From: Cris Di Sclafani Date: Fri, 7 Aug 2020 10:57:54 +0000 (+0200) Subject: Built motion from commit (unavailable).|2.5.0 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.openchannel?a=commitdiff_plain;h=496ae191f30140700d5e8e8ca626e609687a9732;p=motion2.git Built motion from commit (unavailable).|2.5.0 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 1eb5dfa..6bc7923 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -1 +1 @@ -define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-07T10:39:19.939Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); +define({ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-07T10:51:20.915Z", "url": "http://apidocjs.com", "version": "0.19.0" } }); diff --git a/apidoc/api_project.json b/apidoc/api_project.json index 93edfc8..a68e631 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -1 +1 @@ -{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-07T10:39:19.939Z", "url": "http://apidocjs.com", "version": "0.19.0" } } +{ "name": "xCALLY Motion API", "version": "2.5.0", "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-08-07T10:51:20.915Z", "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 70cbc5b..0236698 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 _0x8357=['sequelize','exports','VIRTUAL','getDataValue','action','contactManager','integration','jscripty','bot','STRING','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','motionbar[NULL,NULL,WinAppArguments]','TEXT'];(function(_0x477ab3,_0x297dc5){var _0x100884=function(_0x520a92){while(--_0x520a92){_0x477ab3['push'](_0x477ab3['shift']());}};_0x100884(++_0x297dc5);}(_0x8357,0x152));var _0x7835=function(_0x294667,_0x240fb9){_0x294667=_0x294667-0x0;var _0x528394=_0x8357[_0x294667];return _0x528394;};'use strict';var Sequelize=require(_0x7835('0x0'));module[_0x7835('0x1')]={'name':{'type':Sequelize[_0x7835('0x2')],'get':function(_0x45c08d){return this[_0x7835('0x3')](_0x7835('0x4'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x7835('0x5'),_0x7835('0x6'),'motionbar',_0x7835('0x7'),'urlForward','browser',_0x7835('0x8'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x7835('0x9')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x7835('0x9')](0x1000),'comment':_0x7835('0xa')},'data3':{'type':Sequelize[_0x7835('0x9')](0x1000),'comment':_0x7835('0xb')},'data4':{'type':Sequelize[_0x7835('0x9')](0x1000)},'data5':{'type':Sequelize['STRING'](0x1000)},'data6':{'type':Sequelize['STRING']},'data7':{'type':Sequelize[_0x7835('0xc')]}}; \ No newline at end of file +var _0x0009=['STRING','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]','TEXT','sequelize','exports','getDataValue','action'];(function(_0x3b5049,_0x495a94){var _0x12454e=function(_0x3988d3){while(--_0x3988d3){_0x3b5049['push'](_0x3b5049['shift']());}};_0x12454e(++_0x495a94);}(_0x0009,0x161));var _0x9000=function(_0x188360,_0x3d93f8){_0x188360=_0x188360-0x0;var _0x1fbe6d=_0x0009[_0x188360];return _0x1fbe6d;};'use strict';var Sequelize=require(_0x9000('0x0'));module[_0x9000('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x193f4d){return this[_0x9000('0x2')](_0x9000('0x3'));}},'action':{'type':Sequelize[_0x9000('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x9000('0x5'),_0x9000('0x6'),_0x9000('0x7'),_0x9000('0x8'),_0x9000('0x9'),_0x9000('0xa'),_0x9000('0xb'),_0x9000('0xc')]],'msg':_0x9000('0xd')}},'comment':_0x9000('0xd')},'data1':{'type':Sequelize[_0x9000('0x4')](0x1000),'comment':_0x9000('0xe')},'data2':{'type':Sequelize[_0x9000('0x4')](0x1000),'comment':_0x9000('0xf')},'data3':{'type':Sequelize[_0x9000('0x4')](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x9000('0x4')](0x1000)},'data5':{'type':Sequelize[_0x9000('0x4')](0x1000)},'data6':{'type':Sequelize[_0x9000('0x4')]},'data7':{'type':Sequelize[_0x9000('0x10')]}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 4562fed..17ac1b8 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 _0x2fe4=['find','params','then','catch','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','destroy','error','send','body','Action'];(function(_0x11cdca,_0xcb2bb7){var _0x2a483c=function(_0x271f77){while(--_0x271f77){_0x11cdca['push'](_0x11cdca['shift']());}};_0x2a483c(++_0xcb2bb7);}(_0x2fe4,0x131));var _0x42fe=function(_0x1a5529,_0x196832){_0x1a5529=_0x1a5529-0x0;var _0x5af82f=_0x2fe4[_0x1a5529];return _0x5af82f;};'use strict';var pdf=require(_0x42fe('0x0'));var emlformat=require(_0x42fe('0x1'));var rimraf=require(_0x42fe('0x2'));var zipdir=require(_0x42fe('0x3'));var jsonpatch=require(_0x42fe('0x4'));var rp=require('request-promise');var moment=require(_0x42fe('0x5'));var BPromise=require(_0x42fe('0x6'));var Mustache=require('mustache');var util=require(_0x42fe('0x7'));var path=require(_0x42fe('0x8'));var sox=require(_0x42fe('0x9'));var csv=require(_0x42fe('0xa'));var ejs=require(_0x42fe('0xb'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x42fe('0xc'));var deskjs=require(_0x42fe('0xd'));var toCsv=require(_0x42fe('0xa'));var querystring=require(_0x42fe('0xe'));var Papa=require('papaparse');var Redis=require(_0x42fe('0xf'));var authService=require(_0x42fe('0x10'));var qs=require(_0x42fe('0x11'));var as=require(_0x42fe('0x12'));var hardwareService=require(_0x42fe('0x13'));var logger=require(_0x42fe('0x14'))(_0x42fe('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x42fe('0x16'))['db'];function respondWithStatusCode(_0x10218a,_0x15e9ab){_0x15e9ab=_0x15e9ab||0xcc;return function(_0x43eabd){if(_0x43eabd){return _0x10218a[_0x42fe('0x17')](_0x15e9ab);}return _0x10218a[_0x42fe('0x18')](_0x15e9ab)[_0x42fe('0x19')]();};}function respondWithResult(_0x2c7757,_0x45b4e6){_0x45b4e6=_0x45b4e6||0xc8;return function(_0x5f5a5f){if(_0x5f5a5f){return _0x2c7757[_0x42fe('0x18')](_0x45b4e6)[_0x42fe('0x1a')](_0x5f5a5f);}};}function respondWithFilteredResult(_0x41c9fe,_0x5e45f0){return function(_0x512970){if(_0x512970){var _0x2606ab=_0x512970[_0x42fe('0x1b')],_0x104126=_0x5e45f0[_0x42fe('0x1c')],_0x2bbf8b=_0x5e45f0[_0x42fe('0x1c')]+_0x5e45f0['limit'],_0x240741;if(_0x2bbf8b>=_0x2606ab){_0x2bbf8b=_0x2606ab;_0x240741=0xc8;}else{_0x240741=0xce;}_0x41c9fe[_0x42fe('0x18')](_0x240741);return _0x41c9fe[_0x42fe('0x1d')](_0x42fe('0x1e'),_0x104126+'-'+_0x2bbf8b+'/'+_0x2606ab)[_0x42fe('0x1a')](_0x512970);}return null;};}function patchUpdates(_0xd720ed){return function(_0x2b658f){try{jsonpatch[_0x42fe('0x1f')](_0x2b658f,_0xd720ed,!![]);}catch(_0x53ec88){return BPromise[_0x42fe('0x20')](_0x53ec88);}return _0x2b658f['save']();};}function saveUpdates(_0x3552fd,_0x2f86f8){return function(_0x3636b7){if(_0x3636b7){return _0x3636b7[_0x42fe('0x21')](_0x3552fd)['then'](function(_0x2758bf){return _0x2758bf;});}return null;};}function removeEntity(_0x47f14f,_0x365e04){return function(_0x194955){if(_0x194955){return _0x194955[_0x42fe('0x22')]()['then'](function(){_0x47f14f[_0x42fe('0x18')](0xcc)[_0x42fe('0x19')]();});}};}function handleEntityNotFound(_0xeca895,_0xdfe6a7){return function(_0x37dcb5){if(!_0x37dcb5){_0xeca895[_0x42fe('0x17')](0x194);}return _0x37dcb5;};}function handleError(_0x219bc0,_0x481e97){_0x481e97=_0x481e97||0x1f4;return function(_0x24c5f6){logger[_0x42fe('0x23')](_0x24c5f6['stack']);if(_0x24c5f6['name']){delete _0x24c5f6['name'];}_0x219bc0[_0x42fe('0x18')](_0x481e97)[_0x42fe('0x24')](_0x24c5f6);};}exports['update']=function(_0x416e03,_0x1f96b7){if(_0x416e03[_0x42fe('0x25')]['id']){delete _0x416e03[_0x42fe('0x25')]['id'];}return db[_0x42fe('0x26')][_0x42fe('0x27')]({'where':{'id':_0x416e03[_0x42fe('0x28')]['id']}})['then'](handleEntityNotFound(_0x1f96b7,null))[_0x42fe('0x29')](saveUpdates(_0x416e03[_0x42fe('0x25')],null))[_0x42fe('0x29')](respondWithResult(_0x1f96b7,null))[_0x42fe('0x2a')](handleError(_0x1f96b7,null));};exports['destroy']=function(_0x24c8a4,_0x2c4b4b){return db[_0x42fe('0x26')][_0x42fe('0x27')]({'where':{'id':_0x24c8a4[_0x42fe('0x28')]['id']}})[_0x42fe('0x29')](handleEntityNotFound(_0x2c4b4b,null))[_0x42fe('0x29')](removeEntity(_0x2c4b4b,null))[_0x42fe('0x2a')](handleError(_0x2c4b4b,null));}; \ No newline at end of file +var _0x3a98=['catch','find','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/environment','../../mysqldb','status','end','json','offset','limit','set','save','update','destroy','then','sendStatus','error','name','send','body','Action'];(function(_0x2e77c3,_0x578abc){var _0x5c8666=function(_0x34ff41){while(--_0x34ff41){_0x2e77c3['push'](_0x2e77c3['shift']());}};_0x5c8666(++_0x578abc);}(_0x3a98,0x1e6));var _0x83a9=function(_0x29ae80,_0x3579f1){_0x29ae80=_0x29ae80-0x0;var _0x5d6d71=_0x3a98[_0x29ae80];return _0x5d6d71;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x83a9('0x0'));var zipdir=require(_0x83a9('0x1'));var jsonpatch=require(_0x83a9('0x2'));var rp=require(_0x83a9('0x3'));var moment=require(_0x83a9('0x4'));var BPromise=require(_0x83a9('0x5'));var Mustache=require(_0x83a9('0x6'));var util=require(_0x83a9('0x7'));var path=require(_0x83a9('0x8'));var sox=require(_0x83a9('0x9'));var csv=require(_0x83a9('0xa'));var ejs=require(_0x83a9('0xb'));var fs=require('fs');var _=require(_0x83a9('0xc'));var squel=require(_0x83a9('0xd'));var crypto=require(_0x83a9('0xe'));var jsforce=require(_0x83a9('0xf'));var deskjs=require(_0x83a9('0x10'));var toCsv=require(_0x83a9('0xa'));var querystring=require(_0x83a9('0x11'));var Papa=require(_0x83a9('0x12'));var Redis=require(_0x83a9('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x83a9('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x83a9('0x15'));var logger=require(_0x83a9('0x16'))(_0x83a9('0x17'));var utils=require('../../config/utils');var config=require(_0x83a9('0x18'));var db=require(_0x83a9('0x19'))['db'];function respondWithStatusCode(_0x4634d7,_0xd0b270){_0xd0b270=_0xd0b270||0xcc;return function(_0x1b70d0){if(_0x1b70d0){return _0x4634d7['sendStatus'](_0xd0b270);}return _0x4634d7[_0x83a9('0x1a')](_0xd0b270)[_0x83a9('0x1b')]();};}function respondWithResult(_0x25526d,_0x291a8b){_0x291a8b=_0x291a8b||0xc8;return function(_0x246180){if(_0x246180){return _0x25526d[_0x83a9('0x1a')](_0x291a8b)[_0x83a9('0x1c')](_0x246180);}};}function respondWithFilteredResult(_0x34eb83,_0x4910a6){return function(_0x11110f){if(_0x11110f){var _0x1da4fc=_0x11110f['count'],_0x7b985a=_0x4910a6[_0x83a9('0x1d')],_0x26db79=_0x4910a6[_0x83a9('0x1d')]+_0x4910a6[_0x83a9('0x1e')],_0x405686;if(_0x26db79>=_0x1da4fc){_0x26db79=_0x1da4fc;_0x405686=0xc8;}else{_0x405686=0xce;}_0x34eb83[_0x83a9('0x1a')](_0x405686);return _0x34eb83[_0x83a9('0x1f')]('Content-Range',_0x7b985a+'-'+_0x26db79+'/'+_0x1da4fc)[_0x83a9('0x1c')](_0x11110f);}return null;};}function patchUpdates(_0x219bba){return function(_0x33edce){try{jsonpatch['apply'](_0x33edce,_0x219bba,!![]);}catch(_0x22fdf0){return BPromise['reject'](_0x22fdf0);}return _0x33edce[_0x83a9('0x20')]();};}function saveUpdates(_0xd7b4e5,_0x1f3f22){return function(_0x3cc55b){if(_0x3cc55b){return _0x3cc55b[_0x83a9('0x21')](_0xd7b4e5)['then'](function(_0x50b463){return _0x50b463;});}return null;};}function removeEntity(_0x59b5c9,_0x2bc17f){return function(_0x3f051f){if(_0x3f051f){return _0x3f051f[_0x83a9('0x22')]()[_0x83a9('0x23')](function(){_0x59b5c9[_0x83a9('0x1a')](0xcc)[_0x83a9('0x1b')]();});}};}function handleEntityNotFound(_0x3fd736,_0x328ea2){return function(_0x49f497){if(!_0x49f497){_0x3fd736[_0x83a9('0x24')](0x194);}return _0x49f497;};}function handleError(_0x1b9629,_0x1d91f9){_0x1d91f9=_0x1d91f9||0x1f4;return function(_0x495621){logger[_0x83a9('0x25')](_0x495621['stack']);if(_0x495621[_0x83a9('0x26')]){delete _0x495621[_0x83a9('0x26')];}_0x1b9629['status'](_0x1d91f9)[_0x83a9('0x27')](_0x495621);};}exports['update']=function(_0xf4e16a,_0x444c5a){if(_0xf4e16a[_0x83a9('0x28')]['id']){delete _0xf4e16a[_0x83a9('0x28')]['id'];}return db[_0x83a9('0x29')]['find']({'where':{'id':_0xf4e16a['params']['id']}})[_0x83a9('0x23')](handleEntityNotFound(_0x444c5a,null))[_0x83a9('0x23')](saveUpdates(_0xf4e16a[_0x83a9('0x28')],null))[_0x83a9('0x23')](respondWithResult(_0x444c5a,null))[_0x83a9('0x2a')](handleError(_0x444c5a,null));};exports[_0x83a9('0x22')]=function(_0x5bef46,_0x5c4393){return db[_0x83a9('0x29')][_0x83a9('0x2b')]({'where':{'id':_0x5bef46['params']['id']}})[_0x83a9('0x23')](handleEntityNotFound(_0x5c4393,null))[_0x83a9('0x23')](removeEntity(_0x5c4393,null))[_0x83a9('0x2a')](handleError(_0x5c4393,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index f850939..1f05dba 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 _0xd17a=['request-promise','path','../../config/environment','./action.attributes','exports','define','Action','tools_actions','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5e79ca,_0x2e34a4){var _0x1873c6=function(_0x4c1496){while(--_0x4c1496){_0x5e79ca['push'](_0x5e79ca['shift']());}};_0x1873c6(++_0x2e34a4);}(_0xd17a,0xcb));var _0xad17=function(_0xdb27ce,_0x21e4f6){_0xdb27ce=_0xdb27ce-0x0;var _0x2a9fcb=_0xd17a[_0xdb27ce];return _0x2a9fcb;};'use strict';var _=require(_0xad17('0x0'));var util=require(_0xad17('0x1'));var logger=require(_0xad17('0x2'))('api');var moment=require(_0xad17('0x3'));var BPromise=require(_0xad17('0x4'));var rp=require(_0xad17('0x5'));var fs=require('fs');var path=require(_0xad17('0x6'));var rimraf=require('rimraf');var config=require(_0xad17('0x7'));var attributes=require(_0xad17('0x8'));module[_0xad17('0x9')]=function(_0x260bb0,_0x14834b){return _0x260bb0[_0xad17('0xa')](_0xad17('0xb'),attributes,{'tableName':_0xad17('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4ce9=['define','Action','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4ce9,0x7a));var _0x94ce=function(_0x5eae78,_0x43249a){_0x5eae78=_0x5eae78-0x0;var _0x512edb=_0x4ce9[_0x5eae78];return _0x512edb;};'use strict';var _=require(_0x94ce('0x0'));var util=require(_0x94ce('0x1'));var logger=require(_0x94ce('0x2'))('api');var moment=require(_0x94ce('0x3'));var BPromise=require(_0x94ce('0x4'));var rp=require(_0x94ce('0x5'));var fs=require('fs');var path=require(_0x94ce('0x6'));var rimraf=require(_0x94ce('0x7'));var config=require(_0x94ce('0x8'));var attributes=require(_0x94ce('0x9'));module['exports']=function(_0x547b14,_0x58cd11){return _0x547b14[_0x94ce('0xa')](_0x94ce('0xb'),attributes,{'tableName':'tools_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/action/action.rpc.js b/server/api/action/action.rpc.js index ef6cfee..a4d4d41 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x4975d7,_0x1b03f7){var _0x4d6d5b=function(_0x59c521){while(--_0x59c521){_0x4975d7['push'](_0x4975d7['shift']());}};_0x4d6d5b(++_0x1b03f7);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x125ff8,_0x41925f){_0x125ff8=_0x125ff8-0x0;var _0x2d9ef=_0xcb91[_0x125ff8];return _0x2d9ef;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s'];(function(_0x525212,_0x59e111){var _0x136566=function(_0x35942d){while(--_0x35942d){_0x525212['push'](_0x525212['shift']());}};_0x136566(++_0x59e111);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x510c60,_0x50247e){_0x510c60=_0x510c60-0x0;var _0x49c4aa=_0xcb91[_0x510c60];return _0x49c4aa;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('Action,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index e31c85c..4bca2b7 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 _0xcb76=['../../config/environment','./action.controller','put','update','delete','/:id','isAuthenticated','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0xdc7173,_0x381f4e){var _0xf21379=function(_0x16fa98){while(--_0x16fa98){_0xdc7173['push'](_0xdc7173['shift']());}};_0xf21379(++_0x381f4e);}(_0xcb76,0x15d));var _0x6cb7=function(_0x40bffc,_0x3a45d7){_0x40bffc=_0x40bffc-0x0;var _0x3007e9=_0xcb76[_0x40bffc];return _0x3007e9;};'use strict';var multer=require(_0x6cb7('0x0'));var util=require(_0x6cb7('0x1'));var path=require(_0x6cb7('0x2'));var timeout=require(_0x6cb7('0x3'));var express=require(_0x6cb7('0x4'));var router=express[_0x6cb7('0x5')]();var auth=require(_0x6cb7('0x6'));var interaction=require(_0x6cb7('0x7'));var config=require(_0x6cb7('0x8'));var controller=require(_0x6cb7('0x9'));router[_0x6cb7('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x6cb7('0xb')]);router[_0x6cb7('0xc')](_0x6cb7('0xd'),auth[_0x6cb7('0xe')](),controller[_0x6cb7('0xf')]);module[_0x6cb7('0x10')]=router; \ No newline at end of file +var _0x4422=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','multer','util','path'];(function(_0x367c83,_0xb7f3f5){var _0x28ae2c=function(_0x32fda9){while(--_0x32fda9){_0x367c83['push'](_0x367c83['shift']());}};_0x28ae2c(++_0xb7f3f5);}(_0x4422,0x19d));var _0x2442=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x4422[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x2442('0x0'));var util=require(_0x2442('0x1'));var path=require(_0x2442('0x2'));var timeout=require(_0x2442('0x3'));var express=require(_0x2442('0x4'));var router=express[_0x2442('0x5')]();var auth=require(_0x2442('0x6'));var interaction=require(_0x2442('0x7'));var config=require(_0x2442('0x8'));var controller=require(_0x2442('0x9'));router[_0x2442('0xa')](_0x2442('0xb'),auth[_0x2442('0xc')](),controller[_0x2442('0xd')]);router[_0x2442('0xe')](_0x2442('0xb'),auth['isAuthenticated'](),controller[_0x2442('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 47eab0a..f2b0f49 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 _0xf60b=['exports','STRING','TEXT','sequelize'];(function(_0x2eb07d,_0x42b119){var _0x331e78=function(_0x3b12eb){while(--_0x3b12eb){_0x2eb07d['push'](_0x2eb07d['shift']());}};_0x331e78(++_0x42b119);}(_0xf60b,0x1ab));var _0xbf60=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xf60b[_0xac151d];return _0x111dba;};'use strict';var Sequelize=require(_0xbf60('0x0'));module[_0xbf60('0x1')]={'name':{'type':Sequelize[_0xbf60('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xbf60('0x2')]},'parent':{'type':Sequelize[_0xbf60('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0xbf60('0x3')]},'joins':{'type':Sequelize[_0xbf60('0x3')]}}; \ No newline at end of file +var _0xa0c2=['sequelize','exports','STRING','TEXT'];(function(_0x5cc00b,_0x3ba7a2){var _0x577d67=function(_0x83bc4){while(--_0x83bc4){_0x5cc00b['push'](_0x5cc00b['shift']());}};_0x577d67(++_0x3ba7a2);}(_0xa0c2,0xe4));var _0x2a0c=function(_0x4164ab,_0x46b3be){_0x4164ab=_0x4164ab-0x0;var _0x4f7810=_0xa0c2[_0x4164ab];return _0x4f7810;};'use strict';var Sequelize=require(_0x2a0c('0x0'));module[_0x2a0c('0x1')]={'name':{'type':Sequelize[_0x2a0c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x2a0c('0x2')]},'parent':{'type':Sequelize['STRING']},'table':{'type':Sequelize[_0x2a0c('0x2')]},'conditions':{'type':Sequelize[_0x2a0c('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 4d4cd00..f2d8ae2 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 _0x9451=['api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','update','then','get','CustomReports','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','fields','attributes','length','order','sort','where','pick','filter','VIRTUAL','options','AnalyticCustomReport','includeAll','rows','show','params','include','merge','find','create','body','user','role','Reports','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','replace','format','orderBy','DESC','alias','joins','parse','includes','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','HOUR(%s)','ROUND(%s)','IS\x20NULL','Please\x20insert\x20at\x20least\x20one\x20field','findAll','groupBy','No\x20available\x20data','web','%s-%s.%s','randomstring','generate','output','csv','custom','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','runReport','rimraf','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3ff4a3,_0xa5bfa6){var _0x38676f=function(_0x3ab2b1){while(--_0x3ab2b1){_0x3ff4a3['push'](_0x3ff4a3['shift']());}};_0x38676f(++_0xa5bfa6);}(_0x9451,0x1da));var _0x1945=function(_0x5da68b,_0x16711d){_0x5da68b=_0x5da68b-0x0;var _0x5e7393=_0x9451[_0x5da68b];return _0x5e7393;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1945('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1945('0x1'));var moment=require(_0x1945('0x2'));var BPromise=require(_0x1945('0x3'));var Mustache=require('mustache');var util=require(_0x1945('0x4'));var path=require(_0x1945('0x5'));var sox=require(_0x1945('0x6'));var csv=require('to-csv');var ejs=require(_0x1945('0x7'));var fs=require('fs');var _=require(_0x1945('0x8'));var squel=require(_0x1945('0x9'));var crypto=require(_0x1945('0xa'));var jsforce=require(_0x1945('0xb'));var deskjs=require(_0x1945('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1945('0xd'));var authService=require(_0x1945('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x1945('0xf'));var hardwareService=require(_0x1945('0x10'));var logger=require(_0x1945('0x11'))(_0x1945('0x12'));var utils=require('../../config/utils');var config=require(_0x1945('0x13'));var db=require(_0x1945('0x14'))['db'];function respondWithStatusCode(_0x23ff31,_0x14ad63){_0x14ad63=_0x14ad63||0xcc;return function(_0x13ed91){if(_0x13ed91){return _0x23ff31[_0x1945('0x15')](_0x14ad63);}return _0x23ff31[_0x1945('0x16')](_0x14ad63)[_0x1945('0x17')]();};}function respondWithResult(_0x188703,_0x195476){_0x195476=_0x195476||0xc8;return function(_0x3765da){if(_0x3765da){return _0x188703['status'](_0x195476)['json'](_0x3765da);}};}function respondWithFilteredResult(_0x4c4ba8,_0x60008){return function(_0x55eaae){if(_0x55eaae){var _0xdb92e2=_0x55eaae[_0x1945('0x18')],_0xc628b1=_0x60008[_0x1945('0x19')],_0x520b41=_0x60008[_0x1945('0x19')]+_0x60008[_0x1945('0x1a')],_0x5d944c;if(_0x520b41>=_0xdb92e2){_0x520b41=_0xdb92e2;_0x5d944c=0xc8;}else{_0x5d944c=0xce;}_0x4c4ba8[_0x1945('0x16')](_0x5d944c);return _0x4c4ba8[_0x1945('0x1b')](_0x1945('0x1c'),_0xc628b1+'-'+_0x520b41+'/'+_0xdb92e2)[_0x1945('0x1d')](_0x55eaae);}return null;};}function patchUpdates(_0x3f576e){return function(_0x485401){try{jsonpatch['apply'](_0x485401,_0x3f576e,!![]);}catch(_0x184ffe){return BPromise[_0x1945('0x1e')](_0x184ffe);}return _0x485401['save']();};}function saveUpdates(_0x17f297,_0x314c82){return function(_0x1b8d6c){if(_0x1b8d6c){return _0x1b8d6c[_0x1945('0x1f')](_0x17f297)[_0x1945('0x20')](function(_0x1b645b){return _0x1b645b;});}return null;};}function removeEntity(_0x549c56,_0x3d8ba1){return function(_0x340609){if(_0x340609){return _0x340609['destroy']()[_0x1945('0x20')](function(){var _0x2a9b69=_0x340609[_0x1945('0x21')]({'plain':!![]});var _0x1d19ac=_0x1945('0x22');return db['UserProfileResource'][_0x1945('0x23')]({'where':{'type':_0x1d19ac,'resourceId':_0x2a9b69['id']}})[_0x1945('0x20')](function(){return _0x340609;});})['then'](function(){_0x549c56[_0x1945('0x16')](0xcc)[_0x1945('0x17')]();});}};}function handleEntityNotFound(_0xbaedfe,_0x99d83e){return function(_0x3dbb19){if(!_0x3dbb19){_0xbaedfe[_0x1945('0x15')](0x194);}return _0x3dbb19;};}function handleError(_0x43a374,_0x186c5c){_0x186c5c=_0x186c5c||0x1f4;return function(_0x5bd6a0){logger[_0x1945('0x24')](_0x5bd6a0[_0x1945('0x25')]);if(_0x5bd6a0[_0x1945('0x26')]){delete _0x5bd6a0['name'];}_0x43a374[_0x1945('0x16')](_0x186c5c)[_0x1945('0x27')](_0x5bd6a0);};}exports[_0x1945('0x28')]=function(_0x103e34,_0x56b463){var _0xa7d9c0={},_0x2e8f4f={},_0x35f681={'count':0x0,'rows':[]};var _0x334ad5=_[_0x1945('0x29')](db['AnalyticCustomReport'][_0x1945('0x2a')],function(_0xbd2315){return{'name':_0xbd2315[_0x1945('0x2b')],'type':_0xbd2315[_0x1945('0x2c')][_0x1945('0x2d')]};});_0x2e8f4f['model']=_[_0x1945('0x29')](_0x334ad5,_0x1945('0x26'));_0x2e8f4f['query']=_[_0x1945('0x2e')](_0x103e34[_0x1945('0x2f')]);_0x2e8f4f[_0x1945('0x30')]=_[_0x1945('0x31')](_0x2e8f4f[_0x1945('0x32')],_0x2e8f4f[_0x1945('0x2f')]);_0xa7d9c0['attributes']=_['intersection'](_0x2e8f4f[_0x1945('0x32')],qs[_0x1945('0x33')](_0x103e34[_0x1945('0x2f')][_0x1945('0x33')]));_0xa7d9c0[_0x1945('0x34')]=_0xa7d9c0[_0x1945('0x34')][_0x1945('0x35')]?_0xa7d9c0['attributes']:_0x2e8f4f[_0x1945('0x32')];if(!_0x103e34[_0x1945('0x2f')]['hasOwnProperty']('nolimit')){_0xa7d9c0[_0x1945('0x1a')]=qs['limit'](_0x103e34[_0x1945('0x2f')][_0x1945('0x1a')]);_0xa7d9c0[_0x1945('0x19')]=qs['offset'](_0x103e34[_0x1945('0x2f')]['offset']);}_0xa7d9c0[_0x1945('0x36')]=qs['sort'](_0x103e34['query'][_0x1945('0x37')]);_0xa7d9c0[_0x1945('0x38')]=qs[_0x1945('0x30')](_[_0x1945('0x39')](_0x103e34[_0x1945('0x2f')],_0x2e8f4f[_0x1945('0x30')]));if(_0x103e34['query'][_0x1945('0x3a')]){_0xa7d9c0['where']=_['merge'](_0xa7d9c0[_0x1945('0x38')],{'$or':_[_0x1945('0x29')](_0x334ad5,function(_0x5e0c07){if(_0x5e0c07[_0x1945('0x2c')]!==_0x1945('0x3b')){var _0x598d44={};_0x598d44[_0x5e0c07[_0x1945('0x26')]]={'$like':'%'+_0x103e34[_0x1945('0x2f')][_0x1945('0x3a')]+'%'};return _0x598d44;}})});}_0xa7d9c0=_['merge']({},_0xa7d9c0,_0x103e34[_0x1945('0x3c')]);var _0x13565a={'where':_0xa7d9c0[_0x1945('0x38')]};return db[_0x1945('0x3d')][_0x1945('0x18')](_0x13565a)[_0x1945('0x20')](function(_0x6d3cd2){_0x35f681[_0x1945('0x18')]=_0x6d3cd2;if(_0x103e34['query'][_0x1945('0x3e')]){_0xa7d9c0['include']=[{'all':!![]}];}return db[_0x1945('0x3d')]['findAll'](_0xa7d9c0);})[_0x1945('0x20')](function(_0x1cae31){_0x35f681[_0x1945('0x3f')]=_0x1cae31;return _0x35f681;})[_0x1945('0x20')](respondWithFilteredResult(_0x56b463,_0xa7d9c0))['catch'](handleError(_0x56b463,null));};exports[_0x1945('0x40')]=function(_0x3a69eb,_0x111006){var _0x157a43={'raw':![],'where':{'id':_0x3a69eb[_0x1945('0x41')]['id']}},_0x1d621b={};_0x1d621b[_0x1945('0x32')]=_[_0x1945('0x2e')](db['AnalyticCustomReport'][_0x1945('0x2a')]);_0x1d621b[_0x1945('0x2f')]=_[_0x1945('0x2e')](_0x3a69eb['query']);_0x1d621b['filters']=_[_0x1945('0x31')](_0x1d621b[_0x1945('0x32')],_0x1d621b['query']);_0x157a43[_0x1945('0x34')]=_['intersection'](_0x1d621b[_0x1945('0x32')],qs['fields'](_0x3a69eb[_0x1945('0x2f')][_0x1945('0x33')]));_0x157a43[_0x1945('0x34')]=_0x157a43[_0x1945('0x34')][_0x1945('0x35')]?_0x157a43['attributes']:_0x1d621b['model'];if(_0x3a69eb[_0x1945('0x2f')][_0x1945('0x3e')]){_0x157a43[_0x1945('0x42')]=[{'all':!![]}];}_0x157a43=_[_0x1945('0x43')]({},_0x157a43,_0x3a69eb[_0x1945('0x3c')]);return db[_0x1945('0x3d')][_0x1945('0x44')](_0x157a43)['then'](handleEntityNotFound(_0x111006,null))[_0x1945('0x20')](respondWithResult(_0x111006,null))['catch'](handleError(_0x111006,null));};exports[_0x1945('0x45')]=function(_0x2a76cc,_0xea474c){return db[_0x1945('0x3d')]['create'](_0x2a76cc[_0x1945('0x46')],{})[_0x1945('0x20')](function(_0x467fd2){var _0x26f8d7=_0x2a76cc[_0x1945('0x47')][_0x1945('0x21')]({'plain':!![]});if(!_0x26f8d7)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26f8d7[_0x1945('0x48')]===_0x1945('0x47')){var _0x4bed6e=_0x467fd2['get']({'plain':!![]});var _0x3ee556=_0x1945('0x49');return db[_0x1945('0x4a')]['find']({'where':{'name':_0x3ee556,'userProfileId':_0x26f8d7[_0x1945('0x4b')]},'raw':!![]})['then'](function(_0x1cf2da){if(_0x1cf2da&&_0x1cf2da[_0x1945('0x4c')]===0x0){return db[_0x1945('0x4d')][_0x1945('0x45')]({'name':_0x4bed6e[_0x1945('0x26')],'resourceId':_0x4bed6e['id'],'type':'CustomReports','sectionId':_0x1cf2da['id']},{})['then'](function(){return _0x467fd2;});}else{return _0x467fd2;}})[_0x1945('0x4e')](function(_0x423b8e){logger[_0x1945('0x24')](_0x1945('0x4f'),_0x423b8e);throw _0x423b8e;});}return _0x467fd2;})[_0x1945('0x20')](respondWithResult(_0xea474c,0xc9))[_0x1945('0x4e')](handleError(_0xea474c,null));};exports[_0x1945('0x1f')]=function(_0x477f84,_0x35d62c){if(_0x477f84[_0x1945('0x46')]['id']){delete _0x477f84[_0x1945('0x46')]['id'];}return db[_0x1945('0x3d')][_0x1945('0x44')]({'where':{'id':_0x477f84[_0x1945('0x41')]['id']}})[_0x1945('0x20')](handleEntityNotFound(_0x35d62c,null))[_0x1945('0x20')](saveUpdates(_0x477f84[_0x1945('0x46')],null))[_0x1945('0x20')](respondWithResult(_0x35d62c,null))['catch'](handleError(_0x35d62c,null));};exports[_0x1945('0x23')]=function(_0x1ae118,_0x4e716d){return db[_0x1945('0x3d')][_0x1945('0x44')]({'where':{'id':_0x1ae118[_0x1945('0x41')]['id']}})[_0x1945('0x20')](handleEntityNotFound(_0x4e716d,null))[_0x1945('0x20')](removeEntity(_0x4e716d,null))[_0x1945('0x4e')](handleError(_0x4e716d,null));};exports[_0x1945('0x50')]=function(_0x3fd2bd,_0x885354){var _0x501bd7=0xa;var _0xa03e2b=[_0x1945('0x51'),'left_join',_0x1945('0x52'),_0x1945('0x53')];var _0x13bfe8={'SUM':_0x1945('0x54'),'COUNT':_0x1945('0x55'),'COUNT DISTINCT':_0x1945('0x56'),'MAX':_0x1945('0x57'),'MIN':_0x1945('0x58'),'AVG':_0x1945('0x59'),'GROUP_CONCAT':_0x1945('0x5a'),'GROUP_CONCAT ASC':_0x1945('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x543e08={'SEC_TO_TIME':_0x1945('0x5c'),'DATE':_0x1945('0x5d'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x1945('0x5e')};var _0x438bba=function(_0x1d84f7){return!_['includes'](['IS\x20NULL',_0x1945('0x5f'),_0x1945('0x60'),_0x1945('0x61')],_0x1d84f7);};var _0x9e2ecc=function(_0x6c2533){if(!_0x6c2533||!_0x6c2533[_0x1945('0x62')][_0x1945('0x35')]){return'';}for(var _0x286c21='(',_0x36b6b5=0x0;_0x36b6b5<_0x6c2533[_0x1945('0x62')][_0x1945('0x35')];_0x36b6b5+=0x1){_0x36b6b5>0x0&&(_0x286c21+='\x20'+_0x6c2533[_0x1945('0x63')]+'\x20');_0x286c21+=_0x6c2533['rules'][_0x36b6b5][_0x1945('0x64')]?_0x9e2ecc(_0x6c2533[_0x1945('0x62')][_0x36b6b5][_0x1945('0x64')]):_0x6c2533[_0x1945('0x62')][_0x36b6b5][_0x1945('0x65')]+'\x20'+_0x6c2533[_0x1945('0x62')][_0x36b6b5][_0x1945('0x66')]+(_0x438bba(_0x6c2533['rules'][_0x36b6b5]['condition'])?'\x20'+_0x6c2533[_0x1945('0x62')][_0x36b6b5][_0x1945('0x67')]:'');}return _0x286c21+')';};var _0x21cfb9={'where':{'id':_0x3fd2bd[_0x1945('0x41')]['id']}},_0x17d42f,_0x12963e,_0x335d75,_0x445210,_0x1ffafc;_0x21cfb9=_[_0x1945('0x43')]({},_0x21cfb9,_0x3fd2bd[_0x1945('0x3c')]);return db['AnalyticCustomReport'][_0x1945('0x44')](_0x21cfb9)[_0x1945('0x20')](function(_0xc01db3){if(_0xc01db3){_0x17d42f=_0xc01db3;return _0xc01db3[_0x1945('0x68')]();}return null;})[_0x1945('0x20')](function(_0x3fcc6e){if(_0x3fcc6e){if(!_0x3fcc6e[_0x1945('0x35')]){throw new db[(_0x1945('0x69'))][(_0x1945('0x6a'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x12963e=_0x3fcc6e;return db[_0x1945('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x1945('0x20')](function(_0x9d541b){if(_0x9d541b){_0x335d75=_[_0x1945('0x6c')](_0x9d541b,'id');var _0x519182;var _0x4850c5=squel[_0x1945('0x6d')]();_0x4850c5[_0x1945('0x6e')](_0x17d42f[_0x1945('0x6f')]);for(var _0x3fb8dd=0x0;_0x3fb8dd<_0x12963e[_0x1945('0x35')];_0x3fb8dd+=0x1){_0x519182=_0x12963e[_0x3fb8dd][_0x1945('0x70')]?_0x335d75[_0x12963e[_0x3fb8dd][_0x1945('0x70')]][_0x1945('0x71')]:_0x12963e[_0x3fb8dd][_0x1945('0x65')];_0x519182=_0x12963e[_0x3fb8dd][_0x1945('0x72')]?_[_0x1945('0x73')](_0x13bfe8[_0x12963e[_0x3fb8dd][_0x1945('0x72')]],'%s',_0x519182):_0x519182;_0x519182=_0x12963e[_0x3fb8dd][_0x1945('0x74')]?_[_0x1945('0x73')](_0x543e08[_0x12963e[_0x3fb8dd][_0x1945('0x74')]],'%s',_0x519182):_0x519182;if(_0x12963e[_0x3fb8dd]['groupBy']){_0x4850c5[_0x1945('0x64')](_0x519182);}_0x12963e[_0x3fb8dd]['orderBy']&&_0x4850c5[_0x1945('0x36')](_0x519182,_0x12963e[_0x3fb8dd][_0x1945('0x75')]===_0x1945('0x76')?![]:!![]);_0x4850c5['field'](_0x519182,_0x12963e[_0x3fb8dd][_0x1945('0x77')]||_0x519182);}if(_0x17d42f[_0x1945('0x78')]){_0x17d42f[_0x1945('0x78')]=JSON[_0x1945('0x79')](_0x17d42f['joins']);for(var _0x5f301b=0x0;_0x5f301b<_0x17d42f[_0x1945('0x78')][_0x1945('0x35')];_0x5f301b+=0x1){if(_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x2c')]&&_[_0x1945('0x7a')](_0xa03e2b,_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x2c')])&&_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7b')]&&_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7c')]&&_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7d')]){_0x4850c5[_0x17d42f['joins'][_0x5f301b][_0x1945('0x2c')]](_0x17d42f['joins'][_0x5f301b][_0x1945('0x7c')],null,util[_0x1945('0x74')](_0x1945('0x7e'),_0x17d42f['table'],_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7b')],_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7c')],_0x17d42f[_0x1945('0x78')][_0x5f301b][_0x1945('0x7d')]));}}}if(_0x17d42f['conditions']){_0x17d42f[_0x1945('0x7f')]=JSON['parse'](_0x17d42f[_0x1945('0x7f')]);_0x4850c5[_0x1945('0x38')](_0x9e2ecc(_0x17d42f[_0x1945('0x7f')][_0x1945('0x64')]));}_0x1ffafc=_0x4850c5[_0x1945('0x80')]();_0x4850c5[_0x1945('0x1a')](_0x501bd7);_0x4850c5[_0x1945('0x19')](0x0);logger[_0x1945('0x81')](_0x1945('0x82'),_0x4850c5[_0x1945('0x83')]());return db[_0x1945('0x84')]['query'](_0x4850c5[_0x1945('0x83')](),{'type':db[_0x1945('0x84')][_0x1945('0x85')][_0x1945('0x86')]});}})['then'](respondWithResult(_0x885354,null))[_0x1945('0x4e')](handleError(_0x885354,null));};function runReport(_0x570e8c,_0x26a429,_0x5c93a1){var _0xdb5429=_0x26a429[_0x1945('0x26')];var _0x2464de=0xa;var _0x17d5a5=[_0x1945('0x51'),_0x1945('0x87'),_0x1945('0x52'),_0x1945('0x53')];var _0xd8df45={'SUM':_0x1945('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x1945('0x57'),'MIN':_0x1945('0x58'),'AVG':_0x1945('0x59'),'GROUP_CONCAT':_0x1945('0x5a'),'GROUP_CONCAT ASC':_0x1945('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x425440={'SEC_TO_TIME':_0x1945('0x5c'),'DATE':_0x1945('0x5d'),'HOUR':_0x1945('0x88'),'ROUND':_0x1945('0x89'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1a61da=function(_0x54ce8f){return!_[_0x1945('0x7a')]([_0x1945('0x8a'),_0x1945('0x5f'),_0x1945('0x60'),_0x1945('0x61')],_0x54ce8f);};var _0x493410=function(_0x3a4284){if(!_0x3a4284||!_0x3a4284[_0x1945('0x62')][_0x1945('0x35')]){return'';}for(var _0x342b16='(',_0x3bb493=0x0;_0x3bb493<_0x3a4284[_0x1945('0x62')][_0x1945('0x35')];_0x3bb493+=0x1){_0x3bb493>0x0&&(_0x342b16+='\x20'+_0x3a4284[_0x1945('0x63')]+'\x20');_0x342b16+=_0x3a4284[_0x1945('0x62')][_0x3bb493]['group']?_0x493410(_0x3a4284[_0x1945('0x62')][_0x3bb493][_0x1945('0x64')]):_0x3a4284[_0x1945('0x62')][_0x3bb493][_0x1945('0x65')]+'\x20'+_0x3a4284[_0x1945('0x62')][_0x3bb493][_0x1945('0x66')]+(_0x1a61da(_0x3a4284[_0x1945('0x62')][_0x3bb493]['condition'])?'\x20'+_0x3a4284[_0x1945('0x62')][_0x3bb493][_0x1945('0x67')]:'');}return _0x342b16+')';};var _0x41918a={'where':{'id':_0x570e8c['id']}},_0x54be70,_0x4f0382,_0x1d08a3,_0x4dc46c,_0x586bba;_0x41918a=_[_0x1945('0x43')]({},_0x41918a,_0x5c93a1);return db[_0x1945('0x3d')][_0x1945('0x44')](_0x41918a)[_0x1945('0x20')](function(_0x41a84a){if(_0x41a84a){_0x54be70=_0x41a84a;return _0x41a84a['getFields']();}return null;})[_0x1945('0x20')](function(_0x16d94a){if(_0x16d94a){if(!_0x16d94a[_0x1945('0x35')]){throw new db['Sequelize']['ValidationErrorItem'](_0x1945('0x8b'),0x193);}_0x4f0382=_0x16d94a;return db[_0x1945('0x6b')][_0x1945('0x8c')]({'raw':!![]});}return null;})[_0x1945('0x20')](function(_0x3ff55f){if(_0x3ff55f){_0x1d08a3=_[_0x1945('0x6c')](_0x3ff55f,'id');var _0x2b6a28;var _0x1f7656=squel[_0x1945('0x6d')]();_0x1f7656['from'](_0x54be70[_0x1945('0x6f')]);for(var _0x44060b=0x0;_0x44060b<_0x4f0382[_0x1945('0x35')];_0x44060b+=0x1){_0x2b6a28=_0x4f0382[_0x44060b][_0x1945('0x70')]?_0x1d08a3[_0x4f0382[_0x44060b][_0x1945('0x70')]]['metric']:_0x4f0382[_0x44060b]['field'];_0x2b6a28=_0x4f0382[_0x44060b]['function']?_[_0x1945('0x73')](_0xd8df45[_0x4f0382[_0x44060b][_0x1945('0x72')]],'%s',_0x2b6a28):_0x2b6a28;_0x2b6a28=_0x4f0382[_0x44060b][_0x1945('0x74')]?_[_0x1945('0x73')](_0x425440[_0x4f0382[_0x44060b]['format']],'%s',_0x2b6a28):_0x2b6a28;if(_0x4f0382[_0x44060b][_0x1945('0x8d')]){_0x1f7656[_0x1945('0x64')](_0x2b6a28);}_0x4f0382[_0x44060b][_0x1945('0x75')]&&_0x1f7656[_0x1945('0x36')](_0x2b6a28,_0x4f0382[_0x44060b][_0x1945('0x75')]===_0x1945('0x76')?![]:!![]);_0x1f7656[_0x1945('0x65')](_0x2b6a28,_0x4f0382[_0x44060b][_0x1945('0x77')]||_0x2b6a28);}if(_0x54be70['joins']){_0x54be70[_0x1945('0x78')]=JSON['parse'](_0x54be70[_0x1945('0x78')]);for(var _0x1e35db=0x0;_0x1e35db<_0x54be70[_0x1945('0x78')][_0x1945('0x35')];_0x1e35db+=0x1){if(_0x54be70[_0x1945('0x78')][_0x1e35db][_0x1945('0x2c')]&&_['includes'](_0x17d5a5,_0x54be70['joins'][_0x1e35db][_0x1945('0x2c')])&&_0x54be70[_0x1945('0x78')][_0x1e35db]['parentKey']&&_0x54be70[_0x1945('0x78')][_0x1e35db]['foreignTable']&&_0x54be70[_0x1945('0x78')][_0x1e35db]['foreignKey']){_0x1f7656[_0x54be70[_0x1945('0x78')][_0x1e35db][_0x1945('0x2c')]](_0x54be70[_0x1945('0x78')][_0x1e35db][_0x1945('0x7c')],null,util[_0x1945('0x74')](_0x1945('0x7e'),_0x54be70[_0x1945('0x6f')],_0x54be70[_0x1945('0x78')][_0x1e35db]['parentKey'],_0x54be70[_0x1945('0x78')][_0x1e35db][_0x1945('0x7c')],_0x54be70['joins'][_0x1e35db][_0x1945('0x7d')]));}}}if(_0x54be70['conditions']){_0x54be70[_0x1945('0x7f')]=JSON[_0x1945('0x79')](_0x54be70[_0x1945('0x7f')]);_0x1f7656[_0x1945('0x38')](_0x493410(_0x54be70[_0x1945('0x7f')]['group']));}_0x586bba=_0x1f7656[_0x1945('0x80')]();_0x1f7656['limit'](_0x2464de);_0x1f7656[_0x1945('0x19')](0x0);logger[_0x1945('0x81')](_0x1945('0x82'),_0x1f7656[_0x1945('0x83')]());return db['sequelize'][_0x1945('0x2f')](_0x1f7656[_0x1945('0x83')](),{'type':db[_0x1945('0x84')]['QueryTypes'][_0x1945('0x86')]});}})['then'](function(_0x33e774){if(!_0x33e774['length']){throw new db['Sequelize'][(_0x1945('0x6a'))](_0x1945('0x8e'),0xcc);}if(_0x26a429['output']===_0x1945('0x8f')){return null;}var _0x24b94e=_[_0x1945('0x43')](_0x26a429,{'name':_0x26a429['fullPath']||_0x26a429[_0x1945('0x26')]||_0x54be70['name'],'basename':_0xdb5429,'savename':util[_0x1945('0x74')](_0x1945('0x90'),_0x26a429[_0x1945('0x26')]||_0x54be70[_0x1945('0x26')],require(_0x1945('0x91'))[_0x1945('0x92')](0x4),_0x26a429[_0x1945('0x93')]||_0x1945('0x94')),'reportId':_0x54be70['id'],'reportType':_0x1945('0x95')});return db['AnalyticExtractedReport']['create'](_0x24b94e,{'raw':!![]});})[_0x1945('0x20')](function(_0x27d3db){if(_0x54be70['table']===_0x1945('0x96')){_0x586bba[_0x1945('0x38')](_0x54be70[_0x1945('0x6f')]+_0x1945('0x97'),_0x26a429[_0x1945('0x98')],_0x26a429['endDate']);}else{_0x586bba[_0x1945('0x38')](_0x54be70[_0x1945('0x6f')]+_0x1945('0x99'),_0x26a429[_0x1945('0x98')],_0x26a429[_0x1945('0x9a')]);}if(_0x27d3db){logger[_0x1945('0x9b')](_0x1945('0x9c'),_0x586bba[_0x1945('0x83')]());require(_0x1945('0x9d'))[_0x1945('0x9e')](path[_0x1945('0x51')](__dirname,_0x1945('0x9f'),_0x27d3db[_0x1945('0x93')]),[_0x27d3db['id'],_0x586bba['toString'](),path[_0x1945('0x51')](__dirname,_0x1945('0xa0'),_0x27d3db[_0x1945('0xa1')]),_0xdb5429]);return _0x27d3db;}else{var _0x55f0db=squel[_0x1945('0x6d')]();_0x55f0db[_0x1945('0x6e')]('('+_0x586bba[_0x1945('0x83')]()+')',_0x1945('0xa2'));_0x55f0db[_0x1945('0x65')]('COUNT(*)',_0x1945('0x18'));_0x586bba[_0x1945('0x1a')](_0x26a429[_0x1945('0x1a')]||_0x2464de);_0x586bba[_0x1945('0x19')](_0x26a429[_0x1945('0x19')]||0x0);return db['sequelize'][_0x1945('0x2f')](_0x55f0db[_0x1945('0x83')](),{'type':db[_0x1945('0x84')]['QueryTypes'][_0x1945('0x86')]})[_0x1945('0x20')](function(_0x18f763){if(!_0x18f763[_0x1945('0x35')]){_0x4dc46c=0x0;}else{_0x4dc46c=_0x18f763[0x0]['count']||0x0;}return db[_0x1945('0x84')][_0x1945('0x2f')](_0x586bba[_0x1945('0x83')](),{'type':db[_0x1945('0x84')][_0x1945('0x85')]['SELECT']});})[_0x1945('0x20')](function(_0x228937){return{'rows':_0x228937||[],'count':_0x4dc46c};});}});}exports['run']=function(_0x2da157,_0x42a0bf){return runReport(_0x2da157[_0x1945('0x41')],_0x2da157[_0x1945('0x2f')],_0x2da157[_0x1945('0x3c')])['then'](respondWithResult(_0x42a0bf,null))[_0x1945('0x4e')](handleError(_0x42a0bf,null));};exports[_0x1945('0xa3')]=runReport;exports['query']=function(_0x7d1d82,_0x53ea05){var _0x4817cb=0xa;var _0x5a8941=['join',_0x1945('0x87'),'right_join',_0x1945('0x53')];var _0x5c29bb={'SUM':'SUM(%s)','COUNT':_0x1945('0x55'),'COUNT DISTINCT':_0x1945('0x56'),'MAX':_0x1945('0x57'),'MIN':_0x1945('0x58'),'AVG':_0x1945('0x59'),'GROUP_CONCAT':_0x1945('0x5a'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5aa8bc={'SEC_TO_TIME':_0x1945('0x5c'),'DATE':_0x1945('0x5d'),'HOUR':'HOUR(%s)','ROUND':_0x1945('0x89'),'UNIX_TIMESTAMP':_0x1945('0x5e')};var _0x3c34a0=function(_0x489a02){return!_[_0x1945('0x7a')](['IS\x20NULL',_0x1945('0x5f'),_0x1945('0x60'),_0x1945('0x61')],_0x489a02);};var _0x35fdbb=function(_0x16a740){if(!_0x16a740||!_0x16a740['rules'][_0x1945('0x35')]){return'';}for(var _0x502eaa='(',_0x94023d=0x0;_0x94023d<_0x16a740[_0x1945('0x62')][_0x1945('0x35')];_0x94023d+=0x1){_0x94023d>0x0&&(_0x502eaa+='\x20'+_0x16a740[_0x1945('0x63')]+'\x20');_0x502eaa+=_0x16a740[_0x1945('0x62')][_0x94023d]['group']?_0x35fdbb(_0x16a740[_0x1945('0x62')][_0x94023d][_0x1945('0x64')]):_0x16a740['rules'][_0x94023d][_0x1945('0x65')]+'\x20'+_0x16a740[_0x1945('0x62')][_0x94023d][_0x1945('0x66')]+(_0x3c34a0(_0x16a740[_0x1945('0x62')][_0x94023d][_0x1945('0x66')])?'\x20'+_0x16a740[_0x1945('0x62')][_0x94023d][_0x1945('0x67')]:'');}return _0x502eaa+')';};var _0x4f6000={'where':{'id':_0x7d1d82[_0x1945('0x41')]['id']}},_0x211ad0,_0x475bcd,_0x5584e8,_0x5a292d,_0x4a79ba;_0x4f6000=_['merge']({},_0x4f6000,_0x7d1d82[_0x1945('0x3c')]);return db[_0x1945('0x3d')][_0x1945('0x44')](_0x4f6000)[_0x1945('0x20')](function(_0x16aaf7){if(_0x16aaf7){_0x211ad0=_0x16aaf7;return _0x16aaf7[_0x1945('0x68')]();}return null;})['then'](function(_0x1907d0){if(_0x1907d0){if(!_0x1907d0[_0x1945('0x35')]){throw new db[(_0x1945('0x69'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x475bcd=_0x1907d0;return db[_0x1945('0x6b')][_0x1945('0x8c')]({'raw':!![]});}return null;})[_0x1945('0x20')](function(_0x4e8558){if(_0x4e8558){_0x5584e8=_[_0x1945('0x6c')](_0x4e8558,'id');var _0x533c2c;var _0x3d18dc=squel[_0x1945('0x6d')]();_0x3d18dc['from'](_0x211ad0[_0x1945('0x6f')]);for(var _0x440f29=0x0;_0x440f29<_0x475bcd['length'];_0x440f29+=0x1){_0x533c2c=_0x475bcd[_0x440f29][_0x1945('0x70')]?_0x5584e8[_0x475bcd[_0x440f29][_0x1945('0x70')]]['metric']:_0x475bcd[_0x440f29]['field'];_0x533c2c=_0x475bcd[_0x440f29]['function']?_['replace'](_0x5c29bb[_0x475bcd[_0x440f29]['function']],'%s',_0x533c2c):_0x533c2c;_0x533c2c=_0x475bcd[_0x440f29][_0x1945('0x74')]?_[_0x1945('0x73')](_0x5aa8bc[_0x475bcd[_0x440f29]['format']],'%s',_0x533c2c):_0x533c2c;if(_0x475bcd[_0x440f29]['groupBy']){_0x3d18dc['group'](_0x533c2c);}_0x475bcd[_0x440f29][_0x1945('0x75')]&&_0x3d18dc[_0x1945('0x36')](_0x533c2c,_0x475bcd[_0x440f29][_0x1945('0x75')]===_0x1945('0x76')?![]:!![]);_0x3d18dc['field'](_0x533c2c,_0x475bcd[_0x440f29]['alias']||_0x533c2c);}if(_0x211ad0[_0x1945('0x78')]){_0x211ad0[_0x1945('0x78')]=JSON['parse'](_0x211ad0['joins']);for(var _0x41f4b6=0x0;_0x41f4b6<_0x211ad0[_0x1945('0x78')]['length'];_0x41f4b6+=0x1){if(_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x2c')]&&_[_0x1945('0x7a')](_0x5a8941,_0x211ad0[_0x1945('0x78')][_0x41f4b6]['type'])&&_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7b')]&&_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7c')]&&_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7d')]){_0x3d18dc[_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x2c')]](_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7c')],null,util['format'](_0x1945('0x7e'),_0x211ad0[_0x1945('0x6f')],_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7b')],_0x211ad0[_0x1945('0x78')][_0x41f4b6][_0x1945('0x7c')],_0x211ad0[_0x1945('0x78')][_0x41f4b6]['foreignKey']));}}}if(_0x211ad0[_0x1945('0x7f')]){_0x211ad0[_0x1945('0x7f')]=JSON[_0x1945('0x79')](_0x211ad0[_0x1945('0x7f')]);_0x3d18dc[_0x1945('0x38')](_0x35fdbb(_0x211ad0[_0x1945('0x7f')]['group']));}_0x4a79ba=_0x3d18dc[_0x1945('0x80')]();_0x3d18dc[_0x1945('0x1a')](_0x4817cb);_0x3d18dc[_0x1945('0x19')](0x0);logger['debug'](_0x1945('0x82'),_0x3d18dc[_0x1945('0x83')]());return db[_0x1945('0x84')][_0x1945('0x2f')](_0x3d18dc[_0x1945('0x83')](),{'type':db[_0x1945('0x84')][_0x1945('0x85')][_0x1945('0x86')]});}})[_0x1945('0x20')](function(){return{'sql':_0x4a79ba[_0x1945('0x83')]()};})[_0x1945('0x20')](respondWithResult(_0x53ea05,null))[_0x1945('0x4e')](handleError(_0x53ea05,null));}; \ No newline at end of file +var _0x0666=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticCustomReport','includeAll','include','findAll','catch','show','params','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','rules','operator','group','condition','value','getFields','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','ValidationErrorItem','%s.%s\x20=\x20%s.%s','debug','No\x20available\x20data','output','web','fullPath','%s-%s.%s','randomstring','generate','csv','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','startDate','info','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','run','runReport','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','Content-Range','save','update','then','CustomReports','UserProfileResource','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model'];(function(_0x43b4e0,_0x7d9828){var _0x34dea2=function(_0x12b2cb){while(--_0x12b2cb){_0x43b4e0['push'](_0x43b4e0['shift']());}};_0x34dea2(++_0x7d9828);}(_0x0666,0x1ca));var _0x6066=function(_0x5c7fd9,_0x189d2b){_0x5c7fd9=_0x5c7fd9-0x0;var _0x5a79b3=_0x0666[_0x5c7fd9];return _0x5a79b3;};'use strict';var pdf=require(_0x6066('0x0'));var emlformat=require(_0x6066('0x1'));var rimraf=require(_0x6066('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6066('0x3'));var rp=require(_0x6066('0x4'));var moment=require(_0x6066('0x5'));var BPromise=require(_0x6066('0x6'));var Mustache=require(_0x6066('0x7'));var util=require(_0x6066('0x8'));var path=require(_0x6066('0x9'));var sox=require(_0x6066('0xa'));var csv=require(_0x6066('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x6066('0xc'));var crypto=require(_0x6066('0xd'));var jsforce=require(_0x6066('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6066('0xf'));var Papa=require('papaparse');var Redis=require(_0x6066('0x10'));var authService=require(_0x6066('0x11'));var qs=require(_0x6066('0x12'));var as=require(_0x6066('0x13'));var hardwareService=require(_0x6066('0x14'));var logger=require(_0x6066('0x15'))(_0x6066('0x16'));var utils=require(_0x6066('0x17'));var config=require(_0x6066('0x18'));var db=require(_0x6066('0x19'))['db'];function respondWithStatusCode(_0x23925d,_0x1dfc92){_0x1dfc92=_0x1dfc92||0xcc;return function(_0x3e55f3){if(_0x3e55f3){return _0x23925d['sendStatus'](_0x1dfc92);}return _0x23925d['status'](_0x1dfc92)[_0x6066('0x1a')]();};}function respondWithResult(_0x4ddfbd,_0x8c5507){_0x8c5507=_0x8c5507||0xc8;return function(_0x30b182){if(_0x30b182){return _0x4ddfbd[_0x6066('0x1b')](_0x8c5507)[_0x6066('0x1c')](_0x30b182);}};}function respondWithFilteredResult(_0x5ca918,_0x2bdce2){return function(_0xfa1740){if(_0xfa1740){var _0xcea280=_0xfa1740['count'],_0xbd94f2=_0x2bdce2['offset'],_0x210f98=_0x2bdce2[_0x6066('0x1d')]+_0x2bdce2[_0x6066('0x1e')],_0x143347;if(_0x210f98>=_0xcea280){_0x210f98=_0xcea280;_0x143347=0xc8;}else{_0x143347=0xce;}_0x5ca918['status'](_0x143347);return _0x5ca918['set'](_0x6066('0x1f'),_0xbd94f2+'-'+_0x210f98+'/'+_0xcea280)[_0x6066('0x1c')](_0xfa1740);}return null;};}function patchUpdates(_0x8d8ff3){return function(_0x5eba6c){try{jsonpatch['apply'](_0x5eba6c,_0x8d8ff3,!![]);}catch(_0x1908fd){return BPromise['reject'](_0x1908fd);}return _0x5eba6c[_0x6066('0x20')]();};}function saveUpdates(_0x3ef1ba,_0x1f7679){return function(_0x521453){if(_0x521453){return _0x521453[_0x6066('0x21')](_0x3ef1ba)[_0x6066('0x22')](function(_0x1a4ff6){return _0x1a4ff6;});}return null;};}function removeEntity(_0x592c2d,_0x4f7177){return function(_0x128e67){if(_0x128e67){return _0x128e67['destroy']()[_0x6066('0x22')](function(){var _0x298731=_0x128e67['get']({'plain':!![]});var _0x3a8f41=_0x6066('0x23');return db[_0x6066('0x24')][_0x6066('0x25')]({'where':{'type':_0x3a8f41,'resourceId':_0x298731['id']}})[_0x6066('0x22')](function(){return _0x128e67;});})['then'](function(){_0x592c2d[_0x6066('0x1b')](0xcc)[_0x6066('0x1a')]();});}};}function handleEntityNotFound(_0x401956,_0x241bf1){return function(_0x11bfd3){if(!_0x11bfd3){_0x401956[_0x6066('0x26')](0x194);}return _0x11bfd3;};}function handleError(_0x4dc285,_0x40b9b5){_0x40b9b5=_0x40b9b5||0x1f4;return function(_0x1db9b7){logger['error'](_0x1db9b7[_0x6066('0x27')]);if(_0x1db9b7[_0x6066('0x28')]){delete _0x1db9b7[_0x6066('0x28')];}_0x4dc285[_0x6066('0x1b')](_0x40b9b5)[_0x6066('0x29')](_0x1db9b7);};}exports[_0x6066('0x2a')]=function(_0xbabdac,_0x136b91){var _0x1b2265={},_0x596da8={},_0x4680a3={'count':0x0,'rows':[]};var _0x30bcc8=_[_0x6066('0x2b')](db['AnalyticCustomReport'][_0x6066('0x2c')],function(_0xf1c5ca){return{'name':_0xf1c5ca[_0x6066('0x2d')],'type':_0xf1c5ca[_0x6066('0x2e')][_0x6066('0x2f')]};});_0x596da8[_0x6066('0x30')]=_['map'](_0x30bcc8,_0x6066('0x28'));_0x596da8[_0x6066('0x31')]=_[_0x6066('0x32')](_0xbabdac[_0x6066('0x31')]);_0x596da8[_0x6066('0x33')]=_[_0x6066('0x34')](_0x596da8['model'],_0x596da8[_0x6066('0x31')]);_0x1b2265[_0x6066('0x35')]=_[_0x6066('0x34')](_0x596da8[_0x6066('0x30')],qs[_0x6066('0x36')](_0xbabdac[_0x6066('0x31')]['fields']));_0x1b2265[_0x6066('0x35')]=_0x1b2265['attributes'][_0x6066('0x37')]?_0x1b2265[_0x6066('0x35')]:_0x596da8[_0x6066('0x30')];if(!_0xbabdac[_0x6066('0x31')][_0x6066('0x38')](_0x6066('0x39'))){_0x1b2265['limit']=qs[_0x6066('0x1e')](_0xbabdac[_0x6066('0x31')]['limit']);_0x1b2265[_0x6066('0x1d')]=qs['offset'](_0xbabdac[_0x6066('0x31')][_0x6066('0x1d')]);}_0x1b2265[_0x6066('0x3a')]=qs[_0x6066('0x3b')](_0xbabdac[_0x6066('0x31')][_0x6066('0x3b')]);_0x1b2265[_0x6066('0x3c')]=qs[_0x6066('0x33')](_[_0x6066('0x3d')](_0xbabdac[_0x6066('0x31')],_0x596da8['filters']));if(_0xbabdac[_0x6066('0x31')][_0x6066('0x3e')]){_0x1b2265['where']=_[_0x6066('0x3f')](_0x1b2265[_0x6066('0x3c')],{'$or':_['map'](_0x30bcc8,function(_0x1325eb){if(_0x1325eb[_0x6066('0x2e')]!==_0x6066('0x40')){var _0x1c73a8={};_0x1c73a8[_0x1325eb['name']]={'$like':'%'+_0xbabdac[_0x6066('0x31')][_0x6066('0x3e')]+'%'};return _0x1c73a8;}})});}_0x1b2265=_['merge']({},_0x1b2265,_0xbabdac[_0x6066('0x41')]);var _0x5ab77f={'where':_0x1b2265[_0x6066('0x3c')]};return db[_0x6066('0x42')]['count'](_0x5ab77f)[_0x6066('0x22')](function(_0x5d310c){_0x4680a3['count']=_0x5d310c;if(_0xbabdac[_0x6066('0x31')][_0x6066('0x43')]){_0x1b2265[_0x6066('0x44')]=[{'all':!![]}];}return db['AnalyticCustomReport'][_0x6066('0x45')](_0x1b2265);})[_0x6066('0x22')](function(_0x273e28){_0x4680a3['rows']=_0x273e28;return _0x4680a3;})[_0x6066('0x22')](respondWithFilteredResult(_0x136b91,_0x1b2265))[_0x6066('0x46')](handleError(_0x136b91,null));};exports[_0x6066('0x47')]=function(_0x7c4532,_0x156555){var _0x5bdaae={'raw':![],'where':{'id':_0x7c4532[_0x6066('0x48')]['id']}},_0xe44741={};_0xe44741[_0x6066('0x30')]=_[_0x6066('0x32')](db['AnalyticCustomReport'][_0x6066('0x2c')]);_0xe44741['query']=_[_0x6066('0x32')](_0x7c4532[_0x6066('0x31')]);_0xe44741['filters']=_['intersection'](_0xe44741[_0x6066('0x30')],_0xe44741['query']);_0x5bdaae[_0x6066('0x35')]=_[_0x6066('0x34')](_0xe44741[_0x6066('0x30')],qs[_0x6066('0x36')](_0x7c4532[_0x6066('0x31')][_0x6066('0x36')]));_0x5bdaae[_0x6066('0x35')]=_0x5bdaae[_0x6066('0x35')][_0x6066('0x37')]?_0x5bdaae[_0x6066('0x35')]:_0xe44741[_0x6066('0x30')];if(_0x7c4532[_0x6066('0x31')][_0x6066('0x43')]){_0x5bdaae[_0x6066('0x44')]=[{'all':!![]}];}_0x5bdaae=_[_0x6066('0x3f')]({},_0x5bdaae,_0x7c4532[_0x6066('0x41')]);return db[_0x6066('0x42')]['find'](_0x5bdaae)[_0x6066('0x22')](handleEntityNotFound(_0x156555,null))[_0x6066('0x22')](respondWithResult(_0x156555,null))[_0x6066('0x46')](handleError(_0x156555,null));};exports[_0x6066('0x49')]=function(_0x456759,_0x3a5322){return db['AnalyticCustomReport']['create'](_0x456759[_0x6066('0x4a')],{})[_0x6066('0x22')](function(_0x2b202d){var _0x307e79=_0x456759[_0x6066('0x4b')][_0x6066('0x4c')]({'plain':!![]});if(!_0x307e79)throw new Error(_0x6066('0x4d'));if(_0x307e79[_0x6066('0x4e')]===_0x6066('0x4b')){var _0x9989a7=_0x2b202d[_0x6066('0x4c')]({'plain':!![]});var _0x5738e2='Reports';return db['UserProfileSection']['find']({'where':{'name':_0x5738e2,'userProfileId':_0x307e79[_0x6066('0x4f')]},'raw':!![]})[_0x6066('0x22')](function(_0xa074fe){if(_0xa074fe&&_0xa074fe[_0x6066('0x50')]===0x0){return db['UserProfileResource'][_0x6066('0x49')]({'name':_0x9989a7[_0x6066('0x28')],'resourceId':_0x9989a7['id'],'type':_0x6066('0x23'),'sectionId':_0xa074fe['id']},{})[_0x6066('0x22')](function(){return _0x2b202d;});}else{return _0x2b202d;}})[_0x6066('0x46')](function(_0x588769){logger['error'](_0x6066('0x51'),_0x588769);throw _0x588769;});}return _0x2b202d;})['then'](respondWithResult(_0x3a5322,0xc9))[_0x6066('0x46')](handleError(_0x3a5322,null));};exports[_0x6066('0x21')]=function(_0x26dcc2,_0x4243f6){if(_0x26dcc2['body']['id']){delete _0x26dcc2[_0x6066('0x4a')]['id'];}return db['AnalyticCustomReport'][_0x6066('0x52')]({'where':{'id':_0x26dcc2[_0x6066('0x48')]['id']}})['then'](handleEntityNotFound(_0x4243f6,null))[_0x6066('0x22')](saveUpdates(_0x26dcc2[_0x6066('0x4a')],null))[_0x6066('0x22')](respondWithResult(_0x4243f6,null))[_0x6066('0x46')](handleError(_0x4243f6,null));};exports[_0x6066('0x25')]=function(_0x5777b5,_0xc0401e){return db[_0x6066('0x42')][_0x6066('0x52')]({'where':{'id':_0x5777b5[_0x6066('0x48')]['id']}})[_0x6066('0x22')](handleEntityNotFound(_0xc0401e,null))[_0x6066('0x22')](removeEntity(_0xc0401e,null))[_0x6066('0x46')](handleError(_0xc0401e,null));};exports[_0x6066('0x53')]=function(_0x5da0c0,_0x2c9d60){var _0x29a8ec=0xa;var _0xb6a8cb=[_0x6066('0x54'),_0x6066('0x55'),_0x6066('0x56'),_0x6066('0x57')];var _0x277338={'SUM':_0x6066('0x58'),'COUNT':_0x6066('0x59'),'COUNT DISTINCT':_0x6066('0x5a'),'MAX':_0x6066('0x5b'),'MIN':_0x6066('0x5c'),'AVG':_0x6066('0x5d'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x6066('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x532410={'SEC_TO_TIME':_0x6066('0x5f'),'DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':_0x6066('0x60'),'UNIX_TIMESTAMP':_0x6066('0x61')};var _0x312efd=function(_0x2478a0){return!_[_0x6066('0x62')]([_0x6066('0x63'),'IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x2478a0);};var _0x556436=function(_0x216f04){if(!_0x216f04||!_0x216f04[_0x6066('0x64')]['length']){return'';}for(var _0x4b76bb='(',_0xf05e33=0x0;_0xf05e33<_0x216f04['rules']['length'];_0xf05e33+=0x1){_0xf05e33>0x0&&(_0x4b76bb+='\x20'+_0x216f04[_0x6066('0x65')]+'\x20');_0x4b76bb+=_0x216f04['rules'][_0xf05e33][_0x6066('0x66')]?_0x556436(_0x216f04[_0x6066('0x64')][_0xf05e33][_0x6066('0x66')]):_0x216f04[_0x6066('0x64')][_0xf05e33]['field']+'\x20'+_0x216f04[_0x6066('0x64')][_0xf05e33][_0x6066('0x67')]+(_0x312efd(_0x216f04[_0x6066('0x64')][_0xf05e33][_0x6066('0x67')])?'\x20'+_0x216f04['rules'][_0xf05e33][_0x6066('0x68')]:'');}return _0x4b76bb+')';};var _0x3e77b4={'where':{'id':_0x5da0c0[_0x6066('0x48')]['id']}},_0x374b6b,_0x4be640,_0x1903d1,_0xad4c7b,_0x27f48d;_0x3e77b4=_[_0x6066('0x3f')]({},_0x3e77b4,_0x5da0c0[_0x6066('0x41')]);return db[_0x6066('0x42')]['find'](_0x3e77b4)['then'](function(_0x489c9a){if(_0x489c9a){_0x374b6b=_0x489c9a;return _0x489c9a[_0x6066('0x69')]();}return null;})[_0x6066('0x22')](function(_0x330ae4){if(_0x330ae4){if(!_0x330ae4[_0x6066('0x37')]){throw new db[(_0x6066('0x6a'))]['ValidationErrorItem'](_0x6066('0x6b'),0x193);}_0x4be640=_0x330ae4;return db[_0x6066('0x6c')][_0x6066('0x45')]({'raw':!![]});}return null;})['then'](function(_0x75cb3d){if(_0x75cb3d){_0x1903d1=_[_0x6066('0x6d')](_0x75cb3d,'id');var _0x2721d9;var _0x2724e8=squel[_0x6066('0x6e')]();_0x2724e8[_0x6066('0x6f')](_0x374b6b[_0x6066('0x70')]);for(var _0x4f6e82=0x0;_0x4f6e82<_0x4be640[_0x6066('0x37')];_0x4f6e82+=0x1){_0x2721d9=_0x4be640[_0x4f6e82][_0x6066('0x71')]?_0x1903d1[_0x4be640[_0x4f6e82]['MetricId']][_0x6066('0x72')]:_0x4be640[_0x4f6e82][_0x6066('0x73')];_0x2721d9=_0x4be640[_0x4f6e82]['function']?_['replace'](_0x277338[_0x4be640[_0x4f6e82][_0x6066('0x74')]],'%s',_0x2721d9):_0x2721d9;_0x2721d9=_0x4be640[_0x4f6e82][_0x6066('0x75')]?_[_0x6066('0x76')](_0x532410[_0x4be640[_0x4f6e82][_0x6066('0x75')]],'%s',_0x2721d9):_0x2721d9;if(_0x4be640[_0x4f6e82][_0x6066('0x77')]){_0x2724e8[_0x6066('0x66')](_0x2721d9);}_0x4be640[_0x4f6e82][_0x6066('0x78')]&&_0x2724e8[_0x6066('0x3a')](_0x2721d9,_0x4be640[_0x4f6e82][_0x6066('0x78')]===_0x6066('0x79')?![]:!![]);_0x2724e8[_0x6066('0x73')](_0x2721d9,_0x4be640[_0x4f6e82][_0x6066('0x7a')]||_0x2721d9);}if(_0x374b6b[_0x6066('0x7b')]){_0x374b6b[_0x6066('0x7b')]=JSON[_0x6066('0x7c')](_0x374b6b[_0x6066('0x7b')]);for(var _0x82f01=0x0;_0x82f01<_0x374b6b[_0x6066('0x7b')][_0x6066('0x37')];_0x82f01+=0x1){if(_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x2e')]&&_[_0x6066('0x62')](_0xb6a8cb,_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x2e')])&&_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7d')]&&_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7e')]&&_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7f')]){_0x2724e8[_0x374b6b['joins'][_0x82f01][_0x6066('0x2e')]](_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7e')],null,util[_0x6066('0x75')]('%s.%s\x20=\x20%s.%s',_0x374b6b['table'],_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7d')],_0x374b6b['joins'][_0x82f01][_0x6066('0x7e')],_0x374b6b[_0x6066('0x7b')][_0x82f01][_0x6066('0x7f')]));}}}if(_0x374b6b[_0x6066('0x80')]){_0x374b6b[_0x6066('0x80')]=JSON[_0x6066('0x7c')](_0x374b6b[_0x6066('0x80')]);_0x2724e8['where'](_0x556436(_0x374b6b['conditions'][_0x6066('0x66')]));}_0x27f48d=_0x2724e8[_0x6066('0x81')]();_0x2724e8[_0x6066('0x1e')](_0x29a8ec);_0x2724e8[_0x6066('0x1d')](0x0);logger['debug'](_0x6066('0x82'),_0x2724e8[_0x6066('0x83')]());return db[_0x6066('0x84')][_0x6066('0x31')](_0x2724e8[_0x6066('0x83')](),{'type':db[_0x6066('0x84')][_0x6066('0x85')][_0x6066('0x86')]});}})[_0x6066('0x22')](respondWithResult(_0x2c9d60,null))[_0x6066('0x46')](handleError(_0x2c9d60,null));};function runReport(_0x4c4874,_0x5d0e0c,_0x33d53a){var _0x35b0a2=_0x5d0e0c[_0x6066('0x28')];var _0x5d2f49=0xa;var _0xf0c7ad=[_0x6066('0x54'),_0x6066('0x55'),_0x6066('0x56'),_0x6066('0x57')];var _0x38e34b={'SUM':_0x6066('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6066('0x5a'),'MAX':_0x6066('0x5b'),'MIN':_0x6066('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x6066('0x87'),'GROUP_CONCAT ASC':_0x6066('0x5e'),'GROUP_CONCAT DESC':_0x6066('0x88')};var _0x1f9a32={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x6066('0x89'),'HOUR':_0x6066('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x6066('0x61')};var _0x49ebba=function(_0x403ba1){return!_[_0x6066('0x62')](['IS\x20NULL',_0x6066('0x8b'),_0x6066('0x8c'),_0x6066('0x8d')],_0x403ba1);};var _0x588968=function(_0x1d3a1d){if(!_0x1d3a1d||!_0x1d3a1d[_0x6066('0x64')][_0x6066('0x37')]){return'';}for(var _0x3c1f0f='(',_0x6c7d08=0x0;_0x6c7d08<_0x1d3a1d[_0x6066('0x64')][_0x6066('0x37')];_0x6c7d08+=0x1){_0x6c7d08>0x0&&(_0x3c1f0f+='\x20'+_0x1d3a1d[_0x6066('0x65')]+'\x20');_0x3c1f0f+=_0x1d3a1d[_0x6066('0x64')][_0x6c7d08][_0x6066('0x66')]?_0x588968(_0x1d3a1d[_0x6066('0x64')][_0x6c7d08][_0x6066('0x66')]):_0x1d3a1d[_0x6066('0x64')][_0x6c7d08]['field']+'\x20'+_0x1d3a1d[_0x6066('0x64')][_0x6c7d08][_0x6066('0x67')]+(_0x49ebba(_0x1d3a1d['rules'][_0x6c7d08][_0x6066('0x67')])?'\x20'+_0x1d3a1d[_0x6066('0x64')][_0x6c7d08]['value']:'');}return _0x3c1f0f+')';};var _0x454bdb={'where':{'id':_0x4c4874['id']}},_0x7713ad,_0x1ace67,_0x5a61d8,_0x2e8cb0,_0x4b440a;_0x454bdb=_[_0x6066('0x3f')]({},_0x454bdb,_0x33d53a);return db['AnalyticCustomReport'][_0x6066('0x52')](_0x454bdb)[_0x6066('0x22')](function(_0x4c9003){if(_0x4c9003){_0x7713ad=_0x4c9003;return _0x4c9003[_0x6066('0x69')]();}return null;})['then'](function(_0x28d2da){if(_0x28d2da){if(!_0x28d2da['length']){throw new db['Sequelize'][(_0x6066('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1ace67=_0x28d2da;return db[_0x6066('0x6c')][_0x6066('0x45')]({'raw':!![]});}return null;})['then'](function(_0x5ce4e0){if(_0x5ce4e0){_0x5a61d8=_[_0x6066('0x6d')](_0x5ce4e0,'id');var _0xfdb2ea;var _0x2decbe=squel[_0x6066('0x6e')]();_0x2decbe[_0x6066('0x6f')](_0x7713ad[_0x6066('0x70')]);for(var _0x2d0024=0x0;_0x2d0024<_0x1ace67[_0x6066('0x37')];_0x2d0024+=0x1){_0xfdb2ea=_0x1ace67[_0x2d0024]['MetricId']?_0x5a61d8[_0x1ace67[_0x2d0024][_0x6066('0x71')]][_0x6066('0x72')]:_0x1ace67[_0x2d0024][_0x6066('0x73')];_0xfdb2ea=_0x1ace67[_0x2d0024][_0x6066('0x74')]?_[_0x6066('0x76')](_0x38e34b[_0x1ace67[_0x2d0024][_0x6066('0x74')]],'%s',_0xfdb2ea):_0xfdb2ea;_0xfdb2ea=_0x1ace67[_0x2d0024][_0x6066('0x75')]?_['replace'](_0x1f9a32[_0x1ace67[_0x2d0024][_0x6066('0x75')]],'%s',_0xfdb2ea):_0xfdb2ea;if(_0x1ace67[_0x2d0024][_0x6066('0x77')]){_0x2decbe['group'](_0xfdb2ea);}_0x1ace67[_0x2d0024][_0x6066('0x78')]&&_0x2decbe[_0x6066('0x3a')](_0xfdb2ea,_0x1ace67[_0x2d0024][_0x6066('0x78')]===_0x6066('0x79')?![]:!![]);_0x2decbe['field'](_0xfdb2ea,_0x1ace67[_0x2d0024][_0x6066('0x7a')]||_0xfdb2ea);}if(_0x7713ad['joins']){_0x7713ad[_0x6066('0x7b')]=JSON[_0x6066('0x7c')](_0x7713ad[_0x6066('0x7b')]);for(var _0x11b3ee=0x0;_0x11b3ee<_0x7713ad['joins'][_0x6066('0x37')];_0x11b3ee+=0x1){if(_0x7713ad[_0x6066('0x7b')][_0x11b3ee][_0x6066('0x2e')]&&_[_0x6066('0x62')](_0xf0c7ad,_0x7713ad[_0x6066('0x7b')][_0x11b3ee][_0x6066('0x2e')])&&_0x7713ad['joins'][_0x11b3ee][_0x6066('0x7d')]&&_0x7713ad[_0x6066('0x7b')][_0x11b3ee][_0x6066('0x7e')]&&_0x7713ad['joins'][_0x11b3ee]['foreignKey']){_0x2decbe[_0x7713ad[_0x6066('0x7b')][_0x11b3ee]['type']](_0x7713ad[_0x6066('0x7b')][_0x11b3ee]['foreignTable'],null,util['format'](_0x6066('0x8f'),_0x7713ad['table'],_0x7713ad[_0x6066('0x7b')][_0x11b3ee]['parentKey'],_0x7713ad[_0x6066('0x7b')][_0x11b3ee][_0x6066('0x7e')],_0x7713ad['joins'][_0x11b3ee][_0x6066('0x7f')]));}}}if(_0x7713ad[_0x6066('0x80')]){_0x7713ad[_0x6066('0x80')]=JSON['parse'](_0x7713ad[_0x6066('0x80')]);_0x2decbe[_0x6066('0x3c')](_0x588968(_0x7713ad[_0x6066('0x80')][_0x6066('0x66')]));}_0x4b440a=_0x2decbe[_0x6066('0x81')]();_0x2decbe[_0x6066('0x1e')](_0x5d2f49);_0x2decbe[_0x6066('0x1d')](0x0);logger[_0x6066('0x90')](_0x6066('0x82'),_0x2decbe['toString']());return db[_0x6066('0x84')]['query'](_0x2decbe[_0x6066('0x83')](),{'type':db['sequelize'][_0x6066('0x85')]['SELECT']});}})[_0x6066('0x22')](function(_0xc644ac){if(!_0xc644ac[_0x6066('0x37')]){throw new db['Sequelize'][(_0x6066('0x8e'))](_0x6066('0x91'),0xcc);}if(_0x5d0e0c[_0x6066('0x92')]===_0x6066('0x93')){return null;}var _0x4dbd48=_['merge'](_0x5d0e0c,{'name':_0x5d0e0c[_0x6066('0x94')]||_0x5d0e0c[_0x6066('0x28')]||_0x7713ad[_0x6066('0x28')],'basename':_0x35b0a2,'savename':util[_0x6066('0x75')](_0x6066('0x95'),_0x5d0e0c['name']||_0x7713ad[_0x6066('0x28')],require(_0x6066('0x96'))[_0x6066('0x97')](0x4),_0x5d0e0c[_0x6066('0x92')]||_0x6066('0x98')),'reportId':_0x7713ad['id'],'reportType':'custom'});return db[_0x6066('0x99')][_0x6066('0x49')](_0x4dbd48,{'raw':!![]});})[_0x6066('0x22')](function(_0x3383b0){if(_0x7713ad['table']===_0x6066('0x9a')){_0x4b440a['where'](_0x7713ad['table']+_0x6066('0x9b'),_0x5d0e0c['startDate'],_0x5d0e0c[_0x6066('0x9c')]);}else{_0x4b440a[_0x6066('0x3c')](_0x7713ad[_0x6066('0x70')]+_0x6066('0x9d'),_0x5d0e0c[_0x6066('0x9e')],_0x5d0e0c['endDate']);}if(_0x3383b0){logger[_0x6066('0x9f')](_0x6066('0xa0'),_0x4b440a[_0x6066('0x83')]());require(_0x6066('0xa1'))[_0x6066('0xa2')](path['join'](__dirname,_0x6066('0xa3'),_0x3383b0[_0x6066('0x92')]),[_0x3383b0['id'],_0x4b440a[_0x6066('0x83')](),path[_0x6066('0x54')](__dirname,_0x6066('0xa4'),_0x3383b0[_0x6066('0xa5')]),_0x35b0a2]);return _0x3383b0;}else{var _0x5aff51=squel[_0x6066('0x6e')]();_0x5aff51[_0x6066('0x6f')]('('+_0x4b440a['toString']()+')',_0x6066('0xa6'));_0x5aff51['field']('COUNT(*)','count');_0x4b440a[_0x6066('0x1e')](_0x5d0e0c[_0x6066('0x1e')]||_0x5d2f49);_0x4b440a[_0x6066('0x1d')](_0x5d0e0c[_0x6066('0x1d')]||0x0);return db['sequelize']['query'](_0x5aff51[_0x6066('0x83')](),{'type':db['sequelize'][_0x6066('0x85')][_0x6066('0x86')]})['then'](function(_0x36b746){if(!_0x36b746[_0x6066('0x37')]){_0x2e8cb0=0x0;}else{_0x2e8cb0=_0x36b746[0x0]['count']||0x0;}return db[_0x6066('0x84')][_0x6066('0x31')](_0x4b440a[_0x6066('0x83')](),{'type':db[_0x6066('0x84')][_0x6066('0x85')][_0x6066('0x86')]});})[_0x6066('0x22')](function(_0x2f9fe9){return{'rows':_0x2f9fe9||[],'count':_0x2e8cb0};});}});}exports[_0x6066('0xa7')]=function(_0x135b26,_0x4c8f6c){return runReport(_0x135b26[_0x6066('0x48')],_0x135b26[_0x6066('0x31')],_0x135b26[_0x6066('0x41')])[_0x6066('0x22')](respondWithResult(_0x4c8f6c,null))[_0x6066('0x46')](handleError(_0x4c8f6c,null));};exports[_0x6066('0xa8')]=runReport;exports[_0x6066('0x31')]=function(_0x16420a,_0x21ee14){var _0x375c59=0xa;var _0x1ea18b=['join',_0x6066('0x55'),_0x6066('0x56'),'cross_join'];var _0x622701={'SUM':_0x6066('0x58'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x6066('0x5a'),'MAX':_0x6066('0x5b'),'MIN':_0x6066('0x5c'),'AVG':_0x6066('0x5d'),'GROUP_CONCAT':_0x6066('0x87'),'GROUP_CONCAT ASC':_0x6066('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x47740e={'SEC_TO_TIME':_0x6066('0x5f'),'DATE':_0x6066('0x89'),'HOUR':_0x6066('0x8a'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5f140b=function(_0x5ba7c7){return!_[_0x6066('0x62')]([_0x6066('0x63'),_0x6066('0x8b'),_0x6066('0x8c'),_0x6066('0x8d')],_0x5ba7c7);};var _0x5c81e1=function(_0x3c0381){if(!_0x3c0381||!_0x3c0381[_0x6066('0x64')][_0x6066('0x37')]){return'';}for(var _0x512903='(',_0x270584=0x0;_0x270584<_0x3c0381[_0x6066('0x64')]['length'];_0x270584+=0x1){_0x270584>0x0&&(_0x512903+='\x20'+_0x3c0381[_0x6066('0x65')]+'\x20');_0x512903+=_0x3c0381['rules'][_0x270584][_0x6066('0x66')]?_0x5c81e1(_0x3c0381['rules'][_0x270584][_0x6066('0x66')]):_0x3c0381[_0x6066('0x64')][_0x270584][_0x6066('0x73')]+'\x20'+_0x3c0381[_0x6066('0x64')][_0x270584]['condition']+(_0x5f140b(_0x3c0381[_0x6066('0x64')][_0x270584][_0x6066('0x67')])?'\x20'+_0x3c0381[_0x6066('0x64')][_0x270584][_0x6066('0x68')]:'');}return _0x512903+')';};var _0x5f3e85={'where':{'id':_0x16420a['params']['id']}},_0xddf91d,_0x549546,_0x1f30de,_0x1707d5,_0x25c98f;_0x5f3e85=_[_0x6066('0x3f')]({},_0x5f3e85,_0x16420a[_0x6066('0x41')]);return db[_0x6066('0x42')][_0x6066('0x52')](_0x5f3e85)[_0x6066('0x22')](function(_0x319b83){if(_0x319b83){_0xddf91d=_0x319b83;return _0x319b83[_0x6066('0x69')]();}return null;})['then'](function(_0x43d623){if(_0x43d623){if(!_0x43d623[_0x6066('0x37')]){throw new db[(_0x6066('0x6a'))][(_0x6066('0x8e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x549546=_0x43d623;return db[_0x6066('0x6c')][_0x6066('0x45')]({'raw':!![]});}return null;})[_0x6066('0x22')](function(_0x1c2f68){if(_0x1c2f68){_0x1f30de=_[_0x6066('0x6d')](_0x1c2f68,'id');var _0x191cd4;var _0x470d66=squel[_0x6066('0x6e')]();_0x470d66['from'](_0xddf91d[_0x6066('0x70')]);for(var _0x4b152c=0x0;_0x4b152c<_0x549546[_0x6066('0x37')];_0x4b152c+=0x1){_0x191cd4=_0x549546[_0x4b152c][_0x6066('0x71')]?_0x1f30de[_0x549546[_0x4b152c][_0x6066('0x71')]][_0x6066('0x72')]:_0x549546[_0x4b152c][_0x6066('0x73')];_0x191cd4=_0x549546[_0x4b152c][_0x6066('0x74')]?_[_0x6066('0x76')](_0x622701[_0x549546[_0x4b152c][_0x6066('0x74')]],'%s',_0x191cd4):_0x191cd4;_0x191cd4=_0x549546[_0x4b152c][_0x6066('0x75')]?_[_0x6066('0x76')](_0x47740e[_0x549546[_0x4b152c][_0x6066('0x75')]],'%s',_0x191cd4):_0x191cd4;if(_0x549546[_0x4b152c][_0x6066('0x77')]){_0x470d66['group'](_0x191cd4);}_0x549546[_0x4b152c][_0x6066('0x78')]&&_0x470d66[_0x6066('0x3a')](_0x191cd4,_0x549546[_0x4b152c][_0x6066('0x78')]===_0x6066('0x79')?![]:!![]);_0x470d66[_0x6066('0x73')](_0x191cd4,_0x549546[_0x4b152c]['alias']||_0x191cd4);}if(_0xddf91d[_0x6066('0x7b')]){_0xddf91d[_0x6066('0x7b')]=JSON[_0x6066('0x7c')](_0xddf91d['joins']);for(var _0x42e2f5=0x0;_0x42e2f5<_0xddf91d['joins'][_0x6066('0x37')];_0x42e2f5+=0x1){if(_0xddf91d['joins'][_0x42e2f5][_0x6066('0x2e')]&&_[_0x6066('0x62')](_0x1ea18b,_0xddf91d[_0x6066('0x7b')][_0x42e2f5]['type'])&&_0xddf91d['joins'][_0x42e2f5][_0x6066('0x7d')]&&_0xddf91d[_0x6066('0x7b')][_0x42e2f5][_0x6066('0x7e')]&&_0xddf91d[_0x6066('0x7b')][_0x42e2f5][_0x6066('0x7f')]){_0x470d66[_0xddf91d[_0x6066('0x7b')][_0x42e2f5]['type']](_0xddf91d['joins'][_0x42e2f5][_0x6066('0x7e')],null,util[_0x6066('0x75')](_0x6066('0x8f'),_0xddf91d[_0x6066('0x70')],_0xddf91d[_0x6066('0x7b')][_0x42e2f5][_0x6066('0x7d')],_0xddf91d[_0x6066('0x7b')][_0x42e2f5][_0x6066('0x7e')],_0xddf91d[_0x6066('0x7b')][_0x42e2f5][_0x6066('0x7f')]));}}}if(_0xddf91d[_0x6066('0x80')]){_0xddf91d[_0x6066('0x80')]=JSON[_0x6066('0x7c')](_0xddf91d['conditions']);_0x470d66[_0x6066('0x3c')](_0x5c81e1(_0xddf91d[_0x6066('0x80')][_0x6066('0x66')]));}_0x25c98f=_0x470d66[_0x6066('0x81')]();_0x470d66[_0x6066('0x1e')](_0x375c59);_0x470d66[_0x6066('0x1d')](0x0);logger['debug'](_0x6066('0x82'),_0x470d66[_0x6066('0x83')]());return db[_0x6066('0x84')][_0x6066('0x31')](_0x470d66['toString'](),{'type':db['sequelize'][_0x6066('0x85')][_0x6066('0x86')]});}})[_0x6066('0x22')](function(){return{'sql':_0x25c98f[_0x6066('0x83')]()};})[_0x6066('0x22')](respondWithResult(_0x21ee14,null))[_0x6066('0x46')](handleError(_0x21ee14,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index e4ea033..5617820 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 _0xfa32=['analytics_custom_reports','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport'];(function(_0x17b3a0,_0x24e743){var _0x3bb234=function(_0x589579){while(--_0x589579){_0x17b3a0['push'](_0x17b3a0['shift']());}};_0x3bb234(++_0x24e743);}(_0xfa32,0x1dd));var _0x2fa3=function(_0x474de1,_0x5a5427){_0x474de1=_0x474de1-0x0;var _0xa4d9a5=_0xfa32[_0x474de1];return _0xa4d9a5;};'use strict';var _=require(_0x2fa3('0x0'));var util=require(_0x2fa3('0x1'));var logger=require(_0x2fa3('0x2'))(_0x2fa3('0x3'));var moment=require(_0x2fa3('0x4'));var BPromise=require(_0x2fa3('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2fa3('0x6'));var rimraf=require(_0x2fa3('0x7'));var config=require(_0x2fa3('0x8'));var attributes=require(_0x2fa3('0x9'));module[_0x2fa3('0xa')]=function(_0x3f95c0,_0x267448){return _0x3f95c0[_0x2fa3('0xb')](_0x2fa3('0xc'),attributes,{'tableName':_0x2fa3('0xd'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xba5c=['lodash','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports'];(function(_0x43499d,_0x5cf1c6){var _0x1f7f44=function(_0xe57a89){while(--_0xe57a89){_0x43499d['push'](_0x43499d['shift']());}};_0x1f7f44(++_0x5cf1c6);}(_0xba5c,0xfc));var _0xcba5=function(_0x5be5d0,_0x1c6363){_0x5be5d0=_0x5be5d0-0x0;var _0x25d3e3=_0xba5c[_0x5be5d0];return _0x25d3e3;};'use strict';var _=require(_0xcba5('0x0'));var util=require(_0xcba5('0x1'));var logger=require(_0xcba5('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xcba5('0x3'));var fs=require('fs');var path=require(_0xcba5('0x4'));var rimraf=require(_0xcba5('0x5'));var config=require(_0xcba5('0x6'));var attributes=require(_0xcba5('0x7'));module[_0xcba5('0x8')]=function(_0x36ee07,_0x17d52f){return _0x36ee07[_0xcba5('0x9')](_0xcba5('0xa'),attributes,{'tableName':_0xcba5('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.rpc.js b/server/api/analyticCustomReport/analyticCustomReport.rpc.js index 4ab5d40..c4684a0 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 _0x28b0=['info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then'];(function(_0x24f343,_0xa3042){var _0x38230a=function(_0x10c563){while(--_0x10c563){_0x24f343['push'](_0x24f343['shift']());}};_0x38230a(++_0xa3042);}(_0x28b0,0x6d));var _0x028b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x28b0[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x028b('0x0'));var moment=require('moment');var BPromise=require(_0x028b('0x1'));var rs=require(_0x028b('0x2'));var fs=require('fs');var Redis=require(_0x028b('0x3'));var db=require(_0x028b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x028b('0x5'))(_0x028b('0x6'));var config=require(_0x028b('0x7'));var jayson=require(_0x028b('0x8'));var client=jayson[_0x028b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b4e39,_0x21f861,_0x2062bd){return new BPromise(function(_0x5192d8,_0x495d40){return client['request'](_0x3b4e39,_0x2062bd)[_0x028b('0xa')](function(_0x49cbf1){logger[_0x028b('0xb')](_0x028b('0xc'),_0x21f861,_0x028b('0xd'));logger[_0x028b('0xe')](_0x028b('0xf'),_0x21f861,_0x028b('0xd'),JSON['stringify'](_0x49cbf1));if(_0x49cbf1['error']){if(_0x49cbf1[_0x028b('0x10')]['code']===0x1f4){logger[_0x028b('0x10')](_0x028b('0xc'),_0x21f861,_0x49cbf1[_0x028b('0x10')][_0x028b('0x11')]);return _0x495d40(_0x49cbf1[_0x028b('0x10')][_0x028b('0x11')]);}logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x21f861,_0x49cbf1[_0x028b('0x10')][_0x028b('0x11')]);return _0x5192d8(_0x49cbf1[_0x028b('0x10')][_0x028b('0x11')]);}else{logger['info'](_0x028b('0xc'),_0x21f861,'request\x20sent');_0x5192d8(_0x49cbf1[_0x028b('0x12')][_0x028b('0x11')]);}})[_0x028b('0x13')](function(_0x4c1f47){logger[_0x028b('0x10')](_0x028b('0xc'),_0x21f861,_0x4c1f47);_0x495d40(_0x4c1f47);});});} \ No newline at end of file +var _0xf2f8=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4c4ff3,_0x3ed2f6){var _0x1542f1=function(_0x23c5aa){while(--_0x23c5aa){_0x4c4ff3['push'](_0x4c4ff3['shift']());}};_0x1542f1(++_0x3ed2f6);}(_0xf2f8,0x126));var _0x8f2f=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xf2f8[_0x2be8c2];return _0x97f531;};'use strict';var _=require(_0x8f2f('0x0'));var util=require(_0x8f2f('0x1'));var moment=require(_0x8f2f('0x2'));var BPromise=require('bluebird');var rs=require(_0x8f2f('0x3'));var fs=require('fs');var Redis=require(_0x8f2f('0x4'));var db=require(_0x8f2f('0x5'))['db'];var utils=require(_0x8f2f('0x6'));var logger=require('../../config/logger')(_0x8f2f('0x7'));var config=require('../../config/environment');var jayson=require(_0x8f2f('0x8'));var client=jayson[_0x8f2f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x102710,_0x57a3a0,_0x3a9314){return new BPromise(function(_0x3c8923,_0x4a5d89){return client[_0x8f2f('0xa')](_0x102710,_0x3a9314)['then'](function(_0x1a8613){logger['info'](_0x8f2f('0xb'),_0x57a3a0,_0x8f2f('0xc'));logger[_0x8f2f('0xd')](_0x8f2f('0xe'),_0x57a3a0,_0x8f2f('0xc'),JSON[_0x8f2f('0xf')](_0x1a8613));if(_0x1a8613[_0x8f2f('0x10')]){if(_0x1a8613[_0x8f2f('0x10')][_0x8f2f('0x11')]===0x1f4){logger['error']('AnalyticCustomReport,\x20%s,\x20%s',_0x57a3a0,_0x1a8613[_0x8f2f('0x10')]['message']);return _0x4a5d89(_0x1a8613[_0x8f2f('0x10')][_0x8f2f('0x12')]);}logger[_0x8f2f('0x10')](_0x8f2f('0xb'),_0x57a3a0,_0x1a8613['error']['message']);return _0x3c8923(_0x1a8613['error'][_0x8f2f('0x12')]);}else{logger[_0x8f2f('0x13')](_0x8f2f('0xb'),_0x57a3a0,'request\x20sent');_0x3c8923(_0x1a8613[_0x8f2f('0x14')][_0x8f2f('0x12')]);}})[_0x8f2f('0x15')](function(_0x3fcdc6){logger[_0x8f2f('0x10')](_0x8f2f('0xb'),_0x57a3a0,_0x3fcdc6);_0x4a5d89(_0x3fcdc6);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5b1a142..4656365 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 _0xd2a1=['/:id','isAuthenticated','show','/:id/preview','/:id/run','/:id/query','post','put','update','delete','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index'];(function(_0x3e8ebe,_0x248687){var _0xe0eb02=function(_0x9d1023){while(--_0x9d1023){_0x3e8ebe['push'](_0x3e8ebe['shift']());}};_0xe0eb02(++_0x248687);}(_0xd2a1,0x131));var _0x1d2a=function(_0x1ca890,_0x21d0d3){_0x1ca890=_0x1ca890-0x0;var _0x3f8e01=_0xd2a1[_0x1ca890];return _0x3f8e01;};'use strict';var multer=require(_0x1d2a('0x0'));var util=require('util');var path=require(_0x1d2a('0x1'));var timeout=require(_0x1d2a('0x2'));var express=require(_0x1d2a('0x3'));var router=express['Router']();var auth=require(_0x1d2a('0x4'));var interaction=require(_0x1d2a('0x5'));var config=require(_0x1d2a('0x6'));var controller=require(_0x1d2a('0x7'));router[_0x1d2a('0x8')]('/',auth['isAuthenticated'](),controller[_0x1d2a('0x9')]);router['get'](_0x1d2a('0xa'),auth[_0x1d2a('0xb')](),controller[_0x1d2a('0xc')]);router['get'](_0x1d2a('0xd'),auth[_0x1d2a('0xb')](),controller['preview']);router[_0x1d2a('0x8')](_0x1d2a('0xe'),auth[_0x1d2a('0xb')](),controller['run']);router[_0x1d2a('0x8')](_0x1d2a('0xf'),auth[_0x1d2a('0xb')](),controller['query']);router[_0x1d2a('0x10')]('/',auth[_0x1d2a('0xb')](),controller['create']);router[_0x1d2a('0x11')](_0x1d2a('0xa'),auth['isAuthenticated'](),controller[_0x1d2a('0x12')]);router[_0x1d2a('0x13')](_0x1d2a('0xa'),auth[_0x1d2a('0xb')](),controller['destroy']);module[_0x1d2a('0x14')]=router; \ No newline at end of file +var _0x5bcb=['delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','index','get','/:id','isAuthenticated','show','/:id/preview','preview','/:id/run','/:id/query','query','post','put','update'];(function(_0x2bcb4d,_0x1b1d96){var _0x423940=function(_0x28e92e){while(--_0x28e92e){_0x2bcb4d['push'](_0x2bcb4d['shift']());}};_0x423940(++_0x1b1d96);}(_0x5bcb,0x12f));var _0xb5bc=function(_0x5adf2b,_0x1ea3e9){_0x5adf2b=_0x5adf2b-0x0;var _0x2a9399=_0x5bcb[_0x5adf2b];return _0x2a9399;};'use strict';var multer=require(_0xb5bc('0x0'));var util=require(_0xb5bc('0x1'));var path=require(_0xb5bc('0x2'));var timeout=require(_0xb5bc('0x3'));var express=require('express');var router=express[_0xb5bc('0x4')]();var auth=require(_0xb5bc('0x5'));var interaction=require(_0xb5bc('0x6'));var config=require(_0xb5bc('0x7'));var controller=require(_0xb5bc('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xb5bc('0x9')]);router[_0xb5bc('0xa')](_0xb5bc('0xb'),auth[_0xb5bc('0xc')](),controller[_0xb5bc('0xd')]);router[_0xb5bc('0xa')](_0xb5bc('0xe'),auth['isAuthenticated'](),controller[_0xb5bc('0xf')]);router[_0xb5bc('0xa')](_0xb5bc('0x10'),auth[_0xb5bc('0xc')](),controller['run']);router[_0xb5bc('0xa')](_0xb5bc('0x11'),auth['isAuthenticated'](),controller[_0xb5bc('0x12')]);router[_0xb5bc('0x13')]('/',auth[_0xb5bc('0xc')](),controller['create']);router[_0xb5bc('0x14')](_0xb5bc('0xb'),auth[_0xb5bc('0xc')](),controller[_0xb5bc('0x15')]);router[_0xb5bc('0x16')](_0xb5bc('0xb'),auth[_0xb5bc('0xc')](),controller[_0xb5bc('0x17')]);module[_0xb5bc('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0524de2..d7029c3 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 _0x1f30=['STRING','TEXT','sequelize'];(function(_0x5c0a22,_0x3e0eb3){var _0x292d8e=function(_0x28c9e6){while(--_0x28c9e6){_0x5c0a22['push'](_0x5c0a22['shift']());}};_0x292d8e(++_0x3e0eb3);}(_0x1f30,0x191));var _0x01f3=function(_0x3c67d0,_0x432a92){_0x3c67d0=_0x3c67d0-0x0;var _0x12719c=_0x1f30[_0x3c67d0];return _0x12719c;};'use strict';var Sequelize=require(_0x01f3('0x0'));module['exports']={'name':{'type':Sequelize[_0x01f3('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x01f3('0x1')]},'parent':{'type':Sequelize[_0x01f3('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x01f3('0x2')]}}; \ No newline at end of file +var _0xea0d=['exports','STRING','TEXT','sequelize'];(function(_0x35de1b,_0x22335d){var _0xe84c82=function(_0x3c749d){while(--_0x3c749d){_0x35de1b['push'](_0x35de1b['shift']());}};_0xe84c82(++_0x22335d);}(_0xea0d,0x153));var _0xdea0=function(_0x5a7618,_0x3f44c2){_0x5a7618=_0x5a7618-0x0;var _0x12dc65=_0xea0d[_0x5a7618];return _0x12dc65;};'use strict';var Sequelize=require(_0xdea0('0x0'));module[_0xdea0('0x1')]={'name':{'type':Sequelize[_0xdea0('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xdea0('0x2')]},'parent':{'type':Sequelize[_0xdea0('0x2')]},'table':{'type':Sequelize[_0xdea0('0x2')]},'conditions':{'type':Sequelize[_0xdea0('0x3')]},'joins':{'type':Sequelize[_0xdea0('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index bd44d35..acd55a8 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 _0x6687=['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)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','value','Sequelize','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','field','replace','function','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','format','conditions','debug','Limited\x20Query:','toString','sequelize','QueryTypes','join','SUM(%s)','COUNT(DISTINCT\x20%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','merge','getFields','ValidationErrorItem','metric','order','%s.%s\x20=\x20%s.%s','clone','SELECT','No\x20available\x20data','output','web','%s-%s.%s','randomstring','generate','csv','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','Run\x20Query:','child_process','fork','../../components/export/','../../files/reports','savename','countTable','COUNT(*)','MAX(%s)','ROUND(%s)','condition','html-pdf','rimraf','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','DefaultReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','VIRTUAL','options','includeAll','findAll','rows','catch','params','length','include','create','body','user','get','role','Reports','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','left_join','right_join','cross_join','COUNT(%s)'];(function(_0x3ad133,_0x377068){var _0x33b86a=function(_0xda36c2){while(--_0xda36c2){_0x3ad133['push'](_0x3ad133['shift']());}};_0x33b86a(++_0x377068);}(_0x6687,0x18f));var _0x7668=function(_0xfd93ef,_0x1c787a){_0xfd93ef=_0xfd93ef-0x0;var _0x48bccb=_0x6687[_0xfd93ef];return _0x48bccb;};'use strict';var pdf=require(_0x7668('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7668('0x2'));var rp=require(_0x7668('0x3'));var moment=require(_0x7668('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7668('0x5'));var path=require(_0x7668('0x6'));var sox=require(_0x7668('0x7'));var csv=require(_0x7668('0x8'));var ejs=require(_0x7668('0x9'));var fs=require('fs');var _=require(_0x7668('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7668('0xb'));var deskjs=require(_0x7668('0xc'));var toCsv=require(_0x7668('0x8'));var querystring=require('querystring');var Papa=require(_0x7668('0xd'));var Redis=require(_0x7668('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x7668('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7668('0x10'))(_0x7668('0x11'));var utils=require(_0x7668('0x12'));var config=require(_0x7668('0x13'));var db=require(_0x7668('0x14'))['db'];function respondWithStatusCode(_0x4cbec4,_0x502dc6){_0x502dc6=_0x502dc6||0xcc;return function(_0x12c333){if(_0x12c333){return _0x4cbec4[_0x7668('0x15')](_0x502dc6);}return _0x4cbec4['status'](_0x502dc6)[_0x7668('0x16')]();};}function respondWithResult(_0x3d9e56,_0x25fb3d){_0x25fb3d=_0x25fb3d||0xc8;return function(_0x13c7f7){if(_0x13c7f7){return _0x3d9e56[_0x7668('0x17')](_0x25fb3d)[_0x7668('0x18')](_0x13c7f7);}};}function respondWithFilteredResult(_0x49065f,_0x5da1f9){return function(_0x4e24a6){if(_0x4e24a6){var _0x1a2e90=_0x4e24a6[_0x7668('0x19')],_0x58d697=_0x5da1f9['offset'],_0x5e7514=_0x5da1f9[_0x7668('0x1a')]+_0x5da1f9[_0x7668('0x1b')],_0x422b5d;if(_0x5e7514>=_0x1a2e90){_0x5e7514=_0x1a2e90;_0x422b5d=0xc8;}else{_0x422b5d=0xce;}_0x49065f[_0x7668('0x17')](_0x422b5d);return _0x49065f[_0x7668('0x1c')](_0x7668('0x1d'),_0x58d697+'-'+_0x5e7514+'/'+_0x1a2e90)['json'](_0x4e24a6);}return null;};}function patchUpdates(_0x31b265){return function(_0x7a8e9d){try{jsonpatch[_0x7668('0x1e')](_0x7a8e9d,_0x31b265,!![]);}catch(_0x32f8da){return BPromise['reject'](_0x32f8da);}return _0x7a8e9d[_0x7668('0x1f')]();};}function saveUpdates(_0x58ebcf,_0x27941f){return function(_0x239dd0){if(_0x239dd0){return _0x239dd0[_0x7668('0x20')](_0x58ebcf)[_0x7668('0x21')](function(_0x751793){return _0x751793;});}return null;};}function removeEntity(_0x12fafd,_0x24b8ca){return function(_0x175f51){if(_0x175f51){return _0x175f51['destroy']()['then'](function(){var _0x5e0ed8=_0x175f51['get']({'plain':!![]});var _0x5e4242=_0x7668('0x22');return db[_0x7668('0x23')][_0x7668('0x24')]({'where':{'type':_0x5e4242,'resourceId':_0x5e0ed8['id']}})['then'](function(){return _0x175f51;});})[_0x7668('0x21')](function(){_0x12fafd[_0x7668('0x17')](0xcc)[_0x7668('0x16')]();});}};}function handleEntityNotFound(_0x3f3037,_0x5afe0f){return function(_0x55d360){if(!_0x55d360){_0x3f3037['sendStatus'](0x194);}return _0x55d360;};}function handleError(_0x1c59b0,_0x509586){_0x509586=_0x509586||0x1f4;return function(_0x3b5104){logger[_0x7668('0x25')](_0x3b5104[_0x7668('0x26')]);if(_0x3b5104[_0x7668('0x27')]){delete _0x3b5104['name'];}_0x1c59b0[_0x7668('0x17')](_0x509586)[_0x7668('0x28')](_0x3b5104);};}exports['index']=function(_0x4b6913,_0x5ceada){var _0x13a802={},_0x13b4c0={},_0xfa9737={'count':0x0,'rows':[]};var _0x479400=_[_0x7668('0x29')](db[_0x7668('0x2a')][_0x7668('0x2b')],function(_0x55ae22){return{'name':_0x55ae22[_0x7668('0x2c')],'type':_0x55ae22[_0x7668('0x2d')][_0x7668('0x2e')]};});_0x13b4c0[_0x7668('0x2f')]=_[_0x7668('0x29')](_0x479400,_0x7668('0x27'));_0x13b4c0[_0x7668('0x30')]=_[_0x7668('0x31')](_0x4b6913[_0x7668('0x30')]);_0x13b4c0[_0x7668('0x32')]=_[_0x7668('0x33')](_0x13b4c0[_0x7668('0x2f')],_0x13b4c0[_0x7668('0x30')]);_0x13a802['attributes']=_['intersection'](_0x13b4c0['model'],qs[_0x7668('0x34')](_0x4b6913[_0x7668('0x30')][_0x7668('0x34')]));_0x13a802[_0x7668('0x35')]=_0x13a802[_0x7668('0x35')]['length']?_0x13a802['attributes']:_0x13b4c0['model'];if(!_0x4b6913[_0x7668('0x30')]['hasOwnProperty'](_0x7668('0x36'))){_0x13a802[_0x7668('0x1b')]=qs['limit'](_0x4b6913[_0x7668('0x30')][_0x7668('0x1b')]);_0x13a802['offset']=qs[_0x7668('0x1a')](_0x4b6913['query'][_0x7668('0x1a')]);}_0x13a802['order']=qs[_0x7668('0x37')](_0x4b6913[_0x7668('0x30')]['sort']);_0x13a802[_0x7668('0x38')]=qs[_0x7668('0x32')](_[_0x7668('0x39')](_0x4b6913[_0x7668('0x30')],_0x13b4c0[_0x7668('0x32')]));if(_0x4b6913[_0x7668('0x30')][_0x7668('0x3a')]){_0x13a802['where']=_['merge'](_0x13a802[_0x7668('0x38')],{'$or':_[_0x7668('0x29')](_0x479400,function(_0x1b656c){if(_0x1b656c[_0x7668('0x2d')]!==_0x7668('0x3b')){var _0x2c489b={};_0x2c489b[_0x1b656c[_0x7668('0x27')]]={'$like':'%'+_0x4b6913[_0x7668('0x30')]['filter']+'%'};return _0x2c489b;}})});}_0x13a802=_['merge']({},_0x13a802,_0x4b6913[_0x7668('0x3c')]);var _0x4cbd7d={'where':_0x13a802[_0x7668('0x38')]};return db[_0x7668('0x2a')]['count'](_0x4cbd7d)['then'](function(_0x46388a){_0xfa9737[_0x7668('0x19')]=_0x46388a;if(_0x4b6913['query'][_0x7668('0x3d')]){_0x13a802['include']=[{'all':!![]}];}return db[_0x7668('0x2a')][_0x7668('0x3e')](_0x13a802);})[_0x7668('0x21')](function(_0xcea53d){_0xfa9737[_0x7668('0x3f')]=_0xcea53d;return _0xfa9737;})[_0x7668('0x21')](respondWithFilteredResult(_0x5ceada,_0x13a802))[_0x7668('0x40')](handleError(_0x5ceada,null));};exports['show']=function(_0x5f4430,_0x3b86de){var _0x1fcc2c={'raw':!![],'where':{'id':_0x5f4430[_0x7668('0x41')]['id']}},_0x377de6={};_0x377de6[_0x7668('0x2f')]=_['keys'](db[_0x7668('0x2a')][_0x7668('0x2b')]);_0x377de6[_0x7668('0x30')]=_['keys'](_0x5f4430[_0x7668('0x30')]);_0x377de6[_0x7668('0x32')]=_[_0x7668('0x33')](_0x377de6[_0x7668('0x2f')],_0x377de6[_0x7668('0x30')]);_0x1fcc2c['attributes']=_[_0x7668('0x33')](_0x377de6[_0x7668('0x2f')],qs[_0x7668('0x34')](_0x5f4430[_0x7668('0x30')][_0x7668('0x34')]));_0x1fcc2c[_0x7668('0x35')]=_0x1fcc2c['attributes'][_0x7668('0x42')]?_0x1fcc2c[_0x7668('0x35')]:_0x377de6[_0x7668('0x2f')];if(_0x5f4430['query'][_0x7668('0x3d')]){_0x1fcc2c[_0x7668('0x43')]=[{'all':!![]}];}_0x1fcc2c=_['merge']({},_0x1fcc2c,_0x5f4430[_0x7668('0x3c')]);return db[_0x7668('0x2a')]['find'](_0x1fcc2c)['then'](handleEntityNotFound(_0x3b86de,null))[_0x7668('0x21')](respondWithResult(_0x3b86de,null))[_0x7668('0x40')](handleError(_0x3b86de,null));};exports[_0x7668('0x44')]=function(_0x1377f1,_0x261168){return db[_0x7668('0x2a')][_0x7668('0x44')](_0x1377f1[_0x7668('0x45')],{})[_0x7668('0x21')](function(_0x551564){var _0x598561=_0x1377f1[_0x7668('0x46')][_0x7668('0x47')]({'plain':!![]});if(!_0x598561)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x598561[_0x7668('0x48')]===_0x7668('0x46')){var _0x34b43e=_0x551564[_0x7668('0x47')]({'plain':!![]});var _0x4bdf87=_0x7668('0x49');return db[_0x7668('0x4a')][_0x7668('0x4b')]({'where':{'name':_0x4bdf87,'userProfileId':_0x598561[_0x7668('0x4c')]},'raw':!![]})['then'](function(_0x48b95c){if(_0x48b95c&&_0x48b95c[_0x7668('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x34b43e['name'],'resourceId':_0x34b43e['id'],'type':_0x7668('0x22'),'sectionId':_0x48b95c['id']},{})[_0x7668('0x21')](function(){return _0x551564;});}else{return _0x551564;}})[_0x7668('0x40')](function(_0x2cd2db){logger[_0x7668('0x25')](_0x7668('0x4e'),_0x2cd2db);throw _0x2cd2db;});}return _0x551564;})[_0x7668('0x21')](respondWithResult(_0x261168,0xc9))[_0x7668('0x40')](handleError(_0x261168,null));};exports[_0x7668('0x20')]=function(_0x2999fc,_0x191b28){if(_0x2999fc[_0x7668('0x45')]['id']){delete _0x2999fc[_0x7668('0x45')]['id'];}return db[_0x7668('0x2a')][_0x7668('0x4b')]({'where':{'id':_0x2999fc[_0x7668('0x41')]['id']}})[_0x7668('0x21')](handleEntityNotFound(_0x191b28,null))['then'](saveUpdates(_0x2999fc[_0x7668('0x45')],null))[_0x7668('0x21')](respondWithResult(_0x191b28,null))[_0x7668('0x40')](handleError(_0x191b28,null));};exports[_0x7668('0x24')]=function(_0x3b7c67,_0x1a2c0f){return db[_0x7668('0x2a')][_0x7668('0x4b')]({'where':{'id':_0x3b7c67[_0x7668('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a2c0f,null))[_0x7668('0x21')](removeEntity(_0x1a2c0f,null))[_0x7668('0x40')](handleError(_0x1a2c0f,null));};exports[_0x7668('0x4f')]=function(_0x3f7950,_0x45dcdb){var _0x53d84c=0xa;var _0x3a2ba8=['join',_0x7668('0x50'),_0x7668('0x51'),_0x7668('0x52')];var _0x6c344c={'SUM':'SUM(%s)','COUNT':_0x7668('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x7668('0x54'),'AVG':_0x7668('0x55'),'GROUP_CONCAT':_0x7668('0x56'),'GROUP_CONCAT ASC':_0x7668('0x57'),'GROUP_CONCAT DESC':_0x7668('0x58')};var _0x12527b={'SEC_TO_TIME':_0x7668('0x59'),'DATE':_0x7668('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x35039a=function(_0x4dfc58){return!_[_0x7668('0x5b')]([_0x7668('0x5c'),_0x7668('0x5d'),_0x7668('0x5e'),'IS\x20NOT\x20EMPTY'],_0x4dfc58);};var _0x20064d=function(_0x33fcd0){if(!_0x33fcd0||!_0x33fcd0[_0x7668('0x5f')]['length']){return'';}for(var _0x73f6fa='(',_0x500680=0x0;_0x500680<_0x33fcd0[_0x7668('0x5f')][_0x7668('0x42')];_0x500680+=0x1){_0x500680>0x0&&(_0x73f6fa+='\x20'+_0x33fcd0[_0x7668('0x60')]+'\x20');_0x73f6fa+=_0x33fcd0[_0x7668('0x5f')][_0x500680][_0x7668('0x61')]?_0x20064d(_0x33fcd0[_0x7668('0x5f')][_0x500680][_0x7668('0x61')]):_0x33fcd0[_0x7668('0x5f')][_0x500680]['field']+'\x20'+_0x33fcd0[_0x7668('0x5f')][_0x500680]['condition']+(_0x35039a(_0x33fcd0[_0x7668('0x5f')][_0x500680]['condition'])?'\x20'+_0x33fcd0['rules'][_0x500680][_0x7668('0x62')]:'');}return _0x73f6fa+')';};var _0xe3acd0={'where':{'id':_0x3f7950['params']['id']}},_0x25dbac,_0x3905b0,_0x204a35,_0x181965,_0x157efb;_0xe3acd0=_['merge']({},_0xe3acd0,_0x3f7950['options']);return db[_0x7668('0x2a')][_0x7668('0x4b')](_0xe3acd0)[_0x7668('0x21')](function(_0x4e4617){if(_0x4e4617){_0x25dbac=_0x4e4617;return _0x4e4617['getFields']();}return null;})[_0x7668('0x21')](function(_0x51e2f4){if(_0x51e2f4){if(!_0x51e2f4[_0x7668('0x42')]){throw new db[(_0x7668('0x63'))]['ValidationErrorItem'](_0x7668('0x64'),0x193);}_0x3905b0=_0x51e2f4;return db[_0x7668('0x65')][_0x7668('0x3e')]({'raw':!![]});}return null;})['then'](function(_0x5db6ed){if(_0x5db6ed){_0x204a35=_[_0x7668('0x66')](_0x5db6ed,'id');var _0x15f129;var _0xd96e98=squel[_0x7668('0x67')]();_0xd96e98[_0x7668('0x68')](_0x25dbac[_0x7668('0x69')]);for(var _0x28f400=0x0;_0x28f400<_0x3905b0[_0x7668('0x42')];_0x28f400+=0x1){_0x15f129=_0x3905b0[_0x28f400]['MetricId']?_0x204a35[_0x3905b0[_0x28f400][_0x7668('0x6a')]]['metric']:_0x3905b0[_0x28f400][_0x7668('0x6b')];_0x15f129=_0x3905b0[_0x28f400]['function']?_[_0x7668('0x6c')](_0x6c344c[_0x3905b0[_0x28f400][_0x7668('0x6d')]],'%s',_0x15f129):_0x15f129;_0x15f129=_0x3905b0[_0x28f400]['format']?_[_0x7668('0x6c')](_0x12527b[_0x3905b0[_0x28f400]['format']],'%s',_0x15f129):_0x15f129;if(_0x3905b0[_0x28f400][_0x7668('0x6e')]){_0xd96e98['group'](_0x15f129);}_0x3905b0[_0x28f400]['orderBy']&&_0xd96e98['order'](_0x15f129,_0x3905b0[_0x28f400][_0x7668('0x6f')]===_0x7668('0x70')?![]:!![]);_0xd96e98['field'](_0x15f129,_0x3905b0[_0x28f400][_0x7668('0x71')]||_0x15f129);}if(_0x25dbac[_0x7668('0x72')]){_0x25dbac['joins']=JSON[_0x7668('0x73')](_0x25dbac[_0x7668('0x72')]);for(var _0x4b40f7=0x0;_0x4b40f7<_0x25dbac[_0x7668('0x72')][_0x7668('0x42')];_0x4b40f7+=0x1){if(_0x25dbac[_0x7668('0x72')][_0x4b40f7]['type']&&_[_0x7668('0x5b')](_0x3a2ba8,_0x25dbac['joins'][_0x4b40f7][_0x7668('0x2d')])&&_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x74')]&&_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x75')]&&_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x76')]){_0xd96e98[_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x2d')]](_0x25dbac['joins'][_0x4b40f7][_0x7668('0x75')],null,util[_0x7668('0x77')]('%s.%s\x20=\x20%s.%s',_0x25dbac[_0x7668('0x69')],_0x25dbac['joins'][_0x4b40f7][_0x7668('0x74')],_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x75')],_0x25dbac[_0x7668('0x72')][_0x4b40f7][_0x7668('0x76')]));}}}if(_0x25dbac[_0x7668('0x78')]){_0x25dbac['conditions']=JSON[_0x7668('0x73')](_0x25dbac[_0x7668('0x78')]);_0xd96e98[_0x7668('0x38')](_0x20064d(_0x25dbac[_0x7668('0x78')]['group']));}_0x157efb=_0xd96e98['clone']();_0xd96e98['limit'](_0x53d84c);_0xd96e98[_0x7668('0x1a')](0x0);logger[_0x7668('0x79')](_0x7668('0x7a'),_0xd96e98[_0x7668('0x7b')]());return db[_0x7668('0x7c')]['query'](_0xd96e98[_0x7668('0x7b')](),{'type':db[_0x7668('0x7c')][_0x7668('0x7d')]['SELECT']});}})[_0x7668('0x21')](respondWithResult(_0x45dcdb,null))[_0x7668('0x40')](handleError(_0x45dcdb,null));};function runReport(_0x55dd5c,_0xcea9ca,_0x42cba0){var _0x2a5ca8=_0xcea9ca['name'];var _0x191241=0xa;var _0x3494cc=[_0x7668('0x7e'),_0x7668('0x50'),_0x7668('0x51'),'cross_join'];var _0x334a1c={'SUM':_0x7668('0x7f'),'COUNT':_0x7668('0x53'),'COUNT DISTINCT':_0x7668('0x80'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x7668('0x57'),'GROUP_CONCAT DESC':_0x7668('0x58')};var _0x281390={'SEC_TO_TIME':_0x7668('0x59'),'DATE':'DATE(%s)','HOUR':_0x7668('0x81'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x7668('0x82')};var _0x149bca=function(_0x5da0e1){return!_[_0x7668('0x5b')]([_0x7668('0x5c'),_0x7668('0x5d'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x5da0e1);};var _0x58f0c5=function(_0x114913){if(!_0x114913||!_0x114913[_0x7668('0x5f')][_0x7668('0x42')]){return'';}for(var _0x2fa8c6='(',_0x6cd1a0=0x0;_0x6cd1a0<_0x114913[_0x7668('0x5f')]['length'];_0x6cd1a0+=0x1){_0x6cd1a0>0x0&&(_0x2fa8c6+='\x20'+_0x114913[_0x7668('0x60')]+'\x20');_0x2fa8c6+=_0x114913[_0x7668('0x5f')][_0x6cd1a0]['group']?_0x58f0c5(_0x114913['rules'][_0x6cd1a0][_0x7668('0x61')]):_0x114913[_0x7668('0x5f')][_0x6cd1a0][_0x7668('0x6b')]+'\x20'+_0x114913[_0x7668('0x5f')][_0x6cd1a0]['condition']+(_0x149bca(_0x114913[_0x7668('0x5f')][_0x6cd1a0]['condition'])?'\x20'+_0x114913['rules'][_0x6cd1a0]['value']:'');}return _0x2fa8c6+')';};var _0x533f93={'where':{'id':_0x55dd5c['id']}},_0x1ee6e4,_0x3d4bd6,_0x44c367,_0x228748,_0x548329;_0x533f93=_[_0x7668('0x83')]({},_0x533f93,_0x42cba0);return db[_0x7668('0x2a')]['find'](_0x533f93)[_0x7668('0x21')](function(_0x348724){if(_0x348724){_0x1ee6e4=_0x348724;return _0x348724[_0x7668('0x84')]();}return null;})[_0x7668('0x21')](function(_0xb4d7c8){if(_0xb4d7c8){if(!_0xb4d7c8[_0x7668('0x42')]){throw new db[(_0x7668('0x63'))][(_0x7668('0x85'))](_0x7668('0x64'),0x193);}_0x3d4bd6=_0xb4d7c8;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x7668('0x21')](function(_0x58797d){if(_0x58797d){_0x44c367=_['keyBy'](_0x58797d,'id');var _0x251bb6;var _0xd0e524=squel['select']();_0xd0e524[_0x7668('0x68')](_0x1ee6e4[_0x7668('0x69')]);for(var _0x52b78b=0x0;_0x52b78b<_0x3d4bd6[_0x7668('0x42')];_0x52b78b+=0x1){_0x251bb6=_0x3d4bd6[_0x52b78b]['MetricId']?_0x44c367[_0x3d4bd6[_0x52b78b][_0x7668('0x6a')]][_0x7668('0x86')]:_0x3d4bd6[_0x52b78b]['field'];_0x251bb6=_0x3d4bd6[_0x52b78b][_0x7668('0x6d')]?_[_0x7668('0x6c')](_0x334a1c[_0x3d4bd6[_0x52b78b][_0x7668('0x6d')]],'%s',_0x251bb6):_0x251bb6;_0x251bb6=_0x3d4bd6[_0x52b78b]['format']?_['replace'](_0x281390[_0x3d4bd6[_0x52b78b][_0x7668('0x77')]],'%s',_0x251bb6):_0x251bb6;if(_0x3d4bd6[_0x52b78b][_0x7668('0x6e')]){_0xd0e524[_0x7668('0x61')](_0x251bb6);}_0x3d4bd6[_0x52b78b][_0x7668('0x6f')]&&_0xd0e524[_0x7668('0x87')](_0x251bb6,_0x3d4bd6[_0x52b78b][_0x7668('0x6f')]===_0x7668('0x70')?![]:!![]);_0xd0e524[_0x7668('0x6b')](_0x251bb6,_0x3d4bd6[_0x52b78b][_0x7668('0x71')]||_0x251bb6);}if(_0x1ee6e4['joins']){_0x1ee6e4['joins']=JSON['parse'](_0x1ee6e4[_0x7668('0x72')]);for(var _0x27a199=0x0;_0x27a199<_0x1ee6e4[_0x7668('0x72')]['length'];_0x27a199+=0x1){if(_0x1ee6e4[_0x7668('0x72')][_0x27a199][_0x7668('0x2d')]&&_[_0x7668('0x5b')](_0x3494cc,_0x1ee6e4[_0x7668('0x72')][_0x27a199][_0x7668('0x2d')])&&_0x1ee6e4['joins'][_0x27a199][_0x7668('0x74')]&&_0x1ee6e4[_0x7668('0x72')][_0x27a199][_0x7668('0x75')]&&_0x1ee6e4[_0x7668('0x72')][_0x27a199]['foreignKey']){_0xd0e524[_0x1ee6e4['joins'][_0x27a199][_0x7668('0x2d')]](_0x1ee6e4['joins'][_0x27a199][_0x7668('0x75')],null,util['format'](_0x7668('0x88'),_0x1ee6e4[_0x7668('0x69')],_0x1ee6e4['joins'][_0x27a199][_0x7668('0x74')],_0x1ee6e4[_0x7668('0x72')][_0x27a199][_0x7668('0x75')],_0x1ee6e4[_0x7668('0x72')][_0x27a199][_0x7668('0x76')]));}}}if(_0x1ee6e4[_0x7668('0x78')]){_0x1ee6e4[_0x7668('0x78')]=JSON['parse'](_0x1ee6e4[_0x7668('0x78')]);_0xd0e524['where'](_0x58f0c5(_0x1ee6e4[_0x7668('0x78')][_0x7668('0x61')]));}_0x548329=_0xd0e524[_0x7668('0x89')]();_0xd0e524[_0x7668('0x1b')](_0x191241);_0xd0e524[_0x7668('0x1a')](0x0);logger['debug'](_0x7668('0x7a'),_0xd0e524[_0x7668('0x7b')]());return db['sequelize'][_0x7668('0x30')](_0xd0e524['toString'](),{'type':db['sequelize']['QueryTypes'][_0x7668('0x8a')]});}})[_0x7668('0x21')](function(_0x5ae069){if(!_0x5ae069[_0x7668('0x42')]){throw new db[(_0x7668('0x63'))][(_0x7668('0x85'))](_0x7668('0x8b'),0xcc);}if(_0xcea9ca[_0x7668('0x8c')]===_0x7668('0x8d')){return null;}var _0x4d6acb=_['merge'](_0xcea9ca,{'name':_0xcea9ca['fullPath']||_0xcea9ca[_0x7668('0x27')]||_0x1ee6e4['name'],'basename':_0x2a5ca8,'savename':util[_0x7668('0x77')](_0x7668('0x8e'),_0xcea9ca[_0x7668('0x27')]||_0x1ee6e4[_0x7668('0x27')],require(_0x7668('0x8f'))[_0x7668('0x90')](0x4),_0xcea9ca['output']||_0x7668('0x91')),'reportId':_0x1ee6e4['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x7668('0x44')](_0x4d6acb,{'raw':!![]});})[_0x7668('0x21')](function(_0x3b780c){if(_0x1ee6e4['table']==='cdr'){_0x548329['where'](_0x1ee6e4[_0x7668('0x69')]+_0x7668('0x92'),_0xcea9ca[_0x7668('0x93')],_0xcea9ca[_0x7668('0x94')]);}else{_0x548329['where'](_0x1ee6e4[_0x7668('0x69')]+_0x7668('0x95'),_0xcea9ca['startDate'],_0xcea9ca[_0x7668('0x94')]);}if(_0x3b780c){logger['info'](_0x7668('0x96'),_0x548329[_0x7668('0x7b')]());require(_0x7668('0x97'))[_0x7668('0x98')](path[_0x7668('0x7e')](__dirname,_0x7668('0x99'),_0x3b780c['output']),[_0x3b780c['id'],_0x548329[_0x7668('0x7b')](),path['join'](__dirname,_0x7668('0x9a'),_0x3b780c[_0x7668('0x9b')]),_0x2a5ca8]);return _0x3b780c;}else{var _0x34c518=squel[_0x7668('0x67')]();_0x34c518[_0x7668('0x68')]('('+_0x548329[_0x7668('0x7b')]()+')',_0x7668('0x9c'));_0x34c518[_0x7668('0x6b')](_0x7668('0x9d'),_0x7668('0x19'));_0x548329[_0x7668('0x1b')](_0xcea9ca['limit']||_0x191241);_0x548329[_0x7668('0x1a')](_0xcea9ca[_0x7668('0x1a')]||0x0);return db[_0x7668('0x7c')]['query'](_0x34c518['toString'](),{'type':db[_0x7668('0x7c')][_0x7668('0x7d')][_0x7668('0x8a')]})[_0x7668('0x21')](function(_0x1c0947){if(!_0x1c0947[_0x7668('0x42')]){_0x228748=0x0;}else{_0x228748=_0x1c0947[0x0][_0x7668('0x19')]||0x0;}return db[_0x7668('0x7c')][_0x7668('0x30')](_0x548329[_0x7668('0x7b')](),{'type':db[_0x7668('0x7c')][_0x7668('0x7d')][_0x7668('0x8a')]});})[_0x7668('0x21')](function(_0x45a36c){return{'rows':_0x45a36c||[],'count':_0x228748};});}});}exports['run']=function(_0x4ec08d,_0x539770){return runReport(_0x4ec08d[_0x7668('0x41')],_0x4ec08d[_0x7668('0x30')],_0x4ec08d[_0x7668('0x3c')])[_0x7668('0x21')](respondWithResult(_0x539770,null))['catch'](handleError(_0x539770,null));};exports['runReport']=runReport;exports[_0x7668('0x30')]=function(_0x5bb8b5,_0x56029d){var _0x36dc6e=0xa;var _0x1f11a0=[_0x7668('0x7e'),_0x7668('0x50'),_0x7668('0x51'),_0x7668('0x52')];var _0xd417c1={'SUM':_0x7668('0x7f'),'COUNT':_0x7668('0x53'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x7668('0x9e'),'MIN':_0x7668('0x54'),'AVG':_0x7668('0x55'),'GROUP_CONCAT':_0x7668('0x56'),'GROUP_CONCAT ASC':_0x7668('0x57'),'GROUP_CONCAT DESC':_0x7668('0x58')};var _0x1fcfed={'SEC_TO_TIME':_0x7668('0x59'),'DATE':_0x7668('0x5a'),'HOUR':_0x7668('0x81'),'ROUND':_0x7668('0x9f'),'UNIX_TIMESTAMP':_0x7668('0x82')};var _0x266cb3=function(_0x5657b1){return!_[_0x7668('0x5b')](['IS\x20NULL',_0x7668('0x5d'),_0x7668('0x5e'),'IS\x20NOT\x20EMPTY'],_0x5657b1);};var _0x2a5034=function(_0x3db6d5){if(!_0x3db6d5||!_0x3db6d5['rules'][_0x7668('0x42')]){return'';}for(var _0x51fa22='(',_0x1dffc0=0x0;_0x1dffc0<_0x3db6d5[_0x7668('0x5f')]['length'];_0x1dffc0+=0x1){_0x1dffc0>0x0&&(_0x51fa22+='\x20'+_0x3db6d5[_0x7668('0x60')]+'\x20');_0x51fa22+=_0x3db6d5[_0x7668('0x5f')][_0x1dffc0][_0x7668('0x61')]?_0x2a5034(_0x3db6d5[_0x7668('0x5f')][_0x1dffc0][_0x7668('0x61')]):_0x3db6d5[_0x7668('0x5f')][_0x1dffc0][_0x7668('0x6b')]+'\x20'+_0x3db6d5['rules'][_0x1dffc0][_0x7668('0xa0')]+(_0x266cb3(_0x3db6d5[_0x7668('0x5f')][_0x1dffc0]['condition'])?'\x20'+_0x3db6d5[_0x7668('0x5f')][_0x1dffc0][_0x7668('0x62')]:'');}return _0x51fa22+')';};var _0x2d8b72={'where':{'id':_0x5bb8b5['params']['id']}},_0x4ec194,_0x31b34e,_0xfcec8b,_0x3c60f6,_0x1a75c0;_0x2d8b72=_[_0x7668('0x83')]({},_0x2d8b72,_0x5bb8b5[_0x7668('0x3c')]);return db['AnalyticDefaultReport'][_0x7668('0x4b')](_0x2d8b72)[_0x7668('0x21')](function(_0x58376f){if(_0x58376f){_0x4ec194=_0x58376f;return _0x58376f['getFields']();}return null;})['then'](function(_0x3e348c){if(_0x3e348c){if(!_0x3e348c[_0x7668('0x42')]){throw new db[(_0x7668('0x63'))][(_0x7668('0x85'))](_0x7668('0x64'),0x193);}_0x31b34e=_0x3e348c;return db[_0x7668('0x65')]['findAll']({'raw':!![]});}return null;})[_0x7668('0x21')](function(_0x27c0cc){if(_0x27c0cc){_0xfcec8b=_['keyBy'](_0x27c0cc,'id');var _0x36d0f1;var _0x5b0406=squel[_0x7668('0x67')]();_0x5b0406[_0x7668('0x68')](_0x4ec194[_0x7668('0x69')]);for(var _0x1bfc1f=0x0;_0x1bfc1f<_0x31b34e[_0x7668('0x42')];_0x1bfc1f+=0x1){_0x36d0f1=_0x31b34e[_0x1bfc1f][_0x7668('0x6a')]?_0xfcec8b[_0x31b34e[_0x1bfc1f][_0x7668('0x6a')]]['metric']:_0x31b34e[_0x1bfc1f]['field'];_0x36d0f1=_0x31b34e[_0x1bfc1f]['function']?_['replace'](_0xd417c1[_0x31b34e[_0x1bfc1f][_0x7668('0x6d')]],'%s',_0x36d0f1):_0x36d0f1;_0x36d0f1=_0x31b34e[_0x1bfc1f][_0x7668('0x77')]?_[_0x7668('0x6c')](_0x1fcfed[_0x31b34e[_0x1bfc1f][_0x7668('0x77')]],'%s',_0x36d0f1):_0x36d0f1;if(_0x31b34e[_0x1bfc1f]['groupBy']){_0x5b0406[_0x7668('0x61')](_0x36d0f1);}_0x31b34e[_0x1bfc1f][_0x7668('0x6f')]&&_0x5b0406[_0x7668('0x87')](_0x36d0f1,_0x31b34e[_0x1bfc1f][_0x7668('0x6f')]===_0x7668('0x70')?![]:!![]);_0x5b0406[_0x7668('0x6b')](_0x36d0f1,_0x31b34e[_0x1bfc1f][_0x7668('0x71')]||_0x36d0f1);}if(_0x4ec194[_0x7668('0x72')]){_0x4ec194['joins']=JSON[_0x7668('0x73')](_0x4ec194[_0x7668('0x72')]);for(var _0x63d730=0x0;_0x63d730<_0x4ec194['joins'][_0x7668('0x42')];_0x63d730+=0x1){if(_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x2d')]&&_[_0x7668('0x5b')](_0x1f11a0,_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x2d')])&&_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x74')]&&_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x75')]&&_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x76')]){_0x5b0406[_0x4ec194['joins'][_0x63d730][_0x7668('0x2d')]](_0x4ec194['joins'][_0x63d730][_0x7668('0x75')],null,util[_0x7668('0x77')](_0x7668('0x88'),_0x4ec194['table'],_0x4ec194['joins'][_0x63d730]['parentKey'],_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x75')],_0x4ec194[_0x7668('0x72')][_0x63d730][_0x7668('0x76')]));}}}if(_0x4ec194[_0x7668('0x78')]){_0x4ec194[_0x7668('0x78')]=JSON['parse'](_0x4ec194[_0x7668('0x78')]);_0x5b0406[_0x7668('0x38')](_0x2a5034(_0x4ec194[_0x7668('0x78')][_0x7668('0x61')]));}_0x1a75c0=_0x5b0406['clone']();_0x5b0406[_0x7668('0x1b')](_0x36dc6e);_0x5b0406[_0x7668('0x1a')](0x0);logger[_0x7668('0x79')](_0x7668('0x7a'),_0x5b0406[_0x7668('0x7b')]());return db[_0x7668('0x7c')]['query'](_0x5b0406['toString'](),{'type':db[_0x7668('0x7c')][_0x7668('0x7d')]['SELECT']});}})[_0x7668('0x21')](function(){return{'sql':_0x1a75c0[_0x7668('0x7b')]()};})[_0x7668('0x21')](respondWithResult(_0x56029d,null))[_0x7668('0x40')](handleError(_0x56029d,null));}; \ No newline at end of file +var _0xc492=['fullPath','%s-%s.%s','output','csv','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','child_process','savename','countTable','COUNT(*)','SELECT','cross_join','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','destroy','then','get','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','AnalyticDefaultReport','findAll','show','params','find','catch','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','autoAssociation','UserProfileResource','create','DefaultReports','update','body','preview','left_join','right_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','table','conditions','clone','toString','sequelize','QueryTypes','join','GROUP_CONCAT(%s)','SEC_TO_TIME(%s)','debug','Limited\x20Query:','web'];(function(_0x2e7f1e,_0x32f286){var _0x3dffa5=function(_0x920dc5){while(--_0x920dc5){_0x2e7f1e['push'](_0x2e7f1e['shift']());}};_0x3dffa5(++_0x32f286);}(_0xc492,0x146));var _0x2c49=function(_0x353a1b,_0x174214){_0x353a1b=_0x353a1b-0x0;var _0x37e4cc=_0xc492[_0x353a1b];return _0x37e4cc;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2c49('0x0'));var rimraf=require(_0x2c49('0x1'));var zipdir=require(_0x2c49('0x2'));var jsonpatch=require(_0x2c49('0x3'));var rp=require('request-promise');var moment=require(_0x2c49('0x4'));var BPromise=require(_0x2c49('0x5'));var Mustache=require(_0x2c49('0x6'));var util=require(_0x2c49('0x7'));var path=require('path');var sox=require(_0x2c49('0x8'));var csv=require(_0x2c49('0x9'));var ejs=require(_0x2c49('0xa'));var fs=require('fs');var _=require(_0x2c49('0xb'));var squel=require(_0x2c49('0xc'));var crypto=require(_0x2c49('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x2c49('0xe'));var toCsv=require(_0x2c49('0x9'));var querystring=require(_0x2c49('0xf'));var Papa=require('papaparse');var Redis=require(_0x2c49('0x10'));var authService=require(_0x2c49('0x11'));var qs=require(_0x2c49('0x12'));var as=require(_0x2c49('0x13'));var hardwareService=require(_0x2c49('0x14'));var logger=require('../../config/logger')(_0x2c49('0x15'));var utils=require(_0x2c49('0x16'));var config=require(_0x2c49('0x17'));var db=require(_0x2c49('0x18'))['db'];function respondWithStatusCode(_0x540087,_0x419d74){_0x419d74=_0x419d74||0xcc;return function(_0x306ec7){if(_0x306ec7){return _0x540087[_0x2c49('0x19')](_0x419d74);}return _0x540087[_0x2c49('0x1a')](_0x419d74)[_0x2c49('0x1b')]();};}function respondWithResult(_0x2ddcf3,_0x5c04a2){_0x5c04a2=_0x5c04a2||0xc8;return function(_0x1f6984){if(_0x1f6984){return _0x2ddcf3[_0x2c49('0x1a')](_0x5c04a2)[_0x2c49('0x1c')](_0x1f6984);}};}function respondWithFilteredResult(_0x30f45d,_0x479901){return function(_0x3e7c73){if(_0x3e7c73){var _0x48a7d1=_0x3e7c73[_0x2c49('0x1d')],_0x314d35=_0x479901['offset'],_0x4029bc=_0x479901[_0x2c49('0x1e')]+_0x479901[_0x2c49('0x1f')],_0x2a16c0;if(_0x4029bc>=_0x48a7d1){_0x4029bc=_0x48a7d1;_0x2a16c0=0xc8;}else{_0x2a16c0=0xce;}_0x30f45d[_0x2c49('0x1a')](_0x2a16c0);return _0x30f45d[_0x2c49('0x20')](_0x2c49('0x21'),_0x314d35+'-'+_0x4029bc+'/'+_0x48a7d1)[_0x2c49('0x1c')](_0x3e7c73);}return null;};}function patchUpdates(_0x5b5a34){return function(_0x55af55){try{jsonpatch[_0x2c49('0x22')](_0x55af55,_0x5b5a34,!![]);}catch(_0x6f44af){return BPromise['reject'](_0x6f44af);}return _0x55af55[_0x2c49('0x23')]();};}function saveUpdates(_0x227527,_0x29067c){return function(_0x216d9b){if(_0x216d9b){return _0x216d9b['update'](_0x227527)['then'](function(_0x216e4e){return _0x216e4e;});}return null;};}function removeEntity(_0x430eaa,_0x5582d4){return function(_0x42847a){if(_0x42847a){return _0x42847a[_0x2c49('0x24')]()[_0x2c49('0x25')](function(){var _0x4dff03=_0x42847a[_0x2c49('0x26')]({'plain':!![]});var _0x267c14='DefaultReports';return db['UserProfileResource'][_0x2c49('0x24')]({'where':{'type':_0x267c14,'resourceId':_0x4dff03['id']}})['then'](function(){return _0x42847a;});})[_0x2c49('0x25')](function(){_0x430eaa[_0x2c49('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4355ea,_0x2dd862){return function(_0x3a1a27){if(!_0x3a1a27){_0x4355ea['sendStatus'](0x194);}return _0x3a1a27;};}function handleError(_0x2a355f,_0x27fa42){_0x27fa42=_0x27fa42||0x1f4;return function(_0x5da7ec){logger[_0x2c49('0x27')](_0x5da7ec[_0x2c49('0x28')]);if(_0x5da7ec[_0x2c49('0x29')]){delete _0x5da7ec[_0x2c49('0x29')];}_0x2a355f[_0x2c49('0x1a')](_0x27fa42)['send'](_0x5da7ec);};}exports[_0x2c49('0x2a')]=function(_0x4707df,_0x5a2476){var _0x1e5510={},_0x181136={},_0x43eab3={'count':0x0,'rows':[]};var _0x21c27f=_['map'](db['AnalyticDefaultReport'][_0x2c49('0x2b')],function(_0x49370b){return{'name':_0x49370b[_0x2c49('0x2c')],'type':_0x49370b[_0x2c49('0x2d')]['key']};});_0x181136[_0x2c49('0x2e')]=_[_0x2c49('0x2f')](_0x21c27f,_0x2c49('0x29'));_0x181136[_0x2c49('0x30')]=_[_0x2c49('0x31')](_0x4707df['query']);_0x181136[_0x2c49('0x32')]=_[_0x2c49('0x33')](_0x181136[_0x2c49('0x2e')],_0x181136[_0x2c49('0x30')]);_0x1e5510[_0x2c49('0x34')]=_[_0x2c49('0x33')](_0x181136['model'],qs[_0x2c49('0x35')](_0x4707df[_0x2c49('0x30')][_0x2c49('0x35')]));_0x1e5510[_0x2c49('0x34')]=_0x1e5510[_0x2c49('0x34')][_0x2c49('0x36')]?_0x1e5510[_0x2c49('0x34')]:_0x181136[_0x2c49('0x2e')];if(!_0x4707df['query'][_0x2c49('0x37')](_0x2c49('0x38'))){_0x1e5510[_0x2c49('0x1f')]=qs[_0x2c49('0x1f')](_0x4707df[_0x2c49('0x30')][_0x2c49('0x1f')]);_0x1e5510[_0x2c49('0x1e')]=qs[_0x2c49('0x1e')](_0x4707df[_0x2c49('0x30')][_0x2c49('0x1e')]);}_0x1e5510[_0x2c49('0x39')]=qs[_0x2c49('0x3a')](_0x4707df['query'][_0x2c49('0x3a')]);_0x1e5510[_0x2c49('0x3b')]=qs[_0x2c49('0x32')](_[_0x2c49('0x3c')](_0x4707df['query'],_0x181136['filters']));if(_0x4707df[_0x2c49('0x30')][_0x2c49('0x3d')]){_0x1e5510[_0x2c49('0x3b')]=_[_0x2c49('0x3e')](_0x1e5510[_0x2c49('0x3b')],{'$or':_[_0x2c49('0x2f')](_0x21c27f,function(_0x3eef7e){if(_0x3eef7e['type']!==_0x2c49('0x3f')){var _0x9e0b38={};_0x9e0b38[_0x3eef7e[_0x2c49('0x29')]]={'$like':'%'+_0x4707df[_0x2c49('0x30')]['filter']+'%'};return _0x9e0b38;}})});}_0x1e5510=_['merge']({},_0x1e5510,_0x4707df[_0x2c49('0x40')]);var _0x2f9522={'where':_0x1e5510[_0x2c49('0x3b')]};return db['AnalyticDefaultReport'][_0x2c49('0x1d')](_0x2f9522)['then'](function(_0x3a6e14){_0x43eab3[_0x2c49('0x1d')]=_0x3a6e14;if(_0x4707df[_0x2c49('0x30')]['includeAll']){_0x1e5510[_0x2c49('0x41')]=[{'all':!![]}];}return db[_0x2c49('0x42')][_0x2c49('0x43')](_0x1e5510);})[_0x2c49('0x25')](function(_0x524b2a){_0x43eab3['rows']=_0x524b2a;return _0x43eab3;})[_0x2c49('0x25')](respondWithFilteredResult(_0x5a2476,_0x1e5510))['catch'](handleError(_0x5a2476,null));};exports[_0x2c49('0x44')]=function(_0x3e0321,_0x36e607){var _0x14378a={'raw':!![],'where':{'id':_0x3e0321[_0x2c49('0x45')]['id']}},_0x3c81ac={};_0x3c81ac[_0x2c49('0x2e')]=_[_0x2c49('0x31')](db[_0x2c49('0x42')][_0x2c49('0x2b')]);_0x3c81ac['query']=_[_0x2c49('0x31')](_0x3e0321['query']);_0x3c81ac['filters']=_[_0x2c49('0x33')](_0x3c81ac[_0x2c49('0x2e')],_0x3c81ac[_0x2c49('0x30')]);_0x14378a[_0x2c49('0x34')]=_['intersection'](_0x3c81ac['model'],qs[_0x2c49('0x35')](_0x3e0321['query'][_0x2c49('0x35')]));_0x14378a[_0x2c49('0x34')]=_0x14378a['attributes'][_0x2c49('0x36')]?_0x14378a[_0x2c49('0x34')]:_0x3c81ac[_0x2c49('0x2e')];if(_0x3e0321[_0x2c49('0x30')]['includeAll']){_0x14378a['include']=[{'all':!![]}];}_0x14378a=_[_0x2c49('0x3e')]({},_0x14378a,_0x3e0321[_0x2c49('0x40')]);return db[_0x2c49('0x42')][_0x2c49('0x46')](_0x14378a)[_0x2c49('0x25')](handleEntityNotFound(_0x36e607,null))[_0x2c49('0x25')](respondWithResult(_0x36e607,null))[_0x2c49('0x47')](handleError(_0x36e607,null));};exports['create']=function(_0x33f589,_0x3d2531){return db['AnalyticDefaultReport']['create'](_0x33f589['body'],{})[_0x2c49('0x25')](function(_0x551f77){var _0x57f2d6=_0x33f589['user'][_0x2c49('0x26')]({'plain':!![]});if(!_0x57f2d6)throw new Error(_0x2c49('0x48'));if(_0x57f2d6[_0x2c49('0x49')]==='user'){var _0xc584f4=_0x551f77[_0x2c49('0x26')]({'plain':!![]});var _0x1d77ff=_0x2c49('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x1d77ff,'userProfileId':_0x57f2d6['userProfileId']},'raw':!![]})[_0x2c49('0x25')](function(_0x4397fb){if(_0x4397fb&&_0x4397fb[_0x2c49('0x4b')]===0x0){return db[_0x2c49('0x4c')][_0x2c49('0x4d')]({'name':_0xc584f4['name'],'resourceId':_0xc584f4['id'],'type':_0x2c49('0x4e'),'sectionId':_0x4397fb['id']},{})[_0x2c49('0x25')](function(){return _0x551f77;});}else{return _0x551f77;}})['catch'](function(_0x4c9c41){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c9c41);throw _0x4c9c41;});}return _0x551f77;})[_0x2c49('0x25')](respondWithResult(_0x3d2531,0xc9))[_0x2c49('0x47')](handleError(_0x3d2531,null));};exports[_0x2c49('0x4f')]=function(_0x3dd3e5,_0x4b2030){if(_0x3dd3e5['body']['id']){delete _0x3dd3e5['body']['id'];}return db[_0x2c49('0x42')]['find']({'where':{'id':_0x3dd3e5['params']['id']}})['then'](handleEntityNotFound(_0x4b2030,null))[_0x2c49('0x25')](saveUpdates(_0x3dd3e5[_0x2c49('0x50')],null))['then'](respondWithResult(_0x4b2030,null))['catch'](handleError(_0x4b2030,null));};exports[_0x2c49('0x24')]=function(_0x30caf2,_0x5b8a90){return db['AnalyticDefaultReport']['find']({'where':{'id':_0x30caf2['params']['id']}})[_0x2c49('0x25')](handleEntityNotFound(_0x5b8a90,null))[_0x2c49('0x25')](removeEntity(_0x5b8a90,null))[_0x2c49('0x47')](handleError(_0x5b8a90,null));};exports[_0x2c49('0x51')]=function(_0x45e903,_0x121fdb){var _0x2e4ee9=0xa;var _0x96b328=['join',_0x2c49('0x52'),_0x2c49('0x53'),'cross_join'];var _0x492e30={'SUM':_0x2c49('0x54'),'COUNT':_0x2c49('0x55'),'COUNT DISTINCT':_0x2c49('0x56'),'MAX':_0x2c49('0x57'),'MIN':_0x2c49('0x58'),'AVG':_0x2c49('0x59'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x2c49('0x5a'),'GROUP_CONCAT DESC':_0x2c49('0x5b')};var _0x15750f={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x2c49('0x5c'),'HOUR':_0x2c49('0x5d'),'ROUND':_0x2c49('0x5e'),'UNIX_TIMESTAMP':_0x2c49('0x5f')};var _0x9d1f52=function(_0xb25045){return!_[_0x2c49('0x60')]([_0x2c49('0x61'),_0x2c49('0x62'),_0x2c49('0x63'),_0x2c49('0x64')],_0xb25045);};var _0x5d2038=function(_0x2c42e2){if(!_0x2c42e2||!_0x2c42e2[_0x2c49('0x65')][_0x2c49('0x36')]){return'';}for(var _0x3343dc='(',_0x7c0e9d=0x0;_0x7c0e9d<_0x2c42e2[_0x2c49('0x65')][_0x2c49('0x36')];_0x7c0e9d+=0x1){_0x7c0e9d>0x0&&(_0x3343dc+='\x20'+_0x2c42e2[_0x2c49('0x66')]+'\x20');_0x3343dc+=_0x2c42e2['rules'][_0x7c0e9d][_0x2c49('0x67')]?_0x5d2038(_0x2c42e2[_0x2c49('0x65')][_0x7c0e9d][_0x2c49('0x67')]):_0x2c42e2[_0x2c49('0x65')][_0x7c0e9d][_0x2c49('0x68')]+'\x20'+_0x2c42e2[_0x2c49('0x65')][_0x7c0e9d]['condition']+(_0x9d1f52(_0x2c42e2[_0x2c49('0x65')][_0x7c0e9d][_0x2c49('0x69')])?'\x20'+_0x2c42e2[_0x2c49('0x65')][_0x7c0e9d][_0x2c49('0x6a')]:'');}return _0x3343dc+')';};var _0x5f26b5={'where':{'id':_0x45e903[_0x2c49('0x45')]['id']}},_0x4f8b49,_0x8c3c95,_0x4eaa03,_0x42a0d7,_0x359ca4;_0x5f26b5=_[_0x2c49('0x3e')]({},_0x5f26b5,_0x45e903[_0x2c49('0x40')]);return db[_0x2c49('0x42')][_0x2c49('0x46')](_0x5f26b5)[_0x2c49('0x25')](function(_0x3d422e){if(_0x3d422e){_0x4f8b49=_0x3d422e;return _0x3d422e[_0x2c49('0x6b')]();}return null;})[_0x2c49('0x25')](function(_0x18ee33){if(_0x18ee33){if(!_0x18ee33[_0x2c49('0x36')]){throw new db[(_0x2c49('0x6c'))][(_0x2c49('0x6d'))](_0x2c49('0x6e'),0x193);}_0x8c3c95=_0x18ee33;return db[_0x2c49('0x6f')][_0x2c49('0x43')]({'raw':!![]});}return null;})[_0x2c49('0x25')](function(_0x3de88a){if(_0x3de88a){_0x4eaa03=_[_0x2c49('0x70')](_0x3de88a,'id');var _0xe5e45c;var _0x14861d=squel[_0x2c49('0x71')]();_0x14861d[_0x2c49('0x72')](_0x4f8b49['table']);for(var _0xc861c0=0x0;_0xc861c0<_0x8c3c95['length'];_0xc861c0+=0x1){_0xe5e45c=_0x8c3c95[_0xc861c0][_0x2c49('0x73')]?_0x4eaa03[_0x8c3c95[_0xc861c0][_0x2c49('0x73')]][_0x2c49('0x74')]:_0x8c3c95[_0xc861c0][_0x2c49('0x68')];_0xe5e45c=_0x8c3c95[_0xc861c0][_0x2c49('0x75')]?_[_0x2c49('0x76')](_0x492e30[_0x8c3c95[_0xc861c0]['function']],'%s',_0xe5e45c):_0xe5e45c;_0xe5e45c=_0x8c3c95[_0xc861c0][_0x2c49('0x77')]?_['replace'](_0x15750f[_0x8c3c95[_0xc861c0][_0x2c49('0x77')]],'%s',_0xe5e45c):_0xe5e45c;if(_0x8c3c95[_0xc861c0][_0x2c49('0x78')]){_0x14861d[_0x2c49('0x67')](_0xe5e45c);}_0x8c3c95[_0xc861c0][_0x2c49('0x79')]&&_0x14861d['order'](_0xe5e45c,_0x8c3c95[_0xc861c0][_0x2c49('0x79')]===_0x2c49('0x7a')?![]:!![]);_0x14861d['field'](_0xe5e45c,_0x8c3c95[_0xc861c0][_0x2c49('0x7b')]||_0xe5e45c);}if(_0x4f8b49[_0x2c49('0x7c')]){_0x4f8b49['joins']=JSON[_0x2c49('0x7d')](_0x4f8b49[_0x2c49('0x7c')]);for(var _0x5b04fa=0x0;_0x5b04fa<_0x4f8b49['joins'][_0x2c49('0x36')];_0x5b04fa+=0x1){if(_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x2d')]&&_[_0x2c49('0x60')](_0x96b328,_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa]['type'])&&_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x7e')]&&_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x7f')]&&_0x4f8b49['joins'][_0x5b04fa][_0x2c49('0x80')]){_0x14861d[_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x2d')]](_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x7f')],null,util[_0x2c49('0x77')](_0x2c49('0x81'),_0x4f8b49[_0x2c49('0x82')],_0x4f8b49['joins'][_0x5b04fa][_0x2c49('0x7e')],_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x7f')],_0x4f8b49[_0x2c49('0x7c')][_0x5b04fa][_0x2c49('0x80')]));}}}if(_0x4f8b49[_0x2c49('0x83')]){_0x4f8b49[_0x2c49('0x83')]=JSON[_0x2c49('0x7d')](_0x4f8b49[_0x2c49('0x83')]);_0x14861d['where'](_0x5d2038(_0x4f8b49[_0x2c49('0x83')][_0x2c49('0x67')]));}_0x359ca4=_0x14861d[_0x2c49('0x84')]();_0x14861d['limit'](_0x2e4ee9);_0x14861d['offset'](0x0);logger['debug']('Limited\x20Query:',_0x14861d[_0x2c49('0x85')]());return db['sequelize'][_0x2c49('0x30')](_0x14861d[_0x2c49('0x85')](),{'type':db[_0x2c49('0x86')][_0x2c49('0x87')]['SELECT']});}})['then'](respondWithResult(_0x121fdb,null))['catch'](handleError(_0x121fdb,null));};function runReport(_0x57a206,_0x488884,_0x5684bd){var _0x3f3ab7=_0x488884[_0x2c49('0x29')];var _0xf081fb=0xa;var _0x1ae1f=[_0x2c49('0x88'),_0x2c49('0x52'),_0x2c49('0x53'),'cross_join'];var _0x53c702={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2c49('0x56'),'MAX':_0x2c49('0x57'),'MIN':_0x2c49('0x58'),'AVG':_0x2c49('0x59'),'GROUP_CONCAT':_0x2c49('0x89'),'GROUP_CONCAT ASC':_0x2c49('0x5a'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0xa2b9a={'SEC_TO_TIME':_0x2c49('0x8a'),'DATE':'DATE(%s)','HOUR':_0x2c49('0x5d'),'ROUND':_0x2c49('0x5e'),'UNIX_TIMESTAMP':_0x2c49('0x5f')};var _0x4179b6=function(_0xc17fc3){return!_[_0x2c49('0x60')]([_0x2c49('0x61'),_0x2c49('0x62'),_0x2c49('0x63'),'IS\x20NOT\x20EMPTY'],_0xc17fc3);};var _0x4e6d41=function(_0x4ece5f){if(!_0x4ece5f||!_0x4ece5f['rules']['length']){return'';}for(var _0xb80098='(',_0x52a1f7=0x0;_0x52a1f7<_0x4ece5f[_0x2c49('0x65')][_0x2c49('0x36')];_0x52a1f7+=0x1){_0x52a1f7>0x0&&(_0xb80098+='\x20'+_0x4ece5f[_0x2c49('0x66')]+'\x20');_0xb80098+=_0x4ece5f[_0x2c49('0x65')][_0x52a1f7][_0x2c49('0x67')]?_0x4e6d41(_0x4ece5f[_0x2c49('0x65')][_0x52a1f7][_0x2c49('0x67')]):_0x4ece5f[_0x2c49('0x65')][_0x52a1f7]['field']+'\x20'+_0x4ece5f[_0x2c49('0x65')][_0x52a1f7]['condition']+(_0x4179b6(_0x4ece5f[_0x2c49('0x65')][_0x52a1f7]['condition'])?'\x20'+_0x4ece5f[_0x2c49('0x65')][_0x52a1f7][_0x2c49('0x6a')]:'');}return _0xb80098+')';};var _0xc94d98={'where':{'id':_0x57a206['id']}},_0x3f926a,_0x501117,_0x1dc337,_0x243fd3,_0x5993d4;_0xc94d98=_['merge']({},_0xc94d98,_0x5684bd);return db['AnalyticDefaultReport']['find'](_0xc94d98)['then'](function(_0x42c024){if(_0x42c024){_0x3f926a=_0x42c024;return _0x42c024['getFields']();}return null;})['then'](function(_0x29be53){if(_0x29be53){if(!_0x29be53[_0x2c49('0x36')]){throw new db[(_0x2c49('0x6c'))][(_0x2c49('0x6d'))](_0x2c49('0x6e'),0x193);}_0x501117=_0x29be53;return db[_0x2c49('0x6f')][_0x2c49('0x43')]({'raw':!![]});}return null;})[_0x2c49('0x25')](function(_0x4b0907){if(_0x4b0907){_0x1dc337=_[_0x2c49('0x70')](_0x4b0907,'id');var _0x384c01;var _0x5c2980=squel[_0x2c49('0x71')]();_0x5c2980[_0x2c49('0x72')](_0x3f926a[_0x2c49('0x82')]);for(var _0x1ccff7=0x0;_0x1ccff7<_0x501117[_0x2c49('0x36')];_0x1ccff7+=0x1){_0x384c01=_0x501117[_0x1ccff7][_0x2c49('0x73')]?_0x1dc337[_0x501117[_0x1ccff7][_0x2c49('0x73')]]['metric']:_0x501117[_0x1ccff7][_0x2c49('0x68')];_0x384c01=_0x501117[_0x1ccff7][_0x2c49('0x75')]?_[_0x2c49('0x76')](_0x53c702[_0x501117[_0x1ccff7][_0x2c49('0x75')]],'%s',_0x384c01):_0x384c01;_0x384c01=_0x501117[_0x1ccff7][_0x2c49('0x77')]?_[_0x2c49('0x76')](_0xa2b9a[_0x501117[_0x1ccff7][_0x2c49('0x77')]],'%s',_0x384c01):_0x384c01;if(_0x501117[_0x1ccff7][_0x2c49('0x78')]){_0x5c2980[_0x2c49('0x67')](_0x384c01);}_0x501117[_0x1ccff7][_0x2c49('0x79')]&&_0x5c2980[_0x2c49('0x39')](_0x384c01,_0x501117[_0x1ccff7][_0x2c49('0x79')]===_0x2c49('0x7a')?![]:!![]);_0x5c2980[_0x2c49('0x68')](_0x384c01,_0x501117[_0x1ccff7]['alias']||_0x384c01);}if(_0x3f926a['joins']){_0x3f926a[_0x2c49('0x7c')]=JSON[_0x2c49('0x7d')](_0x3f926a['joins']);for(var _0x5626ae=0x0;_0x5626ae<_0x3f926a['joins']['length'];_0x5626ae+=0x1){if(_0x3f926a[_0x2c49('0x7c')][_0x5626ae][_0x2c49('0x2d')]&&_['includes'](_0x1ae1f,_0x3f926a[_0x2c49('0x7c')][_0x5626ae]['type'])&&_0x3f926a['joins'][_0x5626ae][_0x2c49('0x7e')]&&_0x3f926a[_0x2c49('0x7c')][_0x5626ae]['foreignTable']&&_0x3f926a[_0x2c49('0x7c')][_0x5626ae][_0x2c49('0x80')]){_0x5c2980[_0x3f926a[_0x2c49('0x7c')][_0x5626ae][_0x2c49('0x2d')]](_0x3f926a[_0x2c49('0x7c')][_0x5626ae][_0x2c49('0x7f')],null,util[_0x2c49('0x77')](_0x2c49('0x81'),_0x3f926a['table'],_0x3f926a[_0x2c49('0x7c')][_0x5626ae]['parentKey'],_0x3f926a['joins'][_0x5626ae][_0x2c49('0x7f')],_0x3f926a[_0x2c49('0x7c')][_0x5626ae][_0x2c49('0x80')]));}}}if(_0x3f926a['conditions']){_0x3f926a[_0x2c49('0x83')]=JSON['parse'](_0x3f926a['conditions']);_0x5c2980[_0x2c49('0x3b')](_0x4e6d41(_0x3f926a['conditions'][_0x2c49('0x67')]));}_0x5993d4=_0x5c2980[_0x2c49('0x84')]();_0x5c2980[_0x2c49('0x1f')](_0xf081fb);_0x5c2980[_0x2c49('0x1e')](0x0);logger[_0x2c49('0x8b')](_0x2c49('0x8c'),_0x5c2980[_0x2c49('0x85')]());return db[_0x2c49('0x86')][_0x2c49('0x30')](_0x5c2980[_0x2c49('0x85')](),{'type':db[_0x2c49('0x86')][_0x2c49('0x87')]['SELECT']});}})[_0x2c49('0x25')](function(_0x17b185){if(!_0x17b185[_0x2c49('0x36')]){throw new db[(_0x2c49('0x6c'))][(_0x2c49('0x6d'))]('No\x20available\x20data',0xcc);}if(_0x488884['output']===_0x2c49('0x8d')){return null;}var _0x479fee=_['merge'](_0x488884,{'name':_0x488884[_0x2c49('0x8e')]||_0x488884[_0x2c49('0x29')]||_0x3f926a[_0x2c49('0x29')],'basename':_0x3f3ab7,'savename':util[_0x2c49('0x77')](_0x2c49('0x8f'),_0x488884[_0x2c49('0x29')]||_0x3f926a[_0x2c49('0x29')],require('randomstring')['generate'](0x4),_0x488884[_0x2c49('0x90')]||_0x2c49('0x91')),'reportId':_0x3f926a['id'],'reportType':'default'});return db['AnalyticExtractedReport'][_0x2c49('0x4d')](_0x479fee,{'raw':!![]});})[_0x2c49('0x25')](function(_0x5b500c){if(_0x3f926a[_0x2c49('0x82')]===_0x2c49('0x92')){_0x5993d4[_0x2c49('0x3b')](_0x3f926a[_0x2c49('0x82')]+_0x2c49('0x93'),_0x488884[_0x2c49('0x94')],_0x488884[_0x2c49('0x95')]);}else{_0x5993d4[_0x2c49('0x3b')](_0x3f926a[_0x2c49('0x82')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x488884[_0x2c49('0x94')],_0x488884[_0x2c49('0x95')]);}if(_0x5b500c){logger['info']('Run\x20Query:',_0x5993d4[_0x2c49('0x85')]());require(_0x2c49('0x96'))['fork'](path[_0x2c49('0x88')](__dirname,'../../components/export/',_0x5b500c['output']),[_0x5b500c['id'],_0x5993d4[_0x2c49('0x85')](),path[_0x2c49('0x88')](__dirname,'../../files/reports',_0x5b500c[_0x2c49('0x97')]),_0x3f3ab7]);return _0x5b500c;}else{var _0x53f750=squel['select']();_0x53f750[_0x2c49('0x72')]('('+_0x5993d4['toString']()+')',_0x2c49('0x98'));_0x53f750[_0x2c49('0x68')](_0x2c49('0x99'),_0x2c49('0x1d'));_0x5993d4['limit'](_0x488884[_0x2c49('0x1f')]||_0xf081fb);_0x5993d4[_0x2c49('0x1e')](_0x488884[_0x2c49('0x1e')]||0x0);return db[_0x2c49('0x86')]['query'](_0x53f750[_0x2c49('0x85')](),{'type':db[_0x2c49('0x86')][_0x2c49('0x87')][_0x2c49('0x9a')]})[_0x2c49('0x25')](function(_0x522c7e){if(!_0x522c7e[_0x2c49('0x36')]){_0x243fd3=0x0;}else{_0x243fd3=_0x522c7e[0x0][_0x2c49('0x1d')]||0x0;}return db[_0x2c49('0x86')][_0x2c49('0x30')](_0x5993d4['toString'](),{'type':db[_0x2c49('0x86')]['QueryTypes'][_0x2c49('0x9a')]});})[_0x2c49('0x25')](function(_0x10af75){return{'rows':_0x10af75||[],'count':_0x243fd3};});}});}exports['run']=function(_0x141787,_0xf43869){return runReport(_0x141787[_0x2c49('0x45')],_0x141787[_0x2c49('0x30')],_0x141787[_0x2c49('0x40')])['then'](respondWithResult(_0xf43869,null))[_0x2c49('0x47')](handleError(_0xf43869,null));};exports['runReport']=runReport;exports[_0x2c49('0x30')]=function(_0x176f93,_0x4b5c2f){var _0x1fa53e=0xa;var _0x334df6=['join','left_join',_0x2c49('0x53'),_0x2c49('0x9b')];var _0x3f515={'SUM':_0x2c49('0x54'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x2c49('0x56'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0x2c49('0x59'),'GROUP_CONCAT':_0x2c49('0x89'),'GROUP_CONCAT ASC':_0x2c49('0x5a'),'GROUP_CONCAT DESC':_0x2c49('0x5b')};var _0x49ec78={'SEC_TO_TIME':_0x2c49('0x8a'),'DATE':_0x2c49('0x5c'),'HOUR':_0x2c49('0x5d'),'ROUND':_0x2c49('0x5e'),'UNIX_TIMESTAMP':_0x2c49('0x5f')};var _0xa7c7e6=function(_0x108ff4){return!_[_0x2c49('0x60')]([_0x2c49('0x61'),_0x2c49('0x62'),_0x2c49('0x63'),'IS\x20NOT\x20EMPTY'],_0x108ff4);};var _0xfef60=function(_0xaf9101){if(!_0xaf9101||!_0xaf9101['rules'][_0x2c49('0x36')]){return'';}for(var _0x35474f='(',_0x45b7a7=0x0;_0x45b7a7<_0xaf9101['rules'][_0x2c49('0x36')];_0x45b7a7+=0x1){_0x45b7a7>0x0&&(_0x35474f+='\x20'+_0xaf9101[_0x2c49('0x66')]+'\x20');_0x35474f+=_0xaf9101['rules'][_0x45b7a7]['group']?_0xfef60(_0xaf9101['rules'][_0x45b7a7][_0x2c49('0x67')]):_0xaf9101[_0x2c49('0x65')][_0x45b7a7][_0x2c49('0x68')]+'\x20'+_0xaf9101[_0x2c49('0x65')][_0x45b7a7][_0x2c49('0x69')]+(_0xa7c7e6(_0xaf9101['rules'][_0x45b7a7][_0x2c49('0x69')])?'\x20'+_0xaf9101['rules'][_0x45b7a7][_0x2c49('0x6a')]:'');}return _0x35474f+')';};var _0x2ac2c9={'where':{'id':_0x176f93[_0x2c49('0x45')]['id']}},_0x1da955,_0x1394bb,_0x24afab,_0x33aa2c,_0x40bcea;_0x2ac2c9=_[_0x2c49('0x3e')]({},_0x2ac2c9,_0x176f93[_0x2c49('0x40')]);return db['AnalyticDefaultReport'][_0x2c49('0x46')](_0x2ac2c9)[_0x2c49('0x25')](function(_0x192431){if(_0x192431){_0x1da955=_0x192431;return _0x192431['getFields']();}return null;})[_0x2c49('0x25')](function(_0x5c563b){if(_0x5c563b){if(!_0x5c563b[_0x2c49('0x36')]){throw new db['Sequelize'][(_0x2c49('0x6d'))](_0x2c49('0x6e'),0x193);}_0x1394bb=_0x5c563b;return db[_0x2c49('0x6f')][_0x2c49('0x43')]({'raw':!![]});}return null;})[_0x2c49('0x25')](function(_0xadc94e){if(_0xadc94e){_0x24afab=_[_0x2c49('0x70')](_0xadc94e,'id');var _0xeb1f5a;var _0x13b29f=squel[_0x2c49('0x71')]();_0x13b29f[_0x2c49('0x72')](_0x1da955['table']);for(var _0x2cdb0d=0x0;_0x2cdb0d<_0x1394bb['length'];_0x2cdb0d+=0x1){_0xeb1f5a=_0x1394bb[_0x2cdb0d][_0x2c49('0x73')]?_0x24afab[_0x1394bb[_0x2cdb0d]['MetricId']][_0x2c49('0x74')]:_0x1394bb[_0x2cdb0d][_0x2c49('0x68')];_0xeb1f5a=_0x1394bb[_0x2cdb0d][_0x2c49('0x75')]?_[_0x2c49('0x76')](_0x3f515[_0x1394bb[_0x2cdb0d][_0x2c49('0x75')]],'%s',_0xeb1f5a):_0xeb1f5a;_0xeb1f5a=_0x1394bb[_0x2cdb0d][_0x2c49('0x77')]?_['replace'](_0x49ec78[_0x1394bb[_0x2cdb0d][_0x2c49('0x77')]],'%s',_0xeb1f5a):_0xeb1f5a;if(_0x1394bb[_0x2cdb0d][_0x2c49('0x78')]){_0x13b29f[_0x2c49('0x67')](_0xeb1f5a);}_0x1394bb[_0x2cdb0d]['orderBy']&&_0x13b29f[_0x2c49('0x39')](_0xeb1f5a,_0x1394bb[_0x2cdb0d]['orderBy']===_0x2c49('0x7a')?![]:!![]);_0x13b29f['field'](_0xeb1f5a,_0x1394bb[_0x2cdb0d][_0x2c49('0x7b')]||_0xeb1f5a);}if(_0x1da955[_0x2c49('0x7c')]){_0x1da955['joins']=JSON['parse'](_0x1da955[_0x2c49('0x7c')]);for(var _0x476a38=0x0;_0x476a38<_0x1da955[_0x2c49('0x7c')][_0x2c49('0x36')];_0x476a38+=0x1){if(_0x1da955[_0x2c49('0x7c')][_0x476a38]['type']&&_[_0x2c49('0x60')](_0x334df6,_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x2d')])&&_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x7e')]&&_0x1da955[_0x2c49('0x7c')][_0x476a38]['foreignTable']&&_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x80')]){_0x13b29f[_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x2d')]](_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x7f')],null,util['format'](_0x2c49('0x81'),_0x1da955['table'],_0x1da955[_0x2c49('0x7c')][_0x476a38]['parentKey'],_0x1da955['joins'][_0x476a38][_0x2c49('0x7f')],_0x1da955[_0x2c49('0x7c')][_0x476a38][_0x2c49('0x80')]));}}}if(_0x1da955['conditions']){_0x1da955[_0x2c49('0x83')]=JSON[_0x2c49('0x7d')](_0x1da955[_0x2c49('0x83')]);_0x13b29f['where'](_0xfef60(_0x1da955[_0x2c49('0x83')][_0x2c49('0x67')]));}_0x40bcea=_0x13b29f[_0x2c49('0x84')]();_0x13b29f[_0x2c49('0x1f')](_0x1fa53e);_0x13b29f[_0x2c49('0x1e')](0x0);logger[_0x2c49('0x8b')](_0x2c49('0x8c'),_0x13b29f['toString']());return db[_0x2c49('0x86')]['query'](_0x13b29f[_0x2c49('0x85')](),{'type':db[_0x2c49('0x86')]['QueryTypes']['SELECT']});}})['then'](function(){return{'sql':_0x40bcea[_0x2c49('0x85')]()};})[_0x2c49('0x25')](respondWithResult(_0x4b5c2f,null))[_0x2c49('0x47')](handleError(_0x4b5c2f,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 6d59469..96d06e4 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 _0x1016=['rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xdc1559,_0x539c37){var _0x5dbc86=function(_0xc0cfd){while(--_0xc0cfd){_0xdc1559['push'](_0xdc1559['shift']());}};_0x5dbc86(++_0x539c37);}(_0x1016,0x124));var _0x6101=function(_0x3c472a,_0xbe009d){_0x3c472a=_0x3c472a-0x0;var _0x25f0c2=_0x1016[_0x3c472a];return _0x25f0c2;};'use strict';var _=require(_0x6101('0x0'));var util=require(_0x6101('0x1'));var logger=require(_0x6101('0x2'))('api');var moment=require(_0x6101('0x3'));var BPromise=require(_0x6101('0x4'));var rp=require(_0x6101('0x5'));var fs=require('fs');var path=require(_0x6101('0x6'));var rimraf=require(_0x6101('0x7'));var config=require(_0x6101('0x8'));var attributes=require(_0x6101('0x9'));module[_0x6101('0xa')]=function(_0x49bf64,_0x3bd613){return _0x49bf64[_0x6101('0xb')]('AnalyticDefaultReport',attributes,{'tableName':_0x6101('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd1f5=['api','bluebird','request-promise','path','../../config/environment','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger'];(function(_0x15bf3d,_0x490ecd){var _0x26dc5d=function(_0x99f707){while(--_0x99f707){_0x15bf3d['push'](_0x15bf3d['shift']());}};_0x26dc5d(++_0x490ecd);}(_0xd1f5,0x1de));var _0x5d1f=function(_0x5a615d,_0x13360e){_0x5a615d=_0x5a615d-0x0;var _0x1a5d1d=_0xd1f5[_0x5a615d];return _0x1a5d1d;};'use strict';var _=require(_0x5d1f('0x0'));var util=require('util');var logger=require(_0x5d1f('0x1'))(_0x5d1f('0x2'));var moment=require('moment');var BPromise=require(_0x5d1f('0x3'));var rp=require(_0x5d1f('0x4'));var fs=require('fs');var path=require(_0x5d1f('0x5'));var rimraf=require('rimraf');var config=require(_0x5d1f('0x6'));var attributes=require('./analyticDefaultReport.attributes');module['exports']=function(_0x577c21,_0x3b6ac8){return _0x577c21[_0x5d1f('0x7')](_0x5d1f('0x8'),attributes,{'tableName':_0x5d1f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js b/server/api/analyticDefaultReport/analyticDefaultReport.rpc.js index 951ec70..bf89a0d 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 _0x81d5=['debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent'];(function(_0x566667,_0x3f99c2){var _0x277136=function(_0x129ea0){while(--_0x129ea0){_0x566667['push'](_0x566667['shift']());}};_0x277136(++_0x3f99c2);}(_0x81d5,0x1ab));var _0x581d=function(_0x4241a9,_0x4403d3){_0x4241a9=_0x4241a9-0x0;var _0x1f2f77=_0x81d5[_0x4241a9];return _0x1f2f77;};'use strict';var _=require(_0x581d('0x0'));var util=require(_0x581d('0x1'));var moment=require('moment');var BPromise=require(_0x581d('0x2'));var rs=require(_0x581d('0x3'));var fs=require('fs');var Redis=require(_0x581d('0x4'));var db=require(_0x581d('0x5'))['db'];var utils=require(_0x581d('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x581d('0x7'));var jayson=require(_0x581d('0x8'));var client=jayson[_0x581d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x16067b,_0x2f32bf,_0x43124c){return new BPromise(function(_0x497368,_0xf1a3b6){return client['request'](_0x16067b,_0x43124c)['then'](function(_0x5d8fa3){logger[_0x581d('0xa')](_0x581d('0xb'),_0x2f32bf,_0x581d('0xc'));logger[_0x581d('0xd')](_0x581d('0xe'),_0x2f32bf,'request\x20sent',JSON[_0x581d('0xf')](_0x5d8fa3));if(_0x5d8fa3[_0x581d('0x10')]){if(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x11')]===0x1f4){logger[_0x581d('0x10')](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);return _0xf1a3b6(_0x5d8fa3[_0x581d('0x10')][_0x581d('0x12')]);}logger['error'](_0x581d('0xb'),_0x2f32bf,_0x5d8fa3[_0x581d('0x10')]['message']);return _0x497368(_0x5d8fa3['error']['message']);}else{logger['info'](_0x581d('0xb'),_0x2f32bf,'request\x20sent');_0x497368(_0x5d8fa3[_0x581d('0x13')][_0x581d('0x12')]);}})['catch'](function(_0x1890d0){logger['error'](_0x581d('0xb'),_0x2f32bf,_0x1890d0);_0xf1a3b6(_0x1890d0);});});} \ No newline at end of file +var _0x67da=['error','code','message','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0x67da,0x192));var _0xa67d=function(_0x1c58b8,_0x589ac5){_0x1c58b8=_0x1c58b8-0x0;var _0x398eeb=_0x67da[_0x1c58b8];return _0x398eeb;};'use strict';var _=require('lodash');var util=require(_0xa67d('0x0'));var moment=require(_0xa67d('0x1'));var BPromise=require(_0xa67d('0x2'));var rs=require(_0xa67d('0x3'));var fs=require('fs');var Redis=require(_0xa67d('0x4'));var db=require(_0xa67d('0x5'))['db'];var utils=require(_0xa67d('0x6'));var logger=require(_0xa67d('0x7'))(_0xa67d('0x8'));var config=require(_0xa67d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa67d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d2734,_0x31d56a,_0x2346f4){return new BPromise(function(_0x10f89a,_0x2c37c2){return client[_0xa67d('0xb')](_0x4d2734,_0x2346f4)[_0xa67d('0xc')](function(_0x330a9f){logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));logger['debug'](_0xa67d('0x10'),_0x31d56a,_0xa67d('0xf'),JSON[_0xa67d('0x11')](_0x330a9f));if(_0x330a9f[_0xa67d('0x12')]){if(_0x330a9f['error'][_0xa67d('0x13')]===0x1f4){logger[_0xa67d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x31d56a,_0x330a9f['error'][_0xa67d('0x14')]);return _0x2c37c2(_0x330a9f['error'][_0xa67d('0x14')]);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0x31d56a,_0x330a9f[_0xa67d('0x12')][_0xa67d('0x14')]);return _0x10f89a(_0x330a9f['error'][_0xa67d('0x14')]);}else{logger[_0xa67d('0xd')](_0xa67d('0xe'),_0x31d56a,_0xa67d('0xf'));_0x10f89a(_0x330a9f['result']['message']);}})['catch'](function(_0x4fa50f){logger[_0xa67d('0x12')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x31d56a,_0x4fa50f);_0x2c37c2(_0x4fa50f);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 77f7edf..27abb2a 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 _0x865e=['util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./analyticDefaultReport.controller','index','get','/:id','isAuthenticated','preview','/:id/run','/:id/query','query','create','put','update','delete','exports','multer'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x865e,0x7d));var _0xe865=function(_0x87b0ff,_0x314389){_0x87b0ff=_0x87b0ff-0x0;var _0x3bc0b2=_0x865e[_0x87b0ff];return _0x3bc0b2;};'use strict';var multer=require(_0xe865('0x0'));var util=require(_0xe865('0x1'));var path=require(_0xe865('0x2'));var timeout=require(_0xe865('0x3'));var express=require('express');var router=express[_0xe865('0x4')]();var auth=require(_0xe865('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe865('0x6'));var controller=require(_0xe865('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xe865('0x8')]);router[_0xe865('0x9')](_0xe865('0xa'),auth[_0xe865('0xb')](),controller['show']);router[_0xe865('0x9')]('/:id/preview',auth['isAuthenticated'](),controller[_0xe865('0xc')]);router[_0xe865('0x9')](_0xe865('0xd'),auth['isAuthenticated'](),controller['run']);router['get'](_0xe865('0xe'),auth[_0xe865('0xb')](),controller[_0xe865('0xf')]);router['post']('/',auth[_0xe865('0xb')](),controller[_0xe865('0x10')]);router[_0xe865('0x11')](_0xe865('0xa'),auth[_0xe865('0xb')](),controller[_0xe865('0x12')]);router[_0xe865('0x13')](_0xe865('0xa'),auth[_0xe865('0xb')](),controller['destroy']);module[_0xe865('0x14')]=router; \ No newline at end of file +var _0x5a78=['put','update','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','/:id/preview','preview','run','query','post','create'];(function(_0xf06727,_0x1aa690){var _0x1a2d95=function(_0x1e4978){while(--_0x1e4978){_0xf06727['push'](_0xf06727['shift']());}};_0x1a2d95(++_0x1aa690);}(_0x5a78,0x1bd));var _0x85a7=function(_0x2cb841,_0x439c1c){_0x2cb841=_0x2cb841-0x0;var _0x20ef74=_0x5a78[_0x2cb841];return _0x20ef74;};'use strict';var multer=require('multer');var util=require(_0x85a7('0x0'));var path=require('path');var timeout=require(_0x85a7('0x1'));var express=require('express');var router=express[_0x85a7('0x2')]();var auth=require(_0x85a7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x85a7('0x4'));router[_0x85a7('0x5')]('/',auth[_0x85a7('0x6')](),controller['index']);router[_0x85a7('0x5')](_0x85a7('0x7'),auth[_0x85a7('0x6')](),controller[_0x85a7('0x8')]);router[_0x85a7('0x5')](_0x85a7('0x9'),auth[_0x85a7('0x6')](),controller[_0x85a7('0xa')]);router[_0x85a7('0x5')]('/:id/run',auth['isAuthenticated'](),controller[_0x85a7('0xb')]);router[_0x85a7('0x5')]('/:id/query',auth[_0x85a7('0x6')](),controller[_0x85a7('0xc')]);router[_0x85a7('0xd')]('/',auth[_0x85a7('0x6')](),controller[_0x85a7('0xe')]);router[_0x85a7('0xf')](_0x85a7('0x7'),auth[_0x85a7('0x6')](),controller[_0x85a7('0x10')]);router[_0x85a7('0x11')]('/:id',auth[_0x85a7('0x6')](),controller[_0x85a7('0x12')]);module[_0x85a7('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 42eff2d..4dd1075 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 _0x2e95=['Loading','manual','INTEGER','UNSIGNED','exports','STRING','ENUM','csv','pdf','xlsx','DATE'];(function(_0x49157b,_0x5d8601){var _0x3ea5d4=function(_0x4c2905){while(--_0x4c2905){_0x49157b['push'](_0x49157b['shift']());}};_0x3ea5d4(++_0x5d8601);}(_0x2e95,0x19b));var _0x52e9=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x2e95[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x52e9('0x0')]={'name':{'type':Sequelize[_0x52e9('0x1')],'allowNull':![]},'basename':{'type':Sequelize[_0x52e9('0x1')],'allowNull':![]},'output':{'type':Sequelize[_0x52e9('0x2')](_0x52e9('0x3'),_0x52e9('0x4'),_0x52e9('0x5')),'allowNull':![],'defaultValue':_0x52e9('0x3')},'savename':{'type':Sequelize[_0x52e9('0x1')],'allowNull':![]},'startDate':{'type':Sequelize[_0x52e9('0x6')]},'endDate':{'type':Sequelize[_0x52e9('0x6')]},'status':{'type':Sequelize[_0x52e9('0x1')],'defaultValue':_0x52e9('0x7')},'type':{'type':Sequelize[_0x52e9('0x2')](_0x52e9('0x8'),'scheduled'),'allowNull':![],'defaultValue':_0x52e9('0x8')},'reportId':{'type':Sequelize[_0x52e9('0x9')](0xb)[_0x52e9('0xa')]},'reportType':{'type':Sequelize[_0x52e9('0x1')]}}; \ No newline at end of file +var _0xf13d=['ENUM','csv','pdf','xlsx','DATE','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING'];(function(_0x32181f,_0x3d4e95){var _0x35855d=function(_0x54c374){while(--_0x54c374){_0x32181f['push'](_0x32181f['shift']());}};_0x35855d(++_0x3d4e95);}(_0xf13d,0x126));var _0xdf13=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0xf13d[_0x199572];return _0x13cfa3;};'use strict';var Sequelize=require(_0xdf13('0x0'));var moment=require('moment');module[_0xdf13('0x1')]={'name':{'type':Sequelize[_0xdf13('0x2')],'allowNull':![]},'basename':{'type':Sequelize['STRING'],'allowNull':![]},'output':{'type':Sequelize[_0xdf13('0x3')](_0xdf13('0x4'),_0xdf13('0x5'),_0xdf13('0x6')),'allowNull':![],'defaultValue':_0xdf13('0x4')},'savename':{'type':Sequelize[_0xdf13('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0xdf13('0x7')]},'endDate':{'type':Sequelize[_0xdf13('0x7')]},'status':{'type':Sequelize[_0xdf13('0x2')],'defaultValue':'Loading'},'type':{'type':Sequelize['ENUM']('manual',_0xdf13('0x8')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0xdf13('0x9')](0xb)[_0xdf13('0xa')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 9fd7b8a..f383ef6 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 _0x7578=['userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','params','basename','savename','join','root','server/files/reports','ValidationError','exists','format','%s.%s','output','toLowerCase','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','get','ExtractedReports','destroy','error','stack','name','send','index','AnalyticExtractedReport','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection'];(function(_0x5bb453,_0x4d75c0){var _0x3fa3e8=function(_0x79ae7b){while(--_0x79ae7b){_0x5bb453['push'](_0x5bb453['shift']());}};_0x3fa3e8(++_0x4d75c0);}(_0x7578,0xcb));var _0x8757=function(_0x1b8729,_0x5c57d7){_0x1b8729=_0x1b8729-0x0;var _0x27750b=_0x7578[_0x1b8729];return _0x27750b;};'use strict';var pdf=require(_0x8757('0x0'));var emlformat=require(_0x8757('0x1'));var rimraf=require(_0x8757('0x2'));var zipdir=require(_0x8757('0x3'));var jsonpatch=require(_0x8757('0x4'));var rp=require(_0x8757('0x5'));var moment=require('moment');var BPromise=require(_0x8757('0x6'));var Mustache=require(_0x8757('0x7'));var util=require(_0x8757('0x8'));var path=require(_0x8757('0x9'));var sox=require('sox');var csv=require(_0x8757('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8757('0xb'));var squel=require(_0x8757('0xc'));var crypto=require('crypto');var jsforce=require(_0x8757('0xd'));var deskjs=require(_0x8757('0xe'));var toCsv=require(_0x8757('0xa'));var querystring=require(_0x8757('0xf'));var Papa=require(_0x8757('0x10'));var Redis=require(_0x8757('0x11'));var authService=require(_0x8757('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8757('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x8757('0x14'));var config=require(_0x8757('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2584e0,_0x471b53){_0x471b53=_0x471b53||0xcc;return function(_0x252735){if(_0x252735){return _0x2584e0[_0x8757('0x16')](_0x471b53);}return _0x2584e0[_0x8757('0x17')](_0x471b53)[_0x8757('0x18')]();};}function respondWithResult(_0xd1ef69,_0x4f9730){_0x4f9730=_0x4f9730||0xc8;return function(_0x495177){if(_0x495177){return _0xd1ef69[_0x8757('0x17')](_0x4f9730)[_0x8757('0x19')](_0x495177);}};}function respondWithFilteredResult(_0x6de36b,_0x39c9a5){return function(_0x3ca76f){if(_0x3ca76f){var _0x549c32=_0x3ca76f[_0x8757('0x1a')],_0x51ac36=_0x39c9a5[_0x8757('0x1b')],_0x40f5f6=_0x39c9a5[_0x8757('0x1b')]+_0x39c9a5[_0x8757('0x1c')],_0xfda4ce;if(_0x40f5f6>=_0x549c32){_0x40f5f6=_0x549c32;_0xfda4ce=0xc8;}else{_0xfda4ce=0xce;}_0x6de36b['status'](_0xfda4ce);return _0x6de36b[_0x8757('0x1d')](_0x8757('0x1e'),_0x51ac36+'-'+_0x40f5f6+'/'+_0x549c32)[_0x8757('0x19')](_0x3ca76f);}return null;};}function patchUpdates(_0xa42f00){return function(_0x830703){try{jsonpatch['apply'](_0x830703,_0xa42f00,!![]);}catch(_0x7d395a){return BPromise[_0x8757('0x1f')](_0x7d395a);}return _0x830703[_0x8757('0x20')]();};}function saveUpdates(_0x469fe3,_0x5db4a3){return function(_0x1e5073){if(_0x1e5073){return _0x1e5073[_0x8757('0x21')](_0x469fe3)[_0x8757('0x22')](function(_0x3250c9){return _0x3250c9;});}return null;};}function removeEntity(_0x40d2b5,_0x1002fa){return function(_0x522050){if(_0x522050){return _0x522050['destroy']()[_0x8757('0x22')](function(){var _0x6f69bf=_0x522050[_0x8757('0x23')]({'plain':!![]});var _0x1a5df5=_0x8757('0x24');return db['UserProfileResource'][_0x8757('0x25')]({'where':{'type':_0x1a5df5,'resourceId':_0x6f69bf['id']}})[_0x8757('0x22')](function(){return _0x522050;});})[_0x8757('0x22')](function(){_0x40d2b5['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x330b58,_0x5118c0){return function(_0x1cc7c5){if(!_0x1cc7c5){_0x330b58[_0x8757('0x16')](0x194);}return _0x1cc7c5;};}function handleError(_0x542034,_0x4a759f){_0x4a759f=_0x4a759f||0x1f4;return function(_0x2a388c){logger[_0x8757('0x26')](_0x2a388c[_0x8757('0x27')]);if(_0x2a388c[_0x8757('0x28')]){delete _0x2a388c[_0x8757('0x28')];}_0x542034['status'](_0x4a759f)[_0x8757('0x29')](_0x2a388c);};}exports[_0x8757('0x2a')]=function(_0x28f893,_0x1f2b2f){var _0x5d37c6={},_0x4aa34c={},_0x1e488e={'count':0x0,'rows':[]};var _0x2819b4=_['map'](db[_0x8757('0x2b')]['rawAttributes'],function(_0xbb036f){return{'name':_0xbb036f[_0x8757('0x2c')],'type':_0xbb036f['type'][_0x8757('0x2d')]};});_0x4aa34c[_0x8757('0x2e')]=_[_0x8757('0x2f')](_0x2819b4,_0x8757('0x28'));_0x4aa34c[_0x8757('0x30')]=_[_0x8757('0x31')](_0x28f893[_0x8757('0x30')]);_0x4aa34c[_0x8757('0x32')]=_[_0x8757('0x33')](_0x4aa34c['model'],_0x4aa34c[_0x8757('0x30')]);_0x5d37c6[_0x8757('0x34')]=_[_0x8757('0x33')](_0x4aa34c[_0x8757('0x2e')],qs[_0x8757('0x35')](_0x28f893[_0x8757('0x30')][_0x8757('0x35')]));_0x5d37c6[_0x8757('0x34')]=_0x5d37c6[_0x8757('0x34')]['length']?_0x5d37c6[_0x8757('0x34')]:_0x4aa34c['model'];if(!_0x28f893['query'][_0x8757('0x36')](_0x8757('0x37'))){_0x5d37c6[_0x8757('0x1c')]=qs[_0x8757('0x1c')](_0x28f893[_0x8757('0x30')]['limit']);_0x5d37c6[_0x8757('0x1b')]=qs[_0x8757('0x1b')](_0x28f893[_0x8757('0x30')]['offset']);}_0x5d37c6[_0x8757('0x38')]=qs[_0x8757('0x39')](_0x28f893['query'][_0x8757('0x39')]);_0x5d37c6[_0x8757('0x3a')]=qs[_0x8757('0x32')](_[_0x8757('0x3b')](_0x28f893[_0x8757('0x30')],_0x4aa34c[_0x8757('0x32')]));if(_0x28f893['query'][_0x8757('0x3c')]){_0x5d37c6[_0x8757('0x3a')]=_[_0x8757('0x3d')](_0x5d37c6['where'],{'$or':_['map'](_0x2819b4,function(_0x5049b4){if(_0x5049b4['type']!==_0x8757('0x3e')){var _0x12c71b={};_0x12c71b[_0x5049b4[_0x8757('0x28')]]={'$like':'%'+_0x28f893['query'][_0x8757('0x3c')]+'%'};return _0x12c71b;}})});}_0x5d37c6=_['merge']({},_0x5d37c6,_0x28f893[_0x8757('0x3f')]);var _0xfb8086={'where':_0x5d37c6[_0x8757('0x3a')]};return db[_0x8757('0x2b')]['count'](_0xfb8086)[_0x8757('0x22')](function(_0x1ed624){_0x1e488e['count']=_0x1ed624;if(_0x28f893[_0x8757('0x30')][_0x8757('0x40')]){_0x5d37c6['include']=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8757('0x41')](_0x5d37c6);})[_0x8757('0x22')](function(_0x2129a2){_0x1e488e[_0x8757('0x42')]=_0x2129a2;return _0x1e488e;})[_0x8757('0x22')](respondWithFilteredResult(_0x1f2b2f,_0x5d37c6))[_0x8757('0x43')](handleError(_0x1f2b2f,null));};exports['show']=function(_0x19b44b,_0x444aa6){var _0x47c36b={'raw':!![],'where':{'id':_0x19b44b['params']['id']}},_0x1c7f53={};_0x1c7f53[_0x8757('0x2e')]=_[_0x8757('0x31')](db[_0x8757('0x2b')]['rawAttributes']);_0x1c7f53[_0x8757('0x30')]=_[_0x8757('0x31')](_0x19b44b[_0x8757('0x30')]);_0x1c7f53[_0x8757('0x32')]=_[_0x8757('0x33')](_0x1c7f53[_0x8757('0x2e')],_0x1c7f53[_0x8757('0x30')]);_0x47c36b[_0x8757('0x34')]=_['intersection'](_0x1c7f53[_0x8757('0x2e')],qs['fields'](_0x19b44b[_0x8757('0x30')][_0x8757('0x35')]));_0x47c36b['attributes']=_0x47c36b[_0x8757('0x34')]['length']?_0x47c36b['attributes']:_0x1c7f53[_0x8757('0x2e')];if(_0x19b44b[_0x8757('0x30')][_0x8757('0x40')]){_0x47c36b[_0x8757('0x44')]=[{'all':!![]}];}_0x47c36b=_[_0x8757('0x3d')]({},_0x47c36b,_0x19b44b['options']);return db[_0x8757('0x2b')][_0x8757('0x45')](_0x47c36b)[_0x8757('0x22')](handleEntityNotFound(_0x444aa6,null))[_0x8757('0x22')](respondWithResult(_0x444aa6,null))['catch'](handleError(_0x444aa6,null));};exports[_0x8757('0x46')]=function(_0x430d9c,_0x30d0ff){return db[_0x8757('0x2b')][_0x8757('0x46')](_0x430d9c[_0x8757('0x47')],{})[_0x8757('0x22')](function(_0x488445){var _0x55a715=_0x430d9c[_0x8757('0x48')][_0x8757('0x23')]({'plain':!![]});if(!_0x55a715)throw new Error(_0x8757('0x49'));if(_0x55a715[_0x8757('0x4a')]===_0x8757('0x48')){var _0x409ad5=_0x488445[_0x8757('0x23')]({'plain':!![]});var _0x433dc4=_0x8757('0x24');return db[_0x8757('0x4b')][_0x8757('0x45')]({'where':{'name':_0x433dc4,'userProfileId':_0x55a715[_0x8757('0x4c')]},'raw':!![]})[_0x8757('0x22')](function(_0x6a755){if(_0x6a755&&_0x6a755[_0x8757('0x4d')]===0x0){return db[_0x8757('0x4e')]['create']({'name':_0x409ad5[_0x8757('0x28')],'resourceId':_0x409ad5['id'],'type':_0x6a755[_0x8757('0x28')],'sectionId':_0x6a755['id']},{})[_0x8757('0x22')](function(){return _0x488445;});}else{return _0x488445;}})['catch'](function(_0x47d4b5){logger['error'](_0x8757('0x4f'),_0x47d4b5);throw _0x47d4b5;});}return _0x488445;})[_0x8757('0x22')](respondWithResult(_0x30d0ff,0xc9))[_0x8757('0x43')](handleError(_0x30d0ff,null));};exports['update']=function(_0x56593b,_0x229f7c){if(_0x56593b[_0x8757('0x47')]['id']){delete _0x56593b[_0x8757('0x47')]['id'];}return db[_0x8757('0x2b')][_0x8757('0x45')]({'where':{'id':_0x56593b['params']['id']}})['then'](handleEntityNotFound(_0x229f7c,null))[_0x8757('0x22')](saveUpdates(_0x56593b[_0x8757('0x47')],null))[_0x8757('0x22')](respondWithResult(_0x229f7c,null))[_0x8757('0x43')](handleError(_0x229f7c,null));};exports[_0x8757('0x25')]=function(_0x75652a,_0x54b924){return db[_0x8757('0x2b')][_0x8757('0x45')]({'where':{'id':_0x75652a['params']['id']}})['then'](handleEntityNotFound(_0x54b924,null))['then'](removeEntity(_0x54b924,null))['catch'](handleError(_0x54b924,null));};exports[_0x8757('0x50')]=function(_0x78aa13,_0x441dd1,_0x41ff9){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x78aa13[_0x8757('0x51')]['id']},'attributes':[_0x8757('0x28'),_0x8757('0x52'),_0x8757('0x53'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x441dd1,null))[_0x8757('0x22')](function(_0x9aa1b9){if(_0x9aa1b9){if(!fs['existsSync'](path[_0x8757('0x54')](config[_0x8757('0x55')],_0x8757('0x56'),_0x9aa1b9['savename']))){throw new db['Sequelize'][(_0x8757('0x57'))]('Report\x20not\x20found\x20or\x20empty');}if(_0x78aa13[_0x8757('0x30')][_0x8757('0x58')]){return _0x441dd1[_0x8757('0x16')](0xc8);}return _0x441dd1[_0x8757('0x50')](path[_0x8757('0x54')](config[_0x8757('0x55')],_0x8757('0x56'),_0x9aa1b9[_0x8757('0x53')]),util[_0x8757('0x59')](_0x8757('0x5a'),_0x9aa1b9[_0x8757('0x52')]||_0x9aa1b9[_0x8757('0x28')],_0x9aa1b9[_0x8757('0x5b')][_0x8757('0x5c')]()));}})[_0x8757('0x43')](handleError(_0x441dd1,null));}; \ No newline at end of file +var _0xd507=['savename','output','existsSync','join','server/files/reports','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','root','format','%s.%s','toLowerCase','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','sendStatus','status','offset','limit','set','Content-Range','apply','reject','update','destroy','then','UserProfileResource','end','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','show','params','options','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','download','basename'];(function(_0x4487e8,_0x237609){var _0x2145f4=function(_0x4f1bf6){while(--_0x4f1bf6){_0x4487e8['push'](_0x4487e8['shift']());}};_0x2145f4(++_0x237609);}(_0xd507,0x69));var _0x7d50=function(_0x3faa1f,_0x5c9d8c){_0x3faa1f=_0x3faa1f-0x0;var _0x17bcc2=_0xd507[_0x3faa1f];return _0x17bcc2;};'use strict';var pdf=require(_0x7d50('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7d50('0x1'));var zipdir=require(_0x7d50('0x2'));var jsonpatch=require(_0x7d50('0x3'));var rp=require('request-promise');var moment=require(_0x7d50('0x4'));var BPromise=require(_0x7d50('0x5'));var Mustache=require('mustache');var util=require(_0x7d50('0x6'));var path=require(_0x7d50('0x7'));var sox=require(_0x7d50('0x8'));var csv=require(_0x7d50('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7d50('0xa'));var squel=require('squel');var crypto=require(_0x7d50('0xb'));var jsforce=require(_0x7d50('0xc'));var deskjs=require(_0x7d50('0xd'));var toCsv=require(_0x7d50('0x9'));var querystring=require(_0x7d50('0xe'));var Papa=require('papaparse');var Redis=require(_0x7d50('0xf'));var authService=require(_0x7d50('0x10'));var qs=require(_0x7d50('0x11'));var as=require(_0x7d50('0x12'));var hardwareService=require(_0x7d50('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7d50('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14c3eb,_0x8c841f){_0x8c841f=_0x8c841f||0xcc;return function(_0x25e97b){if(_0x25e97b){return _0x14c3eb[_0x7d50('0x15')](_0x8c841f);}return _0x14c3eb[_0x7d50('0x16')](_0x8c841f)['end']();};}function respondWithResult(_0x5c48cd,_0x27c8c2){_0x27c8c2=_0x27c8c2||0xc8;return function(_0x5e6626){if(_0x5e6626){return _0x5c48cd[_0x7d50('0x16')](_0x27c8c2)['json'](_0x5e6626);}};}function respondWithFilteredResult(_0x26d96c,_0x454c38){return function(_0x610389){if(_0x610389){var _0xe62032=_0x610389['count'],_0x19c5ef=_0x454c38['offset'],_0x2ec951=_0x454c38[_0x7d50('0x17')]+_0x454c38[_0x7d50('0x18')],_0x2f80ae;if(_0x2ec951>=_0xe62032){_0x2ec951=_0xe62032;_0x2f80ae=0xc8;}else{_0x2f80ae=0xce;}_0x26d96c[_0x7d50('0x16')](_0x2f80ae);return _0x26d96c[_0x7d50('0x19')](_0x7d50('0x1a'),_0x19c5ef+'-'+_0x2ec951+'/'+_0xe62032)['json'](_0x610389);}return null;};}function patchUpdates(_0x42cefe){return function(_0x2e0d21){try{jsonpatch[_0x7d50('0x1b')](_0x2e0d21,_0x42cefe,!![]);}catch(_0x4211e1){return BPromise[_0x7d50('0x1c')](_0x4211e1);}return _0x2e0d21['save']();};}function saveUpdates(_0x547e6b,_0x57011e){return function(_0x508f70){if(_0x508f70){return _0x508f70[_0x7d50('0x1d')](_0x547e6b)['then'](function(_0x532640){return _0x532640;});}return null;};}function removeEntity(_0x2e46eb,_0x472eaf){return function(_0x16c40a){if(_0x16c40a){return _0x16c40a[_0x7d50('0x1e')]()[_0x7d50('0x1f')](function(){var _0x2f3525=_0x16c40a['get']({'plain':!![]});var _0x5dc205='ExtractedReports';return db[_0x7d50('0x20')]['destroy']({'where':{'type':_0x5dc205,'resourceId':_0x2f3525['id']}})[_0x7d50('0x1f')](function(){return _0x16c40a;});})[_0x7d50('0x1f')](function(){_0x2e46eb[_0x7d50('0x16')](0xcc)[_0x7d50('0x21')]();});}};}function handleEntityNotFound(_0x4911e6,_0x533d9b){return function(_0x2bf36c){if(!_0x2bf36c){_0x4911e6[_0x7d50('0x15')](0x194);}return _0x2bf36c;};}function handleError(_0x1df8c2,_0x3bb301){_0x3bb301=_0x3bb301||0x1f4;return function(_0x3b9349){logger[_0x7d50('0x22')](_0x3b9349[_0x7d50('0x23')]);if(_0x3b9349[_0x7d50('0x24')]){delete _0x3b9349[_0x7d50('0x24')];}_0x1df8c2['status'](_0x3bb301)[_0x7d50('0x25')](_0x3b9349);};}exports[_0x7d50('0x26')]=function(_0xb11138,_0x48af52){var _0xafc8e0={},_0x2d2758={},_0x3693a8={'count':0x0,'rows':[]};var _0x5647cb=_[_0x7d50('0x27')](db[_0x7d50('0x28')][_0x7d50('0x29')],function(_0x697968){return{'name':_0x697968[_0x7d50('0x2a')],'type':_0x697968[_0x7d50('0x2b')][_0x7d50('0x2c')]};});_0x2d2758[_0x7d50('0x2d')]=_['map'](_0x5647cb,_0x7d50('0x24'));_0x2d2758[_0x7d50('0x2e')]=_[_0x7d50('0x2f')](_0xb11138['query']);_0x2d2758['filters']=_[_0x7d50('0x30')](_0x2d2758[_0x7d50('0x2d')],_0x2d2758[_0x7d50('0x2e')]);_0xafc8e0[_0x7d50('0x31')]=_[_0x7d50('0x30')](_0x2d2758['model'],qs[_0x7d50('0x32')](_0xb11138[_0x7d50('0x2e')]['fields']));_0xafc8e0[_0x7d50('0x31')]=_0xafc8e0['attributes'][_0x7d50('0x33')]?_0xafc8e0[_0x7d50('0x31')]:_0x2d2758[_0x7d50('0x2d')];if(!_0xb11138[_0x7d50('0x2e')]['hasOwnProperty']('nolimit')){_0xafc8e0['limit']=qs[_0x7d50('0x18')](_0xb11138[_0x7d50('0x2e')][_0x7d50('0x18')]);_0xafc8e0['offset']=qs[_0x7d50('0x17')](_0xb11138[_0x7d50('0x2e')]['offset']);}_0xafc8e0[_0x7d50('0x34')]=qs['sort'](_0xb11138[_0x7d50('0x2e')][_0x7d50('0x35')]);_0xafc8e0[_0x7d50('0x36')]=qs[_0x7d50('0x37')](_[_0x7d50('0x38')](_0xb11138[_0x7d50('0x2e')],_0x2d2758[_0x7d50('0x37')]));if(_0xb11138[_0x7d50('0x2e')][_0x7d50('0x39')]){_0xafc8e0[_0x7d50('0x36')]=_[_0x7d50('0x3a')](_0xafc8e0[_0x7d50('0x36')],{'$or':_[_0x7d50('0x27')](_0x5647cb,function(_0x439ed4){if(_0x439ed4['type']!==_0x7d50('0x3b')){var _0x232431={};_0x232431[_0x439ed4[_0x7d50('0x24')]]={'$like':'%'+_0xb11138['query'][_0x7d50('0x39')]+'%'};return _0x232431;}})});}_0xafc8e0=_['merge']({},_0xafc8e0,_0xb11138['options']);var _0x43fcd9={'where':_0xafc8e0['where']};return db['AnalyticExtractedReport'][_0x7d50('0x3c')](_0x43fcd9)[_0x7d50('0x1f')](function(_0x1e2117){_0x3693a8[_0x7d50('0x3c')]=_0x1e2117;if(_0xb11138[_0x7d50('0x2e')][_0x7d50('0x3d')]){_0xafc8e0[_0x7d50('0x3e')]=[{'all':!![]}];}return db[_0x7d50('0x28')][_0x7d50('0x3f')](_0xafc8e0);})['then'](function(_0x381b34){_0x3693a8[_0x7d50('0x40')]=_0x381b34;return _0x3693a8;})['then'](respondWithFilteredResult(_0x48af52,_0xafc8e0))['catch'](handleError(_0x48af52,null));};exports[_0x7d50('0x41')]=function(_0x5d6dc4,_0x1556c3){var _0x2675ff={'raw':!![],'where':{'id':_0x5d6dc4[_0x7d50('0x42')]['id']}},_0xf7ae10={};_0xf7ae10['model']=_['keys'](db[_0x7d50('0x28')][_0x7d50('0x29')]);_0xf7ae10['query']=_['keys'](_0x5d6dc4[_0x7d50('0x2e')]);_0xf7ae10['filters']=_['intersection'](_0xf7ae10['model'],_0xf7ae10[_0x7d50('0x2e')]);_0x2675ff[_0x7d50('0x31')]=_['intersection'](_0xf7ae10[_0x7d50('0x2d')],qs[_0x7d50('0x32')](_0x5d6dc4[_0x7d50('0x2e')]['fields']));_0x2675ff['attributes']=_0x2675ff[_0x7d50('0x31')][_0x7d50('0x33')]?_0x2675ff[_0x7d50('0x31')]:_0xf7ae10[_0x7d50('0x2d')];if(_0x5d6dc4['query'][_0x7d50('0x3d')]){_0x2675ff[_0x7d50('0x3e')]=[{'all':!![]}];}_0x2675ff=_[_0x7d50('0x3a')]({},_0x2675ff,_0x5d6dc4[_0x7d50('0x43')]);return db[_0x7d50('0x28')][_0x7d50('0x44')](_0x2675ff)[_0x7d50('0x1f')](handleEntityNotFound(_0x1556c3,null))[_0x7d50('0x1f')](respondWithResult(_0x1556c3,null))['catch'](handleError(_0x1556c3,null));};exports[_0x7d50('0x45')]=function(_0x3d69f9,_0xf2cb49){return db['AnalyticExtractedReport'][_0x7d50('0x45')](_0x3d69f9[_0x7d50('0x46')],{})[_0x7d50('0x1f')](function(_0x24c8e7){var _0xfc28e2=_0x3d69f9[_0x7d50('0x47')][_0x7d50('0x48')]({'plain':!![]});if(!_0xfc28e2)throw new Error(_0x7d50('0x49'));if(_0xfc28e2[_0x7d50('0x4a')]===_0x7d50('0x47')){var _0x11d8d2=_0x24c8e7[_0x7d50('0x48')]({'plain':!![]});var _0x205a03='ExtractedReports';return db[_0x7d50('0x4b')][_0x7d50('0x44')]({'where':{'name':_0x205a03,'userProfileId':_0xfc28e2['userProfileId']},'raw':!![]})[_0x7d50('0x1f')](function(_0xffba2){if(_0xffba2&&_0xffba2[_0x7d50('0x4c')]===0x0){return db[_0x7d50('0x20')][_0x7d50('0x45')]({'name':_0x11d8d2[_0x7d50('0x24')],'resourceId':_0x11d8d2['id'],'type':_0xffba2[_0x7d50('0x24')],'sectionId':_0xffba2['id']},{})[_0x7d50('0x1f')](function(){return _0x24c8e7;});}else{return _0x24c8e7;}})[_0x7d50('0x4d')](function(_0x513603){logger[_0x7d50('0x22')](_0x7d50('0x4e'),_0x513603);throw _0x513603;});}return _0x24c8e7;})[_0x7d50('0x1f')](respondWithResult(_0xf2cb49,0xc9))[_0x7d50('0x4d')](handleError(_0xf2cb49,null));};exports[_0x7d50('0x1d')]=function(_0xb6a703,_0x348f0c){if(_0xb6a703['body']['id']){delete _0xb6a703[_0x7d50('0x46')]['id'];}return db['AnalyticExtractedReport']['find']({'where':{'id':_0xb6a703[_0x7d50('0x42')]['id']}})[_0x7d50('0x1f')](handleEntityNotFound(_0x348f0c,null))[_0x7d50('0x1f')](saveUpdates(_0xb6a703['body'],null))[_0x7d50('0x1f')](respondWithResult(_0x348f0c,null))['catch'](handleError(_0x348f0c,null));};exports[_0x7d50('0x1e')]=function(_0xbb1fbe,_0x273ddd){return db['AnalyticExtractedReport'][_0x7d50('0x44')]({'where':{'id':_0xbb1fbe['params']['id']}})[_0x7d50('0x1f')](handleEntityNotFound(_0x273ddd,null))['then'](removeEntity(_0x273ddd,null))[_0x7d50('0x4d')](handleError(_0x273ddd,null));};exports[_0x7d50('0x4f')]=function(_0x9740e8,_0x51f94f,_0x43d740){return db[_0x7d50('0x28')]['find']({'where':{'id':_0x9740e8['params']['id']},'attributes':[_0x7d50('0x24'),_0x7d50('0x50'),_0x7d50('0x51'),_0x7d50('0x52')],'raw':!![]})[_0x7d50('0x1f')](handleEntityNotFound(_0x51f94f,null))[_0x7d50('0x1f')](function(_0x4e8320){if(_0x4e8320){if(!fs[_0x7d50('0x53')](path[_0x7d50('0x54')](config['root'],_0x7d50('0x55'),_0x4e8320['savename']))){throw new db['Sequelize'][(_0x7d50('0x56'))](_0x7d50('0x57'));}if(_0x9740e8[_0x7d50('0x2e')][_0x7d50('0x58')]){return _0x51f94f[_0x7d50('0x15')](0xc8);}return _0x51f94f[_0x7d50('0x4f')](path[_0x7d50('0x54')](config[_0x7d50('0x59')],_0x7d50('0x55'),_0x4e8320[_0x7d50('0x51')]),util[_0x7d50('0x5a')](_0x7d50('0x5b'),_0x4e8320[_0x7d50('0x50')]||_0x4e8320[_0x7d50('0x24')],_0x4e8320[_0x7d50('0x52')][_0x7d50('0x5c')]()));}})[_0x7d50('0x4d')](handleError(_0x51f94f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index cba0cab..4e5d445 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 _0x3b11=['api','moment','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','define','AnalyticExtractedReport','lodash','util','../../config/logger'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0x3b11,0x14f));var _0x13b1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3b11[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x13b1('0x0'));var util=require(_0x13b1('0x1'));var logger=require(_0x13b1('0x2'))(_0x13b1('0x3'));var moment=require(_0x13b1('0x4'));var BPromise=require('bluebird');var rp=require(_0x13b1('0x5'));var fs=require('fs');var path=require(_0x13b1('0x6'));var rimraf=require(_0x13b1('0x7'));var config=require(_0x13b1('0x8'));var attributes=require(_0x13b1('0x9'));module[_0x13b1('0xa')]=function(_0x194419,_0x465857){return _0x194419[_0x13b1('0xb')](_0x13b1('0xc'),attributes,{'tableName':'analytics_extracted_reports','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4a1f=['exports','define','analytics_extracted_reports','lodash','util','api','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x2f7003,_0x31365d){var _0x1f335b=function(_0x3a23de){while(--_0x3a23de){_0x2f7003['push'](_0x2f7003['shift']());}};_0x1f335b(++_0x31365d);}(_0x4a1f,0x71));var _0xf4a1=function(_0x5eab9b,_0x113241){_0x5eab9b=_0x5eab9b-0x0;var _0x16bbc5=_0x4a1f[_0x5eab9b];return _0x16bbc5;};'use strict';var _=require(_0xf4a1('0x0'));var util=require(_0xf4a1('0x1'));var logger=require('../../config/logger')(_0xf4a1('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf4a1('0x3'));var fs=require('fs');var path=require(_0xf4a1('0x4'));var rimraf=require(_0xf4a1('0x5'));var config=require(_0xf4a1('0x6'));var attributes=require(_0xf4a1('0x7'));module[_0xf4a1('0x8')]=function(_0x83474a,_0x354863){return _0x83474a[_0xf4a1('0x9')]('AnalyticExtractedReport',attributes,{'tableName':_0xf4a1('0xa'),'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 ce7b1e0..858cb6b 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 _0x80b3=['rpc','../../config/environment','http','request','then','info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x5d860f,_0x467498){var _0x236490=function(_0x5e045c){while(--_0x5e045c){_0x5d860f['push'](_0x5d860f['shift']());}};_0x236490(++_0x467498);}(_0x80b3,0xeb));var _0x380b=function(_0x447a05,_0x2c7bfe){_0x447a05=_0x447a05-0x0;var _0x55727b=_0x80b3[_0x447a05];return _0x55727b;};'use strict';var _=require(_0x380b('0x0'));var util=require(_0x380b('0x1'));var moment=require(_0x380b('0x2'));var BPromise=require('bluebird');var rs=require(_0x380b('0x3'));var fs=require('fs');var Redis=require(_0x380b('0x4'));var db=require(_0x380b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x380b('0x6'))(_0x380b('0x7'));var config=require(_0x380b('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x380b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x722115,_0x479fdc,_0x1ddc0f){return new BPromise(function(_0x379eac,_0x560e1e){return client[_0x380b('0xa')](_0x722115,_0x1ddc0f)[_0x380b('0xb')](function(_0x5909d5){logger[_0x380b('0xc')](_0x380b('0xd'),_0x479fdc,_0x380b('0xe'));logger['debug'](_0x380b('0xf'),_0x479fdc,_0x380b('0xe'),JSON[_0x380b('0x10')](_0x5909d5));if(_0x5909d5[_0x380b('0x11')]){if(_0x5909d5[_0x380b('0x11')][_0x380b('0x12')]===0x1f4){logger[_0x380b('0x11')](_0x380b('0xd'),_0x479fdc,_0x5909d5[_0x380b('0x11')][_0x380b('0x13')]);return _0x560e1e(_0x5909d5[_0x380b('0x11')][_0x380b('0x13')]);}logger['error'](_0x380b('0xd'),_0x479fdc,_0x5909d5['error'][_0x380b('0x13')]);return _0x379eac(_0x5909d5[_0x380b('0x11')][_0x380b('0x13')]);}else{logger[_0x380b('0xc')](_0x380b('0xd'),_0x479fdc,_0x380b('0xe'));_0x379eac(_0x5909d5[_0x380b('0x14')][_0x380b('0x13')]);}})[_0x380b('0x15')](function(_0xfb7146){logger['error'](_0x380b('0xd'),_0x479fdc,_0xfb7146);_0x560e1e(_0xfb7146);});});} \ No newline at end of file +var _0x852a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','AnalyticExtractedReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x3eec42,_0x192ed2){var _0x110bf0=function(_0x4ef488){while(--_0x4ef488){_0x3eec42['push'](_0x3eec42['shift']());}};_0x110bf0(++_0x192ed2);}(_0x852a,0x89));var _0xa852=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x852a[_0x4bb66f];return _0xf2772f;};'use strict';var _=require(_0xa852('0x0'));var util=require(_0xa852('0x1'));var moment=require(_0xa852('0x2'));var BPromise=require(_0xa852('0x3'));var rs=require(_0xa852('0x4'));var fs=require('fs');var Redis=require(_0xa852('0x5'));var db=require(_0xa852('0x6'))['db'];var utils=require(_0xa852('0x7'));var logger=require(_0xa852('0x8'))(_0xa852('0x9'));var config=require(_0xa852('0xa'));var jayson=require(_0xa852('0xb'));var client=jayson[_0xa852('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c07e7,_0x225954,_0x24e2c9){return new BPromise(function(_0x39ed2f,_0x404046){return client[_0xa852('0xd')](_0x2c07e7,_0x24e2c9)[_0xa852('0xe')](function(_0x3a6870){logger[_0xa852('0xf')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x225954,_0xa852('0x10'));logger[_0xa852('0x11')](_0xa852('0x12'),_0x225954,_0xa852('0x10'),JSON[_0xa852('0x13')](_0x3a6870));if(_0x3a6870['error']){if(_0x3a6870[_0xa852('0x14')][_0xa852('0x15')]===0x1f4){logger['error'](_0xa852('0x16'),_0x225954,_0x3a6870[_0xa852('0x14')][_0xa852('0x17')]);return _0x404046(_0x3a6870['error'][_0xa852('0x17')]);}logger['error'](_0xa852('0x16'),_0x225954,_0x3a6870[_0xa852('0x14')][_0xa852('0x17')]);return _0x39ed2f(_0x3a6870[_0xa852('0x14')][_0xa852('0x17')]);}else{logger[_0xa852('0xf')](_0xa852('0x16'),_0x225954,_0xa852('0x10'));_0x39ed2f(_0x3a6870['result'][_0xa852('0x17')]);}})['catch'](function(_0x42cbe6){logger[_0xa852('0x14')](_0xa852('0x16'),_0x225954,_0x42cbe6);_0x404046(_0x42cbe6);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 990b27e..6289377 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 _0x5bb7=['show','/:id/download','download','post','create','put','update','destroy','multer','path','connect-timeout','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','/:id'];(function(_0x464a12,_0x222e43){var _0x22342d=function(_0x2dbfe9){while(--_0x2dbfe9){_0x464a12['push'](_0x464a12['shift']());}};_0x22342d(++_0x222e43);}(_0x5bb7,0x104));var _0x75bb=function(_0x1fc122,_0x5e2c17){_0x1fc122=_0x1fc122-0x0;var _0xa2cb13=_0x5bb7[_0x1fc122];return _0xa2cb13;};'use strict';var multer=require(_0x75bb('0x0'));var util=require('util');var path=require(_0x75bb('0x1'));var timeout=require(_0x75bb('0x2'));var express=require('express');var router=express['Router']();var auth=require(_0x75bb('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x75bb('0x4'));var controller=require(_0x75bb('0x5'));router[_0x75bb('0x6')]('/',auth[_0x75bb('0x7')](),controller[_0x75bb('0x8')]);router[_0x75bb('0x6')](_0x75bb('0x9'),auth['isAuthenticated'](),controller[_0x75bb('0xa')]);router[_0x75bb('0x6')](_0x75bb('0xb'),auth[_0x75bb('0x7')](),controller[_0x75bb('0xc')]);router[_0x75bb('0xd')]('/',auth[_0x75bb('0x7')](),controller[_0x75bb('0xe')]);router[_0x75bb('0xf')]('/:id',auth[_0x75bb('0x7')](),controller[_0x75bb('0x10')]);router['delete'](_0x75bb('0x9'),auth[_0x75bb('0x7')](),controller[_0x75bb('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6a7a=['post','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./analyticExtractedReport.controller','get','isAuthenticated','/:id','/:id/download','download'];(function(_0x3efd24,_0x307e53){var _0x5df6f2=function(_0x52503d){while(--_0x52503d){_0x3efd24['push'](_0x3efd24['shift']());}};_0x5df6f2(++_0x307e53);}(_0x6a7a,0x1ad));var _0xa6a7=function(_0x1e3f2b,_0x3b0f1e){_0x1e3f2b=_0x1e3f2b-0x0;var _0x3f6400=_0x6a7a[_0x1e3f2b];return _0x3f6400;};'use strict';var multer=require(_0xa6a7('0x0'));var util=require(_0xa6a7('0x1'));var path=require(_0xa6a7('0x2'));var timeout=require(_0xa6a7('0x3'));var express=require('express');var router=express[_0xa6a7('0x4')]();var auth=require(_0xa6a7('0x5'));var interaction=require(_0xa6a7('0x6'));var config=require('../../config/environment');var controller=require(_0xa6a7('0x7'));router[_0xa6a7('0x8')]('/',auth[_0xa6a7('0x9')](),controller['index']);router['get'](_0xa6a7('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xa6a7('0x8')](_0xa6a7('0xb'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0xc')]);router[_0xa6a7('0xd')]('/',auth[_0xa6a7('0x9')](),controller['create']);router['put'](_0xa6a7('0xa'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0xe')]);router['delete'](_0xa6a7('0xa'),auth[_0xa6a7('0x9')](),controller[_0xa6a7('0xf')]);module[_0xa6a7('0x10')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index 1dc1e15..a6736d0 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 _0x7a54=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x37705d,_0x227651){var _0x164028=function(_0x266b8b){while(--_0x266b8b){_0x37705d['push'](_0x37705d['shift']());}};_0x164028(++_0x227651);}(_0x7a54,0x106));var _0x47a5=function(_0x4c79d4,_0x2a8eb8){_0x4c79d4=_0x4c79d4-0x0;var _0x4af30b=_0x7a54[_0x4c79d4];return _0x4af30b;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'field':{'type':Sequelize[_0x47a5('0x2')]},'alias':{'type':Sequelize['STRING']},'function':{'type':Sequelize[_0x47a5('0x3')]},'format':{'type':Sequelize[_0x47a5('0x3')]},'groupBy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x47a5('0x3')]},'custom':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0x1261=['exports','TEXT','STRING','BOOLEAN'];(function(_0x61daa3,_0x357415){var _0x3072a5=function(_0xb4f2f9){while(--_0xb4f2f9){_0x61daa3['push'](_0x61daa3['shift']());}};_0x3072a5(++_0x357415);}(_0x1261,0x144));var _0x1126=function(_0x19aa84,_0x549537){_0x19aa84=_0x19aa84-0x0;var _0x536146=_0x1261[_0x19aa84];return _0x536146;};'use strict';var Sequelize=require('sequelize');module[_0x1126('0x0')]={'field':{'type':Sequelize[_0x1126('0x1')]},'alias':{'type':Sequelize[_0x1126('0x2')]},'function':{'type':Sequelize[_0x1126('0x2')]},'format':{'type':Sequelize[_0x1126('0x2')]},'groupBy':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0x1126('0x2')]},'custom':{'type':Sequelize[_0x1126('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index d51e18c..cc82b57 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 _0xdcdb=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','bulkCreate','params','bulkDestroy','ids','AnalyticCustomReport','transaction','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','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','reject','save','then','destroy','end','error','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','name','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter'];(function(_0x46effc,_0x4886f5){var _0x5a985f=function(_0x1af692){while(--_0x1af692){_0x46effc['push'](_0x46effc['shift']());}};_0x5a985f(++_0x4886f5);}(_0xdcdb,0x64));var _0xbdcd=function(_0x22dd90,_0x538096){_0x22dd90=_0x22dd90-0x0;var _0x15361f=_0xdcdb[_0x22dd90];return _0x15361f;};'use strict';var pdf=require(_0xbdcd('0x0'));var emlformat=require(_0xbdcd('0x1'));var rimraf=require(_0xbdcd('0x2'));var zipdir=require(_0xbdcd('0x3'));var jsonpatch=require(_0xbdcd('0x4'));var rp=require(_0xbdcd('0x5'));var moment=require(_0xbdcd('0x6'));var BPromise=require(_0xbdcd('0x7'));var Mustache=require(_0xbdcd('0x8'));var util=require(_0xbdcd('0x9'));var path=require(_0xbdcd('0xa'));var sox=require(_0xbdcd('0xb'));var csv=require(_0xbdcd('0xc'));var ejs=require(_0xbdcd('0xd'));var fs=require('fs');var _=require(_0xbdcd('0xe'));var squel=require(_0xbdcd('0xf'));var crypto=require(_0xbdcd('0x10'));var jsforce=require(_0xbdcd('0x11'));var deskjs=require(_0xbdcd('0x12'));var toCsv=require(_0xbdcd('0xc'));var querystring=require('querystring');var Papa=require(_0xbdcd('0x13'));var Redis=require(_0xbdcd('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xbdcd('0x15'));var as=require(_0xbdcd('0x16'));var hardwareService=require(_0xbdcd('0x17'));var logger=require(_0xbdcd('0x18'))(_0xbdcd('0x19'));var utils=require(_0xbdcd('0x1a'));var config=require(_0xbdcd('0x1b'));var db=require(_0xbdcd('0x1c'))['db'];function respondWithStatusCode(_0x4f55f3,_0x353c5f){_0x353c5f=_0x353c5f||0xcc;return function(_0x5860cb){if(_0x5860cb){return _0x4f55f3[_0xbdcd('0x1d')](_0x353c5f);}return _0x4f55f3['status'](_0x353c5f)['end']();};}function respondWithResult(_0x19447f,_0x5412fb){_0x5412fb=_0x5412fb||0xc8;return function(_0x408017){if(_0x408017){return _0x19447f[_0xbdcd('0x1e')](_0x5412fb)['json'](_0x408017);}};}function respondWithFilteredResult(_0x2a17d1,_0x294a4e){return function(_0x75f924){if(_0x75f924){var _0x147261=_0x75f924[_0xbdcd('0x1f')],_0x500fb9=_0x294a4e[_0xbdcd('0x20')],_0x29a41f=_0x294a4e[_0xbdcd('0x20')]+_0x294a4e[_0xbdcd('0x21')],_0x1160d9;if(_0x29a41f>=_0x147261){_0x29a41f=_0x147261;_0x1160d9=0xc8;}else{_0x1160d9=0xce;}_0x2a17d1[_0xbdcd('0x1e')](_0x1160d9);return _0x2a17d1[_0xbdcd('0x22')](_0xbdcd('0x23'),_0x500fb9+'-'+_0x29a41f+'/'+_0x147261)[_0xbdcd('0x24')](_0x75f924);}return null;};}function patchUpdates(_0x4f5c5c){return function(_0x5d86c1){try{jsonpatch['apply'](_0x5d86c1,_0x4f5c5c,!![]);}catch(_0x4135bc){return BPromise[_0xbdcd('0x25')](_0x4135bc);}return _0x5d86c1[_0xbdcd('0x26')]();};}function saveUpdates(_0x3a96c0,_0x2835b4){return function(_0x2111c9){if(_0x2111c9){return _0x2111c9['update'](_0x3a96c0)[_0xbdcd('0x27')](function(_0x30bb5e){return _0x30bb5e;});}return null;};}function removeEntity(_0x2f095e,_0x779716){return function(_0x143e03){if(_0x143e03){return _0x143e03[_0xbdcd('0x28')]()[_0xbdcd('0x27')](function(){_0x2f095e[_0xbdcd('0x1e')](0xcc)[_0xbdcd('0x29')]();});}};}function handleEntityNotFound(_0x4c67da,_0x868c1){return function(_0x3dc2c2){if(!_0x3dc2c2){_0x4c67da[_0xbdcd('0x1d')](0x194);}return _0x3dc2c2;};}function handleError(_0x1be8e6,_0x1a2911){_0x1a2911=_0x1a2911||0x1f4;return function(_0x2f3fb8){logger[_0xbdcd('0x2a')](_0x2f3fb8['stack']);if(_0x2f3fb8['name']){delete _0x2f3fb8['name'];}_0x1be8e6['status'](_0x1a2911)['send'](_0x2f3fb8);};}exports[_0xbdcd('0x2b')]=function(_0x3bd413,_0x5949ef){var _0x358751={},_0x92a778={},_0x38a31f={'count':0x0,'rows':[]};var _0x580473=_[_0xbdcd('0x2c')](db[_0xbdcd('0x2d')][_0xbdcd('0x2e')],function(_0x4a9f02){return{'name':_0x4a9f02[_0xbdcd('0x2f')],'type':_0x4a9f02[_0xbdcd('0x30')]['key']};});_0x92a778[_0xbdcd('0x31')]=_[_0xbdcd('0x2c')](_0x580473,_0xbdcd('0x32'));_0x92a778[_0xbdcd('0x33')]=_[_0xbdcd('0x34')](_0x3bd413[_0xbdcd('0x33')]);_0x92a778[_0xbdcd('0x35')]=_[_0xbdcd('0x36')](_0x92a778['model'],_0x92a778[_0xbdcd('0x33')]);_0x358751[_0xbdcd('0x37')]=_['intersection'](_0x92a778[_0xbdcd('0x31')],qs['fields'](_0x3bd413['query'][_0xbdcd('0x38')]));_0x358751[_0xbdcd('0x37')]=_0x358751[_0xbdcd('0x37')][_0xbdcd('0x39')]?_0x358751['attributes']:_0x92a778[_0xbdcd('0x31')];if(!_0x3bd413[_0xbdcd('0x33')]['hasOwnProperty'](_0xbdcd('0x3a'))){_0x358751[_0xbdcd('0x21')]=qs['limit'](_0x3bd413[_0xbdcd('0x33')][_0xbdcd('0x21')]);_0x358751[_0xbdcd('0x20')]=qs[_0xbdcd('0x20')](_0x3bd413[_0xbdcd('0x33')][_0xbdcd('0x20')]);}_0x358751[_0xbdcd('0x3b')]=qs[_0xbdcd('0x3c')](_0x3bd413[_0xbdcd('0x33')][_0xbdcd('0x3c')]);_0x358751[_0xbdcd('0x3d')]=qs[_0xbdcd('0x35')](_[_0xbdcd('0x3e')](_0x3bd413['query'],_0x92a778[_0xbdcd('0x35')]));if(_0x3bd413[_0xbdcd('0x33')][_0xbdcd('0x3f')]){_0x358751[_0xbdcd('0x3d')]=_[_0xbdcd('0x40')](_0x358751['where'],{'$or':_[_0xbdcd('0x2c')](_0x580473,function(_0x11fca5){if(_0x11fca5[_0xbdcd('0x30')]!==_0xbdcd('0x41')){var _0x36997e={};_0x36997e[_0x11fca5[_0xbdcd('0x32')]]={'$like':'%'+_0x3bd413[_0xbdcd('0x33')][_0xbdcd('0x3f')]+'%'};return _0x36997e;}})});}_0x358751=_['merge']({},_0x358751,_0x3bd413[_0xbdcd('0x42')]);var _0x1fe32c={'where':_0x358751[_0xbdcd('0x3d')]};return db[_0xbdcd('0x2d')][_0xbdcd('0x1f')](_0x1fe32c)[_0xbdcd('0x27')](function(_0x30721f){_0x38a31f[_0xbdcd('0x1f')]=_0x30721f;if(_0x3bd413['query'][_0xbdcd('0x43')]){_0x358751[_0xbdcd('0x44')]=[{'all':!![]}];}return db[_0xbdcd('0x2d')][_0xbdcd('0x45')](_0x358751);})[_0xbdcd('0x27')](function(_0x2bb918){_0x38a31f[_0xbdcd('0x46')]=_0x2bb918;return _0x38a31f;})['then'](respondWithFilteredResult(_0x5949ef,_0x358751))[_0xbdcd('0x47')](handleError(_0x5949ef,null));};exports[_0xbdcd('0x48')]=function(_0x14d67a,_0x10ab68){var _0x22998e={'raw':![],'where':{'id':_0x14d67a['params']['id']}},_0x585793={};_0x585793[_0xbdcd('0x31')]=_[_0xbdcd('0x34')](db[_0xbdcd('0x2d')][_0xbdcd('0x2e')]);_0x585793['query']=_[_0xbdcd('0x34')](_0x14d67a[_0xbdcd('0x33')]);_0x585793[_0xbdcd('0x35')]=_['intersection'](_0x585793[_0xbdcd('0x31')],_0x585793['query']);_0x22998e[_0xbdcd('0x37')]=_[_0xbdcd('0x36')](_0x585793[_0xbdcd('0x31')],qs[_0xbdcd('0x38')](_0x14d67a[_0xbdcd('0x33')][_0xbdcd('0x38')]));_0x22998e['attributes']=_0x22998e[_0xbdcd('0x37')][_0xbdcd('0x39')]?_0x22998e[_0xbdcd('0x37')]:_0x585793[_0xbdcd('0x31')];if(_0x14d67a[_0xbdcd('0x33')][_0xbdcd('0x43')]){_0x22998e[_0xbdcd('0x44')]=[{'all':!![]}];}_0x22998e=_[_0xbdcd('0x40')]({},_0x22998e,_0x14d67a['options']);return db[_0xbdcd('0x2d')][_0xbdcd('0x49')](_0x22998e)[_0xbdcd('0x27')](handleEntityNotFound(_0x10ab68,null))[_0xbdcd('0x27')](respondWithResult(_0x10ab68,null))[_0xbdcd('0x47')](handleError(_0x10ab68,null));};exports[_0xbdcd('0x4a')]=function(_0x581bb6,_0x4b80de){return db[_0xbdcd('0x2d')]['create'](_0x581bb6[_0xbdcd('0x4b')],{})[_0xbdcd('0x27')](respondWithResult(_0x4b80de,0xc9))[_0xbdcd('0x47')](handleError(_0x4b80de,null));};exports[_0xbdcd('0x4c')]=function(_0x10a354,_0x9b1170){return db[_0xbdcd('0x2d')][_0xbdcd('0x4c')](_0x10a354[_0xbdcd('0x4b')],{'raw':![],'individualHooks':!![]})[_0xbdcd('0x27')](respondWithResult(_0x9b1170,0xc9))[_0xbdcd('0x47')](handleError(_0x9b1170,null));};exports['update']=function(_0x31941a,_0x3bd0f5){if(_0x31941a[_0xbdcd('0x4b')]['id']){delete _0x31941a[_0xbdcd('0x4b')]['id'];}return db[_0xbdcd('0x2d')][_0xbdcd('0x49')]({'where':{'id':_0x31941a[_0xbdcd('0x4d')]['id']}})['then'](handleEntityNotFound(_0x3bd0f5,null))[_0xbdcd('0x27')](saveUpdates(_0x31941a[_0xbdcd('0x4b')],null))['then'](respondWithResult(_0x3bd0f5,null))[_0xbdcd('0x47')](handleError(_0x3bd0f5,null));};exports[_0xbdcd('0x28')]=function(_0xcc52ba,_0x169805){return db[_0xbdcd('0x2d')]['find']({'where':{'id':_0xcc52ba['params']['id']}})[_0xbdcd('0x27')](handleEntityNotFound(_0x169805,null))[_0xbdcd('0x27')](removeEntity(_0x169805,null))[_0xbdcd('0x47')](handleError(_0x169805,null));};exports[_0xbdcd('0x4e')]=function(_0x21dd58,_0x5df1b6){return db[_0xbdcd('0x2d')][_0xbdcd('0x28')]({'where':{'id':_0x21dd58[_0xbdcd('0x33')][_0xbdcd('0x4f')]||[]},'raw':![],'individualHooks':!![]})[_0xbdcd('0x27')](respondWithResult(_0x5df1b6,0xcc))[_0xbdcd('0x47')](handleError(_0x5df1b6,null));};exports['addFields']=function(_0x3bc32b,_0x311afd,_0x7ca95e){return db[_0xbdcd('0x50')]['findOne']({'where':{'id':_0x3bc32b['params']['id']}})[_0xbdcd('0x27')](handleEntityNotFound(_0x311afd,null))[_0xbdcd('0x27')](function(_0x160dd1){if(_0x160dd1){return db['sequelize'][_0xbdcd('0x51')](function(_0x58b964){return db[_0xbdcd('0x2d')][_0xbdcd('0x28')]({'where':{'CustomReportId':_0x3bc32b[_0xbdcd('0x4d')]['id']},'transaction':_0x58b964})[_0xbdcd('0x27')](function(_0x4ef0ab){var _0x132a47=_['map'](_0x3bc32b[_0xbdcd('0x4b')],function(_0x217e76){delete _0x217e76['id'];_0x217e76['CustomReportId']=_0x3bc32b[_0xbdcd('0x4d')]['id'];return _0x217e76;});return db['AnalyticFieldReport'][_0xbdcd('0x4c')](_0x132a47,{'transaction':_0x58b964});});})[_0xbdcd('0x27')](function(){return db['AnalyticFieldReport'][_0xbdcd('0x45')]({'where':{'CustomReportId':_0x3bc32b[_0xbdcd('0x4d')]['id']}});});}})[_0xbdcd('0x27')](respondWithResult(_0x311afd,null))['catch'](handleError(_0x311afd,null));}; \ No newline at end of file +var _0x1472=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','AnalyticFieldReport','includeAll','include','catch','show','find','create','bulkCreate','body','params','ids','findOne','sequelize','transaction','CustomReportId','findAll','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map'];(function(_0xa1e3e3,_0x29fe0e){var _0xc980e9=function(_0x1f5adc){while(--_0x1f5adc){_0xa1e3e3['push'](_0xa1e3e3['shift']());}};_0xc980e9(++_0x29fe0e);}(_0x1472,0x166));var _0x2147=function(_0x4864ea,_0x7764ed){_0x4864ea=_0x4864ea-0x0;var _0x12e74f=_0x1472[_0x4864ea];return _0x12e74f;};'use strict';var pdf=require(_0x2147('0x0'));var emlformat=require(_0x2147('0x1'));var rimraf=require(_0x2147('0x2'));var zipdir=require(_0x2147('0x3'));var jsonpatch=require(_0x2147('0x4'));var rp=require(_0x2147('0x5'));var moment=require(_0x2147('0x6'));var BPromise=require(_0x2147('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2147('0x8'));var sox=require(_0x2147('0x9'));var csv=require(_0x2147('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x2147('0xb'));var crypto=require('crypto');var jsforce=require(_0x2147('0xc'));var deskjs=require(_0x2147('0xd'));var toCsv=require(_0x2147('0xa'));var querystring=require('querystring');var Papa=require(_0x2147('0xe'));var Redis=require(_0x2147('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2147('0x10'));var as=require(_0x2147('0x11'));var hardwareService=require(_0x2147('0x12'));var logger=require(_0x2147('0x13'))(_0x2147('0x14'));var utils=require('../../config/utils');var config=require(_0x2147('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x352b6f,_0x3b774d){_0x3b774d=_0x3b774d||0xcc;return function(_0x11a373){if(_0x11a373){return _0x352b6f[_0x2147('0x16')](_0x3b774d);}return _0x352b6f[_0x2147('0x17')](_0x3b774d)[_0x2147('0x18')]();};}function respondWithResult(_0x365c1c,_0x1f14fe){_0x1f14fe=_0x1f14fe||0xc8;return function(_0x4aef54){if(_0x4aef54){return _0x365c1c[_0x2147('0x17')](_0x1f14fe)[_0x2147('0x19')](_0x4aef54);}};}function respondWithFilteredResult(_0x4aec5c,_0x4de221){return function(_0x284435){if(_0x284435){var _0x116673=_0x284435[_0x2147('0x1a')],_0x27e193=_0x4de221['offset'],_0x54327b=_0x4de221[_0x2147('0x1b')]+_0x4de221[_0x2147('0x1c')],_0x2867a9;if(_0x54327b>=_0x116673){_0x54327b=_0x116673;_0x2867a9=0xc8;}else{_0x2867a9=0xce;}_0x4aec5c[_0x2147('0x17')](_0x2867a9);return _0x4aec5c[_0x2147('0x1d')]('Content-Range',_0x27e193+'-'+_0x54327b+'/'+_0x116673)[_0x2147('0x19')](_0x284435);}return null;};}function patchUpdates(_0x21fe64){return function(_0x2d1ff8){try{jsonpatch[_0x2147('0x1e')](_0x2d1ff8,_0x21fe64,!![]);}catch(_0x239902){return BPromise[_0x2147('0x1f')](_0x239902);}return _0x2d1ff8[_0x2147('0x20')]();};}function saveUpdates(_0x5ec2d4,_0x48e737){return function(_0x298364){if(_0x298364){return _0x298364[_0x2147('0x21')](_0x5ec2d4)[_0x2147('0x22')](function(_0x2c5b19){return _0x2c5b19;});}return null;};}function removeEntity(_0x3b2053,_0x477df1){return function(_0x1035cc){if(_0x1035cc){return _0x1035cc[_0x2147('0x23')]()[_0x2147('0x22')](function(){_0x3b2053[_0x2147('0x17')](0xcc)[_0x2147('0x18')]();});}};}function handleEntityNotFound(_0x20ee10,_0x54c4ed){return function(_0x36f14a){if(!_0x36f14a){_0x20ee10[_0x2147('0x16')](0x194);}return _0x36f14a;};}function handleError(_0x336ae5,_0x3588d1){_0x3588d1=_0x3588d1||0x1f4;return function(_0x265324){logger[_0x2147('0x24')](_0x265324[_0x2147('0x25')]);if(_0x265324[_0x2147('0x26')]){delete _0x265324[_0x2147('0x26')];}_0x336ae5[_0x2147('0x17')](_0x3588d1)[_0x2147('0x27')](_0x265324);};}exports[_0x2147('0x28')]=function(_0x564552,_0x3099dd){var _0x491449={},_0x883443={},_0x272c80={'count':0x0,'rows':[]};var _0x28dc0d=_[_0x2147('0x29')](db['AnalyticFieldReport'][_0x2147('0x2a')],function(_0x339d6){return{'name':_0x339d6[_0x2147('0x2b')],'type':_0x339d6[_0x2147('0x2c')][_0x2147('0x2d')]};});_0x883443[_0x2147('0x2e')]=_[_0x2147('0x29')](_0x28dc0d,_0x2147('0x26'));_0x883443[_0x2147('0x2f')]=_[_0x2147('0x30')](_0x564552[_0x2147('0x2f')]);_0x883443[_0x2147('0x31')]=_[_0x2147('0x32')](_0x883443[_0x2147('0x2e')],_0x883443[_0x2147('0x2f')]);_0x491449['attributes']=_[_0x2147('0x32')](_0x883443['model'],qs['fields'](_0x564552[_0x2147('0x2f')][_0x2147('0x33')]));_0x491449[_0x2147('0x34')]=_0x491449['attributes'][_0x2147('0x35')]?_0x491449[_0x2147('0x34')]:_0x883443[_0x2147('0x2e')];if(!_0x564552[_0x2147('0x2f')][_0x2147('0x36')](_0x2147('0x37'))){_0x491449[_0x2147('0x1c')]=qs[_0x2147('0x1c')](_0x564552[_0x2147('0x2f')]['limit']);_0x491449[_0x2147('0x1b')]=qs[_0x2147('0x1b')](_0x564552[_0x2147('0x2f')]['offset']);}_0x491449[_0x2147('0x38')]=qs[_0x2147('0x39')](_0x564552[_0x2147('0x2f')][_0x2147('0x39')]);_0x491449[_0x2147('0x3a')]=qs[_0x2147('0x31')](_[_0x2147('0x3b')](_0x564552['query'],_0x883443[_0x2147('0x31')]));if(_0x564552['query'][_0x2147('0x3c')]){_0x491449[_0x2147('0x3a')]=_[_0x2147('0x3d')](_0x491449[_0x2147('0x3a')],{'$or':_['map'](_0x28dc0d,function(_0x44282d){if(_0x44282d[_0x2147('0x2c')]!==_0x2147('0x3e')){var _0x2bb5cb={};_0x2bb5cb[_0x44282d['name']]={'$like':'%'+_0x564552[_0x2147('0x2f')][_0x2147('0x3c')]+'%'};return _0x2bb5cb;}})});}_0x491449=_[_0x2147('0x3d')]({},_0x491449,_0x564552[_0x2147('0x3f')]);var _0x44ad02={'where':_0x491449['where']};return db[_0x2147('0x40')][_0x2147('0x1a')](_0x44ad02)['then'](function(_0xba4237){_0x272c80[_0x2147('0x1a')]=_0xba4237;if(_0x564552[_0x2147('0x2f')][_0x2147('0x41')]){_0x491449[_0x2147('0x42')]=[{'all':!![]}];}return db[_0x2147('0x40')]['findAll'](_0x491449);})[_0x2147('0x22')](function(_0x46d61d){_0x272c80['rows']=_0x46d61d;return _0x272c80;})[_0x2147('0x22')](respondWithFilteredResult(_0x3099dd,_0x491449))[_0x2147('0x43')](handleError(_0x3099dd,null));};exports[_0x2147('0x44')]=function(_0x19bac8,_0x452d3b){var _0x2534d8={'raw':![],'where':{'id':_0x19bac8['params']['id']}},_0xc4f5e3={};_0xc4f5e3[_0x2147('0x2e')]=_['keys'](db[_0x2147('0x40')][_0x2147('0x2a')]);_0xc4f5e3[_0x2147('0x2f')]=_['keys'](_0x19bac8[_0x2147('0x2f')]);_0xc4f5e3[_0x2147('0x31')]=_[_0x2147('0x32')](_0xc4f5e3['model'],_0xc4f5e3['query']);_0x2534d8[_0x2147('0x34')]=_[_0x2147('0x32')](_0xc4f5e3[_0x2147('0x2e')],qs[_0x2147('0x33')](_0x19bac8[_0x2147('0x2f')][_0x2147('0x33')]));_0x2534d8[_0x2147('0x34')]=_0x2534d8[_0x2147('0x34')][_0x2147('0x35')]?_0x2534d8[_0x2147('0x34')]:_0xc4f5e3[_0x2147('0x2e')];if(_0x19bac8[_0x2147('0x2f')][_0x2147('0x41')]){_0x2534d8[_0x2147('0x42')]=[{'all':!![]}];}_0x2534d8=_[_0x2147('0x3d')]({},_0x2534d8,_0x19bac8[_0x2147('0x3f')]);return db[_0x2147('0x40')][_0x2147('0x45')](_0x2534d8)[_0x2147('0x22')](handleEntityNotFound(_0x452d3b,null))[_0x2147('0x22')](respondWithResult(_0x452d3b,null))[_0x2147('0x43')](handleError(_0x452d3b,null));};exports['create']=function(_0x41b500,_0x17b147){return db[_0x2147('0x40')][_0x2147('0x46')](_0x41b500['body'],{})[_0x2147('0x22')](respondWithResult(_0x17b147,0xc9))[_0x2147('0x43')](handleError(_0x17b147,null));};exports[_0x2147('0x47')]=function(_0x1ed3bf,_0x5bc826){return db[_0x2147('0x40')][_0x2147('0x47')](_0x1ed3bf[_0x2147('0x48')],{'raw':![],'individualHooks':!![]})[_0x2147('0x22')](respondWithResult(_0x5bc826,0xc9))[_0x2147('0x43')](handleError(_0x5bc826,null));};exports[_0x2147('0x21')]=function(_0x407f17,_0xd4d18c){if(_0x407f17[_0x2147('0x48')]['id']){delete _0x407f17[_0x2147('0x48')]['id'];}return db[_0x2147('0x40')][_0x2147('0x45')]({'where':{'id':_0x407f17[_0x2147('0x49')]['id']}})[_0x2147('0x22')](handleEntityNotFound(_0xd4d18c,null))[_0x2147('0x22')](saveUpdates(_0x407f17['body'],null))['then'](respondWithResult(_0xd4d18c,null))['catch'](handleError(_0xd4d18c,null));};exports[_0x2147('0x23')]=function(_0x54f857,_0x3b4565){return db[_0x2147('0x40')][_0x2147('0x45')]({'where':{'id':_0x54f857['params']['id']}})['then'](handleEntityNotFound(_0x3b4565,null))[_0x2147('0x22')](removeEntity(_0x3b4565,null))[_0x2147('0x43')](handleError(_0x3b4565,null));};exports['bulkDestroy']=function(_0x4e2559,_0x532224){return db['AnalyticFieldReport'][_0x2147('0x23')]({'where':{'id':_0x4e2559[_0x2147('0x2f')][_0x2147('0x4a')]||[]},'raw':![],'individualHooks':!![]})[_0x2147('0x22')](respondWithResult(_0x532224,0xcc))[_0x2147('0x43')](handleError(_0x532224,null));};exports['addFields']=function(_0x34d070,_0x59610d,_0x41229b){return db['AnalyticCustomReport'][_0x2147('0x4b')]({'where':{'id':_0x34d070[_0x2147('0x49')]['id']}})[_0x2147('0x22')](handleEntityNotFound(_0x59610d,null))[_0x2147('0x22')](function(_0x3f54c1){if(_0x3f54c1){return db[_0x2147('0x4c')][_0x2147('0x4d')](function(_0x3273ee){return db[_0x2147('0x40')][_0x2147('0x23')]({'where':{'CustomReportId':_0x34d070[_0x2147('0x49')]['id']},'transaction':_0x3273ee})['then'](function(_0x41d781){var _0xe0f4db=_['map'](_0x34d070[_0x2147('0x48')],function(_0x4487fb){delete _0x4487fb['id'];_0x4487fb[_0x2147('0x4e')]=_0x34d070[_0x2147('0x49')]['id'];return _0x4487fb;});return db[_0x2147('0x40')][_0x2147('0x47')](_0xe0f4db,{'transaction':_0x3273ee});});})[_0x2147('0x22')](function(){return db['AnalyticFieldReport'][_0x2147('0x4f')]({'where':{'CustomReportId':_0x34d070['params']['id']}});});}})['then'](respondWithResult(_0x59610d,null))['catch'](handleError(_0x59610d,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 9981f91..3f3bc24 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 _0x7ea9=['rimraf','../../config/environment','./analyticFieldReport.attributes','exports','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','moment','bluebird'];(function(_0x4c1dcf,_0x56b757){var _0x153529=function(_0x43e02b){while(--_0x43e02b){_0x4c1dcf['push'](_0x4c1dcf['shift']());}};_0x153529(++_0x56b757);}(_0x7ea9,0xf8));var _0x97ea=function(_0x1a0782,_0x113ac1){_0x1a0782=_0x1a0782-0x0;var _0x32189b=_0x7ea9[_0x1a0782];return _0x32189b;};'use strict';var _=require(_0x97ea('0x0'));var util=require(_0x97ea('0x1'));var logger=require(_0x97ea('0x2'))('api');var moment=require(_0x97ea('0x3'));var BPromise=require(_0x97ea('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x97ea('0x5'));var config=require(_0x97ea('0x6'));var attributes=require(_0x97ea('0x7'));module[_0x97ea('0x8')]=function(_0x37935b,_0x6234f9){return _0x37935b['define'](_0x97ea('0x9'),attributes,{'tableName':_0x97ea('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d3e=['rimraf','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','request-promise','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x5d3e,0x15d));var _0xe5d3=function(_0x568bde,_0x328f01){_0x568bde=_0x568bde-0x0;var _0x4cc2a0=_0x5d3e[_0x568bde];return _0x4cc2a0;};'use strict';var _=require(_0xe5d3('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xe5d3('0x1'));var fs=require('fs');var path=require(_0xe5d3('0x2'));var rimraf=require(_0xe5d3('0x3'));var config=require('../../config/environment');var attributes=require('./analyticFieldReport.attributes');module[_0xe5d3('0x4')]=function(_0x496b92,_0x461b40){return _0x496b92[_0xe5d3('0x5')](_0xe5d3('0x6'),attributes,{'tableName':_0xe5d3('0x7'),'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 c259ed4..bea8db7 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 _0x06d8=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','AnalyticFieldReport,\x20%s,\x20%s'];(function(_0x3c7b04,_0x2e8b50){var _0x4be4f7=function(_0x3278b5){while(--_0x3278b5){_0x3c7b04['push'](_0x3c7b04['shift']());}};_0x4be4f7(++_0x2e8b50);}(_0x06d8,0x12f));var _0x806d=function(_0x4c2bac,_0x5750d4){_0x4c2bac=_0x4c2bac-0x0;var _0x3bc1dc=_0x06d8[_0x4c2bac];return _0x3bc1dc;};'use strict';var _=require('lodash');var util=require(_0x806d('0x0'));var moment=require(_0x806d('0x1'));var BPromise=require(_0x806d('0x2'));var rs=require(_0x806d('0x3'));var fs=require('fs');var Redis=require(_0x806d('0x4'));var db=require(_0x806d('0x5'))['db'];var utils=require(_0x806d('0x6'));var logger=require('../../config/logger')(_0x806d('0x7'));var config=require(_0x806d('0x8'));var jayson=require(_0x806d('0x9'));var client=jayson[_0x806d('0xa')][_0x806d('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x16a646,_0x547407,_0x1e7417){return new BPromise(function(_0x5bee4f,_0x829575){return client[_0x806d('0xc')](_0x16a646,_0x1e7417)[_0x806d('0xd')](function(_0x319b1b){logger[_0x806d('0xe')]('AnalyticFieldReport,\x20%s,\x20%s',_0x547407,'request\x20sent');logger[_0x806d('0xf')](_0x806d('0x10'),_0x547407,_0x806d('0x11'),JSON[_0x806d('0x12')](_0x319b1b));if(_0x319b1b[_0x806d('0x13')]){if(_0x319b1b[_0x806d('0x13')][_0x806d('0x14')]===0x1f4){logger[_0x806d('0x13')](_0x806d('0x15'),_0x547407,_0x319b1b[_0x806d('0x13')]['message']);return _0x829575(_0x319b1b['error'][_0x806d('0x16')]);}logger['error'](_0x806d('0x15'),_0x547407,_0x319b1b['error']['message']);return _0x5bee4f(_0x319b1b[_0x806d('0x13')][_0x806d('0x16')]);}else{logger['info'](_0x806d('0x15'),_0x547407,_0x806d('0x11'));_0x5bee4f(_0x319b1b[_0x806d('0x17')][_0x806d('0x16')]);}})[_0x806d('0x18')](function(_0x305bcc){logger['error'](_0x806d('0x15'),_0x547407,_0x305bcc);_0x829575(_0x305bcc);});});} \ No newline at end of file +var _0xc8b4=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','stringify','error','AnalyticFieldReport,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','moment'];(function(_0x128d15,_0xf6f86c){var _0x2be577=function(_0x270ec5){while(--_0x270ec5){_0x128d15['push'](_0x128d15['shift']());}};_0x2be577(++_0xf6f86c);}(_0xc8b4,0x1f1));var _0x4c8b=function(_0x54852a,_0x3fe89b){_0x54852a=_0x54852a-0x0;var _0x101863=_0xc8b4[_0x54852a];return _0x101863;};'use strict';var _=require(_0x4c8b('0x0'));var util=require(_0x4c8b('0x1'));var moment=require(_0x4c8b('0x2'));var BPromise=require(_0x4c8b('0x3'));var rs=require(_0x4c8b('0x4'));var fs=require('fs');var Redis=require(_0x4c8b('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x4c8b('0x6'));var logger=require(_0x4c8b('0x7'))(_0x4c8b('0x8'));var config=require('../../config/environment');var jayson=require(_0x4c8b('0x9'));var client=jayson[_0x4c8b('0xa')][_0x4c8b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x47109e,_0x412443,_0xcf2074){return new BPromise(function(_0x42436c,_0x1fc0d3){return client['request'](_0x47109e,_0xcf2074)[_0x4c8b('0xc')](function(_0x501c59){logger[_0x4c8b('0xd')]('AnalyticFieldReport,\x20%s,\x20%s',_0x412443,'request\x20sent');logger['debug']('AnalyticFieldReport,\x20%s,\x20%s,\x20%s',_0x412443,'request\x20sent',JSON[_0x4c8b('0xe')](_0x501c59));if(_0x501c59['error']){if(_0x501c59[_0x4c8b('0xf')]['code']===0x1f4){logger[_0x4c8b('0xf')](_0x4c8b('0x10'),_0x412443,_0x501c59[_0x4c8b('0xf')]['message']);return _0x1fc0d3(_0x501c59['error'][_0x4c8b('0x11')]);}logger[_0x4c8b('0xf')](_0x4c8b('0x10'),_0x412443,_0x501c59[_0x4c8b('0xf')]['message']);return _0x42436c(_0x501c59[_0x4c8b('0xf')][_0x4c8b('0x11')]);}else{logger[_0x4c8b('0xd')](_0x4c8b('0x10'),_0x412443,_0x4c8b('0x12'));_0x42436c(_0x501c59[_0x4c8b('0x13')]['message']);}})['catch'](function(_0x558cd1){logger[_0x4c8b('0xf')]('AnalyticFieldReport,\x20%s,\x20%s',_0x412443,_0x558cd1);_0x1fc0d3(_0x558cd1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index ec4b65e..bd0f9a1 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['/:id/create_many','addFields','put','update','delete','bulkDestroy','destroy','exports','multer','util','Router','../../components/auth/service','../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','show','post','create','bulkCreate'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x55ca,0x126));var _0xa55c=function(_0x36d2e4,_0x49819a){_0x36d2e4=_0x36d2e4-0x0;var _0x3c32ae=_0x55ca[_0x36d2e4];return _0x3c32ae;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var auth=require(_0xa55c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xa55c('0x4'));var controller=require(_0xa55c('0x5'));router[_0xa55c('0x6')]('/',auth[_0xa55c('0x7')](),controller[_0xa55c('0x8')]);router[_0xa55c('0x6')](_0xa55c('0x9'),auth['isAuthenticated'](),controller[_0xa55c('0xa')]);router[_0xa55c('0xb')]('/',auth['isAuthenticated'](),controller[_0xa55c('0xc')]);router[_0xa55c('0xb')]('/create_many',auth['isAuthenticated'](),controller[_0xa55c('0xd')]);router[_0xa55c('0xb')](_0xa55c('0xe'),auth[_0xa55c('0x7')](),controller[_0xa55c('0xf')]);router[_0xa55c('0x10')](_0xa55c('0x9'),auth[_0xa55c('0x7')](),controller[_0xa55c('0x11')]);router[_0xa55c('0x12')]('/destroy_many',auth['isAuthenticated'](),controller[_0xa55c('0x13')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xa55c('0x14')]);module[_0xa55c('0x15')]=router; \ No newline at end of file +var _0x814b=['../../config/environment','./analyticFieldReport.controller','get','isAuthenticated','index','/:id','post','create','/create_many','bulkCreate','/:id/create_many','addFields','update','delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x445b03,_0x964cd6){var _0x5015d8=function(_0x51c008){while(--_0x51c008){_0x445b03['push'](_0x445b03['shift']());}};_0x5015d8(++_0x964cd6);}(_0x814b,0x1a2));var _0xb814=function(_0x1de43c,_0xaa29de){_0x1de43c=_0x1de43c-0x0;var _0x296d3e=_0x814b[_0x1de43c];return _0x296d3e;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb814('0x6'));var config=require(_0xb814('0x7'));var controller=require(_0xb814('0x8'));router[_0xb814('0x9')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xb')]);router['get'](_0xb814('0xc'),auth[_0xb814('0xa')](),controller['show']);router[_0xb814('0xd')]('/',auth[_0xb814('0xa')](),controller[_0xb814('0xe')]);router[_0xb814('0xd')](_0xb814('0xf'),auth[_0xb814('0xa')](),controller[_0xb814('0x10')]);router[_0xb814('0xd')](_0xb814('0x11'),auth[_0xb814('0xa')](),controller[_0xb814('0x12')]);router['put'](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);router[_0xb814('0x14')](_0xb814('0x15'),auth[_0xb814('0xa')](),controller[_0xb814('0x16')]);router[_0xb814('0x14')](_0xb814('0xc'),auth[_0xb814('0xa')](),controller[_0xb814('0x17')]);module[_0xb814('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 7929fe9..b8c286b 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 _0xf7a3=['TEXT','STRING','name'];(function(_0x12acdc,_0x43a85b){var _0x908df4=function(_0x799d11){while(--_0x799d11){_0x12acdc['push'](_0x12acdc['shift']());}};_0x908df4(++_0x43a85b);}(_0xf7a3,0xac));var _0x3f7a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0xf7a3[_0x2a6809];return _0x11c371;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x3f7a('0x0')],'allowNull':![],'unique':_0x3f7a('0x1')},'table':{'type':Sequelize['STRING']},'metric':{'type':Sequelize[_0x3f7a('0x2')]},'description':{'type':Sequelize[_0x3f7a('0x0')]}}; \ No newline at end of file +var _0x8ba2=['exports','STRING','TEXT','sequelize'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8ba2,0x13f));var _0x28ba=function(_0x488237,_0x33c515){_0x488237=_0x488237-0x0;var _0x16e5c8=_0x8ba2[_0x488237];return _0x16e5c8;};'use strict';var Sequelize=require(_0x28ba('0x0'));module[_0x28ba('0x1')]={'name':{'type':Sequelize[_0x28ba('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x28ba('0x2')]},'metric':{'type':Sequelize[_0x28ba('0x3')]},'description':{'type':Sequelize[_0x28ba('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 3f10974..7c8f822 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 _0xbdf4=['attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','AnalyticMetric','includeAll','findAll','rows','catch','show','params','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','UserProfileSection','userProfileId','autoAssociation','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','UserProfileResource','error','stack','name','map','rawAttributes','type','key','model','query','keys','filters','intersection'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xbdf4,0x16b));var _0x4bdf=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0xbdf4[_0x44bcb0];return _0xfaf881;};'use strict';var pdf=require(_0x4bdf('0x0'));var emlformat=require(_0x4bdf('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x4bdf('0x2'));var jsonpatch=require(_0x4bdf('0x3'));var rp=require(_0x4bdf('0x4'));var moment=require(_0x4bdf('0x5'));var BPromise=require(_0x4bdf('0x6'));var Mustache=require(_0x4bdf('0x7'));var util=require(_0x4bdf('0x8'));var path=require(_0x4bdf('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x4bdf('0xa'));var fs=require('fs');var _=require(_0x4bdf('0xb'));var squel=require(_0x4bdf('0xc'));var crypto=require('crypto');var jsforce=require(_0x4bdf('0xd'));var deskjs=require(_0x4bdf('0xe'));var toCsv=require(_0x4bdf('0xf'));var querystring=require('querystring');var Papa=require(_0x4bdf('0x10'));var Redis=require(_0x4bdf('0x11'));var authService=require(_0x4bdf('0x12'));var qs=require(_0x4bdf('0x13'));var as=require(_0x4bdf('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4bdf('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x4bdf('0x16'));var db=require(_0x4bdf('0x17'))['db'];function respondWithStatusCode(_0xc9bfa1,_0x3f3592){_0x3f3592=_0x3f3592||0xcc;return function(_0x427f87){if(_0x427f87){return _0xc9bfa1[_0x4bdf('0x18')](_0x3f3592);}return _0xc9bfa1[_0x4bdf('0x19')](_0x3f3592)[_0x4bdf('0x1a')]();};}function respondWithResult(_0x5d5196,_0x5e7dbd){_0x5e7dbd=_0x5e7dbd||0xc8;return function(_0x4e2212){if(_0x4e2212){return _0x5d5196[_0x4bdf('0x19')](_0x5e7dbd)[_0x4bdf('0x1b')](_0x4e2212);}};}function respondWithFilteredResult(_0x46b3ea,_0x1d87e9){return function(_0x493c29){if(_0x493c29){var _0x272563=_0x493c29[_0x4bdf('0x1c')],_0x1155cf=_0x1d87e9[_0x4bdf('0x1d')],_0x40056d=_0x1d87e9[_0x4bdf('0x1d')]+_0x1d87e9['limit'],_0x11974d;if(_0x40056d>=_0x272563){_0x40056d=_0x272563;_0x11974d=0xc8;}else{_0x11974d=0xce;}_0x46b3ea[_0x4bdf('0x19')](_0x11974d);return _0x46b3ea[_0x4bdf('0x1e')](_0x4bdf('0x1f'),_0x1155cf+'-'+_0x40056d+'/'+_0x272563)[_0x4bdf('0x1b')](_0x493c29);}return null;};}function patchUpdates(_0x267128){return function(_0x1e0e15){try{jsonpatch[_0x4bdf('0x20')](_0x1e0e15,_0x267128,!![]);}catch(_0x4a89f0){return BPromise[_0x4bdf('0x21')](_0x4a89f0);}return _0x1e0e15[_0x4bdf('0x22')]();};}function saveUpdates(_0xfcf0c6,_0x431ab4){return function(_0x26de03){if(_0x26de03){return _0x26de03[_0x4bdf('0x23')](_0xfcf0c6)[_0x4bdf('0x24')](function(_0x1fbb8f){return _0x1fbb8f;});}return null;};}function removeEntity(_0xb6d188,_0x1dff4e){return function(_0x8fc99e){if(_0x8fc99e){return _0x8fc99e[_0x4bdf('0x25')]()[_0x4bdf('0x24')](function(){var _0x5b5fc4=_0x8fc99e[_0x4bdf('0x26')]({'plain':!![]});var _0x39ad7d='Metrics';return db[_0x4bdf('0x27')][_0x4bdf('0x25')]({'where':{'type':_0x39ad7d,'resourceId':_0x5b5fc4['id']}})['then'](function(){return _0x8fc99e;});})[_0x4bdf('0x24')](function(){_0xb6d188[_0x4bdf('0x19')](0xcc)[_0x4bdf('0x1a')]();});}};}function handleEntityNotFound(_0x5f284d,_0x324b39){return function(_0xb6fdc4){if(!_0xb6fdc4){_0x5f284d['sendStatus'](0x194);}return _0xb6fdc4;};}function handleError(_0x1a76ce,_0x4d9014){_0x4d9014=_0x4d9014||0x1f4;return function(_0x983ee2){logger[_0x4bdf('0x28')](_0x983ee2[_0x4bdf('0x29')]);if(_0x983ee2['name']){delete _0x983ee2[_0x4bdf('0x2a')];}_0x1a76ce[_0x4bdf('0x19')](_0x4d9014)['send'](_0x983ee2);};}exports['index']=function(_0x30afd2,_0x33f0b2){var _0x1a35ef={},_0x20dfc6={},_0x42970a={'count':0x0,'rows':[]};var _0x281248=_[_0x4bdf('0x2b')](db['AnalyticMetric'][_0x4bdf('0x2c')],function(_0x19d5f8){return{'name':_0x19d5f8['fieldName'],'type':_0x19d5f8[_0x4bdf('0x2d')][_0x4bdf('0x2e')]};});_0x20dfc6[_0x4bdf('0x2f')]=_[_0x4bdf('0x2b')](_0x281248,_0x4bdf('0x2a'));_0x20dfc6[_0x4bdf('0x30')]=_[_0x4bdf('0x31')](_0x30afd2['query']);_0x20dfc6[_0x4bdf('0x32')]=_[_0x4bdf('0x33')](_0x20dfc6[_0x4bdf('0x2f')],_0x20dfc6[_0x4bdf('0x30')]);_0x1a35ef[_0x4bdf('0x34')]=_[_0x4bdf('0x33')](_0x20dfc6[_0x4bdf('0x2f')],qs['fields'](_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x35')]));_0x1a35ef[_0x4bdf('0x34')]=_0x1a35ef['attributes'][_0x4bdf('0x36')]?_0x1a35ef[_0x4bdf('0x34')]:_0x20dfc6[_0x4bdf('0x2f')];if(!_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x37')]('nolimit')){_0x1a35ef[_0x4bdf('0x38')]=qs['limit'](_0x30afd2['query'][_0x4bdf('0x38')]);_0x1a35ef[_0x4bdf('0x1d')]=qs[_0x4bdf('0x1d')](_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x1d')]);}_0x1a35ef[_0x4bdf('0x39')]=qs[_0x4bdf('0x3a')](_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x3a')]);_0x1a35ef[_0x4bdf('0x3b')]=qs[_0x4bdf('0x32')](_[_0x4bdf('0x3c')](_0x30afd2[_0x4bdf('0x30')],_0x20dfc6[_0x4bdf('0x32')]));if(_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x3d')]){_0x1a35ef[_0x4bdf('0x3b')]=_['merge'](_0x1a35ef[_0x4bdf('0x3b')],{'$or':_[_0x4bdf('0x2b')](_0x281248,function(_0x399582){if(_0x399582[_0x4bdf('0x2d')]!==_0x4bdf('0x3e')){var _0x4f081e={};_0x4f081e[_0x399582['name']]={'$like':'%'+_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x3d')]+'%'};return _0x4f081e;}})});}_0x1a35ef=_[_0x4bdf('0x3f')]({},_0x1a35ef,_0x30afd2[_0x4bdf('0x40')]);var _0x42f49b={'where':_0x1a35ef['where']};return db[_0x4bdf('0x41')][_0x4bdf('0x1c')](_0x42f49b)[_0x4bdf('0x24')](function(_0x8f933f){_0x42970a['count']=_0x8f933f;if(_0x30afd2[_0x4bdf('0x30')][_0x4bdf('0x42')]){_0x1a35ef['include']=[{'all':!![]}];}return db[_0x4bdf('0x41')][_0x4bdf('0x43')](_0x1a35ef);})[_0x4bdf('0x24')](function(_0x1ab9db){_0x42970a[_0x4bdf('0x44')]=_0x1ab9db;return _0x42970a;})[_0x4bdf('0x24')](respondWithFilteredResult(_0x33f0b2,_0x1a35ef))[_0x4bdf('0x45')](handleError(_0x33f0b2,null));};exports[_0x4bdf('0x46')]=function(_0x22091f,_0x594ced){var _0x5a5677={'raw':!![],'where':{'id':_0x22091f[_0x4bdf('0x47')]['id']}},_0x29f2a3={};_0x29f2a3[_0x4bdf('0x2f')]=_[_0x4bdf('0x31')](db[_0x4bdf('0x41')][_0x4bdf('0x2c')]);_0x29f2a3[_0x4bdf('0x30')]=_[_0x4bdf('0x31')](_0x22091f[_0x4bdf('0x30')]);_0x29f2a3[_0x4bdf('0x32')]=_[_0x4bdf('0x33')](_0x29f2a3[_0x4bdf('0x2f')],_0x29f2a3[_0x4bdf('0x30')]);_0x5a5677[_0x4bdf('0x34')]=_[_0x4bdf('0x33')](_0x29f2a3['model'],qs[_0x4bdf('0x35')](_0x22091f[_0x4bdf('0x30')][_0x4bdf('0x35')]));_0x5a5677[_0x4bdf('0x34')]=_0x5a5677[_0x4bdf('0x34')][_0x4bdf('0x36')]?_0x5a5677['attributes']:_0x29f2a3['model'];if(_0x22091f[_0x4bdf('0x30')][_0x4bdf('0x42')]){_0x5a5677[_0x4bdf('0x48')]=[{'all':!![]}];}_0x5a5677=_[_0x4bdf('0x3f')]({},_0x5a5677,_0x22091f['options']);return db[_0x4bdf('0x41')][_0x4bdf('0x49')](_0x5a5677)['then'](handleEntityNotFound(_0x594ced,null))[_0x4bdf('0x24')](respondWithResult(_0x594ced,null))[_0x4bdf('0x45')](handleError(_0x594ced,null));};exports[_0x4bdf('0x4a')]=function(_0x37fb5a,_0x575b79){return db['AnalyticMetric'][_0x4bdf('0x4a')](_0x37fb5a[_0x4bdf('0x4b')],{})[_0x4bdf('0x24')](function(_0x5b41c5){var _0x2d3bc9=_0x37fb5a[_0x4bdf('0x4c')]['get']({'plain':!![]});if(!_0x2d3bc9)throw new Error(_0x4bdf('0x4d'));if(_0x2d3bc9[_0x4bdf('0x4e')]===_0x4bdf('0x4c')){var _0x191d39=_0x5b41c5['get']({'plain':!![]});var _0x8eead6=_0x4bdf('0x4f');return db[_0x4bdf('0x50')][_0x4bdf('0x49')]({'where':{'name':_0x8eead6,'userProfileId':_0x2d3bc9[_0x4bdf('0x51')]},'raw':!![]})[_0x4bdf('0x24')](function(_0x4221a5){if(_0x4221a5&&_0x4221a5[_0x4bdf('0x52')]===0x0){return db[_0x4bdf('0x27')][_0x4bdf('0x4a')]({'name':_0x191d39['name'],'resourceId':_0x191d39['id'],'type':_0x4221a5[_0x4bdf('0x2a')],'sectionId':_0x4221a5['id']},{})['then'](function(){return _0x5b41c5;});}else{return _0x5b41c5;}})[_0x4bdf('0x45')](function(_0x5dce1b){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5dce1b);throw _0x5dce1b;});}return _0x5b41c5;})[_0x4bdf('0x24')](respondWithResult(_0x575b79,0xc9))[_0x4bdf('0x45')](handleError(_0x575b79,null));};exports[_0x4bdf('0x23')]=function(_0x25ef9e,_0x5c97ee){if(_0x25ef9e[_0x4bdf('0x4b')]['id']){delete _0x25ef9e[_0x4bdf('0x4b')]['id'];}return db[_0x4bdf('0x41')][_0x4bdf('0x49')]({'where':{'id':_0x25ef9e['params']['id']}})[_0x4bdf('0x24')](handleEntityNotFound(_0x5c97ee,null))[_0x4bdf('0x24')](saveUpdates(_0x25ef9e[_0x4bdf('0x4b')],null))[_0x4bdf('0x24')](respondWithResult(_0x5c97ee,null))[_0x4bdf('0x45')](handleError(_0x5c97ee,null));};exports['destroy']=function(_0x124936,_0x305b56){return db[_0x4bdf('0x41')][_0x4bdf('0x49')]({'where':{'id':_0x124936[_0x4bdf('0x47')]['id']}})[_0x4bdf('0x24')](handleEntityNotFound(_0x305b56,null))[_0x4bdf('0x24')](removeEntity(_0x305b56,null))[_0x4bdf('0x45')](handleError(_0x305b56,null));}; \ No newline at end of file +var _0xaea4=['status','end','json','offset','apply','reject','save','update','destroy','then','get','Metrics','UserProfileResource','sendStatus','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','where','VIRTUAL','options','count','includeAll','findAll','catch','show','params','include','merge','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','rimraf','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','../../config/environment'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xaea4,0x17e));var _0x4aea=function(_0x3b155e,_0x2e6292){_0x3b155e=_0x3b155e-0x0;var _0x4269a1=_0xaea4[_0x3b155e];return _0x4269a1;};'use strict';var pdf=require(_0x4aea('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4aea('0x1'));var zipdir=require(_0x4aea('0x2'));var jsonpatch=require(_0x4aea('0x3'));var rp=require(_0x4aea('0x4'));var moment=require(_0x4aea('0x5'));var BPromise=require(_0x4aea('0x6'));var Mustache=require('mustache');var util=require(_0x4aea('0x7'));var path=require(_0x4aea('0x8'));var sox=require(_0x4aea('0x9'));var csv=require(_0x4aea('0xa'));var ejs=require(_0x4aea('0xb'));var fs=require('fs');var _=require(_0x4aea('0xc'));var squel=require(_0x4aea('0xd'));var crypto=require(_0x4aea('0xe'));var jsforce=require(_0x4aea('0xf'));var deskjs=require(_0x4aea('0x10'));var toCsv=require('to-csv');var querystring=require(_0x4aea('0x11'));var Papa=require(_0x4aea('0x12'));var Redis=require(_0x4aea('0x13'));var authService=require(_0x4aea('0x14'));var qs=require(_0x4aea('0x15'));var as=require(_0x4aea('0x16'));var hardwareService=require(_0x4aea('0x17'));var logger=require(_0x4aea('0x18'))(_0x4aea('0x19'));var utils=require(_0x4aea('0x1a'));var config=require(_0x4aea('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e694d,_0x371fe6){_0x371fe6=_0x371fe6||0xcc;return function(_0x3fb238){if(_0x3fb238){return _0x2e694d['sendStatus'](_0x371fe6);}return _0x2e694d[_0x4aea('0x1c')](_0x371fe6)[_0x4aea('0x1d')]();};}function respondWithResult(_0x3e5637,_0x533013){_0x533013=_0x533013||0xc8;return function(_0x1d10a1){if(_0x1d10a1){return _0x3e5637['status'](_0x533013)[_0x4aea('0x1e')](_0x1d10a1);}};}function respondWithFilteredResult(_0x5f1810,_0x5c3d1e){return function(_0x399433){if(_0x399433){var _0x5300c3=_0x399433['count'],_0x3d592c=_0x5c3d1e[_0x4aea('0x1f')],_0x18a908=_0x5c3d1e[_0x4aea('0x1f')]+_0x5c3d1e['limit'],_0x3b3c8e;if(_0x18a908>=_0x5300c3){_0x18a908=_0x5300c3;_0x3b3c8e=0xc8;}else{_0x3b3c8e=0xce;}_0x5f1810[_0x4aea('0x1c')](_0x3b3c8e);return _0x5f1810['set']('Content-Range',_0x3d592c+'-'+_0x18a908+'/'+_0x5300c3)['json'](_0x399433);}return null;};}function patchUpdates(_0x93f75a){return function(_0x57b884){try{jsonpatch[_0x4aea('0x20')](_0x57b884,_0x93f75a,!![]);}catch(_0x2231f2){return BPromise[_0x4aea('0x21')](_0x2231f2);}return _0x57b884[_0x4aea('0x22')]();};}function saveUpdates(_0x3ee6d8,_0x1f356c){return function(_0x585c8f){if(_0x585c8f){return _0x585c8f[_0x4aea('0x23')](_0x3ee6d8)['then'](function(_0xb69621){return _0xb69621;});}return null;};}function removeEntity(_0x254563,_0x335d88){return function(_0x39d711){if(_0x39d711){return _0x39d711[_0x4aea('0x24')]()[_0x4aea('0x25')](function(){var _0x1bf0aa=_0x39d711[_0x4aea('0x26')]({'plain':!![]});var _0x109261=_0x4aea('0x27');return db[_0x4aea('0x28')][_0x4aea('0x24')]({'where':{'type':_0x109261,'resourceId':_0x1bf0aa['id']}})[_0x4aea('0x25')](function(){return _0x39d711;});})[_0x4aea('0x25')](function(){_0x254563['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50c1b4,_0xc806d1){return function(_0x51ec63){if(!_0x51ec63){_0x50c1b4[_0x4aea('0x29')](0x194);}return _0x51ec63;};}function handleError(_0x52f64f,_0x18be3f){_0x18be3f=_0x18be3f||0x1f4;return function(_0x2e0908){logger[_0x4aea('0x2a')](_0x2e0908[_0x4aea('0x2b')]);if(_0x2e0908[_0x4aea('0x2c')]){delete _0x2e0908['name'];}_0x52f64f[_0x4aea('0x1c')](_0x18be3f)[_0x4aea('0x2d')](_0x2e0908);};}exports[_0x4aea('0x2e')]=function(_0x4103a9,_0x43cf4a){var _0x241c1f={},_0x5dbe2e={},_0x4f9842={'count':0x0,'rows':[]};var _0x1b8516=_[_0x4aea('0x2f')](db[_0x4aea('0x30')][_0x4aea('0x31')],function(_0x2236dc){return{'name':_0x2236dc['fieldName'],'type':_0x2236dc['type'][_0x4aea('0x32')]};});_0x5dbe2e['model']=_[_0x4aea('0x2f')](_0x1b8516,'name');_0x5dbe2e[_0x4aea('0x33')]=_[_0x4aea('0x34')](_0x4103a9[_0x4aea('0x33')]);_0x5dbe2e[_0x4aea('0x35')]=_['intersection'](_0x5dbe2e[_0x4aea('0x36')],_0x5dbe2e[_0x4aea('0x33')]);_0x241c1f[_0x4aea('0x37')]=_[_0x4aea('0x38')](_0x5dbe2e[_0x4aea('0x36')],qs[_0x4aea('0x39')](_0x4103a9[_0x4aea('0x33')][_0x4aea('0x39')]));_0x241c1f[_0x4aea('0x37')]=_0x241c1f['attributes'][_0x4aea('0x3a')]?_0x241c1f['attributes']:_0x5dbe2e[_0x4aea('0x36')];if(!_0x4103a9[_0x4aea('0x33')][_0x4aea('0x3b')]('nolimit')){_0x241c1f['limit']=qs[_0x4aea('0x3c')](_0x4103a9[_0x4aea('0x33')][_0x4aea('0x3c')]);_0x241c1f[_0x4aea('0x1f')]=qs[_0x4aea('0x1f')](_0x4103a9[_0x4aea('0x33')]['offset']);}_0x241c1f[_0x4aea('0x3d')]=qs[_0x4aea('0x3e')](_0x4103a9[_0x4aea('0x33')]['sort']);_0x241c1f[_0x4aea('0x3f')]=qs[_0x4aea('0x35')](_['pick'](_0x4103a9['query'],_0x5dbe2e['filters']));if(_0x4103a9[_0x4aea('0x33')]['filter']){_0x241c1f[_0x4aea('0x3f')]=_['merge'](_0x241c1f[_0x4aea('0x3f')],{'$or':_[_0x4aea('0x2f')](_0x1b8516,function(_0x50dbb4){if(_0x50dbb4['type']!==_0x4aea('0x40')){var _0x3d94a2={};_0x3d94a2[_0x50dbb4['name']]={'$like':'%'+_0x4103a9[_0x4aea('0x33')]['filter']+'%'};return _0x3d94a2;}})});}_0x241c1f=_['merge']({},_0x241c1f,_0x4103a9[_0x4aea('0x41')]);var _0x20c979={'where':_0x241c1f[_0x4aea('0x3f')]};return db[_0x4aea('0x30')]['count'](_0x20c979)[_0x4aea('0x25')](function(_0x3cde71){_0x4f9842[_0x4aea('0x42')]=_0x3cde71;if(_0x4103a9[_0x4aea('0x33')][_0x4aea('0x43')]){_0x241c1f['include']=[{'all':!![]}];}return db[_0x4aea('0x30')][_0x4aea('0x44')](_0x241c1f);})[_0x4aea('0x25')](function(_0x54f87a){_0x4f9842['rows']=_0x54f87a;return _0x4f9842;})[_0x4aea('0x25')](respondWithFilteredResult(_0x43cf4a,_0x241c1f))[_0x4aea('0x45')](handleError(_0x43cf4a,null));};exports[_0x4aea('0x46')]=function(_0x309e7c,_0x50e508){var _0x5af81e={'raw':!![],'where':{'id':_0x309e7c[_0x4aea('0x47')]['id']}},_0xc943bc={};_0xc943bc['model']=_[_0x4aea('0x34')](db[_0x4aea('0x30')][_0x4aea('0x31')]);_0xc943bc[_0x4aea('0x33')]=_[_0x4aea('0x34')](_0x309e7c[_0x4aea('0x33')]);_0xc943bc[_0x4aea('0x35')]=_[_0x4aea('0x38')](_0xc943bc[_0x4aea('0x36')],_0xc943bc[_0x4aea('0x33')]);_0x5af81e[_0x4aea('0x37')]=_[_0x4aea('0x38')](_0xc943bc['model'],qs[_0x4aea('0x39')](_0x309e7c[_0x4aea('0x33')]['fields']));_0x5af81e[_0x4aea('0x37')]=_0x5af81e[_0x4aea('0x37')][_0x4aea('0x3a')]?_0x5af81e[_0x4aea('0x37')]:_0xc943bc[_0x4aea('0x36')];if(_0x309e7c['query'][_0x4aea('0x43')]){_0x5af81e[_0x4aea('0x48')]=[{'all':!![]}];}_0x5af81e=_[_0x4aea('0x49')]({},_0x5af81e,_0x309e7c[_0x4aea('0x41')]);return db[_0x4aea('0x30')]['find'](_0x5af81e)['then'](handleEntityNotFound(_0x50e508,null))[_0x4aea('0x25')](respondWithResult(_0x50e508,null))[_0x4aea('0x45')](handleError(_0x50e508,null));};exports[_0x4aea('0x4a')]=function(_0x1bd2c5,_0x50b759){return db['AnalyticMetric'][_0x4aea('0x4a')](_0x1bd2c5[_0x4aea('0x4b')],{})[_0x4aea('0x25')](function(_0x1d05b1){var _0x4c59e8=_0x1bd2c5[_0x4aea('0x4c')]['get']({'plain':!![]});if(!_0x4c59e8)throw new Error(_0x4aea('0x4d'));if(_0x4c59e8[_0x4aea('0x4e')]===_0x4aea('0x4c')){var _0x59626c=_0x1d05b1[_0x4aea('0x26')]({'plain':!![]});var _0x2078a2='Metrics';return db['UserProfileSection'][_0x4aea('0x4f')]({'where':{'name':_0x2078a2,'userProfileId':_0x4c59e8['userProfileId']},'raw':!![]})['then'](function(_0x50ea9d){if(_0x50ea9d&&_0x50ea9d[_0x4aea('0x50')]===0x0){return db[_0x4aea('0x28')]['create']({'name':_0x59626c[_0x4aea('0x2c')],'resourceId':_0x59626c['id'],'type':_0x50ea9d[_0x4aea('0x2c')],'sectionId':_0x50ea9d['id']},{})['then'](function(){return _0x1d05b1;});}else{return _0x1d05b1;}})[_0x4aea('0x45')](function(_0x5fe435){logger[_0x4aea('0x2a')](_0x4aea('0x51'),_0x5fe435);throw _0x5fe435;});}return _0x1d05b1;})[_0x4aea('0x25')](respondWithResult(_0x50b759,0xc9))[_0x4aea('0x45')](handleError(_0x50b759,null));};exports[_0x4aea('0x23')]=function(_0x576806,_0x518b08){if(_0x576806['body']['id']){delete _0x576806['body']['id'];}return db[_0x4aea('0x30')][_0x4aea('0x4f')]({'where':{'id':_0x576806['params']['id']}})[_0x4aea('0x25')](handleEntityNotFound(_0x518b08,null))[_0x4aea('0x25')](saveUpdates(_0x576806[_0x4aea('0x4b')],null))['then'](respondWithResult(_0x518b08,null))[_0x4aea('0x45')](handleError(_0x518b08,null));};exports['destroy']=function(_0x2cffb6,_0x5dd48f){return db[_0x4aea('0x30')][_0x4aea('0x4f')]({'where':{'id':_0x2cffb6['params']['id']}})[_0x4aea('0x25')](handleEntityNotFound(_0x5dd48f,null))[_0x4aea('0x25')](removeEntity(_0x5dd48f,null))[_0x4aea('0x45')](handleError(_0x5dd48f,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 24bbe87..51fb8c6 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 _0x2bc1=['moment','request-promise','path','rimraf','./analyticMetric.attributes','exports','define','lodash','util','../../config/logger','api'];(function(_0x1c8cc6,_0x411e5c){var _0x522936=function(_0x38d044){while(--_0x38d044){_0x1c8cc6['push'](_0x1c8cc6['shift']());}};_0x522936(++_0x411e5c);}(_0x2bc1,0xa1));var _0x12bc=function(_0x71e7d,_0x239c71){_0x71e7d=_0x71e7d-0x0;var _0x255a56=_0x2bc1[_0x71e7d];return _0x255a56;};'use strict';var _=require(_0x12bc('0x0'));var util=require(_0x12bc('0x1'));var logger=require(_0x12bc('0x2'))(_0x12bc('0x3'));var moment=require(_0x12bc('0x4'));var BPromise=require('bluebird');var rp=require(_0x12bc('0x5'));var fs=require('fs');var path=require(_0x12bc('0x6'));var rimraf=require(_0x12bc('0x7'));var config=require('../../config/environment');var attributes=require(_0x12bc('0x8'));module[_0x12bc('0x9')]=function(_0x27540f,_0x25d0ba){return _0x27540f[_0x12bc('0xa')]('AnalyticMetric',attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7cc=['define','AnalyticMetric','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc7cc,0x91));var _0xcc7c=function(_0x1ccaf0,_0x5014ea){_0x1ccaf0=_0x1ccaf0-0x0;var _0x5c5a34=_0xc7cc[_0x1ccaf0];return _0x5c5a34;};'use strict';var _=require(_0xcc7c('0x0'));var util=require(_0xcc7c('0x1'));var logger=require(_0xcc7c('0x2'))('api');var moment=require(_0xcc7c('0x3'));var BPromise=require(_0xcc7c('0x4'));var rp=require(_0xcc7c('0x5'));var fs=require('fs');var path=require(_0xcc7c('0x6'));var rimraf=require(_0xcc7c('0x7'));var config=require(_0xcc7c('0x8'));var attributes=require(_0xcc7c('0x9'));module[_0xcc7c('0xa')]=function(_0xe166a9,_0x82dc04){return _0xe166a9[_0xcc7c('0xb')](_0xcc7c('0xc'),attributes,{'tableName':'analytics_metrics','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.rpc.js b/server/api/analyticMetric/analyticMetric.rpc.js index 21f9a6a..c57a51a 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 _0xc737=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','AnalyticMetric,\x20%s,\x20%s','error','message','result','catch','lodash'];(function(_0x450d87,_0x2ae298){var _0x204e75=function(_0x4f4f7d){while(--_0x4f4f7d){_0x450d87['push'](_0x450d87['shift']());}};_0x204e75(++_0x2ae298);}(_0xc737,0xaf));var _0x7c73=function(_0x130561,_0x118dab){_0x130561=_0x130561-0x0;var _0x4e9659=_0xc737[_0x130561];return _0x4e9659;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var moment=require('moment');var BPromise=require(_0x7c73('0x2'));var rs=require(_0x7c73('0x3'));var fs=require('fs');var Redis=require(_0x7c73('0x4'));var db=require(_0x7c73('0x5'))['db'];var utils=require(_0x7c73('0x6'));var logger=require(_0x7c73('0x7'))(_0x7c73('0x8'));var config=require('../../config/environment');var jayson=require(_0x7c73('0x9'));var client=jayson[_0x7c73('0xa')][_0x7c73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28f722,_0x15052f,_0x50ce7c){return new BPromise(function(_0x25802e,_0x43e1d6){return client['request'](_0x28f722,_0x50ce7c)['then'](function(_0x144c25){logger[_0x7c73('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x15052f,_0x7c73('0xd'));logger[_0x7c73('0xe')](_0x7c73('0xf'),_0x15052f,_0x7c73('0xd'),JSON[_0x7c73('0x10')](_0x144c25));if(_0x144c25['error']){if(_0x144c25['error']['code']===0x1f4){logger['error'](_0x7c73('0x11'),_0x15052f,_0x144c25[_0x7c73('0x12')][_0x7c73('0x13')]);return _0x43e1d6(_0x144c25[_0x7c73('0x12')][_0x7c73('0x13')]);}logger[_0x7c73('0x12')](_0x7c73('0x11'),_0x15052f,_0x144c25[_0x7c73('0x12')][_0x7c73('0x13')]);return _0x25802e(_0x144c25[_0x7c73('0x12')][_0x7c73('0x13')]);}else{logger[_0x7c73('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x15052f,_0x7c73('0xd'));_0x25802e(_0x144c25[_0x7c73('0x14')][_0x7c73('0x13')]);}})[_0x7c73('0x15')](function(_0x18fe3e){logger[_0x7c73('0x12')](_0x7c73('0x11'),_0x15052f,_0x18fe3e);_0x43e1d6(_0x18fe3e);});});} \ No newline at end of file +var _0x6c9c=['../../config/environment','jayson/promise','client','http','request','then','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x46800d,_0x588500){var _0x3824cd=function(_0x14b132){while(--_0x14b132){_0x46800d['push'](_0x46800d['shift']());}};_0x3824cd(++_0x588500);}(_0x6c9c,0x99));var _0xc6c9=function(_0x583b1b,_0x100592){_0x583b1b=_0x583b1b-0x0;var _0x3338b7=_0x6c9c[_0x583b1b];return _0x3338b7;};'use strict';var _=require(_0xc6c9('0x0'));var util=require(_0xc6c9('0x1'));var moment=require(_0xc6c9('0x2'));var BPromise=require(_0xc6c9('0x3'));var rs=require(_0xc6c9('0x4'));var fs=require('fs');var Redis=require(_0xc6c9('0x5'));var db=require(_0xc6c9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc6c9('0x7'));var config=require(_0xc6c9('0x8'));var jayson=require(_0xc6c9('0x9'));var client=jayson[_0xc6c9('0xa')][_0xc6c9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x28df34,_0x308529,_0x1ca782){return new BPromise(function(_0x24cb4b,_0xf1de9e){return client[_0xc6c9('0xc')](_0x28df34,_0x1ca782)[_0xc6c9('0xd')](function(_0x483c9a){logger[_0xc6c9('0xe')](_0xc6c9('0xf'),_0x308529,_0xc6c9('0x10'));logger[_0xc6c9('0x11')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x308529,_0xc6c9('0x10'),JSON[_0xc6c9('0x12')](_0x483c9a));if(_0x483c9a[_0xc6c9('0x13')]){if(_0x483c9a[_0xc6c9('0x13')][_0xc6c9('0x14')]===0x1f4){logger['error'](_0xc6c9('0xf'),_0x308529,_0x483c9a[_0xc6c9('0x13')][_0xc6c9('0x15')]);return _0xf1de9e(_0x483c9a[_0xc6c9('0x13')]['message']);}logger[_0xc6c9('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x308529,_0x483c9a[_0xc6c9('0x13')][_0xc6c9('0x15')]);return _0x24cb4b(_0x483c9a[_0xc6c9('0x13')][_0xc6c9('0x15')]);}else{logger['info'](_0xc6c9('0xf'),_0x308529,'request\x20sent');_0x24cb4b(_0x483c9a[_0xc6c9('0x16')][_0xc6c9('0x15')]);}})['catch'](function(_0x3f9a72){logger['error'](_0xc6c9('0xf'),_0x308529,_0x3f9a72);_0xf1de9e(_0x3f9a72);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index 4893395..e17183f 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 _0x7880=['Router','../../components/auth/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','index','/:id','show','post','create','update','delete','destroy','util','path','connect-timeout','express'];(function(_0x1b96ee,_0x32ffef){var _0x1aef42=function(_0x62d6e0){while(--_0x62d6e0){_0x1b96ee['push'](_0x1b96ee['shift']());}};_0x1aef42(++_0x32ffef);}(_0x7880,0x1f4));var _0x0788=function(_0x4b8968,_0x5c9b44){_0x4b8968=_0x4b8968-0x0;var _0x3a0ab7=_0x7880[_0x4b8968];return _0x3a0ab7;};'use strict';var multer=require('multer');var util=require(_0x0788('0x0'));var path=require(_0x0788('0x1'));var timeout=require(_0x0788('0x2'));var express=require(_0x0788('0x3'));var router=express[_0x0788('0x4')]();var auth=require(_0x0788('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0788('0x6'));var controller=require(_0x0788('0x7'));router[_0x0788('0x8')]('/',auth[_0x0788('0x9')](),controller[_0x0788('0xa')]);router[_0x0788('0x8')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0xc')]);router[_0x0788('0xd')]('/',auth['isAuthenticated'](),controller[_0x0788('0xe')]);router['put'](_0x0788('0xb'),auth['isAuthenticated'](),controller[_0x0788('0xf')]);router[_0x0788('0x10')](_0x0788('0xb'),auth[_0x0788('0x9')](),controller[_0x0788('0x11')]);module['exports']=router; \ No newline at end of file +var _0xadb5=['destroy','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./analyticMetric.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','delete'];(function(_0x7e7c0f,_0x13e311){var _0x2b0a5c=function(_0x416883){while(--_0x416883){_0x7e7c0f['push'](_0x7e7c0f['shift']());}};_0x2b0a5c(++_0x13e311);}(_0xadb5,0xad));var _0x5adb=function(_0x3021e1,_0x51de9e){_0x3021e1=_0x3021e1-0x0;var _0x22f887=_0xadb5[_0x3021e1];return _0x22f887;};'use strict';var multer=require('multer');var util=require(_0x5adb('0x0'));var path=require('path');var timeout=require(_0x5adb('0x1'));var express=require(_0x5adb('0x2'));var router=express[_0x5adb('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5adb('0x4'));var config=require(_0x5adb('0x5'));var controller=require(_0x5adb('0x6'));router['get']('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xb')]);router[_0x5adb('0xc')]('/',auth[_0x5adb('0x7')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')](_0x5adb('0xa'),auth[_0x5adb('0x7')](),controller[_0x5adb('0xf')]);router[_0x5adb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x5adb('0x11')]);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index a38fae8..37ce61d 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 _0x6d9a=['sequelize'];(function(_0x2632d6,_0xc2cf90){var _0x2643f8=function(_0x39a1e6){while(--_0x39a1e6){_0x2632d6['push'](_0x2632d6['shift']());}};_0x2643f8(++_0xc2cf90);}(_0x6d9a,0x15a));var _0xa6d9=function(_0x389b04,_0x3b0ae7){_0x389b04=_0x389b04-0x0;var _0x27319c=_0x6d9a[_0x389b04];return _0x27319c;};'use strict';var Sequelize=require(_0xa6d9('0x0'));module['exports']={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0xfe8d=['TEXT','sequelize','exports'];(function(_0x21fe98,_0x429019){var _0x49e2eb=function(_0x2d9de8){while(--_0x2d9de8){_0x21fe98['push'](_0x21fe98['shift']());}};_0x49e2eb(++_0x429019);}(_0xfe8d,0x193));var _0xdfe8=function(_0x57ff9f,_0x3dee21){_0x57ff9f=_0x57ff9f-0x0;var _0x1f3df9=_0xfe8d[_0x57ff9f];return _0x1f3df9;};'use strict';var Sequelize=require(_0xdfe8('0x0'));module[_0xdfe8('0x1')]={'tree':{'type':Sequelize[_0xdfe8('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index bd898ae..bc1ced1 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 _0x5c00=['catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','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','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','AnalyticTreeReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5c00,0x17e));var _0x05c0=function(_0xeb6f8d,_0x1138f1){_0xeb6f8d=_0xeb6f8d-0x0;var _0x41f045=_0x5c00[_0xeb6f8d];return _0x41f045;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];function respondWithStatusCode(_0xa50678,_0x5a3e65){_0x5a3e65=_0x5a3e65||0xcc;return function(_0x4e39d4){if(_0x4e39d4){return _0xa50678['sendStatus'](_0x5a3e65);}return _0xa50678[_0x05c0('0x18')](_0x5a3e65)[_0x05c0('0x19')]();};}function respondWithResult(_0x20ff48,_0x12deeb){_0x12deeb=_0x12deeb||0xc8;return function(_0x25764b){if(_0x25764b){return _0x20ff48[_0x05c0('0x18')](_0x12deeb)[_0x05c0('0x1a')](_0x25764b);}};}function respondWithFilteredResult(_0xd7b487,_0x4c3e54){return function(_0x238e25){if(_0x238e25){var _0x161a5f=_0x238e25[_0x05c0('0x1b')],_0x4bb164=_0x4c3e54[_0x05c0('0x1c')],_0x29e6b0=_0x4c3e54[_0x05c0('0x1c')]+_0x4c3e54[_0x05c0('0x1d')],_0x27c7bd;if(_0x29e6b0>=_0x161a5f){_0x29e6b0=_0x161a5f;_0x27c7bd=0xc8;}else{_0x27c7bd=0xce;}_0xd7b487['status'](_0x27c7bd);return _0xd7b487[_0x05c0('0x1e')](_0x05c0('0x1f'),_0x4bb164+'-'+_0x29e6b0+'/'+_0x161a5f)[_0x05c0('0x1a')](_0x238e25);}return null;};}function patchUpdates(_0x54fef0){return function(_0x40d905){try{jsonpatch[_0x05c0('0x20')](_0x40d905,_0x54fef0,!![]);}catch(_0x10685b){return BPromise[_0x05c0('0x21')](_0x10685b);}return _0x40d905[_0x05c0('0x22')]();};}function saveUpdates(_0x5e4742,_0x407c1f){return function(_0x1014ef){if(_0x1014ef){return _0x1014ef['update'](_0x5e4742)['then'](function(_0x5e4b80){return _0x5e4b80;});}return null;};}function removeEntity(_0x1c448b,_0x2055a3){return function(_0x83f29){if(_0x83f29){return _0x83f29[_0x05c0('0x23')]()[_0x05c0('0x24')](function(){_0x1c448b[_0x05c0('0x18')](0xcc)[_0x05c0('0x19')]();});}};}function handleEntityNotFound(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(!_0x1abbf3){_0x5b4eef['sendStatus'](0x194);}return _0x1abbf3;};}function handleError(_0x530966,_0x4da6d6){_0x4da6d6=_0x4da6d6||0x1f4;return function(_0x5dc2b7){logger['error'](_0x5dc2b7[_0x05c0('0x25')]);if(_0x5dc2b7[_0x05c0('0x26')]){delete _0x5dc2b7['name'];}_0x530966[_0x05c0('0x18')](_0x4da6d6)[_0x05c0('0x27')](_0x5dc2b7);};}exports[_0x05c0('0x28')]=function(_0x889c75,_0x58769a){var _0x7d5ccd={},_0x1c14b1={},_0x2ceaed={'count':0x0,'rows':[]};var _0x200e80=_[_0x05c0('0x29')](db[_0x05c0('0x2a')]['rawAttributes'],function(_0x56ba64){return{'name':_0x56ba64[_0x05c0('0x2b')],'type':_0x56ba64[_0x05c0('0x2c')][_0x05c0('0x2d')]};});_0x1c14b1[_0x05c0('0x2e')]=_[_0x05c0('0x29')](_0x200e80,_0x05c0('0x26'));_0x1c14b1[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x889c75[_0x05c0('0x2f')]);_0x1c14b1[_0x05c0('0x31')]=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],_0x1c14b1['query']);_0x7d5ccd['attributes']=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x889c75['query'][_0x05c0('0x33')]));_0x7d5ccd[_0x05c0('0x34')]=_0x7d5ccd['attributes'][_0x05c0('0x35')]?_0x7d5ccd['attributes']:_0x1c14b1[_0x05c0('0x2e')];if(!_0x889c75[_0x05c0('0x2f')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x7d5ccd[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1d')]);_0x7d5ccd[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1c')]);}_0x7d5ccd[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x39')]);_0x7d5ccd[_0x05c0('0x3a')]=qs[_0x05c0('0x31')](_[_0x05c0('0x3b')](_0x889c75[_0x05c0('0x2f')],_0x1c14b1[_0x05c0('0x31')]));if(_0x889c75[_0x05c0('0x2f')][_0x05c0('0x3c')]){_0x7d5ccd[_0x05c0('0x3a')]=_[_0x05c0('0x3d')](_0x7d5ccd[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x200e80,function(_0x3bc6cc){if(_0x3bc6cc[_0x05c0('0x2c')]!==_0x05c0('0x3e')){var _0x1f493c={};_0x1f493c[_0x3bc6cc[_0x05c0('0x26')]]={'$like':'%'+_0x889c75[_0x05c0('0x2f')]['filter']+'%'};return _0x1f493c;}})});}_0x7d5ccd=_[_0x05c0('0x3d')]({},_0x7d5ccd,_0x889c75[_0x05c0('0x3f')]);var _0x41fa50={'where':_0x7d5ccd[_0x05c0('0x3a')]};return db['AnalyticTreeReport']['count'](_0x41fa50)[_0x05c0('0x24')](function(_0x2540db){_0x2ceaed[_0x05c0('0x1b')]=_0x2540db;if(_0x889c75['query'][_0x05c0('0x40')]){_0x7d5ccd[_0x05c0('0x41')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x42')](_0x7d5ccd);})['then'](function(_0x152c6a){_0x2ceaed[_0x05c0('0x43')]=_0x152c6a;return _0x2ceaed;})['then'](respondWithFilteredResult(_0x58769a,_0x7d5ccd))[_0x05c0('0x44')](handleError(_0x58769a,null));};exports[_0x05c0('0x45')]=function(_0x4557db,_0xcbd98){var _0x164e3a={'raw':!![],'where':{'id':_0x4557db[_0x05c0('0x46')]['id']}},_0x398a6e={};_0x398a6e['model']=_['keys'](db[_0x05c0('0x2a')][_0x05c0('0x47')]);_0x398a6e[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x4557db[_0x05c0('0x2f')]);_0x398a6e['filters']=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],_0x398a6e[_0x05c0('0x2f')]);_0x164e3a[_0x05c0('0x34')]=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x4557db['query'][_0x05c0('0x33')]));_0x164e3a[_0x05c0('0x34')]=_0x164e3a[_0x05c0('0x34')][_0x05c0('0x35')]?_0x164e3a[_0x05c0('0x34')]:_0x398a6e[_0x05c0('0x2e')];if(_0x4557db[_0x05c0('0x2f')][_0x05c0('0x40')]){_0x164e3a[_0x05c0('0x41')]=[{'all':!![]}];}_0x164e3a=_[_0x05c0('0x3d')]({},_0x164e3a,_0x4557db[_0x05c0('0x3f')]);return db['AnalyticTreeReport']['find'](_0x164e3a)[_0x05c0('0x24')](handleEntityNotFound(_0xcbd98,null))[_0x05c0('0x24')](respondWithResult(_0xcbd98,null))[_0x05c0('0x44')](handleError(_0xcbd98,null));};exports[_0x05c0('0x48')]=function(_0x2a1339,_0x856372){return db['AnalyticTreeReport'][_0x05c0('0x48')](_0x2a1339[_0x05c0('0x49')],{})[_0x05c0('0x24')](respondWithResult(_0x856372,0xc9))[_0x05c0('0x44')](handleError(_0x856372,null));};exports['update']=function(_0x34e94e,_0x2440e8){if(_0x34e94e[_0x05c0('0x49')]['id']){delete _0x34e94e[_0x05c0('0x49')]['id'];}return db['AnalyticTreeReport'][_0x05c0('0x4a')]({'where':{'id':_0x34e94e[_0x05c0('0x46')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x2440e8,null))[_0x05c0('0x24')](saveUpdates(_0x34e94e['body'],null))[_0x05c0('0x24')](respondWithResult(_0x2440e8,null))[_0x05c0('0x44')](handleError(_0x2440e8,null));};exports['destroy']=function(_0x27f69e,_0x57f979){return db['AnalyticTreeReport'][_0x05c0('0x4a')]({'where':{'id':_0x27f69e['params']['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x57f979,null))[_0x05c0('0x24')](removeEntity(_0x57f979,null))[_0x05c0('0x44')](handleError(_0x57f979,null));}; \ No newline at end of file +var _0x757a=['map','VIRTUAL','options','AnalyticTreeReport','count','findAll','rows','catch','params','keys','includeAll','include','create','body','find','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','end','status','json','offset','limit','Content-Range','apply','save','update','then','destroy','stack','name','send','index','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter'];(function(_0x5def7f,_0x5db6d8){var _0x2dacb8=function(_0xad7347){while(--_0xad7347){_0x5def7f['push'](_0x5def7f['shift']());}};_0x2dacb8(++_0x5db6d8);}(_0x757a,0xde));var _0xa757=function(_0x215bc2,_0x2b5dea){_0x215bc2=_0x215bc2-0x0;var _0x58aa9f=_0x757a[_0x215bc2];return _0x58aa9f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xa757('0x0'));var rimraf=require(_0xa757('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa757('0x2'));var BPromise=require(_0xa757('0x3'));var Mustache=require(_0xa757('0x4'));var util=require(_0xa757('0x5'));var path=require(_0xa757('0x6'));var sox=require(_0xa757('0x7'));var csv=require('to-csv');var ejs=require(_0xa757('0x8'));var fs=require('fs');var _=require(_0xa757('0x9'));var squel=require('squel');var crypto=require(_0xa757('0xa'));var jsforce=require(_0xa757('0xb'));var deskjs=require(_0xa757('0xc'));var toCsv=require(_0xa757('0xd'));var querystring=require(_0xa757('0xe'));var Papa=require('papaparse');var Redis=require(_0xa757('0xf'));var authService=require(_0xa757('0x10'));var qs=require(_0xa757('0x11'));var as=require(_0xa757('0x12'));var hardwareService=require(_0xa757('0x13'));var logger=require(_0xa757('0x14'))(_0xa757('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x56acfb,_0x4db68e){_0x4db68e=_0x4db68e||0xcc;return function(_0x421040){if(_0x421040){return _0x56acfb['sendStatus'](_0x4db68e);}return _0x56acfb['status'](_0x4db68e)[_0xa757('0x16')]();};}function respondWithResult(_0x513b1f,_0x481508){_0x481508=_0x481508||0xc8;return function(_0x32112b){if(_0x32112b){return _0x513b1f[_0xa757('0x17')](_0x481508)[_0xa757('0x18')](_0x32112b);}};}function respondWithFilteredResult(_0x4a0c38,_0x86abd){return function(_0x31cfd2){if(_0x31cfd2){var _0xf12b68=_0x31cfd2['count'],_0x2f7947=_0x86abd[_0xa757('0x19')],_0x185011=_0x86abd[_0xa757('0x19')]+_0x86abd[_0xa757('0x1a')],_0x3df1f9;if(_0x185011>=_0xf12b68){_0x185011=_0xf12b68;_0x3df1f9=0xc8;}else{_0x3df1f9=0xce;}_0x4a0c38['status'](_0x3df1f9);return _0x4a0c38['set'](_0xa757('0x1b'),_0x2f7947+'-'+_0x185011+'/'+_0xf12b68)[_0xa757('0x18')](_0x31cfd2);}return null;};}function patchUpdates(_0x1bd14c){return function(_0x340599){try{jsonpatch[_0xa757('0x1c')](_0x340599,_0x1bd14c,!![]);}catch(_0xe2d567){return BPromise['reject'](_0xe2d567);}return _0x340599[_0xa757('0x1d')]();};}function saveUpdates(_0x4fec52,_0x32c2a1){return function(_0x167640){if(_0x167640){return _0x167640[_0xa757('0x1e')](_0x4fec52)[_0xa757('0x1f')](function(_0x4d598c){return _0x4d598c;});}return null;};}function removeEntity(_0x5638c7,_0x40ec48){return function(_0x2159cf){if(_0x2159cf){return _0x2159cf[_0xa757('0x20')]()[_0xa757('0x1f')](function(){_0x5638c7[_0xa757('0x17')](0xcc)[_0xa757('0x16')]();});}};}function handleEntityNotFound(_0x2ca10d,_0x21f1af){return function(_0x2bf276){if(!_0x2bf276){_0x2ca10d['sendStatus'](0x194);}return _0x2bf276;};}function handleError(_0x3707c1,_0x59e9d4){_0x59e9d4=_0x59e9d4||0x1f4;return function(_0x422e9e){logger['error'](_0x422e9e[_0xa757('0x21')]);if(_0x422e9e[_0xa757('0x22')]){delete _0x422e9e[_0xa757('0x22')];}_0x3707c1['status'](_0x59e9d4)[_0xa757('0x23')](_0x422e9e);};}exports[_0xa757('0x24')]=function(_0x471e84,_0x3bf7f3){var _0x5b4779={},_0x449a7d={},_0x54263b={'count':0x0,'rows':[]};var _0x5a5664=_['map'](db['AnalyticTreeReport'][_0xa757('0x25')],function(_0x596ae2){return{'name':_0x596ae2[_0xa757('0x26')],'type':_0x596ae2[_0xa757('0x27')]['key']};});_0x449a7d[_0xa757('0x28')]=_['map'](_0x5a5664,_0xa757('0x22'));_0x449a7d[_0xa757('0x29')]=_['keys'](_0x471e84[_0xa757('0x29')]);_0x449a7d['filters']=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],_0x449a7d[_0xa757('0x29')]);_0x5b4779[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x449a7d[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x471e84[_0xa757('0x29')][_0xa757('0x2c')]));_0x5b4779[_0xa757('0x2b')]=_0x5b4779[_0xa757('0x2b')][_0xa757('0x2d')]?_0x5b4779[_0xa757('0x2b')]:_0x449a7d[_0xa757('0x28')];if(!_0x471e84[_0xa757('0x29')][_0xa757('0x2e')](_0xa757('0x2f'))){_0x5b4779[_0xa757('0x1a')]=qs[_0xa757('0x1a')](_0x471e84[_0xa757('0x29')][_0xa757('0x1a')]);_0x5b4779[_0xa757('0x19')]=qs[_0xa757('0x19')](_0x471e84[_0xa757('0x29')]['offset']);}_0x5b4779[_0xa757('0x30')]=qs[_0xa757('0x31')](_0x471e84[_0xa757('0x29')][_0xa757('0x31')]);_0x5b4779[_0xa757('0x32')]=qs['filters'](_[_0xa757('0x33')](_0x471e84[_0xa757('0x29')],_0x449a7d[_0xa757('0x34')]));if(_0x471e84[_0xa757('0x29')][_0xa757('0x35')]){_0x5b4779[_0xa757('0x32')]=_['merge'](_0x5b4779[_0xa757('0x32')],{'$or':_[_0xa757('0x36')](_0x5a5664,function(_0x2cade7){if(_0x2cade7[_0xa757('0x27')]!==_0xa757('0x37')){var _0x111cfe={};_0x111cfe[_0x2cade7[_0xa757('0x22')]]={'$like':'%'+_0x471e84[_0xa757('0x29')][_0xa757('0x35')]+'%'};return _0x111cfe;}})});}_0x5b4779=_['merge']({},_0x5b4779,_0x471e84[_0xa757('0x38')]);var _0x34fba8={'where':_0x5b4779[_0xa757('0x32')]};return db[_0xa757('0x39')][_0xa757('0x3a')](_0x34fba8)[_0xa757('0x1f')](function(_0x501e26){_0x54263b[_0xa757('0x3a')]=_0x501e26;if(_0x471e84[_0xa757('0x29')]['includeAll']){_0x5b4779['include']=[{'all':!![]}];}return db[_0xa757('0x39')][_0xa757('0x3b')](_0x5b4779);})['then'](function(_0x51c3d1){_0x54263b[_0xa757('0x3c')]=_0x51c3d1;return _0x54263b;})[_0xa757('0x1f')](respondWithFilteredResult(_0x3bf7f3,_0x5b4779))[_0xa757('0x3d')](handleError(_0x3bf7f3,null));};exports['show']=function(_0x830dc4,_0x13a8f4){var _0x26802c={'raw':!![],'where':{'id':_0x830dc4[_0xa757('0x3e')]['id']}},_0x1ba399={};_0x1ba399['model']=_[_0xa757('0x3f')](db['AnalyticTreeReport']['rawAttributes']);_0x1ba399[_0xa757('0x29')]=_[_0xa757('0x3f')](_0x830dc4[_0xa757('0x29')]);_0x1ba399[_0xa757('0x34')]=_[_0xa757('0x2a')](_0x1ba399['model'],_0x1ba399['query']);_0x26802c[_0xa757('0x2b')]=_[_0xa757('0x2a')](_0x1ba399[_0xa757('0x28')],qs[_0xa757('0x2c')](_0x830dc4[_0xa757('0x29')][_0xa757('0x2c')]));_0x26802c['attributes']=_0x26802c[_0xa757('0x2b')][_0xa757('0x2d')]?_0x26802c['attributes']:_0x1ba399[_0xa757('0x28')];if(_0x830dc4['query'][_0xa757('0x40')]){_0x26802c[_0xa757('0x41')]=[{'all':!![]}];}_0x26802c=_['merge']({},_0x26802c,_0x830dc4[_0xa757('0x38')]);return db[_0xa757('0x39')]['find'](_0x26802c)[_0xa757('0x1f')](handleEntityNotFound(_0x13a8f4,null))[_0xa757('0x1f')](respondWithResult(_0x13a8f4,null))[_0xa757('0x3d')](handleError(_0x13a8f4,null));};exports[_0xa757('0x42')]=function(_0x543b5b,_0x199dc9){return db[_0xa757('0x39')][_0xa757('0x42')](_0x543b5b[_0xa757('0x43')],{})['then'](respondWithResult(_0x199dc9,0xc9))[_0xa757('0x3d')](handleError(_0x199dc9,null));};exports['update']=function(_0x50c131,_0x2acf88){if(_0x50c131[_0xa757('0x43')]['id']){delete _0x50c131[_0xa757('0x43')]['id'];}return db['AnalyticTreeReport'][_0xa757('0x44')]({'where':{'id':_0x50c131['params']['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x2acf88,null))[_0xa757('0x1f')](saveUpdates(_0x50c131[_0xa757('0x43')],null))[_0xa757('0x1f')](respondWithResult(_0x2acf88,null))[_0xa757('0x3d')](handleError(_0x2acf88,null));};exports[_0xa757('0x20')]=function(_0x57bf73,_0x505cd){return db['AnalyticTreeReport'][_0xa757('0x44')]({'where':{'id':_0x57bf73[_0xa757('0x3e')]['id']}})[_0xa757('0x1f')](handleEntityNotFound(_0x505cd,null))[_0xa757('0x1f')](removeEntity(_0x505cd,null))[_0xa757('0x3d')](handleError(_0x505cd,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 2ec0708..5e2a436 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 _0x5f66=['request-promise','path','../../config/environment','exports','AnalyticTreeReport','analytics_report_trees','util','api','moment','bluebird'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x5f66,0x1a0));var _0x65f6=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x5f66[_0x19e35c];return _0x3e1fe8;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./analyticTreeReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2cc4=['bluebird','request-promise','./analyticTreeReport.attributes','exports','define','analytics_report_trees','lodash','util','../../config/logger','api'];(function(_0x123aff,_0x2e6aea){var _0x1be3ec=function(_0x188c08){while(--_0x188c08){_0x123aff['push'](_0x123aff['shift']());}};_0x1be3ec(++_0x2e6aea);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x19159a,_0x1cb5c3){_0x19159a=_0x19159a-0x0;var _0xa677f4=_0x2cc4[_0x19159a];return _0xa677f4;};'use strict';var _=require(_0x42cc('0x0'));var util=require(_0x42cc('0x1'));var logger=require(_0x42cc('0x2'))(_0x42cc('0x3'));var moment=require('moment');var BPromise=require(_0x42cc('0x4'));var rp=require(_0x42cc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x42cc('0x6'));module[_0x42cc('0x7')]=function(_0x299177,_0x2b9798){return _0x299177[_0x42cc('0x8')]('AnalyticTreeReport',attributes,{'tableName':_0x42cc('0x9'),'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 62d5c23..cf25932 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 _0x1869=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x4c8b62,_0x372804){var _0x59288a=function(_0x102aef){while(--_0x102aef){_0x4c8b62['push'](_0x4c8b62['shift']());}};_0x59288a(++_0x372804);}(_0x1869,0x68));var _0x9186=function(_0x1fbc06,_0x4cfe7a){_0x1fbc06=_0x1fbc06-0x0;var _0x143c60=_0x1869[_0x1fbc06];return _0x143c60;};'use strict';var _=require(_0x9186('0x0'));var util=require(_0x9186('0x1'));var moment=require(_0x9186('0x2'));var BPromise=require(_0x9186('0x3'));var rs=require(_0x9186('0x4'));var fs=require('fs');var Redis=require(_0x9186('0x5'));var db=require(_0x9186('0x6'))['db'];var utils=require(_0x9186('0x7'));var logger=require(_0x9186('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9186('0x9'));var client=jayson[_0x9186('0xa')][_0x9186('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x23cd91,_0x12a9cd,_0x2815ca){return new BPromise(function(_0xb858f9,_0x593a75){return client[_0x9186('0xc')](_0x23cd91,_0x2815ca)['then'](function(_0x241d4f){logger['info'](_0x9186('0xd'),_0x12a9cd,_0x9186('0xe'));logger['debug'](_0x9186('0xf'),_0x12a9cd,_0x9186('0xe'),JSON[_0x9186('0x10')](_0x241d4f));if(_0x241d4f['error']){if(_0x241d4f[_0x9186('0x11')]['code']===0x1f4){logger[_0x9186('0x11')](_0x9186('0xd'),_0x12a9cd,_0x241d4f[_0x9186('0x11')][_0x9186('0x12')]);return _0x593a75(_0x241d4f['error'][_0x9186('0x12')]);}logger[_0x9186('0x11')](_0x9186('0xd'),_0x12a9cd,_0x241d4f[_0x9186('0x11')]['message']);return _0xb858f9(_0x241d4f[_0x9186('0x11')][_0x9186('0x12')]);}else{logger[_0x9186('0x13')](_0x9186('0xd'),_0x12a9cd,_0x9186('0xe'));_0xb858f9(_0x241d4f[_0x9186('0x14')][_0x9186('0x12')]);}})[_0x9186('0x15')](function(_0x1bab93){logger[_0x9186('0x11')](_0x9186('0xd'),_0x12a9cd,_0x1bab93);_0x593a75(_0x1bab93);});});} \ No newline at end of file +var _0x8367=['client','http','request','then','info','request\x20sent','debug','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','AnalyticTreeReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x8367,0xdc));var _0x7836=function(_0x5e7d0c,_0x56ba7b){_0x5e7d0c=_0x5e7d0c-0x0;var _0xc24371=_0x8367[_0x5e7d0c];return _0xc24371;};'use strict';var _=require(_0x7836('0x0'));var util=require(_0x7836('0x1'));var moment=require(_0x7836('0x2'));var BPromise=require(_0x7836('0x3'));var rs=require(_0x7836('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7836('0x5'));var logger=require(_0x7836('0x6'))(_0x7836('0x7'));var config=require(_0x7836('0x8'));var jayson=require(_0x7836('0x9'));var client=jayson[_0x7836('0xa')][_0x7836('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x13c0bb,_0x234046,_0x5e6f23){return new BPromise(function(_0x2ac595,_0x3440f7){return client[_0x7836('0xc')](_0x13c0bb,_0x5e6f23)[_0x7836('0xd')](function(_0x597ae0){logger[_0x7836('0xe')]('AnalyticTreeReport,\x20%s,\x20%s',_0x234046,_0x7836('0xf'));logger[_0x7836('0x10')](_0x7836('0x11'),_0x234046,_0x7836('0xf'),JSON['stringify'](_0x597ae0));if(_0x597ae0[_0x7836('0x12')]){if(_0x597ae0[_0x7836('0x12')][_0x7836('0x13')]===0x1f4){logger[_0x7836('0x12')](_0x7836('0x14'),_0x234046,_0x597ae0[_0x7836('0x12')][_0x7836('0x15')]);return _0x3440f7(_0x597ae0[_0x7836('0x12')]['message']);}logger[_0x7836('0x12')](_0x7836('0x14'),_0x234046,_0x597ae0[_0x7836('0x12')]['message']);return _0x2ac595(_0x597ae0[_0x7836('0x12')][_0x7836('0x15')]);}else{logger[_0x7836('0xe')](_0x7836('0x14'),_0x234046,'request\x20sent');_0x2ac595(_0x597ae0[_0x7836('0x16')][_0x7836('0x15')]);}})['catch'](function(_0x14c4b0){logger[_0x7836('0x12')](_0x7836('0x14'),_0x234046,_0x14c4b0);_0x3440f7(_0x14c4b0);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 5522834..a48236e 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 _0xf362=['exports','multer','util','connect-timeout','Router','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','get','isAuthenticated','index','show','post','create','put','/:id','update'];(function(_0x233a4c,_0x3ef6e1){var _0x51d977=function(_0x5f27f7){while(--_0x5f27f7){_0x233a4c['push'](_0x233a4c['shift']());}};_0x51d977(++_0x3ef6e1);}(_0xf362,0x89));var _0x2f36=function(_0x33b2ad,_0x20d161){_0x33b2ad=_0x33b2ad-0x0;var _0x3d333f=_0xf362[_0x33b2ad];return _0x3d333f;};'use strict';var multer=require(_0x2f36('0x0'));var util=require(_0x2f36('0x1'));var path=require('path');var timeout=require(_0x2f36('0x2'));var express=require('express');var router=express[_0x2f36('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x2f36('0x4'));var config=require(_0x2f36('0x5'));var controller=require(_0x2f36('0x6'));router[_0x2f36('0x7')]('/',auth[_0x2f36('0x8')](),controller[_0x2f36('0x9')]);router[_0x2f36('0x7')]('/:id',auth[_0x2f36('0x8')](),controller[_0x2f36('0xa')]);router[_0x2f36('0xb')]('/',auth[_0x2f36('0x8')](),controller[_0x2f36('0xc')]);router[_0x2f36('0xd')](_0x2f36('0xe'),auth[_0x2f36('0x8')](),controller[_0x2f36('0xf')]);router['delete'](_0x2f36('0xe'),auth[_0x2f36('0x8')](),controller['destroy']);module[_0x2f36('0x10')]=router; \ No newline at end of file +var _0x20ae=['index','/:id','show','post','create','put','update','delete','destroy','exports','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./analyticTreeReport.controller','get','isAuthenticated'];(function(_0x2fa457,_0x7021df){var _0x4f250a=function(_0xef901e){while(--_0xef901e){_0x2fa457['push'](_0x2fa457['shift']());}};_0x4f250a(++_0x7021df);}(_0x20ae,0xee));var _0xe20a=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x20ae[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe20a('0x0'));var timeout=require(_0xe20a('0x1'));var express=require(_0xe20a('0x2'));var router=express[_0xe20a('0x3')]();var auth=require(_0xe20a('0x4'));var interaction=require(_0xe20a('0x5'));var config=require('../../config/environment');var controller=require(_0xe20a('0x6'));router[_0xe20a('0x7')]('/',auth[_0xe20a('0x8')](),controller[_0xe20a('0x9')]);router[_0xe20a('0x7')](_0xe20a('0xa'),auth[_0xe20a('0x8')](),controller[_0xe20a('0xb')]);router[_0xe20a('0xc')]('/',auth[_0xe20a('0x8')](),controller[_0xe20a('0xd')]);router[_0xe20a('0xe')]('/:id',auth[_0xe20a('0x8')](),controller[_0xe20a('0xf')]);router[_0xe20a('0x10')]('/:id',auth[_0xe20a('0x8')](),controller[_0xe20a('0x11')]);module[_0xe20a('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 5b99342..07d68ea 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 _0xab24=['STRING','sequelize','exports'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xab24,0x1db));var _0x4ab2=function(_0x2ba459,_0x130fa8){_0x2ba459=_0x2ba459-0x0;var _0x26eb9f=_0xab24[_0x2ba459];return _0x26eb9f;};'use strict';var Sequelize=require(_0x4ab2('0x0'));module[_0x4ab2('0x1')]={'name':{'type':Sequelize[_0x4ab2('0x2')]},'basename':{'type':Sequelize[_0x4ab2('0x2')]},'type':{'type':Sequelize[_0x4ab2('0x2')]}}; \ No newline at end of file +var _0xabbe=['sequelize','exports','STRING'];(function(_0x3c3a31,_0x50a71a){var _0x42a364=function(_0x25da93){while(--_0x25da93){_0x3c3a31['push'](_0x3c3a31['shift']());}};_0x42a364(++_0x50a71a);}(_0xabbe,0x8d));var _0xeabb=function(_0x9924d6,_0x34970f){_0x9924d6=_0x9924d6-0x0;var _0x312f0f=_0xabbe[_0x9924d6];return _0x312f0f;};'use strict';var Sequelize=require(_0xeabb('0x0'));module[_0xeabb('0x1')]={'name':{'type':Sequelize[_0xeabb('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index b796454..34ae594 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 _0xfb69=['sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','keys','find','get','createdAt','updatedAt','body','omit','create','file','basename','filename','mimetype','download','join','server/files/attachments/','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','papaparse','../../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','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','Attachment','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order'];(function(_0x44b362,_0x1b5fd9){var _0x38b45c=function(_0x163919){while(--_0x163919){_0x44b362['push'](_0x44b362['shift']());}};_0x38b45c(++_0x1b5fd9);}(_0xfb69,0x1c2));var _0x9fb6=function(_0x48ac83,_0x2ae540){_0x48ac83=_0x48ac83-0x0;var _0x3c450f=_0xfb69[_0x48ac83];return _0x3c450f;};'use strict';var pdf=require(_0x9fb6('0x0'));var emlformat=require(_0x9fb6('0x1'));var rimraf=require(_0x9fb6('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9fb6('0x3'));var moment=require('moment');var BPromise=require(_0x9fb6('0x4'));var Mustache=require(_0x9fb6('0x5'));var util=require('util');var path=require(_0x9fb6('0x6'));var sox=require(_0x9fb6('0x7'));var csv=require(_0x9fb6('0x8'));var ejs=require(_0x9fb6('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9fb6('0xa'));var crypto=require(_0x9fb6('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x9fb6('0x8'));var querystring=require('querystring');var Papa=require(_0x9fb6('0xc'));var Redis=require('ioredis');var authService=require(_0x9fb6('0xd'));var qs=require(_0x9fb6('0xe'));var as=require(_0x9fb6('0xf'));var hardwareService=require(_0x9fb6('0x10'));var logger=require(_0x9fb6('0x11'))(_0x9fb6('0x12'));var utils=require(_0x9fb6('0x13'));var config=require(_0x9fb6('0x14'));var db=require(_0x9fb6('0x15'))['db'];function respondWithStatusCode(_0x18f877,_0x12de61){_0x12de61=_0x12de61||0xcc;return function(_0x3432ef){if(_0x3432ef){return _0x18f877[_0x9fb6('0x16')](_0x12de61);}return _0x18f877[_0x9fb6('0x17')](_0x12de61)[_0x9fb6('0x18')]();};}function respondWithResult(_0x126f0f,_0x102395){_0x102395=_0x102395||0xc8;return function(_0x23df52){if(_0x23df52){return _0x126f0f[_0x9fb6('0x17')](_0x102395)['json'](_0x23df52);}};}function respondWithFilteredResult(_0x7b39d2,_0xedcb4a){return function(_0x468270){if(_0x468270){var _0x5eb3ca=_0x468270[_0x9fb6('0x19')],_0xfcac0=_0xedcb4a[_0x9fb6('0x1a')],_0x5ee9ee=_0xedcb4a[_0x9fb6('0x1a')]+_0xedcb4a['limit'],_0x358538;if(_0x5ee9ee>=_0x5eb3ca){_0x5ee9ee=_0x5eb3ca;_0x358538=0xc8;}else{_0x358538=0xce;}_0x7b39d2[_0x9fb6('0x17')](_0x358538);return _0x7b39d2['set'](_0x9fb6('0x1b'),_0xfcac0+'-'+_0x5ee9ee+'/'+_0x5eb3ca)[_0x9fb6('0x1c')](_0x468270);}return null;};}function patchUpdates(_0x293f00){return function(_0x41f74f){try{jsonpatch[_0x9fb6('0x1d')](_0x41f74f,_0x293f00,!![]);}catch(_0x4de3ad){return BPromise[_0x9fb6('0x1e')](_0x4de3ad);}return _0x41f74f[_0x9fb6('0x1f')]();};}function saveUpdates(_0x5bc414,_0x2bb9a5){return function(_0x53f1a6){if(_0x53f1a6){return _0x53f1a6[_0x9fb6('0x20')](_0x5bc414)[_0x9fb6('0x21')](function(_0x51c8e6){return _0x51c8e6;});}return null;};}function removeEntity(_0x3f0ecb,_0x249242){return function(_0x302026){if(_0x302026){return _0x302026[_0x9fb6('0x22')]()[_0x9fb6('0x21')](function(){_0x3f0ecb[_0x9fb6('0x17')](0xcc)[_0x9fb6('0x18')]();});}};}function handleEntityNotFound(_0x12d091,_0x4c260f){return function(_0x27eeb3){if(!_0x27eeb3){_0x12d091[_0x9fb6('0x16')](0x194);}return _0x27eeb3;};}function handleError(_0xdeb02,_0x32cd6f){_0x32cd6f=_0x32cd6f||0x1f4;return function(_0x3f74f5){logger[_0x9fb6('0x23')](_0x3f74f5['stack']);if(_0x3f74f5[_0x9fb6('0x24')]){delete _0x3f74f5[_0x9fb6('0x24')];}_0xdeb02['status'](_0x32cd6f)['send'](_0x3f74f5);};}exports[_0x9fb6('0x25')]=function(_0x21570c,_0x1940d7){var _0x2ae2fe={},_0x7f1aad={},_0x5c2c5f={'count':0x0,'rows':[]};var _0x41f178=_[_0x9fb6('0x26')](db[_0x9fb6('0x27')][_0x9fb6('0x28')],function(_0x4f09ff){return{'name':_0x4f09ff['fieldName'],'type':_0x4f09ff[_0x9fb6('0x29')][_0x9fb6('0x2a')]};});_0x7f1aad[_0x9fb6('0x2b')]=_['map'](_0x41f178,_0x9fb6('0x24'));_0x7f1aad[_0x9fb6('0x2c')]=_['keys'](_0x21570c['query']);_0x7f1aad[_0x9fb6('0x2d')]=_[_0x9fb6('0x2e')](_0x7f1aad[_0x9fb6('0x2b')],_0x7f1aad['query']);_0x2ae2fe[_0x9fb6('0x2f')]=_['intersection'](_0x7f1aad[_0x9fb6('0x2b')],qs[_0x9fb6('0x30')](_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x30')]));_0x2ae2fe[_0x9fb6('0x2f')]=_0x2ae2fe[_0x9fb6('0x2f')][_0x9fb6('0x31')]?_0x2ae2fe[_0x9fb6('0x2f')]:_0x7f1aad[_0x9fb6('0x2b')];if(!_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x32')](_0x9fb6('0x33'))){_0x2ae2fe[_0x9fb6('0x34')]=qs[_0x9fb6('0x34')](_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x34')]);_0x2ae2fe[_0x9fb6('0x1a')]=qs[_0x9fb6('0x1a')](_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x1a')]);}_0x2ae2fe[_0x9fb6('0x35')]=qs[_0x9fb6('0x36')](_0x21570c[_0x9fb6('0x2c')]['sort']);_0x2ae2fe['where']=qs[_0x9fb6('0x2d')](_[_0x9fb6('0x37')](_0x21570c[_0x9fb6('0x2c')],_0x7f1aad[_0x9fb6('0x2d')]));if(_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x38')]){_0x2ae2fe[_0x9fb6('0x39')]=_[_0x9fb6('0x3a')](_0x2ae2fe[_0x9fb6('0x39')],{'$or':_['map'](_0x41f178,function(_0x385fdb){if(_0x385fdb[_0x9fb6('0x29')]!==_0x9fb6('0x3b')){var _0x4be48e={};_0x4be48e[_0x385fdb[_0x9fb6('0x24')]]={'$like':'%'+_0x21570c[_0x9fb6('0x2c')][_0x9fb6('0x38')]+'%'};return _0x4be48e;}})});}_0x2ae2fe=_['merge']({},_0x2ae2fe,_0x21570c[_0x9fb6('0x3c')]);var _0x21843a={'where':_0x2ae2fe[_0x9fb6('0x39')]};return db[_0x9fb6('0x27')][_0x9fb6('0x19')](_0x21843a)[_0x9fb6('0x21')](function(_0x2e5503){_0x5c2c5f[_0x9fb6('0x19')]=_0x2e5503;if(_0x21570c['query'][_0x9fb6('0x3d')]){_0x2ae2fe[_0x9fb6('0x3e')]=[{'all':!![]}];}return db[_0x9fb6('0x27')][_0x9fb6('0x3f')](_0x2ae2fe);})[_0x9fb6('0x21')](function(_0xf79771){_0x5c2c5f[_0x9fb6('0x40')]=_0xf79771;return _0x5c2c5f;})['then'](respondWithFilteredResult(_0x1940d7,_0x2ae2fe))[_0x9fb6('0x41')](handleError(_0x1940d7,null));};exports[_0x9fb6('0x42')]=function(_0x28dc42,_0x4bb803){var _0x29772f={'raw':!![],'where':{'id':_0x28dc42[_0x9fb6('0x43')]['id']}},_0x334595={};_0x334595[_0x9fb6('0x2b')]=_['keys'](db[_0x9fb6('0x27')]['rawAttributes']);_0x334595['query']=_['keys'](_0x28dc42[_0x9fb6('0x2c')]);_0x334595['filters']=_[_0x9fb6('0x2e')](_0x334595['model'],_0x334595[_0x9fb6('0x2c')]);_0x29772f[_0x9fb6('0x2f')]=_['intersection'](_0x334595[_0x9fb6('0x2b')],qs[_0x9fb6('0x30')](_0x28dc42[_0x9fb6('0x2c')][_0x9fb6('0x30')]));_0x29772f[_0x9fb6('0x2f')]=_0x29772f[_0x9fb6('0x2f')][_0x9fb6('0x31')]?_0x29772f[_0x9fb6('0x2f')]:_0x334595[_0x9fb6('0x2b')];if(_0x28dc42[_0x9fb6('0x2c')]['includeAll']){_0x29772f[_0x9fb6('0x3e')]=[{'all':!![]}];}_0x29772f=_[_0x9fb6('0x3a')]({},_0x29772f,_0x28dc42[_0x9fb6('0x3c')]);return db[_0x9fb6('0x27')]['find'](_0x29772f)[_0x9fb6('0x21')](handleEntityNotFound(_0x4bb803,null))[_0x9fb6('0x21')](respondWithResult(_0x4bb803,null))[_0x9fb6('0x41')](handleError(_0x4bb803,null));};exports[_0x9fb6('0x44')]=function(_0x4cebc2,_0x2973ed){var _0x384f38={'where':{'id':_0x4cebc2[_0x9fb6('0x43')]['id']}},_0x2e37a8={};_0x2e37a8[_0x9fb6('0x2b')]=_[_0x9fb6('0x45')](db[_0x9fb6('0x27')][_0x9fb6('0x28')]);_0x384f38['attributes']=_['intersection'](_0x2e37a8[_0x9fb6('0x2b')],qs[_0x9fb6('0x30')](_0x4cebc2['query'][_0x9fb6('0x30')]));_0x384f38[_0x9fb6('0x2f')]=_0x384f38[_0x9fb6('0x2f')][_0x9fb6('0x31')]?_0x384f38['attributes']:_0x2e37a8[_0x9fb6('0x2b')];if(_0x4cebc2['query'][_0x9fb6('0x3d')]){_0x384f38[_0x9fb6('0x3e')]=[{'all':!![]}];}_0x384f38=_[_0x9fb6('0x3a')]({},_0x384f38,_0x4cebc2['options']);return db[_0x9fb6('0x27')][_0x9fb6('0x46')](_0x384f38)[_0x9fb6('0x21')](handleEntityNotFound(_0x2973ed,null))['then'](function(_0x4f7461){if(_0x4f7461){var _0x2f6c94=_0x4f7461[_0x9fb6('0x47')]({'plain':!![]});_0x2f6c94=qs['omit'](_0x2f6c94,['id',_0x9fb6('0x48'),_0x9fb6('0x49')]);_0x4cebc2[_0x9fb6('0x4a')]=_[_0x9fb6('0x4b')](_0x4cebc2[_0x9fb6('0x4a')],['id',_0x9fb6('0x48'),_0x9fb6('0x49')]);return db[_0x9fb6('0x27')][_0x9fb6('0x4c')](_[_0x9fb6('0x3a')](_0x2f6c94,_0x4cebc2[_0x9fb6('0x4a')]),{'include':_0x4cebc2[_0x9fb6('0x2c')][_0x9fb6('0x3d')]?[{'all':!![]}]:undefined});}})[_0x9fb6('0x21')](respondWithResult(_0x2973ed,0xc9))['catch'](handleError(_0x2973ed,null));};exports[_0x9fb6('0x20')]=function(_0x359328,_0x3b1ac2){if(_0x359328[_0x9fb6('0x4a')]['id']){delete _0x359328['body']['id'];}return db['Attachment'][_0x9fb6('0x46')]({'where':{'id':_0x359328[_0x9fb6('0x43')]['id']}})[_0x9fb6('0x21')](handleEntityNotFound(_0x3b1ac2,null))[_0x9fb6('0x21')](saveUpdates(_0x359328[_0x9fb6('0x4a')],null))[_0x9fb6('0x21')](respondWithResult(_0x3b1ac2,null))['catch'](handleError(_0x3b1ac2,null));};exports[_0x9fb6('0x22')]=function(_0x2d32a1,_0x3493c4){return db[_0x9fb6('0x27')][_0x9fb6('0x46')]({'where':{'id':_0x2d32a1[_0x9fb6('0x43')]['id']}})['then'](handleEntityNotFound(_0x3493c4,null))[_0x9fb6('0x21')](removeEntity(_0x3493c4,null))[_0x9fb6('0x41')](handleError(_0x3493c4,null));};exports[_0x9fb6('0x4c')]=function(_0xb2c36,_0x48d0e4,_0x59218a){_0xb2c36['body']['name']=_0xb2c36[_0x9fb6('0x4d')]['originalname'];_0xb2c36[_0x9fb6('0x4a')][_0x9fb6('0x4e')]=_0xb2c36[_0x9fb6('0x4d')][_0x9fb6('0x4f')];_0xb2c36[_0x9fb6('0x4a')]['type']=_0xb2c36[_0x9fb6('0x4d')][_0x9fb6('0x50')];return db[_0x9fb6('0x27')][_0x9fb6('0x4c')](_0xb2c36[_0x9fb6('0x4a')])[_0x9fb6('0x21')](respondWithResult(_0x48d0e4,0xc9))[_0x9fb6('0x41')](handleError(_0x48d0e4,null));};exports[_0x9fb6('0x51')]=function(_0x4a7434,_0xb312fc,_0x53cbe1){return db[_0x9fb6('0x27')]['findOne']({'where':{'id':_0x4a7434['params']['id']},'raw':!![]})[_0x9fb6('0x21')](handleEntityNotFound(_0xb312fc,null))[_0x9fb6('0x21')](function(_0x5186e0){if(_0x5186e0){return _0xb312fc[_0x9fb6('0x51')](path[_0x9fb6('0x52')](config['root'],_0x9fb6('0x53'),_0x5186e0[_0x9fb6('0x4e')]));}})[_0x9fb6('0x41')](handleError(_0xb312fc,null));}; \ No newline at end of file +var _0x390a=['key','query','keys','model','attributes','intersection','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','fields','catch','clone','find','get','createdAt','updatedAt','body','omit','update','create','basename','file','type','mimetype','download','findOne','join','root','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','error','stack','name','index','map','Attachment','rawAttributes','fieldName'];(function(_0x45e34c,_0x41eb38){var _0x2c8a7a=function(_0x35b174){while(--_0x35b174){_0x45e34c['push'](_0x45e34c['shift']());}};_0x2c8a7a(++_0x41eb38);}(_0x390a,0x80));var _0xa390=function(_0x3ca117,_0x10d22e){_0x3ca117=_0x3ca117-0x0;var _0x59cdd8=_0x390a[_0x3ca117];return _0x59cdd8;};'use strict';var pdf=require(_0xa390('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa390('0x1'));var zipdir=require(_0xa390('0x2'));var jsonpatch=require(_0xa390('0x3'));var rp=require(_0xa390('0x4'));var moment=require(_0xa390('0x5'));var BPromise=require(_0xa390('0x6'));var Mustache=require(_0xa390('0x7'));var util=require(_0xa390('0x8'));var path=require(_0xa390('0x9'));var sox=require(_0xa390('0xa'));var csv=require(_0xa390('0xb'));var ejs=require(_0xa390('0xc'));var fs=require('fs');var _=require(_0xa390('0xd'));var squel=require(_0xa390('0xe'));var crypto=require('crypto');var jsforce=require(_0xa390('0xf'));var deskjs=require(_0xa390('0x10'));var toCsv=require(_0xa390('0xb'));var querystring=require('querystring');var Papa=require(_0xa390('0x11'));var Redis=require('ioredis');var authService=require(_0xa390('0x12'));var qs=require(_0xa390('0x13'));var as=require(_0xa390('0x14'));var hardwareService=require(_0xa390('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0xa390('0x16'));var config=require(_0xa390('0x17'));var db=require(_0xa390('0x18'))['db'];function respondWithStatusCode(_0x24be2d,_0x2bc948){_0x2bc948=_0x2bc948||0xcc;return function(_0x56a3da){if(_0x56a3da){return _0x24be2d[_0xa390('0x19')](_0x2bc948);}return _0x24be2d['status'](_0x2bc948)[_0xa390('0x1a')]();};}function respondWithResult(_0x969532,_0xa89849){_0xa89849=_0xa89849||0xc8;return function(_0x492cb9){if(_0x492cb9){return _0x969532[_0xa390('0x1b')](_0xa89849)[_0xa390('0x1c')](_0x492cb9);}};}function respondWithFilteredResult(_0x58fa98,_0x2fef03){return function(_0x5cb753){if(_0x5cb753){var _0x5676ef=_0x5cb753[_0xa390('0x1d')],_0x242d5a=_0x2fef03[_0xa390('0x1e')],_0x3d6e99=_0x2fef03[_0xa390('0x1e')]+_0x2fef03[_0xa390('0x1f')],_0x35c45d;if(_0x3d6e99>=_0x5676ef){_0x3d6e99=_0x5676ef;_0x35c45d=0xc8;}else{_0x35c45d=0xce;}_0x58fa98['status'](_0x35c45d);return _0x58fa98[_0xa390('0x20')](_0xa390('0x21'),_0x242d5a+'-'+_0x3d6e99+'/'+_0x5676ef)['json'](_0x5cb753);}return null;};}function patchUpdates(_0x252ea6){return function(_0x53d396){try{jsonpatch[_0xa390('0x22')](_0x53d396,_0x252ea6,!![]);}catch(_0x537703){return BPromise['reject'](_0x537703);}return _0x53d396[_0xa390('0x23')]();};}function saveUpdates(_0x1d27e6,_0x477412){return function(_0x1c685e){if(_0x1c685e){return _0x1c685e['update'](_0x1d27e6)[_0xa390('0x24')](function(_0x5b1c76){return _0x5b1c76;});}return null;};}function removeEntity(_0x5b86c2,_0x41de36){return function(_0x967e5b){if(_0x967e5b){return _0x967e5b[_0xa390('0x25')]()['then'](function(){_0x5b86c2[_0xa390('0x1b')](0xcc)[_0xa390('0x1a')]();});}};}function handleEntityNotFound(_0x2f9acc,_0x2ae86b){return function(_0x2f6f3b){if(!_0x2f6f3b){_0x2f9acc[_0xa390('0x19')](0x194);}return _0x2f6f3b;};}function handleError(_0xb930c9,_0x5a2142){_0x5a2142=_0x5a2142||0x1f4;return function(_0x30be7b){logger[_0xa390('0x26')](_0x30be7b[_0xa390('0x27')]);if(_0x30be7b['name']){delete _0x30be7b[_0xa390('0x28')];}_0xb930c9['status'](_0x5a2142)['send'](_0x30be7b);};}exports[_0xa390('0x29')]=function(_0xacd4b2,_0x2e20c2){var _0x8dd695={},_0x2da6bb={},_0x5f02cd={'count':0x0,'rows':[]};var _0x351d42=_[_0xa390('0x2a')](db[_0xa390('0x2b')][_0xa390('0x2c')],function(_0xabf669){return{'name':_0xabf669[_0xa390('0x2d')],'type':_0xabf669['type'][_0xa390('0x2e')]};});_0x2da6bb['model']=_['map'](_0x351d42,_0xa390('0x28'));_0x2da6bb[_0xa390('0x2f')]=_[_0xa390('0x30')](_0xacd4b2[_0xa390('0x2f')]);_0x2da6bb['filters']=_['intersection'](_0x2da6bb[_0xa390('0x31')],_0x2da6bb['query']);_0x8dd695[_0xa390('0x32')]=_[_0xa390('0x33')](_0x2da6bb[_0xa390('0x31')],qs['fields'](_0xacd4b2[_0xa390('0x2f')]['fields']));_0x8dd695[_0xa390('0x32')]=_0x8dd695[_0xa390('0x32')][_0xa390('0x34')]?_0x8dd695[_0xa390('0x32')]:_0x2da6bb['model'];if(!_0xacd4b2['query'][_0xa390('0x35')](_0xa390('0x36'))){_0x8dd695[_0xa390('0x1f')]=qs[_0xa390('0x1f')](_0xacd4b2['query'][_0xa390('0x1f')]);_0x8dd695['offset']=qs[_0xa390('0x1e')](_0xacd4b2[_0xa390('0x2f')][_0xa390('0x1e')]);}_0x8dd695[_0xa390('0x37')]=qs['sort'](_0xacd4b2['query'][_0xa390('0x38')]);_0x8dd695[_0xa390('0x39')]=qs[_0xa390('0x3a')](_[_0xa390('0x3b')](_0xacd4b2[_0xa390('0x2f')],_0x2da6bb['filters']));if(_0xacd4b2['query'][_0xa390('0x3c')]){_0x8dd695[_0xa390('0x39')]=_[_0xa390('0x3d')](_0x8dd695[_0xa390('0x39')],{'$or':_[_0xa390('0x2a')](_0x351d42,function(_0x320585){if(_0x320585['type']!==_0xa390('0x3e')){var _0x1bc130={};_0x1bc130[_0x320585[_0xa390('0x28')]]={'$like':'%'+_0xacd4b2[_0xa390('0x2f')][_0xa390('0x3c')]+'%'};return _0x1bc130;}})});}_0x8dd695=_[_0xa390('0x3d')]({},_0x8dd695,_0xacd4b2[_0xa390('0x3f')]);var _0x18a0e0={'where':_0x8dd695[_0xa390('0x39')]};return db['Attachment'][_0xa390('0x1d')](_0x18a0e0)[_0xa390('0x24')](function(_0x5e2080){_0x5f02cd['count']=_0x5e2080;if(_0xacd4b2[_0xa390('0x2f')][_0xa390('0x40')]){_0x8dd695[_0xa390('0x41')]=[{'all':!![]}];}return db['Attachment']['findAll'](_0x8dd695);})['then'](function(_0x279a90){_0x5f02cd[_0xa390('0x42')]=_0x279a90;return _0x5f02cd;})[_0xa390('0x24')](respondWithFilteredResult(_0x2e20c2,_0x8dd695))['catch'](handleError(_0x2e20c2,null));};exports['show']=function(_0x390ed5,_0xac9e1a){var _0x4ed48e={'raw':!![],'where':{'id':_0x390ed5[_0xa390('0x43')]['id']}},_0x248d36={};_0x248d36[_0xa390('0x31')]=_[_0xa390('0x30')](db[_0xa390('0x2b')]['rawAttributes']);_0x248d36['query']=_[_0xa390('0x30')](_0x390ed5['query']);_0x248d36[_0xa390('0x3a')]=_[_0xa390('0x33')](_0x248d36[_0xa390('0x31')],_0x248d36[_0xa390('0x2f')]);_0x4ed48e['attributes']=_[_0xa390('0x33')](_0x248d36[_0xa390('0x31')],qs[_0xa390('0x44')](_0x390ed5[_0xa390('0x2f')][_0xa390('0x44')]));_0x4ed48e[_0xa390('0x32')]=_0x4ed48e[_0xa390('0x32')][_0xa390('0x34')]?_0x4ed48e['attributes']:_0x248d36['model'];if(_0x390ed5[_0xa390('0x2f')]['includeAll']){_0x4ed48e['include']=[{'all':!![]}];}_0x4ed48e=_['merge']({},_0x4ed48e,_0x390ed5[_0xa390('0x3f')]);return db[_0xa390('0x2b')]['find'](_0x4ed48e)[_0xa390('0x24')](handleEntityNotFound(_0xac9e1a,null))[_0xa390('0x24')](respondWithResult(_0xac9e1a,null))[_0xa390('0x45')](handleError(_0xac9e1a,null));};exports[_0xa390('0x46')]=function(_0x5a135b,_0x56e037){var _0xc93ce6={'where':{'id':_0x5a135b[_0xa390('0x43')]['id']}},_0x37aac3={};_0x37aac3['model']=_[_0xa390('0x30')](db['Attachment'][_0xa390('0x2c')]);_0xc93ce6[_0xa390('0x32')]=_[_0xa390('0x33')](_0x37aac3[_0xa390('0x31')],qs[_0xa390('0x44')](_0x5a135b[_0xa390('0x2f')][_0xa390('0x44')]));_0xc93ce6['attributes']=_0xc93ce6[_0xa390('0x32')][_0xa390('0x34')]?_0xc93ce6['attributes']:_0x37aac3[_0xa390('0x31')];if(_0x5a135b[_0xa390('0x2f')]['includeAll']){_0xc93ce6[_0xa390('0x41')]=[{'all':!![]}];}_0xc93ce6=_[_0xa390('0x3d')]({},_0xc93ce6,_0x5a135b[_0xa390('0x3f')]);return db[_0xa390('0x2b')][_0xa390('0x47')](_0xc93ce6)['then'](handleEntityNotFound(_0x56e037,null))['then'](function(_0x1eb8f0){if(_0x1eb8f0){var _0x59bff0=_0x1eb8f0[_0xa390('0x48')]({'plain':!![]});_0x59bff0=qs['omit'](_0x59bff0,['id',_0xa390('0x49'),_0xa390('0x4a')]);_0x5a135b[_0xa390('0x4b')]=_[_0xa390('0x4c')](_0x5a135b[_0xa390('0x4b')],['id',_0xa390('0x49'),_0xa390('0x4a')]);return db[_0xa390('0x2b')]['create'](_[_0xa390('0x3d')](_0x59bff0,_0x5a135b[_0xa390('0x4b')]),{'include':_0x5a135b['query'][_0xa390('0x40')]?[{'all':!![]}]:undefined});}})[_0xa390('0x24')](respondWithResult(_0x56e037,0xc9))[_0xa390('0x45')](handleError(_0x56e037,null));};exports[_0xa390('0x4d')]=function(_0x3e120e,_0xa53225){if(_0x3e120e[_0xa390('0x4b')]['id']){delete _0x3e120e[_0xa390('0x4b')]['id'];}return db[_0xa390('0x2b')][_0xa390('0x47')]({'where':{'id':_0x3e120e[_0xa390('0x43')]['id']}})[_0xa390('0x24')](handleEntityNotFound(_0xa53225,null))[_0xa390('0x24')](saveUpdates(_0x3e120e[_0xa390('0x4b')],null))[_0xa390('0x24')](respondWithResult(_0xa53225,null))[_0xa390('0x45')](handleError(_0xa53225,null));};exports[_0xa390('0x25')]=function(_0xe68435,_0x5399a1){return db['Attachment'][_0xa390('0x47')]({'where':{'id':_0xe68435[_0xa390('0x43')]['id']}})['then'](handleEntityNotFound(_0x5399a1,null))['then'](removeEntity(_0x5399a1,null))['catch'](handleError(_0x5399a1,null));};exports[_0xa390('0x4e')]=function(_0x457a58,_0x2a6183,_0x16d859){_0x457a58[_0xa390('0x4b')]['name']=_0x457a58['file']['originalname'];_0x457a58[_0xa390('0x4b')][_0xa390('0x4f')]=_0x457a58[_0xa390('0x50')]['filename'];_0x457a58[_0xa390('0x4b')][_0xa390('0x51')]=_0x457a58[_0xa390('0x50')][_0xa390('0x52')];return db[_0xa390('0x2b')][_0xa390('0x4e')](_0x457a58['body'])[_0xa390('0x24')](respondWithResult(_0x2a6183,0xc9))['catch'](handleError(_0x2a6183,null));};exports[_0xa390('0x53')]=function(_0x132cc4,_0x370c0c,_0x5a8293){return db['Attachment'][_0xa390('0x54')]({'where':{'id':_0x132cc4[_0xa390('0x43')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x370c0c,null))[_0xa390('0x24')](function(_0x15ef09){if(_0x15ef09){return _0x370c0c[_0xa390('0x53')](path[_0xa390('0x55')](config[_0xa390('0x56')],'server/files/attachments/',_0x15ef09[_0xa390('0x4f')]));}})[_0xa390('0x45')](handleError(_0x370c0c,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index d50451d..b49055b 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 _0x7708=['../../config/environment','exports','define','Attachment','attachments','lodash','util','api','rimraf'];(function(_0x57062d,_0x2f2c1f){var _0x2ccfa6=function(_0x5b3b3f){while(--_0x5b3b3f){_0x57062d['push'](_0x57062d['shift']());}};_0x2ccfa6(++_0x2f2c1f);}(_0x7708,0x188));var _0x8770=function(_0x2f1114,_0x4561f1){_0x2f1114=_0x2f1114-0x0;var _0x2fe856=_0x7708[_0x2f1114];return _0x2fe856;};'use strict';var _=require(_0x8770('0x0'));var util=require(_0x8770('0x1'));var logger=require('../../config/logger')(_0x8770('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8770('0x3'));var config=require(_0x8770('0x4'));var attributes=require('./attachment.attributes');module[_0x8770('0x5')]=function(_0x50bab7,_0x31390d){return _0x50bab7[_0x8770('0x6')](_0x8770('0x7'),attributes,{'tableName':_0x8770('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa846=['define','attachments','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0xd68edb,_0xc0092b){var _0x19142b=function(_0x28552e){while(--_0x28552e){_0xd68edb['push'](_0xd68edb['shift']());}};_0x19142b(++_0xc0092b);}(_0xa846,0x70));var _0x6a84=function(_0x2e5baf,_0x4b77a1){_0x2e5baf=_0x2e5baf-0x0;var _0x4c0797=_0xa846[_0x2e5baf];return _0x4c0797;};'use strict';var _=require('lodash');var util=require(_0x6a84('0x0'));var logger=require(_0x6a84('0x1'))(_0x6a84('0x2'));var moment=require(_0x6a84('0x3'));var BPromise=require(_0x6a84('0x4'));var rp=require(_0x6a84('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6a84('0x6'));var config=require(_0x6a84('0x7'));var attributes=require('./attachment.attributes');module[_0x6a84('0x8')]=function(_0x1d803f,_0x42c692){return _0x1d803f[_0x6a84('0x9')]('Attachment',attributes,{'tableName':_0x6a84('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/attachment/attachment.rpc.js b/server/api/attachment/attachment.rpc.js index fc655a5..33e47bc 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 _0x4a77=['error','message','result','catch','CreateAttachment','create','options','stringify','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','Attachment,\x20%s,\x20%s,\x20%s'];(function(_0x46cd89,_0x4a23e4){var _0xb080e8=function(_0x32fc3e){while(--_0x32fc3e){_0x46cd89['push'](_0x46cd89['shift']());}};_0xb080e8(++_0x4a23e4);}(_0x4a77,0x18e));var _0x74a7=function(_0x1d1d23,_0x4bae2b){_0x1d1d23=_0x1d1d23-0x0;var _0x20ade9=_0x4a77[_0x1d1d23];return _0x20ade9;};'use strict';var _=require(_0x74a7('0x0'));var util=require('util');var moment=require(_0x74a7('0x1'));var BPromise=require(_0x74a7('0x2'));var rs=require(_0x74a7('0x3'));var fs=require('fs');var Redis=require(_0x74a7('0x4'));var db=require(_0x74a7('0x5'))['db'];var utils=require(_0x74a7('0x6'));var logger=require(_0x74a7('0x7'))('rpc');var config=require(_0x74a7('0x8'));var jayson=require(_0x74a7('0x9'));var client=jayson[_0x74a7('0xa')][_0x74a7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4067b2,_0x36faa4,_0x10ab1d){return new BPromise(function(_0x2cc8f6,_0x46c850){return client['request'](_0x4067b2,_0x10ab1d)[_0x74a7('0xc')](function(_0x42944c){logger[_0x74a7('0xd')](_0x74a7('0xe'),_0x36faa4,_0x74a7('0xf'));logger[_0x74a7('0x10')](_0x74a7('0x11'),_0x36faa4,_0x74a7('0xf'),JSON['stringify'](_0x42944c));if(_0x42944c[_0x74a7('0x12')]){if(_0x42944c[_0x74a7('0x12')]['code']===0x1f4){logger[_0x74a7('0x12')](_0x74a7('0xe'),_0x36faa4,_0x42944c[_0x74a7('0x12')][_0x74a7('0x13')]);return _0x46c850(_0x42944c[_0x74a7('0x12')][_0x74a7('0x13')]);}logger[_0x74a7('0x12')]('Attachment,\x20%s,\x20%s',_0x36faa4,_0x42944c[_0x74a7('0x12')]['message']);return _0x2cc8f6(_0x42944c[_0x74a7('0x12')][_0x74a7('0x13')]);}else{logger[_0x74a7('0xd')]('Attachment,\x20%s,\x20%s',_0x36faa4,_0x74a7('0xf'));_0x2cc8f6(_0x42944c[_0x74a7('0x14')][_0x74a7('0x13')]);}})[_0x74a7('0x15')](function(_0x496907){logger[_0x74a7('0x12')]('Attachment,\x20%s,\x20%s',_0x36faa4,_0x496907);_0x46c850(_0x496907);});});}exports[_0x74a7('0x16')]=function(_0x4c3902){var _0xccf952=this;return new Promise(function(_0xd2e9be,_0x326943){return db['Attachment'][_0x74a7('0x17')](_0x4c3902['body'],{'raw':_0x4c3902[_0x74a7('0x18')]?_0x4c3902['options']['raw']===undefined?!![]:![]:!![]})[_0x74a7('0xc')](function(_0x53d3c8){logger[_0x74a7('0xd')]('CreateAttachment',_0x4c3902);logger[_0x74a7('0x10')](_0x74a7('0x16'),_0x4c3902,JSON[_0x74a7('0x19')](_0x53d3c8));_0xd2e9be(_0x53d3c8);})['catch'](function(_0x43b8e1){logger[_0x74a7('0x12')](_0x74a7('0x16'),_0x43b8e1[_0x74a7('0x13')],_0x4c3902);_0x326943(_0xccf952[_0x74a7('0x12')](0x1f4,_0x43b8e1[_0x74a7('0x13')]));});});}; \ No newline at end of file +var _0xc3c6=['debug','Attachment,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateAttachment','Attachment','create','options','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','then','Attachment,\x20%s,\x20%s'];(function(_0x5b814a,_0x48fa1e){var _0x43f574=function(_0x35ffd3){while(--_0x35ffd3){_0x5b814a['push'](_0x5b814a['shift']());}};_0x43f574(++_0x48fa1e);}(_0xc3c6,0x101));var _0x6c3c=function(_0x130870,_0x251de1){_0x130870=_0x130870-0x0;var _0x3c6a4b=_0xc3c6[_0x130870];return _0x3c6a4b;};'use strict';var _=require(_0x6c3c('0x0'));var util=require(_0x6c3c('0x1'));var moment=require('moment');var BPromise=require(_0x6c3c('0x2'));var rs=require(_0x6c3c('0x3'));var fs=require('fs');var Redis=require(_0x6c3c('0x4'));var db=require(_0x6c3c('0x5'))['db'];var utils=require(_0x6c3c('0x6'));var logger=require(_0x6c3c('0x7'))(_0x6c3c('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6c3c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x556566,_0x417d5d,_0xc17269){return new BPromise(function(_0x2d6e15,_0x7ebfb0){return client[_0x6c3c('0xa')](_0x556566,_0xc17269)[_0x6c3c('0xb')](function(_0xd53885){logger['info'](_0x6c3c('0xc'),_0x417d5d,'request\x20sent');logger[_0x6c3c('0xd')](_0x6c3c('0xe'),_0x417d5d,_0x6c3c('0xf'),JSON[_0x6c3c('0x10')](_0xd53885));if(_0xd53885[_0x6c3c('0x11')]){if(_0xd53885[_0x6c3c('0x11')][_0x6c3c('0x12')]===0x1f4){logger[_0x6c3c('0x11')](_0x6c3c('0xc'),_0x417d5d,_0xd53885[_0x6c3c('0x11')][_0x6c3c('0x13')]);return _0x7ebfb0(_0xd53885[_0x6c3c('0x11')][_0x6c3c('0x13')]);}logger[_0x6c3c('0x11')](_0x6c3c('0xc'),_0x417d5d,_0xd53885[_0x6c3c('0x11')][_0x6c3c('0x13')]);return _0x2d6e15(_0xd53885[_0x6c3c('0x11')][_0x6c3c('0x13')]);}else{logger['info']('Attachment,\x20%s,\x20%s',_0x417d5d,_0x6c3c('0xf'));_0x2d6e15(_0xd53885[_0x6c3c('0x14')][_0x6c3c('0x13')]);}})[_0x6c3c('0x15')](function(_0x4f9e48){logger[_0x6c3c('0x11')](_0x6c3c('0xc'),_0x417d5d,_0x4f9e48);_0x7ebfb0(_0x4f9e48);});});}exports[_0x6c3c('0x16')]=function(_0x28ce65){var _0x27d373=this;return new Promise(function(_0x5eb65d,_0x35d779){return db[_0x6c3c('0x17')][_0x6c3c('0x18')](_0x28ce65['body'],{'raw':_0x28ce65[_0x6c3c('0x19')]?_0x28ce65[_0x6c3c('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x6c3c('0xb')](function(_0xbfd164){logger[_0x6c3c('0x1a')](_0x6c3c('0x16'),_0x28ce65);logger[_0x6c3c('0xd')](_0x6c3c('0x16'),_0x28ce65,JSON[_0x6c3c('0x10')](_0xbfd164));_0x5eb65d(_0xbfd164);})[_0x6c3c('0x15')](function(_0x2b1942){logger[_0x6c3c('0x11')](_0x6c3c('0x16'),_0x2b1942[_0x6c3c('0x13')],_0x28ce65);_0x35d779(_0x27d373[_0x6c3c('0x11')](0x1f4,_0x2b1942[_0x6c3c('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4531dbb..c2dc126 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 _0x0447=['../../components/interaction/service','../../config/environment','./attachment.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','/:id/clone','clone','diskStorage','join','format','%s-%s','replace','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x328cc8,_0x4f5e10){var _0x45e89f=function(_0x5a6503){while(--_0x5a6503){_0x328cc8['push'](_0x328cc8['shift']());}};_0x45e89f(++_0x4f5e10);}(_0x0447,0x8b));var _0x7044=function(_0x1bc798,_0x2ab7c9){_0x1bc798=_0x1bc798-0x0;var _0x3308ca=_0x0447[_0x1bc798];return _0x3308ca;};'use strict';var multer=require(_0x7044('0x0'));var util=require(_0x7044('0x1'));var path=require(_0x7044('0x2'));var timeout=require(_0x7044('0x3'));var express=require(_0x7044('0x4'));var router=express['Router']();var auth=require(_0x7044('0x5'));var interaction=require(_0x7044('0x6'));var config=require(_0x7044('0x7'));var controller=require(_0x7044('0x8'));router[_0x7044('0x9')]('/',auth[_0x7044('0xa')](),controller[_0x7044('0xb')]);router[_0x7044('0x9')](_0x7044('0xc'),auth['isAuthenticated'](),controller[_0x7044('0xd')]);router[_0x7044('0x9')](_0x7044('0xe'),auth[_0x7044('0xa')](),controller['download']);router[_0x7044('0xf')](_0x7044('0x10'),auth['isAuthenticated'](),controller[_0x7044('0x11')]);var upload=multer({'storage':multer[_0x7044('0x12')]({'destination':function(_0x87a156,_0xf38c20,_0x4f83c7){_0x4f83c7(null,path[_0x7044('0x13')](config['root'],'server/files/attachments/'));},'filename':function(_0x53f150,_0xe26cea,_0x41b118){_0x41b118(null,util[_0x7044('0x14')](_0x7044('0x15'),Date['now'](),_0xe26cea['originalname'][_0x7044('0x16')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x7044('0xf')]('/',upload['single']('file'),controller[_0x7044('0x17')]);router[_0x7044('0x18')](_0x7044('0xc'),auth[_0x7044('0xa')](),controller[_0x7044('0x19')]);router[_0x7044('0x1a')]('/:id',auth[_0x7044('0xa')](),controller[_0x7044('0x1b')]);module[_0x7044('0x1c')]=router; \ No newline at end of file +var _0x97e7=['post','/:id/clone','clone','diskStorage','root','server/files/attachments/','originalname','single','file','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','./attachment.controller','get','index','/:id','isAuthenticated','show','/:id/download'];(function(_0x29b929,_0x2a4b10){var _0x3a8ce6=function(_0x1e2759){while(--_0x1e2759){_0x29b929['push'](_0x29b929['shift']());}};_0x3a8ce6(++_0x2a4b10);}(_0x97e7,0x7a));var _0x797e=function(_0x54458c,_0x28bb7d){_0x54458c=_0x54458c-0x0;var _0x398da9=_0x97e7[_0x54458c];return _0x398da9;};'use strict';var multer=require(_0x797e('0x0'));var util=require(_0x797e('0x1'));var path=require('path');var timeout=require(_0x797e('0x2'));var express=require(_0x797e('0x3'));var router=express[_0x797e('0x4')]();var auth=require(_0x797e('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x797e('0x6'));router[_0x797e('0x7')]('/',auth['isAuthenticated'](),controller[_0x797e('0x8')]);router['get'](_0x797e('0x9'),auth[_0x797e('0xa')](),controller[_0x797e('0xb')]);router['get'](_0x797e('0xc'),auth[_0x797e('0xa')](),controller['download']);router[_0x797e('0xd')](_0x797e('0xe'),auth[_0x797e('0xa')](),controller[_0x797e('0xf')]);var upload=multer({'storage':multer[_0x797e('0x10')]({'destination':function(_0x12ed5d,_0x488fc1,_0x43e0e8){_0x43e0e8(null,path['join'](config[_0x797e('0x11')],_0x797e('0x12')));},'filename':function(_0x3da234,_0x302ccb,_0x5b7315){_0x5b7315(null,util['format']('%s-%s',Date['now'](),_0x302ccb[_0x797e('0x13')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x797e('0xd')]('/',upload[_0x797e('0x14')](_0x797e('0x15')),controller[_0x797e('0x16')]);router[_0x797e('0x17')]('/:id',auth[_0x797e('0xa')](),controller['update']);router[_0x797e('0x18')](_0x797e('0x9'),auth[_0x797e('0xa')](),controller[_0x797e('0x19')]);module[_0x797e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 90e221e..c1ed1a0 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 _0xf1af=['findOne','blockDuration','then','User','find','map','emails','value','admin','user','agent','disabled','blocked','blockedAt','minutes','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','../../mysqldb','../../components/auth/service','signToken','../../config/utils','login','google','profile','callback','authenticate','/login','use','clientID','clientSecret','secret','Setting'];(function(_0x16b99d,_0x19e643){var _0x17a994=function(_0x591737){while(--_0x591737){_0x16b99d['push'](_0x16b99d['shift']());}};_0x17a994(++_0x19e643);}(_0xf1af,0x7d));var _0xff1a=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0xf1af[_0x28d18d];return _0x470640;};'use strict';var _=require(_0xff1a('0x0'));var passport=require(_0xff1a('0x1'));var GoogleStrategy=require(_0xff1a('0x2'))[_0xff1a('0x3')];var moment=require('moment');var db=require(_0xff1a('0x4'))['db'];var config=require('../../config/environment');var signToken=require(_0xff1a('0x5'))[_0xff1a('0x6')];var utils=require(_0xff1a('0x7'));exports[_0xff1a('0x8')]=passport['authenticate'](_0xff1a('0x9'),{'failureRedirect':'/login','scope':[_0xff1a('0xa'),'email'],'session':![]});exports[_0xff1a('0xb')]=passport[_0xff1a('0xc')](_0xff1a('0x9'),{'failureRedirect':_0xff1a('0xd'),'session':![]});passport[_0xff1a('0xe')](new GoogleStrategy({'clientID':config[_0xff1a('0x9')]?config['google'][_0xff1a('0xf')]:'id','clientSecret':config[_0xff1a('0x9')]?config['google'][_0xff1a('0x10')]:_0xff1a('0x11'),'callbackURL':config[_0xff1a('0x9')]?config[_0xff1a('0x9')]['callbackURL']:''},function(_0x400177,_0x1f5a84,_0x427b64,_0x3ecf5f){var _0x15353a,_0x3e57e9;return db[_0xff1a('0x12')][_0xff1a('0x13')]({'where':{'id':0x1},'attributes':['allowedLoginAttempts',_0xff1a('0x14')],'raw':!![]})[_0xff1a('0x15')](function(_0x1e4b56){_0x15353a=_0x1e4b56;return db[_0xff1a('0x16')][_0xff1a('0x17')]({'where':{'email':_[_0xff1a('0x18')](_0x427b64[_0xff1a('0x19')],_0xff1a('0x1a')),'role':{'$or':[_0xff1a('0x1b'),_0xff1a('0x1c'),_0xff1a('0x1d')]}}});})[_0xff1a('0x15')](function(_0x19f5dc){_0x3e57e9=_0x19f5dc;if(_0x3e57e9){if(_0x3e57e9[_0xff1a('0x1e')]){return _0x3ecf5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x15353a[_0xff1a('0x14')]>0x0){if(_0x3e57e9[_0xff1a('0x1f')]){if(moment(_0x3e57e9[_0xff1a('0x20')])['add'](_0x15353a[_0xff1a('0x14')],_0xff1a('0x21'))>moment()){return _0x3ecf5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{return utils['clearBlockUser'](_0x3e57e9,0x0,![],null)[_0xff1a('0x15')](function(){return utils[_0xff1a('0x22')](_0x3e57e9);})[_0xff1a('0x15')](function(){return _0x3ecf5f(null,_0x3e57e9);});}}else{return utils[_0xff1a('0x22')](_0x3e57e9)[_0xff1a('0x15')](function(){return _0x3ecf5f(null,_0x3e57e9);});}}else{return utils['getLicense'](_0x3e57e9)[_0xff1a('0x15')](function(){return _0x3ecf5f(null,_0x3e57e9);});}}return _0x3ecf5f('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');})[_0xff1a('0x23')](function(_0x1c1e47){_0x3ecf5f(_0x1c1e47);});})); \ No newline at end of file +var _0x9408=['clientSecret','callbackURL','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','disabled','blockedAt','add','minutes','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','Strategy','moment','../../mysqldb','../../components/auth/service','signToken','login','authenticate','google','/login','callback','use','clientID'];(function(_0x3f8e5e,_0x45dd58){var _0x1214cb=function(_0x518f8a){while(--_0x518f8a){_0x3f8e5e['push'](_0x3f8e5e['shift']());}};_0x1214cb(++_0x45dd58);}(_0x9408,0x109));var _0x8940=function(_0x1794b1,_0x44ccc8){_0x1794b1=_0x1794b1-0x0;var _0x39cb44=_0x9408[_0x1794b1];return _0x39cb44;};'use strict';var _=require(_0x8940('0x0'));var passport=require(_0x8940('0x1'));var GoogleStrategy=require(_0x8940('0x2'))[_0x8940('0x3')];var moment=require(_0x8940('0x4'));var db=require(_0x8940('0x5'))['db'];var config=require('../../config/environment');var signToken=require(_0x8940('0x6'))[_0x8940('0x7')];var utils=require('../../config/utils');exports[_0x8940('0x8')]=passport[_0x8940('0x9')](_0x8940('0xa'),{'failureRedirect':_0x8940('0xb'),'scope':['profile','email'],'session':![]});exports[_0x8940('0xc')]=passport['authenticate'](_0x8940('0xa'),{'failureRedirect':_0x8940('0xb'),'session':![]});passport[_0x8940('0xd')](new GoogleStrategy({'clientID':config[_0x8940('0xa')]?config[_0x8940('0xa')][_0x8940('0xe')]:'id','clientSecret':config[_0x8940('0xa')]?config[_0x8940('0xa')][_0x8940('0xf')]:'secret','callbackURL':config['google']?config[_0x8940('0xa')][_0x8940('0x10')]:''},function(_0x55084b,_0x3e0bf5,_0x3e420b,_0x2a9ed2){var _0x2276ab,_0x3aaee5;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x8940('0x11'),_0x8940('0x12')],'raw':!![]})[_0x8940('0x13')](function(_0xd76591){_0x2276ab=_0xd76591;return db[_0x8940('0x14')][_0x8940('0x15')]({'where':{'email':_[_0x8940('0x16')](_0x3e420b['emails'],_0x8940('0x17')),'role':{'$or':[_0x8940('0x18'),_0x8940('0x19'),_0x8940('0x1a')]}}});})[_0x8940('0x13')](function(_0x5455a5){_0x3aaee5=_0x5455a5;if(_0x3aaee5){if(_0x3aaee5[_0x8940('0x1b')]){return _0x2a9ed2('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(_0x2276ab[_0x8940('0x12')]>0x0){if(_0x3aaee5['blocked']){if(moment(_0x3aaee5[_0x8940('0x1c')])[_0x8940('0x1d')](_0x2276ab[_0x8940('0x12')],_0x8940('0x1e'))>moment()){return _0x2a9ed2(_0x8940('0x1f'));}else{return utils[_0x8940('0x20')](_0x3aaee5,0x0,![],null)[_0x8940('0x13')](function(){return utils[_0x8940('0x21')](_0x3aaee5);})[_0x8940('0x13')](function(){return _0x2a9ed2(null,_0x3aaee5);});}}else{return utils[_0x8940('0x21')](_0x3aaee5)[_0x8940('0x13')](function(){return _0x2a9ed2(null,_0x3aaee5);});}}else{return utils[_0x8940('0x21')](_0x3aaee5)[_0x8940('0x13')](function(){return _0x2a9ed2(null,_0x3aaee5);});}}return _0x2a9ed2(_0x8940('0x1f'));})[_0x8940('0x22')](function(_0x562fcb){_0x2a9ed2(_0x562fcb);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index e980a11..20e0e92 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 _0x0dba=['callback','isMiddleware','express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback'];(function(_0x1aed01,_0x3b59f3){var _0x34ccb8=function(_0x1420db){while(--_0x1420db){_0x1aed01['push'](_0x1aed01['shift']());}};_0x34ccb8(++_0x3b59f3);}(_0x0dba,0x136));var _0xa0db=function(_0x38d7b9,_0x85d2f2){_0x38d7b9=_0x38d7b9-0x0;var _0x3e685c=_0x0dba[_0x38d7b9];return _0x3e685c;};'use strict';var express=require(_0xa0db('0x0'));var passport=require(_0xa0db('0x1'));var router=express[_0xa0db('0x2')]();var controller=require(_0xa0db('0x3'));var userController=require(_0xa0db('0x4'));var authService=require(_0xa0db('0x5'));router[_0xa0db('0x6')]('/',controller[_0xa0db('0x7')]);router[_0xa0db('0x6')](_0xa0db('0x8'),controller[_0xa0db('0x9')],authService[_0xa0db('0xa')],userController['login'],authService['setTokenCookie']);module['exports']=router; \ No newline at end of file +var _0x1978=['./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','setTokenCookie','exports','passport','Router'];(function(_0x35dea7,_0x1f7e22){var _0x3ddd9f=function(_0x1cdffd){while(--_0x1cdffd){_0x35dea7['push'](_0x35dea7['shift']());}};_0x3ddd9f(++_0x1f7e22);}(_0x1978,0x174));var _0x8197=function(_0x2ae2bb,_0x47af44){_0x2ae2bb=_0x2ae2bb-0x0;var _0x4912b6=_0x1978[_0x2ae2bb];return _0x4912b6;};'use strict';var express=require('express');var passport=require(_0x8197('0x0'));var router=express[_0x8197('0x1')]();var controller=require(_0x8197('0x2'));var userController=require(_0x8197('0x3'));var authService=require(_0x8197('0x4'));router[_0x8197('0x5')]('/',controller[_0x8197('0x6')]);router[_0x8197('0x5')](_0x8197('0x7'),controller[_0x8197('0x8')],authService['isMiddleware'],userController[_0x8197('0x6')],authService[_0x8197('0x9')]);module[_0x8197('0xa')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 0a0b05a..4ec4c42 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 _0x2cbd=['salt','role','disabled','blocked','blockedAt','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','add','minutes','clearBlockUser','getLicense','MailAccount','find','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','pass','merge','format','\x22%s\x22\x20<%s>','SendMail','error','message','stringify','send','test','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','online','forgot','body','Email\x20parameter\x20is\x20missing','email','trim','toLowerCase','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','resetPasswordExpires','now','save','xCally\x20Motion\x20Password\x20Reset','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','Reset\x20Email\x20sent!','reset','User','params','token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','use','util','passport','passport-local','Strategy','randomstring','../../mysqldb','../../components/auth/service','client','Setting','findOne','allowedLoginAttempts','then','name','password'];(function(_0x52d3f0,_0x5af9a5){var _0x1d80ee=function(_0x38dd86){while(--_0x38dd86){_0x52d3f0['push'](_0x52d3f0['shift']());}};_0x1d80ee(++_0x5af9a5);}(_0x2cbd,0x1ea));var _0xd2cb=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x2cbd[_0xfb42e6];return _0x27265b;};'use strict';var util=require(_0xd2cb('0x0'));var passport=require(_0xd2cb('0x1'));var LocalStrategy=require(_0xd2cb('0x2'))[_0xd2cb('0x3')];var jayson=require('jayson/promise');var _=require('lodash');var rs=require(_0xd2cb('0x4'));var moment=require('moment');var db=require(_0xd2cb('0x5'))['db'];var authService=require(_0xd2cb('0x6'));var utils=require('../../config/utils');var client=jayson[_0xd2cb('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x4ac26f,_0x4f9aac,_0x16ba61,_0x1402d7){var _0x15f8f6,_0x3b253e;return db[_0xd2cb('0x8')][_0xd2cb('0x9')]({'where':{'id':0x1},'attributes':[_0xd2cb('0xa'),'blockDuration'],'raw':!![]})[_0xd2cb('0xb')](function(_0x467637){_0x15f8f6=_0x467637;return _0x4ac26f['findOne']({'attributes':['id',_0xd2cb('0xc'),_0xd2cb('0xd'),_0xd2cb('0xe'),_0xd2cb('0xf'),_0xd2cb('0x10'),_0xd2cb('0x11'),_0xd2cb('0x12'),_0xd2cb('0x13')],'where':{'name':_0x4f9aac,'role':{'$or':[_0xd2cb('0x14'),_0xd2cb('0x15'),'agent']}}});})['then'](function(_0x254ad5){if(!_0x254ad5||_0x254ad5&&_0x254ad5['name']!==_0x4f9aac){throw new Error(_0xd2cb('0x16'));}else{_0x3b253e=_0x254ad5;return _0x3b253e;}})[_0xd2cb('0xb')](function(){_0x3b253e['authenticate'](_0x16ba61,function(_0x5e0042,_0x5b1421){var _0x290366=_0x3b253e[_0xd2cb('0x13')]+0x1;if(_0x5e0042){return _0x1402d7(_0x5e0042);}else if(!_0x5b1421){if(_0x3b253e[_0xd2cb('0x10')]){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}else if(_0x15f8f6[_0xd2cb('0xa')]>0x0){if(_0x3b253e['blocked']){if(_0x15f8f6[_0xd2cb('0x17')]>0x0){if(moment(_0x3b253e[_0xd2cb('0x12')])[_0xd2cb('0x18')](_0x15f8f6[_0xd2cb('0x17')],_0xd2cb('0x19'))>moment()){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}else{return utils[_0xd2cb('0x1a')](_0x3b253e,_0x290366,![],null)[_0xd2cb('0xb')](function(){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});});}}else{return _0x1402d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x290366>=_0x15f8f6[_0xd2cb('0xa')]){return utils[_0xd2cb('0x1a')](_0x3b253e,0x0,!![],moment())[_0xd2cb('0xb')](function(){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});});}else{return utils[_0xd2cb('0x1a')](_0x3b253e,_0x290366,![],null)[_0xd2cb('0xb')](function(){return _0x1402d7(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}}else{if(_0x3b253e[_0xd2cb('0x10')]){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}else if(_0x15f8f6[_0xd2cb('0xa')]>0x0){if(_0x3b253e['blocked']){if(_0x15f8f6[_0xd2cb('0x17')]>0x0){if(moment(_0x3b253e[_0xd2cb('0x12')])[_0xd2cb('0x18')](_0x15f8f6[_0xd2cb('0x17')],_0xd2cb('0x19'))>moment()){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}else{return utils[_0xd2cb('0x1a')](_0x3b253e,0x0,![],null)['then'](function(){return utils['getLicense'](_0x3b253e);})[_0xd2cb('0xb')](function(){return _0x1402d7(null,_0x3b253e);});}}else{return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}}else{return utils[_0xd2cb('0x1a')](_0x3b253e,0x0,![],null)[_0xd2cb('0xb')](function(){return utils[_0xd2cb('0x1b')](_0x3b253e);})[_0xd2cb('0xb')](function(){return _0x1402d7(null,_0x3b253e);})['catch'](function(_0x41d17b){return _0x1402d7(null,![],_0x41d17b);});}}else{if(_0x3b253e[_0xd2cb('0x11')]){return _0x1402d7(null,![],{'message':_0xd2cb('0x16')});}else{return utils[_0xd2cb('0x1b')](_0x3b253e)[_0xd2cb('0xb')](function(){return _0x1402d7(null,_0x3b253e);});}}}});})['catch'](function(_0x60d3e2){return _0x1402d7(null,![],_0x60d3e2);});}function sendServiceMail(_0x1e1994){return db[_0xd2cb('0x1c')][_0xd2cb('0x1d')]({'where':{'service':!![]},'attributes':['id',_0xd2cb('0xc'),'email'],'include':[{'model':db[_0xd2cb('0x1e')],'as':_0xd2cb('0x1f')}]})[_0xd2cb('0xb')](function(_0x1373dd){if(!_0x1373dd){throw new Error(_0xd2cb('0x20'));}var _0x59628a={'tls':{'rejectUnauthorized':![]}};if(_0x1373dd['Smtp'][_0xd2cb('0x21')]){_0x59628a[_0xd2cb('0x21')]=_0x1373dd[_0xd2cb('0x1f')]['service'];}else{_0x59628a[_0xd2cb('0x22')]=_0x1373dd[_0xd2cb('0x1f')]['host'];_0x59628a[_0xd2cb('0x23')]=_0x1373dd[_0xd2cb('0x1f')][_0xd2cb('0x23')];_0x59628a[_0xd2cb('0x24')]=_0x1373dd[_0xd2cb('0x1f')][_0xd2cb('0x24')];}if(_0x1373dd[_0xd2cb('0x1f')][_0xd2cb('0x25')]){_0x59628a['auth']={'user':_0x1373dd[_0xd2cb('0x1f')]['user'],'pass':_0x1373dd[_0xd2cb('0x1f')][_0xd2cb('0x26')]};}var _0xcff14c={'account':_0x59628a,'message':_[_0xd2cb('0x27')]({'from':util[_0xd2cb('0x28')](_0xd2cb('0x29'),_0x1373dd[_0xd2cb('0xc')],_0x1373dd['email']||_0x1373dd[_0xd2cb('0x1f')][_0xd2cb('0x15')])},_0x1e1994)};return client['request'](_0xd2cb('0x2a'),_0xcff14c);})[_0xd2cb('0xb')](function(_0x3f8c94){if(_0x3f8c94[_0xd2cb('0x2b')]){throw new Error(util['format']('SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!',_0x3f8c94[_0xd2cb('0x2b')][_0xd2cb('0x2c')]||JSON[_0xd2cb('0x2d')](_0x3f8c94['error'])));}return!![];});}function handleError(_0x1819fc,_0x3bb279,_0x470588){return _0x1819fc['status'](_0x3bb279||0x1f4)[_0xd2cb('0x2e')]({'message':_0x470588?_0x470588['message']||_0x470588:''});}function checkPasswordPattern(_0x4338b7,_0x6bd622,_0xa6401f){if(_0xa6401f){var _0x2cddd9=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2cddd9[_0xd2cb('0x2f')](_0x6bd622)){return _0x4338b7;}else{throw new Error(_0xd2cb('0x30'));}}else{return _0x4338b7;}}exports[_0xd2cb('0x31')]=function(_0x4451b3,_0x5d2bce,_0x18369a){passport['authenticate'](_0xd2cb('0x32'),function(_0x14ecbd,_0x9e9c9,_0x39964d){var _0x13b020=_0x14ecbd||_0x39964d;if(_0x13b020){return handleError(_0x5d2bce,0x191,_0x13b020);}if(!_0x9e9c9){return handleError(_0x5d2bce,0x194,{'message':_0xd2cb('0x33')});}else{var _0x53017c={'payload':{'id':_0x9e9c9['id'],'role':_0x9e9c9['role']},'options':{'expiresIn':0x15180}};return authService[_0xd2cb('0x34')](_0x53017c)[_0xd2cb('0xb')](function(_0x4fa2bd){_0x5d2bce[_0xd2cb('0x35')]({'id':_0x9e9c9['id'],'token':_0x4fa2bd,'statusCall':'','isAlreadyLogged':_0x9e9c9[_0xd2cb('0x36')]});});}})(_0x4451b3,_0x5d2bce,_0x18369a);};exports[_0xd2cb('0x37')]=function(_0x30f281,_0x5b3ca3,_0x3a96fe){if(!_0x30f281[_0xd2cb('0x38')]['email']){return handleError(_0x5b3ca3,0x1f4,{'message':_0xd2cb('0x39')});}var _0x5788ad=rs['generate']();_0x30f281[_0xd2cb('0x38')][_0xd2cb('0x3a')]=_0x30f281['body'][_0xd2cb('0x3a')][_0xd2cb('0x3b')]()[_0xd2cb('0x3c')]();var _0x3bbb18;return db[_0xd2cb('0x8')][_0xd2cb('0x9')]({'where':{'id':0x1},'attributes':[_0xd2cb('0xa'),_0xd2cb('0x17')],'raw':!![]})[_0xd2cb('0xb')](function(_0x5d6442){_0x3bbb18=_0x5d6442;return db['User'][_0xd2cb('0x1d')]({'where':{'email':_0x30f281['body'][_0xd2cb('0x3a')]}});})[_0xd2cb('0xb')](function(_0x3a4862){if(!_0x3a4862){throw new Error(_0xd2cb('0x3d'));}if(_0x3a4862[_0xd2cb('0x10')]){throw new Error(_0xd2cb('0x3e'));}if(_0x3a4862[_0xd2cb('0x11')]){if(moment(_0x3a4862[_0xd2cb('0x12')])[_0xd2cb('0x18')](_0x3bbb18[_0xd2cb('0x17')],_0xd2cb('0x19'))>moment()){throw new Error(_0xd2cb('0x3f'));}else{_0x3a4862['blocked']=![];_0x3a4862[_0xd2cb('0x12')]=null;}}_0x3a4862[_0xd2cb('0x40')]=_0x5788ad;_0x3a4862[_0xd2cb('0x41')]=Date[_0xd2cb('0x42')]()+0x36ee80;return _0x3a4862[_0xd2cb('0x43')]();})[_0xd2cb('0xb')](function(){return sendServiceMail({'to':_0x30f281[_0xd2cb('0x38')][_0xd2cb('0x3a')],'subject':_0xd2cb('0x44'),'text':_0xd2cb('0x45')+_0xd2cb('0x46')+_0xd2cb('0x47')+_0x30f281[_0xd2cb('0x48')][_0xd2cb('0x22')]+_0xd2cb('0x49')+_0x5788ad+'\x0a\x0a'+_0xd2cb('0x4a')});})[_0xd2cb('0xb')](function(){_0x5b3ca3[_0xd2cb('0x4b')](0xc8)[_0xd2cb('0x2e')]({'message':_0xd2cb('0x4c')});})['catch'](function(_0x2c5d6c){return handleError(_0x5b3ca3,0x1f4,_0x2c5d6c);});};exports[_0xd2cb('0x4d')]=function(_0xc28eaa,_0x260cd5,_0x3f3035){var _0x144bdb;return db[_0xd2cb('0x4e')]['find']({'where':{'resetPasswordToken':_0xc28eaa[_0xd2cb('0x4f')][_0xd2cb('0x50')],'resetPasswordExpires':{'$gt':Date[_0xd2cb('0x42')]()}}})[_0xd2cb('0xb')](function(_0x4ba26a){_0x144bdb=_0x4ba26a;if(!_0x144bdb){throw new Error(_0xd2cb('0x51'));}return db['Setting'][_0xd2cb('0x9')]({'attributes':['id',_0xd2cb('0x52')]});})[_0xd2cb('0xb')](function(_0x462ce6){return checkPasswordPattern(_0x462ce6,_0xc28eaa[_0xd2cb('0x38')]['password'],_0x462ce6[_0xd2cb('0x52')]);})['then'](function(){_0x144bdb[_0xd2cb('0xd')]=_0xc28eaa[_0xd2cb('0x38')][_0xd2cb('0xd')];_0x144bdb[_0xd2cb('0x40')]=null;_0x144bdb['resetPasswordExpires']=null;return _0x144bdb[_0xd2cb('0x43')]();})[_0xd2cb('0xb')](function(){_0x260cd5[_0xd2cb('0x4b')](0xc8)['send']({'message':'Password\x20reset!'});})['catch'](function(_0x1a9467){return handleError(_0x260cd5,0x1f4,_0x1a9467);});};passport[_0xd2cb('0x53')](new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x2cd973,_0x595dc1,_0x1998e2){return localAuthenticate(db[_0xd2cb('0x4e')],_0x2cd973,_0x595dc1,_0x1998e2);})); \ No newline at end of file +var _0xd671=['format','\x22%s\x22\x20<%s>','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','Email\x20parameter\x20is\x20missing','generate','body','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','http://','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','Reset\x20Email\x20sent!','reset','params','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','Setting','securePassword','save','Password\x20reset!','use','util','passport','passport-local','lodash','moment','../../mysqldb','../../components/auth/service','client','http','allowedLoginAttempts','blockDuration','then','findOne','password','salt','role','blocked','blockedAt','loginAttempts','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','add','minutes','clearBlockUser','getLicense','catch','MailAccount','find','name','email','MailServerOut','Smtp','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','service','host','port','secure','authentication','auth','pass','merge'];(function(_0x365a69,_0x78f175){var _0x604e13=function(_0x25c9e4){while(--_0x25c9e4){_0x365a69['push'](_0x365a69['shift']());}};_0x604e13(++_0x78f175);}(_0xd671,0x172));var _0x1d67=function(_0x3ab687,_0x2f3a18){_0x3ab687=_0x3ab687-0x0;var _0x512596=_0xd671[_0x3ab687];return _0x512596;};'use strict';var util=require(_0x1d67('0x0'));var passport=require(_0x1d67('0x1'));var LocalStrategy=require(_0x1d67('0x2'))['Strategy'];var jayson=require('jayson/promise');var _=require(_0x1d67('0x3'));var rs=require('randomstring');var moment=require(_0x1d67('0x4'));var db=require(_0x1d67('0x5'))['db'];var authService=require(_0x1d67('0x6'));var utils=require('../../config/utils');var client=jayson[_0x1d67('0x7')][_0x1d67('0x8')]({'port':0x232b});function localAuthenticate(_0x226100,_0x3568e6,_0x2b7229,_0x525169){var _0x3f5f95,_0x34512d;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x1d67('0x9'),_0x1d67('0xa')],'raw':!![]})[_0x1d67('0xb')](function(_0x195fd5){_0x3f5f95=_0x195fd5;return _0x226100[_0x1d67('0xc')]({'attributes':['id','name',_0x1d67('0xd'),_0x1d67('0xe'),_0x1d67('0xf'),'disabled',_0x1d67('0x10'),_0x1d67('0x11'),_0x1d67('0x12')],'where':{'name':_0x3568e6,'role':{'$or':[_0x1d67('0x13'),_0x1d67('0x14'),_0x1d67('0x15')]}}});})[_0x1d67('0xb')](function(_0x712ab2){if(!_0x712ab2||_0x712ab2&&_0x712ab2['name']!==_0x3568e6){throw new Error(_0x1d67('0x16'));}else{_0x34512d=_0x712ab2;return _0x34512d;}})['then'](function(){_0x34512d[_0x1d67('0x17')](_0x2b7229,function(_0x2b1187,_0x57e815){var _0x339fcc=_0x34512d[_0x1d67('0x12')]+0x1;if(_0x2b1187){return _0x525169(_0x2b1187);}else if(!_0x57e815){if(_0x34512d[_0x1d67('0x18')]){return _0x525169(null,![],{'message':_0x1d67('0x16')});}else if(_0x3f5f95[_0x1d67('0x9')]>0x0){if(_0x34512d['blocked']){if(_0x3f5f95[_0x1d67('0xa')]>0x0){if(moment(_0x34512d[_0x1d67('0x11')])[_0x1d67('0x19')](_0x3f5f95[_0x1d67('0xa')],_0x1d67('0x1a'))>moment()){return _0x525169(null,![],{'message':_0x1d67('0x16')});}else{return utils[_0x1d67('0x1b')](_0x34512d,_0x339fcc,![],null)[_0x1d67('0xb')](function(){return _0x525169(null,![],{'message':_0x1d67('0x16')});});}}else{return _0x525169(null,![],{'message':_0x1d67('0x16')});}}else{if(_0x339fcc>=_0x3f5f95[_0x1d67('0x9')]){return utils[_0x1d67('0x1b')](_0x34512d,0x0,!![],moment())['then'](function(){return _0x525169(null,![],{'message':_0x1d67('0x16')});});}else{return utils['clearBlockUser'](_0x34512d,_0x339fcc,![],null)['then'](function(){return _0x525169(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x525169(null,![],{'message':_0x1d67('0x16')});}}else{if(_0x34512d[_0x1d67('0x18')]){return _0x525169(null,![],{'message':_0x1d67('0x16')});}else if(_0x3f5f95['allowedLoginAttempts']>0x0){if(_0x34512d['blocked']){if(_0x3f5f95[_0x1d67('0xa')]>0x0){if(moment(_0x34512d[_0x1d67('0x11')])[_0x1d67('0x19')](_0x3f5f95[_0x1d67('0xa')],_0x1d67('0x1a'))>moment()){return _0x525169(null,![],{'message':_0x1d67('0x16')});}else{return utils[_0x1d67('0x1b')](_0x34512d,0x0,![],null)[_0x1d67('0xb')](function(){return utils[_0x1d67('0x1c')](_0x34512d);})[_0x1d67('0xb')](function(){return _0x525169(null,_0x34512d);});}}else{return _0x525169(null,![],{'message':_0x1d67('0x16')});}}else{return utils[_0x1d67('0x1b')](_0x34512d,0x0,![],null)[_0x1d67('0xb')](function(){return utils[_0x1d67('0x1c')](_0x34512d);})[_0x1d67('0xb')](function(){return _0x525169(null,_0x34512d);})[_0x1d67('0x1d')](function(_0x19f767){return _0x525169(null,![],_0x19f767);});}}else{if(_0x34512d['blocked']){return _0x525169(null,![],{'message':_0x1d67('0x16')});}else{return utils['getLicense'](_0x34512d)[_0x1d67('0xb')](function(){return _0x525169(null,_0x34512d);});}}}});})[_0x1d67('0x1d')](function(_0x24fb6b){return _0x525169(null,![],_0x24fb6b);});}function sendServiceMail(_0x5267ab){return db[_0x1d67('0x1e')][_0x1d67('0x1f')]({'where':{'service':!![]},'attributes':['id',_0x1d67('0x20'),_0x1d67('0x21')],'include':[{'model':db[_0x1d67('0x22')],'as':_0x1d67('0x23')}]})['then'](function(_0x3b932b){if(!_0x3b932b){throw new Error(_0x1d67('0x24'));}var _0x3d1613={'tls':{'rejectUnauthorized':![]}};if(_0x3b932b[_0x1d67('0x23')]['service']){_0x3d1613['service']=_0x3b932b[_0x1d67('0x23')][_0x1d67('0x25')];}else{_0x3d1613[_0x1d67('0x26')]=_0x3b932b[_0x1d67('0x23')]['host'];_0x3d1613[_0x1d67('0x27')]=_0x3b932b[_0x1d67('0x23')][_0x1d67('0x27')];_0x3d1613[_0x1d67('0x28')]=_0x3b932b['Smtp'][_0x1d67('0x28')];}if(_0x3b932b[_0x1d67('0x23')][_0x1d67('0x29')]){_0x3d1613[_0x1d67('0x2a')]={'user':_0x3b932b[_0x1d67('0x23')]['user'],'pass':_0x3b932b[_0x1d67('0x23')][_0x1d67('0x2b')]};}var _0x153787={'account':_0x3d1613,'message':_[_0x1d67('0x2c')]({'from':util[_0x1d67('0x2d')](_0x1d67('0x2e'),_0x3b932b['name'],_0x3b932b[_0x1d67('0x21')]||_0x3b932b[_0x1d67('0x23')]['user'])},_0x5267ab)};return client['request'](_0x1d67('0x2f'),_0x153787);})[_0x1d67('0xb')](function(_0x592f7c){if(_0x592f7c[_0x1d67('0x30')]){throw new Error(util['format'](_0x1d67('0x31'),_0x592f7c['error'][_0x1d67('0x32')]||JSON['stringify'](_0x592f7c[_0x1d67('0x30')])));}return!![];});}function handleError(_0x3519d6,_0x6bbbbe,_0xb6a46d){return _0x3519d6[_0x1d67('0x33')](_0x6bbbbe||0x1f4)[_0x1d67('0x34')]({'message':_0xb6a46d?_0xb6a46d[_0x1d67('0x32')]||_0xb6a46d:''});}function checkPasswordPattern(_0x7d2740,_0x3cd9c6,_0x19ee10){if(_0x19ee10){var _0x20c063=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20c063['test'](_0x3cd9c6)){return _0x7d2740;}else{throw new Error(_0x1d67('0x35'));}}else{return _0x7d2740;}}exports[_0x1d67('0x36')]=function(_0x7a99c3,_0x42daf2,_0x5b9067){passport[_0x1d67('0x17')](_0x1d67('0x37'),function(_0x55f758,_0xa69727,_0x515a12){var _0x5f3715=_0x55f758||_0x515a12;if(_0x5f3715){return handleError(_0x42daf2,0x191,_0x5f3715);}if(!_0xa69727){return handleError(_0x42daf2,0x194,{'message':_0x1d67('0x38')});}else{var _0x5295b8={'payload':{'id':_0xa69727['id'],'role':_0xa69727['role']},'options':{'expiresIn':0x15180}};return authService[_0x1d67('0x39')](_0x5295b8)[_0x1d67('0xb')](function(_0x102fe7){_0x42daf2['json']({'id':_0xa69727['id'],'token':_0x102fe7,'statusCall':'','isAlreadyLogged':_0xa69727[_0x1d67('0x3a')]});});}})(_0x7a99c3,_0x42daf2,_0x5b9067);};exports['forgot']=function(_0x2922a2,_0x158340,_0x2257c0){if(!_0x2922a2['body'][_0x1d67('0x21')]){return handleError(_0x158340,0x1f4,{'message':_0x1d67('0x3b')});}var _0xf6cbbe=rs[_0x1d67('0x3c')]();_0x2922a2['body'][_0x1d67('0x21')]=_0x2922a2[_0x1d67('0x3d')][_0x1d67('0x21')]['trim']()['toLowerCase']();var _0x5c0f9e;return db['Setting'][_0x1d67('0xc')]({'where':{'id':0x1},'attributes':[_0x1d67('0x9'),_0x1d67('0xa')],'raw':!![]})['then'](function(_0x1960b4){_0x5c0f9e=_0x1960b4;return db[_0x1d67('0x3e')]['find']({'where':{'email':_0x2922a2['body'][_0x1d67('0x21')]}});})[_0x1d67('0xb')](function(_0x35df67){if(!_0x35df67){throw new Error(_0x1d67('0x3f'));}if(_0x35df67['disabled']){throw new Error(_0x1d67('0x40'));}if(_0x35df67['blocked']){if(moment(_0x35df67[_0x1d67('0x11')])[_0x1d67('0x19')](_0x5c0f9e['blockDuration'],'minutes')>moment()){throw new Error(_0x1d67('0x41'));}else{_0x35df67[_0x1d67('0x10')]=![];_0x35df67[_0x1d67('0x11')]=null;}}_0x35df67[_0x1d67('0x42')]=_0xf6cbbe;_0x35df67['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x35df67['save']();})[_0x1d67('0xb')](function(){return sendServiceMail({'to':_0x2922a2[_0x1d67('0x3d')][_0x1d67('0x21')],'subject':'xCally\x20Motion\x20Password\x20Reset','text':_0x1d67('0x43')+_0x1d67('0x44')+_0x1d67('0x45')+_0x2922a2[_0x1d67('0x46')][_0x1d67('0x26')]+_0x1d67('0x47')+_0xf6cbbe+'\x0a\x0a'+_0x1d67('0x48')});})['then'](function(){_0x158340[_0x1d67('0x33')](0xc8)['send']({'message':_0x1d67('0x49')});})['catch'](function(_0xeed854){return handleError(_0x158340,0x1f4,_0xeed854);});};exports[_0x1d67('0x4a')]=function(_0x3cf3ce,_0x2ba679,_0x4e0845){var _0x2ecb4e;return db[_0x1d67('0x3e')]['find']({'where':{'resetPasswordToken':_0x3cf3ce[_0x1d67('0x4b')]['token'],'resetPasswordExpires':{'$gt':Date[_0x1d67('0x4c')]()}}})['then'](function(_0x323216){_0x2ecb4e=_0x323216;if(!_0x2ecb4e){throw new Error(_0x1d67('0x4d'));}return db[_0x1d67('0x4e')]['findOne']({'attributes':['id',_0x1d67('0x4f')]});})[_0x1d67('0xb')](function(_0x84f484){return checkPasswordPattern(_0x84f484,_0x3cf3ce[_0x1d67('0x3d')][_0x1d67('0xd')],_0x84f484[_0x1d67('0x4f')]);})[_0x1d67('0xb')](function(){_0x2ecb4e[_0x1d67('0xd')]=_0x3cf3ce['body']['password'];_0x2ecb4e[_0x1d67('0x42')]=null;_0x2ecb4e['resetPasswordExpires']=null;return _0x2ecb4e[_0x1d67('0x50')]();})[_0x1d67('0xb')](function(){_0x2ba679[_0x1d67('0x33')](0xc8)[_0x1d67('0x34')]({'message':_0x1d67('0x51')});})['catch'](function(_0x3c34d8){return handleError(_0x2ba679,0x1f4,_0x3c34d8);});};passport[_0x1d67('0x52')](new LocalStrategy({'usernameField':'name','passwordField':_0x1d67('0xd')},function(_0x52475c,_0xa80d7d,_0x5113fc){return localAuthenticate(db[_0x1d67('0x3e')],_0x52475c,_0xa80d7d,_0x5113fc);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 4cf9b0d..1b59de4 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 _0xd631=['forgot','/reset/:token','reset','express','Router','login','post','/forgot'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xd631,0x183));var _0x1d63=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xd631[_0x318840];return _0x223da4;};'use strict';var express=require(_0x1d63('0x0'));var router=express[_0x1d63('0x1')]();var controller=require('./authLocal.controller');router['post']('/',controller[_0x1d63('0x2')]);router[_0x1d63('0x3')](_0x1d63('0x4'),controller[_0x1d63('0x5')]);router[_0x1d63('0x3')](_0x1d63('0x6'),controller[_0x1d63('0x7')]);module['exports']=router; \ No newline at end of file +var _0xe803=['/reset/:token','reset','exports','express','Router','post','login','/forgot'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe803,0xa3));var _0x3e80=function(_0x126249,_0xca0ba2){_0x126249=_0x126249-0x0;var _0x212ab6=_0xe803[_0x126249];return _0x212ab6;};'use strict';var express=require(_0x3e80('0x0'));var router=express[_0x3e80('0x1')]();var controller=require('./authLocal.controller');router[_0x3e80('0x2')]('/',controller[_0x3e80('0x3')]);router[_0x3e80('0x2')](_0x3e80('0x4'),controller['forgot']);router[_0x3e80('0x2')](_0x3e80('0x5'),controller[_0x3e80('0x6')]);module[_0x3e80('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 7b798bf..46ecff6 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 _0xe699=['STRING','INTEGER','exports'];(function(_0x295b1a,_0x1e31a){var _0x2bb42b=function(_0xc27b30){while(--_0xc27b30){_0x295b1a['push'](_0x295b1a['shift']());}};_0x2bb42b(++_0x1e31a);}(_0xe699,0x8c));var _0x9e69=function(_0x44fb9b,_0x19760f){_0x44fb9b=_0x44fb9b-0x0;var _0x3e592b=_0xe699[_0x44fb9b];return _0x3e592b;};'use strict';var Sequelize=require('sequelize');module[_0x9e69('0x0')]={'name':{'type':Sequelize[_0x9e69('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x9e69('0x1')]},'description':{'type':Sequelize[_0x9e69('0x1')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9e69('0x2')],'defaultValue':0xa}}; \ No newline at end of file +var _0x9d9b=['sequelize','exports','STRING','INTEGER'];(function(_0x313452,_0x5ea1f2){var _0x16c93e=function(_0x2f2950){while(--_0x2f2950){_0x313452['push'](_0x313452['shift']());}};_0x16c93e(++_0x5ea1f2);}(_0x9d9b,0x18c));var _0xb9d9=function(_0xfb6fd1,_0x1429d4){_0xfb6fd1=_0xfb6fd1-0x0;var _0x167516=_0x9d9b[_0xfb6fd1];return _0x167516;};'use strict';var Sequelize=require(_0xb9d9('0x0'));module[_0xb9d9('0x1')]={'name':{'type':Sequelize[_0xb9d9('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0xb9d9('0x2')]},'description':{'type':Sequelize[_0xb9d9('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timeout':{'type':Sequelize[_0xb9d9('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 3aecbf5..734d4ee 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 _0x6eef=['save','update','then','error','name','send','map','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','filters','pick','filter','where','VIRTUAL','merge','options','Automation','include','findAll','rows','catch','show','params','includeAll','body','find','destroy','addConditions','Condition','omit','ids','getConditions','nolimit','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range','apply','reject'];(function(_0x466bfa,_0x25ea55){var _0x37e0b1=function(_0x2a8f2b){while(--_0x2a8f2b){_0x466bfa['push'](_0x466bfa['shift']());}};_0x37e0b1(++_0x25ea55);}(_0x6eef,0x1bb));var _0xf6ee=function(_0x1b745b,_0x3e2d40){_0x1b745b=_0x1b745b-0x0;var _0x120a9d=_0x6eef[_0x1b745b];return _0x120a9d;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf6ee('0x0'));var rimraf=require(_0xf6ee('0x1'));var zipdir=require(_0xf6ee('0x2'));var jsonpatch=require(_0xf6ee('0x3'));var rp=require(_0xf6ee('0x4'));var moment=require(_0xf6ee('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xf6ee('0x6'));var sox=require(_0xf6ee('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf6ee('0x8'));var squel=require(_0xf6ee('0x9'));var crypto=require(_0xf6ee('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf6ee('0xb'));var toCsv=require(_0xf6ee('0xc'));var querystring=require(_0xf6ee('0xd'));var Papa=require(_0xf6ee('0xe'));var Redis=require(_0xf6ee('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf6ee('0x10'));var hardwareService=require(_0xf6ee('0x11'));var logger=require(_0xf6ee('0x12'))(_0xf6ee('0x13'));var utils=require('../../config/utils');var config=require(_0xf6ee('0x14'));var db=require(_0xf6ee('0x15'))['db'];function respondWithStatusCode(_0x1d3468,_0x457f67){_0x457f67=_0x457f67||0xcc;return function(_0xd3a1a7){if(_0xd3a1a7){return _0x1d3468[_0xf6ee('0x16')](_0x457f67);}return _0x1d3468[_0xf6ee('0x17')](_0x457f67)[_0xf6ee('0x18')]();};}function respondWithResult(_0x3f04e7,_0x170d3e){_0x170d3e=_0x170d3e||0xc8;return function(_0x44e1a3){if(_0x44e1a3){return _0x3f04e7[_0xf6ee('0x17')](_0x170d3e)[_0xf6ee('0x19')](_0x44e1a3);}};}function respondWithFilteredResult(_0x4991fa,_0x24f77d){return function(_0x24890a){if(_0x24890a){var _0x1fb4bb=_0x24890a[_0xf6ee('0x1a')],_0x4578dd=_0x24f77d[_0xf6ee('0x1b')],_0x8386ca=_0x24f77d['offset']+_0x24f77d['limit'],_0x565de3;if(_0x8386ca>=_0x1fb4bb){_0x8386ca=_0x1fb4bb;_0x565de3=0xc8;}else{_0x565de3=0xce;}_0x4991fa[_0xf6ee('0x17')](_0x565de3);return _0x4991fa['set'](_0xf6ee('0x1c'),_0x4578dd+'-'+_0x8386ca+'/'+_0x1fb4bb)[_0xf6ee('0x19')](_0x24890a);}return null;};}function patchUpdates(_0xc63f3){return function(_0x25f0fd){try{jsonpatch[_0xf6ee('0x1d')](_0x25f0fd,_0xc63f3,!![]);}catch(_0x1dc46c){return BPromise[_0xf6ee('0x1e')](_0x1dc46c);}return _0x25f0fd[_0xf6ee('0x1f')]();};}function saveUpdates(_0x3577d6,_0x48b7fa){return function(_0x157726){if(_0x157726){return _0x157726[_0xf6ee('0x20')](_0x3577d6)[_0xf6ee('0x21')](function(_0x19871d){return _0x19871d;});}return null;};}function removeEntity(_0x296994,_0x57ab09){return function(_0x356d99){if(_0x356d99){return _0x356d99['destroy']()['then'](function(){_0x296994[_0xf6ee('0x17')](0xcc)[_0xf6ee('0x18')]();});}};}function handleEntityNotFound(_0xe427e,_0x1079d3){return function(_0x1c0874){if(!_0x1c0874){_0xe427e[_0xf6ee('0x16')](0x194);}return _0x1c0874;};}function handleError(_0x4a58a5,_0x2f90c6){_0x2f90c6=_0x2f90c6||0x1f4;return function(_0x208cc0){logger[_0xf6ee('0x22')](_0x208cc0['stack']);if(_0x208cc0[_0xf6ee('0x23')]){delete _0x208cc0[_0xf6ee('0x23')];}_0x4a58a5['status'](_0x2f90c6)[_0xf6ee('0x24')](_0x208cc0);};}exports['index']=function(_0x1faaa3,_0x531547){var _0x4ec38b={},_0x16e2c4={},_0x382a40={'count':0x0,'rows':[]};var _0x3238eb=_[_0xf6ee('0x25')](db['Automation'][_0xf6ee('0x26')],function(_0x2fa66a){return{'name':_0x2fa66a[_0xf6ee('0x27')],'type':_0x2fa66a[_0xf6ee('0x28')]['key']};});_0x16e2c4[_0xf6ee('0x29')]=_[_0xf6ee('0x25')](_0x3238eb,'name');_0x16e2c4['query']=_[_0xf6ee('0x2a')](_0x1faaa3[_0xf6ee('0x2b')]);_0x16e2c4['filters']=_[_0xf6ee('0x2c')](_0x16e2c4['model'],_0x16e2c4[_0xf6ee('0x2b')]);_0x4ec38b[_0xf6ee('0x2d')]=_[_0xf6ee('0x2c')](_0x16e2c4['model'],qs[_0xf6ee('0x2e')](_0x1faaa3[_0xf6ee('0x2b')][_0xf6ee('0x2e')]));_0x4ec38b[_0xf6ee('0x2d')]=_0x4ec38b[_0xf6ee('0x2d')][_0xf6ee('0x2f')]?_0x4ec38b[_0xf6ee('0x2d')]:_0x16e2c4[_0xf6ee('0x29')];if(!_0x1faaa3[_0xf6ee('0x2b')][_0xf6ee('0x30')]('nolimit')){_0x4ec38b[_0xf6ee('0x31')]=qs[_0xf6ee('0x31')](_0x1faaa3[_0xf6ee('0x2b')]['limit']);_0x4ec38b['offset']=qs[_0xf6ee('0x1b')](_0x1faaa3[_0xf6ee('0x2b')][_0xf6ee('0x1b')]);}_0x4ec38b[_0xf6ee('0x32')]=qs[_0xf6ee('0x33')](_0x1faaa3[_0xf6ee('0x2b')]['sort']);_0x4ec38b['where']=qs[_0xf6ee('0x34')](_[_0xf6ee('0x35')](_0x1faaa3[_0xf6ee('0x2b')],_0x16e2c4['filters']));if(_0x1faaa3[_0xf6ee('0x2b')][_0xf6ee('0x36')]){_0x4ec38b[_0xf6ee('0x37')]=_['merge'](_0x4ec38b[_0xf6ee('0x37')],{'$or':_[_0xf6ee('0x25')](_0x3238eb,function(_0x59ef85){if(_0x59ef85[_0xf6ee('0x28')]!==_0xf6ee('0x38')){var _0x4b083f={};_0x4b083f[_0x59ef85['name']]={'$like':'%'+_0x1faaa3['query'][_0xf6ee('0x36')]+'%'};return _0x4b083f;}})});}_0x4ec38b=_[_0xf6ee('0x39')]({},_0x4ec38b,_0x1faaa3[_0xf6ee('0x3a')]);var _0x5ea698={'where':_0x4ec38b[_0xf6ee('0x37')]};return db[_0xf6ee('0x3b')]['count'](_0x5ea698)[_0xf6ee('0x21')](function(_0x36b0dc){_0x382a40[_0xf6ee('0x1a')]=_0x36b0dc;if(_0x1faaa3[_0xf6ee('0x2b')]['includeAll']){_0x4ec38b[_0xf6ee('0x3c')]=[{'all':!![]}];}return db['Automation'][_0xf6ee('0x3d')](_0x4ec38b);})[_0xf6ee('0x21')](function(_0x4f53db){_0x382a40[_0xf6ee('0x3e')]=_0x4f53db;return _0x382a40;})[_0xf6ee('0x21')](respondWithFilteredResult(_0x531547,_0x4ec38b))[_0xf6ee('0x3f')](handleError(_0x531547,null));};exports[_0xf6ee('0x40')]=function(_0x227be5,_0x5395b4){var _0x57d543={'raw':![],'where':{'id':_0x227be5[_0xf6ee('0x41')]['id']}},_0x5e30eb={};_0x5e30eb[_0xf6ee('0x29')]=_[_0xf6ee('0x2a')](db[_0xf6ee('0x3b')][_0xf6ee('0x26')]);_0x5e30eb[_0xf6ee('0x2b')]=_[_0xf6ee('0x2a')](_0x227be5[_0xf6ee('0x2b')]);_0x5e30eb['filters']=_[_0xf6ee('0x2c')](_0x5e30eb[_0xf6ee('0x29')],_0x5e30eb[_0xf6ee('0x2b')]);_0x57d543[_0xf6ee('0x2d')]=_['intersection'](_0x5e30eb[_0xf6ee('0x29')],qs[_0xf6ee('0x2e')](_0x227be5[_0xf6ee('0x2b')][_0xf6ee('0x2e')]));_0x57d543[_0xf6ee('0x2d')]=_0x57d543[_0xf6ee('0x2d')][_0xf6ee('0x2f')]?_0x57d543[_0xf6ee('0x2d')]:_0x5e30eb[_0xf6ee('0x29')];if(_0x227be5[_0xf6ee('0x2b')][_0xf6ee('0x42')]){_0x57d543['include']=[{'all':!![]}];}_0x57d543=_[_0xf6ee('0x39')]({},_0x57d543,_0x227be5[_0xf6ee('0x3a')]);return db[_0xf6ee('0x3b')]['find'](_0x57d543)[_0xf6ee('0x21')](handleEntityNotFound(_0x5395b4,null))['then'](respondWithResult(_0x5395b4,null))[_0xf6ee('0x3f')](handleError(_0x5395b4,null));};exports['create']=function(_0x4b624d,_0x4f57f9){return db[_0xf6ee('0x3b')]['create'](_0x4b624d[_0xf6ee('0x43')],{})[_0xf6ee('0x21')](respondWithResult(_0x4f57f9,0xc9))[_0xf6ee('0x3f')](handleError(_0x4f57f9,null));};exports['update']=function(_0x4a7d1b,_0x2c3845){if(_0x4a7d1b[_0xf6ee('0x43')]['id']){delete _0x4a7d1b[_0xf6ee('0x43')]['id'];}return db[_0xf6ee('0x3b')][_0xf6ee('0x44')]({'where':{'id':_0x4a7d1b[_0xf6ee('0x41')]['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x2c3845,null))[_0xf6ee('0x21')](saveUpdates(_0x4a7d1b[_0xf6ee('0x43')],null))[_0xf6ee('0x21')](respondWithResult(_0x2c3845,null))[_0xf6ee('0x3f')](handleError(_0x2c3845,null));};exports[_0xf6ee('0x45')]=function(_0xe5864c,_0x28c25a){return db[_0xf6ee('0x3b')][_0xf6ee('0x44')]({'where':{'id':_0xe5864c['params']['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x28c25a,null))[_0xf6ee('0x21')](removeEntity(_0x28c25a,null))[_0xf6ee('0x3f')](handleError(_0x28c25a,null));};exports[_0xf6ee('0x46')]=function(_0x20c8df,_0x125401,_0xa4fe4c){return db[_0xf6ee('0x47')][_0xf6ee('0x44')]({'where':{'id':_0x20c8df['params']['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x125401,null))[_0xf6ee('0x21')](function(_0x2eadae){if(_0x2eadae){return _0x2eadae['addConditions'](_0x20c8df[_0xf6ee('0x43')]['ids'],_[_0xf6ee('0x48')](_0x20c8df[_0xf6ee('0x43')],[_0xf6ee('0x49'),'id'])||{});}})[_0xf6ee('0x21')](respondWithResult(_0x125401,null))[_0xf6ee('0x3f')](handleError(_0x125401,null));};exports[_0xf6ee('0x4a')]=function(_0x3a4172,_0x3bdaeb,_0x5f5d13){var _0x54ab0d={};var _0x293e3f={};var _0x1766c4;var _0x5e937f;return db[_0xf6ee('0x3b')]['findOne']({'where':{'id':_0x3a4172[_0xf6ee('0x41')]['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x3bdaeb,null))[_0xf6ee('0x21')](function(_0x2a63d9){if(_0x2a63d9){_0x1766c4=_0x2a63d9;_0x293e3f[_0xf6ee('0x29')]=_[_0xf6ee('0x2a')](db[_0xf6ee('0x47')][_0xf6ee('0x26')]);_0x293e3f[_0xf6ee('0x2b')]=_[_0xf6ee('0x2a')](_0x3a4172[_0xf6ee('0x2b')]);_0x293e3f[_0xf6ee('0x34')]=_[_0xf6ee('0x2c')](_0x293e3f[_0xf6ee('0x29')],_0x293e3f[_0xf6ee('0x2b')]);_0x54ab0d[_0xf6ee('0x2d')]=_[_0xf6ee('0x2c')](_0x293e3f[_0xf6ee('0x29')],qs[_0xf6ee('0x2e')](_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x2e')]));_0x54ab0d[_0xf6ee('0x2d')]=_0x54ab0d[_0xf6ee('0x2d')][_0xf6ee('0x2f')]?_0x54ab0d[_0xf6ee('0x2d')]:_0x293e3f['model'];_0x54ab0d[_0xf6ee('0x32')]=qs[_0xf6ee('0x33')](_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x33')]);_0x54ab0d['where']=qs[_0xf6ee('0x34')](_[_0xf6ee('0x35')](_0x3a4172[_0xf6ee('0x2b')],_0x293e3f[_0xf6ee('0x34')]));if(_0x3a4172[_0xf6ee('0x2b')]['filter']){_0x54ab0d['where']=_[_0xf6ee('0x39')](_0x54ab0d[_0xf6ee('0x37')],{'$or':_[_0xf6ee('0x25')](_0x54ab0d[_0xf6ee('0x2d')],function(_0x506e01){var _0x3e3db9={};_0x3e3db9[_0x506e01]={'$like':'%'+_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x36')]+'%'};return _0x3e3db9;})});}_0x54ab0d=_[_0xf6ee('0x39')]({},_0x54ab0d,_0x3a4172['options']);return _0x1766c4[_0xf6ee('0x4a')](_0x54ab0d);}})['then'](function(_0x4d58e2){if(_0x4d58e2){_0x5e937f=_0x4d58e2[_0xf6ee('0x2f')];if(!_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x30')](_0xf6ee('0x4b'))){_0x54ab0d[_0xf6ee('0x31')]=qs['limit'](_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x31')]);_0x54ab0d[_0xf6ee('0x1b')]=qs[_0xf6ee('0x1b')](_0x3a4172[_0xf6ee('0x2b')][_0xf6ee('0x1b')]);}return _0x1766c4[_0xf6ee('0x4a')](_0x54ab0d);}})[_0xf6ee('0x21')](function(_0x4fa8ac){if(_0x4fa8ac){return _0x4fa8ac?{'count':_0x5e937f,'rows':_0x4fa8ac}:null;}})[_0xf6ee('0x21')](respondWithResult(_0x3bdaeb,null))[_0xf6ee('0x3f')](handleError(_0x3bdaeb,null));};exports[_0xf6ee('0x4c')]=function(_0x192df1,_0x49449e,_0x3d2723){return db['Action'][_0xf6ee('0x44')]({'where':{'id':_0x192df1[_0xf6ee('0x41')]['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x49449e,null))['then'](function(_0x2ae5f6){if(_0x2ae5f6){return _0x2ae5f6['addActions'](_0x192df1[_0xf6ee('0x43')]['ids'],_[_0xf6ee('0x48')](_0x192df1[_0xf6ee('0x43')],[_0xf6ee('0x49'),'id'])||{});}})[_0xf6ee('0x21')](respondWithResult(_0x49449e,null))[_0xf6ee('0x3f')](handleError(_0x49449e,null));};exports[_0xf6ee('0x4d')]=function(_0x49f66f,_0x1bfe57,_0x37b887){var _0x19c1eb={};var _0x11f8d2={};var _0x58c9e4;var _0x583a26;return db[_0xf6ee('0x3b')]['findOne']({'where':{'id':_0x49f66f[_0xf6ee('0x41')]['id']}})[_0xf6ee('0x21')](handleEntityNotFound(_0x1bfe57,null))[_0xf6ee('0x21')](function(_0x315f4e){if(_0x315f4e){_0x58c9e4=_0x315f4e;_0x11f8d2[_0xf6ee('0x29')]=_[_0xf6ee('0x2a')](db[_0xf6ee('0x4e')][_0xf6ee('0x26')]);_0x11f8d2['query']=_[_0xf6ee('0x2a')](_0x49f66f[_0xf6ee('0x2b')]);_0x11f8d2[_0xf6ee('0x34')]=_[_0xf6ee('0x2c')](_0x11f8d2['model'],_0x11f8d2['query']);_0x19c1eb['attributes']=_[_0xf6ee('0x2c')](_0x11f8d2[_0xf6ee('0x29')],qs['fields'](_0x49f66f[_0xf6ee('0x2b')][_0xf6ee('0x2e')]));_0x19c1eb[_0xf6ee('0x2d')]=_0x19c1eb[_0xf6ee('0x2d')]['length']?_0x19c1eb[_0xf6ee('0x2d')]:_0x11f8d2[_0xf6ee('0x29')];_0x19c1eb['order']=qs['sort'](_0x49f66f['query'][_0xf6ee('0x33')]);_0x19c1eb[_0xf6ee('0x37')]=qs[_0xf6ee('0x34')](_[_0xf6ee('0x35')](_0x49f66f[_0xf6ee('0x2b')],_0x11f8d2[_0xf6ee('0x34')]));if(_0x49f66f['query'][_0xf6ee('0x36')]){_0x19c1eb[_0xf6ee('0x37')]=_['merge'](_0x19c1eb[_0xf6ee('0x37')],{'$or':_[_0xf6ee('0x25')](_0x19c1eb[_0xf6ee('0x2d')],function(_0x492769){var _0x450c74={};_0x450c74[_0x492769]={'$like':'%'+_0x49f66f[_0xf6ee('0x2b')][_0xf6ee('0x36')]+'%'};return _0x450c74;})});}_0x19c1eb=_[_0xf6ee('0x39')]({},_0x19c1eb,_0x49f66f['options']);return _0x58c9e4[_0xf6ee('0x4d')](_0x19c1eb);}})['then'](function(_0x2b137a){if(_0x2b137a){_0x583a26=_0x2b137a[_0xf6ee('0x2f')];if(!_0x49f66f['query'][_0xf6ee('0x30')](_0xf6ee('0x4b'))){_0x19c1eb[_0xf6ee('0x31')]=qs[_0xf6ee('0x31')](_0x49f66f[_0xf6ee('0x2b')][_0xf6ee('0x31')]);_0x19c1eb['offset']=qs[_0xf6ee('0x1b')](_0x49f66f[_0xf6ee('0x2b')][_0xf6ee('0x1b')]);}return _0x58c9e4[_0xf6ee('0x4d')](_0x19c1eb);}})['then'](function(_0x23aa7b){if(_0x23aa7b){return _0x23aa7b?{'count':_0x583a26,'rows':_0x23aa7b}:null;}})[_0xf6ee('0x21')](respondWithResult(_0x1bfe57,null))[_0xf6ee('0x3f')](handleError(_0x1bfe57,null));}; \ No newline at end of file +var _0x1ba2=['error','stack','index','map','Automation','type','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','options','include','catch','show','params','rawAttributes','includeAll','merge','find','create','body','destroy','addConditions','Condition','ids','omit','getConditions','addActions','Action','getActions','html-pdf','eml-format','fast-json-patch','request-promise','bluebird','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','sendStatus','status','end','json','count','offset','limit','Content-Range','apply','reject','save','update','then'];(function(_0x223b71,_0x597bfb){var _0x4131e4=function(_0x411d23){while(--_0x411d23){_0x223b71['push'](_0x223b71['shift']());}};_0x4131e4(++_0x597bfb);}(_0x1ba2,0x1aa));var _0x21ba=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1ba2[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x21ba('0x0'));var emlformat=require(_0x21ba('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x21ba('0x2'));var rp=require(_0x21ba('0x3'));var moment=require('moment');var BPromise=require(_0x21ba('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x21ba('0x5'));var sox=require(_0x21ba('0x6'));var csv=require(_0x21ba('0x7'));var ejs=require(_0x21ba('0x8'));var fs=require('fs');var _=require(_0x21ba('0x9'));var squel=require('squel');var crypto=require(_0x21ba('0xa'));var jsforce=require(_0x21ba('0xb'));var deskjs=require(_0x21ba('0xc'));var toCsv=require(_0x21ba('0x7'));var querystring=require(_0x21ba('0xd'));var Papa=require('papaparse');var Redis=require(_0x21ba('0xe'));var authService=require(_0x21ba('0xf'));var qs=require(_0x21ba('0x10'));var as=require(_0x21ba('0x11'));var hardwareService=require(_0x21ba('0x12'));var logger=require(_0x21ba('0x13'))(_0x21ba('0x14'));var utils=require(_0x21ba('0x15'));var config=require(_0x21ba('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19dddf,_0x5213bd){_0x5213bd=_0x5213bd||0xcc;return function(_0x31cbb8){if(_0x31cbb8){return _0x19dddf[_0x21ba('0x17')](_0x5213bd);}return _0x19dddf[_0x21ba('0x18')](_0x5213bd)[_0x21ba('0x19')]();};}function respondWithResult(_0x31401b,_0xac3064){_0xac3064=_0xac3064||0xc8;return function(_0x91da50){if(_0x91da50){return _0x31401b['status'](_0xac3064)[_0x21ba('0x1a')](_0x91da50);}};}function respondWithFilteredResult(_0x27240c,_0x3cab77){return function(_0x2f56b7){if(_0x2f56b7){var _0x3ebb7c=_0x2f56b7[_0x21ba('0x1b')],_0x39b1dc=_0x3cab77[_0x21ba('0x1c')],_0x5f225d=_0x3cab77[_0x21ba('0x1c')]+_0x3cab77[_0x21ba('0x1d')],_0x2cca5d;if(_0x5f225d>=_0x3ebb7c){_0x5f225d=_0x3ebb7c;_0x2cca5d=0xc8;}else{_0x2cca5d=0xce;}_0x27240c['status'](_0x2cca5d);return _0x27240c['set'](_0x21ba('0x1e'),_0x39b1dc+'-'+_0x5f225d+'/'+_0x3ebb7c)[_0x21ba('0x1a')](_0x2f56b7);}return null;};}function patchUpdates(_0x12ae50){return function(_0x176267){try{jsonpatch[_0x21ba('0x1f')](_0x176267,_0x12ae50,!![]);}catch(_0x477b47){return BPromise[_0x21ba('0x20')](_0x477b47);}return _0x176267[_0x21ba('0x21')]();};}function saveUpdates(_0x215c2a,_0x2573cf){return function(_0x5d6ed0){if(_0x5d6ed0){return _0x5d6ed0[_0x21ba('0x22')](_0x215c2a)[_0x21ba('0x23')](function(_0x2380ee){return _0x2380ee;});}return null;};}function removeEntity(_0x549b0a,_0x1a146b){return function(_0x562f3e){if(_0x562f3e){return _0x562f3e['destroy']()['then'](function(){_0x549b0a[_0x21ba('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3afb2b,_0x3fe8eb){return function(_0xd131bb){if(!_0xd131bb){_0x3afb2b[_0x21ba('0x17')](0x194);}return _0xd131bb;};}function handleError(_0x470c4f,_0x1f0c23){_0x1f0c23=_0x1f0c23||0x1f4;return function(_0x2f12b5){logger[_0x21ba('0x24')](_0x2f12b5[_0x21ba('0x25')]);if(_0x2f12b5['name']){delete _0x2f12b5['name'];}_0x470c4f[_0x21ba('0x18')](_0x1f0c23)['send'](_0x2f12b5);};}exports[_0x21ba('0x26')]=function(_0x4c6429,_0xeac14f){var _0x39e91a={},_0x5849e4={},_0x38fb97={'count':0x0,'rows':[]};var _0x5cb78d=_[_0x21ba('0x27')](db[_0x21ba('0x28')]['rawAttributes'],function(_0x11e65b){return{'name':_0x11e65b['fieldName'],'type':_0x11e65b[_0x21ba('0x29')]['key']};});_0x5849e4[_0x21ba('0x2a')]=_[_0x21ba('0x27')](_0x5cb78d,_0x21ba('0x2b'));_0x5849e4[_0x21ba('0x2c')]=_[_0x21ba('0x2d')](_0x4c6429[_0x21ba('0x2c')]);_0x5849e4[_0x21ba('0x2e')]=_[_0x21ba('0x2f')](_0x5849e4[_0x21ba('0x2a')],_0x5849e4['query']);_0x39e91a[_0x21ba('0x30')]=_[_0x21ba('0x2f')](_0x5849e4['model'],qs[_0x21ba('0x31')](_0x4c6429[_0x21ba('0x2c')]['fields']));_0x39e91a['attributes']=_0x39e91a[_0x21ba('0x30')][_0x21ba('0x32')]?_0x39e91a[_0x21ba('0x30')]:_0x5849e4[_0x21ba('0x2a')];if(!_0x4c6429[_0x21ba('0x2c')][_0x21ba('0x33')](_0x21ba('0x34'))){_0x39e91a['limit']=qs[_0x21ba('0x1d')](_0x4c6429[_0x21ba('0x2c')][_0x21ba('0x1d')]);_0x39e91a['offset']=qs[_0x21ba('0x1c')](_0x4c6429[_0x21ba('0x2c')][_0x21ba('0x1c')]);}_0x39e91a[_0x21ba('0x35')]=qs['sort'](_0x4c6429['query'][_0x21ba('0x36')]);_0x39e91a[_0x21ba('0x37')]=qs[_0x21ba('0x2e')](_['pick'](_0x4c6429[_0x21ba('0x2c')],_0x5849e4['filters']));if(_0x4c6429[_0x21ba('0x2c')][_0x21ba('0x38')]){_0x39e91a[_0x21ba('0x37')]=_['merge'](_0x39e91a['where'],{'$or':_[_0x21ba('0x27')](_0x5cb78d,function(_0x138c2a){if(_0x138c2a[_0x21ba('0x29')]!=='VIRTUAL'){var _0x2bdc96={};_0x2bdc96[_0x138c2a['name']]={'$like':'%'+_0x4c6429[_0x21ba('0x2c')]['filter']+'%'};return _0x2bdc96;}})});}_0x39e91a=_['merge']({},_0x39e91a,_0x4c6429[_0x21ba('0x39')]);var _0x560f05={'where':_0x39e91a['where']};return db[_0x21ba('0x28')][_0x21ba('0x1b')](_0x560f05)[_0x21ba('0x23')](function(_0x272b4d){_0x38fb97[_0x21ba('0x1b')]=_0x272b4d;if(_0x4c6429[_0x21ba('0x2c')]['includeAll']){_0x39e91a[_0x21ba('0x3a')]=[{'all':!![]}];}return db[_0x21ba('0x28')]['findAll'](_0x39e91a);})[_0x21ba('0x23')](function(_0x7bff62){_0x38fb97['rows']=_0x7bff62;return _0x38fb97;})[_0x21ba('0x23')](respondWithFilteredResult(_0xeac14f,_0x39e91a))[_0x21ba('0x3b')](handleError(_0xeac14f,null));};exports[_0x21ba('0x3c')]=function(_0x239689,_0x57cdfa){var _0x4a393e={'raw':![],'where':{'id':_0x239689[_0x21ba('0x3d')]['id']}},_0xf25b5f={};_0xf25b5f[_0x21ba('0x2a')]=_[_0x21ba('0x2d')](db[_0x21ba('0x28')][_0x21ba('0x3e')]);_0xf25b5f['query']=_['keys'](_0x239689[_0x21ba('0x2c')]);_0xf25b5f['filters']=_[_0x21ba('0x2f')](_0xf25b5f['model'],_0xf25b5f[_0x21ba('0x2c')]);_0x4a393e[_0x21ba('0x30')]=_[_0x21ba('0x2f')](_0xf25b5f[_0x21ba('0x2a')],qs[_0x21ba('0x31')](_0x239689[_0x21ba('0x2c')][_0x21ba('0x31')]));_0x4a393e[_0x21ba('0x30')]=_0x4a393e[_0x21ba('0x30')][_0x21ba('0x32')]?_0x4a393e[_0x21ba('0x30')]:_0xf25b5f[_0x21ba('0x2a')];if(_0x239689[_0x21ba('0x2c')][_0x21ba('0x3f')]){_0x4a393e['include']=[{'all':!![]}];}_0x4a393e=_[_0x21ba('0x40')]({},_0x4a393e,_0x239689[_0x21ba('0x39')]);return db['Automation'][_0x21ba('0x41')](_0x4a393e)[_0x21ba('0x23')](handleEntityNotFound(_0x57cdfa,null))[_0x21ba('0x23')](respondWithResult(_0x57cdfa,null))[_0x21ba('0x3b')](handleError(_0x57cdfa,null));};exports['create']=function(_0x413839,_0x10781c){return db[_0x21ba('0x28')][_0x21ba('0x42')](_0x413839['body'],{})[_0x21ba('0x23')](respondWithResult(_0x10781c,0xc9))['catch'](handleError(_0x10781c,null));};exports['update']=function(_0x3b5fdb,_0x1a6020){if(_0x3b5fdb['body']['id']){delete _0x3b5fdb[_0x21ba('0x43')]['id'];}return db[_0x21ba('0x28')][_0x21ba('0x41')]({'where':{'id':_0x3b5fdb[_0x21ba('0x3d')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x1a6020,null))[_0x21ba('0x23')](saveUpdates(_0x3b5fdb[_0x21ba('0x43')],null))['then'](respondWithResult(_0x1a6020,null))[_0x21ba('0x3b')](handleError(_0x1a6020,null));};exports[_0x21ba('0x44')]=function(_0x2d130a,_0x21c328){return db[_0x21ba('0x28')][_0x21ba('0x41')]({'where':{'id':_0x2d130a[_0x21ba('0x3d')]['id']}})['then'](handleEntityNotFound(_0x21c328,null))[_0x21ba('0x23')](removeEntity(_0x21c328,null))[_0x21ba('0x3b')](handleError(_0x21c328,null));};exports[_0x21ba('0x45')]=function(_0x5f2846,_0x1cdaf6,_0x331ced){return db[_0x21ba('0x46')]['find']({'where':{'id':_0x5f2846[_0x21ba('0x3d')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x1cdaf6,null))[_0x21ba('0x23')](function(_0x41adc7){if(_0x41adc7){return _0x41adc7[_0x21ba('0x45')](_0x5f2846[_0x21ba('0x43')][_0x21ba('0x47')],_[_0x21ba('0x48')](_0x5f2846[_0x21ba('0x43')],['ids','id'])||{});}})[_0x21ba('0x23')](respondWithResult(_0x1cdaf6,null))[_0x21ba('0x3b')](handleError(_0x1cdaf6,null));};exports[_0x21ba('0x49')]=function(_0x3091b2,_0x45f78c,_0x40ec29){var _0x3b21fe={};var _0x48a4d7={};var _0x1a1219;var _0x559277;return db[_0x21ba('0x28')]['findOne']({'where':{'id':_0x3091b2[_0x21ba('0x3d')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x45f78c,null))[_0x21ba('0x23')](function(_0x4954aa){if(_0x4954aa){_0x1a1219=_0x4954aa;_0x48a4d7[_0x21ba('0x2a')]=_[_0x21ba('0x2d')](db[_0x21ba('0x46')]['rawAttributes']);_0x48a4d7[_0x21ba('0x2c')]=_[_0x21ba('0x2d')](_0x3091b2[_0x21ba('0x2c')]);_0x48a4d7[_0x21ba('0x2e')]=_['intersection'](_0x48a4d7[_0x21ba('0x2a')],_0x48a4d7[_0x21ba('0x2c')]);_0x3b21fe[_0x21ba('0x30')]=_[_0x21ba('0x2f')](_0x48a4d7[_0x21ba('0x2a')],qs[_0x21ba('0x31')](_0x3091b2[_0x21ba('0x2c')][_0x21ba('0x31')]));_0x3b21fe[_0x21ba('0x30')]=_0x3b21fe[_0x21ba('0x30')]['length']?_0x3b21fe[_0x21ba('0x30')]:_0x48a4d7[_0x21ba('0x2a')];_0x3b21fe[_0x21ba('0x35')]=qs[_0x21ba('0x36')](_0x3091b2[_0x21ba('0x2c')][_0x21ba('0x36')]);_0x3b21fe['where']=qs['filters'](_['pick'](_0x3091b2[_0x21ba('0x2c')],_0x48a4d7[_0x21ba('0x2e')]));if(_0x3091b2[_0x21ba('0x2c')]['filter']){_0x3b21fe[_0x21ba('0x37')]=_[_0x21ba('0x40')](_0x3b21fe['where'],{'$or':_[_0x21ba('0x27')](_0x3b21fe[_0x21ba('0x30')],function(_0x11b469){var _0x6f850c={};_0x6f850c[_0x11b469]={'$like':'%'+_0x3091b2['query']['filter']+'%'};return _0x6f850c;})});}_0x3b21fe=_['merge']({},_0x3b21fe,_0x3091b2[_0x21ba('0x39')]);return _0x1a1219[_0x21ba('0x49')](_0x3b21fe);}})[_0x21ba('0x23')](function(_0xd457e0){if(_0xd457e0){_0x559277=_0xd457e0[_0x21ba('0x32')];if(!_0x3091b2[_0x21ba('0x2c')][_0x21ba('0x33')]('nolimit')){_0x3b21fe[_0x21ba('0x1d')]=qs[_0x21ba('0x1d')](_0x3091b2['query'][_0x21ba('0x1d')]);_0x3b21fe[_0x21ba('0x1c')]=qs[_0x21ba('0x1c')](_0x3091b2[_0x21ba('0x2c')][_0x21ba('0x1c')]);}return _0x1a1219[_0x21ba('0x49')](_0x3b21fe);}})[_0x21ba('0x23')](function(_0x49e592){if(_0x49e592){return _0x49e592?{'count':_0x559277,'rows':_0x49e592}:null;}})[_0x21ba('0x23')](respondWithResult(_0x45f78c,null))[_0x21ba('0x3b')](handleError(_0x45f78c,null));};exports[_0x21ba('0x4a')]=function(_0x204111,_0x48085d,_0x38469b){return db[_0x21ba('0x4b')][_0x21ba('0x41')]({'where':{'id':_0x204111[_0x21ba('0x3d')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x48085d,null))[_0x21ba('0x23')](function(_0x3f2310){if(_0x3f2310){return _0x3f2310[_0x21ba('0x4a')](_0x204111[_0x21ba('0x43')][_0x21ba('0x47')],_[_0x21ba('0x48')](_0x204111[_0x21ba('0x43')],[_0x21ba('0x47'),'id'])||{});}})[_0x21ba('0x23')](respondWithResult(_0x48085d,null))[_0x21ba('0x3b')](handleError(_0x48085d,null));};exports[_0x21ba('0x4c')]=function(_0xbb01ba,_0x31ef98,_0x1e0e03){var _0x55690={};var _0x9d53b3={};var _0x1f96ba;var _0x45adda;return db[_0x21ba('0x28')]['findOne']({'where':{'id':_0xbb01ba[_0x21ba('0x3d')]['id']}})[_0x21ba('0x23')](handleEntityNotFound(_0x31ef98,null))['then'](function(_0x5271f3){if(_0x5271f3){_0x1f96ba=_0x5271f3;_0x9d53b3['model']=_[_0x21ba('0x2d')](db[_0x21ba('0x4b')][_0x21ba('0x3e')]);_0x9d53b3[_0x21ba('0x2c')]=_[_0x21ba('0x2d')](_0xbb01ba[_0x21ba('0x2c')]);_0x9d53b3[_0x21ba('0x2e')]=_['intersection'](_0x9d53b3[_0x21ba('0x2a')],_0x9d53b3['query']);_0x55690['attributes']=_[_0x21ba('0x2f')](_0x9d53b3[_0x21ba('0x2a')],qs[_0x21ba('0x31')](_0xbb01ba[_0x21ba('0x2c')][_0x21ba('0x31')]));_0x55690[_0x21ba('0x30')]=_0x55690[_0x21ba('0x30')][_0x21ba('0x32')]?_0x55690[_0x21ba('0x30')]:_0x9d53b3[_0x21ba('0x2a')];_0x55690[_0x21ba('0x35')]=qs[_0x21ba('0x36')](_0xbb01ba[_0x21ba('0x2c')][_0x21ba('0x36')]);_0x55690['where']=qs[_0x21ba('0x2e')](_['pick'](_0xbb01ba[_0x21ba('0x2c')],_0x9d53b3['filters']));if(_0xbb01ba[_0x21ba('0x2c')][_0x21ba('0x38')]){_0x55690[_0x21ba('0x37')]=_['merge'](_0x55690[_0x21ba('0x37')],{'$or':_[_0x21ba('0x27')](_0x55690[_0x21ba('0x30')],function(_0x35c23e){var _0xf50de9={};_0xf50de9[_0x35c23e]={'$like':'%'+_0xbb01ba['query'][_0x21ba('0x38')]+'%'};return _0xf50de9;})});}_0x55690=_[_0x21ba('0x40')]({},_0x55690,_0xbb01ba[_0x21ba('0x39')]);return _0x1f96ba[_0x21ba('0x4c')](_0x55690);}})['then'](function(_0x51d85b){if(_0x51d85b){_0x45adda=_0x51d85b['length'];if(!_0xbb01ba[_0x21ba('0x2c')][_0x21ba('0x33')](_0x21ba('0x34'))){_0x55690[_0x21ba('0x1d')]=qs['limit'](_0xbb01ba[_0x21ba('0x2c')][_0x21ba('0x1d')]);_0x55690[_0x21ba('0x1c')]=qs[_0x21ba('0x1c')](_0xbb01ba['query']['offset']);}return _0x1f96ba[_0x21ba('0x4c')](_0x55690);}})[_0x21ba('0x23')](function(_0x523fa1){if(_0x523fa1){return _0x523fa1?{'count':_0x45adda,'rows':_0x523fa1}:null;}})['then'](respondWithResult(_0x31ef98,null))['catch'](handleError(_0x31ef98,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 1969abc..4250f10 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 _0x9007=['request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','lodash','util','../../config/logger','moment','bluebird'];(function(_0x23a2b5,_0x5d85d3){var _0x5591aa=function(_0x396395){while(--_0x396395){_0x23a2b5['push'](_0x23a2b5['shift']());}};_0x5591aa(++_0x5d85d3);}(_0x9007,0x1db));var _0x7900=function(_0x1f7839,_0x2a26e6){_0x1f7839=_0x1f7839-0x0;var _0x36b42e=_0x9007[_0x1f7839];return _0x36b42e;};'use strict';var _=require(_0x7900('0x0'));var util=require(_0x7900('0x1'));var logger=require(_0x7900('0x2'))('api');var moment=require(_0x7900('0x3'));var BPromise=require(_0x7900('0x4'));var rp=require(_0x7900('0x5'));var fs=require('fs');var path=require(_0x7900('0x6'));var rimraf=require(_0x7900('0x7'));var config=require(_0x7900('0x8'));var attributes=require(_0x7900('0x9'));module[_0x7900('0xa')]=function(_0x4e908b,_0x13c1d2){return _0x4e908b['define'](_0x7900('0xb'),attributes,{'tableName':'tools_automations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa2b1=['../../config/environment','./automation.attributes','define','Automation','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa2b1,0x184));var _0x1a2b=function(_0x5bdf83,_0x3fd84c){_0x5bdf83=_0x5bdf83-0x0;var _0x224548=_0xa2b1[_0x5bdf83];return _0x224548;};'use strict';var _=require(_0x1a2b('0x0'));var util=require(_0x1a2b('0x1'));var logger=require(_0x1a2b('0x2'))('api');var moment=require(_0x1a2b('0x3'));var BPromise=require(_0x1a2b('0x4'));var rp=require(_0x1a2b('0x5'));var fs=require('fs');var path=require(_0x1a2b('0x6'));var rimraf=require(_0x1a2b('0x7'));var config=require(_0x1a2b('0x8'));var attributes=require(_0x1a2b('0x9'));module['exports']=function(_0x345a0e,_0x2424a4){return _0x345a0e[_0x1a2b('0xa')](_0x1a2b('0xb'),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 1247962..f6c7b17 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 _0xaac4=['code','Automation,\x20%s,\x20%s','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xaac4,0x72));var _0x4aac=function(_0x5534fe,_0x43c22e){_0x5534fe=_0x5534fe-0x0;var _0x3d1dc2=_0xaac4[_0x5534fe];return _0x3d1dc2;};'use strict';var _=require(_0x4aac('0x0'));var util=require(_0x4aac('0x1'));var moment=require(_0x4aac('0x2'));var BPromise=require('bluebird');var rs=require(_0x4aac('0x3'));var fs=require('fs');var Redis=require(_0x4aac('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4aac('0x5'));var logger=require(_0x4aac('0x6'))('rpc');var config=require(_0x4aac('0x7'));var jayson=require(_0x4aac('0x8'));var client=jayson[_0x4aac('0x9')][_0x4aac('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x202fd8,_0x5416ec,_0x264f41){return new BPromise(function(_0x215b79,_0x199337){return client[_0x4aac('0xb')](_0x202fd8,_0x264f41)[_0x4aac('0xc')](function(_0x4bd217){logger[_0x4aac('0xd')]('Automation,\x20%s,\x20%s',_0x5416ec,'request\x20sent');logger['debug'](_0x4aac('0xe'),_0x5416ec,_0x4aac('0xf'),JSON[_0x4aac('0x10')](_0x4bd217));if(_0x4bd217[_0x4aac('0x11')]){if(_0x4bd217[_0x4aac('0x11')][_0x4aac('0x12')]===0x1f4){logger[_0x4aac('0x11')](_0x4aac('0x13'),_0x5416ec,_0x4bd217[_0x4aac('0x11')][_0x4aac('0x14')]);return _0x199337(_0x4bd217[_0x4aac('0x11')]['message']);}logger['error']('Automation,\x20%s,\x20%s',_0x5416ec,_0x4bd217[_0x4aac('0x11')][_0x4aac('0x14')]);return _0x215b79(_0x4bd217[_0x4aac('0x11')][_0x4aac('0x14')]);}else{logger['info'](_0x4aac('0x13'),_0x5416ec,'request\x20sent');_0x215b79(_0x4bd217[_0x4aac('0x15')][_0x4aac('0x14')]);}})['catch'](function(_0x5a6bbb){logger[_0x4aac('0x11')]('Automation,\x20%s,\x20%s',_0x5416ec,_0x5a6bbb);_0x199337(_0x5a6bbb);});});} \ No newline at end of file +var _0xce1b=['stringify','error','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','http','request','then','info','Automation,\x20%s,\x20%s','request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s'];(function(_0x5807c9,_0x882976){var _0x27d993=function(_0xb8356b){while(--_0xb8356b){_0x5807c9['push'](_0x5807c9['shift']());}};_0x27d993(++_0x882976);}(_0xce1b,0x1d0));var _0xbce1=function(_0x43ffd6,_0x100ac0){_0x43ffd6=_0x43ffd6-0x0;var _0x410512=_0xce1b[_0x43ffd6];return _0x410512;};'use strict';var _=require(_0xbce1('0x0'));var util=require(_0xbce1('0x1'));var moment=require(_0xbce1('0x2'));var BPromise=require(_0xbce1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbce1('0x4'));var db=require(_0xbce1('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbce1('0x6'));var config=require(_0xbce1('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbce1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4134c3,_0x43c27b,_0x1a4a4b){return new BPromise(function(_0x13a507,_0x15fe66){return client[_0xbce1('0x9')](_0x4134c3,_0x1a4a4b)[_0xbce1('0xa')](function(_0x45b774){logger[_0xbce1('0xb')](_0xbce1('0xc'),_0x43c27b,_0xbce1('0xd'));logger[_0xbce1('0xe')](_0xbce1('0xf'),_0x43c27b,_0xbce1('0xd'),JSON[_0xbce1('0x10')](_0x45b774));if(_0x45b774[_0xbce1('0x11')]){if(_0x45b774[_0xbce1('0x11')]['code']===0x1f4){logger['error'](_0xbce1('0xc'),_0x43c27b,_0x45b774[_0xbce1('0x11')][_0xbce1('0x12')]);return _0x15fe66(_0x45b774[_0xbce1('0x11')]['message']);}logger['error'](_0xbce1('0xc'),_0x43c27b,_0x45b774[_0xbce1('0x11')]['message']);return _0x13a507(_0x45b774[_0xbce1('0x11')]['message']);}else{logger[_0xbce1('0xb')](_0xbce1('0xc'),_0x43c27b,'request\x20sent');_0x13a507(_0x45b774[_0xbce1('0x13')]['message']);}})['catch'](function(_0x21ae78){logger[_0xbce1('0x11')]('Automation,\x20%s,\x20%s',_0x43c27b,_0x21ae78);_0x15fe66(_0x21ae78);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index e7e8e83..f0c40e3 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 _0xee04=['path','connect-timeout','express','Router','../../components/auth/service','get','index','isAuthenticated','show','getConditions','/:id/conditions','addConditions','post','/:id/actions','put','/:id','update','delete','exports','multer','util'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xee04,0x124));var _0x4ee0=function(_0x5928e0,_0x282778){_0x5928e0=_0x5928e0-0x0;var _0x5eb4fc=_0xee04[_0x5928e0];return _0x5eb4fc;};'use strict';var multer=require(_0x4ee0('0x0'));var util=require(_0x4ee0('0x1'));var path=require(_0x4ee0('0x2'));var timeout=require(_0x4ee0('0x3'));var express=require(_0x4ee0('0x4'));var router=express[_0x4ee0('0x5')]();var auth=require(_0x4ee0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./automation.controller');router[_0x4ee0('0x7')]('/',auth['isAuthenticated'](),controller[_0x4ee0('0x8')]);router['get']('/:id',auth[_0x4ee0('0x9')](),controller[_0x4ee0('0xa')]);router['get']('/:id/conditions',auth[_0x4ee0('0x9')](),controller[_0x4ee0('0xb')]);router[_0x4ee0('0x7')]('/:id/actions',auth[_0x4ee0('0x9')](),controller['getActions']);router['post']('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x4ee0('0xc'),auth[_0x4ee0('0x9')](),controller[_0x4ee0('0xd')]);router[_0x4ee0('0xe')](_0x4ee0('0xf'),auth[_0x4ee0('0x9')](),controller['addActions']);router[_0x4ee0('0x10')](_0x4ee0('0x11'),auth['isAuthenticated'](),controller[_0x4ee0('0x12')]);router[_0x4ee0('0x13')](_0x4ee0('0x11'),auth[_0x4ee0('0x9')](),controller['destroy']);module[_0x4ee0('0x14')]=router; \ No newline at end of file +var _0xe5a9=['put','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','get','/:id','isAuthenticated','show','/:id/conditions','getConditions','getActions','post','addConditions','addActions'];(function(_0x2405bc,_0x2f28a1){var _0x5272d4=function(_0x225294){while(--_0x225294){_0x2405bc['push'](_0x2405bc['shift']());}};_0x5272d4(++_0x2f28a1);}(_0xe5a9,0x9e));var _0x9e5a=function(_0x42879f,_0x3b68ed){_0x42879f=_0x42879f-0x0;var _0x328d93=_0xe5a9[_0x42879f];return _0x328d93;};'use strict';var multer=require('multer');var util=require(_0x9e5a('0x0'));var path=require(_0x9e5a('0x1'));var timeout=require(_0x9e5a('0x2'));var express=require(_0x9e5a('0x3'));var router=express[_0x9e5a('0x4')]();var auth=require(_0x9e5a('0x5'));var interaction=require(_0x9e5a('0x6'));var config=require('../../config/environment');var controller=require(_0x9e5a('0x7'));router[_0x9e5a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9e5a('0x9'),auth[_0x9e5a('0xa')](),controller[_0x9e5a('0xb')]);router['get'](_0x9e5a('0xc'),auth[_0x9e5a('0xa')](),controller[_0x9e5a('0xd')]);router[_0x9e5a('0x8')]('/:id/actions',auth[_0x9e5a('0xa')](),controller[_0x9e5a('0xe')]);router[_0x9e5a('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9e5a('0xf')]('/:id/conditions',auth[_0x9e5a('0xa')](),controller[_0x9e5a('0x10')]);router[_0x9e5a('0xf')]('/:id/actions',auth[_0x9e5a('0xa')](),controller[_0x9e5a('0x11')]);router[_0x9e5a('0x12')]('/:id',auth[_0x9e5a('0xa')](),controller[_0x9e5a('0x13')]);router['delete'](_0x9e5a('0x9'),auth[_0x9e5a('0xa')](),controller[_0x9e5a('0x14')]);module[_0x9e5a('0x15')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 8f35501..a70f943 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 _0xd781=['DESC','Cut\x20Digit\x20(min:1,\x20max:15)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#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','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','ASC'];(function(_0x2f8e08,_0x5787cd){var _0x56fbb4=function(_0x9bb57e){while(--_0x9bb57e){_0x2f8e08['push'](_0x2f8e08['shift']());}};_0x56fbb4(++_0x5787cd);}(_0xd781,0xd4));var _0x1d78=function(_0x7ebb12,_0x161c4a){_0x7ebb12=_0x7ebb12-0x0;var _0x189edd=_0xd781[_0x7ebb12];return _0x189edd;};'use strict';var Sequelize=require(_0x1d78('0x0'));module[_0x1d78('0x1')]={'name':{'type':Sequelize[_0x1d78('0x2')],'unique':_0x1d78('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x1d78('0x4')](_0x1d78('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize[_0x1d78('0x2')]},'active':{'type':Sequelize[_0x1d78('0x6')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'limitCalls':{'type':Sequelize[_0x1d78('0x7')](0x4)[_0x1d78('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0x1d78('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x1d78('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x1d78('0x8')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d78('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d78('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)[_0x1d78('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d78('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'comment':_0x1d78('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d78('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x1d78('0xe')},'dialTimezone':{'type':Sequelize[_0x1d78('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x1d78('0x2')],'defaultValue':_0x1d78('0xf')},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x1d78('0x10'),'never','onlyIfOpen'),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x1d78('0x6')],'defaultValue':0x0,'comment':_0x1d78('0x11')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x1d78('0x12')},'dialAMDGreeting':{'type':Sequelize[_0x1d78('0x7')](0x9)[_0x1d78('0x8')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x1d78('0x13')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x1d78('0x7')](0x9)[_0x1d78('0x8')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x1d78('0x14')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x1d78('0x7')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x1d78('0x15')},'dialAMDMinWordLength':{'type':Sequelize[_0x1d78('0x7')](0x9)[_0x1d78('0x8')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x1d78('0x16')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x1d78('0x7')](0x9)[_0x1d78('0x8')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x1d78('0x17')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x1d78('0x7')](0x9)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x1d78('0x18')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x1d78('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x1d78('0x8')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Word\x20Length'},'dialOrderByScheduledAt':{'type':Sequelize[_0x1d78('0x4')]('DESC',_0x1d78('0x19')),'defaultValue':_0x1d78('0x1a')},'dialPrefix':{'type':Sequelize[_0x1d78('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x1d78('0x7')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0x1d78('0x8')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x1d78('0x1b')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)[_0x1d78('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d78('0x1c')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d78('0x1d')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)[_0x1d78('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d78('0x1e')},'dialMachineMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d78('0x1f')},'dialMachineRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)[_0x1d78('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x1d78('0x20')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x1d78('0x7')](0x3)[_0x1d78('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x1d78('0x21')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x1d78('0x7')](0x5)[_0x1d78('0x8')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'}}; \ No newline at end of file +var _0xf27c=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Maximum\x20Word\x20Length','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x1d307e,_0x250246){var _0x4b34fd=function(_0x4a45df){while(--_0x4a45df){_0x1d307e['push'](_0x1d307e['shift']());}};_0x4b34fd(++_0x250246);}(_0xf27c,0x111));var _0xcf27=function(_0x7c5ce8,_0x3ef259){_0x7c5ce8=_0x7c5ce8-0x0;var _0x5a406a=_0xf27c[_0x7c5ce8];return _0x5a406a;};'use strict';var Sequelize=require(_0xcf27('0x0'));module[_0xcf27('0x1')]={'name':{'type':Sequelize[_0xcf27('0x2')],'unique':_0xcf27('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xcf27('0x4')](_0xcf27('0x5')),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xcf27('0x6')],'defaultValue':0x0,'comment':_0xcf27('0x7')},'limitCalls':{'type':Sequelize[_0xcf27('0x8')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':'Max\x20200\x20calls.'},'dialOriginateCallerIdName':{'type':Sequelize[_0xcf27('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xcf27('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf27('0xa')},'dialCongestionMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf27('0xb')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf27('0xc')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'comment':_0xcf27('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf27('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcf27('0xf')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xcf27('0x2')],'defaultValue':_0xcf27('0x10')},'dialCheckDuplicateType':{'type':Sequelize[_0xcf27('0x4')]('always','never',_0xcf27('0x11')),'defaultValue':_0xcf27('0x12')},'dialAMDActive':{'type':Sequelize[_0xcf27('0x6')],'defaultValue':0x0,'comment':_0xcf27('0x13')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)[_0xcf27('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcf27('0x14')},'dialAMDGreeting':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcf27('0x15')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcf27('0x16')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf27('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcf27('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xcf27('0x19')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcf27('0x8')](0x9)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xcf27('0x1a')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcf27('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcf27('0x4')]('DESC',_0xcf27('0x1c')),'defaultValue':_0xcf27('0x1d')},'dialPrefix':{'type':Sequelize[_0xcf27('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcf27('0x1e')},'dialCutDigit':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf27('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf27('0x20')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf27('0x21')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcf27('0x8')](0x3)[_0xcf27('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcf27('0x22')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xcf27('0x8')](0x5)[_0xcf27('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcf27('0x23')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 27e8dac..0df3641 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 _0x22fb=['cm_hopper','fromQuery','scheduledAt','ContactId','ListId','createdAt','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','sequelize','all','addBlackLists','push','removeBlackLists','rimraf','fast-json-patch','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','../../config/logger','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','save','update','destroy','then','get','error','stack','name','map','Campaign','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','filter','merge','includeAll','include','findAll','catch','params','keys','rawAttributes','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','updatedAt','IvrCampaigns','UserProfileResource','findOne','CmHopper','nolimit','pick','CampaignId','rows','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into'];(function(_0x596a91,_0x2ae66a){var _0x2281bb=function(_0x1d6178){while(--_0x1d6178){_0x596a91['push'](_0x596a91['shift']());}};_0x2281bb(++_0x2ae66a);}(_0x22fb,0x192));var _0xb22f=function(_0x5eb7aa,_0x4f7b30){_0x5eb7aa=_0x5eb7aa-0x0;var _0xca8012=_0x22fb[_0x5eb7aa];return _0xca8012;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xb22f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb22f('0x1'));var rp=require(_0xb22f('0x2'));var moment=require(_0xb22f('0x3'));var BPromise=require(_0xb22f('0x4'));var Mustache=require(_0xb22f('0x5'));var util=require('util');var path=require(_0xb22f('0x6'));var sox=require(_0xb22f('0x7'));var csv=require(_0xb22f('0x8'));var ejs=require(_0xb22f('0x9'));var fs=require('fs');var _=require(_0xb22f('0xa'));var squel=require(_0xb22f('0xb'));var crypto=require('crypto');var jsforce=require(_0xb22f('0xc'));var deskjs=require(_0xb22f('0xd'));var toCsv=require(_0xb22f('0x8'));var querystring=require(_0xb22f('0xe'));var Papa=require(_0xb22f('0xf'));var Redis=require(_0xb22f('0x10'));var authService=require(_0xb22f('0x11'));var qs=require(_0xb22f('0x12'));var as=require(_0xb22f('0x13'));var hardwareService=require(_0xb22f('0x14'));var logger=require(_0xb22f('0x15'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xb22f('0x16'))['db'];function respondWithStatusCode(_0x4923d3,_0x4bb02a){_0x4bb02a=_0x4bb02a||0xcc;return function(_0x5bf0b9){if(_0x5bf0b9){return _0x4923d3[_0xb22f('0x17')](_0x4bb02a);}return _0x4923d3[_0xb22f('0x18')](_0x4bb02a)[_0xb22f('0x19')]();};}function respondWithResult(_0x2f046d,_0x390c53){_0x390c53=_0x390c53||0xc8;return function(_0x32d796){if(_0x32d796){return _0x2f046d['status'](_0x390c53)[_0xb22f('0x1a')](_0x32d796);}};}function respondWithFilteredResult(_0x5f1590,_0x36e2a8){return function(_0x4f9108){if(_0x4f9108){var _0x2187fc=_0x4f9108[_0xb22f('0x1b')],_0x514a8f=_0x36e2a8['offset'],_0x160417=_0x36e2a8[_0xb22f('0x1c')]+_0x36e2a8['limit'],_0xc36af4;if(_0x160417>=_0x2187fc){_0x160417=_0x2187fc;_0xc36af4=0xc8;}else{_0xc36af4=0xce;}_0x5f1590[_0xb22f('0x18')](_0xc36af4);return _0x5f1590[_0xb22f('0x1d')](_0xb22f('0x1e'),_0x514a8f+'-'+_0x160417+'/'+_0x2187fc)[_0xb22f('0x1a')](_0x4f9108);}return null;};}function patchUpdates(_0x139bb6){return function(_0x2d52e4){try{jsonpatch['apply'](_0x2d52e4,_0x139bb6,!![]);}catch(_0x72994){return BPromise['reject'](_0x72994);}return _0x2d52e4[_0xb22f('0x1f')]();};}function saveUpdates(_0x3878d8,_0x316f11){return function(_0x2239b8){if(_0x2239b8){return _0x2239b8[_0xb22f('0x20')](_0x3878d8)['then'](function(_0x47d5cf){return _0x47d5cf;});}return null;};}function removeEntity(_0x3da442,_0x19e480){return function(_0xf34e0d){if(_0xf34e0d){return _0xf34e0d[_0xb22f('0x21')]()[_0xb22f('0x22')](function(){var _0xcb9a74=_0xf34e0d[_0xb22f('0x23')]({'plain':!![]});var _0x286465='IvrCampaigns';return db['UserProfileResource'][_0xb22f('0x21')]({'where':{'type':_0x286465,'resourceId':_0xcb9a74['id']}})[_0xb22f('0x22')](function(){return _0xf34e0d;});})['then'](function(){_0x3da442[_0xb22f('0x18')](0xcc)[_0xb22f('0x19')]();});}};}function handleEntityNotFound(_0x4f2986,_0x4687f2){return function(_0x2918be){if(!_0x2918be){_0x4f2986['sendStatus'](0x194);}return _0x2918be;};}function handleError(_0x3e471f,_0x2c4a9e){_0x2c4a9e=_0x2c4a9e||0x1f4;return function(_0xcddbca){logger[_0xb22f('0x24')](_0xcddbca[_0xb22f('0x25')]);if(_0xcddbca[_0xb22f('0x26')]){delete _0xcddbca[_0xb22f('0x26')];}_0x3e471f[_0xb22f('0x18')](_0x2c4a9e)['send'](_0xcddbca);};}exports['index']=function(_0x5d86a1,_0x2f6b97){var _0x557d96={},_0x327200={},_0xc7f33b={'count':0x0,'rows':[]};var _0xf268f4=_[_0xb22f('0x27')](db[_0xb22f('0x28')]['rawAttributes'],function(_0x519034){return{'name':_0x519034[_0xb22f('0x29')],'type':_0x519034[_0xb22f('0x2a')][_0xb22f('0x2b')]};});_0x327200[_0xb22f('0x2c')]=_['map'](_0xf268f4,_0xb22f('0x26'));_0x327200[_0xb22f('0x2d')]=_['keys'](_0x5d86a1[_0xb22f('0x2d')]);_0x327200[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x327200[_0xb22f('0x2c')],_0x327200[_0xb22f('0x2d')]);_0x557d96['attributes']=_['intersection'](_0x327200[_0xb22f('0x2c')],qs[_0xb22f('0x30')](_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x557d96[_0xb22f('0x31')]=_0x557d96[_0xb22f('0x31')][_0xb22f('0x32')]?_0x557d96[_0xb22f('0x31')]:_0x327200[_0xb22f('0x2c')];if(!_0x5d86a1['query'][_0xb22f('0x33')]('nolimit')){_0x557d96['limit']=qs[_0xb22f('0x34')](_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x557d96[_0xb22f('0x1c')]=qs[_0xb22f('0x1c')](_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x1c')]);}_0x557d96[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x36')]);_0x557d96[_0xb22f('0x37')]=qs[_0xb22f('0x2e')](_['pick'](_0x5d86a1['query'],_0x327200[_0xb22f('0x2e')]));if(_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x38')]){_0x557d96['where']=_[_0xb22f('0x39')](_0x557d96[_0xb22f('0x37')],{'$or':_['map'](_0xf268f4,function(_0x4bf34d){if(_0x4bf34d[_0xb22f('0x2a')]!=='VIRTUAL'){var _0x234d17={};_0x234d17[_0x4bf34d['name']]={'$like':'%'+_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x234d17;}})});}_0x557d96=_[_0xb22f('0x39')]({},_0x557d96,_0x5d86a1['options']);var _0x2cf9f4={'where':_0x557d96[_0xb22f('0x37')]};return db[_0xb22f('0x28')]['count'](_0x2cf9f4)[_0xb22f('0x22')](function(_0x195985){_0xc7f33b[_0xb22f('0x1b')]=_0x195985;if(_0x5d86a1[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x557d96[_0xb22f('0x3b')]=[{'all':!![]}];}return db[_0xb22f('0x28')][_0xb22f('0x3c')](_0x557d96);})[_0xb22f('0x22')](function(_0x42e834){_0xc7f33b['rows']=_0x42e834;return _0xc7f33b;})[_0xb22f('0x22')](respondWithFilteredResult(_0x2f6b97,_0x557d96))[_0xb22f('0x3d')](handleError(_0x2f6b97,null));};exports['show']=function(_0x3e4c4a,_0x4be0de){var _0x58ba40={'raw':![],'where':{'id':_0x3e4c4a[_0xb22f('0x3e')]['id']}},_0x2ccbba={};_0x2ccbba[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db['Campaign'][_0xb22f('0x40')]);_0x2ccbba['query']=_[_0xb22f('0x3f')](_0x3e4c4a[_0xb22f('0x2d')]);_0x2ccbba[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x2ccbba[_0xb22f('0x2c')],_0x2ccbba[_0xb22f('0x2d')]);_0x58ba40['attributes']=_[_0xb22f('0x2f')](_0x2ccbba['model'],qs[_0xb22f('0x30')](_0x3e4c4a[_0xb22f('0x2d')]['fields']));_0x58ba40[_0xb22f('0x31')]=_0x58ba40[_0xb22f('0x31')]['length']?_0x58ba40['attributes']:_0x2ccbba[_0xb22f('0x2c')];if(_0x3e4c4a['query'][_0xb22f('0x3a')]){_0x58ba40[_0xb22f('0x3b')]=[{'all':!![]}];}_0x58ba40=_[_0xb22f('0x39')]({},_0x58ba40,_0x3e4c4a[_0xb22f('0x41')]);return db['Campaign'][_0xb22f('0x42')](_0x58ba40)[_0xb22f('0x22')](handleEntityNotFound(_0x4be0de,null))['then'](respondWithResult(_0x4be0de,null))[_0xb22f('0x3d')](handleError(_0x4be0de,null));};exports[_0xb22f('0x43')]=function(_0x411723,_0x291e0c){return db[_0xb22f('0x28')]['create'](_0x411723[_0xb22f('0x44')],{})['then'](function(_0x52141e){var _0x3fb0ac=_0x411723[_0xb22f('0x45')][_0xb22f('0x23')]({'plain':!![]});if(!_0x3fb0ac)throw new Error(_0xb22f('0x46'));if(_0x3fb0ac[_0xb22f('0x47')]==='user'){var _0x275ca5=_0x52141e['get']({'plain':!![]});var _0x2d9683='IvrCampaigns';return db[_0xb22f('0x48')][_0xb22f('0x42')]({'where':{'name':_0x2d9683,'userProfileId':_0x3fb0ac[_0xb22f('0x49')]},'raw':!![]})['then'](function(_0x299156){if(_0x299156&&_0x299156[_0xb22f('0x4a')]===0x0){return db['UserProfileResource'][_0xb22f('0x43')]({'name':_0x275ca5[_0xb22f('0x26')],'resourceId':_0x275ca5['id'],'type':_0x299156['name'],'sectionId':_0x299156['id']},{})['then'](function(){return _0x52141e;});}else{return _0x52141e;}})[_0xb22f('0x3d')](function(_0x1a847d){logger['error'](_0xb22f('0x4b'),_0x1a847d);throw _0x1a847d;});}return _0x52141e;})[_0xb22f('0x22')](respondWithResult(_0x291e0c,0xc9))['catch'](handleError(_0x291e0c,null));};exports['clone']=function(_0x36684a,_0x3759ef){var _0x4c18d3={'where':{'id':_0x36684a[_0xb22f('0x3e')]['id']}},_0x13ac40={};_0x13ac40[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db['Campaign'][_0xb22f('0x40')]);_0x4c18d3[_0xb22f('0x31')]=_['intersection'](_0x13ac40['model'],qs[_0xb22f('0x30')](_0x36684a[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x4c18d3[_0xb22f('0x31')]=_0x4c18d3['attributes'][_0xb22f('0x32')]?_0x4c18d3[_0xb22f('0x31')]:_0x13ac40['model'];if(_0x36684a[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x4c18d3[_0xb22f('0x3b')]=[{'all':!![]}];}_0x4c18d3=_[_0xb22f('0x39')]({},_0x4c18d3,_0x36684a[_0xb22f('0x41')]);return db[_0xb22f('0x28')][_0xb22f('0x42')](_0x4c18d3)['then'](handleEntityNotFound(_0x3759ef,null))[_0xb22f('0x22')](function(_0x14637f){if(_0x14637f){var _0x34e2d4=_0x14637f[_0xb22f('0x23')]({'plain':!![]});_0x34e2d4=qs[_0xb22f('0x4c')](_0x34e2d4,['id','createdAt','updatedAt']);_0x36684a[_0xb22f('0x44')]=_[_0xb22f('0x4c')](_0x36684a[_0xb22f('0x44')],['id','createdAt',_0xb22f('0x4d')]);return db[_0xb22f('0x28')][_0xb22f('0x43')](_[_0xb22f('0x39')](_0x34e2d4,_0x36684a[_0xb22f('0x44')]),{'include':_0x36684a[_0xb22f('0x2d')][_0xb22f('0x3a')]?[{'all':!![]}]:undefined})[_0xb22f('0x22')](function(_0x5bbdf6){var _0x552624=_0x36684a[_0xb22f('0x45')][_0xb22f('0x23')]({'plain':!![]});if(!_0x552624)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x552624['role']===_0xb22f('0x45')){var _0x137761=_0x5bbdf6['get']({'plain':!![]});var _0x5796ea=_0xb22f('0x4e');return db['UserProfileSection'][_0xb22f('0x42')]({'where':{'name':_0x5796ea,'userProfileId':_0x552624[_0xb22f('0x49')]},'raw':!![]})[_0xb22f('0x22')](function(_0x50e874){if(_0x50e874&&_0x50e874['autoAssociation']===0x0){return db[_0xb22f('0x4f')]['create']({'name':_0x137761[_0xb22f('0x26')],'resourceId':_0x137761['id'],'type':_0x50e874[_0xb22f('0x26')],'sectionId':_0x50e874['id']},{})[_0xb22f('0x22')](function(){return _0x5bbdf6;});}else{return _0x5bbdf6;}})['catch'](function(_0x55fdf1){logger[_0xb22f('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x55fdf1);throw _0x55fdf1;});}return _0x5bbdf6;});}})[_0xb22f('0x22')](respondWithResult(_0x3759ef,0xc9))[_0xb22f('0x3d')](handleError(_0x3759ef,null));};exports[_0xb22f('0x20')]=function(_0x4d5074,_0x4464bd){if(_0x4d5074['body']['id']){delete _0x4d5074[_0xb22f('0x44')]['id'];}return db[_0xb22f('0x28')][_0xb22f('0x42')]({'where':{'id':_0x4d5074[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x4464bd,null))[_0xb22f('0x22')](saveUpdates(_0x4d5074[_0xb22f('0x44')],null))[_0xb22f('0x22')](respondWithResult(_0x4464bd,null))[_0xb22f('0x3d')](handleError(_0x4464bd,null));};exports['destroy']=function(_0x631832,_0x1487e7){return db[_0xb22f('0x28')]['find']({'where':{'id':_0x631832[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x1487e7,null))[_0xb22f('0x22')](removeEntity(_0x1487e7,null))[_0xb22f('0x3d')](handleError(_0x1487e7,null));};exports['getHoppers']=function(_0x4c79d6,_0x169215,_0x5e4fc0){var _0x51ef42={'raw':!![],'where':{}};var _0x43d850={};var _0x3a8183={'count':0x0,'rows':[]};return db[_0xb22f('0x28')][_0xb22f('0x50')]({'where':{'id':_0x4c79d6[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x169215,null))[_0xb22f('0x22')](function(_0x3a0746){if(_0x3a0746){_0x43d850[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db[_0xb22f('0x51')][_0xb22f('0x40')]);_0x43d850['query']=_[_0xb22f('0x3f')](_0x4c79d6[_0xb22f('0x2d')]);_0x43d850[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x43d850[_0xb22f('0x2c')],_0x43d850[_0xb22f('0x2d')]);_0x51ef42[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x43d850[_0xb22f('0x2c')],qs[_0xb22f('0x30')](_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x51ef42['attributes']=_0x51ef42['attributes']['length']?_0x51ef42[_0xb22f('0x31')]:_0x43d850[_0xb22f('0x2c')];if(!_0x4c79d6['query'][_0xb22f('0x33')](_0xb22f('0x52'))){_0x51ef42['limit']=qs[_0xb22f('0x34')](_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x51ef42[_0xb22f('0x1c')]=qs[_0xb22f('0x1c')](_0x4c79d6['query']['offset']);}_0x51ef42['order']=qs[_0xb22f('0x36')](_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x36')]);_0x51ef42['where']=qs[_0xb22f('0x2e')](_[_0xb22f('0x53')](_0x4c79d6['query'],_0x43d850[_0xb22f('0x2e')]));_0x51ef42[_0xb22f('0x37')][_0xb22f('0x54')]=_0x3a0746['id'];if(_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x38')]){_0x51ef42[_0xb22f('0x37')]=_[_0xb22f('0x39')](_0x51ef42[_0xb22f('0x37')],{'$or':_[_0xb22f('0x27')](_0x51ef42[_0xb22f('0x31')],function(_0x4bed6e){var _0x47055d={};_0x47055d[_0x4bed6e]={'$like':'%'+_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x47055d;})});}_0x51ef42=_[_0xb22f('0x39')]({},_0x51ef42,_0x4c79d6[_0xb22f('0x41')]);return db[_0xb22f('0x51')][_0xb22f('0x1b')]({'where':_0x51ef42['where']})[_0xb22f('0x22')](function(_0x42d790){_0x3a8183[_0xb22f('0x1b')]=_0x42d790;if(_0x4c79d6[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x51ef42[_0xb22f('0x3b')]=[{'all':!![]}];}return db['CmHopper'][_0xb22f('0x3c')](_0x51ef42);})[_0xb22f('0x22')](function(_0x5edfc7){_0x3a8183[_0xb22f('0x55')]=_0x5edfc7;return _0x3a8183;});}})['then'](respondWithFilteredResult(_0x169215,_0x51ef42))['catch'](handleError(_0x169215,null));};exports['getHopperHistories']=function(_0x317c49,_0x5e5f4f,_0x27c739){var _0x4e7756={'raw':!![],'where':{}};var _0x4a7dc8={};var _0x348981={'count':0x0,'rows':[]};return db[_0xb22f('0x28')]['findOne']({'where':{'id':_0x317c49['params']['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x5e5f4f,null))[_0xb22f('0x22')](function(_0x5534ec){if(_0x5534ec){_0x4a7dc8[_0xb22f('0x2c')]=_['keys'](db['CmHopperHistory'][_0xb22f('0x40')]);_0x4a7dc8[_0xb22f('0x2d')]=_[_0xb22f('0x3f')](_0x317c49['query']);_0x4a7dc8['filters']=_['intersection'](_0x4a7dc8[_0xb22f('0x2c')],_0x4a7dc8[_0xb22f('0x2d')]);_0x4e7756[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x4a7dc8['model'],qs[_0xb22f('0x30')](_0x317c49[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x4e7756[_0xb22f('0x31')]=_0x4e7756[_0xb22f('0x31')]['length']?_0x4e7756[_0xb22f('0x31')]:_0x4a7dc8['model'];if(!_0x317c49['query'][_0xb22f('0x33')](_0xb22f('0x52'))){_0x4e7756[_0xb22f('0x34')]=qs['limit'](_0x317c49[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x4e7756[_0xb22f('0x1c')]=qs[_0xb22f('0x1c')](_0x317c49[_0xb22f('0x2d')][_0xb22f('0x1c')]);}_0x4e7756[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x317c49[_0xb22f('0x2d')][_0xb22f('0x36')]);_0x4e7756[_0xb22f('0x37')]=qs['filters'](_['pick'](_0x317c49[_0xb22f('0x2d')],_0x4a7dc8[_0xb22f('0x2e')]));_0x4e7756['where'][_0xb22f('0x54')]=_0x5534ec['id'];if(_0x317c49[_0xb22f('0x2d')][_0xb22f('0x38')]){_0x4e7756[_0xb22f('0x37')]=_[_0xb22f('0x39')](_0x4e7756[_0xb22f('0x37')],{'$or':_[_0xb22f('0x27')](_0x4e7756[_0xb22f('0x31')],function(_0x506eba){var _0x4aea79={};_0x4aea79[_0x506eba]={'$like':'%'+_0x317c49[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x4aea79;})});}_0x4e7756=_['merge']({},_0x4e7756,_0x317c49[_0xb22f('0x41')]);return db[_0xb22f('0x56')][_0xb22f('0x1b')]({'where':_0x4e7756['where']})[_0xb22f('0x22')](function(_0x5deddf){_0x348981[_0xb22f('0x1b')]=_0x5deddf;if(_0x317c49[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x4e7756[_0xb22f('0x3b')]=[{'all':!![]}];}return db[_0xb22f('0x56')][_0xb22f('0x3c')](_0x4e7756);})[_0xb22f('0x22')](function(_0xaffc3){_0x348981[_0xb22f('0x55')]=_0xaffc3;return _0x348981;});}})['then'](respondWithFilteredResult(_0x5e5f4f,_0x4e7756))[_0xb22f('0x3d')](handleError(_0x5e5f4f,null));};exports[_0xb22f('0x57')]=function(_0x2007ca,_0x58e63c,_0x457132){var _0x5b122e={'raw':!![],'where':{}};var _0x5e4cec={};var _0x4a5ab1={'count':0x0,'rows':[]};return db[_0xb22f('0x28')][_0xb22f('0x50')]({'where':{'id':_0x2007ca[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x58e63c,null))[_0xb22f('0x22')](function(_0x18208a){if(_0x18208a){_0x5e4cec[_0xb22f('0x2c')]=_['keys'](db[_0xb22f('0x58')][_0xb22f('0x40')]);_0x5e4cec[_0xb22f('0x2d')]=_[_0xb22f('0x3f')](_0x2007ca[_0xb22f('0x2d')]);_0x5e4cec[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x5e4cec[_0xb22f('0x2c')],_0x5e4cec['query']);_0x5b122e[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x5e4cec[_0xb22f('0x2c')],qs[_0xb22f('0x30')](_0x2007ca[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x5b122e[_0xb22f('0x31')]=_0x5b122e[_0xb22f('0x31')][_0xb22f('0x32')]?_0x5b122e[_0xb22f('0x31')]:_0x5e4cec[_0xb22f('0x2c')];if(!_0x2007ca['query'][_0xb22f('0x33')]('nolimit')){_0x5b122e[_0xb22f('0x34')]=qs[_0xb22f('0x34')](_0x2007ca['query']['limit']);_0x5b122e[_0xb22f('0x1c')]=qs[_0xb22f('0x1c')](_0x2007ca[_0xb22f('0x2d')][_0xb22f('0x1c')]);}_0x5b122e[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x2007ca['query'][_0xb22f('0x36')]);_0x5b122e['where']=qs[_0xb22f('0x2e')](_['pick'](_0x2007ca['query'],_0x5e4cec[_0xb22f('0x2e')]));_0x5b122e['where'][_0xb22f('0x54')]=_0x18208a['id'];if(_0x2007ca[_0xb22f('0x2d')][_0xb22f('0x38')]){_0x5b122e['where']=_[_0xb22f('0x39')](_0x5b122e[_0xb22f('0x37')],{'$or':_[_0xb22f('0x27')](_0x5b122e[_0xb22f('0x31')],function(_0x540013){var _0x3f9f4a={};_0x3f9f4a[_0x540013]={'$like':'%'+_0x2007ca[_0xb22f('0x2d')]['filter']+'%'};return _0x3f9f4a;})});}_0x5b122e=_['merge']({},_0x5b122e,_0x2007ca[_0xb22f('0x41')]);return db[_0xb22f('0x58')]['count']({'where':_0x5b122e['where']})[_0xb22f('0x22')](function(_0x2c5799){_0x4a5ab1[_0xb22f('0x1b')]=_0x2c5799;if(_0x2007ca[_0xb22f('0x2d')]['includeAll']){_0x5b122e[_0xb22f('0x3b')]=[{'all':!![]}];}return db[_0xb22f('0x58')][_0xb22f('0x3c')](_0x5b122e);})[_0xb22f('0x22')](function(_0x4c8219){_0x4a5ab1[_0xb22f('0x55')]=_0x4c8219;return _0x4a5ab1;});}})['then'](respondWithFilteredResult(_0x58e63c,_0x5b122e))[_0xb22f('0x3d')](handleError(_0x58e63c,null));};exports['getHopperBlacks']=function(_0x5ce15b,_0x1b1953,_0x4a1e18){var _0x1f1e62={'raw':!![],'where':{}};var _0x29f553={};var _0xe3a900={'count':0x0,'rows':[]};return db[_0xb22f('0x28')]['findOne']({'where':{'id':_0x5ce15b[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x1b1953,null))[_0xb22f('0x22')](function(_0x137947){if(_0x137947){_0x29f553[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db[_0xb22f('0x59')]['rawAttributes']);_0x29f553['query']=_[_0xb22f('0x3f')](_0x5ce15b['query']);_0x29f553[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x29f553[_0xb22f('0x2c')],_0x29f553[_0xb22f('0x2d')]);_0x1f1e62[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x29f553['model'],qs[_0xb22f('0x30')](_0x5ce15b[_0xb22f('0x2d')][_0xb22f('0x30')]));_0x1f1e62['attributes']=_0x1f1e62['attributes'][_0xb22f('0x32')]?_0x1f1e62['attributes']:_0x29f553['model'];if(!_0x5ce15b[_0xb22f('0x2d')][_0xb22f('0x33')](_0xb22f('0x52'))){_0x1f1e62['limit']=qs['limit'](_0x5ce15b[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x1f1e62['offset']=qs['offset'](_0x5ce15b['query'][_0xb22f('0x1c')]);}_0x1f1e62[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x5ce15b[_0xb22f('0x2d')]['sort']);_0x1f1e62[_0xb22f('0x37')]=qs['filters'](_[_0xb22f('0x53')](_0x5ce15b[_0xb22f('0x2d')],_0x29f553[_0xb22f('0x2e')]));_0x1f1e62[_0xb22f('0x37')][_0xb22f('0x54')]=_0x137947['id'];if(_0x5ce15b['query']['filter']){_0x1f1e62[_0xb22f('0x37')]=_[_0xb22f('0x39')](_0x1f1e62[_0xb22f('0x37')],{'$or':_[_0xb22f('0x27')](_0x1f1e62['attributes'],function(_0x3f3bbb){var _0x30f6d4={};_0x30f6d4[_0x3f3bbb]={'$like':'%'+_0x5ce15b[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x30f6d4;})});}_0x1f1e62=_[_0xb22f('0x39')]({},_0x1f1e62,_0x5ce15b['options']);return db['CmHopperBlack']['count']({'where':_0x1f1e62[_0xb22f('0x37')]})[_0xb22f('0x22')](function(_0x199cfd){_0xe3a900['count']=_0x199cfd;if(_0x5ce15b[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x1f1e62[_0xb22f('0x3b')]=[{'all':!![]}];}return db[_0xb22f('0x59')][_0xb22f('0x3c')](_0x1f1e62);})[_0xb22f('0x22')](function(_0x41e957){_0xe3a900['rows']=_0x41e957;return _0xe3a900;});}})['then'](respondWithFilteredResult(_0x1b1953,_0x1f1e62))['catch'](handleError(_0x1b1953,null));};exports[_0xb22f('0x5a')]=function(_0x27749d,_0x540552,_0x602c26){var _0x402c9c={};var _0x77ec4={};var _0x3d9475;var _0x4b3963;return db[_0xb22f('0x28')][_0xb22f('0x50')]({'where':{'id':_0x27749d['params']['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x540552,null))[_0xb22f('0x22')](function(_0x38f1b6){if(_0x38f1b6){_0x3d9475=_0x38f1b6;_0x77ec4[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db[_0xb22f('0x5b')][_0xb22f('0x40')]);_0x77ec4['query']=_[_0xb22f('0x3f')](_0x27749d['query']);_0x77ec4[_0xb22f('0x2e')]=_[_0xb22f('0x2f')](_0x77ec4[_0xb22f('0x2c')],_0x77ec4[_0xb22f('0x2d')]);_0x402c9c[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x77ec4[_0xb22f('0x2c')],qs[_0xb22f('0x30')](_0x27749d['query'][_0xb22f('0x30')]));_0x402c9c[_0xb22f('0x31')]=_0x402c9c[_0xb22f('0x31')][_0xb22f('0x32')]?_0x402c9c['attributes']:_0x77ec4[_0xb22f('0x2c')];_0x402c9c[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x27749d[_0xb22f('0x2d')][_0xb22f('0x36')]);_0x402c9c[_0xb22f('0x37')]=qs['filters'](_['pick'](_0x27749d[_0xb22f('0x2d')],_0x77ec4[_0xb22f('0x2e')]));if(_0x27749d[_0xb22f('0x2d')]['filter']){_0x402c9c['where']=_[_0xb22f('0x39')](_0x402c9c[_0xb22f('0x37')],{'$or':_[_0xb22f('0x27')](_0x402c9c['attributes'],function(_0x5aa68f){var _0x17daa7={};_0x17daa7[_0x5aa68f]={'$like':'%'+_0x27749d[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x17daa7;})});}_0x402c9c=_[_0xb22f('0x39')]({},_0x402c9c,_0x27749d[_0xb22f('0x41')]);return _0x3d9475['getLists'](_0x402c9c);}})['then'](function(_0x2d5848){if(_0x2d5848){_0x4b3963=_0x2d5848[_0xb22f('0x32')];if(!_0x27749d[_0xb22f('0x2d')][_0xb22f('0x33')]('nolimit')){_0x402c9c[_0xb22f('0x34')]=qs[_0xb22f('0x34')](_0x27749d[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x402c9c[_0xb22f('0x1c')]=qs['offset'](_0x27749d['query']['offset']);}return _0x3d9475[_0xb22f('0x5a')](_0x402c9c);}})[_0xb22f('0x22')](function(_0x39416e){if(_0x39416e){return _0x39416e?{'count':_0x4b3963,'rows':_0x39416e}:null;}})[_0xb22f('0x22')](respondWithResult(_0x540552,null))[_0xb22f('0x3d')](handleError(_0x540552,null));};exports[_0xb22f('0x5c')]=function(_0x2b521f,_0x583d54,_0x2f233c){var _0x1a6d37,_0x3e4ec0;return db[_0xb22f('0x28')][_0xb22f('0x42')]({'where':{'id':_0x2b521f['params']['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x583d54,null))['then'](function(_0x37a1bc){if(_0x37a1bc){_0x3e4ec0=_0x37a1bc;return _0x37a1bc[_0xb22f('0x5c')](_0x2b521f[_0xb22f('0x44')][_0xb22f('0x5d')],_[_0xb22f('0x4c')](_0x2b521f[_0xb22f('0x44')],['ids','id'])||{});}return null;})[_0xb22f('0x5e')](function(_0x532056){var _0x587118;_0x1a6d37=_0x532056||[];var _0x576d72=[];if(_0x532056){for(var _0x127ad6=0x0;_0x127ad6<_0x532056[_0xb22f('0x32')];_0x127ad6+=0x1){var _0x439da5=_0x532056[_0x127ad6][_0xb22f('0x23')]({'plain':!![]});_0x3e4ec0[_0xb22f('0x5f')]=_0x2b521f[_0xb22f('0x44')][_0xb22f('0x5f')]?_0x2b521f[_0xb22f('0x44')][_0xb22f('0x5f')]:_0x3e4ec0[_0xb22f('0x5f')];switch(_0x3e4ec0[_0xb22f('0x5f')]){case'always':_0x587118=squel[_0xb22f('0x60')]()[_0xb22f('0x61')](_0xb22f('0x62'))[_0xb22f('0x63')](['phone',_0xb22f('0x64'),_0xb22f('0x65'),_0xb22f('0x66'),_0xb22f('0x54'),_0xb22f('0x67'),_0xb22f('0x4d')],squel['select']()[_0xb22f('0x68')](_0xb22f('0x69'),_0xb22f('0x69'))[_0xb22f('0x68')](_0xb22f('0x6a'),_0xb22f('0x64'))[_0xb22f('0x68')]('id',_0xb22f('0x65'))[_0xb22f('0x68')](_0x439da5[_0xb22f('0x6b')][_0xb22f('0x6c')](),_0xb22f('0x66'))[_0xb22f('0x68')](_0x2b521f[_0xb22f('0x3e')]['id'][_0xb22f('0x6c')](),_0xb22f('0x54'))[_0xb22f('0x68')](_0xb22f('0x6a'),_0xb22f('0x67'))[_0xb22f('0x68')](_0xb22f('0x6a'),_0xb22f('0x4d'))[_0xb22f('0x6d')](_0xb22f('0x6e'))[_0xb22f('0x37')](_0xb22f('0x6f'))[_0xb22f('0x37')](_0xb22f('0x70'),_0x439da5[_0xb22f('0x6b')]['toString']())[_0xb22f('0x37')](_0xb22f('0x71'))[_0xb22f('0x37')](_0xb22f('0x72'),squel[_0xb22f('0x73')]()[_0xb22f('0x68')](_0xb22f('0x74'))[_0xb22f('0x6d')]('cm_hopper_final')[_0xb22f('0x37')](_0xb22f('0x75'),_0x2b521f['params']['id'][_0xb22f('0x6c')]()))[_0xb22f('0x37')](_0xb22f('0x72'),squel[_0xb22f('0x73')]()[_0xb22f('0x68')](_0xb22f('0x76'))[_0xb22f('0x6d')](_0xb22f('0x62'))[_0xb22f('0x37')](_0xb22f('0x75'),_0x2b521f[_0xb22f('0x3e')]['id'][_0xb22f('0x6c')]())))[_0xb22f('0x6c')]();break;case _0xb22f('0x77'):_0x587118=squel[_0xb22f('0x60')]()[_0xb22f('0x61')](_0xb22f('0x62'))[_0xb22f('0x63')](['phone','scheduledAt','ContactId',_0xb22f('0x66'),'CampaignId','createdAt',_0xb22f('0x4d')],squel['select']()[_0xb22f('0x68')]('phone','phone')[_0xb22f('0x68')](_0xb22f('0x6a'),'scheduledAt')[_0xb22f('0x68')]('id','ContactId')[_0xb22f('0x68')](_0x439da5[_0xb22f('0x6b')][_0xb22f('0x6c')](),_0xb22f('0x66'))['field'](_0x2b521f[_0xb22f('0x3e')]['id'][_0xb22f('0x6c')](),_0xb22f('0x54'))['field']('NOW()',_0xb22f('0x67'))[_0xb22f('0x68')](_0xb22f('0x6a'),_0xb22f('0x4d'))['from'](_0xb22f('0x6e'))[_0xb22f('0x37')](_0xb22f('0x6f'))[_0xb22f('0x37')](_0xb22f('0x70'),_0x439da5['CmListId'][_0xb22f('0x6c')]())[_0xb22f('0x37')](_0xb22f('0x71'))[_0xb22f('0x37')](_0xb22f('0x72'),squel[_0xb22f('0x73')]()[_0xb22f('0x68')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')[_0xb22f('0x37')](_0xb22f('0x75'),_0x2b521f[_0xb22f('0x3e')]['id'][_0xb22f('0x6c')]())))[_0xb22f('0x6c')]();break;default:_0x587118=squel['insert']()[_0xb22f('0x61')](_0xb22f('0x62'))[_0xb22f('0x63')](['phone',_0xb22f('0x64'),_0xb22f('0x65'),_0xb22f('0x66'),_0xb22f('0x54'),_0xb22f('0x67'),_0xb22f('0x4d')],squel[_0xb22f('0x73')]()[_0xb22f('0x68')]('phone',_0xb22f('0x69'))[_0xb22f('0x68')]('NOW()',_0xb22f('0x64'))[_0xb22f('0x68')]('id',_0xb22f('0x65'))[_0xb22f('0x68')](_0x439da5[_0xb22f('0x6b')]['toString'](),_0xb22f('0x66'))[_0xb22f('0x68')](_0x2b521f['params']['id']['toString'](),_0xb22f('0x54'))[_0xb22f('0x68')](_0xb22f('0x6a'),_0xb22f('0x67'))[_0xb22f('0x68')]('NOW()',_0xb22f('0x4d'))[_0xb22f('0x6d')](_0xb22f('0x6e'))['where'](_0xb22f('0x6f'))[_0xb22f('0x37')](_0xb22f('0x70'),_0x439da5['CmListId'][_0xb22f('0x6c')]())[_0xb22f('0x37')](_0xb22f('0x71')))['toString']();}_0x576d72['push'](db[_0xb22f('0x78')][_0xb22f('0x2d')](_0x587118));}return BPromise[_0xb22f('0x79')](_0x576d72);}})['then'](function(){return _0x1a6d37;})[_0xb22f('0x22')](respondWithResult(_0x583d54,null))[_0xb22f('0x3d')](handleError(_0x583d54,null));};exports['removeLists']=function(_0x4fcb90,_0x51fba6,_0x294d03){return db['Campaign']['find']({'where':{'id':_0x4fcb90[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](handleEntityNotFound(_0x51fba6,null))[_0xb22f('0x22')](function(_0x4faf29){if(_0x4faf29){return _0x4faf29['removeLists'](_0x4fcb90['query'][_0xb22f('0x5d')]);}})[_0xb22f('0x22')](function(_0x21dcb6){if(_0x21dcb6){return db[_0xb22f('0x51')]['destroy']({'where':{'ListId':_0x4fcb90[_0xb22f('0x2d')][_0xb22f('0x5d')],'CampaignId':_0x4fcb90[_0xb22f('0x3e')]['id']}})['then'](function(){return _0x21dcb6;});}})[_0xb22f('0x22')](respondWithStatusCode(_0x51fba6,null))[_0xb22f('0x3d')](handleError(_0x51fba6,null));};exports['getBlackLists']=function(_0x3558da,_0x37c7a5,_0x2fb6cd){var _0x34bb6f={'raw':!![],'where':{}};var _0x17acff={};var _0x260fb0={'count':0x0,'rows':[]};return db[_0xb22f('0x28')][_0xb22f('0x50')]({'where':{'id':_0x3558da[_0xb22f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x37c7a5,null))[_0xb22f('0x22')](function(_0x257010){if(_0x257010){_0x17acff[_0xb22f('0x2c')]=_[_0xb22f('0x3f')](db[_0xb22f('0x5b')][_0xb22f('0x40')]);_0x17acff[_0xb22f('0x2d')]=_[_0xb22f('0x3f')](_0x3558da[_0xb22f('0x2d')]);_0x17acff[_0xb22f('0x2e')]=_['intersection'](_0x17acff[_0xb22f('0x2c')],_0x17acff[_0xb22f('0x2d')]);_0x34bb6f[_0xb22f('0x31')]=_[_0xb22f('0x2f')](_0x17acff[_0xb22f('0x2c')],qs[_0xb22f('0x30')](_0x3558da[_0xb22f('0x2d')]['fields']));_0x34bb6f[_0xb22f('0x31')]=_0x34bb6f['attributes']['length']?_0x34bb6f[_0xb22f('0x31')]:_0x17acff[_0xb22f('0x2c')];if(!_0x3558da[_0xb22f('0x2d')][_0xb22f('0x33')](_0xb22f('0x52'))){_0x34bb6f[_0xb22f('0x34')]=qs[_0xb22f('0x34')](_0x3558da[_0xb22f('0x2d')][_0xb22f('0x34')]);_0x34bb6f[_0xb22f('0x1c')]=qs['offset'](_0x3558da[_0xb22f('0x2d')][_0xb22f('0x1c')]);}_0x34bb6f[_0xb22f('0x35')]=qs[_0xb22f('0x36')](_0x3558da[_0xb22f('0x2d')][_0xb22f('0x36')]);_0x34bb6f[_0xb22f('0x37')]=qs[_0xb22f('0x2e')](_[_0xb22f('0x53')](_0x3558da[_0xb22f('0x2d')],_0x17acff[_0xb22f('0x2e')]));_0x34bb6f['where'][_0xb22f('0x54')]=_0x257010['id'];if(_0x3558da['query'][_0xb22f('0x38')]){_0x34bb6f[_0xb22f('0x37')]=_[_0xb22f('0x39')](_0x34bb6f['where'],{'$or':_['map'](_0x34bb6f[_0xb22f('0x31')],function(_0x2bae51){var _0x1cc6e3={};_0x1cc6e3[_0x2bae51]={'$like':'%'+_0x3558da[_0xb22f('0x2d')][_0xb22f('0x38')]+'%'};return _0x1cc6e3;})});}_0x34bb6f=_['merge']({},_0x34bb6f,_0x3558da['options']);return db[_0xb22f('0x5b')][_0xb22f('0x1b')]({'where':_0x34bb6f[_0xb22f('0x37')]})[_0xb22f('0x22')](function(_0x196eae){_0x260fb0[_0xb22f('0x1b')]=_0x196eae;if(_0x3558da[_0xb22f('0x2d')][_0xb22f('0x3a')]){_0x34bb6f[_0xb22f('0x3b')]=[{'all':!![]}];}return db[_0xb22f('0x5b')][_0xb22f('0x3c')](_0x34bb6f);})['then'](function(_0x413fc9){_0x260fb0[_0xb22f('0x55')]=_0x413fc9;return _0x260fb0;});}})[_0xb22f('0x22')](respondWithFilteredResult(_0x37c7a5,_0x34bb6f))[_0xb22f('0x3d')](handleError(_0x37c7a5,null));};exports[_0xb22f('0x7a')]=function(_0x566225,_0x307e55,_0x56a362){var _0xb64233,_0x5308a0;return db[_0xb22f('0x28')][_0xb22f('0x42')]({'where':{'id':_0x566225['params']['id']}})['then'](handleEntityNotFound(_0x307e55,null))['then'](function(_0x15cb82){if(_0x15cb82){_0x5308a0=_0x15cb82;return _0x15cb82['addBlackLists'](_0x566225['body'][_0xb22f('0x5d')],_[_0xb22f('0x4c')](_0x566225['body'],[_0xb22f('0x5d'),'id'])||{});}return null;})[_0xb22f('0x5e')](function(_0x45b259){var _0x1c526b;_0xb64233=_0x45b259||[];var _0xb114c4=[];if(_0x45b259){for(var _0x1a061c=0x0;_0x1a061c<_0x45b259[_0xb22f('0x32')];_0x1a061c+=0x1){var _0x4bc5f8=_0x45b259[_0x1a061c][_0xb22f('0x23')]({'plain':!![]});_0x1c526b=squel['insert']()[_0xb22f('0x61')]('cm_hopper_black')[_0xb22f('0x63')]([_0xb22f('0x69'),'ContactId',_0xb22f('0x66'),'CampaignId',_0xb22f('0x67'),_0xb22f('0x4d')],squel[_0xb22f('0x73')]()[_0xb22f('0x68')](_0xb22f('0x69'),_0xb22f('0x69'))[_0xb22f('0x68')]('id',_0xb22f('0x65'))[_0xb22f('0x68')](_0x4bc5f8[_0xb22f('0x6b')][_0xb22f('0x6c')](),_0xb22f('0x66'))[_0xb22f('0x68')](_0x566225['params']['id'][_0xb22f('0x6c')](),_0xb22f('0x54'))['field'](_0xb22f('0x6a'),_0xb22f('0x67'))[_0xb22f('0x68')]('NOW()',_0xb22f('0x4d'))[_0xb22f('0x6d')](_0xb22f('0x6e'))[_0xb22f('0x37')]('deletedAt\x20IS\x20NULL')[_0xb22f('0x37')](_0xb22f('0x70'),_0x4bc5f8[_0xb22f('0x6b')][_0xb22f('0x6c')]())[_0xb22f('0x37')]('phone\x20IS\x20NOT\x20NULL'))[_0xb22f('0x6c')]();_0xb114c4[_0xb22f('0x7b')](db[_0xb22f('0x78')][_0xb22f('0x2d')](_0x1c526b));}return BPromise[_0xb22f('0x79')](_0xb114c4);}})[_0xb22f('0x22')](function(){return _0xb64233;})[_0xb22f('0x22')](respondWithResult(_0x307e55,null))['catch'](handleError(_0x307e55,null));};exports[_0xb22f('0x7c')]=function(_0x470772,_0x4c3175,_0x30d337){return db[_0xb22f('0x28')][_0xb22f('0x42')]({'where':{'id':_0x470772[_0xb22f('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4c3175,null))['then'](function(_0x28eb08){if(_0x28eb08){return _0x28eb08[_0xb22f('0x7c')](_0x470772[_0xb22f('0x2d')]['ids']);}})[_0xb22f('0x22')](function(_0x261877){if(_0x261877){return db[_0xb22f('0x59')][_0xb22f('0x21')]({'where':{'ListId':_0x470772[_0xb22f('0x2d')][_0xb22f('0x5d')],'CampaignId':_0x470772[_0xb22f('0x3e')]['id']}})[_0xb22f('0x22')](function(){return _0x261877;});}})[_0xb22f('0x22')](respondWithStatusCode(_0x4c3175,null))['catch'](handleError(_0x4c3175,null));}; \ No newline at end of file +var _0x9bde=['model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','includeAll','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','body','autoAssociation','getHoppers','CmHopper','pick','rows','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','select','field','phone','NOW()','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','phone\x20IS\x20NOT\x20NULL','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','IvrCampaigns','sendStatus','stack','name','send','index','map','Campaign','rawAttributes','type','key'];(function(_0x4ef7d6,_0x5d2ca3){var _0x471cd1=function(_0x2f1af9){while(--_0x2f1af9){_0x4ef7d6['push'](_0x4ef7d6['shift']());}};_0x471cd1(++_0x5d2ca3);}(_0x9bde,0xe1));var _0xe9bd=function(_0x2ae288,_0x5b2700){_0x2ae288=_0x2ae288-0x0;var _0x1fcd38=_0x9bde[_0x2ae288];return _0x1fcd38;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9bd('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe9bd('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe9bd('0x2'));var moment=require(_0xe9bd('0x3'));var BPromise=require(_0xe9bd('0x4'));var Mustache=require(_0xe9bd('0x5'));var util=require(_0xe9bd('0x6'));var path=require(_0xe9bd('0x7'));var sox=require(_0xe9bd('0x8'));var csv=require('to-csv');var ejs=require(_0xe9bd('0x9'));var fs=require('fs');var _=require(_0xe9bd('0xa'));var squel=require(_0xe9bd('0xb'));var crypto=require(_0xe9bd('0xc'));var jsforce=require(_0xe9bd('0xd'));var deskjs=require(_0xe9bd('0xe'));var toCsv=require(_0xe9bd('0xf'));var querystring=require(_0xe9bd('0x10'));var Papa=require(_0xe9bd('0x11'));var Redis=require(_0xe9bd('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe9bd('0x13'));var hardwareService=require(_0xe9bd('0x14'));var logger=require(_0xe9bd('0x15'))('api');var utils=require(_0xe9bd('0x16'));var config=require(_0xe9bd('0x17'));var db=require(_0xe9bd('0x18'))['db'];function respondWithStatusCode(_0x141587,_0x5e022a){_0x5e022a=_0x5e022a||0xcc;return function(_0x2c1d98){if(_0x2c1d98){return _0x141587['sendStatus'](_0x5e022a);}return _0x141587[_0xe9bd('0x19')](_0x5e022a)[_0xe9bd('0x1a')]();};}function respondWithResult(_0x3435b4,_0x51109f){_0x51109f=_0x51109f||0xc8;return function(_0x47ba5e){if(_0x47ba5e){return _0x3435b4[_0xe9bd('0x19')](_0x51109f)[_0xe9bd('0x1b')](_0x47ba5e);}};}function respondWithFilteredResult(_0x3a9e5f,_0x46a59b){return function(_0x3360bd){if(_0x3360bd){var _0x389e7b=_0x3360bd[_0xe9bd('0x1c')],_0x45a9f2=_0x46a59b[_0xe9bd('0x1d')],_0x573350=_0x46a59b['offset']+_0x46a59b[_0xe9bd('0x1e')],_0x1d11a0;if(_0x573350>=_0x389e7b){_0x573350=_0x389e7b;_0x1d11a0=0xc8;}else{_0x1d11a0=0xce;}_0x3a9e5f[_0xe9bd('0x19')](_0x1d11a0);return _0x3a9e5f[_0xe9bd('0x1f')](_0xe9bd('0x20'),_0x45a9f2+'-'+_0x573350+'/'+_0x389e7b)['json'](_0x3360bd);}return null;};}function patchUpdates(_0x20ec32){return function(_0x50a5e8){try{jsonpatch[_0xe9bd('0x21')](_0x50a5e8,_0x20ec32,!![]);}catch(_0x55b869){return BPromise[_0xe9bd('0x22')](_0x55b869);}return _0x50a5e8[_0xe9bd('0x23')]();};}function saveUpdates(_0x134c4e,_0x3dda13){return function(_0x1acb82){if(_0x1acb82){return _0x1acb82[_0xe9bd('0x24')](_0x134c4e)[_0xe9bd('0x25')](function(_0x49165b){return _0x49165b;});}return null;};}function removeEntity(_0x133318,_0x28cd17){return function(_0x4ecaf5){if(_0x4ecaf5){return _0x4ecaf5[_0xe9bd('0x26')]()['then'](function(){var _0x238ab1=_0x4ecaf5[_0xe9bd('0x27')]({'plain':!![]});var _0x36f8c0=_0xe9bd('0x28');return db['UserProfileResource'][_0xe9bd('0x26')]({'where':{'type':_0x36f8c0,'resourceId':_0x238ab1['id']}})[_0xe9bd('0x25')](function(){return _0x4ecaf5;});})[_0xe9bd('0x25')](function(){_0x133318[_0xe9bd('0x19')](0xcc)[_0xe9bd('0x1a')]();});}};}function handleEntityNotFound(_0xb52d45,_0x399f3c){return function(_0x43ea90){if(!_0x43ea90){_0xb52d45[_0xe9bd('0x29')](0x194);}return _0x43ea90;};}function handleError(_0x5987af,_0x3c211a){_0x3c211a=_0x3c211a||0x1f4;return function(_0x38fdfa){logger['error'](_0x38fdfa[_0xe9bd('0x2a')]);if(_0x38fdfa[_0xe9bd('0x2b')]){delete _0x38fdfa[_0xe9bd('0x2b')];}_0x5987af[_0xe9bd('0x19')](_0x3c211a)[_0xe9bd('0x2c')](_0x38fdfa);};}exports[_0xe9bd('0x2d')]=function(_0x519f48,_0x5b7f1d){var _0x1de54c={},_0x56e409={},_0xa45eb0={'count':0x0,'rows':[]};var _0x1f2c0e=_[_0xe9bd('0x2e')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')],function(_0x509e36){return{'name':_0x509e36['fieldName'],'type':_0x509e36[_0xe9bd('0x31')][_0xe9bd('0x32')]};});_0x56e409[_0xe9bd('0x33')]=_[_0xe9bd('0x2e')](_0x1f2c0e,_0xe9bd('0x2b'));_0x56e409[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x519f48[_0xe9bd('0x34')]);_0x56e409[_0xe9bd('0x36')]=_['intersection'](_0x56e409[_0xe9bd('0x33')],_0x56e409[_0xe9bd('0x34')]);_0x1de54c[_0xe9bd('0x37')]=_['intersection'](_0x56e409['model'],qs[_0xe9bd('0x38')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x1de54c[_0xe9bd('0x37')]=_0x1de54c[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x1de54c[_0xe9bd('0x37')]:_0x56e409[_0xe9bd('0x33')];if(!_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x1de54c[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x519f48[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x1de54c[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x519f48[_0xe9bd('0x34')]['offset']);}_0x1de54c[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x519f48['query'][_0xe9bd('0x3d')]);_0x1de54c[_0xe9bd('0x3e')]=qs['filters'](_['pick'](_0x519f48[_0xe9bd('0x34')],_0x56e409[_0xe9bd('0x36')]));if(_0x519f48['query'][_0xe9bd('0x3f')]){_0x1de54c[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x1de54c['where'],{'$or':_[_0xe9bd('0x2e')](_0x1f2c0e,function(_0x4d1945){if(_0x4d1945[_0xe9bd('0x31')]!==_0xe9bd('0x41')){var _0x63d67c={};_0x63d67c[_0x4d1945[_0xe9bd('0x2b')]]={'$like':'%'+_0x519f48['query'][_0xe9bd('0x3f')]+'%'};return _0x63d67c;}})});}_0x1de54c=_[_0xe9bd('0x40')]({},_0x1de54c,_0x519f48[_0xe9bd('0x42')]);var _0x3f1212={'where':_0x1de54c[_0xe9bd('0x3e')]};return db[_0xe9bd('0x2f')][_0xe9bd('0x1c')](_0x3f1212)[_0xe9bd('0x25')](function(_0x2b5a71){_0xa45eb0[_0xe9bd('0x1c')]=_0x2b5a71;if(_0x519f48['query']['includeAll']){_0x1de54c[_0xe9bd('0x43')]=[{'all':!![]}];}return db['Campaign'][_0xe9bd('0x44')](_0x1de54c);})[_0xe9bd('0x25')](function(_0x41881a){_0xa45eb0['rows']=_0x41881a;return _0xa45eb0;})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5b7f1d,_0x1de54c))[_0xe9bd('0x45')](handleError(_0x5b7f1d,null));};exports[_0xe9bd('0x46')]=function(_0x5a4460,_0x2ef01b){var _0x3a5703={'raw':![],'where':{'id':_0x5a4460[_0xe9bd('0x47')]['id']}},_0x2b3cd7={};_0x2b3cd7[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x2b3cd7[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x5a4460[_0xe9bd('0x34')]);_0x2b3cd7[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x2b3cd7[_0xe9bd('0x33')],_0x2b3cd7[_0xe9bd('0x34')]);_0x3a5703['attributes']=_['intersection'](_0x2b3cd7[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x5a4460[_0xe9bd('0x34')]['fields']));_0x3a5703['attributes']=_0x3a5703[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3a5703[_0xe9bd('0x37')]:_0x2b3cd7[_0xe9bd('0x33')];if(_0x5a4460[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3a5703[_0xe9bd('0x43')]=[{'all':!![]}];}_0x3a5703=_['merge']({},_0x3a5703,_0x5a4460[_0xe9bd('0x42')]);return db['Campaign'][_0xe9bd('0x4a')](_0x3a5703)[_0xe9bd('0x25')](handleEntityNotFound(_0x2ef01b,null))[_0xe9bd('0x25')](respondWithResult(_0x2ef01b,null))[_0xe9bd('0x45')](handleError(_0x2ef01b,null));};exports[_0xe9bd('0x4b')]=function(_0x4b7b67,_0x3317d6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4b')](_0x4b7b67['body'],{})[_0xe9bd('0x25')](function(_0x476f23){var _0x34f787=_0x4b7b67['user'][_0xe9bd('0x27')]({'plain':!![]});if(!_0x34f787)throw new Error(_0xe9bd('0x4c'));if(_0x34f787[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0x1ee09c=_0x476f23['get']({'plain':!![]});var _0x3f4833='IvrCampaigns';return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x3f4833,'userProfileId':_0x34f787[_0xe9bd('0x50')]},'raw':!![]})[_0xe9bd('0x25')](function(_0x194b7d){if(_0x194b7d&&_0x194b7d['autoAssociation']===0x0){return db[_0xe9bd('0x51')]['create']({'name':_0x1ee09c[_0xe9bd('0x2b')],'resourceId':_0x1ee09c['id'],'type':_0x194b7d[_0xe9bd('0x2b')],'sectionId':_0x194b7d['id']},{})['then'](function(){return _0x476f23;});}else{return _0x476f23;}})['catch'](function(_0x1ce539){logger['error'](_0xe9bd('0x52'),_0x1ce539);throw _0x1ce539;});}return _0x476f23;})['then'](respondWithResult(_0x3317d6,0xc9))[_0xe9bd('0x45')](handleError(_0x3317d6,null));};exports[_0xe9bd('0x53')]=function(_0x5496d7,_0x55f619){var _0x4d6021={'where':{'id':_0x5496d7[_0xe9bd('0x47')]['id']}},_0x3aeda2={};_0x3aeda2[_0xe9bd('0x33')]=_['keys'](db[_0xe9bd('0x2f')][_0xe9bd('0x30')]);_0x4d6021[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x3aeda2['model'],qs['fields'](_0x5496d7[_0xe9bd('0x34')]['fields']));_0x4d6021[_0xe9bd('0x37')]=_0x4d6021[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x4d6021[_0xe9bd('0x37')]:_0x3aeda2[_0xe9bd('0x33')];if(_0x5496d7[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x4d6021[_0xe9bd('0x43')]=[{'all':!![]}];}_0x4d6021=_[_0xe9bd('0x40')]({},_0x4d6021,_0x5496d7[_0xe9bd('0x42')]);return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')](_0x4d6021)['then'](handleEntityNotFound(_0x55f619,null))['then'](function(_0x566dd8){if(_0x566dd8){var _0x10e685=_0x566dd8['get']({'plain':!![]});_0x10e685=qs[_0xe9bd('0x54')](_0x10e685,['id',_0xe9bd('0x55'),_0xe9bd('0x56')]);_0x5496d7[_0xe9bd('0x57')]=_[_0xe9bd('0x54')](_0x5496d7[_0xe9bd('0x57')],['id',_0xe9bd('0x55'),_0xe9bd('0x56')]);return db[_0xe9bd('0x2f')]['create'](_[_0xe9bd('0x40')](_0x10e685,_0x5496d7[_0xe9bd('0x57')]),{'include':_0x5496d7[_0xe9bd('0x34')][_0xe9bd('0x49')]?[{'all':!![]}]:undefined})['then'](function(_0x1c8765){var _0xc44b92=_0x5496d7[_0xe9bd('0x4e')]['get']({'plain':!![]});if(!_0xc44b92)throw new Error(_0xe9bd('0x4c'));if(_0xc44b92[_0xe9bd('0x4d')]===_0xe9bd('0x4e')){var _0xfe82f7=_0x1c8765['get']({'plain':!![]});var _0x4b3447=_0xe9bd('0x28');return db[_0xe9bd('0x4f')][_0xe9bd('0x4a')]({'where':{'name':_0x4b3447,'userProfileId':_0xc44b92[_0xe9bd('0x50')]},'raw':!![]})['then'](function(_0x49add9){if(_0x49add9&&_0x49add9[_0xe9bd('0x58')]===0x0){return db[_0xe9bd('0x51')][_0xe9bd('0x4b')]({'name':_0xfe82f7[_0xe9bd('0x2b')],'resourceId':_0xfe82f7['id'],'type':_0x49add9[_0xe9bd('0x2b')],'sectionId':_0x49add9['id']},{})[_0xe9bd('0x25')](function(){return _0x1c8765;});}else{return _0x1c8765;}})['catch'](function(_0x179c8d){logger['error'](_0xe9bd('0x52'),_0x179c8d);throw _0x179c8d;});}return _0x1c8765;});}})[_0xe9bd('0x25')](respondWithResult(_0x55f619,0xc9))[_0xe9bd('0x45')](handleError(_0x55f619,null));};exports[_0xe9bd('0x24')]=function(_0x5bc1f8,_0x1cc054){if(_0x5bc1f8[_0xe9bd('0x57')]['id']){delete _0x5bc1f8[_0xe9bd('0x57')]['id'];}return db['Campaign'][_0xe9bd('0x4a')]({'where':{'id':_0x5bc1f8[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x1cc054,null))[_0xe9bd('0x25')](saveUpdates(_0x5bc1f8[_0xe9bd('0x57')],null))[_0xe9bd('0x25')](respondWithResult(_0x1cc054,null))[_0xe9bd('0x45')](handleError(_0x1cc054,null));};exports[_0xe9bd('0x26')]=function(_0x38e2bf,_0x37bb08){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x38e2bf['params']['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x37bb08,null))[_0xe9bd('0x25')](removeEntity(_0x37bb08,null))['catch'](handleError(_0x37bb08,null));};exports[_0xe9bd('0x59')]=function(_0xe82570,_0x59b8be,_0x561165){var _0x3eeaa5={'raw':!![],'where':{}};var _0x4190f0={};var _0x4ec6ec={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0xe82570[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x59b8be,null))['then'](function(_0x4b5bfb){if(_0x4b5bfb){_0x4190f0['model']=_[_0xe9bd('0x35')](db[_0xe9bd('0x5a')][_0xe9bd('0x30')]);_0x4190f0['query']=_[_0xe9bd('0x35')](_0xe82570[_0xe9bd('0x34')]);_0x4190f0[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x4190f0['model'],_0x4190f0[_0xe9bd('0x34')]);_0x3eeaa5[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x4190f0['model'],qs['fields'](_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x3eeaa5[_0xe9bd('0x37')]=_0x3eeaa5[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x3eeaa5[_0xe9bd('0x37')]:_0x4190f0[_0xe9bd('0x33')];if(!_0xe82570[_0xe9bd('0x34')]['hasOwnProperty'](_0xe9bd('0x3b'))){_0x3eeaa5[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x3eeaa5['offset']=qs[_0xe9bd('0x1d')](_0xe82570['query']['offset']);}_0x3eeaa5[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0xe82570['query'][_0xe9bd('0x3d')]);_0x3eeaa5[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0xe82570['query'],_0x4190f0[_0xe9bd('0x36')]));_0x3eeaa5[_0xe9bd('0x3e')]['CampaignId']=_0x4b5bfb['id'];if(_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x3eeaa5[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x3eeaa5[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x3eeaa5[_0xe9bd('0x37')],function(_0x5e127b){var _0x1b0929={};_0x1b0929[_0x5e127b]={'$like':'%'+_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1b0929;})});}_0x3eeaa5=_[_0xe9bd('0x40')]({},_0x3eeaa5,_0xe82570[_0xe9bd('0x42')]);return db[_0xe9bd('0x5a')][_0xe9bd('0x1c')]({'where':_0x3eeaa5[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x5a7dfd){_0x4ec6ec[_0xe9bd('0x1c')]=_0x5a7dfd;if(_0xe82570[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x3eeaa5[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x5a')][_0xe9bd('0x44')](_0x3eeaa5);})[_0xe9bd('0x25')](function(_0x4b9c08){_0x4ec6ec[_0xe9bd('0x5c')]=_0x4b9c08;return _0x4ec6ec;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x59b8be,_0x3eeaa5))['catch'](handleError(_0x59b8be,null));};exports[_0xe9bd('0x5d')]=function(_0x17f733,_0x2d86b6,_0x2083c4){var _0x242110={'raw':!![],'where':{}};var _0x332228={};var _0x28331d={'count':0x0,'rows':[]};return db['Campaign']['findOne']({'where':{'id':_0x17f733[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x2d86b6,null))[_0xe9bd('0x25')](function(_0x1b863f){if(_0x1b863f){_0x332228[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x5e')]['rawAttributes']);_0x332228[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x17f733[_0xe9bd('0x34')]);_0x332228[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x332228[_0xe9bd('0x33')],_0x332228[_0xe9bd('0x34')]);_0x242110['attributes']=_['intersection'](_0x332228['model'],qs[_0xe9bd('0x38')](_0x17f733['query']['fields']));_0x242110['attributes']=_0x242110[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x242110[_0xe9bd('0x37')]:_0x332228[_0xe9bd('0x33')];if(!_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x242110[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x17f733['query'][_0xe9bd('0x1e')]);_0x242110['offset']=qs[_0xe9bd('0x1d')](_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x242110[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x17f733['query']['sort']);_0x242110['where']=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0x17f733['query'],_0x332228[_0xe9bd('0x36')]));_0x242110[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x1b863f['id'];if(_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x242110['where']=_[_0xe9bd('0x40')](_0x242110[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x242110[_0xe9bd('0x37')],function(_0x399429){var _0x1f9829={};_0x1f9829[_0x399429]={'$like':'%'+_0x17f733[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1f9829;})});}_0x242110=_[_0xe9bd('0x40')]({},_0x242110,_0x17f733[_0xe9bd('0x42')]);return db['CmHopperHistory']['count']({'where':_0x242110['where']})['then'](function(_0x4039c7){_0x28331d[_0xe9bd('0x1c')]=_0x4039c7;if(_0x17f733[_0xe9bd('0x34')]['includeAll']){_0x242110[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x5e')]['findAll'](_0x242110);})['then'](function(_0xb607c0){_0x28331d[_0xe9bd('0x5c')]=_0xb607c0;return _0x28331d;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x2d86b6,_0x242110))[_0xe9bd('0x45')](handleError(_0x2d86b6,null));};exports[_0xe9bd('0x60')]=function(_0x59364c,_0x5bd400,_0x499771){var _0x223f56={'raw':!![],'where':{}};var _0x2c7a14={};var _0x448f82={'count':0x0,'rows':[]};return db[_0xe9bd('0x2f')][_0xe9bd('0x61')]({'where':{'id':_0x59364c[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x5bd400,null))[_0xe9bd('0x25')](function(_0x2fae04){if(_0x2fae04){_0x2c7a14[_0xe9bd('0x33')]=_['keys'](db[_0xe9bd('0x62')]['rawAttributes']);_0x2c7a14[_0xe9bd('0x34')]=_['keys'](_0x59364c['query']);_0x2c7a14[_0xe9bd('0x36')]=_['intersection'](_0x2c7a14[_0xe9bd('0x33')],_0x2c7a14['query']);_0x223f56[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x2c7a14[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x223f56['attributes']=_0x223f56[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x223f56['attributes']:_0x2c7a14[_0xe9bd('0x33')];if(!_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3a')]('nolimit')){_0x223f56[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x223f56[_0xe9bd('0x1d')]=qs['offset'](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x223f56['order']=qs[_0xe9bd('0x3d')](_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x223f56[_0xe9bd('0x3e')]=qs['filters'](_[_0xe9bd('0x5b')](_0x59364c[_0xe9bd('0x34')],_0x2c7a14[_0xe9bd('0x36')]));_0x223f56[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x2fae04['id'];if(_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x223f56['where']=_[_0xe9bd('0x40')](_0x223f56['where'],{'$or':_[_0xe9bd('0x2e')](_0x223f56[_0xe9bd('0x37')],function(_0x11ac8d){var _0x5e08e0={};_0x5e08e0[_0x11ac8d]={'$like':'%'+_0x59364c[_0xe9bd('0x34')]['filter']+'%'};return _0x5e08e0;})});}_0x223f56=_[_0xe9bd('0x40')]({},_0x223f56,_0x59364c[_0xe9bd('0x42')]);return db[_0xe9bd('0x62')][_0xe9bd('0x1c')]({'where':_0x223f56[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x4f6a50){_0x448f82[_0xe9bd('0x1c')]=_0x4f6a50;if(_0x59364c[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x223f56[_0xe9bd('0x43')]=[{'all':!![]}];}return db['CmHopperFinal'][_0xe9bd('0x44')](_0x223f56);})[_0xe9bd('0x25')](function(_0x261af6){_0x448f82['rows']=_0x261af6;return _0x448f82;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x5bd400,_0x223f56))[_0xe9bd('0x45')](handleError(_0x5bd400,null));};exports['getHopperBlacks']=function(_0x59bfc1,_0x571fc1,_0x52df8f){var _0x458bff={'raw':!![],'where':{}};var _0x3b32a9={};var _0x1c0c0a={'count':0x0,'rows':[]};return db['Campaign'][_0xe9bd('0x61')]({'where':{'id':_0x59bfc1[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x571fc1,null))[_0xe9bd('0x25')](function(_0x35894c){if(_0x35894c){_0x3b32a9[_0xe9bd('0x33')]=_[_0xe9bd('0x35')](db[_0xe9bd('0x63')]['rawAttributes']);_0x3b32a9[_0xe9bd('0x34')]=_[_0xe9bd('0x35')](_0x59bfc1['query']);_0x3b32a9['filters']=_['intersection'](_0x3b32a9['model'],_0x3b32a9[_0xe9bd('0x34')]);_0x458bff[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x3b32a9[_0xe9bd('0x33')],qs['fields'](_0x59bfc1['query'][_0xe9bd('0x38')]));_0x458bff[_0xe9bd('0x37')]=_0x458bff[_0xe9bd('0x37')]['length']?_0x458bff[_0xe9bd('0x37')]:_0x3b32a9[_0xe9bd('0x33')];if(!_0x59bfc1['query']['hasOwnProperty'](_0xe9bd('0x3b'))){_0x458bff[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x458bff[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x458bff['order']=qs[_0xe9bd('0x3d')](_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x458bff[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_[_0xe9bd('0x5b')](_0x59bfc1['query'],_0x3b32a9[_0xe9bd('0x36')]));_0x458bff['where'][_0xe9bd('0x5f')]=_0x35894c['id'];if(_0x59bfc1['query'][_0xe9bd('0x3f')]){_0x458bff[_0xe9bd('0x3e')]=_['merge'](_0x458bff[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x458bff['attributes'],function(_0x95e011){var _0x9bd62a={};_0x9bd62a[_0x95e011]={'$like':'%'+_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x9bd62a;})});}_0x458bff=_['merge']({},_0x458bff,_0x59bfc1[_0xe9bd('0x42')]);return db[_0xe9bd('0x63')]['count']({'where':_0x458bff[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x2d5601){_0x1c0c0a['count']=_0x2d5601;if(_0x59bfc1[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x458bff[_0xe9bd('0x43')]=[{'all':!![]}];}return db[_0xe9bd('0x63')][_0xe9bd('0x44')](_0x458bff);})[_0xe9bd('0x25')](function(_0x136aa0){_0x1c0c0a['rows']=_0x136aa0;return _0x1c0c0a;});}})[_0xe9bd('0x25')](respondWithFilteredResult(_0x571fc1,_0x458bff))[_0xe9bd('0x45')](handleError(_0x571fc1,null));};exports[_0xe9bd('0x64')]=function(_0x5a0758,_0x67bd92,_0x57c26d){var _0x5ba105={};var _0x4e1eb8={};var _0x1939ed;var _0x48af68;return db['Campaign'][_0xe9bd('0x61')]({'where':{'id':_0x5a0758[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x67bd92,null))[_0xe9bd('0x25')](function(_0x48f4cd){if(_0x48f4cd){_0x1939ed=_0x48f4cd;_0x4e1eb8['model']=_['keys'](db[_0xe9bd('0x65')]['rawAttributes']);_0x4e1eb8['query']=_[_0xe9bd('0x35')](_0x5a0758[_0xe9bd('0x34')]);_0x4e1eb8[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x4e1eb8[_0xe9bd('0x33')],_0x4e1eb8[_0xe9bd('0x34')]);_0x5ba105[_0xe9bd('0x37')]=_['intersection'](_0x4e1eb8[_0xe9bd('0x33')],qs['fields'](_0x5a0758['query'][_0xe9bd('0x38')]));_0x5ba105[_0xe9bd('0x37')]=_0x5ba105[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x5ba105[_0xe9bd('0x37')]:_0x4e1eb8['model'];_0x5ba105[_0xe9bd('0x3c')]=qs[_0xe9bd('0x3d')](_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3d')]);_0x5ba105[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_['pick'](_0x5a0758[_0xe9bd('0x34')],_0x4e1eb8[_0xe9bd('0x36')]));if(_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3f')]){_0x5ba105[_0xe9bd('0x3e')]=_[_0xe9bd('0x40')](_0x5ba105['where'],{'$or':_[_0xe9bd('0x2e')](_0x5ba105[_0xe9bd('0x37')],function(_0x4d88c8){var _0x1e5c54={};_0x1e5c54[_0x4d88c8]={'$like':'%'+_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x1e5c54;})});}_0x5ba105=_[_0xe9bd('0x40')]({},_0x5ba105,_0x5a0758['options']);return _0x1939ed[_0xe9bd('0x64')](_0x5ba105);}})[_0xe9bd('0x25')](function(_0x4249f5){if(_0x4249f5){_0x48af68=_0x4249f5[_0xe9bd('0x39')];if(!_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x5ba105[_0xe9bd('0x1e')]=qs[_0xe9bd('0x1e')](_0x5a0758['query'][_0xe9bd('0x1e')]);_0x5ba105[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x5a0758[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}return _0x1939ed[_0xe9bd('0x64')](_0x5ba105);}})[_0xe9bd('0x25')](function(_0x4a8358){if(_0x4a8358){return _0x4a8358?{'count':_0x48af68,'rows':_0x4a8358}:null;}})[_0xe9bd('0x25')](respondWithResult(_0x67bd92,null))['catch'](handleError(_0x67bd92,null));};exports[_0xe9bd('0x66')]=function(_0xbc686e,_0x2db271,_0x1c2d6d){var _0x3f0e49,_0x2b8645;return db['Campaign'][_0xe9bd('0x4a')]({'where':{'id':_0xbc686e[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x2db271,null))['then'](function(_0x457536){if(_0x457536){_0x2b8645=_0x457536;return _0x457536[_0xe9bd('0x66')](_0xbc686e[_0xe9bd('0x57')][_0xe9bd('0x67')],_[_0xe9bd('0x54')](_0xbc686e[_0xe9bd('0x57')],[_0xe9bd('0x67'),'id'])||{});}return null;})[_0xe9bd('0x68')](function(_0x20a8ce){var _0x3b0874;_0x3f0e49=_0x20a8ce||[];var _0x5c0b2d=[];if(_0x20a8ce){for(var _0x464f7a=0x0;_0x464f7a<_0x20a8ce[_0xe9bd('0x39')];_0x464f7a+=0x1){var _0x31aae8=_0x20a8ce[_0x464f7a]['get']({'plain':!![]});_0x2b8645[_0xe9bd('0x69')]=_0xbc686e[_0xe9bd('0x57')][_0xe9bd('0x69')]?_0xbc686e['body']['dialCheckDuplicateType']:_0x2b8645[_0xe9bd('0x69')];switch(_0x2b8645[_0xe9bd('0x69')]){case _0xe9bd('0x6a'):_0x3b0874=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')](_0xe9bd('0x6d'))[_0xe9bd('0x6e')](['phone',_0xe9bd('0x6f'),_0xe9bd('0x70'),'ListId',_0xe9bd('0x5f'),_0xe9bd('0x55'),_0xe9bd('0x56')],squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x73'),_0xe9bd('0x73'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x6f'))[_0xe9bd('0x72')]('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),'ListId')[_0xe9bd('0x72')](_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')](),_0xe9bd('0x5f'))[_0xe9bd('0x72')]('NOW()',_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x56'))[_0xe9bd('0x77')](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())[_0xe9bd('0x3e')]('phone\x20IS\x20NOT\x20NULL')[_0xe9bd('0x3e')](_0xe9bd('0x7b'),squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x7c'))[_0xe9bd('0x77')](_0xe9bd('0x7d'))[_0xe9bd('0x3e')](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]()))[_0xe9bd('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x7f'))[_0xe9bd('0x77')](_0xe9bd('0x6d'))['where'](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]())))['toString']();break;case _0xe9bd('0x80'):_0x3b0874=squel[_0xe9bd('0x6b')]()['into']('cm_hopper')['fromQuery']([_0xe9bd('0x73'),_0xe9bd('0x6f'),'ContactId',_0xe9bd('0x81'),_0xe9bd('0x5f'),_0xe9bd('0x55'),'updatedAt'],squel[_0xe9bd('0x71')]()[_0xe9bd('0x72')](_0xe9bd('0x73'),_0xe9bd('0x73'))['field'](_0xe9bd('0x74'),_0xe9bd('0x6f'))['field']('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),'ListId')['field'](_0xbc686e['params']['id'][_0xe9bd('0x76')](),'CampaignId')[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x56'))['from'](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())['where'](_0xe9bd('0x82'))[_0xe9bd('0x3e')](_0xe9bd('0x7b'),squel[_0xe9bd('0x71')]()['field'](_0xe9bd('0x7f'))[_0xe9bd('0x77')](_0xe9bd('0x6d'))[_0xe9bd('0x3e')](_0xe9bd('0x7e'),_0xbc686e[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')]())))[_0xe9bd('0x76')]();break;default:_0x3b0874=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')](_0xe9bd('0x6d'))[_0xe9bd('0x6e')]([_0xe9bd('0x73'),'scheduledAt',_0xe9bd('0x70'),_0xe9bd('0x81'),'CampaignId',_0xe9bd('0x55'),_0xe9bd('0x56')],squel[_0xe9bd('0x71')]()['field'](_0xe9bd('0x73'),_0xe9bd('0x73'))[_0xe9bd('0x72')](_0xe9bd('0x74'),'scheduledAt')[_0xe9bd('0x72')]('id',_0xe9bd('0x70'))[_0xe9bd('0x72')](_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')](),_0xe9bd('0x81'))['field'](_0xbc686e[_0xe9bd('0x47')]['id']['toString'](),'CampaignId')[_0xe9bd('0x72')]('NOW()',_0xe9bd('0x55'))['field'](_0xe9bd('0x74'),_0xe9bd('0x56'))['from'](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')](_0xe9bd('0x7a'),_0x31aae8[_0xe9bd('0x75')][_0xe9bd('0x76')]())['where'](_0xe9bd('0x82')))[_0xe9bd('0x76')]();}_0x5c0b2d[_0xe9bd('0x83')](db[_0xe9bd('0x84')][_0xe9bd('0x34')](_0x3b0874));}return BPromise[_0xe9bd('0x85')](_0x5c0b2d);}})['then'](function(){return _0x3f0e49;})[_0xe9bd('0x25')](respondWithResult(_0x2db271,null))[_0xe9bd('0x45')](handleError(_0x2db271,null));};exports[_0xe9bd('0x86')]=function(_0x377e3f,_0x4747de,_0x5692ab){return db['Campaign']['find']({'where':{'id':_0x377e3f[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x4747de,null))[_0xe9bd('0x25')](function(_0x1c340c){if(_0x1c340c){return _0x1c340c['removeLists'](_0x377e3f[_0xe9bd('0x34')][_0xe9bd('0x67')]);}})[_0xe9bd('0x25')](function(_0x3d9732){if(_0x3d9732){return db[_0xe9bd('0x5a')][_0xe9bd('0x26')]({'where':{'ListId':_0x377e3f[_0xe9bd('0x34')]['ids'],'CampaignId':_0x377e3f['params']['id']}})[_0xe9bd('0x25')](function(){return _0x3d9732;});}})['then'](respondWithStatusCode(_0x4747de,null))['catch'](handleError(_0x4747de,null));};exports[_0xe9bd('0x87')]=function(_0x7de714,_0x63af04,_0x391b6b){var _0x2d2872={'raw':!![],'where':{}};var _0x43fe2f={};var _0x3a9bc4={'count':0x0,'rows':[]};return db[_0xe9bd('0x2f')][_0xe9bd('0x61')]({'where':{'id':_0x7de714[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x63af04,null))['then'](function(_0x287012){if(_0x287012){_0x43fe2f['model']=_[_0xe9bd('0x35')](db[_0xe9bd('0x65')][_0xe9bd('0x30')]);_0x43fe2f[_0xe9bd('0x34')]=_['keys'](_0x7de714[_0xe9bd('0x34')]);_0x43fe2f[_0xe9bd('0x36')]=_[_0xe9bd('0x48')](_0x43fe2f['model'],_0x43fe2f['query']);_0x2d2872[_0xe9bd('0x37')]=_[_0xe9bd('0x48')](_0x43fe2f[_0xe9bd('0x33')],qs[_0xe9bd('0x38')](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x38')]));_0x2d2872['attributes']=_0x2d2872[_0xe9bd('0x37')][_0xe9bd('0x39')]?_0x2d2872[_0xe9bd('0x37')]:_0x43fe2f[_0xe9bd('0x33')];if(!_0x7de714['query'][_0xe9bd('0x3a')](_0xe9bd('0x3b'))){_0x2d2872[_0xe9bd('0x1e')]=qs['limit'](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x1e')]);_0x2d2872[_0xe9bd('0x1d')]=qs[_0xe9bd('0x1d')](_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x1d')]);}_0x2d2872[_0xe9bd('0x3c')]=qs['sort'](_0x7de714['query'][_0xe9bd('0x3d')]);_0x2d2872[_0xe9bd('0x3e')]=qs[_0xe9bd('0x36')](_['pick'](_0x7de714['query'],_0x43fe2f[_0xe9bd('0x36')]));_0x2d2872[_0xe9bd('0x3e')][_0xe9bd('0x5f')]=_0x287012['id'];if(_0x7de714['query'][_0xe9bd('0x3f')]){_0x2d2872['where']=_[_0xe9bd('0x40')](_0x2d2872[_0xe9bd('0x3e')],{'$or':_[_0xe9bd('0x2e')](_0x2d2872[_0xe9bd('0x37')],function(_0x1c1593){var _0x7673f3={};_0x7673f3[_0x1c1593]={'$like':'%'+_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x3f')]+'%'};return _0x7673f3;})});}_0x2d2872=_[_0xe9bd('0x40')]({},_0x2d2872,_0x7de714['options']);return db['CmList'][_0xe9bd('0x1c')]({'where':_0x2d2872[_0xe9bd('0x3e')]})[_0xe9bd('0x25')](function(_0x2c0457){_0x3a9bc4[_0xe9bd('0x1c')]=_0x2c0457;if(_0x7de714[_0xe9bd('0x34')][_0xe9bd('0x49')]){_0x2d2872[_0xe9bd('0x43')]=[{'all':!![]}];}return db['CmList'][_0xe9bd('0x44')](_0x2d2872);})[_0xe9bd('0x25')](function(_0x55a0ec){_0x3a9bc4[_0xe9bd('0x5c')]=_0x55a0ec;return _0x3a9bc4;});}})['then'](respondWithFilteredResult(_0x63af04,_0x2d2872))[_0xe9bd('0x45')](handleError(_0x63af04,null));};exports[_0xe9bd('0x88')]=function(_0x401924,_0x5a7a61,_0x4c7419){var _0x1f0452,_0x488000;return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x401924[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](handleEntityNotFound(_0x5a7a61,null))[_0xe9bd('0x25')](function(_0x4eb22e){if(_0x4eb22e){_0x488000=_0x4eb22e;return _0x4eb22e[_0xe9bd('0x88')](_0x401924[_0xe9bd('0x57')][_0xe9bd('0x67')],_[_0xe9bd('0x54')](_0x401924[_0xe9bd('0x57')],[_0xe9bd('0x67'),'id'])||{});}return null;})['spread'](function(_0x39e8e5){var _0x5a2edb;_0x1f0452=_0x39e8e5||[];var _0x25d15b=[];if(_0x39e8e5){for(var _0x560ed7=0x0;_0x560ed7<_0x39e8e5[_0xe9bd('0x39')];_0x560ed7+=0x1){var _0x1ec28e=_0x39e8e5[_0x560ed7]['get']({'plain':!![]});_0x5a2edb=squel[_0xe9bd('0x6b')]()[_0xe9bd('0x6c')]('cm_hopper_black')[_0xe9bd('0x6e')](['phone','ContactId','ListId',_0xe9bd('0x5f'),_0xe9bd('0x55'),'updatedAt'],squel['select']()[_0xe9bd('0x72')]('phone',_0xe9bd('0x73'))[_0xe9bd('0x72')]('id','ContactId')[_0xe9bd('0x72')](_0x1ec28e[_0xe9bd('0x75')][_0xe9bd('0x76')](),_0xe9bd('0x81'))[_0xe9bd('0x72')](_0x401924[_0xe9bd('0x47')]['id'][_0xe9bd('0x76')](),_0xe9bd('0x5f'))[_0xe9bd('0x72')](_0xe9bd('0x74'),_0xe9bd('0x55'))[_0xe9bd('0x72')](_0xe9bd('0x74'),'updatedAt')[_0xe9bd('0x77')](_0xe9bd('0x78'))[_0xe9bd('0x3e')](_0xe9bd('0x79'))[_0xe9bd('0x3e')]('ListId\x20=\x20?',_0x1ec28e[_0xe9bd('0x75')][_0xe9bd('0x76')]())[_0xe9bd('0x3e')](_0xe9bd('0x82')))[_0xe9bd('0x76')]();_0x25d15b[_0xe9bd('0x83')](db[_0xe9bd('0x84')]['query'](_0x5a2edb));}return BPromise[_0xe9bd('0x85')](_0x25d15b);}})[_0xe9bd('0x25')](function(){return _0x1f0452;})['then'](respondWithResult(_0x5a7a61,null))[_0xe9bd('0x45')](handleError(_0x5a7a61,null));};exports[_0xe9bd('0x89')]=function(_0x3ea71a,_0x271ab8,_0x24aef6){return db[_0xe9bd('0x2f')][_0xe9bd('0x4a')]({'where':{'id':_0x3ea71a[_0xe9bd('0x47')]['id']}})['then'](handleEntityNotFound(_0x271ab8,null))[_0xe9bd('0x25')](function(_0x1b52e2){if(_0x1b52e2){return _0x1b52e2[_0xe9bd('0x89')](_0x3ea71a['query'][_0xe9bd('0x67')]);}})[_0xe9bd('0x25')](function(_0x5ceed4){if(_0x5ceed4){return db['CmHopperBlack'][_0xe9bd('0x26')]({'where':{'ListId':_0x3ea71a['query'][_0xe9bd('0x67')],'CampaignId':_0x3ea71a[_0xe9bd('0x47')]['id']}})[_0xe9bd('0x25')](function(){return _0x5ceed4;});}})[_0xe9bd('0x25')](respondWithStatusCode(_0x271ab8,null))[_0xe9bd('0x45')](handleError(_0x271ab8,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 18ad0cb..4b9303a 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 _0x268d=['Campaign','campaigns','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x56970c,_0x9ce0f1){var _0x5b764c=function(_0x118339){while(--_0x118339){_0x56970c['push'](_0x56970c['shift']());}};_0x5b764c(++_0x9ce0f1);}(_0x268d,0x195));var _0xd268=function(_0x53f944,_0x4aad32){_0x53f944=_0x53f944-0x0;var _0x303d90=_0x268d[_0x53f944];return _0x303d90;};'use strict';var _=require(_0xd268('0x0'));var util=require(_0xd268('0x1'));var logger=require('../../config/logger')(_0xd268('0x2'));var moment=require(_0xd268('0x3'));var BPromise=require(_0xd268('0x4'));var rp=require(_0xd268('0x5'));var fs=require('fs');var path=require(_0xd268('0x6'));var rimraf=require(_0xd268('0x7'));var config=require(_0xd268('0x8'));var attributes=require('./campaign.attributes');module[_0xd268('0x9')]=function(_0x1e87c1,_0x9b8533){return _0x1e87c1[_0xd268('0xa')](_0xd268('0xb'),attributes,{'tableName':_0xd268('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe57=['exports','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2d9e0d,_0x171441){var _0x241da1=function(_0x3491d0){while(--_0x3491d0){_0x2d9e0d['push'](_0x2d9e0d['shift']());}};_0x241da1(++_0x171441);}(_0xfe57,0x191));var _0x7fe5=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xfe57[_0x506d83];return _0x335e8b;};'use strict';var _=require(_0x7fe5('0x0'));var util=require('util');var logger=require(_0x7fe5('0x1'))(_0x7fe5('0x2'));var moment=require(_0x7fe5('0x3'));var BPromise=require(_0x7fe5('0x4'));var rp=require(_0x7fe5('0x5'));var fs=require('fs');var path=require(_0x7fe5('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./campaign.attributes');module[_0x7fe5('0x7')]=function(_0x4ced14,_0x5c2ac0){return _0x4ced14['define']('Campaign',attributes,{'tableName':'campaigns','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 703d1cc..065777b 100644 --- a/server/api/campaign/campaign.rpc.js +++ b/server/api/campaign/campaign.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','Campaign','findAll','options','raw','where','attributes','include','map','model','GetCampaign','stringify','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','code','error','message','result'];(function(_0x166758,_0x26f2ec){var _0x190126=function(_0x23b78a){while(--_0x23b78a){_0x166758['push'](_0x166758['shift']());}};_0x190126(++_0x26f2ec);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}exports['GetCampaign']=function(_0x459eb1){var _0x478723=this;return new Promise(function(_0x106033,_0x205fd6){return db[_0x0a9e('0x14')][_0x0a9e('0x15')]({'raw':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x459eb1[_0x0a9e('0x16')]?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x18')]||null:null,'attributes':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x19')]||null:null,'limit':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')]['limit']||null:null,'include':_0x459eb1['options']?_0x459eb1[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x459eb1[_0x0a9e('0x16')]['include'],function(_0xfb6e48){return{'model':db[_0xfb6e48[_0x0a9e('0x1c')]],'as':_0xfb6e48['as'],'attributes':_0xfb6e48[_0x0a9e('0x19')],'include':_0xfb6e48[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0xfb6e48[_0x0a9e('0x1a')],function(_0x16b1ca){return{'model':db[_0x16b1ca['model']],'as':_0x16b1ca['as'],'attributes':_0x16b1ca['attributes'],'include':_0x16b1ca[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x16b1ca[_0x0a9e('0x1a')],function(_0x33161b){return{'model':db[_0x33161b['model']],'as':_0x33161b['as'],'attributes':_0x33161b[_0x0a9e('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x45a1e7){logger['info'](_0x0a9e('0x1d'),_0x459eb1);logger[_0x0a9e('0xd')](_0x0a9e('0x1d'),_0x459eb1,JSON[_0x0a9e('0x1e')](_0x45a1e7));_0x106033(_0x45a1e7);})[_0x0a9e('0x13')](function(_0x1538a4){logger[_0x0a9e('0x10')](_0x0a9e('0x1d'),_0x1538a4['message'],_0x459eb1);_0x205fd6(_0x478723[_0x0a9e('0x10')](0x1f4,_0x1538a4[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0x9957=['catch','GetCampaign','findAll','raw','options','where','attributes','limit','map','include','model','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2f90ff,_0x4b9ee2){var _0x56b690=function(_0xf714){while(--_0xf714){_0x2f90ff['push'](_0x2f90ff['shift']());}};_0x56b690(++_0x4b9ee2);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Campaign,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});}exports[_0x7995('0x18')]=function(_0x291317){var _0x1e1415=this;return new Promise(function(_0x37a7d4,_0x4faa60){return db['Campaign'][_0x7995('0x19')]({'raw':_0x291317['options']?_0x291317['options'][_0x7995('0x1a')]===undefined?!![]:![]:!![],'where':_0x291317[_0x7995('0x1b')]?_0x291317['options'][_0x7995('0x1c')]||null:null,'attributes':_0x291317['options']?_0x291317['options'][_0x7995('0x1d')]||null:null,'limit':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')][_0x7995('0x1e')]||null:null,'include':_0x291317[_0x7995('0x1b')]?_0x291317[_0x7995('0x1b')]['include']?_[_0x7995('0x1f')](_0x291317[_0x7995('0x1b')][_0x7995('0x20')],function(_0x285437){return{'model':db[_0x285437[_0x7995('0x21')]],'as':_0x285437['as'],'attributes':_0x285437[_0x7995('0x1d')],'include':_0x285437[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x285437['include'],function(_0x39df42){return{'model':db[_0x39df42[_0x7995('0x21')]],'as':_0x39df42['as'],'attributes':_0x39df42[_0x7995('0x1d')],'include':_0x39df42[_0x7995('0x20')]?_[_0x7995('0x1f')](_0x39df42[_0x7995('0x20')],function(_0x56691a){return{'model':db[_0x56691a[_0x7995('0x21')]],'as':_0x56691a['as'],'attributes':_0x56691a['attributes']};}):[]};}):[]};}):[]:[]})[_0x7995('0xc')](function(_0x49bc7e){logger[_0x7995('0xd')](_0x7995('0x18'),_0x291317);logger[_0x7995('0x10')]('GetCampaign',_0x291317,JSON[_0x7995('0x12')](_0x49bc7e));_0x37a7d4(_0x49bc7e);})['catch'](function(_0x456a28){logger[_0x7995('0x13')](_0x7995('0x18'),_0x456a28['message'],_0x291317);_0x4faa60(_0x1e1415['error'](0x1f4,_0x456a28['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 04fa3fe..aaca0ad 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 _0xf99c=['/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addLists','put','update','delete','destroy','removeLists','multer','util','path','connect-timeout','Router','../../components/interaction/service','./campaign.controller','get','isAuthenticated','index'];(function(_0x5c1f07,_0x35d59e){var _0x22c4d3=function(_0x5ceac3){while(--_0x5ceac3){_0x5c1f07['push'](_0x5c1f07['shift']());}};_0x22c4d3(++_0x35d59e);}(_0xf99c,0x1b6));var _0xcf99=function(_0x28829b,_0x4bf06a){_0x28829b=_0x28829b-0x0;var _0x29eb77=_0xf99c[_0x28829b];return _0x29eb77;};'use strict';var multer=require(_0xcf99('0x0'));var util=require(_0xcf99('0x1'));var path=require(_0xcf99('0x2'));var timeout=require(_0xcf99('0x3'));var express=require('express');var router=express[_0xcf99('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcf99('0x5'));var config=require('../../config/environment');var controller=require(_0xcf99('0x6'));router[_0xcf99('0x7')]('/',auth[_0xcf99('0x8')](),controller[_0xcf99('0x9')]);router[_0xcf99('0x7')](_0xcf99('0xa'),auth[_0xcf99('0x8')](),controller[_0xcf99('0xb')]);router[_0xcf99('0x7')](_0xcf99('0xc'),auth[_0xcf99('0x8')](),controller[_0xcf99('0xd')]);router[_0xcf99('0x7')](_0xcf99('0xe'),auth[_0xcf99('0x8')](),controller[_0xcf99('0xf')]);router[_0xcf99('0x7')]('/:id/hopper_finals',auth['isAuthenticated'](),controller[_0xcf99('0x10')]);router[_0xcf99('0x7')](_0xcf99('0x11'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x12')]);router[_0xcf99('0x7')](_0xcf99('0x13'),auth[_0xcf99('0x8')](),controller['getLists']);router[_0xcf99('0x7')](_0xcf99('0x14'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x15')]);router[_0xcf99('0x16')]('/',auth[_0xcf99('0x8')](),controller[_0xcf99('0x17')]);router[_0xcf99('0x16')](_0xcf99('0x18'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x19')]);router[_0xcf99('0x16')](_0xcf99('0x13'),auth['isAuthenticated'](),controller[_0xcf99('0x1a')]);router[_0xcf99('0x16')](_0xcf99('0x14'),auth[_0xcf99('0x8')](),controller['addBlackLists']);router[_0xcf99('0x1b')](_0xcf99('0xa'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x1c')]);router[_0xcf99('0x1d')](_0xcf99('0xa'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x1e')]);router[_0xcf99('0x1d')](_0xcf99('0x13'),auth[_0xcf99('0x8')](),controller[_0xcf99('0x1f')]);router[_0xcf99('0x1d')](_0xcf99('0x14'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0xb111=['getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addBlackLists','put','update','delete','destroy','removeLists','removeBlackLists','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getHoppers','/:id/hopper_histories','getHopperHistories'];(function(_0x2e436b,_0x17c82d){var _0x382742=function(_0x3611b2){while(--_0x3611b2){_0x2e436b['push'](_0x2e436b['shift']());}};_0x382742(++_0x17c82d);}(_0xb111,0x189));var _0x1b11=function(_0x3911cc,_0x484843){_0x3911cc=_0x3911cc-0x0;var _0x2bc606=_0xb111[_0x3911cc];return _0x2bc606;};'use strict';var multer=require(_0x1b11('0x0'));var util=require(_0x1b11('0x1'));var path=require('path');var timeout=require(_0x1b11('0x2'));var express=require(_0x1b11('0x3'));var router=express[_0x1b11('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x1b11('0x5'));var config=require(_0x1b11('0x6'));var controller=require('./campaign.controller');router[_0x1b11('0x7')]('/',auth[_0x1b11('0x8')](),controller[_0x1b11('0x9')]);router['get'](_0x1b11('0xa'),auth[_0x1b11('0x8')](),controller[_0x1b11('0xb')]);router[_0x1b11('0x7')]('/:id/hoppers',auth[_0x1b11('0x8')](),controller[_0x1b11('0xc')]);router[_0x1b11('0x7')](_0x1b11('0xd'),auth[_0x1b11('0x8')](),controller[_0x1b11('0xe')]);router[_0x1b11('0x7')]('/:id/hopper_finals',auth[_0x1b11('0x8')](),controller[_0x1b11('0xf')]);router['get'](_0x1b11('0x10'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x11')]);router[_0x1b11('0x7')](_0x1b11('0x12'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x13')]);router[_0x1b11('0x7')](_0x1b11('0x14'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x15')]);router[_0x1b11('0x16')]('/',auth['isAuthenticated'](),controller[_0x1b11('0x17')]);router[_0x1b11('0x16')](_0x1b11('0x18'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x19')]);router[_0x1b11('0x16')](_0x1b11('0x12'),auth['isAuthenticated'](),controller['addLists']);router[_0x1b11('0x16')]('/:id/blacklists',auth[_0x1b11('0x8')](),controller[_0x1b11('0x1a')]);router[_0x1b11('0x1b')](_0x1b11('0xa'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x1c')]);router[_0x1b11('0x1d')](_0x1b11('0xa'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x1e')]);router[_0x1b11('0x1d')](_0x1b11('0x12'),auth[_0x1b11('0x8')](),controller[_0x1b11('0x1f')]);router[_0x1b11('0x1d')]('/:id/blacklists',auth[_0x1b11('0x8')](),controller[_0x1b11('0x20')]);module[_0x1b11('0x21')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 1bcdf1e..c60fb56 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 _0x8f42=['STRING','VIRTUAL','getDataValue','key','sequelize','exports'];(function(_0x11ba32,_0x5a7ba6){var _0x296558=function(_0x53d575){while(--_0x53d575){_0x11ba32['push'](_0x11ba32['shift']());}};_0x296558(++_0x5a7ba6);}(_0x8f42,0x8e));var _0x28f4=function(_0x53fa23,_0x5c6cb6){_0x53fa23=_0x53fa23-0x0;var _0x31b974=_0x8f42[_0x53fa23];return _0x31b974;};'use strict';var Sequelize=require(_0x28f4('0x0'));module[_0x28f4('0x1')]={'key':{'type':Sequelize[_0x28f4('0x2')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x28f4('0x3')],'get':function(){return this[_0x28f4('0x4')](_0x28f4('0x5'));}}}; \ No newline at end of file +var _0xcbfc=['getDataValue','sequelize','STRING','TEXT'];(function(_0x2a6387,_0x4c5702){var _0xfc7c54=function(_0x23ac08){while(--_0x23ac08){_0x2a6387['push'](_0x2a6387['shift']());}};_0xfc7c54(++_0x4c5702);}(_0xcbfc,0x1b9));var _0xccbf=function(_0x7be23c,_0x368608){_0x7be23c=_0x7be23c-0x0;var _0x46b4f5=_0xcbfc[_0x7be23c];return _0x46b4f5;};'use strict';var Sequelize=require(_0xccbf('0x0'));module['exports']={'key':{'type':Sequelize[_0xccbf('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0xccbf('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xccbf('0x1')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xccbf('0x3')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 4fcae74..044a0b7 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 _0x9957=['limit','set','Content-Range','reject','save','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','filter','options','CannedAnswer','count','include','catch','show','params','keys','length','includeAll','find','update','body','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x4eb02e,_0x2011ce){var _0x582c29=function(_0x41b4b5){while(--_0x41b4b5){_0x4eb02e['push'](_0x4eb02e['shift']());}};_0x582c29(++_0x2011ce);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];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(){var _0x32a09a=_0x460924[_0x7995('0x26')]({'plain':!![]});var _0x204507=_0x7995('0x27');return db[_0x7995('0x28')][_0x7995('0x25')]({'where':{'type':_0x204507,'resourceId':_0x32a09a['id']}})[_0x7995('0x24')](function(){return _0x460924;});})[_0x7995('0x24')](function(){_0x350fd9['status'](0xcc)[_0x7995('0x1c')]();});}};}function handleEntityNotFound(_0x34e70c,_0x401dc3){return function(_0x268ce7){if(!_0x268ce7){_0x34e70c[_0x7995('0x1a')](0x194);}return _0x268ce7;};}function handleError(_0x2a307e,_0x56691a){_0x56691a=_0x56691a||0x1f4;return function(_0x47625f){logger['error'](_0x47625f[_0x7995('0x29')]);if(_0x47625f[_0x7995('0x2a')]){delete _0x47625f[_0x7995('0x2a')];}_0x2a307e[_0x7995('0x1b')](_0x56691a)[_0x7995('0x2b')](_0x47625f);};}exports['index']=function(_0x9b2a15,_0x514445){var _0x456a28={},_0x3250e0={},_0x4253e5={'count':0x0,'rows':[]};var _0x574574=_['map'](db['CannedAnswer'][_0x7995('0x2c')],function(_0xe6b0b3){return{'name':_0xe6b0b3[_0x7995('0x2d')],'type':_0xe6b0b3[_0x7995('0x2e')][_0x7995('0x2f')]};});_0x3250e0[_0x7995('0x30')]=_['map'](_0x574574,'name');_0x3250e0[_0x7995('0x31')]=_['keys'](_0x9b2a15[_0x7995('0x31')]);_0x3250e0[_0x7995('0x32')]=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],_0x3250e0[_0x7995('0x31')]);_0x456a28['attributes']=_[_0x7995('0x33')](_0x3250e0[_0x7995('0x30')],qs['fields'](_0x9b2a15['query']['fields']));_0x456a28[_0x7995('0x34')]=_0x456a28[_0x7995('0x34')]['length']?_0x456a28[_0x7995('0x34')]:_0x3250e0['model'];if(!_0x9b2a15[_0x7995('0x31')][_0x7995('0x35')](_0x7995('0x36'))){_0x456a28['limit']=qs['limit'](_0x9b2a15[_0x7995('0x31')]['limit']);_0x456a28['offset']=qs[_0x7995('0x1e')](_0x9b2a15[_0x7995('0x31')]['offset']);}_0x456a28[_0x7995('0x37')]=qs[_0x7995('0x38')](_0x9b2a15[_0x7995('0x31')][_0x7995('0x38')]);_0x456a28[_0x7995('0x39')]=qs['filters'](_[_0x7995('0x3a')](_0x9b2a15[_0x7995('0x31')],_0x3250e0[_0x7995('0x32')]));if(_0x9b2a15[_0x7995('0x31')]['filter']){_0x456a28[_0x7995('0x39')]=_[_0x7995('0x3b')](_0x456a28[_0x7995('0x39')],{'$or':_[_0x7995('0x3c')](_0x574574,function(_0x1f5bee){if(_0x1f5bee[_0x7995('0x2e')]!=='VIRTUAL'){var _0x183a68={};_0x183a68[_0x1f5bee[_0x7995('0x2a')]]={'$like':'%'+_0x9b2a15[_0x7995('0x31')][_0x7995('0x3d')]+'%'};return _0x183a68;}})});}_0x456a28=_[_0x7995('0x3b')]({},_0x456a28,_0x9b2a15[_0x7995('0x3e')]);var _0x14d638={'where':_0x456a28[_0x7995('0x39')]};return db[_0x7995('0x3f')][_0x7995('0x40')](_0x14d638)[_0x7995('0x24')](function(_0x270d52){_0x4253e5[_0x7995('0x40')]=_0x270d52;if(_0x9b2a15['query']['includeAll']){_0x456a28[_0x7995('0x41')]=[{'all':!![]}];}return db[_0x7995('0x3f')]['findAll'](_0x456a28);})['then'](function(_0x3f8522){_0x4253e5['rows']=_0x3f8522;return _0x4253e5;})['then'](respondWithFilteredResult(_0x514445,_0x456a28))[_0x7995('0x42')](handleError(_0x514445,null));};exports[_0x7995('0x43')]=function(_0x35c8ff,_0x576b96){var _0x46ac4f={'raw':!![],'where':{'id':_0x35c8ff[_0x7995('0x44')]['id']}},_0x5e85b9={};_0x5e85b9['model']=_['keys'](db[_0x7995('0x3f')][_0x7995('0x2c')]);_0x5e85b9[_0x7995('0x31')]=_[_0x7995('0x45')](_0x35c8ff['query']);_0x5e85b9[_0x7995('0x32')]=_[_0x7995('0x33')](_0x5e85b9[_0x7995('0x30')],_0x5e85b9[_0x7995('0x31')]);_0x46ac4f['attributes']=_['intersection'](_0x5e85b9[_0x7995('0x30')],qs['fields'](_0x35c8ff[_0x7995('0x31')]['fields']));_0x46ac4f[_0x7995('0x34')]=_0x46ac4f['attributes'][_0x7995('0x46')]?_0x46ac4f[_0x7995('0x34')]:_0x5e85b9['model'];if(_0x35c8ff[_0x7995('0x31')][_0x7995('0x47')]){_0x46ac4f[_0x7995('0x41')]=[{'all':!![]}];}_0x46ac4f=_[_0x7995('0x3b')]({},_0x46ac4f,_0x35c8ff['options']);return db[_0x7995('0x3f')][_0x7995('0x48')](_0x46ac4f)[_0x7995('0x24')](handleEntityNotFound(_0x576b96,null))['then'](respondWithResult(_0x576b96,null))[_0x7995('0x42')](handleError(_0x576b96,null));};exports[_0x7995('0x49')]=function(_0x511567,_0x3d8ae3){if(_0x511567[_0x7995('0x4a')]['id']){delete _0x511567['body']['id'];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':{'id':_0x511567['params']['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x3d8ae3,null))['then'](saveUpdates(_0x511567[_0x7995('0x4a')],null))[_0x7995('0x24')](respondWithResult(_0x3d8ae3,null))[_0x7995('0x42')](handleError(_0x3d8ae3,null));};exports[_0x7995('0x25')]=function(_0xddf537,_0x14b537){return db[_0x7995('0x3f')]['find']({'where':{'id':_0xddf537[_0x7995('0x44')]['id']}})[_0x7995('0x24')](handleEntityNotFound(_0x14b537,null))[_0x7995('0x24')](removeEntity(_0x14b537,null))['catch'](handleError(_0x14b537,null));};exports[_0x7995('0x4b')]=function(_0x1fe77e,_0x12d4b8){var _0x47d1d8={'key':_0x1fe77e['body']['key']};if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')]){_0x47d1d8['MailAccountId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4c')];}else if(_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4d')]){_0x47d1d8[_0x7995('0x4d')]=_0x1fe77e['body'][_0x7995('0x4d')];}else if(_0x1fe77e['body'][_0x7995('0x4e')]){_0x47d1d8[_0x7995('0x4e')]=_0x1fe77e[_0x7995('0x4a')]['OpenchannelAccountId'];}else if(_0x1fe77e['body']['ChatWebsiteId']){_0x47d1d8['ChatWebsiteId']=_0x1fe77e[_0x7995('0x4a')][_0x7995('0x4f')];}return db[_0x7995('0x3f')][_0x7995('0x48')]({'where':_0x47d1d8})[_0x7995('0x24')](function(_0x357e60){if(_0x357e60){throw new db[(_0x7995('0x50'))][(_0x7995('0x51'))](_0x7995('0x52'));}return db[_0x7995('0x3f')][_0x7995('0x4b')](_0x1fe77e[_0x7995('0x4a')]);})[_0x7995('0x24')](function(_0x35bea3){var _0x1ea1dc=_0x1fe77e[_0x7995('0x53')][_0x7995('0x26')]({'plain':!![]});if(!_0x1ea1dc)throw new Error(_0x7995('0x54'));if(_0x1ea1dc[_0x7995('0x55')]==='user'){var _0x56a374=_0x35bea3[_0x7995('0x26')]({'plain':!![]});return db[_0x7995('0x56')][_0x7995('0x48')]({'where':{'name':'CannedAnswers','userProfileId':_0x1ea1dc['userProfileId']},'raw':!![]})[_0x7995('0x24')](function(_0x197b52){if(_0x197b52&&_0x197b52[_0x7995('0x57')]===0x0){return db[_0x7995('0x28')]['create']({'name':_0x56a374[_0x7995('0x2a')],'resourceId':_0x56a374['id'],'type':_0x197b52[_0x7995('0x2a')],'sectionId':_0x197b52['id']},{})[_0x7995('0x24')](function(){return _0x35bea3;});}else{return _0x35bea3;}})[_0x7995('0x42')](function(_0x502d43){logger['error'](_0x7995('0x58'),_0x502d43);throw _0x502d43;});}return _0x35bea3;})[_0x7995('0x24')](respondWithResult(_0x12d4b8,0xc9))[_0x7995('0x42')](handleError(_0x12d4b8,null));}; \ No newline at end of file +var _0x34e8=['filters','intersection','attributes','fields','length','order','sort','pick','filter','where','merge','options','include','findAll','catch','show','includeAll','find','body','params','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','CannedAnswers','destroy','sendStatus','error','stack','name','map','CannedAnswer','rawAttributes','fieldName','type','key','model','keys','query'];(function(_0x265dcd,_0x1e86f7){var _0x1eea2c=function(_0x1c33c5){while(--_0x1c33c5){_0x265dcd['push'](_0x265dcd['shift']());}};_0x1eea2c(++_0x1e86f7);}(_0x34e8,0x12c));var _0x834e=function(_0x1e664d,_0x4a538d){_0x1e664d=_0x1e664d-0x0;var _0x3bf48b=_0x34e8[_0x1e664d];return _0x3bf48b;};'use strict';var pdf=require(_0x834e('0x0'));var emlformat=require(_0x834e('0x1'));var rimraf=require(_0x834e('0x2'));var zipdir=require(_0x834e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x834e('0x4'));var moment=require(_0x834e('0x5'));var BPromise=require(_0x834e('0x6'));var Mustache=require(_0x834e('0x7'));var util=require(_0x834e('0x8'));var path=require(_0x834e('0x9'));var sox=require(_0x834e('0xa'));var csv=require('to-csv');var ejs=require(_0x834e('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0x10'));var querystring=require(_0x834e('0x11'));var Papa=require(_0x834e('0x12'));var Redis=require(_0x834e('0x13'));var authService=require(_0x834e('0x14'));var qs=require(_0x834e('0x15'));var as=require(_0x834e('0x16'));var hardwareService=require(_0x834e('0x17'));var logger=require(_0x834e('0x18'))(_0x834e('0x19'));var utils=require(_0x834e('0x1a'));var config=require(_0x834e('0x1b'));var db=require(_0x834e('0x1c'))['db'];function respondWithStatusCode(_0x538bb3,_0x5e5b6d){_0x5e5b6d=_0x5e5b6d||0xcc;return function(_0x6cd9b9){if(_0x6cd9b9){return _0x538bb3['sendStatus'](_0x5e5b6d);}return _0x538bb3[_0x834e('0x1d')](_0x5e5b6d)[_0x834e('0x1e')]();};}function respondWithResult(_0x28e659,_0x21cc0a){_0x21cc0a=_0x21cc0a||0xc8;return function(_0x50e860){if(_0x50e860){return _0x28e659[_0x834e('0x1d')](_0x21cc0a)[_0x834e('0x1f')](_0x50e860);}};}function respondWithFilteredResult(_0x57274a,_0x316205){return function(_0x4a9cdc){if(_0x4a9cdc){var _0x38a8cd=_0x4a9cdc[_0x834e('0x20')],_0x36d443=_0x316205[_0x834e('0x21')],_0x478afe=_0x316205['offset']+_0x316205[_0x834e('0x22')],_0x43ac41;if(_0x478afe>=_0x38a8cd){_0x478afe=_0x38a8cd;_0x43ac41=0xc8;}else{_0x43ac41=0xce;}_0x57274a[_0x834e('0x1d')](_0x43ac41);return _0x57274a[_0x834e('0x23')](_0x834e('0x24'),_0x36d443+'-'+_0x478afe+'/'+_0x38a8cd)[_0x834e('0x1f')](_0x4a9cdc);}return null;};}function patchUpdates(_0x254677){return function(_0x1dd214){try{jsonpatch['apply'](_0x1dd214,_0x254677,!![]);}catch(_0x2545b4){return BPromise[_0x834e('0x25')](_0x2545b4);}return _0x1dd214[_0x834e('0x26')]();};}function saveUpdates(_0x325a99,_0x4ab05d){return function(_0x45a630){if(_0x45a630){return _0x45a630[_0x834e('0x27')](_0x325a99)['then'](function(_0x1b4bdf){return _0x1b4bdf;});}return null;};}function removeEntity(_0x28d687,_0x8d406e){return function(_0x5c55ca){if(_0x5c55ca){return _0x5c55ca['destroy']()[_0x834e('0x28')](function(){var _0x34563b=_0x5c55ca['get']({'plain':!![]});var _0x25ee1d=_0x834e('0x29');return db['UserProfileResource'][_0x834e('0x2a')]({'where':{'type':_0x25ee1d,'resourceId':_0x34563b['id']}})[_0x834e('0x28')](function(){return _0x5c55ca;});})[_0x834e('0x28')](function(){_0x28d687['status'](0xcc)[_0x834e('0x1e')]();});}};}function handleEntityNotFound(_0x3e310f,_0x5e1cc5){return function(_0x5bef62){if(!_0x5bef62){_0x3e310f[_0x834e('0x2b')](0x194);}return _0x5bef62;};}function handleError(_0x508a1d,_0x2826ec){_0x2826ec=_0x2826ec||0x1f4;return function(_0x3f1b0b){logger[_0x834e('0x2c')](_0x3f1b0b[_0x834e('0x2d')]);if(_0x3f1b0b[_0x834e('0x2e')]){delete _0x3f1b0b[_0x834e('0x2e')];}_0x508a1d['status'](_0x2826ec)['send'](_0x3f1b0b);};}exports['index']=function(_0x58c1d7,_0x2c7a8d){var _0x567cea={},_0x106d6a={},_0x5dacc1={'count':0x0,'rows':[]};var _0xb5bc06=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x4551f5){return{'name':_0x4551f5[_0x834e('0x32')],'type':_0x4551f5[_0x834e('0x33')][_0x834e('0x34')]};});_0x106d6a[_0x834e('0x35')]=_['map'](_0xb5bc06,_0x834e('0x2e'));_0x106d6a['query']=_[_0x834e('0x36')](_0x58c1d7[_0x834e('0x37')]);_0x106d6a[_0x834e('0x38')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],_0x106d6a[_0x834e('0x37')]);_0x567cea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x106d6a[_0x834e('0x35')],qs[_0x834e('0x3b')](_0x58c1d7['query'][_0x834e('0x3b')]));_0x567cea[_0x834e('0x3a')]=_0x567cea[_0x834e('0x3a')][_0x834e('0x3c')]?_0x567cea['attributes']:_0x106d6a[_0x834e('0x35')];if(!_0x58c1d7[_0x834e('0x37')]['hasOwnProperty']('nolimit')){_0x567cea['limit']=qs[_0x834e('0x22')](_0x58c1d7[_0x834e('0x37')][_0x834e('0x22')]);_0x567cea[_0x834e('0x21')]=qs[_0x834e('0x21')](_0x58c1d7[_0x834e('0x37')]['offset']);}_0x567cea[_0x834e('0x3d')]=qs['sort'](_0x58c1d7[_0x834e('0x37')][_0x834e('0x3e')]);_0x567cea['where']=qs[_0x834e('0x38')](_[_0x834e('0x3f')](_0x58c1d7['query'],_0x106d6a['filters']));if(_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]){_0x567cea[_0x834e('0x41')]=_[_0x834e('0x42')](_0x567cea[_0x834e('0x41')],{'$or':_['map'](_0xb5bc06,function(_0x1c5ed6){if(_0x1c5ed6['type']!=='VIRTUAL'){var _0x1b2edf={};_0x1b2edf[_0x1c5ed6['name']]={'$like':'%'+_0x58c1d7[_0x834e('0x37')][_0x834e('0x40')]+'%'};return _0x1b2edf;}})});}_0x567cea=_[_0x834e('0x42')]({},_0x567cea,_0x58c1d7[_0x834e('0x43')]);var _0x2b7933={'where':_0x567cea['where']};return db[_0x834e('0x30')][_0x834e('0x20')](_0x2b7933)[_0x834e('0x28')](function(_0x58c5fb){_0x5dacc1[_0x834e('0x20')]=_0x58c5fb;if(_0x58c1d7[_0x834e('0x37')]['includeAll']){_0x567cea[_0x834e('0x44')]=[{'all':!![]}];}return db['CannedAnswer'][_0x834e('0x45')](_0x567cea);})[_0x834e('0x28')](function(_0x4a18bb){_0x5dacc1['rows']=_0x4a18bb;return _0x5dacc1;})[_0x834e('0x28')](respondWithFilteredResult(_0x2c7a8d,_0x567cea))[_0x834e('0x46')](handleError(_0x2c7a8d,null));};exports[_0x834e('0x47')]=function(_0xbc1571,_0x8ad264){var _0x23feea={'raw':!![],'where':{'id':_0xbc1571['params']['id']}},_0x195204={};_0x195204[_0x834e('0x35')]=_['keys'](db[_0x834e('0x30')]['rawAttributes']);_0x195204[_0x834e('0x37')]=_['keys'](_0xbc1571[_0x834e('0x37')]);_0x195204[_0x834e('0x38')]=_['intersection'](_0x195204[_0x834e('0x35')],_0x195204[_0x834e('0x37')]);_0x23feea[_0x834e('0x3a')]=_[_0x834e('0x39')](_0x195204[_0x834e('0x35')],qs[_0x834e('0x3b')](_0xbc1571[_0x834e('0x37')][_0x834e('0x3b')]));_0x23feea[_0x834e('0x3a')]=_0x23feea[_0x834e('0x3a')]['length']?_0x23feea[_0x834e('0x3a')]:_0x195204[_0x834e('0x35')];if(_0xbc1571['query'][_0x834e('0x48')]){_0x23feea[_0x834e('0x44')]=[{'all':!![]}];}_0x23feea=_[_0x834e('0x42')]({},_0x23feea,_0xbc1571[_0x834e('0x43')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x23feea)['then'](handleEntityNotFound(_0x8ad264,null))['then'](respondWithResult(_0x8ad264,null))[_0x834e('0x46')](handleError(_0x8ad264,null));};exports[_0x834e('0x27')]=function(_0x30568e,_0x40ff5a){if(_0x30568e[_0x834e('0x4a')]['id']){delete _0x30568e[_0x834e('0x4a')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x30568e[_0x834e('0x4b')]['id']}})[_0x834e('0x28')](handleEntityNotFound(_0x40ff5a,null))[_0x834e('0x28')](saveUpdates(_0x30568e[_0x834e('0x4a')],null))[_0x834e('0x28')](respondWithResult(_0x40ff5a,null))[_0x834e('0x46')](handleError(_0x40ff5a,null));};exports[_0x834e('0x2a')]=function(_0x1a3855,_0x3df078){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1a3855[_0x834e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3df078,null))[_0x834e('0x28')](removeEntity(_0x3df078,null))[_0x834e('0x46')](handleError(_0x3df078,null));};exports['create']=function(_0x3c00a3,_0x3b0988){var _0x55d491={'key':_0x3c00a3[_0x834e('0x4a')][_0x834e('0x34')]};if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')]){_0x55d491[_0x834e('0x4c')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4c')];}else if(_0x3c00a3['body'][_0x834e('0x4d')]){_0x55d491[_0x834e('0x4d')]=_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4d')];}else if(_0x3c00a3[_0x834e('0x4a')][_0x834e('0x4e')]){_0x55d491[_0x834e('0x4e')]=_0x3c00a3[_0x834e('0x4a')]['OpenchannelAccountId'];}else if(_0x3c00a3[_0x834e('0x4a')]['ChatWebsiteId']){_0x55d491[_0x834e('0x4f')]=_0x3c00a3['body'][_0x834e('0x4f')];}return db['CannedAnswer']['find']({'where':_0x55d491})[_0x834e('0x28')](function(_0x3e1bee){if(_0x3e1bee){throw new db['Sequelize']['ValidationError'](_0x834e('0x50'));}return db[_0x834e('0x30')][_0x834e('0x51')](_0x3c00a3[_0x834e('0x4a')]);})[_0x834e('0x28')](function(_0x315858){var _0x3d3f2b=_0x3c00a3[_0x834e('0x52')]['get']({'plain':!![]});if(!_0x3d3f2b)throw new Error(_0x834e('0x53'));if(_0x3d3f2b[_0x834e('0x54')]==='user'){var _0x281342=_0x315858['get']({'plain':!![]});return db[_0x834e('0x55')][_0x834e('0x49')]({'where':{'name':'CannedAnswers','userProfileId':_0x3d3f2b[_0x834e('0x56')]},'raw':!![]})[_0x834e('0x28')](function(_0x2de29a){if(_0x2de29a&&_0x2de29a[_0x834e('0x57')]===0x0){return db['UserProfileResource'][_0x834e('0x51')]({'name':_0x281342[_0x834e('0x2e')],'resourceId':_0x281342['id'],'type':_0x2de29a[_0x834e('0x2e')],'sectionId':_0x2de29a['id']},{})['then'](function(){return _0x315858;});}else{return _0x315858;}})[_0x834e('0x46')](function(_0x1fcae9){logger[_0x834e('0x2c')](_0x834e('0x58'),_0x1fcae9);throw _0x1fcae9;});}return _0x315858;})[_0x834e('0x28')](respondWithResult(_0x3b0988,0xc9))[_0x834e('0x46')](handleError(_0x3b0988,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 5de8aab..04b61fc 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 _0x9879=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','utf8mb4','util','../../config/logger'];(function(_0x39c46e,_0x156daf){var _0x583479=function(_0x27ecfd){while(--_0x27ecfd){_0x39c46e['push'](_0x39c46e['shift']());}};_0x583479(++_0x156daf);}(_0x9879,0x98));var _0x9987=function(_0xcea21f,_0x5a0da2){_0xcea21f=_0xcea21f-0x0;var _0xa1f43c=_0x9879[_0xcea21f];return _0xa1f43c;};'use strict';var _=require('lodash');var util=require(_0x9987('0x0'));var logger=require(_0x9987('0x1'))(_0x9987('0x2'));var moment=require(_0x9987('0x3'));var BPromise=require(_0x9987('0x4'));var rp=require(_0x9987('0x5'));var fs=require('fs');var path=require(_0x9987('0x6'));var rimraf=require(_0x9987('0x7'));var config=require(_0x9987('0x8'));var attributes=require(_0x9987('0x9'));module[_0x9987('0xa')]=function(_0x473510,_0x15193d){return _0x473510[_0x9987('0xb')](_0x9987('0xc'),attributes,{'tableName':'tools_canned_answers','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x9987('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x20bc=['utf8mb4_unicode_ci','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4'];(function(_0x389ae2,_0xfc71dd){var _0x460f87=function(_0x74d953){while(--_0x74d953){_0x389ae2['push'](_0x389ae2['shift']());}};_0x460f87(++_0xfc71dd);}(_0x20bc,0xb5));var _0xc20b=function(_0x60878f,_0x1166d3){_0x60878f=_0x60878f-0x0;var _0x1fbefb=_0x20bc[_0x60878f];return _0x1fbefb;};'use strict';var _=require(_0xc20b('0x0'));var util=require(_0xc20b('0x1'));var logger=require('../../config/logger')(_0xc20b('0x2'));var moment=require(_0xc20b('0x3'));var BPromise=require('bluebird');var rp=require(_0xc20b('0x4'));var fs=require('fs');var path=require(_0xc20b('0x5'));var rimraf=require(_0xc20b('0x6'));var config=require(_0xc20b('0x7'));var attributes=require(_0xc20b('0x8'));module[_0xc20b('0x9')]=function(_0x3230e8,_0x44cbfb){return _0x3230e8[_0xc20b('0xa')](_0xc20b('0xb'),attributes,{'tableName':_0xc20b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc20b('0xd'),'collate':_0xc20b('0xe')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 901aa52..812237a 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 _0x9996=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','CannedAnswer,\x20%s,\x20%s','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird'];(function(_0x1e2ac3,_0x27318b){var _0x519396=function(_0xcaa24a){while(--_0xcaa24a){_0x1e2ac3['push'](_0x1e2ac3['shift']());}};_0x519396(++_0x27318b);}(_0x9996,0x1f4));var _0x6999=function(_0x5cd6c9,_0x2e3005){_0x5cd6c9=_0x5cd6c9-0x0;var _0x51bba8=_0x9996[_0x5cd6c9];return _0x51bba8;};'use strict';var _=require(_0x6999('0x0'));var util=require(_0x6999('0x1'));var moment=require(_0x6999('0x2'));var BPromise=require(_0x6999('0x3'));var rs=require(_0x6999('0x4'));var fs=require('fs');var Redis=require(_0x6999('0x5'));var db=require(_0x6999('0x6'))['db'];var utils=require(_0x6999('0x7'));var logger=require(_0x6999('0x8'))(_0x6999('0x9'));var config=require(_0x6999('0xa'));var jayson=require(_0x6999('0xb'));var client=jayson[_0x6999('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xed4c8,_0x48da09,_0x566cf3){return new BPromise(function(_0x3a7b16,_0x3804f6){return client[_0x6999('0xd')](_0xed4c8,_0x566cf3)[_0x6999('0xe')](function(_0x2b2b69){logger[_0x6999('0xf')](_0x6999('0x10'),_0x48da09,'request\x20sent');logger['debug'](_0x6999('0x11'),_0x48da09,'request\x20sent',JSON[_0x6999('0x12')](_0x2b2b69));if(_0x2b2b69[_0x6999('0x13')]){if(_0x2b2b69['error'][_0x6999('0x14')]===0x1f4){logger[_0x6999('0x13')](_0x6999('0x10'),_0x48da09,_0x2b2b69['error'][_0x6999('0x15')]);return _0x3804f6(_0x2b2b69[_0x6999('0x13')][_0x6999('0x15')]);}logger[_0x6999('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x48da09,_0x2b2b69[_0x6999('0x13')]['message']);return _0x3a7b16(_0x2b2b69[_0x6999('0x13')][_0x6999('0x15')]);}else{logger['info'](_0x6999('0x10'),_0x48da09,_0x6999('0x16'));_0x3a7b16(_0x2b2b69['result'][_0x6999('0x15')]);}})[_0x6999('0x17')](function(_0x4dbccd){logger['error'](_0x6999('0x10'),_0x48da09,_0x4dbccd);_0x3804f6(_0x4dbccd);});});} \ No newline at end of file +var _0xcaff=['request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','CannedAnswer,\x20%s,\x20%s'];(function(_0x263a2f,_0x1e81e3){var _0x8020e8=function(_0x39f91a){while(--_0x39f91a){_0x263a2f['push'](_0x263a2f['shift']());}};_0x8020e8(++_0x1e81e3);}(_0xcaff,0xe6));var _0xfcaf=function(_0xd75918,_0x35865){_0xd75918=_0xd75918-0x0;var _0x147237=_0xcaff[_0xd75918];return _0x147237;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xfcaf('0x0'));var BPromise=require(_0xfcaf('0x1'));var rs=require(_0xfcaf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfcaf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xfcaf('0x4'))(_0xfcaf('0x5'));var config=require(_0xfcaf('0x6'));var jayson=require(_0xfcaf('0x7'));var client=jayson[_0xfcaf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c9747,_0x5ad222,_0x102e2a){return new BPromise(function(_0x32f773,_0x1ae595){return client[_0xfcaf('0x9')](_0x2c9747,_0x102e2a)[_0xfcaf('0xa')](function(_0x2bdcee){logger['info'](_0xfcaf('0xb'),_0x5ad222,_0xfcaf('0xc'));logger[_0xfcaf('0xd')](_0xfcaf('0xe'),_0x5ad222,_0xfcaf('0xc'),JSON[_0xfcaf('0xf')](_0x2bdcee));if(_0x2bdcee[_0xfcaf('0x10')]){if(_0x2bdcee[_0xfcaf('0x10')][_0xfcaf('0x11')]===0x1f4){logger[_0xfcaf('0x10')](_0xfcaf('0xb'),_0x5ad222,_0x2bdcee[_0xfcaf('0x10')][_0xfcaf('0x12')]);return _0x1ae595(_0x2bdcee[_0xfcaf('0x10')]['message']);}logger[_0xfcaf('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x5ad222,_0x2bdcee[_0xfcaf('0x10')][_0xfcaf('0x12')]);return _0x32f773(_0x2bdcee['error'][_0xfcaf('0x12')]);}else{logger[_0xfcaf('0x13')]('CannedAnswer,\x20%s,\x20%s',_0x5ad222,_0xfcaf('0xc'));_0x32f773(_0x2bdcee[_0xfcaf('0x14')]['message']);}})[_0xfcaf('0x15')](function(_0x2bd232){logger[_0xfcaf('0x10')]('CannedAnswer,\x20%s,\x20%s',_0x5ad222,_0x2bd232);_0x1ae595(_0x2bd232);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index dfd4599..192ad5d 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 _0xa4bd=['isAuthenticated','index','show','post','put','/:id','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get'];(function(_0xf61985,_0x4326b1){var _0x524cdf=function(_0x137cc5){while(--_0x137cc5){_0xf61985['push'](_0xf61985['shift']());}};_0x524cdf(++_0x4326b1);}(_0xa4bd,0x1e4));var _0xda4b=function(_0x5a1f5a,_0x39d6a6){_0x5a1f5a=_0x5a1f5a-0x0;var _0xc37a59=_0xa4bd[_0x5a1f5a];return _0xc37a59;};'use strict';var multer=require(_0xda4b('0x0'));var util=require(_0xda4b('0x1'));var path=require(_0xda4b('0x2'));var timeout=require('connect-timeout');var express=require(_0xda4b('0x3'));var router=express[_0xda4b('0x4')]();var auth=require(_0xda4b('0x5'));var interaction=require(_0xda4b('0x6'));var config=require(_0xda4b('0x7'));var controller=require(_0xda4b('0x8'));router[_0xda4b('0x9')]('/',auth[_0xda4b('0xa')](),controller[_0xda4b('0xb')]);router[_0xda4b('0x9')]('/:id',auth[_0xda4b('0xa')](),controller[_0xda4b('0xc')]);router[_0xda4b('0xd')]('/',auth[_0xda4b('0xa')](),controller['create']);router[_0xda4b('0xe')](_0xda4b('0xf'),auth[_0xda4b('0xa')](),controller['update']);router[_0xda4b('0x10')]('/:id',auth[_0xda4b('0xa')](),controller[_0xda4b('0x11')]);module[_0xda4b('0x12')]=router; \ No newline at end of file +var _0xc5c7=['put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','index','post','create'];(function(_0x17408f,_0xf4a0f5){var _0x357065=function(_0xbbb58c){while(--_0xbbb58c){_0x17408f['push'](_0x17408f['shift']());}};_0x357065(++_0xf4a0f5);}(_0xc5c7,0x1cf));var _0x7c5c=function(_0x5d3464,_0x1ae22b){_0x5d3464=_0x5d3464-0x0;var _0x26f1c3=_0xc5c7[_0x5d3464];return _0x26f1c3;};'use strict';var multer=require('multer');var util=require(_0x7c5c('0x0'));var path=require(_0x7c5c('0x1'));var timeout=require(_0x7c5c('0x2'));var express=require(_0x7c5c('0x3'));var router=express[_0x7c5c('0x4')]();var auth=require(_0x7c5c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7c5c('0x6'));var controller=require(_0x7c5c('0x7'));router[_0x7c5c('0x8')]('/',auth[_0x7c5c('0x9')](),controller[_0x7c5c('0xa')]);router['get']('/:id',auth[_0x7c5c('0x9')](),controller['show']);router[_0x7c5c('0xb')]('/',auth['isAuthenticated'](),controller[_0x7c5c('0xc')]);router[_0x7c5c('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7c5c('0xe')]);router[_0x7c5c('0xf')]('/:id',auth[_0x7c5c('0x9')](),controller['destroy']);module[_0x7c5c('0x10')]=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index 62c31ee..867155c 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 _0x2f28=['sequelize','DATE','1970-01-01\x2000:00:01','STRING','INTEGER'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x2f28,0x131));var _0x82f2=function(_0x165cc2,_0x557d0c){_0x165cc2=_0x165cc2-0x0;var _0x359a7e=_0x2f28[_0x165cc2];return _0x359a7e;};'use strict';var Sequelize=require(_0x82f2('0x0'));module['exports']={'calldate':{'type':Sequelize[_0x82f2('0x1')],'allowNull':![],'defaultValue':_0x82f2('0x2')},'clid':{'type':Sequelize['STRING']},'src':{'type':Sequelize[_0x82f2('0x3')]},'dst':{'type':Sequelize[_0x82f2('0x3')]},'dcontext':{'type':Sequelize[_0x82f2('0x3')]},'channel':{'type':Sequelize[_0x82f2('0x3')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x82f2('0x3')]},'lastdata':{'type':Sequelize[_0x82f2('0x3')]},'duration':{'type':Sequelize[_0x82f2('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x82f2('0x4')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x82f2('0x3')]},'amaflags':{'type':Sequelize[_0x82f2('0x4')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x82f2('0x3')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x82f2('0x3')]},'linkedid':{'type':Sequelize[_0x82f2('0x3')]},'sequence':{'type':Sequelize[_0x82f2('0x3')]},'peeraccount':{'type':Sequelize[_0x82f2('0x3')]},'type':{'type':Sequelize[_0x82f2('0x3')]},'tag':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7806=['STRING','INTEGER','exports','1970-01-01\x2000:00:01'];(function(_0x3f994d,_0x249d72){var _0x5309b4=function(_0x545307){while(--_0x545307){_0x3f994d['push'](_0x3f994d['shift']());}};_0x5309b4(++_0x249d72);}(_0x7806,0x10a));var _0x6780=function(_0x3ee19a,_0x2d2717){_0x3ee19a=_0x3ee19a-0x0;var _0xcb900f=_0x7806[_0x3ee19a];return _0xcb900f;};'use strict';var Sequelize=require('sequelize');module[_0x6780('0x0')]={'calldate':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':_0x6780('0x1')},'clid':{'type':Sequelize[_0x6780('0x2')]},'src':{'type':Sequelize[_0x6780('0x2')]},'dst':{'type':Sequelize[_0x6780('0x2')]},'dcontext':{'type':Sequelize[_0x6780('0x2')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x6780('0x2')]},'lastapp':{'type':Sequelize['STRING']},'lastdata':{'type':Sequelize[_0x6780('0x2')]},'duration':{'type':Sequelize[_0x6780('0x3')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x6780('0x2')]},'amaflags':{'type':Sequelize[_0x6780('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x6780('0x2')]},'userfield':{'type':Sequelize[_0x6780('0x2')]},'uniqueid':{'type':Sequelize[_0x6780('0x2')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x6780('0x2')]},'peeraccount':{'type':Sequelize[_0x6780('0x2')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x6780('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index 72bee0f..c03a0f2 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 _0x67c1=['key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','update','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','index','map','Cdr','rawAttributes'];(function(_0x1c2d80,_0x582e83){var _0x497000=function(_0x16e6dc){while(--_0x16e6dc){_0x1c2d80['push'](_0x1c2d80['shift']());}};_0x497000(++_0x582e83);}(_0x67c1,0x14c));var _0x167c=function(_0x378240,_0x3adf55){_0x378240=_0x378240-0x0;var _0x1314d3=_0x67c1[_0x378240];return _0x1314d3;};'use strict';var pdf=require(_0x167c('0x0'));var emlformat=require(_0x167c('0x1'));var rimraf=require(_0x167c('0x2'));var zipdir=require(_0x167c('0x3'));var jsonpatch=require(_0x167c('0x4'));var rp=require('request-promise');var moment=require(_0x167c('0x5'));var BPromise=require(_0x167c('0x6'));var Mustache=require(_0x167c('0x7'));var util=require(_0x167c('0x8'));var path=require(_0x167c('0x9'));var sox=require(_0x167c('0xa'));var csv=require(_0x167c('0xb'));var ejs=require(_0x167c('0xc'));var fs=require('fs');var _=require(_0x167c('0xd'));var squel=require('squel');var crypto=require(_0x167c('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x167c('0xf'));var toCsv=require('to-csv');var querystring=require(_0x167c('0x10'));var Papa=require(_0x167c('0x11'));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(_0x167c('0x12'));var logger=require(_0x167c('0x13'))(_0x167c('0x14'));var utils=require('../../config/utils');var config=require(_0x167c('0x15'));var db=require(_0x167c('0x16'))['db'];function respondWithStatusCode(_0x1daa8e,_0x16d56a){_0x16d56a=_0x16d56a||0xcc;return function(_0x14ff02){if(_0x14ff02){return _0x1daa8e[_0x167c('0x17')](_0x16d56a);}return _0x1daa8e[_0x167c('0x18')](_0x16d56a)[_0x167c('0x19')]();};}function respondWithResult(_0x28c7ee,_0x56899f){_0x56899f=_0x56899f||0xc8;return function(_0xfa23){if(_0xfa23){return _0x28c7ee['status'](_0x56899f)[_0x167c('0x1a')](_0xfa23);}};}function respondWithFilteredResult(_0x38d4b9,_0x372422){return function(_0x21d9e0){if(_0x21d9e0){var _0x1c1845=_0x21d9e0[_0x167c('0x1b')],_0x594ea3=_0x372422[_0x167c('0x1c')],_0x4e9d94=_0x372422[_0x167c('0x1c')]+_0x372422[_0x167c('0x1d')],_0x35d356;if(_0x4e9d94>=_0x1c1845){_0x4e9d94=_0x1c1845;_0x35d356=0xc8;}else{_0x35d356=0xce;}_0x38d4b9[_0x167c('0x18')](_0x35d356);return _0x38d4b9[_0x167c('0x1e')](_0x167c('0x1f'),_0x594ea3+'-'+_0x4e9d94+'/'+_0x1c1845)['json'](_0x21d9e0);}return null;};}function patchUpdates(_0xcd84a1){return function(_0x1bf103){try{jsonpatch[_0x167c('0x20')](_0x1bf103,_0xcd84a1,!![]);}catch(_0x33bf0a){return BPromise[_0x167c('0x21')](_0x33bf0a);}return _0x1bf103[_0x167c('0x22')]();};}function saveUpdates(_0x36826a,_0x2210c5){return function(_0x550ffd){if(_0x550ffd){return _0x550ffd['update'](_0x36826a)[_0x167c('0x23')](function(_0x5c6d9e){return _0x5c6d9e;});}return null;};}function removeEntity(_0x46ff3f,_0x5e278a){return function(_0x81d4f6){if(_0x81d4f6){return _0x81d4f6[_0x167c('0x24')]()[_0x167c('0x23')](function(){_0x46ff3f[_0x167c('0x18')](0xcc)[_0x167c('0x19')]();});}};}function handleEntityNotFound(_0x28ce17,_0x2b66cc){return function(_0xda296c){if(!_0xda296c){_0x28ce17[_0x167c('0x17')](0x194);}return _0xda296c;};}function handleError(_0x9ca5e,_0x2c4061){_0x2c4061=_0x2c4061||0x1f4;return function(_0x564331){logger[_0x167c('0x25')](_0x564331['stack']);if(_0x564331[_0x167c('0x26')]){delete _0x564331[_0x167c('0x26')];}_0x9ca5e[_0x167c('0x18')](_0x2c4061)['send'](_0x564331);};}exports[_0x167c('0x27')]=function(_0x46648c,_0x296cb6){var _0x24da98={},_0xb9d545={},_0x5c5ec7={'count':0x0,'rows':[]};var _0x2d52b2=_[_0x167c('0x28')](db[_0x167c('0x29')][_0x167c('0x2a')],function(_0x2b3977){return{'name':_0x2b3977['fieldName'],'type':_0x2b3977['type'][_0x167c('0x2b')]};});_0xb9d545[_0x167c('0x2c')]=_[_0x167c('0x28')](_0x2d52b2,_0x167c('0x26'));_0xb9d545[_0x167c('0x2d')]=_[_0x167c('0x2e')](_0x46648c[_0x167c('0x2d')]);_0xb9d545[_0x167c('0x2f')]=_['intersection'](_0xb9d545['model'],_0xb9d545[_0x167c('0x2d')]);_0x24da98[_0x167c('0x30')]=_[_0x167c('0x31')](_0xb9d545['model'],qs[_0x167c('0x32')](_0x46648c[_0x167c('0x2d')][_0x167c('0x32')]));_0x24da98[_0x167c('0x30')]=_0x24da98['attributes'][_0x167c('0x33')]?_0x24da98[_0x167c('0x30')]:_0xb9d545[_0x167c('0x2c')];if(!_0x46648c[_0x167c('0x2d')][_0x167c('0x34')](_0x167c('0x35'))){_0x24da98[_0x167c('0x1d')]=qs[_0x167c('0x1d')](_0x46648c[_0x167c('0x2d')][_0x167c('0x1d')]);_0x24da98['offset']=qs[_0x167c('0x1c')](_0x46648c['query'][_0x167c('0x1c')]);}_0x24da98[_0x167c('0x36')]=qs['sort'](_0x46648c[_0x167c('0x2d')][_0x167c('0x37')]);_0x24da98[_0x167c('0x38')]=qs[_0x167c('0x2f')](_[_0x167c('0x39')](_0x46648c[_0x167c('0x2d')],_0xb9d545[_0x167c('0x2f')]));if(_0x46648c[_0x167c('0x2d')][_0x167c('0x3a')]){_0x24da98[_0x167c('0x38')]=_[_0x167c('0x3b')](_0x24da98['where'],{'$or':_[_0x167c('0x28')](_0x2d52b2,function(_0x125826){if(_0x125826[_0x167c('0x3c')]!==_0x167c('0x3d')){var _0x52a14e={};_0x52a14e[_0x125826['name']]={'$like':'%'+_0x46648c[_0x167c('0x2d')]['filter']+'%'};return _0x52a14e;}})});}_0x24da98=_[_0x167c('0x3b')]({},_0x24da98,_0x46648c[_0x167c('0x3e')]);var _0xecca80={'where':_0x24da98[_0x167c('0x38')]};return db[_0x167c('0x29')][_0x167c('0x1b')](_0xecca80)[_0x167c('0x23')](function(_0x42c769){_0x5c5ec7[_0x167c('0x1b')]=_0x42c769;if(_0x46648c[_0x167c('0x2d')][_0x167c('0x3f')]){_0x24da98[_0x167c('0x40')]=[{'all':!![]}];}return db[_0x167c('0x29')][_0x167c('0x41')](_0x24da98);})[_0x167c('0x23')](function(_0x42dc1e){_0x5c5ec7[_0x167c('0x42')]=_0x42dc1e;return _0x5c5ec7;})['then'](respondWithFilteredResult(_0x296cb6,_0x24da98))[_0x167c('0x43')](handleError(_0x296cb6,null));};exports[_0x167c('0x44')]=function(_0x29e8da,_0x3f64fe){var _0x26cd02={'raw':!![],'where':{'id':_0x29e8da[_0x167c('0x45')]['id']}},_0x2d25a2={};_0x2d25a2[_0x167c('0x2c')]=_['keys'](db[_0x167c('0x29')][_0x167c('0x2a')]);_0x2d25a2['query']=_[_0x167c('0x2e')](_0x29e8da['query']);_0x2d25a2[_0x167c('0x2f')]=_[_0x167c('0x31')](_0x2d25a2[_0x167c('0x2c')],_0x2d25a2[_0x167c('0x2d')]);_0x26cd02['attributes']=_[_0x167c('0x31')](_0x2d25a2[_0x167c('0x2c')],qs['fields'](_0x29e8da[_0x167c('0x2d')][_0x167c('0x32')]));_0x26cd02[_0x167c('0x30')]=_0x26cd02[_0x167c('0x30')]['length']?_0x26cd02[_0x167c('0x30')]:_0x2d25a2[_0x167c('0x2c')];if(_0x29e8da[_0x167c('0x2d')][_0x167c('0x3f')]){_0x26cd02[_0x167c('0x40')]=[{'all':!![]}];}_0x26cd02=_[_0x167c('0x3b')]({},_0x26cd02,_0x29e8da[_0x167c('0x3e')]);return db[_0x167c('0x29')][_0x167c('0x46')](_0x26cd02)['then'](handleEntityNotFound(_0x3f64fe,null))[_0x167c('0x23')](respondWithResult(_0x3f64fe,null))[_0x167c('0x43')](handleError(_0x3f64fe,null));};exports[_0x167c('0x47')]=function(_0x2e53ec,_0x2c83c9){return db['Cdr'][_0x167c('0x47')](_0x2e53ec[_0x167c('0x48')],{})['then'](respondWithResult(_0x2c83c9,0xc9))[_0x167c('0x43')](handleError(_0x2c83c9,null));};exports[_0x167c('0x49')]=function(_0x36bfe3,_0xbbdad0){if(_0x36bfe3['body']['id']){delete _0x36bfe3[_0x167c('0x48')]['id'];}return db['Cdr'][_0x167c('0x46')]({'where':{'id':_0x36bfe3[_0x167c('0x45')]['id']}})[_0x167c('0x23')](handleEntityNotFound(_0xbbdad0,null))['then'](saveUpdates(_0x36bfe3[_0x167c('0x48')],null))[_0x167c('0x23')](respondWithResult(_0xbbdad0,null))[_0x167c('0x43')](handleError(_0xbbdad0,null));};exports[_0x167c('0x24')]=function(_0x1fff32,_0x106e8a){return db[_0x167c('0x29')][_0x167c('0x46')]({'where':{'id':_0x1fff32[_0x167c('0x45')]['id']}})[_0x167c('0x23')](handleEntityNotFound(_0x106e8a,null))[_0x167c('0x23')](removeEntity(_0x106e8a,null))[_0x167c('0x43')](handleError(_0x106e8a,null));};exports[_0x167c('0x4a')]=function(_0x4ab683,_0x22d628){return db[_0x167c('0x29')]['describe']()[_0x167c('0x23')](respondWithResult(_0x22d628,null))[_0x167c('0x43')](handleError(_0x22d628,null));}; \ No newline at end of file +var _0x1388=['name','send','map','Cdr','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','find','body','update','describe','html-pdf','zip-dir','fast-json-patch','moment','bluebird','mustache','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','status','end','json','count','offset','set','apply','reject','then','destroy','stack'];(function(_0xcd90ac,_0x5ae6f6){var _0x4d92f9=function(_0x20069c){while(--_0x20069c){_0xcd90ac['push'](_0xcd90ac['shift']());}};_0x4d92f9(++_0x5ae6f6);}(_0x1388,0x101));var _0x8138=function(_0x4702ee,_0xaf6a45){_0x4702ee=_0x4702ee-0x0;var _0x62ca7d=_0x1388[_0x4702ee];return _0x62ca7d;};'use strict';var pdf=require(_0x8138('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8138('0x1'));var jsonpatch=require(_0x8138('0x2'));var rp=require('request-promise');var moment=require(_0x8138('0x3'));var BPromise=require(_0x8138('0x4'));var Mustache=require(_0x8138('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8138('0x6'));var csv=require(_0x8138('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8138('0x8'));var squel=require(_0x8138('0x9'));var crypto=require(_0x8138('0xa'));var jsforce=require(_0x8138('0xb'));var deskjs=require(_0x8138('0xc'));var toCsv=require(_0x8138('0x7'));var querystring=require(_0x8138('0xd'));var Papa=require(_0x8138('0xe'));var Redis=require(_0x8138('0xf'));var authService=require(_0x8138('0x10'));var qs=require(_0x8138('0x11'));var as=require(_0x8138('0x12'));var hardwareService=require(_0x8138('0x13'));var logger=require('../../config/logger')(_0x8138('0x14'));var utils=require(_0x8138('0x15'));var config=require(_0x8138('0x16'));var db=require(_0x8138('0x17'))['db'];function respondWithStatusCode(_0x2dab0c,_0x2ecd93){_0x2ecd93=_0x2ecd93||0xcc;return function(_0x433fcd){if(_0x433fcd){return _0x2dab0c['sendStatus'](_0x2ecd93);}return _0x2dab0c[_0x8138('0x18')](_0x2ecd93)[_0x8138('0x19')]();};}function respondWithResult(_0x143435,_0x35bb69){_0x35bb69=_0x35bb69||0xc8;return function(_0x3b2b88){if(_0x3b2b88){return _0x143435[_0x8138('0x18')](_0x35bb69)[_0x8138('0x1a')](_0x3b2b88);}};}function respondWithFilteredResult(_0x3f15fe,_0x1364dd){return function(_0x3f185a){if(_0x3f185a){var _0xe6e31c=_0x3f185a[_0x8138('0x1b')],_0x289c69=_0x1364dd[_0x8138('0x1c')],_0x5751e0=_0x1364dd['offset']+_0x1364dd['limit'],_0x1259d9;if(_0x5751e0>=_0xe6e31c){_0x5751e0=_0xe6e31c;_0x1259d9=0xc8;}else{_0x1259d9=0xce;}_0x3f15fe[_0x8138('0x18')](_0x1259d9);return _0x3f15fe[_0x8138('0x1d')]('Content-Range',_0x289c69+'-'+_0x5751e0+'/'+_0xe6e31c)[_0x8138('0x1a')](_0x3f185a);}return null;};}function patchUpdates(_0xd872fe){return function(_0x4f2fe0){try{jsonpatch[_0x8138('0x1e')](_0x4f2fe0,_0xd872fe,!![]);}catch(_0x16ab00){return BPromise[_0x8138('0x1f')](_0x16ab00);}return _0x4f2fe0['save']();};}function saveUpdates(_0x54946e,_0xcbaec8){return function(_0x5beb4c){if(_0x5beb4c){return _0x5beb4c['update'](_0x54946e)[_0x8138('0x20')](function(_0x124965){return _0x124965;});}return null;};}function removeEntity(_0x2fbbeb,_0x26685b){return function(_0x3be49c){if(_0x3be49c){return _0x3be49c[_0x8138('0x21')]()['then'](function(){_0x2fbbeb[_0x8138('0x18')](0xcc)[_0x8138('0x19')]();});}};}function handleEntityNotFound(_0x415b4a,_0x3f6c59){return function(_0x177d0b){if(!_0x177d0b){_0x415b4a['sendStatus'](0x194);}return _0x177d0b;};}function handleError(_0x174f00,_0x4ec671){_0x4ec671=_0x4ec671||0x1f4;return function(_0x1d65ef){logger['error'](_0x1d65ef[_0x8138('0x22')]);if(_0x1d65ef[_0x8138('0x23')]){delete _0x1d65ef[_0x8138('0x23')];}_0x174f00[_0x8138('0x18')](_0x4ec671)[_0x8138('0x24')](_0x1d65ef);};}exports['index']=function(_0xf51290,_0x91edd5){var _0x33c27f={},_0x3d4067={},_0x369c6a={'count':0x0,'rows':[]};var _0xaa9a7a=_[_0x8138('0x25')](db[_0x8138('0x26')][_0x8138('0x27')],function(_0x582b63){return{'name':_0x582b63[_0x8138('0x28')],'type':_0x582b63[_0x8138('0x29')][_0x8138('0x2a')]};});_0x3d4067[_0x8138('0x2b')]=_[_0x8138('0x25')](_0xaa9a7a,_0x8138('0x23'));_0x3d4067[_0x8138('0x2c')]=_[_0x8138('0x2d')](_0xf51290[_0x8138('0x2c')]);_0x3d4067[_0x8138('0x2e')]=_[_0x8138('0x2f')](_0x3d4067[_0x8138('0x2b')],_0x3d4067[_0x8138('0x2c')]);_0x33c27f[_0x8138('0x30')]=_['intersection'](_0x3d4067['model'],qs['fields'](_0xf51290[_0x8138('0x2c')]['fields']));_0x33c27f[_0x8138('0x30')]=_0x33c27f[_0x8138('0x30')][_0x8138('0x31')]?_0x33c27f[_0x8138('0x30')]:_0x3d4067['model'];if(!_0xf51290[_0x8138('0x2c')][_0x8138('0x32')](_0x8138('0x33'))){_0x33c27f[_0x8138('0x34')]=qs[_0x8138('0x34')](_0xf51290[_0x8138('0x2c')][_0x8138('0x34')]);_0x33c27f[_0x8138('0x1c')]=qs['offset'](_0xf51290['query'][_0x8138('0x1c')]);}_0x33c27f[_0x8138('0x35')]=qs['sort'](_0xf51290[_0x8138('0x2c')][_0x8138('0x36')]);_0x33c27f['where']=qs['filters'](_[_0x8138('0x37')](_0xf51290[_0x8138('0x2c')],_0x3d4067[_0x8138('0x2e')]));if(_0xf51290['query'][_0x8138('0x38')]){_0x33c27f[_0x8138('0x39')]=_[_0x8138('0x3a')](_0x33c27f[_0x8138('0x39')],{'$or':_['map'](_0xaa9a7a,function(_0x454d2c){if(_0x454d2c[_0x8138('0x29')]!==_0x8138('0x3b')){var _0x48fade={};_0x48fade[_0x454d2c['name']]={'$like':'%'+_0xf51290['query'][_0x8138('0x38')]+'%'};return _0x48fade;}})});}_0x33c27f=_[_0x8138('0x3a')]({},_0x33c27f,_0xf51290[_0x8138('0x3c')]);var _0x172b66={'where':_0x33c27f[_0x8138('0x39')]};return db[_0x8138('0x26')][_0x8138('0x1b')](_0x172b66)['then'](function(_0x2f8361){_0x369c6a[_0x8138('0x1b')]=_0x2f8361;if(_0xf51290[_0x8138('0x2c')][_0x8138('0x3d')]){_0x33c27f[_0x8138('0x3e')]=[{'all':!![]}];}return db[_0x8138('0x26')][_0x8138('0x3f')](_0x33c27f);})[_0x8138('0x20')](function(_0x1c8090){_0x369c6a[_0x8138('0x40')]=_0x1c8090;return _0x369c6a;})[_0x8138('0x20')](respondWithFilteredResult(_0x91edd5,_0x33c27f))[_0x8138('0x41')](handleError(_0x91edd5,null));};exports[_0x8138('0x42')]=function(_0x2bbf5d,_0x162931){var _0x396354={'raw':!![],'where':{'id':_0x2bbf5d[_0x8138('0x43')]['id']}},_0xf17a6e={};_0xf17a6e[_0x8138('0x2b')]=_[_0x8138('0x2d')](db[_0x8138('0x26')][_0x8138('0x27')]);_0xf17a6e['query']=_[_0x8138('0x2d')](_0x2bbf5d[_0x8138('0x2c')]);_0xf17a6e[_0x8138('0x2e')]=_[_0x8138('0x2f')](_0xf17a6e[_0x8138('0x2b')],_0xf17a6e[_0x8138('0x2c')]);_0x396354[_0x8138('0x30')]=_[_0x8138('0x2f')](_0xf17a6e[_0x8138('0x2b')],qs[_0x8138('0x44')](_0x2bbf5d[_0x8138('0x2c')][_0x8138('0x44')]));_0x396354[_0x8138('0x30')]=_0x396354[_0x8138('0x30')][_0x8138('0x31')]?_0x396354[_0x8138('0x30')]:_0xf17a6e['model'];if(_0x2bbf5d[_0x8138('0x2c')][_0x8138('0x3d')]){_0x396354[_0x8138('0x3e')]=[{'all':!![]}];}_0x396354=_[_0x8138('0x3a')]({},_0x396354,_0x2bbf5d[_0x8138('0x3c')]);return db[_0x8138('0x26')][_0x8138('0x45')](_0x396354)[_0x8138('0x20')](handleEntityNotFound(_0x162931,null))[_0x8138('0x20')](respondWithResult(_0x162931,null))[_0x8138('0x41')](handleError(_0x162931,null));};exports['create']=function(_0x3199bf,_0x4c2628){return db[_0x8138('0x26')]['create'](_0x3199bf[_0x8138('0x46')],{})[_0x8138('0x20')](respondWithResult(_0x4c2628,0xc9))['catch'](handleError(_0x4c2628,null));};exports[_0x8138('0x47')]=function(_0xb50a9d,_0x35aa84){if(_0xb50a9d[_0x8138('0x46')]['id']){delete _0xb50a9d[_0x8138('0x46')]['id'];}return db[_0x8138('0x26')]['find']({'where':{'id':_0xb50a9d['params']['id']}})[_0x8138('0x20')](handleEntityNotFound(_0x35aa84,null))[_0x8138('0x20')](saveUpdates(_0xb50a9d[_0x8138('0x46')],null))['then'](respondWithResult(_0x35aa84,null))[_0x8138('0x41')](handleError(_0x35aa84,null));};exports['destroy']=function(_0x3112d4,_0x19ed16){return db[_0x8138('0x26')]['find']({'where':{'id':_0x3112d4[_0x8138('0x43')]['id']}})[_0x8138('0x20')](handleEntityNotFound(_0x19ed16,null))[_0x8138('0x20')](removeEntity(_0x19ed16,null))[_0x8138('0x41')](handleError(_0x19ed16,null));};exports[_0x8138('0x48')]=function(_0x28bfb9,_0x2c89c5){return db[_0x8138('0x26')][_0x8138('0x48')]()[_0x8138('0x20')](respondWithResult(_0x2c89c5,null))[_0x8138('0x41')](handleError(_0x2c89c5,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 497cbde..7b3ccb9 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 _0xda19=['accountcode','disposition','dst','src','uniqueid','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./cdr.attributes','exports','define','Cdr','cdr'];(function(_0xd077f6,_0x83bd3c){var _0x4a1c0f=function(_0x209652){while(--_0x209652){_0xd077f6['push'](_0xd077f6['shift']());}};_0x4a1c0f(++_0x83bd3c);}(_0xda19,0xd5));var _0x9da1=function(_0x53201f,_0x27d252){_0x53201f=_0x53201f-0x0;var _0x3dbae1=_0xda19[_0x53201f];return _0x3dbae1;};'use strict';var _=require('lodash');var util=require(_0x9da1('0x0'));var logger=require(_0x9da1('0x1'))('api');var moment=require(_0x9da1('0x2'));var BPromise=require('bluebird');var rp=require(_0x9da1('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9da1('0x4'));var config=require(_0x9da1('0x5'));var attributes=require(_0x9da1('0x6'));module[_0x9da1('0x7')]=function(_0x156faf,_0x2dcbc6){return _0x156faf[_0x9da1('0x8')](_0x9da1('0x9'),attributes,{'tableName':_0x9da1('0xa'),'paranoid':![],'indexes':[{'name':_0x9da1('0xb'),'fields':['accountcode']},{'name':'calldate','fields':['calldate']},{'name':_0x9da1('0xc'),'fields':['disposition']},{'name':_0x9da1('0xd'),'fields':[_0x9da1('0xd')]},{'name':_0x9da1('0xe'),'fields':[_0x9da1('0xe')]},{'name':_0x9da1('0xf'),'fields':[_0x9da1('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf61e=['src','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cdr.attributes','exports','define','cdr','accountcode','disposition','dst'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xf61e,0x191));var _0xef61=function(_0x3b25d5,_0x30a7be){_0x3b25d5=_0x3b25d5-0x0;var _0x22ff16=_0xf61e[_0x3b25d5];return _0x22ff16;};'use strict';var _=require(_0xef61('0x0'));var util=require(_0xef61('0x1'));var logger=require(_0xef61('0x2'))(_0xef61('0x3'));var moment=require(_0xef61('0x4'));var BPromise=require(_0xef61('0x5'));var rp=require(_0xef61('0x6'));var fs=require('fs');var path=require(_0xef61('0x7'));var rimraf=require(_0xef61('0x8'));var config=require(_0xef61('0x9'));var attributes=require(_0xef61('0xa'));module[_0xef61('0xb')]=function(_0x5b00b2,_0x9e17f4){return _0x5b00b2[_0xef61('0xc')]('Cdr',attributes,{'tableName':_0xef61('0xd'),'paranoid':![],'indexes':[{'name':_0xef61('0xe'),'fields':[_0xef61('0xe')]},{'name':'calldate','fields':['calldate']},{'name':_0xef61('0xf'),'fields':[_0xef61('0xf')]},{'name':_0xef61('0x10'),'fields':[_0xef61('0x10')]},{'name':_0xef61('0x11'),'fields':[_0xef61('0x11')]},{'name':_0xef61('0x12'),'fields':[_0xef61('0x12')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 6f26ad0..695d1f7 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 _0xe9e7=['Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info'];(function(_0x2a524a,_0x28c5cb){var _0x38a273=function(_0x2b7eed){while(--_0x2b7eed){_0x2a524a['push'](_0x2a524a['shift']());}};_0x38a273(++_0x28c5cb);}(_0xe9e7,0x142));var _0x7e9e=function(_0x2f23cf,_0x54795d){_0x2f23cf=_0x2f23cf-0x0;var _0x1ec8ed=_0xe9e7[_0x2f23cf];return _0x1ec8ed;};'use strict';var _=require(_0x7e9e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7e9e('0x1'));var rs=require(_0x7e9e('0x2'));var fs=require('fs');var Redis=require(_0x7e9e('0x3'));var db=require(_0x7e9e('0x4'))['db'];var utils=require(_0x7e9e('0x5'));var logger=require(_0x7e9e('0x6'))(_0x7e9e('0x7'));var config=require('../../config/environment');var jayson=require(_0x7e9e('0x8'));var client=jayson[_0x7e9e('0x9')][_0x7e9e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3f544b,_0x269ebc,_0x5eef0f){return new BPromise(function(_0x1df22f,_0x1c69e9){return client[_0x7e9e('0xb')](_0x3f544b,_0x5eef0f)[_0x7e9e('0xc')](function(_0x2b652d){logger[_0x7e9e('0xd')](_0x7e9e('0xe'),_0x269ebc,_0x7e9e('0xf'));logger[_0x7e9e('0x10')](_0x7e9e('0x11'),_0x269ebc,_0x7e9e('0xf'),JSON[_0x7e9e('0x12')](_0x2b652d));if(_0x2b652d[_0x7e9e('0x13')]){if(_0x2b652d[_0x7e9e('0x13')][_0x7e9e('0x14')]===0x1f4){logger[_0x7e9e('0x13')](_0x7e9e('0xe'),_0x269ebc,_0x2b652d[_0x7e9e('0x13')][_0x7e9e('0x15')]);return _0x1c69e9(_0x2b652d[_0x7e9e('0x13')][_0x7e9e('0x15')]);}logger[_0x7e9e('0x13')]('Cdr,\x20%s,\x20%s',_0x269ebc,_0x2b652d['error'][_0x7e9e('0x15')]);return _0x1df22f(_0x2b652d[_0x7e9e('0x13')][_0x7e9e('0x15')]);}else{logger['info'](_0x7e9e('0xe'),_0x269ebc,_0x7e9e('0xf'));_0x1df22f(_0x2b652d[_0x7e9e('0x16')][_0x7e9e('0x15')]);}})[_0x7e9e('0x17')](function(_0x1f8e9f){logger[_0x7e9e('0x13')](_0x7e9e('0xe'),_0x269ebc,_0x1f8e9f);_0x1c69e9(_0x1f8e9f);});});} \ No newline at end of file +var _0xdc72=['bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0x7f6bc8,_0x98c3bf){var _0xb899c7=function(_0x334535){while(--_0x334535){_0x7f6bc8['push'](_0x7f6bc8['shift']());}};_0xb899c7(++_0x98c3bf);}(_0xdc72,0xd5));var _0x2dc7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc72[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2dc7('0x0'));var util=require(_0x2dc7('0x1'));var moment=require(_0x2dc7('0x2'));var BPromise=require(_0x2dc7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2dc7('0x4'));var db=require(_0x2dc7('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2dc7('0x6'));var config=require(_0x2dc7('0x7'));var jayson=require(_0x2dc7('0x8'));var client=jayson[_0x2dc7('0x9')][_0x2dc7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x441cb7,_0x4ce294,_0x567ab6){return new BPromise(function(_0x1c5be5,_0x26369c){return client[_0x2dc7('0xb')](_0x441cb7,_0x567ab6)[_0x2dc7('0xc')](function(_0x1da0ca){logger[_0x2dc7('0xd')](_0x2dc7('0xe'),_0x4ce294,_0x2dc7('0xf'));logger[_0x2dc7('0x10')](_0x2dc7('0x11'),_0x4ce294,'request\x20sent',JSON[_0x2dc7('0x12')](_0x1da0ca));if(_0x1da0ca[_0x2dc7('0x13')]){if(_0x1da0ca['error'][_0x2dc7('0x14')]===0x1f4){logger[_0x2dc7('0x13')]('Cdr,\x20%s,\x20%s',_0x4ce294,_0x1da0ca[_0x2dc7('0x13')][_0x2dc7('0x15')]);return _0x26369c(_0x1da0ca[_0x2dc7('0x13')]['message']);}logger['error'](_0x2dc7('0xe'),_0x4ce294,_0x1da0ca['error'][_0x2dc7('0x15')]);return _0x1c5be5(_0x1da0ca[_0x2dc7('0x13')][_0x2dc7('0x15')]);}else{logger[_0x2dc7('0xd')](_0x2dc7('0xe'),_0x4ce294,_0x2dc7('0xf'));_0x1c5be5(_0x1da0ca[_0x2dc7('0x16')][_0x2dc7('0x15')]);}})[_0x2dc7('0x17')](function(_0x151a0c){logger[_0x2dc7('0x13')]('Cdr,\x20%s,\x20%s',_0x4ce294,_0x151a0c);_0x26369c(_0x151a0c);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 579b3ee..709e022 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 _0xac7f=['./cdr.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','express','Router','../../config/environment'];(function(_0x57446e,_0x4740a8){var _0x400e52=function(_0x452863){while(--_0x452863){_0x57446e['push'](_0x57446e['shift']());}};_0x400e52(++_0x4740a8);}(_0xac7f,0x1f4));var _0xfac7=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xac7f[_0xd1d19a];return _0x52a79d;};'use strict';var multer=require(_0xfac7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfac7('0x1'));var router=express[_0xfac7('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xfac7('0x3'));var controller=require(_0xfac7('0x4'));router['get']('/',auth[_0xfac7('0x5')](),controller['index']);router[_0xfac7('0x6')](_0xfac7('0x7'),auth[_0xfac7('0x5')](),controller[_0xfac7('0x8')]);router[_0xfac7('0x6')](_0xfac7('0x9'),auth['isAuthenticated'](),controller[_0xfac7('0xa')]);router[_0xfac7('0xb')]('/',auth[_0xfac7('0x5')](),controller[_0xfac7('0xc')]);router[_0xfac7('0xd')](_0xfac7('0x9'),auth[_0xfac7('0x5')](),controller[_0xfac7('0xe')]);router[_0xfac7('0xf')](_0xfac7('0x9'),auth[_0xfac7('0x5')](),controller[_0xfac7('0x10')]);module[_0xfac7('0x11')]=router; \ No newline at end of file +var _0x54c4=['put','/:id','update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../config/environment','./cdr.controller','get','isAuthenticated','index','/describe','describe','show','post','create'];(function(_0x3081e8,_0x4f715b){var _0x4641e5=function(_0x44df2d){while(--_0x44df2d){_0x3081e8['push'](_0x3081e8['shift']());}};_0x4641e5(++_0x4f715b);}(_0x54c4,0x182));var _0x454c=function(_0x8dca03,_0x307dd3){_0x8dca03=_0x8dca03-0x0;var _0x47007d=_0x54c4[_0x8dca03];return _0x47007d;};'use strict';var multer=require(_0x454c('0x0'));var util=require('util');var path=require(_0x454c('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x454c('0x2')]();var auth=require(_0x454c('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x454c('0x4'));var controller=require(_0x454c('0x5'));router[_0x454c('0x6')]('/',auth[_0x454c('0x7')](),controller[_0x454c('0x8')]);router['get'](_0x454c('0x9'),auth['isAuthenticated'](),controller[_0x454c('0xa')]);router['get']('/:id',auth[_0x454c('0x7')](),controller[_0x454c('0xb')]);router[_0x454c('0xc')]('/',auth[_0x454c('0x7')](),controller[_0x454c('0xd')]);router[_0x454c('0xe')](_0x454c('0xf'),auth[_0x454c('0x7')](),controller[_0x454c('0x10')]);router[_0x454c('0x11')](_0x454c('0xf'),auth[_0x454c('0x7')](),controller[_0x454c('0x12')]);module[_0x454c('0x13')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 6ada4f5..152efde 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 _0x6309=['exports','INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x3a7399,_0x2d2307){var _0x440350=function(_0x485e94){while(--_0x485e94){_0x3a7399['push'](_0x3a7399['shift']());}};_0x440350(++_0x2d2307);}(_0x6309,0x1d4));var _0x9630=function(_0x1ccdf7,_0x215d5a){_0x1ccdf7=_0x1ccdf7-0x0;var _0x52a0ae=_0x6309[_0x1ccdf7];return _0x52a0ae;};'use strict';var Sequelize=require(_0x9630('0x0'));module[_0x9630('0x1')]={'priority':{'type':Sequelize[_0x9630('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x9630('0x3')],'allowNull':![],'defaultValue':_0x9630('0x4')},'appdata':{'type':Sequelize[_0x9630('0x5')]()},'description':{'type':Sequelize[_0x9630('0x3')]},'interval':{'type':Sequelize[_0x9630('0x3')],'defaultValue':_0x9630('0x6')}}; \ No newline at end of file +var _0x5d31=['STRING','*,*,*,*','exports','INTEGER'];(function(_0x4c36a8,_0x1fb420){var _0x3c0859=function(_0xa60ca7){while(--_0xa60ca7){_0x4c36a8['push'](_0x4c36a8['shift']());}};_0x3c0859(++_0x1fb420);}(_0x5d31,0x8e));var _0x15d3=function(_0x4e291f,_0x202c9){_0x4e291f=_0x4e291f-0x0;var _0x3b2d52=_0x5d31[_0x4e291f];return _0x3b2d52;};'use strict';var Sequelize=require('sequelize');module[_0x15d3('0x0')]={'priority':{'type':Sequelize[_0x15d3('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x15d3('0x2')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x15d3('0x2')],'defaultValue':_0x15d3('0x3')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 4fe6b38..ba62c20 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 _0x7cdd=['body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','show','params','ChatApplication','rawAttributes','query','keys','intersection','attributes','model','fields','length','include','merge','find','catch'];(function(_0x570b29,_0x54070a){var _0x1a7aae=function(_0x2b94d6){while(--_0x2b94d6){_0x570b29['push'](_0x570b29['shift']());}};_0x1a7aae(++_0x54070a);}(_0x7cdd,0xb8));var _0xd7cd=function(_0x200c2a,_0x4965f8){_0x200c2a=_0x200c2a-0x0;var _0x1929f1=_0x7cdd[_0x200c2a];return _0x1929f1;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xd7cd('0x0'));var rimraf=require(_0xd7cd('0x1'));var zipdir=require(_0xd7cd('0x2'));var jsonpatch=require(_0xd7cd('0x3'));var rp=require(_0xd7cd('0x4'));var moment=require(_0xd7cd('0x5'));var BPromise=require(_0xd7cd('0x6'));var Mustache=require(_0xd7cd('0x7'));var util=require(_0xd7cd('0x8'));var path=require(_0xd7cd('0x9'));var sox=require('sox');var csv=require(_0xd7cd('0xa'));var ejs=require(_0xd7cd('0xb'));var fs=require('fs');var _=require(_0xd7cd('0xc'));var squel=require(_0xd7cd('0xd'));var crypto=require(_0xd7cd('0xe'));var jsforce=require(_0xd7cd('0xf'));var deskjs=require(_0xd7cd('0x10'));var toCsv=require(_0xd7cd('0xa'));var querystring=require(_0xd7cd('0x11'));var Papa=require(_0xd7cd('0x12'));var Redis=require(_0xd7cd('0x13'));var authService=require(_0xd7cd('0x14'));var qs=require(_0xd7cd('0x15'));var as=require(_0xd7cd('0x16'));var hardwareService=require(_0xd7cd('0x17'));var logger=require(_0xd7cd('0x18'))(_0xd7cd('0x19'));var utils=require(_0xd7cd('0x1a'));var config=require(_0xd7cd('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2266c2,_0x3c724d){_0x3c724d=_0x3c724d||0xcc;return function(_0x52f67a){if(_0x52f67a){return _0x2266c2[_0xd7cd('0x1c')](_0x3c724d);}return _0x2266c2[_0xd7cd('0x1d')](_0x3c724d)[_0xd7cd('0x1e')]();};}function respondWithResult(_0x6a895c,_0x22b0b7){_0x22b0b7=_0x22b0b7||0xc8;return function(_0x4a05cc){if(_0x4a05cc){return _0x6a895c[_0xd7cd('0x1d')](_0x22b0b7)[_0xd7cd('0x1f')](_0x4a05cc);}};}function respondWithFilteredResult(_0x33b2c4,_0x3268bc){return function(_0x503846){if(_0x503846){var _0xf2d0c5=_0x503846[_0xd7cd('0x20')],_0x488d48=_0x3268bc['offset'],_0x9682b3=_0x3268bc['offset']+_0x3268bc[_0xd7cd('0x21')],_0x236bfe;if(_0x9682b3>=_0xf2d0c5){_0x9682b3=_0xf2d0c5;_0x236bfe=0xc8;}else{_0x236bfe=0xce;}_0x33b2c4[_0xd7cd('0x1d')](_0x236bfe);return _0x33b2c4[_0xd7cd('0x22')](_0xd7cd('0x23'),_0x488d48+'-'+_0x9682b3+'/'+_0xf2d0c5)[_0xd7cd('0x1f')](_0x503846);}return null;};}function patchUpdates(_0x55ef9e){return function(_0xa3b802){try{jsonpatch[_0xd7cd('0x24')](_0xa3b802,_0x55ef9e,!![]);}catch(_0x15c2fb){return BPromise[_0xd7cd('0x25')](_0x15c2fb);}return _0xa3b802[_0xd7cd('0x26')]();};}function saveUpdates(_0x4207d5,_0x23a493){return function(_0x160f32){if(_0x160f32){return _0x160f32[_0xd7cd('0x27')](_0x4207d5)[_0xd7cd('0x28')](function(_0x18e50b){return _0x18e50b;});}return null;};}function removeEntity(_0x4425e0,_0x5ae56f){return function(_0x252432){if(_0x252432){return _0x252432[_0xd7cd('0x29')]()[_0xd7cd('0x28')](function(){_0x4425e0[_0xd7cd('0x1d')](0xcc)[_0xd7cd('0x1e')]();});}};}function handleEntityNotFound(_0x49923a,_0x1955c1){return function(_0x27d9b2){if(!_0x27d9b2){_0x49923a[_0xd7cd('0x1c')](0x194);}return _0x27d9b2;};}function handleError(_0x274e48,_0x293621){_0x293621=_0x293621||0x1f4;return function(_0x1b0692){logger[_0xd7cd('0x2a')](_0x1b0692[_0xd7cd('0x2b')]);if(_0x1b0692['name']){delete _0x1b0692[_0xd7cd('0x2c')];}_0x274e48[_0xd7cd('0x1d')](_0x293621)['send'](_0x1b0692);};}exports[_0xd7cd('0x2d')]=function(_0x2589d1,_0x100e05){var _0x1b72ae={'raw':!![],'where':{'id':_0x2589d1[_0xd7cd('0x2e')]['id']}},_0x2dc5d5={};_0x2dc5d5['model']=_['keys'](db[_0xd7cd('0x2f')][_0xd7cd('0x30')]);_0x2dc5d5[_0xd7cd('0x31')]=_[_0xd7cd('0x32')](_0x2589d1[_0xd7cd('0x31')]);_0x2dc5d5['filters']=_[_0xd7cd('0x33')](_0x2dc5d5['model'],_0x2dc5d5[_0xd7cd('0x31')]);_0x1b72ae[_0xd7cd('0x34')]=_[_0xd7cd('0x33')](_0x2dc5d5[_0xd7cd('0x35')],qs['fields'](_0x2589d1[_0xd7cd('0x31')][_0xd7cd('0x36')]));_0x1b72ae[_0xd7cd('0x34')]=_0x1b72ae[_0xd7cd('0x34')][_0xd7cd('0x37')]?_0x1b72ae[_0xd7cd('0x34')]:_0x2dc5d5[_0xd7cd('0x35')];if(_0x2589d1[_0xd7cd('0x31')]['includeAll']){_0x1b72ae[_0xd7cd('0x38')]=[{'all':!![]}];}_0x1b72ae=_[_0xd7cd('0x39')]({},_0x1b72ae,_0x2589d1['options']);return db['ChatApplication'][_0xd7cd('0x3a')](_0x1b72ae)[_0xd7cd('0x28')](handleEntityNotFound(_0x100e05,null))['then'](respondWithResult(_0x100e05,null))[_0xd7cd('0x3b')](handleError(_0x100e05,null));};exports[_0xd7cd('0x27')]=function(_0x54cfe1,_0x5b1112){if(_0x54cfe1[_0xd7cd('0x3c')]['id']){delete _0x54cfe1[_0xd7cd('0x3c')]['id'];}return db[_0xd7cd('0x2f')]['find']({'where':{'id':_0x54cfe1[_0xd7cd('0x2e')]['id']}})[_0xd7cd('0x28')](handleEntityNotFound(_0x5b1112,null))['then'](saveUpdates(_0x54cfe1[_0xd7cd('0x3c')],null))[_0xd7cd('0x28')](respondWithResult(_0x5b1112,null))[_0xd7cd('0x3b')](handleError(_0x5b1112,null));};exports[_0xd7cd('0x29')]=function(_0x41d15c,_0x29e21b){return db['ChatApplication']['find']({'where':{'id':_0x41d15c[_0xd7cd('0x2e')]['id']}})[_0xd7cd('0x28')](handleEntityNotFound(_0x29e21b,null))[_0xd7cd('0x28')](removeEntity(_0x29e21b,null))[_0xd7cd('0x3b')](handleError(_0x29e21b,null));}; \ No newline at end of file +var _0x888d=['json','count','offset','limit','set','apply','reject','save','update','then','destroy','error','name','show','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','fields','attributes','length','includeAll','include','options','find','catch','body','html-pdf','rimraf','zip-dir','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end'];(function(_0x4ed625,_0x384757){var _0x5b4bad=function(_0x4b4baf){while(--_0x4b4baf){_0x4ed625['push'](_0x4ed625['shift']());}};_0x5b4bad(++_0x384757);}(_0x888d,0x1e7));var _0xd888=function(_0x4c7a72,_0x419681){_0x4c7a72=_0x4c7a72-0x0;var _0x581ec3=_0x888d[_0x4c7a72];return _0x581ec3;};'use strict';var pdf=require(_0xd888('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd888('0x1'));var zipdir=require(_0xd888('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd888('0x3'));var Mustache=require(_0xd888('0x4'));var util=require('util');var path=require(_0xd888('0x5'));var sox=require(_0xd888('0x6'));var csv=require(_0xd888('0x7'));var ejs=require(_0xd888('0x8'));var fs=require('fs');var _=require(_0xd888('0x9'));var squel=require(_0xd888('0xa'));var crypto=require(_0xd888('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xd888('0xc'));var toCsv=require(_0xd888('0x7'));var querystring=require('querystring');var Papa=require(_0xd888('0xd'));var Redis=require(_0xd888('0xe'));var authService=require(_0xd888('0xf'));var qs=require(_0xd888('0x10'));var as=require(_0xd888('0x11'));var hardwareService=require(_0xd888('0x12'));var logger=require(_0xd888('0x13'))(_0xd888('0x14'));var utils=require(_0xd888('0x15'));var config=require('../../config/environment');var db=require(_0xd888('0x16'))['db'];function respondWithStatusCode(_0x38d824,_0x2e6763){_0x2e6763=_0x2e6763||0xcc;return function(_0x20ef53){if(_0x20ef53){return _0x38d824[_0xd888('0x17')](_0x2e6763);}return _0x38d824[_0xd888('0x18')](_0x2e6763)[_0xd888('0x19')]();};}function respondWithResult(_0x3f1d12,_0x23ab26){_0x23ab26=_0x23ab26||0xc8;return function(_0x2ccfc5){if(_0x2ccfc5){return _0x3f1d12[_0xd888('0x18')](_0x23ab26)[_0xd888('0x1a')](_0x2ccfc5);}};}function respondWithFilteredResult(_0x482ca7,_0x1f623d){return function(_0x51cb6f){if(_0x51cb6f){var _0x383f07=_0x51cb6f[_0xd888('0x1b')],_0x44c335=_0x1f623d[_0xd888('0x1c')],_0x5aadaf=_0x1f623d[_0xd888('0x1c')]+_0x1f623d[_0xd888('0x1d')],_0x405ec5;if(_0x5aadaf>=_0x383f07){_0x5aadaf=_0x383f07;_0x405ec5=0xc8;}else{_0x405ec5=0xce;}_0x482ca7['status'](_0x405ec5);return _0x482ca7[_0xd888('0x1e')]('Content-Range',_0x44c335+'-'+_0x5aadaf+'/'+_0x383f07)[_0xd888('0x1a')](_0x51cb6f);}return null;};}function patchUpdates(_0xbb9068){return function(_0x274118){try{jsonpatch[_0xd888('0x1f')](_0x274118,_0xbb9068,!![]);}catch(_0xae7e24){return BPromise[_0xd888('0x20')](_0xae7e24);}return _0x274118[_0xd888('0x21')]();};}function saveUpdates(_0x22a669,_0x40a839){return function(_0x462ed4){if(_0x462ed4){return _0x462ed4[_0xd888('0x22')](_0x22a669)[_0xd888('0x23')](function(_0x263939){return _0x263939;});}return null;};}function removeEntity(_0x1b67e3,_0x5f5085){return function(_0x1399c8){if(_0x1399c8){return _0x1399c8[_0xd888('0x24')]()['then'](function(){_0x1b67e3['status'](0xcc)[_0xd888('0x19')]();});}};}function handleEntityNotFound(_0x551179,_0x426686){return function(_0x50bd46){if(!_0x50bd46){_0x551179[_0xd888('0x17')](0x194);}return _0x50bd46;};}function handleError(_0x4e666d,_0x4dd5ab){_0x4dd5ab=_0x4dd5ab||0x1f4;return function(_0x48df52){logger[_0xd888('0x25')](_0x48df52['stack']);if(_0x48df52['name']){delete _0x48df52[_0xd888('0x26')];}_0x4e666d[_0xd888('0x18')](_0x4dd5ab)['send'](_0x48df52);};}exports[_0xd888('0x27')]=function(_0x59757f,_0x4d7292){var _0x2fa5b7={'raw':!![],'where':{'id':_0x59757f[_0xd888('0x28')]['id']}},_0x45ab4a={};_0x45ab4a[_0xd888('0x29')]=_[_0xd888('0x2a')](db[_0xd888('0x2b')][_0xd888('0x2c')]);_0x45ab4a[_0xd888('0x2d')]=_['keys'](_0x59757f[_0xd888('0x2d')]);_0x45ab4a[_0xd888('0x2e')]=_['intersection'](_0x45ab4a[_0xd888('0x29')],_0x45ab4a[_0xd888('0x2d')]);_0x2fa5b7['attributes']=_[_0xd888('0x2f')](_0x45ab4a['model'],qs[_0xd888('0x30')](_0x59757f[_0xd888('0x2d')][_0xd888('0x30')]));_0x2fa5b7[_0xd888('0x31')]=_0x2fa5b7[_0xd888('0x31')][_0xd888('0x32')]?_0x2fa5b7['attributes']:_0x45ab4a['model'];if(_0x59757f['query'][_0xd888('0x33')]){_0x2fa5b7[_0xd888('0x34')]=[{'all':!![]}];}_0x2fa5b7=_['merge']({},_0x2fa5b7,_0x59757f[_0xd888('0x35')]);return db[_0xd888('0x2b')][_0xd888('0x36')](_0x2fa5b7)['then'](handleEntityNotFound(_0x4d7292,null))[_0xd888('0x23')](respondWithResult(_0x4d7292,null))[_0xd888('0x37')](handleError(_0x4d7292,null));};exports[_0xd888('0x22')]=function(_0x13b0fa,_0x656ed1){if(_0x13b0fa[_0xd888('0x38')]['id']){delete _0x13b0fa[_0xd888('0x38')]['id'];}return db['ChatApplication'][_0xd888('0x36')]({'where':{'id':_0x13b0fa[_0xd888('0x28')]['id']}})[_0xd888('0x23')](handleEntityNotFound(_0x656ed1,null))[_0xd888('0x23')](saveUpdates(_0x13b0fa[_0xd888('0x38')],null))[_0xd888('0x23')](respondWithResult(_0x656ed1,null))[_0xd888('0x37')](handleError(_0x656ed1,null));};exports[_0xd888('0x24')]=function(_0x25fd85,_0x2a8caa){return db[_0xd888('0x2b')]['find']({'where':{'id':_0x25fd85[_0xd888('0x28')]['id']}})[_0xd888('0x23')](handleEntityNotFound(_0x2a8caa,null))[_0xd888('0x23')](removeEntity(_0x2a8caa,null))[_0xd888('0x37')](handleError(_0x2a8caa,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 84bce3d..c263f3d 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(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'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(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'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 0cec962..5e99b53 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 _0x5231=['client','http','request','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x3cf9e9,_0x3a47e3){var _0x2b9b9f=function(_0x50d1a9){while(--_0x50d1a9){_0x3cf9e9['push'](_0x3cf9e9['shift']());}};_0x2b9b9f(++_0x3a47e3);}(_0x5231,0x13a));var _0x1523=function(_0x534617,_0x41a7ba){_0x534617=_0x534617-0x0;var _0x516e6a=_0x5231[_0x534617];return _0x516e6a;};'use strict';var _=require('lodash');var util=require(_0x1523('0x0'));var moment=require(_0x1523('0x1'));var BPromise=require('bluebird');var rs=require(_0x1523('0x2'));var fs=require('fs');var Redis=require(_0x1523('0x3'));var db=require(_0x1523('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x1523('0x5'))('rpc');var config=require(_0x1523('0x6'));var jayson=require(_0x1523('0x7'));var client=jayson[_0x1523('0x8')][_0x1523('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5ac1d2,_0xd0214e,_0x1ea8bf){return new BPromise(function(_0x2f9bfd,_0x368aaf){return client[_0x1523('0xa')](_0x5ac1d2,_0x1ea8bf)[_0x1523('0xb')](function(_0x29fd2f){logger['info'](_0x1523('0xc'),_0xd0214e,_0x1523('0xd'));logger[_0x1523('0xe')](_0x1523('0xf'),_0xd0214e,'request\x20sent',JSON[_0x1523('0x10')](_0x29fd2f));if(_0x29fd2f[_0x1523('0x11')]){if(_0x29fd2f[_0x1523('0x11')][_0x1523('0x12')]===0x1f4){logger[_0x1523('0x11')](_0x1523('0xc'),_0xd0214e,_0x29fd2f[_0x1523('0x11')][_0x1523('0x13')]);return _0x368aaf(_0x29fd2f[_0x1523('0x11')][_0x1523('0x13')]);}logger['error'](_0x1523('0xc'),_0xd0214e,_0x29fd2f[_0x1523('0x11')][_0x1523('0x13')]);return _0x2f9bfd(_0x29fd2f['error'][_0x1523('0x13')]);}else{logger[_0x1523('0x14')](_0x1523('0xc'),_0xd0214e,_0x1523('0xd'));_0x2f9bfd(_0x29fd2f[_0x1523('0x15')][_0x1523('0x13')]);}})[_0x1523('0x16')](function(_0x30b2f2){logger[_0x1523('0x11')]('ChatApplication,\x20%s,\x20%s',_0xd0214e,_0x30b2f2);_0x368aaf(_0x30b2f2);});});} \ No newline at end of file +var _0xc6e4=['ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/logger','rpc','client','request','then','info','request\x20sent','debug'];(function(_0x215760,_0x580ac2){var _0xc3d8eb=function(_0x48ace1){while(--_0x48ace1){_0x215760['push'](_0x215760['shift']());}};_0xc3d8eb(++_0x580ac2);}(_0xc6e4,0x143));var _0x4c6e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc6e4[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x4c6e('0x0'));var util=require(_0x4c6e('0x1'));var moment=require(_0x4c6e('0x2'));var BPromise=require(_0x4c6e('0x3'));var rs=require(_0x4c6e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4c6e('0x5'))(_0x4c6e('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4c6e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24a8e1,_0x10acdc,_0x52fc12){return new BPromise(function(_0x118012,_0x44315e){return client[_0x4c6e('0x8')](_0x24a8e1,_0x52fc12)[_0x4c6e('0x9')](function(_0x15c52c){logger[_0x4c6e('0xa')]('ChatApplication,\x20%s,\x20%s',_0x10acdc,_0x4c6e('0xb'));logger[_0x4c6e('0xc')](_0x4c6e('0xd'),_0x10acdc,_0x4c6e('0xb'),JSON[_0x4c6e('0xe')](_0x15c52c));if(_0x15c52c[_0x4c6e('0xf')]){if(_0x15c52c[_0x4c6e('0xf')][_0x4c6e('0x10')]===0x1f4){logger[_0x4c6e('0xf')](_0x4c6e('0x11'),_0x10acdc,_0x15c52c[_0x4c6e('0xf')][_0x4c6e('0x12')]);return _0x44315e(_0x15c52c['error']['message']);}logger[_0x4c6e('0xf')](_0x4c6e('0x11'),_0x10acdc,_0x15c52c[_0x4c6e('0xf')]['message']);return _0x118012(_0x15c52c[_0x4c6e('0xf')][_0x4c6e('0x12')]);}else{logger[_0x4c6e('0xa')](_0x4c6e('0x11'),_0x10acdc,_0x4c6e('0xb'));_0x118012(_0x15c52c[_0x4c6e('0x13')][_0x4c6e('0x12')]);}})[_0x4c6e('0x14')](function(_0x2a4e5a){logger[_0x4c6e('0xf')](_0x4c6e('0x11'),_0x10acdc,_0x2a4e5a);_0x44315e(_0x2a4e5a);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 0b33bb7..930e402 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 _0x6412=['../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x1d5f7b,_0x210b0f){var _0x5c73eb=function(_0x3f83bf){while(--_0x3f83bf){_0x1d5f7b['push'](_0x1d5f7b['shift']());}};_0x5c73eb(++_0x210b0f);}(_0x6412,0xad));var _0x2641=function(_0x15bbd4,_0x738cc0){_0x15bbd4=_0x15bbd4-0x0;var _0x3c6863=_0x6412[_0x15bbd4];return _0x3c6863;};'use strict';var multer=require(_0x2641('0x0'));var util=require(_0x2641('0x1'));var path=require(_0x2641('0x2'));var timeout=require(_0x2641('0x3'));var express=require(_0x2641('0x4'));var router=express[_0x2641('0x5')]();var auth=require(_0x2641('0x6'));var interaction=require(_0x2641('0x7'));var config=require('../../config/environment');var controller=require(_0x2641('0x8'));router[_0x2641('0x9')](_0x2641('0xa'),auth[_0x2641('0xb')](),controller[_0x2641('0xc')]);router[_0x2641('0xd')](_0x2641('0xa'),auth[_0x2641('0xb')](),controller[_0x2641('0xe')]);router[_0x2641('0xf')](_0x2641('0xa'),auth[_0x2641('0xb')](),controller[_0x2641('0x10')]);module[_0x2641('0x11')]=router; \ No newline at end of file +var _0x0d62=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','multer'];(function(_0x24a7a4,_0x4b23ac){var _0x23aa4a=function(_0x3cc01f){while(--_0x3cc01f){_0x24a7a4['push'](_0x24a7a4['shift']());}};_0x23aa4a(++_0x4b23ac);}(_0x0d62,0x98));var _0x20d6=function(_0x34843e,_0x4c4224){_0x34843e=_0x34843e-0x0;var _0x598f7f=_0x0d62[_0x34843e];return _0x598f7f;};'use strict';var multer=require(_0x20d6('0x0'));var util=require(_0x20d6('0x1'));var path=require('path');var timeout=require(_0x20d6('0x2'));var express=require(_0x20d6('0x3'));var router=express[_0x20d6('0x4')]();var auth=require(_0x20d6('0x5'));var interaction=require(_0x20d6('0x6'));var config=require('../../config/environment');var controller=require(_0x20d6('0x7'));router[_0x20d6('0x8')](_0x20d6('0x9'),auth[_0x20d6('0xa')](),controller[_0x20d6('0xb')]);router[_0x20d6('0xc')]('/:id',auth[_0x20d6('0xa')](),controller[_0x20d6('0xd')]);router[_0x20d6('0xe')](_0x20d6('0x9'),auth[_0x20d6('0xa')](),controller[_0x20d6('0xf')]);module[_0x20d6('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 5593650..82a8ed6 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 _0xf430=['BOOLEAN','sequelize','STRING'];(function(_0x4fd572,_0x17e456){var _0x4cb8c8=function(_0x156ed6){while(--_0x156ed6){_0x4fd572['push'](_0x4fd572['shift']());}};_0x4cb8c8(++_0x17e456);}(_0xf430,0xb5));var _0x0f43=function(_0x1ad926,_0x3e1fed){_0x1ad926=_0x1ad926-0x0;var _0x1b81dc=_0xf430[_0x1ad926];return _0x1b81dc;};'use strict';var Sequelize=require(_0x0f43('0x0'));module['exports']={'name':{'type':Sequelize[_0x0f43('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x0f43('0x1')]},'write':{'type':Sequelize[_0x0f43('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xea86=['BOOLEAN','exports','STRING'];(function(_0x2c9531,_0x3554a8){var _0x5c4723=function(_0x1a054a){while(--_0x1a054a){_0x2c9531['push'](_0x2c9531['shift']());}};_0x5c4723(++_0x3554a8);}(_0xea86,0x1d8));var _0x6ea8=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xea86[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x6ea8('0x0')]={'name':{'type':Sequelize[_0x6ea8('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x6ea8('0x1')]},'write':{'type':Sequelize[_0x6ea8('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 ce7ba87..ae15c54 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 _0x82b2=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','request','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','info','result','sendStatus','status','end','count','offset','set','reject','save','update','then','destroy','name','send','index','map','ChatGroup','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','find','catch','create','body','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','getMembers','findOne','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','ioredis','../../components/auth/service'];(function(_0x5c2db,_0x3c9bff){var _0x45a350=function(_0x5aa807){while(--_0x5aa807){_0x5c2db['push'](_0x5c2db['shift']());}};_0x45a350(++_0x3c9bff);}(_0x82b2,0x132));var _0x282b=function(_0x118afa,_0x4bf0c1){_0x118afa=_0x118afa-0x0;var _0x167d76=_0x82b2[_0x118afa];return _0x167d76;};'use strict';var pdf=require(_0x282b('0x0'));var emlformat=require(_0x282b('0x1'));var rimraf=require(_0x282b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x282b('0x3'));var rp=require(_0x282b('0x4'));var moment=require(_0x282b('0x5'));var BPromise=require(_0x282b('0x6'));var Mustache=require('mustache');var util=require(_0x282b('0x7'));var path=require(_0x282b('0x8'));var sox=require(_0x282b('0x9'));var csv=require('to-csv');var ejs=require(_0x282b('0xa'));var fs=require('fs');var _=require(_0x282b('0xb'));var squel=require(_0x282b('0xc'));var crypto=require(_0x282b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x282b('0xe'));var toCsv=require(_0x282b('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x282b('0x10'));var authService=require(_0x282b('0x11'));var qs=require(_0x282b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x282b('0x13'));var logger=require(_0x282b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x282b('0x15'));var db=require(_0x282b('0x16'))['db'];config[_0x282b('0x17')]=_[_0x282b('0x18')](config[_0x282b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x282b('0x19'))(new Redis(config[_0x282b('0x17')]));require('./chatGroup.socket')[_0x282b('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x282b('0x1b')][_0x282b('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x30db76,_0x752c55,_0x50bdd9){if(_0x50bdd9){var _0x323a88=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x323a88[_0x282b('0x1d')](_0x752c55)){return _0x30db76;}else{throw new db[(_0x282b('0x1e'))][(_0x282b('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x30db76;}}function respondWithRpcPromise(_0x3cc2f4,_0x2d7d63,_0x31af4f,_0x5374fe){return new BPromise(function(_0x3d6934,_0x56c2e1){var _0x52878d=_0x5374fe||client;return _0x52878d[_0x282b('0x20')](_0x3cc2f4,_0x31af4f)['then'](function(_0x1645a9){logger['info']('ChatGroup,\x20%s,\x20%s',_0x2d7d63,_0x282b('0x21'));logger['debug'](_0x282b('0x22'),_0x2d7d63,_0x282b('0x21'),JSON[_0x282b('0x23')](_0x1645a9));if(_0x1645a9[_0x282b('0x24')]){if(_0x1645a9['error'][_0x282b('0x25')]===0x1f4){logger[_0x282b('0x24')](_0x282b('0x26'),_0x2d7d63,_0x1645a9[_0x282b('0x24')][_0x282b('0x27')]);return _0x56c2e1(_0x1645a9[_0x282b('0x24')]['message']);}logger[_0x282b('0x24')](_0x282b('0x26'),_0x2d7d63,_0x1645a9[_0x282b('0x24')]['message']);return _0x3d6934(_0x1645a9[_0x282b('0x24')]['message']);}else{logger[_0x282b('0x28')](_0x282b('0x26'),_0x2d7d63,_0x282b('0x21'));_0x3d6934(_0x1645a9[_0x282b('0x29')][_0x282b('0x27')]);}})['catch'](function(_0x31fdb4){logger[_0x282b('0x24')](_0x282b('0x26'),_0x2d7d63,_0x31fdb4);_0x56c2e1(_0x31fdb4);});});}function respondWithStatusCode(_0x481d5c,_0x4fe2d7){_0x4fe2d7=_0x4fe2d7||0xcc;return function(_0x508a47){if(_0x508a47){return _0x481d5c[_0x282b('0x2a')](_0x4fe2d7);}return _0x481d5c[_0x282b('0x2b')](_0x4fe2d7)[_0x282b('0x2c')]();};}function respondWithResult(_0x4b0423,_0x2b26e0){_0x2b26e0=_0x2b26e0||0xc8;return function(_0xa68894){if(_0xa68894){return _0x4b0423[_0x282b('0x2b')](_0x2b26e0)['json'](_0xa68894);}};}function respondWithFilteredResult(_0x4d5468,_0x416c42){return function(_0x3bc5fa){if(_0x3bc5fa){var _0x2c6a44=_0x3bc5fa[_0x282b('0x2d')],_0x3c2820=_0x416c42[_0x282b('0x2e')],_0x291198=_0x416c42[_0x282b('0x2e')]+_0x416c42['limit'],_0x48bca8;if(_0x291198>=_0x2c6a44){_0x291198=_0x2c6a44;_0x48bca8=0xc8;}else{_0x48bca8=0xce;}_0x4d5468[_0x282b('0x2b')](_0x48bca8);return _0x4d5468[_0x282b('0x2f')]('Content-Range',_0x3c2820+'-'+_0x291198+'/'+_0x2c6a44)['json'](_0x3bc5fa);}return null;};}function patchUpdates(_0xbe882b){return function(_0xb33b85){try{jsonpatch['apply'](_0xb33b85,_0xbe882b,!![]);}catch(_0x2e0bb4){return BPromise[_0x282b('0x30')](_0x2e0bb4);}return _0xb33b85[_0x282b('0x31')]();};}function saveUpdates(_0x3274ff,_0x57df27){return function(_0x2098e7){if(_0x2098e7){return _0x2098e7[_0x282b('0x32')](_0x3274ff)[_0x282b('0x33')](function(_0x5198e0){return _0x5198e0;});}return null;};}function removeEntity(_0x28a088,_0x54388f){return function(_0x48ee49){if(_0x48ee49){return _0x48ee49[_0x282b('0x34')]()['then'](function(){_0x28a088[_0x282b('0x2b')](0xcc)[_0x282b('0x2c')]();});}};}function handleEntityNotFound(_0x2e018b,_0xba3f05){return function(_0x1c368d){if(!_0x1c368d){_0x2e018b['sendStatus'](0x194);}return _0x1c368d;};}function handleError(_0x46c895,_0x27115b){_0x27115b=_0x27115b||0x1f4;return function(_0x1a6f8e){logger[_0x282b('0x24')](_0x1a6f8e['stack']);if(_0x1a6f8e['name']){delete _0x1a6f8e[_0x282b('0x35')];}_0x46c895['status'](_0x27115b)[_0x282b('0x36')](_0x1a6f8e);};}exports[_0x282b('0x37')]=function(_0x322d3f,_0x48f53d){var _0xc5bfd1={},_0x52210d={},_0x42a697={'count':0x0,'rows':[]};var _0x122f04=_[_0x282b('0x38')](db[_0x282b('0x39')][_0x282b('0x3a')],function(_0x4ff27f){return{'name':_0x4ff27f[_0x282b('0x3b')],'type':_0x4ff27f[_0x282b('0x3c')][_0x282b('0x3d')]};});_0x52210d[_0x282b('0x3e')]=_[_0x282b('0x38')](_0x122f04,_0x282b('0x35'));_0x52210d[_0x282b('0x3f')]=_['keys'](_0x322d3f['query']);_0x52210d[_0x282b('0x40')]=_[_0x282b('0x41')](_0x52210d[_0x282b('0x3e')],_0x52210d['query']);_0xc5bfd1[_0x282b('0x42')]=_[_0x282b('0x41')](_0x52210d[_0x282b('0x3e')],qs[_0x282b('0x43')](_0x322d3f[_0x282b('0x3f')]['fields']));_0xc5bfd1['attributes']=_0xc5bfd1['attributes'][_0x282b('0x44')]?_0xc5bfd1['attributes']:_0x52210d[_0x282b('0x3e')];if(!_0x322d3f['query']['hasOwnProperty'](_0x282b('0x45'))){_0xc5bfd1['limit']=qs[_0x282b('0x46')](_0x322d3f['query']['limit']);_0xc5bfd1['offset']=qs[_0x282b('0x2e')](_0x322d3f[_0x282b('0x3f')]['offset']);}_0xc5bfd1[_0x282b('0x47')]=qs['sort'](_0x322d3f[_0x282b('0x3f')][_0x282b('0x48')]);_0xc5bfd1[_0x282b('0x49')]=qs[_0x282b('0x40')](_[_0x282b('0x4a')](_0x322d3f[_0x282b('0x3f')],_0x52210d[_0x282b('0x40')]));if(_0x322d3f['query'][_0x282b('0x4b')]){_0xc5bfd1[_0x282b('0x49')]=_[_0x282b('0x4c')](_0xc5bfd1[_0x282b('0x49')],{'$or':_['map'](_0x122f04,function(_0x55b3a8){if(_0x55b3a8[_0x282b('0x3c')]!==_0x282b('0x4d')){var _0x531962={};_0x531962[_0x55b3a8['name']]={'$like':'%'+_0x322d3f[_0x282b('0x3f')][_0x282b('0x4b')]+'%'};return _0x531962;}})});}_0xc5bfd1=_[_0x282b('0x4c')]({},_0xc5bfd1,_0x322d3f[_0x282b('0x4e')]);var _0x441d21={'where':_0xc5bfd1[_0x282b('0x49')]};return db[_0x282b('0x39')][_0x282b('0x2d')](_0x441d21)[_0x282b('0x33')](function(_0x5131d6){_0x42a697[_0x282b('0x2d')]=_0x5131d6;if(_0x322d3f['query'][_0x282b('0x4f')]){_0xc5bfd1[_0x282b('0x50')]=[{'all':!![]}];}return db[_0x282b('0x39')][_0x282b('0x51')](_0xc5bfd1);})[_0x282b('0x33')](function(_0x50b95a){_0x42a697[_0x282b('0x52')]=_0x50b95a;return _0x42a697;})[_0x282b('0x33')](respondWithFilteredResult(_0x48f53d,_0xc5bfd1))['catch'](handleError(_0x48f53d,null));};exports['show']=function(_0x17a943,_0x76a461){var _0x52a471={'raw':!![],'where':{'id':_0x17a943[_0x282b('0x53')]['id']}},_0x5ecb0d={};_0x5ecb0d[_0x282b('0x3e')]=_[_0x282b('0x54')](db[_0x282b('0x39')][_0x282b('0x3a')]);_0x5ecb0d['query']=_['keys'](_0x17a943['query']);_0x5ecb0d['filters']=_[_0x282b('0x41')](_0x5ecb0d[_0x282b('0x3e')],_0x5ecb0d[_0x282b('0x3f')]);_0x52a471[_0x282b('0x42')]=_[_0x282b('0x41')](_0x5ecb0d['model'],qs['fields'](_0x17a943[_0x282b('0x3f')][_0x282b('0x43')]));_0x52a471['attributes']=_0x52a471['attributes']['length']?_0x52a471[_0x282b('0x42')]:_0x5ecb0d[_0x282b('0x3e')];if(_0x17a943['query'][_0x282b('0x4f')]){_0x52a471[_0x282b('0x50')]=[{'all':!![]}];}_0x52a471=_[_0x282b('0x4c')]({},_0x52a471,_0x17a943[_0x282b('0x4e')]);return db[_0x282b('0x39')][_0x282b('0x55')](_0x52a471)[_0x282b('0x33')](handleEntityNotFound(_0x76a461,null))[_0x282b('0x33')](respondWithResult(_0x76a461,null))[_0x282b('0x56')](handleError(_0x76a461,null));};exports[_0x282b('0x57')]=function(_0x18fbe8,_0x1e3d7d){return db['ChatGroup'][_0x282b('0x57')](_0x18fbe8[_0x282b('0x58')],{})[_0x282b('0x33')](respondWithResult(_0x1e3d7d,0xc9))[_0x282b('0x56')](handleError(_0x1e3d7d,null));};exports['update']=function(_0x5dd017,_0x29a149){if(_0x5dd017[_0x282b('0x58')]['id']){delete _0x5dd017[_0x282b('0x58')]['id'];}return db['ChatGroup'][_0x282b('0x55')]({'where':{'id':_0x5dd017[_0x282b('0x53')]['id']}})[_0x282b('0x33')](handleEntityNotFound(_0x29a149,null))['then'](saveUpdates(_0x5dd017[_0x282b('0x58')],null))[_0x282b('0x33')](respondWithResult(_0x29a149,null))[_0x282b('0x56')](handleError(_0x29a149,null));};exports[_0x282b('0x34')]=function(_0x37ab16,_0x1f63fe){return db['ChatGroup'][_0x282b('0x55')]({'where':{'id':_0x37ab16[_0x282b('0x53')]['id']}})['then'](handleEntityNotFound(_0x1f63fe,null))['then'](removeEntity(_0x1f63fe,null))['catch'](handleError(_0x1f63fe,null));};exports['describe']=function(_0xe7893f,_0x2fac69){return db[_0x282b('0x39')][_0x282b('0x59')]()['then'](respondWithResult(_0x2fac69,null))[_0x282b('0x56')](handleError(_0x2fac69,null));};exports[_0x282b('0x5a')]=function(_0x1d7c17,_0x4e6c0,_0x1e073c){return db[_0x282b('0x5b')][_0x282b('0x2d')]({'where':{'ChatGroupId':_0x1d7c17[_0x282b('0x53')]['id'],'ToId':_0x1d7c17[_0x282b('0x5c')]['id'],'read':![]}})[_0x282b('0x33')](function(_0x151a08){return{'id':_[_0x282b('0x5d')](_0x1d7c17['params']['id']),'count':_0x151a08};})['then'](respondWithResult(_0x4e6c0,null))[_0x282b('0x56')](handleError(_0x4e6c0,null));};exports[_0x282b('0x5e')]=function(_0x536166,_0x39d41e,_0x28354a){return db[_0x282b('0x39')][_0x282b('0x55')]({'where':{'id':_0x536166[_0x282b('0x53')]['id']}})[_0x282b('0x33')](handleEntityNotFound(_0x39d41e,null))[_0x282b('0x33')](function(_0x4bdbf3){if(_0x4bdbf3){return _0x4bdbf3[_0x282b('0x5e')](_0x536166[_0x282b('0x58')][_0x282b('0x5f')],_['omit'](_0x536166[_0x282b('0x58')],[_0x282b('0x5f'),'id'])||{});}})['then'](respondWithResult(_0x39d41e,null))['catch'](handleError(_0x39d41e,null));};exports[_0x282b('0x60')]=function(_0x2aa85f,_0x3e38c4,_0x140f9e){var _0xaa9803={};var _0x56e7dc={};var _0x18fc66;var _0x310107;return db[_0x282b('0x39')][_0x282b('0x61')]({'where':{'id':_0x2aa85f['params']['id']}})[_0x282b('0x33')](handleEntityNotFound(_0x3e38c4,null))['then'](function(_0x4fa1d9){if(_0x4fa1d9){_0x18fc66=_0x4fa1d9;_0x56e7dc[_0x282b('0x3e')]=_['keys'](db[_0x282b('0x62')]['rawAttributes']);_0x56e7dc[_0x282b('0x3f')]=_[_0x282b('0x54')](_0x2aa85f[_0x282b('0x3f')]);_0x56e7dc['filters']=_[_0x282b('0x41')](_0x56e7dc[_0x282b('0x3e')],_0x56e7dc['query']);_0xaa9803[_0x282b('0x42')]=_[_0x282b('0x41')](_0x56e7dc[_0x282b('0x3e')],qs[_0x282b('0x43')](_0x2aa85f[_0x282b('0x3f')][_0x282b('0x43')]));_0xaa9803[_0x282b('0x42')]=_0xaa9803['attributes'][_0x282b('0x44')]?_0xaa9803['attributes']:_0x56e7dc[_0x282b('0x3e')];_0xaa9803[_0x282b('0x47')]=qs[_0x282b('0x48')](_0x2aa85f[_0x282b('0x3f')][_0x282b('0x48')]);_0xaa9803['where']=qs[_0x282b('0x40')](_[_0x282b('0x4a')](_0x2aa85f['query'],_0x56e7dc[_0x282b('0x40')]));if(_0x2aa85f[_0x282b('0x3f')][_0x282b('0x4b')]){_0xaa9803['where']=_['merge'](_0xaa9803[_0x282b('0x49')],{'$or':_[_0x282b('0x38')](_0xaa9803['attributes'],function(_0x2eb2a0){var _0x3ad0ab={};_0x3ad0ab[_0x2eb2a0]={'$like':'%'+_0x2aa85f['query'][_0x282b('0x4b')]+'%'};return _0x3ad0ab;})});}_0xaa9803=_['merge']({},_0xaa9803,_0x2aa85f[_0x282b('0x4e')]);return _0x18fc66[_0x282b('0x60')](_0xaa9803);}})[_0x282b('0x33')](function(_0x4a41fa){if(_0x4a41fa){_0x310107=_0x4a41fa['length'];if(!_0x2aa85f[_0x282b('0x3f')][_0x282b('0x63')](_0x282b('0x45'))){_0xaa9803[_0x282b('0x46')]=qs[_0x282b('0x46')](_0x2aa85f['query']['limit']);_0xaa9803[_0x282b('0x2e')]=qs[_0x282b('0x2e')](_0x2aa85f[_0x282b('0x3f')][_0x282b('0x2e')]);}return _0x18fc66['getMembers'](_0xaa9803);}})[_0x282b('0x33')](function(_0x53c956){if(_0x53c956){return _0x53c956?{'count':_0x310107,'rows':_0x53c956}:null;}})[_0x282b('0x33')](respondWithResult(_0x3e38c4,null))['catch'](handleError(_0x3e38c4,null));};exports[_0x282b('0x64')]=function(_0x2ae7fb,_0x31feab,_0x2a10e0){return db[_0x282b('0x39')][_0x282b('0x55')]({'where':{'id':_0x2ae7fb['params']['id']}})[_0x282b('0x33')](handleEntityNotFound(_0x31feab,null))[_0x282b('0x33')](function(_0x22e135){if(_0x22e135){return _0x22e135[_0x282b('0x64')](_0x2ae7fb[_0x282b('0x3f')][_0x282b('0x5f')]);}})[_0x282b('0x33')](respondWithStatusCode(_0x31feab,null))['catch'](handleError(_0x31feab,null));};exports[_0x282b('0x65')]=function(_0x3a8cba,_0x991f2d,_0x5ae268){if(_0x3a8cba['body']['id']){delete _0x3a8cba['body']['id'];}return db[_0x282b('0x39')][_0x282b('0x55')]({'where':{'id':_0x3a8cba[_0x282b('0x53')]['id']}})[_0x282b('0x33')](handleEntityNotFound(_0x991f2d,null))['then'](function(_0x37d0d1){if(_0x37d0d1){_0x3a8cba['body'][_0x282b('0x66')]=_0x37d0d1['id'];return db['ChatInternalMessage'][_0x282b('0x57')](_0x3a8cba[_0x282b('0x58')]);}})[_0x282b('0x33')](respondWithResult(_0x991f2d,null))['catch'](handleError(_0x991f2d,null));};exports[_0x282b('0x67')]=function(_0x4060a4,_0x53a085,_0x52c567){var _0x41cab6={};var _0x2e29e5={};var _0x14c402;var _0x5d990a;return db[_0x282b('0x39')][_0x282b('0x61')]({'where':{'id':_0x4060a4[_0x282b('0x53')]['id']}})['then'](handleEntityNotFound(_0x53a085,null))[_0x282b('0x33')](function(_0x2f6353){if(_0x2f6353){_0x14c402=_0x2f6353;_0x2e29e5[_0x282b('0x3e')]=_[_0x282b('0x54')](db[_0x282b('0x5b')][_0x282b('0x3a')]);_0x2e29e5[_0x282b('0x3f')]=_[_0x282b('0x54')](_0x4060a4[_0x282b('0x3f')]);_0x2e29e5['filters']=_[_0x282b('0x41')](_0x2e29e5[_0x282b('0x3e')],_0x2e29e5['query']);_0x41cab6[_0x282b('0x42')]=_[_0x282b('0x41')](_0x2e29e5[_0x282b('0x3e')],qs[_0x282b('0x43')](_0x4060a4[_0x282b('0x3f')][_0x282b('0x43')]));_0x41cab6[_0x282b('0x42')]=_0x41cab6[_0x282b('0x42')][_0x282b('0x44')]?_0x41cab6['attributes']:_0x2e29e5['model'];_0x41cab6[_0x282b('0x47')]=qs[_0x282b('0x48')](_0x4060a4[_0x282b('0x3f')]['sort']);_0x41cab6[_0x282b('0x49')]=qs[_0x282b('0x40')](_['pick'](_0x4060a4[_0x282b('0x3f')],_0x2e29e5['filters']));if(_0x4060a4[_0x282b('0x3f')][_0x282b('0x4b')]){_0x41cab6[_0x282b('0x49')]=_[_0x282b('0x4c')](_0x41cab6[_0x282b('0x49')],{'$or':_['map'](_0x41cab6[_0x282b('0x42')],function(_0x33d5fe){var _0x1a50e4={};_0x1a50e4[_0x33d5fe]={'$like':'%'+_0x4060a4[_0x282b('0x3f')][_0x282b('0x4b')]+'%'};return _0x1a50e4;})});}if(_0x4060a4[_0x282b('0x3f')][_0x282b('0x68')]){var _0x5bb810=_0x4060a4[_0x282b('0x3f')][_0x282b('0x68')][_0x282b('0x69')](',');var _0x10f3d2={};_0x10f3d2[_0x5bb810[0x0]]={'$gte':moment(_0x5bb810[0x1])[_0x282b('0x6a')](_0x282b('0x6b'))};_0x41cab6[_0x282b('0x49')]=_[_0x282b('0x4c')](_0x41cab6[_0x282b('0x49')],_0x10f3d2);}_0x41cab6=_[_0x282b('0x4c')]({},_0x41cab6,_0x4060a4[_0x282b('0x4e')]);return _0x14c402['getMessages'](_0x41cab6);}})[_0x282b('0x33')](function(_0x55f7c4){if(_0x55f7c4){_0x5d990a=_0x55f7c4['length'];if(!_0x4060a4[_0x282b('0x3f')][_0x282b('0x63')](_0x282b('0x45'))){_0x41cab6[_0x282b('0x46')]=qs[_0x282b('0x46')](_0x4060a4[_0x282b('0x3f')][_0x282b('0x46')]);_0x41cab6['offset']=qs[_0x282b('0x2e')](_0x4060a4[_0x282b('0x3f')][_0x282b('0x2e')]);}return _0x14c402[_0x282b('0x67')](_0x41cab6);}})[_0x282b('0x33')](function(_0x3f4fc8){if(_0x3f4fc8){return _0x3f4fc8?{'count':_0x5d990a,'rows':_0x3f4fc8}:null;}})['then'](respondWithResult(_0x53a085,null))[_0x282b('0x56')](handleError(_0x53a085,null));}; \ No newline at end of file +var _0x697c=['addMessage','ChatGroupId','$gte','split','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','socket.io-emitter','./chatGroup.socket','register','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','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','set','apply','reject','save','update','name','map','rawAttributes','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','type','VIRTUAL','merge','ChatGroup','count','includeAll','include','findAll','rows','show','options','find','create','body','params','destroy','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','ids','findOne','User','pick','filter','getMembers','removeMembers'];(function(_0x164af1,_0x3cf772){var _0x5d81a2=function(_0xa57547){while(--_0xa57547){_0x164af1['push'](_0x164af1['shift']());}};_0x5d81a2(++_0x3cf772);}(_0x697c,0x6d));var _0xc697=function(_0x3f0123,_0x4a8c0e){_0x3f0123=_0x3f0123-0x0;var _0x397eb9=_0x697c[_0x3f0123];return _0x397eb9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc697('0x0'));var rimraf=require(_0xc697('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xc697('0x2'));var rp=require(_0xc697('0x3'));var moment=require(_0xc697('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc697('0x5'));var util=require(_0xc697('0x6'));var path=require(_0xc697('0x7'));var sox=require(_0xc697('0x8'));var csv=require(_0xc697('0x9'));var ejs=require(_0xc697('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc697('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc697('0x9'));var querystring=require(_0xc697('0xc'));var Papa=require(_0xc697('0xd'));var Redis=require(_0xc697('0xe'));var authService=require(_0xc697('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xc697('0x10'));var hardwareService=require(_0xc697('0x11'));var logger=require(_0xc697('0x12'))(_0xc697('0x13'));var utils=require(_0xc697('0x14'));var config=require(_0xc697('0x15'));var db=require(_0xc697('0x16'))['db'];config[_0xc697('0x17')]=_[_0xc697('0x18')](config[_0xc697('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xc697('0x19'))(new Redis(config[_0xc697('0x17')]));require(_0xc697('0x1a'))[_0xc697('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc697('0x1c')][_0xc697('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x15d50a,_0xec576e,_0x1140a8){if(_0x1140a8){var _0x4b8353=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4b8353[_0xc697('0x1e')](_0xec576e)){return _0x15d50a;}else{throw new db['Sequelize']['ValidationError'](_0xc697('0x1f'));}}else{return _0x15d50a;}}function respondWithRpcPromise(_0x45438e,_0x1a1e26,_0x2818a8,_0x18afc4){return new BPromise(function(_0x5c5044,_0xdb95e9){var _0x9c26c5=_0x18afc4||client;return _0x9c26c5[_0xc697('0x20')](_0x45438e,_0x2818a8)[_0xc697('0x21')](function(_0x1ee0d0){logger[_0xc697('0x22')](_0xc697('0x23'),_0x1a1e26,_0xc697('0x24'));logger[_0xc697('0x25')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x1a1e26,_0xc697('0x24'),JSON[_0xc697('0x26')](_0x1ee0d0));if(_0x1ee0d0[_0xc697('0x27')]){if(_0x1ee0d0[_0xc697('0x27')][_0xc697('0x28')]===0x1f4){logger['error']('ChatGroup,\x20%s,\x20%s',_0x1a1e26,_0x1ee0d0[_0xc697('0x27')][_0xc697('0x29')]);return _0xdb95e9(_0x1ee0d0[_0xc697('0x27')][_0xc697('0x29')]);}logger[_0xc697('0x27')]('ChatGroup,\x20%s,\x20%s',_0x1a1e26,_0x1ee0d0[_0xc697('0x27')][_0xc697('0x29')]);return _0x5c5044(_0x1ee0d0[_0xc697('0x27')][_0xc697('0x29')]);}else{logger[_0xc697('0x22')]('ChatGroup,\x20%s,\x20%s',_0x1a1e26,'request\x20sent');_0x5c5044(_0x1ee0d0[_0xc697('0x2a')][_0xc697('0x29')]);}})[_0xc697('0x2b')](function(_0x1099ba){logger[_0xc697('0x27')](_0xc697('0x23'),_0x1a1e26,_0x1099ba);_0xdb95e9(_0x1099ba);});});}function respondWithStatusCode(_0x2a6a7d,_0x4f28f6){_0x4f28f6=_0x4f28f6||0xcc;return function(_0x238773){if(_0x238773){return _0x2a6a7d[_0xc697('0x2c')](_0x4f28f6);}return _0x2a6a7d[_0xc697('0x2d')](_0x4f28f6)[_0xc697('0x2e')]();};}function respondWithResult(_0x57d98a,_0x41cf92){_0x41cf92=_0x41cf92||0xc8;return function(_0x20e9f6){if(_0x20e9f6){return _0x57d98a['status'](_0x41cf92)['json'](_0x20e9f6);}};}function respondWithFilteredResult(_0x248d19,_0x1d8606){return function(_0x126193){if(_0x126193){var _0x34cf5d=_0x126193['count'],_0x3cb2ea=_0x1d8606[_0xc697('0x2f')],_0x3c1cfd=_0x1d8606[_0xc697('0x2f')]+_0x1d8606[_0xc697('0x30')],_0x57214e;if(_0x3c1cfd>=_0x34cf5d){_0x3c1cfd=_0x34cf5d;_0x57214e=0xc8;}else{_0x57214e=0xce;}_0x248d19[_0xc697('0x2d')](_0x57214e);return _0x248d19[_0xc697('0x31')]('Content-Range',_0x3cb2ea+'-'+_0x3c1cfd+'/'+_0x34cf5d)['json'](_0x126193);}return null;};}function patchUpdates(_0x576065){return function(_0x4029ec){try{jsonpatch[_0xc697('0x32')](_0x4029ec,_0x576065,!![]);}catch(_0x17a113){return BPromise[_0xc697('0x33')](_0x17a113);}return _0x4029ec[_0xc697('0x34')]();};}function saveUpdates(_0x4d6e7a,_0x410195){return function(_0x3e782e){if(_0x3e782e){return _0x3e782e[_0xc697('0x35')](_0x4d6e7a)['then'](function(_0x3756ec){return _0x3756ec;});}return null;};}function removeEntity(_0x407271,_0x4dff4e){return function(_0x415151){if(_0x415151){return _0x415151['destroy']()[_0xc697('0x21')](function(){_0x407271[_0xc697('0x2d')](0xcc)[_0xc697('0x2e')]();});}};}function handleEntityNotFound(_0x453a98,_0x532d70){return function(_0xa986ca){if(!_0xa986ca){_0x453a98[_0xc697('0x2c')](0x194);}return _0xa986ca;};}function handleError(_0x5b8390,_0x34b854){_0x34b854=_0x34b854||0x1f4;return function(_0xae1ca2){logger[_0xc697('0x27')](_0xae1ca2['stack']);if(_0xae1ca2[_0xc697('0x36')]){delete _0xae1ca2['name'];}_0x5b8390[_0xc697('0x2d')](_0x34b854)['send'](_0xae1ca2);};}exports['index']=function(_0x1450f5,_0xb8febc){var _0x1417a4={},_0x5d5800={},_0x574d16={'count':0x0,'rows':[]};var _0x5bb860=_[_0xc697('0x37')](db['ChatGroup'][_0xc697('0x38')],function(_0x12d7fa){return{'name':_0x12d7fa['fieldName'],'type':_0x12d7fa['type']['key']};});_0x5d5800['model']=_[_0xc697('0x37')](_0x5bb860,'name');_0x5d5800[_0xc697('0x39')]=_[_0xc697('0x3a')](_0x1450f5[_0xc697('0x39')]);_0x5d5800[_0xc697('0x3b')]=_[_0xc697('0x3c')](_0x5d5800[_0xc697('0x3d')],_0x5d5800[_0xc697('0x39')]);_0x1417a4[_0xc697('0x3e')]=_['intersection'](_0x5d5800[_0xc697('0x3d')],qs[_0xc697('0x3f')](_0x1450f5[_0xc697('0x39')][_0xc697('0x3f')]));_0x1417a4[_0xc697('0x3e')]=_0x1417a4[_0xc697('0x3e')][_0xc697('0x40')]?_0x1417a4[_0xc697('0x3e')]:_0x5d5800[_0xc697('0x3d')];if(!_0x1450f5[_0xc697('0x39')][_0xc697('0x41')](_0xc697('0x42'))){_0x1417a4[_0xc697('0x30')]=qs['limit'](_0x1450f5[_0xc697('0x39')][_0xc697('0x30')]);_0x1417a4['offset']=qs['offset'](_0x1450f5[_0xc697('0x39')][_0xc697('0x2f')]);}_0x1417a4[_0xc697('0x43')]=qs['sort'](_0x1450f5['query'][_0xc697('0x44')]);_0x1417a4['where']=qs[_0xc697('0x3b')](_['pick'](_0x1450f5[_0xc697('0x39')],_0x5d5800['filters']));if(_0x1450f5[_0xc697('0x39')]['filter']){_0x1417a4[_0xc697('0x45')]=_['merge'](_0x1417a4[_0xc697('0x45')],{'$or':_[_0xc697('0x37')](_0x5bb860,function(_0x552f0d){if(_0x552f0d[_0xc697('0x46')]!==_0xc697('0x47')){var _0x4a107f={};_0x4a107f[_0x552f0d[_0xc697('0x36')]]={'$like':'%'+_0x1450f5[_0xc697('0x39')]['filter']+'%'};return _0x4a107f;}})});}_0x1417a4=_[_0xc697('0x48')]({},_0x1417a4,_0x1450f5['options']);var _0x43f67a={'where':_0x1417a4[_0xc697('0x45')]};return db[_0xc697('0x49')][_0xc697('0x4a')](_0x43f67a)[_0xc697('0x21')](function(_0x3e8e12){_0x574d16[_0xc697('0x4a')]=_0x3e8e12;if(_0x1450f5['query'][_0xc697('0x4b')]){_0x1417a4[_0xc697('0x4c')]=[{'all':!![]}];}return db[_0xc697('0x49')][_0xc697('0x4d')](_0x1417a4);})[_0xc697('0x21')](function(_0x175fb){_0x574d16[_0xc697('0x4e')]=_0x175fb;return _0x574d16;})[_0xc697('0x21')](respondWithFilteredResult(_0xb8febc,_0x1417a4))['catch'](handleError(_0xb8febc,null));};exports[_0xc697('0x4f')]=function(_0x380c5c,_0x46da5c){var _0x1e01b8={'raw':!![],'where':{'id':_0x380c5c['params']['id']}},_0x1e1b5f={};_0x1e1b5f[_0xc697('0x3d')]=_[_0xc697('0x3a')](db['ChatGroup'][_0xc697('0x38')]);_0x1e1b5f[_0xc697('0x39')]=_[_0xc697('0x3a')](_0x380c5c[_0xc697('0x39')]);_0x1e1b5f[_0xc697('0x3b')]=_[_0xc697('0x3c')](_0x1e1b5f[_0xc697('0x3d')],_0x1e1b5f[_0xc697('0x39')]);_0x1e01b8[_0xc697('0x3e')]=_['intersection'](_0x1e1b5f[_0xc697('0x3d')],qs[_0xc697('0x3f')](_0x380c5c['query'][_0xc697('0x3f')]));_0x1e01b8[_0xc697('0x3e')]=_0x1e01b8[_0xc697('0x3e')]['length']?_0x1e01b8[_0xc697('0x3e')]:_0x1e1b5f[_0xc697('0x3d')];if(_0x380c5c[_0xc697('0x39')][_0xc697('0x4b')]){_0x1e01b8[_0xc697('0x4c')]=[{'all':!![]}];}_0x1e01b8=_[_0xc697('0x48')]({},_0x1e01b8,_0x380c5c[_0xc697('0x50')]);return db['ChatGroup'][_0xc697('0x51')](_0x1e01b8)[_0xc697('0x21')](handleEntityNotFound(_0x46da5c,null))['then'](respondWithResult(_0x46da5c,null))[_0xc697('0x2b')](handleError(_0x46da5c,null));};exports[_0xc697('0x52')]=function(_0x47b611,_0x4a03ff){return db[_0xc697('0x49')][_0xc697('0x52')](_0x47b611[_0xc697('0x53')],{})[_0xc697('0x21')](respondWithResult(_0x4a03ff,0xc9))['catch'](handleError(_0x4a03ff,null));};exports[_0xc697('0x35')]=function(_0x4f1442,_0x4f983a){if(_0x4f1442['body']['id']){delete _0x4f1442['body']['id'];}return db[_0xc697('0x49')][_0xc697('0x51')]({'where':{'id':_0x4f1442[_0xc697('0x54')]['id']}})[_0xc697('0x21')](handleEntityNotFound(_0x4f983a,null))['then'](saveUpdates(_0x4f1442[_0xc697('0x53')],null))['then'](respondWithResult(_0x4f983a,null))[_0xc697('0x2b')](handleError(_0x4f983a,null));};exports[_0xc697('0x55')]=function(_0x32fbb7,_0x16de8e){return db[_0xc697('0x49')]['find']({'where':{'id':_0x32fbb7[_0xc697('0x54')]['id']}})[_0xc697('0x21')](handleEntityNotFound(_0x16de8e,null))[_0xc697('0x21')](removeEntity(_0x16de8e,null))['catch'](handleError(_0x16de8e,null));};exports[_0xc697('0x56')]=function(_0x1175b6,_0x31d2a5){return db[_0xc697('0x49')][_0xc697('0x56')]()['then'](respondWithResult(_0x31d2a5,null))[_0xc697('0x2b')](handleError(_0x31d2a5,null));};exports[_0xc697('0x57')]=function(_0x41f540,_0x3a2c59,_0x1ba863){return db[_0xc697('0x58')][_0xc697('0x4a')]({'where':{'ChatGroupId':_0x41f540[_0xc697('0x54')]['id'],'ToId':_0x41f540[_0xc697('0x59')]['id'],'read':![]}})[_0xc697('0x21')](function(_0x53fa27){return{'id':_[_0xc697('0x5a')](_0x41f540[_0xc697('0x54')]['id']),'count':_0x53fa27};})['then'](respondWithResult(_0x3a2c59,null))['catch'](handleError(_0x3a2c59,null));};exports[_0xc697('0x5b')]=function(_0x426f8d,_0x5c2d7d,_0x23206f){return db[_0xc697('0x49')][_0xc697('0x51')]({'where':{'id':_0x426f8d['params']['id']}})['then'](handleEntityNotFound(_0x5c2d7d,null))['then'](function(_0x2cee78){if(_0x2cee78){return _0x2cee78[_0xc697('0x5b')](_0x426f8d[_0xc697('0x53')][_0xc697('0x5c')],_['omit'](_0x426f8d[_0xc697('0x53')],[_0xc697('0x5c'),'id'])||{});}})[_0xc697('0x21')](respondWithResult(_0x5c2d7d,null))[_0xc697('0x2b')](handleError(_0x5c2d7d,null));};exports['getMembers']=function(_0x31ef58,_0x125f5c,_0x58d1c4){var _0x10c099={};var _0x2b28df={};var _0x2cf44f;var _0xda221;return db[_0xc697('0x49')][_0xc697('0x5d')]({'where':{'id':_0x31ef58[_0xc697('0x54')]['id']}})['then'](handleEntityNotFound(_0x125f5c,null))[_0xc697('0x21')](function(_0x135df2){if(_0x135df2){_0x2cf44f=_0x135df2;_0x2b28df['model']=_['keys'](db[_0xc697('0x5e')]['rawAttributes']);_0x2b28df['query']=_[_0xc697('0x3a')](_0x31ef58[_0xc697('0x39')]);_0x2b28df['filters']=_[_0xc697('0x3c')](_0x2b28df[_0xc697('0x3d')],_0x2b28df[_0xc697('0x39')]);_0x10c099[_0xc697('0x3e')]=_['intersection'](_0x2b28df[_0xc697('0x3d')],qs[_0xc697('0x3f')](_0x31ef58[_0xc697('0x39')][_0xc697('0x3f')]));_0x10c099[_0xc697('0x3e')]=_0x10c099[_0xc697('0x3e')]['length']?_0x10c099[_0xc697('0x3e')]:_0x2b28df['model'];_0x10c099['order']=qs[_0xc697('0x44')](_0x31ef58['query']['sort']);_0x10c099['where']=qs[_0xc697('0x3b')](_[_0xc697('0x5f')](_0x31ef58[_0xc697('0x39')],_0x2b28df[_0xc697('0x3b')]));if(_0x31ef58[_0xc697('0x39')][_0xc697('0x60')]){_0x10c099[_0xc697('0x45')]=_[_0xc697('0x48')](_0x10c099[_0xc697('0x45')],{'$or':_['map'](_0x10c099['attributes'],function(_0x25a092){var _0x494831={};_0x494831[_0x25a092]={'$like':'%'+_0x31ef58[_0xc697('0x39')][_0xc697('0x60')]+'%'};return _0x494831;})});}_0x10c099=_[_0xc697('0x48')]({},_0x10c099,_0x31ef58[_0xc697('0x50')]);return _0x2cf44f[_0xc697('0x61')](_0x10c099);}})[_0xc697('0x21')](function(_0xede0d){if(_0xede0d){_0xda221=_0xede0d[_0xc697('0x40')];if(!_0x31ef58[_0xc697('0x39')][_0xc697('0x41')]('nolimit')){_0x10c099['limit']=qs[_0xc697('0x30')](_0x31ef58[_0xc697('0x39')][_0xc697('0x30')]);_0x10c099['offset']=qs[_0xc697('0x2f')](_0x31ef58[_0xc697('0x39')][_0xc697('0x2f')]);}return _0x2cf44f['getMembers'](_0x10c099);}})[_0xc697('0x21')](function(_0x499cb2){if(_0x499cb2){return _0x499cb2?{'count':_0xda221,'rows':_0x499cb2}:null;}})['then'](respondWithResult(_0x125f5c,null))[_0xc697('0x2b')](handleError(_0x125f5c,null));};exports['removeMembers']=function(_0x2dd3bf,_0x2cc217,_0x168729){return db['ChatGroup'][_0xc697('0x51')]({'where':{'id':_0x2dd3bf[_0xc697('0x54')]['id']}})[_0xc697('0x21')](handleEntityNotFound(_0x2cc217,null))[_0xc697('0x21')](function(_0x72b90c){if(_0x72b90c){return _0x72b90c[_0xc697('0x62')](_0x2dd3bf[_0xc697('0x39')][_0xc697('0x5c')]);}})[_0xc697('0x21')](respondWithStatusCode(_0x2cc217,null))['catch'](handleError(_0x2cc217,null));};exports[_0xc697('0x63')]=function(_0x2a407e,_0x13bf70,_0x4ff0ef){if(_0x2a407e[_0xc697('0x53')]['id']){delete _0x2a407e[_0xc697('0x53')]['id'];}return db[_0xc697('0x49')][_0xc697('0x51')]({'where':{'id':_0x2a407e[_0xc697('0x54')]['id']}})['then'](handleEntityNotFound(_0x13bf70,null))['then'](function(_0x3e7c73){if(_0x3e7c73){_0x2a407e['body'][_0xc697('0x64')]=_0x3e7c73['id'];return db['ChatInternalMessage']['create'](_0x2a407e[_0xc697('0x53')]);}})[_0xc697('0x21')](respondWithResult(_0x13bf70,null))[_0xc697('0x2b')](handleError(_0x13bf70,null));};exports['getMessages']=function(_0x28a9d5,_0x56c83e,_0x1d2b4c){var _0x224149={};var _0x1312d7={};var _0x1c51cc;var _0x11ad16;return db[_0xc697('0x49')][_0xc697('0x5d')]({'where':{'id':_0x28a9d5[_0xc697('0x54')]['id']}})[_0xc697('0x21')](handleEntityNotFound(_0x56c83e,null))[_0xc697('0x21')](function(_0xddb468){if(_0xddb468){_0x1c51cc=_0xddb468;_0x1312d7[_0xc697('0x3d')]=_[_0xc697('0x3a')](db['ChatInternalMessage'][_0xc697('0x38')]);_0x1312d7[_0xc697('0x39')]=_[_0xc697('0x3a')](_0x28a9d5[_0xc697('0x39')]);_0x1312d7['filters']=_[_0xc697('0x3c')](_0x1312d7['model'],_0x1312d7['query']);_0x224149[_0xc697('0x3e')]=_['intersection'](_0x1312d7[_0xc697('0x3d')],qs[_0xc697('0x3f')](_0x28a9d5[_0xc697('0x39')][_0xc697('0x3f')]));_0x224149[_0xc697('0x3e')]=_0x224149[_0xc697('0x3e')][_0xc697('0x40')]?_0x224149[_0xc697('0x3e')]:_0x1312d7['model'];_0x224149[_0xc697('0x43')]=qs[_0xc697('0x44')](_0x28a9d5[_0xc697('0x39')][_0xc697('0x44')]);_0x224149['where']=qs[_0xc697('0x3b')](_[_0xc697('0x5f')](_0x28a9d5[_0xc697('0x39')],_0x1312d7[_0xc697('0x3b')]));if(_0x28a9d5['query'][_0xc697('0x60')]){_0x224149[_0xc697('0x45')]=_[_0xc697('0x48')](_0x224149[_0xc697('0x45')],{'$or':_[_0xc697('0x37')](_0x224149[_0xc697('0x3e')],function(_0x116e4d){var _0x4b18bc={};_0x4b18bc[_0x116e4d]={'$like':'%'+_0x28a9d5[_0xc697('0x39')][_0xc697('0x60')]+'%'};return _0x4b18bc;})});}if(_0x28a9d5[_0xc697('0x39')][_0xc697('0x65')]){var _0xdb92e5=_0x28a9d5[_0xc697('0x39')][_0xc697('0x65')][_0xc697('0x66')](',');var _0x56dda8={};_0x56dda8[_0xdb92e5[0x0]]={'$gte':moment(_0xdb92e5[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x224149['where']=_[_0xc697('0x48')](_0x224149['where'],_0x56dda8);}_0x224149=_['merge']({},_0x224149,_0x28a9d5[_0xc697('0x50')]);return _0x1c51cc[_0xc697('0x67')](_0x224149);}})[_0xc697('0x21')](function(_0x409a9b){if(_0x409a9b){_0x11ad16=_0x409a9b['length'];if(!_0x28a9d5[_0xc697('0x39')][_0xc697('0x41')](_0xc697('0x42'))){_0x224149[_0xc697('0x30')]=qs[_0xc697('0x30')](_0x28a9d5[_0xc697('0x39')][_0xc697('0x30')]);_0x224149[_0xc697('0x2f')]=qs[_0xc697('0x2f')](_0x28a9d5[_0xc697('0x39')]['offset']);}return _0x1c51cc[_0xc697('0x67')](_0x224149);}})[_0xc697('0x21')](function(_0x48d562){if(_0x48d562){return _0x48d562?{'count':_0x11ad16,'rows':_0x48d562}:null;}})[_0xc697('0x21')](respondWithResult(_0x56c83e,null))['catch'](handleError(_0x56c83e,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 66e7ef7..e6a7c26 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 _0xadb5=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0xadb5,0xad));var _0x5adb=function(_0x24f8f7,_0x243a1a){_0x24f8f7=_0x24f8f7-0x0;var _0x5b3183=_0xadb5[_0x24f8f7];return _0x5b3183;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x5adb('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0x5adb('0x1')](0x0);var events={'afterCreate':_0x5adb('0x2'),'afterUpdate':_0x5adb('0x3'),'afterDestroy':'remove'};function emitEvent(_0x248dc6){return function(_0x31457,_0x2e3ef4,_0x4cb1d1){ChatGroupEvents[_0x5adb('0x4')](_0x248dc6+':'+_0x31457['id'],_0x31457);ChatGroupEvents[_0x5adb('0x4')](_0x248dc6,_0x31457);_0x4cb1d1(null);};}for(var e in events){if(events[_0x5adb('0x5')](e)){var event=events[e];ChatGroup[_0x5adb('0x6')](e,emitEvent(event));}}module[_0x5adb('0x7')]=ChatGroupEvents; \ No newline at end of file +var _0xdb28=['ChatGroup','setMaxListeners','update','remove','emit','exports','events','../../mysqldb'];(function(_0x3dbb5d,_0x4d5392){var _0x905117=function(_0x3387f7){while(--_0x3387f7){_0x3dbb5d['push'](_0x3dbb5d['shift']());}};_0x905117(++_0x4d5392);}(_0xdb28,0x106));var _0x8db2=function(_0xdf672b,_0x2de946){_0xdf672b=_0xdf672b-0x0;var _0x535246=_0xdb28[_0xdf672b];return _0x535246;};'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 6aa3cd0..1250760 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 _0x0d4e=['exports','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes'];(function(_0x3b5ad9,_0x223867){var _0x611ae9=function(_0x1c5e28){while(--_0x1c5e28){_0x3b5ad9['push'](_0x3b5ad9['shift']());}};_0x611ae9(++_0x223867);}(_0x0d4e,0x1ca));var _0xe0d4=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0d4e[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xe0d4('0x0'));var util=require(_0xe0d4('0x1'));var logger=require(_0xe0d4('0x2'))(_0xe0d4('0x3'));var moment=require(_0xe0d4('0x4'));var BPromise=require(_0xe0d4('0x5'));var rp=require(_0xe0d4('0x6'));var fs=require('fs');var path=require(_0xe0d4('0x7'));var rimraf=require(_0xe0d4('0x8'));var config=require('../../config/environment');var attributes=require(_0xe0d4('0x9'));module[_0xe0d4('0xa')]=function(_0x2cc782,_0x25bdbe){return _0x2cc782['define']('ChatGroup',attributes,{'tableName':_0xe0d4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0c3=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes','define','ChatGroup','chat_groups'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe0c3,0xea));var _0x3e0c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe0c3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e0c('0x0'));var util=require('util');var logger=require(_0x3e0c('0x1'))(_0x3e0c('0x2'));var moment=require(_0x3e0c('0x3'));var BPromise=require(_0x3e0c('0x4'));var rp=require(_0x3e0c('0x5'));var fs=require('fs');var path=require(_0x3e0c('0x6'));var rimraf=require(_0x3e0c('0x7'));var config=require(_0x3e0c('0x8'));var attributes=require(_0x3e0c('0x9'));module['exports']=function(_0x530ebf,_0x163adf){return _0x530ebf[_0x3e0c('0xa')](_0x3e0c('0xb'),attributes,{'tableName':_0x3e0c('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 ee8ac93..0fb9676 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 _0xf9db=['socket.io-emitter','register','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost'];(function(_0xb810ca,_0x5cccfa){var _0x509874=function(_0x373280){while(--_0x373280){_0xb810ca['push'](_0xb810ca['shift']());}};_0x509874(++_0x5cccfa);}(_0xf9db,0xd0));var _0xbf9d=function(_0xbf8095,_0x2b3908){_0xbf8095=_0xbf8095-0x0;var _0x556f85=_0xf9db[_0xbf8095];return _0x556f85;};'use strict';var _=require('lodash');var util=require(_0xbf9d('0x0'));var moment=require(_0xbf9d('0x1'));var BPromise=require(_0xbf9d('0x2'));var rs=require(_0xbf9d('0x3'));var fs=require('fs');var Redis=require(_0xbf9d('0x4'));var db=require(_0xbf9d('0x5'))['db'];var utils=require(_0xbf9d('0x6'));var logger=require(_0xbf9d('0x7'))(_0xbf9d('0x8'));var config=require(_0xbf9d('0x9'));var jayson=require(_0xbf9d('0xa'));var client=jayson[_0xbf9d('0xb')][_0xbf9d('0xc')]({'port':0x232a});config[_0xbf9d('0xd')]=_[_0xbf9d('0xe')](config[_0xbf9d('0xd')],{'host':_0xbf9d('0xf'),'port':0x18eb});var socket=require(_0xbf9d('0x10'))(new Redis(config[_0xbf9d('0xd')]));require('./chatGroup.socket')[_0xbf9d('0x11')](socket);function respondWithRpcPromise(_0x18607e,_0x196dc3,_0x1b2a78){return new BPromise(function(_0x23a85e,_0x45c776){return client['request'](_0x18607e,_0x1b2a78)[_0xbf9d('0x12')](function(_0x28ebc7){logger[_0xbf9d('0x13')](_0xbf9d('0x14'),_0x196dc3,_0xbf9d('0x15'));logger[_0xbf9d('0x16')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x196dc3,'request\x20sent',JSON['stringify'](_0x28ebc7));if(_0x28ebc7[_0xbf9d('0x17')]){if(_0x28ebc7['error'][_0xbf9d('0x18')]===0x1f4){logger[_0xbf9d('0x17')](_0xbf9d('0x14'),_0x196dc3,_0x28ebc7[_0xbf9d('0x17')][_0xbf9d('0x19')]);return _0x45c776(_0x28ebc7['error'][_0xbf9d('0x19')]);}logger['error'](_0xbf9d('0x14'),_0x196dc3,_0x28ebc7[_0xbf9d('0x17')]['message']);return _0x23a85e(_0x28ebc7[_0xbf9d('0x17')][_0xbf9d('0x19')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x196dc3,_0xbf9d('0x15'));_0x23a85e(_0x28ebc7[_0xbf9d('0x1a')][_0xbf9d('0x19')]);}})[_0xbf9d('0x1b')](function(_0x3c7bad){logger[_0xbf9d('0x17')](_0xbf9d('0x14'),_0x196dc3,_0x3c7bad);_0x45c776(_0x3c7bad);});});} \ No newline at end of file +var _0x43de=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','client','http','redis','defaults','localhost','register','request','then','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x307bec,_0x248900){var _0x25c2ec=function(_0x46c0d6){while(--_0x46c0d6){_0x307bec['push'](_0x307bec['shift']());}};_0x25c2ec(++_0x248900);}(_0x43de,0x189));var _0xe43d=function(_0xb90c93,_0x1c85c4){_0xb90c93=_0xb90c93-0x0;var _0x267c48=_0x43de[_0xb90c93];return _0x267c48;};'use strict';var _=require(_0xe43d('0x0'));var util=require(_0xe43d('0x1'));var moment=require(_0xe43d('0x2'));var BPromise=require(_0xe43d('0x3'));var rs=require(_0xe43d('0x4'));var fs=require('fs');var Redis=require(_0xe43d('0x5'));var db=require(_0xe43d('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xe43d('0x7'))(_0xe43d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe43d('0x9')][_0xe43d('0xa')]({'port':0x232a});config[_0xe43d('0xb')]=_[_0xe43d('0xc')](config[_0xe43d('0xb')],{'host':_0xe43d('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe43d('0xb')]));require('./chatGroup.socket')[_0xe43d('0xe')](socket);function respondWithRpcPromise(_0x38e604,_0x44a270,_0x17dd46){return new BPromise(function(_0x62e765,_0x17afd4){return client[_0xe43d('0xf')](_0x38e604,_0x17dd46)[_0xe43d('0x10')](function(_0xef4755){logger[_0xe43d('0x11')](_0xe43d('0x12'),_0x44a270,_0xe43d('0x13'));logger[_0xe43d('0x14')](_0xe43d('0x15'),_0x44a270,_0xe43d('0x13'),JSON[_0xe43d('0x16')](_0xef4755));if(_0xef4755[_0xe43d('0x17')]){if(_0xef4755['error'][_0xe43d('0x18')]===0x1f4){logger[_0xe43d('0x17')](_0xe43d('0x12'),_0x44a270,_0xef4755[_0xe43d('0x17')][_0xe43d('0x19')]);return _0x17afd4(_0xef4755[_0xe43d('0x17')][_0xe43d('0x19')]);}logger['error'](_0xe43d('0x12'),_0x44a270,_0xef4755[_0xe43d('0x17')]['message']);return _0x62e765(_0xef4755['error']['message']);}else{logger[_0xe43d('0x11')](_0xe43d('0x12'),_0x44a270,_0xe43d('0x13'));_0x62e765(_0xef4755[_0xe43d('0x1a')]['message']);}})[_0xe43d('0x1b')](function(_0xbafe09){logger['error'](_0xe43d('0x12'),_0x44a270,_0xbafe09);_0x17afd4(_0xbafe09);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index e9add1e..3573638 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 _0xb77e=['removeListener','length','chatGroup:','./chatGroup.events','save','remove','emit'];(function(_0x400b43,_0x55da4e){var _0x3c330f=function(_0x5bbd52){while(--_0x5bbd52){_0x400b43['push'](_0x400b43['shift']());}};_0x3c330f(++_0x55da4e);}(_0xb77e,0x1df));var _0xeb77=function(_0x6cf19c,_0x2f3f02){_0x6cf19c=_0x6cf19c-0x0;var _0xce14f3=_0xb77e[_0x6cf19c];return _0xce14f3;};'use strict';var ChatGroupEvents=require(_0xeb77('0x0'));var events=[_0xeb77('0x1'),_0xeb77('0x2'),'update'];function createListener(_0x6f2eb5,_0x46496a){return function(_0x2457eb){_0x46496a[_0xeb77('0x3')](_0x6f2eb5,_0x2457eb);};}function removeListener(_0x4738a2,_0x451432){return function(){ChatGroupEvents[_0xeb77('0x4')](_0x4738a2,_0x451432);};}exports['register']=function(_0x3c0f09){for(var _0x31c808=0x0,_0x4b89ac=events[_0xeb77('0x5')];_0x31c808<_0x4b89ac;_0x31c808++){var _0x149871=events[_0x31c808];var _0x38da2c=createListener(_0xeb77('0x6')+_0x149871,_0x3c0f09);ChatGroupEvents['on'](_0x149871,_0x38da2c);}}; \ No newline at end of file +var _0xec30=['register','chatGroup:','save','update','emit','removeListener'];(function(_0x4914e2,_0x48be8f){var _0x2dcd07=function(_0x1a2565){while(--_0x1a2565){_0x4914e2['push'](_0x4914e2['shift']());}};_0x2dcd07(++_0x48be8f);}(_0xec30,0x68));var _0x0ec3=function(_0x55d946,_0x644bc4){_0x55d946=_0x55d946-0x0;var _0xc53385=_0xec30[_0x55d946];return _0xc53385;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x0ec3('0x0'),'remove',_0x0ec3('0x1')];function createListener(_0x24c175,_0x3cd4c7){return function(_0x544c58){_0x3cd4c7[_0x0ec3('0x2')](_0x24c175,_0x544c58);};}function removeListener(_0x1b2797,_0xe54cd0){return function(){ChatGroupEvents[_0x0ec3('0x3')](_0x1b2797,_0xe54cd0);};}exports[_0x0ec3('0x4')]=function(_0x580c8c){for(var _0x2f812e=0x0,_0x59f372=events['length'];_0x2f812e<_0x59f372;_0x2f812e++){var _0xbbf538=events[_0x2f812e];var _0x6d36e=createListener(_0x0ec3('0x5')+_0xbbf538,_0x580c8c);ChatGroupEvents['on'](_0xbbf538,_0x6d36e);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 3c01b81..630ae94 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 _0x6044=['destroy','removeMembers','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','/:id','show','/:id/unread','getUnread','getMembers','post','create','/:id/members','/:id/messages','addMessage','update','delete'];(function(_0x53823a,_0x9dfbd3){var _0x51012a=function(_0x1ed0c7){while(--_0x1ed0c7){_0x53823a['push'](_0x53823a['shift']());}};_0x51012a(++_0x9dfbd3);}(_0x6044,0x1c5));var _0x4604=function(_0x8e36d0,_0x4627c0){_0x8e36d0=_0x8e36d0-0x0;var _0x1ad22c=_0x6044[_0x8e36d0];return _0x1ad22c;};'use strict';var multer=require('multer');var util=require(_0x4604('0x0'));var path=require('path');var timeout=require(_0x4604('0x1'));var express=require(_0x4604('0x2'));var router=express[_0x4604('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4604('0x4'));var config=require(_0x4604('0x5'));var controller=require(_0x4604('0x6'));router[_0x4604('0x7')]('/',auth[_0x4604('0x8')](),controller[_0x4604('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x4604('0x7')](_0x4604('0xa'),auth[_0x4604('0x8')](),controller[_0x4604('0xb')]);router[_0x4604('0x7')](_0x4604('0xc'),auth[_0x4604('0x8')](),controller[_0x4604('0xd')]);router[_0x4604('0x7')]('/:id/members',auth[_0x4604('0x8')](),controller[_0x4604('0xe')]);router[_0x4604('0x7')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router[_0x4604('0xf')]('/',auth[_0x4604('0x8')](),controller[_0x4604('0x10')]);router[_0x4604('0xf')](_0x4604('0x11'),auth[_0x4604('0x8')](),controller['addMembers']);router[_0x4604('0xf')](_0x4604('0x12'),auth['isAuthenticated'](),controller[_0x4604('0x13')]);router['put']('/:id',auth[_0x4604('0x8')](),controller[_0x4604('0x14')]);router[_0x4604('0x15')](_0x4604('0xa'),auth[_0x4604('0x8')](),controller[_0x4604('0x16')]);router[_0x4604('0x15')](_0x4604('0x11'),auth[_0x4604('0x8')](),controller[_0x4604('0x17')]);module[_0x4604('0x18')]=router; \ No newline at end of file +var _0x2816=['/describe','/:id','show','/:id/unread','getUnread','/:id/members','getMembers','getMessages','post','addMembers','/:id/messages','put','update','delete','exports','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated'];(function(_0x44213c,_0x1e17d7){var _0x4c04bb=function(_0x3df8e4){while(--_0x3df8e4){_0x44213c['push'](_0x44213c['shift']());}};_0x4c04bb(++_0x1e17d7);}(_0x2816,0x8c));var _0x6281=function(_0x1f63e2,_0x1bf2f5){_0x1f63e2=_0x1f63e2-0x0;var _0x48fa55=_0x2816[_0x1f63e2];return _0x48fa55;};'use strict';var multer=require(_0x6281('0x0'));var util=require(_0x6281('0x1'));var path=require('path');var timeout=require(_0x6281('0x2'));var express=require(_0x6281('0x3'));var router=express['Router']();var auth=require(_0x6281('0x4'));var interaction=require(_0x6281('0x5'));var config=require(_0x6281('0x6'));var controller=require(_0x6281('0x7'));router[_0x6281('0x8')]('/',auth[_0x6281('0x9')](),controller['index']);router[_0x6281('0x8')](_0x6281('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x6281('0x8')](_0x6281('0xb'),auth[_0x6281('0x9')](),controller[_0x6281('0xc')]);router[_0x6281('0x8')](_0x6281('0xd'),auth[_0x6281('0x9')](),controller[_0x6281('0xe')]);router['get'](_0x6281('0xf'),auth['isAuthenticated'](),controller[_0x6281('0x10')]);router['get']('/:id/messages',auth[_0x6281('0x9')](),controller[_0x6281('0x11')]);router[_0x6281('0x12')]('/',auth[_0x6281('0x9')](),controller['create']);router[_0x6281('0x12')](_0x6281('0xf'),auth[_0x6281('0x9')](),controller[_0x6281('0x13')]);router[_0x6281('0x12')](_0x6281('0x14'),auth[_0x6281('0x9')](),controller['addMessage']);router[_0x6281('0x15')](_0x6281('0xb'),auth[_0x6281('0x9')](),controller[_0x6281('0x16')]);router[_0x6281('0x17')](_0x6281('0xb'),auth[_0x6281('0x9')](),controller['destroy']);router[_0x6281('0x17')](_0x6281('0xf'),auth[_0x6281('0x9')](),controller['removeMembers']);module[_0x6281('0x18')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index a673adb..3c6fdc8 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 _0xcad6=['sequelize','exports','ENUM','star','thumb','TEXT','STRING','long','DATE','out'];(function(_0x50cfdf,_0xbfc861){var _0x449896=function(_0x106946){while(--_0x106946){_0x50cfdf['push'](_0x50cfdf['shift']());}};_0x449896(++_0xbfc861);}(_0xcad6,0x1b8));var _0x6cad=function(_0x3183c3,_0x424eb7){_0x3183c3=_0x3183c3-0x0;var _0x81552f=_0xcad6[_0x3183c3];return _0x81552f;};'use strict';var Sequelize=require(_0x6cad('0x0'));module[_0x6cad('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6cad('0x2')](_0x6cad('0x3'),_0x6cad('0x4')),'defaultValue':_0x6cad('0x3')},'ratingMessage':{'type':Sequelize[_0x6cad('0x5')]},'pathTranscript':{'type':Sequelize[_0x6cad('0x5')]},'mailTranscript':{'type':Sequelize[_0x6cad('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x6cad('0x6')]},'note':{'type':Sequelize[_0x6cad('0x6')]},'browserName':{'type':Sequelize[_0x6cad('0x6')]},'browserVersion':{'type':Sequelize[_0x6cad('0x6')]},'osName':{'type':Sequelize[_0x6cad('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x6cad('0x6')]},'deviceVendor':{'type':Sequelize[_0x6cad('0x6')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x6cad('0x5')]},'customerIp':{'type':Sequelize[_0x6cad('0x6')]},'formData':{'type':Sequelize['TEXT'](_0x6cad('0x7'))},'read1stAt':{'type':Sequelize[_0x6cad('0x8')]},'lastMsgAt':{'type':Sequelize[_0x6cad('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x6cad('0x2')]('in',_0x6cad('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x6cad('0x6')]},'customerPort':{'type':Sequelize[_0x6cad('0x6')]}}; \ No newline at end of file +var _0xa79e=['star','thumb','TEXT','STRING','DATE','long','BOOLEAN','INTEGER','ENUM'];(function(_0x114319,_0x35893e){var _0x124d04=function(_0x4e147a){while(--_0x4e147a){_0x114319['push'](_0x114319['shift']());}};_0x124d04(++_0x35893e);}(_0xa79e,0x177));var _0xea79=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0xa79e[_0x2b10c6];return _0x3789d2;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0xea79('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0xea79('0x1')]},'ratingType':{'type':Sequelize[_0xea79('0x2')](_0xea79('0x3'),_0xea79('0x4')),'defaultValue':_0xea79('0x3')},'ratingMessage':{'type':Sequelize[_0xea79('0x5')]},'pathTranscript':{'type':Sequelize[_0xea79('0x5')]},'mailTranscript':{'type':Sequelize[_0xea79('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0xea79('0x7')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xea79('0x6')]},'browserName':{'type':Sequelize['STRING']},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0xea79('0x6')]},'osVersion':{'type':Sequelize[_0xea79('0x6')]},'deviceModel':{'type':Sequelize[_0xea79('0x6')]},'deviceVendor':{'type':Sequelize[_0xea79('0x6')]},'deviceType':{'type':Sequelize[_0xea79('0x6')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0xea79('0x6')]},'formData':{'type':Sequelize[_0xea79('0x5')](_0xea79('0x8'))},'read1stAt':{'type':Sequelize[_0xea79('0x7')]},'lastMsgAt':{'type':Sequelize[_0xea79('0x7')]},'lastMsgDirection':{'type':Sequelize[_0xea79('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0xea79('0x6')]},'customerPort':{'type':Sequelize[_0xea79('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index f13bece..961a0a4 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 _0x7da7=['defaults','socket.io-emitter','register','jayson/promise','client','http','test','request','then','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','stack','name','send','Users','map','TagIds','Tags','forEach','index','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','select','field','color','from','tools_tags','u.id','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','chat_websites','a.id\x20=\x20i.ChatWebsiteId','chat_messages','chat_interaction_has_tags','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','text','start','end','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','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','where','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','tag','isArray','filter','replace','isNumeric','getFullTextValue','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','push','all','params','include','ChatInteraction','create','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Sequelize','ValidationError','Interaction\x20already\x20assigned','closed','attachmentUpload','file','basename','filename','mimetype','Attachment','attachmentDownload','findOne','Unauthorized','download','join','root','server/files/attachments/','close','format','transcript-%s.txt','now','ChatMessage','ChatWebsiteId','CmContact','Messages','%s%d','agentAlias','customer','Visitor','agentIdentifier','website_alias','System','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','SendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','includeAll','findAll','rows','nolimit','alias','setTags','spread','emit','chatInteractionTags:save','removeTags','server','files','attachments','transcript-%d-%s.zip','firstName','lastName','ChatWebsite','Owner','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','N.A.','YYYY-MM-DD\x20HH:mm:ss','disposition','browserName','osName','customerIp','customerPort','createReadStream','pipe','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','log','err','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','api','../../config/utils','../../mysqldb','redis'];(function(_0x1601ce,_0x19e283){var _0x31e294=function(_0x5b4bba){while(--_0x5b4bba){_0x1601ce['push'](_0x1601ce['shift']());}};_0x31e294(++_0x19e283);}(_0x7da7,0x10d));var _0x77da=function(_0x954b3a,_0x10a7c1){_0x954b3a=_0x954b3a-0x0;var _0x3a313e=_0x7da7[_0x954b3a];return _0x3a313e;};'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'];config[_0x77da('0x16')]=_[_0x77da('0x17')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x77da('0x18'))(new Redis(config[_0x77da('0x16')]));require('./chatInteraction.socket')[_0x77da('0x19')](socket);var jayson=require(_0x77da('0x1a'));var client=jayson[_0x77da('0x1b')][_0x77da('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x77da('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x4e130c,_0x29cd7b,_0x366443){if(_0x366443){var _0x1b0e17=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b0e17[_0x77da('0x1d')](_0x29cd7b)){return _0x4e130c;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x4e130c;}}function respondWithRpcPromise(_0x482b87,_0x103e46,_0x295bef,_0x289887){return new BPromise(function(_0x335dcb,_0x19a00c){var _0x12d2b1=_0x289887||client;return _0x12d2b1[_0x77da('0x1e')](_0x482b87,_0x295bef)[_0x77da('0x1f')](function(_0x544104){logger['info'](_0x77da('0x20'),_0x103e46,_0x77da('0x21'));logger['debug'](_0x77da('0x22'),_0x103e46,_0x77da('0x21'),JSON[_0x77da('0x23')](_0x544104));if(_0x544104['error']){if(_0x544104['error'][_0x77da('0x24')]===0x1f4){logger['error'](_0x77da('0x20'),_0x103e46,_0x544104[_0x77da('0x25')][_0x77da('0x26')]);return _0x19a00c(_0x544104[_0x77da('0x25')][_0x77da('0x26')]);}logger[_0x77da('0x25')](_0x77da('0x20'),_0x103e46,_0x544104['error']['message']);return _0x335dcb(_0x544104[_0x77da('0x25')][_0x77da('0x26')]);}else{logger[_0x77da('0x27')](_0x77da('0x20'),_0x103e46,'request\x20sent');_0x335dcb(_0x544104[_0x77da('0x28')][_0x77da('0x26')]);}})[_0x77da('0x29')](function(_0x36115b){logger[_0x77da('0x25')]('ChatInteraction,\x20%s,\x20%s',_0x103e46,_0x36115b);_0x19a00c(_0x36115b);});});}function respondWithStatusCode(_0xce24b8,_0x3e090d){_0x3e090d=_0x3e090d||0xcc;return function(_0x1f2279){if(_0x1f2279){return _0xce24b8[_0x77da('0x2a')](_0x3e090d);}return _0xce24b8['status'](_0x3e090d)['end']();};}function respondWithResult(_0x4d395a,_0x2258e9){_0x2258e9=_0x2258e9||0xc8;return function(_0x30456a){if(_0x30456a){return _0x4d395a[_0x77da('0x2b')](_0x2258e9)[_0x77da('0x2c')](_0x30456a);}};}function respondWithFilteredResult(_0x34228f,_0x4eeb99){return function(_0x350b4e){if(_0x350b4e){var _0x26f5a0=_0x350b4e[_0x77da('0x2d')],_0x356bfb=_0x4eeb99['offset'],_0x1d381b=_0x4eeb99[_0x77da('0x2e')]+_0x4eeb99[_0x77da('0x2f')],_0x1e7853;if(_0x1d381b>=_0x26f5a0){_0x1d381b=_0x26f5a0;_0x1e7853=0xc8;}else{_0x1e7853=0xce;}_0x34228f[_0x77da('0x2b')](_0x1e7853);return _0x34228f[_0x77da('0x30')](_0x77da('0x31'),_0x356bfb+'-'+_0x1d381b+'/'+_0x26f5a0)[_0x77da('0x2c')](_0x350b4e);}return null;};}function patchUpdates(_0x3343b4){return function(_0x2c790d){try{jsonpatch['apply'](_0x2c790d,_0x3343b4,!![]);}catch(_0x5e8d1e){return BPromise[_0x77da('0x32')](_0x5e8d1e);}return _0x2c790d[_0x77da('0x33')]();};}function saveUpdates(_0x49cd8f,_0x473c7f){return function(_0x390399){if(_0x390399){return _0x390399[_0x77da('0x34')](_0x49cd8f)[_0x77da('0x1f')](function(_0x4232ac){return _0x4232ac;});}return null;};}function removeEntity(_0x161d8c,_0x20d1cc){return function(_0x5c4a03){if(_0x5c4a03){return _0x5c4a03[_0x77da('0x35')]()['then'](function(){_0x161d8c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x17d236,_0x53543a){return function(_0x19bfd3){if(!_0x19bfd3){_0x17d236[_0x77da('0x2a')](0x194);}return _0x19bfd3;};}function handleError(_0xce9df2,_0x3cc78b){_0x3cc78b=_0x3cc78b||0x1f4;return function(_0x3c46d2){logger[_0x77da('0x25')](_0x3c46d2[_0x77da('0x36')]);if(_0x3c46d2['name']){delete _0x3c46d2[_0x77da('0x37')];}_0xce9df2[_0x77da('0x2b')](_0x3cc78b)[_0x77da('0x38')](_0x3c46d2);};}function getInteractionUsers(_0x32785f,_0x166534){return new BPromise(function(_0x188284,_0x48fccc){try{if(_0x166534[_0x32785f['id']]){_0x32785f[_0x77da('0x39')]=_[_0x77da('0x3a')](_0x166534[_0x32785f['id']],function(_0x2cd190){return{'id':_0x2cd190['id'],'fullname':_0x2cd190['fullname']};});}}catch(_0xc5f0b8){_0x48fccc(_0xc5f0b8);}_0x188284(_0x32785f);});}function getInteractionTags(_0x505ffb,_0x4e1e31){return new BPromise(function(_0x599e21,_0x59abca){try{if(_0x505ffb[_0x77da('0x3b')]){_0x505ffb[_0x77da('0x3c')]=[];_0x505ffb[_0x77da('0x3b')]['split'](',')[_0x77da('0x3d')](function(_0x5b7e63){_0x505ffb[_0x77da('0x3c')]['push'](_0x4e1e31[_0x5b7e63]);});}delete _0x505ffb[_0x77da('0x3b')];}catch(_0xa19b50){_0x59abca(_0xa19b50);}_0x599e21(_0x505ffb);});}function updateChatInteraction(_0x290667,_0x1612b7,_0x240bee){return new BPromise(function(_0x5ecf12,_0x759b86){return getInteractionUsers(_0x290667,_0x240bee)[_0x77da('0x1f')](function(_0x44717a){return getInteractionTags(_0x44717a,_0x1612b7);})[_0x77da('0x1f')](function(_0x32a9c4){_0x5ecf12(_0x32a9c4);})[_0x77da('0x29')](function(_0x4ea24c){_0x759b86(_0x4ea24c);});});}exports[_0x77da('0x3e')]=function(_0x2f0495,_0x21de41){var _0x2dfeca={},_0x7d11f9={},_0x25f65f={'count':0x0,'rows':[]};var _0x52488d=_[_0x77da('0x3a')](db['ChatInteraction'][_0x77da('0x3f')],function(_0x373fb2){return{'name':_0x373fb2[_0x77da('0x40')],'type':_0x373fb2['type'][_0x77da('0x41')]};});_0x7d11f9[_0x77da('0x42')]=_[_0x77da('0x3a')](_0x52488d,_0x77da('0x37'));_0x7d11f9[_0x77da('0x43')]=_[_0x77da('0x44')](_0x2f0495[_0x77da('0x43')]);_0x7d11f9[_0x77da('0x45')]=_[_0x77da('0x46')](_0x7d11f9['model'],_0x7d11f9[_0x77da('0x43')]);_0x2dfeca[_0x77da('0x47')]=_[_0x77da('0x46')](_0x7d11f9[_0x77da('0x42')],qs[_0x77da('0x48')](_0x2f0495[_0x77da('0x43')]['fields']));_0x2dfeca['attributes']=_0x2dfeca[_0x77da('0x47')][_0x77da('0x49')]?_0x2dfeca[_0x77da('0x47')]:_0x7d11f9[_0x77da('0x42')];if(!_0x2f0495[_0x77da('0x43')][_0x77da('0x4a')]('nolimit')){_0x2dfeca[_0x77da('0x2f')]=qs[_0x77da('0x2f')](_0x2f0495[_0x77da('0x43')][_0x77da('0x2f')]);_0x2dfeca['offset']=qs[_0x77da('0x2e')](_0x2f0495['query']['offset']);}_0x2dfeca[_0x77da('0x4b')]=qs[_0x77da('0x4c')](_0x2f0495[_0x77da('0x43')][_0x77da('0x4c')]);_0x2dfeca['where']=qs[_0x77da('0x45')](_[_0x77da('0x4d')](_0x2f0495['query'],_0x7d11f9[_0x77da('0x45')]));var _0x3c2d89=[];var _0x5c264e=squel[_0x77da('0x4e')]()[_0x77da('0x4f')]('id')[_0x77da('0x4f')](_0x77da('0x37'))[_0x77da('0x4f')](_0x77da('0x50'))[_0x77da('0x51')](_0x77da('0x52'));var _0x128ce3=squel[_0x77da('0x4e')]()['field'](_0x77da('0x53'))['field'](_0x77da('0x54'))[_0x77da('0x4f')](_0x77da('0x55'))[_0x77da('0x51')](_0x77da('0x56'),'ui')[_0x77da('0x57')](_0x77da('0x58'),'u','u.id\x20=\x20ui.UserId');var _0x17ed71=squel[_0x77da('0x4e')]()[_0x77da('0x51')](_0x77da('0x59'),'i')['left_join'](_0x77da('0x5a'),'c',_0x77da('0x5b'))[_0x77da('0x57')]('users','o','o.id\x20=\x20i.UserId')[_0x77da('0x57')](_0x77da('0x5c'),'a',_0x77da('0x5d'))[_0x77da('0x57')](_0x77da('0x5e'),'me','me.ChatInteractionId\x20=\x20i.id')['left_join'](_0x77da('0x5f'),'it',_0x77da('0x60'))['left_join'](_0x77da('0x52'),'t',_0x77da('0x61'));var _0x1e0146=squel['expr']();var _0x1d665d=[];var _0x111260=squel['expr']();var _0x3ae855;if(_0x2f0495[_0x77da('0x43')][_0x77da('0x62')]){_0x3ae855=as[_0x77da('0x63')](_0x2f0495[_0x77da('0x43')][_0x77da('0x62')]);var _0x1dc4ab=_0x3ae855[_0x77da('0x64')];for(var _0x1ecb28=0x0;_0x1ecb28<_0x3ae855['conditions'][_0x77da('0x49')];_0x1ecb28++){var _0x11c240=_0x3ae855[_0x77da('0x65')][_0x1ecb28];var _0x2e92f4='i';var _0x329c6b=_[_0x77da('0x66')](_0x52488d,['name',_0x11c240[_0x77da('0x4f')]]);if(!_0x329c6b){switch(_0x11c240[_0x77da('0x4f')]){case _0x77da('0x67'):if(_0x11c240['value']==0x1){_0x17ed71[_0x77da('0x68')]('`'+_0x11c240[_0x77da('0x4f')]+_0x77da('0x69'));}else{_0x17ed71[_0x77da('0x68')]('`'+_0x11c240[_0x77da('0x4f')]+_0x77da('0x6a'));}break;case _0x77da('0x6b'):if(_0x11c240['operator']===_0x77da('0x6c')){if(_0x11c240['value'][_0x77da('0x6d')]('\x20')[_0x77da('0x49')]>0x1){_0x1e0146[_0x1dc4ab](_0x77da('0x6e'),qs['getFullTextValue'](_0x11c240[_0x77da('0x6f')]),null);}else{var _0x3c4453='%'+_0x11c240[_0x77da('0x6f')]+'%';_0x1e0146[_0x1dc4ab](_0x77da('0x70'),_0x3c4453,_0x3c4453,_0x3c4453);}}else{_0x329c6b=_['find'](_0x52488d,['name','ContactId']);_0x11c240[_0x77da('0x4f')]=_0x77da('0x71');_0x19b514=as[_0x77da('0x72')](_0x2e92f4,_0x329c6b[_0x77da('0x73')],_0x11c240);_0x1e0146[_0x1dc4ab](_0x19b514[_0x77da('0x74')],_0x19b514[_0x77da('0x6f')][_0x77da('0x75')],_0x19b514[_0x77da('0x6f')][_0x77da('0x76')]);}break;case _0x77da('0x77'):var _0x5afd7a=_0x11c240[_0x77da('0x6f')][_0x77da('0x6d')](',')['map'](function(_0x52ebdf){return Number(_0x52ebdf);});_0x5afd7a[_0x77da('0x3d')](function(_0x47ec1d){_0x111260['or'](_0x77da('0x78'),'%,'+_0x47ec1d+',%');});_0x1d665d=_[_0x77da('0x79')](_0x1d665d,_0x5afd7a);break;case _0x77da('0x7a'):if(_0x11c240['operator']===_0x77da('0x6c')){_0x1e0146[_0x1dc4ab](_0x77da('0x7b'),'%'+_0x11c240[_0x77da('0x6f')]+'%',null);}else{_0x329c6b=_[_0x77da('0x66')](_0x52488d,[_0x77da('0x37'),'UserId']);_0x11c240[_0x77da('0x4f')]=_0x77da('0x7c');_0x19b514=as['buildExpression'](_0x2e92f4,_0x329c6b[_0x77da('0x73')],_0x11c240);_0x1e0146[_0x1dc4ab](_0x19b514[_0x77da('0x74')],_0x19b514[_0x77da('0x6f')][_0x77da('0x75')],_0x19b514[_0x77da('0x6f')][_0x77da('0x76')]);}break;case _0x77da('0x7d'):_0x19b514=as['buildExpression']('me',null,_0x11c240);_0x1e0146[_0x1dc4ab](_0x19b514[_0x77da('0x74')],_0x19b514['value'][_0x77da('0x75')],_0x19b514[_0x77da('0x6f')][_0x77da('0x76')]);break;}}else{var _0x19b514=as[_0x77da('0x72')](_0x2e92f4,_0x329c6b[_0x77da('0x73')],_0x11c240);_0x1e0146[_0x1dc4ab](_0x19b514[_0x77da('0x74')],_0x19b514[_0x77da('0x6f')][_0x77da('0x75')],_0x19b514[_0x77da('0x6f')][_0x77da('0x76')]);}}}else{var _0x19065e=_(_0x2f0495['query'])[_0x77da('0x44')]()[_0x77da('0x3a')](function(_0xeb5121){return _[_0x77da('0x7e')](_0x52488d,['name',_0xeb5121])?_0xeb5121:undefined;})[_0x77da('0x7f')]()[_0x77da('0x6f')]();if(!_[_0x77da('0x80')](_0x19065e)){_0x19065e['forEach'](function(_0x132d14){if(_0x132d14==='ChatWebsiteId'){_0x17ed71['where'](_0x77da('0x81'),[][_0x77da('0x82')](_0x2f0495[_0x77da('0x43')][_0x132d14]));}else if(_0x132d14===_0x77da('0x83')){var _0x3cb69e=JSON[_0x77da('0x84')](_0x2f0495[_0x77da('0x43')][_0x132d14])[_0x77da('0x85')];var _0x470840=JSON['parse'](_0x2f0495[_0x77da('0x43')][_0x132d14])[_0x77da('0x86')];_0x17ed71[_0x77da('0x87')](_0x77da('0x88'),_0x3cb69e,_0x470840);}else{if(_0x2f0495[_0x77da('0x43')][_0x132d14]==='null'){_0x17ed71[_0x77da('0x87')]('i.'+_0x132d14+_0x77da('0x89'));}else{_0x17ed71[_0x77da('0x87')]('i.'+_0x132d14+_0x77da('0x8a'),_0x2f0495[_0x77da('0x43')][_0x132d14]);}}});}if(_0x2f0495[_0x77da('0x43')][_0x77da('0x8b')]){if(_0x2f0495[_0x77da('0x43')][_0x77da('0x8b')]==0x1){_0x17ed71[_0x77da('0x68')]('`unreadMessages`\x20=\x200');}else{_0x17ed71['having']('`unreadMessages`\x20>\x200');}}if(_0x2f0495[_0x77da('0x43')][_0x77da('0x8c')]){_0x1d665d=_[_0x77da('0x8d')](_0x2f0495['query']['tag'])?_0x2f0495[_0x77da('0x43')][_0x77da('0x8c')]:new Array(_0x2f0495[_0x77da('0x43')][_0x77da('0x8c')]);_0x1d665d[_0x77da('0x3d')](function(_0x44fa0d){_0x111260['or'](_0x77da('0x78'),'%,'+_0x44fa0d+',%');});}if(_0x2f0495[_0x77da('0x43')][_0x77da('0x8e')]){var _0x11152b=_0x2f0495[_0x77da('0x43')][_0x77da('0x8e')][_0x77da('0x8f')]('\x5c','\x5c\x5c')['replace']('\x27\x27','\x27\x27\x27\x27');if(qs[_0x77da('0x90')](_0x11152b)){_0x1e0146['or']('i.id\x20LIKE\x20?',_0x11152b+'%');}else{_0x1e0146['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x77da('0x91')](_0x11152b))['or'](_0x77da('0x92'),_0x11152b+'%');}}}_0x17ed71[_0x77da('0x87')](_0x1e0146);_0x17ed71['group']('i.id');var _0x1c3a18={'type':db['Sequelize'][_0x77da('0x93')][_0x77da('0x94')],'raw':!![]};var _0x554c44=_0x17ed71[_0x77da('0x95')]();_0x554c44['field'](_0x77da('0x96'));_0x554c44[_0x77da('0x4f')](_0x77da('0x97'),_0x77da('0x67'));if(_0x2dfeca['order']){_0x2dfeca[_0x77da('0x4b')][_0x77da('0x3d')](function(_0x8454b3){_0x17ed71[_0x77da('0x4b')]('i.'+_0x8454b3[0x0],_0x8454b3[0x1]===_0x77da('0x98')?![]:!![]);});}if(!_[_0x77da('0x80')](_0x1d665d)){_0x17ed71[_0x77da('0x68')](_0x111260);_0x554c44['where']('t.id\x20IN\x20?',_0x1d665d);}BPromise[_0x77da('0x99')]()[_0x77da('0x1f')](function(){if(!_0x3ae855){if(_0x2f0495[_0x77da('0x43')]['ChatWebsiteId']||_0x2f0495['query']['journey'])return;_0x554c44['where'](_0x77da('0x9a'));_0x17ed71[_0x77da('0x87')](_0x77da('0x9a'));return;}return _0x2f0495['user'][_0x77da('0x9b')]({'attributes':['id'],'raw':!![]})['then'](function(_0x39de26){if(_['isEmpty'](_0x39de26)){_0x554c44[_0x77da('0x87')]('i.ChatWebsiteId\x20IS\x20NULL');_0x17ed71[_0x77da('0x87')](_0x77da('0x9c'));}else{_0x554c44['where'](_0x77da('0x81'),_[_0x77da('0x3a')](_0x39de26,'id'));_0x17ed71[_0x77da('0x87')](_0x77da('0x81'),_[_0x77da('0x3a')](_0x39de26,'id'));}});})[_0x77da('0x1f')](function(){db[_0x77da('0x9d')][_0x77da('0x43')](_0x554c44[_0x77da('0x9e')](),_0x1c3a18)['then'](function(_0x4abfb8){_0x25f65f['count']=_0x4abfb8[_0x77da('0x49')];if(_0x25f65f[_0x77da('0x2d')]===0x0)return[];return db[_0x77da('0x9d')]['query'](_0x5c264e[_0x77da('0x9e')](),_0x1c3a18)['then'](function(_0x5e93b1){_0x3c2d89=_[_0x77da('0x9f')](_0x5e93b1,'id');_0x1c3a18=_[_0x77da('0xa0')](_0x1c3a18,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f0495['query'][_0x77da('0x48')]){_0x2dfeca[_0x77da('0x47')][_0x77da('0x3d')](function(_0x5d9750){_0x17ed71[_0x77da('0x4f')]('i.'+_0x5d9750);});}else{_0x17ed71['field'](_0x77da('0x97'),_0x77da('0x67'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xa1'),_0x77da('0xa2'));_0x17ed71[_0x77da('0x4f')]('a.mandatoryDisposition',_0x77da('0xa3'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xa4'));_0x17ed71[_0x77da('0x4f')]('c.firstName',_0x77da('0xa5'));_0x17ed71['field'](_0x77da('0xa6'),_0x77da('0xa7'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xa8'),_0x77da('0xa9'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xaa'),_0x77da('0xab'));_0x17ed71['field'](_0x77da('0xac'),_0x77da('0xad'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xae'),_0x77da('0xaf'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xb0'),_0x77da('0xb1'));_0x17ed71['field']('o.internal',_0x77da('0xb2'));_0x17ed71[_0x77da('0x4f')](_0x77da('0xb3'),'TagIds');}_0x17ed71[_0x77da('0x2f')](_0x2dfeca['limit']);_0x17ed71[_0x77da('0x2e')](_0x2dfeca[_0x77da('0x2e')]);return db[_0x77da('0x9d')]['query'](_0x17ed71['toString'](),_0x1c3a18);})[_0x77da('0x1f')](function(_0x48bd19){_0x128ce3['where'](_0x77da('0xb4'),_[_0x77da('0x3a')](_0x48bd19,'id'));return db[_0x77da('0x9d')][_0x77da('0x43')](_0x128ce3['toString'](),_0x1c3a18)[_0x77da('0x1f')](function(_0x4c5c42){var _0x490dd8=_['groupBy'](_0x4c5c42,_0x77da('0xb5'));var _0x3a4050=[];_0x48bd19[_0x77da('0x3d')](function(_0x36decd){_0x3a4050[_0x77da('0xb6')](updateChatInteraction(_0x36decd,_0x3c2d89,_0x490dd8));});return BPromise[_0x77da('0xb7')](_0x3a4050);});});})[_0x77da('0x1f')](function(_0x1176d1){_0x25f65f['rows']=_0x1176d1;return _0x25f65f;})[_0x77da('0x1f')](respondWithFilteredResult(_0x21de41,_0x2dfeca));})[_0x77da('0x29')](handleError(_0x21de41,null));};exports['show']=function(_0x24029c,_0x5177ba){var _0x3b6c44={'raw':![],'where':{'id':_0x24029c[_0x77da('0xb8')]['id']}},_0x2c1d7c={};_0x2c1d7c[_0x77da('0x42')]=_[_0x77da('0x44')](db['ChatInteraction'][_0x77da('0x3f')]);_0x2c1d7c[_0x77da('0x43')]=_['keys'](_0x24029c[_0x77da('0x43')]);_0x2c1d7c['filters']=_['intersection'](_0x2c1d7c[_0x77da('0x42')],_0x2c1d7c['query']);_0x3b6c44['attributes']=_[_0x77da('0x46')](_0x2c1d7c[_0x77da('0x42')],qs[_0x77da('0x48')](_0x24029c[_0x77da('0x43')]['fields']));_0x3b6c44[_0x77da('0x47')]=_0x3b6c44['attributes'][_0x77da('0x49')]?_0x3b6c44['attributes']:_0x2c1d7c['model'];if(_0x24029c[_0x77da('0x43')]['includeAll']){_0x3b6c44[_0x77da('0xb9')]=[{'all':!![]}];}_0x3b6c44=_[_0x77da('0xa0')]({},_0x3b6c44,_0x24029c['options']);return db[_0x77da('0xba')][_0x77da('0x66')](_0x3b6c44)[_0x77da('0x1f')](handleEntityNotFound(_0x5177ba,null))['then'](respondWithResult(_0x5177ba,null))[_0x77da('0x29')](handleError(_0x5177ba,null));};exports[_0x77da('0xbb')]=function(_0x41b6d7,_0x2a344f){return db['ChatInteraction'][_0x77da('0xbb')](_0x41b6d7['body'],{})[_0x77da('0x1f')](respondWithResult(_0x2a344f,0xc9))[_0x77da('0x29')](handleError(_0x2a344f,null));};exports[_0x77da('0x34')]=function(_0x14b8f7,_0x1a31f3){if(_0x14b8f7[_0x77da('0x7d')]['id']){delete _0x14b8f7[_0x77da('0x7d')]['id'];}return db[_0x77da('0xba')][_0x77da('0x66')]({'where':{'id':_0x14b8f7[_0x77da('0xb8')]['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x1a31f3,null))[_0x77da('0x1f')](saveUpdates(_0x14b8f7[_0x77da('0x7d')],null))['then'](respondWithResult(_0x1a31f3,null))[_0x77da('0x29')](handleError(_0x1a31f3,null));};exports['destroy']=function(_0x52f5fb,_0x1cd28d){return db['ChatInteraction'][_0x77da('0x66')]({'where':{'id':_0x52f5fb[_0x77da('0xb8')]['id']}})['then'](handleEntityNotFound(_0x1cd28d,null))[_0x77da('0x1f')](removeEntity(_0x1cd28d,null))[_0x77da('0x29')](handleError(_0x1cd28d,null));};exports[_0x77da('0xbc')]=function(_0x1ba53c,_0x2d2552){return db[_0x77da('0xba')][_0x77da('0xbc')]()[_0x77da('0x1f')](respondWithResult(_0x2d2552,null))[_0x77da('0x29')](handleError(_0x2d2552,null));};exports[_0x77da('0xbd')]=function(_0x41d7e2,_0x2267c4){if(_0x41d7e2[_0x77da('0x7d')]['id']){delete _0x41d7e2['body']['id'];}return db[_0x77da('0xba')][_0x77da('0x66')]({'where':{'id':_0x41d7e2['params']['id']}})['then'](handleEntityNotFound(_0x2267c4,null))[_0x77da('0x1f')](saveUpdates(_0x41d7e2['body'],null))[_0x77da('0x1f')](respondWithResult(_0x2267c4,null))['catch'](handleError(_0x2267c4,null));};exports[_0x77da('0xbe')]=function(_0x5a4dcd,_0x31a578,_0x2e887c){if(_0x5a4dcd[_0x77da('0x7d')]['id']){delete _0x5a4dcd['body']['id'];}return db['ChatInteraction'][_0x77da('0x66')]({'where':{'id':_0x5a4dcd[_0x77da('0xb8')]['id']}})['then'](function(_0xac3f80){if(!_0xac3f80){logger[_0x77da('0x25')](_0x77da('0xbf'),_0x77da('0xbe'),0x194,_0x77da('0xc0'));_0x31a578[_0x77da('0x2a')](0x194);}else{if(_0xac3f80[_0x77da('0x7c')]){throw new db[(_0x77da('0xc1'))][(_0x77da('0xc2'))](_0x77da('0xc3'));}}return _0xac3f80;})[_0x77da('0x1f')](function(_0x422eca){if(_0x422eca){return _0x422eca[_0x77da('0x34')]({'closed':_0x5a4dcd['body'][_0x77da('0xc4')],'disposition':_0x5a4dcd['body']['disposition']})[_0x77da('0x1f')](function(_0x221ba8){return _0x221ba8;});}})[_0x77da('0x1f')](function(_0x2e3d33){return respondWithRpcPromise('AbandonInteraction',_0x77da('0xbe'),_0x5a4dcd[_0x77da('0x7d')],client9004);})['then'](respondWithResult(_0x31a578,null))[_0x77da('0x29')](handleError(_0x31a578,null));};exports[_0x77da('0xc5')]=function(_0x32845f,_0x211853,_0x2fdd40){_0x32845f[_0x77da('0x7d')]['name']=_0x32845f[_0x77da('0xc6')]['originalname'];_0x32845f[_0x77da('0x7d')][_0x77da('0xc7')]=_0x32845f['file'][_0x77da('0xc8')];_0x32845f['body']['type']=_0x32845f[_0x77da('0xc6')][_0x77da('0xc9')];return db[_0x77da('0xca')]['create'](_0x32845f['body'])['then'](respondWithResult(_0x211853,0xc9))[_0x77da('0x29')](handleError(_0x211853,null));};exports[_0x77da('0xcb')]=function(_0x2b019e,_0x336009,_0x16f067){return db[_0x77da('0xba')][_0x77da('0xcc')]({'where':{'id':_0x2b019e['params']['id']},'raw':!![]})['then'](handleEntityNotFound(_0x336009,null))[_0x77da('0x1f')](function(_0x177a00){if(_0x177a00){if(_0x177a00[_0x77da('0xc4')]){return _0x336009[_0x77da('0x2b')](0x193)[_0x77da('0x2c')]({'status':0x193,'message':_0x77da('0xcd')});}return db['Attachment'][_0x77da('0xcc')]({'where':{'id':_0x2b019e['query']['attachId']},'raw':!![]})[_0x77da('0x1f')](handleEntityNotFound(_0x336009,null));}})[_0x77da('0x1f')](function(_0x264984){if(_0x264984){return _0x336009[_0x77da('0xce')](path[_0x77da('0xcf')](config[_0x77da('0xd0')],_0x77da('0xd1'),_0x264984['basename']));}})[_0x77da('0x29')](handleError(_0x336009,null));};exports[_0x77da('0xd2')]=function(_0x319972,_0x1b3f24){var _0x3f5aa4=null;var _0x2298bc=null;var _0x525b7e=null;var _0x31116d=null;if(_0x319972[_0x77da('0x7d')]['id']){delete _0x319972[_0x77da('0x7d')]['id'];}if(_0x319972['body']['mailTranscript']){_0x31116d=path[_0x77da('0xcf')](config['root'],'server/files/chat/upload/',util[_0x77da('0xd3')](_0x77da('0xd4'),Date[_0x77da('0xd5')]()));_0x319972['body']['pathTranscript']=_0x31116d;}return db[_0x77da('0xba')]['find']({'where':{'id':_0x319972[_0x77da('0xb8')]['id']},'include':[{'model':db[_0x77da('0xd6')],'as':'Messages','include':[{'model':db['User'],'as':'User'}]}]})[_0x77da('0x1f')](handleEntityNotFound(_0x1b3f24,null))[_0x77da('0x1f')](saveUpdates(_0x319972[_0x77da('0x7d')],null))[_0x77da('0x1f')](function(_0x37669b){if(_0x37669b){_0x3f5aa4=_0x37669b;return db['ChatWebsite'][_0x77da('0x66')]({'where':{'id':_0x3f5aa4[_0x77da('0xd7')]}});}})['then'](function(_0x4c5bfe){if(_0x4c5bfe){_0x525b7e=_0x4c5bfe;return db[_0x77da('0xd8')][_0x77da('0x66')]({'where':{'id':_0x3f5aa4[_0x77da('0x71')]}});}})['then'](function(_0x20b1fa){if(_0x20b1fa){_0x2298bc=_0x20b1fa;if(_0x31116d){var _0x4840c5=null;for(var _0xaf82f4=0x1;_0xaf82f4<_0x3f5aa4['Messages']['length'];++_0xaf82f4){_0x4840c5=_0x3f5aa4[_0x77da('0xd9')][_0xaf82f4];var _0x44b1f7=_0x4840c5[_0x77da('0x7c')]?util[_0x77da('0xd3')](_0x77da('0xda'),_0x525b7e[_0x77da('0xdb')],_0x4840c5[_0x77da('0x7c')]):'System';var _0x2d9b7b=_0x319972[_0x77da('0x7d')][_0x77da('0xdc')]||util['format'](_0x77da('0xda'),_0x77da('0xdd'),_0x4840c5[_0x77da('0x71')]);switch(_0x525b7e[_0x77da('0xde')]){case _0x77da('0xdf'):_0x44b1f7=_0x4840c5['UserId']?util[_0x77da('0xd3')](_0x77da('0xda'),_0x525b7e[_0x77da('0xdb')],_0x4840c5[_0x77da('0x7c')]):_0x77da('0xe0');break;case'agent_alias':_0x44b1f7=_0x4840c5[_0x77da('0x7c')]?_0x4840c5[_0x77da('0x7a')]['alias']||_0x4840c5[_0x77da('0x7a')][_0x77da('0xe1')]:_0x77da('0xe0');break;case _0x77da('0xe2'):_0x44b1f7=_0x4840c5[_0x77da('0x7c')]?_0x4840c5['User'][_0x77da('0xe1')]:_0x77da('0xe0');break;default:_0x44b1f7=_0x4840c5['UserId']?util[_0x77da('0xd3')](_0x77da('0xda'),_0x525b7e['agentAlias'],_0x4840c5['UserId']):'System';}var _0x1c2c42=util[_0x77da('0xd3')](_0x77da('0xe3'),moment(_0x4840c5[_0x77da('0x83')])['format'](_0x77da('0xe4')),_0x4840c5[_0x77da('0xe5')]==='in'?_0x2d9b7b:_0x44b1f7,_0x4840c5[_0x77da('0x7d')]);if(!_0x4840c5[_0x77da('0xe6')]){fs[_0x77da('0xe7')](_0x31116d,_0x1c2c42);}}return db[_0x77da('0xe8')][_0x77da('0xcc')]({'where':{'service':!![]},'include':[{'model':db[_0x77da('0xe9')],'as':_0x77da('0xea'),'raw':!![]}]});}}})[_0x77da('0x1f')](function(_0x56ebd3){if(_0x56ebd3&&_0x56ebd3[_0x77da('0xea')]&&_0x319972['body']){var _0x2854f3={'tls':{'rejectUnauthorized':![]}};if(_0x56ebd3[_0x77da('0xea')][_0x77da('0xeb')]){_0x2854f3[_0x77da('0xeb')]=_0x56ebd3[_0x77da('0xea')][_0x77da('0xeb')];}else{_0x2854f3['host']=_0x56ebd3[_0x77da('0xea')][_0x77da('0xec')];_0x2854f3['port']=_0x56ebd3[_0x77da('0xea')]['port'];_0x2854f3['secure']=_0x56ebd3[_0x77da('0xea')][_0x77da('0xed')];}if(_0x56ebd3[_0x77da('0xea')][_0x77da('0xee')]){_0x2854f3[_0x77da('0xef')]={'user':_0x56ebd3[_0x77da('0xea')]['user'],'pass':_0x56ebd3['Smtp'][_0x77da('0xf0')]};}return respondWithRpcPromise(_0x77da('0xf1'),'sendMail',{'account':_0x2854f3,'message':{'from':util['format'](_0x77da('0xf2'),_0x56ebd3[_0x77da('0x37')],_0x56ebd3['email']||_0x56ebd3['Smtp']['user']),'to':_0x319972['body'][_0x77da('0xf3')],'subject':_0x77da('0xf4'),'text':util[_0x77da('0xd3')](_0x77da('0xf5'),_0x319972[_0x77da('0x7d')][_0x77da('0xf3')]),'attachments':[{'path':_0x31116d}]}})[_0x77da('0x1f')](function(){return _0x3f5aa4;})['catch'](function(_0x362c36){console[_0x77da('0x25')](_0x362c36);});}else{return _0x3f5aa4;}})[_0x77da('0x1f')](respondWithStatusCode(_0x1b3f24,0xc8))[_0x77da('0x29')](handleError(_0x1b3f24,null));};exports[_0x77da('0xf6')]=function(_0x28e635,_0x40f21d,_0x7706a){return db[_0x77da('0xd6')][_0x77da('0x66')]({'where':{'id':_0x28e635[_0x77da('0xb8')]['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x40f21d,null))['then'](function(_0x11c893){if(_0x11c893){return _0x11c893[_0x77da('0xf6')](_0x28e635[_0x77da('0x7d')][_0x77da('0xf7')],_[_0x77da('0xf8')](_0x28e635[_0x77da('0x7d')],[_0x77da('0xf7'),'id'])||{});}})[_0x77da('0x1f')](respondWithResult(_0x40f21d,null))['catch'](handleError(_0x40f21d,null));};exports[_0x77da('0xf9')]=function(_0x55808a,_0x442836,_0x476590){var _0x46ccb0={'raw':![],'where':{}};var _0x237aa0={};var _0x5143cc={'count':0x0,'rows':[]};return db[_0x77da('0xba')][_0x77da('0xcc')]({'where':{'id':_0x55808a['params']['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x442836,null))[_0x77da('0x1f')](function(_0x24d278){if(_0x24d278){_0x237aa0[_0x77da('0x42')]=_[_0x77da('0x44')](db[_0x77da('0xd6')][_0x77da('0x3f')]);_0x237aa0[_0x77da('0x43')]=_[_0x77da('0x44')](_0x55808a[_0x77da('0x43')]);_0x237aa0[_0x77da('0x45')]=_['intersection'](_0x237aa0[_0x77da('0x42')],_0x237aa0['query']);_0x46ccb0[_0x77da('0x47')]=_['intersection'](_0x237aa0['model'],qs[_0x77da('0x48')](_0x55808a['query'][_0x77da('0x48')]));_0x46ccb0[_0x77da('0x47')]=_0x46ccb0['attributes'][_0x77da('0x49')]?_0x46ccb0['attributes']:_0x237aa0[_0x77da('0x42')];if(!_0x55808a['query']['hasOwnProperty']('nolimit')){_0x46ccb0['limit']=qs['limit'](_0x55808a[_0x77da('0x43')]['limit']);_0x46ccb0[_0x77da('0x2e')]=qs[_0x77da('0x2e')](_0x55808a[_0x77da('0x43')]['offset']);}_0x46ccb0[_0x77da('0x4b')]=qs['sort'](_0x55808a[_0x77da('0x43')]['sort']);_0x46ccb0[_0x77da('0x87')]=qs['filters'](_[_0x77da('0x4d')](_0x55808a['query'],_0x237aa0[_0x77da('0x45')]));_0x46ccb0[_0x77da('0x87')][_0x77da('0xb5')]=_0x24d278['id'];if(_0x55808a[_0x77da('0x43')][_0x77da('0x8e')]){_0x46ccb0[_0x77da('0x87')]=_[_0x77da('0xa0')](_0x46ccb0[_0x77da('0x87')],{'$or':_[_0x77da('0x3a')](_0x46ccb0[_0x77da('0x47')],function(_0x8aed7d){var _0x35b243={};_0x35b243[_0x8aed7d]={'$like':'%'+_0x55808a[_0x77da('0x43')][_0x77da('0x8e')]+'%'};return _0x35b243;})});}if(_0x55808a['query']['$gte']){var _0x6dff0e=_0x55808a[_0x77da('0x43')][_0x77da('0x85')][_0x77da('0x6d')](',');var _0x222ec2={};_0x222ec2[_0x6dff0e[0x0]]={'$gte':moment(_0x6dff0e[0x1])[_0x77da('0xd3')]('YYYY-MM-DD\x20HH:mm:ss')};_0x46ccb0[_0x77da('0x87')]=_['merge'](_0x46ccb0[_0x77da('0x87')],_0x222ec2);}_0x46ccb0=_[_0x77da('0xa0')]({},_0x46ccb0,_0x55808a['options']);return db[_0x77da('0xd6')][_0x77da('0x2d')]({'where':_0x46ccb0[_0x77da('0x87')]})[_0x77da('0x1f')](function(_0x5a548e){_0x5143cc[_0x77da('0x2d')]=_0x5a548e;if(_0x55808a[_0x77da('0x43')][_0x77da('0xfa')]){_0x46ccb0[_0x77da('0xb9')]=[{'all':!![]}];}return db[_0x77da('0xd6')][_0x77da('0xfb')](_0x46ccb0);})[_0x77da('0x1f')](function(_0xbddfc9){_0x5143cc[_0x77da('0xfc')]=_0xbddfc9;return _0x5143cc;});}})[_0x77da('0x1f')](respondWithFilteredResult(_0x442836,_0x46ccb0))[_0x77da('0x29')](handleError(_0x442836,null));};exports['getMyMessages']=function(_0x16b763,_0x15b293,_0x352bad){var _0x508025={'where':{}},_0x24e34f={},_0x3d6ea8={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x77da('0xcc')]({'where':{'id':_0x16b763[_0x77da('0xb8')]['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x15b293,null))['then'](function(_0x57a0bd){if(_0x57a0bd){_0x24e34f['model']=_[_0x77da('0x44')](db[_0x77da('0xd6')][_0x77da('0x3f')]);_0x24e34f['query']=_[_0x77da('0x44')](_0x16b763['query']);_0x24e34f[_0x77da('0x45')]=_['intersection'](_0x24e34f[_0x77da('0x42')],_0x24e34f[_0x77da('0x43')]);_0x508025[_0x77da('0x47')]=_[_0x77da('0x46')](_0x24e34f[_0x77da('0x42')],qs[_0x77da('0x48')](_0x16b763['query'][_0x77da('0x48')]));_0x508025[_0x77da('0x47')]=_0x508025[_0x77da('0x47')][_0x77da('0x49')]?_0x508025[_0x77da('0x47')]:_0x24e34f['model'];if(!_0x16b763[_0x77da('0x43')][_0x77da('0x4a')](_0x77da('0xfd'))){_0x508025[_0x77da('0x2f')]=qs[_0x77da('0x2f')](_0x16b763[_0x77da('0x43')][_0x77da('0x2f')]);_0x508025[_0x77da('0x2e')]=qs['offset'](_0x16b763[_0x77da('0x43')][_0x77da('0x2e')]);}_0x508025[_0x77da('0x4b')]=qs[_0x77da('0x4c')](_0x16b763[_0x77da('0x43')][_0x77da('0x4c')]);_0x508025[_0x77da('0x87')]=qs['filters'](_['pick'](_0x16b763[_0x77da('0x43')],_0x24e34f[_0x77da('0x45')]));_0x508025['where'][_0x77da('0xb5')]=_0x57a0bd['id'];if(_0x16b763[_0x77da('0x43')][_0x77da('0x8e')]){_0x508025[_0x77da('0x87')]=_[_0x77da('0xa0')](_0x508025['where'],{'$or':_[_0x77da('0x3a')](_0x508025[_0x77da('0x47')],function(_0x195ddd){var _0x42a46e={};_0x42a46e[_0x195ddd]={'$like':'%'+_0x16b763[_0x77da('0x43')]['filter']+'%'};return _0x42a46e;})});}_0x508025[_0x77da('0x87')][_0x77da('0xe6')]=![];if(_0x16b763[_0x77da('0x43')]['id']){_0x508025[_0x77da('0x87')]['id']={'$gt':_0x16b763[_0x77da('0x43')]['id']};}_0x508025=_[_0x77da('0xa0')]({},_0x508025,_0x16b763['options']);return db[_0x77da('0xd6')][_0x77da('0x2d')]({'where':_0x508025['where']})[_0x77da('0x1f')](function(_0x33ab80){_0x3d6ea8[_0x77da('0x2d')]=_0x33ab80;_0x508025[_0x77da('0xb9')]=[];if(_0x16b763[_0x77da('0x43')]['includeAgent']){_0x508025[_0x77da('0xb9')]['push']({'model':db[_0x77da('0x7a')],'as':_0x77da('0x7a'),'attributes':['id','fullname',_0x77da('0xfe')]});}if(_0x16b763[_0x77da('0x43')][_0x77da('0xfa')]){_0x508025[_0x77da('0xb9')]=[{'all':!![]}];}return db[_0x77da('0xd6')][_0x77da('0xfb')](_0x508025);})[_0x77da('0x1f')](function(_0xdf1eda){_0x3d6ea8[_0x77da('0xfc')]=_0xdf1eda;return _0x3d6ea8;});}})[_0x77da('0x1f')](respondWithFilteredResult(_0x15b293,_0x508025))[_0x77da('0x29')](handleError(_0x15b293,null));};exports['addTags']=function(_0x508db1,_0x37950f,_0x11e8fc){return db['ChatInteraction'][_0x77da('0x66')]({'where':{'id':_0x508db1[_0x77da('0xb8')]['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x37950f,null))[_0x77da('0x1f')](function(_0x8d04f5){if(_0x8d04f5){return _0x8d04f5[_0x77da('0xff')](_0x508db1[_0x77da('0x7d')][_0x77da('0xf7')],_[_0x77da('0xf8')](_0x508db1[_0x77da('0x7d')],[_0x77da('0xf7'),'id'])||{})[_0x77da('0x100')](function(){return db['Tag']['findAll']({'attributes':['id',_0x77da('0x37'),_0x77da('0x50')],'where':{'id':_0x508db1[_0x77da('0x7d')][_0x77da('0xf7')]}});})[_0x77da('0x1f')](function(_0x21967b){socket[_0x77da('0x101')](_0x77da('0x102'),{'id':Number(_0x508db1[_0x77da('0xb8')]['id']),'tags':_0x21967b||[]});return{'id':Number(_0x508db1['params']['id']),'tags':_0x21967b||[]};});}})['then'](respondWithResult(_0x37950f,null))[_0x77da('0x29')](handleError(_0x37950f,null));};exports[_0x77da('0x103')]=function(_0x9a8a08,_0x356e50,_0x4465aa){return db['ChatInteraction']['find']({'where':{'id':_0x9a8a08[_0x77da('0xb8')]['id']}})[_0x77da('0x1f')](handleEntityNotFound(_0x356e50,null))[_0x77da('0x1f')](function(_0x4609aa){if(_0x4609aa){return _0x4609aa[_0x77da('0x103')](_0x9a8a08[_0x77da('0x43')][_0x77da('0xf7')]);}})[_0x77da('0x1f')](respondWithStatusCode(_0x356e50,null))[_0x77da('0x29')](handleError(_0x356e50,null));};exports['download']=function(_0x4e48d1,_0x4af714){var _0x5c0d28=moment()['unix']()[_0x77da('0x9e')]();var _0x177019=path[_0x77da('0xcf')](config[_0x77da('0xd0')],_0x77da('0x104'),_0x77da('0x105'),'tmp');var _0x996c29=path[_0x77da('0xcf')](config[_0x77da('0xd0')],'server',_0x77da('0x105'),_0x77da('0x106'));var _0x5b1635=path['join'](_0x177019,_0x5c0d28);var _0x3b489c=util[_0x77da('0xd3')](_0x77da('0x107'),_0x4e48d1[_0x77da('0xb8')]['id'],_0x5c0d28);var _0x3ab97d=path[_0x77da('0xcf')](_0x177019,_0x3b489c);var _0x4e105c=[];_0x4e105c[_0x77da('0xb6')]({'model':db['User'],'as':'User','attributes':['id',_0x77da('0xe1')],'raw':!![]});_0x4e105c[_0x77da('0xb6')]({'model':db[_0x77da('0xd8')],'as':_0x77da('0x6b'),'attributes':['id',_0x77da('0x108'),_0x77da('0x109')],'raw':!![]});if(_0x4e48d1[_0x77da('0x43')][_0x77da('0x106')]){_0x4e105c[_0x77da('0xb6')]({'model':db['Attachment'],'as':_0x77da('0xca'),'raw':!![]});}var _0x200a02=[{'model':db[_0x77da('0xd6')],'as':_0x77da('0xd9'),'attributes':['id',_0x77da('0x7d'),_0x77da('0x83'),_0x77da('0xe5'),'secret',_0x77da('0x8b')],'include':_0x4e105c}];_0x200a02[_0x77da('0xb6')]({'model':db[_0x77da('0x10a')],'as':'Account','attributes':['id',_0x77da('0x37')]});_0x200a02[_0x77da('0xb6')]({'model':db[_0x77da('0x7a')],'as':_0x77da('0x10b'),'attributes':['id','fullname']});return db[_0x77da('0xba')][_0x77da('0x66')]({'where':{'id':_0x4e48d1[_0x77da('0xb8')]['id']},'include':_0x200a02})[_0x77da('0x1f')](handleEntityNotFound(_0x4af714,null))[_0x77da('0x1f')](function(_0x4ac3f4){if(_0x4ac3f4){var _0x5b4905=_0x4ac3f4['get']({'plain':!![]});fs['mkdirSync'](_0x5b1635);var _0x354044={'format':'A4','border':_0x77da('0x10c'),'header':{'height':_0x77da('0x10d'),'contents':{'first':'\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20'}},'footer':{'height':'30px','contents':{'default':util['format'](_0x77da('0x10e'),util[_0x77da('0xd3')](_0x77da('0x10f'),_0x77da('0x110'),_0x5b4905['id']),moment()['format']('YYYY-MM-DD')[_0x77da('0x9e')]())}}};var _0x562100={'channel':_0x77da('0x110'),'account':_0x5b4905['Account'][_0x77da('0x37')],'agent':_0x5b4905[_0x77da('0x10b')]?_0x5b4905['Owner'][_0x77da('0xe1')]:_0x77da('0x111'),'createdAt':moment(_0x5b4905[_0x77da('0x83')])['format'](_0x77da('0x112'))[_0x77da('0x9e')](),'closedAt':_0x5b4905[_0x77da('0xc4')]?moment(_0x5b4905['closedAt'])[_0x77da('0xd3')](_0x77da('0x112'))[_0x77da('0x9e')]():'','disposition':_0x5b4905[_0x77da('0x113')],'chatInfo':{'browser':_0x5b4905[_0x77da('0x114')],'os':_0x5b4905[_0x77da('0x115')],'referer':_0x5b4905['referer'],'customerIp':_0x5b4905[_0x77da('0x116')],'customerPort':_0x5b4905[_0x77da('0x117')]?_0x5b4905[_0x77da('0x117')]:'N.A.'},'messages':_(_0x5b4905[_0x77da('0xd9')])['tail']()[_0x77da('0x8e')]({'secret':![]})[_0x77da('0x3a')](function(_0x3972fd){if(_0x3972fd[_0x77da('0xca')]){var _0x5307dd=path[_0x77da('0xcf')](_0x996c29,_0x3972fd[_0x77da('0xca')][_0x77da('0xc7')]);if(fs['existsSync'](_0x5307dd)){fs[_0x77da('0x118')](_0x5307dd)[_0x77da('0x119')](fs[_0x77da('0x11a')](path['join'](_0x5b1635,_0x3972fd['Attachment'][_0x77da('0xc7')])));}}return{'date':moment(_0x3972fd[_0x77da('0x83')])[_0x77da('0xd3')](_0x77da('0x112'))['toString'](),'sender':_0x3972fd[_0x77da('0xe5')]===_0x77da('0x11b')?_0x3972fd[_0x77da('0x7a')]?_0x3972fd[_0x77da('0x7a')]['fullname']:_0x77da('0xe0'):_0x3972fd[_0x77da('0x6b')][_0x77da('0x108')]+(_0x3972fd[_0x77da('0x6b')][_0x77da('0x109')]?'\x20'+_0x3972fd[_0x77da('0x6b')][_0x77da('0x109')]:''),'body':_0x3972fd[_0x77da('0xca')]?_0x3972fd['Attachment'][_0x77da('0xc7')]:_0x3972fd[_0x77da('0x7d')],'direction':_0x3972fd[_0x77da('0xe5')]===_0x77da('0x11b')?'A':'C','secret':_0x3972fd[_0x77da('0xe6')],'read':_0x3972fd['read'],'attachment':_0x3972fd[_0x77da('0xca')]};})[_0x77da('0x6f')]()};return ejs[_0x77da('0x11c')](path[_0x77da('0xcf')](config[_0x77da('0xd0')],'server',_0x77da('0x11d'),_0x77da('0x11e')),{'interaction':_0x562100})[_0x77da('0x1f')](function(_0x1c92b2){return new BPromise(function(_0x11d10b,_0x156e10){pdf[_0x77da('0xbb')](_0x1c92b2,_0x354044)[_0x77da('0x11f')](path[_0x77da('0xcf')](_0x5b1635,_0x77da('0x120')+_0x5b4905['id']+'-'+_0x5c0d28+_0x77da('0x121')),function(_0xa2db07,_0x42a9ca){if(_0xa2db07)return _0x156e10(_0xa2db07);_0x11d10b(_0x42a9ca);});});})['then'](function(){return new BPromise(function(_0x1506bb,_0x114b11){zipdir(_0x5b1635,{'saveTo':_0x3ab97d},function(_0x4c9246,_0x4e6325){if(_0x4c9246)return _0x114b11(_0x4c9246);return _0x1506bb(_0x4e6325);});})[_0x77da('0x1f')](function(){return new BPromise(function(_0x4775bd,_0x415747){rimraf(_0x5b1635,function(_0x1dcd67){if(_0x1dcd67)_0x415747(_0x1dcd67);return _0x4775bd();});});})[_0x77da('0x1f')](function(){return _0x4af714[_0x77da('0xce')](_0x3ab97d,_0x3b489c,function(_0x1c05e8){if(_0x1c05e8){console[_0x77da('0x122')](_0x77da('0x123'),_0x1c05e8);}else{fs['unlinkSync'](_0x3ab97d);}});});});}else{return _0x4af714[_0x77da('0x2a')](0xc8);}})['catch'](handleError(_0x4af714,null));}; \ No newline at end of file +var _0x25fa=['stringify','error','code','message','sendStatus','end','status','count','offset','limit','set','Content-Range','json','reject','save','update','stack','name','send','Users','map','TagIds','Tags','forEach','push','index','ChatInteraction','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_chat_interactions','left_join','users','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','it.ChatInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','operator','$substring','split','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','start','body','some','compact','isEmpty','ChatWebsiteId','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','i.ChatWebsiteId\x20IS\x20NULL','sequelize','toString','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.ChatInteractionId\x20IN\x20?','ChatInteractionId','all','rows','show','params','includeAll','options','catch','create','destroy','describe','customUpdate','abandon','abandonInteraction,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','Interaction\x20already\x20assigned','closed','disposition','attachmentUpload','file','originalname','basename','filename','mimetype','Attachment','Unauthorized','findOne','download','join','close','root','format','transcript-%s.txt','pathTranscript','ChatMessage','Messages','User','ChatWebsite','CmContact','agentAlias','System','customer','%s%d','agentIdentifier','agent_alias','fullname','agent_fullname','[%s]\x20%s:\x20%s\x0a','secret','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','user','pass','SendMail','sendMail','email','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','include','getMyMessages','includeAgent','alias','findAll','addTags','setTags','spread','emit','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','transcript-%d-%s.zip','lastName','direction','Account','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Chat','YYYY-MM-DD','Owner','closedAt','browserName','osName','referer','customerIp','customerPort','N.A.','tail','existsSync','createReadStream','pipe','createWriteStream','out','Contact','firstName','renderFile','views','downloadInteraction.html','toFile','.pdf','log','unlinkSync','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','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~!@#$%^&-_=+[{]}.','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x36d9eb,_0x4c1ebf){var _0x10f24e=function(_0x441747){while(--_0x441747){_0x36d9eb['push'](_0x36d9eb['shift']());}};_0x10f24e(++_0x4c1ebf);}(_0x25fa,0x109));var _0xa25f=function(_0x5ab744,_0x445f3e){_0x5ab744=_0x5ab744-0x0;var _0x55ebb4=_0x25fa[_0x5ab744];return _0x55ebb4;};'use strict';var pdf=require(_0xa25f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa25f('0x1'));var zipdir=require(_0xa25f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa25f('0x3'));var moment=require(_0xa25f('0x4'));var BPromise=require(_0xa25f('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xa25f('0x6'));var sox=require('sox');var csv=require(_0xa25f('0x7'));var ejs=require(_0xa25f('0x8'));var fs=require('fs');var _=require(_0xa25f('0x9'));var squel=require(_0xa25f('0xa'));var crypto=require(_0xa25f('0xb'));var jsforce=require(_0xa25f('0xc'));var deskjs=require(_0xa25f('0xd'));var toCsv=require(_0xa25f('0x7'));var querystring=require(_0xa25f('0xe'));var Papa=require('papaparse');var Redis=require(_0xa25f('0xf'));var authService=require(_0xa25f('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa25f('0x11'));var hardwareService=require(_0xa25f('0x12'));var logger=require(_0xa25f('0x13'))(_0xa25f('0x14'));var utils=require('../../config/utils');var config=require(_0xa25f('0x15'));var db=require(_0xa25f('0x16'))['db'];config['redis']=_[_0xa25f('0x17')](config[_0xa25f('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa25f('0x19'))(new Redis(config[_0xa25f('0x18')]));require(_0xa25f('0x1a'))[_0xa25f('0x1b')](socket);var jayson=require(_0xa25f('0x1c'));var client=jayson[_0xa25f('0x1d')][_0xa25f('0x1e')]({'port':0x232b});var client9004=jayson[_0xa25f('0x1d')][_0xa25f('0x1e')]({'port':0x232c});function checkPasswordPattern(_0x2d2417,_0x1e5836,_0x1859ba){if(_0x1859ba){var _0x57ada6=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57ada6[_0xa25f('0x1f')](_0x1e5836)){return _0x2d2417;}else{throw new db[(_0xa25f('0x20'))][(_0xa25f('0x21'))](_0xa25f('0x22'));}}else{return _0x2d2417;}}function respondWithRpcPromise(_0x18705c,_0x427105,_0x4a4805,_0x292171){return new BPromise(function(_0x5a2d5c,_0x32b868){var _0x562573=_0x292171||client;return _0x562573['request'](_0x18705c,_0x4a4805)[_0xa25f('0x23')](function(_0x489c83){logger[_0xa25f('0x24')](_0xa25f('0x25'),_0x427105,_0xa25f('0x26'));logger[_0xa25f('0x27')](_0xa25f('0x28'),_0x427105,'request\x20sent',JSON[_0xa25f('0x29')](_0x489c83));if(_0x489c83[_0xa25f('0x2a')]){if(_0x489c83[_0xa25f('0x2a')][_0xa25f('0x2b')]===0x1f4){logger['error'](_0xa25f('0x25'),_0x427105,_0x489c83[_0xa25f('0x2a')][_0xa25f('0x2c')]);return _0x32b868(_0x489c83[_0xa25f('0x2a')]['message']);}logger[_0xa25f('0x2a')](_0xa25f('0x25'),_0x427105,_0x489c83[_0xa25f('0x2a')][_0xa25f('0x2c')]);return _0x5a2d5c(_0x489c83['error'][_0xa25f('0x2c')]);}else{logger[_0xa25f('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x427105,_0xa25f('0x26'));_0x5a2d5c(_0x489c83['result'][_0xa25f('0x2c')]);}})['catch'](function(_0x1e1fbd){logger[_0xa25f('0x2a')]('ChatInteraction,\x20%s,\x20%s',_0x427105,_0x1e1fbd);_0x32b868(_0x1e1fbd);});});}function respondWithStatusCode(_0xf6c928,_0x1412b6){_0x1412b6=_0x1412b6||0xcc;return function(_0x54d98c){if(_0x54d98c){return _0xf6c928[_0xa25f('0x2d')](_0x1412b6);}return _0xf6c928['status'](_0x1412b6)[_0xa25f('0x2e')]();};}function respondWithResult(_0x41a847,_0x472114){_0x472114=_0x472114||0xc8;return function(_0x208518){if(_0x208518){return _0x41a847[_0xa25f('0x2f')](_0x472114)['json'](_0x208518);}};}function respondWithFilteredResult(_0x24e358,_0x28d84e){return function(_0x119ffc){if(_0x119ffc){var _0x245684=_0x119ffc[_0xa25f('0x30')],_0x3bdde0=_0x28d84e[_0xa25f('0x31')],_0x501372=_0x28d84e[_0xa25f('0x31')]+_0x28d84e[_0xa25f('0x32')],_0x1ca4a3;if(_0x501372>=_0x245684){_0x501372=_0x245684;_0x1ca4a3=0xc8;}else{_0x1ca4a3=0xce;}_0x24e358[_0xa25f('0x2f')](_0x1ca4a3);return _0x24e358[_0xa25f('0x33')](_0xa25f('0x34'),_0x3bdde0+'-'+_0x501372+'/'+_0x245684)[_0xa25f('0x35')](_0x119ffc);}return null;};}function patchUpdates(_0x5621ab){return function(_0x597233){try{jsonpatch['apply'](_0x597233,_0x5621ab,!![]);}catch(_0x41093d){return BPromise[_0xa25f('0x36')](_0x41093d);}return _0x597233[_0xa25f('0x37')]();};}function saveUpdates(_0x370759,_0x311ba8){return function(_0xaefd9){if(_0xaefd9){return _0xaefd9[_0xa25f('0x38')](_0x370759)[_0xa25f('0x23')](function(_0x3ef65f){return _0x3ef65f;});}return null;};}function removeEntity(_0x291351,_0x3c0561){return function(_0x574149){if(_0x574149){return _0x574149['destroy']()[_0xa25f('0x23')](function(){_0x291351[_0xa25f('0x2f')](0xcc)[_0xa25f('0x2e')]();});}};}function handleEntityNotFound(_0x5d3103,_0x5a558d){return function(_0x4aadc1){if(!_0x4aadc1){_0x5d3103[_0xa25f('0x2d')](0x194);}return _0x4aadc1;};}function handleError(_0x25952d,_0x1078c4){_0x1078c4=_0x1078c4||0x1f4;return function(_0x4a334b){logger['error'](_0x4a334b[_0xa25f('0x39')]);if(_0x4a334b[_0xa25f('0x3a')]){delete _0x4a334b['name'];}_0x25952d['status'](_0x1078c4)[_0xa25f('0x3b')](_0x4a334b);};}function getInteractionUsers(_0x33ad7a,_0x8c753){return new BPromise(function(_0x494e4c,_0x151c4b){try{if(_0x8c753[_0x33ad7a['id']]){_0x33ad7a[_0xa25f('0x3c')]=_[_0xa25f('0x3d')](_0x8c753[_0x33ad7a['id']],function(_0x49556e){return{'id':_0x49556e['id'],'fullname':_0x49556e['fullname']};});}}catch(_0x3108bb){_0x151c4b(_0x3108bb);}_0x494e4c(_0x33ad7a);});}function getInteractionTags(_0x44c9c8,_0xe6cb75){return new BPromise(function(_0x32c745,_0x4649a7){try{if(_0x44c9c8[_0xa25f('0x3e')]){_0x44c9c8[_0xa25f('0x3f')]=[];_0x44c9c8[_0xa25f('0x3e')]['split'](',')[_0xa25f('0x40')](function(_0x773d41){_0x44c9c8[_0xa25f('0x3f')][_0xa25f('0x41')](_0xe6cb75[_0x773d41]);});}delete _0x44c9c8[_0xa25f('0x3e')];}catch(_0xd285eb){_0x4649a7(_0xd285eb);}_0x32c745(_0x44c9c8);});}function updateChatInteraction(_0x38bacd,_0x4603a9,_0x3f052f){return new BPromise(function(_0x370375,_0xd91854){return getInteractionUsers(_0x38bacd,_0x3f052f)[_0xa25f('0x23')](function(_0x82ddbf){return getInteractionTags(_0x82ddbf,_0x4603a9);})['then'](function(_0x20400d){_0x370375(_0x20400d);})['catch'](function(_0xace015){_0xd91854(_0xace015);});});}exports[_0xa25f('0x42')]=function(_0x36afe4,_0x559874){var _0x9f2276={},_0x1eaa67={},_0x37d94d={'count':0x0,'rows':[]};var _0x19724c=_['map'](db[_0xa25f('0x43')][_0xa25f('0x44')],function(_0x25123c){return{'name':_0x25123c[_0xa25f('0x45')],'type':_0x25123c[_0xa25f('0x46')][_0xa25f('0x47')]};});_0x1eaa67['model']=_[_0xa25f('0x3d')](_0x19724c,_0xa25f('0x3a'));_0x1eaa67['query']=_[_0xa25f('0x48')](_0x36afe4[_0xa25f('0x49')]);_0x1eaa67[_0xa25f('0x4a')]=_[_0xa25f('0x4b')](_0x1eaa67[_0xa25f('0x4c')],_0x1eaa67[_0xa25f('0x49')]);_0x9f2276[_0xa25f('0x4d')]=_[_0xa25f('0x4b')](_0x1eaa67[_0xa25f('0x4c')],qs[_0xa25f('0x4e')](_0x36afe4[_0xa25f('0x49')][_0xa25f('0x4e')]));_0x9f2276[_0xa25f('0x4d')]=_0x9f2276['attributes'][_0xa25f('0x4f')]?_0x9f2276[_0xa25f('0x4d')]:_0x1eaa67[_0xa25f('0x4c')];if(!_0x36afe4[_0xa25f('0x49')]['hasOwnProperty'](_0xa25f('0x50'))){_0x9f2276[_0xa25f('0x32')]=qs[_0xa25f('0x32')](_0x36afe4['query'][_0xa25f('0x32')]);_0x9f2276[_0xa25f('0x31')]=qs[_0xa25f('0x31')](_0x36afe4[_0xa25f('0x49')][_0xa25f('0x31')]);}_0x9f2276[_0xa25f('0x51')]=qs[_0xa25f('0x52')](_0x36afe4[_0xa25f('0x49')]['sort']);_0x9f2276[_0xa25f('0x53')]=qs[_0xa25f('0x4a')](_[_0xa25f('0x54')](_0x36afe4[_0xa25f('0x49')],_0x1eaa67[_0xa25f('0x4a')]));var _0x37ebf2=[];var _0x3057a5=squel[_0xa25f('0x55')]()[_0xa25f('0x56')]('id')[_0xa25f('0x56')](_0xa25f('0x3a'))[_0xa25f('0x56')](_0xa25f('0x57'))[_0xa25f('0x58')](_0xa25f('0x59'));var _0x22ab7f=squel[_0xa25f('0x55')]()[_0xa25f('0x56')](_0xa25f('0x5a'))[_0xa25f('0x56')](_0xa25f('0x5b'))[_0xa25f('0x56')]('ui.ChatInteractionId')[_0xa25f('0x58')](_0xa25f('0x5c'),'ui')[_0xa25f('0x5d')](_0xa25f('0x5e'),'u','u.id\x20=\x20ui.UserId');var _0x34cb3b=squel['select']()[_0xa25f('0x58')]('chat_interactions','i')['left_join'](_0xa25f('0x5f'),'c',_0xa25f('0x60'))[_0xa25f('0x5d')](_0xa25f('0x5e'),'o',_0xa25f('0x61'))[_0xa25f('0x5d')](_0xa25f('0x62'),'a',_0xa25f('0x63'))[_0xa25f('0x5d')](_0xa25f('0x64'),'me',_0xa25f('0x65'))[_0xa25f('0x5d')]('chat_interaction_has_tags','it',_0xa25f('0x66'))[_0xa25f('0x5d')](_0xa25f('0x59'),'t',_0xa25f('0x67'));var _0x50dd10=squel[_0xa25f('0x68')]();var _0x5c7d08=[];var _0x19b74a=squel[_0xa25f('0x68')]();var _0x36d202;if(_0x36afe4[_0xa25f('0x49')]['search']){_0x36d202=as[_0xa25f('0x69')](_0x36afe4[_0xa25f('0x49')][_0xa25f('0x6a')]);var _0x56c6bf=_0x36d202[_0xa25f('0x6b')];for(var _0x5094e5=0x0;_0x5094e5<_0x36d202[_0xa25f('0x6c')]['length'];_0x5094e5++){var _0x40ab78=_0x36d202[_0xa25f('0x6c')][_0x5094e5];var _0x15073a='i';var _0x37aae1=_[_0xa25f('0x6d')](_0x19724c,[_0xa25f('0x3a'),_0x40ab78['field']]);if(!_0x37aae1){switch(_0x40ab78[_0xa25f('0x56')]){case _0xa25f('0x6e'):if(_0x40ab78[_0xa25f('0x6f')]==0x1){_0x34cb3b[_0xa25f('0x70')]('`'+_0x40ab78[_0xa25f('0x56')]+_0xa25f('0x71'));}else{_0x34cb3b[_0xa25f('0x70')]('`'+_0x40ab78['field']+'`\x20>\x200');}break;case'Contact':if(_0x40ab78[_0xa25f('0x72')]===_0xa25f('0x73')){if(_0x40ab78[_0xa25f('0x6f')][_0xa25f('0x74')]('\x20')[_0xa25f('0x4f')]>0x1){_0x50dd10[_0x56c6bf](_0xa25f('0x75'),qs[_0xa25f('0x76')](_0x40ab78[_0xa25f('0x6f')]),null);}else{var _0x3ffa53='%'+_0x40ab78[_0xa25f('0x6f')]+'%';_0x50dd10[_0x56c6bf](_0xa25f('0x77'),_0x3ffa53,_0x3ffa53,_0x3ffa53);}}else{_0x37aae1=_['find'](_0x19724c,[_0xa25f('0x3a'),_0xa25f('0x78')]);_0x40ab78[_0xa25f('0x56')]=_0xa25f('0x78');_0x73d61e=as[_0xa25f('0x79')](_0x15073a,_0x37aae1['type'],_0x40ab78);_0x50dd10[_0x56c6bf](_0x73d61e[_0xa25f('0x7a')],_0x73d61e[_0xa25f('0x6f')]['start'],_0x73d61e[_0xa25f('0x6f')][_0xa25f('0x2e')]);}break;case'Tag':var _0x381a01=_0x40ab78[_0xa25f('0x6f')][_0xa25f('0x74')](',')[_0xa25f('0x3d')](function(_0x380f61){return Number(_0x380f61);});_0x381a01['forEach'](function(_0xa3ddab){_0x19b74a['or'](_0xa25f('0x7b'),'%,'+_0xa3ddab+',%');});_0x5c7d08=_[_0xa25f('0x7c')](_0x5c7d08,_0x381a01);break;case'User':if(_0x40ab78[_0xa25f('0x72')]===_0xa25f('0x73')){_0x50dd10[_0x56c6bf](_0xa25f('0x7d'),'%'+_0x40ab78['value']+'%',null);}else{_0x37aae1=_[_0xa25f('0x6d')](_0x19724c,[_0xa25f('0x3a'),_0xa25f('0x7e')]);_0x40ab78[_0xa25f('0x56')]='UserId';_0x73d61e=as['buildExpression'](_0x15073a,_0x37aae1[_0xa25f('0x46')],_0x40ab78);_0x50dd10[_0x56c6bf](_0x73d61e[_0xa25f('0x7a')],_0x73d61e[_0xa25f('0x6f')][_0xa25f('0x7f')],_0x73d61e[_0xa25f('0x6f')][_0xa25f('0x2e')]);}break;case _0xa25f('0x80'):_0x73d61e=as['buildExpression']('me',null,_0x40ab78);_0x50dd10[_0x56c6bf](_0x73d61e['text'],_0x73d61e[_0xa25f('0x6f')]['start'],_0x73d61e[_0xa25f('0x6f')][_0xa25f('0x2e')]);break;}}else{var _0x73d61e=as[_0xa25f('0x79')](_0x15073a,_0x37aae1[_0xa25f('0x46')],_0x40ab78);_0x50dd10[_0x56c6bf](_0x73d61e[_0xa25f('0x7a')],_0x73d61e[_0xa25f('0x6f')]['start'],_0x73d61e[_0xa25f('0x6f')]['end']);}}}else{var _0x44de55=_(_0x36afe4[_0xa25f('0x49')])[_0xa25f('0x48')]()[_0xa25f('0x3d')](function(_0x34dd3d){return _[_0xa25f('0x81')](_0x19724c,[_0xa25f('0x3a'),_0x34dd3d])?_0x34dd3d:undefined;})[_0xa25f('0x82')]()[_0xa25f('0x6f')]();if(!_[_0xa25f('0x83')](_0x44de55)){_0x44de55[_0xa25f('0x40')](function(_0x1023e9){if(_0x1023e9===_0xa25f('0x84')){_0x34cb3b[_0xa25f('0x53')](_0xa25f('0x85'),[][_0xa25f('0x86')](_0x36afe4[_0xa25f('0x49')][_0x1023e9]));}else if(_0x1023e9===_0xa25f('0x87')){var _0xe32668=JSON[_0xa25f('0x88')](_0x36afe4['query'][_0x1023e9])[_0xa25f('0x89')];var _0x5c8c87=JSON[_0xa25f('0x88')](_0x36afe4[_0xa25f('0x49')][_0x1023e9])[_0xa25f('0x8a')];_0x34cb3b[_0xa25f('0x53')](_0xa25f('0x8b'),_0xe32668,_0x5c8c87);}else{if(_0x36afe4[_0xa25f('0x49')][_0x1023e9]===_0xa25f('0x8c')){_0x34cb3b['where']('i.'+_0x1023e9+_0xa25f('0x8d'));}else{_0x34cb3b[_0xa25f('0x53')]('i.'+_0x1023e9+_0xa25f('0x8e'),_0x36afe4[_0xa25f('0x49')][_0x1023e9]);}}});}if(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x8f')]){if(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x8f')]==0x1){_0x34cb3b[_0xa25f('0x70')](_0xa25f('0x90'));}else{_0x34cb3b['having'](_0xa25f('0x91'));}}if(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x92')]){_0x5c7d08=_[_0xa25f('0x93')](_0x36afe4['query'][_0xa25f('0x92')])?_0x36afe4[_0xa25f('0x49')][_0xa25f('0x92')]:new Array(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x92')]);_0x5c7d08[_0xa25f('0x40')](function(_0x4dc03c){_0x19b74a['or'](_0xa25f('0x7b'),'%,'+_0x4dc03c+',%');});}if(_0x36afe4['query'][_0xa25f('0x94')]){var _0x1b2e63=_0x36afe4[_0xa25f('0x49')]['filter'][_0xa25f('0x95')]('\x5c','\x5c\x5c')[_0xa25f('0x95')]('\x27\x27',_0xa25f('0x96'));if(qs[_0xa25f('0x97')](_0x1b2e63)){_0x50dd10['or']('i.id\x20LIKE\x20?',_0x1b2e63+'%');}else{_0x50dd10['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xa25f('0x76')](_0x1b2e63))['or'](_0xa25f('0x98'),_0x1b2e63+'%');}}}_0x34cb3b[_0xa25f('0x53')](_0x50dd10);_0x34cb3b['group'](_0xa25f('0x99'));var _0x299e8c={'type':db['Sequelize'][_0xa25f('0x9a')][_0xa25f('0x9b')],'raw':!![]};var _0x5e1fe2=_0x34cb3b[_0xa25f('0x9c')]();_0x5e1fe2[_0xa25f('0x56')](_0xa25f('0x99'));_0x5e1fe2['field'](_0xa25f('0x9d'),_0xa25f('0x6e'));if(_0x9f2276['order']){_0x9f2276[_0xa25f('0x51')][_0xa25f('0x40')](function(_0x4561b5){_0x34cb3b[_0xa25f('0x51')]('i.'+_0x4561b5[0x0],_0x4561b5[0x1]===_0xa25f('0x9e')?![]:!![]);});}if(!_[_0xa25f('0x83')](_0x5c7d08)){_0x34cb3b[_0xa25f('0x70')](_0x19b74a);_0x5e1fe2['where']('t.id\x20IN\x20?',_0x5c7d08);}BPromise[_0xa25f('0x9f')]()[_0xa25f('0x23')](function(){if(!_0x36d202){if(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x84')]||_0x36afe4[_0xa25f('0x49')]['journey'])return;_0x5e1fe2[_0xa25f('0x53')](_0xa25f('0xa0'));_0x34cb3b['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}return _0x36afe4['user']['getChatWebsites']({'attributes':['id'],'raw':!![]})[_0xa25f('0x23')](function(_0x5d07b0){if(_[_0xa25f('0x83')](_0x5d07b0)){_0x5e1fe2[_0xa25f('0x53')]('i.ChatWebsiteId\x20IS\x20NULL');_0x34cb3b['where'](_0xa25f('0xa1'));}else{_0x5e1fe2[_0xa25f('0x53')](_0xa25f('0x85'),_['map'](_0x5d07b0,'id'));_0x34cb3b[_0xa25f('0x53')](_0xa25f('0x85'),_[_0xa25f('0x3d')](_0x5d07b0,'id'));}});})[_0xa25f('0x23')](function(){db[_0xa25f('0xa2')][_0xa25f('0x49')](_0x5e1fe2['toString'](),_0x299e8c)['then'](function(_0x65d748){_0x37d94d[_0xa25f('0x30')]=_0x65d748[_0xa25f('0x4f')];if(_0x37d94d['count']===0x0)return[];return db[_0xa25f('0xa2')][_0xa25f('0x49')](_0x3057a5[_0xa25f('0xa3')](),_0x299e8c)[_0xa25f('0x23')](function(_0x23b561){_0x37ebf2=_['keyBy'](_0x23b561,'id');_0x299e8c=_[_0xa25f('0xa4')](_0x299e8c,{'model':db['ChatInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x36afe4[_0xa25f('0x49')][_0xa25f('0x4e')]){_0x9f2276[_0xa25f('0x4d')][_0xa25f('0x40')](function(_0x287151){_0x34cb3b[_0xa25f('0x56')]('i.'+_0x287151);});}else{_0x34cb3b[_0xa25f('0x56')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa25f('0x6e'));_0x34cb3b['field'](_0xa25f('0xa5'),_0xa25f('0xa6'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xa7'),_0xa25f('0xa8'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xa9'));_0x34cb3b['field'](_0xa25f('0xaa'),_0xa25f('0xab'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xac'),_0xa25f('0xad'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xae'),_0xa25f('0xaf'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xb0'),'Contact.phone');_0x34cb3b['field'](_0xa25f('0xb1'),_0xa25f('0xb2'));_0x34cb3b[_0xa25f('0x56')]('c.fax',_0xa25f('0xb3'));_0x34cb3b[_0xa25f('0x56')]('o.fullname',_0xa25f('0xb4'));_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xb5'),'Owner.internal');_0x34cb3b[_0xa25f('0x56')](_0xa25f('0xb6'),_0xa25f('0x3e'));}_0x34cb3b[_0xa25f('0x32')](_0x9f2276[_0xa25f('0x32')]);_0x34cb3b[_0xa25f('0x31')](_0x9f2276[_0xa25f('0x31')]);return db['sequelize'][_0xa25f('0x49')](_0x34cb3b[_0xa25f('0xa3')](),_0x299e8c);})[_0xa25f('0x23')](function(_0x1f1a8b){_0x22ab7f['where'](_0xa25f('0xb7'),_[_0xa25f('0x3d')](_0x1f1a8b,'id'));return db['sequelize']['query'](_0x22ab7f['toString'](),_0x299e8c)['then'](function(_0x181617){var _0x2d975a=_['groupBy'](_0x181617,_0xa25f('0xb8'));var _0x2b88b5=[];_0x1f1a8b[_0xa25f('0x40')](function(_0x5bb31e){_0x2b88b5[_0xa25f('0x41')](updateChatInteraction(_0x5bb31e,_0x37ebf2,_0x2d975a));});return BPromise[_0xa25f('0xb9')](_0x2b88b5);});});})[_0xa25f('0x23')](function(_0x36f702){_0x37d94d[_0xa25f('0xba')]=_0x36f702;return _0x37d94d;})[_0xa25f('0x23')](respondWithFilteredResult(_0x559874,_0x9f2276));})['catch'](handleError(_0x559874,null));};exports[_0xa25f('0xbb')]=function(_0x53fd94,_0x45924d){var _0x19a399={'raw':![],'where':{'id':_0x53fd94[_0xa25f('0xbc')]['id']}},_0x269c50={};_0x269c50[_0xa25f('0x4c')]=_[_0xa25f('0x48')](db[_0xa25f('0x43')]['rawAttributes']);_0x269c50[_0xa25f('0x49')]=_[_0xa25f('0x48')](_0x53fd94[_0xa25f('0x49')]);_0x269c50[_0xa25f('0x4a')]=_[_0xa25f('0x4b')](_0x269c50[_0xa25f('0x4c')],_0x269c50[_0xa25f('0x49')]);_0x19a399['attributes']=_[_0xa25f('0x4b')](_0x269c50[_0xa25f('0x4c')],qs[_0xa25f('0x4e')](_0x53fd94[_0xa25f('0x49')][_0xa25f('0x4e')]));_0x19a399[_0xa25f('0x4d')]=_0x19a399['attributes'][_0xa25f('0x4f')]?_0x19a399[_0xa25f('0x4d')]:_0x269c50[_0xa25f('0x4c')];if(_0x53fd94[_0xa25f('0x49')][_0xa25f('0xbd')]){_0x19a399['include']=[{'all':!![]}];}_0x19a399=_[_0xa25f('0xa4')]({},_0x19a399,_0x53fd94[_0xa25f('0xbe')]);return db['ChatInteraction'][_0xa25f('0x6d')](_0x19a399)[_0xa25f('0x23')](handleEntityNotFound(_0x45924d,null))[_0xa25f('0x23')](respondWithResult(_0x45924d,null))[_0xa25f('0xbf')](handleError(_0x45924d,null));};exports[_0xa25f('0xc0')]=function(_0x45a7ae,_0x426693){return db[_0xa25f('0x43')]['create'](_0x45a7ae['body'],{})['then'](respondWithResult(_0x426693,0xc9))[_0xa25f('0xbf')](handleError(_0x426693,null));};exports[_0xa25f('0x38')]=function(_0x120156,_0x585a7c){if(_0x120156[_0xa25f('0x80')]['id']){delete _0x120156[_0xa25f('0x80')]['id'];}return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0x120156[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x585a7c,null))[_0xa25f('0x23')](saveUpdates(_0x120156[_0xa25f('0x80')],null))[_0xa25f('0x23')](respondWithResult(_0x585a7c,null))[_0xa25f('0xbf')](handleError(_0x585a7c,null));};exports[_0xa25f('0xc1')]=function(_0xab44b9,_0x4f83d2){return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0xab44b9[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x4f83d2,null))[_0xa25f('0x23')](removeEntity(_0x4f83d2,null))[_0xa25f('0xbf')](handleError(_0x4f83d2,null));};exports[_0xa25f('0xc2')]=function(_0x8a1f2f,_0x2eaabc){return db['ChatInteraction'][_0xa25f('0xc2')]()[_0xa25f('0x23')](respondWithResult(_0x2eaabc,null))['catch'](handleError(_0x2eaabc,null));};exports[_0xa25f('0xc3')]=function(_0x225b70,_0x3be85f){if(_0x225b70[_0xa25f('0x80')]['id']){delete _0x225b70[_0xa25f('0x80')]['id'];}return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0x225b70[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x3be85f,null))[_0xa25f('0x23')](saveUpdates(_0x225b70['body'],null))[_0xa25f('0x23')](respondWithResult(_0x3be85f,null))[_0xa25f('0xbf')](handleError(_0x3be85f,null));};exports[_0xa25f('0xc4')]=function(_0x1dbb44,_0x41cc3f,_0x5e7f1e){if(_0x1dbb44[_0xa25f('0x80')]['id']){delete _0x1dbb44[_0xa25f('0x80')]['id'];}return db['ChatInteraction'][_0xa25f('0x6d')]({'where':{'id':_0x1dbb44['params']['id']}})[_0xa25f('0x23')](function(_0x122f79){if(!_0x122f79){logger[_0xa25f('0x2a')](_0xa25f('0xc5'),'abandon',0x194,_0xa25f('0xc6'));_0x41cc3f['sendStatus'](0x194);}else{if(_0x122f79[_0xa25f('0x7e')]){throw new db['Sequelize'][(_0xa25f('0x21'))](_0xa25f('0xc7'));}}return _0x122f79;})[_0xa25f('0x23')](function(_0x3ed00e){if(_0x3ed00e){return _0x3ed00e[_0xa25f('0x38')]({'closed':_0x1dbb44[_0xa25f('0x80')][_0xa25f('0xc8')],'disposition':_0x1dbb44['body'][_0xa25f('0xc9')]})[_0xa25f('0x23')](function(_0x14b4f3){return _0x14b4f3;});}})[_0xa25f('0x23')](function(_0x37cf51){return respondWithRpcPromise('AbandonInteraction',_0xa25f('0xc4'),_0x1dbb44['body'],client9004);})[_0xa25f('0x23')](respondWithResult(_0x41cc3f,null))[_0xa25f('0xbf')](handleError(_0x41cc3f,null));};exports[_0xa25f('0xca')]=function(_0x1849ea,_0x253ce8,_0x138f6c){_0x1849ea[_0xa25f('0x80')][_0xa25f('0x3a')]=_0x1849ea[_0xa25f('0xcb')][_0xa25f('0xcc')];_0x1849ea[_0xa25f('0x80')][_0xa25f('0xcd')]=_0x1849ea['file'][_0xa25f('0xce')];_0x1849ea[_0xa25f('0x80')][_0xa25f('0x46')]=_0x1849ea['file'][_0xa25f('0xcf')];return db[_0xa25f('0xd0')]['create'](_0x1849ea[_0xa25f('0x80')])[_0xa25f('0x23')](respondWithResult(_0x253ce8,0xc9))[_0xa25f('0xbf')](handleError(_0x253ce8,null));};exports['attachmentDownload']=function(_0x31be73,_0x47228a,_0x23ca04){return db[_0xa25f('0x43')]['findOne']({'where':{'id':_0x31be73['params']['id']},'raw':!![]})[_0xa25f('0x23')](handleEntityNotFound(_0x47228a,null))['then'](function(_0x4ae936){if(_0x4ae936){if(_0x4ae936[_0xa25f('0xc8')]){return _0x47228a[_0xa25f('0x2f')](0x193)['json']({'status':0x193,'message':_0xa25f('0xd1')});}return db[_0xa25f('0xd0')][_0xa25f('0xd2')]({'where':{'id':_0x31be73['query']['attachId']},'raw':!![]})[_0xa25f('0x23')](handleEntityNotFound(_0x47228a,null));}})[_0xa25f('0x23')](function(_0x6ba1cc){if(_0x6ba1cc){return _0x47228a[_0xa25f('0xd3')](path[_0xa25f('0xd4')](config['root'],'server/files/attachments/',_0x6ba1cc['basename']));}})[_0xa25f('0xbf')](handleError(_0x47228a,null));};exports[_0xa25f('0xd5')]=function(_0x5e910d,_0x26bf41){var _0x3fa53f=null;var _0x4c388a=null;var _0x40ac08=null;var _0x5a8258=null;if(_0x5e910d['body']['id']){delete _0x5e910d[_0xa25f('0x80')]['id'];}if(_0x5e910d[_0xa25f('0x80')]['mailTranscript']){_0x5a8258=path[_0xa25f('0xd4')](config[_0xa25f('0xd6')],'server/files/chat/upload/',util[_0xa25f('0xd7')](_0xa25f('0xd8'),Date['now']()));_0x5e910d[_0xa25f('0x80')][_0xa25f('0xd9')]=_0x5a8258;}return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0x5e910d[_0xa25f('0xbc')]['id']},'include':[{'model':db[_0xa25f('0xda')],'as':_0xa25f('0xdb'),'include':[{'model':db[_0xa25f('0xdc')],'as':_0xa25f('0xdc')}]}]})[_0xa25f('0x23')](handleEntityNotFound(_0x26bf41,null))[_0xa25f('0x23')](saveUpdates(_0x5e910d[_0xa25f('0x80')],null))[_0xa25f('0x23')](function(_0x228c6a){if(_0x228c6a){_0x3fa53f=_0x228c6a;return db[_0xa25f('0xdd')][_0xa25f('0x6d')]({'where':{'id':_0x3fa53f[_0xa25f('0x84')]}});}})[_0xa25f('0x23')](function(_0x12ef8b){if(_0x12ef8b){_0x40ac08=_0x12ef8b;return db[_0xa25f('0xde')]['find']({'where':{'id':_0x3fa53f['ContactId']}});}})[_0xa25f('0x23')](function(_0x4c34f0){if(_0x4c34f0){_0x4c388a=_0x4c34f0;if(_0x5a8258){var _0x4eeb5d=null;for(var _0x5257ae=0x1;_0x5257ae<_0x3fa53f[_0xa25f('0xdb')]['length'];++_0x5257ae){_0x4eeb5d=_0x3fa53f[_0xa25f('0xdb')][_0x5257ae];var _0x5009cd=_0x4eeb5d[_0xa25f('0x7e')]?util[_0xa25f('0xd7')]('%s%d',_0x40ac08[_0xa25f('0xdf')],_0x4eeb5d['UserId']):_0xa25f('0xe0');var _0x4243e0=_0x5e910d[_0xa25f('0x80')][_0xa25f('0xe1')]||util[_0xa25f('0xd7')](_0xa25f('0xe2'),'Visitor',_0x4eeb5d[_0xa25f('0x78')]);switch(_0x40ac08[_0xa25f('0xe3')]){case'website_alias':_0x5009cd=_0x4eeb5d['UserId']?util[_0xa25f('0xd7')](_0xa25f('0xe2'),_0x40ac08[_0xa25f('0xdf')],_0x4eeb5d[_0xa25f('0x7e')]):_0xa25f('0xe0');break;case _0xa25f('0xe4'):_0x5009cd=_0x4eeb5d[_0xa25f('0x7e')]?_0x4eeb5d[_0xa25f('0xdc')]['alias']||_0x4eeb5d['User'][_0xa25f('0xe5')]:_0xa25f('0xe0');break;case _0xa25f('0xe6'):_0x5009cd=_0x4eeb5d[_0xa25f('0x7e')]?_0x4eeb5d[_0xa25f('0xdc')][_0xa25f('0xe5')]:_0xa25f('0xe0');break;default:_0x5009cd=_0x4eeb5d[_0xa25f('0x7e')]?util[_0xa25f('0xd7')](_0xa25f('0xe2'),_0x40ac08[_0xa25f('0xdf')],_0x4eeb5d[_0xa25f('0x7e')]):_0xa25f('0xe0');}var _0xa41acd=util[_0xa25f('0xd7')](_0xa25f('0xe7'),moment(_0x4eeb5d[_0xa25f('0x87')])['format']('MM/DD/YYYY\x20HH:mm:ss'),_0x4eeb5d['direction']==='in'?_0x4243e0:_0x5009cd,_0x4eeb5d[_0xa25f('0x80')]);if(!_0x4eeb5d[_0xa25f('0xe8')]){fs['appendFileSync'](_0x5a8258,_0xa41acd);}}return db[_0xa25f('0xe9')][_0xa25f('0xd2')]({'where':{'service':!![]},'include':[{'model':db[_0xa25f('0xea')],'as':_0xa25f('0xeb'),'raw':!![]}]});}}})['then'](function(_0x3080a0){if(_0x3080a0&&_0x3080a0[_0xa25f('0xeb')]&&_0x5e910d[_0xa25f('0x80')]){var _0x4d9215={'tls':{'rejectUnauthorized':![]}};if(_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xec')]){_0x4d9215[_0xa25f('0xec')]=_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xec')];}else{_0x4d9215[_0xa25f('0xed')]=_0x3080a0[_0xa25f('0xeb')]['host'];_0x4d9215[_0xa25f('0xee')]=_0x3080a0[_0xa25f('0xeb')]['port'];_0x4d9215[_0xa25f('0xef')]=_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xef')];}if(_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xf0')]){_0x4d9215[_0xa25f('0xf1')]={'user':_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xf2')],'pass':_0x3080a0[_0xa25f('0xeb')][_0xa25f('0xf3')]};}return respondWithRpcPromise(_0xa25f('0xf4'),_0xa25f('0xf5'),{'account':_0x4d9215,'message':{'from':util['format']('\x22%s\x22\x20<%s>',_0x3080a0[_0xa25f('0x3a')],_0x3080a0[_0xa25f('0xf6')]||_0x3080a0['Smtp']['user']),'to':_0x5e910d[_0xa25f('0x80')]['mailTranscript'],'subject':_0xa25f('0xf7'),'text':util[_0xa25f('0xd7')](_0xa25f('0xf8'),_0x5e910d[_0xa25f('0x80')]['mailTranscript']),'attachments':[{'path':_0x5a8258}]}})[_0xa25f('0x23')](function(){return _0x3fa53f;})[_0xa25f('0xbf')](function(_0x472698){console[_0xa25f('0x2a')](_0x472698);});}else{return _0x3fa53f;}})[_0xa25f('0x23')](respondWithStatusCode(_0x26bf41,0xc8))[_0xa25f('0xbf')](handleError(_0x26bf41,null));};exports[_0xa25f('0xf9')]=function(_0x4c28a4,_0x21eacb,_0x29779c){return db[_0xa25f('0xda')][_0xa25f('0x6d')]({'where':{'id':_0x4c28a4[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x21eacb,null))[_0xa25f('0x23')](function(_0x16eb64){if(_0x16eb64){return _0x16eb64['addMessage'](_0x4c28a4[_0xa25f('0x80')][_0xa25f('0xfa')],_[_0xa25f('0xfb')](_0x4c28a4[_0xa25f('0x80')],[_0xa25f('0xfa'),'id'])||{});}})['then'](respondWithResult(_0x21eacb,null))[_0xa25f('0xbf')](handleError(_0x21eacb,null));};exports[_0xa25f('0xfc')]=function(_0x5a64da,_0x33fcbe,_0x10993a){var _0xa489ca={'raw':![],'where':{}};var _0x1ed641={};var _0x30d7cc={'count':0x0,'rows':[]};return db[_0xa25f('0x43')][_0xa25f('0xd2')]({'where':{'id':_0x5a64da['params']['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x33fcbe,null))[_0xa25f('0x23')](function(_0x3f239d){if(_0x3f239d){_0x1ed641['model']=_[_0xa25f('0x48')](db[_0xa25f('0xda')][_0xa25f('0x44')]);_0x1ed641[_0xa25f('0x49')]=_[_0xa25f('0x48')](_0x5a64da[_0xa25f('0x49')]);_0x1ed641[_0xa25f('0x4a')]=_[_0xa25f('0x4b')](_0x1ed641[_0xa25f('0x4c')],_0x1ed641['query']);_0xa489ca[_0xa25f('0x4d')]=_[_0xa25f('0x4b')](_0x1ed641[_0xa25f('0x4c')],qs[_0xa25f('0x4e')](_0x5a64da[_0xa25f('0x49')]['fields']));_0xa489ca['attributes']=_0xa489ca['attributes'][_0xa25f('0x4f')]?_0xa489ca[_0xa25f('0x4d')]:_0x1ed641[_0xa25f('0x4c')];if(!_0x5a64da[_0xa25f('0x49')][_0xa25f('0xfd')](_0xa25f('0x50'))){_0xa489ca[_0xa25f('0x32')]=qs[_0xa25f('0x32')](_0x5a64da[_0xa25f('0x49')][_0xa25f('0x32')]);_0xa489ca[_0xa25f('0x31')]=qs[_0xa25f('0x31')](_0x5a64da['query'][_0xa25f('0x31')]);}_0xa489ca['order']=qs['sort'](_0x5a64da[_0xa25f('0x49')]['sort']);_0xa489ca['where']=qs[_0xa25f('0x4a')](_[_0xa25f('0x54')](_0x5a64da[_0xa25f('0x49')],_0x1ed641[_0xa25f('0x4a')]));_0xa489ca[_0xa25f('0x53')][_0xa25f('0xb8')]=_0x3f239d['id'];if(_0x5a64da[_0xa25f('0x49')]['filter']){_0xa489ca['where']=_[_0xa25f('0xa4')](_0xa489ca[_0xa25f('0x53')],{'$or':_[_0xa25f('0x3d')](_0xa489ca['attributes'],function(_0x9d43ce){var _0x461bbe={};_0x461bbe[_0x9d43ce]={'$like':'%'+_0x5a64da[_0xa25f('0x49')][_0xa25f('0x94')]+'%'};return _0x461bbe;})});}if(_0x5a64da[_0xa25f('0x49')][_0xa25f('0x89')]){var _0x1006bd=_0x5a64da['query']['$gte'][_0xa25f('0x74')](',');var _0x750e9e={};_0x750e9e[_0x1006bd[0x0]]={'$gte':moment(_0x1006bd[0x1])[_0xa25f('0xd7')](_0xa25f('0xfe'))};_0xa489ca[_0xa25f('0x53')]=_[_0xa25f('0xa4')](_0xa489ca['where'],_0x750e9e);}_0xa489ca=_['merge']({},_0xa489ca,_0x5a64da[_0xa25f('0xbe')]);return db[_0xa25f('0xda')][_0xa25f('0x30')]({'where':_0xa489ca[_0xa25f('0x53')]})['then'](function(_0x166b26){_0x30d7cc['count']=_0x166b26;if(_0x5a64da['query']['includeAll']){_0xa489ca[_0xa25f('0xff')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0xa489ca);})['then'](function(_0x121da3){_0x30d7cc[_0xa25f('0xba')]=_0x121da3;return _0x30d7cc;});}})['then'](respondWithFilteredResult(_0x33fcbe,_0xa489ca))[_0xa25f('0xbf')](handleError(_0x33fcbe,null));};exports[_0xa25f('0x100')]=function(_0xcabf2e,_0x39711b,_0x3512e5){var _0x14c03b={'where':{}},_0x1988bb={},_0x1b9b9a={'count':0x0,'rows':[]};return db[_0xa25f('0x43')][_0xa25f('0xd2')]({'where':{'id':_0xcabf2e['params']['id']}})['then'](handleEntityNotFound(_0x39711b,null))[_0xa25f('0x23')](function(_0x107c84){if(_0x107c84){_0x1988bb[_0xa25f('0x4c')]=_['keys'](db[_0xa25f('0xda')][_0xa25f('0x44')]);_0x1988bb[_0xa25f('0x49')]=_[_0xa25f('0x48')](_0xcabf2e['query']);_0x1988bb[_0xa25f('0x4a')]=_['intersection'](_0x1988bb[_0xa25f('0x4c')],_0x1988bb[_0xa25f('0x49')]);_0x14c03b['attributes']=_[_0xa25f('0x4b')](_0x1988bb[_0xa25f('0x4c')],qs[_0xa25f('0x4e')](_0xcabf2e[_0xa25f('0x49')][_0xa25f('0x4e')]));_0x14c03b[_0xa25f('0x4d')]=_0x14c03b[_0xa25f('0x4d')][_0xa25f('0x4f')]?_0x14c03b[_0xa25f('0x4d')]:_0x1988bb[_0xa25f('0x4c')];if(!_0xcabf2e[_0xa25f('0x49')][_0xa25f('0xfd')](_0xa25f('0x50'))){_0x14c03b[_0xa25f('0x32')]=qs[_0xa25f('0x32')](_0xcabf2e[_0xa25f('0x49')][_0xa25f('0x32')]);_0x14c03b[_0xa25f('0x31')]=qs['offset'](_0xcabf2e[_0xa25f('0x49')]['offset']);}_0x14c03b[_0xa25f('0x51')]=qs['sort'](_0xcabf2e['query'][_0xa25f('0x52')]);_0x14c03b[_0xa25f('0x53')]=qs['filters'](_['pick'](_0xcabf2e[_0xa25f('0x49')],_0x1988bb[_0xa25f('0x4a')]));_0x14c03b[_0xa25f('0x53')][_0xa25f('0xb8')]=_0x107c84['id'];if(_0xcabf2e['query'][_0xa25f('0x94')]){_0x14c03b[_0xa25f('0x53')]=_['merge'](_0x14c03b[_0xa25f('0x53')],{'$or':_['map'](_0x14c03b[_0xa25f('0x4d')],function(_0x4de4aa){var _0x4f945a={};_0x4f945a[_0x4de4aa]={'$like':'%'+_0xcabf2e[_0xa25f('0x49')][_0xa25f('0x94')]+'%'};return _0x4f945a;})});}_0x14c03b[_0xa25f('0x53')][_0xa25f('0xe8')]=![];if(_0xcabf2e[_0xa25f('0x49')]['id']){_0x14c03b['where']['id']={'$gt':_0xcabf2e[_0xa25f('0x49')]['id']};}_0x14c03b=_['merge']({},_0x14c03b,_0xcabf2e[_0xa25f('0xbe')]);return db[_0xa25f('0xda')][_0xa25f('0x30')]({'where':_0x14c03b[_0xa25f('0x53')]})['then'](function(_0x217642){_0x1b9b9a['count']=_0x217642;_0x14c03b[_0xa25f('0xff')]=[];if(_0xcabf2e['query'][_0xa25f('0x101')]){_0x14c03b[_0xa25f('0xff')]['push']({'model':db['User'],'as':_0xa25f('0xdc'),'attributes':['id',_0xa25f('0xe5'),_0xa25f('0x102')]});}if(_0xcabf2e[_0xa25f('0x49')]['includeAll']){_0x14c03b[_0xa25f('0xff')]=[{'all':!![]}];}return db['ChatMessage'][_0xa25f('0x103')](_0x14c03b);})['then'](function(_0xdb4e26){_0x1b9b9a[_0xa25f('0xba')]=_0xdb4e26;return _0x1b9b9a;});}})['then'](respondWithFilteredResult(_0x39711b,_0x14c03b))[_0xa25f('0xbf')](handleError(_0x39711b,null));};exports[_0xa25f('0x104')]=function(_0x96e5d8,_0x19928a,_0x8c84d3){return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0x96e5d8[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x19928a,null))[_0xa25f('0x23')](function(_0xf37871){if(_0xf37871){return _0xf37871[_0xa25f('0x105')](_0x96e5d8[_0xa25f('0x80')][_0xa25f('0xfa')],_[_0xa25f('0xfb')](_0x96e5d8['body'],[_0xa25f('0xfa'),'id'])||{})[_0xa25f('0x106')](function(){return db['Tag'][_0xa25f('0x103')]({'attributes':['id','name',_0xa25f('0x57')],'where':{'id':_0x96e5d8[_0xa25f('0x80')][_0xa25f('0xfa')]}});})['then'](function(_0x5e2ab2){socket[_0xa25f('0x107')](_0xa25f('0x108'),{'id':Number(_0x96e5d8['params']['id']),'tags':_0x5e2ab2||[]});return{'id':Number(_0x96e5d8[_0xa25f('0xbc')]['id']),'tags':_0x5e2ab2||[]};});}})['then'](respondWithResult(_0x19928a,null))[_0xa25f('0xbf')](handleError(_0x19928a,null));};exports[_0xa25f('0x109')]=function(_0x1254d0,_0x5c42c5,_0x76b84){return db[_0xa25f('0x43')][_0xa25f('0x6d')]({'where':{'id':_0x1254d0[_0xa25f('0xbc')]['id']}})[_0xa25f('0x23')](handleEntityNotFound(_0x5c42c5,null))[_0xa25f('0x23')](function(_0x1e6eb4){if(_0x1e6eb4){return _0x1e6eb4[_0xa25f('0x109')](_0x1254d0['query']['ids']);}})[_0xa25f('0x23')](respondWithStatusCode(_0x5c42c5,null))[_0xa25f('0xbf')](handleError(_0x5c42c5,null));};exports[_0xa25f('0xd3')]=function(_0x19f6b2,_0x96648d){var _0x2c7359=moment()[_0xa25f('0x10a')]()[_0xa25f('0xa3')]();var _0x226a28=path[_0xa25f('0xd4')](config['root'],_0xa25f('0x10b'),'files',_0xa25f('0x10c'));var _0x46a2be=path[_0xa25f('0xd4')](config['root'],_0xa25f('0x10b'),_0xa25f('0x10d'),_0xa25f('0x10e'));var _0x41fc1d=path[_0xa25f('0xd4')](_0x226a28,_0x2c7359);var _0x9547cf=util[_0xa25f('0xd7')](_0xa25f('0x10f'),_0x19f6b2[_0xa25f('0xbc')]['id'],_0x2c7359);var _0xc6d3fd=path[_0xa25f('0xd4')](_0x226a28,_0x9547cf);var _0x3799dc=[];_0x3799dc[_0xa25f('0x41')]({'model':db[_0xa25f('0xdc')],'as':_0xa25f('0xdc'),'attributes':['id','fullname'],'raw':!![]});_0x3799dc[_0xa25f('0x41')]({'model':db[_0xa25f('0xde')],'as':'Contact','attributes':['id','firstName',_0xa25f('0x110')],'raw':!![]});if(_0x19f6b2['query'][_0xa25f('0x10e')]){_0x3799dc['push']({'model':db['Attachment'],'as':_0xa25f('0xd0'),'raw':!![]});}var _0xeb16af=[{'model':db[_0xa25f('0xda')],'as':'Messages','attributes':['id',_0xa25f('0x80'),_0xa25f('0x87'),_0xa25f('0x111'),_0xa25f('0xe8'),_0xa25f('0x8f')],'include':_0x3799dc}];_0xeb16af[_0xa25f('0x41')]({'model':db['ChatWebsite'],'as':_0xa25f('0x112'),'attributes':['id',_0xa25f('0x3a')]});_0xeb16af[_0xa25f('0x41')]({'model':db[_0xa25f('0xdc')],'as':'Owner','attributes':['id',_0xa25f('0xe5')]});return db[_0xa25f('0x43')]['find']({'where':{'id':_0x19f6b2['params']['id']},'include':_0xeb16af})[_0xa25f('0x23')](handleEntityNotFound(_0x96648d,null))['then'](function(_0x191004){if(_0x191004){var _0x10c910=_0x191004[_0xa25f('0x113')]({'plain':!![]});fs['mkdirSync'](_0x41fc1d);var _0x14f32a={'format':'A4','border':'10px','header':{'height':_0xa25f('0x114'),'contents':{'first':_0xa25f('0x115')}},'footer':{'height':_0xa25f('0x116'),'contents':{'default':util['format'](_0xa25f('0x117'),util[_0xa25f('0xd7')](_0xa25f('0x118'),_0xa25f('0x119'),_0x10c910['id']),moment()['format'](_0xa25f('0x11a'))['toString']())}}};var _0x3f29e4={'channel':_0xa25f('0x119'),'account':_0x10c910[_0xa25f('0x112')]['name'],'agent':_0x10c910[_0xa25f('0x11b')]?_0x10c910[_0xa25f('0x11b')][_0xa25f('0xe5')]:'N.A.','createdAt':moment(_0x10c910[_0xa25f('0x87')])[_0xa25f('0xd7')]('YYYY-MM-DD\x20HH:mm:ss')[_0xa25f('0xa3')](),'closedAt':_0x10c910[_0xa25f('0xc8')]?moment(_0x10c910[_0xa25f('0x11c')])[_0xa25f('0xd7')](_0xa25f('0xfe'))[_0xa25f('0xa3')]():'','disposition':_0x10c910[_0xa25f('0xc9')],'chatInfo':{'browser':_0x10c910[_0xa25f('0x11d')],'os':_0x10c910[_0xa25f('0x11e')],'referer':_0x10c910[_0xa25f('0x11f')],'customerIp':_0x10c910[_0xa25f('0x120')],'customerPort':_0x10c910[_0xa25f('0x121')]?_0x10c910[_0xa25f('0x121')]:_0xa25f('0x122')},'messages':_(_0x10c910[_0xa25f('0xdb')])[_0xa25f('0x123')]()[_0xa25f('0x94')]({'secret':![]})[_0xa25f('0x3d')](function(_0x2f3650){if(_0x2f3650[_0xa25f('0xd0')]){var _0x1a3d5d=path[_0xa25f('0xd4')](_0x46a2be,_0x2f3650[_0xa25f('0xd0')][_0xa25f('0xcd')]);if(fs[_0xa25f('0x124')](_0x1a3d5d)){fs[_0xa25f('0x125')](_0x1a3d5d)[_0xa25f('0x126')](fs[_0xa25f('0x127')](path[_0xa25f('0xd4')](_0x41fc1d,_0x2f3650[_0xa25f('0xd0')][_0xa25f('0xcd')])));}}return{'date':moment(_0x2f3650[_0xa25f('0x87')])[_0xa25f('0xd7')](_0xa25f('0xfe'))[_0xa25f('0xa3')](),'sender':_0x2f3650['direction']===_0xa25f('0x128')?_0x2f3650[_0xa25f('0xdc')]?_0x2f3650[_0xa25f('0xdc')][_0xa25f('0xe5')]:_0xa25f('0xe0'):_0x2f3650[_0xa25f('0x129')][_0xa25f('0x12a')]+(_0x2f3650[_0xa25f('0x129')][_0xa25f('0x110')]?'\x20'+_0x2f3650[_0xa25f('0x129')][_0xa25f('0x110')]:''),'body':_0x2f3650['Attachment']?_0x2f3650['Attachment'][_0xa25f('0xcd')]:_0x2f3650['body'],'direction':_0x2f3650[_0xa25f('0x111')]===_0xa25f('0x128')?'A':'C','secret':_0x2f3650[_0xa25f('0xe8')],'read':_0x2f3650[_0xa25f('0x8f')],'attachment':_0x2f3650['Attachment']};})['value']()};return ejs[_0xa25f('0x12b')](path[_0xa25f('0xd4')](config['root'],'server',_0xa25f('0x12c'),_0xa25f('0x12d')),{'interaction':_0x3f29e4})[_0xa25f('0x23')](function(_0x424cca){return new BPromise(function(_0x405909,_0x2e9d8){pdf[_0xa25f('0xc0')](_0x424cca,_0x14f32a)[_0xa25f('0x12e')](path[_0xa25f('0xd4')](_0x41fc1d,'transcript-'+_0x10c910['id']+'-'+_0x2c7359+_0xa25f('0x12f')),function(_0x4e544a,_0x21e921){if(_0x4e544a)return _0x2e9d8(_0x4e544a);_0x405909(_0x21e921);});});})[_0xa25f('0x23')](function(){return new BPromise(function(_0x293b5d,_0x10f89a){zipdir(_0x41fc1d,{'saveTo':_0xc6d3fd},function(_0x1d8e74,_0x5f246d){if(_0x1d8e74)return _0x10f89a(_0x1d8e74);return _0x293b5d(_0x5f246d);});})['then'](function(){return new BPromise(function(_0xf669d5,_0x530bd5){rimraf(_0x41fc1d,function(_0x34e62a){if(_0x34e62a)_0x530bd5(_0x34e62a);return _0xf669d5();});});})[_0xa25f('0x23')](function(){return _0x96648d['download'](_0xc6d3fd,_0x9547cf,function(_0x1f4c57){if(_0x1f4c57){console[_0xa25f('0x130')]('err',_0x1f4c57);}else{fs[_0xa25f('0x131')](_0xc6d3fd);}});});});}else{return _0x96648d[_0xa25f('0x2d')](0xc8);}})[_0xa25f('0xbf')](handleError(_0x96648d,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 6056492..be0f53c 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 _0xdcde=['events','../../mysqldb','ChatMessage','setMaxListeners','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports'];(function(_0x55c3e8,_0x579784){var _0x251e1c=function(_0x482032){while(--_0x482032){_0x55c3e8['push'](_0x55c3e8['shift']());}};_0x251e1c(++_0x579784);}(_0xdcde,0x1d0));var _0xedcd=function(_0xbc6fc0,_0x135ebf){_0xbc6fc0=_0xbc6fc0-0x0;var _0x254b84=_0xdcde[_0xbc6fc0];return _0x254b84;};'use strict';var EventEmitter=require(_0xedcd('0x0'));var ChatInteraction=require(_0xedcd('0x1'))['db']['ChatInteraction'];var ChatMessage=require(_0xedcd('0x1'))['db'][_0xedcd('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xedcd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc9e22d){return function(_0x314f23,_0xc47415,_0x58cda1){_0x314f23[_0xedcd('0x4')]({'attributes':['id'],'raw':!![]})[_0xedcd('0x5')](function(_0x106aaa){_0x314f23[_0xedcd('0x6')]('Users',_0x106aaa[_0xedcd('0x7')](function(_0x2ce75a){return{'id':_0x2ce75a['id']};}));return ChatMessage[_0xedcd('0x8')]({'where':{'ChatInteractionId':_0x314f23['id'],'direction':'in','read':![]},'raw':!![]});})[_0xedcd('0x5')](function(_0x94fdc8){_0x314f23[_0xedcd('0x6')](_0xedcd('0x9'),_0x94fdc8[_0xedcd('0xa')]);ChatInteractionEvents[_0xedcd('0xb')](_0xc9e22d+':'+_0x314f23['id'],_0x314f23);ChatInteractionEvents[_0xedcd('0xb')](_0xc9e22d,_0x314f23);_0x58cda1(null);})[_0xedcd('0xc')](_0x58cda1(null));};}for(var e in events){if(events[_0xedcd('0xd')](e)){var event=events[e];ChatInteraction[_0xedcd('0xe')](e,emitEvent(event));}}module[_0xedcd('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0x4dcb=['remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','save','update'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4dcb,0x186));var _0xb4dc=function(_0x38596a,_0xfca7c8){_0x38596a=_0x38596a-0x0;var _0x254154=_0x4dcb[_0x38596a];return _0x254154;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xb4dc('0x0'))['db'][_0xb4dc('0x1')];var ChatMessage=require(_0xb4dc('0x0'))['db'][_0xb4dc('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xb4dc('0x3')](0x0);var events={'afterCreate':_0xb4dc('0x4'),'afterUpdate':_0xb4dc('0x5'),'afterDestroy':_0xb4dc('0x6')};function emitEvent(_0x161991){return function(_0x56a262,_0x5c031c,_0x244be0){_0x56a262['getUsers']({'attributes':['id'],'raw':!![]})[_0xb4dc('0x7')](function(_0x14790e){_0x56a262[_0xb4dc('0x8')](_0xb4dc('0x9'),_0x14790e[_0xb4dc('0xa')](function(_0x168305){return{'id':_0x168305['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x56a262['id'],'direction':'in','read':![]},'raw':!![]});})[_0xb4dc('0x7')](function(_0x43e354){_0x56a262[_0xb4dc('0x8')](_0xb4dc('0xb'),_0x43e354[_0xb4dc('0xc')]);ChatInteractionEvents[_0xb4dc('0xd')](_0x161991+':'+_0x56a262['id'],_0x56a262);ChatInteractionEvents[_0xb4dc('0xd')](_0x161991,_0x56a262);_0x244be0(null);})[_0xb4dc('0xe')](_0x244be0(null));};}for(var e in events){if(events[_0xb4dc('0xf')](e)){var event=events[e];ChatInteraction[_0xb4dc('0x10')](e,emitEvent(event));}}module[_0xb4dc('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 1455df1..32b68cb 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 _0x0f7a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatInteraction.attributes','ChatInteraction','changed','closed','utf8mb4_unicode_ci'];(function(_0x2dbf71,_0x2d1284){var _0x744fbd=function(_0x21ead7){while(--_0x21ead7){_0x2dbf71['push'](_0x2dbf71['shift']());}};_0x744fbd(++_0x2d1284);}(_0x0f7a,0xfc));var _0xa0f7=function(_0xffd8b0,_0x12c51f){_0xffd8b0=_0xffd8b0-0x0;var _0x301ba0=_0x0f7a[_0xffd8b0];return _0x301ba0;};'use strict';var _=require(_0xa0f7('0x0'));var util=require(_0xa0f7('0x1'));var logger=require(_0xa0f7('0x2'))(_0xa0f7('0x3'));var moment=require(_0xa0f7('0x4'));var BPromise=require(_0xa0f7('0x5'));var rp=require(_0xa0f7('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xa0f7('0x7'));module['exports']=function(_0x4c8082,_0x503db0){return _0x4c8082['define'](_0xa0f7('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46b4a5,_0xf3c95a,_0x2319fc){if(_0x46b4a5[_0xa0f7('0x9')](_0xa0f7('0xa'))){_0x46b4a5['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2319fc(null,_0x46b4a5);}},'charset':'utf8mb4','collate':_0xa0f7('0xb')});}; \ No newline at end of file +var _0x5bcd=['./chatInteraction.attributes','define','chat_interactions','closed','format','utf8mb4','utf8mb4_unicode_ci','util','api','bluebird','rimraf','../../config/environment'];(function(_0x4af07b,_0x24429d){var _0x59ae3f=function(_0xf1bdec){while(--_0xf1bdec){_0x4af07b['push'](_0x4af07b['shift']());}};_0x59ae3f(++_0x24429d);}(_0x5bcd,0x1c3));var _0xd5bc=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x5bcd[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0xd5bc('0x0'));var logger=require('../../config/logger')(_0xd5bc('0x1'));var moment=require('moment');var BPromise=require(_0xd5bc('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd5bc('0x3'));var config=require(_0xd5bc('0x4'));var attributes=require(_0xd5bc('0x5'));module['exports']=function(_0x2843c2,_0x3ec55e){return _0x2843c2[_0xd5bc('0x6')]('ChatInteraction',attributes,{'tableName':_0xd5bc('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x5a7703,_0x4cf005,_0x10b82c){if(_0x5a7703['changed'](_0xd5bc('0x8'))){_0x5a7703['closedAt']=moment()[_0xd5bc('0x9')]('YYYY-MM-DD\x20HH:mm:ss');}_0x10b82c(null,_0x5a7703);}},'charset':_0xd5bc('0xa'),'collate':_0xd5bc('0xb')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index aa76f8b..4c9131b 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 _0x2d04=['message','result','catch','UpdateChatInteraction','options','raw','where','limit','then','stringify','AddTagsToChatInteraction','ChatInteraction','addTags','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','info','ChatInteraction,\x20%s,\x20%s','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x2d04,0x1a1));var _0x42d0=function(_0x10c6b9,_0x462e4f){_0x10c6b9=_0x10c6b9-0x0;var _0x1e5c55=_0x2d04[_0x10c6b9];return _0x1e5c55;};'use strict';var _=require(_0x42d0('0x0'));var util=require(_0x42d0('0x1'));var moment=require(_0x42d0('0x2'));var BPromise=require(_0x42d0('0x3'));var rs=require(_0x42d0('0x4'));var fs=require('fs');var Redis=require(_0x42d0('0x5'));var db=require(_0x42d0('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x42d0('0x7'));var config=require(_0x42d0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x42d0('0x9')][_0x42d0('0xa')]({'port':0x232a});config[_0x42d0('0xb')]=_[_0x42d0('0xc')](config[_0x42d0('0xb')],{'host':_0x42d0('0xd'),'port':0x18eb});var socket=require(_0x42d0('0xe'))(new Redis(config[_0x42d0('0xb')]));require(_0x42d0('0xf'))['register'](socket);function respondWithRpcPromise(_0x2cfd26,_0x245056,_0x2b970a){return new BPromise(function(_0x258339,_0x1ea13c){return client['request'](_0x2cfd26,_0x2b970a)['then'](function(_0x2b11b9){logger[_0x42d0('0x10')](_0x42d0('0x11'),_0x245056,'request\x20sent');logger[_0x42d0('0x12')](_0x42d0('0x13'),_0x245056,_0x42d0('0x14'),JSON['stringify'](_0x2b11b9));if(_0x2b11b9[_0x42d0('0x15')]){if(_0x2b11b9['error'][_0x42d0('0x16')]===0x1f4){logger[_0x42d0('0x15')](_0x42d0('0x11'),_0x245056,_0x2b11b9[_0x42d0('0x15')][_0x42d0('0x17')]);return _0x1ea13c(_0x2b11b9[_0x42d0('0x15')][_0x42d0('0x17')]);}logger['error'](_0x42d0('0x11'),_0x245056,_0x2b11b9['error'][_0x42d0('0x17')]);return _0x258339(_0x2b11b9[_0x42d0('0x15')][_0x42d0('0x17')]);}else{logger[_0x42d0('0x10')](_0x42d0('0x11'),_0x245056,'request\x20sent');_0x258339(_0x2b11b9[_0x42d0('0x18')][_0x42d0('0x17')]);}})[_0x42d0('0x19')](function(_0x332fe5){logger[_0x42d0('0x15')](_0x42d0('0x11'),_0x245056,_0x332fe5);_0x1ea13c(_0x332fe5);});});}exports[_0x42d0('0x1a')]=function(_0x3b6d32){var _0x4ffbd6=this;return new Promise(function(_0x5a5d20,_0x28fb7e){return db['ChatInteraction']['update'](_0x3b6d32['body'],{'raw':_0x3b6d32[_0x42d0('0x1b')]?_0x3b6d32[_0x42d0('0x1b')][_0x42d0('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3b6d32[_0x42d0('0x1b')]?_0x3b6d32['options'][_0x42d0('0x1d')]||null:null,'attributes':_0x3b6d32[_0x42d0('0x1b')]?_0x3b6d32[_0x42d0('0x1b')]['attributes']||null:null,'limit':_0x3b6d32[_0x42d0('0x1b')]?_0x3b6d32[_0x42d0('0x1b')][_0x42d0('0x1e')]||null:null})[_0x42d0('0x1f')](function(_0x73c418){logger['info'](_0x42d0('0x1a'),_0x3b6d32);logger[_0x42d0('0x12')](_0x42d0('0x1a'),_0x3b6d32,JSON[_0x42d0('0x20')](_0x73c418));_0x5a5d20(_0x73c418);})['catch'](function(_0x39547a){logger['error'](_0x42d0('0x1a'),_0x39547a[_0x42d0('0x17')],_0x3b6d32);_0x28fb7e(_0x4ffbd6[_0x42d0('0x15')](0x1f4,_0x39547a[_0x42d0('0x17')]));});});};exports[_0x42d0('0x21')]=function(_0x3327ca){return new Promise(function(_0x3f6d3c,_0x490c62){return db[_0x42d0('0x22')]['find']({'where':_0x3327ca[_0x42d0('0x1b')]?_0x3327ca[_0x42d0('0x1b')]['where']||null:null})[_0x42d0('0x1f')](function(_0x764a8b){if(_0x764a8b){return _0x764a8b[_0x42d0('0x23')](_0x3327ca['body']['ids'],_['omit'](_0x3327ca[_0x42d0('0x24')],[_0x42d0('0x25'),'id'])||{});}})[_0x42d0('0x26')](function(_0x4c227f){logger[_0x42d0('0x10')]('AddTags',_0x3327ca);logger['debug'](_0x42d0('0x27'),_0x3327ca,JSON[_0x42d0('0x20')](_0x4c227f));_0x3f6d3c(_0x4c227f);})[_0x42d0('0x19')](function(_0x34a57a){logger['error'](_0x42d0('0x27'),_0x34a57a['message'],_0x3327ca);_0x490c62(_this[_0x42d0('0x15')](0x1f4,_0x34a57a[_0x42d0('0x17')]));});});}; \ No newline at end of file +var _0xb243=['UpdateChatInteraction','update','options','raw','where','attributes','limit','catch','AddTagsToChatInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./chatInteraction.socket','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb243,0x10c));var _0x3b24=function(_0x92d4f3,_0x5bf702){_0x92d4f3=_0x92d4f3-0x0;var _0x35221e=_0xb243[_0x92d4f3];return _0x35221e;};'use strict';var _=require(_0x3b24('0x0'));var util=require('util');var moment=require(_0x3b24('0x1'));var BPromise=require(_0x3b24('0x2'));var rs=require(_0x3b24('0x3'));var fs=require('fs');var Redis=require(_0x3b24('0x4'));var db=require(_0x3b24('0x5'))['db'];var utils=require(_0x3b24('0x6'));var logger=require(_0x3b24('0x7'))('rpc');var config=require(_0x3b24('0x8'));var jayson=require(_0x3b24('0x9'));var client=jayson[_0x3b24('0xa')][_0x3b24('0xb')]({'port':0x232a});config[_0x3b24('0xc')]=_[_0x3b24('0xd')](config[_0x3b24('0xc')],{'host':_0x3b24('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x3b24('0xf'))['register'](socket);function respondWithRpcPromise(_0x5ee729,_0x1b947e,_0x2a97f9){return new BPromise(function(_0x438cbf,_0x174bde){return client[_0x3b24('0x10')](_0x5ee729,_0x2a97f9)[_0x3b24('0x11')](function(_0xce7744){logger[_0x3b24('0x12')](_0x3b24('0x13'),_0x1b947e,_0x3b24('0x14'));logger[_0x3b24('0x15')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x1b947e,_0x3b24('0x14'),JSON[_0x3b24('0x16')](_0xce7744));if(_0xce7744[_0x3b24('0x17')]){if(_0xce7744[_0x3b24('0x17')]['code']===0x1f4){logger[_0x3b24('0x17')]('ChatInteraction,\x20%s,\x20%s',_0x1b947e,_0xce7744[_0x3b24('0x17')]['message']);return _0x174bde(_0xce7744[_0x3b24('0x17')][_0x3b24('0x18')]);}logger[_0x3b24('0x17')](_0x3b24('0x13'),_0x1b947e,_0xce7744[_0x3b24('0x17')][_0x3b24('0x18')]);return _0x438cbf(_0xce7744[_0x3b24('0x17')][_0x3b24('0x18')]);}else{logger[_0x3b24('0x12')](_0x3b24('0x13'),_0x1b947e,_0x3b24('0x14'));_0x438cbf(_0xce7744[_0x3b24('0x19')][_0x3b24('0x18')]);}})['catch'](function(_0x486263){logger[_0x3b24('0x17')](_0x3b24('0x13'),_0x1b947e,_0x486263);_0x174bde(_0x486263);});});}exports[_0x3b24('0x1a')]=function(_0xd8ce0a){var _0x534356=this;return new Promise(function(_0x5701b2,_0x347143){return db['ChatInteraction'][_0x3b24('0x1b')](_0xd8ce0a['body'],{'raw':_0xd8ce0a[_0x3b24('0x1c')]?_0xd8ce0a[_0x3b24('0x1c')][_0x3b24('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd8ce0a[_0x3b24('0x1c')]?_0xd8ce0a[_0x3b24('0x1c')][_0x3b24('0x1e')]||null:null,'attributes':_0xd8ce0a[_0x3b24('0x1c')]?_0xd8ce0a[_0x3b24('0x1c')][_0x3b24('0x1f')]||null:null,'limit':_0xd8ce0a[_0x3b24('0x1c')]?_0xd8ce0a[_0x3b24('0x1c')][_0x3b24('0x20')]||null:null})[_0x3b24('0x11')](function(_0x27fc9c){logger[_0x3b24('0x12')](_0x3b24('0x1a'),_0xd8ce0a);logger[_0x3b24('0x15')](_0x3b24('0x1a'),_0xd8ce0a,JSON[_0x3b24('0x16')](_0x27fc9c));_0x5701b2(_0x27fc9c);})[_0x3b24('0x21')](function(_0x363baf){logger[_0x3b24('0x17')](_0x3b24('0x1a'),_0x363baf['message'],_0xd8ce0a);_0x347143(_0x534356['error'](0x1f4,_0x363baf['message']));});});};exports[_0x3b24('0x22')]=function(_0x177f32){return new Promise(function(_0x1e2eae,_0x34ffbb){return db['ChatInteraction'][_0x3b24('0x23')]({'where':_0x177f32['options']?_0x177f32[_0x3b24('0x1c')][_0x3b24('0x1e')]||null:null})[_0x3b24('0x11')](function(_0x2e4d1c){if(_0x2e4d1c){return _0x2e4d1c[_0x3b24('0x24')](_0x177f32[_0x3b24('0x25')][_0x3b24('0x26')],_[_0x3b24('0x27')](_0x177f32[_0x3b24('0x25')],[_0x3b24('0x26'),'id'])||{});}})[_0x3b24('0x28')](function(_0x51bd1b){logger['info']('AddTags',_0x177f32);logger[_0x3b24('0x15')](_0x3b24('0x29'),_0x177f32,JSON[_0x3b24('0x16')](_0x51bd1b));_0x1e2eae(_0x51bd1b);})[_0x3b24('0x21')](function(_0x548be4){logger[_0x3b24('0x17')](_0x3b24('0x29'),_0x548be4[_0x3b24('0x18')],_0x177f32);_0x34ffbb(_this[_0x3b24('0x17')](0x1f4,_0x548be4[_0x3b24('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index 15af6d3..a4e8eeb 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 _0x3871=['chatInteraction:','./chatInteraction.events','save','remove','update','emit','removeListener','length'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0x3871,0x191));var _0x1387=function(_0x2c17ce,_0x402816){_0x2c17ce=_0x2c17ce-0x0;var _0x1d3e32=_0x3871[_0x2c17ce];return _0x1d3e32;};'use strict';var ChatInteractionEvents=require(_0x1387('0x0'));var events=[_0x1387('0x1'),_0x1387('0x2'),_0x1387('0x3')];function createListener(_0x186bdc,_0x4597a6){return function(_0x23c294){_0x4597a6[_0x1387('0x4')](_0x186bdc,_0x23c294);};}function removeListener(_0x31c13e,_0x49cc85){return function(){ChatInteractionEvents[_0x1387('0x5')](_0x31c13e,_0x49cc85);};}exports['register']=function(_0xb0e75f){for(var _0x522ae9=0x0,_0x18d2ff=events[_0x1387('0x6')];_0x522ae9<_0x18d2ff;_0x522ae9++){var _0x117f65=events[_0x522ae9];var _0x3f03af=createListener(_0x1387('0x7')+_0x117f65,_0xb0e75f);ChatInteractionEvents['on'](_0x117f65,_0x3f03af);}}; \ No newline at end of file +var _0x03c1=['./chatInteraction.events','save','remove','update','emit','length','chatInteraction:'];(function(_0x1f8240,_0x449dd8){var _0x4b2c81=function(_0x51247f){while(--_0x51247f){_0x1f8240['push'](_0x1f8240['shift']());}};_0x4b2c81(++_0x449dd8);}(_0x03c1,0x118));var _0x103c=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x03c1[_0x251e8c];return _0x1e0c1d;};'use strict';var ChatInteractionEvents=require(_0x103c('0x0'));var events=[_0x103c('0x1'),_0x103c('0x2'),_0x103c('0x3')];function createListener(_0x3f42dc,_0x3eaff9){return function(_0x57fe2c){_0x3eaff9[_0x103c('0x4')](_0x3f42dc,_0x57fe2c);};}function removeListener(_0x420cd3,_0x3936f5){return function(){ChatInteractionEvents['removeListener'](_0x420cd3,_0x3936f5);};}exports['register']=function(_0xdd5704){for(var _0x3bddde=0x0,_0x35e042=events[_0x103c('0x5')];_0x3bddde<_0x35e042;_0x3bddde++){var _0x2a325c=events[_0x3bddde];var _0x5bcdf3=createListener(_0x103c('0x6')+_0x2a325c,_0xdd5704);ChatInteractionEvents['on'](_0x2a325c,_0x5bcdf3);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 634b266..93d74ac 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 _0xf11f=['customUpdate','abandon','/:id/close','close','delete','destroy','removeTags','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','/:id/attachment_download','/:id/messages','getMessages','/:id/my_messages','getMyMessages','/:id/download','download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','single','file','attachmentUpload','addMessage','/:id/tags','chat','chatinteraction:addtags','addTags','put','tracked','chatinteraction:update','/:id/custom_update'];(function(_0x531fbf,_0x9b24af){var _0x4e9127=function(_0x38c5a0){while(--_0x38c5a0){_0x531fbf['push'](_0x531fbf['shift']());}};_0x4e9127(++_0x9b24af);}(_0xf11f,0x1b0));var _0xff11=function(_0x4450b1,_0x214ace){_0x4450b1=_0x4450b1-0x0;var _0x399b0b=_0xf11f[_0x4450b1];return _0x399b0b;};'use strict';var multer=require(_0xff11('0x0'));var util=require(_0xff11('0x1'));var path=require('path');var timeout=require(_0xff11('0x2'));var express=require('express');var router=express[_0xff11('0x3')]();var auth=require(_0xff11('0x4'));var interaction=require(_0xff11('0x5'));var config=require(_0xff11('0x6'));var controller=require('./chatInteraction.controller');router[_0xff11('0x7')]('/',auth[_0xff11('0x8')](),controller[_0xff11('0x9')]);router[_0xff11('0x7')](_0xff11('0xa'),auth['isAuthenticated'](),controller[_0xff11('0xb')]);router['get'](_0xff11('0xc'),auth[_0xff11('0xd')](),controller['show']);router[_0xff11('0x7')](_0xff11('0xe'),auth[_0xff11('0xd')](),controller['attachmentDownload']);router['get'](_0xff11('0xf'),auth[_0xff11('0x8')](),controller[_0xff11('0x10')]);router['get'](_0xff11('0x11'),auth['isChatInteractionAuthorized'](),controller[_0xff11('0x12')]);router[_0xff11('0x7')](_0xff11('0x13'),auth[_0xff11('0x8')](),controller[_0xff11('0x14')]);router[_0xff11('0x15')]('/',auth[_0xff11('0x8')](),controller[_0xff11('0x16')]);var upload=multer({'storage':multer[_0xff11('0x17')]({'destination':function(_0x18f05d,_0x14ac89,_0x3da2d7){_0x3da2d7(null,path[_0xff11('0x18')](config[_0xff11('0x19')],_0xff11('0x1a')));},'filename':function(_0x582137,_0x41f676,_0x19d781){_0x19d781(null,util[_0xff11('0x1b')](_0xff11('0x1c'),Date[_0xff11('0x1d')](),_0x41f676[_0xff11('0x1e')][_0xff11('0x1f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xff11('0x15')](_0xff11('0x20'),upload[_0xff11('0x21')](_0xff11('0x22')),controller[_0xff11('0x23')]);router[_0xff11('0x15')](_0xff11('0xf'),auth[_0xff11('0xd')](),controller[_0xff11('0x24')]);router[_0xff11('0x15')](_0xff11('0x25'),auth[_0xff11('0x8')](),interaction['tracked'](_0xff11('0x26'),_0xff11('0x27')),controller[_0xff11('0x28')]);router[_0xff11('0x29')](_0xff11('0xc'),auth['isAuthenticated'](),interaction[_0xff11('0x2a')](_0xff11('0x26'),_0xff11('0x2b')),controller['update']);router[_0xff11('0x29')](_0xff11('0x2c'),controller[_0xff11('0x2d')]);router[_0xff11('0x29')]('/:id/abandon',auth[_0xff11('0xd')](),controller[_0xff11('0x2e')]);router[_0xff11('0x29')](_0xff11('0x2f'),controller[_0xff11('0x30')]);router[_0xff11('0x31')]('/:id',auth[_0xff11('0x8')](),interaction[_0xff11('0x2a')]('chat','chatinteraction:destroy'),controller[_0xff11('0x32')]);router['delete'](_0xff11('0x25'),auth['isAuthenticated'](),controller[_0xff11('0x33')]);module[_0xff11('0x34')]=router; \ No newline at end of file +var _0xb8a2=['chatinteraction:destroy','delete','/:id/tags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','isChatInteractionAuthorized','show','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','post','create','diskStorage','join','root','server/files/attachments/','format','%s-%s','single','file','addMessage','tracked','chat','addTags','put','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close','close'];(function(_0x2e6544,_0x168aef){var _0x8dceb5=function(_0x54d448){while(--_0x54d448){_0x2e6544['push'](_0x2e6544['shift']());}};_0x8dceb5(++_0x168aef);}(_0xb8a2,0x1ee));var _0x2b8a=function(_0x1538d1,_0x1fb930){_0x1538d1=_0x1538d1-0x0;var _0x2b5747=_0xb8a2[_0x1538d1];return _0x2b5747;};'use strict';var multer=require('multer');var util=require(_0x2b8a('0x0'));var path=require(_0x2b8a('0x1'));var timeout=require(_0x2b8a('0x2'));var express=require(_0x2b8a('0x3'));var router=express[_0x2b8a('0x4')]();var auth=require(_0x2b8a('0x5'));var interaction=require(_0x2b8a('0x6'));var config=require(_0x2b8a('0x7'));var controller=require(_0x2b8a('0x8'));router[_0x2b8a('0x9')]('/',auth[_0x2b8a('0xa')](),controller[_0x2b8a('0xb')]);router[_0x2b8a('0x9')](_0x2b8a('0xc'),auth['isAuthenticated'](),controller[_0x2b8a('0xd')]);router[_0x2b8a('0x9')](_0x2b8a('0xe'),auth[_0x2b8a('0xf')](),controller[_0x2b8a('0x10')]);router[_0x2b8a('0x9')](_0x2b8a('0x11'),auth[_0x2b8a('0xf')](),controller[_0x2b8a('0x12')]);router[_0x2b8a('0x9')](_0x2b8a('0x13'),auth[_0x2b8a('0xa')](),controller[_0x2b8a('0x14')]);router[_0x2b8a('0x9')](_0x2b8a('0x15'),auth[_0x2b8a('0xf')](),controller['getMyMessages']);router['get'](_0x2b8a('0x16'),auth[_0x2b8a('0xa')](),controller['download']);router[_0x2b8a('0x17')]('/',auth[_0x2b8a('0xa')](),controller[_0x2b8a('0x18')]);var upload=multer({'storage':multer[_0x2b8a('0x19')]({'destination':function(_0x231479,_0x584c36,_0x3433a8){_0x3433a8(null,path[_0x2b8a('0x1a')](config[_0x2b8a('0x1b')],_0x2b8a('0x1c')));},'filename':function(_0x2d142e,_0xb960da,_0xfeb695){_0xfeb695(null,util[_0x2b8a('0x1d')](_0x2b8a('0x1e'),Date['now'](),_0xb960da['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2b8a('0x17')]('/:id/attachment_upload',upload[_0x2b8a('0x1f')](_0x2b8a('0x20')),controller['attachmentUpload']);router[_0x2b8a('0x17')](_0x2b8a('0x13'),auth[_0x2b8a('0xf')](),controller[_0x2b8a('0x21')]);router[_0x2b8a('0x17')]('/:id/tags',auth[_0x2b8a('0xa')](),interaction[_0x2b8a('0x22')](_0x2b8a('0x23'),'chatinteraction:addtags'),controller[_0x2b8a('0x24')]);router[_0x2b8a('0x25')](_0x2b8a('0xe'),auth[_0x2b8a('0xa')](),interaction[_0x2b8a('0x22')](_0x2b8a('0x23'),_0x2b8a('0x26')),controller[_0x2b8a('0x27')]);router[_0x2b8a('0x25')](_0x2b8a('0x28'),controller[_0x2b8a('0x29')]);router[_0x2b8a('0x25')](_0x2b8a('0x2a'),auth[_0x2b8a('0xf')](),controller['abandon']);router[_0x2b8a('0x25')](_0x2b8a('0x2b'),controller[_0x2b8a('0x2c')]);router['delete'](_0x2b8a('0xe'),auth[_0x2b8a('0xa')](),interaction[_0x2b8a('0x22')](_0x2b8a('0x23'),_0x2b8a('0x2d')),controller['destroy']);router[_0x2b8a('0x2e')](_0x2b8a('0x2f'),auth[_0x2b8a('0xa')](),controller['removeTags']);module[_0x2b8a('0x30')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 98e3632..b4f7bf3 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 _0x1967=['INTEGER','exports','TEXT','medium','BOOLEAN'];(function(_0x53d460,_0x23b719){var _0x1333cd=function(_0x38aabd){while(--_0x38aabd){_0x53d460['push'](_0x53d460['shift']());}};_0x1333cd(++_0x23b719);}(_0x1967,0x173));var _0x7196=function(_0x2de702,_0x505b5f){_0x2de702=_0x2de702-0x0;var _0x538578=_0x1967[_0x2de702];return _0x538578;};'use strict';var Sequelize=require('sequelize');module[_0x7196('0x0')]={'body':{'type':Sequelize[_0x7196('0x1')](_0x7196('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x7196('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x7196('0x4')]}}; \ No newline at end of file +var _0x0b0e=['TEXT','BOOLEAN','INTEGER','sequelize'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x0b0e,0x187));var _0xe0b0=function(_0x47159c,_0x1c8216){_0x47159c=_0x47159c-0x0;var _0x454dbe=_0x0b0e[_0x47159c];return _0x454dbe;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'body':{'type':Sequelize[_0xe0b0('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe0b0('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xe0b0('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e82a071..299cd70 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 _0xf4f7=['redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','stack','name','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','sort','where','pick','filter','merge','VIRTUAL','options','ChatInternalMessage','count','includeAll','findAll','rows','show','params','include','catch','create','body','find','destroy','describe','get','messages','createdAt','lastMessage','lastMessageAt','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','fullname','role','userpic','internal','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','push','FromId','ToId','read','-createdAt','all','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb'];(function(_0x7c6b50,_0x1f0390){var _0x43abb4=function(_0x5a8088){while(--_0x5a8088){_0x7c6b50['push'](_0x7c6b50['shift']());}};_0x43abb4(++_0x1f0390);}(_0xf4f7,0x129));var _0x7f4f=function(_0xa6cc5c,_0x239c99){_0xa6cc5c=_0xa6cc5c-0x0;var _0x44803d=_0xf4f7[_0xa6cc5c];return _0x44803d;};'use strict';var pdf=require(_0x7f4f('0x0'));var emlformat=require(_0x7f4f('0x1'));var rimraf=require(_0x7f4f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7f4f('0x3'));var rp=require(_0x7f4f('0x4'));var moment=require(_0x7f4f('0x5'));var BPromise=require(_0x7f4f('0x6'));var Mustache=require(_0x7f4f('0x7'));var util=require('util');var path=require(_0x7f4f('0x8'));var sox=require(_0x7f4f('0x9'));var csv=require('to-csv');var ejs=require(_0x7f4f('0xa'));var fs=require('fs');var _=require(_0x7f4f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7f4f('0xc'));var deskjs=require(_0x7f4f('0xd'));var toCsv=require('to-csv');var querystring=require(_0x7f4f('0xe'));var Papa=require('papaparse');var Redis=require(_0x7f4f('0xf'));var authService=require(_0x7f4f('0x10'));var qs=require(_0x7f4f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x7f4f('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x7f4f('0x13'));var db=require(_0x7f4f('0x14'))['db'];config[_0x7f4f('0x15')]=_[_0x7f4f('0x16')](config[_0x7f4f('0x15')],{'host':_0x7f4f('0x17'),'port':0x18eb});var socket=require(_0x7f4f('0x18'))(new Redis(config[_0x7f4f('0x15')]));require(_0x7f4f('0x19'))[_0x7f4f('0x1a')](socket);function respondWithStatusCode(_0x434d7a,_0x22eea1){_0x22eea1=_0x22eea1||0xcc;return function(_0x235e0b){if(_0x235e0b){return _0x434d7a[_0x7f4f('0x1b')](_0x22eea1);}return _0x434d7a[_0x7f4f('0x1c')](_0x22eea1)['end']();};}function respondWithResult(_0x39db66,_0x2e1961){_0x2e1961=_0x2e1961||0xc8;return function(_0x15a3d7){if(_0x15a3d7){return _0x39db66[_0x7f4f('0x1c')](_0x2e1961)[_0x7f4f('0x1d')](_0x15a3d7);}};}function respondWithFilteredResult(_0x466323,_0x962533){return function(_0x187b1f){if(_0x187b1f){var _0x2131c4=_0x187b1f['count'],_0x552c79=_0x962533[_0x7f4f('0x1e')],_0x35b488=_0x962533[_0x7f4f('0x1e')]+_0x962533[_0x7f4f('0x1f')],_0x70eb17;if(_0x35b488>=_0x2131c4){_0x35b488=_0x2131c4;_0x70eb17=0xc8;}else{_0x70eb17=0xce;}_0x466323['status'](_0x70eb17);return _0x466323[_0x7f4f('0x20')](_0x7f4f('0x21'),_0x552c79+'-'+_0x35b488+'/'+_0x2131c4)[_0x7f4f('0x1d')](_0x187b1f);}return null;};}function patchUpdates(_0xdacc6a){return function(_0x2f2edb){try{jsonpatch[_0x7f4f('0x22')](_0x2f2edb,_0xdacc6a,!![]);}catch(_0x5514c0){return BPromise[_0x7f4f('0x23')](_0x5514c0);}return _0x2f2edb[_0x7f4f('0x24')]();};}function saveUpdates(_0xfacda,_0x36deed){return function(_0x513f61){if(_0x513f61){return _0x513f61[_0x7f4f('0x25')](_0xfacda)['then'](function(_0x225a17){return _0x225a17;});}return null;};}function removeEntity(_0x15d32b,_0x5945c3){return function(_0x145e73){if(_0x145e73){return _0x145e73['destroy']()[_0x7f4f('0x26')](function(){_0x15d32b[_0x7f4f('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef308,_0x6cb742){return function(_0x5e77e4){if(!_0x5e77e4){_0x3ef308[_0x7f4f('0x1b')](0x194);}return _0x5e77e4;};}function handleError(_0xa06ee5,_0x303cf9){_0x303cf9=_0x303cf9||0x1f4;return function(_0xf98889){logger['error'](_0xf98889[_0x7f4f('0x27')]);if(_0xf98889[_0x7f4f('0x28')]){delete _0xf98889[_0x7f4f('0x28')];}_0xa06ee5[_0x7f4f('0x1c')](_0x303cf9)['send'](_0xf98889);};}exports['index']=function(_0x2d0c2a,_0x340dd1){var _0x8d0ab4={},_0x2aca8a={},_0x3d416d={'count':0x0,'rows':[]};var _0x3a760f=_[_0x7f4f('0x29')](db['ChatInternalMessage'][_0x7f4f('0x2a')],function(_0x2e5025){return{'name':_0x2e5025[_0x7f4f('0x2b')],'type':_0x2e5025[_0x7f4f('0x2c')]['key']};});_0x2aca8a[_0x7f4f('0x2d')]=_[_0x7f4f('0x29')](_0x3a760f,_0x7f4f('0x28'));_0x2aca8a[_0x7f4f('0x2e')]=_[_0x7f4f('0x2f')](_0x2d0c2a[_0x7f4f('0x2e')]);_0x2aca8a[_0x7f4f('0x30')]=_['intersection'](_0x2aca8a['model'],_0x2aca8a[_0x7f4f('0x2e')]);_0x8d0ab4[_0x7f4f('0x31')]=_[_0x7f4f('0x32')](_0x2aca8a[_0x7f4f('0x2d')],qs['fields'](_0x2d0c2a[_0x7f4f('0x2e')][_0x7f4f('0x33')]));_0x8d0ab4[_0x7f4f('0x31')]=_0x8d0ab4['attributes'][_0x7f4f('0x34')]?_0x8d0ab4[_0x7f4f('0x31')]:_0x2aca8a[_0x7f4f('0x2d')];if(!_0x2d0c2a['query']['hasOwnProperty']('nolimit')){_0x8d0ab4[_0x7f4f('0x1f')]=qs[_0x7f4f('0x1f')](_0x2d0c2a[_0x7f4f('0x2e')]['limit']);_0x8d0ab4[_0x7f4f('0x1e')]=qs[_0x7f4f('0x1e')](_0x2d0c2a[_0x7f4f('0x2e')][_0x7f4f('0x1e')]);}_0x8d0ab4['order']=qs[_0x7f4f('0x35')](_0x2d0c2a[_0x7f4f('0x2e')][_0x7f4f('0x35')]);_0x8d0ab4[_0x7f4f('0x36')]=qs[_0x7f4f('0x30')](_[_0x7f4f('0x37')](_0x2d0c2a[_0x7f4f('0x2e')],_0x2aca8a[_0x7f4f('0x30')]));if(_0x2d0c2a[_0x7f4f('0x2e')][_0x7f4f('0x38')]){_0x8d0ab4[_0x7f4f('0x36')]=_[_0x7f4f('0x39')](_0x8d0ab4[_0x7f4f('0x36')],{'$or':_['map'](_0x3a760f,function(_0x32474c){if(_0x32474c[_0x7f4f('0x2c')]!==_0x7f4f('0x3a')){var _0x2b6389={};_0x2b6389[_0x32474c[_0x7f4f('0x28')]]={'$like':'%'+_0x2d0c2a[_0x7f4f('0x2e')]['filter']+'%'};return _0x2b6389;}})});}_0x8d0ab4=_[_0x7f4f('0x39')]({},_0x8d0ab4,_0x2d0c2a[_0x7f4f('0x3b')]);var _0x29f7b9={'where':_0x8d0ab4[_0x7f4f('0x36')]};return db[_0x7f4f('0x3c')][_0x7f4f('0x3d')](_0x29f7b9)['then'](function(_0x4e2396){_0x3d416d[_0x7f4f('0x3d')]=_0x4e2396;if(_0x2d0c2a[_0x7f4f('0x2e')][_0x7f4f('0x3e')]){_0x8d0ab4['include']=[{'all':!![]}];}return db['ChatInternalMessage'][_0x7f4f('0x3f')](_0x8d0ab4);})[_0x7f4f('0x26')](function(_0x2b3f81){_0x3d416d[_0x7f4f('0x40')]=_0x2b3f81;return _0x3d416d;})[_0x7f4f('0x26')](respondWithFilteredResult(_0x340dd1,_0x8d0ab4))['catch'](handleError(_0x340dd1,null));};exports[_0x7f4f('0x41')]=function(_0x3f31af,_0x25c4dc){var _0x5d7854={'raw':!![],'where':{'id':_0x3f31af[_0x7f4f('0x42')]['id']}},_0x5492ea={};_0x5492ea[_0x7f4f('0x2d')]=_[_0x7f4f('0x2f')](db[_0x7f4f('0x3c')]['rawAttributes']);_0x5492ea[_0x7f4f('0x2e')]=_[_0x7f4f('0x2f')](_0x3f31af[_0x7f4f('0x2e')]);_0x5492ea[_0x7f4f('0x30')]=_[_0x7f4f('0x32')](_0x5492ea[_0x7f4f('0x2d')],_0x5492ea[_0x7f4f('0x2e')]);_0x5d7854[_0x7f4f('0x31')]=_['intersection'](_0x5492ea['model'],qs[_0x7f4f('0x33')](_0x3f31af[_0x7f4f('0x2e')][_0x7f4f('0x33')]));_0x5d7854[_0x7f4f('0x31')]=_0x5d7854['attributes'][_0x7f4f('0x34')]?_0x5d7854['attributes']:_0x5492ea[_0x7f4f('0x2d')];if(_0x3f31af[_0x7f4f('0x2e')][_0x7f4f('0x3e')]){_0x5d7854[_0x7f4f('0x43')]=[{'all':!![]}];}_0x5d7854=_['merge']({},_0x5d7854,_0x3f31af[_0x7f4f('0x3b')]);return db[_0x7f4f('0x3c')]['find'](_0x5d7854)[_0x7f4f('0x26')](handleEntityNotFound(_0x25c4dc,null))['then'](respondWithResult(_0x25c4dc,null))[_0x7f4f('0x44')](handleError(_0x25c4dc,null));};exports['create']=function(_0x51b9ee,_0x4cb495){return db['ChatInternalMessage'][_0x7f4f('0x45')](_0x51b9ee[_0x7f4f('0x46')],{})[_0x7f4f('0x26')](respondWithResult(_0x4cb495,0xc9))[_0x7f4f('0x44')](handleError(_0x4cb495,null));};exports['update']=function(_0x300ad1,_0x4d1556){if(_0x300ad1[_0x7f4f('0x46')]['id']){delete _0x300ad1[_0x7f4f('0x46')]['id'];}return db[_0x7f4f('0x3c')][_0x7f4f('0x47')]({'where':{'id':_0x300ad1[_0x7f4f('0x42')]['id']}})[_0x7f4f('0x26')](handleEntityNotFound(_0x4d1556,null))['then'](saveUpdates(_0x300ad1[_0x7f4f('0x46')],null))[_0x7f4f('0x26')](respondWithResult(_0x4d1556,null))[_0x7f4f('0x44')](handleError(_0x4d1556,null));};exports[_0x7f4f('0x48')]=function(_0x74c808,_0x15e690){return db['ChatInternalMessage'][_0x7f4f('0x47')]({'where':{'id':_0x74c808[_0x7f4f('0x42')]['id']}})['then'](handleEntityNotFound(_0x15e690,null))['then'](removeEntity(_0x15e690,null))[_0x7f4f('0x44')](handleError(_0x15e690,null));};exports[_0x7f4f('0x49')]=function(_0x4075c0,_0x35e9b0){return db[_0x7f4f('0x3c')][_0x7f4f('0x49')]()[_0x7f4f('0x26')](respondWithResult(_0x35e9b0,null))[_0x7f4f('0x44')](handleError(_0x35e9b0,null));};function wrapUser(_0x32f54a){return function(_0x56947b){var _0xffd59b=_0x32f54a[_0x7f4f('0x4a')]({'plain':!![]});_0xffd59b[_0x7f4f('0x4b')]=[];if(_0x56947b){_0xffd59b['lastMessageAt']=_0x56947b[_0x7f4f('0x4c')];_0xffd59b[_0x7f4f('0x4d')]=_0x56947b;}else{_0xffd59b[_0x7f4f('0x4e')]=moment(0x0)[_0x7f4f('0x4f')](_0x7f4f('0x50'));_0xffd59b[_0x7f4f('0x4d')]={};}return _0xffd59b;};}exports[_0x7f4f('0x51')]=function(_0x1f03f3,_0x32df4e,_0x5eb43f){var _0x4301f1=[];return db['User']['findAll']({'where':{'role':[_0x7f4f('0x52'),_0x7f4f('0x53'),'user']},'attributes':['id',_0x7f4f('0x54'),_0x7f4f('0x28'),_0x7f4f('0x55'),_0x7f4f('0x56'),_0x7f4f('0x57'),'online',_0x7f4f('0x58'),_0x7f4f('0x59'),_0x7f4f('0x5a')],'order':qs[_0x7f4f('0x35')](_0x7f4f('0x5b')),'include':[{'model':db[_0x7f4f('0x5c')],'as':_0x7f4f('0x5d'),'attributes':['id','name',_0x7f4f('0x2c')],'through':{'attributes':[]}}]})[_0x7f4f('0x26')](function(_0x2315de){if(_0x2315de){var _0x22926b=_0x1f03f3[_0x7f4f('0x5e')][_0x7f4f('0x4a')]({'plain':!![]});if(!_0x22926b)throw new Error(_0x7f4f('0x5f'));if(_0x22926b[_0x7f4f('0x55')]===_0x7f4f('0x5e')){return db[_0x7f4f('0x60')][_0x7f4f('0x47')]({'where':{'name':'Agents','userProfileId':_0x22926b[_0x7f4f('0x61')]},'raw':!![]})[_0x7f4f('0x26')](function(_0x3aa66e){if(_0x3aa66e){if(_0x3aa66e[_0x7f4f('0x62')]===0x0){return db[_0x7f4f('0x63')][_0x7f4f('0x3f')]({'where':{'sectionId':_0x3aa66e['id']},'raw':!![]})['then'](function(_0x4dd228){var _0x52a713=[];if(_['isEmpty'](_0x4dd228)){_0x52a713=_[_0x7f4f('0x38')](_0x2315de,function(_0x4c99b8){if(_0x4c99b8[_0x7f4f('0x55')]!=='agent'){return _0x4c99b8;}});return _0x52a713;}else{for(var _0x1a7b0a=0x0;_0x1a7b0a<_0x2315de[_0x7f4f('0x34')];_0x1a7b0a++){var _0x3f394c=_0x2315de[_0x1a7b0a];if(_0x3f394c['role']===_0x7f4f('0x52')){var _0x5ebc58=_['find'](_0x4dd228,function(_0x1aad13){return _0x1aad13['resourceId']===_0x3f394c['id'];});if(_0x5ebc58)_0x52a713[_0x7f4f('0x64')](_0x3f394c);}else{_0x52a713[_0x7f4f('0x64')](_0x3f394c);}}return _0x52a713;}});}else{return _0x2315de;}}else{var _0x39b731=_[_0x7f4f('0x38')](_0x2315de,function(_0x10f730){if(_0x10f730[_0x7f4f('0x55')]!==_0x7f4f('0x52')){return _0x10f730;}});return _0x39b731;}});}else{return _0x2315de;}}})['then'](function(_0x2a2bbd){var _0x2cd429=[];if(_0x2a2bbd){_0x4301f1=_0x2a2bbd;for(var _0x1f4887=0x0;_0x1f4887<_0x2a2bbd[_0x7f4f('0x34')];_0x1f4887+=0x1){_0x4301f1[_0x1f4887][_0x7f4f('0x4b')]=[];_0x2cd429[_0x7f4f('0x64')](db[_0x7f4f('0x3c')]['find']({'where':{'FromId':[_0x1f03f3[_0x7f4f('0x5e')]['id'],_0x2a2bbd[_0x1f4887]['id']],'ToId':[_0x1f03f3[_0x7f4f('0x5e')]['id'],_0x2a2bbd[_0x1f4887]['id']],'ChatGroupId':null},'attributes':['id',_0x7f4f('0x4c'),_0x7f4f('0x65'),_0x7f4f('0x66'),_0x7f4f('0x67'),'body'],'order':qs[_0x7f4f('0x35')](_0x7f4f('0x68')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x7f4f('0x26')](wrapUser(_0x2a2bbd[_0x1f4887])));}return BPromise[_0x7f4f('0x69')](_0x2cd429);}return[];})[_0x7f4f('0x26')](function(_0x39e50a){return{'rows':_0x39e50a,'count':_0x39e50a[_0x7f4f('0x34')]};})[_0x7f4f('0x26')](respondWithResult(_0x32df4e,null))[_0x7f4f('0x44')](handleError(_0x32df4e,null));}; \ No newline at end of file +var _0xf989=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','json','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','map','ChatInternalMessage','key','keys','intersection','model','query','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','include','create','body','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','findAll','agent','admin','user','fullname','userpic','internal','showWebBar','-online','VoiceQueue','VoiceQueues','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','isEmpty','role','push','FromId','read','-createdAt','all','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger'];(function(_0x2e6b02,_0x1937ca){var _0x5444c2=function(_0xa5c467){while(--_0xa5c467){_0x2e6b02['push'](_0x2e6b02['shift']());}};_0x5444c2(++_0x1937ca);}(_0xf989,0x1a5));var _0x9f98=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0xf989[_0x3a2118];return _0x1d181d;};'use strict';var pdf=require(_0x9f98('0x0'));var emlformat=require(_0x9f98('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x9f98('0x2'));var jsonpatch=require(_0x9f98('0x3'));var rp=require('request-promise');var moment=require(_0x9f98('0x4'));var BPromise=require(_0x9f98('0x5'));var Mustache=require(_0x9f98('0x6'));var util=require(_0x9f98('0x7'));var path=require('path');var sox=require(_0x9f98('0x8'));var csv=require(_0x9f98('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x9f98('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9f98('0xb'));var toCsv=require(_0x9f98('0x9'));var querystring=require(_0x9f98('0xc'));var Papa=require(_0x9f98('0xd'));var Redis=require(_0x9f98('0xe'));var authService=require(_0x9f98('0xf'));var qs=require(_0x9f98('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9f98('0x11'));var logger=require(_0x9f98('0x12'))(_0x9f98('0x13'));var utils=require(_0x9f98('0x14'));var config=require(_0x9f98('0x15'));var db=require(_0x9f98('0x16'))['db'];config[_0x9f98('0x17')]=_[_0x9f98('0x18')](config['redis'],{'host':_0x9f98('0x19'),'port':0x18eb});var socket=require(_0x9f98('0x1a'))(new Redis(config['redis']));require(_0x9f98('0x1b'))['register'](socket);function respondWithStatusCode(_0x5b1be3,_0x172d12){_0x172d12=_0x172d12||0xcc;return function(_0x49fdc9){if(_0x49fdc9){return _0x5b1be3[_0x9f98('0x1c')](_0x172d12);}return _0x5b1be3[_0x9f98('0x1d')](_0x172d12)[_0x9f98('0x1e')]();};}function respondWithResult(_0x52114e,_0x4c83f5){_0x4c83f5=_0x4c83f5||0xc8;return function(_0x19b452){if(_0x19b452){return _0x52114e[_0x9f98('0x1d')](_0x4c83f5)[_0x9f98('0x1f')](_0x19b452);}};}function respondWithFilteredResult(_0x3d9087,_0x1eeff9){return function(_0x36282c){if(_0x36282c){var _0x4eaf01=_0x36282c['count'],_0x109cfb=_0x1eeff9[_0x9f98('0x20')],_0x5e16c1=_0x1eeff9[_0x9f98('0x20')]+_0x1eeff9['limit'],_0x26e76d;if(_0x5e16c1>=_0x4eaf01){_0x5e16c1=_0x4eaf01;_0x26e76d=0xc8;}else{_0x26e76d=0xce;}_0x3d9087[_0x9f98('0x1d')](_0x26e76d);return _0x3d9087[_0x9f98('0x21')]('Content-Range',_0x109cfb+'-'+_0x5e16c1+'/'+_0x4eaf01)[_0x9f98('0x1f')](_0x36282c);}return null;};}function patchUpdates(_0x1c0d0f){return function(_0x3e07bc){try{jsonpatch[_0x9f98('0x22')](_0x3e07bc,_0x1c0d0f,!![]);}catch(_0x577083){return BPromise[_0x9f98('0x23')](_0x577083);}return _0x3e07bc[_0x9f98('0x24')]();};}function saveUpdates(_0x351088,_0xc069ca){return function(_0x2cd561){if(_0x2cd561){return _0x2cd561[_0x9f98('0x25')](_0x351088)[_0x9f98('0x26')](function(_0xb043c1){return _0xb043c1;});}return null;};}function removeEntity(_0xbcaf2e,_0x281516){return function(_0x13ff6e){if(_0x13ff6e){return _0x13ff6e[_0x9f98('0x27')]()[_0x9f98('0x26')](function(){_0xbcaf2e[_0x9f98('0x1d')](0xcc)[_0x9f98('0x1e')]();});}};}function handleEntityNotFound(_0x1de46b,_0x1645a7){return function(_0x453f9b){if(!_0x453f9b){_0x1de46b[_0x9f98('0x1c')](0x194);}return _0x453f9b;};}function handleError(_0xe733da,_0x37b023){_0x37b023=_0x37b023||0x1f4;return function(_0x46fb54){logger[_0x9f98('0x28')](_0x46fb54[_0x9f98('0x29')]);if(_0x46fb54['name']){delete _0x46fb54[_0x9f98('0x2a')];}_0xe733da[_0x9f98('0x1d')](_0x37b023)[_0x9f98('0x2b')](_0x46fb54);};}exports['index']=function(_0x5151c7,_0x50af24){var _0x441784={},_0x363a1f={},_0x3b69d3={'count':0x0,'rows':[]};var _0x28fcb1=_[_0x9f98('0x2c')](db[_0x9f98('0x2d')]['rawAttributes'],function(_0x4304a7){return{'name':_0x4304a7['fieldName'],'type':_0x4304a7['type'][_0x9f98('0x2e')]};});_0x363a1f['model']=_['map'](_0x28fcb1,_0x9f98('0x2a'));_0x363a1f['query']=_[_0x9f98('0x2f')](_0x5151c7['query']);_0x363a1f['filters']=_[_0x9f98('0x30')](_0x363a1f[_0x9f98('0x31')],_0x363a1f['query']);_0x441784['attributes']=_[_0x9f98('0x30')](_0x363a1f[_0x9f98('0x31')],qs['fields'](_0x5151c7[_0x9f98('0x32')][_0x9f98('0x33')]));_0x441784[_0x9f98('0x34')]=_0x441784[_0x9f98('0x34')][_0x9f98('0x35')]?_0x441784[_0x9f98('0x34')]:_0x363a1f[_0x9f98('0x31')];if(!_0x5151c7['query'][_0x9f98('0x36')](_0x9f98('0x37'))){_0x441784[_0x9f98('0x38')]=qs[_0x9f98('0x38')](_0x5151c7[_0x9f98('0x32')][_0x9f98('0x38')]);_0x441784[_0x9f98('0x20')]=qs[_0x9f98('0x20')](_0x5151c7[_0x9f98('0x32')][_0x9f98('0x20')]);}_0x441784[_0x9f98('0x39')]=qs[_0x9f98('0x3a')](_0x5151c7[_0x9f98('0x32')]['sort']);_0x441784['where']=qs['filters'](_[_0x9f98('0x3b')](_0x5151c7[_0x9f98('0x32')],_0x363a1f[_0x9f98('0x3c')]));if(_0x5151c7[_0x9f98('0x32')][_0x9f98('0x3d')]){_0x441784[_0x9f98('0x3e')]=_[_0x9f98('0x3f')](_0x441784[_0x9f98('0x3e')],{'$or':_['map'](_0x28fcb1,function(_0x50e390){if(_0x50e390[_0x9f98('0x40')]!==_0x9f98('0x41')){var _0x26c5f4={};_0x26c5f4[_0x50e390[_0x9f98('0x2a')]]={'$like':'%'+_0x5151c7['query'][_0x9f98('0x3d')]+'%'};return _0x26c5f4;}})});}_0x441784=_[_0x9f98('0x3f')]({},_0x441784,_0x5151c7[_0x9f98('0x42')]);var _0x288901={'where':_0x441784[_0x9f98('0x3e')]};return db[_0x9f98('0x2d')]['count'](_0x288901)[_0x9f98('0x26')](function(_0x433947){_0x3b69d3[_0x9f98('0x43')]=_0x433947;if(_0x5151c7['query'][_0x9f98('0x44')]){_0x441784['include']=[{'all':!![]}];}return db['ChatInternalMessage']['findAll'](_0x441784);})[_0x9f98('0x26')](function(_0x40716a){_0x3b69d3[_0x9f98('0x45')]=_0x40716a;return _0x3b69d3;})[_0x9f98('0x26')](respondWithFilteredResult(_0x50af24,_0x441784))[_0x9f98('0x46')](handleError(_0x50af24,null));};exports[_0x9f98('0x47')]=function(_0x337eb7,_0x6e251){var _0x251b7b={'raw':!![],'where':{'id':_0x337eb7[_0x9f98('0x48')]['id']}},_0x2e178b={};_0x2e178b[_0x9f98('0x31')]=_[_0x9f98('0x2f')](db['ChatInternalMessage'][_0x9f98('0x49')]);_0x2e178b['query']=_[_0x9f98('0x2f')](_0x337eb7[_0x9f98('0x32')]);_0x2e178b[_0x9f98('0x3c')]=_[_0x9f98('0x30')](_0x2e178b[_0x9f98('0x31')],_0x2e178b['query']);_0x251b7b['attributes']=_[_0x9f98('0x30')](_0x2e178b['model'],qs['fields'](_0x337eb7[_0x9f98('0x32')][_0x9f98('0x33')]));_0x251b7b[_0x9f98('0x34')]=_0x251b7b[_0x9f98('0x34')][_0x9f98('0x35')]?_0x251b7b[_0x9f98('0x34')]:_0x2e178b['model'];if(_0x337eb7[_0x9f98('0x32')]['includeAll']){_0x251b7b[_0x9f98('0x4a')]=[{'all':!![]}];}_0x251b7b=_[_0x9f98('0x3f')]({},_0x251b7b,_0x337eb7[_0x9f98('0x42')]);return db['ChatInternalMessage']['find'](_0x251b7b)[_0x9f98('0x26')](handleEntityNotFound(_0x6e251,null))[_0x9f98('0x26')](respondWithResult(_0x6e251,null))[_0x9f98('0x46')](handleError(_0x6e251,null));};exports[_0x9f98('0x4b')]=function(_0xa022f3,_0x5f0c19){return db['ChatInternalMessage'][_0x9f98('0x4b')](_0xa022f3['body'],{})[_0x9f98('0x26')](respondWithResult(_0x5f0c19,0xc9))[_0x9f98('0x46')](handleError(_0x5f0c19,null));};exports[_0x9f98('0x25')]=function(_0x4fba7b,_0x44ef2a){if(_0x4fba7b[_0x9f98('0x4c')]['id']){delete _0x4fba7b[_0x9f98('0x4c')]['id'];}return db[_0x9f98('0x2d')][_0x9f98('0x4d')]({'where':{'id':_0x4fba7b[_0x9f98('0x48')]['id']}})[_0x9f98('0x26')](handleEntityNotFound(_0x44ef2a,null))['then'](saveUpdates(_0x4fba7b['body'],null))[_0x9f98('0x26')](respondWithResult(_0x44ef2a,null))['catch'](handleError(_0x44ef2a,null));};exports[_0x9f98('0x27')]=function(_0x25e87c,_0x340203){return db[_0x9f98('0x2d')][_0x9f98('0x4d')]({'where':{'id':_0x25e87c[_0x9f98('0x48')]['id']}})[_0x9f98('0x26')](handleEntityNotFound(_0x340203,null))[_0x9f98('0x26')](removeEntity(_0x340203,null))[_0x9f98('0x46')](handleError(_0x340203,null));};exports['describe']=function(_0xbeac9d,_0x2a9d84){return db[_0x9f98('0x2d')][_0x9f98('0x4e')]()[_0x9f98('0x26')](respondWithResult(_0x2a9d84,null))[_0x9f98('0x46')](handleError(_0x2a9d84,null));};function wrapUser(_0x49c3fd){return function(_0x3490ff){var _0x16adc5=_0x49c3fd[_0x9f98('0x4f')]({'plain':!![]});_0x16adc5[_0x9f98('0x50')]=[];if(_0x3490ff){_0x16adc5[_0x9f98('0x51')]=_0x3490ff[_0x9f98('0x52')];_0x16adc5[_0x9f98('0x53')]=_0x3490ff;}else{_0x16adc5[_0x9f98('0x51')]=moment(0x0)[_0x9f98('0x54')](_0x9f98('0x55'));_0x16adc5[_0x9f98('0x53')]={};}return _0x16adc5;};}exports[_0x9f98('0x56')]=function(_0x1ee3f2,_0x3a5f00,_0x411647){var _0x44b45c=[];return db[_0x9f98('0x57')][_0x9f98('0x58')]({'where':{'role':[_0x9f98('0x59'),_0x9f98('0x5a'),_0x9f98('0x5b')]},'attributes':['id',_0x9f98('0x5c'),_0x9f98('0x2a'),'role',_0x9f98('0x5d'),_0x9f98('0x5e'),'online','lastLoginAt','allowmessenger',_0x9f98('0x5f')],'order':qs[_0x9f98('0x3a')](_0x9f98('0x60')),'include':[{'model':db[_0x9f98('0x61')],'as':_0x9f98('0x62'),'attributes':['id','name',_0x9f98('0x40')],'through':{'attributes':[]}}]})[_0x9f98('0x26')](function(_0x482add){if(_0x482add){var _0x12c93e=_0x1ee3f2['user'][_0x9f98('0x4f')]({'plain':!![]});if(!_0x12c93e)throw new Error(_0x9f98('0x63'));if(_0x12c93e['role']===_0x9f98('0x5b')){return db[_0x9f98('0x64')][_0x9f98('0x4d')]({'where':{'name':'Agents','userProfileId':_0x12c93e['userProfileId']},'raw':!![]})['then'](function(_0x47f2d9){if(_0x47f2d9){if(_0x47f2d9[_0x9f98('0x65')]===0x0){return db[_0x9f98('0x66')]['findAll']({'where':{'sectionId':_0x47f2d9['id']},'raw':!![]})['then'](function(_0x1f1f75){var _0x1c73a4=[];if(_[_0x9f98('0x67')](_0x1f1f75)){_0x1c73a4=_[_0x9f98('0x3d')](_0x482add,function(_0x1b4b9c){if(_0x1b4b9c[_0x9f98('0x68')]!==_0x9f98('0x59')){return _0x1b4b9c;}});return _0x1c73a4;}else{for(var _0x427ad4=0x0;_0x427ad4<_0x482add[_0x9f98('0x35')];_0x427ad4++){var _0x4d255b=_0x482add[_0x427ad4];if(_0x4d255b[_0x9f98('0x68')]===_0x9f98('0x59')){var _0x3a5e34=_[_0x9f98('0x4d')](_0x1f1f75,function(_0x75106e){return _0x75106e['resourceId']===_0x4d255b['id'];});if(_0x3a5e34)_0x1c73a4[_0x9f98('0x69')](_0x4d255b);}else{_0x1c73a4['push'](_0x4d255b);}}return _0x1c73a4;}});}else{return _0x482add;}}else{var _0x6ba415=_[_0x9f98('0x3d')](_0x482add,function(_0x5c547d){if(_0x5c547d[_0x9f98('0x68')]!==_0x9f98('0x59')){return _0x5c547d;}});return _0x6ba415;}});}else{return _0x482add;}}})['then'](function(_0x5082a8){var _0x5c8b8a=[];if(_0x5082a8){_0x44b45c=_0x5082a8;for(var _0x1a7cb1=0x0;_0x1a7cb1<_0x5082a8['length'];_0x1a7cb1+=0x1){_0x44b45c[_0x1a7cb1]['messages']=[];_0x5c8b8a[_0x9f98('0x69')](db[_0x9f98('0x2d')][_0x9f98('0x4d')]({'where':{'FromId':[_0x1ee3f2[_0x9f98('0x5b')]['id'],_0x5082a8[_0x1a7cb1]['id']],'ToId':[_0x1ee3f2['user']['id'],_0x5082a8[_0x1a7cb1]['id']],'ChatGroupId':null},'attributes':['id','createdAt',_0x9f98('0x6a'),'ToId',_0x9f98('0x6b'),_0x9f98('0x4c')],'order':qs['sort'](_0x9f98('0x6c')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x9f98('0x26')](wrapUser(_0x5082a8[_0x1a7cb1])));}return BPromise[_0x9f98('0x6d')](_0x5c8b8a);}return[];})['then'](function(_0x3ceefe){return{'rows':_0x3ceefe,'count':_0x3ceefe[_0x9f98('0x35')]};})['then'](respondWithResult(_0x3a5f00,null))['catch'](handleError(_0x3a5f00,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index e0aee0b..f27c857 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 _0x9330=['events','setMaxListeners','remove','emit','hook','exports'];(function(_0x1e35bd,_0x40ee90){var _0x2c379d=function(_0x347fa7){while(--_0x347fa7){_0x1e35bd['push'](_0x1e35bd['shift']());}};_0x2c379d(++_0x40ee90);}(_0x9330,0x14a));var _0x0933=function(_0x3c49fc,_0x1b8c90){_0x3c49fc=_0x3c49fc-0x0;var _0x56d37e=_0x9330[_0x3c49fc];return _0x56d37e;};'use strict';var EventEmitter=require(_0x0933('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x0933('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x0933('0x2')};function emitEvent(_0x18cf92){return function(_0x39ad54,_0x2964c7,_0x2462a4){ChatInternalMessageEvents[_0x0933('0x3')](_0x18cf92+':'+_0x39ad54['id'],_0x39ad54);ChatInternalMessageEvents[_0x0933('0x3')](_0x18cf92,_0x39ad54);_0x2462a4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x0933('0x4')](e,emitEvent(event));}}module[_0x0933('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xfd8f=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update','remove'];(function(_0x374c66,_0x47be09){var _0x19f463=function(_0x4ededf){while(--_0x4ededf){_0x374c66['push'](_0x374c66['shift']());}};_0x19f463(++_0x47be09);}(_0xfd8f,0xae));var _0xffd8=function(_0x447a26,_0x3fd123){_0x447a26=_0x447a26-0x0;var _0x2e3e63=_0xfd8f[_0x447a26];return _0x2e3e63;};'use strict';var EventEmitter=require(_0xffd8('0x0'));var ChatInternalMessage=require(_0xffd8('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xffd8('0x2')](0x0);var events={'afterCreate':_0xffd8('0x3'),'afterUpdate':_0xffd8('0x4'),'afterDestroy':_0xffd8('0x5')};function emitEvent(_0x5dcec3){return function(_0x123f30,_0x190f79,_0x50c670){ChatInternalMessageEvents[_0xffd8('0x6')](_0x5dcec3+':'+_0x123f30['id'],_0x123f30);ChatInternalMessageEvents[_0xffd8('0x6')](_0x5dcec3,_0x123f30);_0x50c670(null);};}for(var e in events){if(events[_0xffd8('0x7')](e)){var event=events[e];ChatInternalMessage[_0xffd8('0x8')](e,emitEvent(event));}}module[_0xffd8('0x9')]=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 311d8e3..316aa0c 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 _0xbaf0=['define','ChatInternalMessage','chat_internal_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports'];(function(_0x1c4a30,_0x317dd3){var _0x539e22=function(_0x4082e9){while(--_0x4082e9){_0x1c4a30['push'](_0x1c4a30['shift']());}};_0x539e22(++_0x317dd3);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x0baf('0xd')});}; \ No newline at end of file +var _0x0713=['../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x15ea09,_0x2f30ab){var _0x3e9c78=function(_0x15f8ba){while(--_0x15f8ba){_0x15ea09['push'](_0x15ea09['shift']());}};_0x3e9c78(++_0x2f30ab);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3071('0x0'))(_0x3071('0x1'));var moment=require(_0x3071('0x2'));var BPromise=require(_0x3071('0x3'));var rp=require(_0x3071('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3071('0x5'));var config=require(_0x3071('0x6'));var attributes=require(_0x3071('0x7'));module[_0x3071('0x8')]=function(_0xabd7b6,_0x41cf76){return _0xabd7b6[_0x3071('0x9')](_0x3071('0xa'),attributes,{'tableName':_0x3071('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3071('0xc'),'collate':_0x3071('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 214b80a..cd34455 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 _0x1a68=['localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code','ChatInternalMessage,\x20%s,\x20%s','message','info','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x1a68,0x128));var _0x81a6=function(_0x3bd176,_0x1e4d2e){_0x3bd176=_0x3bd176-0x0;var _0x3e2ce3=_0x1a68[_0x3bd176];return _0x3e2ce3;};'use strict';var _=require(_0x81a6('0x0'));var util=require(_0x81a6('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x81a6('0x2'));var fs=require('fs');var Redis=require(_0x81a6('0x3'));var db=require(_0x81a6('0x4'))['db'];var utils=require(_0x81a6('0x5'));var logger=require('../../config/logger')(_0x81a6('0x6'));var config=require(_0x81a6('0x7'));var jayson=require(_0x81a6('0x8'));var client=jayson[_0x81a6('0x9')][_0x81a6('0xa')]({'port':0x232a});config[_0x81a6('0xb')]=_['defaults'](config['redis'],{'host':_0x81a6('0xc'),'port':0x18eb});var socket=require(_0x81a6('0xd'))(new Redis(config[_0x81a6('0xb')]));require(_0x81a6('0xe'))[_0x81a6('0xf')](socket);function respondWithRpcPromise(_0xd5a39a,_0x5cf0a0,_0x67b708){return new BPromise(function(_0x37c2a3,_0x239bc6){return client[_0x81a6('0x10')](_0xd5a39a,_0x67b708)[_0x81a6('0x11')](function(_0x2f664a){logger['info']('ChatInternalMessage,\x20%s,\x20%s',_0x5cf0a0,_0x81a6('0x12'));logger[_0x81a6('0x13')](_0x81a6('0x14'),_0x5cf0a0,_0x81a6('0x12'),JSON['stringify'](_0x2f664a));if(_0x2f664a[_0x81a6('0x15')]){if(_0x2f664a['error'][_0x81a6('0x16')]===0x1f4){logger[_0x81a6('0x15')](_0x81a6('0x17'),_0x5cf0a0,_0x2f664a[_0x81a6('0x15')][_0x81a6('0x18')]);return _0x239bc6(_0x2f664a[_0x81a6('0x15')][_0x81a6('0x18')]);}logger['error'](_0x81a6('0x17'),_0x5cf0a0,_0x2f664a[_0x81a6('0x15')]['message']);return _0x37c2a3(_0x2f664a[_0x81a6('0x15')][_0x81a6('0x18')]);}else{logger[_0x81a6('0x19')](_0x81a6('0x17'),_0x5cf0a0,_0x81a6('0x12'));_0x37c2a3(_0x2f664a[_0x81a6('0x1a')][_0x81a6('0x18')]);}})[_0x81a6('0x1b')](function(_0x8eecf2){logger['error'](_0x81a6('0x17'),_0x5cf0a0,_0x8eecf2);_0x239bc6(_0x8eecf2);});});} \ No newline at end of file +var _0x702a=['debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatInternalMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','request','info','request\x20sent'];(function(_0x1355bd,_0x4cb6e8){var _0x550a07=function(_0x31c58a){while(--_0x31c58a){_0x1355bd['push'](_0x1355bd['shift']());}};_0x550a07(++_0x4cb6e8);}(_0x702a,0x175));var _0xa702=function(_0x4e3fca,_0x2713c8){_0x4e3fca=_0x4e3fca-0x0;var _0x367a34=_0x702a[_0x4e3fca];return _0x367a34;};'use strict';var _=require(_0xa702('0x0'));var util=require(_0xa702('0x1'));var moment=require(_0xa702('0x2'));var BPromise=require(_0xa702('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa702('0x4'))['db'];var utils=require(_0xa702('0x5'));var logger=require(_0xa702('0x6'))(_0xa702('0x7'));var config=require(_0xa702('0x8'));var jayson=require(_0xa702('0x9'));var client=jayson[_0xa702('0xa')]['http']({'port':0x232a});config[_0xa702('0xb')]=_[_0xa702('0xc')](config[_0xa702('0xb')],{'host':_0xa702('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x50c6da,_0x374b68,_0x2ba07c){return new BPromise(function(_0x5c6437,_0x2ca938){return client[_0xa702('0xe')](_0x50c6da,_0x2ba07c)['then'](function(_0x429e39){logger[_0xa702('0xf')]('ChatInternalMessage,\x20%s,\x20%s',_0x374b68,_0xa702('0x10'));logger[_0xa702('0x11')](_0xa702('0x12'),_0x374b68,_0xa702('0x10'),JSON[_0xa702('0x13')](_0x429e39));if(_0x429e39['error']){if(_0x429e39[_0xa702('0x14')][_0xa702('0x15')]===0x1f4){logger[_0xa702('0x14')](_0xa702('0x16'),_0x374b68,_0x429e39[_0xa702('0x14')]['message']);return _0x2ca938(_0x429e39[_0xa702('0x14')][_0xa702('0x17')]);}logger[_0xa702('0x14')](_0xa702('0x16'),_0x374b68,_0x429e39[_0xa702('0x14')][_0xa702('0x17')]);return _0x5c6437(_0x429e39[_0xa702('0x14')]['message']);}else{logger[_0xa702('0xf')](_0xa702('0x16'),_0x374b68,_0xa702('0x10'));_0x5c6437(_0x429e39[_0xa702('0x18')][_0xa702('0x17')]);}})[_0xa702('0x19')](function(_0x5588c6){logger[_0xa702('0x14')](_0xa702('0x16'),_0x374b68,_0x5588c6);_0x2ca938(_0x5588c6);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 31a1c07..06accab 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 _0xcf95=['./chatInternalMessage.events','save','emit','removeListener','register','length','chatInternalMessage:'];(function(_0x4c98b9,_0x1ad11b){var _0x3a257a=function(_0x147857){while(--_0x147857){_0x4c98b9['push'](_0x4c98b9['shift']());}};_0x3a257a(++_0x1ad11b);}(_0xcf95,0xa1));var _0x5cf9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf95[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInternalMessageEvents=require(_0x5cf9('0x0'));var events=[_0x5cf9('0x1'),'remove','update'];function createListener(_0x548d0c,_0x431989){return function(_0xfeb22f){_0x431989[_0x5cf9('0x2')](_0x548d0c,_0xfeb22f);};}function removeListener(_0x102b24,_0x53e2a1){return function(){ChatInternalMessageEvents[_0x5cf9('0x3')](_0x102b24,_0x53e2a1);};}exports[_0x5cf9('0x4')]=function(_0x5b060f){for(var _0x498d14=0x0,_0x1c0c3a=events[_0x5cf9('0x5')];_0x498d14<_0x1c0c3a;_0x498d14++){var _0x51acd7=events[_0x498d14];var _0x26b0de=createListener(_0x5cf9('0x6')+_0x51acd7,_0x5b060f);ChatInternalMessageEvents['on'](_0x51acd7,_0x26b0de);}}; \ No newline at end of file +var _0xad36=['remove','update','emit','register','save'];(function(_0x4d08b8,_0x34c445){var _0x70214a=function(_0x4db67c){while(--_0x4db67c){_0x4d08b8['push'](_0x4d08b8['shift']());}};_0x70214a(++_0x34c445);}(_0xad36,0x11c));var _0x6ad3=function(_0x3bc262,_0x5b4697){_0x3bc262=_0x3bc262-0x0;var _0x1d2fd8=_0xad36[_0x3bc262];return _0x1d2fd8;};'use strict';var ChatInternalMessageEvents=require('./chatInternalMessage.events');var events=[_0x6ad3('0x0'),_0x6ad3('0x1'),_0x6ad3('0x2')];function createListener(_0x1164e0,_0x32fb2f){return function(_0x35a0ee){_0x32fb2f[_0x6ad3('0x3')](_0x1164e0,_0x35a0ee);};}function removeListener(_0x17a9b2,_0x3d8fee){return function(){ChatInternalMessageEvents['removeListener'](_0x17a9b2,_0x3d8fee);};}exports[_0x6ad3('0x4')]=function(_0x3d669f){for(var _0x3c3041=0x0,_0xb38339=events['length'];_0x3c3041<_0xb38339;_0x3c3041++){var _0x5693c1=events[_0x3c3041];var _0x50913c=createListener('chatInternalMessage:'+_0x5693c1,_0x3d669f);ChatInternalMessageEvents['on'](_0x5693c1,_0x50913c);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 7d61347..e7cbea6 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 _0xb7e7=['exports','multer','path','express','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','/users','getUsers','/:id','post','create','put','update','delete'];(function(_0x135c6a,_0x43f134){var _0x5cd130=function(_0x1cf8ab){while(--_0x1cf8ab){_0x135c6a['push'](_0x135c6a['shift']());}};_0x5cd130(++_0x43f134);}(_0xb7e7,0x121));var _0x7b7e=function(_0x468b0f,_0x408566){_0x468b0f=_0x468b0f-0x0;var _0x3e74d9=_0xb7e7[_0x468b0f];return _0x3e74d9;};'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['describe']);router[_0x7b7e('0x6')](_0x7b7e('0x9'),auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xa')]);router[_0x7b7e('0x6')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['show']);router[_0x7b7e('0xc')]('/',auth[_0x7b7e('0x8')](),controller[_0x7b7e('0xd')]);router[_0x7b7e('0xe')](_0x7b7e('0xb'),controller[_0x7b7e('0xf')]);router[_0x7b7e('0x10')](_0x7b7e('0xb'),auth[_0x7b7e('0x8')](),controller['destroy']);module[_0x7b7e('0x11')]=router; \ No newline at end of file +var _0x0713=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','isAuthenticated','index','/describe','describe','/users','getUsers','/:id','show','post','put','update','delete'];(function(_0x1ca910,_0x251afe){var _0x442d18=function(_0x43ca46){while(--_0x43ca46){_0x1ca910['push'](_0x1ca910['shift']());}};_0x442d18(++_0x251afe);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3071('0x0'));var timeout=require(_0x3071('0x1'));var express=require(_0x3071('0x2'));var router=express[_0x3071('0x3')]();var auth=require(_0x3071('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3071('0x5'));var controller=require(_0x3071('0x6'));router[_0x3071('0x7')]('/',auth[_0x3071('0x8')](),controller[_0x3071('0x9')]);router[_0x3071('0x7')](_0x3071('0xa'),auth[_0x3071('0x8')](),controller[_0x3071('0xb')]);router[_0x3071('0x7')](_0x3071('0xc'),auth[_0x3071('0x8')](),controller[_0x3071('0xd')]);router['get'](_0x3071('0xe'),auth[_0x3071('0x8')](),controller[_0x3071('0xf')]);router[_0x3071('0x10')]('/',auth[_0x3071('0x8')](),controller['create']);router[_0x3071('0x11')](_0x3071('0xe'),controller[_0x3071('0x12')]);router[_0x3071('0x13')](_0x3071('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3071('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index c68af27..c6f559d 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 _0x8bf1=['exports','TEXT','medium','BOOLEAN','out','sequelize'];(function(_0x40b578,_0xc5da1a){var _0x2c9cc1=function(_0x442b52){while(--_0x442b52){_0x40b578['push'](_0x40b578['shift']());}};_0x2c9cc1(++_0xc5da1a);}(_0x8bf1,0x1d9));var _0x18bf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8bf1[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x18bf('0x0'));module[_0x18bf('0x1')]={'body':{'type':Sequelize[_0x18bf('0x2')](_0x18bf('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x18bf('0x4')],'defaultValue':![]},'secret':{'type':Sequelize[_0x18bf('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x18bf('0x5')),'defaultValue':_0x18bf('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xb158=['out','DATE','sequelize','exports','TEXT','ENUM'];(function(_0x42fb16,_0x39fd7a){var _0x53a6ff=function(_0x1f0eca){while(--_0x1f0eca){_0x42fb16['push'](_0x42fb16['shift']());}};_0x53a6ff(++_0x39fd7a);}(_0xb158,0x92));var _0x8b15=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb158[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x8b15('0x0'));module[_0x8b15('0x1')]={'body':{'type':Sequelize[_0x8b15('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b15('0x3')]('in',_0x8b15('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x8b15('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 4182fb3..92f534f 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 _0x1030=['jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','info','catch','sendStatus','status','offset','set','Content-Range','json','apply','update','end','stack','send','map','ChatMessage','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','fields','attributes','nolimit','limit','order','sort','filter','where','VIRTUAL','merge','options','count','findAll','rows','show','params','keys','includeAll','find','create','body','destroy','describe','../../config/logger','chat-interactions','accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','ChatInteraction','ChatInteractionId','isNil','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','AcceptMessage','acceptMessage','manual','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','reject','RejectMessage','interface','rejectmessage','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto'];(function(_0x5e9f73,_0x2ec54e){var _0x5e6185=function(_0x416d49){while(--_0x416d49){_0x5e9f73['push'](_0x5e9f73['shift']());}};_0x5e6185(++_0x2ec54e);}(_0x1030,0x15f));var _0x0103=function(_0x45d97d,_0x1d1008){_0x45d97d=_0x45d97d-0x0;var _0x2f9233=_0x1030[_0x45d97d];return _0x2f9233;};'use strict';var pdf=require(_0x0103('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0103('0x1'));var jsonpatch=require(_0x0103('0x2'));var rp=require(_0x0103('0x3'));var moment=require(_0x0103('0x4'));var BPromise=require(_0x0103('0x5'));var Mustache=require(_0x0103('0x6'));var util=require('util');var path=require(_0x0103('0x7'));var sox=require(_0x0103('0x8'));var csv=require(_0x0103('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0103('0xa'));var squel=require('squel');var crypto=require(_0x0103('0xb'));var jsforce=require(_0x0103('0xc'));var deskjs=require(_0x0103('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0103('0xe'));var Papa=require('papaparse');var Redis=require(_0x0103('0xf'));var authService=require(_0x0103('0x10'));var qs=require(_0x0103('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0103('0x12'));var db=require(_0x0103('0x13'))['db'];config[_0x0103('0x14')]=_['defaults'](config[_0x0103('0x14')],{'host':_0x0103('0x15'),'port':0x18eb});var socket=require(_0x0103('0x16'))(new Redis(config[_0x0103('0x14')]));require('./chatMessage.socket')[_0x0103('0x17')](socket);var jayson=require(_0x0103('0x18'));var client=jayson[_0x0103('0x19')][_0x0103('0x1a')]({'port':0x232c});var client9002=jayson[_0x0103('0x19')][_0x0103('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3d3ef6,_0x59887d,_0x5a0dcd){if(_0x5a0dcd){var _0x5ba2cc=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5ba2cc[_0x0103('0x1b')](_0x59887d)){return _0x3d3ef6;}else{throw new db[(_0x0103('0x1c'))][(_0x0103('0x1d'))](_0x0103('0x1e'));}}else{return _0x3d3ef6;}}function respondWithRpcPromise(_0x229cd2,_0x1ea73a,_0x153fce,_0xad74f0){return new BPromise(function(_0x452128,_0x34c71d){var _0x41e99d=_0xad74f0||client;return _0x41e99d['request'](_0x229cd2,_0x153fce)[_0x0103('0x1f')](function(_0x21a38e){logger['info']('ChatMessage,\x20%s,\x20%s',_0x1ea73a,_0x0103('0x20'));logger[_0x0103('0x21')](_0x0103('0x22'),_0x1ea73a,'request\x20sent',JSON[_0x0103('0x23')](_0x21a38e));if(_0x21a38e[_0x0103('0x24')]){if(_0x21a38e[_0x0103('0x24')][_0x0103('0x25')]===0x1f4){logger[_0x0103('0x24')]('ChatMessage,\x20%s,\x20%s',_0x1ea73a,_0x21a38e[_0x0103('0x24')][_0x0103('0x26')]);return _0x34c71d(_0x21a38e[_0x0103('0x24')][_0x0103('0x26')]);}logger['error'](_0x0103('0x27'),_0x1ea73a,_0x21a38e[_0x0103('0x24')][_0x0103('0x26')]);return _0x452128(_0x21a38e[_0x0103('0x24')]['message']);}else{logger[_0x0103('0x28')](_0x0103('0x27'),_0x1ea73a,'request\x20sent');_0x452128(_0x21a38e['result'][_0x0103('0x26')]);}})[_0x0103('0x29')](function(_0x4f99e0){logger['error']('ChatMessage,\x20%s,\x20%s',_0x1ea73a,_0x4f99e0);_0x34c71d(_0x4f99e0);});});}function respondWithStatusCode(_0x1df590,_0x2c4680){_0x2c4680=_0x2c4680||0xcc;return function(_0x4b67a5){if(_0x4b67a5){return _0x1df590[_0x0103('0x2a')](_0x2c4680);}return _0x1df590[_0x0103('0x2b')](_0x2c4680)['end']();};}function respondWithResult(_0x8afe0f,_0x6d0e7c){_0x6d0e7c=_0x6d0e7c||0xc8;return function(_0x3ec1d4){if(_0x3ec1d4){return _0x8afe0f['status'](_0x6d0e7c)['json'](_0x3ec1d4);}};}function respondWithFilteredResult(_0x197604,_0x188ea5){return function(_0x31022b){if(_0x31022b){var _0x4f6c57=_0x31022b['count'],_0x36ed5d=_0x188ea5[_0x0103('0x2c')],_0xf03268=_0x188ea5[_0x0103('0x2c')]+_0x188ea5['limit'],_0x1bba77;if(_0xf03268>=_0x4f6c57){_0xf03268=_0x4f6c57;_0x1bba77=0xc8;}else{_0x1bba77=0xce;}_0x197604[_0x0103('0x2b')](_0x1bba77);return _0x197604[_0x0103('0x2d')](_0x0103('0x2e'),_0x36ed5d+'-'+_0xf03268+'/'+_0x4f6c57)[_0x0103('0x2f')](_0x31022b);}return null;};}function patchUpdates(_0x2458b7){return function(_0x539a74){try{jsonpatch[_0x0103('0x30')](_0x539a74,_0x2458b7,!![]);}catch(_0x296760){return BPromise['reject'](_0x296760);}return _0x539a74['save']();};}function saveUpdates(_0xdb1b64,_0x19c44a){return function(_0x59c06d){if(_0x59c06d){return _0x59c06d[_0x0103('0x31')](_0xdb1b64)[_0x0103('0x1f')](function(_0x3f1147){return _0x3f1147;});}return null;};}function removeEntity(_0x21b35e,_0x250cd7){return function(_0xc51f93){if(_0xc51f93){return _0xc51f93['destroy']()['then'](function(){_0x21b35e[_0x0103('0x2b')](0xcc)[_0x0103('0x32')]();});}};}function handleEntityNotFound(_0x202a23,_0x596950){return function(_0x5c1096){if(!_0x5c1096){_0x202a23[_0x0103('0x2a')](0x194);}return _0x5c1096;};}function handleError(_0x396ad0,_0x4a47f3){_0x4a47f3=_0x4a47f3||0x1f4;return function(_0x5c1bf9){logger[_0x0103('0x24')](_0x5c1bf9[_0x0103('0x33')]);if(_0x5c1bf9['name']){delete _0x5c1bf9['name'];}_0x396ad0[_0x0103('0x2b')](_0x4a47f3)[_0x0103('0x34')](_0x5c1bf9);};}exports['index']=function(_0x20b742,_0x5b1f2d){var _0x5d86fa={},_0x39e185={},_0x2c1b8c={'count':0x0,'rows':[]};var _0x312302=_[_0x0103('0x35')](db[_0x0103('0x36')][_0x0103('0x37')],function(_0x1620b){return{'name':_0x1620b[_0x0103('0x38')],'type':_0x1620b[_0x0103('0x39')][_0x0103('0x3a')]};});_0x39e185[_0x0103('0x3b')]=_[_0x0103('0x35')](_0x312302,_0x0103('0x3c'));_0x39e185[_0x0103('0x3d')]=_['keys'](_0x20b742['query']);_0x39e185[_0x0103('0x3e')]=_['intersection'](_0x39e185[_0x0103('0x3b')],_0x39e185[_0x0103('0x3d')]);_0x5d86fa['attributes']=_[_0x0103('0x3f')](_0x39e185[_0x0103('0x3b')],qs[_0x0103('0x40')](_0x20b742['query'][_0x0103('0x40')]));_0x5d86fa[_0x0103('0x41')]=_0x5d86fa[_0x0103('0x41')]['length']?_0x5d86fa[_0x0103('0x41')]:_0x39e185[_0x0103('0x3b')];if(!_0x20b742[_0x0103('0x3d')]['hasOwnProperty'](_0x0103('0x42'))){_0x5d86fa['limit']=qs[_0x0103('0x43')](_0x20b742[_0x0103('0x3d')][_0x0103('0x43')]);_0x5d86fa[_0x0103('0x2c')]=qs[_0x0103('0x2c')](_0x20b742['query']['offset']);}_0x5d86fa[_0x0103('0x44')]=qs[_0x0103('0x45')](_0x20b742[_0x0103('0x3d')]['sort']);_0x5d86fa['where']=qs[_0x0103('0x3e')](_['pick'](_0x20b742['query'],_0x39e185['filters']));if(_0x20b742[_0x0103('0x3d')][_0x0103('0x46')]){_0x5d86fa[_0x0103('0x47')]=_['merge'](_0x5d86fa[_0x0103('0x47')],{'$or':_['map'](_0x312302,function(_0x1e7d4f){if(_0x1e7d4f[_0x0103('0x39')]!==_0x0103('0x48')){var _0x262578={};_0x262578[_0x1e7d4f[_0x0103('0x3c')]]={'$like':'%'+_0x20b742[_0x0103('0x3d')][_0x0103('0x46')]+'%'};return _0x262578;}})});}_0x5d86fa=_[_0x0103('0x49')]({},_0x5d86fa,_0x20b742[_0x0103('0x4a')]);var _0x48e3b9={'where':_0x5d86fa['where']};return db[_0x0103('0x36')][_0x0103('0x4b')](_0x48e3b9)[_0x0103('0x1f')](function(_0xf39121){_0x2c1b8c[_0x0103('0x4b')]=_0xf39121;if(_0x20b742[_0x0103('0x3d')]['includeAll']){_0x5d86fa['include']=[{'all':!![]}];}return db[_0x0103('0x36')][_0x0103('0x4c')](_0x5d86fa);})['then'](function(_0x4331d3){_0x2c1b8c[_0x0103('0x4d')]=_0x4331d3;return _0x2c1b8c;})[_0x0103('0x1f')](respondWithFilteredResult(_0x5b1f2d,_0x5d86fa))[_0x0103('0x29')](handleError(_0x5b1f2d,null));};exports[_0x0103('0x4e')]=function(_0x42268d,_0xda1cd1){var _0x260426={'raw':!![],'where':{'id':_0x42268d[_0x0103('0x4f')]['id']}},_0x3e7b70={};_0x3e7b70[_0x0103('0x3b')]=_[_0x0103('0x50')](db[_0x0103('0x36')][_0x0103('0x37')]);_0x3e7b70['query']=_[_0x0103('0x50')](_0x42268d['query']);_0x3e7b70[_0x0103('0x3e')]=_['intersection'](_0x3e7b70[_0x0103('0x3b')],_0x3e7b70[_0x0103('0x3d')]);_0x260426[_0x0103('0x41')]=_['intersection'](_0x3e7b70[_0x0103('0x3b')],qs[_0x0103('0x40')](_0x42268d[_0x0103('0x3d')]['fields']));_0x260426[_0x0103('0x41')]=_0x260426['attributes']['length']?_0x260426['attributes']:_0x3e7b70[_0x0103('0x3b')];if(_0x42268d['query'][_0x0103('0x51')]){_0x260426['include']=[{'all':!![]}];}_0x260426=_[_0x0103('0x49')]({},_0x260426,_0x42268d[_0x0103('0x4a')]);return db[_0x0103('0x36')][_0x0103('0x52')](_0x260426)[_0x0103('0x1f')](handleEntityNotFound(_0xda1cd1,null))[_0x0103('0x1f')](respondWithResult(_0xda1cd1,null))[_0x0103('0x29')](handleError(_0xda1cd1,null));};exports[_0x0103('0x53')]=function(_0x53390c,_0x3eefb6){return db[_0x0103('0x36')][_0x0103('0x53')](_0x53390c[_0x0103('0x54')],{})[_0x0103('0x1f')](respondWithResult(_0x3eefb6,0xc9))[_0x0103('0x29')](handleError(_0x3eefb6,null));};exports['update']=function(_0x40d07d,_0x50105a){if(_0x40d07d[_0x0103('0x54')]['id']){delete _0x40d07d[_0x0103('0x54')]['id'];}return db[_0x0103('0x36')]['find']({'where':{'id':_0x40d07d[_0x0103('0x4f')]['id']}})[_0x0103('0x1f')](handleEntityNotFound(_0x50105a,null))[_0x0103('0x1f')](saveUpdates(_0x40d07d['body'],null))['then'](respondWithResult(_0x50105a,null))[_0x0103('0x29')](handleError(_0x50105a,null));};exports[_0x0103('0x55')]=function(_0x481a21,_0x1f0c5e){return db[_0x0103('0x36')]['find']({'where':{'id':_0x481a21[_0x0103('0x4f')]['id']}})[_0x0103('0x1f')](handleEntityNotFound(_0x1f0c5e,null))['then'](removeEntity(_0x1f0c5e,null))['catch'](handleError(_0x1f0c5e,null));};exports['describe']=function(_0x45cd20,_0x3dc4e7){return db[_0x0103('0x36')][_0x0103('0x56')]()[_0x0103('0x1f')](respondWithResult(_0x3dc4e7,null))[_0x0103('0x29')](handleError(_0x3dc4e7,null));};var interaction_log=require(_0x0103('0x57'))(_0x0103('0x58'));exports[_0x0103('0x59')]=function(_0xe60d50,_0x48c987,_0x363b83){var _0x92b4e0={'channel':_0x0103('0x5a')};if(_0xe60d50[_0x0103('0x54')]['id']){delete _0xe60d50[_0x0103('0x54')]['id'];}_0xe60d50[_0x0103('0x54')]['read']=!![];_0xe60d50[_0x0103('0x54')][_0x0103('0x5b')]=moment()[_0x0103('0x5c')](_0x0103('0x5d'));_0xe60d50['body']['UserId']=_0xe60d50[_0x0103('0x54')][_0x0103('0x5e')]||_0xe60d50[_0x0103('0x5f')]['id'];return db[_0x0103('0x36')][_0x0103('0x52')]({'where':{'id':_0xe60d50['params']['id'],'UserId':null},'include':[{'model':db[_0x0103('0x60')],'as':_0x0103('0x61')}]})['then'](handleEntityNotFound(_0x48c987,null))['then'](saveUpdates(_0xe60d50['body'],null))['then'](function(_0x27759b){if(_0x27759b){_0x92b4e0[_0x0103('0x26')]=_0x27759b[_0x0103('0x62')]({'plain':!![]});return db[_0x0103('0x63')]['find']({'where':{'id':_0x27759b[_0x0103('0x64')]}});}return null;})[_0x0103('0x1f')](handleEntityNotFound(_0x48c987,null))[_0x0103('0x1f')](function(_0x390738){if(_0x390738){return _0x390738['update']({'UserId':_0xe60d50[_0x0103('0x54')][_0x0103('0x5e')],'read1stAt':_[_0x0103('0x65')](_0x390738[_0x0103('0x66')])?moment()[_0x0103('0x5c')](_0x0103('0x5d')):undefined});}return null;})['then'](function(_0x1b048c){if(_0x1b048c){_0x92b4e0['interaction']=_0x1b048c[_0x0103('0x62')]({'plain':!![]});interaction_log[_0x0103('0x28')](_0x0103('0x67'),_0xe60d50['user']['id'],_0xe60d50['user'][_0x0103('0x3c')],_0xe60d50['user'][_0x0103('0x68')],_0x92b4e0[_0x0103('0x69')]['id'],_0xe60d50[_0x0103('0x54')]?JSON[_0x0103('0x23')](_0xe60d50[_0x0103('0x54')]):_0x0103('0x6a'));return respondWithRpcPromise(_0x0103('0x6b'),_0x0103('0x6c'),_0x92b4e0);}return null;})[_0x0103('0x1f')](function(_0x2d0b3a){if(_0x2d0b3a){if(_0xe60d50[_0x0103('0x54')][_0x0103('0x6d')]){_0x92b4e0[_0x0103('0x26')]['interface']=util[_0x0103('0x5c')](_0x0103('0x6e'),_0xe60d50['user'][_0x0103('0x3c')]);_0x92b4e0[_0x0103('0x26')][_0x0103('0x6f')]=_0x92b4e0['channel'];_0x92b4e0[_0x0103('0x26')][_0x0103('0x70')]=_0x0103('0x59');return respondWithRpcPromise(_0x0103('0x71'),'EventManager',{'event':_0x0103('0x72'),'message':_[_0x0103('0x49')](_0x92b4e0[_0x0103('0x26')],JSON[_0x0103('0x73')](_0x92b4e0['interaction'][_0x0103('0x74')]))},client9002)[_0x0103('0x1f')](function(){return _0x92b4e0;});}return _0x92b4e0;}return null;})[_0x0103('0x1f')](respondWithResult(_0x48c987,null))[_0x0103('0x29')](handleError(_0x48c987,null));};var interaction_log=require(_0x0103('0x57'))(_0x0103('0x58'));exports[_0x0103('0x75')]=function(_0x5eea71,_0x5235ad,_0x28ec8f){var _0x418277={'agent':{},'channel':'chat'};if(_0x5eea71['body']['id']){delete _0x5eea71['body']['id'];}_0x5eea71[_0x0103('0x54')][_0x0103('0x5e')]=_0x5eea71[_0x0103('0x54')][_0x0103('0x5e')]||_0x5eea71[_0x0103('0x5f')]['id'];_0x418277['agent']['id']=_0x5eea71[_0x0103('0x54')]['UserId'];return db[_0x0103('0x36')][_0x0103('0x52')]({'where':{'id':_0x5eea71[_0x0103('0x4f')]['id'],'UserId':null}})[_0x0103('0x1f')](handleEntityNotFound(_0x5235ad,null))[_0x0103('0x1f')](function(_0x5e94e6){if(_0x5e94e6){_0x418277[_0x0103('0x26')]=_0x5e94e6[_0x0103('0x62')]({'plain':!![]});return db['ChatInteraction']['find']({'where':{'id':_0x5e94e6[_0x0103('0x64')]}});}return null;})[_0x0103('0x1f')](handleEntityNotFound(_0x5235ad,null))[_0x0103('0x1f')](function(_0x1e95d9){if(_0x1e95d9){_0x418277['interaction']=_0x1e95d9[_0x0103('0x62')]({'plain':!![]});interaction_log[_0x0103('0x28')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x5eea71[_0x0103('0x5f')]['id'],_0x5eea71[_0x0103('0x5f')][_0x0103('0x3c')],_0x5eea71['user'][_0x0103('0x68')],_0x418277[_0x0103('0x69')]['id'],_0x5eea71[_0x0103('0x54')]?JSON['stringify'](_0x5eea71[_0x0103('0x54')]):'null');return respondWithRpcPromise(_0x0103('0x76'),'rejectMessage',_0x418277);}return null;})[_0x0103('0x1f')](function(_0xfc8ec){if(_0xfc8ec){_0xfc8ec[_0x0103('0x26')][_0x0103('0x77')]=util[_0x0103('0x5c')](_0x0103('0x6e'),_0x5eea71['user'][_0x0103('0x3c')]);_0xfc8ec['message']['channel']=_0x418277[_0x0103('0x6f')];_0xfc8ec['message'][_0x0103('0x70')]=_0x0103('0x75');respondWithRpcPromise(_0x0103('0x71'),_0x0103('0x71'),{'event':_0x0103('0x78'),'message':_0xfc8ec[_0x0103('0x26')]},client9002);return _0x418277;}return null;})[_0x0103('0x1f')](respondWithResult(_0x5235ad,null))['catch'](handleError(_0x5235ad,null));}; \ No newline at end of file +var _0xd338=['desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','jayson/promise','client','http','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','ChatMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','save','then','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','keys','create','body','find','describe','chat-interactions','chat','read','readAt','format','UserId','CmContact','Contact','get','ChatInteractionId','update','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','AcceptMessage','manual','interface','SIP/%s','channel','event','accept','acceptmessage','parse','reject','ChatInteraction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','EventManager','rejectmessage','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','crypto','jsforce'];(function(_0x1c9c91,_0x16eccb){var _0x1f3215=function(_0x466ebd){while(--_0x466ebd){_0x1c9c91['push'](_0x1c9c91['shift']());}};_0x1f3215(++_0x16eccb);}(_0xd338,0x73));var _0x8d33=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xd338[_0x1a36a5];return _0x746243;};'use strict';var pdf=require(_0x8d33('0x0'));var emlformat=require(_0x8d33('0x1'));var rimraf=require(_0x8d33('0x2'));var zipdir=require(_0x8d33('0x3'));var jsonpatch=require(_0x8d33('0x4'));var rp=require(_0x8d33('0x5'));var moment=require(_0x8d33('0x6'));var BPromise=require(_0x8d33('0x7'));var Mustache=require('mustache');var util=require(_0x8d33('0x8'));var path=require(_0x8d33('0x9'));var sox=require(_0x8d33('0xa'));var csv=require(_0x8d33('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d33('0xc'));var squel=require('squel');var crypto=require(_0x8d33('0xd'));var jsforce=require(_0x8d33('0xe'));var deskjs=require(_0x8d33('0xf'));var toCsv=require(_0x8d33('0xb'));var querystring=require(_0x8d33('0x10'));var Papa=require('papaparse');var Redis=require(_0x8d33('0x11'));var authService=require(_0x8d33('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x8d33('0x13'));var hardwareService=require(_0x8d33('0x14'));var logger=require(_0x8d33('0x15'))(_0x8d33('0x16'));var utils=require(_0x8d33('0x17'));var config=require(_0x8d33('0x18'));var db=require(_0x8d33('0x19'))['db'];config['redis']=_[_0x8d33('0x1a')](config[_0x8d33('0x1b')],{'host':_0x8d33('0x1c'),'port':0x18eb});var socket=require(_0x8d33('0x1d'))(new Redis(config[_0x8d33('0x1b')]));require(_0x8d33('0x1e'))[_0x8d33('0x1f')](socket);var jayson=require(_0x8d33('0x20'));var client=jayson[_0x8d33('0x21')][_0x8d33('0x22')]({'port':0x232c});var client9002=jayson[_0x8d33('0x21')][_0x8d33('0x22')]({'port':0x232a});function checkPasswordPattern(_0x47b423,_0x2d997c,_0x2c938e){if(_0x2c938e){var _0x483295=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x483295['test'](_0x2d997c)){return _0x47b423;}else{throw new db['Sequelize'][(_0x8d33('0x23'))](_0x8d33('0x24'));}}else{return _0x47b423;}}function respondWithRpcPromise(_0x2f41a2,_0x203b0f,_0x4afbda,_0x187d39){return new BPromise(function(_0x15f942,_0x3b0265){var _0x3feaa5=_0x187d39||client;return _0x3feaa5[_0x8d33('0x25')](_0x2f41a2,_0x4afbda)['then'](function(_0x4483a0){logger[_0x8d33('0x26')](_0x8d33('0x27'),_0x203b0f,'request\x20sent');logger[_0x8d33('0x28')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x203b0f,_0x8d33('0x29'),JSON[_0x8d33('0x2a')](_0x4483a0));if(_0x4483a0[_0x8d33('0x2b')]){if(_0x4483a0[_0x8d33('0x2b')][_0x8d33('0x2c')]===0x1f4){logger['error'](_0x8d33('0x27'),_0x203b0f,_0x4483a0[_0x8d33('0x2b')][_0x8d33('0x2d')]);return _0x3b0265(_0x4483a0[_0x8d33('0x2b')][_0x8d33('0x2d')]);}logger[_0x8d33('0x2b')]('ChatMessage,\x20%s,\x20%s',_0x203b0f,_0x4483a0[_0x8d33('0x2b')][_0x8d33('0x2d')]);return _0x15f942(_0x4483a0[_0x8d33('0x2b')][_0x8d33('0x2d')]);}else{logger['info'](_0x8d33('0x27'),_0x203b0f,'request\x20sent');_0x15f942(_0x4483a0['result']['message']);}})[_0x8d33('0x2e')](function(_0x5cd75e){logger[_0x8d33('0x2b')](_0x8d33('0x27'),_0x203b0f,_0x5cd75e);_0x3b0265(_0x5cd75e);});});}function respondWithStatusCode(_0x4c1dba,_0x186814){_0x186814=_0x186814||0xcc;return function(_0x4b038c){if(_0x4b038c){return _0x4c1dba[_0x8d33('0x2f')](_0x186814);}return _0x4c1dba['status'](_0x186814)[_0x8d33('0x30')]();};}function respondWithResult(_0x258ef2,_0x125cea){_0x125cea=_0x125cea||0xc8;return function(_0x3bd8c0){if(_0x3bd8c0){return _0x258ef2[_0x8d33('0x31')](_0x125cea)[_0x8d33('0x32')](_0x3bd8c0);}};}function respondWithFilteredResult(_0x3a82bd,_0x5380c3){return function(_0x401333){if(_0x401333){var _0x4de6d8=_0x401333[_0x8d33('0x33')],_0x4fe7b2=_0x5380c3[_0x8d33('0x34')],_0x1d7ad8=_0x5380c3[_0x8d33('0x34')]+_0x5380c3['limit'],_0x3d2aa;if(_0x1d7ad8>=_0x4de6d8){_0x1d7ad8=_0x4de6d8;_0x3d2aa=0xc8;}else{_0x3d2aa=0xce;}_0x3a82bd[_0x8d33('0x31')](_0x3d2aa);return _0x3a82bd[_0x8d33('0x35')](_0x8d33('0x36'),_0x4fe7b2+'-'+_0x1d7ad8+'/'+_0x4de6d8)['json'](_0x401333);}return null;};}function patchUpdates(_0x283d76){return function(_0x5d5eae){try{jsonpatch[_0x8d33('0x37')](_0x5d5eae,_0x283d76,!![]);}catch(_0x2510aa){return BPromise['reject'](_0x2510aa);}return _0x5d5eae[_0x8d33('0x38')]();};}function saveUpdates(_0x5a3956,_0xd094bd){return function(_0x48cb7b){if(_0x48cb7b){return _0x48cb7b['update'](_0x5a3956)[_0x8d33('0x39')](function(_0x2c4621){return _0x2c4621;});}return null;};}function removeEntity(_0x105923,_0x1a4656){return function(_0x1f2246){if(_0x1f2246){return _0x1f2246[_0x8d33('0x3a')]()['then'](function(){_0x105923['status'](0xcc)[_0x8d33('0x30')]();});}};}function handleEntityNotFound(_0xead132,_0x4bbade){return function(_0x2194df){if(!_0x2194df){_0xead132[_0x8d33('0x2f')](0x194);}return _0x2194df;};}function handleError(_0x504744,_0x27b6c7){_0x27b6c7=_0x27b6c7||0x1f4;return function(_0x2b290a){logger[_0x8d33('0x2b')](_0x2b290a[_0x8d33('0x3b')]);if(_0x2b290a['name']){delete _0x2b290a[_0x8d33('0x3c')];}_0x504744[_0x8d33('0x31')](_0x27b6c7)[_0x8d33('0x3d')](_0x2b290a);};}exports[_0x8d33('0x3e')]=function(_0x1b1165,_0x53aab8){var _0x3a683b={},_0x182c5a={},_0x49673f={'count':0x0,'rows':[]};var _0x49903b=_[_0x8d33('0x3f')](db[_0x8d33('0x40')][_0x8d33('0x41')],function(_0x4aacb2){return{'name':_0x4aacb2[_0x8d33('0x42')],'type':_0x4aacb2[_0x8d33('0x43')]['key']};});_0x182c5a['model']=_[_0x8d33('0x3f')](_0x49903b,'name');_0x182c5a[_0x8d33('0x44')]=_['keys'](_0x1b1165[_0x8d33('0x44')]);_0x182c5a[_0x8d33('0x45')]=_[_0x8d33('0x46')](_0x182c5a[_0x8d33('0x47')],_0x182c5a[_0x8d33('0x44')]);_0x3a683b[_0x8d33('0x48')]=_[_0x8d33('0x46')](_0x182c5a['model'],qs[_0x8d33('0x49')](_0x1b1165[_0x8d33('0x44')][_0x8d33('0x49')]));_0x3a683b['attributes']=_0x3a683b[_0x8d33('0x48')][_0x8d33('0x4a')]?_0x3a683b[_0x8d33('0x48')]:_0x182c5a[_0x8d33('0x47')];if(!_0x1b1165[_0x8d33('0x44')][_0x8d33('0x4b')]('nolimit')){_0x3a683b[_0x8d33('0x4c')]=qs['limit'](_0x1b1165[_0x8d33('0x44')]['limit']);_0x3a683b['offset']=qs[_0x8d33('0x34')](_0x1b1165[_0x8d33('0x44')][_0x8d33('0x34')]);}_0x3a683b[_0x8d33('0x4d')]=qs[_0x8d33('0x4e')](_0x1b1165[_0x8d33('0x44')][_0x8d33('0x4e')]);_0x3a683b[_0x8d33('0x4f')]=qs[_0x8d33('0x45')](_['pick'](_0x1b1165[_0x8d33('0x44')],_0x182c5a['filters']));if(_0x1b1165[_0x8d33('0x44')]['filter']){_0x3a683b[_0x8d33('0x4f')]=_[_0x8d33('0x50')](_0x3a683b[_0x8d33('0x4f')],{'$or':_[_0x8d33('0x3f')](_0x49903b,function(_0x4f4d42){if(_0x4f4d42[_0x8d33('0x43')]!==_0x8d33('0x51')){var _0xc5de41={};_0xc5de41[_0x4f4d42[_0x8d33('0x3c')]]={'$like':'%'+_0x1b1165[_0x8d33('0x44')][_0x8d33('0x52')]+'%'};return _0xc5de41;}})});}_0x3a683b=_[_0x8d33('0x50')]({},_0x3a683b,_0x1b1165[_0x8d33('0x53')]);var _0x57ed97={'where':_0x3a683b[_0x8d33('0x4f')]};return db['ChatMessage'][_0x8d33('0x33')](_0x57ed97)[_0x8d33('0x39')](function(_0x236ebc){_0x49673f[_0x8d33('0x33')]=_0x236ebc;if(_0x1b1165[_0x8d33('0x44')][_0x8d33('0x54')]){_0x3a683b[_0x8d33('0x55')]=[{'all':!![]}];}return db['ChatMessage'][_0x8d33('0x56')](_0x3a683b);})[_0x8d33('0x39')](function(_0x30c953){_0x49673f[_0x8d33('0x57')]=_0x30c953;return _0x49673f;})[_0x8d33('0x39')](respondWithFilteredResult(_0x53aab8,_0x3a683b))[_0x8d33('0x2e')](handleError(_0x53aab8,null));};exports[_0x8d33('0x58')]=function(_0xe3212,_0x5e0a93){var _0x13059a={'raw':!![],'where':{'id':_0xe3212[_0x8d33('0x59')]['id']}},_0x2bef07={};_0x2bef07[_0x8d33('0x47')]=_[_0x8d33('0x5a')](db['ChatMessage'][_0x8d33('0x41')]);_0x2bef07[_0x8d33('0x44')]=_[_0x8d33('0x5a')](_0xe3212['query']);_0x2bef07[_0x8d33('0x45')]=_[_0x8d33('0x46')](_0x2bef07[_0x8d33('0x47')],_0x2bef07['query']);_0x13059a[_0x8d33('0x48')]=_[_0x8d33('0x46')](_0x2bef07[_0x8d33('0x47')],qs['fields'](_0xe3212[_0x8d33('0x44')][_0x8d33('0x49')]));_0x13059a[_0x8d33('0x48')]=_0x13059a[_0x8d33('0x48')]['length']?_0x13059a['attributes']:_0x2bef07[_0x8d33('0x47')];if(_0xe3212[_0x8d33('0x44')][_0x8d33('0x54')]){_0x13059a['include']=[{'all':!![]}];}_0x13059a=_[_0x8d33('0x50')]({},_0x13059a,_0xe3212[_0x8d33('0x53')]);return db['ChatMessage']['find'](_0x13059a)['then'](handleEntityNotFound(_0x5e0a93,null))[_0x8d33('0x39')](respondWithResult(_0x5e0a93,null))[_0x8d33('0x2e')](handleError(_0x5e0a93,null));};exports[_0x8d33('0x5b')]=function(_0x43ffd5,_0x564a9e){return db[_0x8d33('0x40')][_0x8d33('0x5b')](_0x43ffd5[_0x8d33('0x5c')],{})[_0x8d33('0x39')](respondWithResult(_0x564a9e,0xc9))['catch'](handleError(_0x564a9e,null));};exports['update']=function(_0x58f141,_0x2a0b22){if(_0x58f141[_0x8d33('0x5c')]['id']){delete _0x58f141[_0x8d33('0x5c')]['id'];}return db[_0x8d33('0x40')][_0x8d33('0x5d')]({'where':{'id':_0x58f141[_0x8d33('0x59')]['id']}})['then'](handleEntityNotFound(_0x2a0b22,null))[_0x8d33('0x39')](saveUpdates(_0x58f141[_0x8d33('0x5c')],null))[_0x8d33('0x39')](respondWithResult(_0x2a0b22,null))[_0x8d33('0x2e')](handleError(_0x2a0b22,null));};exports[_0x8d33('0x3a')]=function(_0x4c73a8,_0xf0e6d4){return db[_0x8d33('0x40')][_0x8d33('0x5d')]({'where':{'id':_0x4c73a8['params']['id']}})[_0x8d33('0x39')](handleEntityNotFound(_0xf0e6d4,null))[_0x8d33('0x39')](removeEntity(_0xf0e6d4,null))[_0x8d33('0x2e')](handleError(_0xf0e6d4,null));};exports[_0x8d33('0x5e')]=function(_0xf28598,_0x5d894f){return db[_0x8d33('0x40')][_0x8d33('0x5e')]()[_0x8d33('0x39')](respondWithResult(_0x5d894f,null))[_0x8d33('0x2e')](handleError(_0x5d894f,null));};var interaction_log=require(_0x8d33('0x15'))(_0x8d33('0x5f'));exports['accept']=function(_0x10f025,_0x532ffc,_0x505408){var _0x47e799={'channel':_0x8d33('0x60')};if(_0x10f025[_0x8d33('0x5c')]['id']){delete _0x10f025[_0x8d33('0x5c')]['id'];}_0x10f025[_0x8d33('0x5c')][_0x8d33('0x61')]=!![];_0x10f025[_0x8d33('0x5c')][_0x8d33('0x62')]=moment()[_0x8d33('0x63')]('YYYY-MM-DD\x20HH:mm:ss');_0x10f025[_0x8d33('0x5c')][_0x8d33('0x64')]=_0x10f025[_0x8d33('0x5c')]['UserId']||_0x10f025['user']['id'];return db[_0x8d33('0x40')]['find']({'where':{'id':_0x10f025['params']['id'],'UserId':null},'include':[{'model':db[_0x8d33('0x65')],'as':_0x8d33('0x66')}]})[_0x8d33('0x39')](handleEntityNotFound(_0x532ffc,null))['then'](saveUpdates(_0x10f025[_0x8d33('0x5c')],null))[_0x8d33('0x39')](function(_0x4068c7){if(_0x4068c7){_0x47e799[_0x8d33('0x2d')]=_0x4068c7[_0x8d33('0x67')]({'plain':!![]});return db['ChatInteraction'][_0x8d33('0x5d')]({'where':{'id':_0x4068c7[_0x8d33('0x68')]}});}return null;})[_0x8d33('0x39')](handleEntityNotFound(_0x532ffc,null))[_0x8d33('0x39')](function(_0x120271){if(_0x120271){return _0x120271[_0x8d33('0x69')]({'UserId':_0x10f025[_0x8d33('0x5c')][_0x8d33('0x64')],'read1stAt':_[_0x8d33('0x6a')](_0x120271[_0x8d33('0x6b')])?moment()[_0x8d33('0x63')](_0x8d33('0x6c')):undefined});}return null;})['then'](function(_0x19b5fb){if(_0x19b5fb){_0x47e799[_0x8d33('0x6d')]=_0x19b5fb['get']({'plain':!![]});interaction_log[_0x8d33('0x26')](_0x8d33('0x6e'),_0x10f025[_0x8d33('0x6f')]['id'],_0x10f025[_0x8d33('0x6f')][_0x8d33('0x3c')],_0x10f025[_0x8d33('0x6f')][_0x8d33('0x70')],_0x47e799[_0x8d33('0x6d')]['id'],_0x10f025[_0x8d33('0x5c')]?JSON['stringify'](_0x10f025[_0x8d33('0x5c')]):'null');return respondWithRpcPromise(_0x8d33('0x71'),'acceptMessage',_0x47e799);}return null;})[_0x8d33('0x39')](function(_0x5ed611){if(_0x5ed611){if(_0x10f025['body'][_0x8d33('0x72')]){_0x47e799['message'][_0x8d33('0x73')]=util[_0x8d33('0x63')](_0x8d33('0x74'),_0x10f025['user']['name']);_0x47e799[_0x8d33('0x2d')][_0x8d33('0x75')]=_0x47e799[_0x8d33('0x75')];_0x47e799['message'][_0x8d33('0x76')]=_0x8d33('0x77');return respondWithRpcPromise('EventManager','EventManager',{'event':_0x8d33('0x78'),'message':_[_0x8d33('0x50')](_0x47e799[_0x8d33('0x2d')],JSON[_0x8d33('0x79')](_0x47e799[_0x8d33('0x6d')]['formData']))},client9002)['then'](function(){return _0x47e799;});}return _0x47e799;}return null;})[_0x8d33('0x39')](respondWithResult(_0x532ffc,null))[_0x8d33('0x2e')](handleError(_0x532ffc,null));};var interaction_log=require(_0x8d33('0x15'))(_0x8d33('0x5f'));exports[_0x8d33('0x7a')]=function(_0x1c865d,_0x1e1b46,_0x2f97cf){var _0x3ffbc1={'agent':{},'channel':'chat'};if(_0x1c865d[_0x8d33('0x5c')]['id']){delete _0x1c865d[_0x8d33('0x5c')]['id'];}_0x1c865d['body'][_0x8d33('0x64')]=_0x1c865d[_0x8d33('0x5c')][_0x8d33('0x64')]||_0x1c865d[_0x8d33('0x6f')]['id'];_0x3ffbc1['agent']['id']=_0x1c865d[_0x8d33('0x5c')][_0x8d33('0x64')];return db[_0x8d33('0x40')][_0x8d33('0x5d')]({'where':{'id':_0x1c865d[_0x8d33('0x59')]['id'],'UserId':null}})[_0x8d33('0x39')](handleEntityNotFound(_0x1e1b46,null))['then'](function(_0x75eec5){if(_0x75eec5){_0x3ffbc1[_0x8d33('0x2d')]=_0x75eec5[_0x8d33('0x67')]({'plain':!![]});return db[_0x8d33('0x7b')][_0x8d33('0x5d')]({'where':{'id':_0x75eec5[_0x8d33('0x68')]}});}return null;})[_0x8d33('0x39')](handleEntityNotFound(_0x1e1b46,null))[_0x8d33('0x39')](function(_0x507839){if(_0x507839){_0x3ffbc1['interaction']=_0x507839[_0x8d33('0x67')]({'plain':!![]});interaction_log['info'](_0x8d33('0x7c'),_0x1c865d[_0x8d33('0x6f')]['id'],_0x1c865d[_0x8d33('0x6f')]['name'],_0x1c865d[_0x8d33('0x6f')][_0x8d33('0x70')],_0x3ffbc1[_0x8d33('0x6d')]['id'],_0x1c865d['body']?JSON[_0x8d33('0x2a')](_0x1c865d['body']):_0x8d33('0x7d'));return respondWithRpcPromise(_0x8d33('0x7e'),_0x8d33('0x7f'),_0x3ffbc1);}return null;})[_0x8d33('0x39')](function(_0x212268){if(_0x212268){_0x212268[_0x8d33('0x2d')][_0x8d33('0x73')]=util[_0x8d33('0x63')](_0x8d33('0x74'),_0x1c865d[_0x8d33('0x6f')]['name']);_0x212268['message'][_0x8d33('0x75')]=_0x3ffbc1[_0x8d33('0x75')];_0x212268[_0x8d33('0x2d')]['event']='reject';respondWithRpcPromise(_0x8d33('0x80'),'EventManager',{'event':_0x8d33('0x81'),'message':_0x212268[_0x8d33('0x2d')]},client9002);return _0x3ffbc1;}return null;})[_0x8d33('0x39')](respondWithResult(_0x1e1b46,null))[_0x8d33('0x2e')](handleError(_0x1e1b46,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 1b9d40a..ccb7d60 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 _0x1c94=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','ChatMessage'];(function(_0x1817be,_0x289f1e){var _0x29ed41=function(_0xaae74){while(--_0xaae74){_0x1817be['push'](_0x1817be['shift']());}};_0x29ed41(++_0x289f1e);}(_0x1c94,0x11e));var _0x41c9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x1c94[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0x41c9('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x41c9('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x41c9('0x2')](0x0);var events={'afterCreate':_0x41c9('0x3'),'afterUpdate':_0x41c9('0x4'),'afterDestroy':_0x41c9('0x5')};function emitEvent(_0x1ff423){return function(_0x2a9e26,_0x12b0f9,_0x4e82f8){ChatMessageEvents[_0x41c9('0x6')](_0x1ff423+':'+_0x2a9e26['id'],_0x2a9e26);ChatMessageEvents[_0x41c9('0x6')](_0x1ff423,_0x2a9e26);_0x4e82f8(null);};}for(var e in events){if(events[_0x41c9('0x7')](e)){var event=events[e];ChatMessage[_0x41c9('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xd1da=['exports','events','ChatMessage','setMaxListeners','remove','hasOwnProperty','hook'];(function(_0x1f1695,_0x23167b){var _0x56dca5=function(_0x1c2013){while(--_0x1c2013){_0x1f1695['push'](_0x1f1695['shift']());}};_0x56dca5(++_0x23167b);}(_0xd1da,0xe1));var _0xad1d=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xd1da[_0x100682];return _0xcb6e87;};'use strict';var EventEmitter=require(_0xad1d('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0xad1d('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xad1d('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xad1d('0x3')};function emitEvent(_0x1b37d8){return function(_0x131258,_0x32abbc,_0x16bcf4){ChatMessageEvents['emit'](_0x1b37d8+':'+_0x131258['id'],_0x131258);ChatMessageEvents['emit'](_0x1b37d8,_0x131258);_0x16bcf4(null);};}for(var e in events){if(events[_0xad1d('0x4')](e)){var event=events[e];ChatMessage[_0xad1d('0x5')](e,emitEvent(event));}}module[_0xad1d('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 1e24703..d7c6a5d 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 _0x9b8c=['error','utf8mb4','utf8mb4_unicode_ci','lodash','util','bluebird','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','models','get','direction','toLowerCase','out','secret','ChatInteractionId','then','update','createdAt','catch'];(function(_0x2e76a7,_0x23871a){var _0x454cde=function(_0x51724d){while(--_0x51724d){_0x2e76a7['push'](_0x2e76a7['shift']());}};_0x454cde(++_0x23871a);}(_0x9b8c,0x12e));var _0xc9b8=function(_0x13524d,_0x505b49){_0x13524d=_0x13524d-0x0;var _0x9918b4=_0x9b8c[_0x13524d];return _0x9918b4;};'use strict';var _=require(_0xc9b8('0x0'));var util=require(_0xc9b8('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xc9b8('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc9b8('0x3'));var config=require(_0xc9b8('0x4'));var attributes=require(_0xc9b8('0x5'));module[_0xc9b8('0x6')]=function(_0x5937a3,_0x30e785){return _0x5937a3[_0xc9b8('0x7')](_0xc9b8('0x8'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3fff3d,_0x3a05a1,_0x4f73b6){var _0x41ad5b=_0x5937a3[_0xc9b8('0x9')];var _0x400783=_0x3fff3d[_0xc9b8('0xa')]({'plain':!![]});if(_0x400783[_0xc9b8('0xb')][_0xc9b8('0xc')]()==='in'||_0x400783['direction'][_0xc9b8('0xc')]()===_0xc9b8('0xd')&&!_0x400783[_0xc9b8('0xe')]&&!_['isNil'](_0x400783['UserId'])){_0x41ad5b['ChatInteraction']['findOne']({'where':{'id':_0x400783[_0xc9b8('0xf')]}})[_0xc9b8('0x10')](function(_0x3c16a8){if(_0x3c16a8){_0x3c16a8[_0xc9b8('0x11')]({'lastMsgAt':_0x400783[_0xc9b8('0x12')],'lastMsgDirection':_0x400783[_0xc9b8('0xb')]['toLowerCase']()});}})[_0xc9b8('0x13')](function(_0x49485e){console[_0xc9b8('0x14')](_0x49485e);});}_0x4f73b6();}},'charset':_0xc9b8('0x15'),'collate':_0xc9b8('0x16')});}; \ No newline at end of file +var _0xaa4f=['FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','ChatInteraction','findOne','ChatInteractionId','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','define','chat_messages','body'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0xaa4f,0x1a7));var _0xfaa4=function(_0x1d0445,_0x36e26f){_0x1d0445=_0x1d0445-0x0;var _0x5e2abd=_0xaa4f[_0x1d0445];return _0x5e2abd;};'use strict';var _=require(_0xfaa4('0x0'));var util=require(_0xfaa4('0x1'));var logger=require(_0xfaa4('0x2'))('api');var moment=require(_0xfaa4('0x3'));var BPromise=require(_0xfaa4('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaa4('0x5'));var rimraf=require(_0xfaa4('0x6'));var config=require(_0xfaa4('0x7'));var attributes=require(_0xfaa4('0x8'));module['exports']=function(_0x3638d2,_0x10d82a){return _0x3638d2[_0xfaa4('0x9')]('ChatMessage',attributes,{'tableName':_0xfaa4('0xa'),'paranoid':![],'indexes':[{'name':'fti_chat_messages','fields':[_0xfaa4('0xb')],'type':_0xfaa4('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xcab365,_0x58771a,_0x5d25f5){var _0x562b0b=_0x3638d2[_0xfaa4('0xd')];var _0x7ae524=_0xcab365[_0xfaa4('0xe')]({'plain':!![]});if(_0x7ae524[_0xfaa4('0xf')][_0xfaa4('0x10')]()==='in'||_0x7ae524[_0xfaa4('0xf')][_0xfaa4('0x10')]()==='out'&&!_0x7ae524[_0xfaa4('0x11')]&&!_[_0xfaa4('0x12')](_0x7ae524[_0xfaa4('0x13')])){_0x562b0b[_0xfaa4('0x14')][_0xfaa4('0x15')]({'where':{'id':_0x7ae524[_0xfaa4('0x16')]}})[_0xfaa4('0x17')](function(_0x25f7a4){if(_0x25f7a4){_0x25f7a4[_0xfaa4('0x18')]({'lastMsgAt':_0x7ae524['createdAt'],'lastMsgDirection':_0x7ae524['direction'][_0xfaa4('0x10')]()});}})[_0xfaa4('0x19')](function(_0x21ff83){console[_0xfaa4('0x1a')](_0x21ff83);});}_0x5d25f5();}},'charset':_0xfaa4('0x1b'),'collate':_0xfaa4('0x1c')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 6c75196..6302e96 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 _0xcc1e=['options','CreateChatMessage','stringify','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','socket.io-emitter','redis','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','ChatMessage','create'];(function(_0x1229c8,_0x1a7f0f){var _0x3ae885=function(_0x27b46d){while(--_0x27b46d){_0x1229c8['push'](_0x1229c8['shift']());}};_0x3ae885(++_0x1a7f0f);}(_0xcc1e,0xfc));var _0xecc1=function(_0x39d85b,_0x290fc8){_0x39d85b=_0x39d85b-0x0;var _0x3f111f=_0xcc1e[_0x39d85b];return _0x3f111f;};'use strict';var _=require(_0xecc1('0x0'));var util=require(_0xecc1('0x1'));var moment=require(_0xecc1('0x2'));var BPromise=require('bluebird');var rs=require(_0xecc1('0x3'));var fs=require('fs');var Redis=require(_0xecc1('0x4'));var db=require(_0xecc1('0x5'))['db'];var utils=require(_0xecc1('0x6'));var logger=require(_0xecc1('0x7'))(_0xecc1('0x8'));var config=require('../../config/environment');var jayson=require(_0xecc1('0x9'));var client=jayson[_0xecc1('0xa')]['http']({'port':0x232a});config['redis']=_[_0xecc1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xecc1('0xc'))(new Redis(config[_0xecc1('0xd')]));require(_0xecc1('0xe'))[_0xecc1('0xf')](socket);function respondWithRpcPromise(_0x806d9b,_0x34af29,_0x24404d){return new BPromise(function(_0x3a650d,_0x7cc545){return client[_0xecc1('0x10')](_0x806d9b,_0x24404d)['then'](function(_0x3a5f37){logger[_0xecc1('0x11')](_0xecc1('0x12'),_0x34af29,_0xecc1('0x13'));logger[_0xecc1('0x14')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x34af29,_0xecc1('0x13'),JSON['stringify'](_0x3a5f37));if(_0x3a5f37[_0xecc1('0x15')]){if(_0x3a5f37[_0xecc1('0x15')][_0xecc1('0x16')]===0x1f4){logger['error'](_0xecc1('0x12'),_0x34af29,_0x3a5f37[_0xecc1('0x15')]['message']);return _0x7cc545(_0x3a5f37[_0xecc1('0x15')]['message']);}logger[_0xecc1('0x15')]('ChatMessage,\x20%s,\x20%s',_0x34af29,_0x3a5f37[_0xecc1('0x15')][_0xecc1('0x17')]);return _0x3a650d(_0x3a5f37[_0xecc1('0x15')][_0xecc1('0x17')]);}else{logger['info']('ChatMessage,\x20%s,\x20%s',_0x34af29,_0xecc1('0x13'));_0x3a650d(_0x3a5f37[_0xecc1('0x18')][_0xecc1('0x17')]);}})['catch'](function(_0x2c7e6d){logger[_0xecc1('0x15')](_0xecc1('0x12'),_0x34af29,_0x2c7e6d);_0x7cc545(_0x2c7e6d);});});}exports['CreateChatMessage']=function(_0x36f7d8){var _0xc1363d=this;return new Promise(function(_0x338629,_0x1ef193){return db[_0xecc1('0x19')][_0xecc1('0x1a')](_0x36f7d8['body'],{'raw':_0x36f7d8[_0xecc1('0x1b')]?_0x36f7d8['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x19468a){logger[_0xecc1('0x11')](_0xecc1('0x1c'),_0x36f7d8);logger[_0xecc1('0x14')](_0xecc1('0x1c'),_0x36f7d8,JSON[_0xecc1('0x1d')](_0x19468a));_0x338629(_0x19468a);})[_0xecc1('0x1e')](function(_0x3fe218){logger[_0xecc1('0x15')](_0xecc1('0x1c'),_0x3fe218[_0xecc1('0x17')],_0x36f7d8);_0x1ef193(_0xc1363d[_0xecc1('0x15')](0x1f4,_0x3fe218[_0xecc1('0x17')]));});});}; \ No newline at end of file +var _0xdfa8=['code','message','catch','ChatMessage','body','options','CreateChatMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','./chatMessage.socket','register','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x4e8ea2,_0x55e417){var _0x692947=function(_0x34b8cc){while(--_0x34b8cc){_0x4e8ea2['push'](_0x4e8ea2['shift']());}};_0x692947(++_0x55e417);}(_0xdfa8,0x1e7));var _0x8dfa=function(_0x32b004,_0x3a4f15){_0x32b004=_0x32b004-0x0;var _0x228f5d=_0xdfa8[_0x32b004];return _0x228f5d;};'use strict';var _=require(_0x8dfa('0x0'));var util=require(_0x8dfa('0x1'));var moment=require(_0x8dfa('0x2'));var BPromise=require(_0x8dfa('0x3'));var rs=require(_0x8dfa('0x4'));var fs=require('fs');var Redis=require(_0x8dfa('0x5'));var db=require(_0x8dfa('0x6'))['db'];var utils=require(_0x8dfa('0x7'));var logger=require(_0x8dfa('0x8'))(_0x8dfa('0x9'));var config=require(_0x8dfa('0xa'));var jayson=require(_0x8dfa('0xb'));var client=jayson['client']['http']({'port':0x232a});config[_0x8dfa('0xc')]=_[_0x8dfa('0xd')](config[_0x8dfa('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8dfa('0xe'))(new Redis(config['redis']));require(_0x8dfa('0xf'))[_0x8dfa('0x10')](socket);function respondWithRpcPromise(_0x10d83e,_0x4c891b,_0xa13c87){return new BPromise(function(_0x51d177,_0x2133fc){return client[_0x8dfa('0x11')](_0x10d83e,_0xa13c87)[_0x8dfa('0x12')](function(_0x425a44){logger[_0x8dfa('0x13')](_0x8dfa('0x14'),_0x4c891b,_0x8dfa('0x15'));logger[_0x8dfa('0x16')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x4c891b,'request\x20sent',JSON[_0x8dfa('0x17')](_0x425a44));if(_0x425a44[_0x8dfa('0x18')]){if(_0x425a44['error'][_0x8dfa('0x19')]===0x1f4){logger['error']('ChatMessage,\x20%s,\x20%s',_0x4c891b,_0x425a44[_0x8dfa('0x18')][_0x8dfa('0x1a')]);return _0x2133fc(_0x425a44[_0x8dfa('0x18')][_0x8dfa('0x1a')]);}logger[_0x8dfa('0x18')]('ChatMessage,\x20%s,\x20%s',_0x4c891b,_0x425a44[_0x8dfa('0x18')]['message']);return _0x51d177(_0x425a44[_0x8dfa('0x18')][_0x8dfa('0x1a')]);}else{logger[_0x8dfa('0x13')]('ChatMessage,\x20%s,\x20%s',_0x4c891b,_0x8dfa('0x15'));_0x51d177(_0x425a44['result'][_0x8dfa('0x1a')]);}})[_0x8dfa('0x1b')](function(_0x2a801f){logger[_0x8dfa('0x18')](_0x8dfa('0x14'),_0x4c891b,_0x2a801f);_0x2133fc(_0x2a801f);});});}exports['CreateChatMessage']=function(_0x32fc45){var _0x59367a=this;return new Promise(function(_0x4aad93,_0x105cec){return db[_0x8dfa('0x1c')]['create'](_0x32fc45[_0x8dfa('0x1d')],{'raw':_0x32fc45[_0x8dfa('0x1e')]?_0x32fc45[_0x8dfa('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x8dfa('0x12')](function(_0x2741d9){logger[_0x8dfa('0x13')](_0x8dfa('0x1f'),_0x32fc45);logger[_0x8dfa('0x16')](_0x8dfa('0x1f'),_0x32fc45,JSON['stringify'](_0x2741d9));_0x4aad93(_0x2741d9);})['catch'](function(_0x3322b7){logger[_0x8dfa('0x18')]('CreateChatMessage',_0x3322b7['message'],_0x32fc45);_0x105cec(_0x59367a[_0x8dfa('0x18')](0x1f4,_0x3322b7['message']));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 311cc3f..69d6db5 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 _0x4137=['emit','removeListener','register','length','chatMessage:','./chatMessage.events','save','remove','update'];(function(_0x547a1d,_0x252337){var _0x4e522f=function(_0x76d516){while(--_0x76d516){_0x547a1d['push'](_0x547a1d['shift']());}};_0x4e522f(++_0x252337);}(_0x4137,0xf8));var _0x7413=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x4137[_0x413feb];return _0x40ee88;};'use strict';var ChatMessageEvents=require(_0x7413('0x0'));var events=[_0x7413('0x1'),_0x7413('0x2'),_0x7413('0x3')];function createListener(_0x392ebc,_0x410971){return function(_0x2e6df7){_0x410971[_0x7413('0x4')](_0x392ebc,_0x2e6df7);};}function removeListener(_0x258255,_0x3dc48a){return function(){ChatMessageEvents[_0x7413('0x5')](_0x258255,_0x3dc48a);};}exports[_0x7413('0x6')]=function(_0x4fbade){for(var _0xc808cd=0x0,_0x188d89=events[_0x7413('0x7')];_0xc808cd<_0x188d89;_0xc808cd++){var _0x15af0d=events[_0xc808cd];var _0x5f4cd0=createListener(_0x7413('0x8')+_0x15af0d,_0x4fbade);ChatMessageEvents['on'](_0x15af0d,_0x5f4cd0);}}; \ No newline at end of file +var _0x2675=['register','length','chatMessage:','./chatMessage.events','emit','removeListener'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x2675,0x75));var _0x5267=function(_0x205e6a,_0xfa8d0d){_0x205e6a=_0x205e6a-0x0;var _0x330d5c=_0x2675[_0x205e6a];return _0x330d5c;};'use strict';var ChatMessageEvents=require(_0x5267('0x0'));var events=['save','remove','update'];function createListener(_0x1da342,_0x2ae442){return function(_0x57c95a){_0x2ae442[_0x5267('0x1')](_0x1da342,_0x57c95a);};}function removeListener(_0x36bdf0,_0x4e2548){return function(){ChatMessageEvents[_0x5267('0x2')](_0x36bdf0,_0x4e2548);};}exports[_0x5267('0x3')]=function(_0x4bd042){for(var _0x10f92c=0x0,_0x20f065=events[_0x5267('0x4')];_0x10f92c<_0x20f065;_0x10f92c++){var _0x527c16=events[_0x10f92c];var _0x9e0a27=createListener(_0x5267('0x5')+_0x527c16,_0x4bd042);ChatMessageEvents['on'](_0x527c16,_0x9e0a27);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index 3de7244..5d4320b 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 _0x0672=['/:id','isAuthenticated','show','post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','index','/describe','describe'];(function(_0x58e3ad,_0x2b42d7){var _0x8764b9=function(_0x5eea10){while(--_0x5eea10){_0x58e3ad['push'](_0x58e3ad['shift']());}};_0x8764b9(++_0x2b42d7);}(_0x0672,0x107));var _0x2067=function(_0x141908,_0x4e61dc){_0x141908=_0x141908-0x0;var _0x37e9c9=_0x0672[_0x141908];return _0x37e9c9;};'use strict';var multer=require(_0x2067('0x0'));var util=require('util');var path=require(_0x2067('0x1'));var timeout=require('connect-timeout');var express=require(_0x2067('0x2'));var router=express[_0x2067('0x3')]();var auth=require(_0x2067('0x4'));var interaction=require(_0x2067('0x5'));var config=require(_0x2067('0x6'));var controller=require(_0x2067('0x7'));router[_0x2067('0x8')]('/',auth['isAuthenticated'](),controller[_0x2067('0x9')]);router['get'](_0x2067('0xa'),auth['isAuthenticated'](),controller[_0x2067('0xb')]);router[_0x2067('0x8')](_0x2067('0xc'),auth[_0x2067('0xd')](),controller[_0x2067('0xe')]);router[_0x2067('0xf')]('/',auth[_0x2067('0xd')](),interaction[_0x2067('0x10')](_0x2067('0x11'),_0x2067('0x12')),controller[_0x2067('0x13')]);router[_0x2067('0x14')](_0x2067('0xc'),controller[_0x2067('0x15')]);router[_0x2067('0x14')](_0x2067('0x16'),auth['isAuthenticated'](),controller['accept']);router[_0x2067('0x14')]('/:id/reject',auth[_0x2067('0xd')](),controller['reject']);router['delete'](_0x2067('0xc'),auth['isAuthenticated'](),controller[_0x2067('0x17')]);module[_0x2067('0x18')]=router; \ No newline at end of file +var _0xcd5e=['post','tracked','chat','chatmessage:create','create','put','update','/:id/accept','accept','reject','delete','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x5b3b9b,_0x1c71b0){var _0x47c1d7=function(_0x34c20b){while(--_0x34c20b){_0x5b3b9b['push'](_0x5b3b9b['shift']());}};_0x47c1d7(++_0x1c71b0);}(_0xcd5e,0x114));var _0xecd5=function(_0x2a0813,_0x5028b6){_0x2a0813=_0x2a0813-0x0;var _0x4d69c2=_0xcd5e[_0x2a0813];return _0x4d69c2;};'use strict';var multer=require(_0xecd5('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xecd5('0x1'));var express=require(_0xecd5('0x2'));var router=express[_0xecd5('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xecd5('0x4'));var config=require(_0xecd5('0x5'));var controller=require(_0xecd5('0x6'));router[_0xecd5('0x7')]('/',auth[_0xecd5('0x8')](),controller[_0xecd5('0x9')]);router[_0xecd5('0x7')](_0xecd5('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xecd5('0x7')](_0xecd5('0xb'),auth[_0xecd5('0x8')](),controller['show']);router[_0xecd5('0xc')]('/',auth[_0xecd5('0x8')](),interaction[_0xecd5('0xd')](_0xecd5('0xe'),_0xecd5('0xf')),controller[_0xecd5('0x10')]);router[_0xecd5('0x11')](_0xecd5('0xb'),controller[_0xecd5('0x12')]);router[_0xecd5('0x11')](_0xecd5('0x13'),auth[_0xecd5('0x8')](),controller[_0xecd5('0x14')]);router[_0xecd5('0x11')]('/:id/reject',auth[_0xecd5('0x8')](),controller[_0xecd5('0x15')]);router[_0xecd5('0x16')](_0xecd5('0xb'),auth[_0xecd5('0x8')](),controller['destroy']);module[_0xecd5('0x17')]=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index 091d34d..67071d5 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 _0xa7dc=['TEXT','medium','sequelize'];(function(_0x117c35,_0x4b5433){var _0x59d30d=function(_0x3d8f76){while(--_0x3d8f76){_0x117c35['push'](_0x117c35['shift']());}};_0x59d30d(++_0x4b5433);}(_0xa7dc,0xc2));var _0xca7d=function(_0x238906,_0x18110a){_0x238906=_0x238906-0x0;var _0x5860bd=_0xa7dc[_0x238906];return _0x5860bd;};'use strict';var Sequelize=require(_0xca7d('0x0'));module['exports']={'body':{'type':Sequelize[_0xca7d('0x1')](_0xca7d('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x01dc=['TEXT','medium','sequelize','exports'];(function(_0x213928,_0x450266){var _0x5aec54=function(_0x29c4ed){while(--_0x29c4ed){_0x213928['push'](_0x213928['shift']());}};_0x5aec54(++_0x450266);}(_0x01dc,0x176));var _0xc01d=function(_0x357a01,_0x1e57d0){_0x357a01=_0x357a01-0x0;var _0x252c1f=_0x01dc[_0x357a01];return _0x252c1f;};'use strict';var Sequelize=require(_0xc01d('0x0'));module[_0xc01d('0x1')]={'body':{'type':Sequelize[_0xc01d('0x2')](_0xc01d('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 9d466cb..1eefd2f 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 _0x24a0=['where','filter','merge','options','include','ChatOfflineMessage','findAll','rows','catch','params','includeAll','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','error','name','send','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x5578f3,_0x4fa154){var _0x448c87=function(_0xadd3fe){while(--_0xadd3fe){_0x5578f3['push'](_0x5578f3['shift']());}};_0x448c87(++_0x4fa154);}(_0x24a0,0xe1));var _0x024a=function(_0xad4f90,_0x1f83f0){_0xad4f90=_0xad4f90-0x0;var _0x2b1586=_0x24a0[_0xad4f90];return _0x2b1586;};'use strict';var pdf=require(_0x024a('0x0'));var emlformat=require(_0x024a('0x1'));var rimraf=require(_0x024a('0x2'));var zipdir=require(_0x024a('0x3'));var jsonpatch=require(_0x024a('0x4'));var rp=require(_0x024a('0x5'));var moment=require(_0x024a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x024a('0x7'));var util=require(_0x024a('0x8'));var path=require(_0x024a('0x9'));var sox=require(_0x024a('0xa'));var csv=require(_0x024a('0xb'));var ejs=require(_0x024a('0xc'));var fs=require('fs');var _=require(_0x024a('0xd'));var squel=require('squel');var crypto=require(_0x024a('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x024a('0xb'));var querystring=require('querystring');var Papa=require(_0x024a('0xf'));var Redis=require(_0x024a('0x10'));var authService=require(_0x024a('0x11'));var qs=require(_0x024a('0x12'));var as=require(_0x024a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x024a('0x14'))('api');var utils=require(_0x024a('0x15'));var config=require(_0x024a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1beac0,_0x19955c){_0x19955c=_0x19955c||0xcc;return function(_0x457833){if(_0x457833){return _0x1beac0[_0x024a('0x17')](_0x19955c);}return _0x1beac0[_0x024a('0x18')](_0x19955c)[_0x024a('0x19')]();};}function respondWithResult(_0x46b3ad,_0x137252){_0x137252=_0x137252||0xc8;return function(_0xb35ad6){if(_0xb35ad6){return _0x46b3ad['status'](_0x137252)['json'](_0xb35ad6);}};}function respondWithFilteredResult(_0x482bac,_0xa04545){return function(_0xe338dd){if(_0xe338dd){var _0x4288de=_0xe338dd[_0x024a('0x1a')],_0x2b2fa3=_0xa04545[_0x024a('0x1b')],_0x590ab6=_0xa04545[_0x024a('0x1b')]+_0xa04545[_0x024a('0x1c')],_0x21fb5c;if(_0x590ab6>=_0x4288de){_0x590ab6=_0x4288de;_0x21fb5c=0xc8;}else{_0x21fb5c=0xce;}_0x482bac[_0x024a('0x18')](_0x21fb5c);return _0x482bac[_0x024a('0x1d')](_0x024a('0x1e'),_0x2b2fa3+'-'+_0x590ab6+'/'+_0x4288de)['json'](_0xe338dd);}return null;};}function patchUpdates(_0x35e2ae){return function(_0xb757e8){try{jsonpatch['apply'](_0xb757e8,_0x35e2ae,!![]);}catch(_0x13246a){return BPromise[_0x024a('0x1f')](_0x13246a);}return _0xb757e8[_0x024a('0x20')]();};}function saveUpdates(_0x5079cc,_0x1cc833){return function(_0x114592){if(_0x114592){return _0x114592[_0x024a('0x21')](_0x5079cc)[_0x024a('0x22')](function(_0x550da9){return _0x550da9;});}return null;};}function removeEntity(_0x2f16f7,_0x7596c){return function(_0x29677d){if(_0x29677d){return _0x29677d[_0x024a('0x23')]()[_0x024a('0x22')](function(){_0x2f16f7[_0x024a('0x18')](0xcc)[_0x024a('0x19')]();});}};}function handleEntityNotFound(_0x590ad5,_0x28487e){return function(_0x349a3b){if(!_0x349a3b){_0x590ad5[_0x024a('0x17')](0x194);}return _0x349a3b;};}function handleError(_0x156c62,_0x2d2dff){_0x2d2dff=_0x2d2dff||0x1f4;return function(_0xf35c43){logger[_0x024a('0x24')](_0xf35c43['stack']);if(_0xf35c43[_0x024a('0x25')]){delete _0xf35c43[_0x024a('0x25')];}_0x156c62[_0x024a('0x18')](_0x2d2dff)[_0x024a('0x26')](_0xf35c43);};}exports['index']=function(_0x2c7662,_0x1284ed){var _0x4351c0={},_0x171d43={},_0x374f38={'count':0x0,'rows':[]};var _0x4fc070=_['map'](db['ChatOfflineMessage'][_0x024a('0x27')],function(_0x312a99){return{'name':_0x312a99[_0x024a('0x28')],'type':_0x312a99[_0x024a('0x29')][_0x024a('0x2a')]};});_0x171d43[_0x024a('0x2b')]=_[_0x024a('0x2c')](_0x4fc070,_0x024a('0x25'));_0x171d43[_0x024a('0x2d')]=_[_0x024a('0x2e')](_0x2c7662[_0x024a('0x2d')]);_0x171d43[_0x024a('0x2f')]=_[_0x024a('0x30')](_0x171d43['model'],_0x171d43[_0x024a('0x2d')]);_0x4351c0[_0x024a('0x31')]=_[_0x024a('0x30')](_0x171d43[_0x024a('0x2b')],qs[_0x024a('0x32')](_0x2c7662['query'][_0x024a('0x32')]));_0x4351c0[_0x024a('0x31')]=_0x4351c0[_0x024a('0x31')][_0x024a('0x33')]?_0x4351c0[_0x024a('0x31')]:_0x171d43[_0x024a('0x2b')];if(!_0x2c7662['query'][_0x024a('0x34')](_0x024a('0x35'))){_0x4351c0['limit']=qs[_0x024a('0x1c')](_0x2c7662[_0x024a('0x2d')]['limit']);_0x4351c0['offset']=qs[_0x024a('0x1b')](_0x2c7662[_0x024a('0x2d')]['offset']);}_0x4351c0[_0x024a('0x36')]=qs['sort'](_0x2c7662[_0x024a('0x2d')]['sort']);_0x4351c0[_0x024a('0x37')]=qs['filters'](_['pick'](_0x2c7662[_0x024a('0x2d')],_0x171d43[_0x024a('0x2f')]));if(_0x2c7662['query'][_0x024a('0x38')]){_0x4351c0[_0x024a('0x37')]=_['merge'](_0x4351c0[_0x024a('0x37')],{'$or':_[_0x024a('0x2c')](_0x4fc070,function(_0x3685f0){if(_0x3685f0[_0x024a('0x29')]!=='VIRTUAL'){var _0x2d47b1={};_0x2d47b1[_0x3685f0[_0x024a('0x25')]]={'$like':'%'+_0x2c7662[_0x024a('0x2d')]['filter']+'%'};return _0x2d47b1;}})});}_0x4351c0=_[_0x024a('0x39')]({},_0x4351c0,_0x2c7662[_0x024a('0x3a')]);var _0x1b4826={'where':_0x4351c0['where']};return db['ChatOfflineMessage']['count'](_0x1b4826)[_0x024a('0x22')](function(_0xfc876b){_0x374f38['count']=_0xfc876b;if(_0x2c7662['query']['includeAll']){_0x4351c0[_0x024a('0x3b')]=[{'all':!![]}];}return db[_0x024a('0x3c')][_0x024a('0x3d')](_0x4351c0);})['then'](function(_0x23db9b){_0x374f38[_0x024a('0x3e')]=_0x23db9b;return _0x374f38;})[_0x024a('0x22')](respondWithFilteredResult(_0x1284ed,_0x4351c0))[_0x024a('0x3f')](handleError(_0x1284ed,null));};exports['show']=function(_0xefb5f0,_0x40683c){var _0x26ab96={'raw':!![],'where':{'id':_0xefb5f0[_0x024a('0x40')]['id']}},_0x4db31b={};_0x4db31b[_0x024a('0x2b')]=_[_0x024a('0x2e')](db['ChatOfflineMessage'][_0x024a('0x27')]);_0x4db31b[_0x024a('0x2d')]=_['keys'](_0xefb5f0['query']);_0x4db31b['filters']=_[_0x024a('0x30')](_0x4db31b[_0x024a('0x2b')],_0x4db31b['query']);_0x26ab96['attributes']=_[_0x024a('0x30')](_0x4db31b[_0x024a('0x2b')],qs['fields'](_0xefb5f0[_0x024a('0x2d')][_0x024a('0x32')]));_0x26ab96[_0x024a('0x31')]=_0x26ab96[_0x024a('0x31')][_0x024a('0x33')]?_0x26ab96[_0x024a('0x31')]:_0x4db31b[_0x024a('0x2b')];if(_0xefb5f0[_0x024a('0x2d')][_0x024a('0x41')]){_0x26ab96['include']=[{'all':!![]}];}_0x26ab96=_[_0x024a('0x39')]({},_0x26ab96,_0xefb5f0[_0x024a('0x3a')]);return db[_0x024a('0x3c')][_0x024a('0x42')](_0x26ab96)[_0x024a('0x22')](handleEntityNotFound(_0x40683c,null))['then'](respondWithResult(_0x40683c,null))[_0x024a('0x3f')](handleError(_0x40683c,null));};exports[_0x024a('0x43')]=function(_0x31be15,_0x61b6e0){return db[_0x024a('0x3c')][_0x024a('0x43')](_0x31be15[_0x024a('0x44')],{})[_0x024a('0x22')](respondWithResult(_0x61b6e0,0xc9))[_0x024a('0x3f')](handleError(_0x61b6e0,null));};exports['update']=function(_0xf1c5fa,_0x57a3fd){if(_0xf1c5fa['body']['id']){delete _0xf1c5fa[_0x024a('0x44')]['id'];}return db['ChatOfflineMessage'][_0x024a('0x42')]({'where':{'id':_0xf1c5fa[_0x024a('0x40')]['id']}})[_0x024a('0x22')](handleEntityNotFound(_0x57a3fd,null))[_0x024a('0x22')](saveUpdates(_0xf1c5fa['body'],null))[_0x024a('0x22')](respondWithResult(_0x57a3fd,null))[_0x024a('0x3f')](handleError(_0x57a3fd,null));};exports['destroy']=function(_0x4260ff,_0x41d0f9){return db[_0x024a('0x3c')]['find']({'where':{'id':_0x4260ff['params']['id']}})[_0x024a('0x22')](handleEntityNotFound(_0x41d0f9,null))[_0x024a('0x22')](removeEntity(_0x41d0f9,null))[_0x024a('0x3f')](handleError(_0x41d0f9,null));};exports[_0x024a('0x45')]=function(_0x14e418,_0x2d5b9c){return db[_0x024a('0x3c')][_0x024a('0x45')]()[_0x024a('0x22')](respondWithResult(_0x2d5b9c,null))[_0x024a('0x3f')](handleError(_0x2d5b9c,null));}; \ No newline at end of file +var _0x18f9=['keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','options','includeAll','include','findAll','catch','show','params','find','body','describe','html-pdf','eml-format','rimraf','moment','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','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','ChatOfflineMessage','rawAttributes','fieldName','type','model','query'];(function(_0x328c0d,_0x54f765){var _0x319640=function(_0x19d63f){while(--_0x19d63f){_0x328c0d['push'](_0x328c0d['shift']());}};_0x319640(++_0x54f765);}(_0x18f9,0x9b));var _0x918f=function(_0x45b190,_0x6297da){_0x45b190=_0x45b190-0x0;var _0x46234d=_0x18f9[_0x45b190];return _0x46234d;};'use strict';var pdf=require(_0x918f('0x0'));var emlformat=require(_0x918f('0x1'));var rimraf=require(_0x918f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x918f('0x3'));var BPromise=require(_0x918f('0x4'));var Mustache=require(_0x918f('0x5'));var util=require(_0x918f('0x6'));var path=require(_0x918f('0x7'));var sox=require(_0x918f('0x8'));var csv=require(_0x918f('0x9'));var ejs=require(_0x918f('0xa'));var fs=require('fs');var _=require(_0x918f('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x918f('0xc'));var deskjs=require(_0x918f('0xd'));var toCsv=require(_0x918f('0x9'));var querystring=require(_0x918f('0xe'));var Papa=require(_0x918f('0xf'));var Redis=require('ioredis');var authService=require(_0x918f('0x10'));var qs=require(_0x918f('0x11'));var as=require(_0x918f('0x12'));var hardwareService=require(_0x918f('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x918f('0x14'))['db'];function respondWithStatusCode(_0x30ee49,_0x16cf47){_0x16cf47=_0x16cf47||0xcc;return function(_0x1ab530){if(_0x1ab530){return _0x30ee49[_0x918f('0x15')](_0x16cf47);}return _0x30ee49[_0x918f('0x16')](_0x16cf47)['end']();};}function respondWithResult(_0x1c6f15,_0x28d4ec){_0x28d4ec=_0x28d4ec||0xc8;return function(_0x46da41){if(_0x46da41){return _0x1c6f15['status'](_0x28d4ec)[_0x918f('0x17')](_0x46da41);}};}function respondWithFilteredResult(_0x400a8a,_0x420835){return function(_0x281c0e){if(_0x281c0e){var _0x5514e5=_0x281c0e[_0x918f('0x18')],_0xca058f=_0x420835['offset'],_0x3e0841=_0x420835['offset']+_0x420835[_0x918f('0x19')],_0x13c2eb;if(_0x3e0841>=_0x5514e5){_0x3e0841=_0x5514e5;_0x13c2eb=0xc8;}else{_0x13c2eb=0xce;}_0x400a8a[_0x918f('0x16')](_0x13c2eb);return _0x400a8a[_0x918f('0x1a')](_0x918f('0x1b'),_0xca058f+'-'+_0x3e0841+'/'+_0x5514e5)['json'](_0x281c0e);}return null;};}function patchUpdates(_0x5c793a){return function(_0x6330c4){try{jsonpatch[_0x918f('0x1c')](_0x6330c4,_0x5c793a,!![]);}catch(_0x20eb4e){return BPromise[_0x918f('0x1d')](_0x20eb4e);}return _0x6330c4['save']();};}function saveUpdates(_0x202b3b,_0x2548e1){return function(_0x58f86c){if(_0x58f86c){return _0x58f86c[_0x918f('0x1e')](_0x202b3b)[_0x918f('0x1f')](function(_0x13eccc){return _0x13eccc;});}return null;};}function removeEntity(_0x19b27e,_0x17d2ef){return function(_0x3e00ed){if(_0x3e00ed){return _0x3e00ed[_0x918f('0x20')]()[_0x918f('0x1f')](function(){_0x19b27e['status'](0xcc)[_0x918f('0x21')]();});}};}function handleEntityNotFound(_0x4aa959,_0x17033d){return function(_0x26bfc0){if(!_0x26bfc0){_0x4aa959[_0x918f('0x15')](0x194);}return _0x26bfc0;};}function handleError(_0x4098e5,_0x401191){_0x401191=_0x401191||0x1f4;return function(_0x2fe2f2){logger[_0x918f('0x22')](_0x2fe2f2[_0x918f('0x23')]);if(_0x2fe2f2['name']){delete _0x2fe2f2[_0x918f('0x24')];}_0x4098e5['status'](_0x401191)[_0x918f('0x25')](_0x2fe2f2);};}exports[_0x918f('0x26')]=function(_0x3286e8,_0x399784){var _0x3560a6={},_0x3a4712={},_0x22525f={'count':0x0,'rows':[]};var _0x85875d=_[_0x918f('0x27')](db[_0x918f('0x28')][_0x918f('0x29')],function(_0x3248b9){return{'name':_0x3248b9[_0x918f('0x2a')],'type':_0x3248b9[_0x918f('0x2b')]['key']};});_0x3a4712[_0x918f('0x2c')]=_[_0x918f('0x27')](_0x85875d,_0x918f('0x24'));_0x3a4712[_0x918f('0x2d')]=_[_0x918f('0x2e')](_0x3286e8[_0x918f('0x2d')]);_0x3a4712[_0x918f('0x2f')]=_['intersection'](_0x3a4712[_0x918f('0x2c')],_0x3a4712[_0x918f('0x2d')]);_0x3560a6[_0x918f('0x30')]=_[_0x918f('0x31')](_0x3a4712[_0x918f('0x2c')],qs['fields'](_0x3286e8[_0x918f('0x2d')][_0x918f('0x32')]));_0x3560a6['attributes']=_0x3560a6[_0x918f('0x30')][_0x918f('0x33')]?_0x3560a6[_0x918f('0x30')]:_0x3a4712[_0x918f('0x2c')];if(!_0x3286e8['query'][_0x918f('0x34')](_0x918f('0x35'))){_0x3560a6['limit']=qs['limit'](_0x3286e8[_0x918f('0x2d')]['limit']);_0x3560a6['offset']=qs['offset'](_0x3286e8[_0x918f('0x2d')]['offset']);}_0x3560a6[_0x918f('0x36')]=qs[_0x918f('0x37')](_0x3286e8[_0x918f('0x2d')][_0x918f('0x37')]);_0x3560a6[_0x918f('0x38')]=qs[_0x918f('0x2f')](_['pick'](_0x3286e8[_0x918f('0x2d')],_0x3a4712[_0x918f('0x2f')]));if(_0x3286e8[_0x918f('0x2d')]['filter']){_0x3560a6[_0x918f('0x38')]=_['merge'](_0x3560a6[_0x918f('0x38')],{'$or':_[_0x918f('0x27')](_0x85875d,function(_0x4a98be){if(_0x4a98be['type']!=='VIRTUAL'){var _0x32c5bd={};_0x32c5bd[_0x4a98be['name']]={'$like':'%'+_0x3286e8[_0x918f('0x2d')]['filter']+'%'};return _0x32c5bd;}})});}_0x3560a6=_['merge']({},_0x3560a6,_0x3286e8[_0x918f('0x39')]);var _0x4abb7a={'where':_0x3560a6['where']};return db['ChatOfflineMessage'][_0x918f('0x18')](_0x4abb7a)[_0x918f('0x1f')](function(_0x13856c){_0x22525f[_0x918f('0x18')]=_0x13856c;if(_0x3286e8[_0x918f('0x2d')][_0x918f('0x3a')]){_0x3560a6[_0x918f('0x3b')]=[{'all':!![]}];}return db['ChatOfflineMessage'][_0x918f('0x3c')](_0x3560a6);})[_0x918f('0x1f')](function(_0x333af8){_0x22525f['rows']=_0x333af8;return _0x22525f;})[_0x918f('0x1f')](respondWithFilteredResult(_0x399784,_0x3560a6))[_0x918f('0x3d')](handleError(_0x399784,null));};exports[_0x918f('0x3e')]=function(_0x39c1f6,_0x193d95){var _0x5d5cb7={'raw':!![],'where':{'id':_0x39c1f6[_0x918f('0x3f')]['id']}},_0x454fe8={};_0x454fe8[_0x918f('0x2c')]=_[_0x918f('0x2e')](db[_0x918f('0x28')]['rawAttributes']);_0x454fe8[_0x918f('0x2d')]=_[_0x918f('0x2e')](_0x39c1f6[_0x918f('0x2d')]);_0x454fe8['filters']=_[_0x918f('0x31')](_0x454fe8[_0x918f('0x2c')],_0x454fe8[_0x918f('0x2d')]);_0x5d5cb7['attributes']=_[_0x918f('0x31')](_0x454fe8['model'],qs[_0x918f('0x32')](_0x39c1f6[_0x918f('0x2d')][_0x918f('0x32')]));_0x5d5cb7['attributes']=_0x5d5cb7[_0x918f('0x30')][_0x918f('0x33')]?_0x5d5cb7[_0x918f('0x30')]:_0x454fe8['model'];if(_0x39c1f6[_0x918f('0x2d')]['includeAll']){_0x5d5cb7[_0x918f('0x3b')]=[{'all':!![]}];}_0x5d5cb7=_['merge']({},_0x5d5cb7,_0x39c1f6[_0x918f('0x39')]);return db[_0x918f('0x28')][_0x918f('0x40')](_0x5d5cb7)[_0x918f('0x1f')](handleEntityNotFound(_0x193d95,null))[_0x918f('0x1f')](respondWithResult(_0x193d95,null))['catch'](handleError(_0x193d95,null));};exports['create']=function(_0x41b6ef,_0x55aa43){return db[_0x918f('0x28')]['create'](_0x41b6ef[_0x918f('0x41')],{})[_0x918f('0x1f')](respondWithResult(_0x55aa43,0xc9))['catch'](handleError(_0x55aa43,null));};exports[_0x918f('0x1e')]=function(_0x25f040,_0x3c9d1a){if(_0x25f040['body']['id']){delete _0x25f040[_0x918f('0x41')]['id'];}return db[_0x918f('0x28')][_0x918f('0x40')]({'where':{'id':_0x25f040['params']['id']}})[_0x918f('0x1f')](handleEntityNotFound(_0x3c9d1a,null))[_0x918f('0x1f')](saveUpdates(_0x25f040[_0x918f('0x41')],null))[_0x918f('0x1f')](respondWithResult(_0x3c9d1a,null))['catch'](handleError(_0x3c9d1a,null));};exports[_0x918f('0x20')]=function(_0x167ab6,_0x4bd541){return db[_0x918f('0x28')][_0x918f('0x40')]({'where':{'id':_0x167ab6[_0x918f('0x3f')]['id']}})[_0x918f('0x1f')](handleEntityNotFound(_0x4bd541,null))[_0x918f('0x1f')](removeEntity(_0x4bd541,null))[_0x918f('0x3d')](handleError(_0x4bd541,null));};exports[_0x918f('0x42')]=function(_0x11f430,_0x56d3d6){return db[_0x918f('0x28')]['describe']()[_0x918f('0x1f')](respondWithResult(_0x56d3d6,null))[_0x918f('0x3d')](handleError(_0x56d3d6,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index c056c25..57a1663 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 _0xe107=['../../config/logger','api','moment','request-promise','../../config/environment','./chatOfflineMessage.attributes','exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4','lodash'];(function(_0x1799a4,_0x114955){var _0xccd50e=function(_0x29e461){while(--_0x29e461){_0x1799a4['push'](_0x1799a4['shift']());}};_0xccd50e(++_0x114955);}(_0xe107,0xb3));var _0x7e10=function(_0x234288,_0x544009){_0x234288=_0x234288-0x0;var _0x2d9476=_0xe107[_0x234288];return _0x2d9476;};'use strict';var _=require(_0x7e10('0x0'));var util=require('util');var logger=require(_0x7e10('0x1'))(_0x7e10('0x2'));var moment=require(_0x7e10('0x3'));var BPromise=require('bluebird');var rp=require(_0x7e10('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7e10('0x5'));var attributes=require(_0x7e10('0x6'));module[_0x7e10('0x7')]=function(_0x5be19f,_0x5f1edf){return _0x5be19f[_0x7e10('0x8')](_0x7e10('0x9'),attributes,{'tableName':_0x7e10('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x7e10('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xfd28=['moment','request-promise','path','rimraf','./chatOfflineMessage.attributes','exports','define','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger'];(function(_0x42ae96,_0x48c45b){var _0x5ada45=function(_0x1ccad8){while(--_0x1ccad8){_0x42ae96['push'](_0x42ae96['shift']());}};_0x5ada45(++_0x48c45b);}(_0xfd28,0x148));var _0x8fd2=function(_0x474d97,_0x5909ce){_0x474d97=_0x474d97-0x0;var _0x1edf25=_0xfd28[_0x474d97];return _0x1edf25;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var logger=require(_0x8fd2('0x1'))('api');var moment=require(_0x8fd2('0x2'));var BPromise=require('bluebird');var rp=require(_0x8fd2('0x3'));var fs=require('fs');var path=require(_0x8fd2('0x4'));var rimraf=require(_0x8fd2('0x5'));var config=require('../../config/environment');var attributes=require(_0x8fd2('0x6'));module[_0x8fd2('0x7')]=function(_0x2ee87e,_0x36178a){return _0x2ee87e[_0x8fd2('0x8')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8fd2('0x9'),'collate':_0x8fd2('0xa')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index e0b76dd..a43ea73 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 _0x641b=['info','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatOfflineMessage,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x2a5c57,_0x2bcdd2){var _0x366ba5=function(_0x363d5f){while(--_0x363d5f){_0x2a5c57['push'](_0x2a5c57['shift']());}};_0x366ba5(++_0x2bcdd2);}(_0x641b,0x182));var _0xb641=function(_0x13200c,_0x1e3195){_0x13200c=_0x13200c-0x0;var _0x48208f=_0x641b[_0x13200c];return _0x48208f;};'use strict';var _=require(_0xb641('0x0'));var util=require(_0xb641('0x1'));var moment=require(_0xb641('0x2'));var BPromise=require(_0xb641('0x3'));var rs=require(_0xb641('0x4'));var fs=require('fs');var Redis=require(_0xb641('0x5'));var db=require(_0xb641('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xb641('0x7'))(_0xb641('0x8'));var config=require(_0xb641('0x9'));var jayson=require(_0xb641('0xa'));var client=jayson[_0xb641('0xb')][_0xb641('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3d33c3,_0x35debb,_0x346d3a){return new BPromise(function(_0x3cb5a1,_0x10ccc4){return client['request'](_0x3d33c3,_0x346d3a)[_0xb641('0xd')](function(_0x372315){logger[_0xb641('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x35debb,_0xb641('0xf'));logger[_0xb641('0x10')](_0xb641('0x11'),_0x35debb,_0xb641('0xf'),JSON[_0xb641('0x12')](_0x372315));if(_0x372315[_0xb641('0x13')]){if(_0x372315['error'][_0xb641('0x14')]===0x1f4){logger['error'](_0xb641('0x15'),_0x35debb,_0x372315[_0xb641('0x13')][_0xb641('0x16')]);return _0x10ccc4(_0x372315[_0xb641('0x13')][_0xb641('0x16')]);}logger[_0xb641('0x13')](_0xb641('0x15'),_0x35debb,_0x372315[_0xb641('0x13')][_0xb641('0x16')]);return _0x3cb5a1(_0x372315[_0xb641('0x13')]['message']);}else{logger[_0xb641('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x35debb,_0xb641('0xf'));_0x3cb5a1(_0x372315[_0xb641('0x17')]['message']);}})[_0xb641('0x18')](function(_0x408417){logger[_0xb641('0x13')](_0xb641('0x15'),_0x35debb,_0x408417);_0x10ccc4(_0x408417);});});} \ No newline at end of file +var _0x6a9e=['request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x6a9e,0xb4));var _0xe6a9=function(_0x5bd239,_0x50dfd9){_0x5bd239=_0x5bd239-0x0;var _0x1e9bab=_0x6a9e[_0x5bd239];return _0x1e9bab;};'use strict';var _=require(_0xe6a9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe6a9('0x1'));var rs=require(_0xe6a9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe6a9('0x3'))['db'];var utils=require(_0xe6a9('0x4'));var logger=require(_0xe6a9('0x5'))('rpc');var config=require(_0xe6a9('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xe6a9('0x7')][_0xe6a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2fd1cf,_0x2de50b,_0x53ad1b){return new BPromise(function(_0x394b2d,_0x1c4b49){return client[_0xe6a9('0x9')](_0x2fd1cf,_0x53ad1b)[_0xe6a9('0xa')](function(_0x5a88b8){logger[_0xe6a9('0xb')](_0xe6a9('0xc'),_0x2de50b,_0xe6a9('0xd'));logger[_0xe6a9('0xe')](_0xe6a9('0xf'),_0x2de50b,_0xe6a9('0xd'),JSON[_0xe6a9('0x10')](_0x5a88b8));if(_0x5a88b8[_0xe6a9('0x11')]){if(_0x5a88b8[_0xe6a9('0x11')][_0xe6a9('0x12')]===0x1f4){logger[_0xe6a9('0x11')](_0xe6a9('0xc'),_0x2de50b,_0x5a88b8[_0xe6a9('0x11')][_0xe6a9('0x13')]);return _0x1c4b49(_0x5a88b8[_0xe6a9('0x11')]['message']);}logger[_0xe6a9('0x11')](_0xe6a9('0xc'),_0x2de50b,_0x5a88b8[_0xe6a9('0x11')]['message']);return _0x394b2d(_0x5a88b8['error'][_0xe6a9('0x13')]);}else{logger[_0xe6a9('0xb')](_0xe6a9('0xc'),_0x2de50b,_0xe6a9('0xd'));_0x394b2d(_0x5a88b8['result'][_0xe6a9('0x13')]);}})[_0xe6a9('0x14')](function(_0x44779c){logger[_0xe6a9('0x11')](_0xe6a9('0xc'),_0x2de50b,_0x44779c);_0x1c4b49(_0x44779c);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index f6c9e50..c009479 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 _0xfcab=['./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment'];(function(_0x11c032,_0x4ca503){var _0x55919f=function(_0x97e42c){while(--_0x97e42c){_0x11c032['push'](_0x11c032['shift']());}};_0x55919f(++_0x4ca503);}(_0xfcab,0x175));var _0xbfca=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xfcab[_0x25a0b9];return _0x30b9ab;};'use strict';var multer=require(_0xbfca('0x0'));var util=require('util');var path=require(_0xbfca('0x1'));var timeout=require(_0xbfca('0x2'));var express=require(_0xbfca('0x3'));var router=express[_0xbfca('0x4')]();var auth=require(_0xbfca('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xbfca('0x6'));var controller=require(_0xbfca('0x7'));router[_0xbfca('0x8')]('/',auth[_0xbfca('0x9')](),controller[_0xbfca('0xa')]);router[_0xbfca('0x8')](_0xbfca('0xb'),auth['isAuthenticated'](),controller[_0xbfca('0xc')]);router[_0xbfca('0x8')](_0xbfca('0xd'),auth[_0xbfca('0x9')](),controller[_0xbfca('0xe')]);router[_0xbfca('0xf')]('/',auth[_0xbfca('0x9')](),controller[_0xbfca('0x10')]);router[_0xbfca('0x11')](_0xbfca('0xd'),auth[_0xbfca('0x9')](),controller['update']);router[_0xbfca('0x12')](_0xbfca('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xbfca('0x13')]=router; \ No newline at end of file +var _0x1282=['post','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x34779a,_0x2d912){var _0x4ce21c=function(_0x3ff6ce){while(--_0x3ff6ce){_0x34779a['push'](_0x34779a['shift']());}};_0x4ce21c(++_0x2d912);}(_0x1282,0xad));var _0x2128=function(_0x47efba,_0x3ccb7c){_0x47efba=_0x47efba-0x0;var _0xf883a6=_0x1282[_0x47efba];return _0xf883a6;};'use strict';var multer=require(_0x2128('0x0'));var util=require(_0x2128('0x1'));var path=require(_0x2128('0x2'));var timeout=require(_0x2128('0x3'));var express=require(_0x2128('0x4'));var router=express[_0x2128('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2128('0x6'));var config=require(_0x2128('0x7'));var controller=require(_0x2128('0x8'));router[_0x2128('0x9')]('/',auth[_0x2128('0xa')](),controller[_0x2128('0xb')]);router[_0x2128('0x9')](_0x2128('0xc'),auth[_0x2128('0xa')](),controller[_0x2128('0xd')]);router['get'](_0x2128('0xe'),auth[_0x2128('0xa')](),controller[_0x2128('0xf')]);router[_0x2128('0x10')]('/',auth[_0x2128('0xa')](),controller['create']);router[_0x2128('0x11')](_0x2128('0xe'),auth[_0x2128('0xa')](),controller[_0x2128('0x12')]);router[_0x2128('0x13')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x2128('0x14')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index fbf3f8f..4031ce6 100644 --- a/server/api/chatProactiveAction/chatProactiveAction.attributes.js +++ b/server/api/chatProactiveAction/chatProactiveAction.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa4dd=['INTEGER','sequelize','exports','STRING','ENUM','mouseOver'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0xa4dd,0x1b1));var _0xda4d=function(_0x4df1f5,_0x39c6d2){_0x4df1f5=_0x4df1f5-0x0;var _0x56585b=_0xa4dd[_0x4df1f5];return _0x56585b;};'use strict';var Sequelize=require(_0xda4d('0x0'));module[_0xda4d('0x1')]={'name':{'type':Sequelize[_0xda4d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xda4d('0x3')](_0xda4d('0x4'),'timeout'),'defaultValue':_0xda4d('0x4')},'selector':{'type':Sequelize[_0xda4d('0x2')]},'timeout':{'type':Sequelize[_0xda4d('0x5')]}}; \ No newline at end of file +var _0xd581=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xd581,0xeb));var _0x1d58=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xd581[_0x22b68a];return _0x1ac67a;};'use strict';var Sequelize=require(_0x1d58('0x0'));module[_0x1d58('0x1')]={'name':{'type':Sequelize[_0x1d58('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x1d58('0x3'),_0x1d58('0x4')),'defaultValue':_0x1d58('0x3')},'selector':{'type':Sequelize[_0x1d58('0x2')]},'timeout':{'type':Sequelize[_0x1d58('0x5')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index addf4aa..08ac436 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(_0x55e2e7,_0x3d7ffb){var _0x2ca98a=function(_0x499090){while(--_0x499090){_0x55e2e7['push'](_0x55e2e7['shift']());}};_0x2ca98a(++_0x3d7ffb);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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 _0x70e0=['mustache','path','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','offset','limit','status','set','Content-Range','apply','reject','update','then','destroy','end','stack','send','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','fields','attributes','length','include','options','catch','create','body','find','html-pdf','eml-format','rimraf','request-promise','moment','bluebird'];(function(_0x41b648,_0x4b0578){var _0x24abc7=function(_0x200941){while(--_0x200941){_0x41b648['push'](_0x41b648['shift']());}};_0x24abc7(++_0x4b0578);}(_0x70e0,0x17b));var _0x070e=function(_0x5c4d74,_0x1c4c05){_0x5c4d74=_0x5c4d74-0x0;var _0xd2ccf7=_0x70e0[_0x5c4d74];return _0xd2ccf7;};'use strict';var pdf=require(_0x070e('0x0'));var emlformat=require(_0x070e('0x1'));var rimraf=require(_0x070e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x070e('0x3'));var moment=require(_0x070e('0x4'));var BPromise=require(_0x070e('0x5'));var Mustache=require(_0x070e('0x6'));var util=require('util');var path=require(_0x070e('0x7'));var sox=require('sox');var csv=require(_0x070e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x070e('0x9'));var jsforce=require(_0x070e('0xa'));var deskjs=require(_0x070e('0xb'));var toCsv=require(_0x070e('0x8'));var querystring=require(_0x070e('0xc'));var Papa=require(_0x070e('0xd'));var Redis=require(_0x070e('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x070e('0xf'));var hardwareService=require(_0x070e('0x10'));var logger=require(_0x070e('0x11'))(_0x070e('0x12'));var utils=require(_0x070e('0x13'));var config=require(_0x070e('0x14'));var db=require(_0x070e('0x15'))['db'];function respondWithStatusCode(_0x1baa12,_0x39d2b9){_0x39d2b9=_0x39d2b9||0xcc;return function(_0x5bf079){if(_0x5bf079){return _0x1baa12[_0x070e('0x16')](_0x39d2b9);}return _0x1baa12['status'](_0x39d2b9)['end']();};}function respondWithResult(_0x24baba,_0x56c7ba){_0x56c7ba=_0x56c7ba||0xc8;return function(_0x4a33d2){if(_0x4a33d2){return _0x24baba['status'](_0x56c7ba)[_0x070e('0x17')](_0x4a33d2);}};}function respondWithFilteredResult(_0x14c3fd,_0x51d14d){return function(_0x5d3a38){if(_0x5d3a38){var _0x373d86=_0x5d3a38['count'],_0xeae1a5=_0x51d14d['offset'],_0x180897=_0x51d14d[_0x070e('0x18')]+_0x51d14d[_0x070e('0x19')],_0x19d9da;if(_0x180897>=_0x373d86){_0x180897=_0x373d86;_0x19d9da=0xc8;}else{_0x19d9da=0xce;}_0x14c3fd[_0x070e('0x1a')](_0x19d9da);return _0x14c3fd[_0x070e('0x1b')](_0x070e('0x1c'),_0xeae1a5+'-'+_0x180897+'/'+_0x373d86)['json'](_0x5d3a38);}return null;};}function patchUpdates(_0x3938b5){return function(_0x168dc6){try{jsonpatch[_0x070e('0x1d')](_0x168dc6,_0x3938b5,!![]);}catch(_0x3ea105){return BPromise[_0x070e('0x1e')](_0x3ea105);}return _0x168dc6['save']();};}function saveUpdates(_0x5b2f48,_0x4e958f){return function(_0x9907cf){if(_0x9907cf){return _0x9907cf[_0x070e('0x1f')](_0x5b2f48)[_0x070e('0x20')](function(_0x4be0d7){return _0x4be0d7;});}return null;};}function removeEntity(_0x5b184,_0x5dc5d2){return function(_0xf8dd5d){if(_0xf8dd5d){return _0xf8dd5d[_0x070e('0x21')]()[_0x070e('0x20')](function(){_0x5b184[_0x070e('0x1a')](0xcc)[_0x070e('0x22')]();});}};}function handleEntityNotFound(_0xa86797,_0xe405e){return function(_0x164cdf){if(!_0x164cdf){_0xa86797['sendStatus'](0x194);}return _0x164cdf;};}function handleError(_0x2f8055,_0x270061){_0x270061=_0x270061||0x1f4;return function(_0x4790eb){logger['error'](_0x4790eb[_0x070e('0x23')]);if(_0x4790eb['name']){delete _0x4790eb['name'];}_0x2f8055[_0x070e('0x1a')](_0x270061)[_0x070e('0x24')](_0x4790eb);};}exports[_0x070e('0x25')]=function(_0x1743cc,_0x4763c6){var _0x497f58={'raw':!![],'where':{'id':_0x1743cc[_0x070e('0x26')]['id']}},_0x374c54={};_0x374c54[_0x070e('0x27')]=_[_0x070e('0x28')](db[_0x070e('0x29')][_0x070e('0x2a')]);_0x374c54[_0x070e('0x2b')]=_[_0x070e('0x28')](_0x1743cc['query']);_0x374c54[_0x070e('0x2c')]=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],_0x374c54['query']);_0x497f58['attributes']=_[_0x070e('0x2d')](_0x374c54[_0x070e('0x27')],qs[_0x070e('0x2e')](_0x1743cc['query'][_0x070e('0x2e')]));_0x497f58[_0x070e('0x2f')]=_0x497f58[_0x070e('0x2f')][_0x070e('0x30')]?_0x497f58['attributes']:_0x374c54['model'];if(_0x1743cc['query']['includeAll']){_0x497f58[_0x070e('0x31')]=[{'all':!![]}];}_0x497f58=_['merge']({},_0x497f58,_0x1743cc[_0x070e('0x32')]);return db[_0x070e('0x29')]['find'](_0x497f58)['then'](handleEntityNotFound(_0x4763c6,null))[_0x070e('0x20')](respondWithResult(_0x4763c6,null))[_0x070e('0x33')](handleError(_0x4763c6,null));};exports['create']=function(_0x546a16,_0x41ade4){return db[_0x070e('0x29')][_0x070e('0x34')](_0x546a16[_0x070e('0x35')],{})[_0x070e('0x20')](respondWithResult(_0x41ade4,0xc9))['catch'](handleError(_0x41ade4,null));};exports['update']=function(_0x24d17d,_0x3011c4){if(_0x24d17d[_0x070e('0x35')]['id']){delete _0x24d17d[_0x070e('0x35')]['id'];}return db[_0x070e('0x29')]['find']({'where':{'id':_0x24d17d[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x3011c4,null))['then'](saveUpdates(_0x24d17d[_0x070e('0x35')],null))[_0x070e('0x20')](respondWithResult(_0x3011c4,null))['catch'](handleError(_0x3011c4,null));};exports['destroy']=function(_0x5ddbe9,_0x363bff){return db[_0x070e('0x29')][_0x070e('0x36')]({'where':{'id':_0x5ddbe9[_0x070e('0x26')]['id']}})[_0x070e('0x20')](handleEntityNotFound(_0x363bff,null))['then'](removeEntity(_0x363bff,null))[_0x070e('0x33')](handleError(_0x363bff,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 23a6b81..e468d28 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 _0xef96=['chat_proactive_actions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./chatProactiveAction.attributes','ChatProactiveAction'];(function(_0x140d8e,_0x5eb62d){var _0x47094e=function(_0x2c21e3){while(--_0x2c21e3){_0x140d8e['push'](_0x140d8e['shift']());}};_0x47094e(++_0x5eb62d);}(_0xef96,0x182));var _0x6ef9=function(_0x5b2ff8,_0x197f8f){_0x5b2ff8=_0x5b2ff8-0x0;var _0x502c11=_0xef96[_0x5b2ff8];return _0x502c11;};'use strict';var _=require(_0x6ef9('0x0'));var util=require(_0x6ef9('0x1'));var logger=require(_0x6ef9('0x2'))(_0x6ef9('0x3'));var moment=require(_0x6ef9('0x4'));var BPromise=require(_0x6ef9('0x5'));var rp=require(_0x6ef9('0x6'));var fs=require('fs');var path=require(_0x6ef9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6ef9('0x8'));module['exports']=function(_0x54b0f9,_0x349597){return _0x54b0f9['define'](_0x6ef9('0x9'),attributes,{'tableName':_0x6ef9('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e5b=['chat_proactive_actions','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','ChatProactiveAction'];(function(_0x2b8ecb,_0x42ec28){var _0x2090ff=function(_0x41e17d){while(--_0x41e17d){_0x2b8ecb['push'](_0x2b8ecb['shift']());}};_0x2090ff(++_0x42ec28);}(_0x4e5b,0x1a3));var _0xb4e5=function(_0x32c655,_0x292267){_0x32c655=_0x32c655-0x0;var _0x24a94b=_0x4e5b[_0x32c655];return _0x24a94b;};'use strict';var _=require('lodash');var util=require(_0xb4e5('0x0'));var logger=require(_0xb4e5('0x1'))(_0xb4e5('0x2'));var moment=require(_0xb4e5('0x3'));var BPromise=require('bluebird');var rp=require(_0xb4e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb4e5('0x5'));var config=require(_0xb4e5('0x6'));var attributes=require(_0xb4e5('0x7'));module[_0xb4e5('0x8')]=function(_0x39f130,_0x3e3c1e){return _0x39f130['define'](_0xb4e5('0x9'),attributes,{'tableName':_0xb4e5('0xa'),'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 9e7cc22..8775358 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 _0x2093=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x44f000,_0x4fcb9f){var _0xa7ffd1=function(_0xff7ddd){while(--_0xff7ddd){_0x44f000['push'](_0x44f000['shift']());}};_0xa7ffd1(++_0x4fcb9f);}(_0x2093,0xcd));var _0x3209=function(_0x3ea4ce,_0x6bf6f1){_0x3ea4ce=_0x3ea4ce-0x0;var _0x36cf6e=_0x2093[_0x3ea4ce];return _0x36cf6e;};'use strict';var _=require(_0x3209('0x0'));var util=require(_0x3209('0x1'));var moment=require(_0x3209('0x2'));var BPromise=require(_0x3209('0x3'));var rs=require(_0x3209('0x4'));var fs=require('fs');var Redis=require(_0x3209('0x5'));var db=require(_0x3209('0x6'))['db'];var utils=require(_0x3209('0x7'));var logger=require(_0x3209('0x8'))(_0x3209('0x9'));var config=require(_0x3209('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x3209('0xb')][_0x3209('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x527e46,_0x354598,_0x3f24b4){return new BPromise(function(_0x5d6f23,_0x4ddb08){return client[_0x3209('0xd')](_0x527e46,_0x3f24b4)[_0x3209('0xe')](function(_0x2519b7){logger[_0x3209('0xf')](_0x3209('0x10'),_0x354598,_0x3209('0x11'));logger[_0x3209('0x12')]('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x354598,_0x3209('0x11'),JSON[_0x3209('0x13')](_0x2519b7));if(_0x2519b7[_0x3209('0x14')]){if(_0x2519b7['error'][_0x3209('0x15')]===0x1f4){logger['error'](_0x3209('0x10'),_0x354598,_0x2519b7['error']['message']);return _0x4ddb08(_0x2519b7['error'][_0x3209('0x16')]);}logger[_0x3209('0x14')](_0x3209('0x10'),_0x354598,_0x2519b7[_0x3209('0x14')]['message']);return _0x5d6f23(_0x2519b7[_0x3209('0x14')][_0x3209('0x16')]);}else{logger['info']('ChatProactiveAction,\x20%s,\x20%s',_0x354598,_0x3209('0x11'));_0x5d6f23(_0x2519b7[_0x3209('0x17')][_0x3209('0x16')]);}})[_0x3209('0x18')](function(_0xbb95d){logger[_0x3209('0x14')](_0x3209('0x10'),_0x354598,_0xbb95d);_0x4ddb08(_0xbb95d);});});} \ No newline at end of file +var _0x2704=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatProactiveAction,\x20%s,\x20%s','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x137e04,_0x3c0799){var _0x4c6762=function(_0x45f489){while(--_0x45f489){_0x137e04['push'](_0x137e04['shift']());}};_0x4c6762(++_0x3c0799);}(_0x2704,0x198));var _0x4270=function(_0x28d1ea,_0x426311){_0x28d1ea=_0x28d1ea-0x0;var _0x1667b6=_0x2704[_0x28d1ea];return _0x1667b6;};'use strict';var _=require(_0x4270('0x0'));var util=require('util');var moment=require(_0x4270('0x1'));var BPromise=require(_0x4270('0x2'));var rs=require(_0x4270('0x3'));var fs=require('fs');var Redis=require(_0x4270('0x4'));var db=require(_0x4270('0x5'))['db'];var utils=require(_0x4270('0x6'));var logger=require(_0x4270('0x7'))(_0x4270('0x8'));var config=require(_0x4270('0x9'));var jayson=require(_0x4270('0xa'));var client=jayson[_0x4270('0xb')][_0x4270('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x459c76,_0x359efa,_0x47587f){return new BPromise(function(_0x3305ed,_0x494c54){return client[_0x4270('0xd')](_0x459c76,_0x47587f)[_0x4270('0xe')](function(_0x5078b6){logger[_0x4270('0xf')](_0x4270('0x10'),_0x359efa,'request\x20sent');logger[_0x4270('0x11')](_0x4270('0x12'),_0x359efa,_0x4270('0x13'),JSON[_0x4270('0x14')](_0x5078b6));if(_0x5078b6[_0x4270('0x15')]){if(_0x5078b6[_0x4270('0x15')][_0x4270('0x16')]===0x1f4){logger['error'](_0x4270('0x10'),_0x359efa,_0x5078b6[_0x4270('0x15')]['message']);return _0x494c54(_0x5078b6[_0x4270('0x15')][_0x4270('0x17')]);}logger[_0x4270('0x15')](_0x4270('0x10'),_0x359efa,_0x5078b6[_0x4270('0x15')][_0x4270('0x17')]);return _0x3305ed(_0x5078b6['error'][_0x4270('0x17')]);}else{logger[_0x4270('0xf')](_0x4270('0x10'),_0x359efa,'request\x20sent');_0x3305ed(_0x5078b6[_0x4270('0x18')][_0x4270('0x17')]);}})[_0x4270('0x19')](function(_0x5ede76){logger[_0x4270('0x15')](_0x4270('0x10'),_0x359efa,_0x5ede76);_0x494c54(_0x5ede76);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 9ebb71a..f2d8528 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 _0x1335=['/:id','isAuthenticated','show','put','update','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller'];(function(_0x531ea2,_0x103ccf){var _0x3a8118=function(_0x4f4640){while(--_0x4f4640){_0x531ea2['push'](_0x531ea2['shift']());}};_0x3a8118(++_0x103ccf);}(_0x1335,0x19c));var _0x5133=function(_0x294021,_0x48100e){_0x294021=_0x294021-0x0;var _0x5712fb=_0x1335[_0x294021];return _0x5712fb;};'use strict';var multer=require(_0x5133('0x0'));var util=require(_0x5133('0x1'));var path=require(_0x5133('0x2'));var timeout=require('connect-timeout');var express=require(_0x5133('0x3'));var router=express['Router']();var auth=require(_0x5133('0x4'));var interaction=require(_0x5133('0x5'));var config=require(_0x5133('0x6'));var controller=require(_0x5133('0x7'));router['get'](_0x5133('0x8'),auth[_0x5133('0x9')](),controller[_0x5133('0xa')]);router['post']('/',auth[_0x5133('0x9')](),controller['create']);router[_0x5133('0xb')](_0x5133('0x8'),auth[_0x5133('0x9')](),controller[_0x5133('0xc')]);router['delete'](_0x5133('0x8'),auth['isAuthenticated'](),controller[_0x5133('0xd')]);module[_0x5133('0xe')]=router; \ No newline at end of file +var _0xaffe=['post','put','delete','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show'];(function(_0x1ecf1c,_0x339929){var _0x2ca1b2=function(_0x5c7834){while(--_0x5c7834){_0x1ecf1c['push'](_0x1ecf1c['shift']());}};_0x2ca1b2(++_0x339929);}(_0xaffe,0x158));var _0xeaff=function(_0x187e6c,_0x4802f9){_0x187e6c=_0x187e6c-0x0;var _0x7c946e=_0xaffe[_0x187e6c];return _0x7c946e;};'use strict';var multer=require(_0xeaff('0x0'));var util=require(_0xeaff('0x1'));var path=require(_0xeaff('0x2'));var timeout=require('connect-timeout');var express=require(_0xeaff('0x3'));var router=express[_0xeaff('0x4')]();var auth=require(_0xeaff('0x5'));var interaction=require(_0xeaff('0x6'));var config=require(_0xeaff('0x7'));var controller=require(_0xeaff('0x8'));router[_0xeaff('0x9')](_0xeaff('0xa'),auth[_0xeaff('0xb')](),controller[_0xeaff('0xc')]);router[_0xeaff('0xd')]('/',auth[_0xeaff('0xb')](),controller['create']);router[_0xeaff('0xe')](_0xeaff('0xa'),auth[_0xeaff('0xb')](),controller['update']);router[_0xeaff('0xf')](_0xeaff('0xa'),auth[_0xeaff('0xb')](),controller[_0xeaff('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index a832158..6f5568f 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 _0x6d87=['exports','name','STRING','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x10e544,_0x3826ad){var _0x35206c=function(_0x1eeb8e){while(--_0x1eeb8e){_0x10e544['push'](_0x10e544['shift']());}};_0x35206c(++_0x3826ad);}(_0x6d87,0xc5));var _0x76d8=function(_0x4ed711,_0x3670bc){_0x4ed711=_0x4ed711-0x0;var _0x42da0b=_0x6d87[_0x4ed711];return _0x42da0b;};'use strict';var Sequelize=require(_0x76d8('0x0'));module[_0x76d8('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x76d8('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x76d8('0x3')]},'timeout':{'type':Sequelize[_0x76d8('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x76d8('0x5')](_0x76d8('0x6'),_0x76d8('0x7'),_0x76d8('0x8'))}}; \ No newline at end of file +var _0x10ff=['ENUM','beepall','roundrobin','sequelize','STRING','INTEGER'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x10ff,0x18f));var _0xf10f=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x10ff[_0x40a045];return _0x1a687c;};'use strict';var Sequelize=require(_0xf10f('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf10f('0x1')]},'timeout':{'type':Sequelize[_0xf10f('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf10f('0x3')]('rrmemory',_0xf10f('0x4'),_0xf10f('0x5'))}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index adb8949..279a9c7 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 _0x3e94=['apply','reject','save','update','destroy','get','ChatQueues','UserProfileResource','sendStatus','name','send','index','map','ChatQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','include','findAll','rows','catch','show','params','includeAll','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','getMembers','UserChatQueue','length','User','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','findOne','addTeams','Team','Agents','online','voicePause','interface','flatMap','transaction','findOrCreate','emit','userChatQueue:save','removeTeams','ids','select','field','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','union','value','isEmpty','removeAgents','forEach','userChatQueue:remove','addAgents','spread','isArray','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','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','ChatQueue,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','end','status','json','offset','limit','set'];(function(_0xe44494,_0x3b38c9){var _0x3198e2=function(_0x523193){while(--_0x523193){_0xe44494['push'](_0xe44494['shift']());}};_0x3198e2(++_0x3b38c9);}(_0x3e94,0x67));var _0x43e9=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x3e94[_0x4cf98e];return _0x1623ac;};'use strict';var pdf=require(_0x43e9('0x0'));var emlformat=require(_0x43e9('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x43e9('0x2'));var jsonpatch=require(_0x43e9('0x3'));var rp=require(_0x43e9('0x4'));var moment=require('moment');var BPromise=require(_0x43e9('0x5'));var Mustache=require(_0x43e9('0x6'));var util=require(_0x43e9('0x7'));var path=require('path');var sox=require(_0x43e9('0x8'));var csv=require('to-csv');var ejs=require(_0x43e9('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x43e9('0xa'));var crypto=require(_0x43e9('0xb'));var jsforce=require(_0x43e9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x43e9('0xd'));var querystring=require(_0x43e9('0xe'));var Papa=require(_0x43e9('0xf'));var Redis=require(_0x43e9('0x10'));var authService=require(_0x43e9('0x11'));var qs=require(_0x43e9('0x12'));var as=require(_0x43e9('0x13'));var hardwareService=require(_0x43e9('0x14'));var logger=require(_0x43e9('0x15'))('api');var utils=require(_0x43e9('0x16'));var config=require(_0x43e9('0x17'));var db=require(_0x43e9('0x18'))['db'];config['redis']=_[_0x43e9('0x19')](config[_0x43e9('0x1a')],{'host':_0x43e9('0x1b'),'port':0x18eb});var socket=require(_0x43e9('0x1c'))(new Redis(config[_0x43e9('0x1a')]));require('./chatQueue.socket')['register'](socket);var jayson=require(_0x43e9('0x1d'));var client=jayson['client'][_0x43e9('0x1e')]({'port':0x232a});function checkPasswordPattern(_0x471cb8,_0x210ab2,_0x274175){if(_0x274175){var _0x3017bf=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3017bf[_0x43e9('0x1f')](_0x210ab2)){return _0x471cb8;}else{throw new db[(_0x43e9('0x20'))][(_0x43e9('0x21'))](_0x43e9('0x22'));}}else{return _0x471cb8;}}function respondWithRpcPromise(_0x13ceac,_0x2636df,_0x21ceda,_0x310476){return new BPromise(function(_0x31614e,_0x527d97){var _0x4e9fef=_0x310476||client;return _0x4e9fef[_0x43e9('0x23')](_0x13ceac,_0x21ceda)[_0x43e9('0x24')](function(_0x663c43){logger[_0x43e9('0x25')](_0x43e9('0x26'),_0x2636df,'request\x20sent');logger[_0x43e9('0x27')]('ChatQueue,\x20%s,\x20%s,\x20%s',_0x2636df,_0x43e9('0x28'),JSON[_0x43e9('0x29')](_0x663c43));if(_0x663c43[_0x43e9('0x2a')]){if(_0x663c43[_0x43e9('0x2a')][_0x43e9('0x2b')]===0x1f4){logger['error'](_0x43e9('0x26'),_0x2636df,_0x663c43[_0x43e9('0x2a')]['message']);return _0x527d97(_0x663c43[_0x43e9('0x2a')][_0x43e9('0x2c')]);}logger[_0x43e9('0x2a')](_0x43e9('0x26'),_0x2636df,_0x663c43['error'][_0x43e9('0x2c')]);return _0x31614e(_0x663c43['error'][_0x43e9('0x2c')]);}else{logger['info']('ChatQueue,\x20%s,\x20%s',_0x2636df,'request\x20sent');_0x31614e(_0x663c43['result'][_0x43e9('0x2c')]);}})['catch'](function(_0x20a270){logger[_0x43e9('0x2a')](_0x43e9('0x26'),_0x2636df,_0x20a270);_0x527d97(_0x20a270);});});}function respondWithStatusCode(_0x55a298,_0x50cf61){_0x50cf61=_0x50cf61||0xcc;return function(_0xf64426){if(_0xf64426){return _0x55a298['sendStatus'](_0x50cf61);}return _0x55a298['status'](_0x50cf61)[_0x43e9('0x2d')]();};}function respondWithResult(_0x506ff4,_0x502f88){_0x502f88=_0x502f88||0xc8;return function(_0x51b356){if(_0x51b356){return _0x506ff4[_0x43e9('0x2e')](_0x502f88)[_0x43e9('0x2f')](_0x51b356);}};}function respondWithFilteredResult(_0x5c7b19,_0x373101){return function(_0x4bbf3a){if(_0x4bbf3a){var _0x4191ff=_0x4bbf3a['count'],_0x5777a8=_0x373101[_0x43e9('0x30')],_0x24dfff=_0x373101[_0x43e9('0x30')]+_0x373101[_0x43e9('0x31')],_0x580bd0;if(_0x24dfff>=_0x4191ff){_0x24dfff=_0x4191ff;_0x580bd0=0xc8;}else{_0x580bd0=0xce;}_0x5c7b19[_0x43e9('0x2e')](_0x580bd0);return _0x5c7b19[_0x43e9('0x32')]('Content-Range',_0x5777a8+'-'+_0x24dfff+'/'+_0x4191ff)[_0x43e9('0x2f')](_0x4bbf3a);}return null;};}function patchUpdates(_0x4bdded){return function(_0x5c99e8){try{jsonpatch[_0x43e9('0x33')](_0x5c99e8,_0x4bdded,!![]);}catch(_0x3f9a1b){return BPromise[_0x43e9('0x34')](_0x3f9a1b);}return _0x5c99e8[_0x43e9('0x35')]();};}function saveUpdates(_0x5e88bb,_0x2642a2){return function(_0x2efff5){if(_0x2efff5){return _0x2efff5[_0x43e9('0x36')](_0x5e88bb)[_0x43e9('0x24')](function(_0x55ea93){return _0x55ea93;});}return null;};}function removeEntity(_0x23cb79,_0x3cf4c8){return function(_0x31822e){if(_0x31822e){return _0x31822e[_0x43e9('0x37')]()[_0x43e9('0x24')](function(){var _0x3599e5=_0x31822e[_0x43e9('0x38')]({'plain':!![]});var _0x4b8152=_0x43e9('0x39');return db[_0x43e9('0x3a')][_0x43e9('0x37')]({'where':{'type':_0x4b8152,'resourceId':_0x3599e5['id']}})[_0x43e9('0x24')](function(){return _0x31822e;});})[_0x43e9('0x24')](function(){_0x23cb79['status'](0xcc)[_0x43e9('0x2d')]();});}};}function handleEntityNotFound(_0x238998,_0x3e3d0f){return function(_0x4f2308){if(!_0x4f2308){_0x238998[_0x43e9('0x3b')](0x194);}return _0x4f2308;};}function handleError(_0x760c9b,_0x1ba37f){_0x1ba37f=_0x1ba37f||0x1f4;return function(_0x2be16e){logger[_0x43e9('0x2a')](_0x2be16e['stack']);if(_0x2be16e[_0x43e9('0x3c')]){delete _0x2be16e[_0x43e9('0x3c')];}_0x760c9b[_0x43e9('0x2e')](_0x1ba37f)[_0x43e9('0x3d')](_0x2be16e);};}exports[_0x43e9('0x3e')]=function(_0x428763,_0xd5a134){var _0x330820={},_0x3ca9d6={},_0x36ac6d={'count':0x0,'rows':[]};var _0x1b5463=_[_0x43e9('0x3f')](db[_0x43e9('0x40')][_0x43e9('0x41')],function(_0x59f3c1){return{'name':_0x59f3c1[_0x43e9('0x42')],'type':_0x59f3c1[_0x43e9('0x43')][_0x43e9('0x44')]};});_0x3ca9d6['model']=_[_0x43e9('0x3f')](_0x1b5463,_0x43e9('0x3c'));_0x3ca9d6[_0x43e9('0x45')]=_[_0x43e9('0x46')](_0x428763[_0x43e9('0x45')]);_0x3ca9d6[_0x43e9('0x47')]=_['intersection'](_0x3ca9d6[_0x43e9('0x48')],_0x3ca9d6[_0x43e9('0x45')]);_0x330820[_0x43e9('0x49')]=_[_0x43e9('0x4a')](_0x3ca9d6[_0x43e9('0x48')],qs[_0x43e9('0x4b')](_0x428763[_0x43e9('0x45')][_0x43e9('0x4b')]));_0x330820[_0x43e9('0x49')]=_0x330820[_0x43e9('0x49')]['length']?_0x330820['attributes']:_0x3ca9d6[_0x43e9('0x48')];if(!_0x428763[_0x43e9('0x45')][_0x43e9('0x4c')](_0x43e9('0x4d'))){_0x330820[_0x43e9('0x31')]=qs[_0x43e9('0x31')](_0x428763[_0x43e9('0x45')]['limit']);_0x330820[_0x43e9('0x30')]=qs['offset'](_0x428763[_0x43e9('0x45')][_0x43e9('0x30')]);}_0x330820[_0x43e9('0x4e')]=qs[_0x43e9('0x4f')](_0x428763[_0x43e9('0x45')][_0x43e9('0x4f')]);_0x330820[_0x43e9('0x50')]=qs[_0x43e9('0x47')](_[_0x43e9('0x51')](_0x428763['query'],_0x3ca9d6[_0x43e9('0x47')]));if(_0x428763[_0x43e9('0x45')][_0x43e9('0x52')]){_0x330820[_0x43e9('0x50')]=_[_0x43e9('0x53')](_0x330820[_0x43e9('0x50')],{'$or':_['map'](_0x1b5463,function(_0x41257d){if(_0x41257d[_0x43e9('0x43')]!=='VIRTUAL'){var _0x3e132d={};_0x3e132d[_0x41257d[_0x43e9('0x3c')]]={'$like':'%'+_0x428763[_0x43e9('0x45')][_0x43e9('0x52')]+'%'};return _0x3e132d;}})});}_0x330820=_[_0x43e9('0x53')]({},_0x330820,_0x428763[_0x43e9('0x54')]);var _0x1fc17a={'where':_0x330820[_0x43e9('0x50')]};return db[_0x43e9('0x40')]['count'](_0x1fc17a)['then'](function(_0x1fe320){_0x36ac6d[_0x43e9('0x55')]=_0x1fe320;if(_0x428763[_0x43e9('0x45')]['includeAll']){_0x330820[_0x43e9('0x56')]=[{'all':!![]}];}return db[_0x43e9('0x40')][_0x43e9('0x57')](_0x330820);})['then'](function(_0x5d8c11){_0x36ac6d[_0x43e9('0x58')]=_0x5d8c11;return _0x36ac6d;})[_0x43e9('0x24')](respondWithFilteredResult(_0xd5a134,_0x330820))[_0x43e9('0x59')](handleError(_0xd5a134,null));};exports[_0x43e9('0x5a')]=function(_0x5126c9,_0x10b8cd){var _0x197d8d={'raw':!![],'where':{'id':_0x5126c9[_0x43e9('0x5b')]['id']}},_0x4a42f6={};_0x4a42f6[_0x43e9('0x48')]=_['keys'](db[_0x43e9('0x40')][_0x43e9('0x41')]);_0x4a42f6['query']=_[_0x43e9('0x46')](_0x5126c9[_0x43e9('0x45')]);_0x4a42f6[_0x43e9('0x47')]=_[_0x43e9('0x4a')](_0x4a42f6['model'],_0x4a42f6[_0x43e9('0x45')]);_0x197d8d[_0x43e9('0x49')]=_[_0x43e9('0x4a')](_0x4a42f6[_0x43e9('0x48')],qs['fields'](_0x5126c9['query'][_0x43e9('0x4b')]));_0x197d8d['attributes']=_0x197d8d[_0x43e9('0x49')]['length']?_0x197d8d[_0x43e9('0x49')]:_0x4a42f6[_0x43e9('0x48')];if(_0x5126c9['query'][_0x43e9('0x5c')]){_0x197d8d[_0x43e9('0x56')]=[{'all':!![]}];}_0x197d8d=_[_0x43e9('0x53')]({},_0x197d8d,_0x5126c9[_0x43e9('0x54')]);return db['ChatQueue'][_0x43e9('0x5d')](_0x197d8d)['then'](handleEntityNotFound(_0x10b8cd,null))[_0x43e9('0x24')](respondWithResult(_0x10b8cd,null))[_0x43e9('0x59')](handleError(_0x10b8cd,null));};exports[_0x43e9('0x5e')]=function(_0x4e161a,_0x4ec88a){return db['ChatQueue'][_0x43e9('0x5e')](_0x4e161a[_0x43e9('0x5f')],{})['then'](function(_0x59a787){var _0xed51e4=_0x4e161a[_0x43e9('0x60')][_0x43e9('0x38')]({'plain':!![]});if(!_0xed51e4)throw new Error(_0x43e9('0x61'));if(_0xed51e4[_0x43e9('0x62')]===_0x43e9('0x60')){var _0x445b85=_0x59a787[_0x43e9('0x38')]({'plain':!![]});var _0xffe161=_0x43e9('0x39');return db['UserProfileSection'][_0x43e9('0x5d')]({'where':{'name':_0xffe161,'userProfileId':_0xed51e4[_0x43e9('0x63')]},'raw':!![]})[_0x43e9('0x24')](function(_0x550988){if(_0x550988&&_0x550988[_0x43e9('0x64')]===0x0){return db['UserProfileResource'][_0x43e9('0x5e')]({'name':_0x445b85[_0x43e9('0x3c')],'resourceId':_0x445b85['id'],'type':_0x550988[_0x43e9('0x3c')],'sectionId':_0x550988['id']},{})[_0x43e9('0x24')](function(){return _0x59a787;});}else{return _0x59a787;}})['catch'](function(_0x1a022a){logger[_0x43e9('0x2a')](_0x43e9('0x65'),_0x1a022a);throw _0x1a022a;});}return _0x59a787;})[_0x43e9('0x24')](respondWithResult(_0x4ec88a,0xc9))[_0x43e9('0x59')](handleError(_0x4ec88a,null));};exports[_0x43e9('0x36')]=function(_0x5703a5,_0x30eec3){if(_0x5703a5[_0x43e9('0x5f')]['id']){delete _0x5703a5[_0x43e9('0x5f')]['id'];}return db[_0x43e9('0x40')][_0x43e9('0x5d')]({'where':{'id':_0x5703a5[_0x43e9('0x5b')]['id']}})[_0x43e9('0x24')](handleEntityNotFound(_0x30eec3,null))['then'](saveUpdates(_0x5703a5[_0x43e9('0x5f')],null))['then'](respondWithResult(_0x30eec3,null))[_0x43e9('0x59')](handleError(_0x30eec3,null));};exports[_0x43e9('0x37')]=function(_0x4aaaac,_0x1ba3c0){return db['ChatQueue'][_0x43e9('0x5d')]({'where':{'id':_0x4aaaac['params']['id']}})['then'](handleEntityNotFound(_0x1ba3c0,null))[_0x43e9('0x24')](removeEntity(_0x1ba3c0,null))['catch'](handleError(_0x1ba3c0,null));};exports[_0x43e9('0x66')]=function(_0x82a7d7,_0x3b5d5f){return db[_0x43e9('0x40')]['describe']()[_0x43e9('0x24')](respondWithResult(_0x3b5d5f,null))[_0x43e9('0x59')](handleError(_0x3b5d5f,null));};exports[_0x43e9('0x67')]=function(_0x4fb0c7,_0x3dc355,_0xa69760){var _0x4755d8={'raw':!![],'where':{}},_0x3ec521={},_0x2d3ee2;return db['ChatQueue']['findOne']({'where':{'id':_0x4fb0c7[_0x43e9('0x5b')]['id']}})[_0x43e9('0x24')](handleEntityNotFound(_0x3dc355,null))[_0x43e9('0x24')](function(_0x154592){if(_0x154592){_0x2d3ee2=_0x154592['get']({'plain':!![]});_0x3ec521['model']=_['keys'](db[_0x43e9('0x68')]['rawAttributes']);_0x3ec521[_0x43e9('0x45')]=_['keys'](_0x4fb0c7[_0x43e9('0x45')]);_0x3ec521[_0x43e9('0x47')]=_[_0x43e9('0x4a')](_0x3ec521[_0x43e9('0x48')],_0x3ec521[_0x43e9('0x45')]);_0x4755d8[_0x43e9('0x49')]=_[_0x43e9('0x4a')](_0x3ec521[_0x43e9('0x48')],qs['fields'](_0x4fb0c7[_0x43e9('0x45')]['fields']));_0x4755d8[_0x43e9('0x49')]=_0x4755d8[_0x43e9('0x49')][_0x43e9('0x69')]?_0x4755d8[_0x43e9('0x49')]:_0x3ec521[_0x43e9('0x48')];if(!_0x4fb0c7[_0x43e9('0x45')]['hasOwnProperty']('nolimit')){_0x4755d8[_0x43e9('0x31')]=qs[_0x43e9('0x31')](_0x4fb0c7[_0x43e9('0x45')][_0x43e9('0x31')]);_0x4755d8[_0x43e9('0x30')]=qs[_0x43e9('0x30')](_0x4fb0c7[_0x43e9('0x45')][_0x43e9('0x30')]);}_0x4755d8[_0x43e9('0x4e')]=qs[_0x43e9('0x4f')](_0x4fb0c7[_0x43e9('0x45')][_0x43e9('0x4f')]);_0x4755d8['where']=qs[_0x43e9('0x47')](_[_0x43e9('0x51')](_0x4fb0c7[_0x43e9('0x45')],_0x3ec521[_0x43e9('0x47')]));_0x4755d8[_0x43e9('0x50')]['ChatQueueId']=_0x154592['id'];if(_0x4fb0c7[_0x43e9('0x45')]['filter']){_0x4755d8[_0x43e9('0x50')]=_[_0x43e9('0x53')](_0x4755d8[_0x43e9('0x50')],{'$or':_[_0x43e9('0x3f')](_0x4755d8[_0x43e9('0x49')],function(_0x590ba3){var _0x4bc3ab={};_0x4bc3ab[_0x590ba3]={'$like':'%'+_0x4fb0c7[_0x43e9('0x45')][_0x43e9('0x52')]+'%'};return _0x4bc3ab;})});}_0x4755d8=_[_0x43e9('0x53')]({},_0x4755d8,_0x4fb0c7['options']);return db[_0x43e9('0x68')][_0x43e9('0x57')](_0x4755d8);}})[_0x43e9('0x24')](function(_0x4b8e82){if(_0x4b8e82){return db[_0x43e9('0x6a')]['findAndCountAll']({'where':{'id':_[_0x43e9('0x3f')](_0x4b8e82,_0x43e9('0x6b')),'role':_0x43e9('0x6c')},'attributes':['id','name',_0x43e9('0x6d'),_0x43e9('0x6e'),_0x43e9('0x6f')]});}})[_0x43e9('0x24')](function(_0x5c2c78){if(_0x5c2c78){return{'count':_0x5c2c78[_0x43e9('0x55')],'rows':_[_0x43e9('0x3f')](_0x5c2c78[_0x43e9('0x58')],function(_0x404eb2){return{'membername':_0x404eb2['name'],'UserId':_0x404eb2['id'],'queue_name':_0x2d3ee2[_0x43e9('0x3c')],'ChatQueueId':_0x2d3ee2['id'],'interface':util[_0x43e9('0x70')](_0x43e9('0x71'),_0x43e9('0x72'),_0x404eb2[_0x43e9('0x3c')]),'penalty':0x0,'paused':_0x404eb2[_0x43e9('0x6d')],'createdAt':_0x404eb2[_0x43e9('0x6f')],'updatedAt':_0x404eb2[_0x43e9('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x43e9('0x24')](respondWithFilteredResult(_0x3dc355,_0x4755d8))[_0x43e9('0x59')](handleError(_0x3dc355,null));};exports['getTeams']=function(_0x2ea772,_0x2be3f9,_0x5e086a){var _0x5e610a={};var _0xfb0bea={};var _0x14f13c;var _0x5bcfec;return db['ChatQueue'][_0x43e9('0x73')]({'where':{'id':_0x2ea772[_0x43e9('0x5b')]['id']}})[_0x43e9('0x24')](handleEntityNotFound(_0x2be3f9,null))['then'](function(_0x8f0fb9){if(_0x8f0fb9){_0x14f13c=_0x8f0fb9;_0xfb0bea[_0x43e9('0x48')]=_[_0x43e9('0x46')](db['Team'][_0x43e9('0x41')]);_0xfb0bea[_0x43e9('0x45')]=_[_0x43e9('0x46')](_0x2ea772['query']);_0xfb0bea[_0x43e9('0x47')]=_['intersection'](_0xfb0bea[_0x43e9('0x48')],_0xfb0bea[_0x43e9('0x45')]);_0x5e610a[_0x43e9('0x49')]=_['intersection'](_0xfb0bea['model'],qs[_0x43e9('0x4b')](_0x2ea772[_0x43e9('0x45')]['fields']));_0x5e610a[_0x43e9('0x49')]=_0x5e610a[_0x43e9('0x49')]['length']?_0x5e610a['attributes']:_0xfb0bea[_0x43e9('0x48')];_0x5e610a[_0x43e9('0x4e')]=qs[_0x43e9('0x4f')](_0x2ea772['query'][_0x43e9('0x4f')]);_0x5e610a['where']=qs['filters'](_[_0x43e9('0x51')](_0x2ea772[_0x43e9('0x45')],_0xfb0bea[_0x43e9('0x47')]));if(_0x2ea772[_0x43e9('0x45')][_0x43e9('0x52')]){_0x5e610a[_0x43e9('0x50')]=_[_0x43e9('0x53')](_0x5e610a[_0x43e9('0x50')],{'$or':_[_0x43e9('0x3f')](_0x5e610a['attributes'],function(_0x5b33d6){var _0x42de3e={};_0x42de3e[_0x5b33d6]={'$like':'%'+_0x2ea772[_0x43e9('0x45')][_0x43e9('0x52')]+'%'};return _0x42de3e;})});}_0x5e610a=_[_0x43e9('0x53')]({},_0x5e610a,_0x2ea772[_0x43e9('0x54')]);return _0x14f13c['getTeams'](_0x5e610a);}})['then'](function(_0x20cd20){if(_0x20cd20){_0x5bcfec=_0x20cd20['length'];if(!_0x2ea772[_0x43e9('0x45')]['hasOwnProperty'](_0x43e9('0x4d'))){_0x5e610a['limit']=qs[_0x43e9('0x31')](_0x2ea772[_0x43e9('0x45')]['limit']);_0x5e610a['offset']=qs[_0x43e9('0x30')](_0x2ea772[_0x43e9('0x45')][_0x43e9('0x30')]);}return _0x14f13c['getTeams'](_0x5e610a);}})[_0x43e9('0x24')](function(_0x25cd40){if(_0x25cd40){return _0x25cd40?{'count':_0x5bcfec,'rows':_0x25cd40}:null;}})['then'](respondWithResult(_0x2be3f9,null))['catch'](handleError(_0x2be3f9,null));};exports[_0x43e9('0x74')]=function(_0x29a34d,_0x2991bd,_0x5e52c9){var _0xe1f5e2=_0x29a34d[_0x43e9('0x5f')]['ids'];return db[_0x43e9('0x75')]['findAll']({'where':{'id':_0xe1f5e2},'attributes':['id'],'include':[{'model':db['User'],'as':_0x43e9('0x76'),'attributes':['id',_0x43e9('0x3c'),_0x43e9('0x77'),_0x43e9('0x78'),_0x43e9('0x79')],'raw':!![]}]})['then'](function(_0x1dd126){if(_0x1dd126){var _0x7f99ab=_[_0x43e9('0x7a')](_0x1dd126,function(_0x312d80){var _0x5ae115=_0x312d80[_0x43e9('0x38')]({'plain':!![]});return _0x5ae115[_0x43e9('0x76')];});return db[_0x43e9('0x40')]['find']({'where':{'id':_0x29a34d[_0x43e9('0x5b')]['id']}})[_0x43e9('0x24')](function(_0x3c63b2){return db['sequelize'][_0x43e9('0x7b')](function(_0x33e752){return _0x3c63b2[_0x43e9('0x74')](_0xe1f5e2,{'transaction':_0x33e752})[_0x43e9('0x24')](function(){return BPromise['each'](_0x7f99ab,function(_0x3735b1){return db['UserChatQueue'][_0x43e9('0x7c')]({'where':{'UserId':_0x3735b1['id'],'ChatQueueId':_0x29a34d['params']['id']},'transaction':_0x33e752});});})[_0x43e9('0x24')](function(){_0x7f99ab['forEach'](function(_0x3aa100){socket[_0x43e9('0x7d')](_0x43e9('0x7e'),{'UserId':_0x3aa100['id'],'ChatQueueId':_0x3c63b2['id']});});});});});}})[_0x43e9('0x24')](respondWithStatusCode(_0x2991bd,null))['catch'](handleError(_0x2991bd,null));};exports[_0x43e9('0x7f')]=function(_0x2b4167,_0x300ea3,_0x13b191){return db[_0x43e9('0x75')][_0x43e9('0x57')]({'where':{'id':_0x2b4167[_0x43e9('0x45')][_0x43e9('0x80')]},'attributes':['id'],'include':[{'model':db[_0x43e9('0x6a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x43e9('0x24')](handleEntityNotFound(_0x300ea3,null))[_0x43e9('0x24')](function(_0x295e84){var _0x54f0dd=_[_0x43e9('0x3f')](_0x295e84,'id');var _0x206972=[];var _0x8a9efa=[];var _0x5a8e38=squel[_0x43e9('0x81')]();_0x5a8e38[_0x43e9('0x82')]('tq.TeamId')[_0x43e9('0x83')](_0x43e9('0x84'),'tq')['join'](_0x43e9('0x85'),'ut',_0x43e9('0x86'))[_0x43e9('0x50')]('ChatQueueId\x20=\x20?',_0x2b4167[_0x43e9('0x5b')]['id']);for(var _0x3a41ad=0x0;_0x3a41ad<_0x295e84['length'];_0x3a41ad+=0x1){let _0x4ab7ac=_0x295e84[_0x3a41ad];for(var _0x476288=0x0;_0x476288<_0x4ab7ac[_0x43e9('0x76')][_0x43e9('0x69')];_0x476288+=0x1){let _0x45904a=_0x4ab7ac[_0x43e9('0x76')][_0x476288];var _0x53f7bd=_0x5a8e38['clone']();_0x53f7bd[_0x43e9('0x50')](_0x43e9('0x87'),_0x45904a['id']);_0x8a9efa[_0x43e9('0x88')](db[_0x43e9('0x89')][_0x43e9('0x45')](_0x53f7bd[_0x43e9('0x8a')](),{'type':db['sequelize']['QueryTypes'][_0x43e9('0x8b')]})['then'](function(_0x5baa8e){if(_0x5baa8e[_0x43e9('0x69')]===0x1){return _0x45904a['id'];}else{var _0x56c0b1=_[_0x43e9('0x8c')](_[_0x43e9('0x3f')](_0x5baa8e,_0x43e9('0x8d')),function(_0x1600c5){return _[_0x43e9('0x8e')](_0x54f0dd,_0x1600c5);});if(_0x56c0b1){return _0x45904a['id'];}}}));}}return BPromise[_0x43e9('0x8f')](_0x8a9efa)[_0x43e9('0x24')](function(_0x356f10){_0x206972=_(_0x206972)[_0x43e9('0x90')](_0x356f10)['compact']()[_0x43e9('0x91')]();return db[_0x43e9('0x40')][_0x43e9('0x5d')]({'where':{'id':_0x2b4167['params']['id']}})[_0x43e9('0x24')](function(_0x5dcf59){return db[_0x43e9('0x89')][_0x43e9('0x7b')](function(_0xde993a){return _0x5dcf59[_0x43e9('0x7f')](_0x2b4167[_0x43e9('0x45')]['ids'],{'transaction':_0xde993a})[_0x43e9('0x24')](function(){if(!_[_0x43e9('0x92')](_0x206972)){return _0x5dcf59[_0x43e9('0x93')](_0x206972,{'transaction':_0xde993a});}})[_0x43e9('0x24')](function(){_0x206972[_0x43e9('0x94')](function(_0x2299fb){socket[_0x43e9('0x7d')](_0x43e9('0x95'),{'UserId':_0x2299fb,'ChatQueueId':_0x5dcf59['id']});});});});});});})[_0x43e9('0x24')](respondWithStatusCode(_0x300ea3,null))['catch'](handleError(_0x300ea3,null));};exports['addAgents']=function(_0x222882,_0x1684ff,_0x5a02b2){return db[_0x43e9('0x40')]['find']({'where':{'id':_0x222882['params']['id']}})[_0x43e9('0x24')](handleEntityNotFound(_0x1684ff,null))[_0x43e9('0x24')](function(_0x46940e){if(_0x46940e){return _0x46940e[_0x43e9('0x96')](_0x222882['body'][_0x43e9('0x80')],_['omit'](_0x222882['body'],['ids','id'])||{})[_0x43e9('0x97')](function(_0x5179de){for(var _0x3b5463=0x0;_0x3b5463<_0x222882[_0x43e9('0x5f')][_0x43e9('0x80')][_0x43e9('0x69')];_0x3b5463+=0x1){socket[_0x43e9('0x7d')](_0x43e9('0x7e'),{'UserId':_0x222882[_0x43e9('0x5f')][_0x43e9('0x80')][_0x3b5463],'ChatQueueId':_0x222882[_0x43e9('0x5b')]['id']});}return _0x5179de;});}})[_0x43e9('0x24')](respondWithResult(_0x1684ff,null))[_0x43e9('0x59')](handleError(_0x1684ff,null));};exports['removeAgents']=function(_0x3680ff,_0x10e167,_0x3f4854){return db['ChatQueue'][_0x43e9('0x5d')]({'where':{'id':_0x3680ff[_0x43e9('0x5b')]['id']}})['then'](handleEntityNotFound(_0x10e167,null))[_0x43e9('0x24')](function(_0x22158e){if(_0x22158e){return _0x22158e[_0x43e9('0x93')](_0x3680ff['query'][_0x43e9('0x80')])[_0x43e9('0x24')](function(){if(_[_0x43e9('0x98')](_0x3680ff[_0x43e9('0x45')]['ids'])){for(var _0x466587=0x0;_0x466587<_0x3680ff[_0x43e9('0x45')][_0x43e9('0x80')][_0x43e9('0x69')];_0x466587+=0x1){socket['emit'](_0x43e9('0x95'),{'UserId':Number(_0x3680ff[_0x43e9('0x45')][_0x43e9('0x80')][_0x466587]),'ChatQueueId':Number(_0x3680ff['params']['id'])});}}else{socket[_0x43e9('0x7d')](_0x43e9('0x95'),{'UserId':Number(_0x3680ff[_0x43e9('0x45')][_0x43e9('0x80')]),'ChatQueueId':Number(_0x3680ff['params']['id'])});}});}})[_0x43e9('0x24')](respondWithStatusCode(_0x10e167,null))[_0x43e9('0x59')](handleError(_0x10e167,null));};exports[_0x43e9('0x99')]=function(_0x25d2d7,_0x5e0d62,_0x59a65a){var _0x5765fc={};var _0x3921b1={};var _0x27d1da;var _0x47cfe3;return db['ChatQueue'][_0x43e9('0x73')]({'where':{'id':_0x25d2d7[_0x43e9('0x5b')]['id']}})[_0x43e9('0x24')](handleEntityNotFound(_0x5e0d62,null))['then'](function(_0x9b16ae){if(_0x9b16ae){_0x27d1da=_0x9b16ae;_0x3921b1[_0x43e9('0x48')]=_[_0x43e9('0x46')](db[_0x43e9('0x6a')][_0x43e9('0x41')]);_0x3921b1[_0x43e9('0x45')]=_[_0x43e9('0x46')](_0x25d2d7[_0x43e9('0x45')]);_0x3921b1[_0x43e9('0x47')]=_['intersection'](_0x3921b1[_0x43e9('0x48')],_0x3921b1[_0x43e9('0x45')]);_0x5765fc[_0x43e9('0x49')]=_['intersection'](_0x3921b1[_0x43e9('0x48')],qs[_0x43e9('0x4b')](_0x25d2d7[_0x43e9('0x45')][_0x43e9('0x4b')]));_0x5765fc['attributes']=_0x5765fc[_0x43e9('0x49')][_0x43e9('0x69')]?_0x5765fc[_0x43e9('0x49')]:_0x3921b1[_0x43e9('0x48')];_0x5765fc[_0x43e9('0x4e')]=qs[_0x43e9('0x4f')](_0x25d2d7[_0x43e9('0x45')]['sort']);_0x5765fc['where']=qs['filters'](_['pick'](_0x25d2d7['query'],_0x3921b1[_0x43e9('0x47')]));if(_0x25d2d7[_0x43e9('0x45')][_0x43e9('0x52')]){_0x5765fc[_0x43e9('0x50')]=_[_0x43e9('0x53')](_0x5765fc[_0x43e9('0x50')],{'$or':_[_0x43e9('0x3f')](_0x5765fc[_0x43e9('0x49')],function(_0x4a4fdd){var _0x4bce83={};_0x4bce83[_0x4a4fdd]={'$like':'%'+_0x25d2d7['query'][_0x43e9('0x52')]+'%'};return _0x4bce83;})});}_0x5765fc=_['merge']({},_0x5765fc,_0x25d2d7[_0x43e9('0x54')]);return _0x27d1da['getAgents'](_0x5765fc);}})[_0x43e9('0x24')](function(_0xa3ac0){if(_0xa3ac0){_0x47cfe3=_0xa3ac0['length'];if(!_0x25d2d7[_0x43e9('0x45')]['hasOwnProperty']('nolimit')){_0x5765fc[_0x43e9('0x31')]=qs['limit'](_0x25d2d7[_0x43e9('0x45')][_0x43e9('0x31')]);_0x5765fc[_0x43e9('0x30')]=qs[_0x43e9('0x30')](_0x25d2d7[_0x43e9('0x45')][_0x43e9('0x30')]);}return _0x27d1da[_0x43e9('0x99')](_0x5765fc);}})[_0x43e9('0x24')](function(_0x38f5dd){if(_0x38f5dd){return _0x38f5dd?{'count':_0x47cfe3,'rows':_0x38f5dd}:null;}})[_0x43e9('0x24')](respondWithResult(_0x5e0d62,null))[_0x43e9('0x59')](handleError(_0x5e0d62,null));}; \ No newline at end of file +var _0xbff5=['../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','./chatQueue.socket','register','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ChatQueue,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','destroy','get','ChatQueues','UserProfileResource','stack','name','index','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','UserChatQueue','nolimit','order','pick','map','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','userChatQueue:save','select','field','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','removeTeams','emit','addAgents','omit','spread','removeAgents','userChatQueue:remove','findOne','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service'];(function(_0x424a9a,_0x2dd9af){var _0xa7831c=function(_0x512534){while(--_0x512534){_0x424a9a['push'](_0x424a9a['shift']());}};_0xa7831c(++_0x2dd9af);}(_0xbff5,0x1bc));var _0x5bff=function(_0x302297,_0x375562){_0x302297=_0x302297-0x0;var _0x3b41a5=_0xbff5[_0x302297];return _0x3b41a5;};'use strict';var pdf=require(_0x5bff('0x0'));var emlformat=require(_0x5bff('0x1'));var rimraf=require(_0x5bff('0x2'));var zipdir=require(_0x5bff('0x3'));var jsonpatch=require(_0x5bff('0x4'));var rp=require(_0x5bff('0x5'));var moment=require(_0x5bff('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5bff('0x7'));var util=require('util');var path=require('path');var sox=require(_0x5bff('0x8'));var csv=require(_0x5bff('0x9'));var ejs=require(_0x5bff('0xa'));var fs=require('fs');var _=require(_0x5bff('0xb'));var squel=require(_0x5bff('0xc'));var crypto=require(_0x5bff('0xd'));var jsforce=require(_0x5bff('0xe'));var deskjs=require(_0x5bff('0xf'));var toCsv=require(_0x5bff('0x9'));var querystring=require('querystring');var Papa=require(_0x5bff('0x10'));var Redis=require('ioredis');var authService=require(_0x5bff('0x11'));var qs=require(_0x5bff('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5bff('0x13'));var logger=require('../../config/logger')(_0x5bff('0x14'));var utils=require('../../config/utils');var config=require(_0x5bff('0x15'));var db=require(_0x5bff('0x16'))['db'];config['redis']=_[_0x5bff('0x17')](config['redis'],{'host':_0x5bff('0x18'),'port':0x18eb});var socket=require(_0x5bff('0x19'))(new Redis(config['redis']));require(_0x5bff('0x1a'))[_0x5bff('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x5bff('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x1d300e,_0x3a507c,_0x4d883e){if(_0x4d883e){var _0x2d22ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2d22ab[_0x5bff('0x1d')](_0x3a507c)){return _0x1d300e;}else{throw new db[(_0x5bff('0x1e'))]['ValidationError'](_0x5bff('0x1f'));}}else{return _0x1d300e;}}function respondWithRpcPromise(_0x40c7f6,_0x38daa0,_0x546351,_0xc9fbc3){return new BPromise(function(_0x279c22,_0x36653b){var _0x32cf60=_0xc9fbc3||client;return _0x32cf60['request'](_0x40c7f6,_0x546351)[_0x5bff('0x20')](function(_0x5357d4){logger[_0x5bff('0x21')]('ChatQueue,\x20%s,\x20%s',_0x38daa0,_0x5bff('0x22'));logger[_0x5bff('0x23')](_0x5bff('0x24'),_0x38daa0,_0x5bff('0x22'),JSON[_0x5bff('0x25')](_0x5357d4));if(_0x5357d4[_0x5bff('0x26')]){if(_0x5357d4[_0x5bff('0x26')][_0x5bff('0x27')]===0x1f4){logger[_0x5bff('0x26')]('ChatQueue,\x20%s,\x20%s',_0x38daa0,_0x5357d4[_0x5bff('0x26')][_0x5bff('0x28')]);return _0x36653b(_0x5357d4[_0x5bff('0x26')][_0x5bff('0x28')]);}logger[_0x5bff('0x26')](_0x5bff('0x29'),_0x38daa0,_0x5357d4[_0x5bff('0x26')][_0x5bff('0x28')]);return _0x279c22(_0x5357d4['error']['message']);}else{logger[_0x5bff('0x21')]('ChatQueue,\x20%s,\x20%s',_0x38daa0,_0x5bff('0x22'));_0x279c22(_0x5357d4[_0x5bff('0x2a')][_0x5bff('0x28')]);}})[_0x5bff('0x2b')](function(_0xfa361d){logger[_0x5bff('0x26')](_0x5bff('0x29'),_0x38daa0,_0xfa361d);_0x36653b(_0xfa361d);});});}function respondWithStatusCode(_0xedba9d,_0x5a4e82){_0x5a4e82=_0x5a4e82||0xcc;return function(_0x4df57a){if(_0x4df57a){return _0xedba9d[_0x5bff('0x2c')](_0x5a4e82);}return _0xedba9d[_0x5bff('0x2d')](_0x5a4e82)['end']();};}function respondWithResult(_0x36a7d2,_0x588078){_0x588078=_0x588078||0xc8;return function(_0x5470cb){if(_0x5470cb){return _0x36a7d2[_0x5bff('0x2d')](_0x588078)['json'](_0x5470cb);}};}function respondWithFilteredResult(_0x3ed23b,_0x64e22){return function(_0x2d692a){if(_0x2d692a){var _0x11d48a=_0x2d692a[_0x5bff('0x2e')],_0x48aee1=_0x64e22['offset'],_0x71783=_0x64e22[_0x5bff('0x2f')]+_0x64e22[_0x5bff('0x30')],_0x4ee6f1;if(_0x71783>=_0x11d48a){_0x71783=_0x11d48a;_0x4ee6f1=0xc8;}else{_0x4ee6f1=0xce;}_0x3ed23b[_0x5bff('0x2d')](_0x4ee6f1);return _0x3ed23b[_0x5bff('0x31')](_0x5bff('0x32'),_0x48aee1+'-'+_0x71783+'/'+_0x11d48a)[_0x5bff('0x33')](_0x2d692a);}return null;};}function patchUpdates(_0x49155d){return function(_0x31b175){try{jsonpatch[_0x5bff('0x34')](_0x31b175,_0x49155d,!![]);}catch(_0x3fef83){return BPromise[_0x5bff('0x35')](_0x3fef83);}return _0x31b175[_0x5bff('0x36')]();};}function saveUpdates(_0x276862,_0x36ae08){return function(_0x16b3c2){if(_0x16b3c2){return _0x16b3c2['update'](_0x276862)[_0x5bff('0x20')](function(_0x16042d){return _0x16042d;});}return null;};}function removeEntity(_0x2f50e1,_0x320ff0){return function(_0x4fc35f){if(_0x4fc35f){return _0x4fc35f[_0x5bff('0x37')]()[_0x5bff('0x20')](function(){var _0x5a24be=_0x4fc35f[_0x5bff('0x38')]({'plain':!![]});var _0x118e07=_0x5bff('0x39');return db[_0x5bff('0x3a')]['destroy']({'where':{'type':_0x118e07,'resourceId':_0x5a24be['id']}})[_0x5bff('0x20')](function(){return _0x4fc35f;});})[_0x5bff('0x20')](function(){_0x2f50e1[_0x5bff('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1065d1,_0x55f603){return function(_0x4572e6){if(!_0x4572e6){_0x1065d1[_0x5bff('0x2c')](0x194);}return _0x4572e6;};}function handleError(_0x4422f7,_0x557ef4){_0x557ef4=_0x557ef4||0x1f4;return function(_0x368110){logger[_0x5bff('0x26')](_0x368110[_0x5bff('0x3b')]);if(_0x368110['name']){delete _0x368110[_0x5bff('0x3c')];}_0x4422f7[_0x5bff('0x2d')](_0x557ef4)['send'](_0x368110);};}exports[_0x5bff('0x3d')]=function(_0x1151d4,_0x2ff182){var _0x77a071={},_0x3b0f99={},_0x4c239f={'count':0x0,'rows':[]};var _0x35796f=_['map'](db[_0x5bff('0x3e')][_0x5bff('0x3f')],function(_0x1c3f65){return{'name':_0x1c3f65[_0x5bff('0x40')],'type':_0x1c3f65[_0x5bff('0x41')][_0x5bff('0x42')]};});_0x3b0f99[_0x5bff('0x43')]=_['map'](_0x35796f,'name');_0x3b0f99[_0x5bff('0x44')]=_[_0x5bff('0x45')](_0x1151d4[_0x5bff('0x44')]);_0x3b0f99[_0x5bff('0x46')]=_[_0x5bff('0x47')](_0x3b0f99[_0x5bff('0x43')],_0x3b0f99[_0x5bff('0x44')]);_0x77a071[_0x5bff('0x48')]=_['intersection'](_0x3b0f99[_0x5bff('0x43')],qs['fields'](_0x1151d4[_0x5bff('0x44')][_0x5bff('0x49')]));_0x77a071['attributes']=_0x77a071[_0x5bff('0x48')][_0x5bff('0x4a')]?_0x77a071['attributes']:_0x3b0f99[_0x5bff('0x43')];if(!_0x1151d4[_0x5bff('0x44')][_0x5bff('0x4b')]('nolimit')){_0x77a071[_0x5bff('0x30')]=qs[_0x5bff('0x30')](_0x1151d4[_0x5bff('0x44')]['limit']);_0x77a071[_0x5bff('0x2f')]=qs[_0x5bff('0x2f')](_0x1151d4[_0x5bff('0x44')][_0x5bff('0x2f')]);}_0x77a071['order']=qs[_0x5bff('0x4c')](_0x1151d4['query']['sort']);_0x77a071[_0x5bff('0x4d')]=qs[_0x5bff('0x46')](_['pick'](_0x1151d4[_0x5bff('0x44')],_0x3b0f99[_0x5bff('0x46')]));if(_0x1151d4['query'][_0x5bff('0x4e')]){_0x77a071[_0x5bff('0x4d')]=_[_0x5bff('0x4f')](_0x77a071[_0x5bff('0x4d')],{'$or':_['map'](_0x35796f,function(_0x579a8d){if(_0x579a8d[_0x5bff('0x41')]!==_0x5bff('0x50')){var _0x738700={};_0x738700[_0x579a8d[_0x5bff('0x3c')]]={'$like':'%'+_0x1151d4[_0x5bff('0x44')]['filter']+'%'};return _0x738700;}})});}_0x77a071=_[_0x5bff('0x4f')]({},_0x77a071,_0x1151d4[_0x5bff('0x51')]);var _0x5d5b1f={'where':_0x77a071[_0x5bff('0x4d')]};return db['ChatQueue']['count'](_0x5d5b1f)['then'](function(_0x3ac8ad){_0x4c239f[_0x5bff('0x2e')]=_0x3ac8ad;if(_0x1151d4['query'][_0x5bff('0x52')]){_0x77a071[_0x5bff('0x53')]=[{'all':!![]}];}return db[_0x5bff('0x3e')][_0x5bff('0x54')](_0x77a071);})[_0x5bff('0x20')](function(_0x4a63b3){_0x4c239f[_0x5bff('0x55')]=_0x4a63b3;return _0x4c239f;})[_0x5bff('0x20')](respondWithFilteredResult(_0x2ff182,_0x77a071))['catch'](handleError(_0x2ff182,null));};exports[_0x5bff('0x56')]=function(_0x48feaa,_0x1b0b69){var _0x8c5211={'raw':!![],'where':{'id':_0x48feaa[_0x5bff('0x57')]['id']}},_0x455937={};_0x455937[_0x5bff('0x43')]=_['keys'](db[_0x5bff('0x3e')][_0x5bff('0x3f')]);_0x455937['query']=_[_0x5bff('0x45')](_0x48feaa[_0x5bff('0x44')]);_0x455937['filters']=_[_0x5bff('0x47')](_0x455937[_0x5bff('0x43')],_0x455937[_0x5bff('0x44')]);_0x8c5211[_0x5bff('0x48')]=_[_0x5bff('0x47')](_0x455937[_0x5bff('0x43')],qs['fields'](_0x48feaa['query'][_0x5bff('0x49')]));_0x8c5211['attributes']=_0x8c5211[_0x5bff('0x48')][_0x5bff('0x4a')]?_0x8c5211[_0x5bff('0x48')]:_0x455937[_0x5bff('0x43')];if(_0x48feaa[_0x5bff('0x44')][_0x5bff('0x52')]){_0x8c5211[_0x5bff('0x53')]=[{'all':!![]}];}_0x8c5211=_[_0x5bff('0x4f')]({},_0x8c5211,_0x48feaa[_0x5bff('0x51')]);return db[_0x5bff('0x3e')][_0x5bff('0x58')](_0x8c5211)['then'](handleEntityNotFound(_0x1b0b69,null))['then'](respondWithResult(_0x1b0b69,null))[_0x5bff('0x2b')](handleError(_0x1b0b69,null));};exports['create']=function(_0x27e34d,_0x47b0b2){return db[_0x5bff('0x3e')][_0x5bff('0x59')](_0x27e34d[_0x5bff('0x5a')],{})[_0x5bff('0x20')](function(_0x3d1b1c){var _0x1021b1=_0x27e34d[_0x5bff('0x5b')][_0x5bff('0x38')]({'plain':!![]});if(!_0x1021b1)throw new Error(_0x5bff('0x5c'));if(_0x1021b1[_0x5bff('0x5d')]===_0x5bff('0x5b')){var _0x57053a=_0x3d1b1c[_0x5bff('0x38')]({'plain':!![]});var _0x56eff2='ChatQueues';return db['UserProfileSection'][_0x5bff('0x58')]({'where':{'name':_0x56eff2,'userProfileId':_0x1021b1['userProfileId']},'raw':!![]})[_0x5bff('0x20')](function(_0x17d6f2){if(_0x17d6f2&&_0x17d6f2[_0x5bff('0x5e')]===0x0){return db[_0x5bff('0x3a')]['create']({'name':_0x57053a['name'],'resourceId':_0x57053a['id'],'type':_0x17d6f2['name'],'sectionId':_0x17d6f2['id']},{})[_0x5bff('0x20')](function(){return _0x3d1b1c;});}else{return _0x3d1b1c;}})[_0x5bff('0x2b')](function(_0x5893b9){logger[_0x5bff('0x26')](_0x5bff('0x5f'),_0x5893b9);throw _0x5893b9;});}return _0x3d1b1c;})[_0x5bff('0x20')](respondWithResult(_0x47b0b2,0xc9))[_0x5bff('0x2b')](handleError(_0x47b0b2,null));};exports[_0x5bff('0x60')]=function(_0x20ff8a,_0x134268){if(_0x20ff8a[_0x5bff('0x5a')]['id']){delete _0x20ff8a[_0x5bff('0x5a')]['id'];}return db[_0x5bff('0x3e')][_0x5bff('0x58')]({'where':{'id':_0x20ff8a[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x134268,null))[_0x5bff('0x20')](saveUpdates(_0x20ff8a['body'],null))[_0x5bff('0x20')](respondWithResult(_0x134268,null))[_0x5bff('0x2b')](handleError(_0x134268,null));};exports[_0x5bff('0x37')]=function(_0x13980a,_0x3ae675){return db[_0x5bff('0x3e')][_0x5bff('0x58')]({'where':{'id':_0x13980a[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x3ae675,null))[_0x5bff('0x20')](removeEntity(_0x3ae675,null))[_0x5bff('0x2b')](handleError(_0x3ae675,null));};exports[_0x5bff('0x61')]=function(_0x44f512,_0x4d3e37){return db[_0x5bff('0x3e')][_0x5bff('0x61')]()[_0x5bff('0x20')](respondWithResult(_0x4d3e37,null))[_0x5bff('0x2b')](handleError(_0x4d3e37,null));};exports[_0x5bff('0x62')]=function(_0x5e3cec,_0x78f4c9,_0xd71b86){var _0x5b8f25={'raw':!![],'where':{}},_0x1b35ae={},_0x1e3eab;return db[_0x5bff('0x3e')]['findOne']({'where':{'id':_0x5e3cec[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x78f4c9,null))[_0x5bff('0x20')](function(_0x3bf744){if(_0x3bf744){_0x1e3eab=_0x3bf744[_0x5bff('0x38')]({'plain':!![]});_0x1b35ae[_0x5bff('0x43')]=_[_0x5bff('0x45')](db[_0x5bff('0x63')][_0x5bff('0x3f')]);_0x1b35ae[_0x5bff('0x44')]=_[_0x5bff('0x45')](_0x5e3cec[_0x5bff('0x44')]);_0x1b35ae['filters']=_['intersection'](_0x1b35ae[_0x5bff('0x43')],_0x1b35ae[_0x5bff('0x44')]);_0x5b8f25[_0x5bff('0x48')]=_['intersection'](_0x1b35ae[_0x5bff('0x43')],qs['fields'](_0x5e3cec['query'][_0x5bff('0x49')]));_0x5b8f25['attributes']=_0x5b8f25['attributes'][_0x5bff('0x4a')]?_0x5b8f25[_0x5bff('0x48')]:_0x1b35ae['model'];if(!_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x4b')](_0x5bff('0x64'))){_0x5b8f25[_0x5bff('0x30')]=qs[_0x5bff('0x30')](_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x30')]);_0x5b8f25[_0x5bff('0x2f')]=qs[_0x5bff('0x2f')](_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x2f')]);}_0x5b8f25[_0x5bff('0x65')]=qs[_0x5bff('0x4c')](_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x4c')]);_0x5b8f25[_0x5bff('0x4d')]=qs[_0x5bff('0x46')](_[_0x5bff('0x66')](_0x5e3cec[_0x5bff('0x44')],_0x1b35ae[_0x5bff('0x46')]));_0x5b8f25[_0x5bff('0x4d')]['ChatQueueId']=_0x3bf744['id'];if(_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x4e')]){_0x5b8f25['where']=_[_0x5bff('0x4f')](_0x5b8f25['where'],{'$or':_[_0x5bff('0x67')](_0x5b8f25[_0x5bff('0x48')],function(_0x515850){var _0x198391={};_0x198391[_0x515850]={'$like':'%'+_0x5e3cec[_0x5bff('0x44')][_0x5bff('0x4e')]+'%'};return _0x198391;})});}_0x5b8f25=_[_0x5bff('0x4f')]({},_0x5b8f25,_0x5e3cec[_0x5bff('0x51')]);return db[_0x5bff('0x63')][_0x5bff('0x54')](_0x5b8f25);}})[_0x5bff('0x20')](function(_0x37314a){if(_0x37314a){return db[_0x5bff('0x68')][_0x5bff('0x69')]({'where':{'id':_['map'](_0x37314a,_0x5bff('0x6a')),'role':_0x5bff('0x6b')},'attributes':['id','name',_0x5bff('0x6c'),_0x5bff('0x6d'),_0x5bff('0x6e')]});}})[_0x5bff('0x20')](function(_0x3c7965){if(_0x3c7965){return{'count':_0x3c7965[_0x5bff('0x2e')],'rows':_[_0x5bff('0x67')](_0x3c7965[_0x5bff('0x55')],function(_0x57ae4d){return{'membername':_0x57ae4d['name'],'UserId':_0x57ae4d['id'],'queue_name':_0x1e3eab[_0x5bff('0x3c')],'ChatQueueId':_0x1e3eab['id'],'interface':util['format'](_0x5bff('0x6f'),_0x5bff('0x70'),_0x57ae4d[_0x5bff('0x3c')]),'penalty':0x0,'paused':_0x57ae4d['chatPause'],'createdAt':_0x57ae4d[_0x5bff('0x6e')],'updatedAt':_0x57ae4d[_0x5bff('0x6d')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x5bff('0x20')](respondWithFilteredResult(_0x78f4c9,_0x5b8f25))[_0x5bff('0x2b')](handleError(_0x78f4c9,null));};exports[_0x5bff('0x71')]=function(_0x4774c2,_0x4b40c5,_0x341e79){var _0x16cc32={};var _0x4750d3={};var _0x1143aa;var _0x5b0acf;return db[_0x5bff('0x3e')]['findOne']({'where':{'id':_0x4774c2[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x4b40c5,null))[_0x5bff('0x20')](function(_0x2e965f){if(_0x2e965f){_0x1143aa=_0x2e965f;_0x4750d3[_0x5bff('0x43')]=_[_0x5bff('0x45')](db[_0x5bff('0x72')]['rawAttributes']);_0x4750d3[_0x5bff('0x44')]=_['keys'](_0x4774c2['query']);_0x4750d3[_0x5bff('0x46')]=_[_0x5bff('0x47')](_0x4750d3['model'],_0x4750d3['query']);_0x16cc32[_0x5bff('0x48')]=_[_0x5bff('0x47')](_0x4750d3[_0x5bff('0x43')],qs[_0x5bff('0x49')](_0x4774c2['query'][_0x5bff('0x49')]));_0x16cc32['attributes']=_0x16cc32[_0x5bff('0x48')][_0x5bff('0x4a')]?_0x16cc32[_0x5bff('0x48')]:_0x4750d3['model'];_0x16cc32[_0x5bff('0x65')]=qs['sort'](_0x4774c2[_0x5bff('0x44')][_0x5bff('0x4c')]);_0x16cc32[_0x5bff('0x4d')]=qs['filters'](_['pick'](_0x4774c2[_0x5bff('0x44')],_0x4750d3[_0x5bff('0x46')]));if(_0x4774c2[_0x5bff('0x44')][_0x5bff('0x4e')]){_0x16cc32[_0x5bff('0x4d')]=_[_0x5bff('0x4f')](_0x16cc32[_0x5bff('0x4d')],{'$or':_[_0x5bff('0x67')](_0x16cc32[_0x5bff('0x48')],function(_0x59efd7){var _0x435076={};_0x435076[_0x59efd7]={'$like':'%'+_0x4774c2[_0x5bff('0x44')][_0x5bff('0x4e')]+'%'};return _0x435076;})});}_0x16cc32=_['merge']({},_0x16cc32,_0x4774c2['options']);return _0x1143aa[_0x5bff('0x71')](_0x16cc32);}})[_0x5bff('0x20')](function(_0x4b216f){if(_0x4b216f){_0x5b0acf=_0x4b216f['length'];if(!_0x4774c2[_0x5bff('0x44')]['hasOwnProperty'](_0x5bff('0x64'))){_0x16cc32[_0x5bff('0x30')]=qs[_0x5bff('0x30')](_0x4774c2[_0x5bff('0x44')]['limit']);_0x16cc32[_0x5bff('0x2f')]=qs['offset'](_0x4774c2[_0x5bff('0x44')][_0x5bff('0x2f')]);}return _0x1143aa[_0x5bff('0x71')](_0x16cc32);}})[_0x5bff('0x20')](function(_0x63b716){if(_0x63b716){return _0x63b716?{'count':_0x5b0acf,'rows':_0x63b716}:null;}})['then'](respondWithResult(_0x4b40c5,null))[_0x5bff('0x2b')](handleError(_0x4b40c5,null));};exports[_0x5bff('0x73')]=function(_0x523123,_0x1d7454,_0x494872){var _0xf05c8a=_0x523123[_0x5bff('0x5a')][_0x5bff('0x74')];return db['Team'][_0x5bff('0x54')]({'where':{'id':_0xf05c8a},'attributes':['id'],'include':[{'model':db[_0x5bff('0x68')],'as':_0x5bff('0x75'),'attributes':['id',_0x5bff('0x3c'),_0x5bff('0x76'),_0x5bff('0x77'),'interface'],'raw':!![]}]})[_0x5bff('0x20')](function(_0x4be1a0){if(_0x4be1a0){var _0x1f0a8a=_[_0x5bff('0x78')](_0x4be1a0,function(_0x1ed775){var _0x3b240f=_0x1ed775[_0x5bff('0x38')]({'plain':!![]});return _0x3b240f[_0x5bff('0x75')];});return db[_0x5bff('0x3e')][_0x5bff('0x58')]({'where':{'id':_0x523123[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](function(_0x429263){return db[_0x5bff('0x79')][_0x5bff('0x7a')](function(_0x4cfb5b){return _0x429263['addTeams'](_0xf05c8a,{'transaction':_0x4cfb5b})[_0x5bff('0x20')](function(){return BPromise[_0x5bff('0x7b')](_0x1f0a8a,function(_0x76387){return db[_0x5bff('0x63')][_0x5bff('0x7c')]({'where':{'UserId':_0x76387['id'],'ChatQueueId':_0x523123['params']['id']},'transaction':_0x4cfb5b});});})[_0x5bff('0x20')](function(){_0x1f0a8a[_0x5bff('0x7d')](function(_0x1d5599){socket['emit'](_0x5bff('0x7e'),{'UserId':_0x1d5599['id'],'ChatQueueId':_0x429263['id']});});});});});}})['then'](respondWithStatusCode(_0x1d7454,null))[_0x5bff('0x2b')](handleError(_0x1d7454,null));};exports['removeTeams']=function(_0x338e0c,_0x4888de,_0xe39373){return db[_0x5bff('0x72')][_0x5bff('0x54')]({'where':{'id':_0x338e0c['query'][_0x5bff('0x74')]},'attributes':['id'],'include':[{'model':db[_0x5bff('0x68')],'as':_0x5bff('0x75'),'attributes':['id'],'raw':!![]}]})[_0x5bff('0x20')](handleEntityNotFound(_0x4888de,null))[_0x5bff('0x20')](function(_0x1bd28a){var _0x2ca82e=_[_0x5bff('0x67')](_0x1bd28a,'id');var _0x2f9221=[];var _0x11b49d=[];var _0x4d5581=squel[_0x5bff('0x7f')]();_0x4d5581[_0x5bff('0x80')]('tq.TeamId')[_0x5bff('0x81')]('team_has_chat_queues','tq')['join'](_0x5bff('0x82'),'ut',_0x5bff('0x83'))[_0x5bff('0x4d')](_0x5bff('0x84'),_0x338e0c['params']['id']);for(var _0x5e83b8=0x0;_0x5e83b8<_0x1bd28a[_0x5bff('0x4a')];_0x5e83b8+=0x1){let _0x15d606=_0x1bd28a[_0x5e83b8];for(var _0xafa91a=0x0;_0xafa91a<_0x15d606['Agents'][_0x5bff('0x4a')];_0xafa91a+=0x1){let _0x248b2c=_0x15d606[_0x5bff('0x75')][_0xafa91a];var _0x23aaef=_0x4d5581[_0x5bff('0x85')]();_0x23aaef['where'](_0x5bff('0x86'),_0x248b2c['id']);_0x11b49d[_0x5bff('0x87')](db['sequelize'][_0x5bff('0x44')](_0x23aaef[_0x5bff('0x88')](),{'type':db[_0x5bff('0x79')][_0x5bff('0x89')]['SELECT']})['then'](function(_0x436d86){if(_0x436d86[_0x5bff('0x4a')]===0x1){return _0x248b2c['id'];}else{var _0xe25ae8=_[_0x5bff('0x8a')](_[_0x5bff('0x67')](_0x436d86,_0x5bff('0x8b')),function(_0x3f9ecd){return _[_0x5bff('0x8c')](_0x2ca82e,_0x3f9ecd);});if(_0xe25ae8){return _0x248b2c['id'];}}}));}}return BPromise[_0x5bff('0x8d')](_0x11b49d)[_0x5bff('0x20')](function(_0x4c6a55){_0x2f9221=_(_0x2f9221)[_0x5bff('0x8e')](_0x4c6a55)[_0x5bff('0x8f')]()[_0x5bff('0x90')]();return db[_0x5bff('0x3e')]['find']({'where':{'id':_0x338e0c['params']['id']}})[_0x5bff('0x20')](function(_0xd37db6){return db[_0x5bff('0x79')][_0x5bff('0x7a')](function(_0x39da05){return _0xd37db6[_0x5bff('0x91')](_0x338e0c[_0x5bff('0x44')]['ids'],{'transaction':_0x39da05})['then'](function(){if(!_['isEmpty'](_0x2f9221)){return _0xd37db6['removeAgents'](_0x2f9221,{'transaction':_0x39da05});}})[_0x5bff('0x20')](function(){_0x2f9221[_0x5bff('0x7d')](function(_0x1cd2c6){socket[_0x5bff('0x92')]('userChatQueue:remove',{'UserId':_0x1cd2c6,'ChatQueueId':_0xd37db6['id']});});});});});});})['then'](respondWithStatusCode(_0x4888de,null))[_0x5bff('0x2b')](handleError(_0x4888de,null));};exports[_0x5bff('0x93')]=function(_0x356a1d,_0x10cf74,_0x355333){return db[_0x5bff('0x3e')]['find']({'where':{'id':_0x356a1d['params']['id']}})['then'](handleEntityNotFound(_0x10cf74,null))['then'](function(_0x98350){if(_0x98350){return _0x98350[_0x5bff('0x93')](_0x356a1d['body'][_0x5bff('0x74')],_[_0x5bff('0x94')](_0x356a1d[_0x5bff('0x5a')],['ids','id'])||{})[_0x5bff('0x95')](function(_0x5ac000){for(var _0x4f7c78=0x0;_0x4f7c78<_0x356a1d[_0x5bff('0x5a')][_0x5bff('0x74')][_0x5bff('0x4a')];_0x4f7c78+=0x1){socket[_0x5bff('0x92')]('userChatQueue:save',{'UserId':_0x356a1d[_0x5bff('0x5a')][_0x5bff('0x74')][_0x4f7c78],'ChatQueueId':_0x356a1d[_0x5bff('0x57')]['id']});}return _0x5ac000;});}})['then'](respondWithResult(_0x10cf74,null))[_0x5bff('0x2b')](handleError(_0x10cf74,null));};exports[_0x5bff('0x96')]=function(_0xa88013,_0x41c9d0,_0x3bd9c2){return db['ChatQueue'][_0x5bff('0x58')]({'where':{'id':_0xa88013['params']['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x41c9d0,null))['then'](function(_0xb3bab4){if(_0xb3bab4){return _0xb3bab4[_0x5bff('0x96')](_0xa88013[_0x5bff('0x44')][_0x5bff('0x74')])[_0x5bff('0x20')](function(){if(_['isArray'](_0xa88013['query']['ids'])){for(var _0x4a4b12=0x0;_0x4a4b12<_0xa88013[_0x5bff('0x44')]['ids']['length'];_0x4a4b12+=0x1){socket['emit'](_0x5bff('0x97'),{'UserId':Number(_0xa88013['query']['ids'][_0x4a4b12]),'ChatQueueId':Number(_0xa88013[_0x5bff('0x57')]['id'])});}}else{socket[_0x5bff('0x92')](_0x5bff('0x97'),{'UserId':Number(_0xa88013[_0x5bff('0x44')][_0x5bff('0x74')]),'ChatQueueId':Number(_0xa88013['params']['id'])});}});}})['then'](respondWithStatusCode(_0x41c9d0,null))['catch'](handleError(_0x41c9d0,null));};exports['getAgents']=function(_0xd62f75,_0x462abb,_0x5a8b9d){var _0x4ef3a9={};var _0x3f151f={};var _0x23044a;var _0x5453bd;return db['ChatQueue'][_0x5bff('0x98')]({'where':{'id':_0xd62f75[_0x5bff('0x57')]['id']}})[_0x5bff('0x20')](handleEntityNotFound(_0x462abb,null))[_0x5bff('0x20')](function(_0x40b41f){if(_0x40b41f){_0x23044a=_0x40b41f;_0x3f151f[_0x5bff('0x43')]=_['keys'](db[_0x5bff('0x68')]['rawAttributes']);_0x3f151f[_0x5bff('0x44')]=_['keys'](_0xd62f75[_0x5bff('0x44')]);_0x3f151f[_0x5bff('0x46')]=_[_0x5bff('0x47')](_0x3f151f[_0x5bff('0x43')],_0x3f151f[_0x5bff('0x44')]);_0x4ef3a9['attributes']=_[_0x5bff('0x47')](_0x3f151f[_0x5bff('0x43')],qs[_0x5bff('0x49')](_0xd62f75['query'][_0x5bff('0x49')]));_0x4ef3a9[_0x5bff('0x48')]=_0x4ef3a9[_0x5bff('0x48')][_0x5bff('0x4a')]?_0x4ef3a9[_0x5bff('0x48')]:_0x3f151f[_0x5bff('0x43')];_0x4ef3a9['order']=qs['sort'](_0xd62f75[_0x5bff('0x44')]['sort']);_0x4ef3a9[_0x5bff('0x4d')]=qs['filters'](_[_0x5bff('0x66')](_0xd62f75['query'],_0x3f151f[_0x5bff('0x46')]));if(_0xd62f75[_0x5bff('0x44')]['filter']){_0x4ef3a9['where']=_[_0x5bff('0x4f')](_0x4ef3a9[_0x5bff('0x4d')],{'$or':_[_0x5bff('0x67')](_0x4ef3a9[_0x5bff('0x48')],function(_0x2b8f70){var _0x32352e={};_0x32352e[_0x2b8f70]={'$like':'%'+_0xd62f75[_0x5bff('0x44')][_0x5bff('0x4e')]+'%'};return _0x32352e;})});}_0x4ef3a9=_[_0x5bff('0x4f')]({},_0x4ef3a9,_0xd62f75[_0x5bff('0x51')]);return _0x23044a[_0x5bff('0x99')](_0x4ef3a9);}})[_0x5bff('0x20')](function(_0x232197){if(_0x232197){_0x5453bd=_0x232197[_0x5bff('0x4a')];if(!_0xd62f75[_0x5bff('0x44')][_0x5bff('0x4b')]('nolimit')){_0x4ef3a9[_0x5bff('0x30')]=qs[_0x5bff('0x30')](_0xd62f75['query'][_0x5bff('0x30')]);_0x4ef3a9[_0x5bff('0x2f')]=qs['offset'](_0xd62f75['query']['offset']);}return _0x23044a[_0x5bff('0x99')](_0x4ef3a9);}})['then'](function(_0x25d550){if(_0x25d550){return _0x25d550?{'count':_0x5453bd,'rows':_0x25d550}:null;}})['then'](respondWithResult(_0x462abb,null))[_0x5bff('0x2b')](handleError(_0x462abb,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 6200cb0..7ef86c6 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(_0x2769d9,_0xb61766){var _0x59553c=function(_0x2ee0ee){while(--_0x2ee0ee){_0x2769d9['push'](_0x2769d9['shift']());}};_0x59553c(++_0xb61766);}(_0x5f2f,0x73));var _0xf5f2=function(_0x57041d,_0x3c34ad){_0x57041d=_0x57041d-0x0;var _0x5c5372=_0x5f2f[_0x57041d];return _0x5c5372;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file +var _0x5f2f=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','setMaxListeners','save','update'];(function(_0x91d3cf,_0x8ee4b5){var _0x3715ef=function(_0x50f4d7){while(--_0x50f4d7){_0x91d3cf['push'](_0x91d3cf['shift']());}};_0x3715ef(++_0x8ee4b5);}(_0x5f2f,0x73));var _0xf5f2=function(_0x516f71,_0x38fc8b){_0x516f71=_0x516f71-0x0;var _0x4707b0=_0x5f2f[_0x516f71];return _0x4707b0;};'use strict';var EventEmitter=require(_0xf5f2('0x0'));var ChatQueue=require(_0xf5f2('0x1'))['db'][_0xf5f2('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0xf5f2('0x3')](0x0);var events={'afterCreate':_0xf5f2('0x4'),'afterUpdate':_0xf5f2('0x5'),'afterDestroy':_0xf5f2('0x6')};function emitEvent(_0x107cf){return function(_0x501fbd,_0x4854b6,_0x1665c7){ChatQueueEvents[_0xf5f2('0x7')](_0x107cf+':'+_0x501fbd['id'],_0x501fbd);ChatQueueEvents[_0xf5f2('0x7')](_0x107cf,_0x501fbd);_0x1665c7(null);};}for(var e in events){if(events[_0xf5f2('0x8')](e)){var event=events[e];ChatQueue[_0xf5f2('0x9')](e,emitEvent(event));}}module[_0xf5f2('0xa')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 43de083..e7ede0a 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 _0xb604=['bluebird','./chatQueue.attributes','exports','define','chat_queues','../../config/logger','moment'];(function(_0x3e3850,_0x9e8430){var _0xf2cdac=function(_0x4329e5){while(--_0x4329e5){_0x3e3850['push'](_0x3e3850['shift']());}};_0xf2cdac(++_0x9e8430);}(_0xb604,0x1a2));var _0x4b60=function(_0x164ef5,_0xba6238){_0x164ef5=_0x164ef5-0x0;var _0x2d60c5=_0xb604[_0x164ef5];return _0x2d60c5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4b60('0x0'))('api');var moment=require(_0x4b60('0x1'));var BPromise=require(_0x4b60('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4b60('0x3'));module[_0x4b60('0x4')]=function(_0x514cf2,_0xf1a69b){return _0x514cf2[_0x4b60('0x5')]('ChatQueue',attributes,{'tableName':_0x4b60('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1f23=['moment','request-promise','path','rimraf','../../config/environment','exports','define','lodash','util','../../config/logger'];(function(_0x310489,_0x142a75){var _0x436a69=function(_0xa06d7a){while(--_0xa06d7a){_0x310489['push'](_0x310489['shift']());}};_0x436a69(++_0x142a75);}(_0x1f23,0x1e7));var _0x31f2=function(_0x388440,_0x4699fa){_0x388440=_0x388440-0x0;var _0x16e634=_0x1f23[_0x388440];return _0x16e634;};'use strict';var _=require(_0x31f2('0x0'));var util=require(_0x31f2('0x1'));var logger=require(_0x31f2('0x2'))('api');var moment=require(_0x31f2('0x3'));var BPromise=require('bluebird');var rp=require(_0x31f2('0x4'));var fs=require('fs');var path=require(_0x31f2('0x5'));var rimraf=require(_0x31f2('0x6'));var config=require(_0x31f2('0x7'));var attributes=require('./chatQueue.attributes');module[_0x31f2('0x8')]=function(_0x51c702,_0x46ba9a){return _0x51c702[_0x31f2('0x9')]('ChatQueue',attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.rpc.js b/server/api/chatQueue/chatQueue.rpc.js index 2273e45..72e0d53 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 _0x0c8d=['error','code','ChatQueue,\x20%s,\x20%s','message','info','ChatQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetChatQueue','ShowChatQueue','find','debug','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatQueue.socket','then','request\x20sent','stringify'];(function(_0x3770f4,_0x5daa68){var _0x1f1be6=function(_0x1920af){while(--_0x1920af){_0x3770f4['push'](_0x3770f4['shift']());}};_0x1f1be6(++_0x5daa68);}(_0x0c8d,0x79));var _0xd0c8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0c8d[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require('lodash');var util=require(_0xd0c8('0x0'));var moment=require(_0xd0c8('0x1'));var BPromise=require(_0xd0c8('0x2'));var rs=require(_0xd0c8('0x3'));var fs=require('fs');var Redis=require(_0xd0c8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd0c8('0x5'));var jayson=require(_0xd0c8('0x6'));var client=jayson[_0xd0c8('0x7')]['http']({'port':0x232a});config[_0xd0c8('0x8')]=_['defaults'](config[_0xd0c8('0x8')],{'host':_0xd0c8('0x9'),'port':0x18eb});var socket=require(_0xd0c8('0xa'))(new Redis(config[_0xd0c8('0x8')]));require(_0xd0c8('0xb'))['register'](socket);function respondWithRpcPromise(_0x82ca40,_0x22df4d,_0x3b9aed){return new BPromise(function(_0x1a38b9,_0x557607){return client['request'](_0x82ca40,_0x3b9aed)[_0xd0c8('0xc')](function(_0x10f4ea){logger['info']('ChatQueue,\x20%s,\x20%s',_0x22df4d,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x22df4d,_0xd0c8('0xd'),JSON[_0xd0c8('0xe')](_0x10f4ea));if(_0x10f4ea['error']){if(_0x10f4ea[_0xd0c8('0xf')][_0xd0c8('0x10')]===0x1f4){logger[_0xd0c8('0xf')](_0xd0c8('0x11'),_0x22df4d,_0x10f4ea[_0xd0c8('0xf')][_0xd0c8('0x12')]);return _0x557607(_0x10f4ea[_0xd0c8('0xf')][_0xd0c8('0x12')]);}logger[_0xd0c8('0xf')](_0xd0c8('0x11'),_0x22df4d,_0x10f4ea[_0xd0c8('0xf')][_0xd0c8('0x12')]);return _0x1a38b9(_0x10f4ea['error'][_0xd0c8('0x12')]);}else{logger[_0xd0c8('0x13')](_0xd0c8('0x11'),_0x22df4d,'request\x20sent');_0x1a38b9(_0x10f4ea['result'][_0xd0c8('0x12')]);}})['catch'](function(_0x5e797c){logger[_0xd0c8('0xf')](_0xd0c8('0x11'),_0x22df4d,_0x5e797c);_0x557607(_0x5e797c);});});}exports['GetChatQueue']=function(_0x10c878){var _0x42ba67=this;return new Promise(function(_0x559ddd,_0x1a5a3d){return db[_0xd0c8('0x14')][_0xd0c8('0x15')]({'raw':_0x10c878[_0xd0c8('0x16')]?_0x10c878[_0xd0c8('0x16')][_0xd0c8('0x17')]===undefined?!![]:![]:!![],'where':_0x10c878[_0xd0c8('0x16')]?_0x10c878[_0xd0c8('0x16')][_0xd0c8('0x18')]||null:null,'attributes':_0x10c878[_0xd0c8('0x16')]?_0x10c878[_0xd0c8('0x16')][_0xd0c8('0x19')]||null:null,'limit':_0x10c878[_0xd0c8('0x16')]?_0x10c878[_0xd0c8('0x16')][_0xd0c8('0x1a')]||null:null,'include':_0x10c878[_0xd0c8('0x16')]?_0x10c878[_0xd0c8('0x16')][_0xd0c8('0x1b')]?_[_0xd0c8('0x1c')](_0x10c878['options']['include'],function(_0xc109ee){return{'model':db[_0xc109ee[_0xd0c8('0x1d')]],'as':_0xc109ee['as'],'attributes':_0xc109ee[_0xd0c8('0x19')],'include':_0xc109ee[_0xd0c8('0x1b')]?_[_0xd0c8('0x1c')](_0xc109ee[_0xd0c8('0x1b')],function(_0x39ec6d){return{'model':db[_0x39ec6d[_0xd0c8('0x1d')]],'as':_0x39ec6d['as'],'attributes':_0x39ec6d[_0xd0c8('0x19')],'include':_0x39ec6d['include']?_[_0xd0c8('0x1c')](_0x39ec6d[_0xd0c8('0x1b')],function(_0x160032){return{'model':db[_0x160032['model']],'as':_0x160032['as'],'attributes':_0x160032['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x22e125){logger['info'](_0xd0c8('0x1e'),_0x10c878);logger['debug'](_0xd0c8('0x1e'),_0x10c878,JSON[_0xd0c8('0xe')](_0x22e125));_0x559ddd(_0x22e125);})['catch'](function(_0x30336a){logger[_0xd0c8('0xf')](_0xd0c8('0x1e'),_0x30336a['message'],_0x10c878);_0x1a5a3d(_0x42ba67[_0xd0c8('0xf')](0x1f4,_0x30336a[_0xd0c8('0x12')]));});});};exports[_0xd0c8('0x1f')]=function(_0x21d7fb){var _0x87f472=this;return new Promise(function(_0x1f4b11,_0x3cf0f1){return db[_0xd0c8('0x14')][_0xd0c8('0x20')]({'raw':_0x21d7fb[_0xd0c8('0x16')]?_0x21d7fb['options']['raw']===undefined?!![]:![]:!![],'where':_0x21d7fb['options']?_0x21d7fb[_0xd0c8('0x16')]['where']||null:null,'attributes':_0x21d7fb[_0xd0c8('0x16')]?_0x21d7fb['options'][_0xd0c8('0x19')]||null:null,'include':_0x21d7fb[_0xd0c8('0x16')]?_0x21d7fb[_0xd0c8('0x16')][_0xd0c8('0x1b')]?_[_0xd0c8('0x1c')](_0x21d7fb[_0xd0c8('0x16')][_0xd0c8('0x1b')],function(_0x481cef){return{'model':db[_0x481cef[_0xd0c8('0x1d')]],'as':_0x481cef['as'],'attributes':_0x481cef[_0xd0c8('0x19')],'include':_0x481cef['include']?_[_0xd0c8('0x1c')](_0x481cef[_0xd0c8('0x1b')],function(_0x321fe7){return{'model':db[_0x321fe7[_0xd0c8('0x1d')]],'as':_0x321fe7['as'],'attributes':_0x321fe7[_0xd0c8('0x19')],'include':_0x321fe7[_0xd0c8('0x1b')]?_['map'](_0x321fe7[_0xd0c8('0x1b')],function(_0x17f58c){return{'model':db[_0x17f58c[_0xd0c8('0x1d')]],'as':_0x17f58c['as'],'attributes':_0x17f58c[_0xd0c8('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd0c8('0xc')](function(_0x3d533f){logger[_0xd0c8('0x13')]('ShowChatQueue',_0x21d7fb);logger[_0xd0c8('0x21')](_0xd0c8('0x1f'),_0x21d7fb,JSON[_0xd0c8('0xe')](_0x3d533f));_0x1f4b11(_0x3d533f);})['catch'](function(_0x265a4d){logger[_0xd0c8('0xf')](_0xd0c8('0x1f'),_0x265a4d[_0xd0c8('0x12')],_0x21d7fb);_0x3cf0f1(_0x87f472[_0xd0c8('0xf')](0x1f4,_0x265a4d[_0xd0c8('0x12')]));});});}; \ No newline at end of file +var _0x5950=['model','map','debug','catch','ShowChatQueue','find','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','./chatQueue.socket','register','then','ChatQueue,\x20%s,\x20%s','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','GetChatQueue','ChatQueue','findAll','options','raw','where','limit','include','attributes'];(function(_0x395f63,_0x2cfb5f){var _0x580f5c=function(_0x5ebbbf){while(--_0x5ebbbf){_0x395f63['push'](_0x395f63['shift']());}};_0x580f5c(++_0x2cfb5f);}(_0x5950,0x11e));var _0x0595=function(_0x2524d1,_0x4d8490){_0x2524d1=_0x2524d1-0x0;var _0x4fe978=_0x5950[_0x2524d1];return _0x4fe978;};'use strict';var _=require(_0x0595('0x0'));var util=require(_0x0595('0x1'));var moment=require(_0x0595('0x2'));var BPromise=require(_0x0595('0x3'));var rs=require(_0x0595('0x4'));var fs=require('fs');var Redis=require(_0x0595('0x5'));var db=require(_0x0595('0x6'))['db'];var utils=require(_0x0595('0x7'));var logger=require(_0x0595('0x8'))(_0x0595('0x9'));var config=require(_0x0595('0xa'));var jayson=require(_0x0595('0xb'));var client=jayson[_0x0595('0xc')]['http']({'port':0x232a});config['redis']=_[_0x0595('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0595('0xe')]));require(_0x0595('0xf'))[_0x0595('0x10')](socket);function respondWithRpcPromise(_0x56c464,_0x58c6f5,_0x141c3f){return new BPromise(function(_0x4e4313,_0xb04683){return client['request'](_0x56c464,_0x141c3f)[_0x0595('0x11')](function(_0x5db2eb){logger['info'](_0x0595('0x12'),_0x58c6f5,_0x0595('0x13'));logger['debug'](_0x0595('0x14'),_0x58c6f5,'request\x20sent',JSON[_0x0595('0x15')](_0x5db2eb));if(_0x5db2eb[_0x0595('0x16')]){if(_0x5db2eb['error']['code']===0x1f4){logger[_0x0595('0x16')]('ChatQueue,\x20%s,\x20%s',_0x58c6f5,_0x5db2eb[_0x0595('0x16')][_0x0595('0x17')]);return _0xb04683(_0x5db2eb['error'][_0x0595('0x17')]);}logger[_0x0595('0x16')]('ChatQueue,\x20%s,\x20%s',_0x58c6f5,_0x5db2eb[_0x0595('0x16')][_0x0595('0x17')]);return _0x4e4313(_0x5db2eb[_0x0595('0x16')][_0x0595('0x17')]);}else{logger[_0x0595('0x18')](_0x0595('0x12'),_0x58c6f5,_0x0595('0x13'));_0x4e4313(_0x5db2eb['result'][_0x0595('0x17')]);}})['catch'](function(_0x44e9c7){logger['error']('ChatQueue,\x20%s,\x20%s',_0x58c6f5,_0x44e9c7);_0xb04683(_0x44e9c7);});});}exports[_0x0595('0x19')]=function(_0x5f2626){var _0x23a77c=this;return new Promise(function(_0x19437d,_0x2d8b17){return db[_0x0595('0x1a')][_0x0595('0x1b')]({'raw':_0x5f2626[_0x0595('0x1c')]?_0x5f2626[_0x0595('0x1c')][_0x0595('0x1d')]===undefined?!![]:![]:!![],'where':_0x5f2626[_0x0595('0x1c')]?_0x5f2626['options'][_0x0595('0x1e')]||null:null,'attributes':_0x5f2626[_0x0595('0x1c')]?_0x5f2626[_0x0595('0x1c')]['attributes']||null:null,'limit':_0x5f2626['options']?_0x5f2626[_0x0595('0x1c')][_0x0595('0x1f')]||null:null,'include':_0x5f2626[_0x0595('0x1c')]?_0x5f2626[_0x0595('0x1c')]['include']?_['map'](_0x5f2626[_0x0595('0x1c')][_0x0595('0x20')],function(_0x4153b4){return{'model':db[_0x4153b4['model']],'as':_0x4153b4['as'],'attributes':_0x4153b4[_0x0595('0x21')],'include':_0x4153b4['include']?_['map'](_0x4153b4[_0x0595('0x20')],function(_0x21ea1d){return{'model':db[_0x21ea1d[_0x0595('0x22')]],'as':_0x21ea1d['as'],'attributes':_0x21ea1d[_0x0595('0x21')],'include':_0x21ea1d[_0x0595('0x20')]?_[_0x0595('0x23')](_0x21ea1d[_0x0595('0x20')],function(_0x31abae){return{'model':db[_0x31abae['model']],'as':_0x31abae['as'],'attributes':_0x31abae[_0x0595('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x910032){logger[_0x0595('0x18')]('GetChatQueue',_0x5f2626);logger[_0x0595('0x24')]('GetChatQueue',_0x5f2626,JSON[_0x0595('0x15')](_0x910032));_0x19437d(_0x910032);})[_0x0595('0x25')](function(_0x1bad53){logger['error'](_0x0595('0x19'),_0x1bad53[_0x0595('0x17')],_0x5f2626);_0x2d8b17(_0x23a77c['error'](0x1f4,_0x1bad53[_0x0595('0x17')]));});});};exports[_0x0595('0x26')]=function(_0x2b6f43){var _0x48243b=this;return new Promise(function(_0x130d7e,_0x54075c){return db[_0x0595('0x1a')][_0x0595('0x27')]({'raw':_0x2b6f43[_0x0595('0x1c')]?_0x2b6f43['options'][_0x0595('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b6f43[_0x0595('0x1c')]?_0x2b6f43[_0x0595('0x1c')][_0x0595('0x1e')]||null:null,'attributes':_0x2b6f43[_0x0595('0x1c')]?_0x2b6f43[_0x0595('0x1c')][_0x0595('0x21')]||null:null,'include':_0x2b6f43['options']?_0x2b6f43[_0x0595('0x1c')][_0x0595('0x20')]?_['map'](_0x2b6f43[_0x0595('0x1c')][_0x0595('0x20')],function(_0x2ac492){return{'model':db[_0x2ac492[_0x0595('0x22')]],'as':_0x2ac492['as'],'attributes':_0x2ac492[_0x0595('0x21')],'include':_0x2ac492[_0x0595('0x20')]?_[_0x0595('0x23')](_0x2ac492[_0x0595('0x20')],function(_0x3fec29){return{'model':db[_0x3fec29[_0x0595('0x22')]],'as':_0x3fec29['as'],'attributes':_0x3fec29['attributes'],'include':_0x3fec29[_0x0595('0x20')]?_[_0x0595('0x23')](_0x3fec29['include'],function(_0x253042){return{'model':db[_0x253042['model']],'as':_0x253042['as'],'attributes':_0x253042[_0x0595('0x21')]};}):[]};}):[]};}):[]:[]})[_0x0595('0x11')](function(_0x4f2ff1){logger['info'](_0x0595('0x26'),_0x2b6f43);logger[_0x0595('0x24')]('ShowChatQueue',_0x2b6f43,JSON['stringify'](_0x4f2ff1));_0x130d7e(_0x4f2ff1);})[_0x0595('0x25')](function(_0x163f63){logger[_0x0595('0x16')](_0x0595('0x26'),_0x163f63[_0x0595('0x17')],_0x2b6f43);_0x54075c(_0x48243b['error'](0x1f4,_0x163f63[_0x0595('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index a79206c..6f10807 100644 --- a/server/api/chatQueue/chatQueue.socket.js +++ b/server/api/chatQueue/chatQueue.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['remove','update','emit','removeListener','register','length','chatQueue:','./chatQueue.events','save'];(function(_0x345aab,_0x18b7af){var _0x37d787=function(_0x262a09){while(--_0x262a09){_0x345aab['push'](_0x345aab['shift']());}};_0x37d787(++_0x18b7af);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2e3591,_0x24acba){_0x2e3591=_0x2e3591-0x0;var _0x1a451=_0x5f2f[_0x2e3591];return _0x1a451;};'use strict';var ChatQueueEvents=require(_0xf5f2('0x0'));var events=[_0xf5f2('0x1'),_0xf5f2('0x2'),_0xf5f2('0x3')];function createListener(_0x1172dd,_0x174bc7){return function(_0x3c72ee){_0x174bc7[_0xf5f2('0x4')](_0x1172dd,_0x3c72ee);};}function removeListener(_0x501fbd,_0x4854b6){return function(){ChatQueueEvents[_0xf5f2('0x5')](_0x501fbd,_0x4854b6);};}exports[_0xf5f2('0x6')]=function(_0xad7f65){for(var _0x3eebf6=0x0,_0x3133bc=events[_0xf5f2('0x7')];_0x3eebf6<_0x3133bc;_0x3eebf6++){var _0x5907aa=events[_0x3eebf6];var _0x466882=createListener(_0xf5f2('0x8')+_0x5907aa,_0xad7f65);ChatQueueEvents['on'](_0x5907aa,_0x466882);}}; \ No newline at end of file +var _0xbaf0=['removeListener','register','length','chatQueue:','save','remove','update'];(function(_0x4c406a,_0x22fed9){var _0x332aaf=function(_0x101190){while(--_0x101190){_0x4c406a['push'](_0x4c406a['shift']());}};_0x332aaf(++_0x22fed9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0xbaf0[_0x6c993a];return _0x27f547;};'use strict';var ChatQueueEvents=require('./chatQueue.events');var events=[_0x0baf('0x0'),_0x0baf('0x1'),_0x0baf('0x2')];function createListener(_0x263f79,_0x1688bc){return function(_0x4d2e72){_0x1688bc['emit'](_0x263f79,_0x4d2e72);};}function removeListener(_0x232cc7,_0x1c383e){return function(){ChatQueueEvents[_0x0baf('0x3')](_0x232cc7,_0x1c383e);};}exports[_0x0baf('0x4')]=function(_0xe4c3c4){for(var _0x335e24=0x0,_0x1a10b1=events[_0x0baf('0x5')];_0x335e24<_0x1a10b1;_0x335e24++){var _0x1d0a0d=events[_0x335e24];var _0x5f5030=createListener(_0x0baf('0x6')+_0x1d0a0d,_0xe4c3c4);ChatQueueEvents['on'](_0x1d0a0d,_0x5f5030);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 8ab0350..08c403d 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 _0xa0cf=['isAuthenticated','index','/describe','/:id/members','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','/:id','update','delete','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get'];(function(_0x49daa3,_0x26ad10){var _0x3c5754=function(_0x3c6e61){while(--_0x3c6e61){_0x49daa3['push'](_0x49daa3['shift']());}};_0x3c5754(++_0x26ad10);}(_0xa0cf,0x114));var _0xfa0c=function(_0x36f8c5,_0x173213){_0x36f8c5=_0x36f8c5-0x0;var _0x3dee1a=_0xa0cf[_0x36f8c5];return _0x3dee1a;};'use strict';var multer=require(_0xfa0c('0x0'));var util=require(_0xfa0c('0x1'));var path=require(_0xfa0c('0x2'));var timeout=require(_0xfa0c('0x3'));var express=require(_0xfa0c('0x4'));var router=express[_0xfa0c('0x5')]();var auth=require(_0xfa0c('0x6'));var interaction=require(_0xfa0c('0x7'));var config=require('../../config/environment');var controller=require(_0xfa0c('0x8'));router[_0xfa0c('0x9')]('/',auth[_0xfa0c('0xa')](),controller[_0xfa0c('0xb')]);router[_0xfa0c('0x9')](_0xfa0c('0xc'),auth[_0xfa0c('0xa')](),controller['describe']);router[_0xfa0c('0x9')]('/:id',auth[_0xfa0c('0xa')](),controller['show']);router[_0xfa0c('0x9')](_0xfa0c('0xd'),auth[_0xfa0c('0xa')](),controller['getMembers']);router['get'](_0xfa0c('0xe'),auth['isAuthenticated'](),controller[_0xfa0c('0xf')]);router[_0xfa0c('0x9')](_0xfa0c('0x10'),auth['isAuthenticated'](),controller['getAgents']);router[_0xfa0c('0x11')]('/',auth[_0xfa0c('0xa')](),controller[_0xfa0c('0x12')]);router[_0xfa0c('0x11')](_0xfa0c('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0xfa0c('0x11')](_0xfa0c('0x10'),auth[_0xfa0c('0xa')](),controller[_0xfa0c('0x13')]);router[_0xfa0c('0x14')](_0xfa0c('0x15'),auth[_0xfa0c('0xa')](),controller[_0xfa0c('0x16')]);router[_0xfa0c('0x17')](_0xfa0c('0x15'),auth['isAuthenticated'](),controller['destroy']);router[_0xfa0c('0x17')]('/:id/teams',auth[_0xfa0c('0xa')](),controller['removeTeams']);router['delete'](_0xfa0c('0x10'),auth[_0xfa0c('0xa')](),controller[_0xfa0c('0x18')]);module[_0xfa0c('0x19')]=router; \ No newline at end of file +var _0xbc26=['/:id','show','/:id/members','getMembers','getTeams','/:id/users','create','/:id/teams','addTeams','post','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','get','isAuthenticated','index','/describe','describe'];(function(_0x52bb76,_0x325703){var _0x2f2f21=function(_0x888a73){while(--_0x888a73){_0x52bb76['push'](_0x52bb76['shift']());}};_0x2f2f21(++_0x325703);}(_0xbc26,0x1a5));var _0x6bc2=function(_0x62f044,_0x47f8df){_0x62f044=_0x62f044-0x0;var _0x1b2d7b=_0xbc26[_0x62f044];return _0x1b2d7b;};'use strict';var multer=require(_0x6bc2('0x0'));var util=require(_0x6bc2('0x1'));var path=require(_0x6bc2('0x2'));var timeout=require('connect-timeout');var express=require(_0x6bc2('0x3'));var router=express[_0x6bc2('0x4')]();var auth=require(_0x6bc2('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./chatQueue.controller');router[_0x6bc2('0x6')]('/',auth[_0x6bc2('0x7')](),controller[_0x6bc2('0x8')]);router[_0x6bc2('0x6')](_0x6bc2('0x9'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0xa')]);router['get'](_0x6bc2('0xb'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0xc')]);router[_0x6bc2('0x6')](_0x6bc2('0xd'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0xe')]);router[_0x6bc2('0x6')]('/:id/teams',auth['isAuthenticated'](),controller[_0x6bc2('0xf')]);router[_0x6bc2('0x6')](_0x6bc2('0x10'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x6bc2('0x11')]);router['post'](_0x6bc2('0x12'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0x13')]);router[_0x6bc2('0x14')]('/:id/users',auth[_0x6bc2('0x7')](),controller['addAgents']);router['put'](_0x6bc2('0xb'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0x15')]);router[_0x6bc2('0x16')](_0x6bc2('0xb'),auth[_0x6bc2('0x7')](),controller[_0x6bc2('0x17')]);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0x6bc2('0x18')]);router[_0x6bc2('0x16')](_0x6bc2('0x10'),auth['isAuthenticated'](),controller[_0x6bc2('0x19')]);module[_0x6bc2('0x1a')]=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index 4b19696..dda224b 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 _0xadda=['moment','sequelize','exports','STRING','DATE'];(function(_0xdf6525,_0x57a0e6){var _0x4b90d5=function(_0x29df84){while(--_0x29df84){_0xdf6525['push'](_0xdf6525['shift']());}};_0x4b90d5(++_0x57a0e6);}(_0xadda,0xeb));var _0xaadd=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0xadda[_0x3ff085];return _0x2b68c3;};'use strict';var moment=require(_0xaadd('0x0'));var Sequelize=require(_0xaadd('0x1'));module[_0xaadd('0x2')]={'uniqueid':{'type':Sequelize[_0xaadd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xaadd('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xaadd('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xaadd('0x4')]},'reason':{'type':Sequelize[_0xaadd('0x3')]}}; \ No newline at end of file +var _0x50c5=['DATE','sequelize','STRING'];(function(_0x464510,_0x32d71f){var _0x98d71e=function(_0x4bbecc){while(--_0x4bbecc){_0x464510['push'](_0x464510['shift']());}};_0x98d71e(++_0x32d71f);}(_0x50c5,0xc1));var _0x550c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x50c5[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require('moment');var Sequelize=require(_0x550c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x550c('0x1')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x550c('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x550c('0x2')]},'reason':{'type':Sequelize[_0x550c('0x1')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 19917d4..01e65af 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 _0x9e7e=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','Content-Range','apply','update','then','stack','name','send','map','ChatQueueReport','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','show','params','keys','find','create','body'];(function(_0xa5624b,_0x5be014){var _0x32c9be=function(_0x174978){while(--_0x174978){_0xa5624b['push'](_0xa5624b['shift']());}};_0x32c9be(++_0x5be014);}(_0x9e7e,0x8f));var _0xe9e7=function(_0x1a1b6e,_0x3a07a9){_0x1a1b6e=_0x1a1b6e-0x0;var _0x571e2c=_0x9e7e[_0x1a1b6e];return _0x571e2c;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe9e7('0x0'));var rimraf=require(_0xe9e7('0x1'));var zipdir=require(_0xe9e7('0x2'));var jsonpatch=require(_0xe9e7('0x3'));var rp=require(_0xe9e7('0x4'));var moment=require(_0xe9e7('0x5'));var BPromise=require(_0xe9e7('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xe9e7('0x7'));var sox=require(_0xe9e7('0x8'));var csv=require(_0xe9e7('0x9'));var ejs=require(_0xe9e7('0xa'));var fs=require('fs');var _=require(_0xe9e7('0xb'));var squel=require(_0xe9e7('0xc'));var crypto=require(_0xe9e7('0xd'));var jsforce=require(_0xe9e7('0xe'));var deskjs=require(_0xe9e7('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xe9e7('0x10'));var Redis=require(_0xe9e7('0x11'));var authService=require(_0xe9e7('0x12'));var qs=require(_0xe9e7('0x13'));var as=require(_0xe9e7('0x14'));var hardwareService=require(_0xe9e7('0x15'));var logger=require('../../config/logger')(_0xe9e7('0x16'));var utils=require(_0xe9e7('0x17'));var config=require(_0xe9e7('0x18'));var db=require(_0xe9e7('0x19'))['db'];function respondWithStatusCode(_0x4bd998,_0x57ff44){_0x57ff44=_0x57ff44||0xcc;return function(_0x49bbcc){if(_0x49bbcc){return _0x4bd998[_0xe9e7('0x1a')](_0x57ff44);}return _0x4bd998[_0xe9e7('0x1b')](_0x57ff44)[_0xe9e7('0x1c')]();};}function respondWithResult(_0x46a2aa,_0x183a1f){_0x183a1f=_0x183a1f||0xc8;return function(_0x7b9230){if(_0x7b9230){return _0x46a2aa['status'](_0x183a1f)[_0xe9e7('0x1d')](_0x7b9230);}};}function respondWithFilteredResult(_0x55912e,_0x5b2343){return function(_0x27289c){if(_0x27289c){var _0x1f8c0e=_0x27289c['count'],_0x2a3ed4=_0x5b2343[_0xe9e7('0x1e')],_0x3d5276=_0x5b2343['offset']+_0x5b2343[_0xe9e7('0x1f')],_0x34f890;if(_0x3d5276>=_0x1f8c0e){_0x3d5276=_0x1f8c0e;_0x34f890=0xc8;}else{_0x34f890=0xce;}_0x55912e[_0xe9e7('0x1b')](_0x34f890);return _0x55912e['set'](_0xe9e7('0x20'),_0x2a3ed4+'-'+_0x3d5276+'/'+_0x1f8c0e)['json'](_0x27289c);}return null;};}function patchUpdates(_0x36f5dc){return function(_0x43aea6){try{jsonpatch[_0xe9e7('0x21')](_0x43aea6,_0x36f5dc,!![]);}catch(_0x456311){return BPromise['reject'](_0x456311);}return _0x43aea6['save']();};}function saveUpdates(_0x3e240d,_0x106f63){return function(_0x3f886d){if(_0x3f886d){return _0x3f886d[_0xe9e7('0x22')](_0x3e240d)[_0xe9e7('0x23')](function(_0x348a67){return _0x348a67;});}return null;};}function removeEntity(_0x7e8a64,_0x55d4fa){return function(_0xa1b024){if(_0xa1b024){return _0xa1b024['destroy']()['then'](function(){_0x7e8a64['status'](0xcc)[_0xe9e7('0x1c')]();});}};}function handleEntityNotFound(_0x14ad03,_0xcc1010){return function(_0x1f041a){if(!_0x1f041a){_0x14ad03[_0xe9e7('0x1a')](0x194);}return _0x1f041a;};}function handleError(_0x3546ea,_0x547ff9){_0x547ff9=_0x547ff9||0x1f4;return function(_0x465103){logger['error'](_0x465103[_0xe9e7('0x24')]);if(_0x465103[_0xe9e7('0x25')]){delete _0x465103[_0xe9e7('0x25')];}_0x3546ea[_0xe9e7('0x1b')](_0x547ff9)[_0xe9e7('0x26')](_0x465103);};}exports['index']=function(_0x53424e,_0x280067){var _0x5a1a87={},_0x42ccf9={},_0x550225={'count':0x0,'rows':[]};var _0x56324a=_[_0xe9e7('0x27')](db[_0xe9e7('0x28')]['rawAttributes'],function(_0x1e9933){return{'name':_0x1e9933['fieldName'],'type':_0x1e9933[_0xe9e7('0x29')][_0xe9e7('0x2a')]};});_0x42ccf9[_0xe9e7('0x2b')]=_[_0xe9e7('0x27')](_0x56324a,'name');_0x42ccf9[_0xe9e7('0x2c')]=_['keys'](_0x53424e[_0xe9e7('0x2c')]);_0x42ccf9[_0xe9e7('0x2d')]=_['intersection'](_0x42ccf9[_0xe9e7('0x2b')],_0x42ccf9[_0xe9e7('0x2c')]);_0x5a1a87[_0xe9e7('0x2e')]=_[_0xe9e7('0x2f')](_0x42ccf9[_0xe9e7('0x2b')],qs[_0xe9e7('0x30')](_0x53424e['query'][_0xe9e7('0x30')]));_0x5a1a87[_0xe9e7('0x2e')]=_0x5a1a87['attributes'][_0xe9e7('0x31')]?_0x5a1a87[_0xe9e7('0x2e')]:_0x42ccf9[_0xe9e7('0x2b')];if(!_0x53424e['query'][_0xe9e7('0x32')](_0xe9e7('0x33'))){_0x5a1a87[_0xe9e7('0x1f')]=qs[_0xe9e7('0x1f')](_0x53424e['query'][_0xe9e7('0x1f')]);_0x5a1a87[_0xe9e7('0x1e')]=qs[_0xe9e7('0x1e')](_0x53424e[_0xe9e7('0x2c')][_0xe9e7('0x1e')]);}_0x5a1a87[_0xe9e7('0x34')]=qs[_0xe9e7('0x35')](_0x53424e[_0xe9e7('0x2c')][_0xe9e7('0x35')]);_0x5a1a87[_0xe9e7('0x36')]=qs[_0xe9e7('0x2d')](_['pick'](_0x53424e[_0xe9e7('0x2c')],_0x42ccf9[_0xe9e7('0x2d')]));if(_0x53424e[_0xe9e7('0x2c')][_0xe9e7('0x37')]){_0x5a1a87[_0xe9e7('0x36')]=_[_0xe9e7('0x38')](_0x5a1a87['where'],{'$or':_[_0xe9e7('0x27')](_0x56324a,function(_0x1daf4e){if(_0x1daf4e[_0xe9e7('0x29')]!==_0xe9e7('0x39')){var _0x148e71={};_0x148e71[_0x1daf4e[_0xe9e7('0x25')]]={'$like':'%'+_0x53424e[_0xe9e7('0x2c')][_0xe9e7('0x37')]+'%'};return _0x148e71;}})});}_0x5a1a87=_[_0xe9e7('0x38')]({},_0x5a1a87,_0x53424e[_0xe9e7('0x3a')]);var _0x49d34a={'where':_0x5a1a87[_0xe9e7('0x36')]};return db['ChatQueueReport']['count'](_0x49d34a)[_0xe9e7('0x23')](function(_0x4e0a8e){_0x550225[_0xe9e7('0x3b')]=_0x4e0a8e;if(_0x53424e['query'][_0xe9e7('0x3c')]){_0x5a1a87[_0xe9e7('0x3d')]=[{'all':!![]}];}return db[_0xe9e7('0x28')][_0xe9e7('0x3e')](_0x5a1a87);})['then'](function(_0x331daa){_0x550225['rows']=_0x331daa;return _0x550225;})['then'](respondWithFilteredResult(_0x280067,_0x5a1a87))[_0xe9e7('0x3f')](handleError(_0x280067,null));};exports[_0xe9e7('0x40')]=function(_0x543d6a,_0x212ed5){var _0x5e028f={'raw':!![],'where':{'id':_0x543d6a[_0xe9e7('0x41')]['id']}},_0x38fc27={};_0x38fc27[_0xe9e7('0x2b')]=_[_0xe9e7('0x42')](db['ChatQueueReport']['rawAttributes']);_0x38fc27[_0xe9e7('0x2c')]=_[_0xe9e7('0x42')](_0x543d6a[_0xe9e7('0x2c')]);_0x38fc27[_0xe9e7('0x2d')]=_[_0xe9e7('0x2f')](_0x38fc27[_0xe9e7('0x2b')],_0x38fc27[_0xe9e7('0x2c')]);_0x5e028f['attributes']=_[_0xe9e7('0x2f')](_0x38fc27[_0xe9e7('0x2b')],qs['fields'](_0x543d6a[_0xe9e7('0x2c')][_0xe9e7('0x30')]));_0x5e028f[_0xe9e7('0x2e')]=_0x5e028f[_0xe9e7('0x2e')][_0xe9e7('0x31')]?_0x5e028f[_0xe9e7('0x2e')]:_0x38fc27[_0xe9e7('0x2b')];if(_0x543d6a[_0xe9e7('0x2c')][_0xe9e7('0x3c')]){_0x5e028f[_0xe9e7('0x3d')]=[{'all':!![]}];}_0x5e028f=_[_0xe9e7('0x38')]({},_0x5e028f,_0x543d6a[_0xe9e7('0x3a')]);return db[_0xe9e7('0x28')][_0xe9e7('0x43')](_0x5e028f)[_0xe9e7('0x23')](handleEntityNotFound(_0x212ed5,null))['then'](respondWithResult(_0x212ed5,null))[_0xe9e7('0x3f')](handleError(_0x212ed5,null));};exports[_0xe9e7('0x44')]=function(_0x7aac93,_0x4a620e){return db[_0xe9e7('0x28')][_0xe9e7('0x44')](_0x7aac93[_0xe9e7('0x45')],{})[_0xe9e7('0x23')](respondWithResult(_0x4a620e,0xc9))[_0xe9e7('0x3f')](handleError(_0x4a620e,null));};exports[_0xe9e7('0x22')]=function(_0x25c1b9,_0x536448){if(_0x25c1b9['body']['id']){delete _0x25c1b9[_0xe9e7('0x45')]['id'];}return db['ChatQueueReport'][_0xe9e7('0x43')]({'where':{'id':_0x25c1b9[_0xe9e7('0x41')]['id']}})[_0xe9e7('0x23')](handleEntityNotFound(_0x536448,null))[_0xe9e7('0x23')](saveUpdates(_0x25c1b9[_0xe9e7('0x45')],null))[_0xe9e7('0x23')](respondWithResult(_0x536448,null))[_0xe9e7('0x3f')](handleError(_0x536448,null));};exports['destroy']=function(_0x17626b,_0xc758b8){return db[_0xe9e7('0x28')][_0xe9e7('0x43')]({'where':{'id':_0x17626b[_0xe9e7('0x41')]['id']}})[_0xe9e7('0x23')](handleEntityNotFound(_0xc758b8,null))[_0xe9e7('0x23')](removeEntity(_0xc758b8,null))[_0xe9e7('0x3f')](handleError(_0xc758b8,null));};exports[_0xe9e7('0x46')]=function(_0x30d25c,_0x156cec){return db[_0xe9e7('0x28')]['describe']()['then'](respondWithResult(_0x156cec,null))[_0xe9e7('0x3f')](handleError(_0x156cec,null));}; \ No newline at end of file +var _0xe772=['index','map','ChatQueueReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','count','includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','send'];(function(_0x803e24,_0x3b4793){var _0x5efc2c=function(_0x1a9d71){while(--_0x1a9d71){_0x803e24['push'](_0x803e24['shift']());}};_0x5efc2c(++_0x3b4793);}(_0xe772,0x199));var _0x2e77=function(_0x53417c,_0x126dee){_0x53417c=_0x53417c-0x0;var _0x49407d=_0xe772[_0x53417c];return _0x49407d;};'use strict';var pdf=require(_0x2e77('0x0'));var emlformat=require(_0x2e77('0x1'));var rimraf=require(_0x2e77('0x2'));var zipdir=require(_0x2e77('0x3'));var jsonpatch=require(_0x2e77('0x4'));var rp=require(_0x2e77('0x5'));var moment=require('moment');var BPromise=require(_0x2e77('0x6'));var Mustache=require(_0x2e77('0x7'));var util=require('util');var path=require(_0x2e77('0x8'));var sox=require(_0x2e77('0x9'));var csv=require('to-csv');var ejs=require(_0x2e77('0xa'));var fs=require('fs');var _=require(_0x2e77('0xb'));var squel=require('squel');var crypto=require(_0x2e77('0xc'));var jsforce=require(_0x2e77('0xd'));var deskjs=require(_0x2e77('0xe'));var toCsv=require(_0x2e77('0xf'));var querystring=require('querystring');var Papa=require(_0x2e77('0x10'));var Redis=require(_0x2e77('0x11'));var authService=require(_0x2e77('0x12'));var qs=require(_0x2e77('0x13'));var as=require(_0x2e77('0x14'));var hardwareService=require(_0x2e77('0x15'));var logger=require(_0x2e77('0x16'))(_0x2e77('0x17'));var utils=require(_0x2e77('0x18'));var config=require(_0x2e77('0x19'));var db=require(_0x2e77('0x1a'))['db'];function respondWithStatusCode(_0x5cd5b3,_0x3c0195){_0x3c0195=_0x3c0195||0xcc;return function(_0x5a579c){if(_0x5a579c){return _0x5cd5b3['sendStatus'](_0x3c0195);}return _0x5cd5b3[_0x2e77('0x1b')](_0x3c0195)[_0x2e77('0x1c')]();};}function respondWithResult(_0x2ac260,_0x557a60){_0x557a60=_0x557a60||0xc8;return function(_0x1d02b3){if(_0x1d02b3){return _0x2ac260[_0x2e77('0x1b')](_0x557a60)['json'](_0x1d02b3);}};}function respondWithFilteredResult(_0x1f56e8,_0x2ef320){return function(_0x2d8972){if(_0x2d8972){var _0x4e0d4d=_0x2d8972['count'],_0xa1bfa1=_0x2ef320[_0x2e77('0x1d')],_0x3504fd=_0x2ef320[_0x2e77('0x1d')]+_0x2ef320[_0x2e77('0x1e')],_0x26d63b;if(_0x3504fd>=_0x4e0d4d){_0x3504fd=_0x4e0d4d;_0x26d63b=0xc8;}else{_0x26d63b=0xce;}_0x1f56e8['status'](_0x26d63b);return _0x1f56e8[_0x2e77('0x1f')](_0x2e77('0x20'),_0xa1bfa1+'-'+_0x3504fd+'/'+_0x4e0d4d)['json'](_0x2d8972);}return null;};}function patchUpdates(_0x2ee3d5){return function(_0x2333f5){try{jsonpatch[_0x2e77('0x21')](_0x2333f5,_0x2ee3d5,!![]);}catch(_0x3e135e){return BPromise[_0x2e77('0x22')](_0x3e135e);}return _0x2333f5['save']();};}function saveUpdates(_0x3b6a89,_0x532792){return function(_0xa96908){if(_0xa96908){return _0xa96908[_0x2e77('0x23')](_0x3b6a89)[_0x2e77('0x24')](function(_0x591e40){return _0x591e40;});}return null;};}function removeEntity(_0x13328e,_0x57260c){return function(_0x114fe7){if(_0x114fe7){return _0x114fe7[_0x2e77('0x25')]()[_0x2e77('0x24')](function(){_0x13328e['status'](0xcc)[_0x2e77('0x1c')]();});}};}function handleEntityNotFound(_0x37f3a7,_0x382f0d){return function(_0x5833e0){if(!_0x5833e0){_0x37f3a7['sendStatus'](0x194);}return _0x5833e0;};}function handleError(_0x41b21e,_0x1208bc){_0x1208bc=_0x1208bc||0x1f4;return function(_0x1f160e){logger['error'](_0x1f160e[_0x2e77('0x26')]);if(_0x1f160e[_0x2e77('0x27')]){delete _0x1f160e[_0x2e77('0x27')];}_0x41b21e[_0x2e77('0x1b')](_0x1208bc)[_0x2e77('0x28')](_0x1f160e);};}exports[_0x2e77('0x29')]=function(_0x83d15c,_0x5f3908){var _0x24dddd={},_0x597788={},_0x52cf21={'count':0x0,'rows':[]};var _0x493753=_[_0x2e77('0x2a')](db[_0x2e77('0x2b')]['rawAttributes'],function(_0x286325){return{'name':_0x286325[_0x2e77('0x2c')],'type':_0x286325[_0x2e77('0x2d')][_0x2e77('0x2e')]};});_0x597788[_0x2e77('0x2f')]=_[_0x2e77('0x2a')](_0x493753,_0x2e77('0x27'));_0x597788[_0x2e77('0x30')]=_[_0x2e77('0x31')](_0x83d15c[_0x2e77('0x30')]);_0x597788[_0x2e77('0x32')]=_[_0x2e77('0x33')](_0x597788[_0x2e77('0x2f')],_0x597788['query']);_0x24dddd[_0x2e77('0x34')]=_['intersection'](_0x597788[_0x2e77('0x2f')],qs[_0x2e77('0x35')](_0x83d15c[_0x2e77('0x30')][_0x2e77('0x35')]));_0x24dddd[_0x2e77('0x34')]=_0x24dddd[_0x2e77('0x34')][_0x2e77('0x36')]?_0x24dddd[_0x2e77('0x34')]:_0x597788['model'];if(!_0x83d15c[_0x2e77('0x30')]['hasOwnProperty'](_0x2e77('0x37'))){_0x24dddd['limit']=qs['limit'](_0x83d15c['query']['limit']);_0x24dddd[_0x2e77('0x1d')]=qs[_0x2e77('0x1d')](_0x83d15c[_0x2e77('0x30')][_0x2e77('0x1d')]);}_0x24dddd[_0x2e77('0x38')]=qs[_0x2e77('0x39')](_0x83d15c[_0x2e77('0x30')][_0x2e77('0x39')]);_0x24dddd[_0x2e77('0x3a')]=qs['filters'](_[_0x2e77('0x3b')](_0x83d15c[_0x2e77('0x30')],_0x597788[_0x2e77('0x32')]));if(_0x83d15c['query'][_0x2e77('0x3c')]){_0x24dddd[_0x2e77('0x3a')]=_[_0x2e77('0x3d')](_0x24dddd[_0x2e77('0x3a')],{'$or':_[_0x2e77('0x2a')](_0x493753,function(_0x554a82){if(_0x554a82[_0x2e77('0x2d')]!==_0x2e77('0x3e')){var _0x5452d5={};_0x5452d5[_0x554a82[_0x2e77('0x27')]]={'$like':'%'+_0x83d15c[_0x2e77('0x30')]['filter']+'%'};return _0x5452d5;}})});}_0x24dddd=_[_0x2e77('0x3d')]({},_0x24dddd,_0x83d15c['options']);var _0x4db443={'where':_0x24dddd['where']};return db[_0x2e77('0x2b')][_0x2e77('0x3f')](_0x4db443)['then'](function(_0x31aff7){_0x52cf21[_0x2e77('0x3f')]=_0x31aff7;if(_0x83d15c[_0x2e77('0x30')][_0x2e77('0x40')]){_0x24dddd[_0x2e77('0x41')]=[{'all':!![]}];}return db['ChatQueueReport'][_0x2e77('0x42')](_0x24dddd);})[_0x2e77('0x24')](function(_0x44ae43){_0x52cf21[_0x2e77('0x43')]=_0x44ae43;return _0x52cf21;})[_0x2e77('0x24')](respondWithFilteredResult(_0x5f3908,_0x24dddd))[_0x2e77('0x44')](handleError(_0x5f3908,null));};exports['show']=function(_0x4e96ac,_0x1117e0){var _0xd2f33={'raw':!![],'where':{'id':_0x4e96ac[_0x2e77('0x45')]['id']}},_0x10457d={};_0x10457d[_0x2e77('0x2f')]=_['keys'](db[_0x2e77('0x2b')][_0x2e77('0x46')]);_0x10457d[_0x2e77('0x30')]=_['keys'](_0x4e96ac[_0x2e77('0x30')]);_0x10457d[_0x2e77('0x32')]=_['intersection'](_0x10457d[_0x2e77('0x2f')],_0x10457d[_0x2e77('0x30')]);_0xd2f33[_0x2e77('0x34')]=_[_0x2e77('0x33')](_0x10457d[_0x2e77('0x2f')],qs[_0x2e77('0x35')](_0x4e96ac[_0x2e77('0x30')][_0x2e77('0x35')]));_0xd2f33[_0x2e77('0x34')]=_0xd2f33['attributes'][_0x2e77('0x36')]?_0xd2f33[_0x2e77('0x34')]:_0x10457d['model'];if(_0x4e96ac[_0x2e77('0x30')][_0x2e77('0x40')]){_0xd2f33[_0x2e77('0x41')]=[{'all':!![]}];}_0xd2f33=_[_0x2e77('0x3d')]({},_0xd2f33,_0x4e96ac['options']);return db[_0x2e77('0x2b')][_0x2e77('0x47')](_0xd2f33)[_0x2e77('0x24')](handleEntityNotFound(_0x1117e0,null))[_0x2e77('0x24')](respondWithResult(_0x1117e0,null))[_0x2e77('0x44')](handleError(_0x1117e0,null));};exports[_0x2e77('0x48')]=function(_0x18c168,_0xe18b4c){return db[_0x2e77('0x2b')]['create'](_0x18c168['body'],{})[_0x2e77('0x24')](respondWithResult(_0xe18b4c,0xc9))[_0x2e77('0x44')](handleError(_0xe18b4c,null));};exports[_0x2e77('0x23')]=function(_0x13680b,_0x2befcc){if(_0x13680b[_0x2e77('0x49')]['id']){delete _0x13680b[_0x2e77('0x49')]['id'];}return db[_0x2e77('0x2b')][_0x2e77('0x47')]({'where':{'id':_0x13680b[_0x2e77('0x45')]['id']}})[_0x2e77('0x24')](handleEntityNotFound(_0x2befcc,null))[_0x2e77('0x24')](saveUpdates(_0x13680b['body'],null))[_0x2e77('0x24')](respondWithResult(_0x2befcc,null))[_0x2e77('0x44')](handleError(_0x2befcc,null));};exports['destroy']=function(_0x5115d9,_0x25be57){return db[_0x2e77('0x2b')][_0x2e77('0x47')]({'where':{'id':_0x5115d9[_0x2e77('0x45')]['id']}})[_0x2e77('0x24')](handleEntityNotFound(_0x25be57,null))[_0x2e77('0x24')](removeEntity(_0x25be57,null))['catch'](handleError(_0x25be57,null));};exports['describe']=function(_0x5e5741,_0x1ef4a6){return db['ChatQueueReport'][_0x2e77('0x4a')]()[_0x2e77('0x24')](respondWithResult(_0x1ef4a6,null))['catch'](handleError(_0x1ef4a6,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 78344d5..30d7e78 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 _0x4539=['request-promise','path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','util','../../config/logger','api','moment'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x4539,0x11a));var _0x9453=function(_0x32029a,_0x219ee5){_0x32029a=_0x32029a-0x0;var _0x327e24=_0x4539[_0x32029a];return _0x327e24;};'use strict';var _=require('lodash');var util=require(_0x9453('0x0'));var logger=require(_0x9453('0x1'))(_0x9453('0x2'));var moment=require(_0x9453('0x3'));var BPromise=require('bluebird');var rp=require(_0x9453('0x4'));var fs=require('fs');var path=require(_0x9453('0x5'));var rimraf=require(_0x9453('0x6'));var config=require(_0x9453('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0x9453('0x8')]=function(_0x103516,_0xff0e0e){return _0x103516[_0x9453('0x9')](_0x9453('0xa'),attributes,{'tableName':_0x9453('0xb'),'paranoid':![],'indexes':[{'name':_0x9453('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a9a=['bluebird','path','rimraf','../../config/environment','exports','define','ChatQueueReport','report_chat_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x28cf60,_0x2fe9d9){var _0x2b61e5=function(_0x28b6ba){while(--_0x28b6ba){_0x28cf60['push'](_0x28cf60['shift']());}};_0x2b61e5(++_0x2fe9d9);}(_0x5a9a,0x11a));var _0xa5a9=function(_0x2cc6de,_0x4b0348){_0x2cc6de=_0x2cc6de-0x0;var _0x47a21e=_0x5a9a[_0x2cc6de];return _0x47a21e;};'use strict';var _=require(_0xa5a9('0x0'));var util=require('util');var logger=require(_0xa5a9('0x1'))(_0xa5a9('0x2'));var moment=require(_0xa5a9('0x3'));var BPromise=require(_0xa5a9('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa5a9('0x5'));var rimraf=require(_0xa5a9('0x6'));var config=require(_0xa5a9('0x7'));var attributes=require('./chatQueueReport.attributes');module[_0xa5a9('0x8')]=function(_0x14aa6f,_0x26cc84){return _0x14aa6f[_0xa5a9('0x9')](_0xa5a9('0xa'),attributes,{'tableName':_0xa5a9('0xb'),'paranoid':![],'indexes':[{'name':_0xa5a9('0xc'),'fields':[_0xa5a9('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 c2e64ca..9c6d900 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 _0x7c41=['error','code','message','result','CreateChatQueueReport','ChatQueueReport','create','body','options','raw','UpdateChatQueueReport','where','limit','debug','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x5c6994,_0x19ad9a){var _0x1d5c84=function(_0x4a385a){while(--_0x4a385a){_0x5c6994['push'](_0x5c6994['shift']());}};_0x1d5c84(++_0x19ad9a);}(_0x7c41,0x125));var _0x17c4=function(_0x596ee8,_0x4bcf27){_0x596ee8=_0x596ee8-0x0;var _0x560e00=_0x7c41[_0x596ee8];return _0x560e00;};'use strict';var _=require(_0x17c4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x17c4('0x1'));var rs=require(_0x17c4('0x2'));var fs=require('fs');var Redis=require(_0x17c4('0x3'));var db=require(_0x17c4('0x4'))['db'];var utils=require(_0x17c4('0x5'));var logger=require('../../config/logger')(_0x17c4('0x6'));var config=require(_0x17c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x17c4('0x8')][_0x17c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c312f,_0x5eb7aa,_0xaf15f8){return new BPromise(function(_0x1f70bc,_0x3eaa91){return client[_0x17c4('0xa')](_0x3c312f,_0xaf15f8)[_0x17c4('0xb')](function(_0x560102){logger[_0x17c4('0xc')](_0x17c4('0xd'),_0x5eb7aa,_0x17c4('0xe'));logger['debug'](_0x17c4('0xf'),_0x5eb7aa,_0x17c4('0xe'),JSON[_0x17c4('0x10')](_0x560102));if(_0x560102[_0x17c4('0x11')]){if(_0x560102[_0x17c4('0x11')][_0x17c4('0x12')]===0x1f4){logger[_0x17c4('0x11')]('ChatQueueReport,\x20%s,\x20%s',_0x5eb7aa,_0x560102[_0x17c4('0x11')][_0x17c4('0x13')]);return _0x3eaa91(_0x560102['error'][_0x17c4('0x13')]);}logger[_0x17c4('0x11')](_0x17c4('0xd'),_0x5eb7aa,_0x560102['error']['message']);return _0x1f70bc(_0x560102[_0x17c4('0x11')]['message']);}else{logger[_0x17c4('0xc')](_0x17c4('0xd'),_0x5eb7aa,'request\x20sent');_0x1f70bc(_0x560102[_0x17c4('0x14')][_0x17c4('0x13')]);}})['catch'](function(_0x477e1d){logger[_0x17c4('0x11')](_0x17c4('0xd'),_0x5eb7aa,_0x477e1d);_0x3eaa91(_0x477e1d);});});}exports[_0x17c4('0x15')]=function(_0x165122){var _0x132533=this;return new Promise(function(_0x29973f,_0x155a6b){return db[_0x17c4('0x16')][_0x17c4('0x17')](_0x165122[_0x17c4('0x18')],{'raw':_0x165122[_0x17c4('0x19')]?_0x165122[_0x17c4('0x19')][_0x17c4('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x575a59){logger[_0x17c4('0xc')]('CreateChatQueueReport',_0x165122);logger['debug'](_0x17c4('0x15'),_0x165122,JSON[_0x17c4('0x10')](_0x575a59));_0x29973f(_0x575a59);})['catch'](function(_0x499826){logger['error'](_0x17c4('0x15'),_0x499826[_0x17c4('0x13')],_0x165122);_0x155a6b(_0x132533['error'](0x1f4,_0x499826[_0x17c4('0x13')]));});});};exports[_0x17c4('0x1b')]=function(_0x4e7e10){var _0x359dd7=this;return new Promise(function(_0x1468b6,_0x19238f){return db[_0x17c4('0x16')]['update'](_0x4e7e10[_0x17c4('0x18')],{'raw':_0x4e7e10[_0x17c4('0x19')]?_0x4e7e10[_0x17c4('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4e7e10[_0x17c4('0x19')]?_0x4e7e10[_0x17c4('0x19')][_0x17c4('0x1c')]||null:null,'attributes':_0x4e7e10[_0x17c4('0x19')]?_0x4e7e10['options']['attributes']||null:null,'limit':_0x4e7e10[_0x17c4('0x19')]?_0x4e7e10[_0x17c4('0x19')][_0x17c4('0x1d')]||null:null})[_0x17c4('0xb')](function(_0x3d20c5){logger[_0x17c4('0xc')]('UpdateChatQueueReport',_0x4e7e10);logger[_0x17c4('0x1e')]('UpdateChatQueueReport',_0x4e7e10,JSON[_0x17c4('0x10')](_0x3d20c5));_0x1468b6(_0x3d20c5);})['catch'](function(_0x492b35){logger[_0x17c4('0x11')](_0x17c4('0x1b'),_0x492b35[_0x17c4('0x13')],_0x4e7e10);_0x19238f(_0x359dd7[_0x17c4('0x11')](0x1f4,_0x492b35['message']));});});}; \ No newline at end of file +var _0x95aa=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','stringify','UpdateChatQueueReport','update','limit','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x234cdc,_0x5e14d6){var _0xfe8b6a=function(_0x5c6f6f){while(--_0x5c6f6f){_0x234cdc['push'](_0x234cdc['shift']());}};_0xfe8b6a(++_0x5e14d6);}(_0x95aa,0x123));var _0xa95a=function(_0x4a5494,_0x3ad336){_0x4a5494=_0x4a5494-0x0;var _0x57cbb5=_0x95aa[_0x4a5494];return _0x57cbb5;};'use strict';var _=require(_0xa95a('0x0'));var util=require(_0xa95a('0x1'));var moment=require(_0xa95a('0x2'));var BPromise=require(_0xa95a('0x3'));var rs=require(_0xa95a('0x4'));var fs=require('fs');var Redis=require(_0xa95a('0x5'));var db=require(_0xa95a('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xa95a('0x7'))(_0xa95a('0x8'));var config=require(_0xa95a('0x9'));var jayson=require(_0xa95a('0xa'));var client=jayson[_0xa95a('0xb')][_0xa95a('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x20c619,_0x5ba3d9,_0x1a19ca){return new BPromise(function(_0x3dd883,_0x56aeb0){return client[_0xa95a('0xd')](_0x20c619,_0x1a19ca)[_0xa95a('0xe')](function(_0x165848){logger[_0xa95a('0xf')](_0xa95a('0x10'),_0x5ba3d9,_0xa95a('0x11'));logger[_0xa95a('0x12')]('ChatQueueReport,\x20%s,\x20%s,\x20%s',_0x5ba3d9,_0xa95a('0x11'),JSON['stringify'](_0x165848));if(_0x165848[_0xa95a('0x13')]){if(_0x165848[_0xa95a('0x13')][_0xa95a('0x14')]===0x1f4){logger[_0xa95a('0x13')](_0xa95a('0x10'),_0x5ba3d9,_0x165848[_0xa95a('0x13')][_0xa95a('0x15')]);return _0x56aeb0(_0x165848['error'][_0xa95a('0x15')]);}logger[_0xa95a('0x13')](_0xa95a('0x10'),_0x5ba3d9,_0x165848[_0xa95a('0x13')][_0xa95a('0x15')]);return _0x3dd883(_0x165848[_0xa95a('0x13')]['message']);}else{logger[_0xa95a('0xf')]('ChatQueueReport,\x20%s,\x20%s',_0x5ba3d9,_0xa95a('0x11'));_0x3dd883(_0x165848[_0xa95a('0x16')][_0xa95a('0x15')]);}})[_0xa95a('0x17')](function(_0x1d6d12){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x5ba3d9,_0x1d6d12);_0x56aeb0(_0x1d6d12);});});}exports[_0xa95a('0x18')]=function(_0x1ba4f3){var _0x213dab=this;return new Promise(function(_0x5c9a2c,_0x4887f5){return db[_0xa95a('0x19')]['create'](_0x1ba4f3[_0xa95a('0x1a')],{'raw':_0x1ba4f3[_0xa95a('0x1b')]?_0x1ba4f3['options'][_0xa95a('0x1c')]===undefined?!![]:![]:!![]})[_0xa95a('0xe')](function(_0x348d52){logger[_0xa95a('0xf')](_0xa95a('0x18'),_0x1ba4f3);logger[_0xa95a('0x12')](_0xa95a('0x18'),_0x1ba4f3,JSON[_0xa95a('0x1d')](_0x348d52));_0x5c9a2c(_0x348d52);})[_0xa95a('0x17')](function(_0x579ab2){logger['error'](_0xa95a('0x18'),_0x579ab2[_0xa95a('0x15')],_0x1ba4f3);_0x4887f5(_0x213dab[_0xa95a('0x13')](0x1f4,_0x579ab2[_0xa95a('0x15')]));});});};exports[_0xa95a('0x1e')]=function(_0x1c1eef){var _0x4c77b8=this;return new Promise(function(_0x5d145f,_0x209919){return db[_0xa95a('0x19')][_0xa95a('0x1f')](_0x1c1eef[_0xa95a('0x1a')],{'raw':_0x1c1eef[_0xa95a('0x1b')]?_0x1c1eef['options'][_0xa95a('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1c1eef[_0xa95a('0x1b')]?_0x1c1eef[_0xa95a('0x1b')]['where']||null:null,'attributes':_0x1c1eef['options']?_0x1c1eef[_0xa95a('0x1b')]['attributes']||null:null,'limit':_0x1c1eef[_0xa95a('0x1b')]?_0x1c1eef[_0xa95a('0x1b')][_0xa95a('0x20')]||null:null})[_0xa95a('0xe')](function(_0x53764f){logger['info'](_0xa95a('0x1e'),_0x1c1eef);logger[_0xa95a('0x12')]('UpdateChatQueueReport',_0x1c1eef,JSON[_0xa95a('0x1d')](_0x53764f));_0x5d145f(_0x53764f);})[_0xa95a('0x17')](function(_0x57fe35){logger[_0xa95a('0x13')](_0xa95a('0x1e'),_0x57fe35[_0xa95a('0x15')],_0x1c1eef);_0x209919(_0x4c77b8['error'](0x1f4,_0x57fe35['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index de9869b..e9716d1 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 _0x5d8b=['post','put','delete','destroy','multer','util','connect-timeout','./chatQueueReport.controller','get','index','/describe','isAuthenticated','/:id'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x5d8b,0x1cb));var _0xb5d8=function(_0x2b8571,_0x3b2ee8){_0x2b8571=_0x2b8571-0x0;var _0x4d23a3=_0x5d8b[_0x2b8571];return _0x4d23a3;};'use strict';var multer=require(_0xb5d8('0x0'));var util=require(_0xb5d8('0x1'));var path=require('path');var timeout=require(_0xb5d8('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb5d8('0x3'));router[_0xb5d8('0x4')]('/',auth['isAuthenticated'](),controller[_0xb5d8('0x5')]);router[_0xb5d8('0x4')](_0xb5d8('0x6'),auth[_0xb5d8('0x7')](),controller['describe']);router['get'](_0xb5d8('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xb5d8('0x9')]('/',auth[_0xb5d8('0x7')](),controller['create']);router[_0xb5d8('0xa')](_0xb5d8('0x8'),auth['isAuthenticated'](),controller['update']);router[_0xb5d8('0xb')](_0xb5d8('0x8'),auth['isAuthenticated'](),controller[_0xb5d8('0xc')]);module['exports']=router; \ No newline at end of file +var _0x65a3=['update','destroy','exports','multer','util','path','express','Router','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create'];(function(_0x91b449,_0x3c5762){var _0x572947=function(_0xd63277){while(--_0xd63277){_0x91b449['push'](_0x91b449['shift']());}};_0x572947(++_0x3c5762);}(_0x65a3,0x1f0));var _0x365a=function(_0x4deaea,_0x41b3dd){_0x4deaea=_0x4deaea-0x0;var _0x5c63fd=_0x65a3[_0x4deaea];return _0x5c63fd;};'use strict';var multer=require(_0x365a('0x0'));var util=require(_0x365a('0x1'));var path=require(_0x365a('0x2'));var timeout=require('connect-timeout');var express=require(_0x365a('0x3'));var router=express[_0x365a('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x365a('0x5'));router[_0x365a('0x6')]('/',auth[_0x365a('0x7')](),controller[_0x365a('0x8')]);router[_0x365a('0x6')](_0x365a('0x9'),auth['isAuthenticated'](),controller[_0x365a('0xa')]);router['get'](_0x365a('0xb'),auth[_0x365a('0x7')](),controller[_0x365a('0xc')]);router['post']('/',auth[_0x365a('0x7')](),controller[_0x365a('0xd')]);router['put'](_0x365a('0xb'),auth['isAuthenticated'](),controller[_0x365a('0xe')]);router['delete'](_0x365a('0xb'),auth['isAuthenticated'](),controller[_0x365a('0xf')]);module[_0x365a('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index ed8f395..30ca818 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 _0xe781=['queue','DATE','NOW','moment','sequelize','exports','STRING','ENUM','account'];(function(_0x41582d,_0x291b1c){var _0x59c504=function(_0x4d967e){while(--_0x4d967e){_0x41582d['push'](_0x41582d['shift']());}};_0x59c504(++_0x291b1c);}(_0xe781,0xae));var _0x1e78=function(_0x303bcd,_0x43bf48){_0x303bcd=_0x303bcd-0x0;var _0x3a20ac=_0xe781[_0x303bcd];return _0x3a20ac;};'use strict';var moment=require(_0x1e78('0x0'));var Sequelize=require(_0x1e78('0x1'));module[_0x1e78('0x2')]={'uniqueid':{'type':Sequelize[_0x1e78('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x1e78('0x4')](_0x1e78('0x5'),'agent',_0x1e78('0x6')),'allowNull':![],'defaultValue':_0x1e78('0x6')},'transferredAt':{'type':Sequelize[_0x1e78('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x1e78('0x8')]}}; \ No newline at end of file +var _0x6fa8=['ENUM','account','agent','queue','moment','sequelize','exports','STRING'];(function(_0x3e531a,_0x28a82a){var _0x3c2574=function(_0x4a0c98){while(--_0x4a0c98){_0x3e531a['push'](_0x3e531a['shift']());}};_0x3c2574(++_0x28a82a);}(_0x6fa8,0x184));var _0x86fa=function(_0x32e54a,_0x59fc0d){_0x32e54a=_0x32e54a-0x0;var _0x109af4=_0x6fa8[_0x32e54a];return _0x109af4;};'use strict';var moment=require(_0x86fa('0x0'));var Sequelize=require(_0x86fa('0x1'));module[_0x86fa('0x2')]={'uniqueid':{'type':Sequelize[_0x86fa('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x86fa('0x4')](_0x86fa('0x5'),_0x86fa('0x6'),'queue'),'allowNull':![],'defaultValue':_0x86fa('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index 3ae49c0..23abdd3 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 _0x15d6=['../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','ChatTransferReport','fieldName','type','key','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','filters','filter','merge','VIRTUAL','options','where','count','include','findAll','show','rawAttributes','length','find','create','body','catch','params','describe','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0x15d6,0x192));var _0x615d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x15d6[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x615d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x615d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x615d('0x2'));var moment=require('moment');var BPromise=require(_0x615d('0x3'));var Mustache=require(_0x615d('0x4'));var util=require(_0x615d('0x5'));var path=require(_0x615d('0x6'));var sox=require(_0x615d('0x7'));var csv=require(_0x615d('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x615d('0x9'));var crypto=require(_0x615d('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x615d('0x8'));var querystring=require(_0x615d('0xb'));var Papa=require(_0x615d('0xc'));var Redis=require(_0x615d('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x615d('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x615d('0xf'))(_0x615d('0x10'));var utils=require(_0x615d('0x11'));var config=require(_0x615d('0x12'));var db=require(_0x615d('0x13'))['db'];function respondWithStatusCode(_0x40ecb6,_0x102290){_0x102290=_0x102290||0xcc;return function(_0x297541){if(_0x297541){return _0x40ecb6[_0x615d('0x14')](_0x102290);}return _0x40ecb6[_0x615d('0x15')](_0x102290)[_0x615d('0x16')]();};}function respondWithResult(_0x40711e,_0x4260fb){_0x4260fb=_0x4260fb||0xc8;return function(_0x13e6fc){if(_0x13e6fc){return _0x40711e['status'](_0x4260fb)[_0x615d('0x17')](_0x13e6fc);}};}function respondWithFilteredResult(_0x48bc9b,_0x2e99af){return function(_0x11c93d){if(_0x11c93d){var _0x169141=_0x11c93d['count'],_0x1253e1=_0x2e99af['offset'],_0x1108e8=_0x2e99af[_0x615d('0x18')]+_0x2e99af['limit'],_0x56b30c;if(_0x1108e8>=_0x169141){_0x1108e8=_0x169141;_0x56b30c=0xc8;}else{_0x56b30c=0xce;}_0x48bc9b['status'](_0x56b30c);return _0x48bc9b['set'](_0x615d('0x19'),_0x1253e1+'-'+_0x1108e8+'/'+_0x169141)[_0x615d('0x17')](_0x11c93d);}return null;};}function patchUpdates(_0x55976d){return function(_0x3c29f8){try{jsonpatch[_0x615d('0x1a')](_0x3c29f8,_0x55976d,!![]);}catch(_0x4ad3a7){return BPromise[_0x615d('0x1b')](_0x4ad3a7);}return _0x3c29f8['save']();};}function saveUpdates(_0xa853c8,_0x3a2586){return function(_0x41c3db){if(_0x41c3db){return _0x41c3db[_0x615d('0x1c')](_0xa853c8)[_0x615d('0x1d')](function(_0x261c3d){return _0x261c3d;});}return null;};}function removeEntity(_0x25b008,_0x5963f8){return function(_0x35c5b2){if(_0x35c5b2){return _0x35c5b2[_0x615d('0x1e')]()[_0x615d('0x1d')](function(){_0x25b008['status'](0xcc)[_0x615d('0x16')]();});}};}function handleEntityNotFound(_0x3b1055,_0x574a9d){return function(_0x36b7db){if(!_0x36b7db){_0x3b1055[_0x615d('0x14')](0x194);}return _0x36b7db;};}function handleError(_0x3fc1ba,_0x57294a){_0x57294a=_0x57294a||0x1f4;return function(_0x11f017){logger[_0x615d('0x1f')](_0x11f017[_0x615d('0x20')]);if(_0x11f017[_0x615d('0x21')]){delete _0x11f017[_0x615d('0x21')];}_0x3fc1ba[_0x615d('0x15')](_0x57294a)[_0x615d('0x22')](_0x11f017);};}exports[_0x615d('0x23')]=function(_0xc3008b,_0x2359b6){var _0x2b8e36={},_0x4444f6={},_0x5da926={'count':0x0,'rows':[]};var _0x4b82d6=_[_0x615d('0x24')](db[_0x615d('0x25')]['rawAttributes'],function(_0x139641){return{'name':_0x139641[_0x615d('0x26')],'type':_0x139641[_0x615d('0x27')][_0x615d('0x28')]};});_0x4444f6[_0x615d('0x29')]=_[_0x615d('0x24')](_0x4b82d6,'name');_0x4444f6[_0x615d('0x2a')]=_[_0x615d('0x2b')](_0xc3008b[_0x615d('0x2a')]);_0x4444f6['filters']=_[_0x615d('0x2c')](_0x4444f6[_0x615d('0x29')],_0x4444f6[_0x615d('0x2a')]);_0x2b8e36['attributes']=_[_0x615d('0x2c')](_0x4444f6['model'],qs[_0x615d('0x2d')](_0xc3008b['query'][_0x615d('0x2d')]));_0x2b8e36[_0x615d('0x2e')]=_0x2b8e36[_0x615d('0x2e')]['length']?_0x2b8e36[_0x615d('0x2e')]:_0x4444f6[_0x615d('0x29')];if(!_0xc3008b['query'][_0x615d('0x2f')](_0x615d('0x30'))){_0x2b8e36[_0x615d('0x31')]=qs[_0x615d('0x31')](_0xc3008b['query'][_0x615d('0x31')]);_0x2b8e36['offset']=qs['offset'](_0xc3008b['query'][_0x615d('0x18')]);}_0x2b8e36[_0x615d('0x32')]=qs[_0x615d('0x33')](_0xc3008b[_0x615d('0x2a')][_0x615d('0x33')]);_0x2b8e36['where']=qs[_0x615d('0x34')](_['pick'](_0xc3008b['query'],_0x4444f6[_0x615d('0x34')]));if(_0xc3008b[_0x615d('0x2a')][_0x615d('0x35')]){_0x2b8e36['where']=_[_0x615d('0x36')](_0x2b8e36['where'],{'$or':_[_0x615d('0x24')](_0x4b82d6,function(_0x59952e){if(_0x59952e[_0x615d('0x27')]!==_0x615d('0x37')){var _0x575ef0={};_0x575ef0[_0x59952e[_0x615d('0x21')]]={'$like':'%'+_0xc3008b[_0x615d('0x2a')][_0x615d('0x35')]+'%'};return _0x575ef0;}})});}_0x2b8e36=_[_0x615d('0x36')]({},_0x2b8e36,_0xc3008b[_0x615d('0x38')]);var _0x1c80b5={'where':_0x2b8e36[_0x615d('0x39')]};return db[_0x615d('0x25')][_0x615d('0x3a')](_0x1c80b5)[_0x615d('0x1d')](function(_0xb17584){_0x5da926['count']=_0xb17584;if(_0xc3008b[_0x615d('0x2a')]['includeAll']){_0x2b8e36[_0x615d('0x3b')]=[{'all':!![]}];}return db[_0x615d('0x25')][_0x615d('0x3c')](_0x2b8e36);})[_0x615d('0x1d')](function(_0x3093aa){_0x5da926['rows']=_0x3093aa;return _0x5da926;})[_0x615d('0x1d')](respondWithFilteredResult(_0x2359b6,_0x2b8e36))['catch'](handleError(_0x2359b6,null));};exports[_0x615d('0x3d')]=function(_0x28c1f5,_0x142cb7){var _0x2ed2cf={'raw':!![],'where':{'id':_0x28c1f5['params']['id']}},_0x41818b={};_0x41818b[_0x615d('0x29')]=_[_0x615d('0x2b')](db[_0x615d('0x25')][_0x615d('0x3e')]);_0x41818b[_0x615d('0x2a')]=_[_0x615d('0x2b')](_0x28c1f5[_0x615d('0x2a')]);_0x41818b[_0x615d('0x34')]=_[_0x615d('0x2c')](_0x41818b['model'],_0x41818b[_0x615d('0x2a')]);_0x2ed2cf[_0x615d('0x2e')]=_[_0x615d('0x2c')](_0x41818b['model'],qs[_0x615d('0x2d')](_0x28c1f5[_0x615d('0x2a')][_0x615d('0x2d')]));_0x2ed2cf[_0x615d('0x2e')]=_0x2ed2cf['attributes'][_0x615d('0x3f')]?_0x2ed2cf[_0x615d('0x2e')]:_0x41818b[_0x615d('0x29')];if(_0x28c1f5[_0x615d('0x2a')]['includeAll']){_0x2ed2cf['include']=[{'all':!![]}];}_0x2ed2cf=_[_0x615d('0x36')]({},_0x2ed2cf,_0x28c1f5['options']);return db[_0x615d('0x25')][_0x615d('0x40')](_0x2ed2cf)[_0x615d('0x1d')](handleEntityNotFound(_0x142cb7,null))['then'](respondWithResult(_0x142cb7,null))['catch'](handleError(_0x142cb7,null));};exports[_0x615d('0x41')]=function(_0x558615,_0x17656f){return db['ChatTransferReport'][_0x615d('0x41')](_0x558615[_0x615d('0x42')],{})[_0x615d('0x1d')](respondWithResult(_0x17656f,0xc9))[_0x615d('0x43')](handleError(_0x17656f,null));};exports[_0x615d('0x1c')]=function(_0x56bff0,_0x7b5bcd){if(_0x56bff0['body']['id']){delete _0x56bff0['body']['id'];}return db[_0x615d('0x25')][_0x615d('0x40')]({'where':{'id':_0x56bff0[_0x615d('0x44')]['id']}})['then'](handleEntityNotFound(_0x7b5bcd,null))['then'](saveUpdates(_0x56bff0[_0x615d('0x42')],null))[_0x615d('0x1d')](respondWithResult(_0x7b5bcd,null))[_0x615d('0x43')](handleError(_0x7b5bcd,null));};exports[_0x615d('0x1e')]=function(_0x3041d2,_0x2cec39){return db[_0x615d('0x25')][_0x615d('0x40')]({'where':{'id':_0x3041d2[_0x615d('0x44')]['id']}})[_0x615d('0x1d')](handleEntityNotFound(_0x2cec39,null))[_0x615d('0x1d')](removeEntity(_0x2cec39,null))[_0x615d('0x43')](handleError(_0x2cec39,null));};exports['describe']=function(_0x205b7d,_0x59da71){return db[_0x615d('0x25')][_0x615d('0x45')]()['then'](respondWithResult(_0x59da71,null))[_0x615d('0x43')](handleError(_0x59da71,null));}; \ No newline at end of file +var _0x8c0e=['sendStatus','status','end','json','offset','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','filters','pick','filter','merge','VIRTUAL','options','ChatTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','update','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x8c0e,0x81));var _0xe8c0=function(_0x50bc93,_0x4f0dac){_0x50bc93=_0x50bc93-0x0;var _0x3f2c93=_0x8c0e[_0x50bc93];return _0x3f2c93;};'use strict';var pdf=require(_0xe8c0('0x0'));var emlformat=require(_0xe8c0('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xe8c0('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe8c0('0x3'));var moment=require(_0xe8c0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe8c0('0x5'));var util=require(_0xe8c0('0x6'));var path=require(_0xe8c0('0x7'));var sox=require(_0xe8c0('0x8'));var csv=require(_0xe8c0('0x9'));var ejs=require(_0xe8c0('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe8c0('0xb'));var crypto=require(_0xe8c0('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe8c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0xe8c0('0xe'));var Papa=require(_0xe8c0('0xf'));var Redis=require(_0xe8c0('0x10'));var authService=require(_0xe8c0('0x11'));var qs=require(_0xe8c0('0x12'));var as=require(_0xe8c0('0x13'));var hardwareService=require(_0xe8c0('0x14'));var logger=require('../../config/logger')(_0xe8c0('0x15'));var utils=require(_0xe8c0('0x16'));var config=require(_0xe8c0('0x17'));var db=require(_0xe8c0('0x18'))['db'];function respondWithStatusCode(_0x13f376,_0x7aa30b){_0x7aa30b=_0x7aa30b||0xcc;return function(_0x56ce19){if(_0x56ce19){return _0x13f376[_0xe8c0('0x19')](_0x7aa30b);}return _0x13f376[_0xe8c0('0x1a')](_0x7aa30b)[_0xe8c0('0x1b')]();};}function respondWithResult(_0x369627,_0x586ccd){_0x586ccd=_0x586ccd||0xc8;return function(_0x5dd3f5){if(_0x5dd3f5){return _0x369627['status'](_0x586ccd)[_0xe8c0('0x1c')](_0x5dd3f5);}};}function respondWithFilteredResult(_0x3c1425,_0x326775){return function(_0xa257a){if(_0xa257a){var _0x5722b8=_0xa257a['count'],_0x2db03d=_0x326775[_0xe8c0('0x1d')],_0x1de8c2=_0x326775[_0xe8c0('0x1d')]+_0x326775['limit'],_0x57c9ae;if(_0x1de8c2>=_0x5722b8){_0x1de8c2=_0x5722b8;_0x57c9ae=0xc8;}else{_0x57c9ae=0xce;}_0x3c1425[_0xe8c0('0x1a')](_0x57c9ae);return _0x3c1425[_0xe8c0('0x1e')](_0xe8c0('0x1f'),_0x2db03d+'-'+_0x1de8c2+'/'+_0x5722b8)[_0xe8c0('0x1c')](_0xa257a);}return null;};}function patchUpdates(_0x109ad7){return function(_0x1681bd){try{jsonpatch[_0xe8c0('0x20')](_0x1681bd,_0x109ad7,!![]);}catch(_0x3f4d1e){return BPromise[_0xe8c0('0x21')](_0x3f4d1e);}return _0x1681bd['save']();};}function saveUpdates(_0x12beb7,_0x41702a){return function(_0x25f039){if(_0x25f039){return _0x25f039['update'](_0x12beb7)[_0xe8c0('0x22')](function(_0xae7c5e){return _0xae7c5e;});}return null;};}function removeEntity(_0x16df82,_0x2b12df){return function(_0x56f6f2){if(_0x56f6f2){return _0x56f6f2[_0xe8c0('0x23')]()[_0xe8c0('0x22')](function(){_0x16df82[_0xe8c0('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x214c5a,_0x478ea3){return function(_0x432da0){if(!_0x432da0){_0x214c5a[_0xe8c0('0x19')](0x194);}return _0x432da0;};}function handleError(_0x281b54,_0x462f01){_0x462f01=_0x462f01||0x1f4;return function(_0x20dae7){logger[_0xe8c0('0x24')](_0x20dae7[_0xe8c0('0x25')]);if(_0x20dae7[_0xe8c0('0x26')]){delete _0x20dae7[_0xe8c0('0x26')];}_0x281b54[_0xe8c0('0x1a')](_0x462f01)[_0xe8c0('0x27')](_0x20dae7);};}exports[_0xe8c0('0x28')]=function(_0x257d8f,_0x370dd3){var _0xd8c85={},_0xadaaa={},_0x3bc072={'count':0x0,'rows':[]};var _0x175c2c=_[_0xe8c0('0x29')](db['ChatTransferReport'][_0xe8c0('0x2a')],function(_0x202ed6){return{'name':_0x202ed6[_0xe8c0('0x2b')],'type':_0x202ed6[_0xe8c0('0x2c')][_0xe8c0('0x2d')]};});_0xadaaa[_0xe8c0('0x2e')]=_['map'](_0x175c2c,_0xe8c0('0x26'));_0xadaaa[_0xe8c0('0x2f')]=_['keys'](_0x257d8f[_0xe8c0('0x2f')]);_0xadaaa['filters']=_[_0xe8c0('0x30')](_0xadaaa['model'],_0xadaaa[_0xe8c0('0x2f')]);_0xd8c85[_0xe8c0('0x31')]=_[_0xe8c0('0x30')](_0xadaaa[_0xe8c0('0x2e')],qs['fields'](_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x32')]));_0xd8c85[_0xe8c0('0x31')]=_0xd8c85[_0xe8c0('0x31')][_0xe8c0('0x33')]?_0xd8c85[_0xe8c0('0x31')]:_0xadaaa[_0xe8c0('0x2e')];if(!_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x34')](_0xe8c0('0x35'))){_0xd8c85['limit']=qs[_0xe8c0('0x36')](_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x36')]);_0xd8c85[_0xe8c0('0x1d')]=qs['offset'](_0x257d8f['query']['offset']);}_0xd8c85['order']=qs[_0xe8c0('0x37')](_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x37')]);_0xd8c85[_0xe8c0('0x38')]=qs[_0xe8c0('0x39')](_[_0xe8c0('0x3a')](_0x257d8f['query'],_0xadaaa[_0xe8c0('0x39')]));if(_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x3b')]){_0xd8c85[_0xe8c0('0x38')]=_[_0xe8c0('0x3c')](_0xd8c85[_0xe8c0('0x38')],{'$or':_[_0xe8c0('0x29')](_0x175c2c,function(_0x5eaa73){if(_0x5eaa73['type']!==_0xe8c0('0x3d')){var _0xacdb4e={};_0xacdb4e[_0x5eaa73[_0xe8c0('0x26')]]={'$like':'%'+_0x257d8f['query'][_0xe8c0('0x3b')]+'%'};return _0xacdb4e;}})});}_0xd8c85=_[_0xe8c0('0x3c')]({},_0xd8c85,_0x257d8f[_0xe8c0('0x3e')]);var _0x6248a8={'where':_0xd8c85[_0xe8c0('0x38')]};return db[_0xe8c0('0x3f')]['count'](_0x6248a8)[_0xe8c0('0x22')](function(_0x222bab){_0x3bc072['count']=_0x222bab;if(_0x257d8f[_0xe8c0('0x2f')][_0xe8c0('0x40')]){_0xd8c85[_0xe8c0('0x41')]=[{'all':!![]}];}return db[_0xe8c0('0x3f')][_0xe8c0('0x42')](_0xd8c85);})[_0xe8c0('0x22')](function(_0xd6571e){_0x3bc072[_0xe8c0('0x43')]=_0xd6571e;return _0x3bc072;})['then'](respondWithFilteredResult(_0x370dd3,_0xd8c85))[_0xe8c0('0x44')](handleError(_0x370dd3,null));};exports[_0xe8c0('0x45')]=function(_0x5ca4c7,_0x292cea){var _0xc5336d={'raw':!![],'where':{'id':_0x5ca4c7[_0xe8c0('0x46')]['id']}},_0x1f33d6={};_0x1f33d6[_0xe8c0('0x2e')]=_[_0xe8c0('0x47')](db[_0xe8c0('0x3f')][_0xe8c0('0x2a')]);_0x1f33d6[_0xe8c0('0x2f')]=_[_0xe8c0('0x47')](_0x5ca4c7['query']);_0x1f33d6[_0xe8c0('0x39')]=_['intersection'](_0x1f33d6[_0xe8c0('0x2e')],_0x1f33d6['query']);_0xc5336d[_0xe8c0('0x31')]=_[_0xe8c0('0x30')](_0x1f33d6[_0xe8c0('0x2e')],qs[_0xe8c0('0x32')](_0x5ca4c7['query'][_0xe8c0('0x32')]));_0xc5336d[_0xe8c0('0x31')]=_0xc5336d['attributes'][_0xe8c0('0x33')]?_0xc5336d[_0xe8c0('0x31')]:_0x1f33d6['model'];if(_0x5ca4c7[_0xe8c0('0x2f')][_0xe8c0('0x40')]){_0xc5336d[_0xe8c0('0x41')]=[{'all':!![]}];}_0xc5336d=_[_0xe8c0('0x3c')]({},_0xc5336d,_0x5ca4c7[_0xe8c0('0x3e')]);return db[_0xe8c0('0x3f')][_0xe8c0('0x48')](_0xc5336d)[_0xe8c0('0x22')](handleEntityNotFound(_0x292cea,null))[_0xe8c0('0x22')](respondWithResult(_0x292cea,null))[_0xe8c0('0x44')](handleError(_0x292cea,null));};exports[_0xe8c0('0x49')]=function(_0x3c29a8,_0x740c75){return db[_0xe8c0('0x3f')][_0xe8c0('0x49')](_0x3c29a8[_0xe8c0('0x4a')],{})[_0xe8c0('0x22')](respondWithResult(_0x740c75,0xc9))[_0xe8c0('0x44')](handleError(_0x740c75,null));};exports[_0xe8c0('0x4b')]=function(_0x4516e2,_0x27c102){if(_0x4516e2[_0xe8c0('0x4a')]['id']){delete _0x4516e2[_0xe8c0('0x4a')]['id'];}return db[_0xe8c0('0x3f')][_0xe8c0('0x48')]({'where':{'id':_0x4516e2[_0xe8c0('0x46')]['id']}})[_0xe8c0('0x22')](handleEntityNotFound(_0x27c102,null))[_0xe8c0('0x22')](saveUpdates(_0x4516e2[_0xe8c0('0x4a')],null))[_0xe8c0('0x22')](respondWithResult(_0x27c102,null))[_0xe8c0('0x44')](handleError(_0x27c102,null));};exports[_0xe8c0('0x23')]=function(_0x1aca90,_0x5c9ccc){return db[_0xe8c0('0x3f')]['find']({'where':{'id':_0x1aca90[_0xe8c0('0x46')]['id']}})['then'](handleEntityNotFound(_0x5c9ccc,null))[_0xe8c0('0x22')](removeEntity(_0x5c9ccc,null))[_0xe8c0('0x44')](handleError(_0x5c9ccc,null));};exports[_0xe8c0('0x4c')]=function(_0x3a859a,_0x13721a){return db[_0xe8c0('0x3f')][_0xe8c0('0x4c')]()[_0xe8c0('0x22')](respondWithResult(_0x13721a,null))[_0xe8c0('0x44')](handleError(_0x13721a,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index 457995e..345bf4d 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 _0xb234=['../../config/logger','api','bluebird','path','../../config/environment','./chatTransferReport.attributes','exports','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util'];(function(_0x36e19c,_0x11388b){var _0x5e39eb=function(_0x5c441a){while(--_0x5c441a){_0x36e19c['push'](_0x36e19c['shift']());}};_0x5e39eb(++_0x11388b);}(_0xb234,0x150));var _0x4b23=function(_0x296ed0,_0x5db8ed){_0x296ed0=_0x296ed0-0x0;var _0x4528ae=_0xb234[_0x296ed0];return _0x4528ae;};'use strict';var _=require(_0x4b23('0x0'));var util=require(_0x4b23('0x1'));var logger=require(_0x4b23('0x2'))(_0x4b23('0x3'));var moment=require('moment');var BPromise=require(_0x4b23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4b23('0x5'));var rimraf=require('rimraf');var config=require(_0x4b23('0x6'));var attributes=require(_0x4b23('0x7'));module[_0x4b23('0x8')]=function(_0x12c3dc,_0x4abd0d){return _0x12c3dc[_0x4b23('0x9')](_0x4b23('0xa'),attributes,{'tableName':_0x4b23('0xb'),'paranoid':![],'indexes':[{'name':_0x4b23('0xc'),'fields':[_0x4b23('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3738=['exports','define','ChatTransferReport','report_chat_transfer','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes'];(function(_0x5e8906,_0x18f1e7){var _0x3b6622=function(_0x47ca57){while(--_0x47ca57){_0x5e8906['push'](_0x5e8906['shift']());}};_0x3b6622(++_0x18f1e7);}(_0x3738,0x1e5));var _0x8373=function(_0x15a880,_0x52363b){_0x15a880=_0x15a880-0x0;var _0x414afe=_0x3738[_0x15a880];return _0x414afe;};'use strict';var _=require('lodash');var util=require(_0x8373('0x0'));var logger=require(_0x8373('0x1'))(_0x8373('0x2'));var moment=require(_0x8373('0x3'));var BPromise=require(_0x8373('0x4'));var rp=require(_0x8373('0x5'));var fs=require('fs');var path=require(_0x8373('0x6'));var rimraf=require(_0x8373('0x7'));var config=require(_0x8373('0x8'));var attributes=require(_0x8373('0x9'));module[_0x8373('0xa')]=function(_0x22fdf0,_0x5f3c70){return _0x22fdf0[_0x8373('0xb')](_0x8373('0xc'),attributes,{'tableName':_0x8373('0xd'),'paranoid':![],'indexes':[{'name':_0x8373('0xe'),'fields':[_0x8373('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 208ec98..4b6ed4d 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 _0x1904=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0x1904,0x18a));var _0x4190=function(_0x990992,_0x4888f9){_0x990992=_0x990992-0x0;var _0x184a86=_0x1904[_0x990992];return _0x184a86;};'use strict';var _=require('lodash');var util=require(_0x4190('0x0'));var moment=require('moment');var BPromise=require(_0x4190('0x1'));var rs=require(_0x4190('0x2'));var fs=require('fs');var Redis=require(_0x4190('0x3'));var db=require(_0x4190('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4190('0x5'));var config=require(_0x4190('0x6'));var jayson=require(_0x4190('0x7'));var client=jayson[_0x4190('0x8')][_0x4190('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33e706,_0x29aab2,_0x3c62b3){return new BPromise(function(_0x24916d,_0x743790){return client[_0x4190('0xa')](_0x33e706,_0x3c62b3)[_0x4190('0xb')](function(_0x91d6ea){logger[_0x4190('0xc')](_0x4190('0xd'),_0x29aab2,'request\x20sent');logger[_0x4190('0xe')]('ChatTransferReport,\x20%s,\x20%s,\x20%s',_0x29aab2,_0x4190('0xf'),JSON['stringify'](_0x91d6ea));if(_0x91d6ea[_0x4190('0x10')]){if(_0x91d6ea[_0x4190('0x10')][_0x4190('0x11')]===0x1f4){logger[_0x4190('0x10')](_0x4190('0xd'),_0x29aab2,_0x91d6ea['error']['message']);return _0x743790(_0x91d6ea[_0x4190('0x10')][_0x4190('0x12')]);}logger[_0x4190('0x10')]('ChatTransferReport,\x20%s,\x20%s',_0x29aab2,_0x91d6ea['error'][_0x4190('0x12')]);return _0x24916d(_0x91d6ea[_0x4190('0x10')][_0x4190('0x12')]);}else{logger['info']('ChatTransferReport,\x20%s,\x20%s',_0x29aab2,'request\x20sent');_0x24916d(_0x91d6ea[_0x4190('0x13')][_0x4190('0x12')]);}})[_0x4190('0x14')](function(_0xbc7e4){logger['error'](_0x4190('0xd'),_0x29aab2,_0xbc7e4);_0x743790(_0xbc7e4);});});} \ No newline at end of file +var _0xc35b=['error','message','result','util','moment','randomstring','../../config/logger','rpc','client','http','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x34c6a3,_0x3e1a91){var _0x58fcda=function(_0x104547){while(--_0x104547){_0x34c6a3['push'](_0x34c6a3['shift']());}};_0x58fcda(++_0x3e1a91);}(_0xc35b,0xa3));var _0xbc35=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0xc35b[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require('lodash');var util=require(_0xbc35('0x0'));var moment=require(_0xbc35('0x1'));var BPromise=require('bluebird');var rs=require(_0xbc35('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbc35('0x3'))(_0xbc35('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xbc35('0x5')][_0xbc35('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2db8fd,_0x75ef4d,_0x2ae7b0){return new BPromise(function(_0x51b00b,_0x478893){return client['request'](_0x2db8fd,_0x2ae7b0)[_0xbc35('0x7')](function(_0x590a33){logger[_0xbc35('0x8')](_0xbc35('0x9'),_0x75ef4d,_0xbc35('0xa'));logger['debug'](_0xbc35('0xb'),_0x75ef4d,_0xbc35('0xa'),JSON[_0xbc35('0xc')](_0x590a33));if(_0x590a33[_0xbc35('0xd')]){if(_0x590a33[_0xbc35('0xd')]['code']===0x1f4){logger[_0xbc35('0xd')](_0xbc35('0x9'),_0x75ef4d,_0x590a33[_0xbc35('0xd')]['message']);return _0x478893(_0x590a33['error'][_0xbc35('0xe')]);}logger['error'](_0xbc35('0x9'),_0x75ef4d,_0x590a33[_0xbc35('0xd')]['message']);return _0x51b00b(_0x590a33[_0xbc35('0xd')][_0xbc35('0xe')]);}else{logger[_0xbc35('0x8')](_0xbc35('0x9'),_0x75ef4d,'request\x20sent');_0x51b00b(_0x590a33[_0xbc35('0xf')][_0xbc35('0xe')]);}})['catch'](function(_0x3166f1){logger['error'](_0xbc35('0x9'),_0x75ef4d,_0x3166f1);_0x478893(_0x3166f1);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index a1c09a5..a52d4f3 100644 --- a/server/api/chatTransferReport/index.js +++ b/server/api/chatTransferReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0xf634b7,_0x447d13){var _0x515746=function(_0x58b0be){while(--_0x58b0be){_0xf634b7['push'](_0xf634b7['shift']());}};_0x515746(++_0x447d13);}(_0x5f2f,0x73));var _0xf5f2=function(_0x3d430d,_0x4033f7){_0x3d430d=_0x3d430d-0x0;var _0x256271=_0x5f2f[_0x3d430d];return _0x256271;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./chatTransferReport.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file +var _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(_0x3b4a85,_0x5b9652){var _0x44860c=function(_0x55a8e5){while(--_0x55a8e5){_0x3b4a85['push'](_0x3b4a85['shift']());}};_0x44860c(++_0x5b9652);}(_0x2032,0xd9));var _0x2203=function(_0x387dc0,_0x20e364){_0x387dc0=_0x387dc0-0x0;var _0x1d5551=_0x2032[_0x387dc0];return _0x1d5551;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var auth=require(_0x2203('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2203('0x5'));var controller=require(_0x2203('0x6'));router[_0x2203('0x7')]('/',auth[_0x2203('0x8')](),controller[_0x2203('0x9')]);router[_0x2203('0x7')](_0x2203('0xa'),auth[_0x2203('0x8')](),controller[_0x2203('0xb')]);router[_0x2203('0x7')](_0x2203('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller[_0x2203('0xe')]);router[_0x2203('0xf')](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x10')]);router['delete'](_0x2203('0xc'),auth['isAuthenticated'](),controller[_0x2203('0x11')]);module[_0x2203('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 18ee5f3..7148dbc 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 _0x81be=['#ffffff','BOOLEAN','rounded','squared','Chat','Send','INTEGER','Powered\x20by\x20xCALLY','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20submission\x20error','Type\x20a\x20message','ENUM','star','thumb','stringify','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','offlineForm','generate','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING','address','email','Agent','#9f946a'];(function(_0x31492d,_0x58b627){var _0x105e84=function(_0x5dcf3c){while(--_0x5dcf3c){_0x31492d['push'](_0x31492d['shift']());}};_0x105e84(++_0x58b627);}(_0x81be,0x12e));var _0xe81b=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x81be[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xe81b('0x0')]={'name':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![]},'address':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![],'unique':_0xe81b('0x2')},'description':{'type':Sequelize[_0xe81b('0x1')]},'mapKey':{'type':Sequelize['STRING'],'defaultValue':'email'},'mapKeyOffline':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x3')},'key':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x4')},'customerAlias':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![],'defaultValue':'#9f946a','validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![],'defaultValue':_0xe81b('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xe81b('0x1')],'allowNull':![],'defaultValue':_0xe81b('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0xe81b('0x8'),_0xe81b('0x9')),'defaultValue':_0xe81b('0x8')},'header_online':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'We\x20are\x20here!'},'start_chat_button':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0xa')},'offline_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xe81b('0xb')},'header_offline':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xe81b('0xc')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0xd')},'defaultWhiteLabel':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0xe81b('0xe')]},'closingQuestion':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0xf')},'formSubmitSuccessMessage':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Form\x20properly\x20submitted'},'formSubmitFailureMessage':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x10')},'noteTitle':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x11')},'closingMessage':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0xb')},'skipMessageButton':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xe81b('0x12')](_0xe81b('0x13'),_0xe81b('0x14')),'defaultValue':_0xe81b('0x13')},'ratingStarsNumber':{'type':Sequelize[_0xe81b('0xc')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xe81b('0xe')],'defaultValue':function(){return JSON[_0xe81b('0x15')]({'items':[{'type':'input','variable':null,'config':{'placeholder':_0xe81b('0x16'),'type':_0xe81b('0x17'),'required':!![]},'props':{'title':_0xe81b('0x16'),'helpText':''}},{'type':'input','props':{'title':_0xe81b('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xe81b('0x3'),'type':_0xe81b('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xe81b('0x18')](_0xe81b('0x19'))?JSON[_0xe81b('0x1a')](this[_0xe81b('0x18')]('onlineForm')):{};},'set':function(_0x21d82e){return this[_0xe81b('0x1b')](_0xe81b('0x19'),JSON[_0xe81b('0x15')](_0x21d82e));}},'offlineForm':{'type':Sequelize[_0xe81b('0xe')],'defaultValue':function(){return JSON[_0xe81b('0x15')]({'items':[{'type':'input','props':{'title':_0xe81b('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xe81b('0x3'),'type':_0xe81b('0x3')},'variable':null},{'type':_0xe81b('0x1c'),'config':{'placeholder':_0xe81b('0x1d')},'props':{'title':_0xe81b('0x1d'),'helpText':'Leave\x20your\x20comments'}}],'fromKey':0x0});},'get':function(){return this[_0xe81b('0x18')](_0xe81b('0x1e'))?JSON[_0xe81b('0x1a')](this['getDataValue']('offlineForm')):{};},'set':function(_0x80a907){return this[_0xe81b('0x1b')]('offlineForm',JSON['stringify'](_0x80a907));}},'token':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':function(){return rs[_0xe81b('0x1f')]();}},'autoclose':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xe81b('0x1')]},'waitingTitle':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x20')},'waitingMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe81b('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'New\x20offline\x20message\x20from\x20websiteName'},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xe81b('0x22')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize['STRING'],'defaultValue':_0xe81b('0x23')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xe81b('0x24')},'sendUnmanaged':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xe81b('0x1')]},'notificationTemplate':{'type':Sequelize[_0xe81b('0xe')],'defaultValue':function(){return _0xe81b('0x25');}},'notificationSound':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xe81b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x26')},'verticalAlignment':{'type':Sequelize[_0xe81b('0xc')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x27')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xe81b('0xc')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe81b('0x28'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xe81b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xe81b('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xe81b('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xe81b('0x1')],'defaultValue':_0xe81b('0x29')},'systemAvatar':{'type':Sequelize[_0xe81b('0xe')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xe81b('0xc')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xe81b('0x2a'),'set':function(_0x25819f){if(!_0x25819f)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0xe81b('0x1b')](_0xe81b('0x2b'),_0x25819f);}}}; \ No newline at end of file +var _0x682f=['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.','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','address','email','Agent','#9f946a','#ffffff','INTEGER','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','BOOLEAN','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','star','thumb','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'];(function(_0x21ce26,_0x1e809b){var _0x575fba=function(_0x10104d){while(--_0x10104d){_0x21ce26['push'](_0x21ce26['shift']());}};_0x575fba(++_0x1e809b);}(_0x682f,0xdd));var _0xf682=function(_0x372f0e,_0x52d3a9){_0x372f0e=_0x372f0e-0x0;var _0x55308b=_0x682f[_0x372f0e];return _0x55308b;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf682('0x0'));module[_0xf682('0x1')]={'name':{'type':Sequelize[_0xf682('0x2')],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf682('0x3')},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x4')},'mapKeyOffline':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x4')},'key':{'type':Sequelize[_0xf682('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x5')},'customerAlias':{'type':Sequelize[_0xf682('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf682('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf682('0x2')],'allowNull':![],'defaultValue':_0xf682('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf682('0x2')],'allowNull':![],'defaultValue':_0xf682('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf682('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf682('0x2')]},'animation':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf682('0x9')](_0xf682('0xa'),_0xf682('0xb')),'defaultValue':_0xf682('0xa')},'header_online':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0xc')},'start_chat_button':{'type':Sequelize[_0xf682('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0xd')},'header_offline':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0xe')},'download_transcript':{'type':Sequelize[_0xf682('0xf')],'defaultValue':!![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x10')},'defaultWhiteLabel':{'type':Sequelize[_0xf682('0xf')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x11')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x12')},'formSubmitFailureMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x13')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x14')},'placeholderMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x15')},'closingMessageButton':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0xd')},'skipMessageButton':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x16')},'conditionAgreement':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x17')},'ratingType':{'type':Sequelize[_0xf682('0x9')](_0xf682('0x18'),_0xf682('0x19')),'defaultValue':'star'},'ratingStarsNumber':{'type':Sequelize[_0xf682('0x8')],'defaultValue':0x5},'onlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf682('0x1a')]({'items':[{'type':_0xf682('0x1b'),'variable':null,'config':{'placeholder':_0xf682('0x1c'),'type':_0xf682('0x1d'),'required':!![]},'props':{'title':_0xf682('0x1c'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf682('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf682('0x1e')](_0xf682('0x1f'))?JSON[_0xf682('0x20')](this[_0xf682('0x1e')]('onlineForm')):{};},'set':function(_0x2104b4){return this[_0xf682('0x21')](_0xf682('0x1f'),JSON[_0xf682('0x1a')](_0x2104b4));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0xf682('0x1a')]({'items':[{'type':_0xf682('0x1b'),'props':{'title':_0xf682('0x4'),'helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xf682('0x4')},'variable':null},{'type':_0xf682('0x22'),'config':{'placeholder':_0xf682('0x23')},'props':{'title':'Comments','helpText':_0xf682('0x24')}}],'fromKey':0x0});},'get':function(){return this[_0xf682('0x1e')](_0xf682('0x25'))?JSON[_0xf682('0x20')](this[_0xf682('0x1e')](_0xf682('0x25'))):{};},'set':function(_0x57164a){return this[_0xf682('0x21')]('offlineForm',JSON['stringify'](_0x57164a));}},'token':{'type':Sequelize[_0xf682('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xf682('0xf')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf682('0x2')]},'forwardOffline':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xf682('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x26')},'waitingMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x27')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x28')},'enableUnmanagedNote':{'type':Sequelize[_0xf682('0xf')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x29')},'skipUnmanaged':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x16')},'sendUnmanaged':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0xd')},'enableCustomerAttachment':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'agentAvatar':{'type':Sequelize['TEXT']},'showAgentAvatar':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xf682('0x2a')],'defaultValue':function(){return _0xf682('0x2b');}},'notificationSound':{'type':Sequelize[_0xf682('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x2c')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf682('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0xf682('0x2d')},'verticalAlignment':{'type':Sequelize[_0xf682('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0xf682('0x2')],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xf682('0x2')]},'customerAvatar':{'type':Sequelize[_0xf682('0x2a')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf682('0x8')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xf682('0x2')],'allowNull':![],'defaultValue':_0xf682('0x2e'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xf682('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf682('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf682('0x2')],'defaultValue':_0xf682('0x2f')},'systemAvatar':{'type':Sequelize[_0xf682('0x2a')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf682('0x8')],'comment':_0xf682('0x30')},'mandatoryDisposition':{'type':Sequelize[_0xf682('0xf')],'defaultValue':![],'comment':_0xf682('0x31'),'set':function(_0x1f81c2){if(!_0x1f81c2)this[_0xf682('0x21')](_0xf682('0x32'),null);this['setDataValue'](_0xf682('0x33'),_0x1f81c2);}}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 140310d..766afe1 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 _0x09a0=['../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','message','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','ChatWebsites','UserProfileResource','name','send','index','Pause','ChatWebsite','rawAttributes','fieldName','type','key','model','map','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','mandatoryDispositionPause','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','addDisposition','ChatWebsiteId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.png','../../config/license/util','getLicense','custom','existsSync','server/files/images/logos/','download','getAvatar','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','headers','user-agent','chat','CmContact','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','ChatApplication','account','applications','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','%s\x20%s','unknown','format','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','created','push','close','unmanaged','*,*,*,*','ChatMessage','UserId','User','unshift','waitForTheAssignedAgent','Start','startRouting','EventManager','offline','CompanyId','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','ChatOfflineMessage','MailAccount','MailServerOut','forwardOfflineAddress','Smtp','service','host','port','secure','authentication','auth','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','addInteraction','getInteractions','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','Interval','Intervals','getProactiveActions','License','chatLicenseExceeded','all','some','server/files/chat/iframe.js','x-real-ip','connection','remoteAddress','virtual','replace','alignment','verticalAlignment','textColor','addApplications','sequelize','transaction','bulkCreate','findAndCountAll','getApplications','chatProactiveAction','omit','ChatProactiveAction','getFields','online','offlineForm','items','fromKey','addAgents','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','emit','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x2a2310,_0x2a05a7){var _0x4c6af7=function(_0x3d4a97){while(--_0x3d4a97){_0x2a2310['push'](_0x2a2310['shift']());}};_0x4c6af7(++_0x2a05a7);}(_0x09a0,0x10e));var _0x009a=function(_0xbb87b1,_0x5f00c7){_0xbb87b1=_0xbb87b1-0x0;var _0x4c3889=_0x09a0[_0xbb87b1];return _0x4c3889;};'use strict';var pdf=require(_0x009a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x009a('0x1'));var zipdir=require(_0x009a('0x2'));var jsonpatch=require(_0x009a('0x3'));var rp=require(_0x009a('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x009a('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x009a('0x6'));var ejs=require(_0x009a('0x7'));var fs=require('fs');var _=require(_0x009a('0x8'));var squel=require(_0x009a('0x9'));var crypto=require(_0x009a('0xa'));var jsforce=require(_0x009a('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x009a('0x6'));var querystring=require('querystring');var Papa=require(_0x009a('0xc'));var Redis=require('ioredis');var authService=require(_0x009a('0xd'));var qs=require(_0x009a('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x009a('0xf'));var logger=require(_0x009a('0x10'))(_0x009a('0x11'));var utils=require(_0x009a('0x12'));var config=require(_0x009a('0x13'));var db=require(_0x009a('0x14'))['db'];config[_0x009a('0x15')]=_[_0x009a('0x16')](config[_0x009a('0x15')],{'host':_0x009a('0x17'),'port':0x18eb});var socket=require(_0x009a('0x18'))(new Redis(config[_0x009a('0x15')]));require(_0x009a('0x19'))[_0x009a('0x1a')](socket);var jayson=require(_0x009a('0x1b'));var client=jayson['client'][_0x009a('0x1c')]({'port':0x232c});var client9002=jayson[_0x009a('0x1d')][_0x009a('0x1c')]({'port':0x232a});var client9003=jayson['client'][_0x009a('0x1c')]({'port':0x232b});function checkPasswordPattern(_0x266755,_0x18f4f7,_0x44e524){if(_0x44e524){var _0x41d544=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x41d544[_0x009a('0x1e')](_0x18f4f7)){return _0x266755;}else{throw new db[(_0x009a('0x1f'))][(_0x009a('0x20'))](_0x009a('0x21'));}}else{return _0x266755;}}function respondWithRpcPromise(_0x1095b2,_0x236430,_0x1ab81d,_0x41038f){return new BPromise(function(_0x4fa645,_0x57f18e){var _0x30f624=_0x41038f||client;return _0x30f624['request'](_0x1095b2,_0x1ab81d)[_0x009a('0x22')](function(_0x4adaa0){logger[_0x009a('0x23')](_0x009a('0x24'),_0x236430,_0x009a('0x25'));logger['debug'](_0x009a('0x26'),_0x236430,_0x009a('0x25'),JSON['stringify'](_0x4adaa0));if(_0x4adaa0[_0x009a('0x27')]){if(_0x4adaa0[_0x009a('0x27')]['code']===0x1f4){logger[_0x009a('0x27')](_0x009a('0x24'),_0x236430,_0x4adaa0[_0x009a('0x27')][_0x009a('0x28')]);return _0x57f18e(_0x4adaa0['error']['message']);}logger[_0x009a('0x27')]('ChatWebsite,\x20%s,\x20%s',_0x236430,_0x4adaa0[_0x009a('0x27')][_0x009a('0x28')]);return _0x4fa645(_0x4adaa0[_0x009a('0x27')][_0x009a('0x28')]);}else{logger[_0x009a('0x23')](_0x009a('0x24'),_0x236430,'request\x20sent');_0x4fa645(_0x4adaa0['result'][_0x009a('0x28')]);}})['catch'](function(_0x1d310d){logger['error'](_0x009a('0x24'),_0x236430,_0x1d310d);_0x57f18e(_0x1d310d);});});}function respondWithStatusCode(_0x58747a,_0x438e1e){_0x438e1e=_0x438e1e||0xcc;return function(_0x26d4ba){if(_0x26d4ba){return _0x58747a[_0x009a('0x29')](_0x438e1e);}return _0x58747a[_0x009a('0x2a')](_0x438e1e)[_0x009a('0x2b')]();};}function respondWithResult(_0x27f768,_0x541ece){_0x541ece=_0x541ece||0xc8;return function(_0x3d7b13){if(_0x3d7b13){return _0x27f768[_0x009a('0x2a')](_0x541ece)[_0x009a('0x2c')](_0x3d7b13);}};}function respondWithFilteredResult(_0x12a61c,_0x67142a){return function(_0x2edc49){if(_0x2edc49){var _0x4a6e8e=_0x2edc49[_0x009a('0x2d')],_0x578bbf=_0x67142a[_0x009a('0x2e')],_0x951476=_0x67142a[_0x009a('0x2e')]+_0x67142a[_0x009a('0x2f')],_0xcd7537;if(_0x951476>=_0x4a6e8e){_0x951476=_0x4a6e8e;_0xcd7537=0xc8;}else{_0xcd7537=0xce;}_0x12a61c['status'](_0xcd7537);return _0x12a61c[_0x009a('0x30')](_0x009a('0x31'),_0x578bbf+'-'+_0x951476+'/'+_0x4a6e8e)[_0x009a('0x2c')](_0x2edc49);}return null;};}function patchUpdates(_0x20d945){return function(_0x3042ed){try{jsonpatch[_0x009a('0x32')](_0x3042ed,_0x20d945,!![]);}catch(_0x1cc7a7){return BPromise[_0x009a('0x33')](_0x1cc7a7);}return _0x3042ed[_0x009a('0x34')]();};}function saveUpdates(_0x3cc04e,_0x57dfcd){return function(_0x4b22d8){if(_0x4b22d8){return _0x4b22d8[_0x009a('0x35')](_0x3cc04e)['then'](function(_0x314b1f){return _0x314b1f;});}return null;};}function removeEntity(_0x5d2e2b,_0x3f2f7c){return function(_0x5e8e0b){if(_0x5e8e0b){return _0x5e8e0b[_0x009a('0x36')]()['then'](function(){var _0x30a333=_0x5e8e0b['get']({'plain':!![]});var _0x2fdfbb=_0x009a('0x37');return db[_0x009a('0x38')][_0x009a('0x36')]({'where':{'type':_0x2fdfbb,'resourceId':_0x30a333['id']}})[_0x009a('0x22')](function(){return _0x5e8e0b;});})[_0x009a('0x22')](function(){_0x5d2e2b['status'](0xcc)[_0x009a('0x2b')]();});}};}function handleEntityNotFound(_0x5e6f0d,_0x27a555){return function(_0x10b001){if(!_0x10b001){_0x5e6f0d[_0x009a('0x29')](0x194);}return _0x10b001;};}function handleError(_0x33d5d6,_0x531adc){_0x531adc=_0x531adc||0x1f4;return function(_0x419f8b){logger[_0x009a('0x27')](_0x419f8b['stack']);if(_0x419f8b['name']){delete _0x419f8b[_0x009a('0x39')];}_0x33d5d6['status'](_0x531adc)[_0x009a('0x3a')](_0x419f8b);};}exports[_0x009a('0x3b')]=function(_0x478788,_0x42e546){var _0x3efe67={'include':[{'model':db[_0x009a('0x3c')],'as':'mandatoryDispositionPause'}]},_0x5c139b={},_0x1acec8={'count':0x0,'rows':[]};var _0x4df397=_['map'](db[_0x009a('0x3d')][_0x009a('0x3e')],function(_0x2d27f){return{'name':_0x2d27f[_0x009a('0x3f')],'type':_0x2d27f[_0x009a('0x40')][_0x009a('0x41')]};});_0x5c139b[_0x009a('0x42')]=_[_0x009a('0x43')](_0x4df397,'name');_0x5c139b[_0x009a('0x44')]=_['keys'](_0x478788[_0x009a('0x44')]);_0x5c139b['filters']=_[_0x009a('0x45')](_0x5c139b[_0x009a('0x42')],_0x5c139b[_0x009a('0x44')]);_0x3efe67[_0x009a('0x46')]=_['intersection'](_0x5c139b['model'],qs[_0x009a('0x47')](_0x478788['query']['fields']));_0x3efe67[_0x009a('0x46')]=_0x3efe67[_0x009a('0x46')][_0x009a('0x48')]?_0x3efe67[_0x009a('0x46')]:_0x5c139b[_0x009a('0x42')];if(!_0x478788[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x3efe67[_0x009a('0x2f')]=qs[_0x009a('0x2f')](_0x478788[_0x009a('0x44')][_0x009a('0x2f')]);_0x3efe67[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x478788[_0x009a('0x44')][_0x009a('0x2e')]);}_0x3efe67[_0x009a('0x4b')]=qs[_0x009a('0x4c')](_0x478788[_0x009a('0x44')]['sort']);_0x3efe67[_0x009a('0x4d')]=qs[_0x009a('0x4e')](_[_0x009a('0x4f')](_0x478788[_0x009a('0x44')],_0x5c139b[_0x009a('0x4e')]));if(_0x478788[_0x009a('0x44')][_0x009a('0x50')]){_0x3efe67[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x3efe67['where'],{'$or':_['map'](_0x4df397,function(_0x4116d9){if(_0x4116d9[_0x009a('0x40')]!==_0x009a('0x52')){var _0x29be0e={};_0x29be0e[_0x4116d9[_0x009a('0x39')]]={'$like':'%'+_0x478788[_0x009a('0x44')][_0x009a('0x50')]+'%'};return _0x29be0e;}})});}_0x3efe67=_[_0x009a('0x51')]({},_0x3efe67,_0x478788[_0x009a('0x53')]);var _0xf7a0db={'where':_0x3efe67[_0x009a('0x4d')]};return db[_0x009a('0x3d')]['count'](_0xf7a0db)[_0x009a('0x22')](function(_0x3839a4){_0x1acec8[_0x009a('0x2d')]=_0x3839a4;if(_0x478788[_0x009a('0x44')][_0x009a('0x54')]){_0x3efe67[_0x009a('0x55')]=[{'all':!![]}];}return db[_0x009a('0x3d')][_0x009a('0x56')](_0x3efe67);})[_0x009a('0x22')](function(_0x13a1f5){_0x1acec8[_0x009a('0x57')]=_0x13a1f5;return _0x1acec8;})[_0x009a('0x22')](respondWithFilteredResult(_0x42e546,_0x3efe67))[_0x009a('0x58')](handleError(_0x42e546,null));};exports[_0x009a('0x59')]=function(_0x5cb459,_0x2496de){var _0x453600={'raw':![],'where':{'id':_0x5cb459['params']['id']},'include':[{'model':db[_0x009a('0x3c')],'as':_0x009a('0x5a')}]},_0x1b50dc={};_0x1b50dc[_0x009a('0x42')]=_['keys'](db[_0x009a('0x3d')][_0x009a('0x3e')]);_0x1b50dc[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x5cb459[_0x009a('0x44')]);_0x1b50dc[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x1b50dc[_0x009a('0x42')],_0x1b50dc[_0x009a('0x44')]);_0x453600[_0x009a('0x46')]=_[_0x009a('0x45')](_0x1b50dc[_0x009a('0x42')],qs[_0x009a('0x47')](_0x5cb459[_0x009a('0x44')][_0x009a('0x47')]));_0x453600[_0x009a('0x46')]=_0x453600[_0x009a('0x46')][_0x009a('0x48')]?_0x453600[_0x009a('0x46')]:_0x1b50dc[_0x009a('0x42')];if(_0x5cb459[_0x009a('0x44')][_0x009a('0x54')]){_0x453600[_0x009a('0x55')]=[{'all':!![]}];}_0x453600=_['merge']({},_0x453600,_0x5cb459['options']);return db['ChatWebsite'][_0x009a('0x5c')](_0x453600)[_0x009a('0x22')](handleEntityNotFound(_0x2496de,null))[_0x009a('0x22')](respondWithResult(_0x2496de,null))[_0x009a('0x58')](handleError(_0x2496de,null));};exports['create']=function(_0x4d8cf,_0x588420){return db['ChatWebsite'][_0x009a('0x5d')](_0x4d8cf['body'],{})[_0x009a('0x22')](function(_0x38c646){var _0x221583=_0x4d8cf[_0x009a('0x5e')][_0x009a('0x5f')]({'plain':!![]});if(!_0x221583)throw new Error(_0x009a('0x60'));if(_0x221583[_0x009a('0x61')]===_0x009a('0x5e')){var _0x2f1ad3=_0x38c646[_0x009a('0x5f')]({'plain':!![]});var _0x3a69fe=_0x009a('0x37');return db[_0x009a('0x62')][_0x009a('0x5c')]({'where':{'name':_0x3a69fe,'userProfileId':_0x221583['userProfileId']},'raw':!![]})['then'](function(_0x26505d){if(_0x26505d&&_0x26505d[_0x009a('0x63')]===0x0){return db[_0x009a('0x38')][_0x009a('0x5d')]({'name':_0x2f1ad3['name'],'resourceId':_0x2f1ad3['id'],'type':_0x26505d['name'],'sectionId':_0x26505d['id']},{})[_0x009a('0x22')](function(){return _0x38c646;});}else{return _0x38c646;}})['catch'](function(_0x300fd2){logger['error'](_0x009a('0x64'),_0x300fd2);throw _0x300fd2;});}return _0x38c646;})['then'](respondWithResult(_0x588420,0xc9))[_0x009a('0x58')](handleError(_0x588420,null));};exports['update']=function(_0x4b0d40,_0x1404c5){if(_0x4b0d40[_0x009a('0x65')]['id']){delete _0x4b0d40[_0x009a('0x65')]['id'];}return db['ChatWebsite'][_0x009a('0x5c')]({'where':{'id':_0x4b0d40[_0x009a('0x66')]['id']},'include':[{'model':db[_0x009a('0x3c')],'as':_0x009a('0x5a')}]})['then'](handleEntityNotFound(_0x1404c5,null))[_0x009a('0x22')](saveUpdates(_0x4b0d40[_0x009a('0x65')],null))[_0x009a('0x22')](respondWithResult(_0x1404c5,null))['catch'](handleError(_0x1404c5,null));};exports[_0x009a('0x36')]=function(_0x42e096,_0x5b47a8){return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x42e096['params']['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x5b47a8,null))[_0x009a('0x22')](removeEntity(_0x5b47a8,null))[_0x009a('0x58')](handleError(_0x5b47a8,null));};exports[_0x009a('0x67')]=function(_0x22c655,_0x25ac66){return db[_0x009a('0x3d')][_0x009a('0x67')]()[_0x009a('0x22')](respondWithResult(_0x25ac66,null))[_0x009a('0x58')](handleError(_0x25ac66,null));};exports[_0x009a('0x68')]=function(_0x4a1745,_0x52b17f,_0x354622){if(_0x4a1745['body']['id']){delete _0x4a1745['body']['id'];}return db[_0x009a('0x3d')]['find']({'where':{'id':_0x4a1745[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x52b17f,null))['then'](function(_0x4bacea){if(_0x4bacea){_0x4a1745[_0x009a('0x65')][_0x009a('0x69')]=_0x4bacea['id'];return db[_0x009a('0x6a')][_0x009a('0x5d')](_0x4a1745[_0x009a('0x65')]);}})[_0x009a('0x22')](respondWithResult(_0x52b17f,null))['catch'](handleError(_0x52b17f,null));};exports[_0x009a('0x6b')]=function(_0x997218,_0x3f8fc1,_0x24ed04){var _0x15c807={'raw':![],'where':{}};var _0x2ff7d3={};var _0x1f2ff2={'count':0x0,'rows':[]};return db['ChatWebsite'][_0x009a('0x6c')]({'where':{'id':_0x997218[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x3f8fc1,null))['then'](function(_0x1f4c0c){if(_0x1f4c0c){_0x2ff7d3[_0x009a('0x42')]=_[_0x009a('0x5b')](db[_0x009a('0x6a')][_0x009a('0x3e')]);_0x2ff7d3[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x997218[_0x009a('0x44')]);_0x2ff7d3['filters']=_[_0x009a('0x45')](_0x2ff7d3[_0x009a('0x42')],_0x2ff7d3[_0x009a('0x44')]);_0x15c807[_0x009a('0x46')]=_[_0x009a('0x45')](_0x2ff7d3[_0x009a('0x42')],qs[_0x009a('0x47')](_0x997218['query'][_0x009a('0x47')]));_0x15c807['attributes']=_0x15c807[_0x009a('0x46')][_0x009a('0x48')]?_0x15c807['attributes']:_0x2ff7d3['model'];if(!_0x997218[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x15c807[_0x009a('0x2f')]=qs['limit'](_0x997218['query'][_0x009a('0x2f')]);_0x15c807[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x997218['query'][_0x009a('0x2e')]);}_0x15c807[_0x009a('0x4b')]=qs[_0x009a('0x4c')](_0x997218['query'][_0x009a('0x4c')]);_0x15c807['where']=qs[_0x009a('0x4e')](_['pick'](_0x997218[_0x009a('0x44')],_0x2ff7d3[_0x009a('0x4e')]));_0x15c807[_0x009a('0x4d')][_0x009a('0x69')]=_0x1f4c0c['id'];if(_0x997218['query'][_0x009a('0x50')]){_0x15c807[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x15c807['where'],{'$or':_[_0x009a('0x43')](_0x15c807[_0x009a('0x46')],function(_0x840844){var _0x246e0d={};_0x246e0d[_0x840844]={'$like':'%'+_0x997218[_0x009a('0x44')]['filter']+'%'};return _0x246e0d;})});}_0x15c807=_['merge']({},_0x15c807,_0x997218[_0x009a('0x53')]);return db[_0x009a('0x6a')]['count']({'where':_0x15c807[_0x009a('0x4d')]})['then'](function(_0x131796){_0x1f2ff2[_0x009a('0x2d')]=_0x131796;if(_0x997218['query']['includeAll']){_0x15c807[_0x009a('0x55')]=[{'all':!![]}];}return db[_0x009a('0x6a')][_0x009a('0x56')](_0x15c807);})[_0x009a('0x22')](function(_0x453f3b){_0x1f2ff2[_0x009a('0x57')]=_0x453f3b;return _0x1f2ff2;});}})['then'](respondWithFilteredResult(_0x3f8fc1,_0x15c807))[_0x009a('0x58')](handleError(_0x3f8fc1,null));};exports['removeDispositions']=function(_0x23a9b4,_0x565dd9,_0x21413a){return db[_0x009a('0x3d')]['find']({'where':{'id':_0x23a9b4[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0x565dd9,null))[_0x009a('0x22')](function(_0x10bba5){if(_0x10bba5){return _0x10bba5[_0x009a('0x6d')](_0x23a9b4[_0x009a('0x44')]['ids']);}})['then'](respondWithStatusCode(_0x565dd9,null))[_0x009a('0x58')](handleError(_0x565dd9,null));};exports[_0x009a('0x6e')]=function(_0x66ba52,_0x2ddc69,_0x3f2805){if(_0x66ba52[_0x009a('0x65')]['id']){delete _0x66ba52[_0x009a('0x65')]['id'];}return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x66ba52['params']['id']}})['then'](handleEntityNotFound(_0x2ddc69,null))['then'](function(_0x375622){if(_0x375622){_0x66ba52['body'][_0x009a('0x69')]=_0x375622['id'];return db[_0x009a('0x6f')][_0x009a('0x5d')](_0x66ba52[_0x009a('0x65')]);}})[_0x009a('0x22')](respondWithResult(_0x2ddc69,null))[_0x009a('0x58')](handleError(_0x2ddc69,null));};exports[_0x009a('0x70')]=function(_0x643b50,_0x381a4c,_0x587e11){var _0x275abb={'raw':![],'where':{}};var _0x1ff256={};var _0x1c96cb={'count':0x0,'rows':[]};return db[_0x009a('0x3d')]['findOne']({'where':{'id':_0x643b50[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x381a4c,null))[_0x009a('0x22')](function(_0x161a5d){if(_0x161a5d){_0x1ff256[_0x009a('0x42')]=_['keys'](db['CannedAnswer'][_0x009a('0x3e')]);_0x1ff256[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x643b50[_0x009a('0x44')]);_0x1ff256[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x1ff256['model'],_0x1ff256[_0x009a('0x44')]);_0x275abb['attributes']=_[_0x009a('0x45')](_0x1ff256['model'],qs[_0x009a('0x47')](_0x643b50[_0x009a('0x44')][_0x009a('0x47')]));_0x275abb[_0x009a('0x46')]=_0x275abb[_0x009a('0x46')]['length']?_0x275abb['attributes']:_0x1ff256[_0x009a('0x42')];if(!_0x643b50[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x275abb[_0x009a('0x2f')]=qs['limit'](_0x643b50[_0x009a('0x44')][_0x009a('0x2f')]);_0x275abb[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x643b50['query']['offset']);}_0x275abb[_0x009a('0x4b')]=qs['sort'](_0x643b50[_0x009a('0x44')]['sort']);_0x275abb[_0x009a('0x4d')]=qs[_0x009a('0x4e')](_[_0x009a('0x4f')](_0x643b50[_0x009a('0x44')],_0x1ff256['filters']));_0x275abb[_0x009a('0x4d')]['ChatWebsiteId']=_0x161a5d['id'];if(_0x643b50[_0x009a('0x44')][_0x009a('0x50')]){_0x275abb[_0x009a('0x4d')]=_['merge'](_0x275abb[_0x009a('0x4d')],{'$or':_['map'](_0x275abb['attributes'],function(_0x53bbd1){var _0x112236={};_0x112236[_0x53bbd1]={'$like':'%'+_0x643b50[_0x009a('0x44')]['filter']+'%'};return _0x112236;})});}_0x275abb=_['merge']({},_0x275abb,_0x643b50['options']);return db['CannedAnswer']['count']({'where':_0x275abb[_0x009a('0x4d')]})[_0x009a('0x22')](function(_0x40dbfe){_0x1c96cb['count']=_0x40dbfe;if(_0x643b50[_0x009a('0x44')][_0x009a('0x54')]){_0x275abb['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x275abb);})['then'](function(_0x242172){_0x1c96cb[_0x009a('0x57')]=_0x242172;return _0x1c96cb;});}})['then'](respondWithFilteredResult(_0x381a4c,_0x275abb))[_0x009a('0x58')](handleError(_0x381a4c,null));};exports[_0x009a('0x71')]=function(_0x3e3e65,_0x40bf9e,_0x31a6c9){return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x3e3e65[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x40bf9e,null))[_0x009a('0x22')](function(_0x2f58a6){if(_0x2f58a6){return _0x2f58a6[_0x009a('0x71')](_0x3e3e65[_0x009a('0x44')][_0x009a('0x72')]);}})[_0x009a('0x22')](respondWithStatusCode(_0x40bf9e,null))[_0x009a('0x58')](handleError(_0x40bf9e,null));};exports[_0x009a('0x73')]=function(_0x251423,_0x253341,_0x46761a){_0x251423[_0x009a('0x65')][_0x009a('0x74')]=_0x251423[_0x009a('0x75')][_0x009a('0x76')];return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x251423[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x253341,null))['then'](saveUpdates(_0x251423['body'],null))[_0x009a('0x22')](respondWithResult(_0x253341,null))[_0x009a('0x58')](handleError(_0x253341,null));};exports[_0x009a('0x77')]=function(_0x3034e1,_0x12e9e1,_0x2c1ec6){_0x3034e1[_0x009a('0x65')][_0x009a('0x78')]=_0x3034e1[_0x009a('0x75')][_0x009a('0x76')];return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x3034e1[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x12e9e1,null))['then'](saveUpdates(_0x3034e1[_0x009a('0x65')],null))[_0x009a('0x22')](respondWithResult(_0x12e9e1,null))[_0x009a('0x58')](handleError(_0x12e9e1,null));};exports[_0x009a('0x79')]=function(_0x2b6b3d,_0x10a0f1,_0x1e658c){_0x2b6b3d['body'][_0x009a('0x7a')]=_0x2b6b3d['file'][_0x009a('0x76')];return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x2b6b3d[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0x10a0f1,null))[_0x009a('0x22')](saveUpdates(_0x2b6b3d[_0x009a('0x65')],null))[_0x009a('0x22')](respondWithResult(_0x10a0f1,null))[_0x009a('0x58')](handleError(_0x10a0f1,null));};exports[_0x009a('0x7b')]=function(_0x24d9d8,_0x27380f,_0x2deaf2){_0x24d9d8[_0x009a('0x65')][_0x009a('0x7c')]=_0x24d9d8[_0x009a('0x75')][_0x009a('0x76')];return db['ChatWebsite']['find']({'where':{'id':_0x24d9d8['params']['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x27380f,null))[_0x009a('0x22')](saveUpdates(_0x24d9d8[_0x009a('0x65')],null))[_0x009a('0x22')](respondWithResult(_0x27380f,null))[_0x009a('0x58')](handleError(_0x27380f,null));};exports[_0x009a('0x7d')]=function(_0x53db78,_0x36b967,_0x114cf7){var _0x39b6f0=path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x80'));var _0x78ccb5={'where':{'id':_0x53db78['params']['id']},'attributes':['id','sitepic'],'raw':!![]};var _0x3689cc=![];return require(_0x009a('0x81'))[_0x009a('0x82')]()[_0x009a('0x22')](function(_0xfe8281){if(_0xfe8281){_0x3689cc=_0xfe8281[_0x009a('0x83')];}})[_0x009a('0x22')](function(){return db['ChatWebsite'][_0x009a('0x5c')](_0x78ccb5);})['then'](handleEntityNotFound(_0x36b967,null))[_0x009a('0x22')](function(_0x1f7a16){if(_0x1f7a16){if(!_['isNil'](_0x1f7a16[_0x009a('0x74')])){if(fs[_0x009a('0x84')](path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x85'),_0x1f7a16[_0x009a('0x74')]))&&_0x3689cc){_0x39b6f0=path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x85'),_0x1f7a16[_0x009a('0x74')]);}}return _0x36b967[_0x009a('0x86')](_0x39b6f0);}})[_0x009a('0x58')](handleError(_0x36b967,null));};exports[_0x009a('0x87')]=function(_0x5b842c,_0xe21e50,_0x59051b){var _0x32edc4=path[_0x009a('0x7e')](config[_0x009a('0x7f')],'server/files/images/avatars/default_avatar.png');var _0x5b9166={'where':{'id':_0x5b842c[_0x009a('0x66')]['id']},'attributes':['id',_0x009a('0x78')],'raw':!![]};return db[_0x009a('0x3d')][_0x009a('0x5c')](_0x5b9166)[_0x009a('0x22')](handleEntityNotFound(_0xe21e50,null))[_0x009a('0x22')](function(_0x582111){if(_0x582111){if(!_[_0x009a('0x88')](_0x582111[_0x009a('0x78')])){if(fs[_0x009a('0x84')](path['join'](config[_0x009a('0x7f')],'server/files/images/avatars/',_0x582111[_0x009a('0x78')]))){_0x32edc4=path['join'](config['root'],_0x009a('0x89'),_0x582111[_0x009a('0x78')]);}}return _0xe21e50[_0x009a('0x86')](_0x32edc4);}})[_0x009a('0x58')](handleError(_0xe21e50,null));};exports[_0x009a('0x8a')]=function(_0x226751,_0x5f3c20,_0x4aab4f){var _0x52fc75=path['join'](config[_0x009a('0x7f')],_0x009a('0x8b'));var _0x24830f={'where':{'id':_0x226751['params']['id']},'attributes':['id',_0x009a('0x7a'),_0x009a('0x8c')],'raw':!![]};return db['ChatWebsite'][_0x009a('0x5c')](_0x24830f)[_0x009a('0x22')](handleEntityNotFound(_0x5f3c20,null))[_0x009a('0x22')](function(_0x21f791){if(_0x21f791){if(!_[_0x009a('0x88')](_0x21f791[_0x009a('0x7a')])){if(fs[_0x009a('0x84')](path['join'](config[_0x009a('0x7f')],'server/files/images/avatars/',_0x21f791[_0x009a('0x7a')]))&&_0x21f791[_0x009a('0x8c')]){_0x52fc75=path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x89'),_0x21f791[_0x009a('0x7a')]);}}return _0x5f3c20[_0x009a('0x86')](_0x52fc75);}})[_0x009a('0x58')](handleError(_0x5f3c20,null));};exports[_0x009a('0x8d')]=function(_0x2b85e3,_0x489303,_0x12583a){var _0x345153=path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x8e'));var _0xfe4e5e={'where':{'id':_0x2b85e3[_0x009a('0x66')]['id']},'attributes':['id',_0x009a('0x7c')],'raw':!![]};return db['ChatWebsite'][_0x009a('0x5c')](_0xfe4e5e)['then'](handleEntityNotFound(_0x489303,null))[_0x009a('0x22')](function(_0x5459a4){if(_0x5459a4){if(!_['isNil'](_0x5459a4[_0x009a('0x7c')])){if(fs[_0x009a('0x84')](path['join'](config[_0x009a('0x7f')],_0x009a('0x89'),_0x5459a4[_0x009a('0x7c')]))){_0x345153=path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0x89'),_0x5459a4[_0x009a('0x7c')]);}}return _0x489303[_0x009a('0x86')](_0x345153);}})[_0x009a('0x58')](handleError(_0x489303,null));};exports[_0x009a('0x8f')]=function(_0x24eae8,_0x458d32,_0x3227b5){var _0x14a89b=require(_0x009a('0x90'));var _0x431db7=new _0x14a89b();var _0x26550c=_0x431db7['setUA'](_0x24eae8[_0x009a('0x91')][_0x009a('0x92')])['getResult']();var _0x1dd572={'body':_0x24eae8[_0x009a('0x65')],'channel':_0x009a('0x93')};var _0x1d5164=[];var _0x4f9fa6=[];var _0x55cc1c={};var _0x2ec461=![];return db[_0x009a('0x94')][_0x009a('0x67')]()['then'](function(_0x9603e7){if(!_0x9603e7){throw new db[(_0x009a('0x1f'))][(_0x009a('0x20'))](_0x009a('0x95'));}_0x1d5164=_[_0x009a('0x96')](_[_0x009a('0x5b')](_0x9603e7),['createdAt','updatedAt']);_0x4f9fa6=_[_0x009a('0x96')](_[_0x009a('0x5b')](_0x9603e7),[_0x009a('0x97'),_0x009a('0x98'),'CompanyId',_0x009a('0x99')]);if(_0x24eae8['body']['id']){delete _0x24eae8[_0x009a('0x65')]['id'];}if(_['isNil'](_0x24eae8['body'][_0x009a('0x9a')])){throw new db[(_0x009a('0x1f'))]['ValidationError']('from\x20is\x20mandatory');}if(_[_0x009a('0x88')](_0x24eae8[_0x009a('0x65')][_0x009a('0x65')])||_0x24eae8[_0x009a('0x65')][_0x009a('0x65')]===''){throw new db['Sequelize'][(_0x009a('0x20'))](_0x009a('0x9b'));}if(_[_0x009a('0x88')](_0x24eae8[_0x009a('0x65')][_0x009a('0x9c')])){throw new db[(_0x009a('0x1f'))]['ValidationError'](_0x009a('0x9d')+_0x4f9fa6);}if(!_[_0x009a('0x9e')](_0x4f9fa6,_0x24eae8[_0x009a('0x65')]['mapKey'])){throw new db[(_0x009a('0x1f'))]['ValidationError'](_0x009a('0x9f')+_0x4f9fa6);}_0x55cc1c[_0x24eae8['body']['mapKey']]=_0x24eae8[_0x009a('0x65')][_0x009a('0x9a')];})[_0x009a('0x22')](function(){return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x24eae8['params']['id']},'include':[{'model':db[_0x009a('0xa0')],'as':_0x009a('0xa1'),'include':[{'model':db[_0x009a('0x94')],'as':_0x009a('0xa2'),'where':_0x55cc1c,'limit':0x1,'order':[['updatedAt',_0x009a('0xa3')]]}]},{'model':db[_0x009a('0xa4')],'as':'Applications'}]});})[_0x009a('0x22')](handleEntityNotFound(_0x458d32,null))['then'](function(_0x2260f1){if(_0x2260f1&&_0x2260f1[_0x009a('0xa1')]){_0x1dd572[_0x009a('0xa5')]=_0x2260f1;_0x1dd572['applications']=_0x2260f1['Applications'];_0x1dd572['list']=_0x2260f1[_0x009a('0xa1')];_0x1dd572[_0x009a('0xa6')]=_[_0x009a('0xa7')](_0x1dd572['applications'],[_0x009a('0xa8')],[_0x009a('0xa9')]);if(_0x1dd572['account']['Applications']){delete _0x1dd572[_0x009a('0xa5')]['Applications'];}if(_0x1dd572[_0x009a('0xa5')][_0x009a('0xa1')]&&_0x1dd572[_0x009a('0xa5')]['List'][_0x009a('0xa2')]['length']){return _0x1dd572[_0x009a('0xa5')][_0x009a('0xa1')][_0x009a('0xa2')][0x0];}var _0x571eba=_[_0x009a('0x16')](_0x24eae8[_0x009a('0x65')],{'firstName':_0x24eae8[_0x009a('0x65')]['from'],'ListId':_0x2260f1['ListId']});_0x571eba[_0x24eae8[_0x009a('0x65')]['mapKey']]=_0x24eae8[_0x009a('0x65')][_0x009a('0x9a')];return db['CmContact'][_0x009a('0x5d')](_0x571eba,{'fields':_0x1d5164,'raw':!![]});}})[_0x009a('0x22')](handleEntityNotFound(_0x458d32,null))[_0x009a('0x22')](function(_0x39992f){_0x1dd572[_0x009a('0xaa')]=_0x39992f;var _0x3d79ad=_0x24eae8[_0x009a('0x65')][_0x009a('0xab')];if(_0x24eae8['headers']['cf-connecting-ip']){_0x3d79ad=_0x24eae8[_0x009a('0x91')][_0x009a('0xac')];}else if(_0x24eae8['headers']['x-forwarded-for']){_0x3d79ad=_[_0x009a('0xad')](_0x24eae8[_0x009a('0x91')][_0x009a('0xae')][_0x009a('0xaf')](','));}if(_0x39992f){var _0x4ff220={'ContactId':_0x39992f['id'],'ChatWebsiteId':_0x24eae8[_0x009a('0x66')]['id'],'from':(_0x39992f[_0x009a('0xb0')]||'')+'\x20'+(_0x39992f[_0x009a('0xb1')]||''),'customerIp':_0x3d79ad,'customerPort':_0x24eae8[_0x009a('0x91')][_0x009a('0xb2')]?_0x24eae8[_0x009a('0x91')][_0x009a('0xb2')]:null,'referer':_0x24eae8[_0x009a('0x65')][_0x009a('0xb3')],'browserName':_0x26550c[_0x009a('0xb4')][_0x009a('0x39')]&&_0x26550c[_0x009a('0xb4')][_0x009a('0xb5')]?util['format'](_0x009a('0xb6'),_0x26550c[_0x009a('0xb4')][_0x009a('0x39')],_0x26550c[_0x009a('0xb4')][_0x009a('0xb5')]):'unknown','browserVersion':_0x26550c['browser'][_0x009a('0xb5')]||_0x009a('0xb7'),'osName':util[_0x009a('0xb8')]('%s\x20%s',_0x26550c['os'][_0x009a('0x39')],_0x26550c['os'][_0x009a('0xb5')]),'osVersion':_0x26550c['os'][_0x009a('0xb5')],'deviceModel':_0x26550c[_0x009a('0xb9')][_0x009a('0x42')]&&_0x26550c[_0x009a('0xb9')][_0x009a('0xba')]?util[_0x009a('0xb8')](_0x009a('0xbb'),_0x26550c[_0x009a('0xb9')][_0x009a('0x42')],_0x26550c['device'][_0x009a('0xba')],_0x26550c[_0x009a('0xb9')]['type']):null,'deviceVendor':_0x26550c[_0x009a('0xb9')]['vendor'],'deviceType':_0x26550c[_0x009a('0xb9')][_0x009a('0x40')],'formData':JSON[_0x009a('0xbc')](_0x24eae8['body'])};var _0x53aa8c={'ChatWebsiteId':_0x24eae8[_0x009a('0x66')]['id'],'closed':![]};if(_0x24eae8[_0x009a('0x65')][_0x009a('0xbd')]){_0x53aa8c['threadId']=_0x24eae8[_0x009a('0x65')]['threadId'];return db[_0x009a('0xbe')]['find']({'where':_0x53aa8c})[_0x009a('0x22')](function(_0x13e91c){if(_0x13e91c){return[_0x13e91c,![]];}_0x4ff220[_0x009a('0xbd')]=_0x24eae8[_0x009a('0x65')]['threadId'];_0x4ff220[_0x009a('0xbf')]=_0x24eae8[_0x009a('0x65')][_0x009a('0xbf')];return db[_0x009a('0xbe')][_0x009a('0x5d')](_0x4ff220)[_0x009a('0x22')](function(_0x16ff3e){return[_0x16ff3e,!![]];});});}_0x53aa8c[_0x009a('0xc0')]=_0x39992f['id'];if(_0x24eae8['body'][_0x009a('0xc1')]&&_0x24eae8[_0x009a('0x65')][_0x009a('0xc1')]['id']){_0x53aa8c['id']=_0x24eae8[_0x009a('0x65')][_0x009a('0xc1')]['id'];return db[_0x009a('0xbe')][_0x009a('0x5c')]({'where':_0x53aa8c})[_0x009a('0x22')](function(_0x578f1b){if(_0x578f1b){return[_0x578f1b,![]];}return db[_0x009a('0xbe')][_0x009a('0x5d')](_0x4ff220)[_0x009a('0x22')](function(_0x3d1ae6){return[_0x3d1ae6,!![]];});});}return db['ChatInteraction'][_0x009a('0x5d')](_0x4ff220)[_0x009a('0x22')](function(_0x455f1a){return[_0x455f1a,!![]];});}})[_0x009a('0xc2')](function(_0x16b3ee,_0x2c592d){if(_0x16b3ee){_0x2ec461=_0x2c592d;if(!_0x2c592d){var _0x5ee9b2={'from':(_0x1dd572[_0x009a('0xaa')][_0x009a('0xb0')]||'')+'\x20'+(_0x1dd572['contact'][_0x009a('0xb1')]||'')};if(_0x24eae8[_0x009a('0x65')][_0x009a('0xbd')]&&_0x24eae8['body']['messageId']&&_0x24eae8['body'][_0x009a('0xbd')]!=_0x24eae8[_0x009a('0x65')]['messageId']){_0x5ee9b2[_0x009a('0xbd')]=_0x24eae8[_0x009a('0x65')]['messageId'];}return _0x16b3ee[_0x009a('0x35')](_0x5ee9b2);}else{return _0x16b3ee;}}})[_0x009a('0x22')](function(_0x1240b6){_0x1dd572[_0x009a('0xc1')]=_0x1240b6['get']({'plain':!![]});_0x1dd572['interaction'][_0x009a('0xc3')]=_0x2ec461;if(_0x1dd572[_0x009a('0xc1')]['created']){if(_0x1dd572[_0x009a('0xa5')]['autoclose']){_0x1dd572[_0x009a('0xa6')][_0x009a('0xc4')]({'id':0x0,'priority':_0x1dd572[_0x009a('0xa6')]['length']+0x1,'app':_0x009a('0xc5'),'appdata':_0x009a('0xc6'),'interval':_0x009a('0xc7')});}}return db[_0x009a('0xc8')]['create']({'body':_0x24eae8[_0x009a('0x65')][_0x009a('0x65')],'ChatWebsiteId':_0x24eae8[_0x009a('0x66')]['id'],'ChatInteractionId':_0x1240b6['id'],'direction':'in','ContactId':_0x1dd572[_0x009a('0xaa')]['id'],'AttachmentId':_0x24eae8['body']['AttachmentId']});})[_0x009a('0x22')](function(_0x365359){_0x1dd572['message']=_0x365359;if(_0x1dd572['interaction'][_0x009a('0xc9')]){return db[_0x009a('0xca')][_0x009a('0x5c')]({'attributes':['id',_0x009a('0x39')],'where':{'id':_0x1dd572[_0x009a('0xc1')][_0x009a('0xc9')]}})[_0x009a('0x22')](function(_0x1bc570){if(_0x1bc570){_0x1dd572[_0x009a('0xa6')][_0x009a('0xcb')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x1bc570[_0x009a('0x39')]+','+(_0x1dd572[_0x009a('0xa5')][_0x009a('0xcc')]||0xa),'interval':_0x009a('0xc7')});_0x1dd572['forcedOwnership']=!![];}return respondWithRpcPromise(_0x009a('0xcd'),'startRouting',_0x1dd572);});}return respondWithRpcPromise(_0x009a('0xcd'),_0x009a('0xce'),_0x1dd572);})[_0x009a('0x22')](function(_0x4bc389){respondWithRpcPromise('EventManager',_0x009a('0xcf'),{'event':_0x009a('0x8f'),'message':_0x4bc389},client9002);return _0x4bc389;})['then'](respondWithResult(_0x458d32,null))[_0x009a('0x58')](handleError(_0x458d32,null));};exports[_0x009a('0xd0')]=function(_0x42bd95,_0x3393b9,_0x5e1956){var _0x482b1d,_0x2e666e,_0x9dc0ad;var _0x36abcd=[];var _0x2c3313=[];var _0x4f169e={};return db[_0x009a('0x94')][_0x009a('0x67')]()[_0x009a('0x22')](function(_0x3543fd){if(!_0x3543fd){throw new db[(_0x009a('0x1f'))][(_0x009a('0x20'))](_0x009a('0x95'));}_0x2c3313=_[_0x009a('0x96')](_[_0x009a('0x5b')](_0x3543fd),[_0x009a('0x97'),_0x009a('0x98')]);_0x36abcd=_[_0x009a('0x96')](_['keys'](_0x3543fd),[_0x009a('0x97'),'updatedAt',_0x009a('0xd1'),_0x009a('0x99')]);if(_0x42bd95[_0x009a('0x65')]['id']){delete _0x42bd95[_0x009a('0x65')]['id'];}if(_[_0x009a('0x88')](_0x42bd95[_0x009a('0x65')][_0x009a('0x9a')])){throw _0x3393b9[_0x009a('0x2a')](0x1f4)[_0x009a('0x3a')](new db[(_0x009a('0x1f'))][(_0x009a('0x20'))]('from\x20is\x20mandatory'));}if(_[_0x009a('0x88')](_0x42bd95['body'][_0x009a('0x65')])||_0x42bd95['body'][_0x009a('0x65')]===''){throw _0x3393b9[_0x009a('0x2a')](0x1f4)[_0x009a('0x3a')](new db[(_0x009a('0x1f'))]['ValidationError'](_0x009a('0x9b')));}if(_[_0x009a('0x88')](_0x42bd95['body']['mapKeyOffline'])){throw _0x3393b9[_0x009a('0x2a')](0x1f4)[_0x009a('0x3a')](new db['Sequelize']['ValidationError']('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x36abcd));}if(!_[_0x009a('0x9e')](_0x36abcd,_0x42bd95[_0x009a('0x65')][_0x009a('0xd2')])){throw _0x3393b9[_0x009a('0x2a')](0x1f4)[_0x009a('0x3a')](new db[(_0x009a('0x1f'))][(_0x009a('0x20'))](_0x009a('0xd3')+_0x36abcd));}_0x4f169e[_0x42bd95[_0x009a('0x65')][_0x009a('0xd2')]]=_0x42bd95['body'][_0x009a('0x9a')];})['then'](function(){return db[_0x009a('0x3d')]['find']({'where':{'id':_0x42bd95[_0x009a('0x66')]['id']},'include':[{'model':db['CmList'],'as':_0x009a('0xa1')}]});})[_0x009a('0x22')](handleEntityNotFound(_0x3393b9,null))['then'](function(_0x9f8799){if(_0x9f8799&&_0x9f8799[_0x009a('0xa1')]){_0x2e666e=_0x9f8799;var _0x419097=_['defaults'](_0x42bd95[_0x009a('0x65')],{'firstName':_0x42bd95['body']['from'],'phone':_0x42bd95[_0x009a('0x65')]['from'],'ListId':_0x9f8799[_0x009a('0x99')]});_0x419097[_0x42bd95[_0x009a('0x65')][_0x009a('0xd2')]]=_0x42bd95['body']['from'];return db['CmContact'][_0x009a('0xd4')]({'where':_0x4f169e,'defaults':_0x419097});}})[_0x009a('0xc2')](function(_0x33b8db){if(_0x33b8db){_0x9dc0ad=_0x33b8db;var _0x595466=fs[_0x009a('0xd5')](path[_0x009a('0x7e')](config[_0x009a('0x7f')],_0x009a('0xd6')),_0x009a('0xd7'));var _0x215cb4=ejs[_0x009a('0xd8')](_0x595466,{'body':_['toPairs'](_0x42bd95['body']['body']),'bodyTitle':_0x2e666e[_0x009a('0xd9')]});return db[_0x009a('0xda')][_0x009a('0x5d')]({'body':_0x215cb4,'ContactId':_0x33b8db['id'],'ChatWebsiteId':_0x2e666e['id']});}})[_0x009a('0x22')](function(_0x1491e7){if(_0x1491e7){_0x482b1d=_0x1491e7;return db[_0x009a('0xdb')][_0x009a('0x6c')]({'where':{'service':!![]},'include':[{'model':db[_0x009a('0xdc')],'as':'Smtp','raw':!![]}]});}})[_0x009a('0x22')](function(_0x6cb4e0){if(_0x6cb4e0&&_0x6cb4e0['Smtp']&&_0x2e666e[_0x009a('0xdd')]){var _0x18444f={'tls':{'rejectUnauthorized':![]}};if(_0x6cb4e0[_0x009a('0xde')][_0x009a('0xdf')]){_0x18444f['service']=_0x6cb4e0[_0x009a('0xde')][_0x009a('0xdf')];}else{_0x18444f[_0x009a('0xe0')]=_0x6cb4e0[_0x009a('0xde')][_0x009a('0xe0')];_0x18444f[_0x009a('0xe1')]=_0x6cb4e0[_0x009a('0xde')]['port'];_0x18444f[_0x009a('0xe2')]=_0x6cb4e0[_0x009a('0xde')][_0x009a('0xe2')];}if(_0x6cb4e0[_0x009a('0xde')][_0x009a('0xe3')]){_0x18444f[_0x009a('0xe4')]={'user':_0x6cb4e0[_0x009a('0xde')][_0x009a('0x5e')],'pass':_0x6cb4e0[_0x009a('0xde')][_0x009a('0xe5')]};}return respondWithRpcPromise('SendMail',_0x009a('0xe6'),{'account':_0x18444f,'message':{'from':util[_0x009a('0xb8')](_0x009a('0xe7'),_0x6cb4e0['name'],_0x6cb4e0[_0x009a('0xe8')]||_0x6cb4e0[_0x009a('0xde')][_0x009a('0x5e')]),'to':_0x2e666e[_0x009a('0xdd')],'subject':_0x2e666e[_0x009a('0xe9')],'text':_0x482b1d[_0x009a('0x65')]}},client9003)[_0x009a('0x22')](function(){return _0x482b1d;})['catch'](function(_0xd8b1e8){console[_0x009a('0x27')](_0xd8b1e8);});}})[_0x009a('0x22')](function(){if(_0x482b1d){return _0x482b1d;}})[_0x009a('0x22')](respondWithResult(_0x3393b9,null))[_0x009a('0x58')](handleError(_0x3393b9,null));};exports['addInteraction']=function(_0x1cf5b1,_0x50f69e,_0x116c49){return db[_0x009a('0xbe')][_0x009a('0x5c')]({'where':{'id':_0x1cf5b1[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x50f69e,null))[_0x009a('0x22')](function(_0x5d5c9c){if(_0x5d5c9c){return _0x5d5c9c[_0x009a('0xea')](_0x1cf5b1['body'][_0x009a('0x72')],_['omit'](_0x1cf5b1[_0x009a('0x65')],[_0x009a('0x72'),'id'])||{});}})[_0x009a('0x22')](respondWithResult(_0x50f69e,null))[_0x009a('0x58')](handleError(_0x50f69e,null));};exports[_0x009a('0xeb')]=function(_0x5369e4,_0x3f8d8c,_0xd08679){var _0x340cbd={'raw':![],'where':{}};var _0x23ab6c={};var _0x2cb119={'count':0x0,'rows':[]};return db[_0x009a('0x3d')][_0x009a('0x6c')]({'where':{'id':_0x5369e4[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0x3f8d8c,null))[_0x009a('0x22')](function(_0x13501c){if(_0x13501c){_0x23ab6c[_0x009a('0x42')]=_[_0x009a('0x5b')](db['ChatInteraction'][_0x009a('0x3e')]);_0x23ab6c[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x5369e4[_0x009a('0x44')]);_0x23ab6c[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x23ab6c[_0x009a('0x42')],_0x23ab6c['query']);_0x340cbd[_0x009a('0x46')]=_[_0x009a('0x45')](_0x23ab6c[_0x009a('0x42')],qs['fields'](_0x5369e4[_0x009a('0x44')][_0x009a('0x47')]));_0x340cbd[_0x009a('0x46')]=_0x340cbd[_0x009a('0x46')]['length']?_0x340cbd[_0x009a('0x46')]:_0x23ab6c[_0x009a('0x42')];if(!_0x5369e4[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x340cbd[_0x009a('0x2f')]=qs['limit'](_0x5369e4[_0x009a('0x44')][_0x009a('0x2f')]);_0x340cbd[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x5369e4[_0x009a('0x44')][_0x009a('0x2e')]);}_0x340cbd[_0x009a('0x4b')]=qs[_0x009a('0x4c')](_0x5369e4['query'][_0x009a('0x4c')]);_0x340cbd['where']=qs[_0x009a('0x4e')](_['pick'](_0x5369e4['query'],_0x23ab6c['filters']));_0x340cbd[_0x009a('0x4d')][_0x009a('0x69')]=_0x13501c['id'];if(_0x5369e4[_0x009a('0x44')][_0x009a('0x50')]){_0x340cbd[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x340cbd[_0x009a('0x4d')],{'$or':_[_0x009a('0x43')](_0x340cbd['attributes'],function(_0x41a6e0){var _0x5263fd={};_0x5263fd[_0x41a6e0]={'$like':'%'+_0x5369e4['query'][_0x009a('0x50')]+'%'};return _0x5263fd;})});}_0x340cbd=_[_0x009a('0x51')]({},_0x340cbd,_0x5369e4['options']);return db[_0x009a('0xbe')][_0x009a('0x2d')]({'where':_0x340cbd[_0x009a('0x4d')]})[_0x009a('0x22')](function(_0xcb379e){_0x2cb119[_0x009a('0x2d')]=_0xcb379e;if(_0x5369e4[_0x009a('0x44')][_0x009a('0x54')]){_0x340cbd['include']=[{'model':db[_0x009a('0x94')],'as':'Contact','required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x009a('0x39'),_0x009a('0xec'),'internal'],'required':![]},{'model':db[_0x009a('0xed')],'as':_0x009a('0xee'),'attributes':['id',_0x009a('0x39'),_0x009a('0xef')],'where':_0x5369e4[_0x009a('0x44')]['tag']?{'id':_0x5369e4[_0x009a('0x44')][_0x009a('0xf0')]}:undefined,'required':_0x5369e4['query'][_0x009a('0xf0')]?!![]:![]}];}return db[_0x009a('0xbe')][_0x009a('0x56')](_0x340cbd);})[_0x009a('0x22')](function(_0x5f015d){_0x2cb119[_0x009a('0x57')]=_0x5f015d;return _0x2cb119;});}})[_0x009a('0x22')](respondWithFilteredResult(_0x3f8d8c,_0x340cbd))[_0x009a('0x58')](handleError(_0x3f8d8c,null));};function iftimePromise(_0x379b9e,_0xdd3633){return respondWithRpcPromise(_0x009a('0xf1'),_0x009a('0xf2'),{'command':_0xdd3633[_0x009a('0xf3')]?util[_0x009a('0xb8')](_0x009a('0xf4'),_0x379b9e[_0x009a('0xf5')],_0xdd3633[_0x009a('0xf3')]):util[_0x009a('0xb8')](_0x009a('0xf6'),_0x379b9e['interval'])},client9002)[_0x009a('0x22')](function(_0x1d17ea){var _0x533e6b=_0x1d17ea&&_0x1d17ea[_0x009a('0xf7')](_0x009a('0xf8'))>=0x0?!![]:![];logger[_0x009a('0x23')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0xdd3633['id'],_0x379b9e['id'],_0x379b9e[_0x009a('0xf5')],_0x533e6b?'ONLINE':_0x009a('0xf9'),_0xdd3633[_0x009a('0xf3')]?_0xdd3633['timezone']:_0x009a('0xfa'));return _0x533e6b;})[_0x009a('0x58')](function(_0x1b8415){logger[_0x009a('0x27')](_0x009a('0xfb'),_0xdd3633['id'],_0x379b9e['id'],_0x379b9e['interval'],util[_0x009a('0xfc')](_0x1b8415,{'showHidden':![],'depth':null}),_0xdd3633[_0x009a('0xf3')]?_0xdd3633[_0x009a('0xf3')]:'No\x20timezone');return![];});}exports[_0x009a('0xf2')]=function(_0x72c501,_0x14ebd4,_0x4d4153){var _0x5c3827=0x0;var _0xf4e32f=0x0;var _0x567a74=![];var _0x86c57b;var _0x3a8b21;return db['ChatWebsite'][_0x009a('0x5c')]({'where':{'id':_0x72c501[_0x009a('0x66')]['id']},'include':[{'model':db[_0x009a('0xfd')],'as':_0x009a('0xfd'),'include':[{'model':db[_0x009a('0xfd')],'as':_0x009a('0xfe'),'attributes':['id','interval'],'raw':!![]}]}]})[_0x009a('0x22')](handleEntityNotFound(_0x14ebd4,null))[_0x009a('0x22')](function(_0x1032fa){if(_0x1032fa){_0x86c57b=_0x1032fa;return _0x1032fa[_0x009a('0xff')]({'raw':!![]});}})[_0x009a('0x22')](function(_0x3b42fa){if(_0x86c57b){if(_0x3b42fa){_0x3a8b21=_0x3b42fa;}}return require(_0x009a('0x81'))[_0x009a('0x82')]();})[_0x009a('0x22')](function(_0x3f96fc){if(_0x3f96fc){_0xf4e32f=_0x3f96fc['virtual'];_0x567a74=_0x3f96fc[_0x009a('0x83')];}})[_0x009a('0x22')](function(){return db[_0x009a('0xbe')]['count']({'where':{'closed':![]}});})[_0x009a('0x22')](function(_0x546364){_0x5c3827=_0x546364;if(_0xf4e32f&&_0x546364>_0xf4e32f){return db[_0x009a('0x100')][_0x009a('0x6c')]({'where':{'id':0x1}})[_0x009a('0x22')](function(_0x2a9e45){if(_0x2a9e45){_0x2a9e45['increment'](_0x009a('0x101'));}});}})[_0x009a('0x22')](function(){if(_0x86c57b['Interval']&&_0x86c57b[_0x009a('0xfd')][_0x009a('0xfe')]){var _0x31ee22=[];for(var _0xb61475=0x0;_0xb61475<_0x86c57b[_0x009a('0xfd')][_0x009a('0xfe')][_0x009a('0x48')];_0xb61475++){var _0x158088=_0x86c57b['Interval'][_0x009a('0xfe')][_0xb61475][_0x009a('0x5f')]({'plain':!![]});_0x31ee22[_0x009a('0xc4')](iftimePromise(_0x158088,_0x86c57b));}return BPromise[_0x009a('0x102')](_0x31ee22)[_0x009a('0x22')](function(_0x44956a){return _[_0x009a('0x103')](_0x44956a);});}else{return!![];}})['then'](function(_0x1ff989){var _0x22e459=fs[_0x009a('0xd5')](path['join'](config[_0x009a('0x7f')],_0x009a('0x104')),'utf8');var _0x3d2f6d={'remote':_0x86c57b['remote'],'query':querystring[_0x009a('0xbc')](_[_0x009a('0x51')](_0x86c57b[_0x009a('0x5f')]({'plain':!![]}),{'customerIp':_0x72c501[_0x009a('0x91')][_0x009a('0xae')]||_0x72c501['headers'][_0x009a('0x105')]||_0x72c501[_0x009a('0x106')][_0x009a('0x107')]||_0x72c501['ip'],'referer':_0x72c501[_0x009a('0x91')][_0x009a('0xb3')],'openedInteractions':_0x5c3827,'maxInteractions':_0xf4e32f,'virtual':_0x567a74[_0x009a('0x108')],'online':_0x1ff989,'custom':_0x567a74}))[_0x009a('0x109')](/'/g,'\x5c\x27')};_0x14ebd4[_0x009a('0x3a')](ejs[_0x009a('0xd8')](Mustache[_0x009a('0xd8')](_0x22e459,_0x3d2f6d),{'proactiveActions':_0x3a8b21,'alignment':_0x86c57b[_0x009a('0x10a')],'verticalAlignment':_0x86c57b[_0x009a('0x10b')],'div_color':_0x86c57b['color'],'text_color':_0x86c57b[_0x009a('0x10c')]}));})[_0x009a('0x58')](handleError(_0x14ebd4,null));};exports[_0x009a('0x10d')]=function(_0x56c6e6,_0xf9142a,_0x29e0e0){return db[_0x009a('0x3d')][_0x009a('0x6c')]({'where':{'id':_0x56c6e6[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0xf9142a,null))[_0x009a('0x22')](function(_0x3b7564){if(_0x3b7564){return db[_0x009a('0x10e')][_0x009a('0x10f')](function(_0x3efca9){return db[_0x009a('0xa4')][_0x009a('0x36')]({'where':{'ChatWebsiteId':_0x56c6e6[_0x009a('0x66')]['id']},'transaction':_0x3efca9})[_0x009a('0x22')](function(_0x62d526){var _0x511067=_[_0x009a('0x43')](_0x56c6e6[_0x009a('0x65')],function(_0x11f2fb){_0x11f2fb[_0x009a('0x69')]=_0x56c6e6[_0x009a('0x66')]['id'];return _0x11f2fb;});return db['ChatApplication'][_0x009a('0x110')](_0x511067,{'transaction':_0x3efca9});});})['then'](function(){return db[_0x009a('0xa4')][_0x009a('0x111')]({'where':{'ChatWebsiteId':_0x56c6e6['params']['id']},'order':_0x009a('0xa8')});});}})['then'](respondWithResult(_0xf9142a,null))[_0x009a('0x58')](handleError(_0xf9142a,null));};exports['getApplications']=function(_0x4e1b7b,_0x126e75,_0x32f80b){var _0x2459ce={};var _0x24e3cf={};var _0x3fa628;var _0x45bea7;return db['ChatWebsite']['findOne']({'where':{'id':_0x4e1b7b[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x126e75,null))['then'](function(_0x1a9683){if(_0x1a9683){_0x3fa628=_0x1a9683;_0x24e3cf[_0x009a('0x42')]=_[_0x009a('0x5b')](db[_0x009a('0xa4')]['rawAttributes']);_0x24e3cf[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x4e1b7b[_0x009a('0x44')]);_0x24e3cf['filters']=_['intersection'](_0x24e3cf[_0x009a('0x42')],_0x24e3cf[_0x009a('0x44')]);_0x2459ce[_0x009a('0x46')]=_['intersection'](_0x24e3cf[_0x009a('0x42')],qs['fields'](_0x4e1b7b[_0x009a('0x44')][_0x009a('0x47')]));_0x2459ce[_0x009a('0x46')]=_0x2459ce['attributes']['length']?_0x2459ce[_0x009a('0x46')]:_0x24e3cf[_0x009a('0x42')];_0x2459ce['order']=qs['sort'](_0x4e1b7b[_0x009a('0x44')][_0x009a('0x4c')]);_0x2459ce[_0x009a('0x4d')]=qs[_0x009a('0x4e')](_[_0x009a('0x4f')](_0x4e1b7b[_0x009a('0x44')],_0x24e3cf[_0x009a('0x4e')]));if(_0x4e1b7b[_0x009a('0x44')][_0x009a('0x50')]){_0x2459ce[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x2459ce['where'],{'$or':_['map'](_0x2459ce[_0x009a('0x46')],function(_0x9e37fc){var _0x4e510a={};_0x4e510a[_0x9e37fc]={'$like':'%'+_0x4e1b7b[_0x009a('0x44')]['filter']+'%'};return _0x4e510a;})});}_0x2459ce=_[_0x009a('0x51')]({},_0x2459ce,_0x4e1b7b[_0x009a('0x53')]);return _0x3fa628[_0x009a('0x112')](_0x2459ce);}})[_0x009a('0x22')](function(_0x2f9536){if(_0x2f9536){_0x45bea7=_0x2f9536[_0x009a('0x48')];if(!_0x4e1b7b['query'][_0x009a('0x49')]('nolimit')){_0x2459ce[_0x009a('0x2f')]=qs['limit'](_0x4e1b7b['query'][_0x009a('0x2f')]);_0x2459ce[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x4e1b7b['query'][_0x009a('0x2e')]);}return _0x3fa628[_0x009a('0x112')](_0x2459ce);}})[_0x009a('0x22')](function(_0x5176bf){if(_0x5176bf){return _0x5176bf?{'count':_0x45bea7,'rows':_0x5176bf}:null;}})['then'](respondWithResult(_0x126e75,null))['catch'](handleError(_0x126e75,null));};exports['addProactiveActions']=function(_0x2ede90,_0x2e5f13,_0x4f0ccd){return db[_0x009a('0x113')][_0x009a('0x5c')]({'where':{'id':_0x2ede90[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x2e5f13,null))['then'](function(_0x8d3bb){if(_0x8d3bb){return _0x8d3bb['addProactiveActions'](_0x2ede90['body']['ids'],_[_0x009a('0x114')](_0x2ede90['body'],[_0x009a('0x72'),'id'])||{});}})['then'](respondWithResult(_0x2e5f13,null))[_0x009a('0x58')](handleError(_0x2e5f13,null));};exports[_0x009a('0xff')]=function(_0x562ee2,_0x3e1e3b,_0x289e07){var _0x4af020={};var _0x331178={};var _0x943ff;var _0x63ae43;return db['ChatWebsite'][_0x009a('0x6c')]({'where':{'id':_0x562ee2[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0x3e1e3b,null))[_0x009a('0x22')](function(_0x25b043){if(_0x25b043){_0x943ff=_0x25b043;_0x331178['model']=_[_0x009a('0x5b')](db[_0x009a('0x115')][_0x009a('0x3e')]);_0x331178[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x562ee2[_0x009a('0x44')]);_0x331178[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x331178[_0x009a('0x42')],_0x331178[_0x009a('0x44')]);_0x4af020[_0x009a('0x46')]=_[_0x009a('0x45')](_0x331178['model'],qs['fields'](_0x562ee2[_0x009a('0x44')][_0x009a('0x47')]));_0x4af020[_0x009a('0x46')]=_0x4af020[_0x009a('0x46')][_0x009a('0x48')]?_0x4af020['attributes']:_0x331178[_0x009a('0x42')];_0x4af020[_0x009a('0x4b')]=qs[_0x009a('0x4c')](_0x562ee2[_0x009a('0x44')][_0x009a('0x4c')]);_0x4af020[_0x009a('0x4d')]=qs[_0x009a('0x4e')](_['pick'](_0x562ee2['query'],_0x331178[_0x009a('0x4e')]));if(_0x562ee2[_0x009a('0x44')][_0x009a('0x50')]){_0x4af020[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x4af020[_0x009a('0x4d')],{'$or':_[_0x009a('0x43')](_0x4af020[_0x009a('0x46')],function(_0x35becc){var _0x4280ed={};_0x4280ed[_0x35becc]={'$like':'%'+_0x562ee2[_0x009a('0x44')]['filter']+'%'};return _0x4280ed;})});}_0x4af020=_[_0x009a('0x51')]({},_0x4af020,_0x562ee2[_0x009a('0x53')]);return _0x943ff[_0x009a('0xff')](_0x4af020);}})[_0x009a('0x22')](function(_0x21bc3d){if(_0x21bc3d){_0x63ae43=_0x21bc3d[_0x009a('0x48')];if(!_0x562ee2[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x4af020[_0x009a('0x2f')]=qs[_0x009a('0x2f')](_0x562ee2['query']['limit']);_0x4af020['offset']=qs['offset'](_0x562ee2[_0x009a('0x44')][_0x009a('0x2e')]);}return _0x943ff[_0x009a('0xff')](_0x4af020);}})[_0x009a('0x22')](function(_0xc5551e){if(_0xc5551e){return _0xc5551e?{'count':_0x63ae43,'rows':_0xc5551e}:null;}})[_0x009a('0x22')](respondWithResult(_0x3e1e3b,null))['catch'](handleError(_0x3e1e3b,null));};exports[_0x009a('0x116')]=function(_0x8f6880,_0x4cae2a,_0x1cf7ae){var _0x37d7c8=_0x8f6880[_0x009a('0x44')][_0x009a('0x117')]==='false'?_0x009a('0x118'):'onlineForm';return db[_0x009a('0x3d')][_0x009a('0x5c')]({'attributes':['id',_0x37d7c8],'where':{'id':_0x8f6880[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x4cae2a,null))[_0x009a('0x22')](function(_0x33960d){if(_0x33960d){var _0x2c3f33=_0x33960d[_0x37d7c8];var _0x5e8afd=_0x2c3f33&&_0x2c3f33[_0x009a('0x119')]?_0x2c3f33[_0x009a('0x119')]:[];_0x4cae2a[_0x009a('0x3a')]({'fromKey':_['isNil'](_0x2c3f33[_0x009a('0x11a')])?undefined:_0x2c3f33[_0x009a('0x11a')],'count':_0x5e8afd['length'],'rows':_0x5e8afd});}})[_0x009a('0x58')](handleError(_0x4cae2a,null));};exports['getOfflineMessages']=function(_0x2b09f2,_0x353aab,_0x2f9d4a){var _0x329fea={'raw':![],'where':{}};var _0x2b5e20={};var _0x573db6={'count':0x0,'rows':[]};return db[_0x009a('0x3d')][_0x009a('0x6c')]({'where':{'id':_0x2b09f2[_0x009a('0x66')]['id']}})['then'](handleEntityNotFound(_0x353aab,null))[_0x009a('0x22')](function(_0xb29eda){if(_0xb29eda){_0x2b5e20[_0x009a('0x42')]=_[_0x009a('0x5b')](db[_0x009a('0xda')]['rawAttributes']);_0x2b5e20[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x2b09f2['query']);_0x2b5e20[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x2b5e20[_0x009a('0x42')],_0x2b5e20[_0x009a('0x44')]);_0x329fea['attributes']=_['intersection'](_0x2b5e20[_0x009a('0x42')],qs['fields'](_0x2b09f2[_0x009a('0x44')][_0x009a('0x47')]));_0x329fea[_0x009a('0x46')]=_0x329fea[_0x009a('0x46')][_0x009a('0x48')]?_0x329fea['attributes']:_0x2b5e20[_0x009a('0x42')];if(!_0x2b09f2[_0x009a('0x44')]['hasOwnProperty'](_0x009a('0x4a'))){_0x329fea[_0x009a('0x2f')]=qs[_0x009a('0x2f')](_0x2b09f2[_0x009a('0x44')]['limit']);_0x329fea[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x2b09f2[_0x009a('0x44')][_0x009a('0x2e')]);}_0x329fea['order']=qs[_0x009a('0x4c')](_0x2b09f2[_0x009a('0x44')][_0x009a('0x4c')]);_0x329fea[_0x009a('0x4d')]=qs['filters'](_[_0x009a('0x4f')](_0x2b09f2[_0x009a('0x44')],_0x2b5e20[_0x009a('0x4e')]));_0x329fea[_0x009a('0x4d')][_0x009a('0x69')]=_0xb29eda['id'];if(_0x2b09f2[_0x009a('0x44')][_0x009a('0x50')]){_0x329fea[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x329fea['where'],{'$or':_['map'](_0x329fea[_0x009a('0x46')],function(_0x37aaf0){var _0x4e4b6c={};_0x4e4b6c[_0x37aaf0]={'$like':'%'+_0x2b09f2['query'][_0x009a('0x50')]+'%'};return _0x4e4b6c;})});}_0x329fea=_[_0x009a('0x51')]({},_0x329fea,_0x2b09f2[_0x009a('0x53')]);return db[_0x009a('0xda')][_0x009a('0x2d')]({'where':_0x329fea[_0x009a('0x4d')]})[_0x009a('0x22')](function(_0x45d520){_0x573db6[_0x009a('0x2d')]=_0x45d520;if(_0x2b09f2[_0x009a('0x44')][_0x009a('0x54')]){_0x329fea[_0x009a('0x55')]=[{'all':!![]}];}else{_0x329fea[_0x009a('0x55')]=[{'model':db['CmContact'],'as':'Contact','required':![]}];}return db[_0x009a('0xda')][_0x009a('0x56')](_0x329fea);})[_0x009a('0x22')](function(_0x1ac7da){_0x573db6[_0x009a('0x57')]=_0x1ac7da;return _0x573db6;});}})[_0x009a('0x22')](respondWithFilteredResult(_0x353aab,_0x329fea))['catch'](handleError(_0x353aab,null));};exports[_0x009a('0x11b')]=function(_0x593a33,_0x36d288,_0x2f3348){return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x593a33[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x36d288,null))[_0x009a('0x22')](function(_0x24bc78){if(_0x24bc78){return _0x24bc78['addAgents'](_0x593a33[_0x009a('0x65')][_0x009a('0x72')],_[_0x009a('0x114')](_0x593a33[_0x009a('0x65')],[_0x009a('0x72'),'id'])||{})['spread'](function(_0x2bcf25){for(var _0x11662a=0x0;_0x11662a<_0x593a33[_0x009a('0x65')][_0x009a('0x72')][_0x009a('0x48')];_0x11662a+=0x1){socket['emit'](_0x009a('0x11c'),{'UserId':_0x593a33[_0x009a('0x65')][_0x009a('0x72')][_0x11662a],'ChatWebsiteId':_0x593a33['params']['id']});}return _0x2bcf25;});}})[_0x009a('0x22')](respondWithResult(_0x36d288,null))[_0x009a('0x58')](handleError(_0x36d288,null));};exports[_0x009a('0x11d')]=function(_0x3cca0a,_0x210244,_0x248a6a){return db[_0x009a('0x3d')][_0x009a('0x5c')]({'where':{'id':_0x3cca0a[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x210244,null))['then'](function(_0x3bbe7d){if(_0x3bbe7d){return _0x3bbe7d[_0x009a('0x11d')](_0x3cca0a['query'][_0x009a('0x72')])[_0x009a('0x22')](function(){if(_[_0x009a('0x11e')](_0x3cca0a['query']['ids'])){for(var _0x4f9782=0x0;_0x4f9782<_0x3cca0a[_0x009a('0x44')]['ids']['length'];_0x4f9782+=0x1){socket['emit'](_0x009a('0x11f'),{'UserId':Number(_0x3cca0a[_0x009a('0x44')][_0x009a('0x72')][_0x4f9782]),'ChatWebsiteId':Number(_0x3cca0a[_0x009a('0x66')]['id'])});}}else{socket[_0x009a('0x120')](_0x009a('0x11f'),{'UserId':Number(_0x3cca0a[_0x009a('0x44')][_0x009a('0x72')]),'ChatWebsiteId':Number(_0x3cca0a[_0x009a('0x66')]['id'])});}});}})[_0x009a('0x22')](respondWithStatusCode(_0x210244,null))[_0x009a('0x58')](handleError(_0x210244,null));};exports[_0x009a('0x121')]=function(_0x1be596,_0x11e559,_0x308a0b){var _0x1738ba={};var _0x5cf97e={};var _0xee6027;var _0x29456e;return db[_0x009a('0x3d')][_0x009a('0x6c')]({'where':{'id':_0x1be596[_0x009a('0x66')]['id']}})[_0x009a('0x22')](handleEntityNotFound(_0x11e559,null))[_0x009a('0x22')](function(_0x3fd4d9){if(_0x3fd4d9){_0xee6027=_0x3fd4d9;_0x5cf97e[_0x009a('0x42')]=_[_0x009a('0x5b')](db[_0x009a('0xca')][_0x009a('0x3e')]);_0x5cf97e[_0x009a('0x44')]=_[_0x009a('0x5b')](_0x1be596['query']);_0x5cf97e[_0x009a('0x4e')]=_[_0x009a('0x45')](_0x5cf97e[_0x009a('0x42')],_0x5cf97e[_0x009a('0x44')]);_0x1738ba[_0x009a('0x46')]=_[_0x009a('0x45')](_0x5cf97e[_0x009a('0x42')],qs['fields'](_0x1be596[_0x009a('0x44')][_0x009a('0x47')]));_0x1738ba[_0x009a('0x46')]=_0x1738ba['attributes'][_0x009a('0x48')]?_0x1738ba[_0x009a('0x46')]:_0x5cf97e['model'];_0x1738ba[_0x009a('0x4b')]=qs[_0x009a('0x4c')](_0x1be596[_0x009a('0x44')]['sort']);_0x1738ba['where']=qs['filters'](_[_0x009a('0x4f')](_0x1be596[_0x009a('0x44')],_0x5cf97e['filters']));if(_0x1be596[_0x009a('0x44')]['filter']){_0x1738ba[_0x009a('0x4d')]=_[_0x009a('0x51')](_0x1738ba[_0x009a('0x4d')],{'$or':_[_0x009a('0x43')](_0x1738ba['attributes'],function(_0x5bfac4){var _0x381c73={};_0x381c73[_0x5bfac4]={'$like':'%'+_0x1be596[_0x009a('0x44')]['filter']+'%'};return _0x381c73;})});}_0x1738ba=_[_0x009a('0x51')]({},_0x1738ba,_0x1be596[_0x009a('0x53')]);return _0xee6027['getAgents'](_0x1738ba);}})[_0x009a('0x22')](function(_0x302a06){if(_0x302a06){_0x29456e=_0x302a06[_0x009a('0x48')];if(!_0x1be596[_0x009a('0x44')][_0x009a('0x49')](_0x009a('0x4a'))){_0x1738ba['limit']=qs[_0x009a('0x2f')](_0x1be596[_0x009a('0x44')]['limit']);_0x1738ba[_0x009a('0x2e')]=qs[_0x009a('0x2e')](_0x1be596['query'][_0x009a('0x2e')]);}return _0xee6027[_0x009a('0x121')](_0x1738ba);}})[_0x009a('0x22')](function(_0x51ea22){if(_0x51ea22){return _0x51ea22?{'count':_0x29456e,'rows':_0x51ea22}:null;}})[_0x009a('0x22')](respondWithResult(_0x11e559,null))[_0x009a('0x58')](handleError(_0x11e559,null));}; \ No newline at end of file +var _0xb168=['threadId','externalUrl','ChatInteraction','interaction','contact','lastName','messageId','created','autoclose','push','unmanaged','*,*,*,*','UserId','User','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','EventManager','offline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','spread','server/files/templates/chatOfflineMessage.ejs','utf8','render','toPairs','MailAccount','MailServerOut','Smtp','forwardOfflineAddress','service','host','port','secure','authentication','auth','pass','SendMail','email','omit','getInteractions','Contact','Tag','tag','Command','getSnippet','timezone','iftime\x20%s,%s','interval','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','Interval','getProactiveActions','getLicense','virtual','License','chatLicenseExceeded','Intervals','all','some','readFileSync','server/files/chat/iframe.js','connection','replace','alignment','verticalAlignment','color','textColor','addApplications','sequelize','transaction','ChatApplication','bulkCreate','findAndCountAll','addProactiveActions','chatProactiveAction','getFields','online','offlineForm','onlineForm','fromKey','getOfflineMessages','ChatOfflineMessage','addAgents','emit','userChatWebsite:save','removeAgents','isArray','userChatWebsite:remove','getAgents','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','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','http','client','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','json','offset','limit','set','apply','reject','save','update','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','send','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','key','query','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','findAll','rows','params','keys','include','create','body','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','addDisposition','Disposition','getDispositions','ChatWebsiteId','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','server/files/images/logos/default_logo.png','../../config/license/util','custom','isNil','existsSync','join','root','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','headers','user-agent','getResult','chat','CmContact','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','Contacts','DESC','Applications','List','account','applications','list','orderBy','priority','asc','defaults','customerIp','cf-connecting-ip','x-forwarded-for','first','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','%s\x20%s\x20%s','vendor'];(function(_0x3e4419,_0x454b62){var _0x218914=function(_0x5d7eff){while(--_0x5d7eff){_0x3e4419['push'](_0x3e4419['shift']());}};_0x218914(++_0x454b62);}(_0xb168,0x17b));var _0x8b16=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xb168[_0x1beef3];return _0x5af964;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x8b16('0x0'));var zipdir=require(_0x8b16('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8b16('0x2'));var moment=require('moment');var BPromise=require(_0x8b16('0x3'));var Mustache=require(_0x8b16('0x4'));var util=require(_0x8b16('0x5'));var path=require('path');var sox=require(_0x8b16('0x6'));var csv=require(_0x8b16('0x7'));var ejs=require(_0x8b16('0x8'));var fs=require('fs');var _=require(_0x8b16('0x9'));var squel=require(_0x8b16('0xa'));var crypto=require('crypto');var jsforce=require(_0x8b16('0xb'));var deskjs=require(_0x8b16('0xc'));var toCsv=require(_0x8b16('0x7'));var querystring=require(_0x8b16('0xd'));var Papa=require(_0x8b16('0xe'));var Redis=require(_0x8b16('0xf'));var authService=require(_0x8b16('0x10'));var qs=require(_0x8b16('0x11'));var as=require(_0x8b16('0x12'));var hardwareService=require(_0x8b16('0x13'));var logger=require(_0x8b16('0x14'))(_0x8b16('0x15'));var utils=require(_0x8b16('0x16'));var config=require('../../config/environment');var db=require(_0x8b16('0x17'))['db'];config[_0x8b16('0x18')]=_['defaults'](config[_0x8b16('0x18')],{'host':_0x8b16('0x19'),'port':0x18eb});var socket=require(_0x8b16('0x1a'))(new Redis(config[_0x8b16('0x18')]));require('./chatWebsite.socket')[_0x8b16('0x1b')](socket);var jayson=require(_0x8b16('0x1c'));var client=jayson['client'][_0x8b16('0x1d')]({'port':0x232c});var client9002=jayson[_0x8b16('0x1e')][_0x8b16('0x1d')]({'port':0x232a});var client9003=jayson[_0x8b16('0x1e')][_0x8b16('0x1d')]({'port':0x232b});function checkPasswordPattern(_0x258112,_0x55cec2,_0x2c0b81){if(_0x2c0b81){var _0x326612=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x326612['test'](_0x55cec2)){return _0x258112;}else{throw new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))](_0x8b16('0x21'));}}else{return _0x258112;}}function respondWithRpcPromise(_0x42c6de,_0x4c6e7f,_0x165463,_0x987892){return new BPromise(function(_0x1adf32,_0x30cae0){var _0x931f9c=_0x987892||client;return _0x931f9c[_0x8b16('0x22')](_0x42c6de,_0x165463)[_0x8b16('0x23')](function(_0x30cd6c){logger[_0x8b16('0x24')](_0x8b16('0x25'),_0x4c6e7f,_0x8b16('0x26'));logger[_0x8b16('0x27')](_0x8b16('0x28'),_0x4c6e7f,_0x8b16('0x26'),JSON[_0x8b16('0x29')](_0x30cd6c));if(_0x30cd6c[_0x8b16('0x2a')]){if(_0x30cd6c['error'][_0x8b16('0x2b')]===0x1f4){logger[_0x8b16('0x2a')](_0x8b16('0x25'),_0x4c6e7f,_0x30cd6c[_0x8b16('0x2a')][_0x8b16('0x2c')]);return _0x30cae0(_0x30cd6c[_0x8b16('0x2a')][_0x8b16('0x2c')]);}logger['error'](_0x8b16('0x25'),_0x4c6e7f,_0x30cd6c[_0x8b16('0x2a')][_0x8b16('0x2c')]);return _0x1adf32(_0x30cd6c['error'][_0x8b16('0x2c')]);}else{logger['info'](_0x8b16('0x25'),_0x4c6e7f,_0x8b16('0x26'));_0x1adf32(_0x30cd6c[_0x8b16('0x2d')][_0x8b16('0x2c')]);}})[_0x8b16('0x2e')](function(_0x102a9c){logger[_0x8b16('0x2a')](_0x8b16('0x25'),_0x4c6e7f,_0x102a9c);_0x30cae0(_0x102a9c);});});}function respondWithStatusCode(_0x1f916a,_0x1bb1ef){_0x1bb1ef=_0x1bb1ef||0xcc;return function(_0x1668be){if(_0x1668be){return _0x1f916a['sendStatus'](_0x1bb1ef);}return _0x1f916a[_0x8b16('0x2f')](_0x1bb1ef)[_0x8b16('0x30')]();};}function respondWithResult(_0x3e2c22,_0x509d87){_0x509d87=_0x509d87||0xc8;return function(_0x3ad213){if(_0x3ad213){return _0x3e2c22[_0x8b16('0x2f')](_0x509d87)[_0x8b16('0x31')](_0x3ad213);}};}function respondWithFilteredResult(_0xf28dd0,_0x22e3fe){return function(_0x2bbea5){if(_0x2bbea5){var _0x55b1d0=_0x2bbea5['count'],_0x440aaf=_0x22e3fe['offset'],_0x970cfc=_0x22e3fe[_0x8b16('0x32')]+_0x22e3fe[_0x8b16('0x33')],_0x37357c;if(_0x970cfc>=_0x55b1d0){_0x970cfc=_0x55b1d0;_0x37357c=0xc8;}else{_0x37357c=0xce;}_0xf28dd0[_0x8b16('0x2f')](_0x37357c);return _0xf28dd0[_0x8b16('0x34')]('Content-Range',_0x440aaf+'-'+_0x970cfc+'/'+_0x55b1d0)[_0x8b16('0x31')](_0x2bbea5);}return null;};}function patchUpdates(_0x3adc2a){return function(_0x350d31){try{jsonpatch[_0x8b16('0x35')](_0x350d31,_0x3adc2a,!![]);}catch(_0x5b6bb0){return BPromise[_0x8b16('0x36')](_0x5b6bb0);}return _0x350d31[_0x8b16('0x37')]();};}function saveUpdates(_0xff4251,_0x4b8835){return function(_0x2bebda){if(_0x2bebda){return _0x2bebda[_0x8b16('0x38')](_0xff4251)[_0x8b16('0x23')](function(_0x1c6064){return _0x1c6064;});}return null;};}function removeEntity(_0x4f2ae1,_0x2c3c27){return function(_0x4a93bd){if(_0x4a93bd){return _0x4a93bd[_0x8b16('0x39')]()[_0x8b16('0x23')](function(){var _0x549604=_0x4a93bd[_0x8b16('0x3a')]({'plain':!![]});var _0x5f4177=_0x8b16('0x3b');return db[_0x8b16('0x3c')][_0x8b16('0x39')]({'where':{'type':_0x5f4177,'resourceId':_0x549604['id']}})[_0x8b16('0x23')](function(){return _0x4a93bd;});})['then'](function(){_0x4f2ae1[_0x8b16('0x2f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30ceff,_0x28327b){return function(_0x2fb12f){if(!_0x2fb12f){_0x30ceff[_0x8b16('0x3d')](0x194);}return _0x2fb12f;};}function handleError(_0x1ea489,_0x152360){_0x152360=_0x152360||0x1f4;return function(_0xb12077){logger[_0x8b16('0x2a')](_0xb12077[_0x8b16('0x3e')]);if(_0xb12077[_0x8b16('0x3f')]){delete _0xb12077[_0x8b16('0x3f')];}_0x1ea489[_0x8b16('0x2f')](_0x152360)[_0x8b16('0x40')](_0xb12077);};}exports['index']=function(_0x18bdd4,_0x5aa0a9){var _0x241699={'include':[{'model':db[_0x8b16('0x41')],'as':_0x8b16('0x42')}]},_0x4f7cad={},_0x297536={'count':0x0,'rows':[]};var _0x6bd9a4=_[_0x8b16('0x43')](db[_0x8b16('0x44')][_0x8b16('0x45')],function(_0x4b8d60){return{'name':_0x4b8d60[_0x8b16('0x46')],'type':_0x4b8d60[_0x8b16('0x47')][_0x8b16('0x48')]};});_0x4f7cad['model']=_[_0x8b16('0x43')](_0x6bd9a4,'name');_0x4f7cad[_0x8b16('0x49')]=_['keys'](_0x18bdd4[_0x8b16('0x49')]);_0x4f7cad['filters']=_['intersection'](_0x4f7cad[_0x8b16('0x4a')],_0x4f7cad['query']);_0x241699['attributes']=_[_0x8b16('0x4b')](_0x4f7cad['model'],qs[_0x8b16('0x4c')](_0x18bdd4['query']['fields']));_0x241699[_0x8b16('0x4d')]=_0x241699[_0x8b16('0x4d')][_0x8b16('0x4e')]?_0x241699[_0x8b16('0x4d')]:_0x4f7cad[_0x8b16('0x4a')];if(!_0x18bdd4['query'][_0x8b16('0x4f')](_0x8b16('0x50'))){_0x241699[_0x8b16('0x33')]=qs[_0x8b16('0x33')](_0x18bdd4['query'][_0x8b16('0x33')]);_0x241699[_0x8b16('0x32')]=qs[_0x8b16('0x32')](_0x18bdd4[_0x8b16('0x49')]['offset']);}_0x241699[_0x8b16('0x51')]=qs[_0x8b16('0x52')](_0x18bdd4[_0x8b16('0x49')][_0x8b16('0x52')]);_0x241699[_0x8b16('0x53')]=qs[_0x8b16('0x54')](_[_0x8b16('0x55')](_0x18bdd4[_0x8b16('0x49')],_0x4f7cad[_0x8b16('0x54')]));if(_0x18bdd4['query'][_0x8b16('0x56')]){_0x241699[_0x8b16('0x53')]=_[_0x8b16('0x57')](_0x241699['where'],{'$or':_[_0x8b16('0x43')](_0x6bd9a4,function(_0x322de6){if(_0x322de6[_0x8b16('0x47')]!==_0x8b16('0x58')){var _0xa6f57f={};_0xa6f57f[_0x322de6[_0x8b16('0x3f')]]={'$like':'%'+_0x18bdd4[_0x8b16('0x49')]['filter']+'%'};return _0xa6f57f;}})});}_0x241699=_['merge']({},_0x241699,_0x18bdd4[_0x8b16('0x59')]);var _0x34dd91={'where':_0x241699['where']};return db['ChatWebsite']['count'](_0x34dd91)['then'](function(_0x3cf0de){_0x297536[_0x8b16('0x5a')]=_0x3cf0de;if(_0x18bdd4[_0x8b16('0x49')][_0x8b16('0x5b')]){_0x241699['include']=[{'all':!![]}];}return db[_0x8b16('0x44')][_0x8b16('0x5c')](_0x241699);})[_0x8b16('0x23')](function(_0x2420fb){_0x297536[_0x8b16('0x5d')]=_0x2420fb;return _0x297536;})[_0x8b16('0x23')](respondWithFilteredResult(_0x5aa0a9,_0x241699))[_0x8b16('0x2e')](handleError(_0x5aa0a9,null));};exports['show']=function(_0x95ab2b,_0x27505c){var _0x3e5852={'raw':![],'where':{'id':_0x95ab2b[_0x8b16('0x5e')]['id']},'include':[{'model':db[_0x8b16('0x41')],'as':_0x8b16('0x42')}]},_0x3d6445={};_0x3d6445[_0x8b16('0x4a')]=_[_0x8b16('0x5f')](db[_0x8b16('0x44')][_0x8b16('0x45')]);_0x3d6445[_0x8b16('0x49')]=_[_0x8b16('0x5f')](_0x95ab2b[_0x8b16('0x49')]);_0x3d6445[_0x8b16('0x54')]=_['intersection'](_0x3d6445['model'],_0x3d6445[_0x8b16('0x49')]);_0x3e5852[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x3d6445['model'],qs['fields'](_0x95ab2b['query'][_0x8b16('0x4c')]));_0x3e5852[_0x8b16('0x4d')]=_0x3e5852[_0x8b16('0x4d')]['length']?_0x3e5852[_0x8b16('0x4d')]:_0x3d6445[_0x8b16('0x4a')];if(_0x95ab2b[_0x8b16('0x49')][_0x8b16('0x5b')]){_0x3e5852[_0x8b16('0x60')]=[{'all':!![]}];}_0x3e5852=_[_0x8b16('0x57')]({},_0x3e5852,_0x95ab2b[_0x8b16('0x59')]);return db[_0x8b16('0x44')]['find'](_0x3e5852)[_0x8b16('0x23')](handleEntityNotFound(_0x27505c,null))['then'](respondWithResult(_0x27505c,null))['catch'](handleError(_0x27505c,null));};exports[_0x8b16('0x61')]=function(_0x33795c,_0x54b98e){return db[_0x8b16('0x44')]['create'](_0x33795c[_0x8b16('0x62')],{})['then'](function(_0x1e67c7){var _0x229a53=_0x33795c[_0x8b16('0x63')][_0x8b16('0x3a')]({'plain':!![]});if(!_0x229a53)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x229a53['role']==='user'){var _0x3f2775=_0x1e67c7[_0x8b16('0x3a')]({'plain':!![]});var _0x2c7b8a=_0x8b16('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0x2c7b8a,'userProfileId':_0x229a53[_0x8b16('0x64')]},'raw':!![]})[_0x8b16('0x23')](function(_0x218a7f){if(_0x218a7f&&_0x218a7f[_0x8b16('0x65')]===0x0){return db[_0x8b16('0x3c')]['create']({'name':_0x3f2775[_0x8b16('0x3f')],'resourceId':_0x3f2775['id'],'type':_0x218a7f[_0x8b16('0x3f')],'sectionId':_0x218a7f['id']},{})[_0x8b16('0x23')](function(){return _0x1e67c7;});}else{return _0x1e67c7;}})[_0x8b16('0x2e')](function(_0x1a8815){logger[_0x8b16('0x2a')](_0x8b16('0x66'),_0x1a8815);throw _0x1a8815;});}return _0x1e67c7;})[_0x8b16('0x23')](respondWithResult(_0x54b98e,0xc9))[_0x8b16('0x2e')](handleError(_0x54b98e,null));};exports[_0x8b16('0x38')]=function(_0x363ad9,_0x41636d){if(_0x363ad9['body']['id']){delete _0x363ad9['body']['id'];}return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x363ad9[_0x8b16('0x5e')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x8b16('0x23')](handleEntityNotFound(_0x41636d,null))[_0x8b16('0x23')](saveUpdates(_0x363ad9[_0x8b16('0x62')],null))[_0x8b16('0x23')](respondWithResult(_0x41636d,null))[_0x8b16('0x2e')](handleError(_0x41636d,null));};exports[_0x8b16('0x39')]=function(_0x4be587,_0x4a04d9){return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x4be587[_0x8b16('0x5e')]['id']}})['then'](handleEntityNotFound(_0x4a04d9,null))[_0x8b16('0x23')](removeEntity(_0x4a04d9,null))['catch'](handleError(_0x4a04d9,null));};exports[_0x8b16('0x68')]=function(_0x3cc581,_0x312c54){return db['ChatWebsite'][_0x8b16('0x68')]()['then'](respondWithResult(_0x312c54,null))['catch'](handleError(_0x312c54,null));};exports[_0x8b16('0x69')]=function(_0x214999,_0x5bf64d,_0x15e0cb){if(_0x214999['body']['id']){delete _0x214999['body']['id'];}return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x214999[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x5bf64d,null))[_0x8b16('0x23')](function(_0x3d6588){if(_0x3d6588){_0x214999['body']['ChatWebsiteId']=_0x3d6588['id'];return db[_0x8b16('0x6a')]['create'](_0x214999[_0x8b16('0x62')]);}})[_0x8b16('0x23')](respondWithResult(_0x5bf64d,null))['catch'](handleError(_0x5bf64d,null));};exports[_0x8b16('0x6b')]=function(_0x34d05e,_0x67b7cd,_0x1fccdc){var _0x1645ff={'raw':![],'where':{}};var _0x52a021={};var _0x2c19e3={'count':0x0,'rows':[]};return db[_0x8b16('0x44')]['findOne']({'where':{'id':_0x34d05e[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x67b7cd,null))['then'](function(_0x3f4205){if(_0x3f4205){_0x52a021['model']=_[_0x8b16('0x5f')](db[_0x8b16('0x6a')][_0x8b16('0x45')]);_0x52a021['query']=_[_0x8b16('0x5f')](_0x34d05e[_0x8b16('0x49')]);_0x52a021[_0x8b16('0x54')]=_[_0x8b16('0x4b')](_0x52a021[_0x8b16('0x4a')],_0x52a021[_0x8b16('0x49')]);_0x1645ff[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x52a021[_0x8b16('0x4a')],qs[_0x8b16('0x4c')](_0x34d05e[_0x8b16('0x49')][_0x8b16('0x4c')]));_0x1645ff[_0x8b16('0x4d')]=_0x1645ff[_0x8b16('0x4d')]['length']?_0x1645ff[_0x8b16('0x4d')]:_0x52a021[_0x8b16('0x4a')];if(!_0x34d05e[_0x8b16('0x49')]['hasOwnProperty'](_0x8b16('0x50'))){_0x1645ff[_0x8b16('0x33')]=qs[_0x8b16('0x33')](_0x34d05e[_0x8b16('0x49')]['limit']);_0x1645ff[_0x8b16('0x32')]=qs[_0x8b16('0x32')](_0x34d05e[_0x8b16('0x49')][_0x8b16('0x32')]);}_0x1645ff['order']=qs['sort'](_0x34d05e[_0x8b16('0x49')]['sort']);_0x1645ff[_0x8b16('0x53')]=qs[_0x8b16('0x54')](_[_0x8b16('0x55')](_0x34d05e['query'],_0x52a021[_0x8b16('0x54')]));_0x1645ff[_0x8b16('0x53')][_0x8b16('0x6c')]=_0x3f4205['id'];if(_0x34d05e['query'][_0x8b16('0x56')]){_0x1645ff[_0x8b16('0x53')]=_[_0x8b16('0x57')](_0x1645ff[_0x8b16('0x53')],{'$or':_[_0x8b16('0x43')](_0x1645ff[_0x8b16('0x4d')],function(_0x322c0e){var _0x1fc2e0={};_0x1fc2e0[_0x322c0e]={'$like':'%'+_0x34d05e['query'][_0x8b16('0x56')]+'%'};return _0x1fc2e0;})});}_0x1645ff=_['merge']({},_0x1645ff,_0x34d05e[_0x8b16('0x59')]);return db[_0x8b16('0x6a')][_0x8b16('0x5a')]({'where':_0x1645ff[_0x8b16('0x53')]})[_0x8b16('0x23')](function(_0x10d97a){_0x2c19e3[_0x8b16('0x5a')]=_0x10d97a;if(_0x34d05e[_0x8b16('0x49')][_0x8b16('0x5b')]){_0x1645ff['include']=[{'all':!![]}];}return db['Disposition'][_0x8b16('0x5c')](_0x1645ff);})[_0x8b16('0x23')](function(_0x15bc5a){_0x2c19e3['rows']=_0x15bc5a;return _0x2c19e3;});}})[_0x8b16('0x23')](respondWithFilteredResult(_0x67b7cd,_0x1645ff))[_0x8b16('0x2e')](handleError(_0x67b7cd,null));};exports['removeDispositions']=function(_0x41f96c,_0x539476,_0x439577){return db['ChatWebsite'][_0x8b16('0x67')]({'where':{'id':_0x41f96c[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x539476,null))[_0x8b16('0x23')](function(_0x20e2d7){if(_0x20e2d7){return _0x20e2d7['removeDispositions'](_0x41f96c['query']['ids']);}})[_0x8b16('0x23')](respondWithStatusCode(_0x539476,null))[_0x8b16('0x2e')](handleError(_0x539476,null));};exports[_0x8b16('0x6d')]=function(_0x12cef0,_0x1bccd7,_0x23ce8c){if(_0x12cef0[_0x8b16('0x62')]['id']){delete _0x12cef0[_0x8b16('0x62')]['id'];}return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x12cef0['params']['id']}})['then'](handleEntityNotFound(_0x1bccd7,null))[_0x8b16('0x23')](function(_0x54761c){if(_0x54761c){_0x12cef0[_0x8b16('0x62')][_0x8b16('0x6c')]=_0x54761c['id'];return db[_0x8b16('0x6e')][_0x8b16('0x61')](_0x12cef0['body']);}})[_0x8b16('0x23')](respondWithResult(_0x1bccd7,null))[_0x8b16('0x2e')](handleError(_0x1bccd7,null));};exports[_0x8b16('0x6f')]=function(_0x1fd67a,_0x174868,_0x4f9431){var _0xcec4cb={'raw':![],'where':{}};var _0x1214db={};var _0x1c4b5e={'count':0x0,'rows':[]};return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x1fd67a[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x174868,null))['then'](function(_0x1a84fe){if(_0x1a84fe){_0x1214db[_0x8b16('0x4a')]=_['keys'](db[_0x8b16('0x6e')][_0x8b16('0x45')]);_0x1214db[_0x8b16('0x49')]=_[_0x8b16('0x5f')](_0x1fd67a[_0x8b16('0x49')]);_0x1214db[_0x8b16('0x54')]=_[_0x8b16('0x4b')](_0x1214db[_0x8b16('0x4a')],_0x1214db[_0x8b16('0x49')]);_0xcec4cb['attributes']=_[_0x8b16('0x4b')](_0x1214db['model'],qs['fields'](_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x4c')]));_0xcec4cb[_0x8b16('0x4d')]=_0xcec4cb[_0x8b16('0x4d')]['length']?_0xcec4cb['attributes']:_0x1214db[_0x8b16('0x4a')];if(!_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x4f')](_0x8b16('0x50'))){_0xcec4cb[_0x8b16('0x33')]=qs['limit'](_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x33')]);_0xcec4cb[_0x8b16('0x32')]=qs[_0x8b16('0x32')](_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x32')]);}_0xcec4cb['order']=qs[_0x8b16('0x52')](_0x1fd67a['query']['sort']);_0xcec4cb[_0x8b16('0x53')]=qs[_0x8b16('0x54')](_[_0x8b16('0x55')](_0x1fd67a[_0x8b16('0x49')],_0x1214db['filters']));_0xcec4cb[_0x8b16('0x53')][_0x8b16('0x6c')]=_0x1a84fe['id'];if(_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x56')]){_0xcec4cb['where']=_['merge'](_0xcec4cb[_0x8b16('0x53')],{'$or':_[_0x8b16('0x43')](_0xcec4cb[_0x8b16('0x4d')],function(_0x4be5db){var _0xf60d1d={};_0xf60d1d[_0x4be5db]={'$like':'%'+_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x56')]+'%'};return _0xf60d1d;})});}_0xcec4cb=_[_0x8b16('0x57')]({},_0xcec4cb,_0x1fd67a['options']);return db['CannedAnswer']['count']({'where':_0xcec4cb[_0x8b16('0x53')]})[_0x8b16('0x23')](function(_0x38a5d6){_0x1c4b5e[_0x8b16('0x5a')]=_0x38a5d6;if(_0x1fd67a[_0x8b16('0x49')][_0x8b16('0x5b')]){_0xcec4cb[_0x8b16('0x60')]=[{'all':!![]}];}return db[_0x8b16('0x6e')][_0x8b16('0x5c')](_0xcec4cb);})[_0x8b16('0x23')](function(_0x149fc1){_0x1c4b5e[_0x8b16('0x5d')]=_0x149fc1;return _0x1c4b5e;});}})['then'](respondWithFilteredResult(_0x174868,_0xcec4cb))[_0x8b16('0x2e')](handleError(_0x174868,null));};exports[_0x8b16('0x71')]=function(_0x22bac3,_0x42799f,_0x4398c7){return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x22bac3[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x42799f,null))[_0x8b16('0x23')](function(_0x3ba37d){if(_0x3ba37d){return _0x3ba37d['removeAnswers'](_0x22bac3['query'][_0x8b16('0x72')]);}})[_0x8b16('0x23')](respondWithStatusCode(_0x42799f,null))[_0x8b16('0x2e')](handleError(_0x42799f,null));};exports['addLogo']=function(_0x23cae8,_0x372acc,_0x2f4ef9){_0x23cae8[_0x8b16('0x62')][_0x8b16('0x73')]=_0x23cae8[_0x8b16('0x74')][_0x8b16('0x75')];return db[_0x8b16('0x44')]['find']({'where':{'id':_0x23cae8[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x372acc,null))['then'](saveUpdates(_0x23cae8[_0x8b16('0x62')],null))[_0x8b16('0x23')](respondWithResult(_0x372acc,null))['catch'](handleError(_0x372acc,null));};exports[_0x8b16('0x76')]=function(_0x2e709f,_0x368975,_0x4177ce){_0x2e709f[_0x8b16('0x62')][_0x8b16('0x77')]=_0x2e709f[_0x8b16('0x74')]['filename'];return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x2e709f['params']['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x368975,null))[_0x8b16('0x23')](saveUpdates(_0x2e709f['body'],null))[_0x8b16('0x23')](respondWithResult(_0x368975,null))['catch'](handleError(_0x368975,null));};exports[_0x8b16('0x78')]=function(_0x2e8d38,_0x292362,_0x29206c){_0x2e8d38[_0x8b16('0x62')][_0x8b16('0x79')]=_0x2e8d38[_0x8b16('0x74')][_0x8b16('0x75')];return db[_0x8b16('0x44')]['find']({'where':{'id':_0x2e8d38[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x292362,null))[_0x8b16('0x23')](saveUpdates(_0x2e8d38[_0x8b16('0x62')],null))[_0x8b16('0x23')](respondWithResult(_0x292362,null))[_0x8b16('0x2e')](handleError(_0x292362,null));};exports['addSystemAvatar']=function(_0x21ffe0,_0x497477,_0x67230d){_0x21ffe0['body'][_0x8b16('0x7a')]=_0x21ffe0['file'][_0x8b16('0x75')];return db['ChatWebsite']['find']({'where':{'id':_0x21ffe0[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x497477,null))[_0x8b16('0x23')](saveUpdates(_0x21ffe0[_0x8b16('0x62')],null))[_0x8b16('0x23')](respondWithResult(_0x497477,null))[_0x8b16('0x2e')](handleError(_0x497477,null));};exports[_0x8b16('0x7b')]=function(_0x31843d,_0x478ee4,_0xd4b779){var _0xf80695=path['join'](config['root'],_0x8b16('0x7c'));var _0xd6f18a={'where':{'id':_0x31843d[_0x8b16('0x5e')]['id']},'attributes':['id',_0x8b16('0x73')],'raw':!![]};var _0x29ea0a=![];return require(_0x8b16('0x7d'))['getLicense']()[_0x8b16('0x23')](function(_0x193d0a){if(_0x193d0a){_0x29ea0a=_0x193d0a[_0x8b16('0x7e')];}})[_0x8b16('0x23')](function(){return db[_0x8b16('0x44')][_0x8b16('0x67')](_0xd6f18a);})['then'](handleEntityNotFound(_0x478ee4,null))[_0x8b16('0x23')](function(_0x5606f0){if(_0x5606f0){if(!_[_0x8b16('0x7f')](_0x5606f0[_0x8b16('0x73')])){if(fs[_0x8b16('0x80')](path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x83'),_0x5606f0[_0x8b16('0x73')]))&&_0x29ea0a){_0xf80695=path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x83'),_0x5606f0[_0x8b16('0x73')]);}}return _0x478ee4[_0x8b16('0x84')](_0xf80695);}})[_0x8b16('0x2e')](handleError(_0x478ee4,null));};exports[_0x8b16('0x85')]=function(_0x4c747f,_0x5507dc,_0x58bc8c){var _0xd55c25=path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x86'));var _0xc9e210={'where':{'id':_0x4c747f[_0x8b16('0x5e')]['id']},'attributes':['id',_0x8b16('0x77')],'raw':!![]};return db[_0x8b16('0x44')][_0x8b16('0x67')](_0xc9e210)['then'](handleEntityNotFound(_0x5507dc,null))[_0x8b16('0x23')](function(_0x532e9c){if(_0x532e9c){if(!_[_0x8b16('0x7f')](_0x532e9c[_0x8b16('0x77')])){if(fs[_0x8b16('0x80')](path['join'](config['root'],'server/files/images/avatars/',_0x532e9c['agentAvatar']))){_0xd55c25=path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x87'),_0x532e9c['agentAvatar']);}}return _0x5507dc[_0x8b16('0x84')](_0xd55c25);}})['catch'](handleError(_0x5507dc,null));};exports[_0x8b16('0x88')]=function(_0x3154e4,_0x3c14b2,_0x333c94){var _0xca83ba=path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x89'));var _0x5defa5={'where':{'id':_0x3154e4[_0x8b16('0x5e')]['id']},'attributes':['id',_0x8b16('0x79'),_0x8b16('0x8a')],'raw':!![]};return db[_0x8b16('0x44')][_0x8b16('0x67')](_0x5defa5)['then'](handleEntityNotFound(_0x3c14b2,null))[_0x8b16('0x23')](function(_0x49c4d6){if(_0x49c4d6){if(!_[_0x8b16('0x7f')](_0x49c4d6[_0x8b16('0x79')])){if(fs[_0x8b16('0x80')](path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x87'),_0x49c4d6[_0x8b16('0x79')]))&&_0x49c4d6[_0x8b16('0x8a')]){_0xca83ba=path['join'](config['root'],_0x8b16('0x87'),_0x49c4d6['customerAvatar']);}}return _0x3c14b2[_0x8b16('0x84')](_0xca83ba);}})['catch'](handleError(_0x3c14b2,null));};exports[_0x8b16('0x8b')]=function(_0xec563e,_0x135938,_0x4c9bc3){var _0x3bdb09=path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0x8c'));var _0x2e5f61={'where':{'id':_0xec563e['params']['id']},'attributes':['id',_0x8b16('0x7a')],'raw':!![]};return db[_0x8b16('0x44')][_0x8b16('0x67')](_0x2e5f61)['then'](handleEntityNotFound(_0x135938,null))[_0x8b16('0x23')](function(_0x441b4d){if(_0x441b4d){if(!_[_0x8b16('0x7f')](_0x441b4d[_0x8b16('0x7a')])){if(fs[_0x8b16('0x80')](path['join'](config[_0x8b16('0x82')],_0x8b16('0x87'),_0x441b4d[_0x8b16('0x7a')]))){_0x3bdb09=path[_0x8b16('0x81')](config['root'],_0x8b16('0x87'),_0x441b4d[_0x8b16('0x7a')]);}}return _0x135938[_0x8b16('0x84')](_0x3bdb09);}})['catch'](handleError(_0x135938,null));};exports[_0x8b16('0x8d')]=function(_0x4ff383,_0x210f77,_0x3331e2){var _0x5ae60e=require(_0x8b16('0x8e'));var _0x322324=new _0x5ae60e();var _0x2ab64e=_0x322324[_0x8b16('0x8f')](_0x4ff383[_0x8b16('0x90')][_0x8b16('0x91')])[_0x8b16('0x92')]();var _0x5a66c4={'body':_0x4ff383[_0x8b16('0x62')],'channel':_0x8b16('0x93')};var _0x2cf18a=[];var _0x2b0022=[];var _0x523f41={};var _0x5796b2=![];return db[_0x8b16('0x94')][_0x8b16('0x68')]()['then'](function(_0x74b2f6){if(!_0x74b2f6){throw new db[(_0x8b16('0x1f'))]['ValidationError'](_0x8b16('0x95'));}_0x2cf18a=_['difference'](_[_0x8b16('0x5f')](_0x74b2f6),[_0x8b16('0x96'),_0x8b16('0x97')]);_0x2b0022=_[_0x8b16('0x98')](_[_0x8b16('0x5f')](_0x74b2f6),[_0x8b16('0x96'),_0x8b16('0x97'),_0x8b16('0x99'),_0x8b16('0x9a')]);if(_0x4ff383['body']['id']){delete _0x4ff383['body']['id'];}if(_[_0x8b16('0x7f')](_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9b')])){throw new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))](_0x8b16('0x9c'));}if(_[_0x8b16('0x7f')](_0x4ff383[_0x8b16('0x62')][_0x8b16('0x62')])||_0x4ff383['body']['body']===''){throw new db['Sequelize'][(_0x8b16('0x20'))](_0x8b16('0x9d'));}if(_[_0x8b16('0x7f')](_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9e')])){throw new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))](_0x8b16('0x9f')+_0x2b0022);}if(!_[_0x8b16('0xa0')](_0x2b0022,_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9e')])){throw new db[(_0x8b16('0x1f'))]['ValidationError'](_0x8b16('0xa1')+_0x2b0022);}_0x523f41[_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9e')]]=_0x4ff383['body'][_0x8b16('0x9b')];})[_0x8b16('0x23')](function(){return db[_0x8b16('0x44')]['find']({'where':{'id':_0x4ff383['params']['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x8b16('0x94')],'as':_0x8b16('0xa2'),'where':_0x523f41,'limit':0x1,'order':[['updatedAt',_0x8b16('0xa3')]]}]},{'model':db['ChatApplication'],'as':_0x8b16('0xa4')}]});})[_0x8b16('0x23')](handleEntityNotFound(_0x210f77,null))[_0x8b16('0x23')](function(_0x91013){if(_0x91013&&_0x91013[_0x8b16('0xa5')]){_0x5a66c4[_0x8b16('0xa6')]=_0x91013;_0x5a66c4[_0x8b16('0xa7')]=_0x91013['Applications'];_0x5a66c4[_0x8b16('0xa8')]=_0x91013['List'];_0x5a66c4[_0x8b16('0xa7')]=_[_0x8b16('0xa9')](_0x5a66c4[_0x8b16('0xa7')],[_0x8b16('0xaa')],[_0x8b16('0xab')]);if(_0x5a66c4[_0x8b16('0xa6')][_0x8b16('0xa4')]){delete _0x5a66c4[_0x8b16('0xa6')][_0x8b16('0xa4')];}if(_0x5a66c4[_0x8b16('0xa6')][_0x8b16('0xa5')]&&_0x5a66c4[_0x8b16('0xa6')]['List']['Contacts'][_0x8b16('0x4e')]){return _0x5a66c4['account'][_0x8b16('0xa5')][_0x8b16('0xa2')][0x0];}var _0x45a981=_[_0x8b16('0xac')](_0x4ff383['body'],{'firstName':_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9b')],'ListId':_0x91013[_0x8b16('0x9a')]});_0x45a981[_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9e')]]=_0x4ff383[_0x8b16('0x62')][_0x8b16('0x9b')];return db[_0x8b16('0x94')][_0x8b16('0x61')](_0x45a981,{'fields':_0x2cf18a,'raw':!![]});}})[_0x8b16('0x23')](handleEntityNotFound(_0x210f77,null))[_0x8b16('0x23')](function(_0x132a54){_0x5a66c4['contact']=_0x132a54;var _0x232145=_0x4ff383['body'][_0x8b16('0xad')];if(_0x4ff383['headers'][_0x8b16('0xae')]){_0x232145=_0x4ff383[_0x8b16('0x90')]['cf-connecting-ip'];}else if(_0x4ff383[_0x8b16('0x90')][_0x8b16('0xaf')]){_0x232145=_[_0x8b16('0xb0')](_0x4ff383[_0x8b16('0x90')][_0x8b16('0xaf')][_0x8b16('0xb1')](','));}if(_0x132a54){var _0x42e2b0={'ContactId':_0x132a54['id'],'ChatWebsiteId':_0x4ff383['params']['id'],'from':(_0x132a54[_0x8b16('0xb2')]||'')+'\x20'+(_0x132a54['lastName']||''),'customerIp':_0x232145,'customerPort':_0x4ff383[_0x8b16('0x90')][_0x8b16('0xb3')]?_0x4ff383[_0x8b16('0x90')][_0x8b16('0xb3')]:null,'referer':_0x4ff383['body'][_0x8b16('0xb4')],'browserName':_0x2ab64e[_0x8b16('0xb5')][_0x8b16('0x3f')]&&_0x2ab64e[_0x8b16('0xb5')][_0x8b16('0xb6')]?util[_0x8b16('0xb7')]('%s\x20%s',_0x2ab64e['browser'][_0x8b16('0x3f')],_0x2ab64e[_0x8b16('0xb5')][_0x8b16('0xb6')]):_0x8b16('0xb8'),'browserVersion':_0x2ab64e[_0x8b16('0xb5')]['version']||_0x8b16('0xb8'),'osName':util[_0x8b16('0xb7')](_0x8b16('0xb9'),_0x2ab64e['os'][_0x8b16('0x3f')],_0x2ab64e['os'][_0x8b16('0xb6')]),'osVersion':_0x2ab64e['os'][_0x8b16('0xb6')],'deviceModel':_0x2ab64e[_0x8b16('0xba')][_0x8b16('0x4a')]&&_0x2ab64e[_0x8b16('0xba')]['vendor']?util[_0x8b16('0xb7')](_0x8b16('0xbb'),_0x2ab64e[_0x8b16('0xba')][_0x8b16('0x4a')],_0x2ab64e[_0x8b16('0xba')][_0x8b16('0xbc')],_0x2ab64e[_0x8b16('0xba')][_0x8b16('0x47')]):null,'deviceVendor':_0x2ab64e[_0x8b16('0xba')][_0x8b16('0xbc')],'deviceType':_0x2ab64e[_0x8b16('0xba')]['type'],'formData':JSON[_0x8b16('0x29')](_0x4ff383[_0x8b16('0x62')])};var _0x4b426a={'ChatWebsiteId':_0x4ff383[_0x8b16('0x5e')]['id'],'closed':![]};if(_0x4ff383[_0x8b16('0x62')][_0x8b16('0xbd')]){_0x4b426a[_0x8b16('0xbd')]=_0x4ff383['body']['threadId'];return db['ChatInteraction'][_0x8b16('0x67')]({'where':_0x4b426a})[_0x8b16('0x23')](function(_0x1f724d){if(_0x1f724d){return[_0x1f724d,![]];}_0x42e2b0[_0x8b16('0xbd')]=_0x4ff383['body'][_0x8b16('0xbd')];_0x42e2b0[_0x8b16('0xbe')]=_0x4ff383[_0x8b16('0x62')][_0x8b16('0xbe')];return db[_0x8b16('0xbf')][_0x8b16('0x61')](_0x42e2b0)['then'](function(_0x395675){return[_0x395675,!![]];});});}_0x4b426a['ContactId']=_0x132a54['id'];if(_0x4ff383[_0x8b16('0x62')][_0x8b16('0xc0')]&&_0x4ff383['body'][_0x8b16('0xc0')]['id']){_0x4b426a['id']=_0x4ff383[_0x8b16('0x62')][_0x8b16('0xc0')]['id'];return db[_0x8b16('0xbf')][_0x8b16('0x67')]({'where':_0x4b426a})[_0x8b16('0x23')](function(_0x35d124){if(_0x35d124){return[_0x35d124,![]];}return db['ChatInteraction'][_0x8b16('0x61')](_0x42e2b0)[_0x8b16('0x23')](function(_0x382270){return[_0x382270,!![]];});});}return db[_0x8b16('0xbf')][_0x8b16('0x61')](_0x42e2b0)['then'](function(_0x22f5cb){return[_0x22f5cb,!![]];});}})['spread'](function(_0x289fa2,_0xde131){if(_0x289fa2){_0x5796b2=_0xde131;if(!_0xde131){var _0x4db19a={'from':(_0x5a66c4[_0x8b16('0xc1')][_0x8b16('0xb2')]||'')+'\x20'+(_0x5a66c4['contact'][_0x8b16('0xc2')]||'')};if(_0x4ff383[_0x8b16('0x62')][_0x8b16('0xbd')]&&_0x4ff383[_0x8b16('0x62')][_0x8b16('0xc3')]&&_0x4ff383['body'][_0x8b16('0xbd')]!=_0x4ff383[_0x8b16('0x62')][_0x8b16('0xc3')]){_0x4db19a['threadId']=_0x4ff383['body'][_0x8b16('0xc3')];}return _0x289fa2[_0x8b16('0x38')](_0x4db19a);}else{return _0x289fa2;}}})[_0x8b16('0x23')](function(_0x2e8c22){_0x5a66c4[_0x8b16('0xc0')]=_0x2e8c22[_0x8b16('0x3a')]({'plain':!![]});_0x5a66c4[_0x8b16('0xc0')][_0x8b16('0xc4')]=_0x5796b2;if(_0x5a66c4['interaction'][_0x8b16('0xc4')]){if(_0x5a66c4['account'][_0x8b16('0xc5')]){_0x5a66c4[_0x8b16('0xa7')][_0x8b16('0xc6')]({'id':0x0,'priority':_0x5a66c4[_0x8b16('0xa7')][_0x8b16('0x4e')]+0x1,'app':'close','appdata':_0x8b16('0xc7'),'interval':_0x8b16('0xc8')});}}return db['ChatMessage'][_0x8b16('0x61')]({'body':_0x4ff383[_0x8b16('0x62')][_0x8b16('0x62')],'ChatWebsiteId':_0x4ff383[_0x8b16('0x5e')]['id'],'ChatInteractionId':_0x2e8c22['id'],'direction':'in','ContactId':_0x5a66c4[_0x8b16('0xc1')]['id'],'AttachmentId':_0x4ff383[_0x8b16('0x62')]['AttachmentId']});})['then'](function(_0x430049){_0x5a66c4[_0x8b16('0x2c')]=_0x430049;if(_0x5a66c4[_0x8b16('0xc0')][_0x8b16('0xc9')]){return db[_0x8b16('0xca')][_0x8b16('0x67')]({'attributes':['id','name'],'where':{'id':_0x5a66c4[_0x8b16('0xc0')][_0x8b16('0xc9')]}})[_0x8b16('0x23')](function(_0x26ea2f){if(_0x26ea2f){_0x5a66c4[_0x8b16('0xa7')][_0x8b16('0xcb')]({'id':0x0,'priority':0x0,'app':_0x8b16('0xcc'),'appdata':_0x26ea2f['name']+','+(_0x5a66c4[_0x8b16('0xa6')][_0x8b16('0xcd')]||0xa),'interval':'*,*,*,*'});_0x5a66c4[_0x8b16('0xce')]=!![];}return respondWithRpcPromise(_0x8b16('0xcf'),'startRouting',_0x5a66c4);});}return respondWithRpcPromise(_0x8b16('0xcf'),'startRouting',_0x5a66c4);})[_0x8b16('0x23')](function(_0x1f415e){respondWithRpcPromise(_0x8b16('0xd0'),'EventManager',{'event':_0x8b16('0x8d'),'message':_0x1f415e},client9002);return _0x1f415e;})['then'](respondWithResult(_0x210f77,null))['catch'](handleError(_0x210f77,null));};exports[_0x8b16('0xd1')]=function(_0x313be1,_0x4a7c78,_0x6a0db6){var _0x5181c9,_0x3cad05,_0x3e7ce1;var _0x2fb5c2=[];var _0x4cb0c2=[];var _0x339358={};return db['CmContact'][_0x8b16('0x68')]()[_0x8b16('0x23')](function(_0x33afcf){if(!_0x33afcf){throw new db['Sequelize'][(_0x8b16('0x20'))](_0x8b16('0x95'));}_0x4cb0c2=_['difference'](_[_0x8b16('0x5f')](_0x33afcf),['createdAt',_0x8b16('0x97')]);_0x2fb5c2=_['difference'](_[_0x8b16('0x5f')](_0x33afcf),[_0x8b16('0x96'),'updatedAt','CompanyId',_0x8b16('0x9a')]);if(_0x313be1[_0x8b16('0x62')]['id']){delete _0x313be1['body']['id'];}if(_[_0x8b16('0x7f')](_0x313be1['body'][_0x8b16('0x9b')])){throw _0x4a7c78[_0x8b16('0x2f')](0x1f4)[_0x8b16('0x40')](new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))]('from\x20is\x20mandatory'));}if(_[_0x8b16('0x7f')](_0x313be1[_0x8b16('0x62')][_0x8b16('0x62')])||_0x313be1[_0x8b16('0x62')][_0x8b16('0x62')]===''){throw _0x4a7c78[_0x8b16('0x2f')](0x1f4)[_0x8b16('0x40')](new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))](_0x8b16('0x9d')));}if(_['isNil'](_0x313be1[_0x8b16('0x62')]['mapKeyOffline'])){throw _0x4a7c78[_0x8b16('0x2f')](0x1f4)[_0x8b16('0x40')](new db['Sequelize'][(_0x8b16('0x20'))](_0x8b16('0xd2')+_0x2fb5c2));}if(!_[_0x8b16('0xa0')](_0x2fb5c2,_0x313be1[_0x8b16('0x62')][_0x8b16('0xd3')])){throw _0x4a7c78[_0x8b16('0x2f')](0x1f4)['send'](new db[(_0x8b16('0x1f'))][(_0x8b16('0x20'))](_0x8b16('0xd4')+_0x2fb5c2));}_0x339358[_0x313be1[_0x8b16('0x62')][_0x8b16('0xd3')]]=_0x313be1[_0x8b16('0x62')]['from'];})['then'](function(){return db[_0x8b16('0x44')]['find']({'where':{'id':_0x313be1[_0x8b16('0x5e')]['id']},'include':[{'model':db['CmList'],'as':_0x8b16('0xa5')}]});})[_0x8b16('0x23')](handleEntityNotFound(_0x4a7c78,null))[_0x8b16('0x23')](function(_0x57d9cd){if(_0x57d9cd&&_0x57d9cd[_0x8b16('0xa5')]){_0x3cad05=_0x57d9cd;var _0x29e9fe=_[_0x8b16('0xac')](_0x313be1[_0x8b16('0x62')],{'firstName':_0x313be1['body']['from'],'phone':_0x313be1[_0x8b16('0x62')][_0x8b16('0x9b')],'ListId':_0x57d9cd[_0x8b16('0x9a')]});_0x29e9fe[_0x313be1[_0x8b16('0x62')][_0x8b16('0xd3')]]=_0x313be1['body']['from'];return db[_0x8b16('0x94')]['findOrCreate']({'where':_0x339358,'defaults':_0x29e9fe});}})[_0x8b16('0xd5')](function(_0x20373f){if(_0x20373f){_0x3e7ce1=_0x20373f;var _0x5d612d=fs['readFileSync'](path[_0x8b16('0x81')](config[_0x8b16('0x82')],_0x8b16('0xd6')),_0x8b16('0xd7'));var _0x17ccc3=ejs[_0x8b16('0xd8')](_0x5d612d,{'body':_[_0x8b16('0xd9')](_0x313be1['body'][_0x8b16('0x62')]),'bodyTitle':_0x3cad05['offlineMessageBody']});return db['ChatOfflineMessage'][_0x8b16('0x61')]({'body':_0x17ccc3,'ContactId':_0x20373f['id'],'ChatWebsiteId':_0x3cad05['id']});}})['then'](function(_0x566f15){if(_0x566f15){_0x5181c9=_0x566f15;return db[_0x8b16('0xda')][_0x8b16('0x70')]({'where':{'service':!![]},'include':[{'model':db[_0x8b16('0xdb')],'as':_0x8b16('0xdc'),'raw':!![]}]});}})[_0x8b16('0x23')](function(_0x5071f2){if(_0x5071f2&&_0x5071f2[_0x8b16('0xdc')]&&_0x3cad05[_0x8b16('0xdd')]){var _0x338e30={'tls':{'rejectUnauthorized':![]}};if(_0x5071f2['Smtp'][_0x8b16('0xde')]){_0x338e30[_0x8b16('0xde')]=_0x5071f2[_0x8b16('0xdc')][_0x8b16('0xde')];}else{_0x338e30['host']=_0x5071f2['Smtp'][_0x8b16('0xdf')];_0x338e30[_0x8b16('0xe0')]=_0x5071f2[_0x8b16('0xdc')]['port'];_0x338e30[_0x8b16('0xe1')]=_0x5071f2[_0x8b16('0xdc')][_0x8b16('0xe1')];}if(_0x5071f2[_0x8b16('0xdc')][_0x8b16('0xe2')]){_0x338e30[_0x8b16('0xe3')]={'user':_0x5071f2[_0x8b16('0xdc')][_0x8b16('0x63')],'pass':_0x5071f2['Smtp'][_0x8b16('0xe4')]};}return respondWithRpcPromise(_0x8b16('0xe5'),'sendMail',{'account':_0x338e30,'message':{'from':util[_0x8b16('0xb7')]('\x22%s\x22\x20<%s>',_0x5071f2[_0x8b16('0x3f')],_0x5071f2[_0x8b16('0xe6')]||_0x5071f2[_0x8b16('0xdc')][_0x8b16('0x63')]),'to':_0x3cad05[_0x8b16('0xdd')],'subject':_0x3cad05['offlineMessageSubject'],'text':_0x5181c9['body']}},client9003)[_0x8b16('0x23')](function(){return _0x5181c9;})[_0x8b16('0x2e')](function(_0x1d5b8a){console['error'](_0x1d5b8a);});}})[_0x8b16('0x23')](function(){if(_0x5181c9){return _0x5181c9;}})['then'](respondWithResult(_0x4a7c78,null))[_0x8b16('0x2e')](handleError(_0x4a7c78,null));};exports['addInteraction']=function(_0x4139a9,_0x5accd5,_0x517066){return db[_0x8b16('0xbf')][_0x8b16('0x67')]({'where':{'id':_0x4139a9[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x5accd5,null))['then'](function(_0x4053b4){if(_0x4053b4){return _0x4053b4['addInteraction'](_0x4139a9[_0x8b16('0x62')][_0x8b16('0x72')],_[_0x8b16('0xe7')](_0x4139a9[_0x8b16('0x62')],['ids','id'])||{});}})['then'](respondWithResult(_0x5accd5,null))[_0x8b16('0x2e')](handleError(_0x5accd5,null));};exports[_0x8b16('0xe8')]=function(_0x4edd56,_0x5b0995,_0x14b9ed){var _0x4ff4a2={'raw':![],'where':{}};var _0x5a1801={};var _0xd475f5={'count':0x0,'rows':[]};return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x4edd56['params']['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x5b0995,null))[_0x8b16('0x23')](function(_0x52ba71){if(_0x52ba71){_0x5a1801[_0x8b16('0x4a')]=_[_0x8b16('0x5f')](db['ChatInteraction'][_0x8b16('0x45')]);_0x5a1801[_0x8b16('0x49')]=_[_0x8b16('0x5f')](_0x4edd56[_0x8b16('0x49')]);_0x5a1801[_0x8b16('0x54')]=_[_0x8b16('0x4b')](_0x5a1801[_0x8b16('0x4a')],_0x5a1801[_0x8b16('0x49')]);_0x4ff4a2[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x5a1801[_0x8b16('0x4a')],qs[_0x8b16('0x4c')](_0x4edd56[_0x8b16('0x49')][_0x8b16('0x4c')]));_0x4ff4a2[_0x8b16('0x4d')]=_0x4ff4a2[_0x8b16('0x4d')]['length']?_0x4ff4a2[_0x8b16('0x4d')]:_0x5a1801['model'];if(!_0x4edd56[_0x8b16('0x49')]['hasOwnProperty'](_0x8b16('0x50'))){_0x4ff4a2['limit']=qs[_0x8b16('0x33')](_0x4edd56['query'][_0x8b16('0x33')]);_0x4ff4a2[_0x8b16('0x32')]=qs['offset'](_0x4edd56[_0x8b16('0x49')][_0x8b16('0x32')]);}_0x4ff4a2['order']=qs[_0x8b16('0x52')](_0x4edd56[_0x8b16('0x49')][_0x8b16('0x52')]);_0x4ff4a2[_0x8b16('0x53')]=qs['filters'](_[_0x8b16('0x55')](_0x4edd56['query'],_0x5a1801['filters']));_0x4ff4a2[_0x8b16('0x53')][_0x8b16('0x6c')]=_0x52ba71['id'];if(_0x4edd56[_0x8b16('0x49')]['filter']){_0x4ff4a2[_0x8b16('0x53')]=_[_0x8b16('0x57')](_0x4ff4a2['where'],{'$or':_[_0x8b16('0x43')](_0x4ff4a2[_0x8b16('0x4d')],function(_0x3bdf2b){var _0x2a87c1={};_0x2a87c1[_0x3bdf2b]={'$like':'%'+_0x4edd56['query'][_0x8b16('0x56')]+'%'};return _0x2a87c1;})});}_0x4ff4a2=_['merge']({},_0x4ff4a2,_0x4edd56[_0x8b16('0x59')]);return db[_0x8b16('0xbf')][_0x8b16('0x5a')]({'where':_0x4ff4a2['where']})['then'](function(_0x1ebfd7){_0xd475f5[_0x8b16('0x5a')]=_0x1ebfd7;if(_0x4edd56[_0x8b16('0x49')][_0x8b16('0x5b')]){_0x4ff4a2['include']=[{'model':db[_0x8b16('0x94')],'as':_0x8b16('0xe9'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8b16('0x3f'),'fullname','internal'],'required':![]},{'model':db[_0x8b16('0xea')],'as':'Tags','attributes':['id',_0x8b16('0x3f'),'color'],'where':_0x4edd56[_0x8b16('0x49')][_0x8b16('0xeb')]?{'id':_0x4edd56[_0x8b16('0x49')][_0x8b16('0xeb')]}:undefined,'required':_0x4edd56[_0x8b16('0x49')]['tag']?!![]:![]}];}return db[_0x8b16('0xbf')][_0x8b16('0x5c')](_0x4ff4a2);})[_0x8b16('0x23')](function(_0x2383db){_0xd475f5[_0x8b16('0x5d')]=_0x2383db;return _0xd475f5;});}})[_0x8b16('0x23')](respondWithFilteredResult(_0x5b0995,_0x4ff4a2))[_0x8b16('0x2e')](handleError(_0x5b0995,null));};function iftimePromise(_0x473a35,_0x29147c){return respondWithRpcPromise(_0x8b16('0xec'),_0x8b16('0xed'),{'command':_0x29147c[_0x8b16('0xee')]?util[_0x8b16('0xb7')](_0x8b16('0xef'),_0x473a35[_0x8b16('0xf0')],_0x29147c['timezone']):util[_0x8b16('0xb7')]('iftime\x20%s',_0x473a35[_0x8b16('0xf0')])},client9002)[_0x8b16('0x23')](function(_0x5e0736){var _0x3c9cc3=_0x5e0736&&_0x5e0736['indexOf']('true')>=0x0?!![]:![];logger[_0x8b16('0x24')](_0x8b16('0xf1'),_0x29147c['id'],_0x473a35['id'],_0x473a35[_0x8b16('0xf0')],_0x3c9cc3?_0x8b16('0xf2'):_0x8b16('0xf3'),_0x29147c[_0x8b16('0xee')]?_0x29147c[_0x8b16('0xee')]:'No\x20timezone');return _0x3c9cc3;})[_0x8b16('0x2e')](function(_0x4cb737){logger[_0x8b16('0x2a')](_0x8b16('0xf1'),_0x29147c['id'],_0x473a35['id'],_0x473a35[_0x8b16('0xf0')],util['inspect'](_0x4cb737,{'showHidden':![],'depth':null}),_0x29147c[_0x8b16('0xee')]?_0x29147c['timezone']:_0x8b16('0xf4'));return![];});}exports[_0x8b16('0xed')]=function(_0xbc47a6,_0x55e34a,_0x4a8cf4){var _0x4c2cf0=0x0;var _0x55572f=0x0;var _0x2eb154=![];var _0x5353fe;var _0xeaef09;return db['ChatWebsite'][_0x8b16('0x67')]({'where':{'id':_0xbc47a6['params']['id']},'include':[{'model':db[_0x8b16('0xf5')],'as':'Interval','include':[{'model':db['Interval'],'as':'Intervals','attributes':['id',_0x8b16('0xf0')],'raw':!![]}]}]})[_0x8b16('0x23')](handleEntityNotFound(_0x55e34a,null))[_0x8b16('0x23')](function(_0x200a1a){if(_0x200a1a){_0x5353fe=_0x200a1a;return _0x200a1a[_0x8b16('0xf6')]({'raw':!![]});}})[_0x8b16('0x23')](function(_0x3faa88){if(_0x5353fe){if(_0x3faa88){_0xeaef09=_0x3faa88;}}return require(_0x8b16('0x7d'))[_0x8b16('0xf7')]();})[_0x8b16('0x23')](function(_0x2712d1){if(_0x2712d1){_0x55572f=_0x2712d1[_0x8b16('0xf8')];_0x2eb154=_0x2712d1[_0x8b16('0x7e')];}})['then'](function(){return db[_0x8b16('0xbf')][_0x8b16('0x5a')]({'where':{'closed':![]}});})[_0x8b16('0x23')](function(_0x55c68d){_0x4c2cf0=_0x55c68d;if(_0x55572f&&_0x55c68d>_0x55572f){return db[_0x8b16('0xf9')]['findOne']({'where':{'id':0x1}})['then'](function(_0x432adb){if(_0x432adb){_0x432adb['increment'](_0x8b16('0xfa'));}});}})[_0x8b16('0x23')](function(){if(_0x5353fe['Interval']&&_0x5353fe[_0x8b16('0xf5')][_0x8b16('0xfb')]){var _0x459b21=[];for(var _0x1bee8b=0x0;_0x1bee8b<_0x5353fe[_0x8b16('0xf5')]['Intervals']['length'];_0x1bee8b++){var _0x56857b=_0x5353fe[_0x8b16('0xf5')][_0x8b16('0xfb')][_0x1bee8b]['get']({'plain':!![]});_0x459b21[_0x8b16('0xc6')](iftimePromise(_0x56857b,_0x5353fe));}return BPromise[_0x8b16('0xfc')](_0x459b21)['then'](function(_0x526d14){return _[_0x8b16('0xfd')](_0x526d14);});}else{return!![];}})[_0x8b16('0x23')](function(_0x2f0ca3){var _0x203dde=fs[_0x8b16('0xfe')](path['join'](config[_0x8b16('0x82')],_0x8b16('0xff')),'utf8');var _0x536144={'remote':_0x5353fe['remote'],'query':querystring[_0x8b16('0x29')](_['merge'](_0x5353fe[_0x8b16('0x3a')]({'plain':!![]}),{'customerIp':_0xbc47a6[_0x8b16('0x90')][_0x8b16('0xaf')]||_0xbc47a6['headers']['x-real-ip']||_0xbc47a6[_0x8b16('0x100')]['remoteAddress']||_0xbc47a6['ip'],'referer':_0xbc47a6[_0x8b16('0x90')][_0x8b16('0xb4')],'openedInteractions':_0x4c2cf0,'maxInteractions':_0x55572f,'virtual':_0x2eb154[_0x8b16('0xf8')],'online':_0x2f0ca3,'custom':_0x2eb154}))[_0x8b16('0x101')](/'/g,'\x5c\x27')};_0x55e34a['send'](ejs[_0x8b16('0xd8')](Mustache[_0x8b16('0xd8')](_0x203dde,_0x536144),{'proactiveActions':_0xeaef09,'alignment':_0x5353fe[_0x8b16('0x102')],'verticalAlignment':_0x5353fe[_0x8b16('0x103')],'div_color':_0x5353fe[_0x8b16('0x104')],'text_color':_0x5353fe[_0x8b16('0x105')]}));})['catch'](handleError(_0x55e34a,null));};exports[_0x8b16('0x106')]=function(_0x54f1a8,_0x5dfd6d,_0x1fec19){return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x54f1a8[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x5dfd6d,null))['then'](function(_0x51c52c){if(_0x51c52c){return db[_0x8b16('0x107')][_0x8b16('0x108')](function(_0x36c0b4){return db[_0x8b16('0x109')][_0x8b16('0x39')]({'where':{'ChatWebsiteId':_0x54f1a8[_0x8b16('0x5e')]['id']},'transaction':_0x36c0b4})['then'](function(_0x5981d0){var _0x358014=_[_0x8b16('0x43')](_0x54f1a8['body'],function(_0x2a15ba){_0x2a15ba[_0x8b16('0x6c')]=_0x54f1a8[_0x8b16('0x5e')]['id'];return _0x2a15ba;});return db[_0x8b16('0x109')][_0x8b16('0x10a')](_0x358014,{'transaction':_0x36c0b4});});})[_0x8b16('0x23')](function(){return db[_0x8b16('0x109')][_0x8b16('0x10b')]({'where':{'ChatWebsiteId':_0x54f1a8['params']['id']},'order':_0x8b16('0xaa')});});}})[_0x8b16('0x23')](respondWithResult(_0x5dfd6d,null))[_0x8b16('0x2e')](handleError(_0x5dfd6d,null));};exports['getApplications']=function(_0x28a9d8,_0x39c126,_0x269c81){var _0x4bb339={};var _0x2459eb={};var _0x6c7b5f;var _0x2b1eae;return db['ChatWebsite'][_0x8b16('0x70')]({'where':{'id':_0x28a9d8['params']['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x39c126,null))['then'](function(_0x31b70c){if(_0x31b70c){_0x6c7b5f=_0x31b70c;_0x2459eb[_0x8b16('0x4a')]=_[_0x8b16('0x5f')](db[_0x8b16('0x109')][_0x8b16('0x45')]);_0x2459eb[_0x8b16('0x49')]=_[_0x8b16('0x5f')](_0x28a9d8[_0x8b16('0x49')]);_0x2459eb[_0x8b16('0x54')]=_[_0x8b16('0x4b')](_0x2459eb[_0x8b16('0x4a')],_0x2459eb[_0x8b16('0x49')]);_0x4bb339[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x2459eb[_0x8b16('0x4a')],qs[_0x8b16('0x4c')](_0x28a9d8['query'][_0x8b16('0x4c')]));_0x4bb339[_0x8b16('0x4d')]=_0x4bb339[_0x8b16('0x4d')][_0x8b16('0x4e')]?_0x4bb339[_0x8b16('0x4d')]:_0x2459eb[_0x8b16('0x4a')];_0x4bb339[_0x8b16('0x51')]=qs['sort'](_0x28a9d8[_0x8b16('0x49')]['sort']);_0x4bb339[_0x8b16('0x53')]=qs[_0x8b16('0x54')](_['pick'](_0x28a9d8[_0x8b16('0x49')],_0x2459eb[_0x8b16('0x54')]));if(_0x28a9d8[_0x8b16('0x49')][_0x8b16('0x56')]){_0x4bb339['where']=_[_0x8b16('0x57')](_0x4bb339[_0x8b16('0x53')],{'$or':_[_0x8b16('0x43')](_0x4bb339['attributes'],function(_0x18f402){var _0x3f1278={};_0x3f1278[_0x18f402]={'$like':'%'+_0x28a9d8['query'][_0x8b16('0x56')]+'%'};return _0x3f1278;})});}_0x4bb339=_[_0x8b16('0x57')]({},_0x4bb339,_0x28a9d8[_0x8b16('0x59')]);return _0x6c7b5f['getApplications'](_0x4bb339);}})[_0x8b16('0x23')](function(_0x31036e){if(_0x31036e){_0x2b1eae=_0x31036e['length'];if(!_0x28a9d8[_0x8b16('0x49')][_0x8b16('0x4f')](_0x8b16('0x50'))){_0x4bb339[_0x8b16('0x33')]=qs[_0x8b16('0x33')](_0x28a9d8['query'][_0x8b16('0x33')]);_0x4bb339[_0x8b16('0x32')]=qs['offset'](_0x28a9d8['query'][_0x8b16('0x32')]);}return _0x6c7b5f['getApplications'](_0x4bb339);}})['then'](function(_0x190b6a){if(_0x190b6a){return _0x190b6a?{'count':_0x2b1eae,'rows':_0x190b6a}:null;}})[_0x8b16('0x23')](respondWithResult(_0x39c126,null))[_0x8b16('0x2e')](handleError(_0x39c126,null));};exports[_0x8b16('0x10c')]=function(_0x55548c,_0x88c8f7,_0x3df816){return db[_0x8b16('0x10d')]['find']({'where':{'id':_0x55548c[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x88c8f7,null))[_0x8b16('0x23')](function(_0x2ddb6e){if(_0x2ddb6e){return _0x2ddb6e[_0x8b16('0x10c')](_0x55548c[_0x8b16('0x62')][_0x8b16('0x72')],_['omit'](_0x55548c[_0x8b16('0x62')],[_0x8b16('0x72'),'id'])||{});}})[_0x8b16('0x23')](respondWithResult(_0x88c8f7,null))[_0x8b16('0x2e')](handleError(_0x88c8f7,null));};exports[_0x8b16('0xf6')]=function(_0x26044d,_0x54c1dc,_0x5c5427){var _0x315ce5={};var _0x16c140={};var _0x37e01c;var _0x3e04dc;return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x26044d['params']['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x54c1dc,null))[_0x8b16('0x23')](function(_0x308ed8){if(_0x308ed8){_0x37e01c=_0x308ed8;_0x16c140[_0x8b16('0x4a')]=_[_0x8b16('0x5f')](db['ChatProactiveAction'][_0x8b16('0x45')]);_0x16c140[_0x8b16('0x49')]=_['keys'](_0x26044d[_0x8b16('0x49')]);_0x16c140['filters']=_['intersection'](_0x16c140[_0x8b16('0x4a')],_0x16c140[_0x8b16('0x49')]);_0x315ce5[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x16c140['model'],qs[_0x8b16('0x4c')](_0x26044d[_0x8b16('0x49')][_0x8b16('0x4c')]));_0x315ce5[_0x8b16('0x4d')]=_0x315ce5[_0x8b16('0x4d')][_0x8b16('0x4e')]?_0x315ce5[_0x8b16('0x4d')]:_0x16c140[_0x8b16('0x4a')];_0x315ce5[_0x8b16('0x51')]=qs[_0x8b16('0x52')](_0x26044d[_0x8b16('0x49')][_0x8b16('0x52')]);_0x315ce5['where']=qs[_0x8b16('0x54')](_[_0x8b16('0x55')](_0x26044d[_0x8b16('0x49')],_0x16c140[_0x8b16('0x54')]));if(_0x26044d['query'][_0x8b16('0x56')]){_0x315ce5[_0x8b16('0x53')]=_[_0x8b16('0x57')](_0x315ce5['where'],{'$or':_[_0x8b16('0x43')](_0x315ce5[_0x8b16('0x4d')],function(_0xcf2e3d){var _0x4bce1b={};_0x4bce1b[_0xcf2e3d]={'$like':'%'+_0x26044d['query'][_0x8b16('0x56')]+'%'};return _0x4bce1b;})});}_0x315ce5=_[_0x8b16('0x57')]({},_0x315ce5,_0x26044d['options']);return _0x37e01c['getProactiveActions'](_0x315ce5);}})[_0x8b16('0x23')](function(_0x54c8bb){if(_0x54c8bb){_0x3e04dc=_0x54c8bb[_0x8b16('0x4e')];if(!_0x26044d['query'][_0x8b16('0x4f')]('nolimit')){_0x315ce5['limit']=qs[_0x8b16('0x33')](_0x26044d[_0x8b16('0x49')][_0x8b16('0x33')]);_0x315ce5[_0x8b16('0x32')]=qs['offset'](_0x26044d[_0x8b16('0x49')][_0x8b16('0x32')]);}return _0x37e01c[_0x8b16('0xf6')](_0x315ce5);}})['then'](function(_0xb7447c){if(_0xb7447c){return _0xb7447c?{'count':_0x3e04dc,'rows':_0xb7447c}:null;}})[_0x8b16('0x23')](respondWithResult(_0x54c1dc,null))['catch'](handleError(_0x54c1dc,null));};exports[_0x8b16('0x10e')]=function(_0x148207,_0x3396fd,_0x3998d7){var _0x21d5c2=_0x148207[_0x8b16('0x49')][_0x8b16('0x10f')]==='false'?_0x8b16('0x110'):_0x8b16('0x111');return db[_0x8b16('0x44')][_0x8b16('0x67')]({'attributes':['id',_0x21d5c2],'where':{'id':_0x148207[_0x8b16('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3396fd,null))[_0x8b16('0x23')](function(_0x47dced){if(_0x47dced){var _0x6ce066=_0x47dced[_0x21d5c2];var _0x42b28e=_0x6ce066&&_0x6ce066['items']?_0x6ce066['items']:[];_0x3396fd[_0x8b16('0x40')]({'fromKey':_['isNil'](_0x6ce066[_0x8b16('0x112')])?undefined:_0x6ce066[_0x8b16('0x112')],'count':_0x42b28e[_0x8b16('0x4e')],'rows':_0x42b28e});}})[_0x8b16('0x2e')](handleError(_0x3396fd,null));};exports[_0x8b16('0x113')]=function(_0x43b234,_0xdf536,_0x5bd5df){var _0x4f1dfa={'raw':![],'where':{}};var _0x51d7cc={};var _0x534ee7={'count':0x0,'rows':[]};return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x43b234[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0xdf536,null))[_0x8b16('0x23')](function(_0x56df2d){if(_0x56df2d){_0x51d7cc['model']=_[_0x8b16('0x5f')](db[_0x8b16('0x114')]['rawAttributes']);_0x51d7cc[_0x8b16('0x49')]=_['keys'](_0x43b234[_0x8b16('0x49')]);_0x51d7cc['filters']=_['intersection'](_0x51d7cc[_0x8b16('0x4a')],_0x51d7cc[_0x8b16('0x49')]);_0x4f1dfa['attributes']=_['intersection'](_0x51d7cc[_0x8b16('0x4a')],qs[_0x8b16('0x4c')](_0x43b234[_0x8b16('0x49')][_0x8b16('0x4c')]));_0x4f1dfa[_0x8b16('0x4d')]=_0x4f1dfa[_0x8b16('0x4d')]['length']?_0x4f1dfa[_0x8b16('0x4d')]:_0x51d7cc['model'];if(!_0x43b234['query']['hasOwnProperty'](_0x8b16('0x50'))){_0x4f1dfa[_0x8b16('0x33')]=qs[_0x8b16('0x33')](_0x43b234[_0x8b16('0x49')][_0x8b16('0x33')]);_0x4f1dfa[_0x8b16('0x32')]=qs[_0x8b16('0x32')](_0x43b234[_0x8b16('0x49')][_0x8b16('0x32')]);}_0x4f1dfa[_0x8b16('0x51')]=qs['sort'](_0x43b234[_0x8b16('0x49')][_0x8b16('0x52')]);_0x4f1dfa[_0x8b16('0x53')]=qs[_0x8b16('0x54')](_[_0x8b16('0x55')](_0x43b234[_0x8b16('0x49')],_0x51d7cc['filters']));_0x4f1dfa[_0x8b16('0x53')][_0x8b16('0x6c')]=_0x56df2d['id'];if(_0x43b234[_0x8b16('0x49')][_0x8b16('0x56')]){_0x4f1dfa[_0x8b16('0x53')]=_[_0x8b16('0x57')](_0x4f1dfa[_0x8b16('0x53')],{'$or':_[_0x8b16('0x43')](_0x4f1dfa['attributes'],function(_0x58ed5e){var _0x1d60f3={};_0x1d60f3[_0x58ed5e]={'$like':'%'+_0x43b234[_0x8b16('0x49')][_0x8b16('0x56')]+'%'};return _0x1d60f3;})});}_0x4f1dfa=_[_0x8b16('0x57')]({},_0x4f1dfa,_0x43b234['options']);return db[_0x8b16('0x114')][_0x8b16('0x5a')]({'where':_0x4f1dfa['where']})[_0x8b16('0x23')](function(_0x9c179f){_0x534ee7['count']=_0x9c179f;if(_0x43b234[_0x8b16('0x49')]['includeAll']){_0x4f1dfa['include']=[{'all':!![]}];}else{_0x4f1dfa[_0x8b16('0x60')]=[{'model':db[_0x8b16('0x94')],'as':_0x8b16('0xe9'),'required':![]}];}return db[_0x8b16('0x114')][_0x8b16('0x5c')](_0x4f1dfa);})['then'](function(_0x1fa8f0){_0x534ee7['rows']=_0x1fa8f0;return _0x534ee7;});}})[_0x8b16('0x23')](respondWithFilteredResult(_0xdf536,_0x4f1dfa))[_0x8b16('0x2e')](handleError(_0xdf536,null));};exports[_0x8b16('0x115')]=function(_0x2ad35a,_0x1efbfd,_0xf648fd){return db['ChatWebsite'][_0x8b16('0x67')]({'where':{'id':_0x2ad35a[_0x8b16('0x5e')]['id']}})[_0x8b16('0x23')](handleEntityNotFound(_0x1efbfd,null))['then'](function(_0x459438){if(_0x459438){return _0x459438[_0x8b16('0x115')](_0x2ad35a[_0x8b16('0x62')]['ids'],_['omit'](_0x2ad35a[_0x8b16('0x62')],[_0x8b16('0x72'),'id'])||{})['spread'](function(_0x3f2592){for(var _0x5367ac=0x0;_0x5367ac<_0x2ad35a[_0x8b16('0x62')][_0x8b16('0x72')][_0x8b16('0x4e')];_0x5367ac+=0x1){socket[_0x8b16('0x116')](_0x8b16('0x117'),{'UserId':_0x2ad35a['body']['ids'][_0x5367ac],'ChatWebsiteId':_0x2ad35a[_0x8b16('0x5e')]['id']});}return _0x3f2592;});}})[_0x8b16('0x23')](respondWithResult(_0x1efbfd,null))[_0x8b16('0x2e')](handleError(_0x1efbfd,null));};exports[_0x8b16('0x118')]=function(_0x48ec66,_0x851398,_0x31578a){return db[_0x8b16('0x44')][_0x8b16('0x67')]({'where':{'id':_0x48ec66[_0x8b16('0x5e')]['id']}})['then'](handleEntityNotFound(_0x851398,null))[_0x8b16('0x23')](function(_0xc8db92){if(_0xc8db92){return _0xc8db92['removeAgents'](_0x48ec66[_0x8b16('0x49')][_0x8b16('0x72')])['then'](function(){if(_[_0x8b16('0x119')](_0x48ec66['query'][_0x8b16('0x72')])){for(var _0x181c02=0x0;_0x181c02<_0x48ec66[_0x8b16('0x49')][_0x8b16('0x72')][_0x8b16('0x4e')];_0x181c02+=0x1){socket[_0x8b16('0x116')]('userChatWebsite:remove',{'UserId':Number(_0x48ec66['query']['ids'][_0x181c02]),'ChatWebsiteId':Number(_0x48ec66[_0x8b16('0x5e')]['id'])});}}else{socket[_0x8b16('0x116')](_0x8b16('0x11a'),{'UserId':Number(_0x48ec66[_0x8b16('0x49')][_0x8b16('0x72')]),'ChatWebsiteId':Number(_0x48ec66[_0x8b16('0x5e')]['id'])});}});}})[_0x8b16('0x23')](respondWithStatusCode(_0x851398,null))['catch'](handleError(_0x851398,null));};exports[_0x8b16('0x11b')]=function(_0x4cce9d,_0x38b0fb,_0x17af8f){var _0x2a4d10={};var _0x29bd55={};var _0x2aa577;var _0xf3d478;return db[_0x8b16('0x44')][_0x8b16('0x70')]({'where':{'id':_0x4cce9d['params']['id']}})['then'](handleEntityNotFound(_0x38b0fb,null))[_0x8b16('0x23')](function(_0x1c265e){if(_0x1c265e){_0x2aa577=_0x1c265e;_0x29bd55[_0x8b16('0x4a')]=_[_0x8b16('0x5f')](db['User'][_0x8b16('0x45')]);_0x29bd55[_0x8b16('0x49')]=_[_0x8b16('0x5f')](_0x4cce9d['query']);_0x29bd55[_0x8b16('0x54')]=_[_0x8b16('0x4b')](_0x29bd55[_0x8b16('0x4a')],_0x29bd55[_0x8b16('0x49')]);_0x2a4d10[_0x8b16('0x4d')]=_[_0x8b16('0x4b')](_0x29bd55[_0x8b16('0x4a')],qs['fields'](_0x4cce9d[_0x8b16('0x49')][_0x8b16('0x4c')]));_0x2a4d10['attributes']=_0x2a4d10[_0x8b16('0x4d')][_0x8b16('0x4e')]?_0x2a4d10[_0x8b16('0x4d')]:_0x29bd55[_0x8b16('0x4a')];_0x2a4d10[_0x8b16('0x51')]=qs[_0x8b16('0x52')](_0x4cce9d[_0x8b16('0x49')][_0x8b16('0x52')]);_0x2a4d10[_0x8b16('0x53')]=qs['filters'](_[_0x8b16('0x55')](_0x4cce9d['query'],_0x29bd55[_0x8b16('0x54')]));if(_0x4cce9d[_0x8b16('0x49')]['filter']){_0x2a4d10[_0x8b16('0x53')]=_['merge'](_0x2a4d10['where'],{'$or':_[_0x8b16('0x43')](_0x2a4d10[_0x8b16('0x4d')],function(_0x56d6f1){var _0x55bc8a={};_0x55bc8a[_0x56d6f1]={'$like':'%'+_0x4cce9d['query']['filter']+'%'};return _0x55bc8a;})});}_0x2a4d10=_['merge']({},_0x2a4d10,_0x4cce9d['options']);return _0x2aa577[_0x8b16('0x11b')](_0x2a4d10);}})[_0x8b16('0x23')](function(_0x5af3e8){if(_0x5af3e8){_0xf3d478=_0x5af3e8[_0x8b16('0x4e')];if(!_0x4cce9d[_0x8b16('0x49')][_0x8b16('0x4f')]('nolimit')){_0x2a4d10['limit']=qs[_0x8b16('0x33')](_0x4cce9d[_0x8b16('0x49')]['limit']);_0x2a4d10[_0x8b16('0x32')]=qs['offset'](_0x4cce9d[_0x8b16('0x49')]['offset']);}return _0x2aa577[_0x8b16('0x11b')](_0x2a4d10);}})[_0x8b16('0x23')](function(_0x48eb5d){if(_0x48eb5d){return _0x48eb5d?{'count':_0xf3d478,'rows':_0x48eb5d}:null;}})[_0x8b16('0x23')](respondWithResult(_0x38b0fb,null))[_0x8b16('0x2e')](handleError(_0x38b0fb,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index da80253..11076a5 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 _0x5270=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x11f418,_0x16283a){var _0x5d7f70=function(_0x24ba86){while(--_0x24ba86){_0x11f418['push'](_0x11f418['shift']());}};_0x5d7f70(++_0x16283a);}(_0x5270,0xab));var _0x0527=function(_0x29a945,_0x3a5c45){_0x29a945=_0x29a945-0x0;var _0x3d4f54=_0x5270[_0x29a945];return _0x3d4f54;};'use strict';var EventEmitter=require(_0x0527('0x0'));var ChatWebsite=require(_0x0527('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x0527('0x2')](0x0);var events={'afterCreate':_0x0527('0x3'),'afterUpdate':_0x0527('0x4'),'afterDestroy':'remove'};function emitEvent(_0x237922){return function(_0x254089,_0x3dc04d,_0x1bace3){ChatWebsiteEvents['emit'](_0x237922+':'+_0x254089['id'],_0x254089);ChatWebsiteEvents[_0x0527('0x5')](_0x237922,_0x254089);_0x1bace3(null);};}for(var e in events){if(events[_0x0527('0x6')](e)){var event=events[e];ChatWebsite[_0x0527('0x7')](e,emitEvent(event));}}module[_0x0527('0x8')]=ChatWebsiteEvents; \ No newline at end of file +var _0xef1c=['setMaxListeners','save','update','remove','emit','hook','events','../../mysqldb'];(function(_0x1a1fbd,_0x266bbf){var _0x2361a0=function(_0x4442bd){while(--_0x4442bd){_0x1a1fbd['push'](_0x1a1fbd['shift']());}};_0x2361a0(++_0x266bbf);}(_0xef1c,0x176));var _0xcef1=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xef1c[_0x397e5f];return _0x5302b8;};'use strict';var EventEmitter=require(_0xcef1('0x0'));var ChatWebsite=require(_0xcef1('0x1'))['db']['ChatWebsite'];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xcef1('0x2')](0x0);var events={'afterCreate':_0xcef1('0x3'),'afterUpdate':_0xcef1('0x4'),'afterDestroy':_0xcef1('0x5')};function emitEvent(_0x34a1ce){return function(_0x3872e2,_0x58f00c,_0x1e6fd3){ChatWebsiteEvents[_0xcef1('0x6')](_0x34a1ce+':'+_0x3872e2['id'],_0x3872e2);ChatWebsiteEvents[_0xcef1('0x6')](_0x34a1ce,_0x3872e2);_0x1e6fd3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xcef1('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 329f951..d1f2bde 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 _0xd139=['rimraf','../../config/environment','./chatWebsite.attributes','ChatWebsite','lodash','util','moment','bluebird','request-promise','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd139,0x14e));var _0x9d13=function(_0x37b20d,_0x181dba){_0x37b20d=_0x37b20d-0x0;var _0x1af5cc=_0xd139[_0x37b20d];return _0x1af5cc;};'use strict';var _=require(_0x9d13('0x0'));var util=require(_0x9d13('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x9d13('0x2'));var BPromise=require(_0x9d13('0x3'));var rp=require(_0x9d13('0x4'));var fs=require('fs');var path=require(_0x9d13('0x5'));var rimraf=require(_0x9d13('0x6'));var config=require(_0x9d13('0x7'));var attributes=require(_0x9d13('0x8'));module['exports']=function(_0x4c8e60,_0x2918eb){return _0x4c8e60['define'](_0x9d13('0x9'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bca=['ChatWebsite','chat_websites','util','moment','request-promise','path','rimraf','./chatWebsite.attributes','exports'];(function(_0x4321d7,_0x4db446){var _0x558610=function(_0x4e75d1){while(--_0x4e75d1){_0x4321d7['push'](_0x4321d7['shift']());}};_0x558610(++_0x4db446);}(_0x1bca,0xb6));var _0xa1bc=function(_0x309288,_0x51468f){_0x309288=_0x309288-0x0;var _0x9d03c1=_0x1bca[_0x309288];return _0x9d03c1;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));module[_0xa1bc('0x6')]=function(_0x168b44,_0x268ced){return _0x168b44['define'](_0xa1bc('0x7'),attributes,{'tableName':_0xa1bc('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index d142c94..a750612 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 _0x7a54=['result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','defaults','redis','socket.io-emitter','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7a54,0x106));var _0x47a5=function(_0x2b616b,_0x212cb5){_0x2b616b=_0x2b616b-0x0;var _0x259cef=_0x7a54[_0x2b616b];return _0x259cef;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});config['redis']=_[_0x47a5('0xb')](config[_0x47a5('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x47a5('0xd'))(new Redis(config['redis']));require('./chatWebsite.socket')['register'](socket);function respondWithRpcPromise(_0x2a0e98,_0x2baee7,_0x5e31dd){return new BPromise(function(_0x2eb0dd,_0x49e844){return client['request'](_0x2a0e98,_0x5e31dd)[_0x47a5('0xe')](function(_0x69e4d4){logger[_0x47a5('0xf')](_0x47a5('0x10'),_0x2baee7,_0x47a5('0x11'));logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x2baee7,'request\x20sent',JSON[_0x47a5('0x14')](_0x69e4d4));if(_0x69e4d4[_0x47a5('0x15')]){if(_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x16')]===0x1f4){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x49e844(_0x69e4d4['error'][_0x47a5('0x17')]);}logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x69e4d4[_0x47a5('0x15')][_0x47a5('0x17')]);return _0x2eb0dd(_0x69e4d4['error']['message']);}else{logger[_0x47a5('0xf')]('ChatWebsite,\x20%s,\x20%s',_0x2baee7,'request\x20sent');_0x2eb0dd(_0x69e4d4[_0x47a5('0x18')][_0x47a5('0x17')]);}})[_0x47a5('0x19')](function(_0x1ef371){logger[_0x47a5('0x15')](_0x47a5('0x10'),_0x2baee7,_0x1ef371);_0x49e844(_0x1ef371);});});} \ No newline at end of file +var _0x1a37=['rpc','jayson/promise','http','redis','defaults','register','request','then','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatWebsite,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x53fb63,_0x2497b0){var _0x3fd488=function(_0x41848a){while(--_0x41848a){_0x53fb63['push'](_0x53fb63['shift']());}};_0x3fd488(++_0x2497b0);}(_0x1a37,0xb4));var _0x71a3=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x1a37[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var moment=require(_0x71a3('0x2'));var BPromise=require(_0x71a3('0x3'));var rs=require(_0x71a3('0x4'));var fs=require('fs');var Redis=require(_0x71a3('0x5'));var db=require(_0x71a3('0x6'))['db'];var utils=require(_0x71a3('0x7'));var logger=require(_0x71a3('0x8'))(_0x71a3('0x9'));var config=require('../../config/environment');var jayson=require(_0x71a3('0xa'));var client=jayson['client'][_0x71a3('0xb')]({'port':0x232a});config[_0x71a3('0xc')]=_[_0x71a3('0xd')](config[_0x71a3('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./chatWebsite.socket')[_0x71a3('0xe')](socket);function respondWithRpcPromise(_0x18320a,_0x3709bc,_0x3aeb48){return new BPromise(function(_0x3a7fc1,_0x2215f2){return client[_0x71a3('0xf')](_0x18320a,_0x3aeb48)[_0x71a3('0x10')](function(_0x5c464c){logger['info']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x71a3('0x11'));logger[_0x71a3('0x12')](_0x71a3('0x13'),_0x3709bc,_0x71a3('0x11'),JSON[_0x71a3('0x14')](_0x5c464c));if(_0x5c464c[_0x71a3('0x15')]){if(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x16')]===0x1f4){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5c464c[_0x71a3('0x15')]['message']);return _0x2215f2(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3709bc,_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);return _0x3a7fc1(_0x5c464c[_0x71a3('0x15')][_0x71a3('0x18')]);}else{logger[_0x71a3('0x19')](_0x71a3('0x17'),_0x3709bc,'request\x20sent');_0x3a7fc1(_0x5c464c[_0x71a3('0x1a')][_0x71a3('0x18')]);}})['catch'](function(_0x5f4562){logger[_0x71a3('0x15')](_0x71a3('0x17'),_0x3709bc,_0x5f4562);_0x2215f2(_0x5f4562);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 8124586..f9aa723 100644 --- a/server/api/chatWebsite/chatWebsite.socket.js +++ b/server/api/chatWebsite/chatWebsite.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['emit','removeListener','register','chatWebsite:','./chatWebsite.events','remove','update'];(function(_0xc6299d,_0x4e893e){var _0x278de4=function(_0xe71f61){while(--_0xe71f61){_0xc6299d['push'](_0xc6299d['shift']());}};_0x278de4(++_0x4e893e);}(_0xb10b,0x12a));var _0xbb10=function(_0x2ce4bb,_0x4bc632){_0x2ce4bb=_0x2ce4bb-0x0;var _0x19356b=_0xb10b[_0x2ce4bb];return _0x19356b;};'use strict';var ChatWebsiteEvents=require(_0xbb10('0x0'));var events=['save',_0xbb10('0x1'),_0xbb10('0x2')];function createListener(_0x1dcb08,_0x4d688c){return function(_0x4541ae){_0x4d688c[_0xbb10('0x3')](_0x1dcb08,_0x4541ae);};}function removeListener(_0x460981,_0x22320e){return function(){ChatWebsiteEvents[_0xbb10('0x4')](_0x460981,_0x22320e);};}exports[_0xbb10('0x5')]=function(_0x481979){for(var _0x328583=0x0,_0x3cdd53=events['length'];_0x328583<_0x3cdd53;_0x328583++){var _0x1b9e94=events[_0x328583];var _0x3fb675=createListener(_0xbb10('0x6')+_0x1b9e94,_0x481979);ChatWebsiteEvents['on'](_0x1b9e94,_0x3fb675);}}; \ No newline at end of file +var _0x5f2f=['remove','update','emit','removeListener','register','length','chatWebsite:','./chatWebsite.events','save'];(function(_0x4c9f76,_0x5e0403){var _0x551afe=function(_0x1a3d2a){while(--_0x1a3d2a){_0x4c9f76['push'](_0x4c9f76['shift']());}};_0x551afe(++_0x5e0403);}(_0x5f2f,0x73));var _0xf5f2=function(_0x12258d,_0x11ff9a){_0x12258d=_0x12258d-0x0;var _0x3f322c=_0x5f2f[_0x12258d];return _0x3f322c;};'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 c1d7c23..cf32986 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 _0x1aed=['addDisposition','addAnswer','join','server/files/images/logos/','now','/:id/logo','single','file','diskStorage','server/files/images/avatars/','format','originalname','addAvatar','%s-%s','root','addSystemAvatar','/:id/notify','notify','/:id/offline','offline','addInteraction','addApplications','/:id/proactive_actions','addProactiveActions','addAgents','put','update','delete','destroy','/:id/canned_answers','removeAnswers','removeAgents','exports','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/:id/dispositions','getAnswers','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','/:id/interactions','getInteractions','/:id/snippet','/:id/applications','getApplications','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create'];(function(_0x3f25d5,_0x31d352){var _0xd9b7c5=function(_0xfc38db){while(--_0xfc38db){_0x3f25d5['push'](_0x3f25d5['shift']());}};_0xd9b7c5(++_0x31d352);}(_0x1aed,0x121));var _0xd1ae=function(_0x1c4733,_0x5f038e){_0x1c4733=_0x1c4733-0x0;var _0x59f00c=_0x1aed[_0x1c4733];return _0x59f00c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xd1ae('0x0'));var express=require(_0xd1ae('0x1'));var router=express[_0xd1ae('0x2')]();var auth=require(_0xd1ae('0x3'));var interaction=require(_0xd1ae('0x4'));var config=require(_0xd1ae('0x5'));var controller=require('./chatWebsite.controller');router[_0xd1ae('0x6')]('/',auth['isAuthenticated'](),controller[_0xd1ae('0x7')]);router[_0xd1ae('0x6')](_0xd1ae('0x8'),auth[_0xd1ae('0x9')](),controller['describe']);router['get'](_0xd1ae('0xa'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0xb')]);router[_0xd1ae('0x6')](_0xd1ae('0xc'),auth[_0xd1ae('0x9')](),controller['getDispositions']);router[_0xd1ae('0x6')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0xd1ae('0xd')]);router[_0xd1ae('0x6')]('/:id/logo',controller['getLogo']);router['get'](_0xd1ae('0xe'),controller[_0xd1ae('0xf')]);router['get'](_0xd1ae('0x10'),controller['getCustomerAvatar']);router[_0xd1ae('0x6')](_0xd1ae('0x11'),controller['getSystemAvatar']);router[_0xd1ae('0x6')](_0xd1ae('0x12'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x13')]);router['get'](_0xd1ae('0x14'),controller['getSnippet']);router[_0xd1ae('0x6')](_0xd1ae('0x15'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x16')]);router[_0xd1ae('0x6')]('/:id/proactive_actions',auth['isAuthenticated'](),controller['getProactiveActions']);router[_0xd1ae('0x6')](_0xd1ae('0x17'),controller[_0xd1ae('0x18')]);router['get'](_0xd1ae('0x19'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x1a')]);router['get'](_0xd1ae('0x1b'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x1c')]);router[_0xd1ae('0x1d')]('/',auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x1e')]);router['post'](_0xd1ae('0xc'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x1f')]);router[_0xd1ae('0x1d')]('/:id/canned_answers',auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x26150a,_0x530eca,_0x198ffb){_0x198ffb(null,path[_0xd1ae('0x21')](config['root'],_0xd1ae('0x22')));},'filename':function(_0x3f02fb,_0x25766b,_0x499fa7){_0x499fa7(null,util['format']('%s-%s',Date[_0xd1ae('0x23')](),_0x25766b['originalname']));}})});router[_0xd1ae('0x1d')](_0xd1ae('0x24'),upload[_0xd1ae('0x25')](_0xd1ae('0x26')),controller['addLogo']);var upload=multer({'storage':multer[_0xd1ae('0x27')]({'destination':function(_0x538eb5,_0xb142ee,_0x39646a){_0x39646a(null,path[_0xd1ae('0x21')](config['root'],_0xd1ae('0x28')));},'filename':function(_0x55ba0a,_0x58e393,_0x481121){_0x481121(null,util[_0xd1ae('0x29')]('%s-%s',Date[_0xd1ae('0x23')](),_0x58e393[_0xd1ae('0x2a')]));}})});router[_0xd1ae('0x1d')](_0xd1ae('0xe'),upload[_0xd1ae('0x25')](_0xd1ae('0x26')),controller[_0xd1ae('0x2b')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xd8860,_0x2fba9d,_0x2e5045){_0x2e5045(null,path[_0xd1ae('0x21')](config['root'],_0xd1ae('0x28')));},'filename':function(_0x35c80a,_0x2e015f,_0x4982a8){_0x4982a8(null,util[_0xd1ae('0x29')](_0xd1ae('0x2c'),Date[_0xd1ae('0x23')](),_0x2e015f[_0xd1ae('0x2a')]));}})});router[_0xd1ae('0x1d')](_0xd1ae('0x10'),upload[_0xd1ae('0x25')](_0xd1ae('0x26')),controller['addCustomerAvatar']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2ab018,_0x20c2d4,_0x3696a9){_0x3696a9(null,path['join'](config[_0xd1ae('0x2d')],_0xd1ae('0x28')));},'filename':function(_0xbbe5c,_0x1fc3bc,_0x588d68){_0x588d68(null,util[_0xd1ae('0x29')](_0xd1ae('0x2c'),Date[_0xd1ae('0x23')](),_0x1fc3bc[_0xd1ae('0x2a')]));}})});router[_0xd1ae('0x1d')](_0xd1ae('0x11'),upload[_0xd1ae('0x25')]('file'),controller[_0xd1ae('0x2e')]);router[_0xd1ae('0x1d')](_0xd1ae('0x2f'),controller[_0xd1ae('0x30')]);router[_0xd1ae('0x1d')](_0xd1ae('0x31'),controller[_0xd1ae('0x32')]);router[_0xd1ae('0x1d')]('/:id/interactions',auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x33')]);router['post']('/:id/applications',auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x34')]);router[_0xd1ae('0x1d')](_0xd1ae('0x35'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x36')]);router['post'](_0xd1ae('0x1b'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x37')]);router[_0xd1ae('0x38')](_0xd1ae('0xa'),auth['isAuthenticated'](),controller[_0xd1ae('0x39')]);router[_0xd1ae('0x3a')](_0xd1ae('0xa'),auth['isAuthenticated'](),controller[_0xd1ae('0x3b')]);router[_0xd1ae('0x3a')]('/:id/dispositions',auth[_0xd1ae('0x9')](),controller['removeDispositions']);router[_0xd1ae('0x3a')](_0xd1ae('0x3c'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x3d')]);router[_0xd1ae('0x3a')](_0xd1ae('0x1b'),auth[_0xd1ae('0x9')](),controller[_0xd1ae('0x3e')]);module[_0xd1ae('0x3f')]=router; \ No newline at end of file +var _0x76e0=['addCustomerAvatar','originalname','single','/:id/offline','offline','addInteraction','addApplications','update','delete','destroy','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatWebsite.controller','index','get','/describe','isAuthenticated','/:id','show','getDispositions','/:id/canned_answers','getAnswers','/:id/logo','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','getSystemAvatar','/:id/interactions','getSnippet','/:id/applications','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post','addAnswer','diskStorage','server/files/images/logos/','format','%s-%s','now','file','join','root','server/files/images/avatars/','/:id/avatar','addAvatar'];(function(_0x345dd0,_0x16f4eb){var _0x3f0320=function(_0x930094){while(--_0x930094){_0x345dd0['push'](_0x345dd0['shift']());}};_0x3f0320(++_0x16f4eb);}(_0x76e0,0x18d));var _0x076e=function(_0x38870a,_0x537c99){_0x38870a=_0x38870a-0x0;var _0x828eec=_0x76e0[_0x38870a];return _0x828eec;};'use strict';var multer=require(_0x076e('0x0'));var util=require(_0x076e('0x1'));var path=require(_0x076e('0x2'));var timeout=require(_0x076e('0x3'));var express=require(_0x076e('0x4'));var router=express[_0x076e('0x5')]();var auth=require(_0x076e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x076e('0x7'));var controller=require(_0x076e('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x076e('0x9')]);router[_0x076e('0xa')](_0x076e('0xb'),auth[_0x076e('0xc')](),controller['describe']);router[_0x076e('0xa')](_0x076e('0xd'),auth[_0x076e('0xc')](),controller[_0x076e('0xe')]);router[_0x076e('0xa')]('/:id/dispositions',auth[_0x076e('0xc')](),controller[_0x076e('0xf')]);router[_0x076e('0xa')](_0x076e('0x10'),auth[_0x076e('0xc')](),controller[_0x076e('0x11')]);router['get'](_0x076e('0x12'),controller[_0x076e('0x13')]);router[_0x076e('0xa')]('/:id/avatar',controller[_0x076e('0x14')]);router[_0x076e('0xa')](_0x076e('0x15'),controller[_0x076e('0x16')]);router[_0x076e('0xa')]('/:id/system_avatar',controller[_0x076e('0x17')]);router[_0x076e('0xa')](_0x076e('0x18'),auth[_0x076e('0xc')](),controller['getInteractions']);router[_0x076e('0xa')]('/:id/snippet',controller[_0x076e('0x19')]);router['get'](_0x076e('0x1a'),auth[_0x076e('0xc')](),controller[_0x076e('0x1b')]);router[_0x076e('0xa')](_0x076e('0x1c'),auth[_0x076e('0xc')](),controller[_0x076e('0x1d')]);router['get'](_0x076e('0x1e'),controller[_0x076e('0x1f')]);router[_0x076e('0xa')](_0x076e('0x20'),auth['isAuthenticated'](),controller['getOfflineMessages']);router[_0x076e('0xa')](_0x076e('0x21'),auth['isAuthenticated'](),controller[_0x076e('0x22')]);router['post']('/',auth[_0x076e('0xc')](),controller[_0x076e('0x23')]);router['post'](_0x076e('0x24'),auth['isAuthenticated'](),controller[_0x076e('0x25')]);router[_0x076e('0x26')](_0x076e('0x10'),auth[_0x076e('0xc')](),controller[_0x076e('0x27')]);var upload=multer({'storage':multer[_0x076e('0x28')]({'destination':function(_0x212c57,_0xad8572,_0x6d5f00){_0x6d5f00(null,path['join'](config['root'],_0x076e('0x29')));},'filename':function(_0x3052de,_0x4f373c,_0x5e6d84){_0x5e6d84(null,util[_0x076e('0x2a')](_0x076e('0x2b'),Date[_0x076e('0x2c')](),_0x4f373c['originalname']));}})});router['post'](_0x076e('0x12'),upload['single'](_0x076e('0x2d')),controller['addLogo']);var upload=multer({'storage':multer[_0x076e('0x28')]({'destination':function(_0x1a8b12,_0x959a93,_0x22fc82){_0x22fc82(null,path[_0x076e('0x2e')](config[_0x076e('0x2f')],_0x076e('0x30')));},'filename':function(_0x3900b8,_0x5bbe0f,_0x448ef5){_0x448ef5(null,util[_0x076e('0x2a')](_0x076e('0x2b'),Date[_0x076e('0x2c')](),_0x5bbe0f['originalname']));}})});router[_0x076e('0x26')](_0x076e('0x31'),upload['single']('file'),controller[_0x076e('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x596d26,_0x580381,_0x546f9a){_0x546f9a(null,path[_0x076e('0x2e')](config[_0x076e('0x2f')],'server/files/images/avatars/'));},'filename':function(_0x1b2f02,_0x4b2497,_0x4f6bc7){_0x4f6bc7(null,util[_0x076e('0x2a')]('%s-%s',Date['now'](),_0x4b2497['originalname']));}})});router[_0x076e('0x26')](_0x076e('0x15'),upload['single'](_0x076e('0x2d')),controller[_0x076e('0x33')]);var upload=multer({'storage':multer[_0x076e('0x28')]({'destination':function(_0xe3fb81,_0x1075de,_0x8f34d0){_0x8f34d0(null,path[_0x076e('0x2e')](config[_0x076e('0x2f')],_0x076e('0x30')));},'filename':function(_0x492639,_0x536076,_0x29ddce){_0x29ddce(null,util[_0x076e('0x2a')](_0x076e('0x2b'),Date[_0x076e('0x2c')](),_0x536076[_0x076e('0x34')]));}})});router[_0x076e('0x26')]('/:id/system_avatar',upload[_0x076e('0x35')](_0x076e('0x2d')),controller['addSystemAvatar']);router[_0x076e('0x26')]('/:id/notify',controller['notify']);router[_0x076e('0x26')](_0x076e('0x36'),controller[_0x076e('0x37')]);router[_0x076e('0x26')](_0x076e('0x18'),auth[_0x076e('0xc')](),controller[_0x076e('0x38')]);router[_0x076e('0x26')](_0x076e('0x1a'),auth[_0x076e('0xc')](),controller[_0x076e('0x39')]);router[_0x076e('0x26')](_0x076e('0x1c'),auth[_0x076e('0xc')](),controller['addProactiveActions']);router['post']('/:id/users',auth[_0x076e('0xc')](),controller['addAgents']);router['put'](_0x076e('0xd'),auth[_0x076e('0xc')](),controller[_0x076e('0x3a')]);router[_0x076e('0x3b')](_0x076e('0xd'),auth['isAuthenticated'](),controller[_0x076e('0x3c')]);router[_0x076e('0x3b')]('/:id/dispositions',auth['isAuthenticated'](),controller['removeDispositions']);router[_0x076e('0x3b')](_0x076e('0x10'),auth['isAuthenticated'](),controller[_0x076e('0x3d')]);router[_0x076e('0x3b')](_0x076e('0x21'),auth[_0x076e('0xc')](),controller[_0x076e('0x3e')]);module[_0x076e('0x3f')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 4b71b23..ccc862a 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 _0x950a=['exports','STRING','name','sequelize'];(function(_0x4e808c,_0x3ebb84){var _0x1db4c6=function(_0x211bbf){while(--_0x211bbf){_0x4e808c['push'](_0x4e808c['shift']());}};_0x1db4c6(++_0x3ebb84);}(_0x950a,0xeb));var _0xa950=function(_0x1e4748,_0x3938a4){_0x1e4748=_0x1e4748-0x0;var _0x3ed610=_0x950a[_0x1e4748];return _0x3ed610;};'use strict';var Sequelize=require(_0xa950('0x0'));module[_0xa950('0x1')]={'name':{'type':Sequelize[_0xa950('0x2')],'unique':_0xa950('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize['STRING']},'website':{'type':Sequelize[_0xa950('0x2')]},'phone':{'type':Sequelize['STRING']},'fax':{'type':Sequelize[_0xa950('0x2')]},'type':{'type':Sequelize[_0xa950('0x2')]},'street':{'type':Sequelize[_0xa950('0x2')]},'postalCode':{'type':Sequelize[_0xa950('0x2')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa950('0x2')]},'email':{'type':Sequelize[_0xa950('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xa950('0x2')]},'sStreet':{'type':Sequelize[_0xa950('0x2')]},'sPostalCode':{'type':Sequelize[_0xa950('0x2')]},'sCity':{'type':Sequelize[_0xa950('0x2')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6c1d=['name','STRING','exports'];(function(_0x103391,_0x2c19a1){var _0x473c50=function(_0x2031d3){while(--_0x2031d3){_0x103391['push'](_0x103391['shift']());}};_0x473c50(++_0x2c19a1);}(_0x6c1d,0x1a9));var _0xd6c1=function(_0x24dc28,_0x187aca){_0x24dc28=_0x24dc28-0x0;var _0x98d80c=_0x6c1d[_0x24dc28];return _0x98d80c;};'use strict';var Sequelize=require('sequelize');module[_0xd6c1('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xd6c1('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xd6c1('0x2')]},'companyId':{'type':Sequelize[_0xd6c1('0x2')]},'website':{'type':Sequelize[_0xd6c1('0x2')]},'phone':{'type':Sequelize[_0xd6c1('0x2')]},'fax':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xd6c1('0x2')]},'street':{'type':Sequelize[_0xd6c1('0x2')]},'postalCode':{'type':Sequelize[_0xd6c1('0x2')]},'city':{'type':Sequelize[_0xd6c1('0x2')]},'country':{'type':Sequelize[_0xd6c1('0x2')]},'email':{'type':Sequelize[_0xd6c1('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize['STRING']},'sStreet':{'type':Sequelize[_0xd6c1('0x2')]},'sPostalCode':{'type':Sequelize['STRING']},'sCity':{'type':Sequelize[_0xd6c1('0x2')]},'sCountry':{'type':Sequelize[_0xd6c1('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 158f72c..a704a80 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 _0xb7e3=['limit','set','Content-Range','apply','reject','then','destroy','Companies','UserProfileResource','error','stack','send','index','CmCompany','describe','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filter','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','name','update','params','CmContact','addContacts','ids','omit','getContacts','sort','map','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset'];(function(_0x556228,_0x21fbed){var _0x24d6a4=function(_0x322ff4){while(--_0x322ff4){_0x556228['push'](_0x556228['shift']());}};_0x24d6a4(++_0x21fbed);}(_0xb7e3,0x12e));var _0x3b7e=function(_0x3e1226,_0x4199d6){_0x3e1226=_0x3e1226-0x0;var _0x1ff634=_0xb7e3[_0x3e1226];return _0x1ff634;};'use strict';var pdf=require(_0x3b7e('0x0'));var emlformat=require(_0x3b7e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x3b7e('0x2'));var jsonpatch=require(_0x3b7e('0x3'));var rp=require(_0x3b7e('0x4'));var moment=require(_0x3b7e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x3b7e('0x6'));var util=require(_0x3b7e('0x7'));var path=require(_0x3b7e('0x8'));var sox=require(_0x3b7e('0x9'));var csv=require(_0x3b7e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x3b7e('0xb'));var squel=require(_0x3b7e('0xc'));var crypto=require(_0x3b7e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3b7e('0xe'));var toCsv=require(_0x3b7e('0xa'));var querystring=require(_0x3b7e('0xf'));var Papa=require(_0x3b7e('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3b7e('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3b7e('0x12'));var logger=require(_0x3b7e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x3b7e('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3ad75e,_0x595c68){_0x595c68=_0x595c68||0xcc;return function(_0x23b6f4){if(_0x23b6f4){return _0x3ad75e[_0x3b7e('0x15')](_0x595c68);}return _0x3ad75e[_0x3b7e('0x16')](_0x595c68)[_0x3b7e('0x17')]();};}function respondWithResult(_0x322819,_0x233953){_0x233953=_0x233953||0xc8;return function(_0xe8227d){if(_0xe8227d){return _0x322819['status'](_0x233953)[_0x3b7e('0x18')](_0xe8227d);}};}function respondWithFilteredResult(_0x38f44c,_0x2e4aa9){return function(_0x2bb7c6){if(_0x2bb7c6){var _0x1ed97f=_0x2bb7c6['count'],_0x10d946=_0x2e4aa9[_0x3b7e('0x19')],_0x1aaac0=_0x2e4aa9[_0x3b7e('0x19')]+_0x2e4aa9[_0x3b7e('0x1a')],_0x53e184;if(_0x1aaac0>=_0x1ed97f){_0x1aaac0=_0x1ed97f;_0x53e184=0xc8;}else{_0x53e184=0xce;}_0x38f44c[_0x3b7e('0x16')](_0x53e184);return _0x38f44c[_0x3b7e('0x1b')](_0x3b7e('0x1c'),_0x10d946+'-'+_0x1aaac0+'/'+_0x1ed97f)[_0x3b7e('0x18')](_0x2bb7c6);}return null;};}function patchUpdates(_0x142d06){return function(_0x353410){try{jsonpatch[_0x3b7e('0x1d')](_0x353410,_0x142d06,!![]);}catch(_0x99977a){return BPromise[_0x3b7e('0x1e')](_0x99977a);}return _0x353410['save']();};}function saveUpdates(_0x2f6235,_0x242ae0){return function(_0x217ac){if(_0x217ac){return _0x217ac['update'](_0x2f6235)[_0x3b7e('0x1f')](function(_0x33fe05){return _0x33fe05;});}return null;};}function removeEntity(_0x1444c0,_0x18959c){return function(_0x458417){if(_0x458417){return _0x458417[_0x3b7e('0x20')]()['then'](function(){var _0x4324c4=_0x458417['get']({'plain':!![]});var _0x2db127=_0x3b7e('0x21');return db[_0x3b7e('0x22')][_0x3b7e('0x20')]({'where':{'type':_0x2db127,'resourceId':_0x4324c4['id']}})[_0x3b7e('0x1f')](function(){return _0x458417;});})[_0x3b7e('0x1f')](function(){_0x1444c0[_0x3b7e('0x16')](0xcc)[_0x3b7e('0x17')]();});}};}function handleEntityNotFound(_0x27d58c,_0x47ff08){return function(_0x35e0df){if(!_0x35e0df){_0x27d58c[_0x3b7e('0x15')](0x194);}return _0x35e0df;};}function handleError(_0x3bc2c7,_0x2f5e9f){_0x2f5e9f=_0x2f5e9f||0x1f4;return function(_0x36b393){logger[_0x3b7e('0x23')](_0x36b393[_0x3b7e('0x24')]);if(_0x36b393['name']){delete _0x36b393['name'];}_0x3bc2c7[_0x3b7e('0x16')](_0x2f5e9f)[_0x3b7e('0x25')](_0x36b393);};}exports[_0x3b7e('0x26')]=function(_0x39c8f1,_0x78b4cf){var _0x3dfe88={},_0x52fde2={},_0x249a42={'count':0x0,'rows':[]};return db[_0x3b7e('0x27')][_0x3b7e('0x28')]()[_0x3b7e('0x1f')](function(_0x3a3c0a){_0x52fde2['model']=_[_0x3b7e('0x29')](_0x3a3c0a);_0x52fde2['query']=_[_0x3b7e('0x29')](_0x39c8f1[_0x3b7e('0x2a')]);_0x52fde2[_0x3b7e('0x2b')]=_[_0x3b7e('0x2c')](_0x52fde2[_0x3b7e('0x2d')],_0x52fde2[_0x3b7e('0x2a')]);_0x3dfe88[_0x3b7e('0x2e')]=_['intersection'](_0x52fde2['model'],qs['fields'](_0x39c8f1['query'][_0x3b7e('0x2f')]));_0x3dfe88[_0x3b7e('0x2e')]=_0x3dfe88[_0x3b7e('0x2e')][_0x3b7e('0x30')]?_0x3dfe88[_0x3b7e('0x2e')]:_0x52fde2[_0x3b7e('0x2d')];if(!_0x39c8f1[_0x3b7e('0x2a')][_0x3b7e('0x31')](_0x3b7e('0x32'))){_0x3dfe88[_0x3b7e('0x1a')]=qs[_0x3b7e('0x1a')](_0x39c8f1[_0x3b7e('0x2a')][_0x3b7e('0x1a')]);_0x3dfe88['offset']=qs[_0x3b7e('0x19')](_0x39c8f1['query'][_0x3b7e('0x19')]);}_0x3dfe88[_0x3b7e('0x33')]=qs['sort'](_0x39c8f1[_0x3b7e('0x2a')]['sort']);_0x3dfe88[_0x3b7e('0x34')]=qs['filters'](_['pick'](_0x39c8f1[_0x3b7e('0x2a')],_0x52fde2[_0x3b7e('0x2b')]));if(_0x39c8f1[_0x3b7e('0x2a')]['filter']){_0x3dfe88[_0x3b7e('0x34')]=_['merge'](_0x3dfe88[_0x3b7e('0x34')],{'$or':_['map'](_0x3dfe88['attributes'],function(_0x2b2166){var _0x127ed9={};_0x127ed9[_0x2b2166]={'$like':'%'+_0x39c8f1[_0x3b7e('0x2a')][_0x3b7e('0x35')]+'%'};return _0x127ed9;})});}_0x3dfe88=_[_0x3b7e('0x36')]({},_0x3dfe88,_0x39c8f1[_0x3b7e('0x37')]);var _0x3ab8be={'where':_0x3dfe88['where']};return db[_0x3b7e('0x27')][_0x3b7e('0x38')](_0x3ab8be)[_0x3b7e('0x1f')](function(_0x35ba14){_0x249a42[_0x3b7e('0x38')]=_0x35ba14;if(_0x39c8f1[_0x3b7e('0x2a')][_0x3b7e('0x39')]){_0x3dfe88[_0x3b7e('0x3a')]=[{'all':!![]}];}return db[_0x3b7e('0x27')][_0x3b7e('0x3b')](_0x3dfe88);})[_0x3b7e('0x1f')](function(_0x888698){_0x249a42[_0x3b7e('0x3c')]=_0x888698;return _0x249a42;})[_0x3b7e('0x1f')](respondWithFilteredResult(_0x78b4cf,_0x3dfe88))[_0x3b7e('0x3d')](handleError(_0x78b4cf,null));})[_0x3b7e('0x3d')](handleError(_0x78b4cf,null));};exports[_0x3b7e('0x3e')]=function(_0x433402,_0x90249f){var _0x130be2={'raw':![],'where':{'id':_0x433402['params']['id']}},_0x591326={};_0x591326[_0x3b7e('0x2d')]=_[_0x3b7e('0x29')](db[_0x3b7e('0x27')]['rawAttributes']);_0x591326['query']=_['keys'](_0x433402[_0x3b7e('0x2a')]);_0x591326[_0x3b7e('0x2b')]=_[_0x3b7e('0x2c')](_0x591326[_0x3b7e('0x2d')],_0x591326[_0x3b7e('0x2a')]);_0x130be2[_0x3b7e('0x2e')]=_['intersection'](_0x591326['model'],qs['fields'](_0x433402[_0x3b7e('0x2a')][_0x3b7e('0x2f')]));_0x130be2['attributes']=_0x130be2[_0x3b7e('0x2e')][_0x3b7e('0x30')]?_0x130be2[_0x3b7e('0x2e')]:_0x591326['model'];if(_0x433402[_0x3b7e('0x2a')][_0x3b7e('0x39')]){_0x130be2[_0x3b7e('0x3a')]=[{'all':!![]}];}_0x130be2=_[_0x3b7e('0x36')]({},_0x130be2,_0x433402[_0x3b7e('0x37')]);return db[_0x3b7e('0x27')][_0x3b7e('0x3f')](_0x130be2)[_0x3b7e('0x1f')](handleEntityNotFound(_0x90249f,null))[_0x3b7e('0x1f')](respondWithResult(_0x90249f,null))[_0x3b7e('0x3d')](handleError(_0x90249f,null));};exports[_0x3b7e('0x40')]=function(_0x495902,_0x54ea1d){return db[_0x3b7e('0x27')][_0x3b7e('0x40')](_0x495902[_0x3b7e('0x41')],{})['then'](function(_0x10cc6d){var _0x4b5c53=_0x495902[_0x3b7e('0x42')][_0x3b7e('0x43')]({'plain':!![]});if(!_0x4b5c53)throw new Error(_0x3b7e('0x44'));if(_0x4b5c53[_0x3b7e('0x45')]==='user'){var _0x560150=_0x10cc6d[_0x3b7e('0x43')]({'plain':!![]});var _0xdc9be5=_0x3b7e('0x21');return db[_0x3b7e('0x46')]['find']({'where':{'name':_0xdc9be5,'userProfileId':_0x4b5c53[_0x3b7e('0x47')]},'raw':!![]})[_0x3b7e('0x1f')](function(_0x395f38){if(_0x395f38&&_0x395f38['autoAssociation']===0x0){return db[_0x3b7e('0x22')][_0x3b7e('0x40')]({'name':_0x560150[_0x3b7e('0x48')],'resourceId':_0x560150['id'],'type':_0x395f38[_0x3b7e('0x48')],'sectionId':_0x395f38['id']},{})['then'](function(){return _0x10cc6d;});}else{return _0x10cc6d;}})[_0x3b7e('0x3d')](function(_0x40a00b){logger[_0x3b7e('0x23')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x40a00b);throw _0x40a00b;});}return _0x10cc6d;})[_0x3b7e('0x1f')](respondWithResult(_0x54ea1d,0xc9))['catch'](handleError(_0x54ea1d,null));};exports[_0x3b7e('0x49')]=function(_0x5c1a84,_0x26818f){if(_0x5c1a84[_0x3b7e('0x41')]['id']){delete _0x5c1a84['body']['id'];}return db[_0x3b7e('0x27')][_0x3b7e('0x3f')]({'where':{'id':_0x5c1a84['params']['id']}})[_0x3b7e('0x1f')](handleEntityNotFound(_0x26818f,null))[_0x3b7e('0x1f')](saveUpdates(_0x5c1a84[_0x3b7e('0x41')],null))[_0x3b7e('0x1f')](respondWithResult(_0x26818f,null))[_0x3b7e('0x3d')](handleError(_0x26818f,null));};exports[_0x3b7e('0x20')]=function(_0x1ed12b,_0x318b35){return db[_0x3b7e('0x27')][_0x3b7e('0x3f')]({'where':{'id':_0x1ed12b[_0x3b7e('0x4a')]['id']}})[_0x3b7e('0x1f')](handleEntityNotFound(_0x318b35,null))[_0x3b7e('0x1f')](removeEntity(_0x318b35,null))[_0x3b7e('0x3d')](handleError(_0x318b35,null));};exports[_0x3b7e('0x28')]=function(_0x17b988,_0x290300){return db[_0x3b7e('0x27')][_0x3b7e('0x28')]()[_0x3b7e('0x1f')](respondWithResult(_0x290300,null))[_0x3b7e('0x3d')](handleError(_0x290300,null));};exports['addContacts']=function(_0x9f2956,_0x1512df,_0x36d379){return db[_0x3b7e('0x4b')][_0x3b7e('0x3f')]({'where':{'id':_0x9f2956[_0x3b7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1512df,null))[_0x3b7e('0x1f')](function(_0x158ee2){if(_0x158ee2){return _0x158ee2[_0x3b7e('0x4c')](_0x9f2956['body'][_0x3b7e('0x4d')],_[_0x3b7e('0x4e')](_0x9f2956[_0x3b7e('0x41')],['ids','id'])||{});}})[_0x3b7e('0x1f')](respondWithResult(_0x1512df,null))[_0x3b7e('0x3d')](handleError(_0x1512df,null));};exports[_0x3b7e('0x4f')]=function(_0x4fd5e8,_0x5996cb,_0x4e8428){var _0x397b4c={};var _0x1397a0={};var _0x235221;var _0x1cd466;return db[_0x3b7e('0x27')]['findOne']({'where':{'id':_0x4fd5e8[_0x3b7e('0x4a')]['id']}})[_0x3b7e('0x1f')](handleEntityNotFound(_0x5996cb,null))[_0x3b7e('0x1f')](function(_0x25d86a){if(_0x25d86a){_0x235221=_0x25d86a;_0x1397a0[_0x3b7e('0x2d')]=_[_0x3b7e('0x29')](db[_0x3b7e('0x4b')]['rawAttributes']);_0x1397a0[_0x3b7e('0x2a')]=_[_0x3b7e('0x29')](_0x4fd5e8['query']);_0x1397a0[_0x3b7e('0x2b')]=_[_0x3b7e('0x2c')](_0x1397a0[_0x3b7e('0x2d')],_0x1397a0['query']);_0x397b4c['attributes']=_[_0x3b7e('0x2c')](_0x1397a0[_0x3b7e('0x2d')],qs['fields'](_0x4fd5e8[_0x3b7e('0x2a')][_0x3b7e('0x2f')]));_0x397b4c['attributes']=_0x397b4c[_0x3b7e('0x2e')][_0x3b7e('0x30')]?_0x397b4c[_0x3b7e('0x2e')]:_0x1397a0[_0x3b7e('0x2d')];_0x397b4c[_0x3b7e('0x33')]=qs[_0x3b7e('0x50')](_0x4fd5e8[_0x3b7e('0x2a')][_0x3b7e('0x50')]);_0x397b4c[_0x3b7e('0x34')]=qs[_0x3b7e('0x2b')](_['pick'](_0x4fd5e8[_0x3b7e('0x2a')],_0x1397a0[_0x3b7e('0x2b')]));if(_0x4fd5e8[_0x3b7e('0x2a')]['filter']){_0x397b4c['where']=_['merge'](_0x397b4c['where'],{'$or':_[_0x3b7e('0x51')](_0x397b4c['attributes'],function(_0xa0fbae){var _0x8ff088={};_0x8ff088[_0xa0fbae]={'$like':'%'+_0x4fd5e8[_0x3b7e('0x2a')]['filter']+'%'};return _0x8ff088;})});}_0x397b4c=_[_0x3b7e('0x36')]({},_0x397b4c,_0x4fd5e8[_0x3b7e('0x37')]);return _0x235221['getContacts'](_0x397b4c);}})[_0x3b7e('0x1f')](function(_0x4dcd43){if(_0x4dcd43){_0x1cd466=_0x4dcd43[_0x3b7e('0x30')];if(!_0x4fd5e8[_0x3b7e('0x2a')][_0x3b7e('0x31')](_0x3b7e('0x32'))){_0x397b4c[_0x3b7e('0x1a')]=qs[_0x3b7e('0x1a')](_0x4fd5e8[_0x3b7e('0x2a')]['limit']);_0x397b4c[_0x3b7e('0x19')]=qs[_0x3b7e('0x19')](_0x4fd5e8[_0x3b7e('0x2a')]['offset']);}return _0x235221['getContacts'](_0x397b4c);}})['then'](function(_0xe9e993){if(_0xe9e993){return _0xe9e993?{'count':_0x1cd466,'rows':_0xe9e993}:null;}})[_0x3b7e('0x1f')](respondWithResult(_0x5996cb,null))['catch'](handleError(_0x5996cb,null));}; \ No newline at end of file +var _0xa5dd=['body','get','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','ids','omit','getContacts','findOne','sort','pick','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','apply','reject','update','then','destroy','Companies','UserProfileResource','error','name','index','CmCompany','describe','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','where','filters','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','find','create'];(function(_0x5bca19,_0x5e3dd0){var _0x811b8f=function(_0x209828){while(--_0x209828){_0x5bca19['push'](_0x5bca19['shift']());}};_0x811b8f(++_0x5e3dd0);}(_0xa5dd,0x1b3));var _0xda5d=function(_0x24d9e9,_0x1ef9db){_0x24d9e9=_0x24d9e9-0x0;var _0x558526=_0xa5dd[_0x24d9e9];return _0x558526;};'use strict';var pdf=require(_0xda5d('0x0'));var emlformat=require(_0xda5d('0x1'));var rimraf=require(_0xda5d('0x2'));var zipdir=require(_0xda5d('0x3'));var jsonpatch=require(_0xda5d('0x4'));var rp=require(_0xda5d('0x5'));var moment=require(_0xda5d('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xda5d('0x7'));var path=require(_0xda5d('0x8'));var sox=require(_0xda5d('0x9'));var csv=require(_0xda5d('0xa'));var ejs=require(_0xda5d('0xb'));var fs=require('fs');var _=require(_0xda5d('0xc'));var squel=require(_0xda5d('0xd'));var crypto=require(_0xda5d('0xe'));var jsforce=require(_0xda5d('0xf'));var deskjs=require(_0xda5d('0x10'));var toCsv=require(_0xda5d('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xda5d('0x11'));var authService=require(_0xda5d('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xda5d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda5d('0x14'))(_0xda5d('0x15'));var utils=require(_0xda5d('0x16'));var config=require(_0xda5d('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc41c87,_0xaf7c95){_0xaf7c95=_0xaf7c95||0xcc;return function(_0x577b2f){if(_0x577b2f){return _0xc41c87[_0xda5d('0x18')](_0xaf7c95);}return _0xc41c87[_0xda5d('0x19')](_0xaf7c95)[_0xda5d('0x1a')]();};}function respondWithResult(_0x335b2b,_0x37eb18){_0x37eb18=_0x37eb18||0xc8;return function(_0x1f6eb7){if(_0x1f6eb7){return _0x335b2b[_0xda5d('0x19')](_0x37eb18)['json'](_0x1f6eb7);}};}function respondWithFilteredResult(_0xae7589,_0x5becb4){return function(_0x5e4c49){if(_0x5e4c49){var _0x1b2596=_0x5e4c49[_0xda5d('0x1b')],_0x529733=_0x5becb4[_0xda5d('0x1c')],_0x45da94=_0x5becb4['offset']+_0x5becb4[_0xda5d('0x1d')],_0x1c1cf2;if(_0x45da94>=_0x1b2596){_0x45da94=_0x1b2596;_0x1c1cf2=0xc8;}else{_0x1c1cf2=0xce;}_0xae7589[_0xda5d('0x19')](_0x1c1cf2);return _0xae7589['set'](_0xda5d('0x1e'),_0x529733+'-'+_0x45da94+'/'+_0x1b2596)['json'](_0x5e4c49);}return null;};}function patchUpdates(_0x2ab302){return function(_0x4440a9){try{jsonpatch[_0xda5d('0x1f')](_0x4440a9,_0x2ab302,!![]);}catch(_0x3b1008){return BPromise[_0xda5d('0x20')](_0x3b1008);}return _0x4440a9['save']();};}function saveUpdates(_0x322ae4,_0x4f53d1){return function(_0x4a847b){if(_0x4a847b){return _0x4a847b[_0xda5d('0x21')](_0x322ae4)[_0xda5d('0x22')](function(_0x24a169){return _0x24a169;});}return null;};}function removeEntity(_0x2698bc,_0x3511e4){return function(_0x6c710){if(_0x6c710){return _0x6c710[_0xda5d('0x23')]()['then'](function(){var _0x4680bc=_0x6c710['get']({'plain':!![]});var _0x596be5=_0xda5d('0x24');return db[_0xda5d('0x25')][_0xda5d('0x23')]({'where':{'type':_0x596be5,'resourceId':_0x4680bc['id']}})['then'](function(){return _0x6c710;});})[_0xda5d('0x22')](function(){_0x2698bc[_0xda5d('0x19')](0xcc)[_0xda5d('0x1a')]();});}};}function handleEntityNotFound(_0x3c029e,_0x27c343){return function(_0x25a0de){if(!_0x25a0de){_0x3c029e[_0xda5d('0x18')](0x194);}return _0x25a0de;};}function handleError(_0x5722ff,_0x90b41a){_0x90b41a=_0x90b41a||0x1f4;return function(_0x351113){logger[_0xda5d('0x26')](_0x351113['stack']);if(_0x351113[_0xda5d('0x27')]){delete _0x351113['name'];}_0x5722ff[_0xda5d('0x19')](_0x90b41a)['send'](_0x351113);};}exports[_0xda5d('0x28')]=function(_0x46e6bb,_0x328d15){var _0x38a0b1={},_0x3504de={},_0x1b0d84={'count':0x0,'rows':[]};return db[_0xda5d('0x29')][_0xda5d('0x2a')]()[_0xda5d('0x22')](function(_0xfd0512){_0x3504de[_0xda5d('0x2b')]=_[_0xda5d('0x2c')](_0xfd0512);_0x3504de['query']=_[_0xda5d('0x2c')](_0x46e6bb[_0xda5d('0x2d')]);_0x3504de['filters']=_['intersection'](_0x3504de[_0xda5d('0x2b')],_0x3504de['query']);_0x38a0b1[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x3504de['model'],qs[_0xda5d('0x30')](_0x46e6bb['query'][_0xda5d('0x30')]));_0x38a0b1[_0xda5d('0x2e')]=_0x38a0b1[_0xda5d('0x2e')]['length']?_0x38a0b1['attributes']:_0x3504de['model'];if(!_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x31')](_0xda5d('0x32'))){_0x38a0b1['limit']=qs[_0xda5d('0x1d')](_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x1d')]);_0x38a0b1[_0xda5d('0x1c')]=qs['offset'](_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x1c')]);}_0x38a0b1[_0xda5d('0x33')]=qs['sort'](_0x46e6bb[_0xda5d('0x2d')]['sort']);_0x38a0b1[_0xda5d('0x34')]=qs[_0xda5d('0x35')](_['pick'](_0x46e6bb[_0xda5d('0x2d')],_0x3504de['filters']));if(_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x36')]){_0x38a0b1[_0xda5d('0x34')]=_[_0xda5d('0x37')](_0x38a0b1['where'],{'$or':_[_0xda5d('0x38')](_0x38a0b1[_0xda5d('0x2e')],function(_0x470b7f){var _0x445362={};_0x445362[_0x470b7f]={'$like':'%'+_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x36')]+'%'};return _0x445362;})});}_0x38a0b1=_[_0xda5d('0x37')]({},_0x38a0b1,_0x46e6bb[_0xda5d('0x39')]);var _0x36c746={'where':_0x38a0b1[_0xda5d('0x34')]};return db['CmCompany'][_0xda5d('0x1b')](_0x36c746)['then'](function(_0x321ea4){_0x1b0d84['count']=_0x321ea4;if(_0x46e6bb[_0xda5d('0x2d')][_0xda5d('0x3a')]){_0x38a0b1['include']=[{'all':!![]}];}return db[_0xda5d('0x29')][_0xda5d('0x3b')](_0x38a0b1);})[_0xda5d('0x22')](function(_0x53a0fd){_0x1b0d84[_0xda5d('0x3c')]=_0x53a0fd;return _0x1b0d84;})['then'](respondWithFilteredResult(_0x328d15,_0x38a0b1))[_0xda5d('0x3d')](handleError(_0x328d15,null));})[_0xda5d('0x3d')](handleError(_0x328d15,null));};exports[_0xda5d('0x3e')]=function(_0x6c7b20,_0x501f1b){var _0x31cad3={'raw':![],'where':{'id':_0x6c7b20[_0xda5d('0x3f')]['id']}},_0x29dbd4={};_0x29dbd4[_0xda5d('0x2b')]=_[_0xda5d('0x2c')](db[_0xda5d('0x29')][_0xda5d('0x40')]);_0x29dbd4[_0xda5d('0x2d')]=_[_0xda5d('0x2c')](_0x6c7b20['query']);_0x29dbd4['filters']=_[_0xda5d('0x2f')](_0x29dbd4[_0xda5d('0x2b')],_0x29dbd4[_0xda5d('0x2d')]);_0x31cad3['attributes']=_[_0xda5d('0x2f')](_0x29dbd4[_0xda5d('0x2b')],qs[_0xda5d('0x30')](_0x6c7b20['query'][_0xda5d('0x30')]));_0x31cad3[_0xda5d('0x2e')]=_0x31cad3[_0xda5d('0x2e')][_0xda5d('0x41')]?_0x31cad3[_0xda5d('0x2e')]:_0x29dbd4['model'];if(_0x6c7b20[_0xda5d('0x2d')][_0xda5d('0x3a')]){_0x31cad3[_0xda5d('0x42')]=[{'all':!![]}];}_0x31cad3=_[_0xda5d('0x37')]({},_0x31cad3,_0x6c7b20[_0xda5d('0x39')]);return db['CmCompany'][_0xda5d('0x43')](_0x31cad3)[_0xda5d('0x22')](handleEntityNotFound(_0x501f1b,null))[_0xda5d('0x22')](respondWithResult(_0x501f1b,null))[_0xda5d('0x3d')](handleError(_0x501f1b,null));};exports[_0xda5d('0x44')]=function(_0x101f7d,_0x5d4bd4){return db['CmCompany'][_0xda5d('0x44')](_0x101f7d[_0xda5d('0x45')],{})[_0xda5d('0x22')](function(_0x22985b){var _0x4221fc=_0x101f7d['user'][_0xda5d('0x46')]({'plain':!![]});if(!_0x4221fc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4221fc[_0xda5d('0x47')]===_0xda5d('0x48')){var _0x30a901=_0x22985b[_0xda5d('0x46')]({'plain':!![]});var _0xfb00b2='Companies';return db[_0xda5d('0x49')][_0xda5d('0x43')]({'where':{'name':_0xfb00b2,'userProfileId':_0x4221fc[_0xda5d('0x4a')]},'raw':!![]})[_0xda5d('0x22')](function(_0x242138){if(_0x242138&&_0x242138[_0xda5d('0x4b')]===0x0){return db[_0xda5d('0x25')]['create']({'name':_0x30a901[_0xda5d('0x27')],'resourceId':_0x30a901['id'],'type':_0x242138[_0xda5d('0x27')],'sectionId':_0x242138['id']},{})[_0xda5d('0x22')](function(){return _0x22985b;});}else{return _0x22985b;}})[_0xda5d('0x3d')](function(_0x52af45){logger[_0xda5d('0x26')](_0xda5d('0x4c'),_0x52af45);throw _0x52af45;});}return _0x22985b;})['then'](respondWithResult(_0x5d4bd4,0xc9))[_0xda5d('0x3d')](handleError(_0x5d4bd4,null));};exports[_0xda5d('0x21')]=function(_0x5b703d,_0x31d398){if(_0x5b703d['body']['id']){delete _0x5b703d['body']['id'];}return db[_0xda5d('0x29')][_0xda5d('0x43')]({'where':{'id':_0x5b703d[_0xda5d('0x3f')]['id']}})[_0xda5d('0x22')](handleEntityNotFound(_0x31d398,null))[_0xda5d('0x22')](saveUpdates(_0x5b703d[_0xda5d('0x45')],null))[_0xda5d('0x22')](respondWithResult(_0x31d398,null))['catch'](handleError(_0x31d398,null));};exports[_0xda5d('0x23')]=function(_0x5e9856,_0x3e7258){return db[_0xda5d('0x29')][_0xda5d('0x43')]({'where':{'id':_0x5e9856['params']['id']}})[_0xda5d('0x22')](handleEntityNotFound(_0x3e7258,null))['then'](removeEntity(_0x3e7258,null))['catch'](handleError(_0x3e7258,null));};exports[_0xda5d('0x2a')]=function(_0x29cc88,_0x1a29b4){return db[_0xda5d('0x29')]['describe']()['then'](respondWithResult(_0x1a29b4,null))['catch'](handleError(_0x1a29b4,null));};exports[_0xda5d('0x4d')]=function(_0xd1ec55,_0x4e5ae3,_0x545186){return db['CmContact'][_0xda5d('0x43')]({'where':{'id':_0xd1ec55['params']['id']}})[_0xda5d('0x22')](handleEntityNotFound(_0x4e5ae3,null))[_0xda5d('0x22')](function(_0xcc8208){if(_0xcc8208){return _0xcc8208[_0xda5d('0x4d')](_0xd1ec55[_0xda5d('0x45')][_0xda5d('0x4e')],_[_0xda5d('0x4f')](_0xd1ec55['body'],[_0xda5d('0x4e'),'id'])||{});}})[_0xda5d('0x22')](respondWithResult(_0x4e5ae3,null))['catch'](handleError(_0x4e5ae3,null));};exports[_0xda5d('0x50')]=function(_0xb2a870,_0x111b76,_0x4efa1e){var _0x158da4={};var _0x326a84={};var _0x2900db;var _0x9ff825;return db[_0xda5d('0x29')][_0xda5d('0x51')]({'where':{'id':_0xb2a870['params']['id']}})[_0xda5d('0x22')](handleEntityNotFound(_0x111b76,null))['then'](function(_0x465f69){if(_0x465f69){_0x2900db=_0x465f69;_0x326a84[_0xda5d('0x2b')]=_[_0xda5d('0x2c')](db['CmContact'][_0xda5d('0x40')]);_0x326a84['query']=_[_0xda5d('0x2c')](_0xb2a870[_0xda5d('0x2d')]);_0x326a84[_0xda5d('0x35')]=_['intersection'](_0x326a84[_0xda5d('0x2b')],_0x326a84[_0xda5d('0x2d')]);_0x158da4[_0xda5d('0x2e')]=_[_0xda5d('0x2f')](_0x326a84[_0xda5d('0x2b')],qs['fields'](_0xb2a870[_0xda5d('0x2d')][_0xda5d('0x30')]));_0x158da4[_0xda5d('0x2e')]=_0x158da4[_0xda5d('0x2e')][_0xda5d('0x41')]?_0x158da4['attributes']:_0x326a84[_0xda5d('0x2b')];_0x158da4[_0xda5d('0x33')]=qs[_0xda5d('0x52')](_0xb2a870['query'][_0xda5d('0x52')]);_0x158da4['where']=qs[_0xda5d('0x35')](_[_0xda5d('0x53')](_0xb2a870['query'],_0x326a84[_0xda5d('0x35')]));if(_0xb2a870[_0xda5d('0x2d')][_0xda5d('0x36')]){_0x158da4[_0xda5d('0x34')]=_[_0xda5d('0x37')](_0x158da4[_0xda5d('0x34')],{'$or':_[_0xda5d('0x38')](_0x158da4[_0xda5d('0x2e')],function(_0x264970){var _0x234e07={};_0x234e07[_0x264970]={'$like':'%'+_0xb2a870[_0xda5d('0x2d')][_0xda5d('0x36')]+'%'};return _0x234e07;})});}_0x158da4=_[_0xda5d('0x37')]({},_0x158da4,_0xb2a870[_0xda5d('0x39')]);return _0x2900db[_0xda5d('0x50')](_0x158da4);}})['then'](function(_0x30cf64){if(_0x30cf64){_0x9ff825=_0x30cf64[_0xda5d('0x41')];if(!_0xb2a870['query'][_0xda5d('0x31')](_0xda5d('0x32'))){_0x158da4[_0xda5d('0x1d')]=qs[_0xda5d('0x1d')](_0xb2a870[_0xda5d('0x2d')][_0xda5d('0x1d')]);_0x158da4['offset']=qs[_0xda5d('0x1c')](_0xb2a870[_0xda5d('0x2d')][_0xda5d('0x1c')]);}return _0x2900db[_0xda5d('0x50')](_0x158da4);}})['then'](function(_0x5f140e){if(_0x5f140e){return _0x5f140e?{'count':_0x9ff825,'rows':_0x5f140e}:null;}})[_0xda5d('0x22')](respondWithResult(_0x111b76,null))[_0xda5d('0x3d')](handleError(_0x111b76,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 516d01e..c516e9e 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 _0x0ba7=['cm_companies','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany'];(function(_0xc056fa,_0x134c92){var _0x35573d=function(_0x21ac05){while(--_0x21ac05){_0xc056fa['push'](_0xc056fa['shift']());}};_0x35573d(++_0x134c92);}(_0x0ba7,0x16d));var _0x70ba=function(_0x15a197,_0x6116f6){_0x15a197=_0x15a197-0x0;var _0x529ace=_0x0ba7[_0x15a197];return _0x529ace;};'use strict';var _=require(_0x70ba('0x0'));var util=require('util');var logger=require(_0x70ba('0x1'))(_0x70ba('0x2'));var moment=require(_0x70ba('0x3'));var BPromise=require(_0x70ba('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x70ba('0x5'));var rimraf=require(_0x70ba('0x6'));var config=require(_0x70ba('0x7'));var attributes=require(_0x70ba('0x8'));module[_0x70ba('0x9')]=function(_0x3f9877,_0x17a00c){return _0x3f9877[_0x70ba('0xa')](_0x70ba('0xb'),attributes,{'tableName':_0x70ba('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7a8=['request-promise','rimraf','../../config/environment','./cmCompany.attributes','exports','define','CmCompany','cm_companies','util','../../config/logger','moment','bluebird'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0xb7a8,0xec));var _0x8b7a=function(_0x813845,_0x763acb){_0x813845=_0x813845-0x0;var _0x2eca19=_0xb7a8[_0x813845];return _0x2eca19;};'use strict';var _=require('lodash');var util=require(_0x8b7a('0x0'));var logger=require(_0x8b7a('0x1'))('api');var moment=require(_0x8b7a('0x2'));var BPromise=require(_0x8b7a('0x3'));var rp=require(_0x8b7a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8b7a('0x5'));var config=require(_0x8b7a('0x6'));var attributes=require(_0x8b7a('0x7'));module[_0x8b7a('0x8')]=function(_0x1d61f3,_0x42e4c1){return _0x1d61f3[_0x8b7a('0x9')](_0x8b7a('0xa'),attributes,{'tableName':_0x8b7a('0xb'),'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 9317e67..9462a3f 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 _0xecad=['code','message','result','lodash','moment','bluebird','../../mysqldb','rpc','../../config/environment','client','http','request','then','info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error'];(function(_0x40a11d,_0xf118c8){var _0x3d370d=function(_0xce8f7b){while(--_0xce8f7b){_0x40a11d['push'](_0x40a11d['shift']());}};_0x3d370d(++_0xf118c8);}(_0xecad,0x75));var _0xdeca=function(_0x50d84b,_0x1d7ea7){_0x50d84b=_0x50d84b-0x0;var _0x6d4270=_0xecad[_0x50d84b];return _0x6d4270;};'use strict';var _=require(_0xdeca('0x0'));var util=require('util');var moment=require(_0xdeca('0x1'));var BPromise=require(_0xdeca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdeca('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdeca('0x4'));var config=require(_0xdeca('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xdeca('0x6')][_0xdeca('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x570c3a,_0x38c423,_0x286b87){return new BPromise(function(_0x1f0f69,_0x1d5484){return client[_0xdeca('0x8')](_0x570c3a,_0x286b87)[_0xdeca('0x9')](function(_0x3e2f05){logger[_0xdeca('0xa')](_0xdeca('0xb'),_0x38c423,_0xdeca('0xc'));logger[_0xdeca('0xd')](_0xdeca('0xe'),_0x38c423,_0xdeca('0xc'),JSON['stringify'](_0x3e2f05));if(_0x3e2f05[_0xdeca('0xf')]){if(_0x3e2f05[_0xdeca('0xf')][_0xdeca('0x10')]===0x1f4){logger[_0xdeca('0xf')](_0xdeca('0xb'),_0x38c423,_0x3e2f05[_0xdeca('0xf')]['message']);return _0x1d5484(_0x3e2f05['error'][_0xdeca('0x11')]);}logger[_0xdeca('0xf')](_0xdeca('0xb'),_0x38c423,_0x3e2f05[_0xdeca('0xf')][_0xdeca('0x11')]);return _0x1f0f69(_0x3e2f05[_0xdeca('0xf')]['message']);}else{logger[_0xdeca('0xa')](_0xdeca('0xb'),_0x38c423,'request\x20sent');_0x1f0f69(_0x3e2f05[_0xdeca('0x12')][_0xdeca('0x11')]);}})['catch'](function(_0x1b1e7e){logger[_0xdeca('0xf')]('CmCompany,\x20%s,\x20%s',_0x38c423,_0x1b1e7e);_0x1d5484(_0x1b1e7e);});});} \ No newline at end of file +var _0x0763=['http','request','info','CmCompany,\x20%s,\x20%s','request\x20sent','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x0763,0x172));var _0x3076=function(_0x152fe3,_0x12b0c8){_0x152fe3=_0x152fe3-0x0;var _0xc5bb39=_0x0763[_0x152fe3];return _0xc5bb39;};'use strict';var _=require(_0x3076('0x0'));var util=require(_0x3076('0x1'));var moment=require(_0x3076('0x2'));var BPromise=require(_0x3076('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3076('0x4'));var db=require(_0x3076('0x5'))['db'];var utils=require(_0x3076('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3076('0x7'));var jayson=require(_0x3076('0x8'));var client=jayson[_0x3076('0x9')][_0x3076('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8489,_0x4b284e,_0x236dd3){return new BPromise(function(_0x5f0b8b,_0x20c631){return client[_0x3076('0xb')](_0x2b8489,_0x236dd3)['then'](function(_0x4aa4a3){logger[_0x3076('0xc')](_0x3076('0xd'),_0x4b284e,_0x3076('0xe'));logger['debug'](_0x3076('0xf'),_0x4b284e,'request\x20sent',JSON['stringify'](_0x4aa4a3));if(_0x4aa4a3[_0x3076('0x10')]){if(_0x4aa4a3[_0x3076('0x10')][_0x3076('0x11')]===0x1f4){logger['error'](_0x3076('0xd'),_0x4b284e,_0x4aa4a3[_0x3076('0x10')][_0x3076('0x12')]);return _0x20c631(_0x4aa4a3[_0x3076('0x10')][_0x3076('0x12')]);}logger['error'](_0x3076('0xd'),_0x4b284e,_0x4aa4a3[_0x3076('0x10')]['message']);return _0x5f0b8b(_0x4aa4a3[_0x3076('0x10')][_0x3076('0x12')]);}else{logger[_0x3076('0xc')](_0x3076('0xd'),_0x4b284e,_0x3076('0xe'));_0x5f0b8b(_0x4aa4a3[_0x3076('0x13')]['message']);}})['catch'](function(_0x58f48f){logger[_0x3076('0x10')](_0x3076('0xd'),_0x4b284e,_0x58f48f);_0x20c631(_0x58f48f);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 896c508..5bf4cee 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 _0x82c4=['path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/contacts','getContacts','post','create','addContacts','put','delete','exports','multer','util'];(function(_0x4c3296,_0x262566){var _0x5260de=function(_0x2543c6){while(--_0x2543c6){_0x4c3296['push'](_0x4c3296['shift']());}};_0x5260de(++_0x262566);}(_0x82c4,0x1ca));var _0x482c=function(_0x855e25,_0x5cc86d){_0x855e25=_0x855e25-0x0;var _0x4c2b86=_0x82c4[_0x855e25];return _0x4c2b86;};'use strict';var multer=require(_0x482c('0x0'));var util=require(_0x482c('0x1'));var path=require(_0x482c('0x2'));var timeout=require(_0x482c('0x3'));var express=require(_0x482c('0x4'));var router=express[_0x482c('0x5')]();var auth=require(_0x482c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x482c('0x7'));var controller=require('./cmCompany.controller');router[_0x482c('0x8')]('/',auth['isAuthenticated'](),controller[_0x482c('0x9')]);router['get'](_0x482c('0xa'),auth[_0x482c('0xb')](),controller[_0x482c('0xc')]);router[_0x482c('0x8')](_0x482c('0xd'),auth['isAuthenticated'](),controller[_0x482c('0xe')]);router[_0x482c('0x8')](_0x482c('0xf'),auth[_0x482c('0xb')](),controller[_0x482c('0x10')]);router[_0x482c('0x11')]('/',auth['isAuthenticated'](),controller[_0x482c('0x12')]);router[_0x482c('0x11')](_0x482c('0xf'),auth['isAuthenticated'](),controller[_0x482c('0x13')]);router[_0x482c('0x14')](_0x482c('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x482c('0x15')](_0x482c('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x482c('0x16')]=router; \ No newline at end of file +var _0xc1c6=['multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','show','getContacts','post','/:id/contacts','put','delete','destroy','exports'];(function(_0x20303d,_0x490178){var _0x598cbd=function(_0x1fa142){while(--_0x1fa142){_0x20303d['push'](_0x20303d['shift']());}};_0x598cbd(++_0x490178);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x47c96b,_0x33d301){_0x47c96b=_0x47c96b-0x0;var _0x4ec0d8=_0xc1c6[_0x47c96b];return _0x4ec0d8;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var auth=require(_0x6c1c('0x4'));var interaction=require(_0x6c1c('0x5'));var config=require(_0x6c1c('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x6c1c('0x7')](),controller['index']);router[_0x6c1c('0x8')]('/describe',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x9')]);router[_0x6c1c('0x8')](_0x6c1c('0xa'),auth['isAuthenticated'](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x8')]('/:id/contacts',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0xc')]);router[_0x6c1c('0xd')]('/',auth[_0x6c1c('0x7')](),controller['create']);router[_0x6c1c('0xd')](_0x6c1c('0xe'),auth[_0x6c1c('0x7')](),controller['addContacts']);router[_0x6c1c('0xf')](_0x6c1c('0xa'),auth[_0x6c1c('0x7')](),controller['update']);router[_0x6c1c('0x10')]('/:id',auth[_0x6c1c('0x7')](),controller[_0x6c1c('0x11')]);module[_0x6c1c('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f2029d0..04b48d8 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 _0x7b18=['STRING','TEXT','INTEGER','NOW','lodash','sequelize','exports'];(function(_0x1aa012,_0xab696d){var _0x3c1f56=function(_0x5ddcee){while(--_0x5ddcee){_0x1aa012['push'](_0x1aa012['shift']());}};_0x3c1f56(++_0xab696d);}(_0x7b18,0x7b));var _0x87b1=function(_0x5b6824,_0x50d028){_0x5b6824=_0x5b6824-0x0;var _0x2ffef1=_0x7b18[_0x5b6824];return _0x2ffef1;};'use strict';var _=require(_0x87b1('0x0'));var Sequelize=require(_0x87b1('0x1'));module[_0x87b1('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x87b1('0x3')]},'postalCode':{'type':Sequelize[_0x87b1('0x3')]},'city':{'type':Sequelize[_0x87b1('0x3')]},'country':{'type':Sequelize[_0x87b1('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x87b1('0x4')]},'phone':{'type':Sequelize[_0x87b1('0x3')]},'mobile':{'type':Sequelize[_0x87b1('0x3')]},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'url':{'type':Sequelize[_0x87b1('0x3')]},'facebook':{'type':Sequelize[_0x87b1('0x3')]},'fb_data':{'type':Sequelize[_0x87b1('0x3')]},'twitter':{'type':Sequelize[_0x87b1('0x3')]},'skype':{'type':Sequelize[_0x87b1('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0x87b1('0x3')]},'line':{'type':Sequelize[_0x87b1('0x3')]},'wechat':{'type':Sequelize[_0x87b1('0x3')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0x87b1('0x5')]},'priority':{'type':Sequelize[_0x87b1('0x5')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':Sequelize[_0x87b1('0x6')]}}; \ No newline at end of file +var _0x98da=['INTEGER','UNSIGNED','DATE','NOW','lodash','sequelize','exports','STRING','TEXT'];(function(_0x396289,_0x2e3e55){var _0x1a30e1=function(_0x15f387){while(--_0x15f387){_0x396289['push'](_0x396289['shift']());}};_0x1a30e1(++_0x2e3e55);}(_0x98da,0xe5));var _0xa98d=function(_0x38a801,_0x29d0a9){_0x38a801=_0x38a801-0x0;var _0x5d2991=_0x98da[_0x38a801];return _0x5d2991;};'use strict';var _=require(_0xa98d('0x0'));var Sequelize=require(_0xa98d('0x1'));module[_0xa98d('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa98d('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xa98d('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa98d('0x3')]},'description':{'type':Sequelize[_0xa98d('0x4')]},'phone':{'type':Sequelize[_0xa98d('0x3')]},'mobile':{'type':Sequelize['STRING']},'fax':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xa98d('0x3')]},'url':{'type':Sequelize[_0xa98d('0x3')]},'facebook':{'type':Sequelize[_0xa98d('0x3')]},'fb_data':{'type':Sequelize[_0xa98d('0x3')]},'twitter':{'type':Sequelize[_0xa98d('0x3')]},'skype':{'type':Sequelize[_0xa98d('0x3')]},'teams':{'type':Sequelize['STRING']},'viber':{'type':Sequelize[_0xa98d('0x3')]},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xa98d('0x3')]},'telegram':{'type':Sequelize[_0xa98d('0x3')]},'UserId':{'type':Sequelize[_0xa98d('0x5')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0xa98d('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa98d('0x7')],'defaultValue':Sequelize[_0xa98d('0x8')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index c29ae96..4c7e671 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 _0x4ec1=['conditions','find','value','split','map','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','uc.UserId\x20=\x20?','datetime','castTo','DATE','buildExpression','text','filter','isNil','Contact','isEmpty','ListId','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','tag','isArray','replace','\x27\x27\x27\x27','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','c.id\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','order','DESC','having','resolve','some','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','sequelize','toString','keyBy','merge','c.lastName','c.phone','c.mobile','c.fax','c.ListId','c.deletedAt','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','rows','catch','params','tags','displayName','findAll','columnName','alias','values','body','get','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatMessage','update','ChatOfflineMessage','MailInteraction','SmsInteraction','SmsMessage','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmHopperHistory','ReportAgentPreview','VoiceCallReport','ChatQueueReport','FaxQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','JscriptySessionReport','bulkCreate','each','duplicates','$or','findOrCreate','spread','show','color','omit','format','cf_%d','$and','pickBy','table','id\x20=\x20?','toParam','phone','CmHopper','Tag','rawAttributes','pick','getTags','setTags','ids','getHoppers','ContactId','includeAll','include','options','CmHopperFinal','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','server/files/tmp','file','filename','chmodSync','0777','fork','../../components/import/cm/csv','pid','upload','createReadStream','parse','import','agent','binding','child_process','../../components/import/cm/csv2','stringify','message','start\x20child\x20process\x20correctly!','exit','error\x20child\x20process','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','./cmContact.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','CmContact','describe','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','length','fieldType','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','select','field','from','cm_contacts','left_join','cm_contact_has_tags','ct.CmContactId\x20=\x20c.id','tools_tags','t.id\x20=\x20ct.TagId','c.deletedAt\x20IS\x20NULL','expr','parseSearch','search','sqlOperator'];(function(_0x2cc594,_0x4d727b){var _0x4abff7=function(_0x22b01d){while(--_0x22b01d){_0x2cc594['push'](_0x2cc594['shift']());}};_0x4abff7(++_0x4d727b);}(_0x4ec1,0xa1));var _0x14ec=function(_0x37492c,_0x347305){_0x37492c=_0x37492c-0x0;var _0x389090=_0x4ec1[_0x37492c];return _0x389090;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x14ec('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x14ec('0x1'));var rp=require(_0x14ec('0x2'));var moment=require(_0x14ec('0x3'));var BPromise=require(_0x14ec('0x4'));var Mustache=require('mustache');var util=require(_0x14ec('0x5'));var path=require(_0x14ec('0x6'));var sox=require(_0x14ec('0x7'));var csv=require('to-csv');var ejs=require(_0x14ec('0x8'));var fs=require('fs');var _=require(_0x14ec('0x9'));var squel=require('squel');var crypto=require(_0x14ec('0xa'));var jsforce=require(_0x14ec('0xb'));var deskjs=require(_0x14ec('0xc'));var toCsv=require(_0x14ec('0xd'));var querystring=require('querystring');var Papa=require(_0x14ec('0xe'));var Redis=require('ioredis');var authService=require(_0x14ec('0xf'));var qs=require(_0x14ec('0x10'));var as=require(_0x14ec('0x11'));var hardwareService=require(_0x14ec('0x12'));var logger=require(_0x14ec('0x13'))(_0x14ec('0x14'));var utils=require(_0x14ec('0x15'));var config=require(_0x14ec('0x16'));var db=require('../../mysqldb')['db'];config[_0x14ec('0x17')]=_[_0x14ec('0x18')](config['redis'],{'host':_0x14ec('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x14ec('0x17')]));require(_0x14ec('0x1a'))['register'](socket);function respondWithStatusCode(_0xb42118,_0x4e2a64){_0x4e2a64=_0x4e2a64||0xcc;return function(_0x18133a){if(_0x18133a){return _0xb42118[_0x14ec('0x1b')](_0x4e2a64);}return _0xb42118[_0x14ec('0x1c')](_0x4e2a64)[_0x14ec('0x1d')]();};}function respondWithResult(_0x1ea6f9,_0xd25938){_0xd25938=_0xd25938||0xc8;return function(_0x3046d9){if(_0x3046d9){return _0x1ea6f9[_0x14ec('0x1c')](_0xd25938)[_0x14ec('0x1e')](_0x3046d9);}};}function respondWithFilteredResult(_0x466481,_0x356a9b){return function(_0x3d3057){if(_0x3d3057){var _0x13b6fd=_0x3d3057[_0x14ec('0x1f')],_0x59440c=_0x356a9b[_0x14ec('0x20')],_0x14bdec=_0x356a9b[_0x14ec('0x20')]+_0x356a9b[_0x14ec('0x21')],_0x2fda2e;if(_0x14bdec>=_0x13b6fd){_0x14bdec=_0x13b6fd;_0x2fda2e=0xc8;}else{_0x2fda2e=0xce;}_0x466481['status'](_0x2fda2e);return _0x466481[_0x14ec('0x22')](_0x14ec('0x23'),_0x59440c+'-'+_0x14bdec+'/'+_0x13b6fd)['json'](_0x3d3057);}return null;};}function patchUpdates(_0x175311){return function(_0x503b62){try{jsonpatch[_0x14ec('0x24')](_0x503b62,_0x175311,!![]);}catch(_0x474c72){return BPromise[_0x14ec('0x25')](_0x474c72);}return _0x503b62[_0x14ec('0x26')]();};}function saveUpdates(_0x3095cb,_0x3706f7){return function(_0x478a10){if(_0x478a10){return _0x478a10['update'](_0x3095cb)[_0x14ec('0x27')](function(_0x4a74d7){return _0x4a74d7;});}return null;};}function removeEntity(_0xfebcab,_0x177c87){return function(_0x5e79d0){if(_0x5e79d0){return _0x5e79d0[_0x14ec('0x28')]()[_0x14ec('0x27')](function(){_0xfebcab[_0x14ec('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x25b6a1,_0x554814){return function(_0x12bcb7){if(!_0x12bcb7){_0x25b6a1[_0x14ec('0x1b')](0x194);}return _0x12bcb7;};}function handleError(_0x2cd8ba,_0x286e82){_0x286e82=_0x286e82||0x1f4;return function(_0x4e3e03){logger[_0x14ec('0x29')](_0x4e3e03[_0x14ec('0x2a')]);if(_0x4e3e03[_0x14ec('0x2b')]){delete _0x4e3e03[_0x14ec('0x2b')];}_0x2cd8ba[_0x14ec('0x1c')](_0x286e82)[_0x14ec('0x2c')](_0x4e3e03);};}exports[_0x14ec('0x2d')]=function(_0x4b9af2,_0x51d4e4){var _0x2bdcf2={},_0xe1225e={},_0x49f3bf={'count':0x0,'rows':[]};return db[_0x14ec('0x2e')][_0x14ec('0x2f')]()[_0x14ec('0x27')](function(_0x43c9e8){var _0x32641e=[];for(var _0x1b7a49=0x0;_0x1b7a490x1){_0x4b843c['or'](_0x14ec('0x6c'),qs[_0x14ec('0x6d')](_0x479ebb),null);}else{if(qs['isNumeric'](_0x479ebb)){_0x4b843c['or'](_0x14ec('0x6e'),_0x479ebb+'%');_0x4b843c['or']('c.phone\x20LIKE\x20?',_0x479ebb+'%');_0x4b843c['or'](_0x14ec('0x6f'),_0x479ebb+'%');_0x4b843c['or'](_0x14ec('0x70'),_0x479ebb+'%');}else if(qs['isEmail'](_0x479ebb)){_0x4b843c['or'](_0x14ec('0x71'),_0x479ebb+'%');}else{_0x4b843c['or'](_0x14ec('0x72'),'%'+_0x479ebb+'%');_0x4b843c['or'](_0x14ec('0x73'),'%'+_0x479ebb+'%');_0x4b843c['or'](_0x14ec('0x71'),'%'+_0x479ebb+'%');}}}}_0x2a9208[_0x14ec('0x44')](_0x4b843c);_0x2a9208[_0x14ec('0x74')](_0x14ec('0x75'));var _0x444605={'type':db[_0x14ec('0x76')][_0x14ec('0x77')][_0x14ec('0x78')],'raw':!![]};var _0x44501e=_0x2a9208[_0x14ec('0x79')]()[_0x14ec('0x46')](_0x14ec('0x75'));if(_0x2bdcf2[_0x14ec('0x7a')]){_0x2bdcf2['order']['forEach'](function(_0x332e1a){_0x2a9208[_0x14ec('0x7a')]('c.'+_0x332e1a[0x0],_0x332e1a[0x1]===_0x14ec('0x7b')?![]:!![]);});}if(!_[_0x14ec('0x64')](_0x523c4b)){_0x2a9208[_0x14ec('0x7c')](_0x1ec292);_0x44501e[_0x14ec('0x44')]('t.id\x20IN\x20?',_0x523c4b);}BPromise[_0x14ec('0x7d')]()['then'](function(){if(_0x1d60d3&&!_[_0x14ec('0x7e')](_0x1d60d3[_0x14ec('0x53')],[_0x14ec('0x46'),_0x14ec('0x5a')])){return _0x4b9af2['user'][_0x14ec('0x7f')]({'attributes':['id'],'raw':!![]})[_0x14ec('0x27')](function(_0x46e20f){if(_[_0x14ec('0x64')](_0x46e20f)){_0x44501e['where'](_0x14ec('0x80'));_0x2a9208['where'](_0x14ec('0x80'));}else{_0x44501e[_0x14ec('0x44')](_0x14ec('0x81'),_[_0x14ec('0x57')](_0x46e20f,'id'));_0x2a9208['where'](_0x14ec('0x81'),_['map'](_0x46e20f,'id'));}});}else{return;}})[_0x14ec('0x27')](function(){db[_0x14ec('0x82')]['query'](_0x44501e['toString'](),_0x444605)['then'](function(_0xda8053){_0x49f3bf[_0x14ec('0x1f')]=_0xda8053[_0x14ec('0x38')];if(_0x49f3bf[_0x14ec('0x1f')]===0x0)return[];return db[_0x14ec('0x82')][_0x14ec('0x3b')](_0x412489[_0x14ec('0x83')](),_0x444605);})[_0x14ec('0x27')](function(_0x5de23c){_0x52f51f=_[_0x14ec('0x84')](_0x5de23c,'id');_0x444605=_[_0x14ec('0x85')](_0x444605,{'model':db['CmContact'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4b9af2[_0x14ec('0x3b')][_0x14ec('0x40')]){_0x2bdcf2['attributes'][_0x14ec('0x58')](function(_0x5c9afc){_0x2a9208['field']('c.'+_0x5c9afc);});}else{_0x2a9208[_0x14ec('0x46')](_0x14ec('0x75'));_0x2a9208[_0x14ec('0x46')]('c.firstName');_0x2a9208[_0x14ec('0x46')](_0x14ec('0x86'));_0x2a9208[_0x14ec('0x46')](_0x14ec('0x87'));_0x2a9208['field'](_0x14ec('0x88'));_0x2a9208[_0x14ec('0x46')](_0x14ec('0x89'));_0x2a9208[_0x14ec('0x46')]('c.email');_0x2a9208['field'](_0x14ec('0x8a'));_0x2a9208[_0x14ec('0x46')](_0x14ec('0x8b'));_0x2a9208['field'](_0x14ec('0x8c'),_0x14ec('0x8d'));}if(_0x2bdcf2[_0x14ec('0x21')])_0x2a9208[_0x14ec('0x21')](_0x2bdcf2[_0x14ec('0x21')]);if(_0x2bdcf2[_0x14ec('0x20')])_0x2a9208[_0x14ec('0x20')](_0x2bdcf2['offset']);return db['sequelize'][_0x14ec('0x3b')](_0x2a9208['toString'](),_0x444605);})[_0x14ec('0x27')](function(_0x5c10ed){_0x5c10ed['forEach'](function(_0x10f63b){if(_0x10f63b['TagIds']){_0x10f63b['Tags']=[];_0x10f63b[_0x14ec('0x8d')][_0x14ec('0x56')](',')[_0x14ec('0x58')](function(_0x50f153){_0x10f63b[_0x14ec('0x8e')][_0x14ec('0x33')](_0x52f51f[_0x50f153]);});}delete _0x10f63b['TagIds'];});_0x49f3bf[_0x14ec('0x8f')]=_0x5c10ed;return _0x49f3bf;})[_0x14ec('0x27')](respondWithFilteredResult(_0x51d4e4,_0x2bdcf2));});})[_0x14ec('0x90')](handleError(_0x51d4e4,null));};exports[_0x14ec('0x28')]=function(_0x1d2473,_0x13588f){return db['CmContact'][_0x14ec('0x54')]({'where':{'id':_0x1d2473[_0x14ec('0x91')]['id']}})[_0x14ec('0x27')](handleEntityNotFound(_0x13588f,null))['then'](removeEntity(_0x13588f,null))[_0x14ec('0x90')](handleError(_0x13588f,null));};exports[_0x14ec('0x2f')]=function(_0x3aff79,_0x3be1ea){return db['CmContact'][_0x14ec('0x2f')]()[_0x14ec('0x27')](function(_0x2dbe29){delete _0x2dbe29[_0x14ec('0x92')];for(var _0x459d3e=0x0;_0x459d3e=_0x131efd){_0x22de49=_0x131efd;_0x21da0f=0xc8;}else{_0x21da0f=0xce;}_0x58222e[_0x04ad('0x1e')](_0x21da0f);return _0x58222e[_0x04ad('0x23')](_0x04ad('0x24'),_0x222646+'-'+_0x22de49+'/'+_0x131efd)[_0x04ad('0x20')](_0x345d07);}return null;};}function patchUpdates(_0x116fc2){return function(_0x102fd7){try{jsonpatch['apply'](_0x102fd7,_0x116fc2,!![]);}catch(_0x101d5e){return BPromise['reject'](_0x101d5e);}return _0x102fd7[_0x04ad('0x25')]();};}function saveUpdates(_0x19688f,_0x2b4cee){return function(_0xd91e91){if(_0xd91e91){return _0xd91e91[_0x04ad('0x26')](_0x19688f)[_0x04ad('0x27')](function(_0x446b16){return _0x446b16;});}return null;};}function removeEntity(_0x3fb6a4,_0x58c29c){return function(_0x3939f7){if(_0x3939f7){return _0x3939f7['destroy']()['then'](function(){_0x3fb6a4[_0x04ad('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x351333,_0x493c9e){return function(_0x313bad){if(!_0x313bad){_0x351333[_0x04ad('0x28')](0x194);}return _0x313bad;};}function handleError(_0x4322d7,_0x47e26f){_0x47e26f=_0x47e26f||0x1f4;return function(_0xdb8f4){logger[_0x04ad('0x29')](_0xdb8f4[_0x04ad('0x2a')]);if(_0xdb8f4['name']){delete _0xdb8f4['name'];}_0x4322d7[_0x04ad('0x1e')](_0x47e26f)['send'](_0xdb8f4);};}exports[_0x04ad('0x2b')]=function(_0x2ba266,_0xd347be){var _0x279083={},_0x1d7ac1={},_0x26114b={'count':0x0,'rows':[]};return db[_0x04ad('0x2c')]['describe']()[_0x04ad('0x27')](function(_0x174961){var _0x15e2b2=[];for(var _0x43e839=0x0;_0x43e8390x1){_0x22bd0e['or'](_0x04ad('0x64'),qs[_0x04ad('0x65')](_0x216d1b),null);}else{if(qs[_0x04ad('0x66')](_0x216d1b)){_0x22bd0e['or'](_0x04ad('0x67'),_0x216d1b+'%');_0x22bd0e['or'](_0x04ad('0x68'),_0x216d1b+'%');_0x22bd0e['or'](_0x04ad('0x69'),_0x216d1b+'%');_0x22bd0e['or']('c.fax\x20LIKE\x20?',_0x216d1b+'%');}else if(qs['isEmail'](_0x216d1b)){_0x22bd0e['or'](_0x04ad('0x6a'),_0x216d1b+'%');}else{_0x22bd0e['or'](_0x04ad('0x6b'),'%'+_0x216d1b+'%');_0x22bd0e['or'](_0x04ad('0x6c'),'%'+_0x216d1b+'%');_0x22bd0e['or']('c.email\x20LIKE\x20?','%'+_0x216d1b+'%');}}}}_0x4f4465[_0x04ad('0x3e')](_0x22bd0e);_0x4f4465[_0x04ad('0x6d')](_0x04ad('0x6e'));var _0x4b182f={'type':db[_0x04ad('0x6f')][_0x04ad('0x70')][_0x04ad('0x71')],'raw':!![]};var _0x452bd2=_0x4f4465[_0x04ad('0x72')]()[_0x04ad('0x41')](_0x04ad('0x6e'));if(_0x279083[_0x04ad('0x3c')]){_0x279083[_0x04ad('0x3c')][_0x04ad('0x4e')](function(_0x30a339){_0x4f4465[_0x04ad('0x3c')]('c.'+_0x30a339[0x0],_0x30a339[0x1]===_0x04ad('0x73')?![]:!![]);});}if(!_[_0x04ad('0x5c')](_0x445c2b)){_0x4f4465['having'](_0x5a9704);_0x452bd2['where'](_0x04ad('0x74'),_0x445c2b);}BPromise['resolve']()[_0x04ad('0x27')](function(){if(_0xdb6ff7&&!_[_0x04ad('0x75')](_0xdb6ff7[_0x04ad('0x76')],[_0x04ad('0x41'),_0x04ad('0x51')])){return _0x2ba266[_0x04ad('0x77')][_0x04ad('0x78')]({'attributes':['id'],'raw':!![]})[_0x04ad('0x27')](function(_0x3aea69){if(_[_0x04ad('0x5c')](_0x3aea69)){_0x452bd2['where']('c.ListId\x20IS\x20NULL');_0x4f4465[_0x04ad('0x3e')]('c.ListId\x20IS\x20NULL');}else{_0x452bd2['where']('c.ListId\x20IN\x20?',_[_0x04ad('0x4d')](_0x3aea69,'id'));_0x4f4465[_0x04ad('0x3e')](_0x04ad('0x5d'),_['map'](_0x3aea69,'id'));}});}else{return;}})[_0x04ad('0x27')](function(){db[_0x04ad('0x79')][_0x04ad('0x35')](_0x452bd2[_0x04ad('0x7a')](),_0x4b182f)['then'](function(_0x555f29){_0x26114b[_0x04ad('0x7b')]=_0x555f29['length'];if(_0x26114b[_0x04ad('0x7b')]===0x0)return[];return db[_0x04ad('0x79')]['query'](_0x1437ec['toString'](),_0x4b182f);})['then'](function(_0x5a6dd0){_0xb30fd3=_[_0x04ad('0x7c')](_0x5a6dd0,'id');_0x4b182f=_['merge'](_0x4b182f,{'model':db[_0x04ad('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2ba266[_0x04ad('0x35')][_0x04ad('0x7d')]){_0x279083[_0x04ad('0x39')][_0x04ad('0x4e')](function(_0x18288f){_0x4f4465[_0x04ad('0x41')]('c.'+_0x18288f);});}else{_0x4f4465[_0x04ad('0x41')]('c.id');_0x4f4465['field'](_0x04ad('0x7e'));_0x4f4465['field']('c.lastName');_0x4f4465['field'](_0x04ad('0x7f'));_0x4f4465[_0x04ad('0x41')](_0x04ad('0x80'));_0x4f4465[_0x04ad('0x41')]('c.fax');_0x4f4465[_0x04ad('0x41')](_0x04ad('0x81'));_0x4f4465['field'](_0x04ad('0x82'));_0x4f4465[_0x04ad('0x41')](_0x04ad('0x83'));_0x4f4465[_0x04ad('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x04ad('0x84'));}if(_0x279083['limit'])_0x4f4465[_0x04ad('0x22')](_0x279083[_0x04ad('0x22')]);if(_0x279083['offset'])_0x4f4465[_0x04ad('0x21')](_0x279083[_0x04ad('0x21')]);return db[_0x04ad('0x79')][_0x04ad('0x35')](_0x4f4465[_0x04ad('0x7a')](),_0x4b182f);})['then'](function(_0x405d5b){_0x405d5b[_0x04ad('0x4e')](function(_0x4c44d9){if(_0x4c44d9['TagIds']){_0x4c44d9[_0x04ad('0x85')]=[];_0x4c44d9[_0x04ad('0x84')][_0x04ad('0x63')](',')[_0x04ad('0x4e')](function(_0x275376){_0x4c44d9[_0x04ad('0x85')][_0x04ad('0x2f')](_0xb30fd3[_0x275376]);});}delete _0x4c44d9[_0x04ad('0x84')];});_0x26114b['rows']=_0x405d5b;return _0x26114b;})[_0x04ad('0x27')](respondWithFilteredResult(_0xd347be,_0x279083));});})[_0x04ad('0x86')](handleError(_0xd347be,null));};exports[_0x04ad('0x87')]=function(_0x330c8c,_0x1cc2a2){return db[_0x04ad('0x2c')][_0x04ad('0x4b')]({'where':{'id':_0x330c8c['params']['id']}})['then'](handleEntityNotFound(_0x1cc2a2,null))[_0x04ad('0x27')](removeEntity(_0x1cc2a2,null))[_0x04ad('0x86')](handleError(_0x1cc2a2,null));};exports['describe']=function(_0x23838c,_0x19248b){return db['CmContact'][_0x04ad('0x88')]()[_0x04ad('0x27')](function(_0x5843a6){delete _0x5843a6['tags'];for(var _0x5db2cd=0x0;_0x5db2cd{}\s\\|]/g,'-');_0x3f0257(null,util[_0xe032('0x21')]('%s-%s%s',path[_0xe032('0x22')](_0x4608e4[_0xe032('0x1f')],path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path[_0xe032('0x23')](_0x4608e4[_0xe032('0x1f')])));}})});router[_0xe032('0x16')]('/csv',upload['single']('file'),controller[_0xe032('0x25')]);var upload=multer({'storage':multer[_0xe032('0x1d')]({'destination':function(_0x302559,_0x2a56e5,_0x2bfe8f){_0x2bfe8f(null,path[_0xe032('0x26')](config[_0xe032('0x1e')],_0xe032('0x27')));},'filename':function(_0x4dcbf1,_0x1ac20b,_0x5bb36a){_0x1ac20b[_0xe032('0x1f')]=_0x1ac20b[_0xe032('0x1f')][_0xe032('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5bb36a(null,util[_0xe032('0x21')]('%s-%s%s',path['basename'](_0x1ac20b[_0xe032('0x1f')],path[_0xe032('0x23')](_0x1ac20b[_0xe032('0x1f')])),Date[_0xe032('0x24')](),path['extname'](_0x1ac20b['originalname'])));}})});router['post'](_0xe032('0x28'),upload[_0xe032('0x29')](_0xe032('0x2a')),controller[_0xe032('0x2b')]);router['post'](_0xe032('0x2c'),auth[_0xe032('0x8')](),controller[_0xe032('0x2d')]);router[_0xe032('0x2e')](_0xe032('0xc'),auth['isAuthenticated'](),controller[_0xe032('0x2f')]);router[_0xe032('0x30')](_0xe032('0xc'),auth[_0xe032('0x8')](),controller['destroy']);module[_0xe032('0x31')]=router; \ No newline at end of file +var _0x6aa7=['server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','replace','/upload','upload','/upload/:id','import','put','update','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./cmContact.controller','index','/describe','isAuthenticated','describe','/:id','show','/:id/tags','getTags','get','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperFinals','/:id/jscripty_sessions','/merge','merge','post','create','/create_many','bulkCreate','setTags','diskStorage','join','root'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x6aa7,0x178));var _0x76aa=function(_0x1e7450,_0x593755){_0x1e7450=_0x1e7450-0x0;var _0x2a4d6a=_0x6aa7[_0x1e7450];return _0x2a4d6a;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x76aa('0x5'));var config=require(_0x76aa('0x6'));var controller=require(_0x76aa('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x76aa('0x8')]);router['get'](_0x76aa('0x9'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xb')]);router['get'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xd')]);router['get'](_0x76aa('0xe'),auth[_0x76aa('0xa')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x10')](_0x76aa('0x11'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x12')]);router[_0x76aa('0x10')](_0x76aa('0x13'),auth[_0x76aa('0xa')](),controller['getHopperHistories']);router[_0x76aa('0x10')]('/:id/hopper_finals',auth[_0x76aa('0xa')](),controller[_0x76aa('0x14')]);router[_0x76aa('0x10')](_0x76aa('0x15'),auth[_0x76aa('0xa')](),controller['getJscriptySessions']);router['post'](_0x76aa('0x16'),auth['isAuthenticated'](),controller[_0x76aa('0x17')]);router[_0x76aa('0x18')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router['post'](_0x76aa('0x1a'),auth['isAuthenticated'](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x18')](_0x76aa('0xe'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x1c')]);var upload=multer({'storage':multer[_0x76aa('0x1d')]({'destination':function(_0x496902,_0x5d6202,_0x256636){_0x256636(null,path[_0x76aa('0x1e')](config[_0x76aa('0x1f')],_0x76aa('0x20')));},'filename':function(_0x15109b,_0x191560,_0x19af92){_0x191560[_0x76aa('0x21')]=_0x191560[_0x76aa('0x21')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x19af92(null,util[_0x76aa('0x22')](_0x76aa('0x23'),path[_0x76aa('0x24')](_0x191560['originalname'],path[_0x76aa('0x25')](_0x191560[_0x76aa('0x21')])),Date[_0x76aa('0x26')](),path[_0x76aa('0x25')](_0x191560[_0x76aa('0x21')])));}})});router[_0x76aa('0x18')](_0x76aa('0x27'),upload[_0x76aa('0x28')](_0x76aa('0x29')),controller[_0x76aa('0x2a')]);var upload=multer({'storage':multer[_0x76aa('0x1d')]({'destination':function(_0x26b75e,_0x3599a9,_0x4ef9b0){_0x4ef9b0(null,path[_0x76aa('0x1e')](config[_0x76aa('0x1f')],_0x76aa('0x20')));},'filename':function(_0x2e7ab4,_0xa1e6,_0x2f9316){_0xa1e6[_0x76aa('0x21')]=_0xa1e6[_0x76aa('0x21')][_0x76aa('0x2b')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2f9316(null,util[_0x76aa('0x22')]('%s-%s%s',path[_0x76aa('0x24')](_0xa1e6['originalname'],path[_0x76aa('0x25')](_0xa1e6[_0x76aa('0x21')])),Date[_0x76aa('0x26')](),path[_0x76aa('0x25')](_0xa1e6[_0x76aa('0x21')])));}})});router[_0x76aa('0x18')](_0x76aa('0x2c'),upload[_0x76aa('0x28')](_0x76aa('0x29')),controller[_0x76aa('0x2d')]);router['post'](_0x76aa('0x2e'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x2f')]);router[_0x76aa('0x30')](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller[_0x76aa('0x31')]);router['delete'](_0x76aa('0xc'),auth[_0x76aa('0xa')](),controller['destroy']);module[_0x76aa('0x32')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 018d2d4..120a3e5 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 _0x88b9=['alias','STRING','long','select','parse','values','isArray','setDataValue','lodash','exports','VIRTUAL','getDataValue'];(function(_0x34b8d5,_0x17a3a0){var _0x2aabf9=function(_0x19ff97){while(--_0x19ff97){_0x34b8d5['push'](_0x34b8d5['shift']());}};_0x2aabf9(++_0x17a3a0);}(_0x88b9,0x14c));var _0x988b=function(_0x490e45,_0x218fb5){_0x490e45=_0x490e45-0x0;var _0x1ccc2f=_0x88b9[_0x490e45];return _0x1ccc2f;};'use strict';var Sequelize=require('sequelize');var _=require(_0x988b('0x0'));module[_0x988b('0x1')]={'name':{'type':Sequelize[_0x988b('0x2')],'get':function(_0x3fb2be){return this[_0x988b('0x3')](_0x988b('0x4'));}},'alias':{'type':Sequelize[_0x988b('0x5')],'allowNull':![],'set':function(_0x36a772){this['setDataValue'](_0x988b('0x4'),_0x36a772?_0x36a772:this['getDataValue']('name'));}},'type':{'type':Sequelize['STRING'],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x988b('0x6')),'get':function(){if(this[_0x988b('0x3')]('type')===_0x988b('0x7')){return JSON[_0x988b('0x8')](this['getDataValue'](_0x988b('0x9')));}else{return this[_0x988b('0x3')]('values');}},'set':function(_0x1e4b06){if(Array[_0x988b('0xa')](_0x1e4b06)){this['setDataValue'](_0x988b('0x9'),JSON['stringify'](_0x1e4b06));}else{this[_0x988b('0xb')](_0x988b('0x9'),_0x1e4b06);}}},'required':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xd704=['name','long','type','select','values','isArray','stringify','BOOLEAN','sequelize','lodash','alias','STRING','setDataValue','getDataValue'];(function(_0x475287,_0x4f2b3b){var _0x16f72c=function(_0x45413a){while(--_0x45413a){_0x475287['push'](_0x475287['shift']());}};_0x16f72c(++_0x4f2b3b);}(_0xd704,0xf6));var _0x4d70=function(_0x5f15f3,_0x13c5e6){_0x5f15f3=_0x5f15f3-0x0;var _0x4e6eeb=_0xd704[_0x5f15f3];return _0x4e6eeb;};'use strict';var Sequelize=require(_0x4d70('0x0'));var _=require(_0x4d70('0x1'));module['exports']={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2608bb){return this['getDataValue'](_0x4d70('0x2'));}},'alias':{'type':Sequelize[_0x4d70('0x3')],'allowNull':![],'set':function(_0x11a4dc){this[_0x4d70('0x4')]('alias',_0x11a4dc?_0x11a4dc:this[_0x4d70('0x5')](_0x4d70('0x6')));}},'type':{'type':Sequelize[_0x4d70('0x3')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x4d70('0x7')),'get':function(){if(this[_0x4d70('0x5')](_0x4d70('0x8'))===_0x4d70('0x9')){return JSON['parse'](this[_0x4d70('0x5')](_0x4d70('0xa')));}else{return this[_0x4d70('0x5')](_0x4d70('0xa'));}},'set':function(_0x524c96){if(Array[_0x4d70('0xb')](_0x524c96)){this[_0x4d70('0x4')](_0x4d70('0xa'),JSON[_0x4d70('0xc')](_0x524c96));}else{this[_0x4d70('0x4')](_0x4d70('0xa'),_0x524c96);}}},'required':{'type':Sequelize[_0x4d70('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8657343..dc02c89 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 _0x0bbf=['reject','save','update','destroy','then','error','stack','name','send','map','CmCustomField','fieldName','type','key','differenceBy','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','includeAll','include','findAll','catch','show','find','body','create','transaction','Sequelize','TEXT','text','number','INTEGER','switch','BOOLEAN','defaultValue','sequelize','queryInterface','addColumn','format','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','end','status','count','offset','limit','Content-Range','apply'];(function(_0x32bd37,_0x3d739d){var _0x231759=function(_0x317743){while(--_0x317743){_0x32bd37['push'](_0x32bd37['shift']());}};_0x231759(++_0x3d739d);}(_0x0bbf,0x18d));var _0xf0bb=function(_0x4a5fa5,_0x51dadc){_0x4a5fa5=_0x4a5fa5-0x0;var _0x241266=_0x0bbf[_0x4a5fa5];return _0x241266;};'use strict';var pdf=require(_0xf0bb('0x0'));var emlformat=require(_0xf0bb('0x1'));var rimraf=require(_0xf0bb('0x2'));var zipdir=require(_0xf0bb('0x3'));var jsonpatch=require(_0xf0bb('0x4'));var rp=require('request-promise');var moment=require(_0xf0bb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xf0bb('0x6'));var util=require(_0xf0bb('0x7'));var path=require(_0xf0bb('0x8'));var sox=require('sox');var csv=require(_0xf0bb('0x9'));var ejs=require(_0xf0bb('0xa'));var fs=require('fs');var _=require(_0xf0bb('0xb'));var squel=require(_0xf0bb('0xc'));var crypto=require('crypto');var jsforce=require(_0xf0bb('0xd'));var deskjs=require(_0xf0bb('0xe'));var toCsv=require(_0xf0bb('0x9'));var querystring=require(_0xf0bb('0xf'));var Papa=require(_0xf0bb('0x10'));var Redis=require(_0xf0bb('0x11'));var authService=require(_0xf0bb('0x12'));var qs=require(_0xf0bb('0x13'));var as=require(_0xf0bb('0x14'));var hardwareService=require(_0xf0bb('0x15'));var logger=require(_0xf0bb('0x16'))(_0xf0bb('0x17'));var utils=require('../../config/utils');var config=require(_0xf0bb('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x19f9cf,_0x5a14b9){_0x5a14b9=_0x5a14b9||0xcc;return function(_0x56fd63){if(_0x56fd63){return _0x19f9cf[_0xf0bb('0x19')](_0x5a14b9);}return _0x19f9cf['status'](_0x5a14b9)[_0xf0bb('0x1a')]();};}function respondWithResult(_0x47cbb6,_0x1f0138){_0x1f0138=_0x1f0138||0xc8;return function(_0xa767e7){if(_0xa767e7){return _0x47cbb6[_0xf0bb('0x1b')](_0x1f0138)['json'](_0xa767e7);}};}function respondWithFilteredResult(_0x191471,_0x5e97ba){return function(_0x45445e){if(_0x45445e){var _0x2f9edc=_0x45445e[_0xf0bb('0x1c')],_0x2ec7d2=_0x5e97ba[_0xf0bb('0x1d')],_0x57f1f8=_0x5e97ba[_0xf0bb('0x1d')]+_0x5e97ba[_0xf0bb('0x1e')],_0x342926;if(_0x57f1f8>=_0x2f9edc){_0x57f1f8=_0x2f9edc;_0x342926=0xc8;}else{_0x342926=0xce;}_0x191471[_0xf0bb('0x1b')](_0x342926);return _0x191471['set'](_0xf0bb('0x1f'),_0x2ec7d2+'-'+_0x57f1f8+'/'+_0x2f9edc)['json'](_0x45445e);}return null;};}function patchUpdates(_0x1e0e16){return function(_0x53c78b){try{jsonpatch[_0xf0bb('0x20')](_0x53c78b,_0x1e0e16,!![]);}catch(_0x270f55){return BPromise[_0xf0bb('0x21')](_0x270f55);}return _0x53c78b[_0xf0bb('0x22')]();};}function saveUpdates(_0x429656,_0x4651ae){return function(_0x548dd6){if(_0x548dd6){return _0x548dd6[_0xf0bb('0x23')](_0x429656)['then'](function(_0x59b644){return _0x59b644;});}return null;};}function removeEntity(_0x109876,_0x1b80c5){return function(_0x1be618){if(_0x1be618){return _0x1be618[_0xf0bb('0x24')]()[_0xf0bb('0x25')](function(){_0x109876[_0xf0bb('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ebe5e,_0x497faa){return function(_0x38fb50){if(!_0x38fb50){_0x1ebe5e[_0xf0bb('0x19')](0x194);}return _0x38fb50;};}function handleError(_0x1a7b0a,_0x49f0b6){_0x49f0b6=_0x49f0b6||0x1f4;return function(_0x24845e){logger[_0xf0bb('0x26')](_0x24845e[_0xf0bb('0x27')]);if(_0x24845e[_0xf0bb('0x28')]){delete _0x24845e[_0xf0bb('0x28')];}_0x1a7b0a['status'](_0x49f0b6)[_0xf0bb('0x29')](_0x24845e);};}exports['index']=function(_0x5d56ef,_0x528747){var _0x264869={},_0x32c488={},_0x55fa24={'count':0x0,'rows':[]};var _0x44e34e=_[_0xf0bb('0x2a')](db[_0xf0bb('0x2b')]['rawAttributes'],function(_0x142b8c){return{'name':_0x142b8c[_0xf0bb('0x2c')],'type':_0x142b8c[_0xf0bb('0x2d')][_0xf0bb('0x2e')]};});_0x32c488['model']=_[_0xf0bb('0x2f')](_['map'](_0x44e34e,_0xf0bb('0x28')),[_0xf0bb('0x28')]);_0x32c488['query']=_[_0xf0bb('0x30')](_0x5d56ef[_0xf0bb('0x31')]);_0x32c488[_0xf0bb('0x32')]=_[_0xf0bb('0x33')](_0x32c488[_0xf0bb('0x34')],_0x32c488[_0xf0bb('0x31')]);_0x264869['attributes']=_[_0xf0bb('0x33')](_0x32c488[_0xf0bb('0x34')],qs[_0xf0bb('0x35')](_0x5d56ef[_0xf0bb('0x31')]['fields']));_0x264869[_0xf0bb('0x36')]=_0x264869[_0xf0bb('0x36')][_0xf0bb('0x37')]?_0x264869['attributes']:_0x32c488[_0xf0bb('0x34')];if(!_0x5d56ef[_0xf0bb('0x31')][_0xf0bb('0x38')](_0xf0bb('0x39'))){_0x264869[_0xf0bb('0x1e')]=qs[_0xf0bb('0x1e')](_0x5d56ef[_0xf0bb('0x31')][_0xf0bb('0x1e')]);_0x264869[_0xf0bb('0x1d')]=qs[_0xf0bb('0x1d')](_0x5d56ef[_0xf0bb('0x31')][_0xf0bb('0x1d')]);}_0x264869[_0xf0bb('0x3a')]=qs[_0xf0bb('0x3b')](_0x5d56ef['query'][_0xf0bb('0x3b')]);_0x264869[_0xf0bb('0x3c')]=qs[_0xf0bb('0x32')](_[_0xf0bb('0x3d')](_0x5d56ef[_0xf0bb('0x31')],_0x32c488[_0xf0bb('0x32')]));if(_0x5d56ef[_0xf0bb('0x31')]['filter']){_0x264869['where']=_[_0xf0bb('0x3e')](_0x264869[_0xf0bb('0x3c')],{'$or':_[_0xf0bb('0x2a')](_0x44e34e,function(_0x34e16d){if(_0x34e16d[_0xf0bb('0x2d')]!=='VIRTUAL'){var _0x3ba884={};_0x3ba884[_0x34e16d[_0xf0bb('0x28')]]={'$like':'%'+_0x5d56ef[_0xf0bb('0x31')][_0xf0bb('0x3f')]+'%'};return _0x3ba884;}})});}_0x264869=_[_0xf0bb('0x3e')]({},_0x264869,_0x5d56ef[_0xf0bb('0x40')]);var _0x4df5f3={'where':_0x264869[_0xf0bb('0x3c')]};return db[_0xf0bb('0x2b')]['count'](_0x4df5f3)['then'](function(_0x5632e8){_0x55fa24[_0xf0bb('0x1c')]=_0x5632e8;if(_0x5d56ef[_0xf0bb('0x31')][_0xf0bb('0x41')]){_0x264869[_0xf0bb('0x42')]=[{'all':!![]}];}return db[_0xf0bb('0x2b')][_0xf0bb('0x43')](_0x264869);})[_0xf0bb('0x25')](function(_0x228dd0){_0x55fa24['rows']=_0x228dd0;return _0x55fa24;})['then'](respondWithFilteredResult(_0x528747,_0x264869))[_0xf0bb('0x44')](handleError(_0x528747,null));};exports[_0xf0bb('0x45')]=function(_0x57d6b6,_0x18d93d){var _0x37d156={'raw':!![],'where':{'id':_0x57d6b6['params']['id']}},_0x45cb6b={};_0x45cb6b[_0xf0bb('0x34')]=_[_0xf0bb('0x30')](db[_0xf0bb('0x2b')]['rawAttributes']);_0x45cb6b[_0xf0bb('0x31')]=_[_0xf0bb('0x30')](_0x57d6b6[_0xf0bb('0x31')]);_0x45cb6b[_0xf0bb('0x32')]=_[_0xf0bb('0x33')](_0x45cb6b[_0xf0bb('0x34')],_0x45cb6b[_0xf0bb('0x31')]);_0x37d156[_0xf0bb('0x36')]=_[_0xf0bb('0x33')](_0x45cb6b[_0xf0bb('0x34')],qs[_0xf0bb('0x35')](_0x57d6b6[_0xf0bb('0x31')][_0xf0bb('0x35')]));_0x37d156[_0xf0bb('0x36')]=_0x37d156[_0xf0bb('0x36')][_0xf0bb('0x37')]?_0x37d156[_0xf0bb('0x36')]:_0x45cb6b[_0xf0bb('0x34')];if(_0x57d6b6[_0xf0bb('0x31')][_0xf0bb('0x41')]){_0x37d156[_0xf0bb('0x42')]=[{'all':!![]}];}_0x37d156=_[_0xf0bb('0x3e')]({},_0x37d156,_0x57d6b6[_0xf0bb('0x40')]);return db[_0xf0bb('0x2b')][_0xf0bb('0x46')](_0x37d156)['then'](handleEntityNotFound(_0x18d93d,null))[_0xf0bb('0x25')](respondWithResult(_0x18d93d,null))[_0xf0bb('0x44')](handleError(_0x18d93d,null));};exports[_0xf0bb('0x23')]=function(_0x1fa063,_0x5eee70){if(_0x1fa063[_0xf0bb('0x47')]['id']){delete _0x1fa063[_0xf0bb('0x47')]['id'];}return db[_0xf0bb('0x2b')][_0xf0bb('0x46')]({'where':{'id':_0x1fa063['params']['id']}})[_0xf0bb('0x25')](handleEntityNotFound(_0x5eee70,null))[_0xf0bb('0x25')](saveUpdates(_0x1fa063[_0xf0bb('0x47')],null))[_0xf0bb('0x25')](respondWithResult(_0x5eee70,null))[_0xf0bb('0x44')](handleError(_0x5eee70,null));};exports[_0xf0bb('0x24')]=function(_0x47e0ee,_0x58f0c8){return db['CmCustomField'][_0xf0bb('0x46')]({'where':{'id':_0x47e0ee['params']['id']}})[_0xf0bb('0x25')](handleEntityNotFound(_0x58f0c8,null))[_0xf0bb('0x25')](removeEntity(_0x58f0c8,null))[_0xf0bb('0x44')](handleError(_0x58f0c8,null));};exports[_0xf0bb('0x48')]=function(_0x457dc9,_0x2b5d92){var _0x371d1c;return db['sequelize'][_0xf0bb('0x49')](function(_0x1ef202){return db[_0xf0bb('0x2b')][_0xf0bb('0x48')](_0x457dc9[_0xf0bb('0x47')],{'transaction':_0x1ef202})['then'](function(_0x3b7c13){_0x371d1c=_0x3b7c13;var _0x2fcb29={'type':db[_0xf0bb('0x4a')][_0xf0bb('0x4b')],'transaction':_0x1ef202};switch(_0x457dc9[_0xf0bb('0x47')][_0xf0bb('0x2d')]){case _0xf0bb('0x4c'):_0x2fcb29['type']=db[_0xf0bb('0x4a')]['TEXT'];break;case _0xf0bb('0x4d'):_0x2fcb29[_0xf0bb('0x2d')]=db['Sequelize'][_0xf0bb('0x4e')];break;case _0xf0bb('0x4f'):_0x2fcb29['type']=db['Sequelize'][_0xf0bb('0x50')];_0x2fcb29[_0xf0bb('0x51')]=![];break;default:}return db[_0xf0bb('0x52')][_0xf0bb('0x53')][_0xf0bb('0x54')]('cm_contacts',util[_0xf0bb('0x55')]('cf_%d',_0x371d1c['id']),_0x2fcb29);})['then'](function(){return _0x371d1c;});})['then'](respondWithResult(_0x2b5d92,0xc9))[_0xf0bb('0x44')](handleError(_0x2b5d92,null));}; \ No newline at end of file +var _0x300c=['../../config/utils','../../config/environment','status','end','json','offset','limit','set','apply','save','update','destroy','sendStatus','stack','map','rawAttributes','fieldName','type','key','model','differenceBy','name','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','options','CmCustomField','count','then','includeAll','findAll','catch','params','fields','include','find','body','transaction','create','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','addColumn','cm_contacts','format','cf_%d','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x300c,0x126));var _0xc300=function(_0x1e01c0,_0x38d2f4){_0x1e01c0=_0x1e01c0-0x0;var _0x2a96b7=_0x300c[_0x1e01c0];return _0x2a96b7;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc300('0x0'));var jsonpatch=require(_0xc300('0x1'));var rp=require(_0xc300('0x2'));var moment=require(_0xc300('0x3'));var BPromise=require(_0xc300('0x4'));var Mustache=require('mustache');var util=require(_0xc300('0x5'));var path=require('path');var sox=require(_0xc300('0x6'));var csv=require(_0xc300('0x7'));var ejs=require(_0xc300('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xc300('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xc300('0xa'));var toCsv=require(_0xc300('0x7'));var querystring=require(_0xc300('0xb'));var Papa=require('papaparse');var Redis=require(_0xc300('0xc'));var authService=require(_0xc300('0xd'));var qs=require(_0xc300('0xe'));var as=require(_0xc300('0xf'));var hardwareService=require(_0xc300('0x10'));var logger=require('../../config/logger')(_0xc300('0x11'));var utils=require(_0xc300('0x12'));var config=require(_0xc300('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x524184,_0x1eb5b3){_0x1eb5b3=_0x1eb5b3||0xcc;return function(_0x25d0d6){if(_0x25d0d6){return _0x524184['sendStatus'](_0x1eb5b3);}return _0x524184[_0xc300('0x14')](_0x1eb5b3)[_0xc300('0x15')]();};}function respondWithResult(_0xff7d26,_0x2f9af5){_0x2f9af5=_0x2f9af5||0xc8;return function(_0x3114e1){if(_0x3114e1){return _0xff7d26['status'](_0x2f9af5)[_0xc300('0x16')](_0x3114e1);}};}function respondWithFilteredResult(_0x1e7580,_0x59cf20){return function(_0x1fac95){if(_0x1fac95){var _0x15a754=_0x1fac95['count'],_0xf29025=_0x59cf20[_0xc300('0x17')],_0x1aa9b6=_0x59cf20[_0xc300('0x17')]+_0x59cf20[_0xc300('0x18')],_0x5f2f6e;if(_0x1aa9b6>=_0x15a754){_0x1aa9b6=_0x15a754;_0x5f2f6e=0xc8;}else{_0x5f2f6e=0xce;}_0x1e7580['status'](_0x5f2f6e);return _0x1e7580[_0xc300('0x19')]('Content-Range',_0xf29025+'-'+_0x1aa9b6+'/'+_0x15a754)[_0xc300('0x16')](_0x1fac95);}return null;};}function patchUpdates(_0x24c7ff){return function(_0x40c6af){try{jsonpatch[_0xc300('0x1a')](_0x40c6af,_0x24c7ff,!![]);}catch(_0x2bb2e0){return BPromise['reject'](_0x2bb2e0);}return _0x40c6af[_0xc300('0x1b')]();};}function saveUpdates(_0x52bb26,_0x2d7c27){return function(_0x1860ca){if(_0x1860ca){return _0x1860ca[_0xc300('0x1c')](_0x52bb26)['then'](function(_0x122844){return _0x122844;});}return null;};}function removeEntity(_0x6744dc,_0x21cb98){return function(_0x1c14c9){if(_0x1c14c9){return _0x1c14c9[_0xc300('0x1d')]()['then'](function(){_0x6744dc['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3194c8,_0x1db13a){return function(_0x250f64){if(!_0x250f64){_0x3194c8[_0xc300('0x1e')](0x194);}return _0x250f64;};}function handleError(_0x286d3c,_0x138990){_0x138990=_0x138990||0x1f4;return function(_0x44d431){logger['error'](_0x44d431[_0xc300('0x1f')]);if(_0x44d431['name']){delete _0x44d431['name'];}_0x286d3c[_0xc300('0x14')](_0x138990)['send'](_0x44d431);};}exports['index']=function(_0x4da738,_0x4ab87e){var _0x230d89={},_0x4cd2e1={},_0x754da={'count':0x0,'rows':[]};var _0x4fec9b=_[_0xc300('0x20')](db['CmCustomField'][_0xc300('0x21')],function(_0x4fded7){return{'name':_0x4fded7[_0xc300('0x22')],'type':_0x4fded7[_0xc300('0x23')][_0xc300('0x24')]};});_0x4cd2e1[_0xc300('0x25')]=_[_0xc300('0x26')](_['map'](_0x4fec9b,_0xc300('0x27')),[_0xc300('0x27')]);_0x4cd2e1[_0xc300('0x28')]=_[_0xc300('0x29')](_0x4da738[_0xc300('0x28')]);_0x4cd2e1[_0xc300('0x2a')]=_[_0xc300('0x2b')](_0x4cd2e1['model'],_0x4cd2e1[_0xc300('0x28')]);_0x230d89[_0xc300('0x2c')]=_[_0xc300('0x2b')](_0x4cd2e1[_0xc300('0x25')],qs['fields'](_0x4da738[_0xc300('0x28')]['fields']));_0x230d89[_0xc300('0x2c')]=_0x230d89[_0xc300('0x2c')][_0xc300('0x2d')]?_0x230d89[_0xc300('0x2c')]:_0x4cd2e1['model'];if(!_0x4da738[_0xc300('0x28')]['hasOwnProperty'](_0xc300('0x2e'))){_0x230d89[_0xc300('0x18')]=qs[_0xc300('0x18')](_0x4da738['query'][_0xc300('0x18')]);_0x230d89[_0xc300('0x17')]=qs[_0xc300('0x17')](_0x4da738['query'][_0xc300('0x17')]);}_0x230d89[_0xc300('0x2f')]=qs[_0xc300('0x30')](_0x4da738[_0xc300('0x28')][_0xc300('0x30')]);_0x230d89[_0xc300('0x31')]=qs[_0xc300('0x2a')](_[_0xc300('0x32')](_0x4da738[_0xc300('0x28')],_0x4cd2e1[_0xc300('0x2a')]));if(_0x4da738[_0xc300('0x28')][_0xc300('0x33')]){_0x230d89['where']=_['merge'](_0x230d89['where'],{'$or':_[_0xc300('0x20')](_0x4fec9b,function(_0x503272){if(_0x503272[_0xc300('0x23')]!=='VIRTUAL'){var _0x98685={};_0x98685[_0x503272[_0xc300('0x27')]]={'$like':'%'+_0x4da738[_0xc300('0x28')]['filter']+'%'};return _0x98685;}})});}_0x230d89=_[_0xc300('0x34')]({},_0x230d89,_0x4da738[_0xc300('0x35')]);var _0x5aa288={'where':_0x230d89[_0xc300('0x31')]};return db[_0xc300('0x36')][_0xc300('0x37')](_0x5aa288)[_0xc300('0x38')](function(_0x43a8ca){_0x754da['count']=_0x43a8ca;if(_0x4da738['query'][_0xc300('0x39')]){_0x230d89['include']=[{'all':!![]}];}return db[_0xc300('0x36')][_0xc300('0x3a')](_0x230d89);})[_0xc300('0x38')](function(_0x589645){_0x754da['rows']=_0x589645;return _0x754da;})[_0xc300('0x38')](respondWithFilteredResult(_0x4ab87e,_0x230d89))[_0xc300('0x3b')](handleError(_0x4ab87e,null));};exports['show']=function(_0x59c5cf,_0x4d8c40){var _0x530cb6={'raw':!![],'where':{'id':_0x59c5cf[_0xc300('0x3c')]['id']}},_0x5024ff={};_0x5024ff[_0xc300('0x25')]=_['keys'](db[_0xc300('0x36')][_0xc300('0x21')]);_0x5024ff['query']=_['keys'](_0x59c5cf['query']);_0x5024ff['filters']=_[_0xc300('0x2b')](_0x5024ff['model'],_0x5024ff[_0xc300('0x28')]);_0x530cb6[_0xc300('0x2c')]=_['intersection'](_0x5024ff['model'],qs['fields'](_0x59c5cf[_0xc300('0x28')][_0xc300('0x3d')]));_0x530cb6[_0xc300('0x2c')]=_0x530cb6[_0xc300('0x2c')][_0xc300('0x2d')]?_0x530cb6[_0xc300('0x2c')]:_0x5024ff[_0xc300('0x25')];if(_0x59c5cf[_0xc300('0x28')][_0xc300('0x39')]){_0x530cb6[_0xc300('0x3e')]=[{'all':!![]}];}_0x530cb6=_[_0xc300('0x34')]({},_0x530cb6,_0x59c5cf[_0xc300('0x35')]);return db['CmCustomField'][_0xc300('0x3f')](_0x530cb6)[_0xc300('0x38')](handleEntityNotFound(_0x4d8c40,null))[_0xc300('0x38')](respondWithResult(_0x4d8c40,null))[_0xc300('0x3b')](handleError(_0x4d8c40,null));};exports['update']=function(_0x436822,_0x32f5af){if(_0x436822[_0xc300('0x40')]['id']){delete _0x436822[_0xc300('0x40')]['id'];}return db[_0xc300('0x36')][_0xc300('0x3f')]({'where':{'id':_0x436822[_0xc300('0x3c')]['id']}})[_0xc300('0x38')](handleEntityNotFound(_0x32f5af,null))['then'](saveUpdates(_0x436822[_0xc300('0x40')],null))[_0xc300('0x38')](respondWithResult(_0x32f5af,null))[_0xc300('0x3b')](handleError(_0x32f5af,null));};exports['destroy']=function(_0x371d01,_0x4ac83f){return db['CmCustomField']['find']({'where':{'id':_0x371d01[_0xc300('0x3c')]['id']}})['then'](handleEntityNotFound(_0x4ac83f,null))[_0xc300('0x38')](removeEntity(_0x4ac83f,null))['catch'](handleError(_0x4ac83f,null));};exports['create']=function(_0x432396,_0x23ddf9){var _0x262253;return db['sequelize'][_0xc300('0x41')](function(_0x589eb5){return db[_0xc300('0x36')][_0xc300('0x42')](_0x432396[_0xc300('0x40')],{'transaction':_0x589eb5})[_0xc300('0x38')](function(_0x3015fd){_0x262253=_0x3015fd;var _0x149998={'type':db['Sequelize'][_0xc300('0x43')],'transaction':_0x589eb5};switch(_0x432396['body']['type']){case _0xc300('0x44'):_0x149998['type']=db[_0xc300('0x45')][_0xc300('0x43')];break;case'number':_0x149998[_0xc300('0x23')]=db[_0xc300('0x45')][_0xc300('0x46')];break;case _0xc300('0x47'):_0x149998[_0xc300('0x23')]=db[_0xc300('0x45')][_0xc300('0x48')];_0x149998[_0xc300('0x49')]=![];break;default:}return db['sequelize']['queryInterface'][_0xc300('0x4a')](_0xc300('0x4b'),util[_0xc300('0x4c')](_0xc300('0x4d'),_0x262253['id']),_0x149998);})[_0xc300('0x38')](function(){return _0x262253;});})[_0xc300('0x38')](respondWithResult(_0x23ddf9,0xc9))[_0xc300('0x3b')](handleError(_0x23ddf9,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 656e960..32b723d 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 _0xefc3=['cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','exports','define','CmCustomField'];(function(_0x2044ba,_0x1ebab8){var _0x2fa276=function(_0x20f79c){while(--_0x20f79c){_0x2044ba['push'](_0x2044ba['shift']());}};_0x2fa276(++_0x1ebab8);}(_0xefc3,0xa9));var _0x3efc=function(_0x3a76b0,_0x25fc17){_0x3a76b0=_0x3a76b0-0x0;var _0x242312=_0xefc3[_0x3a76b0];return _0x242312;};'use strict';var _=require(_0x3efc('0x0'));var util=require(_0x3efc('0x1'));var logger=require(_0x3efc('0x2'))(_0x3efc('0x3'));var moment=require(_0x3efc('0x4'));var BPromise=require(_0x3efc('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3efc('0x6'));var rimraf=require(_0x3efc('0x7'));var config=require('../../config/environment');var attributes=require('./cmCustomField.attributes');module[_0x3efc('0x8')]=function(_0x3def2a,_0x5a6982){return _0x3def2a[_0x3efc('0x9')](_0x3efc('0xa'),attributes,{'tableName':_0x3efc('0xb'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6caf=['cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6caf,0x90));var _0xf6ca=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0x6caf[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0xf6ca('0x0'));var util=require(_0xf6ca('0x1'));var logger=require(_0xf6ca('0x2'))('api');var moment=require(_0xf6ca('0x3'));var BPromise=require(_0xf6ca('0x4'));var rp=require(_0xf6ca('0x5'));var fs=require('fs');var path=require(_0xf6ca('0x6'));var rimraf=require(_0xf6ca('0x7'));var config=require(_0xf6ca('0x8'));var attributes=require(_0xf6ca('0x9'));module['exports']=function(_0x1b6097,_0x4042a9){return _0x1b6097['define']('CmCustomField',attributes,{'tableName':_0xf6ca('0xa'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.rpc.js b/server/api/cmCustomField/cmCustomField.rpc.js index 8679e6c..cb36499 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 _0x6f0d=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent'];(function(_0x30a32c,_0x574e7b){var _0x286057=function(_0x16253a){while(--_0x16253a){_0x30a32c['push'](_0x30a32c['shift']());}};_0x286057(++_0x574e7b);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x44689f,_0x1fb85f){_0x44689f=_0x44689f-0x0;var _0x5379fd=_0x6f0d[_0x44689f];return _0x5379fd;};'use strict';var _=require('lodash');var util=require(_0xd6f0('0x0'));var moment=require(_0xd6f0('0x1'));var BPromise=require(_0xd6f0('0x2'));var rs=require(_0xd6f0('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd6f0('0x4'))['db'];var utils=require(_0xd6f0('0x5'));var logger=require(_0xd6f0('0x6'))(_0xd6f0('0x7'));var config=require(_0xd6f0('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd6f0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe21ac4,_0x1af29c,_0x8b89a9){return new BPromise(function(_0x1a48a0,_0x4c4916){return client['request'](_0xe21ac4,_0x8b89a9)[_0xd6f0('0xa')](function(_0x272c4e){logger[_0xd6f0('0xb')](_0xd6f0('0xc'),_0x1af29c,_0xd6f0('0xd'));logger['debug'](_0xd6f0('0xe'),_0x1af29c,_0xd6f0('0xd'),JSON[_0xd6f0('0xf')](_0x272c4e));if(_0x272c4e[_0xd6f0('0x10')]){if(_0x272c4e['error'][_0xd6f0('0x11')]===0x1f4){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);return _0x4c4916(_0x272c4e[_0xd6f0('0x10')][_0xd6f0('0x12')]);}logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x272c4e['error'][_0xd6f0('0x12')]);return _0x1a48a0(_0x272c4e[_0xd6f0('0x10')]['message']);}else{logger[_0xd6f0('0xb')]('CmCustomField,\x20%s,\x20%s',_0x1af29c,_0xd6f0('0xd'));_0x1a48a0(_0x272c4e[_0xd6f0('0x13')][_0xd6f0('0x12')]);}})[_0xd6f0('0x14')](function(_0x64ff5f){logger[_0xd6f0('0x10')](_0xd6f0('0xc'),_0x1af29c,_0x64ff5f);_0x4c4916(_0x64ff5f);});});} \ No newline at end of file +var _0x579c=['message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','debug','CmCustomField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x5ac06f,_0x41f6ff){var _0x44f3c2=function(_0x3e1cf1){while(--_0x3e1cf1){_0x5ac06f['push'](_0x5ac06f['shift']());}};_0x44f3c2(++_0x41f6ff);}(_0x579c,0xda));var _0xc579=function(_0x22ba1e,_0x4b25fd){_0x22ba1e=_0x22ba1e-0x0;var _0x3b42e4=_0x579c[_0x22ba1e];return _0x3b42e4;};'use strict';var _=require(_0xc579('0x0'));var util=require(_0xc579('0x1'));var moment=require(_0xc579('0x2'));var BPromise=require(_0xc579('0x3'));var rs=require(_0xc579('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc579('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc579('0x6'))(_0xc579('0x7'));var config=require(_0xc579('0x8'));var jayson=require(_0xc579('0x9'));var client=jayson[_0xc579('0xa')][_0xc579('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e451b,_0x585167,_0x1c6d9c){return new BPromise(function(_0x293c4a,_0x2ce949){return client[_0xc579('0xc')](_0x2e451b,_0x1c6d9c)[_0xc579('0xd')](function(_0x44b151){logger[_0xc579('0xe')](_0xc579('0xf'),_0x585167,'request\x20sent');logger[_0xc579('0x10')](_0xc579('0x11'),_0x585167,_0xc579('0x12'),JSON[_0xc579('0x13')](_0x44b151));if(_0x44b151[_0xc579('0x14')]){if(_0x44b151[_0xc579('0x14')][_0xc579('0x15')]===0x1f4){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x44b151[_0xc579('0x14')][_0xc579('0x16')]);return _0x2ce949(_0x44b151['error'][_0xc579('0x16')]);}logger['error'](_0xc579('0xf'),_0x585167,_0x44b151['error'][_0xc579('0x16')]);return _0x293c4a(_0x44b151['error'][_0xc579('0x16')]);}else{logger['info'](_0xc579('0xf'),_0x585167,_0xc579('0x12'));_0x293c4a(_0x44b151['result']['message']);}})[_0xc579('0x17')](function(_0x2abc55){logger[_0xc579('0x14')](_0xc579('0xf'),_0x585167,_0x2abc55);_0x2ce949(_0x2abc55);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 0b81b38..f221e54 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 _0x258e=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','post','create','put','update','delete','destroy','exports'];(function(_0xcc2c66,_0x27cf7b){var _0x2197b2=function(_0xacbaeb){while(--_0xacbaeb){_0xcc2c66['push'](_0xcc2c66['shift']());}};_0x2197b2(++_0x27cf7b);}(_0x258e,0x168));var _0xe258=function(_0x23e684,_0x1716e3){_0x23e684=_0x23e684-0x0;var _0x4db831=_0x258e[_0x23e684];return _0x4db831;};'use strict';var multer=require('multer');var util=require(_0xe258('0x0'));var path=require(_0xe258('0x1'));var timeout=require(_0xe258('0x2'));var express=require(_0xe258('0x3'));var router=express['Router']();var auth=require(_0xe258('0x4'));var interaction=require(_0xe258('0x5'));var config=require(_0xe258('0x6'));var controller=require('./cmCustomField.controller');router['get']('/',auth[_0xe258('0x7')](),controller[_0xe258('0x8')]);router[_0xe258('0x9')](_0xe258('0xa'),auth[_0xe258('0x7')](),controller['show']);router[_0xe258('0xb')]('/',auth['isAuthenticated'](),controller[_0xe258('0xc')]);router[_0xe258('0xd')](_0xe258('0xa'),auth[_0xe258('0x7')](),controller[_0xe258('0xe')]);router[_0xe258('0xf')](_0xe258('0xa'),auth[_0xe258('0x7')](),controller[_0xe258('0x10')]);module[_0xe258('0x11')]=router; \ No newline at end of file +var _0xde47=['index','get','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','isAuthenticated'];(function(_0x423acc,_0x702fd1){var _0x51eefe=function(_0x2c7499){while(--_0x2c7499){_0x423acc['push'](_0x423acc['shift']());}};_0x51eefe(++_0x702fd1);}(_0xde47,0x185));var _0x7de4=function(_0x2d7226,_0x35edb1){_0x2d7226=_0x2d7226-0x0;var _0x59b03f=_0xde47[_0x2d7226];return _0x59b03f;};'use strict';var multer=require(_0x7de4('0x0'));var util=require(_0x7de4('0x1'));var path=require(_0x7de4('0x2'));var timeout=require(_0x7de4('0x3'));var express=require('express');var router=express[_0x7de4('0x4')]();var auth=require(_0x7de4('0x5'));var interaction=require(_0x7de4('0x6'));var config=require(_0x7de4('0x7'));var controller=require(_0x7de4('0x8'));router['get']('/',auth[_0x7de4('0x9')](),controller[_0x7de4('0xa')]);router[_0x7de4('0xb')](_0x7de4('0xc'),auth[_0x7de4('0x9')](),controller[_0x7de4('0xd')]);router['post']('/',auth[_0x7de4('0x9')](),controller[_0x7de4('0xe')]);router[_0x7de4('0xf')](_0x7de4('0xc'),auth['isAuthenticated'](),controller[_0x7de4('0x10')]);router['delete'](_0x7de4('0xc'),auth['isAuthenticated'](),controller[_0x7de4('0x11')]);module[_0x7de4('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ec5d706..33e9e88 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 _0x2bd8=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','UNSIGNED','contactListQueue','moment','exports','STRING','BOOLEAN','DATE','format'];(function(_0x38f37e,_0x45aebc){var _0x10a423=function(_0x4f3ad6){while(--_0x4f3ad6){_0x38f37e['push'](_0x38f37e['shift']());}};_0x10a423(++_0x45aebc);}(_0x2bd8,0x130));var _0x82bd=function(_0x3e12c3,_0x48dd3f){_0x3e12c3=_0x3e12c3-0x0;var _0x2d6284=_0x2bd8[_0x3e12c3];return _0x2d6284;};'use strict';var moment=require(_0x82bd('0x0'));var Sequelize=require('sequelize');module[_0x82bd('0x1')]={'phone':{'type':Sequelize[_0x82bd('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x82bd('0x4')],'defaultValue':moment()[_0x82bd('0x5')](_0x82bd('0x6'))},'countbusyretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x82bd('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0x82bd('0x7')](0x2)[_0x82bd('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x82bd('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x82bd('0x7')],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x82bd('0x9')},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x82bd('0x7')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9c5a=['format','INTEGER','contactListQueue','moment','sequelize','STRING','BOOLEAN','DATE'];(function(_0x187ee1,_0x3fd1e6){var _0x388160=function(_0x542dd2){while(--_0x542dd2){_0x187ee1['push'](_0x187ee1['shift']());}};_0x388160(++_0x3fd1e6);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x196040,_0x49a032){_0x196040=_0x196040-0x0;var _0x540ad5=_0x9c5a[_0x196040];return _0x540ad5;};'use strict';var moment=require(_0xa9c5('0x0'));var Sequelize=require(_0xa9c5('0x1'));module['exports']={'phone':{'type':Sequelize[_0xa9c5('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xa9c5('0x4')],'defaultValue':moment()[_0xa9c5('0x5')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xa9c5('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize[_0xa9c5('0x4')]},'priority':{'type':Sequelize[_0xa9c5('0x6')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ContactId':{'type':Sequelize[_0xa9c5('0x6')],'unique':_0xa9c5('0x7')},'ListId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'UserId':{'type':Sequelize[_0xa9c5('0x6')]},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0xa9c5('0x7')},'CampaignId':{'type':Sequelize[_0xa9c5('0x6')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xa9c5('0x6')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xa9c5('0x6')],'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 d6c8bb8..3314609 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 _0xf526=['api','../../config/utils','../../config/environment','sendStatus','status','count','offset','set','json','apply','save','update','then','destroy','end','error','name','index','CmHopper','rawAttributes','fieldName','type','key','model','query','filters','intersection','$and','$or','$gte','$lte','$not','$between','$notBetween','$notIn','$notLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','map','VIRTUAL','options','includeAll','include','show','params','keys','find','catch','create','body','describe','VoiceQueueId','Campaign','merge','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','campaigntype','queue','ivr','lastName','isNil','firstName','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','sequelize','direction','prev','isEmpty','hopperIds','scheduledAt','ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20ASC','priority','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','UPDATE','CmContact','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','dialActive','getOpenContacts','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x15063d,_0x290bec){var _0x53bbcd=function(_0x10863b){while(--_0x10863b){_0x15063d['push'](_0x15063d['shift']());}};_0x53bbcd(++_0x290bec);}(_0xf526,0x19b));var _0x6f52=function(_0x27d0d4,_0x39a79d){_0x27d0d4=_0x27d0d4-0x0;var _0x54427e=_0xf526[_0x27d0d4];return _0x54427e;};'use strict';var pdf=require(_0x6f52('0x0'));var emlformat=require(_0x6f52('0x1'));var rimraf=require(_0x6f52('0x2'));var zipdir=require(_0x6f52('0x3'));var jsonpatch=require(_0x6f52('0x4'));var rp=require(_0x6f52('0x5'));var moment=require(_0x6f52('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x6f52('0x7'));var util=require(_0x6f52('0x8'));var path=require('path');var sox=require(_0x6f52('0x9'));var csv=require('to-csv');var ejs=require(_0x6f52('0xa'));var fs=require('fs');var _=require(_0x6f52('0xb'));var squel=require(_0x6f52('0xc'));var crypto=require(_0x6f52('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6f52('0xe'));var querystring=require(_0x6f52('0xf'));var Papa=require(_0x6f52('0x10'));var Redis=require(_0x6f52('0x11'));var authService=require(_0x6f52('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x6f52('0x13'));var hardwareService=require(_0x6f52('0x14'));var logger=require('../../config/logger')(_0x6f52('0x15'));var utils=require(_0x6f52('0x16'));var config=require(_0x6f52('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x264201,_0x20909f){_0x20909f=_0x20909f||0xcc;return function(_0x2c0bfb){if(_0x2c0bfb){return _0x264201[_0x6f52('0x18')](_0x20909f);}return _0x264201[_0x6f52('0x19')](_0x20909f)['end']();};}function respondWithResult(_0x30dab0,_0x1dbaf2){_0x1dbaf2=_0x1dbaf2||0xc8;return function(_0x43abb2){if(_0x43abb2){return _0x30dab0['status'](_0x1dbaf2)['json'](_0x43abb2);}};}function respondWithFilteredResult(_0x3c56e5,_0x207020){return function(_0x2df808){if(_0x2df808){var _0x6385d2=_0x2df808[_0x6f52('0x1a')],_0x4cf1d0=_0x207020[_0x6f52('0x1b')],_0x7c4dbb=_0x207020[_0x6f52('0x1b')]+_0x207020['limit'],_0x2f4f4b;if(_0x7c4dbb>=_0x6385d2){_0x7c4dbb=_0x6385d2;_0x2f4f4b=0xc8;}else{_0x2f4f4b=0xce;}_0x3c56e5[_0x6f52('0x19')](_0x2f4f4b);return _0x3c56e5[_0x6f52('0x1c')]('Content-Range',_0x4cf1d0+'-'+_0x7c4dbb+'/'+_0x6385d2)[_0x6f52('0x1d')](_0x2df808);}return null;};}function patchUpdates(_0x1d2ab6){return function(_0x3c0856){try{jsonpatch[_0x6f52('0x1e')](_0x3c0856,_0x1d2ab6,!![]);}catch(_0x19da04){return BPromise['reject'](_0x19da04);}return _0x3c0856[_0x6f52('0x1f')]();};}function saveUpdates(_0x471515,_0x13cfa5){return function(_0x482b5d){if(_0x482b5d){return _0x482b5d[_0x6f52('0x20')](_0x471515)[_0x6f52('0x21')](function(_0x262a87){return _0x262a87;});}return null;};}function removeEntity(_0x2f285a,_0x2718cd){return function(_0x45da42){if(_0x45da42){return _0x45da42[_0x6f52('0x22')]()[_0x6f52('0x21')](function(){_0x2f285a[_0x6f52('0x19')](0xcc)[_0x6f52('0x23')]();});}};}function handleEntityNotFound(_0x23e902,_0x45d206){return function(_0x2525fc){if(!_0x2525fc){_0x23e902[_0x6f52('0x18')](0x194);}return _0x2525fc;};}function handleError(_0x1f8223,_0x318a1c){_0x318a1c=_0x318a1c||0x1f4;return function(_0x19bad2){logger[_0x6f52('0x24')](_0x19bad2['stack']);if(_0x19bad2['name']){delete _0x19bad2[_0x6f52('0x25')];}_0x1f8223['status'](_0x318a1c)['send'](_0x19bad2);};}exports[_0x6f52('0x26')]=function(_0x48659e,_0x3acefc){var _0x20fe99={},_0x5ef946={},_0xd04e0e={'count':0x0,'rows':[]};var _0x3e7b10=_['map'](db[_0x6f52('0x27')][_0x6f52('0x28')],function(_0x1a3390){return{'name':_0x1a3390[_0x6f52('0x29')],'type':_0x1a3390[_0x6f52('0x2a')][_0x6f52('0x2b')]};});_0x5ef946[_0x6f52('0x2c')]=_['map'](_0x3e7b10,_0x6f52('0x25'));_0x5ef946[_0x6f52('0x2d')]=_['keys'](_0x48659e[_0x6f52('0x2d')]);_0x5ef946[_0x6f52('0x2e')]=_[_0x6f52('0x2f')](_0x5ef946[_0x6f52('0x2c')],_0x5ef946[_0x6f52('0x2d')]);_0x5ef946[_0x6f52('0x2e')]=_['concat'](_0x5ef946[_0x6f52('0x2e')],[_0x6f52('0x30'),_0x6f52('0x31'),'$gt',_0x6f52('0x32'),'$lt',_0x6f52('0x33'),'$ne','$eq',_0x6f52('0x34'),_0x6f52('0x35'),_0x6f52('0x36'),'$in',_0x6f52('0x37'),'$like',_0x6f52('0x38'),'$iLike',_0x6f52('0x39'),_0x6f52('0x3a'),_0x6f52('0x3b'),_0x6f52('0x3c'),_0x6f52('0x3d'),_0x6f52('0x3e')]);_0x20fe99[_0x6f52('0x3f')]=_['intersection'](_0x5ef946[_0x6f52('0x2c')],qs[_0x6f52('0x40')](_0x48659e['query'][_0x6f52('0x40')]));_0x20fe99[_0x6f52('0x3f')]=_0x20fe99[_0x6f52('0x3f')][_0x6f52('0x41')]?_0x20fe99['attributes']:_0x5ef946[_0x6f52('0x2c')];if(!_0x48659e['query'][_0x6f52('0x42')](_0x6f52('0x43'))){_0x20fe99[_0x6f52('0x44')]=qs[_0x6f52('0x44')](_0x48659e[_0x6f52('0x2d')][_0x6f52('0x44')]);_0x20fe99['offset']=qs[_0x6f52('0x1b')](_0x48659e[_0x6f52('0x2d')]['offset']);}_0x20fe99['order']=qs[_0x6f52('0x45')](_0x48659e['query'][_0x6f52('0x45')]);_0x20fe99[_0x6f52('0x46')]=qs['filters'](_[_0x6f52('0x47')](_0x48659e['query'],_0x5ef946[_0x6f52('0x2e')]));if(_0x48659e[_0x6f52('0x2d')][_0x6f52('0x48')]){_0x20fe99[_0x6f52('0x46')]=_['merge'](_0x20fe99[_0x6f52('0x46')],{'$or':_[_0x6f52('0x49')](_0x3e7b10,function(_0x40e3e5){if(_0x40e3e5['type']!==_0x6f52('0x4a')){var _0x427688={};_0x427688[_0x40e3e5[_0x6f52('0x25')]]={'$like':'%'+_0x48659e['query'][_0x6f52('0x48')]+'%'};return _0x427688;}})});}_0x20fe99=_['merge']({},_0x20fe99,_0x48659e[_0x6f52('0x4b')]);var _0x342679={'where':_0x20fe99['where']};return db[_0x6f52('0x27')][_0x6f52('0x1a')](_0x342679)[_0x6f52('0x21')](function(_0x358904){_0xd04e0e[_0x6f52('0x1a')]=_0x358904;if(_0x48659e[_0x6f52('0x2d')][_0x6f52('0x4c')]){_0x20fe99[_0x6f52('0x4d')]=[{'all':!![]}];}return db[_0x6f52('0x27')]['findAll'](_0x20fe99);})[_0x6f52('0x21')](function(_0x1d830f){_0xd04e0e['rows']=_0x1d830f;return _0xd04e0e;})[_0x6f52('0x21')](respondWithFilteredResult(_0x3acefc,_0x20fe99))['catch'](handleError(_0x3acefc,null));};exports[_0x6f52('0x4e')]=function(_0x1cf095,_0x5f1f3a){var _0x27e903={'raw':!![],'where':{'id':_0x1cf095[_0x6f52('0x4f')]['id']}},_0x5bd86c={};_0x5bd86c[_0x6f52('0x2c')]=_['keys'](db[_0x6f52('0x27')][_0x6f52('0x28')]);_0x5bd86c['query']=_[_0x6f52('0x50')](_0x1cf095[_0x6f52('0x2d')]);_0x5bd86c[_0x6f52('0x2e')]=_[_0x6f52('0x2f')](_0x5bd86c[_0x6f52('0x2c')],_0x5bd86c['query']);_0x27e903[_0x6f52('0x3f')]=_[_0x6f52('0x2f')](_0x5bd86c['model'],qs['fields'](_0x1cf095[_0x6f52('0x2d')][_0x6f52('0x40')]));_0x27e903[_0x6f52('0x3f')]=_0x27e903[_0x6f52('0x3f')][_0x6f52('0x41')]?_0x27e903[_0x6f52('0x3f')]:_0x5bd86c[_0x6f52('0x2c')];if(_0x1cf095[_0x6f52('0x2d')][_0x6f52('0x4c')]){_0x27e903[_0x6f52('0x4d')]=[{'all':!![]}];}_0x27e903=_['merge']({},_0x27e903,_0x1cf095['options']);return db[_0x6f52('0x27')][_0x6f52('0x51')](_0x27e903)[_0x6f52('0x21')](handleEntityNotFound(_0x5f1f3a,null))[_0x6f52('0x21')](respondWithResult(_0x5f1f3a,null))[_0x6f52('0x52')](handleError(_0x5f1f3a,null));};exports[_0x6f52('0x53')]=function(_0x243205,_0x262d0d){return db[_0x6f52('0x27')]['create'](_0x243205[_0x6f52('0x54')],{})[_0x6f52('0x21')](respondWithResult(_0x262d0d,0xc9))[_0x6f52('0x52')](handleError(_0x262d0d,null));};exports[_0x6f52('0x20')]=function(_0xf9e701,_0x2f9ac3){if(_0xf9e701['body']['id']){delete _0xf9e701[_0x6f52('0x54')]['id'];}return db['CmHopper'][_0x6f52('0x51')]({'where':{'id':_0xf9e701[_0x6f52('0x4f')]['id']}})[_0x6f52('0x21')](handleEntityNotFound(_0x2f9ac3,null))[_0x6f52('0x21')](saveUpdates(_0xf9e701['body'],null))[_0x6f52('0x21')](respondWithResult(_0x2f9ac3,null))[_0x6f52('0x52')](handleError(_0x2f9ac3,null));};exports[_0x6f52('0x55')]=function(_0x55256f,_0x9f6fcd){return db[_0x6f52('0x27')][_0x6f52('0x55')]()[_0x6f52('0x21')](respondWithResult(_0x9f6fcd,null))[_0x6f52('0x52')](handleError(_0x9f6fcd,null));};exports[_0x6f52('0x22')]=function(_0xd92aa2,_0x812f1d){var _0x38fcd6;return db['CmHopper']['find']({'where':{'id':_0xd92aa2[_0x6f52('0x4f')]['id']}})[_0x6f52('0x21')](handleEntityNotFound(_0x812f1d,null))[_0x6f52('0x21')](function(_0x273a63){if(_0x273a63){return _0x273a63[_0x6f52('0x22')]()['then'](function(_0x1e4fad){return _0x1e4fad;});}})[_0x6f52('0x21')](function(_0x5610a){_0x38fcd6=_0x5610a;if(_0x5610a){if(_0x5610a[_0x6f52('0x56')]||_0x5610a['CampaignId']){return db[_0x5610a[_0x6f52('0x56')]?'VoiceQueue':_0x6f52('0x57')][_0x6f52('0x51')]({'where':{'id':_0x5610a[_0x6f52('0x56')]?_0x5610a[_0x6f52('0x56')]:_0x5610a['CampaignId']},'attributes':['id',_0x6f52('0x25')],'raw':!![]});}}})[_0x6f52('0x21')](function(_0x1ec19e){var _0x281be0={};if(_0x1ec19e){_[_0x6f52('0x58')](_0x281be0,_['omit'](_0x38fcd6[_0x6f52('0x59')],[_0x6f52('0x5a'),_0x6f52('0x5b'),'id']));_0x281be0[_0x6f52('0x5c')]=0x15;_0x281be0[_0x6f52('0x5d')]=_0x6f52('0x5e');_0x281be0[_0x6f52('0x5f')]=_0x1ec19e[_0x6f52('0x25')];_0x281be0[_0x6f52('0x60')]=_0xd92aa2[_0x6f52('0x61')][_0x6f52('0x25')];_0x281be0[_0x6f52('0x62')]=_0xd92aa2['user']['id'];_0x281be0[_0x6f52('0x5e')]=!![];_0x281be0[_0x6f52('0x63')]=moment()[_0x6f52('0x64')](_0x6f52('0x65'));_0x281be0['calleridnum']=_0x38fcd6['phone'];_0x281be0[_0x6f52('0x66')]=_0x38fcd6['VoiceQueueId']?_0x6f52('0x67'):_0x6f52('0x68');return db['CmContact'][_0x6f52('0x51')]({'where':{'id':_0x281be0['ContactId']},'attributes':['firstName',_0x6f52('0x69')]})['then'](function(_0x57452d){if(!_[_0x6f52('0x6a')](_0x812f1d)&&!_[_0x6f52('0x6a')](_0x57452d[_0x6f52('0x6b')])){_0x281be0['calleridname']=_0x57452d[_0x6f52('0x6b')];if(!_[_0x6f52('0x6a')](_0x57452d['lastName'])){_0x281be0['calleridname']+='\x20'+_0x57452d['lastName'];}}})[_0x6f52('0x6c')](function(){return db[_0x6f52('0x6d')][_0x6f52('0x53')](_0x281be0);});}})[_0x6f52('0x21')](function(){return _0x812f1d[_0x6f52('0x19')](0xcc)[_0x6f52('0x23')]();})[_0x6f52('0x52')](handleError(_0x812f1d,null));};exports[_0x6f52('0x6e')]=function(_0x448305,_0x206efd,_0x354e48){var _0x12b78d=[];return db['CmContact'][_0x6f52('0x55')]()[_0x6f52('0x21')](function(_0x38fed3){_0x12b78d=_[_0x6f52('0x50')](_0x38fed3);return _0x448305[_0x6f52('0x61')][_0x6f52('0x6f')]({'where':{'type':_0x6f52('0x70'),'dialActive':!![],'dialMethod':_0x6f52('0x71')},'attributes':['id',_0x6f52('0x72')],'raw':!![]});})[_0x6f52('0x21')](function(_0x1c63df){if(_0x1c63df&&_0x1c63df[_0x6f52('0x41')]){return db[_0x6f52('0x73')]['transaction'](function(_0x505ffc){var _0x26e6d3={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6f52('0x64')](_0x6f52('0x65'))},'VoiceQueueId':{'$in':_[_0x6f52('0x49')](_0x1c63df,'id')},'$or':[{'UserId':null},{'UserId':_0x448305[_0x6f52('0x61')]['id']}]};var _0x19dc87=[];if(_0x448305['body'][_0x6f52('0x74')]&&_0x448305[_0x6f52('0x54')][_0x6f52('0x74')]===_0x6f52('0x75')){if(!_[_0x6f52('0x76')](_0x448305['body'][_0x6f52('0x77')])){_0x26e6d3['id']={'$in':_0x448305[_0x6f52('0x54')]['hopperIds']};}_0x19dc87=[['priority','ASC'],[_0x6f52('0x78'),_0x1c63df[0x0][_0x6f52('0x72')]===_0x6f52('0x79')?_0x6f52('0x7a'):'ASC'],db[_0x6f52('0x73')]['literal'](_0x6f52('0x7b')),['id','DESC']];}else{if(!_[_0x6f52('0x76')](_0x448305['body']['hopperIds'])){_0x26e6d3['id']={'$notIn':_0x448305['body']['hopperIds']};}_0x19dc87=[[_0x6f52('0x7c'),_0x6f52('0x7a')],[_0x6f52('0x78'),_0x1c63df[0x0][_0x6f52('0x72')]],db[_0x6f52('0x73')][_0x6f52('0x7d')](_0x6f52('0x7e')),['id','ASC']];}return db[_0x6f52('0x27')][_0x6f52('0x7f')]({'attributes':['id',_0x6f52('0x80')],'where':_0x26e6d3,'order':_0x19dc87,'transaction':_0x505ffc,'lock':_0x505ffc[_0x6f52('0x81')][_0x6f52('0x82')],'include':[{'model':db[_0x6f52('0x83')],'as':_0x6f52('0x84'),'attributes':_0x12b78d,'include':[{'model':db[_0x6f52('0x85')],'as':_0x6f52('0x86'),'attributes':['id',_0x6f52('0x25')]}]},{'model':db[_0x6f52('0x87')],'as':_0x6f52('0x88'),'attributes':['id',_0x6f52('0x25')]},{'model':db[_0x6f52('0x89')],'as':_0x6f52('0x8a'),'attributes':['id',_0x6f52('0x25'),_0x6f52('0x8b')]}]})[_0x6f52('0x21')](function(_0x72121f){if(_0x72121f){return _0x72121f['update']({'UserId':_0x448305[_0x6f52('0x61')]['id']},{'transaction':_0x505ffc});}});});}})['then'](handleEntityNotFound(_0x206efd,null))['then'](respondWithResult(_0x206efd,null))[_0x6f52('0x52')](handleError(_0x206efd,null));};exports[_0x6f52('0x8c')]=function(_0x1787f8,_0x151fe5,_0x2ccf22){return _0x1787f8[_0x6f52('0x61')][_0x6f52('0x6f')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0x6f52('0x71')},'attributes':['id'],'raw':!![]})[_0x6f52('0x21')](function(_0x2cb717){if(_0x2cb717&&_0x2cb717['length']){return db[_0x6f52('0x27')][_0x6f52('0x1a')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6f52('0x64')](_0x6f52('0x65'))},'VoiceQueueId':{'$in':_[_0x6f52('0x49')](_0x2cb717,'id')},'$or':[{'UserId':null},{'UserId':_0x1787f8[_0x6f52('0x61')]['id']}]}});}return 0x0;})[_0x6f52('0x21')](function(_0x3aa888){if(!_[_0x6f52('0x6a')](_0x3aa888)&&_[_0x6f52('0x8d')](_0x3aa888)){return _0x151fe5[_0x6f52('0x19')](0xc8)[_0x6f52('0x1d')]({'contacts':_0x3aa888});}else{logger[_0x6f52('0x24')](_0x6f52('0x8e'),_0x6f52('0x8c'),0x194,_0x6f52('0x8f'));_0x151fe5['sendStatus'](0x194);}})['catch'](handleError(_0x151fe5,null));}; \ No newline at end of file +var _0x3c55=['campaigntype','ivr','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','outbound','sequelize','YYYY-MM-DD\x20HH:mm:ss','direction','isEmpty','hopperIds','priority','ASC','scheduledAt','dialOrderByScheduledAt','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','LOCK','Contact','CmCompany','Company','CmList','List','dialActive','update','getOpenContacts','getVoiceQueues','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','html-pdf','rimraf','fast-json-patch','moment','bluebird','sox','to-csv','ejs','squel','crypto','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','save','then','destroy','error','name','send','CmHopper','rawAttributes','fieldName','type','model','query','keys','intersection','filters','concat','$and','$or','$gt','$lte','$ne','$between','$notBetween','$in','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','$any','attributes','fields','length','nolimit','sort','pick','filter','merge','where','options','includeAll','include','rows','show','params','find','create','body','catch','describe','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','state','statedesc','deleted','campaign','membername','user','UserId','format','calleridnum','phone'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0x3c55,0x131));var _0x53c5=function(_0x526360,_0x2d33bd){_0x526360=_0x526360-0x0;var _0x15d868=_0x3c55[_0x526360];return _0x15d868;};'use strict';var pdf=require(_0x53c5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x53c5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53c5('0x2'));var rp=require('request-promise');var moment=require(_0x53c5('0x3'));var BPromise=require(_0x53c5('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x53c5('0x5'));var csv=require(_0x53c5('0x6'));var ejs=require(_0x53c5('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x53c5('0x8'));var crypto=require(_0x53c5('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x53c5('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x53c5('0xa'));var qs=require('../../components/parsers/qs');var as=require(_0x53c5('0xb'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x53c5('0xc'));var utils=require('../../config/utils');var config=require(_0x53c5('0xd'));var db=require(_0x53c5('0xe'))['db'];function respondWithStatusCode(_0xd39be0,_0x267312){_0x267312=_0x267312||0xcc;return function(_0xb40553){if(_0xb40553){return _0xd39be0[_0x53c5('0xf')](_0x267312);}return _0xd39be0[_0x53c5('0x10')](_0x267312)[_0x53c5('0x11')]();};}function respondWithResult(_0x366ed3,_0x5a1191){_0x5a1191=_0x5a1191||0xc8;return function(_0x48217d){if(_0x48217d){return _0x366ed3[_0x53c5('0x10')](_0x5a1191)['json'](_0x48217d);}};}function respondWithFilteredResult(_0x3b0228,_0xa0d0fb){return function(_0xe4ada){if(_0xe4ada){var _0xecffbe=_0xe4ada[_0x53c5('0x12')],_0x4a8f0=_0xa0d0fb[_0x53c5('0x13')],_0x53eb52=_0xa0d0fb[_0x53c5('0x13')]+_0xa0d0fb[_0x53c5('0x14')],_0x534273;if(_0x53eb52>=_0xecffbe){_0x53eb52=_0xecffbe;_0x534273=0xc8;}else{_0x534273=0xce;}_0x3b0228[_0x53c5('0x10')](_0x534273);return _0x3b0228[_0x53c5('0x15')](_0x53c5('0x16'),_0x4a8f0+'-'+_0x53eb52+'/'+_0xecffbe)[_0x53c5('0x17')](_0xe4ada);}return null;};}function patchUpdates(_0x3c2f89){return function(_0xa72cd7){try{jsonpatch[_0x53c5('0x18')](_0xa72cd7,_0x3c2f89,!![]);}catch(_0xf0ab90){return BPromise['reject'](_0xf0ab90);}return _0xa72cd7[_0x53c5('0x19')]();};}function saveUpdates(_0x445754,_0x42db07){return function(_0x21de4e){if(_0x21de4e){return _0x21de4e['update'](_0x445754)[_0x53c5('0x1a')](function(_0x27339a){return _0x27339a;});}return null;};}function removeEntity(_0xfa9445,_0x11fbf1){return function(_0x27b740){if(_0x27b740){return _0x27b740[_0x53c5('0x1b')]()[_0x53c5('0x1a')](function(){_0xfa9445[_0x53c5('0x10')](0xcc)[_0x53c5('0x11')]();});}};}function handleEntityNotFound(_0x279dcb,_0x304ebd){return function(_0x4ef65d){if(!_0x4ef65d){_0x279dcb[_0x53c5('0xf')](0x194);}return _0x4ef65d;};}function handleError(_0x3f75c0,_0x2ce3b7){_0x2ce3b7=_0x2ce3b7||0x1f4;return function(_0x2a3b5c){logger[_0x53c5('0x1c')](_0x2a3b5c['stack']);if(_0x2a3b5c[_0x53c5('0x1d')]){delete _0x2a3b5c[_0x53c5('0x1d')];}_0x3f75c0[_0x53c5('0x10')](_0x2ce3b7)[_0x53c5('0x1e')](_0x2a3b5c);};}exports['index']=function(_0x5f5437,_0x315389){var _0x558b09={},_0x458900={},_0x456983={'count':0x0,'rows':[]};var _0x478aa0=_['map'](db[_0x53c5('0x1f')][_0x53c5('0x20')],function(_0x1aec90){return{'name':_0x1aec90[_0x53c5('0x21')],'type':_0x1aec90[_0x53c5('0x22')]['key']};});_0x458900[_0x53c5('0x23')]=_['map'](_0x478aa0,'name');_0x458900[_0x53c5('0x24')]=_[_0x53c5('0x25')](_0x5f5437[_0x53c5('0x24')]);_0x458900['filters']=_[_0x53c5('0x26')](_0x458900[_0x53c5('0x23')],_0x458900[_0x53c5('0x24')]);_0x458900[_0x53c5('0x27')]=_[_0x53c5('0x28')](_0x458900['filters'],[_0x53c5('0x29'),_0x53c5('0x2a'),_0x53c5('0x2b'),'$gte','$lt',_0x53c5('0x2c'),_0x53c5('0x2d'),'$eq','$not',_0x53c5('0x2e'),_0x53c5('0x2f'),_0x53c5('0x30'),'$notIn','$like',_0x53c5('0x31'),_0x53c5('0x32'),_0x53c5('0x33'),_0x53c5('0x34'),_0x53c5('0x35'),_0x53c5('0x36'),_0x53c5('0x37'),_0x53c5('0x38')]);_0x558b09[_0x53c5('0x39')]=_[_0x53c5('0x26')](_0x458900['model'],qs[_0x53c5('0x3a')](_0x5f5437[_0x53c5('0x24')][_0x53c5('0x3a')]));_0x558b09['attributes']=_0x558b09[_0x53c5('0x39')][_0x53c5('0x3b')]?_0x558b09[_0x53c5('0x39')]:_0x458900[_0x53c5('0x23')];if(!_0x5f5437['query']['hasOwnProperty'](_0x53c5('0x3c'))){_0x558b09[_0x53c5('0x14')]=qs['limit'](_0x5f5437['query']['limit']);_0x558b09[_0x53c5('0x13')]=qs[_0x53c5('0x13')](_0x5f5437[_0x53c5('0x24')]['offset']);}_0x558b09['order']=qs[_0x53c5('0x3d')](_0x5f5437[_0x53c5('0x24')][_0x53c5('0x3d')]);_0x558b09['where']=qs[_0x53c5('0x27')](_[_0x53c5('0x3e')](_0x5f5437[_0x53c5('0x24')],_0x458900[_0x53c5('0x27')]));if(_0x5f5437['query'][_0x53c5('0x3f')]){_0x558b09['where']=_[_0x53c5('0x40')](_0x558b09[_0x53c5('0x41')],{'$or':_['map'](_0x478aa0,function(_0x53f4d5){if(_0x53f4d5[_0x53c5('0x22')]!=='VIRTUAL'){var _0x343944={};_0x343944[_0x53f4d5[_0x53c5('0x1d')]]={'$like':'%'+_0x5f5437['query'][_0x53c5('0x3f')]+'%'};return _0x343944;}})});}_0x558b09=_[_0x53c5('0x40')]({},_0x558b09,_0x5f5437[_0x53c5('0x42')]);var _0x5e18aa={'where':_0x558b09['where']};return db[_0x53c5('0x1f')]['count'](_0x5e18aa)[_0x53c5('0x1a')](function(_0x230571){_0x456983['count']=_0x230571;if(_0x5f5437[_0x53c5('0x24')][_0x53c5('0x43')]){_0x558b09[_0x53c5('0x44')]=[{'all':!![]}];}return db['CmHopper']['findAll'](_0x558b09);})[_0x53c5('0x1a')](function(_0x1dfc0c){_0x456983[_0x53c5('0x45')]=_0x1dfc0c;return _0x456983;})[_0x53c5('0x1a')](respondWithFilteredResult(_0x315389,_0x558b09))['catch'](handleError(_0x315389,null));};exports[_0x53c5('0x46')]=function(_0x5b906c,_0x2f7ac7){var _0x19e912={'raw':!![],'where':{'id':_0x5b906c[_0x53c5('0x47')]['id']}},_0x4391fe={};_0x4391fe[_0x53c5('0x23')]=_['keys'](db['CmHopper'][_0x53c5('0x20')]);_0x4391fe[_0x53c5('0x24')]=_[_0x53c5('0x25')](_0x5b906c['query']);_0x4391fe['filters']=_[_0x53c5('0x26')](_0x4391fe[_0x53c5('0x23')],_0x4391fe[_0x53c5('0x24')]);_0x19e912[_0x53c5('0x39')]=_[_0x53c5('0x26')](_0x4391fe[_0x53c5('0x23')],qs[_0x53c5('0x3a')](_0x5b906c['query']['fields']));_0x19e912[_0x53c5('0x39')]=_0x19e912[_0x53c5('0x39')][_0x53c5('0x3b')]?_0x19e912[_0x53c5('0x39')]:_0x4391fe[_0x53c5('0x23')];if(_0x5b906c[_0x53c5('0x24')][_0x53c5('0x43')]){_0x19e912[_0x53c5('0x44')]=[{'all':!![]}];}_0x19e912=_[_0x53c5('0x40')]({},_0x19e912,_0x5b906c[_0x53c5('0x42')]);return db[_0x53c5('0x1f')][_0x53c5('0x48')](_0x19e912)[_0x53c5('0x1a')](handleEntityNotFound(_0x2f7ac7,null))[_0x53c5('0x1a')](respondWithResult(_0x2f7ac7,null))['catch'](handleError(_0x2f7ac7,null));};exports[_0x53c5('0x49')]=function(_0x37059a,_0x7470d3){return db[_0x53c5('0x1f')][_0x53c5('0x49')](_0x37059a[_0x53c5('0x4a')],{})[_0x53c5('0x1a')](respondWithResult(_0x7470d3,0xc9))['catch'](handleError(_0x7470d3,null));};exports['update']=function(_0xf7e173,_0x4d9c96){if(_0xf7e173['body']['id']){delete _0xf7e173[_0x53c5('0x4a')]['id'];}return db[_0x53c5('0x1f')][_0x53c5('0x48')]({'where':{'id':_0xf7e173[_0x53c5('0x47')]['id']}})[_0x53c5('0x1a')](handleEntityNotFound(_0x4d9c96,null))[_0x53c5('0x1a')](saveUpdates(_0xf7e173[_0x53c5('0x4a')],null))[_0x53c5('0x1a')](respondWithResult(_0x4d9c96,null))[_0x53c5('0x4b')](handleError(_0x4d9c96,null));};exports[_0x53c5('0x4c')]=function(_0x546bdf,_0x374698){return db[_0x53c5('0x1f')]['describe']()[_0x53c5('0x1a')](respondWithResult(_0x374698,null))[_0x53c5('0x4b')](handleError(_0x374698,null));};exports['destroy']=function(_0x42c315,_0x3f7da1){var _0x28563f;return db[_0x53c5('0x1f')]['find']({'where':{'id':_0x42c315[_0x53c5('0x47')]['id']}})[_0x53c5('0x1a')](handleEntityNotFound(_0x3f7da1,null))['then'](function(_0x36671a){if(_0x36671a){return _0x36671a['destroy']()[_0x53c5('0x1a')](function(_0x520ab8){return _0x520ab8;});}})['then'](function(_0x3947fc){_0x28563f=_0x3947fc;if(_0x3947fc){if(_0x3947fc[_0x53c5('0x4d')]||_0x3947fc[_0x53c5('0x4e')]){return db[_0x3947fc[_0x53c5('0x4d')]?_0x53c5('0x4f'):_0x53c5('0x50')][_0x53c5('0x48')]({'where':{'id':_0x3947fc[_0x53c5('0x4d')]?_0x3947fc['VoiceQueueId']:_0x3947fc[_0x53c5('0x4e')]},'attributes':['id',_0x53c5('0x1d')],'raw':!![]});}}})[_0x53c5('0x1a')](function(_0x156faa){var _0x197602={};if(_0x156faa){_['merge'](_0x197602,_[_0x53c5('0x51')](_0x28563f[_0x53c5('0x52')],[_0x53c5('0x53'),'updatedAt','id']));_0x197602[_0x53c5('0x54')]=0x15;_0x197602[_0x53c5('0x55')]=_0x53c5('0x56');_0x197602[_0x53c5('0x57')]=_0x156faa[_0x53c5('0x1d')];_0x197602[_0x53c5('0x58')]=_0x42c315[_0x53c5('0x59')][_0x53c5('0x1d')];_0x197602[_0x53c5('0x5a')]=_0x42c315[_0x53c5('0x59')]['id'];_0x197602[_0x53c5('0x56')]=!![];_0x197602['deletedat']=moment()[_0x53c5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss');_0x197602[_0x53c5('0x5c')]=_0x28563f[_0x53c5('0x5d')];_0x197602[_0x53c5('0x5e')]=_0x28563f[_0x53c5('0x4d')]?'queue':_0x53c5('0x5f');return db[_0x53c5('0x60')]['find']({'where':{'id':_0x197602[_0x53c5('0x61')]},'attributes':[_0x53c5('0x62'),_0x53c5('0x63')]})['then'](function(_0x42be03){if(!_[_0x53c5('0x64')](_0x3f7da1)&&!_[_0x53c5('0x64')](_0x42be03[_0x53c5('0x62')])){_0x197602['calleridname']=_0x42be03[_0x53c5('0x62')];if(!_[_0x53c5('0x64')](_0x42be03[_0x53c5('0x63')])){_0x197602[_0x53c5('0x65')]+='\x20'+_0x42be03['lastName'];}}})[_0x53c5('0x66')](function(){return db[_0x53c5('0x67')][_0x53c5('0x49')](_0x197602);});}})[_0x53c5('0x1a')](function(){return _0x3f7da1[_0x53c5('0x10')](0xcc)['end']();})[_0x53c5('0x4b')](handleError(_0x3f7da1,null));};exports[_0x53c5('0x68')]=function(_0x2aa36f,_0x276100,_0x105cfd){var _0x3dfd17=[];return db[_0x53c5('0x60')]['describe']()['then'](function(_0x55be50){_0x3dfd17=_[_0x53c5('0x25')](_0x55be50);return _0x2aa36f[_0x53c5('0x59')]['getVoiceQueues']({'where':{'type':_0x53c5('0x69'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id','dialOrderByScheduledAt'],'raw':!![]});})[_0x53c5('0x1a')](function(_0x2a4108){if(_0x2a4108&&_0x2a4108[_0x53c5('0x3b')]){return db[_0x53c5('0x6a')]['transaction'](function(_0x453a9c){var _0x364378={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53c5('0x5b')](_0x53c5('0x6b'))},'VoiceQueueId':{'$in':_['map'](_0x2a4108,'id')},'$or':[{'UserId':null},{'UserId':_0x2aa36f[_0x53c5('0x59')]['id']}]};var _0x39c1f4=[];if(_0x2aa36f['body'][_0x53c5('0x6c')]&&_0x2aa36f['body']['direction']==='prev'){if(!_[_0x53c5('0x6d')](_0x2aa36f['body'][_0x53c5('0x6e')])){_0x364378['id']={'$in':_0x2aa36f[_0x53c5('0x4a')][_0x53c5('0x6e')]};}_0x39c1f4=[[_0x53c5('0x6f'),_0x53c5('0x70')],[_0x53c5('0x71'),_0x2a4108[0x0][_0x53c5('0x72')]===_0x53c5('0x70')?'DESC':_0x53c5('0x70')],db[_0x53c5('0x6a')][_0x53c5('0x73')](_0x53c5('0x74')),['id',_0x53c5('0x75')]];}else{if(!_[_0x53c5('0x6d')](_0x2aa36f[_0x53c5('0x4a')]['hopperIds'])){_0x364378['id']={'$notIn':_0x2aa36f[_0x53c5('0x4a')][_0x53c5('0x6e')]};}_0x39c1f4=[[_0x53c5('0x6f'),_0x53c5('0x75')],['scheduledAt',_0x2a4108[0x0][_0x53c5('0x72')]],db[_0x53c5('0x6a')]['literal'](_0x53c5('0x76')),['id',_0x53c5('0x70')]];}return db['CmHopper'][_0x53c5('0x77')]({'attributes':['id','scheduledat'],'where':_0x364378,'order':_0x39c1f4,'transaction':_0x453a9c,'lock':_0x453a9c[_0x53c5('0x78')]['UPDATE'],'include':[{'model':db[_0x53c5('0x60')],'as':_0x53c5('0x79'),'attributes':_0x3dfd17,'include':[{'model':db[_0x53c5('0x7a')],'as':_0x53c5('0x7b'),'attributes':['id',_0x53c5('0x1d')]}]},{'model':db[_0x53c5('0x7c')],'as':_0x53c5('0x7d'),'attributes':['id',_0x53c5('0x1d')]},{'model':db[_0x53c5('0x4f')],'as':'Queue','attributes':['id',_0x53c5('0x1d'),_0x53c5('0x7e')]}]})[_0x53c5('0x1a')](function(_0x133f89){if(_0x133f89){return _0x133f89[_0x53c5('0x7f')]({'UserId':_0x2aa36f['user']['id']},{'transaction':_0x453a9c});}});});}})['then'](handleEntityNotFound(_0x276100,null))[_0x53c5('0x1a')](respondWithResult(_0x276100,null))[_0x53c5('0x4b')](handleError(_0x276100,null));};exports[_0x53c5('0x80')]=function(_0x57bc5d,_0x4d7e20,_0x252a07){return _0x57bc5d['user'][_0x53c5('0x81')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x53c5('0x1a')](function(_0x29f58a){if(_0x29f58a&&_0x29f58a[_0x53c5('0x3b')]){return db[_0x53c5('0x1f')][_0x53c5('0x12')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x53c5('0x5b')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0x29f58a,'id')},'$or':[{'UserId':null},{'UserId':_0x57bc5d['user']['id']}]}});}return 0x0;})[_0x53c5('0x1a')](function(_0x3d8cf1){if(!_[_0x53c5('0x64')](_0x3d8cf1)&&_[_0x53c5('0x82')](_0x3d8cf1)){return _0x4d7e20[_0x53c5('0x10')](0xc8)[_0x53c5('0x17')]({'contacts':_0x3d8cf1});}else{logger[_0x53c5('0x1c')](_0x53c5('0x83'),_0x53c5('0x80'),0x194,_0x53c5('0x84'));_0x4d7e20[_0x53c5('0xf')](0x194);}})[_0x53c5('0x4b')](handleError(_0x4d7e20,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 85b2e7a..e15dd20 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 _0x52b9=['scheduledat','phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','cm_hopper'];(function(_0x14d770,_0x41b389){var _0x4283a5=function(_0x1bc6e7){while(--_0x1bc6e7){_0x14d770['push'](_0x14d770['shift']());}};_0x4283a5(++_0x41b389);}(_0x52b9,0x14d));var _0x952b=function(_0x456546,_0x887210){_0x456546=_0x456546-0x0;var _0xa60a36=_0x52b9[_0x456546];return _0xa60a36;};'use strict';var _=require(_0x952b('0x0'));var util=require(_0x952b('0x1'));var logger=require(_0x952b('0x2'))(_0x952b('0x3'));var moment=require(_0x952b('0x4'));var BPromise=require(_0x952b('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x952b('0x6'));var rimraf=require(_0x952b('0x7'));var config=require(_0x952b('0x8'));var attributes=require(_0x952b('0x9'));module[_0x952b('0xa')]=function(_0x555003,_0x4d67f8){return _0x555003['define']('CmHopper',attributes,{'tableName':_0x952b('0xb'),'paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x952b('0xc')]},{'name':_0x952b('0xd'),'fields':[_0x952b('0xd')]},{'name':'priority','fields':[_0x952b('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x1ad3=['priority','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./cmHopper.attributes','exports','define','cm_hopper','scheduledat','phone'];(function(_0x49fbd8,_0x80d004){var _0x4d398f=function(_0x4f49d1){while(--_0x4f49d1){_0x49fbd8['push'](_0x49fbd8['shift']());}};_0x4d398f(++_0x80d004);}(_0x1ad3,0x14b));var _0x31ad=function(_0xe0b81f,_0x1fb734){_0xe0b81f=_0xe0b81f-0x0;var _0x290e5e=_0x1ad3[_0xe0b81f];return _0x290e5e;};'use strict';var _=require(_0x31ad('0x0'));var util=require(_0x31ad('0x1'));var logger=require(_0x31ad('0x2'))(_0x31ad('0x3'));var moment=require(_0x31ad('0x4'));var BPromise=require(_0x31ad('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x31ad('0x6'));var rimraf=require('rimraf');var config=require(_0x31ad('0x7'));var attributes=require(_0x31ad('0x8'));module[_0x31ad('0x9')]=function(_0x113525,_0x21c914){return _0x113525[_0x31ad('0xa')]('CmHopper',attributes,{'tableName':_0x31ad('0xb'),'paranoid':![],'indexes':[{'name':_0x31ad('0xc'),'fields':['scheduledat']},{'name':_0x31ad('0xd'),'fields':[_0x31ad('0xd')]},{'name':_0x31ad('0xe'),'fields':[_0x31ad('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 8b6dcc1..c74716a 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 _0x7a54=['stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','limit','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','body','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','push','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x32c351,_0x5778a4){_0x32c351=_0x32c351-0x0;var _0x3df8aa=_0x7a54[_0x32c351];return _0x3df8aa;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['GetCmHopper']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});};exports[_0x47a5('0x22')]=function(_0x49c4b5){var _0x101f70=this;return new Promise(function(_0x10f660,_0x596097){return db[_0x47a5('0x15')][_0x47a5('0x23')](_0x49c4b5['body'],{'raw':_0x49c4b5['options']?_0x49c4b5['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b5eaf){logger[_0x47a5('0xb')](_0x47a5('0x22'),_0x49c4b5);logger[_0x47a5('0xd')](_0x47a5('0x22'),_0x49c4b5,JSON[_0x47a5('0xe')](_0x9b5eaf));_0x10f660(_0x9b5eaf);})[_0x47a5('0x14')](function(_0x1f3d01){logger[_0x47a5('0xf')](_0x47a5('0x22'),_0x1f3d01[_0x47a5('0x11')],_0x49c4b5);_0x596097(_0x101f70[_0x47a5('0xf')](0x1f4,_0x1f3d01[_0x47a5('0x11')]));});});};exports['UpdateCmHopper']=function(_0x1fbece){var _0x1c36fa=this;return new Promise(function(_0x331474,_0x23bd8d){return db['CmHopper'][_0x47a5('0x24')](_0x1fbece['body'],{'raw':_0x1fbece['options']?_0x1fbece['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbece[_0x47a5('0x17')]?_0x1fbece['options'][_0x47a5('0x19')]||null:null,'attributes':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['attributes']||null:null,'limit':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['limit']||null:null})['then'](function(_0xbe21d9){logger['info'](_0x47a5('0x25'),_0x1fbece);logger[_0x47a5('0xd')](_0x47a5('0x25'),_0x1fbece,JSON[_0x47a5('0xe')](_0xbe21d9));_0x331474(_0xbe21d9);})[_0x47a5('0x14')](function(_0xf0edbb){logger[_0x47a5('0xf')](_0x47a5('0x25'),_0xf0edbb[_0x47a5('0x11')],_0x1fbece);_0x23bd8d(_0x1c36fa[_0x47a5('0xf')](0x1f4,_0xf0edbb[_0x47a5('0x11')]));});});};exports[_0x47a5('0x26')]=function(_0xe28d76){var _0x3574d4=this;return new Promise(function(_0x4e5e7,_0x3a2b38){return db['CmHopper'][_0x47a5('0x27')]({'where':_0xe28d76[_0x47a5('0x17')]?_0xe28d76['options']['where']||null:null})[_0x47a5('0x1e')](function(_0x560e4e){logger[_0x47a5('0xb')](_0x47a5('0x26'),_0xe28d76);logger['debug']('DestroyCmHopper',_0xe28d76,JSON[_0x47a5('0xe')](_0x560e4e));_0x4e5e7(_0x560e4e);})['catch'](function(_0x2d147c){logger[_0x47a5('0xf')](_0x47a5('0x26'),_0x2d147c[_0x47a5('0x11')],_0xe28d76);_0x3a2b38(_0x3574d4[_0x47a5('0xf')](0x1f4,_0x2d147c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x28')]=function(_0x53e994){var _0x48a0ef=this;return new Promise(function(_0x2dd1db,_0x411230){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x2c0c86){return db[_0x47a5('0x2b')]['transaction'](function(_0x45cca5){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'where':_0x53e994['options']?_0x53e994[_0x47a5('0x17')]['where']||null:null,'attributes':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'limit':_0x53e994[_0x47a5('0x17')]?_0x53e994['options'][_0x47a5('0x2c')]||null:null,'order':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'transaction':_0x45cca5,'lock':_0x45cca5[_0x47a5('0x2e')][_0x47a5('0x2f')],'include':[{'model':db[_0x47a5('0x29')],'as':'Contact','attributes':_[_0x47a5('0x30')](_0x2c0c86)},{'model':db[_0x47a5('0x31')],'as':_0x47a5('0x32'),'attributes':['id',_0x47a5('0x33'),_0x47a5('0x34')]}]})[_0x47a5('0x1e')](function(_0x572233){var _0x1ad6a9=[];for(var _0x245a15=0x0;_0x245a15<_0x572233[_0x47a5('0x35')];_0x245a15+=0x1){_0x1ad6a9['push'](_0x572233[_0x245a15][_0x47a5('0x24')](_0x53e994[_0x47a5('0x36')],{'transaction':_0x45cca5}));}return BPromise[_0x47a5('0x37')](_0x1ad6a9);});})['then'](function(_0x57641e){logger[_0x47a5('0xb')](_0x47a5('0x28'),_0x53e994);logger['debug']('GetContactDialer',_0x53e994,JSON[_0x47a5('0xe')](_0x57641e));_0x2dd1db(_0x57641e);})['catch'](function(_0x16bb8a){logger['error']('GetContactDialer',_0x16bb8a[_0x47a5('0x11')],_0x53e994);_0x411230(_0x48a0ef[_0x47a5('0xf')](0x1f4,_0x16bb8a['message']));});});});};exports[_0x47a5('0x38')]=function(_0x72fe){var _0x4b706a=this;return new Promise(function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x2b')][_0x47a5('0x39')](function(_0x2931e4){return db['CmHopperFinal'][_0x47a5('0x23')](_0x72fe[_0x47a5('0x36')],{'raw':_0x72fe[_0x47a5('0x17')]?_0x72fe['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2931e4})['then'](function(){return db[_0x47a5('0x15')][_0x47a5('0x27')]({'where':_0x72fe[_0x47a5('0x17')]?_0x72fe[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'transaction':_0x2931e4});});})['then'](function(_0x144af9){logger['info']('MoveContactManagedDialer',_0x72fe);logger['debug']('MoveContactManagedDialer',_0x72fe,JSON[_0x47a5('0xe')](_0x144af9));_0x5b6127(_0x144af9);})[_0x47a5('0x14')](function(_0x1e2bb4){logger['error']('MoveContactManagedDialer',_0x1e2bb4[_0x47a5('0x11')],_0x72fe);_0x16b4fd(_0x4b706a[_0x47a5('0xf')](0x1f4,_0x1e2bb4[_0x47a5('0x11')]));});});};exports[_0x47a5('0x3a')]=function(_0xc45e25){var _0x4b5d0c=this;return new Promise(function(_0x3474b7,_0x519e9e){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0xc45e25['options']?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0xc45e25[_0x47a5('0x17')]?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':[[db[_0x47a5('0x2b')]['fn'](_0x47a5('0x3b'),db[_0x47a5('0x2b')]['fn']('IF',db['sequelize'][_0x47a5('0x3c')](_0x47a5('0x3d')+util[_0x47a5('0x3e')](_0x47a5('0x3f'),moment()[_0x47a5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x47a5('0x40')))),_0x47a5('0x41')]]})[_0x47a5('0x1e')](function(_0x144aaa){logger[_0x47a5('0xb')](_0x47a5('0x3a'),_0xc45e25);logger[_0x47a5('0xd')](_0x47a5('0x3a'),_0xc45e25,JSON[_0x47a5('0xe')](_0x144aaa));_0x3474b7(_0x144aaa);})[_0x47a5('0x14')](function(_0x1d56f3){logger[_0x47a5('0xf')](_0x47a5('0x3a'),_0x1d56f3[_0x47a5('0x11')],_0xc45e25);_0x519e9e(_0x4b5d0c[_0x47a5('0xf')](0x1f4,_0x1d56f3['message']));});});};exports[_0x47a5('0x42')]=function(_0x284fb8){var _0x30504e=this;return new Promise(function(_0x4b42f3,_0x37ac59){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x5d9822){return db[_0x47a5('0x2b')]['transaction'](function(_0x2d5ee6){return db['CmHopper'][_0x47a5('0x16')]({'where':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':_0x284fb8[_0x47a5('0x17')]?_0x284fb8['options']['attributes']||null:null,'limit':0x1,'order':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'group':db[_0x47a5('0x15')][_0x47a5('0x43')],'transaction':_0x2d5ee6,'lock':_0x2d5ee6['LOCK'][_0x47a5('0x2f')],'include':_0x284fb8[_0x47a5('0x17')]?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')],function(_0x39939a){return{'model':db[_0x39939a[_0x47a5('0x1d')]],'as':_0x39939a['as'],'attributes':_0x39939a[_0x47a5('0x1a')],'include':_0x39939a[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x39939a['include'],function(_0x1e3212){return{'model':db[_0x1e3212['model']],'as':_0x1e3212['as'],'attributes':_0x1e3212[_0x47a5('0x1a')],'include':_0x1e3212[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x1e3212[_0x47a5('0x1b')],function(_0x40e584){return{'model':db[_0x40e584[_0x47a5('0x1d')]],'as':_0x40e584['as'],'attributes':_0x40e584[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x11c1db){var _0x254049=[];for(var _0x1cfb37=0x0;_0x1cfb37<_0x11c1db[_0x47a5('0x35')];_0x1cfb37+=0x1){_0x254049[_0x47a5('0x44')](_0x11c1db[_0x1cfb37][_0x47a5('0x24')](_0x284fb8[_0x47a5('0x36')],{'transaction':_0x2d5ee6}));}return BPromise['all'](_0x254049);});})['then'](function(_0x5ccc89){logger['info'](_0x47a5('0x42'),_0x284fb8);logger[_0x47a5('0xd')]('GetContactRecallMe',_0x284fb8,JSON[_0x47a5('0xe')](_0x5ccc89));_0x4b42f3(_0x5ccc89);})[_0x47a5('0x14')](function(_0x1baa5a){logger[_0x47a5('0xf')](_0x47a5('0x42'),_0x1baa5a[_0x47a5('0x11')],_0x284fb8);_0x37ac59(_0x30504e[_0x47a5('0xf')](0x1f4,_0x1baa5a[_0x47a5('0x11')]));});});});}; \ No newline at end of file +var _0x7a54=['stringify','error','code','message','request\x20sent','result','catch','CmHopper','findAll','options','raw','where','attributes','include','map','model','then','GetCmHopper','ShowCmHopper','find','CreateCmHopper','create','update','UpdateCmHopper','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','limit','order','LOCK','UPDATE','keys','User','Agent','name','voicePause','length','body','all','MoveContactManagedDialer','transaction','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','UserId','push','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','CmHopper,\x20%s,\x20%s','debug'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a54,0x106));var _0x47a5=function(_0x48a0a1,_0x3c6f34){_0x48a0a1=_0x48a0a1-0x0;var _0x2aa583=_0x7a54[_0x48a0a1];return _0x2aa583;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['GetCmHopper']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'limit':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['limit']||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x5247fd['options'][_0x47a5('0x1b')],function(_0x385687){return{'model':db[_0x385687['model']],'as':_0x385687['as'],'attributes':_0x385687[_0x47a5('0x1a')],'include':_0x385687[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x385687[_0x47a5('0x1b')],function(_0x3abd6a){return{'model':db[_0x3abd6a['model']],'as':_0x3abd6a['as'],'attributes':_0x3abd6a['attributes'],'include':_0x3abd6a[_0x47a5('0x1b')]?_['map'](_0x3abd6a[_0x47a5('0x1b')],function(_0x5b6c4e){return{'model':db[_0x5b6c4e[_0x47a5('0x1d')]],'as':_0x5b6c4e['as'],'attributes':_0x5b6c4e[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x1dac65){logger[_0x47a5('0xb')](_0x47a5('0x1f'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1f'),_0x5247fd,JSON[_0x47a5('0xe')](_0x1dac65));_0xaf70a6(_0x1dac65);})[_0x47a5('0x14')](function(_0x1127f8){logger[_0x47a5('0xf')](_0x47a5('0x1f'),_0x1127f8['message'],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x1127f8['message']));});});};exports[_0x47a5('0x20')]=function(_0x9ac908){var _0x16901f=this;return new Promise(function(_0x4d6b57,_0x256650){return db[_0x47a5('0x15')][_0x47a5('0x21')]({'raw':_0x9ac908[_0x47a5('0x17')]?_0x9ac908['options']['raw']===undefined?!![]:![]:!![],'where':_0x9ac908[_0x47a5('0x17')]?_0x9ac908[_0x47a5('0x17')]['where']||null:null,'attributes':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'include':_0x9ac908['options']?_0x9ac908[_0x47a5('0x17')]['include']?_[_0x47a5('0x1c')](_0x9ac908[_0x47a5('0x17')]['include'],function(_0x4843c0){return{'model':db[_0x4843c0[_0x47a5('0x1d')]],'as':_0x4843c0['as'],'attributes':_0x4843c0['attributes'],'include':_0x4843c0[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x4843c0[_0x47a5('0x1b')],function(_0x52749b){return{'model':db[_0x52749b[_0x47a5('0x1d')]],'as':_0x52749b['as'],'attributes':_0x52749b['attributes'],'include':_0x52749b['include']?_[_0x47a5('0x1c')](_0x52749b['include'],function(_0x25cce0){return{'model':db[_0x25cce0['model']],'as':_0x25cce0['as'],'attributes':_0x25cce0[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x38c8d4){logger[_0x47a5('0xb')](_0x47a5('0x20'),_0x9ac908);logger[_0x47a5('0xd')](_0x47a5('0x20'),_0x9ac908,JSON[_0x47a5('0xe')](_0x38c8d4));_0x4d6b57(_0x38c8d4);})[_0x47a5('0x14')](function(_0x4caed5){logger[_0x47a5('0xf')](_0x47a5('0x20'),_0x4caed5['message'],_0x9ac908);_0x256650(_0x16901f[_0x47a5('0xf')](0x1f4,_0x4caed5[_0x47a5('0x11')]));});});};exports[_0x47a5('0x22')]=function(_0x49c4b5){var _0x101f70=this;return new Promise(function(_0x10f660,_0x596097){return db[_0x47a5('0x15')][_0x47a5('0x23')](_0x49c4b5['body'],{'raw':_0x49c4b5['options']?_0x49c4b5['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x9b5eaf){logger[_0x47a5('0xb')](_0x47a5('0x22'),_0x49c4b5);logger[_0x47a5('0xd')](_0x47a5('0x22'),_0x49c4b5,JSON[_0x47a5('0xe')](_0x9b5eaf));_0x10f660(_0x9b5eaf);})[_0x47a5('0x14')](function(_0x1f3d01){logger[_0x47a5('0xf')](_0x47a5('0x22'),_0x1f3d01[_0x47a5('0x11')],_0x49c4b5);_0x596097(_0x101f70[_0x47a5('0xf')](0x1f4,_0x1f3d01[_0x47a5('0x11')]));});});};exports['UpdateCmHopper']=function(_0x1fbece){var _0x1c36fa=this;return new Promise(function(_0x331474,_0x23bd8d){return db['CmHopper'][_0x47a5('0x24')](_0x1fbece['body'],{'raw':_0x1fbece['options']?_0x1fbece['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1fbece[_0x47a5('0x17')]?_0x1fbece['options'][_0x47a5('0x19')]||null:null,'attributes':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['attributes']||null:null,'limit':_0x1fbece[_0x47a5('0x17')]?_0x1fbece[_0x47a5('0x17')]['limit']||null:null})['then'](function(_0xbe21d9){logger['info'](_0x47a5('0x25'),_0x1fbece);logger[_0x47a5('0xd')](_0x47a5('0x25'),_0x1fbece,JSON[_0x47a5('0xe')](_0xbe21d9));_0x331474(_0xbe21d9);})[_0x47a5('0x14')](function(_0xf0edbb){logger[_0x47a5('0xf')](_0x47a5('0x25'),_0xf0edbb[_0x47a5('0x11')],_0x1fbece);_0x23bd8d(_0x1c36fa[_0x47a5('0xf')](0x1f4,_0xf0edbb[_0x47a5('0x11')]));});});};exports[_0x47a5('0x26')]=function(_0xe28d76){var _0x3574d4=this;return new Promise(function(_0x4e5e7,_0x3a2b38){return db['CmHopper'][_0x47a5('0x27')]({'where':_0xe28d76[_0x47a5('0x17')]?_0xe28d76['options']['where']||null:null})[_0x47a5('0x1e')](function(_0x560e4e){logger[_0x47a5('0xb')](_0x47a5('0x26'),_0xe28d76);logger['debug']('DestroyCmHopper',_0xe28d76,JSON[_0x47a5('0xe')](_0x560e4e));_0x4e5e7(_0x560e4e);})['catch'](function(_0x2d147c){logger[_0x47a5('0xf')](_0x47a5('0x26'),_0x2d147c[_0x47a5('0x11')],_0xe28d76);_0x3a2b38(_0x3574d4[_0x47a5('0xf')](0x1f4,_0x2d147c[_0x47a5('0x11')]));});});};exports[_0x47a5('0x28')]=function(_0x53e994){var _0x48a0ef=this;return new Promise(function(_0x2dd1db,_0x411230){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x2c0c86){return db[_0x47a5('0x2b')]['transaction'](function(_0x45cca5){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'where':_0x53e994['options']?_0x53e994[_0x47a5('0x17')]['where']||null:null,'attributes':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x1a')]||null:null,'limit':_0x53e994[_0x47a5('0x17')]?_0x53e994['options'][_0x47a5('0x2c')]||null:null,'order':_0x53e994[_0x47a5('0x17')]?_0x53e994[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'transaction':_0x45cca5,'lock':_0x45cca5[_0x47a5('0x2e')][_0x47a5('0x2f')],'include':[{'model':db[_0x47a5('0x29')],'as':'Contact','attributes':_[_0x47a5('0x30')](_0x2c0c86)},{'model':db[_0x47a5('0x31')],'as':_0x47a5('0x32'),'attributes':['id',_0x47a5('0x33'),_0x47a5('0x34')]}]})[_0x47a5('0x1e')](function(_0x572233){var _0x1ad6a9=[];for(var _0x245a15=0x0;_0x245a15<_0x572233[_0x47a5('0x35')];_0x245a15+=0x1){_0x1ad6a9['push'](_0x572233[_0x245a15][_0x47a5('0x24')](_0x53e994[_0x47a5('0x36')],{'transaction':_0x45cca5}));}return BPromise[_0x47a5('0x37')](_0x1ad6a9);});})['then'](function(_0x57641e){logger[_0x47a5('0xb')](_0x47a5('0x28'),_0x53e994);logger['debug']('GetContactDialer',_0x53e994,JSON[_0x47a5('0xe')](_0x57641e));_0x2dd1db(_0x57641e);})['catch'](function(_0x16bb8a){logger['error']('GetContactDialer',_0x16bb8a[_0x47a5('0x11')],_0x53e994);_0x411230(_0x48a0ef[_0x47a5('0xf')](0x1f4,_0x16bb8a['message']));});});});};exports[_0x47a5('0x38')]=function(_0x72fe){var _0x4b706a=this;return new Promise(function(_0x5b6127,_0x16b4fd){return db[_0x47a5('0x2b')][_0x47a5('0x39')](function(_0x2931e4){return db['CmHopperFinal'][_0x47a5('0x23')](_0x72fe[_0x47a5('0x36')],{'raw':_0x72fe[_0x47a5('0x17')]?_0x72fe['options'][_0x47a5('0x18')]===undefined?!![]:![]:!![],'transaction':_0x2931e4})['then'](function(){return db[_0x47a5('0x15')][_0x47a5('0x27')]({'where':_0x72fe[_0x47a5('0x17')]?_0x72fe[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'transaction':_0x2931e4});});})['then'](function(_0x144af9){logger['info']('MoveContactManagedDialer',_0x72fe);logger['debug']('MoveContactManagedDialer',_0x72fe,JSON[_0x47a5('0xe')](_0x144af9));_0x5b6127(_0x144af9);})[_0x47a5('0x14')](function(_0x1e2bb4){logger['error']('MoveContactManagedDialer',_0x1e2bb4[_0x47a5('0x11')],_0x72fe);_0x16b4fd(_0x4b706a[_0x47a5('0xf')](0x1f4,_0x1e2bb4[_0x47a5('0x11')]));});});};exports[_0x47a5('0x3a')]=function(_0xc45e25){var _0x4b5d0c=this;return new Promise(function(_0x3474b7,_0x519e9e){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0xc45e25['options']?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0xc45e25[_0x47a5('0x17')]?_0xc45e25[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':[[db[_0x47a5('0x2b')]['fn'](_0x47a5('0x3b'),db[_0x47a5('0x2b')]['fn']('IF',db['sequelize'][_0x47a5('0x3c')](_0x47a5('0x3d')+util[_0x47a5('0x3e')](_0x47a5('0x3f'),moment()[_0x47a5('0x3e')]('YYYY-MM-DD\x20HH:mm:ss'))+_0x47a5('0x40')))),_0x47a5('0x41')]]})[_0x47a5('0x1e')](function(_0x144aaa){logger[_0x47a5('0xb')](_0x47a5('0x3a'),_0xc45e25);logger[_0x47a5('0xd')](_0x47a5('0x3a'),_0xc45e25,JSON[_0x47a5('0xe')](_0x144aaa));_0x3474b7(_0x144aaa);})[_0x47a5('0x14')](function(_0x1d56f3){logger[_0x47a5('0xf')](_0x47a5('0x3a'),_0x1d56f3[_0x47a5('0x11')],_0xc45e25);_0x519e9e(_0x4b5d0c[_0x47a5('0xf')](0x1f4,_0x1d56f3['message']));});});};exports[_0x47a5('0x42')]=function(_0x284fb8){var _0x30504e=this;return new Promise(function(_0x4b42f3,_0x37ac59){return db[_0x47a5('0x29')][_0x47a5('0x2a')]()[_0x47a5('0x1e')](function(_0x5d9822){return db[_0x47a5('0x2b')]['transaction'](function(_0x2d5ee6){return db['CmHopper'][_0x47a5('0x16')]({'where':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x19')]||null:null,'attributes':_0x284fb8[_0x47a5('0x17')]?_0x284fb8['options']['attributes']||null:null,'limit':0x1,'order':_0x284fb8['options']?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x2d')]||null:null,'group':db[_0x47a5('0x15')][_0x47a5('0x43')],'transaction':_0x2d5ee6,'lock':_0x2d5ee6['LOCK'][_0x47a5('0x2f')],'include':_0x284fb8[_0x47a5('0x17')]?_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x284fb8[_0x47a5('0x17')][_0x47a5('0x1b')],function(_0x39939a){return{'model':db[_0x39939a[_0x47a5('0x1d')]],'as':_0x39939a['as'],'attributes':_0x39939a[_0x47a5('0x1a')],'include':_0x39939a[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x39939a['include'],function(_0x1e3212){return{'model':db[_0x1e3212['model']],'as':_0x1e3212['as'],'attributes':_0x1e3212[_0x47a5('0x1a')],'include':_0x1e3212[_0x47a5('0x1b')]?_[_0x47a5('0x1c')](_0x1e3212[_0x47a5('0x1b')],function(_0x40e584){return{'model':db[_0x40e584[_0x47a5('0x1d')]],'as':_0x40e584['as'],'attributes':_0x40e584[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x47a5('0x1e')](function(_0x11c1db){var _0x254049=[];for(var _0x1cfb37=0x0;_0x1cfb37<_0x11c1db[_0x47a5('0x35')];_0x1cfb37+=0x1){_0x254049[_0x47a5('0x44')](_0x11c1db[_0x1cfb37][_0x47a5('0x24')](_0x284fb8[_0x47a5('0x36')],{'transaction':_0x2d5ee6}));}return BPromise['all'](_0x254049);});})['then'](function(_0x5ccc89){logger['info'](_0x47a5('0x42'),_0x284fb8);logger[_0x47a5('0xd')]('GetContactRecallMe',_0x284fb8,JSON[_0x47a5('0xe')](_0x5ccc89));_0x4b42f3(_0x5ccc89);})[_0x47a5('0x14')](function(_0x1baa5a){logger[_0x47a5('0xf')](_0x47a5('0x42'),_0x1baa5a[_0x47a5('0x11')],_0x284fb8);_0x37ac59(_0x30504e[_0x47a5('0xf')](0x1f4,_0x1baa5a[_0x47a5('0x11')]));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index cb78e16..dcc65ac 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 _0x5c3c=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','/opencontacts','getOpenContacts','show','create','post','getPreview','/:id','update','destroy','exports','multer','util'];(function(_0x365113,_0x4b58e2){var _0x5f1450=function(_0x361422){while(--_0x361422){_0x365113['push'](_0x365113['shift']());}};_0x5f1450(++_0x4b58e2);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5c3c[_0x34bf97];return _0x292719;};'use strict';var multer=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var path=require(_0xc5c3('0x2'));var timeout=require(_0xc5c3('0x3'));var express=require('express');var router=express[_0xc5c3('0x4')]();var auth=require(_0xc5c3('0x5'));var interaction=require(_0xc5c3('0x6'));var config=require(_0xc5c3('0x7'));var controller=require(_0xc5c3('0x8'));router[_0xc5c3('0x9')]('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xb')]);router[_0xc5c3('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xc5c3('0x9')](_0xc5c3('0xc'),auth['isAuthenticated'](),controller[_0xc5c3('0xd')]);router[_0xc5c3('0x9')]('/:id',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xe')]);router['post']('/',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0xf')]);router[_0xc5c3('0x10')]('/preview',auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x11')]);router['put'](_0xc5c3('0x12'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x13')]);router['delete'](_0xc5c3('0x12'),auth[_0xc5c3('0xa')](),controller[_0xc5c3('0x14')]);module[_0xc5c3('0x15')]=router; \ No newline at end of file +var _0xdf5d=['create','post','/preview','getPreview','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./cmHopper.controller','get','isAuthenticated','index','/describe','describe','/opencontacts','getOpenContacts','/:id','show'];(function(_0x4a92f7,_0x24e95d){var _0x30a7a5=function(_0x4a7bb5){while(--_0x4a7bb5){_0x4a92f7['push'](_0x4a92f7['shift']());}};_0x30a7a5(++_0x24e95d);}(_0xdf5d,0x126));var _0xddf5=function(_0x337f0b,_0x2773df){_0x337f0b=_0x337f0b-0x0;var _0x55744d=_0xdf5d[_0x337f0b];return _0x55744d;};'use strict';var multer=require(_0xddf5('0x0'));var util=require(_0xddf5('0x1'));var path=require(_0xddf5('0x2'));var timeout=require(_0xddf5('0x3'));var express=require(_0xddf5('0x4'));var router=express[_0xddf5('0x5')]();var auth=require(_0xddf5('0x6'));var interaction=require(_0xddf5('0x7'));var config=require('../../config/environment');var controller=require(_0xddf5('0x8'));router[_0xddf5('0x9')]('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0xb')]);router[_0xddf5('0x9')](_0xddf5('0xc'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xd')]);router[_0xddf5('0x9')](_0xddf5('0xe'),auth[_0xddf5('0xa')](),controller[_0xddf5('0xf')]);router[_0xddf5('0x9')](_0xddf5('0x10'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x11')]);router['post']('/',auth[_0xddf5('0xa')](),controller[_0xddf5('0x12')]);router[_0xddf5('0x13')](_0xddf5('0x14'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x15')]);router[_0xddf5('0x16')](_0xddf5('0x10'),auth['isAuthenticated'](),controller['update']);router[_0xddf5('0x17')](_0xddf5('0x10'),auth[_0xddf5('0xa')](),controller[_0xddf5('0x18')]);module[_0xddf5('0x19')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index c2051dd..a94ee49 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 _0x1492=['INTEGER','contactListQueue','moment','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x1492,0xac));var _0x2149=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x1492[_0x45e98e];return _0x374dba;};'use strict';var moment=require(_0x2149('0x0'));var Sequelize=require('sequelize');module[_0x2149('0x1')]={'phone':{'type':Sequelize[_0x2149('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x2149('0x3')],'unique':_0x2149('0x4')},'VoiceQueueId':{'type':Sequelize[_0x2149('0x3')],'unique':_0x2149('0x4')}}; \ No newline at end of file +var _0x1d10=['INTEGER','contactListQueue','moment','sequelize','STRING'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x1d10,0x8e));var _0x01d1=function(_0x57fbf3,_0x1558c9){_0x57fbf3=_0x57fbf3-0x0;var _0x105755=_0x1d10[_0x57fbf3];return _0x105755;};'use strict';var moment=require(_0x01d1('0x0'));var Sequelize=require(_0x01d1('0x1'));module['exports']={'phone':{'type':Sequelize[_0x01d1('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x01d1('0x3')],'unique':_0x01d1('0x4')},'ListId':{'type':Sequelize[_0x01d1('0x3')],'unique':_0x01d1('0x4')},'VoiceQueueId':{'type':Sequelize[_0x01d1('0x3')],'unique':'contactListQueue'}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index 8321e60..ac63803 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 _0x5523=['type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','limit','sort','where','filters','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','show','params','length','find','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes'];(function(_0x160986,_0x531e21){var _0xfb73aa=function(_0x110903){while(--_0x110903){_0x160986['push'](_0x160986['shift']());}};_0xfb73aa(++_0x531e21);}(_0x5523,0x137));var _0x3552=function(_0x36c196,_0x32ddd2){_0x36c196=_0x36c196-0x0;var _0x4ff710=_0x5523[_0x36c196];return _0x4ff710;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x3552('0x0'));var zipdir=require(_0x3552('0x1'));var jsonpatch=require(_0x3552('0x2'));var rp=require(_0x3552('0x3'));var moment=require(_0x3552('0x4'));var BPromise=require(_0x3552('0x5'));var Mustache=require(_0x3552('0x6'));var util=require(_0x3552('0x7'));var path=require(_0x3552('0x8'));var sox=require(_0x3552('0x9'));var csv=require(_0x3552('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x3552('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x3552('0xc'));var toCsv=require(_0x3552('0xa'));var querystring=require(_0x3552('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x3552('0xe'));var qs=require(_0x3552('0xf'));var as=require(_0x3552('0x10'));var hardwareService=require(_0x3552('0x11'));var logger=require(_0x3552('0x12'))(_0x3552('0x13'));var utils=require(_0x3552('0x14'));var config=require(_0x3552('0x15'));var db=require(_0x3552('0x16'))['db'];function respondWithStatusCode(_0x8fc5be,_0xae728b){_0xae728b=_0xae728b||0xcc;return function(_0x549df0){if(_0x549df0){return _0x8fc5be[_0x3552('0x17')](_0xae728b);}return _0x8fc5be[_0x3552('0x18')](_0xae728b)[_0x3552('0x19')]();};}function respondWithResult(_0x504b80,_0x538549){_0x538549=_0x538549||0xc8;return function(_0x123c8e){if(_0x123c8e){return _0x504b80[_0x3552('0x18')](_0x538549)[_0x3552('0x1a')](_0x123c8e);}};}function respondWithFilteredResult(_0x273e61,_0x50813d){return function(_0x3b9f0a){if(_0x3b9f0a){var _0x268d39=_0x3b9f0a[_0x3552('0x1b')],_0x31dd12=_0x50813d[_0x3552('0x1c')],_0x3da99c=_0x50813d[_0x3552('0x1c')]+_0x50813d['limit'],_0x4a8f95;if(_0x3da99c>=_0x268d39){_0x3da99c=_0x268d39;_0x4a8f95=0xc8;}else{_0x4a8f95=0xce;}_0x273e61[_0x3552('0x18')](_0x4a8f95);return _0x273e61[_0x3552('0x1d')]('Content-Range',_0x31dd12+'-'+_0x3da99c+'/'+_0x268d39)[_0x3552('0x1a')](_0x3b9f0a);}return null;};}function patchUpdates(_0xca6641){return function(_0x150877){try{jsonpatch[_0x3552('0x1e')](_0x150877,_0xca6641,!![]);}catch(_0x4d4a6d){return BPromise[_0x3552('0x1f')](_0x4d4a6d);}return _0x150877[_0x3552('0x20')]();};}function saveUpdates(_0x4d0db9,_0x26984c){return function(_0x443bab){if(_0x443bab){return _0x443bab[_0x3552('0x21')](_0x4d0db9)[_0x3552('0x22')](function(_0x97287d){return _0x97287d;});}return null;};}function removeEntity(_0x57cbe2,_0x2fe62c){return function(_0x4ea201){if(_0x4ea201){return _0x4ea201[_0x3552('0x23')]()['then'](function(){_0x57cbe2[_0x3552('0x18')](0xcc)[_0x3552('0x19')]();});}};}function handleEntityNotFound(_0x5355e4,_0x1f80b5){return function(_0x534c68){if(!_0x534c68){_0x5355e4[_0x3552('0x17')](0x194);}return _0x534c68;};}function handleError(_0x5c2272,_0x1972b7){_0x1972b7=_0x1972b7||0x1f4;return function(_0x555c2d){logger[_0x3552('0x24')](_0x555c2d[_0x3552('0x25')]);if(_0x555c2d[_0x3552('0x26')]){delete _0x555c2d[_0x3552('0x26')];}_0x5c2272[_0x3552('0x18')](_0x1972b7)[_0x3552('0x27')](_0x555c2d);};}exports[_0x3552('0x28')]=function(_0x2e8745,_0x5028e1){var _0x5d93f6={},_0x7d75aa={},_0x581e41={'count':0x0,'rows':[]};var _0x29dc07=_[_0x3552('0x29')](db[_0x3552('0x2a')][_0x3552('0x2b')],function(_0x440cff){return{'name':_0x440cff['fieldName'],'type':_0x440cff[_0x3552('0x2c')][_0x3552('0x2d')]};});_0x7d75aa[_0x3552('0x2e')]=_[_0x3552('0x29')](_0x29dc07,_0x3552('0x26'));_0x7d75aa['query']=_[_0x3552('0x2f')](_0x2e8745[_0x3552('0x30')]);_0x7d75aa['filters']=_[_0x3552('0x31')](_0x7d75aa['model'],_0x7d75aa['query']);_0x5d93f6[_0x3552('0x32')]=_[_0x3552('0x31')](_0x7d75aa[_0x3552('0x2e')],qs[_0x3552('0x33')](_0x2e8745[_0x3552('0x30')][_0x3552('0x33')]));_0x5d93f6[_0x3552('0x32')]=_0x5d93f6[_0x3552('0x32')]['length']?_0x5d93f6['attributes']:_0x7d75aa['model'];if(!_0x2e8745[_0x3552('0x30')][_0x3552('0x34')]('nolimit')){_0x5d93f6['limit']=qs[_0x3552('0x35')](_0x2e8745[_0x3552('0x30')][_0x3552('0x35')]);_0x5d93f6[_0x3552('0x1c')]=qs[_0x3552('0x1c')](_0x2e8745[_0x3552('0x30')][_0x3552('0x1c')]);}_0x5d93f6['order']=qs[_0x3552('0x36')](_0x2e8745[_0x3552('0x30')][_0x3552('0x36')]);_0x5d93f6[_0x3552('0x37')]=qs[_0x3552('0x38')](_['pick'](_0x2e8745[_0x3552('0x30')],_0x7d75aa['filters']));if(_0x2e8745[_0x3552('0x30')]['filter']){_0x5d93f6[_0x3552('0x37')]=_[_0x3552('0x39')](_0x5d93f6[_0x3552('0x37')],{'$or':_[_0x3552('0x29')](_0x29dc07,function(_0x21e812){if(_0x21e812[_0x3552('0x2c')]!==_0x3552('0x3a')){var _0x5b1ab1={};_0x5b1ab1[_0x21e812[_0x3552('0x26')]]={'$like':'%'+_0x2e8745[_0x3552('0x30')][_0x3552('0x3b')]+'%'};return _0x5b1ab1;}})});}_0x5d93f6=_[_0x3552('0x39')]({},_0x5d93f6,_0x2e8745['options']);var _0x34a126={'where':_0x5d93f6[_0x3552('0x37')]};return db[_0x3552('0x2a')][_0x3552('0x1b')](_0x34a126)[_0x3552('0x22')](function(_0x53511e){_0x581e41[_0x3552('0x1b')]=_0x53511e;if(_0x2e8745['query'][_0x3552('0x3c')]){_0x5d93f6[_0x3552('0x3d')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x3552('0x3e')](_0x5d93f6);})[_0x3552('0x22')](function(_0x45e746){_0x581e41[_0x3552('0x3f')]=_0x45e746;return _0x581e41;})[_0x3552('0x22')](respondWithFilteredResult(_0x5028e1,_0x5d93f6))[_0x3552('0x40')](handleError(_0x5028e1,null));};exports[_0x3552('0x41')]=function(_0x380c5c,_0x2912b3){var _0x142da0={'raw':!![],'where':{'id':_0x380c5c[_0x3552('0x42')]['id']}},_0x34b7e6={};_0x34b7e6['model']=_[_0x3552('0x2f')](db[_0x3552('0x2a')][_0x3552('0x2b')]);_0x34b7e6[_0x3552('0x30')]=_[_0x3552('0x2f')](_0x380c5c[_0x3552('0x30')]);_0x34b7e6[_0x3552('0x38')]=_[_0x3552('0x31')](_0x34b7e6['model'],_0x34b7e6[_0x3552('0x30')]);_0x142da0[_0x3552('0x32')]=_[_0x3552('0x31')](_0x34b7e6[_0x3552('0x2e')],qs[_0x3552('0x33')](_0x380c5c[_0x3552('0x30')][_0x3552('0x33')]));_0x142da0['attributes']=_0x142da0[_0x3552('0x32')][_0x3552('0x43')]?_0x142da0[_0x3552('0x32')]:_0x34b7e6[_0x3552('0x2e')];if(_0x380c5c[_0x3552('0x30')][_0x3552('0x3c')]){_0x142da0[_0x3552('0x3d')]=[{'all':!![]}];}_0x142da0=_[_0x3552('0x39')]({},_0x142da0,_0x380c5c['options']);return db[_0x3552('0x2a')][_0x3552('0x44')](_0x142da0)[_0x3552('0x22')](handleEntityNotFound(_0x2912b3,null))[_0x3552('0x22')](respondWithResult(_0x2912b3,null))[_0x3552('0x40')](handleError(_0x2912b3,null));};exports[_0x3552('0x21')]=function(_0x43743c,_0x189fee){if(_0x43743c[_0x3552('0x45')]['id']){delete _0x43743c['body']['id'];}return db[_0x3552('0x2a')]['find']({'where':{'id':_0x43743c[_0x3552('0x42')]['id']}})[_0x3552('0x22')](handleEntityNotFound(_0x189fee,null))['then'](saveUpdates(_0x43743c['body'],null))[_0x3552('0x22')](respondWithResult(_0x189fee,null))[_0x3552('0x40')](handleError(_0x189fee,null));};exports['destroy']=function(_0x24c85b,_0xd38a86){return db[_0x3552('0x2a')][_0x3552('0x44')]({'where':{'id':_0x24c85b[_0x3552('0x42')]['id']}})['then'](handleEntityNotFound(_0xd38a86,null))[_0x3552('0x22')](removeEntity(_0xd38a86,null))[_0x3552('0x40')](handleError(_0xd38a86,null));};exports[_0x3552('0x46')]=function(_0x4eff7a,_0x2a3f99){return db[_0x3552('0x2a')][_0x3552('0x46')]()[_0x3552('0x22')](respondWithResult(_0x2a3f99,null))[_0x3552('0x40')](handleError(_0x2a3f99,null));}; \ No newline at end of file +var _0xd08d=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name','send','map','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','VIRTUAL','merge','CmHopperBlack','findAll','rows','catch','show','rawAttributes','length','include','options','find','body','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd08d,0x81));var _0xdd08=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0xd08d[_0x525c7b];return _0x27b33e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdd08('0x0'));var rimraf=require(_0xdd08('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdd08('0x2'));var rp=require(_0xdd08('0x3'));var moment=require(_0xdd08('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdd08('0x5'));var util=require(_0xdd08('0x6'));var path=require(_0xdd08('0x7'));var sox=require('sox');var csv=require(_0xdd08('0x8'));var ejs=require(_0xdd08('0x9'));var fs=require('fs');var _=require(_0xdd08('0xa'));var squel=require(_0xdd08('0xb'));var crypto=require(_0xdd08('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xdd08('0xd'));var toCsv=require(_0xdd08('0x8'));var querystring=require(_0xdd08('0xe'));var Papa=require('papaparse');var Redis=require(_0xdd08('0xf'));var authService=require(_0xdd08('0x10'));var qs=require(_0xdd08('0x11'));var as=require(_0xdd08('0x12'));var hardwareService=require(_0xdd08('0x13'));var logger=require(_0xdd08('0x14'))(_0xdd08('0x15'));var utils=require(_0xdd08('0x16'));var config=require(_0xdd08('0x17'));var db=require(_0xdd08('0x18'))['db'];function respondWithStatusCode(_0x20a566,_0x1543c8){_0x1543c8=_0x1543c8||0xcc;return function(_0x4bf79b){if(_0x4bf79b){return _0x20a566[_0xdd08('0x19')](_0x1543c8);}return _0x20a566[_0xdd08('0x1a')](_0x1543c8)[_0xdd08('0x1b')]();};}function respondWithResult(_0x240f3b,_0x415169){_0x415169=_0x415169||0xc8;return function(_0x3ed0d1){if(_0x3ed0d1){return _0x240f3b[_0xdd08('0x1a')](_0x415169)[_0xdd08('0x1c')](_0x3ed0d1);}};}function respondWithFilteredResult(_0x7417dd,_0x11aad3){return function(_0x2fc29c){if(_0x2fc29c){var _0x9a6225=_0x2fc29c[_0xdd08('0x1d')],_0x784541=_0x11aad3[_0xdd08('0x1e')],_0xe7a7c9=_0x11aad3[_0xdd08('0x1e')]+_0x11aad3[_0xdd08('0x1f')],_0x46838e;if(_0xe7a7c9>=_0x9a6225){_0xe7a7c9=_0x9a6225;_0x46838e=0xc8;}else{_0x46838e=0xce;}_0x7417dd[_0xdd08('0x1a')](_0x46838e);return _0x7417dd[_0xdd08('0x20')]('Content-Range',_0x784541+'-'+_0xe7a7c9+'/'+_0x9a6225)['json'](_0x2fc29c);}return null;};}function patchUpdates(_0x435dc4){return function(_0xcdad2e){try{jsonpatch[_0xdd08('0x21')](_0xcdad2e,_0x435dc4,!![]);}catch(_0x47d653){return BPromise['reject'](_0x47d653);}return _0xcdad2e[_0xdd08('0x22')]();};}function saveUpdates(_0x13de65,_0x1cfc12){return function(_0x4a587b){if(_0x4a587b){return _0x4a587b[_0xdd08('0x23')](_0x13de65)[_0xdd08('0x24')](function(_0x344e48){return _0x344e48;});}return null;};}function removeEntity(_0x12f5d3,_0x5c9ebe){return function(_0x4f807b){if(_0x4f807b){return _0x4f807b[_0xdd08('0x25')]()['then'](function(){_0x12f5d3[_0xdd08('0x1a')](0xcc)[_0xdd08('0x1b')]();});}};}function handleEntityNotFound(_0x5f0166,_0x4b1be1){return function(_0x2f3361){if(!_0x2f3361){_0x5f0166[_0xdd08('0x19')](0x194);}return _0x2f3361;};}function handleError(_0x56a337,_0x37b095){_0x37b095=_0x37b095||0x1f4;return function(_0x53afa1){logger[_0xdd08('0x26')](_0x53afa1[_0xdd08('0x27')]);if(_0x53afa1['name']){delete _0x53afa1[_0xdd08('0x28')];}_0x56a337[_0xdd08('0x1a')](_0x37b095)[_0xdd08('0x29')](_0x53afa1);};}exports['index']=function(_0x5d67d2,_0x13d1ab){var _0x879dcb={},_0x26cbf8={},_0x268304={'count':0x0,'rows':[]};var _0x3e9b2f=_[_0xdd08('0x2a')](db['CmHopperBlack']['rawAttributes'],function(_0x2aaf75){return{'name':_0x2aaf75[_0xdd08('0x2b')],'type':_0x2aaf75[_0xdd08('0x2c')][_0xdd08('0x2d')]};});_0x26cbf8[_0xdd08('0x2e')]=_[_0xdd08('0x2a')](_0x3e9b2f,_0xdd08('0x28'));_0x26cbf8['query']=_[_0xdd08('0x2f')](_0x5d67d2[_0xdd08('0x30')]);_0x26cbf8[_0xdd08('0x31')]=_[_0xdd08('0x32')](_0x26cbf8[_0xdd08('0x2e')],_0x26cbf8[_0xdd08('0x30')]);_0x879dcb[_0xdd08('0x33')]=_[_0xdd08('0x32')](_0x26cbf8['model'],qs['fields'](_0x5d67d2[_0xdd08('0x30')][_0xdd08('0x34')]));_0x879dcb[_0xdd08('0x33')]=_0x879dcb['attributes']['length']?_0x879dcb[_0xdd08('0x33')]:_0x26cbf8[_0xdd08('0x2e')];if(!_0x5d67d2[_0xdd08('0x30')][_0xdd08('0x35')](_0xdd08('0x36'))){_0x879dcb[_0xdd08('0x1f')]=qs[_0xdd08('0x1f')](_0x5d67d2['query'][_0xdd08('0x1f')]);_0x879dcb[_0xdd08('0x1e')]=qs[_0xdd08('0x1e')](_0x5d67d2[_0xdd08('0x30')][_0xdd08('0x1e')]);}_0x879dcb[_0xdd08('0x37')]=qs[_0xdd08('0x38')](_0x5d67d2['query'][_0xdd08('0x38')]);_0x879dcb['where']=qs['filters'](_['pick'](_0x5d67d2[_0xdd08('0x30')],_0x26cbf8['filters']));if(_0x5d67d2[_0xdd08('0x30')][_0xdd08('0x39')]){_0x879dcb[_0xdd08('0x3a')]=_['merge'](_0x879dcb[_0xdd08('0x3a')],{'$or':_['map'](_0x3e9b2f,function(_0x58b675){if(_0x58b675['type']!==_0xdd08('0x3b')){var _0x2311b3={};_0x2311b3[_0x58b675[_0xdd08('0x28')]]={'$like':'%'+_0x5d67d2[_0xdd08('0x30')][_0xdd08('0x39')]+'%'};return _0x2311b3;}})});}_0x879dcb=_[_0xdd08('0x3c')]({},_0x879dcb,_0x5d67d2['options']);var _0x36d557={'where':_0x879dcb[_0xdd08('0x3a')]};return db[_0xdd08('0x3d')]['count'](_0x36d557)['then'](function(_0x2ced9b){_0x268304[_0xdd08('0x1d')]=_0x2ced9b;if(_0x5d67d2['query']['includeAll']){_0x879dcb['include']=[{'all':!![]}];}return db[_0xdd08('0x3d')][_0xdd08('0x3e')](_0x879dcb);})['then'](function(_0xe1dfa6){_0x268304[_0xdd08('0x3f')]=_0xe1dfa6;return _0x268304;})['then'](respondWithFilteredResult(_0x13d1ab,_0x879dcb))[_0xdd08('0x40')](handleError(_0x13d1ab,null));};exports[_0xdd08('0x41')]=function(_0x553b5a,_0xf740c4){var _0x58f39e={'raw':!![],'where':{'id':_0x553b5a['params']['id']}},_0x4807a0={};_0x4807a0[_0xdd08('0x2e')]=_[_0xdd08('0x2f')](db[_0xdd08('0x3d')][_0xdd08('0x42')]);_0x4807a0[_0xdd08('0x30')]=_['keys'](_0x553b5a[_0xdd08('0x30')]);_0x4807a0[_0xdd08('0x31')]=_['intersection'](_0x4807a0[_0xdd08('0x2e')],_0x4807a0[_0xdd08('0x30')]);_0x58f39e['attributes']=_[_0xdd08('0x32')](_0x4807a0[_0xdd08('0x2e')],qs[_0xdd08('0x34')](_0x553b5a[_0xdd08('0x30')][_0xdd08('0x34')]));_0x58f39e['attributes']=_0x58f39e['attributes'][_0xdd08('0x43')]?_0x58f39e[_0xdd08('0x33')]:_0x4807a0[_0xdd08('0x2e')];if(_0x553b5a[_0xdd08('0x30')]['includeAll']){_0x58f39e[_0xdd08('0x44')]=[{'all':!![]}];}_0x58f39e=_[_0xdd08('0x3c')]({},_0x58f39e,_0x553b5a[_0xdd08('0x45')]);return db[_0xdd08('0x3d')][_0xdd08('0x46')](_0x58f39e)[_0xdd08('0x24')](handleEntityNotFound(_0xf740c4,null))[_0xdd08('0x24')](respondWithResult(_0xf740c4,null))[_0xdd08('0x40')](handleError(_0xf740c4,null));};exports[_0xdd08('0x23')]=function(_0x54c85b,_0x324997){if(_0x54c85b[_0xdd08('0x47')]['id']){delete _0x54c85b[_0xdd08('0x47')]['id'];}return db['CmHopperBlack'][_0xdd08('0x46')]({'where':{'id':_0x54c85b['params']['id']}})[_0xdd08('0x24')](handleEntityNotFound(_0x324997,null))['then'](saveUpdates(_0x54c85b['body'],null))['then'](respondWithResult(_0x324997,null))['catch'](handleError(_0x324997,null));};exports[_0xdd08('0x25')]=function(_0x315275,_0x419c1b){return db[_0xdd08('0x3d')]['find']({'where':{'id':_0x315275[_0xdd08('0x48')]['id']}})['then'](handleEntityNotFound(_0x419c1b,null))[_0xdd08('0x24')](removeEntity(_0x419c1b,null))[_0xdd08('0x40')](handleError(_0x419c1b,null));};exports[_0xdd08('0x49')]=function(_0x78c399,_0x1d3a9e){return db[_0xdd08('0x3d')]['describe']()[_0xdd08('0x24')](respondWithResult(_0x1d3a9e,null))[_0xdd08('0x40')](handleError(_0x1d3a9e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 6c2051e..4b64774 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 _0x14ba=['moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','exports','CmHopperBlack','cm_hopper_black','lodash','util','../../config/logger'];(function(_0x33fd82,_0x43dbcc){var _0x323cca=function(_0x13313d){while(--_0x13313d){_0x33fd82['push'](_0x33fd82['shift']());}};_0x323cca(++_0x43dbcc);}(_0x14ba,0x8d));var _0xa14b=function(_0x4d6add,_0x32d1e6){_0x4d6add=_0x4d6add-0x0;var _0x24a9e5=_0x14ba[_0x4d6add];return _0x24a9e5;};'use strict';var _=require(_0xa14b('0x0'));var util=require(_0xa14b('0x1'));var logger=require(_0xa14b('0x2'))('api');var moment=require(_0xa14b('0x3'));var BPromise=require(_0xa14b('0x4'));var rp=require(_0xa14b('0x5'));var fs=require('fs');var path=require(_0xa14b('0x6'));var rimraf=require(_0xa14b('0x7'));var config=require('../../config/environment');var attributes=require(_0xa14b('0x8'));module[_0xa14b('0x9')]=function(_0xb3a1c,_0x4e6588){return _0xb3a1c['define'](_0xa14b('0xa'),attributes,{'tableName':_0xa14b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x32ca=['request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','cm_hopper_black','lodash','util','moment','bluebird'];(function(_0x1058db,_0x7e3063){var _0x195b98=function(_0x1db9ce){while(--_0x1db9ce){_0x1058db['push'](_0x1058db['shift']());}};_0x195b98(++_0x7e3063);}(_0x32ca,0x96));var _0xa32c=function(_0x1de62e,_0x173bb4){_0x1de62e=_0x1de62e-0x0;var _0x34f094=_0x32ca[_0x1de62e];return _0x34f094;};'use strict';var _=require(_0xa32c('0x0'));var util=require(_0xa32c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa32c('0x2'));var BPromise=require(_0xa32c('0x3'));var rp=require(_0xa32c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa32c('0x5'));var config=require(_0xa32c('0x6'));var attributes=require(_0xa32c('0x7'));module[_0xa32c('0x8')]=function(_0x174d3c,_0x7eab9){return _0x174d3c[_0xa32c('0x9')]('CmHopperBlack',attributes,{'tableName':_0xa32c('0xa'),'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 a2324fe..cb1aa56 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 _0xe8dc=['map','debug','stringify','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','CmHopperBlack,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','GetCmHopperBlack','CmHopperBlack','options','raw','where','attributes','limit','include','model'];(function(_0x580e8f,_0x31f656){var _0x6c6bcd=function(_0x1f7f7f){while(--_0x1f7f7f){_0x580e8f['push'](_0x580e8f['shift']());}};_0x6c6bcd(++_0x31f656);}(_0xe8dc,0x1d5));var _0xce8d=function(_0x426076,_0xfdf5d2){_0x426076=_0x426076-0x0;var _0x1e9565=_0xe8dc[_0x426076];return _0x1e9565;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xce8d('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce8d('0x1'));var db=require(_0xce8d('0x2'))['db'];var utils=require(_0xce8d('0x3'));var logger=require('../../config/logger')('rpc');var config=require(_0xce8d('0x4'));var jayson=require(_0xce8d('0x5'));var client=jayson[_0xce8d('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x227bfa,_0x148209,_0x12cfb4){return new BPromise(function(_0x521040,_0x2dc943){return client[_0xce8d('0x7')](_0x227bfa,_0x12cfb4)[_0xce8d('0x8')](function(_0x4b4c2a){logger['info'](_0xce8d('0x9'),_0x148209,_0xce8d('0xa'));logger['debug'](_0xce8d('0xb'),_0x148209,_0xce8d('0xa'),JSON['stringify'](_0x4b4c2a));if(_0x4b4c2a[_0xce8d('0xc')]){if(_0x4b4c2a['error']['code']===0x1f4){logger[_0xce8d('0xc')](_0xce8d('0x9'),_0x148209,_0x4b4c2a[_0xce8d('0xc')][_0xce8d('0xd')]);return _0x2dc943(_0x4b4c2a['error']['message']);}logger[_0xce8d('0xc')]('CmHopperBlack,\x20%s,\x20%s',_0x148209,_0x4b4c2a[_0xce8d('0xc')]['message']);return _0x521040(_0x4b4c2a[_0xce8d('0xc')]['message']);}else{logger[_0xce8d('0xe')](_0xce8d('0x9'),_0x148209,'request\x20sent');_0x521040(_0x4b4c2a[_0xce8d('0xf')][_0xce8d('0xd')]);}})[_0xce8d('0x10')](function(_0x23beac){logger['error'](_0xce8d('0x9'),_0x148209,_0x23beac);_0x2dc943(_0x23beac);});});}exports[_0xce8d('0x11')]=function(_0x2bdbf6){var _0x32e623=this;return new Promise(function(_0x31cbfe,_0x1c55fe){return db[_0xce8d('0x12')]['findAll']({'raw':_0x2bdbf6[_0xce8d('0x13')]?_0x2bdbf6[_0xce8d('0x13')][_0xce8d('0x14')]===undefined?!![]:![]:!![],'where':_0x2bdbf6[_0xce8d('0x13')]?_0x2bdbf6[_0xce8d('0x13')][_0xce8d('0x15')]||null:null,'attributes':_0x2bdbf6[_0xce8d('0x13')]?_0x2bdbf6[_0xce8d('0x13')][_0xce8d('0x16')]||null:null,'limit':_0x2bdbf6[_0xce8d('0x13')]?_0x2bdbf6[_0xce8d('0x13')][_0xce8d('0x17')]||null:null,'include':_0x2bdbf6[_0xce8d('0x13')]?_0x2bdbf6[_0xce8d('0x13')][_0xce8d('0x18')]?_['map'](_0x2bdbf6['options'][_0xce8d('0x18')],function(_0x2244e4){return{'model':db[_0x2244e4[_0xce8d('0x19')]],'as':_0x2244e4['as'],'attributes':_0x2244e4[_0xce8d('0x16')],'include':_0x2244e4['include']?_[_0xce8d('0x1a')](_0x2244e4[_0xce8d('0x18')],function(_0x5c5fb8){return{'model':db[_0x5c5fb8['model']],'as':_0x5c5fb8['as'],'attributes':_0x5c5fb8['attributes'],'include':_0x5c5fb8['include']?_[_0xce8d('0x1a')](_0x5c5fb8[_0xce8d('0x18')],function(_0x2b795c){return{'model':db[_0x2b795c['model']],'as':_0x2b795c['as'],'attributes':_0x2b795c[_0xce8d('0x16')]};}):[]};}):[]};}):[]:[]})[_0xce8d('0x8')](function(_0x2f0f36){logger[_0xce8d('0xe')](_0xce8d('0x11'),_0x2bdbf6);logger[_0xce8d('0x1b')](_0xce8d('0x11'),_0x2bdbf6,JSON[_0xce8d('0x1c')](_0x2f0f36));_0x31cbfe(_0x2f0f36);})[_0xce8d('0x10')](function(_0x7fb9fc){logger['error'](_0xce8d('0x11'),_0x7fb9fc['message'],_0x2bdbf6);_0x1c55fe(_0x32e623[_0xce8d('0xc')](0x1f4,_0x7fb9fc[_0xce8d('0xd')]));});});};exports[_0xce8d('0x1d')]=function(_0x179c2a){var _0x116fd0=this;return new Promise(function(_0x189134,_0x282cc0){return db[_0xce8d('0x12')][_0xce8d('0x1e')](_0x179c2a[_0xce8d('0x1f')],{'raw':_0x179c2a[_0xce8d('0x13')]?_0x179c2a[_0xce8d('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x179c2a[_0xce8d('0x13')]?_0x179c2a[_0xce8d('0x13')][_0xce8d('0x15')]||null:null,'attributes':_0x179c2a[_0xce8d('0x13')]?_0x179c2a[_0xce8d('0x13')][_0xce8d('0x16')]||null:null,'limit':_0x179c2a[_0xce8d('0x13')]?_0x179c2a[_0xce8d('0x13')][_0xce8d('0x17')]||null:null})['then'](function(_0x248988){logger['info'](_0xce8d('0x1d'),_0x179c2a);logger[_0xce8d('0x1b')](_0xce8d('0x1d'),_0x179c2a,JSON['stringify'](_0x248988));_0x189134(_0x248988);})[_0xce8d('0x10')](function(_0x3f6451){logger[_0xce8d('0xc')]('UpdateCmHopperBlack',_0x3f6451['message'],_0x179c2a);_0x282cc0(_0x116fd0['error'](0x1f4,_0x3f6451[_0xce8d('0xd')]));});});};exports[_0xce8d('0x20')]=function(_0x3ac43a){var _0x9bda4b=this;return new Promise(function(_0xe0dec9,_0x4d8a6b){return db[_0xce8d('0x12')]['destroy']({'where':_0x3ac43a[_0xce8d('0x13')]?_0x3ac43a[_0xce8d('0x13')][_0xce8d('0x15')]||null:null})[_0xce8d('0x8')](function(_0x81823c){logger[_0xce8d('0xe')](_0xce8d('0x20'),_0x3ac43a);logger['debug'](_0xce8d('0x20'),_0x3ac43a,JSON['stringify'](_0x81823c));_0xe0dec9(_0x81823c);})[_0xce8d('0x10')](function(_0x33f0bd){logger[_0xce8d('0xc')](_0xce8d('0x20'),_0x33f0bd['message'],_0x3ac43a);_0x4d8a6b(_0x9bda4b['error'](0x1f4,_0x33f0bd[_0xce8d('0xd')]));});});}; \ No newline at end of file +var _0xfc2f=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','include','map','model','info','UpdateCmHopperBlack','update','body','limit','DestroyCmHopperBlack','lodash','util','moment','bluebird','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc2f,0x70));var _0xffc2=function(_0x5c13fe,_0x4a71d7){_0x5c13fe=_0x5c13fe-0x0;var _0x1ea093=_0xfc2f[_0x5c13fe];return _0x1ea093;};'use strict';var _=require(_0xffc2('0x0'));var util=require(_0xffc2('0x1'));var moment=require(_0xffc2('0x2'));var BPromise=require(_0xffc2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xffc2('0x4'));var db=require(_0xffc2('0x5'))['db'];var utils=require(_0xffc2('0x6'));var logger=require(_0xffc2('0x7'))(_0xffc2('0x8'));var config=require(_0xffc2('0x9'));var jayson=require(_0xffc2('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x372a46,_0x30b4ad,_0x17c9fd){return new BPromise(function(_0x51517b,_0x4759cd){return client[_0xffc2('0xb')](_0x372a46,_0x17c9fd)[_0xffc2('0xc')](function(_0x463371){logger['info'](_0xffc2('0xd'),_0x30b4ad,_0xffc2('0xe'));logger[_0xffc2('0xf')](_0xffc2('0x10'),_0x30b4ad,_0xffc2('0xe'),JSON[_0xffc2('0x11')](_0x463371));if(_0x463371['error']){if(_0x463371[_0xffc2('0x12')][_0xffc2('0x13')]===0x1f4){logger['error'](_0xffc2('0xd'),_0x30b4ad,_0x463371[_0xffc2('0x12')][_0xffc2('0x14')]);return _0x4759cd(_0x463371['error']['message']);}logger[_0xffc2('0x12')](_0xffc2('0xd'),_0x30b4ad,_0x463371[_0xffc2('0x12')][_0xffc2('0x14')]);return _0x51517b(_0x463371[_0xffc2('0x12')][_0xffc2('0x14')]);}else{logger['info'](_0xffc2('0xd'),_0x30b4ad,'request\x20sent');_0x51517b(_0x463371[_0xffc2('0x15')][_0xffc2('0x14')]);}})[_0xffc2('0x16')](function(_0x330610){logger['error']('CmHopperBlack,\x20%s,\x20%s',_0x30b4ad,_0x330610);_0x4759cd(_0x330610);});});}exports[_0xffc2('0x17')]=function(_0x47cfbf){var _0x4b8fba=this;return new Promise(function(_0x14ad70,_0x48e9e4){return db[_0xffc2('0x18')][_0xffc2('0x19')]({'raw':_0x47cfbf[_0xffc2('0x1a')]?_0x47cfbf['options'][_0xffc2('0x1b')]===undefined?!![]:![]:!![],'where':_0x47cfbf[_0xffc2('0x1a')]?_0x47cfbf['options'][_0xffc2('0x1c')]||null:null,'attributes':_0x47cfbf[_0xffc2('0x1a')]?_0x47cfbf[_0xffc2('0x1a')][_0xffc2('0x1d')]||null:null,'limit':_0x47cfbf['options']?_0x47cfbf[_0xffc2('0x1a')]['limit']||null:null,'include':_0x47cfbf[_0xffc2('0x1a')]?_0x47cfbf[_0xffc2('0x1a')][_0xffc2('0x1e')]?_[_0xffc2('0x1f')](_0x47cfbf[_0xffc2('0x1a')][_0xffc2('0x1e')],function(_0x48ae3b){return{'model':db[_0x48ae3b[_0xffc2('0x20')]],'as':_0x48ae3b['as'],'attributes':_0x48ae3b[_0xffc2('0x1d')],'include':_0x48ae3b[_0xffc2('0x1e')]?_[_0xffc2('0x1f')](_0x48ae3b[_0xffc2('0x1e')],function(_0x5b155e){return{'model':db[_0x5b155e[_0xffc2('0x20')]],'as':_0x5b155e['as'],'attributes':_0x5b155e[_0xffc2('0x1d')],'include':_0x5b155e[_0xffc2('0x1e')]?_[_0xffc2('0x1f')](_0x5b155e['include'],function(_0x1aafc1){return{'model':db[_0x1aafc1[_0xffc2('0x20')]],'as':_0x1aafc1['as'],'attributes':_0x1aafc1[_0xffc2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x53c06f){logger[_0xffc2('0x21')]('GetCmHopperBlack',_0x47cfbf);logger[_0xffc2('0xf')](_0xffc2('0x17'),_0x47cfbf,JSON[_0xffc2('0x11')](_0x53c06f));_0x14ad70(_0x53c06f);})[_0xffc2('0x16')](function(_0x19d628){logger['error'](_0xffc2('0x17'),_0x19d628[_0xffc2('0x14')],_0x47cfbf);_0x48e9e4(_0x4b8fba['error'](0x1f4,_0x19d628[_0xffc2('0x14')]));});});};exports[_0xffc2('0x22')]=function(_0x190256){var _0x189ba3=this;return new Promise(function(_0x1b309d,_0x2a385c){return db[_0xffc2('0x18')][_0xffc2('0x23')](_0x190256[_0xffc2('0x24')],{'raw':_0x190256[_0xffc2('0x1a')]?_0x190256[_0xffc2('0x1a')][_0xffc2('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x190256['options']?_0x190256[_0xffc2('0x1a')][_0xffc2('0x1c')]||null:null,'attributes':_0x190256[_0xffc2('0x1a')]?_0x190256[_0xffc2('0x1a')][_0xffc2('0x1d')]||null:null,'limit':_0x190256[_0xffc2('0x1a')]?_0x190256[_0xffc2('0x1a')][_0xffc2('0x25')]||null:null})[_0xffc2('0xc')](function(_0x555c57){logger[_0xffc2('0x21')](_0xffc2('0x22'),_0x190256);logger[_0xffc2('0xf')]('UpdateCmHopperBlack',_0x190256,JSON['stringify'](_0x555c57));_0x1b309d(_0x555c57);})[_0xffc2('0x16')](function(_0x251e16){logger[_0xffc2('0x12')]('UpdateCmHopperBlack',_0x251e16[_0xffc2('0x14')],_0x190256);_0x2a385c(_0x189ba3['error'](0x1f4,_0x251e16[_0xffc2('0x14')]));});});};exports[_0xffc2('0x26')]=function(_0x120e59){var _0x4a6d23=this;return new Promise(function(_0x41d316,_0x1e02d4){return db[_0xffc2('0x18')]['destroy']({'where':_0x120e59['options']?_0x120e59['options']['where']||null:null})[_0xffc2('0xc')](function(_0x157221){logger[_0xffc2('0x21')](_0xffc2('0x26'),_0x120e59);logger[_0xffc2('0xf')]('DestroyCmHopperBlack',_0x120e59,JSON[_0xffc2('0x11')](_0x157221));_0x41d316(_0x157221);})['catch'](function(_0x1d9e6e){logger['error'](_0xffc2('0x26'),_0x1d9e6e[_0xffc2('0x14')],_0x120e59);_0x1e02d4(_0x4a6d23[_0xffc2('0x12')](0x1f4,_0x1d9e6e[_0xffc2('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index b62c16f..351f6c1 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 _0xa8a8=['index','/describe','describe','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated'];(function(_0x221637,_0x42a5e0){var _0x11bf9e=function(_0xbc416e){while(--_0xbc416e){_0x221637['push'](_0x221637['shift']());}};_0x11bf9e(++_0x42a5e0);}(_0xa8a8,0xec));var _0x8a8a=function(_0x3edaed,_0x1384e8){_0x3edaed=_0x3edaed-0x0;var _0x149fa8=_0xa8a8[_0x3edaed];return _0x149fa8;};'use strict';var multer=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var path=require(_0x8a8a('0x2'));var timeout=require(_0x8a8a('0x3'));var express=require('express');var router=express[_0x8a8a('0x4')]();var auth=require(_0x8a8a('0x5'));var interaction=require(_0x8a8a('0x6'));var config=require(_0x8a8a('0x7'));var controller=require(_0x8a8a('0x8'));router[_0x8a8a('0x9')]('/',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xb')]);router[_0x8a8a('0x9')](_0x8a8a('0xc'),auth[_0x8a8a('0xa')](),controller[_0x8a8a('0xd')]);router[_0x8a8a('0x9')](_0x8a8a('0xe'),auth[_0x8a8a('0xa')](),controller['show']);router['put'](_0x8a8a('0xe'),auth['isAuthenticated'](),controller[_0x8a8a('0xf')]);router[_0x8a8a('0x10')]('/:id',auth[_0x8a8a('0xa')](),controller[_0x8a8a('0x11')]);module[_0x8a8a('0x12')]=router; \ No newline at end of file +var _0x008c=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','describe','/:id','put'];(function(_0x25eaaf,_0x1a48d3){var _0x5ba923=function(_0x24feb4){while(--_0x24feb4){_0x25eaaf['push'](_0x25eaaf['shift']());}};_0x5ba923(++_0x1a48d3);}(_0x008c,0x188));var _0xc008=function(_0x276f6d,_0x10a50e){_0x276f6d=_0x276f6d-0x0;var _0xda31b5=_0x008c[_0x276f6d];return _0xda31b5;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0xf')](_0xc008('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xe'),auth[_0xc008('0xa')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index e95e808..f906743 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 _0x7a60=['setDataValue','followuptime','diff','dispositionat','BOOLEAN','INTEGER','DATE','STRING','getDataValue'];(function(_0xb93b1c,_0x3d4bfb){var _0x49d261=function(_0x2b7f1d){while(--_0x2b7f1d){_0xb93b1c['push'](_0xb93b1c['shift']());}};_0x49d261(++_0x3d4bfb);}(_0x7a60,0x1be));var _0x07a6=function(_0x1d3d87,_0x205c07){_0x1d3d87=_0x1d3d87-0x0;var _0x1519d9=_0x7a60[_0x1d3d87];return _0x1519d9;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'state':{'type':Sequelize[_0x07a6('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x07a6('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x07a6('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x07a6('0x2')]},'originatecalleridname':{'type':Sequelize[_0x07a6('0x2')]},'calleridnum':{'type':Sequelize[_0x07a6('0x2')]},'calleridname':{'type':Sequelize[_0x07a6('0x2')]},'starttime':{'type':Sequelize[_0x07a6('0x1')]},'responsetime':{'type':Sequelize[_0x07a6('0x1')]},'answertime':{'type':Sequelize[_0x07a6('0x1')]},'droptime':{'type':Sequelize[_0x07a6('0x1')]},'endtime':{'type':Sequelize[_0x07a6('0x1')]},'ringtime':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x07a6('0x2')]},'campaign':{'type':Sequelize[_0x07a6('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0x07a6('0x2')]},'disposition':{'type':Sequelize[_0x07a6('0x2')]},'dispositionat':{'type':Sequelize[_0x07a6('0x1')],'set':function(_0x3f0860){var _0x4b6227=this[_0x07a6('0x3')]('endtime');if(_0x4b6227&&_0x3f0860){this[_0x07a6('0x4')](_0x07a6('0x5'),moment(_0x3f0860)[_0x07a6('0x6')](moment(_0x4b6227),'seconds'));}return this[_0x07a6('0x4')](_0x07a6('0x7'),_0x3f0860);}},'amd':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x07a6('0x1')]},'callback':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x07a6('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x07a6('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize[_0x07a6('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x07a6('0x1')]},'countnosuchnumberretry':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x07a6('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8f28=['setDataValue','followuptime','diff','seconds','dispositionat','BOOLEAN','moment','exports','INTEGER','STRING','DATE','getDataValue','endtime'];(function(_0x3514f1,_0x450eb3){var _0x581967=function(_0x10d32d){while(--_0x10d32d){_0x3514f1['push'](_0x3514f1['shift']());}};_0x581967(++_0x450eb3);}(_0x8f28,0x6e));var _0x88f2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8f28[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x88f2('0x0'));module[_0x88f2('0x1')]={'state':{'type':Sequelize[_0x88f2('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x88f2('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0x88f2('0x3')]},'originatecalleridname':{'type':Sequelize[_0x88f2('0x3')]},'calleridnum':{'type':Sequelize[_0x88f2('0x3')]},'calleridname':{'type':Sequelize[_0x88f2('0x3')]},'starttime':{'type':Sequelize[_0x88f2('0x4')]},'responsetime':{'type':Sequelize[_0x88f2('0x4')]},'answertime':{'type':Sequelize[_0x88f2('0x4')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0x88f2('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x88f2('0x3')]},'membername':{'type':Sequelize[_0x88f2('0x3')]},'reason':{'type':Sequelize[_0x88f2('0x3')]},'disposition':{'type':Sequelize[_0x88f2('0x3')]},'dispositionat':{'type':Sequelize[_0x88f2('0x4')],'set':function(_0x27e34a){var _0x3fe361=this[_0x88f2('0x5')](_0x88f2('0x6'));if(_0x3fe361&&_0x27e34a){this[_0x88f2('0x7')](_0x88f2('0x8'),moment(_0x27e34a)[_0x88f2('0x9')](moment(_0x3fe361),_0x88f2('0xa')));}return this['setDataValue'](_0x88f2('0xb'),_0x27e34a);}},'amd':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'fax':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x88f2('0x4')]},'callback':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x88f2('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x88f2('0x4')]},'deleted':{'type':Sequelize['STRING'],'defaultValue':null},'deletedat':{'type':Sequelize[_0x88f2('0x4')]},'recallme':{'type':Sequelize[_0x88f2('0xc')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x88f2('0x4')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x88f2('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.controller.js b/server/api/cmHopperFinal/cmHopperFinal.controller.js index 6d413f0..f35c6d3 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 _0xf2a5=['NOW()','scheduledAt','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','from','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','VoiceQueueId\x20=\x20?','select','calleridnum','cm_hopper_final','group','CampaignId','state\x20=\x204','checkContactHopper','CmHopper','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','../../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','apply','reject','save','then','sendStatus','error','stack','name','send','index','CmHopperFinal','rawAttributes','type','map','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','sort','where','pick','filter','options','includeAll','include','findAll','rows','catch','params','length','find','describe','update','uniqueid','body','COUNT','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','ListId','VoiceQueueId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)'];(function(_0x4dacfd,_0x30056d){var _0x2ae9b0=function(_0x2b075a){while(--_0x2b075a){_0x4dacfd['push'](_0x4dacfd['shift']());}};_0x2ae9b0(++_0x30056d);}(_0xf2a5,0x17f));var _0x5f2a=function(_0x58ec21,_0x1bba20){_0x58ec21=_0x58ec21-0x0;var _0x4f7e55=_0xf2a5[_0x58ec21];return _0x4f7e55;};'use strict';var pdf=require(_0x5f2a('0x0'));var emlformat=require(_0x5f2a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5f2a('0x2'));var jsonpatch=require(_0x5f2a('0x3'));var rp=require('request-promise');var moment=require(_0x5f2a('0x4'));var BPromise=require(_0x5f2a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5f2a('0x6'));var sox=require(_0x5f2a('0x7'));var csv=require(_0x5f2a('0x8'));var ejs=require(_0x5f2a('0x9'));var fs=require('fs');var _=require(_0x5f2a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5f2a('0xb'));var deskjs=require(_0x5f2a('0xc'));var toCsv=require(_0x5f2a('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5f2a('0xd'));var qs=require(_0x5f2a('0xe'));var as=require(_0x5f2a('0xf'));var hardwareService=require(_0x5f2a('0x10'));var logger=require('../../config/logger')(_0x5f2a('0x11'));var utils=require(_0x5f2a('0x12'));var config=require(_0x5f2a('0x13'));var db=require(_0x5f2a('0x14'))['db'];function respondWithStatusCode(_0x4d0580,_0x235da4){_0x235da4=_0x235da4||0xcc;return function(_0x23e2fc){if(_0x23e2fc){return _0x4d0580['sendStatus'](_0x235da4);}return _0x4d0580[_0x5f2a('0x15')](_0x235da4)[_0x5f2a('0x16')]();};}function respondWithResult(_0x4454a6,_0x2798d4){_0x2798d4=_0x2798d4||0xc8;return function(_0x36cbdb){if(_0x36cbdb){return _0x4454a6[_0x5f2a('0x15')](_0x2798d4)[_0x5f2a('0x17')](_0x36cbdb);}};}function respondWithFilteredResult(_0x46fb2c,_0xa7bcc1){return function(_0x3ad3bc){if(_0x3ad3bc){var _0x52352f=_0x3ad3bc[_0x5f2a('0x18')],_0x428204=_0xa7bcc1[_0x5f2a('0x19')],_0x11398b=_0xa7bcc1[_0x5f2a('0x19')]+_0xa7bcc1[_0x5f2a('0x1a')],_0x25d2b5;if(_0x11398b>=_0x52352f){_0x11398b=_0x52352f;_0x25d2b5=0xc8;}else{_0x25d2b5=0xce;}_0x46fb2c[_0x5f2a('0x15')](_0x25d2b5);return _0x46fb2c[_0x5f2a('0x1b')](_0x5f2a('0x1c'),_0x428204+'-'+_0x11398b+'/'+_0x52352f)[_0x5f2a('0x17')](_0x3ad3bc);}return null;};}function patchUpdates(_0x46b3bd){return function(_0x114c98){try{jsonpatch[_0x5f2a('0x1d')](_0x114c98,_0x46b3bd,!![]);}catch(_0x2f6768){return BPromise[_0x5f2a('0x1e')](_0x2f6768);}return _0x114c98[_0x5f2a('0x1f')]();};}function saveUpdates(_0xeed823,_0x237769){return function(_0x213547){if(_0x213547){return _0x213547['update'](_0xeed823)[_0x5f2a('0x20')](function(_0x1e22c2){return _0x1e22c2;});}return null;};}function removeEntity(_0x344647,_0x659ed5){return function(_0xa9604f){if(_0xa9604f){return _0xa9604f['destroy']()[_0x5f2a('0x20')](function(){_0x344647[_0x5f2a('0x15')](0xcc)[_0x5f2a('0x16')]();});}};}function handleEntityNotFound(_0x4c64cb,_0x383374){return function(_0x3c2f71){if(!_0x3c2f71){_0x4c64cb[_0x5f2a('0x21')](0x194);}return _0x3c2f71;};}function handleError(_0x302a8f,_0x33ce70){_0x33ce70=_0x33ce70||0x1f4;return function(_0xddbf3a){logger[_0x5f2a('0x22')](_0xddbf3a[_0x5f2a('0x23')]);if(_0xddbf3a[_0x5f2a('0x24')]){delete _0xddbf3a[_0x5f2a('0x24')];}_0x302a8f[_0x5f2a('0x15')](_0x33ce70)[_0x5f2a('0x25')](_0xddbf3a);};}exports[_0x5f2a('0x26')]=function(_0x25e6b1,_0x58a1fc){var _0x5f3d46={},_0x4add98={},_0x2e2b2d={'count':0x0,'rows':[]};var _0x5b6049=_['map'](db[_0x5f2a('0x27')][_0x5f2a('0x28')],function(_0x3d26c3){return{'name':_0x3d26c3['fieldName'],'type':_0x3d26c3[_0x5f2a('0x29')]['key']};});_0x4add98['model']=_[_0x5f2a('0x2a')](_0x5b6049,_0x5f2a('0x24'));_0x4add98[_0x5f2a('0x2b')]=_[_0x5f2a('0x2c')](_0x25e6b1[_0x5f2a('0x2b')]);_0x4add98[_0x5f2a('0x2d')]=_[_0x5f2a('0x2e')](_0x4add98['model'],_0x4add98[_0x5f2a('0x2b')]);_0x5f3d46[_0x5f2a('0x2f')]=_['intersection'](_0x4add98[_0x5f2a('0x30')],qs[_0x5f2a('0x31')](_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x31')]));_0x5f3d46[_0x5f2a('0x2f')]=_0x5f3d46[_0x5f2a('0x2f')]['length']?_0x5f3d46[_0x5f2a('0x2f')]:_0x4add98[_0x5f2a('0x30')];if(!_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x32')](_0x5f2a('0x33'))){_0x5f3d46[_0x5f2a('0x1a')]=qs[_0x5f2a('0x1a')](_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x1a')]);_0x5f3d46[_0x5f2a('0x19')]=qs['offset'](_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x19')]);}_0x5f3d46['order']=qs[_0x5f2a('0x34')](_0x25e6b1['query']['sort']);_0x5f3d46[_0x5f2a('0x35')]=qs['filters'](_[_0x5f2a('0x36')](_0x25e6b1[_0x5f2a('0x2b')],_0x4add98[_0x5f2a('0x2d')]));if(_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x37')]){_0x5f3d46[_0x5f2a('0x35')]=_['merge'](_0x5f3d46[_0x5f2a('0x35')],{'$or':_[_0x5f2a('0x2a')](_0x5b6049,function(_0x2b1f48){if(_0x2b1f48[_0x5f2a('0x29')]!=='VIRTUAL'){var _0xa6d2bc={};_0xa6d2bc[_0x2b1f48['name']]={'$like':'%'+_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x37')]+'%'};return _0xa6d2bc;}})});}_0x5f3d46=_['merge']({},_0x5f3d46,_0x25e6b1[_0x5f2a('0x38')]);var _0x58a9d2={'where':_0x5f3d46[_0x5f2a('0x35')]};return db[_0x5f2a('0x27')][_0x5f2a('0x18')](_0x58a9d2)['then'](function(_0x1ca49e){_0x2e2b2d['count']=_0x1ca49e;if(_0x25e6b1[_0x5f2a('0x2b')][_0x5f2a('0x39')]){_0x5f3d46[_0x5f2a('0x3a')]=[{'all':!![]}];}return db[_0x5f2a('0x27')][_0x5f2a('0x3b')](_0x5f3d46);})[_0x5f2a('0x20')](function(_0x5093e){_0x2e2b2d[_0x5f2a('0x3c')]=_0x5093e;return _0x2e2b2d;})[_0x5f2a('0x20')](respondWithFilteredResult(_0x58a1fc,_0x5f3d46))[_0x5f2a('0x3d')](handleError(_0x58a1fc,null));};exports['show']=function(_0x56329e,_0x52ba81){var _0x2df030={'raw':!![],'where':{'id':_0x56329e[_0x5f2a('0x3e')]['id']}},_0xee8027={};_0xee8027[_0x5f2a('0x30')]=_[_0x5f2a('0x2c')](db[_0x5f2a('0x27')][_0x5f2a('0x28')]);_0xee8027['query']=_[_0x5f2a('0x2c')](_0x56329e[_0x5f2a('0x2b')]);_0xee8027[_0x5f2a('0x2d')]=_[_0x5f2a('0x2e')](_0xee8027['model'],_0xee8027['query']);_0x2df030[_0x5f2a('0x2f')]=_[_0x5f2a('0x2e')](_0xee8027[_0x5f2a('0x30')],qs[_0x5f2a('0x31')](_0x56329e[_0x5f2a('0x2b')][_0x5f2a('0x31')]));_0x2df030[_0x5f2a('0x2f')]=_0x2df030[_0x5f2a('0x2f')][_0x5f2a('0x3f')]?_0x2df030[_0x5f2a('0x2f')]:_0xee8027['model'];if(_0x56329e[_0x5f2a('0x2b')][_0x5f2a('0x39')]){_0x2df030['include']=[{'all':!![]}];}_0x2df030=_['merge']({},_0x2df030,_0x56329e[_0x5f2a('0x38')]);return db[_0x5f2a('0x27')][_0x5f2a('0x40')](_0x2df030)[_0x5f2a('0x20')](handleEntityNotFound(_0x52ba81,null))[_0x5f2a('0x20')](respondWithResult(_0x52ba81,null))[_0x5f2a('0x3d')](handleError(_0x52ba81,null));};exports[_0x5f2a('0x41')]=function(_0x5dedb8,_0xf36b9d){return db[_0x5f2a('0x27')][_0x5f2a('0x41')]()[_0x5f2a('0x20')](respondWithResult(_0xf36b9d,null))[_0x5f2a('0x3d')](handleError(_0xf36b9d,null));};exports[_0x5f2a('0x42')]=function(_0x1b186b,_0x4bfd82){if(_0x1b186b['body'][_0x5f2a('0x43')]){delete _0x1b186b[_0x5f2a('0x44')][_0x5f2a('0x43')];}return db[_0x5f2a('0x27')][_0x5f2a('0x40')]({'where':{'uniqueid':_0x1b186b['params']['id']}})['then'](handleEntityNotFound(_0x4bfd82,null))[_0x5f2a('0x20')](saveUpdates(_0x1b186b[_0x5f2a('0x44')],null))[_0x5f2a('0x20')](respondWithResult(_0x4bfd82,null))[_0x5f2a('0x3d')](handleError(_0x4bfd82,null));};exports['countContactsQueueCampaignHopperFinal']=function(_0x451bd5,_0x90aa5a,_0x2ca355){return db[_0x5f2a('0x27')][_0x5f2a('0x3b')]({'raw':![],'where':{'VoiceQueueId':_0x451bd5[_0x5f2a('0x3e')]['id']},'attributes':[[db['sequelize']['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db['sequelize'][_0x5f2a('0x47')](_0x5f2a('0x48')))),'noSuchContacts'],[db[_0x5f2a('0x46')]['fn']('COUNT',db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x49')))),_0x5f2a('0x4a')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db['sequelize'][_0x5f2a('0x47')](_0x5f2a('0x4b')))),_0x5f2a('0x4c')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db['sequelize'][_0x5f2a('0x47')](_0x5f2a('0x4d')))),'congestionContacts'],[db['sequelize']['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x5f2a('0x4e')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db['sequelize']['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x5f2a('0x4f')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x50')))),_0x5f2a('0x51')],[db['sequelize']['fn'](_0x5f2a('0x45'),db['sequelize']['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x52')))),'answeringMachine']]})[_0x5f2a('0x20')](handleEntityNotFound(_0x90aa5a,null))[_0x5f2a('0x20')](respondWithResult(_0x90aa5a,null))[_0x5f2a('0x3d')](handleError(_0x90aa5a,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x314e09,_0x52f6dd,_0x5eda0c){return db[_0x5f2a('0x27')][_0x5f2a('0x3b')]({'raw':![],'where':{'CampaignId':_0x314e09[_0x5f2a('0x3e')]['id']},'attributes':[[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x48')))),_0x5f2a('0x53')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x49')))),'noAnswerContacts'],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')]['literal']('`state`\x20=\x205,\x201,\x20null'))),'busyContacts'],[db['sequelize']['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x4d')))),_0x5f2a('0x54')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x55')))),'dropContacts'],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db['sequelize']['fn']('IF',db['sequelize'][_0x5f2a('0x47')](_0x5f2a('0x56')))),_0x5f2a('0x4f')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db['sequelize'][_0x5f2a('0x47')](_0x5f2a('0x50')))),_0x5f2a('0x51')],[db[_0x5f2a('0x46')]['fn'](_0x5f2a('0x45'),db[_0x5f2a('0x46')]['fn']('IF',db[_0x5f2a('0x46')][_0x5f2a('0x47')](_0x5f2a('0x52')))),_0x5f2a('0x57')]]})[_0x5f2a('0x20')](handleEntityNotFound(_0x52f6dd,null))[_0x5f2a('0x20')](respondWithResult(_0x52f6dd,null))[_0x5f2a('0x3d')](handleError(_0x52f6dd,null));};exports[_0x5f2a('0x58')]=function(_0x14f962,_0x2ef3f6,_0x49e31f){return db[_0x5f2a('0x59')][_0x5f2a('0x40')]({'where':{'id':_0x14f962[_0x5f2a('0x3e')]['id']}})[_0x5f2a('0x20')](handleEntityNotFound(_0x2ef3f6,null))[_0x5f2a('0x20')](function(_0x54f81e){var _0x28349a;if(_0x54f81e){_0x28349a=squel[_0x5f2a('0x5a')]()[_0x5f2a('0x5b')](_0x5f2a('0x5c'))[_0x5f2a('0x5d')]([_0x5f2a('0x5e'),'scheduledAt','ContactId',_0x5f2a('0x5f'),_0x5f2a('0x60'),_0x5f2a('0x61'),_0x5f2a('0x62')],squel['select']()[_0x5f2a('0x63')](_0x5f2a('0x64'),_0x5f2a('0x5e'))['field'](_0x5f2a('0x65'),_0x5f2a('0x66'))[_0x5f2a('0x63')](_0x5f2a('0x67'),_0x5f2a('0x68'))[_0x5f2a('0x63')](_0x5f2a('0x69'),_0x5f2a('0x5f'))[_0x5f2a('0x63')](_0x5f2a('0x6a'),_0x5f2a('0x60'))['field'](_0x5f2a('0x65'),_0x5f2a('0x61'))[_0x5f2a('0x63')](_0x5f2a('0x65'),'updatedAt')[_0x5f2a('0x6b')]('cm_hopper_final')[_0x5f2a('0x35')]('VoiceQueueId\x20=\x20?',_0x14f962[_0x5f2a('0x3e')]['id'][_0x5f2a('0x6c')]())[_0x5f2a('0x35')]('state\x20=\x20?',_0x14f962['body'][_0x5f2a('0x6d')][_0x5f2a('0x6c')]())[_0x5f2a('0x35')](_0x5f2a('0x6e'))[_0x5f2a('0x35')](_0x5f2a('0x6f'),squel['select']()['field'](_0x5f2a('0x5e'))[_0x5f2a('0x6b')](_0x5f2a('0x5c'))[_0x5f2a('0x35')](_0x5f2a('0x70'),_0x14f962[_0x5f2a('0x3e')]['id'][_0x5f2a('0x6c')]()))[_0x5f2a('0x35')](_0x5f2a('0x6f'),squel[_0x5f2a('0x71')]()[_0x5f2a('0x63')](_0x5f2a('0x72'))['from'](_0x5f2a('0x73'))['where'](_0x5f2a('0x70'),_0x14f962[_0x5f2a('0x3e')]['id'][_0x5f2a('0x6c')]())['where']('state\x20=\x204'))[_0x5f2a('0x74')](_0x5f2a('0x68')))['toString']();return db[_0x5f2a('0x46')][_0x5f2a('0x2b')](_0x28349a);}return[];})['then'](respondWithResult(_0x2ef3f6,null))[_0x5f2a('0x3d')](handleError(_0x2ef3f6,null));};exports['moveContactsIvrCampaignHopperFinal']=function(_0x2253f1,_0x1c965,_0xcaeaa3){return db['Campaign'][_0x5f2a('0x40')]({'where':{'id':_0x2253f1[_0x5f2a('0x3e')]['id']}})['then'](handleEntityNotFound(_0x1c965,null))['then'](function(_0x1b5837){var _0x58602e;if(_0x1b5837){_0x58602e=squel[_0x5f2a('0x5a')]()['into'](_0x5f2a('0x5c'))['fromQuery']([_0x5f2a('0x5e'),'scheduledAt',_0x5f2a('0x68'),'ListId',_0x5f2a('0x75'),_0x5f2a('0x61'),'updatedAt'],squel[_0x5f2a('0x71')]()['field'](_0x5f2a('0x64'),_0x5f2a('0x5e'))[_0x5f2a('0x63')](_0x5f2a('0x65'),_0x5f2a('0x66'))[_0x5f2a('0x63')]('ANY_VALUE(ContactId)',_0x5f2a('0x68'))['field']('ANY_VALUE(ListId)',_0x5f2a('0x5f'))[_0x5f2a('0x63')]('ANY_VALUE(CampaignId)',_0x5f2a('0x75'))[_0x5f2a('0x63')](_0x5f2a('0x65'),_0x5f2a('0x61'))['field'](_0x5f2a('0x65'),_0x5f2a('0x62'))[_0x5f2a('0x6b')](_0x5f2a('0x73'))[_0x5f2a('0x35')]('CampaignId\x20=\x20?',_0x2253f1[_0x5f2a('0x3e')]['id'][_0x5f2a('0x6c')]())['where']('state\x20=\x20?',_0x2253f1[_0x5f2a('0x44')][_0x5f2a('0x6d')][_0x5f2a('0x6c')]())['where'](_0x5f2a('0x6e'))[_0x5f2a('0x35')](_0x5f2a('0x6f'),squel['select']()['field'](_0x5f2a('0x5e'))['from'](_0x5f2a('0x5c'))[_0x5f2a('0x35')]('CampaignId\x20=\x20?',_0x2253f1['params']['id'][_0x5f2a('0x6c')]()))[_0x5f2a('0x35')](_0x5f2a('0x6f'),squel[_0x5f2a('0x71')]()['field'](_0x5f2a('0x72'))[_0x5f2a('0x6b')](_0x5f2a('0x73'))[_0x5f2a('0x35')]('CampaignId\x20=\x20?',_0x2253f1[_0x5f2a('0x3e')]['id'][_0x5f2a('0x6c')]())[_0x5f2a('0x35')](_0x5f2a('0x76')))['group'](_0x5f2a('0x68')))[_0x5f2a('0x6c')]();return db[_0x5f2a('0x46')]['query'](_0x58602e);}return[];})[_0x5f2a('0x20')](respondWithResult(_0x1c965,null))[_0x5f2a('0x3d')](handleError(_0x1c965,null));};exports[_0x5f2a('0x77')]=function(_0x450288,_0x57e9f0,_0x4c756c){return db[_0x5f2a('0x78')]['findOne']({'where':{'VoiceQueueId':_0x450288[_0x5f2a('0x44')][_0x5f2a('0x60')],'CampaignId':_0x450288[_0x5f2a('0x44')][_0x5f2a('0x75')],'ContactId':_0x450288[_0x5f2a('0x44')]['ContactId']}})[_0x5f2a('0x20')](handleEntityNotFound(_0x57e9f0,null))[_0x5f2a('0x20')](function(_0x72f196){if(_0x72f196){return _0x72f196;}return null;})[_0x5f2a('0x20')](respondWithResult(_0x57e9f0,null))[_0x5f2a('0x3d')](handleError(_0x57e9f0,null));}; \ No newline at end of file +var _0x4c24=['status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','catch','show','params','length','include','describe','body','uniqueid','find','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2019,\x201,\x20null','into','cm_hopper','fromQuery','phone','ContactId','ListId','VoiceQueueId','createdAt','updatedAt','select','ANY_VALUE(calleridnum)','field','scheduledAt','ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','NOW()','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','from','calleridnum','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','insert','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','checkContactHopper','CmHopper','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus'];(function(_0x38ba09,_0x20a382){var _0x40c94f=function(_0x46e840){while(--_0x46e840){_0x38ba09['push'](_0x38ba09['shift']());}};_0x40c94f(++_0x20a382);}(_0x4c24,0x171));var _0x44c2=function(_0x3d6017,_0x1cac69){_0x3d6017=_0x3d6017-0x0;var _0x484cec=_0x4c24[_0x3d6017];return _0x484cec;};'use strict';var pdf=require(_0x44c2('0x0'));var emlformat=require(_0x44c2('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x44c2('0x2'));var jsonpatch=require(_0x44c2('0x3'));var rp=require(_0x44c2('0x4'));var moment=require(_0x44c2('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x44c2('0x6'));var util=require('util');var path=require(_0x44c2('0x7'));var sox=require('sox');var csv=require(_0x44c2('0x8'));var ejs=require(_0x44c2('0x9'));var fs=require('fs');var _=require(_0x44c2('0xa'));var squel=require('squel');var crypto=require(_0x44c2('0xb'));var jsforce=require(_0x44c2('0xc'));var deskjs=require(_0x44c2('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x44c2('0xe'));var Redis=require(_0x44c2('0xf'));var authService=require(_0x44c2('0x10'));var qs=require(_0x44c2('0x11'));var as=require(_0x44c2('0x12'));var hardwareService=require(_0x44c2('0x13'));var logger=require(_0x44c2('0x14'))('api');var utils=require(_0x44c2('0x15'));var config=require(_0x44c2('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xacc210,_0x4afc17){_0x4afc17=_0x4afc17||0xcc;return function(_0x4006e6){if(_0x4006e6){return _0xacc210[_0x44c2('0x17')](_0x4afc17);}return _0xacc210[_0x44c2('0x18')](_0x4afc17)[_0x44c2('0x19')]();};}function respondWithResult(_0x4d2a4c,_0x268481){_0x268481=_0x268481||0xc8;return function(_0x30022b){if(_0x30022b){return _0x4d2a4c[_0x44c2('0x18')](_0x268481)[_0x44c2('0x1a')](_0x30022b);}};}function respondWithFilteredResult(_0x5ba5c1,_0x31ba36){return function(_0x221a9b){if(_0x221a9b){var _0x19f7a3=_0x221a9b['count'],_0x2ca4ab=_0x31ba36[_0x44c2('0x1b')],_0x38e5f3=_0x31ba36[_0x44c2('0x1b')]+_0x31ba36[_0x44c2('0x1c')],_0x4427f1;if(_0x38e5f3>=_0x19f7a3){_0x38e5f3=_0x19f7a3;_0x4427f1=0xc8;}else{_0x4427f1=0xce;}_0x5ba5c1[_0x44c2('0x18')](_0x4427f1);return _0x5ba5c1[_0x44c2('0x1d')](_0x44c2('0x1e'),_0x2ca4ab+'-'+_0x38e5f3+'/'+_0x19f7a3)[_0x44c2('0x1a')](_0x221a9b);}return null;};}function patchUpdates(_0x13f965){return function(_0x523e48){try{jsonpatch[_0x44c2('0x1f')](_0x523e48,_0x13f965,!![]);}catch(_0x14cd3b){return BPromise[_0x44c2('0x20')](_0x14cd3b);}return _0x523e48[_0x44c2('0x21')]();};}function saveUpdates(_0x471f33,_0x27ac34){return function(_0x48f323){if(_0x48f323){return _0x48f323[_0x44c2('0x22')](_0x471f33)[_0x44c2('0x23')](function(_0x14f4cb){return _0x14f4cb;});}return null;};}function removeEntity(_0x1d8c13,_0x8170e6){return function(_0x4936ef){if(_0x4936ef){return _0x4936ef[_0x44c2('0x24')]()['then'](function(){_0x1d8c13['status'](0xcc)[_0x44c2('0x19')]();});}};}function handleEntityNotFound(_0x297e5f,_0x210ed7){return function(_0x3ce31a){if(!_0x3ce31a){_0x297e5f[_0x44c2('0x17')](0x194);}return _0x3ce31a;};}function handleError(_0x5e7d69,_0x3da331){_0x3da331=_0x3da331||0x1f4;return function(_0xdc4852){logger['error'](_0xdc4852[_0x44c2('0x25')]);if(_0xdc4852[_0x44c2('0x26')]){delete _0xdc4852[_0x44c2('0x26')];}_0x5e7d69[_0x44c2('0x18')](_0x3da331)[_0x44c2('0x27')](_0xdc4852);};}exports[_0x44c2('0x28')]=function(_0x2795c3,_0x5ddeec){var _0x9375be={},_0x315077={},_0x2359d2={'count':0x0,'rows':[]};var _0x1062ab=_[_0x44c2('0x29')](db[_0x44c2('0x2a')][_0x44c2('0x2b')],function(_0x5bb51e){return{'name':_0x5bb51e[_0x44c2('0x2c')],'type':_0x5bb51e['type'][_0x44c2('0x2d')]};});_0x315077[_0x44c2('0x2e')]=_[_0x44c2('0x29')](_0x1062ab,_0x44c2('0x26'));_0x315077[_0x44c2('0x2f')]=_[_0x44c2('0x30')](_0x2795c3['query']);_0x315077['filters']=_[_0x44c2('0x31')](_0x315077[_0x44c2('0x2e')],_0x315077['query']);_0x9375be[_0x44c2('0x32')]=_[_0x44c2('0x31')](_0x315077[_0x44c2('0x2e')],qs[_0x44c2('0x33')](_0x2795c3[_0x44c2('0x2f')]['fields']));_0x9375be[_0x44c2('0x32')]=_0x9375be[_0x44c2('0x32')]['length']?_0x9375be[_0x44c2('0x32')]:_0x315077[_0x44c2('0x2e')];if(!_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x34')](_0x44c2('0x35'))){_0x9375be['limit']=qs[_0x44c2('0x1c')](_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x1c')]);_0x9375be[_0x44c2('0x1b')]=qs[_0x44c2('0x1b')](_0x2795c3['query'][_0x44c2('0x1b')]);}_0x9375be[_0x44c2('0x36')]=qs[_0x44c2('0x37')](_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x37')]);_0x9375be[_0x44c2('0x38')]=qs[_0x44c2('0x39')](_[_0x44c2('0x3a')](_0x2795c3['query'],_0x315077[_0x44c2('0x39')]));if(_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x3b')]){_0x9375be[_0x44c2('0x38')]=_[_0x44c2('0x3c')](_0x9375be[_0x44c2('0x38')],{'$or':_[_0x44c2('0x29')](_0x1062ab,function(_0x23f635){if(_0x23f635[_0x44c2('0x3d')]!==_0x44c2('0x3e')){var _0x45e70d={};_0x45e70d[_0x23f635['name']]={'$like':'%'+_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x3b')]+'%'};return _0x45e70d;}})});}_0x9375be=_[_0x44c2('0x3c')]({},_0x9375be,_0x2795c3[_0x44c2('0x3f')]);var _0x4a76c5={'where':_0x9375be[_0x44c2('0x38')]};return db[_0x44c2('0x2a')][_0x44c2('0x40')](_0x4a76c5)[_0x44c2('0x23')](function(_0x179d88){_0x2359d2[_0x44c2('0x40')]=_0x179d88;if(_0x2795c3[_0x44c2('0x2f')][_0x44c2('0x41')]){_0x9375be['include']=[{'all':!![]}];}return db[_0x44c2('0x2a')][_0x44c2('0x42')](_0x9375be);})[_0x44c2('0x23')](function(_0x1dc73e){_0x2359d2['rows']=_0x1dc73e;return _0x2359d2;})['then'](respondWithFilteredResult(_0x5ddeec,_0x9375be))[_0x44c2('0x43')](handleError(_0x5ddeec,null));};exports[_0x44c2('0x44')]=function(_0x81115c,_0x2afc9d){var _0xaae806={'raw':!![],'where':{'id':_0x81115c[_0x44c2('0x45')]['id']}},_0x120c0f={};_0x120c0f[_0x44c2('0x2e')]=_[_0x44c2('0x30')](db['CmHopperFinal']['rawAttributes']);_0x120c0f[_0x44c2('0x2f')]=_[_0x44c2('0x30')](_0x81115c[_0x44c2('0x2f')]);_0x120c0f[_0x44c2('0x39')]=_['intersection'](_0x120c0f[_0x44c2('0x2e')],_0x120c0f[_0x44c2('0x2f')]);_0xaae806[_0x44c2('0x32')]=_['intersection'](_0x120c0f[_0x44c2('0x2e')],qs[_0x44c2('0x33')](_0x81115c['query'][_0x44c2('0x33')]));_0xaae806[_0x44c2('0x32')]=_0xaae806['attributes'][_0x44c2('0x46')]?_0xaae806[_0x44c2('0x32')]:_0x120c0f['model'];if(_0x81115c[_0x44c2('0x2f')][_0x44c2('0x41')]){_0xaae806[_0x44c2('0x47')]=[{'all':!![]}];}_0xaae806=_[_0x44c2('0x3c')]({},_0xaae806,_0x81115c[_0x44c2('0x3f')]);return db[_0x44c2('0x2a')]['find'](_0xaae806)['then'](handleEntityNotFound(_0x2afc9d,null))[_0x44c2('0x23')](respondWithResult(_0x2afc9d,null))[_0x44c2('0x43')](handleError(_0x2afc9d,null));};exports[_0x44c2('0x48')]=function(_0x311fb0,_0x4467d7){return db[_0x44c2('0x2a')][_0x44c2('0x48')]()[_0x44c2('0x23')](respondWithResult(_0x4467d7,null))['catch'](handleError(_0x4467d7,null));};exports[_0x44c2('0x22')]=function(_0x5ea1d8,_0x4e31f6){if(_0x5ea1d8[_0x44c2('0x49')][_0x44c2('0x4a')]){delete _0x5ea1d8[_0x44c2('0x49')][_0x44c2('0x4a')];}return db[_0x44c2('0x2a')][_0x44c2('0x4b')]({'where':{'uniqueid':_0x5ea1d8[_0x44c2('0x45')]['id']}})[_0x44c2('0x23')](handleEntityNotFound(_0x4e31f6,null))[_0x44c2('0x23')](saveUpdates(_0x5ea1d8['body'],null))[_0x44c2('0x23')](respondWithResult(_0x4e31f6,null))[_0x44c2('0x43')](handleError(_0x4e31f6,null));};exports[_0x44c2('0x4c')]=function(_0x11e3de,_0x458e4c,_0x470474){return db['CmHopperFinal'][_0x44c2('0x42')]({'raw':![],'where':{'VoiceQueueId':_0x11e3de[_0x44c2('0x45')]['id']},'attributes':[[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')]('`state`\x20=\x200,\x201,\x20null'))),_0x44c2('0x50')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')](_0x44c2('0x51')))),'noAnswerContacts'],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')]['literal'](_0x44c2('0x52')))),_0x44c2('0x53')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db['sequelize']['fn']('IF',db[_0x44c2('0x4d')]['literal'](_0x44c2('0x54')))),_0x44c2('0x55')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')]['literal']('`state`\x20=\x2010\x20,\x201,\x20null'))),'dropContacts'],[db['sequelize']['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x44c2('0x56')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')](_0x44c2('0x57')))),_0x44c2('0x58')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')]('`state`\x20=\x2019,\x201,\x20null'))),_0x44c2('0x59')]]})[_0x44c2('0x23')](handleEntityNotFound(_0x458e4c,null))[_0x44c2('0x23')](respondWithResult(_0x458e4c,null))['catch'](handleError(_0x458e4c,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x11b7a5,_0x135aaa,_0x5356ae){return db['CmHopperFinal'][_0x44c2('0x42')]({'raw':![],'where':{'CampaignId':_0x11b7a5[_0x44c2('0x45')]['id']},'attributes':[[db[_0x44c2('0x4d')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x44c2('0x4f')]('`state`\x20=\x200,\x201,\x20null'))),'noSuchContacts'],[db[_0x44c2('0x4d')]['fn']('COUNT',db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')](_0x44c2('0x51')))),_0x44c2('0x5a')],[db[_0x44c2('0x4d')]['fn']('COUNT',db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')]['literal'](_0x44c2('0x52')))),'busyContacts'],[db['sequelize']['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')](_0x44c2('0x54')))),_0x44c2('0x55')],[db[_0x44c2('0x4d')]['fn']('COUNT',db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')]['literal'](_0x44c2('0x5b')))),_0x44c2('0x5c')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db[_0x44c2('0x4d')][_0x44c2('0x4f')](_0x44c2('0x5d')))),'abandonedContacts'],[db['sequelize']['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db['sequelize'][_0x44c2('0x4f')]('`state`\x20=\x2022,\x201,\x20null'))),_0x44c2('0x58')],[db[_0x44c2('0x4d')]['fn'](_0x44c2('0x4e'),db[_0x44c2('0x4d')]['fn']('IF',db['sequelize']['literal'](_0x44c2('0x5e')))),_0x44c2('0x59')]]})[_0x44c2('0x23')](handleEntityNotFound(_0x135aaa,null))['then'](respondWithResult(_0x135aaa,null))[_0x44c2('0x43')](handleError(_0x135aaa,null));};exports['moveContactsQueueCampaignHopperFinal']=function(_0x33a8a6,_0x3e6c45,_0x46c601){return db['VoiceQueue'][_0x44c2('0x4b')]({'where':{'id':_0x33a8a6[_0x44c2('0x45')]['id']}})[_0x44c2('0x23')](handleEntityNotFound(_0x3e6c45,null))['then'](function(_0x2dee38){var _0x9af81e;if(_0x2dee38){_0x9af81e=squel['insert']()[_0x44c2('0x5f')](_0x44c2('0x60'))[_0x44c2('0x61')]([_0x44c2('0x62'),'scheduledAt',_0x44c2('0x63'),_0x44c2('0x64'),_0x44c2('0x65'),_0x44c2('0x66'),_0x44c2('0x67')],squel[_0x44c2('0x68')]()['field'](_0x44c2('0x69'),_0x44c2('0x62'))[_0x44c2('0x6a')]('NOW()',_0x44c2('0x6b'))[_0x44c2('0x6a')](_0x44c2('0x6c'),'ContactId')[_0x44c2('0x6a')](_0x44c2('0x6d'),_0x44c2('0x64'))[_0x44c2('0x6a')](_0x44c2('0x6e'),_0x44c2('0x65'))[_0x44c2('0x6a')](_0x44c2('0x6f'),_0x44c2('0x66'))[_0x44c2('0x6a')](_0x44c2('0x6f'),_0x44c2('0x67'))['from'](_0x44c2('0x70'))[_0x44c2('0x38')](_0x44c2('0x71'),_0x33a8a6['params']['id']['toString']())[_0x44c2('0x38')](_0x44c2('0x72'),_0x33a8a6[_0x44c2('0x49')][_0x44c2('0x73')][_0x44c2('0x74')]())[_0x44c2('0x38')](_0x44c2('0x75'))['where'](_0x44c2('0x76'),squel[_0x44c2('0x68')]()['field'](_0x44c2('0x62'))[_0x44c2('0x77')](_0x44c2('0x60'))[_0x44c2('0x38')](_0x44c2('0x71'),_0x33a8a6[_0x44c2('0x45')]['id'][_0x44c2('0x74')]()))[_0x44c2('0x38')](_0x44c2('0x76'),squel[_0x44c2('0x68')]()[_0x44c2('0x6a')](_0x44c2('0x78'))[_0x44c2('0x77')](_0x44c2('0x70'))[_0x44c2('0x38')]('VoiceQueueId\x20=\x20?',_0x33a8a6[_0x44c2('0x45')]['id'][_0x44c2('0x74')]())['where'](_0x44c2('0x79')))[_0x44c2('0x7a')](_0x44c2('0x63')))[_0x44c2('0x74')]();return db['sequelize'][_0x44c2('0x2f')](_0x9af81e);}return[];})[_0x44c2('0x23')](respondWithResult(_0x3e6c45,null))[_0x44c2('0x43')](handleError(_0x3e6c45,null));};exports[_0x44c2('0x7b')]=function(_0x4e9f67,_0x158b24,_0x3badde){return db[_0x44c2('0x7c')][_0x44c2('0x4b')]({'where':{'id':_0x4e9f67[_0x44c2('0x45')]['id']}})[_0x44c2('0x23')](handleEntityNotFound(_0x158b24,null))['then'](function(_0x2b8f7c){var _0x41a712;if(_0x2b8f7c){_0x41a712=squel[_0x44c2('0x7d')]()['into'](_0x44c2('0x60'))[_0x44c2('0x61')]([_0x44c2('0x62'),_0x44c2('0x6b'),_0x44c2('0x63'),'ListId',_0x44c2('0x7e'),_0x44c2('0x66'),_0x44c2('0x67')],squel[_0x44c2('0x68')]()[_0x44c2('0x6a')](_0x44c2('0x69'),_0x44c2('0x62'))[_0x44c2('0x6a')](_0x44c2('0x6f'),'scheduledAt')['field'](_0x44c2('0x6c'),_0x44c2('0x63'))[_0x44c2('0x6a')](_0x44c2('0x6d'),'ListId')[_0x44c2('0x6a')](_0x44c2('0x7f'),_0x44c2('0x7e'))[_0x44c2('0x6a')](_0x44c2('0x6f'),_0x44c2('0x66'))['field']('NOW()','updatedAt')[_0x44c2('0x77')]('cm_hopper_final')[_0x44c2('0x38')](_0x44c2('0x80'),_0x4e9f67[_0x44c2('0x45')]['id']['toString']())[_0x44c2('0x38')]('state\x20=\x20?',_0x4e9f67[_0x44c2('0x49')][_0x44c2('0x73')][_0x44c2('0x74')]())['where'](_0x44c2('0x75'))['where'](_0x44c2('0x76'),squel['select']()['field'](_0x44c2('0x62'))['from'](_0x44c2('0x60'))['where'](_0x44c2('0x80'),_0x4e9f67['params']['id'][_0x44c2('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x44c2('0x6a')](_0x44c2('0x78'))['from'](_0x44c2('0x70'))[_0x44c2('0x38')](_0x44c2('0x80'),_0x4e9f67[_0x44c2('0x45')]['id'][_0x44c2('0x74')]())[_0x44c2('0x38')](_0x44c2('0x79')))[_0x44c2('0x7a')](_0x44c2('0x63')))[_0x44c2('0x74')]();return db[_0x44c2('0x4d')]['query'](_0x41a712);}return[];})[_0x44c2('0x23')](respondWithResult(_0x158b24,null))['catch'](handleError(_0x158b24,null));};exports[_0x44c2('0x81')]=function(_0x1ecebb,_0x4797be,_0x43143e){return db[_0x44c2('0x82')]['findOne']({'where':{'VoiceQueueId':_0x1ecebb[_0x44c2('0x49')]['VoiceQueueId'],'CampaignId':_0x1ecebb[_0x44c2('0x49')][_0x44c2('0x7e')],'ContactId':_0x1ecebb['body'][_0x44c2('0x63')]}})[_0x44c2('0x23')](handleEntityNotFound(_0x4797be,null))[_0x44c2('0x23')](function(_0x5dbd6b){if(_0x5dbd6b){return _0x5dbd6b;}return null;})[_0x44c2('0x23')](respondWithResult(_0x4797be,null))['catch'](handleError(_0x4797be,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 2b8c3b8..840567f 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 _0xc17e=['../../config/environment','./cmHopperFinal.attributes','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','util','moment','request-promise','path'];(function(_0x382a62,_0x1baa5e){var _0x490a25=function(_0x1b3427){while(--_0x1b3427){_0x382a62['push'](_0x382a62['shift']());}};_0x490a25(++_0x1baa5e);}(_0xc17e,0x7f));var _0xec17=function(_0x58aad3,_0x2a1647){_0x58aad3=_0x58aad3-0x0;var _0x2618d9=_0xc17e[_0x58aad3];return _0x2618d9;};'use strict';var _=require(_0xec17('0x0'));var util=require(_0xec17('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xec17('0x2'));var BPromise=require('bluebird');var rp=require(_0xec17('0x3'));var fs=require('fs');var path=require(_0xec17('0x4'));var rimraf=require('rimraf');var config=require(_0xec17('0x5'));var attributes=require(_0xec17('0x6'));module['exports']=function(_0x4e2af4,_0x2defef){return _0x4e2af4[_0xec17('0x7')](_0xec17('0x8'),attributes,{'tableName':_0xec17('0x9'),'paranoid':![],'indexes':[{'name':_0xec17('0xa'),'fields':[_0xec17('0xa')]},{'name':'uniqueid','fields':[_0xec17('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf115=['uniqueid','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','calleridnum'];(function(_0xe6edd7,_0x2993d2){var _0xc07080=function(_0x14d02b){while(--_0x14d02b){_0xe6edd7['push'](_0xe6edd7['shift']());}};_0xc07080(++_0x2993d2);}(_0xf115,0xfd));var _0x5f11=function(_0x2f974c,_0x2a9938){_0x2f974c=_0x2f974c-0x0;var _0xd74bc6=_0xf115[_0x2f974c];return _0xd74bc6;};'use strict';var _=require('lodash');var util=require(_0x5f11('0x0'));var logger=require(_0x5f11('0x1'))(_0x5f11('0x2'));var moment=require(_0x5f11('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x5f11('0x4'));var rimraf=require(_0x5f11('0x5'));var config=require(_0x5f11('0x6'));var attributes=require(_0x5f11('0x7'));module[_0x5f11('0x8')]=function(_0x755ef3,_0x2e43d8){return _0x755ef3['define'](_0x5f11('0x9'),attributes,{'tableName':'cm_hopper_final','paranoid':![],'indexes':[{'name':_0x5f11('0xa'),'fields':['calleridnum']},{'name':'uniqueid','fields':[_0x5f11('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index e8f72a9..2a9cb26 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 _0xe01d=['http','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client'];(function(_0x1d08bc,_0x468085){var _0x2236b4=function(_0x58c9f4){while(--_0x58c9f4){_0x1d08bc['push'](_0x1d08bc['shift']());}};_0x2236b4(++_0x468085);}(_0xe01d,0x1c2));var _0xde01=function(_0x280966,_0x414a3a){_0x280966=_0x280966-0x0;var _0x5e6379=_0xe01d[_0x280966];return _0x5e6379;};'use strict';var _=require(_0xde01('0x0'));var util=require('util');var moment=require(_0xde01('0x1'));var BPromise=require(_0xde01('0x2'));var rs=require(_0xde01('0x3'));var fs=require('fs');var Redis=require(_0xde01('0x4'));var db=require(_0xde01('0x5'))['db'];var utils=require(_0xde01('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xde01('0x7'));var client=jayson[_0xde01('0x8')][_0xde01('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xfc08f3,_0x3f2872,_0x1cd33e){return new BPromise(function(_0x557d52,_0xa416aa){return client['request'](_0xfc08f3,_0x1cd33e)[_0xde01('0xa')](function(_0x5cacf6){logger[_0xde01('0xb')](_0xde01('0xc'),_0x3f2872,_0xde01('0xd'));logger[_0xde01('0xe')](_0xde01('0xf'),_0x3f2872,_0xde01('0xd'),JSON[_0xde01('0x10')](_0x5cacf6));if(_0x5cacf6[_0xde01('0x11')]){if(_0x5cacf6[_0xde01('0x11')]['code']===0x1f4){logger[_0xde01('0x11')](_0xde01('0xc'),_0x3f2872,_0x5cacf6[_0xde01('0x11')][_0xde01('0x12')]);return _0xa416aa(_0x5cacf6[_0xde01('0x11')][_0xde01('0x12')]);}logger['error'](_0xde01('0xc'),_0x3f2872,_0x5cacf6[_0xde01('0x11')][_0xde01('0x12')]);return _0x557d52(_0x5cacf6[_0xde01('0x11')][_0xde01('0x12')]);}else{logger[_0xde01('0xb')]('CmHopperFinal,\x20%s,\x20%s',_0x3f2872,_0xde01('0xd'));_0x557d52(_0x5cacf6[_0xde01('0x13')]['message']);}})[_0xde01('0x14')](function(_0x3578b2){logger[_0xde01('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x3f2872,_0x3578b2);_0xa416aa(_0x3578b2);});});}exports[_0xde01('0x15')]=function(_0x2e5fe6){var _0x130c7b=this;return new Promise(function(_0x144ec9,_0x9b7ac8){return db[_0xde01('0x16')][_0xde01('0x17')](_0x2e5fe6[_0xde01('0x18')],{'raw':_0x2e5fe6[_0xde01('0x19')]?_0x2e5fe6[_0xde01('0x19')][_0xde01('0x1a')]===undefined?!![]:![]:!![]})[_0xde01('0xa')](function(_0x5672a8){logger[_0xde01('0xb')]('CreateCmHopperFinal',_0x2e5fe6);logger['debug']('CreateCmHopperFinal',_0x2e5fe6,JSON['stringify'](_0x5672a8));_0x144ec9(_0x5672a8);})[_0xde01('0x14')](function(_0xf5c0bd){logger['error'](_0xde01('0x15'),_0xf5c0bd[_0xde01('0x12')],_0x2e5fe6);_0x9b7ac8(_0x130c7b[_0xde01('0x11')](0x1f4,_0xf5c0bd[_0xde01('0x12')]));});});}; \ No newline at end of file +var _0xbfa9=['request','then','info','CmHopperFinal,\x20%s,\x20%s','request\x20sent','debug','CmHopperFinal,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateCmHopperFinal','CmHopperFinal','create','body','options','raw','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http'];(function(_0xe39824,_0xbdf61f){var _0x4bc31e=function(_0x594760){while(--_0x594760){_0xe39824['push'](_0xe39824['shift']());}};_0x4bc31e(++_0xbdf61f);}(_0xbfa9,0x83));var _0x9bfa=function(_0x4c96e4,_0x2fe2ea){_0x4c96e4=_0x4c96e4-0x0;var _0x2dd5d2=_0xbfa9[_0x4c96e4];return _0x2dd5d2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9bfa('0x0'));var BPromise=require('bluebird');var rs=require(_0x9bfa('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9bfa('0x2'))['db'];var utils=require(_0x9bfa('0x3'));var logger=require('../../config/logger')(_0x9bfa('0x4'));var config=require(_0x9bfa('0x5'));var jayson=require(_0x9bfa('0x6'));var client=jayson[_0x9bfa('0x7')][_0x9bfa('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e512b,_0x14cfe2,_0x1c411b){return new BPromise(function(_0x4dd8b1,_0x458cf4){return client[_0x9bfa('0x9')](_0x1e512b,_0x1c411b)[_0x9bfa('0xa')](function(_0x3be59a){logger[_0x9bfa('0xb')](_0x9bfa('0xc'),_0x14cfe2,_0x9bfa('0xd'));logger[_0x9bfa('0xe')](_0x9bfa('0xf'),_0x14cfe2,'request\x20sent',JSON[_0x9bfa('0x10')](_0x3be59a));if(_0x3be59a[_0x9bfa('0x11')]){if(_0x3be59a[_0x9bfa('0x11')][_0x9bfa('0x12')]===0x1f4){logger['error'](_0x9bfa('0xc'),_0x14cfe2,_0x3be59a[_0x9bfa('0x11')][_0x9bfa('0x13')]);return _0x458cf4(_0x3be59a[_0x9bfa('0x11')][_0x9bfa('0x13')]);}logger[_0x9bfa('0x11')](_0x9bfa('0xc'),_0x14cfe2,_0x3be59a[_0x9bfa('0x11')][_0x9bfa('0x13')]);return _0x4dd8b1(_0x3be59a['error'][_0x9bfa('0x13')]);}else{logger[_0x9bfa('0xb')](_0x9bfa('0xc'),_0x14cfe2,'request\x20sent');_0x4dd8b1(_0x3be59a[_0x9bfa('0x14')][_0x9bfa('0x13')]);}})[_0x9bfa('0x15')](function(_0x587a05){logger[_0x9bfa('0x11')]('CmHopperFinal,\x20%s,\x20%s',_0x14cfe2,_0x587a05);_0x458cf4(_0x587a05);});});}exports[_0x9bfa('0x16')]=function(_0x50f8c3){var _0x2023c0=this;return new Promise(function(_0x19f3d2,_0x3d6729){return db[_0x9bfa('0x17')][_0x9bfa('0x18')](_0x50f8c3[_0x9bfa('0x19')],{'raw':_0x50f8c3[_0x9bfa('0x1a')]?_0x50f8c3[_0x9bfa('0x1a')][_0x9bfa('0x1b')]===undefined?!![]:![]:!![]})[_0x9bfa('0xa')](function(_0x13e116){logger['info'](_0x9bfa('0x16'),_0x50f8c3);logger['debug'](_0x9bfa('0x16'),_0x50f8c3,JSON[_0x9bfa('0x10')](_0x13e116));_0x19f3d2(_0x13e116);})['catch'](function(_0x24244e){logger['error'](_0x9bfa('0x16'),_0x24244e[_0x9bfa('0x13')],_0x50f8c3);_0x3d6729(_0x2023c0[_0x9bfa('0x11')](0x1f4,_0x24244e[_0x9bfa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index 06ea72e..5d9e4f0 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 _0x818f=['countContactsQueueCampaignHopperFinal','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','checkContactHopper','put','update','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x3c30a0,_0x300766){var _0x2eed86=function(_0x154cce){while(--_0x154cce){_0x3c30a0['push'](_0x3c30a0['shift']());}};_0x2eed86(++_0x300766);}(_0x818f,0xe2));var _0xf818=function(_0x752cde,_0x24f1aa){_0x752cde=_0x752cde-0x0;var _0x505417=_0x818f[_0x752cde];return _0x505417;};'use strict';var multer=require('multer');var util=require(_0xf818('0x0'));var path=require(_0xf818('0x1'));var timeout=require(_0xf818('0x2'));var express=require(_0xf818('0x3'));var router=express['Router']();var auth=require(_0xf818('0x4'));var interaction=require(_0xf818('0x5'));var config=require(_0xf818('0x6'));var controller=require(_0xf818('0x7'));router[_0xf818('0x8')]('/',auth[_0xf818('0x9')](),controller['index']);router[_0xf818('0x8')](_0xf818('0xa'),auth[_0xf818('0x9')](),controller[_0xf818('0xb')]);router['get'](_0xf818('0xc'),auth['isAuthenticated'](),controller[_0xf818('0xd')]);router[_0xf818('0x8')]('/voice/queue/countAttributes/:id',auth[_0xf818('0x9')](),controller[_0xf818('0xe')]);router[_0xf818('0x8')]('/campaign/countAttributes/:id',auth[_0xf818('0x9')](),controller[_0xf818('0xf')]);router[_0xf818('0x10')](_0xf818('0x11'),auth['isAuthenticated'](),controller['moveContactsQueueCampaignHopperFinal']);router[_0xf818('0x10')](_0xf818('0x12'),auth['isAuthenticated'](),controller[_0xf818('0x13')]);router[_0xf818('0x10')]('/checkContactHopper',auth['isAuthenticated'](),controller[_0xf818('0x14')]);router[_0xf818('0x15')](_0xf818('0xc'),auth[_0xf818('0x9')](),controller[_0xf818('0x16')]);module[_0xf818('0x17')]=router; \ No newline at end of file +var _0x09f0=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','/voice/campaign/moveContacts/:id','/checkContactHopper','checkContactHopper'];(function(_0x3dc68b,_0x4be2c9){var _0x316cb5=function(_0x42af89){while(--_0x42af89){_0x3dc68b['push'](_0x3dc68b['shift']());}};_0x316cb5(++_0x4be2c9);}(_0x09f0,0xf1));var _0x009f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x09f0[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x009f('0x0'));var util=require(_0x009f('0x1'));var path=require(_0x009f('0x2'));var timeout=require(_0x009f('0x3'));var express=require(_0x009f('0x4'));var router=express[_0x009f('0x5')]();var auth=require(_0x009f('0x6'));var interaction=require(_0x009f('0x7'));var config=require(_0x009f('0x8'));var controller=require('./cmHopperFinal.controller');router[_0x009f('0x9')]('/',auth[_0x009f('0xa')](),controller[_0x009f('0xb')]);router['get'](_0x009f('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x009f('0x9')](_0x009f('0xd'),auth['isAuthenticated'](),controller[_0x009f('0xe')]);router[_0x009f('0x9')](_0x009f('0xf'),auth[_0x009f('0xa')](),controller['countContactsQueueCampaignHopperFinal']);router[_0x009f('0x9')](_0x009f('0x10'),auth['isAuthenticated'](),controller[_0x009f('0x11')]);router[_0x009f('0x12')](_0x009f('0x13'),auth[_0x009f('0xa')](),controller['moveContactsQueueCampaignHopperFinal']);router[_0x009f('0x12')](_0x009f('0x14'),auth[_0x009f('0xa')](),controller['moveContactsIvrCampaignHopperFinal']);router[_0x009f('0x12')](_0x009f('0x15'),auth['isAuthenticated'](),controller[_0x009f('0x16')]);router['put']('/:id',auth[_0x009f('0xa')](),controller['update']);module[_0x009f('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index 9038301..b6a6300 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 _0x9efd=['INTEGER','DATE','STRING','BOOLEAN'];(function(_0x42022b,_0xeb3345){var _0x54b918=function(_0x3cd8a6){while(--_0x3cd8a6){_0x42022b['push'](_0x42022b['shift']());}};_0x54b918(++_0xeb3345);}(_0x9efd,0x19c));var _0xd9ef=function(_0x242196,_0xc85378){_0x242196=_0x242196-0x0;var _0xf1db0a=_0x9efd[_0x242196];return _0xf1db0a;};'use strict';var Sequelize=require('sequelize');module['exports']={'state':{'type':Sequelize[_0xd9ef('0x0')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xd9ef('0x1')]},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xd9ef('0x2')]},'originatecalleridnum':{'type':Sequelize[_0xd9ef('0x2')]},'originatecalleridname':{'type':Sequelize[_0xd9ef('0x2')]},'calleridnum':{'type':Sequelize[_0xd9ef('0x2')]},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0xd9ef('0x1')]},'responsetime':{'type':Sequelize[_0xd9ef('0x1')]},'answertime':{'type':Sequelize[_0xd9ef('0x1')]},'droptime':{'type':Sequelize[_0xd9ef('0x1')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xd9ef('0x2')]},'campaign':{'type':Sequelize[_0xd9ef('0x2')]},'campaigntype':{'type':Sequelize[_0xd9ef('0x2')]},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xd9ef('0x2')]},'amd':{'type':Sequelize[_0xd9ef('0x3')],'defaultValue':![]},'fax':{'type':Sequelize[_0xd9ef('0x3')],'defaultValue':![]},'callback':{'type':Sequelize[_0xd9ef('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xd9ef('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xd9ef('0x1')]},'recallme':{'type':Sequelize[_0xd9ef('0x3')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xd9ef('0x1')]},'edited':{'type':Sequelize[_0xd9ef('0x3')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xd9ef('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe241=['exports','INTEGER','STRING','DATE','BOOLEAN','sequelize'];(function(_0x960b64,_0x1a8a15){var _0x5e4af8=function(_0x986714){while(--_0x986714){_0x960b64['push'](_0x960b64['shift']());}};_0x5e4af8(++_0x1a8a15);}(_0xe241,0x14f));var _0x1e24=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xe241[_0x5a776b];return _0xbbef59;};'use strict';var Sequelize=require(_0x1e24('0x0'));module[_0x1e24('0x1')]={'state':{'type':Sequelize[_0x1e24('0x2')](0x2)},'statedesc':{'type':Sequelize[_0x1e24('0x3')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x1e24('0x3')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x1e24('0x3')]},'calleridnum':{'type':Sequelize[_0x1e24('0x3')]},'calleridname':{'type':Sequelize[_0x1e24('0x3')]},'starttime':{'type':Sequelize[_0x1e24('0x4')]},'responsetime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0x1e24('0x4')]},'droptime':{'type':Sequelize[_0x1e24('0x4')]},'endtime':{'type':Sequelize[_0x1e24('0x4')]},'ringtime':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x1e24('0x3')]},'campaigntype':{'type':Sequelize[_0x1e24('0x3')]},'membername':{'type':Sequelize[_0x1e24('0x3')]},'reason':{'type':Sequelize[_0x1e24('0x3')]},'amd':{'type':Sequelize[_0x1e24('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0x1e24('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0x1e24('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x1e24('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x1e24('0x4')]},'recallme':{'type':Sequelize[_0x1e24('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x1e24('0x4')]},'edited':{'type':Sequelize[_0x1e24('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x1e24('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 0f21b77..ba557ea 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 _0xd2e8=['rimraf','fast-json-patch','request-promise','bluebird','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','index','map','CmHopperHistory','fieldName','type','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','include','findAll','rows','catch','show','keys','intersection','length','includeAll','find','create','describe','body','uniqueid','html-pdf','eml-format'];(function(_0x469f97,_0x1d2bd0){var _0x557d30=function(_0xe4d2a5){while(--_0xe4d2a5){_0x469f97['push'](_0x469f97['shift']());}};_0x557d30(++_0x1d2bd0);}(_0xd2e8,0xdf));var _0x8d2e=function(_0x54381d,_0x247b2c){_0x54381d=_0x54381d-0x0;var _0x5308a7=_0xd2e8[_0x54381d];return _0x5308a7;};'use strict';var pdf=require(_0x8d2e('0x0'));var emlformat=require(_0x8d2e('0x1'));var rimraf=require(_0x8d2e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8d2e('0x3'));var rp=require(_0x8d2e('0x4'));var moment=require('moment');var BPromise=require(_0x8d2e('0x5'));var Mustache=require('mustache');var util=require(_0x8d2e('0x6'));var path=require('path');var sox=require(_0x8d2e('0x7'));var csv=require(_0x8d2e('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8d2e('0x9'));var squel=require('squel');var crypto=require(_0x8d2e('0xa'));var jsforce=require(_0x8d2e('0xb'));var deskjs=require(_0x8d2e('0xc'));var toCsv=require(_0x8d2e('0x8'));var querystring=require(_0x8d2e('0xd'));var Papa=require(_0x8d2e('0xe'));var Redis=require(_0x8d2e('0xf'));var authService=require(_0x8d2e('0x10'));var qs=require(_0x8d2e('0x11'));var as=require(_0x8d2e('0x12'));var hardwareService=require(_0x8d2e('0x13'));var logger=require(_0x8d2e('0x14'))(_0x8d2e('0x15'));var utils=require(_0x8d2e('0x16'));var config=require(_0x8d2e('0x17'));var db=require(_0x8d2e('0x18'))['db'];function respondWithStatusCode(_0x5e278a,_0x155794){_0x155794=_0x155794||0xcc;return function(_0xfc0e8e){if(_0xfc0e8e){return _0x5e278a[_0x8d2e('0x19')](_0x155794);}return _0x5e278a[_0x8d2e('0x1a')](_0x155794)[_0x8d2e('0x1b')]();};}function respondWithResult(_0x164832,_0x4108df){_0x4108df=_0x4108df||0xc8;return function(_0x52ffe0){if(_0x52ffe0){return _0x164832[_0x8d2e('0x1a')](_0x4108df)['json'](_0x52ffe0);}};}function respondWithFilteredResult(_0x5b62b6,_0x25a7f5){return function(_0x25ce11){if(_0x25ce11){var _0x5ce9d9=_0x25ce11[_0x8d2e('0x1c')],_0x3587e0=_0x25a7f5[_0x8d2e('0x1d')],_0x126e54=_0x25a7f5[_0x8d2e('0x1d')]+_0x25a7f5[_0x8d2e('0x1e')],_0x136290;if(_0x126e54>=_0x5ce9d9){_0x126e54=_0x5ce9d9;_0x136290=0xc8;}else{_0x136290=0xce;}_0x5b62b6[_0x8d2e('0x1a')](_0x136290);return _0x5b62b6[_0x8d2e('0x1f')](_0x8d2e('0x20'),_0x3587e0+'-'+_0x126e54+'/'+_0x5ce9d9)[_0x8d2e('0x21')](_0x25ce11);}return null;};}function patchUpdates(_0x1b23df){return function(_0x112916){try{jsonpatch[_0x8d2e('0x22')](_0x112916,_0x1b23df,!![]);}catch(_0x13a902){return BPromise[_0x8d2e('0x23')](_0x13a902);}return _0x112916['save']();};}function saveUpdates(_0x4868cf,_0x2083b6){return function(_0x24a43d){if(_0x24a43d){return _0x24a43d['update'](_0x4868cf)[_0x8d2e('0x24')](function(_0x370da8){return _0x370da8;});}return null;};}function removeEntity(_0x31c87d,_0x27f983){return function(_0x1513d1){if(_0x1513d1){return _0x1513d1[_0x8d2e('0x25')]()[_0x8d2e('0x24')](function(){_0x31c87d[_0x8d2e('0x1a')](0xcc)[_0x8d2e('0x1b')]();});}};}function handleEntityNotFound(_0x3cac70,_0x5a78b4){return function(_0x168880){if(!_0x168880){_0x3cac70[_0x8d2e('0x19')](0x194);}return _0x168880;};}function handleError(_0x1c7675,_0x3d36df){_0x3d36df=_0x3d36df||0x1f4;return function(_0x44df8c){logger[_0x8d2e('0x26')](_0x44df8c[_0x8d2e('0x27')]);if(_0x44df8c[_0x8d2e('0x28')]){delete _0x44df8c[_0x8d2e('0x28')];}_0x1c7675[_0x8d2e('0x1a')](_0x3d36df)[_0x8d2e('0x29')](_0x44df8c);};}exports[_0x8d2e('0x2a')]=function(_0xfe7571,_0x31f821){var _0x276e6f={},_0x517aab={},_0x14d76d={'count':0x0,'rows':[]};var _0x1bd87e=_[_0x8d2e('0x2b')](db[_0x8d2e('0x2c')]['rawAttributes'],function(_0x4e9ce2){return{'name':_0x4e9ce2[_0x8d2e('0x2d')],'type':_0x4e9ce2[_0x8d2e('0x2e')]['key']};});_0x517aab[_0x8d2e('0x2f')]=_['map'](_0x1bd87e,_0x8d2e('0x28'));_0x517aab[_0x8d2e('0x30')]=_['keys'](_0xfe7571['query']);_0x517aab[_0x8d2e('0x31')]=_['intersection'](_0x517aab[_0x8d2e('0x2f')],_0x517aab['query']);_0x276e6f[_0x8d2e('0x32')]=_['intersection'](_0x517aab[_0x8d2e('0x2f')],qs[_0x8d2e('0x33')](_0xfe7571[_0x8d2e('0x30')][_0x8d2e('0x33')]));_0x276e6f[_0x8d2e('0x32')]=_0x276e6f[_0x8d2e('0x32')]['length']?_0x276e6f[_0x8d2e('0x32')]:_0x517aab[_0x8d2e('0x2f')];if(!_0xfe7571[_0x8d2e('0x30')][_0x8d2e('0x34')](_0x8d2e('0x35'))){_0x276e6f[_0x8d2e('0x1e')]=qs['limit'](_0xfe7571['query'][_0x8d2e('0x1e')]);_0x276e6f[_0x8d2e('0x1d')]=qs[_0x8d2e('0x1d')](_0xfe7571[_0x8d2e('0x30')][_0x8d2e('0x1d')]);}_0x276e6f[_0x8d2e('0x36')]=qs[_0x8d2e('0x37')](_0xfe7571['query'][_0x8d2e('0x37')]);_0x276e6f[_0x8d2e('0x38')]=qs[_0x8d2e('0x31')](_[_0x8d2e('0x39')](_0xfe7571[_0x8d2e('0x30')],_0x517aab[_0x8d2e('0x31')]));if(_0xfe7571['query'][_0x8d2e('0x3a')]){_0x276e6f[_0x8d2e('0x38')]=_[_0x8d2e('0x3b')](_0x276e6f[_0x8d2e('0x38')],{'$or':_[_0x8d2e('0x2b')](_0x1bd87e,function(_0x42c984){if(_0x42c984[_0x8d2e('0x2e')]!=='VIRTUAL'){var _0x4dc5d5={};_0x4dc5d5[_0x42c984[_0x8d2e('0x28')]]={'$like':'%'+_0xfe7571[_0x8d2e('0x30')][_0x8d2e('0x3a')]+'%'};return _0x4dc5d5;}})});}_0x276e6f=_[_0x8d2e('0x3b')]({},_0x276e6f,_0xfe7571[_0x8d2e('0x3c')]);var _0x52f72c={'where':_0x276e6f['where']};return db['CmHopperHistory'][_0x8d2e('0x1c')](_0x52f72c)[_0x8d2e('0x24')](function(_0x4ea0f1){_0x14d76d[_0x8d2e('0x1c')]=_0x4ea0f1;if(_0xfe7571[_0x8d2e('0x30')]['includeAll']){_0x276e6f[_0x8d2e('0x3d')]=[{'all':!![]}];}return db[_0x8d2e('0x2c')][_0x8d2e('0x3e')](_0x276e6f);})[_0x8d2e('0x24')](function(_0x768e92){_0x14d76d[_0x8d2e('0x3f')]=_0x768e92;return _0x14d76d;})[_0x8d2e('0x24')](respondWithFilteredResult(_0x31f821,_0x276e6f))[_0x8d2e('0x40')](handleError(_0x31f821,null));};exports[_0x8d2e('0x41')]=function(_0x94262,_0x2b5c4d){var _0x2c3aab={'raw':!![],'where':{'id':_0x94262['params']['id']}},_0x1e3391={};_0x1e3391[_0x8d2e('0x2f')]=_[_0x8d2e('0x42')](db[_0x8d2e('0x2c')]['rawAttributes']);_0x1e3391['query']=_[_0x8d2e('0x42')](_0x94262['query']);_0x1e3391['filters']=_[_0x8d2e('0x43')](_0x1e3391['model'],_0x1e3391[_0x8d2e('0x30')]);_0x2c3aab[_0x8d2e('0x32')]=_[_0x8d2e('0x43')](_0x1e3391[_0x8d2e('0x2f')],qs[_0x8d2e('0x33')](_0x94262[_0x8d2e('0x30')][_0x8d2e('0x33')]));_0x2c3aab[_0x8d2e('0x32')]=_0x2c3aab[_0x8d2e('0x32')][_0x8d2e('0x44')]?_0x2c3aab[_0x8d2e('0x32')]:_0x1e3391[_0x8d2e('0x2f')];if(_0x94262[_0x8d2e('0x30')][_0x8d2e('0x45')]){_0x2c3aab[_0x8d2e('0x3d')]=[{'all':!![]}];}_0x2c3aab=_[_0x8d2e('0x3b')]({},_0x2c3aab,_0x94262['options']);return db[_0x8d2e('0x2c')][_0x8d2e('0x46')](_0x2c3aab)[_0x8d2e('0x24')](handleEntityNotFound(_0x2b5c4d,null))[_0x8d2e('0x24')](respondWithResult(_0x2b5c4d,null))[_0x8d2e('0x40')](handleError(_0x2b5c4d,null));};exports[_0x8d2e('0x47')]=function(_0x24ee15,_0x335fe3){return db[_0x8d2e('0x2c')][_0x8d2e('0x47')](_0x24ee15['body'],{})[_0x8d2e('0x24')](respondWithResult(_0x335fe3,0xc9))[_0x8d2e('0x40')](handleError(_0x335fe3,null));};exports[_0x8d2e('0x48')]=function(_0xe6ccd2,_0x3c8099){return db[_0x8d2e('0x2c')]['describe']()[_0x8d2e('0x24')](respondWithResult(_0x3c8099,null))[_0x8d2e('0x40')](handleError(_0x3c8099,null));};exports['update']=function(_0x4e32c8,_0x3bb8df){if(_0x4e32c8[_0x8d2e('0x49')][_0x8d2e('0x4a')]){delete _0x4e32c8[_0x8d2e('0x49')][_0x8d2e('0x4a')];}return db[_0x8d2e('0x2c')][_0x8d2e('0x46')]({'where':{'uniqueid':_0x4e32c8['params']['id']}})[_0x8d2e('0x24')](handleEntityNotFound(_0x3bb8df,null))['then'](saveUpdates(_0x4e32c8['body'],null))['then'](respondWithResult(_0x3bb8df,null))[_0x8d2e('0x40')](handleError(_0x3bb8df,null));}; \ No newline at end of file +var _0x1e33=['fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','describe','uniqueid','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','stack','name','index','CmHopperHistory','rawAttributes'];(function(_0x45d1fd,_0x463212){var _0xd0e542=function(_0x23ebc9){while(--_0x23ebc9){_0x45d1fd['push'](_0x45d1fd['shift']());}};_0xd0e542(++_0x463212);}(_0x1e33,0x1e4));var _0x31e3=function(_0x3dd247,_0xad3ad0){_0x3dd247=_0x3dd247-0x0;var _0x38bbd7=_0x1e33[_0x3dd247];return _0x38bbd7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x31e3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x31e3('0x1'));var jsonpatch=require(_0x31e3('0x2'));var rp=require(_0x31e3('0x3'));var moment=require(_0x31e3('0x4'));var BPromise=require(_0x31e3('0x5'));var Mustache=require(_0x31e3('0x6'));var util=require(_0x31e3('0x7'));var path=require(_0x31e3('0x8'));var sox=require(_0x31e3('0x9'));var csv=require(_0x31e3('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x31e3('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x31e3('0xc'));var toCsv=require(_0x31e3('0xa'));var querystring=require('querystring');var Papa=require(_0x31e3('0xd'));var Redis=require(_0x31e3('0xe'));var authService=require(_0x31e3('0xf'));var qs=require(_0x31e3('0x10'));var as=require(_0x31e3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x31e3('0x12'))(_0x31e3('0x13'));var utils=require('../../config/utils');var config=require(_0x31e3('0x14'));var db=require(_0x31e3('0x15'))['db'];function respondWithStatusCode(_0x482943,_0x4c21d7){_0x4c21d7=_0x4c21d7||0xcc;return function(_0x505b5a){if(_0x505b5a){return _0x482943['sendStatus'](_0x4c21d7);}return _0x482943[_0x31e3('0x16')](_0x4c21d7)[_0x31e3('0x17')]();};}function respondWithResult(_0x4a1ba8,_0x2e0337){_0x2e0337=_0x2e0337||0xc8;return function(_0x167c08){if(_0x167c08){return _0x4a1ba8['status'](_0x2e0337)[_0x31e3('0x18')](_0x167c08);}};}function respondWithFilteredResult(_0x48815d,_0x566bc8){return function(_0x2b676f){if(_0x2b676f){var _0x2eb17b=_0x2b676f[_0x31e3('0x19')],_0x3a9c70=_0x566bc8['offset'],_0x43f26e=_0x566bc8[_0x31e3('0x1a')]+_0x566bc8[_0x31e3('0x1b')],_0x5c09f8;if(_0x43f26e>=_0x2eb17b){_0x43f26e=_0x2eb17b;_0x5c09f8=0xc8;}else{_0x5c09f8=0xce;}_0x48815d[_0x31e3('0x16')](_0x5c09f8);return _0x48815d[_0x31e3('0x1c')](_0x31e3('0x1d'),_0x3a9c70+'-'+_0x43f26e+'/'+_0x2eb17b)[_0x31e3('0x18')](_0x2b676f);}return null;};}function patchUpdates(_0x5a467c){return function(_0x31b40a){try{jsonpatch['apply'](_0x31b40a,_0x5a467c,!![]);}catch(_0x102d80){return BPromise[_0x31e3('0x1e')](_0x102d80);}return _0x31b40a['save']();};}function saveUpdates(_0x2aae39,_0x286df5){return function(_0x3b4518){if(_0x3b4518){return _0x3b4518[_0x31e3('0x1f')](_0x2aae39)[_0x31e3('0x20')](function(_0x5dbd5c){return _0x5dbd5c;});}return null;};}function removeEntity(_0x14dce7,_0x59b382){return function(_0x262b5d){if(_0x262b5d){return _0x262b5d[_0x31e3('0x21')]()[_0x31e3('0x20')](function(){_0x14dce7[_0x31e3('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39a5e3,_0x469947){return function(_0x34f326){if(!_0x34f326){_0x39a5e3[_0x31e3('0x22')](0x194);}return _0x34f326;};}function handleError(_0x5b6e82,_0x3102ca){_0x3102ca=_0x3102ca||0x1f4;return function(_0x1bcef9){logger[_0x31e3('0x23')](_0x1bcef9[_0x31e3('0x24')]);if(_0x1bcef9[_0x31e3('0x25')]){delete _0x1bcef9[_0x31e3('0x25')];}_0x5b6e82[_0x31e3('0x16')](_0x3102ca)['send'](_0x1bcef9);};}exports[_0x31e3('0x26')]=function(_0x10fd3a,_0x4c4edb){var _0x3ba10f={},_0x2a9040={},_0x31cfdb={'count':0x0,'rows':[]};var _0x5c9bcd=_['map'](db[_0x31e3('0x27')][_0x31e3('0x28')],function(_0x5aaa2b){return{'name':_0x5aaa2b[_0x31e3('0x29')],'type':_0x5aaa2b[_0x31e3('0x2a')][_0x31e3('0x2b')]};});_0x2a9040['model']=_['map'](_0x5c9bcd,_0x31e3('0x25'));_0x2a9040[_0x31e3('0x2c')]=_[_0x31e3('0x2d')](_0x10fd3a['query']);_0x2a9040[_0x31e3('0x2e')]=_[_0x31e3('0x2f')](_0x2a9040[_0x31e3('0x30')],_0x2a9040[_0x31e3('0x2c')]);_0x3ba10f[_0x31e3('0x31')]=_[_0x31e3('0x2f')](_0x2a9040['model'],qs['fields'](_0x10fd3a['query'][_0x31e3('0x32')]));_0x3ba10f[_0x31e3('0x31')]=_0x3ba10f['attributes'][_0x31e3('0x33')]?_0x3ba10f['attributes']:_0x2a9040[_0x31e3('0x30')];if(!_0x10fd3a[_0x31e3('0x2c')][_0x31e3('0x34')](_0x31e3('0x35'))){_0x3ba10f[_0x31e3('0x1b')]=qs[_0x31e3('0x1b')](_0x10fd3a[_0x31e3('0x2c')]['limit']);_0x3ba10f[_0x31e3('0x1a')]=qs[_0x31e3('0x1a')](_0x10fd3a[_0x31e3('0x2c')][_0x31e3('0x1a')]);}_0x3ba10f[_0x31e3('0x36')]=qs[_0x31e3('0x37')](_0x10fd3a['query']['sort']);_0x3ba10f[_0x31e3('0x38')]=qs[_0x31e3('0x2e')](_[_0x31e3('0x39')](_0x10fd3a[_0x31e3('0x2c')],_0x2a9040[_0x31e3('0x2e')]));if(_0x10fd3a['query'][_0x31e3('0x3a')]){_0x3ba10f[_0x31e3('0x38')]=_[_0x31e3('0x3b')](_0x3ba10f[_0x31e3('0x38')],{'$or':_[_0x31e3('0x3c')](_0x5c9bcd,function(_0x3896ea){if(_0x3896ea['type']!==_0x31e3('0x3d')){var _0x37e471={};_0x37e471[_0x3896ea[_0x31e3('0x25')]]={'$like':'%'+_0x10fd3a['query'][_0x31e3('0x3a')]+'%'};return _0x37e471;}})});}_0x3ba10f=_[_0x31e3('0x3b')]({},_0x3ba10f,_0x10fd3a[_0x31e3('0x3e')]);var _0x5e539b={'where':_0x3ba10f[_0x31e3('0x38')]};return db[_0x31e3('0x27')][_0x31e3('0x19')](_0x5e539b)['then'](function(_0x231ab1){_0x31cfdb[_0x31e3('0x19')]=_0x231ab1;if(_0x10fd3a['query'][_0x31e3('0x3f')]){_0x3ba10f[_0x31e3('0x40')]=[{'all':!![]}];}return db[_0x31e3('0x27')][_0x31e3('0x41')](_0x3ba10f);})['then'](function(_0x573c1f){_0x31cfdb[_0x31e3('0x42')]=_0x573c1f;return _0x31cfdb;})[_0x31e3('0x20')](respondWithFilteredResult(_0x4c4edb,_0x3ba10f))[_0x31e3('0x43')](handleError(_0x4c4edb,null));};exports[_0x31e3('0x44')]=function(_0x181daa,_0x2a003d){var _0x4c4de2={'raw':!![],'where':{'id':_0x181daa['params']['id']}},_0x4557fa={};_0x4557fa['model']=_[_0x31e3('0x2d')](db[_0x31e3('0x27')][_0x31e3('0x28')]);_0x4557fa['query']=_[_0x31e3('0x2d')](_0x181daa[_0x31e3('0x2c')]);_0x4557fa['filters']=_[_0x31e3('0x2f')](_0x4557fa[_0x31e3('0x30')],_0x4557fa[_0x31e3('0x2c')]);_0x4c4de2[_0x31e3('0x31')]=_[_0x31e3('0x2f')](_0x4557fa[_0x31e3('0x30')],qs[_0x31e3('0x32')](_0x181daa[_0x31e3('0x2c')][_0x31e3('0x32')]));_0x4c4de2[_0x31e3('0x31')]=_0x4c4de2[_0x31e3('0x31')][_0x31e3('0x33')]?_0x4c4de2[_0x31e3('0x31')]:_0x4557fa[_0x31e3('0x30')];if(_0x181daa[_0x31e3('0x2c')][_0x31e3('0x3f')]){_0x4c4de2[_0x31e3('0x40')]=[{'all':!![]}];}_0x4c4de2=_[_0x31e3('0x3b')]({},_0x4c4de2,_0x181daa[_0x31e3('0x3e')]);return db[_0x31e3('0x27')][_0x31e3('0x45')](_0x4c4de2)[_0x31e3('0x20')](handleEntityNotFound(_0x2a003d,null))[_0x31e3('0x20')](respondWithResult(_0x2a003d,null))[_0x31e3('0x43')](handleError(_0x2a003d,null));};exports[_0x31e3('0x46')]=function(_0x92b8d,_0x209b3f){return db[_0x31e3('0x27')][_0x31e3('0x46')](_0x92b8d[_0x31e3('0x47')],{})[_0x31e3('0x20')](respondWithResult(_0x209b3f,0xc9))[_0x31e3('0x43')](handleError(_0x209b3f,null));};exports[_0x31e3('0x48')]=function(_0xca8990,_0x4ab3ca){return db[_0x31e3('0x27')]['describe']()[_0x31e3('0x20')](respondWithResult(_0x4ab3ca,null))[_0x31e3('0x43')](handleError(_0x4ab3ca,null));};exports['update']=function(_0x54a652,_0x412ff0){if(_0x54a652[_0x31e3('0x47')]['uniqueid']){delete _0x54a652[_0x31e3('0x47')][_0x31e3('0x49')];}return db['CmHopperHistory'][_0x31e3('0x45')]({'where':{'uniqueid':_0x54a652[_0x31e3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x412ff0,null))[_0x31e3('0x20')](saveUpdates(_0x54a652['body'],null))[_0x31e3('0x20')](respondWithResult(_0x412ff0,null))['catch'](handleError(_0x412ff0,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index c2c9fa1..7109d66 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 _0xe216=['util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','define','CmHopperHistory','endtime','uniqueid','lodash'];(function(_0x27d851,_0x5d122d){var _0x494d13=function(_0x2ba78e){while(--_0x2ba78e){_0x27d851['push'](_0x27d851['shift']());}};_0x494d13(++_0x5d122d);}(_0xe216,0x77));var _0x6e21=function(_0x3da612,_0x332456){_0x3da612=_0x3da612-0x0;var _0x1a9d1d=_0xe216[_0x3da612];return _0x1a9d1d;};'use strict';var _=require(_0x6e21('0x0'));var util=require(_0x6e21('0x1'));var logger=require(_0x6e21('0x2'))(_0x6e21('0x3'));var moment=require('moment');var BPromise=require(_0x6e21('0x4'));var rp=require(_0x6e21('0x5'));var fs=require('fs');var path=require(_0x6e21('0x6'));var rimraf=require('rimraf');var config=require(_0x6e21('0x7'));var attributes=require('./cmHopperHistory.attributes');module['exports']=function(_0x1f7de9,_0x5e9bab){return _0x1f7de9[_0x6e21('0x8')](_0x6e21('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x6e21('0xa'),'fields':['endtime']},{'name':_0x6e21('0xb'),'fields':[_0x6e21('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa5a9=['path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','define','CmHopperHistory','cm_hopper_history','uniqueid','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x10b745,_0x1eaf04){var _0x2d34b9=function(_0x45b22f){while(--_0x45b22f){_0x10b745['push'](_0x10b745['shift']());}};_0x2d34b9(++_0x1eaf04);}(_0xa5a9,0x135));var _0x9a5a=function(_0x2eb15c,_0x21c769){_0x2eb15c=_0x2eb15c-0x0;var _0x523ed4=_0xa5a9[_0x2eb15c];return _0x523ed4;};'use strict';var _=require(_0x9a5a('0x0'));var util=require(_0x9a5a('0x1'));var logger=require(_0x9a5a('0x2'))(_0x9a5a('0x3'));var moment=require(_0x9a5a('0x4'));var BPromise=require('bluebird');var rp=require(_0x9a5a('0x5'));var fs=require('fs');var path=require(_0x9a5a('0x6'));var rimraf=require(_0x9a5a('0x7'));var config=require(_0x9a5a('0x8'));var attributes=require(_0x9a5a('0x9'));module[_0x9a5a('0xa')]=function(_0x252069,_0x44c30){return _0x252069[_0x9a5a('0xb')](_0x9a5a('0xc'),attributes,{'tableName':_0x9a5a('0xd'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x9a5a('0xe'),'fields':[_0x9a5a('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 5c96d42..79a5800 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 _0x3c81=['debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateCmHopperHistory','CmHopperHistory','create','body','options','raw','catch','findAll','sequelize','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','COUNT','`state`\x20=\x2010,\x201,\x20null','`state`\x20=\x2011,\x201,\x20null','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','where','campaign','name','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','GetCampaignHopperHistory','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','util','bluebird','randomstring','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent'];(function(_0x594dc7,_0x269225){var _0x2e287d=function(_0x57f96c){while(--_0x57f96c){_0x594dc7['push'](_0x594dc7['shift']());}};_0x2e287d(++_0x269225);}(_0x3c81,0x102));var _0x13c8=function(_0x149e0b,_0x3c25ca){_0x149e0b=_0x149e0b-0x0;var _0x44b7bb=_0x3c81[_0x149e0b];return _0x44b7bb;};'use strict';var _=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var moment=require('moment');var BPromise=require(_0x13c8('0x2'));var rs=require(_0x13c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x13c8('0x4'));var config=require(_0x13c8('0x5'));var jayson=require(_0x13c8('0x6'));var client=jayson[_0x13c8('0x7')][_0x13c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f0bd2,_0x445b69,_0x4f7bcc){return new BPromise(function(_0x17c228,_0x4905c3){return client[_0x13c8('0x9')](_0x3f0bd2,_0x4f7bcc)[_0x13c8('0xa')](function(_0x189ce6){logger[_0x13c8('0xb')](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));logger[_0x13c8('0xe')](_0x13c8('0xf'),_0x445b69,_0x13c8('0xd'),JSON[_0x13c8('0x10')](_0x189ce6));if(_0x189ce6[_0x13c8('0x11')]){if(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x12')]===0x1f4){logger[_0x13c8('0x11')]('CmHopperHistory,\x20%s,\x20%s',_0x445b69,_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);return _0x4905c3(_0x189ce6[_0x13c8('0x11')][_0x13c8('0x13')]);}logger['error'](_0x13c8('0xc'),_0x445b69,_0x189ce6['error']['message']);return _0x17c228(_0x189ce6['error'][_0x13c8('0x13')]);}else{logger['info'](_0x13c8('0xc'),_0x445b69,_0x13c8('0xd'));_0x17c228(_0x189ce6[_0x13c8('0x14')][_0x13c8('0x13')]);}})['catch'](function(_0x13a9e1){logger[_0x13c8('0x11')](_0x13c8('0xc'),_0x445b69,_0x13a9e1);_0x4905c3(_0x13a9e1);});});}exports[_0x13c8('0x15')]=function(_0xce1ad2){var _0x28f07e=this;return new Promise(function(_0x346417,_0x251c38){return db[_0x13c8('0x16')][_0x13c8('0x17')](_0xce1ad2[_0x13c8('0x18')],{'raw':_0xce1ad2['options']?_0xce1ad2[_0x13c8('0x19')][_0x13c8('0x1a')]===undefined?!![]:![]:!![]})[_0x13c8('0xa')](function(_0x313ea3){logger['info'](_0x13c8('0x15'),_0xce1ad2);logger[_0x13c8('0xe')](_0x13c8('0x15'),_0xce1ad2,JSON[_0x13c8('0x10')](_0x313ea3));_0x346417(_0x313ea3);})[_0x13c8('0x1b')](function(_0x2fc123){logger['error'](_0x13c8('0x15'),_0x2fc123[_0x13c8('0x13')],_0xce1ad2);_0x251c38(_0x28f07e[_0x13c8('0x11')](0x1f4,_0x2fc123[_0x13c8('0x13')]));});});};exports['AvgHandleTime']=function(_0x1770e5){var _0x458217=this;return new Promise(function(_0x4e392f,_0x49b552){return db[_0x13c8('0x16')][_0x13c8('0x1c')]({'raw':_0x1770e5['options']?_0x1770e5['options'][_0x13c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x1770e5[_0x13c8('0x19')]?_0x1770e5['options']['where']||null:null,'attributes':[[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize'][_0x13c8('0x1e')]('id')),_0x13c8('0x1f')],[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x22')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x24')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x25')))),'predictiveIntervalDroppedCallsCallersExit'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x26'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x27')))),_0x13c8('0x28')],[db[_0x13c8('0x1d')]['fn']('AVG',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x13c8('0x29')]]})['then'](function(_0x1fdf7d){logger['info'](_0x13c8('0x2a'),_0x1770e5);logger[_0x13c8('0xe')](_0x13c8('0x2a'),_0x1770e5,JSON[_0x13c8('0x10')](_0x1fdf7d));_0x4e392f(_0x1fdf7d);})[_0x13c8('0x1b')](function(_0x42a176){logger[_0x13c8('0x11')]('AvgHandleTime',_0x42a176[_0x13c8('0x13')],_0x1770e5);_0x49b552(_0x458217[_0x13c8('0x11')](0x1f4,_0x42a176['message']));});});};exports[_0x13c8('0x2b')]=function(_0x8ae2e5){var _0x2bfbf4=this;return new Promise(function(_0x479399,_0x4a6225){return db['CmHopperHistory'][_0x13c8('0x1c')]({'raw':_0x8ae2e5[_0x13c8('0x19')]?_0x8ae2e5[_0x13c8('0x19')][_0x13c8('0x1a')]===undefined?!![]:![]:!![],'where':_0x8ae2e5[_0x13c8('0x19')]?_0x8ae2e5[_0x13c8('0x19')][_0x13c8('0x2c')]||null:null,'attributes':[[_0x13c8('0x2d'),_0x13c8('0x2e')],[db['sequelize']['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x2f')))),'outboundNoSuchCallsDay'],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x30')))),_0x13c8('0x31')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x32')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x33')))),_0x13c8('0x34')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x35')))),'outboundCongestionCallsDay'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2010\x20,\x201,\x20null'))),'outboundDropCallsDayTimeout'],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x13c8('0x36')],[db['sequelize']['fn'](_0x13c8('0x23'),db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x37')))),_0x13c8('0x38')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2013,\x201,\x20null'))),_0x13c8('0x39')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')]['literal'](_0x13c8('0x3a')))),_0x13c8('0x3b')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db['sequelize'][_0x13c8('0x20')](_0x13c8('0x3c')))),_0x13c8('0x3d')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x3e')))),_0x13c8('0x3f')],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x40')))),_0x13c8('0x3d')],[db[_0x13c8('0x1d')]['fn']('COUNT',db[_0x13c8('0x1d')]['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),'outboundReCallsDay']],'group':[_0x13c8('0x2d')]})[_0x13c8('0xa')](function(_0x55d353){logger[_0x13c8('0xb')](_0x13c8('0x2b'),_0x8ae2e5);logger['debug'](_0x13c8('0x2b'),_0x8ae2e5,JSON['stringify'](_0x55d353));_0x479399(_0x55d353);})[_0x13c8('0x1b')](function(_0x1f67bd){logger[_0x13c8('0x11')]('GetVoiceQueueHopperHistory',_0x1f67bd[_0x13c8('0x13')],_0x8ae2e5);_0x4a6225(_0x2bfbf4[_0x13c8('0x11')](0x1f4,_0x1f67bd['message']));});});};exports[_0x13c8('0x41')]=function(_0x52b70a){var _0x95289e=this;return new Promise(function(_0x5eda4c,_0x1614f8){return db[_0x13c8('0x16')][_0x13c8('0x1c')]({'raw':_0x52b70a['options']?_0x52b70a[_0x13c8('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x52b70a['options']?_0x52b70a['options']['where']||null:null,'attributes':[['campaign',_0x13c8('0x2e')],[db[_0x13c8('0x1d')]['fn'](_0x13c8('0x23'),db[_0x13c8('0x1d')][_0x13c8('0x1e')]('id')),_0x13c8('0x42')],[db[_0x13c8('0x1d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x13c8('0x1d')][_0x13c8('0x20')](_0x13c8('0x21')))),_0x13c8('0x43')]],'group':[_0x13c8('0x2d')]})[_0x13c8('0xa')](function(_0x4678a0){logger[_0x13c8('0xb')]('GetCampaignHopperHistory',_0x52b70a);logger[_0x13c8('0xe')](_0x13c8('0x41'),_0x52b70a,JSON['stringify'](_0x4678a0));_0x5eda4c(_0x4678a0);})[_0x13c8('0x1b')](function(_0x2ebbcd){logger[_0x13c8('0x11')](_0x13c8('0x41'),_0x2ebbcd[_0x13c8('0x13')],_0x52b70a);_0x1614f8(_0x95289e[_0x13c8('0x11')](0x1f4,_0x2ebbcd[_0x13c8('0x13')]));});});}; \ No newline at end of file +var _0xa571=['CreateCmHopperHistory','CmHopperHistory','create','body','options','AvgHandleTime','findAll','raw','where','sequelize','col','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error','message','catch'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xa571,0x107));var _0x1a57=function(_0x4676cc,_0x5da0a0){_0x4676cc=_0x4676cc-0x0;var _0x19c34f=_0xa571[_0x4676cc];return _0x19c34f;};'use strict';var _=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var moment=require(_0x1a57('0x2'));var BPromise=require(_0x1a57('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1a57('0x4'));var db=require(_0x1a57('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a57('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a57('0x7'));var client=jayson[_0x1a57('0x8')][_0x1a57('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c5352,_0x2492f5,_0x924873){return new BPromise(function(_0x5d9f45,_0x3edb40){return client[_0x1a57('0xa')](_0x3c5352,_0x924873)[_0x1a57('0xb')](function(_0x58e266){logger[_0x1a57('0xc')](_0x1a57('0xd'),_0x2492f5,_0x1a57('0xe'));logger[_0x1a57('0xf')](_0x1a57('0x10'),_0x2492f5,_0x1a57('0xe'),JSON[_0x1a57('0x11')](_0x58e266));if(_0x58e266[_0x1a57('0x12')]){if(_0x58e266['error']['code']===0x1f4){logger[_0x1a57('0x12')](_0x1a57('0xd'),_0x2492f5,_0x58e266[_0x1a57('0x12')]['message']);return _0x3edb40(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}logger['error'](_0x1a57('0xd'),_0x2492f5,_0x58e266['error'][_0x1a57('0x13')]);return _0x5d9f45(_0x58e266[_0x1a57('0x12')][_0x1a57('0x13')]);}else{logger[_0x1a57('0xc')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1a57('0xe'));_0x5d9f45(_0x58e266['result']['message']);}})[_0x1a57('0x14')](function(_0x1c537f){logger[_0x1a57('0x12')]('CmHopperHistory,\x20%s,\x20%s',_0x2492f5,_0x1c537f);_0x3edb40(_0x1c537f);});});}exports[_0x1a57('0x15')]=function(_0x1662a3){var _0x80f8c1=this;return new Promise(function(_0x53bb20,_0x3daa66){return db[_0x1a57('0x16')][_0x1a57('0x17')](_0x1662a3[_0x1a57('0x18')],{'raw':_0x1662a3[_0x1a57('0x19')]?_0x1662a3['options']['raw']===undefined?!![]:![]:!![]})[_0x1a57('0xb')](function(_0x21e811){logger[_0x1a57('0xc')]('CreateCmHopperHistory',_0x1662a3);logger['debug']('CreateCmHopperHistory',_0x1662a3,JSON[_0x1a57('0x11')](_0x21e811));_0x53bb20(_0x21e811);})[_0x1a57('0x14')](function(_0x3f52b9){logger[_0x1a57('0x12')](_0x1a57('0x15'),_0x3f52b9[_0x1a57('0x13')],_0x1662a3);_0x3daa66(_0x80f8c1[_0x1a57('0x12')](0x1f4,_0x3f52b9[_0x1a57('0x13')]));});});};exports[_0x1a57('0x1a')]=function(_0x35d5dc){var _0x29e7cd=this;return new Promise(function(_0x36b17e,_0x26cdd3){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x35d5dc[_0x1a57('0x19')]?_0x35d5dc[_0x1a57('0x19')][_0x1a57('0x1d')]||null:null,'attributes':[[db[_0x1a57('0x1e')]['fn']('COUNT',db['sequelize'][_0x1a57('0x1f')]('id')),_0x1a57('0x20')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x204,\x201,\x20null'))),_0x1a57('0x23')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x24')))),_0x1a57('0x25')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x26')))),_0x1a57('0x27')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x28'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x29')))),_0x1a57('0x2a')],[db['sequelize']['fn']('AVG',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x2b')))),_0x1a57('0x2c')]]})[_0x1a57('0xb')](function(_0xe80d94){logger[_0x1a57('0xc')](_0x1a57('0x1a'),_0x35d5dc);logger[_0x1a57('0xf')](_0x1a57('0x1a'),_0x35d5dc,JSON[_0x1a57('0x11')](_0xe80d94));_0x36b17e(_0xe80d94);})[_0x1a57('0x14')](function(_0x1a6231){logger[_0x1a57('0x12')](_0x1a57('0x1a'),_0x1a6231[_0x1a57('0x13')],_0x35d5dc);_0x26cdd3(_0x29e7cd[_0x1a57('0x12')](0x1f4,_0x1a6231['message']));});});};exports[_0x1a57('0x2d')]=function(_0x173671){var _0x137920=this;return new Promise(function(_0x3dad7c,_0x58b7dc){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x173671[_0x1a57('0x19')]?_0x173671[_0x1a57('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x173671['options']?_0x173671['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),_0x1a57('0x2f')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x30')))),'outboundNoSuchCallsDay'],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x203,\x201,\x20null'))),_0x1a57('0x31')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x32')))),'outboundAnswerCallsDay'],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x33')))),'outboundBusyCallsDay'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x34')))),_0x1a57('0x35')],[db['sequelize']['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize'][_0x1a57('0x22')](_0x1a57('0x36')))),_0x1a57('0x37')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x38')))),_0x1a57('0x39')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2012,\x201,\x20null'))),_0x1a57('0x3a')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3b')))),_0x1a57('0x3c')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3d')))),_0x1a57('0x3e')],[db['sequelize']['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')](_0x1a57('0x3f')))),_0x1a57('0x40')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2016,\x201,\x20null'))),_0x1a57('0x41')],[db[_0x1a57('0x1e')]['fn']('COUNT',db[_0x1a57('0x1e')]['fn']('IF',db[_0x1a57('0x1e')]['literal'](_0x1a57('0x42')))),_0x1a57('0x40')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1a57('0x1e')][_0x1a57('0x22')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x1a57('0x43')]],'group':[_0x1a57('0x2e')]})['then'](function(_0x5e510e){logger['info'](_0x1a57('0x2d'),_0x173671);logger[_0x1a57('0xf')](_0x1a57('0x2d'),_0x173671,JSON[_0x1a57('0x11')](_0x5e510e));_0x3dad7c(_0x5e510e);})[_0x1a57('0x14')](function(_0x33379c){logger[_0x1a57('0x12')](_0x1a57('0x2d'),_0x33379c['message'],_0x173671);_0x58b7dc(_0x137920['error'](0x1f4,_0x33379c['message']));});});};exports['GetCampaignHopperHistory']=function(_0x554208){var _0xd0261c=this;return new Promise(function(_0x13c04d,_0xcba9f0){return db[_0x1a57('0x16')][_0x1a57('0x1b')]({'raw':_0x554208[_0x1a57('0x19')]?_0x554208[_0x1a57('0x19')][_0x1a57('0x1c')]===undefined?!![]:![]:!![],'where':_0x554208['options']?_0x554208['options']['where']||null:null,'attributes':[[_0x1a57('0x2e'),'name'],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db[_0x1a57('0x1e')][_0x1a57('0x1f')]('id')),_0x1a57('0x44')],[db[_0x1a57('0x1e')]['fn'](_0x1a57('0x21'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x1a57('0x32')))),_0x1a57('0x45')]],'group':[_0x1a57('0x2e')]})[_0x1a57('0xb')](function(_0x2db770){logger[_0x1a57('0xc')](_0x1a57('0x46'),_0x554208);logger['debug']('GetCampaignHopperHistory',_0x554208,JSON[_0x1a57('0x11')](_0x2db770));_0x13c04d(_0x2db770);})[_0x1a57('0x14')](function(_0x231154){logger[_0x1a57('0x12')](_0x1a57('0x46'),_0x231154[_0x1a57('0x13')],_0x554208);_0xcba9f0(_0xd0261c['error'](0x1f4,_0x231154['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index 2fce575..fa9009f 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 _0x675f=['describe','/:id','isAuthenticated','create','put','update','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','index','/describe'];(function(_0xfa2693,_0x445d62){var _0x4553fa=function(_0x58fd84){while(--_0x58fd84){_0xfa2693['push'](_0xfa2693['shift']());}};_0x4553fa(++_0x445d62);}(_0x675f,0x149));var _0xf675=function(_0x5a6106,_0x123e70){_0x5a6106=_0x5a6106-0x0;var _0x26d1bc=_0x675f[_0x5a6106];return _0x26d1bc;};'use strict';var multer=require(_0xf675('0x0'));var util=require(_0xf675('0x1'));var path=require(_0xf675('0x2'));var timeout=require(_0xf675('0x3'));var express=require(_0xf675('0x4'));var router=express[_0xf675('0x5')]();var auth=require(_0xf675('0x6'));var interaction=require(_0xf675('0x7'));var config=require(_0xf675('0x8'));var controller=require(_0xf675('0x9'));router[_0xf675('0xa')]('/',auth['isAuthenticated'](),controller[_0xf675('0xb')]);router[_0xf675('0xa')](_0xf675('0xc'),auth['isAuthenticated'](),controller[_0xf675('0xd')]);router[_0xf675('0xa')](_0xf675('0xe'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xf675('0xf')](),controller[_0xf675('0x10')]);router[_0xf675('0x11')](_0xf675('0xe'),auth['isAuthenticated'](),controller[_0xf675('0x12')]);module['exports']=router; \ No newline at end of file +var _0xc0e1=['create','put','/:id','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','/describe','describe','show'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xc0e1,0x147));var _0x1c0e=function(_0x15fc7a,_0xd21741){_0x15fc7a=_0x15fc7a-0x0;var _0x3aa9f4=_0xc0e1[_0x15fc7a];return _0x3aa9f4;};'use strict';var multer=require(_0x1c0e('0x0'));var util=require(_0x1c0e('0x1'));var path=require(_0x1c0e('0x2'));var timeout=require('connect-timeout');var express=require(_0x1c0e('0x3'));var router=express[_0x1c0e('0x4')]();var auth=require(_0x1c0e('0x5'));var interaction=require(_0x1c0e('0x6'));var config=require(_0x1c0e('0x7'));var controller=require(_0x1c0e('0x8'));router[_0x1c0e('0x9')]('/',auth[_0x1c0e('0xa')](),controller[_0x1c0e('0xb')]);router[_0x1c0e('0x9')](_0x1c0e('0xc'),auth[_0x1c0e('0xa')](),controller[_0x1c0e('0xd')]);router[_0x1c0e('0x9')]('/:id',auth[_0x1c0e('0xa')](),controller[_0x1c0e('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0x1c0e('0xf')]);router[_0x1c0e('0x10')](_0x1c0e('0x11'),auth['isAuthenticated'](),controller['update']);module[_0x1c0e('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 3f01d81..94d6a1a 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 _0xef5a=['exports','STRING','name','sequelize'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xef5a,0x127));var _0xaef5=function(_0x41ca33,_0x131bbf){_0x41ca33=_0x41ca33-0x0;var _0x4f205a=_0xef5a[_0x41ca33];return _0x4f205a;};'use strict';var Sequelize=require(_0xaef5('0x0'));module[_0xaef5('0x1')]={'name':{'type':Sequelize[_0xaef5('0x2')],'unique':_0xaef5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xaef5('0x2')]},'dialPrefix':{'type':Sequelize[_0xaef5('0x2')]}}; \ No newline at end of file +var _0x093e=['sequelize','exports','name','STRING'];(function(_0x545f89,_0x34b3e5){var _0x22cfdc=function(_0x13f3ed){while(--_0x13f3ed){_0x545f89['push'](_0x545f89['shift']());}};_0x22cfdc(++_0x34b3e5);}(_0x093e,0x1b4));var _0xe093=function(_0x441e82,_0x77d687){_0x441e82=_0x441e82-0x0;var _0x5efb76=_0x093e[_0x441e82];return _0x5efb76;};'use strict';var Sequelize=require(_0xe093('0x0'));module[_0xe093('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xe093('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe093('0x3')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index 6e1c80d..3084584 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 _0x9c44=['fields','attributes','length','hasOwnProperty','nolimit','limit','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','keys','includeAll','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','update','body','describe','ListId','getDispositions','findOne','order','Disposition','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','push','each','omit','success','dataValues','errors','getContacts','CmCustomField','CustomFields','concat','raw','getContactsCsv','cf_%d','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','sequelize','transaction','Sequelize','type','text','TEXT','number','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','format','getCustomFields','findAndCountAll','addAgents','spread','userCmList:save','emit','userCmList:remove','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','localhost','./cmList.socket','register','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','get','Lists','UserProfileResource','destroy','then','end','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection'];(function(_0x43a45b,_0x1edd3b){var _0x394b2a=function(_0xf53613){while(--_0xf53613){_0x43a45b['push'](_0x43a45b['shift']());}};_0x394b2a(++_0x1edd3b);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'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'];config[_0x49c4('0x14')]=_['defaults'](config[_0x49c4('0x14')],{'host':_0x49c4('0x15'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x49c4('0x14')]));require(_0x49c4('0x16'))[_0x49c4('0x17')](socket);function respondWithStatusCode(_0x2decee,_0x12777c){_0x12777c=_0x12777c||0xcc;return function(_0x18211c){if(_0x18211c){return _0x2decee[_0x49c4('0x18')](_0x12777c);}return _0x2decee[_0x49c4('0x19')](_0x12777c)['end']();};}function respondWithResult(_0x3acd06,_0x141003){_0x141003=_0x141003||0xc8;return function(_0x13a2db){if(_0x13a2db){return _0x3acd06[_0x49c4('0x19')](_0x141003)[_0x49c4('0x1a')](_0x13a2db);}};}function respondWithFilteredResult(_0x53e3a2,_0x44e607){return function(_0x2891f4){if(_0x2891f4){var _0x4c3253=_0x2891f4[_0x49c4('0x1b')],_0x512650=_0x44e607['offset'],_0x3c782d=_0x44e607[_0x49c4('0x1c')]+_0x44e607['limit'],_0x2f82d5;if(_0x3c782d>=_0x4c3253){_0x3c782d=_0x4c3253;_0x2f82d5=0xc8;}else{_0x2f82d5=0xce;}_0x53e3a2[_0x49c4('0x19')](_0x2f82d5);return _0x53e3a2[_0x49c4('0x1d')](_0x49c4('0x1e'),_0x512650+'-'+_0x3c782d+'/'+_0x4c3253)[_0x49c4('0x1a')](_0x2891f4);}return null;};}function patchUpdates(_0x382040){return function(_0x41078c){try{jsonpatch[_0x49c4('0x1f')](_0x41078c,_0x382040,!![]);}catch(_0x46e475){return BPromise[_0x49c4('0x20')](_0x46e475);}return _0x41078c['save']();};}function saveUpdates(_0x527126,_0x57f502){return function(_0x1c99b1){if(_0x1c99b1){return _0x1c99b1['update'](_0x527126)['then'](function(_0x2263ae){return _0x2263ae;});}return null;};}function removeEntity(_0x15581b,_0x26c640){return function(_0xd335e4){if(_0xd335e4){return _0xd335e4['destroy']()['then'](function(){var _0x180276=_0xd335e4[_0x49c4('0x21')]({'plain':!![]});var _0x565423=_0x49c4('0x22');return db[_0x49c4('0x23')][_0x49c4('0x24')]({'where':{'type':_0x565423,'resourceId':_0x180276['id']}})[_0x49c4('0x25')](function(){return _0xd335e4;});})['then'](function(){_0x15581b['status'](0xcc)[_0x49c4('0x26')]();});}};}function handleEntityNotFound(_0x53c199,_0x3800b7){return function(_0x3852b2){if(!_0x3852b2){_0x53c199[_0x49c4('0x18')](0x194);}return _0x3852b2;};}function handleError(_0x372a47,_0x5987ae){_0x5987ae=_0x5987ae||0x1f4;return function(_0x889909){logger[_0x49c4('0x27')](_0x889909[_0x49c4('0x28')]);if(_0x889909[_0x49c4('0x29')]){delete _0x889909[_0x49c4('0x29')];}_0x372a47[_0x49c4('0x19')](_0x5987ae)[_0x49c4('0x2a')](_0x889909);};}exports[_0x49c4('0x2b')]=function(_0x17b50f,_0x2cbd88){var _0x46f7ea={},_0x4ea6ea={},_0x4f4495={'count':0x0,'rows':[]};var _0x59eb84=_[_0x49c4('0x2c')](db[_0x49c4('0x2d')][_0x49c4('0x2e')],function(_0x27e467){return{'name':_0x27e467[_0x49c4('0x2f')],'type':_0x27e467['type'][_0x49c4('0x30')]};});_0x4ea6ea[_0x49c4('0x31')]=_[_0x49c4('0x2c')](_0x59eb84,_0x49c4('0x29'));_0x4ea6ea['query']=_['keys'](_0x17b50f[_0x49c4('0x32')]);_0x4ea6ea[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],_0x4ea6ea[_0x49c4('0x32')]);_0x46f7ea['attributes']=_[_0x49c4('0x34')](_0x4ea6ea[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x17b50f['query']['fields']));_0x46f7ea[_0x49c4('0x36')]=_0x46f7ea[_0x49c4('0x36')][_0x49c4('0x37')]?_0x46f7ea[_0x49c4('0x36')]:_0x4ea6ea[_0x49c4('0x31')];if(!_0x17b50f[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x46f7ea[_0x49c4('0x3a')]=qs['limit'](_0x17b50f[_0x49c4('0x32')]['limit']);_0x46f7ea[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x46f7ea['order']=qs[_0x49c4('0x3b')](_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x46f7ea['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x17b50f[_0x49c4('0x32')],_0x4ea6ea[_0x49c4('0x33')]));if(_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x46f7ea[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x46f7ea[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x59eb84,function(_0x1e506a){if(_0x1e506a['type']!==_0x49c4('0x40')){var _0x20cd21={};_0x20cd21[_0x1e506a[_0x49c4('0x29')]]={'$like':'%'+_0x17b50f[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x20cd21;}})});}_0x46f7ea=_[_0x49c4('0x3f')]({},_0x46f7ea,_0x17b50f[_0x49c4('0x41')]);var _0xc9722b={'where':_0x46f7ea[_0x49c4('0x3e')]};return db[_0x49c4('0x2d')][_0x49c4('0x1b')](_0xc9722b)[_0x49c4('0x25')](function(_0x326142){_0x4f4495['count']=_0x326142;if(_0x17b50f[_0x49c4('0x32')]['includeAll']){_0x46f7ea[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x2d')][_0x49c4('0x43')](_0x46f7ea);})[_0x49c4('0x25')](function(_0x239327){_0x4f4495[_0x49c4('0x44')]=_0x239327;return _0x4f4495;})['then'](respondWithFilteredResult(_0x2cbd88,_0x46f7ea))['catch'](handleError(_0x2cbd88,null));};exports[_0x49c4('0x45')]=function(_0x1e7bdc,_0x38349b){var _0x117151={'raw':![],'where':{'id':_0x1e7bdc[_0x49c4('0x46')]['id']}},_0x490823={};_0x490823[_0x49c4('0x31')]=_[_0x49c4('0x47')](db[_0x49c4('0x2d')][_0x49c4('0x2e')]);_0x490823[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x1e7bdc[_0x49c4('0x32')]);_0x490823[_0x49c4('0x33')]=_['intersection'](_0x490823[_0x49c4('0x31')],_0x490823['query']);_0x117151[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x490823[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1e7bdc[_0x49c4('0x32')]['fields']));_0x117151[_0x49c4('0x36')]=_0x117151[_0x49c4('0x36')][_0x49c4('0x37')]?_0x117151[_0x49c4('0x36')]:_0x490823[_0x49c4('0x31')];if(_0x1e7bdc[_0x49c4('0x32')][_0x49c4('0x48')]){_0x117151['include']=[{'all':!![]}];}_0x117151=_[_0x49c4('0x3f')]({},_0x117151,_0x1e7bdc['options']);return db[_0x49c4('0x2d')][_0x49c4('0x49')](_0x117151)[_0x49c4('0x25')](handleEntityNotFound(_0x38349b,null))[_0x49c4('0x25')](respondWithResult(_0x38349b,null))[_0x49c4('0x4a')](handleError(_0x38349b,null));};exports[_0x49c4('0x4b')]=function(_0x2c6be1,_0x506c71){return db[_0x49c4('0x2d')][_0x49c4('0x4b')](_0x2c6be1['body'],{})[_0x49c4('0x25')](function(_0xaece5f){var _0xfbe179=_0x2c6be1[_0x49c4('0x4c')]['get']({'plain':!![]});if(!_0xfbe179)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xfbe179[_0x49c4('0x4d')]==='user'){var _0x4597c3=_0xaece5f[_0x49c4('0x21')]({'plain':!![]});var _0x3811b2=_0x49c4('0x22');return db[_0x49c4('0x4e')][_0x49c4('0x49')]({'where':{'name':_0x3811b2,'userProfileId':_0xfbe179[_0x49c4('0x4f')]},'raw':!![]})['then'](function(_0x1f26c2){if(_0x1f26c2&&_0x1f26c2[_0x49c4('0x50')]===0x0){return db[_0x49c4('0x23')][_0x49c4('0x4b')]({'name':_0x4597c3[_0x49c4('0x29')],'resourceId':_0x4597c3['id'],'type':_0x1f26c2[_0x49c4('0x29')],'sectionId':_0x1f26c2['id']},{})[_0x49c4('0x25')](function(){return _0xaece5f;});}else{return _0xaece5f;}})[_0x49c4('0x4a')](function(_0x1e0b4f){logger[_0x49c4('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e0b4f);throw _0x1e0b4f;});}return _0xaece5f;})['then'](respondWithResult(_0x506c71,0xc9))[_0x49c4('0x4a')](handleError(_0x506c71,null));};exports[_0x49c4('0x51')]=function(_0x527e74,_0x59a8bc){if(_0x527e74[_0x49c4('0x52')]['id']){delete _0x527e74['body']['id'];}return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x527e74[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x59a8bc,null))[_0x49c4('0x25')](saveUpdates(_0x527e74[_0x49c4('0x52')],null))[_0x49c4('0x25')](respondWithResult(_0x59a8bc,null))[_0x49c4('0x4a')](handleError(_0x59a8bc,null));};exports['destroy']=function(_0x859dde,_0xcc6a2b){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x859dde[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xcc6a2b,null))['then'](removeEntity(_0xcc6a2b,null))['catch'](handleError(_0xcc6a2b,null));};exports[_0x49c4('0x53')]=function(_0x155c43,_0x2a6308){return db[_0x49c4('0x2d')][_0x49c4('0x53')]()[_0x49c4('0x25')](respondWithResult(_0x2a6308,null))[_0x49c4('0x4a')](handleError(_0x2a6308,null));};exports['addDisposition']=function(_0x45d715,_0x33c9a6,_0x4ba4eb){if(_0x45d715[_0x49c4('0x52')]['id']){delete _0x45d715['body']['id'];}return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x45d715[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x33c9a6,null))[_0x49c4('0x25')](function(_0x3e44d7){if(_0x3e44d7){_0x45d715[_0x49c4('0x52')][_0x49c4('0x54')]=_0x3e44d7['id'];return db['Disposition'][_0x49c4('0x4b')](_0x45d715[_0x49c4('0x52')]);}})['then'](respondWithResult(_0x33c9a6,null))[_0x49c4('0x4a')](handleError(_0x33c9a6,null));};exports[_0x49c4('0x55')]=function(_0x4fefbd,_0x39c455,_0x42e0e6){var _0x4f50bf={'raw':![],'where':{}};var _0x4dc54d={};var _0x589484={'count':0x0,'rows':[]};return db['CmList'][_0x49c4('0x56')]({'where':{'id':_0x4fefbd['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x39c455,null))[_0x49c4('0x25')](function(_0x515240){if(_0x515240){_0x4dc54d[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['Disposition'][_0x49c4('0x2e')]);_0x4dc54d[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x4fefbd[_0x49c4('0x32')]);_0x4dc54d['filters']=_[_0x49c4('0x34')](_0x4dc54d[_0x49c4('0x31')],_0x4dc54d[_0x49c4('0x32')]);_0x4f50bf[_0x49c4('0x36')]=_['intersection'](_0x4dc54d[_0x49c4('0x31')],qs['fields'](_0x4fefbd['query']['fields']));_0x4f50bf['attributes']=_0x4f50bf[_0x49c4('0x36')][_0x49c4('0x37')]?_0x4f50bf[_0x49c4('0x36')]:_0x4dc54d[_0x49c4('0x31')];if(!_0x4fefbd['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x4f50bf[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x4f50bf[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x4fefbd[_0x49c4('0x32')]['offset']);}_0x4f50bf[_0x49c4('0x57')]=qs['sort'](_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x4f50bf[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x4fefbd[_0x49c4('0x32')],_0x4dc54d[_0x49c4('0x33')]));_0x4f50bf[_0x49c4('0x3e')][_0x49c4('0x54')]=_0x515240['id'];if(_0x4fefbd[_0x49c4('0x32')][_0x49c4('0x3d')]){_0x4f50bf[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x4f50bf[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x4f50bf[_0x49c4('0x36')],function(_0x371e49){var _0x3485c0={};_0x3485c0[_0x371e49]={'$like':'%'+_0x4fefbd['query']['filter']+'%'};return _0x3485c0;})});}_0x4f50bf=_[_0x49c4('0x3f')]({},_0x4f50bf,_0x4fefbd[_0x49c4('0x41')]);return db['Disposition'][_0x49c4('0x1b')]({'where':_0x4f50bf[_0x49c4('0x3e')]})[_0x49c4('0x25')](function(_0x16e7b1){_0x589484['count']=_0x16e7b1;if(_0x4fefbd['query']['includeAll']){_0x4f50bf[_0x49c4('0x42')]=[{'all':!![]}];}return db[_0x49c4('0x58')][_0x49c4('0x43')](_0x4f50bf);})[_0x49c4('0x25')](function(_0x118fc4){_0x589484[_0x49c4('0x44')]=_0x118fc4;return _0x589484;});}})[_0x49c4('0x25')](respondWithFilteredResult(_0x39c455,_0x4f50bf))[_0x49c4('0x4a')](handleError(_0x39c455,null));};exports[_0x49c4('0x59')]=function(_0x54dea5,_0x363b2e,_0x10fb84){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x54dea5[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x363b2e,null))[_0x49c4('0x25')](function(_0xb6031b){if(_0xb6031b){return _0xb6031b[_0x49c4('0x59')](_0x54dea5[_0x49c4('0x32')][_0x49c4('0x5a')]);}})[_0x49c4('0x25')](respondWithStatusCode(_0x363b2e,null))['catch'](handleError(_0x363b2e,null));};exports[_0x49c4('0x5b')]=function(_0x20e2d5,_0x85540f,_0x18e82b){return db[_0x49c4('0x2d')]['find']({'where':{'id':_0x20e2d5['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x85540f,null))['then'](function(_0x34cf49){if(_0x34cf49){var _0x558880=[];var _0x23516e={'success':[],'errors':[]};return db[_0x49c4('0x5c')][_0x49c4('0x53')]()[_0x49c4('0x25')](function(_0x4eb9f7){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')])){if(_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')][_0x49c4('0x37')]){_0x20e2d5[_0x49c4('0x52')][_0x49c4('0x5d')]=_0x20e2d5['body'][_0x49c4('0x5d')][_0x49c4('0x5f')](';')+';';}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}}else{_0x20e2d5['body'][_0x49c4('0x5d')]=null;}if(_0x20e2d5[_0x49c4('0x52')]&&_[_0x49c4('0x5e')](_0x20e2d5[_0x49c4('0x52')])){for(var _0x2c32c0=0x0;_0x2c32c0<_0x20e2d5['body'][_0x49c4('0x37')];_0x2c32c0+=0x1){_0x20e2d5[_0x49c4('0x52')][_0x2c32c0]['ListId']=_0x20e2d5[_0x49c4('0x46')]['id'];_0x558880[_0x49c4('0x60')](_0x20e2d5['body'][_0x2c32c0]);}return BPromise[_0x49c4('0x61')](_0x558880,function(_0x2cb416){return db['CmContact'][_0x49c4('0x4b')](_[_0x49c4('0x62')](_0x2cb416,[_0x49c4('0x5a'),'id'])||{},{'fields':_[_0x49c4('0x47')](_0x4eb9f7),'raw':!![]})['then'](function(_0x999ae2){_0x23516e[_0x49c4('0x63')]['push'](_0x999ae2[_0x49c4('0x64')]);})['catch'](function(_0x4a4cb7){_0x23516e[_0x49c4('0x65')]['push']({'data':_0x2cb416,'error':_0x4a4cb7['message']});});})[_0x49c4('0x25')](function(_0x131064){return _0x23516e;})['catch'](function(_0x23e684){return _0x23e684;});}else{_0x85540f['status'](0x190)['json']({'message':'Malformed\x20request\x20syntax'});}});}})[_0x49c4('0x25')](respondWithResult(_0x85540f,null))[_0x49c4('0x4a')](handleError(_0x85540f,null));};exports[_0x49c4('0x66')]=function(_0x2bfe15,_0x4a5f0b,_0x5b751a){var _0x348693;return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x2bfe15['params']['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x4a5f0b,null))[_0x49c4('0x25')](function(_0x12d060){if(_0x12d060){_0x348693=_0x12d060;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})['then'](function(_0xbde4b2){if(_0xbde4b2){var _0x1518cb={};var _0x44a188={};_0x44a188[_0x49c4('0x31')]=_[_0x49c4('0x69')](_['keys'](_0xbde4b2),_[_0x49c4('0x2c')](_0x348693[_0x49c4('0x68')],function(_0x3f5a6e){return util['format']('cf_%d',_0x3f5a6e['id']);}));_0x44a188[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x2bfe15[_0x49c4('0x32')]);_0x44a188[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x44a188['model'],_0x44a188[_0x49c4('0x32')]);_0x1518cb[_0x49c4('0x36')]=_[_0x49c4('0x34')](_0x44a188[_0x49c4('0x31')],qs['fields'](_0x2bfe15['query'][_0x49c4('0x35')]));_0x1518cb[_0x49c4('0x36')]=_0x1518cb[_0x49c4('0x36')][_0x49c4('0x37')]?_0x1518cb[_0x49c4('0x36')]:_0x44a188['model'];if(!_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x38')](_0x49c4('0x39'))){_0x1518cb[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x2bfe15[_0x49c4('0x32')]['limit']);_0x1518cb[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x2bfe15[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x1518cb['order']=qs['sort'](_0x2bfe15[_0x49c4('0x32')]['sort']);_0x1518cb[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x2bfe15[_0x49c4('0x32')],_0x44a188[_0x49c4('0x33')]));_0x1518cb[_0x49c4('0x6a')]=!![];if(_0x2bfe15['query']['filter']){_0x1518cb[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x1518cb[_0x49c4('0x3e')],{'$or':_['map'](_0x1518cb['attributes'],function(_0x3e7ab3){var _0x4ce733={};_0x4ce733[_0x3e7ab3]={'$like':'%'+_0x2bfe15['query'][_0x49c4('0x3d')]+'%'};return _0x4ce733;})});}_0x1518cb=_['merge']({},_0x1518cb,_0x2bfe15[_0x49c4('0x41')]);return _0x348693[_0x49c4('0x66')](_0x1518cb);}})['then'](respondWithResult(_0x4a5f0b,null))[_0x49c4('0x4a')](handleError(_0x4a5f0b,null));};exports[_0x49c4('0x6b')]=function(_0x49f060,_0x5428a9,_0xdb9820){var _0x493b9a;return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x49f060[_0x49c4('0x46')]['id']},'include':[{'model':db[_0x49c4('0x67')],'as':_0x49c4('0x68')}]})[_0x49c4('0x25')](handleEntityNotFound(_0x5428a9,null))[_0x49c4('0x25')](function(_0x5f07fa){if(_0x5f07fa){_0x493b9a=_0x5f07fa;return db[_0x49c4('0x5c')][_0x49c4('0x2e')];}})[_0x49c4('0x25')](function(_0xcc42bf){if(_0xcc42bf){var _0x3107c9={};var _0x5795e8={};_0x5795e8[_0x49c4('0x31')]=_['concat'](_[_0x49c4('0x47')](_0xcc42bf),_[_0x49c4('0x2c')](_0x493b9a[_0x49c4('0x68')],function(_0x3d662c){return util['format'](_0x49c4('0x6c'),_0x3d662c['id']);}));_0x5795e8[_0x49c4('0x32')]=_[_0x49c4('0x47')](_0x49f060[_0x49c4('0x32')]);_0x5795e8[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5795e8['model'],_0x5795e8[_0x49c4('0x32')]);_0x3107c9['attributes']=_[_0x49c4('0x34')](_0x5795e8[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x49f060[_0x49c4('0x32')]['fields']));_0x3107c9[_0x49c4('0x36')]=_0x3107c9[_0x49c4('0x36')]['length']?_0x3107c9[_0x49c4('0x36')]:_0x5795e8[_0x49c4('0x31')];if(!_0x49f060['query']['hasOwnProperty'](_0x49c4('0x39'))){_0x3107c9[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x3107c9[_0x49c4('0x1c')]=qs[_0x49c4('0x1c')](_0x49f060[_0x49c4('0x32')][_0x49c4('0x1c')]);}_0x3107c9[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x49f060['query']['sort']);_0x3107c9[_0x49c4('0x3e')]=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x49f060['query'],_0x5795e8[_0x49c4('0x33')]));_0x3107c9[_0x49c4('0x6a')]=!![];if(_0x49f060['query'][_0x49c4('0x3d')]){_0x3107c9['where']=_[_0x49c4('0x3f')](_0x3107c9[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x3107c9[_0x49c4('0x36')],function(_0x572433){var _0x2456a0={};_0x2456a0[_0x572433]={'$like':'%'+_0x49f060[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2456a0;})});}_0x3107c9=_[_0x49c4('0x3f')]({},_0x3107c9,_0x49f060[_0x49c4('0x41')]);return _0x493b9a['getContacts'](_0x3107c9);}})['then'](function(_0x5f4d82){if(!_[_0x49c4('0x6d')](_0x5f4d82)){var _0x10655c=toCsv(_0x5f4d82);var _0x228bbb=Date[_0x49c4('0x6e')]();fs[_0x49c4('0x6f')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb),_0x10655c);_0x5428a9[_0x49c4('0x71')](_0x49c4('0x72'),_0x49c4('0x73')+util['format'](_0x49c4('0x74'),_0x493b9a['id'],_0x228bbb));_0x5428a9[_0x49c4('0x71')](_0x49c4('0x75'),_0x49c4('0x76'));return _0x5428a9[_0x49c4('0x77')](util['format'](_0x49c4('0x70'),_0x493b9a['id'],_0x228bbb));}else{return _0x5428a9[_0x49c4('0x18')](0xcc);}})[_0x49c4('0x4a')](handleError(_0x5428a9,null));};exports['addCustomField']=function(_0x182d2f,_0x11f47f,_0xa1954a){var _0x56341f;delete _0x182d2f[_0x49c4('0x52')]['id'];return db['CmList']['findOne']({'where':{'id':_0x182d2f[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x11f47f,null))['then'](function(_0x815b34){if(_0x815b34){return db[_0x49c4('0x78')][_0x49c4('0x79')](function(_0x1ffc9a){return db[_0x49c4('0x67')][_0x49c4('0x4b')](_0x182d2f[_0x49c4('0x52')],{'transaction':_0x1ffc9a})[_0x49c4('0x25')](function(_0x59dbef){_0x56341f=_0x59dbef;return _0x815b34['addCustomFields'](_0x59dbef,{'transaction':_0x1ffc9a});})[_0x49c4('0x25')](function(){var _0x4c85ab={'type':db[_0x49c4('0x7a')]['TEXT'],'transaction':_0x1ffc9a};switch(_0x182d2f['body'][_0x49c4('0x7b')]){case _0x49c4('0x7c'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7d')];break;case _0x49c4('0x7e'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x7f')];break;case _0x49c4('0x80'):_0x4c85ab[_0x49c4('0x7b')]=db[_0x49c4('0x7a')][_0x49c4('0x81')];_0x4c85ab[_0x49c4('0x82')]=![];break;default:}return db['sequelize'][_0x49c4('0x83')][_0x49c4('0x84')](_0x49c4('0x85'),util[_0x49c4('0x86')]('cf_%s',_0x56341f['id']),_0x4c85ab);})['then'](function(){return _0x56341f;});});}})[_0x49c4('0x25')](respondWithResult(_0x11f47f,null))['catch'](handleError(_0x11f47f,null));};exports[_0x49c4('0x87')]=function(_0x1ac087,_0xd6dc2a,_0xfc5a8f){var _0x2bcc8c={};var _0x45a2ef={};var _0x3238e7;var _0xe9e187;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x1ac087[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0xd6dc2a,null))['then'](function(_0x22fdb9){if(_0x22fdb9){_0x3238e7=_0x22fdb9;_0x45a2ef[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['CmCustomField'][_0x49c4('0x2e')]);_0x45a2ef['query']=_[_0x49c4('0x47')](_0x1ac087[_0x49c4('0x32')]);_0x45a2ef[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x45a2ef['model'],_0x45a2ef[_0x49c4('0x32')]);_0x2bcc8c['attributes']=_['intersection'](_0x45a2ef[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x1ac087[_0x49c4('0x32')]['fields']));_0x2bcc8c['attributes']=_0x2bcc8c[_0x49c4('0x36')][_0x49c4('0x37')]?_0x2bcc8c[_0x49c4('0x36')]:_0x45a2ef[_0x49c4('0x31')];_0x2bcc8c[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x1ac087[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2bcc8c[_0x49c4('0x3e')]=qs['filters'](_[_0x49c4('0x3c')](_0x1ac087[_0x49c4('0x32')],_0x45a2ef['filters']));_0x2bcc8c['where']=_[_0x49c4('0x3f')](_0x2bcc8c['where'],{'$or':[{'ListId':_0x22fdb9['id']},{'ListId':null}]});if(_0x1ac087[_0x49c4('0x32')]['filter']){_0x2bcc8c[_0x49c4('0x3e')]=_['merge'](_0x2bcc8c[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2bcc8c[_0x49c4('0x36')],function(_0x1ab574){var _0x5b1e3d={};_0x5b1e3d[_0x1ab574]={'$like':'%'+_0x1ac087['query'][_0x49c4('0x3d')]+'%'};return _0x5b1e3d;})});}_0x2bcc8c=_[_0x49c4('0x3f')]({},_0x2bcc8c,_0x1ac087[_0x49c4('0x41')]);return db['CmCustomField'][_0x49c4('0x88')](_0x2bcc8c);}})[_0x49c4('0x25')](respondWithResult(_0xd6dc2a,null))['catch'](handleError(_0xd6dc2a,null));};exports['addAgents']=function(_0x43ca05,_0x269170,_0xa0698d){return db['CmList'][_0x49c4('0x49')]({'where':{'id':_0x43ca05[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x269170,null))[_0x49c4('0x25')](function(_0x5a0045){if(_0x5a0045){return _0x5a0045[_0x49c4('0x89')](_0x43ca05['body']['ids'],_[_0x49c4('0x62')](_0x43ca05[_0x49c4('0x52')],[_0x49c4('0x5a'),'id'])||{})[_0x49c4('0x8a')](function(_0x5adb90){for(var _0x32b6e4=0x0;_0x32b6e4<_0x43ca05[_0x49c4('0x52')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x32b6e4+=0x1){socket['emit'](_0x49c4('0x8b'),{'UserId':_0x43ca05['body']['ids'][_0x32b6e4],'CmListId':_0x43ca05[_0x49c4('0x46')]['id']});}return _0x5adb90;});}})[_0x49c4('0x25')](respondWithResult(_0x269170,null))[_0x49c4('0x4a')](handleError(_0x269170,null));};exports['removeAgents']=function(_0x336853,_0x4a874a,_0x30b616){return db[_0x49c4('0x2d')][_0x49c4('0x49')]({'where':{'id':_0x336853[_0x49c4('0x46')]['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x4a874a,null))[_0x49c4('0x25')](function(_0x2b31ac){if(_0x2b31ac){return _0x2b31ac['removeAgents'](_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')])[_0x49c4('0x25')](function(){if(_[_0x49c4('0x5e')](_0x336853['query']['ids'])){for(var _0x4c15ff=0x0;_0x4c15ff<_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x49c4('0x37')];_0x4c15ff+=0x1){socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853[_0x49c4('0x32')][_0x49c4('0x5a')][_0x4c15ff]),'CmListId':Number(_0x336853['params']['id'])});}}else{socket[_0x49c4('0x8c')](_0x49c4('0x8d'),{'UserId':Number(_0x336853['query']['ids']),'CmListId':Number(_0x336853['params']['id'])});}});}})[_0x49c4('0x25')](respondWithStatusCode(_0x4a874a,null))[_0x49c4('0x4a')](handleError(_0x4a874a,null));};exports[_0x49c4('0x8e')]=function(_0x3d0013,_0x1069b9,_0x1480d3){var _0x2f36c6={};var _0x5039fc={};var _0x83440b;var _0x3226c4;return db[_0x49c4('0x2d')][_0x49c4('0x56')]({'where':{'id':_0x3d0013['params']['id']}})[_0x49c4('0x25')](handleEntityNotFound(_0x1069b9,null))[_0x49c4('0x25')](function(_0x227c94){if(_0x227c94){_0x83440b=_0x227c94;_0x5039fc[_0x49c4('0x31')]=_[_0x49c4('0x47')](db['User'][_0x49c4('0x2e')]);_0x5039fc['query']=_['keys'](_0x3d0013[_0x49c4('0x32')]);_0x5039fc[_0x49c4('0x33')]=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],_0x5039fc[_0x49c4('0x32')]);_0x2f36c6['attributes']=_[_0x49c4('0x34')](_0x5039fc[_0x49c4('0x31')],qs[_0x49c4('0x35')](_0x3d0013['query'][_0x49c4('0x35')]));_0x2f36c6[_0x49c4('0x36')]=_0x2f36c6['attributes'][_0x49c4('0x37')]?_0x2f36c6[_0x49c4('0x36')]:_0x5039fc[_0x49c4('0x31')];_0x2f36c6[_0x49c4('0x57')]=qs[_0x49c4('0x3b')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3b')]);_0x2f36c6['where']=qs[_0x49c4('0x33')](_[_0x49c4('0x3c')](_0x3d0013[_0x49c4('0x32')],_0x5039fc[_0x49c4('0x33')]));if(_0x3d0013[_0x49c4('0x32')]['filter']){_0x2f36c6[_0x49c4('0x3e')]=_[_0x49c4('0x3f')](_0x2f36c6[_0x49c4('0x3e')],{'$or':_[_0x49c4('0x2c')](_0x2f36c6[_0x49c4('0x36')],function(_0x50423b){var _0x2582e3={};_0x2582e3[_0x50423b]={'$like':'%'+_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3d')]+'%'};return _0x2582e3;})});}_0x2f36c6=_[_0x49c4('0x3f')]({},_0x2f36c6,_0x3d0013[_0x49c4('0x41')]);return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0x2a25dc){if(_0x2a25dc){_0x3226c4=_0x2a25dc[_0x49c4('0x37')];if(!_0x3d0013[_0x49c4('0x32')]['hasOwnProperty'](_0x49c4('0x39'))){_0x2f36c6[_0x49c4('0x3a')]=qs[_0x49c4('0x3a')](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x3a')]);_0x2f36c6['offset']=qs['offset'](_0x3d0013[_0x49c4('0x32')][_0x49c4('0x1c')]);}return _0x83440b[_0x49c4('0x8e')](_0x2f36c6);}})[_0x49c4('0x25')](function(_0xd87f7e){if(_0xd87f7e){return _0xd87f7e?{'count':_0x3226c4,'rows':_0xd87f7e}:null;}})[_0x49c4('0x25')](respondWithResult(_0x1069b9,null))['catch'](handleError(_0x1069b9,null));}; \ No newline at end of file +var _0xcb91=['bluebird','mustache','path','sox','ejs','lodash','crypto','jsforce','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','socket.io-emitter','./cmList.socket','register','sendStatus','status','end','json','count','offset','limit','set','apply','update','then','get','Lists','destroy','error','name','index','map','CmList','rawAttributes','fieldName','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','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','catch','describe','addDisposition','ListId','Disposition','getDispositions','sort','includeAll','rows','removeDispositions','CmContact','tags','isArray','join','each','omit','ids','success','dataValues','errors','push','message','Malformed\x20request\x20syntax','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContacts','getContactsCsv','isEmpty','now','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','text/csv','download','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT','number','INTEGER','switch','BOOLEAN','queryInterface','addColumn','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x2967c1,_0x202a72){var _0x103397=function(_0x14b5cc){while(--_0x14b5cc){_0x2967c1['push'](_0x2967c1['shift']());}};_0x103397(++_0x202a72);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x323d87,_0x4ef3f9){_0x323d87=_0x323d87-0x0;var _0x5e8f74=_0xcb91[_0x323d87];return _0x5e8f74;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x1cb9('0x0'));var zipdir=require(_0x1cb9('0x1'));var jsonpatch=require(_0x1cb9('0x2'));var rp=require(_0x1cb9('0x3'));var moment=require('moment');var BPromise=require(_0x1cb9('0x4'));var Mustache=require(_0x1cb9('0x5'));var util=require('util');var path=require(_0x1cb9('0x6'));var sox=require(_0x1cb9('0x7'));var csv=require('to-csv');var ejs=require(_0x1cb9('0x8'));var fs=require('fs');var _=require(_0x1cb9('0x9'));var squel=require('squel');var crypto=require(_0x1cb9('0xa'));var jsforce=require(_0x1cb9('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1cb9('0xc'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1cb9('0xd'));var authService=require(_0x1cb9('0xe'));var qs=require(_0x1cb9('0xf'));var as=require(_0x1cb9('0x10'));var hardwareService=require(_0x1cb9('0x11'));var logger=require('../../config/logger')(_0x1cb9('0x12'));var utils=require(_0x1cb9('0x13'));var config=require(_0x1cb9('0x14'));var db=require(_0x1cb9('0x15'))['db'];config[_0x1cb9('0x16')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x1cb9('0x17'))(new Redis(config[_0x1cb9('0x16')]));require(_0x1cb9('0x18'))[_0x1cb9('0x19')](socket);function respondWithStatusCode(_0x56884d,_0x397727){_0x397727=_0x397727||0xcc;return function(_0x6ef389){if(_0x6ef389){return _0x56884d[_0x1cb9('0x1a')](_0x397727);}return _0x56884d[_0x1cb9('0x1b')](_0x397727)[_0x1cb9('0x1c')]();};}function respondWithResult(_0x5806d8,_0x5572cb){_0x5572cb=_0x5572cb||0xc8;return function(_0xd446a3){if(_0xd446a3){return _0x5806d8[_0x1cb9('0x1b')](_0x5572cb)[_0x1cb9('0x1d')](_0xd446a3);}};}function respondWithFilteredResult(_0x3f1376,_0x3e21e0){return function(_0xf22920){if(_0xf22920){var _0x23d3a9=_0xf22920[_0x1cb9('0x1e')],_0x4e1340=_0x3e21e0[_0x1cb9('0x1f')],_0x479d43=_0x3e21e0[_0x1cb9('0x1f')]+_0x3e21e0[_0x1cb9('0x20')],_0x1b2fa6;if(_0x479d43>=_0x23d3a9){_0x479d43=_0x23d3a9;_0x1b2fa6=0xc8;}else{_0x1b2fa6=0xce;}_0x3f1376[_0x1cb9('0x1b')](_0x1b2fa6);return _0x3f1376[_0x1cb9('0x21')]('Content-Range',_0x4e1340+'-'+_0x479d43+'/'+_0x23d3a9)['json'](_0xf22920);}return null;};}function patchUpdates(_0x1a5a72){return function(_0x5dbfae){try{jsonpatch[_0x1cb9('0x22')](_0x5dbfae,_0x1a5a72,!![]);}catch(_0x2265ea){return BPromise['reject'](_0x2265ea);}return _0x5dbfae['save']();};}function saveUpdates(_0x2e3854,_0x325637){return function(_0x103a63){if(_0x103a63){return _0x103a63[_0x1cb9('0x23')](_0x2e3854)[_0x1cb9('0x24')](function(_0x27db16){return _0x27db16;});}return null;};}function removeEntity(_0x59ebea,_0x55b232){return function(_0x6c6f61){if(_0x6c6f61){return _0x6c6f61['destroy']()[_0x1cb9('0x24')](function(){var _0x2b1275=_0x6c6f61[_0x1cb9('0x25')]({'plain':!![]});var _0x44d3c4=_0x1cb9('0x26');return db['UserProfileResource'][_0x1cb9('0x27')]({'where':{'type':_0x44d3c4,'resourceId':_0x2b1275['id']}})[_0x1cb9('0x24')](function(){return _0x6c6f61;});})['then'](function(){_0x59ebea[_0x1cb9('0x1b')](0xcc)[_0x1cb9('0x1c')]();});}};}function handleEntityNotFound(_0x41a9a0,_0x1804fd){return function(_0x406821){if(!_0x406821){_0x41a9a0[_0x1cb9('0x1a')](0x194);}return _0x406821;};}function handleError(_0x2e28fe,_0xb644b3){_0xb644b3=_0xb644b3||0x1f4;return function(_0x41e5c2){logger[_0x1cb9('0x28')](_0x41e5c2['stack']);if(_0x41e5c2[_0x1cb9('0x29')]){delete _0x41e5c2['name'];}_0x2e28fe[_0x1cb9('0x1b')](_0xb644b3)['send'](_0x41e5c2);};}exports[_0x1cb9('0x2a')]=function(_0x41011c,_0x3cd7f5){var _0x2038aa={},_0x561d89={},_0x1c701f={'count':0x0,'rows':[]};var _0x4eba82=_[_0x1cb9('0x2b')](db[_0x1cb9('0x2c')][_0x1cb9('0x2d')],function(_0x5d8793){return{'name':_0x5d8793[_0x1cb9('0x2e')],'type':_0x5d8793['type'][_0x1cb9('0x2f')]};});_0x561d89['model']=_[_0x1cb9('0x2b')](_0x4eba82,_0x1cb9('0x29'));_0x561d89[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x41011c['query']);_0x561d89[_0x1cb9('0x32')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],_0x561d89[_0x1cb9('0x30')]);_0x2038aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x561d89[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x2038aa[_0x1cb9('0x35')]=_0x2038aa[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x2038aa['attributes']:_0x561d89['model'];if(!_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x2038aa[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x2038aa[_0x1cb9('0x1f')]=qs['offset'](_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x2038aa[_0x1cb9('0x3a')]=qs['sort'](_0x41011c[_0x1cb9('0x30')]['sort']);_0x2038aa[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x41011c[_0x1cb9('0x30')],_0x561d89[_0x1cb9('0x32')]));if(_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x2038aa[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x2038aa['where'],{'$or':_['map'](_0x4eba82,function(_0x4111b8){if(_0x4111b8[_0x1cb9('0x3f')]!==_0x1cb9('0x40')){var _0x16ad1c={};_0x16ad1c[_0x4111b8[_0x1cb9('0x29')]]={'$like':'%'+_0x41011c[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x16ad1c;}})});}_0x2038aa=_['merge']({},_0x2038aa,_0x41011c[_0x1cb9('0x41')]);var _0x47edad={'where':_0x2038aa['where']};return db['CmList'][_0x1cb9('0x1e')](_0x47edad)[_0x1cb9('0x24')](function(_0x1bf51c){_0x1c701f[_0x1cb9('0x1e')]=_0x1bf51c;if(_0x41011c[_0x1cb9('0x30')]['includeAll']){_0x2038aa[_0x1cb9('0x42')]=[{'all':!![]}];}return db['CmList'][_0x1cb9('0x43')](_0x2038aa);})[_0x1cb9('0x24')](function(_0x38d973){_0x1c701f['rows']=_0x38d973;return _0x1c701f;})[_0x1cb9('0x24')](respondWithFilteredResult(_0x3cd7f5,_0x2038aa))['catch'](handleError(_0x3cd7f5,null));};exports[_0x1cb9('0x44')]=function(_0xbc36fc,_0x51a898){var _0x5839aa={'raw':![],'where':{'id':_0xbc36fc[_0x1cb9('0x45')]['id']}},_0x24c643={};_0x24c643[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x2c')]['rawAttributes']);_0x24c643[_0x1cb9('0x30')]=_['keys'](_0xbc36fc['query']);_0x24c643['filters']=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],_0x24c643[_0x1cb9('0x30')]);_0x5839aa[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x24c643[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0xbc36fc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x5839aa[_0x1cb9('0x35')]=_0x5839aa[_0x1cb9('0x35')]['length']?_0x5839aa[_0x1cb9('0x35')]:_0x24c643[_0x1cb9('0x34')];if(_0xbc36fc[_0x1cb9('0x30')]['includeAll']){_0x5839aa[_0x1cb9('0x42')]=[{'all':!![]}];}_0x5839aa=_[_0x1cb9('0x3e')]({},_0x5839aa,_0xbc36fc[_0x1cb9('0x41')]);return db[_0x1cb9('0x2c')][_0x1cb9('0x46')](_0x5839aa)['then'](handleEntityNotFound(_0x51a898,null))[_0x1cb9('0x24')](respondWithResult(_0x51a898,null))['catch'](handleError(_0x51a898,null));};exports[_0x1cb9('0x47')]=function(_0x4ac483,_0x1cf2ee){return db[_0x1cb9('0x2c')][_0x1cb9('0x47')](_0x4ac483[_0x1cb9('0x48')],{})['then'](function(_0x298475){var _0x1149b9=_0x4ac483[_0x1cb9('0x49')][_0x1cb9('0x25')]({'plain':!![]});if(!_0x1149b9)throw new Error(_0x1cb9('0x4a'));if(_0x1149b9[_0x1cb9('0x4b')]===_0x1cb9('0x49')){var _0x3b6a92=_0x298475[_0x1cb9('0x25')]({'plain':!![]});var _0x17f10e='Lists';return db['UserProfileSection'][_0x1cb9('0x46')]({'where':{'name':_0x17f10e,'userProfileId':_0x1149b9[_0x1cb9('0x4c')]},'raw':!![]})[_0x1cb9('0x24')](function(_0x1e073d){if(_0x1e073d&&_0x1e073d[_0x1cb9('0x4d')]===0x0){return db[_0x1cb9('0x4e')][_0x1cb9('0x47')]({'name':_0x3b6a92[_0x1cb9('0x29')],'resourceId':_0x3b6a92['id'],'type':_0x1e073d[_0x1cb9('0x29')],'sectionId':_0x1e073d['id']},{})[_0x1cb9('0x24')](function(){return _0x298475;});}else{return _0x298475;}})['catch'](function(_0x2cf8e2){logger['error'](_0x1cb9('0x4f'),_0x2cf8e2);throw _0x2cf8e2;});}return _0x298475;})['then'](respondWithResult(_0x1cf2ee,0xc9))[_0x1cb9('0x50')](handleError(_0x1cf2ee,null));};exports['update']=function(_0x5e5174,_0x44e918){if(_0x5e5174[_0x1cb9('0x48')]['id']){delete _0x5e5174[_0x1cb9('0x48')]['id'];}return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x5e5174[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x44e918,null))['then'](saveUpdates(_0x5e5174[_0x1cb9('0x48')],null))[_0x1cb9('0x24')](respondWithResult(_0x44e918,null))[_0x1cb9('0x50')](handleError(_0x44e918,null));};exports[_0x1cb9('0x27')]=function(_0x3de325,_0x310d6d){return db[_0x1cb9('0x2c')]['find']({'where':{'id':_0x3de325[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x310d6d,null))[_0x1cb9('0x24')](removeEntity(_0x310d6d,null))['catch'](handleError(_0x310d6d,null));};exports[_0x1cb9('0x51')]=function(_0x9893a3,_0x1651c5){return db[_0x1cb9('0x2c')][_0x1cb9('0x51')]()[_0x1cb9('0x24')](respondWithResult(_0x1651c5,null))['catch'](handleError(_0x1651c5,null));};exports[_0x1cb9('0x52')]=function(_0x36c40d,_0x41e81f,_0x128c5b){if(_0x36c40d[_0x1cb9('0x48')]['id']){delete _0x36c40d[_0x1cb9('0x48')]['id'];}return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x36c40d[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x41e81f,null))[_0x1cb9('0x24')](function(_0x55fb51){if(_0x55fb51){_0x36c40d[_0x1cb9('0x48')][_0x1cb9('0x53')]=_0x55fb51['id'];return db[_0x1cb9('0x54')][_0x1cb9('0x47')](_0x36c40d['body']);}})['then'](respondWithResult(_0x41e81f,null))[_0x1cb9('0x50')](handleError(_0x41e81f,null));};exports[_0x1cb9('0x55')]=function(_0x31eccc,_0x173db5,_0x3c2f9c){var _0x75c734={'raw':![],'where':{}};var _0xc515a6={};var _0xd010a9={'count':0x0,'rows':[]};return db['CmList']['findOne']({'where':{'id':_0x31eccc[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x173db5,null))['then'](function(_0x4ca5bc){if(_0x4ca5bc){_0xc515a6['model']=_['keys'](db[_0x1cb9('0x54')][_0x1cb9('0x2d')]);_0xc515a6[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x31eccc[_0x1cb9('0x30')]);_0xc515a6[_0x1cb9('0x32')]=_['intersection'](_0xc515a6[_0x1cb9('0x34')],_0xc515a6[_0x1cb9('0x30')]);_0x75c734['attributes']=_['intersection'](_0xc515a6[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x75c734[_0x1cb9('0x35')]=_0x75c734['attributes']['length']?_0x75c734['attributes']:_0xc515a6[_0x1cb9('0x34')];if(!_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x75c734[_0x1cb9('0x20')]=qs['limit'](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x75c734['offset']=qs['offset'](_0x31eccc[_0x1cb9('0x30')]['offset']);}_0x75c734[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x75c734[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_['pick'](_0x31eccc[_0x1cb9('0x30')],_0xc515a6[_0x1cb9('0x32')]));_0x75c734[_0x1cb9('0x3b')][_0x1cb9('0x53')]=_0x4ca5bc['id'];if(_0x31eccc['query']['filter']){_0x75c734[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x75c734[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x75c734[_0x1cb9('0x35')],function(_0x267a3c){var _0x4f8756={};_0x4f8756[_0x267a3c]={'$like':'%'+_0x31eccc[_0x1cb9('0x30')]['filter']+'%'};return _0x4f8756;})});}_0x75c734=_[_0x1cb9('0x3e')]({},_0x75c734,_0x31eccc[_0x1cb9('0x41')]);return db['Disposition'][_0x1cb9('0x1e')]({'where':_0x75c734[_0x1cb9('0x3b')]})[_0x1cb9('0x24')](function(_0x539514){_0xd010a9[_0x1cb9('0x1e')]=_0x539514;if(_0x31eccc[_0x1cb9('0x30')][_0x1cb9('0x57')]){_0x75c734[_0x1cb9('0x42')]=[{'all':!![]}];}return db[_0x1cb9('0x54')][_0x1cb9('0x43')](_0x75c734);})['then'](function(_0x2b2874){_0xd010a9[_0x1cb9('0x58')]=_0x2b2874;return _0xd010a9;});}})[_0x1cb9('0x24')](respondWithFilteredResult(_0x173db5,_0x75c734))[_0x1cb9('0x50')](handleError(_0x173db5,null));};exports[_0x1cb9('0x59')]=function(_0x1da41c,_0x128a41,_0x37bcd9){return db['CmList'][_0x1cb9('0x46')]({'where':{'id':_0x1da41c[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x128a41,null))[_0x1cb9('0x24')](function(_0x5415fa){if(_0x5415fa){return _0x5415fa[_0x1cb9('0x59')](_0x1da41c['query']['ids']);}})[_0x1cb9('0x24')](respondWithStatusCode(_0x128a41,null))[_0x1cb9('0x50')](handleError(_0x128a41,null));};exports['addContacts']=function(_0x342cb1,_0x5b5419,_0x3d6474){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x342cb1[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5b5419,null))[_0x1cb9('0x24')](function(_0x3d25a3){if(_0x3d25a3){var _0x2a157d=[];var _0x27cc3c={'success':[],'errors':[]};return db[_0x1cb9('0x5a')][_0x1cb9('0x51')]()['then'](function(_0x248946){if(_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]&&_[_0x1cb9('0x5c')](_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')])){if(_0x342cb1['body'][_0x1cb9('0x5b')][_0x1cb9('0x37')]){_0x342cb1['body'][_0x1cb9('0x5b')]=_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')][_0x1cb9('0x5d')](';')+';';}else{_0x342cb1[_0x1cb9('0x48')][_0x1cb9('0x5b')]=null;}}else{_0x342cb1[_0x1cb9('0x48')]['tags']=null;}if(_0x342cb1[_0x1cb9('0x48')]&&_['isArray'](_0x342cb1[_0x1cb9('0x48')])){for(var _0xb5eac1=0x0;_0xb5eac1<_0x342cb1['body'][_0x1cb9('0x37')];_0xb5eac1+=0x1){_0x342cb1[_0x1cb9('0x48')][_0xb5eac1][_0x1cb9('0x53')]=_0x342cb1[_0x1cb9('0x45')]['id'];_0x2a157d['push'](_0x342cb1[_0x1cb9('0x48')][_0xb5eac1]);}return BPromise[_0x1cb9('0x5e')](_0x2a157d,function(_0x429371){return db['CmContact'][_0x1cb9('0x47')](_[_0x1cb9('0x5f')](_0x429371,[_0x1cb9('0x60'),'id'])||{},{'fields':_[_0x1cb9('0x31')](_0x248946),'raw':!![]})[_0x1cb9('0x24')](function(_0x1ea329){_0x27cc3c[_0x1cb9('0x61')]['push'](_0x1ea329[_0x1cb9('0x62')]);})['catch'](function(_0x27f1d2){_0x27cc3c[_0x1cb9('0x63')][_0x1cb9('0x64')]({'data':_0x429371,'error':_0x27f1d2[_0x1cb9('0x65')]});});})['then'](function(_0x1ff5e9){return _0x27cc3c;})[_0x1cb9('0x50')](function(_0x5e68a1){return _0x5e68a1;});}else{_0x5b5419[_0x1cb9('0x1b')](0x190)[_0x1cb9('0x1d')]({'message':_0x1cb9('0x66')});}});}})[_0x1cb9('0x24')](respondWithResult(_0x5b5419,null))[_0x1cb9('0x50')](handleError(_0x5b5419,null));};exports['getContacts']=function(_0x5e0e56,_0x544d2d,_0x5ad853){var _0x19daa1;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x5e0e56[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0x544d2d,null))[_0x1cb9('0x24')](function(_0x4e969a){if(_0x4e969a){_0x19daa1=_0x4e969a;return db[_0x1cb9('0x5a')][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x5eff1e){if(_0x5eff1e){var _0x10977f={};var _0xc6b64c={};_0xc6b64c['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x5eff1e),_[_0x1cb9('0x2b')](_0x19daa1[_0x1cb9('0x68')],function(_0x5cb5e5){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x5cb5e5['id']);}));_0xc6b64c['query']=_['keys'](_0x5e0e56[_0x1cb9('0x30')]);_0xc6b64c[_0x1cb9('0x32')]=_['intersection'](_0xc6b64c['model'],_0xc6b64c[_0x1cb9('0x30')]);_0x10977f[_0x1cb9('0x35')]=_['intersection'](_0xc6b64c['model'],qs[_0x1cb9('0x36')](_0x5e0e56['query']['fields']));_0x10977f['attributes']=_0x10977f[_0x1cb9('0x35')]['length']?_0x10977f[_0x1cb9('0x35')]:_0xc6b64c[_0x1cb9('0x34')];if(!_0x5e0e56[_0x1cb9('0x30')]['hasOwnProperty'](_0x1cb9('0x39'))){_0x10977f[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x5e0e56['query'][_0x1cb9('0x20')]);_0x10977f[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x1f')]);}_0x10977f['order']=qs[_0x1cb9('0x56')](_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x10977f['where']=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x5e0e56[_0x1cb9('0x30')],_0xc6b64c[_0x1cb9('0x32')]));_0x10977f[_0x1cb9('0x6c')]=!![];if(_0x5e0e56['query'][_0x1cb9('0x3d')]){_0x10977f[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x10977f[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x10977f[_0x1cb9('0x35')],function(_0x37affa){var _0x36864c={};_0x36864c[_0x37affa]={'$like':'%'+_0x5e0e56[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x36864c;})});}_0x10977f=_[_0x1cb9('0x3e')]({},_0x10977f,_0x5e0e56[_0x1cb9('0x41')]);return _0x19daa1[_0x1cb9('0x6d')](_0x10977f);}})[_0x1cb9('0x24')](respondWithResult(_0x544d2d,null))[_0x1cb9('0x50')](handleError(_0x544d2d,null));};exports[_0x1cb9('0x6e')]=function(_0x37b290,_0xf25415,_0x48e879){var _0x508a75;return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x37b290[_0x1cb9('0x45')]['id']},'include':[{'model':db[_0x1cb9('0x67')],'as':_0x1cb9('0x68')}]})[_0x1cb9('0x24')](handleEntityNotFound(_0xf25415,null))[_0x1cb9('0x24')](function(_0x56251d){if(_0x56251d){_0x508a75=_0x56251d;return db['CmContact'][_0x1cb9('0x2d')];}})[_0x1cb9('0x24')](function(_0x29b478){if(_0x29b478){var _0x11a46b={};var _0xed8968={};_0xed8968['model']=_[_0x1cb9('0x69')](_[_0x1cb9('0x31')](_0x29b478),_[_0x1cb9('0x2b')](_0x508a75['CustomFields'],function(_0x36faa4){return util[_0x1cb9('0x6a')](_0x1cb9('0x6b'),_0x36faa4['id']);}));_0xed8968['query']=_[_0x1cb9('0x31')](_0x37b290[_0x1cb9('0x30')]);_0xed8968[_0x1cb9('0x32')]=_['intersection'](_0xed8968['model'],_0xed8968['query']);_0x11a46b[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0xed8968[_0x1cb9('0x34')],qs['fields'](_0x37b290[_0x1cb9('0x30')]['fields']));_0x11a46b['attributes']=_0x11a46b[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x11a46b[_0x1cb9('0x35')]:_0xed8968[_0x1cb9('0x34')];if(!_0x37b290[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x11a46b[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x37b290[_0x1cb9('0x30')]['limit']);_0x11a46b['offset']=qs[_0x1cb9('0x1f')](_0x37b290[_0x1cb9('0x30')]['offset']);}_0x11a46b['order']=qs['sort'](_0x37b290['query'][_0x1cb9('0x56')]);_0x11a46b[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x37b290[_0x1cb9('0x30')],_0xed8968[_0x1cb9('0x32')]));_0x11a46b[_0x1cb9('0x6c')]=!![];if(_0x37b290[_0x1cb9('0x30')]['filter']){_0x11a46b[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x11a46b[_0x1cb9('0x3b')],{'$or':_[_0x1cb9('0x2b')](_0x11a46b['attributes'],function(_0x19f3db){var _0x3d82b0={};_0x3d82b0[_0x19f3db]={'$like':'%'+_0x37b290['query']['filter']+'%'};return _0x3d82b0;})});}_0x11a46b=_['merge']({},_0x11a46b,_0x37b290[_0x1cb9('0x41')]);return _0x508a75['getContacts'](_0x11a46b);}})[_0x1cb9('0x24')](function(_0x3506d7){if(!_[_0x1cb9('0x6f')](_0x3506d7)){var _0xf3c554=toCsv(_0x3506d7);var _0x31d1e5=Date[_0x1cb9('0x70')]();fs['writeFileSync'](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5),_0xf3c554);_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x73'),_0x1cb9('0x74')+util[_0x1cb9('0x6a')](_0x1cb9('0x75'),_0x508a75['id'],_0x31d1e5));_0xf25415[_0x1cb9('0x72')](_0x1cb9('0x76'),_0x1cb9('0x77'));return _0xf25415[_0x1cb9('0x78')](util[_0x1cb9('0x6a')](_0x1cb9('0x71'),_0x508a75['id'],_0x31d1e5));}else{return _0xf25415[_0x1cb9('0x1a')](0xcc);}})[_0x1cb9('0x50')](handleError(_0xf25415,null));};exports['addCustomField']=function(_0x592c04,_0x5aae4c,_0x9b1c60){var _0x35792e;delete _0x592c04['body']['id'];return db[_0x1cb9('0x2c')][_0x1cb9('0x79')]({'where':{'id':_0x592c04[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x5aae4c,null))[_0x1cb9('0x24')](function(_0x3f817e){if(_0x3f817e){return db[_0x1cb9('0x7a')][_0x1cb9('0x7b')](function(_0x45b2e4){return db['CmCustomField'][_0x1cb9('0x47')](_0x592c04['body'],{'transaction':_0x45b2e4})['then'](function(_0x191988){_0x35792e=_0x191988;return _0x3f817e[_0x1cb9('0x7c')](_0x191988,{'transaction':_0x45b2e4});})[_0x1cb9('0x24')](function(){var _0x2e9d88={'type':db[_0x1cb9('0x7d')][_0x1cb9('0x7e')],'transaction':_0x45b2e4};switch(_0x592c04[_0x1cb9('0x48')][_0x1cb9('0x3f')]){case'text':_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x7e')];break;case _0x1cb9('0x7f'):_0x2e9d88[_0x1cb9('0x3f')]=db['Sequelize'][_0x1cb9('0x80')];break;case _0x1cb9('0x81'):_0x2e9d88[_0x1cb9('0x3f')]=db[_0x1cb9('0x7d')][_0x1cb9('0x82')];_0x2e9d88['defaultValue']=![];break;default:}return db[_0x1cb9('0x7a')][_0x1cb9('0x83')][_0x1cb9('0x84')]('cm_contacts',util[_0x1cb9('0x6a')](_0x1cb9('0x85'),_0x35792e['id']),_0x2e9d88);})[_0x1cb9('0x24')](function(){return _0x35792e;});});}})[_0x1cb9('0x24')](respondWithResult(_0x5aae4c,null))[_0x1cb9('0x50')](handleError(_0x5aae4c,null));};exports[_0x1cb9('0x86')]=function(_0x4e3ad0,_0x45dc8c,_0x7118bb){var _0x17fdd1={};var _0x5d230a={};var _0x142f08;var _0x2485b9;return db['CmList']['findOne']({'where':{'id':_0x4e3ad0[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x45dc8c,null))[_0x1cb9('0x24')](function(_0x208ce1){if(_0x208ce1){_0x142f08=_0x208ce1;_0x5d230a[_0x1cb9('0x34')]=_['keys'](db[_0x1cb9('0x67')][_0x1cb9('0x2d')]);_0x5d230a[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x4e3ad0[_0x1cb9('0x30')]);_0x5d230a['filters']=_['intersection'](_0x5d230a[_0x1cb9('0x34')],_0x5d230a[_0x1cb9('0x30')]);_0x17fdd1[_0x1cb9('0x35')]=_['intersection'](_0x5d230a['model'],qs[_0x1cb9('0x36')](_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x17fdd1['attributes']=_0x17fdd1['attributes']['length']?_0x17fdd1[_0x1cb9('0x35')]:_0x5d230a[_0x1cb9('0x34')];_0x17fdd1[_0x1cb9('0x3a')]=qs['sort'](_0x4e3ad0[_0x1cb9('0x30')]['sort']);_0x17fdd1[_0x1cb9('0x3b')]=qs[_0x1cb9('0x32')](_[_0x1cb9('0x3c')](_0x4e3ad0[_0x1cb9('0x30')],_0x5d230a[_0x1cb9('0x32')]));_0x17fdd1['where']=_[_0x1cb9('0x3e')](_0x17fdd1['where'],{'$or':[{'ListId':_0x208ce1['id']},{'ListId':null}]});if(_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x17fdd1[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x17fdd1[_0x1cb9('0x3b')],{'$or':_['map'](_0x17fdd1[_0x1cb9('0x35')],function(_0x174147){var _0xb4ea43={};_0xb4ea43[_0x174147]={'$like':'%'+_0x4e3ad0[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0xb4ea43;})});}_0x17fdd1=_[_0x1cb9('0x3e')]({},_0x17fdd1,_0x4e3ad0[_0x1cb9('0x41')]);return db['CmCustomField']['findAndCountAll'](_0x17fdd1);}})[_0x1cb9('0x24')](respondWithResult(_0x45dc8c,null))[_0x1cb9('0x50')](handleError(_0x45dc8c,null));};exports[_0x1cb9('0x87')]=function(_0x1cdff0,_0x106fe7,_0x54b0d0){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x1cdff0['params']['id']}})['then'](handleEntityNotFound(_0x106fe7,null))[_0x1cb9('0x24')](function(_0x48c8e7){if(_0x48c8e7){return _0x48c8e7[_0x1cb9('0x87')](_0x1cdff0['body'][_0x1cb9('0x60')],_[_0x1cb9('0x5f')](_0x1cdff0[_0x1cb9('0x48')],[_0x1cb9('0x60'),'id'])||{})[_0x1cb9('0x88')](function(_0x345e13){for(var _0x2c7326=0x0;_0x2c7326<_0x1cdff0[_0x1cb9('0x48')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x2c7326+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8a'),{'UserId':_0x1cdff0['body']['ids'][_0x2c7326],'CmListId':_0x1cdff0['params']['id']});}return _0x345e13;});}})['then'](respondWithResult(_0x106fe7,null))[_0x1cb9('0x50')](handleError(_0x106fe7,null));};exports[_0x1cb9('0x8b')]=function(_0x550877,_0x5b2b21,_0x4e46c1){return db[_0x1cb9('0x2c')][_0x1cb9('0x46')]({'where':{'id':_0x550877[_0x1cb9('0x45')]['id']}})[_0x1cb9('0x24')](handleEntityNotFound(_0x5b2b21,null))['then'](function(_0x178cba){if(_0x178cba){return _0x178cba[_0x1cb9('0x8b')](_0x550877[_0x1cb9('0x30')]['ids'])[_0x1cb9('0x24')](function(){if(_[_0x1cb9('0x5c')](_0x550877['query'][_0x1cb9('0x60')])){for(var _0x57c3c4=0x0;_0x57c3c4<_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x1cb9('0x37')];_0x57c3c4+=0x1){socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')][_0x57c3c4]),'CmListId':Number(_0x550877['params']['id'])});}}else{socket[_0x1cb9('0x89')](_0x1cb9('0x8c'),{'UserId':Number(_0x550877[_0x1cb9('0x30')][_0x1cb9('0x60')]),'CmListId':Number(_0x550877[_0x1cb9('0x45')]['id'])});}});}})[_0x1cb9('0x24')](respondWithStatusCode(_0x5b2b21,null))[_0x1cb9('0x50')](handleError(_0x5b2b21,null));};exports[_0x1cb9('0x8d')]=function(_0x181146,_0x394a89,_0x4a050d){var _0x183dbf={};var _0x32f255={};var _0x32be25;var _0x3e9fca;return db[_0x1cb9('0x2c')]['findOne']({'where':{'id':_0x181146[_0x1cb9('0x45')]['id']}})['then'](handleEntityNotFound(_0x394a89,null))['then'](function(_0x44f38a){if(_0x44f38a){_0x32be25=_0x44f38a;_0x32f255[_0x1cb9('0x34')]=_[_0x1cb9('0x31')](db[_0x1cb9('0x8e')][_0x1cb9('0x2d')]);_0x32f255[_0x1cb9('0x30')]=_[_0x1cb9('0x31')](_0x181146[_0x1cb9('0x30')]);_0x32f255[_0x1cb9('0x32')]=_['intersection'](_0x32f255['model'],_0x32f255[_0x1cb9('0x30')]);_0x183dbf[_0x1cb9('0x35')]=_[_0x1cb9('0x33')](_0x32f255[_0x1cb9('0x34')],qs[_0x1cb9('0x36')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x36')]));_0x183dbf[_0x1cb9('0x35')]=_0x183dbf[_0x1cb9('0x35')][_0x1cb9('0x37')]?_0x183dbf['attributes']:_0x32f255[_0x1cb9('0x34')];_0x183dbf[_0x1cb9('0x3a')]=qs[_0x1cb9('0x56')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x56')]);_0x183dbf[_0x1cb9('0x3b')]=qs['filters'](_[_0x1cb9('0x3c')](_0x181146[_0x1cb9('0x30')],_0x32f255[_0x1cb9('0x32')]));if(_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]){_0x183dbf[_0x1cb9('0x3b')]=_[_0x1cb9('0x3e')](_0x183dbf['where'],{'$or':_[_0x1cb9('0x2b')](_0x183dbf[_0x1cb9('0x35')],function(_0x276900){var _0x45c0e6={};_0x45c0e6[_0x276900]={'$like':'%'+_0x181146[_0x1cb9('0x30')][_0x1cb9('0x3d')]+'%'};return _0x45c0e6;})});}_0x183dbf=_[_0x1cb9('0x3e')]({},_0x183dbf,_0x181146[_0x1cb9('0x41')]);return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x27390a){if(_0x27390a){_0x3e9fca=_0x27390a[_0x1cb9('0x37')];if(!_0x181146[_0x1cb9('0x30')][_0x1cb9('0x38')](_0x1cb9('0x39'))){_0x183dbf[_0x1cb9('0x20')]=qs[_0x1cb9('0x20')](_0x181146[_0x1cb9('0x30')][_0x1cb9('0x20')]);_0x183dbf[_0x1cb9('0x1f')]=qs[_0x1cb9('0x1f')](_0x181146[_0x1cb9('0x30')]['offset']);}return _0x32be25[_0x1cb9('0x8d')](_0x183dbf);}})[_0x1cb9('0x24')](function(_0x16ec06){if(_0x16ec06){return _0x16ec06?{'count':_0x3e9fca,'rows':_0x16ec06}:null;}})[_0x1cb9('0x24')](respondWithResult(_0x394a89,null))[_0x1cb9('0x50')](handleError(_0x394a89,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 8a6712e..c6e0c65 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 _0xe825=['emit','hasOwnProperty','hook','events','../../mysqldb','CmList','setMaxListeners','save','update'];(function(_0x3e7b59,_0x14a4cd){var _0x4bd64a=function(_0x144656){while(--_0x144656){_0x3e7b59['push'](_0x3e7b59['shift']());}};_0x4bd64a(++_0x14a4cd);}(_0xe825,0x198));var _0x5e82=function(_0x2adda5,_0x1c2bd2){_0x2adda5=_0x2adda5-0x0;var _0x1e4dbb=_0xe825[_0x2adda5];return _0x1e4dbb;};'use strict';var EventEmitter=require(_0x5e82('0x0'));var CmList=require(_0x5e82('0x1'))['db'][_0x5e82('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x5e82('0x3')](0x0);var events={'afterCreate':_0x5e82('0x4'),'afterUpdate':_0x5e82('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4a01f8){return function(_0x4acfad,_0x444947,_0x315916){CmListEvents['emit'](_0x4a01f8+':'+_0x4acfad['id'],_0x4acfad);CmListEvents[_0x5e82('0x6')](_0x4a01f8,_0x4acfad);_0x315916(null);};}for(var e in events){if(events[_0x5e82('0x7')](e)){var event=events[e];CmList[_0x5e82('0x8')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x98fe=['emit','hasOwnProperty','exports','events','CmList','save','update'];(function(_0x3eea1b,_0x4df786){var _0x322e24=function(_0x3d6a89){while(--_0x3d6a89){_0x3eea1b['push'](_0x3eea1b['shift']());}};_0x322e24(++_0x4df786);}(_0x98fe,0xea));var _0xe98f=function(_0x5c71a9,_0x2fe991){_0x5c71a9=_0x5c71a9-0x0;var _0x1962c4=_0x98fe[_0x5c71a9];return _0x1962c4;};'use strict';var EventEmitter=require(_0xe98f('0x0'));var CmList=require('../../mysqldb')['db'][_0xe98f('0x1')];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xe98f('0x2'),'afterUpdate':_0xe98f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3ee42c){return function(_0x43db3e,_0x3aa3bd,_0x5637d8){CmListEvents[_0xe98f('0x4')](_0x3ee42c+':'+_0x43db3e['id'],_0x43db3e);CmListEvents[_0xe98f('0x4')](_0x3ee42c,_0x43db3e);_0x5637d8(null);};}for(var e in events){if(events[_0xe98f('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0xe98f('0x6')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index dd8d0be..2774375 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 _0x096f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists','lodash','util'];(function(_0x5aad65,_0x3b76d6){var _0x577ef3=function(_0x5e1239){while(--_0x5e1239){_0x5aad65['push'](_0x5aad65['shift']());}};_0x577ef3(++_0x3b76d6);}(_0x096f,0x108));var _0xf096=function(_0x4e930f,_0x18dab8){_0x4e930f=_0x4e930f-0x0;var _0x24aedf=_0x096f[_0x4e930f];return _0x24aedf;};'use strict';var _=require(_0xf096('0x0'));var util=require(_0xf096('0x1'));var logger=require('../../config/logger')(_0xf096('0x2'));var moment=require(_0xf096('0x3'));var BPromise=require(_0xf096('0x4'));var rp=require(_0xf096('0x5'));var fs=require('fs');var path=require(_0xf096('0x6'));var rimraf=require(_0xf096('0x7'));var config=require(_0xf096('0x8'));var attributes=require(_0xf096('0x9'));module[_0xf096('0xa')]=function(_0x1935c1,_0x18c957){return _0x1935c1[_0xf096('0xb')](_0xf096('0xc'),attributes,{'tableName':_0xf096('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa8ec=['cm_lists','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmList.attributes','exports','CmList'];(function(_0x252ef1,_0x2e0041){var _0x25817c=function(_0x243776){while(--_0x243776){_0x252ef1['push'](_0x252ef1['shift']());}};_0x25817c(++_0x2e0041);}(_0xa8ec,0x69));var _0xca8e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0xa8ec[_0x4e676e];return _0x336a3c;};'use strict';var _=require('lodash');var util=require(_0xca8e('0x0'));var logger=require(_0xca8e('0x1'))(_0xca8e('0x2'));var moment=require(_0xca8e('0x3'));var BPromise=require(_0xca8e('0x4'));var rp=require(_0xca8e('0x5'));var fs=require('fs');var path=require(_0xca8e('0x6'));var rimraf=require(_0xca8e('0x7'));var config=require(_0xca8e('0x8'));var attributes=require(_0xca8e('0x9'));module[_0xca8e('0xa')]=function(_0x2f74ce,_0x134f9d){return _0x2f74ce['define'](_0xca8e('0xb'),attributes,{'tableName':_0xca8e('0xc'),'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 0b90774..4a6407e 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 _0xb46a=['util','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','http','redis','localhost','socket.io-emitter','register','then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','CmList,\x20%s,\x20%s','message','result','catch','lodash'];(function(_0xfdc023,_0x57a04c){var _0x2ffab8=function(_0x211570){while(--_0x211570){_0xfdc023['push'](_0xfdc023['shift']());}};_0x2ffab8(++_0x57a04c);}(_0xb46a,0x17f));var _0xab46=function(_0x4c13b5,_0xab0f9){_0x4c13b5=_0x4c13b5-0x0;var _0x16ea94=_0xb46a[_0x4c13b5];return _0x16ea94;};'use strict';var _=require(_0xab46('0x0'));var util=require(_0xab46('0x1'));var moment=require(_0xab46('0x2'));var BPromise=require(_0xab46('0x3'));var rs=require(_0xab46('0x4'));var fs=require('fs');var Redis=require(_0xab46('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xab46('0x6'))('rpc');var config=require(_0xab46('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xab46('0x8')]({'port':0x232a});config[_0xab46('0x9')]=_['defaults'](config[_0xab46('0x9')],{'host':_0xab46('0xa'),'port':0x18eb});var socket=require(_0xab46('0xb'))(new Redis(config['redis']));require('./cmList.socket')[_0xab46('0xc')](socket);function respondWithRpcPromise(_0x349a3a,_0x3ce9c7,_0x1bbfd9){return new BPromise(function(_0x321090,_0x1d1be3){return client['request'](_0x349a3a,_0x1bbfd9)[_0xab46('0xd')](function(_0x3f6a28){logger[_0xab46('0xe')]('CmList,\x20%s,\x20%s',_0x3ce9c7,_0xab46('0xf'));logger['debug'](_0xab46('0x10'),_0x3ce9c7,_0xab46('0xf'),JSON[_0xab46('0x11')](_0x3f6a28));if(_0x3f6a28[_0xab46('0x12')]){if(_0x3f6a28[_0xab46('0x12')][_0xab46('0x13')]===0x1f4){logger[_0xab46('0x12')](_0xab46('0x14'),_0x3ce9c7,_0x3f6a28[_0xab46('0x12')][_0xab46('0x15')]);return _0x1d1be3(_0x3f6a28[_0xab46('0x12')]['message']);}logger[_0xab46('0x12')](_0xab46('0x14'),_0x3ce9c7,_0x3f6a28[_0xab46('0x12')][_0xab46('0x15')]);return _0x321090(_0x3f6a28[_0xab46('0x12')][_0xab46('0x15')]);}else{logger[_0xab46('0xe')](_0xab46('0x14'),_0x3ce9c7,'request\x20sent');_0x321090(_0x3f6a28[_0xab46('0x16')]['message']);}})[_0xab46('0x17')](function(_0x14292e){logger[_0xab46('0x12')](_0xab46('0x14'),_0x3ce9c7,_0x14292e);_0x1d1be3(_0x14292e);});});} \ No newline at end of file +var _0x0b2d=['then','info','request\x20sent','CmList,\x20%s,\x20%s,\x20%s','stringify','error','message','CmList,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./cmList.socket','request'];(function(_0x485cac,_0x3186fc){var _0x3790e8=function(_0x4df115){while(--_0x4df115){_0x485cac['push'](_0x485cac['shift']());}};_0x3790e8(++_0x3186fc);}(_0x0b2d,0x11c));var _0xd0b2=function(_0x453e90,_0x92ca66){_0x453e90=_0x453e90-0x0;var _0x33c869=_0x0b2d[_0x453e90];return _0x33c869;};'use strict';var _=require(_0xd0b2('0x0'));var util=require(_0xd0b2('0x1'));var moment=require(_0xd0b2('0x2'));var BPromise=require(_0xd0b2('0x3'));var rs=require(_0xd0b2('0x4'));var fs=require('fs');var Redis=require(_0xd0b2('0x5'));var db=require(_0xd0b2('0x6'))['db'];var utils=require(_0xd0b2('0x7'));var logger=require('../../config/logger')(_0xd0b2('0x8'));var config=require('../../config/environment');var jayson=require(_0xd0b2('0x9'));var client=jayson['client'][_0xd0b2('0xa')]({'port':0x232a});config[_0xd0b2('0xb')]=_['defaults'](config[_0xd0b2('0xb')],{'host':_0xd0b2('0xc'),'port':0x18eb});var socket=require(_0xd0b2('0xd'))(new Redis(config[_0xd0b2('0xb')]));require(_0xd0b2('0xe'))['register'](socket);function respondWithRpcPromise(_0x2edb0b,_0x2fc1d1,_0xb026b3){return new BPromise(function(_0x11c888,_0x45d4b4){return client[_0xd0b2('0xf')](_0x2edb0b,_0xb026b3)[_0xd0b2('0x10')](function(_0x87509b){logger[_0xd0b2('0x11')]('CmList,\x20%s,\x20%s',_0x2fc1d1,_0xd0b2('0x12'));logger['debug'](_0xd0b2('0x13'),_0x2fc1d1,_0xd0b2('0x12'),JSON[_0xd0b2('0x14')](_0x87509b));if(_0x87509b[_0xd0b2('0x15')]){if(_0x87509b[_0xd0b2('0x15')]['code']===0x1f4){logger[_0xd0b2('0x15')]('CmList,\x20%s,\x20%s',_0x2fc1d1,_0x87509b[_0xd0b2('0x15')]['message']);return _0x45d4b4(_0x87509b[_0xd0b2('0x15')][_0xd0b2('0x16')]);}logger[_0xd0b2('0x15')](_0xd0b2('0x17'),_0x2fc1d1,_0x87509b[_0xd0b2('0x15')][_0xd0b2('0x16')]);return _0x11c888(_0x87509b[_0xd0b2('0x15')][_0xd0b2('0x16')]);}else{logger[_0xd0b2('0x11')](_0xd0b2('0x17'),_0x2fc1d1,'request\x20sent');_0x11c888(_0x87509b['result'][_0xd0b2('0x16')]);}})[_0xd0b2('0x18')](function(_0x41adf1){logger[_0xd0b2('0x15')]('CmList,\x20%s,\x20%s',_0x2fc1d1,_0x41adf1);_0x45d4b4(_0x41adf1);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index f9575c9..c37c70e 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 _0x102b=['length','cmList:','save','update','emit','removeListener'];(function(_0xb57d7d,_0x548180){var _0x8b88=function(_0x55673e){while(--_0x55673e){_0xb57d7d['push'](_0xb57d7d['shift']());}};_0x8b88(++_0x548180);}(_0x102b,0x1be));var _0xb102=function(_0x5e5c19,_0x257411){_0x5e5c19=_0x5e5c19-0x0;var _0x320f6c=_0x102b[_0x5e5c19];return _0x320f6c;};'use strict';var CmListEvents=require('./cmList.events');var events=[_0xb102('0x0'),'remove',_0xb102('0x1')];function createListener(_0x3e1311,_0x42172c){return function(_0x1be904){_0x42172c[_0xb102('0x2')](_0x3e1311,_0x1be904);};}function removeListener(_0x1402fb,_0x19e35d){return function(){CmListEvents[_0xb102('0x3')](_0x1402fb,_0x19e35d);};}exports['register']=function(_0x3325b7){for(var _0x370baa=0x0,_0xd131eb=events[_0xb102('0x4')];_0x370baa<_0xd131eb;_0x370baa++){var _0x1ee0c0=events[_0x370baa];var _0x5879bb=createListener(_0xb102('0x5')+_0x1ee0c0,_0x3325b7);CmListEvents['on'](_0x1ee0c0,_0x5879bb);}}; \ No newline at end of file +var _0x254a=['emit','register','./cmList.events','save','remove'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0x254a,0x138));var _0xa254=function(_0x2e0af0,_0x83719c){_0x2e0af0=_0x2e0af0-0x0;var _0x2dfdc9=_0x254a[_0x2e0af0];return _0x2dfdc9;};'use strict';var CmListEvents=require(_0xa254('0x0'));var events=[_0xa254('0x1'),_0xa254('0x2'),'update'];function createListener(_0xdd386c,_0x3e56d3){return function(_0x34467a){_0x3e56d3[_0xa254('0x3')](_0xdd386c,_0x34467a);};}function removeListener(_0x500e29,_0x8fbfaf){return function(){CmListEvents['removeListener'](_0x500e29,_0x8fbfaf);};}exports[_0xa254('0x4')]=function(_0x3d5886){for(var _0x1201ae=0x0,_0x597d72=events['length'];_0x1201ae<_0x597d72;_0x1201ae++){var _0xaeed42=events[_0x1201ae];var _0x352a44=createListener('cmList:'+_0xaeed42,_0x3d5886);CmListEvents['on'](_0xaeed42,_0x352a44);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index 4fedb13..ea0ad90 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 _0xd32b=['/:id/contacts','getContacts','/:id/contacts/csv','getCustomFields','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addContacts','/:id/fields','addCustomField','addAgents','put','update','destroy','removeAgents','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show'];(function(_0x351a91,_0x1b45f6){var _0x430dd3=function(_0x8b51f0){while(--_0x8b51f0){_0x351a91['push'](_0x351a91['shift']());}};_0x430dd3(++_0x1b45f6);}(_0xd32b,0xcc));var _0xbd32=function(_0x18b662,_0x517a09){_0x18b662=_0x18b662-0x0;var _0x1e4ebd=_0xd32b[_0x18b662];return _0x1e4ebd;};'use strict';var multer=require(_0xbd32('0x0'));var util=require(_0xbd32('0x1'));var path=require('path');var timeout=require(_0xbd32('0x2'));var express=require('express');var router=express[_0xbd32('0x3')]();var auth=require(_0xbd32('0x4'));var interaction=require(_0xbd32('0x5'));var config=require(_0xbd32('0x6'));var controller=require('./cmList.controller');router[_0xbd32('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xbd32('0x7')](_0xbd32('0x8'),auth[_0xbd32('0x9')](),controller[_0xbd32('0xa')]);router[_0xbd32('0x7')](_0xbd32('0xb'),auth[_0xbd32('0x9')](),controller[_0xbd32('0xc')]);router[_0xbd32('0x7')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xbd32('0x7')](_0xbd32('0xd'),auth[_0xbd32('0x9')](),controller[_0xbd32('0xe')]);router[_0xbd32('0x7')](_0xbd32('0xf'),auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xbd32('0x7')]('/:id/fields',auth[_0xbd32('0x9')](),controller[_0xbd32('0x10')]);router['get'](_0xbd32('0x11'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x12')]);router[_0xbd32('0x13')]('/',auth[_0xbd32('0x9')](),controller[_0xbd32('0x14')]);router[_0xbd32('0x13')](_0xbd32('0x15'),auth['isAuthenticated'](),controller[_0xbd32('0x16')]);router[_0xbd32('0x13')](_0xbd32('0xd'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x17')]);router[_0xbd32('0x13')](_0xbd32('0x18'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x19')]);router[_0xbd32('0x13')](_0xbd32('0x11'),auth['isAuthenticated'](),controller[_0xbd32('0x1a')]);router[_0xbd32('0x1b')](_0xbd32('0xb'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x1c')]);router['delete'](_0xbd32('0xb'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x1d')]);router['delete'](_0xbd32('0x15'),auth[_0xbd32('0x9')](),controller['removeDispositions']);router['delete'](_0xbd32('0x11'),auth[_0xbd32('0x9')](),controller[_0xbd32('0x1e')]);module['exports']=router; \ No newline at end of file +var _0x8aed=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/dispositions','getDispositions','getContacts','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','addAgents','update','destroy','delete','removeDispositions','removeAgents','exports','multer','path','connect-timeout','express','Router'];(function(_0x151217,_0x3283b7){var _0x6fd20c=function(_0x392a96){while(--_0x392a96){_0x151217['push'](_0x151217['shift']());}};_0x6fd20c(++_0x3283b7);}(_0x8aed,0x171));var _0xd8ae=function(_0x7d58e8,_0x2b7c5d){_0x7d58e8=_0x7d58e8-0x0;var _0x42bd97=_0x8aed[_0x7d58e8];return _0x42bd97;};'use strict';var multer=require(_0xd8ae('0x0'));var util=require('util');var path=require(_0xd8ae('0x1'));var timeout=require(_0xd8ae('0x2'));var express=require(_0xd8ae('0x3'));var router=express[_0xd8ae('0x4')]();var auth=require(_0xd8ae('0x5'));var interaction=require(_0xd8ae('0x6'));var config=require(_0xd8ae('0x7'));var controller=require(_0xd8ae('0x8'));router[_0xd8ae('0x9')]('/',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0xb')]);router['get'](_0xd8ae('0xc'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0xd')]);router[_0xd8ae('0x9')](_0xd8ae('0xe'),auth[_0xd8ae('0xa')](),controller['show']);router[_0xd8ae('0x9')](_0xd8ae('0xf'),auth['isAuthenticated'](),controller[_0xd8ae('0x10')]);router[_0xd8ae('0x9')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xd8ae('0x11')]);router[_0xd8ae('0x9')]('/:id/contacts/csv',auth['isAuthenticated'](),controller['getContactsCsv']);router[_0xd8ae('0x9')](_0xd8ae('0x12'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x13')]);router[_0xd8ae('0x9')](_0xd8ae('0x14'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x15')]);router[_0xd8ae('0x16')]('/',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x17')]);router[_0xd8ae('0x16')]('/:id/dispositions',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x18')]);router[_0xd8ae('0x16')]('/:id/contacts',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x19')]);router[_0xd8ae('0x16')]('/:id/fields',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x1a')]);router[_0xd8ae('0x16')]('/:id/users',auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x1b')]);router['put'](_0xd8ae('0xe'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x1c')]);router['delete'](_0xd8ae('0xe'),auth['isAuthenticated'](),controller[_0xd8ae('0x1d')]);router[_0xd8ae('0x1e')](_0xd8ae('0xf'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x1f')]);router[_0xd8ae('0x1e')](_0xd8ae('0x14'),auth[_0xd8ae('0xa')](),controller[_0xd8ae('0x20')]);module[_0xd8ae('0x21')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index f60395f..ede1418 100644 --- a/server/api/condition/condition.attributes.js +++ b/server/api/condition/condition.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['STRING','sequelize','exports','VIRTUAL','field'];(function(_0x1f5414,_0x348cdc){var _0x25fd3d=function(_0x4919d7){while(--_0x4919d7){_0x1f5414['push'](_0x1f5414['shift']());}};_0x25fd3d(++_0x348cdc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')],'get':function(_0x5dd881){return this['getDataValue'](_0x0a9e('0x3'));}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]},'value':{'type':Sequelize[_0x0a9e('0x4')],'allowNull':![]}}; \ No newline at end of file +var _0x9957=['field','STRING','sequelize','exports','VIRTUAL'];(function(_0x488612,_0x543afa){var _0x2cfbea=function(_0x1d2c5c){while(--_0x1d2c5c){_0x488612['push'](_0x488612['shift']());}};_0x2cfbea(++_0x543afa);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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 f0c56b6..71bcf8d 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 _0x2265=['lodash','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','save','update','then','destroy','stack','name','body','find','params','catch','Condition','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs'];(function(_0x2ba720,_0xc69449){var _0x130f4e=function(_0x24f2da){while(--_0x24f2da){_0x2ba720['push'](_0x2ba720['shift']());}};_0x130f4e(++_0xc69449);}(_0x2265,0xfa));var _0x5226=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x2265[_0x9df060];return _0x338dfe;};'use strict';var pdf=require(_0x5226('0x0'));var emlformat=require(_0x5226('0x1'));var rimraf=require(_0x5226('0x2'));var zipdir=require(_0x5226('0x3'));var jsonpatch=require(_0x5226('0x4'));var rp=require(_0x5226('0x5'));var moment=require(_0x5226('0x6'));var BPromise=require(_0x5226('0x7'));var Mustache=require(_0x5226('0x8'));var util=require(_0x5226('0x9'));var path=require(_0x5226('0xa'));var sox=require(_0x5226('0xb'));var csv=require(_0x5226('0xc'));var ejs=require(_0x5226('0xd'));var fs=require('fs');var _=require(_0x5226('0xe'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5226('0xf'));var toCsv=require(_0x5226('0xc'));var querystring=require('querystring');var Papa=require(_0x5226('0x10'));var Redis=require(_0x5226('0x11'));var authService=require(_0x5226('0x12'));var qs=require(_0x5226('0x13'));var as=require(_0x5226('0x14'));var hardwareService=require(_0x5226('0x15'));var logger=require(_0x5226('0x16'))(_0x5226('0x17'));var utils=require(_0x5226('0x18'));var config=require('../../config/environment');var db=require(_0x5226('0x19'))['db'];function respondWithStatusCode(_0x19c300,_0x2ff13b){_0x2ff13b=_0x2ff13b||0xcc;return function(_0x5c1a7f){if(_0x5c1a7f){return _0x19c300[_0x5226('0x1a')](_0x2ff13b);}return _0x19c300['status'](_0x2ff13b)['end']();};}function respondWithResult(_0x46cfae,_0xad8fb){_0xad8fb=_0xad8fb||0xc8;return function(_0x2be035){if(_0x2be035){return _0x46cfae[_0x5226('0x1b')](_0xad8fb)[_0x5226('0x1c')](_0x2be035);}};}function respondWithFilteredResult(_0xcbf98c,_0x126ad3){return function(_0x112b17){if(_0x112b17){var _0x229a5f=_0x112b17[_0x5226('0x1d')],_0x5c5bfc=_0x126ad3['offset'],_0xc05815=_0x126ad3['offset']+_0x126ad3[_0x5226('0x1e')],_0x35b174;if(_0xc05815>=_0x229a5f){_0xc05815=_0x229a5f;_0x35b174=0xc8;}else{_0x35b174=0xce;}_0xcbf98c[_0x5226('0x1b')](_0x35b174);return _0xcbf98c[_0x5226('0x1f')](_0x5226('0x20'),_0x5c5bfc+'-'+_0xc05815+'/'+_0x229a5f)['json'](_0x112b17);}return null;};}function patchUpdates(_0x54757f){return function(_0x48a5fb){try{jsonpatch['apply'](_0x48a5fb,_0x54757f,!![]);}catch(_0x53e905){return BPromise['reject'](_0x53e905);}return _0x48a5fb[_0x5226('0x21')]();};}function saveUpdates(_0x48d455,_0x254ec7){return function(_0x17f51e){if(_0x17f51e){return _0x17f51e[_0x5226('0x22')](_0x48d455)[_0x5226('0x23')](function(_0x225c31){return _0x225c31;});}return null;};}function removeEntity(_0x1bd036,_0x11e546){return function(_0x4b0e3e){if(_0x4b0e3e){return _0x4b0e3e[_0x5226('0x24')]()[_0x5226('0x23')](function(){_0x1bd036[_0x5226('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0xfa1d48,_0x3798e4){return function(_0x3d80b6){if(!_0x3d80b6){_0xfa1d48[_0x5226('0x1a')](0x194);}return _0x3d80b6;};}function handleError(_0x478c55,_0x4656a1){_0x4656a1=_0x4656a1||0x1f4;return function(_0x4a7f47){logger['error'](_0x4a7f47[_0x5226('0x25')]);if(_0x4a7f47[_0x5226('0x26')]){delete _0x4a7f47[_0x5226('0x26')];}_0x478c55[_0x5226('0x1b')](_0x4656a1)['send'](_0x4a7f47);};}exports['update']=function(_0x565e0f,_0x56ab42){if(_0x565e0f['body']['id']){delete _0x565e0f[_0x5226('0x27')]['id'];}return db['Condition'][_0x5226('0x28')]({'where':{'id':_0x565e0f[_0x5226('0x29')]['id']}})[_0x5226('0x23')](handleEntityNotFound(_0x56ab42,null))['then'](saveUpdates(_0x565e0f['body'],null))[_0x5226('0x23')](respondWithResult(_0x56ab42,null))[_0x5226('0x2a')](handleError(_0x56ab42,null));};exports[_0x5226('0x24')]=function(_0x59df12,_0x1f3345){return db[_0x5226('0x2b')][_0x5226('0x28')]({'where':{'id':_0x59df12[_0x5226('0x29')]['id']}})[_0x5226('0x23')](handleEntityNotFound(_0x1f3345,null))[_0x5226('0x23')](removeEntity(_0x1f3345,null))[_0x5226('0x2a')](handleError(_0x1f3345,null));}; \ No newline at end of file +var _0xa327=['limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','body','find','params','catch','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset'];(function(_0x31ec29,_0x58915c){var _0x3275fc=function(_0x435075){while(--_0x435075){_0x31ec29['push'](_0x31ec29['shift']());}};_0x3275fc(++_0x58915c);}(_0xa327,0x136));var _0x7a32=function(_0x52151d,_0x599ee5){_0x52151d=_0x52151d-0x0;var _0x2f3738=_0xa327[_0x52151d];return _0x2f3738;};'use strict';var pdf=require(_0x7a32('0x0'));var emlformat=require(_0x7a32('0x1'));var rimraf=require(_0x7a32('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7a32('0x3'));var rp=require(_0x7a32('0x4'));var moment=require('moment');var BPromise=require(_0x7a32('0x5'));var Mustache=require(_0x7a32('0x6'));var util=require(_0x7a32('0x7'));var path=require(_0x7a32('0x8'));var sox=require(_0x7a32('0x9'));var csv=require(_0x7a32('0xa'));var ejs=require(_0x7a32('0xb'));var fs=require('fs');var _=require(_0x7a32('0xc'));var squel=require('squel');var crypto=require(_0x7a32('0xd'));var jsforce=require(_0x7a32('0xe'));var deskjs=require(_0x7a32('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7a32('0x10'));var Papa=require(_0x7a32('0x11'));var Redis=require(_0x7a32('0x12'));var authService=require(_0x7a32('0x13'));var qs=require(_0x7a32('0x14'));var as=require(_0x7a32('0x15'));var hardwareService=require(_0x7a32('0x16'));var logger=require(_0x7a32('0x17'))(_0x7a32('0x18'));var utils=require(_0x7a32('0x19'));var config=require(_0x7a32('0x1a'));var db=require(_0x7a32('0x1b'))['db'];function respondWithStatusCode(_0x272b39,_0x32d219){_0x32d219=_0x32d219||0xcc;return function(_0x27fdc5){if(_0x27fdc5){return _0x272b39[_0x7a32('0x1c')](_0x32d219);}return _0x272b39[_0x7a32('0x1d')](_0x32d219)[_0x7a32('0x1e')]();};}function respondWithResult(_0x39693f,_0x2880c7){_0x2880c7=_0x2880c7||0xc8;return function(_0x445c89){if(_0x445c89){return _0x39693f['status'](_0x2880c7)[_0x7a32('0x1f')](_0x445c89);}};}function respondWithFilteredResult(_0x4d1f64,_0x35f8b5){return function(_0x526286){if(_0x526286){var _0x20ff4f=_0x526286['count'],_0x24ee01=_0x35f8b5['offset'],_0x482416=_0x35f8b5[_0x7a32('0x20')]+_0x35f8b5[_0x7a32('0x21')],_0x247da8;if(_0x482416>=_0x20ff4f){_0x482416=_0x20ff4f;_0x247da8=0xc8;}else{_0x247da8=0xce;}_0x4d1f64[_0x7a32('0x1d')](_0x247da8);return _0x4d1f64[_0x7a32('0x22')](_0x7a32('0x23'),_0x24ee01+'-'+_0x482416+'/'+_0x20ff4f)[_0x7a32('0x1f')](_0x526286);}return null;};}function patchUpdates(_0x564d85){return function(_0x5f3dda){try{jsonpatch[_0x7a32('0x24')](_0x5f3dda,_0x564d85,!![]);}catch(_0x303e30){return BPromise['reject'](_0x303e30);}return _0x5f3dda[_0x7a32('0x25')]();};}function saveUpdates(_0x3ec7cf,_0x49d35c){return function(_0x507203){if(_0x507203){return _0x507203[_0x7a32('0x26')](_0x3ec7cf)[_0x7a32('0x27')](function(_0x3660b9){return _0x3660b9;});}return null;};}function removeEntity(_0x407ccf,_0x57e90b){return function(_0x2e84ad){if(_0x2e84ad){return _0x2e84ad[_0x7a32('0x28')]()['then'](function(){_0x407ccf['status'](0xcc)[_0x7a32('0x1e')]();});}};}function handleEntityNotFound(_0x31146f,_0x1d3b01){return function(_0x3acbc7){if(!_0x3acbc7){_0x31146f['sendStatus'](0x194);}return _0x3acbc7;};}function handleError(_0x184865,_0x43433f){_0x43433f=_0x43433f||0x1f4;return function(_0x4ea221){logger[_0x7a32('0x29')](_0x4ea221[_0x7a32('0x2a')]);if(_0x4ea221['name']){delete _0x4ea221[_0x7a32('0x2b')];}_0x184865['status'](_0x43433f)[_0x7a32('0x2c')](_0x4ea221);};}exports[_0x7a32('0x26')]=function(_0x40e753,_0x108d10){if(_0x40e753['body']['id']){delete _0x40e753[_0x7a32('0x2d')]['id'];}return db['Condition'][_0x7a32('0x2e')]({'where':{'id':_0x40e753[_0x7a32('0x2f')]['id']}})[_0x7a32('0x27')](handleEntityNotFound(_0x108d10,null))[_0x7a32('0x27')](saveUpdates(_0x40e753['body'],null))[_0x7a32('0x27')](respondWithResult(_0x108d10,null))[_0x7a32('0x30')](handleError(_0x108d10,null));};exports[_0x7a32('0x28')]=function(_0x55608c,_0x4868c5){return db['Condition']['find']({'where':{'id':_0x55608c[_0x7a32('0x2f')]['id']}})[_0x7a32('0x27')](handleEntityNotFound(_0x4868c5,null))[_0x7a32('0x27')](removeEntity(_0x4868c5,null))['catch'](handleError(_0x4868c5,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index f61dfb6..030b7f1 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 _0xfe17=['rimraf','../../config/environment','./condition.attributes','exports','define','Condition','tools_conditions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2cd1fb,_0x291f55){var _0x48fd2b=function(_0x18e23e){while(--_0x18e23e){_0x2cd1fb['push'](_0x2cd1fb['shift']());}};_0x48fd2b(++_0x291f55);}(_0xfe17,0x1b9));var _0x7fe1=function(_0x111bb6,_0x9ffdc){_0x111bb6=_0x111bb6-0x0;var _0x5499a3=_0xfe17[_0x111bb6];return _0x5499a3;};'use strict';var _=require('lodash');var util=require(_0x7fe1('0x0'));var logger=require(_0x7fe1('0x1'))(_0x7fe1('0x2'));var moment=require(_0x7fe1('0x3'));var BPromise=require(_0x7fe1('0x4'));var rp=require(_0x7fe1('0x5'));var fs=require('fs');var path=require(_0x7fe1('0x6'));var rimraf=require(_0x7fe1('0x7'));var config=require(_0x7fe1('0x8'));var attributes=require(_0x7fe1('0x9'));module[_0x7fe1('0xa')]=function(_0xc8d2b0,_0x16f29a){return _0xc8d2b0[_0x7fe1('0xb')](_0x7fe1('0xc'),attributes,{'tableName':_0x7fe1('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a49=['path','rimraf','./condition.attributes','exports','Condition','tools_conditions','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x2044cb,_0x13f554){var _0x69f7dd=function(_0x3d945d){while(--_0x3d945d){_0x2044cb['push'](_0x2044cb['shift']());}};_0x69f7dd(++_0x13f554);}(_0x7a49,0x1b6));var _0x97a4=function(_0x5ce16f,_0x2be67a){_0x5ce16f=_0x5ce16f-0x0;var _0x2a864a=_0x7a49[_0x5ce16f];return _0x2a864a;};'use strict';var _=require(_0x97a4('0x0'));var util=require('util');var logger=require(_0x97a4('0x1'))(_0x97a4('0x2'));var moment=require(_0x97a4('0x3'));var BPromise=require(_0x97a4('0x4'));var rp=require(_0x97a4('0x5'));var fs=require('fs');var path=require(_0x97a4('0x6'));var rimraf=require(_0x97a4('0x7'));var config=require('../../config/environment');var attributes=require(_0x97a4('0x8'));module[_0x97a4('0x9')]=function(_0xb26ef8,_0x365dd4){return _0xb26ef8['define'](_0x97a4('0xa'),attributes,{'tableName':_0x97a4('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index ba426f1..99df4d2 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 _0x59d7=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util'];(function(_0x378830,_0xb532d7){var _0x4e4348=function(_0x496bc4){while(--_0x496bc4){_0x378830['push'](_0x378830['shift']());}};_0x4e4348(++_0xb532d7);}(_0x59d7,0xc5));var _0x759d=function(_0x296809,_0x1c9665){_0x296809=_0x296809-0x0;var _0x18c0d3=_0x59d7[_0x296809];return _0x18c0d3;};'use strict';var _=require('lodash');var util=require(_0x759d('0x0'));var moment=require('moment');var BPromise=require(_0x759d('0x1'));var rs=require(_0x759d('0x2'));var fs=require('fs');var Redis=require(_0x759d('0x3'));var db=require(_0x759d('0x4'))['db'];var utils=require(_0x759d('0x5'));var logger=require(_0x759d('0x6'))('rpc');var config=require(_0x759d('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x759d('0x8')][_0x759d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5283a7,_0x4362ea,_0x378965){return new BPromise(function(_0x29be2a,_0x1b7d57){return client['request'](_0x5283a7,_0x378965)[_0x759d('0xa')](function(_0x48901d){logger[_0x759d('0xb')](_0x759d('0xc'),_0x4362ea,_0x759d('0xd'));logger[_0x759d('0xe')](_0x759d('0xf'),_0x4362ea,_0x759d('0xd'),JSON[_0x759d('0x10')](_0x48901d));if(_0x48901d[_0x759d('0x11')]){if(_0x48901d['error'][_0x759d('0x12')]===0x1f4){logger['error']('Condition,\x20%s,\x20%s',_0x4362ea,_0x48901d[_0x759d('0x11')][_0x759d('0x13')]);return _0x1b7d57(_0x48901d[_0x759d('0x11')][_0x759d('0x13')]);}logger[_0x759d('0x11')](_0x759d('0xc'),_0x4362ea,_0x48901d[_0x759d('0x11')]['message']);return _0x29be2a(_0x48901d[_0x759d('0x11')]['message']);}else{logger[_0x759d('0xb')](_0x759d('0xc'),_0x4362ea,_0x759d('0xd'));_0x29be2a(_0x48901d[_0x759d('0x14')]['message']);}})[_0x759d('0x15')](function(_0x1e0c18){logger[_0x759d('0x11')](_0x759d('0xc'),_0x4362ea,_0x1e0c18);_0x1b7d57(_0x1e0c18);});});} \ No newline at end of file +var _0x14ef=['request\x20sent','debug','error','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info'];(function(_0x1631ad,_0x3769e8){var _0x44be06=function(_0x380b08){while(--_0x380b08){_0x1631ad['push'](_0x1631ad['shift']());}};_0x44be06(++_0x3769e8);}(_0x14ef,0x1cf));var _0xf14e=function(_0x3ed25d,_0x6c37b2){_0x3ed25d=_0x3ed25d-0x0;var _0x5e0998=_0x14ef[_0x3ed25d];return _0x5e0998;};'use strict';var _=require(_0xf14e('0x0'));var util=require(_0xf14e('0x1'));var moment=require(_0xf14e('0x2'));var BPromise=require('bluebird');var rs=require(_0xf14e('0x3'));var fs=require('fs');var Redis=require(_0xf14e('0x4'));var db=require(_0xf14e('0x5'))['db'];var utils=require(_0xf14e('0x6'));var logger=require(_0xf14e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf14e('0x8')][_0xf14e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x139fcc,_0x1e8dc3,_0x5715a7){return new BPromise(function(_0x22620c,_0x4dffa2){return client['request'](_0x139fcc,_0x5715a7)[_0xf14e('0xa')](function(_0x295bb1){logger[_0xf14e('0xb')]('Condition,\x20%s,\x20%s',_0x1e8dc3,_0xf14e('0xc'));logger[_0xf14e('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x1e8dc3,_0xf14e('0xc'),JSON['stringify'](_0x295bb1));if(_0x295bb1[_0xf14e('0xe')]){if(_0x295bb1[_0xf14e('0xe')]['code']===0x1f4){logger['error'](_0xf14e('0xf'),_0x1e8dc3,_0x295bb1[_0xf14e('0xe')][_0xf14e('0x10')]);return _0x4dffa2(_0x295bb1[_0xf14e('0xe')]['message']);}logger[_0xf14e('0xe')](_0xf14e('0xf'),_0x1e8dc3,_0x295bb1[_0xf14e('0xe')]['message']);return _0x22620c(_0x295bb1[_0xf14e('0xe')][_0xf14e('0x10')]);}else{logger[_0xf14e('0xb')](_0xf14e('0xf'),_0x1e8dc3,_0xf14e('0xc'));_0x22620c(_0x295bb1[_0xf14e('0x11')][_0xf14e('0x10')]);}})[_0xf14e('0x12')](function(_0x437907){logger[_0xf14e('0xe')]('Condition,\x20%s,\x20%s',_0x1e8dc3,_0x437907);_0x4dffa2(_0x437907);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 046dee7..4d272c4 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 _0x5e22=['./condition.controller','put','isAuthenticated','update','delete','exports','multer','util','path','express','Router','../../config/environment'];(function(_0x4880a2,_0x134ca4){var _0xff1f84=function(_0x36490b){while(--_0x36490b){_0x4880a2['push'](_0x4880a2['shift']());}};_0xff1f84(++_0x134ca4);}(_0x5e22,0x11a));var _0x25e2=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0x5e22[_0x22f8ab];return _0x2a70e5;};'use strict';var multer=require(_0x25e2('0x0'));var util=require(_0x25e2('0x1'));var path=require(_0x25e2('0x2'));var timeout=require('connect-timeout');var express=require(_0x25e2('0x3'));var router=express[_0x25e2('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x25e2('0x5'));var controller=require(_0x25e2('0x6'));router[_0x25e2('0x7')]('/:id',auth[_0x25e2('0x8')](),controller[_0x25e2('0x9')]);router[_0x25e2('0xa')]('/:id',auth[_0x25e2('0x8')](),controller['destroy']);module[_0x25e2('0xb')]=router; \ No newline at end of file +var _0x62f3=['update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./condition.controller','/:id','isAuthenticated'];(function(_0x4ed281,_0x1d23b0){var _0x300161=function(_0x186cc8){while(--_0x186cc8){_0x4ed281['push'](_0x4ed281['shift']());}};_0x300161(++_0x1d23b0);}(_0x62f3,0x1a6));var _0x362f=function(_0x413ce5,_0x26c4ab){_0x413ce5=_0x413ce5-0x0;var _0x43d335=_0x62f3[_0x413ce5];return _0x43d335;};'use strict';var multer=require(_0x362f('0x0'));var util=require(_0x362f('0x1'));var path=require(_0x362f('0x2'));var timeout=require(_0x362f('0x3'));var express=require(_0x362f('0x4'));var router=express['Router']();var auth=require(_0x362f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x362f('0x6'));var controller=require(_0x362f('0x7'));router['put'](_0x362f('0x8'),auth[_0x362f('0x9')](),controller[_0x362f('0xa')]);router[_0x362f('0xb')](_0x362f('0x8'),auth[_0x362f('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 4549355..85a745f 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 _0xb2ac=['STRING','name','sequelize','exports'];(function(_0x4fb22c,_0x3a67ef){var _0x819153=function(_0x2875d0){while(--_0x2875d0){_0x4fb22c['push'](_0x4fb22c['shift']());}};_0x819153(++_0x3a67ef);}(_0xb2ac,0x16a));var _0xcb2a=function(_0x2af023,_0x352505){_0x2af023=_0x2af023-0x0;var _0x437526=_0xb2ac[_0x2af023];return _0x437526;};'use strict';var Sequelize=require(_0xcb2a('0x0'));module[_0xcb2a('0x1')]={'name':{'type':Sequelize[_0xcb2a('0x2')],'allowNull':![],'unique':_0xcb2a('0x3')},'description':{'type':Sequelize[_0xcb2a('0x2')]}}; \ No newline at end of file +var _0xeac1=['STRING','name','exports'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xeac1,0x146));var _0x1eac=function(_0x5a06d9,_0xbcb06){_0x5a06d9=_0x5a06d9-0x0;var _0x42478b=_0xeac1[_0x5a06d9];return _0x42478b;};'use strict';var Sequelize=require('sequelize');module[_0x1eac('0x0')]={'name':{'type':Sequelize[_0x1eac('0x1')],'allowNull':![],'unique':_0x1eac('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index 2b992e8..a5415d7 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 _0x188e=['json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','filter','merge','Dashboard','include','findAll','rows','catch','show','keys','includeAll','options','find','user','role','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','createdAt','updatedAt','body','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardId','DashboardItem','getItems','findOne','pick','hasOwnProperty','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status'];(function(_0x5da877,_0x361726){var _0x3f2c10=function(_0x3a2ebc){while(--_0x3a2ebc){_0x5da877['push'](_0x5da877['shift']());}};_0x3f2c10(++_0x361726);}(_0x188e,0x1cf));var _0xe188=function(_0x1d5ba4,_0x40b3b6){_0x1d5ba4=_0x1d5ba4-0x0;var _0x554955=_0x188e[_0x1d5ba4];return _0x554955;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe188('0x0'));var rimraf=require(_0xe188('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe188('0x2'));var rp=require(_0xe188('0x3'));var moment=require(_0xe188('0x4'));var BPromise=require(_0xe188('0x5'));var Mustache=require(_0xe188('0x6'));var util=require(_0xe188('0x7'));var path=require(_0xe188('0x8'));var sox=require('sox');var csv=require(_0xe188('0x9'));var ejs=require(_0xe188('0xa'));var fs=require('fs');var _=require(_0xe188('0xb'));var squel=require(_0xe188('0xc'));var crypto=require(_0xe188('0xd'));var jsforce=require(_0xe188('0xe'));var deskjs=require(_0xe188('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe188('0x10'));var Papa=require(_0xe188('0x11'));var Redis=require(_0xe188('0x12'));var authService=require(_0xe188('0x13'));var qs=require(_0xe188('0x14'));var as=require(_0xe188('0x15'));var hardwareService=require(_0xe188('0x16'));var logger=require('../../config/logger')(_0xe188('0x17'));var utils=require(_0xe188('0x18'));var config=require(_0xe188('0x19'));var db=require('../../mysqldb')['db'];config[_0xe188('0x1a')]=_[_0xe188('0x1b')](config[_0xe188('0x1a')],{'host':_0xe188('0x1c'),'port':0x18eb});var socket=require(_0xe188('0x1d'))(new Redis(config[_0xe188('0x1a')]));require('./dashboard.socket')[_0xe188('0x1e')](socket);function respondWithStatusCode(_0x3fc589,_0x2c190a){_0x2c190a=_0x2c190a||0xcc;return function(_0x432f4b){if(_0x432f4b){return _0x3fc589[_0xe188('0x1f')](_0x2c190a);}return _0x3fc589[_0xe188('0x20')](_0x2c190a)['end']();};}function respondWithResult(_0x3ae93f,_0x1ff120){_0x1ff120=_0x1ff120||0xc8;return function(_0x4231ad){if(_0x4231ad){return _0x3ae93f['status'](_0x1ff120)[_0xe188('0x21')](_0x4231ad);}};}function respondWithFilteredResult(_0x225447,_0x140c51){return function(_0x28ec69){if(_0x28ec69){var _0x2f1ea2=_0x28ec69[_0xe188('0x22')],_0x1d65d8=_0x140c51['offset'],_0x28d1e8=_0x140c51[_0xe188('0x23')]+_0x140c51['limit'],_0x284c3b;if(_0x28d1e8>=_0x2f1ea2){_0x28d1e8=_0x2f1ea2;_0x284c3b=0xc8;}else{_0x284c3b=0xce;}_0x225447[_0xe188('0x20')](_0x284c3b);return _0x225447[_0xe188('0x24')](_0xe188('0x25'),_0x1d65d8+'-'+_0x28d1e8+'/'+_0x2f1ea2)[_0xe188('0x21')](_0x28ec69);}return null;};}function patchUpdates(_0x1d5ae0){return function(_0x5b0840){try{jsonpatch[_0xe188('0x26')](_0x5b0840,_0x1d5ae0,!![]);}catch(_0x574589){return BPromise[_0xe188('0x27')](_0x574589);}return _0x5b0840[_0xe188('0x28')]();};}function saveUpdates(_0x4f93a7,_0x10c55f){return function(_0x508156){if(_0x508156){return _0x508156[_0xe188('0x29')](_0x4f93a7)[_0xe188('0x2a')](function(_0x4b9ec6){return _0x4b9ec6;});}return null;};}function removeEntity(_0x52856d,_0x3e7640){return function(_0x487906){if(_0x487906){return _0x487906[_0xe188('0x2b')]()[_0xe188('0x2a')](function(){var _0x3d280a=_0x487906[_0xe188('0x2c')]({'plain':!![]});var _0x2f47fc=_0xe188('0x2d');return db[_0xe188('0x2e')]['destroy']({'where':{'type':_0x2f47fc,'resourceId':_0x3d280a['id']}})['then'](function(){return _0x487906;});})['then'](function(){_0x52856d[_0xe188('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2700b8,_0x52282b){return function(_0x5dd9ef){if(!_0x5dd9ef){_0x2700b8['sendStatus'](0x194);}return _0x5dd9ef;};}function handleError(_0x1b2c25,_0x2e8b75){_0x2e8b75=_0x2e8b75||0x1f4;return function(_0x33ef8a){logger[_0xe188('0x2f')](_0x33ef8a[_0xe188('0x30')]);if(_0x33ef8a[_0xe188('0x31')]){delete _0x33ef8a[_0xe188('0x31')];}_0x1b2c25['status'](_0x2e8b75)['send'](_0x33ef8a);};}exports['index']=function(_0x2f008f,_0x166fcd){var _0xf7747d={},_0x1e4cfb={},_0x4c24b1={'count':0x0,'rows':[]};var _0x1d0c3d=_[_0xe188('0x32')](db['Dashboard'][_0xe188('0x33')],function(_0x541074){return{'name':_0x541074[_0xe188('0x34')],'type':_0x541074[_0xe188('0x35')][_0xe188('0x36')]};});_0x1e4cfb[_0xe188('0x37')]=_[_0xe188('0x32')](_0x1d0c3d,_0xe188('0x31'));_0x1e4cfb[_0xe188('0x38')]=_['keys'](_0x2f008f[_0xe188('0x38')]);_0x1e4cfb[_0xe188('0x39')]=_[_0xe188('0x3a')](_0x1e4cfb[_0xe188('0x37')],_0x1e4cfb[_0xe188('0x38')]);_0xf7747d['attributes']=_[_0xe188('0x3a')](_0x1e4cfb[_0xe188('0x37')],qs[_0xe188('0x3b')](_0x2f008f[_0xe188('0x38')][_0xe188('0x3b')]));_0xf7747d[_0xe188('0x3c')]=_0xf7747d[_0xe188('0x3c')][_0xe188('0x3d')]?_0xf7747d[_0xe188('0x3c')]:_0x1e4cfb['model'];if(!_0x2f008f[_0xe188('0x38')]['hasOwnProperty'](_0xe188('0x3e'))){_0xf7747d['limit']=qs[_0xe188('0x3f')](_0x2f008f[_0xe188('0x38')][_0xe188('0x3f')]);_0xf7747d[_0xe188('0x23')]=qs[_0xe188('0x23')](_0x2f008f[_0xe188('0x38')]['offset']);}_0xf7747d[_0xe188('0x40')]=qs[_0xe188('0x41')](_0x2f008f[_0xe188('0x38')][_0xe188('0x41')]);_0xf7747d[_0xe188('0x42')]=qs['filters'](_['pick'](_0x2f008f[_0xe188('0x38')],_0x1e4cfb[_0xe188('0x39')]));if(_0x2f008f[_0xe188('0x38')][_0xe188('0x43')]){_0xf7747d[_0xe188('0x42')]=_[_0xe188('0x44')](_0xf7747d[_0xe188('0x42')],{'$or':_['map'](_0x1d0c3d,function(_0x3ca8cf){if(_0x3ca8cf[_0xe188('0x35')]!=='VIRTUAL'){var _0x737d83={};_0x737d83[_0x3ca8cf[_0xe188('0x31')]]={'$like':'%'+_0x2f008f['query'][_0xe188('0x43')]+'%'};return _0x737d83;}})});}_0xf7747d=_[_0xe188('0x44')]({},_0xf7747d,_0x2f008f['options']);var _0x36ebb6={'where':_0xf7747d[_0xe188('0x42')]};return db[_0xe188('0x45')][_0xe188('0x22')](_0x36ebb6)[_0xe188('0x2a')](function(_0xb078ed){_0x4c24b1[_0xe188('0x22')]=_0xb078ed;if(_0x2f008f[_0xe188('0x38')]['includeAll']){_0xf7747d[_0xe188('0x46')]=[{'all':!![]}];}return db[_0xe188('0x45')][_0xe188('0x47')](_0xf7747d);})['then'](function(_0x1c61f7){_0x4c24b1[_0xe188('0x48')]=_0x1c61f7;return _0x4c24b1;})[_0xe188('0x2a')](respondWithFilteredResult(_0x166fcd,_0xf7747d))[_0xe188('0x49')](handleError(_0x166fcd,null));};exports[_0xe188('0x4a')]=function(_0x2a1508,_0x2cb591){var _0x26e08e={'raw':![],'where':{'id':_0x2a1508['params']['id']}},_0x1bf993={};_0x1bf993[_0xe188('0x37')]=_[_0xe188('0x4b')](db['Dashboard'][_0xe188('0x33')]);_0x1bf993['query']=_[_0xe188('0x4b')](_0x2a1508[_0xe188('0x38')]);_0x1bf993[_0xe188('0x39')]=_[_0xe188('0x3a')](_0x1bf993[_0xe188('0x37')],_0x1bf993['query']);_0x26e08e[_0xe188('0x3c')]=_[_0xe188('0x3a')](_0x1bf993[_0xe188('0x37')],qs[_0xe188('0x3b')](_0x2a1508[_0xe188('0x38')][_0xe188('0x3b')]));_0x26e08e['attributes']=_0x26e08e['attributes'][_0xe188('0x3d')]?_0x26e08e[_0xe188('0x3c')]:_0x1bf993[_0xe188('0x37')];if(_0x2a1508['query'][_0xe188('0x4c')]){_0x26e08e[_0xe188('0x46')]=[{'all':!![]}];}_0x26e08e=_['merge']({},_0x26e08e,_0x2a1508[_0xe188('0x4d')]);return db[_0xe188('0x45')][_0xe188('0x4e')](_0x26e08e)['then'](handleEntityNotFound(_0x2cb591,null))[_0xe188('0x2a')](respondWithResult(_0x2cb591,null))[_0xe188('0x49')](handleError(_0x2cb591,null));};exports['create']=function(_0x330816,_0x56355f){return db[_0xe188('0x45')]['create'](_0x330816['body'],{})['then'](function(_0x47628c){var _0x3868bc=_0x330816[_0xe188('0x4f')]['get']({'plain':!![]});if(!_0x3868bc)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3868bc[_0xe188('0x50')]===_0xe188('0x4f')){var _0x48631d=_0x47628c[_0xe188('0x2c')]({'plain':!![]});var _0x33927a=_0xe188('0x2d');return db['UserProfileSection'][_0xe188('0x4e')]({'where':{'name':_0x33927a,'userProfileId':_0x3868bc[_0xe188('0x51')]},'raw':!![]})[_0xe188('0x2a')](function(_0x58464e){if(_0x58464e&&_0x58464e[_0xe188('0x52')]===0x0){return db[_0xe188('0x2e')][_0xe188('0x53')]({'name':_0x48631d['name'],'resourceId':_0x48631d['id'],'type':_0x58464e[_0xe188('0x31')],'sectionId':_0x58464e['id']},{})[_0xe188('0x2a')](function(){return _0x47628c;});}else{return _0x47628c;}})['catch'](function(_0x11ddd7){logger[_0xe188('0x2f')](_0xe188('0x54'),_0x11ddd7);throw _0x11ddd7;});}return _0x47628c;})[_0xe188('0x2a')](respondWithResult(_0x56355f,0xc9))['catch'](handleError(_0x56355f,null));};exports['clone']=function(_0x14c27f,_0xcf6092){var _0x4450eb={'where':{'id':_0x14c27f[_0xe188('0x55')]['id']}},_0x452360={};_0x452360['model']=_[_0xe188('0x4b')](db[_0xe188('0x45')][_0xe188('0x33')]);_0x4450eb['attributes']=_['intersection'](_0x452360[_0xe188('0x37')],qs[_0xe188('0x3b')](_0x14c27f['query'][_0xe188('0x3b')]));_0x4450eb['attributes']=_0x4450eb[_0xe188('0x3c')][_0xe188('0x3d')]?_0x4450eb[_0xe188('0x3c')]:_0x452360[_0xe188('0x37')];if(_0x14c27f[_0xe188('0x38')][_0xe188('0x4c')]){_0x4450eb[_0xe188('0x46')]=[{'all':!![]}];}_0x4450eb=_[_0xe188('0x44')]({},_0x4450eb,_0x14c27f['options']);return db['Dashboard'][_0xe188('0x4e')](_0x4450eb)[_0xe188('0x2a')](handleEntityNotFound(_0xcf6092,null))[_0xe188('0x2a')](function(_0x43e994){if(_0x43e994){var _0x200d68=_0x43e994[_0xe188('0x2c')]({'plain':!![]});_0x200d68=qs['omit'](_0x200d68,['id',_0xe188('0x56'),_0xe188('0x57')]);_0x14c27f[_0xe188('0x58')]=_[_0xe188('0x59')](_0x14c27f['body'],['id',_0xe188('0x56'),'updatedAt']);return db[_0xe188('0x45')]['create'](_[_0xe188('0x44')](_0x200d68,_0x14c27f[_0xe188('0x58')]),{'include':_0x14c27f[_0xe188('0x38')][_0xe188('0x4c')]?[{'all':!![]}]:undefined})['then'](function(_0x67f5cf){var _0x1b5ad0=_0x14c27f[_0xe188('0x4f')][_0xe188('0x2c')]({'plain':!![]});if(!_0x1b5ad0)throw new Error(_0xe188('0x5a'));if(_0x1b5ad0[_0xe188('0x50')]===_0xe188('0x4f')){var _0x463607=_0x67f5cf[_0xe188('0x2c')]({'plain':!![]});var _0x26902f=_0xe188('0x2d');return db['UserProfileSection'][_0xe188('0x4e')]({'where':{'name':_0x26902f,'userProfileId':_0x1b5ad0[_0xe188('0x51')]},'raw':!![]})[_0xe188('0x2a')](function(_0x3db63f){if(_0x3db63f&&_0x3db63f[_0xe188('0x52')]===0x0){return db[_0xe188('0x2e')][_0xe188('0x53')]({'name':_0x463607[_0xe188('0x31')],'resourceId':_0x463607['id'],'type':_0x3db63f[_0xe188('0x31')],'sectionId':_0x3db63f['id']},{})[_0xe188('0x2a')](function(){return _0x67f5cf;});}else{return _0x67f5cf;}})['catch'](function(_0x45082e){logger[_0xe188('0x2f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x45082e);throw _0x45082e;});}return _0x67f5cf;});}})[_0xe188('0x2a')](respondWithResult(_0xcf6092,0xc9))[_0xe188('0x49')](handleError(_0xcf6092,null));};exports[_0xe188('0x29')]=function(_0x6bb379,_0x2d4884){if(_0x6bb379[_0xe188('0x58')]['id']){delete _0x6bb379['body']['id'];}return db['Dashboard'][_0xe188('0x4e')]({'where':{'id':_0x6bb379[_0xe188('0x55')]['id']}})[_0xe188('0x2a')](handleEntityNotFound(_0x2d4884,null))[_0xe188('0x2a')](saveUpdates(_0x6bb379['body'],null))[_0xe188('0x2a')](respondWithResult(_0x2d4884,null))[_0xe188('0x49')](handleError(_0x2d4884,null));};exports[_0xe188('0x2b')]=function(_0x108a8b,_0x29cfc8){return db['Dashboard'][_0xe188('0x4e')]({'where':{'id':_0x108a8b[_0xe188('0x55')]['id']}})[_0xe188('0x2a')](handleEntityNotFound(_0x29cfc8,null))[_0xe188('0x2a')](removeEntity(_0x29cfc8,null))['catch'](handleError(_0x29cfc8,null));};function widgetAttributes(_0x3a6487){try{switch(_0x3a6487[_0xe188('0x35')]){case _0xe188('0x5b'):return[{'name':_0xe188('0x5c'),'value':_0x3a6487[_0xe188('0x5c')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487[_0xe188('0x5d')][0x0][_0xe188('0x5e')]:undefined)||_0xe188('0x5f')}];case _0xe188('0x60'):return[{'name':'attrPath','value':_0x3a6487[_0xe188('0x61')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487[_0xe188('0x5d')][0x0][_0xe188('0x5e')]:undefined)||''}];case _0xe188('0x62'):return[{'name':_0xe188('0x63'),'value':_0x3a6487[_0xe188('0x63')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487[_0xe188('0x5d')][0x0][_0xe188('0x5e')]:undefined)||_0xe188('0x64')},{'name':_0xe188('0x65'),'value':_0x3a6487['attrTimezone']||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x1]?_0x3a6487[_0xe188('0x5d')][0x1]['value']:undefined)||_0xe188('0x66')},{'name':_0xe188('0x67'),'value':_0x3a6487['attrFontSize']||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x2]?_0x3a6487[_0xe188('0x5d')][0x2]['value']:undefined)||0xc}];case _0xe188('0x68'):return[{'name':_0xe188('0x69'),'value':_0x3a6487[_0xe188('0x69')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487['attrs'][0x0][_0xe188('0x5e')]:undefined)||_0xe188('0x6a')},{'name':_0xe188('0x6b'),'value':_0x3a6487['attrVoiceQueues']||(_0x3a6487['attrs']&&_0x3a6487[_0xe188('0x5d')][0x1]?_0x3a6487['attrs'][0x1][_0xe188('0x5e')]:undefined)||[]},{'name':_0xe188('0x67'),'value':_0x3a6487['attrFontSize']||(_0x3a6487['attrs']&&_0x3a6487[_0xe188('0x5d')][0x2]?_0x3a6487[_0xe188('0x5d')][0x2][_0xe188('0x5e')]:undefined)||0x14}];case _0xe188('0x6c'):case _0xe188('0x6d'):return[{'name':_0xe188('0x6e'),'value':_0x3a6487[_0xe188('0x6e')]||(_0x3a6487['attrs']&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487['attrs'][0x0][_0xe188('0x5e')]:undefined)||_0xe188('0x6a')},{'name':_0xe188('0x6f'),'value':_0x3a6487[_0xe188('0x6f')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487['attrs'][0x1]?_0x3a6487['attrs'][0x1][_0xe188('0x5e')]:undefined)||null},{'name':'attrSerie3','value':_0x3a6487[_0xe188('0x70')]||(_0x3a6487['attrs']&&_0x3a6487[_0xe188('0x5d')][0x2]?_0x3a6487['attrs'][0x2][_0xe188('0x5e')]:undefined)||null},{'name':_0xe188('0x6b'),'value':_0x3a6487['attrVoiceQueues']||(_0x3a6487['attrs']&&_0x3a6487['attrs'][0x3]?_0x3a6487[_0xe188('0x5d')][0x3][_0xe188('0x5e')]:undefined)||[]}];case _0xe188('0x71'):return[{'name':'attrReport','type':_0x3a6487['reportType']||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487['attrs'][0x0]?_0x3a6487[_0xe188('0x5d')][0x0][_0xe188('0x35')]:undefined)||null,'value':_0x3a6487[_0xe188('0x72')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x0]?_0x3a6487[_0xe188('0x5d')][0x0][_0xe188('0x5e')]:undefined)||null},{'name':_0xe188('0x73'),'value':_0x3a6487[_0xe188('0x73')]||(_0x3a6487[_0xe188('0x5d')]&&_0x3a6487[_0xe188('0x5d')][0x1]?_0x3a6487[_0xe188('0x5d')][0x1][_0xe188('0x5e')]:undefined)||0x0}];default:return[];}}catch(_0xd0b068){logger[_0xe188('0x2f')](_0xe188('0x74'),JSON['stringify'](_0xd0b068));return[];}}exports[_0xe188('0x75')]=function(_0x29fd05,_0x4577b3,_0x3b091e){if(_0x29fd05[_0xe188('0x58')]['id']){delete _0x29fd05[_0xe188('0x58')]['id'];}return db[_0xe188('0x45')]['find']({'where':{'id':_0x29fd05[_0xe188('0x55')]['id']}})[_0xe188('0x2a')](handleEntityNotFound(_0x4577b3,null))[_0xe188('0x2a')](function(_0x4f3d52){if(_0x4f3d52){_0x29fd05['body'][_0xe188('0x76')]=_0x4f3d52['id'];_0x29fd05[_0xe188('0x58')][_0xe188('0x5d')]=widgetAttributes(_0x29fd05[_0xe188('0x58')]);return db[_0xe188('0x77')][_0xe188('0x53')](_0x29fd05[_0xe188('0x58')]);}})[_0xe188('0x2a')](respondWithResult(_0x4577b3,null))[_0xe188('0x49')](handleError(_0x4577b3,null));};exports[_0xe188('0x78')]=function(_0x554958,_0x12e447,_0x4db83a){var _0x32dd6d={};var _0x4604b2={};var _0x4660a3;var _0x45b976;return db['Dashboard'][_0xe188('0x79')]({'where':{'id':_0x554958['params']['id']}})[_0xe188('0x2a')](handleEntityNotFound(_0x12e447,null))[_0xe188('0x2a')](function(_0x268bed){if(_0x268bed){_0x4660a3=_0x268bed;_0x4604b2['model']=_[_0xe188('0x4b')](db[_0xe188('0x77')]['rawAttributes']);_0x4604b2[_0xe188('0x38')]=_['keys'](_0x554958['query']);_0x4604b2[_0xe188('0x39')]=_[_0xe188('0x3a')](_0x4604b2[_0xe188('0x37')],_0x4604b2[_0xe188('0x38')]);_0x32dd6d['attributes']=_[_0xe188('0x3a')](_0x4604b2[_0xe188('0x37')],qs['fields'](_0x554958[_0xe188('0x38')][_0xe188('0x3b')]));_0x32dd6d[_0xe188('0x3c')]=_0x32dd6d['attributes'][_0xe188('0x3d')]?_0x32dd6d[_0xe188('0x3c')]:_0x4604b2[_0xe188('0x37')];_0x32dd6d[_0xe188('0x40')]=qs[_0xe188('0x41')](_0x554958[_0xe188('0x38')]['sort']);_0x32dd6d['where']=qs[_0xe188('0x39')](_[_0xe188('0x7a')](_0x554958['query'],_0x4604b2[_0xe188('0x39')]));if(_0x554958['query']['filter']){_0x32dd6d[_0xe188('0x42')]=_[_0xe188('0x44')](_0x32dd6d[_0xe188('0x42')],{'$or':_[_0xe188('0x32')](_0x32dd6d['attributes'],function(_0x4e749b){var _0x282a41={};_0x282a41[_0x4e749b]={'$like':'%'+_0x554958['query'][_0xe188('0x43')]+'%'};return _0x282a41;})});}_0x32dd6d=_['merge']({},_0x32dd6d,_0x554958['options']);return _0x4660a3[_0xe188('0x78')](_0x32dd6d);}})[_0xe188('0x2a')](function(_0x5a5188){if(_0x5a5188){_0x45b976=_0x5a5188['length'];if(!_0x554958[_0xe188('0x38')][_0xe188('0x7b')]('nolimit')){_0x32dd6d[_0xe188('0x3f')]=qs['limit'](_0x554958[_0xe188('0x38')][_0xe188('0x3f')]);_0x32dd6d[_0xe188('0x23')]=qs[_0xe188('0x23')](_0x554958[_0xe188('0x38')][_0xe188('0x23')]);}return _0x4660a3[_0xe188('0x78')](_0x32dd6d);}})['then'](function(_0x382667){if(_0x382667){return _0x382667?{'count':_0x45b976,'rows':_0x382667}:null;}})[_0xe188('0x2a')](respondWithResult(_0x12e447,null))[_0xe188('0x49')](handleError(_0x12e447,null));}; \ No newline at end of file +var _0x5bbd=['rawAttributes','fieldName','type','key','map','query','filters','model','attributes','intersection','fields','length','nolimit','sort','pick','filter','VIRTUAL','options','where','include','findAll','rows','catch','params','keys','includeAll','merge','find','body','user','get','role','UserProfileSection','userProfileId','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','updatedAt','omit','Unable\x20to\x20retrieve\x20the\x20current\x20user','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardId','DashboardItem','getItems','findOne','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','defaults','localhost','redis','./dashboard.socket','end','status','json','count','offset','limit','set','Content-Range','reject','update','then','destroy','CustomDashboards','UserProfileResource','sendStatus','error','stack','name','send','index','Dashboard'];(function(_0x2281af,_0x251abd){var _0x10b37f=function(_0x51e1ad){while(--_0x51e1ad){_0x2281af['push'](_0x2281af['shift']());}};_0x10b37f(++_0x251abd);}(_0x5bbd,0x12b));var _0xd5bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5bbd[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xd5bb('0x0'));var emlformat=require(_0xd5bb('0x1'));var rimraf=require(_0xd5bb('0x2'));var zipdir=require(_0xd5bb('0x3'));var jsonpatch=require(_0xd5bb('0x4'));var rp=require(_0xd5bb('0x5'));var moment=require(_0xd5bb('0x6'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd5bb('0x7'));var sox=require(_0xd5bb('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xd5bb('0x9'));var squel=require('squel');var crypto=require(_0xd5bb('0xa'));var jsforce=require(_0xd5bb('0xb'));var deskjs=require(_0xd5bb('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd5bb('0xd'));var Redis=require(_0xd5bb('0xe'));var authService=require(_0xd5bb('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5bb('0x10'));var hardwareService=require(_0xd5bb('0x11'));var logger=require(_0xd5bb('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xd5bb('0x13'));var db=require(_0xd5bb('0x14'))['db'];config['redis']=_[_0xd5bb('0x15')](config['redis'],{'host':_0xd5bb('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd5bb('0x17')]));require(_0xd5bb('0x18'))['register'](socket);function respondWithStatusCode(_0x37bb78,_0x1f54eb){_0x1f54eb=_0x1f54eb||0xcc;return function(_0x140b49){if(_0x140b49){return _0x37bb78['sendStatus'](_0x1f54eb);}return _0x37bb78['status'](_0x1f54eb)[_0xd5bb('0x19')]();};}function respondWithResult(_0xa014fe,_0x516418){_0x516418=_0x516418||0xc8;return function(_0x2210d0){if(_0x2210d0){return _0xa014fe[_0xd5bb('0x1a')](_0x516418)[_0xd5bb('0x1b')](_0x2210d0);}};}function respondWithFilteredResult(_0x34c529,_0x510d9b){return function(_0x2de3c8){if(_0x2de3c8){var _0x41bc89=_0x2de3c8[_0xd5bb('0x1c')],_0x567d06=_0x510d9b['offset'],_0x3d312f=_0x510d9b[_0xd5bb('0x1d')]+_0x510d9b[_0xd5bb('0x1e')],_0x222b0c;if(_0x3d312f>=_0x41bc89){_0x3d312f=_0x41bc89;_0x222b0c=0xc8;}else{_0x222b0c=0xce;}_0x34c529[_0xd5bb('0x1a')](_0x222b0c);return _0x34c529[_0xd5bb('0x1f')](_0xd5bb('0x20'),_0x567d06+'-'+_0x3d312f+'/'+_0x41bc89)[_0xd5bb('0x1b')](_0x2de3c8);}return null;};}function patchUpdates(_0x56a68c){return function(_0x1b5a78){try{jsonpatch['apply'](_0x1b5a78,_0x56a68c,!![]);}catch(_0x502e86){return BPromise[_0xd5bb('0x21')](_0x502e86);}return _0x1b5a78['save']();};}function saveUpdates(_0x53f959,_0x118e3d){return function(_0x4765b7){if(_0x4765b7){return _0x4765b7[_0xd5bb('0x22')](_0x53f959)[_0xd5bb('0x23')](function(_0x285609){return _0x285609;});}return null;};}function removeEntity(_0x52383c,_0x2685ad){return function(_0x44e419){if(_0x44e419){return _0x44e419[_0xd5bb('0x24')]()[_0xd5bb('0x23')](function(){var _0xe53b0=_0x44e419['get']({'plain':!![]});var _0x5d5dac=_0xd5bb('0x25');return db[_0xd5bb('0x26')][_0xd5bb('0x24')]({'where':{'type':_0x5d5dac,'resourceId':_0xe53b0['id']}})[_0xd5bb('0x23')](function(){return _0x44e419;});})[_0xd5bb('0x23')](function(){_0x52383c['status'](0xcc)[_0xd5bb('0x19')]();});}};}function handleEntityNotFound(_0x4f6ec6,_0x30fa6d){return function(_0x188b13){if(!_0x188b13){_0x4f6ec6[_0xd5bb('0x27')](0x194);}return _0x188b13;};}function handleError(_0x32a83e,_0x10e5a6){_0x10e5a6=_0x10e5a6||0x1f4;return function(_0x31d1d1){logger[_0xd5bb('0x28')](_0x31d1d1[_0xd5bb('0x29')]);if(_0x31d1d1[_0xd5bb('0x2a')]){delete _0x31d1d1[_0xd5bb('0x2a')];}_0x32a83e[_0xd5bb('0x1a')](_0x10e5a6)[_0xd5bb('0x2b')](_0x31d1d1);};}exports[_0xd5bb('0x2c')]=function(_0x965a7f,_0x12aeea){var _0x2a6a4a={},_0x4db50b={},_0x12fa21={'count':0x0,'rows':[]};var _0x1a0166=_['map'](db[_0xd5bb('0x2d')][_0xd5bb('0x2e')],function(_0x4b8625){return{'name':_0x4b8625[_0xd5bb('0x2f')],'type':_0x4b8625[_0xd5bb('0x30')][_0xd5bb('0x31')]};});_0x4db50b['model']=_[_0xd5bb('0x32')](_0x1a0166,_0xd5bb('0x2a'));_0x4db50b['query']=_['keys'](_0x965a7f[_0xd5bb('0x33')]);_0x4db50b[_0xd5bb('0x34')]=_['intersection'](_0x4db50b[_0xd5bb('0x35')],_0x4db50b['query']);_0x2a6a4a[_0xd5bb('0x36')]=_[_0xd5bb('0x37')](_0x4db50b['model'],qs[_0xd5bb('0x38')](_0x965a7f[_0xd5bb('0x33')][_0xd5bb('0x38')]));_0x2a6a4a[_0xd5bb('0x36')]=_0x2a6a4a[_0xd5bb('0x36')][_0xd5bb('0x39')]?_0x2a6a4a['attributes']:_0x4db50b[_0xd5bb('0x35')];if(!_0x965a7f[_0xd5bb('0x33')]['hasOwnProperty'](_0xd5bb('0x3a'))){_0x2a6a4a[_0xd5bb('0x1e')]=qs[_0xd5bb('0x1e')](_0x965a7f[_0xd5bb('0x33')][_0xd5bb('0x1e')]);_0x2a6a4a[_0xd5bb('0x1d')]=qs[_0xd5bb('0x1d')](_0x965a7f[_0xd5bb('0x33')]['offset']);}_0x2a6a4a['order']=qs[_0xd5bb('0x3b')](_0x965a7f['query'][_0xd5bb('0x3b')]);_0x2a6a4a['where']=qs['filters'](_[_0xd5bb('0x3c')](_0x965a7f[_0xd5bb('0x33')],_0x4db50b[_0xd5bb('0x34')]));if(_0x965a7f[_0xd5bb('0x33')][_0xd5bb('0x3d')]){_0x2a6a4a['where']=_['merge'](_0x2a6a4a['where'],{'$or':_[_0xd5bb('0x32')](_0x1a0166,function(_0x1b1680){if(_0x1b1680[_0xd5bb('0x30')]!==_0xd5bb('0x3e')){var _0x5b7e32={};_0x5b7e32[_0x1b1680[_0xd5bb('0x2a')]]={'$like':'%'+_0x965a7f[_0xd5bb('0x33')][_0xd5bb('0x3d')]+'%'};return _0x5b7e32;}})});}_0x2a6a4a=_['merge']({},_0x2a6a4a,_0x965a7f[_0xd5bb('0x3f')]);var _0x54c5d8={'where':_0x2a6a4a[_0xd5bb('0x40')]};return db['Dashboard']['count'](_0x54c5d8)[_0xd5bb('0x23')](function(_0x50471b){_0x12fa21['count']=_0x50471b;if(_0x965a7f[_0xd5bb('0x33')]['includeAll']){_0x2a6a4a[_0xd5bb('0x41')]=[{'all':!![]}];}return db[_0xd5bb('0x2d')][_0xd5bb('0x42')](_0x2a6a4a);})['then'](function(_0x2fb4e8){_0x12fa21[_0xd5bb('0x43')]=_0x2fb4e8;return _0x12fa21;})[_0xd5bb('0x23')](respondWithFilteredResult(_0x12aeea,_0x2a6a4a))[_0xd5bb('0x44')](handleError(_0x12aeea,null));};exports['show']=function(_0x56a1ba,_0x47d1ee){var _0x30c47e={'raw':![],'where':{'id':_0x56a1ba[_0xd5bb('0x45')]['id']}},_0x2b9691={};_0x2b9691[_0xd5bb('0x35')]=_[_0xd5bb('0x46')](db[_0xd5bb('0x2d')][_0xd5bb('0x2e')]);_0x2b9691['query']=_[_0xd5bb('0x46')](_0x56a1ba[_0xd5bb('0x33')]);_0x2b9691[_0xd5bb('0x34')]=_[_0xd5bb('0x37')](_0x2b9691[_0xd5bb('0x35')],_0x2b9691[_0xd5bb('0x33')]);_0x30c47e['attributes']=_[_0xd5bb('0x37')](_0x2b9691[_0xd5bb('0x35')],qs[_0xd5bb('0x38')](_0x56a1ba[_0xd5bb('0x33')][_0xd5bb('0x38')]));_0x30c47e['attributes']=_0x30c47e['attributes'][_0xd5bb('0x39')]?_0x30c47e[_0xd5bb('0x36')]:_0x2b9691['model'];if(_0x56a1ba[_0xd5bb('0x33')][_0xd5bb('0x47')]){_0x30c47e['include']=[{'all':!![]}];}_0x30c47e=_[_0xd5bb('0x48')]({},_0x30c47e,_0x56a1ba['options']);return db[_0xd5bb('0x2d')][_0xd5bb('0x49')](_0x30c47e)[_0xd5bb('0x23')](handleEntityNotFound(_0x47d1ee,null))[_0xd5bb('0x23')](respondWithResult(_0x47d1ee,null))[_0xd5bb('0x44')](handleError(_0x47d1ee,null));};exports['create']=function(_0x1cbb68,_0x552d72){return db[_0xd5bb('0x2d')]['create'](_0x1cbb68[_0xd5bb('0x4a')],{})['then'](function(_0x4ea20b){var _0x2b697f=_0x1cbb68[_0xd5bb('0x4b')][_0xd5bb('0x4c')]({'plain':!![]});if(!_0x2b697f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b697f[_0xd5bb('0x4d')]===_0xd5bb('0x4b')){var _0x1664ac=_0x4ea20b[_0xd5bb('0x4c')]({'plain':!![]});var _0xc1fd5c=_0xd5bb('0x25');return db[_0xd5bb('0x4e')][_0xd5bb('0x49')]({'where':{'name':_0xc1fd5c,'userProfileId':_0x2b697f[_0xd5bb('0x4f')]},'raw':!![]})[_0xd5bb('0x23')](function(_0x1ee231){if(_0x1ee231&&_0x1ee231['autoAssociation']===0x0){return db[_0xd5bb('0x26')][_0xd5bb('0x50')]({'name':_0x1664ac[_0xd5bb('0x2a')],'resourceId':_0x1664ac['id'],'type':_0x1ee231[_0xd5bb('0x2a')],'sectionId':_0x1ee231['id']},{})[_0xd5bb('0x23')](function(){return _0x4ea20b;});}else{return _0x4ea20b;}})['catch'](function(_0x4f3d0a){logger[_0xd5bb('0x28')](_0xd5bb('0x51'),_0x4f3d0a);throw _0x4f3d0a;});}return _0x4ea20b;})[_0xd5bb('0x23')](respondWithResult(_0x552d72,0xc9))[_0xd5bb('0x44')](handleError(_0x552d72,null));};exports['clone']=function(_0x1abe56,_0x5f3bc7){var _0xbc62db={'where':{'id':_0x1abe56['params']['id']}},_0x2864c9={};_0x2864c9[_0xd5bb('0x35')]=_['keys'](db['Dashboard'][_0xd5bb('0x2e')]);_0xbc62db[_0xd5bb('0x36')]=_[_0xd5bb('0x37')](_0x2864c9[_0xd5bb('0x35')],qs[_0xd5bb('0x38')](_0x1abe56[_0xd5bb('0x33')][_0xd5bb('0x38')]));_0xbc62db[_0xd5bb('0x36')]=_0xbc62db[_0xd5bb('0x36')][_0xd5bb('0x39')]?_0xbc62db[_0xd5bb('0x36')]:_0x2864c9[_0xd5bb('0x35')];if(_0x1abe56[_0xd5bb('0x33')][_0xd5bb('0x47')]){_0xbc62db[_0xd5bb('0x41')]=[{'all':!![]}];}_0xbc62db=_['merge']({},_0xbc62db,_0x1abe56[_0xd5bb('0x3f')]);return db[_0xd5bb('0x2d')][_0xd5bb('0x49')](_0xbc62db)[_0xd5bb('0x23')](handleEntityNotFound(_0x5f3bc7,null))[_0xd5bb('0x23')](function(_0x50d89d){if(_0x50d89d){var _0x52ae78=_0x50d89d[_0xd5bb('0x4c')]({'plain':!![]});_0x52ae78=qs['omit'](_0x52ae78,['id',_0xd5bb('0x52'),_0xd5bb('0x53')]);_0x1abe56[_0xd5bb('0x4a')]=_[_0xd5bb('0x54')](_0x1abe56[_0xd5bb('0x4a')],['id',_0xd5bb('0x52'),_0xd5bb('0x53')]);return db[_0xd5bb('0x2d')]['create'](_[_0xd5bb('0x48')](_0x52ae78,_0x1abe56[_0xd5bb('0x4a')]),{'include':_0x1abe56[_0xd5bb('0x33')][_0xd5bb('0x47')]?[{'all':!![]}]:undefined})[_0xd5bb('0x23')](function(_0x2561e2){var _0xbcd6f5=_0x1abe56[_0xd5bb('0x4b')][_0xd5bb('0x4c')]({'plain':!![]});if(!_0xbcd6f5)throw new Error(_0xd5bb('0x55'));if(_0xbcd6f5['role']===_0xd5bb('0x4b')){var _0x5ade1f=_0x2561e2[_0xd5bb('0x4c')]({'plain':!![]});var _0x5075e9=_0xd5bb('0x25');return db[_0xd5bb('0x4e')][_0xd5bb('0x49')]({'where':{'name':_0x5075e9,'userProfileId':_0xbcd6f5[_0xd5bb('0x4f')]},'raw':!![]})[_0xd5bb('0x23')](function(_0x4d25fd){if(_0x4d25fd&&_0x4d25fd['autoAssociation']===0x0){return db[_0xd5bb('0x26')]['create']({'name':_0x5ade1f[_0xd5bb('0x2a')],'resourceId':_0x5ade1f['id'],'type':_0x4d25fd['name'],'sectionId':_0x4d25fd['id']},{})['then'](function(){return _0x2561e2;});}else{return _0x2561e2;}})['catch'](function(_0x266920){logger[_0xd5bb('0x28')](_0xd5bb('0x51'),_0x266920);throw _0x266920;});}return _0x2561e2;});}})[_0xd5bb('0x23')](respondWithResult(_0x5f3bc7,0xc9))[_0xd5bb('0x44')](handleError(_0x5f3bc7,null));};exports[_0xd5bb('0x22')]=function(_0x29aeb0,_0x298dff){if(_0x29aeb0[_0xd5bb('0x4a')]['id']){delete _0x29aeb0[_0xd5bb('0x4a')]['id'];}return db[_0xd5bb('0x2d')][_0xd5bb('0x49')]({'where':{'id':_0x29aeb0[_0xd5bb('0x45')]['id']}})[_0xd5bb('0x23')](handleEntityNotFound(_0x298dff,null))[_0xd5bb('0x23')](saveUpdates(_0x29aeb0['body'],null))[_0xd5bb('0x23')](respondWithResult(_0x298dff,null))[_0xd5bb('0x44')](handleError(_0x298dff,null));};exports[_0xd5bb('0x24')]=function(_0x9fc8fb,_0x31d2eb){return db['Dashboard'][_0xd5bb('0x49')]({'where':{'id':_0x9fc8fb['params']['id']}})[_0xd5bb('0x23')](handleEntityNotFound(_0x31d2eb,null))['then'](removeEntity(_0x31d2eb,null))['catch'](handleError(_0x31d2eb,null));};function widgetAttributes(_0xfe1322){try{switch(_0xfe1322[_0xd5bb('0x30')]){case'iframe':return[{'name':_0xd5bb('0x56'),'value':_0xfe1322[_0xd5bb('0x56')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322['attrs'][0x0]?_0xfe1322[_0xd5bb('0x57')][0x0][_0xd5bb('0x58')]:undefined)||'https://'}];case _0xd5bb('0x59'):return[{'name':'attrPath','value':_0xfe1322[_0xd5bb('0x5a')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x0]?_0xfe1322['attrs'][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0xd5bb('0x5b'),'value':_0xfe1322[_0xd5bb('0x5b')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x0]?_0xfe1322['attrs'][0x0][_0xd5bb('0x58')]:undefined)||_0xd5bb('0x5c')},{'name':_0xd5bb('0x5d'),'value':_0xfe1322[_0xd5bb('0x5d')]||(_0xfe1322['attrs']&&_0xfe1322[_0xd5bb('0x57')][0x1]?_0xfe1322[_0xd5bb('0x57')][0x1]['value']:undefined)||_0xd5bb('0x5e')},{'name':_0xd5bb('0x5f'),'value':_0xfe1322['attrFontSize']||(_0xfe1322['attrs']&&_0xfe1322[_0xd5bb('0x57')][0x2]?_0xfe1322[_0xd5bb('0x57')][0x2][_0xd5bb('0x58')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0xfe1322['attrMetric']||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322['attrs'][0x0]?_0xfe1322[_0xd5bb('0x57')][0x0]['value']:undefined)||_0xd5bb('0x60')},{'name':_0xd5bb('0x61'),'value':_0xfe1322[_0xd5bb('0x61')]||(_0xfe1322['attrs']&&_0xfe1322[_0xd5bb('0x57')][0x1]?_0xfe1322[_0xd5bb('0x57')][0x1]['value']:undefined)||[]},{'name':'attrFontSize','value':_0xfe1322[_0xd5bb('0x5f')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x2]?_0xfe1322['attrs'][0x2][_0xd5bb('0x58')]:undefined)||0x14}];case _0xd5bb('0x62'):case _0xd5bb('0x63'):return[{'name':_0xd5bb('0x64'),'value':_0xfe1322[_0xd5bb('0x64')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322['attrs'][0x0]?_0xfe1322[_0xd5bb('0x57')][0x0][_0xd5bb('0x58')]:undefined)||'total'},{'name':_0xd5bb('0x65'),'value':_0xfe1322[_0xd5bb('0x65')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x1]?_0xfe1322['attrs'][0x1][_0xd5bb('0x58')]:undefined)||null},{'name':'attrSerie3','value':_0xfe1322[_0xd5bb('0x66')]||(_0xfe1322['attrs']&&_0xfe1322[_0xd5bb('0x57')][0x2]?_0xfe1322[_0xd5bb('0x57')][0x2][_0xd5bb('0x58')]:undefined)||null},{'name':_0xd5bb('0x61'),'value':_0xfe1322[_0xd5bb('0x61')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x3]?_0xfe1322[_0xd5bb('0x57')][0x3][_0xd5bb('0x58')]:undefined)||[]}];case _0xd5bb('0x67'):return[{'name':_0xd5bb('0x68'),'type':_0xfe1322[_0xd5bb('0x69')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x0]?_0xfe1322['attrs'][0x0][_0xd5bb('0x30')]:undefined)||null,'value':_0xfe1322[_0xd5bb('0x68')]||(_0xfe1322[_0xd5bb('0x57')]&&_0xfe1322[_0xd5bb('0x57')][0x0]?_0xfe1322[_0xd5bb('0x57')][0x0]['value']:undefined)||null},{'name':_0xd5bb('0x6a'),'value':_0xfe1322['attrRefresh']||(_0xfe1322['attrs']&&_0xfe1322['attrs'][0x1]?_0xfe1322[_0xd5bb('0x57')][0x1][_0xd5bb('0x58')]:undefined)||0x0}];default:return[];}}catch(_0x1d858d){logger[_0xd5bb('0x28')](_0xd5bb('0x6b'),JSON[_0xd5bb('0x6c')](_0x1d858d));return[];}}exports[_0xd5bb('0x6d')]=function(_0xa33a6c,_0x44954a,_0x619033){if(_0xa33a6c[_0xd5bb('0x4a')]['id']){delete _0xa33a6c[_0xd5bb('0x4a')]['id'];}return db[_0xd5bb('0x2d')]['find']({'where':{'id':_0xa33a6c[_0xd5bb('0x45')]['id']}})[_0xd5bb('0x23')](handleEntityNotFound(_0x44954a,null))[_0xd5bb('0x23')](function(_0x4485c1){if(_0x4485c1){_0xa33a6c['body'][_0xd5bb('0x6e')]=_0x4485c1['id'];_0xa33a6c[_0xd5bb('0x4a')][_0xd5bb('0x57')]=widgetAttributes(_0xa33a6c[_0xd5bb('0x4a')]);return db[_0xd5bb('0x6f')]['create'](_0xa33a6c[_0xd5bb('0x4a')]);}})[_0xd5bb('0x23')](respondWithResult(_0x44954a,null))[_0xd5bb('0x44')](handleError(_0x44954a,null));};exports[_0xd5bb('0x70')]=function(_0x5cdbb3,_0x2af7c9,_0x573033){var _0x352c76={};var _0x1b278e={};var _0x5beee4;var _0x53c0bd;return db[_0xd5bb('0x2d')][_0xd5bb('0x71')]({'where':{'id':_0x5cdbb3[_0xd5bb('0x45')]['id']}})[_0xd5bb('0x23')](handleEntityNotFound(_0x2af7c9,null))['then'](function(_0x4260a){if(_0x4260a){_0x5beee4=_0x4260a;_0x1b278e[_0xd5bb('0x35')]=_[_0xd5bb('0x46')](db['DashboardItem'][_0xd5bb('0x2e')]);_0x1b278e[_0xd5bb('0x33')]=_[_0xd5bb('0x46')](_0x5cdbb3[_0xd5bb('0x33')]);_0x1b278e[_0xd5bb('0x34')]=_['intersection'](_0x1b278e[_0xd5bb('0x35')],_0x1b278e[_0xd5bb('0x33')]);_0x352c76[_0xd5bb('0x36')]=_[_0xd5bb('0x37')](_0x1b278e[_0xd5bb('0x35')],qs[_0xd5bb('0x38')](_0x5cdbb3['query'][_0xd5bb('0x38')]));_0x352c76[_0xd5bb('0x36')]=_0x352c76[_0xd5bb('0x36')][_0xd5bb('0x39')]?_0x352c76[_0xd5bb('0x36')]:_0x1b278e[_0xd5bb('0x35')];_0x352c76['order']=qs['sort'](_0x5cdbb3[_0xd5bb('0x33')][_0xd5bb('0x3b')]);_0x352c76[_0xd5bb('0x40')]=qs['filters'](_[_0xd5bb('0x3c')](_0x5cdbb3['query'],_0x1b278e[_0xd5bb('0x34')]));if(_0x5cdbb3['query'][_0xd5bb('0x3d')]){_0x352c76[_0xd5bb('0x40')]=_['merge'](_0x352c76[_0xd5bb('0x40')],{'$or':_[_0xd5bb('0x32')](_0x352c76[_0xd5bb('0x36')],function(_0x2a1f2e){var _0x5a89ac={};_0x5a89ac[_0x2a1f2e]={'$like':'%'+_0x5cdbb3[_0xd5bb('0x33')][_0xd5bb('0x3d')]+'%'};return _0x5a89ac;})});}_0x352c76=_[_0xd5bb('0x48')]({},_0x352c76,_0x5cdbb3[_0xd5bb('0x3f')]);return _0x5beee4[_0xd5bb('0x70')](_0x352c76);}})[_0xd5bb('0x23')](function(_0x19c81d){if(_0x19c81d){_0x53c0bd=_0x19c81d[_0xd5bb('0x39')];if(!_0x5cdbb3[_0xd5bb('0x33')][_0xd5bb('0x72')](_0xd5bb('0x3a'))){_0x352c76[_0xd5bb('0x1e')]=qs[_0xd5bb('0x1e')](_0x5cdbb3[_0xd5bb('0x33')][_0xd5bb('0x1e')]);_0x352c76[_0xd5bb('0x1d')]=qs[_0xd5bb('0x1d')](_0x5cdbb3[_0xd5bb('0x33')]['offset']);}return _0x5beee4[_0xd5bb('0x70')](_0x352c76);}})[_0xd5bb('0x23')](function(_0x514dfe){if(_0x514dfe){return _0x514dfe?{'count':_0x53c0bd,'rows':_0x514dfe}:null;}})['then'](respondWithResult(_0x2af7c9,null))['catch'](handleError(_0x2af7c9,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 7dfaba3..6cc88f1 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 _0x6bdc=['hasOwnProperty','hook','exports','events','../../mysqldb','Dashboard','setMaxListeners','update'];(function(_0x12078c,_0x4b9d70){var _0x23ede4=function(_0x8142b6){while(--_0x8142b6){_0x12078c['push'](_0x12078c['shift']());}};_0x23ede4(++_0x4b9d70);}(_0x6bdc,0x16b));var _0xc6bd=function(_0x2d61cc,_0x59a466){_0x2d61cc=_0x2d61cc-0x0;var _0x3ad0ab=_0x6bdc[_0x2d61cc];return _0x3ad0ab;};'use strict';var EventEmitter=require(_0xc6bd('0x0'));var Dashboard=require(_0xc6bd('0x1'))['db'][_0xc6bd('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0xc6bd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc6bd('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3e9a97){return function(_0x3eda61,_0x541661,_0x62f515){DashboardEvents['emit'](_0x3e9a97+':'+_0x3eda61['id'],_0x3eda61);DashboardEvents['emit'](_0x3e9a97,_0x3eda61);_0x62f515(null);};}for(var e in events){if(events[_0xc6bd('0x5')](e)){var event=events[e];Dashboard[_0xc6bd('0x6')](e,emitEvent(event));}}module[_0xc6bd('0x7')]=DashboardEvents; \ No newline at end of file +var _0x8e78=['../../mysqldb','Dashboard','setMaxListeners','save','hook','exports','events'];(function(_0x2298f0,_0x3bbf4f){var _0x39b136=function(_0xc2cd6e){while(--_0xc2cd6e){_0x2298f0['push'](_0x2298f0['shift']());}};_0x39b136(++_0x3bbf4f);}(_0x8e78,0xf4));var _0x88e7=function(_0x20228b,_0x3c6232){_0x20228b=_0x20228b-0x0;var _0x3986fd=_0x8e78[_0x20228b];return _0x3986fd;};'use strict';var EventEmitter=require(_0x88e7('0x0'));var Dashboard=require(_0x88e7('0x1'))['db'][_0x88e7('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x88e7('0x3')](0x0);var events={'afterCreate':_0x88e7('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2c61a1){return function(_0x29cf0a,_0x3bd339,_0x57b12a){DashboardEvents['emit'](_0x2c61a1+':'+_0x29cf0a['id'],_0x29cf0a);DashboardEvents['emit'](_0x2c61a1,_0x29cf0a);_0x57b12a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x88e7('0x5')](e,emitEvent(event));}}module[_0x88e7('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index ad88b93..6e4cc65 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 _0x4fff=['util','path','../../config/environment','./dashboard.attributes','exports','define','Dashboard','lodash'];(function(_0x2e0d88,_0x47ea20){var _0x52c931=function(_0x5df9e7){while(--_0x5df9e7){_0x2e0d88['push'](_0x2e0d88['shift']());}};_0x52c931(++_0x47ea20);}(_0x4fff,0x1a7));var _0xf4ff=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x4fff[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0xf4ff('0x0'));var util=require(_0xf4ff('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xf4ff('0x2'));var rimraf=require('rimraf');var config=require(_0xf4ff('0x3'));var attributes=require(_0xf4ff('0x4'));module[_0xf4ff('0x5')]=function(_0x100f14,_0x155ea6){return _0x100f14[_0xf4ff('0x6')](_0xf4ff('0x7'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb364=['lodash','moment','bluebird','request-promise','path','rimraf','../../config/environment','./dashboard.attributes','define','Dashboard'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0xb364,0xdc));var _0x4b36=function(_0x551f61,_0x492e3d){_0x551f61=_0x551f61-0x0;var _0x3a3ceb=_0xb364[_0x551f61];return _0x3a3ceb;};'use strict';var _=require(_0x4b36('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x4b36('0x1'));var BPromise=require(_0x4b36('0x2'));var rp=require(_0x4b36('0x3'));var fs=require('fs');var path=require(_0x4b36('0x4'));var rimraf=require(_0x4b36('0x5'));var config=require(_0x4b36('0x6'));var attributes=require(_0x4b36('0x7'));module['exports']=function(_0x2d2e93,_0x2e12f2){return _0x2d2e93[_0x4b36('0x8')](_0x4b36('0x9'),attributes,{'tableName':'dashboards','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 4a4edae..9e3d8da 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 _0x33dc=['then','info','debug','Dashboard,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','Dashboard,\x20%s,\x20%s','message','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./dashboard.socket','register'];(function(_0x474cba,_0xe5defa){var _0x180934=function(_0x45502d){while(--_0x45502d){_0x474cba['push'](_0x474cba['shift']());}};_0x180934(++_0xe5defa);}(_0x33dc,0x91));var _0xc33d=function(_0x425716,_0x3e9d1c){_0x425716=_0x425716-0x0;var _0x2d39af=_0x33dc[_0x425716];return _0x2d39af;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc33d('0x0'));var BPromise=require('bluebird');var rs=require(_0xc33d('0x1'));var fs=require('fs');var Redis=require(_0xc33d('0x2'));var db=require(_0xc33d('0x3'))['db'];var utils=require(_0xc33d('0x4'));var logger=require(_0xc33d('0x5'))(_0xc33d('0x6'));var config=require(_0xc33d('0x7'));var jayson=require(_0xc33d('0x8'));var client=jayson[_0xc33d('0x9')][_0xc33d('0xa')]({'port':0x232a});config['redis']=_[_0xc33d('0xb')](config[_0xc33d('0xc')],{'host':_0xc33d('0xd'),'port':0x18eb});var socket=require(_0xc33d('0xe'))(new Redis(config['redis']));require(_0xc33d('0xf'))[_0xc33d('0x10')](socket);function respondWithRpcPromise(_0x3ca8d4,_0x94212f,_0x362cf0){return new BPromise(function(_0x143d8a,_0x1e7323){return client['request'](_0x3ca8d4,_0x362cf0)[_0xc33d('0x11')](function(_0x5bb189){logger[_0xc33d('0x12')]('Dashboard,\x20%s,\x20%s',_0x94212f,'request\x20sent');logger[_0xc33d('0x13')](_0xc33d('0x14'),_0x94212f,_0xc33d('0x15'),JSON[_0xc33d('0x16')](_0x5bb189));if(_0x5bb189[_0xc33d('0x17')]){if(_0x5bb189[_0xc33d('0x17')][_0xc33d('0x18')]===0x1f4){logger[_0xc33d('0x17')](_0xc33d('0x19'),_0x94212f,_0x5bb189[_0xc33d('0x17')][_0xc33d('0x1a')]);return _0x1e7323(_0x5bb189[_0xc33d('0x17')][_0xc33d('0x1a')]);}logger[_0xc33d('0x17')](_0xc33d('0x19'),_0x94212f,_0x5bb189[_0xc33d('0x17')][_0xc33d('0x1a')]);return _0x143d8a(_0x5bb189[_0xc33d('0x17')][_0xc33d('0x1a')]);}else{logger[_0xc33d('0x12')](_0xc33d('0x19'),_0x94212f,'request\x20sent');_0x143d8a(_0x5bb189['result'][_0xc33d('0x1a')]);}})['catch'](function(_0x44d16b){logger[_0xc33d('0x17')]('Dashboard,\x20%s,\x20%s',_0x94212f,_0x44d16b);_0x1e7323(_0x44d16b);});});} \ No newline at end of file +var _0x02f3=['Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','localhost','./dashboard.socket','register','request','then','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x28e3d9,_0x26dd13){var _0x4da3c2=function(_0x55b82f){while(--_0x55b82f){_0x28e3d9['push'](_0x28e3d9['shift']());}};_0x4da3c2(++_0x26dd13);}(_0x02f3,0x1a7));var _0x302f=function(_0x3371af,_0x51c2f2){_0x3371af=_0x3371af-0x0;var _0x2f4af5=_0x02f3[_0x3371af];return _0x2f4af5;};'use strict';var _=require(_0x302f('0x0'));var util=require('util');var moment=require(_0x302f('0x1'));var BPromise=require(_0x302f('0x2'));var rs=require(_0x302f('0x3'));var fs=require('fs');var Redis=require(_0x302f('0x4'));var db=require(_0x302f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x302f('0x6'))(_0x302f('0x7'));var config=require(_0x302f('0x8'));var jayson=require(_0x302f('0x9'));var client=jayson[_0x302f('0xa')][_0x302f('0xb')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':_0x302f('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x302f('0xd'))[_0x302f('0xe')](socket);function respondWithRpcPromise(_0xb6e451,_0x1fa190,_0x41d1eb){return new BPromise(function(_0x17db45,_0x20fc5e){return client[_0x302f('0xf')](_0xb6e451,_0x41d1eb)[_0x302f('0x10')](function(_0x801bfd){logger['info'](_0x302f('0x11'),_0x1fa190,_0x302f('0x12'));logger['debug'](_0x302f('0x13'),_0x1fa190,_0x302f('0x12'),JSON[_0x302f('0x14')](_0x801bfd));if(_0x801bfd[_0x302f('0x15')]){if(_0x801bfd[_0x302f('0x15')][_0x302f('0x16')]===0x1f4){logger[_0x302f('0x15')](_0x302f('0x11'),_0x1fa190,_0x801bfd[_0x302f('0x15')]['message']);return _0x20fc5e(_0x801bfd['error']['message']);}logger[_0x302f('0x15')]('Dashboard,\x20%s,\x20%s',_0x1fa190,_0x801bfd[_0x302f('0x15')]['message']);return _0x17db45(_0x801bfd[_0x302f('0x15')][_0x302f('0x17')]);}else{logger[_0x302f('0x18')](_0x302f('0x11'),_0x1fa190,_0x302f('0x12'));_0x17db45(_0x801bfd['result']['message']);}})[_0x302f('0x19')](function(_0x577841){logger[_0x302f('0x15')](_0x302f('0x11'),_0x1fa190,_0x577841);_0x20fc5e(_0x577841);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 08a702d..0a0eb8b 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 _0x51b4=['dashboard:','./dashboard.events','remove','emit','removeListener','register','length'];(function(_0x22cc36,_0x2c8292){var _0x7fc85=function(_0x4e476d){while(--_0x4e476d){_0x22cc36['push'](_0x22cc36['shift']());}};_0x7fc85(++_0x2c8292);}(_0x51b4,0x12e));var _0x451b=function(_0x8ab1a7,_0x1b5624){_0x8ab1a7=_0x8ab1a7-0x0;var _0x1f79e4=_0x51b4[_0x8ab1a7];return _0x1f79e4;};'use strict';var DashboardEvents=require(_0x451b('0x0'));var events=['save',_0x451b('0x1'),'update'];function createListener(_0x395360,_0x5923bb){return function(_0xc9707b){_0x5923bb[_0x451b('0x2')](_0x395360,_0xc9707b);};}function removeListener(_0x218156,_0x59f866){return function(){DashboardEvents[_0x451b('0x3')](_0x218156,_0x59f866);};}exports[_0x451b('0x4')]=function(_0xf1a0cf){for(var _0x3a7929=0x0,_0x442a67=events[_0x451b('0x5')];_0x3a7929<_0x442a67;_0x3a7929++){var _0x1f5848=events[_0x3a7929];var _0x3f4415=createListener(_0x451b('0x6')+_0x1f5848,_0xf1a0cf);DashboardEvents['on'](_0x1f5848,_0x3f4415);}}; \ No newline at end of file +var _0xd70e=['./dashboard.events','remove','update','emit','removeListener','register','dashboard:'];(function(_0x296a0e,_0x219c50){var _0x47f68a=function(_0x38f943){while(--_0x38f943){_0x296a0e['push'](_0x296a0e['shift']());}};_0x47f68a(++_0x219c50);}(_0xd70e,0x69));var _0xed70=function(_0x2592c8,_0x470e74){_0x2592c8=_0x2592c8-0x0;var _0x376adb=_0xd70e[_0x2592c8];return _0x376adb;};'use strict';var DashboardEvents=require(_0xed70('0x0'));var events=['save',_0xed70('0x1'),_0xed70('0x2')];function createListener(_0x34e454,_0x13b36e){return function(_0x4ec3c9){_0x13b36e[_0xed70('0x3')](_0x34e454,_0x4ec3c9);};}function removeListener(_0x1fabb1,_0x38d898){return function(){DashboardEvents[_0xed70('0x4')](_0x1fabb1,_0x38d898);};}exports[_0xed70('0x5')]=function(_0x32ddd3){for(var _0x3f7ff2=0x0,_0x2f91c7=events['length'];_0x3f7ff2<_0x2f91c7;_0x3f7ff2++){var _0x30ac5b=events[_0x3f7ff2];var _0xc64f6a=createListener(_0xed70('0x6')+_0x30ac5b,_0x32ddd3);DashboardEvents['on'](_0x30ac5b,_0xc64f6a);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 4e776e0..8752c5e 100644 --- a/server/api/dashboard/index.js +++ b/server/api/dashboard/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','create','/:id/clone','clone','addItem','put','update','delete','multer','util','path','express','Router'];(function(_0x1a1460,_0x539531){var _0x33ab03=function(_0x26a04b){while(--_0x26a04b){_0x1a1460['push'](_0x1a1460['shift']());}};_0x33ab03(++_0x539531);}(_0xe706,0xa3));var _0x6e70=function(_0x35dc52,_0x5c666f){_0x35dc52=_0x35dc52-0x0;var _0x4134cd=_0xe706[_0x35dc52];return _0x4134cd;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var auth=require(_0x6e70('0x5'));var interaction=require(_0x6e70('0x6'));var config=require(_0x6e70('0x7'));var controller=require(_0x6e70('0x8'));router[_0x6e70('0x9')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0xb')]);router[_0x6e70('0x9')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xd')]);router[_0x6e70('0x9')](_0x6e70('0xe'),auth[_0x6e70('0xa')](),controller[_0x6e70('0xf')]);router[_0x6e70('0x10')]('/',auth[_0x6e70('0xa')](),controller[_0x6e70('0x11')]);router[_0x6e70('0x10')](_0x6e70('0x12'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x13')]);router['post']('/:id/items',auth[_0x6e70('0xa')](),controller[_0x6e70('0x14')]);router[_0x6e70('0x15')](_0x6e70('0xc'),auth[_0x6e70('0xa')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0xc'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd8b0=['../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','index','get','/:id','show','isAuthenticated','getItems','post','create','/:id/clone','addItem','put','update','delete','destroy','exports','multer','util','Router'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var auth=require(_0x0d8b('0x3'));var interaction=require(_0x0d8b('0x4'));var config=require(_0x0d8b('0x5'));var controller=require(_0x0d8b('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x0d8b('0x7')]);router[_0x0d8b('0x8')](_0x0d8b('0x9'),auth['isAuthenticated'](),controller[_0x0d8b('0xa')]);router[_0x0d8b('0x8')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xd')](_0x0d8b('0xf'),auth[_0x0d8b('0xb')](),controller['clone']);router[_0x0d8b('0xd')]('/:id/items',auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x10')]);router[_0x0d8b('0x11')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x12')]);router[_0x0d8b('0x13')](_0x0d8b('0x9'),auth[_0x0d8b('0xb')](),controller[_0x0d8b('0x14')]);module[_0x0d8b('0x15')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index e9e5b55..0541f9b 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 _0xa78f=['stringify','INTEGER','#ffffff','sequelize','squel','lodash','exports','STRING','TEXT','long','parse','attrs','setDataValue'];(function(_0x1e3bf5,_0x565209){var _0x41c35b=function(_0x3726ff){while(--_0x3726ff){_0x1e3bf5['push'](_0x1e3bf5['shift']());}};_0x41c35b(++_0x565209);}(_0xa78f,0xe0));var _0xfa78=function(_0x4a9e4a,_0x585df1){_0x4a9e4a=_0x4a9e4a-0x0;var _0xaa903e=_0xa78f[_0x4a9e4a];return _0xaa903e;};'use strict';var Sequelize=require(_0xfa78('0x0'));var squel=require(_0xfa78('0x1'));var _=require(_0xfa78('0x2'));module[_0xfa78('0x3')]={'title':{'type':Sequelize[_0xfa78('0x4')],'allowNull':![]},'type':{'type':Sequelize[_0xfa78('0x4')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0xfa78('0x5')](_0xfa78('0x6')),'get':function(){try{return JSON[_0xfa78('0x7')](this['getDataValue'](_0xfa78('0x8')));}catch(_0x2ed050){return[];}},'set':function(_0x4b0ac7){try{this[_0xfa78('0x9')](_0xfa78('0x8'),JSON[_0xfa78('0xa')](_0x4b0ac7));}catch(_0x5977f8){this['setDataValue'](_0xfa78('0x8'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0xfa78('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0xfa78('0xb')]},'col':{'type':Sequelize[_0xfa78('0xb')]},'background':{'type':Sequelize[_0xfa78('0x4')],'allowNull':![],'defaultValue':_0xfa78('0xc'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0xfa78('0x4')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0xfa78('0x4')]}}; \ No newline at end of file +var _0xaaf9=['squel','lodash','STRING','TEXT','long','parse','getDataValue','setDataValue','attrs','INTEGER','#ffffff','#2196f3','sequelize'];(function(_0x57b829,_0xbe5545){var _0x35659=function(_0xf66a62){while(--_0xf66a62){_0x57b829['push'](_0x57b829['shift']());}};_0x35659(++_0xbe5545);}(_0xaaf9,0xe9));var _0x9aaf=function(_0x1ce97b,_0x463732){_0x1ce97b=_0x1ce97b-0x0;var _0x3abc65=_0xaaf9[_0x1ce97b];return _0x3abc65;};'use strict';var Sequelize=require(_0x9aaf('0x0'));var squel=require(_0x9aaf('0x1'));var _=require(_0x9aaf('0x2'));module['exports']={'title':{'type':Sequelize[_0x9aaf('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9aaf('0x4')](_0x9aaf('0x5')),'get':function(){try{return JSON[_0x9aaf('0x6')](this[_0x9aaf('0x7')]('attrs'));}catch(_0xd63913){return[];}},'set':function(_0x2826e3){try{this[_0x9aaf('0x8')]('attrs',JSON['stringify'](_0x2826e3));}catch(_0x33c3bc){this[_0x9aaf('0x8')](_0x9aaf('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x9aaf('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x9aaf('0xa')]},'col':{'type':Sequelize[_0x9aaf('0xa')]},'background':{'type':Sequelize[_0x9aaf('0x3')],'allowNull':![],'defaultValue':_0x9aaf('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9aaf('0x3')],'allowNull':![],'defaultValue':_0x9aaf('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9aaf('0x3')]}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index c39f707..305f612 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 _0xd304=['jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','count','offset','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','show','model','keys','filters','query','attributes','intersection','fields','length','includeAll','merge','options','DashboardItem','find','catch','params','type','iframe','attrUrl','attrs','value','https://','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','squel'];(function(_0x11018f,_0x27eebb){var _0x14af66=function(_0x25612f){while(--_0x25612f){_0x11018f['push'](_0x11018f['shift']());}};_0x14af66(++_0x27eebb);}(_0xd304,0xa2));var _0x4d30=function(_0x17e2c8,_0x4f69e6){_0x17e2c8=_0x17e2c8-0x0;var _0x4388ad=_0xd304[_0x17e2c8];return _0x4388ad;};'use strict';var pdf=require(_0x4d30('0x0'));var emlformat=require(_0x4d30('0x1'));var rimraf=require(_0x4d30('0x2'));var zipdir=require(_0x4d30('0x3'));var jsonpatch=require(_0x4d30('0x4'));var rp=require(_0x4d30('0x5'));var moment=require(_0x4d30('0x6'));var BPromise=require(_0x4d30('0x7'));var Mustache=require(_0x4d30('0x8'));var util=require('util');var path=require(_0x4d30('0x9'));var sox=require(_0x4d30('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x4d30('0xb'));var crypto=require('crypto');var jsforce=require(_0x4d30('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4d30('0xd'));var Papa=require(_0x4d30('0xe'));var Redis=require('ioredis');var authService=require(_0x4d30('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x4d30('0x10'));var hardwareService=require(_0x4d30('0x11'));var logger=require('../../config/logger')(_0x4d30('0x12'));var utils=require(_0x4d30('0x13'));var config=require(_0x4d30('0x14'));var db=require(_0x4d30('0x15'))['db'];config['redis']=_['defaults'](config[_0x4d30('0x16')],{'host':_0x4d30('0x17'),'port':0x18eb});var socket=require(_0x4d30('0x18'))(new Redis(config[_0x4d30('0x16')]));require(_0x4d30('0x19'))[_0x4d30('0x1a')](socket);function respondWithStatusCode(_0x2027e4,_0xdcfb04){_0xdcfb04=_0xdcfb04||0xcc;return function(_0x3de867){if(_0x3de867){return _0x2027e4[_0x4d30('0x1b')](_0xdcfb04);}return _0x2027e4[_0x4d30('0x1c')](_0xdcfb04)[_0x4d30('0x1d')]();};}function respondWithResult(_0x37cb98,_0x40776d){_0x40776d=_0x40776d||0xc8;return function(_0x5ca1a0){if(_0x5ca1a0){return _0x37cb98['status'](_0x40776d)['json'](_0x5ca1a0);}};}function respondWithFilteredResult(_0x277acb,_0x22d9ba){return function(_0x1106ba){if(_0x1106ba){var _0xfbc11d=_0x1106ba[_0x4d30('0x1e')],_0x16293e=_0x22d9ba[_0x4d30('0x1f')],_0x4bd5fc=_0x22d9ba[_0x4d30('0x1f')]+_0x22d9ba['limit'],_0x3f6394;if(_0x4bd5fc>=_0xfbc11d){_0x4bd5fc=_0xfbc11d;_0x3f6394=0xc8;}else{_0x3f6394=0xce;}_0x277acb['status'](_0x3f6394);return _0x277acb['set'](_0x4d30('0x20'),_0x16293e+'-'+_0x4bd5fc+'/'+_0xfbc11d)[_0x4d30('0x21')](_0x1106ba);}return null;};}function patchUpdates(_0x2728d0){return function(_0x53e27e){try{jsonpatch[_0x4d30('0x22')](_0x53e27e,_0x2728d0,!![]);}catch(_0x52dc99){return BPromise['reject'](_0x52dc99);}return _0x53e27e[_0x4d30('0x23')]();};}function saveUpdates(_0x35bbe2,_0x3bef2e){return function(_0x52e34d){if(_0x52e34d){return _0x52e34d[_0x4d30('0x24')](_0x35bbe2)[_0x4d30('0x25')](function(_0x409739){return _0x409739;});}return null;};}function removeEntity(_0x53dabc,_0x59cf32){return function(_0x296491){if(_0x296491){return _0x296491[_0x4d30('0x26')]()[_0x4d30('0x25')](function(){_0x53dabc[_0x4d30('0x1c')](0xcc)[_0x4d30('0x1d')]();});}};}function handleEntityNotFound(_0x444a53,_0x432e2d){return function(_0x277a55){if(!_0x277a55){_0x444a53['sendStatus'](0x194);}return _0x277a55;};}function handleError(_0x23e27b,_0x4c1ea9){_0x4c1ea9=_0x4c1ea9||0x1f4;return function(_0x516fb5){logger[_0x4d30('0x27')](_0x516fb5[_0x4d30('0x28')]);if(_0x516fb5[_0x4d30('0x29')]){delete _0x516fb5[_0x4d30('0x29')];}_0x23e27b[_0x4d30('0x1c')](_0x4c1ea9)[_0x4d30('0x2a')](_0x516fb5);};}exports[_0x4d30('0x2b')]=function(_0x2a6ca2,_0x378746){var _0x7a1058={'raw':![],'where':{'id':_0x2a6ca2['params']['id']}},_0x3610db={};_0x3610db[_0x4d30('0x2c')]=_[_0x4d30('0x2d')](db['DashboardItem']['rawAttributes']);_0x3610db['query']=_[_0x4d30('0x2d')](_0x2a6ca2['query']);_0x3610db[_0x4d30('0x2e')]=_['intersection'](_0x3610db['model'],_0x3610db[_0x4d30('0x2f')]);_0x7a1058[_0x4d30('0x30')]=_[_0x4d30('0x31')](_0x3610db[_0x4d30('0x2c')],qs[_0x4d30('0x32')](_0x2a6ca2[_0x4d30('0x2f')][_0x4d30('0x32')]));_0x7a1058['attributes']=_0x7a1058[_0x4d30('0x30')][_0x4d30('0x33')]?_0x7a1058['attributes']:_0x3610db['model'];if(_0x2a6ca2['query'][_0x4d30('0x34')]){_0x7a1058['include']=[{'all':!![]}];}_0x7a1058=_[_0x4d30('0x35')]({},_0x7a1058,_0x2a6ca2[_0x4d30('0x36')]);return db[_0x4d30('0x37')][_0x4d30('0x38')](_0x7a1058)[_0x4d30('0x25')](handleEntityNotFound(_0x378746,null))[_0x4d30('0x25')](respondWithResult(_0x378746,null))[_0x4d30('0x39')](handleError(_0x378746,null));};exports['destroy']=function(_0x3fa821,_0x611d14){return db[_0x4d30('0x37')][_0x4d30('0x38')]({'where':{'id':_0x3fa821[_0x4d30('0x3a')]['id']}})[_0x4d30('0x25')](handleEntityNotFound(_0x611d14,null))[_0x4d30('0x25')](removeEntity(_0x611d14,null))[_0x4d30('0x39')](handleError(_0x611d14,null));};function widgetAttributes(_0x1d1033){try{switch(_0x1d1033[_0x4d30('0x3b')]){case _0x4d30('0x3c'):return[{'name':_0x4d30('0x3d'),'value':_0x1d1033[_0x4d30('0x3d')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x0]?_0x1d1033['attrs'][0x0][_0x4d30('0x3f')]:undefined)||_0x4d30('0x40')}];case'custom':return[{'name':'attrPath','value':_0x1d1033[_0x4d30('0x41')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x0]?_0x1d1033[_0x4d30('0x3e')][0x0][_0x4d30('0x3f')]:undefined)||''}];case _0x4d30('0x42'):return[{'name':_0x4d30('0x43'),'value':_0x1d1033[_0x4d30('0x43')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x0]?_0x1d1033[_0x4d30('0x3e')][0x0][_0x4d30('0x3f')]:undefined)||_0x4d30('0x44')},{'name':'attrTimezone','value':_0x1d1033[_0x4d30('0x45')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x1]?_0x1d1033[_0x4d30('0x3e')][0x1][_0x4d30('0x3f')]:undefined)||_0x4d30('0x46')},{'name':_0x4d30('0x47'),'value':_0x1d1033[_0x4d30('0x47')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x2]?_0x1d1033[_0x4d30('0x3e')][0x2][_0x4d30('0x3f')]:undefined)||0xc}];case _0x4d30('0x48'):return[{'name':_0x4d30('0x49'),'value':_0x1d1033[_0x4d30('0x49')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x0]?_0x1d1033[_0x4d30('0x3e')][0x0]['value']:undefined)||_0x4d30('0x4a')},{'name':'attrVoiceQueues','value':_0x1d1033[_0x4d30('0x4b')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x1]?_0x1d1033['attrs'][0x1]['value']:undefined)||[]},{'name':_0x4d30('0x47'),'value':_0x1d1033[_0x4d30('0x47')]||(_0x1d1033['attrs']&&_0x1d1033[_0x4d30('0x3e')][0x2]?_0x1d1033[_0x4d30('0x3e')][0x2][_0x4d30('0x3f')]:undefined)||0x14}];case'multibar-chart':case _0x4d30('0x4c'):return[{'name':_0x4d30('0x4d'),'value':_0x1d1033[_0x4d30('0x4d')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x0]?_0x1d1033[_0x4d30('0x3e')][0x0]['value']:undefined)||_0x4d30('0x4a')},{'name':_0x4d30('0x4e'),'value':_0x1d1033[_0x4d30('0x4e')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x1]?_0x1d1033[_0x4d30('0x3e')][0x1][_0x4d30('0x3f')]:undefined)||null},{'name':_0x4d30('0x4f'),'value':_0x1d1033[_0x4d30('0x4f')]||(_0x1d1033['attrs']&&_0x1d1033[_0x4d30('0x3e')][0x2]?_0x1d1033[_0x4d30('0x3e')][0x2]['value']:undefined)||null},{'name':_0x4d30('0x4b'),'value':_0x1d1033[_0x4d30('0x4b')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x3]?_0x1d1033[_0x4d30('0x3e')][0x3][_0x4d30('0x3f')]:undefined)||[]}];case _0x4d30('0x50'):return[{'name':_0x4d30('0x51'),'type':_0x1d1033[_0x4d30('0x52')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x0]?_0x1d1033[_0x4d30('0x3e')][0x0][_0x4d30('0x3b')]:undefined)||null,'value':_0x1d1033['attrReport']||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033[_0x4d30('0x3e')][0x0]?_0x1d1033['attrs'][0x0][_0x4d30('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0x1d1033[_0x4d30('0x53')]||(_0x1d1033[_0x4d30('0x3e')]&&_0x1d1033['attrs'][0x1]?_0x1d1033[_0x4d30('0x3e')][0x1][_0x4d30('0x3f')]:undefined)||0x0}];default:return[];}}catch(_0x5a124f){logger[_0x4d30('0x27')](_0x4d30('0x54'),JSON['stringify'](_0x5a124f));return[];}}exports[_0x4d30('0x55')]=function(_0x221d82,_0x1b0446){if(_0x221d82['body']){_0x221d82[_0x4d30('0x56')][_0x4d30('0x3e')]=widgetAttributes(_0x221d82[_0x4d30('0x56')]);}return db[_0x4d30('0x37')][_0x4d30('0x55')](_0x221d82[_0x4d30('0x56')],{})[_0x4d30('0x25')](respondWithResult(_0x1b0446,0xc9))[_0x4d30('0x39')](handleError(_0x1b0446,null));};exports[_0x4d30('0x24')]=function(_0x2438db,_0x3b7feb){if(_0x2438db[_0x4d30('0x56')]['id']){delete _0x2438db[_0x4d30('0x56')]['id'];}_0x2438db[_0x4d30('0x56')][_0x4d30('0x3e')]=widgetAttributes(_0x2438db[_0x4d30('0x56')]);return db['DashboardItem'][_0x4d30('0x38')]({'where':{'id':_0x2438db[_0x4d30('0x3a')]['id']}})[_0x4d30('0x25')](handleEntityNotFound(_0x3b7feb,null))[_0x4d30('0x25')](saveUpdates(_0x2438db[_0x4d30('0x56')],null))[_0x4d30('0x25')](respondWithResult(_0x3b7feb,null))[_0x4d30('0x39')](handleError(_0x3b7feb,null));}; \ No newline at end of file +var _0xa165=['attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','defaults','localhost','socket.io-emitter','redis','./dashboardItem.socket','register','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','include','merge','find','catch','type','iframe','attrUrl','attrs','value','custom','attrPath','clock','attrHourFormat','attrTimezone','0.00','attrFontSize','counter','attrMetric','total'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xa165,0x67));var _0x5a16=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0xa165[_0x2c7618];return _0x5ce3f0;};'use strict';var pdf=require(_0x5a16('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5a16('0x1'));var zipdir=require(_0x5a16('0x2'));var jsonpatch=require(_0x5a16('0x3'));var rp=require('request-promise');var moment=require(_0x5a16('0x4'));var BPromise=require(_0x5a16('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5a16('0x6'));var sox=require('sox');var csv=require(_0x5a16('0x7'));var ejs=require(_0x5a16('0x8'));var fs=require('fs');var _=require(_0x5a16('0x9'));var squel=require(_0x5a16('0xa'));var crypto=require(_0x5a16('0xb'));var jsforce=require(_0x5a16('0xc'));var deskjs=require(_0x5a16('0xd'));var toCsv=require(_0x5a16('0x7'));var querystring=require(_0x5a16('0xe'));var Papa=require('papaparse');var Redis=require(_0x5a16('0xf'));var authService=require(_0x5a16('0x10'));var qs=require(_0x5a16('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5a16('0x12'));var logger=require('../../config/logger')(_0x5a16('0x13'));var utils=require('../../config/utils');var config=require(_0x5a16('0x14'));var db=require(_0x5a16('0x15'))['db'];config['redis']=_[_0x5a16('0x16')](config['redis'],{'host':_0x5a16('0x17'),'port':0x18eb});var socket=require(_0x5a16('0x18'))(new Redis(config[_0x5a16('0x19')]));require(_0x5a16('0x1a'))[_0x5a16('0x1b')](socket);function respondWithStatusCode(_0x4f721a,_0x32a834){_0x32a834=_0x32a834||0xcc;return function(_0x4e4a3b){if(_0x4e4a3b){return _0x4f721a[_0x5a16('0x1c')](_0x32a834);}return _0x4f721a[_0x5a16('0x1d')](_0x32a834)[_0x5a16('0x1e')]();};}function respondWithResult(_0x232792,_0x6d3b8c){_0x6d3b8c=_0x6d3b8c||0xc8;return function(_0x4e55a4){if(_0x4e55a4){return _0x232792[_0x5a16('0x1d')](_0x6d3b8c)[_0x5a16('0x1f')](_0x4e55a4);}};}function respondWithFilteredResult(_0x59f793,_0x1708e7){return function(_0x2d1805){if(_0x2d1805){var _0x191916=_0x2d1805['count'],_0x1c56d3=_0x1708e7[_0x5a16('0x20')],_0x1cfd36=_0x1708e7[_0x5a16('0x20')]+_0x1708e7[_0x5a16('0x21')],_0x52074b;if(_0x1cfd36>=_0x191916){_0x1cfd36=_0x191916;_0x52074b=0xc8;}else{_0x52074b=0xce;}_0x59f793[_0x5a16('0x1d')](_0x52074b);return _0x59f793[_0x5a16('0x22')](_0x5a16('0x23'),_0x1c56d3+'-'+_0x1cfd36+'/'+_0x191916)['json'](_0x2d1805);}return null;};}function patchUpdates(_0xe82a8a){return function(_0x4b3f3c){try{jsonpatch[_0x5a16('0x24')](_0x4b3f3c,_0xe82a8a,!![]);}catch(_0x804a5b){return BPromise[_0x5a16('0x25')](_0x804a5b);}return _0x4b3f3c['save']();};}function saveUpdates(_0x59345d,_0x5148cf){return function(_0x3dab99){if(_0x3dab99){return _0x3dab99[_0x5a16('0x26')](_0x59345d)[_0x5a16('0x27')](function(_0x3f42e7){return _0x3f42e7;});}return null;};}function removeEntity(_0x14e9c4,_0x2e97d9){return function(_0x2da2c1){if(_0x2da2c1){return _0x2da2c1[_0x5a16('0x28')]()[_0x5a16('0x27')](function(){_0x14e9c4[_0x5a16('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1b99ce,_0x4e7157){return function(_0x4bee7b){if(!_0x4bee7b){_0x1b99ce[_0x5a16('0x1c')](0x194);}return _0x4bee7b;};}function handleError(_0x1111e8,_0x504309){_0x504309=_0x504309||0x1f4;return function(_0x5eda3f){logger[_0x5a16('0x29')](_0x5eda3f[_0x5a16('0x2a')]);if(_0x5eda3f['name']){delete _0x5eda3f[_0x5a16('0x2b')];}_0x1111e8['status'](_0x504309)[_0x5a16('0x2c')](_0x5eda3f);};}exports[_0x5a16('0x2d')]=function(_0x4207c1,_0x4ccc2a){var _0x49125d={'raw':![],'where':{'id':_0x4207c1[_0x5a16('0x2e')]['id']}},_0x2478b1={};_0x2478b1[_0x5a16('0x2f')]=_[_0x5a16('0x30')](db[_0x5a16('0x31')][_0x5a16('0x32')]);_0x2478b1[_0x5a16('0x33')]=_[_0x5a16('0x30')](_0x4207c1[_0x5a16('0x33')]);_0x2478b1[_0x5a16('0x34')]=_[_0x5a16('0x35')](_0x2478b1['model'],_0x2478b1[_0x5a16('0x33')]);_0x49125d[_0x5a16('0x36')]=_[_0x5a16('0x35')](_0x2478b1['model'],qs[_0x5a16('0x37')](_0x4207c1[_0x5a16('0x33')]['fields']));_0x49125d[_0x5a16('0x36')]=_0x49125d[_0x5a16('0x36')][_0x5a16('0x38')]?_0x49125d[_0x5a16('0x36')]:_0x2478b1[_0x5a16('0x2f')];if(_0x4207c1[_0x5a16('0x33')][_0x5a16('0x39')]){_0x49125d[_0x5a16('0x3a')]=[{'all':!![]}];}_0x49125d=_[_0x5a16('0x3b')]({},_0x49125d,_0x4207c1['options']);return db[_0x5a16('0x31')][_0x5a16('0x3c')](_0x49125d)[_0x5a16('0x27')](handleEntityNotFound(_0x4ccc2a,null))[_0x5a16('0x27')](respondWithResult(_0x4ccc2a,null))[_0x5a16('0x3d')](handleError(_0x4ccc2a,null));};exports[_0x5a16('0x28')]=function(_0x6fe4bf,_0x45e494){return db[_0x5a16('0x31')][_0x5a16('0x3c')]({'where':{'id':_0x6fe4bf[_0x5a16('0x2e')]['id']}})['then'](handleEntityNotFound(_0x45e494,null))['then'](removeEntity(_0x45e494,null))['catch'](handleError(_0x45e494,null));};function widgetAttributes(_0x3dfdcf){try{switch(_0x3dfdcf[_0x5a16('0x3e')]){case _0x5a16('0x3f'):return[{'name':_0x5a16('0x40'),'value':_0x3dfdcf[_0x5a16('0x40')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x0]?_0x3dfdcf[_0x5a16('0x41')][0x0][_0x5a16('0x42')]:undefined)||'https://'}];case _0x5a16('0x43'):return[{'name':_0x5a16('0x44'),'value':_0x3dfdcf[_0x5a16('0x44')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x0]?_0x3dfdcf['attrs'][0x0]['value']:undefined)||''}];case _0x5a16('0x45'):return[{'name':'attrHourFormat','value':_0x3dfdcf[_0x5a16('0x46')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x0]?_0x3dfdcf[_0x5a16('0x41')][0x0][_0x5a16('0x42')]:undefined)||'HH:mm:ss'},{'name':_0x5a16('0x47'),'value':_0x3dfdcf[_0x5a16('0x47')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x1]?_0x3dfdcf[_0x5a16('0x41')][0x1][_0x5a16('0x42')]:undefined)||_0x5a16('0x48')},{'name':_0x5a16('0x49'),'value':_0x3dfdcf[_0x5a16('0x49')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x2]?_0x3dfdcf[_0x5a16('0x41')][0x2][_0x5a16('0x42')]:undefined)||0xc}];case _0x5a16('0x4a'):return[{'name':_0x5a16('0x4b'),'value':_0x3dfdcf[_0x5a16('0x4b')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf['attrs'][0x0]?_0x3dfdcf[_0x5a16('0x41')][0x0][_0x5a16('0x42')]:undefined)||_0x5a16('0x4c')},{'name':_0x5a16('0x4d'),'value':_0x3dfdcf[_0x5a16('0x4d')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x1]?_0x3dfdcf['attrs'][0x1][_0x5a16('0x42')]:undefined)||[]},{'name':'attrFontSize','value':_0x3dfdcf[_0x5a16('0x49')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x2]?_0x3dfdcf[_0x5a16('0x41')][0x2][_0x5a16('0x42')]:undefined)||0x14}];case _0x5a16('0x4e'):case _0x5a16('0x4f'):return[{'name':'attrSerie1','value':_0x3dfdcf[_0x5a16('0x50')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x0]?_0x3dfdcf[_0x5a16('0x41')][0x0][_0x5a16('0x42')]:undefined)||_0x5a16('0x4c')},{'name':_0x5a16('0x51'),'value':_0x3dfdcf[_0x5a16('0x51')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x1]?_0x3dfdcf[_0x5a16('0x41')][0x1]['value']:undefined)||null},{'name':_0x5a16('0x52'),'value':_0x3dfdcf[_0x5a16('0x52')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x2]?_0x3dfdcf[_0x5a16('0x41')][0x2]['value']:undefined)||null},{'name':'attrVoiceQueues','value':_0x3dfdcf[_0x5a16('0x4d')]||(_0x3dfdcf['attrs']&&_0x3dfdcf[_0x5a16('0x41')][0x3]?_0x3dfdcf['attrs'][0x3][_0x5a16('0x42')]:undefined)||[]}];case _0x5a16('0x53'):return[{'name':_0x5a16('0x54'),'type':_0x3dfdcf[_0x5a16('0x55')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf['attrs'][0x0]?_0x3dfdcf[_0x5a16('0x41')][0x0][_0x5a16('0x3e')]:undefined)||null,'value':_0x3dfdcf[_0x5a16('0x54')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x0]?_0x3dfdcf['attrs'][0x0][_0x5a16('0x42')]:undefined)||null},{'name':_0x5a16('0x56'),'value':_0x3dfdcf[_0x5a16('0x56')]||(_0x3dfdcf[_0x5a16('0x41')]&&_0x3dfdcf[_0x5a16('0x41')][0x1]?_0x3dfdcf['attrs'][0x1][_0x5a16('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x2db1a7){logger[_0x5a16('0x29')](_0x5a16('0x57'),JSON['stringify'](_0x2db1a7));return[];}}exports[_0x5a16('0x58')]=function(_0x53bab8,_0x6a0ec1){if(_0x53bab8[_0x5a16('0x59')]){_0x53bab8[_0x5a16('0x59')][_0x5a16('0x41')]=widgetAttributes(_0x53bab8[_0x5a16('0x59')]);}return db[_0x5a16('0x31')]['create'](_0x53bab8[_0x5a16('0x59')],{})[_0x5a16('0x27')](respondWithResult(_0x6a0ec1,0xc9))[_0x5a16('0x3d')](handleError(_0x6a0ec1,null));};exports[_0x5a16('0x26')]=function(_0x37c0a0,_0x14667a){if(_0x37c0a0[_0x5a16('0x59')]['id']){delete _0x37c0a0[_0x5a16('0x59')]['id'];}_0x37c0a0['body'][_0x5a16('0x41')]=widgetAttributes(_0x37c0a0[_0x5a16('0x59')]);return db['DashboardItem'][_0x5a16('0x3c')]({'where':{'id':_0x37c0a0[_0x5a16('0x2e')]['id']}})[_0x5a16('0x27')](handleEntityNotFound(_0x14667a,null))['then'](saveUpdates(_0x37c0a0[_0x5a16('0x59')],null))[_0x5a16('0x27')](respondWithResult(_0x14667a,null))[_0x5a16('0x3d')](handleError(_0x14667a,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index f80426a..bd800d6 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 _0x8709=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x333714,_0x3370ac){var _0x4c211e=function(_0x34219b){while(--_0x34219b){_0x333714['push'](_0x333714['shift']());}};_0x4c211e(++_0x3370ac);}(_0x8709,0xc6));var _0x9870=function(_0x3cbc98,_0x4af397){_0x3cbc98=_0x3cbc98-0x0;var _0x9a80c3=_0x8709[_0x3cbc98];return _0x9a80c3;};'use strict';var EventEmitter=require(_0x9870('0x0'));var DashboardItem=require(_0x9870('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x9870('0x2')](0x0);var events={'afterCreate':_0x9870('0x3'),'afterUpdate':_0x9870('0x4'),'afterDestroy':_0x9870('0x5')};function emitEvent(_0x3dfed8){return function(_0x1ab839,_0x1cd217,_0x53300e){DashboardItemEvents[_0x9870('0x6')](_0x3dfed8+':'+_0x1ab839['id'],_0x1ab839);DashboardItemEvents['emit'](_0x3dfed8,_0x1ab839);_0x53300e(null);};}for(var e in events){if(events[_0x9870('0x7')](e)){var event=events[e];DashboardItem[_0x9870('0x8')](e,emitEvent(event));}}module[_0x9870('0x9')]=DashboardItemEvents; \ No newline at end of file +var _0x00bc=['hasOwnProperty','exports','events','../../mysqldb','DashboardItem','setMaxListeners','save','update','emit'];(function(_0x59571c,_0x327ea1){var _0x2c3889=function(_0x508e5e){while(--_0x508e5e){_0x59571c['push'](_0x59571c['shift']());}};_0x2c3889(++_0x327ea1);}(_0x00bc,0x17c));var _0xc00b=function(_0x5059a5,_0x37451b){_0x5059a5=_0x5059a5-0x0;var _0x2258e2=_0x00bc[_0x5059a5];return _0x2258e2;};'use strict';var EventEmitter=require(_0xc00b('0x0'));var DashboardItem=require(_0xc00b('0x1'))['db'][_0xc00b('0x2')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xc00b('0x3')](0x0);var events={'afterCreate':_0xc00b('0x4'),'afterUpdate':_0xc00b('0x5'),'afterDestroy':'remove'};function emitEvent(_0x5622b0){return function(_0x5599c4,_0x1252da,_0x596f4e){DashboardItemEvents[_0xc00b('0x6')](_0x5622b0+':'+_0x5599c4['id'],_0x5599c4);DashboardItemEvents['emit'](_0x5622b0,_0x5599c4);_0x596f4e(null);};}for(var e in events){if(events[_0xc00b('0x7')](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0xc00b('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 1416e56..4cd88a4 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 _0xb02e=['request-promise','rimraf','../../config/environment','./dashboardItem.attributes','define','DashboardItem','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2d5aff,_0x218bf9){var _0x71f75c=function(_0xf67087){while(--_0xf67087){_0x2d5aff['push'](_0x2d5aff['shift']());}};_0x71f75c(++_0x218bf9);}(_0xb02e,0xa0));var _0xeb02=function(_0x40ccce,_0x3d53f8){_0x40ccce=_0x40ccce-0x0;var _0x59e663=_0xb02e[_0x40ccce];return _0x59e663;};'use strict';var _=require(_0xeb02('0x0'));var util=require('util');var logger=require(_0xeb02('0x1'))(_0xeb02('0x2'));var moment=require(_0xeb02('0x3'));var BPromise=require(_0xeb02('0x4'));var rp=require(_0xeb02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb02('0x6'));var config=require(_0xeb02('0x7'));var attributes=require(_0xeb02('0x8'));module['exports']=function(_0x569ac6,_0xdf611e){return _0x569ac6[_0xeb02('0x9')](_0xeb02('0xa'),attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe26d=['moment','bluebird','request-promise','../../config/environment','dashboard_items','lodash','util','api'];(function(_0x375325,_0x57a850){var _0x228f57=function(_0x2ad744){while(--_0x2ad744){_0x375325['push'](_0x375325['shift']());}};_0x228f57(++_0x57a850);}(_0xe26d,0x1e5));var _0xde26=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xe26d[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xde26('0x0'));var util=require(_0xde26('0x1'));var logger=require('../../config/logger')(_0xde26('0x2'));var moment=require(_0xde26('0x3'));var BPromise=require(_0xde26('0x4'));var rp=require(_0xde26('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xde26('0x6'));var attributes=require('./dashboardItem.attributes');module['exports']=function(_0x1676ef,_0x580d26){return _0x1676ef['define']('DashboardItem',attributes,{'tableName':_0xde26('0x7'),'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 350ffca..59d3459 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 _0xf3f3=['message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','code','error'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xf3f3,0x11b));var _0x3f3f=function(_0x59b439,_0x14ae7b){_0x59b439=_0x59b439-0x0;var _0x521ea3=_0xf3f3[_0x59b439];return _0x521ea3;};'use strict';var _=require(_0x3f3f('0x0'));var util=require(_0x3f3f('0x1'));var moment=require('moment');var BPromise=require(_0x3f3f('0x2'));var rs=require(_0x3f3f('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3f3f('0x4'))['db'];var utils=require(_0x3f3f('0x5'));var logger=require(_0x3f3f('0x6'))(_0x3f3f('0x7'));var config=require('../../config/environment');var jayson=require(_0x3f3f('0x8'));var client=jayson[_0x3f3f('0x9')][_0x3f3f('0xa')]({'port':0x232a});config[_0x3f3f('0xb')]=_[_0x3f3f('0xc')](config[_0x3f3f('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3f3f('0xb')]));require(_0x3f3f('0xd'))[_0x3f3f('0xe')](socket);function respondWithRpcPromise(_0x1b0551,_0x24d158,_0x2c787c){return new BPromise(function(_0x22443b,_0x2bca39){return client[_0x3f3f('0xf')](_0x1b0551,_0x2c787c)[_0x3f3f('0x10')](function(_0x43ec76){logger[_0x3f3f('0x11')](_0x3f3f('0x12'),_0x24d158,_0x3f3f('0x13'));logger[_0x3f3f('0x14')](_0x3f3f('0x15'),_0x24d158,_0x3f3f('0x13'),JSON[_0x3f3f('0x16')](_0x43ec76));if(_0x43ec76['error']){if(_0x43ec76['error'][_0x3f3f('0x17')]===0x1f4){logger[_0x3f3f('0x18')](_0x3f3f('0x12'),_0x24d158,_0x43ec76[_0x3f3f('0x18')]['message']);return _0x2bca39(_0x43ec76[_0x3f3f('0x18')]['message']);}logger['error'](_0x3f3f('0x12'),_0x24d158,_0x43ec76['error'][_0x3f3f('0x19')]);return _0x22443b(_0x43ec76[_0x3f3f('0x18')][_0x3f3f('0x19')]);}else{logger['info'](_0x3f3f('0x12'),_0x24d158,_0x3f3f('0x13'));_0x22443b(_0x43ec76[_0x3f3f('0x1a')][_0x3f3f('0x19')]);}})[_0x3f3f('0x1b')](function(_0x1d88cc){logger[_0x3f3f('0x18')](_0x3f3f('0x12'),_0x24d158,_0x1d88cc);_0x2bca39(_0x1d88cc);});});} \ No newline at end of file +var _0x2952=['message','request\x20sent','result','catch','lodash','util','moment','ioredis','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./dashboardItem.socket','register','request','then','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x10d0bf,_0x5f3acb){var _0x2dabd4=function(_0x288ab9){while(--_0x288ab9){_0x10d0bf['push'](_0x10d0bf['shift']());}};_0x2dabd4(++_0x5f3acb);}(_0x2952,0x86));var _0x2295=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x2952[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0x2295('0x0'));var util=require(_0x2295('0x1'));var moment=require(_0x2295('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2295('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2295('0x4'));var config=require(_0x2295('0x5'));var jayson=require(_0x2295('0x6'));var client=jayson[_0x2295('0x7')][_0x2295('0x8')]({'port':0x232a});config[_0x2295('0x9')]=_[_0x2295('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x2295('0xb'))(new Redis(config['redis']));require(_0x2295('0xc'))[_0x2295('0xd')](socket);function respondWithRpcPromise(_0x3a1b61,_0x1e6559,_0x34d881){return new BPromise(function(_0x2c2f08,_0x29c3af){return client[_0x2295('0xe')](_0x3a1b61,_0x34d881)[_0x2295('0xf')](function(_0x1493cc){logger[_0x2295('0x10')](_0x2295('0x11'),_0x1e6559,'request\x20sent');logger[_0x2295('0x12')](_0x2295('0x13'),_0x1e6559,'request\x20sent',JSON['stringify'](_0x1493cc));if(_0x1493cc[_0x2295('0x14')]){if(_0x1493cc[_0x2295('0x14')][_0x2295('0x15')]===0x1f4){logger[_0x2295('0x14')](_0x2295('0x11'),_0x1e6559,_0x1493cc[_0x2295('0x14')][_0x2295('0x16')]);return _0x29c3af(_0x1493cc[_0x2295('0x14')][_0x2295('0x16')]);}logger[_0x2295('0x14')](_0x2295('0x11'),_0x1e6559,_0x1493cc[_0x2295('0x14')]['message']);return _0x2c2f08(_0x1493cc[_0x2295('0x14')]['message']);}else{logger[_0x2295('0x10')](_0x2295('0x11'),_0x1e6559,_0x2295('0x17'));_0x2c2f08(_0x1493cc[_0x2295('0x18')][_0x2295('0x16')]);}})[_0x2295('0x19')](function(_0x3ff056){logger[_0x2295('0x14')]('DashboardItem,\x20%s,\x20%s',_0x1e6559,_0x3ff056);_0x29c3af(_0x3ff056);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0283733..275423c 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 _0x625a=['removeListener','register','./dashboardItem.events','save','update'];(function(_0x4f0a8c,_0x37e545){var _0x250654=function(_0x3131fa){while(--_0x3131fa){_0x4f0a8c['push'](_0x4f0a8c['shift']());}};_0x250654(++_0x37e545);}(_0x625a,0xe3));var _0xa625=function(_0x8cb2f9,_0x2b8706){_0x8cb2f9=_0x8cb2f9-0x0;var _0x164887=_0x625a[_0x8cb2f9];return _0x164887;};'use strict';var DashboardItemEvents=require(_0xa625('0x0'));var events=[_0xa625('0x1'),'remove',_0xa625('0x2')];function createListener(_0x35ae6c,_0xfe8505){return function(_0x3921d6){_0xfe8505['emit'](_0x35ae6c,_0x3921d6);};}function removeListener(_0x369c20,_0x3f0b03){return function(){DashboardItemEvents[_0xa625('0x3')](_0x369c20,_0x3f0b03);};}exports[_0xa625('0x4')]=function(_0x120bd6){for(var _0x9a0dbd=0x0,_0x1207c3=events['length'];_0x9a0dbd<_0x1207c3;_0x9a0dbd++){var _0x416cc8=events[_0x9a0dbd];var _0x2d84f6=createListener('dashboardItem:'+_0x416cc8,_0x120bd6);DashboardItemEvents['on'](_0x416cc8,_0x2d84f6);}}; \ No newline at end of file +var _0xc053=['emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','remove','update'];(function(_0x726eba,_0x23d3be){var _0x29a451=function(_0x2c72c6){while(--_0x2c72c6){_0x726eba['push'](_0x726eba['shift']());}};_0x29a451(++_0x23d3be);}(_0xc053,0x64));var _0x3c05=function(_0x3cd241,_0x2483d3){_0x3cd241=_0x3cd241-0x0;var _0x1e702c=_0xc053[_0x3cd241];return _0x1e702c;};'use strict';var DashboardItemEvents=require(_0x3c05('0x0'));var events=[_0x3c05('0x1'),_0x3c05('0x2'),_0x3c05('0x3')];function createListener(_0xf56b6e,_0x41ef27){return function(_0x27a949){_0x41ef27[_0x3c05('0x4')](_0xf56b6e,_0x27a949);};}function removeListener(_0x3141fb,_0x567d5e){return function(){DashboardItemEvents[_0x3c05('0x5')](_0x3141fb,_0x567d5e);};}exports['register']=function(_0x1eacab){for(var _0x147018=0x0,_0x3ffc95=events[_0x3c05('0x6')];_0x147018<_0x3ffc95;_0x147018++){var _0x249444=events[_0x147018];var _0x15afdc=createListener(_0x3c05('0x7')+_0x249444,_0x1eacab);DashboardItemEvents['on'](_0x249444,_0x15afdc);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index e7e319d..c02a331 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 _0x9c5a=['delete','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','show','post','put','update'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0xa4e686,_0x4508e1){_0xa4e686=_0xa4e686-0x0;var _0x4755d2=_0x9c5a[_0xa4e686];return _0x4755d2;};'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'](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9c5('0xb')](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/:id',auth[_0xa9c5('0xe')](),controller[_0xa9c5('0xf')]);module['exports']=router; \ No newline at end of file +var _0x9c5a=['delete','isAuthenticated','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./dashboardItem.controller','/:id','show','post','put','update'];(function(_0x4ce028,_0x526d4b){var _0x583d0c=function(_0x874178){while(--_0x874178){_0x4ce028['push'](_0x4ce028['shift']());}};_0x583d0c(++_0x526d4b);}(_0x9c5a,0x1c3));var _0xa9c5=function(_0x219a5b,_0x5779ce){_0x219a5b=_0x219a5b-0x0;var _0x36aa92=_0x9c5a[_0x219a5b];return _0x36aa92;};'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'](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0x9')]);router[_0xa9c5('0xa')]('/',auth['isAuthenticated'](),controller['create']);router[_0xa9c5('0xb')](_0xa9c5('0x8'),auth['isAuthenticated'](),controller[_0xa9c5('0xc')]);router[_0xa9c5('0xd')]('/:id',auth[_0xa9c5('0xe')](),controller[_0xa9c5('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 41eaa07..23ca7a9 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 _0xf844=['STRING','sequelize'];(function(_0x49d26b,_0x1e552d){var _0x1c341c=function(_0x3b5f45){while(--_0x3b5f45){_0x49d26b['push'](_0x49d26b['shift']());}};_0x1c341c(++_0x1e552d);}(_0xf844,0x1f3));var _0x4f84=function(_0x41e793,_0x166684){_0x41e793=_0x41e793-0x0;var _0x2885fa=_0xf844[_0x41e793];return _0x2885fa;};'use strict';var Sequelize=require(_0x4f84('0x0'));module['exports']={'name':{'type':Sequelize[_0x4f84('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x9328=['exports'];(function(_0x395bfe,_0x4db521){var _0x35c81c=function(_0x484a1b){while(--_0x484a1b){_0x395bfe['push'](_0x395bfe['shift']());}};_0x35c81c(++_0x4db521);}(_0x9328,0x1d5));var _0x8932=function(_0x16d4ec,_0x502285){_0x16d4ec=_0x16d4ec-0x0;var _0x39104a=_0x9328[_0x16d4ec];return _0x39104a;};'use strict';var Sequelize=require('sequelize');module[_0x8932('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 39f9126..d379ec0 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 _0x00bb=['limit','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','create','Dispositions','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','sendStatus','status','end','json','count','offset','Content-Range','apply','update','then','destroy','get','UserProfileResource','error','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','model','map','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x2c183c,_0x4883bf){var _0xc66563=function(_0x2f9026){while(--_0x2f9026){_0x2c183c['push'](_0x2c183c['shift']());}};_0xc66563(++_0x4883bf);}(_0x00bb,0x1d8));var _0xb00b=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x00bb[_0x55e08b];return _0xd1a7ff;};'use strict';var pdf=require(_0xb00b('0x0'));var emlformat=require(_0xb00b('0x1'));var rimraf=require(_0xb00b('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb00b('0x3'));var rp=require('request-promise');var moment=require(_0xb00b('0x4'));var BPromise=require(_0xb00b('0x5'));var Mustache=require('mustache');var util=require(_0xb00b('0x6'));var path=require(_0xb00b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4ff792,_0x2d8ddf){_0x2d8ddf=_0x2d8ddf||0xcc;return function(_0x1be8aa){if(_0x1be8aa){return _0x4ff792[_0xb00b('0x14')](_0x2d8ddf);}return _0x4ff792[_0xb00b('0x15')](_0x2d8ddf)[_0xb00b('0x16')]();};}function respondWithResult(_0x4ada81,_0x218de2){_0x218de2=_0x218de2||0xc8;return function(_0xb0d42e){if(_0xb0d42e){return _0x4ada81['status'](_0x218de2)[_0xb00b('0x17')](_0xb0d42e);}};}function respondWithFilteredResult(_0x1084a6,_0x540b79){return function(_0x5da36b){if(_0x5da36b){var _0x9b471e=_0x5da36b[_0xb00b('0x18')],_0x4dcd45=_0x540b79[_0xb00b('0x19')],_0x51d136=_0x540b79[_0xb00b('0x19')]+_0x540b79['limit'],_0x1f9c78;if(_0x51d136>=_0x9b471e){_0x51d136=_0x9b471e;_0x1f9c78=0xc8;}else{_0x1f9c78=0xce;}_0x1084a6[_0xb00b('0x15')](_0x1f9c78);return _0x1084a6['set'](_0xb00b('0x1a'),_0x4dcd45+'-'+_0x51d136+'/'+_0x9b471e)['json'](_0x5da36b);}return null;};}function patchUpdates(_0x25d7a0){return function(_0x5e8d7b){try{jsonpatch[_0xb00b('0x1b')](_0x5e8d7b,_0x25d7a0,!![]);}catch(_0x3355a3){return BPromise['reject'](_0x3355a3);}return _0x5e8d7b['save']();};}function saveUpdates(_0x2b0da1,_0x4a334b){return function(_0x1344c4){if(_0x1344c4){return _0x1344c4[_0xb00b('0x1c')](_0x2b0da1)[_0xb00b('0x1d')](function(_0x3501af){return _0x3501af;});}return null;};}function removeEntity(_0x56c189,_0x362ee0){return function(_0x4df284){if(_0x4df284){return _0x4df284[_0xb00b('0x1e')]()[_0xb00b('0x1d')](function(){var _0x51b841=_0x4df284[_0xb00b('0x1f')]({'plain':!![]});var _0x2896d1='Dispositions';return db[_0xb00b('0x20')][_0xb00b('0x1e')]({'where':{'type':_0x2896d1,'resourceId':_0x51b841['id']}})['then'](function(){return _0x4df284;});})[_0xb00b('0x1d')](function(){_0x56c189[_0xb00b('0x15')](0xcc)[_0xb00b('0x16')]();});}};}function handleEntityNotFound(_0x8caadf,_0x520e55){return function(_0x50be6c){if(!_0x50be6c){_0x8caadf[_0xb00b('0x14')](0x194);}return _0x50be6c;};}function handleError(_0x490380,_0x550587){_0x550587=_0x550587||0x1f4;return function(_0x4a635e){logger[_0xb00b('0x21')](_0x4a635e[_0xb00b('0x22')]);if(_0x4a635e[_0xb00b('0x23')]){delete _0x4a635e[_0xb00b('0x23')];}_0x490380[_0xb00b('0x15')](_0x550587)[_0xb00b('0x24')](_0x4a635e);};}exports[_0xb00b('0x25')]=function(_0x4a8d2b,_0x22c22d){var _0x503c9c={},_0x450129={},_0x348165={'count':0x0,'rows':[]};var _0x5424ca=_['map'](db[_0xb00b('0x26')][_0xb00b('0x27')],function(_0x16fbd5){return{'name':_0x16fbd5[_0xb00b('0x28')],'type':_0x16fbd5[_0xb00b('0x29')][_0xb00b('0x2a')]};});_0x450129[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x5424ca,_0xb00b('0x23'));_0x450129['query']=_[_0xb00b('0x2d')](_0x4a8d2b[_0xb00b('0x2e')]);_0x450129['filters']=_[_0xb00b('0x2f')](_0x450129[_0xb00b('0x2b')],_0x450129['query']);_0x503c9c[_0xb00b('0x30')]=_['intersection'](_0x450129[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x503c9c[_0xb00b('0x30')]=_0x503c9c[_0xb00b('0x30')][_0xb00b('0x32')]?_0x503c9c['attributes']:_0x450129['model'];if(!_0x4a8d2b['query'][_0xb00b('0x33')](_0xb00b('0x34'))){_0x503c9c[_0xb00b('0x35')]=qs[_0xb00b('0x35')](_0x4a8d2b['query'][_0xb00b('0x35')]);_0x503c9c[_0xb00b('0x19')]=qs[_0xb00b('0x19')](_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x19')]);}_0x503c9c[_0xb00b('0x36')]=qs[_0xb00b('0x37')](_0x4a8d2b[_0xb00b('0x2e')]['sort']);_0x503c9c['where']=qs[_0xb00b('0x38')](_['pick'](_0x4a8d2b[_0xb00b('0x2e')],_0x450129[_0xb00b('0x38')]));if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x39')]){_0x503c9c[_0xb00b('0x3a')]=_[_0xb00b('0x3b')](_0x503c9c[_0xb00b('0x3a')],{'$or':_['map'](_0x5424ca,function(_0x35f1ca){if(_0x35f1ca[_0xb00b('0x29')]!==_0xb00b('0x3c')){var _0xd9c03f={};_0xd9c03f[_0x35f1ca[_0xb00b('0x23')]]={'$like':'%'+_0x4a8d2b[_0xb00b('0x2e')]['filter']+'%'};return _0xd9c03f;}})});}_0x503c9c=_[_0xb00b('0x3b')]({},_0x503c9c,_0x4a8d2b[_0xb00b('0x3d')]);var _0x4801e7={'where':_0x503c9c[_0xb00b('0x3a')]};return db[_0xb00b('0x26')][_0xb00b('0x18')](_0x4801e7)[_0xb00b('0x1d')](function(_0x2954e8){_0x348165['count']=_0x2954e8;if(_0x4a8d2b[_0xb00b('0x2e')][_0xb00b('0x3e')]){_0x503c9c[_0xb00b('0x3f')]=[{'all':!![]}];}return db[_0xb00b('0x26')]['findAll'](_0x503c9c);})['then'](function(_0x43f834){_0x348165[_0xb00b('0x40')]=_0x43f834;return _0x348165;})[_0xb00b('0x1d')](respondWithFilteredResult(_0x22c22d,_0x503c9c))[_0xb00b('0x41')](handleError(_0x22c22d,null));};exports[_0xb00b('0x42')]=function(_0x26f17b,_0x275664){var _0x493841={'raw':!![],'where':{'id':_0x26f17b[_0xb00b('0x43')]['id']}},_0x36200d={};_0x36200d[_0xb00b('0x2b')]=_[_0xb00b('0x2d')](db[_0xb00b('0x26')][_0xb00b('0x27')]);_0x36200d[_0xb00b('0x2e')]=_[_0xb00b('0x2d')](_0x26f17b[_0xb00b('0x2e')]);_0x36200d[_0xb00b('0x38')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],_0x36200d['query']);_0x493841[_0xb00b('0x30')]=_[_0xb00b('0x2f')](_0x36200d[_0xb00b('0x2b')],qs[_0xb00b('0x31')](_0x26f17b[_0xb00b('0x2e')][_0xb00b('0x31')]));_0x493841[_0xb00b('0x30')]=_0x493841[_0xb00b('0x30')][_0xb00b('0x32')]?_0x493841[_0xb00b('0x30')]:_0x36200d[_0xb00b('0x2b')];if(_0x26f17b[_0xb00b('0x2e')]['includeAll']){_0x493841['include']=[{'all':!![]}];}_0x493841=_['merge']({},_0x493841,_0x26f17b[_0xb00b('0x3d')]);return db[_0xb00b('0x26')]['find'](_0x493841)[_0xb00b('0x1d')](handleEntityNotFound(_0x275664,null))[_0xb00b('0x1d')](respondWithResult(_0x275664,null))[_0xb00b('0x41')](handleError(_0x275664,null));};exports[_0xb00b('0x44')]=function(_0x4b62b3,_0x58e9cb){return db[_0xb00b('0x26')][_0xb00b('0x44')](_0x4b62b3['body'],{})['then'](function(_0x154759){var _0x3a205d=_0x4b62b3['user'][_0xb00b('0x1f')]({'plain':!![]});if(!_0x3a205d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a205d['role']==='user'){var _0x465d90=_0x154759['get']({'plain':!![]});var _0x1f7b86=_0xb00b('0x45');return db[_0xb00b('0x46')][_0xb00b('0x47')]({'where':{'name':_0x1f7b86,'userProfileId':_0x3a205d[_0xb00b('0x48')]},'raw':!![]})[_0xb00b('0x1d')](function(_0x4846c9){if(_0x4846c9&&_0x4846c9['autoAssociation']===0x0){return db[_0xb00b('0x20')][_0xb00b('0x44')]({'name':_0x465d90['name'],'resourceId':_0x465d90['id'],'type':_0x4846c9[_0xb00b('0x23')],'sectionId':_0x4846c9['id']},{})[_0xb00b('0x1d')](function(){return _0x154759;});}else{return _0x154759;}})['catch'](function(_0x15dcbf){logger[_0xb00b('0x21')](_0xb00b('0x49'),_0x15dcbf);throw _0x15dcbf;});}return _0x154759;})['then'](respondWithResult(_0x58e9cb,0xc9))['catch'](handleError(_0x58e9cb,null));};exports[_0xb00b('0x1c')]=function(_0x398deb,_0x12737d){if(_0x398deb[_0xb00b('0x4a')]['id']){delete _0x398deb['body']['id'];}return db[_0xb00b('0x26')][_0xb00b('0x47')]({'where':{'id':_0x398deb['params']['id']}})['then'](handleEntityNotFound(_0x12737d,null))[_0xb00b('0x1d')](saveUpdates(_0x398deb['body'],null))[_0xb00b('0x1d')](respondWithResult(_0x12737d,null))[_0xb00b('0x41')](handleError(_0x12737d,null));};exports[_0xb00b('0x1e')]=function(_0x222459,_0x450ce7){return db[_0xb00b('0x26')]['find']({'where':{'id':_0x222459[_0xb00b('0x43')]['id']}})['then'](handleEntityNotFound(_0x450ce7,null))[_0xb00b('0x1d')](removeEntity(_0x450ce7,null))[_0xb00b('0x41')](handleError(_0x450ce7,null));}; \ No newline at end of file +var _0x4d9e=['show','params','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','html-pdf','zip-dir','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','count','limit','Content-Range','apply','save','update','then','destroy','get','Dispositions','UserProfileResource','end','name','send','index','map','Disposition','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','offset','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','catch'];(function(_0x5406b7,_0x89ac7c){var _0x307f9a=function(_0xae1495){while(--_0xae1495){_0x5406b7['push'](_0x5406b7['shift']());}};_0x307f9a(++_0x89ac7c);}(_0x4d9e,0x18c));var _0xe4d9=function(_0xeaae90,_0x5d33bf){_0xeaae90=_0xeaae90-0x0;var _0x487f65=_0x4d9e[_0xeaae90];return _0x487f65;};'use strict';var pdf=require(_0xe4d9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xe4d9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe4d9('0x2'));var moment=require('moment');var BPromise=require(_0xe4d9('0x3'));var Mustache=require(_0xe4d9('0x4'));var util=require('util');var path=require(_0xe4d9('0x5'));var sox=require(_0xe4d9('0x6'));var csv=require(_0xe4d9('0x7'));var ejs=require(_0xe4d9('0x8'));var fs=require('fs');var _=require(_0xe4d9('0x9'));var squel=require(_0xe4d9('0xa'));var crypto=require('crypto');var jsforce=require(_0xe4d9('0xb'));var deskjs=require(_0xe4d9('0xc'));var toCsv=require(_0xe4d9('0x7'));var querystring=require(_0xe4d9('0xd'));var Papa=require(_0xe4d9('0xe'));var Redis=require(_0xe4d9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe4d9('0x10'));var as=require(_0xe4d9('0x11'));var hardwareService=require(_0xe4d9('0x12'));var logger=require(_0xe4d9('0x13'))(_0xe4d9('0x14'));var utils=require(_0xe4d9('0x15'));var config=require(_0xe4d9('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ee099,_0x580c50){_0x580c50=_0x580c50||0xcc;return function(_0x4e0d15){if(_0x4e0d15){return _0x5ee099['sendStatus'](_0x580c50);}return _0x5ee099['status'](_0x580c50)['end']();};}function respondWithResult(_0x5649e1,_0x15c0eb){_0x15c0eb=_0x15c0eb||0xc8;return function(_0x3238d4){if(_0x3238d4){return _0x5649e1[_0xe4d9('0x17')](_0x15c0eb)['json'](_0x3238d4);}};}function respondWithFilteredResult(_0x9f0442,_0x3f6ce4){return function(_0xe4f133){if(_0xe4f133){var _0x4283f7=_0xe4f133[_0xe4d9('0x18')],_0x58d0cf=_0x3f6ce4['offset'],_0x331ef3=_0x3f6ce4['offset']+_0x3f6ce4[_0xe4d9('0x19')],_0x35cbc2;if(_0x331ef3>=_0x4283f7){_0x331ef3=_0x4283f7;_0x35cbc2=0xc8;}else{_0x35cbc2=0xce;}_0x9f0442[_0xe4d9('0x17')](_0x35cbc2);return _0x9f0442['set'](_0xe4d9('0x1a'),_0x58d0cf+'-'+_0x331ef3+'/'+_0x4283f7)['json'](_0xe4f133);}return null;};}function patchUpdates(_0x469931){return function(_0x19f8ce){try{jsonpatch[_0xe4d9('0x1b')](_0x19f8ce,_0x469931,!![]);}catch(_0x2522f3){return BPromise['reject'](_0x2522f3);}return _0x19f8ce[_0xe4d9('0x1c')]();};}function saveUpdates(_0x3c2017,_0x151220){return function(_0x171224){if(_0x171224){return _0x171224[_0xe4d9('0x1d')](_0x3c2017)[_0xe4d9('0x1e')](function(_0x30d923){return _0x30d923;});}return null;};}function removeEntity(_0x29e0c9,_0x562bab){return function(_0x4fed7f){if(_0x4fed7f){return _0x4fed7f[_0xe4d9('0x1f')]()[_0xe4d9('0x1e')](function(){var _0x4f2143=_0x4fed7f[_0xe4d9('0x20')]({'plain':!![]});var _0x50d377=_0xe4d9('0x21');return db[_0xe4d9('0x22')]['destroy']({'where':{'type':_0x50d377,'resourceId':_0x4f2143['id']}})[_0xe4d9('0x1e')](function(){return _0x4fed7f;});})[_0xe4d9('0x1e')](function(){_0x29e0c9['status'](0xcc)[_0xe4d9('0x23')]();});}};}function handleEntityNotFound(_0x2af9b0,_0x36444c){return function(_0x5bb43b){if(!_0x5bb43b){_0x2af9b0['sendStatus'](0x194);}return _0x5bb43b;};}function handleError(_0x42e6a0,_0x2846e2){_0x2846e2=_0x2846e2||0x1f4;return function(_0x52ef56){logger['error'](_0x52ef56['stack']);if(_0x52ef56['name']){delete _0x52ef56[_0xe4d9('0x24')];}_0x42e6a0['status'](_0x2846e2)[_0xe4d9('0x25')](_0x52ef56);};}exports[_0xe4d9('0x26')]=function(_0x4192bb,_0x535200){var _0xec8d64={},_0x2a0d1f={},_0x250de5={'count':0x0,'rows':[]};var _0x45e8a3=_[_0xe4d9('0x27')](db[_0xe4d9('0x28')][_0xe4d9('0x29')],function(_0x449cb8){return{'name':_0x449cb8[_0xe4d9('0x2a')],'type':_0x449cb8[_0xe4d9('0x2b')][_0xe4d9('0x2c')]};});_0x2a0d1f[_0xe4d9('0x2d')]=_['map'](_0x45e8a3,_0xe4d9('0x24'));_0x2a0d1f[_0xe4d9('0x2e')]=_[_0xe4d9('0x2f')](_0x4192bb[_0xe4d9('0x2e')]);_0x2a0d1f[_0xe4d9('0x30')]=_[_0xe4d9('0x31')](_0x2a0d1f['model'],_0x2a0d1f['query']);_0xec8d64['attributes']=_[_0xe4d9('0x31')](_0x2a0d1f[_0xe4d9('0x2d')],qs[_0xe4d9('0x32')](_0x4192bb['query']['fields']));_0xec8d64['attributes']=_0xec8d64['attributes'][_0xe4d9('0x33')]?_0xec8d64[_0xe4d9('0x34')]:_0x2a0d1f['model'];if(!_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x35')]('nolimit')){_0xec8d64[_0xe4d9('0x19')]=qs[_0xe4d9('0x19')](_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x19')]);_0xec8d64[_0xe4d9('0x36')]=qs[_0xe4d9('0x36')](_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x36')]);}_0xec8d64[_0xe4d9('0x37')]=qs[_0xe4d9('0x38')](_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x38')]);_0xec8d64[_0xe4d9('0x39')]=qs[_0xe4d9('0x30')](_['pick'](_0x4192bb[_0xe4d9('0x2e')],_0x2a0d1f[_0xe4d9('0x30')]));if(_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x3a')]){_0xec8d64[_0xe4d9('0x39')]=_[_0xe4d9('0x3b')](_0xec8d64[_0xe4d9('0x39')],{'$or':_[_0xe4d9('0x27')](_0x45e8a3,function(_0x96a350){if(_0x96a350['type']!=='VIRTUAL'){var _0x5f5bc5={};_0x5f5bc5[_0x96a350[_0xe4d9('0x24')]]={'$like':'%'+_0x4192bb[_0xe4d9('0x2e')][_0xe4d9('0x3a')]+'%'};return _0x5f5bc5;}})});}_0xec8d64=_[_0xe4d9('0x3b')]({},_0xec8d64,_0x4192bb[_0xe4d9('0x3c')]);var _0x324679={'where':_0xec8d64[_0xe4d9('0x39')]};return db['Disposition']['count'](_0x324679)['then'](function(_0x3437cd){_0x250de5[_0xe4d9('0x18')]=_0x3437cd;if(_0x4192bb['query'][_0xe4d9('0x3d')]){_0xec8d64[_0xe4d9('0x3e')]=[{'all':!![]}];}return db[_0xe4d9('0x28')][_0xe4d9('0x3f')](_0xec8d64);})['then'](function(_0x2f5423){_0x250de5[_0xe4d9('0x40')]=_0x2f5423;return _0x250de5;})[_0xe4d9('0x1e')](respondWithFilteredResult(_0x535200,_0xec8d64))[_0xe4d9('0x41')](handleError(_0x535200,null));};exports[_0xe4d9('0x42')]=function(_0x1b9d00,_0x25b1f0){var _0x3e9653={'raw':!![],'where':{'id':_0x1b9d00[_0xe4d9('0x43')]['id']}},_0x86bc71={};_0x86bc71[_0xe4d9('0x2d')]=_['keys'](db[_0xe4d9('0x28')][_0xe4d9('0x29')]);_0x86bc71[_0xe4d9('0x2e')]=_[_0xe4d9('0x2f')](_0x1b9d00[_0xe4d9('0x2e')]);_0x86bc71['filters']=_[_0xe4d9('0x31')](_0x86bc71[_0xe4d9('0x2d')],_0x86bc71[_0xe4d9('0x2e')]);_0x3e9653[_0xe4d9('0x34')]=_[_0xe4d9('0x31')](_0x86bc71[_0xe4d9('0x2d')],qs[_0xe4d9('0x32')](_0x1b9d00[_0xe4d9('0x2e')][_0xe4d9('0x32')]));_0x3e9653[_0xe4d9('0x34')]=_0x3e9653['attributes'][_0xe4d9('0x33')]?_0x3e9653[_0xe4d9('0x34')]:_0x86bc71[_0xe4d9('0x2d')];if(_0x1b9d00['query'][_0xe4d9('0x3d')]){_0x3e9653[_0xe4d9('0x3e')]=[{'all':!![]}];}_0x3e9653=_[_0xe4d9('0x3b')]({},_0x3e9653,_0x1b9d00[_0xe4d9('0x3c')]);return db[_0xe4d9('0x28')][_0xe4d9('0x44')](_0x3e9653)[_0xe4d9('0x1e')](handleEntityNotFound(_0x25b1f0,null))['then'](respondWithResult(_0x25b1f0,null))[_0xe4d9('0x41')](handleError(_0x25b1f0,null));};exports[_0xe4d9('0x45')]=function(_0x38bc8f,_0x15ea5a){return db[_0xe4d9('0x28')][_0xe4d9('0x45')](_0x38bc8f['body'],{})[_0xe4d9('0x1e')](function(_0x119bdc){var _0x87f230=_0x38bc8f[_0xe4d9('0x46')][_0xe4d9('0x20')]({'plain':!![]});if(!_0x87f230)throw new Error(_0xe4d9('0x47'));if(_0x87f230['role']===_0xe4d9('0x46')){var _0x29e038=_0x119bdc['get']({'plain':!![]});var _0x3eccd4='Dispositions';return db[_0xe4d9('0x48')][_0xe4d9('0x44')]({'where':{'name':_0x3eccd4,'userProfileId':_0x87f230['userProfileId']},'raw':!![]})[_0xe4d9('0x1e')](function(_0x5e5267){if(_0x5e5267&&_0x5e5267[_0xe4d9('0x49')]===0x0){return db[_0xe4d9('0x22')][_0xe4d9('0x45')]({'name':_0x29e038['name'],'resourceId':_0x29e038['id'],'type':_0x5e5267[_0xe4d9('0x24')],'sectionId':_0x5e5267['id']},{})[_0xe4d9('0x1e')](function(){return _0x119bdc;});}else{return _0x119bdc;}})['catch'](function(_0x11ca7d){logger[_0xe4d9('0x4a')](_0xe4d9('0x4b'),_0x11ca7d);throw _0x11ca7d;});}return _0x119bdc;})[_0xe4d9('0x1e')](respondWithResult(_0x15ea5a,0xc9))['catch'](handleError(_0x15ea5a,null));};exports['update']=function(_0x198e92,_0x40674d){if(_0x198e92[_0xe4d9('0x4c')]['id']){delete _0x198e92[_0xe4d9('0x4c')]['id'];}return db[_0xe4d9('0x28')][_0xe4d9('0x44')]({'where':{'id':_0x198e92['params']['id']}})['then'](handleEntityNotFound(_0x40674d,null))[_0xe4d9('0x1e')](saveUpdates(_0x198e92[_0xe4d9('0x4c')],null))[_0xe4d9('0x1e')](respondWithResult(_0x40674d,null))[_0xe4d9('0x41')](handleError(_0x40674d,null));};exports[_0xe4d9('0x1f')]=function(_0x390e64,_0x5893cb){return db[_0xe4d9('0x28')][_0xe4d9('0x44')]({'where':{'id':_0x390e64[_0xe4d9('0x43')]['id']}})['then'](handleEntityNotFound(_0x5893cb,null))[_0xe4d9('0x1e')](removeEntity(_0x5893cb,null))[_0xe4d9('0x41')](handleError(_0x5893cb,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a98582e..3a52b0a 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 _0xbe2b=['../../config/environment','exports','define','Disposition','tools_dispositions','name_voice','name','name_chat','ChatWebsiteId','name_mail','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4d8ed9,_0x2ae284){var _0x1e2140=function(_0x9cca89){while(--_0x9cca89){_0x4d8ed9['push'](_0x4d8ed9['shift']());}};_0x1e2140(++_0x2ae284);}(_0xbe2b,0x1f3));var _0xbbe2=function(_0x123584,_0x376fe2){_0x123584=_0x123584-0x0;var _0x5e70a3=_0xbe2b[_0x123584];return _0x5e70a3;};'use strict';var _=require(_0xbbe2('0x0'));var util=require('util');var logger=require(_0xbbe2('0x1'))(_0xbbe2('0x2'));var moment=require('moment');var BPromise=require(_0xbbe2('0x3'));var rp=require(_0xbbe2('0x4'));var fs=require('fs');var path=require(_0xbbe2('0x5'));var rimraf=require(_0xbbe2('0x6'));var config=require(_0xbbe2('0x7'));var attributes=require('./disposition.attributes');module[_0xbbe2('0x8')]=function(_0x3ef73a,_0x2b533d){return _0x3ef73a[_0xbbe2('0x9')](_0xbbe2('0xa'),attributes,{'tableName':_0xbbe2('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbbe2('0xc'),'fields':[_0xbbe2('0xd'),'ListId']},{'unique':!![],'name':_0xbbe2('0xe'),'fields':['name',_0xbbe2('0xf')]},{'unique':!![],'name':_0xbbe2('0x10'),'fields':[_0xbbe2('0xd'),'MailAccountId']},{'unique':!![],'name':_0xbbe2('0x11'),'fields':['name',_0xbbe2('0x12')]},{'unique':!![],'name':_0xbbe2('0x13'),'fields':[_0xbbe2('0xd'),_0xbbe2('0x14')]},{'unique':!![],'name':_0xbbe2('0x15'),'fields':['name',_0xbbe2('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb82b=['define','tools_dispositions','name_voice','ListId','name_chat','name','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','util','moment','bluebird','request-promise','path'];(function(_0x417dee,_0x2a6f81){var _0x4a554b=function(_0x21b4e2){while(--_0x21b4e2){_0x417dee['push'](_0x417dee['shift']());}};_0x4a554b(++_0x2a6f81);}(_0xb82b,0x1b0));var _0xbb82=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb82b[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xbb82('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xbb82('0x1'));var BPromise=require(_0xbb82('0x2'));var rp=require(_0xbb82('0x3'));var fs=require('fs');var path=require(_0xbb82('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./disposition.attributes');module['exports']=function(_0x1240be,_0x3f6a45){return _0x1240be[_0xbb82('0x5')]('Disposition',attributes,{'tableName':_0xbb82('0x6'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xbb82('0x7'),'fields':['name',_0xbb82('0x8')]},{'unique':!![],'name':_0xbb82('0x9'),'fields':[_0xbb82('0xa'),_0xbb82('0xb')]},{'unique':!![],'name':'name_mail','fields':['name',_0xbb82('0xc')]},{'unique':!![],'name':_0xbb82('0xd'),'fields':[_0xbb82('0xa'),_0xbb82('0xe')]},{'unique':!![],'name':_0xbb82('0xf'),'fields':[_0xbb82('0xa'),_0xbb82('0x10')]},{'unique':!![],'name':_0xbb82('0x11'),'fields':['name',_0xbb82('0x12')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index c605841..bbf62d1 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 _0xd270=['jayson/promise','http','request','then','debug','Disposition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','Disposition,\x20%s,\x20%s','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x5f09c5,_0x2bfca0){var _0x426ad9=function(_0x18fe5f){while(--_0x18fe5f){_0x5f09c5['push'](_0x5f09c5['shift']());}};_0x426ad9(++_0x2bfca0);}(_0xd270,0x15f));var _0x0d27=function(_0x19ea11,_0x1534b9){_0x19ea11=_0x19ea11-0x0;var _0x50cf44=_0xd270[_0x19ea11];return _0x50cf44;};'use strict';var _=require(_0x0d27('0x0'));var util=require('util');var moment=require(_0x0d27('0x1'));var BPromise=require(_0x0d27('0x2'));var rs=require(_0x0d27('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0d27('0x4'))['db'];var utils=require(_0x0d27('0x5'));var logger=require(_0x0d27('0x6'))(_0x0d27('0x7'));var config=require(_0x0d27('0x8'));var jayson=require(_0x0d27('0x9'));var client=jayson['client'][_0x0d27('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e3322,_0xe6a932,_0xbe7129){return new BPromise(function(_0x1f31e1,_0x29e1ab){return client[_0x0d27('0xb')](_0x4e3322,_0xbe7129)[_0x0d27('0xc')](function(_0x49e2e9){logger['info']('Disposition,\x20%s,\x20%s',_0xe6a932,'request\x20sent');logger[_0x0d27('0xd')](_0x0d27('0xe'),_0xe6a932,'request\x20sent',JSON[_0x0d27('0xf')](_0x49e2e9));if(_0x49e2e9[_0x0d27('0x10')]){if(_0x49e2e9[_0x0d27('0x10')][_0x0d27('0x11')]===0x1f4){logger[_0x0d27('0x10')]('Disposition,\x20%s,\x20%s',_0xe6a932,_0x49e2e9['error'][_0x0d27('0x12')]);return _0x29e1ab(_0x49e2e9[_0x0d27('0x10')][_0x0d27('0x12')]);}logger[_0x0d27('0x10')]('Disposition,\x20%s,\x20%s',_0xe6a932,_0x49e2e9[_0x0d27('0x10')]['message']);return _0x1f31e1(_0x49e2e9[_0x0d27('0x10')][_0x0d27('0x12')]);}else{logger[_0x0d27('0x13')](_0x0d27('0x14'),_0xe6a932,_0x0d27('0x15'));_0x1f31e1(_0x49e2e9[_0x0d27('0x16')][_0x0d27('0x12')]);}})[_0x0d27('0x17')](function(_0x2a7793){logger[_0x0d27('0x10')]('Disposition,\x20%s,\x20%s',_0xe6a932,_0x2a7793);_0x29e1ab(_0x2a7793);});});} \ No newline at end of file +var _0xcbd5=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','error','code','Disposition,\x20%s,\x20%s','message','result','lodash','util','moment'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xcbd5,0xd5));var _0x5cbd=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xcbd5[_0x51b0dc];return _0x13fa89;};'use strict';var _=require(_0x5cbd('0x0'));var util=require(_0x5cbd('0x1'));var moment=require(_0x5cbd('0x2'));var BPromise=require(_0x5cbd('0x3'));var rs=require(_0x5cbd('0x4'));var fs=require('fs');var Redis=require(_0x5cbd('0x5'));var db=require(_0x5cbd('0x6'))['db'];var utils=require(_0x5cbd('0x7'));var logger=require(_0x5cbd('0x8'))('rpc');var config=require(_0x5cbd('0x9'));var jayson=require(_0x5cbd('0xa'));var client=jayson[_0x5cbd('0xb')][_0x5cbd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4f8f45,_0x4a7507,_0x543f42){return new BPromise(function(_0x56126d,_0x541f4d){return client[_0x5cbd('0xd')](_0x4f8f45,_0x543f42)[_0x5cbd('0xe')](function(_0x5e0cdb){logger[_0x5cbd('0xf')]('Disposition,\x20%s,\x20%s',_0x4a7507,_0x5cbd('0x10'));logger[_0x5cbd('0x11')](_0x5cbd('0x12'),_0x4a7507,_0x5cbd('0x10'),JSON['stringify'](_0x5e0cdb));if(_0x5e0cdb[_0x5cbd('0x13')]){if(_0x5e0cdb[_0x5cbd('0x13')][_0x5cbd('0x14')]===0x1f4){logger[_0x5cbd('0x13')](_0x5cbd('0x15'),_0x4a7507,_0x5e0cdb[_0x5cbd('0x13')][_0x5cbd('0x16')]);return _0x541f4d(_0x5e0cdb['error'][_0x5cbd('0x16')]);}logger[_0x5cbd('0x13')](_0x5cbd('0x15'),_0x4a7507,_0x5e0cdb[_0x5cbd('0x13')]['message']);return _0x56126d(_0x5e0cdb[_0x5cbd('0x13')][_0x5cbd('0x16')]);}else{logger['info'](_0x5cbd('0x15'),_0x4a7507,'request\x20sent');_0x56126d(_0x5e0cdb[_0x5cbd('0x17')][_0x5cbd('0x16')]);}})['catch'](function(_0x3e78a2){logger[_0x5cbd('0x13')]('Disposition,\x20%s,\x20%s',_0x4a7507,_0x3e78a2);_0x541f4d(_0x3e78a2);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index ea0a54f..0e721e5 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 _0x3264=['show','post','create','put','/:id','delete','destroy','util','path','connect-timeout','express','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x3666c7,_0x26ef5e){var _0x1dc09a=function(_0x45f099){while(--_0x45f099){_0x3666c7['push'](_0x3666c7['shift']());}};_0x1dc09a(++_0x26ef5e);}(_0x3264,0x7f));var _0x4326=function(_0x456fb1,_0x859a1d){_0x456fb1=_0x456fb1-0x0;var _0x4083d6=_0x3264[_0x456fb1];return _0x4083d6;};'use strict';var multer=require('multer');var util=require(_0x4326('0x0'));var path=require(_0x4326('0x1'));var timeout=require(_0x4326('0x2'));var express=require(_0x4326('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x4326('0x4'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0x4326('0x5')]('/',auth[_0x4326('0x6')](),controller[_0x4326('0x7')]);router[_0x4326('0x5')]('/:id',auth[_0x4326('0x6')](),controller[_0x4326('0x8')]);router[_0x4326('0x9')]('/',auth[_0x4326('0x6')](),controller[_0x4326('0xa')]);router[_0x4326('0xb')](_0x4326('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x4326('0xd')](_0x4326('0xc'),auth[_0x4326('0x6')](),controller[_0x4326('0xe')]);module['exports']=router; \ No newline at end of file +var _0x5f2f=['create','update','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id','post'];(function(_0x44cb92,_0x59afa3){var _0x56b9e6=function(_0x2841e0){while(--_0x2841e0){_0x44cb92['push'](_0x44cb92['shift']());}};_0x56b9e6(++_0x59afa3);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1b2172,_0x2a18ea){_0x1b2172=_0x1b2172-0x0;var _0x3b2c86=_0x5f2f[_0x1b2172];return _0x3b2c86;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./disposition.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xc')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xd')]);router['put'](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['delete'](_0xf5f2('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xf5f2('0xf')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index 711f312..388d669 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 _0xdb81=['7200','9600','12000','14400','INTEGER','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800'];(function(_0x1b8165,_0x25b78e){var _0x31d82d=function(_0x1446aa){while(--_0x1446aa){_0x1b8165['push'](_0x1b8165['shift']());}};_0x31d82d(++_0x25b78e);}(_0xdb81,0x180));var _0x1db8=function(_0x54300d,_0x5b8bbd){_0x54300d=_0x54300d-0x0;var _0x75eff=_0xdb81[_0x54300d];return _0x75eff;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x1db8('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x1db8('0x0')]},'ecm':{'type':Sequelize[_0x1db8('0x1')](_0x1db8('0x2'),'no'),'defaultValue':_0x1db8('0x2')},'headerinfo':{'type':Sequelize[_0x1db8('0x0')],'defaultValue':_0x1db8('0x3')},'localstationid':{'type':Sequelize[_0x1db8('0x0')],'unique':_0x1db8('0x4')},'minrate':{'type':Sequelize[_0x1db8('0x1')](_0x1db8('0x5'),_0x1db8('0x6'),_0x1db8('0x7'),_0x1db8('0x8'),_0x1db8('0x9'),'14400'),'defaultValue':_0x1db8('0x6')},'maxrate':{'type':Sequelize['ENUM']('2400',_0x1db8('0x6'),'7200',_0x1db8('0x8'),_0x1db8('0x9'),_0x1db8('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x1db8('0x0')],'defaultValue':'v17,v27,v29'},'gateway':{'type':Sequelize[_0x1db8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x1db8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x1db8('0xb')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x1db8('0x1')](_0x1db8('0xc'),_0x1db8('0xd'),_0x1db8('0xe'),_0x1db8('0xf')),'defaultValue':_0x1db8('0xc')},'key':{'type':Sequelize[_0x1db8('0x0')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1db8('0x10');}},'notificationSound':{'type':Sequelize[_0x1db8('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1db8('0xb')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1db8('0x11')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1db8('0xb')],'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[_0x1db8('0xb')],'allowNull':!![],'defaultValue':null,'comment':_0x1db8('0x12')},'mandatoryDisposition':{'type':Sequelize[_0x1db8('0x11')],'defaultValue':![],'comment':_0x1db8('0x13'),'set':function(_0x5cd7e5){if(!_0x5cd7e5)this[_0x1db8('0x14')](_0x1db8('0x15'),null);this[_0x1db8('0x14')](_0x1db8('0x16'),_0x5cd7e5);}}}; \ No newline at end of file +var _0xfb85=['STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','SIP','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId'];(function(_0x6757eb,_0x5c0b74){var _0x5f276a=function(_0x16bd37){while(--_0x16bd37){_0x6757eb['push'](_0x6757eb['shift']());}};_0x5f276a(++_0x5c0b74);}(_0xfb85,0xe6));var _0x5fb8=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0xfb85[_0x1928c9];return _0x51b5fb;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x5fb8('0x0')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x5fb8('0x0')]},'ecm':{'type':Sequelize[_0x5fb8('0x1')](_0x5fb8('0x2'),'no'),'defaultValue':_0x5fb8('0x2')},'headerinfo':{'type':Sequelize[_0x5fb8('0x0')],'defaultValue':_0x5fb8('0x3')},'localstationid':{'type':Sequelize[_0x5fb8('0x0')],'unique':_0x5fb8('0x4')},'minrate':{'type':Sequelize[_0x5fb8('0x1')](_0x5fb8('0x5'),_0x5fb8('0x6'),_0x5fb8('0x7'),_0x5fb8('0x8'),_0x5fb8('0x9'),'14400'),'defaultValue':_0x5fb8('0x6')},'maxrate':{'type':Sequelize[_0x5fb8('0x1')](_0x5fb8('0x5'),_0x5fb8('0x6'),'7200',_0x5fb8('0x8'),'12000',_0x5fb8('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x5fb8('0x0')],'defaultValue':_0x5fb8('0xb')},'gateway':{'type':Sequelize[_0x5fb8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x5fb8('0x0')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x5fb8('0x1')](_0x5fb8('0xc'),_0x5fb8('0xd'),_0x5fb8('0xe'),_0x5fb8('0xf')),'defaultValue':_0x5fb8('0xc')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x5fb8('0x10');}},'notificationSound':{'type':Sequelize[_0x5fb8('0x11')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5fb8('0x11')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x5fb8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x5fb8('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5fb8('0x11')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5fb8('0x12')],'allowNull':!![],'defaultValue':null,'comment':_0x5fb8('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x5fb8('0x11')],'defaultValue':![],'comment':_0x5fb8('0x14'),'set':function(_0x2d2a6e){if(!_0x2d2a6e)this[_0x5fb8('0x15')](_0x5fb8('0x16'),null);this[_0x5fb8('0x15')]('mandatoryDisposition',_0x2d2a6e);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index afbfd71..4fadcd1 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 _0x9407=['include','findAll','rows','show','params','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Pause','FaxAccountId','Disposition','getDispositions','findOne','sort','options','removeDispositions','addAnswer','CannedAnswer','getAnswers','nolimit','removeAnswers','ids','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','fullname','internal','Tag','Tags','color','tag','addApplications','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','exten','localstationid','app','system','description','Fax\x20Extension','push','Answer','Set','gateway','maxrate','modem','t38timeout','FAXOPT(','Wait','/var/opt/motion2/server/files/attachments/fax-${CALLERID(num)}-${CUT(UNIQUEID,.,1)}-${CUT(UNIQUEID,.,2)}-${STRFTIME(,,%C%y%m%d%H%M%S)}-rx.tif,d','addAccountApplications','sequelize','VoiceExtension','tech','updatedAt','TrunkId','findById','getMessages','FaxMessage','$gte','split','format','CmList','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','fax','List','Contacts','ListId','List\x20not\x20found','filename','Messages','Contact\x20not\x20found','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','User','html-pdf','eml-format','fast-json-patch','moment','util','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','count','offset','limit','status','set','Content-Range','json','apply','reject','save','update','destroy','FaxAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','FaxAccount','rawAttributes','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','where','pick','filters','filter','merge','type','VIRTUAL','includeAll'];(function(_0x4b529d,_0x1aa0d8){var _0x311010=function(_0x2f7b12){while(--_0x2f7b12){_0x4b529d['push'](_0x4b529d['shift']());}};_0x311010(++_0x1aa0d8);}(_0x9407,0x1ec));var _0x7940=function(_0x249226,_0x7a6036){_0x249226=_0x249226-0x0;var _0x2188dc=_0x9407[_0x249226];return _0x2188dc;};'use strict';var pdf=require(_0x7940('0x0'));var emlformat=require(_0x7940('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x7940('0x2'));var rp=require('request-promise');var moment=require(_0x7940('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7940('0x4'));var path=require(_0x7940('0x5'));var sox=require(_0x7940('0x6'));var csv=require(_0x7940('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7940('0x8'));var squel=require(_0x7940('0x9'));var crypto=require(_0x7940('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x7940('0xb'));var toCsv=require(_0x7940('0x7'));var querystring=require(_0x7940('0xc'));var Papa=require(_0x7940('0xd'));var Redis=require(_0x7940('0xe'));var authService=require(_0x7940('0xf'));var qs=require(_0x7940('0x10'));var as=require(_0x7940('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x7940('0x12'));var utils=require(_0x7940('0x13'));var config=require(_0x7940('0x14'));var db=require(_0x7940('0x15'))['db'];config['redis']=_['defaults'](config[_0x7940('0x16')],{'host':_0x7940('0x17'),'port':0x18eb});var socket=require(_0x7940('0x18'))(new Redis(config[_0x7940('0x16')]));require('./faxAccount.socket')[_0x7940('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0x7940('0x1a')][_0x7940('0x1b')]({'port':0x232c});var client9002=jayson[_0x7940('0x1a')][_0x7940('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x821d6c,_0x8878be,_0x467c71){if(_0x467c71){var _0x3cc3da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3cc3da[_0x7940('0x1c')](_0x8878be)){return _0x821d6c;}else{throw new db[(_0x7940('0x1d'))][(_0x7940('0x1e'))](_0x7940('0x1f'));}}else{return _0x821d6c;}}function respondWithRpcPromise(_0x26369f,_0x213fa4,_0xa1d3d9,_0xa30fda){return new BPromise(function(_0xfcea0f,_0x2a6b9a){var _0x27de3a=_0xa30fda||client;return _0x27de3a[_0x7940('0x20')](_0x26369f,_0xa1d3d9)[_0x7940('0x21')](function(_0x1466cb){logger[_0x7940('0x22')](_0x7940('0x23'),_0x213fa4,_0x7940('0x24'));logger[_0x7940('0x25')](_0x7940('0x26'),_0x213fa4,'request\x20sent',JSON['stringify'](_0x1466cb));if(_0x1466cb[_0x7940('0x27')]){if(_0x1466cb['error'][_0x7940('0x28')]===0x1f4){logger['error']('FaxAccount,\x20%s,\x20%s',_0x213fa4,_0x1466cb[_0x7940('0x27')][_0x7940('0x29')]);return _0x2a6b9a(_0x1466cb[_0x7940('0x27')]['message']);}logger['error']('FaxAccount,\x20%s,\x20%s',_0x213fa4,_0x1466cb['error'][_0x7940('0x29')]);return _0xfcea0f(_0x1466cb[_0x7940('0x27')]['message']);}else{logger[_0x7940('0x22')](_0x7940('0x23'),_0x213fa4,_0x7940('0x24'));_0xfcea0f(_0x1466cb['result'][_0x7940('0x29')]);}})[_0x7940('0x2a')](function(_0x2ed4e6){logger[_0x7940('0x27')](_0x7940('0x23'),_0x213fa4,_0x2ed4e6);_0x2a6b9a(_0x2ed4e6);});});}function respondWithStatusCode(_0x4a6d1f,_0x3725d8){_0x3725d8=_0x3725d8||0xcc;return function(_0x4364bc){if(_0x4364bc){return _0x4a6d1f[_0x7940('0x2b')](_0x3725d8);}return _0x4a6d1f['status'](_0x3725d8)['end']();};}function respondWithResult(_0x27d2c3,_0x2bb5ac){_0x2bb5ac=_0x2bb5ac||0xc8;return function(_0x5df536){if(_0x5df536){return _0x27d2c3['status'](_0x2bb5ac)['json'](_0x5df536);}};}function respondWithFilteredResult(_0x5ca113,_0x3fc294){return function(_0x53b7f4){if(_0x53b7f4){var _0x4f843d=_0x53b7f4[_0x7940('0x2c')],_0x5205a6=_0x3fc294[_0x7940('0x2d')],_0x5d6ff0=_0x3fc294[_0x7940('0x2d')]+_0x3fc294[_0x7940('0x2e')],_0x48f1d5;if(_0x5d6ff0>=_0x4f843d){_0x5d6ff0=_0x4f843d;_0x48f1d5=0xc8;}else{_0x48f1d5=0xce;}_0x5ca113[_0x7940('0x2f')](_0x48f1d5);return _0x5ca113[_0x7940('0x30')](_0x7940('0x31'),_0x5205a6+'-'+_0x5d6ff0+'/'+_0x4f843d)[_0x7940('0x32')](_0x53b7f4);}return null;};}function patchUpdates(_0x4ea2bd){return function(_0x1048dd){try{jsonpatch[_0x7940('0x33')](_0x1048dd,_0x4ea2bd,!![]);}catch(_0x254be0){return BPromise[_0x7940('0x34')](_0x254be0);}return _0x1048dd[_0x7940('0x35')]();};}function saveUpdates(_0x4d3b3,_0x511616){return function(_0x528f0f){if(_0x528f0f){return _0x528f0f[_0x7940('0x36')](_0x4d3b3)[_0x7940('0x21')](function(_0x274799){return _0x274799;});}return null;};}function removeEntity(_0x31ecd2,_0x11fa57){return function(_0x5695cf){if(_0x5695cf){return _0x5695cf[_0x7940('0x37')]()[_0x7940('0x21')](function(){var _0xa71788=_0x5695cf['get']({'plain':!![]});var _0x5df341=_0x7940('0x38');return db[_0x7940('0x39')][_0x7940('0x37')]({'where':{'type':_0x5df341,'resourceId':_0xa71788['id']}})[_0x7940('0x21')](function(){return _0x5695cf;});})[_0x7940('0x21')](function(){_0x31ecd2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x364fe6,_0x46a93d){return function(_0x501f28){if(!_0x501f28){_0x364fe6[_0x7940('0x2b')](0x194);}return _0x501f28;};}function handleError(_0x16c920,_0x54f7e5){_0x54f7e5=_0x54f7e5||0x1f4;return function(_0x3e4223){logger['error'](_0x3e4223[_0x7940('0x3a')]);if(_0x3e4223[_0x7940('0x3b')]){delete _0x3e4223[_0x7940('0x3b')];}_0x16c920['status'](_0x54f7e5)[_0x7940('0x3c')](_0x3e4223);};}exports[_0x7940('0x3d')]=function(_0x1b550d,_0x387a5b){var _0x26e8a6={'include':[{'model':db['Pause'],'as':_0x7940('0x3e')}]},_0x55e759={},_0x3f5314={'count':0x0,'rows':[]};var _0x30d005=_[_0x7940('0x3f')](db[_0x7940('0x40')][_0x7940('0x41')],function(_0x3339d5){return{'name':_0x3339d5['fieldName'],'type':_0x3339d5['type'][_0x7940('0x42')]};});_0x55e759[_0x7940('0x43')]=_['map'](_0x30d005,'name');_0x55e759['query']=_[_0x7940('0x44')](_0x1b550d[_0x7940('0x45')]);_0x55e759['filters']=_[_0x7940('0x46')](_0x55e759['model'],_0x55e759['query']);_0x26e8a6[_0x7940('0x47')]=_[_0x7940('0x46')](_0x55e759[_0x7940('0x43')],qs['fields'](_0x1b550d[_0x7940('0x45')][_0x7940('0x48')]));_0x26e8a6[_0x7940('0x47')]=_0x26e8a6[_0x7940('0x47')][_0x7940('0x49')]?_0x26e8a6['attributes']:_0x55e759[_0x7940('0x43')];if(!_0x1b550d['query'][_0x7940('0x4a')]('nolimit')){_0x26e8a6[_0x7940('0x2e')]=qs[_0x7940('0x2e')](_0x1b550d['query']['limit']);_0x26e8a6[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0x1b550d[_0x7940('0x45')][_0x7940('0x2d')]);}_0x26e8a6[_0x7940('0x4b')]=qs['sort'](_0x1b550d[_0x7940('0x45')]['sort']);_0x26e8a6[_0x7940('0x4c')]=qs['filters'](_[_0x7940('0x4d')](_0x1b550d[_0x7940('0x45')],_0x55e759[_0x7940('0x4e')]));if(_0x1b550d[_0x7940('0x45')][_0x7940('0x4f')]){_0x26e8a6[_0x7940('0x4c')]=_[_0x7940('0x50')](_0x26e8a6[_0x7940('0x4c')],{'$or':_['map'](_0x30d005,function(_0x5c1348){if(_0x5c1348[_0x7940('0x51')]!==_0x7940('0x52')){var _0x3e5ca8={};_0x3e5ca8[_0x5c1348[_0x7940('0x3b')]]={'$like':'%'+_0x1b550d[_0x7940('0x45')]['filter']+'%'};return _0x3e5ca8;}})});}_0x26e8a6=_[_0x7940('0x50')]({},_0x26e8a6,_0x1b550d['options']);var _0x587b78={'where':_0x26e8a6[_0x7940('0x4c')]};return db[_0x7940('0x40')][_0x7940('0x2c')](_0x587b78)['then'](function(_0x23423e){_0x3f5314[_0x7940('0x2c')]=_0x23423e;if(_0x1b550d[_0x7940('0x45')][_0x7940('0x53')]){_0x26e8a6[_0x7940('0x54')]=[{'all':!![]}];}return db[_0x7940('0x40')][_0x7940('0x55')](_0x26e8a6);})[_0x7940('0x21')](function(_0x14548a){_0x3f5314[_0x7940('0x56')]=_0x14548a;return _0x3f5314;})[_0x7940('0x21')](respondWithFilteredResult(_0x387a5b,_0x26e8a6))[_0x7940('0x2a')](handleError(_0x387a5b,null));};exports[_0x7940('0x57')]=function(_0x1ce8db,_0x5141c5){var _0x43cdd6={'raw':![],'where':{'id':_0x1ce8db[_0x7940('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0x7940('0x3e')}]},_0x311690={};_0x311690[_0x7940('0x43')]=_[_0x7940('0x44')](db[_0x7940('0x40')][_0x7940('0x41')]);_0x311690['query']=_[_0x7940('0x44')](_0x1ce8db['query']);_0x311690[_0x7940('0x4e')]=_['intersection'](_0x311690[_0x7940('0x43')],_0x311690[_0x7940('0x45')]);_0x43cdd6[_0x7940('0x47')]=_[_0x7940('0x46')](_0x311690[_0x7940('0x43')],qs[_0x7940('0x48')](_0x1ce8db['query'][_0x7940('0x48')]));_0x43cdd6['attributes']=_0x43cdd6[_0x7940('0x47')][_0x7940('0x49')]?_0x43cdd6['attributes']:_0x311690[_0x7940('0x43')];if(_0x1ce8db[_0x7940('0x45')][_0x7940('0x53')]){_0x43cdd6[_0x7940('0x54')]=[{'all':!![]}];}_0x43cdd6=_[_0x7940('0x50')]({},_0x43cdd6,_0x1ce8db['options']);return db['FaxAccount'][_0x7940('0x59')](_0x43cdd6)['then'](handleEntityNotFound(_0x5141c5,null))['then'](respondWithResult(_0x5141c5,null))[_0x7940('0x2a')](handleError(_0x5141c5,null));};exports[_0x7940('0x5a')]=function(_0x212885,_0x6c78ec){return db[_0x7940('0x40')][_0x7940('0x5a')](_0x212885[_0x7940('0x5b')],{})[_0x7940('0x21')](function(_0x398599){var _0x510da5=_0x212885[_0x7940('0x5c')][_0x7940('0x5d')]({'plain':!![]});if(!_0x510da5)throw new Error(_0x7940('0x5e'));if(_0x510da5[_0x7940('0x5f')]===_0x7940('0x5c')){var _0x43875f=_0x398599['get']({'plain':!![]});var _0x3aad8e='FaxAccounts';return db[_0x7940('0x60')]['find']({'where':{'name':_0x3aad8e,'userProfileId':_0x510da5[_0x7940('0x61')]},'raw':!![]})[_0x7940('0x21')](function(_0x319e64){if(_0x319e64&&_0x319e64[_0x7940('0x62')]===0x0){return db[_0x7940('0x39')][_0x7940('0x5a')]({'name':_0x43875f[_0x7940('0x3b')],'resourceId':_0x43875f['id'],'type':_0x319e64[_0x7940('0x3b')],'sectionId':_0x319e64['id']},{})[_0x7940('0x21')](function(){return _0x398599;});}else{return _0x398599;}})[_0x7940('0x2a')](function(_0x382e13){logger[_0x7940('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x382e13);throw _0x382e13;});}return _0x398599;})[_0x7940('0x21')](respondWithResult(_0x6c78ec,0xc9))[_0x7940('0x2a')](handleError(_0x6c78ec,null));};exports['update']=function(_0x21844d,_0xb27abb){if(_0x21844d[_0x7940('0x5b')]['id']){delete _0x21844d[_0x7940('0x5b')]['id'];}return db['FaxAccount'][_0x7940('0x59')]({'where':{'id':_0x21844d['params']['id']},'include':[{'model':db[_0x7940('0x63')],'as':_0x7940('0x3e')}]})[_0x7940('0x21')](handleEntityNotFound(_0xb27abb,null))['then'](saveUpdates(_0x21844d[_0x7940('0x5b')],null))[_0x7940('0x21')](respondWithResult(_0xb27abb,null))[_0x7940('0x2a')](handleError(_0xb27abb,null));};exports[_0x7940('0x37')]=function(_0x8a3750,_0x4911a5){return db[_0x7940('0x40')]['find']({'where':{'id':_0x8a3750[_0x7940('0x58')]['id']}})['then'](handleEntityNotFound(_0x4911a5,null))[_0x7940('0x21')](removeEntity(_0x4911a5,null))[_0x7940('0x2a')](handleError(_0x4911a5,null));};exports['describe']=function(_0x460311,_0x37c716){return db[_0x7940('0x40')]['describe']()['then'](respondWithResult(_0x37c716,null))[_0x7940('0x2a')](handleError(_0x37c716,null));};exports['addDisposition']=function(_0x51f855,_0x30bbb7,_0x50a106){if(_0x51f855[_0x7940('0x5b')]['id']){delete _0x51f855[_0x7940('0x5b')]['id'];}return db['FaxAccount'][_0x7940('0x59')]({'where':{'id':_0x51f855[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x30bbb7,null))[_0x7940('0x21')](function(_0x308c48){if(_0x308c48){_0x51f855[_0x7940('0x5b')][_0x7940('0x64')]=_0x308c48['id'];return db[_0x7940('0x65')][_0x7940('0x5a')](_0x51f855[_0x7940('0x5b')]);}})[_0x7940('0x21')](respondWithResult(_0x30bbb7,null))[_0x7940('0x2a')](handleError(_0x30bbb7,null));};exports[_0x7940('0x66')]=function(_0x203ab9,_0x266fdc,_0x4e4b93){var _0x21c313={'raw':![],'where':{}};var _0x268c50={};var _0xa26f5b={'count':0x0,'rows':[]};return db[_0x7940('0x40')][_0x7940('0x67')]({'where':{'id':_0x203ab9[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x266fdc,null))[_0x7940('0x21')](function(_0x5efffc){if(_0x5efffc){_0x268c50[_0x7940('0x43')]=_[_0x7940('0x44')](db[_0x7940('0x65')][_0x7940('0x41')]);_0x268c50[_0x7940('0x45')]=_[_0x7940('0x44')](_0x203ab9[_0x7940('0x45')]);_0x268c50['filters']=_[_0x7940('0x46')](_0x268c50[_0x7940('0x43')],_0x268c50[_0x7940('0x45')]);_0x21c313[_0x7940('0x47')]=_[_0x7940('0x46')](_0x268c50[_0x7940('0x43')],qs[_0x7940('0x48')](_0x203ab9['query'][_0x7940('0x48')]));_0x21c313[_0x7940('0x47')]=_0x21c313['attributes']['length']?_0x21c313['attributes']:_0x268c50['model'];if(!_0x203ab9[_0x7940('0x45')]['hasOwnProperty']('nolimit')){_0x21c313[_0x7940('0x2e')]=qs['limit'](_0x203ab9[_0x7940('0x45')][_0x7940('0x2e')]);_0x21c313['offset']=qs[_0x7940('0x2d')](_0x203ab9[_0x7940('0x45')][_0x7940('0x2d')]);}_0x21c313[_0x7940('0x4b')]=qs[_0x7940('0x68')](_0x203ab9['query'][_0x7940('0x68')]);_0x21c313[_0x7940('0x4c')]=qs['filters'](_[_0x7940('0x4d')](_0x203ab9[_0x7940('0x45')],_0x268c50[_0x7940('0x4e')]));_0x21c313[_0x7940('0x4c')][_0x7940('0x64')]=_0x5efffc['id'];if(_0x203ab9[_0x7940('0x45')][_0x7940('0x4f')]){_0x21c313['where']=_['merge'](_0x21c313[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0x21c313[_0x7940('0x47')],function(_0x427e93){var _0x4f2fd4={};_0x4f2fd4[_0x427e93]={'$like':'%'+_0x203ab9['query'][_0x7940('0x4f')]+'%'};return _0x4f2fd4;})});}_0x21c313=_['merge']({},_0x21c313,_0x203ab9[_0x7940('0x69')]);return db[_0x7940('0x65')]['count']({'where':_0x21c313[_0x7940('0x4c')]})[_0x7940('0x21')](function(_0x3b61c2){_0xa26f5b['count']=_0x3b61c2;if(_0x203ab9[_0x7940('0x45')][_0x7940('0x53')]){_0x21c313[_0x7940('0x54')]=[{'all':!![]}];}return db[_0x7940('0x65')][_0x7940('0x55')](_0x21c313);})['then'](function(_0x34545f){_0xa26f5b[_0x7940('0x56')]=_0x34545f;return _0xa26f5b;});}})[_0x7940('0x21')](respondWithFilteredResult(_0x266fdc,_0x21c313))[_0x7940('0x2a')](handleError(_0x266fdc,null));};exports[_0x7940('0x6a')]=function(_0x2e6052,_0x4e7596,_0x281afd){return db['FaxAccount'][_0x7940('0x59')]({'where':{'id':_0x2e6052[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x4e7596,null))['then'](function(_0x4915af){if(_0x4915af){return _0x4915af[_0x7940('0x6a')](_0x2e6052['query']['ids']);}})['then'](respondWithStatusCode(_0x4e7596,null))[_0x7940('0x2a')](handleError(_0x4e7596,null));};exports[_0x7940('0x6b')]=function(_0x122ce3,_0x17b904,_0x17c548){if(_0x122ce3[_0x7940('0x5b')]['id']){delete _0x122ce3[_0x7940('0x5b')]['id'];}return db[_0x7940('0x40')][_0x7940('0x59')]({'where':{'id':_0x122ce3[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x17b904,null))['then'](function(_0x12f7ae){if(_0x12f7ae){_0x122ce3['body']['FaxAccountId']=_0x12f7ae['id'];return db[_0x7940('0x6c')]['create'](_0x122ce3[_0x7940('0x5b')]);}})[_0x7940('0x21')](respondWithResult(_0x17b904,null))['catch'](handleError(_0x17b904,null));};exports[_0x7940('0x6d')]=function(_0xfbd49a,_0x25cadc,_0x5c12f2){var _0x485cc9={'raw':![],'where':{}};var _0x2acc20={};var _0x197c3f={'count':0x0,'rows':[]};return db[_0x7940('0x40')][_0x7940('0x67')]({'where':{'id':_0xfbd49a[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x25cadc,null))['then'](function(_0x36ea77){if(_0x36ea77){_0x2acc20[_0x7940('0x43')]=_['keys'](db['CannedAnswer'][_0x7940('0x41')]);_0x2acc20[_0x7940('0x45')]=_[_0x7940('0x44')](_0xfbd49a[_0x7940('0x45')]);_0x2acc20[_0x7940('0x4e')]=_[_0x7940('0x46')](_0x2acc20[_0x7940('0x43')],_0x2acc20['query']);_0x485cc9['attributes']=_[_0x7940('0x46')](_0x2acc20[_0x7940('0x43')],qs['fields'](_0xfbd49a[_0x7940('0x45')][_0x7940('0x48')]));_0x485cc9[_0x7940('0x47')]=_0x485cc9[_0x7940('0x47')][_0x7940('0x49')]?_0x485cc9[_0x7940('0x47')]:_0x2acc20[_0x7940('0x43')];if(!_0xfbd49a[_0x7940('0x45')][_0x7940('0x4a')](_0x7940('0x6e'))){_0x485cc9['limit']=qs[_0x7940('0x2e')](_0xfbd49a[_0x7940('0x45')]['limit']);_0x485cc9[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0xfbd49a[_0x7940('0x45')]['offset']);}_0x485cc9[_0x7940('0x4b')]=qs[_0x7940('0x68')](_0xfbd49a[_0x7940('0x45')]['sort']);_0x485cc9[_0x7940('0x4c')]=qs[_0x7940('0x4e')](_[_0x7940('0x4d')](_0xfbd49a[_0x7940('0x45')],_0x2acc20['filters']));_0x485cc9['where'][_0x7940('0x64')]=_0x36ea77['id'];if(_0xfbd49a[_0x7940('0x45')][_0x7940('0x4f')]){_0x485cc9[_0x7940('0x4c')]=_[_0x7940('0x50')](_0x485cc9[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0x485cc9[_0x7940('0x47')],function(_0x4fe202){var _0x5526fe={};_0x5526fe[_0x4fe202]={'$like':'%'+_0xfbd49a[_0x7940('0x45')][_0x7940('0x4f')]+'%'};return _0x5526fe;})});}_0x485cc9=_[_0x7940('0x50')]({},_0x485cc9,_0xfbd49a['options']);return db[_0x7940('0x6c')][_0x7940('0x2c')]({'where':_0x485cc9[_0x7940('0x4c')]})[_0x7940('0x21')](function(_0x188fda){_0x197c3f[_0x7940('0x2c')]=_0x188fda;if(_0xfbd49a[_0x7940('0x45')][_0x7940('0x53')]){_0x485cc9[_0x7940('0x54')]=[{'all':!![]}];}return db[_0x7940('0x6c')][_0x7940('0x55')](_0x485cc9);})[_0x7940('0x21')](function(_0x105e26){_0x197c3f[_0x7940('0x56')]=_0x105e26;return _0x197c3f;});}})[_0x7940('0x21')](respondWithFilteredResult(_0x25cadc,_0x485cc9))[_0x7940('0x2a')](handleError(_0x25cadc,null));};exports[_0x7940('0x6f')]=function(_0x1b4384,_0x1ee709,_0x3c4ba3){return db[_0x7940('0x40')][_0x7940('0x59')]({'where':{'id':_0x1b4384[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x1ee709,null))[_0x7940('0x21')](function(_0x5521f0){if(_0x5521f0){return _0x5521f0['removeAnswers'](_0x1b4384[_0x7940('0x45')][_0x7940('0x70')]);}})[_0x7940('0x21')](respondWithStatusCode(_0x1ee709,null))[_0x7940('0x2a')](handleError(_0x1ee709,null));};exports[_0x7940('0x71')]=function(_0x149480,_0xac266d,_0x30eaf8){return db[_0x7940('0x72')][_0x7940('0x59')]({'where':{'id':_0x149480[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0xac266d,null))['then'](function(_0x12e317){if(_0x12e317){return _0x12e317[_0x7940('0x71')](_0x149480[_0x7940('0x5b')][_0x7940('0x70')],_[_0x7940('0x73')](_0x149480[_0x7940('0x5b')],['ids','id'])||{});}})[_0x7940('0x21')](respondWithResult(_0xac266d,null))[_0x7940('0x2a')](handleError(_0xac266d,null));};exports[_0x7940('0x74')]=function(_0x40ed8d,_0x4710ec,_0x122b58){var _0x75076a={'raw':![],'where':{}};var _0x51f7b4={};var _0x1b7583={'count':0x0,'rows':[]};return db['FaxAccount'][_0x7940('0x67')]({'where':{'id':_0x40ed8d[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x4710ec,null))['then'](function(_0x27f974){if(_0x27f974){_0x51f7b4['model']=_[_0x7940('0x44')](db[_0x7940('0x72')][_0x7940('0x41')]);_0x51f7b4[_0x7940('0x45')]=_[_0x7940('0x44')](_0x40ed8d[_0x7940('0x45')]);_0x51f7b4[_0x7940('0x4e')]=_[_0x7940('0x46')](_0x51f7b4[_0x7940('0x43')],_0x51f7b4[_0x7940('0x45')]);_0x75076a[_0x7940('0x47')]=_[_0x7940('0x46')](_0x51f7b4['model'],qs['fields'](_0x40ed8d[_0x7940('0x45')]['fields']));_0x75076a[_0x7940('0x47')]=_0x75076a['attributes'][_0x7940('0x49')]?_0x75076a[_0x7940('0x47')]:_0x51f7b4['model'];if(!_0x40ed8d['query'][_0x7940('0x4a')](_0x7940('0x6e'))){_0x75076a[_0x7940('0x2e')]=qs['limit'](_0x40ed8d[_0x7940('0x45')][_0x7940('0x2e')]);_0x75076a[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0x40ed8d[_0x7940('0x45')][_0x7940('0x2d')]);}_0x75076a['order']=qs['sort'](_0x40ed8d[_0x7940('0x45')]['sort']);_0x75076a[_0x7940('0x4c')]=qs[_0x7940('0x4e')](_[_0x7940('0x4d')](_0x40ed8d[_0x7940('0x45')],_0x51f7b4[_0x7940('0x4e')]));_0x75076a[_0x7940('0x4c')]['FaxAccountId']=_0x27f974['id'];if(_0x40ed8d[_0x7940('0x45')][_0x7940('0x4f')]){_0x75076a['where']=_[_0x7940('0x50')](_0x75076a[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0x75076a['attributes'],function(_0x6a09c8){var _0x46333e={};_0x46333e[_0x6a09c8]={'$like':'%'+_0x40ed8d['query']['filter']+'%'};return _0x46333e;})});}_0x75076a=_[_0x7940('0x50')]({},_0x75076a,_0x40ed8d['options']);return db['FaxInteraction'][_0x7940('0x2c')]({'where':_0x75076a[_0x7940('0x4c')]})[_0x7940('0x21')](function(_0x42869a){_0x1b7583['count']=_0x42869a;if(_0x40ed8d[_0x7940('0x45')]['includeAll']){_0x75076a['include']=[{'model':db[_0x7940('0x75')],'as':_0x7940('0x76'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x7940('0x3b'),_0x7940('0x77'),_0x7940('0x78')],'required':![]},{'model':db[_0x7940('0x79')],'as':_0x7940('0x7a'),'attributes':['id','name',_0x7940('0x7b')],'where':_0x40ed8d[_0x7940('0x45')][_0x7940('0x7c')]?{'id':_0x40ed8d[_0x7940('0x45')][_0x7940('0x7c')]}:undefined,'required':_0x40ed8d[_0x7940('0x45')][_0x7940('0x7c')]?!![]:![]}];}return db['FaxInteraction'][_0x7940('0x55')](_0x75076a);})[_0x7940('0x21')](function(_0x4e9199){_0x1b7583[_0x7940('0x56')]=_0x4e9199;return _0x1b7583;});}})[_0x7940('0x21')](respondWithFilteredResult(_0x4710ec,_0x75076a))[_0x7940('0x2a')](handleError(_0x4710ec,null));};exports[_0x7940('0x7d')]=function(_0x3fee37,_0x4648eb,_0x492fe1){return db[_0x7940('0x40')]['findOne']({'where':{'id':_0x3fee37['params']['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x4648eb,null))[_0x7940('0x21')](function(_0x5cd26f){if(_0x5cd26f){return db['sequelize'][_0x7940('0x7e')](function(_0x1da38a){return db['FaxApplication'][_0x7940('0x37')]({'where':{'FaxAccountId':_0x3fee37[_0x7940('0x58')]['id']},'transaction':_0x1da38a})[_0x7940('0x21')](function(_0x2c5785){var _0xab83e4=_['map'](_0x3fee37[_0x7940('0x5b')],function(_0x54aab3){_0x54aab3[_0x7940('0x64')]=_0x3fee37['params']['id'];return _0x54aab3;});return db[_0x7940('0x7f')][_0x7940('0x80')](_0xab83e4,{'transaction':_0x1da38a});});})[_0x7940('0x21')](function(){return db['FaxApplication'][_0x7940('0x81')]({'where':{'FaxAccountId':_0x3fee37[_0x7940('0x58')]['id']},'order':_0x7940('0x82')});});}})[_0x7940('0x21')](respondWithResult(_0x4648eb,null))[_0x7940('0x2a')](handleError(_0x4648eb,null));};exports[_0x7940('0x83')]=function(_0x146ed7,_0x41f935,_0x234cbd){var _0x501144={};var _0x5eb196={};var _0x3732be;var _0x2f3577;return db['FaxAccount'][_0x7940('0x67')]({'where':{'id':_0x146ed7[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x41f935,null))[_0x7940('0x21')](function(_0x1955e0){if(_0x1955e0){_0x3732be=_0x1955e0;_0x5eb196['model']=_[_0x7940('0x44')](db['FaxApplication']['rawAttributes']);_0x5eb196[_0x7940('0x45')]=_[_0x7940('0x44')](_0x146ed7[_0x7940('0x45')]);_0x5eb196['filters']=_['intersection'](_0x5eb196[_0x7940('0x43')],_0x5eb196[_0x7940('0x45')]);_0x501144[_0x7940('0x47')]=_[_0x7940('0x46')](_0x5eb196[_0x7940('0x43')],qs[_0x7940('0x48')](_0x146ed7[_0x7940('0x45')][_0x7940('0x48')]));_0x501144['attributes']=_0x501144[_0x7940('0x47')][_0x7940('0x49')]?_0x501144[_0x7940('0x47')]:_0x5eb196['model'];_0x501144[_0x7940('0x4b')]=qs[_0x7940('0x68')](_0x146ed7['query'][_0x7940('0x68')]);_0x501144['where']=qs['filters'](_['pick'](_0x146ed7[_0x7940('0x45')],_0x5eb196['filters']));if(_0x146ed7[_0x7940('0x45')][_0x7940('0x4f')]){_0x501144[_0x7940('0x4c')]=_['merge'](_0x501144[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0x501144[_0x7940('0x47')],function(_0x221b00){var _0x50d430={};_0x50d430[_0x221b00]={'$like':'%'+_0x146ed7['query'][_0x7940('0x4f')]+'%'};return _0x50d430;})});}_0x501144=_['merge']({},_0x501144,_0x146ed7[_0x7940('0x69')]);return _0x3732be[_0x7940('0x83')](_0x501144);}})['then'](function(_0x258c47){if(_0x258c47){_0x2f3577=_0x258c47[_0x7940('0x49')];if(!_0x146ed7['query'][_0x7940('0x4a')](_0x7940('0x6e'))){_0x501144[_0x7940('0x2e')]=qs['limit'](_0x146ed7[_0x7940('0x45')][_0x7940('0x2e')]);_0x501144[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0x146ed7[_0x7940('0x45')]['offset']);}return _0x3732be[_0x7940('0x83')](_0x501144);}})[_0x7940('0x21')](function(_0x33fc81){if(_0x33fc81){return _0x33fc81?{'count':_0x2f3577,'rows':_0x33fc81}:null;}})['then'](respondWithResult(_0x41f935,null))['catch'](handleError(_0x41f935,null));};function Extension(_0x3c766d,_0x2e8909,_0x4cf6f7,_0x218c35){this[_0x7940('0x84')]='from-voip-provider';this[_0x7940('0x85')]=_0x3c766d[_0x7940('0x86')];this[_0x7940('0x87')]=_0x218c35;this['type']=_0x7940('0x88');this[_0x7940('0x89')]=_0x7940('0x8a');this[_0x7940('0x64')]=_0x3c766d['id'];this['priority']=_0x2e8909;this['appdata']=_0x4cf6f7;}function createExtensionsReciveFax(_0x40392a){var _0x57f64e=0x1;var _0x47b02d=[];_0x47b02d[_0x7940('0x8b')](new Extension(_0x40392a,_0x57f64e,'',_0x7940('0x8c')));_0x57f64e+=0x1;_0x47b02d[_0x7940('0x8b')](new Extension(_0x40392a,_0x57f64e,'CDR(type)=inbound-fax',_0x7940('0x8d')));_0x57f64e+=0x1;for(var _0x59552c in _0x40392a){if(_0x40392a[_0x7940('0x4a')](_0x59552c)&&(_0x59552c==='ecm'||_0x59552c===_0x7940('0x86')||_0x59552c===_0x7940('0x8e')||_0x59552c==='faxdetect'||_0x59552c==='headerinfo'||_0x59552c===_0x7940('0x8f')||_0x59552c==='minrate'||_0x59552c===_0x7940('0x90')||_0x59552c===_0x7940('0x91'))){_0x47b02d['push'](new Extension(_0x40392a,_0x57f64e,_0x7940('0x92')+_0x59552c+')='+_0x40392a[_0x59552c],'Set'));_0x57f64e+=0x1;}}_0x47b02d[_0x7940('0x8b')](new Extension(_0x40392a,_0x57f64e,'6',_0x7940('0x93')));_0x57f64e+=0x1;_0x47b02d[_0x7940('0x8b')](new Extension(_0x40392a,_0x57f64e,_0x7940('0x94'),'ReceiveFax'));_0x57f64e=0x0;return _0x47b02d;}exports[_0x7940('0x95')]=function(_0x243133,_0x422a31,_0x1baa9e){var _0x282a8b;return db[_0x7940('0x96')]['transaction'](function(_0xd64350){return db[_0x7940('0x40')][_0x7940('0x5a')](_0x243133[_0x7940('0x5b')],{'transaction':_0xd64350})[_0x7940('0x21')](function(_0xe8d22){_0x282a8b=_0xe8d22['get']({'plain':!![]});return db[_0x7940('0x97')][_0x7940('0x80')](createExtensionsReciveFax(_0x282a8b),{'transaction':_0xd64350});});})[_0x7940('0x21')](function(){return _0x282a8b;})[_0x7940('0x21')](respondWithResult(_0x422a31,null))[_0x7940('0x2a')](handleError(_0x422a31,null));};exports['updateAccountApplications']=function(_0x43b590,_0x2cc317,_0x120bb1){var _0x303e0f;return db[_0x7940('0x96')][_0x7940('0x7e')](function(_0x91ccf6){return db[_0x7940('0x40')][_0x7940('0x36')](_0x43b590[_0x7940('0x5b')],{'where':{'id':_0x43b590[_0x7940('0x5b')]['id']},'transaction':_0x91ccf6})[_0x7940('0x21')](function(_0x41d083){return db[_0x7940('0x97')]['destroy']({'where':{'FaxAccountId':_0x43b590[_0x7940('0x5b')]['id']},'transaction':_0x91ccf6})['then'](function(_0x8acfe){return db[_0x7940('0x97')][_0x7940('0x80')](createExtensionsReciveFax(_[_0x7940('0x73')](_0x43b590['body'],[_0x7940('0x98'),'key','createdAt',_0x7940('0x99'),_0x7940('0x9a'),'ListId'])),{'transaction':_0x91ccf6});});});})[_0x7940('0x21')](function(){return db[_0x7940('0x40')][_0x7940('0x9b')](_0x43b590[_0x7940('0x5b')]['id']);})['then'](respondWithResult(_0x2cc317,null))['catch'](handleError(_0x2cc317,null));};exports[_0x7940('0x9c')]=function(_0x52bb98,_0x595265,_0x337d75){var _0xc48eea={'raw':!![],'where':{}};var _0x372a53={};var _0x3ae9c8={'count':0x0,'rows':[]};return db[_0x7940('0x40')][_0x7940('0x67')]({'where':{'id':_0x52bb98[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x595265,null))[_0x7940('0x21')](function(_0x45b891){if(_0x45b891){_0x372a53['model']=_[_0x7940('0x44')](db[_0x7940('0x9d')][_0x7940('0x41')]);_0x372a53[_0x7940('0x45')]=_[_0x7940('0x44')](_0x52bb98[_0x7940('0x45')]);_0x372a53[_0x7940('0x4e')]=_[_0x7940('0x46')](_0x372a53[_0x7940('0x43')],_0x372a53[_0x7940('0x45')]);_0xc48eea[_0x7940('0x47')]=_[_0x7940('0x46')](_0x372a53[_0x7940('0x43')],qs[_0x7940('0x48')](_0x52bb98[_0x7940('0x45')]['fields']));_0xc48eea[_0x7940('0x47')]=_0xc48eea['attributes'][_0x7940('0x49')]?_0xc48eea[_0x7940('0x47')]:_0x372a53['model'];if(!_0x52bb98[_0x7940('0x45')][_0x7940('0x4a')](_0x7940('0x6e'))){_0xc48eea[_0x7940('0x2e')]=qs[_0x7940('0x2e')](_0x52bb98['query'][_0x7940('0x2e')]);_0xc48eea['offset']=qs[_0x7940('0x2d')](_0x52bb98[_0x7940('0x45')][_0x7940('0x2d')]);}_0xc48eea['order']=qs[_0x7940('0x68')](_0x52bb98[_0x7940('0x45')][_0x7940('0x68')]);_0xc48eea['where']=qs[_0x7940('0x4e')](_[_0x7940('0x4d')](_0x52bb98[_0x7940('0x45')],_0x372a53['filters']));_0xc48eea[_0x7940('0x4c')]['FaxAccountId']=_0x45b891['id'];if(_0x52bb98[_0x7940('0x45')][_0x7940('0x4f')]){_0xc48eea['where']=_[_0x7940('0x50')](_0xc48eea[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0xc48eea[_0x7940('0x47')],function(_0x16a1a6){var _0x1d4d8b={};_0x1d4d8b[_0x16a1a6]={'$like':'%'+_0x52bb98[_0x7940('0x45')]['filter']+'%'};return _0x1d4d8b;})});}if(_0x52bb98[_0x7940('0x45')][_0x7940('0x9e')]){var _0xf611da=_0x52bb98[_0x7940('0x45')][_0x7940('0x9e')][_0x7940('0x9f')](',');var _0x3e527f={};_0x3e527f[_0xf611da[0x0]]={'$gte':moment(_0xf611da[0x1])[_0x7940('0xa0')]('YYYY-MM-DD\x20HH:mm:ss')};_0xc48eea['where']=_[_0x7940('0x50')](_0xc48eea[_0x7940('0x4c')],_0x3e527f);}_0xc48eea=_['merge']({},_0xc48eea,_0x52bb98[_0x7940('0x69')]);return db[_0x7940('0x9d')][_0x7940('0x2c')]({'where':_0xc48eea['where']})['then'](function(_0x56420d){_0x3ae9c8[_0x7940('0x2c')]=_0x56420d;if(_0x52bb98[_0x7940('0x45')]['includeAll']){_0xc48eea[_0x7940('0x54')]=[{'all':!![]}];}return db[_0x7940('0x9d')][_0x7940('0x55')](_0xc48eea);})[_0x7940('0x21')](function(_0x2f4a53){_0x3ae9c8[_0x7940('0x56')]=_0x2f4a53;return _0x3ae9c8;});}})['then'](respondWithFilteredResult(_0x595265,_0xc48eea))[_0x7940('0x2a')](handleError(_0x595265,null));};exports['send']=function(_0x5dc40f,_0xb19e53,_0x29ebd5){var _0x4422b0,_0x9d2ef={},_0x2ea906;if(_0x5dc40f[_0x7940('0x5b')]['to']){_0x2ea906=_0x5dc40f[_0x7940('0x5b')]['to'][0x0];}return db[_0x7940('0x40')][_0x7940('0x59')]({'where':{'id':_0x5dc40f[_0x7940('0x58')]['id']},'include':[{'model':db[_0x7940('0xa1')],'as':'List','include':[{'model':db['CmContact'],'as':'Contacts','where':{'fax':_0x2ea906},'limit':0x1,'order':[[_0x7940('0x99'),_0x7940('0xa2')]]}]}]})['then'](handleEntityNotFound(_0xb19e53,null))[_0x7940('0x21')](function(_0x480c2d){_0x4422b0=_0x480c2d;if(_0x5dc40f['body'][_0x7940('0xa3')]&&_0x5dc40f[_0x7940('0x5b')]['attachments'][_0x7940('0x49')]){for(var _0xb57fdf=0x0;_0xb57fdf<_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][_0x7940('0x49')];_0xb57fdf+=0x1){_0x5dc40f[_0x7940('0x5b')]['attachments'][_0xb57fdf]={'filename':_0x5dc40f['body'][_0x7940('0xa3')][_0xb57fdf]['name'],'id':_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][_0xb57fdf]['id'],'path':path[_0x7940('0xa4')](config[_0x7940('0xa5')],_0x7940('0xa6'),_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][_0xb57fdf][_0x7940('0xa7')])};}}return respondWithRpcPromise(_0x7940('0xa8'),_0x7940('0xa8'),{'FaxAccountId':_['isNil'](_0x5dc40f[_0x7940('0x58')]['id'])?undefined:_0x5dc40f[_0x7940('0x58')]['id'],'path':_[_0x7940('0xa9')](_0x5dc40f['body']['attachments'][0x0]['path'])?undefined:_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][0x0][_0x7940('0x5')],'fax':_[_0x7940('0xa9')](_0x5dc40f['body']['to'][0x0])?undefined:_0x5dc40f[_0x7940('0x5b')]['to'][0x0]},client9002);})['then'](function(){if(_0x4422b0){if(_['isNil'](_0x5dc40f[_0x7940('0x5b')][_0x7940('0xaa')])){_0x5dc40f[_0x7940('0x5b')][_0x7940('0xaa')]=util['format']('\x22%s\x22\x20<%s>',_0x4422b0[_0x7940('0x3b')],_0x4422b0[_0x7940('0xab')]);}if(_0x4422b0[_0x7940('0xac')]){if(_0x4422b0['List'][_0x7940('0xad')][_0x7940('0x49')]){return _0x4422b0[_0x7940('0xac')]['Contacts'][0x0];}else{return db[_0x7940('0x75')]['create'](_['defaults'](_0x5dc40f[_0x7940('0x5b')],{'firstName':_0x5dc40f[_0x7940('0x5b')]['to'][0x0],'phone':_0x5dc40f[_0x7940('0x5b')]['to'][0x0],'fax':_0x5dc40f[_0x7940('0x5b')]['to'][0x0],'ListId':_0x4422b0[_0x7940('0xae')]}));}}else{throw new Error(_0x7940('0xaf'));}}else{throw new Error('Send\x20Fax\x20failed');}})['then'](function(_0x50bfc1){if(_0x50bfc1){return db['FaxInteraction'][_0x7940('0x59')]({'where':{'ContactId':_0x50bfc1['id'],'closed':![],'FaxAccountId':_0x4422b0['id']}})['then'](function(_0x5bafc0){if(_0x5bafc0){return[_0x5bafc0,![]];}return db['FaxInteraction'][_0x7940('0x5a')]({'UserId':_0x5dc40f[_0x7940('0x5c')]['id'],'ContactId':_0x50bfc1['id'],'FaxAccountId':_0x4422b0['id'],'fax':_0x5dc40f['body']['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x5dc40f[_0x7940('0x5b')],{'read':![],'body':_0x5dc40f['body'][_0x7940('0xa3')][0x0][_0x7940('0xb0')],'FaxAccountId':_0x4422b0['id'],'UserId':_0x5dc40f[_0x7940('0x5c')]['id'],'ContactId':_0x50bfc1['id'],'AttachmentId':_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][0x0]['id']})]},{'include':[{'model':db[_0x7940('0x9d')],'as':_0x7940('0xb1')}]})[_0x7940('0x21')](function(_0x1201de){return[_0x1201de,!![]];});});}else{throw new Error(_0x7940('0xb2'));}})['spread'](function(_0x281f26,_0x101b5d){if(_0x101b5d){return _0x281f26;}return db['FaxMessage'][_0x7940('0x5a')]({'direction':_0x7940('0xb3'),'read':![],'body':_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][0x0][_0x7940('0xb0')],'FaxAccountId':_0x4422b0['id'],'FaxInteractionId':_0x281f26['id'],'UserId':_0x5dc40f['user']['id'],'ContactId':_0x281f26[_0x7940('0xb4')],'AttachmentId':_0x5dc40f['body'][_0x7940('0xa3')][0x0]['id']})[_0x7940('0x21')](function(_0x141bbc){_0x281f26[_0x7940('0xb5')][_0x7940('0xb1')]=[];_0x281f26[_0x7940('0xb5')][_0x7940('0xb1')]['push'](_0x141bbc[_0x7940('0xb5')]);return _0x281f26;});})[_0x7940('0x21')](function(_0x18d3f2){respondWithRpcPromise(_0x7940('0xb6'),_0x7940('0xb6'),{'FaxAccountId':_[_0x7940('0xa9')](_0x5dc40f['params']['id'])?undefined:_0x5dc40f['params']['id'],'path':_[_0x7940('0xa9')](_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][0x0]['path'])?undefined:_0x5dc40f['body'][_0x7940('0xa3')][0x0]['path'],'fax':_[_0x7940('0xa9')](_0x5dc40f['body']['to'][0x0])?undefined:_0x5dc40f[_0x7940('0x5b')]['to'][0x0],'AttachmentId':_0x5dc40f[_0x7940('0x5b')][_0x7940('0xa3')][0x0]['id']},client9002)['then'](function(_0x467ddc){logger[_0x7940('0x22')](_0x7940('0xb7'),_0x467ddc);})[_0x7940('0x2a')](function(_0x49ad02){logger[_0x7940('0x22')]('SendFaxRpc,\x20%s',_0x49ad02);});return _0x18d3f2;})[_0x7940('0x21')](respondWithResult(_0xb19e53,null))[_0x7940('0x2a')](handleError(_0xb19e53,null));};exports[_0x7940('0xb8')]=function(_0x292b04,_0x72fa31,_0x49f27a){return db[_0x7940('0x40')][_0x7940('0x59')]({'where':{'id':_0x292b04[_0x7940('0x58')]['id']}})['then'](handleEntityNotFound(_0x72fa31,null))[_0x7940('0x21')](function(_0x17dcf0){if(_0x17dcf0){return _0x17dcf0['addAgents'](_0x292b04['body']['ids'],_[_0x7940('0x73')](_0x292b04[_0x7940('0x5b')],[_0x7940('0x70'),'id'])||{})[_0x7940('0xb9')](function(_0x2d6628){for(var _0x50c11d=0x0;_0x50c11d<_0x292b04[_0x7940('0x5b')][_0x7940('0x70')][_0x7940('0x49')];_0x50c11d+=0x1){socket[_0x7940('0xba')]('userFaxAccount:save',{'UserId':_0x292b04[_0x7940('0x5b')][_0x7940('0x70')][_0x50c11d],'FaxAccountId':_0x292b04[_0x7940('0x58')]['id']});}return _0x2d6628;});}})['then'](respondWithResult(_0x72fa31,null))[_0x7940('0x2a')](handleError(_0x72fa31,null));};exports[_0x7940('0xbb')]=function(_0x58b954,_0x43a9cd,_0x1f2183){return db[_0x7940('0x40')][_0x7940('0x59')]({'where':{'id':_0x58b954[_0x7940('0x58')]['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x43a9cd,null))[_0x7940('0x21')](function(_0x31995b){if(_0x31995b){return _0x31995b[_0x7940('0xbb')](_0x58b954[_0x7940('0x45')][_0x7940('0x70')])[_0x7940('0x21')](function(){if(_[_0x7940('0xbc')](_0x58b954[_0x7940('0x45')][_0x7940('0x70')])){for(var _0x15c684=0x0;_0x15c684<_0x58b954[_0x7940('0x45')][_0x7940('0x70')][_0x7940('0x49')];_0x15c684+=0x1){socket[_0x7940('0xba')](_0x7940('0xbd'),{'UserId':Number(_0x58b954[_0x7940('0x45')][_0x7940('0x70')][_0x15c684]),'FaxAccountId':Number(_0x58b954[_0x7940('0x58')]['id'])});}}else{socket[_0x7940('0xba')](_0x7940('0xbd'),{'UserId':Number(_0x58b954['query']['ids']),'FaxAccountId':Number(_0x58b954[_0x7940('0x58')]['id'])});}});}})[_0x7940('0x21')](respondWithStatusCode(_0x43a9cd,null))[_0x7940('0x2a')](handleError(_0x43a9cd,null));};exports[_0x7940('0xbe')]=function(_0x2834d6,_0x110931,_0x1400c6){var _0x274fbe={};var _0x57de08={};var _0x2f500a;var _0x221fe6;return db['FaxAccount'][_0x7940('0x67')]({'where':{'id':_0x2834d6['params']['id']}})[_0x7940('0x21')](handleEntityNotFound(_0x110931,null))[_0x7940('0x21')](function(_0x360f7f){if(_0x360f7f){_0x2f500a=_0x360f7f;_0x57de08[_0x7940('0x43')]=_[_0x7940('0x44')](db[_0x7940('0xbf')][_0x7940('0x41')]);_0x57de08[_0x7940('0x45')]=_['keys'](_0x2834d6[_0x7940('0x45')]);_0x57de08[_0x7940('0x4e')]=_[_0x7940('0x46')](_0x57de08['model'],_0x57de08[_0x7940('0x45')]);_0x274fbe[_0x7940('0x47')]=_[_0x7940('0x46')](_0x57de08[_0x7940('0x43')],qs[_0x7940('0x48')](_0x2834d6[_0x7940('0x45')][_0x7940('0x48')]));_0x274fbe[_0x7940('0x47')]=_0x274fbe[_0x7940('0x47')]['length']?_0x274fbe[_0x7940('0x47')]:_0x57de08[_0x7940('0x43')];_0x274fbe[_0x7940('0x4b')]=qs[_0x7940('0x68')](_0x2834d6[_0x7940('0x45')]['sort']);_0x274fbe['where']=qs[_0x7940('0x4e')](_['pick'](_0x2834d6[_0x7940('0x45')],_0x57de08['filters']));if(_0x2834d6[_0x7940('0x45')][_0x7940('0x4f')]){_0x274fbe[_0x7940('0x4c')]=_['merge'](_0x274fbe[_0x7940('0x4c')],{'$or':_[_0x7940('0x3f')](_0x274fbe[_0x7940('0x47')],function(_0x6fba7b){var _0x5b7cbe={};_0x5b7cbe[_0x6fba7b]={'$like':'%'+_0x2834d6[_0x7940('0x45')][_0x7940('0x4f')]+'%'};return _0x5b7cbe;})});}_0x274fbe=_[_0x7940('0x50')]({},_0x274fbe,_0x2834d6[_0x7940('0x69')]);return _0x2f500a['getAgents'](_0x274fbe);}})[_0x7940('0x21')](function(_0xf2be91){if(_0xf2be91){_0x221fe6=_0xf2be91[_0x7940('0x49')];if(!_0x2834d6[_0x7940('0x45')][_0x7940('0x4a')](_0x7940('0x6e'))){_0x274fbe[_0x7940('0x2e')]=qs[_0x7940('0x2e')](_0x2834d6[_0x7940('0x45')]['limit']);_0x274fbe[_0x7940('0x2d')]=qs[_0x7940('0x2d')](_0x2834d6[_0x7940('0x45')]['offset']);}return _0x2f500a[_0x7940('0xbe')](_0x274fbe);}})[_0x7940('0x21')](function(_0x1d527d){if(_0x1d527d){return _0x1d527d?{'count':_0x221fe6,'rows':_0x1d527d}:null;}})[_0x7940('0x21')](respondWithResult(_0x110931,null))[_0x7940('0x2a')](handleError(_0x110931,null));}; \ No newline at end of file +var _0x757b=['fields','length','hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','include','findAll','rows','show','params','keys','rawAttributes','includeAll','find','create','body','user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','getDispositions','nolimit','order','pick','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','addInteraction','getInteractions','FaxInteraction','CmContact','Contact','User','Owner','Tag','Tags','tag','addApplications','sequelize','transaction','FaxApplication','bulkCreate','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','app','system','description','Fax\x20Extension','appdata','push','Answer','localstationid','gateway','maxrate','minrate','modem','t38timeout','FAXOPT(','Set','Wait','ReceiveFax','addAccountApplications','update','VoiceExtension','omit','createdAt','updatedAt','TrunkId','ListId','findById','FaxMessage','$gte','split','send','CmList','List','Contacts','DESC','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','format','\x22%s\x22\x20<%s>','List\x20not\x20found','Send\x20Fax\x20failed','filename','Messages','Contact\x20not\x20found','spread','out','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','userFaxAccount:save','removeAgents','emit','userFaxAccount:remove','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','count','offset','limit','set','apply','reject','then','get','FaxAccounts','UserProfileResource','destroy','stack','name','index','Pause','mandatoryDispositionPause','map','FaxAccount','type','key','query','filters','intersection','model','attributes'];(function(_0x22b04c,_0x3f501f){var _0xba01a2=function(_0x45d41b){while(--_0x45d41b){_0x22b04c['push'](_0x22b04c['shift']());}};_0xba01a2(++_0x3f501f);}(_0x757b,0x7a));var _0xb757=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x757b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xb757('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xb757('0x1'));var zipdir=require(_0xb757('0x2'));var jsonpatch=require(_0xb757('0x3'));var rp=require('request-promise');var moment=require(_0xb757('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb757('0x5'));var util=require('util');var path=require(_0xb757('0x6'));var sox=require(_0xb757('0x7'));var csv=require(_0xb757('0x8'));var ejs=require(_0xb757('0x9'));var fs=require('fs');var _=require(_0xb757('0xa'));var squel=require(_0xb757('0xb'));var crypto=require(_0xb757('0xc'));var jsforce=require(_0xb757('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb757('0x8'));var querystring=require(_0xb757('0xe'));var Papa=require(_0xb757('0xf'));var Redis=require(_0xb757('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xb757('0x11'));var as=require(_0xb757('0x12'));var hardwareService=require(_0xb757('0x13'));var logger=require(_0xb757('0x14'))('api');var utils=require(_0xb757('0x15'));var config=require('../../config/environment');var db=require(_0xb757('0x16'))['db'];config[_0xb757('0x17')]=_[_0xb757('0x18')](config[_0xb757('0x17')],{'host':_0xb757('0x19'),'port':0x18eb});var socket=require(_0xb757('0x1a'))(new Redis(config[_0xb757('0x17')]));require(_0xb757('0x1b'))[_0xb757('0x1c')](socket);var jayson=require(_0xb757('0x1d'));var client=jayson[_0xb757('0x1e')][_0xb757('0x1f')]({'port':0x232c});var client9002=jayson[_0xb757('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x540169,_0x42a904,_0x5ca871){if(_0x5ca871){var _0x137ae3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x137ae3[_0xb757('0x20')](_0x42a904)){return _0x540169;}else{throw new db[(_0xb757('0x21'))][(_0xb757('0x22'))](_0xb757('0x23'));}}else{return _0x540169;}}function respondWithRpcPromise(_0x3560d6,_0x3550e8,_0x42d9ad,_0x176d83){return new BPromise(function(_0x10e7bf,_0x3eca19){var _0x53550b=_0x176d83||client;return _0x53550b[_0xb757('0x24')](_0x3560d6,_0x42d9ad)['then'](function(_0x1cb222){logger[_0xb757('0x25')](_0xb757('0x26'),_0x3550e8,_0xb757('0x27'));logger[_0xb757('0x28')](_0xb757('0x29'),_0x3550e8,_0xb757('0x27'),JSON[_0xb757('0x2a')](_0x1cb222));if(_0x1cb222[_0xb757('0x2b')]){if(_0x1cb222[_0xb757('0x2b')][_0xb757('0x2c')]===0x1f4){logger[_0xb757('0x2b')]('FaxAccount,\x20%s,\x20%s',_0x3550e8,_0x1cb222[_0xb757('0x2b')][_0xb757('0x2d')]);return _0x3eca19(_0x1cb222[_0xb757('0x2b')][_0xb757('0x2d')]);}logger[_0xb757('0x2b')](_0xb757('0x26'),_0x3550e8,_0x1cb222[_0xb757('0x2b')][_0xb757('0x2d')]);return _0x10e7bf(_0x1cb222[_0xb757('0x2b')][_0xb757('0x2d')]);}else{logger[_0xb757('0x25')](_0xb757('0x26'),_0x3550e8,_0xb757('0x27'));_0x10e7bf(_0x1cb222[_0xb757('0x2e')]['message']);}})[_0xb757('0x2f')](function(_0x4bd208){logger[_0xb757('0x2b')](_0xb757('0x26'),_0x3550e8,_0x4bd208);_0x3eca19(_0x4bd208);});});}function respondWithStatusCode(_0x1b51a4,_0x1e502c){_0x1e502c=_0x1e502c||0xcc;return function(_0x225b9d){if(_0x225b9d){return _0x1b51a4['sendStatus'](_0x1e502c);}return _0x1b51a4[_0xb757('0x30')](_0x1e502c)['end']();};}function respondWithResult(_0x322db0,_0x14b556){_0x14b556=_0x14b556||0xc8;return function(_0x4f8149){if(_0x4f8149){return _0x322db0[_0xb757('0x30')](_0x14b556)[_0xb757('0x31')](_0x4f8149);}};}function respondWithFilteredResult(_0x5607aa,_0xdad4d2){return function(_0x211a53){if(_0x211a53){var _0x142429=_0x211a53[_0xb757('0x32')],_0x25dae3=_0xdad4d2[_0xb757('0x33')],_0x108981=_0xdad4d2[_0xb757('0x33')]+_0xdad4d2[_0xb757('0x34')],_0x36ef9e;if(_0x108981>=_0x142429){_0x108981=_0x142429;_0x36ef9e=0xc8;}else{_0x36ef9e=0xce;}_0x5607aa['status'](_0x36ef9e);return _0x5607aa[_0xb757('0x35')]('Content-Range',_0x25dae3+'-'+_0x108981+'/'+_0x142429)[_0xb757('0x31')](_0x211a53);}return null;};}function patchUpdates(_0x3ce118){return function(_0x3a69b0){try{jsonpatch[_0xb757('0x36')](_0x3a69b0,_0x3ce118,!![]);}catch(_0x5105ed){return BPromise[_0xb757('0x37')](_0x5105ed);}return _0x3a69b0['save']();};}function saveUpdates(_0x31f8e6,_0x52d890){return function(_0x8becd9){if(_0x8becd9){return _0x8becd9['update'](_0x31f8e6)[_0xb757('0x38')](function(_0x57d955){return _0x57d955;});}return null;};}function removeEntity(_0x267e25,_0x4c4ace){return function(_0x5ebc94){if(_0x5ebc94){return _0x5ebc94['destroy']()[_0xb757('0x38')](function(){var _0x28359d=_0x5ebc94[_0xb757('0x39')]({'plain':!![]});var _0x1b376c=_0xb757('0x3a');return db[_0xb757('0x3b')][_0xb757('0x3c')]({'where':{'type':_0x1b376c,'resourceId':_0x28359d['id']}})[_0xb757('0x38')](function(){return _0x5ebc94;});})[_0xb757('0x38')](function(){_0x267e25[_0xb757('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42744b,_0x901732){return function(_0x5684c0){if(!_0x5684c0){_0x42744b['sendStatus'](0x194);}return _0x5684c0;};}function handleError(_0x5a63a6,_0x183146){_0x183146=_0x183146||0x1f4;return function(_0x2d322e){logger[_0xb757('0x2b')](_0x2d322e[_0xb757('0x3d')]);if(_0x2d322e[_0xb757('0x3e')]){delete _0x2d322e[_0xb757('0x3e')];}_0x5a63a6[_0xb757('0x30')](_0x183146)['send'](_0x2d322e);};}exports[_0xb757('0x3f')]=function(_0x2617bb,_0x5d6624){var _0x569f6b={'include':[{'model':db[_0xb757('0x40')],'as':_0xb757('0x41')}]},_0x3f35fb={},_0x1534de={'count':0x0,'rows':[]};var _0x57f91f=_[_0xb757('0x42')](db[_0xb757('0x43')]['rawAttributes'],function(_0x3515d2){return{'name':_0x3515d2['fieldName'],'type':_0x3515d2[_0xb757('0x44')][_0xb757('0x45')]};});_0x3f35fb['model']=_[_0xb757('0x42')](_0x57f91f,_0xb757('0x3e'));_0x3f35fb[_0xb757('0x46')]=_['keys'](_0x2617bb[_0xb757('0x46')]);_0x3f35fb[_0xb757('0x47')]=_[_0xb757('0x48')](_0x3f35fb[_0xb757('0x49')],_0x3f35fb[_0xb757('0x46')]);_0x569f6b[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x3f35fb[_0xb757('0x49')],qs['fields'](_0x2617bb[_0xb757('0x46')][_0xb757('0x4b')]));_0x569f6b[_0xb757('0x4a')]=_0x569f6b[_0xb757('0x4a')][_0xb757('0x4c')]?_0x569f6b[_0xb757('0x4a')]:_0x3f35fb[_0xb757('0x49')];if(!_0x2617bb['query'][_0xb757('0x4d')]('nolimit')){_0x569f6b[_0xb757('0x34')]=qs[_0xb757('0x34')](_0x2617bb[_0xb757('0x46')]['limit']);_0x569f6b['offset']=qs['offset'](_0x2617bb[_0xb757('0x46')][_0xb757('0x33')]);}_0x569f6b['order']=qs[_0xb757('0x4e')](_0x2617bb[_0xb757('0x46')][_0xb757('0x4e')]);_0x569f6b[_0xb757('0x4f')]=qs['filters'](_['pick'](_0x2617bb[_0xb757('0x46')],_0x3f35fb['filters']));if(_0x2617bb[_0xb757('0x46')][_0xb757('0x50')]){_0x569f6b[_0xb757('0x4f')]=_['merge'](_0x569f6b['where'],{'$or':_[_0xb757('0x42')](_0x57f91f,function(_0x254153){if(_0x254153[_0xb757('0x44')]!==_0xb757('0x51')){var _0x1aa586={};_0x1aa586[_0x254153[_0xb757('0x3e')]]={'$like':'%'+_0x2617bb[_0xb757('0x46')][_0xb757('0x50')]+'%'};return _0x1aa586;}})});}_0x569f6b=_[_0xb757('0x52')]({},_0x569f6b,_0x2617bb[_0xb757('0x53')]);var _0x5163b7={'where':_0x569f6b['where']};return db[_0xb757('0x43')][_0xb757('0x32')](_0x5163b7)[_0xb757('0x38')](function(_0x1077dc){_0x1534de['count']=_0x1077dc;if(_0x2617bb[_0xb757('0x46')]['includeAll']){_0x569f6b[_0xb757('0x54')]=[{'all':!![]}];}return db[_0xb757('0x43')][_0xb757('0x55')](_0x569f6b);})[_0xb757('0x38')](function(_0x5399a4){_0x1534de[_0xb757('0x56')]=_0x5399a4;return _0x1534de;})['then'](respondWithFilteredResult(_0x5d6624,_0x569f6b))[_0xb757('0x2f')](handleError(_0x5d6624,null));};exports[_0xb757('0x57')]=function(_0x5158a1,_0x49242d){var _0x17c887={'raw':![],'where':{'id':_0x5158a1[_0xb757('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb757('0x41')}]},_0x5e0680={};_0x5e0680['model']=_[_0xb757('0x59')](db['FaxAccount'][_0xb757('0x5a')]);_0x5e0680[_0xb757('0x46')]=_['keys'](_0x5158a1[_0xb757('0x46')]);_0x5e0680['filters']=_[_0xb757('0x48')](_0x5e0680[_0xb757('0x49')],_0x5e0680[_0xb757('0x46')]);_0x17c887[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x5e0680[_0xb757('0x49')],qs[_0xb757('0x4b')](_0x5158a1[_0xb757('0x46')][_0xb757('0x4b')]));_0x17c887[_0xb757('0x4a')]=_0x17c887[_0xb757('0x4a')][_0xb757('0x4c')]?_0x17c887['attributes']:_0x5e0680[_0xb757('0x49')];if(_0x5158a1[_0xb757('0x46')][_0xb757('0x5b')]){_0x17c887[_0xb757('0x54')]=[{'all':!![]}];}_0x17c887=_[_0xb757('0x52')]({},_0x17c887,_0x5158a1[_0xb757('0x53')]);return db['FaxAccount'][_0xb757('0x5c')](_0x17c887)['then'](handleEntityNotFound(_0x49242d,null))[_0xb757('0x38')](respondWithResult(_0x49242d,null))[_0xb757('0x2f')](handleError(_0x49242d,null));};exports['create']=function(_0x2df111,_0x4a64e8){return db['FaxAccount'][_0xb757('0x5d')](_0x2df111[_0xb757('0x5e')],{})['then'](function(_0x3eeecf){var _0x5b2484=_0x2df111[_0xb757('0x5f')][_0xb757('0x39')]({'plain':!![]});if(!_0x5b2484)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5b2484[_0xb757('0x60')]===_0xb757('0x5f')){var _0x5af8d2=_0x3eeecf[_0xb757('0x39')]({'plain':!![]});var _0x449deb=_0xb757('0x3a');return db[_0xb757('0x61')][_0xb757('0x5c')]({'where':{'name':_0x449deb,'userProfileId':_0x5b2484['userProfileId']},'raw':!![]})[_0xb757('0x38')](function(_0x353b62){if(_0x353b62&&_0x353b62[_0xb757('0x62')]===0x0){return db[_0xb757('0x3b')]['create']({'name':_0x5af8d2[_0xb757('0x3e')],'resourceId':_0x5af8d2['id'],'type':_0x353b62[_0xb757('0x3e')],'sectionId':_0x353b62['id']},{})[_0xb757('0x38')](function(){return _0x3eeecf;});}else{return _0x3eeecf;}})[_0xb757('0x2f')](function(_0xce6f15){logger[_0xb757('0x2b')](_0xb757('0x63'),_0xce6f15);throw _0xce6f15;});}return _0x3eeecf;})[_0xb757('0x38')](respondWithResult(_0x4a64e8,0xc9))[_0xb757('0x2f')](handleError(_0x4a64e8,null));};exports['update']=function(_0x3457b7,_0x1d7c08){if(_0x3457b7[_0xb757('0x5e')]['id']){delete _0x3457b7[_0xb757('0x5e')]['id'];}return db[_0xb757('0x43')][_0xb757('0x5c')]({'where':{'id':_0x3457b7[_0xb757('0x58')]['id']},'include':[{'model':db['Pause'],'as':_0xb757('0x41')}]})[_0xb757('0x38')](handleEntityNotFound(_0x1d7c08,null))[_0xb757('0x38')](saveUpdates(_0x3457b7[_0xb757('0x5e')],null))[_0xb757('0x38')](respondWithResult(_0x1d7c08,null))[_0xb757('0x2f')](handleError(_0x1d7c08,null));};exports['destroy']=function(_0x3aa308,_0x426674){return db[_0xb757('0x43')]['find']({'where':{'id':_0x3aa308[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x426674,null))[_0xb757('0x38')](removeEntity(_0x426674,null))['catch'](handleError(_0x426674,null));};exports[_0xb757('0x64')]=function(_0x46a739,_0x2b29bc){return db['FaxAccount'][_0xb757('0x64')]()['then'](respondWithResult(_0x2b29bc,null))[_0xb757('0x2f')](handleError(_0x2b29bc,null));};exports[_0xb757('0x65')]=function(_0x2eedc7,_0x28144c,_0x207c34){if(_0x2eedc7['body']['id']){delete _0x2eedc7[_0xb757('0x5e')]['id'];}return db[_0xb757('0x43')]['find']({'where':{'id':_0x2eedc7[_0xb757('0x58')]['id']}})['then'](handleEntityNotFound(_0x28144c,null))[_0xb757('0x38')](function(_0x206e1d){if(_0x206e1d){_0x2eedc7[_0xb757('0x5e')][_0xb757('0x66')]=_0x206e1d['id'];return db[_0xb757('0x67')][_0xb757('0x5d')](_0x2eedc7[_0xb757('0x5e')]);}})[_0xb757('0x38')](respondWithResult(_0x28144c,null))[_0xb757('0x2f')](handleError(_0x28144c,null));};exports[_0xb757('0x68')]=function(_0x5233bb,_0x320e67,_0x18c9f0){var _0x4cff64={'raw':![],'where':{}};var _0x56dab6={};var _0x27b3af={'count':0x0,'rows':[]};return db[_0xb757('0x43')]['findOne']({'where':{'id':_0x5233bb['params']['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x320e67,null))[_0xb757('0x38')](function(_0x57bdc5){if(_0x57bdc5){_0x56dab6[_0xb757('0x49')]=_[_0xb757('0x59')](db[_0xb757('0x67')]['rawAttributes']);_0x56dab6[_0xb757('0x46')]=_['keys'](_0x5233bb[_0xb757('0x46')]);_0x56dab6[_0xb757('0x47')]=_[_0xb757('0x48')](_0x56dab6[_0xb757('0x49')],_0x56dab6[_0xb757('0x46')]);_0x4cff64[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x56dab6[_0xb757('0x49')],qs[_0xb757('0x4b')](_0x5233bb['query'][_0xb757('0x4b')]));_0x4cff64[_0xb757('0x4a')]=_0x4cff64[_0xb757('0x4a')][_0xb757('0x4c')]?_0x4cff64['attributes']:_0x56dab6['model'];if(!_0x5233bb['query'][_0xb757('0x4d')](_0xb757('0x69'))){_0x4cff64[_0xb757('0x34')]=qs[_0xb757('0x34')](_0x5233bb[_0xb757('0x46')][_0xb757('0x34')]);_0x4cff64[_0xb757('0x33')]=qs[_0xb757('0x33')](_0x5233bb['query'][_0xb757('0x33')]);}_0x4cff64[_0xb757('0x6a')]=qs[_0xb757('0x4e')](_0x5233bb[_0xb757('0x46')][_0xb757('0x4e')]);_0x4cff64[_0xb757('0x4f')]=qs['filters'](_[_0xb757('0x6b')](_0x5233bb['query'],_0x56dab6[_0xb757('0x47')]));_0x4cff64[_0xb757('0x4f')]['FaxAccountId']=_0x57bdc5['id'];if(_0x5233bb[_0xb757('0x46')][_0xb757('0x50')]){_0x4cff64['where']=_[_0xb757('0x52')](_0x4cff64[_0xb757('0x4f')],{'$or':_[_0xb757('0x42')](_0x4cff64[_0xb757('0x4a')],function(_0x1f9d91){var _0x3bb1a6={};_0x3bb1a6[_0x1f9d91]={'$like':'%'+_0x5233bb[_0xb757('0x46')][_0xb757('0x50')]+'%'};return _0x3bb1a6;})});}_0x4cff64=_['merge']({},_0x4cff64,_0x5233bb[_0xb757('0x53')]);return db[_0xb757('0x67')][_0xb757('0x32')]({'where':_0x4cff64[_0xb757('0x4f')]})['then'](function(_0x5edff4){_0x27b3af[_0xb757('0x32')]=_0x5edff4;if(_0x5233bb[_0xb757('0x46')][_0xb757('0x5b')]){_0x4cff64[_0xb757('0x54')]=[{'all':!![]}];}return db[_0xb757('0x67')][_0xb757('0x55')](_0x4cff64);})[_0xb757('0x38')](function(_0x3b2454){_0x27b3af['rows']=_0x3b2454;return _0x27b3af;});}})['then'](respondWithFilteredResult(_0x320e67,_0x4cff64))['catch'](handleError(_0x320e67,null));};exports[_0xb757('0x6c')]=function(_0x3053c5,_0x5f3160,_0x574e5e){return db['FaxAccount'][_0xb757('0x5c')]({'where':{'id':_0x3053c5[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x5f3160,null))[_0xb757('0x38')](function(_0x411dd3){if(_0x411dd3){return _0x411dd3[_0xb757('0x6c')](_0x3053c5['query'][_0xb757('0x6d')]);}})[_0xb757('0x38')](respondWithStatusCode(_0x5f3160,null))['catch'](handleError(_0x5f3160,null));};exports[_0xb757('0x6e')]=function(_0x13586d,_0x42d278,_0x4d1256){if(_0x13586d[_0xb757('0x5e')]['id']){delete _0x13586d[_0xb757('0x5e')]['id'];}return db[_0xb757('0x43')][_0xb757('0x5c')]({'where':{'id':_0x13586d[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x42d278,null))[_0xb757('0x38')](function(_0x4b9bf1){if(_0x4b9bf1){_0x13586d['body']['FaxAccountId']=_0x4b9bf1['id'];return db[_0xb757('0x6f')][_0xb757('0x5d')](_0x13586d[_0xb757('0x5e')]);}})[_0xb757('0x38')](respondWithResult(_0x42d278,null))[_0xb757('0x2f')](handleError(_0x42d278,null));};exports[_0xb757('0x70')]=function(_0x3e6034,_0x19c2a0,_0xf8c354){var _0x2d1cbc={'raw':![],'where':{}};var _0x5de7f0={};var _0x14e09a={'count':0x0,'rows':[]};return db['FaxAccount'][_0xb757('0x71')]({'where':{'id':_0x3e6034['params']['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x19c2a0,null))[_0xb757('0x38')](function(_0x337826){if(_0x337826){_0x5de7f0['model']=_[_0xb757('0x59')](db[_0xb757('0x6f')][_0xb757('0x5a')]);_0x5de7f0[_0xb757('0x46')]=_[_0xb757('0x59')](_0x3e6034[_0xb757('0x46')]);_0x5de7f0[_0xb757('0x47')]=_[_0xb757('0x48')](_0x5de7f0[_0xb757('0x49')],_0x5de7f0[_0xb757('0x46')]);_0x2d1cbc[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x5de7f0[_0xb757('0x49')],qs[_0xb757('0x4b')](_0x3e6034[_0xb757('0x46')][_0xb757('0x4b')]));_0x2d1cbc[_0xb757('0x4a')]=_0x2d1cbc[_0xb757('0x4a')][_0xb757('0x4c')]?_0x2d1cbc[_0xb757('0x4a')]:_0x5de7f0[_0xb757('0x49')];if(!_0x3e6034[_0xb757('0x46')][_0xb757('0x4d')]('nolimit')){_0x2d1cbc[_0xb757('0x34')]=qs[_0xb757('0x34')](_0x3e6034[_0xb757('0x46')][_0xb757('0x34')]);_0x2d1cbc[_0xb757('0x33')]=qs['offset'](_0x3e6034[_0xb757('0x46')][_0xb757('0x33')]);}_0x2d1cbc[_0xb757('0x6a')]=qs[_0xb757('0x4e')](_0x3e6034[_0xb757('0x46')]['sort']);_0x2d1cbc[_0xb757('0x4f')]=qs[_0xb757('0x47')](_[_0xb757('0x6b')](_0x3e6034[_0xb757('0x46')],_0x5de7f0[_0xb757('0x47')]));_0x2d1cbc[_0xb757('0x4f')]['FaxAccountId']=_0x337826['id'];if(_0x3e6034[_0xb757('0x46')]['filter']){_0x2d1cbc[_0xb757('0x4f')]=_['merge'](_0x2d1cbc[_0xb757('0x4f')],{'$or':_[_0xb757('0x42')](_0x2d1cbc[_0xb757('0x4a')],function(_0x4da9b7){var _0x181fa8={};_0x181fa8[_0x4da9b7]={'$like':'%'+_0x3e6034[_0xb757('0x46')][_0xb757('0x50')]+'%'};return _0x181fa8;})});}_0x2d1cbc=_[_0xb757('0x52')]({},_0x2d1cbc,_0x3e6034[_0xb757('0x53')]);return db[_0xb757('0x6f')][_0xb757('0x32')]({'where':_0x2d1cbc['where']})[_0xb757('0x38')](function(_0x2725f9){_0x14e09a[_0xb757('0x32')]=_0x2725f9;if(_0x3e6034['query'][_0xb757('0x5b')]){_0x2d1cbc[_0xb757('0x54')]=[{'all':!![]}];}return db[_0xb757('0x6f')][_0xb757('0x55')](_0x2d1cbc);})[_0xb757('0x38')](function(_0x1fa915){_0x14e09a['rows']=_0x1fa915;return _0x14e09a;});}})[_0xb757('0x38')](respondWithFilteredResult(_0x19c2a0,_0x2d1cbc))[_0xb757('0x2f')](handleError(_0x19c2a0,null));};exports[_0xb757('0x72')]=function(_0x35895e,_0x2fb969,_0x307266){return db[_0xb757('0x43')][_0xb757('0x5c')]({'where':{'id':_0x35895e[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x2fb969,null))[_0xb757('0x38')](function(_0x52a87b){if(_0x52a87b){return _0x52a87b[_0xb757('0x72')](_0x35895e[_0xb757('0x46')][_0xb757('0x6d')]);}})['then'](respondWithStatusCode(_0x2fb969,null))[_0xb757('0x2f')](handleError(_0x2fb969,null));};exports[_0xb757('0x73')]=function(_0x1fc993,_0x25ea97,_0xbfde8b){return db['FaxInteraction'][_0xb757('0x5c')]({'where':{'id':_0x1fc993[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x25ea97,null))['then'](function(_0x10c05b){if(_0x10c05b){return _0x10c05b[_0xb757('0x73')](_0x1fc993['body'][_0xb757('0x6d')],_['omit'](_0x1fc993[_0xb757('0x5e')],[_0xb757('0x6d'),'id'])||{});}})[_0xb757('0x38')](respondWithResult(_0x25ea97,null))[_0xb757('0x2f')](handleError(_0x25ea97,null));};exports[_0xb757('0x74')]=function(_0x5c2c9d,_0x140077,_0x5b4aef){var _0x43369f={'raw':![],'where':{}};var _0x28137b={};var _0x474a98={'count':0x0,'rows':[]};return db[_0xb757('0x43')]['findOne']({'where':{'id':_0x5c2c9d[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x140077,null))['then'](function(_0xa6857a){if(_0xa6857a){_0x28137b[_0xb757('0x49')]=_[_0xb757('0x59')](db[_0xb757('0x75')][_0xb757('0x5a')]);_0x28137b[_0xb757('0x46')]=_[_0xb757('0x59')](_0x5c2c9d[_0xb757('0x46')]);_0x28137b[_0xb757('0x47')]=_[_0xb757('0x48')](_0x28137b['model'],_0x28137b[_0xb757('0x46')]);_0x43369f[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x28137b[_0xb757('0x49')],qs[_0xb757('0x4b')](_0x5c2c9d[_0xb757('0x46')][_0xb757('0x4b')]));_0x43369f['attributes']=_0x43369f[_0xb757('0x4a')]['length']?_0x43369f[_0xb757('0x4a')]:_0x28137b[_0xb757('0x49')];if(!_0x5c2c9d[_0xb757('0x46')][_0xb757('0x4d')](_0xb757('0x69'))){_0x43369f[_0xb757('0x34')]=qs[_0xb757('0x34')](_0x5c2c9d['query'][_0xb757('0x34')]);_0x43369f[_0xb757('0x33')]=qs[_0xb757('0x33')](_0x5c2c9d['query'][_0xb757('0x33')]);}_0x43369f['order']=qs[_0xb757('0x4e')](_0x5c2c9d[_0xb757('0x46')][_0xb757('0x4e')]);_0x43369f['where']=qs[_0xb757('0x47')](_['pick'](_0x5c2c9d[_0xb757('0x46')],_0x28137b[_0xb757('0x47')]));_0x43369f[_0xb757('0x4f')]['FaxAccountId']=_0xa6857a['id'];if(_0x5c2c9d['query']['filter']){_0x43369f[_0xb757('0x4f')]=_[_0xb757('0x52')](_0x43369f['where'],{'$or':_[_0xb757('0x42')](_0x43369f[_0xb757('0x4a')],function(_0x52bf25){var _0x5294eb={};_0x5294eb[_0x52bf25]={'$like':'%'+_0x5c2c9d['query'][_0xb757('0x50')]+'%'};return _0x5294eb;})});}_0x43369f=_['merge']({},_0x43369f,_0x5c2c9d[_0xb757('0x53')]);return db[_0xb757('0x75')]['count']({'where':_0x43369f[_0xb757('0x4f')]})['then'](function(_0x540227){_0x474a98[_0xb757('0x32')]=_0x540227;if(_0x5c2c9d[_0xb757('0x46')][_0xb757('0x5b')]){_0x43369f['include']=[{'model':db[_0xb757('0x76')],'as':_0xb757('0x77'),'required':![]},{'model':db[_0xb757('0x78')],'as':_0xb757('0x79'),'attributes':[_0xb757('0x3e'),'fullname','internal'],'required':![]},{'model':db[_0xb757('0x7a')],'as':_0xb757('0x7b'),'attributes':['id','name','color'],'where':_0x5c2c9d[_0xb757('0x46')]['tag']?{'id':_0x5c2c9d[_0xb757('0x46')][_0xb757('0x7c')]}:undefined,'required':_0x5c2c9d[_0xb757('0x46')][_0xb757('0x7c')]?!![]:![]}];}return db[_0xb757('0x75')][_0xb757('0x55')](_0x43369f);})[_0xb757('0x38')](function(_0x5006eb){_0x474a98[_0xb757('0x56')]=_0x5006eb;return _0x474a98;});}})[_0xb757('0x38')](respondWithFilteredResult(_0x140077,_0x43369f))[_0xb757('0x2f')](handleError(_0x140077,null));};exports[_0xb757('0x7d')]=function(_0x5518f7,_0x33f54f,_0x1d725a){return db['FaxAccount']['findOne']({'where':{'id':_0x5518f7[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x33f54f,null))[_0xb757('0x38')](function(_0x24126){if(_0x24126){return db[_0xb757('0x7e')][_0xb757('0x7f')](function(_0x4f8d1f){return db[_0xb757('0x80')]['destroy']({'where':{'FaxAccountId':_0x5518f7[_0xb757('0x58')]['id']},'transaction':_0x4f8d1f})[_0xb757('0x38')](function(_0x42f366){var _0x173f1d=_[_0xb757('0x42')](_0x5518f7[_0xb757('0x5e')],function(_0x1a2f3f){_0x1a2f3f[_0xb757('0x66')]=_0x5518f7['params']['id'];return _0x1a2f3f;});return db[_0xb757('0x80')][_0xb757('0x81')](_0x173f1d,{'transaction':_0x4f8d1f});});})[_0xb757('0x38')](function(){return db[_0xb757('0x80')][_0xb757('0x82')]({'where':{'FaxAccountId':_0x5518f7[_0xb757('0x58')]['id']},'order':_0xb757('0x83')});});}})[_0xb757('0x38')](respondWithResult(_0x33f54f,null))[_0xb757('0x2f')](handleError(_0x33f54f,null));};exports[_0xb757('0x84')]=function(_0x340c46,_0x20127c,_0x2cb65c){var _0x46ced1={};var _0x2d6fef={};var _0x14571a;var _0x57646d;return db['FaxAccount']['findOne']({'where':{'id':_0x340c46[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x20127c,null))[_0xb757('0x38')](function(_0x423524){if(_0x423524){_0x14571a=_0x423524;_0x2d6fef[_0xb757('0x49')]=_['keys'](db['FaxApplication']['rawAttributes']);_0x2d6fef[_0xb757('0x46')]=_[_0xb757('0x59')](_0x340c46[_0xb757('0x46')]);_0x2d6fef[_0xb757('0x47')]=_['intersection'](_0x2d6fef[_0xb757('0x49')],_0x2d6fef[_0xb757('0x46')]);_0x46ced1[_0xb757('0x4a')]=_['intersection'](_0x2d6fef[_0xb757('0x49')],qs['fields'](_0x340c46['query'][_0xb757('0x4b')]));_0x46ced1[_0xb757('0x4a')]=_0x46ced1['attributes'][_0xb757('0x4c')]?_0x46ced1[_0xb757('0x4a')]:_0x2d6fef['model'];_0x46ced1[_0xb757('0x6a')]=qs[_0xb757('0x4e')](_0x340c46[_0xb757('0x46')][_0xb757('0x4e')]);_0x46ced1['where']=qs[_0xb757('0x47')](_[_0xb757('0x6b')](_0x340c46['query'],_0x2d6fef['filters']));if(_0x340c46['query'][_0xb757('0x50')]){_0x46ced1[_0xb757('0x4f')]=_['merge'](_0x46ced1[_0xb757('0x4f')],{'$or':_[_0xb757('0x42')](_0x46ced1[_0xb757('0x4a')],function(_0x1c0b60){var _0xe00001={};_0xe00001[_0x1c0b60]={'$like':'%'+_0x340c46[_0xb757('0x46')][_0xb757('0x50')]+'%'};return _0xe00001;})});}_0x46ced1=_[_0xb757('0x52')]({},_0x46ced1,_0x340c46['options']);return _0x14571a[_0xb757('0x84')](_0x46ced1);}})[_0xb757('0x38')](function(_0x593ebd){if(_0x593ebd){_0x57646d=_0x593ebd[_0xb757('0x4c')];if(!_0x340c46[_0xb757('0x46')]['hasOwnProperty'](_0xb757('0x69'))){_0x46ced1[_0xb757('0x34')]=qs['limit'](_0x340c46[_0xb757('0x46')][_0xb757('0x34')]);_0x46ced1['offset']=qs[_0xb757('0x33')](_0x340c46[_0xb757('0x46')][_0xb757('0x33')]);}return _0x14571a[_0xb757('0x84')](_0x46ced1);}})[_0xb757('0x38')](function(_0xcd614c){if(_0xcd614c){return _0xcd614c?{'count':_0x57646d,'rows':_0xcd614c}:null;}})['then'](respondWithResult(_0x20127c,null))[_0xb757('0x2f')](handleError(_0x20127c,null));};function Extension(_0x16d8fb,_0x37a921,_0x5a1d8a,_0x2ffcf4){this[_0xb757('0x85')]=_0xb757('0x86');this[_0xb757('0x87')]=_0x16d8fb['localstationid'];this[_0xb757('0x88')]=_0x2ffcf4;this[_0xb757('0x44')]=_0xb757('0x89');this[_0xb757('0x8a')]=_0xb757('0x8b');this['FaxAccountId']=_0x16d8fb['id'];this[_0xb757('0x83')]=_0x37a921;this[_0xb757('0x8c')]=_0x5a1d8a;}function createExtensionsReciveFax(_0x1f0157){var _0x4d171f=0x1;var _0x1e3d37=[];_0x1e3d37[_0xb757('0x8d')](new Extension(_0x1f0157,_0x4d171f,'',_0xb757('0x8e')));_0x4d171f+=0x1;_0x1e3d37['push'](new Extension(_0x1f0157,_0x4d171f,'CDR(type)=inbound-fax','Set'));_0x4d171f+=0x1;for(var _0x1b2475 in _0x1f0157){if(_0x1f0157[_0xb757('0x4d')](_0x1b2475)&&(_0x1b2475==='ecm'||_0x1b2475===_0xb757('0x8f')||_0x1b2475===_0xb757('0x90')||_0x1b2475==='faxdetect'||_0x1b2475==='headerinfo'||_0x1b2475===_0xb757('0x91')||_0x1b2475===_0xb757('0x92')||_0x1b2475===_0xb757('0x93')||_0x1b2475===_0xb757('0x94'))){_0x1e3d37[_0xb757('0x8d')](new Extension(_0x1f0157,_0x4d171f,_0xb757('0x95')+_0x1b2475+')='+_0x1f0157[_0x1b2475],_0xb757('0x96')));_0x4d171f+=0x1;}}_0x1e3d37[_0xb757('0x8d')](new Extension(_0x1f0157,_0x4d171f,'6',_0xb757('0x97')));_0x4d171f+=0x1;_0x1e3d37[_0xb757('0x8d')](new Extension(_0x1f0157,_0x4d171f,'/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',_0xb757('0x98')));_0x4d171f=0x0;return _0x1e3d37;}exports[_0xb757('0x99')]=function(_0x27c1de,_0x447753,_0x28e3c8){var _0x2e6f9e;return db['sequelize'][_0xb757('0x7f')](function(_0x1f45d8){return db[_0xb757('0x43')][_0xb757('0x5d')](_0x27c1de['body'],{'transaction':_0x1f45d8})[_0xb757('0x38')](function(_0x654d80){_0x2e6f9e=_0x654d80[_0xb757('0x39')]({'plain':!![]});return db['VoiceExtension']['bulkCreate'](createExtensionsReciveFax(_0x2e6f9e),{'transaction':_0x1f45d8});});})[_0xb757('0x38')](function(){return _0x2e6f9e;})[_0xb757('0x38')](respondWithResult(_0x447753,null))[_0xb757('0x2f')](handleError(_0x447753,null));};exports['updateAccountApplications']=function(_0x21d208,_0x2ea0ae,_0x48fc16){var _0xa75d1f;return db[_0xb757('0x7e')]['transaction'](function(_0x57065e){return db['FaxAccount'][_0xb757('0x9a')](_0x21d208[_0xb757('0x5e')],{'where':{'id':_0x21d208[_0xb757('0x5e')]['id']},'transaction':_0x57065e})[_0xb757('0x38')](function(_0xdcbf56){return db['VoiceExtension'][_0xb757('0x3c')]({'where':{'FaxAccountId':_0x21d208[_0xb757('0x5e')]['id']},'transaction':_0x57065e})[_0xb757('0x38')](function(_0x5f06fd){return db[_0xb757('0x9b')]['bulkCreate'](createExtensionsReciveFax(_[_0xb757('0x9c')](_0x21d208['body'],['tech',_0xb757('0x45'),_0xb757('0x9d'),_0xb757('0x9e'),_0xb757('0x9f'),_0xb757('0xa0')])),{'transaction':_0x57065e});});});})[_0xb757('0x38')](function(){return db[_0xb757('0x43')][_0xb757('0xa1')](_0x21d208[_0xb757('0x5e')]['id']);})[_0xb757('0x38')](respondWithResult(_0x2ea0ae,null))[_0xb757('0x2f')](handleError(_0x2ea0ae,null));};exports['getMessages']=function(_0x4752a1,_0x42bae5,_0x915201){var _0xb992f6={'raw':!![],'where':{}};var _0x5936b6={};var _0x39850a={'count':0x0,'rows':[]};return db[_0xb757('0x43')][_0xb757('0x71')]({'where':{'id':_0x4752a1[_0xb757('0x58')]['id']}})['then'](handleEntityNotFound(_0x42bae5,null))[_0xb757('0x38')](function(_0x909942){if(_0x909942){_0x5936b6[_0xb757('0x49')]=_[_0xb757('0x59')](db[_0xb757('0xa2')][_0xb757('0x5a')]);_0x5936b6['query']=_[_0xb757('0x59')](_0x4752a1[_0xb757('0x46')]);_0x5936b6[_0xb757('0x47')]=_['intersection'](_0x5936b6['model'],_0x5936b6[_0xb757('0x46')]);_0xb992f6['attributes']=_[_0xb757('0x48')](_0x5936b6[_0xb757('0x49')],qs['fields'](_0x4752a1['query'][_0xb757('0x4b')]));_0xb992f6[_0xb757('0x4a')]=_0xb992f6[_0xb757('0x4a')][_0xb757('0x4c')]?_0xb992f6[_0xb757('0x4a')]:_0x5936b6[_0xb757('0x49')];if(!_0x4752a1[_0xb757('0x46')]['hasOwnProperty']('nolimit')){_0xb992f6[_0xb757('0x34')]=qs[_0xb757('0x34')](_0x4752a1[_0xb757('0x46')][_0xb757('0x34')]);_0xb992f6['offset']=qs['offset'](_0x4752a1['query'][_0xb757('0x33')]);}_0xb992f6['order']=qs[_0xb757('0x4e')](_0x4752a1[_0xb757('0x46')][_0xb757('0x4e')]);_0xb992f6['where']=qs[_0xb757('0x47')](_[_0xb757('0x6b')](_0x4752a1['query'],_0x5936b6[_0xb757('0x47')]));_0xb992f6[_0xb757('0x4f')][_0xb757('0x66')]=_0x909942['id'];if(_0x4752a1[_0xb757('0x46')][_0xb757('0x50')]){_0xb992f6[_0xb757('0x4f')]=_[_0xb757('0x52')](_0xb992f6[_0xb757('0x4f')],{'$or':_[_0xb757('0x42')](_0xb992f6[_0xb757('0x4a')],function(_0x4ce92b){var _0x190e35={};_0x190e35[_0x4ce92b]={'$like':'%'+_0x4752a1[_0xb757('0x46')]['filter']+'%'};return _0x190e35;})});}if(_0x4752a1[_0xb757('0x46')]['$gte']){var _0x39bbf9=_0x4752a1[_0xb757('0x46')][_0xb757('0xa3')][_0xb757('0xa4')](',');var _0xf973d={};_0xf973d[_0x39bbf9[0x0]]={'$gte':moment(_0x39bbf9[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0xb992f6[_0xb757('0x4f')]=_[_0xb757('0x52')](_0xb992f6[_0xb757('0x4f')],_0xf973d);}_0xb992f6=_[_0xb757('0x52')]({},_0xb992f6,_0x4752a1[_0xb757('0x53')]);return db[_0xb757('0xa2')]['count']({'where':_0xb992f6[_0xb757('0x4f')]})['then'](function(_0x1ebc45){_0x39850a[_0xb757('0x32')]=_0x1ebc45;if(_0x4752a1[_0xb757('0x46')][_0xb757('0x5b')]){_0xb992f6[_0xb757('0x54')]=[{'all':!![]}];}return db[_0xb757('0xa2')][_0xb757('0x55')](_0xb992f6);})[_0xb757('0x38')](function(_0x2fe46e){_0x39850a[_0xb757('0x56')]=_0x2fe46e;return _0x39850a;});}})[_0xb757('0x38')](respondWithFilteredResult(_0x42bae5,_0xb992f6))[_0xb757('0x2f')](handleError(_0x42bae5,null));};exports[_0xb757('0xa5')]=function(_0x4d5174,_0x4782dc,_0x25acf4){var _0x4ec065,_0x1d5c1e={},_0x2749c0;if(_0x4d5174[_0xb757('0x5e')]['to']){_0x2749c0=_0x4d5174[_0xb757('0x5e')]['to'][0x0];}return db['FaxAccount'][_0xb757('0x5c')]({'where':{'id':_0x4d5174[_0xb757('0x58')]['id']},'include':[{'model':db[_0xb757('0xa6')],'as':_0xb757('0xa7'),'include':[{'model':db['CmContact'],'as':_0xb757('0xa8'),'where':{'fax':_0x2749c0},'limit':0x1,'order':[[_0xb757('0x9e'),_0xb757('0xa9')]]}]}]})['then'](handleEntityNotFound(_0x4782dc,null))[_0xb757('0x38')](function(_0xbf4a72){_0x4ec065=_0xbf4a72;if(_0x4d5174['body'][_0xb757('0xaa')]&&_0x4d5174['body'][_0xb757('0xaa')][_0xb757('0x4c')]){for(var _0x288eb6=0x0;_0x288eb6<_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')]['length'];_0x288eb6+=0x1){_0x4d5174[_0xb757('0x5e')]['attachments'][_0x288eb6]={'filename':_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][_0x288eb6][_0xb757('0x3e')],'id':_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][_0x288eb6]['id'],'path':path[_0xb757('0xab')](config[_0xb757('0xac')],_0xb757('0xad'),_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][_0x288eb6][_0xb757('0xae')])};}}return respondWithRpcPromise(_0xb757('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0xb757('0xb0')](_0x4d5174[_0xb757('0x58')]['id'])?undefined:_0x4d5174['params']['id'],'path':_[_0xb757('0xb0')](_0x4d5174[_0xb757('0x5e')]['attachments'][0x0][_0xb757('0x6')])?undefined:_0x4d5174[_0xb757('0x5e')]['attachments'][0x0][_0xb757('0x6')],'fax':_[_0xb757('0xb0')](_0x4d5174[_0xb757('0x5e')]['to'][0x0])?undefined:_0x4d5174[_0xb757('0x5e')]['to'][0x0]},client9002);})['then'](function(){if(_0x4ec065){if(_[_0xb757('0xb0')](_0x4d5174[_0xb757('0x5e')][_0xb757('0xb1')])){_0x4d5174[_0xb757('0x5e')][_0xb757('0xb1')]=util[_0xb757('0xb2')](_0xb757('0xb3'),_0x4ec065[_0xb757('0x3e')],_0x4ec065['fax']);}if(_0x4ec065[_0xb757('0xa7')]){if(_0x4ec065[_0xb757('0xa7')]['Contacts'][_0xb757('0x4c')]){return _0x4ec065[_0xb757('0xa7')][_0xb757('0xa8')][0x0];}else{return db['CmContact'][_0xb757('0x5d')](_['defaults'](_0x4d5174[_0xb757('0x5e')],{'firstName':_0x4d5174[_0xb757('0x5e')]['to'][0x0],'phone':_0x4d5174[_0xb757('0x5e')]['to'][0x0],'fax':_0x4d5174['body']['to'][0x0],'ListId':_0x4ec065[_0xb757('0xa0')]}));}}else{throw new Error(_0xb757('0xb4'));}}else{throw new Error(_0xb757('0xb5'));}})[_0xb757('0x38')](function(_0x1106b4){if(_0x1106b4){return db[_0xb757('0x75')][_0xb757('0x5c')]({'where':{'ContactId':_0x1106b4['id'],'closed':![],'FaxAccountId':_0x4ec065['id']}})[_0xb757('0x38')](function(_0x32bb01){if(_0x32bb01){return[_0x32bb01,![]];}return db[_0xb757('0x75')]['create']({'UserId':_0x4d5174[_0xb757('0x5f')]['id'],'ContactId':_0x1106b4['id'],'FaxAccountId':_0x4ec065['id'],'fax':_0x4d5174[_0xb757('0x5e')]['to'][0x0],'firstMsgDirection':'out','Messages':[_['merge'](_0x4d5174[_0xb757('0x5e')],{'read':![],'body':_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][0x0][_0xb757('0xb6')],'FaxAccountId':_0x4ec065['id'],'UserId':_0x4d5174[_0xb757('0x5f')]['id'],'ContactId':_0x1106b4['id'],'AttachmentId':_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':_0xb757('0xb7')}]})['then'](function(_0x5f0dcf){return[_0x5f0dcf,!![]];});});}else{throw new Error(_0xb757('0xb8'));}})[_0xb757('0xb9')](function(_0x5e6858,_0x13118f){if(_0x13118f){return _0x5e6858;}return db[_0xb757('0xa2')][_0xb757('0x5d')]({'direction':_0xb757('0xba'),'read':![],'body':_0x4d5174[_0xb757('0x5e')]['attachments'][0x0][_0xb757('0xb6')],'FaxAccountId':_0x4ec065['id'],'FaxInteractionId':_0x5e6858['id'],'UserId':_0x4d5174[_0xb757('0x5f')]['id'],'ContactId':_0x5e6858[_0xb757('0xbb')],'AttachmentId':_0x4d5174[_0xb757('0x5e')][_0xb757('0xaa')][0x0]['id']})[_0xb757('0x38')](function(_0x495ef5){_0x5e6858['dataValues'][_0xb757('0xb7')]=[];_0x5e6858[_0xb757('0xbc')][_0xb757('0xb7')][_0xb757('0x8d')](_0x495ef5[_0xb757('0xbc')]);return _0x5e6858;});})[_0xb757('0x38')](function(_0x529cf7){respondWithRpcPromise(_0xb757('0xbd'),_0xb757('0xbd'),{'FaxAccountId':_['isNil'](_0x4d5174['params']['id'])?undefined:_0x4d5174['params']['id'],'path':_[_0xb757('0xb0')](_0x4d5174['body']['attachments'][0x0][_0xb757('0x6')])?undefined:_0x4d5174['body'][_0xb757('0xaa')][0x0]['path'],'fax':_['isNil'](_0x4d5174[_0xb757('0x5e')]['to'][0x0])?undefined:_0x4d5174[_0xb757('0x5e')]['to'][0x0],'AttachmentId':_0x4d5174[_0xb757('0x5e')]['attachments'][0x0]['id']},client9002)[_0xb757('0x38')](function(_0x33f33e){logger[_0xb757('0x25')](_0xb757('0xbe'),_0x33f33e);})[_0xb757('0x2f')](function(_0x6ff73f){logger[_0xb757('0x25')]('SendFaxRpc,\x20%s',_0x6ff73f);});return _0x529cf7;})[_0xb757('0x38')](respondWithResult(_0x4782dc,null))[_0xb757('0x2f')](handleError(_0x4782dc,null));};exports['addAgents']=function(_0x1fb737,_0x5072a3,_0x1d20bd){return db[_0xb757('0x43')]['find']({'where':{'id':_0x1fb737[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x5072a3,null))['then'](function(_0x4f686d){if(_0x4f686d){return _0x4f686d[_0xb757('0xbf')](_0x1fb737[_0xb757('0x5e')][_0xb757('0x6d')],_[_0xb757('0x9c')](_0x1fb737[_0xb757('0x5e')],[_0xb757('0x6d'),'id'])||{})['spread'](function(_0x28cdbc){for(var _0x43a486=0x0;_0x43a486<_0x1fb737[_0xb757('0x5e')][_0xb757('0x6d')][_0xb757('0x4c')];_0x43a486+=0x1){socket['emit'](_0xb757('0xc0'),{'UserId':_0x1fb737[_0xb757('0x5e')]['ids'][_0x43a486],'FaxAccountId':_0x1fb737['params']['id']});}return _0x28cdbc;});}})[_0xb757('0x38')](respondWithResult(_0x5072a3,null))[_0xb757('0x2f')](handleError(_0x5072a3,null));};exports[_0xb757('0xc1')]=function(_0x3b5273,_0x19be21,_0x2e6445){return db['FaxAccount']['find']({'where':{'id':_0x3b5273[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x19be21,null))['then'](function(_0x30dd1e){if(_0x30dd1e){return _0x30dd1e[_0xb757('0xc1')](_0x3b5273[_0xb757('0x46')][_0xb757('0x6d')])[_0xb757('0x38')](function(){if(_['isArray'](_0x3b5273[_0xb757('0x46')][_0xb757('0x6d')])){for(var _0x1e8e02=0x0;_0x1e8e02<_0x3b5273['query'][_0xb757('0x6d')][_0xb757('0x4c')];_0x1e8e02+=0x1){socket[_0xb757('0xc2')](_0xb757('0xc3'),{'UserId':Number(_0x3b5273[_0xb757('0x46')]['ids'][_0x1e8e02]),'FaxAccountId':Number(_0x3b5273[_0xb757('0x58')]['id'])});}}else{socket[_0xb757('0xc2')](_0xb757('0xc3'),{'UserId':Number(_0x3b5273['query'][_0xb757('0x6d')]),'FaxAccountId':Number(_0x3b5273[_0xb757('0x58')]['id'])});}});}})[_0xb757('0x38')](respondWithStatusCode(_0x19be21,null))['catch'](handleError(_0x19be21,null));};exports['getAgents']=function(_0x570cf1,_0x5b6e23,_0x469485){var _0x17e6a8={};var _0x4ec41d={};var _0x1e502d;var _0x5d3ed2;return db[_0xb757('0x43')][_0xb757('0x71')]({'where':{'id':_0x570cf1[_0xb757('0x58')]['id']}})[_0xb757('0x38')](handleEntityNotFound(_0x5b6e23,null))[_0xb757('0x38')](function(_0x5ee199){if(_0x5ee199){_0x1e502d=_0x5ee199;_0x4ec41d[_0xb757('0x49')]=_[_0xb757('0x59')](db[_0xb757('0x78')][_0xb757('0x5a')]);_0x4ec41d[_0xb757('0x46')]=_[_0xb757('0x59')](_0x570cf1[_0xb757('0x46')]);_0x4ec41d['filters']=_[_0xb757('0x48')](_0x4ec41d[_0xb757('0x49')],_0x4ec41d[_0xb757('0x46')]);_0x17e6a8[_0xb757('0x4a')]=_[_0xb757('0x48')](_0x4ec41d[_0xb757('0x49')],qs[_0xb757('0x4b')](_0x570cf1[_0xb757('0x46')][_0xb757('0x4b')]));_0x17e6a8[_0xb757('0x4a')]=_0x17e6a8[_0xb757('0x4a')][_0xb757('0x4c')]?_0x17e6a8[_0xb757('0x4a')]:_0x4ec41d[_0xb757('0x49')];_0x17e6a8[_0xb757('0x6a')]=qs[_0xb757('0x4e')](_0x570cf1['query'][_0xb757('0x4e')]);_0x17e6a8[_0xb757('0x4f')]=qs[_0xb757('0x47')](_[_0xb757('0x6b')](_0x570cf1['query'],_0x4ec41d['filters']));if(_0x570cf1[_0xb757('0x46')][_0xb757('0x50')]){_0x17e6a8[_0xb757('0x4f')]=_['merge'](_0x17e6a8[_0xb757('0x4f')],{'$or':_[_0xb757('0x42')](_0x17e6a8[_0xb757('0x4a')],function(_0x4df962){var _0x173d43={};_0x173d43[_0x4df962]={'$like':'%'+_0x570cf1['query'][_0xb757('0x50')]+'%'};return _0x173d43;})});}_0x17e6a8=_[_0xb757('0x52')]({},_0x17e6a8,_0x570cf1['options']);return _0x1e502d[_0xb757('0xc4')](_0x17e6a8);}})[_0xb757('0x38')](function(_0x5cf08f){if(_0x5cf08f){_0x5d3ed2=_0x5cf08f[_0xb757('0x4c')];if(!_0x570cf1[_0xb757('0x46')][_0xb757('0x4d')]('nolimit')){_0x17e6a8[_0xb757('0x34')]=qs['limit'](_0x570cf1[_0xb757('0x46')]['limit']);_0x17e6a8[_0xb757('0x33')]=qs[_0xb757('0x33')](_0x570cf1[_0xb757('0x46')][_0xb757('0x33')]);}return _0x1e502d[_0xb757('0xc4')](_0x17e6a8);}})[_0xb757('0x38')](function(_0x507a76){if(_0x507a76){return _0x507a76?{'count':_0x5d3ed2,'rows':_0x507a76}:null;}})[_0xb757('0x38')](respondWithResult(_0x5b6e23,null))['catch'](handleError(_0x5b6e23,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 2705171..4d1ea67 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 _0x0227=['events','setMaxListeners','update','remove','emit','hook'];(function(_0x57f0c3,_0x29a4ef){var _0x1e1706=function(_0x135594){while(--_0x135594){_0x57f0c3['push'](_0x57f0c3['shift']());}};_0x1e1706(++_0x29a4ef);}(_0x0227,0x84));var _0x7022=function(_0x460713,_0x406625){_0x460713=_0x460713-0x0;var _0x5e0fe5=_0x0227[_0x460713];return _0x5e0fe5;};'use strict';var EventEmitter=require(_0x7022('0x0'));var FaxAccount=require('../../mysqldb')['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x7022('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7022('0x2'),'afterDestroy':_0x7022('0x3')};function emitEvent(_0x535d98){return function(_0x35fdc5,_0x776424,_0x4b25bf){FaxAccountEvents[_0x7022('0x4')](_0x535d98+':'+_0x35fdc5['id'],_0x35fdc5);FaxAccountEvents['emit'](_0x535d98,_0x35fdc5);_0x4b25bf(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x7022('0x5')](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file +var _0xccdd=['FaxAccount','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x2d2bc9,_0xff9213){var _0x4f2e14=function(_0x5d1378){while(--_0x5d1378){_0x2d2bc9['push'](_0x2d2bc9['shift']());}};_0x4f2e14(++_0xff9213);}(_0xccdd,0x170));var _0xdccd=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0xccdd[_0x35da42];return _0x370035;};'use strict';var EventEmitter=require(_0xdccd('0x0'));var FaxAccount=require(_0xdccd('0x1'))['db'][_0xdccd('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xdccd('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xdccd('0x4'),'afterDestroy':_0xdccd('0x5')};function emitEvent(_0x46bf6e){return function(_0x47a50d,_0x5c2e50,_0x21f3b9){FaxAccountEvents[_0xdccd('0x6')](_0x46bf6e+':'+_0x47a50d['id'],_0x47a50d);FaxAccountEvents[_0xdccd('0x6')](_0x46bf6e,_0x47a50d);_0x21f3b9(null);};}for(var e in events){if(events[_0xdccd('0x7')](e)){var event=events[e];FaxAccount[_0xdccd('0x8')](e,emitEvent(event));}}module[_0xdccd('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index dde1562..b6a2111 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 _0xf830=['rimraf','./faxAccount.attributes','exports','define','FaxAccount','fax_accounts','lodash','../../config/logger','moment','request-promise','path'];(function(_0x48e2db,_0x5bef01){var _0x44597e=function(_0x2d8c5c){while(--_0x2d8c5c){_0x48e2db['push'](_0x48e2db['shift']());}};_0x44597e(++_0x5bef01);}(_0xf830,0x1a8));var _0x0f83=function(_0x3737e6,_0x5b2de3){_0x3737e6=_0x3737e6-0x0;var _0x589409=_0xf830[_0x3737e6];return _0x589409;};'use strict';var _=require(_0x0f83('0x0'));var util=require('util');var logger=require(_0x0f83('0x1'))('api');var moment=require(_0x0f83('0x2'));var BPromise=require('bluebird');var rp=require(_0x0f83('0x3'));var fs=require('fs');var path=require(_0x0f83('0x4'));var rimraf=require(_0x0f83('0x5'));var config=require('../../config/environment');var attributes=require(_0x0f83('0x6'));module[_0x0f83('0x7')]=function(_0x577031,_0x5154b4){return _0x577031[_0x0f83('0x8')](_0x0f83('0x9'),attributes,{'tableName':_0x0f83('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf66e=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','lodash'];(function(_0x28eb00,_0x5d6873){var _0x4f76aa=function(_0x482ad5){while(--_0x482ad5){_0x28eb00['push'](_0x28eb00['shift']());}};_0x4f76aa(++_0x5d6873);}(_0xf66e,0xa4));var _0xef66=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0xf66e[_0x173441];return _0x2423a8;};'use strict';var _=require(_0xef66('0x0'));var util=require(_0xef66('0x1'));var logger=require(_0xef66('0x2'))(_0xef66('0x3'));var moment=require(_0xef66('0x4'));var BPromise=require(_0xef66('0x5'));var rp=require(_0xef66('0x6'));var fs=require('fs');var path=require(_0xef66('0x7'));var rimraf=require('rimraf');var config=require(_0xef66('0x8'));var attributes=require('./faxAccount.attributes');module[_0xef66('0x9')]=function(_0x2db930,_0xe8458d){return _0x2db930[_0xef66('0xa')]('FaxAccount',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 0b7eb0c..da13fcd 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 _0xa34b=['get','autoclose','close','unmanaged','*,*,*,*','created','FaxMessage','ContactId','AttachmentId','User','name','interaction','unshift','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxAccount','FaxAccount','options','raw','limit','map','model','attributes','include','NotifyFaxAccount','body','fax','CmContact','describe','ValidationError','no\x20available\x20attributes','difference','updatedAt','keys','CompanyId','ListId','from','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','Contacts','DESC','FaxApplication','Applications','applications','priority','asc','length','contact','FaxInteraction','create','Contact\x20not\x20found'];(function(_0x12bb27,_0x2aa17c){var _0x53ddb1=function(_0x547f1a){while(--_0x547f1a){_0x12bb27['push'](_0x12bb27['shift']());}};_0x53ddb1(++_0x2aa17c);}(_0xa34b,0xbf));var _0xba34=function(_0x3e5bb8,_0x475c54){_0x3e5bb8=_0x3e5bb8-0x0;var _0x4851f2=_0xa34b[_0x3e5bb8];return _0x4851f2;};'use strict';var _=require(_0xba34('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xba34('0x1'));var rs=require(_0xba34('0x2'));var fs=require('fs');var Redis=require(_0xba34('0x3'));var db=require(_0xba34('0x4'))['db'];var utils=require(_0xba34('0x5'));var logger=require(_0xba34('0x6'))('rpc');var config=require(_0xba34('0x7'));var jayson=require(_0xba34('0x8'));var client=jayson[_0xba34('0x9')][_0xba34('0xa')]({'port':0x232c});config[_0xba34('0xb')]=_[_0xba34('0xc')](config[_0xba34('0xb')],{'host':_0xba34('0xd'),'port':0x18eb});var socket=require(_0xba34('0xe'))(new Redis(config[_0xba34('0xb')]));require(_0xba34('0xf'))[_0xba34('0x10')](socket);function respondWithRpcPromise(_0x5fbacc,_0x51378c,_0x151176){return new BPromise(function(_0x676b72,_0x412cd7){return client[_0xba34('0x11')](_0x5fbacc,_0x151176)[_0xba34('0x12')](function(_0x3cd59e){logger[_0xba34('0x13')](_0xba34('0x14'),_0x51378c,_0xba34('0x15'));logger[_0xba34('0x16')](_0xba34('0x17'),_0x51378c,_0xba34('0x15'),JSON[_0xba34('0x18')](_0x3cd59e));if(_0x3cd59e[_0xba34('0x19')]){if(_0x3cd59e[_0xba34('0x19')][_0xba34('0x1a')]===0x1f4){logger[_0xba34('0x19')](_0xba34('0x14'),_0x51378c,_0x3cd59e['error'][_0xba34('0x1b')]);return _0x412cd7(_0x3cd59e[_0xba34('0x19')][_0xba34('0x1b')]);}logger[_0xba34('0x19')](_0xba34('0x14'),_0x51378c,_0x3cd59e[_0xba34('0x19')][_0xba34('0x1b')]);return _0x676b72(_0x3cd59e[_0xba34('0x19')][_0xba34('0x1b')]);}else{logger['info'](_0xba34('0x14'),_0x51378c,'request\x20sent');_0x676b72(_0x3cd59e[_0xba34('0x1c')][_0xba34('0x1b')]);}})['catch'](function(_0x252296){logger[_0xba34('0x19')](_0xba34('0x14'),_0x51378c,_0x252296);_0x412cd7(_0x252296);});});}exports[_0xba34('0x1d')]=function(_0x45aba3){var _0x304137=this;return new Promise(function(_0x59ea7b,_0x81f12e){return db[_0xba34('0x1e')]['findAll']({'raw':_0x45aba3[_0xba34('0x1f')]?_0x45aba3[_0xba34('0x1f')][_0xba34('0x20')]===undefined?!![]:![]:!![],'where':_0x45aba3['options']?_0x45aba3[_0xba34('0x1f')]['where']||null:null,'attributes':_0x45aba3[_0xba34('0x1f')]?_0x45aba3[_0xba34('0x1f')]['attributes']||null:null,'limit':_0x45aba3[_0xba34('0x1f')]?_0x45aba3[_0xba34('0x1f')][_0xba34('0x21')]||null:null,'include':_0x45aba3[_0xba34('0x1f')]?_0x45aba3[_0xba34('0x1f')]['include']?_[_0xba34('0x22')](_0x45aba3['options']['include'],function(_0x4dbed8){return{'model':db[_0x4dbed8[_0xba34('0x23')]],'as':_0x4dbed8['as'],'attributes':_0x4dbed8[_0xba34('0x24')],'include':_0x4dbed8[_0xba34('0x25')]?_[_0xba34('0x22')](_0x4dbed8['include'],function(_0x234a6e){return{'model':db[_0x234a6e[_0xba34('0x23')]],'as':_0x234a6e['as'],'attributes':_0x234a6e[_0xba34('0x24')],'include':_0x234a6e[_0xba34('0x25')]?_[_0xba34('0x22')](_0x234a6e[_0xba34('0x25')],function(_0x4ee97b){return{'model':db[_0x4ee97b[_0xba34('0x23')]],'as':_0x4ee97b['as'],'attributes':_0x4ee97b['attributes']};}):[]};}):[]};}):[]:[]})[_0xba34('0x12')](function(_0x2596c4){logger['info']('GetFaxAccount',_0x45aba3);logger[_0xba34('0x16')](_0xba34('0x1d'),_0x45aba3,JSON[_0xba34('0x18')](_0x2596c4));_0x59ea7b(_0x2596c4);})['catch'](function(_0x770fd8){logger['error'](_0xba34('0x1d'),_0x770fd8[_0xba34('0x1b')],_0x45aba3);_0x81f12e(_0x304137[_0xba34('0x19')](0x1f4,_0x770fd8[_0xba34('0x1b')]));});});};exports[_0xba34('0x26')]=function(_0x5280b3,_0x3fe8a1,_0xc725c1){var _0x2654c6=this;return new Promise(function(_0x5171f6,_0x90e55b){var _0x3a08dc={'body':_0x5280b3[_0xba34('0x27')],'channel':_0xba34('0x28')};var _0x4c4950=[];var _0x5c2e37=[];var _0x413fdc={};return db[_0xba34('0x29')][_0xba34('0x2a')]()[_0xba34('0x12')](function(_0xb99900){if(!_0xb99900){throw new db['Sequelize'][(_0xba34('0x2b'))](_0xba34('0x2c'));}_0x4c4950=_[_0xba34('0x2d')](_['keys'](_0xb99900),['createdAt',_0xba34('0x2e')]);_0x5c2e37=_[_0xba34('0x2d')](_[_0xba34('0x2f')](_0xb99900),['createdAt',_0xba34('0x2e'),_0xba34('0x30'),_0xba34('0x31')]);if(_0x5280b3[_0xba34('0x27')]['id']){delete _0x5280b3['body']['id'];}if(_['isNil'](_0x5280b3[_0xba34('0x27')][_0xba34('0x32')])){throw new db['Sequelize'][(_0xba34('0x2b'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x5280b3[_0xba34('0x27')][_0xba34('0x27')])||_0x5280b3['body']['body']===''){throw new db['Sequelize'][(_0xba34('0x2b'))](_0xba34('0x33'));}if(_[_0xba34('0x34')](_0x5280b3['body'][_0xba34('0x35')])){throw new db[(_0xba34('0x36'))][(_0xba34('0x2b'))](_0xba34('0x37')+_0x5c2e37);}if(!_[_0xba34('0x38')](_0x5c2e37,_0x5280b3[_0xba34('0x27')][_0xba34('0x35')])){throw new db['Sequelize'][(_0xba34('0x2b'))](_0xba34('0x39')+_0x5c2e37);}_0x413fdc[_0x5280b3[_0xba34('0x27')][_0xba34('0x35')]]=_0x5280b3[_0xba34('0x27')][_0xba34('0x32')];})[_0xba34('0x12')](function(){return db['FaxAccount'][_0xba34('0x3a')]({'where':{'id':_0x5280b3[_0xba34('0x3b')]['id']},'include':[{'model':db['CmList'],'as':_0xba34('0x3c'),'include':[{'model':db['CmContact'],'as':_0xba34('0x3d'),'where':_0x413fdc,'limit':0x1,'order':[[_0xba34('0x2e'),_0xba34('0x3e')]]}]},{'model':db[_0xba34('0x3f')],'as':_0xba34('0x40')}]});})[_0xba34('0x12')](function(_0x2557cf){if(_0x2557cf&&_0x2557cf[_0xba34('0x3c')]){var _0x11f38e=_0x2557cf['get']({'plain':!![]});_0x3a08dc[_0xba34('0x3b')]=_0x11f38e;_0x3a08dc[_0xba34('0x41')]=_0x11f38e[_0xba34('0x40')];_0x3a08dc['list']=_0x11f38e[_0xba34('0x3c')];_0x3a08dc[_0xba34('0x41')]=_['orderBy'](_0x3a08dc[_0xba34('0x41')],[_0xba34('0x42')],[_0xba34('0x43')]);if(_0x3a08dc[_0xba34('0x3b')]['Applications']){delete _0x3a08dc[_0xba34('0x3b')][_0xba34('0x40')];}if(_0x3a08dc['account']['List']&&_0x3a08dc['account'][_0xba34('0x3c')][_0xba34('0x3d')][_0xba34('0x44')]){return _0x3a08dc[_0xba34('0x3b')][_0xba34('0x3c')][_0xba34('0x3d')][0x0];}var _0x5e1f71=_[_0xba34('0xc')](_0x5280b3[_0xba34('0x27')],{'firstName':_0x5280b3['body'][_0xba34('0x32')],'ListId':_0x11f38e[_0xba34('0x31')]});_0x5e1f71[_0x5280b3[_0xba34('0x27')][_0xba34('0x35')]]=_0x5280b3[_0xba34('0x27')][_0xba34('0x32')];return db[_0xba34('0x29')]['create'](_0x5e1f71,{'fields':_0x4c4950,'raw':!![]});}})[_0xba34('0x12')](function(_0x1a1ee7){_0x3a08dc[_0xba34('0x45')]=_0x1a1ee7;if(_0x1a1ee7){var _0x1a4fc={'ContactId':_0x1a1ee7['id'],'FaxAccountId':_0x5280b3[_0xba34('0x3b')]['id'],'fax':_0x1a1ee7[_0xba34('0x28')]};return db[_0xba34('0x46')][_0xba34('0x3a')]({'where':{'ContactId':_0x1a1ee7['id'],'closed':![],'FaxAccountId':_0x5280b3[_0xba34('0x3b')]['id']}})[_0xba34('0x12')](function(_0x12e9dc){if(_0x12e9dc){return[_0x12e9dc,![]];}return db['FaxInteraction'][_0xba34('0x47')](_0x1a4fc)[_0xba34('0x12')](function(_0xdfea0a){return[_0xdfea0a,!![]];});});}else{throw new Error(_0xba34('0x48'));}})['spread'](function(_0x19689d,_0x5869dc){var _0x4c7392=_0x19689d[_0xba34('0x49')]({'plain':!![]});if(_0x5869dc){if(_0x3a08dc['account'][_0xba34('0x4a')]){_0x3a08dc[_0xba34('0x41')]['push']({'id':0x0,'priority':_0x3a08dc[_0xba34('0x41')][_0xba34('0x44')]+0x1,'app':_0xba34('0x4b'),'appdata':_0xba34('0x4c'),'interval':_0xba34('0x4d')});}_0x4c7392[_0xba34('0x4e')]=!![];}else{_0x4c7392[_0xba34('0x4e')]=![];}_0x3a08dc['interaction']=_0x4c7392;return db[_0xba34('0x4f')][_0xba34('0x47')]({'body':_0x5280b3[_0xba34('0x27')][_0xba34('0x27')],'FaxAccountId':_0x5280b3[_0xba34('0x3b')]['id'],'FaxInteractionId':_0x19689d['id'],'direction':'in','ContactId':_0x19689d[_0xba34('0x50')],'AttachmentId':_0x5280b3['body'][_0xba34('0x51')]});})[_0xba34('0x12')](function(_0x4ec598){_0x3a08dc[_0xba34('0x1b')]=_0x4ec598;if(_0x3a08dc['interaction']['UserId']){return db[_0xba34('0x52')]['find']({'attributes':['id',_0xba34('0x53')],'where':{'id':_0x3a08dc[_0xba34('0x54')]['UserId']}})[_0xba34('0x12')](function(_0x507d43){if(_0x507d43){_0x3a08dc[_0xba34('0x41')][_0xba34('0x55')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x507d43['name']+','+(_0x3a08dc['account']['waitForTheAssignedAgent']||0xa),'interval':_0xba34('0x4d')});}return respondWithRpcPromise(_0xba34('0x56'),_0xba34('0x57'),_0x3a08dc);});}return respondWithRpcPromise(_0xba34('0x56'),_0xba34('0x57'),_0x3a08dc);})[_0xba34('0x12')](function(_0x2e1c92){_0x5171f6(_0x2e1c92);})['catch'](function(_0x592a48){_0x90e55b(_0x2654c6['error'](0x1f4,_0x592a48[_0xba34('0x1b')]));});});}; \ No newline at end of file +var _0xfb1c=['list','applications','orderBy','priority','asc','Contacts','length','contact','FaxInteraction','create','autoclose','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','request','then','info','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetFaxAccount','FaxAccount','findAll','options','raw','where','limit','include','map','model','attributes','stringify','catch','body','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','CmList','FaxApplication','List','get','Applications'];(function(_0x4ba9cb,_0x2c9563){var _0x4a0f37=function(_0x3a194c){while(--_0x3a194c){_0x4ba9cb['push'](_0x4ba9cb['shift']());}};_0x4a0f37(++_0x2c9563);}(_0xfb1c,0xd2));var _0xcfb1=function(_0x11141a,_0x669621){_0x11141a=_0x11141a-0x0;var _0x1c08c5=_0xfb1c[_0x11141a];return _0x1c08c5;};'use strict';var _=require(_0xcfb1('0x0'));var util=require(_0xcfb1('0x1'));var moment=require(_0xcfb1('0x2'));var BPromise=require(_0xcfb1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfb1('0x4'));var db=require(_0xcfb1('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xcfb1('0x6'))(_0xcfb1('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfb1('0x8'));var client=jayson['client'][_0xcfb1('0x9')]({'port':0x232c});config[_0xcfb1('0xa')]=_[_0xcfb1('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xcfb1('0xc'))(new Redis(config[_0xcfb1('0xa')]));require(_0xcfb1('0xd'))['register'](socket);function respondWithRpcPromise(_0x2e09b3,_0x2d1a8,_0x37ef5f){return new BPromise(function(_0x11788c,_0x5dc48f){return client[_0xcfb1('0xe')](_0x2e09b3,_0x37ef5f)[_0xcfb1('0xf')](function(_0xbdd0c8){logger[_0xcfb1('0x10')](_0xcfb1('0x11'),_0x2d1a8,'request\x20sent');logger[_0xcfb1('0x12')](_0xcfb1('0x13'),_0x2d1a8,_0xcfb1('0x14'),JSON['stringify'](_0xbdd0c8));if(_0xbdd0c8[_0xcfb1('0x15')]){if(_0xbdd0c8['error'][_0xcfb1('0x16')]===0x1f4){logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0xbdd0c8[_0xcfb1('0x15')][_0xcfb1('0x17')]);return _0x5dc48f(_0xbdd0c8['error'][_0xcfb1('0x17')]);}logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0xbdd0c8[_0xcfb1('0x15')]['message']);return _0x11788c(_0xbdd0c8[_0xcfb1('0x15')][_0xcfb1('0x17')]);}else{logger['info'](_0xcfb1('0x11'),_0x2d1a8,'request\x20sent');_0x11788c(_0xbdd0c8[_0xcfb1('0x18')]['message']);}})['catch'](function(_0x3f34e3){logger[_0xcfb1('0x15')](_0xcfb1('0x11'),_0x2d1a8,_0x3f34e3);_0x5dc48f(_0x3f34e3);});});}exports[_0xcfb1('0x19')]=function(_0x145215){var _0x5e3638=this;return new Promise(function(_0x1d71f2,_0x3e0152){return db[_0xcfb1('0x1a')][_0xcfb1('0x1b')]({'raw':_0x145215[_0xcfb1('0x1c')]?_0x145215[_0xcfb1('0x1c')][_0xcfb1('0x1d')]===undefined?!![]:![]:!![],'where':_0x145215['options']?_0x145215[_0xcfb1('0x1c')][_0xcfb1('0x1e')]||null:null,'attributes':_0x145215[_0xcfb1('0x1c')]?_0x145215['options']['attributes']||null:null,'limit':_0x145215[_0xcfb1('0x1c')]?_0x145215[_0xcfb1('0x1c')][_0xcfb1('0x1f')]||null:null,'include':_0x145215[_0xcfb1('0x1c')]?_0x145215['options'][_0xcfb1('0x20')]?_[_0xcfb1('0x21')](_0x145215[_0xcfb1('0x1c')][_0xcfb1('0x20')],function(_0x40e640){return{'model':db[_0x40e640[_0xcfb1('0x22')]],'as':_0x40e640['as'],'attributes':_0x40e640[_0xcfb1('0x23')],'include':_0x40e640[_0xcfb1('0x20')]?_['map'](_0x40e640[_0xcfb1('0x20')],function(_0x5ae2f3){return{'model':db[_0x5ae2f3[_0xcfb1('0x22')]],'as':_0x5ae2f3['as'],'attributes':_0x5ae2f3[_0xcfb1('0x23')],'include':_0x5ae2f3[_0xcfb1('0x20')]?_['map'](_0x5ae2f3[_0xcfb1('0x20')],function(_0x495a01){return{'model':db[_0x495a01[_0xcfb1('0x22')]],'as':_0x495a01['as'],'attributes':_0x495a01['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x18695c){logger[_0xcfb1('0x10')]('GetFaxAccount',_0x145215);logger['debug'](_0xcfb1('0x19'),_0x145215,JSON[_0xcfb1('0x24')](_0x18695c));_0x1d71f2(_0x18695c);})[_0xcfb1('0x25')](function(_0x16a335){logger[_0xcfb1('0x15')](_0xcfb1('0x19'),_0x16a335[_0xcfb1('0x17')],_0x145215);_0x3e0152(_0x5e3638[_0xcfb1('0x15')](0x1f4,_0x16a335[_0xcfb1('0x17')]));});});};exports['NotifyFaxAccount']=function(_0x1b16be,_0x1b90b5,_0x60ae6c){var _0x308108=this;return new Promise(function(_0x54b454,_0x53bac4){var _0x2b2c6e={'body':_0x1b16be[_0xcfb1('0x26')],'channel':_0xcfb1('0x27')};var _0x44d60a=[];var _0x17321d=[];var _0x363a3a={};return db[_0xcfb1('0x28')][_0xcfb1('0x29')]()[_0xcfb1('0xf')](function(_0x58639c){if(!_0x58639c){throw new db[(_0xcfb1('0x2a'))][(_0xcfb1('0x2b'))](_0xcfb1('0x2c'));}_0x44d60a=_[_0xcfb1('0x2d')](_[_0xcfb1('0x2e')](_0x58639c),[_0xcfb1('0x2f'),_0xcfb1('0x30')]);_0x17321d=_[_0xcfb1('0x2d')](_[_0xcfb1('0x2e')](_0x58639c),[_0xcfb1('0x2f'),_0xcfb1('0x30'),_0xcfb1('0x31'),_0xcfb1('0x32')]);if(_0x1b16be[_0xcfb1('0x26')]['id']){delete _0x1b16be[_0xcfb1('0x26')]['id'];}if(_['isNil'](_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x33')])){throw new db[(_0xcfb1('0x2a'))][(_0xcfb1('0x2b'))](_0xcfb1('0x34'));}if(_['isNil'](_0x1b16be['body'][_0xcfb1('0x26')])||_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x26')]===''){throw new db[(_0xcfb1('0x2a'))][(_0xcfb1('0x2b'))](_0xcfb1('0x35'));}if(_[_0xcfb1('0x36')](_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x37')])){throw new db[(_0xcfb1('0x2a'))][(_0xcfb1('0x2b'))](_0xcfb1('0x38')+_0x17321d);}if(!_[_0xcfb1('0x39')](_0x17321d,_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x37')])){throw new db[(_0xcfb1('0x2a'))]['ValidationError'](_0xcfb1('0x3a')+_0x17321d);}_0x363a3a[_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x37')]]=_0x1b16be['body'][_0xcfb1('0x33')];})[_0xcfb1('0xf')](function(){return db[_0xcfb1('0x1a')][_0xcfb1('0x3b')]({'where':{'id':_0x1b16be[_0xcfb1('0x3c')]['id']},'include':[{'model':db[_0xcfb1('0x3d')],'as':'List','include':[{'model':db[_0xcfb1('0x28')],'as':'Contacts','where':_0x363a3a,'limit':0x1,'order':[[_0xcfb1('0x30'),'DESC']]}]},{'model':db[_0xcfb1('0x3e')],'as':'Applications'}]});})['then'](function(_0x53128b){if(_0x53128b&&_0x53128b[_0xcfb1('0x3f')]){var _0x2d43fb=_0x53128b[_0xcfb1('0x40')]({'plain':!![]});_0x2b2c6e[_0xcfb1('0x3c')]=_0x2d43fb;_0x2b2c6e['applications']=_0x2d43fb[_0xcfb1('0x41')];_0x2b2c6e[_0xcfb1('0x42')]=_0x2d43fb[_0xcfb1('0x3f')];_0x2b2c6e[_0xcfb1('0x43')]=_[_0xcfb1('0x44')](_0x2b2c6e['applications'],[_0xcfb1('0x45')],[_0xcfb1('0x46')]);if(_0x2b2c6e['account']['Applications']){delete _0x2b2c6e['account'][_0xcfb1('0x41')];}if(_0x2b2c6e[_0xcfb1('0x3c')][_0xcfb1('0x3f')]&&_0x2b2c6e[_0xcfb1('0x3c')][_0xcfb1('0x3f')][_0xcfb1('0x47')][_0xcfb1('0x48')]){return _0x2b2c6e['account']['List']['Contacts'][0x0];}var _0x411c0f=_[_0xcfb1('0xb')](_0x1b16be[_0xcfb1('0x26')],{'firstName':_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x33')],'ListId':_0x2d43fb[_0xcfb1('0x32')]});_0x411c0f[_0x1b16be['body'][_0xcfb1('0x37')]]=_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x33')];return db[_0xcfb1('0x28')]['create'](_0x411c0f,{'fields':_0x44d60a,'raw':!![]});}})[_0xcfb1('0xf')](function(_0x244a3d){_0x2b2c6e[_0xcfb1('0x49')]=_0x244a3d;if(_0x244a3d){var _0x2ecb55={'ContactId':_0x244a3d['id'],'FaxAccountId':_0x1b16be['account']['id'],'fax':_0x244a3d[_0xcfb1('0x27')]};return db[_0xcfb1('0x4a')]['find']({'where':{'ContactId':_0x244a3d['id'],'closed':![],'FaxAccountId':_0x1b16be[_0xcfb1('0x3c')]['id']}})[_0xcfb1('0xf')](function(_0x2c5ee3){if(_0x2c5ee3){return[_0x2c5ee3,![]];}return db[_0xcfb1('0x4a')][_0xcfb1('0x4b')](_0x2ecb55)[_0xcfb1('0xf')](function(_0x22fc30){return[_0x22fc30,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x104781,_0x400345){var _0x3c1c92=_0x104781[_0xcfb1('0x40')]({'plain':!![]});if(_0x400345){if(_0x2b2c6e[_0xcfb1('0x3c')][_0xcfb1('0x4c')]){_0x2b2c6e[_0xcfb1('0x43')][_0xcfb1('0x4d')]({'id':0x0,'priority':_0x2b2c6e['applications']['length']+0x1,'app':_0xcfb1('0x4e'),'appdata':'unmanaged','interval':_0xcfb1('0x4f')});}_0x3c1c92[_0xcfb1('0x50')]=!![];}else{_0x3c1c92[_0xcfb1('0x50')]=![];}_0x2b2c6e[_0xcfb1('0x51')]=_0x3c1c92;return db['FaxMessage'][_0xcfb1('0x4b')]({'body':_0x1b16be[_0xcfb1('0x26')]['body'],'FaxAccountId':_0x1b16be[_0xcfb1('0x3c')]['id'],'FaxInteractionId':_0x104781['id'],'direction':'in','ContactId':_0x104781[_0xcfb1('0x52')],'AttachmentId':_0x1b16be[_0xcfb1('0x26')][_0xcfb1('0x53')]});})[_0xcfb1('0xf')](function(_0x2a229a){_0x2b2c6e[_0xcfb1('0x17')]=_0x2a229a;if(_0x2b2c6e[_0xcfb1('0x51')][_0xcfb1('0x54')]){return db[_0xcfb1('0x55')]['find']({'attributes':['id',_0xcfb1('0x56')],'where':{'id':_0x2b2c6e[_0xcfb1('0x51')][_0xcfb1('0x54')]}})['then'](function(_0x3d3725){if(_0x3d3725){_0x2b2c6e[_0xcfb1('0x43')][_0xcfb1('0x57')]({'id':0x0,'priority':0x0,'app':_0xcfb1('0x58'),'appdata':_0x3d3725[_0xcfb1('0x56')]+','+(_0x2b2c6e[_0xcfb1('0x3c')][_0xcfb1('0x59')]||0xa),'interval':_0xcfb1('0x4f')});}return respondWithRpcPromise(_0xcfb1('0x5a'),_0xcfb1('0x5b'),_0x2b2c6e);});}return respondWithRpcPromise('Start',_0xcfb1('0x5b'),_0x2b2c6e);})[_0xcfb1('0xf')](function(_0x3bfb0e){_0x54b454(_0x3bfb0e);})[_0xcfb1('0x25')](function(_0x5b844e){_0x53bac4(_0x308108[_0xcfb1('0x15')](0x1f4,_0x5b844e[_0xcfb1('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index bcfdddd..896da7d 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 _0xf2e3=['faxAccount:','./faxAccount.events','remove','update','emit','removeListener','length'];(function(_0xc3aae7,_0x3bfa91){var _0x1f365a=function(_0x465838){while(--_0x465838){_0xc3aae7['push'](_0xc3aae7['shift']());}};_0x1f365a(++_0x3bfa91);}(_0xf2e3,0x9b));var _0x3f2e=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xf2e3[_0x5f309e];return _0x487b5e;};'use strict';var FaxAccountEvents=require(_0x3f2e('0x0'));var events=['save',_0x3f2e('0x1'),_0x3f2e('0x2')];function createListener(_0x3fba4b,_0x30f1bb){return function(_0x27d28c){_0x30f1bb[_0x3f2e('0x3')](_0x3fba4b,_0x27d28c);};}function removeListener(_0x3938e2,_0xabcf5c){return function(){FaxAccountEvents[_0x3f2e('0x4')](_0x3938e2,_0xabcf5c);};}exports['register']=function(_0x33a3b7){for(var _0xdd6b3e=0x0,_0x3c0864=events[_0x3f2e('0x5')];_0xdd6b3e<_0x3c0864;_0xdd6b3e++){var _0x12c6e7=events[_0xdd6b3e];var _0x11067d=createListener(_0x3f2e('0x6')+_0x12c6e7,_0x33a3b7);FaxAccountEvents['on'](_0x12c6e7,_0x11067d);}}; \ No newline at end of file +var _0x1a37=['remove','update','emit','register','length','./faxAccount.events','save'];(function(_0xfa4cf6,_0x124e4e){var _0x1d5e45=function(_0xce067d){while(--_0xce067d){_0xfa4cf6['push'](_0xfa4cf6['shift']());}};_0x1d5e45(++_0x124e4e);}(_0x1a37,0xb4));var _0x71a3=function(_0x24061a,_0x1c9f4d){_0x24061a=_0x24061a-0x0;var _0x82054e=_0x1a37[_0x24061a];return _0x82054e;};'use strict';var FaxAccountEvents=require(_0x71a3('0x0'));var events=[_0x71a3('0x1'),_0x71a3('0x2'),_0x71a3('0x3')];function createListener(_0x353cf0,_0x20d8a7){return function(_0x348395){_0x20d8a7[_0x71a3('0x4')](_0x353cf0,_0x348395);};}function removeListener(_0x29c54f,_0x100181){return function(){FaxAccountEvents['removeListener'](_0x29c54f,_0x100181);};}exports[_0x71a3('0x5')]=function(_0x4f6b7a){for(var _0xd09f7=0x0,_0x45050a=events[_0x71a3('0x6')];_0xd09f7<_0x45050a;_0xd09f7++){var _0x2bb6a2=events[_0xd09f7];var _0x4a9ab2=createListener('faxAccount:'+_0x2bb6a2,_0x4f6b7a);FaxAccountEvents['on'](_0x2bb6a2,_0x4a9ab2);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 9a81edc..e846336 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 _0x4b31=['get','isAuthenticated','index','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/users','post','create','addDisposition','addAnswer','addInteraction','addApplications','/addaccountapplications','addAccountApplications','/updateaccountapplications','addAgents','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment'];(function(_0x1eda18,_0x2ec45d){var _0x4f6b41=function(_0x5f3cbe){while(--_0x5f3cbe){_0x1eda18['push'](_0x1eda18['shift']());}};_0x4f6b41(++_0x2ec45d);}(_0x4b31,0x12a));var _0x14b3=function(_0x1a3ce1,_0x40ed90){_0x1a3ce1=_0x1a3ce1-0x0;var _0x24aaae=_0x4b31[_0x1a3ce1];return _0x24aaae;};'use strict';var multer=require('multer');var util=require(_0x14b3('0x0'));var path=require('path');var timeout=require(_0x14b3('0x1'));var express=require(_0x14b3('0x2'));var router=express[_0x14b3('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x14b3('0x4'));var config=require(_0x14b3('0x5'));var controller=require('./faxAccount.controller');router[_0x14b3('0x6')]('/',auth[_0x14b3('0x7')](),controller[_0x14b3('0x8')]);router[_0x14b3('0x6')]('/describe',auth['isAuthenticated'](),controller[_0x14b3('0x9')]);router[_0x14b3('0x6')](_0x14b3('0xa'),auth['isAuthenticated'](),controller[_0x14b3('0xb')]);router[_0x14b3('0x6')](_0x14b3('0xc'),auth['isAuthenticated'](),controller[_0x14b3('0xd')]);router[_0x14b3('0x6')](_0x14b3('0xe'),auth[_0x14b3('0x7')](),controller[_0x14b3('0xf')]);router[_0x14b3('0x6')](_0x14b3('0x10'),auth['isAuthenticated'](),controller['getInteractions']);router[_0x14b3('0x6')](_0x14b3('0x11'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x12')]);router[_0x14b3('0x6')](_0x14b3('0x13'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x14')]);router[_0x14b3('0x6')](_0x14b3('0x15'),auth[_0x14b3('0x7')](),controller['getAgents']);router[_0x14b3('0x16')]('/',auth['isAuthenticated'](),controller[_0x14b3('0x17')]);router[_0x14b3('0x16')](_0x14b3('0xc'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x18')]);router[_0x14b3('0x16')](_0x14b3('0xe'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x19')]);router['post'](_0x14b3('0x10'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x1a')]);router[_0x14b3('0x16')]('/:id/applications',auth[_0x14b3('0x7')](),controller[_0x14b3('0x1b')]);router[_0x14b3('0x16')](_0x14b3('0x1c'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x1d')]);router['post'](_0x14b3('0x1e'),auth[_0x14b3('0x7')](),controller['updateAccountApplications']);router[_0x14b3('0x16')]('/:id/send',auth['isAuthenticated'](),controller['send']);router[_0x14b3('0x16')](_0x14b3('0x15'),auth['isAuthenticated'](),controller[_0x14b3('0x1f')]);router['put'](_0x14b3('0xa'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x20')]);router[_0x14b3('0x21')](_0x14b3('0xa'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x22')]);router[_0x14b3('0x21')](_0x14b3('0xc'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x23')]);router['delete'](_0x14b3('0xe'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x24')]);router[_0x14b3('0x21')](_0x14b3('0x15'),auth[_0x14b3('0x7')](),controller[_0x14b3('0x25')]);module['exports']=router; \ No newline at end of file +var _0x1535=['show','/:id/dispositions','/:id/canned_answers','getAnswers','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','create','post','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','updateAccountApplications','/:id/send','put','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','isAuthenticated','index','/describe','/:id'];(function(_0x292f16,_0x54de9f){var _0x50e784=function(_0x419560){while(--_0x419560){_0x292f16['push'](_0x292f16['shift']());}};_0x50e784(++_0x54de9f);}(_0x1535,0xbf));var _0x5153=function(_0x480589,_0x34cdaa){_0x480589=_0x480589-0x0;var _0x1f159f=_0x1535[_0x480589];return _0x1f159f;};'use strict';var multer=require(_0x5153('0x0'));var util=require(_0x5153('0x1'));var path=require('path');var timeout=require(_0x5153('0x2'));var express=require(_0x5153('0x3'));var router=express[_0x5153('0x4')]();var auth=require(_0x5153('0x5'));var interaction=require(_0x5153('0x6'));var config=require(_0x5153('0x7'));var controller=require(_0x5153('0x8'));router[_0x5153('0x9')]('/',auth[_0x5153('0xa')](),controller[_0x5153('0xb')]);router['get'](_0x5153('0xc'),auth[_0x5153('0xa')](),controller['describe']);router[_0x5153('0x9')](_0x5153('0xd'),auth['isAuthenticated'](),controller[_0x5153('0xe')]);router[_0x5153('0x9')](_0x5153('0xf'),auth[_0x5153('0xa')](),controller['getDispositions']);router[_0x5153('0x9')](_0x5153('0x10'),auth[_0x5153('0xa')](),controller[_0x5153('0x11')]);router[_0x5153('0x9')](_0x5153('0x12'),auth[_0x5153('0xa')](),controller[_0x5153('0x13')]);router[_0x5153('0x9')](_0x5153('0x14'),auth['isAuthenticated'](),controller['getApplications']);router[_0x5153('0x9')](_0x5153('0x15'),auth[_0x5153('0xa')](),controller[_0x5153('0x16')]);router[_0x5153('0x9')](_0x5153('0x17'),auth[_0x5153('0xa')](),controller[_0x5153('0x18')]);router['post']('/',auth[_0x5153('0xa')](),controller[_0x5153('0x19')]);router[_0x5153('0x1a')](_0x5153('0xf'),auth[_0x5153('0xa')](),controller['addDisposition']);router[_0x5153('0x1a')](_0x5153('0x10'),auth[_0x5153('0xa')](),controller[_0x5153('0x1b')]);router['post']('/:id/interactions',auth[_0x5153('0xa')](),controller[_0x5153('0x1c')]);router[_0x5153('0x1a')]('/:id/applications',auth[_0x5153('0xa')](),controller[_0x5153('0x1d')]);router['post']('/addaccountapplications',auth[_0x5153('0xa')](),controller[_0x5153('0x1e')]);router['post'](_0x5153('0x1f'),auth[_0x5153('0xa')](),controller[_0x5153('0x20')]);router['post'](_0x5153('0x21'),auth['isAuthenticated'](),controller['send']);router[_0x5153('0x1a')](_0x5153('0x17'),auth[_0x5153('0xa')](),controller['addAgents']);router[_0x5153('0x22')]('/:id',auth[_0x5153('0xa')](),controller[_0x5153('0x23')]);router['delete'](_0x5153('0xd'),auth[_0x5153('0xa')](),controller[_0x5153('0x24')]);router[_0x5153('0x25')](_0x5153('0xf'),auth[_0x5153('0xa')](),controller[_0x5153('0x26')]);router[_0x5153('0x25')](_0x5153('0x10'),auth[_0x5153('0xa')](),controller[_0x5153('0x27')]);router[_0x5153('0x25')](_0x5153('0x17'),auth[_0x5153('0xa')](),controller[_0x5153('0x28')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index e9f3e04..7677345 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 _0x186d=['TEXT','*,*,*,*','exports','INTEGER','STRING','noop'];(function(_0x2647d4,_0xbde0c2){var _0x365670=function(_0x2dc8f5){while(--_0x2dc8f5){_0x2647d4['push'](_0x2647d4['shift']());}};_0x365670(++_0xbde0c2);}(_0x186d,0x1ca));var _0xd186=function(_0x4df6f9,_0x44bd65){_0x4df6f9=_0x4df6f9-0x0;var _0x4b1a73=_0x186d[_0x4df6f9];return _0x4b1a73;};'use strict';var Sequelize=require('sequelize');module[_0xd186('0x0')]={'priority':{'type':Sequelize[_0xd186('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xd186('0x2')],'allowNull':![],'defaultValue':_0xd186('0x3')},'appdata':{'type':Sequelize[_0xd186('0x4')]()},'description':{'type':Sequelize[_0xd186('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xd186('0x5')}}; \ No newline at end of file +var _0xb4d9=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x1be861,_0x1eff71){var _0x364b4b=function(_0x327687){while(--_0x327687){_0x1be861['push'](_0x1be861['shift']());}};_0x364b4b(++_0x1eff71);}(_0xb4d9,0xce));var _0x9b4d=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0xb4d9[_0x45d3f0];return _0x314b79;};'use strict';var Sequelize=require(_0x9b4d('0x0'));module[_0x9b4d('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x9b4d('0x2')],'allowNull':![],'defaultValue':_0x9b4d('0x3')},'appdata':{'type':Sequelize[_0x9b4d('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x9b4d('0x2')],'defaultValue':_0x9b4d('0x5')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 37cf96d..7886a4e 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 _0xbdfd=['keys','create','body','find','params','html-pdf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','FaxApplication','findAll','catch','show'];(function(_0xcb51e0,_0x33b43f){var _0x177bfa=function(_0x3253de){while(--_0x3253de){_0xcb51e0['push'](_0xcb51e0['shift']());}};_0x177bfa(++_0x33b43f);}(_0xbdfd,0x135));var _0xdbdf=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xbdfd[_0x122ef9];return _0x42fba0;};'use strict';var pdf=require(_0xdbdf('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbdf('0x1'));var jsonpatch=require(_0xdbdf('0x2'));var rp=require(_0xdbdf('0x3'));var moment=require(_0xdbdf('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xdbdf('0x5'));var util=require(_0xdbdf('0x6'));var path=require('path');var sox=require(_0xdbdf('0x7'));var csv=require(_0xdbdf('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xdbdf('0x9'));var squel=require(_0xdbdf('0xa'));var crypto=require(_0xdbdf('0xb'));var jsforce=require(_0xdbdf('0xc'));var deskjs=require(_0xdbdf('0xd'));var toCsv=require('to-csv');var querystring=require(_0xdbdf('0xe'));var Papa=require(_0xdbdf('0xf'));var Redis=require(_0xdbdf('0x10'));var authService=require(_0xdbdf('0x11'));var qs=require(_0xdbdf('0x12'));var as=require(_0xdbdf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xdbdf('0x14'));var utils=require(_0xdbdf('0x15'));var config=require(_0xdbdf('0x16'));var db=require(_0xdbdf('0x17'))['db'];function respondWithStatusCode(_0x3dccaf,_0x244ecd){_0x244ecd=_0x244ecd||0xcc;return function(_0x51212c){if(_0x51212c){return _0x3dccaf[_0xdbdf('0x18')](_0x244ecd);}return _0x3dccaf[_0xdbdf('0x19')](_0x244ecd)[_0xdbdf('0x1a')]();};}function respondWithResult(_0xc1de13,_0x45b824){_0x45b824=_0x45b824||0xc8;return function(_0x24dfde){if(_0x24dfde){return _0xc1de13[_0xdbdf('0x19')](_0x45b824)['json'](_0x24dfde);}};}function respondWithFilteredResult(_0x3f38c8,_0x127060){return function(_0x98c104){if(_0x98c104){var _0x173a18=_0x98c104[_0xdbdf('0x1b')],_0x216c58=_0x127060[_0xdbdf('0x1c')],_0x50dbaa=_0x127060[_0xdbdf('0x1c')]+_0x127060[_0xdbdf('0x1d')],_0x219aa3;if(_0x50dbaa>=_0x173a18){_0x50dbaa=_0x173a18;_0x219aa3=0xc8;}else{_0x219aa3=0xce;}_0x3f38c8[_0xdbdf('0x19')](_0x219aa3);return _0x3f38c8[_0xdbdf('0x1e')](_0xdbdf('0x1f'),_0x216c58+'-'+_0x50dbaa+'/'+_0x173a18)[_0xdbdf('0x20')](_0x98c104);}return null;};}function patchUpdates(_0x3e70fd){return function(_0x419e9d){try{jsonpatch[_0xdbdf('0x21')](_0x419e9d,_0x3e70fd,!![]);}catch(_0x4fce88){return BPromise[_0xdbdf('0x22')](_0x4fce88);}return _0x419e9d[_0xdbdf('0x23')]();};}function saveUpdates(_0x3f522c,_0x2b6fe3){return function(_0x1670b3){if(_0x1670b3){return _0x1670b3[_0xdbdf('0x24')](_0x3f522c)[_0xdbdf('0x25')](function(_0x6f6585){return _0x6f6585;});}return null;};}function removeEntity(_0x4a93dd,_0x44d1d2){return function(_0x2737e5){if(_0x2737e5){return _0x2737e5[_0xdbdf('0x26')]()[_0xdbdf('0x25')](function(){_0x4a93dd['status'](0xcc)[_0xdbdf('0x1a')]();});}};}function handleEntityNotFound(_0x3f02b8,_0x237d86){return function(_0x563628){if(!_0x563628){_0x3f02b8[_0xdbdf('0x18')](0x194);}return _0x563628;};}function handleError(_0xf5c8a6,_0x45f868){_0x45f868=_0x45f868||0x1f4;return function(_0x16fc97){logger['error'](_0x16fc97[_0xdbdf('0x27')]);if(_0x16fc97[_0xdbdf('0x28')]){delete _0x16fc97[_0xdbdf('0x28')];}_0xf5c8a6[_0xdbdf('0x19')](_0x45f868)[_0xdbdf('0x29')](_0x16fc97);};}exports[_0xdbdf('0x2a')]=function(_0x2dac85,_0x3a7e6f){var _0x353fb1={},_0x3d0ad1={},_0x486fea={'count':0x0,'rows':[]};var _0x5c09e4=_[_0xdbdf('0x2b')](db['FaxApplication'][_0xdbdf('0x2c')],function(_0xfa1cd9){return{'name':_0xfa1cd9[_0xdbdf('0x2d')],'type':_0xfa1cd9[_0xdbdf('0x2e')][_0xdbdf('0x2f')]};});_0x3d0ad1[_0xdbdf('0x30')]=_[_0xdbdf('0x2b')](_0x5c09e4,_0xdbdf('0x28'));_0x3d0ad1[_0xdbdf('0x31')]=_['keys'](_0x2dac85[_0xdbdf('0x31')]);_0x3d0ad1[_0xdbdf('0x32')]=_['intersection'](_0x3d0ad1[_0xdbdf('0x30')],_0x3d0ad1[_0xdbdf('0x31')]);_0x353fb1[_0xdbdf('0x33')]=_[_0xdbdf('0x34')](_0x3d0ad1[_0xdbdf('0x30')],qs['fields'](_0x2dac85[_0xdbdf('0x31')][_0xdbdf('0x35')]));_0x353fb1['attributes']=_0x353fb1[_0xdbdf('0x33')][_0xdbdf('0x36')]?_0x353fb1[_0xdbdf('0x33')]:_0x3d0ad1[_0xdbdf('0x30')];if(!_0x2dac85[_0xdbdf('0x31')][_0xdbdf('0x37')](_0xdbdf('0x38'))){_0x353fb1['limit']=qs['limit'](_0x2dac85['query'][_0xdbdf('0x1d')]);_0x353fb1['offset']=qs[_0xdbdf('0x1c')](_0x2dac85['query']['offset']);}_0x353fb1[_0xdbdf('0x39')]=qs[_0xdbdf('0x3a')](_0x2dac85[_0xdbdf('0x31')][_0xdbdf('0x3a')]);_0x353fb1[_0xdbdf('0x3b')]=qs[_0xdbdf('0x32')](_[_0xdbdf('0x3c')](_0x2dac85['query'],_0x3d0ad1[_0xdbdf('0x32')]));if(_0x2dac85[_0xdbdf('0x31')][_0xdbdf('0x3d')]){_0x353fb1[_0xdbdf('0x3b')]=_[_0xdbdf('0x3e')](_0x353fb1[_0xdbdf('0x3b')],{'$or':_[_0xdbdf('0x2b')](_0x5c09e4,function(_0x1bb441){if(_0x1bb441['type']!==_0xdbdf('0x3f')){var _0x1f404c={};_0x1f404c[_0x1bb441['name']]={'$like':'%'+_0x2dac85[_0xdbdf('0x31')][_0xdbdf('0x3d')]+'%'};return _0x1f404c;}})});}_0x353fb1=_[_0xdbdf('0x3e')]({},_0x353fb1,_0x2dac85[_0xdbdf('0x40')]);var _0x555c2d={'where':_0x353fb1[_0xdbdf('0x3b')]};return db['FaxApplication'][_0xdbdf('0x1b')](_0x555c2d)['then'](function(_0x4ee97c){_0x486fea[_0xdbdf('0x1b')]=_0x4ee97c;if(_0x2dac85['query'][_0xdbdf('0x41')]){_0x353fb1[_0xdbdf('0x42')]=[{'all':!![]}];}return db[_0xdbdf('0x43')][_0xdbdf('0x44')](_0x353fb1);})[_0xdbdf('0x25')](function(_0x3c9ae1){_0x486fea['rows']=_0x3c9ae1;return _0x486fea;})['then'](respondWithFilteredResult(_0x3a7e6f,_0x353fb1))[_0xdbdf('0x45')](handleError(_0x3a7e6f,null));};exports[_0xdbdf('0x46')]=function(_0x1dd368,_0x2e2d4e){var _0x548374={'raw':!![],'where':{'id':_0x1dd368['params']['id']}},_0x32eb76={};_0x32eb76[_0xdbdf('0x30')]=_[_0xdbdf('0x47')](db[_0xdbdf('0x43')][_0xdbdf('0x2c')]);_0x32eb76[_0xdbdf('0x31')]=_['keys'](_0x1dd368[_0xdbdf('0x31')]);_0x32eb76[_0xdbdf('0x32')]=_['intersection'](_0x32eb76[_0xdbdf('0x30')],_0x32eb76['query']);_0x548374[_0xdbdf('0x33')]=_['intersection'](_0x32eb76[_0xdbdf('0x30')],qs['fields'](_0x1dd368[_0xdbdf('0x31')][_0xdbdf('0x35')]));_0x548374[_0xdbdf('0x33')]=_0x548374[_0xdbdf('0x33')][_0xdbdf('0x36')]?_0x548374[_0xdbdf('0x33')]:_0x32eb76[_0xdbdf('0x30')];if(_0x1dd368[_0xdbdf('0x31')][_0xdbdf('0x41')]){_0x548374[_0xdbdf('0x42')]=[{'all':!![]}];}_0x548374=_[_0xdbdf('0x3e')]({},_0x548374,_0x1dd368['options']);return db[_0xdbdf('0x43')]['find'](_0x548374)[_0xdbdf('0x25')](handleEntityNotFound(_0x2e2d4e,null))[_0xdbdf('0x25')](respondWithResult(_0x2e2d4e,null))[_0xdbdf('0x45')](handleError(_0x2e2d4e,null));};exports[_0xdbdf('0x48')]=function(_0x3b0fc3,_0x497db9){return db[_0xdbdf('0x43')][_0xdbdf('0x48')](_0x3b0fc3['body'],{})[_0xdbdf('0x25')](respondWithResult(_0x497db9,0xc9))['catch'](handleError(_0x497db9,null));};exports[_0xdbdf('0x24')]=function(_0x446ca5,_0x537247){if(_0x446ca5[_0xdbdf('0x49')]['id']){delete _0x446ca5[_0xdbdf('0x49')]['id'];}return db[_0xdbdf('0x43')][_0xdbdf('0x4a')]({'where':{'id':_0x446ca5[_0xdbdf('0x4b')]['id']}})[_0xdbdf('0x25')](handleEntityNotFound(_0x537247,null))[_0xdbdf('0x25')](saveUpdates(_0x446ca5[_0xdbdf('0x49')],null))[_0xdbdf('0x25')](respondWithResult(_0x537247,null))[_0xdbdf('0x45')](handleError(_0x537247,null));};exports['destroy']=function(_0x9db6e7,_0x40cbb4){return db[_0xdbdf('0x43')][_0xdbdf('0x4a')]({'where':{'id':_0x9db6e7[_0xdbdf('0x4b')]['id']}})[_0xdbdf('0x25')](handleEntityNotFound(_0x40cbb4,null))[_0xdbdf('0x25')](removeEntity(_0x40cbb4,null))[_0xdbdf('0x45')](handleError(_0x40cbb4,null));}; \ No newline at end of file +var _0xecd5=['../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','json','reject','save','update','destroy','error','stack','name','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','then','catch','show','params','options','create','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x5c0a4b,_0x1b5b4a){var _0x136dea=function(_0x3e6b6f){while(--_0x3e6b6f){_0x5c0a4b['push'](_0x5c0a4b['shift']());}};_0x136dea(++_0x1b5b4a);}(_0xecd5,0x110));var _0x5ecd=function(_0x135d61,_0x59431b){_0x135d61=_0x135d61-0x0;var _0x505976=_0xecd5[_0x135d61];return _0x505976;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x5ecd('0x0'));var rimraf=require(_0x5ecd('0x1'));var zipdir=require(_0x5ecd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5ecd('0x3'));var moment=require(_0x5ecd('0x4'));var BPromise=require(_0x5ecd('0x5'));var Mustache=require(_0x5ecd('0x6'));var util=require('util');var path=require(_0x5ecd('0x7'));var sox=require('sox');var csv=require(_0x5ecd('0x8'));var ejs=require(_0x5ecd('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5ecd('0xa'));var crypto=require(_0x5ecd('0xb'));var jsforce=require(_0x5ecd('0xc'));var deskjs=require(_0x5ecd('0xd'));var toCsv=require(_0x5ecd('0x8'));var querystring=require(_0x5ecd('0xe'));var Papa=require(_0x5ecd('0xf'));var Redis=require(_0x5ecd('0x10'));var authService=require(_0x5ecd('0x11'));var qs=require(_0x5ecd('0x12'));var as=require(_0x5ecd('0x13'));var hardwareService=require(_0x5ecd('0x14'));var logger=require('../../config/logger')(_0x5ecd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x5ecd('0x16'))['db'];function respondWithStatusCode(_0x15dec9,_0x4b7add){_0x4b7add=_0x4b7add||0xcc;return function(_0x4fc1ec){if(_0x4fc1ec){return _0x15dec9[_0x5ecd('0x17')](_0x4b7add);}return _0x15dec9[_0x5ecd('0x18')](_0x4b7add)[_0x5ecd('0x19')]();};}function respondWithResult(_0x37bfe1,_0x57bd97){_0x57bd97=_0x57bd97||0xc8;return function(_0x3b918c){if(_0x3b918c){return _0x37bfe1[_0x5ecd('0x18')](_0x57bd97)['json'](_0x3b918c);}};}function respondWithFilteredResult(_0x3619c8,_0xacc5c4){return function(_0x48442a){if(_0x48442a){var _0x458899=_0x48442a[_0x5ecd('0x1a')],_0x4a0e19=_0xacc5c4[_0x5ecd('0x1b')],_0x308374=_0xacc5c4[_0x5ecd('0x1b')]+_0xacc5c4[_0x5ecd('0x1c')],_0x36fb64;if(_0x308374>=_0x458899){_0x308374=_0x458899;_0x36fb64=0xc8;}else{_0x36fb64=0xce;}_0x3619c8[_0x5ecd('0x18')](_0x36fb64);return _0x3619c8[_0x5ecd('0x1d')](_0x5ecd('0x1e'),_0x4a0e19+'-'+_0x308374+'/'+_0x458899)[_0x5ecd('0x1f')](_0x48442a);}return null;};}function patchUpdates(_0x3a0db9){return function(_0x2c18f8){try{jsonpatch['apply'](_0x2c18f8,_0x3a0db9,!![]);}catch(_0x249988){return BPromise[_0x5ecd('0x20')](_0x249988);}return _0x2c18f8[_0x5ecd('0x21')]();};}function saveUpdates(_0x2c191b,_0xea18b7){return function(_0x5e7d1f){if(_0x5e7d1f){return _0x5e7d1f[_0x5ecd('0x22')](_0x2c191b)['then'](function(_0x450669){return _0x450669;});}return null;};}function removeEntity(_0x38ea0e,_0x38e74e){return function(_0x3c8e2b){if(_0x3c8e2b){return _0x3c8e2b[_0x5ecd('0x23')]()['then'](function(){_0x38ea0e[_0x5ecd('0x18')](0xcc)[_0x5ecd('0x19')]();});}};}function handleEntityNotFound(_0x1d9161,_0x57168b){return function(_0xe80905){if(!_0xe80905){_0x1d9161[_0x5ecd('0x17')](0x194);}return _0xe80905;};}function handleError(_0x257d4a,_0x29116a){_0x29116a=_0x29116a||0x1f4;return function(_0x29f8c0){logger[_0x5ecd('0x24')](_0x29f8c0[_0x5ecd('0x25')]);if(_0x29f8c0[_0x5ecd('0x26')]){delete _0x29f8c0['name'];}_0x257d4a[_0x5ecd('0x18')](_0x29116a)['send'](_0x29f8c0);};}exports[_0x5ecd('0x27')]=function(_0x36d964,_0x3d70da){var _0x27e422={},_0x1729c2={},_0x57a775={'count':0x0,'rows':[]};var _0x446324=_[_0x5ecd('0x28')](db[_0x5ecd('0x29')][_0x5ecd('0x2a')],function(_0x389b88){return{'name':_0x389b88[_0x5ecd('0x2b')],'type':_0x389b88[_0x5ecd('0x2c')][_0x5ecd('0x2d')]};});_0x1729c2[_0x5ecd('0x2e')]=_[_0x5ecd('0x28')](_0x446324,_0x5ecd('0x26'));_0x1729c2[_0x5ecd('0x2f')]=_[_0x5ecd('0x30')](_0x36d964[_0x5ecd('0x2f')]);_0x1729c2[_0x5ecd('0x31')]=_[_0x5ecd('0x32')](_0x1729c2[_0x5ecd('0x2e')],_0x1729c2['query']);_0x27e422[_0x5ecd('0x33')]=_[_0x5ecd('0x32')](_0x1729c2[_0x5ecd('0x2e')],qs[_0x5ecd('0x34')](_0x36d964[_0x5ecd('0x2f')]['fields']));_0x27e422[_0x5ecd('0x33')]=_0x27e422[_0x5ecd('0x33')][_0x5ecd('0x35')]?_0x27e422[_0x5ecd('0x33')]:_0x1729c2[_0x5ecd('0x2e')];if(!_0x36d964['query'][_0x5ecd('0x36')](_0x5ecd('0x37'))){_0x27e422[_0x5ecd('0x1c')]=qs['limit'](_0x36d964[_0x5ecd('0x2f')][_0x5ecd('0x1c')]);_0x27e422[_0x5ecd('0x1b')]=qs[_0x5ecd('0x1b')](_0x36d964[_0x5ecd('0x2f')][_0x5ecd('0x1b')]);}_0x27e422['order']=qs[_0x5ecd('0x38')](_0x36d964['query']['sort']);_0x27e422[_0x5ecd('0x39')]=qs[_0x5ecd('0x31')](_[_0x5ecd('0x3a')](_0x36d964[_0x5ecd('0x2f')],_0x1729c2[_0x5ecd('0x31')]));if(_0x36d964[_0x5ecd('0x2f')]['filter']){_0x27e422['where']=_[_0x5ecd('0x3b')](_0x27e422[_0x5ecd('0x39')],{'$or':_[_0x5ecd('0x28')](_0x446324,function(_0x3df69c){if(_0x3df69c[_0x5ecd('0x2c')]!==_0x5ecd('0x3c')){var _0x5fe996={};_0x5fe996[_0x3df69c['name']]={'$like':'%'+_0x36d964[_0x5ecd('0x2f')][_0x5ecd('0x3d')]+'%'};return _0x5fe996;}})});}_0x27e422=_[_0x5ecd('0x3b')]({},_0x27e422,_0x36d964['options']);var _0x27e45c={'where':_0x27e422[_0x5ecd('0x39')]};return db[_0x5ecd('0x29')]['count'](_0x27e45c)['then'](function(_0x5c553f){_0x57a775[_0x5ecd('0x1a')]=_0x5c553f;if(_0x36d964['query'][_0x5ecd('0x3e')]){_0x27e422[_0x5ecd('0x3f')]=[{'all':!![]}];}return db['FaxApplication'][_0x5ecd('0x40')](_0x27e422);})[_0x5ecd('0x41')](function(_0x1c6550){_0x57a775['rows']=_0x1c6550;return _0x57a775;})[_0x5ecd('0x41')](respondWithFilteredResult(_0x3d70da,_0x27e422))[_0x5ecd('0x42')](handleError(_0x3d70da,null));};exports[_0x5ecd('0x43')]=function(_0xd8837f,_0x9d895f){var _0x4bacdc={'raw':!![],'where':{'id':_0xd8837f[_0x5ecd('0x44')]['id']}},_0x129eed={};_0x129eed['model']=_['keys'](db[_0x5ecd('0x29')][_0x5ecd('0x2a')]);_0x129eed[_0x5ecd('0x2f')]=_['keys'](_0xd8837f[_0x5ecd('0x2f')]);_0x129eed['filters']=_[_0x5ecd('0x32')](_0x129eed['model'],_0x129eed['query']);_0x4bacdc['attributes']=_[_0x5ecd('0x32')](_0x129eed[_0x5ecd('0x2e')],qs[_0x5ecd('0x34')](_0xd8837f['query']['fields']));_0x4bacdc[_0x5ecd('0x33')]=_0x4bacdc['attributes'][_0x5ecd('0x35')]?_0x4bacdc[_0x5ecd('0x33')]:_0x129eed[_0x5ecd('0x2e')];if(_0xd8837f['query']['includeAll']){_0x4bacdc['include']=[{'all':!![]}];}_0x4bacdc=_['merge']({},_0x4bacdc,_0xd8837f[_0x5ecd('0x45')]);return db['FaxApplication']['find'](_0x4bacdc)[_0x5ecd('0x41')](handleEntityNotFound(_0x9d895f,null))[_0x5ecd('0x41')](respondWithResult(_0x9d895f,null))['catch'](handleError(_0x9d895f,null));};exports[_0x5ecd('0x46')]=function(_0x173947,_0x477b74){return db['FaxApplication'][_0x5ecd('0x46')](_0x173947[_0x5ecd('0x47')],{})[_0x5ecd('0x41')](respondWithResult(_0x477b74,0xc9))[_0x5ecd('0x42')](handleError(_0x477b74,null));};exports[_0x5ecd('0x22')]=function(_0x3e6504,_0x2cf571){if(_0x3e6504[_0x5ecd('0x47')]['id']){delete _0x3e6504[_0x5ecd('0x47')]['id'];}return db['FaxApplication'][_0x5ecd('0x48')]({'where':{'id':_0x3e6504[_0x5ecd('0x44')]['id']}})[_0x5ecd('0x41')](handleEntityNotFound(_0x2cf571,null))[_0x5ecd('0x41')](saveUpdates(_0x3e6504[_0x5ecd('0x47')],null))[_0x5ecd('0x41')](respondWithResult(_0x2cf571,null))[_0x5ecd('0x42')](handleError(_0x2cf571,null));};exports[_0x5ecd('0x23')]=function(_0x53de39,_0x1867f6){return db[_0x5ecd('0x29')]['find']({'where':{'id':_0x53de39[_0x5ecd('0x44')]['id']}})[_0x5ecd('0x41')](handleEntityNotFound(_0x1867f6,null))['then'](removeEntity(_0x1867f6,null))[_0x5ecd('0x42')](handleError(_0x1867f6,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index 702cce4..ef668ea 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 _0x89f9=['moment','bluebird','request-promise','path','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x562faa,_0x23adc7){var _0xc70f59=function(_0x2d7dec){while(--_0x2d7dec){_0x562faa['push'](_0x562faa['shift']());}};_0xc70f59(++_0x23adc7);}(_0x89f9,0x164));var _0x989f=function(_0x5d0fe9,_0x313c6d){_0x5d0fe9=_0x5d0fe9-0x0;var _0x578105=_0x89f9[_0x5d0fe9];return _0x578105;};'use strict';var _=require(_0x989f('0x0'));var util=require(_0x989f('0x1'));var logger=require(_0x989f('0x2'))(_0x989f('0x3'));var moment=require(_0x989f('0x4'));var BPromise=require(_0x989f('0x5'));var rp=require(_0x989f('0x6'));var fs=require('fs');var path=require(_0x989f('0x7'));var rimraf=require('rimraf');var config=require(_0x989f('0x8'));var attributes=require(_0x989f('0x9'));module['exports']=function(_0x3cdf66,_0x49fac5){return _0x3cdf66[_0x989f('0xa')](_0x989f('0xb'),attributes,{'tableName':_0x989f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x989f('0xd'),'collate':_0x989f('0xe')});}; \ No newline at end of file +var _0x0b80=['bluebird','request-promise','path','rimraf','../../config/environment','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0b80,0x1b8));var _0x00b8=function(_0x1c8897,_0x5a5a0d){_0x1c8897=_0x1c8897-0x0;var _0x23af63=_0x0b80[_0x1c8897];return _0x23af63;};'use strict';var _=require(_0x00b8('0x0'));var util=require(_0x00b8('0x1'));var logger=require(_0x00b8('0x2'))(_0x00b8('0x3'));var moment=require('moment');var BPromise=require(_0x00b8('0x4'));var rp=require(_0x00b8('0x5'));var fs=require('fs');var path=require(_0x00b8('0x6'));var rimraf=require(_0x00b8('0x7'));var config=require(_0x00b8('0x8'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x249058,_0x3cbdb0){return _0x249058['define'](_0x00b8('0x9'),attributes,{'tableName':_0x00b8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x00b8('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 3802a52..c67f131 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 _0x9901=['body','options','limit','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','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','update'];(function(_0x1a1c2,_0x1a4a70){var _0x433b22=function(_0x2961c6){while(--_0x2961c6){_0x1a1c2['push'](_0x1a1c2['shift']());}};_0x433b22(++_0x1a4a70);}(_0x9901,0x16f));var _0x1990=function(_0x216e72,_0x5cd161){_0x216e72=_0x216e72-0x0;var _0x2ff28d=_0x9901[_0x216e72];return _0x2ff28d;};'use strict';var _=require(_0x1990('0x0'));var util=require('util');var moment=require(_0x1990('0x1'));var BPromise=require('bluebird');var rs=require(_0x1990('0x2'));var fs=require('fs');var Redis=require(_0x1990('0x3'));var db=require(_0x1990('0x4'))['db'];var utils=require(_0x1990('0x5'));var logger=require(_0x1990('0x6'))(_0x1990('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1990('0x8')][_0x1990('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1a5856,_0x251b76,_0x3d93e1){return new BPromise(function(_0x11d324,_0x5b89f8){return client[_0x1990('0xa')](_0x1a5856,_0x3d93e1)[_0x1990('0xb')](function(_0x45b708){logger[_0x1990('0xc')](_0x1990('0xd'),_0x251b76,_0x1990('0xe'));logger[_0x1990('0xf')](_0x1990('0x10'),_0x251b76,_0x1990('0xe'),JSON[_0x1990('0x11')](_0x45b708));if(_0x45b708['error']){if(_0x45b708[_0x1990('0x12')][_0x1990('0x13')]===0x1f4){logger['error'](_0x1990('0xd'),_0x251b76,_0x45b708[_0x1990('0x12')]['message']);return _0x5b89f8(_0x45b708['error'][_0x1990('0x14')]);}logger[_0x1990('0x12')](_0x1990('0xd'),_0x251b76,_0x45b708[_0x1990('0x12')][_0x1990('0x14')]);return _0x11d324(_0x45b708[_0x1990('0x12')][_0x1990('0x14')]);}else{logger[_0x1990('0xc')]('FaxApplication,\x20%s,\x20%s',_0x251b76,'request\x20sent');_0x11d324(_0x45b708[_0x1990('0x15')][_0x1990('0x14')]);}})[_0x1990('0x16')](function(_0x37dfbb){logger['error'](_0x1990('0xd'),_0x251b76,_0x37dfbb);_0x5b89f8(_0x37dfbb);});});}exports[_0x1990('0x17')]=function(_0x31ce96){var _0x4ae6f0=this;return new Promise(function(_0x2cfcd9,_0x5e6568){return db['FaxApplication'][_0x1990('0x18')](_0x31ce96[_0x1990('0x19')],{'raw':_0x31ce96[_0x1990('0x1a')]?_0x31ce96[_0x1990('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x31ce96['options']?_0x31ce96[_0x1990('0x1a')]['where']||null:null,'attributes':_0x31ce96[_0x1990('0x1a')]?_0x31ce96['options']['attributes']||null:null,'limit':_0x31ce96[_0x1990('0x1a')]?_0x31ce96[_0x1990('0x1a')][_0x1990('0x1b')]||null:null})[_0x1990('0xb')](function(_0x1a7c48){logger[_0x1990('0xc')](_0x1990('0x17'),_0x31ce96);logger[_0x1990('0xf')](_0x1990('0x17'),_0x31ce96,JSON['stringify'](_0x1a7c48));_0x2cfcd9(_0x1a7c48);})[_0x1990('0x16')](function(_0x201d5a){logger[_0x1990('0x12')](_0x1990('0x17'),_0x201d5a[_0x1990('0x14')],_0x31ce96);_0x5e6568(_0x4ae6f0[_0x1990('0x12')](0x1f4,_0x201d5a[_0x1990('0x14')]));});});}; \ No newline at end of file +var _0x9502=['request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','FaxApplication,\x20%s,\x20%s','message','result','catch','FaxApplication','update','options','raw','where','attributes','UpdateFaxApplication','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x1111f3,_0x585ba8){var _0x5d30a7=function(_0x2202e4){while(--_0x2202e4){_0x1111f3['push'](_0x1111f3['shift']());}};_0x5d30a7(++_0x585ba8);}(_0x9502,0x1ec));var _0x2950=function(_0xbb146,_0x1b3260){_0xbb146=_0xbb146-0x0;var _0x5094d0=_0x9502[_0xbb146];return _0x5094d0;};'use strict';var _=require(_0x2950('0x0'));var util=require('util');var moment=require(_0x2950('0x1'));var BPromise=require(_0x2950('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2950('0x3'));var db=require(_0x2950('0x4'))['db'];var utils=require(_0x2950('0x5'));var logger=require('../../config/logger')(_0x2950('0x6'));var config=require(_0x2950('0x7'));var jayson=require(_0x2950('0x8'));var client=jayson[_0x2950('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x21bcb5,_0x272d31,_0x26b1e5){return new BPromise(function(_0x6f9e04,_0x16f68c){return client['request'](_0x21bcb5,_0x26b1e5)[_0x2950('0xa')](function(_0x1e88d3){logger[_0x2950('0xb')]('FaxApplication,\x20%s,\x20%s',_0x272d31,_0x2950('0xc'));logger[_0x2950('0xd')](_0x2950('0xe'),_0x272d31,_0x2950('0xc'),JSON[_0x2950('0xf')](_0x1e88d3));if(_0x1e88d3[_0x2950('0x10')]){if(_0x1e88d3[_0x2950('0x10')]['code']===0x1f4){logger[_0x2950('0x10')](_0x2950('0x11'),_0x272d31,_0x1e88d3[_0x2950('0x10')]['message']);return _0x16f68c(_0x1e88d3[_0x2950('0x10')][_0x2950('0x12')]);}logger[_0x2950('0x10')](_0x2950('0x11'),_0x272d31,_0x1e88d3[_0x2950('0x10')][_0x2950('0x12')]);return _0x6f9e04(_0x1e88d3[_0x2950('0x10')]['message']);}else{logger[_0x2950('0xb')]('FaxApplication,\x20%s,\x20%s',_0x272d31,'request\x20sent');_0x6f9e04(_0x1e88d3[_0x2950('0x13')]['message']);}})[_0x2950('0x14')](function(_0x23c6a2){logger['error'](_0x2950('0x11'),_0x272d31,_0x23c6a2);_0x16f68c(_0x23c6a2);});});}exports['UpdateFaxApplication']=function(_0x40814e){var _0x436a61=this;return new Promise(function(_0x3e3e59,_0x436aed){return db[_0x2950('0x15')][_0x2950('0x16')](_0x40814e['body'],{'raw':_0x40814e[_0x2950('0x17')]?_0x40814e[_0x2950('0x17')][_0x2950('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x40814e[_0x2950('0x17')]?_0x40814e[_0x2950('0x17')][_0x2950('0x19')]||null:null,'attributes':_0x40814e[_0x2950('0x17')]?_0x40814e[_0x2950('0x17')][_0x2950('0x1a')]||null:null,'limit':_0x40814e[_0x2950('0x17')]?_0x40814e['options']['limit']||null:null})['then'](function(_0x46b06c){logger['info'](_0x2950('0x1b'),_0x40814e);logger['debug'](_0x2950('0x1b'),_0x40814e,JSON[_0x2950('0xf')](_0x46b06c));_0x3e3e59(_0x46b06c);})[_0x2950('0x14')](function(_0x5b99f5){logger[_0x2950('0x10')](_0x2950('0x1b'),_0x5b99f5[_0x2950('0x12')],_0x40814e);_0x436aed(_0x436a61[_0x2950('0x10')](0x1f4,_0x5b99f5['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index b278da6..559578f 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 _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','destroy','exports'];(function(_0x22827f,_0x2e4092){var _0x4a69cc=function(_0x386192){while(--_0x386192){_0x22827f['push'](_0x22827f['shift']());}};_0x4a69cc(++_0x2e4092);}(_0x46ed,0x168));var _0xd46e=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x46ed[_0x2c7618];return _0x5ce3f0;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./faxApplication.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0xc')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router[_0xd46e('0xe')]('/:id',auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router['delete'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0x10')]);module[_0xd46e('0x11')]=router; \ No newline at end of file +var _0xeff8=['index','/:id','isAuthenticated','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./faxApplication.controller','get'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xeff8,0x186));var _0x8eff=function(_0x2555d0,_0x4150a6){_0x2555d0=_0x2555d0-0x0;var _0x3bb486=_0xeff8[_0x2555d0];return _0x3bb486;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x8eff('0x5'));var config=require(_0x8eff('0x6'));var controller=require(_0x8eff('0x7'));router[_0x8eff('0x8')]('/',auth['isAuthenticated'](),controller[_0x8eff('0x9')]);router[_0x8eff('0x8')](_0x8eff('0xa'),auth[_0x8eff('0xb')](),controller['show']);router[_0x8eff('0xc')]('/',auth[_0x8eff('0xb')](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x8eff('0xf')]);router[_0x8eff('0x10')](_0x8eff('0xa'),auth['isAuthenticated'](),controller[_0x8eff('0x11')]);module[_0x8eff('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 379dc75..b8f60b6 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 _0xf285=['DATE','STRING','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x23e5d0,_0x27e6d4){var _0x5eb412=function(_0x3a788f){while(--_0x3a788f){_0x23e5d0['push'](_0x23e5d0['shift']());}};_0x5eb412(++_0x27e6d4);}(_0xf285,0x10e));var _0x5f28=function(_0x4e52f4,_0xb6f8a8){_0x4e52f4=_0x4e52f4-0x0;var _0x2ef869=_0xf285[_0x4e52f4];return _0x2ef869;};'use strict';var Sequelize=require(_0x5f28('0x0'));module[_0x5f28('0x1')]={'closed':{'type':Sequelize[_0x5f28('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x5f28('0x3')]},'disposition':{'type':Sequelize[_0x5f28('0x4')]},'note':{'type':Sequelize[_0x5f28('0x4')]},'read1stAt':{'type':Sequelize[_0x5f28('0x3')]},'fax':{'type':Sequelize[_0x5f28('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x5f28('0x5')]('in',_0x5f28('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5f28('0x5')]('in',_0x5f28('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xec1f=['STRING','out','ENUM','sequelize','exports','BOOLEAN'];(function(_0x46486e,_0x5e912f){var _0x1444df=function(_0x391755){while(--_0x391755){_0x46486e['push'](_0x46486e['shift']());}};_0x1444df(++_0x5e912f);}(_0xec1f,0x87));var _0xfec1=function(_0x3578df,_0x379018){_0x3578df=_0x3578df-0x0;var _0x5ab4ba=_0xec1f[_0x3578df];return _0x5ab4ba;};'use strict';var Sequelize=require(_0xfec1('0x0'));module[_0xfec1('0x1')]={'closed':{'type':Sequelize[_0xfec1('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xfec1('0x3')]},'note':{'type':Sequelize[_0xfec1('0x3')]},'read1stAt':{'type':Sequelize['DATE']},'fax':{'type':Sequelize[_0xfec1('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0xfec1('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xfec1('0x5')]('in',_0xfec1('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.controller.js b/server/api/faxInteraction/faxInteraction.controller.js index c4db096..c5cb91c 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 _0x8fd6=['UserId','body','start','compact','isEmpty','where','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','isNumeric','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','FaxAccountId','journey','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','toString','sequelize','merge','a.key','Account.key','a.mandatoryDisposition','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.fax','o.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','groupBy','rows','show','params','includeAll','create','update','describe','addMessage','ids','omit','findOne','FaxInteractionId','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','FaxMessage','include','findAll','spread','emit','removeTags','download','join','root','server','attachments','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','end','stack','name','send','Users','map','fullname','TagIds','Tags','split','push','catch','index','FaxInteraction','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','field','color','from','tools_tags','select','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','u.id\x20=\x20ui.UserId','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','type','text','Tag','forEach','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?'];(function(_0x432075,_0x308bed){var _0x575582=function(_0x1337e7){while(--_0x1337e7){_0x432075['push'](_0x432075['shift']());}};_0x575582(++_0x308bed);}(_0x8fd6,0x67));var _0x68fd=function(_0x35cf3d,_0x5b755c){_0x35cf3d=_0x35cf3d-0x0;var _0x507252=_0x8fd6[_0x35cf3d];return _0x507252;};'use strict';var pdf=require(_0x68fd('0x0'));var emlformat=require(_0x68fd('0x1'));var rimraf=require(_0x68fd('0x2'));var zipdir=require(_0x68fd('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68fd('0x4'));var moment=require('moment');var BPromise=require(_0x68fd('0x5'));var Mustache=require(_0x68fd('0x6'));var util=require('util');var path=require('path');var sox=require(_0x68fd('0x7'));var csv=require(_0x68fd('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x68fd('0x9'));var squel=require(_0x68fd('0xa'));var crypto=require('crypto');var jsforce=require(_0x68fd('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x68fd('0x8'));var querystring=require(_0x68fd('0xc'));var Papa=require(_0x68fd('0xd'));var Redis=require(_0x68fd('0xe'));var authService=require(_0x68fd('0xf'));var qs=require(_0x68fd('0x10'));var as=require(_0x68fd('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x68fd('0x12'))(_0x68fd('0x13'));var utils=require(_0x68fd('0x14'));var config=require(_0x68fd('0x15'));var db=require(_0x68fd('0x16'))['db'];config['redis']=_['defaults'](config[_0x68fd('0x17')],{'host':_0x68fd('0x18'),'port':0x18eb});var socket=require(_0x68fd('0x19'))(new Redis(config[_0x68fd('0x17')]));require('./faxInteraction.socket')[_0x68fd('0x1a')](socket);function respondWithStatusCode(_0x22bb60,_0x3f6ecc){_0x3f6ecc=_0x3f6ecc||0xcc;return function(_0xd7be1c){if(_0xd7be1c){return _0x22bb60[_0x68fd('0x1b')](_0x3f6ecc);}return _0x22bb60[_0x68fd('0x1c')](_0x3f6ecc)['end']();};}function respondWithResult(_0x508628,_0x29e322){_0x29e322=_0x29e322||0xc8;return function(_0x3ef8fe){if(_0x3ef8fe){return _0x508628['status'](_0x29e322)[_0x68fd('0x1d')](_0x3ef8fe);}};}function respondWithFilteredResult(_0xacd7ae,_0x460904){return function(_0x37fa27){if(_0x37fa27){var _0x218f85=_0x37fa27[_0x68fd('0x1e')],_0x4c2aef=_0x460904[_0x68fd('0x1f')],_0x590be5=_0x460904[_0x68fd('0x1f')]+_0x460904[_0x68fd('0x20')],_0x50eb50;if(_0x590be5>=_0x218f85){_0x590be5=_0x218f85;_0x50eb50=0xc8;}else{_0x50eb50=0xce;}_0xacd7ae[_0x68fd('0x1c')](_0x50eb50);return _0xacd7ae[_0x68fd('0x21')](_0x68fd('0x22'),_0x4c2aef+'-'+_0x590be5+'/'+_0x218f85)[_0x68fd('0x1d')](_0x37fa27);}return null;};}function patchUpdates(_0x104e6a){return function(_0x50789a){try{jsonpatch[_0x68fd('0x23')](_0x50789a,_0x104e6a,!![]);}catch(_0x2c2f89){return BPromise['reject'](_0x2c2f89);}return _0x50789a[_0x68fd('0x24')]();};}function saveUpdates(_0x21427b,_0x1b8d13){return function(_0x3cc70f){if(_0x3cc70f){return _0x3cc70f['update'](_0x21427b)[_0x68fd('0x25')](function(_0xb155a3){return _0xb155a3;});}return null;};}function removeEntity(_0x5f37d6,_0x5df6bd){return function(_0x52a729){if(_0x52a729){return _0x52a729[_0x68fd('0x26')]()[_0x68fd('0x25')](function(){_0x5f37d6[_0x68fd('0x1c')](0xcc)[_0x68fd('0x27')]();});}};}function handleEntityNotFound(_0x350804,_0x2a17b4){return function(_0x6be347){if(!_0x6be347){_0x350804['sendStatus'](0x194);}return _0x6be347;};}function handleError(_0x101477,_0x51991e){_0x51991e=_0x51991e||0x1f4;return function(_0x43cd1){logger['error'](_0x43cd1[_0x68fd('0x28')]);if(_0x43cd1[_0x68fd('0x29')]){delete _0x43cd1[_0x68fd('0x29')];}_0x101477[_0x68fd('0x1c')](_0x51991e)[_0x68fd('0x2a')](_0x43cd1);};}function getInteractionUsers(_0x168b3d,_0x5268a0){return new BPromise(function(_0xd892cd,_0x199672){try{if(_0x5268a0[_0x168b3d['id']]){_0x168b3d[_0x68fd('0x2b')]=_[_0x68fd('0x2c')](_0x5268a0[_0x168b3d['id']],function(_0x28e2e8){return{'id':_0x28e2e8['id'],'fullname':_0x28e2e8[_0x68fd('0x2d')]};});}}catch(_0x4ebb3a){_0x199672(_0x4ebb3a);}_0xd892cd(_0x168b3d);});}function getInteractionTags(_0x31ff07,_0x3f503c){return new BPromise(function(_0x580b47,_0x27e02e){try{if(_0x31ff07[_0x68fd('0x2e')]){_0x31ff07[_0x68fd('0x2f')]=[];_0x31ff07[_0x68fd('0x2e')][_0x68fd('0x30')](',')['forEach'](function(_0x1a47fc){_0x31ff07[_0x68fd('0x2f')][_0x68fd('0x31')](_0x3f503c[_0x1a47fc]);});}delete _0x31ff07[_0x68fd('0x2e')];}catch(_0xd69e87){_0x27e02e(_0xd69e87);}_0x580b47(_0x31ff07);});}function updateFaxInteraction(_0x555938,_0x3efc4e,_0x1ce193){return new BPromise(function(_0x3583b0,_0x11a141){return getInteractionUsers(_0x555938,_0x1ce193)['then'](function(_0x53da0b){return getInteractionTags(_0x53da0b,_0x3efc4e);})['then'](function(_0x7b0730){_0x3583b0(_0x7b0730);})[_0x68fd('0x32')](function(_0x3ea7ad){_0x11a141(_0x3ea7ad);});});}exports[_0x68fd('0x33')]=function(_0x5d43ea,_0x1a8712){var _0x5e23ae={},_0x36dddd={},_0x559cd5={'count':0x0,'rows':[]};var _0x5d0696=_[_0x68fd('0x2c')](db[_0x68fd('0x34')][_0x68fd('0x35')],function(_0x1861b8){return{'name':_0x1861b8[_0x68fd('0x36')],'type':_0x1861b8['type'][_0x68fd('0x37')]};});_0x36dddd[_0x68fd('0x38')]=_[_0x68fd('0x2c')](_0x5d0696,_0x68fd('0x29'));_0x36dddd[_0x68fd('0x39')]=_[_0x68fd('0x3a')](_0x5d43ea[_0x68fd('0x39')]);_0x36dddd[_0x68fd('0x3b')]=_[_0x68fd('0x3c')](_0x36dddd[_0x68fd('0x38')],_0x36dddd[_0x68fd('0x39')]);_0x5e23ae[_0x68fd('0x3d')]=_[_0x68fd('0x3c')](_0x36dddd[_0x68fd('0x38')],qs[_0x68fd('0x3e')](_0x5d43ea['query'][_0x68fd('0x3e')]));_0x5e23ae[_0x68fd('0x3d')]=_0x5e23ae[_0x68fd('0x3d')][_0x68fd('0x3f')]?_0x5e23ae[_0x68fd('0x3d')]:_0x36dddd[_0x68fd('0x38')];if(!_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x40')](_0x68fd('0x41'))){_0x5e23ae[_0x68fd('0x20')]=qs['limit'](_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x20')]);_0x5e23ae['offset']=qs['offset'](_0x5d43ea[_0x68fd('0x39')]['offset']);}_0x5e23ae[_0x68fd('0x42')]=qs[_0x68fd('0x43')](_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x43')]);_0x5e23ae['where']=qs[_0x68fd('0x3b')](_[_0x68fd('0x44')](_0x5d43ea[_0x68fd('0x39')],_0x36dddd[_0x68fd('0x3b')]));var _0x2c24d8=[];var _0x533b35=squel['select']()[_0x68fd('0x45')]('id')['field']('name')['field'](_0x68fd('0x46'))[_0x68fd('0x47')](_0x68fd('0x48'));var _0x234e17=squel[_0x68fd('0x49')]()['field']('u.id')[_0x68fd('0x45')](_0x68fd('0x4a'))['field'](_0x68fd('0x4b'))[_0x68fd('0x47')](_0x68fd('0x4c'),'ui')[_0x68fd('0x4d')](_0x68fd('0x4e'),'u',_0x68fd('0x4f'));var _0x2be3de=squel['select']()[_0x68fd('0x47')](_0x68fd('0x50'),'i')[_0x68fd('0x4d')]('cm_contacts','c',_0x68fd('0x51'))[_0x68fd('0x4d')](_0x68fd('0x4e'),'o',_0x68fd('0x52'))[_0x68fd('0x4d')]('fax_accounts','a',_0x68fd('0x53'))[_0x68fd('0x4d')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x68fd('0x4d')](_0x68fd('0x54'),'it',_0x68fd('0x55'))[_0x68fd('0x4d')](_0x68fd('0x48'),'t',_0x68fd('0x56'));var _0x5d2ad2=squel[_0x68fd('0x57')]();var _0x45c155=[];var _0x48866f=squel[_0x68fd('0x57')]();var _0x36f834;if(_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x58')]){_0x36f834=as['parseSearch'](_0x5d43ea['query'][_0x68fd('0x58')]);var _0x444761=_0x36f834[_0x68fd('0x59')];for(var _0x551099=0x0;_0x551099<_0x36f834['conditions'][_0x68fd('0x3f')];_0x551099++){var _0x5cd400=_0x36f834[_0x68fd('0x5a')][_0x551099];var _0x5b3147='i';var _0x631478=_[_0x68fd('0x5b')](_0x5d0696,[_0x68fd('0x29'),_0x5cd400['field']]);if(!_0x631478){switch(_0x5cd400[_0x68fd('0x45')]){case _0x68fd('0x5c'):if(_0x5cd400[_0x68fd('0x5d')]==0x1){_0x2be3de[_0x68fd('0x5e')]('`'+_0x5cd400[_0x68fd('0x45')]+_0x68fd('0x5f'));}else{_0x2be3de[_0x68fd('0x5e')]('`'+_0x5cd400[_0x68fd('0x45')]+'`\x20>\x200');}break;case _0x68fd('0x60'):if(_0x5cd400[_0x68fd('0x61')]===_0x68fd('0x62')){if(_0x5cd400[_0x68fd('0x5d')][_0x68fd('0x30')]('\x20')['length']>0x1){_0x5d2ad2[_0x444761](_0x68fd('0x63'),qs[_0x68fd('0x64')](_0x5cd400[_0x68fd('0x5d')]),null);}else{var _0x58c944='%'+_0x5cd400['value']+'%';_0x5d2ad2[_0x444761]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x58c944,_0x58c944,_0x58c944);}}else{_0x631478=_[_0x68fd('0x5b')](_0x5d0696,[_0x68fd('0x29'),'ContactId']);_0x5cd400[_0x68fd('0x45')]=_0x68fd('0x65');_0x553884=as[_0x68fd('0x66')](_0x5b3147,_0x631478[_0x68fd('0x67')],_0x5cd400);_0x5d2ad2[_0x444761](_0x553884[_0x68fd('0x68')],_0x553884['value']['start'],_0x553884['value'][_0x68fd('0x27')]);}break;case _0x68fd('0x69'):var _0x89aca=_0x5cd400[_0x68fd('0x5d')][_0x68fd('0x30')](',')[_0x68fd('0x2c')](function(_0x2197fd){return Number(_0x2197fd);});_0x89aca[_0x68fd('0x6a')](function(_0x472a32){_0x48866f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x472a32+',%');});_0x45c155=_[_0x68fd('0x6b')](_0x45c155,_0x89aca);break;case _0x68fd('0x6c'):if(_0x5cd400[_0x68fd('0x61')]===_0x68fd('0x62')){_0x5d2ad2[_0x444761](_0x68fd('0x6d'),'%'+_0x5cd400[_0x68fd('0x5d')]+'%',null);}else{_0x631478=_['find'](_0x5d0696,[_0x68fd('0x29'),'UserId']);_0x5cd400[_0x68fd('0x45')]=_0x68fd('0x6e');_0x553884=as['buildExpression'](_0x5b3147,_0x631478[_0x68fd('0x67')],_0x5cd400);_0x5d2ad2[_0x444761](_0x553884[_0x68fd('0x68')],_0x553884[_0x68fd('0x5d')]['start'],_0x553884[_0x68fd('0x5d')][_0x68fd('0x27')]);}break;case _0x68fd('0x6f'):_0x553884=as['buildExpression']('me',null,_0x5cd400);_0x5d2ad2[_0x444761](_0x553884['text'],_0x553884[_0x68fd('0x5d')][_0x68fd('0x70')],_0x553884['value'][_0x68fd('0x27')]);break;}}else{var _0x553884=as[_0x68fd('0x66')](_0x5b3147,_0x631478[_0x68fd('0x67')],_0x5cd400);_0x5d2ad2[_0x444761](_0x553884['text'],_0x553884['value'][_0x68fd('0x70')],_0x553884['value'][_0x68fd('0x27')]);}}}else{var _0x180942=_(_0x5d43ea[_0x68fd('0x39')])[_0x68fd('0x3a')]()['map'](function(_0x5dcbaf){return _['some'](_0x5d0696,['name',_0x5dcbaf])?_0x5dcbaf:undefined;})[_0x68fd('0x71')]()['value']();if(!_[_0x68fd('0x72')](_0x180942)){_0x180942[_0x68fd('0x6a')](function(_0x32fa29){if(_0x32fa29==='FaxAccountId'){_0x2be3de[_0x68fd('0x73')]('i.FaxAccountId\x20IN\x20?',[][_0x68fd('0x74')](_0x5d43ea[_0x68fd('0x39')][_0x32fa29]));}else if(_0x32fa29===_0x68fd('0x75')){var _0x5353fc=JSON[_0x68fd('0x76')](_0x5d43ea[_0x68fd('0x39')][_0x32fa29])['$gte'];var _0xb87fe3=JSON[_0x68fd('0x76')](_0x5d43ea[_0x68fd('0x39')][_0x32fa29])[_0x68fd('0x77')];_0x2be3de[_0x68fd('0x73')](_0x68fd('0x78'),_0x5353fc,_0xb87fe3);}else{if(_0x5d43ea['query'][_0x32fa29]===_0x68fd('0x79')){_0x2be3de[_0x68fd('0x73')]('i.'+_0x32fa29+_0x68fd('0x7a'));}else{_0x2be3de[_0x68fd('0x73')]('i.'+_0x32fa29+_0x68fd('0x7b'),_0x5d43ea['query'][_0x32fa29]);}}});}if(_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x7c')]){if(_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x7c')]==0x1){_0x2be3de['having'](_0x68fd('0x7d'));}else{_0x2be3de[_0x68fd('0x5e')](_0x68fd('0x7e'));}}if(_0x5d43ea['query']['tag']){_0x45c155=_[_0x68fd('0x7f')](_0x5d43ea[_0x68fd('0x39')]['tag'])?_0x5d43ea['query'][_0x68fd('0x80')]:new Array(_0x5d43ea[_0x68fd('0x39')]['tag']);_0x45c155[_0x68fd('0x6a')](function(_0x36c19e){_0x48866f['or'](_0x68fd('0x81'),'%,'+_0x36c19e+',%');});}if(_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x82')]){var _0x143637=_0x5d43ea['query']['filter'][_0x68fd('0x83')]('\x5c','\x5c\x5c')[_0x68fd('0x83')]('\x27\x27',_0x68fd('0x84'));if(qs[_0x68fd('0x85')](_0x143637)){_0x5d2ad2['or']('i.id\x20LIKE\x20?',_0x143637+'%')['or'](_0x68fd('0x86'),_0x143637+'%');}_0x5d2ad2['or'](_0x68fd('0x87'),_0x143637+'%');}}_0x2be3de[_0x68fd('0x73')](_0x5d2ad2);_0x2be3de[_0x68fd('0x88')]('i.id');var _0x9f28c3={'type':db[_0x68fd('0x89')][_0x68fd('0x8a')][_0x68fd('0x8b')],'raw':!![]};var _0x234da1=_0x2be3de[_0x68fd('0x8c')]();_0x234da1[_0x68fd('0x45')](_0x68fd('0x8d'));_0x234da1['field'](_0x68fd('0x8e'),_0x68fd('0x5c'));if(_0x5e23ae[_0x68fd('0x42')]){_0x5e23ae['order']['forEach'](function(_0x4ace23){_0x2be3de[_0x68fd('0x42')]('i.'+_0x4ace23[0x0],_0x4ace23[0x1]===_0x68fd('0x8f')?![]:!![]);});}if(!_[_0x68fd('0x72')](_0x45c155)){_0x2be3de['having'](_0x48866f);_0x234da1['where'](_0x68fd('0x90'),_0x45c155);}BPromise[_0x68fd('0x91')]()[_0x68fd('0x25')](function(){if(!_0x36f834){if(_0x5d43ea[_0x68fd('0x39')][_0x68fd('0x92')]||_0x5d43ea['query'][_0x68fd('0x93')])return;_0x234da1[_0x68fd('0x73')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x2be3de[_0x68fd('0x73')](_0x68fd('0x94'));return;}return _0x5d43ea[_0x68fd('0x95')][_0x68fd('0x96')]({'attributes':['id'],'raw':!![]})[_0x68fd('0x25')](function(_0x2316d3){if(_['isEmpty'](_0x2316d3)){_0x234da1[_0x68fd('0x73')]('i.FaxAccountId\x20IS\x20NULL');_0x2be3de[_0x68fd('0x73')](_0x68fd('0x97'));}else{_0x234da1[_0x68fd('0x73')](_0x68fd('0x98'),_[_0x68fd('0x2c')](_0x2316d3,'id'));_0x2be3de['where']('i.FaxAccountId\x20IN\x20?',_['map'](_0x2316d3,'id'));}});})[_0x68fd('0x25')](function(){db['sequelize'][_0x68fd('0x39')](_0x234da1[_0x68fd('0x99')](),_0x9f28c3)['then'](function(_0x3e4056){_0x559cd5[_0x68fd('0x1e')]=_0x3e4056[_0x68fd('0x3f')];if(_0x559cd5[_0x68fd('0x1e')]===0x0)return[];return db[_0x68fd('0x9a')]['query'](_0x533b35[_0x68fd('0x99')](),_0x9f28c3)[_0x68fd('0x25')](function(_0x130b64){_0x2c24d8=_['keyBy'](_0x130b64,'id');_0x9f28c3=_[_0x68fd('0x9b')](_0x9f28c3,{'model':db[_0x68fd('0x34')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5d43ea[_0x68fd('0x39')]['fields']){_0x5e23ae[_0x68fd('0x3d')][_0x68fd('0x6a')](function(_0x49e0c5){_0x2be3de[_0x68fd('0x45')]('i.'+_0x49e0c5);});}else{_0x2be3de['field'](_0x68fd('0x8e'),_0x68fd('0x5c'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0x9c'),_0x68fd('0x9d'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0x9e'),'Account.mandatoryDisposition');_0x2be3de[_0x68fd('0x45')](_0x68fd('0x9f'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0xa0'),_0x68fd('0xa1'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0xa2'),_0x68fd('0xa3'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0xa4'),_0x68fd('0xa5'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0xa6'),_0x68fd('0xa7'));_0x2be3de[_0x68fd('0x45')]('c.mobile','Contact.mobile');_0x2be3de[_0x68fd('0x45')]('c.fax',_0x68fd('0xa8'));_0x2be3de[_0x68fd('0x45')](_0x68fd('0xa9'),'Owner.fullname');_0x2be3de[_0x68fd('0x45')](_0x68fd('0xaa'),_0x68fd('0xab'));_0x2be3de['field'](_0x68fd('0xac'),_0x68fd('0x2e'));}_0x2be3de[_0x68fd('0x20')](_0x5e23ae[_0x68fd('0x20')]);_0x2be3de[_0x68fd('0x1f')](_0x5e23ae['offset']);return db[_0x68fd('0x9a')][_0x68fd('0x39')](_0x2be3de[_0x68fd('0x99')](),_0x9f28c3);})['then'](function(_0x5674be){_0x234e17['where'](_0x68fd('0xad'),_['map'](_0x5674be,'id'));return db['sequelize'][_0x68fd('0x39')](_0x234e17[_0x68fd('0x99')](),_0x9f28c3)['then'](function(_0x412f92){var _0x3e5c7f=_[_0x68fd('0xae')](_0x412f92,'FaxInteractionId');var _0x42efda=[];_0x5674be['forEach'](function(_0x49f42a){_0x42efda[_0x68fd('0x31')](updateFaxInteraction(_0x49f42a,_0x2c24d8,_0x3e5c7f));});return BPromise['all'](_0x42efda);});});})[_0x68fd('0x25')](function(_0x5910af){_0x559cd5[_0x68fd('0xaf')]=_0x5910af;return _0x559cd5;})[_0x68fd('0x25')](respondWithFilteredResult(_0x1a8712,_0x5e23ae));})['catch'](handleError(_0x1a8712,null));};exports[_0x68fd('0xb0')]=function(_0x373efe,_0x12826b){var _0x17f101={'raw':![],'where':{'id':_0x373efe[_0x68fd('0xb1')]['id']}},_0x17b4a8={};_0x17b4a8[_0x68fd('0x38')]=_[_0x68fd('0x3a')](db[_0x68fd('0x34')][_0x68fd('0x35')]);_0x17b4a8[_0x68fd('0x39')]=_[_0x68fd('0x3a')](_0x373efe[_0x68fd('0x39')]);_0x17b4a8[_0x68fd('0x3b')]=_[_0x68fd('0x3c')](_0x17b4a8[_0x68fd('0x38')],_0x17b4a8['query']);_0x17f101[_0x68fd('0x3d')]=_[_0x68fd('0x3c')](_0x17b4a8['model'],qs[_0x68fd('0x3e')](_0x373efe[_0x68fd('0x39')][_0x68fd('0x3e')]));_0x17f101['attributes']=_0x17f101['attributes'][_0x68fd('0x3f')]?_0x17f101[_0x68fd('0x3d')]:_0x17b4a8[_0x68fd('0x38')];if(_0x373efe[_0x68fd('0x39')][_0x68fd('0xb2')]){_0x17f101['include']=[{'all':!![]}];}_0x17f101=_[_0x68fd('0x9b')]({},_0x17f101,_0x373efe['options']);return db[_0x68fd('0x34')][_0x68fd('0x5b')](_0x17f101)[_0x68fd('0x25')](handleEntityNotFound(_0x12826b,null))['then'](respondWithResult(_0x12826b,null))[_0x68fd('0x32')](handleError(_0x12826b,null));};exports[_0x68fd('0xb3')]=function(_0x2e65b6,_0x450e22){return db[_0x68fd('0x34')][_0x68fd('0xb3')](_0x2e65b6[_0x68fd('0x6f')],{})[_0x68fd('0x25')](respondWithResult(_0x450e22,0xc9))[_0x68fd('0x32')](handleError(_0x450e22,null));};exports[_0x68fd('0xb4')]=function(_0x51d7ab,_0x2c86f1){if(_0x51d7ab['body']['id']){delete _0x51d7ab[_0x68fd('0x6f')]['id'];}return db[_0x68fd('0x34')][_0x68fd('0x5b')]({'where':{'id':_0x51d7ab[_0x68fd('0xb1')]['id']}})[_0x68fd('0x25')](handleEntityNotFound(_0x2c86f1,null))['then'](saveUpdates(_0x51d7ab['body'],null))[_0x68fd('0x25')](respondWithResult(_0x2c86f1,null))[_0x68fd('0x32')](handleError(_0x2c86f1,null));};exports['destroy']=function(_0x4a68ed,_0x1d1cbb){return db['FaxInteraction'][_0x68fd('0x5b')]({'where':{'id':_0x4a68ed[_0x68fd('0xb1')]['id']}})[_0x68fd('0x25')](handleEntityNotFound(_0x1d1cbb,null))[_0x68fd('0x25')](removeEntity(_0x1d1cbb,null))[_0x68fd('0x32')](handleError(_0x1d1cbb,null));};exports[_0x68fd('0xb5')]=function(_0x1cba51,_0x16ac07){return db['FaxInteraction'][_0x68fd('0xb5')]()[_0x68fd('0x25')](respondWithResult(_0x16ac07,null))['catch'](handleError(_0x16ac07,null));};exports[_0x68fd('0xb6')]=function(_0x4ff86e,_0x38fe4c,_0x4d001a){return db['FaxMessage'][_0x68fd('0x5b')]({'where':{'id':_0x4ff86e[_0x68fd('0xb1')]['id']}})['then'](handleEntityNotFound(_0x38fe4c,null))['then'](function(_0x2ba8bd){if(_0x2ba8bd){return _0x2ba8bd['addMessage'](_0x4ff86e['body'][_0x68fd('0xb7')],_[_0x68fd('0xb8')](_0x4ff86e[_0x68fd('0x6f')],[_0x68fd('0xb7'),'id'])||{});}})[_0x68fd('0x25')](respondWithResult(_0x38fe4c,null))['catch'](handleError(_0x38fe4c,null));};exports['getMessages']=function(_0xadbfef,_0xadc2e2,_0x40527a){var _0xb9b01={'raw':![],'where':{}};var _0x17bdd8={};var _0x1004f9={'count':0x0,'rows':[]};return db[_0x68fd('0x34')][_0x68fd('0xb9')]({'where':{'id':_0xadbfef[_0x68fd('0xb1')]['id']}})[_0x68fd('0x25')](handleEntityNotFound(_0xadc2e2,null))[_0x68fd('0x25')](function(_0xb5f58c){if(_0xb5f58c){_0x17bdd8['model']=_[_0x68fd('0x3a')](db['FaxMessage'][_0x68fd('0x35')]);_0x17bdd8['query']=_['keys'](_0xadbfef[_0x68fd('0x39')]);_0x17bdd8[_0x68fd('0x3b')]=_[_0x68fd('0x3c')](_0x17bdd8[_0x68fd('0x38')],_0x17bdd8['query']);_0xb9b01[_0x68fd('0x3d')]=_[_0x68fd('0x3c')](_0x17bdd8[_0x68fd('0x38')],qs[_0x68fd('0x3e')](_0xadbfef[_0x68fd('0x39')][_0x68fd('0x3e')]));_0xb9b01[_0x68fd('0x3d')]=_0xb9b01['attributes'][_0x68fd('0x3f')]?_0xb9b01['attributes']:_0x17bdd8[_0x68fd('0x38')];if(!_0xadbfef[_0x68fd('0x39')]['hasOwnProperty'](_0x68fd('0x41'))){_0xb9b01['limit']=qs[_0x68fd('0x20')](_0xadbfef[_0x68fd('0x39')][_0x68fd('0x20')]);_0xb9b01[_0x68fd('0x1f')]=qs[_0x68fd('0x1f')](_0xadbfef['query'][_0x68fd('0x1f')]);}_0xb9b01[_0x68fd('0x42')]=qs[_0x68fd('0x43')](_0xadbfef[_0x68fd('0x39')]['sort']);_0xb9b01[_0x68fd('0x73')]=qs[_0x68fd('0x3b')](_[_0x68fd('0x44')](_0xadbfef[_0x68fd('0x39')],_0x17bdd8[_0x68fd('0x3b')]));_0xb9b01[_0x68fd('0x73')][_0x68fd('0xba')]=_0xb5f58c['id'];if(_0xadbfef['query'][_0x68fd('0x82')]){_0xb9b01[_0x68fd('0x73')]=_[_0x68fd('0x9b')](_0xb9b01[_0x68fd('0x73')],{'$or':_[_0x68fd('0x2c')](_0xb9b01['attributes'],function(_0x3698fe){var _0xa77eeb={};_0xa77eeb[_0x3698fe]={'$like':'%'+_0xadbfef[_0x68fd('0x39')][_0x68fd('0x82')]+'%'};return _0xa77eeb;})});}if(_0xadbfef[_0x68fd('0x39')][_0x68fd('0xbb')]){var _0x22b197=_0xadbfef['query'][_0x68fd('0xbb')][_0x68fd('0x30')](',');var _0x246bca={};_0x246bca[_0x22b197[0x0]]={'$gte':moment(_0x22b197[0x1])[_0x68fd('0xbc')](_0x68fd('0xbd'))};_0xb9b01[_0x68fd('0x73')]=_[_0x68fd('0x9b')](_0xb9b01[_0x68fd('0x73')],_0x246bca);}_0xb9b01=_[_0x68fd('0x9b')]({},_0xb9b01,_0xadbfef[_0x68fd('0xbe')]);return db[_0x68fd('0xbf')][_0x68fd('0x1e')]({'where':_0xb9b01['where']})[_0x68fd('0x25')](function(_0x1ea0a6){_0x1004f9['count']=_0x1ea0a6;if(_0xadbfef['query'][_0x68fd('0xb2')]){_0xb9b01[_0x68fd('0xc0')]=[{'all':!![]}];}return db[_0x68fd('0xbf')][_0x68fd('0xc1')](_0xb9b01);})[_0x68fd('0x25')](function(_0x1e7ac7){_0x1004f9[_0x68fd('0xaf')]=_0x1e7ac7;return _0x1004f9;});}})[_0x68fd('0x25')](respondWithFilteredResult(_0xadc2e2,_0xb9b01))[_0x68fd('0x32')](handleError(_0xadc2e2,null));};exports['addTags']=function(_0x375fab,_0x126f42,_0xaa72b){return db[_0x68fd('0x34')][_0x68fd('0x5b')]({'where':{'id':_0x375fab[_0x68fd('0xb1')]['id']}})[_0x68fd('0x25')](handleEntityNotFound(_0x126f42,null))['then'](function(_0x535ff9){if(_0x535ff9){return _0x535ff9['setTags'](_0x375fab['body'][_0x68fd('0xb7')],_[_0x68fd('0xb8')](_0x375fab['body'],['ids','id'])||{})[_0x68fd('0xc2')](function(){return db['Tag'][_0x68fd('0xc1')]({'attributes':['id','name',_0x68fd('0x46')],'where':{'id':_0x375fab[_0x68fd('0x6f')][_0x68fd('0xb7')]}});})['then'](function(_0x3cdb7b){socket[_0x68fd('0xc3')]('faxInteractionTags:save',{'id':Number(_0x375fab[_0x68fd('0xb1')]['id']),'tags':_0x3cdb7b||[]});return{'id':Number(_0x375fab[_0x68fd('0xb1')]['id']),'tags':_0x3cdb7b||[]};});}})[_0x68fd('0x25')](respondWithResult(_0x126f42,null))[_0x68fd('0x32')](handleError(_0x126f42,null));};exports[_0x68fd('0xc4')]=function(_0x581d13,_0x4c57ee,_0x53794a){return db[_0x68fd('0x34')][_0x68fd('0x5b')]({'where':{'id':_0x581d13[_0x68fd('0xb1')]['id']}})[_0x68fd('0x25')](handleEntityNotFound(_0x4c57ee,null))[_0x68fd('0x25')](function(_0x1c5a5d){if(_0x1c5a5d){return _0x1c5a5d[_0x68fd('0xc4')](_0x581d13[_0x68fd('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x4c57ee,null))[_0x68fd('0x32')](handleError(_0x4c57ee,null));};exports[_0x68fd('0xc5')]=function(_0x334f3e,_0x30c457){var _0x829506=moment()['unix']()['toString']();var _0x2de0e2=path[_0x68fd('0xc6')](config[_0x68fd('0xc7')],'server','files','tmp');var _0x2f99ee=path[_0x68fd('0xc6')](config[_0x68fd('0xc7')],_0x68fd('0xc8'),'files',_0x68fd('0xc9'));var _0x4a6a85=path['join'](_0x2de0e2,_0x829506);var _0x3cfb7e=util[_0x68fd('0xbc')]('transcript-%d-%s.zip',_0x334f3e[_0x68fd('0xb1')]['id'],_0x829506);var _0x1f8786=path[_0x68fd('0xc6')](_0x2de0e2,_0x3cfb7e);var _0x5d7439=[];_0x5d7439['push']({'model':db[_0x68fd('0xca')],'as':_0x68fd('0xca'),'raw':!![]});var _0x1f0a26=[{'model':db['FaxMessage'],'as':'Messages','attributes':['id','body',_0x68fd('0x75')],'include':_0x5d7439}];return db[_0x68fd('0x34')]['find']({'where':{'id':_0x334f3e[_0x68fd('0xb1')]['id']},'include':_0x1f0a26})[_0x68fd('0x25')](handleEntityNotFound(_0x30c457,null))[_0x68fd('0x25')](function(_0xd83bd7){if(_0xd83bd7&&_0xd83bd7[_0x68fd('0xcb')]){var _0xf0a762=_0xd83bd7[_0x68fd('0xcc')]({'plain':!![]});fs[_0x68fd('0xcd')](_0x4a6a85);for(var _0x429dbc=0x0;_0x429dbc<_0xf0a762['Messages']['length'];_0x429dbc++){var _0x31990f=_0xf0a762[_0x68fd('0xcb')][_0x429dbc][_0x68fd('0xca')];if(_0x31990f){var _0x38179d=path[_0x68fd('0xc6')](_0x2f99ee,_0x31990f[_0x68fd('0xce')]);if(fs[_0x68fd('0xcf')](_0x38179d)){fs[_0x68fd('0xd0')](_0x38179d)[_0x68fd('0xd1')](fs[_0x68fd('0xd2')](path[_0x68fd('0xc6')](_0x4a6a85,_0x31990f[_0x68fd('0xce')])));}}}return BPromise[_0x68fd('0x91')]()[_0x68fd('0x25')](function(){return new BPromise(function(_0x561b62,_0x5adbc1){zipdir(_0x4a6a85,{'saveTo':_0x1f8786},function(_0x432db2,_0x3adb1b){if(_0x432db2)return _0x5adbc1(_0x432db2);return _0x561b62(_0x3adb1b);});})[_0x68fd('0x25')](function(){return new BPromise(function(_0x51fd73,_0x4f0cb4){rimraf(_0x4a6a85,function(_0x31b74d){if(_0x31b74d)_0x4f0cb4(_0x31b74d);return _0x51fd73();});});})[_0x68fd('0x25')](function(){return _0x30c457[_0x68fd('0xc5')](_0x1f8786,_0x3cfb7e,function(_0x22d1f3){if(_0x22d1f3){console[_0x68fd('0xd3')](_0x68fd('0xd4'),_0x22d1f3);}else{fs['unlinkSync'](_0x1f8786);}});});});}else{return _0x30c457['sendStatus'](0xc8);}})[_0x68fd('0x32')](handleError(_0x30c457,null));}; \ No newline at end of file +var _0xe0a1=['Content-Range','reject','save','update','destroy','then','error','name','send','Users','map','fullname','TagIds','Tags','split','forEach','push','index','FaxInteraction','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','select','field','from','u.id','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','fax_accounts','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','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','buildExpression','some','FaxAccountId','where','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','\x20=\x20?','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.id\x20LIKE\x20?','i.fax\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','i.id','DESC','isEmpty','t.id\x20IN\x20?','resolve','journey','getFaxAccounts','i.FaxAccountId\x20IS\x20NULL','sequelize','toString','keyBy','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.FaxInteractionId\x20IN\x20?','FaxInteractionId','rows','catch','show','params','rawAttributes','includeAll','include','merge','create','describe','addMessage','FaxMessage','ids','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','omit','spread','color','emit','faxInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','count','offset','set'];(function(_0x3f132a,_0x359822){var _0x224a39=function(_0x5c44df){while(--_0x5c44df){_0x3f132a['push'](_0x3f132a['shift']());}};_0x224a39(++_0x359822);}(_0xe0a1,0xb3));var _0x1e0a=function(_0x3bfffa,_0x46123d){_0x3bfffa=_0x3bfffa-0x0;var _0x28e970=_0xe0a1[_0x3bfffa];return _0x28e970;};'use strict';var pdf=require(_0x1e0a('0x0'));var emlformat=require(_0x1e0a('0x1'));var rimraf=require(_0x1e0a('0x2'));var zipdir=require(_0x1e0a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1e0a('0x4'));var moment=require(_0x1e0a('0x5'));var BPromise=require(_0x1e0a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x1e0a('0x7'));var csv=require(_0x1e0a('0x8'));var ejs=require(_0x1e0a('0x9'));var fs=require('fs');var _=require(_0x1e0a('0xa'));var squel=require('squel');var crypto=require(_0x1e0a('0xb'));var jsforce=require(_0x1e0a('0xc'));var deskjs=require(_0x1e0a('0xd'));var toCsv=require(_0x1e0a('0x8'));var querystring=require(_0x1e0a('0xe'));var Papa=require(_0x1e0a('0xf'));var Redis=require(_0x1e0a('0x10'));var authService=require(_0x1e0a('0x11'));var qs=require(_0x1e0a('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1e0a('0x13'));var logger=require(_0x1e0a('0x14'))(_0x1e0a('0x15'));var utils=require(_0x1e0a('0x16'));var config=require('../../config/environment');var db=require(_0x1e0a('0x17'))['db'];config[_0x1e0a('0x18')]=_[_0x1e0a('0x19')](config['redis'],{'host':_0x1e0a('0x1a'),'port':0x18eb});var socket=require(_0x1e0a('0x1b'))(new Redis(config['redis']));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x57e6d4,_0x21da19){_0x21da19=_0x21da19||0xcc;return function(_0x2ed1b6){if(_0x2ed1b6){return _0x57e6d4[_0x1e0a('0x1c')](_0x21da19);}return _0x57e6d4[_0x1e0a('0x1d')](_0x21da19)[_0x1e0a('0x1e')]();};}function respondWithResult(_0x33ec96,_0x14eac4){_0x14eac4=_0x14eac4||0xc8;return function(_0x30d2db){if(_0x30d2db){return _0x33ec96[_0x1e0a('0x1d')](_0x14eac4)[_0x1e0a('0x1f')](_0x30d2db);}};}function respondWithFilteredResult(_0x516d3e,_0x1f0f81){return function(_0x22e622){if(_0x22e622){var _0x41d6dc=_0x22e622[_0x1e0a('0x20')],_0x34808b=_0x1f0f81[_0x1e0a('0x21')],_0x3ffd7b=_0x1f0f81[_0x1e0a('0x21')]+_0x1f0f81['limit'],_0x1ad4c9;if(_0x3ffd7b>=_0x41d6dc){_0x3ffd7b=_0x41d6dc;_0x1ad4c9=0xc8;}else{_0x1ad4c9=0xce;}_0x516d3e[_0x1e0a('0x1d')](_0x1ad4c9);return _0x516d3e[_0x1e0a('0x22')](_0x1e0a('0x23'),_0x34808b+'-'+_0x3ffd7b+'/'+_0x41d6dc)[_0x1e0a('0x1f')](_0x22e622);}return null;};}function patchUpdates(_0x581386){return function(_0x127fff){try{jsonpatch['apply'](_0x127fff,_0x581386,!![]);}catch(_0x1c2d17){return BPromise[_0x1e0a('0x24')](_0x1c2d17);}return _0x127fff[_0x1e0a('0x25')]();};}function saveUpdates(_0x25ab6e,_0x55c295){return function(_0x277af0){if(_0x277af0){return _0x277af0[_0x1e0a('0x26')](_0x25ab6e)['then'](function(_0x387601){return _0x387601;});}return null;};}function removeEntity(_0x32d40e,_0x2d85ad){return function(_0x5c2906){if(_0x5c2906){return _0x5c2906[_0x1e0a('0x27')]()[_0x1e0a('0x28')](function(){_0x32d40e['status'](0xcc)[_0x1e0a('0x1e')]();});}};}function handleEntityNotFound(_0x4377b8,_0xb08979){return function(_0x4a4d90){if(!_0x4a4d90){_0x4377b8['sendStatus'](0x194);}return _0x4a4d90;};}function handleError(_0xee8422,_0xd3e1d3){_0xd3e1d3=_0xd3e1d3||0x1f4;return function(_0x46412c){logger[_0x1e0a('0x29')](_0x46412c['stack']);if(_0x46412c[_0x1e0a('0x2a')]){delete _0x46412c[_0x1e0a('0x2a')];}_0xee8422[_0x1e0a('0x1d')](_0xd3e1d3)[_0x1e0a('0x2b')](_0x46412c);};}function getInteractionUsers(_0x4acbc4,_0x22ffcf){return new BPromise(function(_0x3a413a,_0x367c46){try{if(_0x22ffcf[_0x4acbc4['id']]){_0x4acbc4[_0x1e0a('0x2c')]=_[_0x1e0a('0x2d')](_0x22ffcf[_0x4acbc4['id']],function(_0x4cb7b7){return{'id':_0x4cb7b7['id'],'fullname':_0x4cb7b7[_0x1e0a('0x2e')]};});}}catch(_0x36f1a9){_0x367c46(_0x36f1a9);}_0x3a413a(_0x4acbc4);});}function getInteractionTags(_0x4d739f,_0x4fdda3){return new BPromise(function(_0x1b9d4c,_0x503a70){try{if(_0x4d739f[_0x1e0a('0x2f')]){_0x4d739f[_0x1e0a('0x30')]=[];_0x4d739f[_0x1e0a('0x2f')][_0x1e0a('0x31')](',')[_0x1e0a('0x32')](function(_0x290b4d){_0x4d739f['Tags'][_0x1e0a('0x33')](_0x4fdda3[_0x290b4d]);});}delete _0x4d739f['TagIds'];}catch(_0x15446d){_0x503a70(_0x15446d);}_0x1b9d4c(_0x4d739f);});}function updateFaxInteraction(_0x2d684d,_0x3a166a,_0x801947){return new BPromise(function(_0x393935,_0x145a43){return getInteractionUsers(_0x2d684d,_0x801947)[_0x1e0a('0x28')](function(_0x2caf97){return getInteractionTags(_0x2caf97,_0x3a166a);})[_0x1e0a('0x28')](function(_0x2cecd1){_0x393935(_0x2cecd1);})['catch'](function(_0x16b02f){_0x145a43(_0x16b02f);});});}exports[_0x1e0a('0x34')]=function(_0x57368c,_0x4acb03){var _0x3639c0={},_0x5aa78f={},_0x14c497={'count':0x0,'rows':[]};var _0x285e0e=_[_0x1e0a('0x2d')](db[_0x1e0a('0x35')]['rawAttributes'],function(_0x525197){return{'name':_0x525197[_0x1e0a('0x36')],'type':_0x525197[_0x1e0a('0x37')][_0x1e0a('0x38')]};});_0x5aa78f[_0x1e0a('0x39')]=_[_0x1e0a('0x2d')](_0x285e0e,_0x1e0a('0x2a'));_0x5aa78f[_0x1e0a('0x3a')]=_[_0x1e0a('0x3b')](_0x57368c[_0x1e0a('0x3a')]);_0x5aa78f[_0x1e0a('0x3c')]=_[_0x1e0a('0x3d')](_0x5aa78f['model'],_0x5aa78f[_0x1e0a('0x3a')]);_0x3639c0[_0x1e0a('0x3e')]=_[_0x1e0a('0x3d')](_0x5aa78f[_0x1e0a('0x39')],qs[_0x1e0a('0x3f')](_0x57368c['query'][_0x1e0a('0x3f')]));_0x3639c0[_0x1e0a('0x3e')]=_0x3639c0[_0x1e0a('0x3e')][_0x1e0a('0x40')]?_0x3639c0[_0x1e0a('0x3e')]:_0x5aa78f[_0x1e0a('0x39')];if(!_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x41')](_0x1e0a('0x42'))){_0x3639c0[_0x1e0a('0x43')]=qs['limit'](_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x43')]);_0x3639c0['offset']=qs[_0x1e0a('0x21')](_0x57368c['query'][_0x1e0a('0x21')]);}_0x3639c0[_0x1e0a('0x44')]=qs[_0x1e0a('0x45')](_0x57368c[_0x1e0a('0x3a')]['sort']);_0x3639c0['where']=qs[_0x1e0a('0x3c')](_['pick'](_0x57368c['query'],_0x5aa78f['filters']));var _0xb6d1ef=[];var _0x2ab17=squel[_0x1e0a('0x46')]()['field']('id')['field']('name')[_0x1e0a('0x47')]('color')[_0x1e0a('0x48')]('tools_tags');var _0x537f52=squel[_0x1e0a('0x46')]()[_0x1e0a('0x47')](_0x1e0a('0x49'))['field']('u.fullname')[_0x1e0a('0x47')](_0x1e0a('0x4a'))[_0x1e0a('0x48')](_0x1e0a('0x4b'),'ui')[_0x1e0a('0x4c')](_0x1e0a('0x4d'),'u','u.id\x20=\x20ui.UserId');var _0x1595ae=squel[_0x1e0a('0x46')]()[_0x1e0a('0x48')](_0x1e0a('0x4e'),'i')['left_join']('cm_contacts','c',_0x1e0a('0x4f'))[_0x1e0a('0x4c')](_0x1e0a('0x4d'),'o',_0x1e0a('0x50'))[_0x1e0a('0x4c')](_0x1e0a('0x51'),'a',_0x1e0a('0x52'))[_0x1e0a('0x4c')]('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')[_0x1e0a('0x4c')](_0x1e0a('0x53'),'it',_0x1e0a('0x54'))[_0x1e0a('0x4c')]('tools_tags','t',_0x1e0a('0x55'));var _0xc0b6ac=squel[_0x1e0a('0x56')]();var _0x423191=[];var _0x3725e0=squel[_0x1e0a('0x56')]();var _0x2c1d65;if(_0x57368c[_0x1e0a('0x3a')]['search']){_0x2c1d65=as[_0x1e0a('0x57')](_0x57368c['query'][_0x1e0a('0x58')]);var _0x128336=_0x2c1d65['sqlOperator'];for(var _0x3c1944=0x0;_0x3c1944<_0x2c1d65[_0x1e0a('0x59')][_0x1e0a('0x40')];_0x3c1944++){var _0x2710c2=_0x2c1d65[_0x1e0a('0x59')][_0x3c1944];var _0x155c91='i';var _0x231faf=_[_0x1e0a('0x5a')](_0x285e0e,[_0x1e0a('0x2a'),_0x2710c2[_0x1e0a('0x47')]]);if(!_0x231faf){switch(_0x2710c2[_0x1e0a('0x47')]){case _0x1e0a('0x5b'):if(_0x2710c2[_0x1e0a('0x5c')]==0x1){_0x1595ae[_0x1e0a('0x5d')]('`'+_0x2710c2['field']+'`\x20=\x200');}else{_0x1595ae[_0x1e0a('0x5d')]('`'+_0x2710c2[_0x1e0a('0x47')]+_0x1e0a('0x5e'));}break;case _0x1e0a('0x5f'):if(_0x2710c2[_0x1e0a('0x60')]===_0x1e0a('0x61')){if(_0x2710c2[_0x1e0a('0x5c')]['split']('\x20')[_0x1e0a('0x40')]>0x1){_0xc0b6ac[_0x128336](_0x1e0a('0x62'),qs[_0x1e0a('0x63')](_0x2710c2['value']),null);}else{var _0x405721='%'+_0x2710c2[_0x1e0a('0x5c')]+'%';_0xc0b6ac[_0x128336]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x405721,_0x405721,_0x405721);}}else{_0x231faf=_[_0x1e0a('0x5a')](_0x285e0e,[_0x1e0a('0x2a'),_0x1e0a('0x64')]);_0x2710c2[_0x1e0a('0x47')]='ContactId';_0x1b872f=as['buildExpression'](_0x155c91,_0x231faf[_0x1e0a('0x37')],_0x2710c2);_0xc0b6ac[_0x128336](_0x1b872f[_0x1e0a('0x65')],_0x1b872f[_0x1e0a('0x5c')][_0x1e0a('0x66')],_0x1b872f[_0x1e0a('0x5c')][_0x1e0a('0x1e')]);}break;case _0x1e0a('0x67'):var _0x5dd6dd=_0x2710c2[_0x1e0a('0x5c')][_0x1e0a('0x31')](',')[_0x1e0a('0x2d')](function(_0x5ba739){return Number(_0x5ba739);});_0x5dd6dd[_0x1e0a('0x32')](function(_0x21e503){_0x3725e0['or'](_0x1e0a('0x68'),'%,'+_0x21e503+',%');});_0x423191=_[_0x1e0a('0x69')](_0x423191,_0x5dd6dd);break;case _0x1e0a('0x6a'):if(_0x2710c2[_0x1e0a('0x60')]===_0x1e0a('0x61')){_0xc0b6ac[_0x128336](_0x1e0a('0x6b'),'%'+_0x2710c2[_0x1e0a('0x5c')]+'%',null);}else{_0x231faf=_[_0x1e0a('0x5a')](_0x285e0e,[_0x1e0a('0x2a'),'UserId']);_0x2710c2['field']=_0x1e0a('0x6c');_0x1b872f=as['buildExpression'](_0x155c91,_0x231faf[_0x1e0a('0x37')],_0x2710c2);_0xc0b6ac[_0x128336](_0x1b872f['text'],_0x1b872f[_0x1e0a('0x5c')]['start'],_0x1b872f[_0x1e0a('0x5c')]['end']);}break;case _0x1e0a('0x6d'):_0x1b872f=as[_0x1e0a('0x6e')]('me',null,_0x2710c2);_0xc0b6ac[_0x128336](_0x1b872f[_0x1e0a('0x65')],_0x1b872f[_0x1e0a('0x5c')][_0x1e0a('0x66')],_0x1b872f[_0x1e0a('0x5c')]['end']);break;}}else{var _0x1b872f=as[_0x1e0a('0x6e')](_0x155c91,_0x231faf[_0x1e0a('0x37')],_0x2710c2);_0xc0b6ac[_0x128336](_0x1b872f['text'],_0x1b872f[_0x1e0a('0x5c')][_0x1e0a('0x66')],_0x1b872f[_0x1e0a('0x5c')][_0x1e0a('0x1e')]);}}}else{var _0xd676e2=_(_0x57368c[_0x1e0a('0x3a')])['keys']()[_0x1e0a('0x2d')](function(_0x48fcb0){return _[_0x1e0a('0x6f')](_0x285e0e,[_0x1e0a('0x2a'),_0x48fcb0])?_0x48fcb0:undefined;})['compact']()['value']();if(!_['isEmpty'](_0xd676e2)){_0xd676e2[_0x1e0a('0x32')](function(_0x5f4a09){if(_0x5f4a09===_0x1e0a('0x70')){_0x1595ae[_0x1e0a('0x71')](_0x1e0a('0x72'),[][_0x1e0a('0x73')](_0x57368c[_0x1e0a('0x3a')][_0x5f4a09]));}else if(_0x5f4a09===_0x1e0a('0x74')){var _0x225878=JSON[_0x1e0a('0x75')](_0x57368c[_0x1e0a('0x3a')][_0x5f4a09])[_0x1e0a('0x76')];var _0x113784=JSON[_0x1e0a('0x75')](_0x57368c[_0x1e0a('0x3a')][_0x5f4a09])[_0x1e0a('0x77')];_0x1595ae['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x225878,_0x113784);}else{if(_0x57368c[_0x1e0a('0x3a')][_0x5f4a09]===_0x1e0a('0x78')){_0x1595ae[_0x1e0a('0x71')]('i.'+_0x5f4a09+_0x1e0a('0x79'));}else{_0x1595ae['where']('i.'+_0x5f4a09+_0x1e0a('0x7a'),_0x57368c[_0x1e0a('0x3a')][_0x5f4a09]);}}});}if(_0x57368c[_0x1e0a('0x3a')]['read']){if(_0x57368c[_0x1e0a('0x3a')]['read']==0x1){_0x1595ae[_0x1e0a('0x5d')]('`unreadMessages`\x20=\x200');}else{_0x1595ae['having']('`unreadMessages`\x20>\x200');}}if(_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x7b')]){_0x423191=_[_0x1e0a('0x7c')](_0x57368c['query'][_0x1e0a('0x7b')])?_0x57368c[_0x1e0a('0x3a')]['tag']:new Array(_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x7b')]);_0x423191[_0x1e0a('0x32')](function(_0x189d0f){_0x3725e0['or'](_0x1e0a('0x68'),'%,'+_0x189d0f+',%');});}if(_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x7d')]){var _0x139129=_0x57368c[_0x1e0a('0x3a')]['filter'][_0x1e0a('0x7e')]('\x5c','\x5c\x5c')[_0x1e0a('0x7e')]('\x27\x27',_0x1e0a('0x7f'));if(qs[_0x1e0a('0x80')](_0x139129)){_0xc0b6ac['or'](_0x1e0a('0x81'),_0x139129+'%')['or'](_0x1e0a('0x82'),_0x139129+'%');}_0xc0b6ac['or'](_0x1e0a('0x83'),_0x139129+'%');}}_0x1595ae['where'](_0xc0b6ac);_0x1595ae[_0x1e0a('0x84')]('i.id');var _0x3cedfc={'type':db[_0x1e0a('0x85')][_0x1e0a('0x86')][_0x1e0a('0x87')],'raw':!![]};var _0x5d22ec=_0x1595ae['clone']();_0x5d22ec[_0x1e0a('0x47')](_0x1e0a('0x88'));_0x5d22ec['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1e0a('0x5b'));if(_0x3639c0[_0x1e0a('0x44')]){_0x3639c0[_0x1e0a('0x44')][_0x1e0a('0x32')](function(_0x5c9a58){_0x1595ae[_0x1e0a('0x44')]('i.'+_0x5c9a58[0x0],_0x5c9a58[0x1]===_0x1e0a('0x89')?![]:!![]);});}if(!_[_0x1e0a('0x8a')](_0x423191)){_0x1595ae[_0x1e0a('0x5d')](_0x3725e0);_0x5d22ec[_0x1e0a('0x71')](_0x1e0a('0x8b'),_0x423191);}BPromise[_0x1e0a('0x8c')]()[_0x1e0a('0x28')](function(){if(!_0x2c1d65){if(_0x57368c[_0x1e0a('0x3a')][_0x1e0a('0x70')]||_0x57368c['query'][_0x1e0a('0x8d')])return;_0x5d22ec['where']('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1595ae[_0x1e0a('0x71')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');return;}return _0x57368c['user'][_0x1e0a('0x8e')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4e9a4f){if(_[_0x1e0a('0x8a')](_0x4e9a4f)){_0x5d22ec[_0x1e0a('0x71')]('i.FaxAccountId\x20IS\x20NULL');_0x1595ae['where'](_0x1e0a('0x8f'));}else{_0x5d22ec[_0x1e0a('0x71')]('i.FaxAccountId\x20IN\x20?',_[_0x1e0a('0x2d')](_0x4e9a4f,'id'));_0x1595ae['where'](_0x1e0a('0x72'),_['map'](_0x4e9a4f,'id'));}});})['then'](function(){db[_0x1e0a('0x90')][_0x1e0a('0x3a')](_0x5d22ec['toString'](),_0x3cedfc)[_0x1e0a('0x28')](function(_0xe152bf){_0x14c497[_0x1e0a('0x20')]=_0xe152bf[_0x1e0a('0x40')];if(_0x14c497[_0x1e0a('0x20')]===0x0)return[];return db[_0x1e0a('0x90')][_0x1e0a('0x3a')](_0x2ab17[_0x1e0a('0x91')](),_0x3cedfc)['then'](function(_0x4f50db){_0xb6d1ef=_[_0x1e0a('0x92')](_0x4f50db,'id');_0x3cedfc=_['merge'](_0x3cedfc,{'model':db[_0x1e0a('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x57368c[_0x1e0a('0x3a')]['fields']){_0x3639c0['attributes'][_0x1e0a('0x32')](function(_0x1809d4){_0x1595ae[_0x1e0a('0x47')]('i.'+_0x1809d4);});}else{_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0x93'),_0x1e0a('0x5b'));_0x1595ae[_0x1e0a('0x47')]('a.key',_0x1e0a('0x94'));_0x1595ae['field'](_0x1e0a('0x95'),_0x1e0a('0x96'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0x97'));_0x1595ae['field']('c.firstName',_0x1e0a('0x98'));_0x1595ae['field'](_0x1e0a('0x99'),_0x1e0a('0x9a'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0x9b'),_0x1e0a('0x9c'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0x9d'),_0x1e0a('0x9e'));_0x1595ae[_0x1e0a('0x47')]('c.mobile',_0x1e0a('0x9f'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0xa0'),_0x1e0a('0xa1'));_0x1595ae[_0x1e0a('0x47')]('o.fullname',_0x1e0a('0xa2'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0xa3'),_0x1e0a('0xa4'));_0x1595ae[_0x1e0a('0x47')](_0x1e0a('0xa5'),_0x1e0a('0x2f'));}_0x1595ae[_0x1e0a('0x43')](_0x3639c0[_0x1e0a('0x43')]);_0x1595ae[_0x1e0a('0x21')](_0x3639c0[_0x1e0a('0x21')]);return db[_0x1e0a('0x90')]['query'](_0x1595ae[_0x1e0a('0x91')](),_0x3cedfc);})[_0x1e0a('0x28')](function(_0x48e614){_0x537f52[_0x1e0a('0x71')](_0x1e0a('0xa6'),_[_0x1e0a('0x2d')](_0x48e614,'id'));return db[_0x1e0a('0x90')][_0x1e0a('0x3a')](_0x537f52[_0x1e0a('0x91')](),_0x3cedfc)['then'](function(_0x24e6a1){var _0x52bc6b=_['groupBy'](_0x24e6a1,_0x1e0a('0xa7'));var _0x12135f=[];_0x48e614['forEach'](function(_0x115279){_0x12135f[_0x1e0a('0x33')](updateFaxInteraction(_0x115279,_0xb6d1ef,_0x52bc6b));});return BPromise['all'](_0x12135f);});});})[_0x1e0a('0x28')](function(_0x242450){_0x14c497[_0x1e0a('0xa8')]=_0x242450;return _0x14c497;})[_0x1e0a('0x28')](respondWithFilteredResult(_0x4acb03,_0x3639c0));})[_0x1e0a('0xa9')](handleError(_0x4acb03,null));};exports[_0x1e0a('0xaa')]=function(_0x16f208,_0x7ff30){var _0x5468ac={'raw':![],'where':{'id':_0x16f208[_0x1e0a('0xab')]['id']}},_0x4d4984={};_0x4d4984[_0x1e0a('0x39')]=_[_0x1e0a('0x3b')](db[_0x1e0a('0x35')][_0x1e0a('0xac')]);_0x4d4984[_0x1e0a('0x3a')]=_[_0x1e0a('0x3b')](_0x16f208[_0x1e0a('0x3a')]);_0x4d4984[_0x1e0a('0x3c')]=_[_0x1e0a('0x3d')](_0x4d4984['model'],_0x4d4984['query']);_0x5468ac[_0x1e0a('0x3e')]=_[_0x1e0a('0x3d')](_0x4d4984[_0x1e0a('0x39')],qs['fields'](_0x16f208[_0x1e0a('0x3a')][_0x1e0a('0x3f')]));_0x5468ac[_0x1e0a('0x3e')]=_0x5468ac[_0x1e0a('0x3e')]['length']?_0x5468ac[_0x1e0a('0x3e')]:_0x4d4984[_0x1e0a('0x39')];if(_0x16f208[_0x1e0a('0x3a')][_0x1e0a('0xad')]){_0x5468ac[_0x1e0a('0xae')]=[{'all':!![]}];}_0x5468ac=_[_0x1e0a('0xaf')]({},_0x5468ac,_0x16f208['options']);return db[_0x1e0a('0x35')][_0x1e0a('0x5a')](_0x5468ac)[_0x1e0a('0x28')](handleEntityNotFound(_0x7ff30,null))[_0x1e0a('0x28')](respondWithResult(_0x7ff30,null))[_0x1e0a('0xa9')](handleError(_0x7ff30,null));};exports['create']=function(_0x545559,_0x11a95a){return db[_0x1e0a('0x35')][_0x1e0a('0xb0')](_0x545559[_0x1e0a('0x6d')],{})[_0x1e0a('0x28')](respondWithResult(_0x11a95a,0xc9))[_0x1e0a('0xa9')](handleError(_0x11a95a,null));};exports[_0x1e0a('0x26')]=function(_0x297496,_0x275381){if(_0x297496[_0x1e0a('0x6d')]['id']){delete _0x297496['body']['id'];}return db[_0x1e0a('0x35')][_0x1e0a('0x5a')]({'where':{'id':_0x297496[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x275381,null))[_0x1e0a('0x28')](saveUpdates(_0x297496[_0x1e0a('0x6d')],null))[_0x1e0a('0x28')](respondWithResult(_0x275381,null))[_0x1e0a('0xa9')](handleError(_0x275381,null));};exports[_0x1e0a('0x27')]=function(_0x2f4a45,_0x4e5884){return db[_0x1e0a('0x35')][_0x1e0a('0x5a')]({'where':{'id':_0x2f4a45[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x4e5884,null))[_0x1e0a('0x28')](removeEntity(_0x4e5884,null))['catch'](handleError(_0x4e5884,null));};exports[_0x1e0a('0xb1')]=function(_0x4410fe,_0x186cf2){return db[_0x1e0a('0x35')][_0x1e0a('0xb1')]()[_0x1e0a('0x28')](respondWithResult(_0x186cf2,null))[_0x1e0a('0xa9')](handleError(_0x186cf2,null));};exports[_0x1e0a('0xb2')]=function(_0x84431e,_0x38f692,_0x56413f){return db[_0x1e0a('0xb3')]['find']({'where':{'id':_0x84431e[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x38f692,null))[_0x1e0a('0x28')](function(_0x540e63){if(_0x540e63){return _0x540e63[_0x1e0a('0xb2')](_0x84431e[_0x1e0a('0x6d')][_0x1e0a('0xb4')],_['omit'](_0x84431e['body'],[_0x1e0a('0xb4'),'id'])||{});}})[_0x1e0a('0x28')](respondWithResult(_0x38f692,null))[_0x1e0a('0xa9')](handleError(_0x38f692,null));};exports['getMessages']=function(_0x3dfef8,_0x80c6d3,_0x3df221){var _0x17c244={'raw':![],'where':{}};var _0x5528f4={};var _0x5779bd={'count':0x0,'rows':[]};return db[_0x1e0a('0x35')][_0x1e0a('0xb5')]({'where':{'id':_0x3dfef8[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x80c6d3,null))[_0x1e0a('0x28')](function(_0x23ffb2){if(_0x23ffb2){_0x5528f4[_0x1e0a('0x39')]=_[_0x1e0a('0x3b')](db[_0x1e0a('0xb3')][_0x1e0a('0xac')]);_0x5528f4[_0x1e0a('0x3a')]=_[_0x1e0a('0x3b')](_0x3dfef8['query']);_0x5528f4[_0x1e0a('0x3c')]=_[_0x1e0a('0x3d')](_0x5528f4[_0x1e0a('0x39')],_0x5528f4[_0x1e0a('0x3a')]);_0x17c244[_0x1e0a('0x3e')]=_[_0x1e0a('0x3d')](_0x5528f4[_0x1e0a('0x39')],qs[_0x1e0a('0x3f')](_0x3dfef8['query']['fields']));_0x17c244[_0x1e0a('0x3e')]=_0x17c244[_0x1e0a('0x3e')][_0x1e0a('0x40')]?_0x17c244[_0x1e0a('0x3e')]:_0x5528f4[_0x1e0a('0x39')];if(!_0x3dfef8[_0x1e0a('0x3a')]['hasOwnProperty'](_0x1e0a('0x42'))){_0x17c244[_0x1e0a('0x43')]=qs[_0x1e0a('0x43')](_0x3dfef8['query'][_0x1e0a('0x43')]);_0x17c244[_0x1e0a('0x21')]=qs[_0x1e0a('0x21')](_0x3dfef8[_0x1e0a('0x3a')][_0x1e0a('0x21')]);}_0x17c244[_0x1e0a('0x44')]=qs[_0x1e0a('0x45')](_0x3dfef8['query']['sort']);_0x17c244['where']=qs[_0x1e0a('0x3c')](_[_0x1e0a('0xb6')](_0x3dfef8['query'],_0x5528f4[_0x1e0a('0x3c')]));_0x17c244[_0x1e0a('0x71')]['FaxInteractionId']=_0x23ffb2['id'];if(_0x3dfef8[_0x1e0a('0x3a')][_0x1e0a('0x7d')]){_0x17c244[_0x1e0a('0x71')]=_[_0x1e0a('0xaf')](_0x17c244[_0x1e0a('0x71')],{'$or':_['map'](_0x17c244[_0x1e0a('0x3e')],function(_0x3cbcb3){var _0x527995={};_0x527995[_0x3cbcb3]={'$like':'%'+_0x3dfef8[_0x1e0a('0x3a')]['filter']+'%'};return _0x527995;})});}if(_0x3dfef8[_0x1e0a('0x3a')][_0x1e0a('0x76')]){var _0x16e293=_0x3dfef8['query'][_0x1e0a('0x76')][_0x1e0a('0x31')](',');var _0x4c1d84={};_0x4c1d84[_0x16e293[0x0]]={'$gte':moment(_0x16e293[0x1])[_0x1e0a('0xb7')](_0x1e0a('0xb8'))};_0x17c244[_0x1e0a('0x71')]=_['merge'](_0x17c244['where'],_0x4c1d84);}_0x17c244=_['merge']({},_0x17c244,_0x3dfef8['options']);return db[_0x1e0a('0xb3')][_0x1e0a('0x20')]({'where':_0x17c244[_0x1e0a('0x71')]})[_0x1e0a('0x28')](function(_0x44a04f){_0x5779bd['count']=_0x44a04f;if(_0x3dfef8[_0x1e0a('0x3a')][_0x1e0a('0xad')]){_0x17c244[_0x1e0a('0xae')]=[{'all':!![]}];}return db['FaxMessage'][_0x1e0a('0xb9')](_0x17c244);})[_0x1e0a('0x28')](function(_0xdeeebd){_0x5779bd['rows']=_0xdeeebd;return _0x5779bd;});}})[_0x1e0a('0x28')](respondWithFilteredResult(_0x80c6d3,_0x17c244))[_0x1e0a('0xa9')](handleError(_0x80c6d3,null));};exports[_0x1e0a('0xba')]=function(_0x1b9fed,_0x394647,_0x2023d7){return db[_0x1e0a('0x35')][_0x1e0a('0x5a')]({'where':{'id':_0x1b9fed[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x394647,null))[_0x1e0a('0x28')](function(_0x4c8d11){if(_0x4c8d11){return _0x4c8d11['setTags'](_0x1b9fed[_0x1e0a('0x6d')]['ids'],_[_0x1e0a('0xbb')](_0x1b9fed[_0x1e0a('0x6d')],[_0x1e0a('0xb4'),'id'])||{})[_0x1e0a('0xbc')](function(){return db['Tag'][_0x1e0a('0xb9')]({'attributes':['id',_0x1e0a('0x2a'),_0x1e0a('0xbd')],'where':{'id':_0x1b9fed[_0x1e0a('0x6d')][_0x1e0a('0xb4')]}});})['then'](function(_0x27faad){socket[_0x1e0a('0xbe')](_0x1e0a('0xbf'),{'id':Number(_0x1b9fed[_0x1e0a('0xab')]['id']),'tags':_0x27faad||[]});return{'id':Number(_0x1b9fed[_0x1e0a('0xab')]['id']),'tags':_0x27faad||[]};});}})[_0x1e0a('0x28')](respondWithResult(_0x394647,null))[_0x1e0a('0xa9')](handleError(_0x394647,null));};exports[_0x1e0a('0xc0')]=function(_0x34a2cf,_0x1de28b,_0x39d5a9){return db[_0x1e0a('0x35')][_0x1e0a('0x5a')]({'where':{'id':_0x34a2cf[_0x1e0a('0xab')]['id']}})[_0x1e0a('0x28')](handleEntityNotFound(_0x1de28b,null))['then'](function(_0x1fd85f){if(_0x1fd85f){return _0x1fd85f['removeTags'](_0x34a2cf[_0x1e0a('0x3a')][_0x1e0a('0xb4')]);}})['then'](respondWithStatusCode(_0x1de28b,null))['catch'](handleError(_0x1de28b,null));};exports[_0x1e0a('0xc1')]=function(_0x12e3f0,_0x33c9f3){var _0x2939d3=moment()[_0x1e0a('0xc2')]()[_0x1e0a('0x91')]();var _0x49c465=path[_0x1e0a('0xc3')](config[_0x1e0a('0xc4')],_0x1e0a('0xc5'),_0x1e0a('0xc6'),_0x1e0a('0xc7'));var _0x8a4465=path[_0x1e0a('0xc3')](config[_0x1e0a('0xc4')],_0x1e0a('0xc5'),_0x1e0a('0xc6'),_0x1e0a('0xc8'));var _0x427c27=path[_0x1e0a('0xc3')](_0x49c465,_0x2939d3);var _0x5090e2=util[_0x1e0a('0xb7')](_0x1e0a('0xc9'),_0x12e3f0['params']['id'],_0x2939d3);var _0x48f76b=path[_0x1e0a('0xc3')](_0x49c465,_0x5090e2);var _0x2cbe58=[];_0x2cbe58['push']({'model':db[_0x1e0a('0xca')],'as':_0x1e0a('0xca'),'raw':!![]});var _0x28ccb6=[{'model':db[_0x1e0a('0xb3')],'as':_0x1e0a('0xcb'),'attributes':['id',_0x1e0a('0x6d'),'createdAt'],'include':_0x2cbe58}];return db[_0x1e0a('0x35')]['find']({'where':{'id':_0x12e3f0[_0x1e0a('0xab')]['id']},'include':_0x28ccb6})[_0x1e0a('0x28')](handleEntityNotFound(_0x33c9f3,null))[_0x1e0a('0x28')](function(_0x346f8f){if(_0x346f8f&&_0x346f8f['Messages']){var _0x27e705=_0x346f8f[_0x1e0a('0xcc')]({'plain':!![]});fs[_0x1e0a('0xcd')](_0x427c27);for(var _0x4de06f=0x0;_0x4de06f<_0x27e705[_0x1e0a('0xcb')]['length'];_0x4de06f++){var _0x4e3df8=_0x27e705[_0x1e0a('0xcb')][_0x4de06f][_0x1e0a('0xca')];if(_0x4e3df8){var _0x9da658=path[_0x1e0a('0xc3')](_0x8a4465,_0x4e3df8[_0x1e0a('0xce')]);if(fs[_0x1e0a('0xcf')](_0x9da658)){fs[_0x1e0a('0xd0')](_0x9da658)[_0x1e0a('0xd1')](fs[_0x1e0a('0xd2')](path[_0x1e0a('0xc3')](_0x427c27,_0x4e3df8[_0x1e0a('0xce')])));}}}return BPromise[_0x1e0a('0x8c')]()[_0x1e0a('0x28')](function(){return new BPromise(function(_0x2391f5,_0x3605c0){zipdir(_0x427c27,{'saveTo':_0x48f76b},function(_0x2bc5ef,_0x426785){if(_0x2bc5ef)return _0x3605c0(_0x2bc5ef);return _0x2391f5(_0x426785);});})[_0x1e0a('0x28')](function(){return new BPromise(function(_0xefc894,_0x3043db){rimraf(_0x427c27,function(_0x2c0876){if(_0x2c0876)_0x3043db(_0x2c0876);return _0xefc894();});});})[_0x1e0a('0x28')](function(){return _0x33c9f3[_0x1e0a('0xc1')](_0x48f76b,_0x5090e2,function(_0x57e8d7){if(_0x57e8d7){console[_0x1e0a('0xd3')](_0x1e0a('0xd4'),_0x57e8d7);}else{fs[_0x1e0a('0xd5')](_0x48f76b);}});});});}else{return _0x33c9f3[_0x1e0a('0x1c')](0xc8);}})[_0x1e0a('0xa9')](handleError(_0x33c9f3,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index a581f3b..4a6f6ae 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 _0x2ef3=['remove','then','setDataValue','Users','map','findAll','emit','catch','hasOwnProperty','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','update'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2ef3,0xba));var _0x32ef=function(_0x2f4859,_0x22227a){_0x2f4859=_0x2f4859-0x0;var _0xe5dae1=_0x2ef3[_0x2f4859];return _0xe5dae1;};'use strict';var EventEmitter=require(_0x32ef('0x0'));var FaxInteraction=require(_0x32ef('0x1'))['db'][_0x32ef('0x2')];var FaxMessage=require(_0x32ef('0x1'))['db'][_0x32ef('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x32ef('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x32ef('0x5'),'afterDestroy':_0x32ef('0x6')};function emitEvent(_0x524ab6){return function(_0x402857,_0x37dd1d,_0x4c8104){_0x402857['getUsers']({'attributes':['id'],'raw':!![]})[_0x32ef('0x7')](function(_0x4bfcf8){_0x402857[_0x32ef('0x8')](_0x32ef('0x9'),_0x4bfcf8[_0x32ef('0xa')](function(_0x298066){return{'id':_0x298066['id']};}));return FaxMessage[_0x32ef('0xb')]({'where':{'FaxInteractionId':_0x402857['id'],'direction':'in','read':![]},'raw':!![]});})[_0x32ef('0x7')](function(_0x28275c){_0x402857[_0x32ef('0x8')]('unreadMessages',_0x28275c['length']);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6+':'+_0x402857['id'],_0x402857);FaxInteractionEvents[_0x32ef('0xc')](_0x524ab6,_0x402857);_0x4c8104(null);})[_0x32ef('0xd')](_0x4c8104(null));};}for(var e in events){if(events[_0x32ef('0xe')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x32ef('0xf')]=FaxInteractionEvents; \ No newline at end of file +var _0x1261=['exports','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','emit','hasOwnProperty'];(function(_0x30777d,_0x2c85b2){var _0x533cc5=function(_0x29ed0f){while(--_0x29ed0f){_0x30777d['push'](_0x30777d['shift']());}};_0x533cc5(++_0x2c85b2);}(_0x1261,0x144));var _0x1126=function(_0x21eb3c,_0x7ce88b){_0x21eb3c=_0x21eb3c-0x0;var _0x4bd2aa=_0x1261[_0x21eb3c];return _0x4bd2aa;};'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 diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index c435750..5e69540 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 _0xdbf1=['closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','define','FaxInteraction','fax_interactions'];(function(_0x5d41af,_0x50e55c){var _0x5b9faf=function(_0x2c3814){while(--_0x2c3814){_0x5d41af['push'](_0x5d41af['shift']());}};_0x5b9faf(++_0x50e55c);}(_0xdbf1,0xa4));var _0x1dbf=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xdbf1[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x1dbf('0x0'));var util=require('util');var logger=require(_0x1dbf('0x1'))(_0x1dbf('0x2'));var moment=require(_0x1dbf('0x3'));var BPromise=require('bluebird');var rp=require(_0x1dbf('0x4'));var fs=require('fs');var path=require(_0x1dbf('0x5'));var rimraf=require(_0x1dbf('0x6'));var config=require(_0x1dbf('0x7'));var attributes=require(_0x1dbf('0x8'));module['exports']=function(_0x1f860e,_0x1bdff4){return _0x1f860e[_0x1dbf('0x9')](_0x1dbf('0xa'),attributes,{'tableName':_0x1dbf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4b65aa,_0x34e6e0,_0x936d61){if(_0x4b65aa['changed'](_0x1dbf('0xc'))){_0x4b65aa[_0x1dbf('0xd')]=moment()[_0x1dbf('0xe')](_0x1dbf('0xf'));}_0x936d61(null,_0x4b65aa);}}});}; \ No newline at end of file +var _0xd7f5=['rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','closedAt','format','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2f17e4,_0x1d4bc3){var _0x397e3a=function(_0xfefbaa){while(--_0xfefbaa){_0x2f17e4['push'](_0x2f17e4['shift']());}};_0x397e3a(++_0x1d4bc3);}(_0xd7f5,0x119));var _0x5d7f=function(_0x555ebb,_0x4b1b68){_0x555ebb=_0x555ebb-0x0;var _0x3c0a4a=_0xd7f5[_0x555ebb];return _0x3c0a4a;};'use strict';var _=require(_0x5d7f('0x0'));var util=require('util');var logger=require(_0x5d7f('0x1'))(_0x5d7f('0x2'));var moment=require(_0x5d7f('0x3'));var BPromise=require(_0x5d7f('0x4'));var rp=require(_0x5d7f('0x5'));var fs=require('fs');var path=require(_0x5d7f('0x6'));var rimraf=require(_0x5d7f('0x7'));var config=require(_0x5d7f('0x8'));var attributes=require(_0x5d7f('0x9'));module[_0x5d7f('0xa')]=function(_0x494854,_0x57ea34){return _0x494854[_0x5d7f('0xb')](_0x5d7f('0xc'),attributes,{'tableName':_0x5d7f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x15ce6e,_0x470aca,_0x5cfcab){if(_0x15ce6e['changed']('closed')){_0x15ce6e[_0x5d7f('0xe')]=moment()[_0x5d7f('0xf')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5cfcab(null,_0x15ce6e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 7039257..933fe1b 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 _0x64be=['stringify','error','code','message','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','where','AddTagsToFaxInteraction','addTags','ids','omit','spread','AddTags','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s'];(function(_0x7f2b94,_0x561107){var _0x11f212=function(_0x52a9f2){while(--_0x52a9f2){_0x7f2b94['push'](_0x7f2b94['shift']());}};_0x11f212(++_0x561107);}(_0x64be,0x197));var _0xe64b=function(_0x272f3d,_0x1540c1){_0x272f3d=_0x272f3d-0x0;var _0x27e53e=_0x64be[_0x272f3d];return _0x27e53e;};'use strict';var _=require(_0xe64b('0x0'));var util=require(_0xe64b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe64b('0x2'));var db=require(_0xe64b('0x3'))['db'];var utils=require(_0xe64b('0x4'));var logger=require(_0xe64b('0x5'))('rpc');var config=require(_0xe64b('0x6'));var jayson=require(_0xe64b('0x7'));var client=jayson[_0xe64b('0x8')][_0xe64b('0x9')]({'port':0x232a});config[_0xe64b('0xa')]=_[_0xe64b('0xb')](config[_0xe64b('0xa')],{'host':_0xe64b('0xc'),'port':0x18eb});var socket=require(_0xe64b('0xd'))(new Redis(config[_0xe64b('0xa')]));require(_0xe64b('0xe'))['register'](socket);function respondWithRpcPromise(_0x252baa,_0x5ea95c,_0x3dc71a){return new BPromise(function(_0x437146,_0x463623){return client[_0xe64b('0xf')](_0x252baa,_0x3dc71a)[_0xe64b('0x10')](function(_0x101522){logger[_0xe64b('0x11')](_0xe64b('0x12'),_0x5ea95c,_0xe64b('0x13'));logger[_0xe64b('0x14')](_0xe64b('0x15'),_0x5ea95c,'request\x20sent',JSON[_0xe64b('0x16')](_0x101522));if(_0x101522[_0xe64b('0x17')]){if(_0x101522['error'][_0xe64b('0x18')]===0x1f4){logger['error'](_0xe64b('0x12'),_0x5ea95c,_0x101522[_0xe64b('0x17')][_0xe64b('0x19')]);return _0x463623(_0x101522[_0xe64b('0x17')][_0xe64b('0x19')]);}logger[_0xe64b('0x17')](_0xe64b('0x12'),_0x5ea95c,_0x101522[_0xe64b('0x17')][_0xe64b('0x19')]);return _0x437146(_0x101522['error'][_0xe64b('0x19')]);}else{logger[_0xe64b('0x11')](_0xe64b('0x12'),_0x5ea95c,'request\x20sent');_0x437146(_0x101522['result'][_0xe64b('0x19')]);}})[_0xe64b('0x1a')](function(_0x5bdcb6){logger[_0xe64b('0x17')](_0xe64b('0x12'),_0x5ea95c,_0x5bdcb6);_0x463623(_0x5bdcb6);});});}exports[_0xe64b('0x1b')]=function(_0x4dbe0a){var _0x4dd4e7=this;return new Promise(function(_0x3a82e5,_0x2f7e01){return db[_0xe64b('0x1c')]['update'](_0x4dbe0a[_0xe64b('0x1d')],{'raw':_0x4dbe0a[_0xe64b('0x1e')]?_0x4dbe0a[_0xe64b('0x1e')][_0xe64b('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4dbe0a[_0xe64b('0x1e')]?_0x4dbe0a[_0xe64b('0x1e')][_0xe64b('0x20')]||null:null,'attributes':_0x4dbe0a[_0xe64b('0x1e')]?_0x4dbe0a[_0xe64b('0x1e')]['attributes']||null:null,'limit':_0x4dbe0a['options']?_0x4dbe0a['options']['limit']||null:null})[_0xe64b('0x10')](function(_0x55898c){logger[_0xe64b('0x11')]('UpdateFaxInteraction',_0x4dbe0a);logger[_0xe64b('0x14')]('UpdateFaxInteraction',_0x4dbe0a,JSON[_0xe64b('0x16')](_0x55898c));_0x3a82e5(_0x55898c);})[_0xe64b('0x1a')](function(_0x11384c){logger[_0xe64b('0x17')]('UpdateFaxInteraction',_0x11384c[_0xe64b('0x19')],_0x4dbe0a);_0x2f7e01(_0x4dd4e7[_0xe64b('0x17')](0x1f4,_0x11384c[_0xe64b('0x19')]));});});};exports[_0xe64b('0x21')]=function(_0x23348a){return new Promise(function(_0x4e75bd,_0x1c310e){return db[_0xe64b('0x1c')]['find']({'where':_0x23348a['options']?_0x23348a[_0xe64b('0x1e')][_0xe64b('0x20')]||null:null})[_0xe64b('0x10')](function(_0x5c7907){if(_0x5c7907){return _0x5c7907[_0xe64b('0x22')](_0x23348a[_0xe64b('0x1d')][_0xe64b('0x23')],_[_0xe64b('0x24')](_0x23348a[_0xe64b('0x1d')],[_0xe64b('0x23'),'id'])||{});}})[_0xe64b('0x25')](function(_0x2d65ab){logger[_0xe64b('0x11')](_0xe64b('0x26'),_0x23348a);logger[_0xe64b('0x14')](_0xe64b('0x26'),_0x23348a,JSON[_0xe64b('0x16')](_0x2d65ab));_0x4e75bd(_0x2d65ab);})['catch'](function(_0x1a253c){logger[_0xe64b('0x17')]('AddTags',_0x1a253c[_0xe64b('0x19')],_0x23348a);_0x1c310e(_this[_0xe64b('0x17')](0x1f4,_0x1a253c[_0xe64b('0x19')]));});});}; \ No newline at end of file +var _0xc0ab=['rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','debug','stringify','catch','AddTagsToFaxInteraction','find','addTags','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x2e301d,_0x26b5f0){var _0x3b370c=function(_0x1e5999){while(--_0x1e5999){_0x2e301d['push'](_0x2e301d['shift']());}};_0x3b370c(++_0x26b5f0);}(_0xc0ab,0x7d));var _0xbc0a=function(_0x17fdde,_0x4b3717){_0x17fdde=_0x17fdde-0x0;var _0x4fd885=_0xc0ab[_0x17fdde];return _0x4fd885;};'use strict';var _=require(_0xbc0a('0x0'));var util=require(_0xbc0a('0x1'));var moment=require(_0xbc0a('0x2'));var BPromise=require(_0xbc0a('0x3'));var rs=require(_0xbc0a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbc0a('0x5'))['db'];var utils=require(_0xbc0a('0x6'));var logger=require('../../config/logger')(_0xbc0a('0x7'));var config=require(_0xbc0a('0x8'));var jayson=require(_0xbc0a('0x9'));var client=jayson[_0xbc0a('0xa')][_0xbc0a('0xb')]({'port':0x232a});config[_0xbc0a('0xc')]=_[_0xbc0a('0xd')](config['redis'],{'host':_0xbc0a('0xe'),'port':0x18eb});var socket=require(_0xbc0a('0xf'))(new Redis(config['redis']));require(_0xbc0a('0x10'))[_0xbc0a('0x11')](socket);function respondWithRpcPromise(_0xa7a8aa,_0x2a7d2c,_0xb647f5){return new BPromise(function(_0x6aaf47,_0x3d3c1b){return client[_0xbc0a('0x12')](_0xa7a8aa,_0xb647f5)[_0xbc0a('0x13')](function(_0x1dc6b8){logger['info'](_0xbc0a('0x14'),_0x2a7d2c,'request\x20sent');logger['debug'](_0xbc0a('0x15'),_0x2a7d2c,_0xbc0a('0x16'),JSON['stringify'](_0x1dc6b8));if(_0x1dc6b8['error']){if(_0x1dc6b8[_0xbc0a('0x17')]['code']===0x1f4){logger[_0xbc0a('0x17')](_0xbc0a('0x14'),_0x2a7d2c,_0x1dc6b8['error'][_0xbc0a('0x18')]);return _0x3d3c1b(_0x1dc6b8[_0xbc0a('0x17')][_0xbc0a('0x18')]);}logger[_0xbc0a('0x17')](_0xbc0a('0x14'),_0x2a7d2c,_0x1dc6b8[_0xbc0a('0x17')]['message']);return _0x6aaf47(_0x1dc6b8[_0xbc0a('0x17')]['message']);}else{logger[_0xbc0a('0x19')](_0xbc0a('0x14'),_0x2a7d2c,_0xbc0a('0x16'));_0x6aaf47(_0x1dc6b8[_0xbc0a('0x1a')][_0xbc0a('0x18')]);}})['catch'](function(_0x1dbe67){logger[_0xbc0a('0x17')](_0xbc0a('0x14'),_0x2a7d2c,_0x1dbe67);_0x3d3c1b(_0x1dbe67);});});}exports[_0xbc0a('0x1b')]=function(_0x2784e6){var _0x74bcfb=this;return new Promise(function(_0x3c6d03,_0x38816d){return db[_0xbc0a('0x1c')][_0xbc0a('0x1d')](_0x2784e6[_0xbc0a('0x1e')],{'raw':_0x2784e6[_0xbc0a('0x1f')]?_0x2784e6[_0xbc0a('0x1f')][_0xbc0a('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2784e6[_0xbc0a('0x1f')]?_0x2784e6[_0xbc0a('0x1f')][_0xbc0a('0x21')]||null:null,'attributes':_0x2784e6[_0xbc0a('0x1f')]?_0x2784e6['options'][_0xbc0a('0x22')]||null:null,'limit':_0x2784e6['options']?_0x2784e6[_0xbc0a('0x1f')][_0xbc0a('0x23')]||null:null})[_0xbc0a('0x13')](function(_0x499d56){logger[_0xbc0a('0x19')](_0xbc0a('0x1b'),_0x2784e6);logger[_0xbc0a('0x24')](_0xbc0a('0x1b'),_0x2784e6,JSON[_0xbc0a('0x25')](_0x499d56));_0x3c6d03(_0x499d56);})[_0xbc0a('0x26')](function(_0x11299e){logger[_0xbc0a('0x17')]('UpdateFaxInteraction',_0x11299e[_0xbc0a('0x18')],_0x2784e6);_0x38816d(_0x74bcfb[_0xbc0a('0x17')](0x1f4,_0x11299e['message']));});});};exports[_0xbc0a('0x27')]=function(_0x5d203a){return new Promise(function(_0x1df51a,_0x2cd4da){return db[_0xbc0a('0x1c')][_0xbc0a('0x28')]({'where':_0x5d203a[_0xbc0a('0x1f')]?_0x5d203a[_0xbc0a('0x1f')][_0xbc0a('0x21')]||null:null})['then'](function(_0x56566a){if(_0x56566a){return _0x56566a[_0xbc0a('0x29')](_0x5d203a[_0xbc0a('0x1e')]['ids'],_['omit'](_0x5d203a[_0xbc0a('0x1e')],['ids','id'])||{});}})[_0xbc0a('0x2a')](function(_0x69c16e){logger[_0xbc0a('0x19')](_0xbc0a('0x2b'),_0x5d203a);logger[_0xbc0a('0x24')](_0xbc0a('0x2b'),_0x5d203a,JSON[_0xbc0a('0x25')](_0x69c16e));_0x1df51a(_0x69c16e);})['catch'](function(_0x35d132){logger[_0xbc0a('0x17')](_0xbc0a('0x2b'),_0x35d132[_0xbc0a('0x18')],_0x5d203a);_0x2cd4da(_this[_0xbc0a('0x17')](0x1f4,_0x35d132[_0xbc0a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index ca6363f..5d4ef14 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 _0x96e1=['remove','emit','removeListener','register','faxInteraction:'];(function(_0x20f715,_0x352dc2){var _0x1532d1=function(_0x10e770){while(--_0x10e770){_0x20f715['push'](_0x20f715['shift']());}};_0x1532d1(++_0x352dc2);}(_0x96e1,0x186));var _0x196e=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x96e1[_0x122ef9];return _0x42fba0;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=['save',_0x196e('0x0'),'update'];function createListener(_0x51288c,_0x407eea){return function(_0x5da718){_0x407eea[_0x196e('0x1')](_0x51288c,_0x5da718);};}function removeListener(_0x341401,_0x1aae79){return function(){FaxInteractionEvents[_0x196e('0x2')](_0x341401,_0x1aae79);};}exports[_0x196e('0x3')]=function(_0x197a0a){for(var _0x59c2b8=0x0,_0x5ef8c9=events['length'];_0x59c2b8<_0x5ef8c9;_0x59c2b8++){var _0x43664c=events[_0x59c2b8];var _0x5c3c1e=createListener(_0x196e('0x4')+_0x43664c,_0x197a0a);FaxInteractionEvents['on'](_0x43664c,_0x5c3c1e);}}; \ No newline at end of file +var _0x3828=['save','remove','emit','removeListener','register','length','faxInteraction:','./faxInteraction.events'];(function(_0x30ca20,_0x50f0ed){var _0x3b7563=function(_0x40a813){while(--_0x40a813){_0x30ca20['push'](_0x30ca20['shift']());}};_0x3b7563(++_0x50f0ed);}(_0x3828,0x1bf));var _0x8382=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x3828[_0x18ab2a];return _0x16dcee;};'use strict';var FaxInteractionEvents=require(_0x8382('0x0'));var events=[_0x8382('0x1'),_0x8382('0x2'),'update'];function createListener(_0x58fe74,_0x1141c6){return function(_0x355dc3){_0x1141c6[_0x8382('0x3')](_0x58fe74,_0x355dc3);};}function removeListener(_0x42f4ac,_0x4d6058){return function(){FaxInteractionEvents[_0x8382('0x4')](_0x42f4ac,_0x4d6058);};}exports[_0x8382('0x5')]=function(_0x36335a){for(var _0x48189e=0x0,_0x4f760d=events[_0x8382('0x6')];_0x48189e<_0x4f760d;_0x48189e++){var _0x273552=events[_0x48189e];var _0x1f38a2=createListener(_0x8382('0x7')+_0x273552,_0x36335a);FaxInteractionEvents['on'](_0x273552,_0x1f38a2);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 25cbcfc..2c83138 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 _0x5d66=['exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./faxInteraction.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/messages','/:id/download','post','create','addMessage','/:id/tags','tracked','fax','faxinteraction:addtags','addTags','put','faxinteraction:update','update','delete','faxinteraction:destroy','destroy','removeTags'];(function(_0x2509c2,_0x9831bc){var _0x21ad8a=function(_0xb02424){while(--_0xb02424){_0x2509c2['push'](_0x2509c2['shift']());}};_0x21ad8a(++_0x9831bc);}(_0x5d66,0x109));var _0x65d6=function(_0x2549f4,_0x643407){_0x2549f4=_0x2549f4-0x0;var _0x459936=_0x5d66[_0x2549f4];return _0x459936;};'use strict';var multer=require(_0x65d6('0x0'));var util=require('util');var path=require(_0x65d6('0x1'));var timeout=require(_0x65d6('0x2'));var express=require(_0x65d6('0x3'));var router=express[_0x65d6('0x4')]();var auth=require(_0x65d6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65d6('0x6'));var controller=require(_0x65d6('0x7'));router[_0x65d6('0x8')]('/',auth[_0x65d6('0x9')](),controller[_0x65d6('0xa')]);router[_0x65d6('0x8')](_0x65d6('0xb'),auth[_0x65d6('0x9')](),controller[_0x65d6('0xc')]);router[_0x65d6('0x8')](_0x65d6('0xd'),auth[_0x65d6('0x9')](),controller[_0x65d6('0xe')]);router[_0x65d6('0x8')](_0x65d6('0xf'),auth['isAuthenticated'](),controller['getMessages']);router[_0x65d6('0x8')](_0x65d6('0x10'),auth[_0x65d6('0x9')](),controller['download']);router[_0x65d6('0x11')]('/',auth['isAuthenticated'](),controller[_0x65d6('0x12')]);router['post'](_0x65d6('0xf'),auth[_0x65d6('0x9')](),controller[_0x65d6('0x13')]);router[_0x65d6('0x11')](_0x65d6('0x14'),auth[_0x65d6('0x9')](),interaction[_0x65d6('0x15')](_0x65d6('0x16'),_0x65d6('0x17')),controller[_0x65d6('0x18')]);router[_0x65d6('0x19')](_0x65d6('0xd'),auth[_0x65d6('0x9')](),interaction[_0x65d6('0x15')](_0x65d6('0x16'),_0x65d6('0x1a')),controller[_0x65d6('0x1b')]);router[_0x65d6('0x1c')](_0x65d6('0xd'),auth[_0x65d6('0x9')](),interaction[_0x65d6('0x15')](_0x65d6('0x16'),_0x65d6('0x1d')),controller[_0x65d6('0x1e')]);router[_0x65d6('0x1c')](_0x65d6('0x14'),auth['isAuthenticated'](),controller[_0x65d6('0x1f')]);module[_0x65d6('0x20')]=router; \ No newline at end of file +var _0xebbd=['isAuthenticated','index','/describe','describe','/:id','show','getMessages','/:id/download','download','post','addMessage','/:id/tags','fax','faxinteraction:addtags','put','tracked','faxinteraction:update','update','delete','faxinteraction:destroy','removeTags','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xebbd,0x196));var _0xdebb=function(_0x3ee91e,_0x466a5a){_0x3ee91e=_0x3ee91e-0x0;var _0x239405=_0xebbd[_0x3ee91e];return _0x239405;};'use strict';var multer=require('multer');var util=require(_0xdebb('0x0'));var path=require(_0xdebb('0x1'));var timeout=require(_0xdebb('0x2'));var express=require(_0xdebb('0x3'));var router=express[_0xdebb('0x4')]();var auth=require(_0xdebb('0x5'));var interaction=require(_0xdebb('0x6'));var config=require(_0xdebb('0x7'));var controller=require(_0xdebb('0x8'));router[_0xdebb('0x9')]('/',auth[_0xdebb('0xa')](),controller[_0xdebb('0xb')]);router[_0xdebb('0x9')](_0xdebb('0xc'),auth[_0xdebb('0xa')](),controller[_0xdebb('0xd')]);router[_0xdebb('0x9')](_0xdebb('0xe'),auth[_0xdebb('0xa')](),controller[_0xdebb('0xf')]);router[_0xdebb('0x9')]('/:id/messages',auth[_0xdebb('0xa')](),controller[_0xdebb('0x10')]);router['get'](_0xdebb('0x11'),auth[_0xdebb('0xa')](),controller[_0xdebb('0x12')]);router['post']('/',auth[_0xdebb('0xa')](),controller['create']);router[_0xdebb('0x13')]('/:id/messages',auth[_0xdebb('0xa')](),controller[_0xdebb('0x14')]);router['post'](_0xdebb('0x15'),auth[_0xdebb('0xa')](),interaction['tracked'](_0xdebb('0x16'),_0xdebb('0x17')),controller['addTags']);router[_0xdebb('0x18')](_0xdebb('0xe'),auth['isAuthenticated'](),interaction[_0xdebb('0x19')]('fax',_0xdebb('0x1a')),controller[_0xdebb('0x1b')]);router[_0xdebb('0x1c')]('/:id',auth['isAuthenticated'](),interaction[_0xdebb('0x19')](_0xdebb('0x16'),_0xdebb('0x1d')),controller['destroy']);router[_0xdebb('0x1c')](_0xdebb('0x15'),auth[_0xdebb('0xa')](),controller[_0xdebb('0x1e')]);module[_0xdebb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3ac0793..e77a074 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 _0x5579=['sequelize','exports','TEXT','medium','out','DATE'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x5579,0x90));var _0x9557=function(_0x4357dc,_0x555013){_0x4357dc=_0x4357dc-0x0;var _0x255285=_0x5579[_0x4357dc];return _0x255285;};'use strict';var Sequelize=require(_0x9557('0x0'));module[_0x9557('0x1')]={'body':{'type':Sequelize[_0x9557('0x2')](_0x9557('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in',_0x9557('0x4')),'defaultValue':'out','allowNull':![]},'failMessage':{'type':Sequelize[_0x9557('0x2')],'defaultValue':null},'readAt':{'type':Sequelize[_0x9557('0x5')]}}; \ No newline at end of file +var _0xb6fa=['TEXT','medium','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x4f83ca,_0x46f67a){var _0x1fbac3=function(_0x19e401){while(--_0x19e401){_0x4f83ca['push'](_0x4f83ca['shift']());}};_0x1fbac3(++_0x46f67a);}(_0xb6fa,0xae));var _0xab6f=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xb6fa[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0xab6f('0x0'));module['exports']={'body':{'type':Sequelize[_0xab6f('0x1')](_0xab6f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xab6f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xab6f('0x4')]('in',_0xab6f('0x5')),'defaultValue':_0xab6f('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xab6f('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xab6f('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index acb8ac9..763158a 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 _0xb10b=['read1stAt','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','manual','interface','channel','EventManager','acceptmessage','fax','agent','FaxInteractionId','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','event','create','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','join','root','server','attachments','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','redis','defaults','localhost','socket.io-emitter','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','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','update','stack','name','send','index','FaxMessage','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','params','includeAll','include','find','body','destroy','describe','fax-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','FaxInteraction','isNil'];(function(_0x275566,_0x5a87a7){var _0x13a58c=function(_0x3c12da){while(--_0x3c12da){_0x275566['push'](_0x275566['shift']());}};_0x13a58c(++_0x5a87a7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4a7fd1,_0x4bdde1){_0x4a7fd1=_0x4a7fd1-0x0;var _0x12ef10=_0xb10b[_0x4a7fd1];return _0x12ef10;};'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'];config[_0xbb10('0x18')]=_[_0xbb10('0x19')](config[_0xbb10('0x18')],{'host':_0xbb10('0x1a'),'port':0x18eb});var socket=require(_0xbb10('0x1b'))(new Redis(config[_0xbb10('0x18')]));require('./faxMessage.socket')[_0xbb10('0x1c')](socket);var jayson=require(_0xbb10('0x1d'));var client=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232c});var client9002=jayson[_0xbb10('0x1e')][_0xbb10('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x24a57b,_0x36b5e8,_0x3e26f4){if(_0x3e26f4){var _0x2b184e=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2b184e['test'](_0x36b5e8)){return _0x24a57b;}else{throw new db[(_0xbb10('0x20'))][(_0xbb10('0x21'))](_0xbb10('0x22'));}}else{return _0x24a57b;}}function respondWithRpcPromise(_0x42db98,_0x378da8,_0x1682a4,_0x575cca){return new BPromise(function(_0x30efc6,_0xbf2906){var _0xe1c665=_0x575cca||client;return _0xe1c665['request'](_0x42db98,_0x1682a4)[_0xbb10('0x23')](function(_0x19f48d){logger[_0xbb10('0x24')](_0xbb10('0x25'),_0x378da8,_0xbb10('0x26'));logger[_0xbb10('0x27')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'),JSON[_0xbb10('0x28')](_0x19f48d));if(_0x19f48d['error']){if(_0x19f48d['error'][_0xbb10('0x29')]===0x1f4){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0xbf2906(_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);}logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x19f48d[_0xbb10('0x2a')][_0xbb10('0x2b')]);return _0x30efc6(_0x19f48d[_0xbb10('0x2a')]['message']);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x378da8,_0xbb10('0x26'));_0x30efc6(_0x19f48d[_0xbb10('0x2c')][_0xbb10('0x2b')]);}})['catch'](function(_0x2fdde9){logger[_0xbb10('0x2a')](_0xbb10('0x25'),_0x378da8,_0x2fdde9);_0xbf2906(_0x2fdde9);});});}function respondWithStatusCode(_0x1d5e95,_0x1acce9){_0x1acce9=_0x1acce9||0xcc;return function(_0x20d946){if(_0x20d946){return _0x1d5e95[_0xbb10('0x2d')](_0x1acce9);}return _0x1d5e95['status'](_0x1acce9)[_0xbb10('0x2e')]();};}function respondWithResult(_0x21ac54,_0xfc3595){_0xfc3595=_0xfc3595||0xc8;return function(_0x2e0249){if(_0x2e0249){return _0x21ac54[_0xbb10('0x2f')](_0xfc3595)[_0xbb10('0x30')](_0x2e0249);}};}function respondWithFilteredResult(_0x5d5c80,_0x221624){return function(_0x4ee02e){if(_0x4ee02e){var _0x448d5c=_0x4ee02e[_0xbb10('0x31')],_0x56f2da=_0x221624['offset'],_0x16ad2a=_0x221624['offset']+_0x221624[_0xbb10('0x32')],_0x1dcc9c;if(_0x16ad2a>=_0x448d5c){_0x16ad2a=_0x448d5c;_0x1dcc9c=0xc8;}else{_0x1dcc9c=0xce;}_0x5d5c80[_0xbb10('0x2f')](_0x1dcc9c);return _0x5d5c80['set'](_0xbb10('0x33'),_0x56f2da+'-'+_0x16ad2a+'/'+_0x448d5c)[_0xbb10('0x30')](_0x4ee02e);}return null;};}function patchUpdates(_0x2f653f){return function(_0x1c0b57){try{jsonpatch[_0xbb10('0x34')](_0x1c0b57,_0x2f653f,!![]);}catch(_0x138bc6){return BPromise[_0xbb10('0x35')](_0x138bc6);}return _0x1c0b57['save']();};}function saveUpdates(_0x25acb3,_0x1da9c9){return function(_0x441d15){if(_0x441d15){return _0x441d15[_0xbb10('0x36')](_0x25acb3)[_0xbb10('0x23')](function(_0x9de708){return _0x9de708;});}return null;};}function removeEntity(_0x188cbd,_0x10202c){return function(_0x3c8d7d){if(_0x3c8d7d){return _0x3c8d7d['destroy']()[_0xbb10('0x23')](function(){_0x188cbd[_0xbb10('0x2f')](0xcc)[_0xbb10('0x2e')]();});}};}function handleEntityNotFound(_0x3c3c45,_0x570f5a){return function(_0x111762){if(!_0x111762){_0x3c3c45['sendStatus'](0x194);}return _0x111762;};}function handleError(_0x4e2754,_0x3eb3cc){_0x3eb3cc=_0x3eb3cc||0x1f4;return function(_0x40c164){logger[_0xbb10('0x2a')](_0x40c164[_0xbb10('0x37')]);if(_0x40c164[_0xbb10('0x38')]){delete _0x40c164[_0xbb10('0x38')];}_0x4e2754['status'](_0x3eb3cc)[_0xbb10('0x39')](_0x40c164);};}exports[_0xbb10('0x3a')]=function(_0x52de31,_0x5e3fbd){var _0x5cd55f={},_0x31bee3={},_0x2b0b45={'count':0x0,'rows':[]};var _0x2b658a=_['map'](db[_0xbb10('0x3b')][_0xbb10('0x3c')],function(_0x4345f3){return{'name':_0x4345f3['fieldName'],'type':_0x4345f3[_0xbb10('0x3d')][_0xbb10('0x3e')]};});_0x31bee3[_0xbb10('0x3f')]=_[_0xbb10('0x40')](_0x2b658a,'name');_0x31bee3[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x52de31['query']);_0x31bee3[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x31bee3[_0xbb10('0x3f')],_0x31bee3[_0xbb10('0x41')]);_0x5cd55f[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x31bee3['model'],qs[_0xbb10('0x46')](_0x52de31[_0xbb10('0x41')][_0xbb10('0x46')]));_0x5cd55f[_0xbb10('0x45')]=_0x5cd55f['attributes'][_0xbb10('0x47')]?_0x5cd55f[_0xbb10('0x45')]:_0x31bee3[_0xbb10('0x3f')];if(!_0x52de31[_0xbb10('0x41')]['hasOwnProperty'](_0xbb10('0x48'))){_0x5cd55f[_0xbb10('0x32')]=qs['limit'](_0x52de31['query'][_0xbb10('0x32')]);_0x5cd55f['offset']=qs[_0xbb10('0x49')](_0x52de31[_0xbb10('0x41')]['offset']);}_0x5cd55f[_0xbb10('0x4a')]=qs[_0xbb10('0x4b')](_0x52de31[_0xbb10('0x41')]['sort']);_0x5cd55f[_0xbb10('0x4c')]=qs[_0xbb10('0x43')](_[_0xbb10('0x4d')](_0x52de31[_0xbb10('0x41')],_0x31bee3[_0xbb10('0x43')]));if(_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]){_0x5cd55f[_0xbb10('0x4c')]=_[_0xbb10('0x4f')](_0x5cd55f[_0xbb10('0x4c')],{'$or':_[_0xbb10('0x40')](_0x2b658a,function(_0x1eadd2){if(_0x1eadd2['type']!==_0xbb10('0x50')){var _0x41bbf8={};_0x41bbf8[_0x1eadd2['name']]={'$like':'%'+_0x52de31[_0xbb10('0x41')][_0xbb10('0x4e')]+'%'};return _0x41bbf8;}})});}_0x5cd55f=_[_0xbb10('0x4f')]({},_0x5cd55f,_0x52de31[_0xbb10('0x51')]);var _0x41ea91={'where':_0x5cd55f[_0xbb10('0x4c')]};return db[_0xbb10('0x3b')]['count'](_0x41ea91)['then'](function(_0xcb3354){_0x2b0b45[_0xbb10('0x31')]=_0xcb3354;if(_0x52de31[_0xbb10('0x41')]['includeAll']){_0x5cd55f['include']=[{'all':!![]}];}return db[_0xbb10('0x3b')][_0xbb10('0x52')](_0x5cd55f);})[_0xbb10('0x23')](function(_0xf820fe){_0x2b0b45[_0xbb10('0x53')]=_0xf820fe;return _0x2b0b45;})[_0xbb10('0x23')](respondWithFilteredResult(_0x5e3fbd,_0x5cd55f))[_0xbb10('0x54')](handleError(_0x5e3fbd,null));};exports[_0xbb10('0x55')]=function(_0x2626d8,_0x3d7e7e){var _0x550111={'raw':!![],'where':{'id':_0x2626d8[_0xbb10('0x56')]['id']}},_0x5eafac={};_0x5eafac[_0xbb10('0x3f')]=_[_0xbb10('0x42')](db[_0xbb10('0x3b')][_0xbb10('0x3c')]);_0x5eafac[_0xbb10('0x41')]=_[_0xbb10('0x42')](_0x2626d8[_0xbb10('0x41')]);_0x5eafac[_0xbb10('0x43')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],_0x5eafac[_0xbb10('0x41')]);_0x550111[_0xbb10('0x45')]=_[_0xbb10('0x44')](_0x5eafac[_0xbb10('0x3f')],qs['fields'](_0x2626d8[_0xbb10('0x41')]['fields']));_0x550111[_0xbb10('0x45')]=_0x550111[_0xbb10('0x45')][_0xbb10('0x47')]?_0x550111[_0xbb10('0x45')]:_0x5eafac[_0xbb10('0x3f')];if(_0x2626d8[_0xbb10('0x41')][_0xbb10('0x57')]){_0x550111[_0xbb10('0x58')]=[{'all':!![]}];}_0x550111=_[_0xbb10('0x4f')]({},_0x550111,_0x2626d8[_0xbb10('0x51')]);return db[_0xbb10('0x3b')][_0xbb10('0x59')](_0x550111)[_0xbb10('0x23')](handleEntityNotFound(_0x3d7e7e,null))[_0xbb10('0x23')](respondWithResult(_0x3d7e7e,null))[_0xbb10('0x54')](handleError(_0x3d7e7e,null));};exports['update']=function(_0x4571b6,_0x466eb7){if(_0x4571b6[_0xbb10('0x5a')]['id']){delete _0x4571b6[_0xbb10('0x5a')]['id'];}return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x4571b6['params']['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x466eb7,null))[_0xbb10('0x23')](saveUpdates(_0x4571b6[_0xbb10('0x5a')],null))[_0xbb10('0x23')](respondWithResult(_0x466eb7,null))[_0xbb10('0x54')](handleError(_0x466eb7,null));};exports[_0xbb10('0x5b')]=function(_0x175872,_0x12ec18){return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x175872[_0xbb10('0x56')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x12ec18,null))[_0xbb10('0x23')](removeEntity(_0x12ec18,null))['catch'](handleError(_0x12ec18,null));};exports['describe']=function(_0x16272d,_0x3e6338){return db[_0xbb10('0x3b')][_0xbb10('0x5c')]()['then'](respondWithResult(_0x3e6338,null))['catch'](handleError(_0x3e6338,null));};var interaction_log=require(_0xbb10('0x15'))(_0xbb10('0x5d'));exports[_0xbb10('0x5e')]=function(_0x2dd150,_0x412f13,_0x3e9753){var _0x45c0dc={'channel':'fax'};if(_0x2dd150[_0xbb10('0x5a')]['id']){delete _0x2dd150[_0xbb10('0x5a')]['id'];}_0x2dd150['body']['read']=!![];_0x2dd150['body'][_0xbb10('0x5f')]=moment()[_0xbb10('0x60')](_0xbb10('0x61'));_0x2dd150['body']['UserId']=_0x2dd150['body'][_0xbb10('0x62')]||_0x2dd150[_0xbb10('0x63')]['id'];return db[_0xbb10('0x3b')]['find']({'where':{'id':_0x2dd150[_0xbb10('0x56')]['id'],'UserId':null},'include':[{'model':db[_0xbb10('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](saveUpdates(_0x2dd150[_0xbb10('0x5a')],null))[_0xbb10('0x23')](function(_0x237246){if(_0x237246){_0x45c0dc['message']=_0x237246[_0xbb10('0x65')]({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x237246['FaxInteractionId']}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0x412f13,null))[_0xbb10('0x23')](function(_0x3e3617){if(_0x3e3617){return _0x3e3617['update']({'UserId':_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x62')],'read1stAt':_[_0xbb10('0x67')](_0x3e3617[_0xbb10('0x68')])?moment()['format'](_0xbb10('0x61')):undefined});}return null;})[_0xbb10('0x23')](function(_0x108e5b){if(_0x108e5b){_0x45c0dc[_0xbb10('0x69')]=_0x108e5b['get']({'plain':!![]});interaction_log[_0xbb10('0x24')](_0xbb10('0x6a'),_0x2dd150[_0xbb10('0x63')]['id'],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')],_0x2dd150[_0xbb10('0x63')][_0xbb10('0x6b')],_0x45c0dc['interaction']['id'],_0x2dd150['body']?JSON['stringify'](_0x2dd150[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x6d'),'acceptMessage',_0x45c0dc);}return null;})['then'](function(_0x46f462){if(_0x46f462){if(_0x2dd150[_0xbb10('0x5a')][_0xbb10('0x6e')]){_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x2dd150[_0xbb10('0x63')][_0xbb10('0x38')]);_0x45c0dc[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x45c0dc[_0xbb10('0x70')];_0x45c0dc['message']['event']='accept';return respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':_0xbb10('0x72'),'message':_0x45c0dc[_0xbb10('0x2b')]},client9002)[_0xbb10('0x23')](function(){return _0x45c0dc;});}return _0x45c0dc;}return null;})[_0xbb10('0x23')](respondWithResult(_0x412f13,null))['catch'](handleError(_0x412f13,null));};var interaction_log=require(_0xbb10('0x15'))('fax-interactions');exports['reject']=function(_0x519a54,_0xdf634f,_0x13040d){var _0x23b1d5={'agent':{},'channel':_0xbb10('0x73')};if(_0x519a54['body']['id']){delete _0x519a54[_0xbb10('0x5a')]['id'];}_0x519a54['body']['UserId']=_0x519a54[_0xbb10('0x5a')][_0xbb10('0x62')]||_0x519a54[_0xbb10('0x63')]['id'];_0x23b1d5[_0xbb10('0x74')]['id']=_0x519a54[_0xbb10('0x5a')]['UserId'];return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x519a54[_0xbb10('0x56')]['id'],'UserId':null}})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x27f42f){if(_0x27f42f){_0x23b1d5[_0xbb10('0x2b')]=_0x27f42f['get']({'plain':!![]});return db[_0xbb10('0x66')][_0xbb10('0x59')]({'where':{'id':_0x27f42f[_0xbb10('0x75')]}});}return null;})[_0xbb10('0x23')](handleEntityNotFound(_0xdf634f,null))[_0xbb10('0x23')](function(_0x172be3){if(_0x172be3){_0x23b1d5[_0xbb10('0x69')]=_0x172be3[_0xbb10('0x65')]({'plain':!![]});interaction_log['info'](_0xbb10('0x76'),_0x519a54[_0xbb10('0x63')]['id'],_0x519a54[_0xbb10('0x63')]['name'],_0x519a54['user']['role'],_0x23b1d5[_0xbb10('0x69')]['id'],_0x519a54['body']?JSON['stringify'](_0x519a54[_0xbb10('0x5a')]):_0xbb10('0x6c'));return respondWithRpcPromise(_0xbb10('0x77'),_0xbb10('0x78'),_0x23b1d5);}return null;})[_0xbb10('0x23')](function(_0x24dca6){if(_0x24dca6){_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x6f')]=util[_0xbb10('0x60')]('SIP/%s',_0x519a54[_0xbb10('0x63')][_0xbb10('0x38')]);_0x24dca6[_0xbb10('0x2b')][_0xbb10('0x70')]=_0x23b1d5['channel'];_0x24dca6['message'][_0xbb10('0x79')]=_0xbb10('0x35');respondWithRpcPromise(_0xbb10('0x71'),_0xbb10('0x71'),{'event':'rejectmessage','message':_0x24dca6[_0xbb10('0x2b')]},client9002);return _0x23b1d5;}return null;})[_0xbb10('0x23')](respondWithResult(_0xdf634f,null))[_0xbb10('0x54')](handleError(_0xdf634f,null));};exports[_0xbb10('0x7a')]=function(_0x35c1e8,_0x517185){var _0x5f0691;return db[_0xbb10('0x3b')][_0xbb10('0x7a')](_0x35c1e8[_0xbb10('0x5a')],{})['then'](function(_0x256b35){_0x5f0691=_0x256b35;return db[_0xbb10('0x64')]['findOne']({'where':{'id':_0x5f0691['ContactId']}});})[_0xbb10('0x23')](function(_0x26d0dd){if(_[_0xbb10('0x67')](_0x26d0dd)){return;}else{_0x5f0691['fax']=_0x26d0dd[_0xbb10('0x73')];return db[_0xbb10('0x7b')][_0xbb10('0x7c')]({'where':{'id':_0x5f0691[_0xbb10('0x7d')]}});}})[_0xbb10('0x23')](function(_0x5de006){return respondWithRpcPromise(_0xbb10('0x7e'),_0xbb10('0x7e'),{'FaxAccountId':_[_0xbb10('0x67')](_0x35c1e8['body'])?undefined:_0x35c1e8[_0xbb10('0x5a')][_0xbb10('0x7f')],'path':_[_0xbb10('0x67')](_0x5de006)?undefined:util[_0xbb10('0x60')](_0xbb10('0x80'),_0x5de006[_0xbb10('0x81')]),'fax':_[_0xbb10('0x67')](_0x5f0691[_0xbb10('0x73')])?undefined:_0x5f0691[_0xbb10('0x73')],'AttachmentId':_0x5f0691[_0xbb10('0x7d')]},client9002);})[_0xbb10('0x23')](respondWithResult(_0x517185,0xc9))[_0xbb10('0x54')](handleError(_0x517185,null));};exports['download']=function(_0x51f106,_0xe1fc51){var _0x3fa344=path[_0xbb10('0x82')](config[_0xbb10('0x83')],_0xbb10('0x84'),'files',_0xbb10('0x85'));return db[_0xbb10('0x3b')][_0xbb10('0x59')]({'where':{'id':_0x51f106[_0xbb10('0x56')]['id']},'include':[{'model':db[_0xbb10('0x7b')],'as':_0xbb10('0x7b')}]})['then'](handleEntityNotFound(_0xe1fc51,null))[_0xbb10('0x23')](function(_0x742e10){if(_0x742e10){return _0xe1fc51['download'](path[_0xbb10('0x82')](_0x3fa344,_0x742e10['Attachment'][_0xbb10('0x81')]));}})[_0xbb10('0x54')](handleError(_0xe1fc51,null));}; \ No newline at end of file +var _0xa9e0=['format','get','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','AcceptMessage','acceptMessage','interface','channel','event','agent','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','EventManager','rejectmessage','create','findOne','AttachmentId','SendFax','/var/opt/motion2/server/files/attachments/%s','basename','join','server','files','attachments','Attachment','download','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','redis','defaults','localhost','socket.io-emitter','./faxMessage.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','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','error','message','result','catch','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','stack','index','map','rawAttributes','fieldName','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','name','options','FaxMessage','includeAll','include','findAll','rows','show','intersection','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','FaxInteraction','isNil','read1stAt'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require(_0x0a9e('0x0'));var emlformat=require(_0x0a9e('0x1'));var rimraf=require(_0x0a9e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0a9e('0x3'));var moment=require('moment');var BPromise=require(_0x0a9e('0x4'));var Mustache=require(_0x0a9e('0x5'));var util=require(_0x0a9e('0x6'));var path=require(_0x0a9e('0x7'));var sox=require(_0x0a9e('0x8'));var csv=require('to-csv');var ejs=require(_0x0a9e('0x9'));var fs=require('fs');var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0a9e('0x13'))['db'];config[_0x0a9e('0x14')]=_[_0x0a9e('0x15')](config[_0x0a9e('0x14')],{'host':_0x0a9e('0x16'),'port':0x18eb});var socket=require(_0x0a9e('0x17'))(new Redis(config['redis']));require(_0x0a9e('0x18'))[_0x0a9e('0x19')](socket);var jayson=require(_0x0a9e('0x1a'));var client=jayson[_0x0a9e('0x1b')][_0x0a9e('0x1c')]({'port':0x232c});var client9002=jayson[_0x0a9e('0x1b')]['http']({'port':0x232a});function checkPasswordPattern(_0x22dccb,_0x5d0880,_0x1985b6){if(_0x1985b6){var _0x519dfd=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x519dfd[_0x0a9e('0x1d')](_0x5d0880)){return _0x22dccb;}else{throw new db[(_0x0a9e('0x1e'))]['ValidationError'](_0x0a9e('0x1f'));}}else{return _0x22dccb;}}function respondWithRpcPromise(_0x5a0a06,_0x459eb1,_0x478723,_0x106033){return new BPromise(function(_0x205fd6,_0x31b1ca){var _0x2eb11f=_0x106033||client;return _0x2eb11f[_0x0a9e('0x20')](_0x5a0a06,_0x478723)[_0x0a9e('0x21')](function(_0x1314ae){logger[_0x0a9e('0x22')](_0x0a9e('0x23'),_0x459eb1,_0x0a9e('0x24'));logger['debug'](_0x0a9e('0x25'),_0x459eb1,_0x0a9e('0x24'),JSON['stringify'](_0x1314ae));if(_0x1314ae[_0x0a9e('0x26')]){if(_0x1314ae['error']['code']===0x1f4){logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x31b1ca(_0x1314ae['error'][_0x0a9e('0x27')]);}logger[_0x0a9e('0x26')](_0x0a9e('0x23'),_0x459eb1,_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);return _0x205fd6(_0x1314ae[_0x0a9e('0x26')][_0x0a9e('0x27')]);}else{logger['info']('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x0a9e('0x24'));_0x205fd6(_0x1314ae[_0x0a9e('0x28')][_0x0a9e('0x27')]);}})[_0x0a9e('0x29')](function(_0x526cf3){logger[_0x0a9e('0x26')]('FaxMessage,\x20%s,\x20%s',_0x459eb1,_0x526cf3);_0x31b1ca(_0x526cf3);});});}function respondWithStatusCode(_0x45a1e7,_0x5bfb33){_0x5bfb33=_0x5bfb33||0xcc;return function(_0x1dc186){if(_0x1dc186){return _0x45a1e7[_0x0a9e('0x2a')](_0x5bfb33);}return _0x45a1e7[_0x0a9e('0x2b')](_0x5bfb33)[_0x0a9e('0x2c')]();};}function respondWithResult(_0x140511,_0x1538a4){_0x1538a4=_0x1538a4||0xc8;return function(_0x11c3b6){if(_0x11c3b6){return _0x140511[_0x0a9e('0x2b')](_0x1538a4)['json'](_0x11c3b6);}};}function respondWithFilteredResult(_0x3652a7,_0x468813){return function(_0x2b1f27){if(_0x2b1f27){var _0x2ec755=_0x2b1f27[_0x0a9e('0x2d')],_0x5c877d=_0x468813[_0x0a9e('0x2e')],_0x15b200=_0x468813[_0x0a9e('0x2e')]+_0x468813[_0x0a9e('0x2f')],_0x40e7a3;if(_0x15b200>=_0x2ec755){_0x15b200=_0x2ec755;_0x40e7a3=0xc8;}else{_0x40e7a3=0xce;}_0x3652a7[_0x0a9e('0x2b')](_0x40e7a3);return _0x3652a7[_0x0a9e('0x30')](_0x0a9e('0x31'),_0x5c877d+'-'+_0x15b200+'/'+_0x2ec755)['json'](_0x2b1f27);}return null;};}function patchUpdates(_0x426950){return function(_0x5d1e0e){try{jsonpatch[_0x0a9e('0x32')](_0x5d1e0e,_0x426950,!![]);}catch(_0x3ae878){return BPromise[_0x0a9e('0x33')](_0x3ae878);}return _0x5d1e0e[_0x0a9e('0x34')]();};}function saveUpdates(_0x25ce3a,_0x5180f1){return function(_0x66c1d2){if(_0x66c1d2){return _0x66c1d2[_0x0a9e('0x35')](_0x25ce3a)[_0x0a9e('0x21')](function(_0x2da5c0){return _0x2da5c0;});}return null;};}function removeEntity(_0x2b45ea,_0x409319){return function(_0x332d35){if(_0x332d35){return _0x332d35[_0x0a9e('0x36')]()['then'](function(){_0x2b45ea[_0x0a9e('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2cc7a0,_0x14b13f){return function(_0x2b7e7f){if(!_0x2b7e7f){_0x2cc7a0[_0x0a9e('0x2a')](0x194);}return _0x2b7e7f;};}function handleError(_0x567193,_0x191e91){_0x191e91=_0x191e91||0x1f4;return function(_0xd1836d){logger[_0x0a9e('0x26')](_0xd1836d[_0x0a9e('0x37')]);if(_0xd1836d['name']){delete _0xd1836d['name'];}_0x567193[_0x0a9e('0x2b')](_0x191e91)['send'](_0xd1836d);};}exports[_0x0a9e('0x38')]=function(_0x3d9717,_0x381c37){var _0x1ef87a={},_0x4f41ae={},_0x31916f={'count':0x0,'rows':[]};var _0x3bfce8=_[_0x0a9e('0x39')](db['FaxMessage'][_0x0a9e('0x3a')],function(_0x1a180b){return{'name':_0x1a180b[_0x0a9e('0x3b')],'type':_0x1a180b['type']['key']};});_0x4f41ae[_0x0a9e('0x3c')]=_[_0x0a9e('0x39')](_0x3bfce8,'name');_0x4f41ae[_0x0a9e('0x3d')]=_[_0x0a9e('0x3e')](_0x3d9717[_0x0a9e('0x3d')]);_0x4f41ae[_0x0a9e('0x3f')]=_['intersection'](_0x4f41ae['model'],_0x4f41ae[_0x0a9e('0x3d')]);_0x1ef87a[_0x0a9e('0x40')]=_['intersection'](_0x4f41ae[_0x0a9e('0x3c')],qs[_0x0a9e('0x41')](_0x3d9717[_0x0a9e('0x3d')]['fields']));_0x1ef87a[_0x0a9e('0x40')]=_0x1ef87a[_0x0a9e('0x40')][_0x0a9e('0x42')]?_0x1ef87a[_0x0a9e('0x40')]:_0x4f41ae[_0x0a9e('0x3c')];if(!_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x43')](_0x0a9e('0x44'))){_0x1ef87a[_0x0a9e('0x2f')]=qs[_0x0a9e('0x2f')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x2f')]);_0x1ef87a[_0x0a9e('0x2e')]=qs[_0x0a9e('0x2e')](_0x3d9717[_0x0a9e('0x3d')]['offset']);}_0x1ef87a['order']=qs[_0x0a9e('0x45')](_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x45')]);_0x1ef87a[_0x0a9e('0x46')]=qs[_0x0a9e('0x3f')](_[_0x0a9e('0x47')](_0x3d9717[_0x0a9e('0x3d')],_0x4f41ae[_0x0a9e('0x3f')]));if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]){_0x1ef87a[_0x0a9e('0x46')]=_[_0x0a9e('0x49')](_0x1ef87a['where'],{'$or':_[_0x0a9e('0x39')](_0x3bfce8,function(_0x138b8b){if(_0x138b8b[_0x0a9e('0x4a')]!==_0x0a9e('0x4b')){var _0x2e8caf={};_0x2e8caf[_0x138b8b[_0x0a9e('0x4c')]]={'$like':'%'+_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x48')]+'%'};return _0x2e8caf;}})});}_0x1ef87a=_['merge']({},_0x1ef87a,_0x3d9717[_0x0a9e('0x4d')]);var _0x48fd45={'where':_0x1ef87a[_0x0a9e('0x46')]};return db[_0x0a9e('0x4e')][_0x0a9e('0x2d')](_0x48fd45)['then'](function(_0x14bec2){_0x31916f[_0x0a9e('0x2d')]=_0x14bec2;if(_0x3d9717[_0x0a9e('0x3d')][_0x0a9e('0x4f')]){_0x1ef87a[_0x0a9e('0x50')]=[{'all':!![]}];}return db[_0x0a9e('0x4e')][_0x0a9e('0x51')](_0x1ef87a);})['then'](function(_0x13f44d){_0x31916f[_0x0a9e('0x52')]=_0x13f44d;return _0x31916f;})[_0x0a9e('0x21')](respondWithFilteredResult(_0x381c37,_0x1ef87a))[_0x0a9e('0x29')](handleError(_0x381c37,null));};exports[_0x0a9e('0x53')]=function(_0x992c77,_0x6054ee){var _0x19383e={'raw':!![],'where':{'id':_0x992c77['params']['id']}},_0x34febd={};_0x34febd[_0x0a9e('0x3c')]=_[_0x0a9e('0x3e')](db['FaxMessage']['rawAttributes']);_0x34febd['query']=_[_0x0a9e('0x3e')](_0x992c77[_0x0a9e('0x3d')]);_0x34febd[_0x0a9e('0x3f')]=_[_0x0a9e('0x54')](_0x34febd[_0x0a9e('0x3c')],_0x34febd[_0x0a9e('0x3d')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x54')](_0x34febd['model'],qs['fields'](_0x992c77['query'][_0x0a9e('0x41')]));_0x19383e[_0x0a9e('0x40')]=_0x19383e[_0x0a9e('0x40')]['length']?_0x19383e[_0x0a9e('0x40')]:_0x34febd[_0x0a9e('0x3c')];if(_0x992c77['query']['includeAll']){_0x19383e[_0x0a9e('0x50')]=[{'all':!![]}];}_0x19383e=_['merge']({},_0x19383e,_0x992c77[_0x0a9e('0x4d')]);return db['FaxMessage'][_0x0a9e('0x55')](_0x19383e)[_0x0a9e('0x21')](handleEntityNotFound(_0x6054ee,null))[_0x0a9e('0x21')](respondWithResult(_0x6054ee,null))['catch'](handleError(_0x6054ee,null));};exports[_0x0a9e('0x35')]=function(_0x1bf38a,_0x508b47){if(_0x1bf38a['body']['id']){delete _0x1bf38a[_0x0a9e('0x56')]['id'];}return db[_0x0a9e('0x4e')]['find']({'where':{'id':_0x1bf38a[_0x0a9e('0x57')]['id']}})['then'](handleEntityNotFound(_0x508b47,null))[_0x0a9e('0x21')](saveUpdates(_0x1bf38a['body'],null))[_0x0a9e('0x21')](respondWithResult(_0x508b47,null))['catch'](handleError(_0x508b47,null));};exports['destroy']=function(_0x5df0ad,_0x2da03c){return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5df0ad[_0x0a9e('0x57')]['id']}})[_0x0a9e('0x21')](handleEntityNotFound(_0x2da03c,null))[_0x0a9e('0x21')](removeEntity(_0x2da03c,null))[_0x0a9e('0x29')](handleError(_0x2da03c,null));};exports[_0x0a9e('0x58')]=function(_0xd10662,_0x28d814){return db['FaxMessage'][_0x0a9e('0x58')]()[_0x0a9e('0x21')](respondWithResult(_0x28d814,null))[_0x0a9e('0x29')](handleError(_0x28d814,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x5b')]=function(_0x5d86e9,_0x956fbe,_0x26bc80){var _0x5239ef={'channel':_0x0a9e('0x5c')};if(_0x5d86e9['body']['id']){delete _0x5d86e9[_0x0a9e('0x56')]['id'];}_0x5d86e9['body']['read']=!![];_0x5d86e9['body'][_0x0a9e('0x5d')]=moment()['format'](_0x0a9e('0x5e'));_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]=_0x5d86e9[_0x0a9e('0x56')][_0x0a9e('0x5f')]||_0x5d86e9[_0x0a9e('0x60')]['id'];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x5d86e9['params']['id'],'UserId':null},'include':[{'model':db[_0x0a9e('0x61')],'as':_0x0a9e('0x62')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))['then'](saveUpdates(_0x5d86e9[_0x0a9e('0x56')],null))[_0x0a9e('0x21')](function(_0x119677){if(_0x119677){_0x5239ef[_0x0a9e('0x27')]=_0x119677['get']({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x119677['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x956fbe,null))[_0x0a9e('0x21')](function(_0x88dcbf){if(_0x88dcbf){return _0x88dcbf[_0x0a9e('0x35')]({'UserId':_0x5d86e9[_0x0a9e('0x56')]['UserId'],'read1stAt':_[_0x0a9e('0x64')](_0x88dcbf[_0x0a9e('0x65')])?moment()[_0x0a9e('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x0a9e('0x21')](function(_0x4f1e60){if(_0x4f1e60){_0x5239ef['interaction']=_0x4f1e60[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x68'),_0x5d86e9[_0x0a9e('0x60')]['id'],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x69')],_0x5239ef[_0x0a9e('0x6a')]['id'],_0x5d86e9[_0x0a9e('0x56')]?JSON[_0x0a9e('0x6b')](_0x5d86e9[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x6d'),_0x0a9e('0x6e'),_0x5239ef);}return null;})[_0x0a9e('0x21')](function(_0x2a28c0){if(_0x2a28c0){if(_0x5d86e9[_0x0a9e('0x56')]['manual']){_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util[_0x0a9e('0x66')]('SIP/%s',_0x5d86e9[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x5239ef['message'][_0x0a9e('0x70')]=_0x5239ef[_0x0a9e('0x70')];_0x5239ef[_0x0a9e('0x27')][_0x0a9e('0x71')]=_0x0a9e('0x5b');return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0x5239ef[_0x0a9e('0x27')]},client9002)[_0x0a9e('0x21')](function(){return _0x5239ef;});}return _0x5239ef;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x956fbe,null))[_0x0a9e('0x29')](handleError(_0x956fbe,null));};var interaction_log=require(_0x0a9e('0x59'))(_0x0a9e('0x5a'));exports[_0x0a9e('0x33')]=function(_0x1a0677,_0x5512d1,_0x235f8f){var _0xcbc8b2={'agent':{},'channel':_0x0a9e('0x5c')};if(_0x1a0677['body']['id']){delete _0x1a0677[_0x0a9e('0x56')]['id'];}_0x1a0677['body'][_0x0a9e('0x5f')]=_0x1a0677[_0x0a9e('0x56')]['UserId']||_0x1a0677[_0x0a9e('0x60')]['id'];_0xcbc8b2[_0x0a9e('0x72')]['id']=_0x1a0677[_0x0a9e('0x56')][_0x0a9e('0x5f')];return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x1a0677[_0x0a9e('0x57')]['id'],'UserId':null}})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x5b7fc3){if(_0x5b7fc3){_0xcbc8b2[_0x0a9e('0x27')]=_0x5b7fc3[_0x0a9e('0x67')]({'plain':!![]});return db[_0x0a9e('0x63')][_0x0a9e('0x55')]({'where':{'id':_0x5b7fc3['FaxInteractionId']}});}return null;})[_0x0a9e('0x21')](handleEntityNotFound(_0x5512d1,null))[_0x0a9e('0x21')](function(_0x30a4c7){if(_0x30a4c7){_0xcbc8b2[_0x0a9e('0x6a')]=_0x30a4c7[_0x0a9e('0x67')]({'plain':!![]});interaction_log[_0x0a9e('0x22')](_0x0a9e('0x73'),_0x1a0677[_0x0a9e('0x60')]['id'],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')],_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x69')],_0xcbc8b2[_0x0a9e('0x6a')]['id'],_0x1a0677[_0x0a9e('0x56')]?JSON['stringify'](_0x1a0677[_0x0a9e('0x56')]):_0x0a9e('0x6c'));return respondWithRpcPromise(_0x0a9e('0x74'),'rejectMessage',_0xcbc8b2);}return null;})[_0x0a9e('0x21')](function(_0x33dda0){if(_0x33dda0){_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x6f')]=util['format']('SIP/%s',_0x1a0677[_0x0a9e('0x60')][_0x0a9e('0x4c')]);_0x33dda0['message'][_0x0a9e('0x70')]=_0xcbc8b2['channel'];_0x33dda0[_0x0a9e('0x27')][_0x0a9e('0x71')]='reject';respondWithRpcPromise(_0x0a9e('0x75'),_0x0a9e('0x75'),{'event':_0x0a9e('0x76'),'message':_0x33dda0[_0x0a9e('0x27')]},client9002);return _0xcbc8b2;}return null;})[_0x0a9e('0x21')](respondWithResult(_0x5512d1,null))[_0x0a9e('0x29')](handleError(_0x5512d1,null));};exports[_0x0a9e('0x77')]=function(_0x482ca2,_0x2973d3){var _0x3ca9b9;return db[_0x0a9e('0x4e')][_0x0a9e('0x77')](_0x482ca2['body'],{})[_0x0a9e('0x21')](function(_0xf0db1){_0x3ca9b9=_0xf0db1;return db['CmContact'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9['ContactId']}});})[_0x0a9e('0x21')](function(_0x2bb25a){if(_[_0x0a9e('0x64')](_0x2bb25a)){return;}else{_0x3ca9b9[_0x0a9e('0x5c')]=_0x2bb25a['fax'];return db['Attachment'][_0x0a9e('0x78')]({'where':{'id':_0x3ca9b9[_0x0a9e('0x79')]}});}})[_0x0a9e('0x21')](function(_0x5ac73d){return respondWithRpcPromise(_0x0a9e('0x7a'),_0x0a9e('0x7a'),{'FaxAccountId':_['isNil'](_0x482ca2['body'])?undefined:_0x482ca2[_0x0a9e('0x56')]['FaxAccountId'],'path':_['isNil'](_0x5ac73d)?undefined:util['format'](_0x0a9e('0x7b'),_0x5ac73d[_0x0a9e('0x7c')]),'fax':_[_0x0a9e('0x64')](_0x3ca9b9[_0x0a9e('0x5c')])?undefined:_0x3ca9b9[_0x0a9e('0x5c')],'AttachmentId':_0x3ca9b9[_0x0a9e('0x79')]},client9002);})['then'](respondWithResult(_0x2973d3,0xc9))[_0x0a9e('0x29')](handleError(_0x2973d3,null));};exports['download']=function(_0x2871c1,_0x2aabab){var _0x18ad56=path[_0x0a9e('0x7d')](config['root'],_0x0a9e('0x7e'),_0x0a9e('0x7f'),_0x0a9e('0x80'));return db['FaxMessage'][_0x0a9e('0x55')]({'where':{'id':_0x2871c1[_0x0a9e('0x57')]['id']},'include':[{'model':db[_0x0a9e('0x81')],'as':_0x0a9e('0x81')}]})[_0x0a9e('0x21')](handleEntityNotFound(_0x2aabab,null))[_0x0a9e('0x21')](function(_0x32b9bd){if(_0x32b9bd){return _0x2aabab[_0x0a9e('0x82')](path['join'](_0x18ad56,_0x32b9bd[_0x0a9e('0x81')][_0x0a9e('0x7c')]));}})['catch'](handleError(_0x2aabab,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 4fca15b..9313bcb 100644 --- a/server/api/faxMessage/faxMessage.events.js +++ b/server/api/faxMessage/faxMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','FaxMessage','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x5ad792,_0x29bf9a){_0x5ad792=_0x5ad792-0x0;var _0x170baf=_0x3e74[_0x5ad792];return _0x170baf;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x43e7('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){FaxMessageEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);FaxMessageEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=FaxMessageEvents; \ No newline at end of file +var _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x519756,_0x288785){var _0x37047e=function(_0x3d64a7){while(--_0x3d64a7){_0x519756['push'](_0x519756['shift']());}};_0x37047e(++_0x288785);}(_0x55ca,0x126));var _0xa55c=function(_0x59522a,_0x14d1e5){_0x59522a=_0x59522a-0x0;var _0x30f09d=_0x55ca[_0x59522a];return _0x30f09d;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var FaxMessage=require(_0xa55c('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){FaxMessageEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);FaxMessageEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];FaxMessage[_0xa55c('0x6')](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 0c154b2..20a444f 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 _0x9d89=['fax_messages','fti_fax_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','UserId','FaxInteraction','findOne','then','update','createdAt','catch','lodash','../../config/logger','bluebird','request-promise','path','../../config/environment','./faxMessage.attributes','exports','FaxMessage'];(function(_0x4e90f0,_0x3b7e3c){var _0x1a2cee=function(_0xc0c5f5){while(--_0xc0c5f5){_0x4e90f0['push'](_0x4e90f0['shift']());}};_0x1a2cee(++_0x3b7e3c);}(_0x9d89,0x10a));var _0x99d8=function(_0x2f7354,_0x87a86a){_0x2f7354=_0x2f7354-0x0;var _0x49c78b=_0x9d89[_0x2f7354];return _0x49c78b;};'use strict';var _=require(_0x99d8('0x0'));var util=require('util');var logger=require(_0x99d8('0x1'))('api');var moment=require('moment');var BPromise=require(_0x99d8('0x2'));var rp=require(_0x99d8('0x3'));var fs=require('fs');var path=require(_0x99d8('0x4'));var rimraf=require('rimraf');var config=require(_0x99d8('0x5'));var attributes=require(_0x99d8('0x6'));module[_0x99d8('0x7')]=function(_0x2cc7a9,_0x48482f){return _0x2cc7a9['define'](_0x99d8('0x8'),attributes,{'tableName':_0x99d8('0x9'),'paranoid':![],'indexes':[{'name':_0x99d8('0xa'),'fields':[_0x99d8('0xb')],'type':_0x99d8('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x10fbae,_0x2436a6,_0xa6bb3b){var _0x4de827=_0x2cc7a9[_0x99d8('0xd')];var _0x2c7443=_0x10fbae['get']({'plain':!![]});if(_0x2c7443[_0x99d8('0xe')][_0x99d8('0xf')]()==='in'||_0x2c7443[_0x99d8('0xe')][_0x99d8('0xf')]()==='out'&&!_0x2c7443[_0x99d8('0x10')]&&!_[_0x99d8('0x11')](_0x2c7443[_0x99d8('0x12')])){_0x4de827[_0x99d8('0x13')][_0x99d8('0x14')]({'where':{'id':_0x2c7443['FaxInteractionId']}})[_0x99d8('0x15')](function(_0x3f5191){if(_0x3f5191){_0x3f5191[_0x99d8('0x16')]({'lastMsgAt':_0x2c7443[_0x99d8('0x17')],'lastMsgDirection':_0x2c7443[_0x99d8('0xe')][_0x99d8('0xf')]()});}})[_0x99d8('0x18')](function(_0x574ebf){console['error'](_0x574ebf);});}_0xa6bb3b();}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xf278=['rimraf','../../config/environment','exports','define','fti_fax_messages','body','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x3c623f,_0x55efeb){var _0xcd5f57=function(_0x47b121){while(--_0x47b121){_0x3c623f['push'](_0x3c623f['shift']());}};_0xcd5f57(++_0x55efeb);}(_0xf278,0xbd));var _0x8f27=function(_0x282712,_0x489bbe){_0x282712=_0x282712-0x0;var _0xc1c850=_0xf278[_0x282712];return _0xc1c850;};'use strict';var _=require(_0x8f27('0x0'));var util=require(_0x8f27('0x1'));var logger=require('../../config/logger')(_0x8f27('0x2'));var moment=require(_0x8f27('0x3'));var BPromise=require(_0x8f27('0x4'));var rp=require(_0x8f27('0x5'));var fs=require('fs');var path=require(_0x8f27('0x6'));var rimraf=require(_0x8f27('0x7'));var config=require(_0x8f27('0x8'));var attributes=require('./faxMessage.attributes');module[_0x8f27('0x9')]=function(_0x16972e,_0x581339){return _0x16972e[_0x8f27('0xa')]('FaxMessage',attributes,{'tableName':'fax_messages','paranoid':![],'indexes':[{'name':_0x8f27('0xb'),'fields':[_0x8f27('0xc')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x32672b,_0x41514e,_0x49beac){var _0x4bf4e8=_0x16972e['models'];var _0x4f2b3b=_0x32672b[_0x8f27('0xd')]({'plain':!![]});if(_0x4f2b3b[_0x8f27('0xe')][_0x8f27('0xf')]()==='in'||_0x4f2b3b[_0x8f27('0xe')][_0x8f27('0xf')]()===_0x8f27('0x10')&&!_0x4f2b3b['secret']&&!_[_0x8f27('0x11')](_0x4f2b3b[_0x8f27('0x12')])){_0x4bf4e8[_0x8f27('0x13')]['findOne']({'where':{'id':_0x4f2b3b[_0x8f27('0x14')]}})[_0x8f27('0x15')](function(_0x7fd6b8){if(_0x7fd6b8){_0x7fd6b8[_0x8f27('0x16')]({'lastMsgAt':_0x4f2b3b[_0x8f27('0x17')],'lastMsgDirection':_0x4f2b3b[_0x8f27('0xe')][_0x8f27('0xf')]()});}})[_0x8f27('0x18')](function(_0x195517){console[_0x8f27('0x19')](_0x195517);});}_0x49beac();}},'charset':_0x8f27('0x1a'),'collate':_0x8f27('0x1b')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 31e0595..139ab0e 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 _0xfe58=['info','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','FaxMessage,\x20%s,\x20%s','message','catch','CreateFaxMessage','FaxMessage','create','body','options','raw','then','UpdateFaxMessage','update','attributes','limit','stringify','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','register','request'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xfe58,0x1cf));var _0x8fe5=function(_0xc9bb08,_0x3ecfa8){_0xc9bb08=_0xc9bb08-0x0;var _0x350e87=_0xfe58[_0xc9bb08];return _0x350e87;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8fe5('0x0'));var BPromise=require(_0x8fe5('0x1'));var rs=require(_0x8fe5('0x2'));var fs=require('fs');var Redis=require(_0x8fe5('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8fe5('0x4'));var logger=require(_0x8fe5('0x5'))(_0x8fe5('0x6'));var config=require(_0x8fe5('0x7'));var jayson=require(_0x8fe5('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x8fe5('0x9')]=_['defaults'](config[_0x8fe5('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x8fe5('0xa'))(new Redis(config[_0x8fe5('0x9')]));require('./faxMessage.socket')[_0x8fe5('0xb')](socket);function respondWithRpcPromise(_0x11aa2f,_0x2e9c93,_0x4f16b8){return new BPromise(function(_0x4106c9,_0x313cd1){return client[_0x8fe5('0xc')](_0x11aa2f,_0x4f16b8)['then'](function(_0x53d274){logger[_0x8fe5('0xd')]('FaxMessage,\x20%s,\x20%s',_0x2e9c93,'request\x20sent');logger[_0x8fe5('0xe')](_0x8fe5('0xf'),_0x2e9c93,_0x8fe5('0x10'),JSON['stringify'](_0x53d274));if(_0x53d274[_0x8fe5('0x11')]){if(_0x53d274['error'][_0x8fe5('0x12')]===0x1f4){logger[_0x8fe5('0x11')](_0x8fe5('0x13'),_0x2e9c93,_0x53d274['error'][_0x8fe5('0x14')]);return _0x313cd1(_0x53d274[_0x8fe5('0x11')]['message']);}logger[_0x8fe5('0x11')](_0x8fe5('0x13'),_0x2e9c93,_0x53d274['error'][_0x8fe5('0x14')]);return _0x4106c9(_0x53d274[_0x8fe5('0x11')][_0x8fe5('0x14')]);}else{logger['info'](_0x8fe5('0x13'),_0x2e9c93,_0x8fe5('0x10'));_0x4106c9(_0x53d274['result'][_0x8fe5('0x14')]);}})[_0x8fe5('0x15')](function(_0x444f83){logger[_0x8fe5('0x11')](_0x8fe5('0x13'),_0x2e9c93,_0x444f83);_0x313cd1(_0x444f83);});});}exports[_0x8fe5('0x16')]=function(_0x28bac7){var _0x2b1f5e=this;return new Promise(function(_0x5dfc1a,_0x2fe4f2){return db[_0x8fe5('0x17')][_0x8fe5('0x18')](_0x28bac7[_0x8fe5('0x19')],{'raw':_0x28bac7[_0x8fe5('0x1a')]?_0x28bac7['options'][_0x8fe5('0x1b')]===undefined?!![]:![]:!![]})[_0x8fe5('0x1c')](function(_0x298a4a){logger[_0x8fe5('0xd')](_0x8fe5('0x16'),_0x28bac7);logger[_0x8fe5('0xe')](_0x8fe5('0x16'),_0x28bac7,JSON['stringify'](_0x298a4a));_0x5dfc1a(_0x298a4a);})[_0x8fe5('0x15')](function(_0x32adcd){logger['error'](_0x8fe5('0x16'),_0x32adcd[_0x8fe5('0x14')],_0x28bac7);_0x2fe4f2(_0x2b1f5e[_0x8fe5('0x11')](0x1f4,_0x32adcd[_0x8fe5('0x14')]));});});};exports[_0x8fe5('0x1d')]=function(_0x25b246){var _0x5f481c=this;return new Promise(function(_0x41a4f3,_0x2916b8){return db['FaxMessage'][_0x8fe5('0x1e')](_0x25b246[_0x8fe5('0x19')],{'raw':_0x25b246[_0x8fe5('0x1a')]?_0x25b246[_0x8fe5('0x1a')][_0x8fe5('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25b246[_0x8fe5('0x1a')]?_0x25b246[_0x8fe5('0x1a')]['where']||null:null,'attributes':_0x25b246['options']?_0x25b246['options'][_0x8fe5('0x1f')]||null:null,'limit':_0x25b246[_0x8fe5('0x1a')]?_0x25b246[_0x8fe5('0x1a')][_0x8fe5('0x20')]||null:null})[_0x8fe5('0x1c')](function(_0x351a58){logger[_0x8fe5('0xd')](_0x8fe5('0x1d'),_0x25b246);logger[_0x8fe5('0xe')](_0x8fe5('0x1d'),_0x25b246,JSON[_0x8fe5('0x21')](_0x351a58));_0x41a4f3(_0x351a58);})['catch'](function(_0x443645){logger[_0x8fe5('0x11')](_0x8fe5('0x1d'),_0x443645[_0x8fe5('0x14')],_0x25b246);_0x2916b8(_0x5f481c[_0x8fe5('0x11')](0x1f4,_0x443645[_0x8fe5('0x14')]));});});}; \ No newline at end of file +var _0x6e1a=['redis','defaults','localhost','./faxMessage.socket','register','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateFaxMessage','FaxMessage','create','body','options','raw','UpdateFaxMessage','attributes','limit','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x51e1c7,_0x4f19bd){var _0x111e6e=function(_0x5c909b){while(--_0x5c909b){_0x51e1c7['push'](_0x51e1c7['shift']());}};_0x111e6e(++_0x4f19bd);}(_0x6e1a,0xde));var _0xa6e1=function(_0x24450f,_0x5961e9){_0x24450f=_0x24450f-0x0;var _0x13e4bd=_0x6e1a[_0x24450f];return _0x13e4bd;};'use strict';var _=require('lodash');var util=require(_0xa6e1('0x0'));var moment=require(_0xa6e1('0x1'));var BPromise=require(_0xa6e1('0x2'));var rs=require(_0xa6e1('0x3'));var fs=require('fs');var Redis=require(_0xa6e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa6e1('0x5'));var logger=require(_0xa6e1('0x6'))(_0xa6e1('0x7'));var config=require(_0xa6e1('0x8'));var jayson=require(_0xa6e1('0x9'));var client=jayson[_0xa6e1('0xa')][_0xa6e1('0xb')]({'port':0x232a});config[_0xa6e1('0xc')]=_[_0xa6e1('0xd')](config[_0xa6e1('0xc')],{'host':_0xa6e1('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa6e1('0xc')]));require(_0xa6e1('0xf'))[_0xa6e1('0x10')](socket);function respondWithRpcPromise(_0x227f38,_0x18fefb,_0x99559a){return new BPromise(function(_0x5b7248,_0x3e1b00){return client[_0xa6e1('0x11')](_0x227f38,_0x99559a)[_0xa6e1('0x12')](function(_0xcb16c8){logger[_0xa6e1('0x13')](_0xa6e1('0x14'),_0x18fefb,_0xa6e1('0x15'));logger[_0xa6e1('0x16')](_0xa6e1('0x17'),_0x18fefb,_0xa6e1('0x15'),JSON[_0xa6e1('0x18')](_0xcb16c8));if(_0xcb16c8['error']){if(_0xcb16c8[_0xa6e1('0x19')][_0xa6e1('0x1a')]===0x1f4){logger['error'](_0xa6e1('0x14'),_0x18fefb,_0xcb16c8[_0xa6e1('0x19')]['message']);return _0x3e1b00(_0xcb16c8[_0xa6e1('0x19')][_0xa6e1('0x1b')]);}logger[_0xa6e1('0x19')](_0xa6e1('0x14'),_0x18fefb,_0xcb16c8[_0xa6e1('0x19')][_0xa6e1('0x1b')]);return _0x5b7248(_0xcb16c8['error'][_0xa6e1('0x1b')]);}else{logger[_0xa6e1('0x13')](_0xa6e1('0x14'),_0x18fefb,_0xa6e1('0x15'));_0x5b7248(_0xcb16c8[_0xa6e1('0x1c')][_0xa6e1('0x1b')]);}})['catch'](function(_0x3371b0){logger[_0xa6e1('0x19')](_0xa6e1('0x14'),_0x18fefb,_0x3371b0);_0x3e1b00(_0x3371b0);});});}exports[_0xa6e1('0x1d')]=function(_0x14a1b5){var _0x55916c=this;return new Promise(function(_0x2a4edb,_0x27e9a7){return db[_0xa6e1('0x1e')][_0xa6e1('0x1f')](_0x14a1b5[_0xa6e1('0x20')],{'raw':_0x14a1b5[_0xa6e1('0x21')]?_0x14a1b5[_0xa6e1('0x21')][_0xa6e1('0x22')]===undefined?!![]:![]:!![]})[_0xa6e1('0x12')](function(_0x323a9e){logger[_0xa6e1('0x13')](_0xa6e1('0x1d'),_0x14a1b5);logger[_0xa6e1('0x16')]('CreateFaxMessage',_0x14a1b5,JSON['stringify'](_0x323a9e));_0x2a4edb(_0x323a9e);})['catch'](function(_0x46b81f){logger[_0xa6e1('0x19')](_0xa6e1('0x1d'),_0x46b81f[_0xa6e1('0x1b')],_0x14a1b5);_0x27e9a7(_0x55916c[_0xa6e1('0x19')](0x1f4,_0x46b81f[_0xa6e1('0x1b')]));});});};exports[_0xa6e1('0x23')]=function(_0x104afd){var _0x13ef40=this;return new Promise(function(_0x1abfd7,_0x5e46ca){return db[_0xa6e1('0x1e')]['update'](_0x104afd['body'],{'raw':_0x104afd[_0xa6e1('0x21')]?_0x104afd[_0xa6e1('0x21')][_0xa6e1('0x22')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x104afd[_0xa6e1('0x21')]?_0x104afd[_0xa6e1('0x21')]['where']||null:null,'attributes':_0x104afd[_0xa6e1('0x21')]?_0x104afd[_0xa6e1('0x21')][_0xa6e1('0x24')]||null:null,'limit':_0x104afd[_0xa6e1('0x21')]?_0x104afd['options'][_0xa6e1('0x25')]||null:null})['then'](function(_0x3e25ad){logger[_0xa6e1('0x13')](_0xa6e1('0x23'),_0x104afd);logger[_0xa6e1('0x16')](_0xa6e1('0x23'),_0x104afd,JSON[_0xa6e1('0x18')](_0x3e25ad));_0x1abfd7(_0x3e25ad);})[_0xa6e1('0x26')](function(_0x2abda6){logger[_0xa6e1('0x19')](_0xa6e1('0x23'),_0x2abda6[_0xa6e1('0x1b')],_0x104afd);_0x5e46ca(_0x13ef40[_0xa6e1('0x19')](0x1f4,_0x2abda6['message']));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index aa00681..d82e8ac 100644 --- a/server/api/faxMessage/faxMessage.socket.js +++ b/server/api/faxMessage/faxMessage.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','faxMessage:','./faxMessage.events','save','remove','emit','removeListener'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var FaxMessageEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){FaxMessageEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);FaxMessageEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0x9957=['register','length','faxMessage:','./faxMessage.events','save','remove','update','emit','removeListener'];(function(_0x2dacca,_0x3b55a5){var _0x4e8745=function(_0x4c4515){while(--_0x4c4515){_0x2dacca['push'](_0x2dacca['shift']());}};_0x4e8745(++_0x3b55a5);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var FaxMessageEvents=require(_0x7995('0x0'));var events=[_0x7995('0x1'),_0x7995('0x2'),_0x7995('0x3')];function createListener(_0x5b96eb,_0x86c128){return function(_0x3c58eb){_0x86c128[_0x7995('0x4')](_0x5b96eb,_0x3c58eb);};}function removeListener(_0x462a03,_0x576d89){return function(){FaxMessageEvents[_0x7995('0x5')](_0x462a03,_0x576d89);};}exports[_0x7995('0x6')]=function(_0x137b6b){for(var _0x219534=0x0,_0xbda126=events[_0x7995('0x7')];_0x219534<_0xbda126;_0x219534++){var _0x4996ca=events[_0x219534];var _0x465276=createListener(_0x7995('0x8')+_0x4996ca,_0x137b6b);FaxMessageEvents['on'](_0x4996ca,_0x465276);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 0328aeb..f6a56e6 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 _0x7f4b=['reject','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','describe','/:id','/:id/download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x2e45ee,_0x580e1e){var _0x26c408=function(_0x267940){while(--_0x267940){_0x2e45ee['push'](_0x2e45ee['shift']());}};_0x26c408(++_0x580e1e);}(_0x7f4b,0x6b));var _0xb7f4=function(_0x4ac2ff,_0x51838d){_0x4ac2ff=_0x4ac2ff-0x0;var _0x463521=_0x7f4b[_0x4ac2ff];return _0x463521;};'use strict';var multer=require(_0xb7f4('0x0'));var util=require(_0xb7f4('0x1'));var path=require(_0xb7f4('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7f4('0x3'));var router=express['Router']();var auth=require(_0xb7f4('0x4'));var interaction=require(_0xb7f4('0x5'));var config=require(_0xb7f4('0x6'));var controller=require(_0xb7f4('0x7'));router[_0xb7f4('0x8')]('/',auth[_0xb7f4('0x9')](),controller[_0xb7f4('0xa')]);router[_0xb7f4('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xb7f4('0xb')]);router[_0xb7f4('0x8')](_0xb7f4('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xb7f4('0x8')](_0xb7f4('0xd'),auth[_0xb7f4('0x9')](),controller['download']);router[_0xb7f4('0xe')]('/',auth['isAuthenticated'](),interaction[_0xb7f4('0xf')](_0xb7f4('0x10'),_0xb7f4('0x11')),controller['create']);router[_0xb7f4('0x12')]('/:id',auth[_0xb7f4('0x9')](),controller[_0xb7f4('0x13')]);router['put'](_0xb7f4('0x14'),auth['isAuthenticated'](),controller[_0xb7f4('0x15')]);router[_0xb7f4('0x12')](_0xb7f4('0x16'),auth['isAuthenticated'](),controller[_0xb7f4('0x17')]);router[_0xb7f4('0x18')](_0xb7f4('0xc'),auth[_0xb7f4('0x9')](),controller[_0xb7f4('0x19')]);module['exports']=router; \ No newline at end of file +var _0x46cd=['../../components/interaction/service','../../config/environment','get','/describe','isAuthenticated','describe','/:id','show','/:id/download','download','post','fax','faxmessage:create','create','put','update','/:id/accept','accept','/:id/reject','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x524b26,_0x4241c1){var _0x50acf5=function(_0x22722b){while(--_0x22722b){_0x524b26['push'](_0x524b26['shift']());}};_0x50acf5(++_0x4241c1);}(_0x46cd,0x181));var _0xd46c=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x46cd[_0x4ff09b];return _0x3f5c2e;};'use strict';var multer=require('multer');var util=require(_0xd46c('0x0'));var path=require(_0xd46c('0x1'));var timeout=require(_0xd46c('0x2'));var express=require('express');var router=express[_0xd46c('0x3')]();var auth=require(_0xd46c('0x4'));var interaction=require(_0xd46c('0x5'));var config=require(_0xd46c('0x6'));var controller=require('./faxMessage.controller');router[_0xd46c('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xd46c('0x8'),auth[_0xd46c('0x9')](),controller[_0xd46c('0xa')]);router['get'](_0xd46c('0xb'),auth['isAuthenticated'](),controller[_0xd46c('0xc')]);router['get'](_0xd46c('0xd'),auth[_0xd46c('0x9')](),controller[_0xd46c('0xe')]);router[_0xd46c('0xf')]('/',auth[_0xd46c('0x9')](),interaction['tracked'](_0xd46c('0x10'),_0xd46c('0x11')),controller[_0xd46c('0x12')]);router[_0xd46c('0x13')](_0xd46c('0xb'),auth[_0xd46c('0x9')](),controller[_0xd46c('0x14')]);router[_0xd46c('0x13')](_0xd46c('0x15'),auth[_0xd46c('0x9')](),controller[_0xd46c('0x16')]);router[_0xd46c('0x13')](_0xd46c('0x17'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0xd46c('0xb'),auth['isAuthenticated'](),controller[_0xd46c('0x18')]);module[_0xd46c('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index f7c6ef5..555eab5 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 _0x7c59=['ENUM','rrmemory','INTEGER','exports','STRING','name'];(function(_0x253a6c,_0x1ce533){var _0x5e48ff=function(_0x900553){while(--_0x900553){_0x253a6c['push'](_0x253a6c['shift']());}};_0x5e48ff(++_0x1ce533);}(_0x7c59,0x147));var _0x97c5=function(_0x38db75,_0x3bfd1b){_0x38db75=_0x38db75-0x0;var _0x44bd3c=_0x7c59[_0x38db75];return _0x44bd3c;};'use strict';var Sequelize=require('sequelize');module[_0x97c5('0x0')]={'name':{'type':Sequelize[_0x97c5('0x1')],'unique':_0x97c5('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x97c5('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x97c5('0x3')](_0x97c5('0x4'),'beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x97c5('0x5')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc0f3=['name','INTEGER','beepall','roundrobin','exports','STRING'];(function(_0x303da2,_0x7e567a){var _0x149ea5=function(_0x5cce4c){while(--_0x5cce4c){_0x303da2['push'](_0x303da2['shift']());}};_0x149ea5(++_0x7e567a);}(_0xc0f3,0x1d8));var _0x3c0f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0f3[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x3c0f('0x0')]={'name':{'type':Sequelize[_0x3c0f('0x1')],'unique':_0x3c0f('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x3c0f('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x3c0f('0x4'),_0x3c0f('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x3c0f('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 7f15157..a924b6a 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 _0xe5fc=['lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','register','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','FaxQueues','destroy','sendStatus','error','stack','name','send','index','map','FaxQueue','rawAttributes','fieldName','model','filters','query','intersection','fields','attributes','length','hasOwnProperty','limit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','UserProfileResource','update','describe','getMembers','UserFaxQueue','nolimit','order','FaxQueueId','User','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','findOne','getTeams','addTeams','Agents','online','flatMap','sequelize','findOrCreate','emit','userFaxQueue:save','removeTeams','Team','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','push','SELECT','every','all','union','compact','value','transaction','ids','isEmpty','userFaxQueue:remove','addAgents','spread','removeAgents','isArray','getAgents','html-pdf','rimraf','zip-dir','fast-json-patch','mustache','path','sox','to-csv','ejs'];(function(_0x4be8ba,_0x5d10ba){var _0x1af822=function(_0x40ed8a){while(--_0x40ed8a){_0x4be8ba['push'](_0x4be8ba['shift']());}};_0x1af822(++_0x5d10ba);}(_0xe5fc,0x109));var _0xce5f=function(_0x9330ce,_0x52decc){_0x9330ce=_0x9330ce-0x0;var _0x455fd8=_0xe5fc[_0x9330ce];return _0x455fd8;};'use strict';var pdf=require(_0xce5f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xce5f('0x1'));var zipdir=require(_0xce5f('0x2'));var jsonpatch=require(_0xce5f('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xce5f('0x4'));var util=require('util');var path=require(_0xce5f('0x5'));var sox=require(_0xce5f('0x6'));var csv=require(_0xce5f('0x7'));var ejs=require(_0xce5f('0x8'));var fs=require('fs');var _=require(_0xce5f('0x9'));var squel=require(_0xce5f('0xa'));var crypto=require(_0xce5f('0xb'));var jsforce=require(_0xce5f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xce5f('0x7'));var querystring=require(_0xce5f('0xd'));var Papa=require(_0xce5f('0xe'));var Redis=require(_0xce5f('0xf'));var authService=require(_0xce5f('0x10'));var qs=require(_0xce5f('0x11'));var as=require(_0xce5f('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xce5f('0x13'))(_0xce5f('0x14'));var utils=require(_0xce5f('0x15'));var config=require(_0xce5f('0x16'));var db=require(_0xce5f('0x17'))['db'];config[_0xce5f('0x18')]=_[_0xce5f('0x19')](config[_0xce5f('0x18')],{'host':_0xce5f('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxQueue.socket')[_0xce5f('0x1b')](socket);function respondWithStatusCode(_0xb0438e,_0x3f69cb){_0x3f69cb=_0x3f69cb||0xcc;return function(_0x4782d0){if(_0x4782d0){return _0xb0438e['sendStatus'](_0x3f69cb);}return _0xb0438e[_0xce5f('0x1c')](_0x3f69cb)[_0xce5f('0x1d')]();};}function respondWithResult(_0x1f0762,_0x44ab13){_0x44ab13=_0x44ab13||0xc8;return function(_0x208947){if(_0x208947){return _0x1f0762[_0xce5f('0x1c')](_0x44ab13)[_0xce5f('0x1e')](_0x208947);}};}function respondWithFilteredResult(_0x1b3e51,_0x257d8b){return function(_0x403304){if(_0x403304){var _0xc42202=_0x403304[_0xce5f('0x1f')],_0xf9342b=_0x257d8b[_0xce5f('0x20')],_0x274bd5=_0x257d8b['offset']+_0x257d8b['limit'],_0x82a2bb;if(_0x274bd5>=_0xc42202){_0x274bd5=_0xc42202;_0x82a2bb=0xc8;}else{_0x82a2bb=0xce;}_0x1b3e51['status'](_0x82a2bb);return _0x1b3e51[_0xce5f('0x21')](_0xce5f('0x22'),_0xf9342b+'-'+_0x274bd5+'/'+_0xc42202)[_0xce5f('0x1e')](_0x403304);}return null;};}function patchUpdates(_0x202a9a){return function(_0x3c4d17){try{jsonpatch[_0xce5f('0x23')](_0x3c4d17,_0x202a9a,!![]);}catch(_0x196615){return BPromise[_0xce5f('0x24')](_0x196615);}return _0x3c4d17[_0xce5f('0x25')]();};}function saveUpdates(_0x531b54,_0x1bc889){return function(_0x2c4334){if(_0x2c4334){return _0x2c4334['update'](_0x531b54)[_0xce5f('0x26')](function(_0x1d613b){return _0x1d613b;});}return null;};}function removeEntity(_0x2e0ad7,_0x1e0c39){return function(_0x2bed6d){if(_0x2bed6d){return _0x2bed6d['destroy']()['then'](function(){var _0x3d44fc=_0x2bed6d[_0xce5f('0x27')]({'plain':!![]});var _0x44141d=_0xce5f('0x28');return db['UserProfileResource'][_0xce5f('0x29')]({'where':{'type':_0x44141d,'resourceId':_0x3d44fc['id']}})[_0xce5f('0x26')](function(){return _0x2bed6d;});})[_0xce5f('0x26')](function(){_0x2e0ad7[_0xce5f('0x1c')](0xcc)[_0xce5f('0x1d')]();});}};}function handleEntityNotFound(_0x1e9844,_0x179325){return function(_0x118ccf){if(!_0x118ccf){_0x1e9844[_0xce5f('0x2a')](0x194);}return _0x118ccf;};}function handleError(_0x329f1a,_0x5e86c4){_0x5e86c4=_0x5e86c4||0x1f4;return function(_0x219ede){logger[_0xce5f('0x2b')](_0x219ede[_0xce5f('0x2c')]);if(_0x219ede[_0xce5f('0x2d')]){delete _0x219ede[_0xce5f('0x2d')];}_0x329f1a[_0xce5f('0x1c')](_0x5e86c4)[_0xce5f('0x2e')](_0x219ede);};}exports[_0xce5f('0x2f')]=function(_0x1179c1,_0x4dc1b1){var _0x5233b1={},_0xda99b6={},_0x5d4640={'count':0x0,'rows':[]};var _0x113e70=_[_0xce5f('0x30')](db[_0xce5f('0x31')][_0xce5f('0x32')],function(_0x4137cb){return{'name':_0x4137cb[_0xce5f('0x33')],'type':_0x4137cb['type']['key']};});_0xda99b6[_0xce5f('0x34')]=_['map'](_0x113e70,_0xce5f('0x2d'));_0xda99b6['query']=_['keys'](_0x1179c1['query']);_0xda99b6[_0xce5f('0x35')]=_['intersection'](_0xda99b6['model'],_0xda99b6[_0xce5f('0x36')]);_0x5233b1['attributes']=_[_0xce5f('0x37')](_0xda99b6['model'],qs[_0xce5f('0x38')](_0x1179c1[_0xce5f('0x36')][_0xce5f('0x38')]));_0x5233b1[_0xce5f('0x39')]=_0x5233b1[_0xce5f('0x39')][_0xce5f('0x3a')]?_0x5233b1['attributes']:_0xda99b6[_0xce5f('0x34')];if(!_0x1179c1[_0xce5f('0x36')][_0xce5f('0x3b')]('nolimit')){_0x5233b1['limit']=qs[_0xce5f('0x3c')](_0x1179c1[_0xce5f('0x36')][_0xce5f('0x3c')]);_0x5233b1['offset']=qs[_0xce5f('0x20')](_0x1179c1[_0xce5f('0x36')][_0xce5f('0x20')]);}_0x5233b1['order']=qs['sort'](_0x1179c1[_0xce5f('0x36')][_0xce5f('0x3d')]);_0x5233b1[_0xce5f('0x3e')]=qs[_0xce5f('0x35')](_[_0xce5f('0x3f')](_0x1179c1[_0xce5f('0x36')],_0xda99b6['filters']));if(_0x1179c1[_0xce5f('0x36')][_0xce5f('0x40')]){_0x5233b1[_0xce5f('0x3e')]=_[_0xce5f('0x41')](_0x5233b1['where'],{'$or':_['map'](_0x113e70,function(_0x1f1ca1){if(_0x1f1ca1[_0xce5f('0x42')]!==_0xce5f('0x43')){var _0x26413e={};_0x26413e[_0x1f1ca1[_0xce5f('0x2d')]]={'$like':'%'+_0x1179c1['query'][_0xce5f('0x40')]+'%'};return _0x26413e;}})});}_0x5233b1=_[_0xce5f('0x41')]({},_0x5233b1,_0x1179c1[_0xce5f('0x44')]);var _0x4f980e={'where':_0x5233b1['where']};return db[_0xce5f('0x31')]['count'](_0x4f980e)['then'](function(_0x3abb1e){_0x5d4640['count']=_0x3abb1e;if(_0x1179c1[_0xce5f('0x36')][_0xce5f('0x45')]){_0x5233b1[_0xce5f('0x46')]=[{'all':!![]}];}return db['FaxQueue'][_0xce5f('0x47')](_0x5233b1);})[_0xce5f('0x26')](function(_0x1c81ce){_0x5d4640[_0xce5f('0x48')]=_0x1c81ce;return _0x5d4640;})[_0xce5f('0x26')](respondWithFilteredResult(_0x4dc1b1,_0x5233b1))['catch'](handleError(_0x4dc1b1,null));};exports[_0xce5f('0x49')]=function(_0x203788,_0x5a826f){var _0x5cdd9f={'raw':!![],'where':{'id':_0x203788[_0xce5f('0x4a')]['id']}},_0x58193b={};_0x58193b[_0xce5f('0x34')]=_[_0xce5f('0x4b')](db['FaxQueue'][_0xce5f('0x32')]);_0x58193b[_0xce5f('0x36')]=_['keys'](_0x203788[_0xce5f('0x36')]);_0x58193b[_0xce5f('0x35')]=_[_0xce5f('0x37')](_0x58193b[_0xce5f('0x34')],_0x58193b[_0xce5f('0x36')]);_0x5cdd9f[_0xce5f('0x39')]=_[_0xce5f('0x37')](_0x58193b['model'],qs[_0xce5f('0x38')](_0x203788[_0xce5f('0x36')][_0xce5f('0x38')]));_0x5cdd9f[_0xce5f('0x39')]=_0x5cdd9f['attributes']['length']?_0x5cdd9f['attributes']:_0x58193b[_0xce5f('0x34')];if(_0x203788[_0xce5f('0x36')]['includeAll']){_0x5cdd9f[_0xce5f('0x46')]=[{'all':!![]}];}_0x5cdd9f=_[_0xce5f('0x41')]({},_0x5cdd9f,_0x203788[_0xce5f('0x44')]);return db[_0xce5f('0x31')][_0xce5f('0x4c')](_0x5cdd9f)[_0xce5f('0x26')](handleEntityNotFound(_0x5a826f,null))[_0xce5f('0x26')](respondWithResult(_0x5a826f,null))[_0xce5f('0x4d')](handleError(_0x5a826f,null));};exports['create']=function(_0x31d383,_0x55df60){return db[_0xce5f('0x31')]['create'](_0x31d383[_0xce5f('0x4e')],{})['then'](function(_0x355fc2){var _0xd029fe=_0x31d383[_0xce5f('0x4f')][_0xce5f('0x27')]({'plain':!![]});if(!_0xd029fe)throw new Error(_0xce5f('0x50'));if(_0xd029fe[_0xce5f('0x51')]==='user'){var _0x4f68cd=_0x355fc2['get']({'plain':!![]});var _0x3d5ac5=_0xce5f('0x28');return db['UserProfileSection'][_0xce5f('0x4c')]({'where':{'name':_0x3d5ac5,'userProfileId':_0xd029fe[_0xce5f('0x52')]},'raw':!![]})[_0xce5f('0x26')](function(_0x556b7b){if(_0x556b7b&&_0x556b7b['autoAssociation']===0x0){return db[_0xce5f('0x53')]['create']({'name':_0x4f68cd['name'],'resourceId':_0x4f68cd['id'],'type':_0x556b7b['name'],'sectionId':_0x556b7b['id']},{})[_0xce5f('0x26')](function(){return _0x355fc2;});}else{return _0x355fc2;}})[_0xce5f('0x4d')](function(_0x37d0b8){logger[_0xce5f('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37d0b8);throw _0x37d0b8;});}return _0x355fc2;})['then'](respondWithResult(_0x55df60,0xc9))[_0xce5f('0x4d')](handleError(_0x55df60,null));};exports[_0xce5f('0x54')]=function(_0x4fd94c,_0x30d81c){if(_0x4fd94c[_0xce5f('0x4e')]['id']){delete _0x4fd94c['body']['id'];}return db[_0xce5f('0x31')][_0xce5f('0x4c')]({'where':{'id':_0x4fd94c[_0xce5f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x30d81c,null))['then'](saveUpdates(_0x4fd94c[_0xce5f('0x4e')],null))[_0xce5f('0x26')](respondWithResult(_0x30d81c,null))[_0xce5f('0x4d')](handleError(_0x30d81c,null));};exports['destroy']=function(_0x3aabad,_0x45382c){return db[_0xce5f('0x31')][_0xce5f('0x4c')]({'where':{'id':_0x3aabad[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x45382c,null))['then'](removeEntity(_0x45382c,null))[_0xce5f('0x4d')](handleError(_0x45382c,null));};exports[_0xce5f('0x55')]=function(_0x3f8b8f,_0x581b3e){return db[_0xce5f('0x31')][_0xce5f('0x55')]()['then'](respondWithResult(_0x581b3e,null))[_0xce5f('0x4d')](handleError(_0x581b3e,null));};exports[_0xce5f('0x56')]=function(_0x707715,_0x303ac3,_0x7282df){var _0x5080b4={'raw':!![],'where':{}},_0x260aec={},_0x212318;return db[_0xce5f('0x31')]['findOne']({'where':{'id':_0x707715[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x303ac3,null))[_0xce5f('0x26')](function(_0x19ceb2){if(_0x19ceb2){_0x212318=_0x19ceb2[_0xce5f('0x27')]({'plain':!![]});_0x260aec['model']=_[_0xce5f('0x4b')](db[_0xce5f('0x57')][_0xce5f('0x32')]);_0x260aec[_0xce5f('0x36')]=_[_0xce5f('0x4b')](_0x707715[_0xce5f('0x36')]);_0x260aec[_0xce5f('0x35')]=_[_0xce5f('0x37')](_0x260aec[_0xce5f('0x34')],_0x260aec[_0xce5f('0x36')]);_0x5080b4[_0xce5f('0x39')]=_['intersection'](_0x260aec[_0xce5f('0x34')],qs['fields'](_0x707715[_0xce5f('0x36')][_0xce5f('0x38')]));_0x5080b4[_0xce5f('0x39')]=_0x5080b4[_0xce5f('0x39')][_0xce5f('0x3a')]?_0x5080b4['attributes']:_0x260aec['model'];if(!_0x707715['query']['hasOwnProperty'](_0xce5f('0x58'))){_0x5080b4['limit']=qs[_0xce5f('0x3c')](_0x707715[_0xce5f('0x36')]['limit']);_0x5080b4[_0xce5f('0x20')]=qs[_0xce5f('0x20')](_0x707715[_0xce5f('0x36')][_0xce5f('0x20')]);}_0x5080b4[_0xce5f('0x59')]=qs[_0xce5f('0x3d')](_0x707715[_0xce5f('0x36')]['sort']);_0x5080b4[_0xce5f('0x3e')]=qs[_0xce5f('0x35')](_[_0xce5f('0x3f')](_0x707715['query'],_0x260aec[_0xce5f('0x35')]));_0x5080b4[_0xce5f('0x3e')][_0xce5f('0x5a')]=_0x19ceb2['id'];if(_0x707715[_0xce5f('0x36')][_0xce5f('0x40')]){_0x5080b4[_0xce5f('0x3e')]=_[_0xce5f('0x41')](_0x5080b4[_0xce5f('0x3e')],{'$or':_[_0xce5f('0x30')](_0x5080b4[_0xce5f('0x39')],function(_0x15ac07){var _0xfc42f5={};_0xfc42f5[_0x15ac07]={'$like':'%'+_0x707715[_0xce5f('0x36')][_0xce5f('0x40')]+'%'};return _0xfc42f5;})});}_0x5080b4=_['merge']({},_0x5080b4,_0x707715['options']);return db[_0xce5f('0x57')][_0xce5f('0x47')](_0x5080b4);}})[_0xce5f('0x26')](function(_0x3f2d79){if(_0x3f2d79){return db[_0xce5f('0x5b')]['findAndCountAll']({'where':{'id':_[_0xce5f('0x30')](_0x3f2d79,_0xce5f('0x5c')),'role':_0xce5f('0x5d')},'attributes':['id',_0xce5f('0x2d'),'faxPause',_0xce5f('0x5e'),_0xce5f('0x5f')]});}})[_0xce5f('0x26')](function(_0x4c58d4){if(_0x4c58d4){return{'count':_0x4c58d4['count'],'rows':_[_0xce5f('0x30')](_0x4c58d4['rows'],function(_0x4e09e7){return{'membername':_0x4e09e7[_0xce5f('0x2d')],'UserId':_0x4e09e7['id'],'queue_name':_0x212318[_0xce5f('0x2d')],'FaxQueueId':_0x212318['id'],'interface':util[_0xce5f('0x60')](_0xce5f('0x61'),_0xce5f('0x62'),_0x4e09e7['name']),'penalty':0x0,'paused':_0x4e09e7[_0xce5f('0x63')],'createdAt':_0x4e09e7[_0xce5f('0x5f')],'updatedAt':_0x4e09e7[_0xce5f('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xce5f('0x26')](respondWithFilteredResult(_0x303ac3,_0x5080b4))['catch'](handleError(_0x303ac3,null));};exports['getTeams']=function(_0x3a492e,_0x3424c6,_0x137ee9){var _0x5f3239={};var _0x5bfa14={};var _0x536007;var _0x4f0d4b;return db[_0xce5f('0x31')][_0xce5f('0x64')]({'where':{'id':_0x3a492e['params']['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x3424c6,null))[_0xce5f('0x26')](function(_0x243bdc){if(_0x243bdc){_0x536007=_0x243bdc;_0x5bfa14['model']=_[_0xce5f('0x4b')](db['Team'][_0xce5f('0x32')]);_0x5bfa14[_0xce5f('0x36')]=_[_0xce5f('0x4b')](_0x3a492e[_0xce5f('0x36')]);_0x5bfa14['filters']=_[_0xce5f('0x37')](_0x5bfa14[_0xce5f('0x34')],_0x5bfa14[_0xce5f('0x36')]);_0x5f3239[_0xce5f('0x39')]=_[_0xce5f('0x37')](_0x5bfa14[_0xce5f('0x34')],qs['fields'](_0x3a492e[_0xce5f('0x36')][_0xce5f('0x38')]));_0x5f3239[_0xce5f('0x39')]=_0x5f3239[_0xce5f('0x39')][_0xce5f('0x3a')]?_0x5f3239['attributes']:_0x5bfa14[_0xce5f('0x34')];_0x5f3239[_0xce5f('0x59')]=qs['sort'](_0x3a492e['query']['sort']);_0x5f3239[_0xce5f('0x3e')]=qs['filters'](_['pick'](_0x3a492e[_0xce5f('0x36')],_0x5bfa14[_0xce5f('0x35')]));if(_0x3a492e[_0xce5f('0x36')][_0xce5f('0x40')]){_0x5f3239[_0xce5f('0x3e')]=_[_0xce5f('0x41')](_0x5f3239[_0xce5f('0x3e')],{'$or':_['map'](_0x5f3239[_0xce5f('0x39')],function(_0x8effaf){var _0x2f7521={};_0x2f7521[_0x8effaf]={'$like':'%'+_0x3a492e[_0xce5f('0x36')][_0xce5f('0x40')]+'%'};return _0x2f7521;})});}_0x5f3239=_['merge']({},_0x5f3239,_0x3a492e['options']);return _0x536007[_0xce5f('0x65')](_0x5f3239);}})[_0xce5f('0x26')](function(_0x3dcb47){if(_0x3dcb47){_0x4f0d4b=_0x3dcb47[_0xce5f('0x3a')];if(!_0x3a492e['query'][_0xce5f('0x3b')]('nolimit')){_0x5f3239[_0xce5f('0x3c')]=qs[_0xce5f('0x3c')](_0x3a492e['query'][_0xce5f('0x3c')]);_0x5f3239[_0xce5f('0x20')]=qs[_0xce5f('0x20')](_0x3a492e[_0xce5f('0x36')][_0xce5f('0x20')]);}return _0x536007[_0xce5f('0x65')](_0x5f3239);}})['then'](function(_0xfac4e5){if(_0xfac4e5){return _0xfac4e5?{'count':_0x4f0d4b,'rows':_0xfac4e5}:null;}})[_0xce5f('0x26')](respondWithResult(_0x3424c6,null))[_0xce5f('0x4d')](handleError(_0x3424c6,null));};exports[_0xce5f('0x66')]=function(_0x184055,_0xf5328b,_0x29fde2){var _0x448f00=_0x184055[_0xce5f('0x4e')]['ids'];return db['Team'][_0xce5f('0x47')]({'where':{'id':_0x448f00},'attributes':['id'],'include':[{'model':db[_0xce5f('0x5b')],'as':_0xce5f('0x67'),'attributes':['id',_0xce5f('0x2d'),_0xce5f('0x68'),'voicePause','interface'],'raw':!![]}]})[_0xce5f('0x26')](function(_0x3f1bfd){if(_0x3f1bfd){var _0x531aeb=_[_0xce5f('0x69')](_0x3f1bfd,function(_0x314128){var _0x441a24=_0x314128[_0xce5f('0x27')]({'plain':!![]});return _0x441a24['Agents'];});return db['FaxQueue'][_0xce5f('0x4c')]({'where':{'id':_0x184055[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](function(_0x46ff06){return db[_0xce5f('0x6a')]['transaction'](function(_0x6202e2){return _0x46ff06[_0xce5f('0x66')](_0x448f00,{'transaction':_0x6202e2})[_0xce5f('0x26')](function(){return BPromise['each'](_0x531aeb,function(_0x46323f){return db[_0xce5f('0x57')][_0xce5f('0x6b')]({'where':{'UserId':_0x46323f['id'],'FaxQueueId':_0x184055[_0xce5f('0x4a')]['id']},'transaction':_0x6202e2});});})[_0xce5f('0x26')](function(){_0x531aeb['forEach'](function(_0x4db359){socket[_0xce5f('0x6c')](_0xce5f('0x6d'),{'UserId':_0x4db359['id'],'FaxQueueId':_0x46ff06['id']});});});});});}})[_0xce5f('0x26')](respondWithStatusCode(_0xf5328b,null))['catch'](handleError(_0xf5328b,null));};exports[_0xce5f('0x6e')]=function(_0x5b6f21,_0x587d53,_0x61f244){return db[_0xce5f('0x6f')]['findAll']({'where':{'id':_0x5b6f21[_0xce5f('0x36')]['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0xce5f('0x67'),'attributes':['id'],'raw':!![]}]})[_0xce5f('0x26')](handleEntityNotFound(_0x587d53,null))[_0xce5f('0x26')](function(_0x3c76ce){var _0x44625c=_[_0xce5f('0x30')](_0x3c76ce,'id');var _0x39d0f0=[];var _0x25050b=[];var _0x4a1feb=squel[_0xce5f('0x70')]();_0x4a1feb[_0xce5f('0x71')](_0xce5f('0x72'))[_0xce5f('0x73')](_0xce5f('0x74'),'tq')[_0xce5f('0x75')](_0xce5f('0x76'),'ut',_0xce5f('0x77'))[_0xce5f('0x3e')](_0xce5f('0x78'),_0x5b6f21['params']['id']);for(var _0x3b30ec=0x0;_0x3b30ec<_0x3c76ce[_0xce5f('0x3a')];_0x3b30ec+=0x1){let _0x21d3c1=_0x3c76ce[_0x3b30ec];for(var _0x12ba2d=0x0;_0x12ba2d<_0x21d3c1[_0xce5f('0x67')]['length'];_0x12ba2d+=0x1){let _0x16c5c1=_0x21d3c1['Agents'][_0x12ba2d];var _0x2191fd=_0x4a1feb['clone']();_0x2191fd[_0xce5f('0x3e')]('ut.UserId\x20=\x20?',_0x16c5c1['id']);_0x25050b[_0xce5f('0x79')](db[_0xce5f('0x6a')]['query'](_0x2191fd['toString'](),{'type':db[_0xce5f('0x6a')]['QueryTypes'][_0xce5f('0x7a')]})[_0xce5f('0x26')](function(_0x5eb017){if(_0x5eb017['length']===0x1){return _0x16c5c1['id'];}else{var _0x2d40d4=_[_0xce5f('0x7b')](_[_0xce5f('0x30')](_0x5eb017,'TeamId'),function(_0x182622){return _['includes'](_0x44625c,_0x182622);});if(_0x2d40d4){return _0x16c5c1['id'];}}}));}}return BPromise[_0xce5f('0x7c')](_0x25050b)[_0xce5f('0x26')](function(_0x2918f9){_0x39d0f0=_(_0x39d0f0)[_0xce5f('0x7d')](_0x2918f9)[_0xce5f('0x7e')]()[_0xce5f('0x7f')]();return db[_0xce5f('0x31')][_0xce5f('0x4c')]({'where':{'id':_0x5b6f21[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](function(_0x3728c5){return db['sequelize'][_0xce5f('0x80')](function(_0x28396e){return _0x3728c5['removeTeams'](_0x5b6f21['query'][_0xce5f('0x81')],{'transaction':_0x28396e})['then'](function(){if(!_[_0xce5f('0x82')](_0x39d0f0)){return _0x3728c5['removeAgents'](_0x39d0f0,{'transaction':_0x28396e});}})[_0xce5f('0x26')](function(){_0x39d0f0['forEach'](function(_0x10f7c3){socket[_0xce5f('0x6c')](_0xce5f('0x83'),{'UserId':_0x10f7c3,'FaxQueueId':_0x3728c5['id']});});});});});});})[_0xce5f('0x26')](respondWithStatusCode(_0x587d53,null))[_0xce5f('0x4d')](handleError(_0x587d53,null));};exports[_0xce5f('0x84')]=function(_0x10c5f2,_0x3966e2,_0x3cfd27){return db['FaxQueue'][_0xce5f('0x4c')]({'where':{'id':_0x10c5f2[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x3966e2,null))[_0xce5f('0x26')](function(_0x1b0b29){if(_0x1b0b29){return _0x1b0b29[_0xce5f('0x84')](_0x10c5f2['body'][_0xce5f('0x81')],_['omit'](_0x10c5f2[_0xce5f('0x4e')],['ids','id'])||{})[_0xce5f('0x85')](function(_0x31a06f){for(var _0x1eb4ee=0x0;_0x1eb4ee<_0x10c5f2[_0xce5f('0x4e')][_0xce5f('0x81')][_0xce5f('0x3a')];_0x1eb4ee+=0x1){socket[_0xce5f('0x6c')](_0xce5f('0x6d'),{'UserId':_0x10c5f2[_0xce5f('0x4e')][_0xce5f('0x81')][_0x1eb4ee],'FaxQueueId':_0x10c5f2[_0xce5f('0x4a')]['id']});}return _0x31a06f;});}})[_0xce5f('0x26')](respondWithResult(_0x3966e2,null))['catch'](handleError(_0x3966e2,null));};exports[_0xce5f('0x86')]=function(_0x539b3e,_0x138777,_0x37ee2c){return db[_0xce5f('0x31')][_0xce5f('0x4c')]({'where':{'id':_0x539b3e[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x138777,null))[_0xce5f('0x26')](function(_0x42426f){if(_0x42426f){return _0x42426f[_0xce5f('0x86')](_0x539b3e[_0xce5f('0x36')][_0xce5f('0x81')])[_0xce5f('0x26')](function(){if(_[_0xce5f('0x87')](_0x539b3e[_0xce5f('0x36')]['ids'])){for(var _0x2111f3=0x0;_0x2111f3<_0x539b3e[_0xce5f('0x36')]['ids'][_0xce5f('0x3a')];_0x2111f3+=0x1){socket['emit'](_0xce5f('0x83'),{'UserId':Number(_0x539b3e[_0xce5f('0x36')][_0xce5f('0x81')][_0x2111f3]),'FaxQueueId':Number(_0x539b3e[_0xce5f('0x4a')]['id'])});}}else{socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x539b3e[_0xce5f('0x36')][_0xce5f('0x81')]),'FaxQueueId':Number(_0x539b3e['params']['id'])});}});}})[_0xce5f('0x26')](respondWithStatusCode(_0x138777,null))[_0xce5f('0x4d')](handleError(_0x138777,null));};exports[_0xce5f('0x88')]=function(_0x3287ff,_0x4ff69c,_0x4e9bc5){var _0x5ec615={};var _0xbb69bc={};var _0x50eeed;var _0x4c4b1f;return db[_0xce5f('0x31')][_0xce5f('0x64')]({'where':{'id':_0x3287ff[_0xce5f('0x4a')]['id']}})[_0xce5f('0x26')](handleEntityNotFound(_0x4ff69c,null))[_0xce5f('0x26')](function(_0x583045){if(_0x583045){_0x50eeed=_0x583045;_0xbb69bc[_0xce5f('0x34')]=_[_0xce5f('0x4b')](db['User'][_0xce5f('0x32')]);_0xbb69bc[_0xce5f('0x36')]=_[_0xce5f('0x4b')](_0x3287ff['query']);_0xbb69bc[_0xce5f('0x35')]=_[_0xce5f('0x37')](_0xbb69bc[_0xce5f('0x34')],_0xbb69bc['query']);_0x5ec615[_0xce5f('0x39')]=_['intersection'](_0xbb69bc[_0xce5f('0x34')],qs[_0xce5f('0x38')](_0x3287ff['query']['fields']));_0x5ec615['attributes']=_0x5ec615['attributes']['length']?_0x5ec615['attributes']:_0xbb69bc[_0xce5f('0x34')];_0x5ec615[_0xce5f('0x59')]=qs[_0xce5f('0x3d')](_0x3287ff[_0xce5f('0x36')][_0xce5f('0x3d')]);_0x5ec615[_0xce5f('0x3e')]=qs['filters'](_[_0xce5f('0x3f')](_0x3287ff[_0xce5f('0x36')],_0xbb69bc['filters']));if(_0x3287ff[_0xce5f('0x36')][_0xce5f('0x40')]){_0x5ec615[_0xce5f('0x3e')]=_[_0xce5f('0x41')](_0x5ec615[_0xce5f('0x3e')],{'$or':_[_0xce5f('0x30')](_0x5ec615['attributes'],function(_0x2f4b70){var _0x3551b8={};_0x3551b8[_0x2f4b70]={'$like':'%'+_0x3287ff[_0xce5f('0x36')]['filter']+'%'};return _0x3551b8;})});}_0x5ec615=_['merge']({},_0x5ec615,_0x3287ff[_0xce5f('0x44')]);return _0x50eeed[_0xce5f('0x88')](_0x5ec615);}})['then'](function(_0x2dc31a){if(_0x2dc31a){_0x4c4b1f=_0x2dc31a[_0xce5f('0x3a')];if(!_0x3287ff[_0xce5f('0x36')][_0xce5f('0x3b')](_0xce5f('0x58'))){_0x5ec615[_0xce5f('0x3c')]=qs[_0xce5f('0x3c')](_0x3287ff['query'][_0xce5f('0x3c')]);_0x5ec615[_0xce5f('0x20')]=qs[_0xce5f('0x20')](_0x3287ff[_0xce5f('0x36')][_0xce5f('0x20')]);}return _0x50eeed[_0xce5f('0x88')](_0x5ec615);}})['then'](function(_0x13d7e2){if(_0x13d7e2){return _0x13d7e2?{'count':_0x4c4b1f,'rows':_0x13d7e2}:null;}})[_0xce5f('0x26')](respondWithResult(_0x4ff69c,null))[_0xce5f('0x4d')](handleError(_0x4ff69c,null));}; \ No newline at end of file +var _0x110f=['UserProfileResource','error','name','send','index','FaxQueue','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','count','include','findAll','show','params','length','includeAll','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','FaxQueues','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','getMembers','findOne','UserFaxQueue','FaxQueueId','User','UserId','updatedAt','createdAt','rows','faxPause','getTeams','Team','addTeams','ids','Agents','voicePause','interface','sequelize','each','forEach','emit','removeTeams','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','SELECT','every','TeamId','all','union','compact','value','isEmpty','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','html-pdf','eml-format','request-promise','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./faxQueue.socket','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','then'];(function(_0x5c6f53,_0x5f08f6){var _0x4b9fff=function(_0x34595f){while(--_0x34595f){_0x5c6f53['push'](_0x5c6f53['shift']());}};_0x4b9fff(++_0x5f08f6);}(_0x110f,0x1e6));var _0xf110=function(_0x1a3f9d,_0x2fe212){_0x1a3f9d=_0x1a3f9d-0x0;var _0x4465a3=_0x110f[_0x1a3f9d];return _0x4465a3;};'use strict';var pdf=require(_0xf110('0x0'));var emlformat=require(_0xf110('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf110('0x2'));var moment=require('moment');var BPromise=require(_0xf110('0x3'));var Mustache=require(_0xf110('0x4'));var util=require(_0xf110('0x5'));var path=require('path');var sox=require(_0xf110('0x6'));var csv=require(_0xf110('0x7'));var ejs=require(_0xf110('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf110('0x9'));var crypto=require(_0xf110('0xa'));var jsforce=require(_0xf110('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf110('0x7'));var querystring=require(_0xf110('0xc'));var Papa=require(_0xf110('0xd'));var Redis=require('ioredis');var authService=require(_0xf110('0xe'));var qs=require(_0xf110('0xf'));var as=require(_0xf110('0x10'));var hardwareService=require(_0xf110('0x11'));var logger=require('../../config/logger')(_0xf110('0x12'));var utils=require(_0xf110('0x13'));var config=require('../../config/environment');var db=require(_0xf110('0x14'))['db'];config[_0xf110('0x15')]=_[_0xf110('0x16')](config[_0xf110('0x15')],{'host':'localhost','port':0x18eb});var socket=require(_0xf110('0x17'))(new Redis(config[_0xf110('0x15')]));require(_0xf110('0x18'))['register'](socket);function respondWithStatusCode(_0xb21d63,_0x206703){_0x206703=_0x206703||0xcc;return function(_0x5c33b8){if(_0x5c33b8){return _0xb21d63[_0xf110('0x19')](_0x206703);}return _0xb21d63[_0xf110('0x1a')](_0x206703)[_0xf110('0x1b')]();};}function respondWithResult(_0x325496,_0x32df98){_0x32df98=_0x32df98||0xc8;return function(_0x47cabf){if(_0x47cabf){return _0x325496[_0xf110('0x1a')](_0x32df98)[_0xf110('0x1c')](_0x47cabf);}};}function respondWithFilteredResult(_0x3a0c81,_0x4fb0ea){return function(_0x31dd1c){if(_0x31dd1c){var _0x2d0bb9=_0x31dd1c['count'],_0x3ab2cc=_0x4fb0ea[_0xf110('0x1d')],_0x4ce8c3=_0x4fb0ea[_0xf110('0x1d')]+_0x4fb0ea[_0xf110('0x1e')],_0x3eacf9;if(_0x4ce8c3>=_0x2d0bb9){_0x4ce8c3=_0x2d0bb9;_0x3eacf9=0xc8;}else{_0x3eacf9=0xce;}_0x3a0c81[_0xf110('0x1a')](_0x3eacf9);return _0x3a0c81[_0xf110('0x1f')]('Content-Range',_0x3ab2cc+'-'+_0x4ce8c3+'/'+_0x2d0bb9)[_0xf110('0x1c')](_0x31dd1c);}return null;};}function patchUpdates(_0xed3418){return function(_0x52e6cf){try{jsonpatch[_0xf110('0x20')](_0x52e6cf,_0xed3418,!![]);}catch(_0x105c20){return BPromise[_0xf110('0x21')](_0x105c20);}return _0x52e6cf[_0xf110('0x22')]();};}function saveUpdates(_0x1634bf,_0x4e7aad){return function(_0x2d0f0d){if(_0x2d0f0d){return _0x2d0f0d[_0xf110('0x23')](_0x1634bf)['then'](function(_0x9980ec){return _0x9980ec;});}return null;};}function removeEntity(_0xc52064,_0x11eb1c){return function(_0x2f3ddd){if(_0x2f3ddd){return _0x2f3ddd[_0xf110('0x24')]()[_0xf110('0x25')](function(){var _0x36ac5e=_0x2f3ddd['get']({'plain':!![]});var _0xb4fde2='FaxQueues';return db[_0xf110('0x26')]['destroy']({'where':{'type':_0xb4fde2,'resourceId':_0x36ac5e['id']}})['then'](function(){return _0x2f3ddd;});})['then'](function(){_0xc52064['status'](0xcc)[_0xf110('0x1b')]();});}};}function handleEntityNotFound(_0x1cb61c,_0x585616){return function(_0x26a4e2){if(!_0x26a4e2){_0x1cb61c[_0xf110('0x19')](0x194);}return _0x26a4e2;};}function handleError(_0x32a4d3,_0x4e0087){_0x4e0087=_0x4e0087||0x1f4;return function(_0x2f3488){logger[_0xf110('0x27')](_0x2f3488['stack']);if(_0x2f3488[_0xf110('0x28')]){delete _0x2f3488[_0xf110('0x28')];}_0x32a4d3[_0xf110('0x1a')](_0x4e0087)[_0xf110('0x29')](_0x2f3488);};}exports[_0xf110('0x2a')]=function(_0x32dff4,_0x1ca73f){var _0xe9f387={},_0x5143b0={},_0x509036={'count':0x0,'rows':[]};var _0x2bdeef=_['map'](db[_0xf110('0x2b')][_0xf110('0x2c')],function(_0x1f568d){return{'name':_0x1f568d[_0xf110('0x2d')],'type':_0x1f568d[_0xf110('0x2e')][_0xf110('0x2f')]};});_0x5143b0[_0xf110('0x30')]=_[_0xf110('0x31')](_0x2bdeef,_0xf110('0x28'));_0x5143b0['query']=_[_0xf110('0x32')](_0x32dff4[_0xf110('0x33')]);_0x5143b0[_0xf110('0x34')]=_[_0xf110('0x35')](_0x5143b0[_0xf110('0x30')],_0x5143b0[_0xf110('0x33')]);_0xe9f387[_0xf110('0x36')]=_[_0xf110('0x35')](_0x5143b0[_0xf110('0x30')],qs[_0xf110('0x37')](_0x32dff4[_0xf110('0x33')][_0xf110('0x37')]));_0xe9f387[_0xf110('0x36')]=_0xe9f387[_0xf110('0x36')]['length']?_0xe9f387[_0xf110('0x36')]:_0x5143b0[_0xf110('0x30')];if(!_0x32dff4[_0xf110('0x33')][_0xf110('0x38')](_0xf110('0x39'))){_0xe9f387[_0xf110('0x1e')]=qs[_0xf110('0x1e')](_0x32dff4[_0xf110('0x33')][_0xf110('0x1e')]);_0xe9f387[_0xf110('0x1d')]=qs['offset'](_0x32dff4[_0xf110('0x33')][_0xf110('0x1d')]);}_0xe9f387[_0xf110('0x3a')]=qs[_0xf110('0x3b')](_0x32dff4[_0xf110('0x33')][_0xf110('0x3b')]);_0xe9f387[_0xf110('0x3c')]=qs[_0xf110('0x34')](_[_0xf110('0x3d')](_0x32dff4[_0xf110('0x33')],_0x5143b0[_0xf110('0x34')]));if(_0x32dff4[_0xf110('0x33')]['filter']){_0xe9f387['where']=_[_0xf110('0x3e')](_0xe9f387[_0xf110('0x3c')],{'$or':_[_0xf110('0x31')](_0x2bdeef,function(_0x880dc5){if(_0x880dc5[_0xf110('0x2e')]!=='VIRTUAL'){var _0x323f52={};_0x323f52[_0x880dc5[_0xf110('0x28')]]={'$like':'%'+_0x32dff4[_0xf110('0x33')][_0xf110('0x3f')]+'%'};return _0x323f52;}})});}_0xe9f387=_['merge']({},_0xe9f387,_0x32dff4[_0xf110('0x40')]);var _0x336319={'where':_0xe9f387['where']};return db[_0xf110('0x2b')][_0xf110('0x41')](_0x336319)[_0xf110('0x25')](function(_0x21e98d){_0x509036['count']=_0x21e98d;if(_0x32dff4[_0xf110('0x33')]['includeAll']){_0xe9f387[_0xf110('0x42')]=[{'all':!![]}];}return db['FaxQueue'][_0xf110('0x43')](_0xe9f387);})[_0xf110('0x25')](function(_0x2f9fe5){_0x509036['rows']=_0x2f9fe5;return _0x509036;})[_0xf110('0x25')](respondWithFilteredResult(_0x1ca73f,_0xe9f387))['catch'](handleError(_0x1ca73f,null));};exports[_0xf110('0x44')]=function(_0x355432,_0xff83b5){var _0x19a203={'raw':!![],'where':{'id':_0x355432[_0xf110('0x45')]['id']}},_0x13978c={};_0x13978c[_0xf110('0x30')]=_[_0xf110('0x32')](db[_0xf110('0x2b')][_0xf110('0x2c')]);_0x13978c['query']=_['keys'](_0x355432[_0xf110('0x33')]);_0x13978c[_0xf110('0x34')]=_['intersection'](_0x13978c[_0xf110('0x30')],_0x13978c['query']);_0x19a203[_0xf110('0x36')]=_[_0xf110('0x35')](_0x13978c[_0xf110('0x30')],qs[_0xf110('0x37')](_0x355432[_0xf110('0x33')][_0xf110('0x37')]));_0x19a203[_0xf110('0x36')]=_0x19a203[_0xf110('0x36')][_0xf110('0x46')]?_0x19a203[_0xf110('0x36')]:_0x13978c['model'];if(_0x355432[_0xf110('0x33')][_0xf110('0x47')]){_0x19a203[_0xf110('0x42')]=[{'all':!![]}];}_0x19a203=_[_0xf110('0x3e')]({},_0x19a203,_0x355432['options']);return db[_0xf110('0x2b')]['find'](_0x19a203)['then'](handleEntityNotFound(_0xff83b5,null))[_0xf110('0x25')](respondWithResult(_0xff83b5,null))[_0xf110('0x48')](handleError(_0xff83b5,null));};exports[_0xf110('0x49')]=function(_0x50e457,_0x105b07){return db[_0xf110('0x2b')][_0xf110('0x49')](_0x50e457[_0xf110('0x4a')],{})[_0xf110('0x25')](function(_0x831013){var _0x1ac0fb=_0x50e457[_0xf110('0x4b')][_0xf110('0x4c')]({'plain':!![]});if(!_0x1ac0fb)throw new Error(_0xf110('0x4d'));if(_0x1ac0fb[_0xf110('0x4e')]==='user'){var _0x25b056=_0x831013[_0xf110('0x4c')]({'plain':!![]});var _0x548ea2=_0xf110('0x4f');return db['UserProfileSection']['find']({'where':{'name':_0x548ea2,'userProfileId':_0x1ac0fb['userProfileId']},'raw':!![]})[_0xf110('0x25')](function(_0x13007a){if(_0x13007a&&_0x13007a[_0xf110('0x50')]===0x0){return db['UserProfileResource'][_0xf110('0x49')]({'name':_0x25b056['name'],'resourceId':_0x25b056['id'],'type':_0x13007a[_0xf110('0x28')],'sectionId':_0x13007a['id']},{})['then'](function(){return _0x831013;});}else{return _0x831013;}})['catch'](function(_0x1d9f83){logger[_0xf110('0x27')](_0xf110('0x51'),_0x1d9f83);throw _0x1d9f83;});}return _0x831013;})[_0xf110('0x25')](respondWithResult(_0x105b07,0xc9))[_0xf110('0x48')](handleError(_0x105b07,null));};exports[_0xf110('0x23')]=function(_0x199c18,_0x1e8984){if(_0x199c18[_0xf110('0x4a')]['id']){delete _0x199c18['body']['id'];}return db[_0xf110('0x2b')][_0xf110('0x52')]({'where':{'id':_0x199c18[_0xf110('0x45')]['id']}})['then'](handleEntityNotFound(_0x1e8984,null))[_0xf110('0x25')](saveUpdates(_0x199c18[_0xf110('0x4a')],null))[_0xf110('0x25')](respondWithResult(_0x1e8984,null))[_0xf110('0x48')](handleError(_0x1e8984,null));};exports[_0xf110('0x24')]=function(_0x460806,_0x4d41e5){return db[_0xf110('0x2b')][_0xf110('0x52')]({'where':{'id':_0x460806['params']['id']}})[_0xf110('0x25')](handleEntityNotFound(_0x4d41e5,null))[_0xf110('0x25')](removeEntity(_0x4d41e5,null))[_0xf110('0x48')](handleError(_0x4d41e5,null));};exports[_0xf110('0x53')]=function(_0x4e5445,_0x1fc17b){return db[_0xf110('0x2b')][_0xf110('0x53')]()[_0xf110('0x25')](respondWithResult(_0x1fc17b,null))['catch'](handleError(_0x1fc17b,null));};exports[_0xf110('0x54')]=function(_0x17a0f6,_0xc4d32d,_0x6cb9c4){var _0xeffa42={'raw':!![],'where':{}},_0x2709a2={},_0x2765cf;return db['FaxQueue'][_0xf110('0x55')]({'where':{'id':_0x17a0f6[_0xf110('0x45')]['id']}})[_0xf110('0x25')](handleEntityNotFound(_0xc4d32d,null))[_0xf110('0x25')](function(_0x3098fd){if(_0x3098fd){_0x2765cf=_0x3098fd[_0xf110('0x4c')]({'plain':!![]});_0x2709a2[_0xf110('0x30')]=_[_0xf110('0x32')](db[_0xf110('0x56')][_0xf110('0x2c')]);_0x2709a2[_0xf110('0x33')]=_[_0xf110('0x32')](_0x17a0f6['query']);_0x2709a2[_0xf110('0x34')]=_['intersection'](_0x2709a2[_0xf110('0x30')],_0x2709a2['query']);_0xeffa42[_0xf110('0x36')]=_[_0xf110('0x35')](_0x2709a2['model'],qs[_0xf110('0x37')](_0x17a0f6[_0xf110('0x33')]['fields']));_0xeffa42[_0xf110('0x36')]=_0xeffa42['attributes'][_0xf110('0x46')]?_0xeffa42[_0xf110('0x36')]:_0x2709a2[_0xf110('0x30')];if(!_0x17a0f6[_0xf110('0x33')][_0xf110('0x38')]('nolimit')){_0xeffa42['limit']=qs['limit'](_0x17a0f6[_0xf110('0x33')][_0xf110('0x1e')]);_0xeffa42[_0xf110('0x1d')]=qs[_0xf110('0x1d')](_0x17a0f6[_0xf110('0x33')]['offset']);}_0xeffa42[_0xf110('0x3a')]=qs[_0xf110('0x3b')](_0x17a0f6[_0xf110('0x33')][_0xf110('0x3b')]);_0xeffa42[_0xf110('0x3c')]=qs[_0xf110('0x34')](_[_0xf110('0x3d')](_0x17a0f6[_0xf110('0x33')],_0x2709a2[_0xf110('0x34')]));_0xeffa42[_0xf110('0x3c')][_0xf110('0x57')]=_0x3098fd['id'];if(_0x17a0f6[_0xf110('0x33')][_0xf110('0x3f')]){_0xeffa42[_0xf110('0x3c')]=_[_0xf110('0x3e')](_0xeffa42[_0xf110('0x3c')],{'$or':_['map'](_0xeffa42[_0xf110('0x36')],function(_0x53d417){var _0x4aea36={};_0x4aea36[_0x53d417]={'$like':'%'+_0x17a0f6['query'][_0xf110('0x3f')]+'%'};return _0x4aea36;})});}_0xeffa42=_[_0xf110('0x3e')]({},_0xeffa42,_0x17a0f6[_0xf110('0x40')]);return db['UserFaxQueue'][_0xf110('0x43')](_0xeffa42);}})[_0xf110('0x25')](function(_0x378dea){if(_0x378dea){return db[_0xf110('0x58')]['findAndCountAll']({'where':{'id':_['map'](_0x378dea,_0xf110('0x59')),'role':'agent'},'attributes':['id',_0xf110('0x28'),'faxPause',_0xf110('0x5a'),_0xf110('0x5b')]});}})[_0xf110('0x25')](function(_0x27b4b7){if(_0x27b4b7){return{'count':_0x27b4b7['count'],'rows':_[_0xf110('0x31')](_0x27b4b7[_0xf110('0x5c')],function(_0xcc19cf){return{'membername':_0xcc19cf[_0xf110('0x28')],'UserId':_0xcc19cf['id'],'queue_name':_0x2765cf['name'],'FaxQueueId':_0x2765cf['id'],'interface':util['format']('%s/%s','SIP',_0xcc19cf[_0xf110('0x28')]),'penalty':0x0,'paused':_0xcc19cf[_0xf110('0x5d')],'createdAt':_0xcc19cf[_0xf110('0x5b')],'updatedAt':_0xcc19cf[_0xf110('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xf110('0x25')](respondWithFilteredResult(_0xc4d32d,_0xeffa42))[_0xf110('0x48')](handleError(_0xc4d32d,null));};exports[_0xf110('0x5e')]=function(_0x2dec30,_0xe452cd,_0x24caf2){var _0x546c34={};var _0x2c57d1={};var _0x549817;var _0x5f3ded;return db['FaxQueue'][_0xf110('0x55')]({'where':{'id':_0x2dec30[_0xf110('0x45')]['id']}})[_0xf110('0x25')](handleEntityNotFound(_0xe452cd,null))[_0xf110('0x25')](function(_0x298384){if(_0x298384){_0x549817=_0x298384;_0x2c57d1[_0xf110('0x30')]=_[_0xf110('0x32')](db[_0xf110('0x5f')][_0xf110('0x2c')]);_0x2c57d1[_0xf110('0x33')]=_[_0xf110('0x32')](_0x2dec30['query']);_0x2c57d1[_0xf110('0x34')]=_['intersection'](_0x2c57d1['model'],_0x2c57d1[_0xf110('0x33')]);_0x546c34[_0xf110('0x36')]=_[_0xf110('0x35')](_0x2c57d1[_0xf110('0x30')],qs['fields'](_0x2dec30[_0xf110('0x33')][_0xf110('0x37')]));_0x546c34[_0xf110('0x36')]=_0x546c34[_0xf110('0x36')][_0xf110('0x46')]?_0x546c34[_0xf110('0x36')]:_0x2c57d1[_0xf110('0x30')];_0x546c34[_0xf110('0x3a')]=qs['sort'](_0x2dec30[_0xf110('0x33')][_0xf110('0x3b')]);_0x546c34[_0xf110('0x3c')]=qs[_0xf110('0x34')](_[_0xf110('0x3d')](_0x2dec30[_0xf110('0x33')],_0x2c57d1[_0xf110('0x34')]));if(_0x2dec30['query'][_0xf110('0x3f')]){_0x546c34['where']=_[_0xf110('0x3e')](_0x546c34[_0xf110('0x3c')],{'$or':_[_0xf110('0x31')](_0x546c34['attributes'],function(_0x3f60cc){var _0x3ac981={};_0x3ac981[_0x3f60cc]={'$like':'%'+_0x2dec30['query']['filter']+'%'};return _0x3ac981;})});}_0x546c34=_[_0xf110('0x3e')]({},_0x546c34,_0x2dec30[_0xf110('0x40')]);return _0x549817['getTeams'](_0x546c34);}})[_0xf110('0x25')](function(_0x431bce){if(_0x431bce){_0x5f3ded=_0x431bce[_0xf110('0x46')];if(!_0x2dec30[_0xf110('0x33')]['hasOwnProperty'](_0xf110('0x39'))){_0x546c34[_0xf110('0x1e')]=qs[_0xf110('0x1e')](_0x2dec30[_0xf110('0x33')]['limit']);_0x546c34[_0xf110('0x1d')]=qs['offset'](_0x2dec30[_0xf110('0x33')][_0xf110('0x1d')]);}return _0x549817[_0xf110('0x5e')](_0x546c34);}})['then'](function(_0x4e0d30){if(_0x4e0d30){return _0x4e0d30?{'count':_0x5f3ded,'rows':_0x4e0d30}:null;}})[_0xf110('0x25')](respondWithResult(_0xe452cd,null))[_0xf110('0x48')](handleError(_0xe452cd,null));};exports[_0xf110('0x60')]=function(_0x45470b,_0x404139,_0x5d0353){var _0x289634=_0x45470b['body'][_0xf110('0x61')];return db[_0xf110('0x5f')][_0xf110('0x43')]({'where':{'id':_0x289634},'attributes':['id'],'include':[{'model':db[_0xf110('0x58')],'as':_0xf110('0x62'),'attributes':['id','name','online',_0xf110('0x63'),_0xf110('0x64')],'raw':!![]}]})[_0xf110('0x25')](function(_0x11aa1d){if(_0x11aa1d){var _0x161289=_['flatMap'](_0x11aa1d,function(_0x50a809){var _0x40b3a3=_0x50a809[_0xf110('0x4c')]({'plain':!![]});return _0x40b3a3[_0xf110('0x62')];});return db['FaxQueue'][_0xf110('0x52')]({'where':{'id':_0x45470b[_0xf110('0x45')]['id']}})['then'](function(_0x5067b2){return db[_0xf110('0x65')]['transaction'](function(_0x1b9323){return _0x5067b2[_0xf110('0x60')](_0x289634,{'transaction':_0x1b9323})[_0xf110('0x25')](function(){return BPromise[_0xf110('0x66')](_0x161289,function(_0x42aa5a){return db['UserFaxQueue']['findOrCreate']({'where':{'UserId':_0x42aa5a['id'],'FaxQueueId':_0x45470b['params']['id']},'transaction':_0x1b9323});});})['then'](function(){_0x161289[_0xf110('0x67')](function(_0x3188ff){socket[_0xf110('0x68')]('userFaxQueue:save',{'UserId':_0x3188ff['id'],'FaxQueueId':_0x5067b2['id']});});});});});}})['then'](respondWithStatusCode(_0x404139,null))[_0xf110('0x48')](handleError(_0x404139,null));};exports[_0xf110('0x69')]=function(_0xe3bc02,_0x2e5173,_0x1738c8){return db['Team'][_0xf110('0x43')]({'where':{'id':_0xe3bc02[_0xf110('0x33')][_0xf110('0x61')]},'attributes':['id'],'include':[{'model':db[_0xf110('0x58')],'as':_0xf110('0x62'),'attributes':['id'],'raw':!![]}]})[_0xf110('0x25')](handleEntityNotFound(_0x2e5173,null))['then'](function(_0xe84f45){var _0x57f295=_[_0xf110('0x31')](_0xe84f45,'id');var _0x10c2be=[];var _0x33f57f=[];var _0x14f335=squel['select']();_0x14f335[_0xf110('0x6a')](_0xf110('0x6b'))[_0xf110('0x6c')]('team_has_fax_queues','tq')[_0xf110('0x6d')](_0xf110('0x6e'),'ut',_0xf110('0x6f'))[_0xf110('0x3c')](_0xf110('0x70'),_0xe3bc02[_0xf110('0x45')]['id']);for(var _0x35516a=0x0;_0x35516a<_0xe84f45[_0xf110('0x46')];_0x35516a+=0x1){let _0x73ac6e=_0xe84f45[_0x35516a];for(var _0x4a45e7=0x0;_0x4a45e7<_0x73ac6e['Agents'][_0xf110('0x46')];_0x4a45e7+=0x1){let _0x347459=_0x73ac6e[_0xf110('0x62')][_0x4a45e7];var _0x431968=_0x14f335[_0xf110('0x71')]();_0x431968[_0xf110('0x3c')]('ut.UserId\x20=\x20?',_0x347459['id']);_0x33f57f[_0xf110('0x72')](db['sequelize'][_0xf110('0x33')](_0x431968[_0xf110('0x73')](),{'type':db[_0xf110('0x65')]['QueryTypes'][_0xf110('0x74')]})[_0xf110('0x25')](function(_0x3e70fc){if(_0x3e70fc[_0xf110('0x46')]===0x1){return _0x347459['id'];}else{var _0x1a0ef8=_[_0xf110('0x75')](_[_0xf110('0x31')](_0x3e70fc,_0xf110('0x76')),function(_0x3152bc){return _['includes'](_0x57f295,_0x3152bc);});if(_0x1a0ef8){return _0x347459['id'];}}}));}}return BPromise[_0xf110('0x77')](_0x33f57f)['then'](function(_0x35393a){_0x10c2be=_(_0x10c2be)[_0xf110('0x78')](_0x35393a)[_0xf110('0x79')]()[_0xf110('0x7a')]();return db['FaxQueue'][_0xf110('0x52')]({'where':{'id':_0xe3bc02[_0xf110('0x45')]['id']}})[_0xf110('0x25')](function(_0x2abc4f){return db[_0xf110('0x65')]['transaction'](function(_0x2b8a68){return _0x2abc4f['removeTeams'](_0xe3bc02['query'][_0xf110('0x61')],{'transaction':_0x2b8a68})[_0xf110('0x25')](function(){if(!_[_0xf110('0x7b')](_0x10c2be)){return _0x2abc4f['removeAgents'](_0x10c2be,{'transaction':_0x2b8a68});}})[_0xf110('0x25')](function(){_0x10c2be[_0xf110('0x67')](function(_0x1fb49c){socket['emit'](_0xf110('0x7c'),{'UserId':_0x1fb49c,'FaxQueueId':_0x2abc4f['id']});});});});});});})[_0xf110('0x25')](respondWithStatusCode(_0x2e5173,null))['catch'](handleError(_0x2e5173,null));};exports['addAgents']=function(_0x22754c,_0x26ea86,_0x195356){return db[_0xf110('0x2b')]['find']({'where':{'id':_0x22754c[_0xf110('0x45')]['id']}})[_0xf110('0x25')](handleEntityNotFound(_0x26ea86,null))[_0xf110('0x25')](function(_0x2e7cd1){if(_0x2e7cd1){return _0x2e7cd1[_0xf110('0x7d')](_0x22754c['body'][_0xf110('0x61')],_[_0xf110('0x7e')](_0x22754c[_0xf110('0x4a')],['ids','id'])||{})[_0xf110('0x7f')](function(_0x4b40c9){for(var _0x3f7ccc=0x0;_0x3f7ccc<_0x22754c[_0xf110('0x4a')]['ids'][_0xf110('0x46')];_0x3f7ccc+=0x1){socket[_0xf110('0x68')]('userFaxQueue:save',{'UserId':_0x22754c['body'][_0xf110('0x61')][_0x3f7ccc],'FaxQueueId':_0x22754c[_0xf110('0x45')]['id']});}return _0x4b40c9;});}})[_0xf110('0x25')](respondWithResult(_0x26ea86,null))['catch'](handleError(_0x26ea86,null));};exports[_0xf110('0x80')]=function(_0x59321d,_0x402bf3,_0x5a748a){return db[_0xf110('0x2b')]['find']({'where':{'id':_0x59321d['params']['id']}})['then'](handleEntityNotFound(_0x402bf3,null))[_0xf110('0x25')](function(_0x1608e6){if(_0x1608e6){return _0x1608e6[_0xf110('0x80')](_0x59321d['query'][_0xf110('0x61')])[_0xf110('0x25')](function(){if(_[_0xf110('0x81')](_0x59321d[_0xf110('0x33')][_0xf110('0x61')])){for(var _0x48e243=0x0;_0x48e243<_0x59321d['query'][_0xf110('0x61')]['length'];_0x48e243+=0x1){socket['emit']('userFaxQueue:remove',{'UserId':Number(_0x59321d[_0xf110('0x33')][_0xf110('0x61')][_0x48e243]),'FaxQueueId':Number(_0x59321d[_0xf110('0x45')]['id'])});}}else{socket[_0xf110('0x68')]('userFaxQueue:remove',{'UserId':Number(_0x59321d[_0xf110('0x33')]['ids']),'FaxQueueId':Number(_0x59321d['params']['id'])});}});}})[_0xf110('0x25')](respondWithStatusCode(_0x402bf3,null))[_0xf110('0x48')](handleError(_0x402bf3,null));};exports['getAgents']=function(_0x51a0b4,_0x578576,_0x868714){var _0x326122={};var _0x5b0db2={};var _0x521bd1;var _0x4fce9f;return db[_0xf110('0x2b')][_0xf110('0x55')]({'where':{'id':_0x51a0b4[_0xf110('0x45')]['id']}})[_0xf110('0x25')](handleEntityNotFound(_0x578576,null))[_0xf110('0x25')](function(_0x4ea257){if(_0x4ea257){_0x521bd1=_0x4ea257;_0x5b0db2[_0xf110('0x30')]=_['keys'](db['User']['rawAttributes']);_0x5b0db2[_0xf110('0x33')]=_[_0xf110('0x32')](_0x51a0b4[_0xf110('0x33')]);_0x5b0db2[_0xf110('0x34')]=_['intersection'](_0x5b0db2[_0xf110('0x30')],_0x5b0db2[_0xf110('0x33')]);_0x326122['attributes']=_['intersection'](_0x5b0db2[_0xf110('0x30')],qs[_0xf110('0x37')](_0x51a0b4[_0xf110('0x33')][_0xf110('0x37')]));_0x326122[_0xf110('0x36')]=_0x326122[_0xf110('0x36')][_0xf110('0x46')]?_0x326122[_0xf110('0x36')]:_0x5b0db2[_0xf110('0x30')];_0x326122[_0xf110('0x3a')]=qs[_0xf110('0x3b')](_0x51a0b4[_0xf110('0x33')][_0xf110('0x3b')]);_0x326122['where']=qs[_0xf110('0x34')](_['pick'](_0x51a0b4[_0xf110('0x33')],_0x5b0db2[_0xf110('0x34')]));if(_0x51a0b4[_0xf110('0x33')][_0xf110('0x3f')]){_0x326122['where']=_[_0xf110('0x3e')](_0x326122[_0xf110('0x3c')],{'$or':_[_0xf110('0x31')](_0x326122[_0xf110('0x36')],function(_0x39db05){var _0x59c669={};_0x59c669[_0x39db05]={'$like':'%'+_0x51a0b4[_0xf110('0x33')]['filter']+'%'};return _0x59c669;})});}_0x326122=_['merge']({},_0x326122,_0x51a0b4[_0xf110('0x40')]);return _0x521bd1[_0xf110('0x82')](_0x326122);}})[_0xf110('0x25')](function(_0x865e95){if(_0x865e95){_0x4fce9f=_0x865e95[_0xf110('0x46')];if(!_0x51a0b4[_0xf110('0x33')][_0xf110('0x38')](_0xf110('0x39'))){_0x326122[_0xf110('0x1e')]=qs[_0xf110('0x1e')](_0x51a0b4[_0xf110('0x33')][_0xf110('0x1e')]);_0x326122[_0xf110('0x1d')]=qs[_0xf110('0x1d')](_0x51a0b4[_0xf110('0x33')][_0xf110('0x1d')]);}return _0x521bd1[_0xf110('0x82')](_0x326122);}})[_0xf110('0x25')](function(_0x57e72a){if(_0x57e72a){return _0x57e72a?{'count':_0x4fce9f,'rows':_0x57e72a}:null;}})['then'](respondWithResult(_0x578576,null))[_0xf110('0x48')](handleError(_0x578576,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 214723e..a35291c 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 _0xd76b=['FaxQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x4dee2a,_0x380267){var _0x2b2714=function(_0x5117e0){while(--_0x5117e0){_0x4dee2a['push'](_0x4dee2a['shift']());}};_0x2b2714(++_0x380267);}(_0xd76b,0x127));var _0xbd76=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xd76b[_0x13b02f];return _0x12e9a6;};'use strict';var EventEmitter=require(_0xbd76('0x0'));var FaxQueue=require(_0xbd76('0x1'))['db'][_0xbd76('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xbd76('0x3')](0x0);var events={'afterCreate':_0xbd76('0x4'),'afterUpdate':_0xbd76('0x5'),'afterDestroy':_0xbd76('0x6')};function emitEvent(_0x518653){return function(_0x47aafc,_0x56cf3e,_0x50ae1c){FaxQueueEvents[_0xbd76('0x7')](_0x518653+':'+_0x47aafc['id'],_0x47aafc);FaxQueueEvents[_0xbd76('0x7')](_0x518653,_0x47aafc);_0x50ae1c(null);};}for(var e in events){if(events[_0xbd76('0x8')](e)){var event=events[e];FaxQueue[_0xbd76('0x9')](e,emitEvent(event));}}module[_0xbd76('0xa')]=FaxQueueEvents; \ No newline at end of file +var _0x3c5e=['update','remove','emit','hasOwnProperty','exports','events','FaxQueue','setMaxListeners','save'];(function(_0x58ca9e,_0x55ed97){var _0x2135e4=function(_0x4bf9e7){while(--_0x4bf9e7){_0x58ca9e['push'](_0x58ca9e['shift']());}};_0x2135e4(++_0x55ed97);}(_0x3c5e,0x140));var _0xe3c5=function(_0xa0c891,_0x20564b){_0xa0c891=_0xa0c891-0x0;var _0xc32d32=_0x3c5e[_0xa0c891];return _0xc32d32;};'use strict';var EventEmitter=require(_0xe3c5('0x0'));var FaxQueue=require('../../mysqldb')['db'][_0xe3c5('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xe3c5('0x2')](0x0);var events={'afterCreate':_0xe3c5('0x3'),'afterUpdate':_0xe3c5('0x4'),'afterDestroy':_0xe3c5('0x5')};function emitEvent(_0xd1a7c9){return function(_0x1e6f4c,_0x20268b,_0x35adda){FaxQueueEvents[_0xe3c5('0x6')](_0xd1a7c9+':'+_0x1e6f4c['id'],_0x1e6f4c);FaxQueueEvents[_0xe3c5('0x6')](_0xd1a7c9,_0x1e6f4c);_0x35adda(null);};}for(var e in events){if(events[_0xe3c5('0x7')](e)){var event=events[e];FaxQueue['hook'](e,emitEvent(event));}}module[_0xe3c5('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 d43e6c9..1fe07bc 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 _0x9c0b=['../../config/logger','api','bluebird','request-promise','path','rimraf','exports','define','FaxQueue','fax_queues'];(function(_0x4a0b2f,_0x461ad4){var _0xba147f=function(_0xb828cd){while(--_0xb828cd){_0x4a0b2f['push'](_0x4a0b2f['shift']());}};_0xba147f(++_0x461ad4);}(_0x9c0b,0x1b8));var _0xb9c0=function(_0x143ea6,_0x3c9999){_0x143ea6=_0x143ea6-0x0;var _0xfb14d=_0x9c0b[_0x143ea6];return _0xfb14d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb9c0('0x0'))(_0xb9c0('0x1'));var moment=require('moment');var BPromise=require(_0xb9c0('0x2'));var rp=require(_0xb9c0('0x3'));var fs=require('fs');var path=require(_0xb9c0('0x4'));var rimraf=require(_0xb9c0('0x5'));var config=require('../../config/environment');var attributes=require('./faxQueue.attributes');module[_0xb9c0('0x6')]=function(_0x383cbd,_0x538e4e){return _0x383cbd[_0xb9c0('0x7')](_0xb9c0('0x8'),attributes,{'tableName':_0xb9c0('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe948=['FaxQueue','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports'];(function(_0x47a433,_0x144e05){var _0xbab002=function(_0xfd547b){while(--_0xfd547b){_0x47a433['push'](_0x47a433['shift']());}};_0xbab002(++_0x144e05);}(_0xe948,0x90));var _0x8e94=function(_0x51c4fb,_0x174cdf){_0x51c4fb=_0x51c4fb-0x0;var _0x18f13c=_0xe948[_0x51c4fb];return _0x18f13c;};'use strict';var _=require('lodash');var util=require(_0x8e94('0x0'));var logger=require(_0x8e94('0x1'))(_0x8e94('0x2'));var moment=require(_0x8e94('0x3'));var BPromise=require(_0x8e94('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e94('0x5'));var rimraf=require(_0x8e94('0x6'));var config=require(_0x8e94('0x7'));var attributes=require(_0x8e94('0x8'));module[_0x8e94('0x9')]=function(_0x580a98,_0x193508){return _0x580a98['define'](_0x8e94('0xa'),attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index ef03f5b..d036fc1 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 _0x136f=['../../config/environment','jayson/promise','redis','defaults','localhost','./faxQueue.socket','register','request','then','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxQueue,\x20%s,\x20%s','message','result','GetFaxQueue','findAll','options','where','attributes','limit','include','map','model','info','debug','catch','ShowFaxQueue','FaxQueue','raw','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x27926c,_0x37d579){var _0x584578=function(_0x32e167){while(--_0x32e167){_0x27926c['push'](_0x27926c['shift']());}};_0x584578(++_0x37d579);}(_0x136f,0x6c));var _0xf136=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0x136f[_0xa148b7];return _0x51efd3;};'use strict';var _=require(_0xf136('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf136('0x1'));var rs=require(_0xf136('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf136('0x3'))['db'];var utils=require(_0xf136('0x4'));var logger=require(_0xf136('0x5'))('rpc');var config=require(_0xf136('0x6'));var jayson=require(_0xf136('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0xf136('0x8')]=_[_0xf136('0x9')](config[_0xf136('0x8')],{'host':_0xf136('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xf136('0xb'))[_0xf136('0xc')](socket);function respondWithRpcPromise(_0x2bfd6c,_0x46b5cd,_0x4f5add){return new BPromise(function(_0x334027,_0x35fe81){return client[_0xf136('0xd')](_0x2bfd6c,_0x4f5add)[_0xf136('0xe')](function(_0x273234){logger['info']('FaxQueue,\x20%s,\x20%s',_0x46b5cd,_0xf136('0xf'));logger['debug'](_0xf136('0x10'),_0x46b5cd,_0xf136('0xf'),JSON[_0xf136('0x11')](_0x273234));if(_0x273234[_0xf136('0x12')]){if(_0x273234[_0xf136('0x12')][_0xf136('0x13')]===0x1f4){logger[_0xf136('0x12')](_0xf136('0x14'),_0x46b5cd,_0x273234[_0xf136('0x12')][_0xf136('0x15')]);return _0x35fe81(_0x273234[_0xf136('0x12')][_0xf136('0x15')]);}logger[_0xf136('0x12')](_0xf136('0x14'),_0x46b5cd,_0x273234[_0xf136('0x12')][_0xf136('0x15')]);return _0x334027(_0x273234[_0xf136('0x12')]['message']);}else{logger['info'](_0xf136('0x14'),_0x46b5cd,_0xf136('0xf'));_0x334027(_0x273234[_0xf136('0x16')][_0xf136('0x15')]);}})['catch'](function(_0x340e24){logger[_0xf136('0x12')](_0xf136('0x14'),_0x46b5cd,_0x340e24);_0x35fe81(_0x340e24);});});}exports[_0xf136('0x17')]=function(_0x4dd9ba){var _0x43da2f=this;return new Promise(function(_0xbceb74,_0x121ad2){return db['FaxQueue'][_0xf136('0x18')]({'raw':_0x4dd9ba['options']?_0x4dd9ba[_0xf136('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x4dd9ba[_0xf136('0x19')]?_0x4dd9ba['options'][_0xf136('0x1a')]||null:null,'attributes':_0x4dd9ba['options']?_0x4dd9ba[_0xf136('0x19')][_0xf136('0x1b')]||null:null,'limit':_0x4dd9ba['options']?_0x4dd9ba[_0xf136('0x19')][_0xf136('0x1c')]||null:null,'include':_0x4dd9ba['options']?_0x4dd9ba['options'][_0xf136('0x1d')]?_[_0xf136('0x1e')](_0x4dd9ba[_0xf136('0x19')]['include'],function(_0x5f3663){return{'model':db[_0x5f3663[_0xf136('0x1f')]],'as':_0x5f3663['as'],'attributes':_0x5f3663['attributes'],'include':_0x5f3663[_0xf136('0x1d')]?_[_0xf136('0x1e')](_0x5f3663[_0xf136('0x1d')],function(_0x18176d){return{'model':db[_0x18176d['model']],'as':_0x18176d['as'],'attributes':_0x18176d[_0xf136('0x1b')],'include':_0x18176d[_0xf136('0x1d')]?_['map'](_0x18176d['include'],function(_0x35424b){return{'model':db[_0x35424b[_0xf136('0x1f')]],'as':_0x35424b['as'],'attributes':_0x35424b[_0xf136('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x132b60){logger[_0xf136('0x20')](_0xf136('0x17'),_0x4dd9ba);logger[_0xf136('0x21')](_0xf136('0x17'),_0x4dd9ba,JSON[_0xf136('0x11')](_0x132b60));_0xbceb74(_0x132b60);})[_0xf136('0x22')](function(_0x29546e){logger[_0xf136('0x12')](_0xf136('0x17'),_0x29546e[_0xf136('0x15')],_0x4dd9ba);_0x121ad2(_0x43da2f[_0xf136('0x12')](0x1f4,_0x29546e[_0xf136('0x15')]));});});};exports[_0xf136('0x23')]=function(_0x1e4a73){var _0x3665d8=this;return new Promise(function(_0x7180b7,_0x1dea9f){return db[_0xf136('0x24')]['find']({'raw':_0x1e4a73[_0xf136('0x19')]?_0x1e4a73['options'][_0xf136('0x25')]===undefined?!![]:![]:!![],'where':_0x1e4a73[_0xf136('0x19')]?_0x1e4a73[_0xf136('0x19')]['where']||null:null,'attributes':_0x1e4a73[_0xf136('0x19')]?_0x1e4a73[_0xf136('0x19')][_0xf136('0x1b')]||null:null,'include':_0x1e4a73[_0xf136('0x19')]?_0x1e4a73[_0xf136('0x19')]['include']?_[_0xf136('0x1e')](_0x1e4a73[_0xf136('0x19')]['include'],function(_0x381663){return{'model':db[_0x381663['model']],'as':_0x381663['as'],'attributes':_0x381663[_0xf136('0x1b')],'include':_0x381663[_0xf136('0x1d')]?_[_0xf136('0x1e')](_0x381663[_0xf136('0x1d')],function(_0x5ab617){return{'model':db[_0x5ab617[_0xf136('0x1f')]],'as':_0x5ab617['as'],'attributes':_0x5ab617[_0xf136('0x1b')],'include':_0x5ab617[_0xf136('0x1d')]?_[_0xf136('0x1e')](_0x5ab617[_0xf136('0x1d')],function(_0x4b20ac){return{'model':db[_0x4b20ac[_0xf136('0x1f')]],'as':_0x4b20ac['as'],'attributes':_0x4b20ac[_0xf136('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3eb6ff){logger[_0xf136('0x20')](_0xf136('0x23'),_0x1e4a73);logger[_0xf136('0x21')]('ShowFaxQueue',_0x1e4a73,JSON[_0xf136('0x11')](_0x3eb6ff));_0x7180b7(_0x3eb6ff);})[_0xf136('0x22')](function(_0xa04c8e){logger[_0xf136('0x12')]('ShowFaxQueue',_0xa04c8e[_0xf136('0x15')],_0x1e4a73);_0x1dea9f(_0x3665d8['error'](0x1f4,_0xa04c8e[_0xf136('0x15')]));});});}; \ No newline at end of file +var _0x91c7=['map','model','then','ShowFaxQueue','find','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','socket.io-emitter','./faxQueue.socket','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','options','raw','where','attributes','include'];(function(_0x4e35dc,_0x599a85){var _0x76c104=function(_0x5e2222){while(--_0x5e2222){_0x4e35dc['push'](_0x4e35dc['shift']());}};_0x76c104(++_0x599a85);}(_0x91c7,0x8d));var _0x791c=function(_0x5c12ae,_0x29ab56){_0x5c12ae=_0x5c12ae-0x0;var _0x6b60d1=_0x91c7[_0x5c12ae];return _0x6b60d1;};'use strict';var _=require('lodash');var util=require(_0x791c('0x0'));var moment=require(_0x791c('0x1'));var BPromise=require(_0x791c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x791c('0x3'))['db'];var utils=require(_0x791c('0x4'));var logger=require(_0x791c('0x5'))(_0x791c('0x6'));var config=require('../../config/environment');var jayson=require(_0x791c('0x7'));var client=jayson[_0x791c('0x8')]['http']({'port':0x232a});config[_0x791c('0x9')]=_['defaults'](config[_0x791c('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x791c('0xa'))(new Redis(config[_0x791c('0x9')]));require(_0x791c('0xb'))['register'](socket);function respondWithRpcPromise(_0x2f9f92,_0x4b1814,_0x4e0485){return new BPromise(function(_0x101589,_0x58d021){return client['request'](_0x2f9f92,_0x4e0485)['then'](function(_0x3d27f9){logger[_0x791c('0xc')](_0x791c('0xd'),_0x4b1814,_0x791c('0xe'));logger[_0x791c('0xf')](_0x791c('0x10'),_0x4b1814,_0x791c('0xe'),JSON[_0x791c('0x11')](_0x3d27f9));if(_0x3d27f9['error']){if(_0x3d27f9[_0x791c('0x12')][_0x791c('0x13')]===0x1f4){logger['error'](_0x791c('0xd'),_0x4b1814,_0x3d27f9['error'][_0x791c('0x14')]);return _0x58d021(_0x3d27f9[_0x791c('0x12')][_0x791c('0x14')]);}logger['error']('FaxQueue,\x20%s,\x20%s',_0x4b1814,_0x3d27f9[_0x791c('0x12')][_0x791c('0x14')]);return _0x101589(_0x3d27f9[_0x791c('0x12')]['message']);}else{logger['info']('FaxQueue,\x20%s,\x20%s',_0x4b1814,'request\x20sent');_0x101589(_0x3d27f9['result'][_0x791c('0x14')]);}})[_0x791c('0x15')](function(_0x310c07){logger[_0x791c('0x12')](_0x791c('0xd'),_0x4b1814,_0x310c07);_0x58d021(_0x310c07);});});}exports[_0x791c('0x16')]=function(_0x6f2909){var _0x8cea92=this;return new Promise(function(_0x1a441a,_0x415d78){return db[_0x791c('0x17')]['findAll']({'raw':_0x6f2909[_0x791c('0x18')]?_0x6f2909[_0x791c('0x18')][_0x791c('0x19')]===undefined?!![]:![]:!![],'where':_0x6f2909[_0x791c('0x18')]?_0x6f2909['options'][_0x791c('0x1a')]||null:null,'attributes':_0x6f2909[_0x791c('0x18')]?_0x6f2909['options'][_0x791c('0x1b')]||null:null,'limit':_0x6f2909[_0x791c('0x18')]?_0x6f2909[_0x791c('0x18')]['limit']||null:null,'include':_0x6f2909[_0x791c('0x18')]?_0x6f2909['options'][_0x791c('0x1c')]?_[_0x791c('0x1d')](_0x6f2909[_0x791c('0x18')][_0x791c('0x1c')],function(_0x43fc8e){return{'model':db[_0x43fc8e[_0x791c('0x1e')]],'as':_0x43fc8e['as'],'attributes':_0x43fc8e[_0x791c('0x1b')],'include':_0x43fc8e[_0x791c('0x1c')]?_['map'](_0x43fc8e[_0x791c('0x1c')],function(_0x496033){return{'model':db[_0x496033[_0x791c('0x1e')]],'as':_0x496033['as'],'attributes':_0x496033[_0x791c('0x1b')],'include':_0x496033[_0x791c('0x1c')]?_[_0x791c('0x1d')](_0x496033[_0x791c('0x1c')],function(_0x10c42f){return{'model':db[_0x10c42f[_0x791c('0x1e')]],'as':_0x10c42f['as'],'attributes':_0x10c42f[_0x791c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x791c('0x1f')](function(_0x166d60){logger[_0x791c('0xc')]('GetFaxQueue',_0x6f2909);logger[_0x791c('0xf')]('GetFaxQueue',_0x6f2909,JSON[_0x791c('0x11')](_0x166d60));_0x1a441a(_0x166d60);})[_0x791c('0x15')](function(_0x321bca){logger[_0x791c('0x12')](_0x791c('0x16'),_0x321bca[_0x791c('0x14')],_0x6f2909);_0x415d78(_0x8cea92[_0x791c('0x12')](0x1f4,_0x321bca[_0x791c('0x14')]));});});};exports[_0x791c('0x20')]=function(_0x4bcd21){var _0x1597a3=this;return new Promise(function(_0xbb3e2d,_0xa45a6b){return db[_0x791c('0x17')][_0x791c('0x21')]({'raw':_0x4bcd21['options']?_0x4bcd21['options'][_0x791c('0x19')]===undefined?!![]:![]:!![],'where':_0x4bcd21[_0x791c('0x18')]?_0x4bcd21[_0x791c('0x18')][_0x791c('0x1a')]||null:null,'attributes':_0x4bcd21['options']?_0x4bcd21['options'][_0x791c('0x1b')]||null:null,'include':_0x4bcd21[_0x791c('0x18')]?_0x4bcd21['options']['include']?_[_0x791c('0x1d')](_0x4bcd21[_0x791c('0x18')]['include'],function(_0x33c676){return{'model':db[_0x33c676[_0x791c('0x1e')]],'as':_0x33c676['as'],'attributes':_0x33c676[_0x791c('0x1b')],'include':_0x33c676[_0x791c('0x1c')]?_[_0x791c('0x1d')](_0x33c676[_0x791c('0x1c')],function(_0x10fde1){return{'model':db[_0x10fde1[_0x791c('0x1e')]],'as':_0x10fde1['as'],'attributes':_0x10fde1[_0x791c('0x1b')],'include':_0x10fde1[_0x791c('0x1c')]?_['map'](_0x10fde1[_0x791c('0x1c')],function(_0x41c44e){return{'model':db[_0x41c44e['model']],'as':_0x41c44e['as'],'attributes':_0x41c44e[_0x791c('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x791c('0x1f')](function(_0x10b6a5){logger['info'](_0x791c('0x20'),_0x4bcd21);logger[_0x791c('0xf')](_0x791c('0x20'),_0x4bcd21,JSON['stringify'](_0x10b6a5));_0xbb3e2d(_0x10b6a5);})[_0x791c('0x15')](function(_0x5a6c96){logger[_0x791c('0x12')](_0x791c('0x20'),_0x5a6c96[_0x791c('0x14')],_0x4bcd21);_0xa45a6b(_0x1597a3[_0x791c('0x12')](0x1f4,_0x5a6c96['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index e150fc0..e747a69 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 _0xc7e4=['removeListener','register','faxQueue:','./faxQueue.events','save','remove','emit'];(function(_0x21ada4,_0xc89442){var _0x2c157d=function(_0x4e5558){while(--_0x4e5558){_0x21ada4['push'](_0x21ada4['shift']());}};_0x2c157d(++_0xc89442);}(_0xc7e4,0x137));var _0x4c7e=function(_0x19be15,_0x5271d3){_0x19be15=_0x19be15-0x0;var _0x28b46d=_0xc7e4[_0x19be15];return _0x28b46d;};'use strict';var FaxQueueEvents=require(_0x4c7e('0x0'));var events=[_0x4c7e('0x1'),_0x4c7e('0x2'),'update'];function createListener(_0x28ec66,_0x521d5a){return function(_0x84d4e9){_0x521d5a[_0x4c7e('0x3')](_0x28ec66,_0x84d4e9);};}function removeListener(_0x4245a7,_0x4ccf5e){return function(){FaxQueueEvents[_0x4c7e('0x4')](_0x4245a7,_0x4ccf5e);};}exports[_0x4c7e('0x5')]=function(_0x3d7dc6){for(var _0x41ef00=0x0,_0x258985=events['length'];_0x41ef00<_0x258985;_0x41ef00++){var _0x496872=events[_0x41ef00];var _0x5e9e61=createListener(_0x4c7e('0x6')+_0x496872,_0x3d7dc6);FaxQueueEvents['on'](_0x496872,_0x5e9e61);}}; \ No newline at end of file +var _0xb751=['removeListener','register','length','faxQueue:','remove','update'];(function(_0x3a4249,_0x484329){var _0x2910b6=function(_0x164d3e){while(--_0x164d3e){_0x3a4249['push'](_0x3a4249['shift']());}};_0x2910b6(++_0x484329);}(_0xb751,0x1f0));var _0x1b75=function(_0x2d5f53,_0x1d2f95){_0x2d5f53=_0x2d5f53-0x0;var _0xb3d5b8=_0xb751[_0x2d5f53];return _0xb3d5b8;};'use strict';var FaxQueueEvents=require('./faxQueue.events');var events=['save',_0x1b75('0x0'),_0x1b75('0x1')];function createListener(_0x1dafdd,_0x11e7c8){return function(_0x283a60){_0x11e7c8['emit'](_0x1dafdd,_0x283a60);};}function removeListener(_0x225a40,_0x56311b){return function(){FaxQueueEvents[_0x1b75('0x2')](_0x225a40,_0x56311b);};}exports[_0x1b75('0x3')]=function(_0x391fe6){for(var _0x37fe68=0x0,_0x46b853=events[_0x1b75('0x4')];_0x37fe68<_0x46b853;_0x37fe68++){var _0x1a5d22=events[_0x37fe68];var _0x12943e=createListener(_0x1b75('0x5')+_0x1a5d22,_0x391fe6);FaxQueueEvents['on'](_0x1a5d22,_0x12943e);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 59c06ae..e348d88 100644 --- a/server/api/faxQueue/index.js +++ b/server/api/faxQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b0e=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','destroy','delete','removeTeams','removeAgents','multer'];(function(_0x1faaa1,_0x1568dd){var _0x994ec=function(_0x298ef4){while(--_0x298ef4){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x994ec(++_0x1568dd);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0x0b0e[_0x3e182f];return _0x23edc9;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var auth=require(_0xe0b0('0x4'));var interaction=require(_0xe0b0('0x5'));var config=require(_0xe0b0('0x6'));var controller=require(_0xe0b0('0x7'));router[_0xe0b0('0x8')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xa')]);router[_0xe0b0('0x8')](_0xe0b0('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0xe0b0('0x8')](_0xe0b0('0xc'),auth[_0xe0b0('0x9')](),controller[_0xe0b0('0xd')]);router['get'](_0xe0b0('0xe'),auth[_0xe0b0('0x9')](),controller['getMembers']);router[_0xe0b0('0x8')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x10')]);router[_0xe0b0('0x8')](_0xe0b0('0x11'),auth['isAuthenticated'](),controller[_0xe0b0('0x12')]);router[_0xe0b0('0x13')]('/',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x14')]);router[_0xe0b0('0x13')]('/:id/teams',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x15')]);router[_0xe0b0('0x13')](_0xe0b0('0x11'),auth[_0xe0b0('0x9')](),controller['addAgents']);router[_0xe0b0('0x16')]('/:id',auth[_0xe0b0('0x9')](),controller[_0xe0b0('0x17')]);router['delete'](_0xe0b0('0xc'),auth['isAuthenticated'](),controller[_0xe0b0('0x18')]);router[_0xe0b0('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xe0b0('0x1a')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xe0b0('0x1b')]);module['exports']=router; \ No newline at end of file +var _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(_0x14c093,_0x12cae1){var _0x473746=function(_0x4cfe44){while(--_0x4cfe44){_0x14c093['push'](_0x14c093['shift']());}};_0x473746(++_0x12cae1);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var auth=require(_0x0baf('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x0baf('0x6'));var controller=require(_0x0baf('0x7'));router[_0x0baf('0x8')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0xa')]);router[_0x0baf('0x8')](_0x0baf('0xb'),auth[_0x0baf('0x9')](),controller[_0x0baf('0xc')]);router['get'](_0x0baf('0xd'),auth['isAuthenticated'](),controller[_0x0baf('0xe')]);router[_0x0baf('0x8')](_0x0baf('0xf'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x10')]);router[_0x0baf('0x8')](_0x0baf('0x11'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x8')](_0x0baf('0x13'),auth['isAuthenticated'](),controller['getAgents']);router[_0x0baf('0x14')]('/',auth[_0x0baf('0x9')](),controller[_0x0baf('0x15')]);router[_0x0baf('0x14')]('/:id/teams',auth[_0x0baf('0x9')](),controller['addTeams']);router[_0x0baf('0x14')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x16')]);router[_0x0baf('0x17')](_0x0baf('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x0baf('0x18')](_0x0baf('0xd'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x19')]);router[_0x0baf('0x18')](_0x0baf('0x11'),auth['isAuthenticated'](),controller[_0x0baf('0x1a')]);router[_0x0baf('0x18')](_0x0baf('0x13'),auth[_0x0baf('0x9')](),controller[_0x0baf('0x1b')]);module[_0x0baf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index 1c5261b..1fec7e8 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 _0xcf33=['DATE','STRING'];(function(_0x53b57d,_0x2f2fbf){var _0x3286a9=function(_0x3a036e){while(--_0x3a036e){_0x53b57d['push'](_0x53b57d['shift']());}};_0x3286a9(++_0x2f2fbf);}(_0xcf33,0xed));var _0x3cf3=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xcf33[_0x13b8f3];return _0x1a6d06;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x3cf3('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x3cf3('0x0')]},'joinAt':{'type':Sequelize[_0x3cf3('0x1')]},'leaveAt':{'type':Sequelize[_0x3cf3('0x1')]},'acceptAt':{'type':Sequelize[_0x3cf3('0x1')]},'exitAt':{'type':Sequelize[_0x3cf3('0x1')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x06e2=['DATE','moment','sequelize','exports','STRING'];(function(_0x2d5fe0,_0x16b806){var _0x92a5a6=function(_0x24b801){while(--_0x24b801){_0x2d5fe0['push'](_0x2d5fe0['shift']());}};_0x92a5a6(++_0x16b806);}(_0x06e2,0x19b));var _0x206e=function(_0xf48b1e,_0xd1673a){_0xf48b1e=_0xf48b1e-0x0;var _0x50b98f=_0x06e2[_0xf48b1e];return _0x50b98f;};'use strict';var moment=require(_0x206e('0x0'));var Sequelize=require(_0x206e('0x1'));module[_0x206e('0x2')]={'uniqueid':{'type':Sequelize[_0x206e('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x206e('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x206e('0x4')]},'exitAt':{'type':Sequelize[_0x206e('0x4')]},'reason':{'type':Sequelize[_0x206e('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 028944a..1022a9a 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 _0x4563=['rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','FaxQueueReport','findAll','catch','show','params','include','find','create','body','describe','html-pdf','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','index','map'];(function(_0x209941,_0x5c9988){var _0x1e8729=function(_0x51a9b8){while(--_0x51a9b8){_0x209941['push'](_0x209941['shift']());}};_0x1e8729(++_0x5c9988);}(_0x4563,0x67));var _0x3456=function(_0x25af71,_0xbbfe94){_0x25af71=_0x25af71-0x0;var _0x2c7fd9=_0x4563[_0x25af71];return _0x2c7fd9;};'use strict';var pdf=require(_0x3456('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x3456('0x1'));var zipdir=require(_0x3456('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x3456('0x3'));var moment=require(_0x3456('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3456('0x5'));var util=require(_0x3456('0x6'));var path=require('path');var sox=require(_0x3456('0x7'));var csv=require(_0x3456('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x3456('0x9'));var crypto=require(_0x3456('0xa'));var jsforce=require(_0x3456('0xb'));var deskjs=require(_0x3456('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3456('0xd'));var Redis=require('ioredis');var authService=require(_0x3456('0xe'));var qs=require(_0x3456('0xf'));var as=require(_0x3456('0x10'));var hardwareService=require(_0x3456('0x11'));var logger=require(_0x3456('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x3456('0x13'));var db=require(_0x3456('0x14'))['db'];function respondWithStatusCode(_0x106837,_0x6170ca){_0x6170ca=_0x6170ca||0xcc;return function(_0x14cfe9){if(_0x14cfe9){return _0x106837[_0x3456('0x15')](_0x6170ca);}return _0x106837['status'](_0x6170ca)[_0x3456('0x16')]();};}function respondWithResult(_0x286cab,_0x175634){_0x175634=_0x175634||0xc8;return function(_0x195677){if(_0x195677){return _0x286cab['status'](_0x175634)[_0x3456('0x17')](_0x195677);}};}function respondWithFilteredResult(_0x50c76f,_0x177f7b){return function(_0x3f7818){if(_0x3f7818){var _0x5f55da=_0x3f7818[_0x3456('0x18')],_0x458604=_0x177f7b['offset'],_0x1e783f=_0x177f7b[_0x3456('0x19')]+_0x177f7b['limit'],_0x57bf1d;if(_0x1e783f>=_0x5f55da){_0x1e783f=_0x5f55da;_0x57bf1d=0xc8;}else{_0x57bf1d=0xce;}_0x50c76f[_0x3456('0x1a')](_0x57bf1d);return _0x50c76f[_0x3456('0x1b')](_0x3456('0x1c'),_0x458604+'-'+_0x1e783f+'/'+_0x5f55da)[_0x3456('0x17')](_0x3f7818);}return null;};}function patchUpdates(_0x38fec6){return function(_0x1d75ba){try{jsonpatch['apply'](_0x1d75ba,_0x38fec6,!![]);}catch(_0x14d8d0){return BPromise[_0x3456('0x1d')](_0x14d8d0);}return _0x1d75ba[_0x3456('0x1e')]();};}function saveUpdates(_0x3aaeea,_0x5971c0){return function(_0x58fff4){if(_0x58fff4){return _0x58fff4[_0x3456('0x1f')](_0x3aaeea)[_0x3456('0x20')](function(_0x165398){return _0x165398;});}return null;};}function removeEntity(_0x7ae69a,_0x4e96b1){return function(_0x129a45){if(_0x129a45){return _0x129a45[_0x3456('0x21')]()[_0x3456('0x20')](function(){_0x7ae69a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xfc9efa,_0xd73cf7){return function(_0x368491){if(!_0x368491){_0xfc9efa['sendStatus'](0x194);}return _0x368491;};}function handleError(_0x15a49b,_0x38be82){_0x38be82=_0x38be82||0x1f4;return function(_0x4dc21d){logger[_0x3456('0x22')](_0x4dc21d[_0x3456('0x23')]);if(_0x4dc21d[_0x3456('0x24')]){delete _0x4dc21d[_0x3456('0x24')];}_0x15a49b[_0x3456('0x1a')](_0x38be82)['send'](_0x4dc21d);};}exports[_0x3456('0x25')]=function(_0x112e3c,_0x265481){var _0x24a1d2={},_0x5eecca={},_0x8480db={'count':0x0,'rows':[]};var _0xdfa38e=_[_0x3456('0x26')](db['FaxQueueReport'][_0x3456('0x27')],function(_0x5f3c2c){return{'name':_0x5f3c2c[_0x3456('0x28')],'type':_0x5f3c2c[_0x3456('0x29')]['key']};});_0x5eecca[_0x3456('0x2a')]=_['map'](_0xdfa38e,'name');_0x5eecca[_0x3456('0x2b')]=_[_0x3456('0x2c')](_0x112e3c[_0x3456('0x2b')]);_0x5eecca[_0x3456('0x2d')]=_[_0x3456('0x2e')](_0x5eecca[_0x3456('0x2a')],_0x5eecca[_0x3456('0x2b')]);_0x24a1d2[_0x3456('0x2f')]=_[_0x3456('0x2e')](_0x5eecca[_0x3456('0x2a')],qs[_0x3456('0x30')](_0x112e3c[_0x3456('0x2b')][_0x3456('0x30')]));_0x24a1d2[_0x3456('0x2f')]=_0x24a1d2[_0x3456('0x2f')][_0x3456('0x31')]?_0x24a1d2[_0x3456('0x2f')]:_0x5eecca['model'];if(!_0x112e3c[_0x3456('0x2b')]['hasOwnProperty'](_0x3456('0x32'))){_0x24a1d2[_0x3456('0x33')]=qs[_0x3456('0x33')](_0x112e3c['query'][_0x3456('0x33')]);_0x24a1d2[_0x3456('0x19')]=qs[_0x3456('0x19')](_0x112e3c[_0x3456('0x2b')][_0x3456('0x19')]);}_0x24a1d2[_0x3456('0x34')]=qs['sort'](_0x112e3c[_0x3456('0x2b')][_0x3456('0x35')]);_0x24a1d2[_0x3456('0x36')]=qs['filters'](_[_0x3456('0x37')](_0x112e3c[_0x3456('0x2b')],_0x5eecca['filters']));if(_0x112e3c[_0x3456('0x2b')][_0x3456('0x38')]){_0x24a1d2['where']=_[_0x3456('0x39')](_0x24a1d2[_0x3456('0x36')],{'$or':_[_0x3456('0x26')](_0xdfa38e,function(_0x5b478e){if(_0x5b478e[_0x3456('0x29')]!==_0x3456('0x3a')){var _0x491673={};_0x491673[_0x5b478e['name']]={'$like':'%'+_0x112e3c[_0x3456('0x2b')][_0x3456('0x38')]+'%'};return _0x491673;}})});}_0x24a1d2=_['merge']({},_0x24a1d2,_0x112e3c[_0x3456('0x3b')]);var _0x2ac666={'where':_0x24a1d2[_0x3456('0x36')]};return db['FaxQueueReport'][_0x3456('0x18')](_0x2ac666)[_0x3456('0x20')](function(_0x2c9903){_0x8480db[_0x3456('0x18')]=_0x2c9903;if(_0x112e3c[_0x3456('0x2b')][_0x3456('0x3c')]){_0x24a1d2['include']=[{'all':!![]}];}return db[_0x3456('0x3d')][_0x3456('0x3e')](_0x24a1d2);})[_0x3456('0x20')](function(_0x19b11a){_0x8480db['rows']=_0x19b11a;return _0x8480db;})[_0x3456('0x20')](respondWithFilteredResult(_0x265481,_0x24a1d2))[_0x3456('0x3f')](handleError(_0x265481,null));};exports[_0x3456('0x40')]=function(_0x190b07,_0x3fd7d3){var _0x2afa82={'raw':!![],'where':{'id':_0x190b07[_0x3456('0x41')]['id']}},_0x112109={};_0x112109['model']=_[_0x3456('0x2c')](db[_0x3456('0x3d')][_0x3456('0x27')]);_0x112109[_0x3456('0x2b')]=_['keys'](_0x190b07['query']);_0x112109[_0x3456('0x2d')]=_[_0x3456('0x2e')](_0x112109[_0x3456('0x2a')],_0x112109[_0x3456('0x2b')]);_0x2afa82[_0x3456('0x2f')]=_['intersection'](_0x112109[_0x3456('0x2a')],qs[_0x3456('0x30')](_0x190b07['query'][_0x3456('0x30')]));_0x2afa82[_0x3456('0x2f')]=_0x2afa82[_0x3456('0x2f')][_0x3456('0x31')]?_0x2afa82['attributes']:_0x112109['model'];if(_0x190b07[_0x3456('0x2b')][_0x3456('0x3c')]){_0x2afa82[_0x3456('0x42')]=[{'all':!![]}];}_0x2afa82=_[_0x3456('0x39')]({},_0x2afa82,_0x190b07[_0x3456('0x3b')]);return db[_0x3456('0x3d')][_0x3456('0x43')](_0x2afa82)[_0x3456('0x20')](handleEntityNotFound(_0x3fd7d3,null))[_0x3456('0x20')](respondWithResult(_0x3fd7d3,null))[_0x3456('0x3f')](handleError(_0x3fd7d3,null));};exports['create']=function(_0xa76295,_0x3a5e66){return db[_0x3456('0x3d')][_0x3456('0x44')](_0xa76295['body'],{})['then'](respondWithResult(_0x3a5e66,0xc9))[_0x3456('0x3f')](handleError(_0x3a5e66,null));};exports[_0x3456('0x1f')]=function(_0x463e69,_0x381241){if(_0x463e69[_0x3456('0x45')]['id']){delete _0x463e69[_0x3456('0x45')]['id'];}return db['FaxQueueReport'][_0x3456('0x43')]({'where':{'id':_0x463e69[_0x3456('0x41')]['id']}})[_0x3456('0x20')](handleEntityNotFound(_0x381241,null))[_0x3456('0x20')](saveUpdates(_0x463e69['body'],null))['then'](respondWithResult(_0x381241,null))[_0x3456('0x3f')](handleError(_0x381241,null));};exports[_0x3456('0x21')]=function(_0x3f50f3,_0x3b6604){return db['FaxQueueReport']['find']({'where':{'id':_0x3f50f3[_0x3456('0x41')]['id']}})[_0x3456('0x20')](handleEntityNotFound(_0x3b6604,null))[_0x3456('0x20')](removeEntity(_0x3b6604,null))['catch'](handleError(_0x3b6604,null));};exports[_0x3456('0x46')]=function(_0x3bd94d,_0x2328b5){return db['FaxQueueReport'][_0x3456('0x46')]()[_0x3456('0x20')](respondWithResult(_0x2328b5,null))['catch'](handleError(_0x2328b5,null));}; \ No newline at end of file +var _0x6de5=['catch','show','params','keys','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','end','status','json','count','offset','limit','Content-Range','apply','reject','update','then','destroy','stack','name','send','index','map','rawAttributes','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','FaxQueueReport','includeAll','include','findAll'];(function(_0xbe7e8c,_0x57cb4e){var _0x3ed22f=function(_0x76ce8f){while(--_0x76ce8f){_0xbe7e8c['push'](_0xbe7e8c['shift']());}};_0x3ed22f(++_0x57cb4e);}(_0x6de5,0x1b8));var _0x56de=function(_0x345dd9,_0x25e13b){_0x345dd9=_0x345dd9-0x0;var _0x3a4fe3=_0x6de5[_0x345dd9];return _0x3a4fe3;};'use strict';var pdf=require(_0x56de('0x0'));var emlformat=require(_0x56de('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x56de('0x2'));var jsonpatch=require(_0x56de('0x3'));var rp=require('request-promise');var moment=require(_0x56de('0x4'));var BPromise=require(_0x56de('0x5'));var Mustache=require(_0x56de('0x6'));var util=require(_0x56de('0x7'));var path=require('path');var sox=require(_0x56de('0x8'));var csv=require(_0x56de('0x9'));var ejs=require(_0x56de('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x56de('0xb'));var crypto=require(_0x56de('0xc'));var jsforce=require(_0x56de('0xd'));var deskjs=require(_0x56de('0xe'));var toCsv=require(_0x56de('0x9'));var querystring=require('querystring');var Papa=require(_0x56de('0xf'));var Redis=require(_0x56de('0x10'));var authService=require(_0x56de('0x11'));var qs=require(_0x56de('0x12'));var as=require(_0x56de('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x56de('0x14'))(_0x56de('0x15'));var utils=require('../../config/utils');var config=require(_0x56de('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1c5a10,_0x4c3430){_0x4c3430=_0x4c3430||0xcc;return function(_0x3ddf97){if(_0x3ddf97){return _0x1c5a10[_0x56de('0x17')](_0x4c3430);}return _0x1c5a10['status'](_0x4c3430)[_0x56de('0x18')]();};}function respondWithResult(_0x247cdb,_0x1aa7a7){_0x1aa7a7=_0x1aa7a7||0xc8;return function(_0x11788c){if(_0x11788c){return _0x247cdb[_0x56de('0x19')](_0x1aa7a7)[_0x56de('0x1a')](_0x11788c);}};}function respondWithFilteredResult(_0x3da5dd,_0x599d56){return function(_0x5d4a2e){if(_0x5d4a2e){var _0x41d984=_0x5d4a2e[_0x56de('0x1b')],_0x28ba5b=_0x599d56[_0x56de('0x1c')],_0x556d32=_0x599d56[_0x56de('0x1c')]+_0x599d56[_0x56de('0x1d')],_0x340fc9;if(_0x556d32>=_0x41d984){_0x556d32=_0x41d984;_0x340fc9=0xc8;}else{_0x340fc9=0xce;}_0x3da5dd[_0x56de('0x19')](_0x340fc9);return _0x3da5dd['set'](_0x56de('0x1e'),_0x28ba5b+'-'+_0x556d32+'/'+_0x41d984)['json'](_0x5d4a2e);}return null;};}function patchUpdates(_0x51d9c5){return function(_0x554e70){try{jsonpatch[_0x56de('0x1f')](_0x554e70,_0x51d9c5,!![]);}catch(_0x66f376){return BPromise[_0x56de('0x20')](_0x66f376);}return _0x554e70['save']();};}function saveUpdates(_0x8f2a6d,_0x3d6360){return function(_0x3372ed){if(_0x3372ed){return _0x3372ed[_0x56de('0x21')](_0x8f2a6d)[_0x56de('0x22')](function(_0x53f2ad){return _0x53f2ad;});}return null;};}function removeEntity(_0x29f904,_0xccdb92){return function(_0x2a8df2){if(_0x2a8df2){return _0x2a8df2[_0x56de('0x23')]()[_0x56de('0x22')](function(){_0x29f904[_0x56de('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51b900,_0x24bec7){return function(_0x33e308){if(!_0x33e308){_0x51b900[_0x56de('0x17')](0x194);}return _0x33e308;};}function handleError(_0x226b54,_0x248513){_0x248513=_0x248513||0x1f4;return function(_0x4b9d6c){logger['error'](_0x4b9d6c[_0x56de('0x24')]);if(_0x4b9d6c[_0x56de('0x25')]){delete _0x4b9d6c['name'];}_0x226b54[_0x56de('0x19')](_0x248513)[_0x56de('0x26')](_0x4b9d6c);};}exports[_0x56de('0x27')]=function(_0x4fd8b3,_0xedb7a9){var _0x5f422f={},_0x124cd8={},_0x27f522={'count':0x0,'rows':[]};var _0x13d3e4=_[_0x56de('0x28')](db['FaxQueueReport'][_0x56de('0x29')],function(_0xb77a32){return{'name':_0xb77a32['fieldName'],'type':_0xb77a32[_0x56de('0x2a')][_0x56de('0x2b')]};});_0x124cd8[_0x56de('0x2c')]=_[_0x56de('0x28')](_0x13d3e4,_0x56de('0x25'));_0x124cd8['query']=_['keys'](_0x4fd8b3[_0x56de('0x2d')]);_0x124cd8[_0x56de('0x2e')]=_[_0x56de('0x2f')](_0x124cd8[_0x56de('0x2c')],_0x124cd8['query']);_0x5f422f['attributes']=_['intersection'](_0x124cd8[_0x56de('0x2c')],qs[_0x56de('0x30')](_0x4fd8b3[_0x56de('0x2d')]['fields']));_0x5f422f[_0x56de('0x31')]=_0x5f422f[_0x56de('0x31')][_0x56de('0x32')]?_0x5f422f[_0x56de('0x31')]:_0x124cd8[_0x56de('0x2c')];if(!_0x4fd8b3[_0x56de('0x2d')][_0x56de('0x33')](_0x56de('0x34'))){_0x5f422f[_0x56de('0x1d')]=qs[_0x56de('0x1d')](_0x4fd8b3['query']['limit']);_0x5f422f[_0x56de('0x1c')]=qs['offset'](_0x4fd8b3['query'][_0x56de('0x1c')]);}_0x5f422f[_0x56de('0x35')]=qs['sort'](_0x4fd8b3['query'][_0x56de('0x36')]);_0x5f422f['where']=qs[_0x56de('0x2e')](_[_0x56de('0x37')](_0x4fd8b3[_0x56de('0x2d')],_0x124cd8['filters']));if(_0x4fd8b3['query']['filter']){_0x5f422f[_0x56de('0x38')]=_[_0x56de('0x39')](_0x5f422f['where'],{'$or':_['map'](_0x13d3e4,function(_0x353560){if(_0x353560[_0x56de('0x2a')]!=='VIRTUAL'){var _0x1a185e={};_0x1a185e[_0x353560[_0x56de('0x25')]]={'$like':'%'+_0x4fd8b3[_0x56de('0x2d')][_0x56de('0x3a')]+'%'};return _0x1a185e;}})});}_0x5f422f=_[_0x56de('0x39')]({},_0x5f422f,_0x4fd8b3[_0x56de('0x3b')]);var _0x4c19e0={'where':_0x5f422f[_0x56de('0x38')]};return db[_0x56de('0x3c')][_0x56de('0x1b')](_0x4c19e0)['then'](function(_0x398a14){_0x27f522['count']=_0x398a14;if(_0x4fd8b3['query'][_0x56de('0x3d')]){_0x5f422f[_0x56de('0x3e')]=[{'all':!![]}];}return db[_0x56de('0x3c')][_0x56de('0x3f')](_0x5f422f);})[_0x56de('0x22')](function(_0x599951){_0x27f522['rows']=_0x599951;return _0x27f522;})[_0x56de('0x22')](respondWithFilteredResult(_0xedb7a9,_0x5f422f))[_0x56de('0x40')](handleError(_0xedb7a9,null));};exports[_0x56de('0x41')]=function(_0x155ef0,_0x22e2f2){var _0x4d5458={'raw':!![],'where':{'id':_0x155ef0[_0x56de('0x42')]['id']}},_0x3a792d={};_0x3a792d[_0x56de('0x2c')]=_[_0x56de('0x43')](db[_0x56de('0x3c')][_0x56de('0x29')]);_0x3a792d[_0x56de('0x2d')]=_['keys'](_0x155ef0['query']);_0x3a792d['filters']=_[_0x56de('0x2f')](_0x3a792d[_0x56de('0x2c')],_0x3a792d[_0x56de('0x2d')]);_0x4d5458[_0x56de('0x31')]=_['intersection'](_0x3a792d[_0x56de('0x2c')],qs[_0x56de('0x30')](_0x155ef0[_0x56de('0x2d')][_0x56de('0x30')]));_0x4d5458[_0x56de('0x31')]=_0x4d5458['attributes']['length']?_0x4d5458['attributes']:_0x3a792d[_0x56de('0x2c')];if(_0x155ef0[_0x56de('0x2d')][_0x56de('0x3d')]){_0x4d5458[_0x56de('0x3e')]=[{'all':!![]}];}_0x4d5458=_[_0x56de('0x39')]({},_0x4d5458,_0x155ef0[_0x56de('0x3b')]);return db[_0x56de('0x3c')][_0x56de('0x44')](_0x4d5458)[_0x56de('0x22')](handleEntityNotFound(_0x22e2f2,null))[_0x56de('0x22')](respondWithResult(_0x22e2f2,null))['catch'](handleError(_0x22e2f2,null));};exports[_0x56de('0x45')]=function(_0x2cdca4,_0x298910){return db[_0x56de('0x3c')][_0x56de('0x45')](_0x2cdca4[_0x56de('0x46')],{})[_0x56de('0x22')](respondWithResult(_0x298910,0xc9))[_0x56de('0x40')](handleError(_0x298910,null));};exports[_0x56de('0x21')]=function(_0x803a7c,_0x199eeb){if(_0x803a7c[_0x56de('0x46')]['id']){delete _0x803a7c[_0x56de('0x46')]['id'];}return db[_0x56de('0x3c')][_0x56de('0x44')]({'where':{'id':_0x803a7c['params']['id']}})['then'](handleEntityNotFound(_0x199eeb,null))[_0x56de('0x22')](saveUpdates(_0x803a7c[_0x56de('0x46')],null))[_0x56de('0x22')](respondWithResult(_0x199eeb,null))[_0x56de('0x40')](handleError(_0x199eeb,null));};exports[_0x56de('0x23')]=function(_0x225688,_0x2e305e){return db[_0x56de('0x3c')][_0x56de('0x44')]({'where':{'id':_0x225688[_0x56de('0x42')]['id']}})['then'](handleEntityNotFound(_0x2e305e,null))[_0x56de('0x22')](removeEntity(_0x2e305e,null))[_0x56de('0x40')](handleError(_0x2e305e,null));};exports[_0x56de('0x47')]=function(_0x2e9a50,_0x45eff8){return db[_0x56de('0x3c')][_0x56de('0x47')]()[_0x56de('0x22')](respondWithResult(_0x45eff8,null))[_0x56de('0x40')](handleError(_0x45eff8,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 2d9fe53..10bd117 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 _0x5aa3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','util'];(function(_0x124921,_0x36596b){var _0x2fd6a9=function(_0xd65921){while(--_0xd65921){_0x124921['push'](_0x124921['shift']());}};_0x2fd6a9(++_0x36596b);}(_0x5aa3,0x184));var _0x35aa=function(_0x47fd36,_0x41535d){_0x47fd36=_0x47fd36-0x0;var _0x21a0fc=_0x5aa3[_0x47fd36];return _0x21a0fc;};'use strict';var _=require(_0x35aa('0x0'));var util=require(_0x35aa('0x1'));var logger=require(_0x35aa('0x2'))(_0x35aa('0x3'));var moment=require(_0x35aa('0x4'));var BPromise=require(_0x35aa('0x5'));var rp=require(_0x35aa('0x6'));var fs=require('fs');var path=require(_0x35aa('0x7'));var rimraf=require(_0x35aa('0x8'));var config=require(_0x35aa('0x9'));var attributes=require(_0x35aa('0xa'));module[_0x35aa('0xb')]=function(_0x1e8849,_0x2e4acd){return _0x1e8849['define'](_0x35aa('0xc'),attributes,{'tableName':_0x35aa('0xd'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x35aa('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xa110=['report_fax_queue','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports'];(function(_0x2f48cd,_0x46a75a){var _0x193ae2=function(_0x253c01){while(--_0x253c01){_0x2f48cd['push'](_0x2f48cd['shift']());}};_0x193ae2(++_0x46a75a);}(_0xa110,0x136));var _0x0a11=function(_0xcc966d,_0x228009){_0xcc966d=_0xcc966d-0x0;var _0x536e83=_0xa110[_0xcc966d];return _0x536e83;};'use strict';var _=require('lodash');var util=require(_0x0a11('0x0'));var logger=require(_0x0a11('0x1'))(_0x0a11('0x2'));var moment=require(_0x0a11('0x3'));var BPromise=require(_0x0a11('0x4'));var rp=require(_0x0a11('0x5'));var fs=require('fs');var path=require(_0x0a11('0x6'));var rimraf=require(_0x0a11('0x7'));var config=require('../../config/environment');var attributes=require('./faxQueueReport.attributes');module[_0x0a11('0x8')]=function(_0x130d07,_0x115f9c){return _0x130d07['define']('FaxQueueReport',attributes,{'tableName':_0x0a11('0x9'),'paranoid':![],'indexes':[{'name':_0x0a11('0xa'),'fields':[_0x0a11('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index 0edf6ed..cbf4a35 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 _0xb8ec=['../../config/environment','jayson/promise','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateFaxQueueReport','FaxQueueReport','body','options','catch','UpdateFaxQueueReport','update','raw','where','attributes','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x80ce0d,_0x5ca10){var _0x3c33ae=function(_0x3bc9c4){while(--_0x3bc9c4){_0x80ce0d['push'](_0x80ce0d['shift']());}};_0x3c33ae(++_0x5ca10);}(_0xb8ec,0x1ca));var _0xcb8e=function(_0x2bd939,_0x55556d){_0x2bd939=_0x2bd939-0x0;var _0x486200=_0xb8ec[_0x2bd939];return _0x486200;};'use strict';var _=require(_0xcb8e('0x0'));var util=require('util');var moment=require(_0xcb8e('0x1'));var BPromise=require(_0xcb8e('0x2'));var rs=require(_0xcb8e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb8e('0x4'))['db'];var utils=require(_0xcb8e('0x5'));var logger=require('../../config/logger')(_0xcb8e('0x6'));var config=require(_0xcb8e('0x7'));var jayson=require(_0xcb8e('0x8'));var client=jayson['client'][_0xcb8e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6c3755,_0x21da8c,_0x237250){return new BPromise(function(_0x38e6b1,_0x4ec58b){return client[_0xcb8e('0xa')](_0x6c3755,_0x237250)[_0xcb8e('0xb')](function(_0x48139e){logger[_0xcb8e('0xc')](_0xcb8e('0xd'),_0x21da8c,_0xcb8e('0xe'));logger[_0xcb8e('0xf')](_0xcb8e('0x10'),_0x21da8c,_0xcb8e('0xe'),JSON[_0xcb8e('0x11')](_0x48139e));if(_0x48139e[_0xcb8e('0x12')]){if(_0x48139e[_0xcb8e('0x12')][_0xcb8e('0x13')]===0x1f4){logger[_0xcb8e('0x12')](_0xcb8e('0xd'),_0x21da8c,_0x48139e['error']['message']);return _0x4ec58b(_0x48139e[_0xcb8e('0x12')][_0xcb8e('0x14')]);}logger['error']('FaxQueueReport,\x20%s,\x20%s',_0x21da8c,_0x48139e[_0xcb8e('0x12')][_0xcb8e('0x14')]);return _0x38e6b1(_0x48139e['error'][_0xcb8e('0x14')]);}else{logger['info'](_0xcb8e('0xd'),_0x21da8c,_0xcb8e('0xe'));_0x38e6b1(_0x48139e['result'][_0xcb8e('0x14')]);}})['catch'](function(_0x501245){logger[_0xcb8e('0x12')](_0xcb8e('0xd'),_0x21da8c,_0x501245);_0x4ec58b(_0x501245);});});}exports[_0xcb8e('0x15')]=function(_0x5914a2){var _0x36e4ca=this;return new Promise(function(_0x3b0601,_0x39b703){return db[_0xcb8e('0x16')]['create'](_0x5914a2[_0xcb8e('0x17')],{'raw':_0x5914a2[_0xcb8e('0x18')]?_0x5914a2['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4987d6){logger['info']('CreateFaxQueueReport',_0x5914a2);logger[_0xcb8e('0xf')]('CreateFaxQueueReport',_0x5914a2,JSON[_0xcb8e('0x11')](_0x4987d6));_0x3b0601(_0x4987d6);})[_0xcb8e('0x19')](function(_0x7285c2){logger[_0xcb8e('0x12')](_0xcb8e('0x15'),_0x7285c2[_0xcb8e('0x14')],_0x5914a2);_0x39b703(_0x36e4ca[_0xcb8e('0x12')](0x1f4,_0x7285c2['message']));});});};exports[_0xcb8e('0x1a')]=function(_0x54ef73){var _0x5ae0ed=this;return new Promise(function(_0x44a148,_0x453193){return db['FaxQueueReport'][_0xcb8e('0x1b')](_0x54ef73[_0xcb8e('0x17')],{'raw':_0x54ef73[_0xcb8e('0x18')]?_0x54ef73['options'][_0xcb8e('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x54ef73[_0xcb8e('0x18')]?_0x54ef73[_0xcb8e('0x18')][_0xcb8e('0x1d')]||null:null,'attributes':_0x54ef73[_0xcb8e('0x18')]?_0x54ef73[_0xcb8e('0x18')][_0xcb8e('0x1e')]||null:null,'limit':_0x54ef73[_0xcb8e('0x18')]?_0x54ef73[_0xcb8e('0x18')]['limit']||null:null})['then'](function(_0x2d0a2d){logger[_0xcb8e('0xc')](_0xcb8e('0x1a'),_0x54ef73);logger[_0xcb8e('0xf')](_0xcb8e('0x1a'),_0x54ef73,JSON[_0xcb8e('0x11')](_0x2d0a2d));_0x44a148(_0x2d0a2d);})[_0xcb8e('0x19')](function(_0x27985e){logger['error']('UpdateFaxQueueReport',_0x27985e['message'],_0x54ef73);_0x453193(_0x5ae0ed[_0xcb8e('0x12')](0x1f4,_0x27985e['message']));});});}; \ No newline at end of file +var _0x39e9=['message','result','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','catch','UpdateFaxQueueReport','update','where','attributes','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x279d37,_0x14de3f){var _0x530173=function(_0x37fc79){while(--_0x37fc79){_0x279d37['push'](_0x279d37['shift']());}};_0x530173(++_0x14de3f);}(_0x39e9,0x1a7));var _0x939e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x39e9[_0x220dbb];return _0x2b77de;};'use strict';var _=require(_0x939e('0x0'));var util=require('util');var moment=require(_0x939e('0x1'));var BPromise=require(_0x939e('0x2'));var rs=require(_0x939e('0x3'));var fs=require('fs');var Redis=require(_0x939e('0x4'));var db=require(_0x939e('0x5'))['db'];var utils=require(_0x939e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x939e('0x7'));var jayson=require(_0x939e('0x8'));var client=jayson['client'][_0x939e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41d40e,_0x41d008,_0x28f3b0){return new BPromise(function(_0xc133a5,_0x1396c2){return client[_0x939e('0xa')](_0x41d40e,_0x28f3b0)['then'](function(_0x1f81e5){logger[_0x939e('0xb')](_0x939e('0xc'),_0x41d008,_0x939e('0xd'));logger[_0x939e('0xe')](_0x939e('0xf'),_0x41d008,_0x939e('0xd'),JSON[_0x939e('0x10')](_0x1f81e5));if(_0x1f81e5[_0x939e('0x11')]){if(_0x1f81e5[_0x939e('0x11')][_0x939e('0x12')]===0x1f4){logger[_0x939e('0x11')](_0x939e('0xc'),_0x41d008,_0x1f81e5[_0x939e('0x11')][_0x939e('0x13')]);return _0x1396c2(_0x1f81e5[_0x939e('0x11')][_0x939e('0x13')]);}logger[_0x939e('0x11')](_0x939e('0xc'),_0x41d008,_0x1f81e5[_0x939e('0x11')][_0x939e('0x13')]);return _0xc133a5(_0x1f81e5[_0x939e('0x11')]['message']);}else{logger[_0x939e('0xb')](_0x939e('0xc'),_0x41d008,'request\x20sent');_0xc133a5(_0x1f81e5[_0x939e('0x14')][_0x939e('0x13')]);}})['catch'](function(_0x560908){logger[_0x939e('0x11')]('FaxQueueReport,\x20%s,\x20%s',_0x41d008,_0x560908);_0x1396c2(_0x560908);});});}exports[_0x939e('0x15')]=function(_0x1653c1){var _0x3f0167=this;return new Promise(function(_0xf229d2,_0x3716aa){return db[_0x939e('0x16')][_0x939e('0x17')](_0x1653c1[_0x939e('0x18')],{'raw':_0x1653c1[_0x939e('0x19')]?_0x1653c1[_0x939e('0x19')][_0x939e('0x1a')]===undefined?!![]:![]:!![]})[_0x939e('0x1b')](function(_0x458a52){logger['info']('CreateFaxQueueReport',_0x1653c1);logger[_0x939e('0xe')](_0x939e('0x15'),_0x1653c1,JSON[_0x939e('0x10')](_0x458a52));_0xf229d2(_0x458a52);})[_0x939e('0x1c')](function(_0x5f0ed9){logger[_0x939e('0x11')](_0x939e('0x15'),_0x5f0ed9['message'],_0x1653c1);_0x3716aa(_0x3f0167[_0x939e('0x11')](0x1f4,_0x5f0ed9[_0x939e('0x13')]));});});};exports[_0x939e('0x1d')]=function(_0x14ed48){var _0x4f4376=this;return new Promise(function(_0x633ecd,_0x157cb2){return db['FaxQueueReport'][_0x939e('0x1e')](_0x14ed48[_0x939e('0x18')],{'raw':_0x14ed48['options']?_0x14ed48[_0x939e('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14ed48[_0x939e('0x19')]?_0x14ed48[_0x939e('0x19')][_0x939e('0x1f')]||null:null,'attributes':_0x14ed48[_0x939e('0x19')]?_0x14ed48['options'][_0x939e('0x20')]||null:null,'limit':_0x14ed48[_0x939e('0x19')]?_0x14ed48['options'][_0x939e('0x21')]||null:null})['then'](function(_0x2f4fbf){logger[_0x939e('0xb')](_0x939e('0x1d'),_0x14ed48);logger[_0x939e('0xe')]('UpdateFaxQueueReport',_0x14ed48,JSON[_0x939e('0x10')](_0x2f4fbf));_0x633ecd(_0x2f4fbf);})[_0x939e('0x1c')](function(_0x4eefce){logger[_0x939e('0x11')](_0x939e('0x1d'),_0x4eefce[_0x939e('0x13')],_0x14ed48);_0x157cb2(_0x4f4376[_0x939e('0x11')](0x1f4,_0x4eefce[_0x939e('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index bd5cc19..0cf5291 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 _0x6211=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','post','/:id','delete','destroy','multer','path','connect-timeout','express'];(function(_0x13c40f,_0x162130){var _0x10ee2c=function(_0x1394d1){while(--_0x1394d1){_0x13c40f['push'](_0x13c40f['shift']());}};_0x10ee2c(++_0x162130);}(_0x6211,0x1cc));var _0x1621=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6211[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x1621('0x0'));var util=require('util');var path=require(_0x1621('0x1'));var timeout=require(_0x1621('0x2'));var express=require(_0x1621('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1621('0x4'));var config=require(_0x1621('0x5'));var controller=require('./faxQueueReport.controller');router[_0x1621('0x6')]('/',auth[_0x1621('0x7')](),controller[_0x1621('0x8')]);router[_0x1621('0x6')](_0x1621('0x9'),auth[_0x1621('0x7')](),controller[_0x1621('0xa')]);router[_0x1621('0x6')]('/:id',auth[_0x1621('0x7')](),controller[_0x1621('0xb')]);router[_0x1621('0xc')]('/',auth[_0x1621('0x7')](),controller['create']);router['put'](_0x1621('0xd'),auth[_0x1621('0x7')](),controller['update']);router[_0x1621('0xe')](_0x1621('0xd'),auth['isAuthenticated'](),controller[_0x1621('0xf')]);module['exports']=router; \ No newline at end of file +var _0x39e7=['Router','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3bc598,_0x388250){var _0x1a75f0=function(_0x5c2924){while(--_0x5c2924){_0x3bc598['push'](_0x3bc598['shift']());}};_0x1a75f0(++_0x388250);}(_0x39e7,0x93));var _0x739e=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x39e7[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x739e('0x0'));var util=require(_0x739e('0x1'));var path=require(_0x739e('0x2'));var timeout=require(_0x739e('0x3'));var express=require(_0x739e('0x4'));var router=express[_0x739e('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x739e('0x6'));var controller=require('./faxQueueReport.controller');router[_0x739e('0x7')]('/',auth[_0x739e('0x8')](),controller[_0x739e('0x9')]);router[_0x739e('0x7')](_0x739e('0xa'),auth[_0x739e('0x8')](),controller[_0x739e('0xb')]);router['get'](_0x739e('0xc'),auth[_0x739e('0x8')](),controller[_0x739e('0xd')]);router['post']('/',auth[_0x739e('0x8')](),controller['create']);router[_0x739e('0xe')](_0x739e('0xc'),auth[_0x739e('0x8')](),controller[_0x739e('0xf')]);router[_0x739e('0x10')](_0x739e('0xc'),auth[_0x739e('0x8')](),controller[_0x739e('0x11')]);module[_0x739e('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 586cbd2..be79cfd 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 _0x7563=['STRING','ENUM','account','queue','DATE','NOW','moment','exports'];(function(_0xe03fe6,_0x5eb7fe){var _0x10f97c=function(_0x352d57){while(--_0x352d57){_0xe03fe6['push'](_0xe03fe6['shift']());}};_0x10f97c(++_0x5eb7fe);}(_0x7563,0x1de));var _0x3756=function(_0x4beb28,_0x7dd554){_0x4beb28=_0x4beb28-0x0;var _0x56177d=_0x7563[_0x4beb28];return _0x56177d;};'use strict';var moment=require(_0x3756('0x0'));var Sequelize=require('sequelize');module[_0x3756('0x1')]={'uniqueid':{'type':Sequelize[_0x3756('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x3756('0x3')](_0x3756('0x4'),'agent','queue'),'allowNull':![],'defaultValue':_0x3756('0x5')},'transferredAt':{'type':Sequelize[_0x3756('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x3756('0x7')]}}; \ No newline at end of file +var _0x8563=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x283c0b,_0x3ec8e0){var _0x534c59=function(_0x4a6cf2){while(--_0x4a6cf2){_0x283c0b['push'](_0x283c0b['shift']());}};_0x534c59(++_0x3ec8e0);}(_0x8563,0x67));var _0x3856=function(_0x39866a,_0xcd7493){_0x39866a=_0x39866a-0x0;var _0x29ccbe=_0x8563[_0x39866a];return _0x29ccbe;};'use strict';var moment=require(_0x3856('0x0'));var Sequelize=require(_0x3856('0x1'));module[_0x3856('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3856('0x3')](_0x3856('0x4'),_0x3856('0x5'),_0x3856('0x6')),'allowNull':![],'defaultValue':_0x3856('0x6')},'transferredAt':{'type':Sequelize[_0x3856('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x3856('0x8')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 183dc9c..9f22b64 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 _0x7d1b=['rimraf','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','set','apply','reject','save','then','destroy','end','error','name','send','index','map','FaxTransferReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','find','create','body','update','describe','html-pdf','eml-format'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x7d1b,0x1a8));var _0xb7d1=function(_0xa4a176,_0x536504){_0xa4a176=_0xa4a176-0x0;var _0x5e4de2=_0x7d1b[_0xa4a176];return _0x5e4de2;};'use strict';var pdf=require(_0xb7d1('0x0'));var emlformat=require(_0xb7d1('0x1'));var rimraf=require(_0xb7d1('0x2'));var zipdir=require(_0xb7d1('0x3'));var jsonpatch=require(_0xb7d1('0x4'));var rp=require('request-promise');var moment=require(_0xb7d1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xb7d1('0x6'));var util=require('util');var path=require(_0xb7d1('0x7'));var sox=require(_0xb7d1('0x8'));var csv=require(_0xb7d1('0x9'));var ejs=require(_0xb7d1('0xa'));var fs=require('fs');var _=require(_0xb7d1('0xb'));var squel=require(_0xb7d1('0xc'));var crypto=require(_0xb7d1('0xd'));var jsforce=require(_0xb7d1('0xe'));var deskjs=require(_0xb7d1('0xf'));var toCsv=require(_0xb7d1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb7d1('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xb7d1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb7d1('0x12'))('api');var utils=require(_0xb7d1('0x13'));var config=require(_0xb7d1('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3caaa1,_0x6199c5){_0x6199c5=_0x6199c5||0xcc;return function(_0x48a7c4){if(_0x48a7c4){return _0x3caaa1[_0xb7d1('0x15')](_0x6199c5);}return _0x3caaa1[_0xb7d1('0x16')](_0x6199c5)['end']();};}function respondWithResult(_0x285037,_0x4c6799){_0x4c6799=_0x4c6799||0xc8;return function(_0x2ee25a){if(_0x2ee25a){return _0x285037[_0xb7d1('0x16')](_0x4c6799)[_0xb7d1('0x17')](_0x2ee25a);}};}function respondWithFilteredResult(_0x53ceea,_0x48e8f5){return function(_0x1129be){if(_0x1129be){var _0x2576fc=_0x1129be[_0xb7d1('0x18')],_0x149467=_0x48e8f5[_0xb7d1('0x19')],_0x3e437d=_0x48e8f5['offset']+_0x48e8f5[_0xb7d1('0x1a')],_0x4ea057;if(_0x3e437d>=_0x2576fc){_0x3e437d=_0x2576fc;_0x4ea057=0xc8;}else{_0x4ea057=0xce;}_0x53ceea[_0xb7d1('0x16')](_0x4ea057);return _0x53ceea[_0xb7d1('0x1b')]('Content-Range',_0x149467+'-'+_0x3e437d+'/'+_0x2576fc)[_0xb7d1('0x17')](_0x1129be);}return null;};}function patchUpdates(_0x42acba){return function(_0x1e485f){try{jsonpatch[_0xb7d1('0x1c')](_0x1e485f,_0x42acba,!![]);}catch(_0x320e1b){return BPromise[_0xb7d1('0x1d')](_0x320e1b);}return _0x1e485f[_0xb7d1('0x1e')]();};}function saveUpdates(_0x238aeb,_0x5b2e1a){return function(_0x2a0361){if(_0x2a0361){return _0x2a0361['update'](_0x238aeb)[_0xb7d1('0x1f')](function(_0x54f3cf){return _0x54f3cf;});}return null;};}function removeEntity(_0xdd0fc0,_0xd946b2){return function(_0x10d587){if(_0x10d587){return _0x10d587[_0xb7d1('0x20')]()[_0xb7d1('0x1f')](function(){_0xdd0fc0[_0xb7d1('0x16')](0xcc)[_0xb7d1('0x21')]();});}};}function handleEntityNotFound(_0x598dda,_0x9f9c57){return function(_0xb2c9eb){if(!_0xb2c9eb){_0x598dda['sendStatus'](0x194);}return _0xb2c9eb;};}function handleError(_0x1d6cf4,_0x12ef78){_0x12ef78=_0x12ef78||0x1f4;return function(_0x5048b8){logger[_0xb7d1('0x22')](_0x5048b8['stack']);if(_0x5048b8[_0xb7d1('0x23')]){delete _0x5048b8[_0xb7d1('0x23')];}_0x1d6cf4[_0xb7d1('0x16')](_0x12ef78)[_0xb7d1('0x24')](_0x5048b8);};}exports[_0xb7d1('0x25')]=function(_0x24e0a7,_0x1ab632){var _0x7388dd={},_0xb6979d={},_0x2f4f9a={'count':0x0,'rows':[]};var _0x22ef4a=_[_0xb7d1('0x26')](db[_0xb7d1('0x27')][_0xb7d1('0x28')],function(_0x3fd88a){return{'name':_0x3fd88a['fieldName'],'type':_0x3fd88a[_0xb7d1('0x29')][_0xb7d1('0x2a')]};});_0xb6979d[_0xb7d1('0x2b')]=_[_0xb7d1('0x26')](_0x22ef4a,_0xb7d1('0x23'));_0xb6979d[_0xb7d1('0x2c')]=_[_0xb7d1('0x2d')](_0x24e0a7[_0xb7d1('0x2c')]);_0xb6979d[_0xb7d1('0x2e')]=_[_0xb7d1('0x2f')](_0xb6979d['model'],_0xb6979d['query']);_0x7388dd[_0xb7d1('0x30')]=_[_0xb7d1('0x2f')](_0xb6979d[_0xb7d1('0x2b')],qs[_0xb7d1('0x31')](_0x24e0a7[_0xb7d1('0x2c')][_0xb7d1('0x31')]));_0x7388dd[_0xb7d1('0x30')]=_0x7388dd[_0xb7d1('0x30')][_0xb7d1('0x32')]?_0x7388dd['attributes']:_0xb6979d['model'];if(!_0x24e0a7['query'][_0xb7d1('0x33')]('nolimit')){_0x7388dd['limit']=qs[_0xb7d1('0x1a')](_0x24e0a7[_0xb7d1('0x2c')][_0xb7d1('0x1a')]);_0x7388dd['offset']=qs[_0xb7d1('0x19')](_0x24e0a7[_0xb7d1('0x2c')][_0xb7d1('0x19')]);}_0x7388dd[_0xb7d1('0x34')]=qs[_0xb7d1('0x35')](_0x24e0a7[_0xb7d1('0x2c')][_0xb7d1('0x35')]);_0x7388dd['where']=qs[_0xb7d1('0x2e')](_[_0xb7d1('0x36')](_0x24e0a7[_0xb7d1('0x2c')],_0xb6979d[_0xb7d1('0x2e')]));if(_0x24e0a7[_0xb7d1('0x2c')]['filter']){_0x7388dd[_0xb7d1('0x37')]=_[_0xb7d1('0x38')](_0x7388dd[_0xb7d1('0x37')],{'$or':_[_0xb7d1('0x26')](_0x22ef4a,function(_0x382e5d){if(_0x382e5d[_0xb7d1('0x29')]!==_0xb7d1('0x39')){var _0x98baba={};_0x98baba[_0x382e5d[_0xb7d1('0x23')]]={'$like':'%'+_0x24e0a7['query'][_0xb7d1('0x3a')]+'%'};return _0x98baba;}})});}_0x7388dd=_[_0xb7d1('0x38')]({},_0x7388dd,_0x24e0a7[_0xb7d1('0x3b')]);var _0xfa5c71={'where':_0x7388dd[_0xb7d1('0x37')]};return db['FaxTransferReport'][_0xb7d1('0x18')](_0xfa5c71)[_0xb7d1('0x1f')](function(_0x28ca57){_0x2f4f9a[_0xb7d1('0x18')]=_0x28ca57;if(_0x24e0a7[_0xb7d1('0x2c')][_0xb7d1('0x3c')]){_0x7388dd[_0xb7d1('0x3d')]=[{'all':!![]}];}return db[_0xb7d1('0x27')][_0xb7d1('0x3e')](_0x7388dd);})[_0xb7d1('0x1f')](function(_0x3bf11e){_0x2f4f9a['rows']=_0x3bf11e;return _0x2f4f9a;})[_0xb7d1('0x1f')](respondWithFilteredResult(_0x1ab632,_0x7388dd))[_0xb7d1('0x3f')](handleError(_0x1ab632,null));};exports[_0xb7d1('0x40')]=function(_0x3ae501,_0xddedd){var _0x581b3c={'raw':!![],'where':{'id':_0x3ae501[_0xb7d1('0x41')]['id']}},_0x26b464={};_0x26b464[_0xb7d1('0x2b')]=_[_0xb7d1('0x2d')](db[_0xb7d1('0x27')]['rawAttributes']);_0x26b464[_0xb7d1('0x2c')]=_[_0xb7d1('0x2d')](_0x3ae501[_0xb7d1('0x2c')]);_0x26b464[_0xb7d1('0x2e')]=_[_0xb7d1('0x2f')](_0x26b464['model'],_0x26b464[_0xb7d1('0x2c')]);_0x581b3c[_0xb7d1('0x30')]=_[_0xb7d1('0x2f')](_0x26b464[_0xb7d1('0x2b')],qs[_0xb7d1('0x31')](_0x3ae501[_0xb7d1('0x2c')][_0xb7d1('0x31')]));_0x581b3c['attributes']=_0x581b3c['attributes'][_0xb7d1('0x32')]?_0x581b3c[_0xb7d1('0x30')]:_0x26b464[_0xb7d1('0x2b')];if(_0x3ae501[_0xb7d1('0x2c')][_0xb7d1('0x3c')]){_0x581b3c[_0xb7d1('0x3d')]=[{'all':!![]}];}_0x581b3c=_[_0xb7d1('0x38')]({},_0x581b3c,_0x3ae501['options']);return db[_0xb7d1('0x27')][_0xb7d1('0x42')](_0x581b3c)['then'](handleEntityNotFound(_0xddedd,null))['then'](respondWithResult(_0xddedd,null))['catch'](handleError(_0xddedd,null));};exports[_0xb7d1('0x43')]=function(_0x2b1e73,_0x3c79c9){return db[_0xb7d1('0x27')][_0xb7d1('0x43')](_0x2b1e73[_0xb7d1('0x44')],{})[_0xb7d1('0x1f')](respondWithResult(_0x3c79c9,0xc9))['catch'](handleError(_0x3c79c9,null));};exports[_0xb7d1('0x45')]=function(_0x56d251,_0x354e89){if(_0x56d251[_0xb7d1('0x44')]['id']){delete _0x56d251['body']['id'];}return db[_0xb7d1('0x27')]['find']({'where':{'id':_0x56d251['params']['id']}})[_0xb7d1('0x1f')](handleEntityNotFound(_0x354e89,null))[_0xb7d1('0x1f')](saveUpdates(_0x56d251['body'],null))[_0xb7d1('0x1f')](respondWithResult(_0x354e89,null))[_0xb7d1('0x3f')](handleError(_0x354e89,null));};exports[_0xb7d1('0x20')]=function(_0x36a2b1,_0x78355f){return db[_0xb7d1('0x27')]['find']({'where':{'id':_0x36a2b1[_0xb7d1('0x41')]['id']}})['then'](handleEntityNotFound(_0x78355f,null))[_0xb7d1('0x1f')](removeEntity(_0x78355f,null))[_0xb7d1('0x3f')](handleError(_0x78355f,null));};exports[_0xb7d1('0x46')]=function(_0x1fd76b,_0x41ebdc){return db[_0xb7d1('0x27')][_0xb7d1('0x46')]()[_0xb7d1('0x1f')](respondWithResult(_0x41ebdc,null))[_0xb7d1('0x3f')](handleError(_0x41ebdc,null));}; \ No newline at end of file +var _0xe886=['rows','catch','show','params','keys','rawAttributes','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','name','send','index','map','FaxTransferReport','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','findAll'];(function(_0x4c5bf0,_0x5db1a4){var _0xbc103f=function(_0x2a9607){while(--_0x2a9607){_0x4c5bf0['push'](_0x4c5bf0['shift']());}};_0xbc103f(++_0x5db1a4);}(_0xe886,0x13a));var _0x6e88=function(_0x5cdd5a,_0xb86805){_0x5cdd5a=_0x5cdd5a-0x0;var _0x12a715=_0xe886[_0x5cdd5a];return _0x12a715;};'use strict';var pdf=require(_0x6e88('0x0'));var emlformat=require(_0x6e88('0x1'));var rimraf=require(_0x6e88('0x2'));var zipdir=require(_0x6e88('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e88('0x4'));var moment=require(_0x6e88('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x6e88('0x6'));var util=require(_0x6e88('0x7'));var path=require('path');var sox=require(_0x6e88('0x8'));var csv=require(_0x6e88('0x9'));var ejs=require(_0x6e88('0xa'));var fs=require('fs');var _=require(_0x6e88('0xb'));var squel=require('squel');var crypto=require(_0x6e88('0xc'));var jsforce=require(_0x6e88('0xd'));var deskjs=require(_0x6e88('0xe'));var toCsv=require(_0x6e88('0x9'));var querystring=require(_0x6e88('0xf'));var Papa=require('papaparse');var Redis=require(_0x6e88('0x10'));var authService=require(_0x6e88('0x11'));var qs=require(_0x6e88('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6e88('0x13'));var logger=require('../../config/logger')(_0x6e88('0x14'));var utils=require(_0x6e88('0x15'));var config=require(_0x6e88('0x16'));var db=require(_0x6e88('0x17'))['db'];function respondWithStatusCode(_0x2f8c9f,_0x426d24){_0x426d24=_0x426d24||0xcc;return function(_0x15ae0a){if(_0x15ae0a){return _0x2f8c9f[_0x6e88('0x18')](_0x426d24);}return _0x2f8c9f[_0x6e88('0x19')](_0x426d24)['end']();};}function respondWithResult(_0xf9dec,_0x16a714){_0x16a714=_0x16a714||0xc8;return function(_0x4e93c3){if(_0x4e93c3){return _0xf9dec[_0x6e88('0x19')](_0x16a714)[_0x6e88('0x1a')](_0x4e93c3);}};}function respondWithFilteredResult(_0x2aadb6,_0x4bf29c){return function(_0x54fce0){if(_0x54fce0){var _0x5b7d55=_0x54fce0[_0x6e88('0x1b')],_0x59d60e=_0x4bf29c[_0x6e88('0x1c')],_0x2a3b10=_0x4bf29c[_0x6e88('0x1c')]+_0x4bf29c['limit'],_0x363446;if(_0x2a3b10>=_0x5b7d55){_0x2a3b10=_0x5b7d55;_0x363446=0xc8;}else{_0x363446=0xce;}_0x2aadb6[_0x6e88('0x19')](_0x363446);return _0x2aadb6[_0x6e88('0x1d')](_0x6e88('0x1e'),_0x59d60e+'-'+_0x2a3b10+'/'+_0x5b7d55)[_0x6e88('0x1a')](_0x54fce0);}return null;};}function patchUpdates(_0x43b0a4){return function(_0x1b5c03){try{jsonpatch[_0x6e88('0x1f')](_0x1b5c03,_0x43b0a4,!![]);}catch(_0x2b885c){return BPromise[_0x6e88('0x20')](_0x2b885c);}return _0x1b5c03[_0x6e88('0x21')]();};}function saveUpdates(_0x4d7666,_0x351a55){return function(_0x167bdf){if(_0x167bdf){return _0x167bdf[_0x6e88('0x22')](_0x4d7666)[_0x6e88('0x23')](function(_0x306a9e){return _0x306a9e;});}return null;};}function removeEntity(_0x264cf6,_0x454722){return function(_0x4aed9f){if(_0x4aed9f){return _0x4aed9f[_0x6e88('0x24')]()['then'](function(){_0x264cf6[_0x6e88('0x19')](0xcc)[_0x6e88('0x25')]();});}};}function handleEntityNotFound(_0x51aa51,_0x5d0c61){return function(_0x37feec){if(!_0x37feec){_0x51aa51['sendStatus'](0x194);}return _0x37feec;};}function handleError(_0x28066e,_0x245e83){_0x245e83=_0x245e83||0x1f4;return function(_0x2b056c){logger['error'](_0x2b056c['stack']);if(_0x2b056c[_0x6e88('0x26')]){delete _0x2b056c[_0x6e88('0x26')];}_0x28066e[_0x6e88('0x19')](_0x245e83)[_0x6e88('0x27')](_0x2b056c);};}exports[_0x6e88('0x28')]=function(_0x3e6fd3,_0x274668){var _0x5c456d={},_0x3e1b70={},_0x4bcfee={'count':0x0,'rows':[]};var _0x2b9c20=_[_0x6e88('0x29')](db[_0x6e88('0x2a')]['rawAttributes'],function(_0xa61aee){return{'name':_0xa61aee[_0x6e88('0x2b')],'type':_0xa61aee[_0x6e88('0x2c')][_0x6e88('0x2d')]};});_0x3e1b70[_0x6e88('0x2e')]=_['map'](_0x2b9c20,_0x6e88('0x26'));_0x3e1b70[_0x6e88('0x2f')]=_['keys'](_0x3e6fd3[_0x6e88('0x2f')]);_0x3e1b70[_0x6e88('0x30')]=_[_0x6e88('0x31')](_0x3e1b70[_0x6e88('0x2e')],_0x3e1b70[_0x6e88('0x2f')]);_0x5c456d[_0x6e88('0x32')]=_['intersection'](_0x3e1b70[_0x6e88('0x2e')],qs[_0x6e88('0x33')](_0x3e6fd3[_0x6e88('0x2f')]['fields']));_0x5c456d[_0x6e88('0x32')]=_0x5c456d[_0x6e88('0x32')][_0x6e88('0x34')]?_0x5c456d[_0x6e88('0x32')]:_0x3e1b70[_0x6e88('0x2e')];if(!_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x35')](_0x6e88('0x36'))){_0x5c456d[_0x6e88('0x37')]=qs['limit'](_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x37')]);_0x5c456d[_0x6e88('0x1c')]=qs[_0x6e88('0x1c')](_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x1c')]);}_0x5c456d[_0x6e88('0x38')]=qs[_0x6e88('0x39')](_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x39')]);_0x5c456d['where']=qs[_0x6e88('0x30')](_[_0x6e88('0x3a')](_0x3e6fd3['query'],_0x3e1b70[_0x6e88('0x30')]));if(_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x3b')]){_0x5c456d['where']=_[_0x6e88('0x3c')](_0x5c456d[_0x6e88('0x3d')],{'$or':_[_0x6e88('0x29')](_0x2b9c20,function(_0x32b607){if(_0x32b607['type']!==_0x6e88('0x3e')){var _0x1ee647={};_0x1ee647[_0x32b607[_0x6e88('0x26')]]={'$like':'%'+_0x3e6fd3[_0x6e88('0x2f')]['filter']+'%'};return _0x1ee647;}})});}_0x5c456d=_[_0x6e88('0x3c')]({},_0x5c456d,_0x3e6fd3[_0x6e88('0x3f')]);var _0xd2d4c4={'where':_0x5c456d['where']};return db[_0x6e88('0x2a')][_0x6e88('0x1b')](_0xd2d4c4)[_0x6e88('0x23')](function(_0x4009d1){_0x4bcfee[_0x6e88('0x1b')]=_0x4009d1;if(_0x3e6fd3[_0x6e88('0x2f')][_0x6e88('0x40')]){_0x5c456d['include']=[{'all':!![]}];}return db[_0x6e88('0x2a')][_0x6e88('0x41')](_0x5c456d);})['then'](function(_0xf78922){_0x4bcfee[_0x6e88('0x42')]=_0xf78922;return _0x4bcfee;})[_0x6e88('0x23')](respondWithFilteredResult(_0x274668,_0x5c456d))[_0x6e88('0x43')](handleError(_0x274668,null));};exports[_0x6e88('0x44')]=function(_0x13ff83,_0x52dca2){var _0x304901={'raw':!![],'where':{'id':_0x13ff83[_0x6e88('0x45')]['id']}},_0x285862={};_0x285862['model']=_[_0x6e88('0x46')](db[_0x6e88('0x2a')][_0x6e88('0x47')]);_0x285862[_0x6e88('0x2f')]=_[_0x6e88('0x46')](_0x13ff83[_0x6e88('0x2f')]);_0x285862[_0x6e88('0x30')]=_[_0x6e88('0x31')](_0x285862[_0x6e88('0x2e')],_0x285862[_0x6e88('0x2f')]);_0x304901[_0x6e88('0x32')]=_[_0x6e88('0x31')](_0x285862[_0x6e88('0x2e')],qs[_0x6e88('0x33')](_0x13ff83[_0x6e88('0x2f')][_0x6e88('0x33')]));_0x304901[_0x6e88('0x32')]=_0x304901[_0x6e88('0x32')]['length']?_0x304901[_0x6e88('0x32')]:_0x285862[_0x6e88('0x2e')];if(_0x13ff83['query'][_0x6e88('0x40')]){_0x304901['include']=[{'all':!![]}];}_0x304901=_['merge']({},_0x304901,_0x13ff83[_0x6e88('0x3f')]);return db['FaxTransferReport']['find'](_0x304901)['then'](handleEntityNotFound(_0x52dca2,null))[_0x6e88('0x23')](respondWithResult(_0x52dca2,null))[_0x6e88('0x43')](handleError(_0x52dca2,null));};exports[_0x6e88('0x48')]=function(_0x455e71,_0x5292d9){return db['FaxTransferReport'][_0x6e88('0x48')](_0x455e71[_0x6e88('0x49')],{})['then'](respondWithResult(_0x5292d9,0xc9))[_0x6e88('0x43')](handleError(_0x5292d9,null));};exports[_0x6e88('0x22')]=function(_0x25745c,_0x48f7ca){if(_0x25745c['body']['id']){delete _0x25745c[_0x6e88('0x49')]['id'];}return db['FaxTransferReport'][_0x6e88('0x4a')]({'where':{'id':_0x25745c[_0x6e88('0x45')]['id']}})[_0x6e88('0x23')](handleEntityNotFound(_0x48f7ca,null))[_0x6e88('0x23')](saveUpdates(_0x25745c[_0x6e88('0x49')],null))[_0x6e88('0x23')](respondWithResult(_0x48f7ca,null))[_0x6e88('0x43')](handleError(_0x48f7ca,null));};exports[_0x6e88('0x24')]=function(_0x475d57,_0x2eb870){return db[_0x6e88('0x2a')]['find']({'where':{'id':_0x475d57[_0x6e88('0x45')]['id']}})['then'](handleEntityNotFound(_0x2eb870,null))['then'](removeEntity(_0x2eb870,null))['catch'](handleError(_0x2eb870,null));};exports[_0x6e88('0x4b')]=function(_0x2f89dd,_0x563a85){return db[_0x6e88('0x2a')][_0x6e88('0x4b')]()[_0x6e88('0x23')](respondWithResult(_0x563a85,null))['catch'](handleError(_0x563a85,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index f7f6ded..f356013 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 _0xa825=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./faxTransferReport.attributes','exports','define','report_fax_transfer','uniqueid'];(function(_0xb3eb5a,_0x9d4bef){var _0xd4e56b=function(_0x472e47){while(--_0x472e47){_0xb3eb5a['push'](_0xb3eb5a['shift']());}};_0xd4e56b(++_0x9d4bef);}(_0xa825,0x1ea));var _0x5a82=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xa825[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x5a82('0x0'));var util=require(_0x5a82('0x1'));var logger=require(_0x5a82('0x2'))(_0x5a82('0x3'));var moment=require(_0x5a82('0x4'));var BPromise=require(_0x5a82('0x5'));var rp=require(_0x5a82('0x6'));var fs=require('fs');var path=require(_0x5a82('0x7'));var rimraf=require('rimraf');var config=require(_0x5a82('0x8'));var attributes=require(_0x5a82('0x9'));module[_0x5a82('0xa')]=function(_0x535470,_0x24bc45){return _0x535470[_0x5a82('0xb')]('FaxTransferReport',attributes,{'tableName':_0x5a82('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x5a82('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc90a=['lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer','uniqueid'];(function(_0x570077,_0x3086b9){var _0x4ec6f6=function(_0x27e694){while(--_0x27e694){_0x570077['push'](_0x570077['shift']());}};_0x4ec6f6(++_0x3086b9);}(_0xc90a,0x188));var _0xac90=function(_0x2af459,_0x1f0619){_0x2af459=_0x2af459-0x0;var _0x3a3c1b=_0xc90a[_0x2af459];return _0x3a3c1b;};'use strict';var _=require(_0xac90('0x0'));var util=require(_0xac90('0x1'));var logger=require(_0xac90('0x2'))('api');var moment=require('moment');var BPromise=require(_0xac90('0x3'));var rp=require(_0xac90('0x4'));var fs=require('fs');var path=require(_0xac90('0x5'));var rimraf=require(_0xac90('0x6'));var config=require(_0xac90('0x7'));var attributes=require(_0xac90('0x8'));module[_0xac90('0x9')]=function(_0x36b61b,_0x42f634){return _0x36b61b[_0xac90('0xa')](_0xac90('0xb'),attributes,{'tableName':_0xac90('0xc'),'paranoid':![],'indexes':[{'name':_0xac90('0xd'),'fields':[_0xac90('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 561800c..348bcd9 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 _0xaf81=['debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0xaf81,0x86));var _0x1af8=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xaf81[_0x5c3c0b];return _0x52ecd2;};'use strict';var _=require(_0x1af8('0x0'));var util=require(_0x1af8('0x1'));var moment=require(_0x1af8('0x2'));var BPromise=require(_0x1af8('0x3'));var rs=require(_0x1af8('0x4'));var fs=require('fs');var Redis=require(_0x1af8('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x1af8('0x6'));var logger=require('../../config/logger')(_0x1af8('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1af8('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xbc24f,_0x44ff8c,_0x4e7426){return new BPromise(function(_0xc5d032,_0x509641){return client[_0x1af8('0x9')](_0xbc24f,_0x4e7426)['then'](function(_0x58209a){logger[_0x1af8('0xa')](_0x1af8('0xb'),_0x44ff8c,_0x1af8('0xc'));logger[_0x1af8('0xd')](_0x1af8('0xe'),_0x44ff8c,_0x1af8('0xc'),JSON[_0x1af8('0xf')](_0x58209a));if(_0x58209a[_0x1af8('0x10')]){if(_0x58209a['error'][_0x1af8('0x11')]===0x1f4){logger[_0x1af8('0x10')](_0x1af8('0xb'),_0x44ff8c,_0x58209a['error'][_0x1af8('0x12')]);return _0x509641(_0x58209a[_0x1af8('0x10')][_0x1af8('0x12')]);}logger[_0x1af8('0x10')](_0x1af8('0xb'),_0x44ff8c,_0x58209a[_0x1af8('0x10')][_0x1af8('0x12')]);return _0xc5d032(_0x58209a[_0x1af8('0x10')][_0x1af8('0x12')]);}else{logger[_0x1af8('0xa')]('FaxTransferReport,\x20%s,\x20%s',_0x44ff8c,_0x1af8('0xc'));_0xc5d032(_0x58209a[_0x1af8('0x13')]['message']);}})[_0x1af8('0x14')](function(_0x91106c){logger[_0x1af8('0x10')](_0x1af8('0xb'),_0x44ff8c,_0x91106c);_0x509641(_0x91106c);});});} \ No newline at end of file +var _0xeeb3=['lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','stringify','error','code','FaxTransferReport,\x20%s,\x20%s','message'];(function(_0x5cd3bf,_0x69dc7c){var _0x11ed4a=function(_0x3ef610){while(--_0x3ef610){_0x5cd3bf['push'](_0x5cd3bf['shift']());}};_0x11ed4a(++_0x69dc7c);}(_0xeeb3,0x104));var _0x3eeb=function(_0x505255,_0x58a043){_0x505255=_0x505255-0x0;var _0x5001e0=_0xeeb3[_0x505255];return _0x5001e0;};'use strict';var _=require(_0x3eeb('0x0'));var util=require('util');var moment=require(_0x3eeb('0x1'));var BPromise=require(_0x3eeb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3eeb('0x3'));var db=require(_0x3eeb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3eeb('0x5'))(_0x3eeb('0x6'));var config=require(_0x3eeb('0x7'));var jayson=require(_0x3eeb('0x8'));var client=jayson[_0x3eeb('0x9')][_0x3eeb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2eaf44,_0x17ce6e,_0x1a1524){return new BPromise(function(_0x1b2ea2,_0x3d89fb){return client[_0x3eeb('0xb')](_0x2eaf44,_0x1a1524)['then'](function(_0x5014af){logger[_0x3eeb('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x17ce6e,_0x3eeb('0xd'));logger[_0x3eeb('0xe')]('FaxTransferReport,\x20%s,\x20%s,\x20%s',_0x17ce6e,_0x3eeb('0xd'),JSON[_0x3eeb('0xf')](_0x5014af));if(_0x5014af[_0x3eeb('0x10')]){if(_0x5014af[_0x3eeb('0x10')][_0x3eeb('0x11')]===0x1f4){logger[_0x3eeb('0x10')](_0x3eeb('0x12'),_0x17ce6e,_0x5014af[_0x3eeb('0x10')][_0x3eeb('0x13')]);return _0x3d89fb(_0x5014af['error']['message']);}logger[_0x3eeb('0x10')](_0x3eeb('0x12'),_0x17ce6e,_0x5014af[_0x3eeb('0x10')][_0x3eeb('0x13')]);return _0x1b2ea2(_0x5014af['error']['message']);}else{logger[_0x3eeb('0xc')]('FaxTransferReport,\x20%s,\x20%s',_0x17ce6e,_0x3eeb('0xd'));_0x1b2ea2(_0x5014af['result']['message']);}})['catch'](function(_0x20d802){logger['error']('FaxTransferReport,\x20%s,\x20%s',_0x17ce6e,_0x20d802);_0x3d89fb(_0x20d802);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 9910ffb..2bd3bda 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 _0xcda6=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post'];(function(_0x469ac7,_0x38e416){var _0x22f3b0=function(_0x1a1447){while(--_0x1a1447){_0x469ac7['push'](_0x469ac7['shift']());}};_0x22f3b0(++_0x38e416);}(_0xcda6,0x98));var _0x6cda=function(_0x227669,_0x551f1f){_0x227669=_0x227669-0x0;var _0x2272e2=_0xcda6[_0x227669];return _0x2272e2;};'use strict';var multer=require(_0x6cda('0x0'));var util=require(_0x6cda('0x1'));var path=require(_0x6cda('0x2'));var timeout=require(_0x6cda('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x6cda('0x4'));var interaction=require(_0x6cda('0x5'));var config=require(_0x6cda('0x6'));var controller=require(_0x6cda('0x7'));router['get']('/',auth[_0x6cda('0x8')](),controller[_0x6cda('0x9')]);router[_0x6cda('0xa')](_0x6cda('0xb'),auth[_0x6cda('0x8')](),controller[_0x6cda('0xc')]);router[_0x6cda('0xa')](_0x6cda('0xd'),auth[_0x6cda('0x8')](),controller[_0x6cda('0xe')]);router[_0x6cda('0xf')]('/',auth[_0x6cda('0x8')](),controller[_0x6cda('0x10')]);router['put']('/:id',auth[_0x6cda('0x8')](),controller[_0x6cda('0x11')]);router[_0x6cda('0x12')](_0x6cda('0xd'),auth[_0x6cda('0x8')](),controller[_0x6cda('0x13')]);module[_0x6cda('0x14')]=router; \ No newline at end of file +var _0x201c=['describe','/:id','show','put','update','delete','destroy','exports','connect-timeout','Router','../../components/interaction/service','./faxTransferReport.controller','get','isAuthenticated'];(function(_0x1d5ba8,_0x412a52){var _0x1022a2=function(_0x187f11){while(--_0x187f11){_0x1d5ba8['push'](_0x1d5ba8['shift']());}};_0x1022a2(++_0x412a52);}(_0x201c,0x1e4));var _0xc201=function(_0x465f84,_0x27e25d){_0x465f84=_0x465f84-0x0;var _0x5c8432=_0x201c[_0x465f84];return _0x5c8432;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc201('0x0'));var express=require('express');var router=express[_0xc201('0x1')]();var auth=require('../../components/auth/service');var interaction=require(_0xc201('0x2'));var config=require('../../config/environment');var controller=require(_0xc201('0x3'));router[_0xc201('0x4')]('/',auth[_0xc201('0x5')](),controller['index']);router[_0xc201('0x4')]('/describe',auth[_0xc201('0x5')](),controller[_0xc201('0x6')]);router[_0xc201('0x4')](_0xc201('0x7'),auth[_0xc201('0x5')](),controller[_0xc201('0x8')]);router['post']('/',auth[_0xc201('0x5')](),controller['create']);router[_0xc201('0x9')](_0xc201('0x7'),auth[_0xc201('0x5')](),controller[_0xc201('0xa')]);router[_0xc201('0xb')](_0xc201('0x7'),auth[_0xc201('0x5')](),controller[_0xc201('0xc')]);module[_0xc201('0xd')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 59e3399..a78fc12 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 _0x81bd=['/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intDeskAccount.controller','get','index','/:id','isAuthenticated','getConfigurations'];(function(_0x49f28a,_0x580a24){var _0x3c28e0=function(_0x51029f){while(--_0x51029f){_0x49f28a['push'](_0x49f28a['shift']());}};_0x3c28e0(++_0x580a24);}(_0x81bd,0x7c));var _0xd81b=function(_0x464f8b,_0x10ae65){_0x464f8b=_0x464f8b-0x0;var _0x46f2c7=_0x81bd[_0x464f8b];return _0x46f2c7;};'use strict';var multer=require(_0xd81b('0x0'));var util=require(_0xd81b('0x1'));var path=require(_0xd81b('0x2'));var timeout=require(_0xd81b('0x3'));var express=require(_0xd81b('0x4'));var router=express[_0xd81b('0x5')]();var auth=require(_0xd81b('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd81b('0x7'));var controller=require(_0xd81b('0x8'));router[_0xd81b('0x9')]('/',auth['isAuthenticated'](),controller[_0xd81b('0xa')]);router[_0xd81b('0x9')](_0xd81b('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd81b('0x9')]('/:id/configurations',auth[_0xd81b('0xc')](),controller[_0xd81b('0xd')]);router[_0xd81b('0x9')](_0xd81b('0xe'),auth[_0xd81b('0xc')](),controller[_0xd81b('0xf')]);router[_0xd81b('0x10')]('/',auth[_0xd81b('0xc')](),controller[_0xd81b('0x11')]);router[_0xd81b('0x10')](_0xd81b('0x12'),auth[_0xd81b('0xc')](),controller[_0xd81b('0x13')]);router['put'](_0xd81b('0xb'),auth['isAuthenticated'](),controller[_0xd81b('0x14')]);router[_0xd81b('0x15')]('/:id',auth[_0xd81b('0xc')](),controller['destroy']);module[_0xd81b('0x16')]=router; \ No newline at end of file +var _0x4300=['destroy','exports','multer','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskAccount.controller','isAuthenticated','get','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','/:id'];(function(_0x4ad6fb,_0x51ca5e){var _0xe278a1=function(_0x1d0e3c){while(--_0x1d0e3c){_0x4ad6fb['push'](_0x4ad6fb['shift']());}};_0xe278a1(++_0x51ca5e);}(_0x4300,0x1a6));var _0x0430=function(_0x39f045,_0x21b2c3){_0x39f045=_0x39f045-0x0;var _0x2b46fa=_0x4300[_0x39f045];return _0x2b46fa;};'use strict';var multer=require(_0x0430('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0430('0x1')]();var auth=require(_0x0430('0x2'));var interaction=require(_0x0430('0x3'));var config=require(_0x0430('0x4'));var controller=require(_0x0430('0x5'));router['get']('/',auth[_0x0430('0x6')](),controller['index']);router[_0x0430('0x7')]('/:id',auth[_0x0430('0x6')](),controller[_0x0430('0x8')]);router[_0x0430('0x7')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xa')]);router[_0x0430('0x7')](_0x0430('0xb'),auth[_0x0430('0x6')](),controller['getFields']);router[_0x0430('0xc')]('/',auth[_0x0430('0x6')](),controller[_0x0430('0xd')]);router[_0x0430('0xc')](_0x0430('0x9'),auth[_0x0430('0x6')](),controller[_0x0430('0xe')]);router[_0x0430('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x0430('0x10')]);router[_0x0430('0x11')](_0x0430('0x12'),auth[_0x0430('0x6')](),controller[_0x0430('0x13')]);module[_0x0430('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index 9016c9a..815387e 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 _0x9e16=['newTab','integrationTab','sequelize','exports','STRING','ENUM','basic'];(function(_0x32d19a,_0x4db374){var _0x3867f2=function(_0x473234){while(--_0x473234){_0x32d19a['push'](_0x32d19a['shift']());}};_0x3867f2(++_0x4db374);}(_0x9e16,0x87));var _0x69e1=function(_0xcddac9,_0x59c7fb){_0xcddac9=_0xcddac9-0x0;var _0x39b4fd=_0x9e16[_0xcddac9];return _0x39b4fd;};'use strict';var Sequelize=require(_0x69e1('0x0'));module[_0x69e1('0x1')]={'name':{'type':Sequelize[_0x69e1('0x2')]},'description':{'type':Sequelize[_0x69e1('0x2')]},'username':{'type':Sequelize[_0x69e1('0x2')]},'remoteUri':{'type':Sequelize[_0x69e1('0x2')]},'authType':{'type':Sequelize[_0x69e1('0x3')](_0x69e1('0x4')),'defaultValue':_0x69e1('0x4')},'password':{'type':Sequelize[_0x69e1('0x2')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x69e1('0x2')]},'token':{'type':Sequelize[_0x69e1('0x2')]},'tokenSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x69e1('0x2')]},'type':{'type':Sequelize[_0x69e1('0x3')]('integrationTab',_0x69e1('0x5')),'defaultValue':_0x69e1('0x6')}}; \ No newline at end of file +var _0xa386=['exports','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x369633,_0x263fb9){var _0x1eda8c=function(_0x3b1b46){while(--_0x3b1b46){_0x369633['push'](_0x369633['shift']());}};_0x1eda8c(++_0x263fb9);}(_0xa386,0xcc));var _0x6a38=function(_0x1c30bf,_0x247c31){_0x1c30bf=_0x1c30bf-0x0;var _0x255b5e=_0xa386[_0x1c30bf];return _0x255b5e;};'use strict';var Sequelize=require('sequelize');module[_0x6a38('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6a38('0x1')]},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x6a38('0x1')]},'authType':{'type':Sequelize[_0x6a38('0x2')](_0x6a38('0x3')),'defaultValue':'basic'},'password':{'type':Sequelize[_0x6a38('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0x6a38('0x1')]},'tokenSecret':{'type':Sequelize[_0x6a38('0x1')]},'serverUrl':{'type':Sequelize[_0x6a38('0x1')]},'type':{'type':Sequelize[_0x6a38('0x2')](_0x6a38('0x4'),_0x6a38('0x5')),'defaultValue':_0x6a38('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 5f69f79..3f98283 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 _0x09e3=['pick','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','DeskField','Subjects','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','slice','substring','GET','format','%s/custom_fields','application/json','basic','headers','Authorization','Basic\x20%s','base64','concat','entries','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','then','sendStatus','stack','name','map','DeskAccount','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','create','body','update','getConfigurations','DeskConfiguration','order'];(function(_0x1de59b,_0x46bc39){var _0x3977ad=function(_0x4f2d7b){while(--_0x4f2d7b){_0x1de59b['push'](_0x1de59b['shift']());}};_0x3977ad(++_0x46bc39);}(_0x09e3,0x188));var _0x309e=function(_0x2f0d77,_0x5ce6fa){_0x2f0d77=_0x2f0d77-0x0;var _0x3d3ef7=_0x09e3[_0x2f0d77];return _0x3d3ef7;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x309e('0x0'));var rimraf=require(_0x309e('0x1'));var zipdir=require(_0x309e('0x2'));var jsonpatch=require(_0x309e('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x309e('0x4'));var Mustache=require(_0x309e('0x5'));var util=require(_0x309e('0x6'));var path=require('path');var sox=require(_0x309e('0x7'));var csv=require(_0x309e('0x8'));var ejs=require(_0x309e('0x9'));var fs=require('fs');var _=require(_0x309e('0xa'));var squel=require('squel');var crypto=require(_0x309e('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x309e('0xc'));var toCsv=require(_0x309e('0x8'));var querystring=require('querystring');var Papa=require(_0x309e('0xd'));var Redis=require(_0x309e('0xe'));var authService=require(_0x309e('0xf'));var qs=require(_0x309e('0x10'));var as=require(_0x309e('0x11'));var hardwareService=require(_0x309e('0x12'));var logger=require(_0x309e('0x13'))('api');var utils=require(_0x309e('0x14'));var config=require(_0x309e('0x15'));var db=require('../../mysqldb')['db'];var integrations=require(_0x309e('0x16'));var jayson=require('jayson/promise');var client=jayson[_0x309e('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x535947,_0x30c66f,_0x3f79d3){if(_0x3f79d3){var _0x5d01d3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d01d3[_0x309e('0x18')](_0x30c66f)){return _0x535947;}else{throw new db[(_0x309e('0x19'))][(_0x309e('0x1a'))](_0x309e('0x1b'));}}else{return _0x535947;}}function respondWithRpcPromise(_0x49741f,_0x3c8b8f,_0x104d96,_0x51d7a8){return new BPromise(function(_0xef0d48,_0x37605d){var _0x2f17ce=_0x51d7a8||client;return _0x2f17ce['request'](_0x49741f,_0x104d96)['then'](function(_0x1fa9a6){logger[_0x309e('0x1c')]('DeskAccount,\x20%s,\x20%s',_0x3c8b8f,_0x309e('0x1d'));logger['debug']('DeskAccount,\x20%s,\x20%s,\x20%s',_0x3c8b8f,_0x309e('0x1d'),JSON[_0x309e('0x1e')](_0x1fa9a6));if(_0x1fa9a6[_0x309e('0x1f')]){if(_0x1fa9a6[_0x309e('0x1f')][_0x309e('0x20')]===0x1f4){logger['error'](_0x309e('0x21'),_0x3c8b8f,_0x1fa9a6[_0x309e('0x1f')][_0x309e('0x22')]);return _0x37605d(_0x1fa9a6[_0x309e('0x1f')]['message']);}logger[_0x309e('0x1f')](_0x309e('0x21'),_0x3c8b8f,_0x1fa9a6[_0x309e('0x1f')][_0x309e('0x22')]);return _0xef0d48(_0x1fa9a6['error'][_0x309e('0x22')]);}else{logger[_0x309e('0x1c')]('DeskAccount,\x20%s,\x20%s',_0x3c8b8f,_0x309e('0x1d'));_0xef0d48(_0x1fa9a6[_0x309e('0x23')][_0x309e('0x22')]);}})[_0x309e('0x24')](function(_0x4395e2){logger[_0x309e('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x3c8b8f,_0x4395e2);_0x37605d(_0x4395e2);});});}function respondWithStatusCode(_0x2c52fd,_0x380063){_0x380063=_0x380063||0xcc;return function(_0x190fcb){if(_0x190fcb){return _0x2c52fd['sendStatus'](_0x380063);}return _0x2c52fd[_0x309e('0x25')](_0x380063)[_0x309e('0x26')]();};}function respondWithResult(_0x4c44d3,_0x1a8c5e){_0x1a8c5e=_0x1a8c5e||0xc8;return function(_0x3f70f6){if(_0x3f70f6){return _0x4c44d3['status'](_0x1a8c5e)[_0x309e('0x27')](_0x3f70f6);}};}function respondWithFilteredResult(_0x214036,_0x56d8c2){return function(_0x21daa2){if(_0x21daa2){var _0x10bd6e=_0x21daa2[_0x309e('0x28')],_0x2c199e=_0x56d8c2[_0x309e('0x29')],_0x641095=_0x56d8c2[_0x309e('0x29')]+_0x56d8c2[_0x309e('0x2a')],_0x245fb5;if(_0x641095>=_0x10bd6e){_0x641095=_0x10bd6e;_0x245fb5=0xc8;}else{_0x245fb5=0xce;}_0x214036[_0x309e('0x25')](_0x245fb5);return _0x214036[_0x309e('0x2b')](_0x309e('0x2c'),_0x2c199e+'-'+_0x641095+'/'+_0x10bd6e)[_0x309e('0x27')](_0x21daa2);}return null;};}function patchUpdates(_0x2b4efb){return function(_0x106be2){try{jsonpatch[_0x309e('0x2d')](_0x106be2,_0x2b4efb,!![]);}catch(_0x4f9cbe){return BPromise[_0x309e('0x2e')](_0x4f9cbe);}return _0x106be2['save']();};}function saveUpdates(_0x328c9b,_0x3b72e7){return function(_0x419fb5){if(_0x419fb5){return _0x419fb5['update'](_0x328c9b)[_0x309e('0x2f')](function(_0x39ea8f){return _0x39ea8f;});}return null;};}function removeEntity(_0x9c28,_0x4092b0){return function(_0x33fc82){if(_0x33fc82){return _0x33fc82['destroy']()[_0x309e('0x2f')](function(){_0x9c28[_0x309e('0x25')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c3a6d,_0x4c1916){return function(_0x3774e7){if(!_0x3774e7){_0x2c3a6d[_0x309e('0x30')](0x194);}return _0x3774e7;};}function handleError(_0x82dd3e,_0x47635c){_0x47635c=_0x47635c||0x1f4;return function(_0x1fa1f8){logger[_0x309e('0x1f')](_0x1fa1f8[_0x309e('0x31')]);if(_0x1fa1f8[_0x309e('0x32')]){delete _0x1fa1f8[_0x309e('0x32')];}_0x82dd3e[_0x309e('0x25')](_0x47635c)['send'](_0x1fa1f8);};}exports['index']=function(_0xa8421,_0x56611f){var _0x2a68e4={},_0x3f8c92={},_0xb3cbb1={'count':0x0,'rows':[]};var _0x1d2766=_[_0x309e('0x33')](db[_0x309e('0x34')][_0x309e('0x35')],function(_0x3e859a){return{'name':_0x3e859a['fieldName'],'type':_0x3e859a[_0x309e('0x36')][_0x309e('0x37')]};});_0x3f8c92[_0x309e('0x38')]=_[_0x309e('0x33')](_0x1d2766,'name');_0x3f8c92[_0x309e('0x39')]=_[_0x309e('0x3a')](_0xa8421[_0x309e('0x39')]);_0x3f8c92[_0x309e('0x3b')]=_[_0x309e('0x3c')](_0x3f8c92[_0x309e('0x38')],_0x3f8c92['query']);_0x2a68e4['attributes']=_[_0x309e('0x3c')](_0x3f8c92[_0x309e('0x38')],qs[_0x309e('0x3d')](_0xa8421[_0x309e('0x39')][_0x309e('0x3d')]));_0x2a68e4[_0x309e('0x3e')]=_0x2a68e4[_0x309e('0x3e')][_0x309e('0x3f')]?_0x2a68e4['attributes']:_0x3f8c92[_0x309e('0x38')];if(!_0xa8421[_0x309e('0x39')][_0x309e('0x40')](_0x309e('0x41'))){_0x2a68e4[_0x309e('0x2a')]=qs[_0x309e('0x2a')](_0xa8421[_0x309e('0x39')]['limit']);_0x2a68e4[_0x309e('0x29')]=qs[_0x309e('0x29')](_0xa8421[_0x309e('0x39')][_0x309e('0x29')]);}_0x2a68e4['order']=qs[_0x309e('0x42')](_0xa8421[_0x309e('0x39')]['sort']);_0x2a68e4[_0x309e('0x43')]=qs[_0x309e('0x3b')](_['pick'](_0xa8421[_0x309e('0x39')],_0x3f8c92[_0x309e('0x3b')]));if(_0xa8421[_0x309e('0x39')][_0x309e('0x44')]){_0x2a68e4[_0x309e('0x43')]=_[_0x309e('0x45')](_0x2a68e4[_0x309e('0x43')],{'$or':_[_0x309e('0x33')](_0x1d2766,function(_0x364722){if(_0x364722['type']!==_0x309e('0x46')){var _0x398102={};_0x398102[_0x364722['name']]={'$like':'%'+_0xa8421[_0x309e('0x39')][_0x309e('0x44')]+'%'};return _0x398102;}})});}_0x2a68e4=_[_0x309e('0x45')]({},_0x2a68e4,_0xa8421[_0x309e('0x47')]);var _0x2adb34={'where':_0x2a68e4[_0x309e('0x43')]};return db[_0x309e('0x34')]['count'](_0x2adb34)[_0x309e('0x2f')](function(_0x4e563e){_0xb3cbb1[_0x309e('0x28')]=_0x4e563e;if(_0xa8421[_0x309e('0x39')][_0x309e('0x48')]){_0x2a68e4['include']=[{'all':!![]}];}return db[_0x309e('0x34')][_0x309e('0x49')](_0x2a68e4);})[_0x309e('0x2f')](function(_0x555a4e){_0xb3cbb1['rows']=_0x555a4e;return _0xb3cbb1;})[_0x309e('0x2f')](respondWithFilteredResult(_0x56611f,_0x2a68e4))['catch'](handleError(_0x56611f,null));};exports[_0x309e('0x4a')]=function(_0x53d4a2,_0x2e2811){var _0x242304={'raw':![],'where':{'id':_0x53d4a2[_0x309e('0x4b')]['id']}},_0xaeaf03={};_0xaeaf03[_0x309e('0x38')]=_[_0x309e('0x3a')](db[_0x309e('0x34')]['rawAttributes']);_0xaeaf03[_0x309e('0x39')]=_[_0x309e('0x3a')](_0x53d4a2[_0x309e('0x39')]);_0xaeaf03[_0x309e('0x3b')]=_[_0x309e('0x3c')](_0xaeaf03[_0x309e('0x38')],_0xaeaf03[_0x309e('0x39')]);_0x242304['attributes']=_[_0x309e('0x3c')](_0xaeaf03[_0x309e('0x38')],qs[_0x309e('0x3d')](_0x53d4a2[_0x309e('0x39')][_0x309e('0x3d')]));_0x242304[_0x309e('0x3e')]=_0x242304[_0x309e('0x3e')]['length']?_0x242304[_0x309e('0x3e')]:_0xaeaf03[_0x309e('0x38')];if(_0x53d4a2[_0x309e('0x39')][_0x309e('0x48')]){_0x242304[_0x309e('0x4c')]=[{'all':!![]}];}_0x242304=_[_0x309e('0x45')]({},_0x242304,_0x53d4a2[_0x309e('0x47')]);return db[_0x309e('0x34')][_0x309e('0x4d')](_0x242304)[_0x309e('0x2f')](handleEntityNotFound(_0x2e2811,null))[_0x309e('0x2f')](respondWithResult(_0x2e2811,null))[_0x309e('0x24')](handleError(_0x2e2811,null));};exports[_0x309e('0x4e')]=function(_0x5bd053,_0x61b801){return db['DeskAccount']['create'](_0x5bd053[_0x309e('0x4f')],{})[_0x309e('0x2f')](respondWithResult(_0x61b801,0xc9))[_0x309e('0x24')](handleError(_0x61b801,null));};exports[_0x309e('0x50')]=function(_0xd15412,_0x5392df){if(_0xd15412[_0x309e('0x4f')]['id']){delete _0xd15412[_0x309e('0x4f')]['id'];}return db[_0x309e('0x34')][_0x309e('0x4d')]({'where':{'id':_0xd15412[_0x309e('0x4b')]['id']}})[_0x309e('0x2f')](handleEntityNotFound(_0x5392df,null))['then'](saveUpdates(_0xd15412[_0x309e('0x4f')],null))[_0x309e('0x2f')](respondWithResult(_0x5392df,null))[_0x309e('0x24')](handleError(_0x5392df,null));};exports['destroy']=function(_0x5d46b3,_0xe662c1){return db[_0x309e('0x34')][_0x309e('0x4d')]({'where':{'id':_0x5d46b3[_0x309e('0x4b')]['id']}})[_0x309e('0x2f')](handleEntityNotFound(_0xe662c1,null))[_0x309e('0x2f')](removeEntity(_0xe662c1,null))[_0x309e('0x24')](handleError(_0xe662c1,null));};exports[_0x309e('0x51')]=function(_0x151ade,_0x48ad98,_0xb31869){var _0x420dc8={};var _0x5ce723={};var _0x5bf20f;var _0x55552f;return db[_0x309e('0x34')]['findOne']({'where':{'id':_0x151ade[_0x309e('0x4b')]['id']}})[_0x309e('0x2f')](handleEntityNotFound(_0x48ad98,null))[_0x309e('0x2f')](function(_0x38b6c5){if(_0x38b6c5){_0x5bf20f=_0x38b6c5;_0x5ce723['model']=_['keys'](db[_0x309e('0x52')][_0x309e('0x35')]);_0x5ce723['query']=_[_0x309e('0x3a')](_0x151ade[_0x309e('0x39')]);_0x5ce723[_0x309e('0x3b')]=_[_0x309e('0x3c')](_0x5ce723[_0x309e('0x38')],_0x5ce723['query']);_0x420dc8[_0x309e('0x3e')]=_['intersection'](_0x5ce723[_0x309e('0x38')],qs[_0x309e('0x3d')](_0x151ade['query'][_0x309e('0x3d')]));_0x420dc8['attributes']=_0x420dc8[_0x309e('0x3e')][_0x309e('0x3f')]?_0x420dc8['attributes']:_0x5ce723[_0x309e('0x38')];_0x420dc8[_0x309e('0x53')]=qs['sort'](_0x151ade[_0x309e('0x39')][_0x309e('0x42')]);_0x420dc8[_0x309e('0x43')]=qs[_0x309e('0x3b')](_[_0x309e('0x54')](_0x151ade[_0x309e('0x39')],_0x5ce723[_0x309e('0x3b')]));if(_0x151ade[_0x309e('0x39')][_0x309e('0x44')]){_0x420dc8[_0x309e('0x43')]=_['merge'](_0x420dc8['where'],{'$or':_[_0x309e('0x33')](_0x420dc8['attributes'],function(_0x5b732a){var _0x108a6e={};_0x108a6e[_0x5b732a]={'$like':'%'+_0x151ade[_0x309e('0x39')]['filter']+'%'};return _0x108a6e;})});}_0x420dc8=_[_0x309e('0x45')]({},_0x420dc8,_0x151ade['options']);return _0x5bf20f['getConfigurations'](_0x420dc8);}})['then'](function(_0x4cd9b7){if(_0x4cd9b7){_0x55552f=_0x4cd9b7[_0x309e('0x3f')];if(!_0x151ade['query']['hasOwnProperty'](_0x309e('0x41'))){_0x420dc8['limit']=qs[_0x309e('0x2a')](_0x151ade[_0x309e('0x39')][_0x309e('0x2a')]);_0x420dc8[_0x309e('0x29')]=qs['offset'](_0x151ade['query'][_0x309e('0x29')]);}return _0x5bf20f['getConfigurations'](_0x420dc8);}})[_0x309e('0x2f')](function(_0x5283da){if(_0x5283da){return _0x5283da?{'count':_0x55552f,'rows':_0x5283da}:null;}})[_0x309e('0x2f')](respondWithResult(_0x48ad98,null))[_0x309e('0x24')](handleError(_0x48ad98,null));};exports[_0x309e('0x55')]=function(_0x201129,_0x48db85,_0x5e0ed9){if(_0x201129[_0x309e('0x4f')]['id']){delete _0x201129[_0x309e('0x4f')]['id'];}return db['DeskAccount']['findOne']({'where':{'id':_0x201129[_0x309e('0x4b')]['id']}})[_0x309e('0x2f')](handleEntityNotFound(_0x48db85,null))[_0x309e('0x2f')](function(_0x4a5ab5){if(_0x4a5ab5){_0x201129['body'][_0x309e('0x56')]=_0x4a5ab5['id'];_0x201129[_0x309e('0x4f')]['Subjects']=integrations[_0x309e('0x57')](_0x201129['body'][_0x309e('0x58')],_0x201129[_0x309e('0x4f')][_0x309e('0x36')]);_0x201129[_0x309e('0x4f')][_0x309e('0x59')]=integrations[_0x309e('0x5a')](_0x201129['body'][_0x309e('0x58')],_0x201129[_0x309e('0x4f')]['type']);return db['DeskConfiguration']['create'](_0x201129[_0x309e('0x4f')],{'include':[{'model':db[_0x309e('0x5b')],'as':_0x309e('0x5c')},{'model':db[_0x309e('0x5b')],'as':_0x309e('0x59')}]});}return null;})[_0x309e('0x2f')](respondWithResult(_0x48db85,null))[_0x309e('0x24')](handleError(_0x48db85,null));};exports[_0x309e('0x5d')]=function(_0x36a535,_0x53ac70,_0x5c09e1){var _0x4c1880=[{'name':_0x309e('0x5e'),'label':'priority','custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x3d182b='';return db[_0x309e('0x34')]['findOne']({'where':{'id':_0x36a535[_0x309e('0x4b')]['id']},'attributes':['id',_0x309e('0x5f'),_0x309e('0x60'),_0x309e('0x61'),_0x309e('0x62'),_0x309e('0x63'),_0x309e('0x64'),_0x309e('0x65'),'tokenSecret']})[_0x309e('0x2f')](handleEntityNotFound(_0x53ac70,null))['then'](function(_0x10478b){if(_0x10478b){_0x3d182b=_0x10478b[_0x309e('0x5f')];var _0x5d86b0=_0x3d182b[_0x309e('0x66')](-0x1);if(_0x5d86b0==='/'){_0x3d182b=_0x3d182b[_0x309e('0x67')](0x0,_0x3d182b['lastIndexOf'](_0x5d86b0));}var _0x1f34e5={'method':_0x309e('0x68'),'uri':util[_0x309e('0x69')](_0x309e('0x6a'),_0x3d182b),'headers':{'Content-Type':_0x309e('0x6b'),'Accept':_0x309e('0x6b')},'json':!![]};if(_0x10478b[_0x309e('0x60')]===_0x309e('0x6c')){_0x1f34e5[_0x309e('0x6d')][_0x309e('0x6e')]=util[_0x309e('0x69')](_0x309e('0x6f'),new Buffer(util[_0x309e('0x69')]('%s:%s',_0x10478b[_0x309e('0x61')],_0x10478b[_0x309e('0x62')]))['toString'](_0x309e('0x70')));}return rp(_0x1f34e5)[_0x309e('0x2f')](function(_0x16106e){return _0x4c1880[_0x309e('0x71')](_['map'](_0x16106e['_embedded'][_0x309e('0x72')],function(_0x266fdf){return{'id':_0x266fdf[_0x309e('0x32')],'name':_0x266fdf['name'],'type':_0x266fdf[_0x309e('0x36')],'active':_0x266fdf['active'],'label':_0x266fdf[_0x309e('0x73')],'custom':!![]};}));});}})[_0x309e('0x2f')](function(_0x3531e){return{'count':_0x3531e[_0x309e('0x3f')],'rows':_0x3531e};})[_0x309e('0x2f')](respondWithResult(_0x53ac70,null))[_0x309e('0x24')](function(_0x31252a){var _0x5829db=_0x36a535[_0x309e('0x39')][_0x309e('0x18')]?0x1f4:_0x31252a[_0x309e('0x74')]||0x1f4;logger[_0x309e('0x1f')](_0x309e('0x75'),_0x309e('0x5d'),_0x5829db,JSON[_0x309e('0x1e')](_0x31252a));delete _0x31252a['name'];if(_0x5829db===0x191){_0x5829db=0x190;}_0x53ac70['status'](_0x5829db)[_0x309e('0x76')](_0x36a535[_0x309e('0x39')][_0x309e('0x18')]?{'message':'Wrong\x20credentials','statusCode':_0x31252a[_0x309e('0x74')]}:_0x31252a);});}; \ No newline at end of file +var _0xf3be=['headers','Authorization','format','Basic\x20%s','%s:%s','base64','concat','_embedded','entries','active','label','stringify','send','Wrong\x20credentials','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../components/integrations/configuration','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','DeskAccount,\x20%s,\x20%s','message','result','sendStatus','status','end','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','stack','name','index','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','options','DeskAccount','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','destroy','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','DeskField','getFields','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','tokenSecret','substring','lastIndexOf','GET','application/json','basic'];(function(_0x26a922,_0x2ff12b){var _0x10955f=function(_0x54dfe6){while(--_0x54dfe6){_0x26a922['push'](_0x26a922['shift']());}};_0x10955f(++_0x2ff12b);}(_0xf3be,0x191));var _0xef3b=function(_0x2e4c45,_0xc38fed){_0x2e4c45=_0x2e4c45-0x0;var _0x5c70fc=_0xf3be[_0x2e4c45];return _0x5c70fc;};'use strict';var pdf=require(_0xef3b('0x0'));var emlformat=require(_0xef3b('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xef3b('0x2'));var jsonpatch=require(_0xef3b('0x3'));var rp=require(_0xef3b('0x4'));var moment=require('moment');var BPromise=require(_0xef3b('0x5'));var Mustache=require('mustache');var util=require(_0xef3b('0x6'));var path=require(_0xef3b('0x7'));var sox=require(_0xef3b('0x8'));var csv=require(_0xef3b('0x9'));var ejs=require(_0xef3b('0xa'));var fs=require('fs');var _=require(_0xef3b('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xef3b('0xc'));var deskjs=require(_0xef3b('0xd'));var toCsv=require(_0xef3b('0x9'));var querystring=require(_0xef3b('0xe'));var Papa=require(_0xef3b('0xf'));var Redis=require(_0xef3b('0x10'));var authService=require(_0xef3b('0x11'));var qs=require(_0xef3b('0x12'));var as=require(_0xef3b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xef3b('0x14'));var utils=require(_0xef3b('0x15'));var config=require(_0xef3b('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xef3b('0x17'));var jayson=require('jayson/promise');var client=jayson[_0xef3b('0x18')][_0xef3b('0x19')]({'port':0x232a});function checkPasswordPattern(_0x5913cb,_0xe99b8,_0x22393f){if(_0x22393f){var _0x1a166a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1a166a[_0xef3b('0x1a')](_0xe99b8)){return _0x5913cb;}else{throw new db[(_0xef3b('0x1b'))][(_0xef3b('0x1c'))](_0xef3b('0x1d'));}}else{return _0x5913cb;}}function respondWithRpcPromise(_0x454f53,_0x2abe94,_0x2ccef3,_0xdda775){return new BPromise(function(_0x535f15,_0x431da3){var _0x3c24a4=_0xdda775||client;return _0x3c24a4[_0xef3b('0x1e')](_0x454f53,_0x2ccef3)['then'](function(_0x232dba){logger[_0xef3b('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x2abe94,_0xef3b('0x20'));logger['debug'](_0xef3b('0x21'),_0x2abe94,'request\x20sent',JSON['stringify'](_0x232dba));if(_0x232dba[_0xef3b('0x22')]){if(_0x232dba[_0xef3b('0x22')][_0xef3b('0x23')]===0x1f4){logger[_0xef3b('0x22')](_0xef3b('0x24'),_0x2abe94,_0x232dba[_0xef3b('0x22')]['message']);return _0x431da3(_0x232dba['error'][_0xef3b('0x25')]);}logger[_0xef3b('0x22')](_0xef3b('0x24'),_0x2abe94,_0x232dba['error'][_0xef3b('0x25')]);return _0x535f15(_0x232dba['error'][_0xef3b('0x25')]);}else{logger[_0xef3b('0x1f')]('DeskAccount,\x20%s,\x20%s',_0x2abe94,'request\x20sent');_0x535f15(_0x232dba[_0xef3b('0x26')][_0xef3b('0x25')]);}})['catch'](function(_0x129344){logger['error'](_0xef3b('0x24'),_0x2abe94,_0x129344);_0x431da3(_0x129344);});});}function respondWithStatusCode(_0xf1d0c,_0x536e78){_0x536e78=_0x536e78||0xcc;return function(_0x2601c3){if(_0x2601c3){return _0xf1d0c[_0xef3b('0x27')](_0x536e78);}return _0xf1d0c[_0xef3b('0x28')](_0x536e78)[_0xef3b('0x29')]();};}function respondWithResult(_0x760099,_0x18e5dd){_0x18e5dd=_0x18e5dd||0xc8;return function(_0x191659){if(_0x191659){return _0x760099[_0xef3b('0x28')](_0x18e5dd)['json'](_0x191659);}};}function respondWithFilteredResult(_0x18047a,_0x219ef6){return function(_0x4ca9b0){if(_0x4ca9b0){var _0x352f06=_0x4ca9b0[_0xef3b('0x2a')],_0x2fbf2f=_0x219ef6[_0xef3b('0x2b')],_0x14f2c4=_0x219ef6['offset']+_0x219ef6[_0xef3b('0x2c')],_0x244568;if(_0x14f2c4>=_0x352f06){_0x14f2c4=_0x352f06;_0x244568=0xc8;}else{_0x244568=0xce;}_0x18047a[_0xef3b('0x28')](_0x244568);return _0x18047a[_0xef3b('0x2d')](_0xef3b('0x2e'),_0x2fbf2f+'-'+_0x14f2c4+'/'+_0x352f06)[_0xef3b('0x2f')](_0x4ca9b0);}return null;};}function patchUpdates(_0x1d667b){return function(_0x4b4916){try{jsonpatch[_0xef3b('0x30')](_0x4b4916,_0x1d667b,!![]);}catch(_0x21a2cc){return BPromise[_0xef3b('0x31')](_0x21a2cc);}return _0x4b4916[_0xef3b('0x32')]();};}function saveUpdates(_0x40a6b5,_0x4eaae2){return function(_0x43b003){if(_0x43b003){return _0x43b003[_0xef3b('0x33')](_0x40a6b5)['then'](function(_0x57140e){return _0x57140e;});}return null;};}function removeEntity(_0x296999,_0x11086b){return function(_0x577301){if(_0x577301){return _0x577301['destroy']()[_0xef3b('0x34')](function(){_0x296999[_0xef3b('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x49316a,_0x154066){return function(_0x559ce5){if(!_0x559ce5){_0x49316a[_0xef3b('0x27')](0x194);}return _0x559ce5;};}function handleError(_0x292762,_0x2648bc){_0x2648bc=_0x2648bc||0x1f4;return function(_0x4f3339){logger[_0xef3b('0x22')](_0x4f3339[_0xef3b('0x35')]);if(_0x4f3339[_0xef3b('0x36')]){delete _0x4f3339[_0xef3b('0x36')];}_0x292762['status'](_0x2648bc)['send'](_0x4f3339);};}exports[_0xef3b('0x37')]=function(_0x5b8418,_0x3ac3a5){var _0x4077cd={},_0x56eb0d={},_0x2436fc={'count':0x0,'rows':[]};var _0x6e0498=_['map'](db['DeskAccount'][_0xef3b('0x38')],function(_0x5644d3){return{'name':_0x5644d3['fieldName'],'type':_0x5644d3[_0xef3b('0x39')][_0xef3b('0x3a')]};});_0x56eb0d[_0xef3b('0x3b')]=_[_0xef3b('0x3c')](_0x6e0498,'name');_0x56eb0d[_0xef3b('0x3d')]=_[_0xef3b('0x3e')](_0x5b8418['query']);_0x56eb0d[_0xef3b('0x3f')]=_[_0xef3b('0x40')](_0x56eb0d[_0xef3b('0x3b')],_0x56eb0d['query']);_0x4077cd[_0xef3b('0x41')]=_[_0xef3b('0x40')](_0x56eb0d[_0xef3b('0x3b')],qs['fields'](_0x5b8418['query']['fields']));_0x4077cd[_0xef3b('0x41')]=_0x4077cd[_0xef3b('0x41')][_0xef3b('0x42')]?_0x4077cd[_0xef3b('0x41')]:_0x56eb0d[_0xef3b('0x3b')];if(!_0x5b8418[_0xef3b('0x3d')][_0xef3b('0x43')]('nolimit')){_0x4077cd[_0xef3b('0x2c')]=qs['limit'](_0x5b8418['query']['limit']);_0x4077cd['offset']=qs[_0xef3b('0x2b')](_0x5b8418[_0xef3b('0x3d')][_0xef3b('0x2b')]);}_0x4077cd[_0xef3b('0x44')]=qs[_0xef3b('0x45')](_0x5b8418[_0xef3b('0x3d')]['sort']);_0x4077cd['where']=qs['filters'](_[_0xef3b('0x46')](_0x5b8418[_0xef3b('0x3d')],_0x56eb0d[_0xef3b('0x3f')]));if(_0x5b8418[_0xef3b('0x3d')][_0xef3b('0x47')]){_0x4077cd[_0xef3b('0x48')]=_[_0xef3b('0x49')](_0x4077cd[_0xef3b('0x48')],{'$or':_[_0xef3b('0x3c')](_0x6e0498,function(_0x996a72){if(_0x996a72[_0xef3b('0x39')]!==_0xef3b('0x4a')){var _0x519bbc={};_0x519bbc[_0x996a72['name']]={'$like':'%'+_0x5b8418[_0xef3b('0x3d')][_0xef3b('0x47')]+'%'};return _0x519bbc;}})});}_0x4077cd=_[_0xef3b('0x49')]({},_0x4077cd,_0x5b8418[_0xef3b('0x4b')]);var _0x211b35={'where':_0x4077cd['where']};return db[_0xef3b('0x4c')][_0xef3b('0x2a')](_0x211b35)[_0xef3b('0x34')](function(_0x5af200){_0x2436fc['count']=_0x5af200;if(_0x5b8418[_0xef3b('0x3d')][_0xef3b('0x4d')]){_0x4077cd[_0xef3b('0x4e')]=[{'all':!![]}];}return db[_0xef3b('0x4c')][_0xef3b('0x4f')](_0x4077cd);})[_0xef3b('0x34')](function(_0x199ba6){_0x2436fc[_0xef3b('0x50')]=_0x199ba6;return _0x2436fc;})['then'](respondWithFilteredResult(_0x3ac3a5,_0x4077cd))[_0xef3b('0x51')](handleError(_0x3ac3a5,null));};exports[_0xef3b('0x52')]=function(_0x453c3f,_0x4604d3){var _0x50166f={'raw':![],'where':{'id':_0x453c3f[_0xef3b('0x53')]['id']}},_0x2f762d={};_0x2f762d[_0xef3b('0x3b')]=_[_0xef3b('0x3e')](db[_0xef3b('0x4c')][_0xef3b('0x38')]);_0x2f762d[_0xef3b('0x3d')]=_['keys'](_0x453c3f[_0xef3b('0x3d')]);_0x2f762d[_0xef3b('0x3f')]=_[_0xef3b('0x40')](_0x2f762d[_0xef3b('0x3b')],_0x2f762d[_0xef3b('0x3d')]);_0x50166f['attributes']=_[_0xef3b('0x40')](_0x2f762d[_0xef3b('0x3b')],qs[_0xef3b('0x54')](_0x453c3f['query'][_0xef3b('0x54')]));_0x50166f['attributes']=_0x50166f[_0xef3b('0x41')][_0xef3b('0x42')]?_0x50166f[_0xef3b('0x41')]:_0x2f762d['model'];if(_0x453c3f['query']['includeAll']){_0x50166f[_0xef3b('0x4e')]=[{'all':!![]}];}_0x50166f=_['merge']({},_0x50166f,_0x453c3f[_0xef3b('0x4b')]);return db[_0xef3b('0x4c')][_0xef3b('0x55')](_0x50166f)['then'](handleEntityNotFound(_0x4604d3,null))[_0xef3b('0x34')](respondWithResult(_0x4604d3,null))[_0xef3b('0x51')](handleError(_0x4604d3,null));};exports[_0xef3b('0x56')]=function(_0x262b87,_0x2f0c5f){return db['DeskAccount'][_0xef3b('0x56')](_0x262b87['body'],{})[_0xef3b('0x34')](respondWithResult(_0x2f0c5f,0xc9))['catch'](handleError(_0x2f0c5f,null));};exports['update']=function(_0x1aa794,_0x483834){if(_0x1aa794['body']['id']){delete _0x1aa794[_0xef3b('0x57')]['id'];}return db[_0xef3b('0x4c')]['find']({'where':{'id':_0x1aa794[_0xef3b('0x53')]['id']}})[_0xef3b('0x34')](handleEntityNotFound(_0x483834,null))['then'](saveUpdates(_0x1aa794[_0xef3b('0x57')],null))[_0xef3b('0x34')](respondWithResult(_0x483834,null))[_0xef3b('0x51')](handleError(_0x483834,null));};exports[_0xef3b('0x58')]=function(_0xf3d10f,_0x40f0a8){return db['DeskAccount'][_0xef3b('0x55')]({'where':{'id':_0xf3d10f['params']['id']}})['then'](handleEntityNotFound(_0x40f0a8,null))[_0xef3b('0x34')](removeEntity(_0x40f0a8,null))[_0xef3b('0x51')](handleError(_0x40f0a8,null));};exports[_0xef3b('0x59')]=function(_0x209231,_0x549407,_0x480351){var _0x30cd61={};var _0x485ce4={};var _0x5b1c68;var _0x5012e6;return db[_0xef3b('0x4c')][_0xef3b('0x5a')]({'where':{'id':_0x209231[_0xef3b('0x53')]['id']}})['then'](handleEntityNotFound(_0x549407,null))['then'](function(_0x4146a0){if(_0x4146a0){_0x5b1c68=_0x4146a0;_0x485ce4[_0xef3b('0x3b')]=_['keys'](db[_0xef3b('0x5b')]['rawAttributes']);_0x485ce4['query']=_[_0xef3b('0x3e')](_0x209231['query']);_0x485ce4[_0xef3b('0x3f')]=_[_0xef3b('0x40')](_0x485ce4['model'],_0x485ce4[_0xef3b('0x3d')]);_0x30cd61['attributes']=_[_0xef3b('0x40')](_0x485ce4[_0xef3b('0x3b')],qs[_0xef3b('0x54')](_0x209231[_0xef3b('0x3d')][_0xef3b('0x54')]));_0x30cd61[_0xef3b('0x41')]=_0x30cd61[_0xef3b('0x41')][_0xef3b('0x42')]?_0x30cd61[_0xef3b('0x41')]:_0x485ce4[_0xef3b('0x3b')];_0x30cd61[_0xef3b('0x44')]=qs[_0xef3b('0x45')](_0x209231[_0xef3b('0x3d')][_0xef3b('0x45')]);_0x30cd61[_0xef3b('0x48')]=qs['filters'](_['pick'](_0x209231[_0xef3b('0x3d')],_0x485ce4[_0xef3b('0x3f')]));if(_0x209231[_0xef3b('0x3d')][_0xef3b('0x47')]){_0x30cd61[_0xef3b('0x48')]=_[_0xef3b('0x49')](_0x30cd61[_0xef3b('0x48')],{'$or':_[_0xef3b('0x3c')](_0x30cd61[_0xef3b('0x41')],function(_0x42229e){var _0x2e8b28={};_0x2e8b28[_0x42229e]={'$like':'%'+_0x209231[_0xef3b('0x3d')][_0xef3b('0x47')]+'%'};return _0x2e8b28;})});}_0x30cd61=_[_0xef3b('0x49')]({},_0x30cd61,_0x209231['options']);return _0x5b1c68[_0xef3b('0x59')](_0x30cd61);}})[_0xef3b('0x34')](function(_0x1302e7){if(_0x1302e7){_0x5012e6=_0x1302e7['length'];if(!_0x209231[_0xef3b('0x3d')][_0xef3b('0x43')](_0xef3b('0x5c'))){_0x30cd61[_0xef3b('0x2c')]=qs['limit'](_0x209231['query']['limit']);_0x30cd61[_0xef3b('0x2b')]=qs[_0xef3b('0x2b')](_0x209231[_0xef3b('0x3d')][_0xef3b('0x2b')]);}return _0x5b1c68['getConfigurations'](_0x30cd61);}})[_0xef3b('0x34')](function(_0x2e690c){if(_0x2e690c){return _0x2e690c?{'count':_0x5012e6,'rows':_0x2e690c}:null;}})[_0xef3b('0x34')](respondWithResult(_0x549407,null))[_0xef3b('0x51')](handleError(_0x549407,null));};exports[_0xef3b('0x5d')]=function(_0x5674bb,_0xce367,_0x199c83){if(_0x5674bb[_0xef3b('0x57')]['id']){delete _0x5674bb[_0xef3b('0x57')]['id'];}return db[_0xef3b('0x4c')]['findOne']({'where':{'id':_0x5674bb['params']['id']}})['then'](handleEntityNotFound(_0xce367,null))[_0xef3b('0x34')](function(_0x269133){if(_0x269133){_0x5674bb['body'][_0xef3b('0x5e')]=_0x269133['id'];_0x5674bb[_0xef3b('0x57')][_0xef3b('0x5f')]=integrations[_0xef3b('0x60')](_0x5674bb[_0xef3b('0x57')][_0xef3b('0x61')],_0x5674bb[_0xef3b('0x57')][_0xef3b('0x39')]);_0x5674bb[_0xef3b('0x57')][_0xef3b('0x62')]=integrations[_0xef3b('0x63')](_0x5674bb[_0xef3b('0x57')][_0xef3b('0x61')],_0x5674bb['body'][_0xef3b('0x39')]);return db['DeskConfiguration'][_0xef3b('0x56')](_0x5674bb[_0xef3b('0x57')],{'include':[{'model':db[_0xef3b('0x64')],'as':'Subjects'},{'model':db['DeskField'],'as':_0xef3b('0x62')}]});}return null;})[_0xef3b('0x34')](respondWithResult(_0xce367,null))[_0xef3b('0x51')](handleError(_0xce367,null));};exports[_0xef3b('0x65')]=function(_0x4c6137,_0x8fabc,_0x1b8e02){var _0x4fce06=[{'name':_0xef3b('0x66'),'label':_0xef3b('0x66'),'custom':![],'options':[{'name':0x1,'value':0x1},{'name':0x2,'value':0x2},{'name':0x3,'value':0x3},{'name':0x4,'value':0x4},{'name':0x5,'value':0x5},{'name':0x6,'value':0x6},{'name':0x7,'value':0x7},{'name':0x8,'value':0x8},{'name':0x9,'value':0x9},{'name':0xa,'value':0xa}]}];var _0x28522b='';return db[_0xef3b('0x4c')][_0xef3b('0x5a')]({'where':{'id':_0x4c6137[_0xef3b('0x53')]['id']},'attributes':['id',_0xef3b('0x67'),_0xef3b('0x68'),_0xef3b('0x69'),_0xef3b('0x6a'),_0xef3b('0x6b'),_0xef3b('0x6c'),'token',_0xef3b('0x6d')]})[_0xef3b('0x34')](handleEntityNotFound(_0x8fabc,null))[_0xef3b('0x34')](function(_0x2d0e18){if(_0x2d0e18){_0x28522b=_0x2d0e18[_0xef3b('0x67')];var _0x1442f9=_0x28522b['slice'](-0x1);if(_0x1442f9==='/'){_0x28522b=_0x28522b[_0xef3b('0x6e')](0x0,_0x28522b[_0xef3b('0x6f')](_0x1442f9));}var _0x580a99={'method':_0xef3b('0x70'),'uri':util['format']('%s/custom_fields',_0x28522b),'headers':{'Content-Type':_0xef3b('0x71'),'Accept':_0xef3b('0x71')},'json':!![]};if(_0x2d0e18[_0xef3b('0x68')]===_0xef3b('0x72')){_0x580a99[_0xef3b('0x73')][_0xef3b('0x74')]=util[_0xef3b('0x75')](_0xef3b('0x76'),new Buffer(util[_0xef3b('0x75')](_0xef3b('0x77'),_0x2d0e18[_0xef3b('0x69')],_0x2d0e18[_0xef3b('0x6a')]))['toString'](_0xef3b('0x78')));}return rp(_0x580a99)[_0xef3b('0x34')](function(_0x38b063){return _0x4fce06[_0xef3b('0x79')](_[_0xef3b('0x3c')](_0x38b063[_0xef3b('0x7a')][_0xef3b('0x7b')],function(_0x93ae3a){return{'id':_0x93ae3a[_0xef3b('0x36')],'name':_0x93ae3a[_0xef3b('0x36')],'type':_0x93ae3a['type'],'active':_0x93ae3a[_0xef3b('0x7c')],'label':_0x93ae3a[_0xef3b('0x7d')],'custom':!![]};}));});}})[_0xef3b('0x34')](function(_0x40ddbf){return{'count':_0x40ddbf['length'],'rows':_0x40ddbf};})[_0xef3b('0x34')](respondWithResult(_0x8fabc,null))['catch'](function(_0x42c59c){var _0x2381aa=_0x4c6137[_0xef3b('0x3d')][_0xef3b('0x1a')]?0x1f4:_0x42c59c['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xef3b('0x65'),_0x2381aa,JSON[_0xef3b('0x7e')](_0x42c59c));delete _0x42c59c[_0xef3b('0x36')];if(_0x2381aa===0x191){_0x2381aa=0x190;}_0x8fabc['status'](_0x2381aa)[_0xef3b('0x7f')](_0x4c6137[_0xef3b('0x3d')][_0xef3b('0x1a')]?{'message':_0xef3b('0x80'),'statusCode':_0x42c59c['statusCode']}:_0x42c59c);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index ebc8754..3ef30e7 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 _0x75fd=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDeskAccount.attributes','define','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0x75fd,0x1c5));var _0xd75f=function(_0x1e6136,_0x1aee49){_0x1e6136=_0x1e6136-0x0;var _0x4e8071=_0x75fd[_0x1e6136];return _0x4e8071;};'use strict';var _=require(_0xd75f('0x0'));var util=require(_0xd75f('0x1'));var logger=require(_0xd75f('0x2'))('api');var moment=require(_0xd75f('0x3'));var BPromise=require(_0xd75f('0x4'));var rp=require(_0xd75f('0x5'));var fs=require('fs');var path=require(_0xd75f('0x6'));var rimraf=require(_0xd75f('0x7'));var config=require(_0xd75f('0x8'));var attributes=require(_0xd75f('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x2e6522,_0x310761){return _0x2e6522[_0xd75f('0xa')]('DeskAccount',attributes,{'tableName':_0xd75f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcff9=['api','rimraf','../../config/environment','../../components/integrations/configuration','exports','int_desk_accounts','lodash','util','../../config/logger'];(function(_0x8bf294,_0x1ca4ae){var _0x596021=function(_0x2d1e15){while(--_0x2d1e15){_0x8bf294['push'](_0x8bf294['shift']());}};_0x596021(++_0x1ca4ae);}(_0xcff9,0x1ad));var _0x9cff=function(_0x55e573,_0x3b6daf){_0x55e573=_0x55e573-0x0;var _0x436e0f=_0xcff9[_0x55e573];return _0x436e0f;};'use strict';var _=require(_0x9cff('0x0'));var util=require(_0x9cff('0x1'));var logger=require(_0x9cff('0x2'))(_0x9cff('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9cff('0x4'));var config=require(_0x9cff('0x5'));var attributes=require('./intDeskAccount.attributes');var integrations=require(_0x9cff('0x6'));module[_0x9cff('0x7')]=function(_0x32bf90,_0x3cc12e){return _0x32bf90['define']('DeskAccount',attributes,{'tableName':_0x9cff('0x8'),'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 071b154..f86ee20 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 _0xb76b=['../../config/environment','client','http','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetDeskAccount','options','where','attributes','limit','include','model','stringify','DeskAccount','find','raw','map','ShowDeskAccount','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4347d4,_0x33b2f2){var _0x10b11a=function(_0x46b0e4){while(--_0x46b0e4){_0x4347d4['push'](_0x4347d4['shift']());}};_0x10b11a(++_0x33b2f2);}(_0xb76b,0xf2));var _0xbb76=function(_0x4c1ff6,_0x15ea38){_0x4c1ff6=_0x4c1ff6-0x0;var _0x5201fe=_0xb76b[_0x4c1ff6];return _0x5201fe;};'use strict';var _=require('lodash');var util=require(_0xbb76('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb76('0x1'));var db=require(_0xbb76('0x2'))['db'];var utils=require(_0xbb76('0x3'));var logger=require(_0xbb76('0x4'))(_0xbb76('0x5'));var config=require(_0xbb76('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbb76('0x7')][_0xbb76('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2c22f2,_0x37a677,_0x1ec735){return new BPromise(function(_0x2b9d7a,_0x3da35e){return client['request'](_0x2c22f2,_0x1ec735)['then'](function(_0x1c56d1){logger[_0xbb76('0x9')](_0xbb76('0xa'),_0x37a677,_0xbb76('0xb'));logger[_0xbb76('0xc')](_0xbb76('0xd'),_0x37a677,_0xbb76('0xb'),JSON['stringify'](_0x1c56d1));if(_0x1c56d1['error']){if(_0x1c56d1[_0xbb76('0xe')][_0xbb76('0xf')]===0x1f4){logger[_0xbb76('0xe')]('DeskAccount,\x20%s,\x20%s',_0x37a677,_0x1c56d1[_0xbb76('0xe')]['message']);return _0x3da35e(_0x1c56d1[_0xbb76('0xe')][_0xbb76('0x10')]);}logger['error'](_0xbb76('0xa'),_0x37a677,_0x1c56d1[_0xbb76('0xe')][_0xbb76('0x10')]);return _0x2b9d7a(_0x1c56d1[_0xbb76('0xe')][_0xbb76('0x10')]);}else{logger[_0xbb76('0x9')](_0xbb76('0xa'),_0x37a677,_0xbb76('0xb'));_0x2b9d7a(_0x1c56d1['result'][_0xbb76('0x10')]);}})[_0xbb76('0x11')](function(_0x46148f){logger[_0xbb76('0xe')](_0xbb76('0xa'),_0x37a677,_0x46148f);_0x3da35e(_0x46148f);});});}exports[_0xbb76('0x12')]=function(_0xcbfb68){var _0x30588a=this;return new Promise(function(_0x171405,_0x46e676){return db['DeskAccount']['findAll']({'raw':_0xcbfb68[_0xbb76('0x13')]?_0xcbfb68[_0xbb76('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0xcbfb68[_0xbb76('0x13')]?_0xcbfb68[_0xbb76('0x13')][_0xbb76('0x14')]||null:null,'attributes':_0xcbfb68[_0xbb76('0x13')]?_0xcbfb68[_0xbb76('0x13')][_0xbb76('0x15')]||null:null,'limit':_0xcbfb68[_0xbb76('0x13')]?_0xcbfb68[_0xbb76('0x13')][_0xbb76('0x16')]||null:null,'include':_0xcbfb68[_0xbb76('0x13')]?_0xcbfb68[_0xbb76('0x13')][_0xbb76('0x17')]?_['map'](_0xcbfb68[_0xbb76('0x13')]['include'],function(_0x4abdc4){return{'model':db[_0x4abdc4[_0xbb76('0x18')]],'as':_0x4abdc4['as'],'attributes':_0x4abdc4[_0xbb76('0x15')],'include':_0x4abdc4[_0xbb76('0x17')]?_['map'](_0x4abdc4[_0xbb76('0x17')],function(_0x562610){return{'model':db[_0x562610['model']],'as':_0x562610['as'],'attributes':_0x562610[_0xbb76('0x15')],'include':_0x562610[_0xbb76('0x17')]?_['map'](_0x562610[_0xbb76('0x17')],function(_0x11de3a){return{'model':db[_0x11de3a['model']],'as':_0x11de3a['as'],'attributes':_0x11de3a[_0xbb76('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4bc1c1){logger[_0xbb76('0x9')](_0xbb76('0x12'),_0xcbfb68);logger[_0xbb76('0xc')]('GetDeskAccount',_0xcbfb68,JSON[_0xbb76('0x19')](_0x4bc1c1));_0x171405(_0x4bc1c1);})['catch'](function(_0xcda085){logger[_0xbb76('0xe')](_0xbb76('0x12'),_0xcda085[_0xbb76('0x10')],_0xcbfb68);_0x46e676(_0x30588a[_0xbb76('0xe')](0x1f4,_0xcda085[_0xbb76('0x10')]));});});};exports['ShowDeskAccount']=function(_0x3d121a){var _0x3bf902=this;return new Promise(function(_0x352b37,_0x2c5712){return db[_0xbb76('0x1a')][_0xbb76('0x1b')]({'raw':_0x3d121a['options']?_0x3d121a[_0xbb76('0x13')][_0xbb76('0x1c')]===undefined?!![]:![]:!![],'where':_0x3d121a[_0xbb76('0x13')]?_0x3d121a['options'][_0xbb76('0x14')]||null:null,'attributes':_0x3d121a[_0xbb76('0x13')]?_0x3d121a['options'][_0xbb76('0x15')]||null:null,'include':_0x3d121a[_0xbb76('0x13')]?_0x3d121a['options'][_0xbb76('0x17')]?_[_0xbb76('0x1d')](_0x3d121a[_0xbb76('0x13')][_0xbb76('0x17')],function(_0x31bf59){return{'model':db[_0x31bf59[_0xbb76('0x18')]],'as':_0x31bf59['as'],'attributes':_0x31bf59[_0xbb76('0x15')],'include':_0x31bf59[_0xbb76('0x17')]?_[_0xbb76('0x1d')](_0x31bf59[_0xbb76('0x17')],function(_0x1729d2){return{'model':db[_0x1729d2[_0xbb76('0x18')]],'as':_0x1729d2['as'],'attributes':_0x1729d2['attributes'],'include':_0x1729d2[_0xbb76('0x17')]?_[_0xbb76('0x1d')](_0x1729d2[_0xbb76('0x17')],function(_0xa1518c){return{'model':db[_0xa1518c[_0xbb76('0x18')]],'as':_0xa1518c['as'],'attributes':_0xa1518c[_0xbb76('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x327ad3){logger['info'](_0xbb76('0x1e'),_0x3d121a);logger['debug'](_0xbb76('0x1e'),_0x3d121a,JSON[_0xbb76('0x19')](_0x327ad3));_0x352b37(_0x327ad3);})['catch'](function(_0x2e45a0){logger[_0xbb76('0xe')]('ShowDeskAccount',_0x2e45a0[_0xbb76('0x10')],_0x3d121a);_0x2c5712(_0x3bf902[_0xbb76('0xe')](0x1f4,_0x2e45a0[_0xbb76('0x10')]));});});}; \ No newline at end of file +var _0x02fc=['catch','DeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','then','GetDeskAccount','ShowDeskAccount','find','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result'];(function(_0x517a2d,_0x21e839){var _0x42498c=function(_0x4451b9){while(--_0x4451b9){_0x517a2d['push'](_0x517a2d['shift']());}};_0x42498c(++_0x21e839);}(_0x02fc,0x93));var _0xc02f=function(_0x325b12,_0x19b409){_0x325b12=_0x325b12-0x0;var _0xe1a491=_0x02fc[_0x325b12];return _0xe1a491;};'use strict';var _=require(_0xc02f('0x0'));var util=require(_0xc02f('0x1'));var moment=require(_0xc02f('0x2'));var BPromise=require('bluebird');var rs=require(_0xc02f('0x3'));var fs=require('fs');var Redis=require(_0xc02f('0x4'));var db=require(_0xc02f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc02f('0x6'))(_0xc02f('0x7'));var config=require('../../config/environment');var jayson=require(_0xc02f('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x164440,_0xf5a21e,_0x590bfe){return new BPromise(function(_0x17083d,_0x459ed0){return client[_0xc02f('0x9')](_0x164440,_0x590bfe)['then'](function(_0xadbd93){logger['info'](_0xc02f('0xa'),_0xf5a21e,_0xc02f('0xb'));logger[_0xc02f('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0xf5a21e,'request\x20sent',JSON[_0xc02f('0xd')](_0xadbd93));if(_0xadbd93[_0xc02f('0xe')]){if(_0xadbd93[_0xc02f('0xe')]['code']===0x1f4){logger[_0xc02f('0xe')](_0xc02f('0xa'),_0xf5a21e,_0xadbd93[_0xc02f('0xe')][_0xc02f('0xf')]);return _0x459ed0(_0xadbd93[_0xc02f('0xe')][_0xc02f('0xf')]);}logger[_0xc02f('0xe')](_0xc02f('0xa'),_0xf5a21e,_0xadbd93[_0xc02f('0xe')]['message']);return _0x17083d(_0xadbd93[_0xc02f('0xe')][_0xc02f('0xf')]);}else{logger[_0xc02f('0x10')](_0xc02f('0xa'),_0xf5a21e,_0xc02f('0xb'));_0x17083d(_0xadbd93[_0xc02f('0x11')]['message']);}})[_0xc02f('0x12')](function(_0x59f5b6){logger[_0xc02f('0xe')]('DeskAccount,\x20%s,\x20%s',_0xf5a21e,_0x59f5b6);_0x459ed0(_0x59f5b6);});});}exports['GetDeskAccount']=function(_0x375678){var _0x5ec465=this;return new Promise(function(_0x392b70,_0x15d6a5){return db[_0xc02f('0x13')][_0xc02f('0x14')]({'raw':_0x375678[_0xc02f('0x15')]?_0x375678[_0xc02f('0x15')][_0xc02f('0x16')]===undefined?!![]:![]:!![],'where':_0x375678[_0xc02f('0x15')]?_0x375678[_0xc02f('0x15')][_0xc02f('0x17')]||null:null,'attributes':_0x375678[_0xc02f('0x15')]?_0x375678[_0xc02f('0x15')][_0xc02f('0x18')]||null:null,'limit':_0x375678[_0xc02f('0x15')]?_0x375678[_0xc02f('0x15')][_0xc02f('0x19')]||null:null,'include':_0x375678[_0xc02f('0x15')]?_0x375678[_0xc02f('0x15')]['include']?_[_0xc02f('0x1a')](_0x375678[_0xc02f('0x15')]['include'],function(_0x567e2d){return{'model':db[_0x567e2d[_0xc02f('0x1b')]],'as':_0x567e2d['as'],'attributes':_0x567e2d[_0xc02f('0x18')],'include':_0x567e2d[_0xc02f('0x1c')]?_[_0xc02f('0x1a')](_0x567e2d[_0xc02f('0x1c')],function(_0x22d926){return{'model':db[_0x22d926['model']],'as':_0x22d926['as'],'attributes':_0x22d926[_0xc02f('0x18')],'include':_0x22d926[_0xc02f('0x1c')]?_['map'](_0x22d926[_0xc02f('0x1c')],function(_0x30f419){return{'model':db[_0x30f419[_0xc02f('0x1b')]],'as':_0x30f419['as'],'attributes':_0x30f419['attributes']};}):[]};}):[]};}):[]:[]})[_0xc02f('0x1d')](function(_0x1bd3f4){logger[_0xc02f('0x10')](_0xc02f('0x1e'),_0x375678);logger['debug']('GetDeskAccount',_0x375678,JSON[_0xc02f('0xd')](_0x1bd3f4));_0x392b70(_0x1bd3f4);})[_0xc02f('0x12')](function(_0xcafcc1){logger[_0xc02f('0xe')](_0xc02f('0x1e'),_0xcafcc1[_0xc02f('0xf')],_0x375678);_0x15d6a5(_0x5ec465[_0xc02f('0xe')](0x1f4,_0xcafcc1[_0xc02f('0xf')]));});});};exports[_0xc02f('0x1f')]=function(_0x2a149f){var _0x1dcfbf=this;return new Promise(function(_0x475f1a,_0x2e66dc){return db['DeskAccount'][_0xc02f('0x20')]({'raw':_0x2a149f[_0xc02f('0x15')]?_0x2a149f[_0xc02f('0x15')][_0xc02f('0x16')]===undefined?!![]:![]:!![],'where':_0x2a149f[_0xc02f('0x15')]?_0x2a149f[_0xc02f('0x15')][_0xc02f('0x17')]||null:null,'attributes':_0x2a149f[_0xc02f('0x15')]?_0x2a149f[_0xc02f('0x15')]['attributes']||null:null,'include':_0x2a149f['options']?_0x2a149f[_0xc02f('0x15')][_0xc02f('0x1c')]?_['map'](_0x2a149f[_0xc02f('0x15')]['include'],function(_0x38d372){return{'model':db[_0x38d372[_0xc02f('0x1b')]],'as':_0x38d372['as'],'attributes':_0x38d372['attributes'],'include':_0x38d372[_0xc02f('0x1c')]?_['map'](_0x38d372[_0xc02f('0x1c')],function(_0x49af2c){return{'model':db[_0x49af2c[_0xc02f('0x1b')]],'as':_0x49af2c['as'],'attributes':_0x49af2c[_0xc02f('0x18')],'include':_0x49af2c[_0xc02f('0x1c')]?_['map'](_0x49af2c[_0xc02f('0x1c')],function(_0x19cc8b){return{'model':db[_0x19cc8b[_0xc02f('0x1b')]],'as':_0x19cc8b['as'],'attributes':_0x19cc8b['attributes']};}):[]};}):[]};}):[]:[]})[_0xc02f('0x1d')](function(_0x314dca){logger[_0xc02f('0x10')](_0xc02f('0x1f'),_0x2a149f);logger[_0xc02f('0xc')]('ShowDeskAccount',_0x2a149f,JSON[_0xc02f('0xd')](_0x314dca));_0x475f1a(_0x314dca);})['catch'](function(_0x5ef641){logger[_0xc02f('0xe')](_0xc02f('0x1f'),_0x5ef641[_0xc02f('0xf')],_0x2a149f);_0x2e66dc(_0x1dcfbf[_0xc02f('0xe')](0x1f4,_0x5ef641[_0xc02f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index baf413d..14b23c2 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 _0x2ef3=['delete','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','setTags','update'];(function(_0x3a4047,_0x54c537){var _0x502a29=function(_0x109986){while(--_0x109986){_0x3a4047['push'](_0x3a4047['shift']());}};_0x502a29(++_0x54c537);}(_0x2ef3,0xba));var _0x32ef=function(_0x35205d,_0x415cb9){_0x35205d=_0x35205d-0x0;var _0x4dd418=_0x2ef3[_0x35205d];return _0x4dd418;};'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('./intDeskConfiguration.controller');router[_0x32ef('0x8')]('/',auth[_0x32ef('0x9')](),controller['index']);router['get'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xb')]);router[_0x32ef('0x8')](_0x32ef('0xc'),auth[_0x32ef('0x9')](),controller[_0x32ef('0xd')]);router[_0x32ef('0x8')](_0x32ef('0xe'),auth[_0x32ef('0x9')](),controller['getSubjects']);router['get'](_0x32ef('0xf'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x10')]);router[_0x32ef('0x8')]('/:id/tags',auth[_0x32ef('0x9')](),controller['getTags']);router[_0x32ef('0x11')]('/',auth['isAuthenticated'](),controller[_0x32ef('0x12')]);router[_0x32ef('0x11')]('/:id/tags',auth['isAuthenticated'](),controller[_0x32ef('0x13')]);router['put'](_0x32ef('0xa'),auth[_0x32ef('0x9')](),controller[_0x32ef('0x14')]);router[_0x32ef('0x15')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x32ef('0x16')]=router; \ No newline at end of file +var _0x404d=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x404192,_0x5e084e){var _0x38f955=function(_0x12efdb){while(--_0x12efdb){_0x404192['push'](_0x404192['shift']());}};_0x38f955(++_0x5e084e);}(_0x404d,0x1e9));var _0xd404=function(_0x3bff66,_0x46efa5){_0x3bff66=_0x3bff66-0x0;var _0x3d8ff2=_0x404d[_0x3bff66];return _0x3d8ff2;};'use strict';var multer=require(_0xd404('0x0'));var util=require(_0xd404('0x1'));var path=require(_0xd404('0x2'));var timeout=require(_0xd404('0x3'));var express=require(_0xd404('0x4'));var router=express[_0xd404('0x5')]();var auth=require(_0xd404('0x6'));var interaction=require(_0xd404('0x7'));var config=require(_0xd404('0x8'));var controller=require('./intDeskConfiguration.controller');router[_0xd404('0x9')]('/',auth[_0xd404('0xa')](),controller['index']);router[_0xd404('0x9')](_0xd404('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xd404('0x9')](_0xd404('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0xd404('0x9')](_0xd404('0xd'),auth[_0xd404('0xa')](),controller[_0xd404('0xe')]);router['get']('/:id/descriptions',auth[_0xd404('0xa')](),controller[_0xd404('0xf')]);router['get'](_0xd404('0x10'),auth[_0xd404('0xa')](),controller[_0xd404('0x11')]);router[_0xd404('0x12')]('/',auth[_0xd404('0xa')](),controller[_0xd404('0x13')]);router[_0xd404('0x12')](_0xd404('0x10'),auth[_0xd404('0xa')](),controller[_0xd404('0x14')]);router[_0xd404('0x15')](_0xd404('0xb'),auth[_0xd404('0xa')](),controller[_0xd404('0x16')]);router[_0xd404('0x17')](_0xd404('0xb'),auth[_0xd404('0xa')](),controller[_0xd404('0x18')]);module[_0xd404('0x19')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index 39d932d..a43914f 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 _0x7641=['exports','sequelize'];(function(_0x5d48dd,_0x536856){var _0x13d94c=function(_0x4c32c3){while(--_0x4c32c3){_0x5d48dd['push'](_0x5d48dd['shift']());}};_0x13d94c(++_0x536856);}(_0x7641,0x18f));var _0x1764=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x7641[_0x47b58b];return _0x46bebe;};'use strict';var Sequelize=require(_0x1764('0x0'));module[_0x1764('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xf9bb=['STRING','sequelize','exports'];(function(_0x41fbdf,_0x2740fe){var _0x20e059=function(_0x521269){while(--_0x521269){_0x41fbdf['push'](_0x41fbdf['shift']());}};_0x20e059(++_0x2740fe);}(_0xf9bb,0x157));var _0xbf9b=function(_0x40cb69,_0x37f2ba){_0x40cb69=_0x40cb69-0x0;var _0x55e036=_0xf9bb[_0x40cb69];return _0x55e036;};'use strict';var Sequelize=require(_0xbf9b('0x0'));module[_0xbf9b('0x1')]={'name':{'type':Sequelize[_0xbf9b('0x2')]},'description':{'type':Sequelize[_0xbf9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index 139f12c..b5ce6bc 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 _0x43a9=['Tag','setTags','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','stack','name','send','DeskConfiguration','rawAttributes','type','model','query','filters','attributes','intersection','fields','length','nolimit','sort','pick','filter','where','map','options','includeAll','include','findAll','show','params','keys','find','create','body','getFields','DeskField','order','merge','hasOwnProperty','getSubjects','findOne','getDescriptions','getTags'];(function(_0x3c7601,_0x5eb803){var _0x254f65=function(_0x1a65ad){while(--_0x1a65ad){_0x3c7601['push'](_0x3c7601['shift']());}};_0x254f65(++_0x5eb803);}(_0x43a9,0x128));var _0x943a=function(_0x25fe80,_0x35f583){_0x25fe80=_0x25fe80-0x0;var _0x329fd7=_0x43a9[_0x25fe80];return _0x329fd7;};'use strict';var pdf=require(_0x943a('0x0'));var emlformat=require(_0x943a('0x1'));var rimraf=require(_0x943a('0x2'));var zipdir=require(_0x943a('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x943a('0x4'));var moment=require(_0x943a('0x5'));var BPromise=require(_0x943a('0x6'));var Mustache=require('mustache');var util=require(_0x943a('0x7'));var path=require(_0x943a('0x8'));var sox=require(_0x943a('0x9'));var csv=require(_0x943a('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x943a('0xb'));var squel=require(_0x943a('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x943a('0xd'));var toCsv=require(_0x943a('0xa'));var querystring=require(_0x943a('0xe'));var Papa=require(_0x943a('0xf'));var Redis=require(_0x943a('0x10'));var authService=require(_0x943a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x943a('0x12'));var hardwareService=require(_0x943a('0x13'));var logger=require('../../config/logger')(_0x943a('0x14'));var utils=require(_0x943a('0x15'));var config=require(_0x943a('0x16'));var db=require(_0x943a('0x17'))['db'];var jayson=require(_0x943a('0x18'));var client=jayson[_0x943a('0x19')][_0x943a('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5c3c06,_0x19d10c,_0x36b8ef){if(_0x36b8ef){var _0x4def05=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4def05[_0x943a('0x1b')](_0x19d10c)){return _0x5c3c06;}else{throw new db[(_0x943a('0x1c'))][(_0x943a('0x1d'))](_0x943a('0x1e'));}}else{return _0x5c3c06;}}function respondWithRpcPromise(_0x189b12,_0x2e396b,_0x3fc868,_0x555623){return new BPromise(function(_0x182672,_0x1bbd78){var _0x29d533=_0x555623||client;return _0x29d533[_0x943a('0x1f')](_0x189b12,_0x3fc868)[_0x943a('0x20')](function(_0x374ce7){logger[_0x943a('0x21')](_0x943a('0x22'),_0x2e396b,_0x943a('0x23'));logger[_0x943a('0x24')](_0x943a('0x25'),_0x2e396b,_0x943a('0x23'),JSON[_0x943a('0x26')](_0x374ce7));if(_0x374ce7[_0x943a('0x27')]){if(_0x374ce7[_0x943a('0x27')][_0x943a('0x28')]===0x1f4){logger[_0x943a('0x27')](_0x943a('0x22'),_0x2e396b,_0x374ce7[_0x943a('0x27')]['message']);return _0x1bbd78(_0x374ce7[_0x943a('0x27')][_0x943a('0x29')]);}logger[_0x943a('0x27')](_0x943a('0x22'),_0x2e396b,_0x374ce7[_0x943a('0x27')][_0x943a('0x29')]);return _0x182672(_0x374ce7[_0x943a('0x27')]['message']);}else{logger[_0x943a('0x21')](_0x943a('0x22'),_0x2e396b,_0x943a('0x23'));_0x182672(_0x374ce7[_0x943a('0x2a')]['message']);}})[_0x943a('0x2b')](function(_0x2a39c3){logger['error'](_0x943a('0x22'),_0x2e396b,_0x2a39c3);_0x1bbd78(_0x2a39c3);});});}function respondWithStatusCode(_0x18dbef,_0xf778a9){_0xf778a9=_0xf778a9||0xcc;return function(_0x1b3002){if(_0x1b3002){return _0x18dbef[_0x943a('0x2c')](_0xf778a9);}return _0x18dbef['status'](_0xf778a9)[_0x943a('0x2d')]();};}function respondWithResult(_0x34f703,_0xdd08c7){_0xdd08c7=_0xdd08c7||0xc8;return function(_0x56273f){if(_0x56273f){return _0x34f703[_0x943a('0x2e')](_0xdd08c7)['json'](_0x56273f);}};}function respondWithFilteredResult(_0x1a1134,_0x5ce0fc){return function(_0x42cb37){if(_0x42cb37){var _0x39f059=_0x42cb37[_0x943a('0x2f')],_0x1fef75=_0x5ce0fc[_0x943a('0x30')],_0x1c1f22=_0x5ce0fc['offset']+_0x5ce0fc[_0x943a('0x31')],_0x2f22b1;if(_0x1c1f22>=_0x39f059){_0x1c1f22=_0x39f059;_0x2f22b1=0xc8;}else{_0x2f22b1=0xce;}_0x1a1134['status'](_0x2f22b1);return _0x1a1134[_0x943a('0x32')](_0x943a('0x33'),_0x1fef75+'-'+_0x1c1f22+'/'+_0x39f059)[_0x943a('0x34')](_0x42cb37);}return null;};}function patchUpdates(_0x596c58){return function(_0x1e5592){try{jsonpatch[_0x943a('0x35')](_0x1e5592,_0x596c58,!![]);}catch(_0x3d86b8){return BPromise[_0x943a('0x36')](_0x3d86b8);}return _0x1e5592[_0x943a('0x37')]();};}function saveUpdates(_0x3bc4f2,_0x27baa3){return function(_0x1cd5d0){if(_0x1cd5d0){return _0x1cd5d0[_0x943a('0x38')](_0x3bc4f2)[_0x943a('0x20')](function(_0x21c21e){return _0x21c21e;});}return null;};}function removeEntity(_0x5872f0,_0x46f9bc){return function(_0x1d3f57){if(_0x1d3f57){return _0x1d3f57[_0x943a('0x39')]()['then'](function(){_0x5872f0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1852f4,_0x1e732f){return function(_0x55325f){if(!_0x55325f){_0x1852f4[_0x943a('0x2c')](0x194);}return _0x55325f;};}function handleError(_0xf7eee4,_0x2c4293){_0x2c4293=_0x2c4293||0x1f4;return function(_0x198c75){logger[_0x943a('0x27')](_0x198c75[_0x943a('0x3a')]);if(_0x198c75[_0x943a('0x3b')]){delete _0x198c75[_0x943a('0x3b')];}_0xf7eee4[_0x943a('0x2e')](_0x2c4293)[_0x943a('0x3c')](_0x198c75);};}exports['index']=function(_0x1613c3,_0x1d05d7){var _0x1e06cd={},_0x2fe1ae={},_0x29d294={'count':0x0,'rows':[]};var _0x63259d=_['map'](db[_0x943a('0x3d')][_0x943a('0x3e')],function(_0x5aac33){return{'name':_0x5aac33['fieldName'],'type':_0x5aac33[_0x943a('0x3f')]['key']};});_0x2fe1ae[_0x943a('0x40')]=_['map'](_0x63259d,_0x943a('0x3b'));_0x2fe1ae[_0x943a('0x41')]=_['keys'](_0x1613c3[_0x943a('0x41')]);_0x2fe1ae[_0x943a('0x42')]=_['intersection'](_0x2fe1ae[_0x943a('0x40')],_0x2fe1ae[_0x943a('0x41')]);_0x1e06cd[_0x943a('0x43')]=_[_0x943a('0x44')](_0x2fe1ae[_0x943a('0x40')],qs[_0x943a('0x45')](_0x1613c3[_0x943a('0x41')][_0x943a('0x45')]));_0x1e06cd[_0x943a('0x43')]=_0x1e06cd['attributes'][_0x943a('0x46')]?_0x1e06cd[_0x943a('0x43')]:_0x2fe1ae['model'];if(!_0x1613c3[_0x943a('0x41')]['hasOwnProperty'](_0x943a('0x47'))){_0x1e06cd[_0x943a('0x31')]=qs[_0x943a('0x31')](_0x1613c3['query'][_0x943a('0x31')]);_0x1e06cd[_0x943a('0x30')]=qs[_0x943a('0x30')](_0x1613c3[_0x943a('0x41')][_0x943a('0x30')]);}_0x1e06cd['order']=qs[_0x943a('0x48')](_0x1613c3['query'][_0x943a('0x48')]);_0x1e06cd['where']=qs[_0x943a('0x42')](_[_0x943a('0x49')](_0x1613c3[_0x943a('0x41')],_0x2fe1ae[_0x943a('0x42')]));if(_0x1613c3[_0x943a('0x41')][_0x943a('0x4a')]){_0x1e06cd[_0x943a('0x4b')]=_['merge'](_0x1e06cd['where'],{'$or':_[_0x943a('0x4c')](_0x63259d,function(_0x1d2090){if(_0x1d2090[_0x943a('0x3f')]!=='VIRTUAL'){var _0x565167={};_0x565167[_0x1d2090[_0x943a('0x3b')]]={'$like':'%'+_0x1613c3[_0x943a('0x41')][_0x943a('0x4a')]+'%'};return _0x565167;}})});}_0x1e06cd=_['merge']({},_0x1e06cd,_0x1613c3[_0x943a('0x4d')]);var _0x5bec37={'where':_0x1e06cd[_0x943a('0x4b')]};return db[_0x943a('0x3d')]['count'](_0x5bec37)[_0x943a('0x20')](function(_0x79bb1e){_0x29d294['count']=_0x79bb1e;if(_0x1613c3[_0x943a('0x41')][_0x943a('0x4e')]){_0x1e06cd[_0x943a('0x4f')]=[{'all':!![]}];}return db[_0x943a('0x3d')][_0x943a('0x50')](_0x1e06cd);})[_0x943a('0x20')](function(_0x4af976){_0x29d294['rows']=_0x4af976;return _0x29d294;})[_0x943a('0x20')](respondWithFilteredResult(_0x1d05d7,_0x1e06cd))[_0x943a('0x2b')](handleError(_0x1d05d7,null));};exports[_0x943a('0x51')]=function(_0xd4ae6a,_0x48088d){var _0x2fe00d={'raw':![],'where':{'id':_0xd4ae6a[_0x943a('0x52')]['id']}},_0x47d477={};_0x47d477['model']=_[_0x943a('0x53')](db['DeskConfiguration'][_0x943a('0x3e')]);_0x47d477[_0x943a('0x41')]=_[_0x943a('0x53')](_0xd4ae6a['query']);_0x47d477[_0x943a('0x42')]=_[_0x943a('0x44')](_0x47d477[_0x943a('0x40')],_0x47d477[_0x943a('0x41')]);_0x2fe00d[_0x943a('0x43')]=_[_0x943a('0x44')](_0x47d477['model'],qs[_0x943a('0x45')](_0xd4ae6a[_0x943a('0x41')][_0x943a('0x45')]));_0x2fe00d[_0x943a('0x43')]=_0x2fe00d[_0x943a('0x43')][_0x943a('0x46')]?_0x2fe00d[_0x943a('0x43')]:_0x47d477['model'];if(_0xd4ae6a[_0x943a('0x41')][_0x943a('0x4e')]){_0x2fe00d[_0x943a('0x4f')]=[{'all':!![]}];}_0x2fe00d=_['merge']({},_0x2fe00d,_0xd4ae6a['options']);return db[_0x943a('0x3d')][_0x943a('0x54')](_0x2fe00d)[_0x943a('0x20')](handleEntityNotFound(_0x48088d,null))[_0x943a('0x20')](respondWithResult(_0x48088d,null))[_0x943a('0x2b')](handleError(_0x48088d,null));};exports['create']=function(_0x490759,_0x2a01a1){return db[_0x943a('0x3d')][_0x943a('0x55')](_0x490759[_0x943a('0x56')],{})[_0x943a('0x20')](respondWithResult(_0x2a01a1,0xc9))[_0x943a('0x2b')](handleError(_0x2a01a1,null));};exports['update']=function(_0x5e284b,_0x111162){if(_0x5e284b[_0x943a('0x56')]['id']){delete _0x5e284b[_0x943a('0x56')]['id'];}return db[_0x943a('0x3d')][_0x943a('0x54')]({'where':{'id':_0x5e284b[_0x943a('0x52')]['id']}})['then'](handleEntityNotFound(_0x111162,null))[_0x943a('0x20')](saveUpdates(_0x5e284b['body'],null))['then'](respondWithResult(_0x111162,null))['catch'](handleError(_0x111162,null));};exports[_0x943a('0x39')]=function(_0x35ad8d,_0x472bbc){return db[_0x943a('0x3d')]['find']({'where':{'id':_0x35ad8d[_0x943a('0x52')]['id']}})[_0x943a('0x20')](handleEntityNotFound(_0x472bbc,null))[_0x943a('0x20')](removeEntity(_0x472bbc,null))[_0x943a('0x2b')](handleError(_0x472bbc,null));};exports[_0x943a('0x57')]=function(_0x1e7426,_0x16e674,_0x4cd353){var _0xdae9e0={};var _0x1ce4bc={};var _0x18f38f;var _0x580312;return db['DeskConfiguration']['findOne']({'where':{'id':_0x1e7426['params']['id']}})[_0x943a('0x20')](handleEntityNotFound(_0x16e674,null))[_0x943a('0x20')](function(_0x1e9764){if(_0x1e9764){_0x18f38f=_0x1e9764;_0x1ce4bc[_0x943a('0x40')]=_[_0x943a('0x53')](db[_0x943a('0x58')][_0x943a('0x3e')]);_0x1ce4bc['query']=_[_0x943a('0x53')](_0x1e7426[_0x943a('0x41')]);_0x1ce4bc[_0x943a('0x42')]=_[_0x943a('0x44')](_0x1ce4bc[_0x943a('0x40')],_0x1ce4bc[_0x943a('0x41')]);_0xdae9e0[_0x943a('0x43')]=_[_0x943a('0x44')](_0x1ce4bc[_0x943a('0x40')],qs[_0x943a('0x45')](_0x1e7426[_0x943a('0x41')][_0x943a('0x45')]));_0xdae9e0[_0x943a('0x43')]=_0xdae9e0[_0x943a('0x43')][_0x943a('0x46')]?_0xdae9e0[_0x943a('0x43')]:_0x1ce4bc['model'];_0xdae9e0[_0x943a('0x59')]=qs[_0x943a('0x48')](_0x1e7426[_0x943a('0x41')][_0x943a('0x48')]);_0xdae9e0[_0x943a('0x4b')]=qs[_0x943a('0x42')](_[_0x943a('0x49')](_0x1e7426[_0x943a('0x41')],_0x1ce4bc['filters']));if(_0x1e7426[_0x943a('0x41')][_0x943a('0x4a')]){_0xdae9e0[_0x943a('0x4b')]=_['merge'](_0xdae9e0['where'],{'$or':_['map'](_0xdae9e0[_0x943a('0x43')],function(_0x11d16f){var _0x2ea26b={};_0x2ea26b[_0x11d16f]={'$like':'%'+_0x1e7426[_0x943a('0x41')][_0x943a('0x4a')]+'%'};return _0x2ea26b;})});}_0xdae9e0=_[_0x943a('0x5a')]({},_0xdae9e0,_0x1e7426[_0x943a('0x4d')]);return _0x18f38f[_0x943a('0x57')](_0xdae9e0);}})[_0x943a('0x20')](function(_0x153f64){if(_0x153f64){_0x580312=_0x153f64[_0x943a('0x46')];if(!_0x1e7426[_0x943a('0x41')][_0x943a('0x5b')](_0x943a('0x47'))){_0xdae9e0[_0x943a('0x31')]=qs[_0x943a('0x31')](_0x1e7426['query'][_0x943a('0x31')]);_0xdae9e0[_0x943a('0x30')]=qs['offset'](_0x1e7426[_0x943a('0x41')][_0x943a('0x30')]);}return _0x18f38f['getFields'](_0xdae9e0);}})[_0x943a('0x20')](function(_0x4c98c3){if(_0x4c98c3){return _0x4c98c3?{'count':_0x580312,'rows':_0x4c98c3}:null;}})[_0x943a('0x20')](respondWithResult(_0x16e674,null))['catch'](handleError(_0x16e674,null));};exports[_0x943a('0x5c')]=function(_0x162e71,_0x1e95dc,_0x276730){var _0x4498f9={};var _0x4ba3cc={};var _0x454554;var _0x3a9536;return db[_0x943a('0x3d')][_0x943a('0x5d')]({'where':{'id':_0x162e71[_0x943a('0x52')]['id']}})['then'](handleEntityNotFound(_0x1e95dc,null))[_0x943a('0x20')](function(_0x31efef){if(_0x31efef){_0x454554=_0x31efef;_0x4ba3cc[_0x943a('0x40')]=_[_0x943a('0x53')](db[_0x943a('0x58')][_0x943a('0x3e')]);_0x4ba3cc[_0x943a('0x41')]=_[_0x943a('0x53')](_0x162e71[_0x943a('0x41')]);_0x4ba3cc['filters']=_['intersection'](_0x4ba3cc['model'],_0x4ba3cc[_0x943a('0x41')]);_0x4498f9[_0x943a('0x43')]=_[_0x943a('0x44')](_0x4ba3cc[_0x943a('0x40')],qs[_0x943a('0x45')](_0x162e71[_0x943a('0x41')][_0x943a('0x45')]));_0x4498f9[_0x943a('0x43')]=_0x4498f9[_0x943a('0x43')][_0x943a('0x46')]?_0x4498f9[_0x943a('0x43')]:_0x4ba3cc['model'];_0x4498f9[_0x943a('0x59')]=qs['sort'](_0x162e71[_0x943a('0x41')][_0x943a('0x48')]);_0x4498f9[_0x943a('0x4b')]=qs[_0x943a('0x42')](_[_0x943a('0x49')](_0x162e71[_0x943a('0x41')],_0x4ba3cc[_0x943a('0x42')]));if(_0x162e71['query'][_0x943a('0x4a')]){_0x4498f9['where']=_[_0x943a('0x5a')](_0x4498f9[_0x943a('0x4b')],{'$or':_[_0x943a('0x4c')](_0x4498f9[_0x943a('0x43')],function(_0x64678){var _0x2db6b3={};_0x2db6b3[_0x64678]={'$like':'%'+_0x162e71[_0x943a('0x41')][_0x943a('0x4a')]+'%'};return _0x2db6b3;})});}_0x4498f9=_['merge']({},_0x4498f9,_0x162e71['options']);return _0x454554[_0x943a('0x5c')](_0x4498f9);}})['then'](function(_0x5943f6){if(_0x5943f6){_0x3a9536=_0x5943f6[_0x943a('0x46')];if(!_0x162e71[_0x943a('0x41')][_0x943a('0x5b')](_0x943a('0x47'))){_0x4498f9[_0x943a('0x31')]=qs[_0x943a('0x31')](_0x162e71[_0x943a('0x41')][_0x943a('0x31')]);_0x4498f9['offset']=qs[_0x943a('0x30')](_0x162e71['query'][_0x943a('0x30')]);}return _0x454554[_0x943a('0x5c')](_0x4498f9);}})[_0x943a('0x20')](function(_0x41aa5a){if(_0x41aa5a){return _0x41aa5a?{'count':_0x3a9536,'rows':_0x41aa5a}:null;}})[_0x943a('0x20')](respondWithResult(_0x1e95dc,null))[_0x943a('0x2b')](handleError(_0x1e95dc,null));};exports[_0x943a('0x5e')]=function(_0x5542e1,_0x11a47a,_0x54ad0e){var _0x106a45={};var _0x3fc5b0={};var _0x111f96;var _0x165104;return db[_0x943a('0x3d')]['findOne']({'where':{'id':_0x5542e1[_0x943a('0x52')]['id']}})['then'](handleEntityNotFound(_0x11a47a,null))[_0x943a('0x20')](function(_0x388dcd){if(_0x388dcd){_0x111f96=_0x388dcd;_0x3fc5b0[_0x943a('0x40')]=_['keys'](db[_0x943a('0x58')][_0x943a('0x3e')]);_0x3fc5b0[_0x943a('0x41')]=_['keys'](_0x5542e1[_0x943a('0x41')]);_0x3fc5b0[_0x943a('0x42')]=_['intersection'](_0x3fc5b0[_0x943a('0x40')],_0x3fc5b0[_0x943a('0x41')]);_0x106a45[_0x943a('0x43')]=_[_0x943a('0x44')](_0x3fc5b0[_0x943a('0x40')],qs['fields'](_0x5542e1[_0x943a('0x41')][_0x943a('0x45')]));_0x106a45[_0x943a('0x43')]=_0x106a45[_0x943a('0x43')][_0x943a('0x46')]?_0x106a45['attributes']:_0x3fc5b0['model'];_0x106a45[_0x943a('0x59')]=qs[_0x943a('0x48')](_0x5542e1[_0x943a('0x41')][_0x943a('0x48')]);_0x106a45[_0x943a('0x4b')]=qs[_0x943a('0x42')](_[_0x943a('0x49')](_0x5542e1['query'],_0x3fc5b0[_0x943a('0x42')]));if(_0x5542e1[_0x943a('0x41')]['filter']){_0x106a45[_0x943a('0x4b')]=_['merge'](_0x106a45[_0x943a('0x4b')],{'$or':_['map'](_0x106a45[_0x943a('0x43')],function(_0x52b7e2){var _0x37ca24={};_0x37ca24[_0x52b7e2]={'$like':'%'+_0x5542e1[_0x943a('0x41')][_0x943a('0x4a')]+'%'};return _0x37ca24;})});}_0x106a45=_[_0x943a('0x5a')]({},_0x106a45,_0x5542e1[_0x943a('0x4d')]);return _0x111f96[_0x943a('0x5e')](_0x106a45);}})[_0x943a('0x20')](function(_0x3fcdb1){if(_0x3fcdb1){_0x165104=_0x3fcdb1[_0x943a('0x46')];if(!_0x5542e1[_0x943a('0x41')]['hasOwnProperty'](_0x943a('0x47'))){_0x106a45['limit']=qs['limit'](_0x5542e1[_0x943a('0x41')]['limit']);_0x106a45[_0x943a('0x30')]=qs['offset'](_0x5542e1[_0x943a('0x41')][_0x943a('0x30')]);}return _0x111f96['getDescriptions'](_0x106a45);}})[_0x943a('0x20')](function(_0x2d066f){if(_0x2d066f){return _0x2d066f?{'count':_0x165104,'rows':_0x2d066f}:null;}})['then'](respondWithResult(_0x11a47a,null))['catch'](handleError(_0x11a47a,null));};exports[_0x943a('0x5f')]=function(_0x105422,_0x48e694,_0x5caad6){var _0x5b4df1={};var _0x46a503={};var _0x156bbc;var _0xe4c33c;return db[_0x943a('0x3d')][_0x943a('0x5d')]({'where':{'id':_0x105422[_0x943a('0x52')]['id']}})[_0x943a('0x20')](handleEntityNotFound(_0x48e694,null))[_0x943a('0x20')](function(_0x1df7c6){if(_0x1df7c6){_0x156bbc=_0x1df7c6;_0x46a503[_0x943a('0x40')]=_[_0x943a('0x53')](db[_0x943a('0x60')][_0x943a('0x3e')]);_0x46a503[_0x943a('0x41')]=_[_0x943a('0x53')](_0x105422[_0x943a('0x41')]);_0x46a503['filters']=_['intersection'](_0x46a503[_0x943a('0x40')],_0x46a503[_0x943a('0x41')]);_0x5b4df1[_0x943a('0x43')]=_[_0x943a('0x44')](_0x46a503[_0x943a('0x40')],qs[_0x943a('0x45')](_0x105422[_0x943a('0x41')][_0x943a('0x45')]));_0x5b4df1[_0x943a('0x43')]=_0x5b4df1[_0x943a('0x43')][_0x943a('0x46')]?_0x5b4df1[_0x943a('0x43')]:_0x46a503[_0x943a('0x40')];_0x5b4df1[_0x943a('0x59')]=qs[_0x943a('0x48')](_0x105422[_0x943a('0x41')][_0x943a('0x48')]);_0x5b4df1[_0x943a('0x4b')]=qs[_0x943a('0x42')](_[_0x943a('0x49')](_0x105422[_0x943a('0x41')],_0x46a503[_0x943a('0x42')]));if(_0x105422[_0x943a('0x41')]['filter']){_0x5b4df1[_0x943a('0x4b')]=_[_0x943a('0x5a')](_0x5b4df1[_0x943a('0x4b')],{'$or':_['map'](_0x5b4df1[_0x943a('0x43')],function(_0x4048c5){var _0xd2e6a9={};_0xd2e6a9[_0x4048c5]={'$like':'%'+_0x105422[_0x943a('0x41')]['filter']+'%'};return _0xd2e6a9;})});}_0x5b4df1=_[_0x943a('0x5a')]({},_0x5b4df1,_0x105422[_0x943a('0x4d')]);return _0x156bbc['getTags'](_0x5b4df1);}})[_0x943a('0x20')](function(_0x380943){if(_0x380943){_0xe4c33c=_0x380943[_0x943a('0x46')];if(!_0x105422[_0x943a('0x41')][_0x943a('0x5b')](_0x943a('0x47'))){_0x5b4df1[_0x943a('0x31')]=qs[_0x943a('0x31')](_0x105422[_0x943a('0x41')][_0x943a('0x31')]);_0x5b4df1[_0x943a('0x30')]=qs['offset'](_0x105422[_0x943a('0x41')][_0x943a('0x30')]);}return _0x156bbc[_0x943a('0x5f')](_0x5b4df1);}})[_0x943a('0x20')](function(_0xa91d8d){if(_0xa91d8d){return _0xa91d8d?{'count':_0xe4c33c,'rows':_0xa91d8d}:null;}})[_0x943a('0x20')](respondWithResult(_0x48e694,null))['catch'](handleError(_0x48e694,null));};exports[_0x943a('0x61')]=function(_0x240cef,_0x188ab2,_0x2f9d91){if(_0x240cef[_0x943a('0x56')]['id']){delete _0x240cef[_0x943a('0x56')]['id'];}return db[_0x943a('0x3d')][_0x943a('0x5d')]({'where':{'id':_0x240cef[_0x943a('0x52')]['id']}})['then'](handleEntityNotFound(_0x188ab2,null))[_0x943a('0x20')](function(_0xc95df6){if(_0xc95df6){return _0xc95df6[_0x943a('0x61')](_0x240cef['body']['ids']||[]);}return null;})[_0x943a('0x20')](respondWithResult(_0x188ab2,null))['catch'](handleError(_0x188ab2,null));}; \ No newline at end of file +var _0xf218=['reject','save','update','destroy','stack','name','send','index','map','DeskConfiguration','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','rows','params','include','find','create','findOne','DeskField','pick','getFields','getSubjects','getDescriptions','getTags','Tag','setTags','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','test','ValidationError','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply'];(function(_0x1e5473,_0x44ed5d){var _0x4ead1a=function(_0x395ddc){while(--_0x395ddc){_0x1e5473['push'](_0x1e5473['shift']());}};_0x4ead1a(++_0x44ed5d);}(_0xf218,0x8d));var _0x8f21=function(_0x16fcf9,_0x5a7df9){_0x16fcf9=_0x16fcf9-0x0;var _0x34714b=_0xf218[_0x16fcf9];return _0x34714b;};'use strict';var pdf=require(_0x8f21('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x8f21('0x1'));var zipdir=require(_0x8f21('0x2'));var jsonpatch=require(_0x8f21('0x3'));var rp=require('request-promise');var moment=require(_0x8f21('0x4'));var BPromise=require(_0x8f21('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8f21('0x6'));var sox=require(_0x8f21('0x7'));var csv=require(_0x8f21('0x8'));var ejs=require(_0x8f21('0x9'));var fs=require('fs');var _=require(_0x8f21('0xa'));var squel=require('squel');var crypto=require(_0x8f21('0xb'));var jsforce=require(_0x8f21('0xc'));var deskjs=require(_0x8f21('0xd'));var toCsv=require(_0x8f21('0x8'));var querystring=require(_0x8f21('0xe'));var Papa=require(_0x8f21('0xf'));var Redis=require(_0x8f21('0x10'));var authService=require(_0x8f21('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8f21('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8f21('0x13'))(_0x8f21('0x14'));var utils=require(_0x8f21('0x15'));var config=require('../../config/environment');var db=require(_0x8f21('0x16'))['db'];var jayson=require(_0x8f21('0x17'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x4a1d18,_0x16982c,_0x3f991e){if(_0x3f991e){var _0x16cf04=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16cf04[_0x8f21('0x18')](_0x16982c)){return _0x4a1d18;}else{throw new db['Sequelize'][(_0x8f21('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 _0x4a1d18;}}function respondWithRpcPromise(_0x15079e,_0x3a2e37,_0x4d3d1b,_0x2aa261){return new BPromise(function(_0x43d978,_0x558881){var _0x10aa5e=_0x2aa261||client;return _0x10aa5e[_0x8f21('0x1a')](_0x15079e,_0x4d3d1b)[_0x8f21('0x1b')](function(_0x4973bb){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x3a2e37,_0x8f21('0x1c'));logger[_0x8f21('0x1d')](_0x8f21('0x1e'),_0x3a2e37,_0x8f21('0x1c'),JSON[_0x8f21('0x1f')](_0x4973bb));if(_0x4973bb[_0x8f21('0x20')]){if(_0x4973bb[_0x8f21('0x20')][_0x8f21('0x21')]===0x1f4){logger['error'](_0x8f21('0x22'),_0x3a2e37,_0x4973bb[_0x8f21('0x20')][_0x8f21('0x23')]);return _0x558881(_0x4973bb[_0x8f21('0x20')][_0x8f21('0x23')]);}logger[_0x8f21('0x20')](_0x8f21('0x22'),_0x3a2e37,_0x4973bb[_0x8f21('0x20')][_0x8f21('0x23')]);return _0x43d978(_0x4973bb['error'][_0x8f21('0x23')]);}else{logger[_0x8f21('0x24')](_0x8f21('0x22'),_0x3a2e37,'request\x20sent');_0x43d978(_0x4973bb[_0x8f21('0x25')][_0x8f21('0x23')]);}})[_0x8f21('0x26')](function(_0x686ca3){logger[_0x8f21('0x20')](_0x8f21('0x22'),_0x3a2e37,_0x686ca3);_0x558881(_0x686ca3);});});}function respondWithStatusCode(_0x4cd3c7,_0x9097c2){_0x9097c2=_0x9097c2||0xcc;return function(_0x4e53ed){if(_0x4e53ed){return _0x4cd3c7[_0x8f21('0x27')](_0x9097c2);}return _0x4cd3c7[_0x8f21('0x28')](_0x9097c2)[_0x8f21('0x29')]();};}function respondWithResult(_0x4e2b28,_0x2777e5){_0x2777e5=_0x2777e5||0xc8;return function(_0x1ef206){if(_0x1ef206){return _0x4e2b28['status'](_0x2777e5)[_0x8f21('0x2a')](_0x1ef206);}};}function respondWithFilteredResult(_0x2a00b2,_0x3ae456){return function(_0x12e9c5){if(_0x12e9c5){var _0x24dbc3=_0x12e9c5[_0x8f21('0x2b')],_0x1647ac=_0x3ae456[_0x8f21('0x2c')],_0x2fbb92=_0x3ae456[_0x8f21('0x2c')]+_0x3ae456[_0x8f21('0x2d')],_0x511ff2;if(_0x2fbb92>=_0x24dbc3){_0x2fbb92=_0x24dbc3;_0x511ff2=0xc8;}else{_0x511ff2=0xce;}_0x2a00b2[_0x8f21('0x28')](_0x511ff2);return _0x2a00b2[_0x8f21('0x2e')](_0x8f21('0x2f'),_0x1647ac+'-'+_0x2fbb92+'/'+_0x24dbc3)[_0x8f21('0x2a')](_0x12e9c5);}return null;};}function patchUpdates(_0x5d191a){return function(_0x131e25){try{jsonpatch[_0x8f21('0x30')](_0x131e25,_0x5d191a,!![]);}catch(_0x2321e7){return BPromise[_0x8f21('0x31')](_0x2321e7);}return _0x131e25[_0x8f21('0x32')]();};}function saveUpdates(_0x51c974,_0x239013){return function(_0x904dad){if(_0x904dad){return _0x904dad[_0x8f21('0x33')](_0x51c974)[_0x8f21('0x1b')](function(_0x55c348){return _0x55c348;});}return null;};}function removeEntity(_0x446526,_0x33ddb0){return function(_0x8ab88a){if(_0x8ab88a){return _0x8ab88a[_0x8f21('0x34')]()['then'](function(){_0x446526[_0x8f21('0x28')](0xcc)[_0x8f21('0x29')]();});}};}function handleEntityNotFound(_0x2dc56e,_0x794f8a){return function(_0x4e28de){if(!_0x4e28de){_0x2dc56e[_0x8f21('0x27')](0x194);}return _0x4e28de;};}function handleError(_0x39ee34,_0x41d01c){_0x41d01c=_0x41d01c||0x1f4;return function(_0x3563a3){logger[_0x8f21('0x20')](_0x3563a3[_0x8f21('0x35')]);if(_0x3563a3[_0x8f21('0x36')]){delete _0x3563a3[_0x8f21('0x36')];}_0x39ee34['status'](_0x41d01c)[_0x8f21('0x37')](_0x3563a3);};}exports[_0x8f21('0x38')]=function(_0xa539d5,_0x11454c){var _0x2cbabe={},_0x870c26={},_0x3311d8={'count':0x0,'rows':[]};var _0xdb84dd=_[_0x8f21('0x39')](db[_0x8f21('0x3a')][_0x8f21('0x3b')],function(_0x5e4bae){return{'name':_0x5e4bae['fieldName'],'type':_0x5e4bae[_0x8f21('0x3c')]['key']};});_0x870c26[_0x8f21('0x3d')]=_[_0x8f21('0x39')](_0xdb84dd,_0x8f21('0x36'));_0x870c26[_0x8f21('0x3e')]=_[_0x8f21('0x3f')](_0xa539d5[_0x8f21('0x3e')]);_0x870c26[_0x8f21('0x40')]=_[_0x8f21('0x41')](_0x870c26[_0x8f21('0x3d')],_0x870c26[_0x8f21('0x3e')]);_0x2cbabe[_0x8f21('0x42')]=_[_0x8f21('0x41')](_0x870c26[_0x8f21('0x3d')],qs[_0x8f21('0x43')](_0xa539d5['query'][_0x8f21('0x43')]));_0x2cbabe[_0x8f21('0x42')]=_0x2cbabe[_0x8f21('0x42')][_0x8f21('0x44')]?_0x2cbabe[_0x8f21('0x42')]:_0x870c26[_0x8f21('0x3d')];if(!_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x45')](_0x8f21('0x46'))){_0x2cbabe['limit']=qs[_0x8f21('0x2d')](_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x2d')]);_0x2cbabe[_0x8f21('0x2c')]=qs[_0x8f21('0x2c')](_0xa539d5['query'][_0x8f21('0x2c')]);}_0x2cbabe[_0x8f21('0x47')]=qs['sort'](_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x48')]);_0x2cbabe[_0x8f21('0x49')]=qs[_0x8f21('0x40')](_['pick'](_0xa539d5['query'],_0x870c26[_0x8f21('0x40')]));if(_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x4a')]){_0x2cbabe[_0x8f21('0x49')]=_[_0x8f21('0x4b')](_0x2cbabe[_0x8f21('0x49')],{'$or':_[_0x8f21('0x39')](_0xdb84dd,function(_0x38b4fc){if(_0x38b4fc[_0x8f21('0x3c')]!==_0x8f21('0x4c')){var _0x378eb5={};_0x378eb5[_0x38b4fc[_0x8f21('0x36')]]={'$like':'%'+_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x4a')]+'%'};return _0x378eb5;}})});}_0x2cbabe=_[_0x8f21('0x4b')]({},_0x2cbabe,_0xa539d5[_0x8f21('0x4d')]);var _0x21803f={'where':_0x2cbabe['where']};return db[_0x8f21('0x3a')][_0x8f21('0x2b')](_0x21803f)['then'](function(_0x22d77d){_0x3311d8[_0x8f21('0x2b')]=_0x22d77d;if(_0xa539d5[_0x8f21('0x3e')][_0x8f21('0x4e')]){_0x2cbabe['include']=[{'all':!![]}];}return db['DeskConfiguration'][_0x8f21('0x4f')](_0x2cbabe);})['then'](function(_0x20a045){_0x3311d8[_0x8f21('0x50')]=_0x20a045;return _0x3311d8;})['then'](respondWithFilteredResult(_0x11454c,_0x2cbabe))[_0x8f21('0x26')](handleError(_0x11454c,null));};exports['show']=function(_0x29f3ce,_0x111586){var _0x3745d8={'raw':![],'where':{'id':_0x29f3ce[_0x8f21('0x51')]['id']}},_0x5c2e50={};_0x5c2e50[_0x8f21('0x3d')]=_[_0x8f21('0x3f')](db['DeskConfiguration'][_0x8f21('0x3b')]);_0x5c2e50[_0x8f21('0x3e')]=_[_0x8f21('0x3f')](_0x29f3ce['query']);_0x5c2e50[_0x8f21('0x40')]=_[_0x8f21('0x41')](_0x5c2e50['model'],_0x5c2e50['query']);_0x3745d8[_0x8f21('0x42')]=_['intersection'](_0x5c2e50[_0x8f21('0x3d')],qs[_0x8f21('0x43')](_0x29f3ce[_0x8f21('0x3e')][_0x8f21('0x43')]));_0x3745d8[_0x8f21('0x42')]=_0x3745d8[_0x8f21('0x42')]['length']?_0x3745d8[_0x8f21('0x42')]:_0x5c2e50[_0x8f21('0x3d')];if(_0x29f3ce[_0x8f21('0x3e')][_0x8f21('0x4e')]){_0x3745d8[_0x8f21('0x52')]=[{'all':!![]}];}_0x3745d8=_[_0x8f21('0x4b')]({},_0x3745d8,_0x29f3ce[_0x8f21('0x4d')]);return db[_0x8f21('0x3a')][_0x8f21('0x53')](_0x3745d8)[_0x8f21('0x1b')](handleEntityNotFound(_0x111586,null))[_0x8f21('0x1b')](respondWithResult(_0x111586,null))[_0x8f21('0x26')](handleError(_0x111586,null));};exports[_0x8f21('0x54')]=function(_0x1b199b,_0x3566a1){return db[_0x8f21('0x3a')][_0x8f21('0x54')](_0x1b199b['body'],{})[_0x8f21('0x1b')](respondWithResult(_0x3566a1,0xc9))[_0x8f21('0x26')](handleError(_0x3566a1,null));};exports[_0x8f21('0x33')]=function(_0x438062,_0x2cff6b){if(_0x438062['body']['id']){delete _0x438062['body']['id'];}return db[_0x8f21('0x3a')][_0x8f21('0x53')]({'where':{'id':_0x438062['params']['id']}})['then'](handleEntityNotFound(_0x2cff6b,null))['then'](saveUpdates(_0x438062['body'],null))[_0x8f21('0x1b')](respondWithResult(_0x2cff6b,null))[_0x8f21('0x26')](handleError(_0x2cff6b,null));};exports[_0x8f21('0x34')]=function(_0x265049,_0xfa173){return db[_0x8f21('0x3a')][_0x8f21('0x53')]({'where':{'id':_0x265049['params']['id']}})[_0x8f21('0x1b')](handleEntityNotFound(_0xfa173,null))['then'](removeEntity(_0xfa173,null))[_0x8f21('0x26')](handleError(_0xfa173,null));};exports['getFields']=function(_0x3e4940,_0x4093a8,_0x34d1e8){var _0x39ee86={};var _0x140ca7={};var _0x52dcf2;var _0x50615b;return db[_0x8f21('0x3a')][_0x8f21('0x55')]({'where':{'id':_0x3e4940[_0x8f21('0x51')]['id']}})['then'](handleEntityNotFound(_0x4093a8,null))[_0x8f21('0x1b')](function(_0xe07875){if(_0xe07875){_0x52dcf2=_0xe07875;_0x140ca7[_0x8f21('0x3d')]=_[_0x8f21('0x3f')](db[_0x8f21('0x56')][_0x8f21('0x3b')]);_0x140ca7[_0x8f21('0x3e')]=_[_0x8f21('0x3f')](_0x3e4940[_0x8f21('0x3e')]);_0x140ca7[_0x8f21('0x40')]=_[_0x8f21('0x41')](_0x140ca7['model'],_0x140ca7[_0x8f21('0x3e')]);_0x39ee86[_0x8f21('0x42')]=_['intersection'](_0x140ca7[_0x8f21('0x3d')],qs[_0x8f21('0x43')](_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x43')]));_0x39ee86[_0x8f21('0x42')]=_0x39ee86['attributes'][_0x8f21('0x44')]?_0x39ee86[_0x8f21('0x42')]:_0x140ca7[_0x8f21('0x3d')];_0x39ee86['order']=qs[_0x8f21('0x48')](_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x48')]);_0x39ee86[_0x8f21('0x49')]=qs[_0x8f21('0x40')](_[_0x8f21('0x57')](_0x3e4940[_0x8f21('0x3e')],_0x140ca7[_0x8f21('0x40')]));if(_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x4a')]){_0x39ee86[_0x8f21('0x49')]=_[_0x8f21('0x4b')](_0x39ee86[_0x8f21('0x49')],{'$or':_['map'](_0x39ee86[_0x8f21('0x42')],function(_0x230994){var _0x1aafe7={};_0x1aafe7[_0x230994]={'$like':'%'+_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x4a')]+'%'};return _0x1aafe7;})});}_0x39ee86=_[_0x8f21('0x4b')]({},_0x39ee86,_0x3e4940[_0x8f21('0x4d')]);return _0x52dcf2[_0x8f21('0x58')](_0x39ee86);}})[_0x8f21('0x1b')](function(_0x536fd0){if(_0x536fd0){_0x50615b=_0x536fd0['length'];if(!_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x45')]('nolimit')){_0x39ee86['limit']=qs[_0x8f21('0x2d')](_0x3e4940['query']['limit']);_0x39ee86[_0x8f21('0x2c')]=qs[_0x8f21('0x2c')](_0x3e4940[_0x8f21('0x3e')][_0x8f21('0x2c')]);}return _0x52dcf2[_0x8f21('0x58')](_0x39ee86);}})[_0x8f21('0x1b')](function(_0x2908c6){if(_0x2908c6){return _0x2908c6?{'count':_0x50615b,'rows':_0x2908c6}:null;}})['then'](respondWithResult(_0x4093a8,null))['catch'](handleError(_0x4093a8,null));};exports[_0x8f21('0x59')]=function(_0x3a7845,_0x42fddf,_0x2535b1){var _0x12478b={};var _0x594d74={};var _0x366abe;var _0x83f452;return db[_0x8f21('0x3a')][_0x8f21('0x55')]({'where':{'id':_0x3a7845[_0x8f21('0x51')]['id']}})[_0x8f21('0x1b')](handleEntityNotFound(_0x42fddf,null))[_0x8f21('0x1b')](function(_0xcceef6){if(_0xcceef6){_0x366abe=_0xcceef6;_0x594d74[_0x8f21('0x3d')]=_[_0x8f21('0x3f')](db[_0x8f21('0x56')][_0x8f21('0x3b')]);_0x594d74[_0x8f21('0x3e')]=_[_0x8f21('0x3f')](_0x3a7845['query']);_0x594d74[_0x8f21('0x40')]=_['intersection'](_0x594d74[_0x8f21('0x3d')],_0x594d74[_0x8f21('0x3e')]);_0x12478b[_0x8f21('0x42')]=_['intersection'](_0x594d74[_0x8f21('0x3d')],qs[_0x8f21('0x43')](_0x3a7845[_0x8f21('0x3e')][_0x8f21('0x43')]));_0x12478b[_0x8f21('0x42')]=_0x12478b[_0x8f21('0x42')][_0x8f21('0x44')]?_0x12478b[_0x8f21('0x42')]:_0x594d74['model'];_0x12478b[_0x8f21('0x47')]=qs[_0x8f21('0x48')](_0x3a7845['query'][_0x8f21('0x48')]);_0x12478b[_0x8f21('0x49')]=qs[_0x8f21('0x40')](_[_0x8f21('0x57')](_0x3a7845[_0x8f21('0x3e')],_0x594d74[_0x8f21('0x40')]));if(_0x3a7845[_0x8f21('0x3e')]['filter']){_0x12478b[_0x8f21('0x49')]=_[_0x8f21('0x4b')](_0x12478b[_0x8f21('0x49')],{'$or':_['map'](_0x12478b[_0x8f21('0x42')],function(_0x28d56b){var _0xfa5b9a={};_0xfa5b9a[_0x28d56b]={'$like':'%'+_0x3a7845[_0x8f21('0x3e')][_0x8f21('0x4a')]+'%'};return _0xfa5b9a;})});}_0x12478b=_[_0x8f21('0x4b')]({},_0x12478b,_0x3a7845[_0x8f21('0x4d')]);return _0x366abe[_0x8f21('0x59')](_0x12478b);}})[_0x8f21('0x1b')](function(_0x1e0166){if(_0x1e0166){_0x83f452=_0x1e0166[_0x8f21('0x44')];if(!_0x3a7845[_0x8f21('0x3e')][_0x8f21('0x45')]('nolimit')){_0x12478b['limit']=qs[_0x8f21('0x2d')](_0x3a7845[_0x8f21('0x3e')][_0x8f21('0x2d')]);_0x12478b[_0x8f21('0x2c')]=qs['offset'](_0x3a7845['query'][_0x8f21('0x2c')]);}return _0x366abe['getSubjects'](_0x12478b);}})[_0x8f21('0x1b')](function(_0x2342a7){if(_0x2342a7){return _0x2342a7?{'count':_0x83f452,'rows':_0x2342a7}:null;}})[_0x8f21('0x1b')](respondWithResult(_0x42fddf,null))[_0x8f21('0x26')](handleError(_0x42fddf,null));};exports[_0x8f21('0x5a')]=function(_0x50d642,_0x47ed16,_0x1db969){var _0x52e288={};var _0x4b9bb7={};var _0x311765;var _0x37aa8b;return db[_0x8f21('0x3a')][_0x8f21('0x55')]({'where':{'id':_0x50d642['params']['id']}})[_0x8f21('0x1b')](handleEntityNotFound(_0x47ed16,null))[_0x8f21('0x1b')](function(_0x528803){if(_0x528803){_0x311765=_0x528803;_0x4b9bb7[_0x8f21('0x3d')]=_['keys'](db['DeskField']['rawAttributes']);_0x4b9bb7['query']=_[_0x8f21('0x3f')](_0x50d642['query']);_0x4b9bb7[_0x8f21('0x40')]=_[_0x8f21('0x41')](_0x4b9bb7[_0x8f21('0x3d')],_0x4b9bb7[_0x8f21('0x3e')]);_0x52e288[_0x8f21('0x42')]=_['intersection'](_0x4b9bb7[_0x8f21('0x3d')],qs[_0x8f21('0x43')](_0x50d642[_0x8f21('0x3e')]['fields']));_0x52e288[_0x8f21('0x42')]=_0x52e288[_0x8f21('0x42')][_0x8f21('0x44')]?_0x52e288[_0x8f21('0x42')]:_0x4b9bb7[_0x8f21('0x3d')];_0x52e288['order']=qs[_0x8f21('0x48')](_0x50d642[_0x8f21('0x3e')][_0x8f21('0x48')]);_0x52e288[_0x8f21('0x49')]=qs['filters'](_[_0x8f21('0x57')](_0x50d642['query'],_0x4b9bb7['filters']));if(_0x50d642['query'][_0x8f21('0x4a')]){_0x52e288['where']=_[_0x8f21('0x4b')](_0x52e288[_0x8f21('0x49')],{'$or':_['map'](_0x52e288[_0x8f21('0x42')],function(_0x22cb8d){var _0x1b820b={};_0x1b820b[_0x22cb8d]={'$like':'%'+_0x50d642[_0x8f21('0x3e')][_0x8f21('0x4a')]+'%'};return _0x1b820b;})});}_0x52e288=_['merge']({},_0x52e288,_0x50d642[_0x8f21('0x4d')]);return _0x311765[_0x8f21('0x5a')](_0x52e288);}})[_0x8f21('0x1b')](function(_0x9b9f7d){if(_0x9b9f7d){_0x37aa8b=_0x9b9f7d['length'];if(!_0x50d642[_0x8f21('0x3e')][_0x8f21('0x45')](_0x8f21('0x46'))){_0x52e288['limit']=qs[_0x8f21('0x2d')](_0x50d642[_0x8f21('0x3e')][_0x8f21('0x2d')]);_0x52e288[_0x8f21('0x2c')]=qs['offset'](_0x50d642['query']['offset']);}return _0x311765[_0x8f21('0x5a')](_0x52e288);}})[_0x8f21('0x1b')](function(_0x150cb0){if(_0x150cb0){return _0x150cb0?{'count':_0x37aa8b,'rows':_0x150cb0}:null;}})[_0x8f21('0x1b')](respondWithResult(_0x47ed16,null))[_0x8f21('0x26')](handleError(_0x47ed16,null));};exports[_0x8f21('0x5b')]=function(_0x506163,_0x536e6b,_0x50cf2b){var _0x18fc26={};var _0x41bd12={};var _0x40f183;var _0x4b3de4;return db['DeskConfiguration'][_0x8f21('0x55')]({'where':{'id':_0x506163[_0x8f21('0x51')]['id']}})[_0x8f21('0x1b')](handleEntityNotFound(_0x536e6b,null))['then'](function(_0x52cc69){if(_0x52cc69){_0x40f183=_0x52cc69;_0x41bd12['model']=_[_0x8f21('0x3f')](db[_0x8f21('0x5c')]['rawAttributes']);_0x41bd12[_0x8f21('0x3e')]=_['keys'](_0x506163[_0x8f21('0x3e')]);_0x41bd12['filters']=_[_0x8f21('0x41')](_0x41bd12[_0x8f21('0x3d')],_0x41bd12[_0x8f21('0x3e')]);_0x18fc26[_0x8f21('0x42')]=_[_0x8f21('0x41')](_0x41bd12['model'],qs[_0x8f21('0x43')](_0x506163['query'][_0x8f21('0x43')]));_0x18fc26['attributes']=_0x18fc26[_0x8f21('0x42')][_0x8f21('0x44')]?_0x18fc26[_0x8f21('0x42')]:_0x41bd12['model'];_0x18fc26[_0x8f21('0x47')]=qs['sort'](_0x506163[_0x8f21('0x3e')][_0x8f21('0x48')]);_0x18fc26[_0x8f21('0x49')]=qs[_0x8f21('0x40')](_[_0x8f21('0x57')](_0x506163['query'],_0x41bd12[_0x8f21('0x40')]));if(_0x506163['query'][_0x8f21('0x4a')]){_0x18fc26[_0x8f21('0x49')]=_[_0x8f21('0x4b')](_0x18fc26[_0x8f21('0x49')],{'$or':_['map'](_0x18fc26['attributes'],function(_0x3d12f2){var _0x4f235c={};_0x4f235c[_0x3d12f2]={'$like':'%'+_0x506163['query'][_0x8f21('0x4a')]+'%'};return _0x4f235c;})});}_0x18fc26=_[_0x8f21('0x4b')]({},_0x18fc26,_0x506163['options']);return _0x40f183[_0x8f21('0x5b')](_0x18fc26);}})[_0x8f21('0x1b')](function(_0x29881d){if(_0x29881d){_0x4b3de4=_0x29881d['length'];if(!_0x506163[_0x8f21('0x3e')][_0x8f21('0x45')](_0x8f21('0x46'))){_0x18fc26['limit']=qs['limit'](_0x506163[_0x8f21('0x3e')][_0x8f21('0x2d')]);_0x18fc26[_0x8f21('0x2c')]=qs[_0x8f21('0x2c')](_0x506163['query'][_0x8f21('0x2c')]);}return _0x40f183['getTags'](_0x18fc26);}})[_0x8f21('0x1b')](function(_0x22b50f){if(_0x22b50f){return _0x22b50f?{'count':_0x4b3de4,'rows':_0x22b50f}:null;}})['then'](respondWithResult(_0x536e6b,null))[_0x8f21('0x26')](handleError(_0x536e6b,null));};exports[_0x8f21('0x5d')]=function(_0xb8c896,_0x3d9dde,_0xc806fa){if(_0xb8c896[_0x8f21('0x5e')]['id']){delete _0xb8c896['body']['id'];}return db[_0x8f21('0x3a')][_0x8f21('0x55')]({'where':{'id':_0xb8c896['params']['id']}})[_0x8f21('0x1b')](handleEntityNotFound(_0x3d9dde,null))[_0x8f21('0x1b')](function(_0x4d6357){if(_0x4d6357){return _0x4d6357['setTags'](_0xb8c896[_0x8f21('0x5e')]['ids']||[]);}return null;})[_0x8f21('0x1b')](respondWithResult(_0x3d9dde,null))[_0x8f21('0x26')](handleError(_0x3d9dde,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index a1ab36b..0a8c5d5 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 _0x7c62=['rimraf','../../config/environment','./intDeskConfiguration.attributes','lodash','util','api','moment','request-promise','path'];(function(_0x3d6d4e,_0x44be00){var _0xa6f07c=function(_0x3a9df1){while(--_0x3a9df1){_0x3d6d4e['push'](_0x3d6d4e['shift']());}};_0xa6f07c(++_0x44be00);}(_0x7c62,0x108));var _0x27c6=function(_0x2321f6,_0x11ce8c){_0x2321f6=_0x2321f6-0x0;var _0x279b7e=_0x7c62[_0x2321f6];return _0x279b7e;};'use strict';var _=require(_0x27c6('0x0'));var util=require(_0x27c6('0x1'));var logger=require('../../config/logger')(_0x27c6('0x2'));var moment=require(_0x27c6('0x3'));var BPromise=require('bluebird');var rp=require(_0x27c6('0x4'));var fs=require('fs');var path=require(_0x27c6('0x5'));var rimraf=require(_0x27c6('0x6'));var config=require(_0x27c6('0x7'));var attributes=require(_0x27c6('0x8'));module['exports']=function(_0xbac69a,_0x3b36da){return _0xbac69a['define']('DeskConfiguration',attributes,{'tableName':'int_desk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf6a9=['DeskConfiguration','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDeskConfiguration.attributes','exports','define'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf6a9,0x1d5));var _0x9f6a=function(_0x3c63f5,_0x172a30){_0x3c63f5=_0x3c63f5-0x0;var _0xaf7055=_0xf6a9[_0x3c63f5];return _0xaf7055;};'use strict';var _=require(_0x9f6a('0x0'));var util=require(_0x9f6a('0x1'));var logger=require('../../config/logger')(_0x9f6a('0x2'));var moment=require(_0x9f6a('0x3'));var BPromise=require(_0x9f6a('0x4'));var rp=require(_0x9f6a('0x5'));var fs=require('fs');var path=require(_0x9f6a('0x6'));var rimraf=require(_0x9f6a('0x7'));var config=require('../../config/environment');var attributes=require(_0x9f6a('0x8'));module[_0x9f6a('0x9')]=function(_0x4f6daf,_0x265683){return _0x4f6daf[_0x9f6a('0xa')](_0x9f6a('0xb'),attributes,{'tableName':'int_desk_configurations','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 f77e5ee..8df2919 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 _0x949d=['../../config/environment','client','http','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc'];(function(_0x307ee9,_0x145e8b){var _0x2b3fbe=function(_0x30f0e0){while(--_0x30f0e0){_0x307ee9['push'](_0x307ee9['shift']());}};_0x2b3fbe(++_0x145e8b);}(_0x949d,0x162));var _0xd949=function(_0x336402,_0x354cf4){_0x336402=_0x336402-0x0;var _0x4840a9=_0x949d[_0x336402];return _0x4840a9;};'use strict';var _=require(_0xd949('0x0'));var util=require(_0xd949('0x1'));var moment=require(_0xd949('0x2'));var BPromise=require(_0xd949('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd949('0x4'))['db'];var utils=require(_0xd949('0x5'));var logger=require('../../config/logger')(_0xd949('0x6'));var config=require(_0xd949('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xd949('0x8')][_0xd949('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6e8175,_0x5e90f2,_0x208942){return new BPromise(function(_0x158cc2,_0x49b70a){return client['request'](_0x6e8175,_0x208942)[_0xd949('0xa')](function(_0x1bbff8){logger[_0xd949('0xb')](_0xd949('0xc'),_0x5e90f2,_0xd949('0xd'));logger['debug']('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x5e90f2,_0xd949('0xd'),JSON[_0xd949('0xe')](_0x1bbff8));if(_0x1bbff8[_0xd949('0xf')]){if(_0x1bbff8[_0xd949('0xf')]['code']===0x1f4){logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);return _0x49b70a(_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);}logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0x1bbff8['error'][_0xd949('0x10')]);return _0x158cc2(_0x1bbff8[_0xd949('0xf')][_0xd949('0x10')]);}else{logger[_0xd949('0xb')]('DeskConfiguration,\x20%s,\x20%s',_0x5e90f2,_0xd949('0xd'));_0x158cc2(_0x1bbff8[_0xd949('0x11')][_0xd949('0x10')]);}})[_0xd949('0x12')](function(_0xf5af){logger[_0xd949('0xf')](_0xd949('0xc'),_0x5e90f2,_0xf5af);_0x49b70a(_0xf5af);});});} \ No newline at end of file +var _0x2c6a=['request\x20sent','debug','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','DeskConfiguration,\x20%s,\x20%s'];(function(_0x1cb7a6,_0x27884e){var _0x9d7800=function(_0x1710c5){while(--_0x1710c5){_0x1cb7a6['push'](_0x1cb7a6['shift']());}};_0x9d7800(++_0x27884e);}(_0x2c6a,0xa7));var _0xa2c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c6a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa2c6('0x0'));var util=require(_0xa2c6('0x1'));var moment=require(_0xa2c6('0x2'));var BPromise=require(_0xa2c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa2c6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa2c6('0x5'))(_0xa2c6('0x6'));var config=require(_0xa2c6('0x7'));var jayson=require(_0xa2c6('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a9131,_0x1fa65f,_0x3d1aa0){return new BPromise(function(_0x11aa17,_0x3c2894){return client[_0xa2c6('0x9')](_0x1a9131,_0x3d1aa0)[_0xa2c6('0xa')](function(_0x4b0bdf){logger[_0xa2c6('0xb')](_0xa2c6('0xc'),_0x1fa65f,_0xa2c6('0xd'));logger[_0xa2c6('0xe')]('DeskConfiguration,\x20%s,\x20%s,\x20%s',_0x1fa65f,_0xa2c6('0xd'),JSON['stringify'](_0x4b0bdf));if(_0x4b0bdf[_0xa2c6('0xf')]){if(_0x4b0bdf[_0xa2c6('0xf')][_0xa2c6('0x10')]===0x1f4){logger[_0xa2c6('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x1fa65f,_0x4b0bdf[_0xa2c6('0xf')][_0xa2c6('0x11')]);return _0x3c2894(_0x4b0bdf[_0xa2c6('0xf')]['message']);}logger[_0xa2c6('0xf')](_0xa2c6('0xc'),_0x1fa65f,_0x4b0bdf[_0xa2c6('0xf')][_0xa2c6('0x11')]);return _0x11aa17(_0x4b0bdf[_0xa2c6('0xf')]['message']);}else{logger[_0xa2c6('0xb')](_0xa2c6('0xc'),_0x1fa65f,_0xa2c6('0xd'));_0x11aa17(_0x4b0bdf[_0xa2c6('0x12')][_0xa2c6('0x11')]);}})[_0xa2c6('0x13')](function(_0x4fd220){logger[_0xa2c6('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x1fa65f,_0x4fd220);_0x3c2894(_0x4fd220);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 7dc087a..45f88fa 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 _0x345d=['create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intDeskField.controller','get','/:id','isAuthenticated','show','post'];(function(_0x57025e,_0x1c645f){var _0xa7d5fa=function(_0x5d6799){while(--_0x5d6799){_0x57025e['push'](_0x57025e['shift']());}};_0xa7d5fa(++_0x1c645f);}(_0x345d,0x182));var _0xd345=function(_0x48a296,_0x9a3870){_0x48a296=_0x48a296-0x0;var _0x5a66d4=_0x345d[_0x48a296];return _0x5a66d4;};'use strict';var multer=require(_0xd345('0x0'));var util=require(_0xd345('0x1'));var path=require('path');var timeout=require(_0xd345('0x2'));var express=require(_0xd345('0x3'));var router=express[_0xd345('0x4')]();var auth=require(_0xd345('0x5'));var interaction=require(_0xd345('0x6'));var config=require('../../config/environment');var controller=require(_0xd345('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xd345('0x8')](_0xd345('0x9'),auth[_0xd345('0xa')](),controller[_0xd345('0xb')]);router[_0xd345('0xc')]('/',auth[_0xd345('0xa')](),controller[_0xd345('0xd')]);router[_0xd345('0xe')](_0xd345('0x9'),auth[_0xd345('0xa')](),controller[_0xd345('0xf')]);router[_0xd345('0x10')](_0xd345('0x9'),auth['isAuthenticated'](),controller[_0xd345('0x11')]);module[_0xd345('0x12')]=router; \ No newline at end of file +var _0x1227=['update','delete','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put'];(function(_0x262ccc,_0x1819b2){var _0x197054=function(_0x535584){while(--_0x535584){_0x262ccc['push'](_0x262ccc['shift']());}};_0x197054(++_0x1819b2);}(_0x1227,0x73));var _0x7122=function(_0x893302,_0x477c9f){_0x893302=_0x893302-0x0;var _0x43301f=_0x1227[_0x893302];return _0x43301f;};'use strict';var multer=require('multer');var util=require(_0x7122('0x0'));var path=require(_0x7122('0x1'));var timeout=require(_0x7122('0x2'));var express=require(_0x7122('0x3'));var router=express[_0x7122('0x4')]();var auth=require(_0x7122('0x5'));var interaction=require(_0x7122('0x6'));var config=require('../../config/environment');var controller=require('./intDeskField.controller');router['get']('/',auth[_0x7122('0x7')](),controller['index']);router[_0x7122('0x8')](_0x7122('0x9'),auth[_0x7122('0x7')](),controller[_0x7122('0xa')]);router[_0x7122('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x7122('0xc')](_0x7122('0x9'),auth[_0x7122('0x7')](),controller[_0x7122('0xd')]);router[_0x7122('0xe')](_0x7122('0x9'),auth[_0x7122('0x7')](),controller['destroy']);module[_0x7122('0xf')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 8cf70fd..2ccc810 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 _0x64f4=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x5f4400,_0xf8f000){var _0x547b3d=function(_0x19a1fe){while(--_0x19a1fe){_0x5f4400['push'](_0x5f4400['shift']());}};_0x547b3d(++_0xf8f000);}(_0x64f4,0x15f));var _0x464f=function(_0x1fa734,_0x638ecf){_0x1fa734=_0x1fa734-0x0;var _0x27b129=_0x64f4[_0x1fa734];return _0x27b129;};'use strict';var Sequelize=require(_0x464f('0x0'));module[_0x464f('0x1')]={'type':{'type':Sequelize[_0x464f('0x2')](_0x464f('0x3'),_0x464f('0x4'),_0x464f('0x5'),_0x464f('0x6')),'defaultValue':_0x464f('0x3')},'content':{'type':Sequelize[_0x464f('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x464f('0x2')](_0x464f('0x3'),_0x464f('0x4'),_0x464f('0x5'))},'keyContent':{'type':Sequelize[_0x464f('0x7')]},'idField':{'type':Sequelize[_0x464f('0x7')]},'nameField':{'type':Sequelize[_0x464f('0x7')]},'customField':{'type':Sequelize[_0x464f('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x464f('0x7')]}}; \ No newline at end of file +var _0x2091=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x9383db,_0x16ae2a){var _0x40d237=function(_0x2b8536){while(--_0x2b8536){_0x9383db['push'](_0x9383db['shift']());}};_0x40d237(++_0x16ae2a);}(_0x2091,0x85));var _0x1209=function(_0x225d44,_0x399b52){_0x225d44=_0x225d44-0x0;var _0x4aa98a=_0x2091[_0x225d44];return _0x4aa98a;};'use strict';var Sequelize=require(_0x1209('0x0'));module[_0x1209('0x1')]={'type':{'type':Sequelize[_0x1209('0x2')](_0x1209('0x3'),_0x1209('0x4'),_0x1209('0x5'),_0x1209('0x6')),'defaultValue':_0x1209('0x3')},'content':{'type':Sequelize[_0x1209('0x7')]},'key':{'type':Sequelize[_0x1209('0x7')]},'keyType':{'type':Sequelize[_0x1209('0x2')](_0x1209('0x3'),_0x1209('0x4'),_0x1209('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x1209('0x7')]},'nameField':{'type':Sequelize[_0x1209('0x7')]},'customField':{'type':Sequelize[_0x1209('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1209('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 4b8679c..952ab5c 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 _0xe132=['squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','error','name','index','map','DeskField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','count','includeAll','include','findAll','catch','params','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','lodash'];(function(_0x5c24d0,_0x2c6ded){var _0x18f479=function(_0x493bf2){while(--_0x493bf2){_0x5c24d0['push'](_0x5c24d0['shift']());}};_0x18f479(++_0x2c6ded);}(_0xe132,0x162));var _0x2e13=function(_0x5216bb,_0x516496){_0x5216bb=_0x5216bb-0x0;var _0x136e1e=_0xe132[_0x5216bb];return _0x136e1e;};'use strict';var pdf=require(_0x2e13('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x2e13('0x1'));var zipdir=require(_0x2e13('0x2'));var jsonpatch=require(_0x2e13('0x3'));var rp=require(_0x2e13('0x4'));var moment=require(_0x2e13('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2e13('0x6'));var util=require(_0x2e13('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2e13('0x8'));var ejs=require(_0x2e13('0x9'));var fs=require('fs');var _=require(_0x2e13('0xa'));var squel=require(_0x2e13('0xb'));var crypto=require(_0x2e13('0xc'));var jsforce=require(_0x2e13('0xd'));var deskjs=require(_0x2e13('0xe'));var toCsv=require(_0x2e13('0x8'));var querystring=require(_0x2e13('0xf'));var Papa=require(_0x2e13('0x10'));var Redis=require('ioredis');var authService=require(_0x2e13('0x11'));var qs=require(_0x2e13('0x12'));var as=require(_0x2e13('0x13'));var hardwareService=require(_0x2e13('0x14'));var logger=require(_0x2e13('0x15'))(_0x2e13('0x16'));var utils=require(_0x2e13('0x17'));var config=require('../../config/environment');var db=require(_0x2e13('0x18'))['db'];function respondWithStatusCode(_0x441335,_0x320303){_0x320303=_0x320303||0xcc;return function(_0x299dd3){if(_0x299dd3){return _0x441335[_0x2e13('0x19')](_0x320303);}return _0x441335[_0x2e13('0x1a')](_0x320303)[_0x2e13('0x1b')]();};}function respondWithResult(_0x51f1a3,_0xb70eb8){_0xb70eb8=_0xb70eb8||0xc8;return function(_0xea6c20){if(_0xea6c20){return _0x51f1a3[_0x2e13('0x1a')](_0xb70eb8)['json'](_0xea6c20);}};}function respondWithFilteredResult(_0x4d7fa3,_0x2a58e5){return function(_0x433bbd){if(_0x433bbd){var _0x5e96a5=_0x433bbd['count'],_0xd25628=_0x2a58e5['offset'],_0x358a0d=_0x2a58e5[_0x2e13('0x1c')]+_0x2a58e5[_0x2e13('0x1d')],_0x1667b6;if(_0x358a0d>=_0x5e96a5){_0x358a0d=_0x5e96a5;_0x1667b6=0xc8;}else{_0x1667b6=0xce;}_0x4d7fa3[_0x2e13('0x1a')](_0x1667b6);return _0x4d7fa3[_0x2e13('0x1e')](_0x2e13('0x1f'),_0xd25628+'-'+_0x358a0d+'/'+_0x5e96a5)[_0x2e13('0x20')](_0x433bbd);}return null;};}function patchUpdates(_0x2496ee){return function(_0x226254){try{jsonpatch['apply'](_0x226254,_0x2496ee,!![]);}catch(_0x26bac1){return BPromise[_0x2e13('0x21')](_0x26bac1);}return _0x226254[_0x2e13('0x22')]();};}function saveUpdates(_0x173a27,_0x479013){return function(_0x5d6938){if(_0x5d6938){return _0x5d6938[_0x2e13('0x23')](_0x173a27)[_0x2e13('0x24')](function(_0x59c180){return _0x59c180;});}return null;};}function removeEntity(_0x4c769c,_0x584040){return function(_0x30f744){if(_0x30f744){return _0x30f744[_0x2e13('0x25')]()[_0x2e13('0x24')](function(){_0x4c769c[_0x2e13('0x1a')](0xcc)[_0x2e13('0x1b')]();});}};}function handleEntityNotFound(_0x2416b3,_0x5ce58b){return function(_0x1482fc){if(!_0x1482fc){_0x2416b3[_0x2e13('0x19')](0x194);}return _0x1482fc;};}function handleError(_0x943ffb,_0x2b1b79){_0x2b1b79=_0x2b1b79||0x1f4;return function(_0x20417c){logger[_0x2e13('0x26')](_0x20417c['stack']);if(_0x20417c[_0x2e13('0x27')]){delete _0x20417c[_0x2e13('0x27')];}_0x943ffb['status'](_0x2b1b79)['send'](_0x20417c);};}exports[_0x2e13('0x28')]=function(_0x468102,_0x279d9e){var _0x5a4ff6={},_0x227ef8={},_0x4504d3={'count':0x0,'rows':[]};var _0x3838a0=_[_0x2e13('0x29')](db[_0x2e13('0x2a')][_0x2e13('0x2b')],function(_0x103867){return{'name':_0x103867[_0x2e13('0x2c')],'type':_0x103867[_0x2e13('0x2d')][_0x2e13('0x2e')]};});_0x227ef8[_0x2e13('0x2f')]=_[_0x2e13('0x29')](_0x3838a0,_0x2e13('0x27'));_0x227ef8[_0x2e13('0x30')]=_[_0x2e13('0x31')](_0x468102['query']);_0x227ef8[_0x2e13('0x32')]=_[_0x2e13('0x33')](_0x227ef8[_0x2e13('0x2f')],_0x227ef8['query']);_0x5a4ff6['attributes']=_[_0x2e13('0x33')](_0x227ef8[_0x2e13('0x2f')],qs[_0x2e13('0x34')](_0x468102[_0x2e13('0x30')][_0x2e13('0x34')]));_0x5a4ff6[_0x2e13('0x35')]=_0x5a4ff6['attributes']['length']?_0x5a4ff6[_0x2e13('0x35')]:_0x227ef8[_0x2e13('0x2f')];if(!_0x468102[_0x2e13('0x30')][_0x2e13('0x36')](_0x2e13('0x37'))){_0x5a4ff6[_0x2e13('0x1d')]=qs[_0x2e13('0x1d')](_0x468102[_0x2e13('0x30')]['limit']);_0x5a4ff6[_0x2e13('0x1c')]=qs[_0x2e13('0x1c')](_0x468102[_0x2e13('0x30')][_0x2e13('0x1c')]);}_0x5a4ff6[_0x2e13('0x38')]=qs['sort'](_0x468102[_0x2e13('0x30')][_0x2e13('0x39')]);_0x5a4ff6['where']=qs[_0x2e13('0x32')](_[_0x2e13('0x3a')](_0x468102[_0x2e13('0x30')],_0x227ef8['filters']));if(_0x468102[_0x2e13('0x30')][_0x2e13('0x3b')]){_0x5a4ff6['where']=_[_0x2e13('0x3c')](_0x5a4ff6[_0x2e13('0x3d')],{'$or':_['map'](_0x3838a0,function(_0x2d0f31){if(_0x2d0f31['type']!==_0x2e13('0x3e')){var _0x20c4e3={};_0x20c4e3[_0x2d0f31['name']]={'$like':'%'+_0x468102[_0x2e13('0x30')][_0x2e13('0x3b')]+'%'};return _0x20c4e3;}})});}_0x5a4ff6=_[_0x2e13('0x3c')]({},_0x5a4ff6,_0x468102[_0x2e13('0x3f')]);var _0x20ae95={'where':_0x5a4ff6[_0x2e13('0x3d')]};return db[_0x2e13('0x2a')][_0x2e13('0x40')](_0x20ae95)[_0x2e13('0x24')](function(_0x1cca7f){_0x4504d3['count']=_0x1cca7f;if(_0x468102[_0x2e13('0x30')][_0x2e13('0x41')]){_0x5a4ff6[_0x2e13('0x42')]=[{'all':!![]}];}return db[_0x2e13('0x2a')][_0x2e13('0x43')](_0x5a4ff6);})['then'](function(_0x37d997){_0x4504d3['rows']=_0x37d997;return _0x4504d3;})[_0x2e13('0x24')](respondWithFilteredResult(_0x279d9e,_0x5a4ff6))[_0x2e13('0x44')](handleError(_0x279d9e,null));};exports['show']=function(_0x432ec7,_0x54feeb){var _0x73f6a2={'raw':!![],'where':{'id':_0x432ec7[_0x2e13('0x45')]['id']}},_0x790564={};_0x790564[_0x2e13('0x2f')]=_[_0x2e13('0x31')](db['DeskField'][_0x2e13('0x2b')]);_0x790564['query']=_[_0x2e13('0x31')](_0x432ec7[_0x2e13('0x30')]);_0x790564[_0x2e13('0x32')]=_[_0x2e13('0x33')](_0x790564[_0x2e13('0x2f')],_0x790564[_0x2e13('0x30')]);_0x73f6a2['attributes']=_['intersection'](_0x790564[_0x2e13('0x2f')],qs[_0x2e13('0x34')](_0x432ec7['query'][_0x2e13('0x34')]));_0x73f6a2[_0x2e13('0x35')]=_0x73f6a2[_0x2e13('0x35')]['length']?_0x73f6a2['attributes']:_0x790564[_0x2e13('0x2f')];if(_0x432ec7['query']['includeAll']){_0x73f6a2[_0x2e13('0x42')]=[{'all':!![]}];}_0x73f6a2=_[_0x2e13('0x3c')]({},_0x73f6a2,_0x432ec7[_0x2e13('0x3f')]);return db['DeskField'][_0x2e13('0x46')](_0x73f6a2)[_0x2e13('0x24')](handleEntityNotFound(_0x54feeb,null))[_0x2e13('0x24')](respondWithResult(_0x54feeb,null))[_0x2e13('0x44')](handleError(_0x54feeb,null));};exports['create']=function(_0x1131bf,_0x52697e){return db[_0x2e13('0x2a')][_0x2e13('0x47')](_0x1131bf[_0x2e13('0x48')],{})[_0x2e13('0x24')](respondWithResult(_0x52697e,0xc9))[_0x2e13('0x44')](handleError(_0x52697e,null));};exports[_0x2e13('0x23')]=function(_0x961af7,_0x8e8b86){if(_0x961af7[_0x2e13('0x48')]['id']){delete _0x961af7[_0x2e13('0x48')]['id'];}return db['DeskField'][_0x2e13('0x46')]({'where':{'id':_0x961af7[_0x2e13('0x45')]['id']}})[_0x2e13('0x24')](handleEntityNotFound(_0x8e8b86,null))[_0x2e13('0x24')](saveUpdates(_0x961af7[_0x2e13('0x48')],null))[_0x2e13('0x24')](respondWithResult(_0x8e8b86,null))[_0x2e13('0x44')](handleError(_0x8e8b86,null));};exports[_0x2e13('0x25')]=function(_0x74076a,_0x28010f){return db[_0x2e13('0x2a')][_0x2e13('0x46')]({'where':{'id':_0x74076a['params']['id']}})[_0x2e13('0x24')](handleEntityNotFound(_0x28010f,null))[_0x2e13('0x24')](removeEntity(_0x28010f,null))[_0x2e13('0x44')](handleError(_0x28010f,null));}; \ No newline at end of file +var _0x4944=['error','stack','name','index','map','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','offset','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','DeskField','findAll','rows','catch','show','intersection','find','create','body','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','json','count','limit','set','Content-Range','apply','update','then','end'];(function(_0x27fe26,_0x3b8ca7){var _0x4fcb35=function(_0x35e0ae){while(--_0x35e0ae){_0x27fe26['push'](_0x27fe26['shift']());}};_0x4fcb35(++_0x3b8ca7);}(_0x4944,0x6d));var _0x4494=function(_0x5e5840,_0xc64374){_0x5e5840=_0x5e5840-0x0;var _0x1409aa=_0x4944[_0x5e5840];return _0x1409aa;};'use strict';var pdf=require(_0x4494('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4494('0x1'));var zipdir=require(_0x4494('0x2'));var jsonpatch=require(_0x4494('0x3'));var rp=require(_0x4494('0x4'));var moment=require(_0x4494('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4494('0x6'));var util=require('util');var path=require(_0x4494('0x7'));var sox=require(_0x4494('0x8'));var csv=require(_0x4494('0x9'));var ejs=require(_0x4494('0xa'));var fs=require('fs');var _=require(_0x4494('0xb'));var squel=require(_0x4494('0xc'));var crypto=require(_0x4494('0xd'));var jsforce=require(_0x4494('0xe'));var deskjs=require(_0x4494('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4494('0x10'));var Papa=require(_0x4494('0x11'));var Redis=require(_0x4494('0x12'));var authService=require(_0x4494('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4494('0x14'));var logger=require(_0x4494('0x15'))(_0x4494('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4494('0x17'))['db'];function respondWithStatusCode(_0x435e4a,_0x221a1d){_0x221a1d=_0x221a1d||0xcc;return function(_0x1c9750){if(_0x1c9750){return _0x435e4a[_0x4494('0x18')](_0x221a1d);}return _0x435e4a[_0x4494('0x19')](_0x221a1d)['end']();};}function respondWithResult(_0x34959d,_0x2325f4){_0x2325f4=_0x2325f4||0xc8;return function(_0x45825c){if(_0x45825c){return _0x34959d[_0x4494('0x19')](_0x2325f4)[_0x4494('0x1a')](_0x45825c);}};}function respondWithFilteredResult(_0x8506a0,_0x3847d6){return function(_0x53fed5){if(_0x53fed5){var _0x2caa38=_0x53fed5[_0x4494('0x1b')],_0x5a0985=_0x3847d6['offset'],_0x5570a4=_0x3847d6['offset']+_0x3847d6[_0x4494('0x1c')],_0x1a93bc;if(_0x5570a4>=_0x2caa38){_0x5570a4=_0x2caa38;_0x1a93bc=0xc8;}else{_0x1a93bc=0xce;}_0x8506a0['status'](_0x1a93bc);return _0x8506a0[_0x4494('0x1d')](_0x4494('0x1e'),_0x5a0985+'-'+_0x5570a4+'/'+_0x2caa38)['json'](_0x53fed5);}return null;};}function patchUpdates(_0x22ed31){return function(_0x5e5806){try{jsonpatch[_0x4494('0x1f')](_0x5e5806,_0x22ed31,!![]);}catch(_0x28884c){return BPromise['reject'](_0x28884c);}return _0x5e5806['save']();};}function saveUpdates(_0x434e43,_0x1768c3){return function(_0x17a2bf){if(_0x17a2bf){return _0x17a2bf[_0x4494('0x20')](_0x434e43)[_0x4494('0x21')](function(_0x35b18a){return _0x35b18a;});}return null;};}function removeEntity(_0x2c1b76,_0xae958d){return function(_0x4cd309){if(_0x4cd309){return _0x4cd309['destroy']()['then'](function(){_0x2c1b76['status'](0xcc)[_0x4494('0x22')]();});}};}function handleEntityNotFound(_0x8b6c21,_0x1b3630){return function(_0x470b2f){if(!_0x470b2f){_0x8b6c21['sendStatus'](0x194);}return _0x470b2f;};}function handleError(_0x10f7fe,_0xdd08b8){_0xdd08b8=_0xdd08b8||0x1f4;return function(_0x5596fb){logger[_0x4494('0x23')](_0x5596fb[_0x4494('0x24')]);if(_0x5596fb[_0x4494('0x25')]){delete _0x5596fb['name'];}_0x10f7fe[_0x4494('0x19')](_0xdd08b8)['send'](_0x5596fb);};}exports[_0x4494('0x26')]=function(_0x48d74d,_0x29e625){var _0x2fcc43={},_0xce3c8d={},_0x54f1ea={'count':0x0,'rows':[]};var _0x2f269a=_[_0x4494('0x27')](db['DeskField'][_0x4494('0x28')],function(_0x303321){return{'name':_0x303321[_0x4494('0x29')],'type':_0x303321['type'][_0x4494('0x2a')]};});_0xce3c8d[_0x4494('0x2b')]=_[_0x4494('0x27')](_0x2f269a,_0x4494('0x25'));_0xce3c8d[_0x4494('0x2c')]=_[_0x4494('0x2d')](_0x48d74d[_0x4494('0x2c')]);_0xce3c8d[_0x4494('0x2e')]=_['intersection'](_0xce3c8d[_0x4494('0x2b')],_0xce3c8d[_0x4494('0x2c')]);_0x2fcc43[_0x4494('0x2f')]=_['intersection'](_0xce3c8d[_0x4494('0x2b')],qs[_0x4494('0x30')](_0x48d74d[_0x4494('0x2c')][_0x4494('0x30')]));_0x2fcc43[_0x4494('0x2f')]=_0x2fcc43[_0x4494('0x2f')][_0x4494('0x31')]?_0x2fcc43['attributes']:_0xce3c8d[_0x4494('0x2b')];if(!_0x48d74d[_0x4494('0x2c')][_0x4494('0x32')](_0x4494('0x33'))){_0x2fcc43[_0x4494('0x1c')]=qs[_0x4494('0x1c')](_0x48d74d['query'][_0x4494('0x1c')]);_0x2fcc43[_0x4494('0x34')]=qs[_0x4494('0x34')](_0x48d74d[_0x4494('0x2c')][_0x4494('0x34')]);}_0x2fcc43['order']=qs[_0x4494('0x35')](_0x48d74d[_0x4494('0x2c')]['sort']);_0x2fcc43[_0x4494('0x36')]=qs['filters'](_['pick'](_0x48d74d['query'],_0xce3c8d[_0x4494('0x2e')]));if(_0x48d74d[_0x4494('0x2c')][_0x4494('0x37')]){_0x2fcc43['where']=_['merge'](_0x2fcc43[_0x4494('0x36')],{'$or':_[_0x4494('0x27')](_0x2f269a,function(_0x17726f){if(_0x17726f[_0x4494('0x38')]!==_0x4494('0x39')){var _0x260561={};_0x260561[_0x17726f[_0x4494('0x25')]]={'$like':'%'+_0x48d74d[_0x4494('0x2c')][_0x4494('0x37')]+'%'};return _0x260561;}})});}_0x2fcc43=_[_0x4494('0x3a')]({},_0x2fcc43,_0x48d74d[_0x4494('0x3b')]);var _0x14542e={'where':_0x2fcc43[_0x4494('0x36')]};return db['DeskField'][_0x4494('0x1b')](_0x14542e)[_0x4494('0x21')](function(_0xdb7757){_0x54f1ea[_0x4494('0x1b')]=_0xdb7757;if(_0x48d74d[_0x4494('0x2c')][_0x4494('0x3c')]){_0x2fcc43[_0x4494('0x3d')]=[{'all':!![]}];}return db[_0x4494('0x3e')][_0x4494('0x3f')](_0x2fcc43);})['then'](function(_0x5c5d95){_0x54f1ea[_0x4494('0x40')]=_0x5c5d95;return _0x54f1ea;})['then'](respondWithFilteredResult(_0x29e625,_0x2fcc43))[_0x4494('0x41')](handleError(_0x29e625,null));};exports[_0x4494('0x42')]=function(_0x28cb6c,_0x335999){var _0x18b713={'raw':!![],'where':{'id':_0x28cb6c['params']['id']}},_0x531782={};_0x531782[_0x4494('0x2b')]=_['keys'](db[_0x4494('0x3e')][_0x4494('0x28')]);_0x531782[_0x4494('0x2c')]=_[_0x4494('0x2d')](_0x28cb6c[_0x4494('0x2c')]);_0x531782[_0x4494('0x2e')]=_[_0x4494('0x43')](_0x531782['model'],_0x531782[_0x4494('0x2c')]);_0x18b713[_0x4494('0x2f')]=_['intersection'](_0x531782[_0x4494('0x2b')],qs[_0x4494('0x30')](_0x28cb6c[_0x4494('0x2c')]['fields']));_0x18b713[_0x4494('0x2f')]=_0x18b713[_0x4494('0x2f')][_0x4494('0x31')]?_0x18b713[_0x4494('0x2f')]:_0x531782['model'];if(_0x28cb6c['query'][_0x4494('0x3c')]){_0x18b713[_0x4494('0x3d')]=[{'all':!![]}];}_0x18b713=_[_0x4494('0x3a')]({},_0x18b713,_0x28cb6c['options']);return db['DeskField'][_0x4494('0x44')](_0x18b713)[_0x4494('0x21')](handleEntityNotFound(_0x335999,null))[_0x4494('0x21')](respondWithResult(_0x335999,null))['catch'](handleError(_0x335999,null));};exports[_0x4494('0x45')]=function(_0x1800dd,_0x4d6295){return db[_0x4494('0x3e')][_0x4494('0x45')](_0x1800dd[_0x4494('0x46')],{})[_0x4494('0x21')](respondWithResult(_0x4d6295,0xc9))[_0x4494('0x41')](handleError(_0x4d6295,null));};exports['update']=function(_0x802d47,_0x3c5475){if(_0x802d47[_0x4494('0x46')]['id']){delete _0x802d47[_0x4494('0x46')]['id'];}return db[_0x4494('0x3e')][_0x4494('0x44')]({'where':{'id':_0x802d47[_0x4494('0x47')]['id']}})[_0x4494('0x21')](handleEntityNotFound(_0x3c5475,null))[_0x4494('0x21')](saveUpdates(_0x802d47[_0x4494('0x46')],null))['then'](respondWithResult(_0x3c5475,null))[_0x4494('0x41')](handleError(_0x3c5475,null));};exports['destroy']=function(_0x1227e4,_0x3d90bc){return db[_0x4494('0x3e')][_0x4494('0x44')]({'where':{'id':_0x1227e4[_0x4494('0x47')]['id']}})['then'](handleEntityNotFound(_0x3d90bc,null))[_0x4494('0x21')](removeEntity(_0x3d90bc,null))['catch'](handleError(_0x3d90bc,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index fad777d..581fc4e 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 _0x322c=['int_desk_fields','idField','FieldId','lodash','util','api','moment','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField'];(function(_0x3fe988,_0x149b45){var _0x62ef22=function(_0x1367f1){while(--_0x1367f1){_0x3fe988['push'](_0x3fe988['shift']());}};_0x62ef22(++_0x149b45);}(_0x322c,0x162));var _0xc322=function(_0x1d73c6,_0x1c08f4){_0x1d73c6=_0x1d73c6-0x0;var _0x2bc9e7=_0x322c[_0x1d73c6];return _0x2bc9e7;};'use strict';var _=require(_0xc322('0x0'));var util=require(_0xc322('0x1'));var logger=require('../../config/logger')(_0xc322('0x2'));var moment=require(_0xc322('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xc322('0x4'));var config=require(_0xc322('0x5'));var attributes=require(_0xc322('0x6'));module[_0xc322('0x7')]=function(_0xae603e,_0x3c00d1){return _0xae603e[_0xc322('0x8')](_0xc322('0x9'),attributes,{'tableName':_0xc322('0xa'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xc322('0xb'),_0xc322('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0c5e=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','define','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','util','api','moment'];(function(_0x237244,_0x342694){var _0x57606f=function(_0x440169){while(--_0x440169){_0x237244['push'](_0x237244['shift']());}};_0x57606f(++_0x342694);}(_0x0c5e,0xa5));var _0xe0c5=function(_0x547af,_0x17abff){_0x547af=_0x547af-0x0;var _0x22f7f4=_0x0c5e[_0x547af];return _0x22f7f4;};'use strict';var _=require('lodash');var util=require(_0xe0c5('0x0'));var logger=require('../../config/logger')(_0xe0c5('0x1'));var moment=require(_0xe0c5('0x2'));var BPromise=require('bluebird');var rp=require(_0xe0c5('0x3'));var fs=require('fs');var path=require(_0xe0c5('0x4'));var rimraf=require(_0xe0c5('0x5'));var config=require(_0xe0c5('0x6'));var attributes=require(_0xe0c5('0x7'));module['exports']=function(_0x3ad0f7,_0x2c60c1){return _0x3ad0f7[_0xe0c5('0x8')](_0xe0c5('0x9'),attributes,{'tableName':_0xe0c5('0xa'),'paranoid':![],'indexes':[{'name':_0xe0c5('0xb'),'fields':[_0xe0c5('0xc'),_0xe0c5('0xd')],'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 ed4926f..47dad02 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 _0xc299=['DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskField,\x20%s,\x20%s','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','debug'];(function(_0xcf244f,_0xff2170){var _0x4676b6=function(_0x594fd0){while(--_0x594fd0){_0xcf244f['push'](_0xcf244f['shift']());}};_0x4676b6(++_0xff2170);}(_0xc299,0x18f));var _0x9c29=function(_0x3beea0,_0x416691){_0x3beea0=_0x3beea0-0x0;var _0x314eb1=_0xc299[_0x3beea0];return _0x314eb1;};'use strict';var _=require('lodash');var util=require(_0x9c29('0x0'));var moment=require(_0x9c29('0x1'));var BPromise=require(_0x9c29('0x2'));var rs=require(_0x9c29('0x3'));var fs=require('fs');var Redis=require(_0x9c29('0x4'));var db=require(_0x9c29('0x5'))['db'];var utils=require(_0x9c29('0x6'));var logger=require(_0x9c29('0x7'))(_0x9c29('0x8'));var config=require(_0x9c29('0x9'));var jayson=require(_0x9c29('0xa'));var client=jayson[_0x9c29('0xb')][_0x9c29('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x205dc3,_0x2e250c,_0x36ba08){return new BPromise(function(_0x2ae86f,_0x9f64d3){return client[_0x9c29('0xd')](_0x205dc3,_0x36ba08)[_0x9c29('0xe')](function(_0x4e4cef){logger['info']('DeskField,\x20%s,\x20%s',_0x2e250c,_0x9c29('0xf'));logger[_0x9c29('0x10')](_0x9c29('0x11'),_0x2e250c,_0x9c29('0xf'),JSON[_0x9c29('0x12')](_0x4e4cef));if(_0x4e4cef['error']){if(_0x4e4cef[_0x9c29('0x13')][_0x9c29('0x14')]===0x1f4){logger[_0x9c29('0x13')](_0x9c29('0x15'),_0x2e250c,_0x4e4cef[_0x9c29('0x13')][_0x9c29('0x16')]);return _0x9f64d3(_0x4e4cef[_0x9c29('0x13')][_0x9c29('0x16')]);}logger[_0x9c29('0x13')](_0x9c29('0x15'),_0x2e250c,_0x4e4cef['error'][_0x9c29('0x16')]);return _0x2ae86f(_0x4e4cef[_0x9c29('0x13')]['message']);}else{logger[_0x9c29('0x17')](_0x9c29('0x15'),_0x2e250c,_0x9c29('0xf'));_0x2ae86f(_0x4e4cef[_0x9c29('0x18')][_0x9c29('0x16')]);}})[_0x9c29('0x19')](function(_0x14361f){logger[_0x9c29('0x13')](_0x9c29('0x15'),_0x2e250c,_0x14361f);_0x9f64d3(_0x14361f);});});} \ No newline at end of file +var _0x73c9=['../../config/environment','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x5b157d,_0x2a04bb){var _0x3f18aa=function(_0x4dc523){while(--_0x4dc523){_0x5b157d['push'](_0x5b157d['shift']());}};_0x3f18aa(++_0x2a04bb);}(_0x73c9,0xcb));var _0x973c=function(_0x3ca1a5,_0x1198e2){_0x3ca1a5=_0x3ca1a5-0x0;var _0x8bead3=_0x73c9[_0x3ca1a5];return _0x8bead3;};'use strict';var _=require(_0x973c('0x0'));var util=require(_0x973c('0x1'));var moment=require('moment');var BPromise=require(_0x973c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x973c('0x3'));var db=require(_0x973c('0x4'))['db'];var utils=require(_0x973c('0x5'));var logger=require('../../config/logger')(_0x973c('0x6'));var config=require(_0x973c('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x973c('0x8')][_0x973c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c9504,_0x226aed,_0x4e2683){return new BPromise(function(_0x3cebc5,_0x161dc3){return client[_0x973c('0xa')](_0x4c9504,_0x4e2683)['then'](function(_0x462c99){logger[_0x973c('0xb')](_0x973c('0xc'),_0x226aed,_0x973c('0xd'));logger[_0x973c('0xe')](_0x973c('0xf'),_0x226aed,'request\x20sent',JSON[_0x973c('0x10')](_0x462c99));if(_0x462c99[_0x973c('0x11')]){if(_0x462c99['error']['code']===0x1f4){logger[_0x973c('0x11')]('DeskField,\x20%s,\x20%s',_0x226aed,_0x462c99[_0x973c('0x11')][_0x973c('0x12')]);return _0x161dc3(_0x462c99[_0x973c('0x11')]['message']);}logger['error'](_0x973c('0xc'),_0x226aed,_0x462c99[_0x973c('0x11')][_0x973c('0x12')]);return _0x3cebc5(_0x462c99[_0x973c('0x11')][_0x973c('0x12')]);}else{logger[_0x973c('0xb')]('DeskField,\x20%s,\x20%s',_0x226aed,'request\x20sent');_0x3cebc5(_0x462c99[_0x973c('0x13')]['message']);}})[_0x973c('0x14')](function(_0x34e8d3){logger[_0x973c('0x11')]('DeskField,\x20%s,\x20%s',_0x226aed,_0x34e8d3);_0x161dc3(_0x34e8d3);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9c5f784..191b69d 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 _0x9a0f=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','post','update','delete','exports','multer','util'];(function(_0xe7fc64,_0x536d20){var _0x9af0d7=function(_0x5e8110){while(--_0x5e8110){_0xe7fc64['push'](_0xe7fc64['shift']());}};_0x9af0d7(++_0x536d20);}(_0x9a0f,0x18a));var _0xf9a0=function(_0x583125,_0x34c12b){_0x583125=_0x583125-0x0;var _0x118c4d=_0x9a0f[_0x583125];return _0x118c4d;};'use strict';var multer=require(_0xf9a0('0x0'));var util=require(_0xf9a0('0x1'));var path=require(_0xf9a0('0x2'));var timeout=require(_0xf9a0('0x3'));var express=require(_0xf9a0('0x4'));var router=express[_0xf9a0('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xf9a0('0x6'));var config=require(_0xf9a0('0x7'));var controller=require('./intDynamics365Account.controller');router[_0xf9a0('0x8')]('/',auth[_0xf9a0('0x9')](),controller['index']);router[_0xf9a0('0x8')](_0xf9a0('0xa'),auth[_0xf9a0('0x9')](),controller[_0xf9a0('0xb')]);router['get'](_0xf9a0('0xc'),auth[_0xf9a0('0x9')](),controller[_0xf9a0('0xd')]);router[_0xf9a0('0x8')]('/:id/fields',auth[_0xf9a0('0x9')](),controller['getFields']);router[_0xf9a0('0xe')]('/',auth[_0xf9a0('0x9')](),controller['create']);router[_0xf9a0('0xe')](_0xf9a0('0xc'),auth[_0xf9a0('0x9')](),controller['addConfiguration']);router['put']('/:id',auth[_0xf9a0('0x9')](),controller[_0xf9a0('0xf')]);router[_0xf9a0('0x10')]('/:id',auth[_0xf9a0('0x9')](),controller['destroy']);module[_0xf9a0('0x11')]=router; \ No newline at end of file +var _0x19ef=['../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','delete','destroy','exports','multer','util','connect-timeout','express','../../components/auth/service'];(function(_0x41a836,_0x52f0f2){var _0x34edbd=function(_0x109ad5){while(--_0x109ad5){_0x41a836['push'](_0x41a836['shift']());}};_0x34edbd(++_0x52f0f2);}(_0x19ef,0x1f3));var _0xf19e=function(_0x261b8a,_0x553ec4){_0x261b8a=_0x261b8a-0x0;var _0x3455e8=_0x19ef[_0x261b8a];return _0x3455e8;};'use strict';var multer=require(_0xf19e('0x0'));var util=require(_0xf19e('0x1'));var path=require('path');var timeout=require(_0xf19e('0x2'));var express=require(_0xf19e('0x3'));var router=express['Router']();var auth=require(_0xf19e('0x4'));var interaction=require(_0xf19e('0x5'));var config=require(_0xf19e('0x6'));var controller=require(_0xf19e('0x7'));router[_0xf19e('0x8')]('/',auth[_0xf19e('0x9')](),controller[_0xf19e('0xa')]);router['get'](_0xf19e('0xb'),auth['isAuthenticated'](),controller[_0xf19e('0xc')]);router[_0xf19e('0x8')](_0xf19e('0xd'),auth['isAuthenticated'](),controller[_0xf19e('0xe')]);router[_0xf19e('0x8')](_0xf19e('0xf'),auth['isAuthenticated'](),controller['getFields']);router[_0xf19e('0x10')]('/',auth['isAuthenticated'](),controller[_0xf19e('0x11')]);router['post'](_0xf19e('0xd'),auth[_0xf19e('0x9')](),controller['addConfiguration']);router['put'](_0xf19e('0xb'),auth[_0xf19e('0x9')](),controller['update']);router[_0xf19e('0x12')]('/:id',auth[_0xf19e('0x9')](),controller[_0xf19e('0x13')]);module[_0xf19e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 80b3acf..d8ce34f 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 _0x37ac=['sequelize','exports','STRING'];(function(_0x333f4a,_0x4770a4){var _0x55c80d=function(_0x5465d6){while(--_0x5465d6){_0x333f4a['push'](_0x333f4a['shift']());}};_0x55c80d(++_0x4770a4);}(_0x37ac,0x99));var _0xc37a=function(_0x22b377,_0x528f67){_0x22b377=_0x22b377-0x0;var _0x38ec4b=_0x37ac[_0x22b377];return _0x38ec4b;};'use strict';var Sequelize=require(_0xc37a('0x0'));module[_0xc37a('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xc37a('0x2')]},'password':{'type':Sequelize[_0xc37a('0x2')]},'remoteUri':{'type':Sequelize[_0xc37a('0x2')]},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xc37a('0x2')]},'clientSecret':{'type':Sequelize[_0xc37a('0x2')]},'serverUrl':{'type':Sequelize[_0xc37a('0x2')]},'description':{'type':Sequelize[_0xc37a('0x2')]}}; \ No newline at end of file +var _0x8770=['STRING','exports'];(function(_0x3752dc,_0x315641){var _0x4bbbb4=function(_0x5c495f){while(--_0x5c495f){_0x3752dc['push'](_0x3752dc['shift']());}};_0x4bbbb4(++_0x315641);}(_0x8770,0xfd));var _0x0877=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8770[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x0877('0x0')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x0877('0x1')]},'password':{'type':Sequelize[_0x0877('0x1')]},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x0877('0x1')]},'serverUrl':{'type':Sequelize[_0x0877('0x1')]},'description':{'type':Sequelize[_0x0877('0x1')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 3e85d72..0da42f9 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 _0x1ece=['customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','escalatedon','exchangerate','firstresponsebykpiidname','followupby','importsequencenumber','influencescore','kbarticleidname','lastonholdtime','masteridname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','concat','password','clientId','clientSecret','remoteUri','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','tenantId','/oauth2/token','username','GET','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','includes','forEach','@odata.type','substring','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','Wrong\x20credentials','statusCode',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','Value','LogicalName','DisplayName','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false','?$select=DisplayName,LogicalName','html-pdf','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','Dynamics365Account,\x20%s,\x20%s','message','result','catch','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','sendStatus','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','Dynamics365Account','options','find','create','body','destroy','getConfigurations','findOne','length','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','Dynamics365Configuration','Dynamics365Field','getFields','incident','Incident','PhoneCall','title','description','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','directioncode','accountidname','actualserviceunits','contactidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyyominame','customeridname','customeridtype'];(function(_0x4988f5,_0x22e4fa){var _0x2921e4=function(_0x625316){while(--_0x625316){_0x4988f5['push'](_0x4988f5['shift']());}};_0x2921e4(++_0x22e4fa);}(_0x1ece,0x13f));var _0xe1ec=function(_0x43e41e,_0x2d724e){_0x43e41e=_0x43e41e-0x0;var _0xc59837=_0x1ece[_0x43e41e];return _0xc59837;};'use strict';var pdf=require(_0xe1ec('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe1ec('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe1ec('0x2'));var rp=require('request-promise');var moment=require(_0xe1ec('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xe1ec('0x4'));var util=require('util');var path=require(_0xe1ec('0x5'));var sox=require(_0xe1ec('0x6'));var csv=require(_0xe1ec('0x7'));var ejs=require(_0xe1ec('0x8'));var fs=require('fs');var _=require(_0xe1ec('0x9'));var squel=require('squel');var crypto=require(_0xe1ec('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xe1ec('0xb'));var toCsv=require(_0xe1ec('0x7'));var querystring=require('querystring');var Papa=require(_0xe1ec('0xc'));var Redis=require(_0xe1ec('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xe1ec('0xe'));var as=require(_0xe1ec('0xf'));var hardwareService=require(_0xe1ec('0x10'));var logger=require(_0xe1ec('0x11'))(_0xe1ec('0x12'));var utils=require(_0xe1ec('0x13'));var config=require(_0xe1ec('0x14'));var db=require(_0xe1ec('0x15'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson[_0xe1ec('0x16')][_0xe1ec('0x17')]({'port':0x232a});function checkPasswordPattern(_0x35613f,_0x557fd4,_0x2f6772){if(_0x2f6772){var _0xa2b807=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2b807[_0xe1ec('0x18')](_0x557fd4)){return _0x35613f;}else{throw new db[(_0xe1ec('0x19'))]['ValidationError'](_0xe1ec('0x1a'));}}else{return _0x35613f;}}function respondWithRpcPromise(_0x1526e8,_0x2c8d5a,_0x5bbc75,_0x444f24){return new BPromise(function(_0x45b709,_0x39502c){var _0x35c54c=_0x444f24||client;return _0x35c54c[_0xe1ec('0x1b')](_0x1526e8,_0x5bbc75)[_0xe1ec('0x1c')](function(_0x4dea14){logger[_0xe1ec('0x1d')]('Dynamics365Account,\x20%s,\x20%s',_0x2c8d5a,_0xe1ec('0x1e'));logger[_0xe1ec('0x1f')](_0xe1ec('0x20'),_0x2c8d5a,'request\x20sent',JSON['stringify'](_0x4dea14));if(_0x4dea14[_0xe1ec('0x21')]){if(_0x4dea14[_0xe1ec('0x21')]['code']===0x1f4){logger['error'](_0xe1ec('0x22'),_0x2c8d5a,_0x4dea14[_0xe1ec('0x21')][_0xe1ec('0x23')]);return _0x39502c(_0x4dea14[_0xe1ec('0x21')][_0xe1ec('0x23')]);}logger[_0xe1ec('0x21')](_0xe1ec('0x22'),_0x2c8d5a,_0x4dea14['error'][_0xe1ec('0x23')]);return _0x45b709(_0x4dea14['error']['message']);}else{logger[_0xe1ec('0x1d')](_0xe1ec('0x22'),_0x2c8d5a,_0xe1ec('0x1e'));_0x45b709(_0x4dea14[_0xe1ec('0x24')][_0xe1ec('0x23')]);}})[_0xe1ec('0x25')](function(_0x12bd71){logger[_0xe1ec('0x21')](_0xe1ec('0x22'),_0x2c8d5a,_0x12bd71);_0x39502c(_0x12bd71);});});}function respondWithStatusCode(_0x5d06fd,_0x3a57ce){_0x3a57ce=_0x3a57ce||0xcc;return function(_0x2e8b14){if(_0x2e8b14){return _0x5d06fd['sendStatus'](_0x3a57ce);}return _0x5d06fd[_0xe1ec('0x26')](_0x3a57ce)[_0xe1ec('0x27')]();};}function respondWithResult(_0x1855cc,_0x573440){_0x573440=_0x573440||0xc8;return function(_0x4ca685){if(_0x4ca685){return _0x1855cc[_0xe1ec('0x26')](_0x573440)[_0xe1ec('0x28')](_0x4ca685);}};}function respondWithFilteredResult(_0x2d2cef,_0x5c03a9){return function(_0x5d0e55){if(_0x5d0e55){var _0x59172e=_0x5d0e55[_0xe1ec('0x29')],_0x128834=_0x5c03a9[_0xe1ec('0x2a')],_0x1fb232=_0x5c03a9[_0xe1ec('0x2a')]+_0x5c03a9[_0xe1ec('0x2b')],_0x146b57;if(_0x1fb232>=_0x59172e){_0x1fb232=_0x59172e;_0x146b57=0xc8;}else{_0x146b57=0xce;}_0x2d2cef['status'](_0x146b57);return _0x2d2cef[_0xe1ec('0x2c')](_0xe1ec('0x2d'),_0x128834+'-'+_0x1fb232+'/'+_0x59172e)[_0xe1ec('0x28')](_0x5d0e55);}return null;};}function patchUpdates(_0x52154f){return function(_0x15f226){try{jsonpatch['apply'](_0x15f226,_0x52154f,!![]);}catch(_0x4591f5){return BPromise[_0xe1ec('0x2e')](_0x4591f5);}return _0x15f226[_0xe1ec('0x2f')]();};}function saveUpdates(_0x81cac5,_0x504276){return function(_0x5cf052){if(_0x5cf052){return _0x5cf052[_0xe1ec('0x30')](_0x81cac5)[_0xe1ec('0x1c')](function(_0x49ea1e){return _0x49ea1e;});}return null;};}function removeEntity(_0x39e0fa,_0x89b7f7){return function(_0x4749dc){if(_0x4749dc){return _0x4749dc['destroy']()['then'](function(){_0x39e0fa[_0xe1ec('0x26')](0xcc)[_0xe1ec('0x27')]();});}};}function handleEntityNotFound(_0x1e2215,_0x385a0b){return function(_0x2725d2){if(!_0x2725d2){_0x1e2215[_0xe1ec('0x31')](0x194);}return _0x2725d2;};}function handleError(_0x51cfe4,_0x47ae65){_0x47ae65=_0x47ae65||0x1f4;return function(_0x5071c1){logger['error'](_0x5071c1[_0xe1ec('0x32')]);if(_0x5071c1[_0xe1ec('0x33')]){delete _0x5071c1[_0xe1ec('0x33')];}_0x51cfe4[_0xe1ec('0x26')](_0x47ae65)[_0xe1ec('0x34')](_0x5071c1);};}exports['index']=function(_0x37f1ca,_0x1c2c55){var _0x36f4f1={},_0x1bf756={},_0x339c55={'count':0x0,'rows':[]};var _0x4cb460=_[_0xe1ec('0x35')](db['Dynamics365Account'][_0xe1ec('0x36')],function(_0x3cc1b3){return{'name':_0x3cc1b3[_0xe1ec('0x37')],'type':_0x3cc1b3[_0xe1ec('0x38')][_0xe1ec('0x39')]};});_0x1bf756['model']=_[_0xe1ec('0x35')](_0x4cb460,_0xe1ec('0x33'));_0x1bf756[_0xe1ec('0x3a')]=_[_0xe1ec('0x3b')](_0x37f1ca[_0xe1ec('0x3a')]);_0x1bf756[_0xe1ec('0x3c')]=_[_0xe1ec('0x3d')](_0x1bf756[_0xe1ec('0x3e')],_0x1bf756[_0xe1ec('0x3a')]);_0x36f4f1[_0xe1ec('0x3f')]=_[_0xe1ec('0x3d')](_0x1bf756[_0xe1ec('0x3e')],qs[_0xe1ec('0x40')](_0x37f1ca[_0xe1ec('0x3a')]['fields']));_0x36f4f1['attributes']=_0x36f4f1[_0xe1ec('0x3f')]['length']?_0x36f4f1[_0xe1ec('0x3f')]:_0x1bf756['model'];if(!_0x37f1ca['query'][_0xe1ec('0x41')]('nolimit')){_0x36f4f1[_0xe1ec('0x2b')]=qs['limit'](_0x37f1ca[_0xe1ec('0x3a')][_0xe1ec('0x2b')]);_0x36f4f1['offset']=qs[_0xe1ec('0x2a')](_0x37f1ca['query'][_0xe1ec('0x2a')]);}_0x36f4f1[_0xe1ec('0x42')]=qs['sort'](_0x37f1ca[_0xe1ec('0x3a')][_0xe1ec('0x43')]);_0x36f4f1['where']=qs['filters'](_[_0xe1ec('0x44')](_0x37f1ca[_0xe1ec('0x3a')],_0x1bf756[_0xe1ec('0x3c')]));if(_0x37f1ca[_0xe1ec('0x3a')][_0xe1ec('0x45')]){_0x36f4f1[_0xe1ec('0x46')]=_[_0xe1ec('0x47')](_0x36f4f1[_0xe1ec('0x46')],{'$or':_[_0xe1ec('0x35')](_0x4cb460,function(_0x7916ef){if(_0x7916ef[_0xe1ec('0x38')]!==_0xe1ec('0x48')){var _0x30a056={};_0x30a056[_0x7916ef[_0xe1ec('0x33')]]={'$like':'%'+_0x37f1ca['query'][_0xe1ec('0x45')]+'%'};return _0x30a056;}})});}_0x36f4f1=_[_0xe1ec('0x47')]({},_0x36f4f1,_0x37f1ca['options']);var _0x3aa067={'where':_0x36f4f1[_0xe1ec('0x46')]};return db['Dynamics365Account'][_0xe1ec('0x29')](_0x3aa067)[_0xe1ec('0x1c')](function(_0x29b9e5){_0x339c55[_0xe1ec('0x29')]=_0x29b9e5;if(_0x37f1ca[_0xe1ec('0x3a')][_0xe1ec('0x49')]){_0x36f4f1[_0xe1ec('0x4a')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xe1ec('0x4b')](_0x36f4f1);})[_0xe1ec('0x1c')](function(_0x431b97){_0x339c55[_0xe1ec('0x4c')]=_0x431b97;return _0x339c55;})[_0xe1ec('0x1c')](respondWithFilteredResult(_0x1c2c55,_0x36f4f1))[_0xe1ec('0x25')](handleError(_0x1c2c55,null));};exports[_0xe1ec('0x4d')]=function(_0x20704a,_0x4d80f4){var _0x323c07={'raw':![],'where':{'id':_0x20704a[_0xe1ec('0x4e')]['id']}},_0x595f86={};_0x595f86[_0xe1ec('0x3e')]=_[_0xe1ec('0x3b')](db[_0xe1ec('0x4f')][_0xe1ec('0x36')]);_0x595f86['query']=_[_0xe1ec('0x3b')](_0x20704a[_0xe1ec('0x3a')]);_0x595f86[_0xe1ec('0x3c')]=_[_0xe1ec('0x3d')](_0x595f86[_0xe1ec('0x3e')],_0x595f86['query']);_0x323c07[_0xe1ec('0x3f')]=_[_0xe1ec('0x3d')](_0x595f86[_0xe1ec('0x3e')],qs[_0xe1ec('0x40')](_0x20704a[_0xe1ec('0x3a')][_0xe1ec('0x40')]));_0x323c07[_0xe1ec('0x3f')]=_0x323c07[_0xe1ec('0x3f')]['length']?_0x323c07[_0xe1ec('0x3f')]:_0x595f86[_0xe1ec('0x3e')];if(_0x20704a[_0xe1ec('0x3a')][_0xe1ec('0x49')]){_0x323c07[_0xe1ec('0x4a')]=[{'all':!![]}];}_0x323c07=_['merge']({},_0x323c07,_0x20704a[_0xe1ec('0x50')]);return db[_0xe1ec('0x4f')][_0xe1ec('0x51')](_0x323c07)[_0xe1ec('0x1c')](handleEntityNotFound(_0x4d80f4,null))[_0xe1ec('0x1c')](respondWithResult(_0x4d80f4,null))[_0xe1ec('0x25')](handleError(_0x4d80f4,null));};exports[_0xe1ec('0x52')]=function(_0x4c5ac2,_0x6d1cf5){return db['Dynamics365Account']['create'](_0x4c5ac2[_0xe1ec('0x53')],{})[_0xe1ec('0x1c')](respondWithResult(_0x6d1cf5,0xc9))[_0xe1ec('0x25')](handleError(_0x6d1cf5,null));};exports[_0xe1ec('0x30')]=function(_0xc44515,_0x150a90){if(_0xc44515['body']['id']){delete _0xc44515[_0xe1ec('0x53')]['id'];}return db[_0xe1ec('0x4f')][_0xe1ec('0x51')]({'where':{'id':_0xc44515['params']['id']}})[_0xe1ec('0x1c')](handleEntityNotFound(_0x150a90,null))['then'](saveUpdates(_0xc44515[_0xe1ec('0x53')],null))[_0xe1ec('0x1c')](respondWithResult(_0x150a90,null))['catch'](handleError(_0x150a90,null));};exports[_0xe1ec('0x54')]=function(_0x59917c,_0x1f0f1e){return db[_0xe1ec('0x4f')]['find']({'where':{'id':_0x59917c[_0xe1ec('0x4e')]['id']}})[_0xe1ec('0x1c')](handleEntityNotFound(_0x1f0f1e,null))['then'](removeEntity(_0x1f0f1e,null))[_0xe1ec('0x25')](handleError(_0x1f0f1e,null));};exports[_0xe1ec('0x55')]=function(_0x343fc8,_0x3e39ee,_0x29cb49){var _0x5509bb={};var _0x11f051={};var _0x5de60d;var _0x124940;return db[_0xe1ec('0x4f')][_0xe1ec('0x56')]({'where':{'id':_0x343fc8['params']['id']}})[_0xe1ec('0x1c')](handleEntityNotFound(_0x3e39ee,null))[_0xe1ec('0x1c')](function(_0x46ae0e){if(_0x46ae0e){_0x5de60d=_0x46ae0e;_0x11f051[_0xe1ec('0x3e')]=_[_0xe1ec('0x3b')](db['Dynamics365Configuration'][_0xe1ec('0x36')]);_0x11f051[_0xe1ec('0x3a')]=_['keys'](_0x343fc8[_0xe1ec('0x3a')]);_0x11f051[_0xe1ec('0x3c')]=_[_0xe1ec('0x3d')](_0x11f051[_0xe1ec('0x3e')],_0x11f051[_0xe1ec('0x3a')]);_0x5509bb['attributes']=_['intersection'](_0x11f051[_0xe1ec('0x3e')],qs[_0xe1ec('0x40')](_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x40')]));_0x5509bb[_0xe1ec('0x3f')]=_0x5509bb[_0xe1ec('0x3f')][_0xe1ec('0x57')]?_0x5509bb[_0xe1ec('0x3f')]:_0x11f051[_0xe1ec('0x3e')];_0x5509bb[_0xe1ec('0x42')]=qs['sort'](_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x43')]);_0x5509bb[_0xe1ec('0x46')]=qs['filters'](_[_0xe1ec('0x44')](_0x343fc8[_0xe1ec('0x3a')],_0x11f051[_0xe1ec('0x3c')]));if(_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x45')]){_0x5509bb[_0xe1ec('0x46')]=_[_0xe1ec('0x47')](_0x5509bb['where'],{'$or':_[_0xe1ec('0x35')](_0x5509bb[_0xe1ec('0x3f')],function(_0x4e4c2c){var _0x2ebb69={};_0x2ebb69[_0x4e4c2c]={'$like':'%'+_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x45')]+'%'};return _0x2ebb69;})});}_0x5509bb=_['merge']({},_0x5509bb,_0x343fc8[_0xe1ec('0x50')]);return _0x5de60d['getConfigurations'](_0x5509bb);}})[_0xe1ec('0x1c')](function(_0x1b3a64){if(_0x1b3a64){_0x124940=_0x1b3a64['length'];if(!_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x41')]('nolimit')){_0x5509bb['limit']=qs[_0xe1ec('0x2b')](_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x2b')]);_0x5509bb[_0xe1ec('0x2a')]=qs[_0xe1ec('0x2a')](_0x343fc8[_0xe1ec('0x3a')][_0xe1ec('0x2a')]);}return _0x5de60d['getConfigurations'](_0x5509bb);}})[_0xe1ec('0x1c')](function(_0x176cc2){if(_0x176cc2){return _0x176cc2?{'count':_0x124940,'rows':_0x176cc2}:null;}})[_0xe1ec('0x1c')](respondWithResult(_0x3e39ee,null))[_0xe1ec('0x25')](handleError(_0x3e39ee,null));};exports[_0xe1ec('0x58')]=function(_0x4e3a0f,_0x29333b,_0x442005){if(_0x4e3a0f[_0xe1ec('0x53')]['id']){delete _0x4e3a0f[_0xe1ec('0x53')]['id'];}return db[_0xe1ec('0x4f')]['findOne']({'where':{'id':_0x4e3a0f['params']['id']}})[_0xe1ec('0x1c')](handleEntityNotFound(_0x29333b,null))[_0xe1ec('0x1c')](function(_0x415ffa){if(_0x415ffa){_0x4e3a0f[_0xe1ec('0x53')][_0xe1ec('0x59')]=_0x415ffa['id'];_0x4e3a0f[_0xe1ec('0x53')][_0xe1ec('0x5a')]=integrations[_0xe1ec('0x5b')](_0x4e3a0f['body']['channel'],_0x4e3a0f[_0xe1ec('0x53')][_0xe1ec('0x38')]);_0x4e3a0f[_0xe1ec('0x53')][_0xe1ec('0x5c')]=integrations[_0xe1ec('0x5d')](_0x4e3a0f['body']['channel'],_0x4e3a0f[_0xe1ec('0x53')][_0xe1ec('0x38')]);return db[_0xe1ec('0x5e')][_0xe1ec('0x52')](_0x4e3a0f['body'],{'include':[{'model':db[_0xe1ec('0x5f')],'as':'Subjects'},{'model':db[_0xe1ec('0x5f')],'as':_0xe1ec('0x5c')}]});}return null;})[_0xe1ec('0x1c')](respondWithResult(_0x29333b,null))['catch'](handleError(_0x29333b,null));};exports[_0xe1ec('0x60')]=function(_0x594319,_0x2a9d68,_0xe6a6c8){var _0x452792=_0x594319[_0xe1ec('0x3a')]['ticketType'];var _0x160888=_0x452792===_0xe1ec('0x61')?_0xe1ec('0x62'):_0xe1ec('0x63');var _0x1fa316='';var _0xb93057='';var _0x511a07='';var _0x519747='';var _0x31dc7d='';var _0x380296='';var _0x3b7564='';var _0x598e9f='';var _0x1089b8=[_0xe1ec('0x64'),_0xe1ec('0x65'),'customerid',_0xe1ec('0x66'),_0xe1ec('0x67'),_0xe1ec('0x68'),_0xe1ec('0x69'),_0xe1ec('0x6a'),_0xe1ec('0x6b'),'phonecall_activity_parties'];var _0x4147e1=[_0xe1ec('0x6c'),'accountidyominame',_0xe1ec('0x6d'),'billedserviceunits',_0xe1ec('0x6e'),'contactidyominame','contractdetailidname','contractidname',_0xe1ec('0x6f'),_0xe1ec('0x70'),_0xe1ec('0x71'),_0xe1ec('0x72'),_0xe1ec('0x73'),'createdonbehalfbyname',_0xe1ec('0x74'),_0xe1ec('0x75'),_0xe1ec('0x76'),_0xe1ec('0x77'),_0xe1ec('0x78'),_0xe1ec('0x79'),_0xe1ec('0x7a'),'entityimage_url',_0xe1ec('0x7b'),_0xe1ec('0x7c'),_0xe1ec('0x7d'),_0xe1ec('0x7e'),_0xe1ec('0x7f'),_0xe1ec('0x80'),_0xe1ec('0x81'),_0xe1ec('0x82'),_0xe1ec('0x83'),'modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname',_0xe1ec('0x84'),_0xe1ec('0x85'),_0xe1ec('0x86'),_0xe1ec('0x87'),_0xe1ec('0x88'),_0xe1ec('0x89'),'numberofchildincidents',_0xe1ec('0x8a'),_0xe1ec('0x8b'),_0xe1ec('0x8c'),_0xe1ec('0x8d'),_0xe1ec('0x8e'),_0xe1ec('0x8f'),_0xe1ec('0x90'),_0xe1ec('0x91'),_0xe1ec('0x92'),_0xe1ec('0x93'),_0xe1ec('0x94'),_0xe1ec('0x95'),_0xe1ec('0x96'),_0xe1ec('0x97'),_0xe1ec('0x98'),'responsiblecontactidyominame',_0xe1ec('0x99'),_0xe1ec('0x9a'),_0xe1ec('0x9b'),_0xe1ec('0x9c'),_0xe1ec('0x9d'),'statuscode',_0xe1ec('0x9e'),_0xe1ec('0x9f'),'timezoneruleversionnumber',_0xe1ec('0xa0'),_0xe1ec('0xa1'),_0xe1ec('0xa2'),_0xe1ec('0xa3')];var _0x31f6be=_0x1089b8[_0xe1ec('0xa4')](_0x4147e1);return db[_0xe1ec('0x4f')][_0xe1ec('0x56')]({'where':{'id':_0x594319[_0xe1ec('0x4e')]['id']},'attributes':['id','username',_0xe1ec('0xa5'),'remoteUri','tenantId',_0xe1ec('0xa6'),_0xe1ec('0xa7')]})[_0xe1ec('0x1c')](handleEntityNotFound(_0x2a9d68,null))['then'](function(_0x14a3b9){if(_0x14a3b9){_0x598e9f=_0x14a3b9[_0xe1ec('0xa8')];var _0x34905d=_0x598e9f[_0xe1ec('0xa9')](-0x1);if(_0x34905d==='/'){_0x598e9f=_0x598e9f['substring'](0x0,_0x598e9f[_0xe1ec('0xaa')](_0x34905d));}_0x3b7564=util[_0xe1ec('0xab')](_0xe1ec('0xac'),_0x598e9f);var _0x51368e={'method':_0xe1ec('0xad'),'uri':_0xe1ec('0xae')+_0x14a3b9[_0xe1ec('0xaf')]+_0xe1ec('0xb0'),'form':{'client_id':_0x14a3b9[_0xe1ec('0xa6')],'resource':_0x598e9f,'username':_0x14a3b9[_0xe1ec('0xb1')],'password':_0x14a3b9['password'],'grant_type':'password','client_secret':_0x14a3b9[_0xe1ec('0xa7')]},'json':!![]};return rp(_0x51368e);}})[_0xe1ec('0x1c')](function(_0x3c3eea){_0x380296=_0x3c3eea['access_token'];var _0x4b5c63={'method':_0xe1ec('0xb2'),'uri':encodeURI(_0x3b7564+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x160888+'\x27'),'headers':{'Authorization':_0xe1ec('0xb3')+_0x380296,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4b5c63);})[_0xe1ec('0x1c')](function(_0x467f90){var _0x1aa979=_0x467f90[_0xe1ec('0xb4')][0x0];var _0x34e325=_0x1aa979[_0xe1ec('0xb5')];var _0x835b45={'method':_0xe1ec('0xb2'),'uri':_0x3b7564+_0xe1ec('0xb6')+_0x34e325+_0xe1ec('0xb7'),'headers':{'Authorization':_0xe1ec('0xb3')+_0x380296,'If-None-Match':null,'OData-Version':_0xe1ec('0xb8')},'json':!![]};return rp(_0x835b45);})[_0xe1ec('0x1c')](function(_0x136b2c){_0x1fa316=_0x136b2c;_0xb93057=_0x1fa316[_0xe1ec('0xb9')];_0xb93057=_['remove'](_0xb93057,function(_0x372218){return!_0x31f6be[_0xe1ec('0xba')](_0x372218['LogicalName']);});var _0x503aae=[];var _0x1475fd=[];_0xb93057[_0xe1ec('0xbb')](function(_0x13130b){if(_0x13130b[_0xe1ec('0xbc')]){var _0xd0f97b=_0x13130b[_0xe1ec('0xbc')][_0xe1ec('0xbd')](_0x13130b['@odata.type'][_0xe1ec('0xaa')]('.')+0x1);if(_0xd0f97b===_0xe1ec('0xbe')){_0x503aae[_0xe1ec('0xbf')](getSelectList(_0x3b7564,_0x452792,_0x1475fd,_0x1fa316[_0xe1ec('0xb5')],_0x13130b[_0xe1ec('0xb5')],_0x380296));}}});return Promise[_0xe1ec('0xc0')](_0x503aae);})[_0xe1ec('0x1c')](function(_0x165442){_0x511a07=_0x165442[0x0];var _0x31b28d=[];var _0x5709e8=[];_0xb93057[_0xe1ec('0xbb')](function(_0x489726){if(!_[_0xe1ec('0xc1')](_0x489726[_0xe1ec('0xbc')])){var _0x47ea7a=_0x489726['@odata.type']['substring'](_0x489726[_0xe1ec('0xbc')]['lastIndexOf']('.')+0x1);if(_0x47ea7a===_0xe1ec('0xc2')){_0x31b28d[_0xe1ec('0xbf')](getBooleanList(_0x3b7564,_0x452792,_0x5709e8,_0x1fa316[_0xe1ec('0xb5')],_0x489726[_0xe1ec('0xb5')],_0x380296));}}});return Promise['all'](_0x31b28d);})[_0xe1ec('0x1c')](function(_0x14821d){_0x519747=_0x14821d[0x0];var _0x3ed0a5=[];var _0x10c5b9=[];_0xb93057[_0xe1ec('0xbb')](function(_0x58fdf3){if(_0x58fdf3[_0xe1ec('0xbc')]){var _0x1baccf=_0x58fdf3[_0xe1ec('0xbc')]['substring'](_0x58fdf3[_0xe1ec('0xbc')][_0xe1ec('0xaa')]('.')+0x1);if(_0x1baccf===_0xe1ec('0xc3')||_0x1baccf===_0xe1ec('0xc4')||_0x1baccf==='BigIntAttributeMetadata'||_0x1baccf===_0xe1ec('0xc5')||_0x1baccf===_0xe1ec('0xc6')||_0x1baccf===_0xe1ec('0xc7')||_0x1baccf==='StatusAttributeMetadata'||_0x1baccf===_0xe1ec('0xc8')||_0x1baccf===_0xe1ec('0xc9')||_0x1baccf===_0xe1ec('0xca')){_0x3ed0a5[_0xe1ec('0xbf')](getInputList(_0x3b7564,_0x452792,_0x1baccf,_0x10c5b9,_0x1fa316[_0xe1ec('0xb5')],_0x58fdf3[_0xe1ec('0xb5')],_0x380296));}}});return Promise['all'](_0x3ed0a5);})[_0xe1ec('0x1c')](function(_0x2e10b4){_0x31dc7d=_0x2e10b4[0x0];var _0x420118=_0x511a07['concat'](_0x519747)[_0xe1ec('0xa4')](_0x31dc7d);var _0x2661d6={'count':_0x420118[_0xe1ec('0x57')],'rows':_0x420118};return _0x2661d6;})[_0xe1ec('0x1c')](respondWithResult(_0x2a9d68,null))[_0xe1ec('0x25')](function(_0x1aa51f){var _0x4580e6=_0x594319[_0xe1ec('0x3a')][_0xe1ec('0x18')]?0x1f4:_0x1aa51f['statusCode']||0x1f4;logger['error'](_0x1aa51f[_0xe1ec('0x32')]);delete _0x1aa51f[_0xe1ec('0x33')];if(_0x4580e6===0x191){_0x4580e6=0x190;}_0x2a9d68['status'](_0x4580e6)[_0xe1ec('0x34')](_0x594319['query'][_0xe1ec('0x18')]?{'message':_0xe1ec('0xcb'),'statusCode':_0x1aa51f[_0xe1ec('0xcc')]}:_0x1aa51f);});};function getSelectList(_0x787e11,_0x3b452c,_0x133da4,_0x1a598e,_0x3159f9,_0x5a4175){var _0x29bf1d={'method':_0xe1ec('0xb2'),'uri':_0x787e11+_0xe1ec('0xb6')+_0x1a598e+_0xe1ec('0xcd')+_0x3159f9+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xe1ec('0xce'),'headers':{'Authorization':_0xe1ec('0xb3')+_0x5a4175,'If-None-Match':null,'OData-Version':_0xe1ec('0xb8')},'json':!![]};return rp(_0x29bf1d)[_0xe1ec('0x1c')](function(_0x535535){var _0x370e60=[];var _0x1c6c91=_0x535535[_0xe1ec('0xcf')]['Options'];_0x1c6c91[_0xe1ec('0xbb')](function(_0x4c0b13){_0x370e60[_0xe1ec('0xbf')]({'name':_0x4c0b13[_0xe1ec('0xd0')]['UserLocalizedLabel'][_0xe1ec('0xd0')],'value':String(_0x4c0b13[_0xe1ec('0xd1')])});});var _0x35a467={'id':_0x3b452c+'_'+_0x535535[_0xe1ec('0xd2')],'name':_0x535535[_0xe1ec('0xd3')][_0xe1ec('0xd4')]['Label'],'custom':![],'options':_0x370e60};_0x133da4['push'](_0x35a467);return _0x133da4;});}function getBooleanList(_0x16a465,_0x26fe9d,_0x5392b4,_0x44c9b5,_0x405bb1,_0x20ddda){var _0x2fbf71={'method':_0xe1ec('0xb2'),'uri':_0x16a465+_0xe1ec('0xb6')+_0x44c9b5+_0xe1ec('0xcd')+_0x405bb1+_0xe1ec('0xd5'),'headers':{'Authorization':_0xe1ec('0xb3')+_0x20ddda,'If-None-Match':null,'OData-Version':_0xe1ec('0xb8')},'json':!![]};return rp(_0x2fbf71)[_0xe1ec('0x1c')](function(_0xa106fc){var _0x4bf0d5=[];_0x4bf0d5[_0xe1ec('0xbf')]({'name':_0xa106fc['OptionSet'][_0xe1ec('0xd6')][_0xe1ec('0xd0')][_0xe1ec('0xd4')][_0xe1ec('0xd0')],'value':_0xe1ec('0xd7')},{'name':_0xa106fc['OptionSet'][_0xe1ec('0xd8')]['Label'][_0xe1ec('0xd4')]['Label'],'value':_0xe1ec('0xd9')});var _0x46d521={'id':_0x26fe9d+'_'+_0xa106fc[_0xe1ec('0xd2')],'name':_0xa106fc[_0xe1ec('0xd3')]['UserLocalizedLabel'][_0xe1ec('0xd0')],'custom':![],'options':_0x4bf0d5};_0x5392b4['push'](_0x46d521);return _0x5392b4;});}function getInputList(_0x1340fd,_0x3f6996,_0x13a870,_0x4039c7,_0x4030cf,_0x59554a,_0x168846){var _0x508832={'method':_0xe1ec('0xb2'),'uri':_0x1340fd+'EntityDefinitions('+_0x4030cf+_0xe1ec('0xcd')+_0x59554a+')/Microsoft.Dynamics.CRM.'+_0x13a870+_0xe1ec('0xda'),'headers':{'Authorization':_0xe1ec('0xb3')+_0x168846,'If-None-Match':null,'OData-Version':_0xe1ec('0xb8')},'json':!![]};return rp(_0x508832)[_0xe1ec('0x1c')](function(_0x9b2562){var _0xf5677f={'id':_0x3f6996+'_'+_0x9b2562[_0xe1ec('0xd2')],'name':_0x9b2562[_0xe1ec('0xd3')][_0xe1ec('0xd4')]?_0x9b2562[_0xe1ec('0xd3')]['UserLocalizedLabel'][_0xe1ec('0xd0')]:_0x9b2562[_0xe1ec('0xd2')],'custom':![],'options':[]};_0x4039c7['push'](_0xf5677f);return _0x4039c7;});} \ No newline at end of file +var _0x233e=['MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Attributes','remove','includes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','substring','StringAttributeMetadata','IntegerAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','UserLocalizedLabel','Label','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','Dynamics365Account','include','findAll','params','includeAll','options','find','create','body','getConfigurations','Dynamics365Configuration','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','incident','PhoneCall','title','description','customerid','ownerid','subject','phonenumber','regardingobjectid','directioncode','phonecall_activity_parties','accountidname','actualserviceunits','billedserviceunits','contactidname','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','influencescore','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyyominame','modifiedon','modifiedonbehalfbyyominame','msdyn_incidenttypename','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','socialprofileidname','statecode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','remoteUri','tenantId','clientId','clientSecret','slice','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','password','GET','Bearer\x20','4.0','value'];(function(_0x478126,_0x495f2d){var _0x27c7f4=function(_0x4bc558){while(--_0x4bc558){_0x478126['push'](_0x478126['shift']());}};_0x27c7f4(++_0x495f2d);}(_0x233e,0x1dd));var _0xe233=function(_0x316139,_0x1ba0ee){_0x316139=_0x316139-0x0;var _0xd28435=_0x233e[_0x316139];return _0xd28435;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xe233('0x0'));var rimraf=require(_0xe233('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe233('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xe233('0x3'));var Mustache=require(_0xe233('0x4'));var util=require(_0xe233('0x5'));var path=require(_0xe233('0x6'));var sox=require(_0xe233('0x7'));var csv=require(_0xe233('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xe233('0x9'));var squel=require(_0xe233('0xa'));var crypto=require(_0xe233('0xb'));var jsforce=require(_0xe233('0xc'));var deskjs=require(_0xe233('0xd'));var toCsv=require(_0xe233('0x8'));var querystring=require(_0xe233('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xe233('0xf'));var qs=require(_0xe233('0x10'));var as=require(_0xe233('0x11'));var hardwareService=require(_0xe233('0x12'));var logger=require(_0xe233('0x13'))('api');var utils=require(_0xe233('0x14'));var config=require(_0xe233('0x15'));var db=require(_0xe233('0x16'))['db'];var integrations=require(_0xe233('0x17'));var jayson=require(_0xe233('0x18'));var client=jayson[_0xe233('0x19')][_0xe233('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2d2460,_0x19180a,_0x38d2d4){if(_0x38d2d4){var _0x423bf8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x423bf8[_0xe233('0x1b')](_0x19180a)){return _0x2d2460;}else{throw new db[(_0xe233('0x1c'))][(_0xe233('0x1d'))](_0xe233('0x1e'));}}else{return _0x2d2460;}}function respondWithRpcPromise(_0x2d0d42,_0x5c09b8,_0x561655,_0x501d93){return new BPromise(function(_0x18d62a,_0x3634c1){var _0x3d916d=_0x501d93||client;return _0x3d916d[_0xe233('0x1f')](_0x2d0d42,_0x561655)[_0xe233('0x20')](function(_0x403cd9){logger[_0xe233('0x21')]('Dynamics365Account,\x20%s,\x20%s',_0x5c09b8,_0xe233('0x22'));logger['debug'](_0xe233('0x23'),_0x5c09b8,'request\x20sent',JSON[_0xe233('0x24')](_0x403cd9));if(_0x403cd9['error']){if(_0x403cd9[_0xe233('0x25')][_0xe233('0x26')]===0x1f4){logger[_0xe233('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x5c09b8,_0x403cd9['error'][_0xe233('0x27')]);return _0x3634c1(_0x403cd9[_0xe233('0x25')]['message']);}logger[_0xe233('0x25')]('Dynamics365Account,\x20%s,\x20%s',_0x5c09b8,_0x403cd9[_0xe233('0x25')][_0xe233('0x27')]);return _0x18d62a(_0x403cd9['error'][_0xe233('0x27')]);}else{logger[_0xe233('0x21')](_0xe233('0x28'),_0x5c09b8,_0xe233('0x22'));_0x18d62a(_0x403cd9[_0xe233('0x29')][_0xe233('0x27')]);}})[_0xe233('0x2a')](function(_0x2ae17d){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5c09b8,_0x2ae17d);_0x3634c1(_0x2ae17d);});});}function respondWithStatusCode(_0x577159,_0x19f81d){_0x19f81d=_0x19f81d||0xcc;return function(_0x3beab0){if(_0x3beab0){return _0x577159[_0xe233('0x2b')](_0x19f81d);}return _0x577159[_0xe233('0x2c')](_0x19f81d)[_0xe233('0x2d')]();};}function respondWithResult(_0x46e8f9,_0x5afd9c){_0x5afd9c=_0x5afd9c||0xc8;return function(_0x18a4be){if(_0x18a4be){return _0x46e8f9[_0xe233('0x2c')](_0x5afd9c)[_0xe233('0x2e')](_0x18a4be);}};}function respondWithFilteredResult(_0x5b832e,_0x420767){return function(_0x35adcd){if(_0x35adcd){var _0x4389ec=_0x35adcd[_0xe233('0x2f')],_0x6080c3=_0x420767['offset'],_0x1afe0f=_0x420767[_0xe233('0x30')]+_0x420767['limit'],_0x1fc185;if(_0x1afe0f>=_0x4389ec){_0x1afe0f=_0x4389ec;_0x1fc185=0xc8;}else{_0x1fc185=0xce;}_0x5b832e[_0xe233('0x2c')](_0x1fc185);return _0x5b832e[_0xe233('0x31')](_0xe233('0x32'),_0x6080c3+'-'+_0x1afe0f+'/'+_0x4389ec)[_0xe233('0x2e')](_0x35adcd);}return null;};}function patchUpdates(_0x476f19){return function(_0x2fbf8e){try{jsonpatch[_0xe233('0x33')](_0x2fbf8e,_0x476f19,!![]);}catch(_0x132428){return BPromise[_0xe233('0x34')](_0x132428);}return _0x2fbf8e[_0xe233('0x35')]();};}function saveUpdates(_0x4bd2e1,_0x124677){return function(_0x2928f3){if(_0x2928f3){return _0x2928f3[_0xe233('0x36')](_0x4bd2e1)[_0xe233('0x20')](function(_0x435acb){return _0x435acb;});}return null;};}function removeEntity(_0x1f6036,_0x1928f1){return function(_0x42f60b){if(_0x42f60b){return _0x42f60b[_0xe233('0x37')]()[_0xe233('0x20')](function(){_0x1f6036[_0xe233('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3621d1,_0x1eee28){return function(_0xdeca1b){if(!_0xdeca1b){_0x3621d1['sendStatus'](0x194);}return _0xdeca1b;};}function handleError(_0x3d89d7,_0x53cb8d){_0x53cb8d=_0x53cb8d||0x1f4;return function(_0x156453){logger['error'](_0x156453['stack']);if(_0x156453[_0xe233('0x38')]){delete _0x156453[_0xe233('0x38')];}_0x3d89d7[_0xe233('0x2c')](_0x53cb8d)['send'](_0x156453);};}exports[_0xe233('0x39')]=function(_0x485031,_0x227aff){var _0x58455d={},_0x34c7d6={},_0x2ed244={'count':0x0,'rows':[]};var _0x58804f=_[_0xe233('0x3a')](db['Dynamics365Account'][_0xe233('0x3b')],function(_0x4425d8){return{'name':_0x4425d8[_0xe233('0x3c')],'type':_0x4425d8[_0xe233('0x3d')][_0xe233('0x3e')]};});_0x34c7d6[_0xe233('0x3f')]=_['map'](_0x58804f,_0xe233('0x38'));_0x34c7d6[_0xe233('0x40')]=_[_0xe233('0x41')](_0x485031['query']);_0x34c7d6[_0xe233('0x42')]=_[_0xe233('0x43')](_0x34c7d6[_0xe233('0x3f')],_0x34c7d6[_0xe233('0x40')]);_0x58455d['attributes']=_[_0xe233('0x43')](_0x34c7d6['model'],qs[_0xe233('0x44')](_0x485031[_0xe233('0x40')]['fields']));_0x58455d[_0xe233('0x45')]=_0x58455d['attributes'][_0xe233('0x46')]?_0x58455d[_0xe233('0x45')]:_0x34c7d6[_0xe233('0x3f')];if(!_0x485031[_0xe233('0x40')][_0xe233('0x47')](_0xe233('0x48'))){_0x58455d[_0xe233('0x49')]=qs[_0xe233('0x49')](_0x485031['query'][_0xe233('0x49')]);_0x58455d[_0xe233('0x30')]=qs[_0xe233('0x30')](_0x485031[_0xe233('0x40')][_0xe233('0x30')]);}_0x58455d[_0xe233('0x4a')]=qs[_0xe233('0x4b')](_0x485031[_0xe233('0x40')][_0xe233('0x4b')]);_0x58455d[_0xe233('0x4c')]=qs['filters'](_['pick'](_0x485031[_0xe233('0x40')],_0x34c7d6[_0xe233('0x42')]));if(_0x485031[_0xe233('0x40')][_0xe233('0x4d')]){_0x58455d['where']=_[_0xe233('0x4e')](_0x58455d[_0xe233('0x4c')],{'$or':_[_0xe233('0x3a')](_0x58804f,function(_0x5d448a){if(_0x5d448a[_0xe233('0x3d')]!==_0xe233('0x4f')){var _0x97fafa={};_0x97fafa[_0x5d448a[_0xe233('0x38')]]={'$like':'%'+_0x485031[_0xe233('0x40')][_0xe233('0x4d')]+'%'};return _0x97fafa;}})});}_0x58455d=_[_0xe233('0x4e')]({},_0x58455d,_0x485031['options']);var _0x846991={'where':_0x58455d[_0xe233('0x4c')]};return db[_0xe233('0x50')]['count'](_0x846991)['then'](function(_0x38cf0b){_0x2ed244[_0xe233('0x2f')]=_0x38cf0b;if(_0x485031[_0xe233('0x40')]['includeAll']){_0x58455d[_0xe233('0x51')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xe233('0x52')](_0x58455d);})['then'](function(_0x3203d6){_0x2ed244['rows']=_0x3203d6;return _0x2ed244;})[_0xe233('0x20')](respondWithFilteredResult(_0x227aff,_0x58455d))[_0xe233('0x2a')](handleError(_0x227aff,null));};exports['show']=function(_0x440287,_0xc792c9){var _0x2b13e1={'raw':![],'where':{'id':_0x440287[_0xe233('0x53')]['id']}},_0x50cb8e={};_0x50cb8e[_0xe233('0x3f')]=_['keys'](db[_0xe233('0x50')][_0xe233('0x3b')]);_0x50cb8e[_0xe233('0x40')]=_[_0xe233('0x41')](_0x440287[_0xe233('0x40')]);_0x50cb8e['filters']=_['intersection'](_0x50cb8e[_0xe233('0x3f')],_0x50cb8e[_0xe233('0x40')]);_0x2b13e1[_0xe233('0x45')]=_['intersection'](_0x50cb8e[_0xe233('0x3f')],qs[_0xe233('0x44')](_0x440287[_0xe233('0x40')][_0xe233('0x44')]));_0x2b13e1[_0xe233('0x45')]=_0x2b13e1['attributes'][_0xe233('0x46')]?_0x2b13e1[_0xe233('0x45')]:_0x50cb8e[_0xe233('0x3f')];if(_0x440287[_0xe233('0x40')][_0xe233('0x54')]){_0x2b13e1[_0xe233('0x51')]=[{'all':!![]}];}_0x2b13e1=_['merge']({},_0x2b13e1,_0x440287[_0xe233('0x55')]);return db[_0xe233('0x50')][_0xe233('0x56')](_0x2b13e1)[_0xe233('0x20')](handleEntityNotFound(_0xc792c9,null))['then'](respondWithResult(_0xc792c9,null))['catch'](handleError(_0xc792c9,null));};exports[_0xe233('0x57')]=function(_0x49a585,_0x44f103){return db[_0xe233('0x50')][_0xe233('0x57')](_0x49a585[_0xe233('0x58')],{})[_0xe233('0x20')](respondWithResult(_0x44f103,0xc9))[_0xe233('0x2a')](handleError(_0x44f103,null));};exports[_0xe233('0x36')]=function(_0x368150,_0x54cb29){if(_0x368150['body']['id']){delete _0x368150[_0xe233('0x58')]['id'];}return db[_0xe233('0x50')][_0xe233('0x56')]({'where':{'id':_0x368150['params']['id']}})[_0xe233('0x20')](handleEntityNotFound(_0x54cb29,null))[_0xe233('0x20')](saveUpdates(_0x368150[_0xe233('0x58')],null))[_0xe233('0x20')](respondWithResult(_0x54cb29,null))[_0xe233('0x2a')](handleError(_0x54cb29,null));};exports['destroy']=function(_0x453158,_0x427f04){return db[_0xe233('0x50')][_0xe233('0x56')]({'where':{'id':_0x453158[_0xe233('0x53')]['id']}})[_0xe233('0x20')](handleEntityNotFound(_0x427f04,null))[_0xe233('0x20')](removeEntity(_0x427f04,null))['catch'](handleError(_0x427f04,null));};exports[_0xe233('0x59')]=function(_0x1d4813,_0x512cee,_0x563bd5){var _0x97dcf5={};var _0x43b6b7={};var _0x894fbc;var _0x590f53;return db[_0xe233('0x50')]['findOne']({'where':{'id':_0x1d4813['params']['id']}})[_0xe233('0x20')](handleEntityNotFound(_0x512cee,null))['then'](function(_0x517b49){if(_0x517b49){_0x894fbc=_0x517b49;_0x43b6b7[_0xe233('0x3f')]=_[_0xe233('0x41')](db[_0xe233('0x5a')]['rawAttributes']);_0x43b6b7[_0xe233('0x40')]=_[_0xe233('0x41')](_0x1d4813[_0xe233('0x40')]);_0x43b6b7[_0xe233('0x42')]=_[_0xe233('0x43')](_0x43b6b7['model'],_0x43b6b7[_0xe233('0x40')]);_0x97dcf5['attributes']=_[_0xe233('0x43')](_0x43b6b7['model'],qs[_0xe233('0x44')](_0x1d4813[_0xe233('0x40')][_0xe233('0x44')]));_0x97dcf5[_0xe233('0x45')]=_0x97dcf5[_0xe233('0x45')]['length']?_0x97dcf5[_0xe233('0x45')]:_0x43b6b7[_0xe233('0x3f')];_0x97dcf5[_0xe233('0x4a')]=qs['sort'](_0x1d4813[_0xe233('0x40')][_0xe233('0x4b')]);_0x97dcf5[_0xe233('0x4c')]=qs['filters'](_['pick'](_0x1d4813['query'],_0x43b6b7[_0xe233('0x42')]));if(_0x1d4813['query']['filter']){_0x97dcf5['where']=_['merge'](_0x97dcf5[_0xe233('0x4c')],{'$or':_[_0xe233('0x3a')](_0x97dcf5['attributes'],function(_0x2e55b6){var _0x13d724={};_0x13d724[_0x2e55b6]={'$like':'%'+_0x1d4813[_0xe233('0x40')]['filter']+'%'};return _0x13d724;})});}_0x97dcf5=_[_0xe233('0x4e')]({},_0x97dcf5,_0x1d4813[_0xe233('0x55')]);return _0x894fbc['getConfigurations'](_0x97dcf5);}})['then'](function(_0x3c7405){if(_0x3c7405){_0x590f53=_0x3c7405[_0xe233('0x46')];if(!_0x1d4813[_0xe233('0x40')][_0xe233('0x47')]('nolimit')){_0x97dcf5[_0xe233('0x49')]=qs[_0xe233('0x49')](_0x1d4813['query'][_0xe233('0x49')]);_0x97dcf5[_0xe233('0x30')]=qs[_0xe233('0x30')](_0x1d4813[_0xe233('0x40')]['offset']);}return _0x894fbc[_0xe233('0x59')](_0x97dcf5);}})[_0xe233('0x20')](function(_0x344e76){if(_0x344e76){return _0x344e76?{'count':_0x590f53,'rows':_0x344e76}:null;}})[_0xe233('0x20')](respondWithResult(_0x512cee,null))[_0xe233('0x2a')](handleError(_0x512cee,null));};exports[_0xe233('0x5b')]=function(_0x5ee4ed,_0x528229,_0x2ac06b){if(_0x5ee4ed['body']['id']){delete _0x5ee4ed['body']['id'];}return db[_0xe233('0x50')][_0xe233('0x5c')]({'where':{'id':_0x5ee4ed['params']['id']}})[_0xe233('0x20')](handleEntityNotFound(_0x528229,null))['then'](function(_0x23ceaa){if(_0x23ceaa){_0x5ee4ed[_0xe233('0x58')][_0xe233('0x5d')]=_0x23ceaa['id'];_0x5ee4ed[_0xe233('0x58')][_0xe233('0x5e')]=integrations[_0xe233('0x5f')](_0x5ee4ed[_0xe233('0x58')][_0xe233('0x60')],_0x5ee4ed[_0xe233('0x58')][_0xe233('0x3d')]);_0x5ee4ed[_0xe233('0x58')][_0xe233('0x61')]=integrations[_0xe233('0x62')](_0x5ee4ed[_0xe233('0x58')][_0xe233('0x60')],_0x5ee4ed[_0xe233('0x58')][_0xe233('0x3d')]);return db[_0xe233('0x5a')][_0xe233('0x57')](_0x5ee4ed[_0xe233('0x58')],{'include':[{'model':db[_0xe233('0x63')],'as':_0xe233('0x5e')},{'model':db[_0xe233('0x63')],'as':_0xe233('0x61')}]});}return null;})[_0xe233('0x20')](respondWithResult(_0x528229,null))[_0xe233('0x2a')](handleError(_0x528229,null));};exports['getFields']=function(_0x5cad7a,_0x18a0c6,_0x5bc105){var _0x15b2e1=_0x5cad7a[_0xe233('0x40')]['ticketType'];var _0x22014c=_0x15b2e1===_0xe233('0x64')?'Incident':_0xe233('0x65');var _0xd8924f='';var _0x20c1d3='';var _0x34670a='';var _0x42c3bc='';var _0x47f2ec='';var _0x2d0784='';var _0x530356='';var _0x4a668c='';var _0x411053=[_0xe233('0x66'),_0xe233('0x67'),_0xe233('0x68'),_0xe233('0x69'),'caseorigincode',_0xe233('0x6a'),_0xe233('0x6b'),_0xe233('0x6c'),_0xe233('0x6d'),_0xe233('0x6e')];var _0x273fbb=[_0xe233('0x6f'),'accountidyominame',_0xe233('0x70'),_0xe233('0x71'),_0xe233('0x72'),_0xe233('0x73'),_0xe233('0x74'),_0xe233('0x75'),_0xe233('0x76'),_0xe233('0x77'),_0xe233('0x78'),_0xe233('0x79'),_0xe233('0x7a'),_0xe233('0x7b'),_0xe233('0x7c'),_0xe233('0x7d'),_0xe233('0x7e'),_0xe233('0x7f'),_0xe233('0x80'),_0xe233('0x81'),_0xe233('0x82'),_0xe233('0x83'),_0xe233('0x84'),_0xe233('0x85'),'firstresponsebykpiidname','followupby','importsequencenumber',_0xe233('0x86'),_0xe233('0x87'),_0xe233('0x88'),'masteridname',_0xe233('0x89'),_0xe233('0x8a'),'modifiedbyname',_0xe233('0x8b'),_0xe233('0x8c'),'modifiedonbehalfbyname',_0xe233('0x8d'),_0xe233('0x8e'),'msdyn_iotalertname',_0xe233('0x8f'),_0xe233('0x90'),_0xe233('0x91'),_0xe233('0x92'),_0xe233('0x93'),_0xe233('0x94'),_0xe233('0x95'),_0xe233('0x96'),'primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby',_0xe233('0x97'),_0xe233('0x98'),_0xe233('0x99'),'responsiblecontactidyominame',_0xe233('0x9a'),_0xe233('0x9b'),_0xe233('0x9c'),_0xe233('0x9d'),_0xe233('0x9e'),'statuscode',_0xe233('0x9f'),_0xe233('0xa0'),_0xe233('0xa1'),_0xe233('0xa2'),_0xe233('0xa3'),_0xe233('0xa4'),_0xe233('0xa5')];var _0x11d63f=_0x411053['concat'](_0x273fbb);return db[_0xe233('0x50')][_0xe233('0x5c')]({'where':{'id':_0x5cad7a[_0xe233('0x53')]['id']},'attributes':['id',_0xe233('0xa6'),'password',_0xe233('0xa7'),_0xe233('0xa8'),_0xe233('0xa9'),_0xe233('0xaa')]})[_0xe233('0x20')](handleEntityNotFound(_0x18a0c6,null))[_0xe233('0x20')](function(_0x49fe3c){if(_0x49fe3c){_0x4a668c=_0x49fe3c[_0xe233('0xa7')];var _0xb7fb83=_0x4a668c[_0xe233('0xab')](-0x1);if(_0xb7fb83==='/'){_0x4a668c=_0x4a668c['substring'](0x0,_0x4a668c[_0xe233('0xac')](_0xb7fb83));}_0x530356=util[_0xe233('0xad')](_0xe233('0xae'),_0x4a668c);var _0x16fbe6={'method':_0xe233('0xaf'),'uri':_0xe233('0xb0')+_0x49fe3c[_0xe233('0xa8')]+_0xe233('0xb1'),'form':{'client_id':_0x49fe3c['clientId'],'resource':_0x4a668c,'username':_0x49fe3c['username'],'password':_0x49fe3c[_0xe233('0xb2')],'grant_type':_0xe233('0xb2'),'client_secret':_0x49fe3c[_0xe233('0xaa')]},'json':!![]};return rp(_0x16fbe6);}})[_0xe233('0x20')](function(_0x5552a0){_0x2d0784=_0x5552a0['access_token'];var _0x2bcb30={'method':_0xe233('0xb3'),'uri':encodeURI(_0x530356+'EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27'+_0x22014c+'\x27'),'headers':{'Authorization':_0xe233('0xb4')+_0x2d0784,'If-None-Match':null,'OData-Version':_0xe233('0xb5')},'json':!![]};return rp(_0x2bcb30);})['then'](function(_0x237200){var _0x42982a=_0x237200[_0xe233('0xb6')][0x0];var _0xe6e021=_0x42982a[_0xe233('0xb7')];var _0x12e403={'method':_0xe233('0xb3'),'uri':_0x530356+_0xe233('0xb8')+_0xe6e021+_0xe233('0xb9'),'headers':{'Authorization':_0xe233('0xb4')+_0x2d0784,'If-None-Match':null,'OData-Version':_0xe233('0xb5')},'json':!![]};return rp(_0x12e403);})[_0xe233('0x20')](function(_0x35162e){_0xd8924f=_0x35162e;_0x20c1d3=_0xd8924f[_0xe233('0xba')];_0x20c1d3=_[_0xe233('0xbb')](_0x20c1d3,function(_0x57b9ba){return!_0x11d63f[_0xe233('0xbc')](_0x57b9ba[_0xe233('0xbd')]);});var _0x534103=[];var _0x3c8fb4=[];_0x20c1d3[_0xe233('0xbe')](function(_0x4d000a){if(_0x4d000a[_0xe233('0xbf')]){var _0x5a2082=_0x4d000a[_0xe233('0xbf')]['substring'](_0x4d000a[_0xe233('0xbf')][_0xe233('0xac')]('.')+0x1);if(_0x5a2082===_0xe233('0xc0')){_0x534103[_0xe233('0xc1')](getSelectList(_0x530356,_0x15b2e1,_0x3c8fb4,_0xd8924f[_0xe233('0xb7')],_0x4d000a[_0xe233('0xb7')],_0x2d0784));}}});return Promise[_0xe233('0xc2')](_0x534103);})['then'](function(_0x5daeb2){_0x34670a=_0x5daeb2[0x0];var _0x551be1=[];var _0x27f22=[];_0x20c1d3[_0xe233('0xbe')](function(_0x491f00){if(!_[_0xe233('0xc3')](_0x491f00[_0xe233('0xbf')])){var _0x4ca79b=_0x491f00[_0xe233('0xbf')][_0xe233('0xc4')](_0x491f00[_0xe233('0xbf')][_0xe233('0xac')]('.')+0x1);if(_0x4ca79b==='BooleanAttributeMetadata'){_0x551be1[_0xe233('0xc1')](getBooleanList(_0x530356,_0x15b2e1,_0x27f22,_0xd8924f[_0xe233('0xb7')],_0x491f00['MetadataId'],_0x2d0784));}}});return Promise[_0xe233('0xc2')](_0x551be1);})[_0xe233('0x20')](function(_0x195022){_0x42c3bc=_0x195022[0x0];var _0x17884b=[];var _0x5f223e=[];_0x20c1d3[_0xe233('0xbe')](function(_0x808f71){if(_0x808f71[_0xe233('0xbf')]){var _0x16d063=_0x808f71[_0xe233('0xbf')][_0xe233('0xc4')](_0x808f71[_0xe233('0xbf')][_0xe233('0xac')]('.')+0x1);if(_0x16d063===_0xe233('0xc5')||_0x16d063==='DoubleAttributeMetadata'||_0x16d063==='BigIntAttributeMetadata'||_0x16d063===_0xe233('0xc6')||_0x16d063==='MemoAttributeMetadata'||_0x16d063==='DateTimeAttributeMetadata'||_0x16d063===_0xe233('0xc7')||_0x16d063===_0xe233('0xc8')||_0x16d063===_0xe233('0xc9')||_0x16d063===_0xe233('0xca')){_0x17884b['push'](getInputList(_0x530356,_0x15b2e1,_0x16d063,_0x5f223e,_0xd8924f[_0xe233('0xb7')],_0x808f71[_0xe233('0xb7')],_0x2d0784));}}});return Promise[_0xe233('0xc2')](_0x17884b);})[_0xe233('0x20')](function(_0x260a10){_0x47f2ec=_0x260a10[0x0];var _0x2a2a50=_0x34670a['concat'](_0x42c3bc)['concat'](_0x47f2ec);var _0x181951={'count':_0x2a2a50[_0xe233('0x46')],'rows':_0x2a2a50};return _0x181951;})['then'](respondWithResult(_0x18a0c6,null))['catch'](function(_0x39ab42){var _0x21d5fe=_0x5cad7a[_0xe233('0x40')][_0xe233('0x1b')]?0x1f4:_0x39ab42[_0xe233('0xcb')]||0x1f4;logger[_0xe233('0x25')](_0x39ab42['stack']);delete _0x39ab42['name'];if(_0x21d5fe===0x191){_0x21d5fe=0x190;}_0x18a0c6[_0xe233('0x2c')](_0x21d5fe)['send'](_0x5cad7a[_0xe233('0x40')][_0xe233('0x1b')]?{'message':_0xe233('0xcc'),'statusCode':_0x39ab42[_0xe233('0xcb')]}:_0x39ab42);});};function getSelectList(_0x30abae,_0x6a6e3b,_0x29e283,_0x119580,_0x5607e5,_0x1f25d7){var _0x13fbc8={'method':_0xe233('0xb3'),'uri':_0x30abae+_0xe233('0xb8')+_0x119580+_0xe233('0xcd')+_0x5607e5+_0xe233('0xce')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':'Bearer\x20'+_0x1f25d7,'If-None-Match':null,'OData-Version':_0xe233('0xb5')},'json':!![]};return rp(_0x13fbc8)[_0xe233('0x20')](function(_0x3f19cd){var _0x3cf0b2=[];var _0x5282e0=_0x3f19cd[_0xe233('0xcf')][_0xe233('0xd0')];_0x5282e0[_0xe233('0xbe')](function(_0xc14256){_0x3cf0b2[_0xe233('0xc1')]({'name':_0xc14256['Label'][_0xe233('0xd1')][_0xe233('0xd2')],'value':String(_0xc14256[_0xe233('0xd3')])});});var _0x44fdc6={'id':_0x6a6e3b+'_'+_0x3f19cd['LogicalName'],'name':_0x3f19cd[_0xe233('0xd4')][_0xe233('0xd1')][_0xe233('0xd2')],'custom':![],'options':_0x3cf0b2};_0x29e283[_0xe233('0xc1')](_0x44fdc6);return _0x29e283;});}function getBooleanList(_0x34d1fd,_0x50598d,_0xe39075,_0x1b9fd4,_0x380220,_0x2af2e2){var _0x59f545={'method':_0xe233('0xb3'),'uri':_0x34d1fd+_0xe233('0xb8')+_0x1b9fd4+')/Attributes('+_0x380220+_0xe233('0xd5'),'headers':{'Authorization':'Bearer\x20'+_0x2af2e2,'If-None-Match':null,'OData-Version':_0xe233('0xb5')},'json':!![]};return rp(_0x59f545)[_0xe233('0x20')](function(_0x3be1b5){var _0x3cf953=[];_0x3cf953[_0xe233('0xc1')]({'name':_0x3be1b5[_0xe233('0xcf')][_0xe233('0xd6')][_0xe233('0xd2')][_0xe233('0xd1')][_0xe233('0xd2')],'value':_0xe233('0xd7')},{'name':_0x3be1b5[_0xe233('0xcf')][_0xe233('0xd8')][_0xe233('0xd2')][_0xe233('0xd1')][_0xe233('0xd2')],'value':_0xe233('0xd9')});var _0x2abbee={'id':_0x50598d+'_'+_0x3be1b5[_0xe233('0xbd')],'name':_0x3be1b5[_0xe233('0xd4')][_0xe233('0xd1')][_0xe233('0xd2')],'custom':![],'options':_0x3cf953};_0xe39075[_0xe233('0xc1')](_0x2abbee);return _0xe39075;});}function getInputList(_0xd86bc4,_0x4462c7,_0x411e58,_0x5ad3c4,_0x3df8ba,_0x42af0c,_0x48c73a){var _0x566517={'method':_0xe233('0xb3'),'uri':_0xd86bc4+_0xe233('0xb8')+_0x3df8ba+_0xe233('0xcd')+_0x42af0c+_0xe233('0xda')+_0x411e58+_0xe233('0xdb'),'headers':{'Authorization':_0xe233('0xb4')+_0x48c73a,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x566517)[_0xe233('0x20')](function(_0x88df7d){var _0x4800dd={'id':_0x4462c7+'_'+_0x88df7d[_0xe233('0xbd')],'name':_0x88df7d[_0xe233('0xd4')]['UserLocalizedLabel']?_0x88df7d['DisplayName']['UserLocalizedLabel']['Label']:_0x88df7d[_0xe233('0xbd')],'custom':![],'options':[]};_0x5ad3c4[_0xe233('0xc1')](_0x4800dd);return _0x5ad3c4;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index c150e6a..2c04fc2 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 _0xbdfe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intDynamics365Account.attributes','Dynamics365Account'];(function(_0xa96158,_0xf02370){var _0x33c3ca=function(_0x5056d7){while(--_0x5056d7){_0xa96158['push'](_0xa96158['shift']());}};_0x33c3ca(++_0xf02370);}(_0xbdfe,0x134));var _0xebdf=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0xbdfe[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0xebdf('0x0'));var util=require(_0xebdf('0x1'));var logger=require(_0xebdf('0x2'))(_0xebdf('0x3'));var moment=require(_0xebdf('0x4'));var BPromise=require(_0xebdf('0x5'));var rp=require(_0xebdf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xebdf('0x7'));var config=require(_0xebdf('0x8'));var attributes=require(_0xebdf('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3622e1,_0x42a515){return _0x3622e1['define'](_0xebdf('0xa'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71a9=['path','rimraf','../../components/integrations/configuration','exports','define','Dynamics365Account','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x71a9,0x17a));var _0x971a=function(_0x104119,_0x2e9f28){_0x104119=_0x104119-0x0;var _0x901609=_0x71a9[_0x104119];return _0x901609;};'use strict';var _=require(_0x971a('0x0'));var util=require('util');var logger=require(_0x971a('0x1'))(_0x971a('0x2'));var moment=require(_0x971a('0x3'));var BPromise=require(_0x971a('0x4'));var rp=require(_0x971a('0x5'));var fs=require('fs');var path=require(_0x971a('0x6'));var rimraf=require(_0x971a('0x7'));var config=require('../../config/environment');var attributes=require('./intDynamics365Account.attributes');var integrations=require(_0x971a('0x8'));module[_0x971a('0x9')]=function(_0x502299,_0x3258e7){return _0x502299[_0x971a('0xa')](_0x971a('0xb'),attributes,{'tableName':'int_dynamics365_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index d9eacc1..65dafe0 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 _0xaf0d=['request','request\x20sent','debug','stringify','error','Dynamics365Account,\x20%s,\x20%s','message','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit','map','include','model','then','ShowDynamics365Account','info','util','moment','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x2ed8f3,_0x4aa12f){var _0x525a55=function(_0x4cfb58){while(--_0x4cfb58){_0x2ed8f3['push'](_0x2ed8f3['shift']());}};_0x525a55(++_0x4aa12f);}(_0xaf0d,0x6d));var _0xdaf0=function(_0x3094bb,_0x3ee41f){_0x3094bb=_0x3094bb-0x0;var _0x4f73a2=_0xaf0d[_0x3094bb];return _0x4f73a2;};'use strict';var _=require('lodash');var util=require(_0xdaf0('0x0'));var moment=require(_0xdaf0('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xdaf0('0x2'))(_0xdaf0('0x3'));var config=require(_0xdaf0('0x4'));var jayson=require('jayson/promise');var client=jayson[_0xdaf0('0x5')][_0xdaf0('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x53aec7,_0x5ad050,_0x26bda3){return new BPromise(function(_0x1dc345,_0x16d746){return client[_0xdaf0('0x7')](_0x53aec7,_0x26bda3)['then'](function(_0x528d8a){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'));logger[_0xdaf0('0x9')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x5ad050,_0xdaf0('0x8'),JSON[_0xdaf0('0xa')](_0x528d8a));if(_0x528d8a[_0xdaf0('0xb')]){if(_0x528d8a[_0xdaf0('0xb')]['code']===0x1f4){logger[_0xdaf0('0xb')](_0xdaf0('0xc'),_0x5ad050,_0x528d8a[_0xdaf0('0xb')]['message']);return _0x16d746(_0x528d8a[_0xdaf0('0xb')][_0xdaf0('0xd')]);}logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x5ad050,_0x528d8a['error']['message']);return _0x1dc345(_0x528d8a['error'][_0xdaf0('0xd')]);}else{logger['info'](_0xdaf0('0xc'),_0x5ad050,'request\x20sent');_0x1dc345(_0x528d8a['result'][_0xdaf0('0xd')]);}})[_0xdaf0('0xe')](function(_0x370345){logger['error'](_0xdaf0('0xc'),_0x5ad050,_0x370345);_0x16d746(_0x370345);});});}exports[_0xdaf0('0xf')]=function(_0x21db47){var _0x4b8588=this;return new Promise(function(_0x5a2180,_0xb6b5e2){return db[_0xdaf0('0x10')][_0xdaf0('0x11')]({'raw':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x13')]===undefined?!![]:![]:!![],'where':_0x21db47[_0xdaf0('0x12')]?_0x21db47['options'][_0xdaf0('0x14')]||null:null,'attributes':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'limit':_0x21db47['options']?_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x16')]||null:null,'include':_0x21db47[_0xdaf0('0x12')]?_0x21db47[_0xdaf0('0x12')]['include']?_[_0xdaf0('0x17')](_0x21db47[_0xdaf0('0x12')][_0xdaf0('0x18')],function(_0x13abfc){return{'model':db[_0x13abfc[_0xdaf0('0x19')]],'as':_0x13abfc['as'],'attributes':_0x13abfc[_0xdaf0('0x15')],'include':_0x13abfc[_0xdaf0('0x18')]?_['map'](_0x13abfc[_0xdaf0('0x18')],function(_0x33e5c2){return{'model':db[_0x33e5c2[_0xdaf0('0x19')]],'as':_0x33e5c2['as'],'attributes':_0x33e5c2[_0xdaf0('0x15')],'include':_0x33e5c2[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x33e5c2[_0xdaf0('0x18')],function(_0x4d3347){return{'model':db[_0x4d3347[_0xdaf0('0x19')]],'as':_0x4d3347['as'],'attributes':_0x4d3347['attributes']};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x740ff){logger['info'](_0xdaf0('0xf'),_0x21db47);logger['debug'](_0xdaf0('0xf'),_0x21db47,JSON[_0xdaf0('0xa')](_0x740ff));_0x5a2180(_0x740ff);})['catch'](function(_0xaf86cb){logger[_0xdaf0('0xb')](_0xdaf0('0xf'),_0xaf86cb[_0xdaf0('0xd')],_0x21db47);_0xb6b5e2(_0x4b8588[_0xdaf0('0xb')](0x1f4,_0xaf86cb['message']));});});};exports[_0xdaf0('0x1b')]=function(_0x16821a){var _0x3018b8=this;return new Promise(function(_0x570df5,_0x443cc7){return db[_0xdaf0('0x10')]['find']({'raw':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')]['raw']===undefined?!![]:![]:!![],'where':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x14')]||null:null,'attributes':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x15')]||null:null,'include':_0x16821a[_0xdaf0('0x12')]?_0x16821a[_0xdaf0('0x12')][_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x16821a[_0xdaf0('0x12')]['include'],function(_0x5b955e){return{'model':db[_0x5b955e['model']],'as':_0x5b955e['as'],'attributes':_0x5b955e[_0xdaf0('0x15')],'include':_0x5b955e[_0xdaf0('0x18')]?_['map'](_0x5b955e[_0xdaf0('0x18')],function(_0x2128cc){return{'model':db[_0x2128cc[_0xdaf0('0x19')]],'as':_0x2128cc['as'],'attributes':_0x2128cc[_0xdaf0('0x15')],'include':_0x2128cc[_0xdaf0('0x18')]?_[_0xdaf0('0x17')](_0x2128cc[_0xdaf0('0x18')],function(_0x399116){return{'model':db[_0x399116[_0xdaf0('0x19')]],'as':_0x399116['as'],'attributes':_0x399116[_0xdaf0('0x15')]};}):[]};}):[]};}):[]:[]})[_0xdaf0('0x1a')](function(_0x1a9838){logger[_0xdaf0('0x1c')](_0xdaf0('0x1b'),_0x16821a);logger[_0xdaf0('0x9')](_0xdaf0('0x1b'),_0x16821a,JSON[_0xdaf0('0xa')](_0x1a9838));_0x570df5(_0x1a9838);})['catch'](function(_0xe61d26){logger[_0xdaf0('0xb')](_0xdaf0('0x1b'),_0xe61d26[_0xdaf0('0xd')],_0x16821a);_0x443cc7(_0x3018b8[_0xdaf0('0xb')](0x1f4,_0xe61d26[_0xdaf0('0xd')]));});});}; \ No newline at end of file +var _0xe0ae=['map','include','model','ShowDynamics365Account','find','then','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','http','info','Dynamics365Account,\x20%s,\x20%s','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','GetDynamics365Account','Dynamics365Account','findAll','options','raw','where','attributes','limit'];(function(_0x2d7b97,_0x3c00c5){var _0xd20f92=function(_0x217cdf){while(--_0x217cdf){_0x2d7b97['push'](_0x2d7b97['shift']());}};_0xd20f92(++_0x3c00c5);}(_0xe0ae,0xa1));var _0xee0a=function(_0x367336,_0x18c229){_0x367336=_0x367336-0x0;var _0x3423a7=_0xe0ae[_0x367336];return _0x3423a7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xee0a('0x0'));var BPromise=require(_0xee0a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee0a('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xee0a('0x3'));var logger=require(_0xee0a('0x4'))('rpc');var config=require(_0xee0a('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0xee0a('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x1c5071,_0x347cb3,_0x344355){return new BPromise(function(_0x5e6d2e,_0x2296b9){return client['request'](_0x1c5071,_0x344355)['then'](function(_0x1f9d42){logger[_0xee0a('0x7')](_0xee0a('0x8'),_0x347cb3,'request\x20sent');logger[_0xee0a('0x9')](_0xee0a('0xa'),_0x347cb3,'request\x20sent',JSON[_0xee0a('0xb')](_0x1f9d42));if(_0x1f9d42['error']){if(_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xd')]===0x1f4){logger['error'](_0xee0a('0x8'),_0x347cb3,_0x1f9d42['error'][_0xee0a('0xe')]);return _0x2296b9(_0x1f9d42[_0xee0a('0xc')]['message']);}logger['error'](_0xee0a('0x8'),_0x347cb3,_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xe')]);return _0x5e6d2e(_0x1f9d42[_0xee0a('0xc')][_0xee0a('0xe')]);}else{logger['info'](_0xee0a('0x8'),_0x347cb3,_0xee0a('0xf'));_0x5e6d2e(_0x1f9d42['result'][_0xee0a('0xe')]);}})[_0xee0a('0x10')](function(_0x1bc8e1){logger[_0xee0a('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x347cb3,_0x1bc8e1);_0x2296b9(_0x1bc8e1);});});}exports[_0xee0a('0x11')]=function(_0x1d7a8a){var _0x14ef67=this;return new Promise(function(_0x55c474,_0x1c1be5){return db[_0xee0a('0x12')][_0xee0a('0x13')]({'raw':_0x1d7a8a[_0xee0a('0x14')]?_0x1d7a8a['options'][_0xee0a('0x15')]===undefined?!![]:![]:!![],'where':_0x1d7a8a[_0xee0a('0x14')]?_0x1d7a8a[_0xee0a('0x14')][_0xee0a('0x16')]||null:null,'attributes':_0x1d7a8a['options']?_0x1d7a8a[_0xee0a('0x14')][_0xee0a('0x17')]||null:null,'limit':_0x1d7a8a[_0xee0a('0x14')]?_0x1d7a8a[_0xee0a('0x14')][_0xee0a('0x18')]||null:null,'include':_0x1d7a8a[_0xee0a('0x14')]?_0x1d7a8a[_0xee0a('0x14')]['include']?_[_0xee0a('0x19')](_0x1d7a8a[_0xee0a('0x14')][_0xee0a('0x1a')],function(_0x38d029){return{'model':db[_0x38d029['model']],'as':_0x38d029['as'],'attributes':_0x38d029[_0xee0a('0x17')],'include':_0x38d029[_0xee0a('0x1a')]?_[_0xee0a('0x19')](_0x38d029[_0xee0a('0x1a')],function(_0x4c61e2){return{'model':db[_0x4c61e2['model']],'as':_0x4c61e2['as'],'attributes':_0x4c61e2['attributes'],'include':_0x4c61e2[_0xee0a('0x1a')]?_['map'](_0x4c61e2['include'],function(_0x1c9ad8){return{'model':db[_0x1c9ad8[_0xee0a('0x1b')]],'as':_0x1c9ad8['as'],'attributes':_0x1c9ad8[_0xee0a('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3c3d48){logger[_0xee0a('0x7')](_0xee0a('0x11'),_0x1d7a8a);logger[_0xee0a('0x9')](_0xee0a('0x11'),_0x1d7a8a,JSON[_0xee0a('0xb')](_0x3c3d48));_0x55c474(_0x3c3d48);})[_0xee0a('0x10')](function(_0x408909){logger[_0xee0a('0xc')](_0xee0a('0x11'),_0x408909['message'],_0x1d7a8a);_0x1c1be5(_0x14ef67[_0xee0a('0xc')](0x1f4,_0x408909[_0xee0a('0xe')]));});});};exports[_0xee0a('0x1c')]=function(_0x34569c){var _0x45feeb=this;return new Promise(function(_0x3faad3,_0x4cf1df){return db[_0xee0a('0x12')][_0xee0a('0x1d')]({'raw':_0x34569c[_0xee0a('0x14')]?_0x34569c[_0xee0a('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x34569c[_0xee0a('0x14')]?_0x34569c['options'][_0xee0a('0x16')]||null:null,'attributes':_0x34569c[_0xee0a('0x14')]?_0x34569c[_0xee0a('0x14')][_0xee0a('0x17')]||null:null,'include':_0x34569c[_0xee0a('0x14')]?_0x34569c[_0xee0a('0x14')][_0xee0a('0x1a')]?_[_0xee0a('0x19')](_0x34569c['options'][_0xee0a('0x1a')],function(_0x1d4578){return{'model':db[_0x1d4578['model']],'as':_0x1d4578['as'],'attributes':_0x1d4578[_0xee0a('0x17')],'include':_0x1d4578[_0xee0a('0x1a')]?_[_0xee0a('0x19')](_0x1d4578['include'],function(_0x131b60){return{'model':db[_0x131b60[_0xee0a('0x1b')]],'as':_0x131b60['as'],'attributes':_0x131b60[_0xee0a('0x17')],'include':_0x131b60['include']?_[_0xee0a('0x19')](_0x131b60[_0xee0a('0x1a')],function(_0x340dc8){return{'model':db[_0x340dc8['model']],'as':_0x340dc8['as'],'attributes':_0x340dc8['attributes']};}):[]};}):[]};}):[]:[]})[_0xee0a('0x1e')](function(_0x10e8a5){logger[_0xee0a('0x7')](_0xee0a('0x1c'),_0x34569c);logger[_0xee0a('0x9')](_0xee0a('0x1c'),_0x34569c,JSON[_0xee0a('0xb')](_0x10e8a5));_0x3faad3(_0x10e8a5);})[_0xee0a('0x10')](function(_0x22d505){logger['error'](_0xee0a('0x1c'),_0x22d505[_0xee0a('0xe')],_0x34569c);_0x4cf1df(_0x45feeb['error'](0x1f4,_0x22d505[_0xee0a('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index b9f987e..dd2d438 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 _0x77e0=['util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','isAuthenticated','/:id','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','exports','multer'];(function(_0x2deb15,_0x102a17){var _0x1abb33=function(_0x1a1a10){while(--_0x1a1a10){_0x2deb15['push'](_0x2deb15['shift']());}};_0x1abb33(++_0x102a17);}(_0x77e0,0xdb));var _0x077e=function(_0x54df53,_0x170cfc){_0x54df53=_0x54df53-0x0;var _0x322e63=_0x77e0[_0x54df53];return _0x322e63;};'use strict';var multer=require(_0x077e('0x0'));var util=require(_0x077e('0x1'));var path=require(_0x077e('0x2'));var timeout=require(_0x077e('0x3'));var express=require(_0x077e('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x077e('0x5'));var config=require(_0x077e('0x6'));var controller=require(_0x077e('0x7'));router[_0x077e('0x8')]('/',auth[_0x077e('0x9')](),controller['index']);router['get'](_0x077e('0xa'),auth[_0x077e('0x9')](),controller[_0x077e('0xb')]);router[_0x077e('0x8')](_0x077e('0xc'),auth[_0x077e('0x9')](),controller[_0x077e('0xd')]);router[_0x077e('0x8')]('/:id/subjects',auth[_0x077e('0x9')](),controller[_0x077e('0xe')]);router['get'](_0x077e('0xf'),auth[_0x077e('0x9')](),controller[_0x077e('0x10')]);router[_0x077e('0x11')]('/',auth[_0x077e('0x9')](),controller['create']);router[_0x077e('0x12')](_0x077e('0xa'),auth[_0x077e('0x9')](),controller[_0x077e('0x13')]);router[_0x077e('0x14')](_0x077e('0xa'),auth[_0x077e('0x9')](),controller['destroy']);module[_0x077e('0x15')]=router; \ No newline at end of file +var _0x5520=['destroy','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','post','update','delete'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x5520,0x12d));var _0x0552=function(_0x5af673,_0x4b6254){_0x5af673=_0x5af673-0x0;var _0x42f51b=_0x5520[_0x5af673];return _0x42f51b;};'use strict';var multer=require(_0x0552('0x0'));var util=require(_0x0552('0x1'));var path=require(_0x0552('0x2'));var timeout=require(_0x0552('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x0552('0x4'));var interaction=require(_0x0552('0x5'));var config=require(_0x0552('0x6'));var controller=require(_0x0552('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x0552('0x8')]);router[_0x0552('0x9')](_0x0552('0xa'),auth[_0x0552('0xb')](),controller[_0x0552('0xc')]);router[_0x0552('0x9')](_0x0552('0xd'),auth[_0x0552('0xb')](),controller[_0x0552('0xe')]);router[_0x0552('0x9')]('/:id/subjects',auth[_0x0552('0xb')](),controller[_0x0552('0xf')]);router['get'](_0x0552('0x10'),auth['isAuthenticated'](),controller[_0x0552('0x11')]);router[_0x0552('0x12')]('/',auth[_0x0552('0xb')](),controller['create']);router['put']('/:id',auth[_0x0552('0xb')](),controller[_0x0552('0x13')]);router[_0x0552('0x14')]('/:id',auth[_0x0552('0xb')](),controller[_0x0552('0x15')]);module[_0x0552('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index f2a0e59..55b53f6 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 _0x8ddf=['STRING','incident','phonecall','sequelize'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x8ddf,0x15f));var _0xf8dd=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x8ddf[_0x1ae5ab];return _0x1ce001;};'use strict';var Sequelize=require(_0xf8dd('0x0'));module['exports']={'name':{'type':Sequelize[_0xf8dd('0x1')]},'description':{'type':Sequelize[_0xf8dd('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0xf8dd('0x2'),_0xf8dd('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xea33=['STRING','ENUM','incident','sequelize','exports'];(function(_0x5d19f8,_0x56a7bb){var _0x42e896=function(_0x15d7c6){while(--_0x15d7c6){_0x5d19f8['push'](_0x5d19f8['shift']());}};_0x42e896(++_0x56a7bb);}(_0xea33,0x116));var _0x3ea3=function(_0x22b39b,_0x2b7d63){_0x22b39b=_0x22b39b-0x0;var _0x280e1d=_0xea33[_0x22b39b];return _0x280e1d;};'use strict';var Sequelize=require(_0x3ea3('0x0'));module[_0x3ea3('0x1')]={'name':{'type':Sequelize[_0x3ea3('0x2')]},'description':{'type':Sequelize[_0x3ea3('0x2')]},'ticketType':{'type':Sequelize[_0x3ea3('0x3')](_0x3ea3('0x4'),'phonecall'),'defaultValue':_0x3ea3('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index ec56e57..90b95f5 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 _0x0353=['offset','limit','apply','reject','update','destroy','stack','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','create','body','getFields','findOne','Dynamics365Field','pick','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count'];(function(_0x578131,_0x15425f){var _0x3f1b45=function(_0x53b32e){while(--_0x53b32e){_0x578131['push'](_0x578131['shift']());}};_0x3f1b45(++_0x15425f);}(_0x0353,0x8e));var _0x3035=function(_0x28611e,_0x586726){_0x28611e=_0x28611e-0x0;var _0x530f69=_0x0353[_0x28611e];return _0x530f69;};'use strict';var pdf=require(_0x3035('0x0'));var emlformat=require(_0x3035('0x1'));var rimraf=require(_0x3035('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3035('0x3'));var BPromise=require(_0x3035('0x4'));var Mustache=require('mustache');var util=require(_0x3035('0x5'));var path=require(_0x3035('0x6'));var sox=require(_0x3035('0x7'));var csv=require(_0x3035('0x8'));var ejs=require(_0x3035('0x9'));var fs=require('fs');var _=require(_0x3035('0xa'));var squel=require(_0x3035('0xb'));var crypto=require(_0x3035('0xc'));var jsforce=require(_0x3035('0xd'));var deskjs=require(_0x3035('0xe'));var toCsv=require(_0x3035('0x8'));var querystring=require(_0x3035('0xf'));var Papa=require(_0x3035('0x10'));var Redis=require(_0x3035('0x11'));var authService=require(_0x3035('0x12'));var qs=require(_0x3035('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3035('0x14'));var logger=require(_0x3035('0x15'))(_0x3035('0x16'));var utils=require('../../config/utils');var config=require(_0x3035('0x17'));var db=require(_0x3035('0x18'))['db'];var jayson=require(_0x3035('0x19'));var client=jayson['client'][_0x3035('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x344011,_0x1bbebe,_0x4e6cbe){if(_0x4e6cbe){var _0x260968=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x260968[_0x3035('0x1b')](_0x1bbebe)){return _0x344011;}else{throw new db[(_0x3035('0x1c'))][(_0x3035('0x1d'))](_0x3035('0x1e'));}}else{return _0x344011;}}function respondWithRpcPromise(_0x5e3834,_0x31ae36,_0x3d42ab,_0x263759){return new BPromise(function(_0xeed4a6,_0x28da89){var _0x1fe810=_0x263759||client;return _0x1fe810[_0x3035('0x1f')](_0x5e3834,_0x3d42ab)[_0x3035('0x20')](function(_0x46c21c){logger[_0x3035('0x21')](_0x3035('0x22'),_0x31ae36,_0x3035('0x23'));logger[_0x3035('0x24')](_0x3035('0x25'),_0x31ae36,_0x3035('0x23'),JSON['stringify'](_0x46c21c));if(_0x46c21c[_0x3035('0x26')]){if(_0x46c21c['error'][_0x3035('0x27')]===0x1f4){logger[_0x3035('0x26')]('Dynamics365Configuration,\x20%s,\x20%s',_0x31ae36,_0x46c21c['error'][_0x3035('0x28')]);return _0x28da89(_0x46c21c[_0x3035('0x26')][_0x3035('0x28')]);}logger[_0x3035('0x26')](_0x3035('0x22'),_0x31ae36,_0x46c21c['error'][_0x3035('0x28')]);return _0xeed4a6(_0x46c21c['error'][_0x3035('0x28')]);}else{logger[_0x3035('0x21')](_0x3035('0x22'),_0x31ae36,_0x3035('0x23'));_0xeed4a6(_0x46c21c[_0x3035('0x29')][_0x3035('0x28')]);}})[_0x3035('0x2a')](function(_0x5a33d3){logger['error'](_0x3035('0x22'),_0x31ae36,_0x5a33d3);_0x28da89(_0x5a33d3);});});}function respondWithStatusCode(_0x2951ba,_0x2ab643){_0x2ab643=_0x2ab643||0xcc;return function(_0x3336bb){if(_0x3336bb){return _0x2951ba[_0x3035('0x2b')](_0x2ab643);}return _0x2951ba[_0x3035('0x2c')](_0x2ab643)[_0x3035('0x2d')]();};}function respondWithResult(_0xb3a380,_0x570505){_0x570505=_0x570505||0xc8;return function(_0x3791cd){if(_0x3791cd){return _0xb3a380[_0x3035('0x2c')](_0x570505)[_0x3035('0x2e')](_0x3791cd);}};}function respondWithFilteredResult(_0x2ae50c,_0x2ebc38){return function(_0x12f03f){if(_0x12f03f){var _0x4ba6b9=_0x12f03f[_0x3035('0x2f')],_0x10cb6f=_0x2ebc38[_0x3035('0x30')],_0x34bb29=_0x2ebc38['offset']+_0x2ebc38[_0x3035('0x31')],_0x26e51f;if(_0x34bb29>=_0x4ba6b9){_0x34bb29=_0x4ba6b9;_0x26e51f=0xc8;}else{_0x26e51f=0xce;}_0x2ae50c[_0x3035('0x2c')](_0x26e51f);return _0x2ae50c['set']('Content-Range',_0x10cb6f+'-'+_0x34bb29+'/'+_0x4ba6b9)[_0x3035('0x2e')](_0x12f03f);}return null;};}function patchUpdates(_0x1864fb){return function(_0x1e638a){try{jsonpatch[_0x3035('0x32')](_0x1e638a,_0x1864fb,!![]);}catch(_0x51e2fe){return BPromise[_0x3035('0x33')](_0x51e2fe);}return _0x1e638a['save']();};}function saveUpdates(_0x237893,_0xc8e023){return function(_0x2920e0){if(_0x2920e0){return _0x2920e0[_0x3035('0x34')](_0x237893)['then'](function(_0x2e6ca7){return _0x2e6ca7;});}return null;};}function removeEntity(_0x41a60c,_0x5e0f75){return function(_0x14c65b){if(_0x14c65b){return _0x14c65b[_0x3035('0x35')]()[_0x3035('0x20')](function(){_0x41a60c[_0x3035('0x2c')](0xcc)[_0x3035('0x2d')]();});}};}function handleEntityNotFound(_0x2dcdbd,_0x5985be){return function(_0x4000de){if(!_0x4000de){_0x2dcdbd[_0x3035('0x2b')](0x194);}return _0x4000de;};}function handleError(_0x5dbbe2,_0x2c5983){_0x2c5983=_0x2c5983||0x1f4;return function(_0x440fb6){logger['error'](_0x440fb6[_0x3035('0x36')]);if(_0x440fb6['name']){delete _0x440fb6[_0x3035('0x37')];}_0x5dbbe2[_0x3035('0x2c')](_0x2c5983)[_0x3035('0x38')](_0x440fb6);};}exports[_0x3035('0x39')]=function(_0xbf68dd,_0x1c190f){var _0x2dd455={},_0x3b33b1={},_0x8838e2={'count':0x0,'rows':[]};var _0x135d1c=_[_0x3035('0x3a')](db[_0x3035('0x3b')][_0x3035('0x3c')],function(_0x3c7033){return{'name':_0x3c7033[_0x3035('0x3d')],'type':_0x3c7033[_0x3035('0x3e')][_0x3035('0x3f')]};});_0x3b33b1[_0x3035('0x40')]=_['map'](_0x135d1c,_0x3035('0x37'));_0x3b33b1[_0x3035('0x41')]=_[_0x3035('0x42')](_0xbf68dd[_0x3035('0x41')]);_0x3b33b1['filters']=_[_0x3035('0x43')](_0x3b33b1['model'],_0x3b33b1['query']);_0x2dd455['attributes']=_[_0x3035('0x43')](_0x3b33b1[_0x3035('0x40')],qs[_0x3035('0x44')](_0xbf68dd[_0x3035('0x41')][_0x3035('0x44')]));_0x2dd455[_0x3035('0x45')]=_0x2dd455[_0x3035('0x45')][_0x3035('0x46')]?_0x2dd455[_0x3035('0x45')]:_0x3b33b1['model'];if(!_0xbf68dd['query'][_0x3035('0x47')](_0x3035('0x48'))){_0x2dd455[_0x3035('0x31')]=qs['limit'](_0xbf68dd['query'][_0x3035('0x31')]);_0x2dd455['offset']=qs['offset'](_0xbf68dd[_0x3035('0x41')][_0x3035('0x30')]);}_0x2dd455[_0x3035('0x49')]=qs[_0x3035('0x4a')](_0xbf68dd['query'][_0x3035('0x4a')]);_0x2dd455[_0x3035('0x4b')]=qs[_0x3035('0x4c')](_['pick'](_0xbf68dd[_0x3035('0x41')],_0x3b33b1[_0x3035('0x4c')]));if(_0xbf68dd['query'][_0x3035('0x4d')]){_0x2dd455['where']=_[_0x3035('0x4e')](_0x2dd455['where'],{'$or':_['map'](_0x135d1c,function(_0x28ca83){if(_0x28ca83[_0x3035('0x3e')]!==_0x3035('0x4f')){var _0x35a3e1={};_0x35a3e1[_0x28ca83[_0x3035('0x37')]]={'$like':'%'+_0xbf68dd['query']['filter']+'%'};return _0x35a3e1;}})});}_0x2dd455=_['merge']({},_0x2dd455,_0xbf68dd[_0x3035('0x50')]);var _0x1515c4={'where':_0x2dd455[_0x3035('0x4b')]};return db[_0x3035('0x3b')][_0x3035('0x2f')](_0x1515c4)[_0x3035('0x20')](function(_0x2cdd22){_0x8838e2['count']=_0x2cdd22;if(_0xbf68dd[_0x3035('0x41')][_0x3035('0x51')]){_0x2dd455[_0x3035('0x52')]=[{'all':!![]}];}return db[_0x3035('0x3b')]['findAll'](_0x2dd455);})['then'](function(_0x5e02f3){_0x8838e2[_0x3035('0x53')]=_0x5e02f3;return _0x8838e2;})['then'](respondWithFilteredResult(_0x1c190f,_0x2dd455))[_0x3035('0x2a')](handleError(_0x1c190f,null));};exports[_0x3035('0x54')]=function(_0x29f3fe,_0x3c8cf4){var _0x5dd07d={'raw':![],'where':{'id':_0x29f3fe[_0x3035('0x55')]['id']}},_0x580f42={};_0x580f42['model']=_[_0x3035('0x42')](db[_0x3035('0x3b')][_0x3035('0x3c')]);_0x580f42[_0x3035('0x41')]=_[_0x3035('0x42')](_0x29f3fe[_0x3035('0x41')]);_0x580f42[_0x3035('0x4c')]=_[_0x3035('0x43')](_0x580f42['model'],_0x580f42[_0x3035('0x41')]);_0x5dd07d[_0x3035('0x45')]=_['intersection'](_0x580f42[_0x3035('0x40')],qs[_0x3035('0x44')](_0x29f3fe['query'][_0x3035('0x44')]));_0x5dd07d[_0x3035('0x45')]=_0x5dd07d[_0x3035('0x45')][_0x3035('0x46')]?_0x5dd07d['attributes']:_0x580f42[_0x3035('0x40')];if(_0x29f3fe[_0x3035('0x41')][_0x3035('0x51')]){_0x5dd07d[_0x3035('0x52')]=[{'all':!![]}];}_0x5dd07d=_[_0x3035('0x4e')]({},_0x5dd07d,_0x29f3fe[_0x3035('0x50')]);return db['Dynamics365Configuration'][_0x3035('0x56')](_0x5dd07d)[_0x3035('0x20')](handleEntityNotFound(_0x3c8cf4,null))[_0x3035('0x20')](respondWithResult(_0x3c8cf4,null))[_0x3035('0x2a')](handleError(_0x3c8cf4,null));};exports[_0x3035('0x57')]=function(_0x5c801d,_0x5014f2){return db[_0x3035('0x3b')]['create'](_0x5c801d[_0x3035('0x58')],{})[_0x3035('0x20')](respondWithResult(_0x5014f2,0xc9))[_0x3035('0x2a')](handleError(_0x5014f2,null));};exports[_0x3035('0x34')]=function(_0x19d1e9,_0x4e5c8b){if(_0x19d1e9[_0x3035('0x58')]['id']){delete _0x19d1e9[_0x3035('0x58')]['id'];}return db[_0x3035('0x3b')]['find']({'where':{'id':_0x19d1e9['params']['id']}})[_0x3035('0x20')](handleEntityNotFound(_0x4e5c8b,null))[_0x3035('0x20')](saveUpdates(_0x19d1e9[_0x3035('0x58')],null))[_0x3035('0x20')](respondWithResult(_0x4e5c8b,null))[_0x3035('0x2a')](handleError(_0x4e5c8b,null));};exports[_0x3035('0x35')]=function(_0x178dca,_0x37d013){return db[_0x3035('0x3b')][_0x3035('0x56')]({'where':{'id':_0x178dca[_0x3035('0x55')]['id']}})[_0x3035('0x20')](handleEntityNotFound(_0x37d013,null))[_0x3035('0x20')](removeEntity(_0x37d013,null))[_0x3035('0x2a')](handleError(_0x37d013,null));};exports[_0x3035('0x59')]=function(_0x27b53f,_0x43d194,_0x2418f9){var _0x50528d={};var _0xfbf726={};var _0xcf129;var _0x38415d;return db[_0x3035('0x3b')][_0x3035('0x5a')]({'where':{'id':_0x27b53f[_0x3035('0x55')]['id']}})[_0x3035('0x20')](handleEntityNotFound(_0x43d194,null))[_0x3035('0x20')](function(_0x18dadb){if(_0x18dadb){_0xcf129=_0x18dadb;_0xfbf726['model']=_[_0x3035('0x42')](db[_0x3035('0x5b')][_0x3035('0x3c')]);_0xfbf726['query']=_[_0x3035('0x42')](_0x27b53f['query']);_0xfbf726[_0x3035('0x4c')]=_[_0x3035('0x43')](_0xfbf726['model'],_0xfbf726[_0x3035('0x41')]);_0x50528d[_0x3035('0x45')]=_['intersection'](_0xfbf726['model'],qs['fields'](_0x27b53f[_0x3035('0x41')][_0x3035('0x44')]));_0x50528d[_0x3035('0x45')]=_0x50528d[_0x3035('0x45')][_0x3035('0x46')]?_0x50528d[_0x3035('0x45')]:_0xfbf726[_0x3035('0x40')];_0x50528d[_0x3035('0x49')]=qs['sort'](_0x27b53f['query'][_0x3035('0x4a')]);_0x50528d[_0x3035('0x4b')]=qs[_0x3035('0x4c')](_[_0x3035('0x5c')](_0x27b53f[_0x3035('0x41')],_0xfbf726['filters']));if(_0x27b53f['query'][_0x3035('0x4d')]){_0x50528d[_0x3035('0x4b')]=_['merge'](_0x50528d['where'],{'$or':_[_0x3035('0x3a')](_0x50528d['attributes'],function(_0x4999c0){var _0x45bcaa={};_0x45bcaa[_0x4999c0]={'$like':'%'+_0x27b53f['query'][_0x3035('0x4d')]+'%'};return _0x45bcaa;})});}_0x50528d=_[_0x3035('0x4e')]({},_0x50528d,_0x27b53f['options']);return _0xcf129[_0x3035('0x59')](_0x50528d);}})[_0x3035('0x20')](function(_0x13eb45){if(_0x13eb45){_0x38415d=_0x13eb45['length'];if(!_0x27b53f[_0x3035('0x41')][_0x3035('0x47')]('nolimit')){_0x50528d[_0x3035('0x31')]=qs[_0x3035('0x31')](_0x27b53f[_0x3035('0x41')][_0x3035('0x31')]);_0x50528d[_0x3035('0x30')]=qs[_0x3035('0x30')](_0x27b53f[_0x3035('0x41')][_0x3035('0x30')]);}return _0xcf129['getFields'](_0x50528d);}})[_0x3035('0x20')](function(_0x815668){if(_0x815668){return _0x815668?{'count':_0x38415d,'rows':_0x815668}:null;}})['then'](respondWithResult(_0x43d194,null))[_0x3035('0x2a')](handleError(_0x43d194,null));};exports[_0x3035('0x5d')]=function(_0xacb99a,_0x54a999,_0x693dac){var _0x22e484={};var _0x2cda75={};var _0x2d0d82;var _0x5f50ca;return db[_0x3035('0x3b')]['findOne']({'where':{'id':_0xacb99a[_0x3035('0x55')]['id']}})['then'](handleEntityNotFound(_0x54a999,null))[_0x3035('0x20')](function(_0x171815){if(_0x171815){_0x2d0d82=_0x171815;_0x2cda75[_0x3035('0x40')]=_[_0x3035('0x42')](db['Dynamics365Field'][_0x3035('0x3c')]);_0x2cda75[_0x3035('0x41')]=_[_0x3035('0x42')](_0xacb99a[_0x3035('0x41')]);_0x2cda75[_0x3035('0x4c')]=_['intersection'](_0x2cda75[_0x3035('0x40')],_0x2cda75[_0x3035('0x41')]);_0x22e484[_0x3035('0x45')]=_[_0x3035('0x43')](_0x2cda75[_0x3035('0x40')],qs[_0x3035('0x44')](_0xacb99a[_0x3035('0x41')][_0x3035('0x44')]));_0x22e484[_0x3035('0x45')]=_0x22e484['attributes'][_0x3035('0x46')]?_0x22e484[_0x3035('0x45')]:_0x2cda75[_0x3035('0x40')];_0x22e484[_0x3035('0x49')]=qs[_0x3035('0x4a')](_0xacb99a['query'][_0x3035('0x4a')]);_0x22e484['where']=qs['filters'](_[_0x3035('0x5c')](_0xacb99a[_0x3035('0x41')],_0x2cda75[_0x3035('0x4c')]));if(_0xacb99a[_0x3035('0x41')]['filter']){_0x22e484['where']=_[_0x3035('0x4e')](_0x22e484[_0x3035('0x4b')],{'$or':_[_0x3035('0x3a')](_0x22e484['attributes'],function(_0x3457b6){var _0x3458b1={};_0x3458b1[_0x3457b6]={'$like':'%'+_0xacb99a[_0x3035('0x41')][_0x3035('0x4d')]+'%'};return _0x3458b1;})});}_0x22e484=_['merge']({},_0x22e484,_0xacb99a[_0x3035('0x50')]);return _0x2d0d82[_0x3035('0x5d')](_0x22e484);}})['then'](function(_0x5bca23){if(_0x5bca23){_0x5f50ca=_0x5bca23[_0x3035('0x46')];if(!_0xacb99a[_0x3035('0x41')]['hasOwnProperty']('nolimit')){_0x22e484[_0x3035('0x31')]=qs[_0x3035('0x31')](_0xacb99a['query'][_0x3035('0x31')]);_0x22e484[_0x3035('0x30')]=qs[_0x3035('0x30')](_0xacb99a['query'][_0x3035('0x30')]);}return _0x2d0d82['getSubjects'](_0x22e484);}})[_0x3035('0x20')](function(_0x3743cb){if(_0x3743cb){return _0x3743cb?{'count':_0x5f50ca,'rows':_0x3743cb}:null;}})[_0x3035('0x20')](respondWithResult(_0x54a999,null))['catch'](handleError(_0x54a999,null));};exports[_0x3035('0x5e')]=function(_0x324560,_0xe21561,_0x41f4c9){var _0x19bf99={};var _0x2a212b={};var _0x32deee;var _0x4e2268;return db['Dynamics365Configuration'][_0x3035('0x5a')]({'where':{'id':_0x324560[_0x3035('0x55')]['id']}})['then'](handleEntityNotFound(_0xe21561,null))[_0x3035('0x20')](function(_0x3b7fe1){if(_0x3b7fe1){_0x32deee=_0x3b7fe1;_0x2a212b[_0x3035('0x40')]=_[_0x3035('0x42')](db[_0x3035('0x5b')]['rawAttributes']);_0x2a212b[_0x3035('0x41')]=_[_0x3035('0x42')](_0x324560[_0x3035('0x41')]);_0x2a212b['filters']=_[_0x3035('0x43')](_0x2a212b[_0x3035('0x40')],_0x2a212b[_0x3035('0x41')]);_0x19bf99[_0x3035('0x45')]=_[_0x3035('0x43')](_0x2a212b[_0x3035('0x40')],qs[_0x3035('0x44')](_0x324560[_0x3035('0x41')][_0x3035('0x44')]));_0x19bf99[_0x3035('0x45')]=_0x19bf99[_0x3035('0x45')][_0x3035('0x46')]?_0x19bf99[_0x3035('0x45')]:_0x2a212b['model'];_0x19bf99[_0x3035('0x49')]=qs[_0x3035('0x4a')](_0x324560[_0x3035('0x41')][_0x3035('0x4a')]);_0x19bf99[_0x3035('0x4b')]=qs[_0x3035('0x4c')](_[_0x3035('0x5c')](_0x324560['query'],_0x2a212b[_0x3035('0x4c')]));if(_0x324560[_0x3035('0x41')][_0x3035('0x4d')]){_0x19bf99[_0x3035('0x4b')]=_[_0x3035('0x4e')](_0x19bf99[_0x3035('0x4b')],{'$or':_[_0x3035('0x3a')](_0x19bf99[_0x3035('0x45')],function(_0x41affd){var _0x27688d={};_0x27688d[_0x41affd]={'$like':'%'+_0x324560['query']['filter']+'%'};return _0x27688d;})});}_0x19bf99=_[_0x3035('0x4e')]({},_0x19bf99,_0x324560[_0x3035('0x50')]);return _0x32deee[_0x3035('0x5e')](_0x19bf99);}})[_0x3035('0x20')](function(_0x4a813c){if(_0x4a813c){_0x4e2268=_0x4a813c[_0x3035('0x46')];if(!_0x324560[_0x3035('0x41')][_0x3035('0x47')]('nolimit')){_0x19bf99[_0x3035('0x31')]=qs[_0x3035('0x31')](_0x324560[_0x3035('0x41')][_0x3035('0x31')]);_0x19bf99[_0x3035('0x30')]=qs['offset'](_0x324560[_0x3035('0x41')][_0x3035('0x30')]);}return _0x32deee[_0x3035('0x5e')](_0x19bf99);}})[_0x3035('0x20')](function(_0x3b0120){if(_0x3b0120){return _0x3b0120?{'count':_0x4e2268,'rows':_0x3b0120}:null;}})[_0x3035('0x20')](respondWithResult(_0xe21561,null))[_0x3035('0x2a')](handleError(_0xe21561,null));}; \ No newline at end of file +var _0x931b=['jayson/promise','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','sendStatus','status','end','json','count','offset','Content-Range','apply','save','update','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Dynamics365Configuration','includeAll','include','findAll','rows','show','params','find','catch','create','body','destroy','getFields','findOne','Dynamics365Field','hasOwnProperty','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x45da5d,_0x578539){var _0x449b5c=function(_0x44a207){while(--_0x44a207){_0x45da5d['push'](_0x45da5d['shift']());}};_0x449b5c(++_0x578539);}(_0x931b,0x107));var _0xb931=function(_0x272c4,_0x466c6f){_0x272c4=_0x272c4-0x0;var _0x510051=_0x931b[_0x272c4];return _0x510051;};'use strict';var pdf=require(_0xb931('0x0'));var emlformat=require(_0xb931('0x1'));var rimraf=require(_0xb931('0x2'));var zipdir=require(_0xb931('0x3'));var jsonpatch=require(_0xb931('0x4'));var rp=require(_0xb931('0x5'));var moment=require(_0xb931('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb931('0x7'));var util=require(_0xb931('0x8'));var path=require(_0xb931('0x9'));var sox=require(_0xb931('0xa'));var csv=require('to-csv');var ejs=require(_0xb931('0xb'));var fs=require('fs');var _=require(_0xb931('0xc'));var squel=require(_0xb931('0xd'));var crypto=require(_0xb931('0xe'));var jsforce=require(_0xb931('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xb931('0x10'));var querystring=require(_0xb931('0x11'));var Papa=require(_0xb931('0x12'));var Redis=require(_0xb931('0x13'));var authService=require(_0xb931('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xb931('0x15'));var hardwareService=require(_0xb931('0x16'));var logger=require(_0xb931('0x17'))(_0xb931('0x18'));var utils=require(_0xb931('0x19'));var config=require(_0xb931('0x1a'));var db=require(_0xb931('0x1b'))['db'];var jayson=require(_0xb931('0x1c'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x10d8a2,_0x544f3c,_0x217af0){if(_0x217af0){var _0x4a1105=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a1105['test'](_0x544f3c)){return _0x10d8a2;}else{throw new db[(_0xb931('0x1d'))][(_0xb931('0x1e'))](_0xb931('0x1f'));}}else{return _0x10d8a2;}}function respondWithRpcPromise(_0x13e7ae,_0x5a6f1c,_0x1808e3,_0x10e5c1){return new BPromise(function(_0x5619fe,_0x5721ed){var _0x15a903=_0x10e5c1||client;return _0x15a903[_0xb931('0x20')](_0x13e7ae,_0x1808e3)[_0xb931('0x21')](function(_0x10a419){logger['info'](_0xb931('0x22'),_0x5a6f1c,_0xb931('0x23'));logger[_0xb931('0x24')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x5a6f1c,'request\x20sent',JSON[_0xb931('0x25')](_0x10a419));if(_0x10a419['error']){if(_0x10a419[_0xb931('0x26')][_0xb931('0x27')]===0x1f4){logger[_0xb931('0x26')](_0xb931('0x22'),_0x5a6f1c,_0x10a419[_0xb931('0x26')][_0xb931('0x28')]);return _0x5721ed(_0x10a419[_0xb931('0x26')][_0xb931('0x28')]);}logger[_0xb931('0x26')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6f1c,_0x10a419[_0xb931('0x26')][_0xb931('0x28')]);return _0x5619fe(_0x10a419[_0xb931('0x26')]['message']);}else{logger[_0xb931('0x29')](_0xb931('0x22'),_0x5a6f1c,_0xb931('0x23'));_0x5619fe(_0x10a419[_0xb931('0x2a')]['message']);}})['catch'](function(_0x587446){logger[_0xb931('0x26')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5a6f1c,_0x587446);_0x5721ed(_0x587446);});});}function respondWithStatusCode(_0x35b92f,_0x2ced80){_0x2ced80=_0x2ced80||0xcc;return function(_0x3026a7){if(_0x3026a7){return _0x35b92f[_0xb931('0x2b')](_0x2ced80);}return _0x35b92f[_0xb931('0x2c')](_0x2ced80)[_0xb931('0x2d')]();};}function respondWithResult(_0x5dc1ff,_0x50a738){_0x50a738=_0x50a738||0xc8;return function(_0x47c7b3){if(_0x47c7b3){return _0x5dc1ff[_0xb931('0x2c')](_0x50a738)[_0xb931('0x2e')](_0x47c7b3);}};}function respondWithFilteredResult(_0x57f223,_0x549403){return function(_0x237353){if(_0x237353){var _0x327afb=_0x237353[_0xb931('0x2f')],_0x3eb794=_0x549403[_0xb931('0x30')],_0x22312c=_0x549403['offset']+_0x549403['limit'],_0x1fd41f;if(_0x22312c>=_0x327afb){_0x22312c=_0x327afb;_0x1fd41f=0xc8;}else{_0x1fd41f=0xce;}_0x57f223['status'](_0x1fd41f);return _0x57f223['set'](_0xb931('0x31'),_0x3eb794+'-'+_0x22312c+'/'+_0x327afb)['json'](_0x237353);}return null;};}function patchUpdates(_0x4304d0){return function(_0x401a5f){try{jsonpatch[_0xb931('0x32')](_0x401a5f,_0x4304d0,!![]);}catch(_0x2cb172){return BPromise['reject'](_0x2cb172);}return _0x401a5f[_0xb931('0x33')]();};}function saveUpdates(_0x2853b5,_0x446452){return function(_0x371cf6){if(_0x371cf6){return _0x371cf6[_0xb931('0x34')](_0x2853b5)[_0xb931('0x21')](function(_0x5c1a1f){return _0x5c1a1f;});}return null;};}function removeEntity(_0x4daede,_0x54f599){return function(_0x1df800){if(_0x1df800){return _0x1df800['destroy']()[_0xb931('0x21')](function(){_0x4daede[_0xb931('0x2c')](0xcc)[_0xb931('0x2d')]();});}};}function handleEntityNotFound(_0x2ec9eb,_0x400af1){return function(_0x4a47cb){if(!_0x4a47cb){_0x2ec9eb[_0xb931('0x2b')](0x194);}return _0x4a47cb;};}function handleError(_0x23c15a,_0x52a3f3){_0x52a3f3=_0x52a3f3||0x1f4;return function(_0x36b349){logger[_0xb931('0x26')](_0x36b349[_0xb931('0x35')]);if(_0x36b349[_0xb931('0x36')]){delete _0x36b349['name'];}_0x23c15a['status'](_0x52a3f3)['send'](_0x36b349);};}exports[_0xb931('0x37')]=function(_0x1bfff7,_0x3a5519){var _0x5c6cc5={},_0x17ea90={},_0x199eb1={'count':0x0,'rows':[]};var _0x5ccb27=_['map'](db['Dynamics365Configuration'][_0xb931('0x38')],function(_0x46e122){return{'name':_0x46e122[_0xb931('0x39')],'type':_0x46e122[_0xb931('0x3a')][_0xb931('0x3b')]};});_0x17ea90[_0xb931('0x3c')]=_[_0xb931('0x3d')](_0x5ccb27,_0xb931('0x36'));_0x17ea90[_0xb931('0x3e')]=_[_0xb931('0x3f')](_0x1bfff7[_0xb931('0x3e')]);_0x17ea90[_0xb931('0x40')]=_[_0xb931('0x41')](_0x17ea90['model'],_0x17ea90[_0xb931('0x3e')]);_0x5c6cc5[_0xb931('0x42')]=_[_0xb931('0x41')](_0x17ea90[_0xb931('0x3c')],qs[_0xb931('0x43')](_0x1bfff7[_0xb931('0x3e')][_0xb931('0x43')]));_0x5c6cc5[_0xb931('0x42')]=_0x5c6cc5[_0xb931('0x42')][_0xb931('0x44')]?_0x5c6cc5[_0xb931('0x42')]:_0x17ea90['model'];if(!_0x1bfff7[_0xb931('0x3e')]['hasOwnProperty'](_0xb931('0x45'))){_0x5c6cc5[_0xb931('0x46')]=qs[_0xb931('0x46')](_0x1bfff7[_0xb931('0x3e')]['limit']);_0x5c6cc5[_0xb931('0x30')]=qs[_0xb931('0x30')](_0x1bfff7[_0xb931('0x3e')]['offset']);}_0x5c6cc5[_0xb931('0x47')]=qs[_0xb931('0x48')](_0x1bfff7[_0xb931('0x3e')][_0xb931('0x48')]);_0x5c6cc5[_0xb931('0x49')]=qs[_0xb931('0x40')](_[_0xb931('0x4a')](_0x1bfff7[_0xb931('0x3e')],_0x17ea90[_0xb931('0x40')]));if(_0x1bfff7[_0xb931('0x3e')][_0xb931('0x4b')]){_0x5c6cc5['where']=_[_0xb931('0x4c')](_0x5c6cc5[_0xb931('0x49')],{'$or':_[_0xb931('0x3d')](_0x5ccb27,function(_0x45b55d){if(_0x45b55d[_0xb931('0x3a')]!==_0xb931('0x4d')){var _0x28a6f0={};_0x28a6f0[_0x45b55d['name']]={'$like':'%'+_0x1bfff7[_0xb931('0x3e')][_0xb931('0x4b')]+'%'};return _0x28a6f0;}})});}_0x5c6cc5=_[_0xb931('0x4c')]({},_0x5c6cc5,_0x1bfff7[_0xb931('0x4e')]);var _0x45527d={'where':_0x5c6cc5['where']};return db[_0xb931('0x4f')][_0xb931('0x2f')](_0x45527d)[_0xb931('0x21')](function(_0x1cba2e){_0x199eb1['count']=_0x1cba2e;if(_0x1bfff7[_0xb931('0x3e')][_0xb931('0x50')]){_0x5c6cc5[_0xb931('0x51')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0xb931('0x52')](_0x5c6cc5);})[_0xb931('0x21')](function(_0x4ecdba){_0x199eb1[_0xb931('0x53')]=_0x4ecdba;return _0x199eb1;})['then'](respondWithFilteredResult(_0x3a5519,_0x5c6cc5))['catch'](handleError(_0x3a5519,null));};exports[_0xb931('0x54')]=function(_0x3453d9,_0x1bb4e3){var _0x2f8470={'raw':![],'where':{'id':_0x3453d9[_0xb931('0x55')]['id']}},_0x566a4f={};_0x566a4f['model']=_[_0xb931('0x3f')](db[_0xb931('0x4f')][_0xb931('0x38')]);_0x566a4f['query']=_['keys'](_0x3453d9[_0xb931('0x3e')]);_0x566a4f[_0xb931('0x40')]=_[_0xb931('0x41')](_0x566a4f[_0xb931('0x3c')],_0x566a4f[_0xb931('0x3e')]);_0x2f8470[_0xb931('0x42')]=_[_0xb931('0x41')](_0x566a4f['model'],qs['fields'](_0x3453d9[_0xb931('0x3e')][_0xb931('0x43')]));_0x2f8470[_0xb931('0x42')]=_0x2f8470['attributes'][_0xb931('0x44')]?_0x2f8470['attributes']:_0x566a4f['model'];if(_0x3453d9['query']['includeAll']){_0x2f8470[_0xb931('0x51')]=[{'all':!![]}];}_0x2f8470=_[_0xb931('0x4c')]({},_0x2f8470,_0x3453d9['options']);return db[_0xb931('0x4f')][_0xb931('0x56')](_0x2f8470)['then'](handleEntityNotFound(_0x1bb4e3,null))[_0xb931('0x21')](respondWithResult(_0x1bb4e3,null))[_0xb931('0x57')](handleError(_0x1bb4e3,null));};exports[_0xb931('0x58')]=function(_0x125645,_0x28bb7d){return db['Dynamics365Configuration'][_0xb931('0x58')](_0x125645[_0xb931('0x59')],{})['then'](respondWithResult(_0x28bb7d,0xc9))[_0xb931('0x57')](handleError(_0x28bb7d,null));};exports[_0xb931('0x34')]=function(_0x11500f,_0x44867c){if(_0x11500f['body']['id']){delete _0x11500f[_0xb931('0x59')]['id'];}return db[_0xb931('0x4f')][_0xb931('0x56')]({'where':{'id':_0x11500f[_0xb931('0x55')]['id']}})['then'](handleEntityNotFound(_0x44867c,null))[_0xb931('0x21')](saveUpdates(_0x11500f[_0xb931('0x59')],null))[_0xb931('0x21')](respondWithResult(_0x44867c,null))[_0xb931('0x57')](handleError(_0x44867c,null));};exports[_0xb931('0x5a')]=function(_0x3ef873,_0x44d7d3){return db[_0xb931('0x4f')]['find']({'where':{'id':_0x3ef873[_0xb931('0x55')]['id']}})[_0xb931('0x21')](handleEntityNotFound(_0x44d7d3,null))[_0xb931('0x21')](removeEntity(_0x44d7d3,null))[_0xb931('0x57')](handleError(_0x44d7d3,null));};exports[_0xb931('0x5b')]=function(_0x202d6f,_0x4a433d,_0x1156ce){var _0x9c7db7={};var _0x9d867b={};var _0x142aa8;var _0x20999d;return db[_0xb931('0x4f')][_0xb931('0x5c')]({'where':{'id':_0x202d6f['params']['id']}})[_0xb931('0x21')](handleEntityNotFound(_0x4a433d,null))[_0xb931('0x21')](function(_0x34f4d9){if(_0x34f4d9){_0x142aa8=_0x34f4d9;_0x9d867b[_0xb931('0x3c')]=_['keys'](db[_0xb931('0x5d')][_0xb931('0x38')]);_0x9d867b[_0xb931('0x3e')]=_[_0xb931('0x3f')](_0x202d6f[_0xb931('0x3e')]);_0x9d867b[_0xb931('0x40')]=_['intersection'](_0x9d867b[_0xb931('0x3c')],_0x9d867b[_0xb931('0x3e')]);_0x9c7db7[_0xb931('0x42')]=_[_0xb931('0x41')](_0x9d867b[_0xb931('0x3c')],qs[_0xb931('0x43')](_0x202d6f['query']['fields']));_0x9c7db7[_0xb931('0x42')]=_0x9c7db7[_0xb931('0x42')]['length']?_0x9c7db7[_0xb931('0x42')]:_0x9d867b[_0xb931('0x3c')];_0x9c7db7[_0xb931('0x47')]=qs[_0xb931('0x48')](_0x202d6f[_0xb931('0x3e')][_0xb931('0x48')]);_0x9c7db7[_0xb931('0x49')]=qs[_0xb931('0x40')](_[_0xb931('0x4a')](_0x202d6f['query'],_0x9d867b['filters']));if(_0x202d6f[_0xb931('0x3e')][_0xb931('0x4b')]){_0x9c7db7[_0xb931('0x49')]=_[_0xb931('0x4c')](_0x9c7db7[_0xb931('0x49')],{'$or':_[_0xb931('0x3d')](_0x9c7db7[_0xb931('0x42')],function(_0x11b16d){var _0x222521={};_0x222521[_0x11b16d]={'$like':'%'+_0x202d6f[_0xb931('0x3e')]['filter']+'%'};return _0x222521;})});}_0x9c7db7=_[_0xb931('0x4c')]({},_0x9c7db7,_0x202d6f[_0xb931('0x4e')]);return _0x142aa8[_0xb931('0x5b')](_0x9c7db7);}})[_0xb931('0x21')](function(_0x36042b){if(_0x36042b){_0x20999d=_0x36042b[_0xb931('0x44')];if(!_0x202d6f[_0xb931('0x3e')][_0xb931('0x5e')](_0xb931('0x45'))){_0x9c7db7[_0xb931('0x46')]=qs[_0xb931('0x46')](_0x202d6f['query'][_0xb931('0x46')]);_0x9c7db7[_0xb931('0x30')]=qs['offset'](_0x202d6f[_0xb931('0x3e')][_0xb931('0x30')]);}return _0x142aa8[_0xb931('0x5b')](_0x9c7db7);}})[_0xb931('0x21')](function(_0x231d8a){if(_0x231d8a){return _0x231d8a?{'count':_0x20999d,'rows':_0x231d8a}:null;}})['then'](respondWithResult(_0x4a433d,null))[_0xb931('0x57')](handleError(_0x4a433d,null));};exports[_0xb931('0x5f')]=function(_0x5c4a42,_0x2d7d4a,_0x503889){var _0x29918b={};var _0xfd37de={};var _0x2cf9ea;var _0x9f9d37;return db[_0xb931('0x4f')][_0xb931('0x5c')]({'where':{'id':_0x5c4a42[_0xb931('0x55')]['id']}})['then'](handleEntityNotFound(_0x2d7d4a,null))[_0xb931('0x21')](function(_0xa0d05f){if(_0xa0d05f){_0x2cf9ea=_0xa0d05f;_0xfd37de[_0xb931('0x3c')]=_[_0xb931('0x3f')](db[_0xb931('0x5d')][_0xb931('0x38')]);_0xfd37de[_0xb931('0x3e')]=_[_0xb931('0x3f')](_0x5c4a42[_0xb931('0x3e')]);_0xfd37de[_0xb931('0x40')]=_[_0xb931('0x41')](_0xfd37de['model'],_0xfd37de[_0xb931('0x3e')]);_0x29918b[_0xb931('0x42')]=_[_0xb931('0x41')](_0xfd37de[_0xb931('0x3c')],qs[_0xb931('0x43')](_0x5c4a42[_0xb931('0x3e')][_0xb931('0x43')]));_0x29918b[_0xb931('0x42')]=_0x29918b[_0xb931('0x42')][_0xb931('0x44')]?_0x29918b[_0xb931('0x42')]:_0xfd37de[_0xb931('0x3c')];_0x29918b['order']=qs['sort'](_0x5c4a42[_0xb931('0x3e')][_0xb931('0x48')]);_0x29918b['where']=qs[_0xb931('0x40')](_[_0xb931('0x4a')](_0x5c4a42[_0xb931('0x3e')],_0xfd37de[_0xb931('0x40')]));if(_0x5c4a42[_0xb931('0x3e')]['filter']){_0x29918b['where']=_[_0xb931('0x4c')](_0x29918b[_0xb931('0x49')],{'$or':_['map'](_0x29918b['attributes'],function(_0x5711e4){var _0x34a54d={};_0x34a54d[_0x5711e4]={'$like':'%'+_0x5c4a42[_0xb931('0x3e')][_0xb931('0x4b')]+'%'};return _0x34a54d;})});}_0x29918b=_[_0xb931('0x4c')]({},_0x29918b,_0x5c4a42[_0xb931('0x4e')]);return _0x2cf9ea[_0xb931('0x5f')](_0x29918b);}})[_0xb931('0x21')](function(_0x288c97){if(_0x288c97){_0x9f9d37=_0x288c97[_0xb931('0x44')];if(!_0x5c4a42['query'][_0xb931('0x5e')](_0xb931('0x45'))){_0x29918b[_0xb931('0x46')]=qs['limit'](_0x5c4a42[_0xb931('0x3e')][_0xb931('0x46')]);_0x29918b[_0xb931('0x30')]=qs[_0xb931('0x30')](_0x5c4a42[_0xb931('0x3e')][_0xb931('0x30')]);}return _0x2cf9ea['getSubjects'](_0x29918b);}})[_0xb931('0x21')](function(_0x57d3eb){if(_0x57d3eb){return _0x57d3eb?{'count':_0x9f9d37,'rows':_0x57d3eb}:null;}})[_0xb931('0x21')](respondWithResult(_0x2d7d4a,null))[_0xb931('0x57')](handleError(_0x2d7d4a,null));};exports[_0xb931('0x60')]=function(_0xb534c8,_0x45dbd3,_0x37943e){var _0x1739fb={};var _0x1622f0={};var _0x3ea8cc;var _0xfd37af;return db[_0xb931('0x4f')][_0xb931('0x5c')]({'where':{'id':_0xb534c8[_0xb931('0x55')]['id']}})[_0xb931('0x21')](handleEntityNotFound(_0x45dbd3,null))[_0xb931('0x21')](function(_0x2a351c){if(_0x2a351c){_0x3ea8cc=_0x2a351c;_0x1622f0[_0xb931('0x3c')]=_[_0xb931('0x3f')](db['Dynamics365Field']['rawAttributes']);_0x1622f0[_0xb931('0x3e')]=_['keys'](_0xb534c8[_0xb931('0x3e')]);_0x1622f0['filters']=_[_0xb931('0x41')](_0x1622f0['model'],_0x1622f0[_0xb931('0x3e')]);_0x1739fb[_0xb931('0x42')]=_[_0xb931('0x41')](_0x1622f0[_0xb931('0x3c')],qs[_0xb931('0x43')](_0xb534c8[_0xb931('0x3e')]['fields']));_0x1739fb[_0xb931('0x42')]=_0x1739fb[_0xb931('0x42')]['length']?_0x1739fb[_0xb931('0x42')]:_0x1622f0[_0xb931('0x3c')];_0x1739fb['order']=qs[_0xb931('0x48')](_0xb534c8[_0xb931('0x3e')]['sort']);_0x1739fb['where']=qs[_0xb931('0x40')](_[_0xb931('0x4a')](_0xb534c8[_0xb931('0x3e')],_0x1622f0[_0xb931('0x40')]));if(_0xb534c8['query']['filter']){_0x1739fb[_0xb931('0x49')]=_['merge'](_0x1739fb[_0xb931('0x49')],{'$or':_[_0xb931('0x3d')](_0x1739fb[_0xb931('0x42')],function(_0x3a576d){var _0x16a44a={};_0x16a44a[_0x3a576d]={'$like':'%'+_0xb534c8['query'][_0xb931('0x4b')]+'%'};return _0x16a44a;})});}_0x1739fb=_[_0xb931('0x4c')]({},_0x1739fb,_0xb534c8['options']);return _0x3ea8cc['getDescriptions'](_0x1739fb);}})[_0xb931('0x21')](function(_0x189bd4){if(_0x189bd4){_0xfd37af=_0x189bd4[_0xb931('0x44')];if(!_0xb534c8[_0xb931('0x3e')][_0xb931('0x5e')]('nolimit')){_0x1739fb[_0xb931('0x46')]=qs[_0xb931('0x46')](_0xb534c8[_0xb931('0x3e')][_0xb931('0x46')]);_0x1739fb[_0xb931('0x30')]=qs[_0xb931('0x30')](_0xb534c8['query'][_0xb931('0x30')]);}return _0x3ea8cc[_0xb931('0x60')](_0x1739fb);}})[_0xb931('0x21')](function(_0x27ca8a){if(_0x27ca8a){return _0x27ca8a?{'count':_0xfd37af,'rows':_0x27ca8a}:null;}})[_0xb931('0x21')](respondWithResult(_0x45dbd3,null))[_0xb931('0x57')](handleError(_0x45dbd3,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 36f97bd..a17a4f3 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 _0x409e=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','lodash'];(function(_0x2353fe,_0x4b0bca){var _0x4d43f6=function(_0x5d0bd9){while(--_0x5d0bd9){_0x2353fe['push'](_0x2353fe['shift']());}};_0x4d43f6(++_0x4b0bca);}(_0x409e,0x1a3));var _0xe409=function(_0x485f53,_0x104081){_0x485f53=_0x485f53-0x0;var _0x480f1e=_0x409e[_0x485f53];return _0x480f1e;};'use strict';var _=require(_0xe409('0x0'));var util=require(_0xe409('0x1'));var logger=require(_0xe409('0x2'))('api');var moment=require(_0xe409('0x3'));var BPromise=require(_0xe409('0x4'));var rp=require(_0xe409('0x5'));var fs=require('fs');var path=require(_0xe409('0x6'));var rimraf=require(_0xe409('0x7'));var config=require(_0xe409('0x8'));var attributes=require(_0xe409('0x9'));module[_0xe409('0xa')]=function(_0x1118b6,_0x3d9cb2){return _0x1118b6[_0xe409('0xb')]('Dynamics365Configuration',attributes,{'tableName':'int_dynamics365_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c4=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','int_dynamics365_configurations','lodash','../../config/logger'];(function(_0x5910ab,_0x27b2c8){var _0x4c829c=function(_0x5f254a){while(--_0x5f254a){_0x5910ab['push'](_0x5910ab['shift']());}};_0x4c829c(++_0x27b2c8);}(_0xc3c4,0xf5));var _0x4c3c=function(_0x14f496,_0x26e660){_0x14f496=_0x14f496-0x0;var _0x4af8fc=_0xc3c4[_0x14f496];return _0x4af8fc;};'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 diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 7a2692e..66a3aa4 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 _0x19f3=['result','catch','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x514b40,_0x1945f4){var _0x40b68f=function(_0x57d1e3){while(--_0x57d1e3){_0x514b40['push'](_0x514b40['shift']());}};_0x40b68f(++_0x1945f4);}(_0x19f3,0x142));var _0x319f=function(_0xfee10f,_0x53470e){_0xfee10f=_0xfee10f-0x0;var _0xb91051=_0x19f3[_0xfee10f];return _0xb91051;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x319f('0x0'));var BPromise=require(_0x319f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x319f('0x2'))['db'];var utils=require(_0x319f('0x3'));var logger=require(_0x319f('0x4'))(_0x319f('0x5'));var config=require(_0x319f('0x6'));var jayson=require(_0x319f('0x7'));var client=jayson[_0x319f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f8d92,_0x247e8f,_0x44008d){return new BPromise(function(_0x5621d1,_0x4e419){return client['request'](_0x2f8d92,_0x44008d)[_0x319f('0x9')](function(_0x1a7af0){logger[_0x319f('0xa')](_0x319f('0xb'),_0x247e8f,_0x319f('0xc'));logger[_0x319f('0xd')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x247e8f,_0x319f('0xc'),JSON[_0x319f('0xe')](_0x1a7af0));if(_0x1a7af0[_0x319f('0xf')]){if(_0x1a7af0['error'][_0x319f('0x10')]===0x1f4){logger[_0x319f('0xf')](_0x319f('0xb'),_0x247e8f,_0x1a7af0[_0x319f('0xf')][_0x319f('0x11')]);return _0x4e419(_0x1a7af0['error'][_0x319f('0x11')]);}logger[_0x319f('0xf')](_0x319f('0xb'),_0x247e8f,_0x1a7af0[_0x319f('0xf')][_0x319f('0x11')]);return _0x5621d1(_0x1a7af0['error']['message']);}else{logger[_0x319f('0xa')](_0x319f('0xb'),_0x247e8f,_0x319f('0xc'));_0x5621d1(_0x1a7af0[_0x319f('0x12')][_0x319f('0x11')]);}})[_0x319f('0x13')](function(_0x29b38b){logger[_0x319f('0xf')](_0x319f('0xb'),_0x247e8f,_0x29b38b);_0x4e419(_0x29b38b);});});} \ No newline at end of file +var _0xcb24=['info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then'];(function(_0x57e50b,_0x16e856){var _0x4a1016=function(_0x3db554){while(--_0x3db554){_0x57e50b['push'](_0x57e50b['shift']());}};_0x4a1016(++_0x16e856);}(_0xcb24,0xe5));var _0x4cb2=function(_0x14cfde,_0x403505){_0x14cfde=_0x14cfde-0x0;var _0xa40048=_0xcb24[_0x14cfde];return _0xa40048;};'use strict';var _=require(_0x4cb2('0x0'));var util=require(_0x4cb2('0x1'));var moment=require('moment');var BPromise=require(_0x4cb2('0x2'));var rs=require(_0x4cb2('0x3'));var fs=require('fs');var Redis=require(_0x4cb2('0x4'));var db=require(_0x4cb2('0x5'))['db'];var utils=require(_0x4cb2('0x6'));var logger=require(_0x4cb2('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4cb2('0x8'));var client=jayson[_0x4cb2('0x9')][_0x4cb2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x88d657,_0x43bdb0,_0x8db9f2){return new BPromise(function(_0x2714b3,_0x3f88b0){return client[_0x4cb2('0xb')](_0x88d657,_0x8db9f2)[_0x4cb2('0xc')](function(_0x226ed4){logger[_0x4cb2('0xd')](_0x4cb2('0xe'),_0x43bdb0,_0x4cb2('0xf'));logger[_0x4cb2('0x10')]('Dynamics365Configuration,\x20%s,\x20%s,\x20%s',_0x43bdb0,_0x4cb2('0xf'),JSON['stringify'](_0x226ed4));if(_0x226ed4[_0x4cb2('0x11')]){if(_0x226ed4[_0x4cb2('0x11')][_0x4cb2('0x12')]===0x1f4){logger[_0x4cb2('0x11')]('Dynamics365Configuration,\x20%s,\x20%s',_0x43bdb0,_0x226ed4['error']['message']);return _0x3f88b0(_0x226ed4[_0x4cb2('0x11')][_0x4cb2('0x13')]);}logger[_0x4cb2('0x11')](_0x4cb2('0xe'),_0x43bdb0,_0x226ed4[_0x4cb2('0x11')][_0x4cb2('0x13')]);return _0x2714b3(_0x226ed4[_0x4cb2('0x11')][_0x4cb2('0x13')]);}else{logger[_0x4cb2('0xd')](_0x4cb2('0xe'),_0x43bdb0,_0x4cb2('0xf'));_0x2714b3(_0x226ed4[_0x4cb2('0x14')][_0x4cb2('0x13')]);}})[_0x4cb2('0x15')](function(_0x1a8107){logger[_0x4cb2('0x11')](_0x4cb2('0xe'),_0x43bdb0,_0x1a8107);_0x3f88b0(_0x1a8107);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index bd0cb79..f7faef3 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 _0x3667=['/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intDynamics365Field.controller','get','isAuthenticated','index','show','post','create','put'];(function(_0x39caaa,_0x1f37bc){var _0x9b9c7d=function(_0x2da02c){while(--_0x2da02c){_0x39caaa['push'](_0x39caaa['shift']());}};_0x9b9c7d(++_0x1f37bc);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var path=require(_0x7366('0x2'));var timeout=require(_0x7366('0x3'));var express=require(_0x7366('0x4'));var router=express['Router']();var auth=require(_0x7366('0x5'));var interaction=require(_0x7366('0x6'));var config=require('../../config/environment');var controller=require(_0x7366('0x7'));router[_0x7366('0x8')]('/',auth[_0x7366('0x9')](),controller[_0x7366('0xa')]);router[_0x7366('0x8')]('/:id',auth[_0x7366('0x9')](),controller[_0x7366('0xb')]);router[_0x7366('0xc')]('/',auth[_0x7366('0x9')](),controller[_0x7366('0xd')]);router[_0x7366('0xe')](_0x7366('0xf'),auth[_0x7366('0x9')](),controller[_0x7366('0x10')]);router[_0x7366('0x11')](_0x7366('0xf'),auth[_0x7366('0x9')](),controller[_0x7366('0x12')]);module[_0x7366('0x13')]=router; \ No newline at end of file +var _0x1b32=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','post','destroy','util','path'];(function(_0x5b7a0a,_0x566d2d){var _0x333db9=function(_0x1fa84d){while(--_0x1fa84d){_0x5b7a0a['push'](_0x5b7a0a['shift']());}};_0x333db9(++_0x566d2d);}(_0x1b32,0x85));var _0x21b3=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x1b32[_0x57b54c];return _0x59cc19;};'use strict';var multer=require('multer');var util=require(_0x21b3('0x0'));var path=require(_0x21b3('0x1'));var timeout=require(_0x21b3('0x2'));var express=require(_0x21b3('0x3'));var router=express[_0x21b3('0x4')]();var auth=require(_0x21b3('0x5'));var interaction=require(_0x21b3('0x6'));var config=require(_0x21b3('0x7'));var controller=require(_0x21b3('0x8'));router[_0x21b3('0x9')]('/',auth[_0x21b3('0xa')](),controller[_0x21b3('0xb')]);router[_0x21b3('0x9')](_0x21b3('0xc'),auth[_0x21b3('0xa')](),controller['show']);router[_0x21b3('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x21b3('0xc'),auth[_0x21b3('0xa')](),controller['update']);router['delete'](_0x21b3('0xc'),auth[_0x21b3('0xa')](),controller[_0x21b3('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 44c78e7..3027a4e 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 _0x78b7=['ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN','sequelize','exports'];(function(_0x1a7324,_0x4fd76d){var _0xe7e111=function(_0x4c059a){while(--_0x4c059a){_0x1a7324['push'](_0x1a7324['shift']());}};_0xe7e111(++_0x4fd76d);}(_0x78b7,0x1ae));var _0x778b=function(_0x3ff853,_0x1ed201){_0x3ff853=_0x3ff853-0x0;var _0x38dbed=_0x78b7[_0x3ff853];return _0x38dbed;};'use strict';var Sequelize=require(_0x778b('0x0'));module[_0x778b('0x1')]={'type':{'type':Sequelize[_0x778b('0x2')](_0x778b('0x3'),_0x778b('0x4'),_0x778b('0x5'),_0x778b('0x6')),'defaultValue':_0x778b('0x3')},'content':{'type':Sequelize[_0x778b('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x778b('0x3'),'variable',_0x778b('0x5'))},'keyContent':{'type':Sequelize[_0x778b('0x7')]},'idField':{'type':Sequelize[_0x778b('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x778b('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4876=['ENUM','customVariable','string','STRING','variable','BOOLEAN'];(function(_0x22136c,_0x2eaa2b){var _0xd0c875=function(_0x16e87b){while(--_0x16e87b){_0x22136c['push'](_0x22136c['shift']());}};_0xd0c875(++_0x2eaa2b);}(_0x4876,0x84));var _0x6487=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4876[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x6487('0x0')]('string','variable',_0x6487('0x1'),'keyValue'),'defaultValue':_0x6487('0x2')},'content':{'type':Sequelize[_0x6487('0x3')]},'key':{'type':Sequelize[_0x6487('0x3')]},'keyType':{'type':Sequelize[_0x6487('0x0')]('string',_0x6487('0x4'),_0x6487('0x1'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x6487('0x3')]},'nameField':{'type':Sequelize[_0x6487('0x3')]},'customField':{'type':Sequelize[_0x6487('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6487('0x3')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index 0c3a27c..f3e9e2a 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 _0x8969=['includeAll','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','error','stack','index','map','Dynamics365Field','rawAttributes','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','then','include','findAll','rows','catch','show','params','keys'];(function(_0x5d0bfb,_0x1de3e5){var _0x587698=function(_0x98aaa){while(--_0x98aaa){_0x5d0bfb['push'](_0x5d0bfb['shift']());}};_0x587698(++_0x1de3e5);}(_0x8969,0x130));var _0x9896=function(_0x82aebb,_0x2658c1){_0x82aebb=_0x82aebb-0x0;var _0x4c3aa3=_0x8969[_0x82aebb];return _0x4c3aa3;};'use strict';var pdf=require(_0x9896('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9896('0x1'));var zipdir=require(_0x9896('0x2'));var jsonpatch=require(_0x9896('0x3'));var rp=require(_0x9896('0x4'));var moment=require(_0x9896('0x5'));var BPromise=require(_0x9896('0x6'));var Mustache=require(_0x9896('0x7'));var util=require('util');var path=require(_0x9896('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x9896('0x9'));var fs=require('fs');var _=require(_0x9896('0xa'));var squel=require(_0x9896('0xb'));var crypto=require('crypto');var jsforce=require(_0x9896('0xc'));var deskjs=require(_0x9896('0xd'));var toCsv=require(_0x9896('0xe'));var querystring=require('querystring');var Papa=require(_0x9896('0xf'));var Redis=require(_0x9896('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9896('0x11'));var as=require(_0x9896('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9896('0x13'))(_0x9896('0x14'));var utils=require(_0x9896('0x15'));var config=require(_0x9896('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5611f3,_0x5520ac){_0x5520ac=_0x5520ac||0xcc;return function(_0x331757){if(_0x331757){return _0x5611f3[_0x9896('0x17')](_0x5520ac);}return _0x5611f3[_0x9896('0x18')](_0x5520ac)[_0x9896('0x19')]();};}function respondWithResult(_0x37a660,_0x240012){_0x240012=_0x240012||0xc8;return function(_0x29f386){if(_0x29f386){return _0x37a660[_0x9896('0x18')](_0x240012)[_0x9896('0x1a')](_0x29f386);}};}function respondWithFilteredResult(_0x29952c,_0x51dce3){return function(_0xa13db9){if(_0xa13db9){var _0x51e8cc=_0xa13db9[_0x9896('0x1b')],_0x36596b=_0x51dce3['offset'],_0x12c503=_0x51dce3[_0x9896('0x1c')]+_0x51dce3[_0x9896('0x1d')],_0x2d0d7e;if(_0x12c503>=_0x51e8cc){_0x12c503=_0x51e8cc;_0x2d0d7e=0xc8;}else{_0x2d0d7e=0xce;}_0x29952c[_0x9896('0x18')](_0x2d0d7e);return _0x29952c[_0x9896('0x1e')]('Content-Range',_0x36596b+'-'+_0x12c503+'/'+_0x51e8cc)[_0x9896('0x1a')](_0xa13db9);}return null;};}function patchUpdates(_0x581480){return function(_0x41580e){try{jsonpatch[_0x9896('0x1f')](_0x41580e,_0x581480,!![]);}catch(_0x596a3f){return BPromise[_0x9896('0x20')](_0x596a3f);}return _0x41580e[_0x9896('0x21')]();};}function saveUpdates(_0x435714,_0x3038fd){return function(_0x281bd8){if(_0x281bd8){return _0x281bd8[_0x9896('0x22')](_0x435714)['then'](function(_0x18ff6e){return _0x18ff6e;});}return null;};}function removeEntity(_0x389318,_0x4276e3){return function(_0xc6372c){if(_0xc6372c){return _0xc6372c[_0x9896('0x23')]()['then'](function(){_0x389318[_0x9896('0x18')](0xcc)[_0x9896('0x19')]();});}};}function handleEntityNotFound(_0x173eb6,_0x550ed9){return function(_0x5ea62d){if(!_0x5ea62d){_0x173eb6[_0x9896('0x17')](0x194);}return _0x5ea62d;};}function handleError(_0x5a3515,_0x2627c9){_0x2627c9=_0x2627c9||0x1f4;return function(_0x438e9c){logger[_0x9896('0x24')](_0x438e9c[_0x9896('0x25')]);if(_0x438e9c['name']){delete _0x438e9c['name'];}_0x5a3515[_0x9896('0x18')](_0x2627c9)['send'](_0x438e9c);};}exports[_0x9896('0x26')]=function(_0x2685e8,_0x22c783){var _0x1a6c92={},_0x3b9ee2={},_0xa316c={'count':0x0,'rows':[]};var _0x19cecb=_[_0x9896('0x27')](db[_0x9896('0x28')][_0x9896('0x29')],function(_0x17a8fe){return{'name':_0x17a8fe[_0x9896('0x2a')],'type':_0x17a8fe[_0x9896('0x2b')][_0x9896('0x2c')]};});_0x3b9ee2[_0x9896('0x2d')]=_[_0x9896('0x27')](_0x19cecb,'name');_0x3b9ee2[_0x9896('0x2e')]=_['keys'](_0x2685e8[_0x9896('0x2e')]);_0x3b9ee2['filters']=_['intersection'](_0x3b9ee2[_0x9896('0x2d')],_0x3b9ee2[_0x9896('0x2e')]);_0x1a6c92['attributes']=_[_0x9896('0x2f')](_0x3b9ee2[_0x9896('0x2d')],qs[_0x9896('0x30')](_0x2685e8['query'][_0x9896('0x30')]));_0x1a6c92[_0x9896('0x31')]=_0x1a6c92['attributes'][_0x9896('0x32')]?_0x1a6c92[_0x9896('0x31')]:_0x3b9ee2[_0x9896('0x2d')];if(!_0x2685e8[_0x9896('0x2e')][_0x9896('0x33')](_0x9896('0x34'))){_0x1a6c92[_0x9896('0x1d')]=qs[_0x9896('0x1d')](_0x2685e8[_0x9896('0x2e')][_0x9896('0x1d')]);_0x1a6c92[_0x9896('0x1c')]=qs[_0x9896('0x1c')](_0x2685e8['query'][_0x9896('0x1c')]);}_0x1a6c92[_0x9896('0x35')]=qs[_0x9896('0x36')](_0x2685e8[_0x9896('0x2e')][_0x9896('0x36')]);_0x1a6c92['where']=qs[_0x9896('0x37')](_[_0x9896('0x38')](_0x2685e8[_0x9896('0x2e')],_0x3b9ee2[_0x9896('0x37')]));if(_0x2685e8[_0x9896('0x2e')][_0x9896('0x39')]){_0x1a6c92[_0x9896('0x3a')]=_[_0x9896('0x3b')](_0x1a6c92[_0x9896('0x3a')],{'$or':_[_0x9896('0x27')](_0x19cecb,function(_0x26131a){if(_0x26131a[_0x9896('0x2b')]!==_0x9896('0x3c')){var _0x4d2922={};_0x4d2922[_0x26131a[_0x9896('0x3d')]]={'$like':'%'+_0x2685e8['query']['filter']+'%'};return _0x4d2922;}})});}_0x1a6c92=_['merge']({},_0x1a6c92,_0x2685e8[_0x9896('0x3e')]);var _0x373b3a={'where':_0x1a6c92[_0x9896('0x3a')]};return db[_0x9896('0x28')][_0x9896('0x1b')](_0x373b3a)[_0x9896('0x3f')](function(_0x27fd79){_0xa316c[_0x9896('0x1b')]=_0x27fd79;if(_0x2685e8[_0x9896('0x2e')]['includeAll']){_0x1a6c92[_0x9896('0x40')]=[{'all':!![]}];}return db[_0x9896('0x28')][_0x9896('0x41')](_0x1a6c92);})[_0x9896('0x3f')](function(_0x3df2a9){_0xa316c[_0x9896('0x42')]=_0x3df2a9;return _0xa316c;})[_0x9896('0x3f')](respondWithFilteredResult(_0x22c783,_0x1a6c92))[_0x9896('0x43')](handleError(_0x22c783,null));};exports[_0x9896('0x44')]=function(_0x1e302a,_0x3f849d){var _0x58b611={'raw':!![],'where':{'id':_0x1e302a[_0x9896('0x45')]['id']}},_0x5a7c76={};_0x5a7c76[_0x9896('0x2d')]=_[_0x9896('0x46')](db['Dynamics365Field'][_0x9896('0x29')]);_0x5a7c76[_0x9896('0x2e')]=_['keys'](_0x1e302a[_0x9896('0x2e')]);_0x5a7c76[_0x9896('0x37')]=_['intersection'](_0x5a7c76[_0x9896('0x2d')],_0x5a7c76[_0x9896('0x2e')]);_0x58b611[_0x9896('0x31')]=_['intersection'](_0x5a7c76[_0x9896('0x2d')],qs[_0x9896('0x30')](_0x1e302a[_0x9896('0x2e')]['fields']));_0x58b611[_0x9896('0x31')]=_0x58b611[_0x9896('0x31')]['length']?_0x58b611['attributes']:_0x5a7c76[_0x9896('0x2d')];if(_0x1e302a[_0x9896('0x2e')][_0x9896('0x47')]){_0x58b611[_0x9896('0x40')]=[{'all':!![]}];}_0x58b611=_[_0x9896('0x3b')]({},_0x58b611,_0x1e302a[_0x9896('0x3e')]);return db[_0x9896('0x28')][_0x9896('0x48')](_0x58b611)[_0x9896('0x3f')](handleEntityNotFound(_0x3f849d,null))[_0x9896('0x3f')](respondWithResult(_0x3f849d,null))[_0x9896('0x43')](handleError(_0x3f849d,null));};exports[_0x9896('0x49')]=function(_0x5d7557,_0x489584){return db[_0x9896('0x28')][_0x9896('0x49')](_0x5d7557[_0x9896('0x4a')],{})[_0x9896('0x3f')](respondWithResult(_0x489584,0xc9))[_0x9896('0x43')](handleError(_0x489584,null));};exports[_0x9896('0x22')]=function(_0x1f2aa5,_0x2a21a5){if(_0x1f2aa5[_0x9896('0x4a')]['id']){delete _0x1f2aa5[_0x9896('0x4a')]['id'];}return db[_0x9896('0x28')][_0x9896('0x48')]({'where':{'id':_0x1f2aa5[_0x9896('0x45')]['id']}})['then'](handleEntityNotFound(_0x2a21a5,null))[_0x9896('0x3f')](saveUpdates(_0x1f2aa5[_0x9896('0x4a')],null))[_0x9896('0x3f')](respondWithResult(_0x2a21a5,null))[_0x9896('0x43')](handleError(_0x2a21a5,null));};exports[_0x9896('0x23')]=function(_0x5d9807,_0x5701e2){return db['Dynamics365Field'][_0x9896('0x48')]({'where':{'id':_0x5d9807[_0x9896('0x45')]['id']}})[_0x9896('0x3f')](handleEntityNotFound(_0x5701e2,null))['then'](removeEntity(_0x5701e2,null))[_0x9896('0x43')](handleError(_0x5701e2,null));}; \ No newline at end of file +var _0xf0f4=['include','findAll','rows','catch','show','params','find','create','body','update','destroy','eml-format','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','Dynamics365Field','count','includeAll'];(function(_0x20c383,_0xecccbe){var _0x190833=function(_0x3c45db){while(--_0x3c45db){_0x20c383['push'](_0x20c383['shift']());}};_0x190833(++_0xecccbe);}(_0xf0f4,0x182));var _0x4f0f=function(_0x56ed08,_0x1d68f6){_0x56ed08=_0x56ed08-0x0;var _0x18ca24=_0xf0f4[_0x56ed08];return _0x18ca24;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x4f0f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x4f0f('0x1'));var rp=require(_0x4f0f('0x2'));var moment=require('moment');var BPromise=require(_0x4f0f('0x3'));var Mustache=require(_0x4f0f('0x4'));var util=require(_0x4f0f('0x5'));var path=require(_0x4f0f('0x6'));var sox=require(_0x4f0f('0x7'));var csv=require(_0x4f0f('0x8'));var ejs=require(_0x4f0f('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4f0f('0xa'));var crypto=require(_0x4f0f('0xb'));var jsforce=require(_0x4f0f('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4f0f('0x8'));var querystring=require(_0x4f0f('0xd'));var Papa=require(_0x4f0f('0xe'));var Redis=require(_0x4f0f('0xf'));var authService=require(_0x4f0f('0x10'));var qs=require(_0x4f0f('0x11'));var as=require(_0x4f0f('0x12'));var hardwareService=require(_0x4f0f('0x13'));var logger=require('../../config/logger')(_0x4f0f('0x14'));var utils=require(_0x4f0f('0x15'));var config=require(_0x4f0f('0x16'));var db=require(_0x4f0f('0x17'))['db'];function respondWithStatusCode(_0x2221e5,_0x1a1b94){_0x1a1b94=_0x1a1b94||0xcc;return function(_0x123845){if(_0x123845){return _0x2221e5[_0x4f0f('0x18')](_0x1a1b94);}return _0x2221e5[_0x4f0f('0x19')](_0x1a1b94)[_0x4f0f('0x1a')]();};}function respondWithResult(_0x3fc985,_0x4e1e26){_0x4e1e26=_0x4e1e26||0xc8;return function(_0xebecc0){if(_0xebecc0){return _0x3fc985[_0x4f0f('0x19')](_0x4e1e26)[_0x4f0f('0x1b')](_0xebecc0);}};}function respondWithFilteredResult(_0x22de68,_0x51a713){return function(_0xd9ad12){if(_0xd9ad12){var _0x46d7cf=_0xd9ad12['count'],_0x5783=_0x51a713[_0x4f0f('0x1c')],_0x1c0aa1=_0x51a713[_0x4f0f('0x1c')]+_0x51a713[_0x4f0f('0x1d')],_0x4038fd;if(_0x1c0aa1>=_0x46d7cf){_0x1c0aa1=_0x46d7cf;_0x4038fd=0xc8;}else{_0x4038fd=0xce;}_0x22de68['status'](_0x4038fd);return _0x22de68[_0x4f0f('0x1e')](_0x4f0f('0x1f'),_0x5783+'-'+_0x1c0aa1+'/'+_0x46d7cf)[_0x4f0f('0x1b')](_0xd9ad12);}return null;};}function patchUpdates(_0x5f5363){return function(_0x3a37a9){try{jsonpatch[_0x4f0f('0x20')](_0x3a37a9,_0x5f5363,!![]);}catch(_0x34bba8){return BPromise[_0x4f0f('0x21')](_0x34bba8);}return _0x3a37a9[_0x4f0f('0x22')]();};}function saveUpdates(_0x3bd1b9,_0x537074){return function(_0x276387){if(_0x276387){return _0x276387['update'](_0x3bd1b9)[_0x4f0f('0x23')](function(_0x21ebad){return _0x21ebad;});}return null;};}function removeEntity(_0x5b5889,_0x4e4b28){return function(_0x1bdfb4){if(_0x1bdfb4){return _0x1bdfb4['destroy']()[_0x4f0f('0x23')](function(){_0x5b5889[_0x4f0f('0x19')](0xcc)[_0x4f0f('0x1a')]();});}};}function handleEntityNotFound(_0x17f10c,_0x454720){return function(_0x17a9e9){if(!_0x17a9e9){_0x17f10c['sendStatus'](0x194);}return _0x17a9e9;};}function handleError(_0x1a46dd,_0xcdcd05){_0xcdcd05=_0xcdcd05||0x1f4;return function(_0x37aefe){logger[_0x4f0f('0x24')](_0x37aefe[_0x4f0f('0x25')]);if(_0x37aefe[_0x4f0f('0x26')]){delete _0x37aefe[_0x4f0f('0x26')];}_0x1a46dd[_0x4f0f('0x19')](_0xcdcd05)[_0x4f0f('0x27')](_0x37aefe);};}exports[_0x4f0f('0x28')]=function(_0x37ae8f,_0x394303){var _0x381329={},_0x5c13d1={},_0x1e6941={'count':0x0,'rows':[]};var _0x269563=_[_0x4f0f('0x29')](db['Dynamics365Field'][_0x4f0f('0x2a')],function(_0x4e5f0d){return{'name':_0x4e5f0d[_0x4f0f('0x2b')],'type':_0x4e5f0d[_0x4f0f('0x2c')]['key']};});_0x5c13d1['model']=_[_0x4f0f('0x29')](_0x269563,'name');_0x5c13d1[_0x4f0f('0x2d')]=_[_0x4f0f('0x2e')](_0x37ae8f['query']);_0x5c13d1[_0x4f0f('0x2f')]=_[_0x4f0f('0x30')](_0x5c13d1[_0x4f0f('0x31')],_0x5c13d1[_0x4f0f('0x2d')]);_0x381329['attributes']=_[_0x4f0f('0x30')](_0x5c13d1[_0x4f0f('0x31')],qs[_0x4f0f('0x32')](_0x37ae8f[_0x4f0f('0x2d')]['fields']));_0x381329[_0x4f0f('0x33')]=_0x381329[_0x4f0f('0x33')][_0x4f0f('0x34')]?_0x381329['attributes']:_0x5c13d1[_0x4f0f('0x31')];if(!_0x37ae8f[_0x4f0f('0x2d')]['hasOwnProperty'](_0x4f0f('0x35'))){_0x381329[_0x4f0f('0x1d')]=qs[_0x4f0f('0x1d')](_0x37ae8f[_0x4f0f('0x2d')]['limit']);_0x381329[_0x4f0f('0x1c')]=qs[_0x4f0f('0x1c')](_0x37ae8f[_0x4f0f('0x2d')][_0x4f0f('0x1c')]);}_0x381329[_0x4f0f('0x36')]=qs[_0x4f0f('0x37')](_0x37ae8f[_0x4f0f('0x2d')][_0x4f0f('0x37')]);_0x381329['where']=qs[_0x4f0f('0x2f')](_[_0x4f0f('0x38')](_0x37ae8f[_0x4f0f('0x2d')],_0x5c13d1[_0x4f0f('0x2f')]));if(_0x37ae8f[_0x4f0f('0x2d')][_0x4f0f('0x39')]){_0x381329[_0x4f0f('0x3a')]=_['merge'](_0x381329[_0x4f0f('0x3a')],{'$or':_[_0x4f0f('0x29')](_0x269563,function(_0x32ff59){if(_0x32ff59['type']!==_0x4f0f('0x3b')){var _0x47b3fc={};_0x47b3fc[_0x32ff59[_0x4f0f('0x26')]]={'$like':'%'+_0x37ae8f['query'][_0x4f0f('0x39')]+'%'};return _0x47b3fc;}})});}_0x381329=_[_0x4f0f('0x3c')]({},_0x381329,_0x37ae8f['options']);var _0x76277b={'where':_0x381329[_0x4f0f('0x3a')]};return db[_0x4f0f('0x3d')]['count'](_0x76277b)[_0x4f0f('0x23')](function(_0xda7adc){_0x1e6941[_0x4f0f('0x3e')]=_0xda7adc;if(_0x37ae8f[_0x4f0f('0x2d')][_0x4f0f('0x3f')]){_0x381329[_0x4f0f('0x40')]=[{'all':!![]}];}return db[_0x4f0f('0x3d')][_0x4f0f('0x41')](_0x381329);})[_0x4f0f('0x23')](function(_0x3da96a){_0x1e6941[_0x4f0f('0x42')]=_0x3da96a;return _0x1e6941;})['then'](respondWithFilteredResult(_0x394303,_0x381329))[_0x4f0f('0x43')](handleError(_0x394303,null));};exports[_0x4f0f('0x44')]=function(_0x2e7c5e,_0x204d10){var _0x419cb4={'raw':!![],'where':{'id':_0x2e7c5e[_0x4f0f('0x45')]['id']}},_0x178d74={};_0x178d74['model']=_[_0x4f0f('0x2e')](db[_0x4f0f('0x3d')][_0x4f0f('0x2a')]);_0x178d74[_0x4f0f('0x2d')]=_[_0x4f0f('0x2e')](_0x2e7c5e[_0x4f0f('0x2d')]);_0x178d74['filters']=_[_0x4f0f('0x30')](_0x178d74[_0x4f0f('0x31')],_0x178d74['query']);_0x419cb4['attributes']=_[_0x4f0f('0x30')](_0x178d74[_0x4f0f('0x31')],qs[_0x4f0f('0x32')](_0x2e7c5e['query'][_0x4f0f('0x32')]));_0x419cb4['attributes']=_0x419cb4['attributes'][_0x4f0f('0x34')]?_0x419cb4[_0x4f0f('0x33')]:_0x178d74[_0x4f0f('0x31')];if(_0x2e7c5e[_0x4f0f('0x2d')][_0x4f0f('0x3f')]){_0x419cb4[_0x4f0f('0x40')]=[{'all':!![]}];}_0x419cb4=_['merge']({},_0x419cb4,_0x2e7c5e['options']);return db[_0x4f0f('0x3d')][_0x4f0f('0x46')](_0x419cb4)[_0x4f0f('0x23')](handleEntityNotFound(_0x204d10,null))['then'](respondWithResult(_0x204d10,null))[_0x4f0f('0x43')](handleError(_0x204d10,null));};exports[_0x4f0f('0x47')]=function(_0x343965,_0x4e9265){return db[_0x4f0f('0x3d')]['create'](_0x343965[_0x4f0f('0x48')],{})['then'](respondWithResult(_0x4e9265,0xc9))[_0x4f0f('0x43')](handleError(_0x4e9265,null));};exports[_0x4f0f('0x49')]=function(_0x2b0d3e,_0x45184a){if(_0x2b0d3e[_0x4f0f('0x48')]['id']){delete _0x2b0d3e['body']['id'];}return db['Dynamics365Field'][_0x4f0f('0x46')]({'where':{'id':_0x2b0d3e['params']['id']}})[_0x4f0f('0x23')](handleEntityNotFound(_0x45184a,null))[_0x4f0f('0x23')](saveUpdates(_0x2b0d3e[_0x4f0f('0x48')],null))[_0x4f0f('0x23')](respondWithResult(_0x45184a,null))[_0x4f0f('0x43')](handleError(_0x45184a,null));};exports[_0x4f0f('0x4a')]=function(_0x168383,_0x37c0d5){return db['Dynamics365Field'][_0x4f0f('0x46')]({'where':{'id':_0x168383[_0x4f0f('0x45')]['id']}})[_0x4f0f('0x23')](handleEntityNotFound(_0x37c0d5,null))[_0x4f0f('0x23')](removeEntity(_0x37c0d5,null))[_0x4f0f('0x43')](handleError(_0x37c0d5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 2598c3b..45022f1 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 _0x7d53=['../../config/logger','api','bluebird','path','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util'];(function(_0x30e201,_0x1350d8){var _0x3e7507=function(_0x35524f){while(--_0x35524f){_0x30e201['push'](_0x30e201['shift']());}};_0x3e7507(++_0x1350d8);}(_0x7d53,0x1b1));var _0x37d5=function(_0x37de11,_0x237545){_0x37de11=_0x37de11-0x0;var _0x421558=_0x7d53[_0x37de11];return _0x421558;};'use strict';var _=require(_0x37d5('0x0'));var util=require(_0x37d5('0x1'));var logger=require(_0x37d5('0x2'))(_0x37d5('0x3'));var moment=require('moment');var BPromise=require(_0x37d5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x37d5('0x5'));var rimraf=require('rimraf');var config=require(_0x37d5('0x6'));var attributes=require(_0x37d5('0x7'));module[_0x37d5('0x8')]=function(_0x4b5d24,_0x1cbbd6){return _0x4b5d24[_0x37d5('0x9')](_0x37d5('0xa'),attributes,{'tableName':_0x37d5('0xb'),'paranoid':![],'indexes':[{'name':_0x37d5('0xc'),'fields':[_0x37d5('0xd'),_0x37d5('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xabd7=['rimraf','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','lodash','util','moment','bluebird','request-promise'];(function(_0x16c9a6,_0x27a0e3){var _0x4d7aad=function(_0x1dd74d){while(--_0x1dd74d){_0x16c9a6['push'](_0x16c9a6['shift']());}};_0x4d7aad(++_0x27a0e3);}(_0xabd7,0x103));var _0x7abd=function(_0x16db87,_0x454dcc){_0x16db87=_0x16db87-0x0;var _0x2725f7=_0xabd7[_0x16db87];return _0x2725f7;};'use strict';var _=require(_0x7abd('0x0'));var util=require(_0x7abd('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7abd('0x2'));var BPromise=require(_0x7abd('0x3'));var rp=require(_0x7abd('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7abd('0x5'));var config=require('../../config/environment');var attributes=require(_0x7abd('0x6'));module[_0x7abd('0x7')]=function(_0x49a43f,_0x56705f){return _0x49a43f[_0x7abd('0x8')](_0x7abd('0x9'),attributes,{'tableName':_0x7abd('0xa'),'paranoid':![],'indexes':[{'name':_0x7abd('0xb'),'fields':['idField','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 9e18c25..a5e6979 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 _0xfc17=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','request\x20sent','stringify','error','code','Dynamics365Field,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x121ba0,_0x2729d1){var _0x7767c2=function(_0x314494){while(--_0x314494){_0x121ba0['push'](_0x121ba0['shift']());}};_0x7767c2(++_0x2729d1);}(_0xfc17,0x1b4));var _0x7fc1=function(_0x329528,_0x361060){_0x329528=_0x329528-0x0;var _0x2adb13=_0xfc17[_0x329528];return _0x2adb13;};'use strict';var _=require(_0x7fc1('0x0'));var util=require(_0x7fc1('0x1'));var moment=require(_0x7fc1('0x2'));var BPromise=require(_0x7fc1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7fc1('0x4'));var db=require(_0x7fc1('0x5'))['db'];var utils=require(_0x7fc1('0x6'));var logger=require(_0x7fc1('0x7'))(_0x7fc1('0x8'));var config=require(_0x7fc1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7fc1('0xa')][_0x7fc1('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2267ea,_0xf0d3fa,_0x24c678){return new BPromise(function(_0x1b7106,_0x3b631b){return client['request'](_0x2267ea,_0x24c678)[_0x7fc1('0xc')](function(_0x10e02b){logger[_0x7fc1('0xd')]('Dynamics365Field,\x20%s,\x20%s',_0xf0d3fa,_0x7fc1('0xe'));logger['debug']('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xf0d3fa,_0x7fc1('0xe'),JSON[_0x7fc1('0xf')](_0x10e02b));if(_0x10e02b[_0x7fc1('0x10')]){if(_0x10e02b[_0x7fc1('0x10')][_0x7fc1('0x11')]===0x1f4){logger[_0x7fc1('0x10')](_0x7fc1('0x12'),_0xf0d3fa,_0x10e02b[_0x7fc1('0x10')][_0x7fc1('0x13')]);return _0x3b631b(_0x10e02b[_0x7fc1('0x10')][_0x7fc1('0x13')]);}logger[_0x7fc1('0x10')]('Dynamics365Field,\x20%s,\x20%s',_0xf0d3fa,_0x10e02b['error'][_0x7fc1('0x13')]);return _0x1b7106(_0x10e02b[_0x7fc1('0x10')][_0x7fc1('0x13')]);}else{logger[_0x7fc1('0xd')](_0x7fc1('0x12'),_0xf0d3fa,_0x7fc1('0xe'));_0x1b7106(_0x10e02b[_0x7fc1('0x14')][_0x7fc1('0x13')]);}})[_0x7fc1('0x15')](function(_0x442176){logger['error'](_0x7fc1('0x12'),_0xf0d3fa,_0x442176);_0x3b631b(_0x442176);});});} \ No newline at end of file +var _0xdf55=['util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','request\x20sent','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash'];(function(_0x801efa,_0x37ce33){var _0x24e5c5=function(_0x4d77d0){while(--_0x4d77d0){_0x801efa['push'](_0x801efa['shift']());}};_0x24e5c5(++_0x37ce33);}(_0xdf55,0x83));var _0x5df5=function(_0x5dafd0,_0x3bcbb6){_0x5dafd0=_0x5dafd0-0x0;var _0x364354=_0xdf55[_0x5dafd0];return _0x364354;};'use strict';var _=require(_0x5df5('0x0'));var util=require(_0x5df5('0x1'));var moment=require('moment');var BPromise=require(_0x5df5('0x2'));var rs=require(_0x5df5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5df5('0x4'))['db'];var utils=require(_0x5df5('0x5'));var logger=require(_0x5df5('0x6'))('rpc');var config=require(_0x5df5('0x7'));var jayson=require(_0x5df5('0x8'));var client=jayson[_0x5df5('0x9')][_0x5df5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x9b8756,_0x2b7ed9,_0x4722a2){return new BPromise(function(_0x3743f3,_0x4d43a3){return client[_0x5df5('0xb')](_0x9b8756,_0x4722a2)[_0x5df5('0xc')](function(_0x41941e){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0x2b7ed9,_0x5df5('0xd'));logger['debug'](_0x5df5('0xe'),_0x2b7ed9,_0x5df5('0xd'),JSON['stringify'](_0x41941e));if(_0x41941e['error']){if(_0x41941e[_0x5df5('0xf')][_0x5df5('0x10')]===0x1f4){logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);return _0x4d43a3(_0x41941e[_0x5df5('0xf')][_0x5df5('0x12')]);}logger[_0x5df5('0xf')](_0x5df5('0x11'),_0x2b7ed9,_0x41941e['error'][_0x5df5('0x12')]);return _0x3743f3(_0x41941e['error'][_0x5df5('0x12')]);}else{logger[_0x5df5('0x13')](_0x5df5('0x11'),_0x2b7ed9,_0x5df5('0xd'));_0x3743f3(_0x41941e[_0x5df5('0x14')]['message']);}})[_0x5df5('0x15')](function(_0x457205){logger['error'](_0x5df5('0x11'),_0x2b7ed9,_0x457205);_0x4d43a3(_0x457205);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 421f80d..9701898 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 _0x295e=['update','delete','exports','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields'];(function(_0x5c38cd,_0x5a6b4e){var _0xc985ef=function(_0x4aa1df){while(--_0x4aa1df){_0x5c38cd['push'](_0x5c38cd['shift']());}};_0xc985ef(++_0x5a6b4e);}(_0x295e,0x1b8));var _0xe295=function(_0x21a57e,_0x390ab9){_0x21a57e=_0x21a57e-0x0;var _0xd467a6=_0x295e[_0x21a57e];return _0xd467a6;};'use strict';var multer=require('multer');var util=require(_0xe295('0x0'));var path=require(_0xe295('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe295('0x2')]();var auth=require(_0xe295('0x3'));var interaction=require(_0xe295('0x4'));var config=require(_0xe295('0x5'));var controller=require(_0xe295('0x6'));router[_0xe295('0x7')]('/',auth[_0xe295('0x8')](),controller[_0xe295('0x9')]);router['get'](_0xe295('0xa'),auth[_0xe295('0x8')](),controller[_0xe295('0xb')]);router[_0xe295('0x7')](_0xe295('0xc'),auth['isAuthenticated'](),controller[_0xe295('0xd')]);router[_0xe295('0x7')](_0xe295('0xe'),auth[_0xe295('0x8')](),controller[_0xe295('0xf')]);router['post']('/',auth[_0xe295('0x8')](),controller['create']);router['post'](_0xe295('0xc'),auth[_0xe295('0x8')](),controller['addConfiguration']);router['put'](_0xe295('0xa'),auth['isAuthenticated'](),controller[_0xe295('0x10')]);router[_0xe295('0x11')](_0xe295('0xa'),auth[_0xe295('0x8')](),controller['destroy']);module[_0xe295('0x12')]=router; \ No newline at end of file +var _0xeaa9=['put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','./intFreshdeskAccount.controller','get','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','post'];(function(_0x6a5a9c,_0x162627){var _0x34d9ed=function(_0x392642){while(--_0x392642){_0x6a5a9c['push'](_0x6a5a9c['shift']());}};_0x34d9ed(++_0x162627);}(_0xeaa9,0x123));var _0x9eaa=function(_0x788ef0,_0x48e2be){_0x788ef0=_0x788ef0-0x0;var _0x1e665c=_0xeaa9[_0x788ef0];return _0x1e665c;};'use strict';var multer=require(_0x9eaa('0x0'));var util=require(_0x9eaa('0x1'));var path=require(_0x9eaa('0x2'));var timeout=require('connect-timeout');var express=require(_0x9eaa('0x3'));var router=express[_0x9eaa('0x4')]();var auth=require(_0x9eaa('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9eaa('0x6'));router[_0x9eaa('0x7')]('/',auth[_0x9eaa('0x8')](),controller['index']);router[_0x9eaa('0x7')](_0x9eaa('0x9'),auth['isAuthenticated'](),controller[_0x9eaa('0xa')]);router[_0x9eaa('0x7')](_0x9eaa('0xb'),auth[_0x9eaa('0x8')](),controller[_0x9eaa('0xc')]);router['get'](_0x9eaa('0xd'),auth['isAuthenticated'](),controller[_0x9eaa('0xe')]);router['post']('/',auth[_0x9eaa('0x8')](),controller[_0x9eaa('0xf')]);router[_0x9eaa('0x10')]('/:id/configurations',auth[_0x9eaa('0x8')](),controller['addConfiguration']);router[_0x9eaa('0x11')](_0x9eaa('0x9'),auth[_0x9eaa('0x8')](),controller[_0x9eaa('0x12')]);router[_0x9eaa('0x13')]('/:id',auth[_0x9eaa('0x8')](),controller[_0x9eaa('0x14')]);module[_0x9eaa('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 193e308..4774fbd 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 _0x3024=['STRING','sequelize','exports'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x3024,0x64));var _0x4302=function(_0x5381d2,_0x5819ad){_0x5381d2=_0x5381d2-0x0;var _0x5e09b1=_0x3024[_0x5381d2];return _0x5e09b1;};'use strict';var Sequelize=require(_0x4302('0x0'));module[_0x4302('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4302('0x2')]},'username':{'type':Sequelize[_0x4302('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x4302('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x4302('0x2')]}}; \ No newline at end of file +var _0x1280=['username','sequelize','STRING'];(function(_0x2e52eb,_0x4627af){var _0x42ebbe=function(_0x1d19d6){while(--_0x1d19d6){_0x2e52eb['push'](_0x2e52eb['shift']());}};_0x42ebbe(++_0x4627af);}(_0x1280,0xac));var _0x0128=function(_0x2fc5db,_0x2253b1){_0x2fc5db=_0x2fc5db-0x0;var _0x1ef11b=_0x1280[_0x2fc5db];return _0x1ef11b;};'use strict';var Sequelize=require(_0x0128('0x0'));module['exports']={'name':{'type':Sequelize[_0x0128('0x1')]},'description':{'type':Sequelize[_0x0128('0x1')]},'username':{'type':Sequelize[_0x0128('0x1')],'unique':_0x0128('0x2')},'apiKey':{'type':Sequelize[_0x0128('0x1')]},'remoteUri':{'type':Sequelize[_0x0128('0x1')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x0128('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.controller.js index 5f197ec..39a56f4 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 _0x85f6=['Content-Range','json','apply','reject','save','update','sendStatus','stack','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','destroy','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','channel','Descriptions','FreshdeskField','Subjects','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','toString','base64','requester','subject','agent','description','priority','group','source','ticket_type','company','default','custom_text','custom_dropdown','label','choices','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','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','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','end','count','offset'];(function(_0x15408c,_0x1327b4){var _0x583777=function(_0x4e5db2){while(--_0x4e5db2){_0x15408c['push'](_0x15408c['shift']());}};_0x583777(++_0x1327b4);}(_0x85f6,0xd7));var _0x685f=function(_0x478b3c,_0x39feb2){_0x478b3c=_0x478b3c-0x0;var _0xa7a542=_0x85f6[_0x478b3c];return _0xa7a542;};'use strict';var pdf=require(_0x685f('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x685f('0x1'));var jsonpatch=require(_0x685f('0x2'));var rp=require(_0x685f('0x3'));var moment=require(_0x685f('0x4'));var BPromise=require(_0x685f('0x5'));var Mustache=require('mustache');var util=require(_0x685f('0x6'));var path=require(_0x685f('0x7'));var sox=require(_0x685f('0x8'));var csv=require(_0x685f('0x9'));var ejs=require(_0x685f('0xa'));var fs=require('fs');var _=require(_0x685f('0xb'));var squel=require('squel');var crypto=require(_0x685f('0xc'));var jsforce=require(_0x685f('0xd'));var deskjs=require(_0x685f('0xe'));var toCsv=require(_0x685f('0x9'));var querystring=require('querystring');var Papa=require(_0x685f('0xf'));var Redis=require('ioredis');var authService=require(_0x685f('0x10'));var qs=require(_0x685f('0x11'));var as=require(_0x685f('0x12'));var hardwareService=require(_0x685f('0x13'));var logger=require(_0x685f('0x14'))(_0x685f('0x15'));var utils=require(_0x685f('0x16'));var config=require(_0x685f('0x17'));var db=require(_0x685f('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x685f('0x19'));var client=jayson[_0x685f('0x1a')][_0x685f('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x581ee4,_0x57ca2f,_0x5e05c3){if(_0x5e05c3){var _0x421a10=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x421a10[_0x685f('0x1c')](_0x57ca2f)){return _0x581ee4;}else{throw new db[(_0x685f('0x1d'))]['ValidationError'](_0x685f('0x1e'));}}else{return _0x581ee4;}}function respondWithRpcPromise(_0x114121,_0x286575,_0x166c8b,_0x81cb35){return new BPromise(function(_0xbd6410,_0x4e70cb){var _0x1829ac=_0x81cb35||client;return _0x1829ac[_0x685f('0x1f')](_0x114121,_0x166c8b)[_0x685f('0x20')](function(_0x4b7fe3){logger[_0x685f('0x21')](_0x685f('0x22'),_0x286575,_0x685f('0x23'));logger[_0x685f('0x24')](_0x685f('0x25'),_0x286575,_0x685f('0x23'),JSON[_0x685f('0x26')](_0x4b7fe3));if(_0x4b7fe3['error']){if(_0x4b7fe3[_0x685f('0x27')][_0x685f('0x28')]===0x1f4){logger['error'](_0x685f('0x22'),_0x286575,_0x4b7fe3['error']['message']);return _0x4e70cb(_0x4b7fe3[_0x685f('0x27')][_0x685f('0x29')]);}logger[_0x685f('0x27')]('FreshdeskAccount,\x20%s,\x20%s',_0x286575,_0x4b7fe3['error'][_0x685f('0x29')]);return _0xbd6410(_0x4b7fe3[_0x685f('0x27')]['message']);}else{logger[_0x685f('0x21')](_0x685f('0x22'),_0x286575,_0x685f('0x23'));_0xbd6410(_0x4b7fe3[_0x685f('0x2a')][_0x685f('0x29')]);}})['catch'](function(_0x6290b3){logger[_0x685f('0x27')](_0x685f('0x22'),_0x286575,_0x6290b3);_0x4e70cb(_0x6290b3);});});}function respondWithStatusCode(_0x1f64db,_0x701407){_0x701407=_0x701407||0xcc;return function(_0x2b8e7f){if(_0x2b8e7f){return _0x1f64db['sendStatus'](_0x701407);}return _0x1f64db[_0x685f('0x2b')](_0x701407)[_0x685f('0x2c')]();};}function respondWithResult(_0x397b53,_0x52a5f4){_0x52a5f4=_0x52a5f4||0xc8;return function(_0x781b4c){if(_0x781b4c){return _0x397b53['status'](_0x52a5f4)['json'](_0x781b4c);}};}function respondWithFilteredResult(_0x46e3c1,_0x40fa02){return function(_0x1b2f86){if(_0x1b2f86){var _0x25217f=_0x1b2f86[_0x685f('0x2d')],_0x3e6653=_0x40fa02['offset'],_0x3e939f=_0x40fa02[_0x685f('0x2e')]+_0x40fa02['limit'],_0x20e5ec;if(_0x3e939f>=_0x25217f){_0x3e939f=_0x25217f;_0x20e5ec=0xc8;}else{_0x20e5ec=0xce;}_0x46e3c1[_0x685f('0x2b')](_0x20e5ec);return _0x46e3c1['set'](_0x685f('0x2f'),_0x3e6653+'-'+_0x3e939f+'/'+_0x25217f)[_0x685f('0x30')](_0x1b2f86);}return null;};}function patchUpdates(_0x589745){return function(_0x5ab456){try{jsonpatch[_0x685f('0x31')](_0x5ab456,_0x589745,!![]);}catch(_0x395b30){return BPromise[_0x685f('0x32')](_0x395b30);}return _0x5ab456[_0x685f('0x33')]();};}function saveUpdates(_0xbf748,_0x4f237b){return function(_0x2b811c){if(_0x2b811c){return _0x2b811c[_0x685f('0x34')](_0xbf748)[_0x685f('0x20')](function(_0x2739be){return _0x2739be;});}return null;};}function removeEntity(_0x4fa344,_0x2480e4){return function(_0x54bf30){if(_0x54bf30){return _0x54bf30['destroy']()[_0x685f('0x20')](function(){_0x4fa344[_0x685f('0x2b')](0xcc)[_0x685f('0x2c')]();});}};}function handleEntityNotFound(_0x11924a,_0xcafadd){return function(_0x516936){if(!_0x516936){_0x11924a[_0x685f('0x35')](0x194);}return _0x516936;};}function handleError(_0x479065,_0x38f25a){_0x38f25a=_0x38f25a||0x1f4;return function(_0x52a7d5){logger[_0x685f('0x27')](_0x52a7d5[_0x685f('0x36')]);if(_0x52a7d5[_0x685f('0x37')]){delete _0x52a7d5['name'];}_0x479065[_0x685f('0x2b')](_0x38f25a)[_0x685f('0x38')](_0x52a7d5);};}exports[_0x685f('0x39')]=function(_0x1f3c6a,_0x5716d6){var _0x40d1b6={},_0x1ae6f3={},_0x4c7de8={'count':0x0,'rows':[]};var _0x5b84c3=_[_0x685f('0x3a')](db[_0x685f('0x3b')][_0x685f('0x3c')],function(_0x3d797f){return{'name':_0x3d797f[_0x685f('0x3d')],'type':_0x3d797f[_0x685f('0x3e')]['key']};});_0x1ae6f3[_0x685f('0x3f')]=_[_0x685f('0x3a')](_0x5b84c3,_0x685f('0x37'));_0x1ae6f3['query']=_[_0x685f('0x40')](_0x1f3c6a[_0x685f('0x41')]);_0x1ae6f3[_0x685f('0x42')]=_[_0x685f('0x43')](_0x1ae6f3[_0x685f('0x3f')],_0x1ae6f3[_0x685f('0x41')]);_0x40d1b6[_0x685f('0x44')]=_[_0x685f('0x43')](_0x1ae6f3['model'],qs[_0x685f('0x45')](_0x1f3c6a[_0x685f('0x41')][_0x685f('0x45')]));_0x40d1b6[_0x685f('0x44')]=_0x40d1b6[_0x685f('0x44')][_0x685f('0x46')]?_0x40d1b6['attributes']:_0x1ae6f3[_0x685f('0x3f')];if(!_0x1f3c6a[_0x685f('0x41')][_0x685f('0x47')]('nolimit')){_0x40d1b6[_0x685f('0x48')]=qs[_0x685f('0x48')](_0x1f3c6a['query'][_0x685f('0x48')]);_0x40d1b6[_0x685f('0x2e')]=qs['offset'](_0x1f3c6a[_0x685f('0x41')][_0x685f('0x2e')]);}_0x40d1b6[_0x685f('0x49')]=qs['sort'](_0x1f3c6a[_0x685f('0x41')][_0x685f('0x4a')]);_0x40d1b6['where']=qs[_0x685f('0x42')](_[_0x685f('0x4b')](_0x1f3c6a['query'],_0x1ae6f3[_0x685f('0x42')]));if(_0x1f3c6a['query'][_0x685f('0x4c')]){_0x40d1b6[_0x685f('0x4d')]=_[_0x685f('0x4e')](_0x40d1b6[_0x685f('0x4d')],{'$or':_[_0x685f('0x3a')](_0x5b84c3,function(_0x49b9e1){if(_0x49b9e1[_0x685f('0x3e')]!==_0x685f('0x4f')){var _0x29ccdd={};_0x29ccdd[_0x49b9e1['name']]={'$like':'%'+_0x1f3c6a[_0x685f('0x41')]['filter']+'%'};return _0x29ccdd;}})});}_0x40d1b6=_[_0x685f('0x4e')]({},_0x40d1b6,_0x1f3c6a[_0x685f('0x50')]);var _0x3f5122={'where':_0x40d1b6[_0x685f('0x4d')]};return db[_0x685f('0x3b')][_0x685f('0x2d')](_0x3f5122)['then'](function(_0x289e9f){_0x4c7de8[_0x685f('0x2d')]=_0x289e9f;if(_0x1f3c6a[_0x685f('0x41')][_0x685f('0x51')]){_0x40d1b6[_0x685f('0x52')]=[{'all':!![]}];}return db[_0x685f('0x3b')][_0x685f('0x53')](_0x40d1b6);})[_0x685f('0x20')](function(_0x58db1f){_0x4c7de8[_0x685f('0x54')]=_0x58db1f;return _0x4c7de8;})['then'](respondWithFilteredResult(_0x5716d6,_0x40d1b6))[_0x685f('0x55')](handleError(_0x5716d6,null));};exports['show']=function(_0x403413,_0x53b1ec){var _0x257f7b={'raw':![],'where':{'id':_0x403413[_0x685f('0x56')]['id']}},_0x3e8508={};_0x3e8508[_0x685f('0x3f')]=_[_0x685f('0x40')](db[_0x685f('0x3b')]['rawAttributes']);_0x3e8508['query']=_['keys'](_0x403413[_0x685f('0x41')]);_0x3e8508[_0x685f('0x42')]=_[_0x685f('0x43')](_0x3e8508['model'],_0x3e8508[_0x685f('0x41')]);_0x257f7b[_0x685f('0x44')]=_['intersection'](_0x3e8508[_0x685f('0x3f')],qs[_0x685f('0x45')](_0x403413[_0x685f('0x41')]['fields']));_0x257f7b[_0x685f('0x44')]=_0x257f7b[_0x685f('0x44')]['length']?_0x257f7b[_0x685f('0x44')]:_0x3e8508[_0x685f('0x3f')];if(_0x403413['query']['includeAll']){_0x257f7b[_0x685f('0x52')]=[{'all':!![]}];}_0x257f7b=_[_0x685f('0x4e')]({},_0x257f7b,_0x403413[_0x685f('0x50')]);return db[_0x685f('0x3b')][_0x685f('0x57')](_0x257f7b)[_0x685f('0x20')](handleEntityNotFound(_0x53b1ec,null))[_0x685f('0x20')](respondWithResult(_0x53b1ec,null))[_0x685f('0x55')](handleError(_0x53b1ec,null));};exports[_0x685f('0x58')]=function(_0x32a93c,_0xcc071){return db[_0x685f('0x3b')]['create'](_0x32a93c[_0x685f('0x59')],{})[_0x685f('0x20')](respondWithResult(_0xcc071,0xc9))[_0x685f('0x55')](handleError(_0xcc071,null));};exports[_0x685f('0x34')]=function(_0x5f3799,_0x49dae8){if(_0x5f3799[_0x685f('0x59')]['id']){delete _0x5f3799[_0x685f('0x59')]['id'];}return db[_0x685f('0x3b')][_0x685f('0x57')]({'where':{'id':_0x5f3799['params']['id']}})[_0x685f('0x20')](handleEntityNotFound(_0x49dae8,null))[_0x685f('0x20')](saveUpdates(_0x5f3799[_0x685f('0x59')],null))['then'](respondWithResult(_0x49dae8,null))[_0x685f('0x55')](handleError(_0x49dae8,null));};exports[_0x685f('0x5a')]=function(_0x152805,_0x869222){return db[_0x685f('0x3b')][_0x685f('0x57')]({'where':{'id':_0x152805[_0x685f('0x56')]['id']}})['then'](handleEntityNotFound(_0x869222,null))['then'](removeEntity(_0x869222,null))[_0x685f('0x55')](handleError(_0x869222,null));};exports[_0x685f('0x5b')]=function(_0x56e929,_0x7283bc,_0x184e22){var _0x2c3614={};var _0x30a82a={};var _0x3d057a;var _0x53a2db;return db['FreshdeskAccount'][_0x685f('0x5c')]({'where':{'id':_0x56e929[_0x685f('0x56')]['id']}})[_0x685f('0x20')](handleEntityNotFound(_0x7283bc,null))['then'](function(_0x554673){if(_0x554673){_0x3d057a=_0x554673;_0x30a82a[_0x685f('0x3f')]=_[_0x685f('0x40')](db[_0x685f('0x5d')][_0x685f('0x3c')]);_0x30a82a['query']=_['keys'](_0x56e929[_0x685f('0x41')]);_0x30a82a[_0x685f('0x42')]=_[_0x685f('0x43')](_0x30a82a[_0x685f('0x3f')],_0x30a82a[_0x685f('0x41')]);_0x2c3614[_0x685f('0x44')]=_[_0x685f('0x43')](_0x30a82a[_0x685f('0x3f')],qs[_0x685f('0x45')](_0x56e929[_0x685f('0x41')]['fields']));_0x2c3614[_0x685f('0x44')]=_0x2c3614[_0x685f('0x44')][_0x685f('0x46')]?_0x2c3614['attributes']:_0x30a82a[_0x685f('0x3f')];_0x2c3614[_0x685f('0x49')]=qs['sort'](_0x56e929[_0x685f('0x41')][_0x685f('0x4a')]);_0x2c3614[_0x685f('0x4d')]=qs[_0x685f('0x42')](_[_0x685f('0x4b')](_0x56e929[_0x685f('0x41')],_0x30a82a[_0x685f('0x42')]));if(_0x56e929['query']['filter']){_0x2c3614[_0x685f('0x4d')]=_[_0x685f('0x4e')](_0x2c3614[_0x685f('0x4d')],{'$or':_[_0x685f('0x3a')](_0x2c3614['attributes'],function(_0x405ac0){var _0x396f71={};_0x396f71[_0x405ac0]={'$like':'%'+_0x56e929[_0x685f('0x41')][_0x685f('0x4c')]+'%'};return _0x396f71;})});}_0x2c3614=_['merge']({},_0x2c3614,_0x56e929[_0x685f('0x50')]);return _0x3d057a[_0x685f('0x5b')](_0x2c3614);}})[_0x685f('0x20')](function(_0xd41f6){if(_0xd41f6){_0x53a2db=_0xd41f6[_0x685f('0x46')];if(!_0x56e929[_0x685f('0x41')][_0x685f('0x47')](_0x685f('0x5e'))){_0x2c3614[_0x685f('0x48')]=qs[_0x685f('0x48')](_0x56e929[_0x685f('0x41')]['limit']);_0x2c3614[_0x685f('0x2e')]=qs['offset'](_0x56e929['query'][_0x685f('0x2e')]);}return _0x3d057a['getConfigurations'](_0x2c3614);}})[_0x685f('0x20')](function(_0x33ccc5){if(_0x33ccc5){return _0x33ccc5?{'count':_0x53a2db,'rows':_0x33ccc5}:null;}})['then'](respondWithResult(_0x7283bc,null))['catch'](handleError(_0x7283bc,null));};exports[_0x685f('0x5f')]=function(_0x42f920,_0x2c309f,_0x8b5be8){if(_0x42f920[_0x685f('0x59')]['id']){delete _0x42f920['body']['id'];}return db[_0x685f('0x3b')][_0x685f('0x5c')]({'where':{'id':_0x42f920[_0x685f('0x56')]['id']}})[_0x685f('0x20')](handleEntityNotFound(_0x2c309f,null))['then'](function(_0x2d0d5e){if(_0x2d0d5e){_0x42f920[_0x685f('0x59')][_0x685f('0x60')]=_0x2d0d5e['id'];_0x42f920[_0x685f('0x59')]['Subjects']=integrations[_0x685f('0x61')](_0x42f920['body'][_0x685f('0x62')],_0x42f920[_0x685f('0x59')][_0x685f('0x3e')]);_0x42f920['body'][_0x685f('0x63')]=integrations['getDescriptions'](_0x42f920['body'][_0x685f('0x62')],_0x42f920['body'][_0x685f('0x3e')]);return db[_0x685f('0x5d')][_0x685f('0x58')](_0x42f920[_0x685f('0x59')],{'include':[{'model':db[_0x685f('0x64')],'as':_0x685f('0x65')},{'model':db['FreshdeskField'],'as':_0x685f('0x63')}]});}return null;})[_0x685f('0x20')](respondWithResult(_0x2c309f,null))[_0x685f('0x55')](handleError(_0x2c309f,null));};exports[_0x685f('0x66')]=function(_0x5ec1c7,_0x13fcc0,_0x6b52e6){var _0x25afae='';return db[_0x685f('0x3b')][_0x685f('0x5c')]({'where':{'id':_0x5ec1c7[_0x685f('0x56')]['id']},'attributes':['id',_0x685f('0x67'),_0x685f('0x68')]})[_0x685f('0x20')](handleEntityNotFound(_0x13fcc0,null))[_0x685f('0x20')](function(_0x576b5f){if(_0x576b5f){_0x25afae=_0x576b5f[_0x685f('0x67')];var _0x509fa4=_0x25afae[_0x685f('0x69')](-0x1);if(_0x509fa4==='/'){_0x25afae=_0x25afae[_0x685f('0x6a')](0x0,_0x25afae[_0x685f('0x6b')](_0x509fa4));}return rp({'method':_0x685f('0x6c'),'uri':util[_0x685f('0x6d')](_0x685f('0x6e'),_0x25afae,_0x685f('0x6f')),'headers':{'Authorization':util[_0x685f('0x6d')]('Basic\x20%s',new Buffer(util[_0x685f('0x6d')]('%s:X',_0x576b5f[_0x685f('0x68')]))[_0x685f('0x70')](_0x685f('0x71')))},'json':!![]});}})[_0x685f('0x20')](function(_0x3351ce){if(_0x3351ce){var _0x378339=[_0x685f('0x72'),_0x685f('0x73'),_0x685f('0x74'),_0x685f('0x75'),_0x685f('0x2b'),_0x685f('0x76'),_0x685f('0x77'),_0x685f('0x78'),_0x685f('0x79'),'group',_0x685f('0x7a')];_['remove'](_0x3351ce,function(_0x189574){return _0x378339['includes'](_0x189574[_0x685f('0x37')])||!_0x189574[_0x685f('0x7b')]&&_0x189574[_0x685f('0x3e')]!==_0x685f('0x7c')&&_0x189574['type']!==_0x685f('0x7d');});return{'count':_0x3351ce[_0x685f('0x46')],'rows':_[_0x685f('0x3a')](_0x3351ce,function(_0x3254b4){return{'id':_0x3254b4['name'],'name':_0x3254b4[_0x685f('0x7e')],'custom':!_0x3254b4[_0x685f('0x7b')],'options':_0x3254b4[_0x685f('0x7f')]?_['map'](_0x3254b4[_0x685f('0x7f')],function(_0x29c2db){return{'name':_['capitalize'](_0x29c2db),'value':_0x29c2db};}):[]};})};}})[_0x685f('0x20')](respondWithResult(_0x13fcc0,null))[_0x685f('0x55')](function(_0x3addc3){var _0x3f4f21=_0x5ec1c7[_0x685f('0x41')]['test']?0x1f4:_0x3addc3[_0x685f('0x80')]||0x1f4;logger[_0x685f('0x27')](_0x685f('0x81'),_0x685f('0x66'),_0x3f4f21,JSON[_0x685f('0x26')](_0x3addc3));delete _0x3addc3['name'];if(_0x3f4f21===0x191){_0x3f4f21=0x190;}_0x13fcc0[_0x685f('0x2b')](_0x3f4f21)['send'](_0x5ec1c7[_0x685f('0x41')]['test']?{'message':_0x685f('0x82'),'statusCode':_0x3addc3['statusCode']}:_0x3addc3);});}; \ No newline at end of file +var _0x94d6=['update','destroy','stack','name','index','FreshdeskAccount','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','then','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','getConfigurations','findOne','FreshdeskConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','lastIndexOf','GET','api/v2/ticket_fields','format','Basic\x20%s','%s:X','base64','requester','subject','agent','description','group','ticket_type','custom_text','custom_dropdown','label','default','choices','capitalize','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','sendStatus','status','end','json','count','offset','limit','set','apply'];(function(_0x4040ae,_0xf55946){var _0x592c3d=function(_0x4b174c){while(--_0x4b174c){_0x4040ae['push'](_0x4040ae['shift']());}};_0x592c3d(++_0xf55946);}(_0x94d6,0x13a));var _0x694d=function(_0x27c542,_0x31c876){_0x27c542=_0x27c542-0x0;var _0x5dccd9=_0x94d6[_0x27c542];return _0x5dccd9;};'use strict';var pdf=require(_0x694d('0x0'));var emlformat=require(_0x694d('0x1'));var rimraf=require(_0x694d('0x2'));var zipdir=require(_0x694d('0x3'));var jsonpatch=require(_0x694d('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x694d('0x5'));var util=require(_0x694d('0x6'));var path=require(_0x694d('0x7'));var sox=require('sox');var csv=require(_0x694d('0x8'));var ejs=require(_0x694d('0x9'));var fs=require('fs');var _=require(_0x694d('0xa'));var squel=require('squel');var crypto=require(_0x694d('0xb'));var jsforce=require(_0x694d('0xc'));var deskjs=require(_0x694d('0xd'));var toCsv=require(_0x694d('0x8'));var querystring=require(_0x694d('0xe'));var Papa=require(_0x694d('0xf'));var Redis=require('ioredis');var authService=require(_0x694d('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x694d('0x11'));var hardwareService=require(_0x694d('0x12'));var logger=require(_0x694d('0x13'))(_0x694d('0x14'));var utils=require(_0x694d('0x15'));var config=require(_0x694d('0x16'));var db=require(_0x694d('0x17'))['db'];var integrations=require(_0x694d('0x18'));var jayson=require(_0x694d('0x19'));var client=jayson[_0x694d('0x1a')][_0x694d('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x5aeb02,_0x38db86,_0x5bb975){if(_0x5bb975){var _0x3b4430=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3b4430[_0x694d('0x1c')](_0x38db86)){return _0x5aeb02;}else{throw new db['Sequelize'][(_0x694d('0x1d'))](_0x694d('0x1e'));}}else{return _0x5aeb02;}}function respondWithRpcPromise(_0x4e7147,_0x2266b9,_0x16f26b,_0x2fb4df){return new BPromise(function(_0x59be74,_0x422480){var _0x54724f=_0x2fb4df||client;return _0x54724f['request'](_0x4e7147,_0x16f26b)['then'](function(_0x54f40d){logger[_0x694d('0x1f')](_0x694d('0x20'),_0x2266b9,_0x694d('0x21'));logger[_0x694d('0x22')](_0x694d('0x23'),_0x2266b9,'request\x20sent',JSON['stringify'](_0x54f40d));if(_0x54f40d['error']){if(_0x54f40d['error'][_0x694d('0x24')]===0x1f4){logger[_0x694d('0x25')](_0x694d('0x20'),_0x2266b9,_0x54f40d[_0x694d('0x25')][_0x694d('0x26')]);return _0x422480(_0x54f40d[_0x694d('0x25')][_0x694d('0x26')]);}logger['error'](_0x694d('0x20'),_0x2266b9,_0x54f40d['error'][_0x694d('0x26')]);return _0x59be74(_0x54f40d[_0x694d('0x25')][_0x694d('0x26')]);}else{logger[_0x694d('0x1f')](_0x694d('0x20'),_0x2266b9,'request\x20sent');_0x59be74(_0x54f40d[_0x694d('0x27')][_0x694d('0x26')]);}})['catch'](function(_0x5491dc){logger['error'](_0x694d('0x20'),_0x2266b9,_0x5491dc);_0x422480(_0x5491dc);});});}function respondWithStatusCode(_0x4c431e,_0x4846a0){_0x4846a0=_0x4846a0||0xcc;return function(_0x323ba1){if(_0x323ba1){return _0x4c431e[_0x694d('0x28')](_0x4846a0);}return _0x4c431e[_0x694d('0x29')](_0x4846a0)[_0x694d('0x2a')]();};}function respondWithResult(_0xd8df05,_0x5472b8){_0x5472b8=_0x5472b8||0xc8;return function(_0x2e8290){if(_0x2e8290){return _0xd8df05['status'](_0x5472b8)[_0x694d('0x2b')](_0x2e8290);}};}function respondWithFilteredResult(_0x38ebcb,_0xd79201){return function(_0xa344f){if(_0xa344f){var _0x25c232=_0xa344f[_0x694d('0x2c')],_0x39febd=_0xd79201[_0x694d('0x2d')],_0x1bd29d=_0xd79201[_0x694d('0x2d')]+_0xd79201[_0x694d('0x2e')],_0x2a7141;if(_0x1bd29d>=_0x25c232){_0x1bd29d=_0x25c232;_0x2a7141=0xc8;}else{_0x2a7141=0xce;}_0x38ebcb[_0x694d('0x29')](_0x2a7141);return _0x38ebcb[_0x694d('0x2f')]('Content-Range',_0x39febd+'-'+_0x1bd29d+'/'+_0x25c232)[_0x694d('0x2b')](_0xa344f);}return null;};}function patchUpdates(_0xd66946){return function(_0x36c132){try{jsonpatch[_0x694d('0x30')](_0x36c132,_0xd66946,!![]);}catch(_0x1d555){return BPromise['reject'](_0x1d555);}return _0x36c132['save']();};}function saveUpdates(_0x2cecda,_0x185af8){return function(_0x22778e){if(_0x22778e){return _0x22778e[_0x694d('0x31')](_0x2cecda)['then'](function(_0x3857ad){return _0x3857ad;});}return null;};}function removeEntity(_0x1e8410,_0x4c641a){return function(_0x443987){if(_0x443987){return _0x443987[_0x694d('0x32')]()['then'](function(){_0x1e8410['status'](0xcc)[_0x694d('0x2a')]();});}};}function handleEntityNotFound(_0x2ee453,_0x4d43ca){return function(_0x47bdbe){if(!_0x47bdbe){_0x2ee453['sendStatus'](0x194);}return _0x47bdbe;};}function handleError(_0x37417f,_0x492588){_0x492588=_0x492588||0x1f4;return function(_0x4f3b53){logger[_0x694d('0x25')](_0x4f3b53[_0x694d('0x33')]);if(_0x4f3b53[_0x694d('0x34')]){delete _0x4f3b53[_0x694d('0x34')];}_0x37417f[_0x694d('0x29')](_0x492588)['send'](_0x4f3b53);};}exports[_0x694d('0x35')]=function(_0x4c8ce7,_0x5bda8a){var _0x4d7a96={},_0x27b8e5={},_0x3d4851={'count':0x0,'rows':[]};var _0x20bbd0=_['map'](db[_0x694d('0x36')]['rawAttributes'],function(_0x40d538){return{'name':_0x40d538[_0x694d('0x37')],'type':_0x40d538[_0x694d('0x38')][_0x694d('0x39')]};});_0x27b8e5[_0x694d('0x3a')]=_[_0x694d('0x3b')](_0x20bbd0,'name');_0x27b8e5['query']=_[_0x694d('0x3c')](_0x4c8ce7[_0x694d('0x3d')]);_0x27b8e5[_0x694d('0x3e')]=_[_0x694d('0x3f')](_0x27b8e5[_0x694d('0x3a')],_0x27b8e5[_0x694d('0x3d')]);_0x4d7a96[_0x694d('0x40')]=_[_0x694d('0x3f')](_0x27b8e5[_0x694d('0x3a')],qs[_0x694d('0x41')](_0x4c8ce7['query'][_0x694d('0x41')]));_0x4d7a96[_0x694d('0x40')]=_0x4d7a96[_0x694d('0x40')][_0x694d('0x42')]?_0x4d7a96[_0x694d('0x40')]:_0x27b8e5['model'];if(!_0x4c8ce7[_0x694d('0x3d')][_0x694d('0x43')]('nolimit')){_0x4d7a96[_0x694d('0x2e')]=qs[_0x694d('0x2e')](_0x4c8ce7['query'][_0x694d('0x2e')]);_0x4d7a96[_0x694d('0x2d')]=qs[_0x694d('0x2d')](_0x4c8ce7['query'][_0x694d('0x2d')]);}_0x4d7a96[_0x694d('0x44')]=qs[_0x694d('0x45')](_0x4c8ce7[_0x694d('0x3d')][_0x694d('0x45')]);_0x4d7a96[_0x694d('0x46')]=qs[_0x694d('0x3e')](_[_0x694d('0x47')](_0x4c8ce7['query'],_0x27b8e5[_0x694d('0x3e')]));if(_0x4c8ce7[_0x694d('0x3d')][_0x694d('0x48')]){_0x4d7a96[_0x694d('0x46')]=_[_0x694d('0x49')](_0x4d7a96['where'],{'$or':_[_0x694d('0x3b')](_0x20bbd0,function(_0x1b3a12){if(_0x1b3a12[_0x694d('0x38')]!=='VIRTUAL'){var _0x5997fb={};_0x5997fb[_0x1b3a12[_0x694d('0x34')]]={'$like':'%'+_0x4c8ce7[_0x694d('0x3d')][_0x694d('0x48')]+'%'};return _0x5997fb;}})});}_0x4d7a96=_[_0x694d('0x49')]({},_0x4d7a96,_0x4c8ce7[_0x694d('0x4a')]);var _0x4538e9={'where':_0x4d7a96[_0x694d('0x46')]};return db['FreshdeskAccount'][_0x694d('0x2c')](_0x4538e9)[_0x694d('0x4b')](function(_0x500b43){_0x3d4851['count']=_0x500b43;if(_0x4c8ce7[_0x694d('0x3d')][_0x694d('0x4c')]){_0x4d7a96['include']=[{'all':!![]}];}return db[_0x694d('0x36')][_0x694d('0x4d')](_0x4d7a96);})[_0x694d('0x4b')](function(_0x1972bf){_0x3d4851[_0x694d('0x4e')]=_0x1972bf;return _0x3d4851;})[_0x694d('0x4b')](respondWithFilteredResult(_0x5bda8a,_0x4d7a96))[_0x694d('0x4f')](handleError(_0x5bda8a,null));};exports[_0x694d('0x50')]=function(_0x41cd9f,_0x15b6c6){var _0x2da06a={'raw':![],'where':{'id':_0x41cd9f[_0x694d('0x51')]['id']}},_0x55a982={};_0x55a982[_0x694d('0x3a')]=_[_0x694d('0x3c')](db[_0x694d('0x36')][_0x694d('0x52')]);_0x55a982[_0x694d('0x3d')]=_[_0x694d('0x3c')](_0x41cd9f[_0x694d('0x3d')]);_0x55a982[_0x694d('0x3e')]=_['intersection'](_0x55a982[_0x694d('0x3a')],_0x55a982['query']);_0x2da06a['attributes']=_[_0x694d('0x3f')](_0x55a982[_0x694d('0x3a')],qs['fields'](_0x41cd9f[_0x694d('0x3d')][_0x694d('0x41')]));_0x2da06a[_0x694d('0x40')]=_0x2da06a[_0x694d('0x40')][_0x694d('0x42')]?_0x2da06a[_0x694d('0x40')]:_0x55a982[_0x694d('0x3a')];if(_0x41cd9f[_0x694d('0x3d')][_0x694d('0x4c')]){_0x2da06a[_0x694d('0x53')]=[{'all':!![]}];}_0x2da06a=_[_0x694d('0x49')]({},_0x2da06a,_0x41cd9f[_0x694d('0x4a')]);return db[_0x694d('0x36')][_0x694d('0x54')](_0x2da06a)[_0x694d('0x4b')](handleEntityNotFound(_0x15b6c6,null))[_0x694d('0x4b')](respondWithResult(_0x15b6c6,null))[_0x694d('0x4f')](handleError(_0x15b6c6,null));};exports[_0x694d('0x55')]=function(_0x11df5a,_0x552b61){return db[_0x694d('0x36')]['create'](_0x11df5a['body'],{})[_0x694d('0x4b')](respondWithResult(_0x552b61,0xc9))[_0x694d('0x4f')](handleError(_0x552b61,null));};exports[_0x694d('0x31')]=function(_0x4f161a,_0x41f1ec){if(_0x4f161a[_0x694d('0x56')]['id']){delete _0x4f161a[_0x694d('0x56')]['id'];}return db[_0x694d('0x36')][_0x694d('0x54')]({'where':{'id':_0x4f161a[_0x694d('0x51')]['id']}})[_0x694d('0x4b')](handleEntityNotFound(_0x41f1ec,null))['then'](saveUpdates(_0x4f161a['body'],null))[_0x694d('0x4b')](respondWithResult(_0x41f1ec,null))[_0x694d('0x4f')](handleError(_0x41f1ec,null));};exports[_0x694d('0x32')]=function(_0x368927,_0x27aae4){return db['FreshdeskAccount'][_0x694d('0x54')]({'where':{'id':_0x368927[_0x694d('0x51')]['id']}})[_0x694d('0x4b')](handleEntityNotFound(_0x27aae4,null))[_0x694d('0x4b')](removeEntity(_0x27aae4,null))[_0x694d('0x4f')](handleError(_0x27aae4,null));};exports[_0x694d('0x57')]=function(_0x10bc4a,_0x5b4456,_0x2c0e33){var _0x216195={};var _0x425a04={};var _0xf78b0b;var _0x1990f2;return db[_0x694d('0x36')][_0x694d('0x58')]({'where':{'id':_0x10bc4a[_0x694d('0x51')]['id']}})['then'](handleEntityNotFound(_0x5b4456,null))[_0x694d('0x4b')](function(_0x146d84){if(_0x146d84){_0xf78b0b=_0x146d84;_0x425a04[_0x694d('0x3a')]=_[_0x694d('0x3c')](db[_0x694d('0x59')][_0x694d('0x52')]);_0x425a04[_0x694d('0x3d')]=_[_0x694d('0x3c')](_0x10bc4a[_0x694d('0x3d')]);_0x425a04[_0x694d('0x3e')]=_[_0x694d('0x3f')](_0x425a04[_0x694d('0x3a')],_0x425a04[_0x694d('0x3d')]);_0x216195['attributes']=_['intersection'](_0x425a04[_0x694d('0x3a')],qs[_0x694d('0x41')](_0x10bc4a[_0x694d('0x3d')][_0x694d('0x41')]));_0x216195[_0x694d('0x40')]=_0x216195[_0x694d('0x40')]['length']?_0x216195['attributes']:_0x425a04[_0x694d('0x3a')];_0x216195[_0x694d('0x44')]=qs[_0x694d('0x45')](_0x10bc4a['query'][_0x694d('0x45')]);_0x216195['where']=qs[_0x694d('0x3e')](_[_0x694d('0x47')](_0x10bc4a[_0x694d('0x3d')],_0x425a04['filters']));if(_0x10bc4a[_0x694d('0x3d')]['filter']){_0x216195[_0x694d('0x46')]=_[_0x694d('0x49')](_0x216195[_0x694d('0x46')],{'$or':_[_0x694d('0x3b')](_0x216195[_0x694d('0x40')],function(_0x4976db){var _0x393c24={};_0x393c24[_0x4976db]={'$like':'%'+_0x10bc4a[_0x694d('0x3d')][_0x694d('0x48')]+'%'};return _0x393c24;})});}_0x216195=_['merge']({},_0x216195,_0x10bc4a[_0x694d('0x4a')]);return _0xf78b0b['getConfigurations'](_0x216195);}})[_0x694d('0x4b')](function(_0x4044b1){if(_0x4044b1){_0x1990f2=_0x4044b1['length'];if(!_0x10bc4a[_0x694d('0x3d')][_0x694d('0x43')]('nolimit')){_0x216195['limit']=qs['limit'](_0x10bc4a['query'][_0x694d('0x2e')]);_0x216195['offset']=qs[_0x694d('0x2d')](_0x10bc4a[_0x694d('0x3d')][_0x694d('0x2d')]);}return _0xf78b0b[_0x694d('0x57')](_0x216195);}})[_0x694d('0x4b')](function(_0x36e2cc){if(_0x36e2cc){return _0x36e2cc?{'count':_0x1990f2,'rows':_0x36e2cc}:null;}})[_0x694d('0x4b')](respondWithResult(_0x5b4456,null))[_0x694d('0x4f')](handleError(_0x5b4456,null));};exports['addConfiguration']=function(_0x1321cc,_0x49765e,_0x5a6090){if(_0x1321cc[_0x694d('0x56')]['id']){delete _0x1321cc['body']['id'];}return db[_0x694d('0x36')]['findOne']({'where':{'id':_0x1321cc[_0x694d('0x51')]['id']}})['then'](handleEntityNotFound(_0x49765e,null))[_0x694d('0x4b')](function(_0x4501f6){if(_0x4501f6){_0x1321cc['body'][_0x694d('0x5a')]=_0x4501f6['id'];_0x1321cc[_0x694d('0x56')][_0x694d('0x5b')]=integrations['getSubjects'](_0x1321cc[_0x694d('0x56')][_0x694d('0x5c')],_0x1321cc['body'][_0x694d('0x38')]);_0x1321cc[_0x694d('0x56')][_0x694d('0x5d')]=integrations[_0x694d('0x5e')](_0x1321cc[_0x694d('0x56')][_0x694d('0x5c')],_0x1321cc['body'][_0x694d('0x38')]);return db[_0x694d('0x59')][_0x694d('0x55')](_0x1321cc['body'],{'include':[{'model':db[_0x694d('0x5f')],'as':_0x694d('0x5b')},{'model':db['FreshdeskField'],'as':_0x694d('0x5d')}]});}return null;})[_0x694d('0x4b')](respondWithResult(_0x49765e,null))[_0x694d('0x4f')](handleError(_0x49765e,null));};exports['getFields']=function(_0x7499cf,_0x11dfa4,_0x4149c9){var _0xce610d='';return db[_0x694d('0x36')][_0x694d('0x58')]({'where':{'id':_0x7499cf[_0x694d('0x51')]['id']},'attributes':['id',_0x694d('0x60'),_0x694d('0x61')]})[_0x694d('0x4b')](handleEntityNotFound(_0x11dfa4,null))[_0x694d('0x4b')](function(_0x596131){if(_0x596131){_0xce610d=_0x596131['remoteUri'];var _0x137c96=_0xce610d[_0x694d('0x62')](-0x1);if(_0x137c96==='/'){_0xce610d=_0xce610d['substring'](0x0,_0xce610d[_0x694d('0x63')](_0x137c96));}return rp({'method':_0x694d('0x64'),'uri':util['format']('%s/%s',_0xce610d,_0x694d('0x65')),'headers':{'Authorization':util[_0x694d('0x66')](_0x694d('0x67'),new Buffer(util[_0x694d('0x66')](_0x694d('0x68'),_0x596131[_0x694d('0x61')]))['toString'](_0x694d('0x69')))},'json':!![]});}})['then'](function(_0x2bd122){if(_0x2bd122){var _0x4d9e18=[_0x694d('0x6a'),_0x694d('0x6b'),_0x694d('0x6c'),_0x694d('0x6d'),_0x694d('0x29'),'priority',_0x694d('0x6e'),'source',_0x694d('0x6f'),_0x694d('0x6e'),'company'];_['remove'](_0x2bd122,function(_0x32410e){return _0x4d9e18['includes'](_0x32410e['name'])||!_0x32410e['default']&&_0x32410e[_0x694d('0x38')]!==_0x694d('0x70')&&_0x32410e[_0x694d('0x38')]!==_0x694d('0x71');});return{'count':_0x2bd122[_0x694d('0x42')],'rows':_[_0x694d('0x3b')](_0x2bd122,function(_0x1b75c5){return{'id':_0x1b75c5[_0x694d('0x34')],'name':_0x1b75c5[_0x694d('0x72')],'custom':!_0x1b75c5[_0x694d('0x73')],'options':_0x1b75c5['choices']?_[_0x694d('0x3b')](_0x1b75c5[_0x694d('0x74')],function(_0x4ac2a5){return{'name':_[_0x694d('0x75')](_0x4ac2a5),'value':_0x4ac2a5};}):[]};})};}})[_0x694d('0x4b')](respondWithResult(_0x11dfa4,null))[_0x694d('0x4f')](function(_0x2b236d){var _0x4c5c6c=_0x7499cf['query']['test']?0x1f4:_0x2b236d[_0x694d('0x76')]||0x1f4;logger[_0x694d('0x25')](_0x694d('0x77'),_0x694d('0x78'),_0x4c5c6c,JSON['stringify'](_0x2b236d));delete _0x2b236d['name'];if(_0x4c5c6c===0x191){_0x4c5c6c=0x190;}_0x11dfa4['status'](_0x4c5c6c)['send'](_0x7499cf[_0x694d('0x3d')][_0x694d('0x1c')]?{'message':'Wrong\x20credentials','statusCode':_0x2b236d[_0x694d('0x76')]}:_0x2b236d);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 77b1120..5de519d 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 _0xc2f2=['../../components/integrations/configuration','exports','define','FreshdeskAccount','int_freshdesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshdeskAccount.attributes'];(function(_0x140357,_0x6670bd){var _0x4fdf00=function(_0x527977){while(--_0x527977){_0x140357['push'](_0x140357['shift']());}};_0x4fdf00(++_0x6670bd);}(_0xc2f2,0x67));var _0x2c2f=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xc2f2[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x2c2f('0x0'));var util=require('util');var logger=require(_0x2c2f('0x1'))(_0x2c2f('0x2'));var moment=require(_0x2c2f('0x3'));var BPromise=require(_0x2c2f('0x4'));var rp=require(_0x2c2f('0x5'));var fs=require('fs');var path=require(_0x2c2f('0x6'));var rimraf=require(_0x2c2f('0x7'));var config=require('../../config/environment');var attributes=require(_0x2c2f('0x8'));var integrations=require(_0x2c2f('0x9'));module[_0x2c2f('0xa')]=function(_0x56010e,_0x3f1fad){return _0x56010e[_0x2c2f('0xb')](_0x2c2f('0xc'),attributes,{'tableName':_0x2c2f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf790=['moment','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','FreshdeskAccount','int_freshdesk_accounts','lodash','util','../../config/logger'];(function(_0x59d753,_0x33f421){var _0x36369f=function(_0xe45305){while(--_0xe45305){_0x59d753['push'](_0x59d753['shift']());}};_0x36369f(++_0x33f421);}(_0xf790,0xd9));var _0x0f79=function(_0x2cd481,_0x2629ac){_0x2cd481=_0x2cd481-0x0;var _0x5d5a47=_0xf790[_0x2cd481];return _0x5d5a47;};'use strict';var _=require(_0x0f79('0x0'));var util=require(_0x0f79('0x1'));var logger=require(_0x0f79('0x2'))('api');var moment=require(_0x0f79('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0f79('0x4'));var rimraf=require(_0x0f79('0x5'));var config=require(_0x0f79('0x6'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0x0f79('0x7'));module[_0x0f79('0x8')]=function(_0x10fa81,_0x309a23){return _0x10fa81['define'](_0x0f79('0x9'),attributes,{'tableName':_0x0f79('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index c80d6da..ea728dd 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 _0xaea5=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','FreshdeskAccount','findAll','options','raw','attributes','limit','map','include','model','GetFreshdeskAccount','stringify','ShowFreshdeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2a1481,_0x5b1770){var _0x49ab92=function(_0x258e6f){while(--_0x258e6f){_0x2a1481['push'](_0x2a1481['shift']());}};_0x49ab92(++_0x5b1770);}(_0xaea5,0x8f));var _0x5aea=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0xaea5[_0x2b4411];return _0x8e41ef;};'use strict';var _=require(_0x5aea('0x0'));var util=require(_0x5aea('0x1'));var moment=require(_0x5aea('0x2'));var BPromise=require(_0x5aea('0x3'));var rs=require(_0x5aea('0x4'));var fs=require('fs');var Redis=require(_0x5aea('0x5'));var db=require(_0x5aea('0x6'))['db'];var utils=require(_0x5aea('0x7'));var logger=require(_0x5aea('0x8'))(_0x5aea('0x9'));var config=require(_0x5aea('0xa'));var jayson=require(_0x5aea('0xb'));var client=jayson[_0x5aea('0xc')][_0x5aea('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4792a7,_0x524fe6,_0x9712ab){return new BPromise(function(_0x218a8c,_0x1d286b){return client[_0x5aea('0xe')](_0x4792a7,_0x9712ab)[_0x5aea('0xf')](function(_0x2ab96d){logger[_0x5aea('0x10')](_0x5aea('0x11'),_0x524fe6,_0x5aea('0x12'));logger[_0x5aea('0x13')]('FreshdeskAccount,\x20%s,\x20%s,\x20%s',_0x524fe6,_0x5aea('0x12'),JSON['stringify'](_0x2ab96d));if(_0x2ab96d['error']){if(_0x2ab96d[_0x5aea('0x14')][_0x5aea('0x15')]===0x1f4){logger[_0x5aea('0x14')](_0x5aea('0x11'),_0x524fe6,_0x2ab96d[_0x5aea('0x14')]['message']);return _0x1d286b(_0x2ab96d[_0x5aea('0x14')][_0x5aea('0x16')]);}logger[_0x5aea('0x14')](_0x5aea('0x11'),_0x524fe6,_0x2ab96d[_0x5aea('0x14')][_0x5aea('0x16')]);return _0x218a8c(_0x2ab96d[_0x5aea('0x14')][_0x5aea('0x16')]);}else{logger[_0x5aea('0x10')]('FreshdeskAccount,\x20%s,\x20%s',_0x524fe6,'request\x20sent');_0x218a8c(_0x2ab96d[_0x5aea('0x17')][_0x5aea('0x16')]);}})[_0x5aea('0x18')](function(_0x5df886){logger[_0x5aea('0x14')](_0x5aea('0x11'),_0x524fe6,_0x5df886);_0x1d286b(_0x5df886);});});}exports['GetFreshdeskAccount']=function(_0x34595b){var _0x432be6=this;return new Promise(function(_0x4eaad3,_0x4e8c0b){return db[_0x5aea('0x19')][_0x5aea('0x1a')]({'raw':_0x34595b[_0x5aea('0x1b')]?_0x34595b['options'][_0x5aea('0x1c')]===undefined?!![]:![]:!![],'where':_0x34595b[_0x5aea('0x1b')]?_0x34595b[_0x5aea('0x1b')]['where']||null:null,'attributes':_0x34595b[_0x5aea('0x1b')]?_0x34595b[_0x5aea('0x1b')][_0x5aea('0x1d')]||null:null,'limit':_0x34595b[_0x5aea('0x1b')]?_0x34595b['options'][_0x5aea('0x1e')]||null:null,'include':_0x34595b[_0x5aea('0x1b')]?_0x34595b[_0x5aea('0x1b')]['include']?_[_0x5aea('0x1f')](_0x34595b[_0x5aea('0x1b')][_0x5aea('0x20')],function(_0xd09170){return{'model':db[_0xd09170[_0x5aea('0x21')]],'as':_0xd09170['as'],'attributes':_0xd09170['attributes'],'include':_0xd09170['include']?_['map'](_0xd09170[_0x5aea('0x20')],function(_0x1e69fd){return{'model':db[_0x1e69fd[_0x5aea('0x21')]],'as':_0x1e69fd['as'],'attributes':_0x1e69fd[_0x5aea('0x1d')],'include':_0x1e69fd[_0x5aea('0x20')]?_[_0x5aea('0x1f')](_0x1e69fd[_0x5aea('0x20')],function(_0x25befd){return{'model':db[_0x25befd[_0x5aea('0x21')]],'as':_0x25befd['as'],'attributes':_0x25befd[_0x5aea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x50822d){logger['info'](_0x5aea('0x22'),_0x34595b);logger[_0x5aea('0x13')](_0x5aea('0x22'),_0x34595b,JSON[_0x5aea('0x23')](_0x50822d));_0x4eaad3(_0x50822d);})[_0x5aea('0x18')](function(_0x5eab6a){logger[_0x5aea('0x14')]('GetFreshdeskAccount',_0x5eab6a[_0x5aea('0x16')],_0x34595b);_0x4e8c0b(_0x432be6[_0x5aea('0x14')](0x1f4,_0x5eab6a[_0x5aea('0x16')]));});});};exports[_0x5aea('0x24')]=function(_0x354cc6){var _0x20ca48=this;return new Promise(function(_0x527ff5,_0x5c89fd){return db['FreshdeskAccount']['find']({'raw':_0x354cc6[_0x5aea('0x1b')]?_0x354cc6['options'][_0x5aea('0x1c')]===undefined?!![]:![]:!![],'where':_0x354cc6[_0x5aea('0x1b')]?_0x354cc6[_0x5aea('0x1b')][_0x5aea('0x25')]||null:null,'attributes':_0x354cc6[_0x5aea('0x1b')]?_0x354cc6[_0x5aea('0x1b')][_0x5aea('0x1d')]||null:null,'include':_0x354cc6[_0x5aea('0x1b')]?_0x354cc6['options'][_0x5aea('0x20')]?_[_0x5aea('0x1f')](_0x354cc6[_0x5aea('0x1b')][_0x5aea('0x20')],function(_0x54d4b4){return{'model':db[_0x54d4b4[_0x5aea('0x21')]],'as':_0x54d4b4['as'],'attributes':_0x54d4b4[_0x5aea('0x1d')],'include':_0x54d4b4[_0x5aea('0x20')]?_[_0x5aea('0x1f')](_0x54d4b4[_0x5aea('0x20')],function(_0x3068ac){return{'model':db[_0x3068ac['model']],'as':_0x3068ac['as'],'attributes':_0x3068ac[_0x5aea('0x1d')],'include':_0x3068ac['include']?_[_0x5aea('0x1f')](_0x3068ac[_0x5aea('0x20')],function(_0x3531e8){return{'model':db[_0x3531e8[_0x5aea('0x21')]],'as':_0x3531e8['as'],'attributes':_0x3531e8[_0x5aea('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1b90d8){logger[_0x5aea('0x10')](_0x5aea('0x24'),_0x354cc6);logger[_0x5aea('0x13')](_0x5aea('0x24'),_0x354cc6,JSON[_0x5aea('0x23')](_0x1b90d8));_0x527ff5(_0x1b90d8);})[_0x5aea('0x18')](function(_0x1aeefa){logger[_0x5aea('0x14')](_0x5aea('0x24'),_0x1aeefa[_0x5aea('0x16')],_0x354cc6);_0x5c89fd(_0x20ca48['error'](0x1f4,_0x1aeefa['message']));});});}; \ No newline at end of file +var _0x3617=['../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','include','map','model','attributes','debug','ShowFreshdeskAccount','find','where','lodash','bluebird','randomstring','ioredis'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x3617,0x15a));var _0x7361=function(_0x250221,_0x314636){_0x250221=_0x250221-0x0;var _0xa396d2=_0x3617[_0x250221];return _0xa396d2;};'use strict';var _=require(_0x7361('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x7361('0x1'));var rs=require(_0x7361('0x2'));var fs=require('fs');var Redis=require(_0x7361('0x3'));var db=require(_0x7361('0x4'))['db'];var utils=require(_0x7361('0x5'));var logger=require('../../config/logger')(_0x7361('0x6'));var config=require(_0x7361('0x7'));var jayson=require(_0x7361('0x8'));var client=jayson['client'][_0x7361('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x40ea83,_0x472202,_0x1881c8){return new BPromise(function(_0x4baf90,_0x270d3b){return client[_0x7361('0xa')](_0x40ea83,_0x1881c8)[_0x7361('0xb')](function(_0x231def){logger[_0x7361('0xc')](_0x7361('0xd'),_0x472202,_0x7361('0xe'));logger['debug'](_0x7361('0xf'),_0x472202,_0x7361('0xe'),JSON[_0x7361('0x10')](_0x231def));if(_0x231def[_0x7361('0x11')]){if(_0x231def[_0x7361('0x11')][_0x7361('0x12')]===0x1f4){logger[_0x7361('0x11')](_0x7361('0xd'),_0x472202,_0x231def[_0x7361('0x11')][_0x7361('0x13')]);return _0x270d3b(_0x231def[_0x7361('0x11')][_0x7361('0x13')]);}logger[_0x7361('0x11')](_0x7361('0xd'),_0x472202,_0x231def[_0x7361('0x11')][_0x7361('0x13')]);return _0x4baf90(_0x231def['error'][_0x7361('0x13')]);}else{logger[_0x7361('0xc')](_0x7361('0xd'),_0x472202,_0x7361('0xe'));_0x4baf90(_0x231def[_0x7361('0x14')]['message']);}})[_0x7361('0x15')](function(_0x2e97e9){logger[_0x7361('0x11')]('FreshdeskAccount,\x20%s,\x20%s',_0x472202,_0x2e97e9);_0x270d3b(_0x2e97e9);});});}exports[_0x7361('0x16')]=function(_0x49a5ad){var _0x43a491=this;return new Promise(function(_0x40d562,_0x24ae4b){return db[_0x7361('0x17')][_0x7361('0x18')]({'raw':_0x49a5ad[_0x7361('0x19')]?_0x49a5ad[_0x7361('0x19')][_0x7361('0x1a')]===undefined?!![]:![]:!![],'where':_0x49a5ad['options']?_0x49a5ad[_0x7361('0x19')]['where']||null:null,'attributes':_0x49a5ad[_0x7361('0x19')]?_0x49a5ad[_0x7361('0x19')]['attributes']||null:null,'limit':_0x49a5ad['options']?_0x49a5ad['options']['limit']||null:null,'include':_0x49a5ad[_0x7361('0x19')]?_0x49a5ad[_0x7361('0x19')][_0x7361('0x1b')]?_[_0x7361('0x1c')](_0x49a5ad[_0x7361('0x19')][_0x7361('0x1b')],function(_0x3a9882){return{'model':db[_0x3a9882[_0x7361('0x1d')]],'as':_0x3a9882['as'],'attributes':_0x3a9882['attributes'],'include':_0x3a9882['include']?_[_0x7361('0x1c')](_0x3a9882['include'],function(_0x3b1284){return{'model':db[_0x3b1284['model']],'as':_0x3b1284['as'],'attributes':_0x3b1284[_0x7361('0x1e')],'include':_0x3b1284[_0x7361('0x1b')]?_['map'](_0x3b1284[_0x7361('0x1b')],function(_0x5dd855){return{'model':db[_0x5dd855[_0x7361('0x1d')]],'as':_0x5dd855['as'],'attributes':_0x5dd855['attributes']};}):[]};}):[]};}):[]:[]})[_0x7361('0xb')](function(_0x2cb3c7){logger[_0x7361('0xc')](_0x7361('0x16'),_0x49a5ad);logger[_0x7361('0x1f')](_0x7361('0x16'),_0x49a5ad,JSON['stringify'](_0x2cb3c7));_0x40d562(_0x2cb3c7);})['catch'](function(_0x5a8d78){logger[_0x7361('0x11')](_0x7361('0x16'),_0x5a8d78['message'],_0x49a5ad);_0x24ae4b(_0x43a491[_0x7361('0x11')](0x1f4,_0x5a8d78[_0x7361('0x13')]));});});};exports[_0x7361('0x20')]=function(_0x254674){var _0x5eae51=this;return new Promise(function(_0xe813f5,_0x5bb981){return db[_0x7361('0x17')][_0x7361('0x21')]({'raw':_0x254674[_0x7361('0x19')]?_0x254674[_0x7361('0x19')][_0x7361('0x1a')]===undefined?!![]:![]:!![],'where':_0x254674[_0x7361('0x19')]?_0x254674[_0x7361('0x19')][_0x7361('0x22')]||null:null,'attributes':_0x254674[_0x7361('0x19')]?_0x254674[_0x7361('0x19')][_0x7361('0x1e')]||null:null,'include':_0x254674[_0x7361('0x19')]?_0x254674['options'][_0x7361('0x1b')]?_['map'](_0x254674['options'][_0x7361('0x1b')],function(_0x2e0fd8){return{'model':db[_0x2e0fd8[_0x7361('0x1d')]],'as':_0x2e0fd8['as'],'attributes':_0x2e0fd8[_0x7361('0x1e')],'include':_0x2e0fd8['include']?_[_0x7361('0x1c')](_0x2e0fd8[_0x7361('0x1b')],function(_0x58a279){return{'model':db[_0x58a279[_0x7361('0x1d')]],'as':_0x58a279['as'],'attributes':_0x58a279[_0x7361('0x1e')],'include':_0x58a279[_0x7361('0x1b')]?_[_0x7361('0x1c')](_0x58a279['include'],function(_0x300d2f){return{'model':db[_0x300d2f[_0x7361('0x1d')]],'as':_0x300d2f['as'],'attributes':_0x300d2f['attributes']};}):[]};}):[]};}):[]:[]})[_0x7361('0xb')](function(_0x12e3cb){logger[_0x7361('0xc')]('ShowFreshdeskAccount',_0x254674);logger[_0x7361('0x1f')]('ShowFreshdeskAccount',_0x254674,JSON[_0x7361('0x10')](_0x12e3cb));_0xe813f5(_0x12e3cb);})[_0x7361('0x15')](function(_0x69048d){logger['error'](_0x7361('0x20'),_0x69048d[_0x7361('0x13')],_0x254674);_0x5bb981(_0x5eae51[_0x7361('0x11')](0x1f4,_0x69048d[_0x7361('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 24019fd..ae175df 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 _0xd386=['/:id/tags','getTags','post','create','setTags','update','delete','destroy','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0x2bcbff,_0x5c1d7d){var _0x5d0abd=function(_0xf0ab54){while(--_0xf0ab54){_0x2bcbff['push'](_0x2bcbff['shift']());}};_0x5d0abd(++_0x5c1d7d);}(_0xd386,0x133));var _0x6d38=function(_0x33c7f0,_0x5c9f1c){_0x33c7f0=_0x33c7f0-0x0;var _0x491bef=_0xd386[_0x33c7f0];return _0x491bef;};'use strict';var multer=require('multer');var util=require(_0x6d38('0x0'));var path=require('path');var timeout=require(_0x6d38('0x1'));var express=require(_0x6d38('0x2'));var router=express[_0x6d38('0x3')]();var auth=require(_0x6d38('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x6d38('0x5'));var controller=require(_0x6d38('0x6'));router[_0x6d38('0x7')]('/',auth[_0x6d38('0x8')](),controller['index']);router['get'](_0x6d38('0x9'),auth['isAuthenticated'](),controller[_0x6d38('0xa')]);router[_0x6d38('0x7')](_0x6d38('0xb'),auth[_0x6d38('0x8')](),controller['getFields']);router[_0x6d38('0x7')](_0x6d38('0xc'),auth[_0x6d38('0x8')](),controller[_0x6d38('0xd')]);router[_0x6d38('0x7')](_0x6d38('0xe'),auth[_0x6d38('0x8')](),controller['getDescriptions']);router[_0x6d38('0x7')](_0x6d38('0xf'),auth['isAuthenticated'](),controller[_0x6d38('0x10')]);router[_0x6d38('0x11')]('/',auth[_0x6d38('0x8')](),controller[_0x6d38('0x12')]);router[_0x6d38('0x11')](_0x6d38('0xf'),auth['isAuthenticated'](),controller[_0x6d38('0x13')]);router['put']('/:id',auth[_0x6d38('0x8')](),controller[_0x6d38('0x14')]);router[_0x6d38('0x15')](_0x6d38('0x9'),auth[_0x6d38('0x8')](),controller[_0x6d38('0x16')]);module['exports']=router; \ No newline at end of file +var _0xb4c9=['show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create','setTags','put','update','delete','destroy','exports','util','express','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','get','isAuthenticated','index','/:id'];(function(_0x5a469e,_0x58be73){var _0x243c35=function(_0x4696c6){while(--_0x4696c6){_0x5a469e['push'](_0x5a469e['shift']());}};_0x243c35(++_0x58be73);}(_0xb4c9,0xbf));var _0x9b4c=function(_0x4c69b7,_0x2fadb3){_0x4c69b7=_0x4c69b7-0x0;var _0xcdd243=_0xb4c9[_0x4c69b7];return _0xcdd243;};'use strict';var multer=require('multer');var util=require(_0x9b4c('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9b4c('0x1'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x9b4c('0x2'));var config=require(_0x9b4c('0x3'));var controller=require(_0x9b4c('0x4'));router[_0x9b4c('0x5')]('/',auth[_0x9b4c('0x6')](),controller[_0x9b4c('0x7')]);router[_0x9b4c('0x5')](_0x9b4c('0x8'),auth[_0x9b4c('0x6')](),controller[_0x9b4c('0x9')]);router[_0x9b4c('0x5')](_0x9b4c('0xa'),auth[_0x9b4c('0x6')](),controller['getFields']);router[_0x9b4c('0x5')](_0x9b4c('0xb'),auth[_0x9b4c('0x6')](),controller[_0x9b4c('0xc')]);router[_0x9b4c('0x5')](_0x9b4c('0xd'),auth[_0x9b4c('0x6')](),controller[_0x9b4c('0xe')]);router[_0x9b4c('0x5')](_0x9b4c('0xf'),auth['isAuthenticated'](),controller[_0x9b4c('0x10')]);router[_0x9b4c('0x11')]('/',auth['isAuthenticated'](),controller[_0x9b4c('0x12')]);router['post'](_0x9b4c('0xf'),auth['isAuthenticated'](),controller[_0x9b4c('0x13')]);router[_0x9b4c('0x14')](_0x9b4c('0x8'),auth[_0x9b4c('0x6')](),controller[_0x9b4c('0x15')]);router[_0x9b4c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x9b4c('0x17')]);module[_0x9b4c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index 02ab6c2..aaebfa2 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 _0x7c8e=['STRING','exports'];(function(_0x32bb6b,_0x1a5fbe){var _0x58dcb4=function(_0x402ee2){while(--_0x402ee2){_0x32bb6b['push'](_0x32bb6b['shift']());}};_0x58dcb4(++_0x1a5fbe);}(_0x7c8e,0x95));var _0xe7c8=function(_0x45385c,_0x840419){_0x45385c=_0x45385c-0x0;var _0x523eb1=_0x7c8e[_0x45385c];return _0x523eb1;};'use strict';var Sequelize=require('sequelize');module[_0xe7c8('0x0')]={'name':{'type':Sequelize[_0xe7c8('0x1')]},'description':{'type':Sequelize[_0xe7c8('0x1')]}}; \ No newline at end of file +var _0xd5ff=['sequelize','STRING'];(function(_0x4513fb,_0x400f2b){var _0x18a8c9=function(_0xce95ac){while(--_0xce95ac){_0x4513fb['push'](_0x4513fb['shift']());}};_0x18a8c9(++_0x400f2b);}(_0xd5ff,0x12a));var _0xfd5f=function(_0x1ce603,_0x962f0b){_0x1ce603=_0x1ce603-0x0;var _0x12d3b5=_0xd5ff[_0x1ce603];return _0x12d3b5;};'use strict';var Sequelize=require(_0xfd5f('0x0'));module['exports']={'name':{'type':Sequelize[_0xfd5f('0x1')]},'description':{'type':Sequelize[_0xfd5f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index baadffd..d9b95e8 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 _0x691a=['code','FreshdeskConfiguration,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','then','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','type','key','filters','intersection','model','attributes','fields','query','hasOwnProperty','nolimit','limit','sort','where','filter','merge','VIRTUAL','options','includeAll','show','params','keys','include','find','create','body','destroy','findOne','order','pick','getFields','length','getSubjects','FreshdeskField','getDescriptions','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','debug','stringify','error'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x691a,0xfb));var _0xa691=function(_0x22bf43,_0x54eb72){_0x22bf43=_0x22bf43-0x0;var _0x394796=_0x691a[_0x22bf43];return _0x394796;};'use strict';var pdf=require(_0xa691('0x0'));var emlformat=require(_0xa691('0x1'));var rimraf=require(_0xa691('0x2'));var zipdir=require(_0xa691('0x3'));var jsonpatch=require(_0xa691('0x4'));var rp=require('request-promise');var moment=require(_0xa691('0x5'));var BPromise=require(_0xa691('0x6'));var Mustache=require('mustache');var util=require(_0xa691('0x7'));var path=require('path');var sox=require(_0xa691('0x8'));var csv=require(_0xa691('0x9'));var ejs=require(_0xa691('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xa691('0xb'));var crypto=require(_0xa691('0xc'));var jsforce=require(_0xa691('0xd'));var deskjs=require(_0xa691('0xe'));var toCsv=require(_0xa691('0x9'));var querystring=require(_0xa691('0xf'));var Papa=require(_0xa691('0x10'));var Redis=require(_0xa691('0x11'));var authService=require(_0xa691('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa691('0x13'));var logger=require(_0xa691('0x14'))(_0xa691('0x15'));var utils=require(_0xa691('0x16'));var config=require('../../config/environment');var db=require(_0xa691('0x17'))['db'];var jayson=require(_0xa691('0x18'));var client=jayson[_0xa691('0x19')][_0xa691('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x34b760,_0x218f6d,_0x3d2fde){if(_0x3d2fde){var _0x32faca=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32faca[_0xa691('0x1b')](_0x218f6d)){return _0x34b760;}else{throw new db[(_0xa691('0x1c'))][(_0xa691('0x1d'))](_0xa691('0x1e'));}}else{return _0x34b760;}}function respondWithRpcPromise(_0x3ef5c9,_0x389ccc,_0x2bf2a4,_0x205fe3){return new BPromise(function(_0xb40978,_0x77caa6){var _0x1f0549=_0x205fe3||client;return _0x1f0549[_0xa691('0x1f')](_0x3ef5c9,_0x2bf2a4)['then'](function(_0x4bcf27){logger[_0xa691('0x20')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x389ccc,_0xa691('0x21'));logger[_0xa691('0x22')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x389ccc,_0xa691('0x21'),JSON[_0xa691('0x23')](_0x4bcf27));if(_0x4bcf27[_0xa691('0x24')]){if(_0x4bcf27[_0xa691('0x24')][_0xa691('0x25')]===0x1f4){logger[_0xa691('0x24')](_0xa691('0x26'),_0x389ccc,_0x4bcf27[_0xa691('0x24')][_0xa691('0x27')]);return _0x77caa6(_0x4bcf27['error'][_0xa691('0x27')]);}logger[_0xa691('0x24')](_0xa691('0x26'),_0x389ccc,_0x4bcf27['error']['message']);return _0xb40978(_0x4bcf27[_0xa691('0x24')][_0xa691('0x27')]);}else{logger[_0xa691('0x20')](_0xa691('0x26'),_0x389ccc,_0xa691('0x21'));_0xb40978(_0x4bcf27['result'][_0xa691('0x27')]);}})[_0xa691('0x28')](function(_0x54d587){logger[_0xa691('0x24')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x389ccc,_0x54d587);_0x77caa6(_0x54d587);});});}function respondWithStatusCode(_0x29a394,_0x392b3f){_0x392b3f=_0x392b3f||0xcc;return function(_0x4f7473){if(_0x4f7473){return _0x29a394[_0xa691('0x29')](_0x392b3f);}return _0x29a394[_0xa691('0x2a')](_0x392b3f)[_0xa691('0x2b')]();};}function respondWithResult(_0x241753,_0x35e761){_0x35e761=_0x35e761||0xc8;return function(_0x1f4828){if(_0x1f4828){return _0x241753[_0xa691('0x2a')](_0x35e761)[_0xa691('0x2c')](_0x1f4828);}};}function respondWithFilteredResult(_0x2ffa42,_0x2f778b){return function(_0xd1bf1a){if(_0xd1bf1a){var _0x97a8d8=_0xd1bf1a[_0xa691('0x2d')],_0xced4e9=_0x2f778b[_0xa691('0x2e')],_0x90e9ea=_0x2f778b[_0xa691('0x2e')]+_0x2f778b['limit'],_0x4640b2;if(_0x90e9ea>=_0x97a8d8){_0x90e9ea=_0x97a8d8;_0x4640b2=0xc8;}else{_0x4640b2=0xce;}_0x2ffa42[_0xa691('0x2a')](_0x4640b2);return _0x2ffa42['set'](_0xa691('0x2f'),_0xced4e9+'-'+_0x90e9ea+'/'+_0x97a8d8)[_0xa691('0x2c')](_0xd1bf1a);}return null;};}function patchUpdates(_0x1afbc9){return function(_0x15f6a7){try{jsonpatch[_0xa691('0x30')](_0x15f6a7,_0x1afbc9,!![]);}catch(_0x288c69){return BPromise[_0xa691('0x31')](_0x288c69);}return _0x15f6a7[_0xa691('0x32')]();};}function saveUpdates(_0xaa4a07,_0x9aa10b){return function(_0x32d315){if(_0x32d315){return _0x32d315['update'](_0xaa4a07)['then'](function(_0x31376b){return _0x31376b;});}return null;};}function removeEntity(_0xa8ece7,_0x5672cd){return function(_0x84ab32){if(_0x84ab32){return _0x84ab32['destroy']()[_0xa691('0x33')](function(){_0xa8ece7[_0xa691('0x2a')](0xcc)[_0xa691('0x2b')]();});}};}function handleEntityNotFound(_0x148143,_0x232130){return function(_0x52a667){if(!_0x52a667){_0x148143[_0xa691('0x29')](0x194);}return _0x52a667;};}function handleError(_0x23405b,_0x25d858){_0x25d858=_0x25d858||0x1f4;return function(_0x11f18d){logger[_0xa691('0x24')](_0x11f18d[_0xa691('0x34')]);if(_0x11f18d[_0xa691('0x35')]){delete _0x11f18d[_0xa691('0x35')];}_0x23405b['status'](_0x25d858)[_0xa691('0x36')](_0x11f18d);};}exports[_0xa691('0x37')]=function(_0xc117e9,_0x49f671){var _0x5c4028={},_0x5086fa={},_0x29cfa9={'count':0x0,'rows':[]};var _0x11c516=_[_0xa691('0x38')](db[_0xa691('0x39')][_0xa691('0x3a')],function(_0x8ccfb1){return{'name':_0x8ccfb1['fieldName'],'type':_0x8ccfb1[_0xa691('0x3b')][_0xa691('0x3c')]};});_0x5086fa['model']=_[_0xa691('0x38')](_0x11c516,'name');_0x5086fa['query']=_['keys'](_0xc117e9['query']);_0x5086fa[_0xa691('0x3d')]=_[_0xa691('0x3e')](_0x5086fa[_0xa691('0x3f')],_0x5086fa['query']);_0x5c4028[_0xa691('0x40')]=_[_0xa691('0x3e')](_0x5086fa['model'],qs['fields'](_0xc117e9['query'][_0xa691('0x41')]));_0x5c4028['attributes']=_0x5c4028['attributes']['length']?_0x5c4028[_0xa691('0x40')]:_0x5086fa[_0xa691('0x3f')];if(!_0xc117e9[_0xa691('0x42')][_0xa691('0x43')](_0xa691('0x44'))){_0x5c4028[_0xa691('0x45')]=qs[_0xa691('0x45')](_0xc117e9['query'][_0xa691('0x45')]);_0x5c4028[_0xa691('0x2e')]=qs[_0xa691('0x2e')](_0xc117e9['query'][_0xa691('0x2e')]);}_0x5c4028['order']=qs['sort'](_0xc117e9[_0xa691('0x42')][_0xa691('0x46')]);_0x5c4028[_0xa691('0x47')]=qs[_0xa691('0x3d')](_['pick'](_0xc117e9[_0xa691('0x42')],_0x5086fa['filters']));if(_0xc117e9['query'][_0xa691('0x48')]){_0x5c4028[_0xa691('0x47')]=_[_0xa691('0x49')](_0x5c4028[_0xa691('0x47')],{'$or':_[_0xa691('0x38')](_0x11c516,function(_0xe5ff07){if(_0xe5ff07[_0xa691('0x3b')]!==_0xa691('0x4a')){var _0x153620={};_0x153620[_0xe5ff07[_0xa691('0x35')]]={'$like':'%'+_0xc117e9[_0xa691('0x42')][_0xa691('0x48')]+'%'};return _0x153620;}})});}_0x5c4028=_[_0xa691('0x49')]({},_0x5c4028,_0xc117e9[_0xa691('0x4b')]);var _0x4a1940={'where':_0x5c4028[_0xa691('0x47')]};return db[_0xa691('0x39')][_0xa691('0x2d')](_0x4a1940)[_0xa691('0x33')](function(_0x274759){_0x29cfa9[_0xa691('0x2d')]=_0x274759;if(_0xc117e9[_0xa691('0x42')][_0xa691('0x4c')]){_0x5c4028['include']=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x5c4028);})['then'](function(_0x32e1cf){_0x29cfa9['rows']=_0x32e1cf;return _0x29cfa9;})[_0xa691('0x33')](respondWithFilteredResult(_0x49f671,_0x5c4028))['catch'](handleError(_0x49f671,null));};exports[_0xa691('0x4d')]=function(_0x1cadc6,_0x1c2fd8){var _0x4f00b9={'raw':![],'where':{'id':_0x1cadc6[_0xa691('0x4e')]['id']}},_0x29cbfd={};_0x29cbfd[_0xa691('0x3f')]=_[_0xa691('0x4f')](db[_0xa691('0x39')][_0xa691('0x3a')]);_0x29cbfd[_0xa691('0x42')]=_[_0xa691('0x4f')](_0x1cadc6['query']);_0x29cbfd[_0xa691('0x3d')]=_['intersection'](_0x29cbfd['model'],_0x29cbfd['query']);_0x4f00b9[_0xa691('0x40')]=_['intersection'](_0x29cbfd['model'],qs[_0xa691('0x41')](_0x1cadc6[_0xa691('0x42')][_0xa691('0x41')]));_0x4f00b9['attributes']=_0x4f00b9[_0xa691('0x40')]['length']?_0x4f00b9[_0xa691('0x40')]:_0x29cbfd[_0xa691('0x3f')];if(_0x1cadc6[_0xa691('0x42')][_0xa691('0x4c')]){_0x4f00b9[_0xa691('0x50')]=[{'all':!![]}];}_0x4f00b9=_[_0xa691('0x49')]({},_0x4f00b9,_0x1cadc6['options']);return db['FreshdeskConfiguration'][_0xa691('0x51')](_0x4f00b9)[_0xa691('0x33')](handleEntityNotFound(_0x1c2fd8,null))[_0xa691('0x33')](respondWithResult(_0x1c2fd8,null))[_0xa691('0x28')](handleError(_0x1c2fd8,null));};exports['create']=function(_0x22af94,_0x3b686d){return db[_0xa691('0x39')][_0xa691('0x52')](_0x22af94[_0xa691('0x53')],{})[_0xa691('0x33')](respondWithResult(_0x3b686d,0xc9))[_0xa691('0x28')](handleError(_0x3b686d,null));};exports['update']=function(_0xaefe3a,_0x43d9fc){if(_0xaefe3a[_0xa691('0x53')]['id']){delete _0xaefe3a[_0xa691('0x53')]['id'];}return db[_0xa691('0x39')]['find']({'where':{'id':_0xaefe3a[_0xa691('0x4e')]['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x43d9fc,null))[_0xa691('0x33')](saveUpdates(_0xaefe3a[_0xa691('0x53')],null))[_0xa691('0x33')](respondWithResult(_0x43d9fc,null))['catch'](handleError(_0x43d9fc,null));};exports[_0xa691('0x54')]=function(_0xa7c878,_0x3b303d){return db[_0xa691('0x39')][_0xa691('0x51')]({'where':{'id':_0xa7c878[_0xa691('0x4e')]['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x3b303d,null))[_0xa691('0x33')](removeEntity(_0x3b303d,null))[_0xa691('0x28')](handleError(_0x3b303d,null));};exports['getFields']=function(_0x3d4866,_0x1b51f7,_0x893641){var _0x5b4db1={};var _0x36ad6e={};var _0x3e7b83;var _0x1d19cb;return db[_0xa691('0x39')][_0xa691('0x55')]({'where':{'id':_0x3d4866['params']['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x1b51f7,null))[_0xa691('0x33')](function(_0x4bc7c5){if(_0x4bc7c5){_0x3e7b83=_0x4bc7c5;_0x36ad6e['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x36ad6e['query']=_[_0xa691('0x4f')](_0x3d4866[_0xa691('0x42')]);_0x36ad6e[_0xa691('0x3d')]=_[_0xa691('0x3e')](_0x36ad6e['model'],_0x36ad6e[_0xa691('0x42')]);_0x5b4db1[_0xa691('0x40')]=_[_0xa691('0x3e')](_0x36ad6e[_0xa691('0x3f')],qs[_0xa691('0x41')](_0x3d4866['query'][_0xa691('0x41')]));_0x5b4db1['attributes']=_0x5b4db1['attributes']['length']?_0x5b4db1[_0xa691('0x40')]:_0x36ad6e[_0xa691('0x3f')];_0x5b4db1[_0xa691('0x56')]=qs[_0xa691('0x46')](_0x3d4866[_0xa691('0x42')]['sort']);_0x5b4db1[_0xa691('0x47')]=qs[_0xa691('0x3d')](_[_0xa691('0x57')](_0x3d4866['query'],_0x36ad6e[_0xa691('0x3d')]));if(_0x3d4866[_0xa691('0x42')][_0xa691('0x48')]){_0x5b4db1[_0xa691('0x47')]=_[_0xa691('0x49')](_0x5b4db1[_0xa691('0x47')],{'$or':_[_0xa691('0x38')](_0x5b4db1[_0xa691('0x40')],function(_0x5af923){var _0x3851f9={};_0x3851f9[_0x5af923]={'$like':'%'+_0x3d4866[_0xa691('0x42')]['filter']+'%'};return _0x3851f9;})});}_0x5b4db1=_[_0xa691('0x49')]({},_0x5b4db1,_0x3d4866[_0xa691('0x4b')]);return _0x3e7b83[_0xa691('0x58')](_0x5b4db1);}})['then'](function(_0x4fca97){if(_0x4fca97){_0x1d19cb=_0x4fca97[_0xa691('0x59')];if(!_0x3d4866[_0xa691('0x42')][_0xa691('0x43')]('nolimit')){_0x5b4db1[_0xa691('0x45')]=qs['limit'](_0x3d4866[_0xa691('0x42')][_0xa691('0x45')]);_0x5b4db1[_0xa691('0x2e')]=qs[_0xa691('0x2e')](_0x3d4866[_0xa691('0x42')][_0xa691('0x2e')]);}return _0x3e7b83[_0xa691('0x58')](_0x5b4db1);}})[_0xa691('0x33')](function(_0x41d15b){if(_0x41d15b){return _0x41d15b?{'count':_0x1d19cb,'rows':_0x41d15b}:null;}})['then'](respondWithResult(_0x1b51f7,null))[_0xa691('0x28')](handleError(_0x1b51f7,null));};exports[_0xa691('0x5a')]=function(_0x2c7b56,_0x5d2006,_0x1adfca){var _0xf8b6a9={};var _0x37e729={};var _0x13ffaa;var _0x332651;return db[_0xa691('0x39')][_0xa691('0x55')]({'where':{'id':_0x2c7b56[_0xa691('0x4e')]['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x5d2006,null))['then'](function(_0x2d10a3){if(_0x2d10a3){_0x13ffaa=_0x2d10a3;_0x37e729[_0xa691('0x3f')]=_[_0xa691('0x4f')](db[_0xa691('0x5b')][_0xa691('0x3a')]);_0x37e729[_0xa691('0x42')]=_[_0xa691('0x4f')](_0x2c7b56[_0xa691('0x42')]);_0x37e729['filters']=_[_0xa691('0x3e')](_0x37e729[_0xa691('0x3f')],_0x37e729[_0xa691('0x42')]);_0xf8b6a9[_0xa691('0x40')]=_['intersection'](_0x37e729[_0xa691('0x3f')],qs[_0xa691('0x41')](_0x2c7b56[_0xa691('0x42')][_0xa691('0x41')]));_0xf8b6a9[_0xa691('0x40')]=_0xf8b6a9['attributes'][_0xa691('0x59')]?_0xf8b6a9[_0xa691('0x40')]:_0x37e729[_0xa691('0x3f')];_0xf8b6a9[_0xa691('0x56')]=qs[_0xa691('0x46')](_0x2c7b56[_0xa691('0x42')][_0xa691('0x46')]);_0xf8b6a9[_0xa691('0x47')]=qs[_0xa691('0x3d')](_[_0xa691('0x57')](_0x2c7b56['query'],_0x37e729[_0xa691('0x3d')]));if(_0x2c7b56['query'][_0xa691('0x48')]){_0xf8b6a9[_0xa691('0x47')]=_[_0xa691('0x49')](_0xf8b6a9['where'],{'$or':_[_0xa691('0x38')](_0xf8b6a9[_0xa691('0x40')],function(_0xfc154d){var _0xda5ae7={};_0xda5ae7[_0xfc154d]={'$like':'%'+_0x2c7b56[_0xa691('0x42')][_0xa691('0x48')]+'%'};return _0xda5ae7;})});}_0xf8b6a9=_['merge']({},_0xf8b6a9,_0x2c7b56['options']);return _0x13ffaa[_0xa691('0x5a')](_0xf8b6a9);}})[_0xa691('0x33')](function(_0x50fe67){if(_0x50fe67){_0x332651=_0x50fe67[_0xa691('0x59')];if(!_0x2c7b56[_0xa691('0x42')][_0xa691('0x43')](_0xa691('0x44'))){_0xf8b6a9[_0xa691('0x45')]=qs[_0xa691('0x45')](_0x2c7b56[_0xa691('0x42')][_0xa691('0x45')]);_0xf8b6a9[_0xa691('0x2e')]=qs['offset'](_0x2c7b56[_0xa691('0x42')]['offset']);}return _0x13ffaa[_0xa691('0x5a')](_0xf8b6a9);}})[_0xa691('0x33')](function(_0x1eecd0){if(_0x1eecd0){return _0x1eecd0?{'count':_0x332651,'rows':_0x1eecd0}:null;}})[_0xa691('0x33')](respondWithResult(_0x5d2006,null))[_0xa691('0x28')](handleError(_0x5d2006,null));};exports[_0xa691('0x5c')]=function(_0x1788fa,_0x16053b,_0x401ef9){var _0x5a410f={};var _0x5bccb6={};var _0xcdb708;var _0x5263ca;return db['FreshdeskConfiguration'][_0xa691('0x55')]({'where':{'id':_0x1788fa['params']['id']}})['then'](handleEntityNotFound(_0x16053b,null))[_0xa691('0x33')](function(_0x299c17){if(_0x299c17){_0xcdb708=_0x299c17;_0x5bccb6[_0xa691('0x3f')]=_['keys'](db[_0xa691('0x5b')]['rawAttributes']);_0x5bccb6[_0xa691('0x42')]=_['keys'](_0x1788fa[_0xa691('0x42')]);_0x5bccb6[_0xa691('0x3d')]=_[_0xa691('0x3e')](_0x5bccb6[_0xa691('0x3f')],_0x5bccb6[_0xa691('0x42')]);_0x5a410f['attributes']=_[_0xa691('0x3e')](_0x5bccb6[_0xa691('0x3f')],qs[_0xa691('0x41')](_0x1788fa[_0xa691('0x42')]['fields']));_0x5a410f[_0xa691('0x40')]=_0x5a410f[_0xa691('0x40')][_0xa691('0x59')]?_0x5a410f[_0xa691('0x40')]:_0x5bccb6['model'];_0x5a410f[_0xa691('0x56')]=qs['sort'](_0x1788fa[_0xa691('0x42')][_0xa691('0x46')]);_0x5a410f[_0xa691('0x47')]=qs['filters'](_[_0xa691('0x57')](_0x1788fa[_0xa691('0x42')],_0x5bccb6[_0xa691('0x3d')]));if(_0x1788fa[_0xa691('0x42')]['filter']){_0x5a410f[_0xa691('0x47')]=_['merge'](_0x5a410f[_0xa691('0x47')],{'$or':_['map'](_0x5a410f[_0xa691('0x40')],function(_0x12e8c8){var _0x5a90ac={};_0x5a90ac[_0x12e8c8]={'$like':'%'+_0x1788fa[_0xa691('0x42')][_0xa691('0x48')]+'%'};return _0x5a90ac;})});}_0x5a410f=_[_0xa691('0x49')]({},_0x5a410f,_0x1788fa['options']);return _0xcdb708[_0xa691('0x5c')](_0x5a410f);}})['then'](function(_0x43a276){if(_0x43a276){_0x5263ca=_0x43a276[_0xa691('0x59')];if(!_0x1788fa[_0xa691('0x42')][_0xa691('0x43')](_0xa691('0x44'))){_0x5a410f[_0xa691('0x45')]=qs[_0xa691('0x45')](_0x1788fa[_0xa691('0x42')][_0xa691('0x45')]);_0x5a410f[_0xa691('0x2e')]=qs['offset'](_0x1788fa[_0xa691('0x42')][_0xa691('0x2e')]);}return _0xcdb708[_0xa691('0x5c')](_0x5a410f);}})[_0xa691('0x33')](function(_0x4fc4eb){if(_0x4fc4eb){return _0x4fc4eb?{'count':_0x5263ca,'rows':_0x4fc4eb}:null;}})[_0xa691('0x33')](respondWithResult(_0x16053b,null))[_0xa691('0x28')](handleError(_0x16053b,null));};exports['getTags']=function(_0x49056e,_0x105a65,_0x4fedb1){var _0x113561={};var _0x416e80={};var _0x11528d;var _0x211894;return db[_0xa691('0x39')][_0xa691('0x55')]({'where':{'id':_0x49056e['params']['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x105a65,null))[_0xa691('0x33')](function(_0xf71c57){if(_0xf71c57){_0x11528d=_0xf71c57;_0x416e80['model']=_[_0xa691('0x4f')](db['Tag'][_0xa691('0x3a')]);_0x416e80[_0xa691('0x42')]=_['keys'](_0x49056e[_0xa691('0x42')]);_0x416e80[_0xa691('0x3d')]=_[_0xa691('0x3e')](_0x416e80[_0xa691('0x3f')],_0x416e80[_0xa691('0x42')]);_0x113561[_0xa691('0x40')]=_[_0xa691('0x3e')](_0x416e80[_0xa691('0x3f')],qs[_0xa691('0x41')](_0x49056e['query'][_0xa691('0x41')]));_0x113561['attributes']=_0x113561[_0xa691('0x40')]['length']?_0x113561[_0xa691('0x40')]:_0x416e80['model'];_0x113561[_0xa691('0x56')]=qs['sort'](_0x49056e[_0xa691('0x42')][_0xa691('0x46')]);_0x113561[_0xa691('0x47')]=qs[_0xa691('0x3d')](_[_0xa691('0x57')](_0x49056e['query'],_0x416e80[_0xa691('0x3d')]));if(_0x49056e['query'][_0xa691('0x48')]){_0x113561['where']=_[_0xa691('0x49')](_0x113561[_0xa691('0x47')],{'$or':_['map'](_0x113561['attributes'],function(_0x2b91f8){var _0x5c1f06={};_0x5c1f06[_0x2b91f8]={'$like':'%'+_0x49056e[_0xa691('0x42')][_0xa691('0x48')]+'%'};return _0x5c1f06;})});}_0x113561=_[_0xa691('0x49')]({},_0x113561,_0x49056e[_0xa691('0x4b')]);return _0x11528d[_0xa691('0x5d')](_0x113561);}})[_0xa691('0x33')](function(_0x59cea4){if(_0x59cea4){_0x211894=_0x59cea4[_0xa691('0x59')];if(!_0x49056e[_0xa691('0x42')][_0xa691('0x43')](_0xa691('0x44'))){_0x113561[_0xa691('0x45')]=qs[_0xa691('0x45')](_0x49056e['query'][_0xa691('0x45')]);_0x113561[_0xa691('0x2e')]=qs[_0xa691('0x2e')](_0x49056e[_0xa691('0x42')][_0xa691('0x2e')]);}return _0x11528d[_0xa691('0x5d')](_0x113561);}})[_0xa691('0x33')](function(_0xf96bba){if(_0xf96bba){return _0xf96bba?{'count':_0x211894,'rows':_0xf96bba}:null;}})[_0xa691('0x33')](respondWithResult(_0x105a65,null))[_0xa691('0x28')](handleError(_0x105a65,null));};exports[_0xa691('0x5e')]=function(_0x4bc5d9,_0x583829,_0x5136b2){if(_0x4bc5d9[_0xa691('0x53')]['id']){delete _0x4bc5d9[_0xa691('0x53')]['id'];}return db['FreshdeskConfiguration'][_0xa691('0x55')]({'where':{'id':_0x4bc5d9[_0xa691('0x4e')]['id']}})[_0xa691('0x33')](handleEntityNotFound(_0x583829,null))[_0xa691('0x33')](function(_0x3ccb84){if(_0x3ccb84){return _0x3ccb84[_0xa691('0x5e')](_0x4bc5d9[_0xa691('0x53')][_0xa691('0x5f')]||[]);}return null;})[_0xa691('0x33')](respondWithResult(_0x583829,null))['catch'](handleError(_0x583829,null));}; \ No newline at end of file +var _0xd96d=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','offset','set','Content-Range','apply','reject','save','destroy','name','send','FreshdeskConfiguration','rawAttributes','fieldName','type','key','model','map','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','count','include','findAll','rows','show','params','keys','includeAll','find','create','update','body','getFields','findOne','FreshdeskField','filter','hasOwnProperty','limit','getSubjects','getDescriptions','getTags','Tag','ids','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','sox','to-csv','ejs','lodash','squel','../../components/auth/service'];(function(_0x487b0c,_0x14ff74){var _0x1adbdc=function(_0x2e7b9d){while(--_0x2e7b9d){_0x487b0c['push'](_0x487b0c['shift']());}};_0x1adbdc(++_0x14ff74);}(_0xd96d,0x160));var _0xdd96=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xd96d[_0x3635ce];return _0x97ecd0;};'use strict';var pdf=require(_0xdd96('0x0'));var emlformat=require(_0xdd96('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xdd96('0x2'));var rp=require(_0xdd96('0x3'));var moment=require(_0xdd96('0x4'));var BPromise=require(_0xdd96('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xdd96('0x6'));var csv=require(_0xdd96('0x7'));var ejs=require(_0xdd96('0x8'));var fs=require('fs');var _=require(_0xdd96('0x9'));var squel=require(_0xdd96('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdd96('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xdd96('0xb'));var qs=require('../../components/parsers/qs');var as=require(_0xdd96('0xc'));var hardwareService=require(_0xdd96('0xd'));var logger=require('../../config/logger')(_0xdd96('0xe'));var utils=require(_0xdd96('0xf'));var config=require(_0xdd96('0x10'));var db=require(_0xdd96('0x11'))['db'];var jayson=require(_0xdd96('0x12'));var client=jayson[_0xdd96('0x13')][_0xdd96('0x14')]({'port':0x232a});function checkPasswordPattern(_0x53cc12,_0x2a8615,_0x18d76d){if(_0x18d76d){var _0x16e8e8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x16e8e8[_0xdd96('0x15')](_0x2a8615)){return _0x53cc12;}else{throw new db['Sequelize'][(_0xdd96('0x16'))](_0xdd96('0x17'));}}else{return _0x53cc12;}}function respondWithRpcPromise(_0x302d8c,_0x3b7cab,_0x55c670,_0x34d43a){return new BPromise(function(_0x2138b5,_0x1a477b){var _0x457fca=_0x34d43a||client;return _0x457fca['request'](_0x302d8c,_0x55c670)[_0xdd96('0x18')](function(_0x40a152){logger[_0xdd96('0x19')](_0xdd96('0x1a'),_0x3b7cab,_0xdd96('0x1b'));logger[_0xdd96('0x1c')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x3b7cab,_0xdd96('0x1b'),JSON[_0xdd96('0x1d')](_0x40a152));if(_0x40a152[_0xdd96('0x1e')]){if(_0x40a152['error'][_0xdd96('0x1f')]===0x1f4){logger[_0xdd96('0x1e')](_0xdd96('0x1a'),_0x3b7cab,_0x40a152['error']['message']);return _0x1a477b(_0x40a152[_0xdd96('0x1e')][_0xdd96('0x20')]);}logger[_0xdd96('0x1e')](_0xdd96('0x1a'),_0x3b7cab,_0x40a152[_0xdd96('0x1e')]['message']);return _0x2138b5(_0x40a152[_0xdd96('0x1e')][_0xdd96('0x20')]);}else{logger[_0xdd96('0x19')](_0xdd96('0x1a'),_0x3b7cab,'request\x20sent');_0x2138b5(_0x40a152[_0xdd96('0x21')][_0xdd96('0x20')]);}})[_0xdd96('0x22')](function(_0x3ef795){logger[_0xdd96('0x1e')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3b7cab,_0x3ef795);_0x1a477b(_0x3ef795);});});}function respondWithStatusCode(_0x319844,_0x5713d0){_0x5713d0=_0x5713d0||0xcc;return function(_0x5f04d){if(_0x5f04d){return _0x319844[_0xdd96('0x23')](_0x5713d0);}return _0x319844[_0xdd96('0x24')](_0x5713d0)[_0xdd96('0x25')]();};}function respondWithResult(_0xe41762,_0x21398d){_0x21398d=_0x21398d||0xc8;return function(_0x5f080f){if(_0x5f080f){return _0xe41762['status'](_0x21398d)['json'](_0x5f080f);}};}function respondWithFilteredResult(_0x23b1aa,_0x557688){return function(_0x446d8a){if(_0x446d8a){var _0x29d684=_0x446d8a['count'],_0x29aac0=_0x557688[_0xdd96('0x26')],_0x39f129=_0x557688[_0xdd96('0x26')]+_0x557688['limit'],_0x167d34;if(_0x39f129>=_0x29d684){_0x39f129=_0x29d684;_0x167d34=0xc8;}else{_0x167d34=0xce;}_0x23b1aa['status'](_0x167d34);return _0x23b1aa[_0xdd96('0x27')](_0xdd96('0x28'),_0x29aac0+'-'+_0x39f129+'/'+_0x29d684)['json'](_0x446d8a);}return null;};}function patchUpdates(_0x5549bb){return function(_0x37b92a){try{jsonpatch[_0xdd96('0x29')](_0x37b92a,_0x5549bb,!![]);}catch(_0x5e8f18){return BPromise[_0xdd96('0x2a')](_0x5e8f18);}return _0x37b92a[_0xdd96('0x2b')]();};}function saveUpdates(_0x3d229b,_0x564edd){return function(_0x18eaeb){if(_0x18eaeb){return _0x18eaeb['update'](_0x3d229b)['then'](function(_0x31d9eb){return _0x31d9eb;});}return null;};}function removeEntity(_0x4ac11e,_0x4f551a){return function(_0xe663fc){if(_0xe663fc){return _0xe663fc[_0xdd96('0x2c')]()[_0xdd96('0x18')](function(){_0x4ac11e['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2a5610,_0x128009){return function(_0x2fcce6){if(!_0x2fcce6){_0x2a5610[_0xdd96('0x23')](0x194);}return _0x2fcce6;};}function handleError(_0x38aa38,_0x19a2fe){_0x19a2fe=_0x19a2fe||0x1f4;return function(_0x1072aa){logger[_0xdd96('0x1e')](_0x1072aa['stack']);if(_0x1072aa['name']){delete _0x1072aa[_0xdd96('0x2d')];}_0x38aa38[_0xdd96('0x24')](_0x19a2fe)[_0xdd96('0x2e')](_0x1072aa);};}exports['index']=function(_0x4901e9,_0xc62aac){var _0x55d8e2={},_0x222014={},_0x18ade8={'count':0x0,'rows':[]};var _0x265ce1=_['map'](db[_0xdd96('0x2f')][_0xdd96('0x30')],function(_0x2f7a5f){return{'name':_0x2f7a5f[_0xdd96('0x31')],'type':_0x2f7a5f[_0xdd96('0x32')][_0xdd96('0x33')]};});_0x222014[_0xdd96('0x34')]=_[_0xdd96('0x35')](_0x265ce1,_0xdd96('0x2d'));_0x222014['query']=_['keys'](_0x4901e9[_0xdd96('0x36')]);_0x222014['filters']=_[_0xdd96('0x37')](_0x222014[_0xdd96('0x34')],_0x222014[_0xdd96('0x36')]);_0x55d8e2['attributes']=_['intersection'](_0x222014[_0xdd96('0x34')],qs[_0xdd96('0x38')](_0x4901e9[_0xdd96('0x36')][_0xdd96('0x38')]));_0x55d8e2[_0xdd96('0x39')]=_0x55d8e2[_0xdd96('0x39')][_0xdd96('0x3a')]?_0x55d8e2['attributes']:_0x222014[_0xdd96('0x34')];if(!_0x4901e9[_0xdd96('0x36')]['hasOwnProperty'](_0xdd96('0x3b'))){_0x55d8e2['limit']=qs['limit'](_0x4901e9[_0xdd96('0x36')]['limit']);_0x55d8e2[_0xdd96('0x26')]=qs['offset'](_0x4901e9[_0xdd96('0x36')]['offset']);}_0x55d8e2[_0xdd96('0x3c')]=qs[_0xdd96('0x3d')](_0x4901e9[_0xdd96('0x36')][_0xdd96('0x3d')]);_0x55d8e2[_0xdd96('0x3e')]=qs[_0xdd96('0x3f')](_[_0xdd96('0x40')](_0x4901e9[_0xdd96('0x36')],_0x222014[_0xdd96('0x3f')]));if(_0x4901e9[_0xdd96('0x36')]['filter']){_0x55d8e2[_0xdd96('0x3e')]=_[_0xdd96('0x41')](_0x55d8e2['where'],{'$or':_[_0xdd96('0x35')](_0x265ce1,function(_0x330f6a){if(_0x330f6a[_0xdd96('0x32')]!==_0xdd96('0x42')){var _0x17860d={};_0x17860d[_0x330f6a[_0xdd96('0x2d')]]={'$like':'%'+_0x4901e9[_0xdd96('0x36')]['filter']+'%'};return _0x17860d;}})});}_0x55d8e2=_[_0xdd96('0x41')]({},_0x55d8e2,_0x4901e9[_0xdd96('0x43')]);var _0xf0638b={'where':_0x55d8e2[_0xdd96('0x3e')]};return db[_0xdd96('0x2f')][_0xdd96('0x44')](_0xf0638b)[_0xdd96('0x18')](function(_0x88425e){_0x18ade8[_0xdd96('0x44')]=_0x88425e;if(_0x4901e9[_0xdd96('0x36')]['includeAll']){_0x55d8e2[_0xdd96('0x45')]=[{'all':!![]}];}return db[_0xdd96('0x2f')][_0xdd96('0x46')](_0x55d8e2);})[_0xdd96('0x18')](function(_0x270b26){_0x18ade8[_0xdd96('0x47')]=_0x270b26;return _0x18ade8;})[_0xdd96('0x18')](respondWithFilteredResult(_0xc62aac,_0x55d8e2))['catch'](handleError(_0xc62aac,null));};exports[_0xdd96('0x48')]=function(_0x783196,_0x5c8bd5){var _0x1f62b5={'raw':![],'where':{'id':_0x783196[_0xdd96('0x49')]['id']}},_0x119284={};_0x119284[_0xdd96('0x34')]=_['keys'](db['FreshdeskConfiguration'][_0xdd96('0x30')]);_0x119284[_0xdd96('0x36')]=_[_0xdd96('0x4a')](_0x783196['query']);_0x119284[_0xdd96('0x3f')]=_[_0xdd96('0x37')](_0x119284[_0xdd96('0x34')],_0x119284[_0xdd96('0x36')]);_0x1f62b5[_0xdd96('0x39')]=_[_0xdd96('0x37')](_0x119284[_0xdd96('0x34')],qs['fields'](_0x783196['query']['fields']));_0x1f62b5[_0xdd96('0x39')]=_0x1f62b5[_0xdd96('0x39')][_0xdd96('0x3a')]?_0x1f62b5[_0xdd96('0x39')]:_0x119284[_0xdd96('0x34')];if(_0x783196[_0xdd96('0x36')][_0xdd96('0x4b')]){_0x1f62b5[_0xdd96('0x45')]=[{'all':!![]}];}_0x1f62b5=_[_0xdd96('0x41')]({},_0x1f62b5,_0x783196[_0xdd96('0x43')]);return db['FreshdeskConfiguration'][_0xdd96('0x4c')](_0x1f62b5)[_0xdd96('0x18')](handleEntityNotFound(_0x5c8bd5,null))[_0xdd96('0x18')](respondWithResult(_0x5c8bd5,null))[_0xdd96('0x22')](handleError(_0x5c8bd5,null));};exports['create']=function(_0x143f69,_0x111696){return db[_0xdd96('0x2f')][_0xdd96('0x4d')](_0x143f69['body'],{})[_0xdd96('0x18')](respondWithResult(_0x111696,0xc9))['catch'](handleError(_0x111696,null));};exports[_0xdd96('0x4e')]=function(_0x806b5f,_0x597662){if(_0x806b5f[_0xdd96('0x4f')]['id']){delete _0x806b5f[_0xdd96('0x4f')]['id'];}return db[_0xdd96('0x2f')]['find']({'where':{'id':_0x806b5f[_0xdd96('0x49')]['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x597662,null))[_0xdd96('0x18')](saveUpdates(_0x806b5f['body'],null))[_0xdd96('0x18')](respondWithResult(_0x597662,null))['catch'](handleError(_0x597662,null));};exports[_0xdd96('0x2c')]=function(_0x2b001c,_0x242f3d){return db[_0xdd96('0x2f')][_0xdd96('0x4c')]({'where':{'id':_0x2b001c[_0xdd96('0x49')]['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x242f3d,null))[_0xdd96('0x18')](removeEntity(_0x242f3d,null))['catch'](handleError(_0x242f3d,null));};exports[_0xdd96('0x50')]=function(_0x5582f0,_0x345d7b,_0x144a96){var _0x515f81={};var _0x4739d2={};var _0x23c873;var _0x53b7b7;return db['FreshdeskConfiguration'][_0xdd96('0x51')]({'where':{'id':_0x5582f0['params']['id']}})['then'](handleEntityNotFound(_0x345d7b,null))['then'](function(_0x277808){if(_0x277808){_0x23c873=_0x277808;_0x4739d2[_0xdd96('0x34')]=_[_0xdd96('0x4a')](db[_0xdd96('0x52')][_0xdd96('0x30')]);_0x4739d2[_0xdd96('0x36')]=_[_0xdd96('0x4a')](_0x5582f0[_0xdd96('0x36')]);_0x4739d2[_0xdd96('0x3f')]=_[_0xdd96('0x37')](_0x4739d2[_0xdd96('0x34')],_0x4739d2['query']);_0x515f81[_0xdd96('0x39')]=_[_0xdd96('0x37')](_0x4739d2[_0xdd96('0x34')],qs['fields'](_0x5582f0[_0xdd96('0x36')][_0xdd96('0x38')]));_0x515f81[_0xdd96('0x39')]=_0x515f81[_0xdd96('0x39')]['length']?_0x515f81[_0xdd96('0x39')]:_0x4739d2[_0xdd96('0x34')];_0x515f81[_0xdd96('0x3c')]=qs['sort'](_0x5582f0[_0xdd96('0x36')][_0xdd96('0x3d')]);_0x515f81[_0xdd96('0x3e')]=qs[_0xdd96('0x3f')](_[_0xdd96('0x40')](_0x5582f0[_0xdd96('0x36')],_0x4739d2['filters']));if(_0x5582f0[_0xdd96('0x36')][_0xdd96('0x53')]){_0x515f81['where']=_[_0xdd96('0x41')](_0x515f81[_0xdd96('0x3e')],{'$or':_[_0xdd96('0x35')](_0x515f81['attributes'],function(_0x280a3d){var _0x2ebf9c={};_0x2ebf9c[_0x280a3d]={'$like':'%'+_0x5582f0['query']['filter']+'%'};return _0x2ebf9c;})});}_0x515f81=_[_0xdd96('0x41')]({},_0x515f81,_0x5582f0[_0xdd96('0x43')]);return _0x23c873[_0xdd96('0x50')](_0x515f81);}})[_0xdd96('0x18')](function(_0xda3cde){if(_0xda3cde){_0x53b7b7=_0xda3cde['length'];if(!_0x5582f0['query'][_0xdd96('0x54')](_0xdd96('0x3b'))){_0x515f81[_0xdd96('0x55')]=qs[_0xdd96('0x55')](_0x5582f0[_0xdd96('0x36')][_0xdd96('0x55')]);_0x515f81[_0xdd96('0x26')]=qs[_0xdd96('0x26')](_0x5582f0[_0xdd96('0x36')][_0xdd96('0x26')]);}return _0x23c873[_0xdd96('0x50')](_0x515f81);}})['then'](function(_0x1bc17e){if(_0x1bc17e){return _0x1bc17e?{'count':_0x53b7b7,'rows':_0x1bc17e}:null;}})[_0xdd96('0x18')](respondWithResult(_0x345d7b,null))[_0xdd96('0x22')](handleError(_0x345d7b,null));};exports[_0xdd96('0x56')]=function(_0x512110,_0x50fbbf,_0x5d2d0c){var _0x10e3ed={};var _0x3890b1={};var _0x5e9086;var _0x22f764;return db[_0xdd96('0x2f')][_0xdd96('0x51')]({'where':{'id':_0x512110['params']['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x50fbbf,null))['then'](function(_0x2f823d){if(_0x2f823d){_0x5e9086=_0x2f823d;_0x3890b1['model']=_['keys'](db[_0xdd96('0x52')][_0xdd96('0x30')]);_0x3890b1[_0xdd96('0x36')]=_[_0xdd96('0x4a')](_0x512110[_0xdd96('0x36')]);_0x3890b1['filters']=_[_0xdd96('0x37')](_0x3890b1[_0xdd96('0x34')],_0x3890b1[_0xdd96('0x36')]);_0x10e3ed[_0xdd96('0x39')]=_[_0xdd96('0x37')](_0x3890b1[_0xdd96('0x34')],qs[_0xdd96('0x38')](_0x512110['query'][_0xdd96('0x38')]));_0x10e3ed[_0xdd96('0x39')]=_0x10e3ed[_0xdd96('0x39')][_0xdd96('0x3a')]?_0x10e3ed[_0xdd96('0x39')]:_0x3890b1[_0xdd96('0x34')];_0x10e3ed[_0xdd96('0x3c')]=qs[_0xdd96('0x3d')](_0x512110['query'][_0xdd96('0x3d')]);_0x10e3ed[_0xdd96('0x3e')]=qs[_0xdd96('0x3f')](_[_0xdd96('0x40')](_0x512110[_0xdd96('0x36')],_0x3890b1['filters']));if(_0x512110['query'][_0xdd96('0x53')]){_0x10e3ed[_0xdd96('0x3e')]=_['merge'](_0x10e3ed[_0xdd96('0x3e')],{'$or':_[_0xdd96('0x35')](_0x10e3ed[_0xdd96('0x39')],function(_0x457d61){var _0x4f1d74={};_0x4f1d74[_0x457d61]={'$like':'%'+_0x512110[_0xdd96('0x36')][_0xdd96('0x53')]+'%'};return _0x4f1d74;})});}_0x10e3ed=_[_0xdd96('0x41')]({},_0x10e3ed,_0x512110[_0xdd96('0x43')]);return _0x5e9086['getSubjects'](_0x10e3ed);}})[_0xdd96('0x18')](function(_0x4777a1){if(_0x4777a1){_0x22f764=_0x4777a1['length'];if(!_0x512110['query'][_0xdd96('0x54')](_0xdd96('0x3b'))){_0x10e3ed['limit']=qs['limit'](_0x512110[_0xdd96('0x36')][_0xdd96('0x55')]);_0x10e3ed[_0xdd96('0x26')]=qs[_0xdd96('0x26')](_0x512110[_0xdd96('0x36')]['offset']);}return _0x5e9086[_0xdd96('0x56')](_0x10e3ed);}})[_0xdd96('0x18')](function(_0x47b8ad){if(_0x47b8ad){return _0x47b8ad?{'count':_0x22f764,'rows':_0x47b8ad}:null;}})[_0xdd96('0x18')](respondWithResult(_0x50fbbf,null))[_0xdd96('0x22')](handleError(_0x50fbbf,null));};exports[_0xdd96('0x57')]=function(_0x3cb17d,_0x5927b4,_0xf85945){var _0x6be490={};var _0x5d73ad={};var _0x5d18c1;var _0x3f2dac;return db[_0xdd96('0x2f')][_0xdd96('0x51')]({'where':{'id':_0x3cb17d[_0xdd96('0x49')]['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x5927b4,null))[_0xdd96('0x18')](function(_0x5d2c74){if(_0x5d2c74){_0x5d18c1=_0x5d2c74;_0x5d73ad[_0xdd96('0x34')]=_['keys'](db[_0xdd96('0x52')][_0xdd96('0x30')]);_0x5d73ad['query']=_[_0xdd96('0x4a')](_0x3cb17d[_0xdd96('0x36')]);_0x5d73ad[_0xdd96('0x3f')]=_['intersection'](_0x5d73ad['model'],_0x5d73ad[_0xdd96('0x36')]);_0x6be490['attributes']=_['intersection'](_0x5d73ad[_0xdd96('0x34')],qs[_0xdd96('0x38')](_0x3cb17d[_0xdd96('0x36')][_0xdd96('0x38')]));_0x6be490[_0xdd96('0x39')]=_0x6be490[_0xdd96('0x39')]['length']?_0x6be490[_0xdd96('0x39')]:_0x5d73ad['model'];_0x6be490[_0xdd96('0x3c')]=qs[_0xdd96('0x3d')](_0x3cb17d[_0xdd96('0x36')][_0xdd96('0x3d')]);_0x6be490[_0xdd96('0x3e')]=qs['filters'](_[_0xdd96('0x40')](_0x3cb17d[_0xdd96('0x36')],_0x5d73ad[_0xdd96('0x3f')]));if(_0x3cb17d[_0xdd96('0x36')][_0xdd96('0x53')]){_0x6be490['where']=_['merge'](_0x6be490[_0xdd96('0x3e')],{'$or':_[_0xdd96('0x35')](_0x6be490[_0xdd96('0x39')],function(_0x335493){var _0x1b586b={};_0x1b586b[_0x335493]={'$like':'%'+_0x3cb17d[_0xdd96('0x36')][_0xdd96('0x53')]+'%'};return _0x1b586b;})});}_0x6be490=_[_0xdd96('0x41')]({},_0x6be490,_0x3cb17d[_0xdd96('0x43')]);return _0x5d18c1['getDescriptions'](_0x6be490);}})[_0xdd96('0x18')](function(_0x363bae){if(_0x363bae){_0x3f2dac=_0x363bae['length'];if(!_0x3cb17d['query'][_0xdd96('0x54')]('nolimit')){_0x6be490[_0xdd96('0x55')]=qs['limit'](_0x3cb17d[_0xdd96('0x36')]['limit']);_0x6be490[_0xdd96('0x26')]=qs['offset'](_0x3cb17d[_0xdd96('0x36')][_0xdd96('0x26')]);}return _0x5d18c1[_0xdd96('0x57')](_0x6be490);}})[_0xdd96('0x18')](function(_0xf4937d){if(_0xf4937d){return _0xf4937d?{'count':_0x3f2dac,'rows':_0xf4937d}:null;}})['then'](respondWithResult(_0x5927b4,null))[_0xdd96('0x22')](handleError(_0x5927b4,null));};exports[_0xdd96('0x58')]=function(_0x4520e8,_0x16e5a6,_0xcfeea4){var _0x2a7652={};var _0x344910={};var _0x58e38b;var _0x227c3c;return db[_0xdd96('0x2f')][_0xdd96('0x51')]({'where':{'id':_0x4520e8[_0xdd96('0x49')]['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x16e5a6,null))['then'](function(_0x49d774){if(_0x49d774){_0x58e38b=_0x49d774;_0x344910[_0xdd96('0x34')]=_[_0xdd96('0x4a')](db[_0xdd96('0x59')][_0xdd96('0x30')]);_0x344910[_0xdd96('0x36')]=_[_0xdd96('0x4a')](_0x4520e8[_0xdd96('0x36')]);_0x344910[_0xdd96('0x3f')]=_['intersection'](_0x344910[_0xdd96('0x34')],_0x344910[_0xdd96('0x36')]);_0x2a7652[_0xdd96('0x39')]=_[_0xdd96('0x37')](_0x344910['model'],qs[_0xdd96('0x38')](_0x4520e8[_0xdd96('0x36')][_0xdd96('0x38')]));_0x2a7652[_0xdd96('0x39')]=_0x2a7652[_0xdd96('0x39')][_0xdd96('0x3a')]?_0x2a7652['attributes']:_0x344910[_0xdd96('0x34')];_0x2a7652['order']=qs[_0xdd96('0x3d')](_0x4520e8[_0xdd96('0x36')][_0xdd96('0x3d')]);_0x2a7652[_0xdd96('0x3e')]=qs[_0xdd96('0x3f')](_['pick'](_0x4520e8[_0xdd96('0x36')],_0x344910[_0xdd96('0x3f')]));if(_0x4520e8[_0xdd96('0x36')][_0xdd96('0x53')]){_0x2a7652[_0xdd96('0x3e')]=_['merge'](_0x2a7652[_0xdd96('0x3e')],{'$or':_['map'](_0x2a7652[_0xdd96('0x39')],function(_0x25ef89){var _0x2e7407={};_0x2e7407[_0x25ef89]={'$like':'%'+_0x4520e8['query'][_0xdd96('0x53')]+'%'};return _0x2e7407;})});}_0x2a7652=_[_0xdd96('0x41')]({},_0x2a7652,_0x4520e8[_0xdd96('0x43')]);return _0x58e38b[_0xdd96('0x58')](_0x2a7652);}})[_0xdd96('0x18')](function(_0x1cceac){if(_0x1cceac){_0x227c3c=_0x1cceac[_0xdd96('0x3a')];if(!_0x4520e8[_0xdd96('0x36')][_0xdd96('0x54')](_0xdd96('0x3b'))){_0x2a7652[_0xdd96('0x55')]=qs[_0xdd96('0x55')](_0x4520e8['query'][_0xdd96('0x55')]);_0x2a7652[_0xdd96('0x26')]=qs['offset'](_0x4520e8['query'][_0xdd96('0x26')]);}return _0x58e38b[_0xdd96('0x58')](_0x2a7652);}})[_0xdd96('0x18')](function(_0x37ca18){if(_0x37ca18){return _0x37ca18?{'count':_0x227c3c,'rows':_0x37ca18}:null;}})[_0xdd96('0x18')](respondWithResult(_0x16e5a6,null))[_0xdd96('0x22')](handleError(_0x16e5a6,null));};exports['setTags']=function(_0x3dbc98,_0x242d9e,_0x16ffe9){if(_0x3dbc98[_0xdd96('0x4f')]['id']){delete _0x3dbc98[_0xdd96('0x4f')]['id'];}return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x3dbc98['params']['id']}})[_0xdd96('0x18')](handleEntityNotFound(_0x242d9e,null))[_0xdd96('0x18')](function(_0x49170c){if(_0x49170c){return _0x49170c['setTags'](_0x3dbc98[_0xdd96('0x4f')][_0xdd96('0x5a')]||[]);}return null;})[_0xdd96('0x18')](respondWithResult(_0x242d9e,null))['catch'](handleError(_0x242d9e,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index a498dab..5ee5c72 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 _0x55fd=['FreshdeskConfiguration','int_freshdesk_configurations','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x1aba84,_0x1e663a){var _0x4ca2cb=function(_0x5c3132){while(--_0x5c3132){_0x1aba84['push'](_0x1aba84['shift']());}};_0x4ca2cb(++_0x1e663a);}(_0x55fd,0x120));var _0xd55f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x55fd[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd55f('0x0'));var moment=require(_0xd55f('0x1'));var BPromise=require(_0xd55f('0x2'));var rp=require(_0xd55f('0x3'));var fs=require('fs');var path=require(_0xd55f('0x4'));var rimraf=require(_0xd55f('0x5'));var config=require(_0xd55f('0x6'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0xd55f('0x7')]=function(_0x197119,_0x2fe0de){return _0x197119[_0xd55f('0x8')](_0xd55f('0x9'),attributes,{'tableName':_0xd55f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4404=['define','FreshdeskConfiguration','int_freshdesk_configurations','lodash','util','api','moment','bluebird','request-promise','rimraf','exports'];(function(_0x3e21f4,_0x43d310){var _0x40fc49=function(_0x54a8f6){while(--_0x54a8f6){_0x3e21f4['push'](_0x3e21f4['shift']());}};_0x40fc49(++_0x43d310);}(_0x4404,0x1c6));var _0x4440=function(_0x548e20,_0x5a0474){_0x548e20=_0x548e20-0x0;var _0x46bcda=_0x4404[_0x548e20];return _0x46bcda;};'use strict';var _=require(_0x4440('0x0'));var util=require(_0x4440('0x1'));var logger=require('../../config/logger')(_0x4440('0x2'));var moment=require(_0x4440('0x3'));var BPromise=require(_0x4440('0x4'));var rp=require(_0x4440('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4440('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x4440('0x7')]=function(_0x4ef266,_0x3b92b1){return _0x4ef266[_0x4440('0x8')](_0x4440('0x9'),attributes,{'tableName':_0x4440('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.rpc.js index 3ac29e1..e9cf4d0 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 _0x3596=['message','info','lodash','moment','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x53c7f4,_0x272dd5){var _0x12f418=function(_0x29a01f){while(--_0x29a01f){_0x53c7f4['push'](_0x53c7f4['shift']());}};_0x12f418(++_0x272dd5);}(_0x3596,0xb6));var _0x6359=function(_0x1d24eb,_0x12295b){_0x1d24eb=_0x1d24eb-0x0;var _0x1dc576=_0x3596[_0x1d24eb];return _0x1dc576;};'use strict';var _=require(_0x6359('0x0'));var util=require('util');var moment=require(_0x6359('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6359('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6359('0x3'))(_0x6359('0x4'));var config=require(_0x6359('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x6359('0x6')][_0x6359('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2254e2,_0x3d0993,_0x327bd5){return new BPromise(function(_0x21ca4b,_0x26e128){return client[_0x6359('0x8')](_0x2254e2,_0x327bd5)['then'](function(_0x5f492a){logger['info'](_0x6359('0x9'),_0x3d0993,'request\x20sent');logger[_0x6359('0xa')](_0x6359('0xb'),_0x3d0993,_0x6359('0xc'),JSON[_0x6359('0xd')](_0x5f492a));if(_0x5f492a[_0x6359('0xe')]){if(_0x5f492a[_0x6359('0xe')][_0x6359('0xf')]===0x1f4){logger['error'](_0x6359('0x9'),_0x3d0993,_0x5f492a[_0x6359('0xe')][_0x6359('0x10')]);return _0x26e128(_0x5f492a[_0x6359('0xe')]['message']);}logger[_0x6359('0xe')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d0993,_0x5f492a[_0x6359('0xe')][_0x6359('0x10')]);return _0x21ca4b(_0x5f492a[_0x6359('0xe')][_0x6359('0x10')]);}else{logger[_0x6359('0x11')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x3d0993,_0x6359('0xc'));_0x21ca4b(_0x5f492a['result'][_0x6359('0x10')]);}})['catch'](function(_0xad8391){logger[_0x6359('0xe')](_0x6359('0x9'),_0x3d0993,_0xad8391);_0x26e128(_0xad8391);});});} \ No newline at end of file +var _0xef2a=['jayson/promise','client','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x479967,_0x278601){var _0x5e2c05=function(_0x561619){while(--_0x561619){_0x479967['push'](_0x479967['shift']());}};_0x5e2c05(++_0x278601);}(_0xef2a,0x124));var _0xaef2=function(_0x4e5bfd,_0x413fe6){_0x4e5bfd=_0x4e5bfd-0x0;var _0x4c8e92=_0xef2a[_0x4e5bfd];return _0x4c8e92;};'use strict';var _=require(_0xaef2('0x0'));var util=require('util');var moment=require(_0xaef2('0x1'));var BPromise=require('bluebird');var rs=require(_0xaef2('0x2'));var fs=require('fs');var Redis=require(_0xaef2('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xaef2('0x4'));var logger=require(_0xaef2('0x5'))(_0xaef2('0x6'));var config=require(_0xaef2('0x7'));var jayson=require(_0xaef2('0x8'));var client=jayson[_0xaef2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20df1e,_0x30d7cd,_0x1a1452){return new BPromise(function(_0x5c5b54,_0x400e46){return client[_0xaef2('0xa')](_0x20df1e,_0x1a1452)[_0xaef2('0xb')](function(_0x2d5b7b){logger[_0xaef2('0xc')](_0xaef2('0xd'),_0x30d7cd,_0xaef2('0xe'));logger['debug'](_0xaef2('0xf'),_0x30d7cd,_0xaef2('0xe'),JSON['stringify'](_0x2d5b7b));if(_0x2d5b7b[_0xaef2('0x10')]){if(_0x2d5b7b['error']['code']===0x1f4){logger['error'](_0xaef2('0xd'),_0x30d7cd,_0x2d5b7b[_0xaef2('0x10')][_0xaef2('0x11')]);return _0x400e46(_0x2d5b7b[_0xaef2('0x10')]['message']);}logger[_0xaef2('0x10')](_0xaef2('0xd'),_0x30d7cd,_0x2d5b7b['error'][_0xaef2('0x11')]);return _0x5c5b54(_0x2d5b7b[_0xaef2('0x10')]['message']);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x30d7cd,'request\x20sent');_0x5c5b54(_0x2d5b7b[_0xaef2('0x12')][_0xaef2('0x11')]);}})[_0xaef2('0x13')](function(_0x27ae57){logger[_0xaef2('0x10')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x30d7cd,_0x27ae57);_0x400e46(_0x27ae57);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index e369513..e43c760 100644 --- a/server/api/intFreshdeskField/index.js +++ b/server/api/intFreshdeskField/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb91=['post','create','update','delete','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show'];(function(_0x11f249,_0x4ca4a8){var _0x5c3656=function(_0x27c9f8){while(--_0x27c9f8){_0x11f249['push'](_0x11f249['shift']());}};_0x5c3656(++_0x4ca4a8);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xcb91[_0x469a3c];return _0x968f4;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x1cb9('0x4'));var config=require(_0x1cb9('0x5'));var controller=require('./intFreshdeskField.controller');router[_0x1cb9('0x6')]('/',auth[_0x1cb9('0x7')](),controller['index']);router[_0x1cb9('0x6')](_0x1cb9('0x8'),auth['isAuthenticated'](),controller[_0x1cb9('0x9')]);router[_0x1cb9('0xa')]('/',auth['isAuthenticated'](),controller[_0x1cb9('0xb')]);router['put']('/:id',auth[_0x1cb9('0x7')](),controller[_0x1cb9('0xc')]);router[_0x1cb9('0xd')](_0x1cb9('0x8'),auth[_0x1cb9('0x7')](),controller['destroy']);module[_0x1cb9('0xe')]=router; \ No newline at end of file +var _0x008c=['show','destroy','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id'];(function(_0x85e84f,_0x305b33){var _0x12c0e6=function(_0x27d913){while(--_0x27d913){_0x85e84f['push'](_0x85e84f['shift']());}};_0x12c0e6(++_0x305b33);}(_0x008c,0x188));var _0xc008=function(_0x569f5f,_0x1c6c5c){_0x569f5f=_0x569f5f-0x0;var _0x3e8e2e=_0x008c[_0x569f5f];return _0x3e8e2e;};'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']('/',auth[_0xc008('0xa')](),controller['create']);router['put'](_0xc008('0xc'),auth[_0xc008('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc008('0xa')](),controller[_0xc008('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 6e67f87..57ea5b3 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 _0xcb99=['STRING','variable','BOOLEAN','sequelize','ENUM','customVariable','keyValue','string'];(function(_0x5b2835,_0x2d9f5d){var _0xad488b=function(_0x1c3794){while(--_0x1c3794){_0x5b2835['push'](_0x5b2835['shift']());}};_0xad488b(++_0x2d9f5d);}(_0xcb99,0x8b));var _0x9cb9=function(_0x4a4bc9,_0xd8cbdb){_0x4a4bc9=_0x4a4bc9-0x0;var _0x3589ca=_0xcb99[_0x4a4bc9];return _0x3589ca;};'use strict';var Sequelize=require(_0x9cb9('0x0'));module['exports']={'type':{'type':Sequelize[_0x9cb9('0x1')]('string','variable',_0x9cb9('0x2'),_0x9cb9('0x3')),'defaultValue':_0x9cb9('0x4')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x9cb9('0x5')]},'keyType':{'type':Sequelize[_0x9cb9('0x1')]('string',_0x9cb9('0x6'),'customVariable')},'keyContent':{'type':Sequelize[_0x9cb9('0x5')]},'idField':{'type':Sequelize[_0x9cb9('0x5')]},'nameField':{'type':Sequelize[_0x9cb9('0x5')]},'customField':{'type':Sequelize[_0x9cb9('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9cb9('0x5')]}}; \ No newline at end of file +var _0x20ec=['string','keyValue','STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x20ec,0x12f));var _0xc20e=function(_0x52a23f,_0x467b97){_0x52a23f=_0x52a23f-0x0;var _0x14c953=_0x20ec[_0x52a23f];return _0x14c953;};'use strict';var Sequelize=require(_0xc20e('0x0'));module[_0xc20e('0x1')]={'type':{'type':Sequelize[_0xc20e('0x2')](_0xc20e('0x3'),'variable','customVariable',_0xc20e('0x4')),'defaultValue':_0xc20e('0x3')},'content':{'type':Sequelize[_0xc20e('0x5')]},'key':{'type':Sequelize[_0xc20e('0x5')]},'keyType':{'type':Sequelize[_0xc20e('0x2')](_0xc20e('0x3'),_0xc20e('0x6'),_0xc20e('0x7'))},'keyContent':{'type':Sequelize[_0xc20e('0x5')]},'idField':{'type':Sequelize[_0xc20e('0x5')]},'nameField':{'type':Sequelize[_0xc20e('0x5')]},'customField':{'type':Sequelize[_0xc20e('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc20e('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 946cf22..23951c0 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 _0x7b70=['apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FreshdeskField','rawAttributes','key','query','keys','intersection','model','attributes','fields','hasOwnProperty','limit','order','sort','where','filters','pick','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','Content-Range'];(function(_0x5a452e,_0x41c693){var _0x21a12a=function(_0x1e6888){while(--_0x1e6888){_0x5a452e['push'](_0x5a452e['shift']());}};_0x21a12a(++_0x41c693);}(_0x7b70,0x10c));var _0x07b7=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x7b70[_0x9c2427];return _0x51984f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x07b7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x07b7('0x1'));var jsonpatch=require(_0x07b7('0x2'));var rp=require(_0x07b7('0x3'));var moment=require(_0x07b7('0x4'));var BPromise=require(_0x07b7('0x5'));var Mustache=require(_0x07b7('0x6'));var util=require(_0x07b7('0x7'));var path=require(_0x07b7('0x8'));var sox=require(_0x07b7('0x9'));var csv=require(_0x07b7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x07b7('0xb'));var crypto=require('crypto');var jsforce=require(_0x07b7('0xc'));var deskjs=require(_0x07b7('0xd'));var toCsv=require(_0x07b7('0xa'));var querystring=require(_0x07b7('0xe'));var Papa=require(_0x07b7('0xf'));var Redis=require(_0x07b7('0x10'));var authService=require(_0x07b7('0x11'));var qs=require(_0x07b7('0x12'));var as=require(_0x07b7('0x13'));var hardwareService=require(_0x07b7('0x14'));var logger=require('../../config/logger')(_0x07b7('0x15'));var utils=require(_0x07b7('0x16'));var config=require(_0x07b7('0x17'));var db=require(_0x07b7('0x18'))['db'];function respondWithStatusCode(_0x56642c,_0x41be2e){_0x41be2e=_0x41be2e||0xcc;return function(_0x26e01d){if(_0x26e01d){return _0x56642c[_0x07b7('0x19')](_0x41be2e);}return _0x56642c[_0x07b7('0x1a')](_0x41be2e)[_0x07b7('0x1b')]();};}function respondWithResult(_0x58ee4b,_0x2d24c9){_0x2d24c9=_0x2d24c9||0xc8;return function(_0x57eb4a){if(_0x57eb4a){return _0x58ee4b[_0x07b7('0x1a')](_0x2d24c9)[_0x07b7('0x1c')](_0x57eb4a);}};}function respondWithFilteredResult(_0xd6e0ba,_0x4dac22){return function(_0x3bae12){if(_0x3bae12){var _0xfc6e82=_0x3bae12[_0x07b7('0x1d')],_0x16f11d=_0x4dac22[_0x07b7('0x1e')],_0x12c7f3=_0x4dac22[_0x07b7('0x1e')]+_0x4dac22['limit'],_0xda9ef9;if(_0x12c7f3>=_0xfc6e82){_0x12c7f3=_0xfc6e82;_0xda9ef9=0xc8;}else{_0xda9ef9=0xce;}_0xd6e0ba[_0x07b7('0x1a')](_0xda9ef9);return _0xd6e0ba['set'](_0x07b7('0x1f'),_0x16f11d+'-'+_0x12c7f3+'/'+_0xfc6e82)[_0x07b7('0x1c')](_0x3bae12);}return null;};}function patchUpdates(_0xd2e4e8){return function(_0x541856){try{jsonpatch[_0x07b7('0x20')](_0x541856,_0xd2e4e8,!![]);}catch(_0x5d659b){return BPromise[_0x07b7('0x21')](_0x5d659b);}return _0x541856[_0x07b7('0x22')]();};}function saveUpdates(_0xafa458,_0x220919){return function(_0x17e171){if(_0x17e171){return _0x17e171[_0x07b7('0x23')](_0xafa458)[_0x07b7('0x24')](function(_0x262b39){return _0x262b39;});}return null;};}function removeEntity(_0x2abccb,_0x29a9fa){return function(_0x206faa){if(_0x206faa){return _0x206faa[_0x07b7('0x25')]()[_0x07b7('0x24')](function(){_0x2abccb[_0x07b7('0x1a')](0xcc)[_0x07b7('0x1b')]();});}};}function handleEntityNotFound(_0x470771,_0x5db173){return function(_0x11aa74){if(!_0x11aa74){_0x470771[_0x07b7('0x19')](0x194);}return _0x11aa74;};}function handleError(_0x2d4c21,_0x273f6e){_0x273f6e=_0x273f6e||0x1f4;return function(_0x25e9e5){logger[_0x07b7('0x26')](_0x25e9e5[_0x07b7('0x27')]);if(_0x25e9e5[_0x07b7('0x28')]){delete _0x25e9e5['name'];}_0x2d4c21[_0x07b7('0x1a')](_0x273f6e)[_0x07b7('0x29')](_0x25e9e5);};}exports[_0x07b7('0x2a')]=function(_0x5ba7e2,_0x755d7f){var _0x5c6e5a={},_0x12620c={},_0x7596a9={'count':0x0,'rows':[]};var _0x2a2f97=_[_0x07b7('0x2b')](db[_0x07b7('0x2c')][_0x07b7('0x2d')],function(_0xf68daf){return{'name':_0xf68daf['fieldName'],'type':_0xf68daf['type'][_0x07b7('0x2e')]};});_0x12620c['model']=_[_0x07b7('0x2b')](_0x2a2f97,_0x07b7('0x28'));_0x12620c[_0x07b7('0x2f')]=_[_0x07b7('0x30')](_0x5ba7e2[_0x07b7('0x2f')]);_0x12620c['filters']=_[_0x07b7('0x31')](_0x12620c[_0x07b7('0x32')],_0x12620c[_0x07b7('0x2f')]);_0x5c6e5a[_0x07b7('0x33')]=_[_0x07b7('0x31')](_0x12620c[_0x07b7('0x32')],qs[_0x07b7('0x34')](_0x5ba7e2['query'][_0x07b7('0x34')]));_0x5c6e5a[_0x07b7('0x33')]=_0x5c6e5a['attributes']['length']?_0x5c6e5a[_0x07b7('0x33')]:_0x12620c[_0x07b7('0x32')];if(!_0x5ba7e2[_0x07b7('0x2f')][_0x07b7('0x35')]('nolimit')){_0x5c6e5a['limit']=qs[_0x07b7('0x36')](_0x5ba7e2[_0x07b7('0x2f')][_0x07b7('0x36')]);_0x5c6e5a[_0x07b7('0x1e')]=qs[_0x07b7('0x1e')](_0x5ba7e2[_0x07b7('0x2f')]['offset']);}_0x5c6e5a[_0x07b7('0x37')]=qs[_0x07b7('0x38')](_0x5ba7e2[_0x07b7('0x2f')][_0x07b7('0x38')]);_0x5c6e5a[_0x07b7('0x39')]=qs[_0x07b7('0x3a')](_[_0x07b7('0x3b')](_0x5ba7e2[_0x07b7('0x2f')],_0x12620c['filters']));if(_0x5ba7e2[_0x07b7('0x2f')]['filter']){_0x5c6e5a[_0x07b7('0x39')]=_[_0x07b7('0x3c')](_0x5c6e5a[_0x07b7('0x39')],{'$or':_[_0x07b7('0x2b')](_0x2a2f97,function(_0x362fc2){if(_0x362fc2[_0x07b7('0x3d')]!==_0x07b7('0x3e')){var _0x29ca2b={};_0x29ca2b[_0x362fc2[_0x07b7('0x28')]]={'$like':'%'+_0x5ba7e2[_0x07b7('0x2f')]['filter']+'%'};return _0x29ca2b;}})});}_0x5c6e5a=_[_0x07b7('0x3c')]({},_0x5c6e5a,_0x5ba7e2[_0x07b7('0x3f')]);var _0xe203a6={'where':_0x5c6e5a[_0x07b7('0x39')]};return db[_0x07b7('0x2c')][_0x07b7('0x1d')](_0xe203a6)[_0x07b7('0x24')](function(_0x58cd62){_0x7596a9['count']=_0x58cd62;if(_0x5ba7e2['query'][_0x07b7('0x40')]){_0x5c6e5a[_0x07b7('0x41')]=[{'all':!![]}];}return db[_0x07b7('0x2c')][_0x07b7('0x42')](_0x5c6e5a);})[_0x07b7('0x24')](function(_0x4a6fa7){_0x7596a9[_0x07b7('0x43')]=_0x4a6fa7;return _0x7596a9;})[_0x07b7('0x24')](respondWithFilteredResult(_0x755d7f,_0x5c6e5a))[_0x07b7('0x44')](handleError(_0x755d7f,null));};exports[_0x07b7('0x45')]=function(_0xb4c5f0,_0x1443da){var _0x480609={'raw':!![],'where':{'id':_0xb4c5f0[_0x07b7('0x46')]['id']}},_0x41cd77={};_0x41cd77[_0x07b7('0x32')]=_[_0x07b7('0x30')](db[_0x07b7('0x2c')][_0x07b7('0x2d')]);_0x41cd77[_0x07b7('0x2f')]=_[_0x07b7('0x30')](_0xb4c5f0['query']);_0x41cd77['filters']=_['intersection'](_0x41cd77[_0x07b7('0x32')],_0x41cd77[_0x07b7('0x2f')]);_0x480609['attributes']=_['intersection'](_0x41cd77[_0x07b7('0x32')],qs[_0x07b7('0x34')](_0xb4c5f0[_0x07b7('0x2f')][_0x07b7('0x34')]));_0x480609['attributes']=_0x480609[_0x07b7('0x33')][_0x07b7('0x47')]?_0x480609[_0x07b7('0x33')]:_0x41cd77['model'];if(_0xb4c5f0[_0x07b7('0x2f')][_0x07b7('0x40')]){_0x480609[_0x07b7('0x41')]=[{'all':!![]}];}_0x480609=_[_0x07b7('0x3c')]({},_0x480609,_0xb4c5f0['options']);return db['FreshdeskField'][_0x07b7('0x48')](_0x480609)[_0x07b7('0x24')](handleEntityNotFound(_0x1443da,null))['then'](respondWithResult(_0x1443da,null))[_0x07b7('0x44')](handleError(_0x1443da,null));};exports[_0x07b7('0x49')]=function(_0x32955e,_0x54be3d){return db['FreshdeskField']['create'](_0x32955e[_0x07b7('0x4a')],{})['then'](respondWithResult(_0x54be3d,0xc9))[_0x07b7('0x44')](handleError(_0x54be3d,null));};exports[_0x07b7('0x23')]=function(_0x3eadf8,_0x1f6c2c){if(_0x3eadf8['body']['id']){delete _0x3eadf8[_0x07b7('0x4a')]['id'];}return db[_0x07b7('0x2c')]['find']({'where':{'id':_0x3eadf8[_0x07b7('0x46')]['id']}})[_0x07b7('0x24')](handleEntityNotFound(_0x1f6c2c,null))[_0x07b7('0x24')](saveUpdates(_0x3eadf8[_0x07b7('0x4a')],null))[_0x07b7('0x24')](respondWithResult(_0x1f6c2c,null))[_0x07b7('0x44')](handleError(_0x1f6c2c,null));};exports[_0x07b7('0x25')]=function(_0x2624b9,_0x4ea984){return db['FreshdeskField'][_0x07b7('0x48')]({'where':{'id':_0x2624b9['params']['id']}})[_0x07b7('0x24')](handleEntityNotFound(_0x4ea984,null))[_0x07b7('0x24')](removeEntity(_0x4ea984,null))[_0x07b7('0x44')](handleError(_0x4ea984,null));}; \ No newline at end of file +var _0xdd29=['reject','save','update','then','destroy','error','name','index','map','FreshdeskField','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','length','includeAll','find','create','body','html-pdf','rimraf','request-promise','moment','mustache','util','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','apply'];(function(_0x153faa,_0x75f2a){var _0x43c32a=function(_0x1c5721){while(--_0x1c5721){_0x153faa['push'](_0x153faa['shift']());}};_0x43c32a(++_0x75f2a);}(_0xdd29,0x192));var _0x9dd2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdd29[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x9dd2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9dd2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x9dd2('0x2'));var moment=require(_0x9dd2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9dd2('0x4'));var util=require(_0x9dd2('0x5'));var path=require('path');var sox=require(_0x9dd2('0x6'));var csv=require(_0x9dd2('0x7'));var ejs=require(_0x9dd2('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9dd2('0x9'));var crypto=require(_0x9dd2('0xa'));var jsforce=require(_0x9dd2('0xb'));var deskjs=require(_0x9dd2('0xc'));var toCsv=require(_0x9dd2('0x7'));var querystring=require(_0x9dd2('0xd'));var Papa=require(_0x9dd2('0xe'));var Redis=require(_0x9dd2('0xf'));var authService=require(_0x9dd2('0x10'));var qs=require(_0x9dd2('0x11'));var as=require(_0x9dd2('0x12'));var hardwareService=require(_0x9dd2('0x13'));var logger=require(_0x9dd2('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x9dd2('0x15'));var db=require(_0x9dd2('0x16'))['db'];function respondWithStatusCode(_0x1dbf5a,_0x1c57f3){_0x1c57f3=_0x1c57f3||0xcc;return function(_0x4b78b8){if(_0x4b78b8){return _0x1dbf5a[_0x9dd2('0x17')](_0x1c57f3);}return _0x1dbf5a[_0x9dd2('0x18')](_0x1c57f3)[_0x9dd2('0x19')]();};}function respondWithResult(_0x384ed9,_0x270b42){_0x270b42=_0x270b42||0xc8;return function(_0x3b469d){if(_0x3b469d){return _0x384ed9[_0x9dd2('0x18')](_0x270b42)[_0x9dd2('0x1a')](_0x3b469d);}};}function respondWithFilteredResult(_0x453bdc,_0x3249ec){return function(_0x598380){if(_0x598380){var _0x3b6f0c=_0x598380[_0x9dd2('0x1b')],_0x4799a0=_0x3249ec[_0x9dd2('0x1c')],_0x43196e=_0x3249ec[_0x9dd2('0x1c')]+_0x3249ec['limit'],_0x1fefee;if(_0x43196e>=_0x3b6f0c){_0x43196e=_0x3b6f0c;_0x1fefee=0xc8;}else{_0x1fefee=0xce;}_0x453bdc[_0x9dd2('0x18')](_0x1fefee);return _0x453bdc['set']('Content-Range',_0x4799a0+'-'+_0x43196e+'/'+_0x3b6f0c)[_0x9dd2('0x1a')](_0x598380);}return null;};}function patchUpdates(_0x4f2f97){return function(_0x4ad2aa){try{jsonpatch[_0x9dd2('0x1d')](_0x4ad2aa,_0x4f2f97,!![]);}catch(_0x381f3c){return BPromise[_0x9dd2('0x1e')](_0x381f3c);}return _0x4ad2aa[_0x9dd2('0x1f')]();};}function saveUpdates(_0x220da7,_0xa91ec3){return function(_0x56aa61){if(_0x56aa61){return _0x56aa61[_0x9dd2('0x20')](_0x220da7)[_0x9dd2('0x21')](function(_0x35f90a){return _0x35f90a;});}return null;};}function removeEntity(_0x205bd1,_0x485bf6){return function(_0x571831){if(_0x571831){return _0x571831[_0x9dd2('0x22')]()[_0x9dd2('0x21')](function(){_0x205bd1[_0x9dd2('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x347834,_0xe571f6){return function(_0x39efab){if(!_0x39efab){_0x347834['sendStatus'](0x194);}return _0x39efab;};}function handleError(_0x2fbfe1,_0x146fb2){_0x146fb2=_0x146fb2||0x1f4;return function(_0x109010){logger[_0x9dd2('0x23')](_0x109010['stack']);if(_0x109010['name']){delete _0x109010[_0x9dd2('0x24')];}_0x2fbfe1[_0x9dd2('0x18')](_0x146fb2)['send'](_0x109010);};}exports[_0x9dd2('0x25')]=function(_0x1b2586,_0x2091c8){var _0x3cbc67={},_0x164fe8={},_0x1832d4={'count':0x0,'rows':[]};var _0x410e24=_[_0x9dd2('0x26')](db[_0x9dd2('0x27')][_0x9dd2('0x28')],function(_0x25f983){return{'name':_0x25f983[_0x9dd2('0x29')],'type':_0x25f983['type']['key']};});_0x164fe8[_0x9dd2('0x2a')]=_[_0x9dd2('0x26')](_0x410e24,'name');_0x164fe8[_0x9dd2('0x2b')]=_[_0x9dd2('0x2c')](_0x1b2586[_0x9dd2('0x2b')]);_0x164fe8[_0x9dd2('0x2d')]=_['intersection'](_0x164fe8[_0x9dd2('0x2a')],_0x164fe8[_0x9dd2('0x2b')]);_0x3cbc67[_0x9dd2('0x2e')]=_[_0x9dd2('0x2f')](_0x164fe8[_0x9dd2('0x2a')],qs[_0x9dd2('0x30')](_0x1b2586[_0x9dd2('0x2b')][_0x9dd2('0x30')]));_0x3cbc67[_0x9dd2('0x2e')]=_0x3cbc67[_0x9dd2('0x2e')]['length']?_0x3cbc67[_0x9dd2('0x2e')]:_0x164fe8[_0x9dd2('0x2a')];if(!_0x1b2586['query'][_0x9dd2('0x31')](_0x9dd2('0x32'))){_0x3cbc67[_0x9dd2('0x33')]=qs['limit'](_0x1b2586['query'][_0x9dd2('0x33')]);_0x3cbc67[_0x9dd2('0x1c')]=qs[_0x9dd2('0x1c')](_0x1b2586[_0x9dd2('0x2b')][_0x9dd2('0x1c')]);}_0x3cbc67[_0x9dd2('0x34')]=qs[_0x9dd2('0x35')](_0x1b2586['query'][_0x9dd2('0x35')]);_0x3cbc67[_0x9dd2('0x36')]=qs[_0x9dd2('0x2d')](_[_0x9dd2('0x37')](_0x1b2586[_0x9dd2('0x2b')],_0x164fe8[_0x9dd2('0x2d')]));if(_0x1b2586[_0x9dd2('0x2b')][_0x9dd2('0x38')]){_0x3cbc67[_0x9dd2('0x36')]=_[_0x9dd2('0x39')](_0x3cbc67[_0x9dd2('0x36')],{'$or':_[_0x9dd2('0x26')](_0x410e24,function(_0x2a07da){if(_0x2a07da[_0x9dd2('0x3a')]!==_0x9dd2('0x3b')){var _0x3b9555={};_0x3b9555[_0x2a07da[_0x9dd2('0x24')]]={'$like':'%'+_0x1b2586[_0x9dd2('0x2b')]['filter']+'%'};return _0x3b9555;}})});}_0x3cbc67=_['merge']({},_0x3cbc67,_0x1b2586[_0x9dd2('0x3c')]);var _0x2f829e={'where':_0x3cbc67['where']};return db[_0x9dd2('0x27')]['count'](_0x2f829e)[_0x9dd2('0x21')](function(_0x3a0dc5){_0x1832d4[_0x9dd2('0x1b')]=_0x3a0dc5;if(_0x1b2586[_0x9dd2('0x2b')]['includeAll']){_0x3cbc67[_0x9dd2('0x3d')]=[{'all':!![]}];}return db[_0x9dd2('0x27')][_0x9dd2('0x3e')](_0x3cbc67);})['then'](function(_0x14faac){_0x1832d4[_0x9dd2('0x3f')]=_0x14faac;return _0x1832d4;})[_0x9dd2('0x21')](respondWithFilteredResult(_0x2091c8,_0x3cbc67))[_0x9dd2('0x40')](handleError(_0x2091c8,null));};exports[_0x9dd2('0x41')]=function(_0x286bad,_0x4f1af5){var _0x2f5136={'raw':!![],'where':{'id':_0x286bad[_0x9dd2('0x42')]['id']}},_0x1aa617={};_0x1aa617['model']=_[_0x9dd2('0x2c')](db['FreshdeskField'][_0x9dd2('0x28')]);_0x1aa617[_0x9dd2('0x2b')]=_[_0x9dd2('0x2c')](_0x286bad['query']);_0x1aa617[_0x9dd2('0x2d')]=_[_0x9dd2('0x2f')](_0x1aa617[_0x9dd2('0x2a')],_0x1aa617[_0x9dd2('0x2b')]);_0x2f5136['attributes']=_[_0x9dd2('0x2f')](_0x1aa617['model'],qs[_0x9dd2('0x30')](_0x286bad[_0x9dd2('0x2b')][_0x9dd2('0x30')]));_0x2f5136['attributes']=_0x2f5136[_0x9dd2('0x2e')][_0x9dd2('0x43')]?_0x2f5136[_0x9dd2('0x2e')]:_0x1aa617[_0x9dd2('0x2a')];if(_0x286bad[_0x9dd2('0x2b')][_0x9dd2('0x44')]){_0x2f5136['include']=[{'all':!![]}];}_0x2f5136=_['merge']({},_0x2f5136,_0x286bad[_0x9dd2('0x3c')]);return db[_0x9dd2('0x27')][_0x9dd2('0x45')](_0x2f5136)[_0x9dd2('0x21')](handleEntityNotFound(_0x4f1af5,null))['then'](respondWithResult(_0x4f1af5,null))[_0x9dd2('0x40')](handleError(_0x4f1af5,null));};exports[_0x9dd2('0x46')]=function(_0x2a255c,_0x307184){return db['FreshdeskField'][_0x9dd2('0x46')](_0x2a255c[_0x9dd2('0x47')],{})[_0x9dd2('0x21')](respondWithResult(_0x307184,0xc9))[_0x9dd2('0x40')](handleError(_0x307184,null));};exports[_0x9dd2('0x20')]=function(_0xd3fbc,_0x346616){if(_0xd3fbc[_0x9dd2('0x47')]['id']){delete _0xd3fbc[_0x9dd2('0x47')]['id'];}return db['FreshdeskField']['find']({'where':{'id':_0xd3fbc[_0x9dd2('0x42')]['id']}})['then'](handleEntityNotFound(_0x346616,null))[_0x9dd2('0x21')](saveUpdates(_0xd3fbc['body'],null))[_0x9dd2('0x21')](respondWithResult(_0x346616,null))['catch'](handleError(_0x346616,null));};exports['destroy']=function(_0x19086e,_0x4f1e0f){return db['FreshdeskField'][_0x9dd2('0x45')]({'where':{'id':_0x19086e[_0x9dd2('0x42')]['id']}})[_0x9dd2('0x21')](handleEntityNotFound(_0x4f1e0f,null))[_0x9dd2('0x21')](removeEntity(_0x4f1e0f,null))[_0x9dd2('0x40')](handleError(_0x4f1e0f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 21c526e..1e4ec1e 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 _0xe4b3=['util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','freshdesk_unique_index','idField','lodash'];(function(_0x16d7fb,_0x4b9dc3){var _0x404e18=function(_0x1f0bbf){while(--_0x1f0bbf){_0x16d7fb['push'](_0x16d7fb['shift']());}};_0x404e18(++_0x4b9dc3);}(_0xe4b3,0xb3));var _0x3e4b=function(_0x287a95,_0x1aa354){_0x287a95=_0x287a95-0x0;var _0x2c61b7=_0xe4b3[_0x287a95];return _0x2c61b7;};'use strict';var _=require(_0x3e4b('0x0'));var util=require(_0x3e4b('0x1'));var logger=require(_0x3e4b('0x2'))(_0x3e4b('0x3'));var moment=require('moment');var BPromise=require(_0x3e4b('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3e4b('0x5'));var rimraf=require(_0x3e4b('0x6'));var config=require(_0x3e4b('0x7'));var attributes=require(_0x3e4b('0x8'));module[_0x3e4b('0x9')]=function(_0x130519,_0xdc901f){return _0x130519['define']('FreshdeskField',attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x3e4b('0xa'),'fields':[_0x3e4b('0xb'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb1e3=['exports','define','FreshdeskField','freshdesk_unique_index','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes'];(function(_0x5e9b23,_0x3069fd){var _0x27501f=function(_0x37667c){while(--_0x37667c){_0x5e9b23['push'](_0x5e9b23['shift']());}};_0x27501f(++_0x3069fd);}(_0xb1e3,0xb5));var _0x3b1e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1e3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3b1e('0x0'));var util=require(_0x3b1e('0x1'));var logger=require(_0x3b1e('0x2'))(_0x3b1e('0x3'));var moment=require(_0x3b1e('0x4'));var BPromise=require(_0x3b1e('0x5'));var rp=require(_0x3b1e('0x6'));var fs=require('fs');var path=require(_0x3b1e('0x7'));var rimraf=require(_0x3b1e('0x8'));var config=require(_0x3b1e('0x9'));var attributes=require(_0x3b1e('0xa'));module[_0x3b1e('0xb')]=function(_0x1d26a3,_0x5bd08c){return _0x1d26a3[_0x3b1e('0xc')](_0x3b1e('0xd'),attributes,{'tableName':'int_freshdesk_fields','paranoid':![],'indexes':[{'name':_0x3b1e('0xe'),'fields':['idField',_0x3b1e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.rpc.js b/server/api/intFreshdeskField/intFreshdeskField.rpc.js index b0de6bd..3814127 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(_0x28ceff,_0xc9b4a4){var _0x251ee2=function(_0x3ec3b8){while(--_0x3ec3b8){_0x28ceff['push'](_0x28ceff['shift']());}};_0x251ee2(++_0xc9b4a4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5b5cde,_0x1f7c5f){_0x5b5cde=_0x5b5cde-0x0;var _0x364ad2=_0xb10b[_0x5b5cde];return _0x364ad2;};'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(_0x455033,_0x5d8727){var _0x406304=function(_0x2189b0){while(--_0x2189b0){_0x455033['push'](_0x455033['shift']());}};_0x406304(++_0x5d8727);}(_0xb10b,0x12a));var _0xbb10=function(_0x7f9224,_0x186851){_0x7f9224=_0x7f9224-0x0;var _0x3bc305=_0xb10b[_0x7f9224];return _0x3bc305;};'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 4eef286..29b4902 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 _0x8400=['path','connect-timeout','Router','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','getConfigurations','/:id/fields','post','create','/:id/configurations','addConfiguration','put','delete','destroy','exports','multer','util'];(function(_0x47cfe9,_0x465805){var _0x1dae57=function(_0x18bc76){while(--_0x18bc76){_0x47cfe9['push'](_0x47cfe9['shift']());}};_0x1dae57(++_0x465805);}(_0x8400,0x15e));var _0x0840=function(_0x1272f2,_0x5f1282){_0x1272f2=_0x1272f2-0x0;var _0x4e07a4=_0x8400[_0x1272f2];return _0x4e07a4;};'use strict';var multer=require(_0x0840('0x0'));var util=require(_0x0840('0x1'));var path=require(_0x0840('0x2'));var timeout=require(_0x0840('0x3'));var express=require('express');var router=express[_0x0840('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x0840('0x5'));var config=require(_0x0840('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x0840('0x7')](),controller[_0x0840('0x8')]);router[_0x0840('0x9')](_0x0840('0xa'),auth[_0x0840('0x7')](),controller[_0x0840('0xb')]);router[_0x0840('0x9')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0840('0xc')]);router['get'](_0x0840('0xd'),auth[_0x0840('0x7')](),controller['getFields']);router[_0x0840('0xe')]('/',auth[_0x0840('0x7')](),controller[_0x0840('0xf')]);router[_0x0840('0xe')](_0x0840('0x10'),auth[_0x0840('0x7')](),controller[_0x0840('0x11')]);router[_0x0840('0x12')](_0x0840('0xa'),auth[_0x0840('0x7')](),controller['update']);router[_0x0840('0x13')]('/:id',auth[_0x0840('0x7')](),controller[_0x0840('0x14')]);module[_0x0840('0x15')]=router; \ No newline at end of file +var _0x5694=['../../components/auth/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','getFields','post','create','addConfiguration','put','update','delete','destroy','multer','util','connect-timeout','express','Router'];(function(_0x1bd51b,_0x23c389){var _0x3fccf7=function(_0x1e8ec9){while(--_0x1e8ec9){_0x1bd51b['push'](_0x1bd51b['shift']());}};_0x3fccf7(++_0x23c389);}(_0x5694,0x95));var _0x4569=function(_0xcb75d0,_0x35afb7){_0xcb75d0=_0xcb75d0-0x0;var _0x522cbf=_0x5694[_0xcb75d0];return _0x522cbf;};'use strict';var multer=require(_0x4569('0x0'));var util=require(_0x4569('0x1'));var path=require('path');var timeout=require(_0x4569('0x2'));var express=require(_0x4569('0x3'));var router=express[_0x4569('0x4')]();var auth=require(_0x4569('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4569('0x6'));var controller=require('./intFreshsalesAccount.controller');router['get']('/',auth[_0x4569('0x7')](),controller[_0x4569('0x8')]);router[_0x4569('0x9')](_0x4569('0xa'),auth[_0x4569('0x7')](),controller[_0x4569('0xb')]);router[_0x4569('0x9')](_0x4569('0xc'),auth[_0x4569('0x7')](),controller[_0x4569('0xd')]);router[_0x4569('0x9')]('/:id/fields',auth[_0x4569('0x7')](),controller[_0x4569('0xe')]);router[_0x4569('0xf')]('/',auth['isAuthenticated'](),controller[_0x4569('0x10')]);router[_0x4569('0xf')](_0x4569('0xc'),auth[_0x4569('0x7')](),controller[_0x4569('0x11')]);router[_0x4569('0x12')]('/:id',auth[_0x4569('0x7')](),controller[_0x4569('0x13')]);router[_0x4569('0x14')](_0x4569('0xa'),auth['isAuthenticated'](),controller[_0x4569('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index ba50074..8ff19ba 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 _0x147b=['exports','STRING','remoteUri','sequelize'];(function(_0x1c546c,_0x5c57cb){var _0x2cc384=function(_0x4dee11){while(--_0x4dee11){_0x1c546c['push'](_0x1c546c['shift']());}};_0x2cc384(++_0x5c57cb);}(_0x147b,0x193));var _0xb147=function(_0x448733,_0x5638fa){_0x448733=_0x448733-0x0;var _0x8b38c8=_0x147b[_0x448733];return _0x8b38c8;};'use strict';var Sequelize=require(_0xb147('0x0'));module[_0xb147('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb147('0x2')]},'username':{'type':Sequelize[_0xb147('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0xb147('0x2')]},'remoteUri':{'type':Sequelize[_0xb147('0x2')],'unique':_0xb147('0x3')},'serverUrl':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3746=['username','sequelize','exports','STRING'];(function(_0x396f22,_0x4d87a8){var _0x7aeaa6=function(_0x430844){while(--_0x430844){_0x396f22['push'](_0x396f22['shift']());}};_0x7aeaa6(++_0x4d87a8);}(_0x3746,0xa9));var _0x6374=function(_0x5064f4,_0x4e9545){_0x5064f4=_0x5064f4-0x0;var _0x4260cd=_0x3746[_0x5064f4];return _0x4260cd;};'use strict';var Sequelize=require(_0x6374('0x0'));module[_0x6374('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6374('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0x6374('0x3')},'apiKey':{'type':Sequelize[_0x6374('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x6374('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index b037f36..a1afb39 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 _0x0b08=['hasOwnProperty','nolimit','sort','where','pick','filters','merge','filter','options','includeAll','findAll','rows','show','params','rawAttributes','intersection','find','create','body','catch','FreshsalesConfiguration','order','getConfigurations','addConfiguration','AccountId','Subjects','channel','Descriptions','getDescriptions','FreshsalesField','getFields','findOne','username','apiKey','remoteUri','substring','lastIndexOf','GET','/api/selector/owners','Token\x20token=','email','Requested\x20Resource\x20not\x20Found','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','html-pdf','eml-format','fast-json-patch','request-promise','mustache','path','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','then','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','sendStatus','status','json','count','offset','limit','Content-Range','reject','save','update','destroy','send','index','map','FreshsalesAccount','fieldName','type','key','model','name','query','keys','fields','attributes','length'];(function(_0x594413,_0x437c52){var _0xb7ae32=function(_0x3189e6){while(--_0x3189e6){_0x594413['push'](_0x594413['shift']());}};_0xb7ae32(++_0x437c52);}(_0x0b08,0x108));var _0x80b0=function(_0x2976de,_0x4c546d){_0x2976de=_0x2976de-0x0;var _0xecbf51=_0x0b08[_0x2976de];return _0xecbf51;};'use strict';var pdf=require(_0x80b0('0x0'));var emlformat=require(_0x80b0('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x80b0('0x2'));var rp=require(_0x80b0('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x80b0('0x4'));var util=require('util');var path=require(_0x80b0('0x5'));var sox=require(_0x80b0('0x6'));var csv=require('to-csv');var ejs=require(_0x80b0('0x7'));var fs=require('fs');var _=require(_0x80b0('0x8'));var squel=require(_0x80b0('0x9'));var crypto=require(_0x80b0('0xa'));var jsforce=require(_0x80b0('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x80b0('0xc'));var querystring=require(_0x80b0('0xd'));var Papa=require(_0x80b0('0xe'));var Redis=require('ioredis');var authService=require(_0x80b0('0xf'));var qs=require(_0x80b0('0x10'));var as=require(_0x80b0('0x11'));var hardwareService=require(_0x80b0('0x12'));var logger=require(_0x80b0('0x13'))(_0x80b0('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x80b0('0x15'))['db'];var integrations=require(_0x80b0('0x16'));var jayson=require(_0x80b0('0x17'));var client=jayson[_0x80b0('0x18')][_0x80b0('0x19')]({'port':0x232a});function checkPasswordPattern(_0x53b096,_0x1cf524,_0x10ec91){if(_0x10ec91){var _0x3e2b94=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3e2b94[_0x80b0('0x1a')](_0x1cf524)){return _0x53b096;}else{throw new db[(_0x80b0('0x1b'))][(_0x80b0('0x1c'))](_0x80b0('0x1d'));}}else{return _0x53b096;}}function respondWithRpcPromise(_0xfa137b,_0x146c73,_0x593bf6,_0x2b05ad){return new BPromise(function(_0x4cf603,_0x15ebe6){var _0x4abe8e=_0x2b05ad||client;return _0x4abe8e['request'](_0xfa137b,_0x593bf6)[_0x80b0('0x1e')](function(_0x9f9b43){logger[_0x80b0('0x1f')](_0x80b0('0x20'),_0x146c73,_0x80b0('0x21'));logger[_0x80b0('0x22')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x146c73,'request\x20sent',JSON['stringify'](_0x9f9b43));if(_0x9f9b43[_0x80b0('0x23')]){if(_0x9f9b43[_0x80b0('0x23')]['code']===0x1f4){logger[_0x80b0('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x146c73,_0x9f9b43[_0x80b0('0x23')][_0x80b0('0x24')]);return _0x15ebe6(_0x9f9b43['error'][_0x80b0('0x24')]);}logger[_0x80b0('0x23')]('FreshsalesAccount,\x20%s,\x20%s',_0x146c73,_0x9f9b43[_0x80b0('0x23')][_0x80b0('0x24')]);return _0x4cf603(_0x9f9b43['error'][_0x80b0('0x24')]);}else{logger[_0x80b0('0x1f')](_0x80b0('0x20'),_0x146c73,'request\x20sent');_0x4cf603(_0x9f9b43[_0x80b0('0x25')][_0x80b0('0x24')]);}})['catch'](function(_0x409efc){logger['error'](_0x80b0('0x20'),_0x146c73,_0x409efc);_0x15ebe6(_0x409efc);});});}function respondWithStatusCode(_0x256858,_0x1c59e8){_0x1c59e8=_0x1c59e8||0xcc;return function(_0x281515){if(_0x281515){return _0x256858[_0x80b0('0x26')](_0x1c59e8);}return _0x256858[_0x80b0('0x27')](_0x1c59e8)['end']();};}function respondWithResult(_0x8cca01,_0x119cfa){_0x119cfa=_0x119cfa||0xc8;return function(_0x1f9ae2){if(_0x1f9ae2){return _0x8cca01[_0x80b0('0x27')](_0x119cfa)[_0x80b0('0x28')](_0x1f9ae2);}};}function respondWithFilteredResult(_0x2cfd5c,_0x56678d){return function(_0x28feb1){if(_0x28feb1){var _0x30bb8e=_0x28feb1[_0x80b0('0x29')],_0x59a2ed=_0x56678d[_0x80b0('0x2a')],_0x401b59=_0x56678d[_0x80b0('0x2a')]+_0x56678d[_0x80b0('0x2b')],_0x253fc8;if(_0x401b59>=_0x30bb8e){_0x401b59=_0x30bb8e;_0x253fc8=0xc8;}else{_0x253fc8=0xce;}_0x2cfd5c['status'](_0x253fc8);return _0x2cfd5c['set'](_0x80b0('0x2c'),_0x59a2ed+'-'+_0x401b59+'/'+_0x30bb8e)['json'](_0x28feb1);}return null;};}function patchUpdates(_0x2ab5b6){return function(_0x3a0e85){try{jsonpatch['apply'](_0x3a0e85,_0x2ab5b6,!![]);}catch(_0x3d7cc6){return BPromise[_0x80b0('0x2d')](_0x3d7cc6);}return _0x3a0e85[_0x80b0('0x2e')]();};}function saveUpdates(_0x11c030,_0x1de6a3){return function(_0x169d1c){if(_0x169d1c){return _0x169d1c[_0x80b0('0x2f')](_0x11c030)[_0x80b0('0x1e')](function(_0x691e81){return _0x691e81;});}return null;};}function removeEntity(_0x13d174,_0xd94ef7){return function(_0x4357de){if(_0x4357de){return _0x4357de[_0x80b0('0x30')]()[_0x80b0('0x1e')](function(){_0x13d174['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x47c5bb,_0x6a9167){return function(_0xd79281){if(!_0xd79281){_0x47c5bb[_0x80b0('0x26')](0x194);}return _0xd79281;};}function handleError(_0x1c7dcf,_0x50ddf9){_0x50ddf9=_0x50ddf9||0x1f4;return function(_0x3323b2){logger[_0x80b0('0x23')](_0x3323b2['stack']);if(_0x3323b2['name']){delete _0x3323b2['name'];}_0x1c7dcf[_0x80b0('0x27')](_0x50ddf9)[_0x80b0('0x31')](_0x3323b2);};}exports[_0x80b0('0x32')]=function(_0x12c8bd,_0x2b763d){var _0x5babbf={},_0x2cf8e4={},_0x4dab62={'count':0x0,'rows':[]};var _0x1df924=_[_0x80b0('0x33')](db[_0x80b0('0x34')]['rawAttributes'],function(_0x1a5db2){return{'name':_0x1a5db2[_0x80b0('0x35')],'type':_0x1a5db2[_0x80b0('0x36')][_0x80b0('0x37')]};});_0x2cf8e4[_0x80b0('0x38')]=_[_0x80b0('0x33')](_0x1df924,_0x80b0('0x39'));_0x2cf8e4[_0x80b0('0x3a')]=_[_0x80b0('0x3b')](_0x12c8bd[_0x80b0('0x3a')]);_0x2cf8e4['filters']=_['intersection'](_0x2cf8e4[_0x80b0('0x38')],_0x2cf8e4['query']);_0x5babbf['attributes']=_['intersection'](_0x2cf8e4['model'],qs[_0x80b0('0x3c')](_0x12c8bd[_0x80b0('0x3a')][_0x80b0('0x3c')]));_0x5babbf[_0x80b0('0x3d')]=_0x5babbf[_0x80b0('0x3d')][_0x80b0('0x3e')]?_0x5babbf[_0x80b0('0x3d')]:_0x2cf8e4[_0x80b0('0x38')];if(!_0x12c8bd[_0x80b0('0x3a')][_0x80b0('0x3f')](_0x80b0('0x40'))){_0x5babbf[_0x80b0('0x2b')]=qs['limit'](_0x12c8bd[_0x80b0('0x3a')]['limit']);_0x5babbf[_0x80b0('0x2a')]=qs[_0x80b0('0x2a')](_0x12c8bd['query'][_0x80b0('0x2a')]);}_0x5babbf['order']=qs[_0x80b0('0x41')](_0x12c8bd[_0x80b0('0x3a')]['sort']);_0x5babbf[_0x80b0('0x42')]=qs['filters'](_[_0x80b0('0x43')](_0x12c8bd[_0x80b0('0x3a')],_0x2cf8e4[_0x80b0('0x44')]));if(_0x12c8bd['query']['filter']){_0x5babbf['where']=_[_0x80b0('0x45')](_0x5babbf[_0x80b0('0x42')],{'$or':_[_0x80b0('0x33')](_0x1df924,function(_0x1c41a9){if(_0x1c41a9[_0x80b0('0x36')]!=='VIRTUAL'){var _0x19ae3b={};_0x19ae3b[_0x1c41a9[_0x80b0('0x39')]]={'$like':'%'+_0x12c8bd['query'][_0x80b0('0x46')]+'%'};return _0x19ae3b;}})});}_0x5babbf=_[_0x80b0('0x45')]({},_0x5babbf,_0x12c8bd[_0x80b0('0x47')]);var _0x18ffc2={'where':_0x5babbf['where']};return db[_0x80b0('0x34')][_0x80b0('0x29')](_0x18ffc2)[_0x80b0('0x1e')](function(_0x286d78){_0x4dab62[_0x80b0('0x29')]=_0x286d78;if(_0x12c8bd[_0x80b0('0x3a')][_0x80b0('0x48')]){_0x5babbf['include']=[{'all':!![]}];}return db['FreshsalesAccount'][_0x80b0('0x49')](_0x5babbf);})[_0x80b0('0x1e')](function(_0x2ba0a1){_0x4dab62[_0x80b0('0x4a')]=_0x2ba0a1;return _0x4dab62;})[_0x80b0('0x1e')](respondWithFilteredResult(_0x2b763d,_0x5babbf))['catch'](handleError(_0x2b763d,null));};exports[_0x80b0('0x4b')]=function(_0x2cc587,_0x511265){var _0x3a6ab1={'raw':![],'where':{'id':_0x2cc587[_0x80b0('0x4c')]['id']}},_0x51de6c={};_0x51de6c[_0x80b0('0x38')]=_[_0x80b0('0x3b')](db[_0x80b0('0x34')][_0x80b0('0x4d')]);_0x51de6c['query']=_[_0x80b0('0x3b')](_0x2cc587[_0x80b0('0x3a')]);_0x51de6c['filters']=_[_0x80b0('0x4e')](_0x51de6c[_0x80b0('0x38')],_0x51de6c[_0x80b0('0x3a')]);_0x3a6ab1[_0x80b0('0x3d')]=_[_0x80b0('0x4e')](_0x51de6c[_0x80b0('0x38')],qs[_0x80b0('0x3c')](_0x2cc587[_0x80b0('0x3a')]['fields']));_0x3a6ab1['attributes']=_0x3a6ab1[_0x80b0('0x3d')]['length']?_0x3a6ab1[_0x80b0('0x3d')]:_0x51de6c[_0x80b0('0x38')];if(_0x2cc587['query'][_0x80b0('0x48')]){_0x3a6ab1['include']=[{'all':!![]}];}_0x3a6ab1=_[_0x80b0('0x45')]({},_0x3a6ab1,_0x2cc587[_0x80b0('0x47')]);return db[_0x80b0('0x34')][_0x80b0('0x4f')](_0x3a6ab1)['then'](handleEntityNotFound(_0x511265,null))[_0x80b0('0x1e')](respondWithResult(_0x511265,null))['catch'](handleError(_0x511265,null));};exports[_0x80b0('0x50')]=function(_0x3daf15,_0x4646c4){return db[_0x80b0('0x34')][_0x80b0('0x50')](_0x3daf15[_0x80b0('0x51')],{})[_0x80b0('0x1e')](respondWithResult(_0x4646c4,0xc9))['catch'](handleError(_0x4646c4,null));};exports[_0x80b0('0x2f')]=function(_0x26fef7,_0x50a0c1){if(_0x26fef7[_0x80b0('0x51')]['id']){delete _0x26fef7[_0x80b0('0x51')]['id'];}return db[_0x80b0('0x34')]['find']({'where':{'id':_0x26fef7[_0x80b0('0x4c')]['id']}})[_0x80b0('0x1e')](handleEntityNotFound(_0x50a0c1,null))[_0x80b0('0x1e')](saveUpdates(_0x26fef7[_0x80b0('0x51')],null))[_0x80b0('0x1e')](respondWithResult(_0x50a0c1,null))['catch'](handleError(_0x50a0c1,null));};exports[_0x80b0('0x30')]=function(_0x23a52a,_0x307b9d){return db[_0x80b0('0x34')]['find']({'where':{'id':_0x23a52a[_0x80b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x307b9d,null))['then'](removeEntity(_0x307b9d,null))[_0x80b0('0x52')](handleError(_0x307b9d,null));};exports['getConfigurations']=function(_0x3419ae,_0x38f7c3,_0x57739e){var _0x4029fa={};var _0x193a9a={};var _0x65d1e6;var _0x5bf239;return db[_0x80b0('0x34')]['findOne']({'where':{'id':_0x3419ae[_0x80b0('0x4c')]['id']}})['then'](handleEntityNotFound(_0x38f7c3,null))[_0x80b0('0x1e')](function(_0x164859){if(_0x164859){_0x65d1e6=_0x164859;_0x193a9a['model']=_[_0x80b0('0x3b')](db[_0x80b0('0x53')][_0x80b0('0x4d')]);_0x193a9a[_0x80b0('0x3a')]=_[_0x80b0('0x3b')](_0x3419ae['query']);_0x193a9a[_0x80b0('0x44')]=_[_0x80b0('0x4e')](_0x193a9a[_0x80b0('0x38')],_0x193a9a[_0x80b0('0x3a')]);_0x4029fa[_0x80b0('0x3d')]=_[_0x80b0('0x4e')](_0x193a9a[_0x80b0('0x38')],qs[_0x80b0('0x3c')](_0x3419ae[_0x80b0('0x3a')][_0x80b0('0x3c')]));_0x4029fa[_0x80b0('0x3d')]=_0x4029fa[_0x80b0('0x3d')]['length']?_0x4029fa[_0x80b0('0x3d')]:_0x193a9a[_0x80b0('0x38')];_0x4029fa[_0x80b0('0x54')]=qs['sort'](_0x3419ae['query']['sort']);_0x4029fa[_0x80b0('0x42')]=qs[_0x80b0('0x44')](_[_0x80b0('0x43')](_0x3419ae[_0x80b0('0x3a')],_0x193a9a[_0x80b0('0x44')]));if(_0x3419ae[_0x80b0('0x3a')][_0x80b0('0x46')]){_0x4029fa['where']=_[_0x80b0('0x45')](_0x4029fa[_0x80b0('0x42')],{'$or':_[_0x80b0('0x33')](_0x4029fa['attributes'],function(_0x5a30c2){var _0x5ef95f={};_0x5ef95f[_0x5a30c2]={'$like':'%'+_0x3419ae['query']['filter']+'%'};return _0x5ef95f;})});}_0x4029fa=_[_0x80b0('0x45')]({},_0x4029fa,_0x3419ae[_0x80b0('0x47')]);return _0x65d1e6[_0x80b0('0x55')](_0x4029fa);}})[_0x80b0('0x1e')](function(_0x533709){if(_0x533709){_0x5bf239=_0x533709[_0x80b0('0x3e')];if(!_0x3419ae[_0x80b0('0x3a')][_0x80b0('0x3f')]('nolimit')){_0x4029fa[_0x80b0('0x2b')]=qs[_0x80b0('0x2b')](_0x3419ae[_0x80b0('0x3a')]['limit']);_0x4029fa[_0x80b0('0x2a')]=qs[_0x80b0('0x2a')](_0x3419ae[_0x80b0('0x3a')][_0x80b0('0x2a')]);}return _0x65d1e6[_0x80b0('0x55')](_0x4029fa);}})[_0x80b0('0x1e')](function(_0x204c01){if(_0x204c01){return _0x204c01?{'count':_0x5bf239,'rows':_0x204c01}:null;}})[_0x80b0('0x1e')](respondWithResult(_0x38f7c3,null))['catch'](handleError(_0x38f7c3,null));};exports[_0x80b0('0x56')]=function(_0x2d3441,_0x2509e2,_0x2565c0){if(_0x2d3441[_0x80b0('0x51')]['id']){delete _0x2d3441[_0x80b0('0x51')]['id'];}return db[_0x80b0('0x34')]['findOne']({'where':{'id':_0x2d3441['params']['id']}})[_0x80b0('0x1e')](handleEntityNotFound(_0x2509e2,null))['then'](function(_0x1353fd){if(_0x1353fd){_0x2d3441[_0x80b0('0x51')][_0x80b0('0x57')]=_0x1353fd['id'];_0x2d3441['body'][_0x80b0('0x58')]=integrations['getSubjects'](_0x2d3441['body'][_0x80b0('0x59')],_0x2d3441[_0x80b0('0x51')][_0x80b0('0x36')]);_0x2d3441[_0x80b0('0x51')][_0x80b0('0x5a')]=integrations[_0x80b0('0x5b')](_0x2d3441['body'][_0x80b0('0x59')],_0x2d3441[_0x80b0('0x51')]['type']);return db[_0x80b0('0x53')]['create'](_0x2d3441[_0x80b0('0x51')],{'include':[{'model':db[_0x80b0('0x5c')],'as':'Subjects'},{'model':db[_0x80b0('0x5c')],'as':_0x80b0('0x5a')}]});}return null;})['then'](respondWithResult(_0x2509e2,null))[_0x80b0('0x52')](handleError(_0x2509e2,null));};exports[_0x80b0('0x5d')]=function(_0x35432b,_0x5bd0bd,_0xfaa876){var _0x36ded1='';var _0x1a6585='';return db['FreshsalesAccount'][_0x80b0('0x5e')]({'where':{'id':_0x35432b['params']['id']},'attributes':['id',_0x80b0('0x5f'),'remoteUri',_0x80b0('0x60')]})[_0x80b0('0x1e')](handleEntityNotFound(_0x5bd0bd,null))['then'](function(_0xfe17aa){if(_0xfe17aa){_0x1a6585=_0xfe17aa[_0x80b0('0x5f')];_0x36ded1=_0xfe17aa[_0x80b0('0x61')];var _0x23809e=_0xfe17aa[_0x80b0('0x61')]['slice'](-0x1);if(_0x23809e==='/'){_0x36ded1=_0x36ded1[_0x80b0('0x62')](0x0,_0x36ded1[_0x80b0('0x63')](_0x23809e));}return rp({'method':_0x80b0('0x64'),'uri':util['format']('%s%s',_0x36ded1,_0x80b0('0x65')),'headers':{'Authorization':_0x80b0('0x66')+_0xfe17aa[_0x80b0('0x60')]},'json':!![]});}})['then'](function(_0x4e0387){if(_0x4e0387){var _0x29b4ed=_0x4e0387['users'];var _0x4ab002=![];var _0xf9a4c3=null;for(_0xf9a4c3=0x0;_0xf9a4c3<_0x29b4ed[_0x80b0('0x3e')];_0xf9a4c3++){if(_0x29b4ed[_0xf9a4c3][_0x80b0('0x67')]===_0x1a6585){_0x4ab002=!![];}}if(_0x4ab002){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x80b0('0x68')});}}})[_0x80b0('0x1e')](respondWithResult(_0x5bd0bd,null))[_0x80b0('0x52')](function(_0x46b535){var _0x1b8526=_0x35432b[_0x80b0('0x3a')][_0x80b0('0x1a')]?0x1f4:_0x46b535['statusCode']||0x1f4;logger[_0x80b0('0x23')](_0x80b0('0x69'),_0x80b0('0x5d'),_0x1b8526,JSON[_0x80b0('0x6a')](_0x46b535));delete _0x46b535[_0x80b0('0x39')];if(_0x1b8526===0x191){_0x1b8526=0x190;}_0x5bd0bd[_0x80b0('0x27')](_0x1b8526)[_0x80b0('0x31')](_0x35432b[_0x80b0('0x3a')][_0x80b0('0x1a')]?{'message':_0x80b0('0x6b'),'statusCode':_0x46b535[_0x80b0('0x6c')]}:_0x46b535);});}; \ No newline at end of file +var _0x94a1=['params','pick','getConfigurations','nolimit','AccountId','getSubjects','Descriptions','getDescriptions','FreshsalesConfiguration','Subjects','getFields','findOne','username','remoteUri','apiKey','substring','lastIndexOf','GET','format','%s%s','Token\x20token=','users','email','test','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../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','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','end','count','offset','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','map','rawAttributes','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filter','merge','where','type','VIRTUAL','options','FreshsalesAccount','includeAll','include','show','find','create','body'];(function(_0x5caf7e,_0x52e1bc){var _0x5c3435=function(_0xb77e11){while(--_0xb77e11){_0x5caf7e['push'](_0x5caf7e['shift']());}};_0x5c3435(++_0x52e1bc);}(_0x94a1,0x8b));var _0x194a=function(_0x1f71d2,_0x5e4cff){_0x1f71d2=_0x1f71d2-0x0;var _0x389d01=_0x94a1[_0x1f71d2];return _0x389d01;};'use strict';var pdf=require(_0x194a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x194a('0x1'));var zipdir=require(_0x194a('0x2'));var jsonpatch=require(_0x194a('0x3'));var rp=require(_0x194a('0x4'));var moment=require(_0x194a('0x5'));var BPromise=require(_0x194a('0x6'));var Mustache=require(_0x194a('0x7'));var util=require('util');var path=require('path');var sox=require(_0x194a('0x8'));var csv=require(_0x194a('0x9'));var ejs=require(_0x194a('0xa'));var fs=require('fs');var _=require(_0x194a('0xb'));var squel=require('squel');var crypto=require(_0x194a('0xc'));var jsforce=require(_0x194a('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x194a('0x9'));var querystring=require(_0x194a('0xe'));var Papa=require(_0x194a('0xf'));var Redis=require(_0x194a('0x10'));var authService=require(_0x194a('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x194a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x194a('0x13'))(_0x194a('0x14'));var utils=require(_0x194a('0x15'));var config=require(_0x194a('0x16'));var db=require(_0x194a('0x17'))['db'];var integrations=require(_0x194a('0x18'));var jayson=require(_0x194a('0x19'));var client=jayson[_0x194a('0x1a')][_0x194a('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x13121f,_0x136917,_0x5d3540){if(_0x5d3540){var _0x1554ab=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1554ab['test'](_0x136917)){return _0x13121f;}else{throw new db[(_0x194a('0x1c'))]['ValidationError'](_0x194a('0x1d'));}}else{return _0x13121f;}}function respondWithRpcPromise(_0xe395bb,_0x287c87,_0x10b1de,_0x250b8d){return new BPromise(function(_0x682ad0,_0x1f80af){var _0x364292=_0x250b8d||client;return _0x364292[_0x194a('0x1e')](_0xe395bb,_0x10b1de)[_0x194a('0x1f')](function(_0x3278e4){logger[_0x194a('0x20')](_0x194a('0x21'),_0x287c87,_0x194a('0x22'));logger[_0x194a('0x23')](_0x194a('0x24'),_0x287c87,'request\x20sent',JSON[_0x194a('0x25')](_0x3278e4));if(_0x3278e4[_0x194a('0x26')]){if(_0x3278e4['error'][_0x194a('0x27')]===0x1f4){logger[_0x194a('0x26')](_0x194a('0x21'),_0x287c87,_0x3278e4['error']['message']);return _0x1f80af(_0x3278e4[_0x194a('0x26')][_0x194a('0x28')]);}logger['error'](_0x194a('0x21'),_0x287c87,_0x3278e4[_0x194a('0x26')]['message']);return _0x682ad0(_0x3278e4['error'][_0x194a('0x28')]);}else{logger[_0x194a('0x20')](_0x194a('0x21'),_0x287c87,_0x194a('0x22'));_0x682ad0(_0x3278e4['result'][_0x194a('0x28')]);}})[_0x194a('0x29')](function(_0x5e2442){logger[_0x194a('0x26')](_0x194a('0x21'),_0x287c87,_0x5e2442);_0x1f80af(_0x5e2442);});});}function respondWithStatusCode(_0xd02a70,_0xbc0d7b){_0xbc0d7b=_0xbc0d7b||0xcc;return function(_0xc24dd4){if(_0xc24dd4){return _0xd02a70['sendStatus'](_0xbc0d7b);}return _0xd02a70[_0x194a('0x2a')](_0xbc0d7b)[_0x194a('0x2b')]();};}function respondWithResult(_0x31f3af,_0x4fbaec){_0x4fbaec=_0x4fbaec||0xc8;return function(_0x3a09dc){if(_0x3a09dc){return _0x31f3af['status'](_0x4fbaec)['json'](_0x3a09dc);}};}function respondWithFilteredResult(_0x6c029f,_0xa59bcc){return function(_0x263e9f){if(_0x263e9f){var _0x1279ef=_0x263e9f[_0x194a('0x2c')],_0x40a5ab=_0xa59bcc[_0x194a('0x2d')],_0x526897=_0xa59bcc[_0x194a('0x2d')]+_0xa59bcc['limit'],_0x197d8b;if(_0x526897>=_0x1279ef){_0x526897=_0x1279ef;_0x197d8b=0xc8;}else{_0x197d8b=0xce;}_0x6c029f[_0x194a('0x2a')](_0x197d8b);return _0x6c029f[_0x194a('0x2e')](_0x194a('0x2f'),_0x40a5ab+'-'+_0x526897+'/'+_0x1279ef)['json'](_0x263e9f);}return null;};}function patchUpdates(_0x8035c9){return function(_0x5e7f37){try{jsonpatch[_0x194a('0x30')](_0x5e7f37,_0x8035c9,!![]);}catch(_0x3fe597){return BPromise[_0x194a('0x31')](_0x3fe597);}return _0x5e7f37[_0x194a('0x32')]();};}function saveUpdates(_0x9a513d,_0xf42872){return function(_0xaba330){if(_0xaba330){return _0xaba330[_0x194a('0x33')](_0x9a513d)[_0x194a('0x1f')](function(_0x408aa4){return _0x408aa4;});}return null;};}function removeEntity(_0x227e14,_0x5ef8e5){return function(_0x42e649){if(_0x42e649){return _0x42e649[_0x194a('0x34')]()['then'](function(){_0x227e14[_0x194a('0x2a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35858c,_0x15bb03){return function(_0x379b0e){if(!_0x379b0e){_0x35858c[_0x194a('0x35')](0x194);}return _0x379b0e;};}function handleError(_0x3734d0,_0x40e73c){_0x40e73c=_0x40e73c||0x1f4;return function(_0x468781){logger[_0x194a('0x26')](_0x468781[_0x194a('0x36')]);if(_0x468781[_0x194a('0x37')]){delete _0x468781[_0x194a('0x37')];}_0x3734d0[_0x194a('0x2a')](_0x40e73c)[_0x194a('0x38')](_0x468781);};}exports['index']=function(_0x26f42d,_0x24186f){var _0x4748e9={},_0x5bbdce={},_0x3795bc={'count':0x0,'rows':[]};var _0x5a6acc=_[_0x194a('0x39')](db['FreshsalesAccount'][_0x194a('0x3a')],function(_0x22b8a2){return{'name':_0x22b8a2['fieldName'],'type':_0x22b8a2['type'][_0x194a('0x3b')]};});_0x5bbdce[_0x194a('0x3c')]=_['map'](_0x5a6acc,_0x194a('0x37'));_0x5bbdce['query']=_[_0x194a('0x3d')](_0x26f42d[_0x194a('0x3e')]);_0x5bbdce[_0x194a('0x3f')]=_['intersection'](_0x5bbdce['model'],_0x5bbdce[_0x194a('0x3e')]);_0x4748e9[_0x194a('0x40')]=_[_0x194a('0x41')](_0x5bbdce[_0x194a('0x3c')],qs[_0x194a('0x42')](_0x26f42d[_0x194a('0x3e')][_0x194a('0x42')]));_0x4748e9['attributes']=_0x4748e9[_0x194a('0x40')][_0x194a('0x43')]?_0x4748e9[_0x194a('0x40')]:_0x5bbdce['model'];if(!_0x26f42d[_0x194a('0x3e')][_0x194a('0x44')]('nolimit')){_0x4748e9[_0x194a('0x45')]=qs[_0x194a('0x45')](_0x26f42d[_0x194a('0x3e')]['limit']);_0x4748e9['offset']=qs[_0x194a('0x2d')](_0x26f42d[_0x194a('0x3e')]['offset']);}_0x4748e9[_0x194a('0x46')]=qs[_0x194a('0x47')](_0x26f42d['query']['sort']);_0x4748e9['where']=qs[_0x194a('0x3f')](_['pick'](_0x26f42d[_0x194a('0x3e')],_0x5bbdce[_0x194a('0x3f')]));if(_0x26f42d['query'][_0x194a('0x48')]){_0x4748e9['where']=_[_0x194a('0x49')](_0x4748e9[_0x194a('0x4a')],{'$or':_[_0x194a('0x39')](_0x5a6acc,function(_0x40690c){if(_0x40690c[_0x194a('0x4b')]!==_0x194a('0x4c')){var _0x3d1149={};_0x3d1149[_0x40690c['name']]={'$like':'%'+_0x26f42d['query'][_0x194a('0x48')]+'%'};return _0x3d1149;}})});}_0x4748e9=_[_0x194a('0x49')]({},_0x4748e9,_0x26f42d[_0x194a('0x4d')]);var _0x11b22c={'where':_0x4748e9[_0x194a('0x4a')]};return db[_0x194a('0x4e')][_0x194a('0x2c')](_0x11b22c)['then'](function(_0x5c120f){_0x3795bc[_0x194a('0x2c')]=_0x5c120f;if(_0x26f42d[_0x194a('0x3e')][_0x194a('0x4f')]){_0x4748e9[_0x194a('0x50')]=[{'all':!![]}];}return db[_0x194a('0x4e')]['findAll'](_0x4748e9);})[_0x194a('0x1f')](function(_0x287e11){_0x3795bc['rows']=_0x287e11;return _0x3795bc;})['then'](respondWithFilteredResult(_0x24186f,_0x4748e9))[_0x194a('0x29')](handleError(_0x24186f,null));};exports[_0x194a('0x51')]=function(_0x10182a,_0x573a92){var _0x275fac={'raw':![],'where':{'id':_0x10182a['params']['id']}},_0x53ecb2={};_0x53ecb2[_0x194a('0x3c')]=_['keys'](db[_0x194a('0x4e')][_0x194a('0x3a')]);_0x53ecb2[_0x194a('0x3e')]=_[_0x194a('0x3d')](_0x10182a[_0x194a('0x3e')]);_0x53ecb2[_0x194a('0x3f')]=_[_0x194a('0x41')](_0x53ecb2[_0x194a('0x3c')],_0x53ecb2[_0x194a('0x3e')]);_0x275fac[_0x194a('0x40')]=_['intersection'](_0x53ecb2['model'],qs[_0x194a('0x42')](_0x10182a[_0x194a('0x3e')][_0x194a('0x42')]));_0x275fac[_0x194a('0x40')]=_0x275fac['attributes'][_0x194a('0x43')]?_0x275fac[_0x194a('0x40')]:_0x53ecb2['model'];if(_0x10182a[_0x194a('0x3e')]['includeAll']){_0x275fac['include']=[{'all':!![]}];}_0x275fac=_[_0x194a('0x49')]({},_0x275fac,_0x10182a[_0x194a('0x4d')]);return db['FreshsalesAccount'][_0x194a('0x52')](_0x275fac)[_0x194a('0x1f')](handleEntityNotFound(_0x573a92,null))[_0x194a('0x1f')](respondWithResult(_0x573a92,null))[_0x194a('0x29')](handleError(_0x573a92,null));};exports['create']=function(_0x19143c,_0x486c96){return db[_0x194a('0x4e')][_0x194a('0x53')](_0x19143c['body'],{})[_0x194a('0x1f')](respondWithResult(_0x486c96,0xc9))['catch'](handleError(_0x486c96,null));};exports['update']=function(_0x2eb332,_0xab76f){if(_0x2eb332[_0x194a('0x54')]['id']){delete _0x2eb332[_0x194a('0x54')]['id'];}return db[_0x194a('0x4e')][_0x194a('0x52')]({'where':{'id':_0x2eb332[_0x194a('0x55')]['id']}})[_0x194a('0x1f')](handleEntityNotFound(_0xab76f,null))['then'](saveUpdates(_0x2eb332['body'],null))[_0x194a('0x1f')](respondWithResult(_0xab76f,null))['catch'](handleError(_0xab76f,null));};exports['destroy']=function(_0x47d12b,_0x25a23a){return db[_0x194a('0x4e')]['find']({'where':{'id':_0x47d12b[_0x194a('0x55')]['id']}})[_0x194a('0x1f')](handleEntityNotFound(_0x25a23a,null))[_0x194a('0x1f')](removeEntity(_0x25a23a,null))[_0x194a('0x29')](handleError(_0x25a23a,null));};exports['getConfigurations']=function(_0x478196,_0x5976c0,_0x3e5587){var _0x40fc0b={};var _0x514c18={};var _0x362f81;var _0x1192b3;return db[_0x194a('0x4e')]['findOne']({'where':{'id':_0x478196[_0x194a('0x55')]['id']}})[_0x194a('0x1f')](handleEntityNotFound(_0x5976c0,null))[_0x194a('0x1f')](function(_0x21fba0){if(_0x21fba0){_0x362f81=_0x21fba0;_0x514c18['model']=_['keys'](db['FreshsalesConfiguration'][_0x194a('0x3a')]);_0x514c18[_0x194a('0x3e')]=_[_0x194a('0x3d')](_0x478196[_0x194a('0x3e')]);_0x514c18[_0x194a('0x3f')]=_[_0x194a('0x41')](_0x514c18[_0x194a('0x3c')],_0x514c18['query']);_0x40fc0b[_0x194a('0x40')]=_[_0x194a('0x41')](_0x514c18['model'],qs[_0x194a('0x42')](_0x478196[_0x194a('0x3e')][_0x194a('0x42')]));_0x40fc0b['attributes']=_0x40fc0b['attributes'][_0x194a('0x43')]?_0x40fc0b[_0x194a('0x40')]:_0x514c18[_0x194a('0x3c')];_0x40fc0b[_0x194a('0x46')]=qs[_0x194a('0x47')](_0x478196['query']['sort']);_0x40fc0b[_0x194a('0x4a')]=qs['filters'](_[_0x194a('0x56')](_0x478196[_0x194a('0x3e')],_0x514c18['filters']));if(_0x478196[_0x194a('0x3e')][_0x194a('0x48')]){_0x40fc0b['where']=_[_0x194a('0x49')](_0x40fc0b['where'],{'$or':_['map'](_0x40fc0b['attributes'],function(_0x45664a){var _0x4caa8f={};_0x4caa8f[_0x45664a]={'$like':'%'+_0x478196['query']['filter']+'%'};return _0x4caa8f;})});}_0x40fc0b=_[_0x194a('0x49')]({},_0x40fc0b,_0x478196[_0x194a('0x4d')]);return _0x362f81[_0x194a('0x57')](_0x40fc0b);}})[_0x194a('0x1f')](function(_0x540059){if(_0x540059){_0x1192b3=_0x540059[_0x194a('0x43')];if(!_0x478196['query']['hasOwnProperty'](_0x194a('0x58'))){_0x40fc0b[_0x194a('0x45')]=qs[_0x194a('0x45')](_0x478196['query']['limit']);_0x40fc0b[_0x194a('0x2d')]=qs[_0x194a('0x2d')](_0x478196['query'][_0x194a('0x2d')]);}return _0x362f81[_0x194a('0x57')](_0x40fc0b);}})[_0x194a('0x1f')](function(_0x3872c1){if(_0x3872c1){return _0x3872c1?{'count':_0x1192b3,'rows':_0x3872c1}:null;}})['then'](respondWithResult(_0x5976c0,null))[_0x194a('0x29')](handleError(_0x5976c0,null));};exports['addConfiguration']=function(_0x47e613,_0x98806f,_0x4202be){if(_0x47e613['body']['id']){delete _0x47e613[_0x194a('0x54')]['id'];}return db[_0x194a('0x4e')]['findOne']({'where':{'id':_0x47e613[_0x194a('0x55')]['id']}})[_0x194a('0x1f')](handleEntityNotFound(_0x98806f,null))[_0x194a('0x1f')](function(_0x5ad57f){if(_0x5ad57f){_0x47e613['body'][_0x194a('0x59')]=_0x5ad57f['id'];_0x47e613[_0x194a('0x54')]['Subjects']=integrations[_0x194a('0x5a')](_0x47e613[_0x194a('0x54')]['channel'],_0x47e613[_0x194a('0x54')][_0x194a('0x4b')]);_0x47e613[_0x194a('0x54')][_0x194a('0x5b')]=integrations[_0x194a('0x5c')](_0x47e613[_0x194a('0x54')]['channel'],_0x47e613[_0x194a('0x54')][_0x194a('0x4b')]);return db[_0x194a('0x5d')]['create'](_0x47e613[_0x194a('0x54')],{'include':[{'model':db['FreshsalesField'],'as':_0x194a('0x5e')},{'model':db['FreshsalesField'],'as':_0x194a('0x5b')}]});}return null;})[_0x194a('0x1f')](respondWithResult(_0x98806f,null))[_0x194a('0x29')](handleError(_0x98806f,null));};exports[_0x194a('0x5f')]=function(_0x31d18d,_0x2f0e65,_0x53b2c3){var _0x221aa7='';var _0x41568a='';return db[_0x194a('0x4e')][_0x194a('0x60')]({'where':{'id':_0x31d18d[_0x194a('0x55')]['id']},'attributes':['id',_0x194a('0x61'),_0x194a('0x62'),_0x194a('0x63')]})[_0x194a('0x1f')](handleEntityNotFound(_0x2f0e65,null))['then'](function(_0x326e03){if(_0x326e03){_0x41568a=_0x326e03[_0x194a('0x61')];_0x221aa7=_0x326e03[_0x194a('0x62')];var _0x1694ea=_0x326e03[_0x194a('0x62')]['slice'](-0x1);if(_0x1694ea==='/'){_0x221aa7=_0x221aa7[_0x194a('0x64')](0x0,_0x221aa7[_0x194a('0x65')](_0x1694ea));}return rp({'method':_0x194a('0x66'),'uri':util[_0x194a('0x67')](_0x194a('0x68'),_0x221aa7,'/api/selector/owners'),'headers':{'Authorization':_0x194a('0x69')+_0x326e03['apiKey']},'json':!![]});}})[_0x194a('0x1f')](function(_0x5d9007){if(_0x5d9007){var _0x151d08=_0x5d9007[_0x194a('0x6a')];var _0x26cdab=![];var _0x1ff78b=null;for(_0x1ff78b=0x0;_0x1ff78b<_0x151d08['length'];_0x1ff78b++){if(_0x151d08[_0x1ff78b][_0x194a('0x6b')]===_0x41568a){_0x26cdab=!![];}}if(_0x26cdab){return!![];}else{throw new Error({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}})[_0x194a('0x1f')](respondWithResult(_0x2f0e65,null))[_0x194a('0x29')](function(_0x1d47fd){var _0x598107=_0x31d18d[_0x194a('0x3e')][_0x194a('0x6c')]?0x1f4:_0x1d47fd['statusCode']||0x1f4;logger[_0x194a('0x26')](_0x194a('0x6d'),_0x194a('0x5f'),_0x598107,JSON[_0x194a('0x25')](_0x1d47fd));delete _0x1d47fd[_0x194a('0x37')];if(_0x598107===0x191){_0x598107=0x190;}_0x2f0e65[_0x194a('0x2a')](_0x598107)[_0x194a('0x38')](_0x31d18d[_0x194a('0x3e')][_0x194a('0x6c')]?{'message':_0x194a('0x6e'),'statusCode':_0x1d47fd[_0x194a('0x6f')]}:_0x1d47fd);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 2920393..81d8311 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 _0x0a4d=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x368fb9,_0x1a9895){var _0x4892fb=function(_0x28d735){while(--_0x28d735){_0x368fb9['push'](_0x368fb9['shift']());}};_0x4892fb(++_0x1a9895);}(_0x0a4d,0xad));var _0xd0a4=function(_0x41d5f1,_0x297f25){_0x41d5f1=_0x41d5f1-0x0;var _0x57ab91=_0x0a4d[_0x41d5f1];return _0x57ab91;};'use strict';var _=require('lodash');var util=require(_0xd0a4('0x0'));var logger=require(_0xd0a4('0x1'))(_0xd0a4('0x2'));var moment=require(_0xd0a4('0x3'));var BPromise=require('bluebird');var rp=require(_0xd0a4('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0a4('0x5'));var config=require(_0xd0a4('0x6'));var attributes=require(_0xd0a4('0x7'));var integrations=require(_0xd0a4('0x8'));module[_0xd0a4('0x9')]=function(_0x257a92,_0x42e06b){return _0x257a92[_0xd0a4('0xa')](_0xd0a4('0xb'),attributes,{'tableName':_0xd0a4('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa144=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','FreshsalesAccount','lodash'];(function(_0x4fd360,_0x435775){var _0x5c93d7=function(_0x40870c){while(--_0x40870c){_0x4fd360['push'](_0x4fd360['shift']());}};_0x5c93d7(++_0x435775);}(_0xa144,0x11f));var _0x4a14=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa144[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0x4a14('0x0'));var util=require('util');var logger=require(_0x4a14('0x1'))(_0x4a14('0x2'));var moment=require(_0x4a14('0x3'));var BPromise=require(_0x4a14('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4a14('0x5'));var rimraf=require(_0x4a14('0x6'));var config=require(_0x4a14('0x7'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x4a14('0x8'));module[_0x4a14('0x9')]=function(_0x57518e,_0x3b7cdd){return _0x57518e[_0x4a14('0xa')](_0x4a14('0xb'),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 7eb9234..a4462c0 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 _0x556a=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include','map','model','then','catch','find','ShowFreshsalesAccount','lodash','util','moment','bluebird'];(function(_0x4513e8,_0x16f480){var _0x1e8758=function(_0x5c2038){while(--_0x5c2038){_0x4513e8['push'](_0x4513e8['shift']());}};_0x1e8758(++_0x16f480);}(_0x556a,0x1dd));var _0xa556=function(_0x34b727,_0xd967e1){_0x34b727=_0x34b727-0x0;var _0x27c307=_0x556a[_0x34b727];return _0x27c307;};'use strict';var _=require(_0xa556('0x0'));var util=require(_0xa556('0x1'));var moment=require(_0xa556('0x2'));var BPromise=require(_0xa556('0x3'));var rs=require(_0xa556('0x4'));var fs=require('fs');var Redis=require(_0xa556('0x5'));var db=require(_0xa556('0x6'))['db'];var utils=require(_0xa556('0x7'));var logger=require(_0xa556('0x8'))('rpc');var config=require(_0xa556('0x9'));var jayson=require(_0xa556('0xa'));var client=jayson[_0xa556('0xb')][_0xa556('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x358b8c,_0x5a745c,_0x2c9a0c){return new BPromise(function(_0x644538,_0x17c2c2){return client[_0xa556('0xd')](_0x358b8c,_0x2c9a0c)['then'](function(_0x44ea8e){logger[_0xa556('0xe')](_0xa556('0xf'),_0x5a745c,_0xa556('0x10'));logger[_0xa556('0x11')](_0xa556('0x12'),_0x5a745c,_0xa556('0x10'),JSON[_0xa556('0x13')](_0x44ea8e));if(_0x44ea8e['error']){if(_0x44ea8e[_0xa556('0x14')]['code']===0x1f4){logger[_0xa556('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x5a745c,_0x44ea8e['error'][_0xa556('0x15')]);return _0x17c2c2(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}logger[_0xa556('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x5a745c,_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);return _0x644538(_0x44ea8e[_0xa556('0x14')][_0xa556('0x15')]);}else{logger[_0xa556('0xe')]('FreshsalesAccount,\x20%s,\x20%s',_0x5a745c,'request\x20sent');_0x644538(_0x44ea8e[_0xa556('0x16')][_0xa556('0x15')]);}})['catch'](function(_0x3f8bd7){logger['error']('FreshsalesAccount,\x20%s,\x20%s',_0x5a745c,_0x3f8bd7);_0x17c2c2(_0x3f8bd7);});});}exports[_0xa556('0x17')]=function(_0x529879){var _0x429a55=this;return new Promise(function(_0x46b205,_0xd68e21){return db[_0xa556('0x18')]['findAll']({'raw':_0x529879[_0xa556('0x19')]?_0x529879[_0xa556('0x19')][_0xa556('0x1a')]===undefined?!![]:![]:!![],'where':_0x529879['options']?_0x529879[_0xa556('0x19')][_0xa556('0x1b')]||null:null,'attributes':_0x529879['options']?_0x529879['options'][_0xa556('0x1c')]||null:null,'limit':_0x529879[_0xa556('0x19')]?_0x529879['options'][_0xa556('0x1d')]||null:null,'include':_0x529879['options']?_0x529879[_0xa556('0x19')][_0xa556('0x1e')]?_[_0xa556('0x1f')](_0x529879[_0xa556('0x19')][_0xa556('0x1e')],function(_0xfb4dda){return{'model':db[_0xfb4dda[_0xa556('0x20')]],'as':_0xfb4dda['as'],'attributes':_0xfb4dda[_0xa556('0x1c')],'include':_0xfb4dda[_0xa556('0x1e')]?_[_0xa556('0x1f')](_0xfb4dda[_0xa556('0x1e')],function(_0xec6fbb){return{'model':db[_0xec6fbb['model']],'as':_0xec6fbb['as'],'attributes':_0xec6fbb[_0xa556('0x1c')],'include':_0xec6fbb[_0xa556('0x1e')]?_['map'](_0xec6fbb[_0xa556('0x1e')],function(_0x169d01){return{'model':db[_0x169d01['model']],'as':_0x169d01['as'],'attributes':_0x169d01[_0xa556('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa556('0x21')](function(_0x157ac5){logger['info'](_0xa556('0x17'),_0x529879);logger[_0xa556('0x11')](_0xa556('0x17'),_0x529879,JSON['stringify'](_0x157ac5));_0x46b205(_0x157ac5);})[_0xa556('0x22')](function(_0x1f5ce4){logger[_0xa556('0x14')](_0xa556('0x17'),_0x1f5ce4[_0xa556('0x15')],_0x529879);_0xd68e21(_0x429a55[_0xa556('0x14')](0x1f4,_0x1f5ce4[_0xa556('0x15')]));});});};exports['ShowFreshsalesAccount']=function(_0x3446f0){var _0x51cb84=this;return new Promise(function(_0x34f2cf,_0x356a0c){return db[_0xa556('0x18')][_0xa556('0x23')]({'raw':_0x3446f0[_0xa556('0x19')]?_0x3446f0[_0xa556('0x19')][_0xa556('0x1a')]===undefined?!![]:![]:!![],'where':_0x3446f0['options']?_0x3446f0[_0xa556('0x19')][_0xa556('0x1b')]||null:null,'attributes':_0x3446f0[_0xa556('0x19')]?_0x3446f0[_0xa556('0x19')][_0xa556('0x1c')]||null:null,'include':_0x3446f0[_0xa556('0x19')]?_0x3446f0[_0xa556('0x19')][_0xa556('0x1e')]?_[_0xa556('0x1f')](_0x3446f0['options'][_0xa556('0x1e')],function(_0x38fec7){return{'model':db[_0x38fec7[_0xa556('0x20')]],'as':_0x38fec7['as'],'attributes':_0x38fec7['attributes'],'include':_0x38fec7[_0xa556('0x1e')]?_[_0xa556('0x1f')](_0x38fec7[_0xa556('0x1e')],function(_0x2addf5){return{'model':db[_0x2addf5['model']],'as':_0x2addf5['as'],'attributes':_0x2addf5[_0xa556('0x1c')],'include':_0x2addf5['include']?_[_0xa556('0x1f')](_0x2addf5['include'],function(_0x201d0c){return{'model':db[_0x201d0c[_0xa556('0x20')]],'as':_0x201d0c['as'],'attributes':_0x201d0c[_0xa556('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa556('0x21')](function(_0x3f9d63){logger['info']('ShowFreshsalesAccount',_0x3446f0);logger[_0xa556('0x11')](_0xa556('0x24'),_0x3446f0,JSON[_0xa556('0x13')](_0x3f9d63));_0x34f2cf(_0x3f9d63);})[_0xa556('0x22')](function(_0x3c557d){logger[_0xa556('0x14')](_0xa556('0x24'),_0x3c557d[_0xa556('0x15')],_0x3446f0);_0x356a0c(_0x51cb84[_0xa556('0x14')](0x1f4,_0x3c557d[_0xa556('0x15')]));});});}; \ No newline at end of file +var _0xee9c=['info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','limit','include','map','attributes','model','ShowFreshsalesAccount','find','then','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','http','request'];(function(_0x39aef1,_0x3fc5d5){var _0x1478a0=function(_0x3f1be3){while(--_0x3f1be3){_0x39aef1['push'](_0x39aef1['shift']());}};_0x1478a0(++_0x3fc5d5);}(_0xee9c,0x1e6));var _0xcee9=function(_0x3e2fcf,_0x579110){_0x3e2fcf=_0x3e2fcf-0x0;var _0x497db7=_0xee9c[_0x3e2fcf];return _0x497db7;};'use strict';var _=require('lodash');var util=require(_0xcee9('0x0'));var moment=require(_0xcee9('0x1'));var BPromise=require(_0xcee9('0x2'));var rs=require(_0xcee9('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xcee9('0x4'));var logger=require(_0xcee9('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xcee9('0x6'));var client=jayson['client'][_0xcee9('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2bc2cb,_0x34819a,_0x58636f){return new BPromise(function(_0x4d1f9a,_0x2b14da){return client[_0xcee9('0x8')](_0x2bc2cb,_0x58636f)['then'](function(_0x7c80be){logger[_0xcee9('0x9')](_0xcee9('0xa'),_0x34819a,_0xcee9('0xb'));logger[_0xcee9('0xc')](_0xcee9('0xd'),_0x34819a,'request\x20sent',JSON[_0xcee9('0xe')](_0x7c80be));if(_0x7c80be[_0xcee9('0xf')]){if(_0x7c80be['error'][_0xcee9('0x10')]===0x1f4){logger[_0xcee9('0xf')](_0xcee9('0xa'),_0x34819a,_0x7c80be['error'][_0xcee9('0x11')]);return _0x2b14da(_0x7c80be[_0xcee9('0xf')][_0xcee9('0x11')]);}logger[_0xcee9('0xf')](_0xcee9('0xa'),_0x34819a,_0x7c80be['error']['message']);return _0x4d1f9a(_0x7c80be[_0xcee9('0xf')][_0xcee9('0x11')]);}else{logger[_0xcee9('0x9')](_0xcee9('0xa'),_0x34819a,_0xcee9('0xb'));_0x4d1f9a(_0x7c80be[_0xcee9('0x12')][_0xcee9('0x11')]);}})[_0xcee9('0x13')](function(_0x1adcc9){logger[_0xcee9('0xf')](_0xcee9('0xa'),_0x34819a,_0x1adcc9);_0x2b14da(_0x1adcc9);});});}exports[_0xcee9('0x14')]=function(_0x552ca1){var _0x10e6b5=this;return new Promise(function(_0x414032,_0x39f0dc){return db[_0xcee9('0x15')][_0xcee9('0x16')]({'raw':_0x552ca1['options']?_0x552ca1[_0xcee9('0x17')][_0xcee9('0x18')]===undefined?!![]:![]:!![],'where':_0x552ca1[_0xcee9('0x17')]?_0x552ca1[_0xcee9('0x17')]['where']||null:null,'attributes':_0x552ca1[_0xcee9('0x17')]?_0x552ca1[_0xcee9('0x17')]['attributes']||null:null,'limit':_0x552ca1['options']?_0x552ca1[_0xcee9('0x17')][_0xcee9('0x19')]||null:null,'include':_0x552ca1[_0xcee9('0x17')]?_0x552ca1['options'][_0xcee9('0x1a')]?_[_0xcee9('0x1b')](_0x552ca1[_0xcee9('0x17')]['include'],function(_0x2c219){return{'model':db[_0x2c219['model']],'as':_0x2c219['as'],'attributes':_0x2c219[_0xcee9('0x1c')],'include':_0x2c219[_0xcee9('0x1a')]?_[_0xcee9('0x1b')](_0x2c219[_0xcee9('0x1a')],function(_0xef4b0a){return{'model':db[_0xef4b0a[_0xcee9('0x1d')]],'as':_0xef4b0a['as'],'attributes':_0xef4b0a[_0xcee9('0x1c')],'include':_0xef4b0a[_0xcee9('0x1a')]?_[_0xcee9('0x1b')](_0xef4b0a[_0xcee9('0x1a')],function(_0x4cc9a1){return{'model':db[_0x4cc9a1['model']],'as':_0x4cc9a1['as'],'attributes':_0x4cc9a1[_0xcee9('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4593bc){logger[_0xcee9('0x9')](_0xcee9('0x14'),_0x552ca1);logger[_0xcee9('0xc')]('GetFreshsalesAccount',_0x552ca1,JSON[_0xcee9('0xe')](_0x4593bc));_0x414032(_0x4593bc);})[_0xcee9('0x13')](function(_0x3e88cd){logger['error'](_0xcee9('0x14'),_0x3e88cd[_0xcee9('0x11')],_0x552ca1);_0x39f0dc(_0x10e6b5[_0xcee9('0xf')](0x1f4,_0x3e88cd['message']));});});};exports[_0xcee9('0x1e')]=function(_0x6bfe80){var _0x423287=this;return new Promise(function(_0x2e44dc,_0x4de639){return db[_0xcee9('0x15')][_0xcee9('0x1f')]({'raw':_0x6bfe80['options']?_0x6bfe80[_0xcee9('0x17')][_0xcee9('0x18')]===undefined?!![]:![]:!![],'where':_0x6bfe80[_0xcee9('0x17')]?_0x6bfe80[_0xcee9('0x17')]['where']||null:null,'attributes':_0x6bfe80['options']?_0x6bfe80[_0xcee9('0x17')][_0xcee9('0x1c')]||null:null,'include':_0x6bfe80[_0xcee9('0x17')]?_0x6bfe80[_0xcee9('0x17')][_0xcee9('0x1a')]?_[_0xcee9('0x1b')](_0x6bfe80[_0xcee9('0x17')]['include'],function(_0x12169c){return{'model':db[_0x12169c[_0xcee9('0x1d')]],'as':_0x12169c['as'],'attributes':_0x12169c[_0xcee9('0x1c')],'include':_0x12169c['include']?_[_0xcee9('0x1b')](_0x12169c[_0xcee9('0x1a')],function(_0x944ea1){return{'model':db[_0x944ea1[_0xcee9('0x1d')]],'as':_0x944ea1['as'],'attributes':_0x944ea1[_0xcee9('0x1c')],'include':_0x944ea1['include']?_['map'](_0x944ea1[_0xcee9('0x1a')],function(_0x1a2af9){return{'model':db[_0x1a2af9[_0xcee9('0x1d')]],'as':_0x1a2af9['as'],'attributes':_0x1a2af9['attributes']};}):[]};}):[]};}):[]:[]})[_0xcee9('0x20')](function(_0x2f17c5){logger[_0xcee9('0x9')](_0xcee9('0x1e'),_0x6bfe80);logger[_0xcee9('0xc')](_0xcee9('0x1e'),_0x6bfe80,JSON['stringify'](_0x2f17c5));_0x2e44dc(_0x2f17c5);})[_0xcee9('0x13')](function(_0x6f2506){logger[_0xcee9('0xf')](_0xcee9('0x1e'),_0x6f2506['message'],_0x6bfe80);_0x4de639(_0x423287['error'](0x1f4,_0x6f2506[_0xcee9('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index d4f9107..4e2a925 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 _0x3812=['/:id/descriptions','getDescriptions','/:id/fields','getFields','post','delete','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intFreshsalesConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/subjects','getSubjects'];(function(_0x7af628,_0x3613ad){var _0x37606d=function(_0x651806){while(--_0x651806){_0x7af628['push'](_0x7af628['shift']());}};_0x37606d(++_0x3613ad);}(_0x3812,0x1c0));var _0x2381=function(_0x55372c,_0x4a7e98){_0x55372c=_0x55372c-0x0;var _0x2959b7=_0x3812[_0x55372c];return _0x2959b7;};'use strict';var multer=require(_0x2381('0x0'));var util=require(_0x2381('0x1'));var path=require('path');var timeout=require(_0x2381('0x2'));var express=require('express');var router=express[_0x2381('0x3')]();var auth=require(_0x2381('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2381('0x5'));var controller=require(_0x2381('0x6'));router[_0x2381('0x7')]('/',auth['isAuthenticated'](),controller[_0x2381('0x8')]);router[_0x2381('0x7')](_0x2381('0x9'),auth[_0x2381('0xa')](),controller[_0x2381('0xb')]);router[_0x2381('0x7')](_0x2381('0xc'),auth['isAuthenticated'](),controller[_0x2381('0xd')]);router['get'](_0x2381('0xe'),auth[_0x2381('0xa')](),controller[_0x2381('0xf')]);router['get'](_0x2381('0x10'),auth[_0x2381('0xa')](),controller[_0x2381('0x11')]);router[_0x2381('0x12')]('/',auth[_0x2381('0xa')](),controller['create']);router['put'](_0x2381('0x9'),auth[_0x2381('0xa')](),controller['update']);router[_0x2381('0x13')](_0x2381('0x9'),auth[_0x2381('0xa')](),controller['destroy']);module[_0x2381('0x14')]=router; \ No newline at end of file +var _0xa753=['getFields','put','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/subjects','getSubjects','/:id/fields'];(function(_0x53a167,_0x4bf6c7){var _0x150263=function(_0x422191){while(--_0x422191){_0x53a167['push'](_0x53a167['shift']());}};_0x150263(++_0x4bf6c7);}(_0xa753,0x17f));var _0x3a75=function(_0xa8a613,_0x3636aa){_0xa8a613=_0xa8a613-0x0;var _0x261a28=_0xa753[_0xa8a613];return _0x261a28;};'use strict';var multer=require(_0x3a75('0x0'));var util=require(_0x3a75('0x1'));var path=require(_0x3a75('0x2'));var timeout=require(_0x3a75('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x3a75('0x4'));var interaction=require(_0x3a75('0x5'));var config=require(_0x3a75('0x6'));var controller=require(_0x3a75('0x7'));router[_0x3a75('0x8')]('/',auth[_0x3a75('0x9')](),controller[_0x3a75('0xa')]);router[_0x3a75('0x8')](_0x3a75('0xb'),auth[_0x3a75('0x9')](),controller[_0x3a75('0xc')]);router[_0x3a75('0x8')](_0x3a75('0xd'),auth['isAuthenticated'](),controller[_0x3a75('0xe')]);router[_0x3a75('0x8')]('/:id/descriptions',auth[_0x3a75('0x9')](),controller['getDescriptions']);router[_0x3a75('0x8')](_0x3a75('0xf'),auth['isAuthenticated'](),controller[_0x3a75('0x10')]);router['post']('/',auth[_0x3a75('0x9')](),controller['create']);router[_0x3a75('0x11')](_0x3a75('0xb'),auth[_0x3a75('0x9')](),controller['update']);router['delete'](_0x3a75('0xb'),auth[_0x3a75('0x9')](),controller['destroy']);module[_0x3a75('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 11fbda6..80aa4dc 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 _0xa70c=['exports','STRING'];(function(_0x473c6f,_0x2d520a){var _0x54af12=function(_0xfa823){while(--_0xfa823){_0x473c6f['push'](_0x473c6f['shift']());}};_0x54af12(++_0x2d520a);}(_0xa70c,0x13a));var _0xca70=function(_0x52ea48,_0x14f622){_0x52ea48=_0x52ea48-0x0;var _0x1f8e44=_0xa70c[_0x52ea48];return _0x1f8e44;};'use strict';var Sequelize=require('sequelize');module[_0xca70('0x0')]={'name':{'type':Sequelize[_0xca70('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7ecd=['STRING','sequelize','exports'];(function(_0x111ad4,_0x388616){var _0x100369=function(_0x48ff5d){while(--_0x48ff5d){_0x111ad4['push'](_0x111ad4['shift']());}};_0x100369(++_0x388616);}(_0x7ecd,0xb2));var _0xd7ec=function(_0x3e8c58,_0x36ce72){_0x3e8c58=_0x3e8c58-0x0;var _0xb13a98=_0x7ecd[_0x3e8c58];return _0xb13a98;};'use strict';var Sequelize=require(_0xd7ec('0x0'));module[_0xd7ec('0x1')]={'name':{'type':Sequelize[_0xd7ec('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index a7aecd3..82d670c 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 _0x2c8f=['map','FreshsalesConfiguration','fieldName','type','query','intersection','attributes','fields','length','model','order','sort','where','pick','filters','filter','merge','VIRTUAL','count','include','findAll','rows','show','rawAttributes','keys','includeAll','options','body','update','find','params','getSubjects','findOne','FreshsalesField','nolimit','getDescriptions','hasOwnProperty','getFields','eml-format','request-promise','moment','bluebird','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','api','../../config/utils','../../config/environment','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshsalesConfiguration,\x20%s,\x20%s','result','catch','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','destroy','stack','name'];(function(_0x39cf1c,_0x2a6723){var _0x167799=function(_0x5a24a2){while(--_0x5a24a2){_0x39cf1c['push'](_0x39cf1c['shift']());}};_0x167799(++_0x2a6723);}(_0x2c8f,0x192));var _0xf2c8=function(_0x46ecd2,_0x2d2984){_0x46ecd2=_0x46ecd2-0x0;var _0x36a0e8=_0x2c8f[_0x46ecd2];return _0x36a0e8;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf2c8('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xf2c8('0x1'));var moment=require(_0xf2c8('0x2'));var BPromise=require(_0xf2c8('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf2c8('0x4'));var sox=require(_0xf2c8('0x5'));var csv=require(_0xf2c8('0x6'));var ejs=require(_0xf2c8('0x7'));var fs=require('fs');var _=require(_0xf2c8('0x8'));var squel=require('squel');var crypto=require(_0xf2c8('0x9'));var jsforce=require(_0xf2c8('0xa'));var deskjs=require(_0xf2c8('0xb'));var toCsv=require(_0xf2c8('0x6'));var querystring=require(_0xf2c8('0xc'));var Papa=require(_0xf2c8('0xd'));var Redis=require('ioredis');var authService=require(_0xf2c8('0xe'));var qs=require(_0xf2c8('0xf'));var as=require(_0xf2c8('0x10'));var hardwareService=require(_0xf2c8('0x11'));var logger=require(_0xf2c8('0x12'))(_0xf2c8('0x13'));var utils=require(_0xf2c8('0x14'));var config=require(_0xf2c8('0x15'));var db=require('../../mysqldb')['db'];var jayson=require(_0xf2c8('0x16'));var client=jayson['client'][_0xf2c8('0x17')]({'port':0x232a});function checkPasswordPattern(_0x16b7a4,_0x2b6565,_0x46d0c6){if(_0x46d0c6){var _0x37db9b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x37db9b[_0xf2c8('0x18')](_0x2b6565)){return _0x16b7a4;}else{throw new db['Sequelize'][(_0xf2c8('0x19'))](_0xf2c8('0x1a'));}}else{return _0x16b7a4;}}function respondWithRpcPromise(_0x9152f1,_0x34f9b1,_0x3ed09e,_0x383af2){return new BPromise(function(_0x1b8c5b,_0x5f37ba){var _0x282094=_0x383af2||client;return _0x282094[_0xf2c8('0x1b')](_0x9152f1,_0x3ed09e)[_0xf2c8('0x1c')](function(_0x31b8e0){logger[_0xf2c8('0x1d')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34f9b1,'request\x20sent');logger[_0xf2c8('0x1e')](_0xf2c8('0x1f'),_0x34f9b1,_0xf2c8('0x20'),JSON[_0xf2c8('0x21')](_0x31b8e0));if(_0x31b8e0['error']){if(_0x31b8e0[_0xf2c8('0x22')][_0xf2c8('0x23')]===0x1f4){logger[_0xf2c8('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34f9b1,_0x31b8e0[_0xf2c8('0x22')][_0xf2c8('0x24')]);return _0x5f37ba(_0x31b8e0['error']['message']);}logger[_0xf2c8('0x22')](_0xf2c8('0x25'),_0x34f9b1,_0x31b8e0[_0xf2c8('0x22')]['message']);return _0x1b8c5b(_0x31b8e0[_0xf2c8('0x22')][_0xf2c8('0x24')]);}else{logger[_0xf2c8('0x1d')](_0xf2c8('0x25'),_0x34f9b1,'request\x20sent');_0x1b8c5b(_0x31b8e0[_0xf2c8('0x26')][_0xf2c8('0x24')]);}})[_0xf2c8('0x27')](function(_0x440b41){logger[_0xf2c8('0x22')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x34f9b1,_0x440b41);_0x5f37ba(_0x440b41);});});}function respondWithStatusCode(_0x93707c,_0x54bbcb){_0x54bbcb=_0x54bbcb||0xcc;return function(_0x3cd344){if(_0x3cd344){return _0x93707c[_0xf2c8('0x28')](_0x54bbcb);}return _0x93707c[_0xf2c8('0x29')](_0x54bbcb)[_0xf2c8('0x2a')]();};}function respondWithResult(_0x1d2e74,_0x3160a5){_0x3160a5=_0x3160a5||0xc8;return function(_0x3ffd20){if(_0x3ffd20){return _0x1d2e74[_0xf2c8('0x29')](_0x3160a5)[_0xf2c8('0x2b')](_0x3ffd20);}};}function respondWithFilteredResult(_0xcf5239,_0xf17065){return function(_0x20af1e){if(_0x20af1e){var _0x311349=_0x20af1e['count'],_0x4e12a2=_0xf17065[_0xf2c8('0x2c')],_0x1cb979=_0xf17065['offset']+_0xf17065[_0xf2c8('0x2d')],_0x5146e4;if(_0x1cb979>=_0x311349){_0x1cb979=_0x311349;_0x5146e4=0xc8;}else{_0x5146e4=0xce;}_0xcf5239[_0xf2c8('0x29')](_0x5146e4);return _0xcf5239[_0xf2c8('0x2e')](_0xf2c8('0x2f'),_0x4e12a2+'-'+_0x1cb979+'/'+_0x311349)[_0xf2c8('0x2b')](_0x20af1e);}return null;};}function patchUpdates(_0x12a547){return function(_0x27a7dc){try{jsonpatch['apply'](_0x27a7dc,_0x12a547,!![]);}catch(_0x27c02e){return BPromise[_0xf2c8('0x30')](_0x27c02e);}return _0x27a7dc[_0xf2c8('0x31')]();};}function saveUpdates(_0x391045,_0x18ed3f){return function(_0x3f43ee){if(_0x3f43ee){return _0x3f43ee['update'](_0x391045)[_0xf2c8('0x1c')](function(_0x5d530b){return _0x5d530b;});}return null;};}function removeEntity(_0x3a01db,_0x4abc1e){return function(_0x25238f){if(_0x25238f){return _0x25238f[_0xf2c8('0x32')]()[_0xf2c8('0x1c')](function(){_0x3a01db[_0xf2c8('0x29')](0xcc)[_0xf2c8('0x2a')]();});}};}function handleEntityNotFound(_0x5b6e0b,_0x3fb2b0){return function(_0x1927bd){if(!_0x1927bd){_0x5b6e0b['sendStatus'](0x194);}return _0x1927bd;};}function handleError(_0x309232,_0x23f6be){_0x23f6be=_0x23f6be||0x1f4;return function(_0x4a24e8){logger[_0xf2c8('0x22')](_0x4a24e8[_0xf2c8('0x33')]);if(_0x4a24e8[_0xf2c8('0x34')]){delete _0x4a24e8[_0xf2c8('0x34')];}_0x309232[_0xf2c8('0x29')](_0x23f6be)['send'](_0x4a24e8);};}exports['index']=function(_0x25abb5,_0x301567){var _0xb48f51={},_0x80c939={},_0x24e728={'count':0x0,'rows':[]};var _0x3a807e=_[_0xf2c8('0x35')](db[_0xf2c8('0x36')]['rawAttributes'],function(_0x2e7c54){return{'name':_0x2e7c54[_0xf2c8('0x37')],'type':_0x2e7c54[_0xf2c8('0x38')]['key']};});_0x80c939['model']=_['map'](_0x3a807e,'name');_0x80c939[_0xf2c8('0x39')]=_['keys'](_0x25abb5[_0xf2c8('0x39')]);_0x80c939['filters']=_[_0xf2c8('0x3a')](_0x80c939['model'],_0x80c939['query']);_0xb48f51[_0xf2c8('0x3b')]=_[_0xf2c8('0x3a')](_0x80c939['model'],qs[_0xf2c8('0x3c')](_0x25abb5[_0xf2c8('0x39')]['fields']));_0xb48f51[_0xf2c8('0x3b')]=_0xb48f51[_0xf2c8('0x3b')][_0xf2c8('0x3d')]?_0xb48f51[_0xf2c8('0x3b')]:_0x80c939[_0xf2c8('0x3e')];if(!_0x25abb5[_0xf2c8('0x39')]['hasOwnProperty']('nolimit')){_0xb48f51[_0xf2c8('0x2d')]=qs['limit'](_0x25abb5[_0xf2c8('0x39')]['limit']);_0xb48f51[_0xf2c8('0x2c')]=qs['offset'](_0x25abb5[_0xf2c8('0x39')][_0xf2c8('0x2c')]);}_0xb48f51[_0xf2c8('0x3f')]=qs[_0xf2c8('0x40')](_0x25abb5['query'][_0xf2c8('0x40')]);_0xb48f51[_0xf2c8('0x41')]=qs['filters'](_[_0xf2c8('0x42')](_0x25abb5[_0xf2c8('0x39')],_0x80c939[_0xf2c8('0x43')]));if(_0x25abb5[_0xf2c8('0x39')][_0xf2c8('0x44')]){_0xb48f51[_0xf2c8('0x41')]=_[_0xf2c8('0x45')](_0xb48f51['where'],{'$or':_[_0xf2c8('0x35')](_0x3a807e,function(_0x37555d){if(_0x37555d[_0xf2c8('0x38')]!==_0xf2c8('0x46')){var _0x593a45={};_0x593a45[_0x37555d['name']]={'$like':'%'+_0x25abb5[_0xf2c8('0x39')][_0xf2c8('0x44')]+'%'};return _0x593a45;}})});}_0xb48f51=_[_0xf2c8('0x45')]({},_0xb48f51,_0x25abb5['options']);var _0xe257cc={'where':_0xb48f51[_0xf2c8('0x41')]};return db['FreshsalesConfiguration']['count'](_0xe257cc)[_0xf2c8('0x1c')](function(_0xce3dd5){_0x24e728[_0xf2c8('0x47')]=_0xce3dd5;if(_0x25abb5[_0xf2c8('0x39')]['includeAll']){_0xb48f51[_0xf2c8('0x48')]=[{'all':!![]}];}return db[_0xf2c8('0x36')][_0xf2c8('0x49')](_0xb48f51);})['then'](function(_0xc78712){_0x24e728[_0xf2c8('0x4a')]=_0xc78712;return _0x24e728;})[_0xf2c8('0x1c')](respondWithFilteredResult(_0x301567,_0xb48f51))['catch'](handleError(_0x301567,null));};exports[_0xf2c8('0x4b')]=function(_0x452b12,_0x24d4a2){var _0x3d90f5={'raw':![],'where':{'id':_0x452b12['params']['id']}},_0x143cd0={};_0x143cd0[_0xf2c8('0x3e')]=_['keys'](db['FreshsalesConfiguration'][_0xf2c8('0x4c')]);_0x143cd0[_0xf2c8('0x39')]=_[_0xf2c8('0x4d')](_0x452b12[_0xf2c8('0x39')]);_0x143cd0[_0xf2c8('0x43')]=_['intersection'](_0x143cd0[_0xf2c8('0x3e')],_0x143cd0[_0xf2c8('0x39')]);_0x3d90f5[_0xf2c8('0x3b')]=_[_0xf2c8('0x3a')](_0x143cd0[_0xf2c8('0x3e')],qs[_0xf2c8('0x3c')](_0x452b12['query']['fields']));_0x3d90f5[_0xf2c8('0x3b')]=_0x3d90f5[_0xf2c8('0x3b')][_0xf2c8('0x3d')]?_0x3d90f5[_0xf2c8('0x3b')]:_0x143cd0[_0xf2c8('0x3e')];if(_0x452b12[_0xf2c8('0x39')][_0xf2c8('0x4e')]){_0x3d90f5[_0xf2c8('0x48')]=[{'all':!![]}];}_0x3d90f5=_['merge']({},_0x3d90f5,_0x452b12[_0xf2c8('0x4f')]);return db[_0xf2c8('0x36')]['find'](_0x3d90f5)['then'](handleEntityNotFound(_0x24d4a2,null))[_0xf2c8('0x1c')](respondWithResult(_0x24d4a2,null))[_0xf2c8('0x27')](handleError(_0x24d4a2,null));};exports['create']=function(_0xb207b,_0x232884){return db[_0xf2c8('0x36')]['create'](_0xb207b[_0xf2c8('0x50')],{})[_0xf2c8('0x1c')](respondWithResult(_0x232884,0xc9))[_0xf2c8('0x27')](handleError(_0x232884,null));};exports[_0xf2c8('0x51')]=function(_0x3b33fb,_0x268fbc){if(_0x3b33fb[_0xf2c8('0x50')]['id']){delete _0x3b33fb[_0xf2c8('0x50')]['id'];}return db['FreshsalesConfiguration'][_0xf2c8('0x52')]({'where':{'id':_0x3b33fb[_0xf2c8('0x53')]['id']}})[_0xf2c8('0x1c')](handleEntityNotFound(_0x268fbc,null))['then'](saveUpdates(_0x3b33fb['body'],null))[_0xf2c8('0x1c')](respondWithResult(_0x268fbc,null))[_0xf2c8('0x27')](handleError(_0x268fbc,null));};exports['destroy']=function(_0xb8c07b,_0x4f9596){return db['FreshsalesConfiguration'][_0xf2c8('0x52')]({'where':{'id':_0xb8c07b[_0xf2c8('0x53')]['id']}})['then'](handleEntityNotFound(_0x4f9596,null))[_0xf2c8('0x1c')](removeEntity(_0x4f9596,null))[_0xf2c8('0x27')](handleError(_0x4f9596,null));};exports[_0xf2c8('0x54')]=function(_0x3d2d39,_0x2f78b1,_0x4f1c78){var _0x19dc1b={};var _0x3601be={};var _0x51e918;var _0x44b578;return db['FreshsalesConfiguration'][_0xf2c8('0x55')]({'where':{'id':_0x3d2d39[_0xf2c8('0x53')]['id']}})[_0xf2c8('0x1c')](handleEntityNotFound(_0x2f78b1,null))[_0xf2c8('0x1c')](function(_0x387497){if(_0x387497){_0x51e918=_0x387497;_0x3601be[_0xf2c8('0x3e')]=_['keys'](db[_0xf2c8('0x56')][_0xf2c8('0x4c')]);_0x3601be[_0xf2c8('0x39')]=_[_0xf2c8('0x4d')](_0x3d2d39[_0xf2c8('0x39')]);_0x3601be['filters']=_[_0xf2c8('0x3a')](_0x3601be[_0xf2c8('0x3e')],_0x3601be[_0xf2c8('0x39')]);_0x19dc1b[_0xf2c8('0x3b')]=_['intersection'](_0x3601be[_0xf2c8('0x3e')],qs[_0xf2c8('0x3c')](_0x3d2d39[_0xf2c8('0x39')][_0xf2c8('0x3c')]));_0x19dc1b[_0xf2c8('0x3b')]=_0x19dc1b[_0xf2c8('0x3b')][_0xf2c8('0x3d')]?_0x19dc1b[_0xf2c8('0x3b')]:_0x3601be[_0xf2c8('0x3e')];_0x19dc1b['order']=qs[_0xf2c8('0x40')](_0x3d2d39[_0xf2c8('0x39')]['sort']);_0x19dc1b[_0xf2c8('0x41')]=qs[_0xf2c8('0x43')](_['pick'](_0x3d2d39[_0xf2c8('0x39')],_0x3601be[_0xf2c8('0x43')]));if(_0x3d2d39[_0xf2c8('0x39')][_0xf2c8('0x44')]){_0x19dc1b['where']=_['merge'](_0x19dc1b[_0xf2c8('0x41')],{'$or':_['map'](_0x19dc1b[_0xf2c8('0x3b')],function(_0x1d46c4){var _0x443e06={};_0x443e06[_0x1d46c4]={'$like':'%'+_0x3d2d39[_0xf2c8('0x39')][_0xf2c8('0x44')]+'%'};return _0x443e06;})});}_0x19dc1b=_[_0xf2c8('0x45')]({},_0x19dc1b,_0x3d2d39['options']);return _0x51e918[_0xf2c8('0x54')](_0x19dc1b);}})[_0xf2c8('0x1c')](function(_0x4dcfd0){if(_0x4dcfd0){_0x44b578=_0x4dcfd0[_0xf2c8('0x3d')];if(!_0x3d2d39[_0xf2c8('0x39')]['hasOwnProperty'](_0xf2c8('0x57'))){_0x19dc1b['limit']=qs[_0xf2c8('0x2d')](_0x3d2d39[_0xf2c8('0x39')]['limit']);_0x19dc1b['offset']=qs['offset'](_0x3d2d39[_0xf2c8('0x39')][_0xf2c8('0x2c')]);}return _0x51e918[_0xf2c8('0x54')](_0x19dc1b);}})[_0xf2c8('0x1c')](function(_0xb5801f){if(_0xb5801f){return _0xb5801f?{'count':_0x44b578,'rows':_0xb5801f}:null;}})[_0xf2c8('0x1c')](respondWithResult(_0x2f78b1,null))['catch'](handleError(_0x2f78b1,null));};exports[_0xf2c8('0x58')]=function(_0x373d14,_0x2a6cba,_0x299cdc){var _0x4ff195={};var _0x5b0b51={};var _0x949a87;var _0x9d63ca;return db[_0xf2c8('0x36')][_0xf2c8('0x55')]({'where':{'id':_0x373d14['params']['id']}})['then'](handleEntityNotFound(_0x2a6cba,null))[_0xf2c8('0x1c')](function(_0x1ad6af){if(_0x1ad6af){_0x949a87=_0x1ad6af;_0x5b0b51[_0xf2c8('0x3e')]=_[_0xf2c8('0x4d')](db['FreshsalesField']['rawAttributes']);_0x5b0b51[_0xf2c8('0x39')]=_[_0xf2c8('0x4d')](_0x373d14[_0xf2c8('0x39')]);_0x5b0b51[_0xf2c8('0x43')]=_[_0xf2c8('0x3a')](_0x5b0b51[_0xf2c8('0x3e')],_0x5b0b51['query']);_0x4ff195[_0xf2c8('0x3b')]=_[_0xf2c8('0x3a')](_0x5b0b51['model'],qs[_0xf2c8('0x3c')](_0x373d14['query'][_0xf2c8('0x3c')]));_0x4ff195['attributes']=_0x4ff195[_0xf2c8('0x3b')][_0xf2c8('0x3d')]?_0x4ff195[_0xf2c8('0x3b')]:_0x5b0b51[_0xf2c8('0x3e')];_0x4ff195[_0xf2c8('0x3f')]=qs['sort'](_0x373d14['query']['sort']);_0x4ff195[_0xf2c8('0x41')]=qs[_0xf2c8('0x43')](_[_0xf2c8('0x42')](_0x373d14['query'],_0x5b0b51[_0xf2c8('0x43')]));if(_0x373d14['query'][_0xf2c8('0x44')]){_0x4ff195['where']=_[_0xf2c8('0x45')](_0x4ff195['where'],{'$or':_[_0xf2c8('0x35')](_0x4ff195[_0xf2c8('0x3b')],function(_0x269d81){var _0x30ca9a={};_0x30ca9a[_0x269d81]={'$like':'%'+_0x373d14[_0xf2c8('0x39')][_0xf2c8('0x44')]+'%'};return _0x30ca9a;})});}_0x4ff195=_[_0xf2c8('0x45')]({},_0x4ff195,_0x373d14[_0xf2c8('0x4f')]);return _0x949a87['getDescriptions'](_0x4ff195);}})[_0xf2c8('0x1c')](function(_0x4f3522){if(_0x4f3522){_0x9d63ca=_0x4f3522[_0xf2c8('0x3d')];if(!_0x373d14['query']['hasOwnProperty']('nolimit')){_0x4ff195['limit']=qs[_0xf2c8('0x2d')](_0x373d14[_0xf2c8('0x39')][_0xf2c8('0x2d')]);_0x4ff195[_0xf2c8('0x2c')]=qs['offset'](_0x373d14[_0xf2c8('0x39')][_0xf2c8('0x2c')]);}return _0x949a87[_0xf2c8('0x58')](_0x4ff195);}})[_0xf2c8('0x1c')](function(_0x48f6b9){if(_0x48f6b9){return _0x48f6b9?{'count':_0x9d63ca,'rows':_0x48f6b9}:null;}})[_0xf2c8('0x1c')](respondWithResult(_0x2a6cba,null))[_0xf2c8('0x27')](handleError(_0x2a6cba,null));};exports['getFields']=function(_0x4d7e27,_0x15bb5d,_0xa68658){var _0x32ce0a={};var _0x4d2686={};var _0x14edd6;var _0x28fdcc;return db[_0xf2c8('0x36')]['findOne']({'where':{'id':_0x4d7e27[_0xf2c8('0x53')]['id']}})[_0xf2c8('0x1c')](handleEntityNotFound(_0x15bb5d,null))[_0xf2c8('0x1c')](function(_0x84457d){if(_0x84457d){_0x14edd6=_0x84457d;_0x4d2686[_0xf2c8('0x3e')]=_[_0xf2c8('0x4d')](db['FreshsalesField'][_0xf2c8('0x4c')]);_0x4d2686[_0xf2c8('0x39')]=_[_0xf2c8('0x4d')](_0x4d7e27[_0xf2c8('0x39')]);_0x4d2686[_0xf2c8('0x43')]=_[_0xf2c8('0x3a')](_0x4d2686['model'],_0x4d2686[_0xf2c8('0x39')]);_0x32ce0a[_0xf2c8('0x3b')]=_[_0xf2c8('0x3a')](_0x4d2686[_0xf2c8('0x3e')],qs[_0xf2c8('0x3c')](_0x4d7e27['query'][_0xf2c8('0x3c')]));_0x32ce0a[_0xf2c8('0x3b')]=_0x32ce0a[_0xf2c8('0x3b')]['length']?_0x32ce0a[_0xf2c8('0x3b')]:_0x4d2686[_0xf2c8('0x3e')];_0x32ce0a[_0xf2c8('0x3f')]=qs[_0xf2c8('0x40')](_0x4d7e27[_0xf2c8('0x39')]['sort']);_0x32ce0a['where']=qs[_0xf2c8('0x43')](_['pick'](_0x4d7e27[_0xf2c8('0x39')],_0x4d2686[_0xf2c8('0x43')]));if(_0x4d7e27[_0xf2c8('0x39')]['filter']){_0x32ce0a[_0xf2c8('0x41')]=_[_0xf2c8('0x45')](_0x32ce0a[_0xf2c8('0x41')],{'$or':_[_0xf2c8('0x35')](_0x32ce0a[_0xf2c8('0x3b')],function(_0x1cf5fa){var _0x8acd72={};_0x8acd72[_0x1cf5fa]={'$like':'%'+_0x4d7e27[_0xf2c8('0x39')][_0xf2c8('0x44')]+'%'};return _0x8acd72;})});}_0x32ce0a=_[_0xf2c8('0x45')]({},_0x32ce0a,_0x4d7e27[_0xf2c8('0x4f')]);return _0x14edd6['getFields'](_0x32ce0a);}})['then'](function(_0x17352c){if(_0x17352c){_0x28fdcc=_0x17352c[_0xf2c8('0x3d')];if(!_0x4d7e27[_0xf2c8('0x39')][_0xf2c8('0x59')](_0xf2c8('0x57'))){_0x32ce0a[_0xf2c8('0x2d')]=qs[_0xf2c8('0x2d')](_0x4d7e27[_0xf2c8('0x39')][_0xf2c8('0x2d')]);_0x32ce0a[_0xf2c8('0x2c')]=qs[_0xf2c8('0x2c')](_0x4d7e27[_0xf2c8('0x39')][_0xf2c8('0x2c')]);}return _0x14edd6[_0xf2c8('0x5a')](_0x32ce0a);}})[_0xf2c8('0x1c')](function(_0x5abd3d){if(_0x5abd3d){return _0x5abd3d?{'count':_0x28fdcc,'rows':_0x5abd3d}:null;}})[_0xf2c8('0x1c')](respondWithResult(_0x15bb5d,null))[_0xf2c8('0x27')](handleError(_0x15bb5d,null));}; \ No newline at end of file +var _0x7c09=['../../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~!@#$%^&-_=+[{]}.','then','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','sendStatus','status','json','offset','limit','set','apply','reject','save','update','destroy','end','stack','name','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','params','find','create','body','getSubjects','findOne','FreshsalesField','getDescriptions','getFields','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x49b984,_0x387c83){var _0x49d1e0=function(_0x3664c7){while(--_0x3664c7){_0x49b984['push'](_0x49b984['shift']());}};_0x49d1e0(++_0x387c83);}(_0x7c09,0x102));var _0x97c0=function(_0x17c5ad,_0x463d1f){_0x17c5ad=_0x17c5ad-0x0;var _0x2e6dba=_0x7c09[_0x17c5ad];return _0x2e6dba;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x97c0('0x0'));var rimraf=require(_0x97c0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x97c0('0x2'));var rp=require(_0x97c0('0x3'));var moment=require(_0x97c0('0x4'));var BPromise=require(_0x97c0('0x5'));var Mustache=require(_0x97c0('0x6'));var util=require(_0x97c0('0x7'));var path=require(_0x97c0('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x97c0('0x9'));var squel=require(_0x97c0('0xa'));var crypto=require(_0x97c0('0xb'));var jsforce=require(_0x97c0('0xc'));var deskjs=require(_0x97c0('0xd'));var toCsv=require('to-csv');var querystring=require(_0x97c0('0xe'));var Papa=require('papaparse');var Redis=require(_0x97c0('0xf'));var authService=require(_0x97c0('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97c0('0x11'));var logger=require(_0x97c0('0x12'))(_0x97c0('0x13'));var utils=require(_0x97c0('0x14'));var config=require(_0x97c0('0x15'));var db=require(_0x97c0('0x16'))['db'];var jayson=require(_0x97c0('0x17'));var client=jayson[_0x97c0('0x18')][_0x97c0('0x19')]({'port':0x232a});function checkPasswordPattern(_0x2ecf34,_0x2810fd,_0x132865){if(_0x132865){var _0x20acfa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x20acfa['test'](_0x2810fd)){return _0x2ecf34;}else{throw new db[(_0x97c0('0x1a'))][(_0x97c0('0x1b'))](_0x97c0('0x1c'));}}else{return _0x2ecf34;}}function respondWithRpcPromise(_0x496017,_0x42027d,_0x9ca6a8,_0x379951){return new BPromise(function(_0x21e5f7,_0x482be5){var _0x13d46e=_0x379951||client;return _0x13d46e['request'](_0x496017,_0x9ca6a8)[_0x97c0('0x1d')](function(_0x3ae7c4){logger['info'](_0x97c0('0x1e'),_0x42027d,_0x97c0('0x1f'));logger[_0x97c0('0x20')](_0x97c0('0x21'),_0x42027d,_0x97c0('0x1f'),JSON[_0x97c0('0x22')](_0x3ae7c4));if(_0x3ae7c4[_0x97c0('0x23')]){if(_0x3ae7c4[_0x97c0('0x23')][_0x97c0('0x24')]===0x1f4){logger[_0x97c0('0x23')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x42027d,_0x3ae7c4['error'][_0x97c0('0x25')]);return _0x482be5(_0x3ae7c4[_0x97c0('0x23')][_0x97c0('0x25')]);}logger['error'](_0x97c0('0x1e'),_0x42027d,_0x3ae7c4[_0x97c0('0x23')][_0x97c0('0x25')]);return _0x21e5f7(_0x3ae7c4[_0x97c0('0x23')][_0x97c0('0x25')]);}else{logger[_0x97c0('0x26')](_0x97c0('0x1e'),_0x42027d,'request\x20sent');_0x21e5f7(_0x3ae7c4[_0x97c0('0x27')][_0x97c0('0x25')]);}})[_0x97c0('0x28')](function(_0x216785){logger['error'](_0x97c0('0x1e'),_0x42027d,_0x216785);_0x482be5(_0x216785);});});}function respondWithStatusCode(_0x14cada,_0x52a429){_0x52a429=_0x52a429||0xcc;return function(_0x2ec9d6){if(_0x2ec9d6){return _0x14cada[_0x97c0('0x29')](_0x52a429);}return _0x14cada[_0x97c0('0x2a')](_0x52a429)['end']();};}function respondWithResult(_0x4f11ba,_0x51f258){_0x51f258=_0x51f258||0xc8;return function(_0x11b8ad){if(_0x11b8ad){return _0x4f11ba[_0x97c0('0x2a')](_0x51f258)[_0x97c0('0x2b')](_0x11b8ad);}};}function respondWithFilteredResult(_0x225e43,_0x26939e){return function(_0x153b14){if(_0x153b14){var _0x4a3645=_0x153b14['count'],_0x10e47e=_0x26939e[_0x97c0('0x2c')],_0x1c183f=_0x26939e[_0x97c0('0x2c')]+_0x26939e[_0x97c0('0x2d')],_0x325090;if(_0x1c183f>=_0x4a3645){_0x1c183f=_0x4a3645;_0x325090=0xc8;}else{_0x325090=0xce;}_0x225e43[_0x97c0('0x2a')](_0x325090);return _0x225e43[_0x97c0('0x2e')]('Content-Range',_0x10e47e+'-'+_0x1c183f+'/'+_0x4a3645)['json'](_0x153b14);}return null;};}function patchUpdates(_0x29ad98){return function(_0x353fc9){try{jsonpatch[_0x97c0('0x2f')](_0x353fc9,_0x29ad98,!![]);}catch(_0x58f2e8){return BPromise[_0x97c0('0x30')](_0x58f2e8);}return _0x353fc9[_0x97c0('0x31')]();};}function saveUpdates(_0x52bdfe,_0x30147b){return function(_0x22833e){if(_0x22833e){return _0x22833e[_0x97c0('0x32')](_0x52bdfe)[_0x97c0('0x1d')](function(_0x28ed7d){return _0x28ed7d;});}return null;};}function removeEntity(_0x2aa05b,_0x4624ed){return function(_0x1a6c4b){if(_0x1a6c4b){return _0x1a6c4b[_0x97c0('0x33')]()[_0x97c0('0x1d')](function(){_0x2aa05b[_0x97c0('0x2a')](0xcc)[_0x97c0('0x34')]();});}};}function handleEntityNotFound(_0x1de938,_0x11485f){return function(_0x287739){if(!_0x287739){_0x1de938['sendStatus'](0x194);}return _0x287739;};}function handleError(_0x292560,_0x1548b6){_0x1548b6=_0x1548b6||0x1f4;return function(_0x2b7f9a){logger[_0x97c0('0x23')](_0x2b7f9a[_0x97c0('0x35')]);if(_0x2b7f9a[_0x97c0('0x36')]){delete _0x2b7f9a[_0x97c0('0x36')];}_0x292560[_0x97c0('0x2a')](_0x1548b6)['send'](_0x2b7f9a);};}exports[_0x97c0('0x37')]=function(_0x4bf42a,_0x23e482){var _0x20291={},_0xc4c795={},_0x3988d3={'count':0x0,'rows':[]};var _0x41e360=_[_0x97c0('0x38')](db[_0x97c0('0x39')][_0x97c0('0x3a')],function(_0x38f37a){return{'name':_0x38f37a[_0x97c0('0x3b')],'type':_0x38f37a[_0x97c0('0x3c')]['key']};});_0xc4c795[_0x97c0('0x3d')]=_[_0x97c0('0x38')](_0x41e360,'name');_0xc4c795[_0x97c0('0x3e')]=_[_0x97c0('0x3f')](_0x4bf42a[_0x97c0('0x3e')]);_0xc4c795[_0x97c0('0x40')]=_['intersection'](_0xc4c795[_0x97c0('0x3d')],_0xc4c795['query']);_0x20291[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0xc4c795['model'],qs[_0x97c0('0x43')](_0x4bf42a[_0x97c0('0x3e')][_0x97c0('0x43')]));_0x20291[_0x97c0('0x41')]=_0x20291[_0x97c0('0x41')][_0x97c0('0x44')]?_0x20291[_0x97c0('0x41')]:_0xc4c795[_0x97c0('0x3d')];if(!_0x4bf42a[_0x97c0('0x3e')][_0x97c0('0x45')](_0x97c0('0x46'))){_0x20291[_0x97c0('0x2d')]=qs[_0x97c0('0x2d')](_0x4bf42a['query'][_0x97c0('0x2d')]);_0x20291[_0x97c0('0x2c')]=qs[_0x97c0('0x2c')](_0x4bf42a[_0x97c0('0x3e')][_0x97c0('0x2c')]);}_0x20291[_0x97c0('0x47')]=qs[_0x97c0('0x48')](_0x4bf42a['query']['sort']);_0x20291[_0x97c0('0x49')]=qs[_0x97c0('0x40')](_[_0x97c0('0x4a')](_0x4bf42a[_0x97c0('0x3e')],_0xc4c795[_0x97c0('0x40')]));if(_0x4bf42a['query']['filter']){_0x20291['where']=_[_0x97c0('0x4b')](_0x20291['where'],{'$or':_['map'](_0x41e360,function(_0x1d0e94){if(_0x1d0e94[_0x97c0('0x3c')]!==_0x97c0('0x4c')){var _0x15e427={};_0x15e427[_0x1d0e94[_0x97c0('0x36')]]={'$like':'%'+_0x4bf42a['query'][_0x97c0('0x4d')]+'%'};return _0x15e427;}})});}_0x20291=_[_0x97c0('0x4b')]({},_0x20291,_0x4bf42a[_0x97c0('0x4e')]);var _0x10a8ea={'where':_0x20291[_0x97c0('0x49')]};return db[_0x97c0('0x39')][_0x97c0('0x4f')](_0x10a8ea)[_0x97c0('0x1d')](function(_0x2c50ff){_0x3988d3[_0x97c0('0x4f')]=_0x2c50ff;if(_0x4bf42a['query'][_0x97c0('0x50')]){_0x20291[_0x97c0('0x51')]=[{'all':!![]}];}return db[_0x97c0('0x39')][_0x97c0('0x52')](_0x20291);})['then'](function(_0x597a0f){_0x3988d3[_0x97c0('0x53')]=_0x597a0f;return _0x3988d3;})[_0x97c0('0x1d')](respondWithFilteredResult(_0x23e482,_0x20291))[_0x97c0('0x28')](handleError(_0x23e482,null));};exports['show']=function(_0x3e09d5,_0xac56ac){var _0x240f68={'raw':![],'where':{'id':_0x3e09d5[_0x97c0('0x54')]['id']}},_0x2fc02f={};_0x2fc02f['model']=_[_0x97c0('0x3f')](db[_0x97c0('0x39')][_0x97c0('0x3a')]);_0x2fc02f['query']=_['keys'](_0x3e09d5[_0x97c0('0x3e')]);_0x2fc02f['filters']=_['intersection'](_0x2fc02f[_0x97c0('0x3d')],_0x2fc02f[_0x97c0('0x3e')]);_0x240f68[_0x97c0('0x41')]=_['intersection'](_0x2fc02f['model'],qs['fields'](_0x3e09d5[_0x97c0('0x3e')][_0x97c0('0x43')]));_0x240f68[_0x97c0('0x41')]=_0x240f68[_0x97c0('0x41')][_0x97c0('0x44')]?_0x240f68[_0x97c0('0x41')]:_0x2fc02f[_0x97c0('0x3d')];if(_0x3e09d5['query'][_0x97c0('0x50')]){_0x240f68[_0x97c0('0x51')]=[{'all':!![]}];}_0x240f68=_[_0x97c0('0x4b')]({},_0x240f68,_0x3e09d5[_0x97c0('0x4e')]);return db[_0x97c0('0x39')][_0x97c0('0x55')](_0x240f68)['then'](handleEntityNotFound(_0xac56ac,null))[_0x97c0('0x1d')](respondWithResult(_0xac56ac,null))[_0x97c0('0x28')](handleError(_0xac56ac,null));};exports['create']=function(_0x245f2a,_0x3e212b){return db[_0x97c0('0x39')][_0x97c0('0x56')](_0x245f2a[_0x97c0('0x57')],{})[_0x97c0('0x1d')](respondWithResult(_0x3e212b,0xc9))[_0x97c0('0x28')](handleError(_0x3e212b,null));};exports['update']=function(_0x2cd43c,_0x14e93c){if(_0x2cd43c[_0x97c0('0x57')]['id']){delete _0x2cd43c[_0x97c0('0x57')]['id'];}return db[_0x97c0('0x39')][_0x97c0('0x55')]({'where':{'id':_0x2cd43c[_0x97c0('0x54')]['id']}})[_0x97c0('0x1d')](handleEntityNotFound(_0x14e93c,null))[_0x97c0('0x1d')](saveUpdates(_0x2cd43c[_0x97c0('0x57')],null))[_0x97c0('0x1d')](respondWithResult(_0x14e93c,null))[_0x97c0('0x28')](handleError(_0x14e93c,null));};exports[_0x97c0('0x33')]=function(_0x57766f,_0x771495){return db[_0x97c0('0x39')][_0x97c0('0x55')]({'where':{'id':_0x57766f[_0x97c0('0x54')]['id']}})[_0x97c0('0x1d')](handleEntityNotFound(_0x771495,null))[_0x97c0('0x1d')](removeEntity(_0x771495,null))['catch'](handleError(_0x771495,null));};exports[_0x97c0('0x58')]=function(_0x1ad855,_0x5f3803,_0x2813e8){var _0x3c9f09={};var _0x1ceae3={};var _0x586ca1;var _0x829ca8;return db['FreshsalesConfiguration'][_0x97c0('0x59')]({'where':{'id':_0x1ad855[_0x97c0('0x54')]['id']}})[_0x97c0('0x1d')](handleEntityNotFound(_0x5f3803,null))[_0x97c0('0x1d')](function(_0x3c5150){if(_0x3c5150){_0x586ca1=_0x3c5150;_0x1ceae3[_0x97c0('0x3d')]=_[_0x97c0('0x3f')](db[_0x97c0('0x5a')][_0x97c0('0x3a')]);_0x1ceae3[_0x97c0('0x3e')]=_[_0x97c0('0x3f')](_0x1ad855['query']);_0x1ceae3[_0x97c0('0x40')]=_[_0x97c0('0x42')](_0x1ceae3[_0x97c0('0x3d')],_0x1ceae3[_0x97c0('0x3e')]);_0x3c9f09['attributes']=_[_0x97c0('0x42')](_0x1ceae3[_0x97c0('0x3d')],qs[_0x97c0('0x43')](_0x1ad855[_0x97c0('0x3e')]['fields']));_0x3c9f09[_0x97c0('0x41')]=_0x3c9f09[_0x97c0('0x41')][_0x97c0('0x44')]?_0x3c9f09['attributes']:_0x1ceae3[_0x97c0('0x3d')];_0x3c9f09[_0x97c0('0x47')]=qs[_0x97c0('0x48')](_0x1ad855[_0x97c0('0x3e')][_0x97c0('0x48')]);_0x3c9f09[_0x97c0('0x49')]=qs[_0x97c0('0x40')](_['pick'](_0x1ad855['query'],_0x1ceae3[_0x97c0('0x40')]));if(_0x1ad855[_0x97c0('0x3e')]['filter']){_0x3c9f09[_0x97c0('0x49')]=_['merge'](_0x3c9f09['where'],{'$or':_[_0x97c0('0x38')](_0x3c9f09['attributes'],function(_0x17101c){var _0x41b122={};_0x41b122[_0x17101c]={'$like':'%'+_0x1ad855['query']['filter']+'%'};return _0x41b122;})});}_0x3c9f09=_['merge']({},_0x3c9f09,_0x1ad855[_0x97c0('0x4e')]);return _0x586ca1['getSubjects'](_0x3c9f09);}})[_0x97c0('0x1d')](function(_0xc02039){if(_0xc02039){_0x829ca8=_0xc02039[_0x97c0('0x44')];if(!_0x1ad855[_0x97c0('0x3e')][_0x97c0('0x45')](_0x97c0('0x46'))){_0x3c9f09[_0x97c0('0x2d')]=qs[_0x97c0('0x2d')](_0x1ad855[_0x97c0('0x3e')][_0x97c0('0x2d')]);_0x3c9f09[_0x97c0('0x2c')]=qs['offset'](_0x1ad855[_0x97c0('0x3e')][_0x97c0('0x2c')]);}return _0x586ca1[_0x97c0('0x58')](_0x3c9f09);}})[_0x97c0('0x1d')](function(_0x7063a1){if(_0x7063a1){return _0x7063a1?{'count':_0x829ca8,'rows':_0x7063a1}:null;}})['then'](respondWithResult(_0x5f3803,null))[_0x97c0('0x28')](handleError(_0x5f3803,null));};exports[_0x97c0('0x5b')]=function(_0x579f54,_0x4116c9,_0x30ffa8){var _0x1cfe22={};var _0x4f52f4={};var _0xa5f32b;var _0x100d97;return db[_0x97c0('0x39')][_0x97c0('0x59')]({'where':{'id':_0x579f54['params']['id']}})['then'](handleEntityNotFound(_0x4116c9,null))['then'](function(_0x443508){if(_0x443508){_0xa5f32b=_0x443508;_0x4f52f4[_0x97c0('0x3d')]=_[_0x97c0('0x3f')](db[_0x97c0('0x5a')][_0x97c0('0x3a')]);_0x4f52f4[_0x97c0('0x3e')]=_[_0x97c0('0x3f')](_0x579f54[_0x97c0('0x3e')]);_0x4f52f4['filters']=_['intersection'](_0x4f52f4[_0x97c0('0x3d')],_0x4f52f4['query']);_0x1cfe22['attributes']=_['intersection'](_0x4f52f4[_0x97c0('0x3d')],qs[_0x97c0('0x43')](_0x579f54[_0x97c0('0x3e')][_0x97c0('0x43')]));_0x1cfe22[_0x97c0('0x41')]=_0x1cfe22['attributes']['length']?_0x1cfe22[_0x97c0('0x41')]:_0x4f52f4[_0x97c0('0x3d')];_0x1cfe22[_0x97c0('0x47')]=qs[_0x97c0('0x48')](_0x579f54['query'][_0x97c0('0x48')]);_0x1cfe22['where']=qs[_0x97c0('0x40')](_[_0x97c0('0x4a')](_0x579f54[_0x97c0('0x3e')],_0x4f52f4[_0x97c0('0x40')]));if(_0x579f54[_0x97c0('0x3e')][_0x97c0('0x4d')]){_0x1cfe22[_0x97c0('0x49')]=_[_0x97c0('0x4b')](_0x1cfe22[_0x97c0('0x49')],{'$or':_[_0x97c0('0x38')](_0x1cfe22['attributes'],function(_0x65f918){var _0x569516={};_0x569516[_0x65f918]={'$like':'%'+_0x579f54['query'][_0x97c0('0x4d')]+'%'};return _0x569516;})});}_0x1cfe22=_[_0x97c0('0x4b')]({},_0x1cfe22,_0x579f54['options']);return _0xa5f32b[_0x97c0('0x5b')](_0x1cfe22);}})['then'](function(_0x1f2380){if(_0x1f2380){_0x100d97=_0x1f2380[_0x97c0('0x44')];if(!_0x579f54['query'][_0x97c0('0x45')]('nolimit')){_0x1cfe22['limit']=qs['limit'](_0x579f54[_0x97c0('0x3e')][_0x97c0('0x2d')]);_0x1cfe22['offset']=qs[_0x97c0('0x2c')](_0x579f54[_0x97c0('0x3e')][_0x97c0('0x2c')]);}return _0xa5f32b[_0x97c0('0x5b')](_0x1cfe22);}})[_0x97c0('0x1d')](function(_0x11db50){if(_0x11db50){return _0x11db50?{'count':_0x100d97,'rows':_0x11db50}:null;}})[_0x97c0('0x1d')](respondWithResult(_0x4116c9,null))[_0x97c0('0x28')](handleError(_0x4116c9,null));};exports['getFields']=function(_0x1b9adf,_0x4e7b60,_0x597cd1){var _0x4062f8={};var _0x4f9307={};var _0x3f69a6;var _0x15f953;return db['FreshsalesConfiguration'][_0x97c0('0x59')]({'where':{'id':_0x1b9adf[_0x97c0('0x54')]['id']}})[_0x97c0('0x1d')](handleEntityNotFound(_0x4e7b60,null))[_0x97c0('0x1d')](function(_0x388ba1){if(_0x388ba1){_0x3f69a6=_0x388ba1;_0x4f9307['model']=_[_0x97c0('0x3f')](db[_0x97c0('0x5a')][_0x97c0('0x3a')]);_0x4f9307['query']=_[_0x97c0('0x3f')](_0x1b9adf[_0x97c0('0x3e')]);_0x4f9307[_0x97c0('0x40')]=_[_0x97c0('0x42')](_0x4f9307['model'],_0x4f9307[_0x97c0('0x3e')]);_0x4062f8[_0x97c0('0x41')]=_[_0x97c0('0x42')](_0x4f9307[_0x97c0('0x3d')],qs[_0x97c0('0x43')](_0x1b9adf['query'][_0x97c0('0x43')]));_0x4062f8[_0x97c0('0x41')]=_0x4062f8['attributes']['length']?_0x4062f8[_0x97c0('0x41')]:_0x4f9307[_0x97c0('0x3d')];_0x4062f8[_0x97c0('0x47')]=qs['sort'](_0x1b9adf['query'][_0x97c0('0x48')]);_0x4062f8['where']=qs[_0x97c0('0x40')](_[_0x97c0('0x4a')](_0x1b9adf[_0x97c0('0x3e')],_0x4f9307[_0x97c0('0x40')]));if(_0x1b9adf[_0x97c0('0x3e')][_0x97c0('0x4d')]){_0x4062f8[_0x97c0('0x49')]=_['merge'](_0x4062f8[_0x97c0('0x49')],{'$or':_[_0x97c0('0x38')](_0x4062f8[_0x97c0('0x41')],function(_0x4ed628){var _0x312ace={};_0x312ace[_0x4ed628]={'$like':'%'+_0x1b9adf[_0x97c0('0x3e')][_0x97c0('0x4d')]+'%'};return _0x312ace;})});}_0x4062f8=_[_0x97c0('0x4b')]({},_0x4062f8,_0x1b9adf[_0x97c0('0x4e')]);return _0x3f69a6[_0x97c0('0x5c')](_0x4062f8);}})[_0x97c0('0x1d')](function(_0x1b2e52){if(_0x1b2e52){_0x15f953=_0x1b2e52[_0x97c0('0x44')];if(!_0x1b9adf[_0x97c0('0x3e')]['hasOwnProperty'](_0x97c0('0x46'))){_0x4062f8[_0x97c0('0x2d')]=qs[_0x97c0('0x2d')](_0x1b9adf[_0x97c0('0x3e')]['limit']);_0x4062f8[_0x97c0('0x2c')]=qs[_0x97c0('0x2c')](_0x1b9adf[_0x97c0('0x3e')][_0x97c0('0x2c')]);}return _0x3f69a6[_0x97c0('0x5c')](_0x4062f8);}})[_0x97c0('0x1d')](function(_0xf4a5c8){if(_0xf4a5c8){return _0xf4a5c8?{'count':_0x15f953,'rows':_0xf4a5c8}:null;}})['then'](respondWithResult(_0x4e7b60,null))[_0x97c0('0x28')](handleError(_0x4e7b60,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 547ee1b..a2078f7 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 _0xe235=['api','request-promise','path','rimraf','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util','../../config/logger'];(function(_0x1a72de,_0x1904fd){var _0x2c7a60=function(_0x3464f3){while(--_0x3464f3){_0x1a72de['push'](_0x1a72de['shift']());}};_0x2c7a60(++_0x1904fd);}(_0xe235,0xe4));var _0x5e23=function(_0x43eb68,_0x34acfe){_0x43eb68=_0x43eb68-0x0;var _0x451a50=_0xe235[_0x43eb68];return _0x451a50;};'use strict';var _=require(_0x5e23('0x0'));var util=require(_0x5e23('0x1'));var logger=require(_0x5e23('0x2'))(_0x5e23('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5e23('0x4'));var fs=require('fs');var path=require(_0x5e23('0x5'));var rimraf=require(_0x5e23('0x6'));var config=require('../../config/environment');var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x5e23('0x7')]=function(_0x37c8a7,_0x1b49b2){return _0x37c8a7[_0x5e23('0x8')](_0x5e23('0x9'),attributes,{'tableName':_0x5e23('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf39b=['../../config/environment','exports','define','int_freshsales_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x4a9984,_0x1abcab){var _0x269703=function(_0x4ed4ca){while(--_0x4ed4ca){_0x4a9984['push'](_0x4a9984['shift']());}};_0x269703(++_0x1abcab);}(_0xf39b,0x100));var _0xbf39=function(_0x2b53e5,_0x2feac7){_0x2b53e5=_0x2b53e5-0x0;var _0x3db514=_0xf39b[_0x2b53e5];return _0x3db514;};'use strict';var _=require(_0xbf39('0x0'));var util=require(_0xbf39('0x1'));var logger=require(_0xbf39('0x2'))('api');var moment=require(_0xbf39('0x3'));var BPromise=require(_0xbf39('0x4'));var rp=require(_0xbf39('0x5'));var fs=require('fs');var path=require(_0xbf39('0x6'));var rimraf=require(_0xbf39('0x7'));var config=require(_0xbf39('0x8'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0xbf39('0x9')]=function(_0x551bac,_0x5a1672){return _0x551bac[_0xbf39('0xa')]('FreshsalesConfiguration',attributes,{'tableName':_0xbf39('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 13b1823..fe16b63 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 _0x0565=['client','http','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','message','error','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x2421c4,_0x37997c){var _0x49dbd7=function(_0x4804c0){while(--_0x4804c0){_0x2421c4['push'](_0x2421c4['shift']());}};_0x49dbd7(++_0x37997c);}(_0x0565,0xf2));var _0x5056=function(_0x49b207,_0x408ade){_0x49b207=_0x49b207-0x0;var _0x2dc8fa=_0x0565[_0x49b207];return _0x2dc8fa;};'use strict';var _=require(_0x5056('0x0'));var util=require(_0x5056('0x1'));var moment=require(_0x5056('0x2'));var BPromise=require(_0x5056('0x3'));var rs=require(_0x5056('0x4'));var fs=require('fs');var Redis=require(_0x5056('0x5'));var db=require(_0x5056('0x6'))['db'];var utils=require(_0x5056('0x7'));var logger=require(_0x5056('0x8'))(_0x5056('0x9'));var config=require('../../config/environment');var jayson=require(_0x5056('0xa'));var client=jayson[_0x5056('0xb')][_0x5056('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x22afb7,_0x4b8280,_0x52b01f){return new BPromise(function(_0x38f74,_0x223c92){return client[_0x5056('0xd')](_0x22afb7,_0x52b01f)[_0x5056('0xe')](function(_0x2144a9){logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));logger['debug'](_0x5056('0x12'),_0x4b8280,_0x5056('0x11'),JSON[_0x5056('0x13')](_0x2144a9));if(_0x2144a9['error']){if(_0x2144a9['error'][_0x5056('0x14')]===0x1f4){logger['error']('FreshsalesConfiguration,\x20%s,\x20%s',_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x223c92(_0x2144a9['error'][_0x5056('0x15')]);}logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x2144a9['error'][_0x5056('0x15')]);return _0x38f74(_0x2144a9[_0x5056('0x16')][_0x5056('0x15')]);}else{logger[_0x5056('0xf')](_0x5056('0x10'),_0x4b8280,_0x5056('0x11'));_0x38f74(_0x2144a9['result'][_0x5056('0x15')]);}})['catch'](function(_0x43db77){logger[_0x5056('0x16')](_0x5056('0x10'),_0x4b8280,_0x43db77);_0x223c92(_0x43db77);});});} \ No newline at end of file +var _0x983c=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','info','FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0x4ca7b6,_0x12cce1){var _0x3db920=function(_0x50d777){while(--_0x50d777){_0x4ca7b6['push'](_0x4ca7b6['shift']());}};_0x3db920(++_0x12cce1);}(_0x983c,0xf3));var _0xc983=function(_0x5a5f1d,_0x3359d8){_0x5a5f1d=_0x5a5f1d-0x0;var _0x597cf4=_0x983c[_0x5a5f1d];return _0x597cf4;};'use strict';var _=require(_0xc983('0x0'));var util=require(_0xc983('0x1'));var moment=require(_0xc983('0x2'));var BPromise=require(_0xc983('0x3'));var rs=require(_0xc983('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc983('0x5'))['db'];var utils=require(_0xc983('0x6'));var logger=require(_0xc983('0x7'))(_0xc983('0x8'));var config=require(_0xc983('0x9'));var jayson=require(_0xc983('0xa'));var client=jayson[_0xc983('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x346933,_0x363403,_0x141900){return new BPromise(function(_0x11cd44,_0x52025a){return client['request'](_0x346933,_0x141900)['then'](function(_0x5ad672){logger[_0xc983('0xc')](_0xc983('0xd'),_0x363403,_0xc983('0xe'));logger[_0xc983('0xf')](_0xc983('0x10'),_0x363403,_0xc983('0xe'),JSON[_0xc983('0x11')](_0x5ad672));if(_0x5ad672[_0xc983('0x12')]){if(_0x5ad672[_0xc983('0x12')]['code']===0x1f4){logger[_0xc983('0x12')](_0xc983('0xd'),_0x363403,_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);return _0x52025a(_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);}logger['error'](_0xc983('0xd'),_0x363403,_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);return _0x11cd44(_0x5ad672[_0xc983('0x12')][_0xc983('0x13')]);}else{logger[_0xc983('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x363403,_0xc983('0xe'));_0x11cd44(_0x5ad672[_0xc983('0x14')][_0xc983('0x13')]);}})[_0xc983('0x15')](function(_0x2f5dad){logger[_0xc983('0x12')](_0xc983('0xd'),_0x363403,_0x2f5dad);_0x52025a(_0x2f5dad);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index b4f3675..9fc47d6 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 _0xe49f=['path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','post','create','put','update','/:id','destroy','multer','util'];(function(_0x1dfe96,_0xacd7bf){var _0x23bb8a=function(_0x2f9f1a){while(--_0x2f9f1a){_0x1dfe96['push'](_0x1dfe96['shift']());}};_0x23bb8a(++_0xacd7bf);}(_0xe49f,0xb9));var _0xfe49=function(_0x2c7c7d,_0x26f5cd){_0x2c7c7d=_0x2c7c7d-0x0;var _0x1e8ec7=_0xe49f[_0x2c7c7d];return _0x1e8ec7;};'use strict';var multer=require(_0xfe49('0x0'));var util=require(_0xfe49('0x1'));var path=require(_0xfe49('0x2'));var timeout=require('connect-timeout');var express=require(_0xfe49('0x3'));var router=express[_0xfe49('0x4')]();var auth=require(_0xfe49('0x5'));var interaction=require(_0xfe49('0x6'));var config=require(_0xfe49('0x7'));var controller=require(_0xfe49('0x8'));router[_0xfe49('0x9')]('/',auth[_0xfe49('0xa')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0xfe49('0xb')]('/',auth[_0xfe49('0xa')](),controller[_0xfe49('0xc')]);router[_0xfe49('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xfe49('0xe')]);router['delete'](_0xfe49('0xf'),auth[_0xfe49('0xa')](),controller[_0xfe49('0x10')]);module['exports']=router; \ No newline at end of file +var _0x8906=['put','/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','show','post'];(function(_0x3c482a,_0x1f8706){var _0x2ad415=function(_0x44befa){while(--_0x44befa){_0x3c482a['push'](_0x3c482a['shift']());}};_0x2ad415(++_0x1f8706);}(_0x8906,0x64));var _0x6890=function(_0x77acb8,_0x443bec){_0x77acb8=_0x77acb8-0x0;var _0x544a2f=_0x8906[_0x77acb8];return _0x544a2f;};'use strict';var multer=require(_0x6890('0x0'));var util=require('util');var path=require(_0x6890('0x1'));var timeout=require(_0x6890('0x2'));var express=require(_0x6890('0x3'));var router=express[_0x6890('0x4')]();var auth=require(_0x6890('0x5'));var interaction=require(_0x6890('0x6'));var config=require(_0x6890('0x7'));var controller=require(_0x6890('0x8'));router[_0x6890('0x9')]('/',auth[_0x6890('0xa')](),controller[_0x6890('0xb')]);router[_0x6890('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6890('0xc')]);router[_0x6890('0xd')]('/',auth[_0x6890('0xa')](),controller['create']);router[_0x6890('0xe')](_0x6890('0xf'),auth[_0x6890('0xa')](),controller[_0x6890('0x10')]);router[_0x6890('0x11')]('/:id',auth[_0x6890('0xa')](),controller['destroy']);module[_0x6890('0x12')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 2320e7f..bffe4e5 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 _0xebb1=['STRING','variable','customVariable','BOOLEAN','sequelize','exports','ENUM','string','keyValue'];(function(_0xa84536,_0x15e7fc){var _0x2eea26=function(_0x1d132a){while(--_0x1d132a){_0xa84536['push'](_0xa84536['shift']());}};_0x2eea26(++_0x15e7fc);}(_0xebb1,0x1d8));var _0x1ebb=function(_0x167791,_0x2b9890){_0x167791=_0x167791-0x0;var _0x599f82=_0xebb1[_0x167791];return _0x599f82;};'use strict';var Sequelize=require(_0x1ebb('0x0'));module[_0x1ebb('0x1')]={'type':{'type':Sequelize[_0x1ebb('0x2')](_0x1ebb('0x3'),'variable','customVariable',_0x1ebb('0x4')),'defaultValue':_0x1ebb('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x1ebb('0x5')]},'keyType':{'type':Sequelize['ENUM']('string',_0x1ebb('0x6'),_0x1ebb('0x7'))},'keyContent':{'type':Sequelize[_0x1ebb('0x5')]},'idField':{'type':Sequelize[_0x1ebb('0x5')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x1ebb('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x1ebb('0x5')]}}; \ No newline at end of file +var _0xfb99=['STRING','ENUM','variable','customVariable','string'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xfb99,0x1e1));var _0x9fb9=function(_0x1bfc60,_0x50aff7){_0x1bfc60=_0x1bfc60-0x0;var _0x2046ae=_0xfb99[_0x1bfc60];return _0x2046ae;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x9fb9('0x0')]('string',_0x9fb9('0x1'),_0x9fb9('0x2'),'keyValue'),'defaultValue':_0x9fb9('0x3')},'content':{'type':Sequelize[_0x9fb9('0x4')]},'key':{'type':Sequelize[_0x9fb9('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x9fb9('0x3'),_0x9fb9('0x1'),_0x9fb9('0x2'))},'keyContent':{'type':Sequelize[_0x9fb9('0x4')]},'idField':{'type':Sequelize[_0x9fb9('0x4')]},'nameField':{'type':Sequelize[_0x9fb9('0x4')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9fb9('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index f01bb6f..1b52b35 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 _0x5c00=['catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','rimraf','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','api','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','stack','name','send','index','map','FreshsalesField','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x5c00,0x17e));var _0x05c0=function(_0x3fd4b3,_0x17d3ef){_0x3fd4b3=_0x3fd4b3-0x0;var _0x2979a3=_0x5c00[_0x3fd4b3];return _0x2979a3;};'use strict';var pdf=require(_0x05c0('0x0'));var emlformat=require(_0x05c0('0x1'));var rimraf=require(_0x05c0('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x05c0('0x3'));var rp=require('request-promise');var moment=require(_0x05c0('0x4'));var BPromise=require(_0x05c0('0x5'));var Mustache=require(_0x05c0('0x6'));var util=require(_0x05c0('0x7'));var path=require('path');var sox=require(_0x05c0('0x8'));var csv=require(_0x05c0('0x9'));var ejs=require(_0x05c0('0xa'));var fs=require('fs');var _=require(_0x05c0('0xb'));var squel=require('squel');var crypto=require(_0x05c0('0xc'));var jsforce=require(_0x05c0('0xd'));var deskjs=require(_0x05c0('0xe'));var toCsv=require('to-csv');var querystring=require(_0x05c0('0xf'));var Papa=require(_0x05c0('0x10'));var Redis=require(_0x05c0('0x11'));var authService=require(_0x05c0('0x12'));var qs=require(_0x05c0('0x13'));var as=require(_0x05c0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x05c0('0x15'));var utils=require('../../config/utils');var config=require(_0x05c0('0x16'));var db=require(_0x05c0('0x17'))['db'];function respondWithStatusCode(_0xa50678,_0x5a3e65){_0x5a3e65=_0x5a3e65||0xcc;return function(_0x4e39d4){if(_0x4e39d4){return _0xa50678['sendStatus'](_0x5a3e65);}return _0xa50678[_0x05c0('0x18')](_0x5a3e65)[_0x05c0('0x19')]();};}function respondWithResult(_0x20ff48,_0x12deeb){_0x12deeb=_0x12deeb||0xc8;return function(_0x25764b){if(_0x25764b){return _0x20ff48[_0x05c0('0x18')](_0x12deeb)[_0x05c0('0x1a')](_0x25764b);}};}function respondWithFilteredResult(_0xd7b487,_0x4c3e54){return function(_0x238e25){if(_0x238e25){var _0x161a5f=_0x238e25[_0x05c0('0x1b')],_0x4bb164=_0x4c3e54[_0x05c0('0x1c')],_0x29e6b0=_0x4c3e54[_0x05c0('0x1c')]+_0x4c3e54[_0x05c0('0x1d')],_0x27c7bd;if(_0x29e6b0>=_0x161a5f){_0x29e6b0=_0x161a5f;_0x27c7bd=0xc8;}else{_0x27c7bd=0xce;}_0xd7b487['status'](_0x27c7bd);return _0xd7b487[_0x05c0('0x1e')](_0x05c0('0x1f'),_0x4bb164+'-'+_0x29e6b0+'/'+_0x161a5f)[_0x05c0('0x1a')](_0x238e25);}return null;};}function patchUpdates(_0x54fef0){return function(_0x40d905){try{jsonpatch[_0x05c0('0x20')](_0x40d905,_0x54fef0,!![]);}catch(_0x10685b){return BPromise[_0x05c0('0x21')](_0x10685b);}return _0x40d905[_0x05c0('0x22')]();};}function saveUpdates(_0x5e4742,_0x407c1f){return function(_0x1014ef){if(_0x1014ef){return _0x1014ef['update'](_0x5e4742)['then'](function(_0x5e4b80){return _0x5e4b80;});}return null;};}function removeEntity(_0x1c448b,_0x2055a3){return function(_0x83f29){if(_0x83f29){return _0x83f29[_0x05c0('0x23')]()[_0x05c0('0x24')](function(){_0x1c448b[_0x05c0('0x18')](0xcc)[_0x05c0('0x19')]();});}};}function handleEntityNotFound(_0x5b4eef,_0x9b4930){return function(_0x1abbf3){if(!_0x1abbf3){_0x5b4eef['sendStatus'](0x194);}return _0x1abbf3;};}function handleError(_0x530966,_0x4da6d6){_0x4da6d6=_0x4da6d6||0x1f4;return function(_0x5dc2b7){logger['error'](_0x5dc2b7[_0x05c0('0x25')]);if(_0x5dc2b7[_0x05c0('0x26')]){delete _0x5dc2b7['name'];}_0x530966[_0x05c0('0x18')](_0x4da6d6)[_0x05c0('0x27')](_0x5dc2b7);};}exports[_0x05c0('0x28')]=function(_0x889c75,_0x58769a){var _0x7d5ccd={},_0x1c14b1={},_0x2ceaed={'count':0x0,'rows':[]};var _0x200e80=_[_0x05c0('0x29')](db[_0x05c0('0x2a')]['rawAttributes'],function(_0x56ba64){return{'name':_0x56ba64[_0x05c0('0x2b')],'type':_0x56ba64[_0x05c0('0x2c')][_0x05c0('0x2d')]};});_0x1c14b1[_0x05c0('0x2e')]=_[_0x05c0('0x29')](_0x200e80,_0x05c0('0x26'));_0x1c14b1[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x889c75[_0x05c0('0x2f')]);_0x1c14b1[_0x05c0('0x31')]=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],_0x1c14b1['query']);_0x7d5ccd['attributes']=_[_0x05c0('0x32')](_0x1c14b1[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x889c75['query'][_0x05c0('0x33')]));_0x7d5ccd[_0x05c0('0x34')]=_0x7d5ccd['attributes'][_0x05c0('0x35')]?_0x7d5ccd['attributes']:_0x1c14b1[_0x05c0('0x2e')];if(!_0x889c75[_0x05c0('0x2f')][_0x05c0('0x36')](_0x05c0('0x37'))){_0x7d5ccd[_0x05c0('0x1d')]=qs[_0x05c0('0x1d')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1d')]);_0x7d5ccd[_0x05c0('0x1c')]=qs[_0x05c0('0x1c')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x1c')]);}_0x7d5ccd[_0x05c0('0x38')]=qs[_0x05c0('0x39')](_0x889c75[_0x05c0('0x2f')][_0x05c0('0x39')]);_0x7d5ccd[_0x05c0('0x3a')]=qs[_0x05c0('0x31')](_[_0x05c0('0x3b')](_0x889c75[_0x05c0('0x2f')],_0x1c14b1[_0x05c0('0x31')]));if(_0x889c75[_0x05c0('0x2f')][_0x05c0('0x3c')]){_0x7d5ccd[_0x05c0('0x3a')]=_[_0x05c0('0x3d')](_0x7d5ccd[_0x05c0('0x3a')],{'$or':_[_0x05c0('0x29')](_0x200e80,function(_0x3bc6cc){if(_0x3bc6cc[_0x05c0('0x2c')]!==_0x05c0('0x3e')){var _0x1f493c={};_0x1f493c[_0x3bc6cc[_0x05c0('0x26')]]={'$like':'%'+_0x889c75[_0x05c0('0x2f')]['filter']+'%'};return _0x1f493c;}})});}_0x7d5ccd=_[_0x05c0('0x3d')]({},_0x7d5ccd,_0x889c75[_0x05c0('0x3f')]);var _0x41fa50={'where':_0x7d5ccd[_0x05c0('0x3a')]};return db['FreshsalesField']['count'](_0x41fa50)[_0x05c0('0x24')](function(_0x2540db){_0x2ceaed[_0x05c0('0x1b')]=_0x2540db;if(_0x889c75['query'][_0x05c0('0x40')]){_0x7d5ccd[_0x05c0('0x41')]=[{'all':!![]}];}return db[_0x05c0('0x2a')][_0x05c0('0x42')](_0x7d5ccd);})['then'](function(_0x152c6a){_0x2ceaed[_0x05c0('0x43')]=_0x152c6a;return _0x2ceaed;})['then'](respondWithFilteredResult(_0x58769a,_0x7d5ccd))[_0x05c0('0x44')](handleError(_0x58769a,null));};exports[_0x05c0('0x45')]=function(_0x4557db,_0xcbd98){var _0x164e3a={'raw':!![],'where':{'id':_0x4557db[_0x05c0('0x46')]['id']}},_0x398a6e={};_0x398a6e['model']=_['keys'](db[_0x05c0('0x2a')][_0x05c0('0x47')]);_0x398a6e[_0x05c0('0x2f')]=_[_0x05c0('0x30')](_0x4557db[_0x05c0('0x2f')]);_0x398a6e['filters']=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],_0x398a6e[_0x05c0('0x2f')]);_0x164e3a[_0x05c0('0x34')]=_[_0x05c0('0x32')](_0x398a6e[_0x05c0('0x2e')],qs[_0x05c0('0x33')](_0x4557db['query'][_0x05c0('0x33')]));_0x164e3a[_0x05c0('0x34')]=_0x164e3a[_0x05c0('0x34')][_0x05c0('0x35')]?_0x164e3a[_0x05c0('0x34')]:_0x398a6e[_0x05c0('0x2e')];if(_0x4557db[_0x05c0('0x2f')][_0x05c0('0x40')]){_0x164e3a[_0x05c0('0x41')]=[{'all':!![]}];}_0x164e3a=_[_0x05c0('0x3d')]({},_0x164e3a,_0x4557db[_0x05c0('0x3f')]);return db['FreshsalesField']['find'](_0x164e3a)[_0x05c0('0x24')](handleEntityNotFound(_0xcbd98,null))[_0x05c0('0x24')](respondWithResult(_0xcbd98,null))[_0x05c0('0x44')](handleError(_0xcbd98,null));};exports[_0x05c0('0x48')]=function(_0x2a1339,_0x856372){return db['FreshsalesField'][_0x05c0('0x48')](_0x2a1339[_0x05c0('0x49')],{})[_0x05c0('0x24')](respondWithResult(_0x856372,0xc9))[_0x05c0('0x44')](handleError(_0x856372,null));};exports['update']=function(_0x34e94e,_0x2440e8){if(_0x34e94e[_0x05c0('0x49')]['id']){delete _0x34e94e[_0x05c0('0x49')]['id'];}return db['FreshsalesField'][_0x05c0('0x4a')]({'where':{'id':_0x34e94e[_0x05c0('0x46')]['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x2440e8,null))[_0x05c0('0x24')](saveUpdates(_0x34e94e['body'],null))[_0x05c0('0x24')](respondWithResult(_0x2440e8,null))[_0x05c0('0x44')](handleError(_0x2440e8,null));};exports['destroy']=function(_0x27f69e,_0x57f979){return db['FreshsalesField'][_0x05c0('0x4a')]({'where':{'id':_0x27f69e['params']['id']}})[_0x05c0('0x24')](handleEntityNotFound(_0x57f979,null))[_0x05c0('0x24')](removeEntity(_0x57f979,null))[_0x05c0('0x44')](handleError(_0x57f979,null));}; \ No newline at end of file +var _0xac4a=['set','apply','reject','save','update','destroy','then','sendStatus','error','send','index','map','FreshsalesField','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','catch','show','keys','rawAttributes','find','create','params','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','json','count','offset','limit'];(function(_0xa1397e,_0x12d423){var _0x1ee271=function(_0x193864){while(--_0x193864){_0xa1397e['push'](_0xa1397e['shift']());}};_0x1ee271(++_0x12d423);}(_0xac4a,0x13f));var _0xaac4=function(_0x34b948,_0x39c51a){_0x34b948=_0x34b948-0x0;var _0x4fe19d=_0xac4a[_0x34b948];return _0x4fe19d;};'use strict';var pdf=require(_0xaac4('0x0'));var emlformat=require(_0xaac4('0x1'));var rimraf=require(_0xaac4('0x2'));var zipdir=require(_0xaac4('0x3'));var jsonpatch=require(_0xaac4('0x4'));var rp=require(_0xaac4('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xaac4('0x6'));var util=require(_0xaac4('0x7'));var path=require(_0xaac4('0x8'));var sox=require('sox');var csv=require(_0xaac4('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2348c2,_0x2e2d02){_0x2e2d02=_0x2e2d02||0xcc;return function(_0x45e512){if(_0x45e512){return _0x2348c2['sendStatus'](_0x2e2d02);}return _0x2348c2[_0xaac4('0x14')](_0x2e2d02)[_0xaac4('0x15')]();};}function respondWithResult(_0x5bcacd,_0xf06b1d){_0xf06b1d=_0xf06b1d||0xc8;return function(_0x2b20d0){if(_0x2b20d0){return _0x5bcacd[_0xaac4('0x14')](_0xf06b1d)[_0xaac4('0x16')](_0x2b20d0);}};}function respondWithFilteredResult(_0x187624,_0x2fbeb7){return function(_0x31b7e5){if(_0x31b7e5){var _0x1df9ae=_0x31b7e5[_0xaac4('0x17')],_0x233278=_0x2fbeb7[_0xaac4('0x18')],_0xb8466e=_0x2fbeb7['offset']+_0x2fbeb7[_0xaac4('0x19')],_0x35bc32;if(_0xb8466e>=_0x1df9ae){_0xb8466e=_0x1df9ae;_0x35bc32=0xc8;}else{_0x35bc32=0xce;}_0x187624['status'](_0x35bc32);return _0x187624[_0xaac4('0x1a')]('Content-Range',_0x233278+'-'+_0xb8466e+'/'+_0x1df9ae)[_0xaac4('0x16')](_0x31b7e5);}return null;};}function patchUpdates(_0x27fe7b){return function(_0xa22b76){try{jsonpatch[_0xaac4('0x1b')](_0xa22b76,_0x27fe7b,!![]);}catch(_0x3cbcb1){return BPromise[_0xaac4('0x1c')](_0x3cbcb1);}return _0xa22b76[_0xaac4('0x1d')]();};}function saveUpdates(_0x25b946,_0x4166ee){return function(_0x480fb0){if(_0x480fb0){return _0x480fb0[_0xaac4('0x1e')](_0x25b946)['then'](function(_0x3303f1){return _0x3303f1;});}return null;};}function removeEntity(_0x2013b7,_0x43625c){return function(_0x477b77){if(_0x477b77){return _0x477b77[_0xaac4('0x1f')]()[_0xaac4('0x20')](function(){_0x2013b7['status'](0xcc)[_0xaac4('0x15')]();});}};}function handleEntityNotFound(_0x27a84d,_0x174860){return function(_0x4f10ec){if(!_0x4f10ec){_0x27a84d[_0xaac4('0x21')](0x194);}return _0x4f10ec;};}function handleError(_0x2dcc59,_0xb2577b){_0xb2577b=_0xb2577b||0x1f4;return function(_0x577b3d){logger[_0xaac4('0x22')](_0x577b3d['stack']);if(_0x577b3d['name']){delete _0x577b3d['name'];}_0x2dcc59['status'](_0xb2577b)[_0xaac4('0x23')](_0x577b3d);};}exports[_0xaac4('0x24')]=function(_0x22cda2,_0xe93120){var _0x3c1445={},_0x249a5d={},_0x43b122={'count':0x0,'rows':[]};var _0x2d68b6=_[_0xaac4('0x25')](db[_0xaac4('0x26')]['rawAttributes'],function(_0x316445){return{'name':_0x316445[_0xaac4('0x27')],'type':_0x316445[_0xaac4('0x28')][_0xaac4('0x29')]};});_0x249a5d[_0xaac4('0x2a')]=_[_0xaac4('0x25')](_0x2d68b6,'name');_0x249a5d[_0xaac4('0x2b')]=_['keys'](_0x22cda2[_0xaac4('0x2b')]);_0x249a5d[_0xaac4('0x2c')]=_[_0xaac4('0x2d')](_0x249a5d[_0xaac4('0x2a')],_0x249a5d['query']);_0x3c1445['attributes']=_['intersection'](_0x249a5d[_0xaac4('0x2a')],qs[_0xaac4('0x2e')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x2e')]));_0x3c1445[_0xaac4('0x2f')]=_0x3c1445[_0xaac4('0x2f')][_0xaac4('0x30')]?_0x3c1445[_0xaac4('0x2f')]:_0x249a5d[_0xaac4('0x2a')];if(!_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x31')](_0xaac4('0x32'))){_0x3c1445[_0xaac4('0x19')]=qs[_0xaac4('0x19')](_0x22cda2[_0xaac4('0x2b')]['limit']);_0x3c1445['offset']=qs[_0xaac4('0x18')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x18')]);}_0x3c1445['order']=qs[_0xaac4('0x33')](_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x33')]);_0x3c1445[_0xaac4('0x34')]=qs[_0xaac4('0x2c')](_[_0xaac4('0x35')](_0x22cda2[_0xaac4('0x2b')],_0x249a5d['filters']));if(_0x22cda2[_0xaac4('0x2b')][_0xaac4('0x36')]){_0x3c1445[_0xaac4('0x34')]=_['merge'](_0x3c1445[_0xaac4('0x34')],{'$or':_['map'](_0x2d68b6,function(_0x577b5b){if(_0x577b5b[_0xaac4('0x28')]!==_0xaac4('0x37')){var _0x2da28a={};_0x2da28a[_0x577b5b['name']]={'$like':'%'+_0x22cda2['query'][_0xaac4('0x36')]+'%'};return _0x2da28a;}})});}_0x3c1445=_[_0xaac4('0x38')]({},_0x3c1445,_0x22cda2[_0xaac4('0x39')]);var _0x268295={'where':_0x3c1445[_0xaac4('0x34')]};return db[_0xaac4('0x26')]['count'](_0x268295)['then'](function(_0x220bdc){_0x43b122[_0xaac4('0x17')]=_0x220bdc;if(_0x22cda2['query'][_0xaac4('0x3a')]){_0x3c1445[_0xaac4('0x3b')]=[{'all':!![]}];}return db[_0xaac4('0x26')]['findAll'](_0x3c1445);})[_0xaac4('0x20')](function(_0x4a4773){_0x43b122[_0xaac4('0x3c')]=_0x4a4773;return _0x43b122;})['then'](respondWithFilteredResult(_0xe93120,_0x3c1445))[_0xaac4('0x3d')](handleError(_0xe93120,null));};exports[_0xaac4('0x3e')]=function(_0x3dcade,_0x33bf83){var _0x51e59d={'raw':!![],'where':{'id':_0x3dcade['params']['id']}},_0x247fea={};_0x247fea['model']=_[_0xaac4('0x3f')](db[_0xaac4('0x26')][_0xaac4('0x40')]);_0x247fea[_0xaac4('0x2b')]=_[_0xaac4('0x3f')](_0x3dcade[_0xaac4('0x2b')]);_0x247fea[_0xaac4('0x2c')]=_[_0xaac4('0x2d')](_0x247fea['model'],_0x247fea[_0xaac4('0x2b')]);_0x51e59d[_0xaac4('0x2f')]=_[_0xaac4('0x2d')](_0x247fea[_0xaac4('0x2a')],qs['fields'](_0x3dcade[_0xaac4('0x2b')][_0xaac4('0x2e')]));_0x51e59d[_0xaac4('0x2f')]=_0x51e59d['attributes'][_0xaac4('0x30')]?_0x51e59d[_0xaac4('0x2f')]:_0x247fea[_0xaac4('0x2a')];if(_0x3dcade[_0xaac4('0x2b')]['includeAll']){_0x51e59d[_0xaac4('0x3b')]=[{'all':!![]}];}_0x51e59d=_[_0xaac4('0x38')]({},_0x51e59d,_0x3dcade[_0xaac4('0x39')]);return db['FreshsalesField'][_0xaac4('0x41')](_0x51e59d)[_0xaac4('0x20')](handleEntityNotFound(_0x33bf83,null))[_0xaac4('0x20')](respondWithResult(_0x33bf83,null))[_0xaac4('0x3d')](handleError(_0x33bf83,null));};exports[_0xaac4('0x42')]=function(_0x1ad713,_0x25e1b1){return db[_0xaac4('0x26')][_0xaac4('0x42')](_0x1ad713['body'],{})[_0xaac4('0x20')](respondWithResult(_0x25e1b1,0xc9))[_0xaac4('0x3d')](handleError(_0x25e1b1,null));};exports[_0xaac4('0x1e')]=function(_0x360420,_0x130bb5){if(_0x360420['body']['id']){delete _0x360420['body']['id'];}return db[_0xaac4('0x26')][_0xaac4('0x41')]({'where':{'id':_0x360420[_0xaac4('0x43')]['id']}})[_0xaac4('0x20')](handleEntityNotFound(_0x130bb5,null))['then'](saveUpdates(_0x360420[_0xaac4('0x44')],null))['then'](respondWithResult(_0x130bb5,null))[_0xaac4('0x3d')](handleError(_0x130bb5,null));};exports[_0xaac4('0x1f')]=function(_0x487203,_0x282de3){return db[_0xaac4('0x26')][_0xaac4('0x41')]({'where':{'id':_0x487203['params']['id']}})['then'](handleEntityNotFound(_0x282de3,null))[_0xaac4('0x20')](removeEntity(_0x282de3,null))[_0xaac4('0x3d')](handleError(_0x282de3,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 8fd352a..371c01a 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 _0xb338=['../../config/environment','./intFreshsalesField.attributes','define','FreshsalesField','idField','FieldId','lodash','api','moment','bluebird'];(function(_0x1ad990,_0x219d08){var _0x4f1580=function(_0x3b6f26){while(--_0x3b6f26){_0x1ad990['push'](_0x1ad990['shift']());}};_0x4f1580(++_0x219d08);}(_0xb338,0x16e));var _0x8b33=function(_0xbe41ba,_0x384563){_0xbe41ba=_0xbe41ba-0x0;var _0x2c2085=_0xb338[_0xbe41ba];return _0x2c2085;};'use strict';var _=require(_0x8b33('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8b33('0x1'));var moment=require(_0x8b33('0x2'));var BPromise=require(_0x8b33('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8b33('0x4'));var attributes=require(_0x8b33('0x5'));module['exports']=function(_0x1808fb,_0x49545d){return _0x1808fb[_0x8b33('0x6')](_0x8b33('0x7'),attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':'freshsales_unique_index','fields':[_0x8b33('0x8'),_0x8b33('0x9')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c3=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','FreshsalesField','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util','../../config/logger'];(function(_0x4f4c2a,_0x5f5a28){var _0xd15be6=function(_0x1bc725){while(--_0x1bc725){_0x4f4c2a['push'](_0x4f4c2a['shift']());}};_0xd15be6(++_0x5f5a28);}(_0xc3c3,0x6d));var _0x3c3c=function(_0x24b278,_0x394db0){_0x24b278=_0x24b278-0x0;var _0x1e2646=_0xc3c3[_0x24b278];return _0x1e2646;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var logger=require(_0x3c3c('0x2'))(_0x3c3c('0x3'));var moment=require(_0x3c3c('0x4'));var BPromise=require(_0x3c3c('0x5'));var rp=require(_0x3c3c('0x6'));var fs=require('fs');var path=require(_0x3c3c('0x7'));var rimraf=require(_0x3c3c('0x8'));var config=require(_0x3c3c('0x9'));var attributes=require('./intFreshsalesField.attributes');module[_0x3c3c('0xa')]=function(_0x4debba,_0x3013e7){return _0x4debba[_0x3c3c('0xb')](_0x3c3c('0xc'),attributes,{'tableName':_0x3c3c('0xd'),'paranoid':![],'indexes':[{'name':_0x3c3c('0xe'),'fields':['idField',_0x3c3c('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.rpc.js b/server/api/intFreshsalesField/intFreshsalesField.rpc.js index dd04567..25758ca 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 _0x18f4=['result','catch','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2ed880,_0x2ad96c){var _0x61faf=function(_0x416f51){while(--_0x416f51){_0x2ed880['push'](_0x2ed880['shift']());}};_0x61faf(++_0x2ad96c);}(_0x18f4,0x1a4));var _0x418f=function(_0x980b65,_0x24e334){_0x980b65=_0x980b65-0x0;var _0x366f0d=_0x18f4[_0x980b65];return _0x366f0d;};'use strict';var _=require('lodash');var util=require(_0x418f('0x0'));var moment=require(_0x418f('0x1'));var BPromise=require('bluebird');var rs=require(_0x418f('0x2'));var fs=require('fs');var Redis=require(_0x418f('0x3'));var db=require(_0x418f('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x418f('0x5'));var config=require(_0x418f('0x6'));var jayson=require(_0x418f('0x7'));var client=jayson[_0x418f('0x8')][_0x418f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e23c8,_0x14eca7,_0x7c0e09){return new BPromise(function(_0x4f4263,_0x1144ab){return client['request'](_0x3e23c8,_0x7c0e09)[_0x418f('0xa')](function(_0x525368){logger[_0x418f('0xb')](_0x418f('0xc'),_0x14eca7,_0x418f('0xd'));logger[_0x418f('0xe')](_0x418f('0xf'),_0x14eca7,_0x418f('0xd'),JSON[_0x418f('0x10')](_0x525368));if(_0x525368['error']){if(_0x525368[_0x418f('0x11')][_0x418f('0x12')]===0x1f4){logger[_0x418f('0x11')](_0x418f('0xc'),_0x14eca7,_0x525368['error'][_0x418f('0x13')]);return _0x1144ab(_0x525368[_0x418f('0x11')]['message']);}logger[_0x418f('0x11')]('FreshsalesField,\x20%s,\x20%s',_0x14eca7,_0x525368[_0x418f('0x11')][_0x418f('0x13')]);return _0x4f4263(_0x525368[_0x418f('0x11')]['message']);}else{logger[_0x418f('0xb')]('FreshsalesField,\x20%s,\x20%s',_0x14eca7,_0x418f('0xd'));_0x4f4263(_0x525368[_0x418f('0x14')][_0x418f('0x13')]);}})[_0x418f('0x15')](function(_0x50a923){logger[_0x418f('0x11')](_0x418f('0xc'),_0x14eca7,_0x50a923);_0x1144ab(_0x50a923);});});} \ No newline at end of file +var _0x62cc=['request\x20sent','stringify','error','FreshsalesField,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','FreshsalesField,\x20%s,\x20%s,\x20%s'];(function(_0x3bba16,_0xb50821){var _0x3da1b7=function(_0x3eecdb){while(--_0x3eecdb){_0x3bba16['push'](_0x3bba16['shift']());}};_0x3da1b7(++_0xb50821);}(_0x62cc,0x9f));var _0xc62c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x62cc[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xc62c('0x0'));var util=require(_0xc62c('0x1'));var moment=require(_0xc62c('0x2'));var BPromise=require('bluebird');var rs=require(_0xc62c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc62c('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc62c('0x5'))(_0xc62c('0x6'));var config=require(_0xc62c('0x7'));var jayson=require(_0xc62c('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1a09be,_0x24c5ff,_0x5d3306){return new BPromise(function(_0x5c1d3a,_0x8784bb){return client[_0xc62c('0x9')](_0x1a09be,_0x5d3306)['then'](function(_0x483b87){logger[_0xc62c('0xa')]('FreshsalesField,\x20%s,\x20%s',_0x24c5ff,'request\x20sent');logger['debug'](_0xc62c('0xb'),_0x24c5ff,_0xc62c('0xc'),JSON[_0xc62c('0xd')](_0x483b87));if(_0x483b87[_0xc62c('0xe')]){if(_0x483b87[_0xc62c('0xe')]['code']===0x1f4){logger['error'](_0xc62c('0xf'),_0x24c5ff,_0x483b87['error']['message']);return _0x8784bb(_0x483b87[_0xc62c('0xe')]['message']);}logger[_0xc62c('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x24c5ff,_0x483b87[_0xc62c('0xe')][_0xc62c('0x10')]);return _0x5c1d3a(_0x483b87[_0xc62c('0xe')][_0xc62c('0x10')]);}else{logger[_0xc62c('0xa')](_0xc62c('0xf'),_0x24c5ff,_0xc62c('0xc'));_0x5c1d3a(_0x483b87[_0xc62c('0x11')][_0xc62c('0x10')]);}})[_0xc62c('0x12')](function(_0x583aec){logger[_0xc62c('0xe')]('FreshsalesField,\x20%s,\x20%s',_0x24c5ff,_0x583aec);_0x8784bb(_0x583aec);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index f99c233..a15ea07 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 _0x1bb2=['getConfigurations','/:id/fields','post','create','addConfiguration','put','update','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','isAuthenticated'];(function(_0x4589b8,_0x147234){var _0x14bf43=function(_0x4c7ab5){while(--_0x4c7ab5){_0x4589b8['push'](_0x4589b8['shift']());}};_0x14bf43(++_0x147234);}(_0x1bb2,0xc6));var _0x21bb=function(_0x1df8ff,_0x34b8cc){_0x1df8ff=_0x1df8ff-0x0;var _0x50053a=_0x1bb2[_0x1df8ff];return _0x50053a;};'use strict';var multer=require('multer');var util=require(_0x21bb('0x0'));var path=require(_0x21bb('0x1'));var timeout=require(_0x21bb('0x2'));var express=require('express');var router=express[_0x21bb('0x3')]();var auth=require(_0x21bb('0x4'));var interaction=require(_0x21bb('0x5'));var config=require(_0x21bb('0x6'));var controller=require(_0x21bb('0x7'));router[_0x21bb('0x8')]('/',auth['isAuthenticated'](),controller[_0x21bb('0x9')]);router[_0x21bb('0x8')](_0x21bb('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x21bb('0x8')]('/:id/configurations',auth[_0x21bb('0xb')](),controller[_0x21bb('0xc')]);router[_0x21bb('0x8')](_0x21bb('0xd'),auth[_0x21bb('0xb')](),controller['getFields']);router[_0x21bb('0xe')]('/',auth[_0x21bb('0xb')](),controller[_0x21bb('0xf')]);router[_0x21bb('0xe')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x21bb('0x10')]);router[_0x21bb('0x11')](_0x21bb('0xa'),auth[_0x21bb('0xb')](),controller[_0x21bb('0x12')]);router['delete'](_0x21bb('0xa'),auth['isAuthenticated'](),controller[_0x21bb('0x13')]);module[_0x21bb('0x14')]=router; \ No newline at end of file +var _0xa482=['../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','destroy','exports','multer','util','path','connect-timeout','express','Router'];(function(_0x3d3ca6,_0x5f3400){var _0x49c3b4=function(_0x957a02){while(--_0x957a02){_0x3d3ca6['push'](_0x3d3ca6['shift']());}};_0x49c3b4(++_0x5f3400);}(_0xa482,0x181));var _0x2a48=function(_0x1cb005,_0x139e00){_0x1cb005=_0x1cb005-0x0;var _0x487a43=_0xa482[_0x1cb005];return _0x487a43;};'use strict';var multer=require(_0x2a48('0x0'));var util=require(_0x2a48('0x1'));var path=require(_0x2a48('0x2'));var timeout=require(_0x2a48('0x3'));var express=require(_0x2a48('0x4'));var router=express[_0x2a48('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x2a48('0x6'));var config=require(_0x2a48('0x7'));var controller=require(_0x2a48('0x8'));router[_0x2a48('0x9')]('/',auth[_0x2a48('0xa')](),controller[_0x2a48('0xb')]);router[_0x2a48('0x9')](_0x2a48('0xc'),auth[_0x2a48('0xa')](),controller[_0x2a48('0xd')]);router['get'](_0x2a48('0xe'),auth[_0x2a48('0xa')](),controller['getConfigurations']);router[_0x2a48('0x9')](_0x2a48('0xf'),auth[_0x2a48('0xa')](),controller[_0x2a48('0x10')]);router[_0x2a48('0x11')]('/',auth[_0x2a48('0xa')](),controller[_0x2a48('0x12')]);router['post'](_0x2a48('0xe'),auth[_0x2a48('0xa')](),controller[_0x2a48('0x13')]);router[_0x2a48('0x14')]('/:id',auth[_0x2a48('0xa')](),controller['update']);router['delete'](_0x2a48('0xc'),auth[_0x2a48('0xa')](),controller[_0x2a48('0x15')]);module[_0x2a48('0x16')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 28d2b92..849460a 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(_0x2a56ad,_0x2b94bf){var _0x425175=function(_0x342f20){while(--_0x342f20){_0x2a56ad['push'](_0x2a56ad['shift']());}};_0x425175(++_0x2b94bf);}(_0x7217,0x19e));var _0x7721=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x7217[_0x37bd26];return _0xe83dc4;};'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 _0x5fc3=['STRING','username','newTab','sequelize','exports'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x5fc3,0xa8));var _0x35fc=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x5fc3[_0x397cfb];return _0x15fed9;};'use strict';var Sequelize=require(_0x35fc('0x0'));module[_0x35fc('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x35fc('0x2')]},'username':{'type':Sequelize[_0x35fc('0x2')],'unique':_0x35fc('0x3')},'remoteUri':{'type':Sequelize[_0x35fc('0x2')]},'password':{'type':Sequelize[_0x35fc('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x35fc('0x2')]},'securityToken':{'type':Sequelize[_0x35fc('0x2')]},'serverUrl':{'type':Sequelize[_0x35fc('0x2')]},'type':{'type':Sequelize['ENUM']('integrationTab',_0x35fc('0x4')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b86c91f..5bc3d67 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 _0x1cb9=['keys','include','find','create','body','params','getConfigurations','findOne','order','pick','addConfiguration','AccountId','Descriptions','channel','SalesforceConfiguration','Subjects','SalesforceField','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','Connection','login','concat','isNil','ticketType','sobject','CallDisposition','CallDurationInSeconds','CallObject','CallType','IsArchived','Status','Type','Case','Origin','Priority','IsEscalated','SuppliedName','remove','custom','includes','label','picklistValues','value','boolean','True','true','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','http','Sequelize','ValidationError','then','info','SalesforceAccount,\x20%s,\x20%s','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','catch','sendStatus','end','status','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','send','index','SalesforceAccount','rawAttributes','fieldName','type','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','VIRTUAL','options','count','includeAll','findAll'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x1cb9,0x14e));var _0x91cb=function(_0x337b9c,_0x30be51){_0x337b9c=_0x337b9c-0x0;var _0x4ddf9a=_0x1cb9[_0x337b9c];return _0x4ddf9a;};'use strict';var pdf=require(_0x91cb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x91cb('0x1'));var zipdir=require(_0x91cb('0x2'));var jsonpatch=require(_0x91cb('0x3'));var rp=require(_0x91cb('0x4'));var moment=require('moment');var BPromise=require(_0x91cb('0x5'));var Mustache=require(_0x91cb('0x6'));var util=require('util');var path=require(_0x91cb('0x7'));var sox=require(_0x91cb('0x8'));var csv=require(_0x91cb('0x9'));var ejs=require(_0x91cb('0xa'));var fs=require('fs');var _=require(_0x91cb('0xb'));var squel=require(_0x91cb('0xc'));var crypto=require('crypto');var jsforce=require(_0x91cb('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x91cb('0x9'));var querystring=require('querystring');var Papa=require(_0x91cb('0xe'));var Redis=require(_0x91cb('0xf'));var authService=require(_0x91cb('0x10'));var qs=require(_0x91cb('0x11'));var as=require(_0x91cb('0x12'));var hardwareService=require(_0x91cb('0x13'));var logger=require(_0x91cb('0x14'))(_0x91cb('0x15'));var utils=require(_0x91cb('0x16'));var config=require(_0x91cb('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x91cb('0x18'));var jayson=require(_0x91cb('0x19'));var client=jayson['client'][_0x91cb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ea707,_0x44f2e9,_0x2c7d40){if(_0x2c7d40){var _0x4a7d45=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4a7d45['test'](_0x44f2e9)){return _0x3ea707;}else{throw new db[(_0x91cb('0x1b'))][(_0x91cb('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 _0x3ea707;}}function respondWithRpcPromise(_0x528f73,_0x576369,_0xc3629e,_0x347980){return new BPromise(function(_0x5ea796,_0x238f11){var _0x135890=_0x347980||client;return _0x135890['request'](_0x528f73,_0xc3629e)[_0x91cb('0x1d')](function(_0x139f4b){logger[_0x91cb('0x1e')](_0x91cb('0x1f'),_0x576369,'request\x20sent');logger[_0x91cb('0x20')](_0x91cb('0x21'),_0x576369,'request\x20sent',JSON[_0x91cb('0x22')](_0x139f4b));if(_0x139f4b['error']){if(_0x139f4b['error'][_0x91cb('0x23')]===0x1f4){logger[_0x91cb('0x24')]('SalesforceAccount,\x20%s,\x20%s',_0x576369,_0x139f4b['error']['message']);return _0x238f11(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x139f4b['error'][_0x91cb('0x25')]);return _0x5ea796(_0x139f4b[_0x91cb('0x24')][_0x91cb('0x25')]);}else{logger['info'](_0x91cb('0x1f'),_0x576369,_0x91cb('0x26'));_0x5ea796(_0x139f4b[_0x91cb('0x27')][_0x91cb('0x25')]);}})[_0x91cb('0x28')](function(_0x7ad361){logger[_0x91cb('0x24')](_0x91cb('0x1f'),_0x576369,_0x7ad361);_0x238f11(_0x7ad361);});});}function respondWithStatusCode(_0x264e9b,_0x4c8438){_0x4c8438=_0x4c8438||0xcc;return function(_0x59bf3a){if(_0x59bf3a){return _0x264e9b[_0x91cb('0x29')](_0x4c8438);}return _0x264e9b['status'](_0x4c8438)[_0x91cb('0x2a')]();};}function respondWithResult(_0x34d372,_0x318031){_0x318031=_0x318031||0xc8;return function(_0x5595c5){if(_0x5595c5){return _0x34d372[_0x91cb('0x2b')](_0x318031)['json'](_0x5595c5);}};}function respondWithFilteredResult(_0x4572f6,_0x308e8c){return function(_0x3b3ee6){if(_0x3b3ee6){var _0x2fb473=_0x3b3ee6['count'],_0x468908=_0x308e8c[_0x91cb('0x2c')],_0x504275=_0x308e8c[_0x91cb('0x2c')]+_0x308e8c[_0x91cb('0x2d')],_0x2f04a3;if(_0x504275>=_0x2fb473){_0x504275=_0x2fb473;_0x2f04a3=0xc8;}else{_0x2f04a3=0xce;}_0x4572f6['status'](_0x2f04a3);return _0x4572f6[_0x91cb('0x2e')](_0x91cb('0x2f'),_0x468908+'-'+_0x504275+'/'+_0x2fb473)[_0x91cb('0x30')](_0x3b3ee6);}return null;};}function patchUpdates(_0x361e4c){return function(_0xf296bc){try{jsonpatch[_0x91cb('0x31')](_0xf296bc,_0x361e4c,!![]);}catch(_0x1e5bf1){return BPromise[_0x91cb('0x32')](_0x1e5bf1);}return _0xf296bc[_0x91cb('0x33')]();};}function saveUpdates(_0x5e6ed3,_0x2ccf6e){return function(_0x474a15){if(_0x474a15){return _0x474a15[_0x91cb('0x34')](_0x5e6ed3)[_0x91cb('0x1d')](function(_0x440060){return _0x440060;});}return null;};}function removeEntity(_0x4e70cd,_0x2409d3){return function(_0x74b443){if(_0x74b443){return _0x74b443[_0x91cb('0x35')]()[_0x91cb('0x1d')](function(){_0x4e70cd[_0x91cb('0x2b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x121c37,_0x5927cb){return function(_0x47fc17){if(!_0x47fc17){_0x121c37['sendStatus'](0x194);}return _0x47fc17;};}function handleError(_0x2011fc,_0x4bba88){_0x4bba88=_0x4bba88||0x1f4;return function(_0x341ebe){logger['error'](_0x341ebe['stack']);if(_0x341ebe[_0x91cb('0x36')]){delete _0x341ebe[_0x91cb('0x36')];}_0x2011fc[_0x91cb('0x2b')](_0x4bba88)[_0x91cb('0x37')](_0x341ebe);};}exports[_0x91cb('0x38')]=function(_0x4b0ca6,_0x8beb3a){var _0x3ddc0b={},_0x13a5ea={},_0x8496a3={'count':0x0,'rows':[]};var _0x486a89=_['map'](db[_0x91cb('0x39')][_0x91cb('0x3a')],function(_0x56d614){return{'name':_0x56d614[_0x91cb('0x3b')],'type':_0x56d614[_0x91cb('0x3c')]['key']};});_0x13a5ea[_0x91cb('0x3d')]=_[_0x91cb('0x3e')](_0x486a89,'name');_0x13a5ea[_0x91cb('0x3f')]=_['keys'](_0x4b0ca6[_0x91cb('0x3f')]);_0x13a5ea[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x13a5ea[_0x91cb('0x3d')],_0x13a5ea[_0x91cb('0x3f')]);_0x3ddc0b[_0x91cb('0x42')]=_['intersection'](_0x13a5ea[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x4b0ca6['query'][_0x91cb('0x43')]));_0x3ddc0b['attributes']=_0x3ddc0b[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3ddc0b[_0x91cb('0x42')]:_0x13a5ea[_0x91cb('0x3d')];if(!_0x4b0ca6['query'][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3ddc0b[_0x91cb('0x2d')]=qs[_0x91cb('0x2d')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3ddc0b[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x2c')]);}_0x3ddc0b['order']=qs[_0x91cb('0x47')](_0x4b0ca6['query'][_0x91cb('0x47')]);_0x3ddc0b['where']=qs[_0x91cb('0x40')](_['pick'](_0x4b0ca6[_0x91cb('0x3f')],_0x13a5ea[_0x91cb('0x40')]));if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3ddc0b['where']=_[_0x91cb('0x49')](_0x3ddc0b[_0x91cb('0x4a')],{'$or':_['map'](_0x486a89,function(_0x461e1e){if(_0x461e1e[_0x91cb('0x3c')]!==_0x91cb('0x4b')){var _0x32517d={};_0x32517d[_0x461e1e[_0x91cb('0x36')]]={'$like':'%'+_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x32517d;}})});}_0x3ddc0b=_[_0x91cb('0x49')]({},_0x3ddc0b,_0x4b0ca6[_0x91cb('0x4c')]);var _0x4b26f6={'where':_0x3ddc0b[_0x91cb('0x4a')]};return db[_0x91cb('0x39')][_0x91cb('0x4d')](_0x4b26f6)[_0x91cb('0x1d')](function(_0x3314cc){_0x8496a3[_0x91cb('0x4d')]=_0x3314cc;if(_0x4b0ca6[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x3ddc0b['include']=[{'all':!![]}];}return db[_0x91cb('0x39')][_0x91cb('0x4f')](_0x3ddc0b);})[_0x91cb('0x1d')](function(_0x3b8cfd){_0x8496a3['rows']=_0x3b8cfd;return _0x8496a3;})[_0x91cb('0x1d')](respondWithFilteredResult(_0x8beb3a,_0x3ddc0b))[_0x91cb('0x28')](handleError(_0x8beb3a,null));};exports['show']=function(_0x212473,_0x47cdb7){var _0x2c419b={'raw':![],'where':{'id':_0x212473['params']['id']}},_0x4c0acd={};_0x4c0acd['model']=_[_0x91cb('0x50')](db[_0x91cb('0x39')][_0x91cb('0x3a')]);_0x4c0acd[_0x91cb('0x3f')]=_[_0x91cb('0x50')](_0x212473['query']);_0x4c0acd['filters']=_[_0x91cb('0x41')](_0x4c0acd[_0x91cb('0x3d')],_0x4c0acd[_0x91cb('0x3f')]);_0x2c419b[_0x91cb('0x42')]=_['intersection'](_0x4c0acd['model'],qs['fields'](_0x212473[_0x91cb('0x3f')]['fields']));_0x2c419b[_0x91cb('0x42')]=_0x2c419b['attributes'][_0x91cb('0x44')]?_0x2c419b[_0x91cb('0x42')]:_0x4c0acd[_0x91cb('0x3d')];if(_0x212473[_0x91cb('0x3f')][_0x91cb('0x4e')]){_0x2c419b[_0x91cb('0x51')]=[{'all':!![]}];}_0x2c419b=_[_0x91cb('0x49')]({},_0x2c419b,_0x212473[_0x91cb('0x4c')]);return db[_0x91cb('0x39')][_0x91cb('0x52')](_0x2c419b)[_0x91cb('0x1d')](handleEntityNotFound(_0x47cdb7,null))['then'](respondWithResult(_0x47cdb7,null))[_0x91cb('0x28')](handleError(_0x47cdb7,null));};exports[_0x91cb('0x53')]=function(_0x4d7a34,_0x3f719b){return db[_0x91cb('0x39')]['create'](_0x4d7a34[_0x91cb('0x54')],{})[_0x91cb('0x1d')](respondWithResult(_0x3f719b,0xc9))[_0x91cb('0x28')](handleError(_0x3f719b,null));};exports[_0x91cb('0x34')]=function(_0x43ddee,_0x42a9ef){if(_0x43ddee[_0x91cb('0x54')]['id']){delete _0x43ddee[_0x91cb('0x54')]['id'];}return db[_0x91cb('0x39')][_0x91cb('0x52')]({'where':{'id':_0x43ddee[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x42a9ef,null))[_0x91cb('0x1d')](saveUpdates(_0x43ddee['body'],null))[_0x91cb('0x1d')](respondWithResult(_0x42a9ef,null))['catch'](handleError(_0x42a9ef,null));};exports[_0x91cb('0x35')]=function(_0x1b2fec,_0x1986d7){return db['SalesforceAccount'][_0x91cb('0x52')]({'where':{'id':_0x1b2fec[_0x91cb('0x55')]['id']}})['then'](handleEntityNotFound(_0x1986d7,null))[_0x91cb('0x1d')](removeEntity(_0x1986d7,null))[_0x91cb('0x28')](handleError(_0x1986d7,null));};exports[_0x91cb('0x56')]=function(_0x25548b,_0x48e825,_0x2f5658){var _0x3854e9={};var _0x4250c2={};var _0x373076;var _0x55a0e3;return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x25548b['params']['id']}})['then'](handleEntityNotFound(_0x48e825,null))[_0x91cb('0x1d')](function(_0x525021){if(_0x525021){_0x373076=_0x525021;_0x4250c2[_0x91cb('0x3d')]=_[_0x91cb('0x50')](db['SalesforceConfiguration']['rawAttributes']);_0x4250c2[_0x91cb('0x3f')]=_['keys'](_0x25548b[_0x91cb('0x3f')]);_0x4250c2[_0x91cb('0x40')]=_[_0x91cb('0x41')](_0x4250c2['model'],_0x4250c2[_0x91cb('0x3f')]);_0x3854e9['attributes']=_[_0x91cb('0x41')](_0x4250c2[_0x91cb('0x3d')],qs[_0x91cb('0x43')](_0x25548b[_0x91cb('0x3f')]['fields']));_0x3854e9[_0x91cb('0x42')]=_0x3854e9[_0x91cb('0x42')][_0x91cb('0x44')]?_0x3854e9[_0x91cb('0x42')]:_0x4250c2[_0x91cb('0x3d')];_0x3854e9[_0x91cb('0x58')]=qs[_0x91cb('0x47')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x47')]);_0x3854e9[_0x91cb('0x4a')]=qs[_0x91cb('0x40')](_[_0x91cb('0x59')](_0x25548b['query'],_0x4250c2[_0x91cb('0x40')]));if(_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]){_0x3854e9[_0x91cb('0x4a')]=_[_0x91cb('0x49')](_0x3854e9[_0x91cb('0x4a')],{'$or':_[_0x91cb('0x3e')](_0x3854e9['attributes'],function(_0x325b2d){var _0x5a3c7d={};_0x5a3c7d[_0x325b2d]={'$like':'%'+_0x25548b[_0x91cb('0x3f')][_0x91cb('0x48')]+'%'};return _0x5a3c7d;})});}_0x3854e9=_[_0x91cb('0x49')]({},_0x3854e9,_0x25548b[_0x91cb('0x4c')]);return _0x373076['getConfigurations'](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x22ab40){if(_0x22ab40){_0x55a0e3=_0x22ab40[_0x91cb('0x44')];if(!_0x25548b[_0x91cb('0x3f')][_0x91cb('0x45')](_0x91cb('0x46'))){_0x3854e9['limit']=qs[_0x91cb('0x2d')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2d')]);_0x3854e9[_0x91cb('0x2c')]=qs[_0x91cb('0x2c')](_0x25548b[_0x91cb('0x3f')][_0x91cb('0x2c')]);}return _0x373076[_0x91cb('0x56')](_0x3854e9);}})[_0x91cb('0x1d')](function(_0x457f81){if(_0x457f81){return _0x457f81?{'count':_0x55a0e3,'rows':_0x457f81}:null;}})[_0x91cb('0x1d')](respondWithResult(_0x48e825,null))[_0x91cb('0x28')](handleError(_0x48e825,null));};exports[_0x91cb('0x5a')]=function(_0x3eead5,_0x2d2613,_0x2605c3){if(_0x3eead5[_0x91cb('0x54')]['id']){delete _0x3eead5['body']['id'];}return db[_0x91cb('0x39')][_0x91cb('0x57')]({'where':{'id':_0x3eead5['params']['id']}})[_0x91cb('0x1d')](handleEntityNotFound(_0x2d2613,null))[_0x91cb('0x1d')](function(_0x1c3e0a){if(_0x1c3e0a){_0x3eead5['body'][_0x91cb('0x5b')]=_0x1c3e0a['id'];_0x3eead5[_0x91cb('0x54')]['Subjects']=integrations['getSubjects'](_0x3eead5[_0x91cb('0x54')]['channel'],_0x3eead5[_0x91cb('0x54')][_0x91cb('0x3c')]);_0x3eead5['body'][_0x91cb('0x5c')]=integrations['getDescriptions'](_0x3eead5[_0x91cb('0x54')][_0x91cb('0x5d')],_0x3eead5['body']['type']);return db[_0x91cb('0x5e')][_0x91cb('0x53')](_0x3eead5[_0x91cb('0x54')],{'include':[{'model':db['SalesforceField'],'as':_0x91cb('0x5f')},{'model':db[_0x91cb('0x60')],'as':_0x91cb('0x5c')}]});}return null;})[_0x91cb('0x1d')](respondWithResult(_0x2d2613,null))['catch'](handleError(_0x2d2613,null));};exports[_0x91cb('0x61')]=function(_0x4ee1e3,_0x342587,_0x4118eb){var _0x30c607;var _0x281eda='';var _0x5f2418='Task';return db[_0x91cb('0x39')]['findOne']({'where':{'id':_0x4ee1e3[_0x91cb('0x55')]['id']},'attributes':['id',_0x91cb('0x62'),_0x91cb('0x63'),_0x91cb('0x64'),_0x91cb('0x65'),_0x91cb('0x66'),_0x91cb('0x67')]})['then'](handleEntityNotFound(_0x342587,null))[_0x91cb('0x1d')](function(_0x2074fc){if(_0x2074fc){_0x281eda=_0x2074fc['remoteUri'];var _0x10ec48=_0x281eda['slice'](-0x1);if(_0x10ec48==='/'){_0x281eda=_0x281eda[_0x91cb('0x68')](0x0,_0x281eda[_0x91cb('0x69')](_0x10ec48));}_0x30c607=new jsforce[(_0x91cb('0x6a'))]({'oauth2':{'loginUrl':_0x281eda,'clientId':_0x2074fc[_0x91cb('0x63')],'clientSecret':_0x2074fc[_0x91cb('0x64')]}});return _0x30c607[_0x91cb('0x6b')](_0x2074fc[_0x91cb('0x65')],_0x2074fc[_0x91cb('0x66')][_0x91cb('0x6c')](_0x2074fc[_0x91cb('0x67')]));}})[_0x91cb('0x1d')](function(_0x11411d){if(_0x11411d){if(!_[_0x91cb('0x6d')](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x6e')])){_0x5f2418=_0x4ee1e3[_0x91cb('0x3f')]['ticketType'];}return _0x30c607[_0x91cb('0x6f')](_0x5f2418)['describe']();}})[_0x91cb('0x1d')](function(_0x123d72){var _0x13f358=[_0x91cb('0x70'),_0x91cb('0x71'),_0x91cb('0x72'),_0x91cb('0x73'),_0x91cb('0x74'),'Priority',_0x91cb('0x75'),_0x91cb('0x76')];if(!_['isNil'](_0x4ee1e3['query'][_0x91cb('0x6e')])&&_0x4ee1e3['query']['ticketType']===_0x91cb('0x77')){_0x13f358=['Type',_0x91cb('0x78'),'Reason',_0x91cb('0x75'),_0x91cb('0x79'),_0x91cb('0x7a'),_0x91cb('0x7b'),'SuppliedCompany'];}if(_0x123d72){_[_0x91cb('0x7c')](_0x123d72[_0x91cb('0x43')],function(_0x42d07b){return _0x42d07b[_0x91cb('0x7d')]===![]&&!_0x13f358[_0x91cb('0x7e')](_0x42d07b[_0x91cb('0x36')]);});return{'count':_0x123d72[_0x91cb('0x43')][_0x91cb('0x44')],'rows':_[_0x91cb('0x3e')](_0x123d72[_0x91cb('0x43')],function(_0xafda63){return{'id':_0xafda63[_0x91cb('0x36')],'name':_0xafda63[_0x91cb('0x7f')],'custom':_0xafda63[_0x91cb('0x7d')],'options':_0xafda63[_0x91cb('0x80')][_0x91cb('0x44')]>0x0?_[_0x91cb('0x3e')](_0xafda63[_0x91cb('0x80')],function(_0x30640e){return{'name':_0x30640e[_0x91cb('0x7f')],'value':_0x30640e[_0x91cb('0x81')]};}):_0xafda63[_0x91cb('0x3c')]==_0x91cb('0x82')?[{'name':_0x91cb('0x83'),'value':_0x91cb('0x84')},{'name':'False','value':_0x91cb('0x85')}]:[]};})};}})[_0x91cb('0x1d')](respondWithResult(_0x342587,null))[_0x91cb('0x28')](function(_0x1a654b){var _0x320315=_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x86')]?0x1f4:_0x1a654b[_0x91cb('0x87')]||0x1f4;logger[_0x91cb('0x24')](_0x91cb('0x88'),_0x91cb('0x61'),_0x320315,JSON['stringify'](_0x1a654b));delete _0x1a654b[_0x91cb('0x36')];if(_0x320315===0x191){_0x320315=0x190;}_0x342587['status'](_0x320315)['send'](_0x4ee1e3[_0x91cb('0x3f')][_0x91cb('0x86')]?{'message':_0x91cb('0x89'),'statusCode':_0x1a654b[_0x91cb('0x87')]}:_0x1a654b);});}; \ No newline at end of file +var _0x0295=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','options','SalesforceAccount','includeAll','include','findAll','rows','catch','show','params','merge','find','create','body','getConfigurations','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','SalesforceConfiguration','SalesforceField','getFields','clientId','clientSecret','username','securityToken','remoteUri','substring','lastIndexOf','Connection','password','concat','isNil','ticketType','sobject','describe','CallDisposition','CallObject','CallType','IsArchived','Priority','Status','Case','IsEscalated','SuppliedName','SuppliedCompany','custom','label','picklistValues','value','True','False','false','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','statusCode','html-pdf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../components/integrations/configuration','jayson/promise','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(_0x2403ab,_0x5a4ed2){var _0x171f71=function(_0x3f56c4){while(--_0x3f56c4){_0x2403ab['push'](_0x2403ab['shift']());}};_0x171f71(++_0x5a4ed2);}(_0x0295,0x1f0));var _0x5029=function(_0x5a3b09,_0x24a4a3){_0x5a3b09=_0x5a3b09-0x0;var _0x46298a=_0x0295[_0x5a3b09];return _0x46298a;};'use strict';var pdf=require(_0x5029('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x5029('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5029('0x2'));var BPromise=require(_0x5029('0x3'));var Mustache=require(_0x5029('0x4'));var util=require(_0x5029('0x5'));var path=require(_0x5029('0x6'));var sox=require(_0x5029('0x7'));var csv=require(_0x5029('0x8'));var ejs=require(_0x5029('0x9'));var fs=require('fs');var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0x5029('0x14'));var jayson=require(_0x5029('0x15'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x49f836,_0x4aebb6,_0x2484ac){if(_0x2484ac){var _0x2e0369=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2e0369[_0x5029('0x16')](_0x4aebb6)){return _0x49f836;}else{throw new db[(_0x5029('0x17'))][(_0x5029('0x18'))](_0x5029('0x19'));}}else{return _0x49f836;}}function respondWithRpcPromise(_0xe278b7,_0x317c20,_0x10bf55,_0x326923){return new BPromise(function(_0x457c73,_0x353cba){var _0x3786b5=_0x326923||client;return _0x3786b5[_0x5029('0x1a')](_0xe278b7,_0x10bf55)[_0x5029('0x1b')](function(_0x4f7ab4){logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x317c20,_0x5029('0x1e'));logger[_0x5029('0x1f')](_0x5029('0x20'),_0x317c20,_0x5029('0x1e'),JSON[_0x5029('0x21')](_0x4f7ab4));if(_0x4f7ab4['error']){if(_0x4f7ab4[_0x5029('0x22')]['code']===0x1f4){logger[_0x5029('0x22')](_0x5029('0x1d'),_0x317c20,_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);return _0x353cba(_0x4f7ab4['error']['message']);}logger[_0x5029('0x22')]('SalesforceAccount,\x20%s,\x20%s',_0x317c20,_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);return _0x457c73(_0x4f7ab4[_0x5029('0x22')][_0x5029('0x23')]);}else{logger[_0x5029('0x1c')](_0x5029('0x1d'),_0x317c20,_0x5029('0x1e'));_0x457c73(_0x4f7ab4[_0x5029('0x24')][_0x5029('0x23')]);}})['catch'](function(_0x564866){logger['error'](_0x5029('0x1d'),_0x317c20,_0x564866);_0x353cba(_0x564866);});});}function respondWithStatusCode(_0x45666c,_0x51093c){_0x51093c=_0x51093c||0xcc;return function(_0x5727e9){if(_0x5727e9){return _0x45666c[_0x5029('0x25')](_0x51093c);}return _0x45666c[_0x5029('0x26')](_0x51093c)[_0x5029('0x27')]();};}function respondWithResult(_0x5527fc,_0x2c501f){_0x2c501f=_0x2c501f||0xc8;return function(_0xb14bc){if(_0xb14bc){return _0x5527fc['status'](_0x2c501f)[_0x5029('0x28')](_0xb14bc);}};}function respondWithFilteredResult(_0x31f0a0,_0x16ad8b){return function(_0x4a24b9){if(_0x4a24b9){var _0x32da06=_0x4a24b9[_0x5029('0x29')],_0x251f99=_0x16ad8b[_0x5029('0x2a')],_0xe5313e=_0x16ad8b['offset']+_0x16ad8b[_0x5029('0x2b')],_0x4b6f92;if(_0xe5313e>=_0x32da06){_0xe5313e=_0x32da06;_0x4b6f92=0xc8;}else{_0x4b6f92=0xce;}_0x31f0a0[_0x5029('0x26')](_0x4b6f92);return _0x31f0a0[_0x5029('0x2c')](_0x5029('0x2d'),_0x251f99+'-'+_0xe5313e+'/'+_0x32da06)[_0x5029('0x28')](_0x4a24b9);}return null;};}function patchUpdates(_0x2a1ed6){return function(_0x44255a){try{jsonpatch[_0x5029('0x2e')](_0x44255a,_0x2a1ed6,!![]);}catch(_0x250156){return BPromise[_0x5029('0x2f')](_0x250156);}return _0x44255a[_0x5029('0x30')]();};}function saveUpdates(_0x4519c8,_0x4ff3db){return function(_0x11ae38){if(_0x11ae38){return _0x11ae38['update'](_0x4519c8)[_0x5029('0x1b')](function(_0x4f672e){return _0x4f672e;});}return null;};}function removeEntity(_0x48f387,_0x2bc434){return function(_0x447680){if(_0x447680){return _0x447680[_0x5029('0x31')]()['then'](function(){_0x48f387[_0x5029('0x26')](0xcc)[_0x5029('0x27')]();});}};}function handleEntityNotFound(_0x3f20fb,_0x29c59a){return function(_0x1bb896){if(!_0x1bb896){_0x3f20fb[_0x5029('0x25')](0x194);}return _0x1bb896;};}function handleError(_0x46ec59,_0x22205e){_0x22205e=_0x22205e||0x1f4;return function(_0x456cfc){logger['error'](_0x456cfc[_0x5029('0x32')]);if(_0x456cfc[_0x5029('0x33')]){delete _0x456cfc[_0x5029('0x33')];}_0x46ec59[_0x5029('0x26')](_0x22205e)['send'](_0x456cfc);};}exports[_0x5029('0x34')]=function(_0x388cca,_0x3e2d88){var _0x594549={},_0x4904cc={},_0x2d1ccb={'count':0x0,'rows':[]};var _0x17756b=_['map'](db['SalesforceAccount'][_0x5029('0x35')],function(_0x157969){return{'name':_0x157969[_0x5029('0x36')],'type':_0x157969[_0x5029('0x37')][_0x5029('0x38')]};});_0x4904cc[_0x5029('0x39')]=_[_0x5029('0x3a')](_0x17756b,_0x5029('0x33'));_0x4904cc[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x388cca[_0x5029('0x3b')]);_0x4904cc[_0x5029('0x3d')]=_[_0x5029('0x3e')](_0x4904cc[_0x5029('0x39')],_0x4904cc['query']);_0x594549['attributes']=_[_0x5029('0x3e')](_0x4904cc[_0x5029('0x39')],qs[_0x5029('0x3f')](_0x388cca['query'][_0x5029('0x3f')]));_0x594549[_0x5029('0x40')]=_0x594549['attributes'][_0x5029('0x41')]?_0x594549['attributes']:_0x4904cc[_0x5029('0x39')];if(!_0x388cca['query'][_0x5029('0x42')](_0x5029('0x43'))){_0x594549[_0x5029('0x2b')]=qs[_0x5029('0x2b')](_0x388cca[_0x5029('0x3b')][_0x5029('0x2b')]);_0x594549[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x388cca[_0x5029('0x3b')]['offset']);}_0x594549[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x388cca[_0x5029('0x3b')][_0x5029('0x45')]);_0x594549[_0x5029('0x46')]=qs[_0x5029('0x3d')](_['pick'](_0x388cca[_0x5029('0x3b')],_0x4904cc[_0x5029('0x3d')]));if(_0x388cca[_0x5029('0x3b')][_0x5029('0x47')]){_0x594549[_0x5029('0x46')]=_['merge'](_0x594549[_0x5029('0x46')],{'$or':_[_0x5029('0x3a')](_0x17756b,function(_0x248556){if(_0x248556[_0x5029('0x37')]!==_0x5029('0x48')){var _0x128aff={};_0x128aff[_0x248556[_0x5029('0x33')]]={'$like':'%'+_0x388cca[_0x5029('0x3b')][_0x5029('0x47')]+'%'};return _0x128aff;}})});}_0x594549=_['merge']({},_0x594549,_0x388cca[_0x5029('0x49')]);var _0x27d2ad={'where':_0x594549[_0x5029('0x46')]};return db[_0x5029('0x4a')]['count'](_0x27d2ad)['then'](function(_0x17a515){_0x2d1ccb[_0x5029('0x29')]=_0x17a515;if(_0x388cca[_0x5029('0x3b')][_0x5029('0x4b')]){_0x594549[_0x5029('0x4c')]=[{'all':!![]}];}return db[_0x5029('0x4a')][_0x5029('0x4d')](_0x594549);})[_0x5029('0x1b')](function(_0x1257a4){_0x2d1ccb[_0x5029('0x4e')]=_0x1257a4;return _0x2d1ccb;})[_0x5029('0x1b')](respondWithFilteredResult(_0x3e2d88,_0x594549))[_0x5029('0x4f')](handleError(_0x3e2d88,null));};exports[_0x5029('0x50')]=function(_0x18f1f5,_0x3168bd){var _0x175cc0={'raw':![],'where':{'id':_0x18f1f5[_0x5029('0x51')]['id']}},_0x10fc07={};_0x10fc07[_0x5029('0x39')]=_[_0x5029('0x3c')](db[_0x5029('0x4a')]['rawAttributes']);_0x10fc07[_0x5029('0x3b')]=_['keys'](_0x18f1f5[_0x5029('0x3b')]);_0x10fc07[_0x5029('0x3d')]=_['intersection'](_0x10fc07['model'],_0x10fc07[_0x5029('0x3b')]);_0x175cc0['attributes']=_['intersection'](_0x10fc07[_0x5029('0x39')],qs[_0x5029('0x3f')](_0x18f1f5[_0x5029('0x3b')]['fields']));_0x175cc0['attributes']=_0x175cc0[_0x5029('0x40')][_0x5029('0x41')]?_0x175cc0['attributes']:_0x10fc07[_0x5029('0x39')];if(_0x18f1f5['query'][_0x5029('0x4b')]){_0x175cc0['include']=[{'all':!![]}];}_0x175cc0=_[_0x5029('0x52')]({},_0x175cc0,_0x18f1f5[_0x5029('0x49')]);return db[_0x5029('0x4a')][_0x5029('0x53')](_0x175cc0)[_0x5029('0x1b')](handleEntityNotFound(_0x3168bd,null))[_0x5029('0x1b')](respondWithResult(_0x3168bd,null))[_0x5029('0x4f')](handleError(_0x3168bd,null));};exports[_0x5029('0x54')]=function(_0x586936,_0x1df044){return db['SalesforceAccount'][_0x5029('0x54')](_0x586936[_0x5029('0x55')],{})['then'](respondWithResult(_0x1df044,0xc9))[_0x5029('0x4f')](handleError(_0x1df044,null));};exports['update']=function(_0x58928f,_0x55c57c){if(_0x58928f[_0x5029('0x55')]['id']){delete _0x58928f['body']['id'];}return db[_0x5029('0x4a')][_0x5029('0x53')]({'where':{'id':_0x58928f[_0x5029('0x51')]['id']}})['then'](handleEntityNotFound(_0x55c57c,null))[_0x5029('0x1b')](saveUpdates(_0x58928f['body'],null))['then'](respondWithResult(_0x55c57c,null))[_0x5029('0x4f')](handleError(_0x55c57c,null));};exports[_0x5029('0x31')]=function(_0x81e39c,_0x448273){return db[_0x5029('0x4a')]['find']({'where':{'id':_0x81e39c[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0x448273,null))[_0x5029('0x1b')](removeEntity(_0x448273,null))[_0x5029('0x4f')](handleError(_0x448273,null));};exports['getConfigurations']=function(_0x33812b,_0xfffc0d,_0x4d4a2d){var _0x512de9={};var _0x2afd44={};var _0x4685a6;var _0x1263ba;return db[_0x5029('0x4a')]['findOne']({'where':{'id':_0x33812b[_0x5029('0x51')]['id']}})[_0x5029('0x1b')](handleEntityNotFound(_0xfffc0d,null))[_0x5029('0x1b')](function(_0x2aebb3){if(_0x2aebb3){_0x4685a6=_0x2aebb3;_0x2afd44[_0x5029('0x39')]=_[_0x5029('0x3c')](db['SalesforceConfiguration']['rawAttributes']);_0x2afd44[_0x5029('0x3b')]=_[_0x5029('0x3c')](_0x33812b[_0x5029('0x3b')]);_0x2afd44['filters']=_[_0x5029('0x3e')](_0x2afd44[_0x5029('0x39')],_0x2afd44[_0x5029('0x3b')]);_0x512de9[_0x5029('0x40')]=_[_0x5029('0x3e')](_0x2afd44['model'],qs[_0x5029('0x3f')](_0x33812b[_0x5029('0x3b')][_0x5029('0x3f')]));_0x512de9['attributes']=_0x512de9[_0x5029('0x40')]['length']?_0x512de9[_0x5029('0x40')]:_0x2afd44['model'];_0x512de9[_0x5029('0x44')]=qs[_0x5029('0x45')](_0x33812b[_0x5029('0x3b')][_0x5029('0x45')]);_0x512de9[_0x5029('0x46')]=qs[_0x5029('0x3d')](_['pick'](_0x33812b[_0x5029('0x3b')],_0x2afd44[_0x5029('0x3d')]));if(_0x33812b[_0x5029('0x3b')][_0x5029('0x47')]){_0x512de9[_0x5029('0x46')]=_['merge'](_0x512de9[_0x5029('0x46')],{'$or':_['map'](_0x512de9[_0x5029('0x40')],function(_0x539f80){var _0xacab3={};_0xacab3[_0x539f80]={'$like':'%'+_0x33812b['query'][_0x5029('0x47')]+'%'};return _0xacab3;})});}_0x512de9=_['merge']({},_0x512de9,_0x33812b['options']);return _0x4685a6[_0x5029('0x56')](_0x512de9);}})['then'](function(_0x2d2a40){if(_0x2d2a40){_0x1263ba=_0x2d2a40[_0x5029('0x41')];if(!_0x33812b[_0x5029('0x3b')]['hasOwnProperty'](_0x5029('0x43'))){_0x512de9['limit']=qs[_0x5029('0x2b')](_0x33812b[_0x5029('0x3b')][_0x5029('0x2b')]);_0x512de9[_0x5029('0x2a')]=qs[_0x5029('0x2a')](_0x33812b['query'][_0x5029('0x2a')]);}return _0x4685a6[_0x5029('0x56')](_0x512de9);}})['then'](function(_0x6500bb){if(_0x6500bb){return _0x6500bb?{'count':_0x1263ba,'rows':_0x6500bb}:null;}})[_0x5029('0x1b')](respondWithResult(_0xfffc0d,null))[_0x5029('0x4f')](handleError(_0xfffc0d,null));};exports[_0x5029('0x57')]=function(_0x9b1c13,_0x1bd1c6,_0x5bd84e){if(_0x9b1c13['body']['id']){delete _0x9b1c13[_0x5029('0x55')]['id'];}return db['SalesforceAccount'][_0x5029('0x58')]({'where':{'id':_0x9b1c13[_0x5029('0x51')]['id']}})['then'](handleEntityNotFound(_0x1bd1c6,null))[_0x5029('0x1b')](function(_0x574d06){if(_0x574d06){_0x9b1c13['body'][_0x5029('0x59')]=_0x574d06['id'];_0x9b1c13[_0x5029('0x55')][_0x5029('0x5a')]=integrations[_0x5029('0x5b')](_0x9b1c13['body'][_0x5029('0x5c')],_0x9b1c13[_0x5029('0x55')]['type']);_0x9b1c13[_0x5029('0x55')][_0x5029('0x5d')]=integrations['getDescriptions'](_0x9b1c13['body']['channel'],_0x9b1c13[_0x5029('0x55')][_0x5029('0x37')]);return db[_0x5029('0x5e')][_0x5029('0x54')](_0x9b1c13[_0x5029('0x55')],{'include':[{'model':db[_0x5029('0x5f')],'as':_0x5029('0x5a')},{'model':db[_0x5029('0x5f')],'as':_0x5029('0x5d')}]});}return null;})['then'](respondWithResult(_0x1bd1c6,null))['catch'](handleError(_0x1bd1c6,null));};exports[_0x5029('0x60')]=function(_0x413f9e,_0xf51086,_0x15906f){var _0x2d8c9a;var _0x3f5115='';var _0x459230='Task';return db[_0x5029('0x4a')][_0x5029('0x58')]({'where':{'id':_0x413f9e[_0x5029('0x51')]['id']},'attributes':['id','remoteUri',_0x5029('0x61'),_0x5029('0x62'),_0x5029('0x63'),'password',_0x5029('0x64')]})[_0x5029('0x1b')](handleEntityNotFound(_0xf51086,null))[_0x5029('0x1b')](function(_0x50af55){if(_0x50af55){_0x3f5115=_0x50af55[_0x5029('0x65')];var _0x145616=_0x3f5115['slice'](-0x1);if(_0x145616==='/'){_0x3f5115=_0x3f5115[_0x5029('0x66')](0x0,_0x3f5115[_0x5029('0x67')](_0x145616));}_0x2d8c9a=new jsforce[(_0x5029('0x68'))]({'oauth2':{'loginUrl':_0x3f5115,'clientId':_0x50af55[_0x5029('0x61')],'clientSecret':_0x50af55[_0x5029('0x62')]}});return _0x2d8c9a['login'](_0x50af55[_0x5029('0x63')],_0x50af55[_0x5029('0x69')][_0x5029('0x6a')](_0x50af55[_0x5029('0x64')]));}})[_0x5029('0x1b')](function(_0x5e7f50){if(_0x5e7f50){if(!_[_0x5029('0x6b')](_0x413f9e[_0x5029('0x3b')][_0x5029('0x6c')])){_0x459230=_0x413f9e['query'][_0x5029('0x6c')];}return _0x2d8c9a[_0x5029('0x6d')](_0x459230)[_0x5029('0x6e')]();}})[_0x5029('0x1b')](function(_0x1b3860){var _0x320a91=[_0x5029('0x6f'),'CallDurationInSeconds',_0x5029('0x70'),_0x5029('0x71'),_0x5029('0x72'),_0x5029('0x73'),_0x5029('0x74'),'Type'];if(!_[_0x5029('0x6b')](_0x413f9e[_0x5029('0x3b')][_0x5029('0x6c')])&&_0x413f9e['query'][_0x5029('0x6c')]===_0x5029('0x75')){_0x320a91=['Type','Origin','Reason',_0x5029('0x74'),_0x5029('0x73'),_0x5029('0x76'),_0x5029('0x77'),_0x5029('0x78')];}if(_0x1b3860){_['remove'](_0x1b3860[_0x5029('0x3f')],function(_0x2e4782){return _0x2e4782[_0x5029('0x79')]===![]&&!_0x320a91['includes'](_0x2e4782['name']);});return{'count':_0x1b3860[_0x5029('0x3f')][_0x5029('0x41')],'rows':_[_0x5029('0x3a')](_0x1b3860[_0x5029('0x3f')],function(_0x597381){return{'id':_0x597381[_0x5029('0x33')],'name':_0x597381[_0x5029('0x7a')],'custom':_0x597381[_0x5029('0x79')],'options':_0x597381[_0x5029('0x7b')][_0x5029('0x41')]>0x0?_[_0x5029('0x3a')](_0x597381[_0x5029('0x7b')],function(_0xe4b730){return{'name':_0xe4b730['label'],'value':_0xe4b730[_0x5029('0x7c')]};}):_0x597381['type']=='boolean'?[{'name':_0x5029('0x7d'),'value':'true'},{'name':_0x5029('0x7e'),'value':_0x5029('0x7f')}]:[]};})};}})[_0x5029('0x1b')](respondWithResult(_0xf51086,null))[_0x5029('0x4f')](function(_0x1b6f4c){var _0x227d13=_0x413f9e[_0x5029('0x3b')][_0x5029('0x16')]?0x1f4:_0x1b6f4c['statusCode']||0x1f4;logger['error'](_0x5029('0x80'),'getFields',_0x227d13,JSON['stringify'](_0x1b6f4c));delete _0x1b6f4c[_0x5029('0x33')];if(_0x227d13===0x191){_0x227d13=0x190;}_0xf51086['status'](_0x227d13)['send'](_0x413f9e[_0x5029('0x3b')][_0x5029('0x16')]?{'message':_0x5029('0x81'),'statusCode':_0x1b6f4c[_0x5029('0x82')]}:_0x1b6f4c);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 56964e9..a5412d0 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 _0x5f9a=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x1cfe20,_0x121d39){var _0x4ded09=function(_0x279441){while(--_0x279441){_0x1cfe20['push'](_0x1cfe20['shift']());}};_0x4ded09(++_0x121d39);}(_0x5f9a,0x114));var _0xa5f9=function(_0x4d70d2,_0x3e0ed5){_0x4d70d2=_0x4d70d2-0x0;var _0x25629a=_0x5f9a[_0x4d70d2];return _0x25629a;};'use strict';var _=require(_0xa5f9('0x0'));var util=require(_0xa5f9('0x1'));var logger=require(_0xa5f9('0x2'))(_0xa5f9('0x3'));var moment=require(_0xa5f9('0x4'));var BPromise=require(_0xa5f9('0x5'));var rp=require(_0xa5f9('0x6'));var fs=require('fs');var path=require(_0xa5f9('0x7'));var rimraf=require(_0xa5f9('0x8'));var config=require('../../config/environment');var attributes=require(_0xa5f9('0x9'));var integrations=require(_0xa5f9('0xa'));module[_0xa5f9('0xb')]=function(_0x21b0c5,_0x29353b){return _0x21b0c5['define']('SalesforceAccount',attributes,{'tableName':'int_salesforce_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6672=['../../config/logger','api','moment','bluebird','../../config/environment','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts','lodash'];(function(_0x4b0211,_0x17f347){var _0x1906fc=function(_0x9e2459){while(--_0x9e2459){_0x4b0211['push'](_0x4b0211['shift']());}};_0x1906fc(++_0x17f347);}(_0x6672,0x107));var _0x2667=function(_0x2f2a6f,_0xe63e10){_0x2f2a6f=_0x2f2a6f-0x0;var _0x14441d=_0x6672[_0x2f2a6f];return _0x14441d;};'use strict';var _=require(_0x2667('0x0'));var util=require('util');var logger=require(_0x2667('0x1'))(_0x2667('0x2'));var moment=require(_0x2667('0x3'));var BPromise=require(_0x2667('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2667('0x5'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require(_0x2667('0x6'));module[_0x2667('0x7')]=function(_0x5ae443,_0x2e1cf6){return _0x5ae443[_0x2667('0x8')](_0x2667('0x9'),attributes,{'tableName':_0x2667('0xa'),'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 4b1e67d..2adddf4 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 _0xb43b=['GetSalesforceAccount','SalesforceAccount','findAll','raw','options','where','limit','include','model','attributes','map','then','ShowSalesforceAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','info','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SalesforceAccount,\x20%s,\x20%s','catch'];(function(_0x229302,_0x4f89a9){var _0x27fd2f=function(_0x115305){while(--_0x115305){_0x229302['push'](_0x229302['shift']());}};_0x27fd2f(++_0x4f89a9);}(_0xb43b,0x1b2));var _0xbb43=function(_0x4246a4,_0x266a5f){_0x4246a4=_0x4246a4-0x0;var _0x42d751=_0xb43b[_0x4246a4];return _0x42d751;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('SalesforceAccount,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});}exports[_0xbb43('0x15')]=function(_0x2e3b43){var _0x55dd73=this;return new Promise(function(_0x1c16d7,_0x4f28b8){return db[_0xbb43('0x16')][_0xbb43('0x17')]({'raw':_0x2e3b43['options']?_0x2e3b43['options'][_0xbb43('0x18')]===undefined?!![]:![]:!![],'where':_0x2e3b43[_0xbb43('0x19')]?_0x2e3b43[_0xbb43('0x19')][_0xbb43('0x1a')]||null:null,'attributes':_0x2e3b43['options']?_0x2e3b43[_0xbb43('0x19')]['attributes']||null:null,'limit':_0x2e3b43[_0xbb43('0x19')]?_0x2e3b43['options'][_0xbb43('0x1b')]||null:null,'include':_0x2e3b43['options']?_0x2e3b43[_0xbb43('0x19')][_0xbb43('0x1c')]?_['map'](_0x2e3b43[_0xbb43('0x19')]['include'],function(_0xf24e60){return{'model':db[_0xf24e60[_0xbb43('0x1d')]],'as':_0xf24e60['as'],'attributes':_0xf24e60[_0xbb43('0x1e')],'include':_0xf24e60['include']?_['map'](_0xf24e60['include'],function(_0x269ca5){return{'model':db[_0x269ca5[_0xbb43('0x1d')]],'as':_0x269ca5['as'],'attributes':_0x269ca5['attributes'],'include':_0x269ca5[_0xbb43('0x1c')]?_[_0xbb43('0x1f')](_0x269ca5[_0xbb43('0x1c')],function(_0x3874fb){return{'model':db[_0x3874fb['model']],'as':_0x3874fb['as'],'attributes':_0x3874fb['attributes']};}):[]};}):[]};}):[]:[]})[_0xbb43('0x20')](function(_0x42800f){logger[_0xbb43('0xb')](_0xbb43('0x15'),_0x2e3b43);logger[_0xbb43('0xd')](_0xbb43('0x15'),_0x2e3b43,JSON[_0xbb43('0xf')](_0x42800f));_0x1c16d7(_0x42800f);})[_0xbb43('0x14')](function(_0x539730){logger[_0xbb43('0x10')]('GetSalesforceAccount',_0x539730[_0xbb43('0x12')],_0x2e3b43);_0x4f28b8(_0x55dd73[_0xbb43('0x10')](0x1f4,_0x539730[_0xbb43('0x12')]));});});};exports[_0xbb43('0x21')]=function(_0x555b99){var _0x157d62=this;return new Promise(function(_0x547a6f,_0x5566cf){return db['SalesforceAccount'][_0xbb43('0x22')]({'raw':_0x555b99['options']?_0x555b99[_0xbb43('0x19')][_0xbb43('0x18')]===undefined?!![]:![]:!![],'where':_0x555b99[_0xbb43('0x19')]?_0x555b99['options'][_0xbb43('0x1a')]||null:null,'attributes':_0x555b99[_0xbb43('0x19')]?_0x555b99[_0xbb43('0x19')][_0xbb43('0x1e')]||null:null,'include':_0x555b99[_0xbb43('0x19')]?_0x555b99[_0xbb43('0x19')][_0xbb43('0x1c')]?_[_0xbb43('0x1f')](_0x555b99['options'][_0xbb43('0x1c')],function(_0x3961f5){return{'model':db[_0x3961f5[_0xbb43('0x1d')]],'as':_0x3961f5['as'],'attributes':_0x3961f5[_0xbb43('0x1e')],'include':_0x3961f5[_0xbb43('0x1c')]?_[_0xbb43('0x1f')](_0x3961f5[_0xbb43('0x1c')],function(_0x342714){return{'model':db[_0x342714[_0xbb43('0x1d')]],'as':_0x342714['as'],'attributes':_0x342714[_0xbb43('0x1e')],'include':_0x342714[_0xbb43('0x1c')]?_[_0xbb43('0x1f')](_0x342714[_0xbb43('0x1c')],function(_0x33f45c){return{'model':db[_0x33f45c[_0xbb43('0x1d')]],'as':_0x33f45c['as'],'attributes':_0x33f45c[_0xbb43('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x39cbd7){logger[_0xbb43('0xb')]('ShowSalesforceAccount',_0x555b99);logger[_0xbb43('0xd')](_0xbb43('0x21'),_0x555b99,JSON[_0xbb43('0xf')](_0x39cbd7));_0x547a6f(_0x39cbd7);})['catch'](function(_0x5f4601){logger['error'](_0xbb43('0x21'),_0x5f4601[_0xbb43('0x12')],_0x555b99);_0x5566cf(_0x157d62['error'](0x1f4,_0x5f4601['message']));});});}; \ No newline at end of file +var _0xf72b=['then','debug','catch','ShowSalesforceAccount','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','SalesforceAccount,\x20%s,\x20%s','request\x20sent','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model'];(function(_0x49cfdd,_0x25a4f4){var _0x2fe375=function(_0x3bf6ed){while(--_0x3bf6ed){_0x49cfdd['push'](_0x49cfdd['shift']());}};_0x2fe375(++_0x25a4f4);}(_0xf72b,0x1d9));var _0xbf72=function(_0x367d55,_0x15bd4a){_0x367d55=_0x367d55-0x0;var _0x2c1db9=_0xf72b[_0x367d55];return _0x2c1db9;};'use strict';var _=require(_0xbf72('0x0'));var util=require('util');var moment=require(_0xbf72('0x1'));var BPromise=require('bluebird');var rs=require(_0xbf72('0x2'));var fs=require('fs');var Redis=require(_0xbf72('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xbf72('0x4'));var logger=require(_0xbf72('0x5'))(_0xbf72('0x6'));var config=require(_0xbf72('0x7'));var jayson=require(_0xbf72('0x8'));var client=jayson[_0xbf72('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41c11d,_0xc0842b,_0x119807){return new BPromise(function(_0xd0402c,_0xdd6177){return client[_0xbf72('0xa')](_0x41c11d,_0x119807)['then'](function(_0x455891){logger['info'](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));logger['debug'](_0xbf72('0xd'),_0xc0842b,_0xbf72('0xc'),JSON[_0xbf72('0xe')](_0x455891));if(_0x455891[_0xbf72('0xf')]){if(_0x455891[_0xbf72('0xf')][_0xbf72('0x10')]===0x1f4){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x455891['error'][_0xbf72('0x11')]);return _0xdd6177(_0x455891[_0xbf72('0xf')][_0xbf72('0x11')]);}logger['error'](_0xbf72('0xb'),_0xc0842b,_0x455891['error']['message']);return _0xd0402c(_0x455891['error'][_0xbf72('0x11')]);}else{logger[_0xbf72('0x12')](_0xbf72('0xb'),_0xc0842b,_0xbf72('0xc'));_0xd0402c(_0x455891[_0xbf72('0x13')][_0xbf72('0x11')]);}})['catch'](function(_0x266ce2){logger[_0xbf72('0xf')](_0xbf72('0xb'),_0xc0842b,_0x266ce2);_0xdd6177(_0x266ce2);});});}exports[_0xbf72('0x14')]=function(_0x27dadc){var _0x5b5fc9=this;return new Promise(function(_0x51d4c9,_0x1b8d73){return db[_0xbf72('0x15')][_0xbf72('0x16')]({'raw':_0x27dadc[_0xbf72('0x17')]?_0x27dadc[_0xbf72('0x17')][_0xbf72('0x18')]===undefined?!![]:![]:!![],'where':_0x27dadc[_0xbf72('0x17')]?_0x27dadc['options'][_0xbf72('0x19')]||null:null,'attributes':_0x27dadc[_0xbf72('0x17')]?_0x27dadc[_0xbf72('0x17')][_0xbf72('0x1a')]||null:null,'limit':_0x27dadc[_0xbf72('0x17')]?_0x27dadc['options'][_0xbf72('0x1b')]||null:null,'include':_0x27dadc[_0xbf72('0x17')]?_0x27dadc['options'][_0xbf72('0x1c')]?_[_0xbf72('0x1d')](_0x27dadc[_0xbf72('0x17')]['include'],function(_0x44f3f9){return{'model':db[_0x44f3f9[_0xbf72('0x1e')]],'as':_0x44f3f9['as'],'attributes':_0x44f3f9[_0xbf72('0x1a')],'include':_0x44f3f9[_0xbf72('0x1c')]?_['map'](_0x44f3f9[_0xbf72('0x1c')],function(_0x392a8c){return{'model':db[_0x392a8c[_0xbf72('0x1e')]],'as':_0x392a8c['as'],'attributes':_0x392a8c['attributes'],'include':_0x392a8c[_0xbf72('0x1c')]?_[_0xbf72('0x1d')](_0x392a8c[_0xbf72('0x1c')],function(_0x1a2f55){return{'model':db[_0x1a2f55[_0xbf72('0x1e')]],'as':_0x1a2f55['as'],'attributes':_0x1a2f55[_0xbf72('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbf72('0x1f')](function(_0x25ecdf){logger[_0xbf72('0x12')](_0xbf72('0x14'),_0x27dadc);logger[_0xbf72('0x20')](_0xbf72('0x14'),_0x27dadc,JSON[_0xbf72('0xe')](_0x25ecdf));_0x51d4c9(_0x25ecdf);})[_0xbf72('0x21')](function(_0x37a233){logger['error'](_0xbf72('0x14'),_0x37a233[_0xbf72('0x11')],_0x27dadc);_0x1b8d73(_0x5b5fc9[_0xbf72('0xf')](0x1f4,_0x37a233[_0xbf72('0x11')]));});});};exports[_0xbf72('0x22')]=function(_0x82c0f0){var _0x35ecdc=this;return new Promise(function(_0x209b2b,_0x1be26a){return db[_0xbf72('0x15')][_0xbf72('0x23')]({'raw':_0x82c0f0[_0xbf72('0x17')]?_0x82c0f0[_0xbf72('0x17')][_0xbf72('0x18')]===undefined?!![]:![]:!![],'where':_0x82c0f0['options']?_0x82c0f0[_0xbf72('0x17')][_0xbf72('0x19')]||null:null,'attributes':_0x82c0f0[_0xbf72('0x17')]?_0x82c0f0['options']['attributes']||null:null,'include':_0x82c0f0['options']?_0x82c0f0[_0xbf72('0x17')][_0xbf72('0x1c')]?_[_0xbf72('0x1d')](_0x82c0f0['options'][_0xbf72('0x1c')],function(_0x4c9662){return{'model':db[_0x4c9662['model']],'as':_0x4c9662['as'],'attributes':_0x4c9662[_0xbf72('0x1a')],'include':_0x4c9662['include']?_[_0xbf72('0x1d')](_0x4c9662[_0xbf72('0x1c')],function(_0x5c2f60){return{'model':db[_0x5c2f60['model']],'as':_0x5c2f60['as'],'attributes':_0x5c2f60[_0xbf72('0x1a')],'include':_0x5c2f60[_0xbf72('0x1c')]?_[_0xbf72('0x1d')](_0x5c2f60[_0xbf72('0x1c')],function(_0x297c59){return{'model':db[_0x297c59[_0xbf72('0x1e')]],'as':_0x297c59['as'],'attributes':_0x297c59[_0xbf72('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xbf72('0x1f')](function(_0x269b8e){logger['info'](_0xbf72('0x22'),_0x82c0f0);logger[_0xbf72('0x20')](_0xbf72('0x22'),_0x82c0f0,JSON[_0xbf72('0xe')](_0x269b8e));_0x209b2b(_0x269b8e);})['catch'](function(_0xd0a1a8){logger[_0xbf72('0xf')]('ShowSalesforceAccount',_0xd0a1a8[_0xbf72('0x11')],_0x82c0f0);_0x1be26a(_0x35ecdc['error'](0x1f4,_0xd0a1a8['message']));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index cf082ec..22d08ef 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 _0xd5a8=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','/:id','show','/:id/fields','get','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer'];(function(_0x3dcdb8,_0x4bada8){var _0x344920=function(_0x1a5c80){while(--_0x1a5c80){_0x3dcdb8['push'](_0x3dcdb8['shift']());}};_0x344920(++_0x4bada8);}(_0xd5a8,0x1e3));var _0x8d5a=function(_0x1d8d45,_0x5048dd){_0x1d8d45=_0x1d8d45-0x0;var _0x305b41=_0xd5a8[_0x1d8d45];return _0x305b41;};'use strict';var multer=require(_0x8d5a('0x0'));var util=require(_0x8d5a('0x1'));var path=require(_0x8d5a('0x2'));var timeout=require('connect-timeout');var express=require(_0x8d5a('0x3'));var router=express['Router']();var auth=require(_0x8d5a('0x4'));var interaction=require(_0x8d5a('0x5'));var config=require(_0x8d5a('0x6'));var controller=require('./intSalesforceConfiguration.controller');router['get']('/',auth[_0x8d5a('0x7')](),controller[_0x8d5a('0x8')]);router['get'](_0x8d5a('0x9'),auth['isAuthenticated'](),controller[_0x8d5a('0xa')]);router['get'](_0x8d5a('0xb'),auth['isAuthenticated'](),controller['getFields']);router[_0x8d5a('0xc')]('/:id/subjects',auth[_0x8d5a('0x7')](),controller['getSubjects']);router[_0x8d5a('0xc')](_0x8d5a('0xd'),auth['isAuthenticated'](),controller[_0x8d5a('0xe')]);router[_0x8d5a('0xf')]('/',auth[_0x8d5a('0x7')](),controller[_0x8d5a('0x10')]);router[_0x8d5a('0x11')](_0x8d5a('0x9'),auth[_0x8d5a('0x7')](),controller[_0x8d5a('0x12')]);router[_0x8d5a('0x13')]('/:id',auth[_0x8d5a('0x7')](),controller[_0x8d5a('0x14')]);module[_0x8d5a('0x15')]=router; \ No newline at end of file +var _0xc337=['./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','update','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc337,0x170));var _0x7c33=function(_0x5ca268,_0x293286){_0x5ca268=_0x5ca268-0x0;var _0x52e674=_0xc337[_0x5ca268];return _0x52e674;};'use strict';var multer=require('multer');var util=require(_0x7c33('0x0'));var path=require(_0x7c33('0x1'));var timeout=require(_0x7c33('0x2'));var express=require(_0x7c33('0x3'));var router=express['Router']();var auth=require(_0x7c33('0x4'));var interaction=require(_0x7c33('0x5'));var config=require('../../config/environment');var controller=require(_0x7c33('0x6'));router[_0x7c33('0x7')]('/',auth[_0x7c33('0x8')](),controller[_0x7c33('0x9')]);router['get'](_0x7c33('0xa'),auth['isAuthenticated'](),controller[_0x7c33('0xb')]);router[_0x7c33('0x7')](_0x7c33('0xc'),auth[_0x7c33('0x8')](),controller[_0x7c33('0xd')]);router[_0x7c33('0x7')](_0x7c33('0xe'),auth['isAuthenticated'](),controller[_0x7c33('0xf')]);router['get'](_0x7c33('0x10'),auth['isAuthenticated'](),controller[_0x7c33('0x11')]);router[_0x7c33('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x7c33('0xa'),auth[_0x7c33('0x8')](),controller[_0x7c33('0x13')]);router['delete'](_0x7c33('0xa'),auth[_0x7c33('0x8')](),controller[_0x7c33('0x14')]);module[_0x7c33('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3ad62ec..6674409 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 _0x7236=['lead','sequelize','STRING','Task','Case','ENUM','contact_lead','contact'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0x7236,0x179));var _0x6723=function(_0x45c51a,_0x1da5b8){_0x45c51a=_0x45c51a-0x0;var _0x30f8eb=_0x7236[_0x45c51a];return _0x30f8eb;};'use strict';var Sequelize=require(_0x6723('0x0'));module['exports']={'name':{'type':Sequelize[_0x6723('0x1')]},'description':{'type':Sequelize[_0x6723('0x1')]},'ticketType':{'type':Sequelize['ENUM'](_0x6723('0x2'),_0x6723('0x3')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0x6723('0x4')](_0x6723('0x5'),_0x6723('0x6'),_0x6723('0x7')),'defaultValue':_0x6723('0x5')},'moduleCreate':{'type':Sequelize['ENUM']('nothing','contact','lead'),'defaultValue':_0x6723('0x7')}}; \ No newline at end of file +var _0xdc4d=['contact_lead','nothing','lead','sequelize','exports','STRING','ENUM','Case','contact'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0xdc4d,0xc0));var _0xddc4=function(_0x519bb9,_0x53a0ae){_0x519bb9=_0x519bb9-0x0;var _0x33ef17=_0xdc4d[_0x519bb9];return _0x33ef17;};'use strict';var Sequelize=require(_0xddc4('0x0'));module[_0xddc4('0x1')]={'name':{'type':Sequelize[_0xddc4('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0xddc4('0x3')]('Task',_0xddc4('0x4')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize[_0xddc4('0x3')]('contact_lead',_0xddc4('0x5'),'lead'),'defaultValue':_0xddc4('0x6')},'moduleCreate':{'type':Sequelize[_0xddc4('0x3')](_0xddc4('0x7'),_0xddc4('0x5'),_0xddc4('0x8')),'defaultValue':_0xddc4('0x8')}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index ac8ceb5..14d1d10 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 _0xc59f=['../../config/environment','../../mysqldb','client','test','Sequelize','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','destroy','stack','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','show','params','includeAll','create','body','find','getFields','findOne','SalesforceField','hasOwnProperty','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x2a2b1e,_0x3cc9ce){var _0x309286=function(_0x4bc61b){while(--_0x4bc61b){_0x2a2b1e['push'](_0x2a2b1e['shift']());}};_0x309286(++_0x3cc9ce);}(_0xc59f,0xf9));var _0xfc59=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc59f[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xfc59('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfc59('0x1'));var zipdir=require(_0xfc59('0x2'));var jsonpatch=require(_0xfc59('0x3'));var rp=require(_0xfc59('0x4'));var moment=require(_0xfc59('0x5'));var BPromise=require(_0xfc59('0x6'));var Mustache=require(_0xfc59('0x7'));var util=require(_0xfc59('0x8'));var path=require('path');var sox=require(_0xfc59('0x9'));var csv=require(_0xfc59('0xa'));var ejs=require(_0xfc59('0xb'));var fs=require('fs');var _=require(_0xfc59('0xc'));var squel=require(_0xfc59('0xd'));var crypto=require(_0xfc59('0xe'));var jsforce=require(_0xfc59('0xf'));var deskjs=require(_0xfc59('0x10'));var toCsv=require(_0xfc59('0xa'));var querystring=require(_0xfc59('0x11'));var Papa=require('papaparse');var Redis=require(_0xfc59('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfc59('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfc59('0x14'));var logger=require(_0xfc59('0x15'))(_0xfc59('0x16'));var utils=require(_0xfc59('0x17'));var config=require(_0xfc59('0x18'));var db=require(_0xfc59('0x19'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xfc59('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x422d8a,_0x36cbaa,_0x3b2286){if(_0x3b2286){var _0x476dc8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x476dc8[_0xfc59('0x1b')](_0x36cbaa)){return _0x422d8a;}else{throw new db[(_0xfc59('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 _0x422d8a;}}function respondWithRpcPromise(_0x33c7bf,_0x3a2876,_0x42c7fa,_0x2ec783){return new BPromise(function(_0x5df911,_0x38e4c9){var _0x24bcd4=_0x2ec783||client;return _0x24bcd4['request'](_0x33c7bf,_0x42c7fa)[_0xfc59('0x1d')](function(_0x39e86f){logger['info'](_0xfc59('0x1e'),_0x3a2876,_0xfc59('0x1f'));logger['debug'](_0xfc59('0x20'),_0x3a2876,_0xfc59('0x1f'),JSON[_0xfc59('0x21')](_0x39e86f));if(_0x39e86f[_0xfc59('0x22')]){if(_0x39e86f[_0xfc59('0x22')][_0xfc59('0x23')]===0x1f4){logger[_0xfc59('0x22')](_0xfc59('0x1e'),_0x3a2876,_0x39e86f[_0xfc59('0x22')]['message']);return _0x38e4c9(_0x39e86f[_0xfc59('0x22')][_0xfc59('0x24')]);}logger['error'](_0xfc59('0x1e'),_0x3a2876,_0x39e86f[_0xfc59('0x22')][_0xfc59('0x24')]);return _0x5df911(_0x39e86f[_0xfc59('0x22')][_0xfc59('0x24')]);}else{logger['info'](_0xfc59('0x1e'),_0x3a2876,_0xfc59('0x1f'));_0x5df911(_0x39e86f['result'][_0xfc59('0x24')]);}})[_0xfc59('0x25')](function(_0x1dfdc6){logger[_0xfc59('0x22')]('SalesforceConfiguration,\x20%s,\x20%s',_0x3a2876,_0x1dfdc6);_0x38e4c9(_0x1dfdc6);});});}function respondWithStatusCode(_0xda9ff8,_0x36467b){_0x36467b=_0x36467b||0xcc;return function(_0x5c24eb){if(_0x5c24eb){return _0xda9ff8[_0xfc59('0x26')](_0x36467b);}return _0xda9ff8[_0xfc59('0x27')](_0x36467b)[_0xfc59('0x28')]();};}function respondWithResult(_0x2c2efb,_0x47da91){_0x47da91=_0x47da91||0xc8;return function(_0xef824b){if(_0xef824b){return _0x2c2efb[_0xfc59('0x27')](_0x47da91)[_0xfc59('0x29')](_0xef824b);}};}function respondWithFilteredResult(_0x4117de,_0x4df541){return function(_0x573804){if(_0x573804){var _0xd40785=_0x573804[_0xfc59('0x2a')],_0x32bf78=_0x4df541[_0xfc59('0x2b')],_0x46a046=_0x4df541[_0xfc59('0x2b')]+_0x4df541[_0xfc59('0x2c')],_0x39b345;if(_0x46a046>=_0xd40785){_0x46a046=_0xd40785;_0x39b345=0xc8;}else{_0x39b345=0xce;}_0x4117de[_0xfc59('0x27')](_0x39b345);return _0x4117de[_0xfc59('0x2d')]('Content-Range',_0x32bf78+'-'+_0x46a046+'/'+_0xd40785)[_0xfc59('0x29')](_0x573804);}return null;};}function patchUpdates(_0x1c2413){return function(_0x26979a){try{jsonpatch[_0xfc59('0x2e')](_0x26979a,_0x1c2413,!![]);}catch(_0x24a519){return BPromise[_0xfc59('0x2f')](_0x24a519);}return _0x26979a[_0xfc59('0x30')]();};}function saveUpdates(_0x52a3c5,_0x5df4b4){return function(_0x337616){if(_0x337616){return _0x337616[_0xfc59('0x31')](_0x52a3c5)[_0xfc59('0x1d')](function(_0x4e9964){return _0x4e9964;});}return null;};}function removeEntity(_0x249b9b,_0x574d03){return function(_0x284d2c){if(_0x284d2c){return _0x284d2c[_0xfc59('0x32')]()[_0xfc59('0x1d')](function(){_0x249b9b[_0xfc59('0x27')](0xcc)[_0xfc59('0x28')]();});}};}function handleEntityNotFound(_0x5873be,_0x2850eb){return function(_0x33c29f){if(!_0x33c29f){_0x5873be['sendStatus'](0x194);}return _0x33c29f;};}function handleError(_0x38b403,_0x4d0df0){_0x4d0df0=_0x4d0df0||0x1f4;return function(_0x46f3d0){logger[_0xfc59('0x22')](_0x46f3d0[_0xfc59('0x33')]);if(_0x46f3d0[_0xfc59('0x34')]){delete _0x46f3d0[_0xfc59('0x34')];}_0x38b403[_0xfc59('0x27')](_0x4d0df0)[_0xfc59('0x35')](_0x46f3d0);};}exports[_0xfc59('0x36')]=function(_0x247983,_0x521d01){var _0x52f1c5={},_0x45c11e={},_0x3b51c5={'count':0x0,'rows':[]};var _0x479883=_[_0xfc59('0x37')](db[_0xfc59('0x38')][_0xfc59('0x39')],function(_0x4fe0b8){return{'name':_0x4fe0b8[_0xfc59('0x3a')],'type':_0x4fe0b8['type']['key']};});_0x45c11e[_0xfc59('0x3b')]=_[_0xfc59('0x37')](_0x479883,'name');_0x45c11e[_0xfc59('0x3c')]=_[_0xfc59('0x3d')](_0x247983[_0xfc59('0x3c')]);_0x45c11e[_0xfc59('0x3e')]=_['intersection'](_0x45c11e['model'],_0x45c11e[_0xfc59('0x3c')]);_0x52f1c5[_0xfc59('0x3f')]=_[_0xfc59('0x40')](_0x45c11e[_0xfc59('0x3b')],qs[_0xfc59('0x41')](_0x247983[_0xfc59('0x3c')][_0xfc59('0x41')]));_0x52f1c5[_0xfc59('0x3f')]=_0x52f1c5[_0xfc59('0x3f')][_0xfc59('0x42')]?_0x52f1c5['attributes']:_0x45c11e[_0xfc59('0x3b')];if(!_0x247983[_0xfc59('0x3c')]['hasOwnProperty'](_0xfc59('0x43'))){_0x52f1c5[_0xfc59('0x2c')]=qs['limit'](_0x247983[_0xfc59('0x3c')][_0xfc59('0x2c')]);_0x52f1c5[_0xfc59('0x2b')]=qs[_0xfc59('0x2b')](_0x247983['query'][_0xfc59('0x2b')]);}_0x52f1c5[_0xfc59('0x44')]=qs[_0xfc59('0x45')](_0x247983[_0xfc59('0x3c')][_0xfc59('0x45')]);_0x52f1c5[_0xfc59('0x46')]=qs[_0xfc59('0x3e')](_[_0xfc59('0x47')](_0x247983[_0xfc59('0x3c')],_0x45c11e[_0xfc59('0x3e')]));if(_0x247983[_0xfc59('0x3c')][_0xfc59('0x48')]){_0x52f1c5[_0xfc59('0x46')]=_[_0xfc59('0x49')](_0x52f1c5[_0xfc59('0x46')],{'$or':_[_0xfc59('0x37')](_0x479883,function(_0x258f39){if(_0x258f39[_0xfc59('0x4a')]!==_0xfc59('0x4b')){var _0x497b97={};_0x497b97[_0x258f39['name']]={'$like':'%'+_0x247983[_0xfc59('0x3c')][_0xfc59('0x48')]+'%'};return _0x497b97;}})});}_0x52f1c5=_[_0xfc59('0x49')]({},_0x52f1c5,_0x247983[_0xfc59('0x4c')]);var _0x592abd={'where':_0x52f1c5[_0xfc59('0x46')]};return db['SalesforceConfiguration'][_0xfc59('0x2a')](_0x592abd)['then'](function(_0x3302ae){_0x3b51c5[_0xfc59('0x2a')]=_0x3302ae;if(_0x247983[_0xfc59('0x3c')]['includeAll']){_0x52f1c5[_0xfc59('0x4d')]=[{'all':!![]}];}return db[_0xfc59('0x38')][_0xfc59('0x4e')](_0x52f1c5);})[_0xfc59('0x1d')](function(_0x5e2047){_0x3b51c5['rows']=_0x5e2047;return _0x3b51c5;})['then'](respondWithFilteredResult(_0x521d01,_0x52f1c5))[_0xfc59('0x25')](handleError(_0x521d01,null));};exports[_0xfc59('0x4f')]=function(_0x4f1612,_0x4eb2c1){var _0xb76d93={'raw':![],'where':{'id':_0x4f1612[_0xfc59('0x50')]['id']}},_0x28b5f0={};_0x28b5f0[_0xfc59('0x3b')]=_[_0xfc59('0x3d')](db[_0xfc59('0x38')][_0xfc59('0x39')]);_0x28b5f0['query']=_['keys'](_0x4f1612[_0xfc59('0x3c')]);_0x28b5f0[_0xfc59('0x3e')]=_[_0xfc59('0x40')](_0x28b5f0[_0xfc59('0x3b')],_0x28b5f0[_0xfc59('0x3c')]);_0xb76d93[_0xfc59('0x3f')]=_[_0xfc59('0x40')](_0x28b5f0[_0xfc59('0x3b')],qs[_0xfc59('0x41')](_0x4f1612[_0xfc59('0x3c')][_0xfc59('0x41')]));_0xb76d93['attributes']=_0xb76d93[_0xfc59('0x3f')][_0xfc59('0x42')]?_0xb76d93[_0xfc59('0x3f')]:_0x28b5f0[_0xfc59('0x3b')];if(_0x4f1612[_0xfc59('0x3c')][_0xfc59('0x51')]){_0xb76d93[_0xfc59('0x4d')]=[{'all':!![]}];}_0xb76d93=_[_0xfc59('0x49')]({},_0xb76d93,_0x4f1612[_0xfc59('0x4c')]);return db[_0xfc59('0x38')]['find'](_0xb76d93)[_0xfc59('0x1d')](handleEntityNotFound(_0x4eb2c1,null))[_0xfc59('0x1d')](respondWithResult(_0x4eb2c1,null))['catch'](handleError(_0x4eb2c1,null));};exports[_0xfc59('0x52')]=function(_0x618409,_0x465c0f){return db[_0xfc59('0x38')]['create'](_0x618409[_0xfc59('0x53')],{})[_0xfc59('0x1d')](respondWithResult(_0x465c0f,0xc9))['catch'](handleError(_0x465c0f,null));};exports['update']=function(_0x1a03f2,_0x290fa6){if(_0x1a03f2[_0xfc59('0x53')]['id']){delete _0x1a03f2['body']['id'];}return db[_0xfc59('0x38')][_0xfc59('0x54')]({'where':{'id':_0x1a03f2[_0xfc59('0x50')]['id']}})[_0xfc59('0x1d')](handleEntityNotFound(_0x290fa6,null))[_0xfc59('0x1d')](saveUpdates(_0x1a03f2['body'],null))[_0xfc59('0x1d')](respondWithResult(_0x290fa6,null))[_0xfc59('0x25')](handleError(_0x290fa6,null));};exports[_0xfc59('0x32')]=function(_0x285bce,_0x192b68){return db[_0xfc59('0x38')]['find']({'where':{'id':_0x285bce[_0xfc59('0x50')]['id']}})[_0xfc59('0x1d')](handleEntityNotFound(_0x192b68,null))[_0xfc59('0x1d')](removeEntity(_0x192b68,null))[_0xfc59('0x25')](handleError(_0x192b68,null));};exports[_0xfc59('0x55')]=function(_0x385513,_0x4fe627,_0x22a305){var _0x1eaab7={};var _0x2ec776={};var _0x505558;var _0x205973;return db[_0xfc59('0x38')][_0xfc59('0x56')]({'where':{'id':_0x385513[_0xfc59('0x50')]['id']}})[_0xfc59('0x1d')](handleEntityNotFound(_0x4fe627,null))[_0xfc59('0x1d')](function(_0x13342f){if(_0x13342f){_0x505558=_0x13342f;_0x2ec776['model']=_[_0xfc59('0x3d')](db[_0xfc59('0x57')][_0xfc59('0x39')]);_0x2ec776[_0xfc59('0x3c')]=_['keys'](_0x385513['query']);_0x2ec776['filters']=_[_0xfc59('0x40')](_0x2ec776[_0xfc59('0x3b')],_0x2ec776[_0xfc59('0x3c')]);_0x1eaab7['attributes']=_[_0xfc59('0x40')](_0x2ec776[_0xfc59('0x3b')],qs[_0xfc59('0x41')](_0x385513[_0xfc59('0x3c')][_0xfc59('0x41')]));_0x1eaab7['attributes']=_0x1eaab7['attributes'][_0xfc59('0x42')]?_0x1eaab7[_0xfc59('0x3f')]:_0x2ec776[_0xfc59('0x3b')];_0x1eaab7[_0xfc59('0x44')]=qs[_0xfc59('0x45')](_0x385513[_0xfc59('0x3c')][_0xfc59('0x45')]);_0x1eaab7[_0xfc59('0x46')]=qs['filters'](_[_0xfc59('0x47')](_0x385513[_0xfc59('0x3c')],_0x2ec776[_0xfc59('0x3e')]));if(_0x385513[_0xfc59('0x3c')][_0xfc59('0x48')]){_0x1eaab7['where']=_[_0xfc59('0x49')](_0x1eaab7[_0xfc59('0x46')],{'$or':_['map'](_0x1eaab7['attributes'],function(_0x1a7c5d){var _0x8eabc7={};_0x8eabc7[_0x1a7c5d]={'$like':'%'+_0x385513[_0xfc59('0x3c')][_0xfc59('0x48')]+'%'};return _0x8eabc7;})});}_0x1eaab7=_[_0xfc59('0x49')]({},_0x1eaab7,_0x385513[_0xfc59('0x4c')]);return _0x505558['getFields'](_0x1eaab7);}})[_0xfc59('0x1d')](function(_0x46a5a3){if(_0x46a5a3){_0x205973=_0x46a5a3[_0xfc59('0x42')];if(!_0x385513[_0xfc59('0x3c')][_0xfc59('0x58')](_0xfc59('0x43'))){_0x1eaab7[_0xfc59('0x2c')]=qs[_0xfc59('0x2c')](_0x385513[_0xfc59('0x3c')][_0xfc59('0x2c')]);_0x1eaab7[_0xfc59('0x2b')]=qs[_0xfc59('0x2b')](_0x385513[_0xfc59('0x3c')][_0xfc59('0x2b')]);}return _0x505558['getFields'](_0x1eaab7);}})['then'](function(_0x5dc3dc){if(_0x5dc3dc){return _0x5dc3dc?{'count':_0x205973,'rows':_0x5dc3dc}:null;}})['then'](respondWithResult(_0x4fe627,null))[_0xfc59('0x25')](handleError(_0x4fe627,null));};exports[_0xfc59('0x59')]=function(_0x1b9187,_0x393f1f,_0x52e1b9){var _0x20a63a={};var _0x34ebba={};var _0x347b36;var _0x5242c3;return db[_0xfc59('0x38')][_0xfc59('0x56')]({'where':{'id':_0x1b9187['params']['id']}})['then'](handleEntityNotFound(_0x393f1f,null))[_0xfc59('0x1d')](function(_0x396437){if(_0x396437){_0x347b36=_0x396437;_0x34ebba[_0xfc59('0x3b')]=_[_0xfc59('0x3d')](db[_0xfc59('0x57')][_0xfc59('0x39')]);_0x34ebba[_0xfc59('0x3c')]=_[_0xfc59('0x3d')](_0x1b9187[_0xfc59('0x3c')]);_0x34ebba[_0xfc59('0x3e')]=_[_0xfc59('0x40')](_0x34ebba[_0xfc59('0x3b')],_0x34ebba['query']);_0x20a63a['attributes']=_['intersection'](_0x34ebba[_0xfc59('0x3b')],qs[_0xfc59('0x41')](_0x1b9187[_0xfc59('0x3c')]['fields']));_0x20a63a[_0xfc59('0x3f')]=_0x20a63a[_0xfc59('0x3f')][_0xfc59('0x42')]?_0x20a63a[_0xfc59('0x3f')]:_0x34ebba[_0xfc59('0x3b')];_0x20a63a[_0xfc59('0x44')]=qs[_0xfc59('0x45')](_0x1b9187[_0xfc59('0x3c')][_0xfc59('0x45')]);_0x20a63a[_0xfc59('0x46')]=qs[_0xfc59('0x3e')](_['pick'](_0x1b9187[_0xfc59('0x3c')],_0x34ebba[_0xfc59('0x3e')]));if(_0x1b9187[_0xfc59('0x3c')][_0xfc59('0x48')]){_0x20a63a[_0xfc59('0x46')]=_[_0xfc59('0x49')](_0x20a63a[_0xfc59('0x46')],{'$or':_[_0xfc59('0x37')](_0x20a63a['attributes'],function(_0x5c99aa){var _0x5f3bd9={};_0x5f3bd9[_0x5c99aa]={'$like':'%'+_0x1b9187['query'][_0xfc59('0x48')]+'%'};return _0x5f3bd9;})});}_0x20a63a=_[_0xfc59('0x49')]({},_0x20a63a,_0x1b9187[_0xfc59('0x4c')]);return _0x347b36[_0xfc59('0x59')](_0x20a63a);}})[_0xfc59('0x1d')](function(_0x43970e){if(_0x43970e){_0x5242c3=_0x43970e[_0xfc59('0x42')];if(!_0x1b9187[_0xfc59('0x3c')]['hasOwnProperty']('nolimit')){_0x20a63a[_0xfc59('0x2c')]=qs[_0xfc59('0x2c')](_0x1b9187[_0xfc59('0x3c')]['limit']);_0x20a63a[_0xfc59('0x2b')]=qs['offset'](_0x1b9187[_0xfc59('0x3c')]['offset']);}return _0x347b36[_0xfc59('0x59')](_0x20a63a);}})[_0xfc59('0x1d')](function(_0x31ea75){if(_0x31ea75){return _0x31ea75?{'count':_0x5242c3,'rows':_0x31ea75}:null;}})[_0xfc59('0x1d')](respondWithResult(_0x393f1f,null))[_0xfc59('0x25')](handleError(_0x393f1f,null));};exports[_0xfc59('0x5a')]=function(_0x129372,_0x108776,_0x2ad7c9){var _0xf8165f={};var _0x5b3659={};var _0x1070ff;var _0xce2a50;return db[_0xfc59('0x38')][_0xfc59('0x56')]({'where':{'id':_0x129372[_0xfc59('0x50')]['id']}})[_0xfc59('0x1d')](handleEntityNotFound(_0x108776,null))[_0xfc59('0x1d')](function(_0x34e962){if(_0x34e962){_0x1070ff=_0x34e962;_0x5b3659[_0xfc59('0x3b')]=_[_0xfc59('0x3d')](db[_0xfc59('0x57')]['rawAttributes']);_0x5b3659['query']=_[_0xfc59('0x3d')](_0x129372[_0xfc59('0x3c')]);_0x5b3659[_0xfc59('0x3e')]=_[_0xfc59('0x40')](_0x5b3659[_0xfc59('0x3b')],_0x5b3659['query']);_0xf8165f[_0xfc59('0x3f')]=_[_0xfc59('0x40')](_0x5b3659[_0xfc59('0x3b')],qs['fields'](_0x129372[_0xfc59('0x3c')]['fields']));_0xf8165f['attributes']=_0xf8165f['attributes'][_0xfc59('0x42')]?_0xf8165f[_0xfc59('0x3f')]:_0x5b3659[_0xfc59('0x3b')];_0xf8165f[_0xfc59('0x44')]=qs['sort'](_0x129372[_0xfc59('0x3c')][_0xfc59('0x45')]);_0xf8165f['where']=qs[_0xfc59('0x3e')](_['pick'](_0x129372[_0xfc59('0x3c')],_0x5b3659['filters']));if(_0x129372[_0xfc59('0x3c')][_0xfc59('0x48')]){_0xf8165f[_0xfc59('0x46')]=_['merge'](_0xf8165f[_0xfc59('0x46')],{'$or':_[_0xfc59('0x37')](_0xf8165f[_0xfc59('0x3f')],function(_0x3526d8){var _0x31367f={};_0x31367f[_0x3526d8]={'$like':'%'+_0x129372[_0xfc59('0x3c')][_0xfc59('0x48')]+'%'};return _0x31367f;})});}_0xf8165f=_[_0xfc59('0x49')]({},_0xf8165f,_0x129372[_0xfc59('0x4c')]);return _0x1070ff['getDescriptions'](_0xf8165f);}})[_0xfc59('0x1d')](function(_0x456daa){if(_0x456daa){_0xce2a50=_0x456daa['length'];if(!_0x129372[_0xfc59('0x3c')][_0xfc59('0x58')]('nolimit')){_0xf8165f['limit']=qs['limit'](_0x129372[_0xfc59('0x3c')][_0xfc59('0x2c')]);_0xf8165f['offset']=qs[_0xfc59('0x2b')](_0x129372['query'][_0xfc59('0x2b')]);}return _0x1070ff[_0xfc59('0x5a')](_0xf8165f);}})['then'](function(_0x1788e9){if(_0x1788e9){return _0x1788e9?{'count':_0xce2a50,'rows':_0x1788e9}:null;}})[_0xfc59('0x1d')](respondWithResult(_0x108776,null))[_0xfc59('0x25')](handleError(_0x108776,null));}; \ No newline at end of file +var _0x4e06=['offset','limit','set','Content-Range','apply','reject','update','then','destroy','stack','name','map','SalesforceConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','getFields','findOne','SalesforceField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','count'];(function(_0x39fb91,_0x13635f){var _0x1d764a=function(_0x3a1ece){while(--_0x3a1ece){_0x39fb91['push'](_0x39fb91['shift']());}};_0x1d764a(++_0x13635f);}(_0x4e06,0xec));var _0x64e0=function(_0x10f316,_0x5822db){_0x10f316=_0x10f316-0x0;var _0x568d7e=_0x4e06[_0x10f316];return _0x568d7e;};'use strict';var pdf=require(_0x64e0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x64e0('0x1'));var zipdir=require(_0x64e0('0x2'));var jsonpatch=require(_0x64e0('0x3'));var rp=require(_0x64e0('0x4'));var moment=require(_0x64e0('0x5'));var BPromise=require(_0x64e0('0x6'));var Mustache=require(_0x64e0('0x7'));var util=require(_0x64e0('0x8'));var path=require(_0x64e0('0x9'));var sox=require(_0x64e0('0xa'));var csv=require(_0x64e0('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x64e0('0xc'));var crypto=require('crypto');var jsforce=require(_0x64e0('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x64e0('0xb'));var querystring=require(_0x64e0('0xe'));var Papa=require(_0x64e0('0xf'));var Redis=require(_0x64e0('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x64e0('0x11'));var as=require(_0x64e0('0x12'));var hardwareService=require(_0x64e0('0x13'));var logger=require('../../config/logger')(_0x64e0('0x14'));var utils=require(_0x64e0('0x15'));var config=require(_0x64e0('0x16'));var db=require(_0x64e0('0x17'))['db'];var jayson=require(_0x64e0('0x18'));var client=jayson[_0x64e0('0x19')][_0x64e0('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x1bcc18,_0x425990,_0x25f496){if(_0x25f496){var _0xdc92f4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xdc92f4[_0x64e0('0x1b')](_0x425990)){return _0x1bcc18;}else{throw new db[(_0x64e0('0x1c'))][(_0x64e0('0x1d'))](_0x64e0('0x1e'));}}else{return _0x1bcc18;}}function respondWithRpcPromise(_0x1c3481,_0x4f9f9c,_0x29c596,_0x2ff606){return new BPromise(function(_0x144cca,_0x2ae109){var _0x5cec18=_0x2ff606||client;return _0x5cec18[_0x64e0('0x1f')](_0x1c3481,_0x29c596)['then'](function(_0x1c977a){logger[_0x64e0('0x20')](_0x64e0('0x21'),_0x4f9f9c,_0x64e0('0x22'));logger['debug'](_0x64e0('0x23'),_0x4f9f9c,_0x64e0('0x22'),JSON['stringify'](_0x1c977a));if(_0x1c977a[_0x64e0('0x24')]){if(_0x1c977a[_0x64e0('0x24')][_0x64e0('0x25')]===0x1f4){logger[_0x64e0('0x24')](_0x64e0('0x21'),_0x4f9f9c,_0x1c977a[_0x64e0('0x24')][_0x64e0('0x26')]);return _0x2ae109(_0x1c977a['error']['message']);}logger['error'](_0x64e0('0x21'),_0x4f9f9c,_0x1c977a[_0x64e0('0x24')][_0x64e0('0x26')]);return _0x144cca(_0x1c977a[_0x64e0('0x24')][_0x64e0('0x26')]);}else{logger[_0x64e0('0x20')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4f9f9c,_0x64e0('0x22'));_0x144cca(_0x1c977a[_0x64e0('0x27')][_0x64e0('0x26')]);}})[_0x64e0('0x28')](function(_0x36b95c){logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x4f9f9c,_0x36b95c);_0x2ae109(_0x36b95c);});});}function respondWithStatusCode(_0x49e145,_0x1b6fb0){_0x1b6fb0=_0x1b6fb0||0xcc;return function(_0x25e1ba){if(_0x25e1ba){return _0x49e145[_0x64e0('0x29')](_0x1b6fb0);}return _0x49e145[_0x64e0('0x2a')](_0x1b6fb0)[_0x64e0('0x2b')]();};}function respondWithResult(_0x5102af,_0x595ab6){_0x595ab6=_0x595ab6||0xc8;return function(_0x4b6ae4){if(_0x4b6ae4){return _0x5102af[_0x64e0('0x2a')](_0x595ab6)[_0x64e0('0x2c')](_0x4b6ae4);}};}function respondWithFilteredResult(_0x40a359,_0xa68aad){return function(_0x41c6ab){if(_0x41c6ab){var _0x2da3cf=_0x41c6ab[_0x64e0('0x2d')],_0x129759=_0xa68aad['offset'],_0x91f39=_0xa68aad[_0x64e0('0x2e')]+_0xa68aad[_0x64e0('0x2f')],_0x3c5eec;if(_0x91f39>=_0x2da3cf){_0x91f39=_0x2da3cf;_0x3c5eec=0xc8;}else{_0x3c5eec=0xce;}_0x40a359[_0x64e0('0x2a')](_0x3c5eec);return _0x40a359[_0x64e0('0x30')](_0x64e0('0x31'),_0x129759+'-'+_0x91f39+'/'+_0x2da3cf)[_0x64e0('0x2c')](_0x41c6ab);}return null;};}function patchUpdates(_0x2067b0){return function(_0x4b5956){try{jsonpatch[_0x64e0('0x32')](_0x4b5956,_0x2067b0,!![]);}catch(_0xad98b){return BPromise[_0x64e0('0x33')](_0xad98b);}return _0x4b5956['save']();};}function saveUpdates(_0x2ccccc,_0x550494){return function(_0x5f4e1f){if(_0x5f4e1f){return _0x5f4e1f[_0x64e0('0x34')](_0x2ccccc)[_0x64e0('0x35')](function(_0x13005b){return _0x13005b;});}return null;};}function removeEntity(_0x4a1259,_0x37eb99){return function(_0x3f4c90){if(_0x3f4c90){return _0x3f4c90[_0x64e0('0x36')]()[_0x64e0('0x35')](function(){_0x4a1259['status'](0xcc)[_0x64e0('0x2b')]();});}};}function handleEntityNotFound(_0x8a6b48,_0x54f3c7){return function(_0x3dae4c){if(!_0x3dae4c){_0x8a6b48['sendStatus'](0x194);}return _0x3dae4c;};}function handleError(_0x5b1192,_0x2fb87a){_0x2fb87a=_0x2fb87a||0x1f4;return function(_0x56f685){logger[_0x64e0('0x24')](_0x56f685[_0x64e0('0x37')]);if(_0x56f685[_0x64e0('0x38')]){delete _0x56f685[_0x64e0('0x38')];}_0x5b1192[_0x64e0('0x2a')](_0x2fb87a)['send'](_0x56f685);};}exports['index']=function(_0x338188,_0x2a7b23){var _0x53d6f6={},_0x38b309={},_0x2cc4e8={'count':0x0,'rows':[]};var _0x3ee976=_[_0x64e0('0x39')](db[_0x64e0('0x3a')][_0x64e0('0x3b')],function(_0x364b57){return{'name':_0x364b57[_0x64e0('0x3c')],'type':_0x364b57[_0x64e0('0x3d')][_0x64e0('0x3e')]};});_0x38b309[_0x64e0('0x3f')]=_[_0x64e0('0x39')](_0x3ee976,'name');_0x38b309[_0x64e0('0x40')]=_[_0x64e0('0x41')](_0x338188[_0x64e0('0x40')]);_0x38b309[_0x64e0('0x42')]=_['intersection'](_0x38b309[_0x64e0('0x3f')],_0x38b309['query']);_0x53d6f6['attributes']=_[_0x64e0('0x43')](_0x38b309[_0x64e0('0x3f')],qs[_0x64e0('0x44')](_0x338188[_0x64e0('0x40')]['fields']));_0x53d6f6[_0x64e0('0x45')]=_0x53d6f6[_0x64e0('0x45')][_0x64e0('0x46')]?_0x53d6f6[_0x64e0('0x45')]:_0x38b309[_0x64e0('0x3f')];if(!_0x338188[_0x64e0('0x40')][_0x64e0('0x47')](_0x64e0('0x48'))){_0x53d6f6['limit']=qs[_0x64e0('0x2f')](_0x338188['query'][_0x64e0('0x2f')]);_0x53d6f6[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x338188[_0x64e0('0x40')][_0x64e0('0x2e')]);}_0x53d6f6[_0x64e0('0x49')]=qs[_0x64e0('0x4a')](_0x338188[_0x64e0('0x40')]['sort']);_0x53d6f6[_0x64e0('0x4b')]=qs['filters'](_[_0x64e0('0x4c')](_0x338188[_0x64e0('0x40')],_0x38b309['filters']));if(_0x338188['query'][_0x64e0('0x4d')]){_0x53d6f6[_0x64e0('0x4b')]=_[_0x64e0('0x4e')](_0x53d6f6['where'],{'$or':_[_0x64e0('0x39')](_0x3ee976,function(_0x3516bc){if(_0x3516bc['type']!==_0x64e0('0x4f')){var _0x51e5fb={};_0x51e5fb[_0x3516bc[_0x64e0('0x38')]]={'$like':'%'+_0x338188[_0x64e0('0x40')][_0x64e0('0x4d')]+'%'};return _0x51e5fb;}})});}_0x53d6f6=_['merge']({},_0x53d6f6,_0x338188[_0x64e0('0x50')]);var _0xd18799={'where':_0x53d6f6[_0x64e0('0x4b')]};return db[_0x64e0('0x3a')]['count'](_0xd18799)[_0x64e0('0x35')](function(_0x2e6ff7){_0x2cc4e8['count']=_0x2e6ff7;if(_0x338188[_0x64e0('0x40')][_0x64e0('0x51')]){_0x53d6f6[_0x64e0('0x52')]=[{'all':!![]}];}return db[_0x64e0('0x3a')][_0x64e0('0x53')](_0x53d6f6);})[_0x64e0('0x35')](function(_0x40f091){_0x2cc4e8['rows']=_0x40f091;return _0x2cc4e8;})[_0x64e0('0x35')](respondWithFilteredResult(_0x2a7b23,_0x53d6f6))['catch'](handleError(_0x2a7b23,null));};exports[_0x64e0('0x54')]=function(_0x49b4f7,_0x9e9097){var _0x426a56={'raw':![],'where':{'id':_0x49b4f7[_0x64e0('0x55')]['id']}},_0x3a391c={};_0x3a391c[_0x64e0('0x3f')]=_['keys'](db['SalesforceConfiguration']['rawAttributes']);_0x3a391c[_0x64e0('0x40')]=_[_0x64e0('0x41')](_0x49b4f7[_0x64e0('0x40')]);_0x3a391c[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x3a391c[_0x64e0('0x3f')],_0x3a391c[_0x64e0('0x40')]);_0x426a56[_0x64e0('0x45')]=_[_0x64e0('0x43')](_0x3a391c['model'],qs['fields'](_0x49b4f7[_0x64e0('0x40')][_0x64e0('0x44')]));_0x426a56['attributes']=_0x426a56[_0x64e0('0x45')][_0x64e0('0x46')]?_0x426a56[_0x64e0('0x45')]:_0x3a391c[_0x64e0('0x3f')];if(_0x49b4f7['query']['includeAll']){_0x426a56[_0x64e0('0x52')]=[{'all':!![]}];}_0x426a56=_[_0x64e0('0x4e')]({},_0x426a56,_0x49b4f7[_0x64e0('0x50')]);return db[_0x64e0('0x3a')][_0x64e0('0x56')](_0x426a56)[_0x64e0('0x35')](handleEntityNotFound(_0x9e9097,null))[_0x64e0('0x35')](respondWithResult(_0x9e9097,null))[_0x64e0('0x28')](handleError(_0x9e9097,null));};exports[_0x64e0('0x57')]=function(_0x445aa4,_0x32e981){return db[_0x64e0('0x3a')]['create'](_0x445aa4['body'],{})[_0x64e0('0x35')](respondWithResult(_0x32e981,0xc9))['catch'](handleError(_0x32e981,null));};exports[_0x64e0('0x34')]=function(_0x30bb35,_0xb2ac77){if(_0x30bb35[_0x64e0('0x58')]['id']){delete _0x30bb35[_0x64e0('0x58')]['id'];}return db[_0x64e0('0x3a')][_0x64e0('0x56')]({'where':{'id':_0x30bb35['params']['id']}})[_0x64e0('0x35')](handleEntityNotFound(_0xb2ac77,null))[_0x64e0('0x35')](saveUpdates(_0x30bb35[_0x64e0('0x58')],null))['then'](respondWithResult(_0xb2ac77,null))[_0x64e0('0x28')](handleError(_0xb2ac77,null));};exports[_0x64e0('0x36')]=function(_0x2d8b31,_0x1e27b5){return db[_0x64e0('0x3a')]['find']({'where':{'id':_0x2d8b31[_0x64e0('0x55')]['id']}})[_0x64e0('0x35')](handleEntityNotFound(_0x1e27b5,null))['then'](removeEntity(_0x1e27b5,null))[_0x64e0('0x28')](handleError(_0x1e27b5,null));};exports[_0x64e0('0x59')]=function(_0x3a291c,_0x15f2df,_0x3f4706){var _0x58478a={};var _0x12f605={};var _0x12b8ce;var _0x1ea391;return db['SalesforceConfiguration'][_0x64e0('0x5a')]({'where':{'id':_0x3a291c[_0x64e0('0x55')]['id']}})[_0x64e0('0x35')](handleEntityNotFound(_0x15f2df,null))[_0x64e0('0x35')](function(_0x58ebd8){if(_0x58ebd8){_0x12b8ce=_0x58ebd8;_0x12f605[_0x64e0('0x3f')]=_[_0x64e0('0x41')](db[_0x64e0('0x5b')][_0x64e0('0x3b')]);_0x12f605[_0x64e0('0x40')]=_[_0x64e0('0x41')](_0x3a291c[_0x64e0('0x40')]);_0x12f605[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x12f605[_0x64e0('0x3f')],_0x12f605['query']);_0x58478a[_0x64e0('0x45')]=_[_0x64e0('0x43')](_0x12f605[_0x64e0('0x3f')],qs['fields'](_0x3a291c[_0x64e0('0x40')][_0x64e0('0x44')]));_0x58478a[_0x64e0('0x45')]=_0x58478a[_0x64e0('0x45')]['length']?_0x58478a[_0x64e0('0x45')]:_0x12f605['model'];_0x58478a[_0x64e0('0x49')]=qs[_0x64e0('0x4a')](_0x3a291c['query'][_0x64e0('0x4a')]);_0x58478a['where']=qs[_0x64e0('0x42')](_[_0x64e0('0x4c')](_0x3a291c['query'],_0x12f605[_0x64e0('0x42')]));if(_0x3a291c[_0x64e0('0x40')]['filter']){_0x58478a[_0x64e0('0x4b')]=_[_0x64e0('0x4e')](_0x58478a[_0x64e0('0x4b')],{'$or':_[_0x64e0('0x39')](_0x58478a[_0x64e0('0x45')],function(_0x284952){var _0x4f7d57={};_0x4f7d57[_0x284952]={'$like':'%'+_0x3a291c['query'][_0x64e0('0x4d')]+'%'};return _0x4f7d57;})});}_0x58478a=_[_0x64e0('0x4e')]({},_0x58478a,_0x3a291c['options']);return _0x12b8ce[_0x64e0('0x59')](_0x58478a);}})[_0x64e0('0x35')](function(_0x45962d){if(_0x45962d){_0x1ea391=_0x45962d[_0x64e0('0x46')];if(!_0x3a291c[_0x64e0('0x40')][_0x64e0('0x47')](_0x64e0('0x48'))){_0x58478a[_0x64e0('0x2f')]=qs[_0x64e0('0x2f')](_0x3a291c[_0x64e0('0x40')][_0x64e0('0x2f')]);_0x58478a[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x3a291c[_0x64e0('0x40')][_0x64e0('0x2e')]);}return _0x12b8ce[_0x64e0('0x59')](_0x58478a);}})['then'](function(_0x5d6040){if(_0x5d6040){return _0x5d6040?{'count':_0x1ea391,'rows':_0x5d6040}:null;}})[_0x64e0('0x35')](respondWithResult(_0x15f2df,null))['catch'](handleError(_0x15f2df,null));};exports[_0x64e0('0x5c')]=function(_0x30c857,_0x366e40,_0x418876){var _0x246561={};var _0x1fb147={};var _0x354a71;var _0xb74f99;return db[_0x64e0('0x3a')]['findOne']({'where':{'id':_0x30c857[_0x64e0('0x55')]['id']}})[_0x64e0('0x35')](handleEntityNotFound(_0x366e40,null))[_0x64e0('0x35')](function(_0x4d3f40){if(_0x4d3f40){_0x354a71=_0x4d3f40;_0x1fb147[_0x64e0('0x3f')]=_[_0x64e0('0x41')](db[_0x64e0('0x5b')][_0x64e0('0x3b')]);_0x1fb147[_0x64e0('0x40')]=_[_0x64e0('0x41')](_0x30c857[_0x64e0('0x40')]);_0x1fb147[_0x64e0('0x42')]=_['intersection'](_0x1fb147[_0x64e0('0x3f')],_0x1fb147[_0x64e0('0x40')]);_0x246561['attributes']=_['intersection'](_0x1fb147['model'],qs[_0x64e0('0x44')](_0x30c857[_0x64e0('0x40')][_0x64e0('0x44')]));_0x246561[_0x64e0('0x45')]=_0x246561['attributes'][_0x64e0('0x46')]?_0x246561[_0x64e0('0x45')]:_0x1fb147['model'];_0x246561[_0x64e0('0x49')]=qs[_0x64e0('0x4a')](_0x30c857[_0x64e0('0x40')][_0x64e0('0x4a')]);_0x246561[_0x64e0('0x4b')]=qs['filters'](_[_0x64e0('0x4c')](_0x30c857['query'],_0x1fb147[_0x64e0('0x42')]));if(_0x30c857['query'][_0x64e0('0x4d')]){_0x246561[_0x64e0('0x4b')]=_[_0x64e0('0x4e')](_0x246561[_0x64e0('0x4b')],{'$or':_[_0x64e0('0x39')](_0x246561[_0x64e0('0x45')],function(_0x183ddb){var _0x4cc7e5={};_0x4cc7e5[_0x183ddb]={'$like':'%'+_0x30c857[_0x64e0('0x40')][_0x64e0('0x4d')]+'%'};return _0x4cc7e5;})});}_0x246561=_[_0x64e0('0x4e')]({},_0x246561,_0x30c857[_0x64e0('0x50')]);return _0x354a71[_0x64e0('0x5c')](_0x246561);}})[_0x64e0('0x35')](function(_0x11831a){if(_0x11831a){_0xb74f99=_0x11831a[_0x64e0('0x46')];if(!_0x30c857[_0x64e0('0x40')][_0x64e0('0x47')](_0x64e0('0x48'))){_0x246561[_0x64e0('0x2f')]=qs[_0x64e0('0x2f')](_0x30c857['query'][_0x64e0('0x2f')]);_0x246561[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x30c857[_0x64e0('0x40')][_0x64e0('0x2e')]);}return _0x354a71['getSubjects'](_0x246561);}})[_0x64e0('0x35')](function(_0x4b4af5){if(_0x4b4af5){return _0x4b4af5?{'count':_0xb74f99,'rows':_0x4b4af5}:null;}})['then'](respondWithResult(_0x366e40,null))['catch'](handleError(_0x366e40,null));};exports[_0x64e0('0x5d')]=function(_0x223861,_0x54ea90,_0xbce7a0){var _0xa83cd9={};var _0x45d068={};var _0x39e55a;var _0x1eafc0;return db[_0x64e0('0x3a')]['findOne']({'where':{'id':_0x223861[_0x64e0('0x55')]['id']}})['then'](handleEntityNotFound(_0x54ea90,null))[_0x64e0('0x35')](function(_0x209f5b){if(_0x209f5b){_0x39e55a=_0x209f5b;_0x45d068[_0x64e0('0x3f')]=_[_0x64e0('0x41')](db[_0x64e0('0x5b')][_0x64e0('0x3b')]);_0x45d068[_0x64e0('0x40')]=_['keys'](_0x223861[_0x64e0('0x40')]);_0x45d068[_0x64e0('0x42')]=_[_0x64e0('0x43')](_0x45d068[_0x64e0('0x3f')],_0x45d068[_0x64e0('0x40')]);_0xa83cd9[_0x64e0('0x45')]=_[_0x64e0('0x43')](_0x45d068['model'],qs[_0x64e0('0x44')](_0x223861[_0x64e0('0x40')][_0x64e0('0x44')]));_0xa83cd9[_0x64e0('0x45')]=_0xa83cd9[_0x64e0('0x45')][_0x64e0('0x46')]?_0xa83cd9[_0x64e0('0x45')]:_0x45d068[_0x64e0('0x3f')];_0xa83cd9['order']=qs[_0x64e0('0x4a')](_0x223861[_0x64e0('0x40')][_0x64e0('0x4a')]);_0xa83cd9[_0x64e0('0x4b')]=qs[_0x64e0('0x42')](_['pick'](_0x223861[_0x64e0('0x40')],_0x45d068[_0x64e0('0x42')]));if(_0x223861[_0x64e0('0x40')]['filter']){_0xa83cd9['where']=_[_0x64e0('0x4e')](_0xa83cd9[_0x64e0('0x4b')],{'$or':_[_0x64e0('0x39')](_0xa83cd9[_0x64e0('0x45')],function(_0x10afba){var _0x5b2c0c={};_0x5b2c0c[_0x10afba]={'$like':'%'+_0x223861['query']['filter']+'%'};return _0x5b2c0c;})});}_0xa83cd9=_[_0x64e0('0x4e')]({},_0xa83cd9,_0x223861[_0x64e0('0x50')]);return _0x39e55a[_0x64e0('0x5d')](_0xa83cd9);}})[_0x64e0('0x35')](function(_0x2f4c99){if(_0x2f4c99){_0x1eafc0=_0x2f4c99[_0x64e0('0x46')];if(!_0x223861[_0x64e0('0x40')][_0x64e0('0x47')](_0x64e0('0x48'))){_0xa83cd9[_0x64e0('0x2f')]=qs[_0x64e0('0x2f')](_0x223861[_0x64e0('0x40')][_0x64e0('0x2f')]);_0xa83cd9[_0x64e0('0x2e')]=qs[_0x64e0('0x2e')](_0x223861[_0x64e0('0x40')][_0x64e0('0x2e')]);}return _0x39e55a[_0x64e0('0x5d')](_0xa83cd9);}})[_0x64e0('0x35')](function(_0x52d8b5){if(_0x52d8b5){return _0x52d8b5?{'count':_0x1eafc0,'rows':_0x52d8b5}:null;}})['then'](respondWithResult(_0x54ea90,null))[_0x64e0('0x28')](handleError(_0x54ea90,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 712b010..47652f3 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 _0x5f92=['int_salesforce_configurations','lodash','util','api','bluebird','../../config/environment','define','SalesforceConfiguration'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x5f92,0x99));var _0x25f9=function(_0x2d994d,_0x168a27){_0x2d994d=_0x2d994d-0x0;var _0xd54be4=_0x5f92[_0x2d994d];return _0xd54be4;};'use strict';var _=require(_0x25f9('0x0'));var util=require(_0x25f9('0x1'));var logger=require('../../config/logger')(_0x25f9('0x2'));var moment=require('moment');var BPromise=require(_0x25f9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x25f9('0x4'));var attributes=require('./intSalesforceConfiguration.attributes');module['exports']=function(_0x45c398,_0x2fe7f2){return _0x45c398[_0x25f9('0x5')](_0x25f9('0x6'),attributes,{'tableName':_0x25f9('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3c3=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','exports','define','SalesforceConfiguration','int_salesforce_configurations','lodash','util','api'];(function(_0x3c21fa,_0x4ebbc3){var _0x59ab31=function(_0x54d844){while(--_0x54d844){_0x3c21fa['push'](_0x3c21fa['shift']());}};_0x59ab31(++_0x4ebbc3);}(_0xc3c3,0xc1));var _0x3c3c=function(_0x3438ef,_0x28f1d2){_0x3438ef=_0x3438ef-0x0;var _0x1be734=_0xc3c3[_0x3438ef];return _0x1be734;};'use strict';var _=require(_0x3c3c('0x0'));var util=require(_0x3c3c('0x1'));var logger=require('../../config/logger')(_0x3c3c('0x2'));var moment=require(_0x3c3c('0x3'));var BPromise=require(_0x3c3c('0x4'));var rp=require(_0x3c3c('0x5'));var fs=require('fs');var path=require(_0x3c3c('0x6'));var rimraf=require(_0x3c3c('0x7'));var config=require(_0x3c3c('0x8'));var attributes=require(_0x3c3c('0x9'));module[_0x3c3c('0xa')]=function(_0x3dcd79,_0x5f33fd){return _0x3dcd79[_0x3c3c('0xb')](_0x3c3c('0xc'),attributes,{'tableName':_0x3c3c('0xd'),'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 20c4dcc..e664ebc 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 _0xf2c7=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2c7,0x1e2));var _0x7f2c=function(_0x210718,_0x247b55){_0x210718=_0x210718-0x0;var _0x541bfc=_0xf2c7[_0x210718];return _0x541bfc;};'use strict';var _=require(_0x7f2c('0x0'));var util=require('util');var moment=require(_0x7f2c('0x1'));var BPromise=require(_0x7f2c('0x2'));var rs=require(_0x7f2c('0x3'));var fs=require('fs');var Redis=require(_0x7f2c('0x4'));var db=require(_0x7f2c('0x5'))['db'];var utils=require(_0x7f2c('0x6'));var logger=require(_0x7f2c('0x7'))('rpc');var config=require(_0x7f2c('0x8'));var jayson=require(_0x7f2c('0x9'));var client=jayson[_0x7f2c('0xa')][_0x7f2c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x595413,_0x8b97e7,_0x4b4a59){return new BPromise(function(_0x336f28,_0x4fd85a){return client[_0x7f2c('0xc')](_0x595413,_0x4b4a59)[_0x7f2c('0xd')](function(_0x26294e){logger[_0x7f2c('0xe')](_0x7f2c('0xf'),_0x8b97e7,_0x7f2c('0x10'));logger[_0x7f2c('0x11')](_0x7f2c('0x12'),_0x8b97e7,_0x7f2c('0x10'),JSON['stringify'](_0x26294e));if(_0x26294e[_0x7f2c('0x13')]){if(_0x26294e[_0x7f2c('0x13')][_0x7f2c('0x14')]===0x1f4){logger[_0x7f2c('0x13')](_0x7f2c('0xf'),_0x8b97e7,_0x26294e['error']['message']);return _0x4fd85a(_0x26294e[_0x7f2c('0x13')]['message']);}logger[_0x7f2c('0x13')](_0x7f2c('0xf'),_0x8b97e7,_0x26294e[_0x7f2c('0x13')][_0x7f2c('0x15')]);return _0x336f28(_0x26294e[_0x7f2c('0x13')][_0x7f2c('0x15')]);}else{logger[_0x7f2c('0xe')](_0x7f2c('0xf'),_0x8b97e7,_0x7f2c('0x10'));_0x336f28(_0x26294e[_0x7f2c('0x16')][_0x7f2c('0x15')]);}})['catch'](function(_0x1cce89){logger[_0x7f2c('0x13')](_0x7f2c('0xf'),_0x8b97e7,_0x1cce89);_0x4fd85a(_0x1cce89);});});} \ No newline at end of file +var _0xaaa6=['catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x1465d1,_0x10aff3){var _0x23aba4=function(_0x3754f8){while(--_0x3754f8){_0x1465d1['push'](_0x1465d1['shift']());}};_0x23aba4(++_0x10aff3);}(_0xaaa6,0x1e4));var _0x6aaa=function(_0x819ce,_0xf25f51){_0x819ce=_0x819ce-0x0;var _0x1edcf0=_0xaaa6[_0x819ce];return _0x1edcf0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6aaa('0x0'));var BPromise=require(_0x6aaa('0x1'));var rs=require(_0x6aaa('0x2'));var fs=require('fs');var Redis=require(_0x6aaa('0x3'));var db=require(_0x6aaa('0x4'))['db'];var utils=require(_0x6aaa('0x5'));var logger=require(_0x6aaa('0x6'))('rpc');var config=require(_0x6aaa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6aaa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26443d,_0x5d0f35,_0x18cdf1){return new BPromise(function(_0x1f1f92,_0x3c0001){return client['request'](_0x26443d,_0x18cdf1)[_0x6aaa('0x9')](function(_0x1e7d66){logger[_0x6aaa('0xa')](_0x6aaa('0xb'),_0x5d0f35,_0x6aaa('0xc'));logger[_0x6aaa('0xd')](_0x6aaa('0xe'),_0x5d0f35,_0x6aaa('0xc'),JSON[_0x6aaa('0xf')](_0x1e7d66));if(_0x1e7d66[_0x6aaa('0x10')]){if(_0x1e7d66[_0x6aaa('0x10')][_0x6aaa('0x11')]===0x1f4){logger[_0x6aaa('0x10')](_0x6aaa('0xb'),_0x5d0f35,_0x1e7d66[_0x6aaa('0x10')][_0x6aaa('0x12')]);return _0x3c0001(_0x1e7d66['error'][_0x6aaa('0x12')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x5d0f35,_0x1e7d66['error'][_0x6aaa('0x12')]);return _0x1f1f92(_0x1e7d66[_0x6aaa('0x10')][_0x6aaa('0x12')]);}else{logger[_0x6aaa('0xa')](_0x6aaa('0xb'),_0x5d0f35,_0x6aaa('0xc'));_0x1f1f92(_0x1e7d66[_0x6aaa('0x13')][_0x6aaa('0x12')]);}})[_0x6aaa('0x14')](function(_0x162772){logger[_0x6aaa('0x10')]('SalesforceConfiguration,\x20%s,\x20%s',_0x5d0f35,_0x162772);_0x3c0001(_0x162772);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 0a2d726..028fce8 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 _0x2eb2=['/:id','show','post','create','put','delete','destroy','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','isAuthenticated','index','get'];(function(_0x54bd96,_0x122c68){var _0x356665=function(_0x20c39c){while(--_0x20c39c){_0x54bd96['push'](_0x54bd96['shift']());}};_0x356665(++_0x122c68);}(_0x2eb2,0x19f));var _0x22eb=function(_0x31cb5f,_0x2df766){_0x31cb5f=_0x31cb5f-0x0;var _0x586042=_0x2eb2[_0x31cb5f];return _0x586042;};'use strict';var multer=require('multer');var util=require(_0x22eb('0x0'));var path=require(_0x22eb('0x1'));var timeout=require(_0x22eb('0x2'));var express=require(_0x22eb('0x3'));var router=express[_0x22eb('0x4')]();var auth=require(_0x22eb('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x22eb('0x6'));var controller=require('./intSalesforceField.controller');router['get']('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0x8')]);router[_0x22eb('0x9')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller[_0x22eb('0xb')]);router[_0x22eb('0xc')]('/',auth[_0x22eb('0x7')](),controller[_0x22eb('0xd')]);router[_0x22eb('0xe')](_0x22eb('0xa'),auth[_0x22eb('0x7')](),controller['update']);router[_0x22eb('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x22eb('0x10')]);module['exports']=router; \ No newline at end of file +var _0x71ab=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get'];(function(_0x52f41a,_0xefc811){var _0x5c9778=function(_0x160ace){while(--_0x160ace){_0x52f41a['push'](_0x52f41a['shift']());}};_0x5c9778(++_0xefc811);}(_0x71ab,0x64));var _0xb71a=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x71ab[_0x13d07a];return _0x5ee0ee;};'use strict';var multer=require('multer');var util=require(_0xb71a('0x0'));var path=require('path');var timeout=require(_0xb71a('0x1'));var express=require('express');var router=express[_0xb71a('0x2')]();var auth=require(_0xb71a('0x3'));var interaction=require(_0xb71a('0x4'));var config=require(_0xb71a('0x5'));var controller=require(_0xb71a('0x6'));router[_0xb71a('0x7')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0x9')]);router[_0xb71a('0x7')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller[_0xb71a('0xb')]);router[_0xb71a('0xc')]('/',auth[_0xb71a('0x8')](),controller[_0xb71a('0xd')]);router[_0xb71a('0xe')](_0xb71a('0xa'),auth[_0xb71a('0x8')](),controller['update']);router[_0xb71a('0xf')]('/:id',auth[_0xb71a('0x8')](),controller[_0xb71a('0x10')]);module[_0xb71a('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index c5eba1a..d2415ff 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 _0x9c48=['exports','string','variable','customVariable','keyValue','STRING'];(function(_0xef22dd,_0x4774b0){var _0x443a54=function(_0xbdc4c1){while(--_0xbdc4c1){_0xef22dd['push'](_0xef22dd['shift']());}};_0x443a54(++_0x4774b0);}(_0x9c48,0x1b6));var _0x89c4=function(_0x2cfc6f,_0x34778f){_0x2cfc6f=_0x2cfc6f-0x0;var _0x444a41=_0x9c48[_0x2cfc6f];return _0x444a41;};'use strict';var Sequelize=require('sequelize');module[_0x89c4('0x0')]={'type':{'type':Sequelize['ENUM'](_0x89c4('0x1'),_0x89c4('0x2'),_0x89c4('0x3'),_0x89c4('0x4')),'defaultValue':_0x89c4('0x1')},'content':{'type':Sequelize[_0x89c4('0x5')]},'key':{'type':Sequelize[_0x89c4('0x5')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x89c4('0x3'))},'keyContent':{'type':Sequelize[_0x89c4('0x5')]},'idField':{'type':Sequelize[_0x89c4('0x5')]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3219=['variable','customVariable','keyValue','STRING','sequelize','exports','ENUM','string'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0x3219,0xfc));var _0x9321=function(_0x48c612,_0x432076){_0x48c612=_0x48c612-0x0;var _0x5f0583=_0x3219[_0x48c612];return _0x5f0583;};'use strict';var Sequelize=require(_0x9321('0x0'));module[_0x9321('0x1')]={'type':{'type':Sequelize[_0x9321('0x2')](_0x9321('0x3'),_0x9321('0x4'),_0x9321('0x5'),_0x9321('0x6')),'defaultValue':_0x9321('0x3')},'content':{'type':Sequelize[_0x9321('0x7')]},'key':{'type':Sequelize[_0x9321('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x9321('0x3'),'variable',_0x9321('0x5'))},'keyContent':{'type':Sequelize[_0x9321('0x7')]},'idField':{'type':Sequelize[_0x9321('0x7')]},'variableName':{'type':Sequelize[_0x9321('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index 69ffa88..8180fc7 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 _0x2ef3=['then','stack','name','send','index','SalesforceField','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','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'];(function(_0x50762b,_0x1e807f){var _0x31bfb8=function(_0x239e54){while(--_0x239e54){_0x50762b['push'](_0x50762b['shift']());}};_0x31bfb8(++_0x1e807f);}(_0x2ef3,0xba));var _0x32ef=function(_0x5f4fe6,_0x577a36){_0x5f4fe6=_0x5f4fe6-0x0;var _0x30787b=_0x2ef3[_0x5f4fe6];return _0x30787b;};'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')]));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['SalesforceField'][_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));}; \ No newline at end of file +var _0x0b0e=['update','then','destroy','end','error','name','index','map','SalesforceField','fieldName','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','VIRTUAL','merge','count','includeAll','rows','show','params','rawAttributes','include','find','catch','create','body','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','set','reject'];(function(_0x10aba8,_0x4326f4){var _0x360793=function(_0x18c7f9){while(--_0x18c7f9){_0x10aba8['push'](_0x10aba8['shift']());}};_0x360793(++_0x4326f4);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4c3a36,_0xdba60f){_0x4c3a36=_0x4c3a36-0x0;var _0x40f945=_0x0b0e[_0x4c3a36];return _0x40f945;};'use strict';var pdf=require(_0xe0b0('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe0b0('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe0b0('0x2'));var rp=require(_0xe0b0('0x3'));var moment=require(_0xe0b0('0x4'));var BPromise=require(_0xe0b0('0x5'));var Mustache=require(_0xe0b0('0x6'));var util=require(_0xe0b0('0x7'));var path=require(_0xe0b0('0x8'));var sox=require(_0xe0b0('0x9'));var csv=require(_0xe0b0('0xa'));var ejs=require(_0xe0b0('0xb'));var fs=require('fs');var _=require(_0xe0b0('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe0b0('0xd'));var deskjs=require(_0xe0b0('0xe'));var toCsv=require(_0xe0b0('0xa'));var querystring=require(_0xe0b0('0xf'));var Papa=require('papaparse');var Redis=require(_0xe0b0('0x10'));var authService=require(_0xe0b0('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe0b0('0x12'));var hardwareService=require(_0xe0b0('0x13'));var logger=require('../../config/logger')(_0xe0b0('0x14'));var utils=require(_0xe0b0('0x15'));var config=require(_0xe0b0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3068c0,_0x1c358a){_0x1c358a=_0x1c358a||0xcc;return function(_0x3cc19a){if(_0x3cc19a){return _0x3068c0[_0xe0b0('0x17')](_0x1c358a);}return _0x3068c0[_0xe0b0('0x18')](_0x1c358a)['end']();};}function respondWithResult(_0x3782be,_0x154de6){_0x154de6=_0x154de6||0xc8;return function(_0x743318){if(_0x743318){return _0x3782be[_0xe0b0('0x18')](_0x154de6)[_0xe0b0('0x19')](_0x743318);}};}function respondWithFilteredResult(_0x55d884,_0x41a7e2){return function(_0x5adb01){if(_0x5adb01){var _0x35cb40=_0x5adb01['count'],_0xadee6e=_0x41a7e2[_0xe0b0('0x1a')],_0x519ae8=_0x41a7e2[_0xe0b0('0x1a')]+_0x41a7e2['limit'],_0x11fdca;if(_0x519ae8>=_0x35cb40){_0x519ae8=_0x35cb40;_0x11fdca=0xc8;}else{_0x11fdca=0xce;}_0x55d884['status'](_0x11fdca);return _0x55d884[_0xe0b0('0x1b')]('Content-Range',_0xadee6e+'-'+_0x519ae8+'/'+_0x35cb40)['json'](_0x5adb01);}return null;};}function patchUpdates(_0x4bce65){return function(_0x1920ee){try{jsonpatch['apply'](_0x1920ee,_0x4bce65,!![]);}catch(_0x52598b){return BPromise[_0xe0b0('0x1c')](_0x52598b);}return _0x1920ee['save']();};}function saveUpdates(_0x472286,_0x5dba2f){return function(_0x2c84cc){if(_0x2c84cc){return _0x2c84cc[_0xe0b0('0x1d')](_0x472286)[_0xe0b0('0x1e')](function(_0x310a6d){return _0x310a6d;});}return null;};}function removeEntity(_0x2cf6a1,_0x58b804){return function(_0x4cae54){if(_0x4cae54){return _0x4cae54[_0xe0b0('0x1f')]()['then'](function(){_0x2cf6a1[_0xe0b0('0x18')](0xcc)[_0xe0b0('0x20')]();});}};}function handleEntityNotFound(_0x513e63,_0x170ad8){return function(_0x503883){if(!_0x503883){_0x513e63[_0xe0b0('0x17')](0x194);}return _0x503883;};}function handleError(_0x49a727,_0x28586d){_0x28586d=_0x28586d||0x1f4;return function(_0x576352){logger[_0xe0b0('0x21')](_0x576352['stack']);if(_0x576352[_0xe0b0('0x22')]){delete _0x576352['name'];}_0x49a727[_0xe0b0('0x18')](_0x28586d)['send'](_0x576352);};}exports[_0xe0b0('0x23')]=function(_0x3c3bc2,_0x1f1ebd){var _0x1d91ad={},_0x3ec2={},_0x10745d={'count':0x0,'rows':[]};var _0x5200a6=_[_0xe0b0('0x24')](db[_0xe0b0('0x25')]['rawAttributes'],function(_0x15e13b){return{'name':_0x15e13b[_0xe0b0('0x26')],'type':_0x15e13b[_0xe0b0('0x27')][_0xe0b0('0x28')]};});_0x3ec2[_0xe0b0('0x29')]=_[_0xe0b0('0x24')](_0x5200a6,_0xe0b0('0x22'));_0x3ec2['query']=_[_0xe0b0('0x2a')](_0x3c3bc2[_0xe0b0('0x2b')]);_0x3ec2['filters']=_['intersection'](_0x3ec2[_0xe0b0('0x29')],_0x3ec2[_0xe0b0('0x2b')]);_0x1d91ad[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x3ec2[_0xe0b0('0x29')],qs['fields'](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x2e')]));_0x1d91ad[_0xe0b0('0x2c')]=_0x1d91ad[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x1d91ad['attributes']:_0x3ec2[_0xe0b0('0x29')];if(!_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x30')](_0xe0b0('0x31'))){_0x1d91ad[_0xe0b0('0x32')]=qs[_0xe0b0('0x32')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x32')]);_0x1d91ad[_0xe0b0('0x1a')]=qs[_0xe0b0('0x1a')](_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x1a')]);}_0x1d91ad[_0xe0b0('0x33')]=qs[_0xe0b0('0x34')](_0x3c3bc2[_0xe0b0('0x2b')]['sort']);_0x1d91ad[_0xe0b0('0x35')]=qs[_0xe0b0('0x36')](_[_0xe0b0('0x37')](_0x3c3bc2[_0xe0b0('0x2b')],_0x3ec2[_0xe0b0('0x36')]));if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]){_0x1d91ad['where']=_['merge'](_0x1d91ad['where'],{'$or':_['map'](_0x5200a6,function(_0x26137c){if(_0x26137c[_0xe0b0('0x27')]!==_0xe0b0('0x39')){var _0x4e4b20={};_0x4e4b20[_0x26137c[_0xe0b0('0x22')]]={'$like':'%'+_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x38')]+'%'};return _0x4e4b20;}})});}_0x1d91ad=_[_0xe0b0('0x3a')]({},_0x1d91ad,_0x3c3bc2['options']);var _0xed3226={'where':_0x1d91ad[_0xe0b0('0x35')]};return db[_0xe0b0('0x25')][_0xe0b0('0x3b')](_0xed3226)[_0xe0b0('0x1e')](function(_0x1205db){_0x10745d[_0xe0b0('0x3b')]=_0x1205db;if(_0x3c3bc2[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x1d91ad['include']=[{'all':!![]}];}return db[_0xe0b0('0x25')]['findAll'](_0x1d91ad);})[_0xe0b0('0x1e')](function(_0x2d5f47){_0x10745d[_0xe0b0('0x3d')]=_0x2d5f47;return _0x10745d;})[_0xe0b0('0x1e')](respondWithFilteredResult(_0x1f1ebd,_0x1d91ad))['catch'](handleError(_0x1f1ebd,null));};exports[_0xe0b0('0x3e')]=function(_0x41adcb,_0x33706d){var _0x402a0e={'raw':!![],'where':{'id':_0x41adcb[_0xe0b0('0x3f')]['id']}},_0x19c80e={};_0x19c80e[_0xe0b0('0x29')]=_[_0xe0b0('0x2a')](db['SalesforceField'][_0xe0b0('0x40')]);_0x19c80e[_0xe0b0('0x2b')]=_['keys'](_0x41adcb['query']);_0x19c80e[_0xe0b0('0x36')]=_[_0xe0b0('0x2d')](_0x19c80e['model'],_0x19c80e[_0xe0b0('0x2b')]);_0x402a0e[_0xe0b0('0x2c')]=_[_0xe0b0('0x2d')](_0x19c80e[_0xe0b0('0x29')],qs[_0xe0b0('0x2e')](_0x41adcb['query']['fields']));_0x402a0e['attributes']=_0x402a0e[_0xe0b0('0x2c')][_0xe0b0('0x2f')]?_0x402a0e['attributes']:_0x19c80e[_0xe0b0('0x29')];if(_0x41adcb[_0xe0b0('0x2b')][_0xe0b0('0x3c')]){_0x402a0e[_0xe0b0('0x41')]=[{'all':!![]}];}_0x402a0e=_[_0xe0b0('0x3a')]({},_0x402a0e,_0x41adcb['options']);return db['SalesforceField'][_0xe0b0('0x42')](_0x402a0e)[_0xe0b0('0x1e')](handleEntityNotFound(_0x33706d,null))[_0xe0b0('0x1e')](respondWithResult(_0x33706d,null))[_0xe0b0('0x43')](handleError(_0x33706d,null));};exports[_0xe0b0('0x44')]=function(_0x575c7d,_0x3b1474){return db[_0xe0b0('0x25')]['create'](_0x575c7d['body'],{})['then'](respondWithResult(_0x3b1474,0xc9))[_0xe0b0('0x43')](handleError(_0x3b1474,null));};exports[_0xe0b0('0x1d')]=function(_0x2419ce,_0x364877){if(_0x2419ce['body']['id']){delete _0x2419ce[_0xe0b0('0x45')]['id'];}return db[_0xe0b0('0x25')]['find']({'where':{'id':_0x2419ce['params']['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x364877,null))[_0xe0b0('0x1e')](saveUpdates(_0x2419ce['body'],null))[_0xe0b0('0x1e')](respondWithResult(_0x364877,null))[_0xe0b0('0x43')](handleError(_0x364877,null));};exports['destroy']=function(_0x5cb2b6,_0x123ad2){return db['SalesforceField'][_0xe0b0('0x42')]({'where':{'id':_0x5cb2b6[_0xe0b0('0x3f')]['id']}})[_0xe0b0('0x1e')](handleEntityNotFound(_0x123ad2,null))[_0xe0b0('0x1e')](removeEntity(_0x123ad2,null))[_0xe0b0('0x43')](handleError(_0x123ad2,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 2fbef2f..65a23c6 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 _0xfdcb=['../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24eb89,_0x2d44bf){var _0x50c325=function(_0x184097){while(--_0x184097){_0x24eb89['push'](_0x24eb89['shift']());}};_0x50c325(++_0x2d44bf);}(_0xfdcb,0x134));var _0xbfdc=function(_0x356107,_0x3bb13c){_0x356107=_0x356107-0x0;var _0x2f9d2b=_0xfdcb[_0x356107];return _0x2f9d2b;};'use strict';var _=require(_0xbfdc('0x0'));var util=require(_0xbfdc('0x1'));var logger=require(_0xbfdc('0x2'))(_0xbfdc('0x3'));var moment=require(_0xbfdc('0x4'));var BPromise=require(_0xbfdc('0x5'));var rp=require(_0xbfdc('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xbfdc('0x7'));var attributes=require(_0xbfdc('0x8'));module[_0xbfdc('0x9')]=function(_0x499dc1,_0x29b7f2){return _0x499dc1[_0xbfdc('0xa')](_0xbfdc('0xb'),attributes,{'tableName':_0xbfdc('0xc'),'paranoid':![],'indexes':[{'name':_0xbfdc('0xd'),'fields':[_0xbfdc('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x303a=['lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','exports','define','SalesforceField','FieldId'];(function(_0x415f7e,_0x4630b6){var _0x311ff4=function(_0x19c19d){while(--_0x19c19d){_0x415f7e['push'](_0x415f7e['shift']());}};_0x311ff4(++_0x4630b6);}(_0x303a,0x1a0));var _0xa303=function(_0x1417c6,_0x194309){_0x1417c6=_0x1417c6-0x0;var _0x44db97=_0x303a[_0x1417c6];return _0x44db97;};'use strict';var _=require(_0xa303('0x0'));var util=require('util');var logger=require(_0xa303('0x1'))(_0xa303('0x2'));var moment=require(_0xa303('0x3'));var BPromise=require(_0xa303('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa303('0x5'));var rimraf=require(_0xa303('0x6'));var config=require(_0xa303('0x7'));var attributes=require(_0xa303('0x8'));module[_0xa303('0x9')]=function(_0x1c7ee9,_0x2bc3d7){return _0x1c7ee9[_0xa303('0xa')](_0xa303('0xb'),attributes,{'tableName':'int_salesforce_fields','paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':['idField',_0xa303('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 742c807..e80f999 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 _0x878f=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x54772a,_0x4ed88e){var _0x50afcc=function(_0x5be5ca){while(--_0x5be5ca){_0x54772a['push'](_0x54772a['shift']());}};_0x50afcc(++_0x4ed88e);}(_0x878f,0x173));var _0xf878=function(_0x46edd0,_0x2e1b4d){_0x46edd0=_0x46edd0-0x0;var _0x3d7c2f=_0x878f[_0x46edd0];return _0x3d7c2f;};'use strict';var _=require('lodash');var util=require(_0xf878('0x0'));var moment=require(_0xf878('0x1'));var BPromise=require(_0xf878('0x2'));var rs=require(_0xf878('0x3'));var fs=require('fs');var Redis=require(_0xf878('0x4'));var db=require(_0xf878('0x5'))['db'];var utils=require(_0xf878('0x6'));var logger=require(_0xf878('0x7'))(_0xf878('0x8'));var config=require(_0xf878('0x9'));var jayson=require(_0xf878('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c5f5c,_0x62b420,_0x59e564){return new BPromise(function(_0x52851e,_0x530767){return client[_0xf878('0xb')](_0x3c5f5c,_0x59e564)['then'](function(_0x4a9d79){logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));logger['debug'](_0xf878('0xf'),_0x62b420,_0xf878('0xe'),JSON['stringify'](_0x4a9d79));if(_0x4a9d79[_0xf878('0x10')]){if(_0x4a9d79['error'][_0xf878('0x11')]===0x1f4){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x4a9d79['error'][_0xf878('0x12')]);return _0x530767(_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);}logger['error'](_0xf878('0xd'),_0x62b420,_0x4a9d79[_0xf878('0x10')][_0xf878('0x12')]);return _0x52851e(_0x4a9d79['error']['message']);}else{logger[_0xf878('0xc')](_0xf878('0xd'),_0x62b420,_0xf878('0xe'));_0x52851e(_0x4a9d79[_0xf878('0x13')][_0xf878('0x12')]);}})[_0xf878('0x14')](function(_0x415056){logger[_0xf878('0x10')](_0xf878('0xd'),_0x62b420,_0x415056);_0x530767(_0x415056);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x1b28c5,_0x5c3357){var _0x2b80be=function(_0x10ce66){while(--_0x10ce66){_0x1b28c5['push'](_0x1b28c5['shift']());}};_0x2b80be(++_0x5c3357);}(_0x153f,0x15b));var _0xf153=function(_0x4c60df,_0x21a3ab){_0x4c60df=_0x4c60df-0x0;var _0x638975=_0x153f[_0x4c60df];return _0x638975;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index a3f452b..674d277 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 _0xa8c4=['delete','exports','util','path','express','Router','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa8c4,0x12d));var _0x4a8c=function(_0x59c4a4,_0x2759e9){_0x59c4a4=_0x59c4a4-0x0;var _0x45b0a5=_0xa8c4[_0x59c4a4];return _0x45b0a5;};'use strict';var multer=require('multer');var util=require(_0x4a8c('0x0'));var path=require(_0x4a8c('0x1'));var timeout=require('connect-timeout');var express=require(_0x4a8c('0x2'));var router=express[_0x4a8c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x4a8c('0x4'));var config=require(_0x4a8c('0x5'));var controller=require(_0x4a8c('0x6'));router[_0x4a8c('0x7')]('/',auth[_0x4a8c('0x8')](),controller[_0x4a8c('0x9')]);router[_0x4a8c('0x7')](_0x4a8c('0xa'),auth[_0x4a8c('0x8')](),controller[_0x4a8c('0xb')]);router['get'](_0x4a8c('0xc'),auth[_0x4a8c('0x8')](),controller[_0x4a8c('0xd')]);router[_0x4a8c('0x7')](_0x4a8c('0xe'),auth[_0x4a8c('0x8')](),controller[_0x4a8c('0xf')]);router[_0x4a8c('0x10')]('/',auth['isAuthenticated'](),controller[_0x4a8c('0x11')]);router['post']('/:id/configurations',auth[_0x4a8c('0x8')](),controller[_0x4a8c('0x12')]);router[_0x4a8c('0x13')](_0x4a8c('0xa'),auth[_0x4a8c('0x8')](),controller[_0x4a8c('0x14')]);router[_0x4a8c('0x15')](_0x4a8c('0xa'),auth[_0x4a8c('0x8')](),controller['destroy']);module[_0x4a8c('0x16')]=router; \ No newline at end of file +var _0xb708=['/:id','delete','destroy','multer','path','express','Router','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','getFields','post','put'];(function(_0x111bd0,_0x34bf7b){var _0x30edfa=function(_0x31e4f9){while(--_0x31e4f9){_0x111bd0['push'](_0x111bd0['shift']());}};_0x30edfa(++_0x34bf7b);}(_0xb708,0xe7));var _0x8b70=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0xb708[_0x23f8c8];return _0x3dc718;};'use strict';var multer=require(_0x8b70('0x0'));var util=require('util');var path=require(_0x8b70('0x1'));var timeout=require('connect-timeout');var express=require(_0x8b70('0x2'));var router=express[_0x8b70('0x3')]();var auth=require(_0x8b70('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8b70('0x5'));var controller=require(_0x8b70('0x6'));router[_0x8b70('0x7')]('/',auth['isAuthenticated'](),controller[_0x8b70('0x8')]);router[_0x8b70('0x7')]('/:id',auth[_0x8b70('0x9')](),controller[_0x8b70('0xa')]);router[_0x8b70('0x7')](_0x8b70('0xb'),auth['isAuthenticated'](),controller[_0x8b70('0xc')]);router[_0x8b70('0x7')]('/:id/fields',auth[_0x8b70('0x9')](),controller[_0x8b70('0xd')]);router['post']('/',auth[_0x8b70('0x9')](),controller['create']);router[_0x8b70('0xe')](_0x8b70('0xb'),auth[_0x8b70('0x9')](),controller['addConfiguration']);router[_0x8b70('0xf')](_0x8b70('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x8b70('0x11')]('/:id',auth[_0x8b70('0x9')](),controller[_0x8b70('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index 54f85f5..c7524ac 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 _0x2917=['remoteUri','sequelize','exports','STRING'];(function(_0x37fa07,_0x2cee43){var _0x33f488=function(_0x5c960d){while(--_0x5c960d){_0x37fa07['push'](_0x37fa07['shift']());}};_0x33f488(++_0x2cee43);}(_0x2917,0x151));var _0x7291=function(_0x387dc1,_0x3ba649){_0x387dc1=_0x387dc1-0x0;var _0x17567c=_0x2917[_0x387dc1];return _0x17567c;};'use strict';var Sequelize=require(_0x7291('0x0'));module[_0x7291('0x1')]={'name':{'type':Sequelize[_0x7291('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x7291('0x2')],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x7291('0x2')]},'remoteUri':{'type':Sequelize[_0x7291('0x2')],'unique':_0x7291('0x3')},'serverUrl':{'type':Sequelize[_0x7291('0x2')]}}; \ No newline at end of file +var _0x522b=['sequelize','exports','STRING','username','remoteUri'];(function(_0x1432e0,_0xa2a593){var _0x498a18=function(_0x58bf80){while(--_0x58bf80){_0x1432e0['push'](_0x1432e0['shift']());}};_0x498a18(++_0xa2a593);}(_0x522b,0x1b8));var _0xb522=function(_0x2d4065,_0x38dc95){_0x2d4065=_0x2d4065-0x0;var _0xef6016=_0x522b[_0x2d4065];return _0xef6016;};'use strict';var Sequelize=require(_0xb522('0x0'));module[_0xb522('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb522('0x2')],'unique':_0xb522('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xb522('0x2')]},'remoteUri':{'type':Sequelize[_0xb522('0x2')],'unique':_0xb522('0x4')},'serverUrl':{'type':Sequelize[_0xb522('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index ebfa322..cbef1d3 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 _0x06cc=['calendar_stc','closed_at','cmdb_ci','delivery_plan','impact','active','business_service','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','work_end','reopened_time','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','close_notes','parent_incident','sys_id','contact_type','urgency','company','reassignment_count','assigned_to','approval','due_date','sys_mod_count','reopen_count','sys_tags','escalation','correlation_id','username','email','remoteUri','substring','format','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','forEach','internalType','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','label','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','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','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','end','count','offset','Content-Range','json','apply','save','destroy','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','update','params','getConfigurations','findOne','ServicenowConfiguration','order','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on'];(function(_0x57f91f,_0x21cf17){var _0x4deca6=function(_0x5c97bb){while(--_0x5c97bb){_0x57f91f['push'](_0x57f91f['shift']());}};_0x4deca6(++_0x21cf17);}(_0x06cc,0x105));var _0xc06c=function(_0x52770a,_0x47673c){_0x52770a=_0x52770a-0x0;var _0x25f46a=_0x06cc[_0x52770a];return _0x25f46a;};'use strict';var pdf=require(_0xc06c('0x0'));var emlformat=require(_0xc06c('0x1'));var rimraf=require(_0xc06c('0x2'));var zipdir=require(_0xc06c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc06c('0x4'));var moment=require('moment');var BPromise=require(_0xc06c('0x5'));var Mustache=require(_0xc06c('0x6'));var util=require(_0xc06c('0x7'));var path=require(_0xc06c('0x8'));var sox=require(_0xc06c('0x9'));var csv=require(_0xc06c('0xa'));var ejs=require(_0xc06c('0xb'));var fs=require('fs');var _=require(_0xc06c('0xc'));var squel=require(_0xc06c('0xd'));var crypto=require(_0xc06c('0xe'));var jsforce=require(_0xc06c('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc06c('0xa'));var querystring=require(_0xc06c('0x10'));var Papa=require(_0xc06c('0x11'));var Redis=require(_0xc06c('0x12'));var authService=require(_0xc06c('0x13'));var qs=require(_0xc06c('0x14'));var as=require(_0xc06c('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc06c('0x16'))('api');var utils=require(_0xc06c('0x17'));var config=require(_0xc06c('0x18'));var db=require(_0xc06c('0x19'))['db'];var integrations=require(_0xc06c('0x1a'));var jayson=require(_0xc06c('0x1b'));var client=jayson[_0xc06c('0x1c')][_0xc06c('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x1243c7,_0x163cb0,_0x508fb6){if(_0x508fb6){var _0x4628cb=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4628cb[_0xc06c('0x1e')](_0x163cb0)){return _0x1243c7;}else{throw new db[(_0xc06c('0x1f'))][(_0xc06c('0x20'))](_0xc06c('0x21'));}}else{return _0x1243c7;}}function respondWithRpcPromise(_0x590ebd,_0x3a94e7,_0x53510f,_0x557c1e){return new BPromise(function(_0x1395b6,_0x31730c){var _0x4589f9=_0x557c1e||client;return _0x4589f9[_0xc06c('0x22')](_0x590ebd,_0x53510f)[_0xc06c('0x23')](function(_0x38da16){logger['info'](_0xc06c('0x24'),_0x3a94e7,_0xc06c('0x25'));logger['debug'](_0xc06c('0x26'),_0x3a94e7,_0xc06c('0x25'),JSON[_0xc06c('0x27')](_0x38da16));if(_0x38da16[_0xc06c('0x28')]){if(_0x38da16[_0xc06c('0x28')][_0xc06c('0x29')]===0x1f4){logger['error']('ServicenowAccount,\x20%s,\x20%s',_0x3a94e7,_0x38da16[_0xc06c('0x28')][_0xc06c('0x2a')]);return _0x31730c(_0x38da16[_0xc06c('0x28')][_0xc06c('0x2a')]);}logger[_0xc06c('0x28')](_0xc06c('0x24'),_0x3a94e7,_0x38da16[_0xc06c('0x28')][_0xc06c('0x2a')]);return _0x1395b6(_0x38da16[_0xc06c('0x28')][_0xc06c('0x2a')]);}else{logger['info']('ServicenowAccount,\x20%s,\x20%s',_0x3a94e7,_0xc06c('0x25'));_0x1395b6(_0x38da16['result'][_0xc06c('0x2a')]);}})['catch'](function(_0x1778be){logger[_0xc06c('0x28')](_0xc06c('0x24'),_0x3a94e7,_0x1778be);_0x31730c(_0x1778be);});});}function respondWithStatusCode(_0x4de829,_0x380b42){_0x380b42=_0x380b42||0xcc;return function(_0x2aad0d){if(_0x2aad0d){return _0x4de829[_0xc06c('0x2b')](_0x380b42);}return _0x4de829[_0xc06c('0x2c')](_0x380b42)[_0xc06c('0x2d')]();};}function respondWithResult(_0x15341d,_0x1e510f){_0x1e510f=_0x1e510f||0xc8;return function(_0xcf5512){if(_0xcf5512){return _0x15341d[_0xc06c('0x2c')](_0x1e510f)['json'](_0xcf5512);}};}function respondWithFilteredResult(_0x23e546,_0x2b26ec){return function(_0x450b39){if(_0x450b39){var _0x4a5b14=_0x450b39[_0xc06c('0x2e')],_0x309a04=_0x2b26ec[_0xc06c('0x2f')],_0x9730ef=_0x2b26ec[_0xc06c('0x2f')]+_0x2b26ec['limit'],_0xbee30b;if(_0x9730ef>=_0x4a5b14){_0x9730ef=_0x4a5b14;_0xbee30b=0xc8;}else{_0xbee30b=0xce;}_0x23e546[_0xc06c('0x2c')](_0xbee30b);return _0x23e546['set'](_0xc06c('0x30'),_0x309a04+'-'+_0x9730ef+'/'+_0x4a5b14)[_0xc06c('0x31')](_0x450b39);}return null;};}function patchUpdates(_0x36bd18){return function(_0x404df2){try{jsonpatch[_0xc06c('0x32')](_0x404df2,_0x36bd18,!![]);}catch(_0x175af9){return BPromise['reject'](_0x175af9);}return _0x404df2[_0xc06c('0x33')]();};}function saveUpdates(_0x3ebeab,_0x5f31a1){return function(_0x3cb652){if(_0x3cb652){return _0x3cb652['update'](_0x3ebeab)[_0xc06c('0x23')](function(_0x4ef5f6){return _0x4ef5f6;});}return null;};}function removeEntity(_0x2a5dd,_0x2dc220){return function(_0x28ba36){if(_0x28ba36){return _0x28ba36[_0xc06c('0x34')]()[_0xc06c('0x23')](function(){_0x2a5dd[_0xc06c('0x2c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4bb999,_0x518fde){return function(_0x1f0380){if(!_0x1f0380){_0x4bb999['sendStatus'](0x194);}return _0x1f0380;};}function handleError(_0x423a41,_0x128b92){_0x128b92=_0x128b92||0x1f4;return function(_0x349fe9){logger[_0xc06c('0x28')](_0x349fe9[_0xc06c('0x35')]);if(_0x349fe9[_0xc06c('0x36')]){delete _0x349fe9[_0xc06c('0x36')];}_0x423a41['status'](_0x128b92)[_0xc06c('0x37')](_0x349fe9);};}exports['index']=function(_0x5db986,_0x3678bb){var _0x1c4035={},_0x24d8ba={},_0x3f1658={'count':0x0,'rows':[]};var _0x15cd3a=_[_0xc06c('0x38')](db[_0xc06c('0x39')][_0xc06c('0x3a')],function(_0x2ba870){return{'name':_0x2ba870[_0xc06c('0x3b')],'type':_0x2ba870[_0xc06c('0x3c')][_0xc06c('0x3d')]};});_0x24d8ba[_0xc06c('0x3e')]=_[_0xc06c('0x38')](_0x15cd3a,_0xc06c('0x36'));_0x24d8ba[_0xc06c('0x3f')]=_[_0xc06c('0x40')](_0x5db986['query']);_0x24d8ba[_0xc06c('0x41')]=_[_0xc06c('0x42')](_0x24d8ba['model'],_0x24d8ba[_0xc06c('0x3f')]);_0x1c4035[_0xc06c('0x43')]=_[_0xc06c('0x42')](_0x24d8ba['model'],qs[_0xc06c('0x44')](_0x5db986[_0xc06c('0x3f')][_0xc06c('0x44')]));_0x1c4035[_0xc06c('0x43')]=_0x1c4035['attributes'][_0xc06c('0x45')]?_0x1c4035['attributes']:_0x24d8ba['model'];if(!_0x5db986['query']['hasOwnProperty'](_0xc06c('0x46'))){_0x1c4035[_0xc06c('0x47')]=qs['limit'](_0x5db986[_0xc06c('0x3f')]['limit']);_0x1c4035[_0xc06c('0x2f')]=qs[_0xc06c('0x2f')](_0x5db986[_0xc06c('0x3f')]['offset']);}_0x1c4035['order']=qs[_0xc06c('0x48')](_0x5db986[_0xc06c('0x3f')]['sort']);_0x1c4035[_0xc06c('0x49')]=qs[_0xc06c('0x41')](_[_0xc06c('0x4a')](_0x5db986[_0xc06c('0x3f')],_0x24d8ba[_0xc06c('0x41')]));if(_0x5db986[_0xc06c('0x3f')][_0xc06c('0x4b')]){_0x1c4035[_0xc06c('0x49')]=_[_0xc06c('0x4c')](_0x1c4035[_0xc06c('0x49')],{'$or':_[_0xc06c('0x38')](_0x15cd3a,function(_0x58460e){if(_0x58460e[_0xc06c('0x3c')]!==_0xc06c('0x4d')){var _0x85006e={};_0x85006e[_0x58460e['name']]={'$like':'%'+_0x5db986[_0xc06c('0x3f')][_0xc06c('0x4b')]+'%'};return _0x85006e;}})});}_0x1c4035=_[_0xc06c('0x4c')]({},_0x1c4035,_0x5db986['options']);var _0x1acdf2={'where':_0x1c4035['where']};return db['ServicenowAccount'][_0xc06c('0x2e')](_0x1acdf2)[_0xc06c('0x23')](function(_0x2c0d5f){_0x3f1658[_0xc06c('0x2e')]=_0x2c0d5f;if(_0x5db986[_0xc06c('0x3f')][_0xc06c('0x4e')]){_0x1c4035[_0xc06c('0x4f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0xc06c('0x50')](_0x1c4035);})['then'](function(_0x2b45e5){_0x3f1658[_0xc06c('0x51')]=_0x2b45e5;return _0x3f1658;})[_0xc06c('0x23')](respondWithFilteredResult(_0x3678bb,_0x1c4035))[_0xc06c('0x52')](handleError(_0x3678bb,null));};exports[_0xc06c('0x53')]=function(_0x3ad845,_0x467e45){var _0x544289={'raw':![],'where':{'id':_0x3ad845['params']['id']}},_0x17f749={};_0x17f749['model']=_[_0xc06c('0x40')](db[_0xc06c('0x39')][_0xc06c('0x3a')]);_0x17f749[_0xc06c('0x3f')]=_[_0xc06c('0x40')](_0x3ad845[_0xc06c('0x3f')]);_0x17f749[_0xc06c('0x41')]=_[_0xc06c('0x42')](_0x17f749[_0xc06c('0x3e')],_0x17f749['query']);_0x544289[_0xc06c('0x43')]=_[_0xc06c('0x42')](_0x17f749[_0xc06c('0x3e')],qs[_0xc06c('0x44')](_0x3ad845[_0xc06c('0x3f')][_0xc06c('0x44')]));_0x544289[_0xc06c('0x43')]=_0x544289['attributes']['length']?_0x544289[_0xc06c('0x43')]:_0x17f749[_0xc06c('0x3e')];if(_0x3ad845['query'][_0xc06c('0x4e')]){_0x544289['include']=[{'all':!![]}];}_0x544289=_[_0xc06c('0x4c')]({},_0x544289,_0x3ad845[_0xc06c('0x54')]);return db[_0xc06c('0x39')][_0xc06c('0x55')](_0x544289)[_0xc06c('0x23')](handleEntityNotFound(_0x467e45,null))[_0xc06c('0x23')](respondWithResult(_0x467e45,null))[_0xc06c('0x52')](handleError(_0x467e45,null));};exports[_0xc06c('0x56')]=function(_0x9cedd2,_0x4926a8){return db[_0xc06c('0x39')]['create'](_0x9cedd2[_0xc06c('0x57')],{})['then'](respondWithResult(_0x4926a8,0xc9))[_0xc06c('0x52')](handleError(_0x4926a8,null));};exports[_0xc06c('0x58')]=function(_0xaf39db,_0x1d3440){if(_0xaf39db[_0xc06c('0x57')]['id']){delete _0xaf39db[_0xc06c('0x57')]['id'];}return db[_0xc06c('0x39')][_0xc06c('0x55')]({'where':{'id':_0xaf39db['params']['id']}})[_0xc06c('0x23')](handleEntityNotFound(_0x1d3440,null))[_0xc06c('0x23')](saveUpdates(_0xaf39db[_0xc06c('0x57')],null))[_0xc06c('0x23')](respondWithResult(_0x1d3440,null))[_0xc06c('0x52')](handleError(_0x1d3440,null));};exports[_0xc06c('0x34')]=function(_0x48c8f3,_0x465f19){return db['ServicenowAccount'][_0xc06c('0x55')]({'where':{'id':_0x48c8f3[_0xc06c('0x59')]['id']}})[_0xc06c('0x23')](handleEntityNotFound(_0x465f19,null))[_0xc06c('0x23')](removeEntity(_0x465f19,null))[_0xc06c('0x52')](handleError(_0x465f19,null));};exports[_0xc06c('0x5a')]=function(_0x26025f,_0x33fa93,_0xf66200){var _0x37fbc3={};var _0x1b15b9={};var _0x31327e;var _0x1ced63;return db[_0xc06c('0x39')][_0xc06c('0x5b')]({'where':{'id':_0x26025f[_0xc06c('0x59')]['id']}})[_0xc06c('0x23')](handleEntityNotFound(_0x33fa93,null))['then'](function(_0x47caeb){if(_0x47caeb){_0x31327e=_0x47caeb;_0x1b15b9[_0xc06c('0x3e')]=_[_0xc06c('0x40')](db[_0xc06c('0x5c')][_0xc06c('0x3a')]);_0x1b15b9[_0xc06c('0x3f')]=_[_0xc06c('0x40')](_0x26025f[_0xc06c('0x3f')]);_0x1b15b9[_0xc06c('0x41')]=_[_0xc06c('0x42')](_0x1b15b9['model'],_0x1b15b9[_0xc06c('0x3f')]);_0x37fbc3[_0xc06c('0x43')]=_[_0xc06c('0x42')](_0x1b15b9['model'],qs[_0xc06c('0x44')](_0x26025f[_0xc06c('0x3f')]['fields']));_0x37fbc3[_0xc06c('0x43')]=_0x37fbc3[_0xc06c('0x43')][_0xc06c('0x45')]?_0x37fbc3[_0xc06c('0x43')]:_0x1b15b9['model'];_0x37fbc3[_0xc06c('0x5d')]=qs[_0xc06c('0x48')](_0x26025f[_0xc06c('0x3f')][_0xc06c('0x48')]);_0x37fbc3[_0xc06c('0x49')]=qs[_0xc06c('0x41')](_[_0xc06c('0x4a')](_0x26025f[_0xc06c('0x3f')],_0x1b15b9[_0xc06c('0x41')]));if(_0x26025f[_0xc06c('0x3f')]['filter']){_0x37fbc3['where']=_[_0xc06c('0x4c')](_0x37fbc3[_0xc06c('0x49')],{'$or':_[_0xc06c('0x38')](_0x37fbc3[_0xc06c('0x43')],function(_0xecd574){var _0xce63be={};_0xce63be[_0xecd574]={'$like':'%'+_0x26025f[_0xc06c('0x3f')]['filter']+'%'};return _0xce63be;})});}_0x37fbc3=_['merge']({},_0x37fbc3,_0x26025f['options']);return _0x31327e[_0xc06c('0x5a')](_0x37fbc3);}})[_0xc06c('0x23')](function(_0xb3e6e9){if(_0xb3e6e9){_0x1ced63=_0xb3e6e9[_0xc06c('0x45')];if(!_0x26025f[_0xc06c('0x3f')][_0xc06c('0x5e')]('nolimit')){_0x37fbc3['limit']=qs[_0xc06c('0x47')](_0x26025f[_0xc06c('0x3f')][_0xc06c('0x47')]);_0x37fbc3[_0xc06c('0x2f')]=qs[_0xc06c('0x2f')](_0x26025f[_0xc06c('0x3f')][_0xc06c('0x2f')]);}return _0x31327e['getConfigurations'](_0x37fbc3);}})[_0xc06c('0x23')](function(_0x844f25){if(_0x844f25){return _0x844f25?{'count':_0x1ced63,'rows':_0x844f25}:null;}})[_0xc06c('0x23')](respondWithResult(_0x33fa93,null))[_0xc06c('0x52')](handleError(_0x33fa93,null));};exports[_0xc06c('0x5f')]=function(_0x49923d,_0x3110b4,_0x274b8d){if(_0x49923d['body']['id']){delete _0x49923d['body']['id'];}return db['ServicenowAccount'][_0xc06c('0x5b')]({'where':{'id':_0x49923d[_0xc06c('0x59')]['id']}})[_0xc06c('0x23')](handleEntityNotFound(_0x3110b4,null))[_0xc06c('0x23')](function(_0x14bf39){if(_0x14bf39){_0x49923d[_0xc06c('0x57')][_0xc06c('0x60')]=_0x14bf39['id'];_0x49923d[_0xc06c('0x57')][_0xc06c('0x61')]=integrations[_0xc06c('0x62')](_0x49923d[_0xc06c('0x57')]['channel'],_0x49923d[_0xc06c('0x57')][_0xc06c('0x3c')]);_0x49923d[_0xc06c('0x57')][_0xc06c('0x63')]=integrations[_0xc06c('0x64')](_0x49923d[_0xc06c('0x57')][_0xc06c('0x65')],_0x49923d[_0xc06c('0x57')][_0xc06c('0x3c')]);return db[_0xc06c('0x5c')]['create'](_0x49923d['body'],{'include':[{'model':db[_0xc06c('0x66')],'as':_0xc06c('0x61')},{'model':db[_0xc06c('0x66')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3110b4,null))[_0xc06c('0x52')](handleError(_0x3110b4,null));};exports['getFields']=function(_0x4d067e,_0xe5656,_0x50b863){var _0x3df153=[_0xc06c('0x67'),_0xc06c('0x68'),_0xc06c('0x69'),_0xc06c('0x6a'),_0xc06c('0x6b'),_0xc06c('0x6c'),_0xc06c('0x6d'),_0xc06c('0x6e'),_0xc06c('0x6f')];var _0x1ed0fc=[_0xc06c('0x70'),_0xc06c('0x67'),_0xc06c('0x71'),_0xc06c('0x72'),_0xc06c('0x73'),_0xc06c('0x74'),_0xc06c('0x75'),_0xc06c('0x68'),_0xc06c('0x76'),_0xc06c('0x77'),_0xc06c('0x78'),_0xc06c('0x79'),_0xc06c('0x7a'),_0xc06c('0x7b'),_0xc06c('0x7c'),'sys_domain','state','sys_created_by',_0xc06c('0x69'),_0xc06c('0x5d'),_0xc06c('0x7d'),_0xc06c('0x7e'),_0xc06c('0x7f'),_0xc06c('0x80'),_0xc06c('0x81'),_0xc06c('0x82'),'work_notes_list',_0xc06c('0x83'),'priority',_0xc06c('0x84'),_0xc06c('0x85'),_0xc06c('0x86'),_0xc06c('0x87'),_0xc06c('0x88'),_0xc06c('0x89'),'group_list',_0xc06c('0x8a'),_0xc06c('0x8b'),'resolved_at',_0xc06c('0x8c'),_0xc06c('0x8d'),_0xc06c('0x6a'),_0xc06c('0x8e'),_0xc06c('0x8f'),_0xc06c('0x6b'),_0xc06c('0x90'),_0xc06c('0x91'),_0xc06c('0x92'),_0xc06c('0x93'),_0xc06c('0x94'),_0xc06c('0x95'),'description',_0xc06c('0x96'),'notify','sys_class_name',_0xc06c('0x97'),'closed_by','follow_up',_0xc06c('0x98'),_0xc06c('0x99'),_0xc06c('0x9a'),'reopened_by',_0xc06c('0x6d'),_0xc06c('0x9b'),'problem_id',_0xc06c('0x9c'),_0xc06c('0x9d'),'activity_due',_0xc06c('0x9e'),_0xc06c('0x6e'),'comments','sla_due',_0xc06c('0x9f'),'comments_and_work_notes',_0xc06c('0xa0'),_0xc06c('0xa1'),_0xc06c('0xa2'),_0xc06c('0xa3'),_0xc06c('0xa4'),'upon_approval',_0xc06c('0xa5'),'location','category'];var _0x365009='';var _0x4dd7a1='';var _0x2747d8=[];var _0x3ed639='';var _0x25e589='';var _0x1faa1c=[];var _0x1cdb59='';var _0x5f14cf='';var _0x33bf41={};var _0x343192='';return db[_0xc06c('0x39')]['findOne']({'where':{'id':_0x4d067e['params']['id']},'attributes':['id',_0xc06c('0xa6'),'password',_0xc06c('0xa7'),_0xc06c('0xa8'),'serverUrl']})[_0xc06c('0x23')](handleEntityNotFound(_0xe5656,null))[_0xc06c('0x23')](function(_0x16e6f7){if(_0x16e6f7){_0x343192=_0x16e6f7[_0xc06c('0xa8')];var _0x573582=_0x343192['slice'](-0x1);if(_0x573582==='/'){_0x343192=_0x343192[_0xc06c('0xa9')](0x0,_0x343192['lastIndexOf'](_0x573582));}_0x5f14cf=util[_0xc06c('0xaa')]('%s/api/now/doc/table/schema/',_0x343192);_0x1cdb59=util['format']('%s/api/now/table/',_0x343192);_0x33bf41={'user':_0x16e6f7[_0xc06c('0xa6')],'pass':_0x16e6f7['password']};var _0x25855b={'method':'GET','uri':_0x5f14cf+_0xc06c('0xab'),'auth':_0x33bf41,'json':!![]};return rp(_0x25855b);}})[_0xc06c('0x23')](function(_0x2c4cdd){if(_0x2c4cdd[_0xc06c('0xac')]['length']>0x0){_0x365009=_0x2c4cdd[_0xc06c('0xac')];}console[_0xc06c('0xad')](_0xc06c('0xae'),_0x365009);_0x1faa1c=[];_0x4dd7a1=Object[_0xc06c('0xaf')]([],_0x365009);_[_0xc06c('0xb0')](_0x4dd7a1,function(_0x51d249){return!_0x3df153['includes'](_0x51d249['name']);});_0x4dd7a1[_0xc06c('0xb1')](function(_0x1783e3){var _0x13773d=createFieldObject(_0x1cdb59,_0x33bf41,_0x1783e3[_0xc06c('0xb2')],_0x1783e3[_0xc06c('0x36')],_0x1783e3['label'],![]);_0x1faa1c[_0xc06c('0xb3')](_0x13773d);});return Promise[_0xc06c('0xb4')](_0x1faa1c);})[_0xc06c('0x23')](function(_0x3c40f0){_0x2747d8=_0x3c40f0;_0x3ed639=Object['assign']([],_0x365009);console[_0xc06c('0xad')](_0xc06c('0xb5'),_0x365009);_['remove'](_0x3ed639,function(_0x175019){return _0x1ed0fc[_0xc06c('0xb6')](_0x175019[_0xc06c('0x36')]);});console[_0xc06c('0xad')](_0xc06c('0xb7'),_0x3ed639);_0x1faa1c=[];_0x3ed639[_0xc06c('0xb1')](function(_0xc45dbe){var _0x3dad63=createFieldObject(_0x1cdb59,_0x33bf41,_0xc45dbe[_0xc06c('0xb2')],_0xc45dbe['name'],_0xc45dbe[_0xc06c('0xb8')],!![]);_0x1faa1c[_0xc06c('0xb3')](_0x3dad63);});return Promise['all'](_0x1faa1c);})['then'](function(_0x32c4c9){_0x25e589=_0x32c4c9;var _0x21c4eb=_0x2747d8['concat'](_0x25e589);return{'count':_0x21c4eb[_0xc06c('0x45')],'rows':_0x21c4eb};})[_0xc06c('0x23')](respondWithResult(_0xe5656,null))[_0xc06c('0x52')](function(_0x3a518f){console[_0xc06c('0xad')]('ServiceNow\x20error:\x20'+_0x3a518f);var _0x3beb06=_0x4d067e[_0xc06c('0x3f')][_0xc06c('0x1e')]?0x1f4:_0x3a518f[_0xc06c('0xb9')]||0x1f4;logger[_0xc06c('0x28')](_0x3a518f[_0xc06c('0x35')]);delete _0x3a518f['name'];if(_0x3beb06===0x191){_0x3beb06=0x190;}_0xe5656[_0xc06c('0x2c')](_0x3beb06)[_0xc06c('0x37')](_0x4d067e[_0xc06c('0x3f')][_0xc06c('0x1e')]?{'message':'Wrong\x20credentials','statusCode':_0x3a518f['statusCode']}:_0x3a518f);});};function createFieldObject(_0x3e5018,_0x395478,_0x5dc890,_0x4463c1,_0x3bf272,_0xe4372f){return new Promise(function(_0x2dfa51,_0x197af5){var _0x2bf689={'id':_0x4463c1,'name':_0x3bf272,'custom':_0xe4372f};if(_0x5dc890===_0xc06c('0xba')){_0x2bf689['options']=[{'name':_0xc06c('0xbb'),'value':_0xc06c('0xbc')},{'name':_0xc06c('0xbd'),'value':_0xc06c('0xbe')}];_0x2dfa51(_0x2bf689);}else{var _0x5897b4={'method':'GET','uri':_0x3e5018+_0xc06c('0xbf')+_0x4463c1,'auth':_0x395478,'json':!![]};return rp(_0x5897b4)[_0xc06c('0x23')](function(_0x43138d){var _0x3783c2=[];if(_0x43138d[_0xc06c('0xac')][_0xc06c('0x45')]>0x0){_0x43138d[_0xc06c('0xac')]['forEach'](function(_0x502d9b){if(_0x502d9b['inactive']===_0xc06c('0xbe')){var _0x377d02={'name':_0x502d9b[_0xc06c('0xb8')],'value':_0x502d9b[_0xc06c('0xc0')]};_0x3783c2[_0xc06c('0xb3')](_0x377d02);}});}_0x2bf689['options']=_0x3783c2;if(_0x2bf689[_0xc06c('0x54')]['length']>0x0){_0x2dfa51(_0x2bf689);}else{if(_0xe4372f==![]){_0x2dfa51();}else{_0x2dfa51(_0x2bf689);}}});}});} \ No newline at end of file +var _0x4f5d=['substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','log','incident\x20table\x20objects','assign','remove','forEach','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','internalType','statusCode','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','inactive','value','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','error','message','result','end','status','json','count','offset','limit','Content-Range','apply','reject','save','destroy','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','options','includeAll','include','findAll','rows','show','params','merge','find','catch','create','body','update','getConfigurations','findOne','ServicenowConfiguration','Subjects','getSubjects','channel','Descriptions','ServicenowField','hold_reason','notify','incident_state','severity','category','parent','made_sla','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','opened_by','sys_created_on','sys_domain','state','sys_created_by','knowledge','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','business_service','priority','sys_domain_path','rfc','expected_start','opened_at','business_duration','group_list','resolved_at','approval_set','subcategory','work_notes','short_description','close_code','correlation_display','work_start','business_stc','additional_assignee_list','description','close_notes','closed_by','contact_type','reopened_by','problem_id','reassignment_count','activity_due','assigned_to','comments','sla_due','approval','due_date','sys_mod_count','escalation','upon_approval','correlation_id','location','username','password','email','serverUrl','slice'];(function(_0x7d9c61,_0x2e8c97){var _0x39e41f=function(_0x917dae){while(--_0x917dae){_0x7d9c61['push'](_0x7d9c61['shift']());}};_0x39e41f(++_0x2e8c97);}(_0x4f5d,0xda));var _0xd4f5=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0x4f5d[_0x16b9ed];return _0x66b1f8;};'use strict';var pdf=require(_0xd4f5('0x0'));var emlformat=require(_0xd4f5('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd4f5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd4f5('0x3'));var moment=require(_0xd4f5('0x4'));var BPromise=require(_0xd4f5('0x5'));var Mustache=require(_0xd4f5('0x6'));var util=require(_0xd4f5('0x7'));var path=require(_0xd4f5('0x8'));var sox=require('sox');var csv=require(_0xd4f5('0x9'));var ejs=require(_0xd4f5('0xa'));var fs=require('fs');var _=require(_0xd4f5('0xb'));var squel=require(_0xd4f5('0xc'));var crypto=require(_0xd4f5('0xd'));var jsforce=require(_0xd4f5('0xe'));var deskjs=require(_0xd4f5('0xf'));var toCsv=require(_0xd4f5('0x9'));var querystring=require(_0xd4f5('0x10'));var Papa=require(_0xd4f5('0x11'));var Redis=require(_0xd4f5('0x12'));var authService=require(_0xd4f5('0x13'));var qs=require(_0xd4f5('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0xd4f5('0x15'));var config=require(_0xd4f5('0x16'));var db=require(_0xd4f5('0x17'))['db'];var integrations=require(_0xd4f5('0x18'));var jayson=require('jayson/promise');var client=jayson[_0xd4f5('0x19')]['http']({'port':0x232a});function checkPasswordPattern(_0x3e4064,_0x3fb7ca,_0x392e9f){if(_0x392e9f){var _0x183302=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x183302[_0xd4f5('0x1a')](_0x3fb7ca)){return _0x3e4064;}else{throw new db[(_0xd4f5('0x1b'))][(_0xd4f5('0x1c'))](_0xd4f5('0x1d'));}}else{return _0x3e4064;}}function respondWithRpcPromise(_0x46ef0b,_0x49b3f9,_0x4c82ab,_0x5216e7){return new BPromise(function(_0x1f3c4d,_0xf9bda6){var _0x1faafc=_0x5216e7||client;return _0x1faafc['request'](_0x46ef0b,_0x4c82ab)[_0xd4f5('0x1e')](function(_0x208b07){logger[_0xd4f5('0x1f')](_0xd4f5('0x20'),_0x49b3f9,_0xd4f5('0x21'));logger[_0xd4f5('0x22')]('ServicenowAccount,\x20%s,\x20%s,\x20%s',_0x49b3f9,_0xd4f5('0x21'),JSON['stringify'](_0x208b07));if(_0x208b07[_0xd4f5('0x23')]){if(_0x208b07[_0xd4f5('0x23')]['code']===0x1f4){logger['error'](_0xd4f5('0x20'),_0x49b3f9,_0x208b07[_0xd4f5('0x23')][_0xd4f5('0x24')]);return _0xf9bda6(_0x208b07[_0xd4f5('0x23')][_0xd4f5('0x24')]);}logger[_0xd4f5('0x23')](_0xd4f5('0x20'),_0x49b3f9,_0x208b07[_0xd4f5('0x23')][_0xd4f5('0x24')]);return _0x1f3c4d(_0x208b07[_0xd4f5('0x23')][_0xd4f5('0x24')]);}else{logger[_0xd4f5('0x1f')]('ServicenowAccount,\x20%s,\x20%s',_0x49b3f9,_0xd4f5('0x21'));_0x1f3c4d(_0x208b07[_0xd4f5('0x25')]['message']);}})['catch'](function(_0x2599c2){logger[_0xd4f5('0x23')](_0xd4f5('0x20'),_0x49b3f9,_0x2599c2);_0xf9bda6(_0x2599c2);});});}function respondWithStatusCode(_0xc53282,_0x12472e){_0x12472e=_0x12472e||0xcc;return function(_0x351d6c){if(_0x351d6c){return _0xc53282['sendStatus'](_0x12472e);}return _0xc53282['status'](_0x12472e)[_0xd4f5('0x26')]();};}function respondWithResult(_0x4b8115,_0x39d90d){_0x39d90d=_0x39d90d||0xc8;return function(_0x218b49){if(_0x218b49){return _0x4b8115[_0xd4f5('0x27')](_0x39d90d)[_0xd4f5('0x28')](_0x218b49);}};}function respondWithFilteredResult(_0x53c6a0,_0x1ae0f2){return function(_0x44cafc){if(_0x44cafc){var _0x3c78bc=_0x44cafc[_0xd4f5('0x29')],_0x560c04=_0x1ae0f2['offset'],_0x3ef4ba=_0x1ae0f2[_0xd4f5('0x2a')]+_0x1ae0f2[_0xd4f5('0x2b')],_0x30e21e;if(_0x3ef4ba>=_0x3c78bc){_0x3ef4ba=_0x3c78bc;_0x30e21e=0xc8;}else{_0x30e21e=0xce;}_0x53c6a0[_0xd4f5('0x27')](_0x30e21e);return _0x53c6a0['set'](_0xd4f5('0x2c'),_0x560c04+'-'+_0x3ef4ba+'/'+_0x3c78bc)[_0xd4f5('0x28')](_0x44cafc);}return null;};}function patchUpdates(_0x54c8dc){return function(_0x59ebc4){try{jsonpatch[_0xd4f5('0x2d')](_0x59ebc4,_0x54c8dc,!![]);}catch(_0x535ddf){return BPromise[_0xd4f5('0x2e')](_0x535ddf);}return _0x59ebc4[_0xd4f5('0x2f')]();};}function saveUpdates(_0x472a35,_0x23de80){return function(_0x3d56ac){if(_0x3d56ac){return _0x3d56ac['update'](_0x472a35)[_0xd4f5('0x1e')](function(_0x188304){return _0x188304;});}return null;};}function removeEntity(_0x297902,_0x492b12){return function(_0x3b6580){if(_0x3b6580){return _0x3b6580[_0xd4f5('0x30')]()['then'](function(){_0x297902[_0xd4f5('0x27')](0xcc)[_0xd4f5('0x26')]();});}};}function handleEntityNotFound(_0x25ca71,_0x3d566f){return function(_0x538aee){if(!_0x538aee){_0x25ca71['sendStatus'](0x194);}return _0x538aee;};}function handleError(_0x31431c,_0x238cc6){_0x238cc6=_0x238cc6||0x1f4;return function(_0x1066ea){logger[_0xd4f5('0x23')](_0x1066ea[_0xd4f5('0x31')]);if(_0x1066ea[_0xd4f5('0x32')]){delete _0x1066ea['name'];}_0x31431c['status'](_0x238cc6)[_0xd4f5('0x33')](_0x1066ea);};}exports['index']=function(_0xe06436,_0x3676d4){var _0x37c456={},_0xda4e39={},_0x291d0b={'count':0x0,'rows':[]};var _0x2831bf=_[_0xd4f5('0x34')](db[_0xd4f5('0x35')][_0xd4f5('0x36')],function(_0x2d9eeb){return{'name':_0x2d9eeb[_0xd4f5('0x37')],'type':_0x2d9eeb[_0xd4f5('0x38')][_0xd4f5('0x39')]};});_0xda4e39[_0xd4f5('0x3a')]=_[_0xd4f5('0x34')](_0x2831bf,_0xd4f5('0x32'));_0xda4e39[_0xd4f5('0x3b')]=_[_0xd4f5('0x3c')](_0xe06436[_0xd4f5('0x3b')]);_0xda4e39['filters']=_[_0xd4f5('0x3d')](_0xda4e39[_0xd4f5('0x3a')],_0xda4e39[_0xd4f5('0x3b')]);_0x37c456['attributes']=_[_0xd4f5('0x3d')](_0xda4e39[_0xd4f5('0x3a')],qs[_0xd4f5('0x3e')](_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x3e')]));_0x37c456['attributes']=_0x37c456[_0xd4f5('0x3f')][_0xd4f5('0x40')]?_0x37c456['attributes']:_0xda4e39[_0xd4f5('0x3a')];if(!_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x41')](_0xd4f5('0x42'))){_0x37c456['limit']=qs[_0xd4f5('0x2b')](_0xe06436[_0xd4f5('0x3b')]['limit']);_0x37c456[_0xd4f5('0x2a')]=qs[_0xd4f5('0x2a')](_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x2a')]);}_0x37c456[_0xd4f5('0x43')]=qs[_0xd4f5('0x44')](_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x44')]);_0x37c456['where']=qs[_0xd4f5('0x45')](_[_0xd4f5('0x46')](_0xe06436['query'],_0xda4e39['filters']));if(_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x47')]){_0x37c456[_0xd4f5('0x48')]=_['merge'](_0x37c456[_0xd4f5('0x48')],{'$or':_[_0xd4f5('0x34')](_0x2831bf,function(_0x1482a1){if(_0x1482a1[_0xd4f5('0x38')]!=='VIRTUAL'){var _0x5e395d={};_0x5e395d[_0x1482a1[_0xd4f5('0x32')]]={'$like':'%'+_0xe06436[_0xd4f5('0x3b')]['filter']+'%'};return _0x5e395d;}})});}_0x37c456=_['merge']({},_0x37c456,_0xe06436[_0xd4f5('0x49')]);var _0x22a804={'where':_0x37c456['where']};return db[_0xd4f5('0x35')][_0xd4f5('0x29')](_0x22a804)[_0xd4f5('0x1e')](function(_0x4d122b){_0x291d0b['count']=_0x4d122b;if(_0xe06436[_0xd4f5('0x3b')][_0xd4f5('0x4a')]){_0x37c456[_0xd4f5('0x4b')]=[{'all':!![]}];}return db[_0xd4f5('0x35')][_0xd4f5('0x4c')](_0x37c456);})[_0xd4f5('0x1e')](function(_0x5e43f4){_0x291d0b[_0xd4f5('0x4d')]=_0x5e43f4;return _0x291d0b;})[_0xd4f5('0x1e')](respondWithFilteredResult(_0x3676d4,_0x37c456))['catch'](handleError(_0x3676d4,null));};exports[_0xd4f5('0x4e')]=function(_0x546dda,_0x271dca){var _0x2b3255={'raw':![],'where':{'id':_0x546dda[_0xd4f5('0x4f')]['id']}},_0x23b83e={};_0x23b83e['model']=_[_0xd4f5('0x3c')](db['ServicenowAccount'][_0xd4f5('0x36')]);_0x23b83e['query']=_[_0xd4f5('0x3c')](_0x546dda[_0xd4f5('0x3b')]);_0x23b83e[_0xd4f5('0x45')]=_['intersection'](_0x23b83e['model'],_0x23b83e[_0xd4f5('0x3b')]);_0x2b3255[_0xd4f5('0x3f')]=_[_0xd4f5('0x3d')](_0x23b83e[_0xd4f5('0x3a')],qs[_0xd4f5('0x3e')](_0x546dda['query'][_0xd4f5('0x3e')]));_0x2b3255['attributes']=_0x2b3255['attributes'][_0xd4f5('0x40')]?_0x2b3255[_0xd4f5('0x3f')]:_0x23b83e[_0xd4f5('0x3a')];if(_0x546dda['query'][_0xd4f5('0x4a')]){_0x2b3255[_0xd4f5('0x4b')]=[{'all':!![]}];}_0x2b3255=_[_0xd4f5('0x50')]({},_0x2b3255,_0x546dda[_0xd4f5('0x49')]);return db[_0xd4f5('0x35')][_0xd4f5('0x51')](_0x2b3255)['then'](handleEntityNotFound(_0x271dca,null))['then'](respondWithResult(_0x271dca,null))[_0xd4f5('0x52')](handleError(_0x271dca,null));};exports[_0xd4f5('0x53')]=function(_0x2e0622,_0x37660a){return db[_0xd4f5('0x35')][_0xd4f5('0x53')](_0x2e0622[_0xd4f5('0x54')],{})['then'](respondWithResult(_0x37660a,0xc9))[_0xd4f5('0x52')](handleError(_0x37660a,null));};exports[_0xd4f5('0x55')]=function(_0x59664d,_0xd9a556){if(_0x59664d['body']['id']){delete _0x59664d['body']['id'];}return db[_0xd4f5('0x35')][_0xd4f5('0x51')]({'where':{'id':_0x59664d[_0xd4f5('0x4f')]['id']}})[_0xd4f5('0x1e')](handleEntityNotFound(_0xd9a556,null))[_0xd4f5('0x1e')](saveUpdates(_0x59664d[_0xd4f5('0x54')],null))[_0xd4f5('0x1e')](respondWithResult(_0xd9a556,null))['catch'](handleError(_0xd9a556,null));};exports['destroy']=function(_0x2cd321,_0x3d878b){return db['ServicenowAccount'][_0xd4f5('0x51')]({'where':{'id':_0x2cd321[_0xd4f5('0x4f')]['id']}})[_0xd4f5('0x1e')](handleEntityNotFound(_0x3d878b,null))[_0xd4f5('0x1e')](removeEntity(_0x3d878b,null))[_0xd4f5('0x52')](handleError(_0x3d878b,null));};exports[_0xd4f5('0x56')]=function(_0x3853f6,_0xe911c1,_0x5c6563){var _0x40154c={};var _0x30198c={};var _0x274e2e;var _0x3f99e6;return db[_0xd4f5('0x35')][_0xd4f5('0x57')]({'where':{'id':_0x3853f6[_0xd4f5('0x4f')]['id']}})[_0xd4f5('0x1e')](handleEntityNotFound(_0xe911c1,null))[_0xd4f5('0x1e')](function(_0x2bd132){if(_0x2bd132){_0x274e2e=_0x2bd132;_0x30198c[_0xd4f5('0x3a')]=_[_0xd4f5('0x3c')](db[_0xd4f5('0x58')][_0xd4f5('0x36')]);_0x30198c[_0xd4f5('0x3b')]=_['keys'](_0x3853f6[_0xd4f5('0x3b')]);_0x30198c['filters']=_[_0xd4f5('0x3d')](_0x30198c[_0xd4f5('0x3a')],_0x30198c[_0xd4f5('0x3b')]);_0x40154c['attributes']=_['intersection'](_0x30198c[_0xd4f5('0x3a')],qs[_0xd4f5('0x3e')](_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x3e')]));_0x40154c[_0xd4f5('0x3f')]=_0x40154c[_0xd4f5('0x3f')]['length']?_0x40154c[_0xd4f5('0x3f')]:_0x30198c['model'];_0x40154c['order']=qs[_0xd4f5('0x44')](_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x44')]);_0x40154c[_0xd4f5('0x48')]=qs['filters'](_['pick'](_0x3853f6[_0xd4f5('0x3b')],_0x30198c['filters']));if(_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x47')]){_0x40154c[_0xd4f5('0x48')]=_['merge'](_0x40154c[_0xd4f5('0x48')],{'$or':_[_0xd4f5('0x34')](_0x40154c[_0xd4f5('0x3f')],function(_0x3f4126){var _0x5d5ff4={};_0x5d5ff4[_0x3f4126]={'$like':'%'+_0x3853f6[_0xd4f5('0x3b')]['filter']+'%'};return _0x5d5ff4;})});}_0x40154c=_[_0xd4f5('0x50')]({},_0x40154c,_0x3853f6[_0xd4f5('0x49')]);return _0x274e2e[_0xd4f5('0x56')](_0x40154c);}})[_0xd4f5('0x1e')](function(_0x5ab0c4){if(_0x5ab0c4){_0x3f99e6=_0x5ab0c4[_0xd4f5('0x40')];if(!_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x41')](_0xd4f5('0x42'))){_0x40154c[_0xd4f5('0x2b')]=qs['limit'](_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x2b')]);_0x40154c['offset']=qs['offset'](_0x3853f6[_0xd4f5('0x3b')][_0xd4f5('0x2a')]);}return _0x274e2e['getConfigurations'](_0x40154c);}})[_0xd4f5('0x1e')](function(_0x203c6d){if(_0x203c6d){return _0x203c6d?{'count':_0x3f99e6,'rows':_0x203c6d}:null;}})[_0xd4f5('0x1e')](respondWithResult(_0xe911c1,null))['catch'](handleError(_0xe911c1,null));};exports['addConfiguration']=function(_0xcaf972,_0x40123b,_0x2598b2){if(_0xcaf972['body']['id']){delete _0xcaf972[_0xd4f5('0x54')]['id'];}return db['ServicenowAccount']['findOne']({'where':{'id':_0xcaf972[_0xd4f5('0x4f')]['id']}})[_0xd4f5('0x1e')](handleEntityNotFound(_0x40123b,null))[_0xd4f5('0x1e')](function(_0x54c2b1){if(_0x54c2b1){_0xcaf972[_0xd4f5('0x54')]['AccountId']=_0x54c2b1['id'];_0xcaf972['body'][_0xd4f5('0x59')]=integrations[_0xd4f5('0x5a')](_0xcaf972['body'][_0xd4f5('0x5b')],_0xcaf972[_0xd4f5('0x54')][_0xd4f5('0x38')]);_0xcaf972[_0xd4f5('0x54')][_0xd4f5('0x5c')]=integrations['getDescriptions'](_0xcaf972[_0xd4f5('0x54')][_0xd4f5('0x5b')],_0xcaf972[_0xd4f5('0x54')]['type']);return db[_0xd4f5('0x58')][_0xd4f5('0x53')](_0xcaf972[_0xd4f5('0x54')],{'include':[{'model':db[_0xd4f5('0x5d')],'as':'Subjects'},{'model':db[_0xd4f5('0x5d')],'as':_0xd4f5('0x5c')}]});}return null;})[_0xd4f5('0x1e')](respondWithResult(_0x40123b,null))[_0xd4f5('0x52')](handleError(_0x40123b,null));};exports['getFields']=function(_0x40ce57,_0x2232c6,_0x191541){var _0x9de310=['made_sla',_0xd4f5('0x5e'),'knowledge','subcategory','close_code',_0xd4f5('0x5f'),_0xd4f5('0x60'),_0xd4f5('0x61'),_0xd4f5('0x62')];var _0x45a89f=[_0xd4f5('0x63'),_0xd4f5('0x64'),_0xd4f5('0x65'),_0xd4f5('0x66'),_0xd4f5('0x67'),_0xd4f5('0x68'),_0xd4f5('0x69'),_0xd4f5('0x5e'),_0xd4f5('0x6a'),_0xd4f5('0x6b'),_0xd4f5('0x6c'),'sys_updated_by',_0xd4f5('0x6d'),'user_input',_0xd4f5('0x6e'),_0xd4f5('0x6f'),_0xd4f5('0x70'),_0xd4f5('0x71'),_0xd4f5('0x72'),'order','calendar_stc',_0xd4f5('0x73'),_0xd4f5('0x74'),_0xd4f5('0x75'),_0xd4f5('0x76'),_0xd4f5('0x77'),_0xd4f5('0x78'),_0xd4f5('0x79'),_0xd4f5('0x7a'),_0xd4f5('0x7b'),_0xd4f5('0x7c'),'time_worked',_0xd4f5('0x7d'),_0xd4f5('0x7e'),_0xd4f5('0x7f'),_0xd4f5('0x80'),'work_end','reopened_time',_0xd4f5('0x81'),'caller_id',_0xd4f5('0x82'),_0xd4f5('0x83'),_0xd4f5('0x84'),_0xd4f5('0x85'),_0xd4f5('0x86'),_0xd4f5('0x87'),'delivery_task',_0xd4f5('0x88'),'assignment_group',_0xd4f5('0x89'),_0xd4f5('0x8a'),_0xd4f5('0x8b'),'calendar_duration',_0xd4f5('0x5f'),'sys_class_name',_0xd4f5('0x8c'),_0xd4f5('0x8d'),'follow_up','parent_incident','sys_id',_0xd4f5('0x8e'),_0xd4f5('0x8f'),_0xd4f5('0x60'),'urgency',_0xd4f5('0x90'),'company',_0xd4f5('0x91'),_0xd4f5('0x92'),_0xd4f5('0x93'),_0xd4f5('0x61'),_0xd4f5('0x94'),_0xd4f5('0x95'),_0xd4f5('0x96'),'comments_and_work_notes',_0xd4f5('0x97'),_0xd4f5('0x98'),'reopen_count','sys_tags',_0xd4f5('0x99'),_0xd4f5('0x9a'),_0xd4f5('0x9b'),_0xd4f5('0x9c'),_0xd4f5('0x62')];var _0x472e3a='';var _0xa84045='';var _0x403f1f=[];var _0x2a4bc9='';var _0x806b52='';var _0x12d29d=[];var _0x4462a1='';var _0x5d1f7e='';var _0x426f9e={};var _0x4d46eb='';return db[_0xd4f5('0x35')][_0xd4f5('0x57')]({'where':{'id':_0x40ce57[_0xd4f5('0x4f')]['id']},'attributes':['id',_0xd4f5('0x9d'),_0xd4f5('0x9e'),_0xd4f5('0x9f'),'remoteUri',_0xd4f5('0xa0')]})['then'](handleEntityNotFound(_0x2232c6,null))['then'](function(_0x28d5a3){if(_0x28d5a3){_0x4d46eb=_0x28d5a3['remoteUri'];var _0x485424=_0x4d46eb[_0xd4f5('0xa1')](-0x1);if(_0x485424==='/'){_0x4d46eb=_0x4d46eb[_0xd4f5('0xa2')](0x0,_0x4d46eb[_0xd4f5('0xa3')](_0x485424));}_0x5d1f7e=util[_0xd4f5('0xa4')](_0xd4f5('0xa5'),_0x4d46eb);_0x4462a1=util[_0xd4f5('0xa4')](_0xd4f5('0xa6'),_0x4d46eb);_0x426f9e={'user':_0x28d5a3[_0xd4f5('0x9d')],'pass':_0x28d5a3[_0xd4f5('0x9e')]};var _0x1123cc={'method':_0xd4f5('0xa7'),'uri':_0x5d1f7e+_0xd4f5('0xa8'),'auth':_0x426f9e,'json':!![]};return rp(_0x1123cc);}})[_0xd4f5('0x1e')](function(_0x130dd0){if(_0x130dd0['result'][_0xd4f5('0x40')]>0x0){_0x472e3a=_0x130dd0[_0xd4f5('0x25')];}console[_0xd4f5('0xa9')](_0xd4f5('0xaa'),_0x472e3a);_0x12d29d=[];_0xa84045=Object[_0xd4f5('0xab')]([],_0x472e3a);_[_0xd4f5('0xac')](_0xa84045,function(_0x430792){return!_0x9de310['includes'](_0x430792[_0xd4f5('0x32')]);});_0xa84045[_0xd4f5('0xad')](function(_0x27c517){var _0x5aaf82=createFieldObject(_0x4462a1,_0x426f9e,_0x27c517['internalType'],_0x27c517[_0xd4f5('0x32')],_0x27c517[_0xd4f5('0xae')],![]);_0x12d29d[_0xd4f5('0xaf')](_0x5aaf82);});return Promise[_0xd4f5('0xb0')](_0x12d29d);})[_0xd4f5('0x1e')](function(_0x46c0e7){_0x403f1f=_0x46c0e7;_0x2a4bc9=Object['assign']([],_0x472e3a);console[_0xd4f5('0xa9')](_0xd4f5('0xb1'),_0x472e3a);_[_0xd4f5('0xac')](_0x2a4bc9,function(_0x3d73f6){return _0x45a89f[_0xd4f5('0xb2')](_0x3d73f6[_0xd4f5('0x32')]);});console[_0xd4f5('0xa9')](_0xd4f5('0xb3'),_0x2a4bc9);_0x12d29d=[];_0x2a4bc9[_0xd4f5('0xad')](function(_0x4f081c){var _0x423776=createFieldObject(_0x4462a1,_0x426f9e,_0x4f081c[_0xd4f5('0xb4')],_0x4f081c['name'],_0x4f081c['label'],!![]);_0x12d29d[_0xd4f5('0xaf')](_0x423776);});return Promise[_0xd4f5('0xb0')](_0x12d29d);})['then'](function(_0x28bf75){_0x806b52=_0x28bf75;var _0x22a39c=_0x403f1f['concat'](_0x806b52);return{'count':_0x22a39c[_0xd4f5('0x40')],'rows':_0x22a39c};})[_0xd4f5('0x1e')](respondWithResult(_0x2232c6,null))[_0xd4f5('0x52')](function(_0x4f8df3){console[_0xd4f5('0xa9')]('ServiceNow\x20error:\x20'+_0x4f8df3);var _0x5b6da6=_0x40ce57[_0xd4f5('0x3b')]['test']?0x1f4:_0x4f8df3['statusCode']||0x1f4;logger['error'](_0x4f8df3['stack']);delete _0x4f8df3[_0xd4f5('0x32')];if(_0x5b6da6===0x191){_0x5b6da6=0x190;}_0x2232c6[_0xd4f5('0x27')](_0x5b6da6)[_0xd4f5('0x33')](_0x40ce57[_0xd4f5('0x3b')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x4f8df3[_0xd4f5('0xb5')]}:_0x4f8df3);});};function createFieldObject(_0x326b60,_0x4191f3,_0x49fa1c,_0x325353,_0x296f33,_0x26e37a){return new Promise(function(_0x1add8a,_0x3e4cef){var _0x6e95ac={'id':_0x325353,'name':_0x296f33,'custom':_0x26e37a};if(_0x49fa1c===_0xd4f5('0xb6')){_0x6e95ac[_0xd4f5('0x49')]=[{'name':_0xd4f5('0xb7'),'value':_0xd4f5('0xb8')},{'name':_0xd4f5('0xb9'),'value':_0xd4f5('0xba')}];_0x1add8a(_0x6e95ac);}else{var _0x458c68={'method':_0xd4f5('0xa7'),'uri':_0x326b60+_0xd4f5('0xbb')+_0x325353,'auth':_0x4191f3,'json':!![]};return rp(_0x458c68)[_0xd4f5('0x1e')](function(_0x3e4b01){var _0x4ac4c8=[];if(_0x3e4b01[_0xd4f5('0x25')][_0xd4f5('0x40')]>0x0){_0x3e4b01[_0xd4f5('0x25')]['forEach'](function(_0x257ab1){if(_0x257ab1[_0xd4f5('0xbc')]===_0xd4f5('0xba')){var _0x544bd6={'name':_0x257ab1[_0xd4f5('0xae')],'value':_0x257ab1[_0xd4f5('0xbd')]};_0x4ac4c8[_0xd4f5('0xaf')](_0x544bd6);}});}_0x6e95ac['options']=_0x4ac4c8;if(_0x6e95ac['options']['length']>0x0){_0x1add8a(_0x6e95ac);}else{if(_0x26e37a==![]){_0x1add8a();}else{_0x1add8a(_0x6e95ac);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index df45d90..7eddcf1 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 _0xb4c7=['moment','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api'];(function(_0x27314d,_0x33c0f2){var _0x30a648=function(_0x21e50b){while(--_0x21e50b){_0x27314d['push'](_0x27314d['shift']());}};_0x30a648(++_0x33c0f2);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x52a53c,_0x5395a4){_0x52a53c=_0x52a53c-0x0;var _0x1e5a03=_0xb4c7[_0x52a53c];return _0x1e5a03;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var logger=require(_0x7b4c('0x2'))(_0x7b4c('0x3'));var moment=require(_0x7b4c('0x4'));var BPromise=require('bluebird');var rp=require(_0x7b4c('0x5'));var fs=require('fs');var path=require(_0x7b4c('0x6'));var rimraf=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var attributes=require(_0x7b4c('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x7b4c('0xa')]=function(_0x10e197,_0x2dd5c7){return _0x10e197['define'](_0x7b4c('0xb'),attributes,{'tableName':_0x7b4c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6334=['int_servicenow_accounts','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x6334,0x119));var _0x4633=function(_0x3f94f9,_0x42774b){_0x3f94f9=_0x3f94f9-0x0;var _0x46f84f=_0x6334[_0x3f94f9];return _0x46f84f;};'use strict';var _=require(_0x4633('0x0'));var util=require(_0x4633('0x1'));var logger=require(_0x4633('0x2'))(_0x4633('0x3'));var moment=require(_0x4633('0x4'));var BPromise=require(_0x4633('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4633('0x6'));var rimraf=require(_0x4633('0x7'));var config=require(_0x4633('0x8'));var attributes=require(_0x4633('0x9'));var integrations=require(_0x4633('0xa'));module[_0x4633('0xb')]=function(_0x175e14,_0x4a8997){return _0x175e14[_0x4633('0xc')]('ServicenowAccount',attributes,{'tableName':_0x4633('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index d2bb562..0f526cf 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 _0x7f6f=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowServicenowAccount','util','moment','bluebird','randomstring','../../config/utils'];(function(_0x191b48,_0x402e4e){var _0x2aff3c=function(_0x2b7faf){while(--_0x2b7faf){_0x191b48['push'](_0x191b48['shift']());}};_0x2aff3c(++_0x402e4e);}(_0x7f6f,0xa5));var _0xf7f6=function(_0x187309,_0x2cb520){_0x187309=_0x187309-0x0;var _0x1d3711=_0x7f6f[_0x187309];return _0x1d3711;};'use strict';var _=require('lodash');var util=require(_0xf7f6('0x0'));var moment=require(_0xf7f6('0x1'));var BPromise=require(_0xf7f6('0x2'));var rs=require(_0xf7f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xf7f6('0x4'));var logger=require('../../config/logger')(_0xf7f6('0x5'));var config=require(_0xf7f6('0x6'));var jayson=require(_0xf7f6('0x7'));var client=jayson[_0xf7f6('0x8')][_0xf7f6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e4ca5,_0x4efb0f,_0x457fe9){return new BPromise(function(_0x58ff99,_0x3f2b46){return client[_0xf7f6('0xa')](_0x5e4ca5,_0x457fe9)[_0xf7f6('0xb')](function(_0x114d7e){logger[_0xf7f6('0xc')](_0xf7f6('0xd'),_0x4efb0f,_0xf7f6('0xe'));logger['debug'](_0xf7f6('0xf'),_0x4efb0f,_0xf7f6('0xe'),JSON[_0xf7f6('0x10')](_0x114d7e));if(_0x114d7e[_0xf7f6('0x11')]){if(_0x114d7e[_0xf7f6('0x11')][_0xf7f6('0x12')]===0x1f4){logger[_0xf7f6('0x11')](_0xf7f6('0xd'),_0x4efb0f,_0x114d7e['error']['message']);return _0x3f2b46(_0x114d7e[_0xf7f6('0x11')][_0xf7f6('0x13')]);}logger[_0xf7f6('0x11')](_0xf7f6('0xd'),_0x4efb0f,_0x114d7e['error'][_0xf7f6('0x13')]);return _0x58ff99(_0x114d7e[_0xf7f6('0x11')][_0xf7f6('0x13')]);}else{logger['info'](_0xf7f6('0xd'),_0x4efb0f,_0xf7f6('0xe'));_0x58ff99(_0x114d7e['result'][_0xf7f6('0x13')]);}})[_0xf7f6('0x14')](function(_0x9136b4){logger[_0xf7f6('0x11')](_0xf7f6('0xd'),_0x4efb0f,_0x9136b4);_0x3f2b46(_0x9136b4);});});}exports[_0xf7f6('0x15')]=function(_0x42ae9f){var _0x2b60ab=this;return new Promise(function(_0x72dadf,_0x2425fd){return db[_0xf7f6('0x16')][_0xf7f6('0x17')]({'raw':_0x42ae9f[_0xf7f6('0x18')]?_0x42ae9f['options'][_0xf7f6('0x19')]===undefined?!![]:![]:!![],'where':_0x42ae9f['options']?_0x42ae9f[_0xf7f6('0x18')][_0xf7f6('0x1a')]||null:null,'attributes':_0x42ae9f[_0xf7f6('0x18')]?_0x42ae9f[_0xf7f6('0x18')][_0xf7f6('0x1b')]||null:null,'limit':_0x42ae9f[_0xf7f6('0x18')]?_0x42ae9f['options'][_0xf7f6('0x1c')]||null:null,'include':_0x42ae9f[_0xf7f6('0x18')]?_0x42ae9f['options'][_0xf7f6('0x1d')]?_[_0xf7f6('0x1e')](_0x42ae9f[_0xf7f6('0x18')][_0xf7f6('0x1d')],function(_0x276dbf){return{'model':db[_0x276dbf['model']],'as':_0x276dbf['as'],'attributes':_0x276dbf[_0xf7f6('0x1b')],'include':_0x276dbf[_0xf7f6('0x1d')]?_['map'](_0x276dbf[_0xf7f6('0x1d')],function(_0x3ec86b){return{'model':db[_0x3ec86b[_0xf7f6('0x1f')]],'as':_0x3ec86b['as'],'attributes':_0x3ec86b[_0xf7f6('0x1b')],'include':_0x3ec86b['include']?_[_0xf7f6('0x1e')](_0x3ec86b[_0xf7f6('0x1d')],function(_0xda743b){return{'model':db[_0xda743b[_0xf7f6('0x1f')]],'as':_0xda743b['as'],'attributes':_0xda743b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf7f6('0xb')](function(_0x341f23){logger['info']('GetServicenowAccount',_0x42ae9f);logger[_0xf7f6('0x20')](_0xf7f6('0x15'),_0x42ae9f,JSON[_0xf7f6('0x10')](_0x341f23));_0x72dadf(_0x341f23);})['catch'](function(_0x36ca56){logger[_0xf7f6('0x11')](_0xf7f6('0x15'),_0x36ca56[_0xf7f6('0x13')],_0x42ae9f);_0x2425fd(_0x2b60ab[_0xf7f6('0x11')](0x1f4,_0x36ca56[_0xf7f6('0x13')]));});});};exports[_0xf7f6('0x21')]=function(_0x50d204){var _0x45659e=this;return new Promise(function(_0x51c434,_0x3d9d95){return db[_0xf7f6('0x16')]['find']({'raw':_0x50d204[_0xf7f6('0x18')]?_0x50d204['options'][_0xf7f6('0x19')]===undefined?!![]:![]:!![],'where':_0x50d204['options']?_0x50d204['options'][_0xf7f6('0x1a')]||null:null,'attributes':_0x50d204['options']?_0x50d204[_0xf7f6('0x18')][_0xf7f6('0x1b')]||null:null,'include':_0x50d204[_0xf7f6('0x18')]?_0x50d204[_0xf7f6('0x18')][_0xf7f6('0x1d')]?_[_0xf7f6('0x1e')](_0x50d204[_0xf7f6('0x18')][_0xf7f6('0x1d')],function(_0xdbe4d2){return{'model':db[_0xdbe4d2['model']],'as':_0xdbe4d2['as'],'attributes':_0xdbe4d2[_0xf7f6('0x1b')],'include':_0xdbe4d2[_0xf7f6('0x1d')]?_[_0xf7f6('0x1e')](_0xdbe4d2[_0xf7f6('0x1d')],function(_0x52cee9){return{'model':db[_0x52cee9[_0xf7f6('0x1f')]],'as':_0x52cee9['as'],'attributes':_0x52cee9['attributes'],'include':_0x52cee9[_0xf7f6('0x1d')]?_[_0xf7f6('0x1e')](_0x52cee9['include'],function(_0x5ae9e8){return{'model':db[_0x5ae9e8['model']],'as':_0x5ae9e8['as'],'attributes':_0x5ae9e8[_0xf7f6('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xf7f6('0xb')](function(_0x56e39b){logger[_0xf7f6('0xc')]('ShowServicenowAccount',_0x50d204);logger[_0xf7f6('0x20')](_0xf7f6('0x21'),_0x50d204,JSON['stringify'](_0x56e39b));_0x51c434(_0x56e39b);})[_0xf7f6('0x14')](function(_0x1b2a7c){logger[_0xf7f6('0x11')](_0xf7f6('0x21'),_0x1b2a7c[_0xf7f6('0x13')],_0x50d204);_0x3d9d95(_0x45659e[_0xf7f6('0x11')](0x1f4,_0x1b2a7c['message']));});});}; \ No newline at end of file +var _0xb065=['../../config/utils','../../config/logger','rpc','jayson/promise','request','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','map','include','model','then','stringify','find','where','ShowServicenowAccount','lodash','util','moment','ioredis','../../mysqldb'];(function(_0x804193,_0x14c4e8){var _0x2f7b5c=function(_0x282ff8){while(--_0x282ff8){_0x804193['push'](_0x804193['shift']());}};_0x2f7b5c(++_0x14c4e8);}(_0xb065,0x1a8));var _0x5b06=function(_0x2036c3,_0x64526c){_0x2036c3=_0x2036c3-0x0;var _0x3d1799=_0xb065[_0x2036c3];return _0x3d1799;};'use strict';var _=require(_0x5b06('0x0'));var util=require(_0x5b06('0x1'));var moment=require(_0x5b06('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5b06('0x3'));var db=require(_0x5b06('0x4'))['db'];var utils=require(_0x5b06('0x5'));var logger=require(_0x5b06('0x6'))(_0x5b06('0x7'));var config=require('../../config/environment');var jayson=require(_0x5b06('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x7f0e0,_0x214eff,_0x5cc064){return new BPromise(function(_0x698a41,_0xdab616){return client[_0x5b06('0x9')](_0x7f0e0,_0x5cc064)['then'](function(_0x2e4324){logger['info'](_0x5b06('0xa'),_0x214eff,_0x5b06('0xb'));logger[_0x5b06('0xc')](_0x5b06('0xd'),_0x214eff,_0x5b06('0xb'),JSON['stringify'](_0x2e4324));if(_0x2e4324[_0x5b06('0xe')]){if(_0x2e4324[_0x5b06('0xe')][_0x5b06('0xf')]===0x1f4){logger[_0x5b06('0xe')](_0x5b06('0xa'),_0x214eff,_0x2e4324[_0x5b06('0xe')][_0x5b06('0x10')]);return _0xdab616(_0x2e4324[_0x5b06('0xe')]['message']);}logger[_0x5b06('0xe')]('ServicenowAccount,\x20%s,\x20%s',_0x214eff,_0x2e4324[_0x5b06('0xe')][_0x5b06('0x10')]);return _0x698a41(_0x2e4324['error'][_0x5b06('0x10')]);}else{logger[_0x5b06('0x11')]('ServicenowAccount,\x20%s,\x20%s',_0x214eff,_0x5b06('0xb'));_0x698a41(_0x2e4324['result']['message']);}})[_0x5b06('0x12')](function(_0x23098d){logger[_0x5b06('0xe')](_0x5b06('0xa'),_0x214eff,_0x23098d);_0xdab616(_0x23098d);});});}exports[_0x5b06('0x13')]=function(_0x207672){var _0x386826=this;return new Promise(function(_0x349d90,_0x50c333){return db[_0x5b06('0x14')][_0x5b06('0x15')]({'raw':_0x207672[_0x5b06('0x16')]?_0x207672[_0x5b06('0x16')][_0x5b06('0x17')]===undefined?!![]:![]:!![],'where':_0x207672['options']?_0x207672[_0x5b06('0x16')]['where']||null:null,'attributes':_0x207672[_0x5b06('0x16')]?_0x207672[_0x5b06('0x16')][_0x5b06('0x18')]||null:null,'limit':_0x207672[_0x5b06('0x16')]?_0x207672[_0x5b06('0x16')]['limit']||null:null,'include':_0x207672['options']?_0x207672['options']['include']?_[_0x5b06('0x19')](_0x207672['options'][_0x5b06('0x1a')],function(_0x92885a){return{'model':db[_0x92885a['model']],'as':_0x92885a['as'],'attributes':_0x92885a[_0x5b06('0x18')],'include':_0x92885a[_0x5b06('0x1a')]?_['map'](_0x92885a[_0x5b06('0x1a')],function(_0x14c279){return{'model':db[_0x14c279[_0x5b06('0x1b')]],'as':_0x14c279['as'],'attributes':_0x14c279[_0x5b06('0x18')],'include':_0x14c279[_0x5b06('0x1a')]?_['map'](_0x14c279[_0x5b06('0x1a')],function(_0x1edb87){return{'model':db[_0x1edb87[_0x5b06('0x1b')]],'as':_0x1edb87['as'],'attributes':_0x1edb87[_0x5b06('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5b06('0x1c')](function(_0x4fe65c){logger[_0x5b06('0x11')]('GetServicenowAccount',_0x207672);logger[_0x5b06('0xc')](_0x5b06('0x13'),_0x207672,JSON[_0x5b06('0x1d')](_0x4fe65c));_0x349d90(_0x4fe65c);})[_0x5b06('0x12')](function(_0x5f4520){logger[_0x5b06('0xe')]('GetServicenowAccount',_0x5f4520[_0x5b06('0x10')],_0x207672);_0x50c333(_0x386826[_0x5b06('0xe')](0x1f4,_0x5f4520[_0x5b06('0x10')]));});});};exports['ShowServicenowAccount']=function(_0x4d449d){var _0x4a7f4a=this;return new Promise(function(_0x1c6287,_0x15f571){return db['ServicenowAccount'][_0x5b06('0x1e')]({'raw':_0x4d449d[_0x5b06('0x16')]?_0x4d449d[_0x5b06('0x16')][_0x5b06('0x17')]===undefined?!![]:![]:!![],'where':_0x4d449d[_0x5b06('0x16')]?_0x4d449d[_0x5b06('0x16')][_0x5b06('0x1f')]||null:null,'attributes':_0x4d449d[_0x5b06('0x16')]?_0x4d449d[_0x5b06('0x16')]['attributes']||null:null,'include':_0x4d449d['options']?_0x4d449d['options'][_0x5b06('0x1a')]?_[_0x5b06('0x19')](_0x4d449d[_0x5b06('0x16')][_0x5b06('0x1a')],function(_0x48e8dd){return{'model':db[_0x48e8dd[_0x5b06('0x1b')]],'as':_0x48e8dd['as'],'attributes':_0x48e8dd[_0x5b06('0x18')],'include':_0x48e8dd[_0x5b06('0x1a')]?_[_0x5b06('0x19')](_0x48e8dd['include'],function(_0xe33bcb){return{'model':db[_0xe33bcb[_0x5b06('0x1b')]],'as':_0xe33bcb['as'],'attributes':_0xe33bcb[_0x5b06('0x18')],'include':_0xe33bcb[_0x5b06('0x1a')]?_[_0x5b06('0x19')](_0xe33bcb[_0x5b06('0x1a')],function(_0x48f147){return{'model':db[_0x48f147[_0x5b06('0x1b')]],'as':_0x48f147['as'],'attributes':_0x48f147[_0x5b06('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5b06('0x1c')](function(_0x291fd4){logger['info'](_0x5b06('0x20'),_0x4d449d);logger['debug'](_0x5b06('0x20'),_0x4d449d,JSON[_0x5b06('0x1d')](_0x291fd4));_0x1c6287(_0x291fd4);})[_0x5b06('0x12')](function(_0x3a76e4){logger['error']('ShowServicenowAccount',_0x3a76e4['message'],_0x4d449d);_0x15f571(_0x4a7f4a['error'](0x1f4,_0x3a76e4[_0x5b06('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index a3e6277..7eed2a6 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 _0xb2d1=['update','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x1381a3,_0x38a97a){var _0x5dc170=function(_0x54aff4){while(--_0x54aff4){_0x1381a3['push'](_0x1381a3['shift']());}};_0x5dc170(++_0x38a97a);}(_0xb2d1,0x144));var _0x1b2d=function(_0x3ce2c4,_0x4544c1){_0x3ce2c4=_0x3ce2c4-0x0;var _0x4047c1=_0xb2d1[_0x3ce2c4];return _0x4047c1;};'use strict';var multer=require(_0x1b2d('0x0'));var util=require(_0x1b2d('0x1'));var path=require(_0x1b2d('0x2'));var timeout=require(_0x1b2d('0x3'));var express=require('express');var router=express[_0x1b2d('0x4')]();var auth=require(_0x1b2d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1b2d('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x1b2d('0x7')]('/',auth[_0x1b2d('0x8')](),controller[_0x1b2d('0x9')]);router[_0x1b2d('0x7')](_0x1b2d('0xa'),auth[_0x1b2d('0x8')](),controller[_0x1b2d('0xb')]);router['get'](_0x1b2d('0xc'),auth[_0x1b2d('0x8')](),controller[_0x1b2d('0xd')]);router[_0x1b2d('0x7')](_0x1b2d('0xe'),auth['isAuthenticated'](),controller[_0x1b2d('0xf')]);router[_0x1b2d('0x7')](_0x1b2d('0x10'),auth[_0x1b2d('0x8')](),controller[_0x1b2d('0x11')]);router[_0x1b2d('0x12')]('/',auth['isAuthenticated'](),controller[_0x1b2d('0x13')]);router[_0x1b2d('0x14')](_0x1b2d('0xa'),auth['isAuthenticated'](),controller[_0x1b2d('0x15')]);router['delete']('/:id',auth[_0x1b2d('0x8')](),controller['destroy']);module[_0x1b2d('0x16')]=router; \ No newline at end of file +var _0x20cb=['../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x8c9741,_0x1362c8){var _0x580e3e=function(_0x31ee83){while(--_0x31ee83){_0x8c9741['push'](_0x8c9741['shift']());}};_0x580e3e(++_0x1362c8);}(_0x20cb,0x18c));var _0xb20c=function(_0xd88607,_0x8fba24){_0xd88607=_0xd88607-0x0;var _0x3f953c=_0x20cb[_0xd88607];return _0x3f953c;};'use strict';var multer=require('multer');var util=require(_0xb20c('0x0'));var path=require('path');var timeout=require(_0xb20c('0x1'));var express=require(_0xb20c('0x2'));var router=express[_0xb20c('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb20c('0x4'));var config=require('../../config/environment');var controller=require('./intServicenowConfiguration.controller');router['get']('/',auth[_0xb20c('0x5')](),controller[_0xb20c('0x6')]);router[_0xb20c('0x7')](_0xb20c('0x8'),auth[_0xb20c('0x5')](),controller['show']);router[_0xb20c('0x7')](_0xb20c('0x9'),auth[_0xb20c('0x5')](),controller['getFields']);router[_0xb20c('0x7')](_0xb20c('0xa'),auth['isAuthenticated'](),controller[_0xb20c('0xb')]);router[_0xb20c('0x7')](_0xb20c('0xc'),auth[_0xb20c('0x5')](),controller[_0xb20c('0xd')]);router[_0xb20c('0xe')]('/',auth[_0xb20c('0x5')](),controller['create']);router[_0xb20c('0xf')](_0xb20c('0x8'),auth[_0xb20c('0x5')](),controller[_0xb20c('0x10')]);router[_0xb20c('0x11')](_0xb20c('0x8'),auth[_0xb20c('0x5')](),controller[_0xb20c('0x12')]);module[_0xb20c('0x13')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index cb1df52..ef050a5 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 _0xc20f=['exports','STRING','sequelize'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0xc20f,0x14c));var _0xfc20=function(_0x56e9af,_0x76252b){_0x56e9af=_0x56e9af-0x0;var _0x48ecd2=_0xc20f[_0x56e9af];return _0x48ecd2;};'use strict';var Sequelize=require(_0xfc20('0x0'));module[_0xfc20('0x1')]={'name':{'type':Sequelize[_0xfc20('0x2')]},'description':{'type':Sequelize[_0xfc20('0x2')]}}; \ No newline at end of file +var _0xfc24=['sequelize','exports','STRING'];(function(_0x3b4922,_0x2fa365){var _0x239729=function(_0x82fd7){while(--_0x82fd7){_0x3b4922['push'](_0x3b4922['shift']());}};_0x239729(++_0x2fa365);}(_0xfc24,0xf9));var _0x4fc2=function(_0x1f3aec,_0x24c18e){_0x1f3aec=_0x1f3aec-0x0;var _0x409f0d=_0xfc24[_0x1f3aec];return _0x409f0d;};'use strict';var Sequelize=require(_0x4fc2('0x0'));module[_0x4fc2('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x4fc2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index b40cc7b..f4b78aa 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 _0xc287=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','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','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','count','offset','limit','set','Content-Range','apply','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','type','key','keys','filters','intersection','model','query','attributes','fields','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','ServicenowConfiguration','include','findAll','show','params','find','create','body','update','getFields','findOne','hasOwnProperty','ServicenowField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x1a3e8a,_0x52680e){var _0x53e696=function(_0x5cb155){while(--_0x5cb155){_0x1a3e8a['push'](_0x1a3e8a['shift']());}};_0x53e696(++_0x52680e);}(_0xc287,0xa4));var _0x7c28=function(_0x35949a,_0xece70){_0x35949a=_0x35949a-0x0;var _0x9e2198=_0xc287[_0x35949a];return _0x9e2198;};'use strict';var pdf=require(_0x7c28('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7c28('0x1'));var zipdir=require(_0x7c28('0x2'));var jsonpatch=require(_0x7c28('0x3'));var rp=require('request-promise');var moment=require(_0x7c28('0x4'));var BPromise=require(_0x7c28('0x5'));var Mustache=require(_0x7c28('0x6'));var util=require(_0x7c28('0x7'));var path=require('path');var sox=require(_0x7c28('0x8'));var csv=require(_0x7c28('0x9'));var ejs=require(_0x7c28('0xa'));var fs=require('fs');var _=require(_0x7c28('0xb'));var squel=require(_0x7c28('0xc'));var crypto=require(_0x7c28('0xd'));var jsforce=require(_0x7c28('0xe'));var deskjs=require(_0x7c28('0xf'));var toCsv=require(_0x7c28('0x9'));var querystring=require(_0x7c28('0x10'));var Papa=require(_0x7c28('0x11'));var Redis=require(_0x7c28('0x12'));var authService=require(_0x7c28('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7c28('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7c28('0x15'))('api');var utils=require(_0x7c28('0x16'));var config=require('../../config/environment');var db=require(_0x7c28('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x7c28('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0xd22f0f,_0x2aefd2,_0x71d4f6){if(_0x71d4f6){var _0xfd1daa=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xfd1daa['test'](_0x2aefd2)){return _0xd22f0f;}else{throw new db[(_0x7c28('0x19'))][(_0x7c28('0x1a'))](_0x7c28('0x1b'));}}else{return _0xd22f0f;}}function respondWithRpcPromise(_0x561eca,_0x331d36,_0x3519e3,_0x1bd59a){return new BPromise(function(_0x2198a9,_0x408840){var _0x53ceba=_0x1bd59a||client;return _0x53ceba[_0x7c28('0x1c')](_0x561eca,_0x3519e3)[_0x7c28('0x1d')](function(_0x19bb25){logger[_0x7c28('0x1e')](_0x7c28('0x1f'),_0x331d36,_0x7c28('0x20'));logger[_0x7c28('0x21')](_0x7c28('0x22'),_0x331d36,_0x7c28('0x20'),JSON[_0x7c28('0x23')](_0x19bb25));if(_0x19bb25[_0x7c28('0x24')]){if(_0x19bb25[_0x7c28('0x24')][_0x7c28('0x25')]===0x1f4){logger[_0x7c28('0x24')](_0x7c28('0x1f'),_0x331d36,_0x19bb25[_0x7c28('0x24')][_0x7c28('0x26')]);return _0x408840(_0x19bb25[_0x7c28('0x24')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x331d36,_0x19bb25['error'][_0x7c28('0x26')]);return _0x2198a9(_0x19bb25['error']['message']);}else{logger[_0x7c28('0x1e')](_0x7c28('0x1f'),_0x331d36,_0x7c28('0x20'));_0x2198a9(_0x19bb25['result'][_0x7c28('0x26')]);}})[_0x7c28('0x27')](function(_0x19f086){logger[_0x7c28('0x24')]('ServicenowConfiguration,\x20%s,\x20%s',_0x331d36,_0x19f086);_0x408840(_0x19f086);});});}function respondWithStatusCode(_0x43ad17,_0x374421){_0x374421=_0x374421||0xcc;return function(_0x49875d){if(_0x49875d){return _0x43ad17['sendStatus'](_0x374421);}return _0x43ad17[_0x7c28('0x28')](_0x374421)['end']();};}function respondWithResult(_0x591a5d,_0x424420){_0x424420=_0x424420||0xc8;return function(_0x1729a0){if(_0x1729a0){return _0x591a5d[_0x7c28('0x28')](_0x424420)[_0x7c28('0x29')](_0x1729a0);}};}function respondWithFilteredResult(_0x748d26,_0x371d69){return function(_0x3c3e2a){if(_0x3c3e2a){var _0x1fdf0c=_0x3c3e2a[_0x7c28('0x2a')],_0x551b25=_0x371d69[_0x7c28('0x2b')],_0x510ef3=_0x371d69[_0x7c28('0x2b')]+_0x371d69[_0x7c28('0x2c')],_0x4a647f;if(_0x510ef3>=_0x1fdf0c){_0x510ef3=_0x1fdf0c;_0x4a647f=0xc8;}else{_0x4a647f=0xce;}_0x748d26['status'](_0x4a647f);return _0x748d26[_0x7c28('0x2d')](_0x7c28('0x2e'),_0x551b25+'-'+_0x510ef3+'/'+_0x1fdf0c)['json'](_0x3c3e2a);}return null;};}function patchUpdates(_0x3c1506){return function(_0x5ccdf4){try{jsonpatch[_0x7c28('0x2f')](_0x5ccdf4,_0x3c1506,!![]);}catch(_0x3ce8b4){return BPromise['reject'](_0x3ce8b4);}return _0x5ccdf4['save']();};}function saveUpdates(_0x55e700,_0x56a3ba){return function(_0x4fccdf){if(_0x4fccdf){return _0x4fccdf['update'](_0x55e700)[_0x7c28('0x1d')](function(_0x48510d){return _0x48510d;});}return null;};}function removeEntity(_0x294850,_0x145f02){return function(_0x344300){if(_0x344300){return _0x344300[_0x7c28('0x30')]()[_0x7c28('0x1d')](function(){_0x294850[_0x7c28('0x28')](0xcc)[_0x7c28('0x31')]();});}};}function handleEntityNotFound(_0x5db334,_0x47f1ee){return function(_0x45d2d2){if(!_0x45d2d2){_0x5db334[_0x7c28('0x32')](0x194);}return _0x45d2d2;};}function handleError(_0x2d859d,_0x34d47d){_0x34d47d=_0x34d47d||0x1f4;return function(_0x3d37d8){logger[_0x7c28('0x24')](_0x3d37d8[_0x7c28('0x33')]);if(_0x3d37d8[_0x7c28('0x34')]){delete _0x3d37d8[_0x7c28('0x34')];}_0x2d859d[_0x7c28('0x28')](_0x34d47d)[_0x7c28('0x35')](_0x3d37d8);};}exports[_0x7c28('0x36')]=function(_0x3bae49,_0x1df0a0){var _0x39c30b={},_0x328e5f={},_0x150311={'count':0x0,'rows':[]};var _0x3b6ae6=_[_0x7c28('0x37')](db['ServicenowConfiguration'][_0x7c28('0x38')],function(_0x18f252){return{'name':_0x18f252['fieldName'],'type':_0x18f252[_0x7c28('0x39')][_0x7c28('0x3a')]};});_0x328e5f['model']=_[_0x7c28('0x37')](_0x3b6ae6,_0x7c28('0x34'));_0x328e5f['query']=_[_0x7c28('0x3b')](_0x3bae49['query']);_0x328e5f[_0x7c28('0x3c')]=_[_0x7c28('0x3d')](_0x328e5f[_0x7c28('0x3e')],_0x328e5f[_0x7c28('0x3f')]);_0x39c30b[_0x7c28('0x40')]=_[_0x7c28('0x3d')](_0x328e5f[_0x7c28('0x3e')],qs['fields'](_0x3bae49[_0x7c28('0x3f')][_0x7c28('0x41')]));_0x39c30b['attributes']=_0x39c30b['attributes'][_0x7c28('0x42')]?_0x39c30b[_0x7c28('0x40')]:_0x328e5f['model'];if(!_0x3bae49['query']['hasOwnProperty'](_0x7c28('0x43'))){_0x39c30b[_0x7c28('0x2c')]=qs[_0x7c28('0x2c')](_0x3bae49['query'][_0x7c28('0x2c')]);_0x39c30b[_0x7c28('0x2b')]=qs[_0x7c28('0x2b')](_0x3bae49[_0x7c28('0x3f')][_0x7c28('0x2b')]);}_0x39c30b[_0x7c28('0x44')]=qs[_0x7c28('0x45')](_0x3bae49[_0x7c28('0x3f')][_0x7c28('0x45')]);_0x39c30b[_0x7c28('0x46')]=qs[_0x7c28('0x3c')](_[_0x7c28('0x47')](_0x3bae49[_0x7c28('0x3f')],_0x328e5f['filters']));if(_0x3bae49[_0x7c28('0x3f')]['filter']){_0x39c30b[_0x7c28('0x46')]=_[_0x7c28('0x48')](_0x39c30b[_0x7c28('0x46')],{'$or':_['map'](_0x3b6ae6,function(_0x1d28b3){if(_0x1d28b3['type']!==_0x7c28('0x49')){var _0x56e1f4={};_0x56e1f4[_0x1d28b3[_0x7c28('0x34')]]={'$like':'%'+_0x3bae49[_0x7c28('0x3f')][_0x7c28('0x4a')]+'%'};return _0x56e1f4;}})});}_0x39c30b=_[_0x7c28('0x48')]({},_0x39c30b,_0x3bae49[_0x7c28('0x4b')]);var _0x1045b0={'where':_0x39c30b[_0x7c28('0x46')]};return db[_0x7c28('0x4c')][_0x7c28('0x2a')](_0x1045b0)[_0x7c28('0x1d')](function(_0x1cae17){_0x150311[_0x7c28('0x2a')]=_0x1cae17;if(_0x3bae49[_0x7c28('0x3f')]['includeAll']){_0x39c30b[_0x7c28('0x4d')]=[{'all':!![]}];}return db[_0x7c28('0x4c')][_0x7c28('0x4e')](_0x39c30b);})[_0x7c28('0x1d')](function(_0x1d0252){_0x150311['rows']=_0x1d0252;return _0x150311;})[_0x7c28('0x1d')](respondWithFilteredResult(_0x1df0a0,_0x39c30b))[_0x7c28('0x27')](handleError(_0x1df0a0,null));};exports[_0x7c28('0x4f')]=function(_0x166e87,_0x2f1e6b){var _0x156173={'raw':![],'where':{'id':_0x166e87[_0x7c28('0x50')]['id']}},_0x1e5deb={};_0x1e5deb['model']=_[_0x7c28('0x3b')](db['ServicenowConfiguration']['rawAttributes']);_0x1e5deb[_0x7c28('0x3f')]=_['keys'](_0x166e87[_0x7c28('0x3f')]);_0x1e5deb[_0x7c28('0x3c')]=_[_0x7c28('0x3d')](_0x1e5deb[_0x7c28('0x3e')],_0x1e5deb[_0x7c28('0x3f')]);_0x156173['attributes']=_['intersection'](_0x1e5deb['model'],qs[_0x7c28('0x41')](_0x166e87[_0x7c28('0x3f')][_0x7c28('0x41')]));_0x156173[_0x7c28('0x40')]=_0x156173[_0x7c28('0x40')]['length']?_0x156173[_0x7c28('0x40')]:_0x1e5deb[_0x7c28('0x3e')];if(_0x166e87['query']['includeAll']){_0x156173['include']=[{'all':!![]}];}_0x156173=_['merge']({},_0x156173,_0x166e87[_0x7c28('0x4b')]);return db[_0x7c28('0x4c')][_0x7c28('0x51')](_0x156173)[_0x7c28('0x1d')](handleEntityNotFound(_0x2f1e6b,null))['then'](respondWithResult(_0x2f1e6b,null))['catch'](handleError(_0x2f1e6b,null));};exports[_0x7c28('0x52')]=function(_0x294a04,_0x3cf377){return db[_0x7c28('0x4c')][_0x7c28('0x52')](_0x294a04[_0x7c28('0x53')],{})[_0x7c28('0x1d')](respondWithResult(_0x3cf377,0xc9))['catch'](handleError(_0x3cf377,null));};exports[_0x7c28('0x54')]=function(_0x35cf19,_0x436111){if(_0x35cf19[_0x7c28('0x53')]['id']){delete _0x35cf19[_0x7c28('0x53')]['id'];}return db[_0x7c28('0x4c')]['find']({'where':{'id':_0x35cf19[_0x7c28('0x50')]['id']}})[_0x7c28('0x1d')](handleEntityNotFound(_0x436111,null))[_0x7c28('0x1d')](saveUpdates(_0x35cf19[_0x7c28('0x53')],null))[_0x7c28('0x1d')](respondWithResult(_0x436111,null))[_0x7c28('0x27')](handleError(_0x436111,null));};exports[_0x7c28('0x30')]=function(_0x553aa3,_0x3137cc){return db[_0x7c28('0x4c')]['find']({'where':{'id':_0x553aa3[_0x7c28('0x50')]['id']}})['then'](handleEntityNotFound(_0x3137cc,null))[_0x7c28('0x1d')](removeEntity(_0x3137cc,null))['catch'](handleError(_0x3137cc,null));};exports[_0x7c28('0x55')]=function(_0x145b3a,_0x430c2f,_0x549d14){var _0x5a75d4={};var _0x50973e={};var _0x2ccb2d;var _0x48351a;return db[_0x7c28('0x4c')][_0x7c28('0x56')]({'where':{'id':_0x145b3a[_0x7c28('0x50')]['id']}})[_0x7c28('0x1d')](handleEntityNotFound(_0x430c2f,null))[_0x7c28('0x1d')](function(_0x566017){if(_0x566017){_0x2ccb2d=_0x566017;_0x50973e['model']=_['keys'](db['ServicenowField'][_0x7c28('0x38')]);_0x50973e[_0x7c28('0x3f')]=_[_0x7c28('0x3b')](_0x145b3a[_0x7c28('0x3f')]);_0x50973e['filters']=_[_0x7c28('0x3d')](_0x50973e[_0x7c28('0x3e')],_0x50973e[_0x7c28('0x3f')]);_0x5a75d4['attributes']=_[_0x7c28('0x3d')](_0x50973e[_0x7c28('0x3e')],qs[_0x7c28('0x41')](_0x145b3a['query'][_0x7c28('0x41')]));_0x5a75d4[_0x7c28('0x40')]=_0x5a75d4[_0x7c28('0x40')][_0x7c28('0x42')]?_0x5a75d4[_0x7c28('0x40')]:_0x50973e[_0x7c28('0x3e')];_0x5a75d4[_0x7c28('0x44')]=qs[_0x7c28('0x45')](_0x145b3a[_0x7c28('0x3f')]['sort']);_0x5a75d4[_0x7c28('0x46')]=qs['filters'](_[_0x7c28('0x47')](_0x145b3a[_0x7c28('0x3f')],_0x50973e['filters']));if(_0x145b3a[_0x7c28('0x3f')]['filter']){_0x5a75d4[_0x7c28('0x46')]=_[_0x7c28('0x48')](_0x5a75d4[_0x7c28('0x46')],{'$or':_[_0x7c28('0x37')](_0x5a75d4[_0x7c28('0x40')],function(_0x4a9b73){var _0x261c31={};_0x261c31[_0x4a9b73]={'$like':'%'+_0x145b3a[_0x7c28('0x3f')][_0x7c28('0x4a')]+'%'};return _0x261c31;})});}_0x5a75d4=_[_0x7c28('0x48')]({},_0x5a75d4,_0x145b3a['options']);return _0x2ccb2d['getFields'](_0x5a75d4);}})['then'](function(_0x35598b){if(_0x35598b){_0x48351a=_0x35598b[_0x7c28('0x42')];if(!_0x145b3a[_0x7c28('0x3f')][_0x7c28('0x57')]('nolimit')){_0x5a75d4[_0x7c28('0x2c')]=qs[_0x7c28('0x2c')](_0x145b3a[_0x7c28('0x3f')]['limit']);_0x5a75d4['offset']=qs[_0x7c28('0x2b')](_0x145b3a[_0x7c28('0x3f')][_0x7c28('0x2b')]);}return _0x2ccb2d[_0x7c28('0x55')](_0x5a75d4);}})[_0x7c28('0x1d')](function(_0x405a62){if(_0x405a62){return _0x405a62?{'count':_0x48351a,'rows':_0x405a62}:null;}})[_0x7c28('0x1d')](respondWithResult(_0x430c2f,null))[_0x7c28('0x27')](handleError(_0x430c2f,null));};exports['getSubjects']=function(_0x1b1c79,_0x4105ca,_0x2896f1){var _0x4071e0={};var _0x123f4b={};var _0x57d71a;var _0x2d3f43;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x1b1c79[_0x7c28('0x50')]['id']}})[_0x7c28('0x1d')](handleEntityNotFound(_0x4105ca,null))['then'](function(_0x48316a){if(_0x48316a){_0x57d71a=_0x48316a;_0x123f4b[_0x7c28('0x3e')]=_[_0x7c28('0x3b')](db[_0x7c28('0x58')]['rawAttributes']);_0x123f4b[_0x7c28('0x3f')]=_[_0x7c28('0x3b')](_0x1b1c79[_0x7c28('0x3f')]);_0x123f4b[_0x7c28('0x3c')]=_['intersection'](_0x123f4b[_0x7c28('0x3e')],_0x123f4b[_0x7c28('0x3f')]);_0x4071e0[_0x7c28('0x40')]=_['intersection'](_0x123f4b[_0x7c28('0x3e')],qs[_0x7c28('0x41')](_0x1b1c79[_0x7c28('0x3f')][_0x7c28('0x41')]));_0x4071e0[_0x7c28('0x40')]=_0x4071e0['attributes'][_0x7c28('0x42')]?_0x4071e0[_0x7c28('0x40')]:_0x123f4b[_0x7c28('0x3e')];_0x4071e0[_0x7c28('0x44')]=qs[_0x7c28('0x45')](_0x1b1c79[_0x7c28('0x3f')][_0x7c28('0x45')]);_0x4071e0['where']=qs['filters'](_['pick'](_0x1b1c79[_0x7c28('0x3f')],_0x123f4b[_0x7c28('0x3c')]));if(_0x1b1c79[_0x7c28('0x3f')][_0x7c28('0x4a')]){_0x4071e0['where']=_[_0x7c28('0x48')](_0x4071e0[_0x7c28('0x46')],{'$or':_[_0x7c28('0x37')](_0x4071e0[_0x7c28('0x40')],function(_0x585bc9){var _0x14b9bd={};_0x14b9bd[_0x585bc9]={'$like':'%'+_0x1b1c79[_0x7c28('0x3f')][_0x7c28('0x4a')]+'%'};return _0x14b9bd;})});}_0x4071e0=_[_0x7c28('0x48')]({},_0x4071e0,_0x1b1c79[_0x7c28('0x4b')]);return _0x57d71a[_0x7c28('0x59')](_0x4071e0);}})[_0x7c28('0x1d')](function(_0x5bf90b){if(_0x5bf90b){_0x2d3f43=_0x5bf90b[_0x7c28('0x42')];if(!_0x1b1c79['query']['hasOwnProperty'](_0x7c28('0x43'))){_0x4071e0[_0x7c28('0x2c')]=qs[_0x7c28('0x2c')](_0x1b1c79[_0x7c28('0x3f')]['limit']);_0x4071e0[_0x7c28('0x2b')]=qs['offset'](_0x1b1c79[_0x7c28('0x3f')]['offset']);}return _0x57d71a[_0x7c28('0x59')](_0x4071e0);}})[_0x7c28('0x1d')](function(_0x1fbfdb){if(_0x1fbfdb){return _0x1fbfdb?{'count':_0x2d3f43,'rows':_0x1fbfdb}:null;}})[_0x7c28('0x1d')](respondWithResult(_0x4105ca,null))[_0x7c28('0x27')](handleError(_0x4105ca,null));};exports[_0x7c28('0x5a')]=function(_0x36f628,_0x37951f,_0x51324d){var _0x50bd70={};var _0xceaafb={};var _0x447943;var _0x33d6b2;return db[_0x7c28('0x4c')][_0x7c28('0x56')]({'where':{'id':_0x36f628[_0x7c28('0x50')]['id']}})[_0x7c28('0x1d')](handleEntityNotFound(_0x37951f,null))['then'](function(_0x108742){if(_0x108742){_0x447943=_0x108742;_0xceaafb['model']=_[_0x7c28('0x3b')](db[_0x7c28('0x58')][_0x7c28('0x38')]);_0xceaafb[_0x7c28('0x3f')]=_['keys'](_0x36f628[_0x7c28('0x3f')]);_0xceaafb[_0x7c28('0x3c')]=_[_0x7c28('0x3d')](_0xceaafb['model'],_0xceaafb[_0x7c28('0x3f')]);_0x50bd70[_0x7c28('0x40')]=_[_0x7c28('0x3d')](_0xceaafb[_0x7c28('0x3e')],qs[_0x7c28('0x41')](_0x36f628[_0x7c28('0x3f')][_0x7c28('0x41')]));_0x50bd70[_0x7c28('0x40')]=_0x50bd70[_0x7c28('0x40')][_0x7c28('0x42')]?_0x50bd70[_0x7c28('0x40')]:_0xceaafb[_0x7c28('0x3e')];_0x50bd70[_0x7c28('0x44')]=qs[_0x7c28('0x45')](_0x36f628[_0x7c28('0x3f')]['sort']);_0x50bd70[_0x7c28('0x46')]=qs['filters'](_[_0x7c28('0x47')](_0x36f628[_0x7c28('0x3f')],_0xceaafb[_0x7c28('0x3c')]));if(_0x36f628['query'][_0x7c28('0x4a')]){_0x50bd70[_0x7c28('0x46')]=_[_0x7c28('0x48')](_0x50bd70[_0x7c28('0x46')],{'$or':_[_0x7c28('0x37')](_0x50bd70[_0x7c28('0x40')],function(_0x548ccd){var _0x16d784={};_0x16d784[_0x548ccd]={'$like':'%'+_0x36f628[_0x7c28('0x3f')][_0x7c28('0x4a')]+'%'};return _0x16d784;})});}_0x50bd70=_[_0x7c28('0x48')]({},_0x50bd70,_0x36f628[_0x7c28('0x4b')]);return _0x447943[_0x7c28('0x5a')](_0x50bd70);}})['then'](function(_0x1295a9){if(_0x1295a9){_0x33d6b2=_0x1295a9['length'];if(!_0x36f628[_0x7c28('0x3f')][_0x7c28('0x57')](_0x7c28('0x43'))){_0x50bd70[_0x7c28('0x2c')]=qs['limit'](_0x36f628[_0x7c28('0x3f')][_0x7c28('0x2c')]);_0x50bd70[_0x7c28('0x2b')]=qs[_0x7c28('0x2b')](_0x36f628['query'][_0x7c28('0x2b')]);}return _0x447943['getDescriptions'](_0x50bd70);}})[_0x7c28('0x1d')](function(_0x3bbaf7){if(_0x3bbaf7){return _0x3bbaf7?{'count':_0x33d6b2,'rows':_0x3bbaf7}:null;}})['then'](respondWithResult(_0x37951f,null))[_0x7c28('0x27')](handleError(_0x37951f,null));}; \ No newline at end of file +var _0xd3e0=['status','end','json','count','offset','limit','apply','reject','save','destroy','stack','name','send','index','ServicenowConfiguration','rawAttributes','type','key','model','map','query','keys','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','intersection','find','create','body','update','getFields','getSubjects','findOne','ServicenowField','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','request','then','info','request\x20sent','stringify','error','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus'];(function(_0x2bd43c,_0x26ce58){var _0x145a14=function(_0x43b346){while(--_0x43b346){_0x2bd43c['push'](_0x2bd43c['shift']());}};_0x145a14(++_0x26ce58);}(_0xd3e0,0xf2));var _0x0d3e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd3e0[_0x321bb2];return _0x9c12ed;};'use strict';var pdf=require(_0x0d3e('0x0'));var emlformat=require(_0x0d3e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x0d3e('0x2'));var jsonpatch=require(_0x0d3e('0x3'));var rp=require(_0x0d3e('0x4'));var moment=require(_0x0d3e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0d3e('0x6'));var util=require(_0x0d3e('0x7'));var path=require(_0x0d3e('0x8'));var sox=require(_0x0d3e('0x9'));var csv=require('to-csv');var ejs=require(_0x0d3e('0xa'));var fs=require('fs');var _=require(_0x0d3e('0xb'));var squel=require(_0x0d3e('0xc'));var crypto=require(_0x0d3e('0xd'));var jsforce=require(_0x0d3e('0xe'));var deskjs=require(_0x0d3e('0xf'));var toCsv=require(_0x0d3e('0x10'));var querystring=require(_0x0d3e('0x11'));var Papa=require('papaparse');var Redis=require(_0x0d3e('0x12'));var authService=require(_0x0d3e('0x13'));var qs=require(_0x0d3e('0x14'));var as=require(_0x0d3e('0x15'));var hardwareService=require(_0x0d3e('0x16'));var logger=require(_0x0d3e('0x17'))(_0x0d3e('0x18'));var utils=require(_0x0d3e('0x19'));var config=require(_0x0d3e('0x1a'));var db=require(_0x0d3e('0x1b'))['db'];var jayson=require(_0x0d3e('0x1c'));var client=jayson[_0x0d3e('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x5539c8,_0x3c8afa,_0x1c946e){if(_0x1c946e){var _0x5e47ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e47ff[_0x0d3e('0x1e')](_0x3c8afa)){return _0x5539c8;}else{throw new db[(_0x0d3e('0x1f'))]['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 _0x5539c8;}}function respondWithRpcPromise(_0xc1a159,_0x25aa26,_0x8188e1,_0x29bcd2){return new BPromise(function(_0x6c4875,_0x4e9ae6){var _0x39672e=_0x29bcd2||client;return _0x39672e[_0x0d3e('0x20')](_0xc1a159,_0x8188e1)[_0x0d3e('0x21')](function(_0x4bd258){logger[_0x0d3e('0x22')]('ServicenowConfiguration,\x20%s,\x20%s',_0x25aa26,_0x0d3e('0x23'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x25aa26,_0x0d3e('0x23'),JSON[_0x0d3e('0x24')](_0x4bd258));if(_0x4bd258['error']){if(_0x4bd258[_0x0d3e('0x25')]['code']===0x1f4){logger['error'](_0x0d3e('0x26'),_0x25aa26,_0x4bd258[_0x0d3e('0x25')][_0x0d3e('0x27')]);return _0x4e9ae6(_0x4bd258['error'][_0x0d3e('0x27')]);}logger[_0x0d3e('0x25')](_0x0d3e('0x26'),_0x25aa26,_0x4bd258['error']['message']);return _0x6c4875(_0x4bd258['error'][_0x0d3e('0x27')]);}else{logger['info'](_0x0d3e('0x26'),_0x25aa26,'request\x20sent');_0x6c4875(_0x4bd258[_0x0d3e('0x28')][_0x0d3e('0x27')]);}})[_0x0d3e('0x29')](function(_0x5219d7){logger[_0x0d3e('0x25')](_0x0d3e('0x26'),_0x25aa26,_0x5219d7);_0x4e9ae6(_0x5219d7);});});}function respondWithStatusCode(_0x5c0052,_0x536a49){_0x536a49=_0x536a49||0xcc;return function(_0x567278){if(_0x567278){return _0x5c0052[_0x0d3e('0x2a')](_0x536a49);}return _0x5c0052[_0x0d3e('0x2b')](_0x536a49)[_0x0d3e('0x2c')]();};}function respondWithResult(_0x426035,_0xd62731){_0xd62731=_0xd62731||0xc8;return function(_0x18109e){if(_0x18109e){return _0x426035[_0x0d3e('0x2b')](_0xd62731)[_0x0d3e('0x2d')](_0x18109e);}};}function respondWithFilteredResult(_0x270ef1,_0x34141e){return function(_0xbc9bd7){if(_0xbc9bd7){var _0xa03e7f=_0xbc9bd7[_0x0d3e('0x2e')],_0x224731=_0x34141e[_0x0d3e('0x2f')],_0x29c384=_0x34141e['offset']+_0x34141e[_0x0d3e('0x30')],_0x40cd6c;if(_0x29c384>=_0xa03e7f){_0x29c384=_0xa03e7f;_0x40cd6c=0xc8;}else{_0x40cd6c=0xce;}_0x270ef1[_0x0d3e('0x2b')](_0x40cd6c);return _0x270ef1['set']('Content-Range',_0x224731+'-'+_0x29c384+'/'+_0xa03e7f)[_0x0d3e('0x2d')](_0xbc9bd7);}return null;};}function patchUpdates(_0x24b971){return function(_0x3f6449){try{jsonpatch[_0x0d3e('0x31')](_0x3f6449,_0x24b971,!![]);}catch(_0x57f2f1){return BPromise[_0x0d3e('0x32')](_0x57f2f1);}return _0x3f6449[_0x0d3e('0x33')]();};}function saveUpdates(_0x406fa1,_0x36461f){return function(_0x3fef35){if(_0x3fef35){return _0x3fef35['update'](_0x406fa1)['then'](function(_0x51745b){return _0x51745b;});}return null;};}function removeEntity(_0x53fc89,_0x97bd32){return function(_0x41e539){if(_0x41e539){return _0x41e539[_0x0d3e('0x34')]()['then'](function(){_0x53fc89[_0x0d3e('0x2b')](0xcc)[_0x0d3e('0x2c')]();});}};}function handleEntityNotFound(_0x50d62,_0x315cca){return function(_0x5309f1){if(!_0x5309f1){_0x50d62[_0x0d3e('0x2a')](0x194);}return _0x5309f1;};}function handleError(_0x2b2710,_0x50cffd){_0x50cffd=_0x50cffd||0x1f4;return function(_0x3ea673){logger[_0x0d3e('0x25')](_0x3ea673[_0x0d3e('0x35')]);if(_0x3ea673[_0x0d3e('0x36')]){delete _0x3ea673[_0x0d3e('0x36')];}_0x2b2710[_0x0d3e('0x2b')](_0x50cffd)[_0x0d3e('0x37')](_0x3ea673);};}exports[_0x0d3e('0x38')]=function(_0x5e37c2,_0x210a69){var _0x48aab3={},_0x5b8da6={},_0x48d88e={'count':0x0,'rows':[]};var _0x56b5d9=_['map'](db[_0x0d3e('0x39')][_0x0d3e('0x3a')],function(_0x5acc24){return{'name':_0x5acc24['fieldName'],'type':_0x5acc24[_0x0d3e('0x3b')][_0x0d3e('0x3c')]};});_0x5b8da6[_0x0d3e('0x3d')]=_[_0x0d3e('0x3e')](_0x56b5d9,_0x0d3e('0x36'));_0x5b8da6[_0x0d3e('0x3f')]=_[_0x0d3e('0x40')](_0x5e37c2[_0x0d3e('0x3f')]);_0x5b8da6['filters']=_['intersection'](_0x5b8da6['model'],_0x5b8da6[_0x0d3e('0x3f')]);_0x48aab3[_0x0d3e('0x41')]=_['intersection'](_0x5b8da6['model'],qs[_0x0d3e('0x42')](_0x5e37c2[_0x0d3e('0x3f')]['fields']));_0x48aab3[_0x0d3e('0x41')]=_0x48aab3['attributes'][_0x0d3e('0x43')]?_0x48aab3['attributes']:_0x5b8da6[_0x0d3e('0x3d')];if(!_0x5e37c2['query'][_0x0d3e('0x44')](_0x0d3e('0x45'))){_0x48aab3[_0x0d3e('0x30')]=qs['limit'](_0x5e37c2[_0x0d3e('0x3f')]['limit']);_0x48aab3[_0x0d3e('0x2f')]=qs[_0x0d3e('0x2f')](_0x5e37c2[_0x0d3e('0x3f')][_0x0d3e('0x2f')]);}_0x48aab3[_0x0d3e('0x46')]=qs[_0x0d3e('0x47')](_0x5e37c2[_0x0d3e('0x3f')][_0x0d3e('0x47')]);_0x48aab3[_0x0d3e('0x48')]=qs['filters'](_[_0x0d3e('0x49')](_0x5e37c2[_0x0d3e('0x3f')],_0x5b8da6[_0x0d3e('0x4a')]));if(_0x5e37c2[_0x0d3e('0x3f')][_0x0d3e('0x4b')]){_0x48aab3[_0x0d3e('0x48')]=_[_0x0d3e('0x4c')](_0x48aab3[_0x0d3e('0x48')],{'$or':_[_0x0d3e('0x3e')](_0x56b5d9,function(_0x486cc3){if(_0x486cc3[_0x0d3e('0x3b')]!==_0x0d3e('0x4d')){var _0x12d362={};_0x12d362[_0x486cc3[_0x0d3e('0x36')]]={'$like':'%'+_0x5e37c2['query']['filter']+'%'};return _0x12d362;}})});}_0x48aab3=_[_0x0d3e('0x4c')]({},_0x48aab3,_0x5e37c2[_0x0d3e('0x4e')]);var _0x47a681={'where':_0x48aab3[_0x0d3e('0x48')]};return db[_0x0d3e('0x39')][_0x0d3e('0x2e')](_0x47a681)[_0x0d3e('0x21')](function(_0x367bf7){_0x48d88e['count']=_0x367bf7;if(_0x5e37c2[_0x0d3e('0x3f')][_0x0d3e('0x4f')]){_0x48aab3[_0x0d3e('0x50')]=[{'all':!![]}];}return db[_0x0d3e('0x39')][_0x0d3e('0x51')](_0x48aab3);})[_0x0d3e('0x21')](function(_0x311834){_0x48d88e[_0x0d3e('0x52')]=_0x311834;return _0x48d88e;})['then'](respondWithFilteredResult(_0x210a69,_0x48aab3))[_0x0d3e('0x29')](handleError(_0x210a69,null));};exports[_0x0d3e('0x53')]=function(_0x11f0ba,_0x12137a){var _0x587346={'raw':![],'where':{'id':_0x11f0ba[_0x0d3e('0x54')]['id']}},_0x28e003={};_0x28e003[_0x0d3e('0x3d')]=_[_0x0d3e('0x40')](db[_0x0d3e('0x39')][_0x0d3e('0x3a')]);_0x28e003[_0x0d3e('0x3f')]=_[_0x0d3e('0x40')](_0x11f0ba[_0x0d3e('0x3f')]);_0x28e003[_0x0d3e('0x4a')]=_[_0x0d3e('0x55')](_0x28e003['model'],_0x28e003['query']);_0x587346[_0x0d3e('0x41')]=_['intersection'](_0x28e003[_0x0d3e('0x3d')],qs[_0x0d3e('0x42')](_0x11f0ba[_0x0d3e('0x3f')][_0x0d3e('0x42')]));_0x587346[_0x0d3e('0x41')]=_0x587346[_0x0d3e('0x41')][_0x0d3e('0x43')]?_0x587346['attributes']:_0x28e003[_0x0d3e('0x3d')];if(_0x11f0ba[_0x0d3e('0x3f')][_0x0d3e('0x4f')]){_0x587346[_0x0d3e('0x50')]=[{'all':!![]}];}_0x587346=_['merge']({},_0x587346,_0x11f0ba[_0x0d3e('0x4e')]);return db['ServicenowConfiguration'][_0x0d3e('0x56')](_0x587346)[_0x0d3e('0x21')](handleEntityNotFound(_0x12137a,null))[_0x0d3e('0x21')](respondWithResult(_0x12137a,null))['catch'](handleError(_0x12137a,null));};exports[_0x0d3e('0x57')]=function(_0x7196d3,_0x1a3209){return db[_0x0d3e('0x39')]['create'](_0x7196d3[_0x0d3e('0x58')],{})[_0x0d3e('0x21')](respondWithResult(_0x1a3209,0xc9))['catch'](handleError(_0x1a3209,null));};exports[_0x0d3e('0x59')]=function(_0x1d72b5,_0x2806f9){if(_0x1d72b5[_0x0d3e('0x58')]['id']){delete _0x1d72b5[_0x0d3e('0x58')]['id'];}return db[_0x0d3e('0x39')][_0x0d3e('0x56')]({'where':{'id':_0x1d72b5[_0x0d3e('0x54')]['id']}})[_0x0d3e('0x21')](handleEntityNotFound(_0x2806f9,null))['then'](saveUpdates(_0x1d72b5['body'],null))[_0x0d3e('0x21')](respondWithResult(_0x2806f9,null))[_0x0d3e('0x29')](handleError(_0x2806f9,null));};exports[_0x0d3e('0x34')]=function(_0x4a6403,_0x222c02){return db[_0x0d3e('0x39')][_0x0d3e('0x56')]({'where':{'id':_0x4a6403['params']['id']}})[_0x0d3e('0x21')](handleEntityNotFound(_0x222c02,null))[_0x0d3e('0x21')](removeEntity(_0x222c02,null))[_0x0d3e('0x29')](handleError(_0x222c02,null));};exports[_0x0d3e('0x5a')]=function(_0x5d739e,_0x4b4872,_0x47e7a4){var _0x4e39e1={};var _0x545184={};var _0x13d156;var _0xe75699;return db[_0x0d3e('0x39')]['findOne']({'where':{'id':_0x5d739e[_0x0d3e('0x54')]['id']}})[_0x0d3e('0x21')](handleEntityNotFound(_0x4b4872,null))['then'](function(_0x44f59a){if(_0x44f59a){_0x13d156=_0x44f59a;_0x545184[_0x0d3e('0x3d')]=_['keys'](db['ServicenowField'][_0x0d3e('0x3a')]);_0x545184[_0x0d3e('0x3f')]=_[_0x0d3e('0x40')](_0x5d739e['query']);_0x545184[_0x0d3e('0x4a')]=_['intersection'](_0x545184[_0x0d3e('0x3d')],_0x545184[_0x0d3e('0x3f')]);_0x4e39e1[_0x0d3e('0x41')]=_['intersection'](_0x545184[_0x0d3e('0x3d')],qs['fields'](_0x5d739e[_0x0d3e('0x3f')][_0x0d3e('0x42')]));_0x4e39e1[_0x0d3e('0x41')]=_0x4e39e1[_0x0d3e('0x41')]['length']?_0x4e39e1[_0x0d3e('0x41')]:_0x545184['model'];_0x4e39e1[_0x0d3e('0x46')]=qs[_0x0d3e('0x47')](_0x5d739e[_0x0d3e('0x3f')]['sort']);_0x4e39e1['where']=qs[_0x0d3e('0x4a')](_[_0x0d3e('0x49')](_0x5d739e[_0x0d3e('0x3f')],_0x545184[_0x0d3e('0x4a')]));if(_0x5d739e[_0x0d3e('0x3f')]['filter']){_0x4e39e1[_0x0d3e('0x48')]=_[_0x0d3e('0x4c')](_0x4e39e1['where'],{'$or':_[_0x0d3e('0x3e')](_0x4e39e1[_0x0d3e('0x41')],function(_0x10e098){var _0x3293be={};_0x3293be[_0x10e098]={'$like':'%'+_0x5d739e[_0x0d3e('0x3f')][_0x0d3e('0x4b')]+'%'};return _0x3293be;})});}_0x4e39e1=_[_0x0d3e('0x4c')]({},_0x4e39e1,_0x5d739e[_0x0d3e('0x4e')]);return _0x13d156[_0x0d3e('0x5a')](_0x4e39e1);}})[_0x0d3e('0x21')](function(_0x1a460e){if(_0x1a460e){_0xe75699=_0x1a460e[_0x0d3e('0x43')];if(!_0x5d739e[_0x0d3e('0x3f')][_0x0d3e('0x44')](_0x0d3e('0x45'))){_0x4e39e1[_0x0d3e('0x30')]=qs['limit'](_0x5d739e[_0x0d3e('0x3f')][_0x0d3e('0x30')]);_0x4e39e1['offset']=qs['offset'](_0x5d739e[_0x0d3e('0x3f')][_0x0d3e('0x2f')]);}return _0x13d156[_0x0d3e('0x5a')](_0x4e39e1);}})[_0x0d3e('0x21')](function(_0x2a2c63){if(_0x2a2c63){return _0x2a2c63?{'count':_0xe75699,'rows':_0x2a2c63}:null;}})[_0x0d3e('0x21')](respondWithResult(_0x4b4872,null))[_0x0d3e('0x29')](handleError(_0x4b4872,null));};exports[_0x0d3e('0x5b')]=function(_0x3b01f2,_0x2c7858,_0x172f5d){var _0x107314={};var _0x5ed1a6={};var _0x3c46ab;var _0x3d1498;return db['ServicenowConfiguration'][_0x0d3e('0x5c')]({'where':{'id':_0x3b01f2[_0x0d3e('0x54')]['id']}})[_0x0d3e('0x21')](handleEntityNotFound(_0x2c7858,null))[_0x0d3e('0x21')](function(_0x6b325f){if(_0x6b325f){_0x3c46ab=_0x6b325f;_0x5ed1a6[_0x0d3e('0x3d')]=_['keys'](db[_0x0d3e('0x5d')][_0x0d3e('0x3a')]);_0x5ed1a6[_0x0d3e('0x3f')]=_['keys'](_0x3b01f2[_0x0d3e('0x3f')]);_0x5ed1a6['filters']=_['intersection'](_0x5ed1a6[_0x0d3e('0x3d')],_0x5ed1a6[_0x0d3e('0x3f')]);_0x107314['attributes']=_[_0x0d3e('0x55')](_0x5ed1a6['model'],qs[_0x0d3e('0x42')](_0x3b01f2[_0x0d3e('0x3f')][_0x0d3e('0x42')]));_0x107314[_0x0d3e('0x41')]=_0x107314[_0x0d3e('0x41')][_0x0d3e('0x43')]?_0x107314[_0x0d3e('0x41')]:_0x5ed1a6[_0x0d3e('0x3d')];_0x107314[_0x0d3e('0x46')]=qs[_0x0d3e('0x47')](_0x3b01f2['query']['sort']);_0x107314[_0x0d3e('0x48')]=qs['filters'](_[_0x0d3e('0x49')](_0x3b01f2[_0x0d3e('0x3f')],_0x5ed1a6['filters']));if(_0x3b01f2[_0x0d3e('0x3f')]['filter']){_0x107314['where']=_[_0x0d3e('0x4c')](_0x107314['where'],{'$or':_[_0x0d3e('0x3e')](_0x107314['attributes'],function(_0x8015b8){var _0x2088cf={};_0x2088cf[_0x8015b8]={'$like':'%'+_0x3b01f2[_0x0d3e('0x3f')][_0x0d3e('0x4b')]+'%'};return _0x2088cf;})});}_0x107314=_[_0x0d3e('0x4c')]({},_0x107314,_0x3b01f2[_0x0d3e('0x4e')]);return _0x3c46ab[_0x0d3e('0x5b')](_0x107314);}})[_0x0d3e('0x21')](function(_0xe1482b){if(_0xe1482b){_0x3d1498=_0xe1482b[_0x0d3e('0x43')];if(!_0x3b01f2[_0x0d3e('0x3f')][_0x0d3e('0x44')]('nolimit')){_0x107314[_0x0d3e('0x30')]=qs['limit'](_0x3b01f2['query'][_0x0d3e('0x30')]);_0x107314[_0x0d3e('0x2f')]=qs[_0x0d3e('0x2f')](_0x3b01f2[_0x0d3e('0x3f')][_0x0d3e('0x2f')]);}return _0x3c46ab[_0x0d3e('0x5b')](_0x107314);}})[_0x0d3e('0x21')](function(_0x3078f1){if(_0x3078f1){return _0x3078f1?{'count':_0x3d1498,'rows':_0x3078f1}:null;}})[_0x0d3e('0x21')](respondWithResult(_0x2c7858,null))['catch'](handleError(_0x2c7858,null));};exports['getDescriptions']=function(_0x2d2741,_0x25100f,_0x4d4f09){var _0x4feb7a={};var _0x1b8d03={};var _0x1b6d97;var _0x5d73de;return db['ServicenowConfiguration']['findOne']({'where':{'id':_0x2d2741[_0x0d3e('0x54')]['id']}})[_0x0d3e('0x21')](handleEntityNotFound(_0x25100f,null))[_0x0d3e('0x21')](function(_0x1429aa){if(_0x1429aa){_0x1b6d97=_0x1429aa;_0x1b8d03[_0x0d3e('0x3d')]=_['keys'](db['ServicenowField']['rawAttributes']);_0x1b8d03[_0x0d3e('0x3f')]=_[_0x0d3e('0x40')](_0x2d2741[_0x0d3e('0x3f')]);_0x1b8d03[_0x0d3e('0x4a')]=_[_0x0d3e('0x55')](_0x1b8d03['model'],_0x1b8d03[_0x0d3e('0x3f')]);_0x4feb7a[_0x0d3e('0x41')]=_[_0x0d3e('0x55')](_0x1b8d03[_0x0d3e('0x3d')],qs['fields'](_0x2d2741[_0x0d3e('0x3f')][_0x0d3e('0x42')]));_0x4feb7a[_0x0d3e('0x41')]=_0x4feb7a['attributes'][_0x0d3e('0x43')]?_0x4feb7a[_0x0d3e('0x41')]:_0x1b8d03[_0x0d3e('0x3d')];_0x4feb7a[_0x0d3e('0x46')]=qs[_0x0d3e('0x47')](_0x2d2741['query'][_0x0d3e('0x47')]);_0x4feb7a['where']=qs[_0x0d3e('0x4a')](_[_0x0d3e('0x49')](_0x2d2741[_0x0d3e('0x3f')],_0x1b8d03['filters']));if(_0x2d2741[_0x0d3e('0x3f')][_0x0d3e('0x4b')]){_0x4feb7a[_0x0d3e('0x48')]=_['merge'](_0x4feb7a[_0x0d3e('0x48')],{'$or':_[_0x0d3e('0x3e')](_0x4feb7a['attributes'],function(_0x42c74b){var _0x53444d={};_0x53444d[_0x42c74b]={'$like':'%'+_0x2d2741['query'][_0x0d3e('0x4b')]+'%'};return _0x53444d;})});}_0x4feb7a=_['merge']({},_0x4feb7a,_0x2d2741[_0x0d3e('0x4e')]);return _0x1b6d97[_0x0d3e('0x5e')](_0x4feb7a);}})[_0x0d3e('0x21')](function(_0x1ff0e9){if(_0x1ff0e9){_0x5d73de=_0x1ff0e9[_0x0d3e('0x43')];if(!_0x2d2741[_0x0d3e('0x3f')]['hasOwnProperty'](_0x0d3e('0x45'))){_0x4feb7a[_0x0d3e('0x30')]=qs['limit'](_0x2d2741[_0x0d3e('0x3f')]['limit']);_0x4feb7a['offset']=qs[_0x0d3e('0x2f')](_0x2d2741[_0x0d3e('0x3f')][_0x0d3e('0x2f')]);}return _0x1b6d97[_0x0d3e('0x5e')](_0x4feb7a);}})[_0x0d3e('0x21')](function(_0x464673){if(_0x464673){return _0x464673?{'count':_0x5d73de,'rows':_0x464673}:null;}})[_0x0d3e('0x21')](respondWithResult(_0x25100f,null))[_0x0d3e('0x29')](handleError(_0x25100f,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 09c3e44..c2bd795 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 _0x7294=['bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x375efe,_0x27df2d){var _0x1d5db6=function(_0x43e15d){while(--_0x43e15d){_0x375efe['push'](_0x375efe['shift']());}};_0x1d5db6(++_0x27df2d);}(_0x7294,0x157));var _0x4729=function(_0x1ad6bf,_0x5c3b39){_0x1ad6bf=_0x1ad6bf-0x0;var _0x2ac4e9=_0x7294[_0x1ad6bf];return _0x2ac4e9;};'use strict';var _=require(_0x4729('0x0'));var util=require(_0x4729('0x1'));var logger=require(_0x4729('0x2'))(_0x4729('0x3'));var moment=require(_0x4729('0x4'));var BPromise=require(_0x4729('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4729('0x6'));var rimraf=require(_0x4729('0x7'));var config=require(_0x4729('0x8'));var attributes=require(_0x4729('0x9'));module['exports']=function(_0x57392c,_0xa7a0c8){return _0x57392c['define'](_0x4729('0xa'),attributes,{'tableName':_0x4729('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8bfd=['./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5223bf,_0x109da4){var _0x181da4=function(_0x5d7047){while(--_0x5d7047){_0x5223bf['push'](_0x5223bf['shift']());}};_0x181da4(++_0x109da4);}(_0x8bfd,0xae));var _0xd8bf=function(_0xc80b2b,_0x5a12e9){_0xc80b2b=_0xc80b2b-0x0;var _0x22af6f=_0x8bfd[_0xc80b2b];return _0x22af6f;};'use strict';var _=require(_0xd8bf('0x0'));var util=require(_0xd8bf('0x1'));var logger=require(_0xd8bf('0x2'))(_0xd8bf('0x3'));var moment=require(_0xd8bf('0x4'));var BPromise=require(_0xd8bf('0x5'));var rp=require(_0xd8bf('0x6'));var fs=require('fs');var path=require(_0xd8bf('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd8bf('0x8'));module[_0xd8bf('0x9')]=function(_0x543c2f,_0x4ae3d8){return _0x543c2f[_0xd8bf('0xa')](_0xd8bf('0xb'),attributes,{'tableName':_0xd8bf('0xc'),'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 f2b98c1..9dac6f5 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 _0xeebd=['then','info','request\x20sent','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http'];(function(_0x492451,_0x3771c3){var _0x1984e9=function(_0x8b7510){while(--_0x8b7510){_0x492451['push'](_0x492451['shift']());}};_0x1984e9(++_0x3771c3);}(_0xeebd,0x119));var _0xdeeb=function(_0x197c48,_0x46b30f){_0x197c48=_0x197c48-0x0;var _0x536305=_0xeebd[_0x197c48];return _0x536305;};'use strict';var _=require('lodash');var util=require(_0xdeeb('0x0'));var moment=require('moment');var BPromise=require(_0xdeeb('0x1'));var rs=require(_0xdeeb('0x2'));var fs=require('fs');var Redis=require(_0xdeeb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdeeb('0x4'));var logger=require('../../config/logger')(_0xdeeb('0x5'));var config=require(_0xdeeb('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xdeeb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x459271,_0x43e48b,_0x3ff94c){return new BPromise(function(_0x599f8a,_0x434093){return client['request'](_0x459271,_0x3ff94c)[_0xdeeb('0x8')](function(_0x14b11b){logger[_0xdeeb('0x9')]('ServicenowConfiguration,\x20%s,\x20%s',_0x43e48b,_0xdeeb('0xa'));logger['debug']('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x43e48b,_0xdeeb('0xa'),JSON[_0xdeeb('0xb')](_0x14b11b));if(_0x14b11b[_0xdeeb('0xc')]){if(_0x14b11b[_0xdeeb('0xc')][_0xdeeb('0xd')]===0x1f4){logger['error'](_0xdeeb('0xe'),_0x43e48b,_0x14b11b[_0xdeeb('0xc')]['message']);return _0x434093(_0x14b11b[_0xdeeb('0xc')][_0xdeeb('0xf')]);}logger[_0xdeeb('0xc')](_0xdeeb('0xe'),_0x43e48b,_0x14b11b[_0xdeeb('0xc')][_0xdeeb('0xf')]);return _0x599f8a(_0x14b11b['error'][_0xdeeb('0xf')]);}else{logger[_0xdeeb('0x9')](_0xdeeb('0xe'),_0x43e48b,_0xdeeb('0xa'));_0x599f8a(_0x14b11b[_0xdeeb('0x10')][_0xdeeb('0xf')]);}})['catch'](function(_0x590180){logger['error'](_0xdeeb('0xe'),_0x43e48b,_0x590180);_0x434093(_0x590180);});});} \ No newline at end of file +var _0x3fc9=['ServicenowConfiguration,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x4c5c97,_0x4f85bf){var _0xd5d2cb=function(_0x1e6100){while(--_0x1e6100){_0x4c5c97['push'](_0x4c5c97['shift']());}};_0xd5d2cb(++_0x4f85bf);}(_0x3fc9,0xa2));var _0x93fc=function(_0x20e40d,_0x2a9f0f){_0x20e40d=_0x20e40d-0x0;var _0x558350=_0x3fc9[_0x20e40d];return _0x558350;};'use strict';var _=require(_0x93fc('0x0'));var util=require(_0x93fc('0x1'));var moment=require(_0x93fc('0x2'));var BPromise=require(_0x93fc('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x93fc('0x4'))['db'];var utils=require(_0x93fc('0x5'));var logger=require(_0x93fc('0x6'))(_0x93fc('0x7'));var config=require(_0x93fc('0x8'));var jayson=require(_0x93fc('0x9'));var client=jayson['client'][_0x93fc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x16be52,_0x5b8abe,_0x1cba32){return new BPromise(function(_0x33454a,_0x58bffd){return client[_0x93fc('0xb')](_0x16be52,_0x1cba32)[_0x93fc('0xc')](function(_0x102e0d){logger[_0x93fc('0xd')](_0x93fc('0xe'),_0x5b8abe,'request\x20sent');logger[_0x93fc('0xf')]('ServicenowConfiguration,\x20%s,\x20%s,\x20%s',_0x5b8abe,_0x93fc('0x10'),JSON['stringify'](_0x102e0d));if(_0x102e0d[_0x93fc('0x11')]){if(_0x102e0d[_0x93fc('0x11')][_0x93fc('0x12')]===0x1f4){logger['error'](_0x93fc('0xe'),_0x5b8abe,_0x102e0d[_0x93fc('0x11')][_0x93fc('0x13')]);return _0x58bffd(_0x102e0d[_0x93fc('0x11')]['message']);}logger[_0x93fc('0x11')](_0x93fc('0xe'),_0x5b8abe,_0x102e0d[_0x93fc('0x11')]['message']);return _0x33454a(_0x102e0d[_0x93fc('0x11')][_0x93fc('0x13')]);}else{logger[_0x93fc('0xd')](_0x93fc('0xe'),_0x5b8abe,_0x93fc('0x10'));_0x33454a(_0x102e0d[_0x93fc('0x14')]['message']);}})[_0x93fc('0x15')](function(_0xda0e16){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x5b8abe,_0xda0e16);_0x58bffd(_0xda0e16);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 2ebfe96..ca3f21a 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 _0x3529=['destroy','exports','util','path','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','index','/:id','isAuthenticated','show','post','create','update','delete'];(function(_0x2e509c,_0x64456e){var _0x4f06b9=function(_0x58b173){while(--_0x58b173){_0x2e509c['push'](_0x2e509c['shift']());}};_0x4f06b9(++_0x64456e);}(_0x3529,0xf2));var _0x9352=function(_0x4e11e7,_0x42d0b6){_0x4e11e7=_0x4e11e7-0x0;var _0x1d7d39=_0x3529[_0x4e11e7];return _0x1d7d39;};'use strict';var multer=require('multer');var util=require(_0x9352('0x0'));var path=require(_0x9352('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9352('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x9352('0x3'));var config=require(_0x9352('0x4'));var controller=require(_0x9352('0x5'));router['get']('/',auth['isAuthenticated'](),controller[_0x9352('0x6')]);router['get'](_0x9352('0x7'),auth[_0x9352('0x8')](),controller[_0x9352('0x9')]);router[_0x9352('0xa')]('/',auth[_0x9352('0x8')](),controller[_0x9352('0xb')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9352('0xc')]);router[_0x9352('0xd')](_0x9352('0x7'),auth[_0x9352('0x8')](),controller[_0x9352('0xe')]);module[_0x9352('0xf')]=router; \ No newline at end of file +var _0xa46e=['destroy','multer','util','connect-timeout','Router','../../components/auth/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index','/:id','show','post','create','put','delete'];(function(_0x170635,_0x3ffbfb){var _0x154bee=function(_0x15c7d5){while(--_0x15c7d5){_0x170635['push'](_0x170635['shift']());}};_0x154bee(++_0x3ffbfb);}(_0xa46e,0xde));var _0xea46=function(_0x3b4b1d,_0x15029e){_0x3b4b1d=_0x3b4b1d-0x0;var _0x488c36=_0xa46e[_0x3b4b1d];return _0x488c36;};'use strict';var multer=require(_0xea46('0x0'));var util=require(_0xea46('0x1'));var path=require('path');var timeout=require(_0xea46('0x2'));var express=require('express');var router=express[_0xea46('0x3')]();var auth=require(_0xea46('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xea46('0x5'));var controller=require(_0xea46('0x6'));router[_0xea46('0x7')]('/',auth[_0xea46('0x8')](),controller[_0xea46('0x9')]);router['get'](_0xea46('0xa'),auth[_0xea46('0x8')](),controller[_0xea46('0xb')]);router[_0xea46('0xc')]('/',auth[_0xea46('0x8')](),controller[_0xea46('0xd')]);router[_0xea46('0xe')](_0xea46('0xa'),auth['isAuthenticated'](),controller['update']);router[_0xea46('0xf')](_0xea46('0xa'),auth['isAuthenticated'](),controller[_0xea46('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index a0ffa45..46129ab 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 _0x7662=['string','STRING','sequelize','exports','ENUM','variable','customVariable','keyValue'];(function(_0x5e4f24,_0x523774){var _0x14c7b8=function(_0xeaaed2){while(--_0xeaaed2){_0x5e4f24['push'](_0x5e4f24['shift']());}};_0x14c7b8(++_0x523774);}(_0x7662,0xd2));var _0x2766=function(_0x226a2c,_0x301754){_0x226a2c=_0x226a2c-0x0;var _0x7e8247=_0x7662[_0x226a2c];return _0x7e8247;};'use strict';var Sequelize=require(_0x2766('0x0'));module[_0x2766('0x1')]={'type':{'type':Sequelize[_0x2766('0x2')]('string',_0x2766('0x3'),_0x2766('0x4'),_0x2766('0x5')),'defaultValue':_0x2766('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x2766('0x7')]},'keyType':{'type':Sequelize[_0x2766('0x2')](_0x2766('0x6'),_0x2766('0x3'),_0x2766('0x4'))},'keyContent':{'type':Sequelize[_0x2766('0x7')]},'idField':{'type':Sequelize[_0x2766('0x7')]},'nameField':{'type':Sequelize[_0x2766('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x2766('0x7')]}}; \ No newline at end of file +var _0x84d8=['string','STRING','BOOLEAN','sequelize','exports','ENUM','variable','keyValue'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x84d8,0x8b));var _0x884d=function(_0x33ae7b,_0x216a78){_0x33ae7b=_0x33ae7b-0x0;var _0x4c91ad=_0x84d8[_0x33ae7b];return _0x4c91ad;};'use strict';var Sequelize=require(_0x884d('0x0'));module[_0x884d('0x1')]={'type':{'type':Sequelize[_0x884d('0x2')]('string',_0x884d('0x3'),'customVariable',_0x884d('0x4')),'defaultValue':_0x884d('0x5')},'content':{'type':Sequelize[_0x884d('0x6')]},'key':{'type':Sequelize[_0x884d('0x6')]},'keyType':{'type':Sequelize[_0x884d('0x2')](_0x884d('0x5'),_0x884d('0x3'),'customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x884d('0x6')]},'customField':{'type':Sequelize[_0x884d('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x884d('0x6')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index 97b17f4..340b3f4 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 _0xbb96=['pick','filter','merge','type','VIRTUAL','name','includeAll','include','findAll','catch','show','params','options','find','create','body','update','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','send','index','map','ServicenowField','rawAttributes','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbb96,0xf2));var _0x6bb9=function(_0x380016,_0x178dd6){_0x380016=_0x380016-0x0;var _0x5c7ac0=_0xbb96[_0x380016];return _0x5c7ac0;};'use strict';var pdf=require(_0x6bb9('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x6bb9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6bb9('0x2'));var rp=require(_0x6bb9('0x3'));var moment=require(_0x6bb9('0x4'));var BPromise=require(_0x6bb9('0x5'));var Mustache=require(_0x6bb9('0x6'));var util=require(_0x6bb9('0x7'));var path=require(_0x6bb9('0x8'));var sox=require(_0x6bb9('0x9'));var csv=require(_0x6bb9('0xa'));var ejs=require(_0x6bb9('0xb'));var fs=require('fs');var _=require(_0x6bb9('0xc'));var squel=require(_0x6bb9('0xd'));var crypto=require(_0x6bb9('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x6bb9('0xf'));var toCsv=require(_0x6bb9('0xa'));var querystring=require(_0x6bb9('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x6bb9('0x11'));var qs=require(_0x6bb9('0x12'));var as=require(_0x6bb9('0x13'));var hardwareService=require(_0x6bb9('0x14'));var logger=require('../../config/logger')(_0x6bb9('0x15'));var utils=require(_0x6bb9('0x16'));var config=require(_0x6bb9('0x17'));var db=require(_0x6bb9('0x18'))['db'];function respondWithStatusCode(_0x26b70f,_0x10e43f){_0x10e43f=_0x10e43f||0xcc;return function(_0x4ddbc2){if(_0x4ddbc2){return _0x26b70f[_0x6bb9('0x19')](_0x10e43f);}return _0x26b70f[_0x6bb9('0x1a')](_0x10e43f)[_0x6bb9('0x1b')]();};}function respondWithResult(_0x43ee74,_0x32f472){_0x32f472=_0x32f472||0xc8;return function(_0x589a35){if(_0x589a35){return _0x43ee74[_0x6bb9('0x1a')](_0x32f472)['json'](_0x589a35);}};}function respondWithFilteredResult(_0x9f0a31,_0x1ca6f8){return function(_0x47f364){if(_0x47f364){var _0x2a04e8=_0x47f364[_0x6bb9('0x1c')],_0x5f094c=_0x1ca6f8[_0x6bb9('0x1d')],_0x51d252=_0x1ca6f8[_0x6bb9('0x1d')]+_0x1ca6f8[_0x6bb9('0x1e')],_0x3d1f57;if(_0x51d252>=_0x2a04e8){_0x51d252=_0x2a04e8;_0x3d1f57=0xc8;}else{_0x3d1f57=0xce;}_0x9f0a31[_0x6bb9('0x1a')](_0x3d1f57);return _0x9f0a31[_0x6bb9('0x1f')](_0x6bb9('0x20'),_0x5f094c+'-'+_0x51d252+'/'+_0x2a04e8)['json'](_0x47f364);}return null;};}function patchUpdates(_0x1e5dbf){return function(_0x3386d5){try{jsonpatch[_0x6bb9('0x21')](_0x3386d5,_0x1e5dbf,!![]);}catch(_0x22b1f0){return BPromise[_0x6bb9('0x22')](_0x22b1f0);}return _0x3386d5[_0x6bb9('0x23')]();};}function saveUpdates(_0x3b67bd,_0x4fd66d){return function(_0x241073){if(_0x241073){return _0x241073['update'](_0x3b67bd)[_0x6bb9('0x24')](function(_0x4543b2){return _0x4543b2;});}return null;};}function removeEntity(_0x548736,_0x1a6555){return function(_0x4ddf1d){if(_0x4ddf1d){return _0x4ddf1d[_0x6bb9('0x25')]()[_0x6bb9('0x24')](function(){_0x548736[_0x6bb9('0x1a')](0xcc)[_0x6bb9('0x1b')]();});}};}function handleEntityNotFound(_0x431001,_0xe9cd26){return function(_0x2540cd){if(!_0x2540cd){_0x431001[_0x6bb9('0x19')](0x194);}return _0x2540cd;};}function handleError(_0x4468d7,_0x2fc901){_0x2fc901=_0x2fc901||0x1f4;return function(_0x37b971){logger[_0x6bb9('0x26')](_0x37b971['stack']);if(_0x37b971['name']){delete _0x37b971['name'];}_0x4468d7[_0x6bb9('0x1a')](_0x2fc901)[_0x6bb9('0x27')](_0x37b971);};}exports[_0x6bb9('0x28')]=function(_0x133071,_0x4fcb9e){var _0x2e047e={},_0x1763c1={},_0x5820b3={'count':0x0,'rows':[]};var _0x518730=_[_0x6bb9('0x29')](db[_0x6bb9('0x2a')][_0x6bb9('0x2b')],function(_0xc44865){return{'name':_0xc44865['fieldName'],'type':_0xc44865['type'][_0x6bb9('0x2c')]};});_0x1763c1[_0x6bb9('0x2d')]=_['map'](_0x518730,'name');_0x1763c1[_0x6bb9('0x2e')]=_[_0x6bb9('0x2f')](_0x133071[_0x6bb9('0x2e')]);_0x1763c1['filters']=_[_0x6bb9('0x30')](_0x1763c1[_0x6bb9('0x2d')],_0x1763c1[_0x6bb9('0x2e')]);_0x2e047e[_0x6bb9('0x31')]=_[_0x6bb9('0x30')](_0x1763c1[_0x6bb9('0x2d')],qs[_0x6bb9('0x32')](_0x133071[_0x6bb9('0x2e')][_0x6bb9('0x32')]));_0x2e047e[_0x6bb9('0x31')]=_0x2e047e[_0x6bb9('0x31')][_0x6bb9('0x33')]?_0x2e047e['attributes']:_0x1763c1[_0x6bb9('0x2d')];if(!_0x133071['query'][_0x6bb9('0x34')](_0x6bb9('0x35'))){_0x2e047e[_0x6bb9('0x1e')]=qs[_0x6bb9('0x1e')](_0x133071[_0x6bb9('0x2e')]['limit']);_0x2e047e[_0x6bb9('0x1d')]=qs[_0x6bb9('0x1d')](_0x133071[_0x6bb9('0x2e')][_0x6bb9('0x1d')]);}_0x2e047e[_0x6bb9('0x36')]=qs[_0x6bb9('0x37')](_0x133071[_0x6bb9('0x2e')][_0x6bb9('0x37')]);_0x2e047e[_0x6bb9('0x38')]=qs[_0x6bb9('0x39')](_[_0x6bb9('0x3a')](_0x133071[_0x6bb9('0x2e')],_0x1763c1[_0x6bb9('0x39')]));if(_0x133071[_0x6bb9('0x2e')][_0x6bb9('0x3b')]){_0x2e047e[_0x6bb9('0x38')]=_[_0x6bb9('0x3c')](_0x2e047e[_0x6bb9('0x38')],{'$or':_['map'](_0x518730,function(_0x555aac){if(_0x555aac[_0x6bb9('0x3d')]!==_0x6bb9('0x3e')){var _0x42bd31={};_0x42bd31[_0x555aac[_0x6bb9('0x3f')]]={'$like':'%'+_0x133071['query']['filter']+'%'};return _0x42bd31;}})});}_0x2e047e=_['merge']({},_0x2e047e,_0x133071['options']);var _0xca0aa={'where':_0x2e047e[_0x6bb9('0x38')]};return db[_0x6bb9('0x2a')][_0x6bb9('0x1c')](_0xca0aa)['then'](function(_0x3b1dea){_0x5820b3[_0x6bb9('0x1c')]=_0x3b1dea;if(_0x133071[_0x6bb9('0x2e')][_0x6bb9('0x40')]){_0x2e047e[_0x6bb9('0x41')]=[{'all':!![]}];}return db['ServicenowField'][_0x6bb9('0x42')](_0x2e047e);})['then'](function(_0x4b0253){_0x5820b3['rows']=_0x4b0253;return _0x5820b3;})[_0x6bb9('0x24')](respondWithFilteredResult(_0x4fcb9e,_0x2e047e))[_0x6bb9('0x43')](handleError(_0x4fcb9e,null));};exports[_0x6bb9('0x44')]=function(_0xa5b09e,_0x1620e8){var _0x1096fc={'raw':!![],'where':{'id':_0xa5b09e[_0x6bb9('0x45')]['id']}},_0x480fa1={};_0x480fa1[_0x6bb9('0x2d')]=_[_0x6bb9('0x2f')](db[_0x6bb9('0x2a')][_0x6bb9('0x2b')]);_0x480fa1[_0x6bb9('0x2e')]=_[_0x6bb9('0x2f')](_0xa5b09e['query']);_0x480fa1[_0x6bb9('0x39')]=_[_0x6bb9('0x30')](_0x480fa1[_0x6bb9('0x2d')],_0x480fa1[_0x6bb9('0x2e')]);_0x1096fc[_0x6bb9('0x31')]=_[_0x6bb9('0x30')](_0x480fa1[_0x6bb9('0x2d')],qs[_0x6bb9('0x32')](_0xa5b09e[_0x6bb9('0x2e')][_0x6bb9('0x32')]));_0x1096fc[_0x6bb9('0x31')]=_0x1096fc[_0x6bb9('0x31')][_0x6bb9('0x33')]?_0x1096fc[_0x6bb9('0x31')]:_0x480fa1['model'];if(_0xa5b09e['query'][_0x6bb9('0x40')]){_0x1096fc['include']=[{'all':!![]}];}_0x1096fc=_[_0x6bb9('0x3c')]({},_0x1096fc,_0xa5b09e[_0x6bb9('0x46')]);return db[_0x6bb9('0x2a')][_0x6bb9('0x47')](_0x1096fc)[_0x6bb9('0x24')](handleEntityNotFound(_0x1620e8,null))[_0x6bb9('0x24')](respondWithResult(_0x1620e8,null))[_0x6bb9('0x43')](handleError(_0x1620e8,null));};exports[_0x6bb9('0x48')]=function(_0x3ea763,_0x2e9d4a){return db['ServicenowField']['create'](_0x3ea763[_0x6bb9('0x49')],{})[_0x6bb9('0x24')](respondWithResult(_0x2e9d4a,0xc9))[_0x6bb9('0x43')](handleError(_0x2e9d4a,null));};exports[_0x6bb9('0x4a')]=function(_0x13a299,_0x1d59ed){if(_0x13a299[_0x6bb9('0x49')]['id']){delete _0x13a299['body']['id'];}return db[_0x6bb9('0x2a')]['find']({'where':{'id':_0x13a299['params']['id']}})[_0x6bb9('0x24')](handleEntityNotFound(_0x1d59ed,null))['then'](saveUpdates(_0x13a299['body'],null))[_0x6bb9('0x24')](respondWithResult(_0x1d59ed,null))[_0x6bb9('0x43')](handleError(_0x1d59ed,null));};exports[_0x6bb9('0x25')]=function(_0x12f0ad,_0x299464){return db[_0x6bb9('0x2a')][_0x6bb9('0x47')]({'where':{'id':_0x12f0ad[_0x6bb9('0x45')]['id']}})[_0x6bb9('0x24')](handleEntityNotFound(_0x299464,null))[_0x6bb9('0x24')](removeEntity(_0x299464,null))[_0x6bb9('0x43')](handleError(_0x299464,null));}; \ No newline at end of file +var _0xdacc=['rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','eml-format','rimraf','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','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','json','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','ServicenowField'];(function(_0x3517e5,_0x2c3608){var _0x15ba05=function(_0x6eccbc){while(--_0x6eccbc){_0x3517e5['push'](_0x3517e5['shift']());}};_0x15ba05(++_0x2c3608);}(_0xdacc,0x14f));var _0xcdac=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xdacc[_0x14add3];return _0x4a174f;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xcdac('0x0'));var rimraf=require(_0xcdac('0x1'));var zipdir=require(_0xcdac('0x2'));var jsonpatch=require(_0xcdac('0x3'));var rp=require(_0xcdac('0x4'));var moment=require(_0xcdac('0x5'));var BPromise=require(_0xcdac('0x6'));var Mustache=require('mustache');var util=require(_0xcdac('0x7'));var path=require(_0xcdac('0x8'));var sox=require(_0xcdac('0x9'));var csv=require(_0xcdac('0xa'));var ejs=require(_0xcdac('0xb'));var fs=require('fs');var _=require(_0xcdac('0xc'));var squel=require(_0xcdac('0xd'));var crypto=require(_0xcdac('0xe'));var jsforce=require(_0xcdac('0xf'));var deskjs=require(_0xcdac('0x10'));var toCsv=require(_0xcdac('0xa'));var querystring=require(_0xcdac('0x11'));var Papa=require(_0xcdac('0x12'));var Redis=require(_0xcdac('0x13'));var authService=require(_0xcdac('0x14'));var qs=require(_0xcdac('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xcdac('0x16'));var logger=require(_0xcdac('0x17'))('api');var utils=require(_0xcdac('0x18'));var config=require(_0xcdac('0x19'));var db=require(_0xcdac('0x1a'))['db'];function respondWithStatusCode(_0xdc5b0e,_0x3f949d){_0x3f949d=_0x3f949d||0xcc;return function(_0x511f55){if(_0x511f55){return _0xdc5b0e['sendStatus'](_0x3f949d);}return _0xdc5b0e[_0xcdac('0x1b')](_0x3f949d)['end']();};}function respondWithResult(_0x36c582,_0x50b59c){_0x50b59c=_0x50b59c||0xc8;return function(_0x5b3bdd){if(_0x5b3bdd){return _0x36c582[_0xcdac('0x1b')](_0x50b59c)[_0xcdac('0x1c')](_0x5b3bdd);}};}function respondWithFilteredResult(_0x1b4bba,_0x228096){return function(_0x1ff7d3){if(_0x1ff7d3){var _0x2882cc=_0x1ff7d3['count'],_0x53a103=_0x228096[_0xcdac('0x1d')],_0x38ad30=_0x228096[_0xcdac('0x1d')]+_0x228096[_0xcdac('0x1e')],_0x28af17;if(_0x38ad30>=_0x2882cc){_0x38ad30=_0x2882cc;_0x28af17=0xc8;}else{_0x28af17=0xce;}_0x1b4bba[_0xcdac('0x1b')](_0x28af17);return _0x1b4bba[_0xcdac('0x1f')](_0xcdac('0x20'),_0x53a103+'-'+_0x38ad30+'/'+_0x2882cc)[_0xcdac('0x1c')](_0x1ff7d3);}return null;};}function patchUpdates(_0x9e3029){return function(_0x4dcd46){try{jsonpatch['apply'](_0x4dcd46,_0x9e3029,!![]);}catch(_0x7c45b1){return BPromise[_0xcdac('0x21')](_0x7c45b1);}return _0x4dcd46[_0xcdac('0x22')]();};}function saveUpdates(_0x443c86,_0xeb1f4){return function(_0x50bd6e){if(_0x50bd6e){return _0x50bd6e[_0xcdac('0x23')](_0x443c86)[_0xcdac('0x24')](function(_0x367d52){return _0x367d52;});}return null;};}function removeEntity(_0x3e156e,_0x385e56){return function(_0x280d96){if(_0x280d96){return _0x280d96[_0xcdac('0x25')]()[_0xcdac('0x24')](function(){_0x3e156e[_0xcdac('0x1b')](0xcc)[_0xcdac('0x26')]();});}};}function handleEntityNotFound(_0x41bd76,_0x1fe6c9){return function(_0x129103){if(!_0x129103){_0x41bd76['sendStatus'](0x194);}return _0x129103;};}function handleError(_0x3cb041,_0x18f8b9){_0x18f8b9=_0x18f8b9||0x1f4;return function(_0x4689c2){logger[_0xcdac('0x27')](_0x4689c2[_0xcdac('0x28')]);if(_0x4689c2[_0xcdac('0x29')]){delete _0x4689c2['name'];}_0x3cb041[_0xcdac('0x1b')](_0x18f8b9)[_0xcdac('0x2a')](_0x4689c2);};}exports['index']=function(_0x518506,_0x305be2){var _0xf16e7a={},_0x20a058={},_0x26af7c={'count':0x0,'rows':[]};var _0x11806a=_[_0xcdac('0x2b')](db[_0xcdac('0x2c')][_0xcdac('0x2d')],function(_0x508f2a){return{'name':_0x508f2a[_0xcdac('0x2e')],'type':_0x508f2a['type'][_0xcdac('0x2f')]};});_0x20a058[_0xcdac('0x30')]=_['map'](_0x11806a,_0xcdac('0x29'));_0x20a058['query']=_[_0xcdac('0x31')](_0x518506[_0xcdac('0x32')]);_0x20a058[_0xcdac('0x33')]=_[_0xcdac('0x34')](_0x20a058[_0xcdac('0x30')],_0x20a058[_0xcdac('0x32')]);_0xf16e7a['attributes']=_[_0xcdac('0x34')](_0x20a058[_0xcdac('0x30')],qs[_0xcdac('0x35')](_0x518506['query'][_0xcdac('0x35')]));_0xf16e7a[_0xcdac('0x36')]=_0xf16e7a[_0xcdac('0x36')]['length']?_0xf16e7a[_0xcdac('0x36')]:_0x20a058[_0xcdac('0x30')];if(!_0x518506[_0xcdac('0x32')][_0xcdac('0x37')]('nolimit')){_0xf16e7a['limit']=qs[_0xcdac('0x1e')](_0x518506[_0xcdac('0x32')][_0xcdac('0x1e')]);_0xf16e7a['offset']=qs[_0xcdac('0x1d')](_0x518506[_0xcdac('0x32')][_0xcdac('0x1d')]);}_0xf16e7a[_0xcdac('0x38')]=qs[_0xcdac('0x39')](_0x518506[_0xcdac('0x32')][_0xcdac('0x39')]);_0xf16e7a[_0xcdac('0x3a')]=qs[_0xcdac('0x33')](_[_0xcdac('0x3b')](_0x518506[_0xcdac('0x32')],_0x20a058[_0xcdac('0x33')]));if(_0x518506[_0xcdac('0x32')]['filter']){_0xf16e7a[_0xcdac('0x3a')]=_[_0xcdac('0x3c')](_0xf16e7a[_0xcdac('0x3a')],{'$or':_[_0xcdac('0x2b')](_0x11806a,function(_0x5642d8){if(_0x5642d8[_0xcdac('0x3d')]!==_0xcdac('0x3e')){var _0x310af8={};_0x310af8[_0x5642d8[_0xcdac('0x29')]]={'$like':'%'+_0x518506[_0xcdac('0x32')]['filter']+'%'};return _0x310af8;}})});}_0xf16e7a=_[_0xcdac('0x3c')]({},_0xf16e7a,_0x518506[_0xcdac('0x3f')]);var _0x49bf47={'where':_0xf16e7a[_0xcdac('0x3a')]};return db['ServicenowField'][_0xcdac('0x40')](_0x49bf47)['then'](function(_0x474f32){_0x26af7c[_0xcdac('0x40')]=_0x474f32;if(_0x518506[_0xcdac('0x32')][_0xcdac('0x41')]){_0xf16e7a[_0xcdac('0x42')]=[{'all':!![]}];}return db['ServicenowField'][_0xcdac('0x43')](_0xf16e7a);})[_0xcdac('0x24')](function(_0x77b51e){_0x26af7c[_0xcdac('0x44')]=_0x77b51e;return _0x26af7c;})[_0xcdac('0x24')](respondWithFilteredResult(_0x305be2,_0xf16e7a))[_0xcdac('0x45')](handleError(_0x305be2,null));};exports[_0xcdac('0x46')]=function(_0x5ba8b4,_0x3eebbd){var _0x33d40d={'raw':!![],'where':{'id':_0x5ba8b4[_0xcdac('0x47')]['id']}},_0x3868ee={};_0x3868ee[_0xcdac('0x30')]=_['keys'](db[_0xcdac('0x2c')][_0xcdac('0x2d')]);_0x3868ee[_0xcdac('0x32')]=_['keys'](_0x5ba8b4[_0xcdac('0x32')]);_0x3868ee[_0xcdac('0x33')]=_['intersection'](_0x3868ee[_0xcdac('0x30')],_0x3868ee[_0xcdac('0x32')]);_0x33d40d['attributes']=_[_0xcdac('0x34')](_0x3868ee[_0xcdac('0x30')],qs[_0xcdac('0x35')](_0x5ba8b4[_0xcdac('0x32')][_0xcdac('0x35')]));_0x33d40d['attributes']=_0x33d40d[_0xcdac('0x36')][_0xcdac('0x48')]?_0x33d40d[_0xcdac('0x36')]:_0x3868ee[_0xcdac('0x30')];if(_0x5ba8b4[_0xcdac('0x32')][_0xcdac('0x41')]){_0x33d40d[_0xcdac('0x42')]=[{'all':!![]}];}_0x33d40d=_[_0xcdac('0x3c')]({},_0x33d40d,_0x5ba8b4[_0xcdac('0x3f')]);return db['ServicenowField'][_0xcdac('0x49')](_0x33d40d)[_0xcdac('0x24')](handleEntityNotFound(_0x3eebbd,null))['then'](respondWithResult(_0x3eebbd,null))[_0xcdac('0x45')](handleError(_0x3eebbd,null));};exports[_0xcdac('0x4a')]=function(_0x1ee5b0,_0x254073){return db[_0xcdac('0x2c')][_0xcdac('0x4a')](_0x1ee5b0[_0xcdac('0x4b')],{})[_0xcdac('0x24')](respondWithResult(_0x254073,0xc9))['catch'](handleError(_0x254073,null));};exports['update']=function(_0x267168,_0x5d38c7){if(_0x267168[_0xcdac('0x4b')]['id']){delete _0x267168[_0xcdac('0x4b')]['id'];}return db[_0xcdac('0x2c')][_0xcdac('0x49')]({'where':{'id':_0x267168[_0xcdac('0x47')]['id']}})[_0xcdac('0x24')](handleEntityNotFound(_0x5d38c7,null))[_0xcdac('0x24')](saveUpdates(_0x267168[_0xcdac('0x4b')],null))['then'](respondWithResult(_0x5d38c7,null))['catch'](handleError(_0x5d38c7,null));};exports[_0xcdac('0x25')]=function(_0x3a0426,_0x4dca75){return db[_0xcdac('0x2c')]['find']({'where':{'id':_0x3a0426[_0xcdac('0x47')]['id']}})[_0xcdac('0x24')](handleEntityNotFound(_0x4dca75,null))[_0xcdac('0x24')](removeEntity(_0x4dca75,null))[_0xcdac('0x45')](handleError(_0x4dca75,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index 4944fab..431c17b 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 _0x5aa1=['int_servicenow_fields','servicenow_unique_index','idField','FieldId','lodash','util','api','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','ServicenowField'];(function(_0x51666b,_0x48e537){var _0x1858fa=function(_0x578ff0){while(--_0x578ff0){_0x51666b['push'](_0x51666b['shift']());}};_0x1858fa(++_0x48e537);}(_0x5aa1,0x12a));var _0x15aa=function(_0x4a7263,_0x33f427){_0x4a7263=_0x4a7263-0x0;var _0x53b910=_0x5aa1[_0x4a7263];return _0x53b910;};'use strict';var _=require(_0x15aa('0x0'));var util=require(_0x15aa('0x1'));var logger=require('../../config/logger')(_0x15aa('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x15aa('0x3'));var fs=require('fs');var path=require(_0x15aa('0x4'));var rimraf=require(_0x15aa('0x5'));var config=require(_0x15aa('0x6'));var attributes=require(_0x15aa('0x7'));module[_0x15aa('0x8')]=function(_0x47a568,_0x353c21){return _0x47a568['define'](_0x15aa('0x9'),attributes,{'tableName':_0x15aa('0xa'),'paranoid':![],'indexes':[{'name':_0x15aa('0xb'),'fields':[_0x15aa('0xc'),_0x15aa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaf40=['define','ServicenowField','servicenow_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','exports'];(function(_0xc07c48,_0x44605c){var _0x12f62a=function(_0x366804){while(--_0x366804){_0xc07c48['push'](_0xc07c48['shift']());}};_0x12f62a(++_0x44605c);}(_0xaf40,0x75));var _0x0af4=function(_0x400943,_0x21a6c2){_0x400943=_0x400943-0x0;var _0x132814=_0xaf40[_0x400943];return _0x132814;};'use strict';var _=require('lodash');var util=require(_0x0af4('0x0'));var logger=require(_0x0af4('0x1'))(_0x0af4('0x2'));var moment=require(_0x0af4('0x3'));var BPromise=require(_0x0af4('0x4'));var rp=require(_0x0af4('0x5'));var fs=require('fs');var path=require(_0x0af4('0x6'));var rimraf=require(_0x0af4('0x7'));var config=require(_0x0af4('0x8'));var attributes=require(_0x0af4('0x9'));module[_0x0af4('0xa')]=function(_0x1aebbe,_0x244b1b){return _0x1aebbe[_0x0af4('0xb')](_0x0af4('0xc'),attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0x0af4('0xd'),'fields':[_0x0af4('0xe'),_0x0af4('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.rpc.js b/server/api/intServicenowField/intServicenowField.rpc.js index c7e37d5..fa7b77c 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 _0xb262=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','message','lodash','util','moment','bluebird'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0xb262,0x1f0));var _0x2b26=function(_0x3556ec,_0x221714){_0x3556ec=_0x3556ec-0x0;var _0x29d72c=_0xb262[_0x3556ec];return _0x29d72c;};'use strict';var _=require(_0x2b26('0x0'));var util=require(_0x2b26('0x1'));var moment=require(_0x2b26('0x2'));var BPromise=require(_0x2b26('0x3'));var rs=require(_0x2b26('0x4'));var fs=require('fs');var Redis=require(_0x2b26('0x5'));var db=require(_0x2b26('0x6'))['db'];var utils=require(_0x2b26('0x7'));var logger=require('../../config/logger')(_0x2b26('0x8'));var config=require(_0x2b26('0x9'));var jayson=require(_0x2b26('0xa'));var client=jayson[_0x2b26('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x45d3c1,_0xe5a466,_0x4cc823){return new BPromise(function(_0x58b77e,_0x143c13){return client[_0x2b26('0xc')](_0x45d3c1,_0x4cc823)['then'](function(_0x37d094){logger[_0x2b26('0xd')](_0x2b26('0xe'),_0xe5a466,_0x2b26('0xf'));logger['debug'](_0x2b26('0x10'),_0xe5a466,_0x2b26('0xf'),JSON[_0x2b26('0x11')](_0x37d094));if(_0x37d094[_0x2b26('0x12')]){if(_0x37d094['error']['code']===0x1f4){logger[_0x2b26('0x12')](_0x2b26('0xe'),_0xe5a466,_0x37d094[_0x2b26('0x12')][_0x2b26('0x13')]);return _0x143c13(_0x37d094['error'][_0x2b26('0x13')]);}logger['error']('ServicenowField,\x20%s,\x20%s',_0xe5a466,_0x37d094[_0x2b26('0x12')][_0x2b26('0x13')]);return _0x58b77e(_0x37d094['error'][_0x2b26('0x13')]);}else{logger[_0x2b26('0xd')]('ServicenowField,\x20%s,\x20%s',_0xe5a466,_0x2b26('0xf'));_0x58b77e(_0x37d094['result'][_0x2b26('0x13')]);}})['catch'](function(_0x67e7ca){logger['error']('ServicenowField,\x20%s,\x20%s',_0xe5a466,_0x67e7ca);_0x143c13(_0x67e7ca);});});} \ No newline at end of file +var _0x50ae=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x327c69,_0x27e755){var _0x49c1af=function(_0x21f59e){while(--_0x21f59e){_0x327c69['push'](_0x327c69['shift']());}};_0x49c1af(++_0x27e755);}(_0x50ae,0x1b4));var _0xe50a=function(_0x53ebd9,_0xf37766){_0x53ebd9=_0x53ebd9-0x0;var _0xbaeac=_0x50ae[_0x53ebd9];return _0xbaeac;};'use strict';var _=require('lodash');var util=require(_0xe50a('0x0'));var moment=require(_0xe50a('0x1'));var BPromise=require(_0xe50a('0x2'));var rs=require(_0xe50a('0x3'));var fs=require('fs');var Redis=require(_0xe50a('0x4'));var db=require(_0xe50a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe50a('0x6'))('rpc');var config=require(_0xe50a('0x7'));var jayson=require(_0xe50a('0x8'));var client=jayson['client'][_0xe50a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5e1672,_0x109919,_0x29f574){return new BPromise(function(_0xf0f702,_0x25a2dc){return client[_0xe50a('0xa')](_0x5e1672,_0x29f574)['then'](function(_0x14336d){logger[_0xe50a('0xb')](_0xe50a('0xc'),_0x109919,'request\x20sent');logger['debug'](_0xe50a('0xd'),_0x109919,_0xe50a('0xe'),JSON[_0xe50a('0xf')](_0x14336d));if(_0x14336d[_0xe50a('0x10')]){if(_0x14336d[_0xe50a('0x10')][_0xe50a('0x11')]===0x1f4){logger[_0xe50a('0x10')](_0xe50a('0xc'),_0x109919,_0x14336d['error'][_0xe50a('0x12')]);return _0x25a2dc(_0x14336d[_0xe50a('0x10')][_0xe50a('0x12')]);}logger[_0xe50a('0x10')](_0xe50a('0xc'),_0x109919,_0x14336d[_0xe50a('0x10')][_0xe50a('0x12')]);return _0xf0f702(_0x14336d[_0xe50a('0x10')][_0xe50a('0x12')]);}else{logger[_0xe50a('0xb')]('ServicenowField,\x20%s,\x20%s',_0x109919,'request\x20sent');_0xf0f702(_0x14336d[_0xe50a('0x13')]['message']);}})[_0xe50a('0x14')](function(_0x599c3e){logger['error'](_0xe50a('0xc'),_0x109919,_0x599c3e);_0x25a2dc(_0x599c3e);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index aced03a..1a03fad 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 _0x86de=['Router','../../components/interaction/service','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','multer','util'];(function(_0x2397e2,_0x589f89){var _0x26a95d=function(_0x2db631){while(--_0x2db631){_0x2397e2['push'](_0x2397e2['shift']());}};_0x26a95d(++_0x589f89);}(_0x86de,0xe2));var _0xe86d=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x86de[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xe86d('0x0'));var util=require(_0xe86d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe86d('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe86d('0x3'));var config=require('../../config/environment');var controller=require('./intSugarcrmAccount.controller');router[_0xe86d('0x4')]('/',auth[_0xe86d('0x5')](),controller[_0xe86d('0x6')]);router[_0xe86d('0x4')](_0xe86d('0x7'),auth[_0xe86d('0x5')](),controller[_0xe86d('0x8')]);router[_0xe86d('0x4')](_0xe86d('0x9'),auth['isAuthenticated'](),controller[_0xe86d('0xa')]);router[_0xe86d('0x4')](_0xe86d('0xb'),auth[_0xe86d('0x5')](),controller[_0xe86d('0xc')]);router[_0xe86d('0xd')]('/',auth[_0xe86d('0x5')](),controller[_0xe86d('0xe')]);router['post'](_0xe86d('0x9'),auth['isAuthenticated'](),controller[_0xe86d('0xf')]);router[_0xe86d('0x10')](_0xe86d('0x7'),auth[_0xe86d('0x5')](),controller['update']);router[_0xe86d('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xe86d('0x12')]=router; \ No newline at end of file +var _0x7fc4=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','delete'];(function(_0x239c42,_0x15322e){var _0x3f06cb=function(_0x316a63){while(--_0x316a63){_0x239c42['push'](_0x239c42['shift']());}};_0x3f06cb(++_0x15322e);}(_0x7fc4,0xaa));var _0x47fc=function(_0x170cf8,_0x5507a6){_0x170cf8=_0x170cf8-0x0;var _0x2883d5=_0x7fc4[_0x170cf8];return _0x2883d5;};'use strict';var multer=require(_0x47fc('0x0'));var util=require(_0x47fc('0x1'));var path=require(_0x47fc('0x2'));var timeout=require(_0x47fc('0x3'));var express=require(_0x47fc('0x4'));var router=express[_0x47fc('0x5')]();var auth=require(_0x47fc('0x6'));var interaction=require(_0x47fc('0x7'));var config=require(_0x47fc('0x8'));var controller=require(_0x47fc('0x9'));router[_0x47fc('0xa')]('/',auth['isAuthenticated'](),controller[_0x47fc('0xb')]);router['get']('/:id',auth[_0x47fc('0xc')](),controller[_0x47fc('0xd')]);router[_0x47fc('0xa')](_0x47fc('0xe'),auth[_0x47fc('0xc')](),controller[_0x47fc('0xf')]);router[_0x47fc('0xa')](_0x47fc('0x10'),auth[_0x47fc('0xc')](),controller[_0x47fc('0x11')]);router[_0x47fc('0x12')]('/',auth['isAuthenticated'](),controller[_0x47fc('0x13')]);router[_0x47fc('0x12')](_0x47fc('0xe'),auth[_0x47fc('0xc')](),controller['addConfiguration']);router[_0x47fc('0x14')]('/:id',auth[_0x47fc('0xc')](),controller['update']);router[_0x47fc('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x47fc('0x16')]);module[_0x47fc('0x17')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 32f99e5..09a9b0e 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 _0xfaf3=['remoteUri','STRING','username'];(function(_0x39b2e9,_0x4747c9){var _0x3b4fd8=function(_0x55f522){while(--_0x55f522){_0x39b2e9['push'](_0x39b2e9['shift']());}};_0x3b4fd8(++_0x4747c9);}(_0xfaf3,0x118));var _0x3faf=function(_0x357a70,_0x46c340){_0x357a70=_0x357a70-0x0;var _0x5f57ea=_0xfaf3[_0x357a70];return _0x5f57ea;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3faf('0x0')]},'username':{'type':Sequelize['STRING'],'unique':_0x3faf('0x1')},'password':{'type':Sequelize[_0x3faf('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3faf('0x2')},'serverUrl':{'type':Sequelize[_0x3faf('0x0')]}}; \ No newline at end of file +var _0x68f8=['sequelize','exports','STRING','username'];(function(_0x2894b4,_0xcbe151){var _0x1ef5fd=function(_0x58aec9){while(--_0x58aec9){_0x2894b4['push'](_0x2894b4['shift']());}};_0x1ef5fd(++_0xcbe151);}(_0x68f8,0x10c));var _0x868f=function(_0xf99fc0,_0x3b8fa3){_0xf99fc0=_0xf99fc0-0x0;var _0x44bb24=_0x68f8[_0xf99fc0];return _0x44bb24;};'use strict';var Sequelize=require(_0x868f('0x0'));module[_0x868f('0x1')]={'name':{'type':Sequelize[_0x868f('0x2')]},'description':{'type':Sequelize[_0x868f('0x2')]},'username':{'type':Sequelize[_0x868f('0x2')],'unique':_0x868f('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x868f('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0x868f('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index 8889351..f534067 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 _0xddc1=['find','getConfigurations','findOne','SugarcrmConfiguration','order','sort','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','parent_name','password','slice','substring','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','username','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','Password\x20Expired','format','stringify','Calls','values','module_fields','remove','label','endsWith','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../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~!@#$%^&-_=+[{]}.','info','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','error','code','message','SugarcrmAccount,\x20%s,\x20%s','result','sendStatus','status','json','offset','limit','set','Content-Range','apply','update','then','destroy','end','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','catch','show','params','keys','create','body'];(function(_0x3899d1,_0x4aa04c){var _0xeb4a7d=function(_0x3ea5ee){while(--_0x3ea5ee){_0x3899d1['push'](_0x3899d1['shift']());}};_0xeb4a7d(++_0x4aa04c);}(_0xddc1,0x13e));var _0x1ddc=function(_0x22887c,_0x59e7df){_0x22887c=_0x22887c-0x0;var _0x4d3caa=_0xddc1[_0x22887c];return _0x4d3caa;};'use strict';var pdf=require(_0x1ddc('0x0'));var emlformat=require(_0x1ddc('0x1'));var rimraf=require(_0x1ddc('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1ddc('0x3'));var rp=require(_0x1ddc('0x4'));var moment=require(_0x1ddc('0x5'));var BPromise=require(_0x1ddc('0x6'));var Mustache=require(_0x1ddc('0x7'));var util=require(_0x1ddc('0x8'));var path=require(_0x1ddc('0x9'));var sox=require(_0x1ddc('0xa'));var csv=require('to-csv');var ejs=require(_0x1ddc('0xb'));var fs=require('fs');var _=require(_0x1ddc('0xc'));var squel=require(_0x1ddc('0xd'));var crypto=require(_0x1ddc('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1ddc('0xf'));var querystring=require(_0x1ddc('0x10'));var Papa=require(_0x1ddc('0x11'));var Redis=require(_0x1ddc('0x12'));var authService=require(_0x1ddc('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1ddc('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1ddc('0x15'))('api');var utils=require(_0x1ddc('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var integrations=require(_0x1ddc('0x17'));var jayson=require(_0x1ddc('0x18'));var client=jayson[_0x1ddc('0x19')][_0x1ddc('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x46f40f,_0x257082,_0x4e734e){if(_0x4e734e){var _0x885ec3=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x885ec3['test'](_0x257082)){return _0x46f40f;}else{throw new db[(_0x1ddc('0x1b'))][(_0x1ddc('0x1c'))](_0x1ddc('0x1d'));}}else{return _0x46f40f;}}function respondWithRpcPromise(_0x2780ae,_0x5504f8,_0x434361,_0x1af996){return new BPromise(function(_0x263bbd,_0x25b25a){var _0x55f165=_0x1af996||client;return _0x55f165['request'](_0x2780ae,_0x434361)['then'](function(_0x3cd136){logger[_0x1ddc('0x1e')]('SugarcrmAccount,\x20%s,\x20%s',_0x5504f8,_0x1ddc('0x1f'));logger[_0x1ddc('0x20')](_0x1ddc('0x21'),_0x5504f8,'request\x20sent',JSON['stringify'](_0x3cd136));if(_0x3cd136[_0x1ddc('0x22')]){if(_0x3cd136[_0x1ddc('0x22')][_0x1ddc('0x23')]===0x1f4){logger[_0x1ddc('0x22')]('SugarcrmAccount,\x20%s,\x20%s',_0x5504f8,_0x3cd136['error'][_0x1ddc('0x24')]);return _0x25b25a(_0x3cd136[_0x1ddc('0x22')]['message']);}logger['error'](_0x1ddc('0x25'),_0x5504f8,_0x3cd136[_0x1ddc('0x22')][_0x1ddc('0x24')]);return _0x263bbd(_0x3cd136['error'][_0x1ddc('0x24')]);}else{logger[_0x1ddc('0x1e')](_0x1ddc('0x25'),_0x5504f8,_0x1ddc('0x1f'));_0x263bbd(_0x3cd136[_0x1ddc('0x26')][_0x1ddc('0x24')]);}})['catch'](function(_0x151e72){logger[_0x1ddc('0x22')](_0x1ddc('0x25'),_0x5504f8,_0x151e72);_0x25b25a(_0x151e72);});});}function respondWithStatusCode(_0x42cded,_0xf24c1c){_0xf24c1c=_0xf24c1c||0xcc;return function(_0x4ffbd5){if(_0x4ffbd5){return _0x42cded[_0x1ddc('0x27')](_0xf24c1c);}return _0x42cded['status'](_0xf24c1c)['end']();};}function respondWithResult(_0x1b9439,_0x56de68){_0x56de68=_0x56de68||0xc8;return function(_0xa9b795){if(_0xa9b795){return _0x1b9439[_0x1ddc('0x28')](_0x56de68)[_0x1ddc('0x29')](_0xa9b795);}};}function respondWithFilteredResult(_0x14fb20,_0x4299dc){return function(_0x5af75f){if(_0x5af75f){var _0x1effc=_0x5af75f['count'],_0x10b63b=_0x4299dc[_0x1ddc('0x2a')],_0x485585=_0x4299dc[_0x1ddc('0x2a')]+_0x4299dc[_0x1ddc('0x2b')],_0x56f4bc;if(_0x485585>=_0x1effc){_0x485585=_0x1effc;_0x56f4bc=0xc8;}else{_0x56f4bc=0xce;}_0x14fb20[_0x1ddc('0x28')](_0x56f4bc);return _0x14fb20[_0x1ddc('0x2c')](_0x1ddc('0x2d'),_0x10b63b+'-'+_0x485585+'/'+_0x1effc)[_0x1ddc('0x29')](_0x5af75f);}return null;};}function patchUpdates(_0x20ca06){return function(_0x4a02d2){try{jsonpatch[_0x1ddc('0x2e')](_0x4a02d2,_0x20ca06,!![]);}catch(_0x5ae63a){return BPromise['reject'](_0x5ae63a);}return _0x4a02d2['save']();};}function saveUpdates(_0x550685,_0x2a9dd1){return function(_0x3fd29e){if(_0x3fd29e){return _0x3fd29e[_0x1ddc('0x2f')](_0x550685)[_0x1ddc('0x30')](function(_0x5c1381){return _0x5c1381;});}return null;};}function removeEntity(_0x233de7,_0x231416){return function(_0x556b18){if(_0x556b18){return _0x556b18[_0x1ddc('0x31')]()[_0x1ddc('0x30')](function(){_0x233de7['status'](0xcc)[_0x1ddc('0x32')]();});}};}function handleEntityNotFound(_0x1bf187,_0x311c38){return function(_0x1b18df){if(!_0x1b18df){_0x1bf187[_0x1ddc('0x27')](0x194);}return _0x1b18df;};}function handleError(_0x476af7,_0x4330b2){_0x4330b2=_0x4330b2||0x1f4;return function(_0x48f26a){logger[_0x1ddc('0x22')](_0x48f26a[_0x1ddc('0x33')]);if(_0x48f26a[_0x1ddc('0x34')]){delete _0x48f26a[_0x1ddc('0x34')];}_0x476af7[_0x1ddc('0x28')](_0x4330b2)[_0x1ddc('0x35')](_0x48f26a);};}exports['index']=function(_0x404c72,_0x3ca4a7){var _0x1cb89a={},_0x2d02fd={},_0x44ab29={'count':0x0,'rows':[]};var _0x1e1309=_[_0x1ddc('0x36')](db[_0x1ddc('0x37')][_0x1ddc('0x38')],function(_0x3c731c){return{'name':_0x3c731c[_0x1ddc('0x39')],'type':_0x3c731c[_0x1ddc('0x3a')][_0x1ddc('0x3b')]};});_0x2d02fd[_0x1ddc('0x3c')]=_['map'](_0x1e1309,'name');_0x2d02fd[_0x1ddc('0x3d')]=_['keys'](_0x404c72[_0x1ddc('0x3d')]);_0x2d02fd[_0x1ddc('0x3e')]=_[_0x1ddc('0x3f')](_0x2d02fd[_0x1ddc('0x3c')],_0x2d02fd[_0x1ddc('0x3d')]);_0x1cb89a[_0x1ddc('0x40')]=_[_0x1ddc('0x3f')](_0x2d02fd[_0x1ddc('0x3c')],qs[_0x1ddc('0x41')](_0x404c72[_0x1ddc('0x3d')][_0x1ddc('0x41')]));_0x1cb89a['attributes']=_0x1cb89a[_0x1ddc('0x40')][_0x1ddc('0x42')]?_0x1cb89a['attributes']:_0x2d02fd[_0x1ddc('0x3c')];if(!_0x404c72['query'][_0x1ddc('0x43')](_0x1ddc('0x44'))){_0x1cb89a[_0x1ddc('0x2b')]=qs[_0x1ddc('0x2b')](_0x404c72[_0x1ddc('0x3d')]['limit']);_0x1cb89a[_0x1ddc('0x2a')]=qs['offset'](_0x404c72[_0x1ddc('0x3d')][_0x1ddc('0x2a')]);}_0x1cb89a['order']=qs['sort'](_0x404c72[_0x1ddc('0x3d')]['sort']);_0x1cb89a[_0x1ddc('0x45')]=qs[_0x1ddc('0x3e')](_[_0x1ddc('0x46')](_0x404c72['query'],_0x2d02fd[_0x1ddc('0x3e')]));if(_0x404c72[_0x1ddc('0x3d')][_0x1ddc('0x47')]){_0x1cb89a[_0x1ddc('0x45')]=_[_0x1ddc('0x48')](_0x1cb89a[_0x1ddc('0x45')],{'$or':_['map'](_0x1e1309,function(_0x200567){if(_0x200567[_0x1ddc('0x3a')]!==_0x1ddc('0x49')){var _0x5016a9={};_0x5016a9[_0x200567['name']]={'$like':'%'+_0x404c72[_0x1ddc('0x3d')][_0x1ddc('0x47')]+'%'};return _0x5016a9;}})});}_0x1cb89a=_['merge']({},_0x1cb89a,_0x404c72[_0x1ddc('0x4a')]);var _0x106f62={'where':_0x1cb89a[_0x1ddc('0x45')]};return db[_0x1ddc('0x37')][_0x1ddc('0x4b')](_0x106f62)[_0x1ddc('0x30')](function(_0x25c937){_0x44ab29[_0x1ddc('0x4b')]=_0x25c937;if(_0x404c72[_0x1ddc('0x3d')][_0x1ddc('0x4c')]){_0x1cb89a[_0x1ddc('0x4d')]=[{'all':!![]}];}return db[_0x1ddc('0x37')]['findAll'](_0x1cb89a);})[_0x1ddc('0x30')](function(_0x498e4b){_0x44ab29['rows']=_0x498e4b;return _0x44ab29;})['then'](respondWithFilteredResult(_0x3ca4a7,_0x1cb89a))[_0x1ddc('0x4e')](handleError(_0x3ca4a7,null));};exports[_0x1ddc('0x4f')]=function(_0x4658ca,_0x1a8ed3){var _0x162e2d={'raw':![],'where':{'id':_0x4658ca[_0x1ddc('0x50')]['id']}},_0x4cee06={};_0x4cee06[_0x1ddc('0x3c')]=_[_0x1ddc('0x51')](db[_0x1ddc('0x37')][_0x1ddc('0x38')]);_0x4cee06[_0x1ddc('0x3d')]=_[_0x1ddc('0x51')](_0x4658ca['query']);_0x4cee06[_0x1ddc('0x3e')]=_[_0x1ddc('0x3f')](_0x4cee06['model'],_0x4cee06[_0x1ddc('0x3d')]);_0x162e2d[_0x1ddc('0x40')]=_[_0x1ddc('0x3f')](_0x4cee06[_0x1ddc('0x3c')],qs[_0x1ddc('0x41')](_0x4658ca[_0x1ddc('0x3d')][_0x1ddc('0x41')]));_0x162e2d[_0x1ddc('0x40')]=_0x162e2d[_0x1ddc('0x40')][_0x1ddc('0x42')]?_0x162e2d['attributes']:_0x4cee06[_0x1ddc('0x3c')];if(_0x4658ca[_0x1ddc('0x3d')][_0x1ddc('0x4c')]){_0x162e2d['include']=[{'all':!![]}];}_0x162e2d=_[_0x1ddc('0x48')]({},_0x162e2d,_0x4658ca[_0x1ddc('0x4a')]);return db[_0x1ddc('0x37')]['find'](_0x162e2d)[_0x1ddc('0x30')](handleEntityNotFound(_0x1a8ed3,null))['then'](respondWithResult(_0x1a8ed3,null))[_0x1ddc('0x4e')](handleError(_0x1a8ed3,null));};exports['create']=function(_0x2e8a33,_0x2358f6){return db[_0x1ddc('0x37')][_0x1ddc('0x52')](_0x2e8a33[_0x1ddc('0x53')],{})['then'](respondWithResult(_0x2358f6,0xc9))[_0x1ddc('0x4e')](handleError(_0x2358f6,null));};exports[_0x1ddc('0x2f')]=function(_0x4c55f2,_0x4c4daf){if(_0x4c55f2[_0x1ddc('0x53')]['id']){delete _0x4c55f2[_0x1ddc('0x53')]['id'];}return db[_0x1ddc('0x37')]['find']({'where':{'id':_0x4c55f2[_0x1ddc('0x50')]['id']}})[_0x1ddc('0x30')](handleEntityNotFound(_0x4c4daf,null))['then'](saveUpdates(_0x4c55f2[_0x1ddc('0x53')],null))['then'](respondWithResult(_0x4c4daf,null))[_0x1ddc('0x4e')](handleError(_0x4c4daf,null));};exports[_0x1ddc('0x31')]=function(_0x26f4cd,_0x30b0d0){return db[_0x1ddc('0x37')][_0x1ddc('0x54')]({'where':{'id':_0x26f4cd[_0x1ddc('0x50')]['id']}})[_0x1ddc('0x30')](handleEntityNotFound(_0x30b0d0,null))['then'](removeEntity(_0x30b0d0,null))['catch'](handleError(_0x30b0d0,null));};exports[_0x1ddc('0x55')]=function(_0x1cbca1,_0x37a4b4,_0x527976){var _0x400db5={};var _0x22cf7c={};var _0x25ef64;var _0x25cca3;return db[_0x1ddc('0x37')][_0x1ddc('0x56')]({'where':{'id':_0x1cbca1[_0x1ddc('0x50')]['id']}})[_0x1ddc('0x30')](handleEntityNotFound(_0x37a4b4,null))[_0x1ddc('0x30')](function(_0x5ac651){if(_0x5ac651){_0x25ef64=_0x5ac651;_0x22cf7c['model']=_[_0x1ddc('0x51')](db[_0x1ddc('0x57')][_0x1ddc('0x38')]);_0x22cf7c['query']=_[_0x1ddc('0x51')](_0x1cbca1[_0x1ddc('0x3d')]);_0x22cf7c[_0x1ddc('0x3e')]=_[_0x1ddc('0x3f')](_0x22cf7c[_0x1ddc('0x3c')],_0x22cf7c[_0x1ddc('0x3d')]);_0x400db5[_0x1ddc('0x40')]=_[_0x1ddc('0x3f')](_0x22cf7c[_0x1ddc('0x3c')],qs[_0x1ddc('0x41')](_0x1cbca1[_0x1ddc('0x3d')][_0x1ddc('0x41')]));_0x400db5[_0x1ddc('0x40')]=_0x400db5[_0x1ddc('0x40')][_0x1ddc('0x42')]?_0x400db5[_0x1ddc('0x40')]:_0x22cf7c[_0x1ddc('0x3c')];_0x400db5[_0x1ddc('0x58')]=qs[_0x1ddc('0x59')](_0x1cbca1[_0x1ddc('0x3d')][_0x1ddc('0x59')]);_0x400db5[_0x1ddc('0x45')]=qs[_0x1ddc('0x3e')](_[_0x1ddc('0x46')](_0x1cbca1[_0x1ddc('0x3d')],_0x22cf7c[_0x1ddc('0x3e')]));if(_0x1cbca1[_0x1ddc('0x3d')]['filter']){_0x400db5[_0x1ddc('0x45')]=_['merge'](_0x400db5[_0x1ddc('0x45')],{'$or':_[_0x1ddc('0x36')](_0x400db5[_0x1ddc('0x40')],function(_0x4ae1a0){var _0x4cbbf9={};_0x4cbbf9[_0x4ae1a0]={'$like':'%'+_0x1cbca1[_0x1ddc('0x3d')][_0x1ddc('0x47')]+'%'};return _0x4cbbf9;})});}_0x400db5=_[_0x1ddc('0x48')]({},_0x400db5,_0x1cbca1[_0x1ddc('0x4a')]);return _0x25ef64[_0x1ddc('0x55')](_0x400db5);}})[_0x1ddc('0x30')](function(_0x2bba62){if(_0x2bba62){_0x25cca3=_0x2bba62['length'];if(!_0x1cbca1['query'][_0x1ddc('0x43')](_0x1ddc('0x44'))){_0x400db5[_0x1ddc('0x2b')]=qs[_0x1ddc('0x2b')](_0x1cbca1[_0x1ddc('0x3d')][_0x1ddc('0x2b')]);_0x400db5[_0x1ddc('0x2a')]=qs[_0x1ddc('0x2a')](_0x1cbca1[_0x1ddc('0x3d')][_0x1ddc('0x2a')]);}return _0x25ef64[_0x1ddc('0x55')](_0x400db5);}})[_0x1ddc('0x30')](function(_0x5ad1d5){if(_0x5ad1d5){return _0x5ad1d5?{'count':_0x25cca3,'rows':_0x5ad1d5}:null;}})[_0x1ddc('0x30')](respondWithResult(_0x37a4b4,null))['catch'](handleError(_0x37a4b4,null));};exports[_0x1ddc('0x5a')]=function(_0x4024b9,_0xc39e07,_0x1aa910){if(_0x4024b9['body']['id']){delete _0x4024b9[_0x1ddc('0x53')]['id'];}return db[_0x1ddc('0x37')][_0x1ddc('0x56')]({'where':{'id':_0x4024b9[_0x1ddc('0x50')]['id']}})[_0x1ddc('0x30')](handleEntityNotFound(_0xc39e07,null))[_0x1ddc('0x30')](function(_0x5162e6){if(_0x5162e6){_0x4024b9['body'][_0x1ddc('0x5b')]=_0x5162e6['id'];_0x4024b9[_0x1ddc('0x53')][_0x1ddc('0x5c')]=integrations[_0x1ddc('0x5d')](_0x4024b9['body'][_0x1ddc('0x5e')],_0x4024b9['body'][_0x1ddc('0x3a')]);_0x4024b9[_0x1ddc('0x53')]['Descriptions']=integrations[_0x1ddc('0x5f')](_0x4024b9[_0x1ddc('0x53')][_0x1ddc('0x5e')],_0x4024b9[_0x1ddc('0x53')]['type']);return db[_0x1ddc('0x57')][_0x1ddc('0x52')](_0x4024b9[_0x1ddc('0x53')],{'include':[{'model':db[_0x1ddc('0x60')],'as':_0x1ddc('0x5c')},{'model':db[_0x1ddc('0x60')],'as':_0x1ddc('0x61')}]});}return null;})[_0x1ddc('0x30')](respondWithResult(_0xc39e07,null))[_0x1ddc('0x4e')](handleError(_0xc39e07,null));};exports[_0x1ddc('0x62')]=function(_0x54bb0d,_0x48e802,_0x1ccd9b){var _0x51cbc9='';var _0x5c4212=['id','name',_0x1ddc('0x63'),_0x1ddc('0x64'),_0x1ddc('0x65'),_0x1ddc('0x66'),_0x1ddc('0x67'),_0x1ddc('0x68'),_0x1ddc('0x69'),_0x1ddc('0x6a'),_0x1ddc('0x6b'),'direction'];return db[_0x1ddc('0x37')]['findOne']({'where':{'id':_0x54bb0d[_0x1ddc('0x50')]['id']},'attributes':['id','username',_0x1ddc('0x6c'),'remoteUri']})[_0x1ddc('0x30')](handleEntityNotFound(_0x48e802,null))[_0x1ddc('0x30')](function(_0x2257f6){if(_0x2257f6){_0x51cbc9=_0x2257f6['remoteUri'];var _0x5be1b2=_0x51cbc9[_0x1ddc('0x6d')](-0x1);if(_0x5be1b2==='/'){_0x51cbc9=_0x51cbc9[_0x1ddc('0x6e')](0x0,_0x51cbc9[_0x1ddc('0x6f')](_0x5be1b2));}return rp({'method':_0x1ddc('0x70'),'uri':util['format'](_0x1ddc('0x71'),_0x51cbc9,_0x1ddc('0x72')),'json':!![],'form':{'method':'login','input_type':_0x1ddc('0x73'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x2257f6[_0x1ddc('0x74')],'password':_0x2257f6[_0x1ddc('0x6c')],'encryption':_0x1ddc('0x75')},'application':_0x1ddc('0x76')})}});}})['then'](function(_0x4817e1){if(_0x4817e1&&_0x4817e1[_0x1ddc('0x34')]!==_0x1ddc('0x77')&&_0x4817e1[_0x1ddc('0x34')]!==_0x1ddc('0x78')){return rp({'method':_0x1ddc('0x70'),'uri':util[_0x1ddc('0x79')]('%s%s',_0x51cbc9,_0x1ddc('0x72')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x1ddc('0x7a')]({'session':_0x4817e1['id'],'module_name':_0x1ddc('0x7b')})}})['then'](function(_0xb70fb){if(_0xb70fb){var _0x507c7f=_[_0x1ddc('0x7c')](_0xb70fb[_0x1ddc('0x7d')]);_[_0x1ddc('0x7e')](_0x507c7f,function(_0x5bb20c){return _0x5c4212['includes'](_0x5bb20c[_0x1ddc('0x34')]);});return{'count':_0x507c7f[_0x1ddc('0x42')],'rows':_[_0x1ddc('0x36')](_0x507c7f,function(_0x57e5a6){return{'id':_0x57e5a6[_0x1ddc('0x34')],'name':_0x57e5a6[_0x1ddc('0x7f')],'custom':_[_0x1ddc('0x80')](_0x57e5a6[_0x1ddc('0x34')],'_c')?!![]:![],'options':_0x57e5a6[_0x1ddc('0x4a')]?_[_0x1ddc('0x36')](_[_0x1ddc('0x7c')](_0x57e5a6[_0x1ddc('0x4a')]),function(_0x1eec5f){return{'name':_0x1eec5f[_0x1ddc('0x81')],'value':_0x1eec5f[_0x1ddc('0x34')]};}):[]};})};}})['then'](respondWithResult(_0x48e802,null))[_0x1ddc('0x4e')](function(_0x21d613){var _0x4d65ea=_0x54bb0d[_0x1ddc('0x3d')][_0x1ddc('0x82')]?0x1f4:_0x21d613[_0x1ddc('0x83')]||0x1f4;logger[_0x1ddc('0x22')](_0x1ddc('0x84'),_0x1ddc('0x62'),_0x4d65ea,JSON['stringify'](_0x21d613));delete _0x21d613[_0x1ddc('0x34')];if(_0x4d65ea===0x191){_0x4d65ea=0x190;}_0x48e802[_0x1ddc('0x28')](_0x4d65ea)['send'](_0x54bb0d[_0x1ddc('0x3d')][_0x1ddc('0x82')]?{'message':'Wrong\x20credentials','statusCode':_0x21d613[_0x1ddc('0x83')]}:_0x21d613);});}else{var _0x6bbdf6=0x1f4;_0x48e802[_0x1ddc('0x28')](_0x6bbdf6)[_0x1ddc('0x35')]({'message':_0x1ddc('0x85'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x0fb4=['Invalid\x20Login','Password\x20Expired','format','values','module_fields','remove','label','endsWith','value','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','stack','name','send','map','SugarcrmAccount','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','create','body','update','findOne','SugarcrmConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','SugarcrmField','getFields','created_by','description','date_start','duration_hours','parent_type','parent_name','username','password','remoteUri','slice','lastIndexOf','POST','%s%s','/service/v4_1/rest.php','JSON','PLAIN','xCALLY\x20Motion\x20Integration'];(function(_0x24310a,_0x22f59f){var _0x34fe89=function(_0x4a26c2){while(--_0x4a26c2){_0x24310a['push'](_0x24310a['shift']());}};_0x34fe89(++_0x22f59f);}(_0x0fb4,0x10e));var _0x40fb=function(_0x3ee1fe,_0x59f2a1){_0x3ee1fe=_0x3ee1fe-0x0;var _0x1ae57a=_0x0fb4[_0x3ee1fe];return _0x1ae57a;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x40fb('0x0'));var zipdir=require(_0x40fb('0x1'));var jsonpatch=require(_0x40fb('0x2'));var rp=require(_0x40fb('0x3'));var moment=require(_0x40fb('0x4'));var BPromise=require(_0x40fb('0x5'));var Mustache=require(_0x40fb('0x6'));var util=require('util');var path=require(_0x40fb('0x7'));var sox=require(_0x40fb('0x8'));var csv=require(_0x40fb('0x9'));var ejs=require(_0x40fb('0xa'));var fs=require('fs');var _=require(_0x40fb('0xb'));var squel=require('squel');var crypto=require(_0x40fb('0xc'));var jsforce=require(_0x40fb('0xd'));var deskjs=require(_0x40fb('0xe'));var toCsv=require(_0x40fb('0x9'));var querystring=require(_0x40fb('0xf'));var Papa=require('papaparse');var Redis=require(_0x40fb('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x40fb('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40fb('0x12'));var logger=require(_0x40fb('0x13'))(_0x40fb('0x14'));var utils=require(_0x40fb('0x15'));var config=require(_0x40fb('0x16'));var db=require(_0x40fb('0x17'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x40fb('0x18'));var client=jayson[_0x40fb('0x19')][_0x40fb('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2b3ed6,_0x17b43b,_0x2d39b5){if(_0x2d39b5){var _0x5b66c5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b66c5[_0x40fb('0x1b')](_0x17b43b)){return _0x2b3ed6;}else{throw new db[(_0x40fb('0x1c'))][(_0x40fb('0x1d'))](_0x40fb('0x1e'));}}else{return _0x2b3ed6;}}function respondWithRpcPromise(_0x327c5c,_0x437246,_0x4f5d29,_0x17d761){return new BPromise(function(_0xc9fda3,_0x430b92){var _0x46b538=_0x17d761||client;return _0x46b538[_0x40fb('0x1f')](_0x327c5c,_0x4f5d29)[_0x40fb('0x20')](function(_0x28c6ee){logger['info'](_0x40fb('0x21'),_0x437246,_0x40fb('0x22'));logger[_0x40fb('0x23')](_0x40fb('0x24'),_0x437246,_0x40fb('0x22'),JSON[_0x40fb('0x25')](_0x28c6ee));if(_0x28c6ee['error']){if(_0x28c6ee[_0x40fb('0x26')][_0x40fb('0x27')]===0x1f4){logger[_0x40fb('0x26')]('SugarcrmAccount,\x20%s,\x20%s',_0x437246,_0x28c6ee['error'][_0x40fb('0x28')]);return _0x430b92(_0x28c6ee['error'][_0x40fb('0x28')]);}logger['error'](_0x40fb('0x21'),_0x437246,_0x28c6ee[_0x40fb('0x26')][_0x40fb('0x28')]);return _0xc9fda3(_0x28c6ee['error'][_0x40fb('0x28')]);}else{logger[_0x40fb('0x29')](_0x40fb('0x21'),_0x437246,_0x40fb('0x22'));_0xc9fda3(_0x28c6ee['result']['message']);}})[_0x40fb('0x2a')](function(_0x26305b){logger['error'](_0x40fb('0x21'),_0x437246,_0x26305b);_0x430b92(_0x26305b);});});}function respondWithStatusCode(_0x3b919a,_0x5a6eaa){_0x5a6eaa=_0x5a6eaa||0xcc;return function(_0x1e1a97){if(_0x1e1a97){return _0x3b919a[_0x40fb('0x2b')](_0x5a6eaa);}return _0x3b919a[_0x40fb('0x2c')](_0x5a6eaa)[_0x40fb('0x2d')]();};}function respondWithResult(_0x3752e0,_0x1af886){_0x1af886=_0x1af886||0xc8;return function(_0x5b2888){if(_0x5b2888){return _0x3752e0[_0x40fb('0x2c')](_0x1af886)[_0x40fb('0x2e')](_0x5b2888);}};}function respondWithFilteredResult(_0x1db1cc,_0x6ff5cf){return function(_0x2ce7b1){if(_0x2ce7b1){var _0x3d1056=_0x2ce7b1[_0x40fb('0x2f')],_0x7e01a7=_0x6ff5cf[_0x40fb('0x30')],_0x3cf0be=_0x6ff5cf[_0x40fb('0x30')]+_0x6ff5cf[_0x40fb('0x31')],_0xa52162;if(_0x3cf0be>=_0x3d1056){_0x3cf0be=_0x3d1056;_0xa52162=0xc8;}else{_0xa52162=0xce;}_0x1db1cc[_0x40fb('0x2c')](_0xa52162);return _0x1db1cc[_0x40fb('0x32')]('Content-Range',_0x7e01a7+'-'+_0x3cf0be+'/'+_0x3d1056)[_0x40fb('0x2e')](_0x2ce7b1);}return null;};}function patchUpdates(_0xba4140){return function(_0x4fd20c){try{jsonpatch[_0x40fb('0x33')](_0x4fd20c,_0xba4140,!![]);}catch(_0x2a7a67){return BPromise[_0x40fb('0x34')](_0x2a7a67);}return _0x4fd20c[_0x40fb('0x35')]();};}function saveUpdates(_0x5e296e,_0x538281){return function(_0x27c30f){if(_0x27c30f){return _0x27c30f['update'](_0x5e296e)['then'](function(_0x1831f6){return _0x1831f6;});}return null;};}function removeEntity(_0x1ae514,_0x3dd1b0){return function(_0x508ce4){if(_0x508ce4){return _0x508ce4['destroy']()['then'](function(){_0x1ae514[_0x40fb('0x2c')](0xcc)[_0x40fb('0x2d')]();});}};}function handleEntityNotFound(_0x4036c8,_0x3fac18){return function(_0x573eaf){if(!_0x573eaf){_0x4036c8[_0x40fb('0x2b')](0x194);}return _0x573eaf;};}function handleError(_0x41d71a,_0x30dc2b){_0x30dc2b=_0x30dc2b||0x1f4;return function(_0x52a0e2){logger['error'](_0x52a0e2[_0x40fb('0x36')]);if(_0x52a0e2[_0x40fb('0x37')]){delete _0x52a0e2[_0x40fb('0x37')];}_0x41d71a['status'](_0x30dc2b)[_0x40fb('0x38')](_0x52a0e2);};}exports['index']=function(_0xea5536,_0x583886){var _0x22e3df={},_0x12456a={},_0x3c6f7c={'count':0x0,'rows':[]};var _0x4e58f1=_[_0x40fb('0x39')](db[_0x40fb('0x3a')][_0x40fb('0x3b')],function(_0x5ac6c8){return{'name':_0x5ac6c8[_0x40fb('0x3c')],'type':_0x5ac6c8[_0x40fb('0x3d')][_0x40fb('0x3e')]};});_0x12456a[_0x40fb('0x3f')]=_[_0x40fb('0x39')](_0x4e58f1,_0x40fb('0x37'));_0x12456a[_0x40fb('0x40')]=_['keys'](_0xea5536['query']);_0x12456a[_0x40fb('0x41')]=_['intersection'](_0x12456a[_0x40fb('0x3f')],_0x12456a[_0x40fb('0x40')]);_0x22e3df[_0x40fb('0x42')]=_[_0x40fb('0x43')](_0x12456a[_0x40fb('0x3f')],qs[_0x40fb('0x44')](_0xea5536[_0x40fb('0x40')]['fields']));_0x22e3df['attributes']=_0x22e3df[_0x40fb('0x42')][_0x40fb('0x45')]?_0x22e3df[_0x40fb('0x42')]:_0x12456a[_0x40fb('0x3f')];if(!_0xea5536['query'][_0x40fb('0x46')](_0x40fb('0x47'))){_0x22e3df[_0x40fb('0x31')]=qs['limit'](_0xea5536['query'][_0x40fb('0x31')]);_0x22e3df[_0x40fb('0x30')]=qs[_0x40fb('0x30')](_0xea5536[_0x40fb('0x40')][_0x40fb('0x30')]);}_0x22e3df[_0x40fb('0x48')]=qs['sort'](_0xea5536[_0x40fb('0x40')][_0x40fb('0x49')]);_0x22e3df[_0x40fb('0x4a')]=qs['filters'](_[_0x40fb('0x4b')](_0xea5536['query'],_0x12456a[_0x40fb('0x41')]));if(_0xea5536[_0x40fb('0x40')][_0x40fb('0x4c')]){_0x22e3df[_0x40fb('0x4a')]=_[_0x40fb('0x4d')](_0x22e3df['where'],{'$or':_[_0x40fb('0x39')](_0x4e58f1,function(_0x2c0ed2){if(_0x2c0ed2[_0x40fb('0x3d')]!==_0x40fb('0x4e')){var _0x5c853f={};_0x5c853f[_0x2c0ed2['name']]={'$like':'%'+_0xea5536['query'][_0x40fb('0x4c')]+'%'};return _0x5c853f;}})});}_0x22e3df=_[_0x40fb('0x4d')]({},_0x22e3df,_0xea5536[_0x40fb('0x4f')]);var _0x50dc47={'where':_0x22e3df[_0x40fb('0x4a')]};return db[_0x40fb('0x3a')][_0x40fb('0x2f')](_0x50dc47)[_0x40fb('0x20')](function(_0x839202){_0x3c6f7c['count']=_0x839202;if(_0xea5536['query'][_0x40fb('0x50')]){_0x22e3df[_0x40fb('0x51')]=[{'all':!![]}];}return db[_0x40fb('0x3a')][_0x40fb('0x52')](_0x22e3df);})['then'](function(_0x49c380){_0x3c6f7c[_0x40fb('0x53')]=_0x49c380;return _0x3c6f7c;})[_0x40fb('0x20')](respondWithFilteredResult(_0x583886,_0x22e3df))[_0x40fb('0x2a')](handleError(_0x583886,null));};exports[_0x40fb('0x54')]=function(_0x4df119,_0x4bbebd){var _0x5868f3={'raw':![],'where':{'id':_0x4df119[_0x40fb('0x55')]['id']}},_0x15ea74={};_0x15ea74['model']=_[_0x40fb('0x56')](db[_0x40fb('0x3a')][_0x40fb('0x3b')]);_0x15ea74[_0x40fb('0x40')]=_[_0x40fb('0x56')](_0x4df119['query']);_0x15ea74['filters']=_[_0x40fb('0x43')](_0x15ea74[_0x40fb('0x3f')],_0x15ea74['query']);_0x5868f3['attributes']=_['intersection'](_0x15ea74[_0x40fb('0x3f')],qs[_0x40fb('0x44')](_0x4df119[_0x40fb('0x40')][_0x40fb('0x44')]));_0x5868f3['attributes']=_0x5868f3[_0x40fb('0x42')][_0x40fb('0x45')]?_0x5868f3['attributes']:_0x15ea74['model'];if(_0x4df119['query']['includeAll']){_0x5868f3[_0x40fb('0x51')]=[{'all':!![]}];}_0x5868f3=_[_0x40fb('0x4d')]({},_0x5868f3,_0x4df119[_0x40fb('0x4f')]);return db[_0x40fb('0x3a')][_0x40fb('0x57')](_0x5868f3)['then'](handleEntityNotFound(_0x4bbebd,null))['then'](respondWithResult(_0x4bbebd,null))[_0x40fb('0x2a')](handleError(_0x4bbebd,null));};exports[_0x40fb('0x58')]=function(_0xebc6a4,_0x37c6cd){return db[_0x40fb('0x3a')][_0x40fb('0x58')](_0xebc6a4[_0x40fb('0x59')],{})[_0x40fb('0x20')](respondWithResult(_0x37c6cd,0xc9))['catch'](handleError(_0x37c6cd,null));};exports[_0x40fb('0x5a')]=function(_0x115fb9,_0x508eee){if(_0x115fb9[_0x40fb('0x59')]['id']){delete _0x115fb9[_0x40fb('0x59')]['id'];}return db[_0x40fb('0x3a')][_0x40fb('0x57')]({'where':{'id':_0x115fb9[_0x40fb('0x55')]['id']}})[_0x40fb('0x20')](handleEntityNotFound(_0x508eee,null))[_0x40fb('0x20')](saveUpdates(_0x115fb9[_0x40fb('0x59')],null))['then'](respondWithResult(_0x508eee,null))[_0x40fb('0x2a')](handleError(_0x508eee,null));};exports['destroy']=function(_0x3b4eaa,_0x4f5f08){return db[_0x40fb('0x3a')][_0x40fb('0x57')]({'where':{'id':_0x3b4eaa[_0x40fb('0x55')]['id']}})['then'](handleEntityNotFound(_0x4f5f08,null))[_0x40fb('0x20')](removeEntity(_0x4f5f08,null))[_0x40fb('0x2a')](handleError(_0x4f5f08,null));};exports['getConfigurations']=function(_0x3dac00,_0x4a9aac,_0xc12e34){var _0x53096d={};var _0x1130f2={};var _0x46adc9;var _0x40fdb5;return db[_0x40fb('0x3a')][_0x40fb('0x5b')]({'where':{'id':_0x3dac00[_0x40fb('0x55')]['id']}})[_0x40fb('0x20')](handleEntityNotFound(_0x4a9aac,null))[_0x40fb('0x20')](function(_0x2c6009){if(_0x2c6009){_0x46adc9=_0x2c6009;_0x1130f2[_0x40fb('0x3f')]=_[_0x40fb('0x56')](db[_0x40fb('0x5c')][_0x40fb('0x3b')]);_0x1130f2[_0x40fb('0x40')]=_[_0x40fb('0x56')](_0x3dac00[_0x40fb('0x40')]);_0x1130f2[_0x40fb('0x41')]=_[_0x40fb('0x43')](_0x1130f2[_0x40fb('0x3f')],_0x1130f2[_0x40fb('0x40')]);_0x53096d[_0x40fb('0x42')]=_[_0x40fb('0x43')](_0x1130f2[_0x40fb('0x3f')],qs[_0x40fb('0x44')](_0x3dac00[_0x40fb('0x40')]['fields']));_0x53096d[_0x40fb('0x42')]=_0x53096d[_0x40fb('0x42')]['length']?_0x53096d[_0x40fb('0x42')]:_0x1130f2[_0x40fb('0x3f')];_0x53096d[_0x40fb('0x48')]=qs['sort'](_0x3dac00[_0x40fb('0x40')][_0x40fb('0x49')]);_0x53096d[_0x40fb('0x4a')]=qs['filters'](_[_0x40fb('0x4b')](_0x3dac00['query'],_0x1130f2[_0x40fb('0x41')]));if(_0x3dac00[_0x40fb('0x40')][_0x40fb('0x4c')]){_0x53096d[_0x40fb('0x4a')]=_[_0x40fb('0x4d')](_0x53096d['where'],{'$or':_[_0x40fb('0x39')](_0x53096d[_0x40fb('0x42')],function(_0x57641d){var _0x5b00a1={};_0x5b00a1[_0x57641d]={'$like':'%'+_0x3dac00[_0x40fb('0x40')][_0x40fb('0x4c')]+'%'};return _0x5b00a1;})});}_0x53096d=_[_0x40fb('0x4d')]({},_0x53096d,_0x3dac00['options']);return _0x46adc9['getConfigurations'](_0x53096d);}})['then'](function(_0x285057){if(_0x285057){_0x40fdb5=_0x285057[_0x40fb('0x45')];if(!_0x3dac00[_0x40fb('0x40')][_0x40fb('0x46')](_0x40fb('0x47'))){_0x53096d[_0x40fb('0x31')]=qs['limit'](_0x3dac00[_0x40fb('0x40')][_0x40fb('0x31')]);_0x53096d[_0x40fb('0x30')]=qs[_0x40fb('0x30')](_0x3dac00[_0x40fb('0x40')][_0x40fb('0x30')]);}return _0x46adc9['getConfigurations'](_0x53096d);}})[_0x40fb('0x20')](function(_0x1c4f75){if(_0x1c4f75){return _0x1c4f75?{'count':_0x40fdb5,'rows':_0x1c4f75}:null;}})[_0x40fb('0x20')](respondWithResult(_0x4a9aac,null))[_0x40fb('0x2a')](handleError(_0x4a9aac,null));};exports['addConfiguration']=function(_0x25a4e0,_0x47bf0b,_0x5a4a17){if(_0x25a4e0['body']['id']){delete _0x25a4e0[_0x40fb('0x59')]['id'];}return db[_0x40fb('0x3a')][_0x40fb('0x5b')]({'where':{'id':_0x25a4e0[_0x40fb('0x55')]['id']}})[_0x40fb('0x20')](handleEntityNotFound(_0x47bf0b,null))['then'](function(_0x20091d){if(_0x20091d){_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x5d')]=_0x20091d['id'];_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x5e')]=integrations[_0x40fb('0x5f')](_0x25a4e0['body']['channel'],_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x3d')]);_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x60')]=integrations['getDescriptions'](_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x61')],_0x25a4e0[_0x40fb('0x59')][_0x40fb('0x3d')]);return db[_0x40fb('0x5c')][_0x40fb('0x58')](_0x25a4e0[_0x40fb('0x59')],{'include':[{'model':db['SugarcrmField'],'as':'Subjects'},{'model':db[_0x40fb('0x62')],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x47bf0b,null))[_0x40fb('0x2a')](handleError(_0x47bf0b,null));};exports[_0x40fb('0x63')]=function(_0x361277,_0x2c72fe,_0x37b81a){var _0x33bdd9='';var _0x56c87b=['id',_0x40fb('0x37'),'assigned_user_id',_0x40fb('0x64'),_0x40fb('0x65'),_0x40fb('0x66'),_0x40fb('0x67'),'duration_minutes','parent_id',_0x40fb('0x68'),_0x40fb('0x69'),'direction'];return db[_0x40fb('0x3a')][_0x40fb('0x5b')]({'where':{'id':_0x361277[_0x40fb('0x55')]['id']},'attributes':['id',_0x40fb('0x6a'),_0x40fb('0x6b'),'remoteUri']})[_0x40fb('0x20')](handleEntityNotFound(_0x2c72fe,null))[_0x40fb('0x20')](function(_0x4f2bee){if(_0x4f2bee){_0x33bdd9=_0x4f2bee[_0x40fb('0x6c')];var _0x5b4837=_0x33bdd9[_0x40fb('0x6d')](-0x1);if(_0x5b4837==='/'){_0x33bdd9=_0x33bdd9['substring'](0x0,_0x33bdd9[_0x40fb('0x6e')](_0x5b4837));}return rp({'method':_0x40fb('0x6f'),'uri':util['format'](_0x40fb('0x70'),_0x33bdd9,_0x40fb('0x71')),'json':!![],'form':{'method':'login','input_type':_0x40fb('0x72'),'response_type':'JSON','rest_data':JSON[_0x40fb('0x25')]({'user_auth':{'user_name':_0x4f2bee[_0x40fb('0x6a')],'password':_0x4f2bee[_0x40fb('0x6b')],'encryption':_0x40fb('0x73')},'application':_0x40fb('0x74')})}});}})[_0x40fb('0x20')](function(_0x4c25ba){if(_0x4c25ba&&_0x4c25ba[_0x40fb('0x37')]!==_0x40fb('0x75')&&_0x4c25ba[_0x40fb('0x37')]!==_0x40fb('0x76')){return rp({'method':_0x40fb('0x6f'),'uri':util[_0x40fb('0x77')](_0x40fb('0x70'),_0x33bdd9,_0x40fb('0x71')),'json':!![],'form':{'method':'get_module_fields','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x40fb('0x25')]({'session':_0x4c25ba['id'],'module_name':'Calls'})}})[_0x40fb('0x20')](function(_0xe3ed67){if(_0xe3ed67){var _0x34eeaf=_[_0x40fb('0x78')](_0xe3ed67[_0x40fb('0x79')]);_[_0x40fb('0x7a')](_0x34eeaf,function(_0x434962){return _0x56c87b['includes'](_0x434962[_0x40fb('0x37')]);});return{'count':_0x34eeaf[_0x40fb('0x45')],'rows':_[_0x40fb('0x39')](_0x34eeaf,function(_0x1dafef){return{'id':_0x1dafef[_0x40fb('0x37')],'name':_0x1dafef[_0x40fb('0x7b')],'custom':_[_0x40fb('0x7c')](_0x1dafef[_0x40fb('0x37')],'_c')?!![]:![],'options':_0x1dafef['options']?_['map'](_[_0x40fb('0x78')](_0x1dafef[_0x40fb('0x4f')]),function(_0x40a96f){return{'name':_0x40a96f[_0x40fb('0x7d')],'value':_0x40a96f[_0x40fb('0x37')]};}):[]};})};}})[_0x40fb('0x20')](respondWithResult(_0x2c72fe,null))['catch'](function(_0x1b9294){var _0x590bf0=_0x361277[_0x40fb('0x40')][_0x40fb('0x1b')]?0x1f4:_0x1b9294[_0x40fb('0x7e')]||0x1f4;logger[_0x40fb('0x26')](_0x40fb('0x7f'),_0x40fb('0x63'),_0x590bf0,JSON['stringify'](_0x1b9294));delete _0x1b9294[_0x40fb('0x37')];if(_0x590bf0===0x191){_0x590bf0=0x190;}_0x2c72fe[_0x40fb('0x2c')](_0x590bf0)[_0x40fb('0x38')](_0x361277['query'][_0x40fb('0x1b')]?{'message':'Wrong\x20credentials','statusCode':_0x1b9294[_0x40fb('0x7e')]}:_0x1b9294);});}else{var _0x3563c3=0x1f4;_0x2c72fe['status'](_0x3563c3)[_0x40fb('0x38')]({'message':_0x40fb('0x80'),'statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index e55c2e3..824b5d1 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 _0xe819=['request-promise','../../config/environment','./intSugarcrmAccount.attributes','exports','define','SugarcrmAccount','lodash','../../config/logger','moment'];(function(_0x158147,_0x15c105){var _0x2a751b=function(_0x111e0e){while(--_0x111e0e){_0x158147['push'](_0x158147['shift']());}};_0x2a751b(++_0x15c105);}(_0xe819,0x7b));var _0x9e81=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xe819[_0x3b380d];return _0x54502b;};'use strict';var _=require(_0x9e81('0x0'));var util=require('util');var logger=require(_0x9e81('0x1'))('api');var moment=require(_0x9e81('0x2'));var BPromise=require('bluebird');var rp=require(_0x9e81('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9e81('0x4'));var attributes=require(_0x9e81('0x5'));var integrations=require('../../components/integrations/configuration');module[_0x9e81('0x6')]=function(_0x4f7173,_0x296498){return _0x4f7173[_0x9e81('0x7')](_0x9e81('0x8'),attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x31a1=['rimraf','../../config/environment','../../components/integrations/configuration','int_sugarcrm_accounts','api','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x31a1,0x12c));var _0x131a=function(_0x4a747d,_0x3b747f){_0x4a747d=_0x4a747d-0x0;var _0x3a5b5c=_0x31a1[_0x4a747d];return _0x3a5b5c;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x131a('0x0'));var moment=require(_0x131a('0x1'));var BPromise=require(_0x131a('0x2'));var rp=require(_0x131a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x131a('0x4'));var config=require(_0x131a('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x131a('0x6'));module['exports']=function(_0xb8e007,_0x25280a){return _0xb8e007['define']('SugarcrmAccount',attributes,{'tableName':_0x131a('0x7'),'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 55f52f2..10a17d3 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 _0x8600=['options','raw','where','attributes','map','model','include','ShowSugarcrmAccount','find','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s','debug','stringify','error','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x8600,0x111));var _0x0860=function(_0x17c8cc,_0x5e5647){_0x17c8cc=_0x17c8cc-0x0;var _0x3db4eb=_0x8600[_0x17c8cc];return _0x3db4eb;};'use strict';var _=require('lodash');var util=require(_0x0860('0x0'));var moment=require(_0x0860('0x1'));var BPromise=require(_0x0860('0x2'));var rs=require(_0x0860('0x3'));var fs=require('fs');var Redis=require(_0x0860('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0860('0x5'));var logger=require(_0x0860('0x6'))(_0x0860('0x7'));var config=require(_0x0860('0x8'));var jayson=require(_0x0860('0x9'));var client=jayson[_0x0860('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2b35a2,_0x46ab47,_0x5be2d4){return new BPromise(function(_0x317381,_0x345f99){return client[_0x0860('0xb')](_0x2b35a2,_0x5be2d4)[_0x0860('0xc')](function(_0x9d352e){logger[_0x0860('0xd')](_0x0860('0xe'),_0x46ab47,'request\x20sent');logger[_0x0860('0xf')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x46ab47,'request\x20sent',JSON[_0x0860('0x10')](_0x9d352e));if(_0x9d352e[_0x0860('0x11')]){if(_0x9d352e[_0x0860('0x11')]['code']===0x1f4){logger[_0x0860('0x11')](_0x0860('0xe'),_0x46ab47,_0x9d352e[_0x0860('0x11')][_0x0860('0x12')]);return _0x345f99(_0x9d352e[_0x0860('0x11')]['message']);}logger[_0x0860('0x11')](_0x0860('0xe'),_0x46ab47,_0x9d352e[_0x0860('0x11')][_0x0860('0x12')]);return _0x317381(_0x9d352e['error'][_0x0860('0x12')]);}else{logger[_0x0860('0xd')](_0x0860('0xe'),_0x46ab47,_0x0860('0x13'));_0x317381(_0x9d352e[_0x0860('0x14')][_0x0860('0x12')]);}})[_0x0860('0x15')](function(_0x1e6c02){logger[_0x0860('0x11')](_0x0860('0xe'),_0x46ab47,_0x1e6c02);_0x345f99(_0x1e6c02);});});}exports[_0x0860('0x16')]=function(_0x3f2145){var _0x422a07=this;return new Promise(function(_0x3444fb,_0x416515){return db[_0x0860('0x17')]['findAll']({'raw':_0x3f2145[_0x0860('0x18')]?_0x3f2145[_0x0860('0x18')][_0x0860('0x19')]===undefined?!![]:![]:!![],'where':_0x3f2145[_0x0860('0x18')]?_0x3f2145[_0x0860('0x18')][_0x0860('0x1a')]||null:null,'attributes':_0x3f2145['options']?_0x3f2145[_0x0860('0x18')][_0x0860('0x1b')]||null:null,'limit':_0x3f2145[_0x0860('0x18')]?_0x3f2145[_0x0860('0x18')]['limit']||null:null,'include':_0x3f2145[_0x0860('0x18')]?_0x3f2145['options']['include']?_[_0x0860('0x1c')](_0x3f2145[_0x0860('0x18')]['include'],function(_0x4fe229){return{'model':db[_0x4fe229[_0x0860('0x1d')]],'as':_0x4fe229['as'],'attributes':_0x4fe229[_0x0860('0x1b')],'include':_0x4fe229[_0x0860('0x1e')]?_[_0x0860('0x1c')](_0x4fe229[_0x0860('0x1e')],function(_0x4dac18){return{'model':db[_0x4dac18[_0x0860('0x1d')]],'as':_0x4dac18['as'],'attributes':_0x4dac18['attributes'],'include':_0x4dac18['include']?_['map'](_0x4dac18[_0x0860('0x1e')],function(_0x542870){return{'model':db[_0x542870['model']],'as':_0x542870['as'],'attributes':_0x542870['attributes']};}):[]};}):[]};}):[]:[]})[_0x0860('0xc')](function(_0x455961){logger[_0x0860('0xd')](_0x0860('0x16'),_0x3f2145);logger[_0x0860('0xf')]('GetSugarcrmAccount',_0x3f2145,JSON['stringify'](_0x455961));_0x3444fb(_0x455961);})[_0x0860('0x15')](function(_0x2feb54){logger[_0x0860('0x11')](_0x0860('0x16'),_0x2feb54[_0x0860('0x12')],_0x3f2145);_0x416515(_0x422a07[_0x0860('0x11')](0x1f4,_0x2feb54[_0x0860('0x12')]));});});};exports[_0x0860('0x1f')]=function(_0x161144){var _0x4fb5de=this;return new Promise(function(_0x587921,_0x16f52b){return db['SugarcrmAccount'][_0x0860('0x20')]({'raw':_0x161144[_0x0860('0x18')]?_0x161144[_0x0860('0x18')][_0x0860('0x19')]===undefined?!![]:![]:!![],'where':_0x161144[_0x0860('0x18')]?_0x161144[_0x0860('0x18')][_0x0860('0x1a')]||null:null,'attributes':_0x161144[_0x0860('0x18')]?_0x161144['options']['attributes']||null:null,'include':_0x161144[_0x0860('0x18')]?_0x161144[_0x0860('0x18')]['include']?_['map'](_0x161144[_0x0860('0x18')][_0x0860('0x1e')],function(_0x45c36e){return{'model':db[_0x45c36e[_0x0860('0x1d')]],'as':_0x45c36e['as'],'attributes':_0x45c36e[_0x0860('0x1b')],'include':_0x45c36e['include']?_[_0x0860('0x1c')](_0x45c36e['include'],function(_0x48c681){return{'model':db[_0x48c681['model']],'as':_0x48c681['as'],'attributes':_0x48c681[_0x0860('0x1b')],'include':_0x48c681['include']?_[_0x0860('0x1c')](_0x48c681[_0x0860('0x1e')],function(_0x583a7a){return{'model':db[_0x583a7a[_0x0860('0x1d')]],'as':_0x583a7a['as'],'attributes':_0x583a7a[_0x0860('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x0860('0xc')](function(_0x45cfb3){logger[_0x0860('0xd')](_0x0860('0x1f'),_0x161144);logger[_0x0860('0xf')]('ShowSugarcrmAccount',_0x161144,JSON[_0x0860('0x10')](_0x45cfb3));_0x587921(_0x45cfb3);})[_0x0860('0x15')](function(_0x75d90b){logger[_0x0860('0x11')](_0x0860('0x1f'),_0x75d90b[_0x0860('0x12')],_0x161144);_0x16f52b(_0x4fb5de[_0x0860('0x11')](0x1f4,_0x75d90b[_0x0860('0x12')]));});});}; \ No newline at end of file +var _0x297b=['SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetSugarcrmAccount','SugarcrmAccount','findAll','raw','options','attributes','limit','include','map','model','debug','ShowSugarcrmAccount','find','where','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','SugarcrmAccount,\x20%s,\x20%s'];(function(_0x2939de,_0x3b948c){var _0x36bdc6=function(_0x356f21){while(--_0x356f21){_0x2939de['push'](_0x2939de['shift']());}};_0x36bdc6(++_0x3b948c);}(_0x297b,0xdc));var _0xb297=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0x297b[_0x154192];return _0x3c2792;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xb297('0x0'));var rs=require(_0xb297('0x1'));var fs=require('fs');var Redis=require(_0xb297('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xb297('0x3'));var logger=require(_0xb297('0x4'))(_0xb297('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb297('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3d08ed,_0x41e367,_0x20d192){return new BPromise(function(_0x57faa4,_0x40b060){return client[_0xb297('0x7')](_0x3d08ed,_0x20d192)[_0xb297('0x8')](function(_0x19b0c9){logger[_0xb297('0x9')](_0xb297('0xa'),_0x41e367,'request\x20sent');logger['debug'](_0xb297('0xb'),_0x41e367,'request\x20sent',JSON[_0xb297('0xc')](_0x19b0c9));if(_0x19b0c9[_0xb297('0xd')]){if(_0x19b0c9[_0xb297('0xd')][_0xb297('0xe')]===0x1f4){logger[_0xb297('0xd')](_0xb297('0xa'),_0x41e367,_0x19b0c9[_0xb297('0xd')][_0xb297('0xf')]);return _0x40b060(_0x19b0c9[_0xb297('0xd')][_0xb297('0xf')]);}logger[_0xb297('0xd')]('SugarcrmAccount,\x20%s,\x20%s',_0x41e367,_0x19b0c9[_0xb297('0xd')][_0xb297('0xf')]);return _0x57faa4(_0x19b0c9[_0xb297('0xd')][_0xb297('0xf')]);}else{logger[_0xb297('0x9')](_0xb297('0xa'),_0x41e367,_0xb297('0x10'));_0x57faa4(_0x19b0c9[_0xb297('0x11')]['message']);}})[_0xb297('0x12')](function(_0x173644){logger['error'](_0xb297('0xa'),_0x41e367,_0x173644);_0x40b060(_0x173644);});});}exports[_0xb297('0x13')]=function(_0x3dc898){var _0x576e94=this;return new Promise(function(_0x1690d0,_0x23937b){return db[_0xb297('0x14')][_0xb297('0x15')]({'raw':_0x3dc898['options']?_0x3dc898['options'][_0xb297('0x16')]===undefined?!![]:![]:!![],'where':_0x3dc898['options']?_0x3dc898[_0xb297('0x17')]['where']||null:null,'attributes':_0x3dc898[_0xb297('0x17')]?_0x3dc898[_0xb297('0x17')][_0xb297('0x18')]||null:null,'limit':_0x3dc898[_0xb297('0x17')]?_0x3dc898['options'][_0xb297('0x19')]||null:null,'include':_0x3dc898['options']?_0x3dc898['options'][_0xb297('0x1a')]?_[_0xb297('0x1b')](_0x3dc898[_0xb297('0x17')][_0xb297('0x1a')],function(_0x4cfe1f){return{'model':db[_0x4cfe1f[_0xb297('0x1c')]],'as':_0x4cfe1f['as'],'attributes':_0x4cfe1f[_0xb297('0x18')],'include':_0x4cfe1f[_0xb297('0x1a')]?_['map'](_0x4cfe1f[_0xb297('0x1a')],function(_0x41ad08){return{'model':db[_0x41ad08[_0xb297('0x1c')]],'as':_0x41ad08['as'],'attributes':_0x41ad08[_0xb297('0x18')],'include':_0x41ad08[_0xb297('0x1a')]?_[_0xb297('0x1b')](_0x41ad08['include'],function(_0x3e2e6d){return{'model':db[_0x3e2e6d[_0xb297('0x1c')]],'as':_0x3e2e6d['as'],'attributes':_0x3e2e6d[_0xb297('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb297('0x8')](function(_0x186c3a){logger['info']('GetSugarcrmAccount',_0x3dc898);logger[_0xb297('0x1d')]('GetSugarcrmAccount',_0x3dc898,JSON[_0xb297('0xc')](_0x186c3a));_0x1690d0(_0x186c3a);})[_0xb297('0x12')](function(_0x32febb){logger[_0xb297('0xd')](_0xb297('0x13'),_0x32febb[_0xb297('0xf')],_0x3dc898);_0x23937b(_0x576e94[_0xb297('0xd')](0x1f4,_0x32febb[_0xb297('0xf')]));});});};exports[_0xb297('0x1e')]=function(_0x44605c){var _0x34c6ed=this;return new Promise(function(_0x55d243,_0x436fd5){return db[_0xb297('0x14')][_0xb297('0x1f')]({'raw':_0x44605c['options']?_0x44605c['options'][_0xb297('0x16')]===undefined?!![]:![]:!![],'where':_0x44605c[_0xb297('0x17')]?_0x44605c[_0xb297('0x17')][_0xb297('0x20')]||null:null,'attributes':_0x44605c['options']?_0x44605c[_0xb297('0x17')]['attributes']||null:null,'include':_0x44605c['options']?_0x44605c[_0xb297('0x17')][_0xb297('0x1a')]?_[_0xb297('0x1b')](_0x44605c['options'][_0xb297('0x1a')],function(_0x42afc0){return{'model':db[_0x42afc0[_0xb297('0x1c')]],'as':_0x42afc0['as'],'attributes':_0x42afc0[_0xb297('0x18')],'include':_0x42afc0[_0xb297('0x1a')]?_[_0xb297('0x1b')](_0x42afc0[_0xb297('0x1a')],function(_0x3882cd){return{'model':db[_0x3882cd['model']],'as':_0x3882cd['as'],'attributes':_0x3882cd[_0xb297('0x18')],'include':_0x3882cd['include']?_[_0xb297('0x1b')](_0x3882cd[_0xb297('0x1a')],function(_0x3fe7a7){return{'model':db[_0x3fe7a7[_0xb297('0x1c')]],'as':_0x3fe7a7['as'],'attributes':_0x3fe7a7[_0xb297('0x18')]};}):[]};}):[]};}):[]:[]})[_0xb297('0x8')](function(_0x507afc){logger[_0xb297('0x9')](_0xb297('0x1e'),_0x44605c);logger['debug'](_0xb297('0x1e'),_0x44605c,JSON[_0xb297('0xc')](_0x507afc));_0x55d243(_0x507afc);})['catch'](function(_0x255c3d){logger[_0xb297('0xd')](_0xb297('0x1e'),_0x255c3d[_0xb297('0xf')],_0x44605c);_0x436fd5(_0x34c6ed[_0xb297('0xd')](0x1f4,_0x255c3d[_0xb297('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 7dfaefc..cf3d2e4 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 _0xaed7=['isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','put','delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xaed7,0x14f));var _0x7aed=function(_0x16519c,_0x538751){_0x16519c=_0x16519c-0x0;var _0x330552=_0xaed7[_0x16519c];return _0x330552;};'use strict';var multer=require(_0x7aed('0x0'));var util=require('util');var path=require(_0x7aed('0x1'));var timeout=require(_0x7aed('0x2'));var express=require(_0x7aed('0x3'));var router=express[_0x7aed('0x4')]();var auth=require(_0x7aed('0x5'));var interaction=require(_0x7aed('0x6'));var config=require(_0x7aed('0x7'));var controller=require(_0x7aed('0x8'));router[_0x7aed('0x9')]('/',auth[_0x7aed('0xa')](),controller[_0x7aed('0xb')]);router['get'](_0x7aed('0xc'),auth[_0x7aed('0xa')](),controller[_0x7aed('0xd')]);router[_0x7aed('0x9')](_0x7aed('0xe'),auth[_0x7aed('0xa')](),controller[_0x7aed('0xf')]);router[_0x7aed('0x9')](_0x7aed('0x10'),auth[_0x7aed('0xa')](),controller[_0x7aed('0x11')]);router['get'](_0x7aed('0x12'),auth[_0x7aed('0xa')](),controller[_0x7aed('0x13')]);router['post']('/',auth[_0x7aed('0xa')](),controller['create']);router[_0x7aed('0x14')](_0x7aed('0xc'),auth[_0x7aed('0xa')](),controller['update']);router[_0x7aed('0x15')](_0x7aed('0xc'),auth[_0x7aed('0xa')](),controller[_0x7aed('0x16')]);module['exports']=router; \ No newline at end of file +var _0xa635=['../../config/environment','./intSugarcrmConfiguration.controller','isAuthenticated','index','get','/:id/fields','/:id/subjects','getSubjects','getDescriptions','create','update','delete','/:id','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x22eaa7,_0x240c84){var _0x57e131=function(_0x215253){while(--_0x215253){_0x22eaa7['push'](_0x22eaa7['shift']());}};_0x57e131(++_0x240c84);}(_0xa635,0x1f1));var _0x5a63=function(_0xa2569a,_0x4437fe){_0xa2569a=_0xa2569a-0x0;var _0xa04d1d=_0xa635[_0xa2569a];return _0xa04d1d;};'use strict';var multer=require(_0x5a63('0x0'));var util=require(_0x5a63('0x1'));var path=require(_0x5a63('0x2'));var timeout=require(_0x5a63('0x3'));var express=require(_0x5a63('0x4'));var router=express[_0x5a63('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x5a63('0x6'));var config=require(_0x5a63('0x7'));var controller=require(_0x5a63('0x8'));router['get']('/',auth[_0x5a63('0x9')](),controller[_0x5a63('0xa')]);router[_0x5a63('0xb')]('/:id',auth[_0x5a63('0x9')](),controller['show']);router['get'](_0x5a63('0xc'),auth[_0x5a63('0x9')](),controller['getFields']);router[_0x5a63('0xb')](_0x5a63('0xd'),auth['isAuthenticated'](),controller[_0x5a63('0xe')]);router[_0x5a63('0xb')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x5a63('0xf')]);router['post']('/',auth[_0x5a63('0x9')](),controller[_0x5a63('0x10')]);router['put']('/:id',auth[_0x5a63('0x9')](),controller[_0x5a63('0x11')]);router[_0x5a63('0x12')](_0x5a63('0x13'),auth[_0x5a63('0x9')](),controller['destroy']);module[_0x5a63('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index f80982e..d06669d 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 _0x61d6=['sequelize','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x61d6,0xf9));var _0x661d=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x61d6[_0x1beef3];return _0x5af964;};'use strict';var Sequelize=require(_0x661d('0x0'));module[_0x661d('0x1')]={'name':{'type':Sequelize[_0x661d('0x2')]},'description':{'type':Sequelize[_0x661d('0x2')]}}; \ No newline at end of file +var _0xda81=['STRING','sequelize','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xda81,0x136));var _0x1da8=function(_0x16b61a,_0x3f79c8){_0x16b61a=_0x16b61a-0x0;var _0x1fb42a=_0xda81[_0x16b61a];return _0x1fb42a;};'use strict';var Sequelize=require(_0x1da8('0x0'));module[_0x1da8('0x1')]={'name':{'type':Sequelize[_0x1da8('0x2')]},'description':{'type':Sequelize[_0x1da8('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index 8847483..f232e2e 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 _0x42a2=['jayson/promise','http','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','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','status','end','count','offset','limit','set','Content-Range','reject','save','destroy','then','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','include','rows','includeAll','create','body','catch','params','findOne','SugarcrmField','pick','getFields','getSubjects','getDescriptions','html-pdf','eml-format','zip-dir','fast-json-patch','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x1a0153,_0x16ff28){var _0x539a6c=function(_0x45581d){while(--_0x45581d){_0x1a0153['push'](_0x1a0153['shift']());}};_0x539a6c(++_0x16ff28);}(_0x42a2,0x149));var _0x242a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x42a2[_0x46698a];return _0x356db0;};'use strict';var pdf=require(_0x242a('0x0'));var emlformat=require(_0x242a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x242a('0x2'));var jsonpatch=require(_0x242a('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x242a('0x4'));var util=require('util');var path=require(_0x242a('0x5'));var sox=require(_0x242a('0x6'));var csv=require(_0x242a('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x242a('0x8'));var squel=require(_0x242a('0x9'));var crypto=require(_0x242a('0xa'));var jsforce=require(_0x242a('0xb'));var deskjs=require(_0x242a('0xc'));var toCsv=require(_0x242a('0x7'));var querystring=require('querystring');var Papa=require(_0x242a('0xd'));var Redis=require(_0x242a('0xe'));var authService=require(_0x242a('0xf'));var qs=require(_0x242a('0x10'));var as=require(_0x242a('0x11'));var hardwareService=require(_0x242a('0x12'));var logger=require(_0x242a('0x13'))('api');var utils=require(_0x242a('0x14'));var config=require(_0x242a('0x15'));var db=require(_0x242a('0x16'))['db'];var jayson=require(_0x242a('0x17'));var client=jayson['client'][_0x242a('0x18')]({'port':0x232a});function checkPasswordPattern(_0x30907f,_0x3d68cc,_0x36d546){if(_0x36d546){var _0x5750d5=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5750d5['test'](_0x3d68cc)){return _0x30907f;}else{throw new db['Sequelize']['ValidationError'](_0x242a('0x19'));}}else{return _0x30907f;}}function respondWithRpcPromise(_0x362a10,_0x2bddec,_0x321839,_0x597806){return new BPromise(function(_0x5ee602,_0x196640){var _0x5b869c=_0x597806||client;return _0x5b869c[_0x242a('0x1a')](_0x362a10,_0x321839)['then'](function(_0x43958d){logger['info'](_0x242a('0x1b'),_0x2bddec,_0x242a('0x1c'));logger[_0x242a('0x1d')](_0x242a('0x1e'),_0x2bddec,_0x242a('0x1c'),JSON[_0x242a('0x1f')](_0x43958d));if(_0x43958d[_0x242a('0x20')]){if(_0x43958d[_0x242a('0x20')][_0x242a('0x21')]===0x1f4){logger[_0x242a('0x20')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2bddec,_0x43958d[_0x242a('0x20')][_0x242a('0x22')]);return _0x196640(_0x43958d[_0x242a('0x20')]['message']);}logger[_0x242a('0x20')](_0x242a('0x1b'),_0x2bddec,_0x43958d[_0x242a('0x20')]['message']);return _0x5ee602(_0x43958d['error'][_0x242a('0x22')]);}else{logger[_0x242a('0x23')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2bddec,'request\x20sent');_0x5ee602(_0x43958d[_0x242a('0x24')]['message']);}})['catch'](function(_0xfebbe){logger[_0x242a('0x20')](_0x242a('0x1b'),_0x2bddec,_0xfebbe);_0x196640(_0xfebbe);});});}function respondWithStatusCode(_0x333cc9,_0x21c6c2){_0x21c6c2=_0x21c6c2||0xcc;return function(_0xa44926){if(_0xa44926){return _0x333cc9['sendStatus'](_0x21c6c2);}return _0x333cc9[_0x242a('0x25')](_0x21c6c2)[_0x242a('0x26')]();};}function respondWithResult(_0x24c891,_0x15505f){_0x15505f=_0x15505f||0xc8;return function(_0x1d3939){if(_0x1d3939){return _0x24c891[_0x242a('0x25')](_0x15505f)['json'](_0x1d3939);}};}function respondWithFilteredResult(_0x40cff6,_0x4dc69d){return function(_0x3631d6){if(_0x3631d6){var _0x49f06a=_0x3631d6[_0x242a('0x27')],_0x5ec2d8=_0x4dc69d[_0x242a('0x28')],_0x4c350b=_0x4dc69d[_0x242a('0x28')]+_0x4dc69d[_0x242a('0x29')],_0x43669a;if(_0x4c350b>=_0x49f06a){_0x4c350b=_0x49f06a;_0x43669a=0xc8;}else{_0x43669a=0xce;}_0x40cff6[_0x242a('0x25')](_0x43669a);return _0x40cff6[_0x242a('0x2a')](_0x242a('0x2b'),_0x5ec2d8+'-'+_0x4c350b+'/'+_0x49f06a)['json'](_0x3631d6);}return null;};}function patchUpdates(_0x4c57c8){return function(_0x48a73b){try{jsonpatch['apply'](_0x48a73b,_0x4c57c8,!![]);}catch(_0x500fa0){return BPromise[_0x242a('0x2c')](_0x500fa0);}return _0x48a73b[_0x242a('0x2d')]();};}function saveUpdates(_0x7e7b7c,_0x101979){return function(_0x58d504){if(_0x58d504){return _0x58d504['update'](_0x7e7b7c)['then'](function(_0x55be30){return _0x55be30;});}return null;};}function removeEntity(_0x286799,_0x260478){return function(_0x156b2b){if(_0x156b2b){return _0x156b2b[_0x242a('0x2e')]()[_0x242a('0x2f')](function(){_0x286799[_0x242a('0x25')](0xcc)[_0x242a('0x26')]();});}};}function handleEntityNotFound(_0x55120a,_0x4fb342){return function(_0x2723a9){if(!_0x2723a9){_0x55120a[_0x242a('0x30')](0x194);}return _0x2723a9;};}function handleError(_0x207fd1,_0x378eea){_0x378eea=_0x378eea||0x1f4;return function(_0x30c571){logger['error'](_0x30c571[_0x242a('0x31')]);if(_0x30c571['name']){delete _0x30c571[_0x242a('0x32')];}_0x207fd1[_0x242a('0x25')](_0x378eea)[_0x242a('0x33')](_0x30c571);};}exports[_0x242a('0x34')]=function(_0x1f8fc3,_0x31752d){var _0x2c13b7={},_0x1cb70f={},_0x12f5ee={'count':0x0,'rows':[]};var _0x51a755=_[_0x242a('0x35')](db[_0x242a('0x36')][_0x242a('0x37')],function(_0x588b6a){return{'name':_0x588b6a[_0x242a('0x38')],'type':_0x588b6a[_0x242a('0x39')][_0x242a('0x3a')]};});_0x1cb70f[_0x242a('0x3b')]=_['map'](_0x51a755,'name');_0x1cb70f[_0x242a('0x3c')]=_[_0x242a('0x3d')](_0x1f8fc3[_0x242a('0x3c')]);_0x1cb70f[_0x242a('0x3e')]=_[_0x242a('0x3f')](_0x1cb70f['model'],_0x1cb70f['query']);_0x2c13b7[_0x242a('0x40')]=_[_0x242a('0x3f')](_0x1cb70f[_0x242a('0x3b')],qs['fields'](_0x1f8fc3['query'][_0x242a('0x41')]));_0x2c13b7['attributes']=_0x2c13b7[_0x242a('0x40')][_0x242a('0x42')]?_0x2c13b7['attributes']:_0x1cb70f[_0x242a('0x3b')];if(!_0x1f8fc3[_0x242a('0x3c')][_0x242a('0x43')](_0x242a('0x44'))){_0x2c13b7[_0x242a('0x29')]=qs[_0x242a('0x29')](_0x1f8fc3[_0x242a('0x3c')][_0x242a('0x29')]);_0x2c13b7[_0x242a('0x28')]=qs[_0x242a('0x28')](_0x1f8fc3[_0x242a('0x3c')][_0x242a('0x28')]);}_0x2c13b7[_0x242a('0x45')]=qs[_0x242a('0x46')](_0x1f8fc3[_0x242a('0x3c')][_0x242a('0x46')]);_0x2c13b7[_0x242a('0x47')]=qs[_0x242a('0x3e')](_['pick'](_0x1f8fc3[_0x242a('0x3c')],_0x1cb70f['filters']));if(_0x1f8fc3[_0x242a('0x3c')]['filter']){_0x2c13b7[_0x242a('0x47')]=_[_0x242a('0x48')](_0x2c13b7[_0x242a('0x47')],{'$or':_[_0x242a('0x35')](_0x51a755,function(_0x4621d1){if(_0x4621d1[_0x242a('0x39')]!=='VIRTUAL'){var _0x2a8b92={};_0x2a8b92[_0x4621d1[_0x242a('0x32')]]={'$like':'%'+_0x1f8fc3['query'][_0x242a('0x49')]+'%'};return _0x2a8b92;}})});}_0x2c13b7=_[_0x242a('0x48')]({},_0x2c13b7,_0x1f8fc3[_0x242a('0x4a')]);var _0x126da5={'where':_0x2c13b7[_0x242a('0x47')]};return db[_0x242a('0x36')][_0x242a('0x27')](_0x126da5)[_0x242a('0x2f')](function(_0x202b5f){_0x12f5ee[_0x242a('0x27')]=_0x202b5f;if(_0x1f8fc3['query']['includeAll']){_0x2c13b7[_0x242a('0x4b')]=[{'all':!![]}];}return db[_0x242a('0x36')]['findAll'](_0x2c13b7);})[_0x242a('0x2f')](function(_0x83f2fb){_0x12f5ee[_0x242a('0x4c')]=_0x83f2fb;return _0x12f5ee;})[_0x242a('0x2f')](respondWithFilteredResult(_0x31752d,_0x2c13b7))['catch'](handleError(_0x31752d,null));};exports['show']=function(_0x243234,_0x4b45e6){var _0x24b934={'raw':![],'where':{'id':_0x243234['params']['id']}},_0x2b8082={};_0x2b8082['model']=_[_0x242a('0x3d')](db[_0x242a('0x36')][_0x242a('0x37')]);_0x2b8082[_0x242a('0x3c')]=_['keys'](_0x243234[_0x242a('0x3c')]);_0x2b8082[_0x242a('0x3e')]=_[_0x242a('0x3f')](_0x2b8082['model'],_0x2b8082[_0x242a('0x3c')]);_0x24b934['attributes']=_['intersection'](_0x2b8082[_0x242a('0x3b')],qs[_0x242a('0x41')](_0x243234[_0x242a('0x3c')][_0x242a('0x41')]));_0x24b934[_0x242a('0x40')]=_0x24b934[_0x242a('0x40')]['length']?_0x24b934[_0x242a('0x40')]:_0x2b8082['model'];if(_0x243234['query'][_0x242a('0x4d')]){_0x24b934[_0x242a('0x4b')]=[{'all':!![]}];}_0x24b934=_['merge']({},_0x24b934,_0x243234[_0x242a('0x4a')]);return db['SugarcrmConfiguration']['find'](_0x24b934)[_0x242a('0x2f')](handleEntityNotFound(_0x4b45e6,null))[_0x242a('0x2f')](respondWithResult(_0x4b45e6,null))['catch'](handleError(_0x4b45e6,null));};exports[_0x242a('0x4e')]=function(_0x273612,_0x2fe48f){return db[_0x242a('0x36')]['create'](_0x273612[_0x242a('0x4f')],{})[_0x242a('0x2f')](respondWithResult(_0x2fe48f,0xc9))['catch'](handleError(_0x2fe48f,null));};exports['update']=function(_0x432d3a,_0x1603d9){if(_0x432d3a[_0x242a('0x4f')]['id']){delete _0x432d3a['body']['id'];}return db[_0x242a('0x36')]['find']({'where':{'id':_0x432d3a['params']['id']}})[_0x242a('0x2f')](handleEntityNotFound(_0x1603d9,null))[_0x242a('0x2f')](saveUpdates(_0x432d3a[_0x242a('0x4f')],null))['then'](respondWithResult(_0x1603d9,null))[_0x242a('0x50')](handleError(_0x1603d9,null));};exports['destroy']=function(_0x51639c,_0x54df0b){return db[_0x242a('0x36')]['find']({'where':{'id':_0x51639c[_0x242a('0x51')]['id']}})[_0x242a('0x2f')](handleEntityNotFound(_0x54df0b,null))[_0x242a('0x2f')](removeEntity(_0x54df0b,null))[_0x242a('0x50')](handleError(_0x54df0b,null));};exports['getFields']=function(_0x252bb5,_0x1d30d4,_0xf3900b){var _0x27795b={};var _0x7dc17a={};var _0x4a2384;var _0x448ff9;return db[_0x242a('0x36')][_0x242a('0x52')]({'where':{'id':_0x252bb5[_0x242a('0x51')]['id']}})[_0x242a('0x2f')](handleEntityNotFound(_0x1d30d4,null))['then'](function(_0x48e9c3){if(_0x48e9c3){_0x4a2384=_0x48e9c3;_0x7dc17a[_0x242a('0x3b')]=_['keys'](db[_0x242a('0x53')][_0x242a('0x37')]);_0x7dc17a[_0x242a('0x3c')]=_[_0x242a('0x3d')](_0x252bb5['query']);_0x7dc17a['filters']=_['intersection'](_0x7dc17a[_0x242a('0x3b')],_0x7dc17a[_0x242a('0x3c')]);_0x27795b[_0x242a('0x40')]=_[_0x242a('0x3f')](_0x7dc17a[_0x242a('0x3b')],qs[_0x242a('0x41')](_0x252bb5['query'][_0x242a('0x41')]));_0x27795b[_0x242a('0x40')]=_0x27795b[_0x242a('0x40')][_0x242a('0x42')]?_0x27795b[_0x242a('0x40')]:_0x7dc17a[_0x242a('0x3b')];_0x27795b[_0x242a('0x45')]=qs['sort'](_0x252bb5[_0x242a('0x3c')][_0x242a('0x46')]);_0x27795b[_0x242a('0x47')]=qs[_0x242a('0x3e')](_[_0x242a('0x54')](_0x252bb5[_0x242a('0x3c')],_0x7dc17a[_0x242a('0x3e')]));if(_0x252bb5['query'][_0x242a('0x49')]){_0x27795b[_0x242a('0x47')]=_[_0x242a('0x48')](_0x27795b[_0x242a('0x47')],{'$or':_[_0x242a('0x35')](_0x27795b['attributes'],function(_0x456019){var _0x120b7a={};_0x120b7a[_0x456019]={'$like':'%'+_0x252bb5[_0x242a('0x3c')][_0x242a('0x49')]+'%'};return _0x120b7a;})});}_0x27795b=_[_0x242a('0x48')]({},_0x27795b,_0x252bb5[_0x242a('0x4a')]);return _0x4a2384[_0x242a('0x55')](_0x27795b);}})[_0x242a('0x2f')](function(_0xd735f0){if(_0xd735f0){_0x448ff9=_0xd735f0[_0x242a('0x42')];if(!_0x252bb5['query'][_0x242a('0x43')]('nolimit')){_0x27795b[_0x242a('0x29')]=qs[_0x242a('0x29')](_0x252bb5[_0x242a('0x3c')][_0x242a('0x29')]);_0x27795b[_0x242a('0x28')]=qs['offset'](_0x252bb5[_0x242a('0x3c')]['offset']);}return _0x4a2384['getFields'](_0x27795b);}})[_0x242a('0x2f')](function(_0x4c6bc7){if(_0x4c6bc7){return _0x4c6bc7?{'count':_0x448ff9,'rows':_0x4c6bc7}:null;}})[_0x242a('0x2f')](respondWithResult(_0x1d30d4,null))['catch'](handleError(_0x1d30d4,null));};exports[_0x242a('0x56')]=function(_0x2b7319,_0xd688e5,_0x392739){var _0xc8a22f={};var _0x2b27b1={};var _0x2e4e79;var _0x356dce;return db[_0x242a('0x36')]['findOne']({'where':{'id':_0x2b7319[_0x242a('0x51')]['id']}})[_0x242a('0x2f')](handleEntityNotFound(_0xd688e5,null))['then'](function(_0x233e7b){if(_0x233e7b){_0x2e4e79=_0x233e7b;_0x2b27b1['model']=_[_0x242a('0x3d')](db[_0x242a('0x53')]['rawAttributes']);_0x2b27b1[_0x242a('0x3c')]=_[_0x242a('0x3d')](_0x2b7319['query']);_0x2b27b1[_0x242a('0x3e')]=_['intersection'](_0x2b27b1[_0x242a('0x3b')],_0x2b27b1[_0x242a('0x3c')]);_0xc8a22f[_0x242a('0x40')]=_['intersection'](_0x2b27b1[_0x242a('0x3b')],qs[_0x242a('0x41')](_0x2b7319['query']['fields']));_0xc8a22f[_0x242a('0x40')]=_0xc8a22f[_0x242a('0x40')]['length']?_0xc8a22f[_0x242a('0x40')]:_0x2b27b1[_0x242a('0x3b')];_0xc8a22f[_0x242a('0x45')]=qs[_0x242a('0x46')](_0x2b7319['query'][_0x242a('0x46')]);_0xc8a22f[_0x242a('0x47')]=qs[_0x242a('0x3e')](_['pick'](_0x2b7319[_0x242a('0x3c')],_0x2b27b1[_0x242a('0x3e')]));if(_0x2b7319[_0x242a('0x3c')]['filter']){_0xc8a22f[_0x242a('0x47')]=_['merge'](_0xc8a22f[_0x242a('0x47')],{'$or':_['map'](_0xc8a22f['attributes'],function(_0x1a2af9){var _0x12fb4e={};_0x12fb4e[_0x1a2af9]={'$like':'%'+_0x2b7319['query'][_0x242a('0x49')]+'%'};return _0x12fb4e;})});}_0xc8a22f=_[_0x242a('0x48')]({},_0xc8a22f,_0x2b7319[_0x242a('0x4a')]);return _0x2e4e79['getSubjects'](_0xc8a22f);}})[_0x242a('0x2f')](function(_0x29233c){if(_0x29233c){_0x356dce=_0x29233c[_0x242a('0x42')];if(!_0x2b7319[_0x242a('0x3c')][_0x242a('0x43')](_0x242a('0x44'))){_0xc8a22f[_0x242a('0x29')]=qs[_0x242a('0x29')](_0x2b7319[_0x242a('0x3c')]['limit']);_0xc8a22f[_0x242a('0x28')]=qs[_0x242a('0x28')](_0x2b7319[_0x242a('0x3c')][_0x242a('0x28')]);}return _0x2e4e79[_0x242a('0x56')](_0xc8a22f);}})[_0x242a('0x2f')](function(_0x1d69d6){if(_0x1d69d6){return _0x1d69d6?{'count':_0x356dce,'rows':_0x1d69d6}:null;}})[_0x242a('0x2f')](respondWithResult(_0xd688e5,null))[_0x242a('0x50')](handleError(_0xd688e5,null));};exports[_0x242a('0x57')]=function(_0x1dbd6b,_0x4e29af,_0x355958){var _0x23c143={};var _0x457324={};var _0x4a24ee;var _0x23b6e7;return db[_0x242a('0x36')][_0x242a('0x52')]({'where':{'id':_0x1dbd6b[_0x242a('0x51')]['id']}})[_0x242a('0x2f')](handleEntityNotFound(_0x4e29af,null))['then'](function(_0x2f3b02){if(_0x2f3b02){_0x4a24ee=_0x2f3b02;_0x457324[_0x242a('0x3b')]=_[_0x242a('0x3d')](db['SugarcrmField'][_0x242a('0x37')]);_0x457324[_0x242a('0x3c')]=_['keys'](_0x1dbd6b['query']);_0x457324[_0x242a('0x3e')]=_[_0x242a('0x3f')](_0x457324[_0x242a('0x3b')],_0x457324[_0x242a('0x3c')]);_0x23c143[_0x242a('0x40')]=_[_0x242a('0x3f')](_0x457324[_0x242a('0x3b')],qs[_0x242a('0x41')](_0x1dbd6b[_0x242a('0x3c')][_0x242a('0x41')]));_0x23c143['attributes']=_0x23c143[_0x242a('0x40')][_0x242a('0x42')]?_0x23c143['attributes']:_0x457324[_0x242a('0x3b')];_0x23c143['order']=qs[_0x242a('0x46')](_0x1dbd6b[_0x242a('0x3c')][_0x242a('0x46')]);_0x23c143[_0x242a('0x47')]=qs[_0x242a('0x3e')](_['pick'](_0x1dbd6b[_0x242a('0x3c')],_0x457324['filters']));if(_0x1dbd6b['query'][_0x242a('0x49')]){_0x23c143[_0x242a('0x47')]=_[_0x242a('0x48')](_0x23c143['where'],{'$or':_[_0x242a('0x35')](_0x23c143['attributes'],function(_0x31d665){var _0x29f768={};_0x29f768[_0x31d665]={'$like':'%'+_0x1dbd6b['query'][_0x242a('0x49')]+'%'};return _0x29f768;})});}_0x23c143=_['merge']({},_0x23c143,_0x1dbd6b[_0x242a('0x4a')]);return _0x4a24ee[_0x242a('0x57')](_0x23c143);}})[_0x242a('0x2f')](function(_0x364f5f){if(_0x364f5f){_0x23b6e7=_0x364f5f[_0x242a('0x42')];if(!_0x1dbd6b[_0x242a('0x3c')]['hasOwnProperty']('nolimit')){_0x23c143[_0x242a('0x29')]=qs['limit'](_0x1dbd6b[_0x242a('0x3c')][_0x242a('0x29')]);_0x23c143[_0x242a('0x28')]=qs['offset'](_0x1dbd6b['query'][_0x242a('0x28')]);}return _0x4a24ee[_0x242a('0x57')](_0x23c143);}})[_0x242a('0x2f')](function(_0x3e9c79){if(_0x3e9c79){return _0x3e9c79?{'count':_0x23b6e7,'rows':_0x3e9c79}:null;}})[_0x242a('0x2f')](respondWithResult(_0x4e29af,null))[_0x242a('0x50')](handleError(_0x4e29af,null));}; \ No newline at end of file +var _0x5224=['find','getFields','findOne','SugarcrmField','getSubjects','getDescriptions','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','test','Sequelize','ValidationError','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','count','offset','limit','set','Content-Range','json','apply','reject','save','then','end','sendStatus','stack','name','send','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key','model','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','show','params','keys','intersection','create','body','update'];(function(_0x4bc876,_0x13fc0b){var _0x86ebcb=function(_0x35e651){while(--_0x35e651){_0x4bc876['push'](_0x4bc876['shift']());}};_0x86ebcb(++_0x13fc0b);}(_0x5224,0x66));var _0x4522=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x5224[_0x37bd26];return _0xe83dc4;};'use strict';var pdf=require(_0x4522('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4522('0x1'));var zipdir=require(_0x4522('0x2'));var jsonpatch=require(_0x4522('0x3'));var rp=require(_0x4522('0x4'));var moment=require(_0x4522('0x5'));var BPromise=require(_0x4522('0x6'));var Mustache=require(_0x4522('0x7'));var util=require(_0x4522('0x8'));var path=require(_0x4522('0x9'));var sox=require(_0x4522('0xa'));var csv=require('to-csv');var ejs=require(_0x4522('0xb'));var fs=require('fs');var _=require(_0x4522('0xc'));var squel=require('squel');var crypto=require(_0x4522('0xd'));var jsforce=require(_0x4522('0xe'));var deskjs=require(_0x4522('0xf'));var toCsv=require(_0x4522('0x10'));var querystring=require('querystring');var Papa=require(_0x4522('0x11'));var Redis=require(_0x4522('0x12'));var authService=require(_0x4522('0x13'));var qs=require(_0x4522('0x14'));var as=require(_0x4522('0x15'));var hardwareService=require(_0x4522('0x16'));var logger=require(_0x4522('0x17'))(_0x4522('0x18'));var utils=require(_0x4522('0x19'));var config=require(_0x4522('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0x4522('0x1b'));var client=jayson[_0x4522('0x1c')]['http']({'port':0x232a});function checkPasswordPattern(_0x1487b8,_0x339c0a,_0x1eb4bd){if(_0x1eb4bd){var _0x252f2f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x252f2f[_0x4522('0x1d')](_0x339c0a)){return _0x1487b8;}else{throw new db[(_0x4522('0x1e'))][(_0x4522('0x1f'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x1487b8;}}function respondWithRpcPromise(_0x38200a,_0x583b95,_0x39f1b3,_0x4220ca){return new BPromise(function(_0x11b6e6,_0x1e9219){var _0x2956cc=_0x4220ca||client;return _0x2956cc['request'](_0x38200a,_0x39f1b3)['then'](function(_0x1c6059){logger[_0x4522('0x20')](_0x4522('0x21'),_0x583b95,_0x4522('0x22'));logger['debug'](_0x4522('0x23'),_0x583b95,_0x4522('0x22'),JSON[_0x4522('0x24')](_0x1c6059));if(_0x1c6059[_0x4522('0x25')]){if(_0x1c6059['error'][_0x4522('0x26')]===0x1f4){logger[_0x4522('0x25')](_0x4522('0x21'),_0x583b95,_0x1c6059[_0x4522('0x25')][_0x4522('0x27')]);return _0x1e9219(_0x1c6059[_0x4522('0x25')][_0x4522('0x27')]);}logger[_0x4522('0x25')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x583b95,_0x1c6059[_0x4522('0x25')][_0x4522('0x27')]);return _0x11b6e6(_0x1c6059[_0x4522('0x25')][_0x4522('0x27')]);}else{logger['info'](_0x4522('0x21'),_0x583b95,'request\x20sent');_0x11b6e6(_0x1c6059['result'][_0x4522('0x27')]);}})[_0x4522('0x28')](function(_0x49469f){logger[_0x4522('0x25')](_0x4522('0x21'),_0x583b95,_0x49469f);_0x1e9219(_0x49469f);});});}function respondWithStatusCode(_0x352c1a,_0x13c04f){_0x13c04f=_0x13c04f||0xcc;return function(_0x2093bc){if(_0x2093bc){return _0x352c1a['sendStatus'](_0x13c04f);}return _0x352c1a[_0x4522('0x29')](_0x13c04f)['end']();};}function respondWithResult(_0x49ccaa,_0x2e3aca){_0x2e3aca=_0x2e3aca||0xc8;return function(_0x2f5e01){if(_0x2f5e01){return _0x49ccaa['status'](_0x2e3aca)['json'](_0x2f5e01);}};}function respondWithFilteredResult(_0x526e46,_0x23427a){return function(_0x3e011e){if(_0x3e011e){var _0x1ad8e0=_0x3e011e[_0x4522('0x2a')],_0x5778c7=_0x23427a['offset'],_0x353e42=_0x23427a[_0x4522('0x2b')]+_0x23427a[_0x4522('0x2c')],_0x8af9eb;if(_0x353e42>=_0x1ad8e0){_0x353e42=_0x1ad8e0;_0x8af9eb=0xc8;}else{_0x8af9eb=0xce;}_0x526e46[_0x4522('0x29')](_0x8af9eb);return _0x526e46[_0x4522('0x2d')](_0x4522('0x2e'),_0x5778c7+'-'+_0x353e42+'/'+_0x1ad8e0)[_0x4522('0x2f')](_0x3e011e);}return null;};}function patchUpdates(_0x35bf37){return function(_0x3138a4){try{jsonpatch[_0x4522('0x30')](_0x3138a4,_0x35bf37,!![]);}catch(_0x5b4e10){return BPromise[_0x4522('0x31')](_0x5b4e10);}return _0x3138a4[_0x4522('0x32')]();};}function saveUpdates(_0x3f7fd3,_0x250117){return function(_0x277d6b){if(_0x277d6b){return _0x277d6b['update'](_0x3f7fd3)[_0x4522('0x33')](function(_0x5a91d4){return _0x5a91d4;});}return null;};}function removeEntity(_0x26b17a,_0x13cf38){return function(_0x37aadc){if(_0x37aadc){return _0x37aadc['destroy']()['then'](function(){_0x26b17a[_0x4522('0x29')](0xcc)[_0x4522('0x34')]();});}};}function handleEntityNotFound(_0x476d64,_0xf8f4de){return function(_0x352a6f){if(!_0x352a6f){_0x476d64[_0x4522('0x35')](0x194);}return _0x352a6f;};}function handleError(_0x2d50d3,_0xb2fba6){_0xb2fba6=_0xb2fba6||0x1f4;return function(_0xed853a){logger['error'](_0xed853a[_0x4522('0x36')]);if(_0xed853a['name']){delete _0xed853a[_0x4522('0x37')];}_0x2d50d3[_0x4522('0x29')](_0xb2fba6)[_0x4522('0x38')](_0xed853a);};}exports[_0x4522('0x39')]=function(_0x4f3daf,_0x2c9d5f){var _0x44ce93={},_0x43b37a={},_0x1aa179={'count':0x0,'rows':[]};var _0x401fe5=_[_0x4522('0x3a')](db[_0x4522('0x3b')][_0x4522('0x3c')],function(_0x258621){return{'name':_0x258621[_0x4522('0x3d')],'type':_0x258621[_0x4522('0x3e')][_0x4522('0x3f')]};});_0x43b37a[_0x4522('0x40')]=_[_0x4522('0x3a')](_0x401fe5,_0x4522('0x37'));_0x43b37a[_0x4522('0x41')]=_['keys'](_0x4f3daf[_0x4522('0x41')]);_0x43b37a[_0x4522('0x42')]=_['intersection'](_0x43b37a['model'],_0x43b37a[_0x4522('0x41')]);_0x44ce93['attributes']=_['intersection'](_0x43b37a[_0x4522('0x40')],qs[_0x4522('0x43')](_0x4f3daf['query'][_0x4522('0x43')]));_0x44ce93[_0x4522('0x44')]=_0x44ce93[_0x4522('0x44')][_0x4522('0x45')]?_0x44ce93[_0x4522('0x44')]:_0x43b37a['model'];if(!_0x4f3daf[_0x4522('0x41')][_0x4522('0x46')](_0x4522('0x47'))){_0x44ce93[_0x4522('0x2c')]=qs[_0x4522('0x2c')](_0x4f3daf['query'][_0x4522('0x2c')]);_0x44ce93['offset']=qs['offset'](_0x4f3daf[_0x4522('0x41')]['offset']);}_0x44ce93[_0x4522('0x48')]=qs[_0x4522('0x49')](_0x4f3daf['query'][_0x4522('0x49')]);_0x44ce93[_0x4522('0x4a')]=qs[_0x4522('0x42')](_[_0x4522('0x4b')](_0x4f3daf['query'],_0x43b37a[_0x4522('0x42')]));if(_0x4f3daf['query'][_0x4522('0x4c')]){_0x44ce93[_0x4522('0x4a')]=_[_0x4522('0x4d')](_0x44ce93[_0x4522('0x4a')],{'$or':_[_0x4522('0x3a')](_0x401fe5,function(_0x44b7b4){if(_0x44b7b4['type']!=='VIRTUAL'){var _0x526085={};_0x526085[_0x44b7b4[_0x4522('0x37')]]={'$like':'%'+_0x4f3daf[_0x4522('0x41')]['filter']+'%'};return _0x526085;}})});}_0x44ce93=_['merge']({},_0x44ce93,_0x4f3daf[_0x4522('0x4e')]);var _0x2c85c2={'where':_0x44ce93[_0x4522('0x4a')]};return db[_0x4522('0x3b')]['count'](_0x2c85c2)[_0x4522('0x33')](function(_0x10a3f8){_0x1aa179[_0x4522('0x2a')]=_0x10a3f8;if(_0x4f3daf[_0x4522('0x41')][_0x4522('0x4f')]){_0x44ce93[_0x4522('0x50')]=[{'all':!![]}];}return db[_0x4522('0x3b')][_0x4522('0x51')](_0x44ce93);})[_0x4522('0x33')](function(_0x3d2366){_0x1aa179[_0x4522('0x52')]=_0x3d2366;return _0x1aa179;})[_0x4522('0x33')](respondWithFilteredResult(_0x2c9d5f,_0x44ce93))[_0x4522('0x28')](handleError(_0x2c9d5f,null));};exports[_0x4522('0x53')]=function(_0x394689,_0x5ae110){var _0x45d9f4={'raw':![],'where':{'id':_0x394689[_0x4522('0x54')]['id']}},_0x18dab0={};_0x18dab0['model']=_[_0x4522('0x55')](db['SugarcrmConfiguration'][_0x4522('0x3c')]);_0x18dab0['query']=_['keys'](_0x394689[_0x4522('0x41')]);_0x18dab0[_0x4522('0x42')]=_['intersection'](_0x18dab0[_0x4522('0x40')],_0x18dab0[_0x4522('0x41')]);_0x45d9f4[_0x4522('0x44')]=_[_0x4522('0x56')](_0x18dab0[_0x4522('0x40')],qs[_0x4522('0x43')](_0x394689[_0x4522('0x41')][_0x4522('0x43')]));_0x45d9f4[_0x4522('0x44')]=_0x45d9f4['attributes'][_0x4522('0x45')]?_0x45d9f4[_0x4522('0x44')]:_0x18dab0['model'];if(_0x394689[_0x4522('0x41')][_0x4522('0x4f')]){_0x45d9f4[_0x4522('0x50')]=[{'all':!![]}];}_0x45d9f4=_[_0x4522('0x4d')]({},_0x45d9f4,_0x394689[_0x4522('0x4e')]);return db[_0x4522('0x3b')]['find'](_0x45d9f4)[_0x4522('0x33')](handleEntityNotFound(_0x5ae110,null))[_0x4522('0x33')](respondWithResult(_0x5ae110,null))['catch'](handleError(_0x5ae110,null));};exports[_0x4522('0x57')]=function(_0xf58c3a,_0x63fa79){return db[_0x4522('0x3b')]['create'](_0xf58c3a[_0x4522('0x58')],{})[_0x4522('0x33')](respondWithResult(_0x63fa79,0xc9))['catch'](handleError(_0x63fa79,null));};exports[_0x4522('0x59')]=function(_0x5909bb,_0x4978d1){if(_0x5909bb[_0x4522('0x58')]['id']){delete _0x5909bb[_0x4522('0x58')]['id'];}return db[_0x4522('0x3b')]['find']({'where':{'id':_0x5909bb['params']['id']}})['then'](handleEntityNotFound(_0x4978d1,null))[_0x4522('0x33')](saveUpdates(_0x5909bb[_0x4522('0x58')],null))[_0x4522('0x33')](respondWithResult(_0x4978d1,null))[_0x4522('0x28')](handleError(_0x4978d1,null));};exports['destroy']=function(_0x1b0275,_0x4b3a37){return db[_0x4522('0x3b')][_0x4522('0x5a')]({'where':{'id':_0x1b0275[_0x4522('0x54')]['id']}})['then'](handleEntityNotFound(_0x4b3a37,null))[_0x4522('0x33')](removeEntity(_0x4b3a37,null))[_0x4522('0x28')](handleError(_0x4b3a37,null));};exports[_0x4522('0x5b')]=function(_0x528fab,_0x462ef9,_0x4243ee){var _0x2c953c={};var _0x17ae16={};var _0x240113;var _0x361f16;return db[_0x4522('0x3b')][_0x4522('0x5c')]({'where':{'id':_0x528fab['params']['id']}})['then'](handleEntityNotFound(_0x462ef9,null))[_0x4522('0x33')](function(_0x3634b2){if(_0x3634b2){_0x240113=_0x3634b2;_0x17ae16['model']=_[_0x4522('0x55')](db[_0x4522('0x5d')][_0x4522('0x3c')]);_0x17ae16['query']=_['keys'](_0x528fab[_0x4522('0x41')]);_0x17ae16['filters']=_[_0x4522('0x56')](_0x17ae16[_0x4522('0x40')],_0x17ae16[_0x4522('0x41')]);_0x2c953c[_0x4522('0x44')]=_[_0x4522('0x56')](_0x17ae16['model'],qs[_0x4522('0x43')](_0x528fab[_0x4522('0x41')][_0x4522('0x43')]));_0x2c953c[_0x4522('0x44')]=_0x2c953c[_0x4522('0x44')]['length']?_0x2c953c[_0x4522('0x44')]:_0x17ae16[_0x4522('0x40')];_0x2c953c[_0x4522('0x48')]=qs[_0x4522('0x49')](_0x528fab['query']['sort']);_0x2c953c['where']=qs[_0x4522('0x42')](_['pick'](_0x528fab[_0x4522('0x41')],_0x17ae16[_0x4522('0x42')]));if(_0x528fab[_0x4522('0x41')][_0x4522('0x4c')]){_0x2c953c[_0x4522('0x4a')]=_[_0x4522('0x4d')](_0x2c953c[_0x4522('0x4a')],{'$or':_['map'](_0x2c953c[_0x4522('0x44')],function(_0x3c0e68){var _0x4ba336={};_0x4ba336[_0x3c0e68]={'$like':'%'+_0x528fab[_0x4522('0x41')][_0x4522('0x4c')]+'%'};return _0x4ba336;})});}_0x2c953c=_[_0x4522('0x4d')]({},_0x2c953c,_0x528fab[_0x4522('0x4e')]);return _0x240113[_0x4522('0x5b')](_0x2c953c);}})[_0x4522('0x33')](function(_0x58d4e5){if(_0x58d4e5){_0x361f16=_0x58d4e5[_0x4522('0x45')];if(!_0x528fab[_0x4522('0x41')][_0x4522('0x46')](_0x4522('0x47'))){_0x2c953c[_0x4522('0x2c')]=qs[_0x4522('0x2c')](_0x528fab['query'][_0x4522('0x2c')]);_0x2c953c['offset']=qs['offset'](_0x528fab['query'][_0x4522('0x2b')]);}return _0x240113['getFields'](_0x2c953c);}})[_0x4522('0x33')](function(_0x130573){if(_0x130573){return _0x130573?{'count':_0x361f16,'rows':_0x130573}:null;}})[_0x4522('0x33')](respondWithResult(_0x462ef9,null))[_0x4522('0x28')](handleError(_0x462ef9,null));};exports[_0x4522('0x5e')]=function(_0x4ef69e,_0x82a240,_0x46776b){var _0x49a310={};var _0x48ad24={};var _0x50c349;var _0x5a77b8;return db[_0x4522('0x3b')][_0x4522('0x5c')]({'where':{'id':_0x4ef69e[_0x4522('0x54')]['id']}})[_0x4522('0x33')](handleEntityNotFound(_0x82a240,null))['then'](function(_0x4c311f){if(_0x4c311f){_0x50c349=_0x4c311f;_0x48ad24['model']=_[_0x4522('0x55')](db[_0x4522('0x5d')][_0x4522('0x3c')]);_0x48ad24[_0x4522('0x41')]=_[_0x4522('0x55')](_0x4ef69e[_0x4522('0x41')]);_0x48ad24['filters']=_[_0x4522('0x56')](_0x48ad24[_0x4522('0x40')],_0x48ad24[_0x4522('0x41')]);_0x49a310[_0x4522('0x44')]=_[_0x4522('0x56')](_0x48ad24[_0x4522('0x40')],qs[_0x4522('0x43')](_0x4ef69e['query'][_0x4522('0x43')]));_0x49a310[_0x4522('0x44')]=_0x49a310[_0x4522('0x44')][_0x4522('0x45')]?_0x49a310['attributes']:_0x48ad24[_0x4522('0x40')];_0x49a310[_0x4522('0x48')]=qs[_0x4522('0x49')](_0x4ef69e['query'][_0x4522('0x49')]);_0x49a310[_0x4522('0x4a')]=qs[_0x4522('0x42')](_[_0x4522('0x4b')](_0x4ef69e['query'],_0x48ad24[_0x4522('0x42')]));if(_0x4ef69e[_0x4522('0x41')][_0x4522('0x4c')]){_0x49a310[_0x4522('0x4a')]=_[_0x4522('0x4d')](_0x49a310[_0x4522('0x4a')],{'$or':_[_0x4522('0x3a')](_0x49a310[_0x4522('0x44')],function(_0x4820cf){var _0x25b400={};_0x25b400[_0x4820cf]={'$like':'%'+_0x4ef69e['query'][_0x4522('0x4c')]+'%'};return _0x25b400;})});}_0x49a310=_[_0x4522('0x4d')]({},_0x49a310,_0x4ef69e[_0x4522('0x4e')]);return _0x50c349['getSubjects'](_0x49a310);}})[_0x4522('0x33')](function(_0x1d962d){if(_0x1d962d){_0x5a77b8=_0x1d962d[_0x4522('0x45')];if(!_0x4ef69e[_0x4522('0x41')][_0x4522('0x46')](_0x4522('0x47'))){_0x49a310['limit']=qs[_0x4522('0x2c')](_0x4ef69e[_0x4522('0x41')][_0x4522('0x2c')]);_0x49a310['offset']=qs[_0x4522('0x2b')](_0x4ef69e['query']['offset']);}return _0x50c349[_0x4522('0x5e')](_0x49a310);}})[_0x4522('0x33')](function(_0xa50c46){if(_0xa50c46){return _0xa50c46?{'count':_0x5a77b8,'rows':_0xa50c46}:null;}})['then'](respondWithResult(_0x82a240,null))['catch'](handleError(_0x82a240,null));};exports[_0x4522('0x5f')]=function(_0x24b03e,_0x2b0bc7,_0x13b7ed){var _0x147126={};var _0x517b5b={};var _0x138e04;var _0x383d05;return db['SugarcrmConfiguration'][_0x4522('0x5c')]({'where':{'id':_0x24b03e[_0x4522('0x54')]['id']}})[_0x4522('0x33')](handleEntityNotFound(_0x2b0bc7,null))[_0x4522('0x33')](function(_0xf29c15){if(_0xf29c15){_0x138e04=_0xf29c15;_0x517b5b[_0x4522('0x40')]=_[_0x4522('0x55')](db[_0x4522('0x5d')]['rawAttributes']);_0x517b5b[_0x4522('0x41')]=_[_0x4522('0x55')](_0x24b03e['query']);_0x517b5b[_0x4522('0x42')]=_[_0x4522('0x56')](_0x517b5b[_0x4522('0x40')],_0x517b5b[_0x4522('0x41')]);_0x147126[_0x4522('0x44')]=_[_0x4522('0x56')](_0x517b5b[_0x4522('0x40')],qs['fields'](_0x24b03e[_0x4522('0x41')][_0x4522('0x43')]));_0x147126[_0x4522('0x44')]=_0x147126['attributes'][_0x4522('0x45')]?_0x147126['attributes']:_0x517b5b[_0x4522('0x40')];_0x147126['order']=qs[_0x4522('0x49')](_0x24b03e[_0x4522('0x41')][_0x4522('0x49')]);_0x147126['where']=qs[_0x4522('0x42')](_[_0x4522('0x4b')](_0x24b03e[_0x4522('0x41')],_0x517b5b['filters']));if(_0x24b03e[_0x4522('0x41')][_0x4522('0x4c')]){_0x147126[_0x4522('0x4a')]=_[_0x4522('0x4d')](_0x147126[_0x4522('0x4a')],{'$or':_[_0x4522('0x3a')](_0x147126[_0x4522('0x44')],function(_0x5aa03c){var _0x34ecaf={};_0x34ecaf[_0x5aa03c]={'$like':'%'+_0x24b03e['query'][_0x4522('0x4c')]+'%'};return _0x34ecaf;})});}_0x147126=_[_0x4522('0x4d')]({},_0x147126,_0x24b03e[_0x4522('0x4e')]);return _0x138e04[_0x4522('0x5f')](_0x147126);}})[_0x4522('0x33')](function(_0x5063d7){if(_0x5063d7){_0x383d05=_0x5063d7['length'];if(!_0x24b03e[_0x4522('0x41')][_0x4522('0x46')](_0x4522('0x47'))){_0x147126[_0x4522('0x2c')]=qs[_0x4522('0x2c')](_0x24b03e[_0x4522('0x41')][_0x4522('0x2c')]);_0x147126['offset']=qs[_0x4522('0x2b')](_0x24b03e[_0x4522('0x41')][_0x4522('0x2b')]);}return _0x138e04['getDescriptions'](_0x147126);}})[_0x4522('0x33')](function(_0x2f3cf9){if(_0x2f3cf9){return _0x2f3cf9?{'count':_0x383d05,'rows':_0x2f3cf9}:null;}})[_0x4522('0x33')](respondWithResult(_0x2b0bc7,null))[_0x4522('0x28')](handleError(_0x2b0bc7,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 7a18cd6..090e50c 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 _0xd08e=['request-promise','rimraf','../../config/environment','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x5e3506,_0x32ea1d){var _0x3a5414=function(_0x30ee1d){while(--_0x30ee1d){_0x5e3506['push'](_0x5e3506['shift']());}};_0x3a5414(++_0x32ea1d);}(_0xd08e,0xdf));var _0xed08=function(_0x409353,_0xe9f04d){_0x409353=_0x409353-0x0;var _0x4f4b59=_0xd08e[_0x409353];return _0x4f4b59;};'use strict';var _=require(_0xed08('0x0'));var util=require(_0xed08('0x1'));var logger=require(_0xed08('0x2'))('api');var moment=require(_0xed08('0x3'));var BPromise=require(_0xed08('0x4'));var rp=require(_0xed08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xed08('0x6'));var config=require(_0xed08('0x7'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0xed08('0x8')]=function(_0xaad68f,_0x541fc2){return _0xaad68f[_0xed08('0x9')](_0xed08('0xa'),attributes,{'tableName':_0xed08('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x98df=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','SugarcrmConfiguration','int_sugarcrm_configurations','lodash','util','../../config/logger','api'];(function(_0xa8aa3c,_0x1a6859){var _0x33a6f8=function(_0x1fce03){while(--_0x1fce03){_0xa8aa3c['push'](_0xa8aa3c['shift']());}};_0x33a6f8(++_0x1a6859);}(_0x98df,0xce));var _0xf98d=function(_0x34a087,_0x167f6e){_0x34a087=_0x34a087-0x0;var _0x2dcf8b=_0x98df[_0x34a087];return _0x2dcf8b;};'use strict';var _=require(_0xf98d('0x0'));var util=require(_0xf98d('0x1'));var logger=require(_0xf98d('0x2'))(_0xf98d('0x3'));var moment=require(_0xf98d('0x4'));var BPromise=require(_0xf98d('0x5'));var rp=require(_0xf98d('0x6'));var fs=require('fs');var path=require(_0xf98d('0x7'));var rimraf=require(_0xf98d('0x8'));var config=require(_0xf98d('0x9'));var attributes=require(_0xf98d('0xa'));module[_0xf98d('0xb')]=function(_0x471ad3,_0x22e5f8){return _0x471ad3[_0xf98d('0xc')](_0xf98d('0xd'),attributes,{'tableName':_0xf98d('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 f0668b1..4f92538 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 _0xade0=['../../config/environment','client','request','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x55ff79,_0x3d45e7){var _0x579067=function(_0x3650e4){while(--_0x3650e4){_0x55ff79['push'](_0x55ff79['shift']());}};_0x579067(++_0x3d45e7);}(_0xade0,0x1f1));var _0x0ade=function(_0x13cab0,_0x14d825){_0x13cab0=_0x13cab0-0x0;var _0x38804f=_0xade0[_0x13cab0];return _0x38804f;};'use strict';var _=require(_0x0ade('0x0'));var util=require(_0x0ade('0x1'));var moment=require(_0x0ade('0x2'));var BPromise=require(_0x0ade('0x3'));var rs=require(_0x0ade('0x4'));var fs=require('fs');var Redis=require(_0x0ade('0x5'));var db=require(_0x0ade('0x6'))['db'];var utils=require(_0x0ade('0x7'));var logger=require('../../config/logger')(_0x0ade('0x8'));var config=require(_0x0ade('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x0ade('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x184949,_0x2a8863,_0x2819a6){return new BPromise(function(_0x41cf35,_0x28b269){return client[_0x0ade('0xb')](_0x184949,_0x2819a6)['then'](function(_0x2648c8){logger[_0x0ade('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a8863,_0x0ade('0xd'));logger[_0x0ade('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2a8863,'request\x20sent',JSON[_0x0ade('0xf')](_0x2648c8));if(_0x2648c8[_0x0ade('0x10')]){if(_0x2648c8[_0x0ade('0x10')][_0x0ade('0x11')]===0x1f4){logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x2a8863,_0x2648c8[_0x0ade('0x10')]['message']);return _0x28b269(_0x2648c8[_0x0ade('0x10')]['message']);}logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x2a8863,_0x2648c8[_0x0ade('0x10')][_0x0ade('0x13')]);return _0x41cf35(_0x2648c8[_0x0ade('0x10')][_0x0ade('0x13')]);}else{logger[_0x0ade('0xc')](_0x0ade('0x12'),_0x2a8863,'request\x20sent');_0x41cf35(_0x2648c8[_0x0ade('0x14')][_0x0ade('0x13')]);}})[_0x0ade('0x15')](function(_0x47ebec){logger[_0x0ade('0x10')](_0x0ade('0x12'),_0x2a8863,_0x47ebec);_0x28b269(_0x47ebec);});});} \ No newline at end of file +var _0x8122=['result','catch','lodash','moment','bluebird','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message'];(function(_0x934754,_0x15bd40){var _0x5cf1fc=function(_0x2c1de6){while(--_0x2c1de6){_0x934754['push'](_0x934754['shift']());}};_0x5cf1fc(++_0x15bd40);}(_0x8122,0x156));var _0x2812=function(_0x5137a6,_0x40715c){_0x5137a6=_0x5137a6-0x0;var _0x349c7a=_0x8122[_0x5137a6];return _0x349c7a;};'use strict';var _=require(_0x2812('0x0'));var util=require('util');var moment=require(_0x2812('0x1'));var BPromise=require(_0x2812('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2812('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2812('0x4'))(_0x2812('0x5'));var config=require(_0x2812('0x6'));var jayson=require(_0x2812('0x7'));var client=jayson['client'][_0x2812('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x415f43,_0x2a27d5,_0x24c0b4){return new BPromise(function(_0x31bfae,_0x3daae1){return client[_0x2812('0x9')](_0x415f43,_0x24c0b4)['then'](function(_0x58b7f0){logger[_0x2812('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a27d5,_0x2812('0xb'));logger[_0x2812('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s,\x20%s',_0x2a27d5,_0x2812('0xb'),JSON[_0x2812('0xd')](_0x58b7f0));if(_0x58b7f0[_0x2812('0xe')]){if(_0x58b7f0[_0x2812('0xe')][_0x2812('0xf')]===0x1f4){logger[_0x2812('0xe')](_0x2812('0x10'),_0x2a27d5,_0x58b7f0['error'][_0x2812('0x11')]);return _0x3daae1(_0x58b7f0[_0x2812('0xe')]['message']);}logger[_0x2812('0xe')](_0x2812('0x10'),_0x2a27d5,_0x58b7f0[_0x2812('0xe')][_0x2812('0x11')]);return _0x31bfae(_0x58b7f0[_0x2812('0xe')]['message']);}else{logger[_0x2812('0xa')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a27d5,_0x2812('0xb'));_0x31bfae(_0x58b7f0[_0x2812('0x12')][_0x2812('0x11')]);}})[_0x2812('0x13')](function(_0x358cbc){logger[_0x2812('0xe')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2a27d5,_0x358cbc);_0x3daae1(_0x358cbc);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 786eff0..6bb740a 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 _0x4ec4=['post','create','put','update','destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmField.controller','isAuthenticated','index','/:id','show'];(function(_0x1e27b6,_0x4864bf){var _0x1e8cbd=function(_0x50078e){while(--_0x50078e){_0x1e27b6['push'](_0x1e27b6['shift']());}};_0x1e8cbd(++_0x4864bf);}(_0x4ec4,0x125));var _0x44ec=function(_0x12fb36,_0x2285e9){_0x12fb36=_0x12fb36-0x0;var _0x37952d=_0x4ec4[_0x12fb36];return _0x37952d;};'use strict';var multer=require(_0x44ec('0x0'));var util=require(_0x44ec('0x1'));var path=require(_0x44ec('0x2'));var timeout=require('connect-timeout');var express=require(_0x44ec('0x3'));var router=express[_0x44ec('0x4')]();var auth=require(_0x44ec('0x5'));var interaction=require(_0x44ec('0x6'));var config=require(_0x44ec('0x7'));var controller=require(_0x44ec('0x8'));router['get']('/',auth[_0x44ec('0x9')](),controller[_0x44ec('0xa')]);router['get'](_0x44ec('0xb'),auth[_0x44ec('0x9')](),controller[_0x44ec('0xc')]);router[_0x44ec('0xd')]('/',auth[_0x44ec('0x9')](),controller[_0x44ec('0xe')]);router[_0x44ec('0xf')]('/:id',auth[_0x44ec('0x9')](),controller[_0x44ec('0x10')]);router['delete'](_0x44ec('0xb'),auth['isAuthenticated'](),controller[_0x44ec('0x11')]);module['exports']=router; \ No newline at end of file +var _0x9fd4=['path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x5a6b45,_0x48fea6){var _0x2ad452=function(_0x57381c){while(--_0x57381c){_0x5a6b45['push'](_0x5a6b45['shift']());}};_0x2ad452(++_0x48fea6);}(_0x9fd4,0x1ae));var _0x49fd=function(_0x119172,_0x3e83f2){_0x119172=_0x119172-0x0;var _0x1498a8=_0x9fd4[_0x119172];return _0x1498a8;};'use strict';var multer=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var path=require(_0x49fd('0x2'));var timeout=require('connect-timeout');var express=require(_0x49fd('0x3'));var router=express[_0x49fd('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x49fd('0x5'));var config=require(_0x49fd('0x6'));var controller=require('./intSugarcrmField.controller');router[_0x49fd('0x7')]('/',auth[_0x49fd('0x8')](),controller['index']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x49fd('0x9')]);router[_0x49fd('0xa')]('/',auth[_0x49fd('0x8')](),controller[_0x49fd('0xb')]);router[_0x49fd('0xc')](_0x49fd('0xd'),auth[_0x49fd('0x8')](),controller[_0x49fd('0xe')]);router[_0x49fd('0xf')](_0x49fd('0xd'),auth['isAuthenticated'](),controller[_0x49fd('0x10')]);module[_0x49fd('0x11')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index da08ef3..33c6128 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 _0xb205=['string','customVariable','keyValue','STRING','variable','BOOLEAN','sequelize','ENUM'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xb205,0x156));var _0x5b20=function(_0x119bf7,_0x88d576){_0x119bf7=_0x119bf7-0x0;var _0x12fbff=_0xb205[_0x119bf7];return _0x12fbff;};'use strict';var Sequelize=require(_0x5b20('0x0'));module['exports']={'type':{'type':Sequelize[_0x5b20('0x1')](_0x5b20('0x2'),'variable',_0x5b20('0x3'),_0x5b20('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x5b20('0x5')]},'key':{'type':Sequelize[_0x5b20('0x5')]},'keyType':{'type':Sequelize[_0x5b20('0x1')](_0x5b20('0x2'),_0x5b20('0x6'),_0x5b20('0x3'))},'keyContent':{'type':Sequelize[_0x5b20('0x5')]},'idField':{'type':Sequelize[_0x5b20('0x5')]},'nameField':{'type':Sequelize[_0x5b20('0x5')]},'customField':{'type':Sequelize[_0x5b20('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x5b20('0x5')]}}; \ No newline at end of file +var _0x1413=['keyValue','STRING','exports','ENUM','string','variable'];(function(_0x55e61f,_0xf21352){var _0xd297bc=function(_0x1b61d3){while(--_0x1b61d3){_0x55e61f['push'](_0x55e61f['shift']());}};_0xd297bc(++_0xf21352);}(_0x1413,0x170));var _0x3141=function(_0x39f50f,_0x157429){_0x39f50f=_0x39f50f-0x0;var _0x22a4f9=_0x1413[_0x39f50f];return _0x22a4f9;};'use strict';var Sequelize=require('sequelize');module[_0x3141('0x0')]={'type':{'type':Sequelize[_0x3141('0x1')](_0x3141('0x2'),_0x3141('0x3'),'customVariable',_0x3141('0x4')),'defaultValue':_0x3141('0x2')},'content':{'type':Sequelize[_0x3141('0x5')]},'key':{'type':Sequelize[_0x3141('0x5')]},'keyType':{'type':Sequelize[_0x3141('0x1')]('string',_0x3141('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x3141('0x5')]},'idField':{'type':Sequelize[_0x3141('0x5')]},'nameField':{'type':Sequelize[_0x3141('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3141('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index b619597..d7b5b00 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 _0x1ffa=['error','stack','name','index','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','model','attributes','intersection','fields','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus'];(function(_0x3297b8,_0x17ce35){var _0x2066de=function(_0x4750c3){while(--_0x4750c3){_0x3297b8['push'](_0x3297b8['shift']());}};_0x2066de(++_0x17ce35);}(_0x1ffa,0x101));var _0xa1ff=function(_0x3d823b,_0x245c0d){_0x3d823b=_0x3d823b-0x0;var _0x1c23cd=_0x1ffa[_0x3d823b];return _0x1c23cd;};'use strict';var pdf=require(_0xa1ff('0x0'));var emlformat=require(_0xa1ff('0x1'));var rimraf=require(_0xa1ff('0x2'));var zipdir=require(_0xa1ff('0x3'));var jsonpatch=require(_0xa1ff('0x4'));var rp=require(_0xa1ff('0x5'));var moment=require(_0xa1ff('0x6'));var BPromise=require(_0xa1ff('0x7'));var Mustache=require(_0xa1ff('0x8'));var util=require(_0xa1ff('0x9'));var path=require(_0xa1ff('0xa'));var sox=require('sox');var csv=require(_0xa1ff('0xb'));var ejs=require(_0xa1ff('0xc'));var fs=require('fs');var _=require(_0xa1ff('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xa1ff('0xe'));var toCsv=require(_0xa1ff('0xb'));var querystring=require(_0xa1ff('0xf'));var Papa=require(_0xa1ff('0x10'));var Redis=require(_0xa1ff('0x11'));var authService=require(_0xa1ff('0x12'));var qs=require(_0xa1ff('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa1ff('0x14'));var logger=require(_0xa1ff('0x15'))(_0xa1ff('0x16'));var utils=require(_0xa1ff('0x17'));var config=require('../../config/environment');var db=require(_0xa1ff('0x18'))['db'];function respondWithStatusCode(_0x2a28ea,_0x4e050e){_0x4e050e=_0x4e050e||0xcc;return function(_0x118a46){if(_0x118a46){return _0x2a28ea['sendStatus'](_0x4e050e);}return _0x2a28ea['status'](_0x4e050e)[_0xa1ff('0x19')]();};}function respondWithResult(_0x19357c,_0x55d494){_0x55d494=_0x55d494||0xc8;return function(_0x5900a7){if(_0x5900a7){return _0x19357c[_0xa1ff('0x1a')](_0x55d494)[_0xa1ff('0x1b')](_0x5900a7);}};}function respondWithFilteredResult(_0x3971b4,_0x81c7d8){return function(_0x51f0a0){if(_0x51f0a0){var _0x3fbfb1=_0x51f0a0[_0xa1ff('0x1c')],_0x211e43=_0x81c7d8['offset'],_0x22b9e5=_0x81c7d8[_0xa1ff('0x1d')]+_0x81c7d8['limit'],_0x59ae03;if(_0x22b9e5>=_0x3fbfb1){_0x22b9e5=_0x3fbfb1;_0x59ae03=0xc8;}else{_0x59ae03=0xce;}_0x3971b4[_0xa1ff('0x1a')](_0x59ae03);return _0x3971b4[_0xa1ff('0x1e')](_0xa1ff('0x1f'),_0x211e43+'-'+_0x22b9e5+'/'+_0x3fbfb1)[_0xa1ff('0x1b')](_0x51f0a0);}return null;};}function patchUpdates(_0x29ce82){return function(_0x4bd0ff){try{jsonpatch[_0xa1ff('0x20')](_0x4bd0ff,_0x29ce82,!![]);}catch(_0x4f1941){return BPromise[_0xa1ff('0x21')](_0x4f1941);}return _0x4bd0ff[_0xa1ff('0x22')]();};}function saveUpdates(_0x5a7c1c,_0x3f2cf3){return function(_0x2f68c6){if(_0x2f68c6){return _0x2f68c6[_0xa1ff('0x23')](_0x5a7c1c)['then'](function(_0x55b38a){return _0x55b38a;});}return null;};}function removeEntity(_0x4815c7,_0x13f721){return function(_0x48475b){if(_0x48475b){return _0x48475b[_0xa1ff('0x24')]()[_0xa1ff('0x25')](function(){_0x4815c7[_0xa1ff('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c6647,_0x23e3c6){return function(_0x4b29d8){if(!_0x4b29d8){_0x4c6647[_0xa1ff('0x26')](0x194);}return _0x4b29d8;};}function handleError(_0x39678a,_0x47db35){_0x47db35=_0x47db35||0x1f4;return function(_0x2f24bb){logger[_0xa1ff('0x27')](_0x2f24bb[_0xa1ff('0x28')]);if(_0x2f24bb[_0xa1ff('0x29')]){delete _0x2f24bb[_0xa1ff('0x29')];}_0x39678a[_0xa1ff('0x1a')](_0x47db35)['send'](_0x2f24bb);};}exports[_0xa1ff('0x2a')]=function(_0x28935d,_0x8d6c85){var _0x1b7372={},_0x3f50b9={},_0x5e904b={'count':0x0,'rows':[]};var _0x2e1e6d=_[_0xa1ff('0x2b')](db[_0xa1ff('0x2c')][_0xa1ff('0x2d')],function(_0x3a39be){return{'name':_0x3a39be[_0xa1ff('0x2e')],'type':_0x3a39be[_0xa1ff('0x2f')][_0xa1ff('0x30')]};});_0x3f50b9['model']=_[_0xa1ff('0x2b')](_0x2e1e6d,_0xa1ff('0x29'));_0x3f50b9[_0xa1ff('0x31')]=_['keys'](_0x28935d[_0xa1ff('0x31')]);_0x3f50b9[_0xa1ff('0x32')]=_['intersection'](_0x3f50b9[_0xa1ff('0x33')],_0x3f50b9[_0xa1ff('0x31')]);_0x1b7372[_0xa1ff('0x34')]=_[_0xa1ff('0x35')](_0x3f50b9[_0xa1ff('0x33')],qs[_0xa1ff('0x36')](_0x28935d[_0xa1ff('0x31')]['fields']));_0x1b7372[_0xa1ff('0x34')]=_0x1b7372[_0xa1ff('0x34')]['length']?_0x1b7372[_0xa1ff('0x34')]:_0x3f50b9[_0xa1ff('0x33')];if(!_0x28935d[_0xa1ff('0x31')]['hasOwnProperty'](_0xa1ff('0x37'))){_0x1b7372[_0xa1ff('0x38')]=qs['limit'](_0x28935d['query']['limit']);_0x1b7372['offset']=qs['offset'](_0x28935d['query'][_0xa1ff('0x1d')]);}_0x1b7372[_0xa1ff('0x39')]=qs[_0xa1ff('0x3a')](_0x28935d[_0xa1ff('0x31')]['sort']);_0x1b7372[_0xa1ff('0x3b')]=qs[_0xa1ff('0x32')](_['pick'](_0x28935d[_0xa1ff('0x31')],_0x3f50b9['filters']));if(_0x28935d[_0xa1ff('0x31')][_0xa1ff('0x3c')]){_0x1b7372[_0xa1ff('0x3b')]=_[_0xa1ff('0x3d')](_0x1b7372[_0xa1ff('0x3b')],{'$or':_[_0xa1ff('0x2b')](_0x2e1e6d,function(_0x210845){if(_0x210845[_0xa1ff('0x2f')]!==_0xa1ff('0x3e')){var _0xd9cd07={};_0xd9cd07[_0x210845[_0xa1ff('0x29')]]={'$like':'%'+_0x28935d['query'][_0xa1ff('0x3c')]+'%'};return _0xd9cd07;}})});}_0x1b7372=_[_0xa1ff('0x3d')]({},_0x1b7372,_0x28935d[_0xa1ff('0x3f')]);var _0xd1c3ea={'where':_0x1b7372[_0xa1ff('0x3b')]};return db['SugarcrmField'][_0xa1ff('0x1c')](_0xd1c3ea)[_0xa1ff('0x25')](function(_0x58c4f5){_0x5e904b[_0xa1ff('0x1c')]=_0x58c4f5;if(_0x28935d['query'][_0xa1ff('0x40')]){_0x1b7372[_0xa1ff('0x41')]=[{'all':!![]}];}return db[_0xa1ff('0x2c')][_0xa1ff('0x42')](_0x1b7372);})[_0xa1ff('0x25')](function(_0x1a9aeb){_0x5e904b[_0xa1ff('0x43')]=_0x1a9aeb;return _0x5e904b;})['then'](respondWithFilteredResult(_0x8d6c85,_0x1b7372))[_0xa1ff('0x44')](handleError(_0x8d6c85,null));};exports[_0xa1ff('0x45')]=function(_0x18291e,_0x319b4d){var _0x2df09e={'raw':!![],'where':{'id':_0x18291e['params']['id']}},_0x30b838={};_0x30b838[_0xa1ff('0x33')]=_['keys'](db[_0xa1ff('0x2c')]['rawAttributes']);_0x30b838[_0xa1ff('0x31')]=_['keys'](_0x18291e[_0xa1ff('0x31')]);_0x30b838[_0xa1ff('0x32')]=_['intersection'](_0x30b838['model'],_0x30b838[_0xa1ff('0x31')]);_0x2df09e[_0xa1ff('0x34')]=_[_0xa1ff('0x35')](_0x30b838[_0xa1ff('0x33')],qs[_0xa1ff('0x36')](_0x18291e['query'][_0xa1ff('0x36')]));_0x2df09e[_0xa1ff('0x34')]=_0x2df09e[_0xa1ff('0x34')]['length']?_0x2df09e[_0xa1ff('0x34')]:_0x30b838['model'];if(_0x18291e[_0xa1ff('0x31')][_0xa1ff('0x40')]){_0x2df09e['include']=[{'all':!![]}];}_0x2df09e=_[_0xa1ff('0x3d')]({},_0x2df09e,_0x18291e[_0xa1ff('0x3f')]);return db[_0xa1ff('0x2c')][_0xa1ff('0x46')](_0x2df09e)[_0xa1ff('0x25')](handleEntityNotFound(_0x319b4d,null))['then'](respondWithResult(_0x319b4d,null))[_0xa1ff('0x44')](handleError(_0x319b4d,null));};exports['create']=function(_0x1366d7,_0x3620d7){return db[_0xa1ff('0x2c')][_0xa1ff('0x47')](_0x1366d7[_0xa1ff('0x48')],{})[_0xa1ff('0x25')](respondWithResult(_0x3620d7,0xc9))[_0xa1ff('0x44')](handleError(_0x3620d7,null));};exports[_0xa1ff('0x23')]=function(_0x5eca7f,_0x3796cc){if(_0x5eca7f[_0xa1ff('0x48')]['id']){delete _0x5eca7f['body']['id'];}return db[_0xa1ff('0x2c')][_0xa1ff('0x46')]({'where':{'id':_0x5eca7f[_0xa1ff('0x49')]['id']}})[_0xa1ff('0x25')](handleEntityNotFound(_0x3796cc,null))['then'](saveUpdates(_0x5eca7f[_0xa1ff('0x48')],null))[_0xa1ff('0x25')](respondWithResult(_0x3796cc,null))[_0xa1ff('0x44')](handleError(_0x3796cc,null));};exports[_0xa1ff('0x24')]=function(_0x1dad95,_0x32d43f){return db[_0xa1ff('0x2c')][_0xa1ff('0x46')]({'where':{'id':_0x1dad95[_0xa1ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x32d43f,null))[_0xa1ff('0x25')](removeEntity(_0x32d43f,null))[_0xa1ff('0x44')](handleError(_0x32d43f,null));}; \ No newline at end of file +var _0x60f9=['rawAttributes','fieldName','key','model','query','intersection','attributes','fields','nolimit','order','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','rows','show','params','length','includeAll','catch','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','SugarcrmField'];(function(_0x5ea7e0,_0x2f46f2){var _0x1c49c7=function(_0x13db9e){while(--_0x13db9e){_0x5ea7e0['push'](_0x5ea7e0['shift']());}};_0x1c49c7(++_0x2f46f2);}(_0x60f9,0xb2));var _0x960f=function(_0x46b4ab,_0x128023){_0x46b4ab=_0x46b4ab-0x0;var _0x360dc4=_0x60f9[_0x46b4ab];return _0x360dc4;};'use strict';var pdf=require(_0x960f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x960f('0x1'));var zipdir=require(_0x960f('0x2'));var jsonpatch=require(_0x960f('0x3'));var rp=require('request-promise');var moment=require(_0x960f('0x4'));var BPromise=require(_0x960f('0x5'));var Mustache=require(_0x960f('0x6'));var util=require(_0x960f('0x7'));var path=require('path');var sox=require(_0x960f('0x8'));var csv=require(_0x960f('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x960f('0xa'));var crypto=require(_0x960f('0xb'));var jsforce=require(_0x960f('0xc'));var deskjs=require(_0x960f('0xd'));var toCsv=require(_0x960f('0x9'));var querystring=require(_0x960f('0xe'));var Papa=require(_0x960f('0xf'));var Redis=require(_0x960f('0x10'));var authService=require(_0x960f('0x11'));var qs=require(_0x960f('0x12'));var as=require(_0x960f('0x13'));var hardwareService=require(_0x960f('0x14'));var logger=require(_0x960f('0x15'))(_0x960f('0x16'));var utils=require(_0x960f('0x17'));var config=require(_0x960f('0x18'));var db=require(_0x960f('0x19'))['db'];function respondWithStatusCode(_0x45e9ce,_0x119707){_0x119707=_0x119707||0xcc;return function(_0x58e11d){if(_0x58e11d){return _0x45e9ce[_0x960f('0x1a')](_0x119707);}return _0x45e9ce[_0x960f('0x1b')](_0x119707)[_0x960f('0x1c')]();};}function respondWithResult(_0x4e2972,_0x46ba79){_0x46ba79=_0x46ba79||0xc8;return function(_0x4b8b83){if(_0x4b8b83){return _0x4e2972[_0x960f('0x1b')](_0x46ba79)[_0x960f('0x1d')](_0x4b8b83);}};}function respondWithFilteredResult(_0x3b95bf,_0x8f7e53){return function(_0x13fb2c){if(_0x13fb2c){var _0x56bbb1=_0x13fb2c[_0x960f('0x1e')],_0x3bdbbe=_0x8f7e53[_0x960f('0x1f')],_0x5a89e2=_0x8f7e53[_0x960f('0x1f')]+_0x8f7e53[_0x960f('0x20')],_0x4eaca6;if(_0x5a89e2>=_0x56bbb1){_0x5a89e2=_0x56bbb1;_0x4eaca6=0xc8;}else{_0x4eaca6=0xce;}_0x3b95bf[_0x960f('0x1b')](_0x4eaca6);return _0x3b95bf[_0x960f('0x21')](_0x960f('0x22'),_0x3bdbbe+'-'+_0x5a89e2+'/'+_0x56bbb1)[_0x960f('0x1d')](_0x13fb2c);}return null;};}function patchUpdates(_0x4c6f4e){return function(_0x512b4e){try{jsonpatch[_0x960f('0x23')](_0x512b4e,_0x4c6f4e,!![]);}catch(_0xc5445c){return BPromise['reject'](_0xc5445c);}return _0x512b4e[_0x960f('0x24')]();};}function saveUpdates(_0x20560d,_0x41c985){return function(_0x96be6d){if(_0x96be6d){return _0x96be6d[_0x960f('0x25')](_0x20560d)[_0x960f('0x26')](function(_0x2fa411){return _0x2fa411;});}return null;};}function removeEntity(_0x437ea6,_0x4f47ae){return function(_0x5b33cb){if(_0x5b33cb){return _0x5b33cb[_0x960f('0x27')]()['then'](function(){_0x437ea6[_0x960f('0x1b')](0xcc)[_0x960f('0x1c')]();});}};}function handleEntityNotFound(_0x5aa502,_0x2f9aab){return function(_0x4b3215){if(!_0x4b3215){_0x5aa502[_0x960f('0x1a')](0x194);}return _0x4b3215;};}function handleError(_0x4c8131,_0x315f8a){_0x315f8a=_0x315f8a||0x1f4;return function(_0x4a4053){logger[_0x960f('0x28')](_0x4a4053[_0x960f('0x29')]);if(_0x4a4053[_0x960f('0x2a')]){delete _0x4a4053[_0x960f('0x2a')];}_0x4c8131[_0x960f('0x1b')](_0x315f8a)[_0x960f('0x2b')](_0x4a4053);};}exports[_0x960f('0x2c')]=function(_0x1afb44,_0x38443a){var _0x2b3535={},_0x1c2601={},_0x3d3867={'count':0x0,'rows':[]};var _0x5a972a=_[_0x960f('0x2d')](db[_0x960f('0x2e')][_0x960f('0x2f')],function(_0x2a746a){return{'name':_0x2a746a[_0x960f('0x30')],'type':_0x2a746a['type'][_0x960f('0x31')]};});_0x1c2601[_0x960f('0x32')]=_[_0x960f('0x2d')](_0x5a972a,_0x960f('0x2a'));_0x1c2601[_0x960f('0x33')]=_['keys'](_0x1afb44[_0x960f('0x33')]);_0x1c2601['filters']=_[_0x960f('0x34')](_0x1c2601[_0x960f('0x32')],_0x1c2601['query']);_0x2b3535[_0x960f('0x35')]=_[_0x960f('0x34')](_0x1c2601[_0x960f('0x32')],qs[_0x960f('0x36')](_0x1afb44[_0x960f('0x33')][_0x960f('0x36')]));_0x2b3535[_0x960f('0x35')]=_0x2b3535[_0x960f('0x35')]['length']?_0x2b3535[_0x960f('0x35')]:_0x1c2601['model'];if(!_0x1afb44['query']['hasOwnProperty'](_0x960f('0x37'))){_0x2b3535[_0x960f('0x20')]=qs[_0x960f('0x20')](_0x1afb44[_0x960f('0x33')][_0x960f('0x20')]);_0x2b3535[_0x960f('0x1f')]=qs[_0x960f('0x1f')](_0x1afb44[_0x960f('0x33')][_0x960f('0x1f')]);}_0x2b3535[_0x960f('0x38')]=qs[_0x960f('0x39')](_0x1afb44['query'][_0x960f('0x39')]);_0x2b3535[_0x960f('0x3a')]=qs[_0x960f('0x3b')](_[_0x960f('0x3c')](_0x1afb44[_0x960f('0x33')],_0x1c2601['filters']));if(_0x1afb44[_0x960f('0x33')][_0x960f('0x3d')]){_0x2b3535['where']=_[_0x960f('0x3e')](_0x2b3535[_0x960f('0x3a')],{'$or':_[_0x960f('0x2d')](_0x5a972a,function(_0x20bdd5){if(_0x20bdd5[_0x960f('0x3f')]!==_0x960f('0x40')){var _0x129098={};_0x129098[_0x20bdd5[_0x960f('0x2a')]]={'$like':'%'+_0x1afb44[_0x960f('0x33')][_0x960f('0x3d')]+'%'};return _0x129098;}})});}_0x2b3535=_['merge']({},_0x2b3535,_0x1afb44[_0x960f('0x41')]);var _0xa45bf1={'where':_0x2b3535[_0x960f('0x3a')]};return db['SugarcrmField'][_0x960f('0x1e')](_0xa45bf1)['then'](function(_0x33277f){_0x3d3867[_0x960f('0x1e')]=_0x33277f;if(_0x1afb44['query']['includeAll']){_0x2b3535['include']=[{'all':!![]}];}return db[_0x960f('0x2e')]['findAll'](_0x2b3535);})[_0x960f('0x26')](function(_0x5da2a2){_0x3d3867[_0x960f('0x42')]=_0x5da2a2;return _0x3d3867;})['then'](respondWithFilteredResult(_0x38443a,_0x2b3535))['catch'](handleError(_0x38443a,null));};exports[_0x960f('0x43')]=function(_0x33a979,_0x3896a2){var _0x4f084c={'raw':!![],'where':{'id':_0x33a979[_0x960f('0x44')]['id']}},_0x5ca350={};_0x5ca350[_0x960f('0x32')]=_['keys'](db['SugarcrmField'][_0x960f('0x2f')]);_0x5ca350['query']=_['keys'](_0x33a979[_0x960f('0x33')]);_0x5ca350[_0x960f('0x3b')]=_[_0x960f('0x34')](_0x5ca350[_0x960f('0x32')],_0x5ca350[_0x960f('0x33')]);_0x4f084c[_0x960f('0x35')]=_['intersection'](_0x5ca350[_0x960f('0x32')],qs[_0x960f('0x36')](_0x33a979[_0x960f('0x33')][_0x960f('0x36')]));_0x4f084c[_0x960f('0x35')]=_0x4f084c[_0x960f('0x35')][_0x960f('0x45')]?_0x4f084c[_0x960f('0x35')]:_0x5ca350['model'];if(_0x33a979['query'][_0x960f('0x46')]){_0x4f084c['include']=[{'all':!![]}];}_0x4f084c=_['merge']({},_0x4f084c,_0x33a979[_0x960f('0x41')]);return db[_0x960f('0x2e')]['find'](_0x4f084c)[_0x960f('0x26')](handleEntityNotFound(_0x3896a2,null))[_0x960f('0x26')](respondWithResult(_0x3896a2,null))[_0x960f('0x47')](handleError(_0x3896a2,null));};exports[_0x960f('0x48')]=function(_0x551412,_0x2d82c4){return db[_0x960f('0x2e')][_0x960f('0x48')](_0x551412[_0x960f('0x49')],{})['then'](respondWithResult(_0x2d82c4,0xc9))[_0x960f('0x47')](handleError(_0x2d82c4,null));};exports[_0x960f('0x25')]=function(_0x4cc3d0,_0x1ecaec){if(_0x4cc3d0[_0x960f('0x49')]['id']){delete _0x4cc3d0['body']['id'];}return db[_0x960f('0x2e')][_0x960f('0x4a')]({'where':{'id':_0x4cc3d0[_0x960f('0x44')]['id']}})[_0x960f('0x26')](handleEntityNotFound(_0x1ecaec,null))[_0x960f('0x26')](saveUpdates(_0x4cc3d0[_0x960f('0x49')],null))[_0x960f('0x26')](respondWithResult(_0x1ecaec,null))[_0x960f('0x47')](handleError(_0x1ecaec,null));};exports[_0x960f('0x27')]=function(_0x1b34f5,_0x5322b0){return db[_0x960f('0x2e')][_0x960f('0x4a')]({'where':{'id':_0x1b34f5[_0x960f('0x44')]['id']}})['then'](handleEntityNotFound(_0x5322b0,null))[_0x960f('0x26')](removeEntity(_0x5322b0,null))[_0x960f('0x47')](handleError(_0x5322b0,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index bebc389..32bb7ee 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 _0xb051=['exports','define','SugarcrmField','int_sugarcrm_fields','idField','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x3d78ed,_0x46ee9c){var _0x19d87d=function(_0x2c232d){while(--_0x2c232d){_0x3d78ed['push'](_0x3d78ed['shift']());}};_0x19d87d(++_0x46ee9c);}(_0xb051,0x155));var _0x1b05=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0xb051[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x1b05('0x0'));var util=require(_0x1b05('0x1'));var logger=require('../../config/logger')(_0x1b05('0x2'));var moment=require(_0x1b05('0x3'));var BPromise=require(_0x1b05('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1b05('0x5'));var rimraf=require(_0x1b05('0x6'));var config=require(_0x1b05('0x7'));var attributes=require(_0x1b05('0x8'));module[_0x1b05('0x9')]=function(_0x57ee0e,_0x1b797e){return _0x57ee0e[_0x1b05('0xa')](_0x1b05('0xb'),attributes,{'tableName':_0x1b05('0xc'),'paranoid':![],'indexes':[{'name':'sugarcrm_unique_index','fields':[_0x1b05('0xd'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xff6f=['SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird','path','rimraf','./intSugarcrmField.attributes','exports','define'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xff6f,0x17c));var _0xfff6=function(_0x418dab,_0xbf3a05){_0x418dab=_0x418dab-0x0;var _0x194a3a=_0xff6f[_0x418dab];return _0x194a3a;};'use strict';var _=require('lodash');var util=require(_0xfff6('0x0'));var logger=require(_0xfff6('0x1'))(_0xfff6('0x2'));var moment=require(_0xfff6('0x3'));var BPromise=require(_0xfff6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfff6('0x5'));var rimraf=require(_0xfff6('0x6'));var config=require('../../config/environment');var attributes=require(_0xfff6('0x7'));module[_0xfff6('0x8')]=function(_0xf89ab7,_0x5775be){return _0xf89ab7[_0xfff6('0x9')](_0xfff6('0xa'),attributes,{'tableName':_0xfff6('0xb'),'paranoid':![],'indexes':[{'name':_0xfff6('0xc'),'fields':[_0xfff6('0xd'),_0xfff6('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.rpc.js b/server/api/intSugarcrmField/intSugarcrmField.rpc.js index ea363bf..94a4ddc 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 _0xbaf0=['client','http','then','info','SugarcrmField,\x20%s,\x20%s','request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0xbaf0,0x12a));var _0x0baf=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xbaf0[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('SugarcrmField,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SugarcrmField,\x20%s,\x20%s','request\x20sent','SugarcrmField,\x20%s,\x20%s,\x20%s','error'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x8603,0x190));var _0x3860=function(_0x164e20,_0x4613da){_0x164e20=_0x164e20-0x0;var _0x185d50=_0x8603[_0x164e20];return _0x185d50;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 08b55e2..05bc17f 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 _0xd971=['create','addConfiguration','update','destroy','exports','util','connect-timeout','express','../../components/interaction/service','./intVtigerAccount.controller','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','post'];(function(_0x1e80d6,_0x2cac6d){var _0xaabe7a=function(_0x5123fa){while(--_0x5123fa){_0x1e80d6['push'](_0x1e80d6['shift']());}};_0xaabe7a(++_0x2cac6d);}(_0xd971,0x71));var _0x1d97=function(_0x5a123f,_0x14cb93){_0x5a123f=_0x5a123f-0x0;var _0x40f3e8=_0xd971[_0x5a123f];return _0x40f3e8;};'use strict';var multer=require('multer');var util=require(_0x1d97('0x0'));var path=require('path');var timeout=require(_0x1d97('0x1'));var express=require(_0x1d97('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x1d97('0x3'));var config=require('../../config/environment');var controller=require(_0x1d97('0x4'));router['get']('/',auth[_0x1d97('0x5')](),controller[_0x1d97('0x6')]);router[_0x1d97('0x7')](_0x1d97('0x8'),auth['isAuthenticated'](),controller[_0x1d97('0x9')]);router['get'](_0x1d97('0xa'),auth[_0x1d97('0x5')](),controller[_0x1d97('0xb')]);router['get']('/:id/fields',auth[_0x1d97('0x5')](),controller['getFields']);router[_0x1d97('0xc')]('/',auth[_0x1d97('0x5')](),controller[_0x1d97('0xd')]);router[_0x1d97('0xc')](_0x1d97('0xa'),auth[_0x1d97('0x5')](),controller[_0x1d97('0xe')]);router['put'](_0x1d97('0x8'),auth[_0x1d97('0x5')](),controller[_0x1d97('0xf')]);router['delete'](_0x1d97('0x8'),auth[_0x1d97('0x5')](),controller[_0x1d97('0x10')]);module[_0x1d97('0x11')]=router; \ No newline at end of file +var _0x5616=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','isAuthenticated','show','/:id/configurations','/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout'];(function(_0x34646f,_0x55a313){var _0x490624=function(_0x327c4f){while(--_0x327c4f){_0x34646f['push'](_0x34646f['shift']());}};_0x490624(++_0x55a313);}(_0x5616,0x19b));var _0x6561=function(_0x6556f3,_0x228c9c){_0x6556f3=_0x6556f3-0x0;var _0x173c20=_0x5616[_0x6556f3];return _0x173c20;};'use strict';var multer=require('multer');var util=require(_0x6561('0x0'));var path=require(_0x6561('0x1'));var timeout=require(_0x6561('0x2'));var express=require(_0x6561('0x3'));var router=express['Router']();var auth=require(_0x6561('0x4'));var interaction=require(_0x6561('0x5'));var config=require(_0x6561('0x6'));var controller=require(_0x6561('0x7'));router[_0x6561('0x8')]('/',auth[_0x6561('0x9')](),controller['index']);router[_0x6561('0x8')]('/:id',auth[_0x6561('0x9')](),controller[_0x6561('0xa')]);router['get'](_0x6561('0xb'),auth[_0x6561('0x9')](),controller['getConfigurations']);router['get'](_0x6561('0xc'),auth[_0x6561('0x9')](),controller[_0x6561('0xd')]);router[_0x6561('0xe')]('/',auth[_0x6561('0x9')](),controller[_0x6561('0xf')]);router[_0x6561('0xe')](_0x6561('0xb'),auth[_0x6561('0x9')](),controller[_0x6561('0x10')]);router[_0x6561('0x11')](_0x6561('0x12'),auth[_0x6561('0x9')](),controller[_0x6561('0x13')]);router[_0x6561('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x6561('0x15')]);module[_0x6561('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 2b03d1c..bcee120 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 _0x300f=['STRING','HelpDesk','sequelize'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0x300f,0x176));var _0xf300=function(_0x5ba6c4,_0x100ab5){_0x5ba6c4=_0x5ba6c4-0x0;var _0x11f1f0=_0x300f[_0x5ba6c4];return _0x11f1f0;};'use strict';var Sequelize=require(_0xf300('0x0'));module['exports']={'name':{'type':Sequelize[_0xf300('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xf300('0x1')]},'username':{'type':Sequelize[_0xf300('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xf300('0x1')],'allowNull':![],'defaultValue':_0xf300('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xf300('0x1')]},'accessKey':{'type':Sequelize[_0xf300('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd4ef=['HelpDesk','STRING'];(function(_0x4c083b,_0x90e77d){var _0x318bbe=function(_0x2c77e0){while(--_0x2c77e0){_0x4c083b['push'](_0x4c083b['shift']());}};_0x318bbe(++_0x90e77d);}(_0xd4ef,0x17f));var _0xfd4e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4ef[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xfd4e('0x0')]},'username':{'type':Sequelize[_0xfd4e('0x0')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfd4e('0x1')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING']},'accessKey':{'type':Sequelize[_0xfd4e('0x0')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index afc67da..d967a4f 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 _0x4632=['getConfigurations','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','username','description','moduleName','accessKey','remoteUri','slice','substring','lastIndexOf','format','%s/webservice.php','GET','POST','login','token','success','describe','sessionName','autogenerated','reference','includes','remove','editable','false','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','VtigerAccount','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','intersection','create','body','update','findOne','VtigerConfiguration','pick'];(function(_0xfac10b,_0x172584){var _0x1b1acb=function(_0x44d286){while(--_0x44d286){_0xfac10b['push'](_0xfac10b['shift']());}};_0x1b1acb(++_0x172584);}(_0x4632,0xb4));var _0x2463=function(_0xbd08b4,_0x4790ed){_0xbd08b4=_0xbd08b4-0x0;var _0x314f1e=_0x4632[_0xbd08b4];return _0x314f1e;};'use strict';var pdf=require(_0x2463('0x0'));var emlformat=require(_0x2463('0x1'));var rimraf=require(_0x2463('0x2'));var zipdir=require(_0x2463('0x3'));var jsonpatch=require(_0x2463('0x4'));var rp=require(_0x2463('0x5'));var moment=require(_0x2463('0x6'));var BPromise=require(_0x2463('0x7'));var Mustache=require(_0x2463('0x8'));var util=require(_0x2463('0x9'));var path=require('path');var sox=require(_0x2463('0xa'));var csv=require(_0x2463('0xb'));var ejs=require(_0x2463('0xc'));var fs=require('fs');var _=require(_0x2463('0xd'));var squel=require('squel');var crypto=require(_0x2463('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2463('0xf'));var Papa=require(_0x2463('0x10'));var Redis=require(_0x2463('0x11'));var authService=require(_0x2463('0x12'));var qs=require(_0x2463('0x13'));var as=require(_0x2463('0x14'));var hardwareService=require(_0x2463('0x15'));var logger=require('../../config/logger')(_0x2463('0x16'));var utils=require('../../config/utils');var config=require(_0x2463('0x17'));var db=require(_0x2463('0x18'))['db'];var integrations=require('../../components/integrations/configuration');var jayson=require('jayson/promise');var client=jayson['client'][_0x2463('0x19')]({'port':0x232a});function checkPasswordPattern(_0x21202e,_0x290736,_0x5772f8){if(_0x5772f8){var _0x373db4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x373db4[_0x2463('0x1a')](_0x290736)){return _0x21202e;}else{throw new db[(_0x2463('0x1b'))][(_0x2463('0x1c'))](_0x2463('0x1d'));}}else{return _0x21202e;}}function respondWithRpcPromise(_0x506fd7,_0x2a2c55,_0x35ab8f,_0x3685c0){return new BPromise(function(_0x45901a,_0xfed63a){var _0x52f40c=_0x3685c0||client;return _0x52f40c[_0x2463('0x1e')](_0x506fd7,_0x35ab8f)[_0x2463('0x1f')](function(_0x1355d6){logger[_0x2463('0x20')](_0x2463('0x21'),_0x2a2c55,_0x2463('0x22'));logger[_0x2463('0x23')](_0x2463('0x24'),_0x2a2c55,_0x2463('0x22'),JSON['stringify'](_0x1355d6));if(_0x1355d6['error']){if(_0x1355d6['error'][_0x2463('0x25')]===0x1f4){logger['error'](_0x2463('0x21'),_0x2a2c55,_0x1355d6[_0x2463('0x26')][_0x2463('0x27')]);return _0xfed63a(_0x1355d6[_0x2463('0x26')][_0x2463('0x27')]);}logger[_0x2463('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x2a2c55,_0x1355d6[_0x2463('0x26')][_0x2463('0x27')]);return _0x45901a(_0x1355d6[_0x2463('0x26')]['message']);}else{logger['info'](_0x2463('0x21'),_0x2a2c55,_0x2463('0x22'));_0x45901a(_0x1355d6[_0x2463('0x28')]['message']);}})[_0x2463('0x29')](function(_0x2c44fd){logger[_0x2463('0x26')]('VtigerAccount,\x20%s,\x20%s',_0x2a2c55,_0x2c44fd);_0xfed63a(_0x2c44fd);});});}function respondWithStatusCode(_0x36a574,_0x14d864){_0x14d864=_0x14d864||0xcc;return function(_0x4f3b39){if(_0x4f3b39){return _0x36a574[_0x2463('0x2a')](_0x14d864);}return _0x36a574[_0x2463('0x2b')](_0x14d864)[_0x2463('0x2c')]();};}function respondWithResult(_0x44b5c0,_0x53b8ce){_0x53b8ce=_0x53b8ce||0xc8;return function(_0x251ab2){if(_0x251ab2){return _0x44b5c0[_0x2463('0x2b')](_0x53b8ce)[_0x2463('0x2d')](_0x251ab2);}};}function respondWithFilteredResult(_0x40abee,_0x353d7b){return function(_0x51d8ab){if(_0x51d8ab){var _0x51d876=_0x51d8ab[_0x2463('0x2e')],_0xc3507b=_0x353d7b[_0x2463('0x2f')],_0x3af96=_0x353d7b[_0x2463('0x2f')]+_0x353d7b['limit'],_0x282e35;if(_0x3af96>=_0x51d876){_0x3af96=_0x51d876;_0x282e35=0xc8;}else{_0x282e35=0xce;}_0x40abee[_0x2463('0x2b')](_0x282e35);return _0x40abee[_0x2463('0x30')](_0x2463('0x31'),_0xc3507b+'-'+_0x3af96+'/'+_0x51d876)[_0x2463('0x2d')](_0x51d8ab);}return null;};}function patchUpdates(_0x501ebf){return function(_0x5256e6){try{jsonpatch[_0x2463('0x32')](_0x5256e6,_0x501ebf,!![]);}catch(_0x34b1b7){return BPromise[_0x2463('0x33')](_0x34b1b7);}return _0x5256e6[_0x2463('0x34')]();};}function saveUpdates(_0x26a762,_0x256916){return function(_0xd5e23){if(_0xd5e23){return _0xd5e23['update'](_0x26a762)[_0x2463('0x1f')](function(_0x87bf6b){return _0x87bf6b;});}return null;};}function removeEntity(_0x56362f,_0x1802c4){return function(_0x1eb87e){if(_0x1eb87e){return _0x1eb87e[_0x2463('0x35')]()[_0x2463('0x1f')](function(){_0x56362f[_0x2463('0x2b')](0xcc)[_0x2463('0x2c')]();});}};}function handleEntityNotFound(_0x4c1fa5,_0x564a45){return function(_0x26d446){if(!_0x26d446){_0x4c1fa5[_0x2463('0x2a')](0x194);}return _0x26d446;};}function handleError(_0xf3b25e,_0x19d1c1){_0x19d1c1=_0x19d1c1||0x1f4;return function(_0x214a34){logger[_0x2463('0x26')](_0x214a34[_0x2463('0x36')]);if(_0x214a34['name']){delete _0x214a34[_0x2463('0x37')];}_0xf3b25e[_0x2463('0x2b')](_0x19d1c1)[_0x2463('0x38')](_0x214a34);};}exports[_0x2463('0x39')]=function(_0x17efe2,_0x44cbef){var _0x7ae698={},_0x3c7286={},_0x3cc2ee={'count':0x0,'rows':[]};var _0x19eaf3=_[_0x2463('0x3a')](db[_0x2463('0x3b')][_0x2463('0x3c')],function(_0x15221e){return{'name':_0x15221e[_0x2463('0x3d')],'type':_0x15221e[_0x2463('0x3e')][_0x2463('0x3f')]};});_0x3c7286['model']=_[_0x2463('0x3a')](_0x19eaf3,'name');_0x3c7286[_0x2463('0x40')]=_[_0x2463('0x41')](_0x17efe2[_0x2463('0x40')]);_0x3c7286[_0x2463('0x42')]=_['intersection'](_0x3c7286[_0x2463('0x43')],_0x3c7286[_0x2463('0x40')]);_0x7ae698[_0x2463('0x44')]=_['intersection'](_0x3c7286[_0x2463('0x43')],qs[_0x2463('0x45')](_0x17efe2[_0x2463('0x40')][_0x2463('0x45')]));_0x7ae698[_0x2463('0x44')]=_0x7ae698[_0x2463('0x44')][_0x2463('0x46')]?_0x7ae698[_0x2463('0x44')]:_0x3c7286[_0x2463('0x43')];if(!_0x17efe2[_0x2463('0x40')][_0x2463('0x47')]('nolimit')){_0x7ae698[_0x2463('0x48')]=qs[_0x2463('0x48')](_0x17efe2[_0x2463('0x40')]['limit']);_0x7ae698['offset']=qs[_0x2463('0x2f')](_0x17efe2[_0x2463('0x40')]['offset']);}_0x7ae698[_0x2463('0x49')]=qs[_0x2463('0x4a')](_0x17efe2[_0x2463('0x40')][_0x2463('0x4a')]);_0x7ae698[_0x2463('0x4b')]=qs[_0x2463('0x42')](_['pick'](_0x17efe2[_0x2463('0x40')],_0x3c7286[_0x2463('0x42')]));if(_0x17efe2[_0x2463('0x40')][_0x2463('0x4c')]){_0x7ae698['where']=_[_0x2463('0x4d')](_0x7ae698[_0x2463('0x4b')],{'$or':_[_0x2463('0x3a')](_0x19eaf3,function(_0x1a8d5b){if(_0x1a8d5b[_0x2463('0x3e')]!==_0x2463('0x4e')){var _0x3bc8cf={};_0x3bc8cf[_0x1a8d5b[_0x2463('0x37')]]={'$like':'%'+_0x17efe2[_0x2463('0x40')][_0x2463('0x4c')]+'%'};return _0x3bc8cf;}})});}_0x7ae698=_[_0x2463('0x4d')]({},_0x7ae698,_0x17efe2[_0x2463('0x4f')]);var _0x4ccc65={'where':_0x7ae698[_0x2463('0x4b')]};return db[_0x2463('0x3b')]['count'](_0x4ccc65)[_0x2463('0x1f')](function(_0x31a072){_0x3cc2ee['count']=_0x31a072;if(_0x17efe2['query'][_0x2463('0x50')]){_0x7ae698[_0x2463('0x51')]=[{'all':!![]}];}return db[_0x2463('0x3b')]['findAll'](_0x7ae698);})[_0x2463('0x1f')](function(_0x4bd1a3){_0x3cc2ee[_0x2463('0x52')]=_0x4bd1a3;return _0x3cc2ee;})[_0x2463('0x1f')](respondWithFilteredResult(_0x44cbef,_0x7ae698))[_0x2463('0x29')](handleError(_0x44cbef,null));};exports[_0x2463('0x53')]=function(_0x41202e,_0x368c9c){var _0x2f2656={'raw':![],'where':{'id':_0x41202e[_0x2463('0x54')]['id']}},_0x5c3922={};_0x5c3922[_0x2463('0x43')]=_[_0x2463('0x41')](db[_0x2463('0x3b')]['rawAttributes']);_0x5c3922['query']=_[_0x2463('0x41')](_0x41202e[_0x2463('0x40')]);_0x5c3922[_0x2463('0x42')]=_[_0x2463('0x55')](_0x5c3922[_0x2463('0x43')],_0x5c3922['query']);_0x2f2656[_0x2463('0x44')]=_['intersection'](_0x5c3922[_0x2463('0x43')],qs[_0x2463('0x45')](_0x41202e[_0x2463('0x40')][_0x2463('0x45')]));_0x2f2656[_0x2463('0x44')]=_0x2f2656[_0x2463('0x44')][_0x2463('0x46')]?_0x2f2656[_0x2463('0x44')]:_0x5c3922[_0x2463('0x43')];if(_0x41202e[_0x2463('0x40')][_0x2463('0x50')]){_0x2f2656[_0x2463('0x51')]=[{'all':!![]}];}_0x2f2656=_[_0x2463('0x4d')]({},_0x2f2656,_0x41202e[_0x2463('0x4f')]);return db[_0x2463('0x3b')]['find'](_0x2f2656)[_0x2463('0x1f')](handleEntityNotFound(_0x368c9c,null))['then'](respondWithResult(_0x368c9c,null))['catch'](handleError(_0x368c9c,null));};exports[_0x2463('0x56')]=function(_0x289593,_0x19759e){return db[_0x2463('0x3b')][_0x2463('0x56')](_0x289593[_0x2463('0x57')],{})[_0x2463('0x1f')](respondWithResult(_0x19759e,0xc9))[_0x2463('0x29')](handleError(_0x19759e,null));};exports[_0x2463('0x58')]=function(_0x589855,_0x55ecac){if(_0x589855[_0x2463('0x57')]['id']){delete _0x589855[_0x2463('0x57')]['id'];}return db[_0x2463('0x3b')]['find']({'where':{'id':_0x589855['params']['id']}})[_0x2463('0x1f')](handleEntityNotFound(_0x55ecac,null))[_0x2463('0x1f')](saveUpdates(_0x589855[_0x2463('0x57')],null))[_0x2463('0x1f')](respondWithResult(_0x55ecac,null))[_0x2463('0x29')](handleError(_0x55ecac,null));};exports[_0x2463('0x35')]=function(_0x54229a,_0x4cbc94){return db[_0x2463('0x3b')]['find']({'where':{'id':_0x54229a['params']['id']}})[_0x2463('0x1f')](handleEntityNotFound(_0x4cbc94,null))[_0x2463('0x1f')](removeEntity(_0x4cbc94,null))[_0x2463('0x29')](handleError(_0x4cbc94,null));};exports['getConfigurations']=function(_0x2272c2,_0xff73f4,_0x18fc6d){var _0x3e9534={};var _0x36fcab={};var _0x4c0293;var _0x344069;return db[_0x2463('0x3b')][_0x2463('0x59')]({'where':{'id':_0x2272c2[_0x2463('0x54')]['id']}})['then'](handleEntityNotFound(_0xff73f4,null))[_0x2463('0x1f')](function(_0xadc29c){if(_0xadc29c){_0x4c0293=_0xadc29c;_0x36fcab[_0x2463('0x43')]=_[_0x2463('0x41')](db[_0x2463('0x5a')][_0x2463('0x3c')]);_0x36fcab[_0x2463('0x40')]=_['keys'](_0x2272c2[_0x2463('0x40')]);_0x36fcab[_0x2463('0x42')]=_[_0x2463('0x55')](_0x36fcab[_0x2463('0x43')],_0x36fcab[_0x2463('0x40')]);_0x3e9534['attributes']=_[_0x2463('0x55')](_0x36fcab['model'],qs[_0x2463('0x45')](_0x2272c2['query']['fields']));_0x3e9534[_0x2463('0x44')]=_0x3e9534[_0x2463('0x44')]['length']?_0x3e9534[_0x2463('0x44')]:_0x36fcab['model'];_0x3e9534[_0x2463('0x49')]=qs[_0x2463('0x4a')](_0x2272c2[_0x2463('0x40')][_0x2463('0x4a')]);_0x3e9534[_0x2463('0x4b')]=qs[_0x2463('0x42')](_[_0x2463('0x5b')](_0x2272c2[_0x2463('0x40')],_0x36fcab[_0x2463('0x42')]));if(_0x2272c2[_0x2463('0x40')]['filter']){_0x3e9534['where']=_[_0x2463('0x4d')](_0x3e9534[_0x2463('0x4b')],{'$or':_[_0x2463('0x3a')](_0x3e9534['attributes'],function(_0x1a9923){var _0x2fcd5d={};_0x2fcd5d[_0x1a9923]={'$like':'%'+_0x2272c2[_0x2463('0x40')]['filter']+'%'};return _0x2fcd5d;})});}_0x3e9534=_[_0x2463('0x4d')]({},_0x3e9534,_0x2272c2[_0x2463('0x4f')]);return _0x4c0293[_0x2463('0x5c')](_0x3e9534);}})[_0x2463('0x1f')](function(_0x577007){if(_0x577007){_0x344069=_0x577007[_0x2463('0x46')];if(!_0x2272c2[_0x2463('0x40')][_0x2463('0x47')](_0x2463('0x5d'))){_0x3e9534[_0x2463('0x48')]=qs[_0x2463('0x48')](_0x2272c2[_0x2463('0x40')][_0x2463('0x48')]);_0x3e9534['offset']=qs[_0x2463('0x2f')](_0x2272c2[_0x2463('0x40')][_0x2463('0x2f')]);}return _0x4c0293[_0x2463('0x5c')](_0x3e9534);}})[_0x2463('0x1f')](function(_0x10ab8b){if(_0x10ab8b){return _0x10ab8b?{'count':_0x344069,'rows':_0x10ab8b}:null;}})[_0x2463('0x1f')](respondWithResult(_0xff73f4,null))[_0x2463('0x29')](handleError(_0xff73f4,null));};exports[_0x2463('0x5e')]=function(_0x3afa02,_0x1832c0,_0x1e8e8c){if(_0x3afa02[_0x2463('0x57')]['id']){delete _0x3afa02[_0x2463('0x57')]['id'];}return db[_0x2463('0x3b')][_0x2463('0x59')]({'where':{'id':_0x3afa02['params']['id']}})[_0x2463('0x1f')](handleEntityNotFound(_0x1832c0,null))[_0x2463('0x1f')](function(_0x2d2173){if(_0x2d2173){_0x3afa02[_0x2463('0x57')][_0x2463('0x5f')]=_0x2d2173['id'];_0x3afa02['body'][_0x2463('0x60')]=integrations[_0x2463('0x61')](_0x3afa02['body'][_0x2463('0x62')],_0x3afa02[_0x2463('0x57')][_0x2463('0x3e')]);_0x3afa02[_0x2463('0x57')][_0x2463('0x63')]=integrations[_0x2463('0x64')](_0x3afa02[_0x2463('0x57')][_0x2463('0x62')],_0x3afa02[_0x2463('0x57')][_0x2463('0x3e')]);return db[_0x2463('0x5a')][_0x2463('0x56')](_0x3afa02[_0x2463('0x57')],{'include':[{'model':db[_0x2463('0x65')],'as':'Subjects'},{'model':db[_0x2463('0x65')],'as':'Descriptions'}]});}return null;})[_0x2463('0x1f')](respondWithResult(_0x1832c0,null))['catch'](handleError(_0x1832c0,null));};var md5=require(_0x2463('0x66'));exports[_0x2463('0x67')]=function(_0x483c5b,_0x5da332,_0x3adee8){var _0x1c5684=null;var _0x32b502=null;var _0x5d6a0f=null;var _0x5cb98a=null;var _0x396f3d='';return db[_0x2463('0x3b')]['findOne']({'where':{'id':_0x483c5b[_0x2463('0x54')]['id']},'attributes':['id','name',_0x2463('0x68'),_0x2463('0x69'),_0x2463('0x6a'),'remoteUri','serverUrl','accessKey']})['then'](handleEntityNotFound(_0x5da332,null))[_0x2463('0x1f')](function(_0x2117da){if(_0x2117da){_0x1c5684=_0x2117da[_0x2463('0x68')];_0x32b502=_0x2117da[_0x2463('0x6b')];_0x5d6a0f=_0x2117da['moduleName'];_0x396f3d=_0x2117da[_0x2463('0x6c')];var _0x3161ea=_0x396f3d[_0x2463('0x6d')](-0x1);if(_0x3161ea==='/'){_0x396f3d=_0x396f3d[_0x2463('0x6e')](0x0,_0x396f3d[_0x2463('0x6f')](_0x3161ea));}_0x5cb98a=util[_0x2463('0x70')](_0x2463('0x71'),_0x396f3d);var _0x38c4d6={'method':_0x2463('0x72'),'uri':_0x5cb98a,'qs':{'operation':'getchallenge','username':_0x2117da[_0x2463('0x68')]},'json':!![]};return rp(_0x38c4d6);}})[_0x2463('0x1f')](function(_0x374dd8){if(_0x374dd8['success']){var _0x2398a5={'method':_0x2463('0x73'),'uri':_0x5cb98a,'form':{'operation':_0x2463('0x74'),'username':_0x1c5684,'accessKey':md5(_0x374dd8[_0x2463('0x28')][_0x2463('0x75')]+_0x32b502)},'json':!![]};return rp(_0x2398a5);}})[_0x2463('0x1f')](function(_0xd2220d){if(_0xd2220d[_0x2463('0x76')]){var _0x32439d={'method':_0x2463('0x72'),'uri':_0x5cb98a,'qs':{'operation':_0x2463('0x77'),'username':_0x1c5684,'sessionName':_0xd2220d[_0x2463('0x28')][_0x2463('0x78')],'elementType':_0x5d6a0f},'json':!![]};return rp(_0x32439d);}})[_0x2463('0x1f')](function(_0x358fff){if(_0x358fff['success']){var _0x79c2fa=[_0x2463('0x79'),_0x2463('0x7a'),'owner'];_['remove'](_0x358fff[_0x2463('0x28')]['fields'],function(_0x35289f){return _0x79c2fa[_0x2463('0x7b')](_0x35289f['type']['name']);});_[_0x2463('0x7c')](_0x358fff[_0x2463('0x28')][_0x2463('0x45')],function(_0x1cfabd){return _0x1cfabd[_0x2463('0x7d')]===_0x2463('0x7e');});return{'count':_0x358fff[_0x2463('0x28')][_0x2463('0x45')][_0x2463('0x46')],'rows':_[_0x2463('0x3a')](_0x358fff[_0x2463('0x28')]['fields'],function(_0x1c9e70){return{'id':_0x1c9e70['name'],'name':_0x1c9e70['label'],'custom':_['startsWith'](_0x1c9e70['name'],_0x2463('0x7f'))?!![]:![],'options':_0x1c9e70['type']['name']===_0x2463('0x80')&&_0x1c9e70['type']['picklistValues']['length']>0x0?_[_0x2463('0x3a')](_0x1c9e70[_0x2463('0x3e')][_0x2463('0x81')],function(_0x3d344c){return{'name':_0x3d344c['label'],'value':_0x3d344c[_0x2463('0x82')]};}):[]};})};}})[_0x2463('0x1f')](respondWithResult(_0x5da332,null))['catch'](function(_0x1bf0a6){console[_0x2463('0x83')](_0x2463('0x84')+_0x1bf0a6);var _0x27e28a=_0x483c5b[_0x2463('0x40')][_0x2463('0x1a')]?0x1f4:_0x1bf0a6[_0x2463('0x85')]||0x1f4;logger[_0x2463('0x26')](_0x2463('0x86'),_0x2463('0x67'),_0x27e28a,JSON[_0x2463('0x87')](_0x1bf0a6));delete _0x1bf0a6[_0x2463('0x37')];if(_0x27e28a===0x191){_0x27e28a=0x190;}_0x5da332[_0x2463('0x2b')](_0x27e28a)[_0x2463('0x38')](_0x483c5b[_0x2463('0x40')][_0x2463('0x1a')]?{'message':'Wrong\x20credentials','statusCode':_0x1bf0a6[_0x2463('0x85')]}:_0x1bf0a6);});}; \ No newline at end of file +var _0xdf5d=['moduleName','remoteUri','serverUrl','accessKey','slice','substring','%s/webservice.php','GET','getchallenge','POST','login','success','describe','autogenerated','reference','remove','includes','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','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','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','sendStatus','end','status','json','offset','limit','update','then','destroy','stack','name','send','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','count','includeAll','findAll','params','include','find','create','body','getConfigurations','findOne','VtigerConfiguration','length','addConfiguration','Subjects','getSubjects','getDescriptions','channel','VtigerField','Descriptions','getFields','username','description'];(function(_0x25f96c,_0x1baacf){var _0x2289a3=function(_0x271219){while(--_0x271219){_0x25f96c['push'](_0x25f96c['shift']());}};_0x2289a3(++_0x1baacf);}(_0xdf5d,0x126));var _0xddf5=function(_0x539c44,_0x33e0e6){_0x539c44=_0x539c44-0x0;var _0x5a3f6f=_0xdf5d[_0x539c44];return _0x5a3f6f;};'use strict';var pdf=require(_0xddf5('0x0'));var emlformat=require(_0xddf5('0x1'));var rimraf=require(_0xddf5('0x2'));var zipdir=require(_0xddf5('0x3'));var jsonpatch=require(_0xddf5('0x4'));var rp=require(_0xddf5('0x5'));var moment=require(_0xddf5('0x6'));var BPromise=require(_0xddf5('0x7'));var Mustache=require('mustache');var util=require(_0xddf5('0x8'));var path=require(_0xddf5('0x9'));var sox=require(_0xddf5('0xa'));var csv=require(_0xddf5('0xb'));var ejs=require(_0xddf5('0xc'));var fs=require('fs');var _=require(_0xddf5('0xd'));var squel=require(_0xddf5('0xe'));var crypto=require(_0xddf5('0xf'));var jsforce=require(_0xddf5('0x10'));var deskjs=require(_0xddf5('0x11'));var toCsv=require(_0xddf5('0xb'));var querystring=require(_0xddf5('0x12'));var Papa=require(_0xddf5('0x13'));var Redis=require(_0xddf5('0x14'));var authService=require(_0xddf5('0x15'));var qs=require(_0xddf5('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xddf5('0x17'));var logger=require(_0xddf5('0x18'))(_0xddf5('0x19'));var utils=require(_0xddf5('0x1a'));var config=require(_0xddf5('0x1b'));var db=require(_0xddf5('0x1c'))['db'];var integrations=require(_0xddf5('0x1d'));var jayson=require(_0xddf5('0x1e'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0xf4c5b5,_0x3782b9,_0x31a822){if(_0x31a822){var _0x3df24c=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x3df24c[_0xddf5('0x1f')](_0x3782b9)){return _0xf4c5b5;}else{throw new db[(_0xddf5('0x20'))][(_0xddf5('0x21'))](_0xddf5('0x22'));}}else{return _0xf4c5b5;}}function respondWithRpcPromise(_0x49cdfc,_0xe3e3e8,_0x2b2dad,_0x3dd408){return new BPromise(function(_0x1c0c30,_0x19a039){var _0x5ef952=_0x3dd408||client;return _0x5ef952[_0xddf5('0x23')](_0x49cdfc,_0x2b2dad)['then'](function(_0x183a2b){logger['info'](_0xddf5('0x24'),_0xe3e3e8,_0xddf5('0x25'));logger[_0xddf5('0x26')](_0xddf5('0x27'),_0xe3e3e8,'request\x20sent',JSON['stringify'](_0x183a2b));if(_0x183a2b[_0xddf5('0x28')]){if(_0x183a2b[_0xddf5('0x28')][_0xddf5('0x29')]===0x1f4){logger[_0xddf5('0x28')]('VtigerAccount,\x20%s,\x20%s',_0xe3e3e8,_0x183a2b['error'][_0xddf5('0x2a')]);return _0x19a039(_0x183a2b[_0xddf5('0x28')][_0xddf5('0x2a')]);}logger['error'](_0xddf5('0x24'),_0xe3e3e8,_0x183a2b[_0xddf5('0x28')][_0xddf5('0x2a')]);return _0x1c0c30(_0x183a2b[_0xddf5('0x28')]['message']);}else{logger[_0xddf5('0x2b')](_0xddf5('0x24'),_0xe3e3e8,'request\x20sent');_0x1c0c30(_0x183a2b[_0xddf5('0x2c')][_0xddf5('0x2a')]);}})[_0xddf5('0x2d')](function(_0x12ece7){logger['error'](_0xddf5('0x24'),_0xe3e3e8,_0x12ece7);_0x19a039(_0x12ece7);});});}function respondWithStatusCode(_0xc75eb8,_0x256ff0){_0x256ff0=_0x256ff0||0xcc;return function(_0x1eca6a){if(_0x1eca6a){return _0xc75eb8[_0xddf5('0x2e')](_0x256ff0);}return _0xc75eb8['status'](_0x256ff0)[_0xddf5('0x2f')]();};}function respondWithResult(_0x35fc2b,_0x5c0451){_0x5c0451=_0x5c0451||0xc8;return function(_0x4821b7){if(_0x4821b7){return _0x35fc2b[_0xddf5('0x30')](_0x5c0451)[_0xddf5('0x31')](_0x4821b7);}};}function respondWithFilteredResult(_0x1d493e,_0x174cd7){return function(_0x3be6f4){if(_0x3be6f4){var _0x1a476d=_0x3be6f4['count'],_0x5a3548=_0x174cd7[_0xddf5('0x32')],_0x26f43c=_0x174cd7[_0xddf5('0x32')]+_0x174cd7[_0xddf5('0x33')],_0x228073;if(_0x26f43c>=_0x1a476d){_0x26f43c=_0x1a476d;_0x228073=0xc8;}else{_0x228073=0xce;}_0x1d493e['status'](_0x228073);return _0x1d493e['set']('Content-Range',_0x5a3548+'-'+_0x26f43c+'/'+_0x1a476d)[_0xddf5('0x31')](_0x3be6f4);}return null;};}function patchUpdates(_0x25e11e){return function(_0x391c68){try{jsonpatch['apply'](_0x391c68,_0x25e11e,!![]);}catch(_0x3d1c7a){return BPromise['reject'](_0x3d1c7a);}return _0x391c68['save']();};}function saveUpdates(_0x577ee0,_0x129f37){return function(_0x2faf35){if(_0x2faf35){return _0x2faf35[_0xddf5('0x34')](_0x577ee0)[_0xddf5('0x35')](function(_0x11cee5){return _0x11cee5;});}return null;};}function removeEntity(_0x49e5a9,_0x1eca4e){return function(_0x53e916){if(_0x53e916){return _0x53e916[_0xddf5('0x36')]()[_0xddf5('0x35')](function(){_0x49e5a9['status'](0xcc)[_0xddf5('0x2f')]();});}};}function handleEntityNotFound(_0x1fd693,_0x22d01f){return function(_0x431e53){if(!_0x431e53){_0x1fd693[_0xddf5('0x2e')](0x194);}return _0x431e53;};}function handleError(_0x4e0b6f,_0x873d16){_0x873d16=_0x873d16||0x1f4;return function(_0x5478cf){logger[_0xddf5('0x28')](_0x5478cf[_0xddf5('0x37')]);if(_0x5478cf['name']){delete _0x5478cf[_0xddf5('0x38')];}_0x4e0b6f['status'](_0x873d16)[_0xddf5('0x39')](_0x5478cf);};}exports['index']=function(_0x5982d3,_0x1b4cde){var _0x51f6c7={},_0x29ac40={},_0x2cc66b={'count':0x0,'rows':[]};var _0x466ccb=_[_0xddf5('0x3a')](db[_0xddf5('0x3b')][_0xddf5('0x3c')],function(_0x10b7a7){return{'name':_0x10b7a7[_0xddf5('0x3d')],'type':_0x10b7a7[_0xddf5('0x3e')][_0xddf5('0x3f')]};});_0x29ac40[_0xddf5('0x40')]=_[_0xddf5('0x3a')](_0x466ccb,_0xddf5('0x38'));_0x29ac40[_0xddf5('0x41')]=_[_0xddf5('0x42')](_0x5982d3[_0xddf5('0x41')]);_0x29ac40[_0xddf5('0x43')]=_[_0xddf5('0x44')](_0x29ac40['model'],_0x29ac40[_0xddf5('0x41')]);_0x51f6c7[_0xddf5('0x45')]=_[_0xddf5('0x44')](_0x29ac40[_0xddf5('0x40')],qs[_0xddf5('0x46')](_0x5982d3['query']['fields']));_0x51f6c7['attributes']=_0x51f6c7[_0xddf5('0x45')]['length']?_0x51f6c7['attributes']:_0x29ac40[_0xddf5('0x40')];if(!_0x5982d3[_0xddf5('0x41')][_0xddf5('0x47')](_0xddf5('0x48'))){_0x51f6c7[_0xddf5('0x33')]=qs[_0xddf5('0x33')](_0x5982d3[_0xddf5('0x41')][_0xddf5('0x33')]);_0x51f6c7[_0xddf5('0x32')]=qs[_0xddf5('0x32')](_0x5982d3['query']['offset']);}_0x51f6c7[_0xddf5('0x49')]=qs[_0xddf5('0x4a')](_0x5982d3['query']['sort']);_0x51f6c7[_0xddf5('0x4b')]=qs[_0xddf5('0x43')](_[_0xddf5('0x4c')](_0x5982d3[_0xddf5('0x41')],_0x29ac40['filters']));if(_0x5982d3['query'][_0xddf5('0x4d')]){_0x51f6c7[_0xddf5('0x4b')]=_['merge'](_0x51f6c7[_0xddf5('0x4b')],{'$or':_[_0xddf5('0x3a')](_0x466ccb,function(_0x4fa051){if(_0x4fa051[_0xddf5('0x3e')]!=='VIRTUAL'){var _0x378e6e={};_0x378e6e[_0x4fa051[_0xddf5('0x38')]]={'$like':'%'+_0x5982d3[_0xddf5('0x41')]['filter']+'%'};return _0x378e6e;}})});}_0x51f6c7=_[_0xddf5('0x4e')]({},_0x51f6c7,_0x5982d3[_0xddf5('0x4f')]);var _0xd4df47={'where':_0x51f6c7[_0xddf5('0x4b')]};return db[_0xddf5('0x3b')][_0xddf5('0x50')](_0xd4df47)['then'](function(_0x1cacbb){_0x2cc66b[_0xddf5('0x50')]=_0x1cacbb;if(_0x5982d3[_0xddf5('0x41')][_0xddf5('0x51')]){_0x51f6c7['include']=[{'all':!![]}];}return db[_0xddf5('0x3b')][_0xddf5('0x52')](_0x51f6c7);})[_0xddf5('0x35')](function(_0x35b4f2){_0x2cc66b['rows']=_0x35b4f2;return _0x2cc66b;})[_0xddf5('0x35')](respondWithFilteredResult(_0x1b4cde,_0x51f6c7))[_0xddf5('0x2d')](handleError(_0x1b4cde,null));};exports['show']=function(_0x2ea645,_0x597f15){var _0x1727c6={'raw':![],'where':{'id':_0x2ea645[_0xddf5('0x53')]['id']}},_0x2a2ca7={};_0x2a2ca7[_0xddf5('0x40')]=_['keys'](db[_0xddf5('0x3b')][_0xddf5('0x3c')]);_0x2a2ca7['query']=_[_0xddf5('0x42')](_0x2ea645['query']);_0x2a2ca7['filters']=_[_0xddf5('0x44')](_0x2a2ca7[_0xddf5('0x40')],_0x2a2ca7[_0xddf5('0x41')]);_0x1727c6[_0xddf5('0x45')]=_[_0xddf5('0x44')](_0x2a2ca7[_0xddf5('0x40')],qs['fields'](_0x2ea645[_0xddf5('0x41')][_0xddf5('0x46')]));_0x1727c6[_0xddf5('0x45')]=_0x1727c6[_0xddf5('0x45')]['length']?_0x1727c6[_0xddf5('0x45')]:_0x2a2ca7[_0xddf5('0x40')];if(_0x2ea645['query'][_0xddf5('0x51')]){_0x1727c6[_0xddf5('0x54')]=[{'all':!![]}];}_0x1727c6=_['merge']({},_0x1727c6,_0x2ea645[_0xddf5('0x4f')]);return db['VtigerAccount'][_0xddf5('0x55')](_0x1727c6)['then'](handleEntityNotFound(_0x597f15,null))['then'](respondWithResult(_0x597f15,null))['catch'](handleError(_0x597f15,null));};exports[_0xddf5('0x56')]=function(_0x306bd3,_0x41e5c0){return db[_0xddf5('0x3b')][_0xddf5('0x56')](_0x306bd3[_0xddf5('0x57')],{})[_0xddf5('0x35')](respondWithResult(_0x41e5c0,0xc9))[_0xddf5('0x2d')](handleError(_0x41e5c0,null));};exports[_0xddf5('0x34')]=function(_0x18e068,_0x57f2a4){if(_0x18e068[_0xddf5('0x57')]['id']){delete _0x18e068[_0xddf5('0x57')]['id'];}return db[_0xddf5('0x3b')][_0xddf5('0x55')]({'where':{'id':_0x18e068[_0xddf5('0x53')]['id']}})['then'](handleEntityNotFound(_0x57f2a4,null))[_0xddf5('0x35')](saveUpdates(_0x18e068['body'],null))[_0xddf5('0x35')](respondWithResult(_0x57f2a4,null))[_0xddf5('0x2d')](handleError(_0x57f2a4,null));};exports['destroy']=function(_0x11a516,_0x49257e){return db[_0xddf5('0x3b')]['find']({'where':{'id':_0x11a516['params']['id']}})[_0xddf5('0x35')](handleEntityNotFound(_0x49257e,null))[_0xddf5('0x35')](removeEntity(_0x49257e,null))[_0xddf5('0x2d')](handleError(_0x49257e,null));};exports[_0xddf5('0x58')]=function(_0xb62de0,_0x1c4022,_0x51d244){var _0x418278={};var _0x9d3d33={};var _0x120ba8;var _0x346c5c;return db['VtigerAccount'][_0xddf5('0x59')]({'where':{'id':_0xb62de0[_0xddf5('0x53')]['id']}})[_0xddf5('0x35')](handleEntityNotFound(_0x1c4022,null))['then'](function(_0x298dbf){if(_0x298dbf){_0x120ba8=_0x298dbf;_0x9d3d33[_0xddf5('0x40')]=_[_0xddf5('0x42')](db[_0xddf5('0x5a')][_0xddf5('0x3c')]);_0x9d3d33[_0xddf5('0x41')]=_[_0xddf5('0x42')](_0xb62de0[_0xddf5('0x41')]);_0x9d3d33[_0xddf5('0x43')]=_[_0xddf5('0x44')](_0x9d3d33[_0xddf5('0x40')],_0x9d3d33[_0xddf5('0x41')]);_0x418278[_0xddf5('0x45')]=_['intersection'](_0x9d3d33[_0xddf5('0x40')],qs['fields'](_0xb62de0[_0xddf5('0x41')][_0xddf5('0x46')]));_0x418278[_0xddf5('0x45')]=_0x418278[_0xddf5('0x45')][_0xddf5('0x5b')]?_0x418278[_0xddf5('0x45')]:_0x9d3d33['model'];_0x418278[_0xddf5('0x49')]=qs[_0xddf5('0x4a')](_0xb62de0[_0xddf5('0x41')][_0xddf5('0x4a')]);_0x418278[_0xddf5('0x4b')]=qs['filters'](_['pick'](_0xb62de0[_0xddf5('0x41')],_0x9d3d33[_0xddf5('0x43')]));if(_0xb62de0[_0xddf5('0x41')][_0xddf5('0x4d')]){_0x418278['where']=_['merge'](_0x418278[_0xddf5('0x4b')],{'$or':_[_0xddf5('0x3a')](_0x418278[_0xddf5('0x45')],function(_0x3853ac){var _0x9277af={};_0x9277af[_0x3853ac]={'$like':'%'+_0xb62de0[_0xddf5('0x41')][_0xddf5('0x4d')]+'%'};return _0x9277af;})});}_0x418278=_['merge']({},_0x418278,_0xb62de0['options']);return _0x120ba8['getConfigurations'](_0x418278);}})[_0xddf5('0x35')](function(_0x2b90d8){if(_0x2b90d8){_0x346c5c=_0x2b90d8[_0xddf5('0x5b')];if(!_0xb62de0[_0xddf5('0x41')][_0xddf5('0x47')](_0xddf5('0x48'))){_0x418278[_0xddf5('0x33')]=qs['limit'](_0xb62de0[_0xddf5('0x41')][_0xddf5('0x33')]);_0x418278['offset']=qs[_0xddf5('0x32')](_0xb62de0[_0xddf5('0x41')][_0xddf5('0x32')]);}return _0x120ba8[_0xddf5('0x58')](_0x418278);}})['then'](function(_0x23641f){if(_0x23641f){return _0x23641f?{'count':_0x346c5c,'rows':_0x23641f}:null;}})[_0xddf5('0x35')](respondWithResult(_0x1c4022,null))[_0xddf5('0x2d')](handleError(_0x1c4022,null));};exports[_0xddf5('0x5c')]=function(_0x22463b,_0x3f7c95,_0x551666){if(_0x22463b[_0xddf5('0x57')]['id']){delete _0x22463b['body']['id'];}return db['VtigerAccount'][_0xddf5('0x59')]({'where':{'id':_0x22463b['params']['id']}})[_0xddf5('0x35')](handleEntityNotFound(_0x3f7c95,null))[_0xddf5('0x35')](function(_0xd0a191){if(_0xd0a191){_0x22463b[_0xddf5('0x57')]['AccountId']=_0xd0a191['id'];_0x22463b[_0xddf5('0x57')][_0xddf5('0x5d')]=integrations[_0xddf5('0x5e')](_0x22463b[_0xddf5('0x57')]['channel'],_0x22463b[_0xddf5('0x57')]['type']);_0x22463b[_0xddf5('0x57')]['Descriptions']=integrations[_0xddf5('0x5f')](_0x22463b[_0xddf5('0x57')][_0xddf5('0x60')],_0x22463b[_0xddf5('0x57')]['type']);return db['VtigerConfiguration']['create'](_0x22463b[_0xddf5('0x57')],{'include':[{'model':db[_0xddf5('0x61')],'as':_0xddf5('0x5d')},{'model':db[_0xddf5('0x61')],'as':_0xddf5('0x62')}]});}return null;})[_0xddf5('0x35')](respondWithResult(_0x3f7c95,null))[_0xddf5('0x2d')](handleError(_0x3f7c95,null));};var md5=require('md5');exports[_0xddf5('0x63')]=function(_0x2d2cc9,_0x5d66c9,_0x289874){var _0x46274f=null;var _0x673df9=null;var _0x3dd053=null;var _0x4f3560=null;var _0x47e468='';return db['VtigerAccount'][_0xddf5('0x59')]({'where':{'id':_0x2d2cc9['params']['id']},'attributes':['id','name',_0xddf5('0x64'),_0xddf5('0x65'),_0xddf5('0x66'),_0xddf5('0x67'),_0xddf5('0x68'),_0xddf5('0x69')]})[_0xddf5('0x35')](handleEntityNotFound(_0x5d66c9,null))['then'](function(_0x5d5afb){if(_0x5d5afb){_0x46274f=_0x5d5afb[_0xddf5('0x64')];_0x673df9=_0x5d5afb[_0xddf5('0x69')];_0x3dd053=_0x5d5afb['moduleName'];_0x47e468=_0x5d5afb[_0xddf5('0x67')];var _0x5962b4=_0x47e468[_0xddf5('0x6a')](-0x1);if(_0x5962b4==='/'){_0x47e468=_0x47e468[_0xddf5('0x6b')](0x0,_0x47e468['lastIndexOf'](_0x5962b4));}_0x4f3560=util['format'](_0xddf5('0x6c'),_0x47e468);var _0x3c8d38={'method':_0xddf5('0x6d'),'uri':_0x4f3560,'qs':{'operation':_0xddf5('0x6e'),'username':_0x5d5afb[_0xddf5('0x64')]},'json':!![]};return rp(_0x3c8d38);}})[_0xddf5('0x35')](function(_0xa2d0f5){if(_0xa2d0f5['success']){var _0x1bb4fa={'method':_0xddf5('0x6f'),'uri':_0x4f3560,'form':{'operation':_0xddf5('0x70'),'username':_0x46274f,'accessKey':md5(_0xa2d0f5['result']['token']+_0x673df9)},'json':!![]};return rp(_0x1bb4fa);}})['then'](function(_0x57a830){if(_0x57a830[_0xddf5('0x71')]){var _0x3e88b7={'method':'GET','uri':_0x4f3560,'qs':{'operation':_0xddf5('0x72'),'username':_0x46274f,'sessionName':_0x57a830[_0xddf5('0x2c')]['sessionName'],'elementType':_0x3dd053},'json':!![]};return rp(_0x3e88b7);}})[_0xddf5('0x35')](function(_0xedf2d){if(_0xedf2d[_0xddf5('0x71')]){var _0x57f5fa=[_0xddf5('0x73'),_0xddf5('0x74'),'owner'];_[_0xddf5('0x75')](_0xedf2d[_0xddf5('0x2c')][_0xddf5('0x46')],function(_0x6a98a1){return _0x57f5fa[_0xddf5('0x76')](_0x6a98a1['type'][_0xddf5('0x38')]);});_[_0xddf5('0x75')](_0xedf2d[_0xddf5('0x2c')][_0xddf5('0x46')],function(_0x46d144){return _0x46d144['editable']===_0xddf5('0x77');});return{'count':_0xedf2d['result'][_0xddf5('0x46')][_0xddf5('0x5b')],'rows':_[_0xddf5('0x3a')](_0xedf2d[_0xddf5('0x2c')][_0xddf5('0x46')],function(_0x2500cf){return{'id':_0x2500cf[_0xddf5('0x38')],'name':_0x2500cf[_0xddf5('0x78')],'custom':_[_0xddf5('0x79')](_0x2500cf[_0xddf5('0x38')],_0xddf5('0x7a'))?!![]:![],'options':_0x2500cf[_0xddf5('0x3e')][_0xddf5('0x38')]===_0xddf5('0x7b')&&_0x2500cf['type'][_0xddf5('0x7c')]['length']>0x0?_[_0xddf5('0x3a')](_0x2500cf[_0xddf5('0x3e')]['picklistValues'],function(_0x1030d6){return{'name':_0x1030d6['label'],'value':_0x1030d6[_0xddf5('0x7d')]};}):[]};})};}})[_0xddf5('0x35')](respondWithResult(_0x5d66c9,null))['catch'](function(_0x540338){console[_0xddf5('0x7e')](_0xddf5('0x7f')+_0x540338);var _0x20851d=_0x2d2cc9[_0xddf5('0x41')][_0xddf5('0x1f')]?0x1f4:_0x540338[_0xddf5('0x80')]||0x1f4;logger[_0xddf5('0x28')](_0xddf5('0x81'),_0xddf5('0x63'),_0x20851d,JSON[_0xddf5('0x82')](_0x540338));delete _0x540338[_0xddf5('0x38')];if(_0x20851d===0x191){_0x20851d=0x190;}_0x5d66c9[_0xddf5('0x30')](_0x20851d)[_0xddf5('0x39')](_0x2d2cc9[_0xddf5('0x41')]['test']?{'message':_0xddf5('0x83'),'statusCode':_0x540338[_0xddf5('0x80')]}:_0x540338);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 990a4c0..7cfaa4d 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 _0x3c6a=['api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerAccount.attributes','exports','define','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger'];(function(_0x4893c6,_0x4823d8){var _0x50f4d3=function(_0x113c47){while(--_0x113c47){_0x4893c6['push'](_0x4893c6['shift']());}};_0x50f4d3(++_0x4823d8);}(_0x3c6a,0x102));var _0xa3c6=function(_0x495b3d,_0x4d3da4){_0x495b3d=_0x495b3d-0x0;var _0x4cb329=_0x3c6a[_0x495b3d];return _0x4cb329;};'use strict';var _=require(_0xa3c6('0x0'));var util=require('util');var logger=require(_0xa3c6('0x1'))(_0xa3c6('0x2'));var moment=require('moment');var BPromise=require(_0xa3c6('0x3'));var rp=require(_0xa3c6('0x4'));var fs=require('fs');var path=require(_0xa3c6('0x5'));var rimraf=require(_0xa3c6('0x6'));var config=require(_0xa3c6('0x7'));var attributes=require(_0xa3c6('0x8'));var integrations=require('../../components/integrations/configuration');module[_0xa3c6('0x9')]=function(_0x2fab43,_0x5b6043){return _0x2fab43[_0xa3c6('0xa')](_0xa3c6('0xb'),attributes,{'tableName':_0xa3c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xafb9=['define','VtigerAccount','util','api','moment','rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x189c9e,_0x1c3b55){var _0x3f38ca=function(_0x4c05ec){while(--_0x4c05ec){_0x189c9e['push'](_0x189c9e['shift']());}};_0x3f38ca(++_0x1c3b55);}(_0xafb9,0x1a6));var _0x9afb=function(_0x236efb,_0x2bc7f9){_0x236efb=_0x236efb-0x0;var _0x3979c9=_0xafb9[_0x236efb];return _0x3979c9;};'use strict';var _=require('lodash');var util=require(_0x9afb('0x0'));var logger=require('../../config/logger')(_0x9afb('0x1'));var moment=require(_0x9afb('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9afb('0x3'));var config=require(_0x9afb('0x4'));var attributes=require(_0x9afb('0x5'));var integrations=require(_0x9afb('0x6'));module[_0x9afb('0x7')]=function(_0x2c4cfe,_0x573f0e){return _0x2c4cfe[_0x9afb('0x8')](_0x9afb('0x9'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.rpc.js b/server/api/intVtigerAccount/intVtigerAccount.rpc.js index fd8c640..445e13e 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 _0xee52=['VtigerAccount,\x20%s,\x20%s','message','result','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','limit','include','model','map','stringify','ShowVtigerAccount','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/environment','client','http','request','then','info','request\x20sent','debug','error','code'];(function(_0x247fa1,_0x4ec37c){var _0x244f35=function(_0xfb98be){while(--_0xfb98be){_0x247fa1['push'](_0x247fa1['shift']());}};_0x244f35(++_0x4ec37c);}(_0xee52,0x1d1));var _0x2ee5=function(_0x12cadc,_0x190995){_0x12cadc=_0x12cadc-0x0;var _0x49bc70=_0xee52[_0x12cadc];return _0x49bc70;};'use strict';var _=require(_0x2ee5('0x0'));var util=require('util');var moment=require(_0x2ee5('0x1'));var BPromise=require(_0x2ee5('0x2'));var rs=require(_0x2ee5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ee5('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x2ee5('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x2ee5('0x6')][_0x2ee5('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1d8f31,_0x17442d,_0x16e4d4){return new BPromise(function(_0x5c7824,_0x490839){return client[_0x2ee5('0x8')](_0x1d8f31,_0x16e4d4)[_0x2ee5('0x9')](function(_0x25ca74){logger[_0x2ee5('0xa')]('VtigerAccount,\x20%s,\x20%s',_0x17442d,_0x2ee5('0xb'));logger[_0x2ee5('0xc')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x17442d,_0x2ee5('0xb'),JSON['stringify'](_0x25ca74));if(_0x25ca74[_0x2ee5('0xd')]){if(_0x25ca74[_0x2ee5('0xd')][_0x2ee5('0xe')]===0x1f4){logger[_0x2ee5('0xd')](_0x2ee5('0xf'),_0x17442d,_0x25ca74['error'][_0x2ee5('0x10')]);return _0x490839(_0x25ca74['error'][_0x2ee5('0x10')]);}logger[_0x2ee5('0xd')]('VtigerAccount,\x20%s,\x20%s',_0x17442d,_0x25ca74[_0x2ee5('0xd')][_0x2ee5('0x10')]);return _0x5c7824(_0x25ca74['error'][_0x2ee5('0x10')]);}else{logger['info'](_0x2ee5('0xf'),_0x17442d,_0x2ee5('0xb'));_0x5c7824(_0x25ca74[_0x2ee5('0x11')]['message']);}})[_0x2ee5('0x12')](function(_0x383263){logger[_0x2ee5('0xd')](_0x2ee5('0xf'),_0x17442d,_0x383263);_0x490839(_0x383263);});});}exports[_0x2ee5('0x13')]=function(_0xa7c493){var _0x1424fc=this;return new Promise(function(_0x273859,_0x3e1e4f){return db[_0x2ee5('0x14')][_0x2ee5('0x15')]({'raw':_0xa7c493[_0x2ee5('0x16')]?_0xa7c493['options'][_0x2ee5('0x17')]===undefined?!![]:![]:!![],'where':_0xa7c493[_0x2ee5('0x16')]?_0xa7c493[_0x2ee5('0x16')][_0x2ee5('0x18')]||null:null,'attributes':_0xa7c493[_0x2ee5('0x16')]?_0xa7c493[_0x2ee5('0x16')][_0x2ee5('0x19')]||null:null,'limit':_0xa7c493['options']?_0xa7c493[_0x2ee5('0x16')][_0x2ee5('0x1a')]||null:null,'include':_0xa7c493[_0x2ee5('0x16')]?_0xa7c493[_0x2ee5('0x16')]['include']?_['map'](_0xa7c493[_0x2ee5('0x16')][_0x2ee5('0x1b')],function(_0x246891){return{'model':db[_0x246891['model']],'as':_0x246891['as'],'attributes':_0x246891[_0x2ee5('0x19')],'include':_0x246891['include']?_['map'](_0x246891[_0x2ee5('0x1b')],function(_0x15b23e){return{'model':db[_0x15b23e[_0x2ee5('0x1c')]],'as':_0x15b23e['as'],'attributes':_0x15b23e[_0x2ee5('0x19')],'include':_0x15b23e[_0x2ee5('0x1b')]?_[_0x2ee5('0x1d')](_0x15b23e[_0x2ee5('0x1b')],function(_0x267ddb){return{'model':db[_0x267ddb[_0x2ee5('0x1c')]],'as':_0x267ddb['as'],'attributes':_0x267ddb[_0x2ee5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2ee5('0x9')](function(_0x2514ad){logger[_0x2ee5('0xa')](_0x2ee5('0x13'),_0xa7c493);logger['debug'](_0x2ee5('0x13'),_0xa7c493,JSON[_0x2ee5('0x1e')](_0x2514ad));_0x273859(_0x2514ad);})['catch'](function(_0x1f9273){logger[_0x2ee5('0xd')](_0x2ee5('0x13'),_0x1f9273[_0x2ee5('0x10')],_0xa7c493);_0x3e1e4f(_0x1424fc[_0x2ee5('0xd')](0x1f4,_0x1f9273[_0x2ee5('0x10')]));});});};exports['ShowVtigerAccount']=function(_0xf146c){var _0x4f58e5=this;return new Promise(function(_0x2f4f1d,_0x3963e8){return db[_0x2ee5('0x14')]['find']({'raw':_0xf146c[_0x2ee5('0x16')]?_0xf146c[_0x2ee5('0x16')][_0x2ee5('0x17')]===undefined?!![]:![]:!![],'where':_0xf146c['options']?_0xf146c[_0x2ee5('0x16')][_0x2ee5('0x18')]||null:null,'attributes':_0xf146c[_0x2ee5('0x16')]?_0xf146c['options'][_0x2ee5('0x19')]||null:null,'include':_0xf146c[_0x2ee5('0x16')]?_0xf146c['options']['include']?_[_0x2ee5('0x1d')](_0xf146c[_0x2ee5('0x16')][_0x2ee5('0x1b')],function(_0x449ef6){return{'model':db[_0x449ef6[_0x2ee5('0x1c')]],'as':_0x449ef6['as'],'attributes':_0x449ef6[_0x2ee5('0x19')],'include':_0x449ef6[_0x2ee5('0x1b')]?_[_0x2ee5('0x1d')](_0x449ef6['include'],function(_0x1fbfc4){return{'model':db[_0x1fbfc4[_0x2ee5('0x1c')]],'as':_0x1fbfc4['as'],'attributes':_0x1fbfc4[_0x2ee5('0x19')],'include':_0x1fbfc4[_0x2ee5('0x1b')]?_[_0x2ee5('0x1d')](_0x1fbfc4['include'],function(_0x4c320d){return{'model':db[_0x4c320d[_0x2ee5('0x1c')]],'as':_0x4c320d['as'],'attributes':_0x4c320d[_0x2ee5('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2ee5('0x9')](function(_0x2b6005){logger[_0x2ee5('0xa')](_0x2ee5('0x1f'),_0xf146c);logger['debug'](_0x2ee5('0x1f'),_0xf146c,JSON[_0x2ee5('0x1e')](_0x2b6005));_0x2f4f1d(_0x2b6005);})['catch'](function(_0x2be0a0){logger[_0x2ee5('0xd')](_0x2ee5('0x1f'),_0x2be0a0[_0x2ee5('0x10')],_0xf146c);_0x3963e8(_0x4f58e5['error'](0x1f4,_0x2be0a0[_0x2ee5('0x10')]));});});}; \ No newline at end of file +var _0x924d=['findAll','options','raw','where','attributes','limit','include','map','model','then','ShowVtigerAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetVtigerAccount','VtigerAccount'];(function(_0x2ab377,_0x3c93d5){var _0x498a84=function(_0xf0836c){while(--_0xf0836c){_0x2ab377['push'](_0x2ab377['shift']());}};_0x498a84(++_0x3c93d5);}(_0x924d,0x115));var _0xd924=function(_0x24b8ec,_0x3c8c5b){_0x24b8ec=_0x24b8ec-0x0;var _0x1d1b63=_0x924d[_0x24b8ec];return _0x1d1b63;};'use strict';var _=require(_0xd924('0x0'));var util=require(_0xd924('0x1'));var moment=require('moment');var BPromise=require(_0xd924('0x2'));var rs=require(_0xd924('0x3'));var fs=require('fs');var Redis=require(_0xd924('0x4'));var db=require(_0xd924('0x5'))['db'];var utils=require(_0xd924('0x6'));var logger=require(_0xd924('0x7'))(_0xd924('0x8'));var config=require(_0xd924('0x9'));var jayson=require(_0xd924('0xa'));var client=jayson[_0xd924('0xb')][_0xd924('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x52fa09,_0x223874,_0x21d1da){return new BPromise(function(_0x120b77,_0x2e2200){return client[_0xd924('0xd')](_0x52fa09,_0x21d1da)['then'](function(_0xa8e4e){logger[_0xd924('0xe')](_0xd924('0xf'),_0x223874,_0xd924('0x10'));logger[_0xd924('0x11')](_0xd924('0x12'),_0x223874,_0xd924('0x10'),JSON[_0xd924('0x13')](_0xa8e4e));if(_0xa8e4e[_0xd924('0x14')]){if(_0xa8e4e[_0xd924('0x14')][_0xd924('0x15')]===0x1f4){logger[_0xd924('0x14')](_0xd924('0xf'),_0x223874,_0xa8e4e[_0xd924('0x14')]['message']);return _0x2e2200(_0xa8e4e[_0xd924('0x14')][_0xd924('0x16')]);}logger[_0xd924('0x14')](_0xd924('0xf'),_0x223874,_0xa8e4e[_0xd924('0x14')]['message']);return _0x120b77(_0xa8e4e[_0xd924('0x14')][_0xd924('0x16')]);}else{logger[_0xd924('0xe')](_0xd924('0xf'),_0x223874,_0xd924('0x10'));_0x120b77(_0xa8e4e[_0xd924('0x17')][_0xd924('0x16')]);}})[_0xd924('0x18')](function(_0x528d64){logger[_0xd924('0x14')]('VtigerAccount,\x20%s,\x20%s',_0x223874,_0x528d64);_0x2e2200(_0x528d64);});});}exports[_0xd924('0x19')]=function(_0x1ebe46){var _0x4ebcca=this;return new Promise(function(_0x1b29bd,_0x2e17e3){return db[_0xd924('0x1a')][_0xd924('0x1b')]({'raw':_0x1ebe46[_0xd924('0x1c')]?_0x1ebe46[_0xd924('0x1c')][_0xd924('0x1d')]===undefined?!![]:![]:!![],'where':_0x1ebe46[_0xd924('0x1c')]?_0x1ebe46[_0xd924('0x1c')][_0xd924('0x1e')]||null:null,'attributes':_0x1ebe46[_0xd924('0x1c')]?_0x1ebe46['options'][_0xd924('0x1f')]||null:null,'limit':_0x1ebe46[_0xd924('0x1c')]?_0x1ebe46[_0xd924('0x1c')][_0xd924('0x20')]||null:null,'include':_0x1ebe46[_0xd924('0x1c')]?_0x1ebe46[_0xd924('0x1c')][_0xd924('0x21')]?_[_0xd924('0x22')](_0x1ebe46[_0xd924('0x1c')][_0xd924('0x21')],function(_0x36ac79){return{'model':db[_0x36ac79['model']],'as':_0x36ac79['as'],'attributes':_0x36ac79[_0xd924('0x1f')],'include':_0x36ac79[_0xd924('0x21')]?_[_0xd924('0x22')](_0x36ac79[_0xd924('0x21')],function(_0x8c5daf){return{'model':db[_0x8c5daf[_0xd924('0x23')]],'as':_0x8c5daf['as'],'attributes':_0x8c5daf[_0xd924('0x1f')],'include':_0x8c5daf[_0xd924('0x21')]?_[_0xd924('0x22')](_0x8c5daf[_0xd924('0x21')],function(_0x22d554){return{'model':db[_0x22d554['model']],'as':_0x22d554['as'],'attributes':_0x22d554['attributes']};}):[]};}):[]};}):[]:[]})[_0xd924('0x24')](function(_0x181011){logger['info']('GetVtigerAccount',_0x1ebe46);logger[_0xd924('0x11')]('GetVtigerAccount',_0x1ebe46,JSON[_0xd924('0x13')](_0x181011));_0x1b29bd(_0x181011);})[_0xd924('0x18')](function(_0x4fb5a8){logger['error']('GetVtigerAccount',_0x4fb5a8['message'],_0x1ebe46);_0x2e17e3(_0x4ebcca['error'](0x1f4,_0x4fb5a8[_0xd924('0x16')]));});});};exports[_0xd924('0x25')]=function(_0x45b5ee){var _0x511d76=this;return new Promise(function(_0x33644a,_0x304e6f){return db[_0xd924('0x1a')]['find']({'raw':_0x45b5ee[_0xd924('0x1c')]?_0x45b5ee[_0xd924('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x45b5ee[_0xd924('0x1c')]?_0x45b5ee[_0xd924('0x1c')][_0xd924('0x1e')]||null:null,'attributes':_0x45b5ee[_0xd924('0x1c')]?_0x45b5ee[_0xd924('0x1c')][_0xd924('0x1f')]||null:null,'include':_0x45b5ee[_0xd924('0x1c')]?_0x45b5ee[_0xd924('0x1c')][_0xd924('0x21')]?_[_0xd924('0x22')](_0x45b5ee['options'][_0xd924('0x21')],function(_0x13e7a6){return{'model':db[_0x13e7a6[_0xd924('0x23')]],'as':_0x13e7a6['as'],'attributes':_0x13e7a6['attributes'],'include':_0x13e7a6[_0xd924('0x21')]?_[_0xd924('0x22')](_0x13e7a6[_0xd924('0x21')],function(_0x298fc4){return{'model':db[_0x298fc4[_0xd924('0x23')]],'as':_0x298fc4['as'],'attributes':_0x298fc4[_0xd924('0x1f')],'include':_0x298fc4[_0xd924('0x21')]?_[_0xd924('0x22')](_0x298fc4[_0xd924('0x21')],function(_0xa48e6c){return{'model':db[_0xa48e6c[_0xd924('0x23')]],'as':_0xa48e6c['as'],'attributes':_0xa48e6c[_0xd924('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd924('0x24')](function(_0x81ce7a){logger[_0xd924('0xe')](_0xd924('0x25'),_0x45b5ee);logger[_0xd924('0x11')](_0xd924('0x25'),_0x45b5ee,JSON[_0xd924('0x13')](_0x81ce7a));_0x33644a(_0x81ce7a);})['catch'](function(_0x119aae){logger[_0xd924('0x14')]('ShowVtigerAccount',_0x119aae[_0xd924('0x16')],_0x45b5ee);_0x304e6f(_0x511d76['error'](0x1f4,_0x119aae['message']));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index e7f3e2e..5da66dc 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 _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(_0x408560,_0x2de014){var _0x3936b0=function(_0x466dd4){while(--_0x466dd4){_0x408560['push'](_0x408560['shift']());}};_0x3936b0(++_0x2de014);}(_0xb10b,0x12a));var _0xbb10=function(_0xe3d4a2,_0x5dbf95){_0xe3d4a2=_0xe3d4a2-0x0;var _0x131efb=_0xb10b[_0xe3d4a2];return _0x131efb;};'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 +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(_0x5cff9d,_0x30ec88){var _0x4390e4=function(_0x3491b7){while(--_0x3491b7){_0x5cff9d['push'](_0x5cff9d['shift']());}};_0x4390e4(++_0x30ec88);}(_0xb10b,0x12a));var _0xbb10=function(_0x100682,_0x11afec){_0x100682=_0x100682-0x0;var _0xcb6e87=_0xb10b[_0x100682];return _0xcb6e87;};'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 9d29a17..78e5498 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 _0x0300=['exports','STRING'];(function(_0x3503af,_0x2b1ab1){var _0x3dc155=function(_0x12b3e4){while(--_0x12b3e4){_0x3503af['push'](_0x3503af['shift']());}};_0x3dc155(++_0x2b1ab1);}(_0x0300,0x152));var _0x0030=function(_0x18df5a,_0x3d2e8d){_0x18df5a=_0x18df5a-0x0;var _0x5a39d4=_0x0300[_0x18df5a];return _0x5a39d4;};'use strict';var Sequelize=require('sequelize');module[_0x0030('0x0')]={'name':{'type':Sequelize[_0x0030('0x1')]},'description':{'type':Sequelize[_0x0030('0x1')]}}; \ No newline at end of file +var _0x3267=['STRING','sequelize','exports'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0x3267,0x15d));var _0x7326=function(_0x3a3758,_0x4dd8cf){_0x3a3758=_0x3a3758-0x0;var _0x1a9234=_0x3267[_0x3a3758];return _0x1a9234;};'use strict';var Sequelize=require(_0x7326('0x0'));module[_0x7326('0x1')]={'name':{'type':Sequelize[_0x7326('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 3b90925..8fd4790 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 _0x6032=['count','limit','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','VtigerConfiguration','rawAttributes','fieldName','type','query','intersection','model','attributes','fields','length','offset','order','where','filters','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','keys','find','create','body','getFields','findOne','VtigerField','sort','nolimit','getSubjects','hasOwnProperty','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','http','ValidationError','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','end','json'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x6032,0xe9));var _0x2603=function(_0x1bc789,_0x65b198){_0x1bc789=_0x1bc789-0x0;var _0x4972a3=_0x6032[_0x1bc789];return _0x4972a3;};'use strict';var pdf=require(_0x2603('0x0'));var emlformat=require(_0x2603('0x1'));var rimraf=require(_0x2603('0x2'));var zipdir=require(_0x2603('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2603('0x4'));var moment=require(_0x2603('0x5'));var BPromise=require(_0x2603('0x6'));var Mustache=require(_0x2603('0x7'));var util=require(_0x2603('0x8'));var path=require(_0x2603('0x9'));var sox=require(_0x2603('0xa'));var csv=require(_0x2603('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2603('0xc'));var jsforce=require(_0x2603('0xd'));var deskjs=require(_0x2603('0xe'));var toCsv=require(_0x2603('0xb'));var querystring=require(_0x2603('0xf'));var Papa=require('papaparse');var Redis=require(_0x2603('0x10'));var authService=require(_0x2603('0x11'));var qs=require(_0x2603('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2603('0x13'));var logger=require(_0x2603('0x14'))(_0x2603('0x15'));var utils=require(_0x2603('0x16'));var config=require(_0x2603('0x17'));var db=require(_0x2603('0x18'))['db'];var jayson=require(_0x2603('0x19'));var client=jayson['client'][_0x2603('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x180b8f,_0x5dd935,_0x394fda){if(_0x394fda){var _0x5a66c8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a66c8['test'](_0x5dd935)){return _0x180b8f;}else{throw new db['Sequelize'][(_0x2603('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 _0x180b8f;}}function respondWithRpcPromise(_0x8f028b,_0x1d8d5a,_0x46fc07,_0x5e6b94){return new BPromise(function(_0x4d13ab,_0x210e3a){var _0x4de07d=_0x5e6b94||client;return _0x4de07d['request'](_0x8f028b,_0x46fc07)[_0x2603('0x1c')](function(_0x257327){logger[_0x2603('0x1d')](_0x2603('0x1e'),_0x1d8d5a,_0x2603('0x1f'));logger[_0x2603('0x20')](_0x2603('0x21'),_0x1d8d5a,_0x2603('0x1f'),JSON[_0x2603('0x22')](_0x257327));if(_0x257327[_0x2603('0x23')]){if(_0x257327['error'][_0x2603('0x24')]===0x1f4){logger[_0x2603('0x23')](_0x2603('0x1e'),_0x1d8d5a,_0x257327[_0x2603('0x23')]['message']);return _0x210e3a(_0x257327[_0x2603('0x23')][_0x2603('0x25')]);}logger[_0x2603('0x23')](_0x2603('0x1e'),_0x1d8d5a,_0x257327[_0x2603('0x23')][_0x2603('0x25')]);return _0x4d13ab(_0x257327[_0x2603('0x23')][_0x2603('0x25')]);}else{logger[_0x2603('0x1d')](_0x2603('0x1e'),_0x1d8d5a,_0x2603('0x1f'));_0x4d13ab(_0x257327['result'][_0x2603('0x25')]);}})[_0x2603('0x26')](function(_0x5d8ecb){logger[_0x2603('0x23')](_0x2603('0x1e'),_0x1d8d5a,_0x5d8ecb);_0x210e3a(_0x5d8ecb);});});}function respondWithStatusCode(_0x4049b4,_0x465b8a){_0x465b8a=_0x465b8a||0xcc;return function(_0x5e70da){if(_0x5e70da){return _0x4049b4[_0x2603('0x27')](_0x465b8a);}return _0x4049b4[_0x2603('0x28')](_0x465b8a)[_0x2603('0x29')]();};}function respondWithResult(_0x22ea52,_0x3df048){_0x3df048=_0x3df048||0xc8;return function(_0x25874a){if(_0x25874a){return _0x22ea52[_0x2603('0x28')](_0x3df048)[_0x2603('0x2a')](_0x25874a);}};}function respondWithFilteredResult(_0x47c69b,_0x10d46a){return function(_0x175983){if(_0x175983){var _0x3cb436=_0x175983[_0x2603('0x2b')],_0x3f4c63=_0x10d46a['offset'],_0x1e84da=_0x10d46a['offset']+_0x10d46a[_0x2603('0x2c')],_0x300762;if(_0x1e84da>=_0x3cb436){_0x1e84da=_0x3cb436;_0x300762=0xc8;}else{_0x300762=0xce;}_0x47c69b['status'](_0x300762);return _0x47c69b[_0x2603('0x2d')](_0x2603('0x2e'),_0x3f4c63+'-'+_0x1e84da+'/'+_0x3cb436)[_0x2603('0x2a')](_0x175983);}return null;};}function patchUpdates(_0x339c52){return function(_0x3d9a58){try{jsonpatch[_0x2603('0x2f')](_0x3d9a58,_0x339c52,!![]);}catch(_0x448d6b){return BPromise['reject'](_0x448d6b);}return _0x3d9a58[_0x2603('0x30')]();};}function saveUpdates(_0x1bf7cb,_0x34b514){return function(_0x46fc27){if(_0x46fc27){return _0x46fc27[_0x2603('0x31')](_0x1bf7cb)['then'](function(_0x30f883){return _0x30f883;});}return null;};}function removeEntity(_0x18f201,_0x3d94cb){return function(_0x3357f0){if(_0x3357f0){return _0x3357f0[_0x2603('0x32')]()['then'](function(){_0x18f201['status'](0xcc)[_0x2603('0x29')]();});}};}function handleEntityNotFound(_0x5b5b0e,_0x24a7ae){return function(_0x59d979){if(!_0x59d979){_0x5b5b0e[_0x2603('0x27')](0x194);}return _0x59d979;};}function handleError(_0x3f649e,_0x10fe25){_0x10fe25=_0x10fe25||0x1f4;return function(_0x54af83){logger['error'](_0x54af83[_0x2603('0x33')]);if(_0x54af83[_0x2603('0x34')]){delete _0x54af83[_0x2603('0x34')];}_0x3f649e[_0x2603('0x28')](_0x10fe25)[_0x2603('0x35')](_0x54af83);};}exports[_0x2603('0x36')]=function(_0x52fb3e,_0x375f17){var _0x3b6e51={},_0x3c26d2={},_0x844e09={'count':0x0,'rows':[]};var _0x5d420c=_[_0x2603('0x37')](db[_0x2603('0x38')][_0x2603('0x39')],function(_0x486d6d){return{'name':_0x486d6d[_0x2603('0x3a')],'type':_0x486d6d[_0x2603('0x3b')]['key']};});_0x3c26d2['model']=_['map'](_0x5d420c,'name');_0x3c26d2[_0x2603('0x3c')]=_['keys'](_0x52fb3e['query']);_0x3c26d2['filters']=_[_0x2603('0x3d')](_0x3c26d2[_0x2603('0x3e')],_0x3c26d2[_0x2603('0x3c')]);_0x3b6e51[_0x2603('0x3f')]=_[_0x2603('0x3d')](_0x3c26d2[_0x2603('0x3e')],qs[_0x2603('0x40')](_0x52fb3e[_0x2603('0x3c')][_0x2603('0x40')]));_0x3b6e51[_0x2603('0x3f')]=_0x3b6e51[_0x2603('0x3f')][_0x2603('0x41')]?_0x3b6e51['attributes']:_0x3c26d2[_0x2603('0x3e')];if(!_0x52fb3e[_0x2603('0x3c')]['hasOwnProperty']('nolimit')){_0x3b6e51[_0x2603('0x2c')]=qs[_0x2603('0x2c')](_0x52fb3e[_0x2603('0x3c')][_0x2603('0x2c')]);_0x3b6e51[_0x2603('0x42')]=qs[_0x2603('0x42')](_0x52fb3e[_0x2603('0x3c')][_0x2603('0x42')]);}_0x3b6e51[_0x2603('0x43')]=qs['sort'](_0x52fb3e[_0x2603('0x3c')]['sort']);_0x3b6e51[_0x2603('0x44')]=qs[_0x2603('0x45')](_[_0x2603('0x46')](_0x52fb3e[_0x2603('0x3c')],_0x3c26d2[_0x2603('0x45')]));if(_0x52fb3e[_0x2603('0x3c')][_0x2603('0x47')]){_0x3b6e51[_0x2603('0x44')]=_['merge'](_0x3b6e51[_0x2603('0x44')],{'$or':_['map'](_0x5d420c,function(_0x5ea7be){if(_0x5ea7be[_0x2603('0x3b')]!==_0x2603('0x48')){var _0x352ea6={};_0x352ea6[_0x5ea7be[_0x2603('0x34')]]={'$like':'%'+_0x52fb3e[_0x2603('0x3c')]['filter']+'%'};return _0x352ea6;}})});}_0x3b6e51=_[_0x2603('0x49')]({},_0x3b6e51,_0x52fb3e[_0x2603('0x4a')]);var _0x303847={'where':_0x3b6e51[_0x2603('0x44')]};return db[_0x2603('0x38')]['count'](_0x303847)[_0x2603('0x1c')](function(_0x376bf5){_0x844e09[_0x2603('0x2b')]=_0x376bf5;if(_0x52fb3e[_0x2603('0x3c')][_0x2603('0x4b')]){_0x3b6e51[_0x2603('0x4c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x2603('0x4d')](_0x3b6e51);})[_0x2603('0x1c')](function(_0x34b108){_0x844e09['rows']=_0x34b108;return _0x844e09;})[_0x2603('0x1c')](respondWithFilteredResult(_0x375f17,_0x3b6e51))['catch'](handleError(_0x375f17,null));};exports[_0x2603('0x4e')]=function(_0x48eb76,_0x104b8b){var _0x218131={'raw':![],'where':{'id':_0x48eb76[_0x2603('0x4f')]['id']}},_0xbb43a7={};_0xbb43a7['model']=_['keys'](db['VtigerConfiguration'][_0x2603('0x39')]);_0xbb43a7[_0x2603('0x3c')]=_[_0x2603('0x50')](_0x48eb76[_0x2603('0x3c')]);_0xbb43a7[_0x2603('0x45')]=_[_0x2603('0x3d')](_0xbb43a7[_0x2603('0x3e')],_0xbb43a7[_0x2603('0x3c')]);_0x218131[_0x2603('0x3f')]=_[_0x2603('0x3d')](_0xbb43a7[_0x2603('0x3e')],qs['fields'](_0x48eb76[_0x2603('0x3c')][_0x2603('0x40')]));_0x218131[_0x2603('0x3f')]=_0x218131['attributes'][_0x2603('0x41')]?_0x218131[_0x2603('0x3f')]:_0xbb43a7[_0x2603('0x3e')];if(_0x48eb76[_0x2603('0x3c')][_0x2603('0x4b')]){_0x218131[_0x2603('0x4c')]=[{'all':!![]}];}_0x218131=_[_0x2603('0x49')]({},_0x218131,_0x48eb76[_0x2603('0x4a')]);return db[_0x2603('0x38')][_0x2603('0x51')](_0x218131)[_0x2603('0x1c')](handleEntityNotFound(_0x104b8b,null))[_0x2603('0x1c')](respondWithResult(_0x104b8b,null))[_0x2603('0x26')](handleError(_0x104b8b,null));};exports['create']=function(_0x3e728d,_0x52d167){return db['VtigerConfiguration'][_0x2603('0x52')](_0x3e728d[_0x2603('0x53')],{})[_0x2603('0x1c')](respondWithResult(_0x52d167,0xc9))[_0x2603('0x26')](handleError(_0x52d167,null));};exports[_0x2603('0x31')]=function(_0x4d208b,_0xf8d718){if(_0x4d208b[_0x2603('0x53')]['id']){delete _0x4d208b[_0x2603('0x53')]['id'];}return db[_0x2603('0x38')][_0x2603('0x51')]({'where':{'id':_0x4d208b[_0x2603('0x4f')]['id']}})[_0x2603('0x1c')](handleEntityNotFound(_0xf8d718,null))[_0x2603('0x1c')](saveUpdates(_0x4d208b[_0x2603('0x53')],null))['then'](respondWithResult(_0xf8d718,null))[_0x2603('0x26')](handleError(_0xf8d718,null));};exports[_0x2603('0x32')]=function(_0x2cce6e,_0x1ab857){return db[_0x2603('0x38')][_0x2603('0x51')]({'where':{'id':_0x2cce6e[_0x2603('0x4f')]['id']}})[_0x2603('0x1c')](handleEntityNotFound(_0x1ab857,null))[_0x2603('0x1c')](removeEntity(_0x1ab857,null))[_0x2603('0x26')](handleError(_0x1ab857,null));};exports[_0x2603('0x54')]=function(_0xed52b1,_0x3bcaca,_0x58dfa3){var _0x205604={};var _0x5c0491={};var _0x503962;var _0x37d41f;return db[_0x2603('0x38')][_0x2603('0x55')]({'where':{'id':_0xed52b1['params']['id']}})[_0x2603('0x1c')](handleEntityNotFound(_0x3bcaca,null))[_0x2603('0x1c')](function(_0x194891){if(_0x194891){_0x503962=_0x194891;_0x5c0491['model']=_['keys'](db[_0x2603('0x56')]['rawAttributes']);_0x5c0491[_0x2603('0x3c')]=_[_0x2603('0x50')](_0xed52b1['query']);_0x5c0491[_0x2603('0x45')]=_[_0x2603('0x3d')](_0x5c0491[_0x2603('0x3e')],_0x5c0491['query']);_0x205604['attributes']=_['intersection'](_0x5c0491[_0x2603('0x3e')],qs['fields'](_0xed52b1[_0x2603('0x3c')][_0x2603('0x40')]));_0x205604[_0x2603('0x3f')]=_0x205604['attributes']['length']?_0x205604[_0x2603('0x3f')]:_0x5c0491['model'];_0x205604[_0x2603('0x43')]=qs[_0x2603('0x57')](_0xed52b1['query'][_0x2603('0x57')]);_0x205604[_0x2603('0x44')]=qs['filters'](_[_0x2603('0x46')](_0xed52b1[_0x2603('0x3c')],_0x5c0491['filters']));if(_0xed52b1[_0x2603('0x3c')][_0x2603('0x47')]){_0x205604[_0x2603('0x44')]=_['merge'](_0x205604[_0x2603('0x44')],{'$or':_['map'](_0x205604[_0x2603('0x3f')],function(_0xbd90ea){var _0x3ce2c9={};_0x3ce2c9[_0xbd90ea]={'$like':'%'+_0xed52b1['query']['filter']+'%'};return _0x3ce2c9;})});}_0x205604=_[_0x2603('0x49')]({},_0x205604,_0xed52b1[_0x2603('0x4a')]);return _0x503962[_0x2603('0x54')](_0x205604);}})[_0x2603('0x1c')](function(_0xc786cc){if(_0xc786cc){_0x37d41f=_0xc786cc[_0x2603('0x41')];if(!_0xed52b1[_0x2603('0x3c')]['hasOwnProperty'](_0x2603('0x58'))){_0x205604[_0x2603('0x2c')]=qs[_0x2603('0x2c')](_0xed52b1[_0x2603('0x3c')]['limit']);_0x205604['offset']=qs['offset'](_0xed52b1[_0x2603('0x3c')]['offset']);}return _0x503962[_0x2603('0x54')](_0x205604);}})[_0x2603('0x1c')](function(_0x37b866){if(_0x37b866){return _0x37b866?{'count':_0x37d41f,'rows':_0x37b866}:null;}})['then'](respondWithResult(_0x3bcaca,null))[_0x2603('0x26')](handleError(_0x3bcaca,null));};exports[_0x2603('0x59')]=function(_0x775fe9,_0x5572ba,_0x26dc7d){var _0x39f298={};var _0x257c53={};var _0x14ea24;var _0x595825;return db[_0x2603('0x38')]['findOne']({'where':{'id':_0x775fe9['params']['id']}})[_0x2603('0x1c')](handleEntityNotFound(_0x5572ba,null))['then'](function(_0x518249){if(_0x518249){_0x14ea24=_0x518249;_0x257c53['model']=_[_0x2603('0x50')](db[_0x2603('0x56')]['rawAttributes']);_0x257c53[_0x2603('0x3c')]=_[_0x2603('0x50')](_0x775fe9['query']);_0x257c53[_0x2603('0x45')]=_['intersection'](_0x257c53['model'],_0x257c53[_0x2603('0x3c')]);_0x39f298[_0x2603('0x3f')]=_['intersection'](_0x257c53['model'],qs[_0x2603('0x40')](_0x775fe9[_0x2603('0x3c')][_0x2603('0x40')]));_0x39f298[_0x2603('0x3f')]=_0x39f298[_0x2603('0x3f')][_0x2603('0x41')]?_0x39f298[_0x2603('0x3f')]:_0x257c53['model'];_0x39f298[_0x2603('0x43')]=qs[_0x2603('0x57')](_0x775fe9['query'][_0x2603('0x57')]);_0x39f298['where']=qs['filters'](_['pick'](_0x775fe9[_0x2603('0x3c')],_0x257c53['filters']));if(_0x775fe9[_0x2603('0x3c')][_0x2603('0x47')]){_0x39f298['where']=_[_0x2603('0x49')](_0x39f298[_0x2603('0x44')],{'$or':_[_0x2603('0x37')](_0x39f298[_0x2603('0x3f')],function(_0x1764c3){var _0x252f60={};_0x252f60[_0x1764c3]={'$like':'%'+_0x775fe9[_0x2603('0x3c')][_0x2603('0x47')]+'%'};return _0x252f60;})});}_0x39f298=_[_0x2603('0x49')]({},_0x39f298,_0x775fe9['options']);return _0x14ea24[_0x2603('0x59')](_0x39f298);}})[_0x2603('0x1c')](function(_0x10163f){if(_0x10163f){_0x595825=_0x10163f[_0x2603('0x41')];if(!_0x775fe9[_0x2603('0x3c')][_0x2603('0x5a')](_0x2603('0x58'))){_0x39f298['limit']=qs[_0x2603('0x2c')](_0x775fe9[_0x2603('0x3c')]['limit']);_0x39f298[_0x2603('0x42')]=qs[_0x2603('0x42')](_0x775fe9['query'][_0x2603('0x42')]);}return _0x14ea24[_0x2603('0x59')](_0x39f298);}})[_0x2603('0x1c')](function(_0x292804){if(_0x292804){return _0x292804?{'count':_0x595825,'rows':_0x292804}:null;}})[_0x2603('0x1c')](respondWithResult(_0x5572ba,null))[_0x2603('0x26')](handleError(_0x5572ba,null));};exports[_0x2603('0x5b')]=function(_0x2ba19d,_0x3301a4,_0x1e497b){var _0x5e04bd={};var _0x3e923e={};var _0x77e315;var _0x732342;return db[_0x2603('0x38')][_0x2603('0x55')]({'where':{'id':_0x2ba19d[_0x2603('0x4f')]['id']}})[_0x2603('0x1c')](handleEntityNotFound(_0x3301a4,null))[_0x2603('0x1c')](function(_0x44af60){if(_0x44af60){_0x77e315=_0x44af60;_0x3e923e['model']=_[_0x2603('0x50')](db[_0x2603('0x56')][_0x2603('0x39')]);_0x3e923e[_0x2603('0x3c')]=_[_0x2603('0x50')](_0x2ba19d[_0x2603('0x3c')]);_0x3e923e['filters']=_[_0x2603('0x3d')](_0x3e923e['model'],_0x3e923e[_0x2603('0x3c')]);_0x5e04bd['attributes']=_[_0x2603('0x3d')](_0x3e923e[_0x2603('0x3e')],qs[_0x2603('0x40')](_0x2ba19d[_0x2603('0x3c')][_0x2603('0x40')]));_0x5e04bd[_0x2603('0x3f')]=_0x5e04bd[_0x2603('0x3f')][_0x2603('0x41')]?_0x5e04bd[_0x2603('0x3f')]:_0x3e923e[_0x2603('0x3e')];_0x5e04bd['order']=qs[_0x2603('0x57')](_0x2ba19d[_0x2603('0x3c')][_0x2603('0x57')]);_0x5e04bd['where']=qs[_0x2603('0x45')](_[_0x2603('0x46')](_0x2ba19d[_0x2603('0x3c')],_0x3e923e['filters']));if(_0x2ba19d['query'][_0x2603('0x47')]){_0x5e04bd['where']=_[_0x2603('0x49')](_0x5e04bd[_0x2603('0x44')],{'$or':_[_0x2603('0x37')](_0x5e04bd[_0x2603('0x3f')],function(_0x22dfc4){var _0x41859a={};_0x41859a[_0x22dfc4]={'$like':'%'+_0x2ba19d[_0x2603('0x3c')][_0x2603('0x47')]+'%'};return _0x41859a;})});}_0x5e04bd=_['merge']({},_0x5e04bd,_0x2ba19d['options']);return _0x77e315[_0x2603('0x5b')](_0x5e04bd);}})[_0x2603('0x1c')](function(_0x4adcf6){if(_0x4adcf6){_0x732342=_0x4adcf6[_0x2603('0x41')];if(!_0x2ba19d[_0x2603('0x3c')][_0x2603('0x5a')](_0x2603('0x58'))){_0x5e04bd['limit']=qs[_0x2603('0x2c')](_0x2ba19d[_0x2603('0x3c')][_0x2603('0x2c')]);_0x5e04bd[_0x2603('0x42')]=qs[_0x2603('0x42')](_0x2ba19d[_0x2603('0x3c')]['offset']);}return _0x77e315[_0x2603('0x5b')](_0x5e04bd);}})[_0x2603('0x1c')](function(_0x3b648d){if(_0x3b648d){return _0x3b648d?{'count':_0x732342,'rows':_0x3b648d}:null;}})[_0x2603('0x1c')](respondWithResult(_0x3301a4,null))[_0x2603('0x26')](handleError(_0x3301a4,null));}; \ No newline at end of file +var _0xa87b=['../../config/environment','client','http','test','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','status','json','offset','limit','set','apply','reject','save','update','destroy','end','sendStatus','name','send','VtigerConfiguration','rawAttributes','type','query','keys','filters','model','attributes','intersection','fields','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','show','params','length','find','create','body','getFields','findOne','order','hasOwnProperty','VtigerField','getSubjects','nolimit','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1490d2,_0x533695){var _0x3da74d=function(_0x11c454){while(--_0x11c454){_0x1490d2['push'](_0x1490d2['shift']());}};_0x3da74d(++_0x533695);}(_0xa87b,0x199));var _0xba87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa87b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xba87('0x0'));var emlformat=require(_0xba87('0x1'));var rimraf=require(_0xba87('0x2'));var zipdir=require(_0xba87('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba87('0x4'));var moment=require('moment');var BPromise=require(_0xba87('0x5'));var Mustache=require(_0xba87('0x6'));var util=require(_0xba87('0x7'));var path=require(_0xba87('0x8'));var sox=require(_0xba87('0x9'));var csv=require(_0xba87('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xba87('0xb'));var squel=require(_0xba87('0xc'));var crypto=require('crypto');var jsforce=require(_0xba87('0xd'));var deskjs=require(_0xba87('0xe'));var toCsv=require(_0xba87('0xa'));var querystring=require('querystring');var Papa=require(_0xba87('0xf'));var Redis=require(_0xba87('0x10'));var authService=require(_0xba87('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xba87('0x12'));var hardwareService=require(_0xba87('0x13'));var logger=require(_0xba87('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xba87('0x15'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xba87('0x16')][_0xba87('0x17')]({'port':0x232a});function checkPasswordPattern(_0x17cac0,_0x425c45,_0x5e3450){if(_0x5e3450){var _0x5d016b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d016b[_0xba87('0x18')](_0x425c45)){return _0x17cac0;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x17cac0;}}function respondWithRpcPromise(_0x24133c,_0x46dbfb,_0x3313cd,_0x1f572e){return new BPromise(function(_0x331d47,_0x2bb9fa){var _0x2ebd0c=_0x1f572e||client;return _0x2ebd0c[_0xba87('0x19')](_0x24133c,_0x3313cd)[_0xba87('0x1a')](function(_0x1a7f9f){logger[_0xba87('0x1b')](_0xba87('0x1c'),_0x46dbfb,_0xba87('0x1d'));logger[_0xba87('0x1e')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x46dbfb,_0xba87('0x1d'),JSON[_0xba87('0x1f')](_0x1a7f9f));if(_0x1a7f9f['error']){if(_0x1a7f9f[_0xba87('0x20')]['code']===0x1f4){logger['error']('VtigerConfiguration,\x20%s,\x20%s',_0x46dbfb,_0x1a7f9f[_0xba87('0x20')]['message']);return _0x2bb9fa(_0x1a7f9f[_0xba87('0x20')][_0xba87('0x21')]);}logger[_0xba87('0x20')](_0xba87('0x1c'),_0x46dbfb,_0x1a7f9f['error'][_0xba87('0x21')]);return _0x331d47(_0x1a7f9f['error'][_0xba87('0x21')]);}else{logger[_0xba87('0x1b')](_0xba87('0x1c'),_0x46dbfb,'request\x20sent');_0x331d47(_0x1a7f9f[_0xba87('0x22')][_0xba87('0x21')]);}})[_0xba87('0x23')](function(_0x2e5351){logger[_0xba87('0x20')]('VtigerConfiguration,\x20%s,\x20%s',_0x46dbfb,_0x2e5351);_0x2bb9fa(_0x2e5351);});});}function respondWithStatusCode(_0x2b3076,_0x3f368e){_0x3f368e=_0x3f368e||0xcc;return function(_0x359525){if(_0x359525){return _0x2b3076['sendStatus'](_0x3f368e);}return _0x2b3076['status'](_0x3f368e)['end']();};}function respondWithResult(_0x56c04c,_0x2305c2){_0x2305c2=_0x2305c2||0xc8;return function(_0x4a5111){if(_0x4a5111){return _0x56c04c[_0xba87('0x24')](_0x2305c2)[_0xba87('0x25')](_0x4a5111);}};}function respondWithFilteredResult(_0x4daa09,_0x24113d){return function(_0x17f62c){if(_0x17f62c){var _0x22d970=_0x17f62c['count'],_0x2b4861=_0x24113d[_0xba87('0x26')],_0x370b17=_0x24113d[_0xba87('0x26')]+_0x24113d[_0xba87('0x27')],_0x40a0cb;if(_0x370b17>=_0x22d970){_0x370b17=_0x22d970;_0x40a0cb=0xc8;}else{_0x40a0cb=0xce;}_0x4daa09[_0xba87('0x24')](_0x40a0cb);return _0x4daa09[_0xba87('0x28')]('Content-Range',_0x2b4861+'-'+_0x370b17+'/'+_0x22d970)[_0xba87('0x25')](_0x17f62c);}return null;};}function patchUpdates(_0x2a01a1){return function(_0x5cf174){try{jsonpatch[_0xba87('0x29')](_0x5cf174,_0x2a01a1,!![]);}catch(_0x3f55ca){return BPromise[_0xba87('0x2a')](_0x3f55ca);}return _0x5cf174[_0xba87('0x2b')]();};}function saveUpdates(_0x3fd3f3,_0x5b7d8c){return function(_0x3532e5){if(_0x3532e5){return _0x3532e5[_0xba87('0x2c')](_0x3fd3f3)[_0xba87('0x1a')](function(_0x234103){return _0x234103;});}return null;};}function removeEntity(_0x334df0,_0x538c0f){return function(_0x3bd3f1){if(_0x3bd3f1){return _0x3bd3f1[_0xba87('0x2d')]()[_0xba87('0x1a')](function(){_0x334df0['status'](0xcc)[_0xba87('0x2e')]();});}};}function handleEntityNotFound(_0x2932f9,_0x4c1b1b){return function(_0x5739bb){if(!_0x5739bb){_0x2932f9[_0xba87('0x2f')](0x194);}return _0x5739bb;};}function handleError(_0x206190,_0x15eb72){_0x15eb72=_0x15eb72||0x1f4;return function(_0x5cd922){logger[_0xba87('0x20')](_0x5cd922['stack']);if(_0x5cd922[_0xba87('0x30')]){delete _0x5cd922['name'];}_0x206190['status'](_0x15eb72)[_0xba87('0x31')](_0x5cd922);};}exports['index']=function(_0x58f09c,_0x444b1c){var _0x3e7b5f={},_0x28d5ea={},_0x3dec7f={'count':0x0,'rows':[]};var _0x3fd2d9=_['map'](db[_0xba87('0x32')][_0xba87('0x33')],function(_0x2fc404){return{'name':_0x2fc404['fieldName'],'type':_0x2fc404[_0xba87('0x34')]['key']};});_0x28d5ea['model']=_['map'](_0x3fd2d9,_0xba87('0x30'));_0x28d5ea[_0xba87('0x35')]=_[_0xba87('0x36')](_0x58f09c['query']);_0x28d5ea[_0xba87('0x37')]=_['intersection'](_0x28d5ea[_0xba87('0x38')],_0x28d5ea[_0xba87('0x35')]);_0x3e7b5f[_0xba87('0x39')]=_[_0xba87('0x3a')](_0x28d5ea['model'],qs[_0xba87('0x3b')](_0x58f09c['query']['fields']));_0x3e7b5f[_0xba87('0x39')]=_0x3e7b5f[_0xba87('0x39')]['length']?_0x3e7b5f['attributes']:_0x28d5ea[_0xba87('0x38')];if(!_0x58f09c[_0xba87('0x35')]['hasOwnProperty']('nolimit')){_0x3e7b5f[_0xba87('0x27')]=qs['limit'](_0x58f09c[_0xba87('0x35')][_0xba87('0x27')]);_0x3e7b5f[_0xba87('0x26')]=qs[_0xba87('0x26')](_0x58f09c[_0xba87('0x35')][_0xba87('0x26')]);}_0x3e7b5f['order']=qs[_0xba87('0x3c')](_0x58f09c[_0xba87('0x35')][_0xba87('0x3c')]);_0x3e7b5f[_0xba87('0x3d')]=qs[_0xba87('0x37')](_[_0xba87('0x3e')](_0x58f09c[_0xba87('0x35')],_0x28d5ea[_0xba87('0x37')]));if(_0x58f09c['query'][_0xba87('0x3f')]){_0x3e7b5f[_0xba87('0x3d')]=_[_0xba87('0x40')](_0x3e7b5f[_0xba87('0x3d')],{'$or':_[_0xba87('0x41')](_0x3fd2d9,function(_0x21f69c){if(_0x21f69c[_0xba87('0x34')]!==_0xba87('0x42')){var _0x23c6e7={};_0x23c6e7[_0x21f69c[_0xba87('0x30')]]={'$like':'%'+_0x58f09c[_0xba87('0x35')]['filter']+'%'};return _0x23c6e7;}})});}_0x3e7b5f=_[_0xba87('0x40')]({},_0x3e7b5f,_0x58f09c[_0xba87('0x43')]);var _0x443687={'where':_0x3e7b5f[_0xba87('0x3d')]};return db[_0xba87('0x32')][_0xba87('0x44')](_0x443687)[_0xba87('0x1a')](function(_0x4456fc){_0x3dec7f[_0xba87('0x44')]=_0x4456fc;if(_0x58f09c[_0xba87('0x35')][_0xba87('0x45')]){_0x3e7b5f[_0xba87('0x46')]=[{'all':!![]}];}return db[_0xba87('0x32')][_0xba87('0x47')](_0x3e7b5f);})['then'](function(_0x144622){_0x3dec7f['rows']=_0x144622;return _0x3dec7f;})['then'](respondWithFilteredResult(_0x444b1c,_0x3e7b5f))['catch'](handleError(_0x444b1c,null));};exports[_0xba87('0x48')]=function(_0x40e16d,_0x1ee25c){var _0x133c57={'raw':![],'where':{'id':_0x40e16d[_0xba87('0x49')]['id']}},_0x27a3af={};_0x27a3af[_0xba87('0x38')]=_['keys'](db[_0xba87('0x32')][_0xba87('0x33')]);_0x27a3af[_0xba87('0x35')]=_[_0xba87('0x36')](_0x40e16d[_0xba87('0x35')]);_0x27a3af[_0xba87('0x37')]=_[_0xba87('0x3a')](_0x27a3af[_0xba87('0x38')],_0x27a3af['query']);_0x133c57[_0xba87('0x39')]=_['intersection'](_0x27a3af[_0xba87('0x38')],qs[_0xba87('0x3b')](_0x40e16d[_0xba87('0x35')][_0xba87('0x3b')]));_0x133c57[_0xba87('0x39')]=_0x133c57[_0xba87('0x39')][_0xba87('0x4a')]?_0x133c57[_0xba87('0x39')]:_0x27a3af[_0xba87('0x38')];if(_0x40e16d['query']['includeAll']){_0x133c57['include']=[{'all':!![]}];}_0x133c57=_[_0xba87('0x40')]({},_0x133c57,_0x40e16d[_0xba87('0x43')]);return db[_0xba87('0x32')][_0xba87('0x4b')](_0x133c57)[_0xba87('0x1a')](handleEntityNotFound(_0x1ee25c,null))[_0xba87('0x1a')](respondWithResult(_0x1ee25c,null))['catch'](handleError(_0x1ee25c,null));};exports[_0xba87('0x4c')]=function(_0xdcadaa,_0x2790de){return db[_0xba87('0x32')][_0xba87('0x4c')](_0xdcadaa[_0xba87('0x4d')],{})[_0xba87('0x1a')](respondWithResult(_0x2790de,0xc9))[_0xba87('0x23')](handleError(_0x2790de,null));};exports[_0xba87('0x2c')]=function(_0x5edf98,_0x4c1be0){if(_0x5edf98['body']['id']){delete _0x5edf98[_0xba87('0x4d')]['id'];}return db[_0xba87('0x32')][_0xba87('0x4b')]({'where':{'id':_0x5edf98[_0xba87('0x49')]['id']}})[_0xba87('0x1a')](handleEntityNotFound(_0x4c1be0,null))['then'](saveUpdates(_0x5edf98[_0xba87('0x4d')],null))[_0xba87('0x1a')](respondWithResult(_0x4c1be0,null))['catch'](handleError(_0x4c1be0,null));};exports['destroy']=function(_0x1e3023,_0x253746){return db[_0xba87('0x32')][_0xba87('0x4b')]({'where':{'id':_0x1e3023[_0xba87('0x49')]['id']}})[_0xba87('0x1a')](handleEntityNotFound(_0x253746,null))['then'](removeEntity(_0x253746,null))['catch'](handleError(_0x253746,null));};exports[_0xba87('0x4e')]=function(_0x1cf33f,_0x42d984,_0x587aff){var _0x39e510={};var _0x2310be={};var _0x588551;var _0x10190a;return db[_0xba87('0x32')][_0xba87('0x4f')]({'where':{'id':_0x1cf33f[_0xba87('0x49')]['id']}})[_0xba87('0x1a')](handleEntityNotFound(_0x42d984,null))[_0xba87('0x1a')](function(_0x37a23f){if(_0x37a23f){_0x588551=_0x37a23f;_0x2310be[_0xba87('0x38')]=_['keys'](db['VtigerField']['rawAttributes']);_0x2310be['query']=_[_0xba87('0x36')](_0x1cf33f[_0xba87('0x35')]);_0x2310be[_0xba87('0x37')]=_['intersection'](_0x2310be[_0xba87('0x38')],_0x2310be[_0xba87('0x35')]);_0x39e510[_0xba87('0x39')]=_[_0xba87('0x3a')](_0x2310be[_0xba87('0x38')],qs[_0xba87('0x3b')](_0x1cf33f[_0xba87('0x35')][_0xba87('0x3b')]));_0x39e510[_0xba87('0x39')]=_0x39e510[_0xba87('0x39')][_0xba87('0x4a')]?_0x39e510['attributes']:_0x2310be[_0xba87('0x38')];_0x39e510[_0xba87('0x50')]=qs[_0xba87('0x3c')](_0x1cf33f[_0xba87('0x35')][_0xba87('0x3c')]);_0x39e510['where']=qs[_0xba87('0x37')](_['pick'](_0x1cf33f[_0xba87('0x35')],_0x2310be['filters']));if(_0x1cf33f[_0xba87('0x35')][_0xba87('0x3f')]){_0x39e510[_0xba87('0x3d')]=_[_0xba87('0x40')](_0x39e510[_0xba87('0x3d')],{'$or':_[_0xba87('0x41')](_0x39e510[_0xba87('0x39')],function(_0x48f23a){var _0x534483={};_0x534483[_0x48f23a]={'$like':'%'+_0x1cf33f[_0xba87('0x35')][_0xba87('0x3f')]+'%'};return _0x534483;})});}_0x39e510=_[_0xba87('0x40')]({},_0x39e510,_0x1cf33f[_0xba87('0x43')]);return _0x588551['getFields'](_0x39e510);}})[_0xba87('0x1a')](function(_0x1f82fc){if(_0x1f82fc){_0x10190a=_0x1f82fc[_0xba87('0x4a')];if(!_0x1cf33f[_0xba87('0x35')][_0xba87('0x51')]('nolimit')){_0x39e510['limit']=qs['limit'](_0x1cf33f[_0xba87('0x35')]['limit']);_0x39e510[_0xba87('0x26')]=qs[_0xba87('0x26')](_0x1cf33f[_0xba87('0x35')][_0xba87('0x26')]);}return _0x588551['getFields'](_0x39e510);}})[_0xba87('0x1a')](function(_0x1d4886){if(_0x1d4886){return _0x1d4886?{'count':_0x10190a,'rows':_0x1d4886}:null;}})['then'](respondWithResult(_0x42d984,null))[_0xba87('0x23')](handleError(_0x42d984,null));};exports['getSubjects']=function(_0x1a8403,_0x525294,_0x224ccb){var _0x1e78d1={};var _0x509c03={};var _0x583e4b;var _0x5b924c;return db[_0xba87('0x32')][_0xba87('0x4f')]({'where':{'id':_0x1a8403[_0xba87('0x49')]['id']}})[_0xba87('0x1a')](handleEntityNotFound(_0x525294,null))[_0xba87('0x1a')](function(_0x1e4adf){if(_0x1e4adf){_0x583e4b=_0x1e4adf;_0x509c03[_0xba87('0x38')]=_[_0xba87('0x36')](db[_0xba87('0x52')][_0xba87('0x33')]);_0x509c03['query']=_[_0xba87('0x36')](_0x1a8403[_0xba87('0x35')]);_0x509c03[_0xba87('0x37')]=_[_0xba87('0x3a')](_0x509c03['model'],_0x509c03[_0xba87('0x35')]);_0x1e78d1[_0xba87('0x39')]=_[_0xba87('0x3a')](_0x509c03[_0xba87('0x38')],qs[_0xba87('0x3b')](_0x1a8403['query']['fields']));_0x1e78d1['attributes']=_0x1e78d1[_0xba87('0x39')][_0xba87('0x4a')]?_0x1e78d1[_0xba87('0x39')]:_0x509c03[_0xba87('0x38')];_0x1e78d1['order']=qs[_0xba87('0x3c')](_0x1a8403['query']['sort']);_0x1e78d1[_0xba87('0x3d')]=qs[_0xba87('0x37')](_[_0xba87('0x3e')](_0x1a8403['query'],_0x509c03['filters']));if(_0x1a8403['query'][_0xba87('0x3f')]){_0x1e78d1['where']=_[_0xba87('0x40')](_0x1e78d1[_0xba87('0x3d')],{'$or':_[_0xba87('0x41')](_0x1e78d1[_0xba87('0x39')],function(_0x9ce041){var _0x4d67b9={};_0x4d67b9[_0x9ce041]={'$like':'%'+_0x1a8403[_0xba87('0x35')][_0xba87('0x3f')]+'%'};return _0x4d67b9;})});}_0x1e78d1=_['merge']({},_0x1e78d1,_0x1a8403['options']);return _0x583e4b[_0xba87('0x53')](_0x1e78d1);}})['then'](function(_0x738dc4){if(_0x738dc4){_0x5b924c=_0x738dc4['length'];if(!_0x1a8403['query'][_0xba87('0x51')](_0xba87('0x54'))){_0x1e78d1[_0xba87('0x27')]=qs[_0xba87('0x27')](_0x1a8403[_0xba87('0x35')][_0xba87('0x27')]);_0x1e78d1[_0xba87('0x26')]=qs['offset'](_0x1a8403[_0xba87('0x35')][_0xba87('0x26')]);}return _0x583e4b[_0xba87('0x53')](_0x1e78d1);}})[_0xba87('0x1a')](function(_0x22034a){if(_0x22034a){return _0x22034a?{'count':_0x5b924c,'rows':_0x22034a}:null;}})[_0xba87('0x1a')](respondWithResult(_0x525294,null))[_0xba87('0x23')](handleError(_0x525294,null));};exports[_0xba87('0x55')]=function(_0x350bfa,_0x2e8da8,_0x30c307){var _0x1af859={};var _0x2a05bc={};var _0x3c7b02;var _0x13f8f4;return db['VtigerConfiguration'][_0xba87('0x4f')]({'where':{'id':_0x350bfa[_0xba87('0x49')]['id']}})[_0xba87('0x1a')](handleEntityNotFound(_0x2e8da8,null))['then'](function(_0x25e9a7){if(_0x25e9a7){_0x3c7b02=_0x25e9a7;_0x2a05bc[_0xba87('0x38')]=_[_0xba87('0x36')](db[_0xba87('0x52')]['rawAttributes']);_0x2a05bc[_0xba87('0x35')]=_[_0xba87('0x36')](_0x350bfa[_0xba87('0x35')]);_0x2a05bc[_0xba87('0x37')]=_[_0xba87('0x3a')](_0x2a05bc['model'],_0x2a05bc[_0xba87('0x35')]);_0x1af859[_0xba87('0x39')]=_[_0xba87('0x3a')](_0x2a05bc[_0xba87('0x38')],qs[_0xba87('0x3b')](_0x350bfa[_0xba87('0x35')][_0xba87('0x3b')]));_0x1af859['attributes']=_0x1af859[_0xba87('0x39')]['length']?_0x1af859[_0xba87('0x39')]:_0x2a05bc['model'];_0x1af859[_0xba87('0x50')]=qs['sort'](_0x350bfa[_0xba87('0x35')][_0xba87('0x3c')]);_0x1af859[_0xba87('0x3d')]=qs[_0xba87('0x37')](_[_0xba87('0x3e')](_0x350bfa['query'],_0x2a05bc[_0xba87('0x37')]));if(_0x350bfa['query'][_0xba87('0x3f')]){_0x1af859['where']=_[_0xba87('0x40')](_0x1af859[_0xba87('0x3d')],{'$or':_[_0xba87('0x41')](_0x1af859[_0xba87('0x39')],function(_0x2ed372){var _0x38f156={};_0x38f156[_0x2ed372]={'$like':'%'+_0x350bfa[_0xba87('0x35')][_0xba87('0x3f')]+'%'};return _0x38f156;})});}_0x1af859=_['merge']({},_0x1af859,_0x350bfa[_0xba87('0x43')]);return _0x3c7b02[_0xba87('0x55')](_0x1af859);}})[_0xba87('0x1a')](function(_0x42ccd0){if(_0x42ccd0){_0x13f8f4=_0x42ccd0[_0xba87('0x4a')];if(!_0x350bfa[_0xba87('0x35')][_0xba87('0x51')](_0xba87('0x54'))){_0x1af859[_0xba87('0x27')]=qs[_0xba87('0x27')](_0x350bfa[_0xba87('0x35')][_0xba87('0x27')]);_0x1af859[_0xba87('0x26')]=qs[_0xba87('0x26')](_0x350bfa['query'][_0xba87('0x26')]);}return _0x3c7b02[_0xba87('0x55')](_0x1af859);}})[_0xba87('0x1a')](function(_0x3df8cc){if(_0x3df8cc){return _0x3df8cc?{'count':_0x13f8f4,'rows':_0x3df8cc}:null;}})['then'](respondWithResult(_0x2e8da8,null))['catch'](handleError(_0x2e8da8,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index e7fd7de..c070fba 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 _0xcfc3=['rimraf','./intVtigerConfiguration.attributes','exports','VtigerConfiguration','int_vtiger_configurations','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x445ccd,_0x157a44){var _0x36cb5f=function(_0xdf173b){while(--_0xdf173b){_0x445ccd['push'](_0x445ccd['shift']());}};_0x36cb5f(++_0x157a44);}(_0xcfc3,0x177));var _0x3cfc=function(_0x34c6db,_0x5eab32){_0x34c6db=_0x34c6db-0x0;var _0x139a9c=_0xcfc3[_0x34c6db];return _0x139a9c;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3cfc('0x0'))('api');var moment=require(_0x3cfc('0x1'));var BPromise=require(_0x3cfc('0x2'));var rp=require(_0x3cfc('0x3'));var fs=require('fs');var path=require(_0x3cfc('0x4'));var rimraf=require(_0x3cfc('0x5'));var config=require('../../config/environment');var attributes=require(_0x3cfc('0x6'));module[_0x3cfc('0x7')]=function(_0xfd040,_0x2ff555){return _0xfd040['define'](_0x3cfc('0x8'),attributes,{'tableName':_0x3cfc('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe0bb=['lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations'];(function(_0x446003,_0x2b17dd){var _0x5b8022=function(_0x3c983a){while(--_0x3c983a){_0x446003['push'](_0x446003['shift']());}};_0x5b8022(++_0x2b17dd);}(_0xe0bb,0xdd));var _0xbe0b=function(_0xc8db6b,_0x320abd){_0xc8db6b=_0xc8db6b-0x0;var _0x12cb81=_0xe0bb[_0xc8db6b];return _0x12cb81;};'use strict';var _=require(_0xbe0b('0x0'));var util=require(_0xbe0b('0x1'));var logger=require(_0xbe0b('0x2'))(_0xbe0b('0x3'));var moment=require('moment');var BPromise=require(_0xbe0b('0x4'));var rp=require(_0xbe0b('0x5'));var fs=require('fs');var path=require(_0xbe0b('0x6'));var rimraf=require('rimraf');var config=require(_0xbe0b('0x7'));var attributes=require(_0xbe0b('0x8'));module[_0xbe0b('0x9')]=function(_0x4428dc,_0x15340f){return _0x4428dc[_0xbe0b('0xa')](_0xbe0b('0xb'),attributes,{'tableName':_0xbe0b('0xc'),'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 e9110e3..7b0a3e5 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 _0x27da=['then','info','request\x20sent','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','VtigerConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request'];(function(_0x3c292b,_0x47e45f){var _0x415afc=function(_0x135327){while(--_0x135327){_0x3c292b['push'](_0x3c292b['shift']());}};_0x415afc(++_0x47e45f);}(_0x27da,0x15c));var _0xa27d=function(_0x57b1da,_0x5668d4){_0x57b1da=_0x57b1da-0x0;var _0x35b545=_0x27da[_0x57b1da];return _0x35b545;};'use strict';var _=require(_0xa27d('0x0'));var util=require(_0xa27d('0x1'));var moment=require('moment');var BPromise=require(_0xa27d('0x2'));var rs=require(_0xa27d('0x3'));var fs=require('fs');var Redis=require(_0xa27d('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa27d('0x5'));var logger=require(_0xa27d('0x6'))(_0xa27d('0x7'));var config=require('../../config/environment');var jayson=require(_0xa27d('0x8'));var client=jayson[_0xa27d('0x9')][_0xa27d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b8bc5,_0xfc0cb0,_0x5db87e){return new BPromise(function(_0xba03bc,_0x44f6c9){return client[_0xa27d('0xb')](_0x2b8bc5,_0x5db87e)[_0xa27d('0xc')](function(_0x43894){logger[_0xa27d('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xfc0cb0,_0xa27d('0xe'));logger[_0xa27d('0xf')](_0xa27d('0x10'),_0xfc0cb0,'request\x20sent',JSON[_0xa27d('0x11')](_0x43894));if(_0x43894['error']){if(_0x43894[_0xa27d('0x12')][_0xa27d('0x13')]===0x1f4){logger[_0xa27d('0x12')](_0xa27d('0x14'),_0xfc0cb0,_0x43894[_0xa27d('0x12')][_0xa27d('0x15')]);return _0x44f6c9(_0x43894[_0xa27d('0x12')][_0xa27d('0x15')]);}logger['error'](_0xa27d('0x14'),_0xfc0cb0,_0x43894['error'][_0xa27d('0x15')]);return _0xba03bc(_0x43894[_0xa27d('0x12')][_0xa27d('0x15')]);}else{logger[_0xa27d('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0xfc0cb0,'request\x20sent');_0xba03bc(_0x43894[_0xa27d('0x16')][_0xa27d('0x15')]);}})[_0xa27d('0x17')](function(_0x3ac294){logger['error'](_0xa27d('0x14'),_0xfc0cb0,_0x3ac294);_0x44f6c9(_0x3ac294);});});} \ No newline at end of file +var _0x9ed6=['code','message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x5b667a,_0x144853){var _0x5df1ce=function(_0x415e25){while(--_0x415e25){_0x5b667a['push'](_0x5b667a['shift']());}};_0x5df1ce(++_0x144853);}(_0x9ed6,0xb4));var _0x69ed=function(_0x141dc0,_0x2b04d8){_0x141dc0=_0x141dc0-0x0;var _0x22b224=_0x9ed6[_0x141dc0];return _0x22b224;};'use strict';var _=require(_0x69ed('0x0'));var util=require(_0x69ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x69ed('0x2'));var fs=require('fs');var Redis=require(_0x69ed('0x3'));var db=require(_0x69ed('0x4'))['db'];var utils=require(_0x69ed('0x5'));var logger=require(_0x69ed('0x6'))(_0x69ed('0x7'));var config=require(_0x69ed('0x8'));var jayson=require(_0x69ed('0x9'));var client=jayson[_0x69ed('0xa')][_0x69ed('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5ab7cd,_0x443245,_0x1719a6){return new BPromise(function(_0x173fc6,_0x1e1ff3){return client['request'](_0x5ab7cd,_0x1719a6)['then'](function(_0x7834c4){logger[_0x69ed('0xc')](_0x69ed('0xd'),_0x443245,_0x69ed('0xe'));logger[_0x69ed('0xf')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x443245,_0x69ed('0xe'),JSON[_0x69ed('0x10')](_0x7834c4));if(_0x7834c4[_0x69ed('0x11')]){if(_0x7834c4[_0x69ed('0x11')][_0x69ed('0x12')]===0x1f4){logger[_0x69ed('0x11')](_0x69ed('0xd'),_0x443245,_0x7834c4[_0x69ed('0x11')][_0x69ed('0x13')]);return _0x1e1ff3(_0x7834c4[_0x69ed('0x11')][_0x69ed('0x13')]);}logger[_0x69ed('0x11')](_0x69ed('0xd'),_0x443245,_0x7834c4['error'][_0x69ed('0x13')]);return _0x173fc6(_0x7834c4[_0x69ed('0x11')][_0x69ed('0x13')]);}else{logger[_0x69ed('0xc')](_0x69ed('0xd'),_0x443245,_0x69ed('0xe'));_0x173fc6(_0x7834c4[_0x69ed('0x14')]['message']);}})[_0x69ed('0x15')](function(_0x103e9c){logger[_0x69ed('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x443245,_0x103e9c);_0x1e1ff3(_0x103e9c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 00358b7..fa6b9da 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 _0xf02d=['util','path','express','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','create','put','update','multer'];(function(_0x3072f4,_0x2ba2e3){var _0x1d0e7b=function(_0x5e9a3a){while(--_0x5e9a3a){_0x3072f4['push'](_0x3072f4['shift']());}};_0x1d0e7b(++_0x2ba2e3);}(_0xf02d,0xe0));var _0xdf02=function(_0x20b828,_0x857992){_0x20b828=_0x20b828-0x0;var _0x13135f=_0xf02d[_0x20b828];return _0x13135f;};'use strict';var multer=require(_0xdf02('0x0'));var util=require(_0xdf02('0x1'));var path=require(_0xdf02('0x2'));var timeout=require('connect-timeout');var express=require(_0xdf02('0x3'));var router=express[_0xdf02('0x4')]();var auth=require(_0xdf02('0x5'));var interaction=require(_0xdf02('0x6'));var config=require('../../config/environment');var controller=require(_0xdf02('0x7'));router[_0xdf02('0x8')]('/',auth[_0xdf02('0x9')](),controller['index']);router[_0xdf02('0x8')](_0xdf02('0xa'),auth[_0xdf02('0x9')](),controller[_0xdf02('0xb')]);router['post']('/',auth['isAuthenticated'](),controller[_0xdf02('0xc')]);router[_0xdf02('0xd')]('/:id',auth[_0xdf02('0x9')](),controller[_0xdf02('0xe')]);router['delete'](_0xdf02('0xa'),auth[_0xdf02('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xec46=['path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./intVtigerField.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy','exports','multer','util'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xec46,0x8e));var _0x6ec4=function(_0x26fc81,_0x57fc19){_0x26fc81=_0x26fc81-0x0;var _0x9feece=_0xec46[_0x26fc81];return _0x9feece;};'use strict';var multer=require(_0x6ec4('0x0'));var util=require(_0x6ec4('0x1'));var path=require(_0x6ec4('0x2'));var timeout=require(_0x6ec4('0x3'));var express=require('express');var router=express[_0x6ec4('0x4')]();var auth=require(_0x6ec4('0x5'));var interaction=require(_0x6ec4('0x6'));var config=require('../../config/environment');var controller=require(_0x6ec4('0x7'));router[_0x6ec4('0x8')]('/',auth[_0x6ec4('0x9')](),controller['index']);router['get'](_0x6ec4('0xa'),auth[_0x6ec4('0x9')](),controller[_0x6ec4('0xb')]);router[_0x6ec4('0xc')]('/',auth[_0x6ec4('0x9')](),controller[_0x6ec4('0xd')]);router[_0x6ec4('0xe')](_0x6ec4('0xa'),auth['isAuthenticated'](),controller[_0x6ec4('0xf')]);router['delete']('/:id',auth[_0x6ec4('0x9')](),controller[_0x6ec4('0x10')]);module[_0x6ec4('0x11')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index c9db550..15a5bf5 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 _0xaf3e=['sequelize','exports','string','customVariable','keyValue','STRING','ENUM','variable','BOOLEAN'];(function(_0x3572cb,_0x4149d3){var _0x33a398=function(_0x163e27){while(--_0x163e27){_0x3572cb['push'](_0x3572cb['shift']());}};_0x33a398(++_0x4149d3);}(_0xaf3e,0xcf));var _0xeaf3=function(_0xe45118,_0x5dffbc){_0xe45118=_0xe45118-0x0;var _0x15e15d=_0xaf3e[_0xe45118];return _0x15e15d;};'use strict';var Sequelize=require(_0xeaf3('0x0'));module[_0xeaf3('0x1')]={'type':{'type':Sequelize['ENUM'](_0xeaf3('0x2'),'variable',_0xeaf3('0x3'),_0xeaf3('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0xeaf3('0x5')]},'key':{'type':Sequelize[_0xeaf3('0x5')]},'keyType':{'type':Sequelize[_0xeaf3('0x6')](_0xeaf3('0x2'),_0xeaf3('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0xeaf3('0x5')]},'idField':{'type':Sequelize[_0xeaf3('0x5')]},'nameField':{'type':Sequelize[_0xeaf3('0x5')]},'customField':{'type':Sequelize[_0xeaf3('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeaf3('0x5')]}}; \ No newline at end of file +var _0x3613=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING'];(function(_0x260af8,_0x1658e9){var _0x342a6e=function(_0x45dc96){while(--_0x45dc96){_0x260af8['push'](_0x260af8['shift']());}};_0x342a6e(++_0x1658e9);}(_0x3613,0x198));var _0x3361=function(_0x304253,_0x44415c){_0x304253=_0x304253-0x0;var _0x2cfb9b=_0x3613[_0x304253];return _0x2cfb9b;};'use strict';var Sequelize=require(_0x3361('0x0'));module[_0x3361('0x1')]={'type':{'type':Sequelize[_0x3361('0x2')](_0x3361('0x3'),_0x3361('0x4'),_0x3361('0x5'),_0x3361('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x3361('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3361('0x2')](_0x3361('0x3'),_0x3361('0x4'),_0x3361('0x5'))},'keyContent':{'type':Sequelize[_0x3361('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3361('0x7')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3361('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index e01400a..61a1258 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 _0x038b=['sendStatus','status','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','end','error','name','send','map','VtigerField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','length','options','find','create','update','body','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x2192dd,_0x28ad0c){var _0x978299=function(_0x32428d){while(--_0x32428d){_0x2192dd['push'](_0x2192dd['shift']());}};_0x978299(++_0x28ad0c);}(_0x038b,0xc0));var _0xb038=function(_0x34b215,_0x14dafa){_0x34b215=_0x34b215-0x0;var _0x94196d=_0x038b[_0x34b215];return _0x94196d;};'use strict';var pdf=require(_0xb038('0x0'));var emlformat=require(_0xb038('0x1'));var rimraf=require(_0xb038('0x2'));var zipdir=require(_0xb038('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb038('0x4'));var BPromise=require(_0xb038('0x5'));var Mustache=require(_0xb038('0x6'));var util=require(_0xb038('0x7'));var path=require(_0xb038('0x8'));var sox=require(_0xb038('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xb038('0xa'));var squel=require(_0xb038('0xb'));var crypto=require(_0xb038('0xc'));var jsforce=require(_0xb038('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb038('0xe'));var Redis=require(_0xb038('0xf'));var authService=require(_0xb038('0x10'));var qs=require(_0xb038('0x11'));var as=require(_0xb038('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb038('0x13'))(_0xb038('0x14'));var utils=require(_0xb038('0x15'));var config=require(_0xb038('0x16'));var db=require(_0xb038('0x17'))['db'];function respondWithStatusCode(_0x4e682f,_0x7ac71){_0x7ac71=_0x7ac71||0xcc;return function(_0x2b81b9){if(_0x2b81b9){return _0x4e682f[_0xb038('0x18')](_0x7ac71);}return _0x4e682f[_0xb038('0x19')](_0x7ac71)['end']();};}function respondWithResult(_0x5d2751,_0x542779){_0x542779=_0x542779||0xc8;return function(_0x5a0222){if(_0x5a0222){return _0x5d2751[_0xb038('0x19')](_0x542779)['json'](_0x5a0222);}};}function respondWithFilteredResult(_0x5b29ed,_0x1eefdf){return function(_0x5bbd7b){if(_0x5bbd7b){var _0x37b02a=_0x5bbd7b[_0xb038('0x1a')],_0xe845c6=_0x1eefdf['offset'],_0x24300e=_0x1eefdf['offset']+_0x1eefdf[_0xb038('0x1b')],_0x53209d;if(_0x24300e>=_0x37b02a){_0x24300e=_0x37b02a;_0x53209d=0xc8;}else{_0x53209d=0xce;}_0x5b29ed[_0xb038('0x19')](_0x53209d);return _0x5b29ed[_0xb038('0x1c')](_0xb038('0x1d'),_0xe845c6+'-'+_0x24300e+'/'+_0x37b02a)[_0xb038('0x1e')](_0x5bbd7b);}return null;};}function patchUpdates(_0x3e3f5c){return function(_0x5058df){try{jsonpatch[_0xb038('0x1f')](_0x5058df,_0x3e3f5c,!![]);}catch(_0x41a153){return BPromise[_0xb038('0x20')](_0x41a153);}return _0x5058df[_0xb038('0x21')]();};}function saveUpdates(_0x4de640,_0x311014){return function(_0x52660f){if(_0x52660f){return _0x52660f['update'](_0x4de640)['then'](function(_0x4fd1de){return _0x4fd1de;});}return null;};}function removeEntity(_0x723969,_0x1ccff3){return function(_0x24c182){if(_0x24c182){return _0x24c182[_0xb038('0x22')]()[_0xb038('0x23')](function(){_0x723969[_0xb038('0x19')](0xcc)[_0xb038('0x24')]();});}};}function handleEntityNotFound(_0xeffa9e,_0x4a4f1e){return function(_0x40f811){if(!_0x40f811){_0xeffa9e[_0xb038('0x18')](0x194);}return _0x40f811;};}function handleError(_0x20456b,_0x4d0d70){_0x4d0d70=_0x4d0d70||0x1f4;return function(_0x45cea3){logger[_0xb038('0x25')](_0x45cea3['stack']);if(_0x45cea3[_0xb038('0x26')]){delete _0x45cea3[_0xb038('0x26')];}_0x20456b['status'](_0x4d0d70)[_0xb038('0x27')](_0x45cea3);};}exports['index']=function(_0xb2263e,_0xa0c666){var _0x528386={},_0xe1ac42={},_0x266fd6={'count':0x0,'rows':[]};var _0x2efd5c=_[_0xb038('0x28')](db[_0xb038('0x29')][_0xb038('0x2a')],function(_0x46ef28){return{'name':_0x46ef28[_0xb038('0x2b')],'type':_0x46ef28['type'][_0xb038('0x2c')]};});_0xe1ac42[_0xb038('0x2d')]=_[_0xb038('0x28')](_0x2efd5c,_0xb038('0x26'));_0xe1ac42[_0xb038('0x2e')]=_[_0xb038('0x2f')](_0xb2263e[_0xb038('0x2e')]);_0xe1ac42[_0xb038('0x30')]=_[_0xb038('0x31')](_0xe1ac42['model'],_0xe1ac42['query']);_0x528386[_0xb038('0x32')]=_[_0xb038('0x31')](_0xe1ac42[_0xb038('0x2d')],qs[_0xb038('0x33')](_0xb2263e[_0xb038('0x2e')]['fields']));_0x528386[_0xb038('0x32')]=_0x528386[_0xb038('0x32')]['length']?_0x528386[_0xb038('0x32')]:_0xe1ac42[_0xb038('0x2d')];if(!_0xb2263e[_0xb038('0x2e')]['hasOwnProperty']('nolimit')){_0x528386[_0xb038('0x1b')]=qs[_0xb038('0x1b')](_0xb2263e[_0xb038('0x2e')][_0xb038('0x1b')]);_0x528386['offset']=qs[_0xb038('0x34')](_0xb2263e[_0xb038('0x2e')][_0xb038('0x34')]);}_0x528386[_0xb038('0x35')]=qs[_0xb038('0x36')](_0xb2263e['query'][_0xb038('0x36')]);_0x528386[_0xb038('0x37')]=qs[_0xb038('0x30')](_[_0xb038('0x38')](_0xb2263e[_0xb038('0x2e')],_0xe1ac42['filters']));if(_0xb2263e[_0xb038('0x2e')][_0xb038('0x39')]){_0x528386['where']=_[_0xb038('0x3a')](_0x528386[_0xb038('0x37')],{'$or':_[_0xb038('0x28')](_0x2efd5c,function(_0x485cff){if(_0x485cff[_0xb038('0x3b')]!==_0xb038('0x3c')){var _0x8a78db={};_0x8a78db[_0x485cff[_0xb038('0x26')]]={'$like':'%'+_0xb2263e[_0xb038('0x2e')][_0xb038('0x39')]+'%'};return _0x8a78db;}})});}_0x528386=_[_0xb038('0x3a')]({},_0x528386,_0xb2263e['options']);var _0x57b44a={'where':_0x528386[_0xb038('0x37')]};return db['VtigerField'][_0xb038('0x1a')](_0x57b44a)[_0xb038('0x23')](function(_0x2c6cbd){_0x266fd6[_0xb038('0x1a')]=_0x2c6cbd;if(_0xb2263e[_0xb038('0x2e')][_0xb038('0x3d')]){_0x528386[_0xb038('0x3e')]=[{'all':!![]}];}return db['VtigerField'][_0xb038('0x3f')](_0x528386);})[_0xb038('0x23')](function(_0x550389){_0x266fd6['rows']=_0x550389;return _0x266fd6;})[_0xb038('0x23')](respondWithFilteredResult(_0xa0c666,_0x528386))[_0xb038('0x40')](handleError(_0xa0c666,null));};exports['show']=function(_0x39f34d,_0x55d3a3){var _0x3523ca={'raw':!![],'where':{'id':_0x39f34d[_0xb038('0x41')]['id']}},_0x222ba9={};_0x222ba9[_0xb038('0x2d')]=_[_0xb038('0x2f')](db['VtigerField']['rawAttributes']);_0x222ba9[_0xb038('0x2e')]=_[_0xb038('0x2f')](_0x39f34d['query']);_0x222ba9[_0xb038('0x30')]=_[_0xb038('0x31')](_0x222ba9[_0xb038('0x2d')],_0x222ba9[_0xb038('0x2e')]);_0x3523ca[_0xb038('0x32')]=_['intersection'](_0x222ba9[_0xb038('0x2d')],qs['fields'](_0x39f34d[_0xb038('0x2e')][_0xb038('0x33')]));_0x3523ca[_0xb038('0x32')]=_0x3523ca[_0xb038('0x32')][_0xb038('0x42')]?_0x3523ca[_0xb038('0x32')]:_0x222ba9[_0xb038('0x2d')];if(_0x39f34d[_0xb038('0x2e')]['includeAll']){_0x3523ca['include']=[{'all':!![]}];}_0x3523ca=_[_0xb038('0x3a')]({},_0x3523ca,_0x39f34d[_0xb038('0x43')]);return db[_0xb038('0x29')][_0xb038('0x44')](_0x3523ca)['then'](handleEntityNotFound(_0x55d3a3,null))[_0xb038('0x23')](respondWithResult(_0x55d3a3,null))['catch'](handleError(_0x55d3a3,null));};exports['create']=function(_0x443d2d,_0xfb7de){return db['VtigerField'][_0xb038('0x45')](_0x443d2d['body'],{})[_0xb038('0x23')](respondWithResult(_0xfb7de,0xc9))['catch'](handleError(_0xfb7de,null));};exports[_0xb038('0x46')]=function(_0x139aa6,_0x34b47d){if(_0x139aa6[_0xb038('0x47')]['id']){delete _0x139aa6['body']['id'];}return db[_0xb038('0x29')][_0xb038('0x44')]({'where':{'id':_0x139aa6[_0xb038('0x41')]['id']}})[_0xb038('0x23')](handleEntityNotFound(_0x34b47d,null))[_0xb038('0x23')](saveUpdates(_0x139aa6[_0xb038('0x47')],null))['then'](respondWithResult(_0x34b47d,null))[_0xb038('0x40')](handleError(_0x34b47d,null));};exports[_0xb038('0x22')]=function(_0x15ebb2,_0x1627a9){return db['VtigerField']['find']({'where':{'id':_0x15ebb2['params']['id']}})[_0xb038('0x23')](handleEntityNotFound(_0x1627a9,null))[_0xb038('0x23')](removeEntity(_0x1627a9,null))[_0xb038('0x40')](handleError(_0x1627a9,null));}; \ No newline at end of file +var _0x02e8=['name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../mysqldb','status','json','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x3da0f1,_0x4d01a6){var _0x190c40=function(_0x1564f3){while(--_0x1564f3){_0x3da0f1['push'](_0x3da0f1['shift']());}};_0x190c40(++_0x4d01a6);}(_0x02e8,0xb6));var _0x802e=function(_0x35ccac,_0x28d874){_0x35ccac=_0x35ccac-0x0;var _0x217b96=_0x02e8[_0x35ccac];return _0x217b96;};'use strict';var pdf=require(_0x802e('0x0'));var emlformat=require(_0x802e('0x1'));var rimraf=require(_0x802e('0x2'));var zipdir=require(_0x802e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x802e('0x4'));var moment=require(_0x802e('0x5'));var BPromise=require(_0x802e('0x6'));var Mustache=require(_0x802e('0x7'));var util=require(_0x802e('0x8'));var path=require(_0x802e('0x9'));var sox=require('sox');var csv=require(_0x802e('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x802e('0xb'));var squel=require(_0x802e('0xc'));var crypto=require(_0x802e('0xd'));var jsforce=require(_0x802e('0xe'));var deskjs=require(_0x802e('0xf'));var toCsv=require(_0x802e('0xa'));var querystring=require('querystring');var Papa=require(_0x802e('0x10'));var Redis=require(_0x802e('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x802e('0x12'));var as=require(_0x802e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x802e('0x14'));var utils=require(_0x802e('0x15'));var config=require('../../config/environment');var db=require(_0x802e('0x16'))['db'];function respondWithStatusCode(_0x52eccf,_0x17029a){_0x17029a=_0x17029a||0xcc;return function(_0x3b66be){if(_0x3b66be){return _0x52eccf['sendStatus'](_0x17029a);}return _0x52eccf[_0x802e('0x17')](_0x17029a)['end']();};}function respondWithResult(_0x3cb8d8,_0x4c88bf){_0x4c88bf=_0x4c88bf||0xc8;return function(_0x10ec6d){if(_0x10ec6d){return _0x3cb8d8[_0x802e('0x17')](_0x4c88bf)[_0x802e('0x18')](_0x10ec6d);}};}function respondWithFilteredResult(_0x54c592,_0x1102a4){return function(_0x94266b){if(_0x94266b){var _0x1b4113=_0x94266b[_0x802e('0x19')],_0x446db7=_0x1102a4['offset'],_0x115f75=_0x1102a4['offset']+_0x1102a4[_0x802e('0x1a')],_0x962d69;if(_0x115f75>=_0x1b4113){_0x115f75=_0x1b4113;_0x962d69=0xc8;}else{_0x962d69=0xce;}_0x54c592[_0x802e('0x17')](_0x962d69);return _0x54c592[_0x802e('0x1b')](_0x802e('0x1c'),_0x446db7+'-'+_0x115f75+'/'+_0x1b4113)['json'](_0x94266b);}return null;};}function patchUpdates(_0x451d49){return function(_0x28648d){try{jsonpatch[_0x802e('0x1d')](_0x28648d,_0x451d49,!![]);}catch(_0x40288f){return BPromise[_0x802e('0x1e')](_0x40288f);}return _0x28648d[_0x802e('0x1f')]();};}function saveUpdates(_0x324f92,_0x51a890){return function(_0x585d03){if(_0x585d03){return _0x585d03[_0x802e('0x20')](_0x324f92)[_0x802e('0x21')](function(_0x5bcfbb){return _0x5bcfbb;});}return null;};}function removeEntity(_0x1e93c2,_0x4aba39){return function(_0xeef08b){if(_0xeef08b){return _0xeef08b[_0x802e('0x22')]()['then'](function(){_0x1e93c2[_0x802e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5aeb19,_0x1291ba){return function(_0x270b38){if(!_0x270b38){_0x5aeb19['sendStatus'](0x194);}return _0x270b38;};}function handleError(_0xb11511,_0x20c59e){_0x20c59e=_0x20c59e||0x1f4;return function(_0x3998c7){logger[_0x802e('0x23')](_0x3998c7[_0x802e('0x24')]);if(_0x3998c7[_0x802e('0x25')]){delete _0x3998c7[_0x802e('0x25')];}_0xb11511[_0x802e('0x17')](_0x20c59e)[_0x802e('0x26')](_0x3998c7);};}exports[_0x802e('0x27')]=function(_0x90a9c3,_0x42bd67){var _0xe4e2d7={},_0x453280={},_0x5f3ae2={'count':0x0,'rows':[]};var _0x476a59=_[_0x802e('0x28')](db[_0x802e('0x29')][_0x802e('0x2a')],function(_0x1a921e){return{'name':_0x1a921e[_0x802e('0x2b')],'type':_0x1a921e[_0x802e('0x2c')][_0x802e('0x2d')]};});_0x453280[_0x802e('0x2e')]=_[_0x802e('0x28')](_0x476a59,'name');_0x453280['query']=_[_0x802e('0x2f')](_0x90a9c3[_0x802e('0x30')]);_0x453280[_0x802e('0x31')]=_[_0x802e('0x32')](_0x453280[_0x802e('0x2e')],_0x453280[_0x802e('0x30')]);_0xe4e2d7[_0x802e('0x33')]=_[_0x802e('0x32')](_0x453280[_0x802e('0x2e')],qs[_0x802e('0x34')](_0x90a9c3[_0x802e('0x30')][_0x802e('0x34')]));_0xe4e2d7['attributes']=_0xe4e2d7['attributes']['length']?_0xe4e2d7['attributes']:_0x453280[_0x802e('0x2e')];if(!_0x90a9c3[_0x802e('0x30')]['hasOwnProperty'](_0x802e('0x35'))){_0xe4e2d7[_0x802e('0x1a')]=qs[_0x802e('0x1a')](_0x90a9c3[_0x802e('0x30')][_0x802e('0x1a')]);_0xe4e2d7[_0x802e('0x36')]=qs[_0x802e('0x36')](_0x90a9c3[_0x802e('0x30')][_0x802e('0x36')]);}_0xe4e2d7[_0x802e('0x37')]=qs[_0x802e('0x38')](_0x90a9c3['query'][_0x802e('0x38')]);_0xe4e2d7[_0x802e('0x39')]=qs[_0x802e('0x31')](_[_0x802e('0x3a')](_0x90a9c3['query'],_0x453280[_0x802e('0x31')]));if(_0x90a9c3[_0x802e('0x30')][_0x802e('0x3b')]){_0xe4e2d7['where']=_[_0x802e('0x3c')](_0xe4e2d7['where'],{'$or':_[_0x802e('0x28')](_0x476a59,function(_0x1e962a){if(_0x1e962a[_0x802e('0x2c')]!==_0x802e('0x3d')){var _0x562f57={};_0x562f57[_0x1e962a[_0x802e('0x25')]]={'$like':'%'+_0x90a9c3[_0x802e('0x30')][_0x802e('0x3b')]+'%'};return _0x562f57;}})});}_0xe4e2d7=_[_0x802e('0x3c')]({},_0xe4e2d7,_0x90a9c3[_0x802e('0x3e')]);var _0x262144={'where':_0xe4e2d7['where']};return db[_0x802e('0x29')][_0x802e('0x19')](_0x262144)['then'](function(_0x51e05d){_0x5f3ae2[_0x802e('0x19')]=_0x51e05d;if(_0x90a9c3[_0x802e('0x30')][_0x802e('0x3f')]){_0xe4e2d7[_0x802e('0x40')]=[{'all':!![]}];}return db[_0x802e('0x29')][_0x802e('0x41')](_0xe4e2d7);})[_0x802e('0x21')](function(_0x586f27){_0x5f3ae2[_0x802e('0x42')]=_0x586f27;return _0x5f3ae2;})['then'](respondWithFilteredResult(_0x42bd67,_0xe4e2d7))['catch'](handleError(_0x42bd67,null));};exports[_0x802e('0x43')]=function(_0x4ac31c,_0x4fa5cd){var _0x423ad4={'raw':!![],'where':{'id':_0x4ac31c[_0x802e('0x44')]['id']}},_0x501c00={};_0x501c00[_0x802e('0x2e')]=_[_0x802e('0x2f')](db['VtigerField']['rawAttributes']);_0x501c00[_0x802e('0x30')]=_[_0x802e('0x2f')](_0x4ac31c[_0x802e('0x30')]);_0x501c00[_0x802e('0x31')]=_[_0x802e('0x32')](_0x501c00['model'],_0x501c00[_0x802e('0x30')]);_0x423ad4[_0x802e('0x33')]=_['intersection'](_0x501c00['model'],qs[_0x802e('0x34')](_0x4ac31c[_0x802e('0x30')][_0x802e('0x34')]));_0x423ad4[_0x802e('0x33')]=_0x423ad4[_0x802e('0x33')]['length']?_0x423ad4[_0x802e('0x33')]:_0x501c00[_0x802e('0x2e')];if(_0x4ac31c[_0x802e('0x30')][_0x802e('0x3f')]){_0x423ad4[_0x802e('0x40')]=[{'all':!![]}];}_0x423ad4=_['merge']({},_0x423ad4,_0x4ac31c[_0x802e('0x3e')]);return db[_0x802e('0x29')][_0x802e('0x45')](_0x423ad4)[_0x802e('0x21')](handleEntityNotFound(_0x4fa5cd,null))[_0x802e('0x21')](respondWithResult(_0x4fa5cd,null))[_0x802e('0x46')](handleError(_0x4fa5cd,null));};exports[_0x802e('0x47')]=function(_0x293d61,_0x3ae2a1){return db[_0x802e('0x29')][_0x802e('0x47')](_0x293d61[_0x802e('0x48')],{})['then'](respondWithResult(_0x3ae2a1,0xc9))[_0x802e('0x46')](handleError(_0x3ae2a1,null));};exports[_0x802e('0x20')]=function(_0x301ae7,_0x3d2048){if(_0x301ae7[_0x802e('0x48')]['id']){delete _0x301ae7[_0x802e('0x48')]['id'];}return db[_0x802e('0x29')][_0x802e('0x45')]({'where':{'id':_0x301ae7[_0x802e('0x44')]['id']}})['then'](handleEntityNotFound(_0x3d2048,null))[_0x802e('0x21')](saveUpdates(_0x301ae7[_0x802e('0x48')],null))[_0x802e('0x21')](respondWithResult(_0x3d2048,null))[_0x802e('0x46')](handleError(_0x3d2048,null));};exports[_0x802e('0x22')]=function(_0x4ce7de,_0x1894df){return db[_0x802e('0x29')]['find']({'where':{'id':_0x4ce7de[_0x802e('0x44')]['id']}})['then'](handleEntityNotFound(_0x1894df,null))[_0x802e('0x21')](removeEntity(_0x1894df,null))[_0x802e('0x46')](handleError(_0x1894df,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 44c3c20..4b89310 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(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'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(_0x38e138,_0x57eb17){var _0xf27fb5=function(_0x3a3dd7){while(--_0x3a3dd7){_0x38e138['push'](_0x38e138['shift']());}};_0xf27fb5(++_0x57eb17);}(_0x7a54,0x106));var _0x47a5=function(_0x5b4afa,_0x1ead1d){_0x5b4afa=_0x5b4afa-0x0;var _0x4f6e0d=_0x7a54[_0x5b4afa];return _0x4f6e0d;};'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 d231b71..a9230bf 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 _0x87d9=['../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','VtigerField,\x20%s,\x20%s,\x20%s','error','code','VtigerField,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xaa4ae,_0x31dfc6){var _0x1b9811=function(_0x5b314e){while(--_0x5b314e){_0xaa4ae['push'](_0xaa4ae['shift']());}};_0x1b9811(++_0x31dfc6);}(_0x87d9,0x143));var _0x987d=function(_0x1c6b61,_0x5d0fe0){_0x1c6b61=_0x1c6b61-0x0;var _0xb6c7e2=_0x87d9[_0x1c6b61];return _0xb6c7e2;};'use strict';var _=require(_0x987d('0x0'));var util=require('util');var moment=require(_0x987d('0x1'));var BPromise=require(_0x987d('0x2'));var rs=require(_0x987d('0x3'));var fs=require('fs');var Redis=require(_0x987d('0x4'));var db=require(_0x987d('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x987d('0x6'))('rpc');var config=require(_0x987d('0x7'));var jayson=require(_0x987d('0x8'));var client=jayson['client'][_0x987d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ee510,_0x5bf349,_0x11d89e){return new BPromise(function(_0x1f97b6,_0x444273){return client[_0x987d('0xa')](_0x3ee510,_0x11d89e)[_0x987d('0xb')](function(_0x325c8b){logger[_0x987d('0xc')]('VtigerField,\x20%s,\x20%s',_0x5bf349,_0x987d('0xd'));logger[_0x987d('0xe')](_0x987d('0xf'),_0x5bf349,_0x987d('0xd'),JSON['stringify'](_0x325c8b));if(_0x325c8b[_0x987d('0x10')]){if(_0x325c8b[_0x987d('0x10')][_0x987d('0x11')]===0x1f4){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x444273(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}logger['error']('VtigerField,\x20%s,\x20%s',_0x5bf349,_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);return _0x1f97b6(_0x325c8b[_0x987d('0x10')][_0x987d('0x13')]);}else{logger[_0x987d('0xc')](_0x987d('0x12'),_0x5bf349,_0x987d('0xd'));_0x1f97b6(_0x325c8b[_0x987d('0x14')][_0x987d('0x13')]);}})[_0x987d('0x15')](function(_0x197e46){logger[_0x987d('0x10')](_0x987d('0x12'),_0x5bf349,_0x197e46);_0x444273(_0x197e46);});});} \ No newline at end of file +var _0xee4f=['VtigerField,\x20%s,\x20%s','message','catch','lodash','bluebird','randomstring','ioredis','../../config/utils','rpc','client','then','info','debug','VtigerField,\x20%s,\x20%s,\x20%s','request\x20sent','error','code'];(function(_0x2de8eb,_0x265f10){var _0x29068a=function(_0x57cbfc){while(--_0x57cbfc){_0x2de8eb['push'](_0x2de8eb['shift']());}};_0x29068a(++_0x265f10);}(_0xee4f,0xad));var _0xfee4=function(_0x4157b9,_0x147461){_0x4157b9=_0x4157b9-0x0;var _0x457d88=_0xee4f[_0x4157b9];return _0x457d88;};'use strict';var _=require(_0xfee4('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfee4('0x1'));var rs=require(_0xfee4('0x2'));var fs=require('fs');var Redis=require(_0xfee4('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfee4('0x4'));var logger=require('../../config/logger')(_0xfee4('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfee4('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52fb6b,_0x2fb1b3,_0x16cc9a){return new BPromise(function(_0x34908a,_0x4d3c71){return client['request'](_0x52fb6b,_0x16cc9a)[_0xfee4('0x7')](function(_0x11556d){logger[_0xfee4('0x8')]('VtigerField,\x20%s,\x20%s',_0x2fb1b3,'request\x20sent');logger[_0xfee4('0x9')](_0xfee4('0xa'),_0x2fb1b3,_0xfee4('0xb'),JSON['stringify'](_0x11556d));if(_0x11556d[_0xfee4('0xc')]){if(_0x11556d[_0xfee4('0xc')][_0xfee4('0xd')]===0x1f4){logger[_0xfee4('0xc')](_0xfee4('0xe'),_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x4d3c71(_0x11556d['error'][_0xfee4('0xf')]);}logger[_0xfee4('0xc')]('VtigerField,\x20%s,\x20%s',_0x2fb1b3,_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);return _0x34908a(_0x11556d[_0xfee4('0xc')][_0xfee4('0xf')]);}else{logger[_0xfee4('0x8')](_0xfee4('0xe'),_0x2fb1b3,_0xfee4('0xb'));_0x34908a(_0x11556d['result'][_0xfee4('0xf')]);}})[_0xfee4('0x10')](function(_0x437979){logger['error'](_0xfee4('0xe'),_0x2fb1b3,_0x437979);_0x4d3c71(_0x437979);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index a35049a..d07da80 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 _0x2408=['isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','delete','exports','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','./intZendeskAccount.controller','get'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x2408,0x19a));var _0x8240=function(_0x11acdd,_0x20f49b){_0x11acdd=_0x11acdd-0x0;var _0x2d6f82=_0x2408[_0x11acdd];return _0x2d6f82;};'use strict';var multer=require('multer');var util=require(_0x8240('0x0'));var path=require(_0x8240('0x1'));var timeout=require(_0x8240('0x2'));var express=require('express');var router=express[_0x8240('0x3')]();var auth=require(_0x8240('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x8240('0x5'));var controller=require(_0x8240('0x6'));router[_0x8240('0x7')]('/',auth[_0x8240('0x8')](),controller[_0x8240('0x9')]);router[_0x8240('0x7')](_0x8240('0xa'),auth['isAuthenticated'](),controller[_0x8240('0xb')]);router[_0x8240('0x7')](_0x8240('0xc'),auth[_0x8240('0x8')](),controller[_0x8240('0xd')]);router[_0x8240('0x7')](_0x8240('0xe'),auth['isAuthenticated'](),controller[_0x8240('0xf')]);router[_0x8240('0x10')]('/',auth[_0x8240('0x8')](),controller[_0x8240('0x11')]);router['post'](_0x8240('0xc'),auth[_0x8240('0x8')](),controller[_0x8240('0x12')]);router[_0x8240('0x13')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x8240('0x14')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x8240('0x15')]=router; \ No newline at end of file +var _0x56e5=['/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get'];(function(_0x3b95bc,_0x5a01be){var _0x3b7405=function(_0x28850d){while(--_0x28850d){_0x3b95bc['push'](_0x3b95bc['shift']());}};_0x3b7405(++_0x5a01be);}(_0x56e5,0x14d));var _0x556e=function(_0x31ae9c,_0x33e5cb){_0x31ae9c=_0x31ae9c-0x0;var _0x2012a2=_0x56e5[_0x31ae9c];return _0x2012a2;};'use strict';var multer=require(_0x556e('0x0'));var util=require(_0x556e('0x1'));var path=require(_0x556e('0x2'));var timeout=require(_0x556e('0x3'));var express=require(_0x556e('0x4'));var router=express[_0x556e('0x5')]();var auth=require(_0x556e('0x6'));var interaction=require(_0x556e('0x7'));var config=require(_0x556e('0x8'));var controller=require('./intZendeskAccount.controller');router['get']('/',auth[_0x556e('0x9')](),controller[_0x556e('0xa')]);router[_0x556e('0xb')](_0x556e('0xc'),auth[_0x556e('0x9')](),controller[_0x556e('0xd')]);router[_0x556e('0xb')](_0x556e('0xe'),auth[_0x556e('0x9')](),controller[_0x556e('0xf')]);router[_0x556e('0xb')](_0x556e('0x10'),auth[_0x556e('0x9')](),controller['getFields']);router[_0x556e('0x11')]('/',auth[_0x556e('0x9')](),controller[_0x556e('0x12')]);router[_0x556e('0x11')](_0x556e('0xe'),auth[_0x556e('0x9')](),controller['addConfiguration']);router[_0x556e('0x13')](_0x556e('0xc'),auth[_0x556e('0x9')](),controller[_0x556e('0x14')]);router[_0x556e('0x15')](_0x556e('0xc'),auth[_0x556e('0x9')](),controller[_0x556e('0x16')]);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 bd3b2c2..7c95994 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 _0x0711=['newTab','sequelize','exports','STRING','ENUM','password','token','integrationTab'];(function(_0x3ec500,_0xefb14d){var _0x475661=function(_0x3dd83b){while(--_0x3dd83b){_0x3ec500['push'](_0x3ec500['shift']());}};_0x475661(++_0xefb14d);}(_0x0711,0x161));var _0x1071=function(_0x257367,_0x177598){_0x257367=_0x257367-0x0;var _0x53a6d3=_0x0711[_0x257367];return _0x53a6d3;};'use strict';var Sequelize=require(_0x1071('0x0'));module[_0x1071('0x1')]={'name':{'type':Sequelize[_0x1071('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x1071('0x2')],'unique':'username'},'password':{'type':Sequelize[_0x1071('0x2')]},'token':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x1071('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize[_0x1071('0x3')](_0x1071('0x4'),_0x1071('0x5')),'defaultValue':'password'},'serverUrl':{'type':Sequelize[_0x1071('0x2')]},'type':{'type':Sequelize[_0x1071('0x3')](_0x1071('0x6'),_0x1071('0x7')),'defaultValue':_0x1071('0x6')}}; \ No newline at end of file +var _0x01c1=['STRING','username','remoteUri','ENUM','password','integrationTab','newTab'];(function(_0x4aac5a,_0x15b04c){var _0x42e7bc=function(_0x1da766){while(--_0x1da766){_0x4aac5a['push'](_0x4aac5a['shift']());}};_0x42e7bc(++_0x15b04c);}(_0x01c1,0xa1));var _0x101c=function(_0x39db34,_0x399131){_0x39db34=_0x39db34-0x0;var _0x283a0c=_0x01c1[_0x39db34];return _0x283a0c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x101c('0x0')]},'description':{'type':Sequelize[_0x101c('0x0')]},'username':{'type':Sequelize[_0x101c('0x0')],'unique':_0x101c('0x1')},'password':{'type':Sequelize[_0x101c('0x0')]},'token':{'type':Sequelize[_0x101c('0x0')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x101c('0x2')},'authType':{'type':Sequelize[_0x101c('0x3')](_0x101c('0x4'),'token'),'defaultValue':_0x101c('0x4')},'serverUrl':{'type':Sequelize[_0x101c('0x0')]},'type':{'type':Sequelize[_0x101c('0x3')](_0x101c('0x5'),_0x101c('0x6')),'defaultValue':_0x101c('0x5')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 4239b0e..7ca215d 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 _0x494e=['jayson/promise','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','sendStatus','status','end','json','count','offset','set','Content-Range','save','destroy','stack','name','send','index','map','ZendeskAccount','rawAttributes','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','update','find','findOne','getConfigurations','limit','addConfiguration','AccountId','getSubjects','channel','Descriptions','getDescriptions','ZendeskConfiguration','ZendeskField','Subjects','username','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','password','headers','Basic\x20%s','base64','token','toString','Unknown\x20authentication\x20type','subject','assignee','remove','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration'];(function(_0x1ad992,_0x5ddc63){var _0x535234=function(_0x2a0b6){while(--_0x2a0b6){_0x1ad992['push'](_0x1ad992['shift']());}};_0x535234(++_0x5ddc63);}(_0x494e,0xec));var _0xe494=function(_0x53cc7a,_0x1eb47e){_0x53cc7a=_0x53cc7a-0x0;var _0x45dc45=_0x494e[_0x53cc7a];return _0x45dc45;};'use strict';var pdf=require(_0xe494('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xe494('0x1'));var zipdir=require(_0xe494('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe494('0x3'));var moment=require(_0xe494('0x4'));var BPromise=require(_0xe494('0x5'));var Mustache=require(_0xe494('0x6'));var util=require(_0xe494('0x7'));var path=require(_0xe494('0x8'));var sox=require(_0xe494('0x9'));var csv=require(_0xe494('0xa'));var ejs=require(_0xe494('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xe494('0xc'));var crypto=require('crypto');var jsforce=require(_0xe494('0xd'));var deskjs=require(_0xe494('0xe'));var toCsv=require(_0xe494('0xa'));var querystring=require(_0xe494('0xf'));var Papa=require(_0xe494('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xe494('0x11'));var as=require(_0xe494('0x12'));var hardwareService=require(_0xe494('0x13'));var logger=require(_0xe494('0x14'))(_0xe494('0x15'));var utils=require(_0xe494('0x16'));var config=require(_0xe494('0x17'));var db=require(_0xe494('0x18'))['db'];var integrations=require(_0xe494('0x19'));var jayson=require(_0xe494('0x1a'));var client=jayson['client'][_0xe494('0x1b')]({'port':0x232a});function checkPasswordPattern(_0x21a4a4,_0x50f564,_0x47e630){if(_0x47e630){var _0x393a97=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x393a97['test'](_0x50f564)){return _0x21a4a4;}else{throw new db[(_0xe494('0x1c'))][(_0xe494('0x1d'))](_0xe494('0x1e'));}}else{return _0x21a4a4;}}function respondWithRpcPromise(_0x46ae8f,_0x16d8c5,_0x5a44b2,_0x3a28da){return new BPromise(function(_0x57ea70,_0xeb105d){var _0x5615aa=_0x3a28da||client;return _0x5615aa[_0xe494('0x1f')](_0x46ae8f,_0x5a44b2)[_0xe494('0x20')](function(_0x3fe713){logger[_0xe494('0x21')](_0xe494('0x22'),_0x16d8c5,_0xe494('0x23'));logger[_0xe494('0x24')](_0xe494('0x25'),_0x16d8c5,_0xe494('0x23'),JSON[_0xe494('0x26')](_0x3fe713));if(_0x3fe713[_0xe494('0x27')]){if(_0x3fe713[_0xe494('0x27')]['code']===0x1f4){logger[_0xe494('0x27')](_0xe494('0x22'),_0x16d8c5,_0x3fe713[_0xe494('0x27')][_0xe494('0x28')]);return _0xeb105d(_0x3fe713['error'][_0xe494('0x28')]);}logger[_0xe494('0x27')](_0xe494('0x22'),_0x16d8c5,_0x3fe713[_0xe494('0x27')][_0xe494('0x28')]);return _0x57ea70(_0x3fe713['error'][_0xe494('0x28')]);}else{logger[_0xe494('0x21')](_0xe494('0x22'),_0x16d8c5,'request\x20sent');_0x57ea70(_0x3fe713[_0xe494('0x29')][_0xe494('0x28')]);}})['catch'](function(_0x338ca2){logger['error']('ZendeskAccount,\x20%s,\x20%s',_0x16d8c5,_0x338ca2);_0xeb105d(_0x338ca2);});});}function respondWithStatusCode(_0x50a180,_0x648fb9){_0x648fb9=_0x648fb9||0xcc;return function(_0x20b57d){if(_0x20b57d){return _0x50a180[_0xe494('0x2a')](_0x648fb9);}return _0x50a180[_0xe494('0x2b')](_0x648fb9)[_0xe494('0x2c')]();};}function respondWithResult(_0x2e71d0,_0x3c9805){_0x3c9805=_0x3c9805||0xc8;return function(_0x36b38c){if(_0x36b38c){return _0x2e71d0[_0xe494('0x2b')](_0x3c9805)[_0xe494('0x2d')](_0x36b38c);}};}function respondWithFilteredResult(_0x2f7c32,_0x5e251d){return function(_0x8ccaa6){if(_0x8ccaa6){var _0x3dea88=_0x8ccaa6[_0xe494('0x2e')],_0x17ecea=_0x5e251d[_0xe494('0x2f')],_0x28a0f3=_0x5e251d[_0xe494('0x2f')]+_0x5e251d['limit'],_0x42fbab;if(_0x28a0f3>=_0x3dea88){_0x28a0f3=_0x3dea88;_0x42fbab=0xc8;}else{_0x42fbab=0xce;}_0x2f7c32['status'](_0x42fbab);return _0x2f7c32[_0xe494('0x30')](_0xe494('0x31'),_0x17ecea+'-'+_0x28a0f3+'/'+_0x3dea88)[_0xe494('0x2d')](_0x8ccaa6);}return null;};}function patchUpdates(_0x267b60){return function(_0x3d1ac3){try{jsonpatch['apply'](_0x3d1ac3,_0x267b60,!![]);}catch(_0x54a897){return BPromise['reject'](_0x54a897);}return _0x3d1ac3[_0xe494('0x32')]();};}function saveUpdates(_0x3ffef6,_0x1010da){return function(_0x506488){if(_0x506488){return _0x506488['update'](_0x3ffef6)[_0xe494('0x20')](function(_0x5105a7){return _0x5105a7;});}return null;};}function removeEntity(_0x98a5f6,_0x176fc5){return function(_0x3a2c1b){if(_0x3a2c1b){return _0x3a2c1b[_0xe494('0x33')]()[_0xe494('0x20')](function(){_0x98a5f6[_0xe494('0x2b')](0xcc)[_0xe494('0x2c')]();});}};}function handleEntityNotFound(_0xf78c9a,_0x5eceba){return function(_0x3e6052){if(!_0x3e6052){_0xf78c9a[_0xe494('0x2a')](0x194);}return _0x3e6052;};}function handleError(_0x13e64d,_0x4c0242){_0x4c0242=_0x4c0242||0x1f4;return function(_0x1d89a5){logger[_0xe494('0x27')](_0x1d89a5[_0xe494('0x34')]);if(_0x1d89a5['name']){delete _0x1d89a5[_0xe494('0x35')];}_0x13e64d['status'](_0x4c0242)[_0xe494('0x36')](_0x1d89a5);};}exports[_0xe494('0x37')]=function(_0x32e70d,_0x56a655){var _0x32d7f8={},_0x5c5f76={},_0x42f763={'count':0x0,'rows':[]};var _0x5ed519=_[_0xe494('0x38')](db[_0xe494('0x39')][_0xe494('0x3a')],function(_0x54a6ca){return{'name':_0x54a6ca[_0xe494('0x3b')],'type':_0x54a6ca[_0xe494('0x3c')][_0xe494('0x3d')]};});_0x5c5f76['model']=_['map'](_0x5ed519,_0xe494('0x35'));_0x5c5f76['query']=_['keys'](_0x32e70d[_0xe494('0x3e')]);_0x5c5f76['filters']=_['intersection'](_0x5c5f76[_0xe494('0x3f')],_0x5c5f76[_0xe494('0x3e')]);_0x32d7f8[_0xe494('0x40')]=_[_0xe494('0x41')](_0x5c5f76['model'],qs[_0xe494('0x42')](_0x32e70d['query'][_0xe494('0x42')]));_0x32d7f8[_0xe494('0x40')]=_0x32d7f8['attributes'][_0xe494('0x43')]?_0x32d7f8[_0xe494('0x40')]:_0x5c5f76[_0xe494('0x3f')];if(!_0x32e70d[_0xe494('0x3e')][_0xe494('0x44')](_0xe494('0x45'))){_0x32d7f8['limit']=qs['limit'](_0x32e70d[_0xe494('0x3e')]['limit']);_0x32d7f8[_0xe494('0x2f')]=qs[_0xe494('0x2f')](_0x32e70d[_0xe494('0x3e')]['offset']);}_0x32d7f8[_0xe494('0x46')]=qs['sort'](_0x32e70d[_0xe494('0x3e')][_0xe494('0x47')]);_0x32d7f8[_0xe494('0x48')]=qs[_0xe494('0x49')](_[_0xe494('0x4a')](_0x32e70d['query'],_0x5c5f76[_0xe494('0x49')]));if(_0x32e70d[_0xe494('0x3e')]['filter']){_0x32d7f8[_0xe494('0x48')]=_['merge'](_0x32d7f8[_0xe494('0x48')],{'$or':_['map'](_0x5ed519,function(_0x433ca5){if(_0x433ca5[_0xe494('0x3c')]!==_0xe494('0x4b')){var _0x25af07={};_0x25af07[_0x433ca5['name']]={'$like':'%'+_0x32e70d[_0xe494('0x3e')][_0xe494('0x4c')]+'%'};return _0x25af07;}})});}_0x32d7f8=_[_0xe494('0x4d')]({},_0x32d7f8,_0x32e70d[_0xe494('0x4e')]);var _0x418767={'where':_0x32d7f8[_0xe494('0x48')]};return db[_0xe494('0x39')][_0xe494('0x2e')](_0x418767)['then'](function(_0x1510c6){_0x42f763[_0xe494('0x2e')]=_0x1510c6;if(_0x32e70d[_0xe494('0x3e')][_0xe494('0x4f')]){_0x32d7f8[_0xe494('0x50')]=[{'all':!![]}];}return db[_0xe494('0x39')][_0xe494('0x51')](_0x32d7f8);})[_0xe494('0x20')](function(_0x4338cd){_0x42f763[_0xe494('0x52')]=_0x4338cd;return _0x42f763;})[_0xe494('0x20')](respondWithFilteredResult(_0x56a655,_0x32d7f8))[_0xe494('0x53')](handleError(_0x56a655,null));};exports[_0xe494('0x54')]=function(_0x415627,_0xfccaa9){var _0x26f4c2={'raw':![],'where':{'id':_0x415627[_0xe494('0x55')]['id']}},_0x84fbee={};_0x84fbee['model']=_['keys'](db[_0xe494('0x39')][_0xe494('0x3a')]);_0x84fbee[_0xe494('0x3e')]=_[_0xe494('0x56')](_0x415627[_0xe494('0x3e')]);_0x84fbee[_0xe494('0x49')]=_[_0xe494('0x41')](_0x84fbee[_0xe494('0x3f')],_0x84fbee[_0xe494('0x3e')]);_0x26f4c2[_0xe494('0x40')]=_[_0xe494('0x41')](_0x84fbee[_0xe494('0x3f')],qs[_0xe494('0x42')](_0x415627['query'][_0xe494('0x42')]));_0x26f4c2[_0xe494('0x40')]=_0x26f4c2[_0xe494('0x40')]['length']?_0x26f4c2[_0xe494('0x40')]:_0x84fbee[_0xe494('0x3f')];if(_0x415627[_0xe494('0x3e')][_0xe494('0x4f')]){_0x26f4c2['include']=[{'all':!![]}];}_0x26f4c2=_[_0xe494('0x4d')]({},_0x26f4c2,_0x415627[_0xe494('0x4e')]);return db[_0xe494('0x39')]['find'](_0x26f4c2)[_0xe494('0x20')](handleEntityNotFound(_0xfccaa9,null))[_0xe494('0x20')](respondWithResult(_0xfccaa9,null))[_0xe494('0x53')](handleError(_0xfccaa9,null));};exports[_0xe494('0x57')]=function(_0x3d0349,_0x25eb03){return db['ZendeskAccount']['create'](_0x3d0349[_0xe494('0x58')],{})[_0xe494('0x20')](respondWithResult(_0x25eb03,0xc9))[_0xe494('0x53')](handleError(_0x25eb03,null));};exports[_0xe494('0x59')]=function(_0x3efec6,_0x19a14f){if(_0x3efec6[_0xe494('0x58')]['id']){delete _0x3efec6[_0xe494('0x58')]['id'];}return db[_0xe494('0x39')][_0xe494('0x5a')]({'where':{'id':_0x3efec6[_0xe494('0x55')]['id']}})[_0xe494('0x20')](handleEntityNotFound(_0x19a14f,null))[_0xe494('0x20')](saveUpdates(_0x3efec6['body'],null))[_0xe494('0x20')](respondWithResult(_0x19a14f,null))[_0xe494('0x53')](handleError(_0x19a14f,null));};exports['destroy']=function(_0x127b9c,_0x315c13){return db[_0xe494('0x39')]['find']({'where':{'id':_0x127b9c[_0xe494('0x55')]['id']}})[_0xe494('0x20')](handleEntityNotFound(_0x315c13,null))[_0xe494('0x20')](removeEntity(_0x315c13,null))[_0xe494('0x53')](handleError(_0x315c13,null));};exports['getConfigurations']=function(_0x588aa2,_0x372615,_0x3cb133){var _0x2dbe21={};var _0x509730={};var _0x20c051;var _0x10f82c;return db[_0xe494('0x39')][_0xe494('0x5b')]({'where':{'id':_0x588aa2['params']['id']}})[_0xe494('0x20')](handleEntityNotFound(_0x372615,null))[_0xe494('0x20')](function(_0x4f8371){if(_0x4f8371){_0x20c051=_0x4f8371;_0x509730[_0xe494('0x3f')]=_[_0xe494('0x56')](db['ZendeskConfiguration']['rawAttributes']);_0x509730[_0xe494('0x3e')]=_['keys'](_0x588aa2[_0xe494('0x3e')]);_0x509730[_0xe494('0x49')]=_[_0xe494('0x41')](_0x509730[_0xe494('0x3f')],_0x509730[_0xe494('0x3e')]);_0x2dbe21['attributes']=_['intersection'](_0x509730['model'],qs[_0xe494('0x42')](_0x588aa2[_0xe494('0x3e')]['fields']));_0x2dbe21[_0xe494('0x40')]=_0x2dbe21[_0xe494('0x40')][_0xe494('0x43')]?_0x2dbe21[_0xe494('0x40')]:_0x509730['model'];_0x2dbe21[_0xe494('0x46')]=qs[_0xe494('0x47')](_0x588aa2['query'][_0xe494('0x47')]);_0x2dbe21[_0xe494('0x48')]=qs[_0xe494('0x49')](_[_0xe494('0x4a')](_0x588aa2[_0xe494('0x3e')],_0x509730[_0xe494('0x49')]));if(_0x588aa2[_0xe494('0x3e')][_0xe494('0x4c')]){_0x2dbe21[_0xe494('0x48')]=_[_0xe494('0x4d')](_0x2dbe21['where'],{'$or':_[_0xe494('0x38')](_0x2dbe21[_0xe494('0x40')],function(_0x1417df){var _0x1e343e={};_0x1e343e[_0x1417df]={'$like':'%'+_0x588aa2[_0xe494('0x3e')][_0xe494('0x4c')]+'%'};return _0x1e343e;})});}_0x2dbe21=_[_0xe494('0x4d')]({},_0x2dbe21,_0x588aa2['options']);return _0x20c051[_0xe494('0x5c')](_0x2dbe21);}})[_0xe494('0x20')](function(_0x5ef875){if(_0x5ef875){_0x10f82c=_0x5ef875[_0xe494('0x43')];if(!_0x588aa2[_0xe494('0x3e')][_0xe494('0x44')]('nolimit')){_0x2dbe21[_0xe494('0x5d')]=qs[_0xe494('0x5d')](_0x588aa2['query'][_0xe494('0x5d')]);_0x2dbe21[_0xe494('0x2f')]=qs[_0xe494('0x2f')](_0x588aa2['query']['offset']);}return _0x20c051[_0xe494('0x5c')](_0x2dbe21);}})[_0xe494('0x20')](function(_0x5ac27e){if(_0x5ac27e){return _0x5ac27e?{'count':_0x10f82c,'rows':_0x5ac27e}:null;}})[_0xe494('0x20')](respondWithResult(_0x372615,null))[_0xe494('0x53')](handleError(_0x372615,null));};exports[_0xe494('0x5e')]=function(_0x16664a,_0x555bbf,_0x5e719f){if(_0x16664a[_0xe494('0x58')]['id']){delete _0x16664a[_0xe494('0x58')]['id'];}return db[_0xe494('0x39')]['findOne']({'where':{'id':_0x16664a[_0xe494('0x55')]['id']}})['then'](handleEntityNotFound(_0x555bbf,null))['then'](function(_0x39ca6f){if(_0x39ca6f){_0x16664a[_0xe494('0x58')][_0xe494('0x5f')]=_0x39ca6f['id'];_0x16664a[_0xe494('0x58')]['Subjects']=integrations[_0xe494('0x60')](_0x16664a['body'][_0xe494('0x61')],_0x16664a[_0xe494('0x58')]['type']);_0x16664a[_0xe494('0x58')][_0xe494('0x62')]=integrations[_0xe494('0x63')](_0x16664a[_0xe494('0x58')]['channel'],_0x16664a[_0xe494('0x58')][_0xe494('0x3c')]);return db[_0xe494('0x64')]['create'](_0x16664a[_0xe494('0x58')],{'include':[{'model':db[_0xe494('0x65')],'as':_0xe494('0x66')},{'model':db[_0xe494('0x65')],'as':_0xe494('0x62')}]});}return null;})[_0xe494('0x20')](respondWithResult(_0x555bbf,null))[_0xe494('0x53')](handleError(_0x555bbf,null));};exports['getFields']=function(_0x123585,_0x12f491,_0x13033a){var _0x913e77='';return db[_0xe494('0x39')]['findOne']({'where':{'id':_0x123585[_0xe494('0x55')]['id']},'attributes':['id',_0xe494('0x67'),'password','token',_0xe494('0x68'),_0xe494('0x69')]})['then'](handleEntityNotFound(_0x12f491,null))[_0xe494('0x20')](function(_0xdaee0f){if(_0xdaee0f){_0x913e77=_0xdaee0f['remoteUri'];var _0x1d1421=_0x913e77[_0xe494('0x6a')](-0x1);if(_0x1d1421==='/'){_0x913e77=_0x913e77[_0xe494('0x6b')](0x0,_0x913e77['lastIndexOf'](_0x1d1421));}var _0x29d9cb={'method':_0xe494('0x6c'),'uri':util[_0xe494('0x6d')](_0xe494('0x6e'),_0x913e77,_0xe494('0x6f')),'json':!![]};switch(_0xdaee0f['authType']){case _0xe494('0x70'):_0x29d9cb[_0xe494('0x71')]={'Authorization':util[_0xe494('0x6d')](_0xe494('0x72'),new Buffer(util[_0xe494('0x6d')]('%s:%s',_0xdaee0f[_0xe494('0x67')],_0xdaee0f[_0xe494('0x70')]))['toString'](_0xe494('0x73')))};break;case'token':_0x29d9cb['headers']={'Authorization':util[_0xe494('0x6d')]('Basic\x20%s',new Buffer(util[_0xe494('0x6d')]('%s/token:%s',_0xdaee0f[_0xe494('0x67')],_0xdaee0f[_0xe494('0x74')]))[_0xe494('0x75')](_0xe494('0x73')))};break;default:throw new db[(_0xe494('0x1c'))][(_0xe494('0x1d'))](_0xe494('0x76'));}return rp(_0x29d9cb);}})[_0xe494('0x20')](function(_0x496153){if(_0x496153){var _0xeeebdc=[_0xe494('0x77'),'description','group',_0xe494('0x78')];_[_0xe494('0x79')](_0x496153[_0xe494('0x6f')],function(_0x255f3c){return _0xeeebdc['includes'](_0x255f3c[_0xe494('0x3c')]);});return{'count':_0x496153[_0xe494('0x6f')]['length'],'rows':_[_0xe494('0x38')](_0x496153['ticket_fields'],function(_0xc5ba8b){return{'id':_0xc5ba8b['id'],'name':_0xc5ba8b[_0xe494('0x7a')]>0x7?_0xc5ba8b[_0xe494('0x7b')]:_0xc5ba8b[_0xe494('0x3c')],'custom':_0xc5ba8b[_0xe494('0x7a')]>0x7?!![]:![],'options':_0xc5ba8b[_0xe494('0x7c')]?_0xc5ba8b[_0xe494('0x7c')]:_0xc5ba8b[_0xe494('0x7d')]?_0xc5ba8b[_0xe494('0x7d')]:[]};})};}})[_0xe494('0x20')](respondWithResult(_0x12f491,null))['catch'](function(_0x4796ac){var _0x3d93d0=_0x123585['query'][_0xe494('0x7e')]?0x1f4:_0x4796ac[_0xe494('0x7f')]||0x1f4;logger[_0xe494('0x27')](_0xe494('0x80'),_0xe494('0x81'),_0x3d93d0,JSON[_0xe494('0x26')](_0x4796ac));delete _0x4796ac[_0xe494('0x35')];if(_0x3d93d0===0x191){_0x3d93d0=0x190;}_0x12f491['status'](_0x3d93d0)['send'](_0x123585[_0xe494('0x3e')][_0xe494('0x7e')]?{'message':_0xe494('0x82'),'statusCode':_0x4796ac[_0xe494('0x7f')]}:_0x4796ac);});}; \ No newline at end of file +var _0x29b4=['lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','status','json','count','offset','limit','Content-Range','reject','update','destroy','end','stack','name','send','index','rawAttributes','fieldName','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','ZendeskAccount','includeAll','include','rows','show','params','keys','find','create','body','getConfigurations','findOne','ZendeskConfiguration','addConfiguration','AccountId','Subjects','channel','getDescriptions','ZendeskField','getFields','username','password','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','authType','headers','Basic\x20%s','base64','token','subject','description','assignee','remove','includes','position','title','system_field_options','custom_field_options','statusCode','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','path','to-csv','ejs'];(function(_0xdba0c,_0x3b4e25){var _0x3f19c4=function(_0x25e8e9){while(--_0x25e8e9){_0xdba0c['push'](_0xdba0c['shift']());}};_0x3f19c4(++_0x3b4e25);}(_0x29b4,0x15b));var _0x429b=function(_0x1105be,_0x1959a5){_0x1105be=_0x1105be-0x0;var _0x100c16=_0x29b4[_0x1105be];return _0x100c16;};'use strict';var pdf=require(_0x429b('0x0'));var emlformat=require(_0x429b('0x1'));var rimraf=require(_0x429b('0x2'));var zipdir=require(_0x429b('0x3'));var jsonpatch=require(_0x429b('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x429b('0x5'));var util=require(_0x429b('0x6'));var path=require(_0x429b('0x7'));var sox=require('sox');var csv=require(_0x429b('0x8'));var ejs=require(_0x429b('0x9'));var fs=require('fs');var _=require(_0x429b('0xa'));var squel=require(_0x429b('0xb'));var crypto=require('crypto');var jsforce=require(_0x429b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x429b('0x8'));var querystring=require('querystring');var Papa=require(_0x429b('0xd'));var Redis=require(_0x429b('0xe'));var authService=require(_0x429b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x429b('0x10'));var hardwareService=require(_0x429b('0x11'));var logger=require(_0x429b('0x12'))(_0x429b('0x13'));var utils=require(_0x429b('0x14'));var config=require(_0x429b('0x15'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');var jayson=require(_0x429b('0x16'));var client=jayson[_0x429b('0x17')][_0x429b('0x18')]({'port':0x232a});function checkPasswordPattern(_0x4c3a5e,_0x46248f,_0x9ffbb3){if(_0x9ffbb3){var _0x2a7737=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a7737[_0x429b('0x19')](_0x46248f)){return _0x4c3a5e;}else{throw new db[(_0x429b('0x1a'))][(_0x429b('0x1b'))](_0x429b('0x1c'));}}else{return _0x4c3a5e;}}function respondWithRpcPromise(_0x5b32b2,_0x444816,_0x5ac30c,_0x58c77e){return new BPromise(function(_0x189209,_0x57afd2){var _0x5508c3=_0x58c77e||client;return _0x5508c3[_0x429b('0x1d')](_0x5b32b2,_0x5ac30c)[_0x429b('0x1e')](function(_0x55f589){logger[_0x429b('0x1f')](_0x429b('0x20'),_0x444816,_0x429b('0x21'));logger['debug']('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x444816,_0x429b('0x21'),JSON[_0x429b('0x22')](_0x55f589));if(_0x55f589[_0x429b('0x23')]){if(_0x55f589[_0x429b('0x23')][_0x429b('0x24')]===0x1f4){logger[_0x429b('0x23')](_0x429b('0x20'),_0x444816,_0x55f589[_0x429b('0x23')]['message']);return _0x57afd2(_0x55f589['error']['message']);}logger[_0x429b('0x23')](_0x429b('0x20'),_0x444816,_0x55f589[_0x429b('0x23')][_0x429b('0x25')]);return _0x189209(_0x55f589[_0x429b('0x23')]['message']);}else{logger[_0x429b('0x1f')](_0x429b('0x20'),_0x444816,_0x429b('0x21'));_0x189209(_0x55f589[_0x429b('0x26')][_0x429b('0x25')]);}})[_0x429b('0x27')](function(_0x4b0e53){logger[_0x429b('0x23')](_0x429b('0x20'),_0x444816,_0x4b0e53);_0x57afd2(_0x4b0e53);});});}function respondWithStatusCode(_0x9e679d,_0x11d2d4){_0x11d2d4=_0x11d2d4||0xcc;return function(_0x2623c3){if(_0x2623c3){return _0x9e679d['sendStatus'](_0x11d2d4);}return _0x9e679d['status'](_0x11d2d4)['end']();};}function respondWithResult(_0x3cb407,_0x506e25){_0x506e25=_0x506e25||0xc8;return function(_0x294b2b){if(_0x294b2b){return _0x3cb407[_0x429b('0x28')](_0x506e25)[_0x429b('0x29')](_0x294b2b);}};}function respondWithFilteredResult(_0x251d6f,_0x308a04){return function(_0x46d531){if(_0x46d531){var _0x402ca4=_0x46d531[_0x429b('0x2a')],_0x3a8bd7=_0x308a04[_0x429b('0x2b')],_0x3d0358=_0x308a04['offset']+_0x308a04[_0x429b('0x2c')],_0x229049;if(_0x3d0358>=_0x402ca4){_0x3d0358=_0x402ca4;_0x229049=0xc8;}else{_0x229049=0xce;}_0x251d6f[_0x429b('0x28')](_0x229049);return _0x251d6f['set'](_0x429b('0x2d'),_0x3a8bd7+'-'+_0x3d0358+'/'+_0x402ca4)[_0x429b('0x29')](_0x46d531);}return null;};}function patchUpdates(_0x242ee2){return function(_0x10287e){try{jsonpatch['apply'](_0x10287e,_0x242ee2,!![]);}catch(_0xd54aa1){return BPromise[_0x429b('0x2e')](_0xd54aa1);}return _0x10287e['save']();};}function saveUpdates(_0x55f023,_0x132591){return function(_0x347d3f){if(_0x347d3f){return _0x347d3f[_0x429b('0x2f')](_0x55f023)['then'](function(_0x28f862){return _0x28f862;});}return null;};}function removeEntity(_0x1b87d8,_0x257037){return function(_0x1bc3f5){if(_0x1bc3f5){return _0x1bc3f5[_0x429b('0x30')]()[_0x429b('0x1e')](function(){_0x1b87d8[_0x429b('0x28')](0xcc)[_0x429b('0x31')]();});}};}function handleEntityNotFound(_0x5af631,_0x9423a2){return function(_0x2cc8e3){if(!_0x2cc8e3){_0x5af631['sendStatus'](0x194);}return _0x2cc8e3;};}function handleError(_0x429bde,_0x1dce9f){_0x1dce9f=_0x1dce9f||0x1f4;return function(_0x2e93ef){logger[_0x429b('0x23')](_0x2e93ef[_0x429b('0x32')]);if(_0x2e93ef[_0x429b('0x33')]){delete _0x2e93ef[_0x429b('0x33')];}_0x429bde[_0x429b('0x28')](_0x1dce9f)[_0x429b('0x34')](_0x2e93ef);};}exports[_0x429b('0x35')]=function(_0x1c7bb2,_0x3eb3af){var _0x382be5={},_0x262c95={},_0x15aa18={'count':0x0,'rows':[]};var _0x23caab=_['map'](db['ZendeskAccount'][_0x429b('0x36')],function(_0x3407bc){return{'name':_0x3407bc[_0x429b('0x37')],'type':_0x3407bc['type']['key']};});_0x262c95[_0x429b('0x38')]=_[_0x429b('0x39')](_0x23caab,_0x429b('0x33'));_0x262c95[_0x429b('0x3a')]=_['keys'](_0x1c7bb2[_0x429b('0x3a')]);_0x262c95[_0x429b('0x3b')]=_[_0x429b('0x3c')](_0x262c95[_0x429b('0x38')],_0x262c95[_0x429b('0x3a')]);_0x382be5['attributes']=_[_0x429b('0x3c')](_0x262c95['model'],qs[_0x429b('0x3d')](_0x1c7bb2[_0x429b('0x3a')]['fields']));_0x382be5[_0x429b('0x3e')]=_0x382be5[_0x429b('0x3e')][_0x429b('0x3f')]?_0x382be5[_0x429b('0x3e')]:_0x262c95[_0x429b('0x38')];if(!_0x1c7bb2['query'][_0x429b('0x40')](_0x429b('0x41'))){_0x382be5[_0x429b('0x2c')]=qs[_0x429b('0x2c')](_0x1c7bb2[_0x429b('0x3a')][_0x429b('0x2c')]);_0x382be5['offset']=qs[_0x429b('0x2b')](_0x1c7bb2['query'][_0x429b('0x2b')]);}_0x382be5[_0x429b('0x42')]=qs[_0x429b('0x43')](_0x1c7bb2['query']['sort']);_0x382be5['where']=qs[_0x429b('0x3b')](_[_0x429b('0x44')](_0x1c7bb2['query'],_0x262c95['filters']));if(_0x1c7bb2[_0x429b('0x3a')][_0x429b('0x45')]){_0x382be5['where']=_[_0x429b('0x46')](_0x382be5[_0x429b('0x47')],{'$or':_[_0x429b('0x39')](_0x23caab,function(_0x12fc07){if(_0x12fc07[_0x429b('0x48')]!==_0x429b('0x49')){var _0x278411={};_0x278411[_0x12fc07[_0x429b('0x33')]]={'$like':'%'+_0x1c7bb2[_0x429b('0x3a')][_0x429b('0x45')]+'%'};return _0x278411;}})});}_0x382be5=_[_0x429b('0x46')]({},_0x382be5,_0x1c7bb2[_0x429b('0x4a')]);var _0x3278b7={'where':_0x382be5[_0x429b('0x47')]};return db[_0x429b('0x4b')][_0x429b('0x2a')](_0x3278b7)[_0x429b('0x1e')](function(_0x36017c){_0x15aa18[_0x429b('0x2a')]=_0x36017c;if(_0x1c7bb2['query'][_0x429b('0x4c')]){_0x382be5[_0x429b('0x4d')]=[{'all':!![]}];}return db[_0x429b('0x4b')]['findAll'](_0x382be5);})['then'](function(_0xc76430){_0x15aa18[_0x429b('0x4e')]=_0xc76430;return _0x15aa18;})[_0x429b('0x1e')](respondWithFilteredResult(_0x3eb3af,_0x382be5))[_0x429b('0x27')](handleError(_0x3eb3af,null));};exports[_0x429b('0x4f')]=function(_0x84987e,_0x2e3e1b){var _0x5db819={'raw':![],'where':{'id':_0x84987e[_0x429b('0x50')]['id']}},_0x422e97={};_0x422e97[_0x429b('0x38')]=_[_0x429b('0x51')](db['ZendeskAccount'][_0x429b('0x36')]);_0x422e97[_0x429b('0x3a')]=_[_0x429b('0x51')](_0x84987e[_0x429b('0x3a')]);_0x422e97[_0x429b('0x3b')]=_[_0x429b('0x3c')](_0x422e97[_0x429b('0x38')],_0x422e97[_0x429b('0x3a')]);_0x5db819[_0x429b('0x3e')]=_[_0x429b('0x3c')](_0x422e97[_0x429b('0x38')],qs[_0x429b('0x3d')](_0x84987e[_0x429b('0x3a')][_0x429b('0x3d')]));_0x5db819[_0x429b('0x3e')]=_0x5db819[_0x429b('0x3e')][_0x429b('0x3f')]?_0x5db819[_0x429b('0x3e')]:_0x422e97[_0x429b('0x38')];if(_0x84987e[_0x429b('0x3a')]['includeAll']){_0x5db819[_0x429b('0x4d')]=[{'all':!![]}];}_0x5db819=_[_0x429b('0x46')]({},_0x5db819,_0x84987e[_0x429b('0x4a')]);return db[_0x429b('0x4b')][_0x429b('0x52')](_0x5db819)[_0x429b('0x1e')](handleEntityNotFound(_0x2e3e1b,null))['then'](respondWithResult(_0x2e3e1b,null))[_0x429b('0x27')](handleError(_0x2e3e1b,null));};exports[_0x429b('0x53')]=function(_0x167c38,_0x56cc0a){return db[_0x429b('0x4b')][_0x429b('0x53')](_0x167c38[_0x429b('0x54')],{})[_0x429b('0x1e')](respondWithResult(_0x56cc0a,0xc9))[_0x429b('0x27')](handleError(_0x56cc0a,null));};exports[_0x429b('0x2f')]=function(_0x5ae03f,_0x57ceb7){if(_0x5ae03f['body']['id']){delete _0x5ae03f[_0x429b('0x54')]['id'];}return db[_0x429b('0x4b')][_0x429b('0x52')]({'where':{'id':_0x5ae03f[_0x429b('0x50')]['id']}})[_0x429b('0x1e')](handleEntityNotFound(_0x57ceb7,null))['then'](saveUpdates(_0x5ae03f[_0x429b('0x54')],null))[_0x429b('0x1e')](respondWithResult(_0x57ceb7,null))[_0x429b('0x27')](handleError(_0x57ceb7,null));};exports[_0x429b('0x30')]=function(_0x58949f,_0x296b6f){return db[_0x429b('0x4b')][_0x429b('0x52')]({'where':{'id':_0x58949f[_0x429b('0x50')]['id']}})[_0x429b('0x1e')](handleEntityNotFound(_0x296b6f,null))[_0x429b('0x1e')](removeEntity(_0x296b6f,null))[_0x429b('0x27')](handleError(_0x296b6f,null));};exports[_0x429b('0x55')]=function(_0x58dc14,_0xe20f6d,_0x47e7ea){var _0x40f9d2={};var _0x1e48e6={};var _0x31a52c;var _0x1dce00;return db[_0x429b('0x4b')][_0x429b('0x56')]({'where':{'id':_0x58dc14[_0x429b('0x50')]['id']}})['then'](handleEntityNotFound(_0xe20f6d,null))[_0x429b('0x1e')](function(_0x2f09a6){if(_0x2f09a6){_0x31a52c=_0x2f09a6;_0x1e48e6['model']=_[_0x429b('0x51')](db[_0x429b('0x57')][_0x429b('0x36')]);_0x1e48e6[_0x429b('0x3a')]=_[_0x429b('0x51')](_0x58dc14[_0x429b('0x3a')]);_0x1e48e6[_0x429b('0x3b')]=_['intersection'](_0x1e48e6[_0x429b('0x38')],_0x1e48e6[_0x429b('0x3a')]);_0x40f9d2[_0x429b('0x3e')]=_['intersection'](_0x1e48e6[_0x429b('0x38')],qs[_0x429b('0x3d')](_0x58dc14['query']['fields']));_0x40f9d2[_0x429b('0x3e')]=_0x40f9d2[_0x429b('0x3e')]['length']?_0x40f9d2[_0x429b('0x3e')]:_0x1e48e6[_0x429b('0x38')];_0x40f9d2[_0x429b('0x42')]=qs['sort'](_0x58dc14[_0x429b('0x3a')][_0x429b('0x43')]);_0x40f9d2[_0x429b('0x47')]=qs['filters'](_[_0x429b('0x44')](_0x58dc14[_0x429b('0x3a')],_0x1e48e6[_0x429b('0x3b')]));if(_0x58dc14[_0x429b('0x3a')][_0x429b('0x45')]){_0x40f9d2[_0x429b('0x47')]=_[_0x429b('0x46')](_0x40f9d2[_0x429b('0x47')],{'$or':_[_0x429b('0x39')](_0x40f9d2[_0x429b('0x3e')],function(_0x575cd0){var _0x14a462={};_0x14a462[_0x575cd0]={'$like':'%'+_0x58dc14[_0x429b('0x3a')][_0x429b('0x45')]+'%'};return _0x14a462;})});}_0x40f9d2=_[_0x429b('0x46')]({},_0x40f9d2,_0x58dc14[_0x429b('0x4a')]);return _0x31a52c[_0x429b('0x55')](_0x40f9d2);}})[_0x429b('0x1e')](function(_0x2b511d){if(_0x2b511d){_0x1dce00=_0x2b511d[_0x429b('0x3f')];if(!_0x58dc14[_0x429b('0x3a')][_0x429b('0x40')]('nolimit')){_0x40f9d2[_0x429b('0x2c')]=qs[_0x429b('0x2c')](_0x58dc14[_0x429b('0x3a')][_0x429b('0x2c')]);_0x40f9d2[_0x429b('0x2b')]=qs['offset'](_0x58dc14[_0x429b('0x3a')][_0x429b('0x2b')]);}return _0x31a52c[_0x429b('0x55')](_0x40f9d2);}})['then'](function(_0xdcfba0){if(_0xdcfba0){return _0xdcfba0?{'count':_0x1dce00,'rows':_0xdcfba0}:null;}})[_0x429b('0x1e')](respondWithResult(_0xe20f6d,null))[_0x429b('0x27')](handleError(_0xe20f6d,null));};exports[_0x429b('0x58')]=function(_0x3c68b9,_0x58d3b3,_0x216500){if(_0x3c68b9['body']['id']){delete _0x3c68b9['body']['id'];}return db[_0x429b('0x4b')][_0x429b('0x56')]({'where':{'id':_0x3c68b9[_0x429b('0x50')]['id']}})[_0x429b('0x1e')](handleEntityNotFound(_0x58d3b3,null))[_0x429b('0x1e')](function(_0x34fcb7){if(_0x34fcb7){_0x3c68b9[_0x429b('0x54')][_0x429b('0x59')]=_0x34fcb7['id'];_0x3c68b9[_0x429b('0x54')][_0x429b('0x5a')]=integrations['getSubjects'](_0x3c68b9[_0x429b('0x54')][_0x429b('0x5b')],_0x3c68b9[_0x429b('0x54')][_0x429b('0x48')]);_0x3c68b9[_0x429b('0x54')]['Descriptions']=integrations[_0x429b('0x5c')](_0x3c68b9[_0x429b('0x54')]['channel'],_0x3c68b9[_0x429b('0x54')][_0x429b('0x48')]);return db['ZendeskConfiguration']['create'](_0x3c68b9[_0x429b('0x54')],{'include':[{'model':db[_0x429b('0x5d')],'as':_0x429b('0x5a')},{'model':db[_0x429b('0x5d')],'as':'Descriptions'}]});}return null;})[_0x429b('0x1e')](respondWithResult(_0x58d3b3,null))[_0x429b('0x27')](handleError(_0x58d3b3,null));};exports[_0x429b('0x5e')]=function(_0x44a9b5,_0x3fc7a0,_0x1dccdf){var _0x1a1f68='';return db['ZendeskAccount'][_0x429b('0x56')]({'where':{'id':_0x44a9b5[_0x429b('0x50')]['id']},'attributes':['id',_0x429b('0x5f'),_0x429b('0x60'),'token','authType','remoteUri']})[_0x429b('0x1e')](handleEntityNotFound(_0x3fc7a0,null))['then'](function(_0x44eafb){if(_0x44eafb){_0x1a1f68=_0x44eafb['remoteUri'];var _0x5d271b=_0x1a1f68[_0x429b('0x61')](-0x1);if(_0x5d271b==='/'){_0x1a1f68=_0x1a1f68[_0x429b('0x62')](0x0,_0x1a1f68[_0x429b('0x63')](_0x5d271b));}var _0x3e2acd={'method':_0x429b('0x64'),'uri':util[_0x429b('0x65')](_0x429b('0x66'),_0x1a1f68,_0x429b('0x67')),'json':!![]};switch(_0x44eafb[_0x429b('0x68')]){case _0x429b('0x60'):_0x3e2acd[_0x429b('0x69')]={'Authorization':util['format'](_0x429b('0x6a'),new Buffer(util[_0x429b('0x65')]('%s:%s',_0x44eafb['username'],_0x44eafb[_0x429b('0x60')]))['toString'](_0x429b('0x6b')))};break;case _0x429b('0x6c'):_0x3e2acd[_0x429b('0x69')]={'Authorization':util[_0x429b('0x65')](_0x429b('0x6a'),new Buffer(util['format']('%s/token:%s',_0x44eafb[_0x429b('0x5f')],_0x44eafb[_0x429b('0x6c')]))['toString'](_0x429b('0x6b')))};break;default:throw new db[(_0x429b('0x1a'))][(_0x429b('0x1b'))]('Unknown\x20authentication\x20type');}return rp(_0x3e2acd);}})['then'](function(_0x1e3b44){if(_0x1e3b44){var _0x33b0e5=[_0x429b('0x6d'),_0x429b('0x6e'),'group',_0x429b('0x6f')];_[_0x429b('0x70')](_0x1e3b44['ticket_fields'],function(_0x4e154c){return _0x33b0e5[_0x429b('0x71')](_0x4e154c[_0x429b('0x48')]);});return{'count':_0x1e3b44[_0x429b('0x67')][_0x429b('0x3f')],'rows':_[_0x429b('0x39')](_0x1e3b44[_0x429b('0x67')],function(_0x1cfa5e){return{'id':_0x1cfa5e['id'],'name':_0x1cfa5e[_0x429b('0x72')]>0x7?_0x1cfa5e[_0x429b('0x73')]:_0x1cfa5e[_0x429b('0x48')],'custom':_0x1cfa5e[_0x429b('0x72')]>0x7?!![]:![],'options':_0x1cfa5e['system_field_options']?_0x1cfa5e[_0x429b('0x74')]:_0x1cfa5e['custom_field_options']?_0x1cfa5e[_0x429b('0x75')]:[]};})};}})['then'](respondWithResult(_0x3fc7a0,null))[_0x429b('0x27')](function(_0x4d033e){var _0x1841ea=_0x44a9b5[_0x429b('0x3a')]['test']?0x1f4:_0x4d033e[_0x429b('0x76')]||0x1f4;logger[_0x429b('0x23')]('getFields,\x20%s,\x20%s,\x20%s',_0x429b('0x5e'),_0x1841ea,JSON['stringify'](_0x4d033e));delete _0x4d033e[_0x429b('0x33')];if(_0x1841ea===0x191){_0x1841ea=0x190;}_0x3fc7a0[_0x429b('0x28')](_0x1841ea)[_0x429b('0x34')](_0x44a9b5['query'][_0x429b('0x19')]?{'message':'Wrong\x20credentials','statusCode':_0x4d033e[_0x429b('0x76')]}:_0x4d033e);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 059d65b..ae0ecef 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 _0xda6d=['define','ZendeskAccount','int_zendesk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','../../components/integrations/configuration','exports'];(function(_0x2f36f2,_0x4d879e){var _0x32080a=function(_0x2edf44){while(--_0x2edf44){_0x2f36f2['push'](_0x2f36f2['shift']());}};_0x32080a(++_0x4d879e);}(_0xda6d,0x19b));var _0xdda6=function(_0x3f1117,_0x5de5fd){_0x3f1117=_0x3f1117-0x0;var _0x2a929f=_0xda6d[_0x3f1117];return _0x2a929f;};'use strict';var _=require(_0xdda6('0x0'));var util=require('util');var logger=require(_0xdda6('0x1'))(_0xdda6('0x2'));var moment=require(_0xdda6('0x3'));var BPromise=require(_0xdda6('0x4'));var rp=require(_0xdda6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xdda6('0x6'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xdda6('0x7'));module[_0xdda6('0x8')]=function(_0x504930,_0x20cdda){return _0x504930[_0xdda6('0x9')](_0xdda6('0xa'),attributes,{'tableName':_0xdda6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b7f=['request-promise','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','moment'];(function(_0x50e593,_0x3ae998){var _0x3821d0=function(_0x53c295){while(--_0x53c295){_0x50e593['push'](_0x50e593['shift']());}};_0x3821d0(++_0x3ae998);}(_0x9b7f,0x17a));var _0xf9b7=function(_0x3ca977,_0x3a3fd5){_0x3ca977=_0x3ca977-0x0;var _0x54dea7=_0x9b7f[_0x3ca977];return _0x54dea7;};'use strict';var _=require(_0xf9b7('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xf9b7('0x1'));var BPromise=require('bluebird');var rp=require(_0xf9b7('0x2'));var fs=require('fs');var path=require(_0xf9b7('0x3'));var rimraf=require('rimraf');var config=require(_0xf9b7('0x4'));var attributes=require(_0xf9b7('0x5'));var integrations=require(_0xf9b7('0x6'));module[_0xf9b7('0x7')]=function(_0x2d7366,_0x3c78b4){return _0x2d7366[_0xf9b7('0x8')](_0xf9b7('0x9'),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 d1be65d..4a96ed7 100644 --- a/server/api/intZendeskAccount/intZendeskAccount.rpc.js +++ b/server/api/intZendeskAccount/intZendeskAccount.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['findAll','options','raw','attributes','limit','include','map','model','ShowZendeskAccount','where','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZendeskAccount','ZendeskAccount'];(function(_0x25c21f,_0x2f23ee){var _0x232afd=function(_0x1e97fd){while(--_0x1e97fd){_0x25c21f['push'](_0x25c21f['shift']());}};_0x232afd(++_0x2f23ee);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3071('0x0'));var BPromise=require(_0x3071('0x1'));var rs=require(_0x3071('0x2'));var fs=require('fs');var Redis=require(_0x3071('0x3'));var db=require(_0x3071('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x3071('0x5'))(_0x3071('0x6'));var config=require(_0x3071('0x7'));var jayson=require(_0x3071('0x8'));var client=jayson[_0x3071('0x9')][_0x3071('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1d3dd6,_0x2f1e87,_0xbd737f){return new BPromise(function(_0x22274c,_0x3e9a5e){return client[_0x3071('0xb')](_0x1d3dd6,_0xbd737f)[_0x3071('0xc')](function(_0x4a36ec){logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));logger[_0x3071('0x10')](_0x3071('0x11'),_0x2f1e87,'request\x20sent',JSON[_0x3071('0x12')](_0x4a36ec));if(_0x4a36ec[_0x3071('0x13')]){if(_0x4a36ec[_0x3071('0x13')][_0x3071('0x14')]===0x1f4){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec['error'][_0x3071('0x15')]);return _0x3e9a5e(_0x4a36ec['error'][_0x3071('0x15')]);}logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x4a36ec[_0x3071('0x13')]['message']);return _0x22274c(_0x4a36ec[_0x3071('0x13')][_0x3071('0x15')]);}else{logger[_0x3071('0xd')](_0x3071('0xe'),_0x2f1e87,_0x3071('0xf'));_0x22274c(_0x4a36ec[_0x3071('0x16')][_0x3071('0x15')]);}})[_0x3071('0x17')](function(_0x21aad3){logger[_0x3071('0x13')]('ZendeskAccount,\x20%s,\x20%s',_0x2f1e87,_0x21aad3);_0x3e9a5e(_0x21aad3);});});}exports[_0x3071('0x18')]=function(_0x17dbda){var _0x1068d9=this;return new Promise(function(_0x108a83,_0x3acf0e){return db[_0x3071('0x19')][_0x3071('0x1a')]({'raw':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')]['where']||null:null,'attributes':_0x17dbda[_0x3071('0x1b')]?_0x17dbda['options'][_0x3071('0x1d')]||null:null,'limit':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1e')]||null:null,'include':_0x17dbda[_0x3071('0x1b')]?_0x17dbda[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x17dbda['options']['include'],function(_0x2ce48a){return{'model':db[_0x2ce48a[_0x3071('0x21')]],'as':_0x2ce48a['as'],'attributes':_0x2ce48a[_0x3071('0x1d')],'include':_0x2ce48a[_0x3071('0x1f')]?_[_0x3071('0x20')](_0x2ce48a[_0x3071('0x1f')],function(_0x7a4cb4){return{'model':db[_0x7a4cb4[_0x3071('0x21')]],'as':_0x7a4cb4['as'],'attributes':_0x7a4cb4[_0x3071('0x1d')],'include':_0x7a4cb4['include']?_[_0x3071('0x20')](_0x7a4cb4[_0x3071('0x1f')],function(_0x177138){return{'model':db[_0x177138['model']],'as':_0x177138['as'],'attributes':_0x177138[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x163604){logger[_0x3071('0xd')](_0x3071('0x18'),_0x17dbda);logger[_0x3071('0x10')](_0x3071('0x18'),_0x17dbda,JSON[_0x3071('0x12')](_0x163604));_0x108a83(_0x163604);})[_0x3071('0x17')](function(_0x292205){logger[_0x3071('0x13')]('GetZendeskAccount',_0x292205['message'],_0x17dbda);_0x3acf0e(_0x1068d9[_0x3071('0x13')](0x1f4,_0x292205[_0x3071('0x15')]));});});};exports[_0x3071('0x22')]=function(_0x40be95){var _0x3f6d90=this;return new Promise(function(_0x29538c,_0x32b6b1){return db[_0x3071('0x19')]['find']({'raw':_0x40be95['options']?_0x40be95['options'][_0x3071('0x1c')]===undefined?!![]:![]:!![],'where':_0x40be95[_0x3071('0x1b')]?_0x40be95['options'][_0x3071('0x23')]||null:null,'attributes':_0x40be95[_0x3071('0x1b')]?_0x40be95[_0x3071('0x1b')][_0x3071('0x1d')]||null:null,'include':_0x40be95['options']?_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')]?_[_0x3071('0x20')](_0x40be95[_0x3071('0x1b')][_0x3071('0x1f')],function(_0x2068ce){return{'model':db[_0x2068ce[_0x3071('0x21')]],'as':_0x2068ce['as'],'attributes':_0x2068ce[_0x3071('0x1d')],'include':_0x2068ce['include']?_[_0x3071('0x20')](_0x2068ce['include'],function(_0x4fb1ec){return{'model':db[_0x4fb1ec[_0x3071('0x21')]],'as':_0x4fb1ec['as'],'attributes':_0x4fb1ec[_0x3071('0x1d')],'include':_0x4fb1ec['include']?_[_0x3071('0x20')](_0x4fb1ec[_0x3071('0x1f')],function(_0x265d76){return{'model':db[_0x265d76[_0x3071('0x21')]],'as':_0x265d76['as'],'attributes':_0x265d76[_0x3071('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x3071('0xc')](function(_0x5610ab){logger[_0x3071('0xd')](_0x3071('0x22'),_0x40be95);logger['debug'](_0x3071('0x22'),_0x40be95,JSON['stringify'](_0x5610ab));_0x29538c(_0x5610ab);})[_0x3071('0x17')](function(_0x43133a){logger['error']('ShowZendeskAccount',_0x43133a[_0x3071('0x15')],_0x40be95);_0x32b6b1(_0x3f6d90[_0x3071('0x13')](0x1f4,_0x43133a[_0x3071('0x15')]));});});}; \ No newline at end of file +var _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(_0x623e7,_0x1bef7d){var _0x121131=function(_0x59b734){while(--_0x59b734){_0x623e7['push'](_0x623e7['shift']());}};_0x121131(++_0x1bef7d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xa9e0[_0x102e37];return _0x35a07c;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});}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 diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 536c8ea..faf0f5a 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 _0xbd45=['post','create','setTags','put','delete','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xbd45,0x14a));var _0x5bd4=function(_0xf778eb,_0x3fd0ae){_0xf778eb=_0xf778eb-0x0;var _0x26f2ae=_0xbd45[_0xf778eb];return _0x26f2ae;};'use strict';var multer=require(_0x5bd4('0x0'));var util=require('util');var path=require(_0x5bd4('0x1'));var timeout=require('connect-timeout');var express=require(_0x5bd4('0x2'));var router=express[_0x5bd4('0x3')]();var auth=require(_0x5bd4('0x4'));var interaction=require(_0x5bd4('0x5'));var config=require(_0x5bd4('0x6'));var controller=require(_0x5bd4('0x7'));router[_0x5bd4('0x8')]('/',auth['isAuthenticated'](),controller[_0x5bd4('0x9')]);router[_0x5bd4('0x8')](_0x5bd4('0xa'),auth[_0x5bd4('0xb')](),controller[_0x5bd4('0xc')]);router[_0x5bd4('0x8')](_0x5bd4('0xd'),auth[_0x5bd4('0xb')](),controller[_0x5bd4('0xe')]);router[_0x5bd4('0x8')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x5bd4('0xf')]);router['get'](_0x5bd4('0x10'),auth['isAuthenticated'](),controller[_0x5bd4('0x11')]);router[_0x5bd4('0x8')](_0x5bd4('0x12'),auth[_0x5bd4('0xb')](),controller[_0x5bd4('0x13')]);router[_0x5bd4('0x14')]('/',auth[_0x5bd4('0xb')](),controller[_0x5bd4('0x15')]);router['post'](_0x5bd4('0x12'),auth[_0x5bd4('0xb')](),controller[_0x5bd4('0x16')]);router[_0x5bd4('0x17')]('/:id',auth[_0x5bd4('0xb')](),controller['update']);router[_0x5bd4('0x18')](_0x5bd4('0xa'),auth[_0x5bd4('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x84bd=['multer','util','path','express','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','/:id/tags','getTags','post','create','setTags','update','delete','destroy','exports'];(function(_0x589cb3,_0x552581){var _0x247157=function(_0x4fbdde){while(--_0x4fbdde){_0x589cb3['push'](_0x589cb3['shift']());}};_0x247157(++_0x552581);}(_0x84bd,0x1d4));var _0xd84b=function(_0xdd82b4,_0x5cd8b8){_0xdd82b4=_0xdd82b4-0x0;var _0x549bb2=_0x84bd[_0xdd82b4];return _0x549bb2;};'use strict';var multer=require(_0xd84b('0x0'));var util=require(_0xd84b('0x1'));var path=require(_0xd84b('0x2'));var timeout=require('connect-timeout');var express=require(_0xd84b('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd84b('0x4'));var config=require(_0xd84b('0x5'));var controller=require(_0xd84b('0x6'));router[_0xd84b('0x7')]('/',auth['isAuthenticated'](),controller[_0xd84b('0x8')]);router[_0xd84b('0x7')](_0xd84b('0x9'),auth[_0xd84b('0xa')](),controller[_0xd84b('0xb')]);router[_0xd84b('0x7')](_0xd84b('0xc'),auth[_0xd84b('0xa')](),controller[_0xd84b('0xd')]);router[_0xd84b('0x7')](_0xd84b('0xe'),auth[_0xd84b('0xa')](),controller[_0xd84b('0xf')]);router['get'](_0xd84b('0x10'),auth[_0xd84b('0xa')](),controller['getDescriptions']);router[_0xd84b('0x7')](_0xd84b('0x11'),auth[_0xd84b('0xa')](),controller[_0xd84b('0x12')]);router[_0xd84b('0x13')]('/',auth[_0xd84b('0xa')](),controller[_0xd84b('0x14')]);router[_0xd84b('0x13')](_0xd84b('0x11'),auth[_0xd84b('0xa')](),controller[_0xd84b('0x15')]);router['put'](_0xd84b('0x9'),auth[_0xd84b('0xa')](),controller[_0xd84b('0x16')]);router[_0xd84b('0x17')]('/:id',auth[_0xd84b('0xa')](),controller[_0xd84b('0x18')]);module[_0xd84b('0x19')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 865eec5..d38a538 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 _0x258b=['STRING','sequelize'];(function(_0x231499,_0x175616){var _0x2e3741=function(_0x440cfe){while(--_0x440cfe){_0x231499['push'](_0x231499['shift']());}};_0x2e3741(++_0x175616);}(_0x258b,0x1e1));var _0xb258=function(_0x256c8a,_0x5427bc){_0x256c8a=_0x256c8a-0x0;var _0x3ac658=_0x258b[_0x256c8a];return _0x3ac658;};'use strict';var Sequelize=require(_0xb258('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb258('0x1')]}}; \ No newline at end of file +var _0xcf18=['exports','STRING'];(function(_0x421a65,_0x15147a){var _0x5638a9=function(_0x33a53a){while(--_0x33a53a){_0x421a65['push'](_0x421a65['shift']());}};_0x5638a9(++_0x15147a);}(_0xcf18,0x66));var _0x8cf1=function(_0x10ad4e,_0x5003e3){_0x10ad4e=_0x10ad4e-0x0;var _0x181ec8=_0xcf18[_0x10ad4e];return _0x181ec8;};'use strict';var Sequelize=require('sequelize');module[_0x8cf1('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8cf1('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index b79d891..7dcc18a 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 _0x5fc3=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','http','test','Sequelize','request','info','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','type','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','ZendeskConfiguration','includeAll','findAll','params','include','find','create','body','getFields','findOne','rawAttributes','pick','getSubjects','ZendeskField','getDescriptions','Tag','setTags','ids','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x2463db,_0x12b669){var _0x5eb642=function(_0x17041b){while(--_0x17041b){_0x2463db['push'](_0x2463db['shift']());}};_0x5eb642(++_0x12b669);}(_0x5fc3,0xa8));var _0x35fc=function(_0x44b3bd,_0x44c97d){_0x44b3bd=_0x44b3bd-0x0;var _0x1efc4a=_0x5fc3[_0x44b3bd];return _0x1efc4a;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var db=require(_0x35fc('0x17'))['db'];var jayson=require('jayson/promise');var client=jayson['client'][_0x35fc('0x18')]({'port':0x232a});function checkPasswordPattern(_0x5d462a,_0x397738,_0x22055e){if(_0x22055e){var _0x2a6ad2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x2a6ad2[_0x35fc('0x19')](_0x397738)){return _0x5d462a;}else{throw new db[(_0x35fc('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 _0x5d462a;}}function respondWithRpcPromise(_0x5eac0f,_0x558364,_0x398b67,_0x229d56){return new BPromise(function(_0x53b898,_0x154958){var _0x227a49=_0x229d56||client;return _0x227a49[_0x35fc('0x1b')](_0x5eac0f,_0x398b67)['then'](function(_0x26ba54){logger[_0x35fc('0x1c')]('ZendeskConfiguration,\x20%s,\x20%s',_0x558364,_0x35fc('0x1d'));logger[_0x35fc('0x1e')](_0x35fc('0x1f'),_0x558364,'request\x20sent',JSON[_0x35fc('0x20')](_0x26ba54));if(_0x26ba54[_0x35fc('0x21')]){if(_0x26ba54[_0x35fc('0x21')]['code']===0x1f4){logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x154958(_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);}logger[_0x35fc('0x21')](_0x35fc('0x22'),_0x558364,_0x26ba54[_0x35fc('0x21')][_0x35fc('0x23')]);return _0x53b898(_0x26ba54['error'][_0x35fc('0x23')]);}else{logger[_0x35fc('0x1c')](_0x35fc('0x22'),_0x558364,_0x35fc('0x1d'));_0x53b898(_0x26ba54[_0x35fc('0x24')]['message']);}})[_0x35fc('0x25')](function(_0x4c587a){logger['error'](_0x35fc('0x22'),_0x558364,_0x4c587a);_0x154958(_0x4c587a);});});}function respondWithStatusCode(_0x5a93df,_0x3d4a98){_0x3d4a98=_0x3d4a98||0xcc;return function(_0x51cfec){if(_0x51cfec){return _0x5a93df[_0x35fc('0x26')](_0x3d4a98);}return _0x5a93df['status'](_0x3d4a98)[_0x35fc('0x27')]();};}function respondWithResult(_0xdfab9f,_0x5cb986){_0x5cb986=_0x5cb986||0xc8;return function(_0x519264){if(_0x519264){return _0xdfab9f[_0x35fc('0x28')](_0x5cb986)['json'](_0x519264);}};}function respondWithFilteredResult(_0x274208,_0x1a5d92){return function(_0x57001c){if(_0x57001c){var _0x26b7cb=_0x57001c[_0x35fc('0x29')],_0x645eac=_0x1a5d92[_0x35fc('0x2a')],_0x383837=_0x1a5d92[_0x35fc('0x2a')]+_0x1a5d92[_0x35fc('0x2b')],_0x9f3c8a;if(_0x383837>=_0x26b7cb){_0x383837=_0x26b7cb;_0x9f3c8a=0xc8;}else{_0x9f3c8a=0xce;}_0x274208['status'](_0x9f3c8a);return _0x274208[_0x35fc('0x2c')](_0x35fc('0x2d'),_0x645eac+'-'+_0x383837+'/'+_0x26b7cb)[_0x35fc('0x2e')](_0x57001c);}return null;};}function patchUpdates(_0x52acc5){return function(_0xe79f52){try{jsonpatch[_0x35fc('0x2f')](_0xe79f52,_0x52acc5,!![]);}catch(_0x3822a8){return BPromise[_0x35fc('0x30')](_0x3822a8);}return _0xe79f52[_0x35fc('0x31')]();};}function saveUpdates(_0x103181,_0x222ddb){return function(_0x37b435){if(_0x37b435){return _0x37b435[_0x35fc('0x32')](_0x103181)[_0x35fc('0x33')](function(_0x57072d){return _0x57072d;});}return null;};}function removeEntity(_0x5e0313,_0x114bc1){return function(_0x4af5fe){if(_0x4af5fe){return _0x4af5fe[_0x35fc('0x34')]()[_0x35fc('0x33')](function(){_0x5e0313[_0x35fc('0x28')](0xcc)[_0x35fc('0x27')]();});}};}function handleEntityNotFound(_0x271ba9,_0x12e78f){return function(_0x4e43b4){if(!_0x4e43b4){_0x271ba9[_0x35fc('0x26')](0x194);}return _0x4e43b4;};}function handleError(_0x330a14,_0x46b9ef){_0x46b9ef=_0x46b9ef||0x1f4;return function(_0x4441d8){logger[_0x35fc('0x21')](_0x4441d8[_0x35fc('0x35')]);if(_0x4441d8['name']){delete _0x4441d8[_0x35fc('0x36')];}_0x330a14[_0x35fc('0x28')](_0x46b9ef)[_0x35fc('0x37')](_0x4441d8);};}exports['index']=function(_0x2c657d,_0x48d223){var _0x2ecb2e={},_0x33a377={},_0x266a11={'count':0x0,'rows':[]};var _0x2e00e3=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x20f5fe){return{'name':_0x20f5fe['fieldName'],'type':_0x20f5fe[_0x35fc('0x38')]['key']};});_0x33a377[_0x35fc('0x39')]=_[_0x35fc('0x3a')](_0x2e00e3,_0x35fc('0x36'));_0x33a377[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2c657d[_0x35fc('0x3b')]);_0x33a377[_0x35fc('0x3d')]=_['intersection'](_0x33a377[_0x35fc('0x39')],_0x33a377[_0x35fc('0x3b')]);_0x2ecb2e['attributes']=_[_0x35fc('0x3e')](_0x33a377[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x2ecb2e[_0x35fc('0x40')]=_0x2ecb2e['attributes'][_0x35fc('0x41')]?_0x2ecb2e[_0x35fc('0x40')]:_0x33a377[_0x35fc('0x39')];if(!_0x2c657d['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x2ecb2e['limit']=qs[_0x35fc('0x2b')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x2ecb2e[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x2a')]);}_0x2ecb2e[_0x35fc('0x44')]=qs['sort'](_0x2c657d['query'][_0x35fc('0x45')]);_0x2ecb2e[_0x35fc('0x46')]=qs['filters'](_['pick'](_0x2c657d['query'],_0x33a377[_0x35fc('0x3d')]));if(_0x2c657d[_0x35fc('0x3b')]['filter']){_0x2ecb2e[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x2ecb2e[_0x35fc('0x46')],{'$or':_[_0x35fc('0x3a')](_0x2e00e3,function(_0x5c52be){if(_0x5c52be['type']!=='VIRTUAL'){var _0x539157={};_0x539157[_0x5c52be['name']]={'$like':'%'+_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x539157;}})});}_0x2ecb2e=_['merge']({},_0x2ecb2e,_0x2c657d[_0x35fc('0x49')]);var _0x56cf1f={'where':_0x2ecb2e[_0x35fc('0x46')]};return db[_0x35fc('0x4a')][_0x35fc('0x29')](_0x56cf1f)[_0x35fc('0x33')](function(_0x16f7c8){_0x266a11['count']=_0x16f7c8;if(_0x2c657d[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x2ecb2e['include']=[{'all':!![]}];}return db[_0x35fc('0x4a')][_0x35fc('0x4c')](_0x2ecb2e);})[_0x35fc('0x33')](function(_0x211746){_0x266a11['rows']=_0x211746;return _0x266a11;})[_0x35fc('0x33')](respondWithFilteredResult(_0x48d223,_0x2ecb2e))['catch'](handleError(_0x48d223,null));};exports['show']=function(_0x1b6160,_0x9db7e8){var _0x18dc78={'raw':![],'where':{'id':_0x1b6160[_0x35fc('0x4d')]['id']}},_0xca8aef={};_0xca8aef[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x4a')]['rawAttributes']);_0xca8aef[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x1b6160[_0x35fc('0x3b')]);_0xca8aef[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],_0xca8aef[_0x35fc('0x3b')]);_0x18dc78[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0xca8aef[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x18dc78[_0x35fc('0x40')]=_0x18dc78['attributes']['length']?_0x18dc78[_0x35fc('0x40')]:_0xca8aef[_0x35fc('0x39')];if(_0x1b6160[_0x35fc('0x3b')][_0x35fc('0x4b')]){_0x18dc78[_0x35fc('0x4e')]=[{'all':!![]}];}_0x18dc78=_[_0x35fc('0x47')]({},_0x18dc78,_0x1b6160['options']);return db['ZendeskConfiguration'][_0x35fc('0x4f')](_0x18dc78)[_0x35fc('0x33')](handleEntityNotFound(_0x9db7e8,null))[_0x35fc('0x33')](respondWithResult(_0x9db7e8,null))[_0x35fc('0x25')](handleError(_0x9db7e8,null));};exports['create']=function(_0x467980,_0x13281f){return db['ZendeskConfiguration'][_0x35fc('0x50')](_0x467980[_0x35fc('0x51')],{})['then'](respondWithResult(_0x13281f,0xc9))[_0x35fc('0x25')](handleError(_0x13281f,null));};exports[_0x35fc('0x32')]=function(_0x26118e,_0x18f18b){if(_0x26118e['body']['id']){delete _0x26118e['body']['id'];}return db['ZendeskConfiguration'][_0x35fc('0x4f')]({'where':{'id':_0x26118e[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x18f18b,null))[_0x35fc('0x33')](saveUpdates(_0x26118e[_0x35fc('0x51')],null))[_0x35fc('0x33')](respondWithResult(_0x18f18b,null))[_0x35fc('0x25')](handleError(_0x18f18b,null));};exports[_0x35fc('0x34')]=function(_0x538be0,_0x2d9d45){return db[_0x35fc('0x4a')][_0x35fc('0x4f')]({'where':{'id':_0x538be0['params']['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x2d9d45,null))[_0x35fc('0x33')](removeEntity(_0x2d9d45,null))['catch'](handleError(_0x2d9d45,null));};exports[_0x35fc('0x52')]=function(_0x164c7b,_0x1c46b1,_0x1c4c33){var _0x314666={};var _0x41453b={};var _0x8501d1;var _0x998fd9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x164c7b[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x1c46b1,null))['then'](function(_0x243871){if(_0x243871){_0x8501d1=_0x243871;_0x41453b['model']=_['keys'](db['ZendeskField'][_0x35fc('0x54')]);_0x41453b[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x164c7b[_0x35fc('0x3b')]);_0x41453b[_0x35fc('0x3d')]=_['intersection'](_0x41453b['model'],_0x41453b['query']);_0x314666['attributes']=_['intersection'](_0x41453b[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x314666['attributes']=_0x314666[_0x35fc('0x40')][_0x35fc('0x41')]?_0x314666[_0x35fc('0x40')]:_0x41453b[_0x35fc('0x39')];_0x314666[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x314666[_0x35fc('0x46')]=qs['filters'](_[_0x35fc('0x55')](_0x164c7b['query'],_0x41453b[_0x35fc('0x3d')]));if(_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x314666[_0x35fc('0x46')]=_['merge'](_0x314666[_0x35fc('0x46')],{'$or':_['map'](_0x314666['attributes'],function(_0x5f1d4a){var _0x10dd1a={};_0x10dd1a[_0x5f1d4a]={'$like':'%'+_0x164c7b['query'][_0x35fc('0x48')]+'%'};return _0x10dd1a;})});}_0x314666=_['merge']({},_0x314666,_0x164c7b[_0x35fc('0x49')]);return _0x8501d1['getFields'](_0x314666);}})[_0x35fc('0x33')](function(_0x455b84){if(_0x455b84){_0x998fd9=_0x455b84[_0x35fc('0x41')];if(!_0x164c7b[_0x35fc('0x3b')]['hasOwnProperty'](_0x35fc('0x43'))){_0x314666[_0x35fc('0x2b')]=qs[_0x35fc('0x2b')](_0x164c7b['query'][_0x35fc('0x2b')]);_0x314666[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x164c7b[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x8501d1[_0x35fc('0x52')](_0x314666);}})[_0x35fc('0x33')](function(_0x4464d5){if(_0x4464d5){return _0x4464d5?{'count':_0x998fd9,'rows':_0x4464d5}:null;}})['then'](respondWithResult(_0x1c46b1,null))[_0x35fc('0x25')](handleError(_0x1c46b1,null));};exports[_0x35fc('0x56')]=function(_0x2600d2,_0x4a926d,_0x1c88d8){var _0x1b76f0={};var _0x586729={};var _0x4d09d4;var _0x3969d3;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x2600d2[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x4a926d,null))[_0x35fc('0x33')](function(_0x1932c9){if(_0x1932c9){_0x4d09d4=_0x1932c9;_0x586729[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x586729[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x2600d2[_0x35fc('0x3b')]);_0x586729[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],_0x586729[_0x35fc('0x3b')]);_0x1b76f0[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x586729[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x2600d2['query'][_0x35fc('0x3f')]));_0x1b76f0['attributes']=_0x1b76f0[_0x35fc('0x40')][_0x35fc('0x41')]?_0x1b76f0[_0x35fc('0x40')]:_0x586729[_0x35fc('0x39')];_0x1b76f0[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1b76f0[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x2600d2['query'],_0x586729[_0x35fc('0x3d')]));if(_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x1b76f0[_0x35fc('0x46')]=_[_0x35fc('0x47')](_0x1b76f0[_0x35fc('0x46')],{'$or':_['map'](_0x1b76f0[_0x35fc('0x40')],function(_0x3353e0){var _0x277514={};_0x277514[_0x3353e0]={'$like':'%'+_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x277514;})});}_0x1b76f0=_[_0x35fc('0x47')]({},_0x1b76f0,_0x2600d2[_0x35fc('0x49')]);return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5f23d8){if(_0x5f23d8){_0x3969d3=_0x5f23d8[_0x35fc('0x41')];if(!_0x2600d2['query'][_0x35fc('0x42')](_0x35fc('0x43'))){_0x1b76f0['limit']=qs[_0x35fc('0x2b')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1b76f0[_0x35fc('0x2a')]=qs[_0x35fc('0x2a')](_0x2600d2[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4d09d4[_0x35fc('0x56')](_0x1b76f0);}})[_0x35fc('0x33')](function(_0x5806bf){if(_0x5806bf){return _0x5806bf?{'count':_0x3969d3,'rows':_0x5806bf}:null;}})['then'](respondWithResult(_0x4a926d,null))['catch'](handleError(_0x4a926d,null));};exports['getDescriptions']=function(_0x160a6f,_0x23cf84,_0x8fc410){var _0x1f5cbc={};var _0x35ef53={};var _0x4f535a;var _0x226fdf;return db[_0x35fc('0x4a')][_0x35fc('0x53')]({'where':{'id':_0x160a6f[_0x35fc('0x4d')]['id']}})['then'](handleEntityNotFound(_0x23cf84,null))[_0x35fc('0x33')](function(_0x3ddd21){if(_0x3ddd21){_0x4f535a=_0x3ddd21;_0x35ef53[_0x35fc('0x39')]=_['keys'](db[_0x35fc('0x57')][_0x35fc('0x54')]);_0x35ef53[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x160a6f[_0x35fc('0x3b')]);_0x35ef53[_0x35fc('0x3d')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],_0x35ef53['query']);_0x1f5cbc[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x35ef53[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x1f5cbc['attributes']=_0x1f5cbc[_0x35fc('0x40')]['length']?_0x1f5cbc['attributes']:_0x35ef53[_0x35fc('0x39')];_0x1f5cbc['order']=qs[_0x35fc('0x45')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x45')]);_0x1f5cbc['where']=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x160a6f[_0x35fc('0x3b')],_0x35ef53[_0x35fc('0x3d')]));if(_0x160a6f[_0x35fc('0x3b')]['filter']){_0x1f5cbc['where']=_['merge'](_0x1f5cbc[_0x35fc('0x46')],{'$or':_['map'](_0x1f5cbc[_0x35fc('0x40')],function(_0x1824c2){var _0x391321={};_0x391321[_0x1824c2]={'$like':'%'+_0x160a6f[_0x35fc('0x3b')]['filter']+'%'};return _0x391321;})});}_0x1f5cbc=_[_0x35fc('0x47')]({},_0x1f5cbc,_0x160a6f[_0x35fc('0x49')]);return _0x4f535a[_0x35fc('0x58')](_0x1f5cbc);}})['then'](function(_0x128286){if(_0x128286){_0x226fdf=_0x128286[_0x35fc('0x41')];if(!_0x160a6f[_0x35fc('0x3b')]['hasOwnProperty']('nolimit')){_0x1f5cbc['limit']=qs[_0x35fc('0x2b')](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x1f5cbc[_0x35fc('0x2a')]=qs['offset'](_0x160a6f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x4f535a['getDescriptions'](_0x1f5cbc);}})['then'](function(_0x143c94){if(_0x143c94){return _0x143c94?{'count':_0x226fdf,'rows':_0x143c94}:null;}})[_0x35fc('0x33')](respondWithResult(_0x23cf84,null))[_0x35fc('0x25')](handleError(_0x23cf84,null));};exports['getTags']=function(_0x4dd05f,_0x134e60,_0x432ba4){var _0x4d5204={};var _0x3439de={};var _0x163edb;var _0x1d96c9;return db['ZendeskConfiguration'][_0x35fc('0x53')]({'where':{'id':_0x4dd05f[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x134e60,null))[_0x35fc('0x33')](function(_0x4fd676){if(_0x4fd676){_0x163edb=_0x4fd676;_0x3439de[_0x35fc('0x39')]=_[_0x35fc('0x3c')](db[_0x35fc('0x59')]['rawAttributes']);_0x3439de[_0x35fc('0x3b')]=_[_0x35fc('0x3c')](_0x4dd05f[_0x35fc('0x3b')]);_0x3439de['filters']=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],_0x3439de['query']);_0x4d5204[_0x35fc('0x40')]=_[_0x35fc('0x3e')](_0x3439de[_0x35fc('0x39')],qs[_0x35fc('0x3f')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x3f')]));_0x4d5204[_0x35fc('0x40')]=_0x4d5204[_0x35fc('0x40')][_0x35fc('0x41')]?_0x4d5204['attributes']:_0x3439de[_0x35fc('0x39')];_0x4d5204[_0x35fc('0x44')]=qs[_0x35fc('0x45')](_0x4dd05f[_0x35fc('0x3b')]['sort']);_0x4d5204[_0x35fc('0x46')]=qs[_0x35fc('0x3d')](_[_0x35fc('0x55')](_0x4dd05f[_0x35fc('0x3b')],_0x3439de[_0x35fc('0x3d')]));if(_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]){_0x4d5204[_0x35fc('0x46')]=_['merge'](_0x4d5204['where'],{'$or':_[_0x35fc('0x3a')](_0x4d5204[_0x35fc('0x40')],function(_0x961ee9){var _0x4ebf4a={};_0x4ebf4a[_0x961ee9]={'$like':'%'+_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x48')]+'%'};return _0x4ebf4a;})});}_0x4d5204=_[_0x35fc('0x47')]({},_0x4d5204,_0x4dd05f[_0x35fc('0x49')]);return _0x163edb['getTags'](_0x4d5204);}})['then'](function(_0x379650){if(_0x379650){_0x1d96c9=_0x379650['length'];if(!_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x42')]('nolimit')){_0x4d5204['limit']=qs[_0x35fc('0x2b')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2b')]);_0x4d5204['offset']=qs[_0x35fc('0x2a')](_0x4dd05f[_0x35fc('0x3b')][_0x35fc('0x2a')]);}return _0x163edb['getTags'](_0x4d5204);}})[_0x35fc('0x33')](function(_0x32cbd){if(_0x32cbd){return _0x32cbd?{'count':_0x1d96c9,'rows':_0x32cbd}:null;}})[_0x35fc('0x33')](respondWithResult(_0x134e60,null))[_0x35fc('0x25')](handleError(_0x134e60,null));};exports['setTags']=function(_0x451cb8,_0x347e06,_0x6f8054){if(_0x451cb8[_0x35fc('0x51')]['id']){delete _0x451cb8[_0x35fc('0x51')]['id'];}return db[_0x35fc('0x4a')]['findOne']({'where':{'id':_0x451cb8[_0x35fc('0x4d')]['id']}})[_0x35fc('0x33')](handleEntityNotFound(_0x347e06,null))['then'](function(_0x4c3253){if(_0x4c3253){return _0x4c3253[_0x35fc('0x5a')](_0x451cb8['body'][_0x35fc('0x5b')]||[]);}return null;})[_0x35fc('0x33')](respondWithResult(_0x347e06,null))[_0x35fc('0x25')](handleError(_0x347e06,null));}; \ No newline at end of file +var _0xc4aa=['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','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','sendStatus','status','end','json','offset','limit','Content-Range','apply','reject','update','destroy','stack','send','index','map','ZendeskConfiguration','fieldName','type','model','keys','query','attributes','intersection','fields','length','order','sort','where','filters','pick','filter','merge','VIRTUAL','name','options','count','includeAll','rows','show','rawAttributes','include','create','body','find','params','getFields','ZendeskField','getSubjects','hasOwnProperty','nolimit','getDescriptions','findOne','getTags','setTags','ids','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','jayson/promise','client','test','Sequelize'];(function(_0x539533,_0x59b89b){var _0x3942f3=function(_0x3b386c){while(--_0x3b386c){_0x539533['push'](_0x539533['shift']());}};_0x3942f3(++_0x59b89b);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];var jayson=require(_0xac4a('0x16'));var client=jayson[_0xac4a('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x21a79,_0x68424a,_0x247b78){if(_0x247b78){var _0x6e00d4=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x6e00d4[_0xac4a('0x18')](_0x68424a)){return _0x21a79;}else{throw new db[(_0xac4a('0x19'))][(_0xac4a('0x1a'))](_0xac4a('0x1b'));}}else{return _0x21a79;}}function respondWithRpcPromise(_0x190418,_0x42c7fc,_0x11e101,_0x26dbb8){return new BPromise(function(_0x4a2119,_0x402fff){var _0x34d797=_0x26dbb8||client;return _0x34d797[_0xac4a('0x1c')](_0x190418,_0x11e101)[_0xac4a('0x1d')](function(_0x3e88e3){logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));logger['debug']('ZendeskConfiguration,\x20%s,\x20%s,\x20%s',_0x42c7fc,_0xac4a('0x20'),JSON[_0xac4a('0x21')](_0x3e88e3));if(_0x3e88e3[_0xac4a('0x22')]){if(_0x3e88e3['error'][_0xac4a('0x23')]===0x1f4){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x402fff(_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);}logger[_0xac4a('0x22')]('ZendeskConfiguration,\x20%s,\x20%s',_0x42c7fc,_0x3e88e3[_0xac4a('0x22')][_0xac4a('0x24')]);return _0x4a2119(_0x3e88e3['error'][_0xac4a('0x24')]);}else{logger[_0xac4a('0x1e')](_0xac4a('0x1f'),_0x42c7fc,_0xac4a('0x20'));_0x4a2119(_0x3e88e3['result'][_0xac4a('0x24')]);}})[_0xac4a('0x25')](function(_0x15435c){logger[_0xac4a('0x22')](_0xac4a('0x1f'),_0x42c7fc,_0x15435c);_0x402fff(_0x15435c);});});}function respondWithStatusCode(_0x2b0dc2,_0x222507){_0x222507=_0x222507||0xcc;return function(_0x36054a){if(_0x36054a){return _0x2b0dc2[_0xac4a('0x26')](_0x222507);}return _0x2b0dc2[_0xac4a('0x27')](_0x222507)[_0xac4a('0x28')]();};}function respondWithResult(_0x215a31,_0x14832b){_0x14832b=_0x14832b||0xc8;return function(_0x472c57){if(_0x472c57){return _0x215a31[_0xac4a('0x27')](_0x14832b)[_0xac4a('0x29')](_0x472c57);}};}function respondWithFilteredResult(_0x4e17ce,_0x23b061){return function(_0x267a22){if(_0x267a22){var _0x42a33c=_0x267a22['count'],_0x2772fe=_0x23b061[_0xac4a('0x2a')],_0x116700=_0x23b061[_0xac4a('0x2a')]+_0x23b061[_0xac4a('0x2b')],_0x4a5a9e;if(_0x116700>=_0x42a33c){_0x116700=_0x42a33c;_0x4a5a9e=0xc8;}else{_0x4a5a9e=0xce;}_0x4e17ce['status'](_0x4a5a9e);return _0x4e17ce['set'](_0xac4a('0x2c'),_0x2772fe+'-'+_0x116700+'/'+_0x42a33c)[_0xac4a('0x29')](_0x267a22);}return null;};}function patchUpdates(_0x228629){return function(_0x432066){try{jsonpatch[_0xac4a('0x2d')](_0x432066,_0x228629,!![]);}catch(_0x53d3a5){return BPromise[_0xac4a('0x2e')](_0x53d3a5);}return _0x432066['save']();};}function saveUpdates(_0x30364b,_0x57adcf){return function(_0x17e6de){if(_0x17e6de){return _0x17e6de[_0xac4a('0x2f')](_0x30364b)[_0xac4a('0x1d')](function(_0x228aa7){return _0x228aa7;});}return null;};}function removeEntity(_0x34577f,_0x61e552){return function(_0xbd4591){if(_0xbd4591){return _0xbd4591[_0xac4a('0x30')]()[_0xac4a('0x1d')](function(){_0x34577f[_0xac4a('0x27')](0xcc)[_0xac4a('0x28')]();});}};}function handleEntityNotFound(_0x1634df,_0x1a9be2){return function(_0x1a9d4e){if(!_0x1a9d4e){_0x1634df['sendStatus'](0x194);}return _0x1a9d4e;};}function handleError(_0x30442d,_0x1c41fb){_0x1c41fb=_0x1c41fb||0x1f4;return function(_0x5a4e2b){logger[_0xac4a('0x22')](_0x5a4e2b[_0xac4a('0x31')]);if(_0x5a4e2b['name']){delete _0x5a4e2b['name'];}_0x30442d[_0xac4a('0x27')](_0x1c41fb)[_0xac4a('0x32')](_0x5a4e2b);};}exports[_0xac4a('0x33')]=function(_0x3de9e2,_0x4f5986){var _0x453d02={},_0x2e56c6={},_0x4e7630={'count':0x0,'rows':[]};var _0x37f2ee=_[_0xac4a('0x34')](db[_0xac4a('0x35')]['rawAttributes'],function(_0x121328){return{'name':_0x121328[_0xac4a('0x36')],'type':_0x121328[_0xac4a('0x37')]['key']};});_0x2e56c6[_0xac4a('0x38')]=_[_0xac4a('0x34')](_0x37f2ee,'name');_0x2e56c6['query']=_[_0xac4a('0x39')](_0x3de9e2['query']);_0x2e56c6['filters']=_['intersection'](_0x2e56c6['model'],_0x2e56c6[_0xac4a('0x3a')]);_0x453d02[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x2e56c6[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x453d02[_0xac4a('0x3b')]=_0x453d02[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x453d02[_0xac4a('0x3b')]:_0x2e56c6[_0xac4a('0x38')];if(!_0x3de9e2['query']['hasOwnProperty']('nolimit')){_0x453d02[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x453d02[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x2a')]);}_0x453d02[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x3de9e2['query'][_0xac4a('0x40')]);_0x453d02[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x3de9e2[_0xac4a('0x3a')],_0x2e56c6['filters']));if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x453d02['where']=_[_0xac4a('0x45')](_0x453d02['where'],{'$or':_[_0xac4a('0x34')](_0x37f2ee,function(_0x65494e){if(_0x65494e[_0xac4a('0x37')]!==_0xac4a('0x46')){var _0x520e4a={};_0x520e4a[_0x65494e[_0xac4a('0x47')]]={'$like':'%'+_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x520e4a;}})});}_0x453d02=_[_0xac4a('0x45')]({},_0x453d02,_0x3de9e2[_0xac4a('0x48')]);var _0x4fa9eb={'where':_0x453d02[_0xac4a('0x41')]};return db['ZendeskConfiguration'][_0xac4a('0x49')](_0x4fa9eb)[_0xac4a('0x1d')](function(_0xeca4e9){_0x4e7630['count']=_0xeca4e9;if(_0x3de9e2[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x453d02['include']=[{'all':!![]}];}return db[_0xac4a('0x35')]['findAll'](_0x453d02);})[_0xac4a('0x1d')](function(_0xe620f6){_0x4e7630[_0xac4a('0x4b')]=_0xe620f6;return _0x4e7630;})['then'](respondWithFilteredResult(_0x4f5986,_0x453d02))['catch'](handleError(_0x4f5986,null));};exports[_0xac4a('0x4c')]=function(_0x4aaeff,_0x18ae96){var _0x566258={'raw':![],'where':{'id':_0x4aaeff['params']['id']}},_0x3d2aaf={};_0x3d2aaf[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x35')][_0xac4a('0x4d')]);_0x3d2aaf['query']=_[_0xac4a('0x39')](_0x4aaeff[_0xac4a('0x3a')]);_0x3d2aaf[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x3d2aaf[_0xac4a('0x38')],_0x3d2aaf[_0xac4a('0x3a')]);_0x566258[_0xac4a('0x3b')]=_['intersection'](_0x3d2aaf[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x4aaeff['query'][_0xac4a('0x3d')]));_0x566258[_0xac4a('0x3b')]=_0x566258[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x566258['attributes']:_0x3d2aaf[_0xac4a('0x38')];if(_0x4aaeff[_0xac4a('0x3a')][_0xac4a('0x4a')]){_0x566258[_0xac4a('0x4e')]=[{'all':!![]}];}_0x566258=_[_0xac4a('0x45')]({},_0x566258,_0x4aaeff['options']);return db[_0xac4a('0x35')]['find'](_0x566258)[_0xac4a('0x1d')](handleEntityNotFound(_0x18ae96,null))[_0xac4a('0x1d')](respondWithResult(_0x18ae96,null))['catch'](handleError(_0x18ae96,null));};exports['create']=function(_0x437466,_0x70fdc3){return db['ZendeskConfiguration'][_0xac4a('0x4f')](_0x437466[_0xac4a('0x50')],{})[_0xac4a('0x1d')](respondWithResult(_0x70fdc3,0xc9))[_0xac4a('0x25')](handleError(_0x70fdc3,null));};exports['update']=function(_0x3057d6,_0x108f7c){if(_0x3057d6[_0xac4a('0x50')]['id']){delete _0x3057d6[_0xac4a('0x50')]['id'];}return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x3057d6[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x108f7c,null))[_0xac4a('0x1d')](saveUpdates(_0x3057d6[_0xac4a('0x50')],null))[_0xac4a('0x1d')](respondWithResult(_0x108f7c,null))[_0xac4a('0x25')](handleError(_0x108f7c,null));};exports[_0xac4a('0x30')]=function(_0x2ac1e9,_0x213df2){return db[_0xac4a('0x35')][_0xac4a('0x51')]({'where':{'id':_0x2ac1e9[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x213df2,null))[_0xac4a('0x1d')](removeEntity(_0x213df2,null))[_0xac4a('0x25')](handleError(_0x213df2,null));};exports[_0xac4a('0x53')]=function(_0x5222f3,_0x11c753,_0x492aae){var _0x13a577={};var _0x479ebc={};var _0x2d598e;var _0x4b7f79;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x5222f3[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x11c753,null))['then'](function(_0x52c957){if(_0x52c957){_0x2d598e=_0x52c957;_0x479ebc[_0xac4a('0x38')]=_[_0xac4a('0x39')](db[_0xac4a('0x54')][_0xac4a('0x4d')]);_0x479ebc[_0xac4a('0x3a')]=_['keys'](_0x5222f3[_0xac4a('0x3a')]);_0x479ebc['filters']=_[_0xac4a('0x3c')](_0x479ebc['model'],_0x479ebc[_0xac4a('0x3a')]);_0x13a577[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x479ebc[_0xac4a('0x38')],qs[_0xac4a('0x3d')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x13a577[_0xac4a('0x3b')]=_0x13a577[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x13a577[_0xac4a('0x3b')]:_0x479ebc[_0xac4a('0x38')];_0x13a577[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x40')]);_0x13a577[_0xac4a('0x41')]=qs['filters'](_[_0xac4a('0x43')](_0x5222f3[_0xac4a('0x3a')],_0x479ebc['filters']));if(_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x13a577[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x13a577[_0xac4a('0x41')],{'$or':_['map'](_0x13a577['attributes'],function(_0x45f3c3){var _0x11bb54={};_0x11bb54[_0x45f3c3]={'$like':'%'+_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x11bb54;})});}_0x13a577=_[_0xac4a('0x45')]({},_0x13a577,_0x5222f3[_0xac4a('0x48')]);return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0x44c60b){if(_0x44c60b){_0x4b7f79=_0x44c60b[_0xac4a('0x3e')];if(!_0x5222f3[_0xac4a('0x3a')]['hasOwnProperty']('nolimit')){_0x13a577[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x13a577[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x5222f3[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x2d598e[_0xac4a('0x53')](_0x13a577);}})[_0xac4a('0x1d')](function(_0xb09b89){if(_0xb09b89){return _0xb09b89?{'count':_0x4b7f79,'rows':_0xb09b89}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x11c753,null))['catch'](handleError(_0x11c753,null));};exports[_0xac4a('0x55')]=function(_0xc74ce8,_0x26bd31,_0x231932){var _0x513976={};var _0xc61e94={};var _0x5a30af;var _0xab4305;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0xc74ce8['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x26bd31,null))[_0xac4a('0x1d')](function(_0x13097f){if(_0x13097f){_0x5a30af=_0x13097f;_0xc61e94['model']=_[_0xac4a('0x39')](db['ZendeskField'][_0xac4a('0x4d')]);_0xc61e94['query']=_['keys'](_0xc74ce8[_0xac4a('0x3a')]);_0xc61e94['filters']=_[_0xac4a('0x3c')](_0xc61e94['model'],_0xc61e94[_0xac4a('0x3a')]);_0x513976[_0xac4a('0x3b')]=_['intersection'](_0xc61e94[_0xac4a('0x38')],qs['fields'](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x513976['attributes']=_0x513976[_0xac4a('0x3b')]['length']?_0x513976['attributes']:_0xc61e94[_0xac4a('0x38')];_0x513976['order']=qs[_0xac4a('0x40')](_0xc74ce8['query']['sort']);_0x513976[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0xc74ce8['query'],_0xc61e94['filters']));if(_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x513976['where']=_['merge'](_0x513976[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x513976[_0xac4a('0x3b')],function(_0x36df3d){var _0x1810f7={};_0x1810f7[_0x36df3d]={'$like':'%'+_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x1810f7;})});}_0x513976=_[_0xac4a('0x45')]({},_0x513976,_0xc74ce8[_0xac4a('0x48')]);return _0x5a30af['getSubjects'](_0x513976);}})[_0xac4a('0x1d')](function(_0x440dc4){if(_0x440dc4){_0xab4305=_0x440dc4[_0xac4a('0x3e')];if(!_0xc74ce8['query'][_0xac4a('0x56')](_0xac4a('0x57'))){_0x513976[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0xc74ce8[_0xac4a('0x3a')]['limit']);_0x513976[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0xc74ce8[_0xac4a('0x3a')][_0xac4a('0x2a')]);}return _0x5a30af[_0xac4a('0x55')](_0x513976);}})[_0xac4a('0x1d')](function(_0xd7bdd6){if(_0xd7bdd6){return _0xd7bdd6?{'count':_0xab4305,'rows':_0xd7bdd6}:null;}})['then'](respondWithResult(_0x26bd31,null))[_0xac4a('0x25')](handleError(_0x26bd31,null));};exports[_0xac4a('0x58')]=function(_0x19bd6f,_0x35a97c,_0x1bb24d){var _0x171c47={};var _0x547eec={};var _0x318bee;var _0x29c772;return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x19bd6f['params']['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x35a97c,null))['then'](function(_0x4447b5){if(_0x4447b5){_0x318bee=_0x4447b5;_0x547eec[_0xac4a('0x38')]=_['keys'](db['ZendeskField'][_0xac4a('0x4d')]);_0x547eec[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x19bd6f['query']);_0x547eec[_0xac4a('0x42')]=_['intersection'](_0x547eec[_0xac4a('0x38')],_0x547eec[_0xac4a('0x3a')]);_0x171c47[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x547eec[_0xac4a('0x38')],qs['fields'](_0x19bd6f['query'][_0xac4a('0x3d')]));_0x171c47[_0xac4a('0x3b')]=_0x171c47[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x171c47[_0xac4a('0x3b')]:_0x547eec[_0xac4a('0x38')];_0x171c47[_0xac4a('0x3f')]=qs[_0xac4a('0x40')](_0x19bd6f['query']['sort']);_0x171c47[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_[_0xac4a('0x43')](_0x19bd6f[_0xac4a('0x3a')],_0x547eec[_0xac4a('0x42')]));if(_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]){_0x171c47[_0xac4a('0x41')]=_['merge'](_0x171c47['where'],{'$or':_[_0xac4a('0x34')](_0x171c47[_0xac4a('0x3b')],function(_0x22804e){var _0x371e06={};_0x371e06[_0x22804e]={'$like':'%'+_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x371e06;})});}_0x171c47=_[_0xac4a('0x45')]({},_0x171c47,_0x19bd6f['options']);return _0x318bee[_0xac4a('0x58')](_0x171c47);}})[_0xac4a('0x1d')](function(_0x3439f3){if(_0x3439f3){_0x29c772=_0x3439f3['length'];if(!_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x56')](_0xac4a('0x57'))){_0x171c47[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x19bd6f[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x171c47[_0xac4a('0x2a')]=qs[_0xac4a('0x2a')](_0x19bd6f['query'][_0xac4a('0x2a')]);}return _0x318bee['getDescriptions'](_0x171c47);}})[_0xac4a('0x1d')](function(_0x1199f6){if(_0x1199f6){return _0x1199f6?{'count':_0x29c772,'rows':_0x1199f6}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x35a97c,null))[_0xac4a('0x25')](handleError(_0x35a97c,null));};exports[_0xac4a('0x5a')]=function(_0x337da7,_0x19766a,_0x5266d3){var _0x2b883a={};var _0x42b3f7={};var _0x279f9b;var _0x3315e7;return db[_0xac4a('0x35')]['findOne']({'where':{'id':_0x337da7[_0xac4a('0x52')]['id']}})[_0xac4a('0x1d')](handleEntityNotFound(_0x19766a,null))['then'](function(_0x55af32){if(_0x55af32){_0x279f9b=_0x55af32;_0x42b3f7[_0xac4a('0x38')]=_[_0xac4a('0x39')](db['Tag'][_0xac4a('0x4d')]);_0x42b3f7[_0xac4a('0x3a')]=_[_0xac4a('0x39')](_0x337da7[_0xac4a('0x3a')]);_0x42b3f7[_0xac4a('0x42')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],_0x42b3f7[_0xac4a('0x3a')]);_0x2b883a[_0xac4a('0x3b')]=_[_0xac4a('0x3c')](_0x42b3f7['model'],qs[_0xac4a('0x3d')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x3d')]));_0x2b883a[_0xac4a('0x3b')]=_0x2b883a[_0xac4a('0x3b')][_0xac4a('0x3e')]?_0x2b883a['attributes']:_0x42b3f7[_0xac4a('0x38')];_0x2b883a[_0xac4a('0x3f')]=qs['sort'](_0x337da7[_0xac4a('0x3a')]['sort']);_0x2b883a[_0xac4a('0x41')]=qs[_0xac4a('0x42')](_['pick'](_0x337da7[_0xac4a('0x3a')],_0x42b3f7['filters']));if(_0x337da7[_0xac4a('0x3a')]['filter']){_0x2b883a[_0xac4a('0x41')]=_[_0xac4a('0x45')](_0x2b883a[_0xac4a('0x41')],{'$or':_[_0xac4a('0x34')](_0x2b883a[_0xac4a('0x3b')],function(_0x36d8ff){var _0x7e403a={};_0x7e403a[_0x36d8ff]={'$like':'%'+_0x337da7[_0xac4a('0x3a')][_0xac4a('0x44')]+'%'};return _0x7e403a;})});}_0x2b883a=_[_0xac4a('0x45')]({},_0x2b883a,_0x337da7[_0xac4a('0x48')]);return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x4217df){if(_0x4217df){_0x3315e7=_0x4217df['length'];if(!_0x337da7[_0xac4a('0x3a')][_0xac4a('0x56')]('nolimit')){_0x2b883a[_0xac4a('0x2b')]=qs[_0xac4a('0x2b')](_0x337da7[_0xac4a('0x3a')][_0xac4a('0x2b')]);_0x2b883a[_0xac4a('0x2a')]=qs['offset'](_0x337da7[_0xac4a('0x3a')]['offset']);}return _0x279f9b[_0xac4a('0x5a')](_0x2b883a);}})[_0xac4a('0x1d')](function(_0x240ff1){if(_0x240ff1){return _0x240ff1?{'count':_0x3315e7,'rows':_0x240ff1}:null;}})[_0xac4a('0x1d')](respondWithResult(_0x19766a,null))['catch'](handleError(_0x19766a,null));};exports[_0xac4a('0x5b')]=function(_0x55866d,_0x277fd1,_0x40d363){if(_0x55866d[_0xac4a('0x50')]['id']){delete _0x55866d['body']['id'];}return db[_0xac4a('0x35')][_0xac4a('0x59')]({'where':{'id':_0x55866d[_0xac4a('0x52')]['id']}})['then'](handleEntityNotFound(_0x277fd1,null))[_0xac4a('0x1d')](function(_0x25639a){if(_0x25639a){return _0x25639a[_0xac4a('0x5b')](_0x55866d[_0xac4a('0x50')][_0xac4a('0x5c')]||[]);}return null;})[_0xac4a('0x1d')](respondWithResult(_0x277fd1,null))[_0xac4a('0x25')](handleError(_0x277fd1,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index d68232f..1f8e83f 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 _0xa73b=['../../config/logger','bluebird','path','rimraf','exports','define','ZendeskConfiguration','lodash','util'];(function(_0x446731,_0x4115d9){var _0x27a3ea=function(_0xf8a18){while(--_0xf8a18){_0x446731['push'](_0x446731['shift']());}};_0x27a3ea(++_0x4115d9);}(_0xa73b,0xfa));var _0xba73=function(_0x12ae4c,_0x455af7){_0x12ae4c=_0x12ae4c-0x0;var _0x250cb5=_0xa73b[_0x12ae4c];return _0x250cb5;};'use strict';var _=require(_0xba73('0x0'));var util=require(_0xba73('0x1'));var logger=require(_0xba73('0x2'))('api');var moment=require('moment');var BPromise=require(_0xba73('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xba73('0x4'));var rimraf=require(_0xba73('0x5'));var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module[_0xba73('0x6')]=function(_0x288fc3,_0x3a333d){return _0x288fc3[_0xba73('0x7')](_0xba73('0x8'),attributes,{'tableName':'int_zendesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd561=['../../config/environment','exports','ZendeskConfiguration','int_zendesk_configurations','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xd561,0x176));var _0x1d56=function(_0x5c55f7,_0x5f045b){_0x5c55f7=_0x5c55f7-0x0;var _0x3db286=_0xd561[_0x5c55f7];return _0x3db286;};'use strict';var _=require(_0x1d56('0x0'));var util=require(_0x1d56('0x1'));var logger=require(_0x1d56('0x2'))(_0x1d56('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x1d56('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d56('0x5'));var config=require(_0x1d56('0x6'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x1d56('0x7')]=function(_0x482611,_0x360419){return _0x482611['define'](_0x1d56('0x8'),attributes,{'tableName':_0x1d56('0x9'),'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 6318785..4cd5d89 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 _0x581f=['then','info','ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xfec150,_0x339032){var _0x408278=function(_0x4f5aa9){while(--_0x4f5aa9){_0xfec150['push'](_0xfec150['shift']());}};_0x408278(++_0x339032);}(_0x581f,0x1a3));var _0xf581=function(_0xa743a6,_0x5b645a){_0xa743a6=_0xa743a6-0x0;var _0x24321c=_0x581f[_0xa743a6];return _0x24321c;};'use strict';var _=require(_0xf581('0x0'));var util=require('util');var moment=require(_0xf581('0x1'));var BPromise=require('bluebird');var rs=require(_0xf581('0x2'));var fs=require('fs');var Redis=require(_0xf581('0x3'));var db=require(_0xf581('0x4'))['db'];var utils=require(_0xf581('0x5'));var logger=require(_0xf581('0x6'))(_0xf581('0x7'));var config=require(_0xf581('0x8'));var jayson=require(_0xf581('0x9'));var client=jayson[_0xf581('0xa')][_0xf581('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5eed2f,_0xafa594,_0x2b1fa6){return new BPromise(function(_0x51ecfd,_0x538667){return client[_0xf581('0xc')](_0x5eed2f,_0x2b1fa6)[_0xf581('0xd')](function(_0x565a1b){logger[_0xf581('0xe')](_0xf581('0xf'),_0xafa594,_0xf581('0x10'));logger[_0xf581('0x11')](_0xf581('0x12'),_0xafa594,_0xf581('0x10'),JSON[_0xf581('0x13')](_0x565a1b));if(_0x565a1b[_0xf581('0x14')]){if(_0x565a1b[_0xf581('0x14')]['code']===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0xafa594,_0x565a1b[_0xf581('0x14')][_0xf581('0x15')]);return _0x538667(_0x565a1b[_0xf581('0x14')][_0xf581('0x15')]);}logger[_0xf581('0x14')](_0xf581('0xf'),_0xafa594,_0x565a1b[_0xf581('0x14')]['message']);return _0x51ecfd(_0x565a1b[_0xf581('0x14')][_0xf581('0x15')]);}else{logger[_0xf581('0xe')](_0xf581('0xf'),_0xafa594,_0xf581('0x10'));_0x51ecfd(_0x565a1b[_0xf581('0x16')][_0xf581('0x15')]);}})[_0xf581('0x17')](function(_0x51e807){logger[_0xf581('0x14')](_0xf581('0xf'),_0xafa594,_0x51e807);_0x538667(_0x51e807);});});} \ No newline at end of file +var _0x925b=['info','request\x20sent','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZendeskConfiguration,\x20%s,\x20%s','message'];(function(_0x12432d,_0x48e284){var _0x759d76=function(_0x5c6a62){while(--_0x5c6a62){_0x12432d['push'](_0x12432d['shift']());}};_0x759d76(++_0x48e284);}(_0x925b,0xbc));var _0xb925=function(_0x30abff,_0x5f2c5f){_0x30abff=_0x30abff-0x0;var _0x4c571e=_0x925b[_0x30abff];return _0x4c571e;};'use strict';var _=require(_0xb925('0x0'));var util=require('util');var moment=require(_0xb925('0x1'));var BPromise=require(_0xb925('0x2'));var rs=require(_0xb925('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb925('0x4'));var logger=require(_0xb925('0x5'))(_0xb925('0x6'));var config=require('../../config/environment');var jayson=require(_0xb925('0x7'));var client=jayson[_0xb925('0x8')][_0xb925('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x7b87ee,_0x56b511,_0x52b2a9){return new BPromise(function(_0xd3e6f7,_0x3d2fc5){return client[_0xb925('0xa')](_0x7b87ee,_0x52b2a9)[_0xb925('0xb')](function(_0x591c08){logger['info']('ZendeskConfiguration,\x20%s,\x20%s',_0x56b511,'request\x20sent');logger[_0xb925('0xc')](_0xb925('0xd'),_0x56b511,'request\x20sent',JSON[_0xb925('0xe')](_0x591c08));if(_0x591c08['error']){if(_0x591c08[_0xb925('0xf')][_0xb925('0x10')]===0x1f4){logger[_0xb925('0xf')](_0xb925('0x11'),_0x56b511,_0x591c08['error'][_0xb925('0x12')]);return _0x3d2fc5(_0x591c08['error'][_0xb925('0x12')]);}logger[_0xb925('0xf')](_0xb925('0x11'),_0x56b511,_0x591c08[_0xb925('0xf')][_0xb925('0x12')]);return _0xd3e6f7(_0x591c08[_0xb925('0xf')][_0xb925('0x12')]);}else{logger[_0xb925('0x13')](_0xb925('0x11'),_0x56b511,_0xb925('0x14'));_0xd3e6f7(_0x591c08[_0xb925('0x15')][_0xb925('0x12')]);}})[_0xb925('0x16')](function(_0x2f5e44){logger['error'](_0xb925('0x11'),_0x56b511,_0x2f5e44);_0x3d2fc5(_0x2f5e44);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5924243..24b3998 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 _0x931f=['express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','show','post','put','/:id','update','destroy','multer','util'];(function(_0x3ab14c,_0x4093a1){var _0x423753=function(_0x278031){while(--_0x278031){_0x3ab14c['push'](_0x3ab14c['shift']());}};_0x423753(++_0x4093a1);}(_0x931f,0x184));var _0xf931=function(_0x18b2a3,_0x2a639b){_0x18b2a3=_0x18b2a3-0x0;var _0x50659f=_0x931f[_0x18b2a3];return _0x50659f;};'use strict';var multer=require(_0xf931('0x0'));var util=require(_0xf931('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf931('0x2'));var router=express['Router']();var auth=require(_0xf931('0x3'));var interaction=require(_0xf931('0x4'));var config=require(_0xf931('0x5'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0xf931('0x6')](),controller[_0xf931('0x7')]);router[_0xf931('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xf931('0x9')]);router[_0xf931('0xa')]('/',auth[_0xf931('0x6')](),controller['create']);router[_0xf931('0xb')](_0xf931('0xc'),auth['isAuthenticated'](),controller[_0xf931('0xd')]);router['delete'](_0xf931('0xc'),auth[_0xf931('0x6')](),controller[_0xf931('0xe')]);module['exports']=router; \ No newline at end of file +var _0xe9d5=['destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete'];(function(_0x4b006b,_0x3c1db3){var _0x362121=function(_0x3e7727){while(--_0x3e7727){_0x4b006b['push'](_0x4b006b['shift']());}};_0x362121(++_0x3c1db3);}(_0xe9d5,0x191));var _0x5e9d=function(_0x2624f7,_0x4175b9){_0x2624f7=_0x2624f7-0x0;var _0x3ea815=_0xe9d5[_0x2624f7];return _0x3ea815;};'use strict';var multer=require(_0x5e9d('0x0'));var util=require(_0x5e9d('0x1'));var path=require(_0x5e9d('0x2'));var timeout=require(_0x5e9d('0x3'));var express=require(_0x5e9d('0x4'));var router=express['Router']();var auth=require(_0x5e9d('0x5'));var interaction=require(_0x5e9d('0x6'));var config=require(_0x5e9d('0x7'));var controller=require(_0x5e9d('0x8'));router[_0x5e9d('0x9')]('/',auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xb')]);router[_0x5e9d('0x9')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0xd')]);router[_0x5e9d('0xe')]('/',auth['isAuthenticated'](),controller[_0x5e9d('0xf')]);router[_0x5e9d('0x10')](_0x5e9d('0xc'),auth[_0x5e9d('0xa')](),controller[_0x5e9d('0x11')]);router[_0x5e9d('0x12')](_0x5e9d('0xc'),auth['isAuthenticated'](),controller[_0x5e9d('0x13')]);module[_0x5e9d('0x14')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 31bee93..7a398a0 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 _0x25f0=['customVariable','string','STRING','BOOLEAN','sequelize','exports'];(function(_0x2e9b22,_0xfdbb5d){var _0x39217e=function(_0x503692){while(--_0x503692){_0x2e9b22['push'](_0x2e9b22['shift']());}};_0x39217e(++_0xfdbb5d);}(_0x25f0,0x10c));var _0x025f=function(_0x102af2,_0x484bc9){_0x102af2=_0x102af2-0x0;var _0x4eeee2=_0x25f0[_0x102af2];return _0x4eeee2;};'use strict';var Sequelize=require(_0x025f('0x0'));module[_0x025f('0x1')]={'type':{'type':Sequelize['ENUM']('string','variable',_0x025f('0x2'),'keyValue'),'defaultValue':_0x025f('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x025f('0x4')]},'keyType':{'type':Sequelize['ENUM'](_0x025f('0x3'),'variable',_0x025f('0x2'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x025f('0x4')]},'customField':{'type':Sequelize[_0x025f('0x5')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x025f('0x4')]}}; \ No newline at end of file +var _0xf29c=['customVariable','keyValue','STRING','exports','ENUM','string','variable'];(function(_0x323c59,_0x2fa7f5){var _0x4b2831=function(_0x11c3b3){while(--_0x11c3b3){_0x323c59['push'](_0x323c59['shift']());}};_0x4b2831(++_0x2fa7f5);}(_0xf29c,0xc7));var _0xcf29=function(_0xf0f250,_0xbbb683){_0xf0f250=_0xf0f250-0x0;var _0x174135=_0xf29c[_0xf0f250];return _0x174135;};'use strict';var Sequelize=require('sequelize');module[_0xcf29('0x0')]={'type':{'type':Sequelize[_0xcf29('0x1')](_0xcf29('0x2'),_0xcf29('0x3'),_0xcf29('0x4'),_0xcf29('0x5')),'defaultValue':_0xcf29('0x2')},'content':{'type':Sequelize[_0xcf29('0x6')]},'key':{'type':Sequelize[_0xcf29('0x6')]},'keyType':{'type':Sequelize[_0xcf29('0x1')](_0xcf29('0x2'),_0xcf29('0x3'),_0xcf29('0x4'))},'keyContent':{'type':Sequelize[_0xcf29('0x6')]},'idField':{'type':Sequelize[_0xcf29('0x6')]},'nameField':{'type':Sequelize[_0xcf29('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 2146462..891cbe0 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 _0x4e43=['ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','ZendeskField','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x4e43,0xd6));var _0x34e4=function(_0x5f51d2,_0x4f0133){_0x5f51d2=_0x5f51d2-0x0;var _0x24bf08=_0x4e43[_0x5f51d2];return _0x24bf08;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x34e4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x34e4('0x1'));var rp=require('request-promise');var moment=require(_0x34e4('0x2'));var BPromise=require(_0x34e4('0x3'));var Mustache=require(_0x34e4('0x4'));var util=require(_0x34e4('0x5'));var path=require(_0x34e4('0x6'));var sox=require('sox');var csv=require(_0x34e4('0x7'));var ejs=require(_0x34e4('0x8'));var fs=require('fs');var _=require(_0x34e4('0x9'));var squel=require(_0x34e4('0xa'));var crypto=require(_0x34e4('0xb'));var jsforce=require(_0x34e4('0xc'));var deskjs=require(_0x34e4('0xd'));var toCsv=require(_0x34e4('0x7'));var querystring=require(_0x34e4('0xe'));var Papa=require(_0x34e4('0xf'));var Redis=require(_0x34e4('0x10'));var authService=require(_0x34e4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x34e4('0x12'));var hardwareService=require(_0x34e4('0x13'));var logger=require('../../config/logger')(_0x34e4('0x14'));var utils=require('../../config/utils');var config=require(_0x34e4('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x404835,_0x598b){_0x598b=_0x598b||0xcc;return function(_0xd83f9){if(_0xd83f9){return _0x404835[_0x34e4('0x16')](_0x598b);}return _0x404835[_0x34e4('0x17')](_0x598b)[_0x34e4('0x18')]();};}function respondWithResult(_0x55f75f,_0x5a464b){_0x5a464b=_0x5a464b||0xc8;return function(_0x1ef26c){if(_0x1ef26c){return _0x55f75f[_0x34e4('0x17')](_0x5a464b)[_0x34e4('0x19')](_0x1ef26c);}};}function respondWithFilteredResult(_0x3b3076,_0x3e6212){return function(_0x309d31){if(_0x309d31){var _0x22eb09=_0x309d31[_0x34e4('0x1a')],_0x3a88c7=_0x3e6212[_0x34e4('0x1b')],_0x4f5ce1=_0x3e6212[_0x34e4('0x1b')]+_0x3e6212['limit'],_0x59e48a;if(_0x4f5ce1>=_0x22eb09){_0x4f5ce1=_0x22eb09;_0x59e48a=0xc8;}else{_0x59e48a=0xce;}_0x3b3076['status'](_0x59e48a);return _0x3b3076[_0x34e4('0x1c')](_0x34e4('0x1d'),_0x3a88c7+'-'+_0x4f5ce1+'/'+_0x22eb09)['json'](_0x309d31);}return null;};}function patchUpdates(_0x33fced){return function(_0x34d3a4){try{jsonpatch[_0x34e4('0x1e')](_0x34d3a4,_0x33fced,!![]);}catch(_0xe0e4ce){return BPromise[_0x34e4('0x1f')](_0xe0e4ce);}return _0x34d3a4['save']();};}function saveUpdates(_0x52d105,_0x3b42b0){return function(_0x5b8c9d){if(_0x5b8c9d){return _0x5b8c9d[_0x34e4('0x20')](_0x52d105)[_0x34e4('0x21')](function(_0x407536){return _0x407536;});}return null;};}function removeEntity(_0x2519c8,_0x2001b1){return function(_0x2fd8f0){if(_0x2fd8f0){return _0x2fd8f0[_0x34e4('0x22')]()[_0x34e4('0x21')](function(){_0x2519c8[_0x34e4('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1ca4ca,_0x2432d0){return function(_0x370063){if(!_0x370063){_0x1ca4ca[_0x34e4('0x16')](0x194);}return _0x370063;};}function handleError(_0x22ab9e,_0x22da17){_0x22da17=_0x22da17||0x1f4;return function(_0x23ab68){logger[_0x34e4('0x23')](_0x23ab68['stack']);if(_0x23ab68[_0x34e4('0x24')]){delete _0x23ab68[_0x34e4('0x24')];}_0x22ab9e[_0x34e4('0x17')](_0x22da17)[_0x34e4('0x25')](_0x23ab68);};}exports[_0x34e4('0x26')]=function(_0x4c4efa,_0x1ace2e){var _0x425955={},_0x242eec={},_0x132fd8={'count':0x0,'rows':[]};var _0x4e5322=_['map'](db['ZendeskField'][_0x34e4('0x27')],function(_0x474665){return{'name':_0x474665[_0x34e4('0x28')],'type':_0x474665[_0x34e4('0x29')][_0x34e4('0x2a')]};});_0x242eec['model']=_[_0x34e4('0x2b')](_0x4e5322,'name');_0x242eec[_0x34e4('0x2c')]=_['keys'](_0x4c4efa[_0x34e4('0x2c')]);_0x242eec[_0x34e4('0x2d')]=_[_0x34e4('0x2e')](_0x242eec[_0x34e4('0x2f')],_0x242eec[_0x34e4('0x2c')]);_0x425955[_0x34e4('0x30')]=_[_0x34e4('0x2e')](_0x242eec[_0x34e4('0x2f')],qs['fields'](_0x4c4efa['query'][_0x34e4('0x31')]));_0x425955['attributes']=_0x425955[_0x34e4('0x30')]['length']?_0x425955[_0x34e4('0x30')]:_0x242eec['model'];if(!_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x32')](_0x34e4('0x33'))){_0x425955[_0x34e4('0x34')]=qs[_0x34e4('0x34')](_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x34')]);_0x425955[_0x34e4('0x1b')]=qs['offset'](_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x1b')]);}_0x425955[_0x34e4('0x35')]=qs[_0x34e4('0x36')](_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x36')]);_0x425955[_0x34e4('0x37')]=qs[_0x34e4('0x2d')](_[_0x34e4('0x38')](_0x4c4efa[_0x34e4('0x2c')],_0x242eec[_0x34e4('0x2d')]));if(_0x4c4efa['query']['filter']){_0x425955['where']=_[_0x34e4('0x39')](_0x425955['where'],{'$or':_['map'](_0x4e5322,function(_0x41912b){if(_0x41912b[_0x34e4('0x29')]!==_0x34e4('0x3a')){var _0x50b23b={};_0x50b23b[_0x41912b[_0x34e4('0x24')]]={'$like':'%'+_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x3b')]+'%'};return _0x50b23b;}})});}_0x425955=_['merge']({},_0x425955,_0x4c4efa[_0x34e4('0x3c')]);var _0x49b943={'where':_0x425955[_0x34e4('0x37')]};return db[_0x34e4('0x3d')][_0x34e4('0x1a')](_0x49b943)[_0x34e4('0x21')](function(_0xdbab7f){_0x132fd8[_0x34e4('0x1a')]=_0xdbab7f;if(_0x4c4efa[_0x34e4('0x2c')][_0x34e4('0x3e')]){_0x425955[_0x34e4('0x3f')]=[{'all':!![]}];}return db[_0x34e4('0x3d')][_0x34e4('0x40')](_0x425955);})[_0x34e4('0x21')](function(_0x1df03b){_0x132fd8[_0x34e4('0x41')]=_0x1df03b;return _0x132fd8;})[_0x34e4('0x21')](respondWithFilteredResult(_0x1ace2e,_0x425955))[_0x34e4('0x42')](handleError(_0x1ace2e,null));};exports[_0x34e4('0x43')]=function(_0x3e2d87,_0xdbbba6){var _0xae8b46={'raw':!![],'where':{'id':_0x3e2d87[_0x34e4('0x44')]['id']}},_0x5aaa04={};_0x5aaa04['model']=_[_0x34e4('0x45')](db[_0x34e4('0x3d')][_0x34e4('0x27')]);_0x5aaa04[_0x34e4('0x2c')]=_[_0x34e4('0x45')](_0x3e2d87['query']);_0x5aaa04['filters']=_[_0x34e4('0x2e')](_0x5aaa04[_0x34e4('0x2f')],_0x5aaa04[_0x34e4('0x2c')]);_0xae8b46['attributes']=_[_0x34e4('0x2e')](_0x5aaa04[_0x34e4('0x2f')],qs[_0x34e4('0x31')](_0x3e2d87[_0x34e4('0x2c')]['fields']));_0xae8b46[_0x34e4('0x30')]=_0xae8b46[_0x34e4('0x30')][_0x34e4('0x46')]?_0xae8b46[_0x34e4('0x30')]:_0x5aaa04['model'];if(_0x3e2d87[_0x34e4('0x2c')][_0x34e4('0x3e')]){_0xae8b46[_0x34e4('0x3f')]=[{'all':!![]}];}_0xae8b46=_[_0x34e4('0x39')]({},_0xae8b46,_0x3e2d87[_0x34e4('0x3c')]);return db[_0x34e4('0x3d')][_0x34e4('0x47')](_0xae8b46)['then'](handleEntityNotFound(_0xdbbba6,null))['then'](respondWithResult(_0xdbbba6,null))['catch'](handleError(_0xdbbba6,null));};exports[_0x34e4('0x48')]=function(_0x588219,_0x5b7b79){return db[_0x34e4('0x3d')][_0x34e4('0x48')](_0x588219[_0x34e4('0x49')],{})[_0x34e4('0x21')](respondWithResult(_0x5b7b79,0xc9))['catch'](handleError(_0x5b7b79,null));};exports[_0x34e4('0x20')]=function(_0x319bd4,_0x39adac){if(_0x319bd4[_0x34e4('0x49')]['id']){delete _0x319bd4['body']['id'];}return db[_0x34e4('0x3d')][_0x34e4('0x47')]({'where':{'id':_0x319bd4['params']['id']}})[_0x34e4('0x21')](handleEntityNotFound(_0x39adac,null))[_0x34e4('0x21')](saveUpdates(_0x319bd4[_0x34e4('0x49')],null))[_0x34e4('0x21')](respondWithResult(_0x39adac,null))['catch'](handleError(_0x39adac,null));};exports[_0x34e4('0x22')]=function(_0x570300,_0x32af4e){return db[_0x34e4('0x3d')][_0x34e4('0x47')]({'where':{'id':_0x570300['params']['id']}})[_0x34e4('0x21')](handleEntityNotFound(_0x32af4e,null))['then'](removeEntity(_0x32af4e,null))[_0x34e4('0x42')](handleError(_0x32af4e,null));}; \ No newline at end of file +var _0x4634=['options','find','catch','create','body','params','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','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','status','end','json','count','offset','set','Content-Range','save','then','destroy','sendStatus','error','stack','name','send','index','map','ZendeskField','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','model'];(function(_0x5da955,_0x32d5cd){var _0x5450d6=function(_0x540565){while(--_0x540565){_0x5da955['push'](_0x5da955['shift']());}};_0x5450d6(++_0x32d5cd);}(_0x4634,0x173));var _0x4463=function(_0x4238ca,_0x472580){_0x4238ca=_0x4238ca-0x0;var _0x421c3d=_0x4634[_0x4238ca];return _0x421c3d;};'use strict';var pdf=require(_0x4463('0x0'));var emlformat=require(_0x4463('0x1'));var rimraf=require(_0x4463('0x2'));var zipdir=require(_0x4463('0x3'));var jsonpatch=require(_0x4463('0x4'));var rp=require(_0x4463('0x5'));var moment=require(_0x4463('0x6'));var BPromise=require(_0x4463('0x7'));var Mustache=require(_0x4463('0x8'));var util=require(_0x4463('0x9'));var path=require(_0x4463('0xa'));var sox=require(_0x4463('0xb'));var csv=require(_0x4463('0xc'));var ejs=require(_0x4463('0xd'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4463('0xe'));var crypto=require(_0x4463('0xf'));var jsforce=require(_0x4463('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4463('0x11'));var Papa=require('papaparse');var Redis=require(_0x4463('0x12'));var authService=require(_0x4463('0x13'));var qs=require(_0x4463('0x14'));var as=require(_0x4463('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4463('0x16'))('api');var utils=require('../../config/utils');var config=require(_0x4463('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4b0bb9,_0x5aa22c){_0x5aa22c=_0x5aa22c||0xcc;return function(_0x1b16c2){if(_0x1b16c2){return _0x4b0bb9['sendStatus'](_0x5aa22c);}return _0x4b0bb9[_0x4463('0x18')](_0x5aa22c)[_0x4463('0x19')]();};}function respondWithResult(_0x5445a1,_0x1181af){_0x1181af=_0x1181af||0xc8;return function(_0x5d7464){if(_0x5d7464){return _0x5445a1[_0x4463('0x18')](_0x1181af)[_0x4463('0x1a')](_0x5d7464);}};}function respondWithFilteredResult(_0x308a79,_0x3602cf){return function(_0x3984db){if(_0x3984db){var _0x2e9eef=_0x3984db[_0x4463('0x1b')],_0x58f17d=_0x3602cf['offset'],_0x105b85=_0x3602cf[_0x4463('0x1c')]+_0x3602cf['limit'],_0x4b8801;if(_0x105b85>=_0x2e9eef){_0x105b85=_0x2e9eef;_0x4b8801=0xc8;}else{_0x4b8801=0xce;}_0x308a79[_0x4463('0x18')](_0x4b8801);return _0x308a79[_0x4463('0x1d')](_0x4463('0x1e'),_0x58f17d+'-'+_0x105b85+'/'+_0x2e9eef)[_0x4463('0x1a')](_0x3984db);}return null;};}function patchUpdates(_0x544384){return function(_0x248544){try{jsonpatch['apply'](_0x248544,_0x544384,!![]);}catch(_0xb19c6e){return BPromise['reject'](_0xb19c6e);}return _0x248544[_0x4463('0x1f')]();};}function saveUpdates(_0x50608e,_0x2ff7cd){return function(_0x5d9416){if(_0x5d9416){return _0x5d9416['update'](_0x50608e)[_0x4463('0x20')](function(_0x1dc267){return _0x1dc267;});}return null;};}function removeEntity(_0x4512bf,_0x2c01b7){return function(_0x371084){if(_0x371084){return _0x371084[_0x4463('0x21')]()[_0x4463('0x20')](function(){_0x4512bf[_0x4463('0x18')](0xcc)[_0x4463('0x19')]();});}};}function handleEntityNotFound(_0x41400b,_0x4fcadc){return function(_0xb0cbf){if(!_0xb0cbf){_0x41400b[_0x4463('0x22')](0x194);}return _0xb0cbf;};}function handleError(_0x2206ab,_0x5762a8){_0x5762a8=_0x5762a8||0x1f4;return function(_0x562e7c){logger[_0x4463('0x23')](_0x562e7c[_0x4463('0x24')]);if(_0x562e7c[_0x4463('0x25')]){delete _0x562e7c[_0x4463('0x25')];}_0x2206ab[_0x4463('0x18')](_0x5762a8)[_0x4463('0x26')](_0x562e7c);};}exports[_0x4463('0x27')]=function(_0x257ae1,_0x4d249d){var _0x4bf4c5={},_0x5a6902={},_0x436de3={'count':0x0,'rows':[]};var _0x26aed8=_[_0x4463('0x28')](db[_0x4463('0x29')][_0x4463('0x2a')],function(_0x2c6571){return{'name':_0x2c6571[_0x4463('0x2b')],'type':_0x2c6571['type'][_0x4463('0x2c')]};});_0x5a6902['model']=_[_0x4463('0x28')](_0x26aed8,_0x4463('0x25'));_0x5a6902[_0x4463('0x2d')]=_[_0x4463('0x2e')](_0x257ae1[_0x4463('0x2d')]);_0x5a6902[_0x4463('0x2f')]=_[_0x4463('0x30')](_0x5a6902['model'],_0x5a6902[_0x4463('0x2d')]);_0x4bf4c5[_0x4463('0x31')]=_[_0x4463('0x30')](_0x5a6902['model'],qs[_0x4463('0x32')](_0x257ae1[_0x4463('0x2d')][_0x4463('0x32')]));_0x4bf4c5[_0x4463('0x31')]=_0x4bf4c5['attributes'][_0x4463('0x33')]?_0x4bf4c5['attributes']:_0x5a6902['model'];if(!_0x257ae1[_0x4463('0x2d')][_0x4463('0x34')]('nolimit')){_0x4bf4c5[_0x4463('0x35')]=qs[_0x4463('0x35')](_0x257ae1[_0x4463('0x2d')]['limit']);_0x4bf4c5[_0x4463('0x1c')]=qs[_0x4463('0x1c')](_0x257ae1[_0x4463('0x2d')]['offset']);}_0x4bf4c5[_0x4463('0x36')]=qs[_0x4463('0x37')](_0x257ae1[_0x4463('0x2d')][_0x4463('0x37')]);_0x4bf4c5[_0x4463('0x38')]=qs[_0x4463('0x2f')](_[_0x4463('0x39')](_0x257ae1[_0x4463('0x2d')],_0x5a6902[_0x4463('0x2f')]));if(_0x257ae1[_0x4463('0x2d')][_0x4463('0x3a')]){_0x4bf4c5[_0x4463('0x38')]=_[_0x4463('0x3b')](_0x4bf4c5['where'],{'$or':_[_0x4463('0x28')](_0x26aed8,function(_0x3410b7){if(_0x3410b7[_0x4463('0x3c')]!==_0x4463('0x3d')){var _0x176e0d={};_0x176e0d[_0x3410b7[_0x4463('0x25')]]={'$like':'%'+_0x257ae1[_0x4463('0x2d')][_0x4463('0x3a')]+'%'};return _0x176e0d;}})});}_0x4bf4c5=_[_0x4463('0x3b')]({},_0x4bf4c5,_0x257ae1['options']);var _0x812536={'where':_0x4bf4c5['where']};return db[_0x4463('0x29')][_0x4463('0x1b')](_0x812536)[_0x4463('0x20')](function(_0x4ae3af){_0x436de3[_0x4463('0x1b')]=_0x4ae3af;if(_0x257ae1['query'][_0x4463('0x3e')]){_0x4bf4c5[_0x4463('0x3f')]=[{'all':!![]}];}return db[_0x4463('0x29')][_0x4463('0x40')](_0x4bf4c5);})[_0x4463('0x20')](function(_0x44edcb){_0x436de3[_0x4463('0x41')]=_0x44edcb;return _0x436de3;})[_0x4463('0x20')](respondWithFilteredResult(_0x4d249d,_0x4bf4c5))['catch'](handleError(_0x4d249d,null));};exports['show']=function(_0x129bd6,_0x4ad30f){var _0x1d5057={'raw':!![],'where':{'id':_0x129bd6['params']['id']}},_0x84c90a={};_0x84c90a[_0x4463('0x42')]=_[_0x4463('0x2e')](db[_0x4463('0x29')][_0x4463('0x2a')]);_0x84c90a[_0x4463('0x2d')]=_['keys'](_0x129bd6['query']);_0x84c90a[_0x4463('0x2f')]=_[_0x4463('0x30')](_0x84c90a[_0x4463('0x42')],_0x84c90a['query']);_0x1d5057[_0x4463('0x31')]=_['intersection'](_0x84c90a['model'],qs['fields'](_0x129bd6[_0x4463('0x2d')][_0x4463('0x32')]));_0x1d5057[_0x4463('0x31')]=_0x1d5057['attributes'][_0x4463('0x33')]?_0x1d5057[_0x4463('0x31')]:_0x84c90a[_0x4463('0x42')];if(_0x129bd6[_0x4463('0x2d')][_0x4463('0x3e')]){_0x1d5057['include']=[{'all':!![]}];}_0x1d5057=_[_0x4463('0x3b')]({},_0x1d5057,_0x129bd6[_0x4463('0x43')]);return db[_0x4463('0x29')][_0x4463('0x44')](_0x1d5057)[_0x4463('0x20')](handleEntityNotFound(_0x4ad30f,null))[_0x4463('0x20')](respondWithResult(_0x4ad30f,null))[_0x4463('0x45')](handleError(_0x4ad30f,null));};exports[_0x4463('0x46')]=function(_0x17ac66,_0x596dd8){return db['ZendeskField'][_0x4463('0x46')](_0x17ac66[_0x4463('0x47')],{})[_0x4463('0x20')](respondWithResult(_0x596dd8,0xc9))['catch'](handleError(_0x596dd8,null));};exports['update']=function(_0x512d8a,_0x2de7e7){if(_0x512d8a[_0x4463('0x47')]['id']){delete _0x512d8a[_0x4463('0x47')]['id'];}return db['ZendeskField'][_0x4463('0x44')]({'where':{'id':_0x512d8a[_0x4463('0x48')]['id']}})[_0x4463('0x20')](handleEntityNotFound(_0x2de7e7,null))['then'](saveUpdates(_0x512d8a[_0x4463('0x47')],null))[_0x4463('0x20')](respondWithResult(_0x2de7e7,null))[_0x4463('0x45')](handleError(_0x2de7e7,null));};exports[_0x4463('0x21')]=function(_0x414ea7,_0x363c6c){return db[_0x4463('0x29')]['find']({'where':{'id':_0x414ea7[_0x4463('0x48')]['id']}})[_0x4463('0x20')](handleEntityNotFound(_0x363c6c,null))['then'](removeEntity(_0x363c6c,null))[_0x4463('0x45')](handleError(_0x363c6c,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index fd429fa..cbf9599 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 _0x980c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x1ccbcc,_0x5c948b){var _0x1e873f=function(_0x4f232e){while(--_0x4f232e){_0x1ccbcc['push'](_0x1ccbcc['shift']());}};_0x1e873f(++_0x5c948b);}(_0x980c,0x100));var _0xc980=function(_0xea00e7,_0x2d23a){_0xea00e7=_0xea00e7-0x0;var _0x9cfa91=_0x980c[_0xea00e7];return _0x9cfa91;};'use strict';var _=require(_0xc980('0x0'));var util=require(_0xc980('0x1'));var logger=require(_0xc980('0x2'))(_0xc980('0x3'));var moment=require(_0xc980('0x4'));var BPromise=require(_0xc980('0x5'));var rp=require(_0xc980('0x6'));var fs=require('fs');var path=require(_0xc980('0x7'));var rimraf=require(_0xc980('0x8'));var config=require(_0xc980('0x9'));var attributes=require(_0xc980('0xa'));module['exports']=function(_0x472ece,_0x311a54){return _0x472ece[_0xc980('0xb')](_0xc980('0xc'),attributes,{'tableName':_0xc980('0xd'),'paranoid':![],'indexes':[{'name':_0xc980('0xe'),'fields':[_0xc980('0xf'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6cb4=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','FieldId','lodash'];(function(_0x5a137e,_0x4cdec2){var _0x57eb7c=function(_0x19b84b){while(--_0x19b84b){_0x5a137e['push'](_0x5a137e['shift']());}};_0x57eb7c(++_0x4cdec2);}(_0x6cb4,0xff));var _0x46cb=function(_0xeafd45,_0x59325c){_0xeafd45=_0xeafd45-0x0;var _0x3a8252=_0x6cb4[_0xeafd45];return _0x3a8252;};'use strict';var _=require(_0x46cb('0x0'));var util=require(_0x46cb('0x1'));var logger=require(_0x46cb('0x2'))(_0x46cb('0x3'));var moment=require(_0x46cb('0x4'));var BPromise=require(_0x46cb('0x5'));var rp=require(_0x46cb('0x6'));var fs=require('fs');var path=require(_0x46cb('0x7'));var rimraf=require(_0x46cb('0x8'));var config=require('../../config/environment');var attributes=require(_0x46cb('0x9'));module['exports']=function(_0x3d9d3c,_0x4d9f1d){return _0x3d9d3c[_0x46cb('0xa')](_0x46cb('0xb'),attributes,{'tableName':_0x46cb('0xc'),'paranoid':![],'indexes':[{'name':_0x46cb('0xd'),'fields':[_0x46cb('0xe'),_0x46cb('0xf')],'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 5b01970..bdb0e3a 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 _0x10ba=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','debug','ZendeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','ZendeskField,\x20%s,\x20%s'];(function(_0x1fc5fe,_0x51d294){var _0x291f26=function(_0x2f5316){while(--_0x2f5316){_0x1fc5fe['push'](_0x1fc5fe['shift']());}};_0x291f26(++_0x51d294);}(_0x10ba,0x13b));var _0xa10b=function(_0x5cc8,_0x1faa02){_0x5cc8=_0x5cc8-0x0;var _0x450661=_0x10ba[_0x5cc8];return _0x450661;};'use strict';var _=require(_0xa10b('0x0'));var util=require(_0xa10b('0x1'));var moment=require(_0xa10b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa10b('0x3'));var fs=require('fs');var Redis=require(_0xa10b('0x4'));var db=require(_0xa10b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa10b('0x6'))(_0xa10b('0x7'));var config=require(_0xa10b('0x8'));var jayson=require(_0xa10b('0x9'));var client=jayson['client'][_0xa10b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ad570,_0x315a64,_0x5ac38c){return new BPromise(function(_0x236983,_0x308a4f){return client[_0xa10b('0xb')](_0x3ad570,_0x5ac38c)[_0xa10b('0xc')](function(_0x3d3b68){logger[_0xa10b('0xd')]('ZendeskField,\x20%s,\x20%s',_0x315a64,'request\x20sent');logger[_0xa10b('0xe')](_0xa10b('0xf'),_0x315a64,_0xa10b('0x10'),JSON[_0xa10b('0x11')](_0x3d3b68));if(_0x3d3b68[_0xa10b('0x12')]){if(_0x3d3b68['error'][_0xa10b('0x13')]===0x1f4){logger[_0xa10b('0x12')](_0xa10b('0x14'),_0x315a64,_0x3d3b68['error']['message']);return _0x308a4f(_0x3d3b68[_0xa10b('0x12')][_0xa10b('0x15')]);}logger[_0xa10b('0x12')](_0xa10b('0x14'),_0x315a64,_0x3d3b68[_0xa10b('0x12')][_0xa10b('0x15')]);return _0x236983(_0x3d3b68['error']['message']);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x315a64,'request\x20sent');_0x236983(_0x3d3b68[_0xa10b('0x16')]['message']);}})[_0xa10b('0x17')](function(_0x26f91a){logger['error']('ZendeskField,\x20%s,\x20%s',_0x315a64,_0x26f91a);_0x308a4f(_0x26f91a);});});} \ No newline at end of file +var _0xf007=['then','info','request\x20sent','error','code','ZendeskField,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x83de16,_0x434b55){var _0x420904=function(_0x3d27ca){while(--_0x3d27ca){_0x83de16['push'](_0x83de16['shift']());}};_0x420904(++_0x434b55);}(_0xf007,0xda));var _0x7f00=function(_0x4c06ac,_0x568788){_0x4c06ac=_0x4c06ac-0x0;var _0x2333cb=_0xf007[_0x4c06ac];return _0x2333cb;};'use strict';var _=require(_0x7f00('0x0'));var util=require(_0x7f00('0x1'));var moment=require('moment');var BPromise=require(_0x7f00('0x2'));var rs=require(_0x7f00('0x3'));var fs=require('fs');var Redis=require(_0x7f00('0x4'));var db=require(_0x7f00('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7f00('0x6'))(_0x7f00('0x7'));var config=require(_0x7f00('0x8'));var jayson=require(_0x7f00('0x9'));var client=jayson[_0x7f00('0xa')][_0x7f00('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5c4359,_0x39d4d4,_0x39ef4b){return new BPromise(function(_0x4a50a2,_0x11e7bc){return client[_0x7f00('0xc')](_0x5c4359,_0x39ef4b)[_0x7f00('0xd')](function(_0x49c3c3){logger[_0x7f00('0xe')]('ZendeskField,\x20%s,\x20%s',_0x39d4d4,_0x7f00('0xf'));logger['debug']('ZendeskField,\x20%s,\x20%s,\x20%s',_0x39d4d4,_0x7f00('0xf'),JSON['stringify'](_0x49c3c3));if(_0x49c3c3['error']){if(_0x49c3c3[_0x7f00('0x10')][_0x7f00('0x11')]===0x1f4){logger[_0x7f00('0x10')](_0x7f00('0x12'),_0x39d4d4,_0x49c3c3[_0x7f00('0x10')][_0x7f00('0x13')]);return _0x11e7bc(_0x49c3c3[_0x7f00('0x10')][_0x7f00('0x13')]);}logger[_0x7f00('0x10')](_0x7f00('0x12'),_0x39d4d4,_0x49c3c3['error']['message']);return _0x4a50a2(_0x49c3c3[_0x7f00('0x10')][_0x7f00('0x13')]);}else{logger[_0x7f00('0xe')](_0x7f00('0x12'),_0x39d4d4,'request\x20sent');_0x4a50a2(_0x49c3c3['result'][_0x7f00('0x13')]);}})[_0x7f00('0x14')](function(_0x54f243){logger['error']('ZendeskField,\x20%s,\x20%s',_0x39d4d4,_0x54f243);_0x11e7bc(_0x54f243);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2c7647e..f42f9ab 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 _0x03ce=['getFields','create','post','addConfiguration','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','index','/:id','isAuthenticated','/:id/configurations','/:id/fields'];(function(_0x16e0a6,_0x18e7f6){var _0x5e15cf=function(_0x266c66){while(--_0x266c66){_0x16e0a6['push'](_0x16e0a6['shift']());}};_0x5e15cf(++_0x18e7f6);}(_0x03ce,0xc8));var _0xe03c=function(_0x225684,_0x5caaa3){_0x225684=_0x225684-0x0;var _0x18a08e=_0x03ce[_0x225684];return _0x18a08e;};'use strict';var multer=require(_0xe03c('0x0'));var util=require(_0xe03c('0x1'));var path=require(_0xe03c('0x2'));var timeout=require(_0xe03c('0x3'));var express=require(_0xe03c('0x4'));var router=express[_0xe03c('0x5')]();var auth=require(_0xe03c('0x6'));var interaction=require(_0xe03c('0x7'));var config=require(_0xe03c('0x8'));var controller=require(_0xe03c('0x9'));router[_0xe03c('0xa')]('/',auth['isAuthenticated'](),controller[_0xe03c('0xb')]);router[_0xe03c('0xa')](_0xe03c('0xc'),auth[_0xe03c('0xd')](),controller['show']);router[_0xe03c('0xa')](_0xe03c('0xe'),auth[_0xe03c('0xd')](),controller['getConfigurations']);router['get'](_0xe03c('0xf'),auth['isAuthenticated'](),controller[_0xe03c('0x10')]);router['post']('/',auth[_0xe03c('0xd')](),controller[_0xe03c('0x11')]);router[_0xe03c('0x12')](_0xe03c('0xe'),auth[_0xe03c('0xd')](),controller[_0xe03c('0x13')]);router[_0xe03c('0x14')](_0xe03c('0xc'),auth[_0xe03c('0xd')](),controller[_0xe03c('0x15')]);router[_0xe03c('0x16')]('/:id',auth[_0xe03c('0xd')](),controller['destroy']);module[_0xe03c('0x17')]=router; \ No newline at end of file +var _0x28b3=['express','Router','../../components/auth/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','addConfiguration','put','/:id','delete','destroy','exports','multer','path','connect-timeout'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0x28b3,0x16d));var _0x328b=function(_0x473c9c,_0x4252bd){_0x473c9c=_0x473c9c-0x0;var _0x514008=_0x28b3[_0x473c9c];return _0x514008;};'use strict';var multer=require(_0x328b('0x0'));var util=require('util');var path=require(_0x328b('0x1'));var timeout=require(_0x328b('0x2'));var express=require(_0x328b('0x3'));var router=express[_0x328b('0x4')]();var auth=require(_0x328b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x328b('0x6'));var controller=require(_0x328b('0x7'));router[_0x328b('0x8')]('/',auth[_0x328b('0x9')](),controller[_0x328b('0xa')]);router[_0x328b('0x8')]('/:id',auth[_0x328b('0x9')](),controller['show']);router[_0x328b('0x8')]('/:id/configurations',auth[_0x328b('0x9')](),controller[_0x328b('0xb')]);router['get'](_0x328b('0xc'),auth[_0x328b('0x9')](),controller[_0x328b('0xd')]);router[_0x328b('0xe')]('/',auth['isAuthenticated'](),controller[_0x328b('0xf')]);router[_0x328b('0xe')](_0x328b('0x10'),auth[_0x328b('0x9')](),controller[_0x328b('0x11')]);router[_0x328b('0x12')](_0x328b('0x13'),auth[_0x328b('0x9')](),controller['update']);router[_0x328b('0x14')]('/:id',auth[_0x328b('0x9')](),controller[_0x328b('0x15')]);module[_0x328b('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 8ed0ec7..9c6ab49 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 _0x2355=['exports','STRING','sequelize'];(function(_0x356b7a,_0x34f197){var _0x24bc41=function(_0xc991d5){while(--_0xc991d5){_0x356b7a['push'](_0x356b7a['shift']());}};_0x24bc41(++_0x34f197);}(_0x2355,0x1df));var _0x5235=function(_0xf012e7,_0x486904){_0xf012e7=_0xf012e7-0x0;var _0x16b497=_0x2355[_0xf012e7];return _0x16b497;};'use strict';var Sequelize=require(_0x5235('0x0'));module[_0x5235('0x1')]={'name':{'type':Sequelize[_0x5235('0x2')]},'description':{'type':Sequelize[_0x5235('0x2')]},'host':{'type':Sequelize[_0x5235('0x2')]},'zone':{'type':Sequelize[_0x5235('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x5235('0x2')]},'serverUrl':{'type':Sequelize[_0x5235('0x2')]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x5235('0x2')]}}; \ No newline at end of file +var _0xffc6=['exports','STRING'];(function(_0x24a88e,_0x22a0b8){var _0x232cbb=function(_0x50b7a4){while(--_0x50b7a4){_0x24a88e['push'](_0x24a88e['shift']());}};_0x232cbb(++_0x22a0b8);}(_0xffc6,0x78));var _0x6ffc=function(_0x3ce796,_0x621939){_0x3ce796=_0x3ce796-0x0;var _0x354e12=_0xffc6[_0x3ce796];return _0x354e12;};'use strict';var Sequelize=require('sequelize');module[_0x6ffc('0x0')]={'name':{'type':Sequelize[_0x6ffc('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x6ffc('0x1')]},'zone':{'type':Sequelize[_0x6ffc('0x1')]},'clientId':{'type':Sequelize[_0x6ffc('0x1')]},'clientSecret':{'type':Sequelize[_0x6ffc('0x1')]},'serverUrl':{'type':Sequelize[_0x6ffc('0x1')]},'code':{'type':Sequelize[_0x6ffc('0x1')]},'refreshToken':{'type':Sequelize[_0x6ffc('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index ee8a1d1..606a1b3 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 _0x9525=['host','clientSecret','zoho.eu','com','serverUrl','slice','substring','lastIndexOf','GET','format','Calls','Zoho-oauthtoken\x20','response','Owner','Description','WhoId','Call_Duration','Call_Result','Call_Type','includes','api_name','system_mandatory','display_label','custom_field','data_type','pick_list_values','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','info','request\x20sent','error','code','message','ZohoAccount,\x20%s,\x20%s','result','catch','sendStatus','status','count','offset','set','json','apply','reject','save','update','then','end','stack','name','send','index','ZohoAccount','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','filter','map','type','VIRTUAL','options','includeAll','include','rows','show','rawAttributes','length','merge','find','create','body','params','getConfigurations','findOne','keys','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','channel','ZohoField','zone','https://accounts.zoho.in','https://accounts.zoho.eu','POST','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields'];(function(_0x30bf2f,_0x5b8415){var _0x2ba797=function(_0xd09e6f){while(--_0xd09e6f){_0x30bf2f['push'](_0x30bf2f['shift']());}};_0x2ba797(++_0x5b8415);}(_0x9525,0x12e));var _0x5952=function(_0x4fd6af,_0x44f868){_0x4fd6af=_0x4fd6af-0x0;var _0x5b5883=_0x9525[_0x4fd6af];return _0x5b5883;};'use strict';var pdf=require(_0x5952('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5952('0x1'));var zipdir=require(_0x5952('0x2'));var jsonpatch=require(_0x5952('0x3'));var rp=require(_0x5952('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5952('0x5'));var util=require(_0x5952('0x6'));var path=require('path');var sox=require(_0x5952('0x7'));var csv=require(_0x5952('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5952('0x9'));var squel=require(_0x5952('0xa'));var crypto=require(_0x5952('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5952('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5952('0xd'));var Papa=require(_0x5952('0xe'));var Redis=require('ioredis');var authService=require(_0x5952('0xf'));var qs=require(_0x5952('0x10'));var as=require(_0x5952('0x11'));var hardwareService=require(_0x5952('0x12'));var logger=require(_0x5952('0x13'))(_0x5952('0x14'));var utils=require(_0x5952('0x15'));var config=require('../../config/environment');var db=require(_0x5952('0x16'))['db'];var integrations=require(_0x5952('0x17'));var jayson=require(_0x5952('0x18'));var client=jayson[_0x5952('0x19')][_0x5952('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x2d3105,_0x1bc893,_0xd6aadc){if(_0xd6aadc){var _0x1692ef=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1692ef['test'](_0x1bc893)){return _0x2d3105;}else{throw new db[(_0x5952('0x1b'))][(_0x5952('0x1c'))](_0x5952('0x1d'));}}else{return _0x2d3105;}}function respondWithRpcPromise(_0x458d76,_0x42b6ae,_0x300ace,_0x2ad52){return new BPromise(function(_0x6edc27,_0x258c8c){var _0x29a648=_0x2ad52||client;return _0x29a648['request'](_0x458d76,_0x300ace)['then'](function(_0x36c55e){logger[_0x5952('0x1e')]('ZohoAccount,\x20%s,\x20%s',_0x42b6ae,_0x5952('0x1f'));logger['debug']('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x42b6ae,_0x5952('0x1f'),JSON['stringify'](_0x36c55e));if(_0x36c55e[_0x5952('0x20')]){if(_0x36c55e[_0x5952('0x20')][_0x5952('0x21')]===0x1f4){logger[_0x5952('0x20')]('ZohoAccount,\x20%s,\x20%s',_0x42b6ae,_0x36c55e[_0x5952('0x20')][_0x5952('0x22')]);return _0x258c8c(_0x36c55e['error'][_0x5952('0x22')]);}logger['error']('ZohoAccount,\x20%s,\x20%s',_0x42b6ae,_0x36c55e[_0x5952('0x20')][_0x5952('0x22')]);return _0x6edc27(_0x36c55e[_0x5952('0x20')][_0x5952('0x22')]);}else{logger[_0x5952('0x1e')](_0x5952('0x23'),_0x42b6ae,_0x5952('0x1f'));_0x6edc27(_0x36c55e[_0x5952('0x24')][_0x5952('0x22')]);}})[_0x5952('0x25')](function(_0x1c9dad){logger[_0x5952('0x20')](_0x5952('0x23'),_0x42b6ae,_0x1c9dad);_0x258c8c(_0x1c9dad);});});}function respondWithStatusCode(_0x5865ae,_0x1bb960){_0x1bb960=_0x1bb960||0xcc;return function(_0x4d80bf){if(_0x4d80bf){return _0x5865ae[_0x5952('0x26')](_0x1bb960);}return _0x5865ae[_0x5952('0x27')](_0x1bb960)['end']();};}function respondWithResult(_0x4af503,_0x1f0677){_0x1f0677=_0x1f0677||0xc8;return function(_0x1aff25){if(_0x1aff25){return _0x4af503[_0x5952('0x27')](_0x1f0677)['json'](_0x1aff25);}};}function respondWithFilteredResult(_0x33fa7c,_0x309b96){return function(_0x494d93){if(_0x494d93){var _0xcb56bb=_0x494d93[_0x5952('0x28')],_0x85130d=_0x309b96['offset'],_0xeb01ba=_0x309b96[_0x5952('0x29')]+_0x309b96['limit'],_0x3d5362;if(_0xeb01ba>=_0xcb56bb){_0xeb01ba=_0xcb56bb;_0x3d5362=0xc8;}else{_0x3d5362=0xce;}_0x33fa7c['status'](_0x3d5362);return _0x33fa7c[_0x5952('0x2a')]('Content-Range',_0x85130d+'-'+_0xeb01ba+'/'+_0xcb56bb)[_0x5952('0x2b')](_0x494d93);}return null;};}function patchUpdates(_0x3894a4){return function(_0x51e07e){try{jsonpatch[_0x5952('0x2c')](_0x51e07e,_0x3894a4,!![]);}catch(_0x196234){return BPromise[_0x5952('0x2d')](_0x196234);}return _0x51e07e[_0x5952('0x2e')]();};}function saveUpdates(_0x5ea1cf,_0x48e181){return function(_0x38e347){if(_0x38e347){return _0x38e347[_0x5952('0x2f')](_0x5ea1cf)[_0x5952('0x30')](function(_0x33e4ef){return _0x33e4ef;});}return null;};}function removeEntity(_0x361ce7,_0x4654c8){return function(_0x151c39){if(_0x151c39){return _0x151c39['destroy']()[_0x5952('0x30')](function(){_0x361ce7['status'](0xcc)[_0x5952('0x31')]();});}};}function handleEntityNotFound(_0x551674,_0xfa276c){return function(_0x49982a){if(!_0x49982a){_0x551674[_0x5952('0x26')](0x194);}return _0x49982a;};}function handleError(_0x5f2074,_0x153d05){_0x153d05=_0x153d05||0x1f4;return function(_0x5469c8){logger[_0x5952('0x20')](_0x5469c8[_0x5952('0x32')]);if(_0x5469c8[_0x5952('0x33')]){delete _0x5469c8['name'];}_0x5f2074[_0x5952('0x27')](_0x153d05)[_0x5952('0x34')](_0x5469c8);};}exports[_0x5952('0x35')]=function(_0x46e972,_0x3a8ffc){var _0x19a4ed={},_0x85d521={},_0xaf01fd={'count':0x0,'rows':[]};var _0x4c00f7=_['map'](db[_0x5952('0x36')]['rawAttributes'],function(_0x57c591){return{'name':_0x57c591['fieldName'],'type':_0x57c591['type'][_0x5952('0x37')]};});_0x85d521[_0x5952('0x38')]=_['map'](_0x4c00f7,_0x5952('0x33'));_0x85d521[_0x5952('0x39')]=_['keys'](_0x46e972[_0x5952('0x39')]);_0x85d521['filters']=_[_0x5952('0x3a')](_0x85d521[_0x5952('0x38')],_0x85d521[_0x5952('0x39')]);_0x19a4ed[_0x5952('0x3b')]=_[_0x5952('0x3a')](_0x85d521[_0x5952('0x38')],qs[_0x5952('0x3c')](_0x46e972[_0x5952('0x39')][_0x5952('0x3c')]));_0x19a4ed[_0x5952('0x3b')]=_0x19a4ed['attributes']['length']?_0x19a4ed['attributes']:_0x85d521[_0x5952('0x38')];if(!_0x46e972[_0x5952('0x39')][_0x5952('0x3d')](_0x5952('0x3e'))){_0x19a4ed[_0x5952('0x3f')]=qs[_0x5952('0x3f')](_0x46e972[_0x5952('0x39')][_0x5952('0x3f')]);_0x19a4ed['offset']=qs[_0x5952('0x29')](_0x46e972[_0x5952('0x39')][_0x5952('0x29')]);}_0x19a4ed[_0x5952('0x40')]=qs[_0x5952('0x41')](_0x46e972['query'][_0x5952('0x41')]);_0x19a4ed[_0x5952('0x42')]=qs[_0x5952('0x43')](_[_0x5952('0x44')](_0x46e972[_0x5952('0x39')],_0x85d521['filters']));if(_0x46e972[_0x5952('0x39')][_0x5952('0x45')]){_0x19a4ed[_0x5952('0x42')]=_['merge'](_0x19a4ed['where'],{'$or':_[_0x5952('0x46')](_0x4c00f7,function(_0x51ec4b){if(_0x51ec4b[_0x5952('0x47')]!==_0x5952('0x48')){var _0x1cdbda={};_0x1cdbda[_0x51ec4b[_0x5952('0x33')]]={'$like':'%'+_0x46e972[_0x5952('0x39')]['filter']+'%'};return _0x1cdbda;}})});}_0x19a4ed=_['merge']({},_0x19a4ed,_0x46e972[_0x5952('0x49')]);var _0x48d5d7={'where':_0x19a4ed['where']};return db[_0x5952('0x36')][_0x5952('0x28')](_0x48d5d7)[_0x5952('0x30')](function(_0x5e7936){_0xaf01fd[_0x5952('0x28')]=_0x5e7936;if(_0x46e972[_0x5952('0x39')][_0x5952('0x4a')]){_0x19a4ed[_0x5952('0x4b')]=[{'all':!![]}];}return db[_0x5952('0x36')]['findAll'](_0x19a4ed);})[_0x5952('0x30')](function(_0x1e6fbd){_0xaf01fd[_0x5952('0x4c')]=_0x1e6fbd;return _0xaf01fd;})['then'](respondWithFilteredResult(_0x3a8ffc,_0x19a4ed))[_0x5952('0x25')](handleError(_0x3a8ffc,null));};exports[_0x5952('0x4d')]=function(_0x437bae,_0x5621a5){var _0x2b6f26={'raw':![],'where':{'id':_0x437bae['params']['id']}},_0x19a22e={};_0x19a22e['model']=_['keys'](db[_0x5952('0x36')][_0x5952('0x4e')]);_0x19a22e[_0x5952('0x39')]=_['keys'](_0x437bae[_0x5952('0x39')]);_0x19a22e[_0x5952('0x43')]=_[_0x5952('0x3a')](_0x19a22e[_0x5952('0x38')],_0x19a22e[_0x5952('0x39')]);_0x2b6f26[_0x5952('0x3b')]=_[_0x5952('0x3a')](_0x19a22e['model'],qs[_0x5952('0x3c')](_0x437bae[_0x5952('0x39')][_0x5952('0x3c')]));_0x2b6f26['attributes']=_0x2b6f26[_0x5952('0x3b')][_0x5952('0x4f')]?_0x2b6f26[_0x5952('0x3b')]:_0x19a22e[_0x5952('0x38')];if(_0x437bae[_0x5952('0x39')][_0x5952('0x4a')]){_0x2b6f26[_0x5952('0x4b')]=[{'all':!![]}];}_0x2b6f26=_[_0x5952('0x50')]({},_0x2b6f26,_0x437bae['options']);return db[_0x5952('0x36')][_0x5952('0x51')](_0x2b6f26)['then'](handleEntityNotFound(_0x5621a5,null))[_0x5952('0x30')](respondWithResult(_0x5621a5,null))[_0x5952('0x25')](handleError(_0x5621a5,null));};exports['create']=function(_0x534fbd,_0x55a060){return db[_0x5952('0x36')][_0x5952('0x52')](_0x534fbd[_0x5952('0x53')],{})['then'](respondWithResult(_0x55a060,0xc9))['catch'](handleError(_0x55a060,null));};exports['update']=function(_0x2a3e54,_0x2d6e1b){if(_0x2a3e54[_0x5952('0x53')]['id']){delete _0x2a3e54[_0x5952('0x53')]['id'];}return db[_0x5952('0x36')][_0x5952('0x51')]({'where':{'id':_0x2a3e54[_0x5952('0x54')]['id']}})[_0x5952('0x30')](handleEntityNotFound(_0x2d6e1b,null))[_0x5952('0x30')](saveUpdates(_0x2a3e54[_0x5952('0x53')],null))[_0x5952('0x30')](respondWithResult(_0x2d6e1b,null))[_0x5952('0x25')](handleError(_0x2d6e1b,null));};exports['destroy']=function(_0x18a727,_0xdfee29){return db[_0x5952('0x36')]['find']({'where':{'id':_0x18a727[_0x5952('0x54')]['id']}})['then'](handleEntityNotFound(_0xdfee29,null))[_0x5952('0x30')](removeEntity(_0xdfee29,null))[_0x5952('0x25')](handleError(_0xdfee29,null));};exports[_0x5952('0x55')]=function(_0x252fb5,_0x19748f,_0x598172){var _0x511f9b={};var _0x413ab4={};var _0xd89520;var _0xe4c2a3;return db['ZohoAccount'][_0x5952('0x56')]({'where':{'id':_0x252fb5['params']['id']}})['then'](handleEntityNotFound(_0x19748f,null))[_0x5952('0x30')](function(_0x111064){if(_0x111064){_0xd89520=_0x111064;_0x413ab4[_0x5952('0x38')]=_[_0x5952('0x57')](db[_0x5952('0x58')][_0x5952('0x4e')]);_0x413ab4[_0x5952('0x39')]=_[_0x5952('0x57')](_0x252fb5[_0x5952('0x39')]);_0x413ab4[_0x5952('0x43')]=_['intersection'](_0x413ab4[_0x5952('0x38')],_0x413ab4[_0x5952('0x39')]);_0x511f9b[_0x5952('0x3b')]=_[_0x5952('0x3a')](_0x413ab4['model'],qs[_0x5952('0x3c')](_0x252fb5['query'][_0x5952('0x3c')]));_0x511f9b[_0x5952('0x3b')]=_0x511f9b[_0x5952('0x3b')][_0x5952('0x4f')]?_0x511f9b[_0x5952('0x3b')]:_0x413ab4['model'];_0x511f9b[_0x5952('0x40')]=qs[_0x5952('0x41')](_0x252fb5[_0x5952('0x39')][_0x5952('0x41')]);_0x511f9b[_0x5952('0x42')]=qs['filters'](_[_0x5952('0x44')](_0x252fb5[_0x5952('0x39')],_0x413ab4[_0x5952('0x43')]));if(_0x252fb5[_0x5952('0x39')][_0x5952('0x45')]){_0x511f9b['where']=_['merge'](_0x511f9b[_0x5952('0x42')],{'$or':_[_0x5952('0x46')](_0x511f9b['attributes'],function(_0x245263){var _0x3ead9a={};_0x3ead9a[_0x245263]={'$like':'%'+_0x252fb5[_0x5952('0x39')]['filter']+'%'};return _0x3ead9a;})});}_0x511f9b=_['merge']({},_0x511f9b,_0x252fb5[_0x5952('0x49')]);return _0xd89520[_0x5952('0x55')](_0x511f9b);}})[_0x5952('0x30')](function(_0xe87891){if(_0xe87891){_0xe4c2a3=_0xe87891[_0x5952('0x4f')];if(!_0x252fb5[_0x5952('0x39')][_0x5952('0x3d')](_0x5952('0x3e'))){_0x511f9b['limit']=qs[_0x5952('0x3f')](_0x252fb5[_0x5952('0x39')][_0x5952('0x3f')]);_0x511f9b[_0x5952('0x29')]=qs[_0x5952('0x29')](_0x252fb5[_0x5952('0x39')][_0x5952('0x29')]);}return _0xd89520[_0x5952('0x55')](_0x511f9b);}})['then'](function(_0x193807){if(_0x193807){return _0x193807?{'count':_0xe4c2a3,'rows':_0x193807}:null;}})[_0x5952('0x30')](respondWithResult(_0x19748f,null))[_0x5952('0x25')](handleError(_0x19748f,null));};exports[_0x5952('0x59')]=function(_0x78e8c1,_0x3d6881,_0x10630e){if(_0x78e8c1[_0x5952('0x53')]['id']){delete _0x78e8c1[_0x5952('0x53')]['id'];}return db[_0x5952('0x36')][_0x5952('0x56')]({'where':{'id':_0x78e8c1[_0x5952('0x54')]['id']}})['then'](handleEntityNotFound(_0x3d6881,null))[_0x5952('0x30')](function(_0x2e01fc){if(_0x2e01fc){_0x78e8c1['body'][_0x5952('0x5a')]=_0x2e01fc['id'];_0x78e8c1[_0x5952('0x53')][_0x5952('0x5b')]=integrations[_0x5952('0x5c')](_0x78e8c1[_0x5952('0x53')]['channel'],_0x78e8c1['body'][_0x5952('0x47')]);_0x78e8c1['body'][_0x5952('0x5d')]=integrations['getDescriptions'](_0x78e8c1[_0x5952('0x53')][_0x5952('0x5e')],_0x78e8c1['body'][_0x5952('0x47')]);return db['ZohoConfiguration'][_0x5952('0x52')](_0x78e8c1[_0x5952('0x53')],{'include':[{'model':db[_0x5952('0x5f')],'as':'Subjects'},{'model':db[_0x5952('0x5f')],'as':_0x5952('0x5d')}]});}return null;})[_0x5952('0x30')](respondWithResult(_0x3d6881,null))[_0x5952('0x25')](handleError(_0x3d6881,null));};function getAccessToken(_0x2b4d68){return new Promise(function(_0x31c121,_0x2e1cd7){var _0x38eb5b;switch(_0x2b4d68[_0x5952('0x60')]){case'US':_0x38eb5b='https://accounts.zoho.com';break;case'AU':_0x38eb5b='https://accounts.zoho.com.au';break;case'EU':_0x38eb5b='https://accounts.zoho.eu';break;case'IN':_0x38eb5b=_0x5952('0x61');break;case'CN':_0x38eb5b='https://accounts.zoho.com.cn';break;default:_0x38eb5b=_0x5952('0x62');break;}var _0x51921f={'method':_0x5952('0x63'),'uri':_0x38eb5b+'/oauth/v2/token','qs':{'refresh_token':_0x2b4d68[_0x5952('0x64')],'client_id':_0x2b4d68[_0x5952('0x65')],'client_secret':_0x2b4d68['clientSecret'],'grant_type':_0x5952('0x66')},'json':!![]};return rp(_0x51921f)['then'](function(_0x5e3e57){if(_0x5e3e57[_0x5952('0x67')]){_0x31c121(_0x5e3e57[_0x5952('0x67')]);}else{_0x2e1cd7(_0x5952('0x68'));}})['catch'](function(_0x539cf7){_0x2e1cd7(_0x539cf7);});});}exports[_0x5952('0x69')]=function(_0x4e13c9,_0x144b5f,_0x220c8e){var _0x24bf5d,_0x13e817,_0x1a33e1,_0x1347a5,_0x464061;return db[_0x5952('0x36')][_0x5952('0x56')]({'where':{'id':_0x4e13c9[_0x5952('0x54')]['id']},'attributes':['id',_0x5952('0x6a'),_0x5952('0x60'),_0x5952('0x65'),_0x5952('0x6b'),'serverUrl','code',_0x5952('0x64')]})['then'](handleEntityNotFound(_0x144b5f,null))['then'](function(_0x253a45){_0x464061=_0x253a45;_0x24bf5d=_0x464061[_0x5952('0x6a')];_0x13e817=_0x24bf5d===_0x5952('0x6c')?'eu':_0x5952('0x6d');_0x1a33e1=_0x464061[_0x5952('0x6e')];var _0xe704a5=_0x1a33e1[_0x5952('0x6f')](-0x1);if(_0xe704a5==='/'||_0xe704a5==='\x5c'||_0xe704a5===':'){_0x1a33e1=_0x1a33e1[_0x5952('0x70')](0x0,_0x1a33e1[_0x5952('0x71')](_0xe704a5));}if(!_0x464061['refreshToken']){throw new Error('Refresh\x20Token\x20not\x20available\x20for\x20the\x20account');}return getAccessToken(_0x464061);})['then'](function(_0x1b9436){if(_0x1b9436){return rp({'method':_0x5952('0x72'),'uri':util[_0x5952('0x73')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x13e817),'qs':{'module':_0x5952('0x74')},'headers':{'Authorization':_0x5952('0x75')+_0x1b9436},'json':!![]});}})['then'](function(_0x119a55){if(_0x119a55){if(_0x119a55[_0x5952('0x76')]&&_0x119a55[_0x5952('0x76')][_0x5952('0x20')]){throw new Error(_0x119a55[_0x5952('0x76')]['error'][_0x5952('0x22')]);}var _0x175cb8=[];var _0x15ba41=[];var _0xe80979=[_0x5952('0x77'),'Subject',_0x5952('0x78'),_0x5952('0x79'),_0x5952('0x7a'),_0x5952('0x7b'),'Call_Start_Time',_0x5952('0x7c')];_0x15ba41=_['remove'](_0x119a55[_0x5952('0x3c')],function(_0x1ecb24){return _0xe80979[_0x5952('0x7d')](_0x1ecb24[_0x5952('0x7e')]);});for(var _0x1f38ce=0x0;_0x1f38ce<_0x15ba41['length'];_0x1f38ce++){if(_0x15ba41[_0x1f38ce][_0x5952('0x7f')]===![]){_0x175cb8['push']({'id':_0x15ba41[_0x1f38ce]['id'],'name':_0x15ba41[_0x1f38ce][_0x5952('0x80')],'custom':_0x15ba41[_0x1f38ce][_0x5952('0x81')],'options':_0x15ba41[_0x1f38ce][_0x5952('0x82')]==='picklist'&&_0x15ba41[_0x1f38ce]['pick_list_values'][_0x5952('0x4f')]>-0x1?_[_0x5952('0x46')](_0x15ba41[_0x1f38ce][_0x5952('0x83')],function(_0x31dd3c){return{'name':_0x31dd3c,'value':_0x31dd3c};}):[]});}}return{'count':_0x175cb8[_0x5952('0x4f')],'rows':_0x175cb8};}else{return{'count':0x0,'rows':[]};}})[_0x5952('0x30')](respondWithResult(_0x144b5f,null))[_0x5952('0x25')](function(_0x3d1878){var _0x2e028d=_0x4e13c9[_0x5952('0x39')][_0x5952('0x84')]?0x1f4:_0x3d1878[_0x5952('0x85')]||0x1f4;logger[_0x5952('0x20')](_0x5952('0x86'),'getFields',_0x2e028d,JSON[_0x5952('0x87')](_0x3d1878));delete _0x3d1878[_0x5952('0x33')];if(_0x2e028d===0x191){_0x2e028d=0x190;}_0x144b5f[_0x5952('0x27')](_0x2e028d)[_0x5952('0x34')](_0x4e13c9['query'][_0x5952('0x84')]?{'message':'Wrong\x20credentials','statusCode':_0x3d1878['statusCode']}:_0x3d1878);});}; \ No newline at end of file +var _0x5f79=['includes','push','display_label','custom_field','data_type','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','jayson/promise','client','test','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','set','Content-Range','save','update','destroy','end','name','send','index','map','ZohoAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','merge','VIRTUAL','count','includeAll','include','show','keys','options','find','create','params','getConfigurations','findOne','ZohoConfiguration','pick','addConfiguration','body','AccountId','Subjects','channel','Descriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','serverUrl','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','https://www.zohoapis.%s/crm/v2/settings/fields','Zoho-oauthtoken\x20','response','Owner','Subject','Description','Call_Duration','Call_Result','Call_Start_Time','Call_Type'];(function(_0x213c63,_0x420de6){var _0x300bfb=function(_0x5d0b2e){while(--_0x5d0b2e){_0x213c63['push'](_0x213c63['shift']());}};_0x300bfb(++_0x420de6);}(_0x5f79,0x92));var _0x95f7=function(_0x4706a6,_0x5a1c63){_0x4706a6=_0x4706a6-0x0;var _0x1bb705=_0x5f79[_0x4706a6];return _0x1bb705;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x95f7('0x0'));var rimraf=require(_0x95f7('0x1'));var zipdir=require(_0x95f7('0x2'));var jsonpatch=require(_0x95f7('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x95f7('0x4'));var Mustache=require(_0x95f7('0x5'));var util=require(_0x95f7('0x6'));var path=require('path');var sox=require(_0x95f7('0x7'));var csv=require('to-csv');var ejs=require(_0x95f7('0x8'));var fs=require('fs');var _=require(_0x95f7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x95f7('0xa'));var deskjs=require(_0x95f7('0xb'));var toCsv=require(_0x95f7('0xc'));var querystring=require(_0x95f7('0xd'));var Papa=require(_0x95f7('0xe'));var Redis=require(_0x95f7('0xf'));var authService=require(_0x95f7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x95f7('0x11'));var hardwareService=require(_0x95f7('0x12'));var logger=require(_0x95f7('0x13'))(_0x95f7('0x14'));var utils=require(_0x95f7('0x15'));var config=require(_0x95f7('0x16'));var db=require(_0x95f7('0x17'))['db'];var integrations=require(_0x95f7('0x18'));var jayson=require(_0x95f7('0x19'));var client=jayson[_0x95f7('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x54b8d1,_0x3d8d1e,_0x4d0de1){if(_0x4d0de1){var _0x14bb8b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14bb8b[_0x95f7('0x1b')](_0x3d8d1e)){return _0x54b8d1;}else{throw new db['Sequelize']['ValidationError']('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');}}else{return _0x54b8d1;}}function respondWithRpcPromise(_0x22f374,_0x4bb8e5,_0x1ccbf7,_0x22e66d){return new BPromise(function(_0x4747af,_0x2675d6){var _0x50998e=_0x22e66d||client;return _0x50998e[_0x95f7('0x1c')](_0x22f374,_0x1ccbf7)[_0x95f7('0x1d')](function(_0x22049f){logger[_0x95f7('0x1e')](_0x95f7('0x1f'),_0x4bb8e5,_0x95f7('0x20'));logger['debug'](_0x95f7('0x21'),_0x4bb8e5,_0x95f7('0x20'),JSON[_0x95f7('0x22')](_0x22049f));if(_0x22049f[_0x95f7('0x23')]){if(_0x22049f['error']['code']===0x1f4){logger['error'](_0x95f7('0x1f'),_0x4bb8e5,_0x22049f[_0x95f7('0x23')][_0x95f7('0x24')]);return _0x2675d6(_0x22049f['error'][_0x95f7('0x24')]);}logger[_0x95f7('0x23')](_0x95f7('0x1f'),_0x4bb8e5,_0x22049f['error']['message']);return _0x4747af(_0x22049f[_0x95f7('0x23')]['message']);}else{logger[_0x95f7('0x1e')](_0x95f7('0x1f'),_0x4bb8e5,'request\x20sent');_0x4747af(_0x22049f['result'][_0x95f7('0x24')]);}})[_0x95f7('0x25')](function(_0x16d248){logger[_0x95f7('0x23')](_0x95f7('0x1f'),_0x4bb8e5,_0x16d248);_0x2675d6(_0x16d248);});});}function respondWithStatusCode(_0xf554f4,_0xd58dc4){_0xd58dc4=_0xd58dc4||0xcc;return function(_0x4f78e6){if(_0x4f78e6){return _0xf554f4[_0x95f7('0x26')](_0xd58dc4);}return _0xf554f4[_0x95f7('0x27')](_0xd58dc4)['end']();};}function respondWithResult(_0x239e4a,_0x1ae3a8){_0x1ae3a8=_0x1ae3a8||0xc8;return function(_0x1a432e){if(_0x1a432e){return _0x239e4a[_0x95f7('0x27')](_0x1ae3a8)[_0x95f7('0x28')](_0x1a432e);}};}function respondWithFilteredResult(_0x3a5730,_0x1aaf12){return function(_0x397a39){if(_0x397a39){var _0x38aa10=_0x397a39['count'],_0xeedf86=_0x1aaf12[_0x95f7('0x29')],_0x414132=_0x1aaf12[_0x95f7('0x29')]+_0x1aaf12['limit'],_0x27e35c;if(_0x414132>=_0x38aa10){_0x414132=_0x38aa10;_0x27e35c=0xc8;}else{_0x27e35c=0xce;}_0x3a5730[_0x95f7('0x27')](_0x27e35c);return _0x3a5730[_0x95f7('0x2a')](_0x95f7('0x2b'),_0xeedf86+'-'+_0x414132+'/'+_0x38aa10)[_0x95f7('0x28')](_0x397a39);}return null;};}function patchUpdates(_0x375bfd){return function(_0x304a20){try{jsonpatch['apply'](_0x304a20,_0x375bfd,!![]);}catch(_0x2ff663){return BPromise['reject'](_0x2ff663);}return _0x304a20[_0x95f7('0x2c')]();};}function saveUpdates(_0x2e9371,_0x2bba8d){return function(_0x170c1d){if(_0x170c1d){return _0x170c1d[_0x95f7('0x2d')](_0x2e9371)[_0x95f7('0x1d')](function(_0x221c40){return _0x221c40;});}return null;};}function removeEntity(_0x5049a8,_0x48392d){return function(_0x573c52){if(_0x573c52){return _0x573c52[_0x95f7('0x2e')]()[_0x95f7('0x1d')](function(){_0x5049a8[_0x95f7('0x27')](0xcc)[_0x95f7('0x2f')]();});}};}function handleEntityNotFound(_0x4daf44,_0x34e90c){return function(_0x320600){if(!_0x320600){_0x4daf44[_0x95f7('0x26')](0x194);}return _0x320600;};}function handleError(_0x78f362,_0x4e8894){_0x4e8894=_0x4e8894||0x1f4;return function(_0x907360){logger[_0x95f7('0x23')](_0x907360['stack']);if(_0x907360[_0x95f7('0x30')]){delete _0x907360[_0x95f7('0x30')];}_0x78f362[_0x95f7('0x27')](_0x4e8894)[_0x95f7('0x31')](_0x907360);};}exports[_0x95f7('0x32')]=function(_0xbfca4b,_0x3062b2){var _0x461d40={},_0x4595a1={},_0x3b331f={'count':0x0,'rows':[]};var _0x3493dc=_[_0x95f7('0x33')](db[_0x95f7('0x34')][_0x95f7('0x35')],function(_0x42b445){return{'name':_0x42b445[_0x95f7('0x36')],'type':_0x42b445[_0x95f7('0x37')][_0x95f7('0x38')]};});_0x4595a1[_0x95f7('0x39')]=_[_0x95f7('0x33')](_0x3493dc,_0x95f7('0x30'));_0x4595a1[_0x95f7('0x3a')]=_['keys'](_0xbfca4b[_0x95f7('0x3a')]);_0x4595a1[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0x4595a1['model'],_0x4595a1[_0x95f7('0x3a')]);_0x461d40[_0x95f7('0x3d')]=_[_0x95f7('0x3c')](_0x4595a1[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x461d40[_0x95f7('0x3d')]=_0x461d40['attributes'][_0x95f7('0x3f')]?_0x461d40[_0x95f7('0x3d')]:_0x4595a1['model'];if(!_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x40')](_0x95f7('0x41'))){_0x461d40[_0x95f7('0x42')]=qs[_0x95f7('0x42')](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x42')]);_0x461d40[_0x95f7('0x29')]=qs['offset'](_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x29')]);}_0x461d40[_0x95f7('0x43')]=qs[_0x95f7('0x44')](_0xbfca4b[_0x95f7('0x3a')]['sort']);_0x461d40[_0x95f7('0x45')]=qs[_0x95f7('0x3b')](_['pick'](_0xbfca4b[_0x95f7('0x3a')],_0x4595a1[_0x95f7('0x3b')]));if(_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x46')]){_0x461d40[_0x95f7('0x45')]=_[_0x95f7('0x47')](_0x461d40[_0x95f7('0x45')],{'$or':_[_0x95f7('0x33')](_0x3493dc,function(_0x2c05f2){if(_0x2c05f2[_0x95f7('0x37')]!==_0x95f7('0x48')){var _0x4f74e6={};_0x4f74e6[_0x2c05f2[_0x95f7('0x30')]]={'$like':'%'+_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x46')]+'%'};return _0x4f74e6;}})});}_0x461d40=_[_0x95f7('0x47')]({},_0x461d40,_0xbfca4b['options']);var _0x11c2ae={'where':_0x461d40[_0x95f7('0x45')]};return db['ZohoAccount'][_0x95f7('0x49')](_0x11c2ae)[_0x95f7('0x1d')](function(_0x363d62){_0x3b331f['count']=_0x363d62;if(_0xbfca4b[_0x95f7('0x3a')][_0x95f7('0x4a')]){_0x461d40[_0x95f7('0x4b')]=[{'all':!![]}];}return db[_0x95f7('0x34')]['findAll'](_0x461d40);})[_0x95f7('0x1d')](function(_0x8267){_0x3b331f['rows']=_0x8267;return _0x3b331f;})[_0x95f7('0x1d')](respondWithFilteredResult(_0x3062b2,_0x461d40))[_0x95f7('0x25')](handleError(_0x3062b2,null));};exports[_0x95f7('0x4c')]=function(_0xac227c,_0x2627bb){var _0x225157={'raw':![],'where':{'id':_0xac227c['params']['id']}},_0x33ad14={};_0x33ad14[_0x95f7('0x39')]=_[_0x95f7('0x4d')](db[_0x95f7('0x34')]['rawAttributes']);_0x33ad14[_0x95f7('0x3a')]=_[_0x95f7('0x4d')](_0xac227c['query']);_0x33ad14[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0x33ad14[_0x95f7('0x39')],_0x33ad14[_0x95f7('0x3a')]);_0x225157[_0x95f7('0x3d')]=_['intersection'](_0x33ad14[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0xac227c[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x225157[_0x95f7('0x3d')]=_0x225157[_0x95f7('0x3d')]['length']?_0x225157[_0x95f7('0x3d')]:_0x33ad14[_0x95f7('0x39')];if(_0xac227c[_0x95f7('0x3a')][_0x95f7('0x4a')]){_0x225157['include']=[{'all':!![]}];}_0x225157=_[_0x95f7('0x47')]({},_0x225157,_0xac227c[_0x95f7('0x4e')]);return db['ZohoAccount'][_0x95f7('0x4f')](_0x225157)[_0x95f7('0x1d')](handleEntityNotFound(_0x2627bb,null))[_0x95f7('0x1d')](respondWithResult(_0x2627bb,null))[_0x95f7('0x25')](handleError(_0x2627bb,null));};exports[_0x95f7('0x50')]=function(_0x4ea286,_0x463be6){return db[_0x95f7('0x34')][_0x95f7('0x50')](_0x4ea286['body'],{})[_0x95f7('0x1d')](respondWithResult(_0x463be6,0xc9))[_0x95f7('0x25')](handleError(_0x463be6,null));};exports['update']=function(_0x14b30d,_0x39b04e){if(_0x14b30d['body']['id']){delete _0x14b30d['body']['id'];}return db[_0x95f7('0x34')][_0x95f7('0x4f')]({'where':{'id':_0x14b30d['params']['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x39b04e,null))['then'](saveUpdates(_0x14b30d['body'],null))[_0x95f7('0x1d')](respondWithResult(_0x39b04e,null))['catch'](handleError(_0x39b04e,null));};exports[_0x95f7('0x2e')]=function(_0x5592c8,_0x3760e6){return db['ZohoAccount'][_0x95f7('0x4f')]({'where':{'id':_0x5592c8[_0x95f7('0x51')]['id']}})['then'](handleEntityNotFound(_0x3760e6,null))[_0x95f7('0x1d')](removeEntity(_0x3760e6,null))[_0x95f7('0x25')](handleError(_0x3760e6,null));};exports[_0x95f7('0x52')]=function(_0x33b6fe,_0x80b814,_0x14314a){var _0x1e1290={};var _0xd37af0={};var _0x36cb94;var _0x26b067;return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x33b6fe[_0x95f7('0x51')]['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x80b814,null))['then'](function(_0x3472e0){if(_0x3472e0){_0x36cb94=_0x3472e0;_0xd37af0[_0x95f7('0x39')]=_['keys'](db[_0x95f7('0x54')][_0x95f7('0x35')]);_0xd37af0[_0x95f7('0x3a')]=_[_0x95f7('0x4d')](_0x33b6fe['query']);_0xd37af0[_0x95f7('0x3b')]=_[_0x95f7('0x3c')](_0xd37af0[_0x95f7('0x39')],_0xd37af0[_0x95f7('0x3a')]);_0x1e1290[_0x95f7('0x3d')]=_[_0x95f7('0x3c')](_0xd37af0[_0x95f7('0x39')],qs[_0x95f7('0x3e')](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x3e')]));_0x1e1290[_0x95f7('0x3d')]=_0x1e1290[_0x95f7('0x3d')][_0x95f7('0x3f')]?_0x1e1290[_0x95f7('0x3d')]:_0xd37af0[_0x95f7('0x39')];_0x1e1290['order']=qs[_0x95f7('0x44')](_0x33b6fe['query'][_0x95f7('0x44')]);_0x1e1290['where']=qs[_0x95f7('0x3b')](_[_0x95f7('0x55')](_0x33b6fe[_0x95f7('0x3a')],_0xd37af0[_0x95f7('0x3b')]));if(_0x33b6fe['query'][_0x95f7('0x46')]){_0x1e1290[_0x95f7('0x45')]=_[_0x95f7('0x47')](_0x1e1290[_0x95f7('0x45')],{'$or':_[_0x95f7('0x33')](_0x1e1290[_0x95f7('0x3d')],function(_0x31752d){var _0x3d7ba9={};_0x3d7ba9[_0x31752d]={'$like':'%'+_0x33b6fe['query']['filter']+'%'};return _0x3d7ba9;})});}_0x1e1290=_['merge']({},_0x1e1290,_0x33b6fe['options']);return _0x36cb94[_0x95f7('0x52')](_0x1e1290);}})[_0x95f7('0x1d')](function(_0x12c134){if(_0x12c134){_0x26b067=_0x12c134[_0x95f7('0x3f')];if(!_0x33b6fe['query']['hasOwnProperty']('nolimit')){_0x1e1290[_0x95f7('0x42')]=qs[_0x95f7('0x42')](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x42')]);_0x1e1290[_0x95f7('0x29')]=qs['offset'](_0x33b6fe[_0x95f7('0x3a')][_0x95f7('0x29')]);}return _0x36cb94[_0x95f7('0x52')](_0x1e1290);}})['then'](function(_0x2a15e6){if(_0x2a15e6){return _0x2a15e6?{'count':_0x26b067,'rows':_0x2a15e6}:null;}})[_0x95f7('0x1d')](respondWithResult(_0x80b814,null))[_0x95f7('0x25')](handleError(_0x80b814,null));};exports[_0x95f7('0x56')]=function(_0x2aff63,_0x59cc55,_0x153821){if(_0x2aff63[_0x95f7('0x57')]['id']){delete _0x2aff63[_0x95f7('0x57')]['id'];}return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x2aff63[_0x95f7('0x51')]['id']}})[_0x95f7('0x1d')](handleEntityNotFound(_0x59cc55,null))[_0x95f7('0x1d')](function(_0x355254){if(_0x355254){_0x2aff63[_0x95f7('0x57')][_0x95f7('0x58')]=_0x355254['id'];_0x2aff63[_0x95f7('0x57')][_0x95f7('0x59')]=integrations['getSubjects'](_0x2aff63['body'][_0x95f7('0x5a')],_0x2aff63[_0x95f7('0x57')]['type']);_0x2aff63[_0x95f7('0x57')][_0x95f7('0x5b')]=integrations['getDescriptions'](_0x2aff63['body'][_0x95f7('0x5a')],_0x2aff63['body'][_0x95f7('0x37')]);return db[_0x95f7('0x54')][_0x95f7('0x50')](_0x2aff63[_0x95f7('0x57')],{'include':[{'model':db[_0x95f7('0x5c')],'as':_0x95f7('0x59')},{'model':db[_0x95f7('0x5c')],'as':_0x95f7('0x5b')}]});}return null;})[_0x95f7('0x1d')](respondWithResult(_0x59cc55,null))[_0x95f7('0x25')](handleError(_0x59cc55,null));};function getAccessToken(_0x1db41f){return new Promise(function(_0x4b955b,_0x44305a){var _0x1da344;switch(_0x1db41f[_0x95f7('0x5d')]){case'US':_0x1da344=_0x95f7('0x5e');break;case'AU':_0x1da344=_0x95f7('0x5f');break;case'EU':_0x1da344=_0x95f7('0x60');break;case'IN':_0x1da344=_0x95f7('0x61');break;case'CN':_0x1da344='https://accounts.zoho.com.cn';break;default:_0x1da344=_0x95f7('0x60');break;}var _0x3776a1={'method':_0x95f7('0x62'),'uri':_0x1da344+_0x95f7('0x63'),'qs':{'refresh_token':_0x1db41f[_0x95f7('0x64')],'client_id':_0x1db41f[_0x95f7('0x65')],'client_secret':_0x1db41f[_0x95f7('0x66')],'grant_type':_0x95f7('0x67')},'json':!![]};return rp(_0x3776a1)[_0x95f7('0x1d')](function(_0x241d20){if(_0x241d20['access_token']){_0x4b955b(_0x241d20[_0x95f7('0x68')]);}else{_0x44305a(_0x95f7('0x69'));}})[_0x95f7('0x25')](function(_0x29a77e){_0x44305a(_0x29a77e);});});}exports[_0x95f7('0x6a')]=function(_0x43ddc2,_0x61f920,_0x183ac0){var _0x4fc0dd,_0x169388,_0x8a2fa9,_0x310eeb,_0x741111;return db[_0x95f7('0x34')][_0x95f7('0x53')]({'where':{'id':_0x43ddc2['params']['id']},'attributes':['id',_0x95f7('0x6b'),_0x95f7('0x5d'),_0x95f7('0x65'),_0x95f7('0x66'),_0x95f7('0x6c'),'code',_0x95f7('0x64')]})['then'](handleEntityNotFound(_0x61f920,null))[_0x95f7('0x1d')](function(_0x39a3f8){_0x741111=_0x39a3f8;_0x4fc0dd=_0x741111['host'];_0x169388=_0x4fc0dd==='zoho.eu'?'eu':_0x95f7('0x6d');_0x8a2fa9=_0x741111['serverUrl'];var _0x3a2c12=_0x8a2fa9[_0x95f7('0x6e')](-0x1);if(_0x3a2c12==='/'||_0x3a2c12==='\x5c'||_0x3a2c12===':'){_0x8a2fa9=_0x8a2fa9[_0x95f7('0x6f')](0x0,_0x8a2fa9[_0x95f7('0x70')](_0x3a2c12));}if(!_0x741111[_0x95f7('0x64')]){throw new Error(_0x95f7('0x71'));}return getAccessToken(_0x741111);})[_0x95f7('0x1d')](function(_0x58a96c){if(_0x58a96c){return rp({'method':_0x95f7('0x72'),'uri':util[_0x95f7('0x73')](_0x95f7('0x74'),_0x169388),'qs':{'module':'Calls'},'headers':{'Authorization':_0x95f7('0x75')+_0x58a96c},'json':!![]});}})[_0x95f7('0x1d')](function(_0x473ed1){if(_0x473ed1){if(_0x473ed1['response']&&_0x473ed1[_0x95f7('0x76')][_0x95f7('0x23')]){throw new Error(_0x473ed1[_0x95f7('0x76')][_0x95f7('0x23')][_0x95f7('0x24')]);}var _0x6cb280=[];var _0x1cc382=[];var _0x5bf429=[_0x95f7('0x77'),_0x95f7('0x78'),_0x95f7('0x79'),'WhoId',_0x95f7('0x7a'),_0x95f7('0x7b'),_0x95f7('0x7c'),_0x95f7('0x7d')];_0x1cc382=_['remove'](_0x473ed1[_0x95f7('0x3e')],function(_0x1873f7){return _0x5bf429[_0x95f7('0x7e')](_0x1873f7['api_name']);});for(var _0x5a9b28=0x0;_0x5a9b28<_0x1cc382[_0x95f7('0x3f')];_0x5a9b28++){if(_0x1cc382[_0x5a9b28]['system_mandatory']===![]){_0x6cb280[_0x95f7('0x7f')]({'id':_0x1cc382[_0x5a9b28]['id'],'name':_0x1cc382[_0x5a9b28][_0x95f7('0x80')],'custom':_0x1cc382[_0x5a9b28][_0x95f7('0x81')],'options':_0x1cc382[_0x5a9b28][_0x95f7('0x82')]===_0x95f7('0x83')&&_0x1cc382[_0x5a9b28][_0x95f7('0x84')][_0x95f7('0x3f')]>-0x1?_[_0x95f7('0x33')](_0x1cc382[_0x5a9b28][_0x95f7('0x84')],function(_0x2a10f8){return{'name':_0x2a10f8,'value':_0x2a10f8};}):[]});}}return{'count':_0x6cb280[_0x95f7('0x3f')],'rows':_0x6cb280};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithResult(_0x61f920,null))[_0x95f7('0x25')](function(_0x369729){var _0x105746=_0x43ddc2[_0x95f7('0x3a')][_0x95f7('0x1b')]?0x1f4:_0x369729[_0x95f7('0x85')]||0x1f4;logger[_0x95f7('0x23')](_0x95f7('0x86'),'getFields',_0x105746,JSON['stringify'](_0x369729));delete _0x369729['name'];if(_0x105746===0x191){_0x105746=0x190;}_0x61f920[_0x95f7('0x27')](_0x105746)[_0x95f7('0x31')](_0x43ddc2[_0x95f7('0x3a')]['test']?{'message':_0x95f7('0x87'),'statusCode':_0x369729[_0x95f7('0x85')]}:_0x369729);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 0b4b3c9..075a253 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 _0xd720=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','int_zoho_accounts','changed','serverUrl','clientId','clientSecret','code','host','slice','substring','zone','https://accounts.zoho.com','https://accounts.zoho.com.cn','/oauth/v2/token','authorization_code','then','parse','refresh_token','info','format','name','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','catch','lastIndexOf','https://accounts.zoho.eu','refreshToken','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','inspect'];(function(_0xe56be6,_0x32627c){var _0x7d5bd9=function(_0x1d2cb4){while(--_0x1d2cb4){_0xe56be6['push'](_0xe56be6['shift']());}};_0x7d5bd9(++_0x32627c);}(_0xd720,0x1ae));var _0x0d72=function(_0x3aa339,_0x4a4d04){_0x3aa339=_0x3aa339-0x0;var _0x29b4b7=_0xd720[_0x3aa339];return _0x29b4b7;};'use strict';var _=require(_0x0d72('0x0'));var util=require(_0x0d72('0x1'));var logger=require(_0x0d72('0x2'))(_0x0d72('0x3'));var moment=require(_0x0d72('0x4'));var BPromise=require(_0x0d72('0x5'));var rp=require(_0x0d72('0x6'));var fs=require('fs');var path=require(_0x0d72('0x7'));var rimraf=require(_0x0d72('0x8'));var config=require(_0x0d72('0x9'));var attributes=require(_0x0d72('0xa'));var integrations=require(_0x0d72('0xb'));module[_0x0d72('0xc')]=function(_0x3ee5dd,_0x30b31c){return _0x3ee5dd[_0x0d72('0xd')](_0x0d72('0xe'),attributes,{'tableName':_0x0d72('0xf'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x120b11,_0x2c21f2,_0x1e5548){if(_0x120b11[_0x0d72('0x10')]('zone')||_0x120b11[_0x0d72('0x10')](_0x0d72('0x11'))||_0x120b11['changed'](_0x0d72('0x12'))||_0x120b11[_0x0d72('0x10')](_0x0d72('0x13'))||_0x120b11[_0x0d72('0x10')](_0x0d72('0x14'))||_0x120b11[_0x0d72('0x10')](_0x0d72('0x15'))){var _0x5e64ce,_0xbc2bf;_0x5e64ce=_0x120b11[_0x0d72('0x11')];var _0x227d93=_0x5e64ce[_0x0d72('0x16')](-0x1);if(_0x227d93==='/'||_0x227d93==='\x5c'||_0x227d93===':'){_0x5e64ce=_0x5e64ce[_0x0d72('0x17')](0x0,_0x5e64ce['lastIndexOf'](_0x227d93));}switch(_0x120b11[_0x0d72('0x18')]){case'US':_0xbc2bf=_0x0d72('0x19');break;case'AU':_0xbc2bf='https://accounts.zoho.com.au';break;case'IN':_0xbc2bf='https://accounts.zoho.in';break;case'CN':_0xbc2bf=_0x0d72('0x1a');break;default:_0xbc2bf='https://accounts.zoho.eu';break;}var _0x8096a5={'method':'POST','uri':_0xbc2bf+_0x0d72('0x1b'),'form':{'grant_type':_0x0d72('0x1c'),'client_id':_0x120b11[_0x0d72('0x12')],'client_secret':_0x120b11[_0x0d72('0x13')],'redirect_uri':_0x120b11[_0x0d72('0x11')],'code':_0x120b11['code']},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x8096a5)[_0x0d72('0x1d')](function(_0x38d20c){var _0x537657=JSON[_0x0d72('0x1e')](_0x38d20c);if(_0x537657[_0x0d72('0x1f')]){_0x120b11['refreshToken']=_0x537657[_0x0d72('0x1f')];logger[_0x0d72('0x20')](util[_0x0d72('0x21')]('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x120b11[_0x0d72('0x22')],_0x120b11['id']));}else{logger['error'](util[_0x0d72('0x21')](_0x0d72('0x23'),_0x120b11[_0x0d72('0x22')],_0x120b11['id']),util['inspect'](_0x537657,{'showHidden':![],'depth':null}));}return _0x1e5548(null,_0x2c21f2);})[_0x0d72('0x24')](function(_0x334af2){logger['error'](util[_0x0d72('0x21')](_0x0d72('0x23'),_0x120b11[_0x0d72('0x22')],_0x120b11['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x1e5548(_0x334af2);});}else{return _0x1e5548(null,_0x2c21f2);}},'beforeUpdate':function(_0x169038,_0x1c1c95,_0x10c4a8){if(_0x169038[_0x0d72('0x10')](_0x0d72('0x18'))||_0x169038[_0x0d72('0x10')](_0x0d72('0x11'))||_0x169038['changed'](_0x0d72('0x12'))||_0x169038[_0x0d72('0x10')](_0x0d72('0x13'))||_0x169038[_0x0d72('0x10')]('code')||_0x169038[_0x0d72('0x10')](_0x0d72('0x15'))){var _0x1230b3,_0x5295c7;_0x1230b3=_0x169038[_0x0d72('0x11')];var _0x4328c3=_0x1230b3['slice'](-0x1);if(_0x4328c3==='/'||_0x4328c3==='\x5c'||_0x4328c3===':'){_0x1230b3=_0x1230b3['substring'](0x0,_0x1230b3[_0x0d72('0x25')](_0x4328c3));}switch(_0x169038[_0x0d72('0x18')]){case'US':_0x5295c7='https://accounts.zoho.com';break;case'AU':_0x5295c7='https://accounts.zoho.com.au';break;case'IN':_0x5295c7='https://accounts.zoho.in';break;case'CN':_0x5295c7=_0x0d72('0x1a');break;default:_0x5295c7=_0x0d72('0x26');break;}var _0x37f127={'method':'POST','uri':_0x5295c7+_0x0d72('0x1b'),'form':{'grant_type':_0x0d72('0x1c'),'client_id':_0x169038[_0x0d72('0x12')],'client_secret':_0x169038[_0x0d72('0x13')],'redirect_uri':_0x169038[_0x0d72('0x11')],'code':_0x169038[_0x0d72('0x14')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x37f127)[_0x0d72('0x1d')](function(_0x15141a){var _0x500203=JSON[_0x0d72('0x1e')](_0x15141a);if(_0x500203['refresh_token']){_0x169038[_0x0d72('0x27')]=_0x500203[_0x0d72('0x1f')];logger['info'](util[_0x0d72('0x21')](_0x0d72('0x28'),_0x169038[_0x0d72('0x22')],_0x169038['id']));}else{logger[_0x0d72('0x29')](util['format'](_0x0d72('0x23'),_0x169038[_0x0d72('0x22')],_0x169038['id']),util[_0x0d72('0x2a')](_0x500203,{'showHidden':![],'depth':null}));}return _0x10c4a8(null,_0x1c1c95);})[_0x0d72('0x24')](function(_0x436693){logger[_0x0d72('0x29')](util[_0x0d72('0x21')](_0x0d72('0x23'),_0x169038['name'],_0x169038['id']),util[_0x0d72('0x2a')](parsedResult,{'showHidden':![],'depth':null}));return _0x10c4a8(_0x436693);});}else{return _0x10c4a8(null,_0x1c1c95);}}}});}; \ No newline at end of file +var _0x7c3e=['catch','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','code','host','slice','lastIndexOf','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','application/x-www-form-urlencoded','parse','refresh_token','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','format','inspect','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','substring','https://accounts.zoho.eu','/oauth/v2/token','then','refreshToken'];(function(_0x5982fd,_0x3ce959){var _0x238b15=function(_0x1203b7){while(--_0x1203b7){_0x5982fd['push'](_0x5982fd['shift']());}};_0x238b15(++_0x3ce959);}(_0x7c3e,0x1da));var _0xe7c3=function(_0x3480f2,_0x4947fa){_0x3480f2=_0x3480f2-0x0;var _0x1e4899=_0x7c3e[_0x3480f2];return _0x1e4899;};'use strict';var _=require(_0xe7c3('0x0'));var util=require('util');var logger=require(_0xe7c3('0x1'))(_0xe7c3('0x2'));var moment=require(_0xe7c3('0x3'));var BPromise=require(_0xe7c3('0x4'));var rp=require(_0xe7c3('0x5'));var fs=require('fs');var path=require(_0xe7c3('0x6'));var rimraf=require(_0xe7c3('0x7'));var config=require(_0xe7c3('0x8'));var attributes=require(_0xe7c3('0x9'));var integrations=require(_0xe7c3('0xa'));module[_0xe7c3('0xb')]=function(_0x50fbd3,_0x3045c4){return _0x50fbd3[_0xe7c3('0xc')]('ZohoAccount',attributes,{'tableName':_0xe7c3('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26daa5,_0x1c0f42,_0x291da2){if(_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0xf'))||_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0x10'))||_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0x11'))||_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0x12'))||_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0x13'))||_0x26daa5[_0xe7c3('0xe')](_0xe7c3('0x14'))){var _0x584789,_0x3e3002;_0x584789=_0x26daa5[_0xe7c3('0x10')];var _0x1e66c2=_0x584789[_0xe7c3('0x15')](-0x1);if(_0x1e66c2==='/'||_0x1e66c2==='\x5c'||_0x1e66c2===':'){_0x584789=_0x584789['substring'](0x0,_0x584789[_0xe7c3('0x16')](_0x1e66c2));}switch(_0x26daa5[_0xe7c3('0xf')]){case'US':_0x3e3002=_0xe7c3('0x17');break;case'AU':_0x3e3002=_0xe7c3('0x18');break;case'IN':_0x3e3002=_0xe7c3('0x19');break;case'CN':_0x3e3002=_0xe7c3('0x1a');break;default:_0x3e3002='https://accounts.zoho.eu';break;}var _0x3c05e1={'method':_0xe7c3('0x1b'),'uri':_0x3e3002+'/oauth/v2/token','form':{'grant_type':'authorization_code','client_id':_0x26daa5[_0xe7c3('0x11')],'client_secret':_0x26daa5[_0xe7c3('0x12')],'redirect_uri':_0x26daa5[_0xe7c3('0x10')],'code':_0x26daa5[_0xe7c3('0x13')]},'headers':{'Content-Type':_0xe7c3('0x1c')}};return rp(_0x3c05e1)['then'](function(_0x8255b2){var _0x72a86f=JSON[_0xe7c3('0x1d')](_0x8255b2);if(_0x72a86f['refresh_token']){_0x26daa5['refreshToken']=_0x72a86f[_0xe7c3('0x1e')];logger['info'](util['format'](_0xe7c3('0x1f'),_0x26daa5[_0xe7c3('0x20')],_0x26daa5['id']));}else{logger[_0xe7c3('0x21')](util[_0xe7c3('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x26daa5[_0xe7c3('0x20')],_0x26daa5['id']),util[_0xe7c3('0x23')](_0x72a86f,{'showHidden':![],'depth':null}));}return _0x291da2(null,_0x1c0f42);})['catch'](function(_0x1479ba){logger[_0xe7c3('0x21')](util[_0xe7c3('0x22')](_0xe7c3('0x24'),_0x26daa5[_0xe7c3('0x20')],_0x26daa5['id']),util[_0xe7c3('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x291da2(_0x1479ba);});}else{return _0x291da2(null,_0x1c0f42);}},'beforeUpdate':function(_0x36f673,_0x4de769,_0x3ef592){if(_0x36f673[_0xe7c3('0xe')]('zone')||_0x36f673[_0xe7c3('0xe')](_0xe7c3('0x10'))||_0x36f673[_0xe7c3('0xe')](_0xe7c3('0x11'))||_0x36f673[_0xe7c3('0xe')]('clientSecret')||_0x36f673[_0xe7c3('0xe')]('code')||_0x36f673[_0xe7c3('0xe')](_0xe7c3('0x14'))){var _0x23c9fc,_0x16607b;_0x23c9fc=_0x36f673['serverUrl'];var _0x3d25df=_0x23c9fc[_0xe7c3('0x15')](-0x1);if(_0x3d25df==='/'||_0x3d25df==='\x5c'||_0x3d25df===':'){_0x23c9fc=_0x23c9fc[_0xe7c3('0x25')](0x0,_0x23c9fc[_0xe7c3('0x16')](_0x3d25df));}switch(_0x36f673[_0xe7c3('0xf')]){case'US':_0x16607b=_0xe7c3('0x17');break;case'AU':_0x16607b=_0xe7c3('0x18');break;case'IN':_0x16607b=_0xe7c3('0x19');break;case'CN':_0x16607b='https://accounts.zoho.com.cn';break;default:_0x16607b=_0xe7c3('0x26');break;}var _0x2c3459={'method':'POST','uri':_0x16607b+_0xe7c3('0x27'),'form':{'grant_type':'authorization_code','client_id':_0x36f673['clientId'],'client_secret':_0x36f673[_0xe7c3('0x12')],'redirect_uri':_0x36f673[_0xe7c3('0x10')],'code':_0x36f673[_0xe7c3('0x13')]},'headers':{'Content-Type':_0xe7c3('0x1c')}};return rp(_0x2c3459)[_0xe7c3('0x28')](function(_0x417c2c){var _0x121278=JSON[_0xe7c3('0x1d')](_0x417c2c);if(_0x121278[_0xe7c3('0x1e')]){_0x36f673[_0xe7c3('0x29')]=_0x121278[_0xe7c3('0x1e')];logger['info'](util['format'](_0xe7c3('0x1f'),_0x36f673[_0xe7c3('0x20')],_0x36f673['id']));}else{logger[_0xe7c3('0x21')](util['format'](_0xe7c3('0x24'),_0x36f673['name'],_0x36f673['id']),util[_0xe7c3('0x23')](_0x121278,{'showHidden':![],'depth':null}));}return _0x3ef592(null,_0x4de769);})[_0xe7c3('0x2a')](function(_0x48f4e0){logger[_0xe7c3('0x21')](util[_0xe7c3('0x22')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x36f673[_0xe7c3('0x20')],_0x36f673['id']),util[_0xe7c3('0x23')](parsedResult,{'showHidden':![],'depth':null}));return _0x3ef592(_0x48f4e0);});}else{return _0x3ef592(null,_0x4de769);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 0c782f4..fb81399 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 _0x1957=['error','code','message','result','ZohoAccount','findAll','options','raw','where','attributes','limit','include','map','model','GetZohoAccount','stringify','catch','ShowZohoAccount','find','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0x1957,0xeb));var _0x7195=function(_0x5b73e7,_0x40789d){_0x5b73e7=_0x5b73e7-0x0;var _0x594436=_0x1957[_0x5b73e7];return _0x594436;};'use strict';var _=require(_0x7195('0x0'));var util=require(_0x7195('0x1'));var moment=require(_0x7195('0x2'));var BPromise=require(_0x7195('0x3'));var rs=require(_0x7195('0x4'));var fs=require('fs');var Redis=require(_0x7195('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7195('0x6'));var logger=require(_0x7195('0x7'))(_0x7195('0x8'));var config=require('../../config/environment');var jayson=require(_0x7195('0x9'));var client=jayson['client'][_0x7195('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6d2b,_0x32079f,_0x49684d){return new BPromise(function(_0x10afd9,_0x5d5f68){return client[_0x7195('0xb')](_0x5a6d2b,_0x49684d)[_0x7195('0xc')](function(_0x4d5f0c){logger[_0x7195('0xd')](_0x7195('0xe'),_0x32079f,_0x7195('0xf'));logger[_0x7195('0x10')]('ZohoAccount,\x20%s,\x20%s,\x20%s',_0x32079f,'request\x20sent',JSON['stringify'](_0x4d5f0c));if(_0x4d5f0c[_0x7195('0x11')]){if(_0x4d5f0c[_0x7195('0x11')][_0x7195('0x12')]===0x1f4){logger[_0x7195('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x32079f,_0x4d5f0c[_0x7195('0x11')][_0x7195('0x13')]);return _0x5d5f68(_0x4d5f0c[_0x7195('0x11')]['message']);}logger['error'](_0x7195('0xe'),_0x32079f,_0x4d5f0c['error'][_0x7195('0x13')]);return _0x10afd9(_0x4d5f0c[_0x7195('0x11')][_0x7195('0x13')]);}else{logger[_0x7195('0xd')](_0x7195('0xe'),_0x32079f,'request\x20sent');_0x10afd9(_0x4d5f0c[_0x7195('0x14')]['message']);}})['catch'](function(_0x19731a){logger[_0x7195('0x11')](_0x7195('0xe'),_0x32079f,_0x19731a);_0x5d5f68(_0x19731a);});});}exports['GetZohoAccount']=function(_0x450e4d){var _0x438b0b=this;return new Promise(function(_0x3e0c97,_0x4ec106){return db[_0x7195('0x15')][_0x7195('0x16')]({'raw':_0x450e4d[_0x7195('0x17')]?_0x450e4d[_0x7195('0x17')][_0x7195('0x18')]===undefined?!![]:![]:!![],'where':_0x450e4d[_0x7195('0x17')]?_0x450e4d['options'][_0x7195('0x19')]||null:null,'attributes':_0x450e4d[_0x7195('0x17')]?_0x450e4d[_0x7195('0x17')][_0x7195('0x1a')]||null:null,'limit':_0x450e4d[_0x7195('0x17')]?_0x450e4d[_0x7195('0x17')][_0x7195('0x1b')]||null:null,'include':_0x450e4d[_0x7195('0x17')]?_0x450e4d[_0x7195('0x17')][_0x7195('0x1c')]?_[_0x7195('0x1d')](_0x450e4d['options'][_0x7195('0x1c')],function(_0x3000b9){return{'model':db[_0x3000b9['model']],'as':_0x3000b9['as'],'attributes':_0x3000b9['attributes'],'include':_0x3000b9[_0x7195('0x1c')]?_['map'](_0x3000b9[_0x7195('0x1c')],function(_0x38ac3b){return{'model':db[_0x38ac3b[_0x7195('0x1e')]],'as':_0x38ac3b['as'],'attributes':_0x38ac3b[_0x7195('0x1a')],'include':_0x38ac3b[_0x7195('0x1c')]?_[_0x7195('0x1d')](_0x38ac3b[_0x7195('0x1c')],function(_0x1ee607){return{'model':db[_0x1ee607[_0x7195('0x1e')]],'as':_0x1ee607['as'],'attributes':_0x1ee607[_0x7195('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x7195('0xc')](function(_0x16af9e){logger[_0x7195('0xd')](_0x7195('0x1f'),_0x450e4d);logger[_0x7195('0x10')](_0x7195('0x1f'),_0x450e4d,JSON[_0x7195('0x20')](_0x16af9e));_0x3e0c97(_0x16af9e);})[_0x7195('0x21')](function(_0x3ce67a){logger[_0x7195('0x11')](_0x7195('0x1f'),_0x3ce67a[_0x7195('0x13')],_0x450e4d);_0x4ec106(_0x438b0b[_0x7195('0x11')](0x1f4,_0x3ce67a[_0x7195('0x13')]));});});};exports[_0x7195('0x22')]=function(_0x3c9d1e){var _0x104928=this;return new Promise(function(_0x2b6387,_0x4a6b57){return db['ZohoAccount'][_0x7195('0x23')]({'raw':_0x3c9d1e[_0x7195('0x17')]?_0x3c9d1e[_0x7195('0x17')][_0x7195('0x18')]===undefined?!![]:![]:!![],'where':_0x3c9d1e[_0x7195('0x17')]?_0x3c9d1e[_0x7195('0x17')][_0x7195('0x19')]||null:null,'attributes':_0x3c9d1e[_0x7195('0x17')]?_0x3c9d1e[_0x7195('0x17')]['attributes']||null:null,'include':_0x3c9d1e['options']?_0x3c9d1e[_0x7195('0x17')]['include']?_[_0x7195('0x1d')](_0x3c9d1e[_0x7195('0x17')]['include'],function(_0x3b975d){return{'model':db[_0x3b975d[_0x7195('0x1e')]],'as':_0x3b975d['as'],'attributes':_0x3b975d[_0x7195('0x1a')],'include':_0x3b975d['include']?_[_0x7195('0x1d')](_0x3b975d[_0x7195('0x1c')],function(_0xd2f370){return{'model':db[_0xd2f370['model']],'as':_0xd2f370['as'],'attributes':_0xd2f370[_0x7195('0x1a')],'include':_0xd2f370[_0x7195('0x1c')]?_['map'](_0xd2f370['include'],function(_0x3cbfc5){return{'model':db[_0x3cbfc5[_0x7195('0x1e')]],'as':_0x3cbfc5['as'],'attributes':_0x3cbfc5['attributes']};}):[]};}):[]};}):[]:[]})[_0x7195('0xc')](function(_0x2cd684){logger['info'](_0x7195('0x22'),_0x3c9d1e);logger[_0x7195('0x10')](_0x7195('0x22'),_0x3c9d1e,JSON[_0x7195('0x20')](_0x2cd684));_0x2b6387(_0x2cd684);})[_0x7195('0x21')](function(_0x2fe610){logger[_0x7195('0x11')]('ShowZohoAccount',_0x2fe610[_0x7195('0x13')],_0x3c9d1e);_0x4a6b57(_0x104928[_0x7195('0x11')](0x1f4,_0x2fe610[_0x7195('0x13')]));});});}; \ No newline at end of file +var _0xe565=['limit','include','model','map','attributes','debug','stringify','find','ShowZohoAccount','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','request\x20sent','ZohoAccount,\x20%s,\x20%s,\x20%s','error','code','ZohoAccount,\x20%s,\x20%s','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','where'];(function(_0x2fbf1a,_0x5b4456){var _0x2ef025=function(_0x59b55c){while(--_0x59b55c){_0x2fbf1a['push'](_0x2fbf1a['shift']());}};_0x2ef025(++_0x5b4456);}(_0xe565,0x195));var _0x5e56=function(_0x264b30,_0x5cad19){_0x264b30=_0x264b30-0x0;var _0x4545a3=_0xe565[_0x264b30];return _0x4545a3;};'use strict';var _=require(_0x5e56('0x0'));var util=require(_0x5e56('0x1'));var moment=require(_0x5e56('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e56('0x3'));var fs=require('fs');var Redis=require(_0x5e56('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e56('0x5'));var logger=require(_0x5e56('0x6'))(_0x5e56('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e56('0x8'));var client=jayson[_0x5e56('0x9')][_0x5e56('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xd78abf,_0x73a280,_0x40efdd){return new BPromise(function(_0x291bfe,_0x1f8a83){return client['request'](_0xd78abf,_0x40efdd)[_0x5e56('0xb')](function(_0x1a94be){logger[_0x5e56('0xc')]('ZohoAccount,\x20%s,\x20%s',_0x73a280,_0x5e56('0xd'));logger['debug'](_0x5e56('0xe'),_0x73a280,'request\x20sent',JSON['stringify'](_0x1a94be));if(_0x1a94be[_0x5e56('0xf')]){if(_0x1a94be[_0x5e56('0xf')][_0x5e56('0x10')]===0x1f4){logger[_0x5e56('0xf')](_0x5e56('0x11'),_0x73a280,_0x1a94be[_0x5e56('0xf')]['message']);return _0x1f8a83(_0x1a94be['error']['message']);}logger[_0x5e56('0xf')](_0x5e56('0x11'),_0x73a280,_0x1a94be[_0x5e56('0xf')][_0x5e56('0x12')]);return _0x291bfe(_0x1a94be['error']['message']);}else{logger[_0x5e56('0xc')](_0x5e56('0x11'),_0x73a280,_0x5e56('0xd'));_0x291bfe(_0x1a94be[_0x5e56('0x13')][_0x5e56('0x12')]);}})[_0x5e56('0x14')](function(_0x432567){logger[_0x5e56('0xf')](_0x5e56('0x11'),_0x73a280,_0x432567);_0x1f8a83(_0x432567);});});}exports[_0x5e56('0x15')]=function(_0x410783){var _0x134178=this;return new Promise(function(_0x9ad8d3,_0x4b8735){return db[_0x5e56('0x16')][_0x5e56('0x17')]({'raw':_0x410783[_0x5e56('0x18')]?_0x410783['options'][_0x5e56('0x19')]===undefined?!![]:![]:!![],'where':_0x410783[_0x5e56('0x18')]?_0x410783['options'][_0x5e56('0x1a')]||null:null,'attributes':_0x410783['options']?_0x410783[_0x5e56('0x18')]['attributes']||null:null,'limit':_0x410783[_0x5e56('0x18')]?_0x410783[_0x5e56('0x18')][_0x5e56('0x1b')]||null:null,'include':_0x410783['options']?_0x410783[_0x5e56('0x18')]['include']?_['map'](_0x410783['options'][_0x5e56('0x1c')],function(_0x151c25){return{'model':db[_0x151c25[_0x5e56('0x1d')]],'as':_0x151c25['as'],'attributes':_0x151c25['attributes'],'include':_0x151c25['include']?_[_0x5e56('0x1e')](_0x151c25[_0x5e56('0x1c')],function(_0x588ddd){return{'model':db[_0x588ddd[_0x5e56('0x1d')]],'as':_0x588ddd['as'],'attributes':_0x588ddd[_0x5e56('0x1f')],'include':_0x588ddd[_0x5e56('0x1c')]?_[_0x5e56('0x1e')](_0x588ddd[_0x5e56('0x1c')],function(_0x4b5944){return{'model':db[_0x4b5944[_0x5e56('0x1d')]],'as':_0x4b5944['as'],'attributes':_0x4b5944['attributes']};}):[]};}):[]};}):[]:[]})[_0x5e56('0xb')](function(_0x266b97){logger[_0x5e56('0xc')](_0x5e56('0x15'),_0x410783);logger[_0x5e56('0x20')](_0x5e56('0x15'),_0x410783,JSON[_0x5e56('0x21')](_0x266b97));_0x9ad8d3(_0x266b97);})[_0x5e56('0x14')](function(_0x261dd9){logger[_0x5e56('0xf')](_0x5e56('0x15'),_0x261dd9[_0x5e56('0x12')],_0x410783);_0x4b8735(_0x134178['error'](0x1f4,_0x261dd9['message']));});});};exports['ShowZohoAccount']=function(_0x231c0e){var _0xcac637=this;return new Promise(function(_0x512864,_0x13e976){return db[_0x5e56('0x16')][_0x5e56('0x22')]({'raw':_0x231c0e['options']?_0x231c0e[_0x5e56('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x231c0e[_0x5e56('0x18')]?_0x231c0e[_0x5e56('0x18')][_0x5e56('0x1a')]||null:null,'attributes':_0x231c0e['options']?_0x231c0e['options'][_0x5e56('0x1f')]||null:null,'include':_0x231c0e[_0x5e56('0x18')]?_0x231c0e[_0x5e56('0x18')][_0x5e56('0x1c')]?_[_0x5e56('0x1e')](_0x231c0e[_0x5e56('0x18')][_0x5e56('0x1c')],function(_0x4629ae){return{'model':db[_0x4629ae[_0x5e56('0x1d')]],'as':_0x4629ae['as'],'attributes':_0x4629ae[_0x5e56('0x1f')],'include':_0x4629ae[_0x5e56('0x1c')]?_[_0x5e56('0x1e')](_0x4629ae[_0x5e56('0x1c')],function(_0x15c257){return{'model':db[_0x15c257['model']],'as':_0x15c257['as'],'attributes':_0x15c257[_0x5e56('0x1f')],'include':_0x15c257['include']?_['map'](_0x15c257[_0x5e56('0x1c')],function(_0x48e40d){return{'model':db[_0x48e40d[_0x5e56('0x1d')]],'as':_0x48e40d['as'],'attributes':_0x48e40d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x5acb2e){logger[_0x5e56('0xc')](_0x5e56('0x23'),_0x231c0e);logger['debug'](_0x5e56('0x23'),_0x231c0e,JSON[_0x5e56('0x21')](_0x5acb2e));_0x512864(_0x5acb2e);})[_0x5e56('0x14')](function(_0xa092b8){logger[_0x5e56('0xf')](_0x5e56('0x23'),_0xa092b8[_0x5e56('0x12')],_0x231c0e);_0x13e976(_0xcac637[_0x5e56('0xf')](0x1f4,_0xa092b8[_0x5e56('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index fcd1be1..81b02cd 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 _0x97a2=['../../config/environment','./intZohoConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','getFields','/:id/subjects','getDescriptions','post','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x967666,_0x533ef2){var _0x287d70=function(_0x12651a){while(--_0x12651a){_0x967666['push'](_0x967666['shift']());}};_0x287d70(++_0x533ef2);}(_0x97a2,0x1b1));var _0x297a=function(_0x137fc8,_0x353966){_0x137fc8=_0x137fc8-0x0;var _0x5d6ec0=_0x97a2[_0x137fc8];return _0x5d6ec0;};'use strict';var multer=require(_0x297a('0x0'));var util=require('util');var path=require(_0x297a('0x1'));var timeout=require(_0x297a('0x2'));var express=require(_0x297a('0x3'));var router=express[_0x297a('0x4')]();var auth=require(_0x297a('0x5'));var interaction=require(_0x297a('0x6'));var config=require(_0x297a('0x7'));var controller=require(_0x297a('0x8'));router['get']('/',auth[_0x297a('0x9')](),controller[_0x297a('0xa')]);router[_0x297a('0xb')](_0x297a('0xc'),auth[_0x297a('0x9')](),controller[_0x297a('0xd')]);router['get'](_0x297a('0xe'),auth[_0x297a('0x9')](),controller[_0x297a('0xf')]);router[_0x297a('0xb')](_0x297a('0x10'),auth[_0x297a('0x9')](),controller['getSubjects']);router['get']('/:id/descriptions',auth[_0x297a('0x9')](),controller[_0x297a('0x11')]);router[_0x297a('0x12')]('/',auth[_0x297a('0x9')](),controller['create']);router[_0x297a('0x13')](_0x297a('0xc'),auth[_0x297a('0x9')](),controller[_0x297a('0x14')]);router[_0x297a('0x15')](_0x297a('0xc'),auth[_0x297a('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf151=['delete','/:id','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','isAuthenticated','show','get','getFields','getSubjects','/:id/descriptions','getDescriptions','post','create','update'];(function(_0xc2db17,_0xdbb459){var _0x540fc7=function(_0x17f842){while(--_0x17f842){_0xc2db17['push'](_0xc2db17['shift']());}};_0x540fc7(++_0xdbb459);}(_0xf151,0xab));var _0x1f15=function(_0x4aad21,_0x2f467b){_0x4aad21=_0x4aad21-0x0;var _0x545309=_0xf151[_0x4aad21];return _0x545309;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1f15('0x0'));var timeout=require(_0x1f15('0x1'));var express=require(_0x1f15('0x2'));var router=express[_0x1f15('0x3')]();var auth=require(_0x1f15('0x4'));var interaction=require(_0x1f15('0x5'));var config=require(_0x1f15('0x6'));var controller=require(_0x1f15('0x7'));router['get']('/',auth[_0x1f15('0x8')](),controller['index']);router['get']('/:id',auth[_0x1f15('0x8')](),controller[_0x1f15('0x9')]);router[_0x1f15('0xa')]('/:id/fields',auth[_0x1f15('0x8')](),controller[_0x1f15('0xb')]);router['get']('/:id/subjects',auth[_0x1f15('0x8')](),controller[_0x1f15('0xc')]);router[_0x1f15('0xa')](_0x1f15('0xd'),auth['isAuthenticated'](),controller[_0x1f15('0xe')]);router[_0x1f15('0xf')]('/',auth[_0x1f15('0x8')](),controller[_0x1f15('0x10')]);router['put']('/:id',auth[_0x1f15('0x8')](),controller[_0x1f15('0x11')]);router[_0x1f15('0x12')](_0x1f15('0x13'),auth[_0x1f15('0x8')](),controller[_0x1f15('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 3622131..bc4924d 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 _0xd612=['contact','nothing','lead','contact_lead','sequelize','exports','STRING','ENUM'];(function(_0x255db1,_0x19b49f){var _0x33384a=function(_0x4ae8da){while(--_0x4ae8da){_0x255db1['push'](_0x255db1['shift']());}};_0x33384a(++_0x19b49f);}(_0xd612,0xfc));var _0x2d61=function(_0x3146d2,_0x558260){_0x3146d2=_0x3146d2-0x0;var _0x5e3703=_0xd612[_0x3146d2];return _0x5e3703;};'use strict';var Sequelize=require(_0x2d61('0x0'));module[_0x2d61('0x1')]={'name':{'type':Sequelize[_0x2d61('0x2')]},'moduleCreate':{'type':Sequelize[_0x2d61('0x3')]('lead',_0x2d61('0x4'),_0x2d61('0x5')),'defaultValue':_0x2d61('0x6')},'moduleSearch':{'type':Sequelize[_0x2d61('0x3')](_0x2d61('0x7'),_0x2d61('0x4'),_0x2d61('0x6')),'defaultValue':_0x2d61('0x7')},'description':{'type':Sequelize[_0x2d61('0x2')]}}; \ No newline at end of file +var _0xeba3=['contact_lead','contact','STRING','sequelize','exports','ENUM','lead','nothing'];(function(_0x5ee911,_0x55ac30){var _0x2b1004=function(_0x3e5651){while(--_0x3e5651){_0x5ee911['push'](_0x5ee911['shift']());}};_0x2b1004(++_0x55ac30);}(_0xeba3,0x13b));var _0x3eba=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xeba3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x3eba('0x0'));module[_0x3eba('0x1')]={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0x3eba('0x2')](_0x3eba('0x3'),'contact',_0x3eba('0x4')),'defaultValue':'lead'},'moduleSearch':{'type':Sequelize[_0x3eba('0x2')](_0x3eba('0x5'),_0x3eba('0x6'),'lead'),'defaultValue':_0x3eba('0x5')},'description':{'type':Sequelize[_0x3eba('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 0141a12..cbfec34 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 _0x9957=['result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','save','update','name','send','index','ZohoConfiguration','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','limit','order','pick','filter','where','merge','type','options','includeAll','findAll','rows','show','params','find','create','body','getFields','findOne','ZohoField','sort','nolimit','getSubjects','getDescriptions','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message'];(function(_0x2de18a,_0x56243a){var _0x3e435c=function(_0x51b4d9){while(--_0x51b4d9){_0x2de18a['push'](_0x2de18a['shift']());}};_0x3e435c(++_0x56243a);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var pdf=require(_0x7995('0x0'));var emlformat=require(_0x7995('0x1'));var rimraf=require(_0x7995('0x2'));var zipdir=require(_0x7995('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7995('0x4'));var moment=require(_0x7995('0x5'));var BPromise=require(_0x7995('0x6'));var Mustache=require(_0x7995('0x7'));var util=require('util');var path=require(_0x7995('0x8'));var sox=require(_0x7995('0x9'));var csv=require(_0x7995('0xa'));var ejs=require(_0x7995('0xb'));var fs=require('fs');var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var db=require(_0x7995('0x19'))['db'];var jayson=require(_0x7995('0x1a'));var client=jayson[_0x7995('0x1b')][_0x7995('0x1c')]({'port':0x232a});function checkPasswordPattern(_0x281576,_0x23999f,_0x2bbe7a){if(_0x2bbe7a){var _0x4cc004=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cc004['test'](_0x23999f)){return _0x281576;}else{throw new db[(_0x7995('0x1d'))][(_0x7995('0x1e'))](_0x7995('0x1f'));}}else{return _0x281576;}}function respondWithRpcPromise(_0x321ae8,_0x3f1d3e,_0x1a5310,_0x2202ce){return new BPromise(function(_0x41cbf0,_0x5377e5){var _0x2eeacc=_0x2202ce||client;return _0x2eeacc['request'](_0x321ae8,_0x1a5310)[_0x7995('0x20')](function(_0x37f297){logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));logger[_0x7995('0x24')]('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x3f1d3e,'request\x20sent',JSON[_0x7995('0x25')](_0x37f297));if(_0x37f297['error']){if(_0x37f297['error'][_0x7995('0x26')]===0x1f4){logger[_0x7995('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x37f297[_0x7995('0x27')]['message']);return _0x5377e5(_0x37f297['error'][_0x7995('0x28')]);}logger[_0x7995('0x27')](_0x7995('0x22'),_0x3f1d3e,_0x37f297[_0x7995('0x27')][_0x7995('0x28')]);return _0x41cbf0(_0x37f297[_0x7995('0x27')]['message']);}else{logger[_0x7995('0x21')](_0x7995('0x22'),_0x3f1d3e,_0x7995('0x23'));_0x41cbf0(_0x37f297[_0x7995('0x29')][_0x7995('0x28')]);}})[_0x7995('0x2a')](function(_0x475351){logger[_0x7995('0x27')]('ZohoConfiguration,\x20%s,\x20%s',_0x3f1d3e,_0x475351);_0x5377e5(_0x475351);});});}function respondWithStatusCode(_0x39df42,_0x34e70c){_0x34e70c=_0x34e70c||0xcc;return function(_0x401dc3){if(_0x401dc3){return _0x39df42[_0x7995('0x2b')](_0x34e70c);}return _0x39df42[_0x7995('0x2c')](_0x34e70c)[_0x7995('0x2d')]();};}function respondWithResult(_0x56691a,_0x47625f){_0x47625f=_0x47625f||0xc8;return function(_0x5911c3){if(_0x5911c3){return _0x56691a[_0x7995('0x2c')](_0x47625f)[_0x7995('0x2e')](_0x5911c3);}};}function respondWithFilteredResult(_0xf16cc2,_0x132a42){return function(_0x11c1eb){if(_0x11c1eb){var _0x4b6f99=_0x11c1eb[_0x7995('0x2f')],_0x9b2a15=_0x132a42[_0x7995('0x30')],_0x514445=_0x132a42['offset']+_0x132a42['limit'],_0x456a28;if(_0x514445>=_0x4b6f99){_0x514445=_0x4b6f99;_0x456a28=0xc8;}else{_0x456a28=0xce;}_0xf16cc2['status'](_0x456a28);return _0xf16cc2[_0x7995('0x31')](_0x7995('0x32'),_0x9b2a15+'-'+_0x514445+'/'+_0x4b6f99)[_0x7995('0x2e')](_0x11c1eb);}return null;};}function patchUpdates(_0x2b874d){return function(_0x2e3493){try{jsonpatch[_0x7995('0x33')](_0x2e3493,_0x2b874d,!![]);}catch(_0x538841){return BPromise['reject'](_0x538841);}return _0x2e3493[_0x7995('0x34')]();};}function saveUpdates(_0x5524af,_0x553671){return function(_0x3eb566){if(_0x3eb566){return _0x3eb566[_0x7995('0x35')](_0x5524af)[_0x7995('0x20')](function(_0x1f7d27){return _0x1f7d27;});}return null;};}function removeEntity(_0x510841,_0x44309d){return function(_0x33e24e){if(_0x33e24e){return _0x33e24e['destroy']()['then'](function(){_0x510841['status'](0xcc)[_0x7995('0x2d')]();});}};}function handleEntityNotFound(_0x3acfc3,_0x4a176f){return function(_0x3e7020){if(!_0x3e7020){_0x3acfc3['sendStatus'](0x194);}return _0x3e7020;};}function handleError(_0x37917b,_0x1cb058){_0x1cb058=_0x1cb058||0x1f4;return function(_0x177cb4){logger['error'](_0x177cb4['stack']);if(_0x177cb4[_0x7995('0x36')]){delete _0x177cb4['name'];}_0x37917b['status'](_0x1cb058)[_0x7995('0x37')](_0x177cb4);};}exports[_0x7995('0x38')]=function(_0x5212ff,_0x1baa15){var _0x1922b4={},_0x2b772f={},_0x18667c={'count':0x0,'rows':[]};var _0x1e3dbf=_['map'](db[_0x7995('0x39')][_0x7995('0x3a')],function(_0xf612e6){return{'name':_0xf612e6[_0x7995('0x3b')],'type':_0xf612e6['type'][_0x7995('0x3c')]};});_0x2b772f[_0x7995('0x3d')]=_[_0x7995('0x3e')](_0x1e3dbf,_0x7995('0x36'));_0x2b772f[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x5212ff['query']);_0x2b772f[_0x7995('0x41')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],_0x2b772f[_0x7995('0x3f')]);_0x1922b4[_0x7995('0x43')]=_[_0x7995('0x42')](_0x2b772f[_0x7995('0x3d')],qs[_0x7995('0x44')](_0x5212ff[_0x7995('0x3f')][_0x7995('0x44')]));_0x1922b4[_0x7995('0x43')]=_0x1922b4[_0x7995('0x43')][_0x7995('0x45')]?_0x1922b4['attributes']:_0x2b772f['model'];if(!_0x5212ff[_0x7995('0x3f')][_0x7995('0x46')]('nolimit')){_0x1922b4['limit']=qs[_0x7995('0x47')](_0x5212ff['query']['limit']);_0x1922b4[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x5212ff[_0x7995('0x3f')]['offset']);}_0x1922b4[_0x7995('0x48')]=qs['sort'](_0x5212ff[_0x7995('0x3f')]['sort']);_0x1922b4['where']=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x5212ff[_0x7995('0x3f')],_0x2b772f[_0x7995('0x41')]));if(_0x5212ff['query'][_0x7995('0x4a')]){_0x1922b4[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x1922b4[_0x7995('0x4b')],{'$or':_['map'](_0x1e3dbf,function(_0x5f28e7){if(_0x5f28e7[_0x7995('0x4d')]!=='VIRTUAL'){var _0x23c41d={};_0x23c41d[_0x5f28e7['name']]={'$like':'%'+_0x5212ff[_0x7995('0x3f')]['filter']+'%'};return _0x23c41d;}})});}_0x1922b4=_[_0x7995('0x4c')]({},_0x1922b4,_0x5212ff[_0x7995('0x4e')]);var _0x4d9245={'where':_0x1922b4[_0x7995('0x4b')]};return db[_0x7995('0x39')][_0x7995('0x2f')](_0x4d9245)[_0x7995('0x20')](function(_0x4c6837){_0x18667c[_0x7995('0x2f')]=_0x4c6837;if(_0x5212ff[_0x7995('0x3f')][_0x7995('0x4f')]){_0x1922b4['include']=[{'all':!![]}];}return db[_0x7995('0x39')][_0x7995('0x50')](_0x1922b4);})[_0x7995('0x20')](function(_0x3d8ae3){_0x18667c[_0x7995('0x51')]=_0x3d8ae3;return _0x18667c;})['then'](respondWithFilteredResult(_0x1baa15,_0x1922b4))[_0x7995('0x2a')](handleError(_0x1baa15,null));};exports[_0x7995('0x52')]=function(_0x5921b9,_0x3d1dbb){var _0x5843ba={'raw':![],'where':{'id':_0x5921b9[_0x7995('0x53')]['id']}},_0x1d87f9={};_0x1d87f9[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x39')][_0x7995('0x3a')]);_0x1d87f9[_0x7995('0x3f')]=_['keys'](_0x5921b9[_0x7995('0x3f')]);_0x1d87f9[_0x7995('0x41')]=_[_0x7995('0x42')](_0x1d87f9['model'],_0x1d87f9[_0x7995('0x3f')]);_0x5843ba[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1d87f9['model'],qs['fields'](_0x5921b9['query'][_0x7995('0x44')]));_0x5843ba[_0x7995('0x43')]=_0x5843ba['attributes'][_0x7995('0x45')]?_0x5843ba[_0x7995('0x43')]:_0x1d87f9[_0x7995('0x3d')];if(_0x5921b9[_0x7995('0x3f')][_0x7995('0x4f')]){_0x5843ba['include']=[{'all':!![]}];}_0x5843ba=_[_0x7995('0x4c')]({},_0x5843ba,_0x5921b9['options']);return db[_0x7995('0x39')][_0x7995('0x54')](_0x5843ba)[_0x7995('0x20')](handleEntityNotFound(_0x3d1dbb,null))['then'](respondWithResult(_0x3d1dbb,null))['catch'](handleError(_0x3d1dbb,null));};exports['create']=function(_0x563f8e,_0x2e13b0){return db[_0x7995('0x39')][_0x7995('0x55')](_0x563f8e[_0x7995('0x56')],{})[_0x7995('0x20')](respondWithResult(_0x2e13b0,0xc9))[_0x7995('0x2a')](handleError(_0x2e13b0,null));};exports[_0x7995('0x35')]=function(_0xda6ce8,_0x328671){if(_0xda6ce8[_0x7995('0x56')]['id']){delete _0xda6ce8[_0x7995('0x56')]['id'];}return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0xda6ce8[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x328671,null))[_0x7995('0x20')](saveUpdates(_0xda6ce8[_0x7995('0x56')],null))[_0x7995('0x20')](respondWithResult(_0x328671,null))[_0x7995('0x2a')](handleError(_0x328671,null));};exports['destroy']=function(_0x56a374,_0x630737){return db[_0x7995('0x39')][_0x7995('0x54')]({'where':{'id':_0x56a374['params']['id']}})['then'](handleEntityNotFound(_0x630737,null))[_0x7995('0x20')](removeEntity(_0x630737,null))[_0x7995('0x2a')](handleError(_0x630737,null));};exports[_0x7995('0x57')]=function(_0x332a85,_0x51c50b,_0x13cd7b){var _0x74ff38={};var _0xef5044={};var _0x33c49c;var _0x502d43;return db['ZohoConfiguration'][_0x7995('0x58')]({'where':{'id':_0x332a85[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x51c50b,null))[_0x7995('0x20')](function(_0x37072){if(_0x37072){_0x33c49c=_0x37072;_0xef5044[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0xef5044['query']=_[_0x7995('0x40')](_0x332a85[_0x7995('0x3f')]);_0xef5044[_0x7995('0x41')]=_[_0x7995('0x42')](_0xef5044['model'],_0xef5044['query']);_0x74ff38[_0x7995('0x43')]=_[_0x7995('0x42')](_0xef5044['model'],qs[_0x7995('0x44')](_0x332a85[_0x7995('0x3f')][_0x7995('0x44')]));_0x74ff38[_0x7995('0x43')]=_0x74ff38[_0x7995('0x43')]['length']?_0x74ff38[_0x7995('0x43')]:_0xef5044['model'];_0x74ff38[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x332a85[_0x7995('0x3f')][_0x7995('0x5a')]);_0x74ff38[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x332a85[_0x7995('0x3f')],_0xef5044[_0x7995('0x41')]));if(_0x332a85[_0x7995('0x3f')][_0x7995('0x4a')]){_0x74ff38[_0x7995('0x4b')]=_['merge'](_0x74ff38[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x74ff38[_0x7995('0x43')],function(_0xc2b660){var _0x2c6548={};_0x2c6548[_0xc2b660]={'$like':'%'+_0x332a85['query']['filter']+'%'};return _0x2c6548;})});}_0x74ff38=_[_0x7995('0x4c')]({},_0x74ff38,_0x332a85[_0x7995('0x4e')]);return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})[_0x7995('0x20')](function(_0x5aa2ec){if(_0x5aa2ec){_0x502d43=_0x5aa2ec[_0x7995('0x45')];if(!_0x332a85['query']['hasOwnProperty'](_0x7995('0x5b'))){_0x74ff38[_0x7995('0x47')]=qs[_0x7995('0x47')](_0x332a85[_0x7995('0x3f')][_0x7995('0x47')]);_0x74ff38[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x332a85[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x33c49c[_0x7995('0x57')](_0x74ff38);}})['then'](function(_0x2dc1f7){if(_0x2dc1f7){return _0x2dc1f7?{'count':_0x502d43,'rows':_0x2dc1f7}:null;}})[_0x7995('0x20')](respondWithResult(_0x51c50b,null))[_0x7995('0x2a')](handleError(_0x51c50b,null));};exports['getSubjects']=function(_0x1fe1cb,_0x1d2f9d,_0x705f0){var _0x3a7d9d={};var _0x3b0d30={};var _0x51ab1e;var _0x550a10;return db[_0x7995('0x39')][_0x7995('0x58')]({'where':{'id':_0x1fe1cb[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x1d2f9d,null))['then'](function(_0x5e8b4c){if(_0x5e8b4c){_0x51ab1e=_0x5e8b4c;_0x3b0d30[_0x7995('0x3d')]=_[_0x7995('0x40')](db[_0x7995('0x59')][_0x7995('0x3a')]);_0x3b0d30['query']=_[_0x7995('0x40')](_0x1fe1cb[_0x7995('0x3f')]);_0x3b0d30['filters']=_['intersection'](_0x3b0d30[_0x7995('0x3d')],_0x3b0d30[_0x7995('0x3f')]);_0x3a7d9d['attributes']=_[_0x7995('0x42')](_0x3b0d30['model'],qs[_0x7995('0x44')](_0x1fe1cb[_0x7995('0x3f')]['fields']));_0x3a7d9d['attributes']=_0x3a7d9d[_0x7995('0x43')]['length']?_0x3a7d9d[_0x7995('0x43')]:_0x3b0d30[_0x7995('0x3d')];_0x3a7d9d[_0x7995('0x48')]=qs[_0x7995('0x5a')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x5a')]);_0x3a7d9d[_0x7995('0x4b')]=qs[_0x7995('0x41')](_[_0x7995('0x49')](_0x1fe1cb[_0x7995('0x3f')],_0x3b0d30[_0x7995('0x41')]));if(_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]){_0x3a7d9d[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x3a7d9d[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x3a7d9d[_0x7995('0x43')],function(_0x2ff7ba){var _0xa2fc8e={};_0xa2fc8e[_0x2ff7ba]={'$like':'%'+_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x4a')]+'%'};return _0xa2fc8e;})});}_0x3a7d9d=_[_0x7995('0x4c')]({},_0x3a7d9d,_0x1fe1cb[_0x7995('0x4e')]);return _0x51ab1e[_0x7995('0x5c')](_0x3a7d9d);}})[_0x7995('0x20')](function(_0x2f7f51){if(_0x2f7f51){_0x550a10=_0x2f7f51[_0x7995('0x45')];if(!_0x1fe1cb['query'][_0x7995('0x46')](_0x7995('0x5b'))){_0x3a7d9d['limit']=qs['limit'](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x47')]);_0x3a7d9d[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x1fe1cb[_0x7995('0x3f')][_0x7995('0x30')]);}return _0x51ab1e['getSubjects'](_0x3a7d9d);}})[_0x7995('0x20')](function(_0xb68962){if(_0xb68962){return _0xb68962?{'count':_0x550a10,'rows':_0xb68962}:null;}})[_0x7995('0x20')](respondWithResult(_0x1d2f9d,null))[_0x7995('0x2a')](handleError(_0x1d2f9d,null));};exports[_0x7995('0x5d')]=function(_0x3f0bff,_0x151d99,_0xc93dcb){var _0x560095={};var _0x1c8e7d={};var _0x2b8217;var _0x5c04c9;return db['ZohoConfiguration'][_0x7995('0x58')]({'where':{'id':_0x3f0bff[_0x7995('0x53')]['id']}})[_0x7995('0x20')](handleEntityNotFound(_0x151d99,null))[_0x7995('0x20')](function(_0xe42797){if(_0xe42797){_0x2b8217=_0xe42797;_0x1c8e7d['model']=_[_0x7995('0x40')](db[_0x7995('0x59')]['rawAttributes']);_0x1c8e7d[_0x7995('0x3f')]=_[_0x7995('0x40')](_0x3f0bff['query']);_0x1c8e7d[_0x7995('0x41')]=_['intersection'](_0x1c8e7d[_0x7995('0x3d')],_0x1c8e7d[_0x7995('0x3f')]);_0x560095[_0x7995('0x43')]=_[_0x7995('0x42')](_0x1c8e7d[_0x7995('0x3d')],qs['fields'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x44')]));_0x560095[_0x7995('0x43')]=_0x560095['attributes'][_0x7995('0x45')]?_0x560095[_0x7995('0x43')]:_0x1c8e7d[_0x7995('0x3d')];_0x560095[_0x7995('0x48')]=qs['sort'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x5a')]);_0x560095[_0x7995('0x4b')]=qs['filters'](_['pick'](_0x3f0bff[_0x7995('0x3f')],_0x1c8e7d[_0x7995('0x41')]));if(_0x3f0bff['query']['filter']){_0x560095[_0x7995('0x4b')]=_[_0x7995('0x4c')](_0x560095[_0x7995('0x4b')],{'$or':_[_0x7995('0x3e')](_0x560095[_0x7995('0x43')],function(_0x551b5e){var _0x56003d={};_0x56003d[_0x551b5e]={'$like':'%'+_0x3f0bff[_0x7995('0x3f')]['filter']+'%'};return _0x56003d;})});}_0x560095=_['merge']({},_0x560095,_0x3f0bff[_0x7995('0x4e')]);return _0x2b8217[_0x7995('0x5d')](_0x560095);}})[_0x7995('0x20')](function(_0x5eb360){if(_0x5eb360){_0x5c04c9=_0x5eb360[_0x7995('0x45')];if(!_0x3f0bff[_0x7995('0x3f')][_0x7995('0x46')](_0x7995('0x5b'))){_0x560095[_0x7995('0x47')]=qs['limit'](_0x3f0bff[_0x7995('0x3f')][_0x7995('0x47')]);_0x560095[_0x7995('0x30')]=qs[_0x7995('0x30')](_0x3f0bff['query'][_0x7995('0x30')]);}return _0x2b8217[_0x7995('0x5d')](_0x560095);}})['then'](function(_0x310272){if(_0x310272){return _0x310272?{'count':_0x5c04c9,'rows':_0x310272}:null;}})[_0x7995('0x20')](respondWithResult(_0x151d99,null))['catch'](handleError(_0x151d99,null));}; \ No newline at end of file +var _0xe14b=['info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','save','update','destroy','name','map','ZohoConfiguration','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','find','catch','body','getFields','findOne','ZohoField','order','getSubjects','getDescriptions','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','jayson/promise','client','http','test','Sequelize','ValidationError','request','then'];(function(_0x39a757,_0x51e36d){var _0x3df2f=function(_0x1e5083){while(--_0x1e5083){_0x39a757['push'](_0x39a757['shift']());}};_0x3df2f(++_0x51e36d);}(_0xe14b,0x93));var _0xbe14=function(_0x1bf7de,_0x1c373a){_0x1bf7de=_0x1bf7de-0x0;var _0xf1a88=_0xe14b[_0x1bf7de];return _0xf1a88;};'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 jayson=require(_0xbe14('0x15'));var client=jayson[_0xbe14('0x16')][_0xbe14('0x17')]({'port':0x232a});function checkPasswordPattern(_0x23a730,_0x2850cb,_0x16893f){if(_0x16893f){var _0xa2cf72=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xa2cf72[_0xbe14('0x18')](_0x2850cb)){return _0x23a730;}else{throw new db[(_0xbe14('0x19'))][(_0xbe14('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 _0x23a730;}}function respondWithRpcPromise(_0x55b3a7,_0x3f58f5,_0x3dc4a9,_0xf4ac9){return new BPromise(function(_0x37ce4e,_0x4e8f34){var _0x21c789=_0xf4ac9||client;return _0x21c789[_0xbe14('0x1b')](_0x55b3a7,_0x3dc4a9)[_0xbe14('0x1c')](function(_0x123ede){logger[_0xbe14('0x1d')](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));logger['debug'](_0xbe14('0x20'),_0x3f58f5,_0xbe14('0x1f'),JSON[_0xbe14('0x21')](_0x123ede));if(_0x123ede[_0xbe14('0x22')]){if(_0x123ede[_0xbe14('0x22')][_0xbe14('0x23')]===0x1f4){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);return _0x4e8f34(_0x123ede[_0xbe14('0x22')][_0xbe14('0x24')]);}logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x123ede['error'][_0xbe14('0x24')]);return _0x37ce4e(_0x123ede['error'][_0xbe14('0x24')]);}else{logger['info'](_0xbe14('0x1e'),_0x3f58f5,_0xbe14('0x1f'));_0x37ce4e(_0x123ede['result'][_0xbe14('0x24')]);}})['catch'](function(_0x4587a8){logger['error'](_0xbe14('0x1e'),_0x3f58f5,_0x4587a8);_0x4e8f34(_0x4587a8);});});}function respondWithStatusCode(_0x5fa043,_0x1ee9c1){_0x1ee9c1=_0x1ee9c1||0xcc;return function(_0x39cc81){if(_0x39cc81){return _0x5fa043[_0xbe14('0x25')](_0x1ee9c1);}return _0x5fa043[_0xbe14('0x26')](_0x1ee9c1)['end']();};}function respondWithResult(_0x1822e0,_0x1ba46a){_0x1ba46a=_0x1ba46a||0xc8;return function(_0x391556){if(_0x391556){return _0x1822e0[_0xbe14('0x26')](_0x1ba46a)['json'](_0x391556);}};}function respondWithFilteredResult(_0x16f884,_0x29fc64){return function(_0x59bf34){if(_0x59bf34){var _0x3c3613=_0x59bf34[_0xbe14('0x27')],_0x3b3e84=_0x29fc64[_0xbe14('0x28')],_0x1c7cc7=_0x29fc64[_0xbe14('0x28')]+_0x29fc64[_0xbe14('0x29')],_0x19252f;if(_0x1c7cc7>=_0x3c3613){_0x1c7cc7=_0x3c3613;_0x19252f=0xc8;}else{_0x19252f=0xce;}_0x16f884[_0xbe14('0x26')](_0x19252f);return _0x16f884[_0xbe14('0x2a')](_0xbe14('0x2b'),_0x3b3e84+'-'+_0x1c7cc7+'/'+_0x3c3613)[_0xbe14('0x2c')](_0x59bf34);}return null;};}function patchUpdates(_0x39dc0a){return function(_0x10ae36){try{jsonpatch[_0xbe14('0x2d')](_0x10ae36,_0x39dc0a,!![]);}catch(_0xe6feb2){return BPromise[_0xbe14('0x2e')](_0xe6feb2);}return _0x10ae36[_0xbe14('0x2f')]();};}function saveUpdates(_0x29e76a,_0x14e7c4){return function(_0x581e86){if(_0x581e86){return _0x581e86[_0xbe14('0x30')](_0x29e76a)['then'](function(_0x58f8de){return _0x58f8de;});}return null;};}function removeEntity(_0x46c2d1,_0x4c1e7e){return function(_0x243524){if(_0x243524){return _0x243524[_0xbe14('0x31')]()['then'](function(){_0x46c2d1['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x412ad5,_0xa3d24){return function(_0x5f27b6){if(!_0x5f27b6){_0x412ad5[_0xbe14('0x25')](0x194);}return _0x5f27b6;};}function handleError(_0x1faf3e,_0x452635){_0x452635=_0x452635||0x1f4;return function(_0x1aa849){logger[_0xbe14('0x22')](_0x1aa849['stack']);if(_0x1aa849['name']){delete _0x1aa849[_0xbe14('0x32')];}_0x1faf3e['status'](_0x452635)['send'](_0x1aa849);};}exports['index']=function(_0x163ef7,_0x393f6b){var _0x2bb45={},_0x3dbacb={},_0x172e79={'count':0x0,'rows':[]};var _0x29356f=_[_0xbe14('0x33')](db[_0xbe14('0x34')][_0xbe14('0x35')],function(_0x2dfd5a){return{'name':_0x2dfd5a[_0xbe14('0x36')],'type':_0x2dfd5a[_0xbe14('0x37')]['key']};});_0x3dbacb['model']=_[_0xbe14('0x33')](_0x29356f,_0xbe14('0x32'));_0x3dbacb[_0xbe14('0x38')]=_['keys'](_0x163ef7[_0xbe14('0x38')]);_0x3dbacb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],_0x3dbacb[_0xbe14('0x38')]);_0x2bb45[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x3dbacb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x163ef7['query'][_0xbe14('0x3d')]));_0x2bb45[_0xbe14('0x3c')]=_0x2bb45[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x2bb45[_0xbe14('0x3c')]:_0x3dbacb[_0xbe14('0x3b')];if(!_0x163ef7['query'][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x2bb45[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x163ef7['query']['limit']);_0x2bb45[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x163ef7[_0xbe14('0x38')]['offset']);}_0x2bb45['order']=qs[_0xbe14('0x41')](_0x163ef7['query']['sort']);_0x2bb45[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x163ef7['query'],_0x3dbacb['filters']));if(_0x163ef7['query'][_0xbe14('0x44')]){_0x2bb45[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x2bb45['where'],{'$or':_[_0xbe14('0x33')](_0x29356f,function(_0xcb0680){if(_0xcb0680[_0xbe14('0x37')]!==_0xbe14('0x46')){var _0x58351f={};_0x58351f[_0xcb0680['name']]={'$like':'%'+_0x163ef7[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x58351f;}})});}_0x2bb45=_[_0xbe14('0x45')]({},_0x2bb45,_0x163ef7[_0xbe14('0x47')]);var _0x2550dc={'where':_0x2bb45['where']};return db['ZohoConfiguration'][_0xbe14('0x27')](_0x2550dc)[_0xbe14('0x1c')](function(_0x238c60){_0x172e79[_0xbe14('0x27')]=_0x238c60;if(_0x163ef7['query'][_0xbe14('0x48')]){_0x2bb45[_0xbe14('0x49')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xbe14('0x4a')](_0x2bb45);})[_0xbe14('0x1c')](function(_0x2d6ee8){_0x172e79[_0xbe14('0x4b')]=_0x2d6ee8;return _0x172e79;})['then'](respondWithFilteredResult(_0x393f6b,_0x2bb45))['catch'](handleError(_0x393f6b,null));};exports[_0xbe14('0x4c')]=function(_0x29564b,_0x4a1a37){var _0x5acf90={'raw':![],'where':{'id':_0x29564b[_0xbe14('0x4d')]['id']}},_0xca8cdb={};_0xca8cdb[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x34')][_0xbe14('0x35')]);_0xca8cdb[_0xbe14('0x38')]=_['keys'](_0x29564b[_0xbe14('0x38')]);_0xca8cdb[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],_0xca8cdb[_0xbe14('0x38')]);_0x5acf90['attributes']=_[_0xbe14('0x3a')](_0xca8cdb[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x29564b[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x5acf90[_0xbe14('0x3c')]=_0x5acf90['attributes']['length']?_0x5acf90[_0xbe14('0x3c')]:_0xca8cdb[_0xbe14('0x3b')];if(_0x29564b[_0xbe14('0x38')]['includeAll']){_0x5acf90['include']=[{'all':!![]}];}_0x5acf90=_[_0xbe14('0x45')]({},_0x5acf90,_0x29564b[_0xbe14('0x47')]);return db['ZohoConfiguration'][_0xbe14('0x4f')](_0x5acf90)[_0xbe14('0x1c')](handleEntityNotFound(_0x4a1a37,null))['then'](respondWithResult(_0x4a1a37,null))[_0xbe14('0x50')](handleError(_0x4a1a37,null));};exports['create']=function(_0x41ba58,_0x410c59){return db[_0xbe14('0x34')]['create'](_0x41ba58[_0xbe14('0x51')],{})[_0xbe14('0x1c')](respondWithResult(_0x410c59,0xc9))['catch'](handleError(_0x410c59,null));};exports[_0xbe14('0x30')]=function(_0x42ca15,_0x2210cc){if(_0x42ca15[_0xbe14('0x51')]['id']){delete _0x42ca15[_0xbe14('0x51')]['id'];}return db['ZohoConfiguration'][_0xbe14('0x4f')]({'where':{'id':_0x42ca15[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x2210cc,null))[_0xbe14('0x1c')](saveUpdates(_0x42ca15[_0xbe14('0x51')],null))[_0xbe14('0x1c')](respondWithResult(_0x2210cc,null))[_0xbe14('0x50')](handleError(_0x2210cc,null));};exports['destroy']=function(_0x72c875,_0x1b47a4){return db[_0xbe14('0x34')][_0xbe14('0x4f')]({'where':{'id':_0x72c875[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x1b47a4,null))[_0xbe14('0x1c')](removeEntity(_0x1b47a4,null))[_0xbe14('0x50')](handleError(_0x1b47a4,null));};exports[_0xbe14('0x52')]=function(_0xc61103,_0x358950,_0x4bccfc){var _0x56bcd3={};var _0x58dd79={};var _0x10c0bc;var _0x1bfcbf;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0xc61103[_0xbe14('0x4d')]['id']}})[_0xbe14('0x1c')](handleEntityNotFound(_0x358950,null))[_0xbe14('0x1c')](function(_0x22bf69){if(_0x22bf69){_0x10c0bc=_0x22bf69;_0x58dd79[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x58dd79[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0xc61103[_0xbe14('0x38')]);_0x58dd79[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x58dd79[_0xbe14('0x3b')],_0x58dd79[_0xbe14('0x38')]);_0x56bcd3[_0xbe14('0x3c')]=_['intersection'](_0x58dd79[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x56bcd3[_0xbe14('0x3c')]=_0x56bcd3[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x56bcd3[_0xbe14('0x3c')]:_0x58dd79[_0xbe14('0x3b')];_0x56bcd3[_0xbe14('0x55')]=qs['sort'](_0xc61103[_0xbe14('0x38')][_0xbe14('0x41')]);_0x56bcd3[_0xbe14('0x42')]=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0xc61103['query'],_0x58dd79[_0xbe14('0x39')]));if(_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]){_0x56bcd3[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0x56bcd3['where'],{'$or':_[_0xbe14('0x33')](_0x56bcd3[_0xbe14('0x3c')],function(_0x7ea146){var _0x29bb26={};_0x29bb26[_0x7ea146]={'$like':'%'+_0xc61103[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x29bb26;})});}_0x56bcd3=_[_0xbe14('0x45')]({},_0x56bcd3,_0xc61103[_0xbe14('0x47')]);return _0x10c0bc['getFields'](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x33c309){if(_0x33c309){_0x1bfcbf=_0x33c309[_0xbe14('0x3e')];if(!_0xc61103[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x56bcd3[_0xbe14('0x29')]=qs['limit'](_0xc61103['query'][_0xbe14('0x29')]);_0x56bcd3[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0xc61103[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x10c0bc[_0xbe14('0x52')](_0x56bcd3);}})[_0xbe14('0x1c')](function(_0x43511e){if(_0x43511e){return _0x43511e?{'count':_0x1bfcbf,'rows':_0x43511e}:null;}})['then'](respondWithResult(_0x358950,null))['catch'](handleError(_0x358950,null));};exports[_0xbe14('0x56')]=function(_0x1c18b6,_0x29aa52,_0x57729f){var _0x76e91e={};var _0x16bca1={};var _0x105be0;var _0x1797dd;return db[_0xbe14('0x34')][_0xbe14('0x53')]({'where':{'id':_0x1c18b6[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x29aa52,null))[_0xbe14('0x1c')](function(_0x3b6ef5){if(_0x3b6ef5){_0x105be0=_0x3b6ef5;_0x16bca1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db[_0xbe14('0x54')][_0xbe14('0x35')]);_0x16bca1[_0xbe14('0x38')]=_['keys'](_0x1c18b6[_0xbe14('0x38')]);_0x16bca1[_0xbe14('0x39')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],_0x16bca1[_0xbe14('0x38')]);_0x76e91e[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x16bca1[_0xbe14('0x3b')],qs['fields'](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3d')]));_0x76e91e[_0xbe14('0x3c')]=_0x76e91e[_0xbe14('0x3c')][_0xbe14('0x3e')]?_0x76e91e[_0xbe14('0x3c')]:_0x16bca1['model'];_0x76e91e[_0xbe14('0x55')]=qs[_0xbe14('0x41')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x41')]);_0x76e91e['where']=qs[_0xbe14('0x39')](_[_0xbe14('0x43')](_0x1c18b6[_0xbe14('0x38')],_0x16bca1[_0xbe14('0x39')]));if(_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]){_0x76e91e[_0xbe14('0x42')]=_['merge'](_0x76e91e[_0xbe14('0x42')],{'$or':_['map'](_0x76e91e[_0xbe14('0x3c')],function(_0x5d85d3){var _0x389822={};_0x389822[_0x5d85d3]={'$like':'%'+_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x389822;})});}_0x76e91e=_['merge']({},_0x76e91e,_0x1c18b6[_0xbe14('0x47')]);return _0x105be0[_0xbe14('0x56')](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x546f22){if(_0x546f22){_0x1797dd=_0x546f22[_0xbe14('0x3e')];if(!_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x3f')](_0xbe14('0x40'))){_0x76e91e['limit']=qs[_0xbe14('0x29')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x29')]);_0x76e91e[_0xbe14('0x28')]=qs[_0xbe14('0x28')](_0x1c18b6[_0xbe14('0x38')][_0xbe14('0x28')]);}return _0x105be0['getSubjects'](_0x76e91e);}})[_0xbe14('0x1c')](function(_0x123f4f){if(_0x123f4f){return _0x123f4f?{'count':_0x1797dd,'rows':_0x123f4f}:null;}})[_0xbe14('0x1c')](respondWithResult(_0x29aa52,null))['catch'](handleError(_0x29aa52,null));};exports[_0xbe14('0x57')]=function(_0x420467,_0x1ea305,_0x5bc52b){var _0xa53262={};var _0x1205d1={};var _0x47d7bb;var _0x2be969;return db['ZohoConfiguration'][_0xbe14('0x53')]({'where':{'id':_0x420467[_0xbe14('0x4d')]['id']}})['then'](handleEntityNotFound(_0x1ea305,null))['then'](function(_0x54045e){if(_0x54045e){_0x47d7bb=_0x54045e;_0x1205d1[_0xbe14('0x3b')]=_[_0xbe14('0x4e')](db['ZohoField'][_0xbe14('0x35')]);_0x1205d1[_0xbe14('0x38')]=_[_0xbe14('0x4e')](_0x420467[_0xbe14('0x38')]);_0x1205d1['filters']=_['intersection'](_0x1205d1[_0xbe14('0x3b')],_0x1205d1[_0xbe14('0x38')]);_0xa53262[_0xbe14('0x3c')]=_[_0xbe14('0x3a')](_0x1205d1[_0xbe14('0x3b')],qs[_0xbe14('0x3d')](_0x420467[_0xbe14('0x38')]['fields']));_0xa53262[_0xbe14('0x3c')]=_0xa53262['attributes'][_0xbe14('0x3e')]?_0xa53262[_0xbe14('0x3c')]:_0x1205d1[_0xbe14('0x3b')];_0xa53262[_0xbe14('0x55')]=qs['sort'](_0x420467[_0xbe14('0x38')][_0xbe14('0x41')]);_0xa53262[_0xbe14('0x42')]=qs['filters'](_[_0xbe14('0x43')](_0x420467[_0xbe14('0x38')],_0x1205d1[_0xbe14('0x39')]));if(_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]){_0xa53262[_0xbe14('0x42')]=_[_0xbe14('0x45')](_0xa53262[_0xbe14('0x42')],{'$or':_[_0xbe14('0x33')](_0xa53262[_0xbe14('0x3c')],function(_0x2bf94c){var _0x49497e={};_0x49497e[_0x2bf94c]={'$like':'%'+_0x420467[_0xbe14('0x38')][_0xbe14('0x44')]+'%'};return _0x49497e;})});}_0xa53262=_[_0xbe14('0x45')]({},_0xa53262,_0x420467[_0xbe14('0x47')]);return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x1679bd){if(_0x1679bd){_0x2be969=_0x1679bd[_0xbe14('0x3e')];if(!_0x420467['query'][_0xbe14('0x3f')]('nolimit')){_0xa53262[_0xbe14('0x29')]=qs[_0xbe14('0x29')](_0x420467[_0xbe14('0x38')][_0xbe14('0x29')]);_0xa53262[_0xbe14('0x28')]=qs['offset'](_0x420467['query'][_0xbe14('0x28')]);}return _0x47d7bb[_0xbe14('0x57')](_0xa53262);}})[_0xbe14('0x1c')](function(_0x42b849){if(_0x42b849){return _0x42b849?{'count':_0x2be969,'rows':_0x42b849}:null;}})['then'](respondWithResult(_0x1ea305,null))[_0xbe14('0x50')](handleError(_0x1ea305,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 2a20cdc..f0948b6 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 _0x1995=['request-promise','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x308482,_0x47b6a1){var _0x1a1df8=function(_0x38b0d5){while(--_0x38b0d5){_0x308482['push'](_0x308482['shift']());}};_0x1a1df8(++_0x47b6a1);}(_0x1995,0x17b));var _0x5199=function(_0x396ab8,_0x100856){_0x396ab8=_0x396ab8-0x0;var _0x3b9ff7=_0x1995[_0x396ab8];return _0x3b9ff7;};'use strict';var _=require(_0x5199('0x0'));var util=require(_0x5199('0x1'));var logger=require(_0x5199('0x2'))(_0x5199('0x3'));var moment=require(_0x5199('0x4'));var BPromise=require(_0x5199('0x5'));var rp=require(_0x5199('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZohoConfiguration.attributes');module[_0x5199('0x7')]=function(_0x172e27,_0x460b5f){return _0x172e27[_0x5199('0x8')](_0x5199('0x9'),attributes,{'tableName':_0x5199('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xae37=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x5ed5b7,_0x1354b5){var _0x54f9e6=function(_0x57f5e1){while(--_0x57f5e1){_0x5ed5b7['push'](_0x5ed5b7['shift']());}};_0x54f9e6(++_0x1354b5);}(_0xae37,0xcd));var _0x7ae3=function(_0x268b06,_0x446ed1){_0x268b06=_0x268b06-0x0;var _0x31d48b=_0xae37[_0x268b06];return _0x31d48b;};'use strict';var _=require(_0x7ae3('0x0'));var util=require(_0x7ae3('0x1'));var logger=require(_0x7ae3('0x2'))(_0x7ae3('0x3'));var moment=require(_0x7ae3('0x4'));var BPromise=require(_0x7ae3('0x5'));var rp=require(_0x7ae3('0x6'));var fs=require('fs');var path=require(_0x7ae3('0x7'));var rimraf=require(_0x7ae3('0x8'));var config=require(_0x7ae3('0x9'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7ae3('0xa')]=function(_0x1df9ae,_0x3416f3){return _0x1df9ae[_0x7ae3('0xb')]('ZohoConfiguration',attributes,{'tableName':_0x7ae3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js b/server/api/intZohoConfiguration/intZohoConfiguration.rpc.js index 4700323..a8da434 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 _0xda14=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xda14,0x175));var _0x4da1=function(_0x2d91c6,_0x10ae0e){_0x2d91c6=_0x2d91c6-0x0;var _0x3a8d19=_0xda14[_0x2d91c6];return _0x3a8d19;};'use strict';var _=require(_0x4da1('0x0'));var util=require(_0x4da1('0x1'));var moment=require('moment');var BPromise=require(_0x4da1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4da1('0x3'));var db=require(_0x4da1('0x4'))['db'];var utils=require(_0x4da1('0x5'));var logger=require(_0x4da1('0x6'))(_0x4da1('0x7'));var config=require(_0x4da1('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4da1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3332e4,_0x3956bd,_0xb59328){return new BPromise(function(_0x360416,_0xeac9a6){return client[_0x4da1('0xa')](_0x3332e4,_0xb59328)[_0x4da1('0xb')](function(_0x7a29cc){logger[_0x4da1('0xc')](_0x4da1('0xd'),_0x3956bd,_0x4da1('0xe'));logger[_0x4da1('0xf')](_0x4da1('0x10'),_0x3956bd,_0x4da1('0xe'),JSON[_0x4da1('0x11')](_0x7a29cc));if(_0x7a29cc[_0x4da1('0x12')]){if(_0x7a29cc['error']['code']===0x1f4){logger[_0x4da1('0x12')](_0x4da1('0xd'),_0x3956bd,_0x7a29cc[_0x4da1('0x12')][_0x4da1('0x13')]);return _0xeac9a6(_0x7a29cc[_0x4da1('0x12')][_0x4da1('0x13')]);}logger[_0x4da1('0x12')](_0x4da1('0xd'),_0x3956bd,_0x7a29cc[_0x4da1('0x12')][_0x4da1('0x13')]);return _0x360416(_0x7a29cc[_0x4da1('0x12')]['message']);}else{logger[_0x4da1('0xc')]('ZohoConfiguration,\x20%s,\x20%s',_0x3956bd,_0x4da1('0xe'));_0x360416(_0x7a29cc[_0x4da1('0x14')]['message']);}})[_0x4da1('0x15')](function(_0x368e6a){logger['error'](_0x4da1('0xd'),_0x3956bd,_0x368e6a);_0xeac9a6(_0x368e6a);});});} \ No newline at end of file +var _0x1273=['debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','request','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2f8e6e,_0x5cdafb){var _0x5ef9ad=function(_0x14f2b4){while(--_0x14f2b4){_0x2f8e6e['push'](_0x2f8e6e['shift']());}};_0x5ef9ad(++_0x5cdafb);}(_0x1273,0xf2));var _0x3127=function(_0x38884a,_0x3d68d6){_0x38884a=_0x38884a-0x0;var _0x22cf77=_0x1273[_0x38884a];return _0x22cf77;};'use strict';var _=require('lodash');var util=require(_0x3127('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3127('0x1'));var fs=require('fs');var Redis=require(_0x3127('0x2'));var db=require(_0x3127('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3127('0x4'));var config=require(_0x3127('0x5'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x75b7c3,_0x2d9564,_0x24eb81){return new BPromise(function(_0x4e3ae9,_0x382a42){return client[_0x3127('0x6')](_0x75b7c3,_0x24eb81)['then'](function(_0x396973){logger[_0x3127('0x7')](_0x3127('0x8'),_0x2d9564,_0x3127('0x9'));logger[_0x3127('0xa')](_0x3127('0xb'),_0x2d9564,'request\x20sent',JSON[_0x3127('0xc')](_0x396973));if(_0x396973['error']){if(_0x396973[_0x3127('0xd')][_0x3127('0xe')]===0x1f4){logger[_0x3127('0xd')]('ZohoConfiguration,\x20%s,\x20%s',_0x2d9564,_0x396973[_0x3127('0xd')][_0x3127('0xf')]);return _0x382a42(_0x396973['error']['message']);}logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x2d9564,_0x396973[_0x3127('0xd')][_0x3127('0xf')]);return _0x4e3ae9(_0x396973[_0x3127('0xd')][_0x3127('0xf')]);}else{logger[_0x3127('0x7')](_0x3127('0x8'),_0x2d9564,_0x3127('0x9'));_0x4e3ae9(_0x396973[_0x3127('0x10')]['message']);}})[_0x3127('0x11')](function(_0x4959bb){logger['error'](_0x3127('0x8'),_0x2d9564,_0x4959bb);_0x382a42(_0x4959bb);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 581bfa4..0e68e7b 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 _0x7b84=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x191065,_0x5e9dfc){var _0x138006=function(_0x33daa3){while(--_0x33daa3){_0x191065['push'](_0x191065['shift']());}};_0x138006(++_0x5e9dfc);}(_0x7b84,0x17c));var _0x47b8=function(_0xee808,_0x1d4a0c){_0xee808=_0xee808-0x0;var _0x3837b2=_0x7b84[_0xee808];return _0x3837b2;};'use strict';var multer=require(_0x47b8('0x0'));var util=require(_0x47b8('0x1'));var path=require(_0x47b8('0x2'));var timeout=require(_0x47b8('0x3'));var express=require(_0x47b8('0x4'));var router=express[_0x47b8('0x5')]();var auth=require(_0x47b8('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x47b8('0x7'));var controller=require(_0x47b8('0x8'));router[_0x47b8('0x9')]('/',auth[_0x47b8('0xa')](),controller[_0x47b8('0xb')]);router[_0x47b8('0x9')]('/:id',auth[_0x47b8('0xa')](),controller[_0x47b8('0xc')]);router[_0x47b8('0xd')]('/',auth[_0x47b8('0xa')](),controller[_0x47b8('0xe')]);router[_0x47b8('0xf')](_0x47b8('0x10'),auth[_0x47b8('0xa')](),controller[_0x47b8('0x11')]);router[_0x47b8('0x12')](_0x47b8('0x10'),auth[_0x47b8('0xa')](),controller[_0x47b8('0x13')]);module[_0x47b8('0x14')]=router; \ No newline at end of file +var _0x4bd3=['isAuthenticated','index','/:id','post','create','put','delete','destroy','multer','path','connect-timeout','../../components/interaction/service','../../config/environment','./intZohoField.controller'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x4bd3,0x174));var _0x34bd=function(_0x26e2a7,_0xb9a32e){_0x26e2a7=_0x26e2a7-0x0;var _0x40d6f3=_0x4bd3[_0x26e2a7];return _0x40d6f3;};'use strict';var multer=require(_0x34bd('0x0'));var util=require('util');var path=require(_0x34bd('0x1'));var timeout=require(_0x34bd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x34bd('0x3'));var config=require(_0x34bd('0x4'));var controller=require(_0x34bd('0x5'));router['get']('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0x7')]);router['get'](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['show']);router[_0x34bd('0x9')]('/',auth[_0x34bd('0x6')](),controller[_0x34bd('0xa')]);router[_0x34bd('0xb')](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller['update']);router[_0x34bd('0xc')](_0x34bd('0x8'),auth[_0x34bd('0x6')](),controller[_0x34bd('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 303efab..0086fda 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 _0xb016=['sequelize','exports','ENUM','string','variable','customVariable','keyValue','STRING','BOOLEAN'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xb016,0x129));var _0x6b01=function(_0x450261,_0x40f295){_0x450261=_0x450261-0x0;var _0x555151=_0xb016[_0x450261];return _0x555151;};'use strict';var Sequelize=require(_0x6b01('0x0'));module[_0x6b01('0x1')]={'type':{'type':Sequelize[_0x6b01('0x2')](_0x6b01('0x3'),_0x6b01('0x4'),_0x6b01('0x5'),_0x6b01('0x6')),'defaultValue':'string'},'content':{'type':Sequelize[_0x6b01('0x7')]},'key':{'type':Sequelize[_0x6b01('0x7')]},'keyType':{'type':Sequelize[_0x6b01('0x2')](_0x6b01('0x3'),_0x6b01('0x4'),_0x6b01('0x5'))},'keyContent':{'type':Sequelize[_0x6b01('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6b01('0x7')]},'customField':{'type':Sequelize[_0x6b01('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x24ca=['sequelize','string','customVariable','keyValue','STRING','ENUM','BOOLEAN'];(function(_0x3ac3a6,_0x229a91){var _0x43af9f=function(_0x37ba17){while(--_0x37ba17){_0x3ac3a6['push'](_0x3ac3a6['shift']());}};_0x43af9f(++_0x229a91);}(_0x24ca,0x8c));var _0xa24c=function(_0x2a8860,_0x2da926){_0x2a8860=_0x2a8860-0x0;var _0x2f47a4=_0x24ca[_0x2a8860];return _0x2f47a4;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0xa24c('0x1'),'variable',_0xa24c('0x2'),_0xa24c('0x3')),'defaultValue':_0xa24c('0x1')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xa24c('0x4')]},'keyType':{'type':Sequelize[_0xa24c('0x5')](_0xa24c('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa24c('0x4')]},'nameField':{'type':Sequelize[_0xa24c('0x4')]},'customField':{'type':Sequelize[_0xa24c('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa24c('0x4')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 73928b8..c05b270 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 _0x0da4=['send','ZohoField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','map','options','includeAll','rows','catch','show','params','keys','length','include','create','body','find','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','save','update','then','destroy','error','stack','name'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0da4,0x13b));var _0x40da=function(_0x1c8a41,_0x32d1f7){_0x1c8a41=_0x1c8a41-0x0;var _0x2108b4=_0x0da4[_0x1c8a41];return _0x2108b4;};'use strict';var pdf=require(_0x40da('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x40da('0x1'));var zipdir=require(_0x40da('0x2'));var jsonpatch=require(_0x40da('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x40da('0x4'));var Mustache=require(_0x40da('0x5'));var util=require('util');var path=require(_0x40da('0x6'));var sox=require(_0x40da('0x7'));var csv=require('to-csv');var ejs=require(_0x40da('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x40da('0x9'));var crypto=require(_0x40da('0xa'));var jsforce=require(_0x40da('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x40da('0xc'));var querystring=require(_0x40da('0xd'));var Papa=require(_0x40da('0xe'));var Redis=require(_0x40da('0xf'));var authService=require(_0x40da('0x10'));var qs=require(_0x40da('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x40da('0x12'));var logger=require(_0x40da('0x13'))(_0x40da('0x14'));var utils=require(_0x40da('0x15'));var config=require(_0x40da('0x16'));var db=require(_0x40da('0x17'))['db'];function respondWithStatusCode(_0x178612,_0x3aa946){_0x3aa946=_0x3aa946||0xcc;return function(_0x429c17){if(_0x429c17){return _0x178612[_0x40da('0x18')](_0x3aa946);}return _0x178612[_0x40da('0x19')](_0x3aa946)[_0x40da('0x1a')]();};}function respondWithResult(_0x4af040,_0x4dea21){_0x4dea21=_0x4dea21||0xc8;return function(_0x185689){if(_0x185689){return _0x4af040[_0x40da('0x19')](_0x4dea21)[_0x40da('0x1b')](_0x185689);}};}function respondWithFilteredResult(_0x32fe6a,_0x2b12ff){return function(_0x1944f1){if(_0x1944f1){var _0x2382de=_0x1944f1[_0x40da('0x1c')],_0x4885ef=_0x2b12ff[_0x40da('0x1d')],_0x36ce88=_0x2b12ff[_0x40da('0x1d')]+_0x2b12ff[_0x40da('0x1e')],_0x415b6b;if(_0x36ce88>=_0x2382de){_0x36ce88=_0x2382de;_0x415b6b=0xc8;}else{_0x415b6b=0xce;}_0x32fe6a[_0x40da('0x19')](_0x415b6b);return _0x32fe6a[_0x40da('0x1f')]('Content-Range',_0x4885ef+'-'+_0x36ce88+'/'+_0x2382de)[_0x40da('0x1b')](_0x1944f1);}return null;};}function patchUpdates(_0x15e87a){return function(_0x409082){try{jsonpatch[_0x40da('0x20')](_0x409082,_0x15e87a,!![]);}catch(_0x56f07e){return BPromise['reject'](_0x56f07e);}return _0x409082[_0x40da('0x21')]();};}function saveUpdates(_0x3ec23f,_0x54d5fe){return function(_0xf0c2a4){if(_0xf0c2a4){return _0xf0c2a4[_0x40da('0x22')](_0x3ec23f)[_0x40da('0x23')](function(_0x41e4c1){return _0x41e4c1;});}return null;};}function removeEntity(_0x478cad,_0x11f345){return function(_0x4f8dfb){if(_0x4f8dfb){return _0x4f8dfb[_0x40da('0x24')]()[_0x40da('0x23')](function(){_0x478cad['status'](0xcc)[_0x40da('0x1a')]();});}};}function handleEntityNotFound(_0x48af2b,_0x5ae459){return function(_0x4fea1a){if(!_0x4fea1a){_0x48af2b[_0x40da('0x18')](0x194);}return _0x4fea1a;};}function handleError(_0x3b67e8,_0x5ccaf5){_0x5ccaf5=_0x5ccaf5||0x1f4;return function(_0x610b6){logger[_0x40da('0x25')](_0x610b6[_0x40da('0x26')]);if(_0x610b6['name']){delete _0x610b6[_0x40da('0x27')];}_0x3b67e8[_0x40da('0x19')](_0x5ccaf5)[_0x40da('0x28')](_0x610b6);};}exports['index']=function(_0x3e77b6,_0x596bd4){var _0x4aaaa6={},_0x2361a1={},_0x24caed={'count':0x0,'rows':[]};var _0x304b93=_['map'](db[_0x40da('0x29')][_0x40da('0x2a')],function(_0xf6535a){return{'name':_0xf6535a[_0x40da('0x2b')],'type':_0xf6535a[_0x40da('0x2c')][_0x40da('0x2d')]};});_0x2361a1[_0x40da('0x2e')]=_['map'](_0x304b93,'name');_0x2361a1[_0x40da('0x2f')]=_['keys'](_0x3e77b6['query']);_0x2361a1[_0x40da('0x30')]=_[_0x40da('0x31')](_0x2361a1[_0x40da('0x2e')],_0x2361a1['query']);_0x4aaaa6[_0x40da('0x32')]=_[_0x40da('0x31')](_0x2361a1['model'],qs[_0x40da('0x33')](_0x3e77b6[_0x40da('0x2f')][_0x40da('0x33')]));_0x4aaaa6[_0x40da('0x32')]=_0x4aaaa6[_0x40da('0x32')]['length']?_0x4aaaa6[_0x40da('0x32')]:_0x2361a1[_0x40da('0x2e')];if(!_0x3e77b6[_0x40da('0x2f')][_0x40da('0x34')](_0x40da('0x35'))){_0x4aaaa6[_0x40da('0x1e')]=qs[_0x40da('0x1e')](_0x3e77b6['query'][_0x40da('0x1e')]);_0x4aaaa6['offset']=qs['offset'](_0x3e77b6[_0x40da('0x2f')][_0x40da('0x1d')]);}_0x4aaaa6[_0x40da('0x36')]=qs[_0x40da('0x37')](_0x3e77b6[_0x40da('0x2f')][_0x40da('0x37')]);_0x4aaaa6['where']=qs[_0x40da('0x30')](_['pick'](_0x3e77b6[_0x40da('0x2f')],_0x2361a1[_0x40da('0x30')]));if(_0x3e77b6[_0x40da('0x2f')]['filter']){_0x4aaaa6[_0x40da('0x38')]=_[_0x40da('0x39')](_0x4aaaa6[_0x40da('0x38')],{'$or':_[_0x40da('0x3a')](_0x304b93,function(_0x8b648a){if(_0x8b648a[_0x40da('0x2c')]!=='VIRTUAL'){var _0x188bf0={};_0x188bf0[_0x8b648a[_0x40da('0x27')]]={'$like':'%'+_0x3e77b6['query']['filter']+'%'};return _0x188bf0;}})});}_0x4aaaa6=_['merge']({},_0x4aaaa6,_0x3e77b6[_0x40da('0x3b')]);var _0x195df6={'where':_0x4aaaa6[_0x40da('0x38')]};return db[_0x40da('0x29')][_0x40da('0x1c')](_0x195df6)['then'](function(_0x42392e){_0x24caed['count']=_0x42392e;if(_0x3e77b6['query'][_0x40da('0x3c')]){_0x4aaaa6['include']=[{'all':!![]}];}return db['ZohoField']['findAll'](_0x4aaaa6);})[_0x40da('0x23')](function(_0x52c7d1){_0x24caed[_0x40da('0x3d')]=_0x52c7d1;return _0x24caed;})[_0x40da('0x23')](respondWithFilteredResult(_0x596bd4,_0x4aaaa6))[_0x40da('0x3e')](handleError(_0x596bd4,null));};exports[_0x40da('0x3f')]=function(_0x2f15b2,_0x24ccf8){var _0x2fec47={'raw':!![],'where':{'id':_0x2f15b2[_0x40da('0x40')]['id']}},_0x310eae={};_0x310eae[_0x40da('0x2e')]=_['keys'](db[_0x40da('0x29')]['rawAttributes']);_0x310eae[_0x40da('0x2f')]=_[_0x40da('0x41')](_0x2f15b2['query']);_0x310eae[_0x40da('0x30')]=_[_0x40da('0x31')](_0x310eae[_0x40da('0x2e')],_0x310eae['query']);_0x2fec47[_0x40da('0x32')]=_[_0x40da('0x31')](_0x310eae['model'],qs[_0x40da('0x33')](_0x2f15b2['query'][_0x40da('0x33')]));_0x2fec47['attributes']=_0x2fec47[_0x40da('0x32')][_0x40da('0x42')]?_0x2fec47[_0x40da('0x32')]:_0x310eae[_0x40da('0x2e')];if(_0x2f15b2[_0x40da('0x2f')][_0x40da('0x3c')]){_0x2fec47[_0x40da('0x43')]=[{'all':!![]}];}_0x2fec47=_['merge']({},_0x2fec47,_0x2f15b2[_0x40da('0x3b')]);return db[_0x40da('0x29')]['find'](_0x2fec47)[_0x40da('0x23')](handleEntityNotFound(_0x24ccf8,null))['then'](respondWithResult(_0x24ccf8,null))[_0x40da('0x3e')](handleError(_0x24ccf8,null));};exports[_0x40da('0x44')]=function(_0x3f9ab8,_0x44bd4c){return db['ZohoField'][_0x40da('0x44')](_0x3f9ab8[_0x40da('0x45')],{})[_0x40da('0x23')](respondWithResult(_0x44bd4c,0xc9))[_0x40da('0x3e')](handleError(_0x44bd4c,null));};exports[_0x40da('0x22')]=function(_0x1b2652,_0x3fa6f3){if(_0x1b2652['body']['id']){delete _0x1b2652[_0x40da('0x45')]['id'];}return db[_0x40da('0x29')][_0x40da('0x46')]({'where':{'id':_0x1b2652[_0x40da('0x40')]['id']}})[_0x40da('0x23')](handleEntityNotFound(_0x3fa6f3,null))[_0x40da('0x23')](saveUpdates(_0x1b2652[_0x40da('0x45')],null))[_0x40da('0x23')](respondWithResult(_0x3fa6f3,null))['catch'](handleError(_0x3fa6f3,null));};exports[_0x40da('0x24')]=function(_0x1b758e,_0x32a6d6){return db[_0x40da('0x29')][_0x40da('0x46')]({'where':{'id':_0x1b758e[_0x40da('0x40')]['id']}})[_0x40da('0x23')](handleEntityNotFound(_0x32a6d6,null))['then'](removeEntity(_0x32a6d6,null))[_0x40da('0x3e')](handleError(_0x32a6d6,null));}; \ No newline at end of file +var _0x5582=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','update','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','reject','save','then','destroy','end','name','index','map','ZohoField','key','model','query','keys'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5582,0x67));var _0x2558=function(_0x936389,_0x21883d){_0x936389=_0x936389-0x0;var _0x1aeb3a=_0x5582[_0x936389];return _0x1aeb3a;};'use strict';var pdf=require(_0x2558('0x0'));var emlformat=require(_0x2558('0x1'));var rimraf=require(_0x2558('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2558('0x3'));var rp=require(_0x2558('0x4'));var moment=require(_0x2558('0x5'));var BPromise=require(_0x2558('0x6'));var Mustache=require('mustache');var util=require(_0x2558('0x7'));var path=require(_0x2558('0x8'));var sox=require(_0x2558('0x9'));var csv=require(_0x2558('0xa'));var ejs=require(_0x2558('0xb'));var fs=require('fs');var _=require(_0x2558('0xc'));var squel=require(_0x2558('0xd'));var crypto=require(_0x2558('0xe'));var jsforce=require(_0x2558('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2558('0x10'));var Papa=require(_0x2558('0x11'));var Redis=require('ioredis');var authService=require(_0x2558('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2558('0x13'));var hardwareService=require(_0x2558('0x14'));var logger=require(_0x2558('0x15'))('api');var utils=require(_0x2558('0x16'));var config=require(_0x2558('0x17'));var db=require(_0x2558('0x18'))['db'];function respondWithStatusCode(_0x9c12f8,_0x1b7aec){_0x1b7aec=_0x1b7aec||0xcc;return function(_0x4c88d2){if(_0x4c88d2){return _0x9c12f8[_0x2558('0x19')](_0x1b7aec);}return _0x9c12f8[_0x2558('0x1a')](_0x1b7aec)['end']();};}function respondWithResult(_0xad5073,_0x4f2481){_0x4f2481=_0x4f2481||0xc8;return function(_0x42b350){if(_0x42b350){return _0xad5073[_0x2558('0x1a')](_0x4f2481)[_0x2558('0x1b')](_0x42b350);}};}function respondWithFilteredResult(_0x3b176f,_0x3546e3){return function(_0x52c275){if(_0x52c275){var _0x158a47=_0x52c275['count'],_0x3cbeb1=_0x3546e3[_0x2558('0x1c')],_0x164683=_0x3546e3[_0x2558('0x1c')]+_0x3546e3[_0x2558('0x1d')],_0x569234;if(_0x164683>=_0x158a47){_0x164683=_0x158a47;_0x569234=0xc8;}else{_0x569234=0xce;}_0x3b176f[_0x2558('0x1a')](_0x569234);return _0x3b176f['set'](_0x2558('0x1e'),_0x3cbeb1+'-'+_0x164683+'/'+_0x158a47)[_0x2558('0x1b')](_0x52c275);}return null;};}function patchUpdates(_0x4fe218){return function(_0x5df1cd){try{jsonpatch[_0x2558('0x1f')](_0x5df1cd,_0x4fe218,!![]);}catch(_0x5399ee){return BPromise[_0x2558('0x20')](_0x5399ee);}return _0x5df1cd[_0x2558('0x21')]();};}function saveUpdates(_0x55b8f7,_0x1980a9){return function(_0x166f54){if(_0x166f54){return _0x166f54['update'](_0x55b8f7)[_0x2558('0x22')](function(_0x3c34a5){return _0x3c34a5;});}return null;};}function removeEntity(_0x2dd980,_0x5aad76){return function(_0x10579e){if(_0x10579e){return _0x10579e[_0x2558('0x23')]()[_0x2558('0x22')](function(){_0x2dd980[_0x2558('0x1a')](0xcc)[_0x2558('0x24')]();});}};}function handleEntityNotFound(_0x142aab,_0x149441){return function(_0x5e4560){if(!_0x5e4560){_0x142aab[_0x2558('0x19')](0x194);}return _0x5e4560;};}function handleError(_0x2620a6,_0x2ae5ac){_0x2ae5ac=_0x2ae5ac||0x1f4;return function(_0x54ab31){logger['error'](_0x54ab31['stack']);if(_0x54ab31[_0x2558('0x25')]){delete _0x54ab31[_0x2558('0x25')];}_0x2620a6[_0x2558('0x1a')](_0x2ae5ac)['send'](_0x54ab31);};}exports[_0x2558('0x26')]=function(_0x132006,_0x4bcce5){var _0x58f399={},_0x3367f6={},_0x367c32={'count':0x0,'rows':[]};var _0x2ddf03=_[_0x2558('0x27')](db[_0x2558('0x28')]['rawAttributes'],function(_0x53f93e){return{'name':_0x53f93e['fieldName'],'type':_0x53f93e['type'][_0x2558('0x29')]};});_0x3367f6[_0x2558('0x2a')]=_[_0x2558('0x27')](_0x2ddf03,_0x2558('0x25'));_0x3367f6[_0x2558('0x2b')]=_[_0x2558('0x2c')](_0x132006[_0x2558('0x2b')]);_0x3367f6[_0x2558('0x2d')]=_[_0x2558('0x2e')](_0x3367f6['model'],_0x3367f6['query']);_0x58f399[_0x2558('0x2f')]=_[_0x2558('0x2e')](_0x3367f6['model'],qs[_0x2558('0x30')](_0x132006['query'][_0x2558('0x30')]));_0x58f399[_0x2558('0x2f')]=_0x58f399['attributes']['length']?_0x58f399['attributes']:_0x3367f6[_0x2558('0x2a')];if(!_0x132006[_0x2558('0x2b')][_0x2558('0x31')](_0x2558('0x32'))){_0x58f399[_0x2558('0x1d')]=qs[_0x2558('0x1d')](_0x132006[_0x2558('0x2b')][_0x2558('0x1d')]);_0x58f399[_0x2558('0x1c')]=qs[_0x2558('0x1c')](_0x132006['query'][_0x2558('0x1c')]);}_0x58f399[_0x2558('0x33')]=qs[_0x2558('0x34')](_0x132006['query']['sort']);_0x58f399[_0x2558('0x35')]=qs['filters'](_[_0x2558('0x36')](_0x132006[_0x2558('0x2b')],_0x3367f6[_0x2558('0x2d')]));if(_0x132006[_0x2558('0x2b')][_0x2558('0x37')]){_0x58f399[_0x2558('0x35')]=_[_0x2558('0x38')](_0x58f399[_0x2558('0x35')],{'$or':_['map'](_0x2ddf03,function(_0x2586bb){if(_0x2586bb[_0x2558('0x39')]!==_0x2558('0x3a')){var _0x341bc1={};_0x341bc1[_0x2586bb[_0x2558('0x25')]]={'$like':'%'+_0x132006[_0x2558('0x2b')]['filter']+'%'};return _0x341bc1;}})});}_0x58f399=_[_0x2558('0x38')]({},_0x58f399,_0x132006[_0x2558('0x3b')]);var _0x2d95e2={'where':_0x58f399[_0x2558('0x35')]};return db[_0x2558('0x28')][_0x2558('0x3c')](_0x2d95e2)[_0x2558('0x22')](function(_0x7243a7){_0x367c32[_0x2558('0x3c')]=_0x7243a7;if(_0x132006[_0x2558('0x2b')][_0x2558('0x3d')]){_0x58f399[_0x2558('0x3e')]=[{'all':!![]}];}return db[_0x2558('0x28')][_0x2558('0x3f')](_0x58f399);})[_0x2558('0x22')](function(_0x3c013a){_0x367c32[_0x2558('0x40')]=_0x3c013a;return _0x367c32;})[_0x2558('0x22')](respondWithFilteredResult(_0x4bcce5,_0x58f399))[_0x2558('0x41')](handleError(_0x4bcce5,null));};exports[_0x2558('0x42')]=function(_0x23891c,_0x609cf5){var _0x3a13fd={'raw':!![],'where':{'id':_0x23891c[_0x2558('0x43')]['id']}},_0x31e274={};_0x31e274[_0x2558('0x2a')]=_['keys'](db[_0x2558('0x28')][_0x2558('0x44')]);_0x31e274[_0x2558('0x2b')]=_[_0x2558('0x2c')](_0x23891c[_0x2558('0x2b')]);_0x31e274[_0x2558('0x2d')]=_['intersection'](_0x31e274[_0x2558('0x2a')],_0x31e274[_0x2558('0x2b')]);_0x3a13fd[_0x2558('0x2f')]=_['intersection'](_0x31e274[_0x2558('0x2a')],qs[_0x2558('0x30')](_0x23891c['query']['fields']));_0x3a13fd['attributes']=_0x3a13fd[_0x2558('0x2f')][_0x2558('0x45')]?_0x3a13fd[_0x2558('0x2f')]:_0x31e274[_0x2558('0x2a')];if(_0x23891c['query'][_0x2558('0x3d')]){_0x3a13fd[_0x2558('0x3e')]=[{'all':!![]}];}_0x3a13fd=_[_0x2558('0x38')]({},_0x3a13fd,_0x23891c[_0x2558('0x3b')]);return db[_0x2558('0x28')][_0x2558('0x46')](_0x3a13fd)[_0x2558('0x22')](handleEntityNotFound(_0x609cf5,null))[_0x2558('0x22')](respondWithResult(_0x609cf5,null))[_0x2558('0x41')](handleError(_0x609cf5,null));};exports[_0x2558('0x47')]=function(_0x3d1668,_0x52f1d7){return db[_0x2558('0x28')][_0x2558('0x47')](_0x3d1668[_0x2558('0x48')],{})[_0x2558('0x22')](respondWithResult(_0x52f1d7,0xc9))[_0x2558('0x41')](handleError(_0x52f1d7,null));};exports[_0x2558('0x49')]=function(_0x4879f1,_0x589339){if(_0x4879f1[_0x2558('0x48')]['id']){delete _0x4879f1[_0x2558('0x48')]['id'];}return db['ZohoField'][_0x2558('0x46')]({'where':{'id':_0x4879f1[_0x2558('0x43')]['id']}})[_0x2558('0x22')](handleEntityNotFound(_0x589339,null))[_0x2558('0x22')](saveUpdates(_0x4879f1['body'],null))['then'](respondWithResult(_0x589339,null))[_0x2558('0x41')](handleError(_0x589339,null));};exports[_0x2558('0x23')]=function(_0x5732e4,_0x4c4aa6){return db[_0x2558('0x28')]['find']({'where':{'id':_0x5732e4[_0x2558('0x43')]['id']}})[_0x2558('0x22')](handleEntityNotFound(_0x4c4aa6,null))[_0x2558('0x22')](removeEntity(_0x4c4aa6,null))[_0x2558('0x41')](handleError(_0x4c4aa6,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index ff5d9bc..65ce5b6 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 _0xefbd=['moment','request-promise','path','rimraf','../../config/environment','ZohoField','int_zoho_fields','FieldId','lodash','util','../../config/logger'];(function(_0x45b82f,_0x3bca8e){var _0x21b2bf=function(_0x3f8971){while(--_0x3f8971){_0x45b82f['push'](_0x45b82f['shift']());}};_0x21b2bf(++_0x3bca8e);}(_0xefbd,0x19f));var _0xdefb=function(_0x5530eb,_0x6bbfd2){_0x5530eb=_0x5530eb-0x0;var _0x48089a=_0xefbd[_0x5530eb];return _0x48089a;};'use strict';var _=require(_0xdefb('0x0'));var util=require(_0xdefb('0x1'));var logger=require(_0xdefb('0x2'))('api');var moment=require(_0xdefb('0x3'));var BPromise=require('bluebird');var rp=require(_0xdefb('0x4'));var fs=require('fs');var path=require(_0xdefb('0x5'));var rimraf=require(_0xdefb('0x6'));var config=require(_0xdefb('0x7'));var attributes=require('./intZohoField.attributes');module['exports']=function(_0x1a0c96,_0xbf762){return _0x1a0c96['define'](_0xdefb('0x8'),attributes,{'tableName':_0xdefb('0x9'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':['idField',_0xdefb('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x041d=['FieldId','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x50247d,_0x379935){var _0x2fd743=function(_0x1d0083){while(--_0x1d0083){_0x50247d['push'](_0x50247d['shift']());}};_0x2fd743(++_0x379935);}(_0x041d,0x141));var _0xd041=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x041d[_0x4b7895];return _0x264180;};'use strict';var _=require(_0xd041('0x0'));var util=require(_0xd041('0x1'));var logger=require('../../config/logger')(_0xd041('0x2'));var moment=require('moment');var BPromise=require(_0xd041('0x3'));var rp=require(_0xd041('0x4'));var fs=require('fs');var path=require(_0xd041('0x5'));var rimraf=require(_0xd041('0x6'));var config=require(_0xd041('0x7'));var attributes=require(_0xd041('0x8'));module[_0xd041('0x9')]=function(_0x473853,_0x364f08){return _0x473853[_0xd041('0xa')](_0xd041('0xb'),attributes,{'tableName':_0xd041('0xc'),'paranoid':![],'indexes':[{'name':_0xd041('0xd'),'fields':[_0xd041('0xe'),_0xd041('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index ae1a4ad..03066d9 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 _0x4c4e=['result','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x406a72,_0x38bcdc){var _0x4f44e4=function(_0x325641){while(--_0x325641){_0x406a72['push'](_0x406a72['shift']());}};_0x4f44e4(++_0x38bcdc);}(_0x4c4e,0x152));var _0xe4c4=function(_0x5d570f,_0xc94f2e){_0x5d570f=_0x5d570f-0x0;var _0x47445b=_0x4c4e[_0x5d570f];return _0x47445b;};'use strict';var _=require(_0xe4c4('0x0'));var util=require('util');var moment=require(_0xe4c4('0x1'));var BPromise=require(_0xe4c4('0x2'));var rs=require(_0xe4c4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe4c4('0x4'))['db'];var utils=require(_0xe4c4('0x5'));var logger=require(_0xe4c4('0x6'))('rpc');var config=require(_0xe4c4('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xe4c4('0x8')][_0xe4c4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x262b64,_0xad105,_0x22085a){return new BPromise(function(_0x329d29,_0x28a42e){return client[_0xe4c4('0xa')](_0x262b64,_0x22085a)['then'](function(_0x589b2e){logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));logger[_0xe4c4('0xe')](_0xe4c4('0xf'),_0xad105,_0xe4c4('0xd'),JSON['stringify'](_0x589b2e));if(_0x589b2e[_0xe4c4('0x10')]){if(_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x11')]===0x1f4){logger[_0xe4c4('0x10')]('ZohoField,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x28a42e(_0x589b2e['error'][_0xe4c4('0x12')]);}logger[_0xe4c4('0x10')]('ZohoField,\x20%s,\x20%s',_0xad105,_0x589b2e[_0xe4c4('0x10')][_0xe4c4('0x12')]);return _0x329d29(_0x589b2e['error'][_0xe4c4('0x12')]);}else{logger[_0xe4c4('0xb')](_0xe4c4('0xc'),_0xad105,_0xe4c4('0xd'));_0x329d29(_0x589b2e[_0xe4c4('0x13')][_0xe4c4('0x12')]);}})[_0xe4c4('0x14')](function(_0x1038cb){logger[_0xe4c4('0x10')](_0xe4c4('0xc'),_0xad105,_0x1038cb);_0x28a42e(_0x1038cb);});});} \ 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(_0x526894,_0x12b7a1){var _0x4cba37=function(_0xb85cb6){while(--_0xb85cb6){_0x526894['push'](_0x526894['shift']());}};_0x4cba37(++_0x12b7a1);}(_0xee14,0x13a));var _0x4ee1=function(_0x5158f5,_0xcc31ac){_0x5158f5=_0x5158f5-0x0;var _0x2077e8=_0xee14[_0x5158f5];return _0x2077e8;};'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 a5d5bae..e9699d2 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 _0x96b0=['path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x53a4ae,_0x205c04){var _0x34da61=function(_0x1402fe){while(--_0x1402fe){_0x53a4ae['push'](_0x53a4ae['shift']());}};_0x34da61(++_0x205c04);}(_0x96b0,0x10e));var _0x096b=function(_0x281266,_0x17807e){_0x281266=_0x281266-0x0;var _0x34b80b=_0x96b0[_0x281266];return _0x34b80b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x096b('0x0'));var timeout=require(_0x096b('0x1'));var express=require(_0x096b('0x2'));var router=express[_0x096b('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x096b('0x4'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0xa166=['../../config/environment','multer','express','Router','../../components/auth/service'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xa166,0x1be));var _0x6a16=function(_0x4a11fe,_0x4d4156){_0x4a11fe=_0x4a11fe-0x0;var _0x2c5bfd=_0xa166[_0x4a11fe];return _0x2c5bfd;};'use strict';var multer=require(_0x6a16('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6a16('0x1'));var router=express[_0x6a16('0x2')]();var auth=require(_0x6a16('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6a16('0x4'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index eeddd1d..4aa9ddd 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 _0x48b7=['STRING','unique_name_and_version','app.js','BOOLEAN','state','sequelize'];(function(_0x1cb119,_0x31ce79){var _0x2eb79a=function(_0x313f35){while(--_0x313f35){_0x1cb119['push'](_0x1cb119['shift']());}};_0x2eb79a(++_0x31ce79);}(_0x48b7,0xe9));var _0x748b=function(_0x40570f,_0x3fb4fd){_0x40570f=_0x40570f-0x0;var _0x4f1ad9=_0x48b7[_0x40570f];return _0x4f1ad9;};'use strict';var Sequelize=require(_0x748b('0x0'));module['exports']={'name':{'type':Sequelize[_0x748b('0x1')],'allowNull':![],'unique':_0x748b('0x2')},'version':{'type':Sequelize[_0x748b('0x1')],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize['STRING'],'defaultValue':_0x748b('0x3')},'filename':{'type':Sequelize[_0x748b('0x1')]},'path':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x748b('0x4')],'defaultValue':![]},'author':{'type':Sequelize[_0x748b('0x1')]},'logo':{'type':Sequelize[_0x748b('0x1')]},'state':{'type':Sequelize['STRING'],'unique':_0x748b('0x5')},'description':{'type':Sequelize[_0x748b('0x1')]},'title':{'type':Sequelize[_0x748b('0x1')]},'remoteUri':{'type':Sequelize[_0x748b('0x1')]},'link':{'type':Sequelize[_0x748b('0x1')],'defaultValue':'#'}}; \ No newline at end of file +var _0xda02=['app.js','INTEGER','BOOLEAN','exports','STRING','unique_name_and_version'];(function(_0x74c15a,_0x45728f){var _0x267902=function(_0x531d1b){while(--_0x531d1b){_0x74c15a['push'](_0x74c15a['shift']());}};_0x267902(++_0x45728f);}(_0xda02,0x111));var _0x2da0=function(_0x43aee5,_0x11268b){_0x43aee5=_0x43aee5-0x0;var _0x76d1d0=_0xda02[_0x43aee5];return _0x76d1d0;};'use strict';var Sequelize=require('sequelize');module[_0x2da0('0x0')]={'name':{'type':Sequelize[_0x2da0('0x1')],'allowNull':![],'unique':_0x2da0('0x2')},'version':{'type':Sequelize[_0x2da0('0x1')],'allowNull':![],'unique':_0x2da0('0x2')},'main':{'type':Sequelize['STRING'],'defaultValue':_0x2da0('0x3')},'filename':{'type':Sequelize[_0x2da0('0x1')]},'path':{'type':Sequelize[_0x2da0('0x1')]},'type':{'type':Sequelize[_0x2da0('0x1')]},'size':{'type':Sequelize[_0x2da0('0x4')]},'active':{'type':Sequelize[_0x2da0('0x5')],'defaultValue':![]},'author':{'type':Sequelize[_0x2da0('0x1')]},'logo':{'type':Sequelize[_0x2da0('0x1')]},'state':{'type':Sequelize[_0x2da0('0x1')],'unique':'state'},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x2da0('0x1')]},'remoteUri':{'type':Sequelize[_0x2da0('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index ceb349c..d3337bd 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 _0xdb77=['keys','find','create','body','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','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','end','json','offset','limit','set','apply','save','destroy','then','stack','name','map','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','Integration','count','includeAll','include','findAll','rows','catch','show'];(function(_0x1757f2,_0x1b09fa){var _0x5e7212=function(_0x4f1794){while(--_0x4f1794){_0x1757f2['push'](_0x1757f2['shift']());}};_0x5e7212(++_0x1b09fa);}(_0xdb77,0xe4));var _0x7db7=function(_0x313820,_0x2ae85e){_0x313820=_0x313820-0x0;var _0x434fd5=_0xdb77[_0x313820];return _0x434fd5;};'use strict';var pdf=require(_0x7db7('0x0'));var emlformat=require(_0x7db7('0x1'));var rimraf=require(_0x7db7('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7db7('0x3'));var rp=require(_0x7db7('0x4'));var moment=require(_0x7db7('0x5'));var BPromise=require(_0x7db7('0x6'));var Mustache=require(_0x7db7('0x7'));var util=require(_0x7db7('0x8'));var path=require(_0x7db7('0x9'));var sox=require('sox');var csv=require(_0x7db7('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x7db7('0xb'));var squel=require(_0x7db7('0xc'));var crypto=require(_0x7db7('0xd'));var jsforce=require(_0x7db7('0xe'));var deskjs=require(_0x7db7('0xf'));var toCsv=require(_0x7db7('0xa'));var querystring=require(_0x7db7('0x10'));var Papa=require(_0x7db7('0x11'));var Redis=require(_0x7db7('0x12'));var authService=require(_0x7db7('0x13'));var qs=require(_0x7db7('0x14'));var as=require(_0x7db7('0x15'));var hardwareService=require(_0x7db7('0x16'));var logger=require(_0x7db7('0x17'))(_0x7db7('0x18'));var utils=require(_0x7db7('0x19'));var config=require('../../config/environment');var db=require(_0x7db7('0x1a'))['db'];function respondWithStatusCode(_0x388d48,_0x2e5749){_0x2e5749=_0x2e5749||0xcc;return function(_0x1b1cae){if(_0x1b1cae){return _0x388d48[_0x7db7('0x1b')](_0x2e5749);}return _0x388d48[_0x7db7('0x1c')](_0x2e5749)[_0x7db7('0x1d')]();};}function respondWithResult(_0x569be7,_0x50f583){_0x50f583=_0x50f583||0xc8;return function(_0x7e18f2){if(_0x7e18f2){return _0x569be7['status'](_0x50f583)[_0x7db7('0x1e')](_0x7e18f2);}};}function respondWithFilteredResult(_0x5b5b3d,_0x535205){return function(_0x39f45b){if(_0x39f45b){var _0x3594af=_0x39f45b['count'],_0x28f7c4=_0x535205[_0x7db7('0x1f')],_0x34c911=_0x535205[_0x7db7('0x1f')]+_0x535205[_0x7db7('0x20')],_0xe3f178;if(_0x34c911>=_0x3594af){_0x34c911=_0x3594af;_0xe3f178=0xc8;}else{_0xe3f178=0xce;}_0x5b5b3d[_0x7db7('0x1c')](_0xe3f178);return _0x5b5b3d[_0x7db7('0x21')]('Content-Range',_0x28f7c4+'-'+_0x34c911+'/'+_0x3594af)[_0x7db7('0x1e')](_0x39f45b);}return null;};}function patchUpdates(_0x5a3ac7){return function(_0x1251b5){try{jsonpatch[_0x7db7('0x22')](_0x1251b5,_0x5a3ac7,!![]);}catch(_0x381968){return BPromise['reject'](_0x381968);}return _0x1251b5[_0x7db7('0x23')]();};}function saveUpdates(_0x134682,_0x215bcb){return function(_0x357cef){if(_0x357cef){return _0x357cef['update'](_0x134682)['then'](function(_0x19bfec){return _0x19bfec;});}return null;};}function removeEntity(_0x14f5b7,_0xb6755a){return function(_0x162314){if(_0x162314){return _0x162314[_0x7db7('0x24')]()[_0x7db7('0x25')](function(){_0x14f5b7[_0x7db7('0x1c')](0xcc)[_0x7db7('0x1d')]();});}};}function handleEntityNotFound(_0x8705d5,_0x4a8da0){return function(_0x48a52c){if(!_0x48a52c){_0x8705d5[_0x7db7('0x1b')](0x194);}return _0x48a52c;};}function handleError(_0x19b290,_0x91aec){_0x91aec=_0x91aec||0x1f4;return function(_0x30a1a1){logger['error'](_0x30a1a1[_0x7db7('0x26')]);if(_0x30a1a1[_0x7db7('0x27')]){delete _0x30a1a1[_0x7db7('0x27')];}_0x19b290[_0x7db7('0x1c')](_0x91aec)['send'](_0x30a1a1);};}exports['index']=function(_0x462998,_0x17047a){var _0x47b820={},_0x9d9d2e={},_0x1873ae={'count':0x0,'rows':[]};var _0x59bd04=_[_0x7db7('0x28')](db['Integration'][_0x7db7('0x29')],function(_0x1a9c7b){return{'name':_0x1a9c7b[_0x7db7('0x2a')],'type':_0x1a9c7b['type'][_0x7db7('0x2b')]};});_0x9d9d2e['model']=_[_0x7db7('0x28')](_0x59bd04,_0x7db7('0x27'));_0x9d9d2e['query']=_['keys'](_0x462998[_0x7db7('0x2c')]);_0x9d9d2e[_0x7db7('0x2d')]=_[_0x7db7('0x2e')](_0x9d9d2e[_0x7db7('0x2f')],_0x9d9d2e[_0x7db7('0x2c')]);_0x47b820[_0x7db7('0x30')]=_[_0x7db7('0x2e')](_0x9d9d2e['model'],qs[_0x7db7('0x31')](_0x462998[_0x7db7('0x2c')][_0x7db7('0x31')]));_0x47b820[_0x7db7('0x30')]=_0x47b820[_0x7db7('0x30')][_0x7db7('0x32')]?_0x47b820[_0x7db7('0x30')]:_0x9d9d2e['model'];if(!_0x462998[_0x7db7('0x2c')][_0x7db7('0x33')](_0x7db7('0x34'))){_0x47b820['limit']=qs['limit'](_0x462998['query'][_0x7db7('0x20')]);_0x47b820[_0x7db7('0x1f')]=qs[_0x7db7('0x1f')](_0x462998[_0x7db7('0x2c')]['offset']);}_0x47b820[_0x7db7('0x35')]=qs['sort'](_0x462998[_0x7db7('0x2c')]['sort']);_0x47b820[_0x7db7('0x36')]=qs[_0x7db7('0x2d')](_[_0x7db7('0x37')](_0x462998[_0x7db7('0x2c')],_0x9d9d2e[_0x7db7('0x2d')]));if(_0x462998[_0x7db7('0x2c')][_0x7db7('0x38')]){_0x47b820['where']=_[_0x7db7('0x39')](_0x47b820[_0x7db7('0x36')],{'$or':_[_0x7db7('0x28')](_0x59bd04,function(_0x426b83){if(_0x426b83['type']!==_0x7db7('0x3a')){var _0x4c0741={};_0x4c0741[_0x426b83['name']]={'$like':'%'+_0x462998['query']['filter']+'%'};return _0x4c0741;}})});}_0x47b820=_['merge']({},_0x47b820,_0x462998[_0x7db7('0x3b')]);var _0x1533b3={'where':_0x47b820[_0x7db7('0x36')]};return db[_0x7db7('0x3c')][_0x7db7('0x3d')](_0x1533b3)[_0x7db7('0x25')](function(_0x2fc16c){_0x1873ae[_0x7db7('0x3d')]=_0x2fc16c;if(_0x462998[_0x7db7('0x2c')][_0x7db7('0x3e')]){_0x47b820[_0x7db7('0x3f')]=[{'all':!![]}];}return db['Integration'][_0x7db7('0x40')](_0x47b820);})[_0x7db7('0x25')](function(_0x496034){_0x1873ae[_0x7db7('0x41')]=_0x496034;return _0x1873ae;})[_0x7db7('0x25')](respondWithFilteredResult(_0x17047a,_0x47b820))[_0x7db7('0x42')](handleError(_0x17047a,null));};exports[_0x7db7('0x43')]=function(_0x3cd40f,_0x453be3){var _0x3718ac={'raw':![],'where':{'id':_0x3cd40f['params']['id']}},_0xa4194a={};_0xa4194a[_0x7db7('0x2f')]=_[_0x7db7('0x44')](db[_0x7db7('0x3c')]['rawAttributes']);_0xa4194a[_0x7db7('0x2c')]=_['keys'](_0x3cd40f[_0x7db7('0x2c')]);_0xa4194a[_0x7db7('0x2d')]=_[_0x7db7('0x2e')](_0xa4194a[_0x7db7('0x2f')],_0xa4194a[_0x7db7('0x2c')]);_0x3718ac[_0x7db7('0x30')]=_[_0x7db7('0x2e')](_0xa4194a[_0x7db7('0x2f')],qs[_0x7db7('0x31')](_0x3cd40f[_0x7db7('0x2c')][_0x7db7('0x31')]));_0x3718ac[_0x7db7('0x30')]=_0x3718ac[_0x7db7('0x30')]['length']?_0x3718ac[_0x7db7('0x30')]:_0xa4194a['model'];if(_0x3cd40f[_0x7db7('0x2c')][_0x7db7('0x3e')]){_0x3718ac['include']=[{'all':!![]}];}_0x3718ac=_[_0x7db7('0x39')]({},_0x3718ac,_0x3cd40f[_0x7db7('0x3b')]);return db['Integration'][_0x7db7('0x45')](_0x3718ac)[_0x7db7('0x25')](handleEntityNotFound(_0x453be3,null))[_0x7db7('0x25')](respondWithResult(_0x453be3,null))[_0x7db7('0x42')](handleError(_0x453be3,null));};exports['create']=function(_0x481116,_0x5ce6a4){return db[_0x7db7('0x3c')][_0x7db7('0x46')](_0x481116[_0x7db7('0x47')],{})[_0x7db7('0x25')](respondWithResult(_0x5ce6a4,0xc9))[_0x7db7('0x42')](handleError(_0x5ce6a4,null));};exports[_0x7db7('0x48')]=function(_0x334a23,_0x1937db){if(_0x334a23[_0x7db7('0x47')]['id']){delete _0x334a23[_0x7db7('0x47')]['id'];}return db['Integration']['find']({'where':{'id':_0x334a23[_0x7db7('0x49')]['id']}})[_0x7db7('0x25')](handleEntityNotFound(_0x1937db,null))['then'](saveUpdates(_0x334a23['body'],null))[_0x7db7('0x25')](respondWithResult(_0x1937db,null))['catch'](handleError(_0x1937db,null));};exports[_0x7db7('0x24')]=function(_0x23e09b,_0x8faf27){return db['Integration'][_0x7db7('0x45')]({'where':{'id':_0x23e09b[_0x7db7('0x49')]['id']}})[_0x7db7('0x25')](handleEntityNotFound(_0x8faf27,null))[_0x7db7('0x25')](removeEntity(_0x8faf27,null))[_0x7db7('0x42')](handleError(_0x8faf27,null));}; \ No newline at end of file +var _0x1b15=['crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','name','map','Integration','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','type','filter','findAll','rows','catch','show','keys','includeAll','include','create','body','find','params','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0x1b15,0x1ae));var _0x51b1=function(_0x5cf661,_0x56b806){_0x5cf661=_0x5cf661-0x0;var _0x3adfa9=_0x1b15[_0x5cf661];return _0x3adfa9;};'use strict';var pdf=require(_0x51b1('0x0'));var emlformat=require(_0x51b1('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x51b1('0x2'));var jsonpatch=require(_0x51b1('0x3'));var rp=require(_0x51b1('0x4'));var moment=require(_0x51b1('0x5'));var BPromise=require(_0x51b1('0x6'));var Mustache=require('mustache');var util=require(_0x51b1('0x7'));var path=require(_0x51b1('0x8'));var sox=require(_0x51b1('0x9'));var csv=require(_0x51b1('0xa'));var ejs=require(_0x51b1('0xb'));var fs=require('fs');var _=require(_0x51b1('0xc'));var squel=require(_0x51b1('0xd'));var crypto=require(_0x51b1('0xe'));var jsforce=require(_0x51b1('0xf'));var deskjs=require(_0x51b1('0x10'));var toCsv=require(_0x51b1('0xa'));var querystring=require('querystring');var Papa=require(_0x51b1('0x11'));var Redis=require(_0x51b1('0x12'));var authService=require(_0x51b1('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x51b1('0x14'));var hardwareService=require(_0x51b1('0x15'));var logger=require(_0x51b1('0x16'))(_0x51b1('0x17'));var utils=require(_0x51b1('0x18'));var config=require(_0x51b1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23c37f,_0x3961f9){_0x3961f9=_0x3961f9||0xcc;return function(_0x4a8832){if(_0x4a8832){return _0x23c37f[_0x51b1('0x1a')](_0x3961f9);}return _0x23c37f[_0x51b1('0x1b')](_0x3961f9)[_0x51b1('0x1c')]();};}function respondWithResult(_0x8c6b45,_0x52f82d){_0x52f82d=_0x52f82d||0xc8;return function(_0x662fec){if(_0x662fec){return _0x8c6b45[_0x51b1('0x1b')](_0x52f82d)['json'](_0x662fec);}};}function respondWithFilteredResult(_0x13a0b8,_0x12b45f){return function(_0x4b4672){if(_0x4b4672){var _0x2663f2=_0x4b4672[_0x51b1('0x1d')],_0xb53d77=_0x12b45f['offset'],_0x30aa66=_0x12b45f[_0x51b1('0x1e')]+_0x12b45f[_0x51b1('0x1f')],_0x3a8c1e;if(_0x30aa66>=_0x2663f2){_0x30aa66=_0x2663f2;_0x3a8c1e=0xc8;}else{_0x3a8c1e=0xce;}_0x13a0b8[_0x51b1('0x1b')](_0x3a8c1e);return _0x13a0b8['set'](_0x51b1('0x20'),_0xb53d77+'-'+_0x30aa66+'/'+_0x2663f2)[_0x51b1('0x21')](_0x4b4672);}return null;};}function patchUpdates(_0x295eea){return function(_0x2f6bb6){try{jsonpatch[_0x51b1('0x22')](_0x2f6bb6,_0x295eea,!![]);}catch(_0x4cd90e){return BPromise[_0x51b1('0x23')](_0x4cd90e);}return _0x2f6bb6[_0x51b1('0x24')]();};}function saveUpdates(_0x1a2e42,_0x343a1e){return function(_0x336d87){if(_0x336d87){return _0x336d87[_0x51b1('0x25')](_0x1a2e42)['then'](function(_0x35478d){return _0x35478d;});}return null;};}function removeEntity(_0x550adf,_0x206a11){return function(_0x41bf5d){if(_0x41bf5d){return _0x41bf5d[_0x51b1('0x26')]()[_0x51b1('0x27')](function(){_0x550adf[_0x51b1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x271c91,_0x32a652){return function(_0x32af88){if(!_0x32af88){_0x271c91[_0x51b1('0x1a')](0x194);}return _0x32af88;};}function handleError(_0x145d9e,_0x305af0){_0x305af0=_0x305af0||0x1f4;return function(_0x126630){logger[_0x51b1('0x28')](_0x126630[_0x51b1('0x29')]);if(_0x126630[_0x51b1('0x2a')]){delete _0x126630[_0x51b1('0x2a')];}_0x145d9e[_0x51b1('0x1b')](_0x305af0)['send'](_0x126630);};}exports['index']=function(_0x3c6a6c,_0xca2cd8){var _0x1fa975={},_0x465b5e={},_0x294372={'count':0x0,'rows':[]};var _0x296f65=_[_0x51b1('0x2b')](db[_0x51b1('0x2c')][_0x51b1('0x2d')],function(_0x4f1aa2){return{'name':_0x4f1aa2[_0x51b1('0x2e')],'type':_0x4f1aa2['type']['key']};});_0x465b5e[_0x51b1('0x2f')]=_['map'](_0x296f65,_0x51b1('0x2a'));_0x465b5e[_0x51b1('0x30')]=_['keys'](_0x3c6a6c['query']);_0x465b5e['filters']=_[_0x51b1('0x31')](_0x465b5e[_0x51b1('0x2f')],_0x465b5e[_0x51b1('0x30')]);_0x1fa975[_0x51b1('0x32')]=_[_0x51b1('0x31')](_0x465b5e[_0x51b1('0x2f')],qs['fields'](_0x3c6a6c[_0x51b1('0x30')][_0x51b1('0x33')]));_0x1fa975[_0x51b1('0x32')]=_0x1fa975['attributes'][_0x51b1('0x34')]?_0x1fa975['attributes']:_0x465b5e[_0x51b1('0x2f')];if(!_0x3c6a6c[_0x51b1('0x30')][_0x51b1('0x35')](_0x51b1('0x36'))){_0x1fa975[_0x51b1('0x1f')]=qs[_0x51b1('0x1f')](_0x3c6a6c['query'][_0x51b1('0x1f')]);_0x1fa975['offset']=qs['offset'](_0x3c6a6c[_0x51b1('0x30')][_0x51b1('0x1e')]);}_0x1fa975[_0x51b1('0x37')]=qs[_0x51b1('0x38')](_0x3c6a6c[_0x51b1('0x30')]['sort']);_0x1fa975[_0x51b1('0x39')]=qs[_0x51b1('0x3a')](_[_0x51b1('0x3b')](_0x3c6a6c[_0x51b1('0x30')],_0x465b5e[_0x51b1('0x3a')]));if(_0x3c6a6c[_0x51b1('0x30')]['filter']){_0x1fa975[_0x51b1('0x39')]=_[_0x51b1('0x3c')](_0x1fa975[_0x51b1('0x39')],{'$or':_[_0x51b1('0x2b')](_0x296f65,function(_0x6e4174){if(_0x6e4174[_0x51b1('0x3d')]!=='VIRTUAL'){var _0x418a9b={};_0x418a9b[_0x6e4174[_0x51b1('0x2a')]]={'$like':'%'+_0x3c6a6c[_0x51b1('0x30')][_0x51b1('0x3e')]+'%'};return _0x418a9b;}})});}_0x1fa975=_[_0x51b1('0x3c')]({},_0x1fa975,_0x3c6a6c['options']);var _0x441b61={'where':_0x1fa975[_0x51b1('0x39')]};return db[_0x51b1('0x2c')][_0x51b1('0x1d')](_0x441b61)['then'](function(_0x3ea84a){_0x294372['count']=_0x3ea84a;if(_0x3c6a6c[_0x51b1('0x30')]['includeAll']){_0x1fa975['include']=[{'all':!![]}];}return db[_0x51b1('0x2c')][_0x51b1('0x3f')](_0x1fa975);})[_0x51b1('0x27')](function(_0x1a690c){_0x294372[_0x51b1('0x40')]=_0x1a690c;return _0x294372;})[_0x51b1('0x27')](respondWithFilteredResult(_0xca2cd8,_0x1fa975))[_0x51b1('0x41')](handleError(_0xca2cd8,null));};exports[_0x51b1('0x42')]=function(_0x535be8,_0x2777a4){var _0x574596={'raw':![],'where':{'id':_0x535be8['params']['id']}},_0x5a85c1={};_0x5a85c1['model']=_[_0x51b1('0x43')](db['Integration']['rawAttributes']);_0x5a85c1[_0x51b1('0x30')]=_[_0x51b1('0x43')](_0x535be8[_0x51b1('0x30')]);_0x5a85c1[_0x51b1('0x3a')]=_[_0x51b1('0x31')](_0x5a85c1[_0x51b1('0x2f')],_0x5a85c1['query']);_0x574596[_0x51b1('0x32')]=_[_0x51b1('0x31')](_0x5a85c1[_0x51b1('0x2f')],qs['fields'](_0x535be8[_0x51b1('0x30')][_0x51b1('0x33')]));_0x574596[_0x51b1('0x32')]=_0x574596[_0x51b1('0x32')][_0x51b1('0x34')]?_0x574596[_0x51b1('0x32')]:_0x5a85c1[_0x51b1('0x2f')];if(_0x535be8[_0x51b1('0x30')][_0x51b1('0x44')]){_0x574596[_0x51b1('0x45')]=[{'all':!![]}];}_0x574596=_[_0x51b1('0x3c')]({},_0x574596,_0x535be8['options']);return db['Integration']['find'](_0x574596)[_0x51b1('0x27')](handleEntityNotFound(_0x2777a4,null))[_0x51b1('0x27')](respondWithResult(_0x2777a4,null))[_0x51b1('0x41')](handleError(_0x2777a4,null));};exports[_0x51b1('0x46')]=function(_0x1250f7,_0x1a807f){return db[_0x51b1('0x2c')][_0x51b1('0x46')](_0x1250f7['body'],{})[_0x51b1('0x27')](respondWithResult(_0x1a807f,0xc9))[_0x51b1('0x41')](handleError(_0x1a807f,null));};exports[_0x51b1('0x25')]=function(_0x8d5e18,_0x45d445){if(_0x8d5e18[_0x51b1('0x47')]['id']){delete _0x8d5e18[_0x51b1('0x47')]['id'];}return db[_0x51b1('0x2c')][_0x51b1('0x48')]({'where':{'id':_0x8d5e18[_0x51b1('0x49')]['id']}})[_0x51b1('0x27')](handleEntityNotFound(_0x45d445,null))[_0x51b1('0x27')](saveUpdates(_0x8d5e18[_0x51b1('0x47')],null))['then'](respondWithResult(_0x45d445,null))[_0x51b1('0x41')](handleError(_0x45d445,null));};exports[_0x51b1('0x26')]=function(_0x3b5497,_0x41df38){return db['Integration'][_0x51b1('0x48')]({'where':{'id':_0x3b5497[_0x51b1('0x49')]['id']}})[_0x51b1('0x27')](handleEntityNotFound(_0x41df38,null))['then'](removeEntity(_0x41df38,null))[_0x51b1('0x41')](handleError(_0x41df38,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index b0ce3af..8a567de 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 _0xbec2=['request-promise','path','rimraf','../../config/environment','./integration.attributes','exports','define','Integration','integrations','lodash','util','../../config/logger','api'];(function(_0x3f1735,_0x979bbf){var _0x14b301=function(_0x34b26e){while(--_0x34b26e){_0x3f1735['push'](_0x3f1735['shift']());}};_0x14b301(++_0x979bbf);}(_0xbec2,0x18f));var _0x2bec=function(_0x281519,_0x309879){_0x281519=_0x281519-0x0;var _0x1a9160=_0xbec2[_0x281519];return _0x1a9160;};'use strict';var _=require(_0x2bec('0x0'));var util=require(_0x2bec('0x1'));var logger=require(_0x2bec('0x2'))(_0x2bec('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x2bec('0x4'));var fs=require('fs');var path=require(_0x2bec('0x5'));var rimraf=require(_0x2bec('0x6'));var config=require(_0x2bec('0x7'));var attributes=require(_0x2bec('0x8'));module[_0x2bec('0x9')]=function(_0x1f3aa0,_0x489ed5){return _0x1f3aa0[_0x2bec('0xa')](_0x2bec('0xb'),attributes,{'tableName':_0x2bec('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe5db=['request-promise','path','rimraf','./integration.attributes','exports','Integration','integrations','lodash','util','../../config/logger','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe5db,0x1e7));var _0xbe5d=function(_0x56d816,_0x424a26){_0x56d816=_0x56d816-0x0;var _0x23df96=_0xe5db[_0x56d816];return _0x23df96;};'use strict';var _=require(_0xbe5d('0x0'));var util=require(_0xbe5d('0x1'));var logger=require(_0xbe5d('0x2'))('api');var moment=require(_0xbe5d('0x3'));var BPromise=require(_0xbe5d('0x4'));var rp=require(_0xbe5d('0x5'));var fs=require('fs');var path=require(_0xbe5d('0x6'));var rimraf=require(_0xbe5d('0x7'));var config=require('../../config/environment');var attributes=require(_0xbe5d('0x8'));module[_0xbe5d('0x9')]=function(_0x47a1f9,_0x3d6f0a){return _0x47a1f9['define'](_0xbe5d('0xa'),attributes,{'tableName':_0xbe5d('0xb'),'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 895b024..73a2532 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 _0x864a=['error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','debug','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0xb4bdb3,_0x48dca0){var _0x4c8c02=function(_0xf9850c){while(--_0xf9850c){_0xb4bdb3['push'](_0xb4bdb3['shift']());}};_0x4c8c02(++_0x48dca0);}(_0x864a,0x8a));var _0xa864=function(_0xcf9bc5,_0x29bdce){_0xcf9bc5=_0xcf9bc5-0x0;var _0x2ba7a5=_0x864a[_0xcf9bc5];return _0x2ba7a5;};'use strict';var _=require(_0xa864('0x0'));var util=require(_0xa864('0x1'));var moment=require(_0xa864('0x2'));var BPromise=require(_0xa864('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa864('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xa864('0x5'));var jayson=require(_0xa864('0x6'));var client=jayson[_0xa864('0x7')][_0xa864('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x351d6b,_0x58ad17,_0x393d69){return new BPromise(function(_0x26c6d9,_0x4d32a7){return client[_0xa864('0x9')](_0x351d6b,_0x393d69)[_0xa864('0xa')](function(_0x419955){logger[_0xa864('0xb')]('Integration,\x20%s,\x20%s',_0x58ad17,'request\x20sent');logger[_0xa864('0xc')](_0xa864('0xd'),_0x58ad17,_0xa864('0xe'),JSON[_0xa864('0xf')](_0x419955));if(_0x419955[_0xa864('0x10')]){if(_0x419955[_0xa864('0x10')][_0xa864('0x11')]===0x1f4){logger[_0xa864('0x10')](_0xa864('0x12'),_0x58ad17,_0x419955[_0xa864('0x10')]['message']);return _0x4d32a7(_0x419955[_0xa864('0x10')][_0xa864('0x13')]);}logger['error'](_0xa864('0x12'),_0x58ad17,_0x419955[_0xa864('0x10')][_0xa864('0x13')]);return _0x26c6d9(_0x419955[_0xa864('0x10')][_0xa864('0x13')]);}else{logger[_0xa864('0xb')]('Integration,\x20%s,\x20%s',_0x58ad17,_0xa864('0xe'));_0x26c6d9(_0x419955[_0xa864('0x14')][_0xa864('0x13')]);}})[_0xa864('0x15')](function(_0x24a897){logger[_0xa864('0x10')](_0xa864('0x12'),_0x58ad17,_0x24a897);_0x4d32a7(_0x24a897);});});} \ No newline at end of file +var _0x8f2d=['../../config/environment','jayson/promise','client','request','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','code','Integration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc'];(function(_0x4535f0,_0x30cea5){var _0x41c597=function(_0x5d0b21){while(--_0x5d0b21){_0x4535f0['push'](_0x4535f0['shift']());}};_0x41c597(++_0x30cea5);}(_0x8f2d,0xd5));var _0xd8f2=function(_0x3888c0,_0x29c499){_0x3888c0=_0x3888c0-0x0;var _0x2c2785=_0x8f2d[_0x3888c0];return _0x2c2785;};'use strict';var _=require(_0xd8f2('0x0'));var util=require(_0xd8f2('0x1'));var moment=require('moment');var BPromise=require(_0xd8f2('0x2'));var rs=require(_0xd8f2('0x3'));var fs=require('fs');var Redis=require(_0xd8f2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd8f2('0x5'))(_0xd8f2('0x6'));var config=require(_0xd8f2('0x7'));var jayson=require(_0xd8f2('0x8'));var client=jayson[_0xd8f2('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xe5e289,_0x16e0b3,_0x42a12c){return new BPromise(function(_0x16a942,_0x1aeae7){return client[_0xd8f2('0xa')](_0xe5e289,_0x42a12c)['then'](function(_0x1383b6){logger[_0xd8f2('0xb')]('Integration,\x20%s,\x20%s',_0x16e0b3,_0xd8f2('0xc'));logger[_0xd8f2('0xd')](_0xd8f2('0xe'),_0x16e0b3,_0xd8f2('0xc'),JSON[_0xd8f2('0xf')](_0x1383b6));if(_0x1383b6[_0xd8f2('0x10')]){if(_0x1383b6['error'][_0xd8f2('0x11')]===0x1f4){logger[_0xd8f2('0x10')](_0xd8f2('0x12'),_0x16e0b3,_0x1383b6[_0xd8f2('0x10')][_0xd8f2('0x13')]);return _0x1aeae7(_0x1383b6[_0xd8f2('0x10')]['message']);}logger[_0xd8f2('0x10')](_0xd8f2('0x12'),_0x16e0b3,_0x1383b6[_0xd8f2('0x10')][_0xd8f2('0x13')]);return _0x16a942(_0x1383b6[_0xd8f2('0x10')]['message']);}else{logger[_0xd8f2('0xb')](_0xd8f2('0x12'),_0x16e0b3,'request\x20sent');_0x16a942(_0x1383b6[_0xd8f2('0x14')][_0xd8f2('0x13')]);}})[_0xd8f2('0x15')](function(_0x25b4e2){logger[_0xd8f2('0x10')](_0xd8f2('0x12'),_0x16e0b3,_0x25b4e2);_0x1aeae7(_0x25b4e2);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 27258a6..1585c3a 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 _0xd76f=['/describe','describe','show','post','create','put','/:id','destroy','connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index'];(function(_0x399bfc,_0x36d4b0){var _0x36846d=function(_0x1465bc){while(--_0x1465bc){_0x399bfc['push'](_0x399bfc['shift']());}};_0x36846d(++_0x36d4b0);}(_0xd76f,0x198));var _0xfd76=function(_0x33fcbb,_0x291d0f){_0x33fcbb=_0x33fcbb-0x0;var _0x2efe40=_0xd76f[_0x33fcbb];return _0x2efe40;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xfd76('0x0'));var express=require(_0xfd76('0x1'));var router=express[_0xfd76('0x2')]();var auth=require(_0xfd76('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xfd76('0x4'));var controller=require('./integrationReport.controller');router[_0xfd76('0x5')]('/',auth[_0xfd76('0x6')](),controller[_0xfd76('0x7')]);router[_0xfd76('0x5')](_0xfd76('0x8'),auth[_0xfd76('0x6')](),controller[_0xfd76('0x9')]);router['get']('/:id',auth[_0xfd76('0x6')](),controller[_0xfd76('0xa')]);router[_0xfd76('0xb')]('/',auth[_0xfd76('0x6')](),controller[_0xfd76('0xc')]);router[_0xfd76('0xd')](_0xfd76('0xe'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xfd76('0xe'),auth[_0xfd76('0x6')](),controller[_0xfd76('0xf')]);module['exports']=router; \ No newline at end of file +var _0xdb84=['get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller'];(function(_0x273dc5,_0x268a81){var _0x46dae7=function(_0x263d62){while(--_0x263d62){_0x273dc5['push'](_0x273dc5['shift']());}};_0x46dae7(++_0x268a81);}(_0xdb84,0xa8));var _0x4db8=function(_0x5007ba,_0x54e45b){_0x5007ba=_0x5007ba-0x0;var _0x248e31=_0xdb84[_0x5007ba];return _0x248e31;};'use strict';var multer=require('multer');var util=require(_0x4db8('0x0'));var path=require(_0x4db8('0x1'));var timeout=require('connect-timeout');var express=require(_0x4db8('0x2'));var router=express[_0x4db8('0x3')]();var auth=require(_0x4db8('0x4'));var interaction=require(_0x4db8('0x5'));var config=require(_0x4db8('0x6'));var controller=require(_0x4db8('0x7'));router[_0x4db8('0x8')]('/',auth[_0x4db8('0x9')](),controller[_0x4db8('0xa')]);router[_0x4db8('0x8')](_0x4db8('0xb'),auth[_0x4db8('0x9')](),controller[_0x4db8('0xc')]);router[_0x4db8('0x8')](_0x4db8('0xd'),auth['isAuthenticated'](),controller[_0x4db8('0xe')]);router[_0x4db8('0xf')]('/',auth[_0x4db8('0x9')](),controller[_0x4db8('0x10')]);router[_0x4db8('0x11')](_0x4db8('0xd'),auth[_0x4db8('0x9')](),controller[_0x4db8('0x12')]);router[_0x4db8('0x13')]('/:id',auth[_0x4db8('0x9')](),controller[_0x4db8('0x14')]);module[_0x4db8('0x15')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 5f6fde9..2fcbff8 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 _0xd494=['FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','SENT','SENDING','RECEIVED'];(function(_0x5695da,_0x4399fc){var _0xdca67c=function(_0x143ae3){while(--_0x143ae3){_0x5695da['push'](_0x5695da['shift']());}};_0xdca67c(++_0x4399fc);}(_0xd494,0x1ae));var _0x4d49=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xd494[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4d49('0x0'));module[_0x4d49('0x1')]={'integration':{'type':Sequelize[_0x4d49('0x2')]},'eventChannel':{'type':Sequelize[_0x4d49('0x2')]},'exitStatus':{'type':Sequelize[_0x4d49('0x2')]},'ticketId':{'type':Sequelize[_0x4d49('0x2')]},'integrationId':{'type':Sequelize[_0x4d49('0x3')]},'contacts':{'type':Sequelize[_0x4d49('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x4d49('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x4d49('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x4d49('0x4')]},'holdtime':{'type':Sequelize[_0x4d49('0x3')]},'agentcomplete':{'type':Sequelize[_0x4d49('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x4d49('0x4')]},'talktime':{'type':Sequelize[_0x4d49('0x3')]},'agentacw':{'type':Sequelize[_0x4d49('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x4d49('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x4d49('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x4d49('0x4')]},'lastevent':{'type':Sequelize[_0x4d49('0x2')]},'channel':{'type':Sequelize[_0x4d49('0x2')]},'channelstate':{'type':Sequelize[_0x4d49('0x3')]},'channelstatedesc':{'type':Sequelize[_0x4d49('0x2')]},'connectedlinenum':{'type':Sequelize[_0x4d49('0x2')]},'connectedlinename':{'type':Sequelize[_0x4d49('0x2')]},'language':{'type':Sequelize[_0x4d49('0x2')]},'accountcode':{'type':Sequelize[_0x4d49('0x2')]},'context':{'type':Sequelize[_0x4d49('0x2')]},'exten':{'type':Sequelize[_0x4d49('0x2')]},'priority':{'type':Sequelize[_0x4d49('0x2')]},'destchannel':{'type':Sequelize[_0x4d49('0x2')]},'destchannelstate':{'type':Sequelize[_0x4d49('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0x4d49('0x2')]},'destcalleridnum':{'type':Sequelize[_0x4d49('0x2')]},'destcalleridname':{'type':Sequelize[_0x4d49('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x4d49('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x4d49('0x2')]},'destlanguage':{'type':Sequelize[_0x4d49('0x2')]},'destaccountcode':{'type':Sequelize[_0x4d49('0x2')]},'destcontext':{'type':Sequelize[_0x4d49('0x2')]},'destexten':{'type':Sequelize[_0x4d49('0x2')]},'destpriority':{'type':Sequelize[_0x4d49('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0x4d49('0x2')]},'inReplyTo':{'type':Sequelize[_0x4d49('0x2')]},'subject':{'type':Sequelize[_0x4d49('0x2')]},'from':{'type':Sequelize[_0x4d49('0x2')]},'to':{'type':Sequelize[_0x4d49('0x2')]},'cc':{'type':Sequelize[_0x4d49('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x4d49('0x6')]},'text':{'type':Sequelize[_0x4d49('0x6')]},'status':{'type':Sequelize['ENUM'](_0x4d49('0x7'),_0x4d49('0x8'),_0x4d49('0x9'),_0x4d49('0xa'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x4d49('0x2')]},'appdata':{'type':Sequelize[_0x4d49('0x2')]},'projectId':{'type':Sequelize[_0x4d49('0x3')]}}; \ No newline at end of file +var _0x7d5c=['STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','exports'];(function(_0x10bba8,_0x1b5f3e){var _0x2d4615=function(_0x3a1607){while(--_0x3a1607){_0x10bba8['push'](_0x10bba8['shift']());}};_0x2d4615(++_0x1b5f3e);}(_0x7d5c,0x121));var _0xc7d5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xc7d5('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize['STRING']},'ticketId':{'type':Sequelize[_0xc7d5('0x1')]},'integrationId':{'type':Sequelize[_0xc7d5('0x2')]},'contacts':{'type':Sequelize[_0xc7d5('0x1')]},'uniqueid':{'type':Sequelize[_0xc7d5('0x1')]},'calleridnum':{'type':Sequelize[_0xc7d5('0x1')]},'calleridname':{'type':Sequelize[_0xc7d5('0x1')]},'queue':{'type':Sequelize[_0xc7d5('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc7d5('0x1')]},'agentcalledAt':{'type':Sequelize[_0xc7d5('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc7d5('0x3')]},'holdtime':{'type':Sequelize[_0xc7d5('0x2')]},'agentcomplete':{'type':Sequelize[_0xc7d5('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xc7d5('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xc7d5('0x2')]},'reason':{'type':Sequelize[_0xc7d5('0x1')]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xc7d5('0x3')]},'agentdump':{'type':Sequelize[_0xc7d5('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc7d5('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc7d5('0x2')]},'channelstatedesc':{'type':Sequelize[_0xc7d5('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc7d5('0x1')]},'connectedlinename':{'type':Sequelize[_0xc7d5('0x1')]},'language':{'type':Sequelize[_0xc7d5('0x1')]},'accountcode':{'type':Sequelize[_0xc7d5('0x1')]},'context':{'type':Sequelize[_0xc7d5('0x1')]},'exten':{'type':Sequelize[_0xc7d5('0x1')]},'priority':{'type':Sequelize[_0xc7d5('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0xc7d5('0x1')]},'destcalleridnum':{'type':Sequelize[_0xc7d5('0x1')]},'destcalleridname':{'type':Sequelize[_0xc7d5('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xc7d5('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xc7d5('0x1')]},'destlanguage':{'type':Sequelize[_0xc7d5('0x1')]},'destaccountcode':{'type':Sequelize[_0xc7d5('0x1')]},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0xc7d5('0x1')]},'destpriority':{'type':Sequelize[_0xc7d5('0x1')]},'destuniqueid':{'type':Sequelize[_0xc7d5('0x1')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xc7d5('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xc7d5('0x1')]},'attachment':{'type':Sequelize[_0xc7d5('0x5')]},'html':{'type':Sequelize[_0xc7d5('0x5')]},'text':{'type':Sequelize[_0xc7d5('0x5')]},'status':{'type':Sequelize[_0xc7d5('0x6')](_0xc7d5('0x7'),_0xc7d5('0x8'),_0xc7d5('0x9'),'FAILED')},'url':{'type':Sequelize[_0xc7d5('0x1')]},'app':{'type':Sequelize[_0xc7d5('0x1')]},'appdata':{'type':Sequelize[_0xc7d5('0x1')]},'projectId':{'type':Sequelize[_0xc7d5('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 0fb28d4..c7aeedd 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 _0x0447=['mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','sendStatus','status','count','offset','limit','set','json','save','update','destroy','then','end','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','include','findAll','rows','catch','show','includeAll','create','body','params','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird'];(function(_0x554574,_0x30e7b0){var _0x100382=function(_0x146a59){while(--_0x146a59){_0x554574['push'](_0x554574['shift']());}};_0x100382(++_0x30e7b0);}(_0x0447,0x8b));var _0x7044=function(_0x5af9b3,_0x516c90){_0x5af9b3=_0x5af9b3-0x0;var _0x129f28=_0x0447[_0x5af9b3];return _0x129f28;};'use strict';var pdf=require(_0x7044('0x0'));var emlformat=require(_0x7044('0x1'));var rimraf=require(_0x7044('0x2'));var zipdir=require(_0x7044('0x3'));var jsonpatch=require(_0x7044('0x4'));var rp=require('request-promise');var moment=require(_0x7044('0x5'));var BPromise=require(_0x7044('0x6'));var Mustache=require(_0x7044('0x7'));var util=require(_0x7044('0x8'));var path=require(_0x7044('0x9'));var sox=require(_0x7044('0xa'));var csv=require(_0x7044('0xb'));var ejs=require(_0x7044('0xc'));var fs=require('fs');var _=require(_0x7044('0xd'));var squel=require('squel');var crypto=require(_0x7044('0xe'));var jsforce=require(_0x7044('0xf'));var deskjs=require(_0x7044('0x10'));var toCsv=require(_0x7044('0xb'));var querystring=require('querystring');var Papa=require(_0x7044('0x11'));var Redis=require(_0x7044('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x7044('0x13'));var as=require(_0x7044('0x14'));var hardwareService=require(_0x7044('0x15'));var logger=require(_0x7044('0x16'))('api');var utils=require(_0x7044('0x17'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x53f150,_0xe26cea){_0xe26cea=_0xe26cea||0xcc;return function(_0x41b118){if(_0x41b118){return _0x53f150[_0x7044('0x18')](_0xe26cea);}return _0x53f150[_0x7044('0x19')](_0xe26cea)['end']();};}function respondWithResult(_0x5805f2,_0xd5ae12){_0xd5ae12=_0xd5ae12||0xc8;return function(_0x3316c4){if(_0x3316c4){return _0x5805f2['status'](_0xd5ae12)['json'](_0x3316c4);}};}function respondWithFilteredResult(_0x798fe3,_0x310535){return function(_0x79f418){if(_0x79f418){var _0x35769e=_0x79f418[_0x7044('0x1a')],_0x2fecb1=_0x310535[_0x7044('0x1b')],_0x5cbec7=_0x310535[_0x7044('0x1b')]+_0x310535[_0x7044('0x1c')],_0x5c85fc;if(_0x5cbec7>=_0x35769e){_0x5cbec7=_0x35769e;_0x5c85fc=0xc8;}else{_0x5c85fc=0xce;}_0x798fe3[_0x7044('0x19')](_0x5c85fc);return _0x798fe3[_0x7044('0x1d')]('Content-Range',_0x2fecb1+'-'+_0x5cbec7+'/'+_0x35769e)[_0x7044('0x1e')](_0x79f418);}return null;};}function patchUpdates(_0x227bcd){return function(_0x1eeb45){try{jsonpatch['apply'](_0x1eeb45,_0x227bcd,!![]);}catch(_0x4bbdb3){return BPromise['reject'](_0x4bbdb3);}return _0x1eeb45[_0x7044('0x1f')]();};}function saveUpdates(_0x3292f8,_0x2c5dcb){return function(_0x4104a9){if(_0x4104a9){return _0x4104a9[_0x7044('0x20')](_0x3292f8)['then'](function(_0x308603){return _0x308603;});}return null;};}function removeEntity(_0x51a83f,_0x4af476){return function(_0x3db88b){if(_0x3db88b){return _0x3db88b[_0x7044('0x21')]()[_0x7044('0x22')](function(){_0x51a83f[_0x7044('0x19')](0xcc)[_0x7044('0x23')]();});}};}function handleEntityNotFound(_0x105da8,_0x41a079){return function(_0x9452a1){if(!_0x9452a1){_0x105da8[_0x7044('0x18')](0x194);}return _0x9452a1;};}function handleError(_0x5e2c9a,_0x5d7d8a){_0x5d7d8a=_0x5d7d8a||0x1f4;return function(_0x45f274){logger[_0x7044('0x24')](_0x45f274[_0x7044('0x25')]);if(_0x45f274[_0x7044('0x26')]){delete _0x45f274[_0x7044('0x26')];}_0x5e2c9a[_0x7044('0x19')](_0x5d7d8a)[_0x7044('0x27')](_0x45f274);};}exports[_0x7044('0x28')]=function(_0x124671,_0x2826bf){var _0x1eb4b0={},_0x115d5c={},_0x4c618d={'count':0x0,'rows':[]};var _0x377cd1=_[_0x7044('0x29')](db[_0x7044('0x2a')][_0x7044('0x2b')],function(_0x4b7de2){return{'name':_0x4b7de2[_0x7044('0x2c')],'type':_0x4b7de2['type']['key']};});_0x115d5c['model']=_[_0x7044('0x29')](_0x377cd1,'name');_0x115d5c[_0x7044('0x2d')]=_[_0x7044('0x2e')](_0x124671['query']);_0x115d5c['filters']=_[_0x7044('0x2f')](_0x115d5c['model'],_0x115d5c['query']);_0x1eb4b0['attributes']=_[_0x7044('0x2f')](_0x115d5c[_0x7044('0x30')],qs['fields'](_0x124671[_0x7044('0x2d')][_0x7044('0x31')]));_0x1eb4b0[_0x7044('0x32')]=_0x1eb4b0[_0x7044('0x32')][_0x7044('0x33')]?_0x1eb4b0['attributes']:_0x115d5c[_0x7044('0x30')];if(!_0x124671[_0x7044('0x2d')][_0x7044('0x34')](_0x7044('0x35'))){_0x1eb4b0[_0x7044('0x1c')]=qs['limit'](_0x124671[_0x7044('0x2d')][_0x7044('0x1c')]);_0x1eb4b0['offset']=qs[_0x7044('0x1b')](_0x124671[_0x7044('0x2d')][_0x7044('0x1b')]);}_0x1eb4b0[_0x7044('0x36')]=qs[_0x7044('0x37')](_0x124671[_0x7044('0x2d')]['sort']);_0x1eb4b0['where']=qs[_0x7044('0x38')](_[_0x7044('0x39')](_0x124671['query'],_0x115d5c[_0x7044('0x38')]));if(_0x124671[_0x7044('0x2d')][_0x7044('0x3a')]){_0x1eb4b0[_0x7044('0x3b')]=_[_0x7044('0x3c')](_0x1eb4b0[_0x7044('0x3b')],{'$or':_[_0x7044('0x29')](_0x377cd1,function(_0x2433fe){if(_0x2433fe['type']!=='VIRTUAL'){var _0x3a809b={};_0x3a809b[_0x2433fe[_0x7044('0x26')]]={'$like':'%'+_0x124671[_0x7044('0x2d')][_0x7044('0x3a')]+'%'};return _0x3a809b;}})});}_0x1eb4b0=_[_0x7044('0x3c')]({},_0x1eb4b0,_0x124671[_0x7044('0x3d')]);var _0x478756={'where':_0x1eb4b0['where']};return db[_0x7044('0x2a')][_0x7044('0x1a')](_0x478756)[_0x7044('0x22')](function(_0x524062){_0x4c618d[_0x7044('0x1a')]=_0x524062;if(_0x124671['query']['includeAll']){_0x1eb4b0[_0x7044('0x3e')]=[{'all':!![]}];}return db['IntegrationReport'][_0x7044('0x3f')](_0x1eb4b0);})[_0x7044('0x22')](function(_0x168740){_0x4c618d[_0x7044('0x40')]=_0x168740;return _0x4c618d;})[_0x7044('0x22')](respondWithFilteredResult(_0x2826bf,_0x1eb4b0))[_0x7044('0x41')](handleError(_0x2826bf,null));};exports[_0x7044('0x42')]=function(_0xc3e9f0,_0xdf8391){var _0x1b4f01={'raw':![],'where':{'id':_0xc3e9f0['params']['id']}},_0x485a0e={};_0x485a0e['model']=_[_0x7044('0x2e')](db[_0x7044('0x2a')][_0x7044('0x2b')]);_0x485a0e[_0x7044('0x2d')]=_['keys'](_0xc3e9f0['query']);_0x485a0e['filters']=_[_0x7044('0x2f')](_0x485a0e[_0x7044('0x30')],_0x485a0e[_0x7044('0x2d')]);_0x1b4f01[_0x7044('0x32')]=_[_0x7044('0x2f')](_0x485a0e[_0x7044('0x30')],qs[_0x7044('0x31')](_0xc3e9f0[_0x7044('0x2d')][_0x7044('0x31')]));_0x1b4f01['attributes']=_0x1b4f01['attributes']['length']?_0x1b4f01[_0x7044('0x32')]:_0x485a0e[_0x7044('0x30')];if(_0xc3e9f0[_0x7044('0x2d')][_0x7044('0x43')]){_0x1b4f01[_0x7044('0x3e')]=[{'all':!![]}];}_0x1b4f01=_[_0x7044('0x3c')]({},_0x1b4f01,_0xc3e9f0[_0x7044('0x3d')]);return db['IntegrationReport']['find'](_0x1b4f01)[_0x7044('0x22')](handleEntityNotFound(_0xdf8391,null))[_0x7044('0x22')](respondWithResult(_0xdf8391,null))[_0x7044('0x41')](handleError(_0xdf8391,null));};exports[_0x7044('0x44')]=function(_0x1e8102,_0x436e45){return db['IntegrationReport']['create'](_0x1e8102['body'],{})[_0x7044('0x22')](respondWithResult(_0x436e45,0xc9))[_0x7044('0x41')](handleError(_0x436e45,null));};exports[_0x7044('0x20')]=function(_0x353120,_0x5757aa){if(_0x353120[_0x7044('0x45')]['id']){delete _0x353120[_0x7044('0x45')]['id'];}return db[_0x7044('0x2a')]['find']({'where':{'id':_0x353120[_0x7044('0x46')]['id']}})[_0x7044('0x22')](handleEntityNotFound(_0x5757aa,null))[_0x7044('0x22')](saveUpdates(_0x353120['body'],null))[_0x7044('0x22')](respondWithResult(_0x5757aa,null))[_0x7044('0x41')](handleError(_0x5757aa,null));};exports[_0x7044('0x21')]=function(_0xdee0ae,_0x56036f){return db[_0x7044('0x2a')][_0x7044('0x47')]({'where':{'id':_0xdee0ae['params']['id']}})[_0x7044('0x22')](handleEntityNotFound(_0x56036f,null))[_0x7044('0x22')](removeEntity(_0x56036f,null))[_0x7044('0x41')](handleError(_0x56036f,null));};exports[_0x7044('0x48')]=function(_0x16e649,_0x57378f){return db[_0x7044('0x2a')][_0x7044('0x48')]()['then'](respondWithResult(_0x57378f,null))['catch'](handleError(_0x57378f,null));}; \ No newline at end of file +var _0x781d=['set','Content-Range','apply','save','update','then','error','name','send','map','type','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','filter','options','IntegrationReport','include','rows','show','rawAttributes','includeAll','find','create','body','params','catch','destroy','describe','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset'];(function(_0x11e400,_0x18c8e9){var _0x740902=function(_0x393c4a){while(--_0x393c4a){_0x11e400['push'](_0x11e400['shift']());}};_0x740902(++_0x18c8e9);}(_0x781d,0x14a));var _0xd781=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x781d[_0x618414];return _0x21c19a;};'use strict';var pdf=require(_0xd781('0x0'));var emlformat=require(_0xd781('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xd781('0x2'));var rp=require(_0xd781('0x3'));var moment=require(_0xd781('0x4'));var BPromise=require(_0xd781('0x5'));var Mustache=require(_0xd781('0x6'));var util=require(_0xd781('0x7'));var path=require(_0xd781('0x8'));var sox=require(_0xd781('0x9'));var csv=require(_0xd781('0xa'));var ejs=require(_0xd781('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd781('0xc'));var crypto=require(_0xd781('0xd'));var jsforce=require(_0xd781('0xe'));var deskjs=require(_0xd781('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd781('0x10'));var Papa=require('papaparse');var Redis=require(_0xd781('0x11'));var authService=require(_0xd781('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd781('0x13'));var hardwareService=require(_0xd781('0x14'));var logger=require('../../config/logger')('api');var utils=require(_0xd781('0x15'));var config=require(_0xd781('0x16'));var db=require(_0xd781('0x17'))['db'];function respondWithStatusCode(_0x17a929,_0xbea78b){_0xbea78b=_0xbea78b||0xcc;return function(_0x1f2f1e){if(_0x1f2f1e){return _0x17a929[_0xd781('0x18')](_0xbea78b);}return _0x17a929[_0xd781('0x19')](_0xbea78b)[_0xd781('0x1a')]();};}function respondWithResult(_0x12b1b2,_0xd454e7){_0xd454e7=_0xd454e7||0xc8;return function(_0x587953){if(_0x587953){return _0x12b1b2[_0xd781('0x19')](_0xd454e7)[_0xd781('0x1b')](_0x587953);}};}function respondWithFilteredResult(_0x498674,_0x3a1f48){return function(_0x48bffc){if(_0x48bffc){var _0x294e5a=_0x48bffc[_0xd781('0x1c')],_0x22d787=_0x3a1f48[_0xd781('0x1d')],_0x9f25f7=_0x3a1f48[_0xd781('0x1d')]+_0x3a1f48['limit'],_0x1409dd;if(_0x9f25f7>=_0x294e5a){_0x9f25f7=_0x294e5a;_0x1409dd=0xc8;}else{_0x1409dd=0xce;}_0x498674[_0xd781('0x19')](_0x1409dd);return _0x498674[_0xd781('0x1e')](_0xd781('0x1f'),_0x22d787+'-'+_0x9f25f7+'/'+_0x294e5a)[_0xd781('0x1b')](_0x48bffc);}return null;};}function patchUpdates(_0x3bf805){return function(_0x35e1bb){try{jsonpatch[_0xd781('0x20')](_0x35e1bb,_0x3bf805,!![]);}catch(_0x1d6fc7){return BPromise['reject'](_0x1d6fc7);}return _0x35e1bb[_0xd781('0x21')]();};}function saveUpdates(_0x3e8a37,_0x1036d3){return function(_0x103758){if(_0x103758){return _0x103758[_0xd781('0x22')](_0x3e8a37)[_0xd781('0x23')](function(_0x1adcbd){return _0x1adcbd;});}return null;};}function removeEntity(_0x5dd1f0,_0xe0c65f){return function(_0x4e2c56){if(_0x4e2c56){return _0x4e2c56['destroy']()[_0xd781('0x23')](function(){_0x5dd1f0['status'](0xcc)[_0xd781('0x1a')]();});}};}function handleEntityNotFound(_0x101480,_0x395087){return function(_0x31bf57){if(!_0x31bf57){_0x101480[_0xd781('0x18')](0x194);}return _0x31bf57;};}function handleError(_0x28f4fe,_0x221f14){_0x221f14=_0x221f14||0x1f4;return function(_0x316d43){logger[_0xd781('0x24')](_0x316d43['stack']);if(_0x316d43['name']){delete _0x316d43[_0xd781('0x25')];}_0x28f4fe[_0xd781('0x19')](_0x221f14)[_0xd781('0x26')](_0x316d43);};}exports['index']=function(_0xa1349e,_0x5a431b){var _0x47c609={},_0x1e29c8={},_0x54fe00={'count':0x0,'rows':[]};var _0x3e868=_[_0xd781('0x27')](db['IntegrationReport']['rawAttributes'],function(_0x43cc74){return{'name':_0x43cc74['fieldName'],'type':_0x43cc74[_0xd781('0x28')]['key']};});_0x1e29c8[_0xd781('0x29')]=_[_0xd781('0x27')](_0x3e868,'name');_0x1e29c8['query']=_[_0xd781('0x2a')](_0xa1349e[_0xd781('0x2b')]);_0x1e29c8[_0xd781('0x2c')]=_['intersection'](_0x1e29c8['model'],_0x1e29c8[_0xd781('0x2b')]);_0x47c609[_0xd781('0x2d')]=_[_0xd781('0x2e')](_0x1e29c8['model'],qs['fields'](_0xa1349e[_0xd781('0x2b')][_0xd781('0x2f')]));_0x47c609['attributes']=_0x47c609[_0xd781('0x2d')][_0xd781('0x30')]?_0x47c609['attributes']:_0x1e29c8[_0xd781('0x29')];if(!_0xa1349e[_0xd781('0x2b')][_0xd781('0x31')](_0xd781('0x32'))){_0x47c609['limit']=qs[_0xd781('0x33')](_0xa1349e[_0xd781('0x2b')][_0xd781('0x33')]);_0x47c609[_0xd781('0x1d')]=qs['offset'](_0xa1349e[_0xd781('0x2b')][_0xd781('0x1d')]);}_0x47c609['order']=qs[_0xd781('0x34')](_0xa1349e['query'][_0xd781('0x34')]);_0x47c609[_0xd781('0x35')]=qs['filters'](_[_0xd781('0x36')](_0xa1349e[_0xd781('0x2b')],_0x1e29c8['filters']));if(_0xa1349e[_0xd781('0x2b')]['filter']){_0x47c609[_0xd781('0x35')]=_[_0xd781('0x37')](_0x47c609['where'],{'$or':_[_0xd781('0x27')](_0x3e868,function(_0x1854c3){if(_0x1854c3['type']!==_0xd781('0x38')){var _0x34528f={};_0x34528f[_0x1854c3[_0xd781('0x25')]]={'$like':'%'+_0xa1349e['query'][_0xd781('0x39')]+'%'};return _0x34528f;}})});}_0x47c609=_[_0xd781('0x37')]({},_0x47c609,_0xa1349e[_0xd781('0x3a')]);var _0x6c67f3={'where':_0x47c609[_0xd781('0x35')]};return db[_0xd781('0x3b')][_0xd781('0x1c')](_0x6c67f3)[_0xd781('0x23')](function(_0x17a978){_0x54fe00['count']=_0x17a978;if(_0xa1349e[_0xd781('0x2b')]['includeAll']){_0x47c609[_0xd781('0x3c')]=[{'all':!![]}];}return db[_0xd781('0x3b')]['findAll'](_0x47c609);})[_0xd781('0x23')](function(_0x3d49f4){_0x54fe00[_0xd781('0x3d')]=_0x3d49f4;return _0x54fe00;})[_0xd781('0x23')](respondWithFilteredResult(_0x5a431b,_0x47c609))['catch'](handleError(_0x5a431b,null));};exports[_0xd781('0x3e')]=function(_0x515357,_0xb14b50){var _0xcdaacf={'raw':![],'where':{'id':_0x515357['params']['id']}},_0x5e3f9a={};_0x5e3f9a[_0xd781('0x29')]=_[_0xd781('0x2a')](db[_0xd781('0x3b')][_0xd781('0x3f')]);_0x5e3f9a['query']=_[_0xd781('0x2a')](_0x515357[_0xd781('0x2b')]);_0x5e3f9a['filters']=_['intersection'](_0x5e3f9a[_0xd781('0x29')],_0x5e3f9a[_0xd781('0x2b')]);_0xcdaacf[_0xd781('0x2d')]=_['intersection'](_0x5e3f9a['model'],qs[_0xd781('0x2f')](_0x515357[_0xd781('0x2b')][_0xd781('0x2f')]));_0xcdaacf[_0xd781('0x2d')]=_0xcdaacf[_0xd781('0x2d')][_0xd781('0x30')]?_0xcdaacf['attributes']:_0x5e3f9a['model'];if(_0x515357[_0xd781('0x2b')][_0xd781('0x40')]){_0xcdaacf[_0xd781('0x3c')]=[{'all':!![]}];}_0xcdaacf=_[_0xd781('0x37')]({},_0xcdaacf,_0x515357[_0xd781('0x3a')]);return db['IntegrationReport'][_0xd781('0x41')](_0xcdaacf)[_0xd781('0x23')](handleEntityNotFound(_0xb14b50,null))[_0xd781('0x23')](respondWithResult(_0xb14b50,null))['catch'](handleError(_0xb14b50,null));};exports[_0xd781('0x42')]=function(_0x14642a,_0x2f1f7a){return db['IntegrationReport'][_0xd781('0x42')](_0x14642a[_0xd781('0x43')],{})['then'](respondWithResult(_0x2f1f7a,0xc9))['catch'](handleError(_0x2f1f7a,null));};exports[_0xd781('0x22')]=function(_0x16d16e,_0x1efb2a){if(_0x16d16e['body']['id']){delete _0x16d16e[_0xd781('0x43')]['id'];}return db[_0xd781('0x3b')][_0xd781('0x41')]({'where':{'id':_0x16d16e[_0xd781('0x44')]['id']}})[_0xd781('0x23')](handleEntityNotFound(_0x1efb2a,null))[_0xd781('0x23')](saveUpdates(_0x16d16e[_0xd781('0x43')],null))['then'](respondWithResult(_0x1efb2a,null))[_0xd781('0x45')](handleError(_0x1efb2a,null));};exports[_0xd781('0x46')]=function(_0x1d54bd,_0x4c7cb6){return db[_0xd781('0x3b')][_0xd781('0x41')]({'where':{'id':_0x1d54bd['params']['id']}})[_0xd781('0x23')](handleEntityNotFound(_0x4c7cb6,null))[_0xd781('0x23')](removeEntity(_0x4c7cb6,null))[_0xd781('0x45')](handleError(_0x4c7cb6,null));};exports[_0xd781('0x47')]=function(_0x42a2f9,_0x599915){return db[_0xd781('0x3b')]['describe']()[_0xd781('0x23')](respondWithResult(_0x599915,null))['catch'](handleError(_0x599915,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index a57b999..2e7c10e 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 _0x7a96=['define','report_integration','lodash','util','request-promise','path','rimraf','../../config/environment','./integrationReport.attributes'];(function(_0x3ef4f1,_0x5f0f9b){var _0x69953c=function(_0xb4e621){while(--_0xb4e621){_0x3ef4f1['push'](_0x3ef4f1['shift']());}};_0x69953c(++_0x5f0f9b);}(_0x7a96,0x12b));var _0x67a9=function(_0x56b886,_0x1ff474){_0x56b886=_0x56b886-0x0;var _0x164baf=_0x7a96[_0x56b886];return _0x164baf;};'use strict';var _=require(_0x67a9('0x0'));var util=require(_0x67a9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x67a9('0x2'));var fs=require('fs');var path=require(_0x67a9('0x3'));var rimraf=require(_0x67a9('0x4'));var config=require(_0x67a9('0x5'));var attributes=require(_0x67a9('0x6'));module['exports']=function(_0x3b73b7,_0xc63af){return _0x3b73b7[_0x67a9('0x7')]('IntegrationReport',attributes,{'tableName':_0x67a9('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde76=['bluebird','request-promise','rimraf','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport','../../config/logger','moment'];(function(_0x984e97,_0x2c72e7){var _0x3630e5=function(_0x3ef0c9){while(--_0x3ef0c9){_0x984e97['push'](_0x984e97['shift']());}};_0x3630e5(++_0x2c72e7);}(_0xde76,0x1e8));var _0x6de7=function(_0x479400,_0x47e432){_0x479400=_0x479400-0x0;var _0x243341=_0xde76[_0x479400];return _0x243341;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6de7('0x0'))('api');var moment=require(_0x6de7('0x1'));var BPromise=require(_0x6de7('0x2'));var rp=require(_0x6de7('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6de7('0x4'));var config=require(_0x6de7('0x5'));var attributes=require(_0x6de7('0x6'));module[_0x6de7('0x7')]=function(_0x1daa6e,_0x4e4c33){return _0x1daa6e[_0x6de7('0x8')](_0x6de7('0x9'),attributes,{'tableName':'report_integration','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 3d321f9..08c0984 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 _0x8603=['message','info','result','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','IntegrationReport,\x20%s,\x20%s','request\x20sent','IntegrationReport,\x20%s,\x20%s,\x20%s','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x128450,_0x5869ba){_0x128450=_0x128450-0x0;var _0x4d80ed=_0x8603[_0x128450];return _0x4d80ed;};'use strict';var _=require('lodash');var util=require(_0x3860('0x0'));var moment=require(_0x3860('0x1'));var BPromise=require(_0x3860('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3860('0x3'))['db'];var utils=require(_0x3860('0x4'));var logger=require(_0x3860('0x5'))('rpc');var config=require(_0x3860('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3860('0x7')][_0x3860('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1eca44,_0xd3ce26,_0x472bf2){return new BPromise(function(_0x4aba10,_0x5c7350){return client['request'](_0x1eca44,_0x472bf2)[_0x3860('0x9')](function(_0x441dc4){logger['info'](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));logger['debug'](_0x3860('0xc'),_0xd3ce26,_0x3860('0xb'),JSON['stringify'](_0x441dc4));if(_0x441dc4[_0x3860('0xd')]){if(_0x441dc4[_0x3860('0xd')]['code']===0x1f4){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x5c7350(_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);}logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x441dc4[_0x3860('0xd')][_0x3860('0xe')]);return _0x4aba10(_0x441dc4['error'][_0x3860('0xe')]);}else{logger[_0x3860('0xf')](_0x3860('0xa'),_0xd3ce26,_0x3860('0xb'));_0x4aba10(_0x441dc4[_0x3860('0x10')][_0x3860('0xe')]);}})[_0x3860('0x11')](function(_0x378305){logger[_0x3860('0xd')](_0x3860('0xa'),_0xd3ce26,_0x378305);_0x5c7350(_0x378305);});});} \ No newline at end of file +var _0xd8b0=['../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','ioredis'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_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);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 2d0ab87..37f15df 100644 --- a/server/api/interval/index.js +++ b/server/api/interval/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['../../config/environment','get','isAuthenticated','index','/:id','/:id/sub_intervals','getIntervals','post','create','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1d24eb,_0x12295b){var _0x1dc576=function(_0x4d5770){while(--_0x4d5770){_0x1d24eb['push'](_0x1d24eb['shift']());}};_0x1dc576(++_0x12295b);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var auth=require(_0x7995('0x5'));var interaction=require(_0x7995('0x6'));var config=require(_0x7995('0x7'));var controller=require('./interval.controller');router[_0x7995('0x8')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xa')]);router[_0x7995('0x8')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller['show']);router[_0x7995('0x8')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth[_0x7995('0x9')](),controller[_0x7995('0xf')]);router[_0x7995('0xe')](_0x7995('0xc'),auth[_0x7995('0x9')](),controller['addInterval']);router[_0x7995('0xe')](_0x7995('0x10'),auth['isAuthenticated'](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xb'),auth[_0x7995('0x9')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x7995('0x15')]=router; \ No newline at end of file +var _0x34e8=['./interval.controller','get','isAuthenticated','show','/:id/sub_intervals','getIntervals','post','create','addInterval','/:id/sub_intervals/create_many','addIntervals','/:id','delete','destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d7acf,_0xb750d1){var _0x3d064d=function(_0x835f87){while(--_0x835f87){_0x1d7acf['push'](_0x1d7acf['shift']());}};_0x3d064d(++_0xb750d1);}(_0x34e8,0x12c));var _0x834e=function(_0x1a4cc6,_0x2a4420){_0x1a4cc6=_0x1a4cc6-0x0;var _0xebee5a=_0x34e8[_0x1a4cc6];return _0xebee5a;};'use strict';var multer=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var path=require(_0x834e('0x2'));var timeout=require(_0x834e('0x3'));var express=require('express');var router=express[_0x834e('0x4')]();var auth=require(_0x834e('0x5'));var interaction=require(_0x834e('0x6'));var config=require(_0x834e('0x7'));var controller=require(_0x834e('0x8'));router[_0x834e('0x9')]('/',auth[_0x834e('0xa')](),controller['index']);router[_0x834e('0x9')]('/:id',auth[_0x834e('0xa')](),controller[_0x834e('0xb')]);router[_0x834e('0x9')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0xd')]);router[_0x834e('0xe')]('/',auth[_0x834e('0xa')](),controller[_0x834e('0xf')]);router[_0x834e('0xe')](_0x834e('0xc'),auth[_0x834e('0xa')](),controller[_0x834e('0x10')]);router[_0x834e('0xe')](_0x834e('0x11'),auth[_0x834e('0xa')](),controller[_0x834e('0x12')]);router['put'](_0x834e('0x13'),auth[_0x834e('0xa')](),controller['update']);router[_0x834e('0x14')](_0x834e('0x13'),auth[_0x834e('0xa')](),controller[_0x834e('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index 48ed25e..c7acda7 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 _0x73b9=['STRING','sequelize','exports'];(function(_0x216428,_0x5d20ea){var _0x313dd4=function(_0x447e0d){while(--_0x447e0d){_0x216428['push'](_0x216428['shift']());}};_0x313dd4(++_0x5d20ea);}(_0x73b9,0xa6));var _0x973b=function(_0xf48d35,_0x2044f4){_0xf48d35=_0xf48d35-0x0;var _0x23522=_0x73b9[_0xf48d35];return _0x23522;};'use strict';var Sequelize=require(_0x973b('0x0'));module[_0x973b('0x1')]={'name':{'type':Sequelize[_0x973b('0x2')]},'description':{'type':Sequelize[_0x973b('0x2')]},'interval':{'type':Sequelize[_0x973b('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9bab=['sequelize','STRING'];(function(_0x19bd8d,_0x1a4bb6){var _0x41a285=function(_0x2766db){while(--_0x2766db){_0x19bd8d['push'](_0x19bd8d['shift']());}};_0x41a285(++_0x1a4bb6);}(_0x9bab,0x1ae));var _0xb9ba=function(_0x1f19c7,_0x425b41){_0x1f19c7=_0x1f19c7-0x0;var _0x3580b4=_0x9bab[_0x1f19c7];return _0x3580b4;};'use strict';var Sequelize=require(_0xb9ba('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb9ba('0x1')]},'interval':{'type':Sequelize[_0xb9ba('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 b616702..7000e33 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 _0xedd9=['sequelize','IntervalId','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','json','offset','limit','set','save','update','then','get','Intervals','destroy','end','name','index','map','Interval','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','params','find','create','body','user','role','userProfileId','UserProfileResource','error','getIntervals','addIntervals'];(function(_0x11a822,_0x5c1afc){var _0x5efcd9=function(_0x1c9f4b){while(--_0x1c9f4b){_0x11a822['push'](_0x11a822['shift']());}};_0x5efcd9(++_0x5c1afc);}(_0xedd9,0xfc));var _0x9edd=function(_0x342fe5,_0x3e588f){_0x342fe5=_0x342fe5-0x0;var _0x465b42=_0xedd9[_0x342fe5];return _0x465b42;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9edd('0x0'));var rimraf=require(_0x9edd('0x1'));var zipdir=require(_0x9edd('0x2'));var jsonpatch=require(_0x9edd('0x3'));var rp=require(_0x9edd('0x4'));var moment=require(_0x9edd('0x5'));var BPromise=require(_0x9edd('0x6'));var Mustache=require(_0x9edd('0x7'));var util=require('util');var path=require(_0x9edd('0x8'));var sox=require(_0x9edd('0x9'));var csv=require(_0x9edd('0xa'));var ejs=require(_0x9edd('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9edd('0xc'));var crypto=require('crypto');var jsforce=require(_0x9edd('0xd'));var deskjs=require(_0x9edd('0xe'));var toCsv=require(_0x9edd('0xa'));var querystring=require(_0x9edd('0xf'));var Papa=require('papaparse');var Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var db=require(_0x9edd('0x16'))['db'];var extensions=require(_0x9edd('0x17'));function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=_0x75a4ab['count'],_0x5f5bf4=_0x1042aa[_0x9edd('0x1b')],_0x448996=_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1c')],_0x449cee;if(_0x448996>=_0x4ea60f){_0x448996=_0x4ea60f;_0x449cee=0xc8;}else{_0x449cee=0xce;}_0x338f3c['status'](_0x449cee);return _0x338f3c[_0x9edd('0x1d')]('Content-Range',_0x5f5bf4+'-'+_0x448996+'/'+_0x4ea60f)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x1083e4){return function(_0x4bdb88){try{jsonpatch['apply'](_0x4bdb88,_0x1083e4,!![]);}catch(_0x45c3ab){return BPromise['reject'](_0x45c3ab);}return _0x4bdb88[_0x9edd('0x1e')]();};}function saveUpdates(_0x54a03f,_0x535f37){return function(_0x356751){if(_0x356751){return _0x356751[_0x9edd('0x1f')](_0x54a03f)['then'](function(_0x5823bc){return _0x5823bc;});}return null;};}function removeEntity(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['destroy']()[_0x9edd('0x20')](function(){var _0x1dca43=_0x477878[_0x9edd('0x21')]({'plain':!![]});var _0x2ca65f=_0x9edd('0x22');return db['UserProfileResource'][_0x9edd('0x23')]({'where':{'type':_0x2ca65f,'resourceId':_0x1dca43['id']}})[_0x9edd('0x20')](function(){return _0x477878;});})[_0x9edd('0x20')](function(){_0x341d67[_0x9edd('0x19')](0xcc)[_0x9edd('0x24')]();});}};}function handleEntityNotFound(_0x4d507f,_0x4b3d1b){return function(_0x3276ee){if(!_0x3276ee){_0x4d507f[_0x9edd('0x18')](0x194);}return _0x3276ee;};}function handleError(_0x8d67aa,_0x25e135){_0x25e135=_0x25e135||0x1f4;return function(_0x3c2227){logger['error'](_0x3c2227['stack']);if(_0x3c2227[_0x9edd('0x25')]){delete _0x3c2227[_0x9edd('0x25')];}_0x8d67aa[_0x9edd('0x19')](_0x25e135)['send'](_0x3c2227);};}exports[_0x9edd('0x26')]=function(_0x28cfae,_0x2ae8dd){var _0x41af53={},_0x5eccfb={},_0x2155a1={'count':0x0,'rows':[]};var _0x3fb556=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x42e664){return{'name':_0x42e664[_0x9edd('0x2a')],'type':_0x42e664[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x5eccfb[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x3fb556,_0x9edd('0x25'));_0x5eccfb[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x28cfae[_0x9edd('0x2e')]);_0x5eccfb['filters']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],_0x5eccfb[_0x9edd('0x2e')]);_0x41af53['attributes']=_[_0x9edd('0x30')](_0x5eccfb[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x41af53[_0x9edd('0x32')]=_0x41af53[_0x9edd('0x32')][_0x9edd('0x33')]?_0x41af53[_0x9edd('0x32')]:_0x5eccfb[_0x9edd('0x2d')];if(!_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x34')](_0x9edd('0x35'))){_0x41af53[_0x9edd('0x1c')]=qs['limit'](_0x28cfae[_0x9edd('0x2e')]['limit']);_0x41af53[_0x9edd('0x1b')]=qs[_0x9edd('0x1b')](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x1b')]);}_0x41af53[_0x9edd('0x36')]=qs['sort'](_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x37')]);_0x41af53[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x28cfae[_0x9edd('0x2e')],_0x5eccfb[_0x9edd('0x39')]));if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x3b')]){_0x41af53[_0x9edd('0x38')]=_['merge'](_0x41af53[_0x9edd('0x38')],{'$or':_['map'](_0x3fb556,function(_0x3ef1d5){if(_0x3ef1d5['type']!==_0x9edd('0x3c')){var _0x2858b5={};_0x2858b5[_0x3ef1d5[_0x9edd('0x25')]]={'$like':'%'+_0x28cfae['query'][_0x9edd('0x3b')]+'%'};return _0x2858b5;}})});}_0x41af53=_[_0x9edd('0x3d')]({},_0x41af53,_0x28cfae[_0x9edd('0x3e')]);var _0x48958a={'where':_0x41af53[_0x9edd('0x38')]};return db['Interval'][_0x9edd('0x3f')](_0x48958a)[_0x9edd('0x20')](function(_0x50be2c){_0x2155a1[_0x9edd('0x3f')]=_0x50be2c;if(_0x28cfae[_0x9edd('0x2e')][_0x9edd('0x40')]){_0x41af53[_0x9edd('0x41')]=[{'all':!![]}];}return db['Interval'][_0x9edd('0x42')](_0x41af53);})['then'](function(_0x2bdb3f){_0x2155a1[_0x9edd('0x43')]=_0x2bdb3f;return _0x2155a1;})['then'](respondWithFilteredResult(_0x2ae8dd,_0x41af53))[_0x9edd('0x44')](handleError(_0x2ae8dd,null));};exports['show']=function(_0x548299,_0x369b69){var _0x9cab86={'raw':!![],'where':{'id':_0x548299[_0x9edd('0x45')]['id']}},_0x1f276b={};_0x1f276b[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x1f276b[_0x9edd('0x2e')]=_[_0x9edd('0x2f')](_0x548299[_0x9edd('0x2e')]);_0x1f276b[_0x9edd('0x39')]=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],_0x1f276b[_0x9edd('0x2e')]);_0x9cab86['attributes']=_[_0x9edd('0x30')](_0x1f276b[_0x9edd('0x2d')],qs[_0x9edd('0x31')](_0x548299[_0x9edd('0x2e')][_0x9edd('0x31')]));_0x9cab86[_0x9edd('0x32')]=_0x9cab86[_0x9edd('0x32')]['length']?_0x9cab86['attributes']:_0x1f276b['model'];if(_0x548299[_0x9edd('0x2e')]['includeAll']){_0x9cab86[_0x9edd('0x41')]=[{'all':!![]}];}_0x9cab86=_[_0x9edd('0x3d')]({},_0x9cab86,_0x548299[_0x9edd('0x3e')]);return db[_0x9edd('0x28')][_0x9edd('0x46')](_0x9cab86)['then'](handleEntityNotFound(_0x369b69,null))[_0x9edd('0x20')](respondWithResult(_0x369b69,null))[_0x9edd('0x44')](handleError(_0x369b69,null));};exports[_0x9edd('0x47')]=function(_0x4a89ae,_0x3626bc){return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x4a89ae[_0x9edd('0x48')],{})[_0x9edd('0x20')](function(_0x35bdec){var _0x4d4f33=_0x4a89ae[_0x9edd('0x49')][_0x9edd('0x21')]({'plain':!![]});if(!_0x4d4f33)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4d4f33[_0x9edd('0x4a')]===_0x9edd('0x49')){var _0x4bb324=_0x35bdec[_0x9edd('0x21')]({'plain':!![]});var _0x8134cd=_0x9edd('0x22');return db['UserProfileSection'][_0x9edd('0x46')]({'where':{'name':_0x8134cd,'userProfileId':_0x4d4f33[_0x9edd('0x4b')]},'raw':!![]})[_0x9edd('0x20')](function(_0x28c7bd){if(_0x28c7bd&&_0x28c7bd['autoAssociation']===0x0){return db[_0x9edd('0x4c')][_0x9edd('0x47')]({'name':_0x4bb324[_0x9edd('0x25')],'resourceId':_0x4bb324['id'],'type':_0x28c7bd['name'],'sectionId':_0x28c7bd['id']},{})[_0x9edd('0x20')](function(){return _0x35bdec;});}else{return _0x35bdec;}})[_0x9edd('0x44')](function(_0x57db43){logger[_0x9edd('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x57db43);throw _0x57db43;});}return _0x35bdec;})[_0x9edd('0x20')](respondWithResult(_0x3626bc,0xc9))[_0x9edd('0x44')](handleError(_0x3626bc,null));};exports[_0x9edd('0x1f')]=function(_0x3fcdf5,_0x1e3c19){if(_0x3fcdf5[_0x9edd('0x48')]['id']){delete _0x3fcdf5[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x3fcdf5[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x1e3c19,null))['then'](saveUpdates(_0x3fcdf5[_0x9edd('0x48')],null))[_0x9edd('0x20')](respondWithResult(_0x1e3c19,null))[_0x9edd('0x44')](handleError(_0x1e3c19,null));};exports['destroy']=function(_0xe96d6a,_0x54a704){return db['Interval']['find']({'where':{'id':_0xe96d6a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x54a704,null))[_0x9edd('0x20')](removeEntity(_0x54a704,null))[_0x9edd('0x44')](handleError(_0x54a704,null));};exports['addInterval']=function(_0x56b38b,_0x4e3c3e,_0x71820f){if(_0x56b38b[_0x9edd('0x48')]['id']){delete _0x56b38b[_0x9edd('0x48')]['id'];}return db[_0x9edd('0x28')][_0x9edd('0x46')]({'where':{'id':_0x56b38b[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x4e3c3e,null))[_0x9edd('0x20')](function(_0x4eb780){if(_0x4eb780){_0x56b38b[_0x9edd('0x48')]['IntervalId']=_0x4eb780['id'];return db[_0x9edd('0x28')][_0x9edd('0x47')](_0x56b38b['body']);}})[_0x9edd('0x20')](respondWithResult(_0x4e3c3e,null))[_0x9edd('0x44')](handleError(_0x4e3c3e,null));};exports[_0x9edd('0x4e')]=function(_0x5ec9af,_0xc648c4,_0x2e1ce3){var _0x430eb4={};var _0x15ebfa={};var _0x1720b1;var _0x2c3173;return db['Interval']['findOne']({'where':{'id':_0x5ec9af[_0x9edd('0x45')]['id']}})['then'](handleEntityNotFound(_0xc648c4,null))[_0x9edd('0x20')](function(_0x3e9a3e){if(_0x3e9a3e){_0x1720b1=_0x3e9a3e;_0x15ebfa[_0x9edd('0x2d')]=_[_0x9edd('0x2f')](db['Interval'][_0x9edd('0x29')]);_0x15ebfa['query']=_[_0x9edd('0x2f')](_0x5ec9af[_0x9edd('0x2e')]);_0x15ebfa[_0x9edd('0x39')]=_['intersection'](_0x15ebfa[_0x9edd('0x2d')],_0x15ebfa['query']);_0x430eb4[_0x9edd('0x32')]=_[_0x9edd('0x30')](_0x15ebfa['model'],qs[_0x9edd('0x31')](_0x5ec9af['query'][_0x9edd('0x31')]));_0x430eb4[_0x9edd('0x32')]=_0x430eb4[_0x9edd('0x32')]['length']?_0x430eb4[_0x9edd('0x32')]:_0x15ebfa[_0x9edd('0x2d')];_0x430eb4[_0x9edd('0x36')]=qs[_0x9edd('0x37')](_0x5ec9af[_0x9edd('0x2e')]['sort']);_0x430eb4['where']=qs[_0x9edd('0x39')](_[_0x9edd('0x3a')](_0x5ec9af['query'],_0x15ebfa['filters']));if(_0x5ec9af['query'][_0x9edd('0x3b')]){_0x430eb4['where']=_['merge'](_0x430eb4[_0x9edd('0x38')],{'$or':_[_0x9edd('0x27')](_0x430eb4['attributes'],function(_0xb9ebeb){var _0x11e082={};_0x11e082[_0xb9ebeb]={'$like':'%'+_0x5ec9af[_0x9edd('0x2e')]['filter']+'%'};return _0x11e082;})});}_0x430eb4=_[_0x9edd('0x3d')]({},_0x430eb4,_0x5ec9af['options']);return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})[_0x9edd('0x20')](function(_0x4c8d06){if(_0x4c8d06){_0x2c3173=_0x4c8d06[_0x9edd('0x33')];if(!_0x5ec9af[_0x9edd('0x2e')]['hasOwnProperty'](_0x9edd('0x35'))){_0x430eb4[_0x9edd('0x1c')]=qs[_0x9edd('0x1c')](_0x5ec9af[_0x9edd('0x2e')]['limit']);_0x430eb4[_0x9edd('0x1b')]=qs['offset'](_0x5ec9af[_0x9edd('0x2e')][_0x9edd('0x1b')]);}return _0x1720b1[_0x9edd('0x4e')](_0x430eb4);}})['then'](function(_0x106a67){if(_0x106a67){return _0x106a67?{'count':_0x2c3173,'rows':_0x106a67}:null;}})[_0x9edd('0x20')](respondWithResult(_0xc648c4,null))[_0x9edd('0x44')](handleError(_0xc648c4,null));};exports[_0x9edd('0x4f')]=function(_0x25626a,_0x14e2e5,_0x3fa4a9){return db['Interval']['findOne']({'where':{'id':_0x25626a[_0x9edd('0x45')]['id']}})[_0x9edd('0x20')](handleEntityNotFound(_0x14e2e5,null))[_0x9edd('0x20')](function(_0x171403){if(_0x171403){return db[_0x9edd('0x50')]['transaction'](function(_0x2e40c8){return db[_0x9edd('0x28')][_0x9edd('0x23')]({'where':{'IntervalId':_0x25626a['params']['id']},'transaction':_0x2e40c8})[_0x9edd('0x20')](function(_0x29d70d){var _0x4b1c12=_[_0x9edd('0x27')](_0x25626a[_0x9edd('0x48')],function(_0x58c839){delete _0x58c839['id'];_0x58c839[_0x9edd('0x51')]=_0x25626a[_0x9edd('0x45')]['id'];return _0x58c839;});return db['Interval'][_0x9edd('0x52')](_0x4b1c12,{'transaction':_0x2e40c8});});})['then'](function(){return db['Interval'][_0x9edd('0x42')]({'where':{'IntervalId':_0x25626a[_0x9edd('0x45')]['id']}});});}})[_0x9edd('0x20')](respondWithResult(_0x14e2e5,null))['catch'](handleError(_0x14e2e5,null));}; \ No newline at end of file +var _0x9c44=['length','nolimit','limit','sort','where','pick','filter','merge','type','VIRTUAL','count','includeAll','include','findAll','rows','catch','show','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addInterval','IntervalId','order','getIntervals','hasOwnProperty','addIntervals','findOne','sequelize','bulkCreate','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','../../components/extensions/rewrite','status','end','json','offset','set','Content-Range','reject','save','update','then','destroy','get','Intervals','UserProfileResource','sendStatus','stack','name','index','map','Interval','rawAttributes','model','query','keys','filters','intersection','fields','attributes'];(function(_0x4fe596,_0x4da7ad){var _0x18071a=function(_0x45ed4d){while(--_0x45ed4d){_0x4fe596['push'](_0x4fe596['shift']());}};_0x18071a(++_0x4da7ad);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'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'];var extensions=require(_0x49c4('0x14'));function respondWithStatusCode(_0x5487cd,_0x7df3a9){_0x7df3a9=_0x7df3a9||0xcc;return function(_0x403bfb){if(_0x403bfb){return _0x5487cd['sendStatus'](_0x7df3a9);}return _0x5487cd[_0x49c4('0x15')](_0x7df3a9)[_0x49c4('0x16')]();};}function respondWithResult(_0x21f15a,_0x2decee){_0x2decee=_0x2decee||0xc8;return function(_0x12777c){if(_0x12777c){return _0x21f15a[_0x49c4('0x15')](_0x2decee)[_0x49c4('0x17')](_0x12777c);}};}function respondWithFilteredResult(_0x3de397,_0x58d177){return function(_0x3acd06){if(_0x3acd06){var _0x141003=_0x3acd06['count'],_0x13a2db=_0x58d177[_0x49c4('0x18')],_0x81e831=_0x58d177[_0x49c4('0x18')]+_0x58d177['limit'],_0x2abc78;if(_0x81e831>=_0x141003){_0x81e831=_0x141003;_0x2abc78=0xc8;}else{_0x2abc78=0xce;}_0x3de397['status'](_0x2abc78);return _0x3de397[_0x49c4('0x19')](_0x49c4('0x1a'),_0x13a2db+'-'+_0x81e831+'/'+_0x141003)[_0x49c4('0x17')](_0x3acd06);}return null;};}function patchUpdates(_0x59f29b){return function(_0x24856d){try{jsonpatch['apply'](_0x24856d,_0x59f29b,!![]);}catch(_0x2cbd50){return BPromise[_0x49c4('0x1b')](_0x2cbd50);}return _0x24856d[_0x49c4('0x1c')]();};}function saveUpdates(_0x291526,_0x382040){return function(_0x41078c){if(_0x41078c){return _0x41078c[_0x49c4('0x1d')](_0x291526)[_0x49c4('0x1e')](function(_0x2197d2){return _0x2197d2;});}return null;};}function removeEntity(_0x578447,_0x527126){return function(_0x57f502){if(_0x57f502){return _0x57f502[_0x49c4('0x1f')]()['then'](function(){var _0x592bb8=_0x57f502[_0x49c4('0x20')]({'plain':!![]});var _0x15581b=_0x49c4('0x21');return db[_0x49c4('0x22')]['destroy']({'where':{'type':_0x15581b,'resourceId':_0x592bb8['id']}})['then'](function(){return _0x57f502;});})[_0x49c4('0x1e')](function(){_0x578447[_0x49c4('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x207358,_0x43e014){return function(_0x210159){if(!_0x210159){_0x207358[_0x49c4('0x23')](0x194);}return _0x210159;};}function handleError(_0x531d92,_0x543ea2){_0x543ea2=_0x543ea2||0x1f4;return function(_0x449960){logger['error'](_0x449960[_0x49c4('0x24')]);if(_0x449960[_0x49c4('0x25')]){delete _0x449960[_0x49c4('0x25')];}_0x531d92[_0x49c4('0x15')](_0x543ea2)['send'](_0x449960);};}exports[_0x49c4('0x26')]=function(_0x2b2793,_0x46e04d){var _0x4f28a2={},_0x6329b3={},_0x29f835={'count':0x0,'rows':[]};var _0x26ba17=_[_0x49c4('0x27')](db[_0x49c4('0x28')][_0x49c4('0x29')],function(_0x46f7ea){return{'name':_0x46f7ea['fieldName'],'type':_0x46f7ea['type']['key']};});_0x6329b3[_0x49c4('0x2a')]=_[_0x49c4('0x27')](_0x26ba17,_0x49c4('0x25'));_0x6329b3[_0x49c4('0x2b')]=_[_0x49c4('0x2c')](_0x2b2793['query']);_0x6329b3[_0x49c4('0x2d')]=_[_0x49c4('0x2e')](_0x6329b3[_0x49c4('0x2a')],_0x6329b3[_0x49c4('0x2b')]);_0x4f28a2['attributes']=_['intersection'](_0x6329b3[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x2f')]));_0x4f28a2[_0x49c4('0x30')]=_0x4f28a2['attributes'][_0x49c4('0x31')]?_0x4f28a2[_0x49c4('0x30')]:_0x6329b3[_0x49c4('0x2a')];if(!_0x2b2793['query']['hasOwnProperty'](_0x49c4('0x32'))){_0x4f28a2[_0x49c4('0x33')]=qs[_0x49c4('0x33')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x33')]);_0x4f28a2[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x18')]);}_0x4f28a2['order']=qs[_0x49c4('0x34')](_0x2b2793['query'][_0x49c4('0x34')]);_0x4f28a2[_0x49c4('0x35')]=qs[_0x49c4('0x2d')](_[_0x49c4('0x36')](_0x2b2793['query'],_0x6329b3[_0x49c4('0x2d')]));if(_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x37')]){_0x4f28a2['where']=_[_0x49c4('0x38')](_0x4f28a2[_0x49c4('0x35')],{'$or':_[_0x49c4('0x27')](_0x26ba17,function(_0x5e5366){if(_0x5e5366[_0x49c4('0x39')]!==_0x49c4('0x3a')){var _0x143916={};_0x143916[_0x5e5366[_0x49c4('0x25')]]={'$like':'%'+_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x37')]+'%'};return _0x143916;}})});}_0x4f28a2=_[_0x49c4('0x38')]({},_0x4f28a2,_0x2b2793['options']);var _0x2d2510={'where':_0x4f28a2[_0x49c4('0x35')]};return db[_0x49c4('0x28')][_0x49c4('0x3b')](_0x2d2510)[_0x49c4('0x1e')](function(_0x29dd5d){_0x29f835[_0x49c4('0x3b')]=_0x29dd5d;if(_0x2b2793[_0x49c4('0x2b')][_0x49c4('0x3c')]){_0x4f28a2[_0x49c4('0x3d')]=[{'all':!![]}];}return db[_0x49c4('0x28')][_0x49c4('0x3e')](_0x4f28a2);})[_0x49c4('0x1e')](function(_0x4e38bc){_0x29f835[_0x49c4('0x3f')]=_0x4e38bc;return _0x29f835;})['then'](respondWithFilteredResult(_0x46e04d,_0x4f28a2))[_0x49c4('0x40')](handleError(_0x46e04d,null));};exports[_0x49c4('0x41')]=function(_0x28d4fb,_0x1480da){var _0x239327={'raw':!![],'where':{'id':_0x28d4fb['params']['id']}},_0x281b83={};_0x281b83['model']=_[_0x49c4('0x2c')](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x281b83[_0x49c4('0x2b')]=_['keys'](_0x28d4fb[_0x49c4('0x2b')]);_0x281b83[_0x49c4('0x2d')]=_[_0x49c4('0x2e')](_0x281b83[_0x49c4('0x2a')],_0x281b83[_0x49c4('0x2b')]);_0x239327[_0x49c4('0x30')]=_[_0x49c4('0x2e')](_0x281b83[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x28d4fb['query'][_0x49c4('0x2f')]));_0x239327['attributes']=_0x239327[_0x49c4('0x30')][_0x49c4('0x31')]?_0x239327[_0x49c4('0x30')]:_0x281b83[_0x49c4('0x2a')];if(_0x28d4fb[_0x49c4('0x2b')]['includeAll']){_0x239327[_0x49c4('0x3d')]=[{'all':!![]}];}_0x239327=_[_0x49c4('0x38')]({},_0x239327,_0x28d4fb[_0x49c4('0x42')]);return db[_0x49c4('0x28')][_0x49c4('0x43')](_0x239327)[_0x49c4('0x1e')](handleEntityNotFound(_0x1480da,null))[_0x49c4('0x1e')](respondWithResult(_0x1480da,null))['catch'](handleError(_0x1480da,null));};exports[_0x49c4('0x44')]=function(_0x5cfff9,_0x3f7379){return db[_0x49c4('0x28')][_0x49c4('0x44')](_0x5cfff9[_0x49c4('0x45')],{})[_0x49c4('0x1e')](function(_0x30bea5){var _0x2c6be1=_0x5cfff9['user'][_0x49c4('0x20')]({'plain':!![]});if(!_0x2c6be1)throw new Error(_0x49c4('0x46'));if(_0x2c6be1['role']===_0x49c4('0x47')){var _0xaece5f=_0x30bea5[_0x49c4('0x20')]({'plain':!![]});var _0x242afc='Intervals';return db['UserProfileSection'][_0x49c4('0x43')]({'where':{'name':_0x242afc,'userProfileId':_0x2c6be1['userProfileId']},'raw':!![]})[_0x49c4('0x1e')](function(_0x1f941f){if(_0x1f941f&&_0x1f941f[_0x49c4('0x48')]===0x0){return db[_0x49c4('0x22')][_0x49c4('0x44')]({'name':_0xaece5f[_0x49c4('0x25')],'resourceId':_0xaece5f['id'],'type':_0x1f941f[_0x49c4('0x25')],'sectionId':_0x1f941f['id']},{})['then'](function(){return _0x30bea5;});}else{return _0x30bea5;}})[_0x49c4('0x40')](function(_0x1550ce){logger[_0x49c4('0x49')](_0x49c4('0x4a'),_0x1550ce);throw _0x1550ce;});}return _0x30bea5;})[_0x49c4('0x1e')](respondWithResult(_0x3f7379,0xc9))[_0x49c4('0x40')](handleError(_0x3f7379,null));};exports[_0x49c4('0x1d')]=function(_0x25d174,_0x1e0b4f){if(_0x25d174[_0x49c4('0x45')]['id']){delete _0x25d174['body']['id'];}return db['Interval'][_0x49c4('0x43')]({'where':{'id':_0x25d174[_0x49c4('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1e0b4f,null))['then'](saveUpdates(_0x25d174[_0x49c4('0x45')],null))['then'](respondWithResult(_0x1e0b4f,null))['catch'](handleError(_0x1e0b4f,null));};exports[_0x49c4('0x1f')]=function(_0x4081a5,_0x4a0a93){return db[_0x49c4('0x28')][_0x49c4('0x43')]({'where':{'id':_0x4081a5[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x4a0a93,null))['then'](removeEntity(_0x4a0a93,null))[_0x49c4('0x40')](handleError(_0x4a0a93,null));};exports[_0x49c4('0x4c')]=function(_0x207572,_0x208208,_0x73840f){if(_0x207572[_0x49c4('0x45')]['id']){delete _0x207572['body']['id'];}return db['Interval'][_0x49c4('0x43')]({'where':{'id':_0x207572[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x208208,null))[_0x49c4('0x1e')](function(_0x23288e){if(_0x23288e){_0x207572[_0x49c4('0x45')][_0x49c4('0x4d')]=_0x23288e['id'];return db['Interval'][_0x49c4('0x44')](_0x207572[_0x49c4('0x45')]);}})['then'](respondWithResult(_0x208208,null))[_0x49c4('0x40')](handleError(_0x208208,null));};exports['getIntervals']=function(_0x2f966c,_0x147ebd,_0x9eaa84){var _0x2fe89a={};var _0x845f7e={};var _0x3e44d7;var _0x3eb66d;return db[_0x49c4('0x28')]['findOne']({'where':{'id':_0x2f966c[_0x49c4('0x4b')]['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x147ebd,null))['then'](function(_0x10dec7){if(_0x10dec7){_0x3e44d7=_0x10dec7;_0x845f7e[_0x49c4('0x2a')]=_['keys'](db[_0x49c4('0x28')][_0x49c4('0x29')]);_0x845f7e['query']=_['keys'](_0x2f966c['query']);_0x845f7e['filters']=_[_0x49c4('0x2e')](_0x845f7e['model'],_0x845f7e[_0x49c4('0x2b')]);_0x2fe89a[_0x49c4('0x30')]=_['intersection'](_0x845f7e[_0x49c4('0x2a')],qs[_0x49c4('0x2f')](_0x2f966c['query'][_0x49c4('0x2f')]));_0x2fe89a[_0x49c4('0x30')]=_0x2fe89a[_0x49c4('0x30')][_0x49c4('0x31')]?_0x2fe89a['attributes']:_0x845f7e[_0x49c4('0x2a')];_0x2fe89a[_0x49c4('0x4e')]=qs[_0x49c4('0x34')](_0x2f966c[_0x49c4('0x2b')]['sort']);_0x2fe89a[_0x49c4('0x35')]=qs['filters'](_['pick'](_0x2f966c['query'],_0x845f7e['filters']));if(_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x37')]){_0x2fe89a[_0x49c4('0x35')]=_[_0x49c4('0x38')](_0x2fe89a['where'],{'$or':_['map'](_0x2fe89a[_0x49c4('0x30')],function(_0x109b81){var _0x342326={};_0x342326[_0x109b81]={'$like':'%'+_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x37')]+'%'};return _0x342326;})});}_0x2fe89a=_[_0x49c4('0x38')]({},_0x2fe89a,_0x2f966c[_0x49c4('0x42')]);return _0x3e44d7[_0x49c4('0x4f')](_0x2fe89a);}})['then'](function(_0x2276db){if(_0x2276db){_0x3eb66d=_0x2276db['length'];if(!_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x50')](_0x49c4('0x32'))){_0x2fe89a[_0x49c4('0x33')]=qs[_0x49c4('0x33')](_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x33')]);_0x2fe89a[_0x49c4('0x18')]=qs[_0x49c4('0x18')](_0x2f966c[_0x49c4('0x2b')][_0x49c4('0x18')]);}return _0x3e44d7[_0x49c4('0x4f')](_0x2fe89a);}})[_0x49c4('0x1e')](function(_0x14bd09){if(_0x14bd09){return _0x14bd09?{'count':_0x3eb66d,'rows':_0x14bd09}:null;}})[_0x49c4('0x1e')](respondWithResult(_0x147ebd,null))[_0x49c4('0x40')](handleError(_0x147ebd,null));};exports[_0x49c4('0x51')]=function(_0x3485c0,_0x4e1544,_0x5ec201){return db[_0x49c4('0x28')][_0x49c4('0x52')]({'where':{'id':_0x3485c0['params']['id']}})[_0x49c4('0x1e')](handleEntityNotFound(_0x4e1544,null))[_0x49c4('0x1e')](function(_0x2939fd){if(_0x2939fd){return db[_0x49c4('0x53')]['transaction'](function(_0x5a14a5){return db['Interval'][_0x49c4('0x1f')]({'where':{'IntervalId':_0x3485c0[_0x49c4('0x4b')]['id']},'transaction':_0x5a14a5})[_0x49c4('0x1e')](function(_0x2f4289){var _0x118fc4=_[_0x49c4('0x27')](_0x3485c0[_0x49c4('0x45')],function(_0x3692a4){delete _0x3692a4['id'];_0x3692a4[_0x49c4('0x4d')]=_0x3485c0['params']['id'];return _0x3692a4;});return db[_0x49c4('0x28')][_0x49c4('0x54')](_0x118fc4,{'transaction':_0x5a14a5});});})[_0x49c4('0x1e')](function(){return db['Interval'][_0x49c4('0x3e')]({'where':{'IntervalId':_0x3485c0[_0x49c4('0x4b')]['id']}});});}})[_0x49c4('0x1e')](respondWithResult(_0x4e1544,null))[_0x49c4('0x40')](handleError(_0x4e1544,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index ca9a198..ec4b2f6 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 _0x10d8=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../components/extensions/rewrite','exports','define','Interval','tools_intervals','rewrite'];(function(_0x2183e,_0x289c92){var _0x537549=function(_0x1a6b71){while(--_0x1a6b71){_0x2183e['push'](_0x2183e['shift']());}};_0x537549(++_0x289c92);}(_0x10d8,0xee));var _0x810d=function(_0x4263e5,_0x5411d1){_0x4263e5=_0x4263e5-0x0;var _0x172fc1=_0x10d8[_0x4263e5];return _0x172fc1;};'use strict';var _=require(_0x810d('0x0'));var util=require(_0x810d('0x1'));var logger=require(_0x810d('0x2'))('api');var moment=require(_0x810d('0x3'));var BPromise=require(_0x810d('0x4'));var rp=require(_0x810d('0x5'));var fs=require('fs');var path=require(_0x810d('0x6'));var rimraf=require(_0x810d('0x7'));var config=require('../../config/environment');var attributes=require('./interval.attributes');var extensions=require(_0x810d('0x8'));module[_0x810d('0x9')]=function(_0xeebfbe,_0x3a4786){return _0xeebfbe[_0x810d('0xa')](_0x810d('0xb'),attributes,{'tableName':_0x810d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4efe33,_0x48321e){extensions['rewrite'](_0xeebfbe,_0x4efe33);},'afterBulkCreate':function(_0x485919,_0x3c8e0f,_0x354659){_0x354659();extensions[_0x810d('0xd')](_0xeebfbe,_0x485919[0x0]);},'afterUpdate':function(_0x2b8c58,_0x5d8288){extensions[_0x810d('0xd')](_0xeebfbe,_0x2b8c58);},'afterDestroy':function(_0x285213,_0x2cd42a){extensions[_0x810d('0xd')](_0xeebfbe,_0x285213);}}});}; \ No newline at end of file +var _0xaaa2=['exports','Interval','rewrite','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','./interval.attributes','../../components/extensions/rewrite'];(function(_0x3b1fd1,_0x6b8d4d){var _0x4efdfb=function(_0x139111){while(--_0x139111){_0x3b1fd1['push'](_0x3b1fd1['shift']());}};_0x4efdfb(++_0x6b8d4d);}(_0xaaa2,0xac));var _0x2aaa=function(_0x5485eb,_0x460f9d){_0x5485eb=_0x5485eb-0x0;var _0x5446c5=_0xaaa2[_0x5485eb];return _0x5446c5;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var logger=require(_0x2aaa('0x2'))(_0x2aaa('0x3'));var moment=require(_0x2aaa('0x4'));var BPromise=require(_0x2aaa('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2aaa('0x6'));var rimraf=require('rimraf');var config=require(_0x2aaa('0x7'));var attributes=require(_0x2aaa('0x8'));var extensions=require(_0x2aaa('0x9'));module[_0x2aaa('0xa')]=function(_0x1ef101,_0x106af9){return _0x1ef101['define'](_0x2aaa('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x505fe8,_0x139ca7){extensions['rewrite'](_0x1ef101,_0x505fe8);},'afterBulkCreate':function(_0x1ad6e9,_0x491279,_0x4f1343){_0x4f1343();extensions[_0x2aaa('0xc')](_0x1ef101,_0x1ad6e9[0x0]);},'afterUpdate':function(_0x438f88,_0x5e1347){extensions[_0x2aaa('0xc')](_0x1ef101,_0x438f88);},'afterDestroy':function(_0xbfd0c9,_0x2e3bd2){extensions['rewrite'](_0x1ef101,_0xbfd0c9);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index c6abe2d..4917754 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 _0x0035=['../../config/logger','rpc','jayson/promise','client','request','then','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetInterval','Interval','options','where','attributes','limit','map','model','include','ShowInterval','util','moment','../../config/utils'];(function(_0x2a765d,_0x40a0d1){var _0x32f154=function(_0x31053f){while(--_0x31053f){_0x2a765d['push'](_0x2a765d['shift']());}};_0x32f154(++_0x40a0d1);}(_0x0035,0x159));var _0x5003=function(_0x135904,_0x1e252b){_0x135904=_0x135904-0x0;var _0x1ce7d5=_0x0035[_0x135904];return _0x1ce7d5;};'use strict';var _=require('lodash');var util=require(_0x5003('0x0'));var moment=require(_0x5003('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5003('0x2'));var logger=require(_0x5003('0x3'))(_0x5003('0x4'));var config=require('../../config/environment');var jayson=require(_0x5003('0x5'));var client=jayson[_0x5003('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3197d8,_0x3f54f7,_0x30f00a){return new BPromise(function(_0xaa3a51,_0x575cb3){return client[_0x5003('0x7')](_0x3197d8,_0x30f00a)[_0x5003('0x8')](function(_0x418087){logger[_0x5003('0x9')](_0x5003('0xa'),_0x3f54f7,_0x5003('0xb'));logger[_0x5003('0xc')](_0x5003('0xd'),_0x3f54f7,'request\x20sent',JSON[_0x5003('0xe')](_0x418087));if(_0x418087[_0x5003('0xf')]){if(_0x418087[_0x5003('0xf')][_0x5003('0x10')]===0x1f4){logger[_0x5003('0xf')](_0x5003('0xa'),_0x3f54f7,_0x418087[_0x5003('0xf')][_0x5003('0x11')]);return _0x575cb3(_0x418087[_0x5003('0xf')][_0x5003('0x11')]);}logger[_0x5003('0xf')]('Interval,\x20%s,\x20%s',_0x3f54f7,_0x418087[_0x5003('0xf')][_0x5003('0x11')]);return _0xaa3a51(_0x418087[_0x5003('0xf')][_0x5003('0x11')]);}else{logger['info'](_0x5003('0xa'),_0x3f54f7,_0x5003('0xb'));_0xaa3a51(_0x418087['result']['message']);}})[_0x5003('0x12')](function(_0x30510a){logger[_0x5003('0xf')](_0x5003('0xa'),_0x3f54f7,_0x30510a);_0x575cb3(_0x30510a);});});}exports[_0x5003('0x13')]=function(_0x2cf6d7){var _0x21ffe3=this;return new Promise(function(_0x48de36,_0x390b60){return db[_0x5003('0x14')]['findAll']({'raw':_0x2cf6d7['options']?_0x2cf6d7['options']['raw']===undefined?!![]:![]:!![],'where':_0x2cf6d7[_0x5003('0x15')]?_0x2cf6d7[_0x5003('0x15')][_0x5003('0x16')]||null:null,'attributes':_0x2cf6d7[_0x5003('0x15')]?_0x2cf6d7['options'][_0x5003('0x17')]||null:null,'limit':_0x2cf6d7[_0x5003('0x15')]?_0x2cf6d7['options'][_0x5003('0x18')]||null:null,'include':_0x2cf6d7[_0x5003('0x15')]?_0x2cf6d7['options']['include']?_[_0x5003('0x19')](_0x2cf6d7[_0x5003('0x15')]['include'],function(_0x5806f6){return{'model':db[_0x5806f6[_0x5003('0x1a')]],'as':_0x5806f6['as'],'attributes':_0x5806f6[_0x5003('0x17')],'include':_0x5806f6[_0x5003('0x1b')]?_[_0x5003('0x19')](_0x5806f6[_0x5003('0x1b')],function(_0x40c39a){return{'model':db[_0x40c39a[_0x5003('0x1a')]],'as':_0x40c39a['as'],'attributes':_0x40c39a[_0x5003('0x17')],'include':_0x40c39a['include']?_['map'](_0x40c39a['include'],function(_0x45389a){return{'model':db[_0x45389a[_0x5003('0x1a')]],'as':_0x45389a['as'],'attributes':_0x45389a[_0x5003('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5003('0x8')](function(_0x41b217){logger[_0x5003('0x9')](_0x5003('0x13'),_0x2cf6d7);logger['debug'](_0x5003('0x13'),_0x2cf6d7,JSON[_0x5003('0xe')](_0x41b217));_0x48de36(_0x41b217);})[_0x5003('0x12')](function(_0x1417fb){logger[_0x5003('0xf')](_0x5003('0x13'),_0x1417fb[_0x5003('0x11')],_0x2cf6d7);_0x390b60(_0x21ffe3[_0x5003('0xf')](0x1f4,_0x1417fb[_0x5003('0x11')]));});});};exports[_0x5003('0x1c')]=function(_0x24c9df){var _0x1b3e5c=this;return new Promise(function(_0x42846f,_0xf3b18e){return db['Interval']['find']({'raw':_0x24c9df[_0x5003('0x15')]?_0x24c9df['options']['raw']===undefined?!![]:![]:!![],'where':_0x24c9df[_0x5003('0x15')]?_0x24c9df[_0x5003('0x15')][_0x5003('0x16')]||null:null,'attributes':_0x24c9df[_0x5003('0x15')]?_0x24c9df['options'][_0x5003('0x17')]||null:null,'include':_0x24c9df[_0x5003('0x15')]?_0x24c9df['options'][_0x5003('0x1b')]?_[_0x5003('0x19')](_0x24c9df[_0x5003('0x15')][_0x5003('0x1b')],function(_0x435073){return{'model':db[_0x435073[_0x5003('0x1a')]],'as':_0x435073['as'],'attributes':_0x435073[_0x5003('0x17')],'include':_0x435073[_0x5003('0x1b')]?_[_0x5003('0x19')](_0x435073[_0x5003('0x1b')],function(_0x163ad6){return{'model':db[_0x163ad6[_0x5003('0x1a')]],'as':_0x163ad6['as'],'attributes':_0x163ad6[_0x5003('0x17')],'include':_0x163ad6[_0x5003('0x1b')]?_['map'](_0x163ad6[_0x5003('0x1b')],function(_0x2ee14c){return{'model':db[_0x2ee14c[_0x5003('0x1a')]],'as':_0x2ee14c['as'],'attributes':_0x2ee14c[_0x5003('0x17')]};}):[]};}):[]};}):[]:[]})[_0x5003('0x8')](function(_0x309aa3){logger[_0x5003('0x9')](_0x5003('0x1c'),_0x24c9df);logger[_0x5003('0xc')](_0x5003('0x1c'),_0x24c9df,JSON['stringify'](_0x309aa3));_0x42846f(_0x309aa3);})['catch'](function(_0x2b0871){logger[_0x5003('0xf')](_0x5003('0x1c'),_0x2b0871[_0x5003('0x11')],_0x24c9df);_0xf3b18e(_0x1b3e5c[_0x5003('0xf')](0x1f4,_0x2b0871[_0x5003('0x11')]));});});}; \ No newline at end of file +var _0xd88d=['options','raw','attributes','include','map','model','debug','catch','find','where','ShowInterval','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then','info','Interval,\x20%s,\x20%s','request\x20sent','Interval,\x20%s,\x20%s,\x20%s','stringify','error','message','result','GetInterval','Interval'];(function(_0x47b606,_0x13dff8){var _0x69e220=function(_0x5e0787){while(--_0x5e0787){_0x47b606['push'](_0x47b606['shift']());}};_0x69e220(++_0x13dff8);}(_0xd88d,0x1dc));var _0xdd88=function(_0x52eba2,_0x57c5b7){_0x52eba2=_0x52eba2-0x0;var _0x21afe5=_0xd88d[_0x52eba2];return _0x21afe5;};'use strict';var _=require('lodash');var util=require(_0xdd88('0x0'));var moment=require(_0xdd88('0x1'));var BPromise=require(_0xdd88('0x2'));var rs=require(_0xdd88('0x3'));var fs=require('fs');var Redis=require(_0xdd88('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xdd88('0x5'));var jayson=require(_0xdd88('0x6'));var client=jayson[_0xdd88('0x7')][_0xdd88('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xcf32bd,_0x23acc8,_0x393846){return new BPromise(function(_0xde630c,_0x248070){return client['request'](_0xcf32bd,_0x393846)[_0xdd88('0x9')](function(_0x125a22){logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x23acc8,_0xdd88('0xc'));logger['debug'](_0xdd88('0xd'),_0x23acc8,_0xdd88('0xc'),JSON[_0xdd88('0xe')](_0x125a22));if(_0x125a22[_0xdd88('0xf')]){if(_0x125a22[_0xdd88('0xf')]['code']===0x1f4){logger['error']('Interval,\x20%s,\x20%s',_0x23acc8,_0x125a22[_0xdd88('0xf')][_0xdd88('0x10')]);return _0x248070(_0x125a22[_0xdd88('0xf')]['message']);}logger[_0xdd88('0xf')](_0xdd88('0xb'),_0x23acc8,_0x125a22[_0xdd88('0xf')][_0xdd88('0x10')]);return _0xde630c(_0x125a22[_0xdd88('0xf')]['message']);}else{logger[_0xdd88('0xa')](_0xdd88('0xb'),_0x23acc8,_0xdd88('0xc'));_0xde630c(_0x125a22[_0xdd88('0x11')][_0xdd88('0x10')]);}})['catch'](function(_0x16dda7){logger[_0xdd88('0xf')](_0xdd88('0xb'),_0x23acc8,_0x16dda7);_0x248070(_0x16dda7);});});}exports[_0xdd88('0x12')]=function(_0x248ad4){var _0x6a5abf=this;return new Promise(function(_0x5ee999,_0x30bd2c){return db[_0xdd88('0x13')]['findAll']({'raw':_0x248ad4[_0xdd88('0x14')]?_0x248ad4['options'][_0xdd88('0x15')]===undefined?!![]:![]:!![],'where':_0x248ad4[_0xdd88('0x14')]?_0x248ad4[_0xdd88('0x14')]['where']||null:null,'attributes':_0x248ad4['options']?_0x248ad4[_0xdd88('0x14')][_0xdd88('0x16')]||null:null,'limit':_0x248ad4[_0xdd88('0x14')]?_0x248ad4[_0xdd88('0x14')]['limit']||null:null,'include':_0x248ad4['options']?_0x248ad4[_0xdd88('0x14')][_0xdd88('0x17')]?_['map'](_0x248ad4['options'][_0xdd88('0x17')],function(_0x95e993){return{'model':db[_0x95e993['model']],'as':_0x95e993['as'],'attributes':_0x95e993['attributes'],'include':_0x95e993[_0xdd88('0x17')]?_['map'](_0x95e993['include'],function(_0x1b173c){return{'model':db[_0x1b173c['model']],'as':_0x1b173c['as'],'attributes':_0x1b173c[_0xdd88('0x16')],'include':_0x1b173c['include']?_[_0xdd88('0x18')](_0x1b173c[_0xdd88('0x17')],function(_0x194b45){return{'model':db[_0x194b45[_0xdd88('0x19')]],'as':_0x194b45['as'],'attributes':_0x194b45[_0xdd88('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdd88('0x9')](function(_0x3eec94){logger[_0xdd88('0xa')]('GetInterval',_0x248ad4);logger[_0xdd88('0x1a')](_0xdd88('0x12'),_0x248ad4,JSON[_0xdd88('0xe')](_0x3eec94));_0x5ee999(_0x3eec94);})[_0xdd88('0x1b')](function(_0x494f04){logger['error'](_0xdd88('0x12'),_0x494f04['message'],_0x248ad4);_0x30bd2c(_0x6a5abf[_0xdd88('0xf')](0x1f4,_0x494f04[_0xdd88('0x10')]));});});};exports['ShowInterval']=function(_0x5222dd){var _0x3587ad=this;return new Promise(function(_0x517af3,_0x2f99a1){return db[_0xdd88('0x13')][_0xdd88('0x1c')]({'raw':_0x5222dd[_0xdd88('0x14')]?_0x5222dd[_0xdd88('0x14')][_0xdd88('0x15')]===undefined?!![]:![]:!![],'where':_0x5222dd[_0xdd88('0x14')]?_0x5222dd['options'][_0xdd88('0x1d')]||null:null,'attributes':_0x5222dd[_0xdd88('0x14')]?_0x5222dd[_0xdd88('0x14')]['attributes']||null:null,'include':_0x5222dd[_0xdd88('0x14')]?_0x5222dd['options'][_0xdd88('0x17')]?_[_0xdd88('0x18')](_0x5222dd[_0xdd88('0x14')][_0xdd88('0x17')],function(_0x17f1bd){return{'model':db[_0x17f1bd[_0xdd88('0x19')]],'as':_0x17f1bd['as'],'attributes':_0x17f1bd[_0xdd88('0x16')],'include':_0x17f1bd[_0xdd88('0x17')]?_[_0xdd88('0x18')](_0x17f1bd['include'],function(_0xaeee15){return{'model':db[_0xaeee15[_0xdd88('0x19')]],'as':_0xaeee15['as'],'attributes':_0xaeee15['attributes'],'include':_0xaeee15[_0xdd88('0x17')]?_['map'](_0xaeee15[_0xdd88('0x17')],function(_0x45ab33){return{'model':db[_0x45ab33[_0xdd88('0x19')]],'as':_0x45ab33['as'],'attributes':_0x45ab33[_0xdd88('0x16')]};}):[]};}):[]};}):[]:[]})[_0xdd88('0x9')](function(_0x18b284){logger['info'](_0xdd88('0x1e'),_0x5222dd);logger[_0xdd88('0x1a')](_0xdd88('0x1e'),_0x5222dd,JSON[_0xdd88('0xe')](_0x18b284));_0x517af3(_0x18b284);})[_0xdd88('0x1b')](function(_0x470bb3){logger['error']('ShowInterval',_0x470bb3[_0xdd88('0x10')],_0x5222dd);_0x2f99a1(_0x3587ad['error'](0x1f4,_0x470bb3[_0xdd88('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index f25de42..c2c0814 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 _0xd3f3=['../../components/auth/service','./jira.controller','post','send','express'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0xd3f3,0x81));var _0x3d3f=function(_0x30b10a,_0x506695){_0x30b10a=_0x30b10a-0x0;var _0x160fd3=_0xd3f3[_0x30b10a];return _0x160fd3;};'use strict';var express=require(_0x3d3f('0x0'));var router=express['Router']();var auth=require(_0x3d3f('0x1'));var controller=require(_0x3d3f('0x2'));router[_0x3d3f('0x3')]('/',auth['isAuthenticated'](),controller[_0x3d3f('0x4')]);module['exports']=router; \ No newline at end of file +var _0xc919=['../../components/auth/service','./jira.controller','post','isAuthenticated','send','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc919,0x1c8));var _0x9c91=function(_0x19ccaa,_0x14c728){_0x19ccaa=_0x19ccaa-0x0;var _0x46884a=_0xc919[_0x19ccaa];return _0x46884a;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x9c91('0x0'));var controller=require(_0x9c91('0x1'));router[_0x9c91('0x2')]('/',auth[_0x9c91('0x3')](),controller[_0x9c91('0x4')]);module[_0x9c91('0x5')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 177c386..732fe8e 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 _0xe2ab=['setEncoding','utf8','data','end','status','statusCode','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','openIssue','send','body','headers','connection','remoteAddress','socket','bluebird','../../config/logger','support','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','POST','application/json','Basic\x20','base64','stringify','request'];(function(_0x364048,_0x34dea3){var _0x591678=function(_0x239c0a){while(--_0x239c0a){_0x364048['push'](_0x364048['shift']());}};_0x591678(++_0x34dea3);}(_0xe2ab,0x1d3));var _0xbe2a=function(_0x12819f,_0x2a25df){_0x12819f=_0x12819f-0x0;var _0x3b4949=_0xe2ab[_0x12819f];return _0x3b4949;};'use strict';var BPromise=require(_0xbe2a('0x0'));var https=require('https');var logger=require(_0xbe2a('0x1'))('api');var USERNAME=_0xbe2a('0x2');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4c34b9,_0xa9ee94){var _0x5a7bda={'fields':{'project':{'key':_0x4c34b9['key']||'MOTGUI'},'summary':(_0x4c34b9['summary']||_0xbe2a('0x3'))+_0xbe2a('0x4')+_0x4c34b9['ip'],'description':_0x4c34b9[_0xbe2a('0x5')]||JSON['stringify'](_0x4c34b9),'issuetype':{'name':_0x4c34b9[_0xbe2a('0x6')]||_0xbe2a('0x7')}}};_0x5a7bda[_0xbe2a('0x8')][_0xbe2a('0x9')]=_0x4c34b9[_0xbe2a('0xa')];_0x5a7bda[_0xbe2a('0x8')][_0xbe2a('0xb')]=_0x4c34b9[_0xbe2a('0xc')];_0x5a7bda[_0xbe2a('0x8')][_0xbe2a('0xd')]=_0x4c34b9['newToken'];_0x5a7bda[_0xbe2a('0x8')]['customfield_11503']=_0x4c34b9[_0xbe2a('0xe')];_0x5a7bda['fields'][_0xbe2a('0xf')]=_0x4c34b9[_0xbe2a('0x10')];_0x5a7bda[_0xbe2a('0x8')][_0xbe2a('0x11')]=_0x4c34b9['ip'];var _0x32ef83={'host':_0xbe2a('0x12'),'port':0x1bb,'path':'/rest/api/2/issue','method':_0xbe2a('0x13'),'timeout':0x4e20,'headers':{'Content-Type':_0xbe2a('0x14'),'Authorization':_0xbe2a('0x15')+new Buffer(USERNAME+':'+PASSWORD)['toString'](_0xbe2a('0x16'))}};var _0x2a3f33=JSON[_0xbe2a('0x17')](_0x5a7bda);var _0x582dd3=https[_0xbe2a('0x18')](_0x32ef83,function(_0x45b674){_0x45b674[_0xbe2a('0x19')](_0xbe2a('0x1a'));var _0x186225='';_0x45b674['on'](_0xbe2a('0x1b'),function(_0x566165){_0x186225+=_0x566165;});_0x45b674['on'](_0xbe2a('0x1c'),function(){if(_0xa9ee94){return _0xa9ee94[_0xbe2a('0x1d')](_0x45b674[_0xbe2a('0x1e')])[_0xbe2a('0x1f')](JSON['parse'](_0x186225));}});});_0x582dd3['on']('error',function(_0x55c802){if(_0xa9ee94){return _0xa9ee94[_0xbe2a('0x1d')](0x1f4)[_0xbe2a('0x1f')]({'errors':[{'message':_0xbe2a('0x20'),'type':'api.jira'}]});}});_0x582dd3[_0xbe2a('0x21')](_0x2a3f33);_0x582dd3[_0xbe2a('0x1c')]();}exports[_0xbe2a('0x22')]=openIssue;exports[_0xbe2a('0x23')]=function(_0x1be343,_0x2a0d23){_0x1be343[_0xbe2a('0x24')]['ip']=_0x1be343[_0xbe2a('0x25')]['x-forwarded-for']||_0x1be343[_0xbe2a('0x26')][_0xbe2a('0x27')]||_0x1be343[_0xbe2a('0x28')][_0xbe2a('0x27')]||_0x1be343['connection']['socket'][_0xbe2a('0x27')];return openIssue(_0x1be343[_0xbe2a('0x24')],_0x2a0d23);}; \ No newline at end of file +var _0x654e=['Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','setEncoding','utf8','data','end','status','statusCode','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','body','headers','x-forwarded-for','connection','socket','remoteAddress','bluebird','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','\x20from\x20','description','stringify'];(function(_0x5e48f8,_0x54ea70){var _0x15f1da=function(_0x2ae67f){while(--_0x2ae67f){_0x5e48f8['push'](_0x5e48f8['shift']());}};_0x15f1da(++_0x54ea70);}(_0x654e,0x137));var _0xe654=function(_0x55b037,_0x2d9392){_0x55b037=_0x55b037-0x0;var _0x5f1053=_0x654e[_0x55b037];return _0x5f1053;};'use strict';var BPromise=require(_0xe654('0x0'));var https=require(_0xe654('0x1'));var logger=require('../../config/logger')(_0xe654('0x2'));var USERNAME=_0xe654('0x3');var PASSWORD=_0xe654('0x4');function openIssue(_0x575e34,_0x4953ae){var _0x356324={'fields':{'project':{'key':_0x575e34[_0xe654('0x5')]||_0xe654('0x6')},'summary':(_0x575e34['summary']||_0xe654('0x7'))+_0xe654('0x8')+_0x575e34['ip'],'description':_0x575e34[_0xe654('0x9')]||JSON[_0xe654('0xa')](_0x575e34),'issuetype':{'name':_0x575e34['issuetype']||_0xe654('0xb')}}};_0x356324[_0xe654('0xc')][_0xe654('0xd')]=_0x575e34[_0xe654('0xe')];_0x356324['fields'][_0xe654('0xf')]=_0x575e34[_0xe654('0x10')];_0x356324['fields']['customfield_11502']=_0x575e34[_0xe654('0x11')];_0x356324[_0xe654('0xc')]['customfield_11503']=_0x575e34[_0xe654('0x12')];_0x356324['fields'][_0xe654('0x13')]=_0x575e34[_0xe654('0x14')];_0x356324[_0xe654('0xc')][_0xe654('0x15')]=_0x575e34['ip'];var _0x474124={'host':_0xe654('0x16'),'port':0x1bb,'path':_0xe654('0x17'),'method':_0xe654('0x18'),'timeout':0x4e20,'headers':{'Content-Type':_0xe654('0x19'),'Authorization':_0xe654('0x1a')+new Buffer(USERNAME+':'+PASSWORD)['toString']('base64')}};var _0x3878ee=JSON[_0xe654('0xa')](_0x356324);var _0x5f4b9f=https['request'](_0x474124,function(_0x145fb7){_0x145fb7[_0xe654('0x1b')](_0xe654('0x1c'));var _0x778810='';_0x145fb7['on'](_0xe654('0x1d'),function(_0x3d0084){_0x778810+=_0x3d0084;});_0x145fb7['on'](_0xe654('0x1e'),function(){if(_0x4953ae){return _0x4953ae[_0xe654('0x1f')](_0x145fb7[_0xe654('0x20')])[_0xe654('0x21')](JSON[_0xe654('0x22')](_0x778810));}});});_0x5f4b9f['on'](_0xe654('0x23'),function(_0x12e064){if(_0x4953ae){return _0x4953ae['status'](0x1f4)[_0xe654('0x21')]({'errors':[{'message':_0xe654('0x24'),'type':_0xe654('0x25')}]});}});_0x5f4b9f[_0xe654('0x26')](_0x3878ee);_0x5f4b9f[_0xe654('0x1e')]();}exports[_0xe654('0x27')]=openIssue;exports['send']=function(_0x3cb557,_0x47c45b){_0x3cb557[_0xe654('0x28')]['ip']=_0x3cb557[_0xe654('0x29')][_0xe654('0x2a')]||_0x3cb557[_0xe654('0x2b')]['remoteAddress']||_0x3cb557[_0xe654('0x2c')][_0xe654('0x2d')]||_0x3cb557[_0xe654('0x2b')][_0xe654('0x2c')]['remoteAddress'];return openIssue(_0x3cb557['body'],_0x47c45b);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index 68541fa..6162695 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 _0x9677=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','update','delete'];(function(_0x2bcd6b,_0x4d4e1a){var _0x59f389=function(_0x30ff0e){while(--_0x30ff0e){_0x2bcd6b['push'](_0x2bcd6b['shift']());}};_0x59f389(++_0x4d4e1a);}(_0x9677,0x190));var _0x7967=function(_0x3d0016,_0x4a37e0){_0x3d0016=_0x3d0016-0x0;var _0x1dcb28=_0x9677[_0x3d0016];return _0x1dcb28;};'use strict';var multer=require(_0x7967('0x0'));var util=require(_0x7967('0x1'));var path=require(_0x7967('0x2'));var timeout=require(_0x7967('0x3'));var express=require(_0x7967('0x4'));var router=express[_0x7967('0x5')]();var auth=require(_0x7967('0x6'));var interaction=require(_0x7967('0x7'));var config=require(_0x7967('0x8'));var controller=require(_0x7967('0x9'));router[_0x7967('0xa')]('/',auth[_0x7967('0xb')](),controller[_0x7967('0xc')]);router[_0x7967('0xa')](_0x7967('0xd'),auth['isAuthenticated'](),controller[_0x7967('0xe')]);router[_0x7967('0xa')](_0x7967('0xf'),auth[_0x7967('0xb')](),controller[_0x7967('0x10')]);router[_0x7967('0x11')]('/',auth[_0x7967('0xb')](),controller['create']);router['put'](_0x7967('0xf'),auth['isAuthenticated'](),controller[_0x7967('0x12')]);router[_0x7967('0x13')](_0x7967('0xf'),auth[_0x7967('0xb')](),controller[_0x7967('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3c1f=['../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','describe','show','create','put','update','delete','/:id','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x373dee,_0x1a8c45){var _0x46798f=function(_0xc389f0){while(--_0xc389f0){_0x373dee['push'](_0x373dee['shift']());}};_0x46798f(++_0x1a8c45);}(_0x3c1f,0x82));var _0xf3c1=function(_0x463b47,_0x29a803){_0x463b47=_0x463b47-0x0;var _0x441f33=_0x3c1f[_0x463b47];return _0x441f33;};'use strict';var multer=require(_0xf3c1('0x0'));var util=require('util');var path=require(_0xf3c1('0x1'));var timeout=require(_0xf3c1('0x2'));var express=require('express');var router=express[_0xf3c1('0x3')]();var auth=require(_0xf3c1('0x4'));var interaction=require(_0xf3c1('0x5'));var config=require(_0xf3c1('0x6'));var controller=require(_0xf3c1('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xf3c1('0x8')]('/describe',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xa')]);router[_0xf3c1('0x8')]('/:id',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xb')]);router['post']('/',auth[_0xf3c1('0x9')](),controller[_0xf3c1('0xc')]);router[_0xf3c1('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xf3c1('0xe')]);router[_0xf3c1('0xf')](_0xf3c1('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 86054f1..ee24631 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 _0x4cbf=['exports','STRING','TEXT','long','sequelize'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x4cbf,0x15d));var _0xf4cb=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x4cbf[_0x4243a3];return _0x1b2a33;};'use strict';var Sequelize=require(_0xf4cb('0x0'));module[_0xf4cb('0x1')]={'question':{'type':Sequelize[_0xf4cb('0x2')]},'answer':{'type':Sequelize[_0xf4cb('0x3')](_0xf4cb('0x4'))},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0xf4cb('0x2')]},'queue':{'type':Sequelize[_0xf4cb('0x2')]},'uniqueid':{'type':Sequelize[_0xf4cb('0x2')]},'calleridname':{'type':Sequelize[_0xf4cb('0x2')]},'calleridnum':{'type':Sequelize[_0xf4cb('0x2')]},'questionId':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x707e=['TEXT','long','STRING','sequelize'];(function(_0x456bd2,_0x156c79){var _0x2218c1=function(_0x44f2d4){while(--_0x44f2d4){_0x456bd2['push'](_0x456bd2['shift']());}};_0x2218c1(++_0x156c79);}(_0x707e,0x197));var _0xe707=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x707e[_0xa8883];return _0x479426;};'use strict';var Sequelize=require(_0xe707('0x0'));module['exports']={'question':{'type':Sequelize['STRING']},'answer':{'type':Sequelize[_0xe707('0x1')](_0xe707('0x2'))},'membername':{'type':Sequelize[_0xe707('0x3')]},'projectname':{'type':Sequelize[_0xe707('0x3')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xe707('0x3')]},'questionId':{'type':Sequelize[_0xe707('0x3')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index d198ec0..57f504a 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 _0x2186=['intersection','hasOwnProperty','order','where','filters','pick','filter','merge','map','type','VIRTUAL','options','JscriptyAnswerReport','include','findAll','rows','show','params','fields','length','includeAll','find','catch','create','body','describe','html-pdf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','rawAttributes','fieldName','key','model','query','keys','attributes'];(function(_0x3ea03d,_0x383d79){var _0x54d96e=function(_0x10885d){while(--_0x10885d){_0x3ea03d['push'](_0x3ea03d['shift']());}};_0x54d96e(++_0x383d79);}(_0x2186,0x1ca));var _0x6218=function(_0x47c51c,_0x52288d){_0x47c51c=_0x47c51c-0x0;var _0x54a573=_0x2186[_0x47c51c];return _0x54a573;};'use strict';var pdf=require(_0x6218('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6218('0x1'));var rp=require(_0x6218('0x2'));var moment=require(_0x6218('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6218('0x4'));var util=require(_0x6218('0x5'));var path=require(_0x6218('0x6'));var sox=require(_0x6218('0x7'));var csv=require(_0x6218('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6218('0x9'));var jsforce=require(_0x6218('0xa'));var deskjs=require(_0x6218('0xb'));var toCsv=require(_0x6218('0x8'));var querystring=require(_0x6218('0xc'));var Papa=require('papaparse');var Redis=require(_0x6218('0xd'));var authService=require(_0x6218('0xe'));var qs=require(_0x6218('0xf'));var as=require(_0x6218('0x10'));var hardwareService=require(_0x6218('0x11'));var logger=require(_0x6218('0x12'))(_0x6218('0x13'));var utils=require('../../config/utils');var config=require(_0x6218('0x14'));var db=require(_0x6218('0x15'))['db'];function respondWithStatusCode(_0x377ba0,_0x432b92){_0x432b92=_0x432b92||0xcc;return function(_0x4e4c17){if(_0x4e4c17){return _0x377ba0['sendStatus'](_0x432b92);}return _0x377ba0['status'](_0x432b92)['end']();};}function respondWithResult(_0x9f6712,_0x3903d9){_0x3903d9=_0x3903d9||0xc8;return function(_0x4d2516){if(_0x4d2516){return _0x9f6712[_0x6218('0x16')](_0x3903d9)[_0x6218('0x17')](_0x4d2516);}};}function respondWithFilteredResult(_0x50e912,_0x3ec76a){return function(_0x297eaf){if(_0x297eaf){var _0x20143e=_0x297eaf[_0x6218('0x18')],_0xe78e18=_0x3ec76a[_0x6218('0x19')],_0x4faec9=_0x3ec76a[_0x6218('0x19')]+_0x3ec76a[_0x6218('0x1a')],_0x44f37d;if(_0x4faec9>=_0x20143e){_0x4faec9=_0x20143e;_0x44f37d=0xc8;}else{_0x44f37d=0xce;}_0x50e912['status'](_0x44f37d);return _0x50e912[_0x6218('0x1b')](_0x6218('0x1c'),_0xe78e18+'-'+_0x4faec9+'/'+_0x20143e)['json'](_0x297eaf);}return null;};}function patchUpdates(_0x31370c){return function(_0x151abf){try{jsonpatch['apply'](_0x151abf,_0x31370c,!![]);}catch(_0x2f35fc){return BPromise[_0x6218('0x1d')](_0x2f35fc);}return _0x151abf[_0x6218('0x1e')]();};}function saveUpdates(_0x55cd01,_0x535d48){return function(_0xf9b6){if(_0xf9b6){return _0xf9b6[_0x6218('0x1f')](_0x55cd01)[_0x6218('0x20')](function(_0x55febb){return _0x55febb;});}return null;};}function removeEntity(_0x58732a,_0x4c84f8){return function(_0x12e59e){if(_0x12e59e){return _0x12e59e[_0x6218('0x21')]()[_0x6218('0x20')](function(){_0x58732a[_0x6218('0x16')](0xcc)[_0x6218('0x22')]();});}};}function handleEntityNotFound(_0x241ea3,_0x47a4f8){return function(_0x12cb63){if(!_0x12cb63){_0x241ea3['sendStatus'](0x194);}return _0x12cb63;};}function handleError(_0x514f43,_0x499a84){_0x499a84=_0x499a84||0x1f4;return function(_0x52ff19){logger['error'](_0x52ff19[_0x6218('0x23')]);if(_0x52ff19['name']){delete _0x52ff19[_0x6218('0x24')];}_0x514f43['status'](_0x499a84)[_0x6218('0x25')](_0x52ff19);};}exports[_0x6218('0x26')]=function(_0x5704ee,_0x596e67){var _0x59001a={},_0x5e9e2b={},_0x59eeb4={'count':0x0,'rows':[]};var _0x716b33=_['map'](db['JscriptyAnswerReport'][_0x6218('0x27')],function(_0x2fd870){return{'name':_0x2fd870[_0x6218('0x28')],'type':_0x2fd870['type'][_0x6218('0x29')]};});_0x5e9e2b[_0x6218('0x2a')]=_['map'](_0x716b33,'name');_0x5e9e2b[_0x6218('0x2b')]=_[_0x6218('0x2c')](_0x5704ee[_0x6218('0x2b')]);_0x5e9e2b['filters']=_['intersection'](_0x5e9e2b[_0x6218('0x2a')],_0x5e9e2b[_0x6218('0x2b')]);_0x59001a[_0x6218('0x2d')]=_[_0x6218('0x2e')](_0x5e9e2b['model'],qs['fields'](_0x5704ee['query']['fields']));_0x59001a[_0x6218('0x2d')]=_0x59001a['attributes']['length']?_0x59001a[_0x6218('0x2d')]:_0x5e9e2b[_0x6218('0x2a')];if(!_0x5704ee[_0x6218('0x2b')][_0x6218('0x2f')]('nolimit')){_0x59001a[_0x6218('0x1a')]=qs[_0x6218('0x1a')](_0x5704ee[_0x6218('0x2b')]['limit']);_0x59001a[_0x6218('0x19')]=qs[_0x6218('0x19')](_0x5704ee[_0x6218('0x2b')][_0x6218('0x19')]);}_0x59001a[_0x6218('0x30')]=qs['sort'](_0x5704ee[_0x6218('0x2b')]['sort']);_0x59001a[_0x6218('0x31')]=qs[_0x6218('0x32')](_[_0x6218('0x33')](_0x5704ee['query'],_0x5e9e2b[_0x6218('0x32')]));if(_0x5704ee[_0x6218('0x2b')][_0x6218('0x34')]){_0x59001a['where']=_[_0x6218('0x35')](_0x59001a['where'],{'$or':_[_0x6218('0x36')](_0x716b33,function(_0x59000e){if(_0x59000e[_0x6218('0x37')]!==_0x6218('0x38')){var _0x4a7722={};_0x4a7722[_0x59000e[_0x6218('0x24')]]={'$like':'%'+_0x5704ee['query'][_0x6218('0x34')]+'%'};return _0x4a7722;}})});}_0x59001a=_[_0x6218('0x35')]({},_0x59001a,_0x5704ee[_0x6218('0x39')]);var _0x46b0bb={'where':_0x59001a[_0x6218('0x31')]};return db[_0x6218('0x3a')][_0x6218('0x18')](_0x46b0bb)[_0x6218('0x20')](function(_0xb8b6cc){_0x59eeb4[_0x6218('0x18')]=_0xb8b6cc;if(_0x5704ee[_0x6218('0x2b')]['includeAll']){_0x59001a[_0x6218('0x3b')]=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x6218('0x3c')](_0x59001a);})['then'](function(_0x4f0886){_0x59eeb4[_0x6218('0x3d')]=_0x4f0886;return _0x59eeb4;})[_0x6218('0x20')](respondWithFilteredResult(_0x596e67,_0x59001a))['catch'](handleError(_0x596e67,null));};exports[_0x6218('0x3e')]=function(_0x2ff8bb,_0x1d30f0){var _0x139b12={'raw':!![],'where':{'id':_0x2ff8bb[_0x6218('0x3f')]['id']}},_0x2755b8={};_0x2755b8['model']=_[_0x6218('0x2c')](db[_0x6218('0x3a')][_0x6218('0x27')]);_0x2755b8[_0x6218('0x2b')]=_[_0x6218('0x2c')](_0x2ff8bb[_0x6218('0x2b')]);_0x2755b8[_0x6218('0x32')]=_[_0x6218('0x2e')](_0x2755b8['model'],_0x2755b8['query']);_0x139b12[_0x6218('0x2d')]=_[_0x6218('0x2e')](_0x2755b8[_0x6218('0x2a')],qs[_0x6218('0x40')](_0x2ff8bb[_0x6218('0x2b')][_0x6218('0x40')]));_0x139b12['attributes']=_0x139b12['attributes'][_0x6218('0x41')]?_0x139b12[_0x6218('0x2d')]:_0x2755b8[_0x6218('0x2a')];if(_0x2ff8bb['query'][_0x6218('0x42')]){_0x139b12['include']=[{'all':!![]}];}_0x139b12=_[_0x6218('0x35')]({},_0x139b12,_0x2ff8bb[_0x6218('0x39')]);return db[_0x6218('0x3a')][_0x6218('0x43')](_0x139b12)[_0x6218('0x20')](handleEntityNotFound(_0x1d30f0,null))[_0x6218('0x20')](respondWithResult(_0x1d30f0,null))[_0x6218('0x44')](handleError(_0x1d30f0,null));};exports[_0x6218('0x45')]=function(_0x3e695b,_0x49d042){return db['JscriptyAnswerReport']['create'](_0x3e695b[_0x6218('0x46')],{})[_0x6218('0x20')](respondWithResult(_0x49d042,0xc9))[_0x6218('0x44')](handleError(_0x49d042,null));};exports[_0x6218('0x1f')]=function(_0x47ca3a,_0x5d3983){if(_0x47ca3a[_0x6218('0x46')]['id']){delete _0x47ca3a[_0x6218('0x46')]['id'];}return db['JscriptyAnswerReport'][_0x6218('0x43')]({'where':{'id':_0x47ca3a[_0x6218('0x3f')]['id']}})[_0x6218('0x20')](handleEntityNotFound(_0x5d3983,null))[_0x6218('0x20')](saveUpdates(_0x47ca3a['body'],null))[_0x6218('0x20')](respondWithResult(_0x5d3983,null))[_0x6218('0x44')](handleError(_0x5d3983,null));};exports[_0x6218('0x21')]=function(_0x13ebb1,_0x94519b){return db['JscriptyAnswerReport'][_0x6218('0x43')]({'where':{'id':_0x13ebb1['params']['id']}})['then'](handleEntityNotFound(_0x94519b,null))[_0x6218('0x20')](removeEntity(_0x94519b,null))[_0x6218('0x44')](handleError(_0x94519b,null));};exports[_0x6218('0x47')]=function(_0x39472a,_0x1caf0a){return db[_0x6218('0x3a')][_0x6218('0x47')]()[_0x6218('0x20')](respondWithResult(_0x1caf0a,null))[_0x6218('0x44')](handleError(_0x1caf0a,null));}; \ No newline at end of file +var _0x68fd=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','intersection','create','body','find','destroy','describe','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','then','sendStatus','error','stack','name','send','index','JscriptyAnswerReport','rawAttributes','type','model','query','keys','filters'];(function(_0x3c4828,_0x546d02){var _0x5149c2=function(_0x2a827a){while(--_0x2a827a){_0x3c4828['push'](_0x3c4828['shift']());}};_0x5149c2(++_0x546d02);}(_0x68fd,0x1e9));var _0xd68f=function(_0x17764b,_0x61931d){_0x17764b=_0x17764b-0x0;var _0x1a3b1b=_0x68fd[_0x17764b];return _0x1a3b1b;};'use strict';var pdf=require(_0xd68f('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd68f('0x1'));var zipdir=require(_0xd68f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd68f('0x3'));var moment=require(_0xd68f('0x4'));var BPromise=require(_0xd68f('0x5'));var Mustache=require(_0xd68f('0x6'));var util=require(_0xd68f('0x7'));var path=require(_0xd68f('0x8'));var sox=require(_0xd68f('0x9'));var csv=require(_0xd68f('0xa'));var ejs=require(_0xd68f('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd68f('0xc'));var crypto=require(_0xd68f('0xd'));var jsforce=require(_0xd68f('0xe'));var deskjs=require(_0xd68f('0xf'));var toCsv=require(_0xd68f('0xa'));var querystring=require(_0xd68f('0x10'));var Papa=require(_0xd68f('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd68f('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd68f('0x13'));var logger=require(_0xd68f('0x14'))(_0xd68f('0x15'));var utils=require(_0xd68f('0x16'));var config=require(_0xd68f('0x17'));var db=require(_0xd68f('0x18'))['db'];function respondWithStatusCode(_0x1943e8,_0x52601f){_0x52601f=_0x52601f||0xcc;return function(_0x518883){if(_0x518883){return _0x1943e8['sendStatus'](_0x52601f);}return _0x1943e8['status'](_0x52601f)[_0xd68f('0x19')]();};}function respondWithResult(_0x305c19,_0x48f357){_0x48f357=_0x48f357||0xc8;return function(_0x9dbc9b){if(_0x9dbc9b){return _0x305c19[_0xd68f('0x1a')](_0x48f357)[_0xd68f('0x1b')](_0x9dbc9b);}};}function respondWithFilteredResult(_0x36441f,_0x3a5bb2){return function(_0x9a7fc6){if(_0x9a7fc6){var _0x203b3c=_0x9a7fc6['count'],_0x53aed0=_0x3a5bb2[_0xd68f('0x1c')],_0x1ba1ce=_0x3a5bb2[_0xd68f('0x1c')]+_0x3a5bb2[_0xd68f('0x1d')],_0x4946bd;if(_0x1ba1ce>=_0x203b3c){_0x1ba1ce=_0x203b3c;_0x4946bd=0xc8;}else{_0x4946bd=0xce;}_0x36441f[_0xd68f('0x1a')](_0x4946bd);return _0x36441f[_0xd68f('0x1e')](_0xd68f('0x1f'),_0x53aed0+'-'+_0x1ba1ce+'/'+_0x203b3c)[_0xd68f('0x1b')](_0x9a7fc6);}return null;};}function patchUpdates(_0x47fdbc){return function(_0x59efc5){try{jsonpatch[_0xd68f('0x20')](_0x59efc5,_0x47fdbc,!![]);}catch(_0x22be19){return BPromise[_0xd68f('0x21')](_0x22be19);}return _0x59efc5[_0xd68f('0x22')]();};}function saveUpdates(_0x24065d,_0x4c192f){return function(_0x17d291){if(_0x17d291){return _0x17d291[_0xd68f('0x23')](_0x24065d)[_0xd68f('0x24')](function(_0x4e00c0){return _0x4e00c0;});}return null;};}function removeEntity(_0x464238,_0x1379e2){return function(_0xeba444){if(_0xeba444){return _0xeba444['destroy']()['then'](function(){_0x464238[_0xd68f('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x563cd3,_0x3cf02f){return function(_0x1ef099){if(!_0x1ef099){_0x563cd3[_0xd68f('0x25')](0x194);}return _0x1ef099;};}function handleError(_0x3f11f9,_0x4595bf){_0x4595bf=_0x4595bf||0x1f4;return function(_0x434fde){logger[_0xd68f('0x26')](_0x434fde[_0xd68f('0x27')]);if(_0x434fde[_0xd68f('0x28')]){delete _0x434fde[_0xd68f('0x28')];}_0x3f11f9[_0xd68f('0x1a')](_0x4595bf)[_0xd68f('0x29')](_0x434fde);};}exports[_0xd68f('0x2a')]=function(_0x5042a3,_0x5f35b9){var _0x2c22bf={},_0x4b1515={},_0x39b64b={'count':0x0,'rows':[]};var _0x5412d7=_['map'](db[_0xd68f('0x2b')][_0xd68f('0x2c')],function(_0x1eaebc){return{'name':_0x1eaebc['fieldName'],'type':_0x1eaebc[_0xd68f('0x2d')]['key']};});_0x4b1515[_0xd68f('0x2e')]=_['map'](_0x5412d7,_0xd68f('0x28'));_0x4b1515[_0xd68f('0x2f')]=_[_0xd68f('0x30')](_0x5042a3[_0xd68f('0x2f')]);_0x4b1515[_0xd68f('0x31')]=_['intersection'](_0x4b1515[_0xd68f('0x2e')],_0x4b1515['query']);_0x2c22bf[_0xd68f('0x32')]=_['intersection'](_0x4b1515[_0xd68f('0x2e')],qs[_0xd68f('0x33')](_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x33')]));_0x2c22bf['attributes']=_0x2c22bf[_0xd68f('0x32')][_0xd68f('0x34')]?_0x2c22bf[_0xd68f('0x32')]:_0x4b1515[_0xd68f('0x2e')];if(!_0x5042a3['query'][_0xd68f('0x35')](_0xd68f('0x36'))){_0x2c22bf[_0xd68f('0x1d')]=qs[_0xd68f('0x1d')](_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x1d')]);_0x2c22bf[_0xd68f('0x1c')]=qs[_0xd68f('0x1c')](_0x5042a3['query'][_0xd68f('0x1c')]);}_0x2c22bf[_0xd68f('0x37')]=qs[_0xd68f('0x38')](_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x38')]);_0x2c22bf[_0xd68f('0x39')]=qs[_0xd68f('0x31')](_[_0xd68f('0x3a')](_0x5042a3['query'],_0x4b1515[_0xd68f('0x31')]));if(_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x3b')]){_0x2c22bf[_0xd68f('0x39')]=_[_0xd68f('0x3c')](_0x2c22bf['where'],{'$or':_[_0xd68f('0x3d')](_0x5412d7,function(_0x297102){if(_0x297102[_0xd68f('0x2d')]!==_0xd68f('0x3e')){var _0x6a987b={};_0x6a987b[_0x297102[_0xd68f('0x28')]]={'$like':'%'+_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x3b')]+'%'};return _0x6a987b;}})});}_0x2c22bf=_['merge']({},_0x2c22bf,_0x5042a3[_0xd68f('0x3f')]);var _0x23216e={'where':_0x2c22bf[_0xd68f('0x39')]};return db[_0xd68f('0x2b')][_0xd68f('0x40')](_0x23216e)[_0xd68f('0x24')](function(_0x4fa7bd){_0x39b64b[_0xd68f('0x40')]=_0x4fa7bd;if(_0x5042a3[_0xd68f('0x2f')][_0xd68f('0x41')]){_0x2c22bf[_0xd68f('0x42')]=[{'all':!![]}];}return db[_0xd68f('0x2b')][_0xd68f('0x43')](_0x2c22bf);})['then'](function(_0x6c1d78){_0x39b64b[_0xd68f('0x44')]=_0x6c1d78;return _0x39b64b;})['then'](respondWithFilteredResult(_0x5f35b9,_0x2c22bf))[_0xd68f('0x45')](handleError(_0x5f35b9,null));};exports['show']=function(_0x5255f7,_0x226088){var _0x2016f1={'raw':!![],'where':{'id':_0x5255f7[_0xd68f('0x46')]['id']}},_0x586046={};_0x586046[_0xd68f('0x2e')]=_['keys'](db[_0xd68f('0x2b')][_0xd68f('0x2c')]);_0x586046[_0xd68f('0x2f')]=_[_0xd68f('0x30')](_0x5255f7['query']);_0x586046['filters']=_['intersection'](_0x586046[_0xd68f('0x2e')],_0x586046[_0xd68f('0x2f')]);_0x2016f1[_0xd68f('0x32')]=_[_0xd68f('0x47')](_0x586046[_0xd68f('0x2e')],qs[_0xd68f('0x33')](_0x5255f7[_0xd68f('0x2f')][_0xd68f('0x33')]));_0x2016f1[_0xd68f('0x32')]=_0x2016f1[_0xd68f('0x32')][_0xd68f('0x34')]?_0x2016f1['attributes']:_0x586046['model'];if(_0x5255f7[_0xd68f('0x2f')][_0xd68f('0x41')]){_0x2016f1[_0xd68f('0x42')]=[{'all':!![]}];}_0x2016f1=_[_0xd68f('0x3c')]({},_0x2016f1,_0x5255f7[_0xd68f('0x3f')]);return db[_0xd68f('0x2b')]['find'](_0x2016f1)[_0xd68f('0x24')](handleEntityNotFound(_0x226088,null))[_0xd68f('0x24')](respondWithResult(_0x226088,null))[_0xd68f('0x45')](handleError(_0x226088,null));};exports[_0xd68f('0x48')]=function(_0x3ae632,_0x309bfd){return db['JscriptyAnswerReport'][_0xd68f('0x48')](_0x3ae632[_0xd68f('0x49')],{})[_0xd68f('0x24')](respondWithResult(_0x309bfd,0xc9))[_0xd68f('0x45')](handleError(_0x309bfd,null));};exports[_0xd68f('0x23')]=function(_0x314c18,_0x34bdc6){if(_0x314c18[_0xd68f('0x49')]['id']){delete _0x314c18[_0xd68f('0x49')]['id'];}return db['JscriptyAnswerReport'][_0xd68f('0x4a')]({'where':{'id':_0x314c18[_0xd68f('0x46')]['id']}})[_0xd68f('0x24')](handleEntityNotFound(_0x34bdc6,null))['then'](saveUpdates(_0x314c18[_0xd68f('0x49')],null))[_0xd68f('0x24')](respondWithResult(_0x34bdc6,null))[_0xd68f('0x45')](handleError(_0x34bdc6,null));};exports[_0xd68f('0x4b')]=function(_0x2dc117,_0x479680){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x2dc117[_0xd68f('0x46')]['id']}})[_0xd68f('0x24')](handleEntityNotFound(_0x479680,null))['then'](removeEntity(_0x479680,null))[_0xd68f('0x45')](handleError(_0x479680,null));};exports[_0xd68f('0x4c')]=function(_0x23a129,_0x25f66d){return db[_0xd68f('0x2b')][_0xd68f('0x4c')]()[_0xd68f('0x24')](respondWithResult(_0x25f66d,null))[_0xd68f('0x45')](handleError(_0x25f66d,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index bf13bc9..6c5876c 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 _0xfdd8=['define','lodash','moment','bluebird','request-promise','path','../../config/environment','./jscriptyAnswerReport.attributes','exports'];(function(_0x38ccc,_0x14f7d6){var _0x4c9ca0=function(_0x1095dd){while(--_0x1095dd){_0x38ccc['push'](_0x38ccc['shift']());}};_0x4c9ca0(++_0x14f7d6);}(_0xfdd8,0x169));var _0x8fdd=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfdd8[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x8fdd('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8fdd('0x1'));var BPromise=require(_0x8fdd('0x2'));var rp=require(_0x8fdd('0x3'));var fs=require('fs');var path=require(_0x8fdd('0x4'));var rimraf=require('rimraf');var config=require(_0x8fdd('0x5'));var attributes=require(_0x8fdd('0x6'));module[_0x8fdd('0x7')]=function(_0x263e68,_0x541ce3){return _0x263e68[_0x8fdd('0x8')]('JscriptyAnswerReport',attributes,{'tableName':'report_jscripty_answers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8f7=['../../config/environment','./jscriptyAnswerReport.attributes','define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf'];(function(_0x2aa48b,_0x5a4446){var _0x48caf8=function(_0x13230c){while(--_0x13230c){_0x2aa48b['push'](_0x2aa48b['shift']());}};_0x48caf8(++_0x5a4446);}(_0xd8f7,0x155));var _0x7d8f=function(_0x413699,_0x314776){_0x413699=_0x413699-0x0;var _0xc9b7d4=_0xd8f7[_0x413699];return _0xc9b7d4;};'use strict';var _=require(_0x7d8f('0x0'));var util=require(_0x7d8f('0x1'));var logger=require(_0x7d8f('0x2'))('api');var moment=require('moment');var BPromise=require(_0x7d8f('0x3'));var rp=require(_0x7d8f('0x4'));var fs=require('fs');var path=require(_0x7d8f('0x5'));var rimraf=require(_0x7d8f('0x6'));var config=require(_0x7d8f('0x7'));var attributes=require(_0x7d8f('0x8'));module['exports']=function(_0x121885,_0x139551){return _0x121885[_0x7d8f('0x9')](_0x7d8f('0xa'),attributes,{'tableName':_0x7d8f('0xb'),'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 3ca4d00..a3086d4 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 _0x797c=['client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0x797c,0x81));var _0xc797=function(_0x492af5,_0xd51471){_0x492af5=_0x492af5-0x0;var _0x59f529=_0x797c[_0x492af5];return _0x59f529;};'use strict';var _=require('lodash');var util=require(_0xc797('0x0'));var moment=require('moment');var BPromise=require(_0xc797('0x1'));var rs=require(_0xc797('0x2'));var fs=require('fs');var Redis=require(_0xc797('0x3'));var db=require(_0xc797('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc797('0x5'))(_0xc797('0x6'));var config=require(_0xc797('0x7'));var jayson=require(_0xc797('0x8'));var client=jayson[_0xc797('0x9')][_0xc797('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x115b5a,_0x2ed6f8,_0x4f0042){return new BPromise(function(_0x102ac2,_0xde6ad4){return client[_0xc797('0xb')](_0x115b5a,_0x4f0042)[_0xc797('0xc')](function(_0x3d56fd){logger[_0xc797('0xd')](_0xc797('0xe'),_0x2ed6f8,'request\x20sent');logger[_0xc797('0xf')](_0xc797('0x10'),_0x2ed6f8,_0xc797('0x11'),JSON[_0xc797('0x12')](_0x3d56fd));if(_0x3d56fd[_0xc797('0x13')]){if(_0x3d56fd[_0xc797('0x13')][_0xc797('0x14')]===0x1f4){logger[_0xc797('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x2ed6f8,_0x3d56fd[_0xc797('0x13')][_0xc797('0x15')]);return _0xde6ad4(_0x3d56fd[_0xc797('0x13')][_0xc797('0x15')]);}logger[_0xc797('0x13')](_0xc797('0xe'),_0x2ed6f8,_0x3d56fd[_0xc797('0x13')][_0xc797('0x15')]);return _0x102ac2(_0x3d56fd[_0xc797('0x13')][_0xc797('0x15')]);}else{logger[_0xc797('0xd')](_0xc797('0xe'),_0x2ed6f8,_0xc797('0x11'));_0x102ac2(_0x3d56fd[_0xc797('0x16')]['message']);}})['catch'](function(_0x304044){logger[_0xc797('0x13')](_0xc797('0xe'),_0x2ed6f8,_0x304044);_0xde6ad4(_0x304044);});});} \ No newline at end of file +var _0x1340=['jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x4ad9f4,_0x38cb56){var _0x2add44=function(_0x4e9f82){while(--_0x4e9f82){_0x4ad9f4['push'](_0x4ad9f4['shift']());}};_0x2add44(++_0x38cb56);}(_0x1340,0x10d));var _0x0134=function(_0x191f62,_0x3e1fa2){_0x191f62=_0x191f62-0x0;var _0x406a25=_0x1340[_0x191f62];return _0x406a25;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0134('0x0'));var BPromise=require('bluebird');var rs=require(_0x0134('0x1'));var fs=require('fs');var Redis=require(_0x0134('0x2'));var db=require(_0x0134('0x3'))['db'];var utils=require(_0x0134('0x4'));var logger=require(_0x0134('0x5'))('rpc');var config=require(_0x0134('0x6'));var jayson=require(_0x0134('0x7'));var client=jayson[_0x0134('0x8')][_0x0134('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x9839b6,_0x37fbc6,_0x5f44fa){return new BPromise(function(_0x1639d5,_0x6c58b3){return client[_0x0134('0xa')](_0x9839b6,_0x5f44fa)[_0x0134('0xb')](function(_0x416764){logger[_0x0134('0xc')](_0x0134('0xd'),_0x37fbc6,'request\x20sent');logger[_0x0134('0xe')](_0x0134('0xf'),_0x37fbc6,_0x0134('0x10'),JSON[_0x0134('0x11')](_0x416764));if(_0x416764[_0x0134('0x12')]){if(_0x416764[_0x0134('0x12')][_0x0134('0x13')]===0x1f4){logger[_0x0134('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x37fbc6,_0x416764[_0x0134('0x12')][_0x0134('0x14')]);return _0x6c58b3(_0x416764[_0x0134('0x12')][_0x0134('0x14')]);}logger[_0x0134('0x12')](_0x0134('0xd'),_0x37fbc6,_0x416764[_0x0134('0x12')][_0x0134('0x14')]);return _0x1639d5(_0x416764[_0x0134('0x12')][_0x0134('0x14')]);}else{logger[_0x0134('0xc')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x37fbc6,_0x0134('0x10'));_0x1639d5(_0x416764[_0x0134('0x15')][_0x0134('0x14')]);}})[_0x0134('0x16')](function(_0x417809){logger[_0x0134('0x12')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x37fbc6,_0x417809);_0x6c58b3(_0x417809);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 1f164db..c2f7467 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 _0x19bf=['show','/:id/sessions','getSessions','/:id/answers','getAnswers','30s','getSummary','post','create','/:id/clone','clone','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x4e1211,_0x1c0e26){var _0x4ae887=function(_0x6e55ff){while(--_0x6e55ff){_0x4e1211['push'](_0x4e1211['shift']());}};_0x4ae887(++_0x1c0e26);}(_0x19bf,0x16f));var _0xf19b=function(_0x1e1a6f,_0x1fe407){_0x1e1a6f=_0x1e1a6f-0x0;var _0x42d992=_0x19bf[_0x1e1a6f];return _0x42d992;};'use strict';var multer=require(_0xf19b('0x0'));var util=require(_0xf19b('0x1'));var path=require(_0xf19b('0x2'));var timeout=require(_0xf19b('0x3'));var express=require(_0xf19b('0x4'));var router=express['Router']();var auth=require(_0xf19b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf19b('0x6'));var controller=require('./jscriptyProject.controller');router[_0xf19b('0x7')]('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0x9')]);router[_0xf19b('0x7')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xb')]);router['get'](_0xf19b('0xc'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xd')]);router[_0xf19b('0x7')](_0xf19b('0xe'),auth[_0xf19b('0x8')](),controller[_0xf19b('0xf')]);router['get']('/:id/summary',auth['isAuthenticated'](),timeout(_0xf19b('0x10')),controller[_0xf19b('0x11')]);router[_0xf19b('0x12')]('/',auth[_0xf19b('0x8')](),controller[_0xf19b('0x13')]);router[_0xf19b('0x12')](_0xf19b('0x14'),auth['isAuthenticated'](),controller[_0xf19b('0x15')]);router[_0xf19b('0x16')](_0xf19b('0xa'),auth[_0xf19b('0x8')](),controller[_0xf19b('0x17')]);router[_0xf19b('0x18')]('/:id',auth[_0xf19b('0x8')](),controller[_0xf19b('0x19')]);module[_0xf19b('0x1a')]=router; \ No newline at end of file +var _0xb107=['update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','isAuthenticated','/:id','/:id/sessions','getSessions','/:id/answers','/:id/summary','30s','getSummary','post','create'];(function(_0x504624,_0x5c80c9){var _0x5b34c0=function(_0x257d52){while(--_0x257d52){_0x504624['push'](_0x504624['shift']());}};_0x5b34c0(++_0x5c80c9);}(_0xb107,0x14e));var _0x7b10=function(_0x44c251,_0x513df9){_0x44c251=_0x44c251-0x0;var _0x12375d=_0xb107[_0x44c251];return _0x12375d;};'use strict';var multer=require(_0x7b10('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x7b10('0x1'));var express=require(_0x7b10('0x2'));var router=express[_0x7b10('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7b10('0x4'));var config=require(_0x7b10('0x5'));var controller=require(_0x7b10('0x6'));router[_0x7b10('0x7')]('/',auth[_0x7b10('0x8')](),controller['index']);router[_0x7b10('0x7')](_0x7b10('0x9'),auth[_0x7b10('0x8')](),controller['show']);router[_0x7b10('0x7')](_0x7b10('0xa'),auth[_0x7b10('0x8')](),controller[_0x7b10('0xb')]);router[_0x7b10('0x7')](_0x7b10('0xc'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x7b10('0xd'),auth[_0x7b10('0x8')](),timeout(_0x7b10('0xe')),controller[_0x7b10('0xf')]);router[_0x7b10('0x10')]('/',auth[_0x7b10('0x8')](),controller[_0x7b10('0x11')]);router['post']('/:id/clone',auth[_0x7b10('0x8')](),controller['clone']);router['put']('/:id',auth[_0x7b10('0x8')](),controller[_0x7b10('0x12')]);router[_0x7b10('0x13')](_0x7b10('0x9'),auth['isAuthenticated'](),controller[_0x7b10('0x14')]);module[_0x7b10('0x15')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index fc2b554..b6f8cea 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 _0x7b3c=['lodash','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','stringify','isString','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize'];(function(_0x484247,_0x19ca9e){var _0x693cfb=function(_0x42cb23){while(--_0x42cb23){_0x484247['push'](_0x484247['shift']());}};_0x693cfb(++_0x19ca9e);}(_0x7b3c,0xef));var _0xc7b3=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x7b3c[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0xc7b3('0x0'));var _=require(_0xc7b3('0x1'));var util=require('util');module[_0xc7b3('0x2')]={'name':{'type':Sequelize[_0xc7b3('0x3')],'unique':_0xc7b3('0x4')},'description':{'type':Sequelize['STRING']},'formData':{'type':Sequelize[_0xc7b3('0x5')](_0xc7b3('0x6')),'set':function(_0x113655){if(_[_0xc7b3('0x7')](_0x113655)){this[_0xc7b3('0x8')](_0xc7b3('0x9'),JSON[_0xc7b3('0xa')](_0x113655));}else if(_[_0xc7b3('0xb')](_0x113655)){this['setDataValue'](_0xc7b3('0x9'),_0x113655);}else{this['setDataValue'](_0xc7b3('0x9'),util['format'](_0xc7b3('0xc'),this[_0xc7b3('0xd')](_0xc7b3('0x4'))||'',this['getDataValue'](_0xc7b3('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xc7b3('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xc7b3('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x3358=['util','exports','STRING','name','TEXT','long','isObjectLike','setDataValue','formData','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash'];(function(_0x587f34,_0x2721b5){var _0x157d40=function(_0x14d676){while(--_0x14d676){_0x587f34['push'](_0x587f34['shift']());}};_0x157d40(++_0x2721b5);}(_0x3358,0x14e));var _0x8335=function(_0x276491,_0x4a196e){_0x276491=_0x276491-0x0;var _0x2904c6=_0x3358[_0x276491];return _0x2904c6;};'use strict';var Sequelize=require(_0x8335('0x0'));var _=require(_0x8335('0x1'));var util=require(_0x8335('0x2'));module[_0x8335('0x3')]={'name':{'type':Sequelize[_0x8335('0x4')],'unique':_0x8335('0x5')},'description':{'type':Sequelize[_0x8335('0x4')]},'formData':{'type':Sequelize[_0x8335('0x6')](_0x8335('0x7')),'set':function(_0x3ef378){if(_[_0x8335('0x8')](_0x3ef378)){this[_0x8335('0x9')](_0x8335('0xa'),JSON['stringify'](_0x3ef378));}else if(_['isString'](_0x3ef378)){this['setDataValue']('formData',_0x3ef378);}else{this[_0x8335('0x9')](_0x8335('0xa'),util[_0x8335('0xb')](_0x8335('0xc'),this[_0x8335('0xd')](_0x8335('0x5'))||'',this[_0x8335('0xd')](_0x8335('0xe'))||''));}}},'enableUncompleteSave':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x8335('0xf')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index 97e6ef4..8344a7d 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 _0x1b83=['findAll','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','push','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','setHeader','Content-type','text/csv','download','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','map','JscriptyProject','rawAttributes','type','key','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','count','include','catch','show','params','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Projects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','role','getSessions','findOne','JscriptySessionReport','pick','ProjectId','rows','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','getSummary','startTime','starttime','JscriptyQuestionReport'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x1b83,0xfc));var _0x31b8=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x1b83[_0x3947c9];return _0x2e7871;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x31b8('0x0'));var rimraf=require(_0x31b8('0x1'));var zipdir=require(_0x31b8('0x2'));var jsonpatch=require(_0x31b8('0x3'));var rp=require(_0x31b8('0x4'));var moment=require(_0x31b8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x31b8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x31b8('0x7'));var ejs=require(_0x31b8('0x8'));var fs=require('fs');var _=require(_0x31b8('0x9'));var squel=require('squel');var crypto=require(_0x31b8('0xa'));var jsforce=require(_0x31b8('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x31b8('0xc'));var Papa=require(_0x31b8('0xd'));var Redis=require(_0x31b8('0xe'));var authService=require(_0x31b8('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x31b8('0x10'));var hardwareService=require(_0x31b8('0x11'));var logger=require(_0x31b8('0x12'))(_0x31b8('0x13'));var utils=require(_0x31b8('0x14'));var config=require(_0x31b8('0x15'));var db=require(_0x31b8('0x16'))['db'];function respondWithStatusCode(_0x24e2dc,_0x1859be){_0x1859be=_0x1859be||0xcc;return function(_0x3d44f6){if(_0x3d44f6){return _0x24e2dc[_0x31b8('0x17')](_0x1859be);}return _0x24e2dc[_0x31b8('0x18')](_0x1859be)[_0x31b8('0x19')]();};}function respondWithResult(_0x225020,_0x34b4da){_0x34b4da=_0x34b4da||0xc8;return function(_0x1a30cc){if(_0x1a30cc){return _0x225020[_0x31b8('0x18')](_0x34b4da)[_0x31b8('0x1a')](_0x1a30cc);}};}function respondWithFilteredResult(_0x256c95,_0x5d5cd4){return function(_0x4582b2){if(_0x4582b2){var _0x4f6217=_0x4582b2['count'],_0xd3b7ab=_0x5d5cd4[_0x31b8('0x1b')],_0xbd5de1=_0x5d5cd4[_0x31b8('0x1b')]+_0x5d5cd4[_0x31b8('0x1c')],_0x219eec;if(_0xbd5de1>=_0x4f6217){_0xbd5de1=_0x4f6217;_0x219eec=0xc8;}else{_0x219eec=0xce;}_0x256c95[_0x31b8('0x18')](_0x219eec);return _0x256c95[_0x31b8('0x1d')](_0x31b8('0x1e'),_0xd3b7ab+'-'+_0xbd5de1+'/'+_0x4f6217)[_0x31b8('0x1a')](_0x4582b2);}return null;};}function patchUpdates(_0x2f8b60){return function(_0x290a15){try{jsonpatch[_0x31b8('0x1f')](_0x290a15,_0x2f8b60,!![]);}catch(_0x564f0e){return BPromise[_0x31b8('0x20')](_0x564f0e);}return _0x290a15[_0x31b8('0x21')]();};}function saveUpdates(_0x4ce0f6,_0x13774a){return function(_0x49e22e){if(_0x49e22e){return _0x49e22e['update'](_0x4ce0f6)['then'](function(_0x2d8d33){return _0x2d8d33;});}return null;};}function removeEntity(_0x32cebb,_0x4fea57){return function(_0x4b131b){if(_0x4b131b){return _0x4b131b['destroy']()[_0x31b8('0x22')](function(){var _0x1543a6=_0x4b131b[_0x31b8('0x23')]({'plain':!![]});var _0x49a5ad='Projects';return db[_0x31b8('0x24')][_0x31b8('0x25')]({'where':{'type':_0x49a5ad,'resourceId':_0x1543a6['id']}})['then'](function(){return _0x4b131b;});})['then'](function(){_0x32cebb[_0x31b8('0x18')](0xcc)[_0x31b8('0x19')]();});}};}function handleEntityNotFound(_0x10ad14,_0x2cc364){return function(_0x2a0cae){if(!_0x2a0cae){_0x10ad14[_0x31b8('0x17')](0x194);}return _0x2a0cae;};}function handleError(_0x5119f7,_0x3228d2){_0x3228d2=_0x3228d2||0x1f4;return function(_0x829f9b){logger[_0x31b8('0x26')](_0x829f9b[_0x31b8('0x27')]);if(_0x829f9b[_0x31b8('0x28')]){delete _0x829f9b[_0x31b8('0x28')];}_0x5119f7[_0x31b8('0x18')](_0x3228d2)[_0x31b8('0x29')](_0x829f9b);};}exports['index']=function(_0x4a5037,_0x3be0c7){var _0x193d27={},_0x5cb169={},_0x562dd2={'count':0x0,'rows':[]};var _0x2e8e88=_[_0x31b8('0x2a')](db[_0x31b8('0x2b')][_0x31b8('0x2c')],function(_0x587bd5){return{'name':_0x587bd5['fieldName'],'type':_0x587bd5[_0x31b8('0x2d')][_0x31b8('0x2e')]};});_0x5cb169[_0x31b8('0x2f')]=_['map'](_0x2e8e88,'name');_0x5cb169['query']=_[_0x31b8('0x30')](_0x4a5037[_0x31b8('0x31')]);_0x5cb169['filters']=_['intersection'](_0x5cb169[_0x31b8('0x2f')],_0x5cb169[_0x31b8('0x31')]);_0x193d27[_0x31b8('0x32')]=_[_0x31b8('0x33')](_0x5cb169[_0x31b8('0x2f')],qs[_0x31b8('0x34')](_0x4a5037[_0x31b8('0x31')]['fields']));_0x193d27[_0x31b8('0x32')]=_0x193d27[_0x31b8('0x32')][_0x31b8('0x35')]?_0x193d27['attributes']:_0x5cb169[_0x31b8('0x2f')];if(!_0x4a5037['query'][_0x31b8('0x36')](_0x31b8('0x37'))){_0x193d27[_0x31b8('0x1c')]=qs[_0x31b8('0x1c')](_0x4a5037[_0x31b8('0x31')][_0x31b8('0x1c')]);_0x193d27[_0x31b8('0x1b')]=qs[_0x31b8('0x1b')](_0x4a5037[_0x31b8('0x31')][_0x31b8('0x1b')]);}_0x193d27[_0x31b8('0x38')]=qs[_0x31b8('0x39')](_0x4a5037['query'][_0x31b8('0x39')]);_0x193d27[_0x31b8('0x3a')]=qs[_0x31b8('0x3b')](_['pick'](_0x4a5037['query'],_0x5cb169[_0x31b8('0x3b')]));if(_0x4a5037['query'][_0x31b8('0x3c')]){_0x193d27[_0x31b8('0x3a')]=_[_0x31b8('0x3d')](_0x193d27[_0x31b8('0x3a')],{'$or':_[_0x31b8('0x2a')](_0x2e8e88,function(_0x1e5285){if(_0x1e5285[_0x31b8('0x2d')]!=='VIRTUAL'){var _0x42821d={};_0x42821d[_0x1e5285[_0x31b8('0x28')]]={'$like':'%'+_0x4a5037[_0x31b8('0x31')][_0x31b8('0x3c')]+'%'};return _0x42821d;}})});}_0x193d27=_[_0x31b8('0x3d')]({},_0x193d27,_0x4a5037[_0x31b8('0x3e')]);var _0x44967c={'where':_0x193d27[_0x31b8('0x3a')]};return db['JscriptyProject'][_0x31b8('0x3f')](_0x44967c)[_0x31b8('0x22')](function(_0x567668){_0x562dd2[_0x31b8('0x3f')]=_0x567668;if(_0x4a5037['query']['includeAll']){_0x193d27[_0x31b8('0x40')]=[{'all':!![]}];}return db[_0x31b8('0x2b')]['findAll'](_0x193d27);})[_0x31b8('0x22')](function(_0x2c2b23){_0x562dd2['rows']=_0x2c2b23;return _0x562dd2;})['then'](respondWithFilteredResult(_0x3be0c7,_0x193d27))[_0x31b8('0x41')](handleError(_0x3be0c7,null));};exports[_0x31b8('0x42')]=function(_0xf2745f,_0x1224cb){var _0x423523={'raw':![],'where':{'id':_0xf2745f[_0x31b8('0x43')]['id']}},_0x1983d0={};_0x1983d0[_0x31b8('0x2f')]=_['keys'](db[_0x31b8('0x2b')]['rawAttributes']);_0x1983d0['query']=_[_0x31b8('0x30')](_0xf2745f['query']);_0x1983d0['filters']=_[_0x31b8('0x33')](_0x1983d0[_0x31b8('0x2f')],_0x1983d0[_0x31b8('0x31')]);_0x423523[_0x31b8('0x32')]=_[_0x31b8('0x33')](_0x1983d0[_0x31b8('0x2f')],qs[_0x31b8('0x34')](_0xf2745f[_0x31b8('0x31')][_0x31b8('0x34')]));_0x423523[_0x31b8('0x32')]=_0x423523[_0x31b8('0x32')][_0x31b8('0x35')]?_0x423523[_0x31b8('0x32')]:_0x1983d0[_0x31b8('0x2f')];if(_0xf2745f[_0x31b8('0x31')][_0x31b8('0x44')]){_0x423523[_0x31b8('0x40')]=[{'all':!![]}];}_0x423523=_[_0x31b8('0x3d')]({},_0x423523,_0xf2745f[_0x31b8('0x3e')]);return db[_0x31b8('0x2b')][_0x31b8('0x45')](_0x423523)[_0x31b8('0x22')](handleEntityNotFound(_0x1224cb,null))[_0x31b8('0x22')](respondWithResult(_0x1224cb,null))[_0x31b8('0x41')](handleError(_0x1224cb,null));};exports[_0x31b8('0x46')]=function(_0x1c6dbc,_0x5a1404){return db[_0x31b8('0x2b')][_0x31b8('0x46')](_0x1c6dbc[_0x31b8('0x47')],{})[_0x31b8('0x22')](function(_0x5d24ca){var _0x4714d8=_0x1c6dbc[_0x31b8('0x48')][_0x31b8('0x23')]({'plain':!![]});if(!_0x4714d8)throw new Error(_0x31b8('0x49'));if(_0x4714d8['role']===_0x31b8('0x48')){var _0x2b2c89=_0x5d24ca[_0x31b8('0x23')]({'plain':!![]});var _0xf53b62=_0x31b8('0x4a');return db[_0x31b8('0x4b')]['find']({'where':{'name':_0xf53b62,'userProfileId':_0x4714d8[_0x31b8('0x4c')]},'raw':!![]})[_0x31b8('0x22')](function(_0x408f61){if(_0x408f61&&_0x408f61[_0x31b8('0x4d')]===0x0){return db['UserProfileResource'][_0x31b8('0x46')]({'name':_0x2b2c89[_0x31b8('0x28')],'resourceId':_0x2b2c89['id'],'type':_0x408f61[_0x31b8('0x28')],'sectionId':_0x408f61['id']},{})[_0x31b8('0x22')](function(){return _0x5d24ca;});}else{return _0x5d24ca;}})['catch'](function(_0x469f50){logger['error'](_0x31b8('0x4e'),_0x469f50);throw _0x469f50;});}return _0x5d24ca;})['then'](respondWithResult(_0x5a1404,0xc9))[_0x31b8('0x41')](handleError(_0x5a1404,null));};exports[_0x31b8('0x4f')]=function(_0x3824b7,_0xb8aff8){var _0x264a08={'where':{'id':_0x3824b7[_0x31b8('0x43')]['id']}},_0xf84ffd={};_0xf84ffd[_0x31b8('0x2f')]=_['keys'](db[_0x31b8('0x2b')][_0x31b8('0x2c')]);_0x264a08[_0x31b8('0x32')]=_[_0x31b8('0x33')](_0xf84ffd[_0x31b8('0x2f')],qs[_0x31b8('0x34')](_0x3824b7['query'][_0x31b8('0x34')]));_0x264a08['attributes']=_0x264a08['attributes'][_0x31b8('0x35')]?_0x264a08[_0x31b8('0x32')]:_0xf84ffd[_0x31b8('0x2f')];if(_0x3824b7['query'][_0x31b8('0x44')]){_0x264a08[_0x31b8('0x40')]=[{'all':!![]}];}_0x264a08=_[_0x31b8('0x3d')]({},_0x264a08,_0x3824b7[_0x31b8('0x3e')]);return db['JscriptyProject']['find'](_0x264a08)['then'](handleEntityNotFound(_0xb8aff8,null))[_0x31b8('0x22')](function(_0x59b307){if(_0x59b307){var _0x4d9207=_0x59b307[_0x31b8('0x23')]({'plain':!![]});_0x4d9207=qs[_0x31b8('0x50')](_0x4d9207,['id',_0x31b8('0x51'),'updatedAt']);_0x3824b7['body']=_[_0x31b8('0x50')](_0x3824b7[_0x31b8('0x47')],['id',_0x31b8('0x51'),_0x31b8('0x52')]);return db[_0x31b8('0x2b')][_0x31b8('0x46')](_[_0x31b8('0x3d')](_0x4d9207,_0x3824b7[_0x31b8('0x47')]),{'include':_0x3824b7['query'][_0x31b8('0x44')]?[{'all':!![]}]:undefined})[_0x31b8('0x22')](function(_0x2e5e72){var _0x4504ba=_0x3824b7['user'][_0x31b8('0x23')]({'plain':!![]});if(!_0x4504ba)throw new Error(_0x31b8('0x49'));if(_0x4504ba[_0x31b8('0x53')]===_0x31b8('0x48')){var _0x406bbf=_0x2e5e72['get']({'plain':!![]});var _0x80a80e=_0x31b8('0x4a');return db[_0x31b8('0x4b')][_0x31b8('0x45')]({'where':{'name':_0x80a80e,'userProfileId':_0x4504ba[_0x31b8('0x4c')]},'raw':!![]})[_0x31b8('0x22')](function(_0x1ad2c4){if(_0x1ad2c4&&_0x1ad2c4[_0x31b8('0x4d')]===0x0){return db['UserProfileResource'][_0x31b8('0x46')]({'name':_0x406bbf[_0x31b8('0x28')],'resourceId':_0x406bbf['id'],'type':_0x1ad2c4[_0x31b8('0x28')],'sectionId':_0x1ad2c4['id']},{})['then'](function(){return _0x2e5e72;});}else{return _0x2e5e72;}})[_0x31b8('0x41')](function(_0x75c619){logger[_0x31b8('0x26')](_0x31b8('0x4e'),_0x75c619);throw _0x75c619;});}return _0x2e5e72;});}})[_0x31b8('0x22')](respondWithResult(_0xb8aff8,0xc9))['catch'](handleError(_0xb8aff8,null));};exports['update']=function(_0x58398d,_0x106cc5){if(_0x58398d[_0x31b8('0x47')]['id']){delete _0x58398d['body']['id'];}return db[_0x31b8('0x2b')][_0x31b8('0x45')]({'where':{'id':_0x58398d['params']['id']}})[_0x31b8('0x22')](handleEntityNotFound(_0x106cc5,null))[_0x31b8('0x22')](saveUpdates(_0x58398d[_0x31b8('0x47')],null))[_0x31b8('0x22')](respondWithResult(_0x106cc5,null))[_0x31b8('0x41')](handleError(_0x106cc5,null));};exports[_0x31b8('0x25')]=function(_0x21e48c,_0x4c30af){return db['JscriptyProject'][_0x31b8('0x45')]({'where':{'id':_0x21e48c[_0x31b8('0x43')]['id']}})[_0x31b8('0x22')](handleEntityNotFound(_0x4c30af,null))[_0x31b8('0x22')](removeEntity(_0x4c30af,null))[_0x31b8('0x41')](handleError(_0x4c30af,null));};exports[_0x31b8('0x54')]=function(_0x5aab3a,_0x56398e,_0x2a0990){var _0x35c8c7={'raw':!![],'where':{}};var _0x385774={};var _0x553348={'count':0x0,'rows':[]};return db[_0x31b8('0x2b')][_0x31b8('0x55')]({'where':{'id':_0x5aab3a['params']['id']}})['then'](handleEntityNotFound(_0x56398e,null))[_0x31b8('0x22')](function(_0x5a04ff){if(_0x5a04ff){_0x385774[_0x31b8('0x2f')]=_[_0x31b8('0x30')](db[_0x31b8('0x56')][_0x31b8('0x2c')]);_0x385774[_0x31b8('0x31')]=_[_0x31b8('0x30')](_0x5aab3a[_0x31b8('0x31')]);_0x385774['filters']=_['intersection'](_0x385774['model'],_0x385774[_0x31b8('0x31')]);_0x35c8c7[_0x31b8('0x32')]=_[_0x31b8('0x33')](_0x385774[_0x31b8('0x2f')],qs[_0x31b8('0x34')](_0x5aab3a[_0x31b8('0x31')]['fields']));_0x35c8c7[_0x31b8('0x32')]=_0x35c8c7[_0x31b8('0x32')][_0x31b8('0x35')]?_0x35c8c7[_0x31b8('0x32')]:_0x385774[_0x31b8('0x2f')];if(!_0x5aab3a['query']['hasOwnProperty'](_0x31b8('0x37'))){_0x35c8c7[_0x31b8('0x1c')]=qs[_0x31b8('0x1c')](_0x5aab3a['query'][_0x31b8('0x1c')]);_0x35c8c7[_0x31b8('0x1b')]=qs[_0x31b8('0x1b')](_0x5aab3a[_0x31b8('0x31')][_0x31b8('0x1b')]);}_0x35c8c7[_0x31b8('0x38')]=qs[_0x31b8('0x39')](_0x5aab3a[_0x31b8('0x31')][_0x31b8('0x39')]);_0x35c8c7[_0x31b8('0x3a')]=qs[_0x31b8('0x3b')](_[_0x31b8('0x57')](_0x5aab3a[_0x31b8('0x31')],_0x385774[_0x31b8('0x3b')]));_0x35c8c7[_0x31b8('0x3a')][_0x31b8('0x58')]=_0x5a04ff['id'];if(_0x5aab3a[_0x31b8('0x31')][_0x31b8('0x3c')]){_0x35c8c7['where']=_['merge'](_0x35c8c7[_0x31b8('0x3a')],{'$or':_[_0x31b8('0x2a')](_0x35c8c7[_0x31b8('0x32')],function(_0x29654d){var _0x1e9759={};_0x1e9759[_0x29654d]={'$like':'%'+_0x5aab3a[_0x31b8('0x31')][_0x31b8('0x3c')]+'%'};return _0x1e9759;})});}_0x35c8c7=_[_0x31b8('0x3d')]({},_0x35c8c7,_0x5aab3a[_0x31b8('0x3e')]);return db[_0x31b8('0x56')][_0x31b8('0x3f')]({'where':_0x35c8c7[_0x31b8('0x3a')]})[_0x31b8('0x22')](function(_0x20d8b4){_0x553348[_0x31b8('0x3f')]=_0x20d8b4;if(_0x5aab3a[_0x31b8('0x31')][_0x31b8('0x44')]){_0x35c8c7[_0x31b8('0x40')]=[{'all':!![]}];}return db[_0x31b8('0x56')]['findAll'](_0x35c8c7);})[_0x31b8('0x22')](function(_0x2a6264){_0x553348[_0x31b8('0x59')]=_0x2a6264;return _0x553348;});}})[_0x31b8('0x22')](respondWithFilteredResult(_0x56398e,_0x35c8c7))['catch'](handleError(_0x56398e,null));};exports['getAnswers']=function(_0x5572db,_0x269468,_0x4316d2){var _0x2f8f55={'raw':!![],'where':{}};var _0x5c0e02={};var _0x38f4f8={'count':0x0,'rows':[]};return db[_0x31b8('0x2b')][_0x31b8('0x55')]({'where':{'id':_0x5572db['params']['id']}})[_0x31b8('0x22')](handleEntityNotFound(_0x269468,null))[_0x31b8('0x22')](function(_0xdf2f2){if(_0xdf2f2){_0x5c0e02[_0x31b8('0x2f')]=_[_0x31b8('0x30')](db['JscriptyAnswerReport'][_0x31b8('0x2c')]);_0x5c0e02[_0x31b8('0x31')]=_[_0x31b8('0x30')](_0x5572db[_0x31b8('0x31')]);_0x5c0e02[_0x31b8('0x3b')]=_['intersection'](_0x5c0e02[_0x31b8('0x2f')],_0x5c0e02['query']);_0x2f8f55[_0x31b8('0x32')]=_[_0x31b8('0x33')](_0x5c0e02[_0x31b8('0x2f')],qs[_0x31b8('0x34')](_0x5572db[_0x31b8('0x31')][_0x31b8('0x34')]));_0x2f8f55[_0x31b8('0x32')]=_0x2f8f55['attributes'][_0x31b8('0x35')]?_0x2f8f55[_0x31b8('0x32')]:_0x5c0e02[_0x31b8('0x2f')];if(!_0x5572db['query'][_0x31b8('0x36')]('nolimit')){_0x2f8f55[_0x31b8('0x1c')]=qs[_0x31b8('0x1c')](_0x5572db[_0x31b8('0x31')][_0x31b8('0x1c')]);_0x2f8f55[_0x31b8('0x1b')]=qs[_0x31b8('0x1b')](_0x5572db[_0x31b8('0x31')]['offset']);}_0x2f8f55[_0x31b8('0x38')]=qs['sort'](_0x5572db[_0x31b8('0x31')][_0x31b8('0x39')]);_0x2f8f55[_0x31b8('0x3a')]=qs[_0x31b8('0x3b')](_[_0x31b8('0x57')](_0x5572db[_0x31b8('0x31')],_0x5c0e02[_0x31b8('0x3b')]));_0x2f8f55[_0x31b8('0x3a')][_0x31b8('0x58')]=_0xdf2f2['id'];if(_0x5572db[_0x31b8('0x31')]['filter']){_0x2f8f55['where']=_[_0x31b8('0x3d')](_0x2f8f55['where'],{'$or':_['map'](_0x2f8f55['attributes'],function(_0x595d1a){var _0x265c4e={};_0x265c4e[_0x595d1a]={'$like':'%'+_0x5572db[_0x31b8('0x31')][_0x31b8('0x3c')]+'%'};return _0x265c4e;})});}_0x2f8f55=_[_0x31b8('0x3d')]({},_0x2f8f55,_0x5572db[_0x31b8('0x3e')]);return db[_0x31b8('0x5a')]['count']({'where':_0x2f8f55[_0x31b8('0x3a')]})['then'](function(_0x52eeda){_0x38f4f8[_0x31b8('0x3f')]=_0x52eeda;if(_0x5572db[_0x31b8('0x31')][_0x31b8('0x44')]){_0x2f8f55[_0x31b8('0x40')]=[{'all':!![]}];}return db[_0x31b8('0x5a')]['findAll'](_0x2f8f55);})['then'](function(_0x1473ee){_0x38f4f8[_0x31b8('0x59')]=_0x1473ee;return _0x38f4f8;});}})[_0x31b8('0x22')](respondWithFilteredResult(_0x269468,_0x2f8f55))[_0x31b8('0x41')](handleError(_0x269468,null));};function char(_0x13b70e){return _0x31b8('0x5b')===typeof _0x13b70e?String[_0x31b8('0x5c')][_0x31b8('0x1f')](null,arguments):_0x13b70e;}function needsEncapsulation(_0x47df70){return!!_0x47df70&&(_0x47df70[_0x31b8('0x5d')]()[_0x31b8('0x5e')](char(0xd))>=0x0||_0x47df70['toString']()[_0x31b8('0x5e')](char(0xa))>=0x0||_0x47df70[_0x31b8('0x5d')]()['indexOf'](char(0x2c))>=0x0||_0x47df70[_0x31b8('0x5d')]()[_0x31b8('0x5e')](char(0x22))>=0x0);}function encapsulate(_0x4d60e3){var _0x37c21d=char(0x22),_0x4aa32a='\x5c'+char(0x22),_0x514fc0=_0x4d60e3[_0x31b8('0x5d')]()['replace'](new RegExp(_0x37c21d,'g'),_0x4aa32a);return _0x37c21d+_0x514fc0+_0x37c21d;}exports[_0x31b8('0x5f')]=function(_0x5475a4,_0x358ac5,_0x12567b){var _0x44c590,_0x2fcc21;var _0x261b1b={'where':{'ProjectId':_0x5475a4[_0x31b8('0x43')]['id']}};if(_0x5475a4[_0x31b8('0x31')][_0x31b8('0x60')]){_0x261b1b[_0x31b8('0x3a')][_0x31b8('0x61')]=JSON['parse'](_0x5475a4['query']['startTime']);}return db['JscriptySessionReport']['findAll'](_0x261b1b)[_0x31b8('0x22')](handleEntityNotFound(_0x358ac5,null))[_0x31b8('0x22')](function(_0x3f0f4f){if(_0x3f0f4f){_0x44c590=_0x3f0f4f;return db[_0x31b8('0x62')][_0x31b8('0x63')]({'where':{'SessionId':{'$in':_['map'](_0x44c590,'id')},'ProjectId':_0x5475a4[_0x31b8('0x43')]['id']},'order':_0x31b8('0x64')});}})[_0x31b8('0x22')](handleEntityNotFound(_0x358ac5,null))['then'](function(_0x204d80){if(_0x204d80){_0x2fcc21=_0x204d80;var _0x42b316={};for(var _0x350f45=0x0,_0x3052c1=_0x2fcc21['length'];_0x350f45<_0x3052c1;_0x350f45++){if(!_0x42b316['hasOwnProperty'](_0x2fcc21[_0x350f45][_0x31b8('0x65')])){_0x42b316[_0x2fcc21[_0x350f45][_0x31b8('0x65')]]=needsEncapsulation(_0x2fcc21[_0x350f45]['question'])?encapsulate(_0x2fcc21[_0x350f45][_0x31b8('0x66')]):_0x2fcc21[_0x350f45][_0x31b8('0x66')];}}var _0x5198a4=[],_0x545010={};for(var _0x4bf510=0x0,_0x35ccd1=_0x44c590[_0x31b8('0x35')];_0x4bf510<_0x35ccd1;_0x4bf510++){_0x545010={'ProjectId':_0x5475a4[_0x31b8('0x43')]['id'],'SessionId':_0x44c590[_0x4bf510]['id'],'StartTime':moment(_0x44c590[_0x4bf510][_0x31b8('0x61')])[_0x31b8('0x67')](_0x31b8('0x68'))};for(var _0x5926d1=0x0,_0x41a007=_0x2fcc21[_0x31b8('0x35')];_0x5926d1<_0x41a007;_0x5926d1++){if(_0x2fcc21[_0x5926d1][_0x31b8('0x69')]==_0x44c590[_0x4bf510]['id']&&_0x42b316['hasOwnProperty'](_0x2fcc21[_0x5926d1][_0x31b8('0x65')])){_0x545010[_0x42b316[_0x2fcc21[_0x5926d1][_0x31b8('0x65')]]]=_0x2fcc21[_0x5926d1][_0x31b8('0x6a')];}}for(var _0x2b6426 in _0x42b316){if(!_0x545010['hasOwnProperty'](_0x42b316[_0x2b6426])){_0x545010[_0x42b316[_0x2b6426]]=null;}}_0x5198a4[_0x31b8('0x6b')](_0x545010);}return _0x5198a4;}})[_0x31b8('0x22')](function(_0x1e8571){if(!_['isEmpty'](_0x1e8571)){var _0x301403=toCsv(_0x1e8571);var _0xaf61d1=Date[_0x31b8('0x6c')]();fs[_0x31b8('0x6d')](util[_0x31b8('0x67')](_0x31b8('0x6e'),_0x5475a4['params']['id'],_0xaf61d1),_0x301403);_0x358ac5['setHeader'](_0x31b8('0x6f'),'attachment;\x20filename='+util[_0x31b8('0x67')](_0x31b8('0x70'),_0x5475a4[_0x31b8('0x43')]['id'],_0xaf61d1));_0x358ac5[_0x31b8('0x71')](_0x31b8('0x72'),_0x31b8('0x73'));return _0x358ac5[_0x31b8('0x74')](util['format'](_0x31b8('0x6e'),_0x5475a4[_0x31b8('0x43')]['id'],_0xaf61d1));}else{return _0x358ac5[_0x31b8('0x17')](0xcc);}})[_0x31b8('0x41')](handleError(_0x358ac5,null));}; \ No newline at end of file +var _0xc9e0=['update','then','get','Projects','sendStatus','error','stack','name','send','map','JscriptyProject','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','show','params','keys','length','merge','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','clone','omit','createdAt','updatedAt','body','UserProfileResource','destroy','getSessions','findOne','order','ProjectId','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','fromCharCode','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','format','YYYY-MM-DD\x20HH:mm:ss','answer','push','isEmpty','now','writeFileSync','/tmp/Jscripty_Project_%d_Summary_%s.csv','setHeader','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','offset','limit','set','Content-Range','json','apply','reject','save'];(function(_0x1dc6fe,_0x5ef44e){var _0x557264=function(_0x4d8ef2){while(--_0x4d8ef2){_0x1dc6fe['push'](_0x1dc6fe['shift']());}};_0x557264(++_0x5ef44e);}(_0xc9e0,0x14d));var _0x0c9e=function(_0x4111c5,_0x1b2481){_0x4111c5=_0x4111c5-0x0;var _0x341819=_0xc9e0[_0x4111c5];return _0x341819;};'use strict';var pdf=require(_0x0c9e('0x0'));var emlformat=require(_0x0c9e('0x1'));var rimraf=require(_0x0c9e('0x2'));var zipdir=require(_0x0c9e('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0c9e('0x4'));var BPromise=require(_0x0c9e('0x5'));var Mustache=require(_0x0c9e('0x6'));var util=require(_0x0c9e('0x7'));var path=require('path');var sox=require(_0x0c9e('0x8'));var csv=require(_0x0c9e('0x9'));var ejs=require(_0x0c9e('0xa'));var fs=require('fs');var _=require(_0x0c9e('0xb'));var squel=require(_0x0c9e('0xc'));var crypto=require('crypto');var jsforce=require(_0x0c9e('0xd'));var deskjs=require(_0x0c9e('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0c9e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0c9e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0c9e('0x11'));var hardwareService=require(_0x0c9e('0x12'));var logger=require(_0x0c9e('0x13'))(_0x0c9e('0x14'));var utils=require(_0x0c9e('0x15'));var config=require(_0x0c9e('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27318b,_0x1f9e7b){_0x1f9e7b=_0x1f9e7b||0xcc;return function(_0x25a295){if(_0x25a295){return _0x27318b['sendStatus'](_0x1f9e7b);}return _0x27318b[_0x0c9e('0x17')](_0x1f9e7b)[_0x0c9e('0x18')]();};}function respondWithResult(_0x5728a6,_0x5687ad){_0x5687ad=_0x5687ad||0xc8;return function(_0x3a18af){if(_0x3a18af){return _0x5728a6[_0x0c9e('0x17')](_0x5687ad)['json'](_0x3a18af);}};}function respondWithFilteredResult(_0xfc8d45,_0x50c378){return function(_0x321bc6){if(_0x321bc6){var _0x3c16d9=_0x321bc6['count'],_0x177295=_0x50c378[_0x0c9e('0x19')],_0x3cae29=_0x50c378['offset']+_0x50c378[_0x0c9e('0x1a')],_0x1382aa;if(_0x3cae29>=_0x3c16d9){_0x3cae29=_0x3c16d9;_0x1382aa=0xc8;}else{_0x1382aa=0xce;}_0xfc8d45['status'](_0x1382aa);return _0xfc8d45[_0x0c9e('0x1b')](_0x0c9e('0x1c'),_0x177295+'-'+_0x3cae29+'/'+_0x3c16d9)[_0x0c9e('0x1d')](_0x321bc6);}return null;};}function patchUpdates(_0x47da59){return function(_0x1495e6){try{jsonpatch[_0x0c9e('0x1e')](_0x1495e6,_0x47da59,!![]);}catch(_0x24627e){return BPromise[_0x0c9e('0x1f')](_0x24627e);}return _0x1495e6[_0x0c9e('0x20')]();};}function saveUpdates(_0x30557b,_0x182422){return function(_0x32191b){if(_0x32191b){return _0x32191b[_0x0c9e('0x21')](_0x30557b)[_0x0c9e('0x22')](function(_0x3ae855){return _0x3ae855;});}return null;};}function removeEntity(_0x3bc978,_0x4d0c77){return function(_0x5ab241){if(_0x5ab241){return _0x5ab241['destroy']()[_0x0c9e('0x22')](function(){var _0x44dcd3=_0x5ab241[_0x0c9e('0x23')]({'plain':!![]});var _0x20d520=_0x0c9e('0x24');return db['UserProfileResource']['destroy']({'where':{'type':_0x20d520,'resourceId':_0x44dcd3['id']}})[_0x0c9e('0x22')](function(){return _0x5ab241;});})[_0x0c9e('0x22')](function(){_0x3bc978[_0x0c9e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8648,_0x2521b0){return function(_0x51ea80){if(!_0x51ea80){_0x4b8648[_0x0c9e('0x25')](0x194);}return _0x51ea80;};}function handleError(_0x297b5b,_0x399484){_0x399484=_0x399484||0x1f4;return function(_0x1e7937){logger[_0x0c9e('0x26')](_0x1e7937[_0x0c9e('0x27')]);if(_0x1e7937[_0x0c9e('0x28')]){delete _0x1e7937[_0x0c9e('0x28')];}_0x297b5b[_0x0c9e('0x17')](_0x399484)[_0x0c9e('0x29')](_0x1e7937);};}exports['index']=function(_0x313419,_0x51e1a8){var _0x12f37d={},_0x2a6118={},_0x105011={'count':0x0,'rows':[]};var _0x313310=_[_0x0c9e('0x2a')](db[_0x0c9e('0x2b')][_0x0c9e('0x2c')],function(_0x3bea2e){return{'name':_0x3bea2e[_0x0c9e('0x2d')],'type':_0x3bea2e[_0x0c9e('0x2e')][_0x0c9e('0x2f')]};});_0x2a6118[_0x0c9e('0x30')]=_['map'](_0x313310,_0x0c9e('0x28'));_0x2a6118[_0x0c9e('0x31')]=_['keys'](_0x313419['query']);_0x2a6118[_0x0c9e('0x32')]=_[_0x0c9e('0x33')](_0x2a6118[_0x0c9e('0x30')],_0x2a6118[_0x0c9e('0x31')]);_0x12f37d[_0x0c9e('0x34')]=_[_0x0c9e('0x33')](_0x2a6118[_0x0c9e('0x30')],qs[_0x0c9e('0x35')](_0x313419[_0x0c9e('0x31')][_0x0c9e('0x35')]));_0x12f37d[_0x0c9e('0x34')]=_0x12f37d[_0x0c9e('0x34')]['length']?_0x12f37d[_0x0c9e('0x34')]:_0x2a6118[_0x0c9e('0x30')];if(!_0x313419[_0x0c9e('0x31')][_0x0c9e('0x36')](_0x0c9e('0x37'))){_0x12f37d[_0x0c9e('0x1a')]=qs[_0x0c9e('0x1a')](_0x313419['query'][_0x0c9e('0x1a')]);_0x12f37d[_0x0c9e('0x19')]=qs[_0x0c9e('0x19')](_0x313419[_0x0c9e('0x31')][_0x0c9e('0x19')]);}_0x12f37d['order']=qs[_0x0c9e('0x38')](_0x313419[_0x0c9e('0x31')][_0x0c9e('0x38')]);_0x12f37d[_0x0c9e('0x39')]=qs['filters'](_[_0x0c9e('0x3a')](_0x313419[_0x0c9e('0x31')],_0x2a6118[_0x0c9e('0x32')]));if(_0x313419['query']['filter']){_0x12f37d[_0x0c9e('0x39')]=_['merge'](_0x12f37d[_0x0c9e('0x39')],{'$or':_[_0x0c9e('0x2a')](_0x313310,function(_0x3cad0c){if(_0x3cad0c[_0x0c9e('0x2e')]!==_0x0c9e('0x3b')){var _0x41ec0f={};_0x41ec0f[_0x3cad0c[_0x0c9e('0x28')]]={'$like':'%'+_0x313419[_0x0c9e('0x31')][_0x0c9e('0x3c')]+'%'};return _0x41ec0f;}})});}_0x12f37d=_['merge']({},_0x12f37d,_0x313419[_0x0c9e('0x3d')]);var _0xd5480c={'where':_0x12f37d[_0x0c9e('0x39')]};return db[_0x0c9e('0x2b')][_0x0c9e('0x3e')](_0xd5480c)[_0x0c9e('0x22')](function(_0x4394f8){_0x105011[_0x0c9e('0x3e')]=_0x4394f8;if(_0x313419[_0x0c9e('0x31')][_0x0c9e('0x3f')]){_0x12f37d[_0x0c9e('0x40')]=[{'all':!![]}];}return db['JscriptyProject'][_0x0c9e('0x41')](_0x12f37d);})['then'](function(_0x4d7450){_0x105011[_0x0c9e('0x42')]=_0x4d7450;return _0x105011;})[_0x0c9e('0x22')](respondWithFilteredResult(_0x51e1a8,_0x12f37d))['catch'](handleError(_0x51e1a8,null));};exports[_0x0c9e('0x43')]=function(_0xe96e48,_0x134939){var _0x5324a6={'raw':![],'where':{'id':_0xe96e48[_0x0c9e('0x44')]['id']}},_0x1efe26={};_0x1efe26[_0x0c9e('0x30')]=_[_0x0c9e('0x45')](db['JscriptyProject']['rawAttributes']);_0x1efe26['query']=_[_0x0c9e('0x45')](_0xe96e48[_0x0c9e('0x31')]);_0x1efe26[_0x0c9e('0x32')]=_['intersection'](_0x1efe26[_0x0c9e('0x30')],_0x1efe26[_0x0c9e('0x31')]);_0x5324a6['attributes']=_[_0x0c9e('0x33')](_0x1efe26[_0x0c9e('0x30')],qs[_0x0c9e('0x35')](_0xe96e48[_0x0c9e('0x31')][_0x0c9e('0x35')]));_0x5324a6[_0x0c9e('0x34')]=_0x5324a6[_0x0c9e('0x34')][_0x0c9e('0x46')]?_0x5324a6['attributes']:_0x1efe26[_0x0c9e('0x30')];if(_0xe96e48[_0x0c9e('0x31')][_0x0c9e('0x3f')]){_0x5324a6['include']=[{'all':!![]}];}_0x5324a6=_[_0x0c9e('0x47')]({},_0x5324a6,_0xe96e48[_0x0c9e('0x3d')]);return db[_0x0c9e('0x2b')][_0x0c9e('0x48')](_0x5324a6)['then'](handleEntityNotFound(_0x134939,null))['then'](respondWithResult(_0x134939,null))['catch'](handleError(_0x134939,null));};exports[_0x0c9e('0x49')]=function(_0x55e927,_0x1031ad){return db[_0x0c9e('0x2b')]['create'](_0x55e927['body'],{})[_0x0c9e('0x22')](function(_0x37fc3d){var _0x3157fb=_0x55e927[_0x0c9e('0x4a')][_0x0c9e('0x23')]({'plain':!![]});if(!_0x3157fb)throw new Error(_0x0c9e('0x4b'));if(_0x3157fb[_0x0c9e('0x4c')]===_0x0c9e('0x4a')){var _0x865aa2=_0x37fc3d[_0x0c9e('0x23')]({'plain':!![]});var _0x53b88b=_0x0c9e('0x24');return db[_0x0c9e('0x4d')][_0x0c9e('0x48')]({'where':{'name':_0x53b88b,'userProfileId':_0x3157fb[_0x0c9e('0x4e')]},'raw':!![]})[_0x0c9e('0x22')](function(_0x34a558){if(_0x34a558&&_0x34a558[_0x0c9e('0x4f')]===0x0){return db['UserProfileResource'][_0x0c9e('0x49')]({'name':_0x865aa2[_0x0c9e('0x28')],'resourceId':_0x865aa2['id'],'type':_0x34a558[_0x0c9e('0x28')],'sectionId':_0x34a558['id']},{})['then'](function(){return _0x37fc3d;});}else{return _0x37fc3d;}})['catch'](function(_0x2769ec){logger[_0x0c9e('0x26')](_0x0c9e('0x50'),_0x2769ec);throw _0x2769ec;});}return _0x37fc3d;})[_0x0c9e('0x22')](respondWithResult(_0x1031ad,0xc9))[_0x0c9e('0x51')](handleError(_0x1031ad,null));};exports[_0x0c9e('0x52')]=function(_0x24c6db,_0x565c54){var _0x2e7d0c={'where':{'id':_0x24c6db[_0x0c9e('0x44')]['id']}},_0x195260={};_0x195260[_0x0c9e('0x30')]=_['keys'](db[_0x0c9e('0x2b')][_0x0c9e('0x2c')]);_0x2e7d0c[_0x0c9e('0x34')]=_[_0x0c9e('0x33')](_0x195260[_0x0c9e('0x30')],qs[_0x0c9e('0x35')](_0x24c6db['query'][_0x0c9e('0x35')]));_0x2e7d0c[_0x0c9e('0x34')]=_0x2e7d0c[_0x0c9e('0x34')][_0x0c9e('0x46')]?_0x2e7d0c[_0x0c9e('0x34')]:_0x195260[_0x0c9e('0x30')];if(_0x24c6db['query']['includeAll']){_0x2e7d0c[_0x0c9e('0x40')]=[{'all':!![]}];}_0x2e7d0c=_['merge']({},_0x2e7d0c,_0x24c6db[_0x0c9e('0x3d')]);return db[_0x0c9e('0x2b')][_0x0c9e('0x48')](_0x2e7d0c)[_0x0c9e('0x22')](handleEntityNotFound(_0x565c54,null))['then'](function(_0x4c9bff){if(_0x4c9bff){var _0x125879=_0x4c9bff[_0x0c9e('0x23')]({'plain':!![]});_0x125879=qs[_0x0c9e('0x53')](_0x125879,['id',_0x0c9e('0x54'),_0x0c9e('0x55')]);_0x24c6db[_0x0c9e('0x56')]=_['omit'](_0x24c6db[_0x0c9e('0x56')],['id','createdAt',_0x0c9e('0x55')]);return db[_0x0c9e('0x2b')][_0x0c9e('0x49')](_[_0x0c9e('0x47')](_0x125879,_0x24c6db[_0x0c9e('0x56')]),{'include':_0x24c6db['query'][_0x0c9e('0x3f')]?[{'all':!![]}]:undefined})[_0x0c9e('0x22')](function(_0x34f60d){var _0x3042ef=_0x24c6db['user'][_0x0c9e('0x23')]({'plain':!![]});if(!_0x3042ef)throw new Error(_0x0c9e('0x4b'));if(_0x3042ef['role']==='user'){var _0x1fd867=_0x34f60d[_0x0c9e('0x23')]({'plain':!![]});var _0x5f0c62='Projects';return db['UserProfileSection'][_0x0c9e('0x48')]({'where':{'name':_0x5f0c62,'userProfileId':_0x3042ef[_0x0c9e('0x4e')]},'raw':!![]})[_0x0c9e('0x22')](function(_0x2c1926){if(_0x2c1926&&_0x2c1926['autoAssociation']===0x0){return db[_0x0c9e('0x57')][_0x0c9e('0x49')]({'name':_0x1fd867[_0x0c9e('0x28')],'resourceId':_0x1fd867['id'],'type':_0x2c1926[_0x0c9e('0x28')],'sectionId':_0x2c1926['id']},{})[_0x0c9e('0x22')](function(){return _0x34f60d;});}else{return _0x34f60d;}})[_0x0c9e('0x51')](function(_0x1015eb){logger[_0x0c9e('0x26')](_0x0c9e('0x50'),_0x1015eb);throw _0x1015eb;});}return _0x34f60d;});}})[_0x0c9e('0x22')](respondWithResult(_0x565c54,0xc9))['catch'](handleError(_0x565c54,null));};exports[_0x0c9e('0x21')]=function(_0x3c2b5c,_0x6bead5){if(_0x3c2b5c['body']['id']){delete _0x3c2b5c[_0x0c9e('0x56')]['id'];}return db['JscriptyProject'][_0x0c9e('0x48')]({'where':{'id':_0x3c2b5c[_0x0c9e('0x44')]['id']}})['then'](handleEntityNotFound(_0x6bead5,null))[_0x0c9e('0x22')](saveUpdates(_0x3c2b5c[_0x0c9e('0x56')],null))['then'](respondWithResult(_0x6bead5,null))[_0x0c9e('0x51')](handleError(_0x6bead5,null));};exports[_0x0c9e('0x58')]=function(_0x20ff26,_0x108702){return db['JscriptyProject']['find']({'where':{'id':_0x20ff26[_0x0c9e('0x44')]['id']}})[_0x0c9e('0x22')](handleEntityNotFound(_0x108702,null))[_0x0c9e('0x22')](removeEntity(_0x108702,null))[_0x0c9e('0x51')](handleError(_0x108702,null));};exports[_0x0c9e('0x59')]=function(_0x3a54c2,_0x2cf26b,_0xb6c725){var _0x58fdd7={'raw':!![],'where':{}};var _0xa64250={};var _0xb877b2={'count':0x0,'rows':[]};return db[_0x0c9e('0x2b')][_0x0c9e('0x5a')]({'where':{'id':_0x3a54c2[_0x0c9e('0x44')]['id']}})[_0x0c9e('0x22')](handleEntityNotFound(_0x2cf26b,null))[_0x0c9e('0x22')](function(_0x5bc62b){if(_0x5bc62b){_0xa64250[_0x0c9e('0x30')]=_['keys'](db['JscriptySessionReport'][_0x0c9e('0x2c')]);_0xa64250[_0x0c9e('0x31')]=_['keys'](_0x3a54c2[_0x0c9e('0x31')]);_0xa64250[_0x0c9e('0x32')]=_['intersection'](_0xa64250[_0x0c9e('0x30')],_0xa64250[_0x0c9e('0x31')]);_0x58fdd7['attributes']=_[_0x0c9e('0x33')](_0xa64250[_0x0c9e('0x30')],qs[_0x0c9e('0x35')](_0x3a54c2[_0x0c9e('0x31')][_0x0c9e('0x35')]));_0x58fdd7[_0x0c9e('0x34')]=_0x58fdd7['attributes']['length']?_0x58fdd7[_0x0c9e('0x34')]:_0xa64250[_0x0c9e('0x30')];if(!_0x3a54c2[_0x0c9e('0x31')]['hasOwnProperty'](_0x0c9e('0x37'))){_0x58fdd7['limit']=qs['limit'](_0x3a54c2['query'][_0x0c9e('0x1a')]);_0x58fdd7['offset']=qs[_0x0c9e('0x19')](_0x3a54c2['query']['offset']);}_0x58fdd7[_0x0c9e('0x5b')]=qs[_0x0c9e('0x38')](_0x3a54c2[_0x0c9e('0x31')]['sort']);_0x58fdd7[_0x0c9e('0x39')]=qs['filters'](_[_0x0c9e('0x3a')](_0x3a54c2[_0x0c9e('0x31')],_0xa64250[_0x0c9e('0x32')]));_0x58fdd7[_0x0c9e('0x39')][_0x0c9e('0x5c')]=_0x5bc62b['id'];if(_0x3a54c2[_0x0c9e('0x31')][_0x0c9e('0x3c')]){_0x58fdd7[_0x0c9e('0x39')]=_['merge'](_0x58fdd7[_0x0c9e('0x39')],{'$or':_['map'](_0x58fdd7[_0x0c9e('0x34')],function(_0xe9e841){var _0x303727={};_0x303727[_0xe9e841]={'$like':'%'+_0x3a54c2[_0x0c9e('0x31')][_0x0c9e('0x3c')]+'%'};return _0x303727;})});}_0x58fdd7=_[_0x0c9e('0x47')]({},_0x58fdd7,_0x3a54c2[_0x0c9e('0x3d')]);return db[_0x0c9e('0x5d')][_0x0c9e('0x3e')]({'where':_0x58fdd7[_0x0c9e('0x39')]})[_0x0c9e('0x22')](function(_0x1a5049){_0xb877b2[_0x0c9e('0x3e')]=_0x1a5049;if(_0x3a54c2['query']['includeAll']){_0x58fdd7['include']=[{'all':!![]}];}return db[_0x0c9e('0x5d')][_0x0c9e('0x41')](_0x58fdd7);})[_0x0c9e('0x22')](function(_0x25bb09){_0xb877b2[_0x0c9e('0x42')]=_0x25bb09;return _0xb877b2;});}})[_0x0c9e('0x22')](respondWithFilteredResult(_0x2cf26b,_0x58fdd7))['catch'](handleError(_0x2cf26b,null));};exports[_0x0c9e('0x5e')]=function(_0x3d0323,_0xc0d69b,_0x42dff4){var _0xdc2b35={'raw':!![],'where':{}};var _0x54a650={};var _0x2ac6aa={'count':0x0,'rows':[]};return db[_0x0c9e('0x2b')][_0x0c9e('0x5a')]({'where':{'id':_0x3d0323[_0x0c9e('0x44')]['id']}})['then'](handleEntityNotFound(_0xc0d69b,null))[_0x0c9e('0x22')](function(_0x336150){if(_0x336150){_0x54a650['model']=_['keys'](db['JscriptyAnswerReport']['rawAttributes']);_0x54a650[_0x0c9e('0x31')]=_[_0x0c9e('0x45')](_0x3d0323[_0x0c9e('0x31')]);_0x54a650[_0x0c9e('0x32')]=_[_0x0c9e('0x33')](_0x54a650[_0x0c9e('0x30')],_0x54a650[_0x0c9e('0x31')]);_0xdc2b35[_0x0c9e('0x34')]=_[_0x0c9e('0x33')](_0x54a650[_0x0c9e('0x30')],qs[_0x0c9e('0x35')](_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x35')]));_0xdc2b35['attributes']=_0xdc2b35['attributes'][_0x0c9e('0x46')]?_0xdc2b35[_0x0c9e('0x34')]:_0x54a650[_0x0c9e('0x30')];if(!_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x36')](_0x0c9e('0x37'))){_0xdc2b35[_0x0c9e('0x1a')]=qs[_0x0c9e('0x1a')](_0x3d0323[_0x0c9e('0x31')]['limit']);_0xdc2b35['offset']=qs[_0x0c9e('0x19')](_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x19')]);}_0xdc2b35['order']=qs['sort'](_0x3d0323['query'][_0x0c9e('0x38')]);_0xdc2b35[_0x0c9e('0x39')]=qs[_0x0c9e('0x32')](_[_0x0c9e('0x3a')](_0x3d0323[_0x0c9e('0x31')],_0x54a650['filters']));_0xdc2b35[_0x0c9e('0x39')][_0x0c9e('0x5c')]=_0x336150['id'];if(_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x3c')]){_0xdc2b35[_0x0c9e('0x39')]=_[_0x0c9e('0x47')](_0xdc2b35[_0x0c9e('0x39')],{'$or':_[_0x0c9e('0x2a')](_0xdc2b35[_0x0c9e('0x34')],function(_0x3883f6){var _0x4255a8={};_0x4255a8[_0x3883f6]={'$like':'%'+_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x3c')]+'%'};return _0x4255a8;})});}_0xdc2b35=_['merge']({},_0xdc2b35,_0x3d0323['options']);return db[_0x0c9e('0x5f')][_0x0c9e('0x3e')]({'where':_0xdc2b35['where']})[_0x0c9e('0x22')](function(_0x580d05){_0x2ac6aa[_0x0c9e('0x3e')]=_0x580d05;if(_0x3d0323[_0x0c9e('0x31')][_0x0c9e('0x3f')]){_0xdc2b35['include']=[{'all':!![]}];}return db[_0x0c9e('0x5f')][_0x0c9e('0x41')](_0xdc2b35);})['then'](function(_0x19a34b){_0x2ac6aa[_0x0c9e('0x42')]=_0x19a34b;return _0x2ac6aa;});}})[_0x0c9e('0x22')](respondWithFilteredResult(_0xc0d69b,_0xdc2b35))[_0x0c9e('0x51')](handleError(_0xc0d69b,null));};function char(_0x265a0f){return _0x0c9e('0x60')===typeof _0x265a0f?String[_0x0c9e('0x61')][_0x0c9e('0x1e')](null,arguments):_0x265a0f;}function needsEncapsulation(_0x18fad4){return!!_0x18fad4&&(_0x18fad4[_0x0c9e('0x62')]()[_0x0c9e('0x63')](char(0xd))>=0x0||_0x18fad4[_0x0c9e('0x62')]()['indexOf'](char(0xa))>=0x0||_0x18fad4[_0x0c9e('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x18fad4[_0x0c9e('0x62')]()[_0x0c9e('0x63')](char(0x22))>=0x0);}function encapsulate(_0x410c5e){var _0x5c2d9a=char(0x22),_0x3c0aa8='\x5c'+char(0x22),_0xb7d3fc=_0x410c5e[_0x0c9e('0x62')]()[_0x0c9e('0x64')](new RegExp(_0x5c2d9a,'g'),_0x3c0aa8);return _0x5c2d9a+_0xb7d3fc+_0x5c2d9a;}exports[_0x0c9e('0x65')]=function(_0xf367bc,_0x22cf50,_0x125ee8){var _0x5c0bd8,_0x15c6f2;var _0x48dc28={'where':{'ProjectId':_0xf367bc[_0x0c9e('0x44')]['id']}};if(_0xf367bc[_0x0c9e('0x31')][_0x0c9e('0x66')]){_0x48dc28[_0x0c9e('0x39')][_0x0c9e('0x67')]=JSON[_0x0c9e('0x68')](_0xf367bc[_0x0c9e('0x31')][_0x0c9e('0x66')]);}return db[_0x0c9e('0x5d')][_0x0c9e('0x41')](_0x48dc28)['then'](handleEntityNotFound(_0x22cf50,null))[_0x0c9e('0x22')](function(_0x2087f8){if(_0x2087f8){_0x5c0bd8=_0x2087f8;return db[_0x0c9e('0x69')][_0x0c9e('0x41')]({'where':{'SessionId':{'$in':_[_0x0c9e('0x2a')](_0x5c0bd8,'id')},'ProjectId':_0xf367bc[_0x0c9e('0x44')]['id']},'order':_0x0c9e('0x6a')});}})['then'](handleEntityNotFound(_0x22cf50,null))['then'](function(_0x49f572){if(_0x49f572){_0x15c6f2=_0x49f572;var _0x3fbcb5={};for(var _0x38e9a5=0x0,_0x2b4be2=_0x15c6f2[_0x0c9e('0x46')];_0x38e9a5<_0x2b4be2;_0x38e9a5++){if(!_0x3fbcb5[_0x0c9e('0x36')](_0x15c6f2[_0x38e9a5][_0x0c9e('0x6b')])){_0x3fbcb5[_0x15c6f2[_0x38e9a5][_0x0c9e('0x6b')]]=needsEncapsulation(_0x15c6f2[_0x38e9a5]['question'])?encapsulate(_0x15c6f2[_0x38e9a5][_0x0c9e('0x6c')]):_0x15c6f2[_0x38e9a5][_0x0c9e('0x6c')];}}var _0x44522c=[],_0x50faa7={};for(var _0x3eca00=0x0,_0x31aeeb=_0x5c0bd8['length'];_0x3eca00<_0x31aeeb;_0x3eca00++){_0x50faa7={'ProjectId':_0xf367bc[_0x0c9e('0x44')]['id'],'SessionId':_0x5c0bd8[_0x3eca00]['id'],'StartTime':moment(_0x5c0bd8[_0x3eca00][_0x0c9e('0x67')])[_0x0c9e('0x6d')](_0x0c9e('0x6e'))};for(var _0x1bcfdb=0x0,_0x40311a=_0x15c6f2['length'];_0x1bcfdb<_0x40311a;_0x1bcfdb++){if(_0x15c6f2[_0x1bcfdb]['SessionId']==_0x5c0bd8[_0x3eca00]['id']&&_0x3fbcb5[_0x0c9e('0x36')](_0x15c6f2[_0x1bcfdb][_0x0c9e('0x6b')])){_0x50faa7[_0x3fbcb5[_0x15c6f2[_0x1bcfdb]['questionId']]]=_0x15c6f2[_0x1bcfdb][_0x0c9e('0x6f')];}}for(var _0x4efd9c in _0x3fbcb5){if(!_0x50faa7['hasOwnProperty'](_0x3fbcb5[_0x4efd9c])){_0x50faa7[_0x3fbcb5[_0x4efd9c]]=null;}}_0x44522c[_0x0c9e('0x70')](_0x50faa7);}return _0x44522c;}})[_0x0c9e('0x22')](function(_0x3eac5c){if(!_[_0x0c9e('0x71')](_0x3eac5c)){var _0x4d1b63=toCsv(_0x3eac5c);var _0x187730=Date[_0x0c9e('0x72')]();fs[_0x0c9e('0x73')](util['format'](_0x0c9e('0x74'),_0xf367bc[_0x0c9e('0x44')]['id'],_0x187730),_0x4d1b63);_0x22cf50[_0x0c9e('0x75')]('Content-disposition','attachment;\x20filename='+util['format'](_0x0c9e('0x76'),_0xf367bc[_0x0c9e('0x44')]['id'],_0x187730));_0x22cf50[_0x0c9e('0x75')](_0x0c9e('0x77'),_0x0c9e('0x78'));return _0x22cf50[_0x0c9e('0x79')](util[_0x0c9e('0x6d')](_0x0c9e('0x74'),_0xf367bc[_0x0c9e('0x44')]['id'],_0x187730));}else{return _0x22cf50['sendStatus'](0xcc);}})[_0x0c9e('0x51')](handleError(_0x22cf50,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index fede6fd..b33a823 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 _0xd4b7=['request-promise','path','define','JscriptyProject','jscripty_projects','lodash','util','../../config/logger','api','bluebird'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0xd4b7,0x69));var _0x7d4b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd4b7[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7d4b('0x0'));var util=require(_0x7d4b('0x1'));var logger=require(_0x7d4b('0x2'))(_0x7d4b('0x3'));var moment=require('moment');var BPromise=require(_0x7d4b('0x4'));var rp=require(_0x7d4b('0x5'));var fs=require('fs');var path=require(_0x7d4b('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./jscriptyProject.attributes');module['exports']=function(_0xb930f0,_0x1c0353){return _0xb930f0[_0x7d4b('0x7')](_0x7d4b('0x8'),attributes,{'tableName':_0x7d4b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc8a3=['rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects','lodash','moment','bluebird','request-promise'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc8a3,0x74));var _0x3c8a=function(_0x3f4750,_0x1a331e){_0x3f4750=_0x3f4750-0x0;var _0x4e605d=_0xc8a3[_0x3f4750];return _0x4e605d;};'use strict';var _=require(_0x3c8a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x3c8a('0x1'));var BPromise=require(_0x3c8a('0x2'));var rp=require(_0x3c8a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c8a('0x4'));var config=require('../../config/environment');var attributes=require(_0x3c8a('0x5'));module[_0x3c8a('0x6')]=function(_0xc8c3d7,_0x5d440c){return _0xc8c3d7[_0x3c8a('0x7')](_0x3c8a('0x8'),attributes,{'tableName':_0x3c8a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.rpc.js b/server/api/jscriptyProject/jscriptyProject.rpc.js index 0886c80..5a61269 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 _0xa4da=['../../config/logger','rpc','jayson/promise','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x335a61,_0x21b879){var _0x48a02b=function(_0x2978a8){while(--_0x2978a8){_0x335a61['push'](_0x335a61['shift']());}};_0x48a02b(++_0x21b879);}(_0xa4da,0x13e));var _0xaa4d=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xa4da[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0xaa4d('0x0'));var util=require(_0xaa4d('0x1'));var moment=require(_0xaa4d('0x2'));var BPromise=require('bluebird');var rs=require(_0xaa4d('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xaa4d('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xaa4d('0x5'))(_0xaa4d('0x6'));var config=require('../../config/environment');var jayson=require(_0xaa4d('0x7'));var client=jayson['client'][_0xaa4d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x49419b,_0x5c50f2,_0x3ef0bd){return new BPromise(function(_0x86c96a,_0x54da21){return client[_0xaa4d('0x9')](_0x49419b,_0x3ef0bd)[_0xaa4d('0xa')](function(_0x5eadc6){logger[_0xaa4d('0xb')](_0xaa4d('0xc'),_0x5c50f2,_0xaa4d('0xd'));logger['debug']('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x5c50f2,_0xaa4d('0xd'),JSON[_0xaa4d('0xe')](_0x5eadc6));if(_0x5eadc6[_0xaa4d('0xf')]){if(_0x5eadc6[_0xaa4d('0xf')]['code']===0x1f4){logger[_0xaa4d('0xf')](_0xaa4d('0xc'),_0x5c50f2,_0x5eadc6[_0xaa4d('0xf')][_0xaa4d('0x10')]);return _0x54da21(_0x5eadc6[_0xaa4d('0xf')][_0xaa4d('0x10')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x5c50f2,_0x5eadc6[_0xaa4d('0xf')]['message']);return _0x86c96a(_0x5eadc6[_0xaa4d('0xf')][_0xaa4d('0x10')]);}else{logger[_0xaa4d('0xb')](_0xaa4d('0xc'),_0x5c50f2,_0xaa4d('0xd'));_0x86c96a(_0x5eadc6[_0xaa4d('0x11')][_0xaa4d('0x10')]);}})[_0xaa4d('0x12')](function(_0x4e8f42){logger[_0xaa4d('0xf')](_0xaa4d('0xc'),_0x5c50f2,_0x4e8f42);_0x54da21(_0x4e8f42);});});} \ No newline at end of file +var _0x6ccf=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x137f06,_0x2a7b36){var _0x152b0c=function(_0x5655b1){while(--_0x5655b1){_0x137f06['push'](_0x137f06['shift']());}};_0x152b0c(++_0x2a7b36);}(_0x6ccf,0x159));var _0xf6cc=function(_0x4b7b69,_0x3ab075){_0x4b7b69=_0x4b7b69-0x0;var _0x173b4c=_0x6ccf[_0x4b7b69];return _0x173b4c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xf6cc('0x0'));var BPromise=require(_0xf6cc('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf6cc('0x2'));var db=require(_0xf6cc('0x3'))['db'];var utils=require(_0xf6cc('0x4'));var logger=require(_0xf6cc('0x5'))(_0xf6cc('0x6'));var config=require(_0xf6cc('0x7'));var jayson=require(_0xf6cc('0x8'));var client=jayson[_0xf6cc('0x9')][_0xf6cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x31d306,_0x19ebbe,_0x3dae8a){return new BPromise(function(_0xcaeeb2,_0x3103a7){return client[_0xf6cc('0xb')](_0x31d306,_0x3dae8a)[_0xf6cc('0xc')](function(_0x5880e0){logger[_0xf6cc('0xd')](_0xf6cc('0xe'),_0x19ebbe,_0xf6cc('0xf'));logger[_0xf6cc('0x10')](_0xf6cc('0x11'),_0x19ebbe,_0xf6cc('0xf'),JSON[_0xf6cc('0x12')](_0x5880e0));if(_0x5880e0['error']){if(_0x5880e0[_0xf6cc('0x13')]['code']===0x1f4){logger[_0xf6cc('0x13')]('JscriptyProject,\x20%s,\x20%s',_0x19ebbe,_0x5880e0[_0xf6cc('0x13')][_0xf6cc('0x14')]);return _0x3103a7(_0x5880e0[_0xf6cc('0x13')][_0xf6cc('0x14')]);}logger[_0xf6cc('0x13')](_0xf6cc('0xe'),_0x19ebbe,_0x5880e0[_0xf6cc('0x13')][_0xf6cc('0x14')]);return _0xcaeeb2(_0x5880e0[_0xf6cc('0x13')]['message']);}else{logger[_0xf6cc('0xd')](_0xf6cc('0xe'),_0x19ebbe,_0xf6cc('0xf'));_0xcaeeb2(_0x5880e0[_0xf6cc('0x15')][_0xf6cc('0x14')]);}})[_0xf6cc('0x16')](function(_0x1c7892){logger[_0xf6cc('0x13')](_0xf6cc('0xe'),_0x19ebbe,_0x1c7892);_0x3103a7(_0x1c7892);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index d9e5bd8..6edb71c 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 _0x0cf8=['put','delete','destroy','exports','multer','util','path','../../components/auth/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','/:id','show'];(function(_0x500c0,_0xdb6a03){var _0xdd146f=function(_0x2e8090){while(--_0x2e8090){_0x500c0['push'](_0x500c0['shift']());}};_0xdd146f(++_0xdb6a03);}(_0x0cf8,0x154));var _0x80cf=function(_0x342599,_0x2ce4a0){_0x342599=_0x342599-0x0;var _0x246737=_0x0cf8[_0x342599];return _0x246737;};'use strict';var multer=require(_0x80cf('0x0'));var util=require(_0x80cf('0x1'));var path=require(_0x80cf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var auth=require(_0x80cf('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x80cf('0x4'));var controller=require(_0x80cf('0x5'));router[_0x80cf('0x6')]('/',auth[_0x80cf('0x7')](),controller['index']);router['get']('/describe',auth[_0x80cf('0x7')](),controller['describe']);router['get'](_0x80cf('0x8'),auth['isAuthenticated'](),controller[_0x80cf('0x9')]);router['post']('/',auth[_0x80cf('0x7')](),controller['create']);router[_0x80cf('0xa')](_0x80cf('0x8'),auth['isAuthenticated'](),controller['update']);router[_0x80cf('0xb')](_0x80cf('0x8'),auth[_0x80cf('0x7')](),controller[_0x80cf('0xc')]);module[_0x80cf('0xd')]=router; \ No newline at end of file +var _0x834e=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x23b401,_0x250f26){var _0x95c219=function(_0x2c71f4){while(--_0x2c71f4){_0x23b401['push'](_0x23b401['shift']());}};_0x95c219(++_0x250f26);}(_0x834e,0x73));var _0xe834=function(_0x4bab9d,_0x57622b){_0x4bab9d=_0x4bab9d-0x0;var _0x592f45=_0x834e[_0x4bab9d];return _0x592f45;};'use strict';var multer=require(_0xe834('0x0'));var util=require(_0xe834('0x1'));var path=require(_0xe834('0x2'));var timeout=require(_0xe834('0x3'));var express=require(_0xe834('0x4'));var router=express[_0xe834('0x5')]();var auth=require(_0xe834('0x6'));var interaction=require(_0xe834('0x7'));var config=require(_0xe834('0x8'));var controller=require('./jscriptyQuestionReport.controller');router[_0xe834('0x9')]('/',auth['isAuthenticated'](),controller[_0xe834('0xa')]);router[_0xe834('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xe834('0x9')](_0xe834('0xb'),auth[_0xe834('0xc')](),controller[_0xe834('0xd')]);router[_0xe834('0xe')]('/',auth['isAuthenticated'](),controller[_0xe834('0xf')]);router[_0xe834('0x10')](_0xe834('0xb'),auth[_0xe834('0xc')](),controller[_0xe834('0x11')]);router['delete'](_0xe834('0xb'),auth[_0xe834('0xc')](),controller[_0xe834('0x12')]);module[_0xe834('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index cf14938..c2cda04 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 _0xa1c3=['STRING','TEXT','long','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xa1c3,0x97));var _0x3a1c=function(_0x1639d7,_0x32b4a0){_0x1639d7=_0x1639d7-0x0;var _0x2b6998=_0xa1c3[_0x1639d7];return _0x2b6998;};'use strict';var Sequelize=require('sequelize');module[_0x3a1c('0x0')]={'question':{'type':Sequelize[_0x3a1c('0x1')]},'answer':{'type':Sequelize[_0x3a1c('0x2')](_0x3a1c('0x3'))},'membername':{'type':Sequelize[_0x3a1c('0x1')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3a1c('0x1')]},'uniqueid':{'type':Sequelize[_0x3a1c('0x1')]},'calleridname':{'type':Sequelize[_0x3a1c('0x1')]},'calleridnum':{'type':Sequelize[_0x3a1c('0x1')]},'questionId':{'type':Sequelize[_0x3a1c('0x1')]}}; \ No newline at end of file +var _0x28c6=['TEXT','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x28c6,0x1dd));var _0x628c=function(_0x2125f0,_0x2f23b9){_0x2125f0=_0x2125f0-0x0;var _0x12d6eb=_0x28c6[_0x2125f0];return _0x12d6eb;};'use strict';var Sequelize=require(_0x628c('0x0'));module[_0x628c('0x1')]={'question':{'type':Sequelize[_0x628c('0x2')]},'answer':{'type':Sequelize[_0x628c('0x3')]('long')},'membername':{'type':Sequelize['STRING']},'projectname':{'type':Sequelize[_0x628c('0x2')]},'queue':{'type':Sequelize[_0x628c('0x2')]},'uniqueid':{'type':Sequelize[_0x628c('0x2')]},'calleridname':{'type':Sequelize[_0x628c('0x2')]},'calleridnum':{'type':Sequelize['STRING']},'questionId':{'type':Sequelize[_0x628c('0x2')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index fcccdc9..1b17cb1 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 _0xa912=['moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','stack','name','index','map','JscriptyQuestionReport','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','findAll','catch','params','create','body','find','describe','html-pdf','eml-format','zip-dir','fast-json-patch'];(function(_0xccf869,_0x2556a5){var _0x21a9db=function(_0xcc4835){while(--_0xcc4835){_0xccf869['push'](_0xccf869['shift']());}};_0x21a9db(++_0x2556a5);}(_0xa912,0xd4));var _0x2a91=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xa912[_0x5f09c5];return _0x426ad9;};'use strict';var pdf=require(_0x2a91('0x0'));var emlformat=require(_0x2a91('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x2a91('0x2'));var jsonpatch=require(_0x2a91('0x3'));var rp=require('request-promise');var moment=require(_0x2a91('0x4'));var BPromise=require(_0x2a91('0x5'));var Mustache=require(_0x2a91('0x6'));var util=require(_0x2a91('0x7'));var path=require(_0x2a91('0x8'));var sox=require('sox');var csv=require(_0x2a91('0x9'));var ejs=require(_0x2a91('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x2a91('0xb'));var crypto=require(_0x2a91('0xc'));var jsforce=require(_0x2a91('0xd'));var deskjs=require(_0x2a91('0xe'));var toCsv=require(_0x2a91('0x9'));var querystring=require(_0x2a91('0xf'));var Papa=require('papaparse');var Redis=require(_0x2a91('0x10'));var authService=require(_0x2a91('0x11'));var qs=require(_0x2a91('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2a91('0x13'));var logger=require(_0x2a91('0x14'))(_0x2a91('0x15'));var utils=require(_0x2a91('0x16'));var config=require(_0x2a91('0x17'));var db=require(_0x2a91('0x18'))['db'];function respondWithStatusCode(_0x553536,_0x4fdd75){_0x4fdd75=_0x4fdd75||0xcc;return function(_0x225f19){if(_0x225f19){return _0x553536[_0x2a91('0x19')](_0x4fdd75);}return _0x553536[_0x2a91('0x1a')](_0x4fdd75)[_0x2a91('0x1b')]();};}function respondWithResult(_0x3a6ffe,_0x41a56c){_0x41a56c=_0x41a56c||0xc8;return function(_0x3d7e65){if(_0x3d7e65){return _0x3a6ffe[_0x2a91('0x1a')](_0x41a56c)[_0x2a91('0x1c')](_0x3d7e65);}};}function respondWithFilteredResult(_0x3d760a,_0x129fc7){return function(_0x35ec68){if(_0x35ec68){var _0x2336ca=_0x35ec68[_0x2a91('0x1d')],_0x2c16fe=_0x129fc7[_0x2a91('0x1e')],_0x26eb2c=_0x129fc7[_0x2a91('0x1e')]+_0x129fc7[_0x2a91('0x1f')],_0x216845;if(_0x26eb2c>=_0x2336ca){_0x26eb2c=_0x2336ca;_0x216845=0xc8;}else{_0x216845=0xce;}_0x3d760a[_0x2a91('0x1a')](_0x216845);return _0x3d760a[_0x2a91('0x20')](_0x2a91('0x21'),_0x2c16fe+'-'+_0x26eb2c+'/'+_0x2336ca)[_0x2a91('0x1c')](_0x35ec68);}return null;};}function patchUpdates(_0x4c9d66){return function(_0x51f8d4){try{jsonpatch['apply'](_0x51f8d4,_0x4c9d66,!![]);}catch(_0xebd973){return BPromise[_0x2a91('0x22')](_0xebd973);}return _0x51f8d4[_0x2a91('0x23')]();};}function saveUpdates(_0x3a20cb,_0x161ab1){return function(_0x4faa67){if(_0x4faa67){return _0x4faa67['update'](_0x3a20cb)[_0x2a91('0x24')](function(_0x5e6ed5){return _0x5e6ed5;});}return null;};}function removeEntity(_0x9ff4a8,_0x3767d0){return function(_0x232b56){if(_0x232b56){return _0x232b56[_0x2a91('0x25')]()[_0x2a91('0x24')](function(){_0x9ff4a8[_0x2a91('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2966dc,_0x24d548){return function(_0x520a3d){if(!_0x520a3d){_0x2966dc[_0x2a91('0x19')](0x194);}return _0x520a3d;};}function handleError(_0x228d0d,_0x31ecfe){_0x31ecfe=_0x31ecfe||0x1f4;return function(_0x35b5e4){logger['error'](_0x35b5e4[_0x2a91('0x26')]);if(_0x35b5e4[_0x2a91('0x27')]){delete _0x35b5e4['name'];}_0x228d0d[_0x2a91('0x1a')](_0x31ecfe)['send'](_0x35b5e4);};}exports[_0x2a91('0x28')]=function(_0x31a5f5,_0x99fb41){var _0x38595c={},_0x49ec3a={},_0x328b6c={'count':0x0,'rows':[]};var _0x505847=_[_0x2a91('0x29')](db[_0x2a91('0x2a')]['rawAttributes'],function(_0x5264a3){return{'name':_0x5264a3[_0x2a91('0x2b')],'type':_0x5264a3[_0x2a91('0x2c')][_0x2a91('0x2d')]};});_0x49ec3a[_0x2a91('0x2e')]=_['map'](_0x505847,'name');_0x49ec3a['query']=_[_0x2a91('0x2f')](_0x31a5f5[_0x2a91('0x30')]);_0x49ec3a['filters']=_[_0x2a91('0x31')](_0x49ec3a[_0x2a91('0x2e')],_0x49ec3a[_0x2a91('0x30')]);_0x38595c[_0x2a91('0x32')]=_[_0x2a91('0x31')](_0x49ec3a[_0x2a91('0x2e')],qs[_0x2a91('0x33')](_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x33')]));_0x38595c['attributes']=_0x38595c[_0x2a91('0x32')][_0x2a91('0x34')]?_0x38595c[_0x2a91('0x32')]:_0x49ec3a[_0x2a91('0x2e')];if(!_0x31a5f5['query']['hasOwnProperty'](_0x2a91('0x35'))){_0x38595c['limit']=qs[_0x2a91('0x1f')](_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x1f')]);_0x38595c[_0x2a91('0x1e')]=qs[_0x2a91('0x1e')](_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x1e')]);}_0x38595c[_0x2a91('0x36')]=qs[_0x2a91('0x37')](_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x37')]);_0x38595c[_0x2a91('0x38')]=qs[_0x2a91('0x39')](_[_0x2a91('0x3a')](_0x31a5f5[_0x2a91('0x30')],_0x49ec3a['filters']));if(_0x31a5f5['query']['filter']){_0x38595c[_0x2a91('0x38')]=_['merge'](_0x38595c[_0x2a91('0x38')],{'$or':_[_0x2a91('0x29')](_0x505847,function(_0x208557){if(_0x208557[_0x2a91('0x2c')]!==_0x2a91('0x3b')){var _0x35cb8c={};_0x35cb8c[_0x208557[_0x2a91('0x27')]]={'$like':'%'+_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x3c')]+'%'};return _0x35cb8c;}})});}_0x38595c=_[_0x2a91('0x3d')]({},_0x38595c,_0x31a5f5[_0x2a91('0x3e')]);var _0x8c3aad={'where':_0x38595c['where']};return db['JscriptyQuestionReport']['count'](_0x8c3aad)[_0x2a91('0x24')](function(_0x3d7148){_0x328b6c['count']=_0x3d7148;if(_0x31a5f5[_0x2a91('0x30')][_0x2a91('0x3f')]){_0x38595c[_0x2a91('0x40')]=[{'all':!![]}];}return db[_0x2a91('0x2a')][_0x2a91('0x41')](_0x38595c);})['then'](function(_0x5d00fc){_0x328b6c['rows']=_0x5d00fc;return _0x328b6c;})[_0x2a91('0x24')](respondWithFilteredResult(_0x99fb41,_0x38595c))[_0x2a91('0x42')](handleError(_0x99fb41,null));};exports['show']=function(_0x3583a4,_0x32b45a){var _0x207f25={'raw':!![],'where':{'id':_0x3583a4[_0x2a91('0x43')]['id']}},_0x1b9ac2={};_0x1b9ac2[_0x2a91('0x2e')]=_[_0x2a91('0x2f')](db['JscriptyQuestionReport']['rawAttributes']);_0x1b9ac2[_0x2a91('0x30')]=_[_0x2a91('0x2f')](_0x3583a4[_0x2a91('0x30')]);_0x1b9ac2['filters']=_[_0x2a91('0x31')](_0x1b9ac2[_0x2a91('0x2e')],_0x1b9ac2[_0x2a91('0x30')]);_0x207f25['attributes']=_[_0x2a91('0x31')](_0x1b9ac2[_0x2a91('0x2e')],qs[_0x2a91('0x33')](_0x3583a4[_0x2a91('0x30')]['fields']));_0x207f25[_0x2a91('0x32')]=_0x207f25[_0x2a91('0x32')][_0x2a91('0x34')]?_0x207f25[_0x2a91('0x32')]:_0x1b9ac2[_0x2a91('0x2e')];if(_0x3583a4[_0x2a91('0x30')][_0x2a91('0x3f')]){_0x207f25[_0x2a91('0x40')]=[{'all':!![]}];}_0x207f25=_['merge']({},_0x207f25,_0x3583a4['options']);return db[_0x2a91('0x2a')]['find'](_0x207f25)['then'](handleEntityNotFound(_0x32b45a,null))['then'](respondWithResult(_0x32b45a,null))['catch'](handleError(_0x32b45a,null));};exports['create']=function(_0x6745e0,_0x206122){return db['JscriptyQuestionReport'][_0x2a91('0x44')](_0x6745e0[_0x2a91('0x45')],{})['then'](respondWithResult(_0x206122,0xc9))[_0x2a91('0x42')](handleError(_0x206122,null));};exports['update']=function(_0x57fc92,_0x4fc3da){if(_0x57fc92['body']['id']){delete _0x57fc92['body']['id'];}return db[_0x2a91('0x2a')][_0x2a91('0x46')]({'where':{'id':_0x57fc92[_0x2a91('0x43')]['id']}})[_0x2a91('0x24')](handleEntityNotFound(_0x4fc3da,null))[_0x2a91('0x24')](saveUpdates(_0x57fc92[_0x2a91('0x45')],null))['then'](respondWithResult(_0x4fc3da,null))[_0x2a91('0x42')](handleError(_0x4fc3da,null));};exports[_0x2a91('0x25')]=function(_0x279129,_0x5225a2){return db[_0x2a91('0x2a')]['find']({'where':{'id':_0x279129[_0x2a91('0x43')]['id']}})['then'](handleEntityNotFound(_0x5225a2,null))[_0x2a91('0x24')](removeEntity(_0x5225a2,null))[_0x2a91('0x42')](handleError(_0x5225a2,null));};exports[_0x2a91('0x47')]=function(_0x2a196b,_0x1392e5){return db[_0x2a91('0x2a')]['describe']()[_0x2a91('0x24')](respondWithResult(_0x1392e5,null))['catch'](handleError(_0x1392e5,null));}; \ No newline at end of file +var _0x2f16=['stack','name','send','map','JscriptyQuestionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','findAll','catch','show','include','options','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','count','limit','status','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error'];(function(_0xb58f9,_0x13b3b5){var _0x14bf30=function(_0x3f7a4e){while(--_0x3f7a4e){_0xb58f9['push'](_0xb58f9['shift']());}};_0x14bf30(++_0x13b3b5);}(_0x2f16,0x14f));var _0x62f1=function(_0x1df088,_0x38c471){_0x1df088=_0x1df088-0x0;var _0x267951=_0x2f16[_0x1df088];return _0x267951;};'use strict';var pdf=require(_0x62f1('0x0'));var emlformat=require(_0x62f1('0x1'));var rimraf=require(_0x62f1('0x2'));var zipdir=require(_0x62f1('0x3'));var jsonpatch=require(_0x62f1('0x4'));var rp=require(_0x62f1('0x5'));var moment=require(_0x62f1('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x62f1('0x7'));var util=require(_0x62f1('0x8'));var path=require('path');var sox=require(_0x62f1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x62f1('0xa'));var squel=require(_0x62f1('0xb'));var crypto=require(_0x62f1('0xc'));var jsforce=require(_0x62f1('0xd'));var deskjs=require(_0x62f1('0xe'));var toCsv=require(_0x62f1('0xf'));var querystring=require(_0x62f1('0x10'));var Papa=require('papaparse');var Redis=require(_0x62f1('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x62f1('0x12'));var as=require(_0x62f1('0x13'));var hardwareService=require(_0x62f1('0x14'));var logger=require(_0x62f1('0x15'))(_0x62f1('0x16'));var utils=require(_0x62f1('0x17'));var config=require(_0x62f1('0x18'));var db=require(_0x62f1('0x19'))['db'];function respondWithStatusCode(_0x3c9018,_0x4e528f){_0x4e528f=_0x4e528f||0xcc;return function(_0x1b6682){if(_0x1b6682){return _0x3c9018['sendStatus'](_0x4e528f);}return _0x3c9018['status'](_0x4e528f)[_0x62f1('0x1a')]();};}function respondWithResult(_0x50cc99,_0x18cd54){_0x18cd54=_0x18cd54||0xc8;return function(_0x32ef8a){if(_0x32ef8a){return _0x50cc99['status'](_0x18cd54)[_0x62f1('0x1b')](_0x32ef8a);}};}function respondWithFilteredResult(_0x6decd6,_0x1711d2){return function(_0x1473fe){if(_0x1473fe){var _0x49c2a9=_0x1473fe[_0x62f1('0x1c')],_0xee2ef1=_0x1711d2['offset'],_0x47d963=_0x1711d2['offset']+_0x1711d2[_0x62f1('0x1d')],_0x1e7de5;if(_0x47d963>=_0x49c2a9){_0x47d963=_0x49c2a9;_0x1e7de5=0xc8;}else{_0x1e7de5=0xce;}_0x6decd6[_0x62f1('0x1e')](_0x1e7de5);return _0x6decd6['set'](_0x62f1('0x1f'),_0xee2ef1+'-'+_0x47d963+'/'+_0x49c2a9)[_0x62f1('0x1b')](_0x1473fe);}return null;};}function patchUpdates(_0x5d68de){return function(_0x56eab0){try{jsonpatch[_0x62f1('0x20')](_0x56eab0,_0x5d68de,!![]);}catch(_0x217cd1){return BPromise[_0x62f1('0x21')](_0x217cd1);}return _0x56eab0[_0x62f1('0x22')]();};}function saveUpdates(_0x2b1f72,_0x5f3541){return function(_0x1bdd2e){if(_0x1bdd2e){return _0x1bdd2e[_0x62f1('0x23')](_0x2b1f72)['then'](function(_0x5efdfb){return _0x5efdfb;});}return null;};}function removeEntity(_0x371a71,_0x27fa43){return function(_0x11dd2c){if(_0x11dd2c){return _0x11dd2c[_0x62f1('0x24')]()[_0x62f1('0x25')](function(){_0x371a71[_0x62f1('0x1e')](0xcc)[_0x62f1('0x1a')]();});}};}function handleEntityNotFound(_0x5e435b,_0x3f79ce){return function(_0x52ffa8){if(!_0x52ffa8){_0x5e435b[_0x62f1('0x26')](0x194);}return _0x52ffa8;};}function handleError(_0x2d7cb5,_0x214585){_0x214585=_0x214585||0x1f4;return function(_0x597335){logger[_0x62f1('0x27')](_0x597335[_0x62f1('0x28')]);if(_0x597335[_0x62f1('0x29')]){delete _0x597335[_0x62f1('0x29')];}_0x2d7cb5[_0x62f1('0x1e')](_0x214585)[_0x62f1('0x2a')](_0x597335);};}exports['index']=function(_0x4011e7,_0x5c54cc){var _0x5ced1e={},_0x2b253c={},_0x1acf7e={'count':0x0,'rows':[]};var _0x20e32b=_[_0x62f1('0x2b')](db[_0x62f1('0x2c')][_0x62f1('0x2d')],function(_0x381b9e){return{'name':_0x381b9e['fieldName'],'type':_0x381b9e['type']['key']};});_0x2b253c[_0x62f1('0x2e')]=_[_0x62f1('0x2b')](_0x20e32b,_0x62f1('0x29'));_0x2b253c[_0x62f1('0x2f')]=_[_0x62f1('0x30')](_0x4011e7[_0x62f1('0x2f')]);_0x2b253c[_0x62f1('0x31')]=_[_0x62f1('0x32')](_0x2b253c[_0x62f1('0x2e')],_0x2b253c[_0x62f1('0x2f')]);_0x5ced1e[_0x62f1('0x33')]=_['intersection'](_0x2b253c[_0x62f1('0x2e')],qs[_0x62f1('0x34')](_0x4011e7[_0x62f1('0x2f')][_0x62f1('0x34')]));_0x5ced1e['attributes']=_0x5ced1e[_0x62f1('0x33')][_0x62f1('0x35')]?_0x5ced1e[_0x62f1('0x33')]:_0x2b253c[_0x62f1('0x2e')];if(!_0x4011e7[_0x62f1('0x2f')][_0x62f1('0x36')](_0x62f1('0x37'))){_0x5ced1e[_0x62f1('0x1d')]=qs[_0x62f1('0x1d')](_0x4011e7['query'][_0x62f1('0x1d')]);_0x5ced1e['offset']=qs[_0x62f1('0x38')](_0x4011e7[_0x62f1('0x2f')][_0x62f1('0x38')]);}_0x5ced1e[_0x62f1('0x39')]=qs[_0x62f1('0x3a')](_0x4011e7[_0x62f1('0x2f')][_0x62f1('0x3a')]);_0x5ced1e[_0x62f1('0x3b')]=qs[_0x62f1('0x31')](_[_0x62f1('0x3c')](_0x4011e7[_0x62f1('0x2f')],_0x2b253c[_0x62f1('0x31')]));if(_0x4011e7[_0x62f1('0x2f')][_0x62f1('0x3d')]){_0x5ced1e[_0x62f1('0x3b')]=_[_0x62f1('0x3e')](_0x5ced1e['where'],{'$or':_[_0x62f1('0x2b')](_0x20e32b,function(_0x25e62f){if(_0x25e62f['type']!==_0x62f1('0x3f')){var _0xc0c1dc={};_0xc0c1dc[_0x25e62f['name']]={'$like':'%'+_0x4011e7['query'][_0x62f1('0x3d')]+'%'};return _0xc0c1dc;}})});}_0x5ced1e=_[_0x62f1('0x3e')]({},_0x5ced1e,_0x4011e7['options']);var _0x5ee6c0={'where':_0x5ced1e[_0x62f1('0x3b')]};return db['JscriptyQuestionReport'][_0x62f1('0x1c')](_0x5ee6c0)[_0x62f1('0x25')](function(_0x39b55e){_0x1acf7e[_0x62f1('0x1c')]=_0x39b55e;if(_0x4011e7['query'][_0x62f1('0x40')]){_0x5ced1e['include']=[{'all':!![]}];}return db[_0x62f1('0x2c')][_0x62f1('0x41')](_0x5ced1e);})[_0x62f1('0x25')](function(_0x77f16c){_0x1acf7e['rows']=_0x77f16c;return _0x1acf7e;})[_0x62f1('0x25')](respondWithFilteredResult(_0x5c54cc,_0x5ced1e))[_0x62f1('0x42')](handleError(_0x5c54cc,null));};exports[_0x62f1('0x43')]=function(_0x51f6c8,_0x8b1f4e){var _0x4ef0db={'raw':!![],'where':{'id':_0x51f6c8['params']['id']}},_0x1ed885={};_0x1ed885[_0x62f1('0x2e')]=_[_0x62f1('0x30')](db[_0x62f1('0x2c')][_0x62f1('0x2d')]);_0x1ed885[_0x62f1('0x2f')]=_[_0x62f1('0x30')](_0x51f6c8[_0x62f1('0x2f')]);_0x1ed885['filters']=_['intersection'](_0x1ed885[_0x62f1('0x2e')],_0x1ed885[_0x62f1('0x2f')]);_0x4ef0db[_0x62f1('0x33')]=_[_0x62f1('0x32')](_0x1ed885[_0x62f1('0x2e')],qs[_0x62f1('0x34')](_0x51f6c8[_0x62f1('0x2f')][_0x62f1('0x34')]));_0x4ef0db[_0x62f1('0x33')]=_0x4ef0db[_0x62f1('0x33')][_0x62f1('0x35')]?_0x4ef0db[_0x62f1('0x33')]:_0x1ed885[_0x62f1('0x2e')];if(_0x51f6c8[_0x62f1('0x2f')][_0x62f1('0x40')]){_0x4ef0db[_0x62f1('0x44')]=[{'all':!![]}];}_0x4ef0db=_[_0x62f1('0x3e')]({},_0x4ef0db,_0x51f6c8[_0x62f1('0x45')]);return db[_0x62f1('0x2c')][_0x62f1('0x46')](_0x4ef0db)[_0x62f1('0x25')](handleEntityNotFound(_0x8b1f4e,null))[_0x62f1('0x25')](respondWithResult(_0x8b1f4e,null))[_0x62f1('0x42')](handleError(_0x8b1f4e,null));};exports['create']=function(_0x38e072,_0x181d05){return db[_0x62f1('0x2c')][_0x62f1('0x47')](_0x38e072[_0x62f1('0x48')],{})['then'](respondWithResult(_0x181d05,0xc9))[_0x62f1('0x42')](handleError(_0x181d05,null));};exports['update']=function(_0x47f574,_0x265950){if(_0x47f574[_0x62f1('0x48')]['id']){delete _0x47f574['body']['id'];}return db[_0x62f1('0x2c')][_0x62f1('0x46')]({'where':{'id':_0x47f574['params']['id']}})[_0x62f1('0x25')](handleEntityNotFound(_0x265950,null))[_0x62f1('0x25')](saveUpdates(_0x47f574[_0x62f1('0x48')],null))[_0x62f1('0x25')](respondWithResult(_0x265950,null))[_0x62f1('0x42')](handleError(_0x265950,null));};exports['destroy']=function(_0x52ca1d,_0x4edeb4){return db[_0x62f1('0x2c')]['find']({'where':{'id':_0x52ca1d[_0x62f1('0x49')]['id']}})[_0x62f1('0x25')](handleEntityNotFound(_0x4edeb4,null))['then'](removeEntity(_0x4edeb4,null))[_0x62f1('0x42')](handleError(_0x4edeb4,null));};exports[_0x62f1('0x4a')]=function(_0x511c72,_0x396b2c){return db['JscriptyQuestionReport'][_0x62f1('0x4a')]()['then'](respondWithResult(_0x396b2c,null))[_0x62f1('0x42')](handleError(_0x396b2c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index 9219dc6..40c0067 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 _0xc35e=['define','JscriptyQuestionReport','report_jscripty_questions','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes'];(function(_0x2ff9e8,_0x173f25){var _0xd14aed=function(_0x58a090){while(--_0x58a090){_0x2ff9e8['push'](_0x2ff9e8['shift']());}};_0xd14aed(++_0x173f25);}(_0xc35e,0x14d));var _0xec35=function(_0x2eea9a,_0x368daf){_0x2eea9a=_0x2eea9a-0x0;var _0x1ec61e=_0xc35e[_0x2eea9a];return _0x1ec61e;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xec35('0x0'));var moment=require(_0xec35('0x1'));var BPromise=require(_0xec35('0x2'));var rp=require(_0xec35('0x3'));var fs=require('fs');var path=require(_0xec35('0x4'));var rimraf=require(_0xec35('0x5'));var config=require(_0xec35('0x6'));var attributes=require(_0xec35('0x7'));module['exports']=function(_0x42876d,_0x37bdaa){return _0x42876d[_0xec35('0x8')](_0xec35('0x9'),attributes,{'tableName':_0xec35('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd61c=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyQuestionReport.attributes','define','lodash'];(function(_0x4c5730,_0x2becbe){var _0x4b8a9d=function(_0x40f163){while(--_0x40f163){_0x4c5730['push'](_0x4c5730['shift']());}};_0x4b8a9d(++_0x2becbe);}(_0xd61c,0x143));var _0xcd61=function(_0x211f67,_0x47ecfc){_0x211f67=_0x211f67-0x0;var _0x320874=_0xd61c[_0x211f67];return _0x320874;};'use strict';var _=require(_0xcd61('0x0'));var util=require(_0xcd61('0x1'));var logger=require(_0xcd61('0x2'))(_0xcd61('0x3'));var moment=require(_0xcd61('0x4'));var BPromise=require(_0xcd61('0x5'));var rp=require(_0xcd61('0x6'));var fs=require('fs');var path=require(_0xcd61('0x7'));var rimraf=require(_0xcd61('0x8'));var config=require(_0xcd61('0x9'));var attributes=require(_0xcd61('0xa'));module['exports']=function(_0x574ddf,_0x4da203){return _0x574ddf[_0xcd61('0xb')]('JscriptyQuestionReport',attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.rpc.js index e81b972..6b5c21c 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 _0x40bb=['../../config/utils','../../config/environment','jayson/promise','http','request','then','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','util','moment','ioredis','../../mysqldb'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x40bb,0x94));var _0xb40b=function(_0x1939cf,_0x54a7dd){_0x1939cf=_0x1939cf-0x0;var _0x364eb8=_0x40bb[_0x1939cf];return _0x364eb8;};'use strict';var _=require('lodash');var util=require(_0xb40b('0x0'));var moment=require(_0xb40b('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb40b('0x2'));var db=require(_0xb40b('0x3'))['db'];var utils=require(_0xb40b('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb40b('0x5'));var jayson=require(_0xb40b('0x6'));var client=jayson['client'][_0xb40b('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x44086c,_0x2d2942,_0x3c4595){return new BPromise(function(_0x4d3d11,_0x4a7d11){return client[_0xb40b('0x8')](_0x44086c,_0x3c4595)[_0xb40b('0x9')](function(_0x46b389){logger['info'](_0xb40b('0xa'),_0x2d2942,_0xb40b('0xb'));logger[_0xb40b('0xc')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x2d2942,_0xb40b('0xb'),JSON[_0xb40b('0xd')](_0x46b389));if(_0x46b389[_0xb40b('0xe')]){if(_0x46b389[_0xb40b('0xe')][_0xb40b('0xf')]===0x1f4){logger[_0xb40b('0xe')](_0xb40b('0xa'),_0x2d2942,_0x46b389[_0xb40b('0xe')][_0xb40b('0x10')]);return _0x4a7d11(_0x46b389[_0xb40b('0xe')]['message']);}logger[_0xb40b('0xe')](_0xb40b('0xa'),_0x2d2942,_0x46b389['error'][_0xb40b('0x10')]);return _0x4d3d11(_0x46b389[_0xb40b('0xe')][_0xb40b('0x10')]);}else{logger[_0xb40b('0x11')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x2d2942,_0xb40b('0xb'));_0x4d3d11(_0x46b389[_0xb40b('0x12')][_0xb40b('0x10')]);}})['catch'](function(_0x47af72){logger[_0xb40b('0xe')](_0xb40b('0xa'),_0x2d2942,_0x47af72);_0x4a7d11(_0x47af72);});});} \ No newline at end of file +var _0xa05d=['message','JscriptyQuestionReport,\x20%s,\x20%s','result','catch','lodash','util','moment','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x2ad2a7,_0x2a3874){var _0x1d22e6=function(_0x1ca4e4){while(--_0x1ca4e4){_0x2ad2a7['push'](_0x2ad2a7['shift']());}};_0x1d22e6(++_0x2a3874);}(_0xa05d,0xac));var _0xda05=function(_0x12ce1d,_0x27dad7){_0x12ce1d=_0x12ce1d-0x0;var _0x3e987f=_0xa05d[_0x12ce1d];return _0x3e987f;};'use strict';var _=require(_0xda05('0x0'));var util=require(_0xda05('0x1'));var moment=require(_0xda05('0x2'));var BPromise=require('bluebird');var rs=require(_0xda05('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xda05('0x4'));var logger=require(_0xda05('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xda05('0x6'));var client=jayson[_0xda05('0x7')][_0xda05('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x184df2,_0x1ec1c2,_0x1eef9c){return new BPromise(function(_0x419a8c,_0x5a6428){return client[_0xda05('0x9')](_0x184df2,_0x1eef9c)[_0xda05('0xa')](function(_0x14823e){logger[_0xda05('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ec1c2,_0xda05('0xc'));logger[_0xda05('0xd')](_0xda05('0xe'),_0x1ec1c2,_0xda05('0xc'),JSON[_0xda05('0xf')](_0x14823e));if(_0x14823e[_0xda05('0x10')]){if(_0x14823e['error']['code']===0x1f4){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x1ec1c2,_0x14823e[_0xda05('0x10')][_0xda05('0x11')]);return _0x5a6428(_0x14823e[_0xda05('0x10')][_0xda05('0x11')]);}logger[_0xda05('0x10')](_0xda05('0x12'),_0x1ec1c2,_0x14823e[_0xda05('0x10')][_0xda05('0x11')]);return _0x419a8c(_0x14823e[_0xda05('0x10')]['message']);}else{logger[_0xda05('0xb')](_0xda05('0x12'),_0x1ec1c2,_0xda05('0xc'));_0x419a8c(_0x14823e[_0xda05('0x13')][_0xda05('0x11')]);}})[_0xda05('0x14')](function(_0x139bbc){logger[_0xda05('0x10')](_0xda05('0x12'),_0x1ec1c2,_0x139bbc);_0x5a6428(_0x139bbc);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 5102516..0f00a29 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 _0x984b=['/:id','show','/:id/questions','getQuestions','post','create','put','update','destroy','exports','connect-timeout','express','Router','../../config/environment','./jscriptySessionReport.controller','index','get','isAuthenticated','describe'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x984b,0xee));var _0xb984=function(_0x28622b,_0x5c2a42){_0x28622b=_0x28622b-0x0;var _0x2bd433=_0x984b[_0x28622b];return _0x2bd433;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xb984('0x0'));var express=require(_0xb984('0x1'));var router=express[_0xb984('0x2')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb984('0x3'));var controller=require(_0xb984('0x4'));router['get']('/',auth['isAuthenticated'](),controller[_0xb984('0x5')]);router[_0xb984('0x6')]('/describe',auth[_0xb984('0x7')](),controller[_0xb984('0x8')]);router['get'](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0xa')]);router[_0xb984('0x6')](_0xb984('0xb'),auth[_0xb984('0x7')](),controller[_0xb984('0xc')]);router[_0xb984('0xd')]('/',auth[_0xb984('0x7')](),controller[_0xb984('0xe')]);router[_0xb984('0xf')](_0xb984('0x9'),auth[_0xb984('0x7')](),controller[_0xb984('0x10')]);router['delete'](_0xb984('0x9'),auth['isAuthenticated'](),controller[_0xb984('0x11')]);module[_0xb984('0x12')]=router; \ No newline at end of file +var _0x9d92=['describe','/:id','show','post','create','update','delete','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe'];(function(_0x4ae3be,_0x40b92d){var _0x52e919=function(_0x10a813){while(--_0x10a813){_0x4ae3be['push'](_0x4ae3be['shift']());}};_0x52e919(++_0x40b92d);}(_0x9d92,0xdf));var _0x29d9=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x9d92[_0xbeb808];return _0x5d6909;};'use strict';var multer=require(_0x29d9('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x29d9('0x1'));var express=require(_0x29d9('0x2'));var router=express['Router']();var auth=require(_0x29d9('0x3'));var interaction=require(_0x29d9('0x4'));var config=require(_0x29d9('0x5'));var controller=require(_0x29d9('0x6'));router[_0x29d9('0x7')]('/',auth[_0x29d9('0x8')](),controller[_0x29d9('0x9')]);router['get'](_0x29d9('0xa'),auth[_0x29d9('0x8')](),controller[_0x29d9('0xb')]);router['get'](_0x29d9('0xc'),auth[_0x29d9('0x8')](),controller[_0x29d9('0xd')]);router['get']('/:id/questions',auth['isAuthenticated'](),controller['getQuestions']);router[_0x29d9('0xe')]('/',auth[_0x29d9('0x8')](),controller[_0x29d9('0xf')]);router['put'](_0x29d9('0xc'),auth[_0x29d9('0x8')](),controller[_0x29d9('0x10')]);router[_0x29d9('0x11')]('/:id',auth[_0x29d9('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 90aa286..7a904c5 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 _0x503d=['sequelize','exports','DATE','setDataValue','starttime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment'];(function(_0x555069,_0x23d66a){var _0x100af7=function(_0x1606bd){while(--_0x1606bd){_0x555069['push'](_0x555069['shift']());}};_0x100af7(++_0x23d66a);}(_0x503d,0xe5));var _0xd503=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x503d[_0x40220a];return _0x3903cc;};'use strict';var moment=require(_0xd503('0x0'));var Sequelize=require(_0xd503('0x1'));module[_0xd503('0x2')]={'starttime':{'type':Sequelize[_0xd503('0x3')],'set':function(_0x39d8c7){this[_0xd503('0x4')](_0xd503('0x5'),_0x39d8c7);this['setDataValue']('endtime',moment()[_0xd503('0x6')](_0xd503('0x7')));}},'endtime':{'type':Sequelize[_0xd503('0x3')]},'membername':{'type':Sequelize[_0xd503('0x8')]},'projectname':{'type':Sequelize[_0xd503('0x8')]},'queue':{'type':Sequelize[_0xd503('0x8')]},'uniqueid':{'type':Sequelize[_0xd503('0x8')]},'calleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xd503('0x8')]},'completed':{'type':Sequelize[_0xd503('0x9')],'defaultValue':![]}}; \ No newline at end of file +var _0x81e1=['setDataValue','endtime','format','STRING','BOOLEAN','moment','sequelize','DATE','starttime'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x81e1,0x1be));var _0x181e=function(_0x5d397e,_0x92b885){_0x5d397e=_0x5d397e-0x0;var _0x36fca8=_0x81e1[_0x5d397e];return _0x36fca8;};'use strict';var moment=require(_0x181e('0x0'));var Sequelize=require(_0x181e('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x181e('0x2')],'set':function(_0x55b3ea){this['setDataValue'](_0x181e('0x3'),_0x55b3ea);this[_0x181e('0x4')](_0x181e('0x5'),moment()[_0x181e('0x6')]('YYYY-MM-DD\x20HH:mm:ss'));}},'endtime':{'type':Sequelize[_0x181e('0x2')]},'membername':{'type':Sequelize[_0x181e('0x7')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x181e('0x7')]},'calleridname':{'type':Sequelize[_0x181e('0x7')]},'calleridnum':{'type':Sequelize[_0x181e('0x7')]},'completed':{'type':Sequelize[_0x181e('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index acceb8d..dd9809c 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 _0xdc56=['catch','show','params','keys','length','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport','hasOwnProperty','options','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/environment','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','update','then','destroy','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows'];(function(_0x39dec7,_0x40a93f){var _0x1b4e39=function(_0x244ce5){while(--_0x244ce5){_0x39dec7['push'](_0x39dec7['shift']());}};_0x1b4e39(++_0x40a93f);}(_0xdc56,0x17b));var _0x6dc5=function(_0x56f7e2,_0x145392){_0x56f7e2=_0x56f7e2-0x0;var _0x36240b=_0xdc56[_0x56f7e2];return _0x36240b;};'use strict';var pdf=require(_0x6dc5('0x0'));var emlformat=require(_0x6dc5('0x1'));var rimraf=require(_0x6dc5('0x2'));var zipdir=require(_0x6dc5('0x3'));var jsonpatch=require(_0x6dc5('0x4'));var rp=require(_0x6dc5('0x5'));var moment=require(_0x6dc5('0x6'));var BPromise=require(_0x6dc5('0x7'));var Mustache=require(_0x6dc5('0x8'));var util=require(_0x6dc5('0x9'));var path=require(_0x6dc5('0xa'));var sox=require('sox');var csv=require(_0x6dc5('0xb'));var ejs=require(_0x6dc5('0xc'));var fs=require('fs');var _=require(_0x6dc5('0xd'));var squel=require(_0x6dc5('0xe'));var crypto=require('crypto');var jsforce=require(_0x6dc5('0xf'));var deskjs=require(_0x6dc5('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6dc5('0x11'));var Redis=require(_0x6dc5('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6dc5('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x6dc5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50a088,_0x61e68d){_0x61e68d=_0x61e68d||0xcc;return function(_0x1294c1){if(_0x1294c1){return _0x50a088[_0x6dc5('0x15')](_0x61e68d);}return _0x50a088[_0x6dc5('0x16')](_0x61e68d)['end']();};}function respondWithResult(_0xcd4016,_0x5b5925){_0x5b5925=_0x5b5925||0xc8;return function(_0x10f69c){if(_0x10f69c){return _0xcd4016[_0x6dc5('0x16')](_0x5b5925)[_0x6dc5('0x17')](_0x10f69c);}};}function respondWithFilteredResult(_0x3ebf50,_0x322591){return function(_0x32c7c6){if(_0x32c7c6){var _0x2c0774=_0x32c7c6[_0x6dc5('0x18')],_0x100415=_0x322591[_0x6dc5('0x19')],_0xee5055=_0x322591['offset']+_0x322591[_0x6dc5('0x1a')],_0x47de54;if(_0xee5055>=_0x2c0774){_0xee5055=_0x2c0774;_0x47de54=0xc8;}else{_0x47de54=0xce;}_0x3ebf50[_0x6dc5('0x16')](_0x47de54);return _0x3ebf50[_0x6dc5('0x1b')](_0x6dc5('0x1c'),_0x100415+'-'+_0xee5055+'/'+_0x2c0774)['json'](_0x32c7c6);}return null;};}function patchUpdates(_0x58bb56){return function(_0x3c6c45){try{jsonpatch[_0x6dc5('0x1d')](_0x3c6c45,_0x58bb56,!![]);}catch(_0x33179d){return BPromise['reject'](_0x33179d);}return _0x3c6c45['save']();};}function saveUpdates(_0x13d1b3,_0x2d9d17){return function(_0x5d194c){if(_0x5d194c){return _0x5d194c[_0x6dc5('0x1e')](_0x13d1b3)[_0x6dc5('0x1f')](function(_0xaa72b3){return _0xaa72b3;});}return null;};}function removeEntity(_0x56f7e9,_0x5c64ee){return function(_0x1bd0e3){if(_0x1bd0e3){return _0x1bd0e3[_0x6dc5('0x20')]()[_0x6dc5('0x1f')](function(){_0x56f7e9[_0x6dc5('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x427b10,_0x5c5f95){return function(_0x1881cd){if(!_0x1881cd){_0x427b10[_0x6dc5('0x15')](0x194);}return _0x1881cd;};}function handleError(_0x16eec1,_0x901b56){_0x901b56=_0x901b56||0x1f4;return function(_0x398855){logger[_0x6dc5('0x21')](_0x398855[_0x6dc5('0x22')]);if(_0x398855[_0x6dc5('0x23')]){delete _0x398855[_0x6dc5('0x23')];}_0x16eec1[_0x6dc5('0x16')](_0x901b56)[_0x6dc5('0x24')](_0x398855);};}exports[_0x6dc5('0x25')]=function(_0x3ba909,_0x560572){var _0x70ff2e={},_0x5366d3={},_0x4eb6c6={'count':0x0,'rows':[]};var _0x5781e9=_[_0x6dc5('0x26')](db[_0x6dc5('0x27')][_0x6dc5('0x28')],function(_0x185087){return{'name':_0x185087[_0x6dc5('0x29')],'type':_0x185087['type'][_0x6dc5('0x2a')]};});_0x5366d3[_0x6dc5('0x2b')]=_[_0x6dc5('0x26')](_0x5781e9,_0x6dc5('0x23'));_0x5366d3[_0x6dc5('0x2c')]=_['keys'](_0x3ba909[_0x6dc5('0x2c')]);_0x5366d3[_0x6dc5('0x2d')]=_[_0x6dc5('0x2e')](_0x5366d3[_0x6dc5('0x2b')],_0x5366d3['query']);_0x70ff2e['attributes']=_[_0x6dc5('0x2e')](_0x5366d3[_0x6dc5('0x2b')],qs[_0x6dc5('0x2f')](_0x3ba909[_0x6dc5('0x2c')][_0x6dc5('0x2f')]));_0x70ff2e['attributes']=_0x70ff2e[_0x6dc5('0x30')]['length']?_0x70ff2e[_0x6dc5('0x30')]:_0x5366d3[_0x6dc5('0x2b')];if(!_0x3ba909[_0x6dc5('0x2c')]['hasOwnProperty'](_0x6dc5('0x31'))){_0x70ff2e[_0x6dc5('0x1a')]=qs[_0x6dc5('0x1a')](_0x3ba909[_0x6dc5('0x2c')]['limit']);_0x70ff2e[_0x6dc5('0x19')]=qs[_0x6dc5('0x19')](_0x3ba909[_0x6dc5('0x2c')][_0x6dc5('0x19')]);}_0x70ff2e[_0x6dc5('0x32')]=qs[_0x6dc5('0x33')](_0x3ba909[_0x6dc5('0x2c')][_0x6dc5('0x33')]);_0x70ff2e[_0x6dc5('0x34')]=qs[_0x6dc5('0x2d')](_['pick'](_0x3ba909[_0x6dc5('0x2c')],_0x5366d3[_0x6dc5('0x2d')]));if(_0x3ba909[_0x6dc5('0x2c')][_0x6dc5('0x35')]){_0x70ff2e[_0x6dc5('0x34')]=_[_0x6dc5('0x36')](_0x70ff2e[_0x6dc5('0x34')],{'$or':_['map'](_0x5781e9,function(_0x220e01){if(_0x220e01['type']!=='VIRTUAL'){var _0x3f5d4e={};_0x3f5d4e[_0x220e01[_0x6dc5('0x23')]]={'$like':'%'+_0x3ba909[_0x6dc5('0x2c')][_0x6dc5('0x35')]+'%'};return _0x3f5d4e;}})});}_0x70ff2e=_[_0x6dc5('0x36')]({},_0x70ff2e,_0x3ba909['options']);var _0x30f2e4={'where':_0x70ff2e[_0x6dc5('0x34')]};return db[_0x6dc5('0x27')][_0x6dc5('0x18')](_0x30f2e4)[_0x6dc5('0x1f')](function(_0x360aed){_0x4eb6c6[_0x6dc5('0x18')]=_0x360aed;if(_0x3ba909['query'][_0x6dc5('0x37')]){_0x70ff2e[_0x6dc5('0x38')]=[{'all':!![]}];}return db[_0x6dc5('0x27')][_0x6dc5('0x39')](_0x70ff2e);})[_0x6dc5('0x1f')](function(_0x21f5be){_0x4eb6c6[_0x6dc5('0x3a')]=_0x21f5be;return _0x4eb6c6;})[_0x6dc5('0x1f')](respondWithFilteredResult(_0x560572,_0x70ff2e))[_0x6dc5('0x3b')](handleError(_0x560572,null));};exports[_0x6dc5('0x3c')]=function(_0x1bfd81,_0x3eefd5){var _0xc4d2d6={'raw':!![],'where':{'id':_0x1bfd81[_0x6dc5('0x3d')]['id']}},_0x283a70={};_0x283a70['model']=_[_0x6dc5('0x3e')](db[_0x6dc5('0x27')][_0x6dc5('0x28')]);_0x283a70[_0x6dc5('0x2c')]=_[_0x6dc5('0x3e')](_0x1bfd81[_0x6dc5('0x2c')]);_0x283a70['filters']=_[_0x6dc5('0x2e')](_0x283a70[_0x6dc5('0x2b')],_0x283a70[_0x6dc5('0x2c')]);_0xc4d2d6[_0x6dc5('0x30')]=_[_0x6dc5('0x2e')](_0x283a70[_0x6dc5('0x2b')],qs[_0x6dc5('0x2f')](_0x1bfd81[_0x6dc5('0x2c')][_0x6dc5('0x2f')]));_0xc4d2d6[_0x6dc5('0x30')]=_0xc4d2d6[_0x6dc5('0x30')][_0x6dc5('0x3f')]?_0xc4d2d6['attributes']:_0x283a70[_0x6dc5('0x2b')];if(_0x1bfd81[_0x6dc5('0x2c')][_0x6dc5('0x37')]){_0xc4d2d6[_0x6dc5('0x38')]=[{'all':!![]}];}_0xc4d2d6=_[_0x6dc5('0x36')]({},_0xc4d2d6,_0x1bfd81['options']);return db[_0x6dc5('0x27')][_0x6dc5('0x40')](_0xc4d2d6)['then'](handleEntityNotFound(_0x3eefd5,null))[_0x6dc5('0x1f')](respondWithResult(_0x3eefd5,null))[_0x6dc5('0x3b')](handleError(_0x3eefd5,null));};exports[_0x6dc5('0x41')]=function(_0x572c07,_0x4c74ad){return db[_0x6dc5('0x27')][_0x6dc5('0x41')](_0x572c07['body'],{})[_0x6dc5('0x1f')](respondWithResult(_0x4c74ad,0xc9))[_0x6dc5('0x3b')](handleError(_0x4c74ad,null));};exports[_0x6dc5('0x1e')]=function(_0x5de2d6,_0x274849){if(_0x5de2d6['body']['id']){delete _0x5de2d6['body']['id'];}return db[_0x6dc5('0x27')]['find']({'where':{'id':_0x5de2d6[_0x6dc5('0x3d')]['id']}})['then'](handleEntityNotFound(_0x274849,null))[_0x6dc5('0x1f')](saveUpdates(_0x5de2d6[_0x6dc5('0x42')],null))[_0x6dc5('0x1f')](respondWithResult(_0x274849,null))['catch'](handleError(_0x274849,null));};exports[_0x6dc5('0x20')]=function(_0x475fe9,_0x41399a){return db['JscriptySessionReport'][_0x6dc5('0x40')]({'where':{'id':_0x475fe9[_0x6dc5('0x3d')]['id']}})[_0x6dc5('0x1f')](handleEntityNotFound(_0x41399a,null))[_0x6dc5('0x1f')](removeEntity(_0x41399a,null))[_0x6dc5('0x3b')](handleError(_0x41399a,null));};exports[_0x6dc5('0x43')]=function(_0x6921a2,_0xc5f3cd){return db['JscriptySessionReport']['describe']()[_0x6dc5('0x1f')](respondWithResult(_0xc5f3cd,null))[_0x6dc5('0x3b')](handleError(_0xc5f3cd,null));};exports[_0x6dc5('0x44')]=function(_0x59edc7,_0xc7f684,_0x160b29){var _0x2e94c4={'raw':!![],'where':{}};var _0x33e2a9={};var _0x2402f2={'count':0x0,'rows':[]};return db[_0x6dc5('0x27')][_0x6dc5('0x45')]({'where':{'id':_0x59edc7[_0x6dc5('0x3d')]['id']}})[_0x6dc5('0x1f')](handleEntityNotFound(_0xc7f684,null))['then'](function(_0x577c4f){if(_0x577c4f){_0x33e2a9[_0x6dc5('0x2b')]=_['keys'](db[_0x6dc5('0x46')][_0x6dc5('0x28')]);_0x33e2a9[_0x6dc5('0x2c')]=_[_0x6dc5('0x3e')](_0x59edc7[_0x6dc5('0x2c')]);_0x33e2a9[_0x6dc5('0x2d')]=_[_0x6dc5('0x2e')](_0x33e2a9[_0x6dc5('0x2b')],_0x33e2a9[_0x6dc5('0x2c')]);_0x2e94c4[_0x6dc5('0x30')]=_[_0x6dc5('0x2e')](_0x33e2a9[_0x6dc5('0x2b')],qs[_0x6dc5('0x2f')](_0x59edc7[_0x6dc5('0x2c')][_0x6dc5('0x2f')]));_0x2e94c4[_0x6dc5('0x30')]=_0x2e94c4[_0x6dc5('0x30')]['length']?_0x2e94c4['attributes']:_0x33e2a9['model'];if(!_0x59edc7['query'][_0x6dc5('0x47')](_0x6dc5('0x31'))){_0x2e94c4['limit']=qs[_0x6dc5('0x1a')](_0x59edc7['query']['limit']);_0x2e94c4[_0x6dc5('0x19')]=qs[_0x6dc5('0x19')](_0x59edc7[_0x6dc5('0x2c')]['offset']);}_0x2e94c4[_0x6dc5('0x32')]=qs[_0x6dc5('0x33')](_0x59edc7[_0x6dc5('0x2c')][_0x6dc5('0x33')]);_0x2e94c4[_0x6dc5('0x34')]=qs[_0x6dc5('0x2d')](_['pick'](_0x59edc7[_0x6dc5('0x2c')],_0x33e2a9[_0x6dc5('0x2d')]));_0x2e94c4[_0x6dc5('0x34')]['SessionId']=_0x577c4f['id'];if(_0x59edc7[_0x6dc5('0x2c')][_0x6dc5('0x35')]){_0x2e94c4[_0x6dc5('0x34')]=_[_0x6dc5('0x36')](_0x2e94c4['where'],{'$or':_[_0x6dc5('0x26')](_0x2e94c4['attributes'],function(_0x13fec2){var _0x5d3cf0={};_0x5d3cf0[_0x13fec2]={'$like':'%'+_0x59edc7[_0x6dc5('0x2c')][_0x6dc5('0x35')]+'%'};return _0x5d3cf0;})});}_0x2e94c4=_['merge']({},_0x2e94c4,_0x59edc7[_0x6dc5('0x48')]);return db[_0x6dc5('0x46')][_0x6dc5('0x18')]({'where':_0x2e94c4['where']})['then'](function(_0x426e61){_0x2402f2[_0x6dc5('0x18')]=_0x426e61;if(_0x59edc7[_0x6dc5('0x2c')][_0x6dc5('0x37')]){_0x2e94c4['include']=[{'all':!![]}];}return db[_0x6dc5('0x46')]['findAll'](_0x2e94c4);})[_0x6dc5('0x1f')](function(_0x378701){_0x2402f2[_0x6dc5('0x3a')]=_0x378701;return _0x2402f2;});}})[_0x6dc5('0x1f')](respondWithFilteredResult(_0xc7f684,_0x2e94c4))[_0x6dc5('0x3b')](handleError(_0xc7f684,null));}; \ No newline at end of file +var _0xd9cf=['key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filters','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','show','find','create','body','catch','describe','getQuestions','findOne','params','order','SessionId','JscriptyQuestionReport','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','api','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','JscriptySessionReport','rawAttributes','fieldName'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xd9cf,0x177));var _0xfd9c=function(_0x31553e,_0x43fc0d){_0x31553e=_0x31553e-0x0;var _0x265759=_0xd9cf[_0x31553e];return _0x265759;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xfd9c('0x0'));var zipdir=require(_0xfd9c('0x1'));var jsonpatch=require(_0xfd9c('0x2'));var rp=require(_0xfd9c('0x3'));var moment=require(_0xfd9c('0x4'));var BPromise=require(_0xfd9c('0x5'));var Mustache=require(_0xfd9c('0x6'));var util=require(_0xfd9c('0x7'));var path=require(_0xfd9c('0x8'));var sox=require(_0xfd9c('0x9'));var csv=require(_0xfd9c('0xa'));var ejs=require(_0xfd9c('0xb'));var fs=require('fs');var _=require(_0xfd9c('0xc'));var squel=require(_0xfd9c('0xd'));var crypto=require(_0xfd9c('0xe'));var jsforce=require(_0xfd9c('0xf'));var deskjs=require(_0xfd9c('0x10'));var toCsv=require(_0xfd9c('0xa'));var querystring=require(_0xfd9c('0x11'));var Papa=require(_0xfd9c('0x12'));var Redis=require(_0xfd9c('0x13'));var authService=require(_0xfd9c('0x14'));var qs=require(_0xfd9c('0x15'));var as=require(_0xfd9c('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xfd9c('0x17'));var utils=require(_0xfd9c('0x18'));var config=require('../../config/environment');var db=require(_0xfd9c('0x19'))['db'];function respondWithStatusCode(_0x193dae,_0x2349df){_0x2349df=_0x2349df||0xcc;return function(_0x55743f){if(_0x55743f){return _0x193dae['sendStatus'](_0x2349df);}return _0x193dae['status'](_0x2349df)[_0xfd9c('0x1a')]();};}function respondWithResult(_0x49cc7b,_0x58b0c1){_0x58b0c1=_0x58b0c1||0xc8;return function(_0x3b3871){if(_0x3b3871){return _0x49cc7b[_0xfd9c('0x1b')](_0x58b0c1)[_0xfd9c('0x1c')](_0x3b3871);}};}function respondWithFilteredResult(_0x439925,_0x4fca91){return function(_0x53f032){if(_0x53f032){var _0x2ced03=_0x53f032[_0xfd9c('0x1d')],_0x11b846=_0x4fca91[_0xfd9c('0x1e')],_0xeba69b=_0x4fca91[_0xfd9c('0x1e')]+_0x4fca91[_0xfd9c('0x1f')],_0x64d8b2;if(_0xeba69b>=_0x2ced03){_0xeba69b=_0x2ced03;_0x64d8b2=0xc8;}else{_0x64d8b2=0xce;}_0x439925['status'](_0x64d8b2);return _0x439925[_0xfd9c('0x20')](_0xfd9c('0x21'),_0x11b846+'-'+_0xeba69b+'/'+_0x2ced03)[_0xfd9c('0x1c')](_0x53f032);}return null;};}function patchUpdates(_0x5558ec){return function(_0x3d043a){try{jsonpatch[_0xfd9c('0x22')](_0x3d043a,_0x5558ec,!![]);}catch(_0x21a5d5){return BPromise[_0xfd9c('0x23')](_0x21a5d5);}return _0x3d043a[_0xfd9c('0x24')]();};}function saveUpdates(_0x539fbe,_0x18d161){return function(_0x116b20){if(_0x116b20){return _0x116b20[_0xfd9c('0x25')](_0x539fbe)[_0xfd9c('0x26')](function(_0x458204){return _0x458204;});}return null;};}function removeEntity(_0x1e353c,_0x8a3df2){return function(_0x56552d){if(_0x56552d){return _0x56552d[_0xfd9c('0x27')]()[_0xfd9c('0x26')](function(){_0x1e353c[_0xfd9c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d625b,_0x21fcb6){return function(_0x4c7eb1){if(!_0x4c7eb1){_0x5d625b[_0xfd9c('0x28')](0x194);}return _0x4c7eb1;};}function handleError(_0x4ca16c,_0x5279d0){_0x5279d0=_0x5279d0||0x1f4;return function(_0x2809ff){logger[_0xfd9c('0x29')](_0x2809ff[_0xfd9c('0x2a')]);if(_0x2809ff[_0xfd9c('0x2b')]){delete _0x2809ff[_0xfd9c('0x2b')];}_0x4ca16c[_0xfd9c('0x1b')](_0x5279d0)[_0xfd9c('0x2c')](_0x2809ff);};}exports[_0xfd9c('0x2d')]=function(_0x74d99b,_0x11902f){var _0x58eddf={},_0x50795f={},_0x567e25={'count':0x0,'rows':[]};var _0x2e9542=_[_0xfd9c('0x2e')](db[_0xfd9c('0x2f')][_0xfd9c('0x30')],function(_0x127002){return{'name':_0x127002[_0xfd9c('0x31')],'type':_0x127002['type'][_0xfd9c('0x32')]};});_0x50795f[_0xfd9c('0x33')]=_[_0xfd9c('0x2e')](_0x2e9542,_0xfd9c('0x2b'));_0x50795f[_0xfd9c('0x34')]=_[_0xfd9c('0x35')](_0x74d99b[_0xfd9c('0x34')]);_0x50795f['filters']=_[_0xfd9c('0x36')](_0x50795f[_0xfd9c('0x33')],_0x50795f[_0xfd9c('0x34')]);_0x58eddf['attributes']=_['intersection'](_0x50795f[_0xfd9c('0x33')],qs[_0xfd9c('0x37')](_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x37')]));_0x58eddf[_0xfd9c('0x38')]=_0x58eddf[_0xfd9c('0x38')][_0xfd9c('0x39')]?_0x58eddf[_0xfd9c('0x38')]:_0x50795f[_0xfd9c('0x33')];if(!_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x3a')](_0xfd9c('0x3b'))){_0x58eddf[_0xfd9c('0x1f')]=qs[_0xfd9c('0x1f')](_0x74d99b['query'][_0xfd9c('0x1f')]);_0x58eddf[_0xfd9c('0x1e')]=qs[_0xfd9c('0x1e')](_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x1e')]);}_0x58eddf['order']=qs[_0xfd9c('0x3c')](_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x3c')]);_0x58eddf[_0xfd9c('0x3d')]=qs[_0xfd9c('0x3e')](_[_0xfd9c('0x3f')](_0x74d99b[_0xfd9c('0x34')],_0x50795f[_0xfd9c('0x3e')]));if(_0x74d99b[_0xfd9c('0x34')]['filter']){_0x58eddf[_0xfd9c('0x3d')]=_['merge'](_0x58eddf[_0xfd9c('0x3d')],{'$or':_[_0xfd9c('0x2e')](_0x2e9542,function(_0xa621ed){if(_0xa621ed[_0xfd9c('0x40')]!==_0xfd9c('0x41')){var _0x46bff1={};_0x46bff1[_0xa621ed[_0xfd9c('0x2b')]]={'$like':'%'+_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x42')]+'%'};return _0x46bff1;}})});}_0x58eddf=_[_0xfd9c('0x43')]({},_0x58eddf,_0x74d99b[_0xfd9c('0x44')]);var _0x5116f5={'where':_0x58eddf[_0xfd9c('0x3d')]};return db['JscriptySessionReport'][_0xfd9c('0x1d')](_0x5116f5)[_0xfd9c('0x26')](function(_0x2535c5){_0x567e25[_0xfd9c('0x1d')]=_0x2535c5;if(_0x74d99b[_0xfd9c('0x34')][_0xfd9c('0x45')]){_0x58eddf[_0xfd9c('0x46')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xfd9c('0x47')](_0x58eddf);})['then'](function(_0x274021){_0x567e25[_0xfd9c('0x48')]=_0x274021;return _0x567e25;})[_0xfd9c('0x26')](respondWithFilteredResult(_0x11902f,_0x58eddf))['catch'](handleError(_0x11902f,null));};exports[_0xfd9c('0x49')]=function(_0x47cc30,_0x891796){var _0x1cc1e4={'raw':!![],'where':{'id':_0x47cc30['params']['id']}},_0x40b237={};_0x40b237['model']=_[_0xfd9c('0x35')](db['JscriptySessionReport']['rawAttributes']);_0x40b237[_0xfd9c('0x34')]=_['keys'](_0x47cc30['query']);_0x40b237[_0xfd9c('0x3e')]=_[_0xfd9c('0x36')](_0x40b237[_0xfd9c('0x33')],_0x40b237[_0xfd9c('0x34')]);_0x1cc1e4[_0xfd9c('0x38')]=_[_0xfd9c('0x36')](_0x40b237[_0xfd9c('0x33')],qs[_0xfd9c('0x37')](_0x47cc30['query']['fields']));_0x1cc1e4['attributes']=_0x1cc1e4[_0xfd9c('0x38')][_0xfd9c('0x39')]?_0x1cc1e4[_0xfd9c('0x38')]:_0x40b237[_0xfd9c('0x33')];if(_0x47cc30['query'][_0xfd9c('0x45')]){_0x1cc1e4['include']=[{'all':!![]}];}_0x1cc1e4=_[_0xfd9c('0x43')]({},_0x1cc1e4,_0x47cc30['options']);return db[_0xfd9c('0x2f')][_0xfd9c('0x4a')](_0x1cc1e4)[_0xfd9c('0x26')](handleEntityNotFound(_0x891796,null))[_0xfd9c('0x26')](respondWithResult(_0x891796,null))['catch'](handleError(_0x891796,null));};exports['create']=function(_0x395da3,_0x1ff5df){return db[_0xfd9c('0x2f')][_0xfd9c('0x4b')](_0x395da3['body'],{})['then'](respondWithResult(_0x1ff5df,0xc9))['catch'](handleError(_0x1ff5df,null));};exports['update']=function(_0xba4768,_0x524ca8){if(_0xba4768[_0xfd9c('0x4c')]['id']){delete _0xba4768[_0xfd9c('0x4c')]['id'];}return db[_0xfd9c('0x2f')]['find']({'where':{'id':_0xba4768['params']['id']}})[_0xfd9c('0x26')](handleEntityNotFound(_0x524ca8,null))['then'](saveUpdates(_0xba4768[_0xfd9c('0x4c')],null))[_0xfd9c('0x26')](respondWithResult(_0x524ca8,null))[_0xfd9c('0x4d')](handleError(_0x524ca8,null));};exports[_0xfd9c('0x27')]=function(_0xce08d8,_0x5242b4){return db[_0xfd9c('0x2f')][_0xfd9c('0x4a')]({'where':{'id':_0xce08d8['params']['id']}})[_0xfd9c('0x26')](handleEntityNotFound(_0x5242b4,null))[_0xfd9c('0x26')](removeEntity(_0x5242b4,null))[_0xfd9c('0x4d')](handleError(_0x5242b4,null));};exports[_0xfd9c('0x4e')]=function(_0x193bd3,_0x3ac643){return db[_0xfd9c('0x2f')][_0xfd9c('0x4e')]()[_0xfd9c('0x26')](respondWithResult(_0x3ac643,null))[_0xfd9c('0x4d')](handleError(_0x3ac643,null));};exports[_0xfd9c('0x4f')]=function(_0x3df547,_0x473a63,_0x230456){var _0x1b5b7e={'raw':!![],'where':{}};var _0x5d137f={};var _0x1a8b2b={'count':0x0,'rows':[]};return db[_0xfd9c('0x2f')][_0xfd9c('0x50')]({'where':{'id':_0x3df547[_0xfd9c('0x51')]['id']}})[_0xfd9c('0x26')](handleEntityNotFound(_0x473a63,null))['then'](function(_0x333214){if(_0x333214){_0x5d137f['model']=_['keys'](db['JscriptyQuestionReport'][_0xfd9c('0x30')]);_0x5d137f[_0xfd9c('0x34')]=_[_0xfd9c('0x35')](_0x3df547[_0xfd9c('0x34')]);_0x5d137f[_0xfd9c('0x3e')]=_[_0xfd9c('0x36')](_0x5d137f[_0xfd9c('0x33')],_0x5d137f[_0xfd9c('0x34')]);_0x1b5b7e[_0xfd9c('0x38')]=_[_0xfd9c('0x36')](_0x5d137f[_0xfd9c('0x33')],qs[_0xfd9c('0x37')](_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x37')]));_0x1b5b7e[_0xfd9c('0x38')]=_0x1b5b7e['attributes'][_0xfd9c('0x39')]?_0x1b5b7e[_0xfd9c('0x38')]:_0x5d137f[_0xfd9c('0x33')];if(!_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x3a')](_0xfd9c('0x3b'))){_0x1b5b7e[_0xfd9c('0x1f')]=qs['limit'](_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x1f')]);_0x1b5b7e['offset']=qs[_0xfd9c('0x1e')](_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x1e')]);}_0x1b5b7e[_0xfd9c('0x52')]=qs['sort'](_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x3c')]);_0x1b5b7e[_0xfd9c('0x3d')]=qs[_0xfd9c('0x3e')](_[_0xfd9c('0x3f')](_0x3df547['query'],_0x5d137f[_0xfd9c('0x3e')]));_0x1b5b7e[_0xfd9c('0x3d')][_0xfd9c('0x53')]=_0x333214['id'];if(_0x3df547[_0xfd9c('0x34')]['filter']){_0x1b5b7e['where']=_['merge'](_0x1b5b7e[_0xfd9c('0x3d')],{'$or':_[_0xfd9c('0x2e')](_0x1b5b7e[_0xfd9c('0x38')],function(_0x240a17){var _0x49f34d={};_0x49f34d[_0x240a17]={'$like':'%'+_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x42')]+'%'};return _0x49f34d;})});}_0x1b5b7e=_[_0xfd9c('0x43')]({},_0x1b5b7e,_0x3df547[_0xfd9c('0x44')]);return db[_0xfd9c('0x54')]['count']({'where':_0x1b5b7e['where']})[_0xfd9c('0x26')](function(_0xfdaaf8){_0x1a8b2b[_0xfd9c('0x1d')]=_0xfdaaf8;if(_0x3df547[_0xfd9c('0x34')][_0xfd9c('0x45')]){_0x1b5b7e[_0xfd9c('0x46')]=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0xfd9c('0x47')](_0x1b5b7e);})[_0xfd9c('0x26')](function(_0xb48c53){_0x1a8b2b[_0xfd9c('0x48')]=_0xb48c53;return _0x1a8b2b;});}})['then'](respondWithFilteredResult(_0x473a63,_0x1b5b7e))[_0xfd9c('0x4d')](handleError(_0x473a63,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index b7451e8..b4a052c 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 _0x8fbe=['../../config/logger','moment','request-promise','path','rimraf','./jscriptySessionReport.attributes','exports','define','lodash','util'];(function(_0x433226,_0x43928c){var _0x5a9e21=function(_0x376ea8){while(--_0x376ea8){_0x433226['push'](_0x433226['shift']());}};_0x5a9e21(++_0x43928c);}(_0x8fbe,0x10c));var _0xe8fb=function(_0x3fe559,_0x51f61d){_0x3fe559=_0x3fe559-0x0;var _0x41d119=_0x8fbe[_0x3fe559];return _0x41d119;};'use strict';var _=require(_0xe8fb('0x0'));var util=require(_0xe8fb('0x1'));var logger=require(_0xe8fb('0x2'))('api');var moment=require(_0xe8fb('0x3'));var BPromise=require('bluebird');var rp=require(_0xe8fb('0x4'));var fs=require('fs');var path=require(_0xe8fb('0x5'));var rimraf=require(_0xe8fb('0x6'));var config=require('../../config/environment');var attributes=require(_0xe8fb('0x7'));module[_0xe8fb('0x8')]=function(_0x4ca7b1,_0x55bd47){return _0x4ca7b1[_0xe8fb('0x9')]('JscriptySessionReport',attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a06=['exports','JscriptySessionReport','lodash','util','api','request-promise','../../config/environment','./jscriptySessionReport.attributes'];(function(_0x2808d9,_0x2dd004){var _0x47a0d6=function(_0x2af595){while(--_0x2af595){_0x2808d9['push'](_0x2808d9['shift']());}};_0x47a0d6(++_0x2dd004);}(_0x6a06,0x6a));var _0x66a0=function(_0x1b6563,_0x3bf0f1){_0x1b6563=_0x1b6563-0x0;var _0xdea7b8=_0x6a06[_0x1b6563];return _0xdea7b8;};'use strict';var _=require(_0x66a0('0x0'));var util=require(_0x66a0('0x1'));var logger=require('../../config/logger')(_0x66a0('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x66a0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x66a0('0x4'));var attributes=require(_0x66a0('0x5'));module[_0x66a0('0x6')]=function(_0x11adf1,_0x8a87a9){return _0x11adf1['define'](_0x66a0('0x7'),attributes,{'tableName':'report_jscripty_sessions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index 0958c3d..9c6fa9b 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 _0x770f=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptySessionReport,\x20%s,\x20%s','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','lodash'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x770f,0xef));var _0xf770=function(_0xa990b7,_0x26c527){_0xa990b7=_0xa990b7-0x0;var _0x52c99c=_0x770f[_0xa990b7];return _0x52c99c;};'use strict';var _=require(_0xf770('0x0'));var util=require(_0xf770('0x1'));var moment=require(_0xf770('0x2'));var BPromise=require(_0xf770('0x3'));var rs=require(_0xf770('0x4'));var fs=require('fs');var Redis=require(_0xf770('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xf770('0x6'));var logger=require(_0xf770('0x7'))('rpc');var config=require(_0xf770('0x8'));var jayson=require(_0xf770('0x9'));var client=jayson[_0xf770('0xa')][_0xf770('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5b2631,_0x878f6b,_0x235f8b){return new BPromise(function(_0x5b620d,_0x494872){return client[_0xf770('0xc')](_0x5b2631,_0x235f8b)[_0xf770('0xd')](function(_0x12f41a){logger[_0xf770('0xe')](_0xf770('0xf'),_0x878f6b,'request\x20sent');logger[_0xf770('0x10')](_0xf770('0x11'),_0x878f6b,'request\x20sent',JSON[_0xf770('0x12')](_0x12f41a));if(_0x12f41a['error']){if(_0x12f41a[_0xf770('0x13')][_0xf770('0x14')]===0x1f4){logger[_0xf770('0x13')](_0xf770('0xf'),_0x878f6b,_0x12f41a['error'][_0xf770('0x15')]);return _0x494872(_0x12f41a['error'][_0xf770('0x15')]);}logger[_0xf770('0x13')](_0xf770('0xf'),_0x878f6b,_0x12f41a['error']['message']);return _0x5b620d(_0x12f41a[_0xf770('0x13')]['message']);}else{logger[_0xf770('0xe')](_0xf770('0xf'),_0x878f6b,_0xf770('0x16'));_0x5b620d(_0x12f41a[_0xf770('0x17')][_0xf770('0x15')]);}})['catch'](function(_0x33b318){logger[_0xf770('0x13')](_0xf770('0xf'),_0x878f6b,_0x33b318);_0x494872(_0x33b318);});});} \ No newline at end of file +var _0x5f25=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash'];(function(_0x26b675,_0x1d8266){var _0x2ddfac=function(_0x1664b5){while(--_0x1664b5){_0x26b675['push'](_0x26b675['shift']());}};_0x2ddfac(++_0x1d8266);}(_0x5f25,0x1cb));var _0x55f2=function(_0x32e649,_0x228649){_0x32e649=_0x32e649-0x0;var _0x14d386=_0x5f25[_0x32e649];return _0x14d386;};'use strict';var _=require(_0x55f2('0x0'));var util=require(_0x55f2('0x1'));var moment=require(_0x55f2('0x2'));var BPromise=require(_0x55f2('0x3'));var rs=require(_0x55f2('0x4'));var fs=require('fs');var Redis=require(_0x55f2('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x55f2('0x6'));var logger=require('../../config/logger')(_0x55f2('0x7'));var config=require(_0x55f2('0x8'));var jayson=require(_0x55f2('0x9'));var client=jayson[_0x55f2('0xa')][_0x55f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48f061,_0x3f9799,_0x11b08d){return new BPromise(function(_0x569f24,_0x3be681){return client[_0x55f2('0xc')](_0x48f061,_0x11b08d)['then'](function(_0x3f4e94){logger[_0x55f2('0xd')](_0x55f2('0xe'),_0x3f9799,_0x55f2('0xf'));logger[_0x55f2('0x10')](_0x55f2('0x11'),_0x3f9799,_0x55f2('0xf'),JSON['stringify'](_0x3f4e94));if(_0x3f4e94[_0x55f2('0x12')]){if(_0x3f4e94[_0x55f2('0x12')][_0x55f2('0x13')]===0x1f4){logger[_0x55f2('0x12')](_0x55f2('0xe'),_0x3f9799,_0x3f4e94[_0x55f2('0x12')][_0x55f2('0x14')]);return _0x3be681(_0x3f4e94['error'][_0x55f2('0x14')]);}logger['error'](_0x55f2('0xe'),_0x3f9799,_0x3f4e94[_0x55f2('0x12')][_0x55f2('0x14')]);return _0x569f24(_0x3f4e94[_0x55f2('0x12')]['message']);}else{logger[_0x55f2('0xd')]('JscriptySessionReport,\x20%s,\x20%s',_0x3f9799,_0x55f2('0xf'));_0x569f24(_0x3f4e94[_0x55f2('0x15')][_0x55f2('0x14')]);}})[_0x55f2('0x16')](function(_0x1de03c){logger[_0x55f2('0x12')](_0x55f2('0xe'),_0x3f9799,_0x1de03c);_0x3be681(_0x1de03c);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 6dde66c..c5325a0 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 _0x23a7=['get','put','isAuthenticated','update','exports','multer','util','express','Router','../../components/auth/service','../../config/environment','./license.controller'];(function(_0x2c0b50,_0x5eb544){var _0x436ec3=function(_0x492f92){while(--_0x492f92){_0x2c0b50['push'](_0x2c0b50['shift']());}};_0x436ec3(++_0x5eb544);}(_0x23a7,0x149));var _0x723a=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x23a7[_0x6131cd];return _0x47e916;};'use strict';var multer=require(_0x723a('0x0'));var util=require(_0x723a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x723a('0x2'));var router=express[_0x723a('0x3')]();var auth=require(_0x723a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x723a('0x5'));var controller=require(_0x723a('0x6'));router[_0x723a('0x7')]('/',controller['index']);router[_0x723a('0x8')]('/:id',auth[_0x723a('0x9')](),controller[_0x723a('0xa')]);module[_0x723a('0xb')]=router; \ No newline at end of file +var _0x128f=['/:id','isAuthenticated','update','exports','util','connect-timeout','express','Router','./license.controller','index'];(function(_0x55d744,_0x57d2ab){var _0x4ce1b8=function(_0x1df765){while(--_0x1df765){_0x55d744['push'](_0x55d744['shift']());}};_0x4ce1b8(++_0x57d2ab);}(_0x128f,0x1ee));var _0xf128=function(_0x3553c9,_0x1f1d5a){_0x3553c9=_0x3553c9-0x0;var _0x495894=_0x128f[_0x3553c9];return _0x495894;};'use strict';var multer=require('multer');var util=require(_0xf128('0x0'));var path=require('path');var timeout=require(_0xf128('0x1'));var express=require(_0xf128('0x2'));var router=express[_0xf128('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf128('0x4'));router['get']('/',controller[_0xf128('0x5')]);router['put'](_0xf128('0x6'),auth[_0xf128('0x7')](),controller[_0xf128('0x8')]);module[_0xf128('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 9f4fb93..77a0903 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 _0xe14b=['exports','STRING','INTEGER','sequelize'];(function(_0x4a1640,_0x4557ec){var _0x36de11=function(_0x41e9f4){while(--_0x41e9f4){_0x4a1640['push'](_0x4a1640['shift']());}};_0x36de11(++_0x4557ec);}(_0xe14b,0x93));var _0xbe14=function(_0x3cd157,_0x577cb8){_0x3cd157=_0x3cd157-0x0;var _0x59e4a7=_0xe14b[_0x3cd157];return _0x59e4a7;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0xbe14('0x2')]},'chatLicenseExceeded':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0295=['sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0295,0x1f0));var _0x5029=function(_0x530191,_0x52edef){_0x530191=_0x530191-0x0;var _0x212d5d=_0x0295[_0x530191];return _0x212d5d;};'use strict';var Sequelize=require(_0x5029('0x0'));module['exports']={'license':{'type':Sequelize['TEXT']},'data1':{'type':Sequelize[_0x5029('0x1')]},'data2':{'type':Sequelize['STRING']},'chatLicenseExceeded':{'type':Sequelize['INTEGER'],'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 b22e9b8..7dea50b 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 _0x9f8f=['moment','bluebird','path','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','limit','status','set','apply','reject','destroy','then','error','stack','name','send','../../config/license/util','index','model','keys','rawAttributes','query','filters','attributes','fields','length','merge','catch','update','body','License','find','checkLicense','demo','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0xd32fd3,_0x1e6419){var _0x48d328=function(_0x4e78aa){while(--_0x4e78aa){_0xd32fd3['push'](_0xd32fd3['shift']());}};_0x48d328(++_0x1e6419);}(_0x9f8f,0xa3));var _0xf9f8=function(_0x14cd45,_0x49ddb3){_0x14cd45=_0x14cd45-0x0;var _0x2a05bf=_0x9f8f[_0x14cd45];return _0x2a05bf;};'use strict';var pdf=require(_0xf9f8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf9f8('0x1'));var zipdir=require(_0xf9f8('0x2'));var jsonpatch=require(_0xf9f8('0x3'));var rp=require(_0xf9f8('0x4'));var moment=require(_0xf9f8('0x5'));var BPromise=require(_0xf9f8('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf9f8('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xf9f8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xf9f8('0x9'));var deskjs=require(_0xf9f8('0xa'));var toCsv=require('to-csv');var querystring=require(_0xf9f8('0xb'));var Papa=require(_0xf9f8('0xc'));var Redis=require(_0xf9f8('0xd'));var authService=require(_0xf9f8('0xe'));var qs=require(_0xf9f8('0xf'));var as=require(_0xf9f8('0x10'));var hardwareService=require(_0xf9f8('0x11'));var logger=require(_0xf9f8('0x12'))(_0xf9f8('0x13'));var utils=require('../../config/utils');var config=require(_0xf9f8('0x14'));var db=require(_0xf9f8('0x15'))['db'];function respondWithStatusCode(_0x496af1,_0x4f9f81){_0x4f9f81=_0x4f9f81||0xcc;return function(_0x28cb0c){if(_0x28cb0c){return _0x496af1[_0xf9f8('0x16')](_0x4f9f81);}return _0x496af1['status'](_0x4f9f81)[_0xf9f8('0x17')]();};}function respondWithResult(_0x48dd90,_0x4b4834){_0x4b4834=_0x4b4834||0xc8;return function(_0xa10787){if(_0xa10787){return _0x48dd90['status'](_0x4b4834)[_0xf9f8('0x18')](_0xa10787);}};}function respondWithFilteredResult(_0x519a90,_0x2ff787){return function(_0x37b350){if(_0x37b350){var _0x5ece85=_0x37b350[_0xf9f8('0x19')],_0x57e3a0=_0x2ff787[_0xf9f8('0x1a')],_0x1b5cc6=_0x2ff787[_0xf9f8('0x1a')]+_0x2ff787[_0xf9f8('0x1b')],_0x3870f3;if(_0x1b5cc6>=_0x5ece85){_0x1b5cc6=_0x5ece85;_0x3870f3=0xc8;}else{_0x3870f3=0xce;}_0x519a90[_0xf9f8('0x1c')](_0x3870f3);return _0x519a90[_0xf9f8('0x1d')]('Content-Range',_0x57e3a0+'-'+_0x1b5cc6+'/'+_0x5ece85)['json'](_0x37b350);}return null;};}function patchUpdates(_0x45eb54){return function(_0x40ffb7){try{jsonpatch[_0xf9f8('0x1e')](_0x40ffb7,_0x45eb54,!![]);}catch(_0x36d889){return BPromise[_0xf9f8('0x1f')](_0x36d889);}return _0x40ffb7['save']();};}function saveUpdates(_0x4a999c,_0x2b4e19){return function(_0x2ad899){if(_0x2ad899){return _0x2ad899['update'](_0x4a999c)['then'](function(_0x2824cf){return _0x2824cf;});}return null;};}function removeEntity(_0x5321ea,_0x2c6603){return function(_0x44a79f){if(_0x44a79f){return _0x44a79f[_0xf9f8('0x20')]()[_0xf9f8('0x21')](function(){_0x5321ea['status'](0xcc)[_0xf9f8('0x17')]();});}};}function handleEntityNotFound(_0x5f3f66,_0x26db69){return function(_0xd57425){if(!_0xd57425){_0x5f3f66[_0xf9f8('0x16')](0x194);}return _0xd57425;};}function handleError(_0x58a670,_0x34d0ae){_0x34d0ae=_0x34d0ae||0x1f4;return function(_0xeefd63){logger[_0xf9f8('0x22')](_0xeefd63[_0xf9f8('0x23')]);if(_0xeefd63['name']){delete _0xeefd63[_0xf9f8('0x24')];}_0x58a670[_0xf9f8('0x1c')](_0x34d0ae)[_0xf9f8('0x25')](_0xeefd63);};}var utilLicense=require(_0xf9f8('0x26'));exports[_0xf9f8('0x27')]=function(_0x2481ac,_0x3a7e75){var _0x34a61c={'raw':!![],'where':{'id':0x1}},_0x271aaf={};_0x271aaf[_0xf9f8('0x28')]=_[_0xf9f8('0x29')](db['License'][_0xf9f8('0x2a')]);_0x271aaf[_0xf9f8('0x2b')]=_[_0xf9f8('0x29')](_0x2481ac[_0xf9f8('0x2b')]);_0x271aaf[_0xf9f8('0x2c')]=_['intersection'](_0x271aaf[_0xf9f8('0x28')],_0x271aaf[_0xf9f8('0x2b')]);_0x34a61c[_0xf9f8('0x2d')]=_['intersection'](_0x271aaf['model'],qs['fields'](_0x2481ac[_0xf9f8('0x2b')][_0xf9f8('0x2e')]));_0x34a61c[_0xf9f8('0x2d')]=_0x34a61c['attributes'][_0xf9f8('0x2f')]?_0x34a61c[_0xf9f8('0x2d')]:_0x271aaf[_0xf9f8('0x28')];_0x34a61c=_[_0xf9f8('0x30')]({},_0x34a61c,_0x2481ac['options']);return utilLicense['getLicense'](_0x34a61c)[_0xf9f8('0x21')](respondWithResult(_0x3a7e75,null))[_0xf9f8('0x31')](handleError(_0x3a7e75,null));};exports[_0xf9f8('0x32')]=function(_0x6f19c2,_0x5cae59){if(_0x6f19c2[_0xf9f8('0x33')]['id']){delete _0x6f19c2[_0xf9f8('0x33')]['id'];}return db[_0xf9f8('0x34')][_0xf9f8('0x35')]({'where':{'id':_0x6f19c2['params']['id']}})['then'](handleEntityNotFound(_0x5cae59,null))[_0xf9f8('0x21')](function(_0x3a802e){var _0x58bb83=_0x3a802e['get']({'plain':!![]});return utilLicense[_0xf9f8('0x36')](_0x58bb83,_0x6f19c2['body']['key']);})[_0xf9f8('0x21')](function(_0x39f9c5){if(!_0x39f9c5[_0xf9f8('0x37')]){return saveUpdates(_0x6f19c2['body'],null);}return _0x39f9c5;})[_0xf9f8('0x21')](respondWithResult(_0x5cae59,null))[_0xf9f8('0x31')](handleError(_0x5cae59,null));}; \ No newline at end of file +var _0x0ebc=['params','checkLicense','key','demo','eml-format','rimraf','zip-dir','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/environment','../../mysqldb','sendStatus','status','count','offset','limit','Content-Range','apply','reject','update','destroy','then','end','error','stack','name','send','../../config/license/util','index','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','merge','options','getLicense','catch','body','License','find'];(function(_0x167147,_0x4f8836){var _0x52dd77=function(_0x109d46){while(--_0x109d46){_0x167147['push'](_0x167147['shift']());}};_0x52dd77(++_0x4f8836);}(_0x0ebc,0x1ec));var _0xc0eb=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0ebc[_0xfae23b];return _0x200640;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xc0eb('0x0'));var rimraf=require(_0xc0eb('0x1'));var zipdir=require(_0xc0eb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc0eb('0x3'));var moment=require(_0xc0eb('0x4'));var BPromise=require(_0xc0eb('0x5'));var Mustache=require(_0xc0eb('0x6'));var util=require(_0xc0eb('0x7'));var path=require(_0xc0eb('0x8'));var sox=require(_0xc0eb('0x9'));var csv=require(_0xc0eb('0xa'));var ejs=require(_0xc0eb('0xb'));var fs=require('fs');var _=require(_0xc0eb('0xc'));var squel=require(_0xc0eb('0xd'));var crypto=require(_0xc0eb('0xe'));var jsforce=require(_0xc0eb('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xc0eb('0xa'));var querystring=require('querystring');var Papa=require(_0xc0eb('0x10'));var Redis=require(_0xc0eb('0x11'));var authService=require(_0xc0eb('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xc0eb('0x13'));var hardwareService=require(_0xc0eb('0x14'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0xc0eb('0x15'));var db=require(_0xc0eb('0x16'))['db'];function respondWithStatusCode(_0x57b915,_0x4f51b3){_0x4f51b3=_0x4f51b3||0xcc;return function(_0x2282ee){if(_0x2282ee){return _0x57b915[_0xc0eb('0x17')](_0x4f51b3);}return _0x57b915['status'](_0x4f51b3)['end']();};}function respondWithResult(_0x5ee12f,_0x1806db){_0x1806db=_0x1806db||0xc8;return function(_0x4f6c38){if(_0x4f6c38){return _0x5ee12f[_0xc0eb('0x18')](_0x1806db)['json'](_0x4f6c38);}};}function respondWithFilteredResult(_0x32a579,_0x3d16f6){return function(_0xf5f24b){if(_0xf5f24b){var _0x4107d2=_0xf5f24b[_0xc0eb('0x19')],_0x29ae3d=_0x3d16f6['offset'],_0x25691b=_0x3d16f6[_0xc0eb('0x1a')]+_0x3d16f6[_0xc0eb('0x1b')],_0x37a488;if(_0x25691b>=_0x4107d2){_0x25691b=_0x4107d2;_0x37a488=0xc8;}else{_0x37a488=0xce;}_0x32a579[_0xc0eb('0x18')](_0x37a488);return _0x32a579['set'](_0xc0eb('0x1c'),_0x29ae3d+'-'+_0x25691b+'/'+_0x4107d2)['json'](_0xf5f24b);}return null;};}function patchUpdates(_0x3dd128){return function(_0x55d200){try{jsonpatch[_0xc0eb('0x1d')](_0x55d200,_0x3dd128,!![]);}catch(_0x156525){return BPromise[_0xc0eb('0x1e')](_0x156525);}return _0x55d200['save']();};}function saveUpdates(_0x3e2519,_0x39ea4a){return function(_0x2ce6d8){if(_0x2ce6d8){return _0x2ce6d8[_0xc0eb('0x1f')](_0x3e2519)['then'](function(_0x4c61ef){return _0x4c61ef;});}return null;};}function removeEntity(_0x5dc65e,_0x1bfa6f){return function(_0x30f8e7){if(_0x30f8e7){return _0x30f8e7[_0xc0eb('0x20')]()[_0xc0eb('0x21')](function(){_0x5dc65e[_0xc0eb('0x18')](0xcc)[_0xc0eb('0x22')]();});}};}function handleEntityNotFound(_0x2fffc3,_0x2916da){return function(_0x5efa50){if(!_0x5efa50){_0x2fffc3[_0xc0eb('0x17')](0x194);}return _0x5efa50;};}function handleError(_0x5d5a2f,_0x12bf21){_0x12bf21=_0x12bf21||0x1f4;return function(_0x3c3adf){logger[_0xc0eb('0x23')](_0x3c3adf[_0xc0eb('0x24')]);if(_0x3c3adf[_0xc0eb('0x25')]){delete _0x3c3adf[_0xc0eb('0x25')];}_0x5d5a2f[_0xc0eb('0x18')](_0x12bf21)[_0xc0eb('0x26')](_0x3c3adf);};}var utilLicense=require(_0xc0eb('0x27'));exports[_0xc0eb('0x28')]=function(_0x31e610,_0x2afd43){var _0x16fdc4={'raw':!![],'where':{'id':0x1}},_0x26e231={};_0x26e231['model']=_[_0xc0eb('0x29')](db['License'][_0xc0eb('0x2a')]);_0x26e231[_0xc0eb('0x2b')]=_[_0xc0eb('0x29')](_0x31e610[_0xc0eb('0x2b')]);_0x26e231[_0xc0eb('0x2c')]=_[_0xc0eb('0x2d')](_0x26e231[_0xc0eb('0x2e')],_0x26e231[_0xc0eb('0x2b')]);_0x16fdc4['attributes']=_[_0xc0eb('0x2d')](_0x26e231['model'],qs[_0xc0eb('0x2f')](_0x31e610[_0xc0eb('0x2b')][_0xc0eb('0x2f')]));_0x16fdc4[_0xc0eb('0x30')]=_0x16fdc4['attributes'][_0xc0eb('0x31')]?_0x16fdc4[_0xc0eb('0x30')]:_0x26e231['model'];_0x16fdc4=_[_0xc0eb('0x32')]({},_0x16fdc4,_0x31e610[_0xc0eb('0x33')]);return utilLicense[_0xc0eb('0x34')](_0x16fdc4)[_0xc0eb('0x21')](respondWithResult(_0x2afd43,null))[_0xc0eb('0x35')](handleError(_0x2afd43,null));};exports['update']=function(_0x28658e,_0x1cc957){if(_0x28658e[_0xc0eb('0x36')]['id']){delete _0x28658e[_0xc0eb('0x36')]['id'];}return db[_0xc0eb('0x37')][_0xc0eb('0x38')]({'where':{'id':_0x28658e[_0xc0eb('0x39')]['id']}})['then'](handleEntityNotFound(_0x1cc957,null))['then'](function(_0x5ebae6){var _0xed10b2=_0x5ebae6['get']({'plain':!![]});return utilLicense[_0xc0eb('0x3a')](_0xed10b2,_0x28658e[_0xc0eb('0x36')][_0xc0eb('0x3b')]);})[_0xc0eb('0x21')](function(_0x2c0d24){if(!_0x2c0d24[_0xc0eb('0x3c')]){return saveUpdates(_0x28658e[_0xc0eb('0x36')],null);}return _0x2c0d24;})[_0xc0eb('0x21')](respondWithResult(_0x1cc957,null))['catch'](handleError(_0x1cc957,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index ba74fc0..347b0f1 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 _0x1bb8=['./license.attributes','exports','define','License','util','api','moment','request-promise','path','rimraf'];(function(_0x5bdcdb,_0x4ea804){var _0x44993c=function(_0xc7aa6f){while(--_0xc7aa6f){_0x5bdcdb['push'](_0x5bdcdb['shift']());}};_0x44993c(++_0x4ea804);}(_0x1bb8,0xc2));var _0x81bb=function(_0x362a20,_0x5a7836){_0x362a20=_0x362a20-0x0;var _0x2f1ee6=_0x1bb8[_0x362a20];return _0x2f1ee6;};'use strict';var _=require('lodash');var util=require(_0x81bb('0x0'));var logger=require('../../config/logger')(_0x81bb('0x1'));var moment=require(_0x81bb('0x2'));var BPromise=require('bluebird');var rp=require(_0x81bb('0x3'));var fs=require('fs');var path=require(_0x81bb('0x4'));var rimraf=require(_0x81bb('0x5'));var config=require('../../config/environment');var attributes=require(_0x81bb('0x6'));module[_0x81bb('0x7')]=function(_0x4e1b58,_0xca5837){return _0x4e1b58[_0x81bb('0x8')](_0x81bb('0x9'),attributes,{'tableName':'license','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe74d=['../../config/environment','./license.attributes','exports','define','License','license','lodash','util','moment','bluebird','request-promise','path'];(function(_0xa87a3e,_0x17eacf){var _0x2da434=function(_0x490061){while(--_0x490061){_0xa87a3e['push'](_0xa87a3e['shift']());}};_0x2da434(++_0x17eacf);}(_0xe74d,0x16e));var _0xde74=function(_0x2dc6eb,_0x439724){_0x2dc6eb=_0x2dc6eb-0x0;var _0x2faaf1=_0xe74d[_0x2dc6eb];return _0x2faaf1;};'use strict';var _=require(_0xde74('0x0'));var util=require(_0xde74('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xde74('0x2'));var BPromise=require(_0xde74('0x3'));var rp=require(_0xde74('0x4'));var fs=require('fs');var path=require(_0xde74('0x5'));var rimraf=require('rimraf');var config=require(_0xde74('0x6'));var attributes=require(_0xde74('0x7'));module[_0xde74('0x8')]=function(_0x328c43,_0x4800a3){return _0x328c43[_0xde74('0x9')](_0xde74('0xa'),attributes,{'tableName':_0xde74('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index 5fec3a2..e1c6351 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 _0xbaf0=['client','http','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var moment=require(_0x0baf('0x1'));var BPromise=require(_0x0baf('0x2'));var rs=require(_0x0baf('0x3'));var fs=require('fs');var Redis=require(_0x0baf('0x4'));var db=require(_0x0baf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0baf('0x6'))(_0x0baf('0x7'));var config=require(_0x0baf('0x8'));var jayson=require(_0x0baf('0x9'));var client=jayson[_0x0baf('0xa')][_0x0baf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1a10b1,_0x2dcaac,_0x1d0a0d){return new BPromise(function(_0x5f5030,_0x11b947){return client['request'](_0x1a10b1,_0x1d0a0d)[_0x0baf('0xc')](function(_0x2c7442){logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,_0x0baf('0xf'));logger[_0x0baf('0x10')](_0x0baf('0x11'),_0x2dcaac,_0x0baf('0xf'),JSON[_0x0baf('0x12')](_0x2c7442));if(_0x2c7442[_0x0baf('0x13')]){if(_0x2c7442[_0x0baf('0x13')]['code']===0x1f4){logger['error'](_0x0baf('0xe'),_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x11b947(_0x2c7442[_0x0baf('0x13')]['message']);}logger[_0x0baf('0x13')]('License,\x20%s,\x20%s',_0x2dcaac,_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);return _0x5f5030(_0x2c7442[_0x0baf('0x13')][_0x0baf('0x14')]);}else{logger[_0x0baf('0xd')](_0x0baf('0xe'),_0x2dcaac,'request\x20sent');_0x5f5030(_0x2c7442['result'][_0x0baf('0x14')]);}})[_0x0baf('0x15')](function(_0x283408){logger[_0x0baf('0x13')](_0x0baf('0xe'),_0x2dcaac,_0x283408);_0x11b947(_0x283408);});});} \ No newline at end of file +var _0x292b=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','info','License,\x20%s,\x20%s','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x2d2498,_0x26426d){var _0x447a5b=function(_0x2977e8){while(--_0x2977e8){_0x2d2498['push'](_0x2d2498['shift']());}};_0x447a5b(++_0x26426d);}(_0x292b,0x64));var _0xb292=function(_0x49aa7d,_0x5d46d8){_0x49aa7d=_0x49aa7d-0x0;var _0xdd0d26=_0x292b[_0x49aa7d];return _0xdd0d26;};'use strict';var _=require(_0xb292('0x0'));var util=require(_0xb292('0x1'));var moment=require(_0xb292('0x2'));var BPromise=require(_0xb292('0x3'));var rs=require(_0xb292('0x4'));var fs=require('fs');var Redis=require(_0xb292('0x5'));var db=require(_0xb292('0x6'))['db'];var utils=require(_0xb292('0x7'));var logger=require(_0xb292('0x8'))(_0xb292('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xb292('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x298571,_0xa511d8,_0x47fe8e){return new BPromise(function(_0x43f8b7,_0x253a58){return client['request'](_0x298571,_0x47fe8e)['then'](function(_0x40d2f5){logger[_0xb292('0xb')](_0xb292('0xc'),_0xa511d8,'request\x20sent');logger[_0xb292('0xd')](_0xb292('0xe'),_0xa511d8,_0xb292('0xf'),JSON[_0xb292('0x10')](_0x40d2f5));if(_0x40d2f5['error']){if(_0x40d2f5[_0xb292('0x11')][_0xb292('0x12')]===0x1f4){logger[_0xb292('0x11')](_0xb292('0xc'),_0xa511d8,_0x40d2f5['error'][_0xb292('0x13')]);return _0x253a58(_0x40d2f5[_0xb292('0x11')]['message']);}logger['error']('License,\x20%s,\x20%s',_0xa511d8,_0x40d2f5[_0xb292('0x11')][_0xb292('0x13')]);return _0x43f8b7(_0x40d2f5[_0xb292('0x11')][_0xb292('0x13')]);}else{logger[_0xb292('0xb')](_0xb292('0xc'),_0xa511d8,_0xb292('0xf'));_0x43f8b7(_0x40d2f5['result'][_0xb292('0x13')]);}})[_0xb292('0x14')](function(_0x386443){logger[_0xb292('0x11')](_0xb292('0xc'),_0xa511d8,_0x386443);_0x253a58(_0x386443);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 639f684..b76432a 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 _0x1ba3=['removeAgents','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','getImap','/:id/out_servers','/:id/interactions','getInteractions','/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','addDisposition','create','addImap','addSmtp','addInteraction','/:id/applications','addApplications','/:id/send','send','addAgents','put','/:id','update','delete','removeAnswers','removeImap','removeSmtp','destroy'];(function(_0x256b96,_0x160abc){var _0x3b5bb0=function(_0x5ae825){while(--_0x5ae825){_0x256b96['push'](_0x256b96['shift']());}};_0x3b5bb0(++_0x160abc);}(_0x1ba3,0x16a));var _0x31ba=function(_0x173452,_0x3aa870){_0x173452=_0x173452-0x0;var _0xee3fd0=_0x1ba3[_0x173452];return _0xee3fd0;};'use strict';var multer=require(_0x31ba('0x0'));var util=require(_0x31ba('0x1'));var path=require(_0x31ba('0x2'));var timeout=require('connect-timeout');var express=require(_0x31ba('0x3'));var router=express['Router']();var auth=require(_0x31ba('0x4'));var interaction=require(_0x31ba('0x5'));var config=require(_0x31ba('0x6'));var controller=require('./mailAccount.controller');router['get']('/',auth[_0x31ba('0x7')](),controller['index']);router[_0x31ba('0x8')](_0x31ba('0x9'),auth[_0x31ba('0x7')](),controller['describe']);router['get']('/:id',auth[_0x31ba('0x7')](),controller['show']);router['get'](_0x31ba('0xa'),auth[_0x31ba('0x7')](),controller[_0x31ba('0xb')]);router[_0x31ba('0x8')](_0x31ba('0xc'),auth[_0x31ba('0x7')](),controller[_0x31ba('0xd')]);router[_0x31ba('0x8')](_0x31ba('0xe'),auth['isAuthenticated'](),controller[_0x31ba('0xf')]);router[_0x31ba('0x8')](_0x31ba('0x10'),auth[_0x31ba('0x7')](),controller['getSmtp']);router['get'](_0x31ba('0x11'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x12')]);router[_0x31ba('0x8')]('/:id/applications',auth[_0x31ba('0x7')](),controller['getApplications']);router['get'](_0x31ba('0x13'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x14')]);router[_0x31ba('0x8')](_0x31ba('0x15'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x16')]);router[_0x31ba('0x8')](_0x31ba('0x17'),auth[_0x31ba('0x7')](),controller['getAgents']);router[_0x31ba('0x18')](_0x31ba('0xa'),auth['isAuthenticated'](),controller[_0x31ba('0x19')]);router['post'](_0x31ba('0xc'),auth['isAuthenticated'](),controller['addAnswer']);router[_0x31ba('0x18')]('/',auth['isAuthenticated'](),controller[_0x31ba('0x1a')]);router[_0x31ba('0x18')](_0x31ba('0xe'),auth['isAuthenticated'](),controller[_0x31ba('0x1b')]);router[_0x31ba('0x18')]('/:id/out_servers',auth[_0x31ba('0x7')](),controller[_0x31ba('0x1c')]);router['post']('/:id/interactions',auth[_0x31ba('0x7')](),controller[_0x31ba('0x1d')]);router[_0x31ba('0x18')](_0x31ba('0x1e'),auth['isAuthenticated'](),controller[_0x31ba('0x1f')]);router[_0x31ba('0x18')](_0x31ba('0x20'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x21')]);router[_0x31ba('0x18')](_0x31ba('0x17'),auth['isAuthenticated'](),controller[_0x31ba('0x22')]);router[_0x31ba('0x23')](_0x31ba('0x24'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x25')]);router[_0x31ba('0x26')](_0x31ba('0xa'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x31ba('0x26')](_0x31ba('0xc'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x27')]);router[_0x31ba('0x26')](_0x31ba('0xe'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x28')]);router[_0x31ba('0x26')]('/:id/out_servers',auth['isAuthenticated'](),controller[_0x31ba('0x29')]);router['delete'](_0x31ba('0x24'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x2a')]);router[_0x31ba('0x26')](_0x31ba('0x17'),auth[_0x31ba('0x7')](),controller[_0x31ba('0x2b')]);module[_0x31ba('0x2c')]=router; \ No newline at end of file +var _0x1f97=['getAnswers','getImap','/:id/out_servers','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','getAgents','post','addDisposition','addAnswer','create','/:id/in_servers','addImap','/:id/send','send','addAgents','put','removeDispositions','delete','removeAnswers','removeImap','destroy','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','/:id/canned_answers'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1f97,0x78));var _0x71f9=function(_0x169b08,_0x2bed60){_0x169b08=_0x169b08-0x0;var _0x2b23aa=_0x1f97[_0x169b08];return _0x2b23aa;};'use strict';var multer=require(_0x71f9('0x0'));var util=require(_0x71f9('0x1'));var path=require(_0x71f9('0x2'));var timeout=require(_0x71f9('0x3'));var express=require(_0x71f9('0x4'));var router=express[_0x71f9('0x5')]();var auth=require(_0x71f9('0x6'));var interaction=require(_0x71f9('0x7'));var config=require(_0x71f9('0x8'));var controller=require(_0x71f9('0x9'));router[_0x71f9('0xa')]('/',auth[_0x71f9('0xb')](),controller['index']);router['get'](_0x71f9('0xc'),auth[_0x71f9('0xb')](),controller[_0x71f9('0xd')]);router[_0x71f9('0xa')](_0x71f9('0xe'),auth[_0x71f9('0xb')](),controller[_0x71f9('0xf')]);router[_0x71f9('0xa')](_0x71f9('0x10'),auth[_0x71f9('0xb')](),controller['getDispositions']);router[_0x71f9('0xa')](_0x71f9('0x11'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x12')]);router[_0x71f9('0xa')]('/:id/in_servers',auth[_0x71f9('0xb')](),controller[_0x71f9('0x13')]);router[_0x71f9('0xa')](_0x71f9('0x14'),auth['isAuthenticated'](),controller[_0x71f9('0x15')]);router[_0x71f9('0xa')](_0x71f9('0x16'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x17')]);router[_0x71f9('0xa')](_0x71f9('0x18'),auth['isAuthenticated'](),controller[_0x71f9('0x19')]);router['get'](_0x71f9('0x1a'),auth['isAuthenticated'](),controller['getMessages']);router['get']('/:id/verify',auth[_0x71f9('0xb')](),controller['verifySmtp']);router['get']('/:id/users',auth[_0x71f9('0xb')](),controller[_0x71f9('0x1b')]);router[_0x71f9('0x1c')](_0x71f9('0x10'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x1d')]);router['post'](_0x71f9('0x11'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x1e')]);router['post']('/',auth[_0x71f9('0xb')](),controller[_0x71f9('0x1f')]);router['post'](_0x71f9('0x20'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x21')]);router[_0x71f9('0x1c')](_0x71f9('0x14'),auth[_0x71f9('0xb')](),controller['addSmtp']);router[_0x71f9('0x1c')]('/:id/interactions',auth['isAuthenticated'](),controller['addInteraction']);router[_0x71f9('0x1c')](_0x71f9('0x18'),auth['isAuthenticated'](),controller['addApplications']);router[_0x71f9('0x1c')](_0x71f9('0x22'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x23')]);router[_0x71f9('0x1c')]('/:id/users',auth[_0x71f9('0xb')](),controller[_0x71f9('0x24')]);router[_0x71f9('0x25')](_0x71f9('0xe'),auth[_0x71f9('0xb')](),controller['update']);router['delete'](_0x71f9('0x10'),auth['isAuthenticated'](),controller[_0x71f9('0x26')]);router[_0x71f9('0x27')](_0x71f9('0x11'),auth[_0x71f9('0xb')](),controller[_0x71f9('0x28')]);router['delete'](_0x71f9('0x20'),auth['isAuthenticated'](),controller[_0x71f9('0x29')]);router[_0x71f9('0x27')](_0x71f9('0x14'),auth[_0x71f9('0xb')](),controller['removeSmtp']);router[_0x71f9('0x27')]('/:id',auth[_0x71f9('0xb')](),controller[_0x71f9('0x2a')]);router[_0x71f9('0x27')](_0x71f9('0x2b'),auth['isAuthenticated'](),controller[_0x71f9('0x2c')]);module[_0x71f9('0x2d')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index ab6f394..b9afc56 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 _0x36d3=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','TEXT','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','exports','STRING','BOOLEAN'];(function(_0x3cb3cd,_0x51514a){var _0x2a6c29=function(_0x57fc10){while(--_0x57fc10){_0x3cb3cd['push'](_0x3cb3cd['shift']());}};_0x2a6c29(++_0x51514a);}(_0x36d3,0x75));var _0x336d=function(_0x312f43,_0x37a6aa){_0x312f43=_0x312f43-0x0;var _0x171d26=_0x36d3[_0x312f43];return _0x171d26;};'use strict';var Sequelize=require('sequelize');module[_0x336d('0x0')]={'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0x336d('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x336d('0x1')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize['TEXT']},'markAsUnread':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x336d('0x1')],'allowNull':![],'defaultValue':_0x336d('0x3')},'fontSize':{'type':Sequelize[_0x336d('0x4')](0x2)[_0x336d('0x5')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x336d('0x6')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}';}},'notificationSound':{'type':Sequelize[_0x336d('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x336d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x336d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x336d('0x4')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x336d('0x4')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x336d('0x2')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x13cb5e){if(!_0x13cb5e)this[_0x336d('0x7')](_0x336d('0x8'),null);this[_0x336d('0x7')](_0x336d('0x9'),_0x13cb5e);}}}; \ No newline at end of file +var _0xc75d=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','STRING','BOOLEAN','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'];(function(_0x410b11,_0x119a01){var _0x571d85=function(_0xc0a43c){while(--_0xc0a43c){_0x410b11['push'](_0x410b11['shift']());}};_0x571d85(++_0x119a01);}(_0xc75d,0x147));var _0xdc75=function(_0x3eaf10,_0x349479){_0x3eaf10=_0x3eaf10-0x0;var _0x383cda=_0xc75d[_0x3eaf10];return _0x383cda;};'use strict';var Sequelize=require(_0xdc75('0x0'));module['exports']={'description':{'type':Sequelize[_0xdc75('0x1')]},'name':{'type':Sequelize[_0xdc75('0x1')],'allowNull':![]},'service':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':!![]},'key':{'type':Sequelize[_0xdc75('0x1')],'allowNull':![]},'template':{'type':Sequelize[_0xdc75('0x3')]},'markAsUnread':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0xdc75('0x1')],'allowNull':![],'defaultValue':_0xdc75('0x4')},'fontSize':{'type':Sequelize[_0xdc75('0x5')](0x2)[_0xdc75('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0xdc75('0x3')],'defaultValue':function(){return _0xdc75('0x7');}},'notificationSound':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdc75('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xdc75('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xdc75('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdc75('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0xdc75('0x8')},'mandatoryDisposition':{'type':Sequelize[_0xdc75('0x2')],'defaultValue':![],'comment':_0xdc75('0x9'),'set':function(_0x76bb16){if(!_0x76bb16)this[_0xdc75('0xa')]('mandatoryDispositionPauseId',null);this[_0xdc75('0xa')](_0xdc75('0xb'),_0x76bb16);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 4b1c24b..fbb7f29 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 _0xe08b=['addAgents','spread','removeAgents','isArray','emit','userMailAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','client','http','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','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','offset','limit','set','Content-Range','apply','reject','save','then','MailAccounts','destroy','send','Imap','MailServerOut','Pause','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','model','name','query','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filter','type','VIRTUAL','merge','options','count','include','findAll','rows','catch','params','MailServerIn','Smtp','keys','fields','length','includeAll','find','update','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','removeAnswers','key','email','isNil','active','description','cservice','user','cuser','password','cpassword','authentication','port','host','service','pass','get','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','addInteraction','MailInteraction','omit','getInteractions','pick','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','tag','sequelize','MailApplication','bulkCreate','priority','getApplications','getMessages','MailMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','from','%s\x20<%s>','attachments','join','root','server/files/attachments','secure','auth','SendMail','List\x20not\x20found','ListId','messageId','subject','attach','out','Interaction','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xe08b,0xc6));var _0xbe08=function(_0x30bd66,_0x36a93d){_0x30bd66=_0x30bd66-0x0;var _0x74c9dd=_0xe08b[_0x30bd66];return _0x74c9dd;};'use strict';var pdf=require(_0xbe08('0x0'));var emlformat=require(_0xbe08('0x1'));var rimraf=require(_0xbe08('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbe08('0x3'));var rp=require(_0xbe08('0x4'));var moment=require(_0xbe08('0x5'));var BPromise=require(_0xbe08('0x6'));var Mustache=require(_0xbe08('0x7'));var util=require(_0xbe08('0x8'));var path=require('path');var sox=require(_0xbe08('0x9'));var csv=require('to-csv');var ejs=require(_0xbe08('0xa'));var fs=require('fs');var _=require(_0xbe08('0xb'));var squel=require(_0xbe08('0xc'));var crypto=require(_0xbe08('0xd'));var jsforce=require(_0xbe08('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xbe08('0xf'));var querystring=require('querystring');var Papa=require(_0xbe08('0x10'));var Redis=require(_0xbe08('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xbe08('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbe08('0x13'));var logger=require(_0xbe08('0x14'))(_0xbe08('0x15'));var utils=require(_0xbe08('0x16'));var config=require('../../config/environment');var db=require(_0xbe08('0x17'))['db'];config[_0xbe08('0x18')]=_[_0xbe08('0x19')](config['redis'],{'host':_0xbe08('0x1a'),'port':0x18eb});var socket=require(_0xbe08('0x1b'))(new Redis(config['redis']));require(_0xbe08('0x1c'))[_0xbe08('0x1d')](socket);var jayson=require(_0xbe08('0x1e'));var client=jayson[_0xbe08('0x1f')][_0xbe08('0x20')]({'port':0x232b});function checkPasswordPattern(_0x45b813,_0x3ac517,_0x37ac66){if(_0x37ac66){var _0x14b867=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x14b867['test'](_0x3ac517)){return _0x45b813;}else{throw new db['Sequelize']['ValidationError'](_0xbe08('0x21'));}}else{return _0x45b813;}}function respondWithRpcPromise(_0x55acdb,_0x55dc17,_0x50c88d,_0xc8a3b3){return new BPromise(function(_0x4acd8b,_0x4949b2){var _0x304f68=_0xc8a3b3||client;return _0x304f68['request'](_0x55acdb,_0x50c88d)['then'](function(_0x1e49e8){logger[_0xbe08('0x22')](_0xbe08('0x23'),_0x55dc17,_0xbe08('0x24'));logger[_0xbe08('0x25')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x55dc17,_0xbe08('0x24'),JSON[_0xbe08('0x26')](_0x1e49e8));if(_0x1e49e8[_0xbe08('0x27')]){if(_0x1e49e8[_0xbe08('0x27')][_0xbe08('0x28')]===0x1f4){logger[_0xbe08('0x27')]('MailAccount,\x20%s,\x20%s',_0x55dc17,_0x1e49e8[_0xbe08('0x27')]['message']);return _0x4949b2(_0x1e49e8[_0xbe08('0x27')][_0xbe08('0x29')]);}logger[_0xbe08('0x27')](_0xbe08('0x23'),_0x55dc17,_0x1e49e8[_0xbe08('0x27')][_0xbe08('0x29')]);return _0x4acd8b(_0x1e49e8['error']['message']);}else{logger[_0xbe08('0x22')]('MailAccount,\x20%s,\x20%s',_0x55dc17,_0xbe08('0x24'));_0x4acd8b(_0x1e49e8[_0xbe08('0x2a')][_0xbe08('0x29')]);}})['catch'](function(_0x1c32d2){logger[_0xbe08('0x27')](_0xbe08('0x23'),_0x55dc17,_0x1c32d2);_0x4949b2(_0x1c32d2);});});}function respondWithStatusCode(_0x340f08,_0x305274){_0x305274=_0x305274||0xcc;return function(_0x4fbb5){if(_0x4fbb5){return _0x340f08[_0xbe08('0x2b')](_0x305274);}return _0x340f08[_0xbe08('0x2c')](_0x305274)[_0xbe08('0x2d')]();};}function respondWithResult(_0x4a26da,_0x2cc4f2){_0x2cc4f2=_0x2cc4f2||0xc8;return function(_0x1fee43){if(_0x1fee43){return _0x4a26da[_0xbe08('0x2c')](_0x2cc4f2)['json'](_0x1fee43);}};}function respondWithFilteredResult(_0x45d783,_0xe9999f){return function(_0x3b1f43){if(_0x3b1f43){var _0xb14ad4=_0x3b1f43['count'],_0x405060=_0xe9999f[_0xbe08('0x2e')],_0x1a6656=_0xe9999f[_0xbe08('0x2e')]+_0xe9999f[_0xbe08('0x2f')],_0x163dc9;if(_0x1a6656>=_0xb14ad4){_0x1a6656=_0xb14ad4;_0x163dc9=0xc8;}else{_0x163dc9=0xce;}_0x45d783['status'](_0x163dc9);return _0x45d783[_0xbe08('0x30')](_0xbe08('0x31'),_0x405060+'-'+_0x1a6656+'/'+_0xb14ad4)['json'](_0x3b1f43);}return null;};}function patchUpdates(_0x13bfa1){return function(_0x3c777e){try{jsonpatch[_0xbe08('0x32')](_0x3c777e,_0x13bfa1,!![]);}catch(_0x43cef5){return BPromise[_0xbe08('0x33')](_0x43cef5);}return _0x3c777e[_0xbe08('0x34')]();};}function saveUpdates(_0x58c971,_0xc17fe2){return function(_0x100fd8){if(_0x100fd8){return _0x100fd8['update'](_0x58c971)['then'](function(_0x333c5f){return _0x333c5f;});}return null;};}function removeEntity(_0x4403bc,_0x23feca){return function(_0x3af311){if(_0x3af311){return _0x3af311['destroy']()[_0xbe08('0x35')](function(){var _0x58268c=_0x3af311['get']({'plain':!![]});var _0x5896e6=_0xbe08('0x36');return db['UserProfileResource'][_0xbe08('0x37')]({'where':{'type':_0x5896e6,'resourceId':_0x58268c['id']}})['then'](function(){return _0x3af311;});})[_0xbe08('0x35')](function(){_0x4403bc[_0xbe08('0x2c')](0xcc)[_0xbe08('0x2d')]();});}};}function handleEntityNotFound(_0xcb4739,_0x1a34a9){return function(_0x48db4c){if(!_0x48db4c){_0xcb4739['sendStatus'](0x194);}return _0x48db4c;};}function handleError(_0x5016c8,_0x539f8d){_0x539f8d=_0x539f8d||0x1f4;return function(_0x47aabe){logger[_0xbe08('0x27')](_0x47aabe['stack']);if(_0x47aabe['name']){delete _0x47aabe['name'];}_0x5016c8[_0xbe08('0x2c')](_0x539f8d)[_0xbe08('0x38')](_0x47aabe);};}exports['index']=function(_0x3c621b,_0x260723){var _0x3ddf51={'include':[{'model':db['MailServerIn'],'as':_0xbe08('0x39')},{'model':db[_0xbe08('0x3a')],'as':'Smtp'},{'model':db[_0xbe08('0x3b')],'as':_0xbe08('0x3c')}]},_0x1c274b={},_0x4f5409={'count':0x0,'rows':[]};var _0x4d0812=_[_0xbe08('0x3d')](db[_0xbe08('0x3e')][_0xbe08('0x3f')],function(_0x48cb26){return{'name':_0x48cb26[_0xbe08('0x40')],'type':_0x48cb26['type']['key']};});_0x1c274b[_0xbe08('0x41')]=_[_0xbe08('0x3d')](_0x4d0812,_0xbe08('0x42'));_0x1c274b[_0xbe08('0x43')]=_['keys'](_0x3c621b[_0xbe08('0x43')]);_0x1c274b[_0xbe08('0x44')]=_['intersection'](_0x1c274b['model'],_0x1c274b[_0xbe08('0x43')]);_0x3ddf51['attributes']=_[_0xbe08('0x45')](_0x1c274b[_0xbe08('0x41')],qs['fields'](_0x3c621b[_0xbe08('0x43')]['fields']));_0x3ddf51['attributes']=_0x3ddf51[_0xbe08('0x46')]['length']?_0x3ddf51['attributes']:_0x1c274b[_0xbe08('0x41')];if(!_0x3c621b['query'][_0xbe08('0x47')](_0xbe08('0x48'))){_0x3ddf51[_0xbe08('0x2f')]=qs[_0xbe08('0x2f')](_0x3c621b[_0xbe08('0x43')][_0xbe08('0x2f')]);_0x3ddf51['offset']=qs['offset'](_0x3c621b[_0xbe08('0x43')][_0xbe08('0x2e')]);}_0x3ddf51[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x3c621b[_0xbe08('0x43')][_0xbe08('0x4a')]);_0x3ddf51[_0xbe08('0x4b')]=qs['filters'](_['pick'](_0x3c621b[_0xbe08('0x43')],_0x1c274b[_0xbe08('0x44')]));if(_0x3c621b[_0xbe08('0x43')][_0xbe08('0x4c')]){_0x3ddf51[_0xbe08('0x4b')]=_['merge'](_0x3ddf51['where'],{'$or':_[_0xbe08('0x3d')](_0x4d0812,function(_0x178fbe){if(_0x178fbe[_0xbe08('0x4d')]!==_0xbe08('0x4e')){var _0x4ef4ac={};_0x4ef4ac[_0x178fbe['name']]={'$like':'%'+_0x3c621b[_0xbe08('0x43')]['filter']+'%'};return _0x4ef4ac;}})});}_0x3ddf51=_[_0xbe08('0x4f')]({},_0x3ddf51,_0x3c621b[_0xbe08('0x50')]);var _0x3dd4bb={'where':_0x3ddf51[_0xbe08('0x4b')]};return db[_0xbe08('0x3e')][_0xbe08('0x51')](_0x3dd4bb)['then'](function(_0x3f4ee7){_0x4f5409[_0xbe08('0x51')]=_0x3f4ee7;if(_0x3c621b['query']['includeAll']){_0x3ddf51[_0xbe08('0x52')]=[{'all':!![]}];}return db[_0xbe08('0x3e')][_0xbe08('0x53')](_0x3ddf51);})[_0xbe08('0x35')](function(_0xb6ba95){_0x4f5409[_0xbe08('0x54')]=_0xb6ba95;return _0x4f5409;})['then'](respondWithFilteredResult(_0x260723,_0x3ddf51))[_0xbe08('0x55')](handleError(_0x260723,null));};exports['show']=function(_0x4f1976,_0x2c4b37){var _0x463147={'raw':![],'where':{'id':_0x4f1976[_0xbe08('0x56')]['id']},'include':[{'model':db[_0xbe08('0x57')],'as':_0xbe08('0x39')},{'model':db['MailServerOut'],'as':_0xbe08('0x58')},{'model':db[_0xbe08('0x3b')],'as':_0xbe08('0x3c')}]},_0x2a6115={};_0x2a6115['model']=_[_0xbe08('0x59')](db[_0xbe08('0x3e')]['rawAttributes']);_0x2a6115[_0xbe08('0x43')]=_[_0xbe08('0x59')](_0x4f1976['query']);_0x2a6115[_0xbe08('0x44')]=_[_0xbe08('0x45')](_0x2a6115[_0xbe08('0x41')],_0x2a6115[_0xbe08('0x43')]);_0x463147[_0xbe08('0x46')]=_['intersection'](_0x2a6115[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x4f1976[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x463147[_0xbe08('0x46')]=_0x463147[_0xbe08('0x46')][_0xbe08('0x5b')]?_0x463147['attributes']:_0x2a6115[_0xbe08('0x41')];if(_0x4f1976['query'][_0xbe08('0x5c')]){_0x463147[_0xbe08('0x52')]=[{'all':!![]}];}_0x463147=_[_0xbe08('0x4f')]({},_0x463147,_0x4f1976[_0xbe08('0x50')]);return db[_0xbe08('0x3e')][_0xbe08('0x5d')](_0x463147)['then'](handleEntityNotFound(_0x2c4b37,null))[_0xbe08('0x35')](respondWithResult(_0x2c4b37,null))[_0xbe08('0x55')](handleError(_0x2c4b37,null));};exports[_0xbe08('0x5e')]=function(_0x113720,_0x480bd8){if(_0x113720['body']['id']){delete _0x113720[_0xbe08('0x5f')]['id'];}return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x113720[_0xbe08('0x56')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xbe08('0x58')},{'model':db[_0xbe08('0x3b')],'as':_0xbe08('0x3c')}]})[_0xbe08('0x35')](handleEntityNotFound(_0x480bd8,null))[_0xbe08('0x35')](saveUpdates(_0x113720[_0xbe08('0x5f')],null))[_0xbe08('0x35')](function(_0xfc916c){if(_0xfc916c&&_0x113720[_0xbe08('0x5f')]['Imap']){return db['MailServerIn'][_0xbe08('0x5e')](_0x113720[_0xbe08('0x5f')][_0xbe08('0x39')],{'where':{'MailAccountId':_0xfc916c['id']}})['then'](function(){return _0xfc916c;});}return _0xfc916c;})[_0xbe08('0x35')](function(_0x136830){if(_0x136830&&_0x113720[_0xbe08('0x5f')]['Smtp']){return db['MailServerOut']['update'](_0x113720[_0xbe08('0x5f')][_0xbe08('0x58')],{'where':{'MailAccountId':_0x136830['id']}})[_0xbe08('0x35')](function(){return _0x136830;});}return _0x136830;})[_0xbe08('0x35')](respondWithResult(_0x480bd8,null))[_0xbe08('0x55')](handleError(_0x480bd8,null));};exports[_0xbe08('0x60')]=function(_0x5032ba,_0x5d4974){return db['MailAccount']['describe']()['then'](respondWithResult(_0x5d4974,null))[_0xbe08('0x55')](handleError(_0x5d4974,null));};exports[_0xbe08('0x61')]=function(_0x544855,_0x7e718f,_0xbc82d4){if(_0x544855[_0xbe08('0x5f')]['id']){delete _0x544855[_0xbe08('0x5f')]['id'];}return db[_0xbe08('0x3e')]['find']({'where':{'id':_0x544855[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x7e718f,null))[_0xbe08('0x35')](function(_0x215f52){if(_0x215f52){_0x544855[_0xbe08('0x5f')][_0xbe08('0x62')]=_0x215f52['id'];return db[_0xbe08('0x63')][_0xbe08('0x64')](_0x544855[_0xbe08('0x5f')]);}})['then'](respondWithResult(_0x7e718f,null))[_0xbe08('0x55')](handleError(_0x7e718f,null));};exports[_0xbe08('0x65')]=function(_0x4cd0fb,_0x20cfd3,_0x27c718){var _0x590365={'raw':![],'where':{}};var _0x10e6a3={};var _0x1845fa={'count':0x0,'rows':[]};return db[_0xbe08('0x3e')][_0xbe08('0x66')]({'where':{'id':_0x4cd0fb[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x20cfd3,null))[_0xbe08('0x35')](function(_0x121354){if(_0x121354){_0x10e6a3[_0xbe08('0x41')]=_[_0xbe08('0x59')](db[_0xbe08('0x63')][_0xbe08('0x3f')]);_0x10e6a3[_0xbe08('0x43')]=_[_0xbe08('0x59')](_0x4cd0fb['query']);_0x10e6a3[_0xbe08('0x44')]=_[_0xbe08('0x45')](_0x10e6a3[_0xbe08('0x41')],_0x10e6a3['query']);_0x590365['attributes']=_[_0xbe08('0x45')](_0x10e6a3[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x590365[_0xbe08('0x46')]=_0x590365[_0xbe08('0x46')][_0xbe08('0x5b')]?_0x590365['attributes']:_0x10e6a3[_0xbe08('0x41')];if(!_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x47')](_0xbe08('0x48'))){_0x590365['limit']=qs[_0xbe08('0x2f')](_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x2f')]);_0x590365['offset']=qs['offset'](_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x2e')]);}_0x590365[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x4a')]);_0x590365[_0xbe08('0x4b')]=qs[_0xbe08('0x44')](_['pick'](_0x4cd0fb[_0xbe08('0x43')],_0x10e6a3[_0xbe08('0x44')]));_0x590365['where'][_0xbe08('0x62')]=_0x121354['id'];if(_0x4cd0fb[_0xbe08('0x43')]['filter']){_0x590365[_0xbe08('0x4b')]=_['merge'](_0x590365[_0xbe08('0x4b')],{'$or':_[_0xbe08('0x3d')](_0x590365[_0xbe08('0x46')],function(_0x33df30){var _0x26e1af={};_0x26e1af[_0x33df30]={'$like':'%'+_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x26e1af;})});}_0x590365=_[_0xbe08('0x4f')]({},_0x590365,_0x4cd0fb[_0xbe08('0x50')]);return db[_0xbe08('0x63')]['count']({'where':_0x590365['where']})[_0xbe08('0x35')](function(_0x17d2b4){_0x1845fa['count']=_0x17d2b4;if(_0x4cd0fb[_0xbe08('0x43')][_0xbe08('0x5c')]){_0x590365['include']=[{'all':!![]}];}return db['Disposition'][_0xbe08('0x53')](_0x590365);})[_0xbe08('0x35')](function(_0x4202c2){_0x1845fa[_0xbe08('0x54')]=_0x4202c2;return _0x1845fa;});}})[_0xbe08('0x35')](respondWithFilteredResult(_0x20cfd3,_0x590365))[_0xbe08('0x55')](handleError(_0x20cfd3,null));};exports[_0xbe08('0x67')]=function(_0x414269,_0x46fea0,_0x1433b1){return db[_0xbe08('0x3e')]['find']({'where':{'id':_0x414269['params']['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x46fea0,null))[_0xbe08('0x35')](function(_0x5545b7){if(_0x5545b7){return _0x5545b7['removeDispositions'](_0x414269[_0xbe08('0x43')][_0xbe08('0x68')]);}})['then'](respondWithStatusCode(_0x46fea0,null))[_0xbe08('0x55')](handleError(_0x46fea0,null));};exports[_0xbe08('0x69')]=function(_0x58dc11,_0x2b7a8a,_0x51d29e){if(_0x58dc11['body']['id']){delete _0x58dc11['body']['id'];}return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x58dc11['params']['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x2b7a8a,null))['then'](function(_0x3afdac){if(_0x3afdac){_0x58dc11[_0xbe08('0x5f')]['MailAccountId']=_0x3afdac['id'];return db[_0xbe08('0x6a')]['create'](_0x58dc11[_0xbe08('0x5f')]);}})['then'](respondWithResult(_0x2b7a8a,null))['catch'](handleError(_0x2b7a8a,null));};exports[_0xbe08('0x6b')]=function(_0x51e53d,_0x1c2d6b,_0x3c954d){var _0x3c1ac2={'raw':![],'where':{}};var _0x1cefbe={};var _0x5159e0={'count':0x0,'rows':[]};return db[_0xbe08('0x3e')]['findOne']({'where':{'id':_0x51e53d[_0xbe08('0x56')]['id']}})['then'](handleEntityNotFound(_0x1c2d6b,null))[_0xbe08('0x35')](function(_0xfd7aba){if(_0xfd7aba){_0x1cefbe['model']=_[_0xbe08('0x59')](db[_0xbe08('0x6a')][_0xbe08('0x3f')]);_0x1cefbe[_0xbe08('0x43')]=_[_0xbe08('0x59')](_0x51e53d[_0xbe08('0x43')]);_0x1cefbe['filters']=_[_0xbe08('0x45')](_0x1cefbe[_0xbe08('0x41')],_0x1cefbe[_0xbe08('0x43')]);_0x3c1ac2[_0xbe08('0x46')]=_['intersection'](_0x1cefbe[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x51e53d[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x3c1ac2['attributes']=_0x3c1ac2[_0xbe08('0x46')][_0xbe08('0x5b')]?_0x3c1ac2[_0xbe08('0x46')]:_0x1cefbe[_0xbe08('0x41')];if(!_0x51e53d[_0xbe08('0x43')][_0xbe08('0x47')](_0xbe08('0x48'))){_0x3c1ac2[_0xbe08('0x2f')]=qs[_0xbe08('0x2f')](_0x51e53d['query'][_0xbe08('0x2f')]);_0x3c1ac2[_0xbe08('0x2e')]=qs[_0xbe08('0x2e')](_0x51e53d['query'][_0xbe08('0x2e')]);}_0x3c1ac2[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x51e53d[_0xbe08('0x43')]['sort']);_0x3c1ac2[_0xbe08('0x4b')]=qs[_0xbe08('0x44')](_['pick'](_0x51e53d[_0xbe08('0x43')],_0x1cefbe[_0xbe08('0x44')]));_0x3c1ac2['where'][_0xbe08('0x62')]=_0xfd7aba['id'];if(_0x51e53d[_0xbe08('0x43')]['filter']){_0x3c1ac2[_0xbe08('0x4b')]=_[_0xbe08('0x4f')](_0x3c1ac2[_0xbe08('0x4b')],{'$or':_['map'](_0x3c1ac2['attributes'],function(_0x581c8d){var _0x14e426={};_0x14e426[_0x581c8d]={'$like':'%'+_0x51e53d[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x14e426;})});}_0x3c1ac2=_[_0xbe08('0x4f')]({},_0x3c1ac2,_0x51e53d[_0xbe08('0x50')]);return db[_0xbe08('0x6a')]['count']({'where':_0x3c1ac2[_0xbe08('0x4b')]})[_0xbe08('0x35')](function(_0xdfda66){_0x5159e0['count']=_0xdfda66;if(_0x51e53d[_0xbe08('0x43')][_0xbe08('0x5c')]){_0x3c1ac2['include']=[{'all':!![]}];}return db[_0xbe08('0x6a')][_0xbe08('0x53')](_0x3c1ac2);})[_0xbe08('0x35')](function(_0x4073f9){_0x5159e0[_0xbe08('0x54')]=_0x4073f9;return _0x5159e0;});}})[_0xbe08('0x35')](respondWithFilteredResult(_0x1c2d6b,_0x3c1ac2))[_0xbe08('0x55')](handleError(_0x1c2d6b,null));};exports[_0xbe08('0x6c')]=function(_0x51b85d,_0x9c280e,_0xeb8c93){return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x51b85d[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x9c280e,null))[_0xbe08('0x35')](function(_0x5b89c5){if(_0x5b89c5){return _0x5b89c5['removeAnswers'](_0x51b85d[_0xbe08('0x43')][_0xbe08('0x68')]);}})['then'](respondWithStatusCode(_0x9c280e,null))[_0xbe08('0x55')](handleError(_0x9c280e,null));};exports[_0xbe08('0x64')]=function(_0x2f6843,_0x2fe1f2){var _0x99eb7e={'name':_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x42')],'key':_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x6d')],'email':_0x2f6843['body'][_0xbe08('0x6e')],'ListId':_0x2f6843[_0xbe08('0x5f')]['ListId'],'active':!_[_0xbe08('0x6f')](_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x70')])?_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x70')]:!![],'description':_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x71')]||null,'Imap':{},'Smtp':{}};if(_['isNil'](_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x72')])){if(_0x2f6843['body']['cauthentication']){_0x99eb7e['Imap'][_0xbe08('0x73')]=_0x99eb7e[_0xbe08('0x58')][_0xbe08('0x73')]=_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x74')];_0x99eb7e[_0xbe08('0x39')][_0xbe08('0x75')]=_0x99eb7e[_0xbe08('0x58')]['pass']=_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x76')];}else{_0x99eb7e[_0xbe08('0x39')][_0xbe08('0x77')]=_0x99eb7e[_0xbe08('0x58')]['authentication']=![];}_0x99eb7e[_0xbe08('0x39')]['host']=_0x2f6843['body'][_0xbe08('0x39')]['host'];_0x99eb7e[_0xbe08('0x39')][_0xbe08('0x78')]=_0x2f6843[_0xbe08('0x5f')]['Imap'][_0xbe08('0x78')];_0x99eb7e['Smtp'][_0xbe08('0x79')]=_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x58')][_0xbe08('0x79')];_0x99eb7e[_0xbe08('0x58')][_0xbe08('0x78')]=_0x2f6843['body'][_0xbe08('0x58')]['port'];}else{_0x99eb7e[_0xbe08('0x39')][_0xbe08('0x7a')]=_0x99eb7e['Smtp'][_0xbe08('0x7a')]=_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x72')];_0x99eb7e['Imap'][_0xbe08('0x73')]=_0x99eb7e[_0xbe08('0x58')][_0xbe08('0x73')]=_0x2f6843[_0xbe08('0x5f')]['cuser'];_0x99eb7e[_0xbe08('0x39')][_0xbe08('0x75')]=_0x99eb7e[_0xbe08('0x58')][_0xbe08('0x7b')]=_0x2f6843[_0xbe08('0x5f')][_0xbe08('0x76')];}return db['MailAccount'][_0xbe08('0x64')](_0x99eb7e,{'include':[{'model':db[_0xbe08('0x3a')],'as':_0xbe08('0x58')},{'model':db['MailServerIn'],'as':_0xbe08('0x39')}]})[_0xbe08('0x35')](function(_0x5a555a){var _0x5c2aad=_0x2f6843[_0xbe08('0x73')][_0xbe08('0x7c')]({'plain':!![]});if(!_0x5c2aad)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c2aad[_0xbe08('0x7d')]===_0xbe08('0x73')){var _0x207305=_0x5a555a['get']({'plain':!![]});return db[_0xbe08('0x7e')]['find']({'where':{'name':_0xbe08('0x36'),'userProfileId':_0x5c2aad[_0xbe08('0x7f')]},'raw':!![]})[_0xbe08('0x35')](function(_0x3ec365){if(_0x3ec365&&_0x3ec365['autoAssociation']===0x0){return db[_0xbe08('0x80')]['create']({'name':_0x207305['name'],'resourceId':_0x207305['id'],'type':_0x3ec365['name'],'sectionId':_0x3ec365['id']},{})[_0xbe08('0x35')](function(){return _0x5a555a;});}else{return _0x5a555a;}})[_0xbe08('0x55')](function(_0x11e8a3){logger[_0xbe08('0x27')](_0xbe08('0x81'),_0x11e8a3);throw _0x11e8a3;});}return _0x5a555a;})[_0xbe08('0x35')](respondWithResult(_0x2fe1f2,0xc9))['catch'](handleError(_0x2fe1f2,null));};exports[_0xbe08('0x82')]=function(_0x5b967b,_0x209b4a,_0x253423){return db['MailAccount']['findOne']({'where':{'id':_0x5b967b[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x209b4a,null))[_0xbe08('0x35')](function(_0x503446){if(_0x503446){return _0x503446['getImap']();}return null;})[_0xbe08('0x35')](respondWithResult(_0x209b4a,null))['catch'](handleError(_0x209b4a,null));};exports[_0xbe08('0x83')]=function(_0x4200ee,_0x8a76c0,_0x18090b){if(_0x4200ee['body']['id']){delete _0x4200ee['body']['id'];}return db['MailAccount'][_0xbe08('0x5d')]({'where':{'id':_0x4200ee[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x8a76c0,null))['then'](function(_0x887a57){if(_0x887a57){_0x4200ee['body'][_0xbe08('0x62')]=_0x887a57['id'];return db[_0xbe08('0x57')][_0xbe08('0x64')](_0x4200ee[_0xbe08('0x5f')]);}})[_0xbe08('0x35')](respondWithResult(_0x8a76c0,null))[_0xbe08('0x55')](handleError(_0x8a76c0,null));};exports[_0xbe08('0x84')]=function(_0x46d513,_0x325e6c,_0x74f01f){return db[_0xbe08('0x3e')]['findOne']({'where':{'id':_0x46d513['params']['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x325e6c,null))[_0xbe08('0x35')](function(_0x4f0f15){if(_0x4f0f15){return _0x4f0f15[_0xbe08('0x85')](null);}return null;})[_0xbe08('0x35')](respondWithStatusCode(_0x325e6c,null))[_0xbe08('0x55')](handleError(_0x325e6c,null));};exports[_0xbe08('0x86')]=function(_0x1f3b03,_0x32cb25,_0x221a63){return db[_0xbe08('0x3e')]['findOne']({'where':{'id':_0x1f3b03[_0xbe08('0x56')]['id']}})['then'](handleEntityNotFound(_0x32cb25,null))[_0xbe08('0x35')](function(_0x960550){if(_0x960550){return _0x960550[_0xbe08('0x86')]();}return null;})[_0xbe08('0x35')](respondWithResult(_0x32cb25,null))[_0xbe08('0x55')](handleError(_0x32cb25,null));};exports[_0xbe08('0x87')]=function(_0x35ddc6,_0x106e4a,_0x5acbda){if(_0x35ddc6[_0xbe08('0x5f')]['id']){delete _0x35ddc6[_0xbe08('0x5f')]['id'];}return db[_0xbe08('0x3e')]['find']({'where':{'id':_0x35ddc6[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x106e4a,null))[_0xbe08('0x35')](function(_0x3d9d1f){if(_0x3d9d1f){_0x35ddc6['body']['MailAccountId']=_0x3d9d1f['id'];return db[_0xbe08('0x3a')][_0xbe08('0x64')](_0x35ddc6[_0xbe08('0x5f')]);}})[_0xbe08('0x35')](respondWithResult(_0x106e4a,null))[_0xbe08('0x55')](handleError(_0x106e4a,null));};exports[_0xbe08('0x88')]=function(_0xb7d1e4,_0x2b6c18,_0x2bff1d){return db[_0xbe08('0x3e')][_0xbe08('0x66')]({'where':{'id':_0xb7d1e4['params']['id']}})['then'](handleEntityNotFound(_0x2b6c18,null))[_0xbe08('0x35')](function(_0x1d1b00){if(_0x1d1b00){return _0x1d1b00['setSmtp'](null);}return null;})[_0xbe08('0x35')](respondWithStatusCode(_0x2b6c18,null))['catch'](handleError(_0x2b6c18,null));};exports[_0xbe08('0x89')]=function(_0x10bc99,_0x62fc0b,_0x1943ea){return db[_0xbe08('0x8a')][_0xbe08('0x5d')]({'where':{'id':_0x10bc99['params']['id']}})['then'](handleEntityNotFound(_0x62fc0b,null))['then'](function(_0x21bfc9){if(_0x21bfc9){return _0x21bfc9[_0xbe08('0x89')](_0x10bc99[_0xbe08('0x5f')][_0xbe08('0x68')],_[_0xbe08('0x8b')](_0x10bc99['body'],[_0xbe08('0x68'),'id'])||{});}})[_0xbe08('0x35')](respondWithResult(_0x62fc0b,null))[_0xbe08('0x55')](handleError(_0x62fc0b,null));};exports[_0xbe08('0x8c')]=function(_0x140a20,_0x1f0fd1,_0x35bbf5){var _0x9f5487={'raw':![],'where':{}};var _0x1af564={};var _0x3592b={'count':0x0,'rows':[]};return db[_0xbe08('0x3e')][_0xbe08('0x66')]({'where':{'id':_0x140a20['params']['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x1f0fd1,null))[_0xbe08('0x35')](function(_0x13f9b3){if(_0x13f9b3){_0x1af564[_0xbe08('0x41')]=_[_0xbe08('0x59')](db[_0xbe08('0x8a')][_0xbe08('0x3f')]);_0x1af564[_0xbe08('0x43')]=_[_0xbe08('0x59')](_0x140a20[_0xbe08('0x43')]);_0x1af564[_0xbe08('0x44')]=_[_0xbe08('0x45')](_0x1af564['model'],_0x1af564[_0xbe08('0x43')]);_0x9f5487[_0xbe08('0x46')]=_['intersection'](_0x1af564['model'],qs[_0xbe08('0x5a')](_0x140a20[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x9f5487[_0xbe08('0x46')]=_0x9f5487[_0xbe08('0x46')]['length']?_0x9f5487['attributes']:_0x1af564[_0xbe08('0x41')];if(!_0x140a20[_0xbe08('0x43')][_0xbe08('0x47')](_0xbe08('0x48'))){_0x9f5487[_0xbe08('0x2f')]=qs[_0xbe08('0x2f')](_0x140a20['query'][_0xbe08('0x2f')]);_0x9f5487['offset']=qs['offset'](_0x140a20[_0xbe08('0x43')][_0xbe08('0x2e')]);}_0x9f5487[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x140a20[_0xbe08('0x43')][_0xbe08('0x4a')]);_0x9f5487[_0xbe08('0x4b')]=qs[_0xbe08('0x44')](_[_0xbe08('0x8d')](_0x140a20['query'],_0x1af564[_0xbe08('0x44')]));_0x9f5487[_0xbe08('0x4b')][_0xbe08('0x62')]=_0x13f9b3['id'];if(_0x140a20['query'][_0xbe08('0x4c')]){_0x9f5487[_0xbe08('0x4b')]=_[_0xbe08('0x4f')](_0x9f5487[_0xbe08('0x4b')],{'$or':_[_0xbe08('0x3d')](_0x9f5487[_0xbe08('0x46')],function(_0x7a9694){var _0x261285={};_0x261285[_0x7a9694]={'$like':'%'+_0x140a20[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x261285;})});}_0x9f5487=_[_0xbe08('0x4f')]({},_0x9f5487,_0x140a20[_0xbe08('0x50')]);return db[_0xbe08('0x8a')][_0xbe08('0x51')]({'where':_0x9f5487['where']})[_0xbe08('0x35')](function(_0x33a14e){_0x3592b[_0xbe08('0x51')]=_0x33a14e;if(_0x140a20[_0xbe08('0x43')][_0xbe08('0x5c')]){_0x9f5487[_0xbe08('0x52')]=[{'model':db[_0xbe08('0x8e')],'as':_0xbe08('0x8f'),'required':![]},{'model':db[_0xbe08('0x90')],'as':_0xbe08('0x91'),'attributes':[_0xbe08('0x42'),_0xbe08('0x92'),_0xbe08('0x93')],'required':![]},{'model':db[_0xbe08('0x94')],'as':_0xbe08('0x95'),'attributes':['id',_0xbe08('0x42'),'color'],'where':_0x140a20['query'][_0xbe08('0x96')]?{'id':_0x140a20['query'][_0xbe08('0x96')]}:undefined,'required':_0x140a20['query'][_0xbe08('0x96')]?!![]:![]}];}return db[_0xbe08('0x8a')][_0xbe08('0x53')](_0x9f5487);})['then'](function(_0x53ce62){_0x3592b[_0xbe08('0x54')]=_0x53ce62;return _0x3592b;});}})[_0xbe08('0x35')](respondWithFilteredResult(_0x1f0fd1,_0x9f5487))[_0xbe08('0x55')](handleError(_0x1f0fd1,null));};exports['addApplications']=function(_0x1785ff,_0x5e2491,_0x4328e4){return db[_0xbe08('0x3e')]['findOne']({'where':{'id':_0x1785ff[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x5e2491,null))[_0xbe08('0x35')](function(_0x156c3c){if(_0x156c3c){return db[_0xbe08('0x97')]['transaction'](function(_0x43af3b){return db[_0xbe08('0x98')]['destroy']({'where':{'MailAccountId':_0x1785ff[_0xbe08('0x56')]['id']},'transaction':_0x43af3b})[_0xbe08('0x35')](function(_0x50208e){var _0x5f0a9c=_[_0xbe08('0x3d')](_0x1785ff['body'],function(_0x1f1a19){_0x1f1a19[_0xbe08('0x62')]=_0x1785ff[_0xbe08('0x56')]['id'];return _0x1f1a19;});return db[_0xbe08('0x98')][_0xbe08('0x99')](_0x5f0a9c,{'transaction':_0x43af3b});});})[_0xbe08('0x35')](function(){return db[_0xbe08('0x98')]['findAndCountAll']({'where':{'MailAccountId':_0x1785ff[_0xbe08('0x56')]['id']},'order':_0xbe08('0x9a')});});}})[_0xbe08('0x35')](respondWithResult(_0x5e2491,null))[_0xbe08('0x55')](handleError(_0x5e2491,null));};exports['getApplications']=function(_0x5133ef,_0x4b71df,_0x19d27a){var _0x18040e={};var _0x6aa329={};var _0x24a6c9;var _0x2d58eb;return db['MailAccount'][_0xbe08('0x66')]({'where':{'id':_0x5133ef[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x4b71df,null))[_0xbe08('0x35')](function(_0x404703){if(_0x404703){_0x24a6c9=_0x404703;_0x6aa329[_0xbe08('0x41')]=_['keys'](db['MailApplication'][_0xbe08('0x3f')]);_0x6aa329[_0xbe08('0x43')]=_['keys'](_0x5133ef[_0xbe08('0x43')]);_0x6aa329[_0xbe08('0x44')]=_[_0xbe08('0x45')](_0x6aa329[_0xbe08('0x41')],_0x6aa329['query']);_0x18040e['attributes']=_[_0xbe08('0x45')](_0x6aa329[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x5133ef['query']['fields']));_0x18040e[_0xbe08('0x46')]=_0x18040e[_0xbe08('0x46')][_0xbe08('0x5b')]?_0x18040e['attributes']:_0x6aa329[_0xbe08('0x41')];_0x18040e['order']=qs[_0xbe08('0x4a')](_0x5133ef[_0xbe08('0x43')][_0xbe08('0x4a')]);_0x18040e[_0xbe08('0x4b')]=qs['filters'](_[_0xbe08('0x8d')](_0x5133ef['query'],_0x6aa329['filters']));if(_0x5133ef[_0xbe08('0x43')]['filter']){_0x18040e[_0xbe08('0x4b')]=_['merge'](_0x18040e[_0xbe08('0x4b')],{'$or':_[_0xbe08('0x3d')](_0x18040e[_0xbe08('0x46')],function(_0x25ad7a){var _0x3a0603={};_0x3a0603[_0x25ad7a]={'$like':'%'+_0x5133ef[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x3a0603;})});}_0x18040e=_['merge']({},_0x18040e,_0x5133ef[_0xbe08('0x50')]);return _0x24a6c9[_0xbe08('0x9b')](_0x18040e);}})['then'](function(_0x316ffb){if(_0x316ffb){_0x2d58eb=_0x316ffb[_0xbe08('0x5b')];if(!_0x5133ef[_0xbe08('0x43')][_0xbe08('0x47')](_0xbe08('0x48'))){_0x18040e[_0xbe08('0x2f')]=qs[_0xbe08('0x2f')](_0x5133ef['query'][_0xbe08('0x2f')]);_0x18040e[_0xbe08('0x2e')]=qs['offset'](_0x5133ef['query']['offset']);}return _0x24a6c9[_0xbe08('0x9b')](_0x18040e);}})[_0xbe08('0x35')](function(_0x48ac4f){if(_0x48ac4f){return _0x48ac4f?{'count':_0x2d58eb,'rows':_0x48ac4f}:null;}})[_0xbe08('0x35')](respondWithResult(_0x4b71df,null))[_0xbe08('0x55')](handleError(_0x4b71df,null));};exports[_0xbe08('0x9c')]=function(_0x576b13,_0x34a5b0,_0x48f84a){var _0x1e0d81={'raw':!![],'where':{}};var _0x5302b2={};var _0x1e3b6c={'count':0x0,'rows':[]};return db[_0xbe08('0x3e')][_0xbe08('0x66')]({'where':{'id':_0x576b13[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x34a5b0,null))[_0xbe08('0x35')](function(_0x1a9854){if(_0x1a9854){_0x5302b2[_0xbe08('0x41')]=_[_0xbe08('0x59')](db[_0xbe08('0x9d')][_0xbe08('0x3f')]);_0x5302b2['query']=_[_0xbe08('0x59')](_0x576b13[_0xbe08('0x43')]);_0x5302b2[_0xbe08('0x44')]=_[_0xbe08('0x45')](_0x5302b2[_0xbe08('0x41')],_0x5302b2[_0xbe08('0x43')]);_0x1e0d81['attributes']=_['intersection'](_0x5302b2[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x576b13[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x1e0d81[_0xbe08('0x46')]=_0x1e0d81[_0xbe08('0x46')][_0xbe08('0x5b')]?_0x1e0d81[_0xbe08('0x46')]:_0x5302b2['model'];if(!_0x576b13[_0xbe08('0x43')][_0xbe08('0x47')](_0xbe08('0x48'))){_0x1e0d81['limit']=qs[_0xbe08('0x2f')](_0x576b13[_0xbe08('0x43')][_0xbe08('0x2f')]);_0x1e0d81[_0xbe08('0x2e')]=qs[_0xbe08('0x2e')](_0x576b13[_0xbe08('0x43')]['offset']);}_0x1e0d81[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x576b13[_0xbe08('0x43')]['sort']);_0x1e0d81[_0xbe08('0x4b')]=qs[_0xbe08('0x44')](_[_0xbe08('0x8d')](_0x576b13[_0xbe08('0x43')],_0x5302b2[_0xbe08('0x44')]));_0x1e0d81[_0xbe08('0x4b')]['MailAccountId']=_0x1a9854['id'];if(_0x576b13[_0xbe08('0x43')][_0xbe08('0x4c')]){_0x1e0d81[_0xbe08('0x4b')]=_['merge'](_0x1e0d81[_0xbe08('0x4b')],{'$or':_[_0xbe08('0x3d')](_0x1e0d81[_0xbe08('0x46')],function(_0x3594e1){var _0x39d44f={};_0x39d44f[_0x3594e1]={'$like':'%'+_0x576b13[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x39d44f;})});}if(_0x576b13[_0xbe08('0x43')]['$gte']){var _0x28003d=_0x576b13[_0xbe08('0x43')][_0xbe08('0x9e')][_0xbe08('0x9f')](',');var _0x576b77={};_0x576b77[_0x28003d[0x0]]={'$gte':moment(_0x28003d[0x1])[_0xbe08('0xa0')](_0xbe08('0xa1'))};_0x1e0d81['where']=_[_0xbe08('0x4f')](_0x1e0d81[_0xbe08('0x4b')],_0x576b77);}_0x1e0d81=_['merge']({},_0x1e0d81,_0x576b13['options']);return db[_0xbe08('0x9d')][_0xbe08('0x51')]({'where':_0x1e0d81[_0xbe08('0x4b')]})[_0xbe08('0x35')](function(_0x284e40){_0x1e3b6c['count']=_0x284e40;if(_0x576b13[_0xbe08('0x43')][_0xbe08('0x5c')]){_0x1e0d81[_0xbe08('0x52')]=[{'all':!![]}];}return db[_0xbe08('0x9d')][_0xbe08('0x53')](_0x1e0d81);})[_0xbe08('0x35')](function(_0x398f9e){_0x1e3b6c[_0xbe08('0x54')]=_0x398f9e;return _0x1e3b6c;});}})[_0xbe08('0x35')](respondWithFilteredResult(_0x34a5b0,_0x1e0d81))['catch'](handleError(_0x34a5b0,null));};exports[_0xbe08('0x38')]=function(_0x557ba9,_0x43060f,_0x5d4504){var _0x3bd58c,_0x5dfe11={},_0xca3c94;if(_0x557ba9[_0xbe08('0x5f')]['to']){_0xca3c94=_0x557ba9[_0xbe08('0x5f')]['to']['split'](',')[0x0];}return db[_0xbe08('0x3e')]['find']({'where':{'id':_0x557ba9[_0xbe08('0x56')]['id']},'include':[{'model':db[_0xbe08('0xa2')],'as':_0xbe08('0xa3'),'include':[{'model':db[_0xbe08('0x8e')],'as':_0xbe08('0xa4'),'where':{'email':_0xca3c94},'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xbe08('0x3a')],'as':'Smtp','raw':!![]}]})[_0xbe08('0x35')](handleEntityNotFound(_0x43060f,null))[_0xbe08('0x35')](function(_0x4b19d6){if(_0x4b19d6){_0x3bd58c=_0x4b19d6;if(_0x4b19d6[_0xbe08('0x58')]){if(_[_0xbe08('0x6f')](_0x557ba9[_0xbe08('0x5f')]['from'])){_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xa5')]=util[_0xbe08('0xa0')](_0xbe08('0xa6'),_0x4b19d6[_0xbe08('0x42')],_0x4b19d6['email']||_0x4b19d6[_0xbe08('0x58')]['user']);}if(_0x557ba9['body'][_0xbe08('0xa7')]&&_0x557ba9['body'][_0xbe08('0xa7')]['length']){for(var _0x1c79ea=0x0;_0x1c79ea<_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xa7')][_0xbe08('0x5b')];_0x1c79ea+=0x1){_0x557ba9[_0xbe08('0x5f')]['attachments'][_0x1c79ea]={'filename':_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xa7')][_0x1c79ea][_0xbe08('0x42')],'path':path[_0xbe08('0xa8')](config[_0xbe08('0xa9')],_0xbe08('0xaa'),_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xa7')][_0x1c79ea]['basename'])};}}var _0x5a7acb={'tls':{'rejectUnauthorized':![]}};if(_[_0xbe08('0x6f')](_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x7a')])){if(_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x77')]){_0x5a7acb['auth']={'user':_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x73')],'pass':_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x7b')]};}_0x5a7acb[_0xbe08('0x79')]=_0x4b19d6['Smtp'][_0xbe08('0x79')];_0x5a7acb[_0xbe08('0x78')]=_0x4b19d6[_0xbe08('0x58')]['port'];_0x5a7acb[_0xbe08('0xab')]=_0x4b19d6['Smtp'][_0xbe08('0xab')];}else{_0x5a7acb[_0xbe08('0x7a')]=_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x7a')];_0x5a7acb[_0xbe08('0xac')]={'user':_0x4b19d6[_0xbe08('0x58')][_0xbe08('0x73')],'pass':_0x4b19d6[_0xbe08('0x58')]['pass']};}return respondWithRpcPromise(_0xbe08('0xad'),'sendMail',{'account':_0x5a7acb,'message':_0x557ba9[_0xbe08('0x5f')]});}else{throw new Error(_0xbe08('0xae'));}}})[_0xbe08('0x35')](function(_0x14badb){if(_0x14badb){_0x5dfe11=_0x14badb;if(_0x3bd58c[_0xbe08('0xa3')]){if(_0x3bd58c['List'][_0xbe08('0xa4')][_0xbe08('0x5b')]){return _0x3bd58c[_0xbe08('0xa3')][_0xbe08('0xa4')][0x0];}else{return db[_0xbe08('0x8e')]['create'](_[_0xbe08('0x19')](_0x557ba9[_0xbe08('0x5f')],{'firstName':_0x557ba9[_0xbe08('0x5f')]['to'],'email':_0x557ba9[_0xbe08('0x5f')]['to'],'phone':_0x557ba9[_0xbe08('0x5f')]['to'],'ListId':_0x3bd58c[_0xbe08('0xaf')]}));}}else{throw new Error(_0xbe08('0xae'));}}})['then'](function(_0xbfe91){if(_0xbfe91){var _0x65a171={'UserId':_0x557ba9[_0xbe08('0x73')]['id'],'ContactId':_0xbfe91['id'],'MailAccountId':_0x3bd58c['id'],'inReplyTo':_0x5dfe11[_0xbe08('0xb0')],'to':_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xa5')],'cc':_0x557ba9[_0xbe08('0x5f')]['cc'],'subject':_0x557ba9[_0xbe08('0x5f')][_0xbe08('0xb1')],'attach':_0x557ba9['body'][_0xbe08('0xb2')],'firstMsgDirection':_0xbe08('0xb3'),'lastMsgAt':moment()[_0xbe08('0xa0')](_0xbe08('0xa1')),'lastMsgDirection':_0xbe08('0xb3'),'lastMsgBody':_0x557ba9[_0xbe08('0x5f')][_0xbe08('0x5f')],'Messages':[_[_0xbe08('0x4f')](_0x557ba9[_0xbe08('0x5f')],{'messageId':_0x5dfe11[_0xbe08('0xb0')],'sentAt':moment()['format'](_0xbe08('0xa1')),'read':!![],'MailAccountId':_0x3bd58c['id'],'UserId':_0x557ba9[_0xbe08('0x73')]['id'],'ContactId':_0xbfe91['id']})]};if(_0x557ba9['body'][_0xbe08('0xb4')]){_0x65a171=_[_0xbe08('0x4f')](_0x65a171,_0x557ba9[_0xbe08('0x5f')]['Interaction']);}return db['MailInteraction'][_0xbe08('0x64')](_0x65a171,{'include':[{'model':db[_0xbe08('0x9d')],'as':'Messages'}]});}})[_0xbe08('0x35')](respondWithResult(_0x43060f,null))['catch'](handleError(_0x43060f,null));};exports[_0xbe08('0xb5')]=function(_0x40ed4e,_0x20d5c6,_0x571f61){return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x40ed4e['params']['id']},'include':[{'model':db[_0xbe08('0x3a')],'as':_0xbe08('0x58'),'raw':!![]}]})[_0xbe08('0x35')](handleEntityNotFound(_0x20d5c6,null))[_0xbe08('0x35')](function(_0x164d9){if(_0x164d9&&_0x164d9[_0xbe08('0x58')]){var _0x4acb28={'id':_0x164d9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x164d9[_0xbe08('0x58')][_0xbe08('0x7a')]){_0x4acb28[_0xbe08('0x7a')]=_0x164d9[_0xbe08('0x58')][_0xbe08('0x7a')];}else{_0x4acb28[_0xbe08('0x79')]=_0x164d9['Smtp'][_0xbe08('0x79')];_0x4acb28['port']=_0x164d9[_0xbe08('0x58')][_0xbe08('0x78')];_0x4acb28[_0xbe08('0xab')]=_0x164d9[_0xbe08('0x58')][_0xbe08('0xab')];}if(_0x164d9['Smtp'][_0xbe08('0x77')]){_0x4acb28[_0xbe08('0xac')]={'user':_0x164d9[_0xbe08('0x58')][_0xbe08('0x73')],'pass':_0x164d9[_0xbe08('0x58')]['pass']};}return respondWithRpcPromise('VerifySmtp',_0xbe08('0xb5'),{'account':_0x4acb28});}})['then'](respondWithResult(_0x20d5c6,null))[_0xbe08('0x55')](handleError(_0x20d5c6,null));};exports['destroy']=function(_0x570114,_0x51e7a8){return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x570114[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x51e7a8,null))[_0xbe08('0x35')](function(_0x317188){if(_0x317188&&_0x317188[_0xbe08('0x7a')]){throw new db[(_0xbe08('0xb6'))]['ValidationError'](_0xbe08('0xb7'));}return _0x317188;})['then'](removeEntity(_0x51e7a8,null))[_0xbe08('0x55')](handleError(_0x51e7a8,null));};exports[_0xbe08('0xb8')]=function(_0xbd8868,_0x3583a5,_0x4f41c1){return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0xbd8868[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x3583a5,null))[_0xbe08('0x35')](function(_0x519a2f){if(_0x519a2f){return _0x519a2f[_0xbe08('0xb8')](_0xbd8868[_0xbe08('0x5f')][_0xbe08('0x68')],_['omit'](_0xbd8868[_0xbe08('0x5f')],[_0xbe08('0x68'),'id'])||{})[_0xbe08('0xb9')](function(_0x19e0e5){for(var _0x3e67ff=0x0;_0x3e67ff<_0xbd8868['body'][_0xbe08('0x68')][_0xbe08('0x5b')];_0x3e67ff+=0x1){socket['emit']('userMailAccount:save',{'UserId':_0xbd8868['body'][_0xbe08('0x68')][_0x3e67ff],'MailAccountId':_0xbd8868[_0xbe08('0x56')]['id']});}return _0x19e0e5;});}})['then'](respondWithResult(_0x3583a5,null))[_0xbe08('0x55')](handleError(_0x3583a5,null));};exports['removeAgents']=function(_0x1a8eb8,_0x1067dd,_0x4b5a17){return db[_0xbe08('0x3e')][_0xbe08('0x5d')]({'where':{'id':_0x1a8eb8[_0xbe08('0x56')]['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x1067dd,null))[_0xbe08('0x35')](function(_0x1831fc){if(_0x1831fc){return _0x1831fc[_0xbe08('0xba')](_0x1a8eb8[_0xbe08('0x43')][_0xbe08('0x68')])['then'](function(){if(_[_0xbe08('0xbb')](_0x1a8eb8[_0xbe08('0x43')][_0xbe08('0x68')])){for(var _0x2e4ea6=0x0;_0x2e4ea6<_0x1a8eb8[_0xbe08('0x43')][_0xbe08('0x68')][_0xbe08('0x5b')];_0x2e4ea6+=0x1){socket[_0xbe08('0xbc')]('userMailAccount:remove',{'UserId':Number(_0x1a8eb8[_0xbe08('0x43')]['ids'][_0x2e4ea6]),'MailAccountId':Number(_0x1a8eb8[_0xbe08('0x56')]['id'])});}}else{socket[_0xbe08('0xbc')](_0xbe08('0xbd'),{'UserId':Number(_0x1a8eb8[_0xbe08('0x43')]['ids']),'MailAccountId':Number(_0x1a8eb8[_0xbe08('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1067dd,null))[_0xbe08('0x55')](handleError(_0x1067dd,null));};exports[_0xbe08('0xbe')]=function(_0x6d8a5b,_0x1e4740,_0x24c257){var _0x29f915={};var _0x3eb332={};var _0x10b992;var _0x2bb08e;return db[_0xbe08('0x3e')][_0xbe08('0x66')]({'where':{'id':_0x6d8a5b['params']['id']}})[_0xbe08('0x35')](handleEntityNotFound(_0x1e4740,null))[_0xbe08('0x35')](function(_0x4001fb){if(_0x4001fb){_0x10b992=_0x4001fb;_0x3eb332[_0xbe08('0x41')]=_[_0xbe08('0x59')](db[_0xbe08('0x90')][_0xbe08('0x3f')]);_0x3eb332['query']=_[_0xbe08('0x59')](_0x6d8a5b[_0xbe08('0x43')]);_0x3eb332[_0xbe08('0x44')]=_['intersection'](_0x3eb332[_0xbe08('0x41')],_0x3eb332[_0xbe08('0x43')]);_0x29f915['attributes']=_[_0xbe08('0x45')](_0x3eb332[_0xbe08('0x41')],qs[_0xbe08('0x5a')](_0x6d8a5b[_0xbe08('0x43')][_0xbe08('0x5a')]));_0x29f915['attributes']=_0x29f915[_0xbe08('0x46')]['length']?_0x29f915['attributes']:_0x3eb332[_0xbe08('0x41')];_0x29f915[_0xbe08('0x49')]=qs[_0xbe08('0x4a')](_0x6d8a5b['query'][_0xbe08('0x4a')]);_0x29f915[_0xbe08('0x4b')]=qs[_0xbe08('0x44')](_[_0xbe08('0x8d')](_0x6d8a5b[_0xbe08('0x43')],_0x3eb332[_0xbe08('0x44')]));if(_0x6d8a5b[_0xbe08('0x43')][_0xbe08('0x4c')]){_0x29f915[_0xbe08('0x4b')]=_['merge'](_0x29f915[_0xbe08('0x4b')],{'$or':_[_0xbe08('0x3d')](_0x29f915['attributes'],function(_0x71325a){var _0x2a86ee={};_0x2a86ee[_0x71325a]={'$like':'%'+_0x6d8a5b[_0xbe08('0x43')][_0xbe08('0x4c')]+'%'};return _0x2a86ee;})});}_0x29f915=_[_0xbe08('0x4f')]({},_0x29f915,_0x6d8a5b[_0xbe08('0x50')]);return _0x10b992['getAgents'](_0x29f915);}})[_0xbe08('0x35')](function(_0x4fbc35){if(_0x4fbc35){_0x2bb08e=_0x4fbc35[_0xbe08('0x5b')];if(!_0x6d8a5b[_0xbe08('0x43')]['hasOwnProperty']('nolimit')){_0x29f915[_0xbe08('0x2f')]=qs[_0xbe08('0x2f')](_0x6d8a5b[_0xbe08('0x43')][_0xbe08('0x2f')]);_0x29f915[_0xbe08('0x2e')]=qs[_0xbe08('0x2e')](_0x6d8a5b[_0xbe08('0x43')]['offset']);}return _0x10b992[_0xbe08('0xbe')](_0x29f915);}})[_0xbe08('0x35')](function(_0x21b8a1){if(_0x21b8a1){return _0x21b8a1?{'count':_0x2bb08e,'rows':_0x21b8a1}:null;}})['then'](respondWithResult(_0x1e4740,null))[_0xbe08('0x55')](handleError(_0x1e4740,null));}; \ No newline at end of file +var _0xbe3a=['format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','DESC','from','%s\x20<%s>','attachments','join','auth','pass','secure','sendMail','List\x20not\x20found','Contacts','messageId','subject','attach','out','Interaction','VerifySmtp','verifySmtp','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','html-pdf','rimraf','zip-dir','moment','bluebird','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../mysqldb','redis','defaults','localhost','register','jayson/promise','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','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','status','end','count','offset','limit','json','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','MailServerIn','Imap','Pause','mandatoryDispositionPause','map','MailAccount','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','findAll','rows','show','params','MailServerOut','Smtp','rawAttributes','include','find','body','describe','addDisposition','MailAccountId','Disposition','create','getDispositions','findOne','removeDispositions','addAnswer','getAnswers','includeAll','CannedAnswer','removeAnswers','ids','email','ListId','active','isNil','cauthentication','user','password','cpassword','authentication','host','port','service','cservice','cuser','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','getImap','removeImap','setImap','getSmtp','removeSmtp','omit','getInteractions','MailInteraction','CmContact','Contact','User','Owner','fullname','internal','Tag','color','tag','addApplications','sequelize','transaction','MailApplication','findAndCountAll','priority','getApplications','MailMessage','$gte','split'];(function(_0xfb03a9,_0xf17818){var _0x4cb23d=function(_0x1a6504){while(--_0x1a6504){_0xfb03a9['push'](_0xfb03a9['shift']());}};_0x4cb23d(++_0xf17818);}(_0xbe3a,0xd4));var _0xabe3=function(_0x3aeee2,_0x405e4a){_0x3aeee2=_0x3aeee2-0x0;var _0x5aeed5=_0xbe3a[_0x3aeee2];return _0x5aeed5;};'use strict';var pdf=require(_0xabe3('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xabe3('0x1'));var zipdir=require(_0xabe3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xabe3('0x3'));var BPromise=require(_0xabe3('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xabe3('0x5'));var sox=require(_0xabe3('0x6'));var csv=require('to-csv');var ejs=require(_0xabe3('0x7'));var fs=require('fs');var _=require(_0xabe3('0x8'));var squel=require(_0xabe3('0x9'));var crypto=require(_0xabe3('0xa'));var jsforce=require(_0xabe3('0xb'));var deskjs=require(_0xabe3('0xc'));var toCsv=require('to-csv');var querystring=require(_0xabe3('0xd'));var Papa=require(_0xabe3('0xe'));var Redis=require(_0xabe3('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xabe3('0x10'));var as=require(_0xabe3('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xabe3('0x12'));var utils=require('../../config/utils');var config=require(_0xabe3('0x13'));var db=require(_0xabe3('0x14'))['db'];config[_0xabe3('0x15')]=_[_0xabe3('0x16')](config[_0xabe3('0x15')],{'host':_0xabe3('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./mailAccount.socket')[_0xabe3('0x18')](socket);var jayson=require(_0xabe3('0x19'));var client=jayson['client']['http']({'port':0x232b});function checkPasswordPattern(_0xdfdd5e,_0xceb05,_0x446ce3){if(_0x446ce3){var _0x1b02ff=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1b02ff[_0xabe3('0x1a')](_0xceb05)){return _0xdfdd5e;}else{throw new db[(_0xabe3('0x1b'))][(_0xabe3('0x1c'))](_0xabe3('0x1d'));}}else{return _0xdfdd5e;}}function respondWithRpcPromise(_0x4d1651,_0x3392b6,_0x102b88,_0x45b6ad){return new BPromise(function(_0x24049d,_0x4b14be){var _0x40fc93=_0x45b6ad||client;return _0x40fc93[_0xabe3('0x1e')](_0x4d1651,_0x102b88)[_0xabe3('0x1f')](function(_0x3ac72a){logger['info'](_0xabe3('0x20'),_0x3392b6,'request\x20sent');logger[_0xabe3('0x21')](_0xabe3('0x22'),_0x3392b6,_0xabe3('0x23'),JSON[_0xabe3('0x24')](_0x3ac72a));if(_0x3ac72a[_0xabe3('0x25')]){if(_0x3ac72a['error'][_0xabe3('0x26')]===0x1f4){logger['error'](_0xabe3('0x20'),_0x3392b6,_0x3ac72a[_0xabe3('0x25')]['message']);return _0x4b14be(_0x3ac72a['error'][_0xabe3('0x27')]);}logger[_0xabe3('0x25')](_0xabe3('0x20'),_0x3392b6,_0x3ac72a['error'][_0xabe3('0x27')]);return _0x24049d(_0x3ac72a[_0xabe3('0x25')][_0xabe3('0x27')]);}else{logger['info'](_0xabe3('0x20'),_0x3392b6,_0xabe3('0x23'));_0x24049d(_0x3ac72a['result'][_0xabe3('0x27')]);}})[_0xabe3('0x28')](function(_0x1ee494){logger[_0xabe3('0x25')](_0xabe3('0x20'),_0x3392b6,_0x1ee494);_0x4b14be(_0x1ee494);});});}function respondWithStatusCode(_0x38a9a3,_0x11e739){_0x11e739=_0x11e739||0xcc;return function(_0x27aa0d){if(_0x27aa0d){return _0x38a9a3['sendStatus'](_0x11e739);}return _0x38a9a3[_0xabe3('0x29')](_0x11e739)[_0xabe3('0x2a')]();};}function respondWithResult(_0x1c754d,_0x5660ea){_0x5660ea=_0x5660ea||0xc8;return function(_0x5d2bf1){if(_0x5d2bf1){return _0x1c754d[_0xabe3('0x29')](_0x5660ea)['json'](_0x5d2bf1);}};}function respondWithFilteredResult(_0x51fc2e,_0x28533e){return function(_0x48402d){if(_0x48402d){var _0x3bd527=_0x48402d[_0xabe3('0x2b')],_0x53c389=_0x28533e[_0xabe3('0x2c')],_0xf0e57c=_0x28533e[_0xabe3('0x2c')]+_0x28533e[_0xabe3('0x2d')],_0x3a9c79;if(_0xf0e57c>=_0x3bd527){_0xf0e57c=_0x3bd527;_0x3a9c79=0xc8;}else{_0x3a9c79=0xce;}_0x51fc2e[_0xabe3('0x29')](_0x3a9c79);return _0x51fc2e['set']('Content-Range',_0x53c389+'-'+_0xf0e57c+'/'+_0x3bd527)[_0xabe3('0x2e')](_0x48402d);}return null;};}function patchUpdates(_0x2eb7f8){return function(_0x13229d){try{jsonpatch[_0xabe3('0x2f')](_0x13229d,_0x2eb7f8,!![]);}catch(_0x3b7610){return BPromise[_0xabe3('0x30')](_0x3b7610);}return _0x13229d[_0xabe3('0x31')]();};}function saveUpdates(_0x239cff,_0x34b152){return function(_0x18e6d3){if(_0x18e6d3){return _0x18e6d3[_0xabe3('0x32')](_0x239cff)[_0xabe3('0x1f')](function(_0x562bba){return _0x562bba;});}return null;};}function removeEntity(_0x3d4d0a,_0x5ce402){return function(_0x25686b){if(_0x25686b){return _0x25686b[_0xabe3('0x33')]()[_0xabe3('0x1f')](function(){var _0x56ab68=_0x25686b[_0xabe3('0x34')]({'plain':!![]});var _0x52cc01=_0xabe3('0x35');return db[_0xabe3('0x36')][_0xabe3('0x33')]({'where':{'type':_0x52cc01,'resourceId':_0x56ab68['id']}})[_0xabe3('0x1f')](function(){return _0x25686b;});})[_0xabe3('0x1f')](function(){_0x3d4d0a[_0xabe3('0x29')](0xcc)[_0xabe3('0x2a')]();});}};}function handleEntityNotFound(_0x111a1d,_0x100500){return function(_0x43ca88){if(!_0x43ca88){_0x111a1d['sendStatus'](0x194);}return _0x43ca88;};}function handleError(_0x3f96a3,_0x5c932e){_0x5c932e=_0x5c932e||0x1f4;return function(_0x38ad98){logger[_0xabe3('0x25')](_0x38ad98[_0xabe3('0x37')]);if(_0x38ad98['name']){delete _0x38ad98[_0xabe3('0x38')];}_0x3f96a3[_0xabe3('0x29')](_0x5c932e)[_0xabe3('0x39')](_0x38ad98);};}exports[_0xabe3('0x3a')]=function(_0x22979d,_0x5a4be5){var _0x1d24df={'include':[{'model':db[_0xabe3('0x3b')],'as':_0xabe3('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xabe3('0x3d')],'as':_0xabe3('0x3e')}]},_0x28de32={},_0x31bb2d={'count':0x0,'rows':[]};var _0x585c69=_[_0xabe3('0x3f')](db[_0xabe3('0x40')]['rawAttributes'],function(_0x1d9c73){return{'name':_0x1d9c73[_0xabe3('0x41')],'type':_0x1d9c73[_0xabe3('0x42')][_0xabe3('0x43')]};});_0x28de32[_0xabe3('0x44')]=_['map'](_0x585c69,_0xabe3('0x38'));_0x28de32[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x22979d[_0xabe3('0x45')]);_0x28de32[_0xabe3('0x47')]=_[_0xabe3('0x48')](_0x28de32[_0xabe3('0x44')],_0x28de32['query']);_0x1d24df[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0x28de32['model'],qs[_0xabe3('0x4a')](_0x22979d[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x1d24df[_0xabe3('0x49')]=_0x1d24df[_0xabe3('0x49')][_0xabe3('0x4b')]?_0x1d24df[_0xabe3('0x49')]:_0x28de32[_0xabe3('0x44')];if(!_0x22979d[_0xabe3('0x45')][_0xabe3('0x4c')](_0xabe3('0x4d'))){_0x1d24df[_0xabe3('0x2d')]=qs[_0xabe3('0x2d')](_0x22979d['query']['limit']);_0x1d24df[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x22979d[_0xabe3('0x45')][_0xabe3('0x2c')]);}_0x1d24df[_0xabe3('0x4e')]=qs[_0xabe3('0x4f')](_0x22979d[_0xabe3('0x45')]['sort']);_0x1d24df['where']=qs[_0xabe3('0x47')](_[_0xabe3('0x50')](_0x22979d[_0xabe3('0x45')],_0x28de32[_0xabe3('0x47')]));if(_0x22979d['query'][_0xabe3('0x51')]){_0x1d24df[_0xabe3('0x52')]=_['merge'](_0x1d24df[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x585c69,function(_0xf70dcd){if(_0xf70dcd[_0xabe3('0x42')]!=='VIRTUAL'){var _0x10bd6a={};_0x10bd6a[_0xf70dcd[_0xabe3('0x38')]]={'$like':'%'+_0x22979d['query'][_0xabe3('0x51')]+'%'};return _0x10bd6a;}})});}_0x1d24df=_[_0xabe3('0x53')]({},_0x1d24df,_0x22979d[_0xabe3('0x54')]);var _0xfc43f6={'where':_0x1d24df['where']};return db['MailAccount'][_0xabe3('0x2b')](_0xfc43f6)[_0xabe3('0x1f')](function(_0xa588d1){_0x31bb2d[_0xabe3('0x2b')]=_0xa588d1;if(_0x22979d[_0xabe3('0x45')]['includeAll']){_0x1d24df['include']=[{'all':!![]}];}return db['MailAccount'][_0xabe3('0x55')](_0x1d24df);})[_0xabe3('0x1f')](function(_0x1ac0f2){_0x31bb2d[_0xabe3('0x56')]=_0x1ac0f2;return _0x31bb2d;})['then'](respondWithFilteredResult(_0x5a4be5,_0x1d24df))['catch'](handleError(_0x5a4be5,null));};exports[_0xabe3('0x57')]=function(_0x5a73c1,_0x2b2a9a){var _0x349840={'raw':![],'where':{'id':_0x5a73c1[_0xabe3('0x58')]['id']},'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xabe3('0x59')],'as':_0xabe3('0x5a')},{'model':db[_0xabe3('0x3d')],'as':_0xabe3('0x3e')}]},_0x3b881a={};_0x3b881a[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x40')][_0xabe3('0x5b')]);_0x3b881a[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x5a73c1[_0xabe3('0x45')]);_0x3b881a['filters']=_[_0xabe3('0x48')](_0x3b881a[_0xabe3('0x44')],_0x3b881a[_0xabe3('0x45')]);_0x349840['attributes']=_[_0xabe3('0x48')](_0x3b881a['model'],qs[_0xabe3('0x4a')](_0x5a73c1[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x349840['attributes']=_0x349840[_0xabe3('0x49')]['length']?_0x349840['attributes']:_0x3b881a['model'];if(_0x5a73c1[_0xabe3('0x45')]['includeAll']){_0x349840[_0xabe3('0x5c')]=[{'all':!![]}];}_0x349840=_[_0xabe3('0x53')]({},_0x349840,_0x5a73c1[_0xabe3('0x54')]);return db[_0xabe3('0x40')][_0xabe3('0x5d')](_0x349840)[_0xabe3('0x1f')](handleEntityNotFound(_0x2b2a9a,null))[_0xabe3('0x1f')](respondWithResult(_0x2b2a9a,null))[_0xabe3('0x28')](handleError(_0x2b2a9a,null));};exports['update']=function(_0x167730,_0x7af518){if(_0x167730[_0xabe3('0x5e')]['id']){delete _0x167730[_0xabe3('0x5e')]['id'];}return db[_0xabe3('0x40')]['find']({'where':{'id':_0x167730[_0xabe3('0x58')]['id']},'include':[{'model':db[_0xabe3('0x3b')],'as':_0xabe3('0x3c')},{'model':db['MailServerOut'],'as':'Smtp'},{'model':db[_0xabe3('0x3d')],'as':_0xabe3('0x3e')}]})['then'](handleEntityNotFound(_0x7af518,null))[_0xabe3('0x1f')](saveUpdates(_0x167730[_0xabe3('0x5e')],null))['then'](function(_0x273398){if(_0x273398&&_0x167730[_0xabe3('0x5e')]['Imap']){return db['MailServerIn'][_0xabe3('0x32')](_0x167730[_0xabe3('0x5e')][_0xabe3('0x3c')],{'where':{'MailAccountId':_0x273398['id']}})[_0xabe3('0x1f')](function(){return _0x273398;});}return _0x273398;})[_0xabe3('0x1f')](function(_0x36b5bd){if(_0x36b5bd&&_0x167730['body'][_0xabe3('0x5a')]){return db[_0xabe3('0x59')][_0xabe3('0x32')](_0x167730[_0xabe3('0x5e')]['Smtp'],{'where':{'MailAccountId':_0x36b5bd['id']}})[_0xabe3('0x1f')](function(){return _0x36b5bd;});}return _0x36b5bd;})[_0xabe3('0x1f')](respondWithResult(_0x7af518,null))[_0xabe3('0x28')](handleError(_0x7af518,null));};exports[_0xabe3('0x5f')]=function(_0x349718,_0x5eade3){return db['MailAccount']['describe']()['then'](respondWithResult(_0x5eade3,null))['catch'](handleError(_0x5eade3,null));};exports[_0xabe3('0x60')]=function(_0x4c7153,_0x11e583,_0x483870){if(_0x4c7153[_0xabe3('0x5e')]['id']){delete _0x4c7153[_0xabe3('0x5e')]['id'];}return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x4c7153[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x11e583,null))[_0xabe3('0x1f')](function(_0x17b877){if(_0x17b877){_0x4c7153[_0xabe3('0x5e')][_0xabe3('0x61')]=_0x17b877['id'];return db[_0xabe3('0x62')][_0xabe3('0x63')](_0x4c7153[_0xabe3('0x5e')]);}})[_0xabe3('0x1f')](respondWithResult(_0x11e583,null))[_0xabe3('0x28')](handleError(_0x11e583,null));};exports[_0xabe3('0x64')]=function(_0x4a1c89,_0x4c9046,_0x45d832){var _0x3ee6e0={'raw':![],'where':{}};var _0xb49c75={};var _0x11c9b6={'count':0x0,'rows':[]};return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x4a1c89[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x4c9046,null))[_0xabe3('0x1f')](function(_0x2c9454){if(_0x2c9454){_0xb49c75[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x62')][_0xabe3('0x5b')]);_0xb49c75[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x4a1c89[_0xabe3('0x45')]);_0xb49c75[_0xabe3('0x47')]=_[_0xabe3('0x48')](_0xb49c75[_0xabe3('0x44')],_0xb49c75[_0xabe3('0x45')]);_0x3ee6e0[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0xb49c75[_0xabe3('0x44')],qs[_0xabe3('0x4a')](_0x4a1c89[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x3ee6e0[_0xabe3('0x49')]=_0x3ee6e0[_0xabe3('0x49')]['length']?_0x3ee6e0['attributes']:_0xb49c75[_0xabe3('0x44')];if(!_0x4a1c89[_0xabe3('0x45')]['hasOwnProperty'](_0xabe3('0x4d'))){_0x3ee6e0[_0xabe3('0x2d')]=qs[_0xabe3('0x2d')](_0x4a1c89[_0xabe3('0x45')][_0xabe3('0x2d')]);_0x3ee6e0[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x4a1c89[_0xabe3('0x45')][_0xabe3('0x2c')]);}_0x3ee6e0[_0xabe3('0x4e')]=qs['sort'](_0x4a1c89[_0xabe3('0x45')][_0xabe3('0x4f')]);_0x3ee6e0[_0xabe3('0x52')]=qs[_0xabe3('0x47')](_[_0xabe3('0x50')](_0x4a1c89['query'],_0xb49c75['filters']));_0x3ee6e0['where'][_0xabe3('0x61')]=_0x2c9454['id'];if(_0x4a1c89['query'][_0xabe3('0x51')]){_0x3ee6e0[_0xabe3('0x52')]=_[_0xabe3('0x53')](_0x3ee6e0[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x3ee6e0['attributes'],function(_0x404c7a){var _0x40d2ef={};_0x40d2ef[_0x404c7a]={'$like':'%'+_0x4a1c89['query'][_0xabe3('0x51')]+'%'};return _0x40d2ef;})});}_0x3ee6e0=_['merge']({},_0x3ee6e0,_0x4a1c89['options']);return db['Disposition']['count']({'where':_0x3ee6e0[_0xabe3('0x52')]})[_0xabe3('0x1f')](function(_0x53e255){_0x11c9b6[_0xabe3('0x2b')]=_0x53e255;if(_0x4a1c89['query']['includeAll']){_0x3ee6e0['include']=[{'all':!![]}];}return db[_0xabe3('0x62')][_0xabe3('0x55')](_0x3ee6e0);})[_0xabe3('0x1f')](function(_0x51b9e7){_0x11c9b6[_0xabe3('0x56')]=_0x51b9e7;return _0x11c9b6;});}})[_0xabe3('0x1f')](respondWithFilteredResult(_0x4c9046,_0x3ee6e0))[_0xabe3('0x28')](handleError(_0x4c9046,null));};exports[_0xabe3('0x66')]=function(_0x2594ef,_0x28c047,_0x362d60){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x2594ef[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x28c047,null))[_0xabe3('0x1f')](function(_0x4d1823){if(_0x4d1823){return _0x4d1823[_0xabe3('0x66')](_0x2594ef[_0xabe3('0x45')]['ids']);}})[_0xabe3('0x1f')](respondWithStatusCode(_0x28c047,null))['catch'](handleError(_0x28c047,null));};exports[_0xabe3('0x67')]=function(_0x1ec98a,_0x210942,_0x4d9edb){if(_0x1ec98a['body']['id']){delete _0x1ec98a[_0xabe3('0x5e')]['id'];}return db['MailAccount'][_0xabe3('0x5d')]({'where':{'id':_0x1ec98a[_0xabe3('0x58')]['id']}})['then'](handleEntityNotFound(_0x210942,null))[_0xabe3('0x1f')](function(_0x573276){if(_0x573276){_0x1ec98a[_0xabe3('0x5e')][_0xabe3('0x61')]=_0x573276['id'];return db['CannedAnswer'][_0xabe3('0x63')](_0x1ec98a[_0xabe3('0x5e')]);}})[_0xabe3('0x1f')](respondWithResult(_0x210942,null))[_0xabe3('0x28')](handleError(_0x210942,null));};exports[_0xabe3('0x68')]=function(_0x3f2d06,_0x372ba9,_0x48418d){var _0x425008={'raw':![],'where':{}};var _0x1ad66a={};var _0x4a0be6={'count':0x0,'rows':[]};return db[_0xabe3('0x40')]['findOne']({'where':{'id':_0x3f2d06[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x372ba9,null))[_0xabe3('0x1f')](function(_0x4745b9){if(_0x4745b9){_0x1ad66a[_0xabe3('0x44')]=_[_0xabe3('0x46')](db['CannedAnswer'][_0xabe3('0x5b')]);_0x1ad66a[_0xabe3('0x45')]=_['keys'](_0x3f2d06[_0xabe3('0x45')]);_0x1ad66a['filters']=_[_0xabe3('0x48')](_0x1ad66a['model'],_0x1ad66a[_0xabe3('0x45')]);_0x425008['attributes']=_['intersection'](_0x1ad66a[_0xabe3('0x44')],qs[_0xabe3('0x4a')](_0x3f2d06[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x425008['attributes']=_0x425008['attributes'][_0xabe3('0x4b')]?_0x425008[_0xabe3('0x49')]:_0x1ad66a[_0xabe3('0x44')];if(!_0x3f2d06['query'][_0xabe3('0x4c')](_0xabe3('0x4d'))){_0x425008[_0xabe3('0x2d')]=qs[_0xabe3('0x2d')](_0x3f2d06[_0xabe3('0x45')]['limit']);_0x425008[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x3f2d06[_0xabe3('0x45')][_0xabe3('0x2c')]);}_0x425008['order']=qs[_0xabe3('0x4f')](_0x3f2d06['query'][_0xabe3('0x4f')]);_0x425008[_0xabe3('0x52')]=qs['filters'](_[_0xabe3('0x50')](_0x3f2d06[_0xabe3('0x45')],_0x1ad66a[_0xabe3('0x47')]));_0x425008[_0xabe3('0x52')][_0xabe3('0x61')]=_0x4745b9['id'];if(_0x3f2d06['query'][_0xabe3('0x51')]){_0x425008[_0xabe3('0x52')]=_[_0xabe3('0x53')](_0x425008[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x425008[_0xabe3('0x49')],function(_0x3c5279){var _0x1fc521={};_0x1fc521[_0x3c5279]={'$like':'%'+_0x3f2d06[_0xabe3('0x45')][_0xabe3('0x51')]+'%'};return _0x1fc521;})});}_0x425008=_[_0xabe3('0x53')]({},_0x425008,_0x3f2d06[_0xabe3('0x54')]);return db['CannedAnswer'][_0xabe3('0x2b')]({'where':_0x425008[_0xabe3('0x52')]})[_0xabe3('0x1f')](function(_0xa47119){_0x4a0be6['count']=_0xa47119;if(_0x3f2d06[_0xabe3('0x45')][_0xabe3('0x69')]){_0x425008[_0xabe3('0x5c')]=[{'all':!![]}];}return db[_0xabe3('0x6a')]['findAll'](_0x425008);})[_0xabe3('0x1f')](function(_0x5301cd){_0x4a0be6[_0xabe3('0x56')]=_0x5301cd;return _0x4a0be6;});}})['then'](respondWithFilteredResult(_0x372ba9,_0x425008))[_0xabe3('0x28')](handleError(_0x372ba9,null));};exports[_0xabe3('0x6b')]=function(_0x32091a,_0x410240,_0x28220b){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x32091a['params']['id']}})['then'](handleEntityNotFound(_0x410240,null))[_0xabe3('0x1f')](function(_0x35d8e3){if(_0x35d8e3){return _0x35d8e3[_0xabe3('0x6b')](_0x32091a[_0xabe3('0x45')][_0xabe3('0x6c')]);}})['then'](respondWithStatusCode(_0x410240,null))[_0xabe3('0x28')](handleError(_0x410240,null));};exports[_0xabe3('0x63')]=function(_0x3d616d,_0x152d9a){var _0xb7e7ac={'name':_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x38')],'key':_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x43')],'email':_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x6d')],'ListId':_0x3d616d['body'][_0xabe3('0x6e')],'active':!_['isNil'](_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x6f')])?_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x6f')]:!![],'description':_0x3d616d[_0xabe3('0x5e')]['description']||null,'Imap':{},'Smtp':{}};if(_[_0xabe3('0x70')](_0x3d616d[_0xabe3('0x5e')]['cservice'])){if(_0x3d616d['body'][_0xabe3('0x71')]){_0xb7e7ac['Imap'][_0xabe3('0x72')]=_0xb7e7ac[_0xabe3('0x5a')][_0xabe3('0x72')]=_0x3d616d[_0xabe3('0x5e')]['cuser'];_0xb7e7ac[_0xabe3('0x3c')][_0xabe3('0x73')]=_0xb7e7ac[_0xabe3('0x5a')]['pass']=_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x74')];}else{_0xb7e7ac['Imap'][_0xabe3('0x75')]=_0xb7e7ac[_0xabe3('0x5a')]['authentication']=![];}_0xb7e7ac[_0xabe3('0x3c')][_0xabe3('0x76')]=_0x3d616d[_0xabe3('0x5e')]['Imap'][_0xabe3('0x76')];_0xb7e7ac[_0xabe3('0x3c')][_0xabe3('0x77')]=_0x3d616d['body'][_0xabe3('0x3c')][_0xabe3('0x77')];_0xb7e7ac[_0xabe3('0x5a')][_0xabe3('0x76')]=_0x3d616d[_0xabe3('0x5e')]['Smtp']['host'];_0xb7e7ac['Smtp']['port']=_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x5a')][_0xabe3('0x77')];}else{_0xb7e7ac[_0xabe3('0x3c')]['service']=_0xb7e7ac[_0xabe3('0x5a')][_0xabe3('0x78')]=_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x79')];_0xb7e7ac[_0xabe3('0x3c')][_0xabe3('0x72')]=_0xb7e7ac[_0xabe3('0x5a')][_0xabe3('0x72')]=_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x7a')];_0xb7e7ac[_0xabe3('0x3c')][_0xabe3('0x73')]=_0xb7e7ac[_0xabe3('0x5a')]['pass']=_0x3d616d[_0xabe3('0x5e')][_0xabe3('0x74')];}return db[_0xabe3('0x40')][_0xabe3('0x63')](_0xb7e7ac,{'include':[{'model':db[_0xabe3('0x59')],'as':_0xabe3('0x5a')},{'model':db[_0xabe3('0x3b')],'as':_0xabe3('0x3c')}]})[_0xabe3('0x1f')](function(_0xd60a1b){var _0x2ef793=_0x3d616d['user'][_0xabe3('0x34')]({'plain':!![]});if(!_0x2ef793)throw new Error(_0xabe3('0x7b'));if(_0x2ef793['role']===_0xabe3('0x72')){var _0x479fba=_0xd60a1b[_0xabe3('0x34')]({'plain':!![]});return db[_0xabe3('0x7c')][_0xabe3('0x5d')]({'where':{'name':_0xabe3('0x35'),'userProfileId':_0x2ef793[_0xabe3('0x7d')]},'raw':!![]})[_0xabe3('0x1f')](function(_0x4679ad){if(_0x4679ad&&_0x4679ad[_0xabe3('0x7e')]===0x0){return db[_0xabe3('0x36')][_0xabe3('0x63')]({'name':_0x479fba[_0xabe3('0x38')],'resourceId':_0x479fba['id'],'type':_0x4679ad['name'],'sectionId':_0x4679ad['id']},{})[_0xabe3('0x1f')](function(){return _0xd60a1b;});}else{return _0xd60a1b;}})[_0xabe3('0x28')](function(_0x43f79f){logger[_0xabe3('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43f79f);throw _0x43f79f;});}return _0xd60a1b;})[_0xabe3('0x1f')](respondWithResult(_0x152d9a,0xc9))[_0xabe3('0x28')](handleError(_0x152d9a,null));};exports[_0xabe3('0x7f')]=function(_0x48fe8e,_0x559372,_0x2032c5){return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x48fe8e['params']['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x559372,null))['then'](function(_0xdde1c0){if(_0xdde1c0){return _0xdde1c0[_0xabe3('0x7f')]();}return null;})['then'](respondWithResult(_0x559372,null))[_0xabe3('0x28')](handleError(_0x559372,null));};exports['addImap']=function(_0x4ad9d3,_0x55577b,_0x19eac2){if(_0x4ad9d3['body']['id']){delete _0x4ad9d3[_0xabe3('0x5e')]['id'];}return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x4ad9d3['params']['id']}})['then'](handleEntityNotFound(_0x55577b,null))[_0xabe3('0x1f')](function(_0x3e2f30){if(_0x3e2f30){_0x4ad9d3[_0xabe3('0x5e')][_0xabe3('0x61')]=_0x3e2f30['id'];return db['MailServerIn'][_0xabe3('0x63')](_0x4ad9d3['body']);}})[_0xabe3('0x1f')](respondWithResult(_0x55577b,null))[_0xabe3('0x28')](handleError(_0x55577b,null));};exports[_0xabe3('0x80')]=function(_0x3f5b91,_0x281b07,_0x19878d){return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x3f5b91[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x281b07,null))[_0xabe3('0x1f')](function(_0x2cc081){if(_0x2cc081){return _0x2cc081[_0xabe3('0x81')](null);}return null;})[_0xabe3('0x1f')](respondWithStatusCode(_0x281b07,null))[_0xabe3('0x28')](handleError(_0x281b07,null));};exports[_0xabe3('0x82')]=function(_0x24695f,_0xd4fb8,_0x1704b2){return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x24695f[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0xd4fb8,null))['then'](function(_0x30d85a){if(_0x30d85a){return _0x30d85a[_0xabe3('0x82')]();}return null;})[_0xabe3('0x1f')](respondWithResult(_0xd4fb8,null))[_0xabe3('0x28')](handleError(_0xd4fb8,null));};exports['addSmtp']=function(_0x246d23,_0x468bfe,_0x29996b){if(_0x246d23['body']['id']){delete _0x246d23[_0xabe3('0x5e')]['id'];}return db['MailAccount'][_0xabe3('0x5d')]({'where':{'id':_0x246d23[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x468bfe,null))[_0xabe3('0x1f')](function(_0x522a04){if(_0x522a04){_0x246d23[_0xabe3('0x5e')][_0xabe3('0x61')]=_0x522a04['id'];return db[_0xabe3('0x59')][_0xabe3('0x63')](_0x246d23[_0xabe3('0x5e')]);}})[_0xabe3('0x1f')](respondWithResult(_0x468bfe,null))[_0xabe3('0x28')](handleError(_0x468bfe,null));};exports[_0xabe3('0x83')]=function(_0x156c6e,_0x56c1a3,_0x3ebcd6){return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x156c6e[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x56c1a3,null))[_0xabe3('0x1f')](function(_0x507742){if(_0x507742){return _0x507742['setSmtp'](null);}return null;})[_0xabe3('0x1f')](respondWithStatusCode(_0x56c1a3,null))['catch'](handleError(_0x56c1a3,null));};exports['addInteraction']=function(_0x1a6779,_0x292523,_0x534b81){return db['MailInteraction'][_0xabe3('0x5d')]({'where':{'id':_0x1a6779[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x292523,null))['then'](function(_0x1cf414){if(_0x1cf414){return _0x1cf414['addInteraction'](_0x1a6779[_0xabe3('0x5e')][_0xabe3('0x6c')],_[_0xabe3('0x84')](_0x1a6779[_0xabe3('0x5e')],['ids','id'])||{});}})[_0xabe3('0x1f')](respondWithResult(_0x292523,null))[_0xabe3('0x28')](handleError(_0x292523,null));};exports[_0xabe3('0x85')]=function(_0x36dbec,_0x120dc4,_0x78608d){var _0x440be0={'raw':![],'where':{}};var _0x1844d1={};var _0x42902b={'count':0x0,'rows':[]};return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x36dbec[_0xabe3('0x58')]['id']}})['then'](handleEntityNotFound(_0x120dc4,null))[_0xabe3('0x1f')](function(_0x15a872){if(_0x15a872){_0x1844d1[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x86')][_0xabe3('0x5b')]);_0x1844d1[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x36dbec[_0xabe3('0x45')]);_0x1844d1[_0xabe3('0x47')]=_[_0xabe3('0x48')](_0x1844d1[_0xabe3('0x44')],_0x1844d1[_0xabe3('0x45')]);_0x440be0[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0x1844d1['model'],qs[_0xabe3('0x4a')](_0x36dbec[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x440be0[_0xabe3('0x49')]=_0x440be0[_0xabe3('0x49')][_0xabe3('0x4b')]?_0x440be0['attributes']:_0x1844d1['model'];if(!_0x36dbec['query'][_0xabe3('0x4c')]('nolimit')){_0x440be0[_0xabe3('0x2d')]=qs[_0xabe3('0x2d')](_0x36dbec[_0xabe3('0x45')][_0xabe3('0x2d')]);_0x440be0[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x36dbec[_0xabe3('0x45')][_0xabe3('0x2c')]);}_0x440be0[_0xabe3('0x4e')]=qs[_0xabe3('0x4f')](_0x36dbec['query'][_0xabe3('0x4f')]);_0x440be0[_0xabe3('0x52')]=qs['filters'](_[_0xabe3('0x50')](_0x36dbec[_0xabe3('0x45')],_0x1844d1['filters']));_0x440be0['where'][_0xabe3('0x61')]=_0x15a872['id'];if(_0x36dbec[_0xabe3('0x45')][_0xabe3('0x51')]){_0x440be0[_0xabe3('0x52')]=_['merge'](_0x440be0[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x440be0[_0xabe3('0x49')],function(_0x34dead){var _0x5d8387={};_0x5d8387[_0x34dead]={'$like':'%'+_0x36dbec[_0xabe3('0x45')][_0xabe3('0x51')]+'%'};return _0x5d8387;})});}_0x440be0=_[_0xabe3('0x53')]({},_0x440be0,_0x36dbec[_0xabe3('0x54')]);return db[_0xabe3('0x86')][_0xabe3('0x2b')]({'where':_0x440be0[_0xabe3('0x52')]})[_0xabe3('0x1f')](function(_0x488c08){_0x42902b['count']=_0x488c08;if(_0x36dbec[_0xabe3('0x45')][_0xabe3('0x69')]){_0x440be0[_0xabe3('0x5c')]=[{'model':db[_0xabe3('0x87')],'as':_0xabe3('0x88'),'required':![]},{'model':db[_0xabe3('0x89')],'as':_0xabe3('0x8a'),'attributes':[_0xabe3('0x38'),_0xabe3('0x8b'),_0xabe3('0x8c')],'required':![]},{'model':db[_0xabe3('0x8d')],'as':'Tags','attributes':['id','name',_0xabe3('0x8e')],'where':_0x36dbec[_0xabe3('0x45')][_0xabe3('0x8f')]?{'id':_0x36dbec[_0xabe3('0x45')][_0xabe3('0x8f')]}:undefined,'required':_0x36dbec[_0xabe3('0x45')][_0xabe3('0x8f')]?!![]:![]}];}return db[_0xabe3('0x86')]['findAll'](_0x440be0);})[_0xabe3('0x1f')](function(_0x1a0be0){_0x42902b[_0xabe3('0x56')]=_0x1a0be0;return _0x42902b;});}})[_0xabe3('0x1f')](respondWithFilteredResult(_0x120dc4,_0x440be0))[_0xabe3('0x28')](handleError(_0x120dc4,null));};exports[_0xabe3('0x90')]=function(_0x15281f,_0x5c3542,_0x358f82){return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x15281f[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x5c3542,null))['then'](function(_0x3c24a8){if(_0x3c24a8){return db[_0xabe3('0x91')][_0xabe3('0x92')](function(_0x2c364b){return db[_0xabe3('0x93')][_0xabe3('0x33')]({'where':{'MailAccountId':_0x15281f[_0xabe3('0x58')]['id']},'transaction':_0x2c364b})[_0xabe3('0x1f')](function(_0x63c723){var _0x224bb2=_['map'](_0x15281f[_0xabe3('0x5e')],function(_0x3a75a5){_0x3a75a5[_0xabe3('0x61')]=_0x15281f['params']['id'];return _0x3a75a5;});return db['MailApplication']['bulkCreate'](_0x224bb2,{'transaction':_0x2c364b});});})[_0xabe3('0x1f')](function(){return db['MailApplication'][_0xabe3('0x94')]({'where':{'MailAccountId':_0x15281f[_0xabe3('0x58')]['id']},'order':_0xabe3('0x95')});});}})['then'](respondWithResult(_0x5c3542,null))[_0xabe3('0x28')](handleError(_0x5c3542,null));};exports['getApplications']=function(_0x3a2d18,_0x296074,_0x505400){var _0x517ef6={};var _0x1574a5={};var _0x4d7d2c;var _0x3e9fc8;return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x3a2d18[_0xabe3('0x58')]['id']}})['then'](handleEntityNotFound(_0x296074,null))[_0xabe3('0x1f')](function(_0x37bd4c){if(_0x37bd4c){_0x4d7d2c=_0x37bd4c;_0x1574a5[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x93')][_0xabe3('0x5b')]);_0x1574a5[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x3a2d18[_0xabe3('0x45')]);_0x1574a5[_0xabe3('0x47')]=_['intersection'](_0x1574a5[_0xabe3('0x44')],_0x1574a5[_0xabe3('0x45')]);_0x517ef6[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0x1574a5[_0xabe3('0x44')],qs['fields'](_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x517ef6[_0xabe3('0x49')]=_0x517ef6[_0xabe3('0x49')]['length']?_0x517ef6[_0xabe3('0x49')]:_0x1574a5[_0xabe3('0x44')];_0x517ef6[_0xabe3('0x4e')]=qs['sort'](_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x4f')]);_0x517ef6[_0xabe3('0x52')]=qs['filters'](_[_0xabe3('0x50')](_0x3a2d18['query'],_0x1574a5[_0xabe3('0x47')]));if(_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x51')]){_0x517ef6[_0xabe3('0x52')]=_[_0xabe3('0x53')](_0x517ef6[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x517ef6[_0xabe3('0x49')],function(_0x15b3ec){var _0x23d525={};_0x23d525[_0x15b3ec]={'$like':'%'+_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x51')]+'%'};return _0x23d525;})});}_0x517ef6=_['merge']({},_0x517ef6,_0x3a2d18[_0xabe3('0x54')]);return _0x4d7d2c[_0xabe3('0x96')](_0x517ef6);}})[_0xabe3('0x1f')](function(_0x2a27e1){if(_0x2a27e1){_0x3e9fc8=_0x2a27e1['length'];if(!_0x3a2d18[_0xabe3('0x45')]['hasOwnProperty'](_0xabe3('0x4d'))){_0x517ef6['limit']=qs[_0xabe3('0x2d')](_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x2d')]);_0x517ef6[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x3a2d18[_0xabe3('0x45')][_0xabe3('0x2c')]);}return _0x4d7d2c[_0xabe3('0x96')](_0x517ef6);}})[_0xabe3('0x1f')](function(_0x29e0ca){if(_0x29e0ca){return _0x29e0ca?{'count':_0x3e9fc8,'rows':_0x29e0ca}:null;}})[_0xabe3('0x1f')](respondWithResult(_0x296074,null))[_0xabe3('0x28')](handleError(_0x296074,null));};exports['getMessages']=function(_0x1b0c28,_0x546eec,_0x5145b4){var _0x3506af={'raw':!![],'where':{}};var _0x37d998={};var _0x2084f2={'count':0x0,'rows':[]};return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x1b0c28['params']['id']}})['then'](handleEntityNotFound(_0x546eec,null))[_0xabe3('0x1f')](function(_0x3951e0){if(_0x3951e0){_0x37d998[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x97')][_0xabe3('0x5b')]);_0x37d998[_0xabe3('0x45')]=_[_0xabe3('0x46')](_0x1b0c28['query']);_0x37d998[_0xabe3('0x47')]=_[_0xabe3('0x48')](_0x37d998['model'],_0x37d998[_0xabe3('0x45')]);_0x3506af[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0x37d998[_0xabe3('0x44')],qs[_0xabe3('0x4a')](_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x3506af[_0xabe3('0x49')]=_0x3506af[_0xabe3('0x49')][_0xabe3('0x4b')]?_0x3506af[_0xabe3('0x49')]:_0x37d998['model'];if(!_0x1b0c28[_0xabe3('0x45')]['hasOwnProperty'](_0xabe3('0x4d'))){_0x3506af[_0xabe3('0x2d')]=qs['limit'](_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x2d')]);_0x3506af[_0xabe3('0x2c')]=qs[_0xabe3('0x2c')](_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x2c')]);}_0x3506af[_0xabe3('0x4e')]=qs[_0xabe3('0x4f')](_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x4f')]);_0x3506af[_0xabe3('0x52')]=qs[_0xabe3('0x47')](_[_0xabe3('0x50')](_0x1b0c28[_0xabe3('0x45')],_0x37d998[_0xabe3('0x47')]));_0x3506af[_0xabe3('0x52')][_0xabe3('0x61')]=_0x3951e0['id'];if(_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x51')]){_0x3506af[_0xabe3('0x52')]=_[_0xabe3('0x53')](_0x3506af[_0xabe3('0x52')],{'$or':_['map'](_0x3506af[_0xabe3('0x49')],function(_0x27626e){var _0x35a360={};_0x35a360[_0x27626e]={'$like':'%'+_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x51')]+'%'};return _0x35a360;})});}if(_0x1b0c28[_0xabe3('0x45')]['$gte']){var _0x51b577=_0x1b0c28['query'][_0xabe3('0x98')][_0xabe3('0x99')](',');var _0x41ea9d={};_0x41ea9d[_0x51b577[0x0]]={'$gte':moment(_0x51b577[0x1])[_0xabe3('0x9a')](_0xabe3('0x9b'))};_0x3506af[_0xabe3('0x52')]=_[_0xabe3('0x53')](_0x3506af[_0xabe3('0x52')],_0x41ea9d);}_0x3506af=_[_0xabe3('0x53')]({},_0x3506af,_0x1b0c28['options']);return db['MailMessage']['count']({'where':_0x3506af[_0xabe3('0x52')]})['then'](function(_0x4c450c){_0x2084f2[_0xabe3('0x2b')]=_0x4c450c;if(_0x1b0c28[_0xabe3('0x45')][_0xabe3('0x69')]){_0x3506af[_0xabe3('0x5c')]=[{'all':!![]}];}return db[_0xabe3('0x97')][_0xabe3('0x55')](_0x3506af);})[_0xabe3('0x1f')](function(_0x2e07b3){_0x2084f2[_0xabe3('0x56')]=_0x2e07b3;return _0x2084f2;});}})['then'](respondWithFilteredResult(_0x546eec,_0x3506af))[_0xabe3('0x28')](handleError(_0x546eec,null));};exports[_0xabe3('0x39')]=function(_0xf8798f,_0x506385,_0x217492){var _0x42204c,_0x581eac={},_0x9bf18b;if(_0xf8798f['body']['to']){_0x9bf18b=_0xf8798f['body']['to'][_0xabe3('0x99')](',')[0x0];}return db[_0xabe3('0x40')]['find']({'where':{'id':_0xf8798f[_0xabe3('0x58')]['id']},'include':[{'model':db[_0xabe3('0x9c')],'as':_0xabe3('0x9d'),'include':[{'model':db[_0xabe3('0x87')],'as':'Contacts','where':{'email':_0x9bf18b},'limit':0x1,'order':[['updatedAt',_0xabe3('0x9e')]]}]},{'model':db[_0xabe3('0x59')],'as':_0xabe3('0x5a'),'raw':!![]}]})['then'](handleEntityNotFound(_0x506385,null))['then'](function(_0x405eb3){if(_0x405eb3){_0x42204c=_0x405eb3;if(_0x405eb3[_0xabe3('0x5a')]){if(_['isNil'](_0xf8798f['body'][_0xabe3('0x9f')])){_0xf8798f[_0xabe3('0x5e')]['from']=util[_0xabe3('0x9a')](_0xabe3('0xa0'),_0x405eb3[_0xabe3('0x38')],_0x405eb3[_0xabe3('0x6d')]||_0x405eb3[_0xabe3('0x5a')]['user']);}if(_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xa1')]&&_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xa1')][_0xabe3('0x4b')]){for(var _0x49b277=0x0;_0x49b277<_0xf8798f[_0xabe3('0x5e')]['attachments'][_0xabe3('0x4b')];_0x49b277+=0x1){_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xa1')][_0x49b277]={'filename':_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xa1')][_0x49b277][_0xabe3('0x38')],'path':path[_0xabe3('0xa2')](config['root'],'server/files/attachments',_0xf8798f[_0xabe3('0x5e')]['attachments'][_0x49b277]['basename'])};}}var _0x3e27e0={'tls':{'rejectUnauthorized':![]}};if(_[_0xabe3('0x70')](_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x78')])){if(_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x75')]){_0x3e27e0[_0xabe3('0xa3')]={'user':_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x72')],'pass':_0x405eb3[_0xabe3('0x5a')][_0xabe3('0xa4')]};}_0x3e27e0[_0xabe3('0x76')]=_0x405eb3['Smtp'][_0xabe3('0x76')];_0x3e27e0[_0xabe3('0x77')]=_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x77')];_0x3e27e0[_0xabe3('0xa5')]=_0x405eb3['Smtp']['secure'];}else{_0x3e27e0[_0xabe3('0x78')]=_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x78')];_0x3e27e0['auth']={'user':_0x405eb3[_0xabe3('0x5a')][_0xabe3('0x72')],'pass':_0x405eb3[_0xabe3('0x5a')][_0xabe3('0xa4')]};}return respondWithRpcPromise('SendMail',_0xabe3('0xa6'),{'account':_0x3e27e0,'message':_0xf8798f['body']});}else{throw new Error(_0xabe3('0xa7'));}}})['then'](function(_0x55bbe9){if(_0x55bbe9){_0x581eac=_0x55bbe9;if(_0x42204c[_0xabe3('0x9d')]){if(_0x42204c[_0xabe3('0x9d')][_0xabe3('0xa8')][_0xabe3('0x4b')]){return _0x42204c['List'][_0xabe3('0xa8')][0x0];}else{return db['CmContact'][_0xabe3('0x63')](_[_0xabe3('0x16')](_0xf8798f['body'],{'firstName':_0xf8798f['body']['to'],'email':_0xf8798f[_0xabe3('0x5e')]['to'],'phone':_0xf8798f['body']['to'],'ListId':_0x42204c[_0xabe3('0x6e')]}));}}else{throw new Error(_0xabe3('0xa7'));}}})[_0xabe3('0x1f')](function(_0x598c10){if(_0x598c10){var _0x5c4dd6={'UserId':_0xf8798f[_0xabe3('0x72')]['id'],'ContactId':_0x598c10['id'],'MailAccountId':_0x42204c['id'],'inReplyTo':_0x581eac[_0xabe3('0xa9')],'to':_0xf8798f['body'][_0xabe3('0x9f')],'cc':_0xf8798f[_0xabe3('0x5e')]['cc'],'subject':_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xaa')],'attach':_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xab')],'firstMsgDirection':_0xabe3('0xac'),'lastMsgAt':moment()[_0xabe3('0x9a')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'out','lastMsgBody':_0xf8798f[_0xabe3('0x5e')][_0xabe3('0x5e')],'Messages':[_['merge'](_0xf8798f[_0xabe3('0x5e')],{'messageId':_0x581eac['messageId'],'sentAt':moment()[_0xabe3('0x9a')](_0xabe3('0x9b')),'read':!![],'MailAccountId':_0x42204c['id'],'UserId':_0xf8798f[_0xabe3('0x72')]['id'],'ContactId':_0x598c10['id']})]};if(_0xf8798f[_0xabe3('0x5e')]['Interaction']){_0x5c4dd6=_['merge'](_0x5c4dd6,_0xf8798f[_0xabe3('0x5e')][_0xabe3('0xad')]);}return db['MailInteraction'][_0xabe3('0x63')](_0x5c4dd6,{'include':[{'model':db[_0xabe3('0x97')],'as':'Messages'}]});}})[_0xabe3('0x1f')](respondWithResult(_0x506385,null))[_0xabe3('0x28')](handleError(_0x506385,null));};exports['verifySmtp']=function(_0x45e32f,_0x8991de,_0xbc3af0){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x45e32f[_0xabe3('0x58')]['id']},'include':[{'model':db[_0xabe3('0x59')],'as':'Smtp','raw':!![]}]})[_0xabe3('0x1f')](handleEntityNotFound(_0x8991de,null))[_0xabe3('0x1f')](function(_0x22ffb9){if(_0x22ffb9&&_0x22ffb9['Smtp']){var _0x3df1cb={'id':_0x22ffb9['id'],'tls':{'rejectUnauthorized':![]}};if(_0x22ffb9[_0xabe3('0x5a')][_0xabe3('0x78')]){_0x3df1cb[_0xabe3('0x78')]=_0x22ffb9[_0xabe3('0x5a')][_0xabe3('0x78')];}else{_0x3df1cb[_0xabe3('0x76')]=_0x22ffb9['Smtp'][_0xabe3('0x76')];_0x3df1cb['port']=_0x22ffb9[_0xabe3('0x5a')]['port'];_0x3df1cb[_0xabe3('0xa5')]=_0x22ffb9[_0xabe3('0x5a')][_0xabe3('0xa5')];}if(_0x22ffb9[_0xabe3('0x5a')][_0xabe3('0x75')]){_0x3df1cb[_0xabe3('0xa3')]={'user':_0x22ffb9['Smtp'][_0xabe3('0x72')],'pass':_0x22ffb9[_0xabe3('0x5a')]['pass']};}return respondWithRpcPromise(_0xabe3('0xae'),_0xabe3('0xaf'),{'account':_0x3df1cb});}})['then'](respondWithResult(_0x8991de,null))[_0xabe3('0x28')](handleError(_0x8991de,null));};exports[_0xabe3('0x33')]=function(_0x1657fa,_0x4cbb40){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x1657fa['params']['id']}})['then'](handleEntityNotFound(_0x4cbb40,null))['then'](function(_0x19dbf7){if(_0x19dbf7&&_0x19dbf7['service']){throw new db[(_0xabe3('0x1b'))]['ValidationError'](_0xabe3('0xb0'));}return _0x19dbf7;})[_0xabe3('0x1f')](removeEntity(_0x4cbb40,null))[_0xabe3('0x28')](handleError(_0x4cbb40,null));};exports[_0xabe3('0xb1')]=function(_0x16f65c,_0x9dcf5b,_0xdaf78b){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x16f65c[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x9dcf5b,null))['then'](function(_0x3591e4){if(_0x3591e4){return _0x3591e4['addAgents'](_0x16f65c[_0xabe3('0x5e')][_0xabe3('0x6c')],_[_0xabe3('0x84')](_0x16f65c[_0xabe3('0x5e')],[_0xabe3('0x6c'),'id'])||{})['spread'](function(_0xfee4c0){for(var _0x245805=0x0;_0x245805<_0x16f65c[_0xabe3('0x5e')][_0xabe3('0x6c')][_0xabe3('0x4b')];_0x245805+=0x1){socket[_0xabe3('0xb2')]('userMailAccount:save',{'UserId':_0x16f65c[_0xabe3('0x5e')]['ids'][_0x245805],'MailAccountId':_0x16f65c[_0xabe3('0x58')]['id']});}return _0xfee4c0;});}})[_0xabe3('0x1f')](respondWithResult(_0x9dcf5b,null))[_0xabe3('0x28')](handleError(_0x9dcf5b,null));};exports[_0xabe3('0xb3')]=function(_0x3c7ccc,_0x5ecb50,_0x53af8d){return db[_0xabe3('0x40')][_0xabe3('0x5d')]({'where':{'id':_0x3c7ccc[_0xabe3('0x58')]['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x5ecb50,null))[_0xabe3('0x1f')](function(_0x2fb26b){if(_0x2fb26b){return _0x2fb26b[_0xabe3('0xb3')](_0x3c7ccc[_0xabe3('0x45')][_0xabe3('0x6c')])[_0xabe3('0x1f')](function(){if(_[_0xabe3('0xb4')](_0x3c7ccc[_0xabe3('0x45')][_0xabe3('0x6c')])){for(var _0x563d65=0x0;_0x563d65<_0x3c7ccc['query'][_0xabe3('0x6c')]['length'];_0x563d65+=0x1){socket[_0xabe3('0xb2')]('userMailAccount:remove',{'UserId':Number(_0x3c7ccc[_0xabe3('0x45')][_0xabe3('0x6c')][_0x563d65]),'MailAccountId':Number(_0x3c7ccc[_0xabe3('0x58')]['id'])});}}else{socket[_0xabe3('0xb2')](_0xabe3('0xb5'),{'UserId':Number(_0x3c7ccc[_0xabe3('0x45')][_0xabe3('0x6c')]),'MailAccountId':Number(_0x3c7ccc[_0xabe3('0x58')]['id'])});}});}})[_0xabe3('0x1f')](respondWithStatusCode(_0x5ecb50,null))['catch'](handleError(_0x5ecb50,null));};exports[_0xabe3('0xb6')]=function(_0x3470f9,_0x19512e,_0x2675c8){var _0x5e21cd={};var _0x3f7992={};var _0x430b9f;var _0x4dc0e9;return db[_0xabe3('0x40')][_0xabe3('0x65')]({'where':{'id':_0x3470f9['params']['id']}})[_0xabe3('0x1f')](handleEntityNotFound(_0x19512e,null))[_0xabe3('0x1f')](function(_0x244da8){if(_0x244da8){_0x430b9f=_0x244da8;_0x3f7992[_0xabe3('0x44')]=_[_0xabe3('0x46')](db[_0xabe3('0x89')][_0xabe3('0x5b')]);_0x3f7992[_0xabe3('0x45')]=_['keys'](_0x3470f9[_0xabe3('0x45')]);_0x3f7992['filters']=_[_0xabe3('0x48')](_0x3f7992[_0xabe3('0x44')],_0x3f7992['query']);_0x5e21cd[_0xabe3('0x49')]=_[_0xabe3('0x48')](_0x3f7992[_0xabe3('0x44')],qs[_0xabe3('0x4a')](_0x3470f9[_0xabe3('0x45')][_0xabe3('0x4a')]));_0x5e21cd[_0xabe3('0x49')]=_0x5e21cd[_0xabe3('0x49')][_0xabe3('0x4b')]?_0x5e21cd[_0xabe3('0x49')]:_0x3f7992[_0xabe3('0x44')];_0x5e21cd[_0xabe3('0x4e')]=qs[_0xabe3('0x4f')](_0x3470f9[_0xabe3('0x45')][_0xabe3('0x4f')]);_0x5e21cd[_0xabe3('0x52')]=qs[_0xabe3('0x47')](_['pick'](_0x3470f9['query'],_0x3f7992[_0xabe3('0x47')]));if(_0x3470f9[_0xabe3('0x45')][_0xabe3('0x51')]){_0x5e21cd['where']=_[_0xabe3('0x53')](_0x5e21cd[_0xabe3('0x52')],{'$or':_[_0xabe3('0x3f')](_0x5e21cd[_0xabe3('0x49')],function(_0x4fc624){var _0x56df94={};_0x56df94[_0x4fc624]={'$like':'%'+_0x3470f9[_0xabe3('0x45')][_0xabe3('0x51')]+'%'};return _0x56df94;})});}_0x5e21cd=_[_0xabe3('0x53')]({},_0x5e21cd,_0x3470f9[_0xabe3('0x54')]);return _0x430b9f[_0xabe3('0xb6')](_0x5e21cd);}})[_0xabe3('0x1f')](function(_0x2be8ba){if(_0x2be8ba){_0x4dc0e9=_0x2be8ba['length'];if(!_0x3470f9['query'][_0xabe3('0x4c')](_0xabe3('0x4d'))){_0x5e21cd[_0xabe3('0x2d')]=qs[_0xabe3('0x2d')](_0x3470f9[_0xabe3('0x45')]['limit']);_0x5e21cd['offset']=qs['offset'](_0x3470f9['query'][_0xabe3('0x2c')]);}return _0x430b9f[_0xabe3('0xb6')](_0x5e21cd);}})[_0xabe3('0x1f')](function(_0x467597){if(_0x467597){return _0x467597?{'count':_0x4dc0e9,'rows':_0x467597}:null;}})[_0xabe3('0x1f')](respondWithResult(_0x19512e,null))[_0xabe3('0x28')](handleError(_0x19512e,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 328ab0b..1d720b7 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 _0x5c5b=['save','emit','hook','exports','MailAccount','setMaxListeners'];(function(_0x5499d9,_0x1abd4f){var _0x52054c=function(_0x2205bc){while(--_0x2205bc){_0x5499d9['push'](_0x5499d9['shift']());}};_0x52054c(++_0x1abd4f);}(_0x5c5b,0x10c));var _0xb5c5=function(_0x32b30c,_0x2d5ec8){_0x32b30c=_0x32b30c-0x0;var _0xcfc212=_0x5c5b[_0x32b30c];return _0xcfc212;};'use strict';var EventEmitter=require('events');var MailAccount=require('../../mysqldb')['db'][_0xb5c5('0x0')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xb5c5('0x1')](0x0);var events={'afterCreate':_0xb5c5('0x2'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5cae77){return function(_0x4c6ea2,_0x520be4,_0x2a7b3d){MailAccountEvents[_0xb5c5('0x3')](_0x5cae77+':'+_0x4c6ea2['id'],_0x4c6ea2);MailAccountEvents[_0xb5c5('0x3')](_0x5cae77,_0x4c6ea2);_0x2a7b3d(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0xb5c5('0x4')](e,emitEvent(event));}}module[_0xb5c5('0x5')]=MailAccountEvents; \ No newline at end of file +var _0x3426=['../../mysqldb','MailAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x3426,0x199));var _0x6342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3426[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6342('0x0'));var MailAccount=require(_0x6342('0x1'))['db'][_0x6342('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x6342('0x3')](0x0);var events={'afterCreate':_0x6342('0x4'),'afterUpdate':_0x6342('0x5'),'afterDestroy':_0x6342('0x6')};function emitEvent(_0x2bc72e){return function(_0x305b4a,_0x52ffe7,_0x975713){MailAccountEvents[_0x6342('0x7')](_0x2bc72e+':'+_0x305b4a['id'],_0x305b4a);MailAccountEvents[_0x6342('0x7')](_0x2bc72e,_0x305b4a);_0x975713(null);};}for(var e in events){if(events[_0x6342('0x8')](e)){var event=events[e];MailAccount[_0x6342('0x9')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 9c3bbc2..2995048 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 _0x6b36=['exports','define','MailAccount','mail_accounts','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailAccount.attributes'];(function(_0x2aa0e7,_0x4e5145){var _0x1472c0=function(_0x4deaeb){while(--_0x4deaeb){_0x2aa0e7['push'](_0x2aa0e7['shift']());}};_0x1472c0(++_0x4e5145);}(_0x6b36,0xbf));var _0x66b3=function(_0x9bd365,_0x4732ce){_0x9bd365=_0x9bd365-0x0;var _0x5eb4ba=_0x6b36[_0x9bd365];return _0x5eb4ba;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x66b3('0x0'));var BPromise=require(_0x66b3('0x1'));var rp=require(_0x66b3('0x2'));var fs=require('fs');var path=require(_0x66b3('0x3'));var rimraf=require(_0x66b3('0x4'));var config=require(_0x66b3('0x5'));var attributes=require(_0x66b3('0x6'));module[_0x66b3('0x7')]=function(_0x5aad4b,_0x51de4c){return _0x5aad4b[_0x66b3('0x8')](_0x66b3('0x9'),attributes,{'tableName':_0x66b3('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0630=['request-promise','path','rimraf','../../config/environment','exports','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2bc49f,_0x112665){var _0x57ddb3=function(_0x1afa48){while(--_0x1afa48){_0x2bc49f['push'](_0x2bc49f['shift']());}};_0x57ddb3(++_0x112665);}(_0x0630,0xde));var _0x0063=function(_0x36994f,_0x53b85a){_0x36994f=_0x36994f-0x0;var _0x12310b=_0x0630[_0x36994f];return _0x12310b;};'use strict';var _=require(_0x0063('0x0'));var util=require(_0x0063('0x1'));var logger=require(_0x0063('0x2'))(_0x0063('0x3'));var moment=require(_0x0063('0x4'));var BPromise=require(_0x0063('0x5'));var rp=require(_0x0063('0x6'));var fs=require('fs');var path=require(_0x0063('0x7'));var rimraf=require(_0x0063('0x8'));var config=require(_0x0063('0x9'));var attributes=require('./mailAccount.attributes');module[_0x0063('0xa')]=function(_0x57a966,_0x14ff3d){return _0x57a966['define']('MailAccount',attributes,{'tableName':_0x0063('0xb'),'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 1cac4da..1b33363 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 _0x8ce3=['register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','findAll','options','raw','attributes','limit','include','map','model','GetMailAccount','ShowMailAccount','find','where','NotifyMailAccount','body','mail','difference','rawAttributes','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','CmContact','DESC','Applications','MailServerOut','List','get','account','list','applications','orderBy','priority','autoclose','push','*,*,*,*','Contacts','length','create','List\x20not\x20found','contact','messageId','generate','attach','format','MailInteraction','MailMessage','Messages','inReplyTo','Contact\x20not\x20found','spread','update','subject','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','waitForTheAssignedAgent','startRouting','Start','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost'];(function(_0x391352,_0x7f7d6d){var _0x5660e9=function(_0x217c9e){while(--_0x217c9e){_0x391352['push'](_0x391352['shift']());}};_0x5660e9(++_0x7f7d6d);}(_0x8ce3,0xc3));var _0x38ce=function(_0x3a14ac,_0x55403f){_0x3a14ac=_0x3a14ac-0x0;var _0x5e3bc3=_0x8ce3[_0x3a14ac];return _0x5e3bc3;};'use strict';var _=require(_0x38ce('0x0'));var util=require(_0x38ce('0x1'));var moment=require('moment');var BPromise=require(_0x38ce('0x2'));var rs=require(_0x38ce('0x3'));var fs=require('fs');var Redis=require(_0x38ce('0x4'));var db=require(_0x38ce('0x5'))['db'];var utils=require(_0x38ce('0x6'));var logger=require(_0x38ce('0x7'))(_0x38ce('0x8'));var config=require(_0x38ce('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x38ce('0xa')][_0x38ce('0xb')]({'port':0x232c});config['redis']=_[_0x38ce('0xc')](config[_0x38ce('0xd')],{'host':_0x38ce('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x38ce('0xd')]));require('./mailAccount.socket')[_0x38ce('0xf')](socket);function respondWithRpcPromise(_0x4bd97b,_0x133bd5,_0x31c2e1){return new BPromise(function(_0xa9931b,_0x2c0cab){return client[_0x38ce('0x10')](_0x4bd97b,_0x31c2e1)[_0x38ce('0x11')](function(_0x2a9045){logger[_0x38ce('0x12')](_0x38ce('0x13'),_0x133bd5,_0x38ce('0x14'));logger[_0x38ce('0x15')](_0x38ce('0x16'),_0x133bd5,_0x38ce('0x14'),JSON[_0x38ce('0x17')](_0x2a9045));if(_0x2a9045[_0x38ce('0x18')]){if(_0x2a9045[_0x38ce('0x18')]['code']===0x1f4){logger['error'](_0x38ce('0x13'),_0x133bd5,_0x2a9045[_0x38ce('0x18')][_0x38ce('0x19')]);return _0x2c0cab(_0x2a9045['error'][_0x38ce('0x19')]);}logger['error'](_0x38ce('0x13'),_0x133bd5,_0x2a9045[_0x38ce('0x18')]['message']);return _0xa9931b(_0x2a9045[_0x38ce('0x18')][_0x38ce('0x19')]);}else{logger[_0x38ce('0x12')]('MailAccount,\x20%s,\x20%s',_0x133bd5,_0x38ce('0x14'));_0xa9931b(_0x2a9045[_0x38ce('0x1a')][_0x38ce('0x19')]);}})[_0x38ce('0x1b')](function(_0x3166ab){logger[_0x38ce('0x18')](_0x38ce('0x13'),_0x133bd5,_0x3166ab);_0x2c0cab(_0x3166ab);});});}exports['GetMailAccount']=function(_0x2a9447){var _0x34a8c7=this;return new Promise(function(_0x280586,_0x303391){return db[_0x38ce('0x1c')][_0x38ce('0x1d')]({'raw':_0x2a9447[_0x38ce('0x1e')]?_0x2a9447[_0x38ce('0x1e')][_0x38ce('0x1f')]===undefined?!![]:![]:!![],'where':_0x2a9447[_0x38ce('0x1e')]?_0x2a9447[_0x38ce('0x1e')]['where']||null:null,'attributes':_0x2a9447[_0x38ce('0x1e')]?_0x2a9447[_0x38ce('0x1e')][_0x38ce('0x20')]||null:null,'limit':_0x2a9447[_0x38ce('0x1e')]?_0x2a9447['options'][_0x38ce('0x21')]||null:null,'include':_0x2a9447[_0x38ce('0x1e')]?_0x2a9447['options'][_0x38ce('0x22')]?_[_0x38ce('0x23')](_0x2a9447[_0x38ce('0x1e')]['include'],function(_0x4a7e8e){return{'model':db[_0x4a7e8e[_0x38ce('0x24')]],'as':_0x4a7e8e['as'],'attributes':_0x4a7e8e[_0x38ce('0x20')],'include':_0x4a7e8e[_0x38ce('0x22')]?_[_0x38ce('0x23')](_0x4a7e8e[_0x38ce('0x22')],function(_0x2a59fe){return{'model':db[_0x2a59fe[_0x38ce('0x24')]],'as':_0x2a59fe['as'],'attributes':_0x2a59fe[_0x38ce('0x20')],'include':_0x2a59fe[_0x38ce('0x22')]?_[_0x38ce('0x23')](_0x2a59fe[_0x38ce('0x22')],function(_0x381703){return{'model':db[_0x381703['model']],'as':_0x381703['as'],'attributes':_0x381703[_0x38ce('0x20')]};}):[]};}):[]};}):[]:[]})[_0x38ce('0x11')](function(_0x5b4a7a){logger[_0x38ce('0x12')](_0x38ce('0x25'),_0x2a9447);logger['debug'](_0x38ce('0x25'),_0x2a9447,JSON[_0x38ce('0x17')](_0x5b4a7a));_0x280586(_0x5b4a7a);})['catch'](function(_0x28d775){logger['error'](_0x38ce('0x25'),_0x28d775[_0x38ce('0x19')],_0x2a9447);_0x303391(_0x34a8c7[_0x38ce('0x18')](0x1f4,_0x28d775[_0x38ce('0x19')]));});});};exports[_0x38ce('0x26')]=function(_0x23019f){var _0x34262a=this;return new Promise(function(_0x2f5695,_0x4ec0d3){return db['MailAccount'][_0x38ce('0x27')]({'raw':_0x23019f[_0x38ce('0x1e')]?_0x23019f[_0x38ce('0x1e')][_0x38ce('0x1f')]===undefined?!![]:![]:!![],'where':_0x23019f[_0x38ce('0x1e')]?_0x23019f['options'][_0x38ce('0x28')]||null:null,'attributes':_0x23019f[_0x38ce('0x1e')]?_0x23019f[_0x38ce('0x1e')][_0x38ce('0x20')]||null:null,'include':_0x23019f[_0x38ce('0x1e')]?_0x23019f[_0x38ce('0x1e')][_0x38ce('0x22')]?_['map'](_0x23019f[_0x38ce('0x1e')][_0x38ce('0x22')],function(_0x5b8c69){return{'model':db[_0x5b8c69[_0x38ce('0x24')]],'as':_0x5b8c69['as'],'attributes':_0x5b8c69[_0x38ce('0x20')],'include':_0x5b8c69[_0x38ce('0x22')]?_[_0x38ce('0x23')](_0x5b8c69[_0x38ce('0x22')],function(_0x3d6838){return{'model':db[_0x3d6838[_0x38ce('0x24')]],'as':_0x3d6838['as'],'attributes':_0x3d6838[_0x38ce('0x20')],'include':_0x3d6838['include']?_[_0x38ce('0x23')](_0x3d6838[_0x38ce('0x22')],function(_0x2314a2){return{'model':db[_0x2314a2[_0x38ce('0x24')]],'as':_0x2314a2['as'],'attributes':_0x2314a2['attributes']};}):[]};}):[]};}):[]:[]})[_0x38ce('0x11')](function(_0x54a15a){logger[_0x38ce('0x12')](_0x38ce('0x26'),_0x23019f);logger[_0x38ce('0x15')](_0x38ce('0x26'),_0x23019f,JSON[_0x38ce('0x17')](_0x54a15a));_0x2f5695(_0x54a15a);})[_0x38ce('0x1b')](function(_0x4a6d2b){logger[_0x38ce('0x18')]('ShowMailAccount',_0x4a6d2b[_0x38ce('0x19')],_0x23019f);_0x4ec0d3(_0x34262a[_0x38ce('0x18')](0x1f4,_0x4a6d2b[_0x38ce('0x19')]));});});};exports[_0x38ce('0x29')]=function(_0x277e94){var _0x1476e9=this;return new Promise(function(_0x5209ee,_0x14fb63){var _0x1e0574={'body':_0x277e94[_0x38ce('0x2a')],'channel':_0x38ce('0x2b')};var _0xd4bfe9=_[_0x38ce('0x2c')](_['keys'](db['CmContact'][_0x38ce('0x2d')]),[_0x38ce('0x2e'),_0x38ce('0x2f'),_0x38ce('0x30'),_0x38ce('0x31')]);var _0x3966d2=![];if(_0x277e94[_0x38ce('0x2a')]['id']){delete _0x277e94['body']['id'];}if(_[_0x38ce('0x32')](_0x277e94[_0x38ce('0x2a')]['from'])){return _0x14fb63(_0x1476e9[_0x38ce('0x18')](0x1f4,_0x38ce('0x33')));}if(_[_0x38ce('0x32')](_0x277e94['body'][_0x38ce('0x2a')])||_0x277e94[_0x38ce('0x2a')][_0x38ce('0x2a')]===''){return _0x14fb63(_0x1476e9[_0x38ce('0x18')](0x1f4,_0x38ce('0x34')));}if(_[_0x38ce('0x32')](_0x277e94['body'][_0x38ce('0x35')])){return _0x14fb63(_0x1476e9[_0x38ce('0x18')](0x1f4,_0x38ce('0x36')+_0xd4bfe9));}if(!_[_0x38ce('0x37')](_0xd4bfe9,_0x277e94[_0x38ce('0x2a')][_0x38ce('0x35')])){return _0x14fb63(_0x1476e9['error'](0x1f4,_0x38ce('0x38')+_0xd4bfe9));}var _0x1847e5={};_0x1847e5[_0x277e94['body']['mapKey']]=_0x277e94['body'][_0x38ce('0x39')];return db[_0x38ce('0x1c')]['find']({'where':{'id':_0x277e94['account']['id']},'include':[{'model':db[_0x38ce('0x3a')],'as':'List','include':[{'model':db[_0x38ce('0x3b')],'as':'Contacts','where':_0x1847e5,'limit':0x1,'order':[[_0x38ce('0x2f'),_0x38ce('0x3c')]]}]},{'model':db['MailApplication'],'as':_0x38ce('0x3d')},{'model':db[_0x38ce('0x3e')],'as':'Smtp'}]})[_0x38ce('0x11')](function(_0x3bbd00){if(_0x3bbd00&&_0x3bbd00[_0x38ce('0x3f')]){var _0x5ce80e=_0x3bbd00[_0x38ce('0x40')]({'plain':!![]});_0x1e0574[_0x38ce('0x41')]=_['omit'](_0x5ce80e,[_0x38ce('0x3d'),_0x38ce('0x3f')]);_0x1e0574['applications']=_0x5ce80e[_0x38ce('0x3d')];_0x1e0574[_0x38ce('0x42')]=_0x5ce80e[_0x38ce('0x3f')];_0x1e0574[_0x38ce('0x43')]=_[_0x38ce('0x44')](_0x1e0574[_0x38ce('0x43')],[_0x38ce('0x45')],['asc']);if(_0x1e0574[_0x38ce('0x41')]&&_0x1e0574[_0x38ce('0x41')][_0x38ce('0x46')]){_0x1e0574[_0x38ce('0x43')][_0x38ce('0x47')]({'id':0x0,'priority':_0x1e0574[_0x38ce('0x43')]['length']+0x1,'app':'close','appdata':_0x38ce('0x46'),'interval':_0x38ce('0x48')});}if(_0x1e0574[_0x38ce('0x41')][_0x38ce('0x3d')]){delete _0x1e0574[_0x38ce('0x41')][_0x38ce('0x3d')];}if(_0x1e0574['account']['List']){delete _0x1e0574[_0x38ce('0x41')]['List'];}if(_0x5ce80e['List'][_0x38ce('0x49')][_0x38ce('0x4a')]){return _0x5ce80e[_0x38ce('0x3f')][_0x38ce('0x49')][0x0];}var _0xd031c0=_['defaults'](_0x277e94[_0x38ce('0x2a')],{'firstName':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x39')],'ListId':_0x5ce80e[_0x38ce('0x31')]});_0xd031c0[_0x277e94[_0x38ce('0x2a')][_0x38ce('0x35')]]=_0x277e94[_0x38ce('0x2a')][_0x38ce('0x39')];return db[_0x38ce('0x3b')][_0x38ce('0x4b')](_0xd031c0);}else{throw new Error(_0x38ce('0x4c'));}})['then'](function(_0x5d1df1){_0x1e0574[_0x38ce('0x4d')]=_0x5d1df1;if(_0x5d1df1){if(!_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x4e')]){_0x277e94['body'][_0x38ce('0x19')][_0x38ce('0x4e')]=rs[_0x38ce('0x4f')]()+'\x20'+_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x39')];}var _0x1534ca={'ContactId':_0x5d1df1['id'],'MailAccountId':_0x277e94['account']['id'],'inReplyTo':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')]['messageId'],'to':_0x277e94['body'][_0x38ce('0x19')][_0x38ce('0x39')],'cc':_0x277e94[_0x38ce('0x2a')]['message']['cc'],'subject':_0x277e94['body'][_0x38ce('0x19')]['subject'],'attach':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x50')],'lastMsgAt':moment()[_0x38ce('0x51')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x2a')]};return db[_0x38ce('0x52')]['find']({'where':{'closed':![],'MailAccountId':_0x277e94[_0x38ce('0x41')]['id']},'include':[{'model':db[_0x38ce('0x53')],'as':_0x38ce('0x54'),'attributes':['messageId'],'where':{'messageId':_0x277e94[_0x38ce('0x2a')]['message'][_0x38ce('0x55')]}}]})['then'](function(_0x146999){if(_0x146999){return[_0x146999,![]];}return db[_0x38ce('0x52')][_0x38ce('0x4b')](_0x1534ca)[_0x38ce('0x11')](function(_0x587e62){return[_0x587e62,!![]];});});}else{throw new Error(_0x38ce('0x56'));}})[_0x38ce('0x57')](function(_0x425002,_0x2ff08b){if(_0x425002){_0x3966d2=_0x2ff08b;if(!_0x2ff08b){return _0x425002[_0x38ce('0x58')]({'inReplyTo':_0x277e94[_0x38ce('0x2a')]['message'][_0x38ce('0x4e')],'to':_0x277e94['body'][_0x38ce('0x19')][_0x38ce('0x39')],'cc':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')]['cc'],'subject':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x59')],'attach':_0x425002[_0x38ce('0x50')]?_0x425002['attach']:_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x50')],'substatus':null,'substatusAt':moment()[_0x38ce('0x51')](_0x38ce('0x5a')),'lastMsgAt':moment()[_0x38ce('0x51')](_0x38ce('0x5a')),'lastMsgDirection':'in','lastMsgBody':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x2a')]});}else{return _0x425002;}}})[_0x38ce('0x11')](function(_0x79b918){_0x1e0574[_0x38ce('0x5b')]=_0x79b918[_0x38ce('0x40')]({'plain':!![]});_0x1e0574[_0x38ce('0x5b')][_0x38ce('0x5c')]=_0x3966d2;return db[_0x38ce('0x53')][_0x38ce('0x4b')]({'body':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x2a')],'MailAccountId':_0x277e94[_0x38ce('0x41')]['id'],'MailInteractionId':_0x79b918['id'],'direction':'in','ContactId':_0x1e0574['contact']['id'],'messageId':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x4e')],'from':_0x277e94['body']['message'][_0x38ce('0x39')],'to':_0x277e94[_0x38ce('0x2a')]['message']['to'],'cc':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')]['cc'],'subject':_0x277e94['body']['message'][_0x38ce('0x59')],'attach':_0x277e94[_0x38ce('0x2a')]['message'][_0x38ce('0x50')],'Attachments':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x5d')],'originTo':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x5e')],'originCc':_0x277e94[_0x38ce('0x2a')]['message'][_0x38ce('0x5f')],'bcc':_0x277e94[_0x38ce('0x2a')][_0x38ce('0x19')][_0x38ce('0x60')]},{'include':[{'model':db[_0x38ce('0x61')],'as':_0x38ce('0x62')}]});})[_0x38ce('0x11')](function(_0x595d81){_0x1e0574['message']=_0x595d81;if(_0x1e0574['interaction'][_0x38ce('0x63')]){return db[_0x38ce('0x64')][_0x38ce('0x27')]({'attributes':['id',_0x38ce('0x65')],'where':{'id':_0x1e0574[_0x38ce('0x5b')][_0x38ce('0x63')]}})[_0x38ce('0x11')](function(_0x4b2dfb){if(_0x4b2dfb){_0x1e0574[_0x38ce('0x43')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4b2dfb['name']+','+(_0x1e0574[_0x38ce('0x41')][_0x38ce('0x66')]||0xa),'interval':_0x38ce('0x48')});}return respondWithRpcPromise('Start',_0x38ce('0x67'),_0x1e0574);});}return respondWithRpcPromise(_0x38ce('0x68'),_0x38ce('0x67'),_0x1e0574);})[_0x38ce('0x11')](function(_0x32a8e3){_0x5209ee(_0x32a8e3);})['catch'](function(_0x19b414){_0x14fb63(_0x1476e9['error'](0x1f4,_0x19b414[_0x38ce('0x19')]));});});}; \ No newline at end of file +var _0xd382=['defaults','CmContact','create','List\x20not\x20found','messageId','subject','attach','format','Messages','inReplyTo','MailInteraction','Contact\x20not\x20found','spread','update','YYYY-MM-DD\x20HH:mm:ss','interaction','contact','attachments','originTo','originCc','bcc','Attachment','Attachments','UserId','User','name','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','localhost','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetMailAccount','options','raw','where','attributes','limit','map','include','model','catch','MailAccount','find','ShowMailAccount','NotifyMailAccount','body','difference','rawAttributes','createdAt','updatedAt','ListId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','Contacts','DESC','MailApplication','Smtp','List','get','account','omit','Applications','applications','list','orderBy','priority','asc','autoclose','push','close','*,*,*,*'];(function(_0x576170,_0x1712ae){var _0x397c70=function(_0x2eb9de){while(--_0x2eb9de){_0x576170['push'](_0x576170['shift']());}};_0x397c70(++_0x1712ae);}(_0xd382,0x1b6));var _0x2d38=function(_0x2e7557,_0x3d8801){_0x2e7557=_0x2e7557-0x0;var _0x2d25ae=_0xd382[_0x2e7557];return _0x2d25ae;};'use strict';var _=require(_0x2d38('0x0'));var util=require(_0x2d38('0x1'));var moment=require(_0x2d38('0x2'));var BPromise=require(_0x2d38('0x3'));var rs=require(_0x2d38('0x4'));var fs=require('fs');var Redis=require(_0x2d38('0x5'));var db=require(_0x2d38('0x6'))['db'];var utils=require(_0x2d38('0x7'));var logger=require(_0x2d38('0x8'))(_0x2d38('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2d38('0xa')]({'port':0x232c});config[_0x2d38('0xb')]=_['defaults'](config[_0x2d38('0xb')],{'host':_0x2d38('0xc'),'port':0x18eb});var socket=require(_0x2d38('0xd'))(new Redis(config['redis']));require('./mailAccount.socket')[_0x2d38('0xe')](socket);function respondWithRpcPromise(_0x25e9a7,_0x12a9bf,_0x495903){return new BPromise(function(_0x29a847,_0x59c2c3){return client[_0x2d38('0xf')](_0x25e9a7,_0x495903)[_0x2d38('0x10')](function(_0x35b37a){logger[_0x2d38('0x11')](_0x2d38('0x12'),_0x12a9bf,_0x2d38('0x13'));logger[_0x2d38('0x14')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x12a9bf,_0x2d38('0x13'),JSON[_0x2d38('0x15')](_0x35b37a));if(_0x35b37a[_0x2d38('0x16')]){if(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x17')]===0x1f4){logger['error'](_0x2d38('0x12'),_0x12a9bf,_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);return _0x59c2c3(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);}logger[_0x2d38('0x16')](_0x2d38('0x12'),_0x12a9bf,_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);return _0x29a847(_0x35b37a[_0x2d38('0x16')][_0x2d38('0x18')]);}else{logger[_0x2d38('0x11')](_0x2d38('0x12'),_0x12a9bf,_0x2d38('0x13'));_0x29a847(_0x35b37a[_0x2d38('0x19')][_0x2d38('0x18')]);}})['catch'](function(_0x1a7a8f){logger[_0x2d38('0x16')]('MailAccount,\x20%s,\x20%s',_0x12a9bf,_0x1a7a8f);_0x59c2c3(_0x1a7a8f);});});}exports[_0x2d38('0x1a')]=function(_0x353874){var _0x246658=this;return new Promise(function(_0x4f519a,_0x46f8be){return db['MailAccount']['findAll']({'raw':_0x353874[_0x2d38('0x1b')]?_0x353874[_0x2d38('0x1b')][_0x2d38('0x1c')]===undefined?!![]:![]:!![],'where':_0x353874[_0x2d38('0x1b')]?_0x353874[_0x2d38('0x1b')][_0x2d38('0x1d')]||null:null,'attributes':_0x353874[_0x2d38('0x1b')]?_0x353874[_0x2d38('0x1b')][_0x2d38('0x1e')]||null:null,'limit':_0x353874[_0x2d38('0x1b')]?_0x353874['options'][_0x2d38('0x1f')]||null:null,'include':_0x353874['options']?_0x353874[_0x2d38('0x1b')]['include']?_[_0x2d38('0x20')](_0x353874[_0x2d38('0x1b')][_0x2d38('0x21')],function(_0x10e283){return{'model':db[_0x10e283[_0x2d38('0x22')]],'as':_0x10e283['as'],'attributes':_0x10e283[_0x2d38('0x1e')],'include':_0x10e283[_0x2d38('0x21')]?_['map'](_0x10e283[_0x2d38('0x21')],function(_0x3f0f7a){return{'model':db[_0x3f0f7a[_0x2d38('0x22')]],'as':_0x3f0f7a['as'],'attributes':_0x3f0f7a[_0x2d38('0x1e')],'include':_0x3f0f7a[_0x2d38('0x21')]?_[_0x2d38('0x20')](_0x3f0f7a[_0x2d38('0x21')],function(_0x3a6437){return{'model':db[_0x3a6437['model']],'as':_0x3a6437['as'],'attributes':_0x3a6437['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x31d427){logger[_0x2d38('0x11')](_0x2d38('0x1a'),_0x353874);logger['debug'](_0x2d38('0x1a'),_0x353874,JSON['stringify'](_0x31d427));_0x4f519a(_0x31d427);})[_0x2d38('0x23')](function(_0x210283){logger[_0x2d38('0x16')]('GetMailAccount',_0x210283[_0x2d38('0x18')],_0x353874);_0x46f8be(_0x246658[_0x2d38('0x16')](0x1f4,_0x210283[_0x2d38('0x18')]));});});};exports['ShowMailAccount']=function(_0x1fa9c2){var _0x3ac678=this;return new Promise(function(_0x81fff7,_0x1b48a9){return db[_0x2d38('0x24')][_0x2d38('0x25')]({'raw':_0x1fa9c2['options']?_0x1fa9c2[_0x2d38('0x1b')][_0x2d38('0x1c')]===undefined?!![]:![]:!![],'where':_0x1fa9c2[_0x2d38('0x1b')]?_0x1fa9c2[_0x2d38('0x1b')]['where']||null:null,'attributes':_0x1fa9c2[_0x2d38('0x1b')]?_0x1fa9c2[_0x2d38('0x1b')][_0x2d38('0x1e')]||null:null,'include':_0x1fa9c2[_0x2d38('0x1b')]?_0x1fa9c2[_0x2d38('0x1b')][_0x2d38('0x21')]?_[_0x2d38('0x20')](_0x1fa9c2[_0x2d38('0x1b')][_0x2d38('0x21')],function(_0xab361d){return{'model':db[_0xab361d['model']],'as':_0xab361d['as'],'attributes':_0xab361d['attributes'],'include':_0xab361d[_0x2d38('0x21')]?_[_0x2d38('0x20')](_0xab361d[_0x2d38('0x21')],function(_0x42f9d0){return{'model':db[_0x42f9d0[_0x2d38('0x22')]],'as':_0x42f9d0['as'],'attributes':_0x42f9d0[_0x2d38('0x1e')],'include':_0x42f9d0[_0x2d38('0x21')]?_[_0x2d38('0x20')](_0x42f9d0[_0x2d38('0x21')],function(_0x145c42){return{'model':db[_0x145c42[_0x2d38('0x22')]],'as':_0x145c42['as'],'attributes':_0x145c42[_0x2d38('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x2d38('0x10')](function(_0x48be91){logger[_0x2d38('0x11')](_0x2d38('0x26'),_0x1fa9c2);logger[_0x2d38('0x14')](_0x2d38('0x26'),_0x1fa9c2,JSON['stringify'](_0x48be91));_0x81fff7(_0x48be91);})[_0x2d38('0x23')](function(_0x41a211){logger[_0x2d38('0x16')](_0x2d38('0x26'),_0x41a211[_0x2d38('0x18')],_0x1fa9c2);_0x1b48a9(_0x3ac678[_0x2d38('0x16')](0x1f4,_0x41a211[_0x2d38('0x18')]));});});};exports[_0x2d38('0x27')]=function(_0x1194cf){var _0x2af2c3=this;return new Promise(function(_0x3cd072,_0x82bb9){var _0x1e1d70={'body':_0x1194cf[_0x2d38('0x28')],'channel':'mail'};var _0x234b9e=_[_0x2d38('0x29')](_['keys'](db['CmContact'][_0x2d38('0x2a')]),[_0x2d38('0x2b'),_0x2d38('0x2c'),'CompanyId',_0x2d38('0x2d')]);var _0x17cc8d=![];if(_0x1194cf[_0x2d38('0x28')]['id']){delete _0x1194cf['body']['id'];}if(_['isNil'](_0x1194cf[_0x2d38('0x28')]['from'])){return _0x82bb9(_0x2af2c3[_0x2d38('0x16')](0x1f4,_0x2d38('0x2e')));}if(_[_0x2d38('0x2f')](_0x1194cf['body']['body'])||_0x1194cf[_0x2d38('0x28')][_0x2d38('0x28')]===''){return _0x82bb9(_0x2af2c3[_0x2d38('0x16')](0x1f4,'body\x20is\x20mandatory\x20and\x20not\x20empty'));}if(_[_0x2d38('0x2f')](_0x1194cf[_0x2d38('0x28')][_0x2d38('0x30')])){return _0x82bb9(_0x2af2c3['error'](0x1f4,_0x2d38('0x31')+_0x234b9e));}if(!_[_0x2d38('0x32')](_0x234b9e,_0x1194cf[_0x2d38('0x28')]['mapKey'])){return _0x82bb9(_0x2af2c3['error'](0x1f4,_0x2d38('0x33')+_0x234b9e));}var _0x18cc37={};_0x18cc37[_0x1194cf[_0x2d38('0x28')][_0x2d38('0x30')]]=_0x1194cf['body'][_0x2d38('0x34')];return db[_0x2d38('0x24')][_0x2d38('0x25')]({'where':{'id':_0x1194cf['account']['id']},'include':[{'model':db[_0x2d38('0x35')],'as':'List','include':[{'model':db['CmContact'],'as':_0x2d38('0x36'),'where':_0x18cc37,'limit':0x1,'order':[[_0x2d38('0x2c'),_0x2d38('0x37')]]}]},{'model':db[_0x2d38('0x38')],'as':'Applications'},{'model':db['MailServerOut'],'as':_0x2d38('0x39')}]})['then'](function(_0x9c67cb){if(_0x9c67cb&&_0x9c67cb[_0x2d38('0x3a')]){var _0x30c1b2=_0x9c67cb[_0x2d38('0x3b')]({'plain':!![]});_0x1e1d70[_0x2d38('0x3c')]=_[_0x2d38('0x3d')](_0x30c1b2,[_0x2d38('0x3e'),_0x2d38('0x3a')]);_0x1e1d70[_0x2d38('0x3f')]=_0x30c1b2['Applications'];_0x1e1d70[_0x2d38('0x40')]=_0x30c1b2['List'];_0x1e1d70[_0x2d38('0x3f')]=_[_0x2d38('0x41')](_0x1e1d70['applications'],[_0x2d38('0x42')],[_0x2d38('0x43')]);if(_0x1e1d70[_0x2d38('0x3c')]&&_0x1e1d70[_0x2d38('0x3c')][_0x2d38('0x44')]){_0x1e1d70[_0x2d38('0x3f')][_0x2d38('0x45')]({'id':0x0,'priority':_0x1e1d70[_0x2d38('0x3f')]['length']+0x1,'app':_0x2d38('0x46'),'appdata':_0x2d38('0x44'),'interval':_0x2d38('0x47')});}if(_0x1e1d70[_0x2d38('0x3c')][_0x2d38('0x3e')]){delete _0x1e1d70[_0x2d38('0x3c')][_0x2d38('0x3e')];}if(_0x1e1d70[_0x2d38('0x3c')][_0x2d38('0x3a')]){delete _0x1e1d70['account'][_0x2d38('0x3a')];}if(_0x30c1b2[_0x2d38('0x3a')]['Contacts']['length']){return _0x30c1b2[_0x2d38('0x3a')][_0x2d38('0x36')][0x0];}var _0x208ae0=_[_0x2d38('0x48')](_0x1194cf['body'],{'firstName':_0x1194cf['body'][_0x2d38('0x34')],'ListId':_0x30c1b2[_0x2d38('0x2d')]});_0x208ae0[_0x1194cf[_0x2d38('0x28')][_0x2d38('0x30')]]=_0x1194cf[_0x2d38('0x28')][_0x2d38('0x34')];return db[_0x2d38('0x49')][_0x2d38('0x4a')](_0x208ae0);}else{throw new Error(_0x2d38('0x4b'));}})[_0x2d38('0x10')](function(_0x1afa40){_0x1e1d70['contact']=_0x1afa40;if(_0x1afa40){if(!_0x1194cf[_0x2d38('0x28')]['message']['messageId']){_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4c')]=rs['generate']()+'\x20'+_0x1194cf['body'][_0x2d38('0x18')][_0x2d38('0x34')];}var _0x5a8820={'ContactId':_0x1afa40['id'],'MailAccountId':_0x1194cf[_0x2d38('0x3c')]['id'],'inReplyTo':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4c')],'to':_0x1194cf[_0x2d38('0x28')]['message']['from'],'cc':_0x1194cf[_0x2d38('0x28')]['message']['cc'],'subject':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4d')],'attach':_0x1194cf[_0x2d38('0x28')]['message'][_0x2d38('0x4e')],'lastMsgAt':moment()[_0x2d38('0x4f')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in','lastMsgBody':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x28')]};return db['MailInteraction'][_0x2d38('0x25')]({'where':{'closed':![],'MailAccountId':_0x1194cf['account']['id']},'include':[{'model':db['MailMessage'],'as':_0x2d38('0x50'),'attributes':[_0x2d38('0x4c')],'where':{'messageId':_0x1194cf['body']['message'][_0x2d38('0x51')]}}]})['then'](function(_0x1ad19e){if(_0x1ad19e){return[_0x1ad19e,![]];}return db[_0x2d38('0x52')][_0x2d38('0x4a')](_0x5a8820)['then'](function(_0x5f0a8a){return[_0x5f0a8a,!![]];});});}else{throw new Error(_0x2d38('0x53'));}})[_0x2d38('0x54')](function(_0x5c8a2e,_0x750ef1){if(_0x5c8a2e){_0x17cc8d=_0x750ef1;if(!_0x750ef1){return _0x5c8a2e[_0x2d38('0x55')]({'inReplyTo':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4c')],'to':_0x1194cf['body'][_0x2d38('0x18')]['from'],'cc':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')]['cc'],'subject':_0x1194cf['body']['message'][_0x2d38('0x4d')],'attach':_0x5c8a2e[_0x2d38('0x4e')]?_0x5c8a2e[_0x2d38('0x4e')]:_0x1194cf[_0x2d38('0x28')]['message'][_0x2d38('0x4e')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()[_0x2d38('0x4f')](_0x2d38('0x56')),'lastMsgDirection':'in','lastMsgBody':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x28')]});}else{return _0x5c8a2e;}}})['then'](function(_0x453fff){_0x1e1d70[_0x2d38('0x57')]=_0x453fff[_0x2d38('0x3b')]({'plain':!![]});_0x1e1d70[_0x2d38('0x57')]['created']=_0x17cc8d;return db['MailMessage']['create']({'body':_0x1194cf['body']['body'],'MailAccountId':_0x1194cf['account']['id'],'MailInteractionId':_0x453fff['id'],'direction':'in','ContactId':_0x1e1d70[_0x2d38('0x58')]['id'],'messageId':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4c')],'from':_0x1194cf[_0x2d38('0x28')]['message'][_0x2d38('0x34')],'to':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')]['to'],'cc':_0x1194cf[_0x2d38('0x28')]['message']['cc'],'subject':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4d')],'attach':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x4e')],'Attachments':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x59')],'originTo':_0x1194cf['body'][_0x2d38('0x18')][_0x2d38('0x5a')],'originCc':_0x1194cf[_0x2d38('0x28')]['message'][_0x2d38('0x5b')],'bcc':_0x1194cf[_0x2d38('0x28')][_0x2d38('0x18')][_0x2d38('0x5c')]},{'include':[{'model':db[_0x2d38('0x5d')],'as':_0x2d38('0x5e')}]});})['then'](function(_0x2f3e38){_0x1e1d70[_0x2d38('0x18')]=_0x2f3e38;if(_0x1e1d70[_0x2d38('0x57')][_0x2d38('0x5f')]){return db[_0x2d38('0x60')]['find']({'attributes':['id',_0x2d38('0x61')],'where':{'id':_0x1e1d70['interaction'][_0x2d38('0x5f')]}})['then'](function(_0xe77ef7){if(_0xe77ef7){_0x1e1d70[_0x2d38('0x3f')]['unshift']({'id':0x0,'priority':0x0,'app':_0x2d38('0x62'),'appdata':_0xe77ef7[_0x2d38('0x61')]+','+(_0x1e1d70[_0x2d38('0x3c')][_0x2d38('0x63')]||0xa),'interval':_0x2d38('0x47')});}return respondWithRpcPromise(_0x2d38('0x64'),_0x2d38('0x65'),_0x1e1d70);});}return respondWithRpcPromise(_0x2d38('0x64'),_0x2d38('0x65'),_0x1e1d70);})[_0x2d38('0x10')](function(_0x1e4eba){_0x3cd072(_0x1e4eba);})[_0x2d38('0x23')](function(_0x335e11){_0x82bb9(_0x2af2c3[_0x2d38('0x16')](0x1f4,_0x335e11[_0x2d38('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 99786de..fac6c78 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 _0xff3c=['save','update','emit','removeListener','register','length','./mailAccount.events'];(function(_0x402d90,_0x6513b3){var _0x1b57fb=function(_0xe724d7){while(--_0xe724d7){_0x402d90['push'](_0x402d90['shift']());}};_0x1b57fb(++_0x6513b3);}(_0xff3c,0x179));var _0xcff3=function(_0x3faf76,_0x2c6c9b){_0x3faf76=_0x3faf76-0x0;var _0x7fc3aa=_0xff3c[_0x3faf76];return _0x7fc3aa;};'use strict';var MailAccountEvents=require(_0xcff3('0x0'));var events=[_0xcff3('0x1'),'remove',_0xcff3('0x2')];function createListener(_0x832575,_0x5344ec){return function(_0x51358d){_0x5344ec[_0xcff3('0x3')](_0x832575,_0x51358d);};}function removeListener(_0x17ae92,_0x45c7f6){return function(){MailAccountEvents[_0xcff3('0x4')](_0x17ae92,_0x45c7f6);};}exports[_0xcff3('0x5')]=function(_0x308a82){for(var _0x47b899=0x0,_0x48620d=events[_0xcff3('0x6')];_0x47b899<_0x48620d;_0x47b899++){var _0x5f1b99=events[_0x47b899];var _0x6a338e=createListener('mailAccount:'+_0x5f1b99,_0x308a82);MailAccountEvents['on'](_0x5f1b99,_0x6a338e);}}; \ No newline at end of file +var _0x6003=['remove','update','emit','removeListener','register','mailAccount:','./mailAccount.events','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6003,0xae));var _0x3600=function(_0x4767c2,_0x1128b8){_0x4767c2=_0x4767c2-0x0;var _0x483521=_0x6003[_0x4767c2];return _0x483521;};'use strict';var MailAccountEvents=require(_0x3600('0x0'));var events=[_0x3600('0x1'),_0x3600('0x2'),_0x3600('0x3')];function createListener(_0x4f423f,_0x484cf5){return function(_0x367da4){_0x484cf5[_0x3600('0x4')](_0x4f423f,_0x367da4);};}function removeListener(_0x29c0fd,_0x47b8b3){return function(){MailAccountEvents[_0x3600('0x5')](_0x29c0fd,_0x47b8b3);};}exports[_0x3600('0x6')]=function(_0x53a557){for(var _0x2953ac=0x0,_0x4f4130=events['length'];_0x2953ac<_0x4f4130;_0x2953ac++){var _0x177f11=events[_0x2953ac];var _0x4a5962=createListener(_0x3600('0x7')+_0x177f11,_0x53a557);MailAccountEvents['on'](_0x177f11,_0x4a5962);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 53078ad..9039c2b 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 _0x5ff3=['show','put','delete','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated'];(function(_0xdc168b,_0xac517f){var _0x77e1e5=function(_0xea022b){while(--_0xea022b){_0xdc168b['push'](_0xdc168b['shift']());}};_0x77e1e5(++_0xac517f);}(_0x5ff3,0x17d));var _0x35ff=function(_0x3dbe57,_0x429eed){_0x3dbe57=_0x3dbe57-0x0;var _0x45a7e4=_0x5ff3[_0x3dbe57];return _0x45a7e4;};'use strict';var multer=require('multer');var util=require(_0x35ff('0x0'));var path=require('path');var timeout=require(_0x35ff('0x1'));var express=require('express');var router=express[_0x35ff('0x2')]();var auth=require(_0x35ff('0x3'));var interaction=require(_0x35ff('0x4'));var config=require(_0x35ff('0x5'));var controller=require('./mailApplication.controller');router[_0x35ff('0x6')](_0x35ff('0x7'),auth[_0x35ff('0x8')](),controller[_0x35ff('0x9')]);router[_0x35ff('0xa')]('/:id',auth[_0x35ff('0x8')](),controller['update']);router[_0x35ff('0xb')](_0x35ff('0x7'),auth[_0x35ff('0x8')](),controller['destroy']);module[_0x35ff('0xc')]=router; \ No newline at end of file +var _0xf45e=['put','update','delete','destroy','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x4edda2,_0x472bc0){var _0x1b3455=function(_0x2e8634){while(--_0x2e8634){_0x4edda2['push'](_0x4edda2['shift']());}};_0x1b3455(++_0x472bc0);}(_0xf45e,0x115));var _0xef45=function(_0x141578,_0x2b6abd){_0x141578=_0x141578-0x0;var _0x5f1d89=_0xf45e[_0x141578];return _0x5f1d89;};'use strict';var multer=require(_0xef45('0x0'));var util=require('util');var path=require(_0xef45('0x1'));var timeout=require('connect-timeout');var express=require(_0xef45('0x2'));var router=express[_0xef45('0x3')]();var auth=require(_0xef45('0x4'));var interaction=require(_0xef45('0x5'));var config=require(_0xef45('0x6'));var controller=require(_0xef45('0x7'));router[_0xef45('0x8')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xb')]);router[_0xef45('0xc')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xd')]);router[_0xef45('0xe')](_0xef45('0x9'),auth[_0xef45('0xa')](),controller[_0xef45('0xf')]);module[_0xef45('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4297158..48051ee 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 _0xb445=['exports','INTEGER','STRING','TEXT','*,*,*,*','sequelize'];(function(_0x1cc775,_0xebd379){var _0x2a02ba=function(_0x420af9){while(--_0x420af9){_0x1cc775['push'](_0x1cc775['shift']());}};_0x2a02ba(++_0xebd379);}(_0xb445,0x89));var _0x5b44=function(_0x5cad29,_0x412fb6){_0x5cad29=_0x5cad29-0x0;var _0x45b1c1=_0xb445[_0x5cad29];return _0x45b1c1;};'use strict';var Sequelize=require(_0x5b44('0x0'));module[_0x5b44('0x1')]={'priority':{'type':Sequelize[_0x5b44('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x5b44('0x3')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x5b44('0x4')]()},'description':{'type':Sequelize[_0x5b44('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x5b44('0x5')}}; \ No newline at end of file +var _0xc72e=['INTEGER','STRING','noop','TEXT','*,*,*,*'];(function(_0x447ddf,_0x11d244){var _0xa82f9=function(_0x836edb){while(--_0x836edb){_0x447ddf['push'](_0x447ddf['shift']());}};_0xa82f9(++_0x11d244);}(_0xc72e,0x10e));var _0xec72=function(_0x2a3e77,_0x4397a9){_0x2a3e77=_0x2a3e77-0x0;var _0x4abb67=_0xc72e[_0x2a3e77];return _0x4abb67;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0xec72('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0xec72('0x1')],'allowNull':![],'defaultValue':_0xec72('0x2')},'appdata':{'type':Sequelize[_0xec72('0x3')]()},'description':{'type':Sequelize[_0xec72('0x1')]},'interval':{'type':Sequelize[_0xec72('0x1')],'defaultValue':_0xec72('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 29525a1..4b53b9a 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 _0x52b4=['rawAttributes','query','keys','intersection','fields','attributes','length','include','merge','options','find','catch','body','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../mysqldb','sendStatus','end','status','json','offset','limit','set','reject','then','destroy','error','stack','name','send','params','model','MailApplication'];(function(_0x12b5bd,_0x30abb1){var _0x26d24e=function(_0x4dca14){while(--_0x4dca14){_0x12b5bd['push'](_0x12b5bd['shift']());}};_0x26d24e(++_0x30abb1);}(_0x52b4,0xdd));var _0x452b=function(_0x2bc24f,_0x1ebbc6){_0x2bc24f=_0x2bc24f-0x0;var _0x4c2524=_0x52b4[_0x2bc24f];return _0x4c2524;};'use strict';var pdf=require(_0x452b('0x0'));var emlformat=require(_0x452b('0x1'));var rimraf=require(_0x452b('0x2'));var zipdir=require(_0x452b('0x3'));var jsonpatch=require(_0x452b('0x4'));var rp=require(_0x452b('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x452b('0x6'));var util=require(_0x452b('0x7'));var path=require(_0x452b('0x8'));var sox=require(_0x452b('0x9'));var csv=require(_0x452b('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x452b('0xb'));var squel=require('squel');var crypto=require(_0x452b('0xc'));var jsforce=require(_0x452b('0xd'));var deskjs=require(_0x452b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x452b('0xf'));var Papa=require(_0x452b('0x10'));var Redis=require(_0x452b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x452b('0x12'));var as=require(_0x452b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x452b('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x452b('0x15'))['db'];function respondWithStatusCode(_0x5afe26,_0x17f95a){_0x17f95a=_0x17f95a||0xcc;return function(_0x110020){if(_0x110020){return _0x5afe26[_0x452b('0x16')](_0x17f95a);}return _0x5afe26['status'](_0x17f95a)[_0x452b('0x17')]();};}function respondWithResult(_0x26f3a0,_0x3ce75a){_0x3ce75a=_0x3ce75a||0xc8;return function(_0x372fe2){if(_0x372fe2){return _0x26f3a0[_0x452b('0x18')](_0x3ce75a)[_0x452b('0x19')](_0x372fe2);}};}function respondWithFilteredResult(_0x494106,_0x2e149c){return function(_0x533a77){if(_0x533a77){var _0x1fedb7=_0x533a77['count'],_0x58b63a=_0x2e149c[_0x452b('0x1a')],_0x5e25d6=_0x2e149c[_0x452b('0x1a')]+_0x2e149c[_0x452b('0x1b')],_0x114c1a;if(_0x5e25d6>=_0x1fedb7){_0x5e25d6=_0x1fedb7;_0x114c1a=0xc8;}else{_0x114c1a=0xce;}_0x494106['status'](_0x114c1a);return _0x494106[_0x452b('0x1c')]('Content-Range',_0x58b63a+'-'+_0x5e25d6+'/'+_0x1fedb7)[_0x452b('0x19')](_0x533a77);}return null;};}function patchUpdates(_0x3ecc42){return function(_0x4ae955){try{jsonpatch['apply'](_0x4ae955,_0x3ecc42,!![]);}catch(_0x1ad639){return BPromise[_0x452b('0x1d')](_0x1ad639);}return _0x4ae955['save']();};}function saveUpdates(_0xa7198f,_0x107b2f){return function(_0x8fc5c9){if(_0x8fc5c9){return _0x8fc5c9['update'](_0xa7198f)[_0x452b('0x1e')](function(_0x4dd9bf){return _0x4dd9bf;});}return null;};}function removeEntity(_0x27ab5e,_0x3dbfdc){return function(_0xa90fa6){if(_0xa90fa6){return _0xa90fa6[_0x452b('0x1f')]()[_0x452b('0x1e')](function(){_0x27ab5e[_0x452b('0x18')](0xcc)[_0x452b('0x17')]();});}};}function handleEntityNotFound(_0x4ff120,_0x246248){return function(_0x384909){if(!_0x384909){_0x4ff120[_0x452b('0x16')](0x194);}return _0x384909;};}function handleError(_0x4cd031,_0x36012a){_0x36012a=_0x36012a||0x1f4;return function(_0x25a3db){logger[_0x452b('0x20')](_0x25a3db[_0x452b('0x21')]);if(_0x25a3db[_0x452b('0x22')]){delete _0x25a3db[_0x452b('0x22')];}_0x4cd031[_0x452b('0x18')](_0x36012a)[_0x452b('0x23')](_0x25a3db);};}exports['show']=function(_0x5743ac,_0x3c70b1){var _0x4804fb={'raw':!![],'where':{'id':_0x5743ac[_0x452b('0x24')]['id']}},_0x4fdc1c={};_0x4fdc1c[_0x452b('0x25')]=_['keys'](db[_0x452b('0x26')][_0x452b('0x27')]);_0x4fdc1c[_0x452b('0x28')]=_[_0x452b('0x29')](_0x5743ac[_0x452b('0x28')]);_0x4fdc1c['filters']=_['intersection'](_0x4fdc1c[_0x452b('0x25')],_0x4fdc1c[_0x452b('0x28')]);_0x4804fb['attributes']=_[_0x452b('0x2a')](_0x4fdc1c[_0x452b('0x25')],qs[_0x452b('0x2b')](_0x5743ac[_0x452b('0x28')][_0x452b('0x2b')]));_0x4804fb[_0x452b('0x2c')]=_0x4804fb['attributes'][_0x452b('0x2d')]?_0x4804fb[_0x452b('0x2c')]:_0x4fdc1c[_0x452b('0x25')];if(_0x5743ac[_0x452b('0x28')]['includeAll']){_0x4804fb[_0x452b('0x2e')]=[{'all':!![]}];}_0x4804fb=_[_0x452b('0x2f')]({},_0x4804fb,_0x5743ac[_0x452b('0x30')]);return db[_0x452b('0x26')][_0x452b('0x31')](_0x4804fb)[_0x452b('0x1e')](handleEntityNotFound(_0x3c70b1,null))[_0x452b('0x1e')](respondWithResult(_0x3c70b1,null))[_0x452b('0x32')](handleError(_0x3c70b1,null));};exports['update']=function(_0x144ff0,_0x578b4f){if(_0x144ff0[_0x452b('0x33')]['id']){delete _0x144ff0[_0x452b('0x33')]['id'];}return db['MailApplication'][_0x452b('0x31')]({'where':{'id':_0x144ff0[_0x452b('0x24')]['id']}})[_0x452b('0x1e')](handleEntityNotFound(_0x578b4f,null))['then'](saveUpdates(_0x144ff0['body'],null))[_0x452b('0x1e')](respondWithResult(_0x578b4f,null))[_0x452b('0x32')](handleError(_0x578b4f,null));};exports['destroy']=function(_0x352a0d,_0x419c47){return db[_0x452b('0x26')][_0x452b('0x31')]({'where':{'id':_0x352a0d[_0x452b('0x24')]['id']}})[_0x452b('0x1e')](handleEntityNotFound(_0x419c47,null))['then'](removeEntity(_0x419c47,null))[_0x452b('0x32')](handleError(_0x419c47,null));}; \ No newline at end of file +var _0x94cf=['rawAttributes','query','keys','filters','intersection','attributes','fields','includeAll','include','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','end','error','name','send','show','params','model','MailApplication'];(function(_0x10c8d0,_0xb1965a){var _0x2321ee=function(_0x449f3b){while(--_0x449f3b){_0x10c8d0['push'](_0x10c8d0['shift']());}};_0x2321ee(++_0xb1965a);}(_0x94cf,0xc2));var _0xf94c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94cf[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf94c('0x0'));var rimraf=require(_0xf94c('0x1'));var zipdir=require(_0xf94c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf94c('0x3'));var moment=require(_0xf94c('0x4'));var BPromise=require(_0xf94c('0x5'));var Mustache=require(_0xf94c('0x6'));var util=require(_0xf94c('0x7'));var path=require(_0xf94c('0x8'));var sox=require(_0xf94c('0x9'));var csv=require(_0xf94c('0xa'));var ejs=require(_0xf94c('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf94c('0xc'));var crypto=require(_0xf94c('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf94c('0xe'));var toCsv=require(_0xf94c('0xa'));var querystring=require(_0xf94c('0xf'));var Papa=require(_0xf94c('0x10'));var Redis=require('ioredis');var authService=require(_0xf94c('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xf94c('0x12'));var hardwareService=require(_0xf94c('0x13'));var logger=require(_0xf94c('0x14'))(_0xf94c('0x15'));var utils=require(_0xf94c('0x16'));var config=require(_0xf94c('0x17'));var db=require(_0xf94c('0x18'))['db'];function respondWithStatusCode(_0x54a340,_0x182478){_0x182478=_0x182478||0xcc;return function(_0x326038){if(_0x326038){return _0x54a340[_0xf94c('0x19')](_0x182478);}return _0x54a340['status'](_0x182478)['end']();};}function respondWithResult(_0x456cb9,_0x1d8359){_0x1d8359=_0x1d8359||0xc8;return function(_0x3d44a9){if(_0x3d44a9){return _0x456cb9[_0xf94c('0x1a')](_0x1d8359)[_0xf94c('0x1b')](_0x3d44a9);}};}function respondWithFilteredResult(_0x2d9e06,_0x326cca){return function(_0x892620){if(_0x892620){var _0x5cef8b=_0x892620[_0xf94c('0x1c')],_0x1d410d=_0x326cca[_0xf94c('0x1d')],_0x31829e=_0x326cca[_0xf94c('0x1d')]+_0x326cca[_0xf94c('0x1e')],_0x410036;if(_0x31829e>=_0x5cef8b){_0x31829e=_0x5cef8b;_0x410036=0xc8;}else{_0x410036=0xce;}_0x2d9e06[_0xf94c('0x1a')](_0x410036);return _0x2d9e06[_0xf94c('0x1f')](_0xf94c('0x20'),_0x1d410d+'-'+_0x31829e+'/'+_0x5cef8b)['json'](_0x892620);}return null;};}function patchUpdates(_0x19a958){return function(_0x1b0a68){try{jsonpatch['apply'](_0x1b0a68,_0x19a958,!![]);}catch(_0x4353fe){return BPromise[_0xf94c('0x21')](_0x4353fe);}return _0x1b0a68[_0xf94c('0x22')]();};}function saveUpdates(_0x1cdcbf,_0x17b0db){return function(_0x540122){if(_0x540122){return _0x540122[_0xf94c('0x23')](_0x1cdcbf)[_0xf94c('0x24')](function(_0x490cce){return _0x490cce;});}return null;};}function removeEntity(_0x2384f8,_0x17370d){return function(_0x28bdb0){if(_0x28bdb0){return _0x28bdb0[_0xf94c('0x25')]()['then'](function(){_0x2384f8[_0xf94c('0x1a')](0xcc)[_0xf94c('0x26')]();});}};}function handleEntityNotFound(_0x4de690,_0x4f8fd2){return function(_0x42c3f5){if(!_0x42c3f5){_0x4de690[_0xf94c('0x19')](0x194);}return _0x42c3f5;};}function handleError(_0x39d765,_0x41c890){_0x41c890=_0x41c890||0x1f4;return function(_0x1a49a5){logger[_0xf94c('0x27')](_0x1a49a5['stack']);if(_0x1a49a5['name']){delete _0x1a49a5[_0xf94c('0x28')];}_0x39d765[_0xf94c('0x1a')](_0x41c890)[_0xf94c('0x29')](_0x1a49a5);};}exports[_0xf94c('0x2a')]=function(_0x1fc75c,_0x449d76){var _0x4959b0={'raw':!![],'where':{'id':_0x1fc75c[_0xf94c('0x2b')]['id']}},_0x48fb09={};_0x48fb09[_0xf94c('0x2c')]=_['keys'](db[_0xf94c('0x2d')][_0xf94c('0x2e')]);_0x48fb09[_0xf94c('0x2f')]=_[_0xf94c('0x30')](_0x1fc75c[_0xf94c('0x2f')]);_0x48fb09[_0xf94c('0x31')]=_[_0xf94c('0x32')](_0x48fb09[_0xf94c('0x2c')],_0x48fb09['query']);_0x4959b0[_0xf94c('0x33')]=_[_0xf94c('0x32')](_0x48fb09[_0xf94c('0x2c')],qs[_0xf94c('0x34')](_0x1fc75c[_0xf94c('0x2f')][_0xf94c('0x34')]));_0x4959b0['attributes']=_0x4959b0[_0xf94c('0x33')]['length']?_0x4959b0[_0xf94c('0x33')]:_0x48fb09['model'];if(_0x1fc75c['query'][_0xf94c('0x35')]){_0x4959b0[_0xf94c('0x36')]=[{'all':!![]}];}_0x4959b0=_[_0xf94c('0x37')]({},_0x4959b0,_0x1fc75c[_0xf94c('0x38')]);return db[_0xf94c('0x2d')][_0xf94c('0x39')](_0x4959b0)[_0xf94c('0x24')](handleEntityNotFound(_0x449d76,null))[_0xf94c('0x24')](respondWithResult(_0x449d76,null))[_0xf94c('0x3a')](handleError(_0x449d76,null));};exports['update']=function(_0x1be309,_0x57af48){if(_0x1be309[_0xf94c('0x3b')]['id']){delete _0x1be309['body']['id'];}return db['MailApplication'][_0xf94c('0x39')]({'where':{'id':_0x1be309['params']['id']}})[_0xf94c('0x24')](handleEntityNotFound(_0x57af48,null))[_0xf94c('0x24')](saveUpdates(_0x1be309[_0xf94c('0x3b')],null))['then'](respondWithResult(_0x57af48,null))['catch'](handleError(_0x57af48,null));};exports[_0xf94c('0x25')]=function(_0x34fb0e,_0x2ee3b6){return db['MailApplication'][_0xf94c('0x39')]({'where':{'id':_0x34fb0e[_0xf94c('0x2b')]['id']}})['then'](handleEntityNotFound(_0x2ee3b6,null))[_0xf94c('0x24')](removeEntity(_0x2ee3b6,null))[_0xf94c('0x3a')](handleError(_0x2ee3b6,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 348a602..5177476 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 _0xdd6e=['api','bluebird','request-promise','path','rimraf','MailApplication','mail_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x261038,_0x2fab28){var _0x2fd230=function(_0x429660){while(--_0x429660){_0x261038['push'](_0x261038['shift']());}};_0x2fd230(++_0x2fab28);}(_0xdd6e,0xa5));var _0xedd6=function(_0x1926b5,_0x36234a){_0x1926b5=_0x1926b5-0x0;var _0x269e0f=_0xdd6e[_0x1926b5];return _0x269e0f;};'use strict';var _=require(_0xedd6('0x0'));var util=require(_0xedd6('0x1'));var logger=require(_0xedd6('0x2'))(_0xedd6('0x3'));var moment=require('moment');var BPromise=require(_0xedd6('0x4'));var rp=require(_0xedd6('0x5'));var fs=require('fs');var path=require(_0xedd6('0x6'));var rimraf=require(_0xedd6('0x7'));var config=require('../../config/environment');var attributes=require('./mailApplication.attributes');module['exports']=function(_0x3430b2,_0x27b159){return _0x3430b2['define'](_0xedd6('0x8'),attributes,{'tableName':_0xedd6('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xedd6('0xa'),'collate':_0xedd6('0xb')});}; \ No newline at end of file +var _0x253d=['../../config/environment','exports','define','MailApplication','utf8mb4','utf8mb4_unicode_ci','lodash','bluebird','request-promise','path','rimraf'];(function(_0xa60b9,_0x41ab8d){var _0xa3dc1a=function(_0x32928f){while(--_0x32928f){_0xa60b9['push'](_0xa60b9['shift']());}};_0xa3dc1a(++_0x41ab8d);}(_0x253d,0x1b3));var _0xd253=function(_0xf894e1,_0x1b7304){_0xf894e1=_0xf894e1-0x0;var _0x3b1e1b=_0x253d[_0xf894e1];return _0x3b1e1b;};'use strict';var _=require(_0xd253('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xd253('0x1'));var rp=require(_0xd253('0x2'));var fs=require('fs');var path=require(_0xd253('0x3'));var rimraf=require(_0xd253('0x4'));var config=require(_0xd253('0x5'));var attributes=require('./mailApplication.attributes');module[_0xd253('0x6')]=function(_0x42d36c,_0x3dca3d){return _0x42d36c[_0xd253('0x7')](_0xd253('0x8'),attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd253('0x9'),'collate':_0xd253('0xa')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 6c4d33f..c349fca 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 _0xb983=['message','result','catch','body','options','raw','where','attributes','limit','info','UpdateMailApplication','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x436e9e,_0x1f5601){var _0x36ecd8=function(_0x2ce181){while(--_0x2ce181){_0x436e9e['push'](_0x436e9e['shift']());}};_0x36ecd8(++_0x1f5601);}(_0xb983,0x19e));var _0x3b98=function(_0x1df7b8,_0x2fe5e5){_0x1df7b8=_0x1df7b8-0x0;var _0x29d911=_0xb983[_0x1df7b8];return _0x29d911;};'use strict';var _=require(_0x3b98('0x0'));var util=require(_0x3b98('0x1'));var moment=require(_0x3b98('0x2'));var BPromise=require('bluebird');var rs=require(_0x3b98('0x3'));var fs=require('fs');var Redis=require(_0x3b98('0x4'));var db=require(_0x3b98('0x5'))['db'];var utils=require(_0x3b98('0x6'));var logger=require(_0x3b98('0x7'))('rpc');var config=require(_0x3b98('0x8'));var jayson=require(_0x3b98('0x9'));var client=jayson['client'][_0x3b98('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1f883d,_0x1d5fff,_0x260f56){return new BPromise(function(_0x56659f,_0xfba8f2){return client[_0x3b98('0xb')](_0x1f883d,_0x260f56)[_0x3b98('0xc')](function(_0x5e91ec){logger['info'](_0x3b98('0xd'),_0x1d5fff,_0x3b98('0xe'));logger[_0x3b98('0xf')](_0x3b98('0x10'),_0x1d5fff,_0x3b98('0xe'),JSON[_0x3b98('0x11')](_0x5e91ec));if(_0x5e91ec[_0x3b98('0x12')]){if(_0x5e91ec[_0x3b98('0x12')][_0x3b98('0x13')]===0x1f4){logger[_0x3b98('0x12')]('MailApplication,\x20%s,\x20%s',_0x1d5fff,_0x5e91ec[_0x3b98('0x12')]['message']);return _0xfba8f2(_0x5e91ec[_0x3b98('0x12')][_0x3b98('0x14')]);}logger[_0x3b98('0x12')](_0x3b98('0xd'),_0x1d5fff,_0x5e91ec[_0x3b98('0x12')][_0x3b98('0x14')]);return _0x56659f(_0x5e91ec[_0x3b98('0x12')]['message']);}else{logger['info'](_0x3b98('0xd'),_0x1d5fff,'request\x20sent');_0x56659f(_0x5e91ec[_0x3b98('0x15')][_0x3b98('0x14')]);}})[_0x3b98('0x16')](function(_0x118900){logger[_0x3b98('0x12')]('MailApplication,\x20%s,\x20%s',_0x1d5fff,_0x118900);_0xfba8f2(_0x118900);});});}exports['UpdateMailApplication']=function(_0x3c4545){var _0x5bbf98=this;return new Promise(function(_0x5319c0,_0x3f5d8d){return db['MailApplication']['update'](_0x3c4545[_0x3b98('0x17')],{'raw':_0x3c4545[_0x3b98('0x18')]?_0x3c4545['options'][_0x3b98('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c4545[_0x3b98('0x18')]?_0x3c4545[_0x3b98('0x18')][_0x3b98('0x1a')]||null:null,'attributes':_0x3c4545[_0x3b98('0x18')]?_0x3c4545['options'][_0x3b98('0x1b')]||null:null,'limit':_0x3c4545[_0x3b98('0x18')]?_0x3c4545[_0x3b98('0x18')][_0x3b98('0x1c')]||null:null})['then'](function(_0xf51984){logger[_0x3b98('0x1d')](_0x3b98('0x1e'),_0x3c4545);logger['debug'](_0x3b98('0x1e'),_0x3c4545,JSON[_0x3b98('0x11')](_0xf51984));_0x5319c0(_0xf51984);})[_0x3b98('0x16')](function(_0x45a4ae){logger[_0x3b98('0x12')]('UpdateMailApplication',_0x45a4ae['message'],_0x3c4545);_0x3f5d8d(_0x5bbf98[_0x3b98('0x12')](0x1f4,_0x45a4ae[_0x3b98('0x14')]));});});}; \ No newline at end of file +var _0x30f8=['request','then','info','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','MailApplication,\x20%s,\x20%s','result','catch','UpdateMailApplication','MailApplication','update','body','options','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x30f8,0x86));var _0x830f=function(_0x45cbc7,_0x1c0a78){_0x45cbc7=_0x45cbc7-0x0;var _0x5c539a=_0x30f8[_0x45cbc7];return _0x5c539a;};'use strict';var _=require('lodash');var util=require(_0x830f('0x0'));var moment=require(_0x830f('0x1'));var BPromise=require(_0x830f('0x2'));var rs=require(_0x830f('0x3'));var fs=require('fs');var Redis=require(_0x830f('0x4'));var db=require(_0x830f('0x5'))['db'];var utils=require(_0x830f('0x6'));var logger=require('../../config/logger')(_0x830f('0x7'));var config=require(_0x830f('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x830f('0x9')][_0x830f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xee0059,_0xe3f5b0,_0x2f6454){return new BPromise(function(_0x22cf69,_0x22e472){return client[_0x830f('0xb')](_0xee0059,_0x2f6454)[_0x830f('0xc')](function(_0x225063){logger[_0x830f('0xd')]('MailApplication,\x20%s,\x20%s',_0xe3f5b0,_0x830f('0xe'));logger[_0x830f('0xf')](_0x830f('0x10'),_0xe3f5b0,'request\x20sent',JSON[_0x830f('0x11')](_0x225063));if(_0x225063[_0x830f('0x12')]){if(_0x225063['error']['code']===0x1f4){logger[_0x830f('0x12')]('MailApplication,\x20%s,\x20%s',_0xe3f5b0,_0x225063[_0x830f('0x12')][_0x830f('0x13')]);return _0x22e472(_0x225063['error'][_0x830f('0x13')]);}logger['error'](_0x830f('0x14'),_0xe3f5b0,_0x225063['error'][_0x830f('0x13')]);return _0x22cf69(_0x225063[_0x830f('0x12')][_0x830f('0x13')]);}else{logger[_0x830f('0xd')](_0x830f('0x14'),_0xe3f5b0,_0x830f('0xe'));_0x22cf69(_0x225063[_0x830f('0x15')][_0x830f('0x13')]);}})[_0x830f('0x16')](function(_0x24dc9e){logger[_0x830f('0x12')](_0x830f('0x14'),_0xe3f5b0,_0x24dc9e);_0x22e472(_0x24dc9e);});});}exports[_0x830f('0x17')]=function(_0x9ea67){var _0x3208eb=this;return new Promise(function(_0x28b5fc,_0x2bea56){return db[_0x830f('0x18')][_0x830f('0x19')](_0x9ea67[_0x830f('0x1a')],{'raw':_0x9ea67[_0x830f('0x1b')]?_0x9ea67[_0x830f('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x9ea67[_0x830f('0x1b')]?_0x9ea67[_0x830f('0x1b')]['where']||null:null,'attributes':_0x9ea67['options']?_0x9ea67[_0x830f('0x1b')]['attributes']||null:null,'limit':_0x9ea67[_0x830f('0x1b')]?_0x9ea67[_0x830f('0x1b')][_0x830f('0x1c')]||null:null})[_0x830f('0xc')](function(_0x3a6d1f){logger[_0x830f('0xd')](_0x830f('0x17'),_0x9ea67);logger['debug'](_0x830f('0x17'),_0x9ea67,JSON[_0x830f('0x11')](_0x3a6d1f));_0x28b5fc(_0x3a6d1f);})[_0x830f('0x16')](function(_0x330531){logger['error'](_0x830f('0x17'),_0x330531[_0x830f('0x13')],_0x9ea67);_0x2bea56(_0x3208eb['error'](0x1f4,_0x330531['message']));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index cfa7f3c..ceb8cc5 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 _0xb87c=['../../components/interaction/service','get','isAuthenticated','index','/describe','/:id','show','getMessages','/:id/download','download','create','post','/:id/messages','addMessage','mail','addTags','mailinteraction:update','delete','tracked','mailinteraction:destroy','destroy','/:id/tags','removeTags','util','path','connect-timeout','express','Router'];(function(_0x4394b6,_0x12357f){var _0x360244=function(_0x5689a1){while(--_0x5689a1){_0x4394b6['push'](_0x4394b6['shift']());}};_0x360244(++_0x12357f);}(_0xb87c,0x1d7));var _0xcb87=function(_0x4bbeb6,_0xd51477){_0x4bbeb6=_0x4bbeb6-0x0;var _0x1932b1=_0xb87c[_0x4bbeb6];return _0x1932b1;};'use strict';var multer=require('multer');var util=require(_0xcb87('0x0'));var path=require(_0xcb87('0x1'));var timeout=require(_0xcb87('0x2'));var express=require(_0xcb87('0x3'));var router=express[_0xcb87('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xcb87('0x5'));var config=require('../../config/environment');var controller=require('./mailInteraction.controller');router[_0xcb87('0x6')]('/',auth[_0xcb87('0x7')](),controller[_0xcb87('0x8')]);router[_0xcb87('0x6')](_0xcb87('0x9'),auth[_0xcb87('0x7')](),controller['describe']);router[_0xcb87('0x6')](_0xcb87('0xa'),auth[_0xcb87('0x7')](),controller[_0xcb87('0xb')]);router[_0xcb87('0x6')]('/:id/messages',auth[_0xcb87('0x7')](),controller[_0xcb87('0xc')]);router[_0xcb87('0x6')](_0xcb87('0xd'),auth[_0xcb87('0x7')](),controller[_0xcb87('0xe')]);router['post']('/',auth[_0xcb87('0x7')](),controller[_0xcb87('0xf')]);router[_0xcb87('0x10')](_0xcb87('0x11'),auth['isAuthenticated'](),controller[_0xcb87('0x12')]);router[_0xcb87('0x10')]('/:id/tags',auth[_0xcb87('0x7')](),interaction['tracked'](_0xcb87('0x13'),'mailinteraction:addtags'),controller[_0xcb87('0x14')]);router['put']('/:id',auth[_0xcb87('0x7')](),interaction['tracked'](_0xcb87('0x13'),_0xcb87('0x15')),controller['update']);router[_0xcb87('0x16')](_0xcb87('0xa'),auth[_0xcb87('0x7')](),interaction[_0xcb87('0x17')]('mail',_0xcb87('0x18')),controller[_0xcb87('0x19')]);router[_0xcb87('0x16')](_0xcb87('0x1a'),auth[_0xcb87('0x7')](),controller[_0xcb87('0x1b')]);module['exports']=router; \ No newline at end of file +var _0x0ae1=['util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','post','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','/:id','update','delete','mailinteraction:destroy','removeTags','exports','multer'];(function(_0x3c79bb,_0x5380b8){var _0x49d7d9=function(_0x4bfee7){while(--_0x4bfee7){_0x3c79bb['push'](_0x3c79bb['shift']());}};_0x49d7d9(++_0x5380b8);}(_0x0ae1,0x167));var _0x10ae=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0ae1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x10ae('0x0'));var util=require(_0x10ae('0x1'));var path=require(_0x10ae('0x2'));var timeout=require(_0x10ae('0x3'));var express=require('express');var router=express[_0x10ae('0x4')]();var auth=require(_0x10ae('0x5'));var interaction=require(_0x10ae('0x6'));var config=require(_0x10ae('0x7'));var controller=require(_0x10ae('0x8'));router[_0x10ae('0x9')]('/',auth[_0x10ae('0xa')](),controller['index']);router[_0x10ae('0x9')](_0x10ae('0xb'),auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth['isAuthenticated'](),controller[_0x10ae('0xc')]);router[_0x10ae('0x9')](_0x10ae('0xd'),auth[_0x10ae('0xa')](),controller[_0x10ae('0xe')]);router['get'](_0x10ae('0xf'),auth[_0x10ae('0xa')](),controller['download']);router[_0x10ae('0x10')]('/',auth[_0x10ae('0xa')](),controller['create']);router['post'](_0x10ae('0xd'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x11')]);router[_0x10ae('0x10')](_0x10ae('0x12'),auth[_0x10ae('0xa')](),interaction[_0x10ae('0x13')](_0x10ae('0x14'),_0x10ae('0x15')),controller[_0x10ae('0x16')]);router[_0x10ae('0x17')](_0x10ae('0x18'),auth['isAuthenticated'](),interaction['tracked'](_0x10ae('0x14'),'mailinteraction:update'),controller[_0x10ae('0x19')]);router[_0x10ae('0x1a')](_0x10ae('0x18'),auth[_0x10ae('0xa')](),interaction[_0x10ae('0x13')](_0x10ae('0x14'),_0x10ae('0x1b')),controller['destroy']);router[_0x10ae('0x1a')](_0x10ae('0x12'),auth[_0x10ae('0xa')](),controller[_0x10ae('0x1c')]);module[_0x10ae('0x1d')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 902bfcd..8df7dc4 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 _0xb093=['TEXT','ENUM','out','long','iconv','exports','BOOLEAN','DATE','STRING'];(function(_0x2b794b,_0x2a76e8){var _0x5e4d12=function(_0x14c3cb){while(--_0x14c3cb){_0x2b794b['push'](_0x2b794b['shift']());}};_0x5e4d12(++_0x2a76e8);}(_0xb093,0x109));var _0x3b09=function(_0x46001d,_0x4a1ab6){_0x46001d=_0x46001d-0x0;var _0x57cb00=_0xb093[_0x46001d];return _0x57cb00;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0x3b09('0x0'));module[_0x3b09('0x1')]={'closed':{'type':Sequelize[_0x3b09('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x3b09('0x3')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3b09('0x4')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x3b09('0x4')]},'cc':{'type':Sequelize['TEXT']('long')},'subject':{'type':Sequelize[_0x3b09('0x5')]()},'attach':{'type':Sequelize[_0x3b09('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x3b09('0x4')](0x3c)},'substatusAt':{'type':Sequelize[_0x3b09('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3b09('0x6')]('in',_0x3b09('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3b09('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x3b09('0x6')]('in',_0x3b09('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x3b09('0x5')]('long')},'lastMsgText':{'type':Sequelize[_0x3b09('0x5')](_0x3b09('0x8'))}}; \ No newline at end of file +var _0x43c5=['DATE','STRING','TEXT','long','ENUM','out','sequelize','iconv','exports','BOOLEAN'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x43c5,0xd8));var _0x543c=function(_0x483097,_0xd8ff26){_0x483097=_0x483097-0x0;var _0x5a5e58=_0x43c5[_0x483097];return _0x5a5e58;};'use strict';var Sequelize=require(_0x543c('0x0'));var iconv=require(_0x543c('0x1'));module[_0x543c('0x2')]={'closed':{'type':Sequelize[_0x543c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x543c('0x4')]},'disposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x543c('0x5')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x543c('0x5')]},'cc':{'type':Sequelize[_0x543c('0x6')](_0x543c('0x7'))},'subject':{'type':Sequelize[_0x543c('0x6')]()},'attach':{'type':Sequelize[_0x543c('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x543c('0x4')]},'substatus':{'type':Sequelize[_0x543c('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0x543c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x543c('0x8')]('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x543c('0x8')]('in',_0x543c('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgBody':{'type':Sequelize[_0x543c('0x6')](_0x543c('0x7'))},'lastMsgText':{'type':Sequelize[_0x543c('0x6')](_0x543c('0x7'))}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 71fda2c..1ebe31e 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 _0x406c=['../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','status','count','offset','limit','set','json','apply','save','update','then','destroy','end','sendStatus','error','name','send','Users','map','TagIds','Tags','split','forEach','push','MailInteraction','findOne','lastMsgBody','lastMsgText','trimStart','fromString','catch','index','rawAttributes','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','select','field','tools_tags','u.fullname','ui.MailInteractionId','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','from','mail_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.MailAccountId','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','length','conditions','find','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','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.disposition','i.to','i.ContactId','i.MailAccountId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','c.mobile','Contact.mobile','Contact.fax','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','Setting','enableEmailPreview','all','show','params','includeAll','include','create','body','describe','addMessage','MailMessage','ids','getMessages','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags','setTags','color','removeTags','download','unix','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','Attachment','Messages','bcc','subject','get','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','basename','existsSync','readFileSync','build','writeFileSync','message%d.eml','log','err','html-pdf','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x406c,0xda));var _0xc406=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x406c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc406('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xc406('0x1'));var zipdir=require(_0xc406('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xc406('0x3'));var moment=require(_0xc406('0x4'));var BPromise=require(_0xc406('0x5'));var Mustache=require(_0xc406('0x6'));var util=require('util');var path=require(_0xc406('0x7'));var sox=require(_0xc406('0x8'));var csv=require(_0xc406('0x9'));var ejs=require(_0xc406('0xa'));var fs=require('fs');var _=require(_0xc406('0xb'));var squel=require(_0xc406('0xc'));var crypto=require(_0xc406('0xd'));var jsforce=require(_0xc406('0xe'));var deskjs=require(_0xc406('0xf'));var toCsv=require('to-csv');var querystring=require(_0xc406('0x10'));var Papa=require(_0xc406('0x11'));var htmlToText=require(_0xc406('0x12'));var Redis=require(_0xc406('0x13'));var authService=require(_0xc406('0x14'));var qs=require(_0xc406('0x15'));var as=require(_0xc406('0x16'));var hardwareService=require(_0xc406('0x17'));var logger=require(_0xc406('0x18'))(_0xc406('0x19'));var utils=require(_0xc406('0x1a'));var config=require(_0xc406('0x1b'));var db=require(_0xc406('0x1c'))['db'];config['redis']=_[_0xc406('0x1d')](config[_0xc406('0x1e')],{'host':_0xc406('0x1f'),'port':0x18eb});var socket=require(_0xc406('0x20'))(new Redis(config[_0xc406('0x1e')]));require(_0xc406('0x21'))[_0xc406('0x22')](socket);function respondWithStatusCode(_0x394d94,_0x5c7009){_0x5c7009=_0x5c7009||0xcc;return function(_0x170801){if(_0x170801){return _0x394d94['sendStatus'](_0x5c7009);}return _0x394d94['status'](_0x5c7009)['end']();};}function respondWithResult(_0x434b2a,_0x51f56b){_0x51f56b=_0x51f56b||0xc8;return function(_0x4a545f){if(_0x4a545f){return _0x434b2a[_0xc406('0x23')](_0x51f56b)['json'](_0x4a545f);}};}function respondWithFilteredResult(_0x55a600,_0xa2b8fb){return function(_0x268df0){if(_0x268df0){var _0x21867c=_0x268df0[_0xc406('0x24')],_0x37e8ed=_0xa2b8fb['offset'],_0x11fced=_0xa2b8fb[_0xc406('0x25')]+_0xa2b8fb[_0xc406('0x26')],_0x2776fc;if(_0x11fced>=_0x21867c){_0x11fced=_0x21867c;_0x2776fc=0xc8;}else{_0x2776fc=0xce;}_0x55a600[_0xc406('0x23')](_0x2776fc);return _0x55a600[_0xc406('0x27')]('Content-Range',_0x37e8ed+'-'+_0x11fced+'/'+_0x21867c)[_0xc406('0x28')](_0x268df0);}return null;};}function patchUpdates(_0x3e1a59){return function(_0x5a6be6){try{jsonpatch[_0xc406('0x29')](_0x5a6be6,_0x3e1a59,!![]);}catch(_0x5571e8){return BPromise['reject'](_0x5571e8);}return _0x5a6be6[_0xc406('0x2a')]();};}function saveUpdates(_0x3e5bd5,_0x13fe66){return function(_0x5d5be5){if(_0x5d5be5){return _0x5d5be5[_0xc406('0x2b')](_0x3e5bd5)[_0xc406('0x2c')](function(_0x4cf41f){return _0x4cf41f;});}return null;};}function removeEntity(_0x2fc366,_0x1a0bb5){return function(_0x43594e){if(_0x43594e){return _0x43594e[_0xc406('0x2d')]()['then'](function(){_0x2fc366[_0xc406('0x23')](0xcc)[_0xc406('0x2e')]();});}};}function handleEntityNotFound(_0x37360e,_0x2f1d18){return function(_0x422b55){if(!_0x422b55){_0x37360e[_0xc406('0x2f')](0x194);}return _0x422b55;};}function handleError(_0x3a81b3,_0x19b70d){_0x19b70d=_0x19b70d||0x1f4;return function(_0x199e09){logger[_0xc406('0x30')](_0x199e09['stack']);if(_0x199e09[_0xc406('0x31')]){delete _0x199e09[_0xc406('0x31')];}_0x3a81b3[_0xc406('0x23')](_0x19b70d)[_0xc406('0x32')](_0x199e09);};}function getInteractionUsers(_0x9074a4,_0x5a1766){return new BPromise(function(_0x55033b,_0x3d7744){try{if(_0x5a1766[_0x9074a4['id']]){_0x9074a4[_0xc406('0x33')]=_[_0xc406('0x34')](_0x5a1766[_0x9074a4['id']],function(_0xa4a4fa){return{'id':_0xa4a4fa['id'],'fullname':_0xa4a4fa['fullname']};});}}catch(_0x39300a){_0x3d7744(_0x39300a);}_0x55033b(_0x9074a4);});}function getInteractionTags(_0x274a99,_0x6baea4){return new BPromise(function(_0x8208c2,_0x377d4a){try{if(_0x274a99[_0xc406('0x35')]){_0x274a99[_0xc406('0x36')]=[];_0x274a99[_0xc406('0x35')][_0xc406('0x37')](',')[_0xc406('0x38')](function(_0xd637d4){_0x274a99[_0xc406('0x36')][_0xc406('0x39')](_0x6baea4[_0xd637d4]);});}delete _0x274a99[_0xc406('0x35')];}catch(_0x5e9e70){_0x377d4a(_0x5e9e70);}_0x8208c2(_0x274a99);});}function getLastMessageText(_0x25e309){return new BPromise(function(_0x242d74,_0x2ca868){return db[_0xc406('0x3a')][_0xc406('0x3b')]({'where':{'id':_0x25e309['id']},'attributes':[_0xc406('0x3c'),_0xc406('0x3d')],'raw':!![]})[_0xc406('0x2c')](function(_0x270c8f){if(!_0x270c8f['lastMsgText']){_0x25e309[_0xc406('0x3d')]=_[_0xc406('0x3e')](htmlToText[_0xc406('0x3f')](_0x270c8f['lastMsgBody'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x25e309[_0xc406('0x3d')]=_0x270c8f[_0xc406('0x3d')];}_0x242d74(_0x25e309);})[_0xc406('0x40')](function(_0x129a48){_0x2ca868(_0x129a48);});});}function updateMailInteraction(_0x358426,_0x45ea08,_0x39e3d2,_0x50c90d){return new BPromise(function(_0x31dde2,_0x3faf76){return getInteractionUsers(_0x358426,_0x39e3d2)['then'](function(_0x587fb3){return getInteractionTags(_0x587fb3,_0x45ea08);})[_0xc406('0x2c')](function(_0x583f55){if(_0x50c90d){_0x31dde2(getLastMessageText(_0x583f55));}else{_0x31dde2(_0x583f55);}})[_0xc406('0x40')](function(_0x48cc34){_0x3faf76(_0x48cc34);});});}exports[_0xc406('0x41')]=function(_0x1a7b72,_0x2bfc35){var _0x3fa6c3={},_0x2b1d3d={},_0x46981d={'count':0x0,'rows':[]};var _0x37dea5=_[_0xc406('0x34')](db[_0xc406('0x3a')][_0xc406('0x42')],function(_0x1cde6d){return{'name':_0x1cde6d['fieldName'],'type':_0x1cde6d[_0xc406('0x43')][_0xc406('0x44')]};});_0x2b1d3d[_0xc406('0x45')]=_[_0xc406('0x34')](_0x37dea5,'name');_0x2b1d3d['query']=_[_0xc406('0x46')](_0x1a7b72[_0xc406('0x47')]);_0x2b1d3d['filters']=_[_0xc406('0x48')](_0x2b1d3d[_0xc406('0x45')],_0x2b1d3d[_0xc406('0x47')]);_0x3fa6c3[_0xc406('0x49')]=_[_0xc406('0x48')](_0x2b1d3d['model'],qs[_0xc406('0x4a')](_0x1a7b72['query']['fields']));_0x3fa6c3[_0xc406('0x49')]=_0x3fa6c3[_0xc406('0x49')]['length']?_0x3fa6c3['attributes']:_0x2b1d3d[_0xc406('0x45')];if(!_0x1a7b72[_0xc406('0x47')][_0xc406('0x4b')](_0xc406('0x4c'))){_0x3fa6c3[_0xc406('0x26')]=qs[_0xc406('0x26')](_0x1a7b72[_0xc406('0x47')][_0xc406('0x26')]);_0x3fa6c3[_0xc406('0x25')]=qs[_0xc406('0x25')](_0x1a7b72[_0xc406('0x47')][_0xc406('0x25')]);}_0x3fa6c3[_0xc406('0x4d')]=qs[_0xc406('0x4e')](_0x1a7b72['query'][_0xc406('0x4e')]);_0x3fa6c3[_0xc406('0x4f')]=qs['filters'](_['pick'](_0x1a7b72[_0xc406('0x47')],_0x2b1d3d[_0xc406('0x50')]));var _0x4939b9=[];var _0x3f0146=squel[_0xc406('0x51')]()[_0xc406('0x52')]('id')[_0xc406('0x52')](_0xc406('0x31'))[_0xc406('0x52')]('color')['from'](_0xc406('0x53'));var _0x3864e2=squel['select']()[_0xc406('0x52')]('u.id')[_0xc406('0x52')](_0xc406('0x54'))[_0xc406('0x52')](_0xc406('0x55'))['from'](_0xc406('0x56'),'ui')[_0xc406('0x57')](_0xc406('0x58'),'u',_0xc406('0x59'));var _0x5dec68=squel[_0xc406('0x51')]()[_0xc406('0x5a')](_0xc406('0x5b'),'i')[_0xc406('0x57')](_0xc406('0x5c'),'c',_0xc406('0x5d'))['left_join']('users','o',_0xc406('0x5e'))[_0xc406('0x57')]('mail_accounts','a',_0xc406('0x5f'))[_0xc406('0x57')](_0xc406('0x60'),'me',_0xc406('0x61'))[_0xc406('0x57')]('mail_interaction_has_tags','it',_0xc406('0x62'))['left_join']('tools_tags','t',_0xc406('0x63'));var _0x50e0eb=squel[_0xc406('0x64')]();var _0x3e708d=[];var _0xdeee3e=squel['expr']();var _0x2df25d;if(_0x1a7b72[_0xc406('0x47')][_0xc406('0x65')]){_0x2df25d=as[_0xc406('0x66')](_0x1a7b72[_0xc406('0x47')]['search']);var _0x2e5613=_0x2df25d['sqlOperator'];for(var _0x144fe9=0x0;_0x144fe9<_0x2df25d['conditions'][_0xc406('0x67')];_0x144fe9++){var _0x56d770=_0x2df25d[_0xc406('0x68')][_0x144fe9];var _0x2c3daf='i';var _0x17a961=_[_0xc406('0x69')](_0x37dea5,[_0xc406('0x31'),_0x56d770[_0xc406('0x52')]]);if(!_0x17a961){switch(_0x56d770[_0xc406('0x52')]){case _0xc406('0x6a'):if(_0x56d770['value']==0x1){_0x5dec68[_0xc406('0x6b')]('`'+_0x56d770['field']+_0xc406('0x6c'));}else{_0x5dec68[_0xc406('0x6b')]('`'+_0x56d770['field']+_0xc406('0x6d'));}break;case _0xc406('0x6e'):if(_0x56d770[_0xc406('0x6f')]==='$substring'){if(_0x56d770[_0xc406('0x70')][_0xc406('0x37')]('\x20')[_0xc406('0x67')]>0x1){_0x50e0eb[_0x2e5613](_0xc406('0x71'),qs[_0xc406('0x72')](_0x56d770[_0xc406('0x70')]),null);}else{var _0x11decd='%'+_0x56d770[_0xc406('0x70')]+'%';_0x50e0eb[_0x2e5613](_0xc406('0x73'),_0x11decd,_0x11decd,_0x11decd);}}else{_0x17a961=_[_0xc406('0x69')](_0x37dea5,[_0xc406('0x31'),_0xc406('0x74')]);_0x56d770['field']=_0xc406('0x74');_0x3372c7=as['buildExpression'](_0x2c3daf,_0x17a961['type'],_0x56d770);_0x50e0eb[_0x2e5613](_0x3372c7[_0xc406('0x75')],_0x3372c7[_0xc406('0x70')][_0xc406('0x76')],_0x3372c7['value']['end']);}break;case _0xc406('0x77'):var _0xace473=_0x56d770[_0xc406('0x70')]['split'](',')[_0xc406('0x34')](function(_0x149217){return Number(_0x149217);});_0xace473[_0xc406('0x38')](function(_0x4b9f9c){_0xdeee3e['or'](_0xc406('0x78'),'%,'+_0x4b9f9c+',%');});_0x3e708d=_[_0xc406('0x79')](_0x3e708d,_0xace473);break;case _0xc406('0x7a'):if(_0x56d770[_0xc406('0x6f')]===_0xc406('0x7b')){_0x50e0eb[_0x2e5613](_0xc406('0x7c'),'%'+_0x56d770[_0xc406('0x70')]+'%',null);}else{_0x17a961=_[_0xc406('0x69')](_0x37dea5,[_0xc406('0x31'),_0xc406('0x7d')]);_0x56d770[_0xc406('0x52')]='UserId';_0x3372c7=as[_0xc406('0x7e')](_0x2c3daf,_0x17a961[_0xc406('0x43')],_0x56d770);_0x50e0eb[_0x2e5613](_0x3372c7[_0xc406('0x75')],_0x3372c7[_0xc406('0x70')][_0xc406('0x76')],_0x3372c7[_0xc406('0x70')]['end']);}break;case _0xc406('0x7f'):_0x3372c7=as['buildExpression']('me',null,_0x56d770);_0x50e0eb[_0x2e5613](_0x3372c7[_0xc406('0x75')],_0x3372c7['value'][_0xc406('0x76')],_0x3372c7[_0xc406('0x70')]['end']);break;}}else{var _0x3372c7=as[_0xc406('0x7e')](_0x2c3daf,_0x17a961[_0xc406('0x43')],_0x56d770);_0x50e0eb[_0x2e5613](_0x3372c7['text'],_0x3372c7[_0xc406('0x70')]['start'],_0x3372c7[_0xc406('0x70')]['end']);}}}else{var _0x46bbf3=_(_0x1a7b72[_0xc406('0x47')])[_0xc406('0x46')]()['map'](function(_0x202e65){return _[_0xc406('0x80')](_0x37dea5,[_0xc406('0x31'),_0x202e65])?_0x202e65:undefined;})[_0xc406('0x81')]()[_0xc406('0x70')]();if(!_[_0xc406('0x82')](_0x46bbf3)){_0x46bbf3[_0xc406('0x38')](function(_0x407bca){if(_0x407bca===_0xc406('0x83')){_0x5dec68['where'](_0xc406('0x84'),[]['concat'](_0x1a7b72[_0xc406('0x47')][_0x407bca]));}else if(_0x407bca===_0xc406('0x85')){var _0x4f6a76=JSON['parse'](_0x1a7b72[_0xc406('0x47')][_0x407bca])[_0xc406('0x86')];var _0x42ee9a=JSON['parse'](_0x1a7b72['query'][_0x407bca])[_0xc406('0x87')];_0x5dec68['where'](_0xc406('0x88'),_0x4f6a76,_0x42ee9a);}else{if(_0x1a7b72['query'][_0x407bca]===_0xc406('0x89')){_0x5dec68[_0xc406('0x4f')]('i.'+_0x407bca+'\x20IS\x20NULL');}else{_0x5dec68[_0xc406('0x4f')]('i.'+_0x407bca+_0xc406('0x8a'),_0x1a7b72[_0xc406('0x47')][_0x407bca]);}}});}if(_0x1a7b72[_0xc406('0x47')][_0xc406('0x8b')]){if(_0x1a7b72[_0xc406('0x47')][_0xc406('0x8b')]==0x1){_0x5dec68[_0xc406('0x6b')](_0xc406('0x8c'));}else{_0x5dec68[_0xc406('0x6b')](_0xc406('0x8d'));}}if(_0x1a7b72[_0xc406('0x47')]['tag']){_0x3e708d=_[_0xc406('0x8e')](_0x1a7b72[_0xc406('0x47')][_0xc406('0x8f')])?_0x1a7b72[_0xc406('0x47')][_0xc406('0x8f')]:new Array(_0x1a7b72['query'][_0xc406('0x8f')]);_0x3e708d['forEach'](function(_0x4423d0){_0xdeee3e['or'](_0xc406('0x78'),'%,'+_0x4423d0+',%');});}if(_0x1a7b72[_0xc406('0x47')][_0xc406('0x90')]){var _0x465fe3=_0x1a7b72['query'][_0xc406('0x90')][_0xc406('0x91')]('\x5c','\x5c\x5c')[_0xc406('0x91')]('\x27\x27',_0xc406('0x92'));if(qs['isNumeric'](_0x465fe3)){_0x50e0eb['or'](_0xc406('0x93'),_0x465fe3+'%');}else if(qs[_0xc406('0x94')](_0x465fe3)){_0x50e0eb['or'](_0xc406('0x95'),_0x465fe3+'%');}else{_0x50e0eb['or'](_0xc406('0x96'),qs[_0xc406('0x72')](_0x465fe3))['or'](_0xc406('0x97'),qs['getFullTextValue'](_0x465fe3));}}}_0x5dec68[_0xc406('0x4f')](_0x50e0eb);_0x5dec68[_0xc406('0x98')](_0xc406('0x99'));var _0x592d3b={'type':db[_0xc406('0x9a')][_0xc406('0x9b')][_0xc406('0x9c')],'raw':!![]};var _0x281baf=_0x5dec68[_0xc406('0x9d')]();_0x281baf[_0xc406('0x52')]('i.id');_0x281baf[_0xc406('0x52')](_0xc406('0x9e'),_0xc406('0x6a'));if(_0x3fa6c3[_0xc406('0x4d')]){_0x3fa6c3[_0xc406('0x4d')][_0xc406('0x38')](function(_0x5826f2){_0x5dec68[_0xc406('0x4d')]('i.'+_0x5826f2[0x0],_0x5826f2[0x1]===_0xc406('0x9f')?![]:!![]);});}if(!_[_0xc406('0x82')](_0x3e708d)){_0x5dec68[_0xc406('0x6b')](_0xdeee3e);_0x281baf[_0xc406('0x4f')]('t.id\x20IN\x20?',_0x3e708d);}BPromise['resolve']()[_0xc406('0x2c')](function(){if(!_0x2df25d){if(_0x1a7b72[_0xc406('0x47')][_0xc406('0x83')]||_0x1a7b72[_0xc406('0x47')][_0xc406('0xa0')])return;_0x281baf[_0xc406('0x4f')](_0xc406('0xa1'));_0x5dec68[_0xc406('0x4f')](_0xc406('0xa1'));return;}return _0x1a7b72[_0xc406('0xa2')][_0xc406('0xa3')]({'attributes':['id'],'raw':!![]})[_0xc406('0x2c')](function(_0x3929da){if(_[_0xc406('0x82')](_0x3929da)){_0x281baf[_0xc406('0x4f')](_0xc406('0xa4'));_0x5dec68[_0xc406('0x4f')](_0xc406('0xa4'));}else{_0x281baf['where']('i.MailAccountId\x20IN\x20?',_[_0xc406('0x34')](_0x3929da,'id'));_0x5dec68['where']('i.MailAccountId\x20IN\x20?',_['map'](_0x3929da,'id'));}});})[_0xc406('0x2c')](function(){db[_0xc406('0xa5')][_0xc406('0x47')](_0x281baf[_0xc406('0xa6')](),_0x592d3b)[_0xc406('0x2c')](function(_0x57e35a){_0x46981d[_0xc406('0x24')]=_0x57e35a[_0xc406('0x67')];if(_0x46981d[_0xc406('0x24')]===0x0)return[];return db[_0xc406('0xa5')][_0xc406('0x47')](_0x3f0146['toString'](),_0x592d3b)[_0xc406('0x2c')](function(_0x81ebfc){_0x4939b9=_[_0xc406('0xa7')](_0x81ebfc,'id');_0x592d3b=_[_0xc406('0xa8')](_0x592d3b,{'model':db[_0xc406('0x3a')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x1a7b72['query']['fields']){_0x3fa6c3['attributes']['forEach'](function(_0x58845d){_0x5dec68[_0xc406('0x52')]('i.'+_0x58845d);});}else{_0x5dec68[_0xc406('0x52')](_0xc406('0x9e'),'unreadMessages');_0x5dec68[_0xc406('0x52')](_0xc406('0xa9'),_0xc406('0xaa'));_0x5dec68[_0xc406('0x52')](_0xc406('0xab'),_0xc406('0xac'));_0x5dec68[_0xc406('0x52')](_0xc406('0x99'));_0x5dec68[_0xc406('0x52')](_0xc406('0xad'));_0x5dec68['field']('i.updatedAt');_0x5dec68[_0xc406('0x52')](_0xc406('0xae'));_0x5dec68[_0xc406('0x52')](_0xc406('0xaf'));_0x5dec68[_0xc406('0x52')](_0xc406('0xb0'));_0x5dec68[_0xc406('0x52')](_0xc406('0xb1'));_0x5dec68[_0xc406('0x52')](_0xc406('0xb2'));_0x5dec68[_0xc406('0x52')]('i.subject');_0x5dec68[_0xc406('0x52')](_0xc406('0xb3'));_0x5dec68[_0xc406('0x52')]('i.substatus');_0x5dec68[_0xc406('0x52')](_0xc406('0xb4'));_0x5dec68[_0xc406('0x52')](_0xc406('0xb5'));_0x5dec68[_0xc406('0x52')](_0xc406('0xb6'));_0x5dec68['field']('i.UserId');_0x5dec68[_0xc406('0x52')]('c.firstName',_0xc406('0xb7'));_0x5dec68['field'](_0xc406('0xb8'),_0xc406('0xb9'));_0x5dec68['field'](_0xc406('0xba'),_0xc406('0xbb'));_0x5dec68[_0xc406('0x52')](_0xc406('0xbc'),'Contact.phone');_0x5dec68[_0xc406('0x52')](_0xc406('0xbd'),_0xc406('0xbe'));_0x5dec68[_0xc406('0x52')]('c.fax',_0xc406('0xbf'));_0x5dec68[_0xc406('0x52')]('o.fullname',_0xc406('0xc0'));_0x5dec68[_0xc406('0x52')](_0xc406('0xc1'),_0xc406('0xc2'));_0x5dec68[_0xc406('0x52')](_0xc406('0xc3'),'TagIds');}_0x5dec68['limit'](_0x3fa6c3['limit']);_0x5dec68['offset'](_0x3fa6c3[_0xc406('0x25')]);return db[_0xc406('0xa5')][_0xc406('0x47')](_0x5dec68['toString'](),_0x592d3b);})[_0xc406('0x2c')](function(_0x15f6cd){_0x3864e2[_0xc406('0x4f')]('ui.MailInteractionId\x20IN\x20?',_[_0xc406('0x34')](_0x15f6cd,'id'));return db[_0xc406('0xa5')][_0xc406('0x47')](_0x3864e2[_0xc406('0xa6')](),_0x592d3b)[_0xc406('0x2c')](function(_0x253482){var _0x4653e4=_[_0xc406('0xc4')](_0x253482,'MailInteractionId');var _0x26cd7d=[];return db[_0xc406('0xc5')][_0xc406('0x3b')]({'attributes':['enableEmailPreview'],'raw':!![]})['then'](function(_0x3bd820){var _0x1c1c39=_0x3bd820[_0xc406('0xc6')];_0x15f6cd['forEach'](function(_0x6aa998){_0x26cd7d[_0xc406('0x39')](updateMailInteraction(_0x6aa998,_0x4939b9,_0x4653e4,_0x1c1c39));});return BPromise[_0xc406('0xc7')](_0x26cd7d);});});});})[_0xc406('0x2c')](function(_0x3c641f){_0x46981d['rows']=_0x3c641f;return _0x46981d;})[_0xc406('0x2c')](respondWithFilteredResult(_0x2bfc35,_0x3fa6c3));})[_0xc406('0x40')](handleError(_0x2bfc35,null));};exports[_0xc406('0xc8')]=function(_0x22c07f,_0x59cbf3){var _0x3330ea={'raw':![],'where':{'id':_0x22c07f[_0xc406('0xc9')]['id']}},_0x45da6c={};_0x45da6c['model']=_[_0xc406('0x46')](db[_0xc406('0x3a')][_0xc406('0x42')]);_0x45da6c[_0xc406('0x47')]=_[_0xc406('0x46')](_0x22c07f[_0xc406('0x47')]);_0x45da6c[_0xc406('0x50')]=_['intersection'](_0x45da6c['model'],_0x45da6c[_0xc406('0x47')]);_0x3330ea[_0xc406('0x49')]=_[_0xc406('0x48')](_0x45da6c[_0xc406('0x45')],qs[_0xc406('0x4a')](_0x22c07f[_0xc406('0x47')]['fields']));_0x3330ea[_0xc406('0x49')]=_0x3330ea[_0xc406('0x49')][_0xc406('0x67')]?_0x3330ea[_0xc406('0x49')]:_0x45da6c[_0xc406('0x45')];if(_0x22c07f['query'][_0xc406('0xca')]){_0x3330ea[_0xc406('0xcb')]=[{'all':!![]}];}_0x3330ea=_['merge']({},_0x3330ea,_0x22c07f['options']);return db[_0xc406('0x3a')][_0xc406('0x69')](_0x3330ea)[_0xc406('0x2c')](handleEntityNotFound(_0x59cbf3,null))['then'](respondWithResult(_0x59cbf3,null))[_0xc406('0x40')](handleError(_0x59cbf3,null));};exports['create']=function(_0x21025a,_0x39ede9){return db[_0xc406('0x3a')][_0xc406('0xcc')](_0x21025a[_0xc406('0xcd')],{})[_0xc406('0x2c')](respondWithResult(_0x39ede9,0xc9))[_0xc406('0x40')](handleError(_0x39ede9,null));};exports[_0xc406('0x2b')]=function(_0x4319a8,_0x1e479b){if(_0x4319a8[_0xc406('0xcd')]['id']){delete _0x4319a8['body']['id'];}return db['MailInteraction'][_0xc406('0x69')]({'where':{'id':_0x4319a8[_0xc406('0xc9')]['id']}})['then'](handleEntityNotFound(_0x1e479b,null))['then'](saveUpdates(_0x4319a8[_0xc406('0xcd')],null))[_0xc406('0x2c')](respondWithResult(_0x1e479b,null))[_0xc406('0x40')](handleError(_0x1e479b,null));};exports[_0xc406('0x2d')]=function(_0x1a3680,_0x4dcce0){return db[_0xc406('0x3a')][_0xc406('0x69')]({'where':{'id':_0x1a3680['params']['id']}})['then'](handleEntityNotFound(_0x4dcce0,null))[_0xc406('0x2c')](removeEntity(_0x4dcce0,null))['catch'](handleError(_0x4dcce0,null));};exports[_0xc406('0xce')]=function(_0x1cd9b7,_0x50d4ed){return db['MailInteraction'][_0xc406('0xce')]()[_0xc406('0x2c')](respondWithResult(_0x50d4ed,null))[_0xc406('0x40')](handleError(_0x50d4ed,null));};exports[_0xc406('0xcf')]=function(_0x57cea5,_0x3e0056,_0x44e4c5){return db[_0xc406('0xd0')][_0xc406('0x69')]({'where':{'id':_0x57cea5[_0xc406('0xc9')]['id']}})[_0xc406('0x2c')](handleEntityNotFound(_0x3e0056,null))[_0xc406('0x2c')](function(_0x9deefa){if(_0x9deefa){return _0x9deefa[_0xc406('0xcf')](_0x57cea5[_0xc406('0xcd')][_0xc406('0xd1')],_['omit'](_0x57cea5['body'],['ids','id'])||{});}})[_0xc406('0x2c')](respondWithResult(_0x3e0056,null))[_0xc406('0x40')](handleError(_0x3e0056,null));};exports[_0xc406('0xd2')]=function(_0x339c3c,_0x5908a8,_0x1f4e7b){var _0x1dba2c={'raw':![],'where':{}};var _0x7a51f4={};var _0x351f8e={'count':0x0,'rows':[]};return db[_0xc406('0x3a')][_0xc406('0x3b')]({'where':{'id':_0x339c3c[_0xc406('0xc9')]['id']}})[_0xc406('0x2c')](handleEntityNotFound(_0x5908a8,null))[_0xc406('0x2c')](function(_0x11f778){if(_0x11f778){_0x7a51f4[_0xc406('0x45')]=_['keys'](db[_0xc406('0xd0')]['rawAttributes']);_0x7a51f4[_0xc406('0x47')]=_[_0xc406('0x46')](_0x339c3c[_0xc406('0x47')]);_0x7a51f4[_0xc406('0x50')]=_[_0xc406('0x48')](_0x7a51f4[_0xc406('0x45')],_0x7a51f4[_0xc406('0x47')]);_0x1dba2c[_0xc406('0x49')]=_[_0xc406('0x48')](_0x7a51f4[_0xc406('0x45')],qs[_0xc406('0x4a')](_0x339c3c[_0xc406('0x47')]['fields']));_0x1dba2c[_0xc406('0x49')]=_0x1dba2c[_0xc406('0x49')][_0xc406('0x67')]?_0x1dba2c[_0xc406('0x49')]:_0x7a51f4['model'];if(!_0x339c3c['query']['hasOwnProperty'](_0xc406('0x4c'))){_0x1dba2c['limit']=qs[_0xc406('0x26')](_0x339c3c[_0xc406('0x47')][_0xc406('0x26')]);_0x1dba2c[_0xc406('0x25')]=qs[_0xc406('0x25')](_0x339c3c['query'][_0xc406('0x25')]);}_0x1dba2c[_0xc406('0x4d')]=qs[_0xc406('0x4e')](_0x339c3c[_0xc406('0x47')][_0xc406('0x4e')]);_0x1dba2c[_0xc406('0x4f')]=qs[_0xc406('0x50')](_['pick'](_0x339c3c[_0xc406('0x47')],_0x7a51f4[_0xc406('0x50')]));_0x1dba2c[_0xc406('0x4f')]['MailInteractionId']=_0x11f778['id'];if(_0x339c3c[_0xc406('0x47')][_0xc406('0x90')]){_0x1dba2c[_0xc406('0x4f')]=_['merge'](_0x1dba2c[_0xc406('0x4f')],{'$or':_['map'](_0x1dba2c[_0xc406('0x49')],function(_0x4d4005){var _0x13e8a1={};_0x13e8a1[_0x4d4005]={'$like':'%'+_0x339c3c['query'][_0xc406('0x90')]+'%'};return _0x13e8a1;})});}if(_0x339c3c['query'][_0xc406('0x86')]){var _0x3ea7fb=_0x339c3c[_0xc406('0x47')][_0xc406('0x86')][_0xc406('0x37')](',');var _0x342076={};_0x342076[_0x3ea7fb[0x0]]={'$gte':moment(_0x3ea7fb[0x1])[_0xc406('0xd3')](_0xc406('0xd4'))};_0x1dba2c['where']=_[_0xc406('0xa8')](_0x1dba2c[_0xc406('0x4f')],_0x342076);}_0x1dba2c=_[_0xc406('0xa8')]({},_0x1dba2c,_0x339c3c['options']);return db[_0xc406('0xd0')][_0xc406('0x24')]({'where':_0x1dba2c[_0xc406('0x4f')]})[_0xc406('0x2c')](function(_0x2e523c){_0x351f8e['count']=_0x2e523c;if(_0x339c3c[_0xc406('0x47')]['includeAll']){_0x1dba2c[_0xc406('0xcb')]=[{'all':!![]}];}return db[_0xc406('0xd0')][_0xc406('0xd5')](_0x1dba2c);})['then'](function(_0x58eb8a){_0x351f8e[_0xc406('0xd6')]=_0x58eb8a;return _0x351f8e;});}})[_0xc406('0x2c')](respondWithFilteredResult(_0x5908a8,_0x1dba2c))['catch'](handleError(_0x5908a8,null));};exports[_0xc406('0xd7')]=function(_0x1223d9,_0x3eee6a,_0x2ca2ac){return db[_0xc406('0x3a')][_0xc406('0x69')]({'where':{'id':_0x1223d9[_0xc406('0xc9')]['id']}})[_0xc406('0x2c')](handleEntityNotFound(_0x3eee6a,null))[_0xc406('0x2c')](function(_0x9dbaf7){if(_0x9dbaf7){return _0x9dbaf7[_0xc406('0xd8')](_0x1223d9['body'][_0xc406('0xd1')],_['omit'](_0x1223d9[_0xc406('0xcd')],['ids','id'])||{})['spread'](function(){return db['Tag']['findAll']({'attributes':['id',_0xc406('0x31'),_0xc406('0xd9')],'where':{'id':_0x1223d9['body'][_0xc406('0xd1')]}});})['then'](function(_0x1d03e1){socket['emit']('mailInteractionTags:save',{'id':Number(_0x1223d9[_0xc406('0xc9')]['id']),'tags':_0x1d03e1||[]});return{'id':Number(_0x1223d9[_0xc406('0xc9')]['id']),'tags':_0x1d03e1||[]};});}})['then'](respondWithResult(_0x3eee6a,null))['catch'](handleError(_0x3eee6a,null));};exports[_0xc406('0xda')]=function(_0x73fa45,_0x44f299,_0x59f305){return db[_0xc406('0x3a')][_0xc406('0x69')]({'where':{'id':_0x73fa45['params']['id']}})['then'](handleEntityNotFound(_0x44f299,null))['then'](function(_0x2b9377){if(_0x2b9377){return _0x2b9377[_0xc406('0xda')](_0x73fa45['query'][_0xc406('0xd1')]);}})[_0xc406('0x2c')](respondWithStatusCode(_0x44f299,null))[_0xc406('0x40')](handleError(_0x44f299,null));};exports[_0xc406('0xdb')]=function(_0x575adb,_0x494bff){var _0x2205d6=moment()[_0xc406('0xdc')]()[_0xc406('0xa6')]();var _0x256aa0=path[_0xc406('0xdd')](config[_0xc406('0xde')],_0xc406('0xdf'),_0xc406('0xe0'),_0xc406('0xe1'));var _0x39cf3a=path['join'](config[_0xc406('0xde')],_0xc406('0xdf'),_0xc406('0xe0'),_0xc406('0xe2'));var _0x59ad6c=path[_0xc406('0xdd')](_0x256aa0,_0x2205d6);var _0x3954fb=util[_0xc406('0xd3')](_0xc406('0xe3'),_0x575adb[_0xc406('0xc9')]['id'],_0x2205d6);var _0x17aae8=path[_0xc406('0xdd')](_0x256aa0,_0x3954fb);var _0x5c29e3=[];if(_0x575adb[_0xc406('0x47')]['attachments']){_0x5c29e3['push']({'model':db[_0xc406('0xe4')],'as':'Attachments','raw':!![]});}var _0x4d70db=[{'model':db[_0xc406('0xd0')],'as':_0xc406('0xe5'),'attributes':['id',_0xc406('0xcd'),_0xc406('0x5a'),'to','cc',_0xc406('0xe6'),_0xc406('0xe7'),_0xc406('0x85')],'where':{'secret':![]},'order':qs[_0xc406('0x4e')]('id'),'include':_0x5c29e3}];return db[_0xc406('0x3a')][_0xc406('0x69')]({'where':{'id':_0x575adb[_0xc406('0xc9')]['id']},'include':_0x4d70db})['then'](handleEntityNotFound(_0x494bff,null))['then'](function(_0x3a9531){if(_0x3a9531&&_0x3a9531['Messages']){var _0x19602d=_0x3a9531[_0xc406('0xe8')]({'plain':!![]});fs['mkdirSync'](_0x59ad6c);return BPromise[_0xc406('0xe9')](_0x19602d[_0xc406('0xe5')],function(_0xe8a83c,_0x3ca861){var _0x306d47={'from':_0xe8a83c['from'],'to':_0xe8a83c['to'],'subject':_0xe8a83c[_0xc406('0xe7')],'html':_0xe8a83c[_0xc406('0xcd')],'headers':{'Date':moment(_0xe8a83c[_0xc406('0x85')])[_0xc406('0xd3')](_0xc406('0xea'))},'attachments':[]};if(_0xe8a83c['cc']){_0x306d47[_0xc406('0xeb')]['Cc']=_0xe8a83c['cc'];}if(_0xe8a83c[_0xc406('0xe6')]){_0x306d47[_0xc406('0xeb')]['Bcc']=_0xe8a83c[_0xc406('0xe6')];}return new BPromise(function(_0x267e89,_0x5dce0b){if(_0xe8a83c[_0xc406('0xec')]){for(var _0x8818d7=0x0;_0x8818d7<_0xe8a83c[_0xc406('0xec')][_0xc406('0x67')];_0x8818d7++){var _0x488782=_0xe8a83c['Attachments'][_0x8818d7];var _0x243e19=path[_0xc406('0xdd')](_0x39cf3a,_0x488782[_0xc406('0xed')]);if(fs[_0xc406('0xee')](_0x243e19)){_0x306d47[_0xc406('0xe2')][_0xc406('0x39')]({'name':_0x488782[_0xc406('0x31')],'contentType':_0x488782[_0xc406('0x43')],'data':fs[_0xc406('0xef')](_0x243e19)});}}}emlformat[_0xc406('0xf0')](_0x306d47,function(_0x3dcb92,_0x5b368d){if(_0x3dcb92)return _0x5dce0b(_0x3dcb92);fs[_0xc406('0xf1')](path[_0xc406('0xdd')](_0x59ad6c,util[_0xc406('0xd3')](_0xc406('0xf2'),_0x3ca861)),_0x5b368d);return _0x267e89(_0x5b368d);});});})[_0xc406('0x2c')](function(){return new BPromise(function(_0x4a166f,_0x2b5207){zipdir(_0x59ad6c,{'saveTo':_0x17aae8},function(_0x22abdb,_0x299812){if(_0x22abdb)return _0x2b5207(_0x22abdb);return _0x4a166f(_0x299812);});})['then'](function(){return new BPromise(function(_0x2f0a43,_0x978272){rimraf(_0x59ad6c,function(_0x4831b8){if(_0x4831b8)_0x978272(_0x4831b8);return _0x2f0a43();});});})[_0xc406('0x2c')](function(){return _0x494bff[_0xc406('0xdb')](_0x17aae8,_0x3954fb,function(_0x505c65){if(_0x505c65){console[_0xc406('0xf3')](_0xc406('0xf4'),_0x505c65);}else{fs['unlinkSync'](_0x17aae8);}});});});}else{return _0x494bff[_0xc406('0x2f')](0xc8);}})[_0xc406('0x40')](handleError(_0x494bff,null));}; \ No newline at end of file +var _0xcb95=['spread','emit','mailInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','Attachment','Attachments','Messages','bcc','subject','mkdirSync','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','basename','existsSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','Users','map','fullname','TagIds','Tags','split','forEach','MailInteraction','findOne','lastMsgText','trimStart','fromString','lastMsgBody','catch','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','left_join','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','plainBody','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','concat','createdAt','parse','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','i.id','Sequelize','QueryTypes','DESC','t.id\x20IN\x20?','journey','i.MailAccountId\x20IS\x20NOT\x20NULL','user','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.disposition','i.ContactId','i.MailAccountId','i.UserId','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','enableEmailPreview','push','all','show','params','includeAll','include','options','create','body','describe','addMessage','MailMessage','ids','omit','getMessages','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','rows','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb95,0x109));var _0x5cb9=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xcb95[_0x126558];return _0x1f6d14;};'use strict';var pdf=require(_0x5cb9('0x0'));var emlformat=require(_0x5cb9('0x1'));var rimraf=require(_0x5cb9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5cb9('0x3'));var rp=require(_0x5cb9('0x4'));var moment=require('moment');var BPromise=require(_0x5cb9('0x5'));var Mustache=require(_0x5cb9('0x6'));var util=require(_0x5cb9('0x7'));var path=require('path');var sox=require(_0x5cb9('0x8'));var csv=require(_0x5cb9('0x9'));var ejs=require(_0x5cb9('0xa'));var fs=require('fs');var _=require(_0x5cb9('0xb'));var squel=require('squel');var crypto=require(_0x5cb9('0xc'));var jsforce=require(_0x5cb9('0xd'));var deskjs=require(_0x5cb9('0xe'));var toCsv=require(_0x5cb9('0x9'));var querystring=require('querystring');var Papa=require(_0x5cb9('0xf'));var htmlToText=require('html-to-text');var Redis=require(_0x5cb9('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x5cb9('0x11'));var as=require(_0x5cb9('0x12'));var hardwareService=require(_0x5cb9('0x13'));var logger=require(_0x5cb9('0x14'))(_0x5cb9('0x15'));var utils=require(_0x5cb9('0x16'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0x5cb9('0x17')]=_[_0x5cb9('0x18')](config[_0x5cb9('0x17')],{'host':_0x5cb9('0x19'),'port':0x18eb});var socket=require(_0x5cb9('0x1a'))(new Redis(config[_0x5cb9('0x17')]));require('./mailInteraction.socket')[_0x5cb9('0x1b')](socket);function respondWithStatusCode(_0x45b724,_0x33f020){_0x33f020=_0x33f020||0xcc;return function(_0x5c7561){if(_0x5c7561){return _0x45b724[_0x5cb9('0x1c')](_0x33f020);}return _0x45b724[_0x5cb9('0x1d')](_0x33f020)[_0x5cb9('0x1e')]();};}function respondWithResult(_0x1c5f9b,_0x5d7722){_0x5d7722=_0x5d7722||0xc8;return function(_0x496f18){if(_0x496f18){return _0x1c5f9b[_0x5cb9('0x1d')](_0x5d7722)[_0x5cb9('0x1f')](_0x496f18);}};}function respondWithFilteredResult(_0x176de3,_0x57d2f0){return function(_0x248174){if(_0x248174){var _0x319969=_0x248174[_0x5cb9('0x20')],_0x5bc847=_0x57d2f0['offset'],_0x153bb0=_0x57d2f0[_0x5cb9('0x21')]+_0x57d2f0[_0x5cb9('0x22')],_0x56e7d9;if(_0x153bb0>=_0x319969){_0x153bb0=_0x319969;_0x56e7d9=0xc8;}else{_0x56e7d9=0xce;}_0x176de3[_0x5cb9('0x1d')](_0x56e7d9);return _0x176de3[_0x5cb9('0x23')](_0x5cb9('0x24'),_0x5bc847+'-'+_0x153bb0+'/'+_0x319969)['json'](_0x248174);}return null;};}function patchUpdates(_0x1bb3da){return function(_0x414f97){try{jsonpatch[_0x5cb9('0x25')](_0x414f97,_0x1bb3da,!![]);}catch(_0x537a2b){return BPromise[_0x5cb9('0x26')](_0x537a2b);}return _0x414f97['save']();};}function saveUpdates(_0x284f69,_0x4d63d5){return function(_0x3a784f){if(_0x3a784f){return _0x3a784f[_0x5cb9('0x27')](_0x284f69)[_0x5cb9('0x28')](function(_0x3dc542){return _0x3dc542;});}return null;};}function removeEntity(_0x51ef8f,_0x196336){return function(_0x32fd23){if(_0x32fd23){return _0x32fd23[_0x5cb9('0x29')]()[_0x5cb9('0x28')](function(){_0x51ef8f[_0x5cb9('0x1d')](0xcc)[_0x5cb9('0x1e')]();});}};}function handleEntityNotFound(_0x2d0c6b,_0x3fa7b9){return function(_0x21033e){if(!_0x21033e){_0x2d0c6b[_0x5cb9('0x1c')](0x194);}return _0x21033e;};}function handleError(_0x5e3a98,_0x5ba9e6){_0x5ba9e6=_0x5ba9e6||0x1f4;return function(_0x263c3c){logger[_0x5cb9('0x2a')](_0x263c3c[_0x5cb9('0x2b')]);if(_0x263c3c[_0x5cb9('0x2c')]){delete _0x263c3c[_0x5cb9('0x2c')];}_0x5e3a98[_0x5cb9('0x1d')](_0x5ba9e6)[_0x5cb9('0x2d')](_0x263c3c);};}function getInteractionUsers(_0x2ad4f1,_0x36bc94){return new BPromise(function(_0xf86d14,_0xa4bc92){try{if(_0x36bc94[_0x2ad4f1['id']]){_0x2ad4f1[_0x5cb9('0x2e')]=_[_0x5cb9('0x2f')](_0x36bc94[_0x2ad4f1['id']],function(_0x378dc8){return{'id':_0x378dc8['id'],'fullname':_0x378dc8[_0x5cb9('0x30')]};});}}catch(_0x4a6fef){_0xa4bc92(_0x4a6fef);}_0xf86d14(_0x2ad4f1);});}function getInteractionTags(_0x55b3b5,_0xa6cd38){return new BPromise(function(_0x59b6b5,_0x59fd43){try{if(_0x55b3b5[_0x5cb9('0x31')]){_0x55b3b5[_0x5cb9('0x32')]=[];_0x55b3b5[_0x5cb9('0x31')][_0x5cb9('0x33')](',')[_0x5cb9('0x34')](function(_0x45a2f3){_0x55b3b5[_0x5cb9('0x32')]['push'](_0xa6cd38[_0x45a2f3]);});}delete _0x55b3b5[_0x5cb9('0x31')];}catch(_0x5ce589){_0x59fd43(_0x5ce589);}_0x59b6b5(_0x55b3b5);});}function getLastMessageText(_0x28e344){return new BPromise(function(_0x4f831b,_0x907ac2){return db[_0x5cb9('0x35')][_0x5cb9('0x36')]({'where':{'id':_0x28e344['id']},'attributes':['lastMsgBody',_0x5cb9('0x37')],'raw':!![]})['then'](function(_0x1789a6){if(!_0x1789a6[_0x5cb9('0x37')]){_0x28e344[_0x5cb9('0x37')]=_[_0x5cb9('0x38')](htmlToText[_0x5cb9('0x39')](_0x1789a6[_0x5cb9('0x3a')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]}));}else{_0x28e344[_0x5cb9('0x37')]=_0x1789a6[_0x5cb9('0x37')];}_0x4f831b(_0x28e344);})[_0x5cb9('0x3b')](function(_0x42cfb3){_0x907ac2(_0x42cfb3);});});}function updateMailInteraction(_0x42774d,_0x154f39,_0x41988a,_0x345dc7){return new BPromise(function(_0x1e3abc,_0x4c16b2){return getInteractionUsers(_0x42774d,_0x41988a)['then'](function(_0x154fc0){return getInteractionTags(_0x154fc0,_0x154f39);})[_0x5cb9('0x28')](function(_0x4ea8ee){if(_0x345dc7){_0x1e3abc(getLastMessageText(_0x4ea8ee));}else{_0x1e3abc(_0x4ea8ee);}})['catch'](function(_0x449ddf){_0x4c16b2(_0x449ddf);});});}exports['index']=function(_0xfffc16,_0x5001b8){var _0x1c2743={},_0x333017={},_0x21c96e={'count':0x0,'rows':[]};var _0x61832a=_[_0x5cb9('0x2f')](db[_0x5cb9('0x35')][_0x5cb9('0x3c')],function(_0x47d49a){return{'name':_0x47d49a['fieldName'],'type':_0x47d49a[_0x5cb9('0x3d')][_0x5cb9('0x3e')]};});_0x333017[_0x5cb9('0x3f')]=_[_0x5cb9('0x2f')](_0x61832a,'name');_0x333017[_0x5cb9('0x40')]=_[_0x5cb9('0x41')](_0xfffc16['query']);_0x333017[_0x5cb9('0x42')]=_[_0x5cb9('0x43')](_0x333017[_0x5cb9('0x3f')],_0x333017[_0x5cb9('0x40')]);_0x1c2743[_0x5cb9('0x44')]=_[_0x5cb9('0x43')](_0x333017[_0x5cb9('0x3f')],qs[_0x5cb9('0x45')](_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x45')]));_0x1c2743[_0x5cb9('0x44')]=_0x1c2743[_0x5cb9('0x44')][_0x5cb9('0x46')]?_0x1c2743['attributes']:_0x333017[_0x5cb9('0x3f')];if(!_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x47')](_0x5cb9('0x48'))){_0x1c2743[_0x5cb9('0x22')]=qs[_0x5cb9('0x22')](_0xfffc16['query'][_0x5cb9('0x22')]);_0x1c2743[_0x5cb9('0x21')]=qs['offset'](_0xfffc16['query'][_0x5cb9('0x21')]);}_0x1c2743[_0x5cb9('0x49')]=qs['sort'](_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x4a')]);_0x1c2743[_0x5cb9('0x4b')]=qs['filters'](_[_0x5cb9('0x4c')](_0xfffc16['query'],_0x333017[_0x5cb9('0x42')]));var _0x2cb486=[];var _0x15265b=squel[_0x5cb9('0x4d')]()[_0x5cb9('0x4e')]('id')[_0x5cb9('0x4e')](_0x5cb9('0x2c'))['field'](_0x5cb9('0x4f'))[_0x5cb9('0x50')](_0x5cb9('0x51'));var _0x5ef76b=squel[_0x5cb9('0x4d')]()[_0x5cb9('0x4e')](_0x5cb9('0x52'))[_0x5cb9('0x4e')]('u.fullname')['field']('ui.MailInteractionId')[_0x5cb9('0x50')]('user_has_mail_interactions','ui')[_0x5cb9('0x53')](_0x5cb9('0x54'),'u',_0x5cb9('0x55'));var _0x309fc6=squel['select']()[_0x5cb9('0x50')](_0x5cb9('0x56'),'i')['left_join']('cm_contacts','c',_0x5cb9('0x57'))[_0x5cb9('0x53')]('users','o',_0x5cb9('0x58'))['left_join'](_0x5cb9('0x59'),'a',_0x5cb9('0x5a'))[_0x5cb9('0x53')]('mail_messages','me','me.MailInteractionId\x20=\x20i.id')[_0x5cb9('0x53')](_0x5cb9('0x5b'),'it','it.MailInteractionId\x20=\x20i.id')['left_join'](_0x5cb9('0x51'),'t','t.id\x20=\x20it.TagId');var _0x455d97=squel['expr']();var _0x224507=[];var _0x10e00c=squel[_0x5cb9('0x5c')]();var _0x29bbf4;if(_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x5d')]){_0x29bbf4=as[_0x5cb9('0x5e')](_0xfffc16['query'][_0x5cb9('0x5d')]);var _0x5749d7=_0x29bbf4[_0x5cb9('0x5f')];for(var _0xde35dd=0x0;_0xde35dd<_0x29bbf4[_0x5cb9('0x60')][_0x5cb9('0x46')];_0xde35dd++){var _0xcc3377=_0x29bbf4[_0x5cb9('0x60')][_0xde35dd];var _0x21bfbd='i';var _0x218fab=_[_0x5cb9('0x61')](_0x61832a,[_0x5cb9('0x2c'),_0xcc3377[_0x5cb9('0x4e')]]);if(!_0x218fab){switch(_0xcc3377['field']){case _0x5cb9('0x62'):if(_0xcc3377['value']==0x1){_0x309fc6[_0x5cb9('0x63')]('`'+_0xcc3377[_0x5cb9('0x4e')]+_0x5cb9('0x64'));}else{_0x309fc6[_0x5cb9('0x63')]('`'+_0xcc3377['field']+_0x5cb9('0x65'));}break;case'Contact':if(_0xcc3377['operator']==='$substring'){if(_0xcc3377[_0x5cb9('0x66')]['split']('\x20')[_0x5cb9('0x46')]>0x1){_0x455d97[_0x5749d7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x5cb9('0x67')](_0xcc3377[_0x5cb9('0x66')]),null);}else{var _0x4c71de='%'+_0xcc3377['value']+'%';_0x455d97[_0x5749d7](_0x5cb9('0x68'),_0x4c71de,_0x4c71de,_0x4c71de);}}else{_0x218fab=_[_0x5cb9('0x61')](_0x61832a,[_0x5cb9('0x2c'),_0x5cb9('0x69')]);_0xcc3377[_0x5cb9('0x4e')]=_0x5cb9('0x69');_0x4ccce0=as[_0x5cb9('0x6a')](_0x21bfbd,_0x218fab[_0x5cb9('0x3d')],_0xcc3377);_0x455d97[_0x5749d7](_0x4ccce0[_0x5cb9('0x6b')],_0x4ccce0[_0x5cb9('0x66')][_0x5cb9('0x6c')],_0x4ccce0['value'][_0x5cb9('0x1e')]);}break;case _0x5cb9('0x6d'):var _0x554e78=_0xcc3377[_0x5cb9('0x66')][_0x5cb9('0x33')](',')[_0x5cb9('0x2f')](function(_0x5b7d0d){return Number(_0x5b7d0d);});_0x554e78[_0x5cb9('0x34')](function(_0x14c422){_0x10e00c['or'](_0x5cb9('0x6e'),'%,'+_0x14c422+',%');});_0x224507=_[_0x5cb9('0x6f')](_0x224507,_0x554e78);break;case'User':if(_0xcc3377[_0x5cb9('0x70')]===_0x5cb9('0x71')){_0x455d97[_0x5749d7](_0x5cb9('0x72'),'%'+_0xcc3377[_0x5cb9('0x66')]+'%',null);}else{_0x218fab=_[_0x5cb9('0x61')](_0x61832a,[_0x5cb9('0x2c'),_0x5cb9('0x73')]);_0xcc3377[_0x5cb9('0x4e')]='UserId';_0x4ccce0=as[_0x5cb9('0x6a')](_0x21bfbd,_0x218fab['type'],_0xcc3377);_0x455d97[_0x5749d7](_0x4ccce0['text'],_0x4ccce0[_0x5cb9('0x66')][_0x5cb9('0x6c')],_0x4ccce0['value'][_0x5cb9('0x1e')]);}break;case _0x5cb9('0x74'):_0x4ccce0=as[_0x5cb9('0x6a')]('me',null,_0xcc3377);_0x455d97[_0x5749d7](_0x4ccce0[_0x5cb9('0x6b')],_0x4ccce0['value']['start'],_0x4ccce0['value']['end']);break;}}else{var _0x4ccce0=as[_0x5cb9('0x6a')](_0x21bfbd,_0x218fab[_0x5cb9('0x3d')],_0xcc3377);_0x455d97[_0x5749d7](_0x4ccce0[_0x5cb9('0x6b')],_0x4ccce0[_0x5cb9('0x66')]['start'],_0x4ccce0[_0x5cb9('0x66')][_0x5cb9('0x1e')]);}}}else{var _0x47e136=_(_0xfffc16[_0x5cb9('0x40')])[_0x5cb9('0x41')]()['map'](function(_0xe6c92){return _[_0x5cb9('0x75')](_0x61832a,[_0x5cb9('0x2c'),_0xe6c92])?_0xe6c92:undefined;})[_0x5cb9('0x76')]()['value']();if(!_[_0x5cb9('0x77')](_0x47e136)){_0x47e136[_0x5cb9('0x34')](function(_0x5ca2dd){if(_0x5ca2dd===_0x5cb9('0x78')){_0x309fc6[_0x5cb9('0x4b')](_0x5cb9('0x79'),[][_0x5cb9('0x7a')](_0xfffc16[_0x5cb9('0x40')][_0x5ca2dd]));}else if(_0x5ca2dd===_0x5cb9('0x7b')){var _0xc5250d=JSON[_0x5cb9('0x7c')](_0xfffc16[_0x5cb9('0x40')][_0x5ca2dd])['$gte'];var _0x2ee20c=JSON[_0x5cb9('0x7c')](_0xfffc16[_0x5cb9('0x40')][_0x5ca2dd])[_0x5cb9('0x7d')];_0x309fc6[_0x5cb9('0x4b')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0xc5250d,_0x2ee20c);}else{if(_0xfffc16[_0x5cb9('0x40')][_0x5ca2dd]===_0x5cb9('0x7e')){_0x309fc6[_0x5cb9('0x4b')]('i.'+_0x5ca2dd+_0x5cb9('0x7f'));}else{_0x309fc6['where']('i.'+_0x5ca2dd+'\x20=\x20?',_0xfffc16[_0x5cb9('0x40')][_0x5ca2dd]);}}});}if(_0xfffc16['query'][_0x5cb9('0x80')]){if(_0xfffc16['query'][_0x5cb9('0x80')]==0x1){_0x309fc6[_0x5cb9('0x63')]('`unreadMessages`\x20=\x200');}else{_0x309fc6[_0x5cb9('0x63')](_0x5cb9('0x81'));}}if(_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x82')]){_0x224507=_[_0x5cb9('0x83')](_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x82')])?_0xfffc16['query'][_0x5cb9('0x82')]:new Array(_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x82')]);_0x224507[_0x5cb9('0x34')](function(_0x3dbce3){_0x10e00c['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3dbce3+',%');});}if(_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x84')]){var _0x4bd295=_0xfffc16['query'][_0x5cb9('0x84')][_0x5cb9('0x85')]('\x5c','\x5c\x5c')[_0x5cb9('0x85')]('\x27\x27','\x27\x27\x27\x27');if(qs[_0x5cb9('0x86')](_0x4bd295)){_0x455d97['or'](_0x5cb9('0x87'),_0x4bd295+'%');}else if(qs['isEmail'](_0x4bd295)){_0x455d97['or'](_0x5cb9('0x88'),_0x4bd295+'%');}else{_0x455d97['or'](_0x5cb9('0x89'),qs[_0x5cb9('0x67')](_0x4bd295))['or'](_0x5cb9('0x8a'),qs['getFullTextValue'](_0x4bd295));}}}_0x309fc6['where'](_0x455d97);_0x309fc6[_0x5cb9('0x8b')](_0x5cb9('0x8c'));var _0x206abc={'type':db[_0x5cb9('0x8d')][_0x5cb9('0x8e')]['SELECT'],'raw':!![]};var _0x310fbe=_0x309fc6['clone']();_0x310fbe['field'](_0x5cb9('0x8c'));_0x310fbe[_0x5cb9('0x4e')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x5cb9('0x62'));if(_0x1c2743[_0x5cb9('0x49')]){_0x1c2743[_0x5cb9('0x49')][_0x5cb9('0x34')](function(_0x56c444){_0x309fc6[_0x5cb9('0x49')]('i.'+_0x56c444[0x0],_0x56c444[0x1]===_0x5cb9('0x8f')?![]:!![]);});}if(!_[_0x5cb9('0x77')](_0x224507)){_0x309fc6[_0x5cb9('0x63')](_0x10e00c);_0x310fbe[_0x5cb9('0x4b')](_0x5cb9('0x90'),_0x224507);}BPromise['resolve']()[_0x5cb9('0x28')](function(){if(!_0x29bbf4){if(_0xfffc16['query']['MailAccountId']||_0xfffc16[_0x5cb9('0x40')][_0x5cb9('0x91')])return;_0x310fbe['where'](_0x5cb9('0x92'));_0x309fc6[_0x5cb9('0x4b')](_0x5cb9('0x92'));return;}return _0xfffc16[_0x5cb9('0x93')][_0x5cb9('0x94')]({'attributes':['id'],'raw':!![]})[_0x5cb9('0x28')](function(_0x2e4f95){if(_['isEmpty'](_0x2e4f95)){_0x310fbe[_0x5cb9('0x4b')](_0x5cb9('0x95'));_0x309fc6[_0x5cb9('0x4b')](_0x5cb9('0x95'));}else{_0x310fbe[_0x5cb9('0x4b')](_0x5cb9('0x79'),_[_0x5cb9('0x2f')](_0x2e4f95,'id'));_0x309fc6[_0x5cb9('0x4b')]('i.MailAccountId\x20IN\x20?',_[_0x5cb9('0x2f')](_0x2e4f95,'id'));}});})['then'](function(){db[_0x5cb9('0x96')]['query'](_0x310fbe[_0x5cb9('0x97')](),_0x206abc)[_0x5cb9('0x28')](function(_0x3733b5){_0x21c96e[_0x5cb9('0x20')]=_0x3733b5[_0x5cb9('0x46')];if(_0x21c96e['count']===0x0)return[];return db[_0x5cb9('0x96')]['query'](_0x15265b['toString'](),_0x206abc)[_0x5cb9('0x28')](function(_0x5d9870){_0x2cb486=_[_0x5cb9('0x98')](_0x5d9870,'id');_0x206abc=_[_0x5cb9('0x99')](_0x206abc,{'model':db[_0x5cb9('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xfffc16[_0x5cb9('0x40')]['fields']){_0x1c2743[_0x5cb9('0x44')][_0x5cb9('0x34')](function(_0x1122a6){_0x309fc6['field']('i.'+_0x1122a6);});}else{_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0x9a'),_0x5cb9('0x62'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0x9b'),_0x5cb9('0x9c'));_0x309fc6['field']('a.mandatoryDisposition',_0x5cb9('0x9d'));_0x309fc6['field'](_0x5cb9('0x8c'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0x9e'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0x9f'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa0'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa1'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa2'));_0x309fc6['field'](_0x5cb9('0xa3'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa4'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa5'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa6'));_0x309fc6['field']('i.substatus');_0x309fc6[_0x5cb9('0x4e')]('i.to');_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa7'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa8'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xa9'));_0x309fc6[_0x5cb9('0x4e')]('c.firstName',_0x5cb9('0xaa'));_0x309fc6['field'](_0x5cb9('0xab'),_0x5cb9('0xac'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xad'),_0x5cb9('0xae'));_0x309fc6['field'](_0x5cb9('0xaf'),_0x5cb9('0xb0'));_0x309fc6[_0x5cb9('0x4e')]('c.mobile',_0x5cb9('0xb1'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xb2'),_0x5cb9('0xb3'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xb4'),_0x5cb9('0xb5'));_0x309fc6[_0x5cb9('0x4e')](_0x5cb9('0xb6'),'Owner.internal');_0x309fc6['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x5cb9('0x31'));}_0x309fc6['limit'](_0x1c2743[_0x5cb9('0x22')]);_0x309fc6['offset'](_0x1c2743[_0x5cb9('0x21')]);return db['sequelize'][_0x5cb9('0x40')](_0x309fc6[_0x5cb9('0x97')](),_0x206abc);})[_0x5cb9('0x28')](function(_0x559fcf){_0x5ef76b['where'](_0x5cb9('0xb7'),_['map'](_0x559fcf,'id'));return db[_0x5cb9('0x96')][_0x5cb9('0x40')](_0x5ef76b[_0x5cb9('0x97')](),_0x206abc)[_0x5cb9('0x28')](function(_0x353b5d){var _0x230f74=_[_0x5cb9('0xb8')](_0x353b5d,_0x5cb9('0xb9'));var _0x21b205=[];return db[_0x5cb9('0xba')][_0x5cb9('0x36')]({'attributes':[_0x5cb9('0xbb')],'raw':!![]})['then'](function(_0x2b8294){var _0x180d70=_0x2b8294[_0x5cb9('0xbb')];_0x559fcf[_0x5cb9('0x34')](function(_0x2ec17b){_0x21b205[_0x5cb9('0xbc')](updateMailInteraction(_0x2ec17b,_0x2cb486,_0x230f74,_0x180d70));});return BPromise[_0x5cb9('0xbd')](_0x21b205);});});});})[_0x5cb9('0x28')](function(_0x4d48c3){_0x21c96e['rows']=_0x4d48c3;return _0x21c96e;})[_0x5cb9('0x28')](respondWithFilteredResult(_0x5001b8,_0x1c2743));})[_0x5cb9('0x3b')](handleError(_0x5001b8,null));};exports[_0x5cb9('0xbe')]=function(_0x116d49,_0x484ae5){var _0x230dac={'raw':![],'where':{'id':_0x116d49[_0x5cb9('0xbf')]['id']}},_0x54c658={};_0x54c658['model']=_[_0x5cb9('0x41')](db['MailInteraction']['rawAttributes']);_0x54c658['query']=_[_0x5cb9('0x41')](_0x116d49['query']);_0x54c658[_0x5cb9('0x42')]=_[_0x5cb9('0x43')](_0x54c658[_0x5cb9('0x3f')],_0x54c658[_0x5cb9('0x40')]);_0x230dac[_0x5cb9('0x44')]=_[_0x5cb9('0x43')](_0x54c658[_0x5cb9('0x3f')],qs[_0x5cb9('0x45')](_0x116d49[_0x5cb9('0x40')][_0x5cb9('0x45')]));_0x230dac[_0x5cb9('0x44')]=_0x230dac['attributes'][_0x5cb9('0x46')]?_0x230dac[_0x5cb9('0x44')]:_0x54c658[_0x5cb9('0x3f')];if(_0x116d49[_0x5cb9('0x40')][_0x5cb9('0xc0')]){_0x230dac[_0x5cb9('0xc1')]=[{'all':!![]}];}_0x230dac=_[_0x5cb9('0x99')]({},_0x230dac,_0x116d49[_0x5cb9('0xc2')]);return db[_0x5cb9('0x35')][_0x5cb9('0x61')](_0x230dac)[_0x5cb9('0x28')](handleEntityNotFound(_0x484ae5,null))[_0x5cb9('0x28')](respondWithResult(_0x484ae5,null))[_0x5cb9('0x3b')](handleError(_0x484ae5,null));};exports[_0x5cb9('0xc3')]=function(_0x414e58,_0x380554){return db[_0x5cb9('0x35')]['create'](_0x414e58[_0x5cb9('0xc4')],{})[_0x5cb9('0x28')](respondWithResult(_0x380554,0xc9))[_0x5cb9('0x3b')](handleError(_0x380554,null));};exports[_0x5cb9('0x27')]=function(_0x5c8845,_0x3bf84f){if(_0x5c8845[_0x5cb9('0xc4')]['id']){delete _0x5c8845[_0x5cb9('0xc4')]['id'];}return db[_0x5cb9('0x35')][_0x5cb9('0x61')]({'where':{'id':_0x5c8845[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x3bf84f,null))[_0x5cb9('0x28')](saveUpdates(_0x5c8845[_0x5cb9('0xc4')],null))[_0x5cb9('0x28')](respondWithResult(_0x3bf84f,null))[_0x5cb9('0x3b')](handleError(_0x3bf84f,null));};exports[_0x5cb9('0x29')]=function(_0x2e3d7f,_0x25058a){return db[_0x5cb9('0x35')][_0x5cb9('0x61')]({'where':{'id':_0x2e3d7f[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x25058a,null))[_0x5cb9('0x28')](removeEntity(_0x25058a,null))[_0x5cb9('0x3b')](handleError(_0x25058a,null));};exports[_0x5cb9('0xc5')]=function(_0x3614ab,_0x3a69a7){return db[_0x5cb9('0x35')][_0x5cb9('0xc5')]()['then'](respondWithResult(_0x3a69a7,null))['catch'](handleError(_0x3a69a7,null));};exports[_0x5cb9('0xc6')]=function(_0x546af0,_0x34396d,_0xbc103d){return db[_0x5cb9('0xc7')][_0x5cb9('0x61')]({'where':{'id':_0x546af0[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x34396d,null))[_0x5cb9('0x28')](function(_0x52bce4){if(_0x52bce4){return _0x52bce4['addMessage'](_0x546af0[_0x5cb9('0xc4')][_0x5cb9('0xc8')],_[_0x5cb9('0xc9')](_0x546af0[_0x5cb9('0xc4')],[_0x5cb9('0xc8'),'id'])||{});}})['then'](respondWithResult(_0x34396d,null))[_0x5cb9('0x3b')](handleError(_0x34396d,null));};exports[_0x5cb9('0xca')]=function(_0x41d720,_0x1a8953,_0x1d648b){var _0x5e7deb={'raw':![],'where':{}};var _0x578972={};var _0x587301={'count':0x0,'rows':[]};return db[_0x5cb9('0x35')]['findOne']({'where':{'id':_0x41d720[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x1a8953,null))[_0x5cb9('0x28')](function(_0x17d280){if(_0x17d280){_0x578972[_0x5cb9('0x3f')]=_['keys'](db['MailMessage'][_0x5cb9('0x3c')]);_0x578972[_0x5cb9('0x40')]=_[_0x5cb9('0x41')](_0x41d720[_0x5cb9('0x40')]);_0x578972[_0x5cb9('0x42')]=_[_0x5cb9('0x43')](_0x578972[_0x5cb9('0x3f')],_0x578972[_0x5cb9('0x40')]);_0x5e7deb['attributes']=_[_0x5cb9('0x43')](_0x578972[_0x5cb9('0x3f')],qs[_0x5cb9('0x45')](_0x41d720[_0x5cb9('0x40')][_0x5cb9('0x45')]));_0x5e7deb['attributes']=_0x5e7deb[_0x5cb9('0x44')]['length']?_0x5e7deb['attributes']:_0x578972[_0x5cb9('0x3f')];if(!_0x41d720['query'][_0x5cb9('0x47')](_0x5cb9('0x48'))){_0x5e7deb['limit']=qs[_0x5cb9('0x22')](_0x41d720[_0x5cb9('0x40')][_0x5cb9('0x22')]);_0x5e7deb[_0x5cb9('0x21')]=qs['offset'](_0x41d720[_0x5cb9('0x40')]['offset']);}_0x5e7deb[_0x5cb9('0x49')]=qs[_0x5cb9('0x4a')](_0x41d720[_0x5cb9('0x40')][_0x5cb9('0x4a')]);_0x5e7deb[_0x5cb9('0x4b')]=qs['filters'](_['pick'](_0x41d720[_0x5cb9('0x40')],_0x578972[_0x5cb9('0x42')]));_0x5e7deb['where'][_0x5cb9('0xb9')]=_0x17d280['id'];if(_0x41d720[_0x5cb9('0x40')]['filter']){_0x5e7deb[_0x5cb9('0x4b')]=_[_0x5cb9('0x99')](_0x5e7deb[_0x5cb9('0x4b')],{'$or':_[_0x5cb9('0x2f')](_0x5e7deb[_0x5cb9('0x44')],function(_0x300a7b){var _0x31ee0d={};_0x31ee0d[_0x300a7b]={'$like':'%'+_0x41d720['query'][_0x5cb9('0x84')]+'%'};return _0x31ee0d;})});}if(_0x41d720['query'][_0x5cb9('0xcb')]){var _0x103eb6=_0x41d720['query']['$gte'][_0x5cb9('0x33')](',');var _0x309388={};_0x309388[_0x103eb6[0x0]]={'$gte':moment(_0x103eb6[0x1])[_0x5cb9('0xcc')](_0x5cb9('0xcd'))};_0x5e7deb['where']=_['merge'](_0x5e7deb['where'],_0x309388);}_0x5e7deb=_['merge']({},_0x5e7deb,_0x41d720[_0x5cb9('0xc2')]);return db['MailMessage']['count']({'where':_0x5e7deb[_0x5cb9('0x4b')]})[_0x5cb9('0x28')](function(_0x3176a4){_0x587301[_0x5cb9('0x20')]=_0x3176a4;if(_0x41d720[_0x5cb9('0x40')][_0x5cb9('0xc0')]){_0x5e7deb[_0x5cb9('0xc1')]=[{'all':!![]}];}return db[_0x5cb9('0xc7')][_0x5cb9('0xce')](_0x5e7deb);})[_0x5cb9('0x28')](function(_0x2e75c2){_0x587301[_0x5cb9('0xcf')]=_0x2e75c2;return _0x587301;});}})[_0x5cb9('0x28')](respondWithFilteredResult(_0x1a8953,_0x5e7deb))[_0x5cb9('0x3b')](handleError(_0x1a8953,null));};exports[_0x5cb9('0xd0')]=function(_0x32aaa4,_0x2f3256,_0x2e5db6){return db[_0x5cb9('0x35')][_0x5cb9('0x61')]({'where':{'id':_0x32aaa4[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x2f3256,null))[_0x5cb9('0x28')](function(_0x5e74bc){if(_0x5e74bc){return _0x5e74bc['setTags'](_0x32aaa4[_0x5cb9('0xc4')][_0x5cb9('0xc8')],_[_0x5cb9('0xc9')](_0x32aaa4[_0x5cb9('0xc4')],[_0x5cb9('0xc8'),'id'])||{})[_0x5cb9('0xd1')](function(){return db[_0x5cb9('0x6d')][_0x5cb9('0xce')]({'attributes':['id',_0x5cb9('0x2c'),_0x5cb9('0x4f')],'where':{'id':_0x32aaa4[_0x5cb9('0xc4')][_0x5cb9('0xc8')]}});})[_0x5cb9('0x28')](function(_0x21f2ad){socket[_0x5cb9('0xd2')](_0x5cb9('0xd3'),{'id':Number(_0x32aaa4['params']['id']),'tags':_0x21f2ad||[]});return{'id':Number(_0x32aaa4['params']['id']),'tags':_0x21f2ad||[]};});}})[_0x5cb9('0x28')](respondWithResult(_0x2f3256,null))[_0x5cb9('0x3b')](handleError(_0x2f3256,null));};exports[_0x5cb9('0xd4')]=function(_0x30fcab,_0x32de47,_0x811505){return db[_0x5cb9('0x35')]['find']({'where':{'id':_0x30fcab[_0x5cb9('0xbf')]['id']}})[_0x5cb9('0x28')](handleEntityNotFound(_0x32de47,null))[_0x5cb9('0x28')](function(_0x2b8f44){if(_0x2b8f44){return _0x2b8f44[_0x5cb9('0xd4')](_0x30fcab[_0x5cb9('0x40')][_0x5cb9('0xc8')]);}})[_0x5cb9('0x28')](respondWithStatusCode(_0x32de47,null))[_0x5cb9('0x3b')](handleError(_0x32de47,null));};exports[_0x5cb9('0xd5')]=function(_0x3a0f67,_0x2ec1c8){var _0xd642f5=moment()[_0x5cb9('0xd6')]()[_0x5cb9('0x97')]();var _0x26e622=path[_0x5cb9('0xd7')](config['root'],_0x5cb9('0xd8'),_0x5cb9('0xd9'),_0x5cb9('0xda'));var _0x33e028=path[_0x5cb9('0xd7')](config[_0x5cb9('0xdb')],_0x5cb9('0xd8'),_0x5cb9('0xd9'),_0x5cb9('0xdc'));var _0x17b571=path[_0x5cb9('0xd7')](_0x26e622,_0xd642f5);var _0x43a15d=util[_0x5cb9('0xcc')]('transcript-%d-%s.zip',_0x3a0f67[_0x5cb9('0xbf')]['id'],_0xd642f5);var _0x2c569b=path[_0x5cb9('0xd7')](_0x26e622,_0x43a15d);var _0x216fa4=[];if(_0x3a0f67[_0x5cb9('0x40')][_0x5cb9('0xdc')]){_0x216fa4[_0x5cb9('0xbc')]({'model':db[_0x5cb9('0xdd')],'as':_0x5cb9('0xde'),'raw':!![]});}var _0x2adbc1=[{'model':db[_0x5cb9('0xc7')],'as':_0x5cb9('0xdf'),'attributes':['id','body',_0x5cb9('0x50'),'to','cc',_0x5cb9('0xe0'),_0x5cb9('0xe1'),_0x5cb9('0x7b')],'where':{'secret':![]},'order':qs[_0x5cb9('0x4a')]('id'),'include':_0x216fa4}];return db[_0x5cb9('0x35')][_0x5cb9('0x61')]({'where':{'id':_0x3a0f67['params']['id']},'include':_0x2adbc1})[_0x5cb9('0x28')](handleEntityNotFound(_0x2ec1c8,null))[_0x5cb9('0x28')](function(_0x121fee){if(_0x121fee&&_0x121fee[_0x5cb9('0xdf')]){var _0x2cfd46=_0x121fee['get']({'plain':!![]});fs[_0x5cb9('0xe2')](_0x17b571);return BPromise['each'](_0x2cfd46['Messages'],function(_0x4d9d99,_0x34cd84){var _0x151c1c={'from':_0x4d9d99[_0x5cb9('0x50')],'to':_0x4d9d99['to'],'subject':_0x4d9d99[_0x5cb9('0xe1')],'html':_0x4d9d99[_0x5cb9('0xc4')],'headers':{'Date':moment(_0x4d9d99['createdAt'])[_0x5cb9('0xcc')](_0x5cb9('0xe3'))},'attachments':[]};if(_0x4d9d99['cc']){_0x151c1c[_0x5cb9('0xe4')]['Cc']=_0x4d9d99['cc'];}if(_0x4d9d99['bcc']){_0x151c1c['headers']['Bcc']=_0x4d9d99['bcc'];}return new BPromise(function(_0x4c2c53,_0x22fabb){if(_0x4d9d99[_0x5cb9('0xde')]){for(var _0x38bc90=0x0;_0x38bc90<_0x4d9d99['Attachments'][_0x5cb9('0x46')];_0x38bc90++){var _0x334cff=_0x4d9d99['Attachments'][_0x38bc90];var _0x14b031=path['join'](_0x33e028,_0x334cff[_0x5cb9('0xe5')]);if(fs[_0x5cb9('0xe6')](_0x14b031)){_0x151c1c[_0x5cb9('0xdc')]['push']({'name':_0x334cff[_0x5cb9('0x2c')],'contentType':_0x334cff[_0x5cb9('0x3d')],'data':fs['readFileSync'](_0x14b031)});}}}emlformat[_0x5cb9('0xe7')](_0x151c1c,function(_0x1f79b0,_0x5f09f9){if(_0x1f79b0)return _0x22fabb(_0x1f79b0);fs[_0x5cb9('0xe8')](path[_0x5cb9('0xd7')](_0x17b571,util['format'](_0x5cb9('0xe9'),_0x34cd84)),_0x5f09f9);return _0x4c2c53(_0x5f09f9);});});})['then'](function(){return new BPromise(function(_0x2781be,_0x22189b){zipdir(_0x17b571,{'saveTo':_0x2c569b},function(_0x38c5db,_0x52c5c2){if(_0x38c5db)return _0x22189b(_0x38c5db);return _0x2781be(_0x52c5c2);});})['then'](function(){return new BPromise(function(_0x7444d9,_0x3849c2){rimraf(_0x17b571,function(_0x5c4b6d){if(_0x5c4b6d)_0x3849c2(_0x5c4b6d);return _0x7444d9();});});})['then'](function(){return _0x2ec1c8[_0x5cb9('0xd5')](_0x2c569b,_0x43a15d,function(_0x46989d){if(_0x46989d){console[_0x5cb9('0xea')](_0x5cb9('0xeb'),_0x46989d);}else{fs[_0x5cb9('0xec')](_0x2c569b);}});});});}else{return _0x2ec1c8[_0x5cb9('0x1c')](0xc8);}})['catch'](handleError(_0x2ec1c8,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 405e966..6e962b8 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 _0x4222=['emit','catch','hasOwnProperty','hook','events','../../mysqldb','MailMessage','save','update','remove','getUsers','setDataValue','map','findAll','then','unreadMessages','length'];(function(_0x325084,_0x4b0fbd){var _0x17db96=function(_0x5d9368){while(--_0x5d9368){_0x325084['push'](_0x325084['shift']());}};_0x17db96(++_0x4b0fbd);}(_0x4222,0x158));var _0x2422=function(_0x346737,_0x3e6081){_0x346737=_0x346737-0x0;var _0x1ade2e=_0x4222[_0x346737];return _0x1ade2e;};'use strict';var EventEmitter=require(_0x2422('0x0'));var MailInteraction=require(_0x2422('0x1'))['db']['MailInteraction'];var MailMessage=require(_0x2422('0x1'))['db'][_0x2422('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x2422('0x3'),'afterUpdate':_0x2422('0x4'),'afterDestroy':_0x2422('0x5')};function emitEvent(_0xa4b622){return function(_0x190c2d,_0xaa6c5,_0x292117){_0x190c2d[_0x2422('0x6')]({'attributes':['id'],'raw':!![]})['then'](function(_0x30e6a6){_0x190c2d[_0x2422('0x7')]('Users',_0x30e6a6[_0x2422('0x8')](function(_0x3bc6ca){return{'id':_0x3bc6ca['id']};}));return MailMessage[_0x2422('0x9')]({'where':{'MailInteractionId':_0x190c2d['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2422('0xa')](function(_0x297f18){_0x190c2d[_0x2422('0x7')](_0x2422('0xb'),_0x297f18[_0x2422('0xc')]);MailInteractionEvents[_0x2422('0xd')](_0xa4b622+':'+_0x190c2d['id'],_0x190c2d);MailInteractionEvents[_0x2422('0xd')](_0xa4b622,_0x190c2d);_0x292117(null);})[_0x2422('0xe')](_0x292117(null));};}for(var e in events){if(events[_0x2422('0xf')](e)){var event=events[e];MailInteraction[_0x2422('0x10')](e,emitEvent(event));}}module['exports']=MailInteractionEvents; \ No newline at end of file +var _0x35f5=['emit','catch','hasOwnProperty','exports','events','MailInteraction','MailMessage','save','remove','getUsers','then','setDataValue','Users','map','findAll','length'];(function(_0x169e5f,_0x21164e){var _0x45011f=function(_0x1067c3){while(--_0x1067c3){_0x169e5f['push'](_0x169e5f['shift']());}};_0x45011f(++_0x21164e);}(_0x35f5,0x124));var _0x535f=function(_0x471448,_0x1c0e9e){_0x471448=_0x471448-0x0;var _0x38190b=_0x35f5[_0x471448];return _0x38190b;};'use strict';var EventEmitter=require(_0x535f('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x535f('0x1')];var MailMessage=require('../../mysqldb')['db'][_0x535f('0x2')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x535f('0x3'),'afterUpdate':'update','afterDestroy':_0x535f('0x4')};function emitEvent(_0x140bde){return function(_0x4683fd,_0x4d442e,_0x17f8c5){_0x4683fd[_0x535f('0x5')]({'attributes':['id'],'raw':!![]})[_0x535f('0x6')](function(_0x1588f5){_0x4683fd[_0x535f('0x7')](_0x535f('0x8'),_0x1588f5[_0x535f('0x9')](function(_0x3ef1d1){return{'id':_0x3ef1d1['id']};}));return MailMessage[_0x535f('0xa')]({'where':{'MailInteractionId':_0x4683fd['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4fad4b){_0x4683fd[_0x535f('0x7')]('unreadMessages',_0x4fad4b[_0x535f('0xb')]);MailInteractionEvents['emit'](_0x140bde+':'+_0x4683fd['id'],_0x4683fd);MailInteractionEvents[_0x535f('0xc')](_0x140bde,_0x4683fd);_0x17f8c5(null);})[_0x535f('0xd')](_0x17f8c5(null));};}for(var e in events){if(events[_0x535f('0xe')](e)){var event=events[e];MailInteraction['hook'](e,emitEvent(event));}}module[_0x535f('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 6071e2a..03366f1 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 _0x8f9f=['YYYY-MM-DD\x20HH:mm:ss','closedAt','changed','substatus','models','get','closed','MailMessage','update','catch','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatusAt','format'];(function(_0x2c2d15,_0x170a84){var _0x28017d=function(_0x5ae8c4){while(--_0x5ae8c4){_0x2c2d15['push'](_0x2c2d15['shift']());}};_0x28017d(++_0x170a84);}(_0x8f9f,0xbf));var _0xf8f9=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0x8f9f[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xf8f9('0x0'));var util=require(_0xf8f9('0x1'));var logger=require(_0xf8f9('0x2'))(_0xf8f9('0x3'));var moment=require(_0xf8f9('0x4'));var BPromise=require(_0xf8f9('0x5'));var rp=require(_0xf8f9('0x6'));var fs=require('fs');var path=require(_0xf8f9('0x7'));var rimraf=require(_0xf8f9('0x8'));var config=require(_0xf8f9('0x9'));var attributes=require('./mailInteraction.attributes');module[_0xf8f9('0xa')]=function(_0x21159f,_0x4fd3bf){return _0x21159f[_0xf8f9('0xb')](_0xf8f9('0xc'),attributes,{'tableName':_0xf8f9('0xd'),'paranoid':![],'indexes':[{'name':_0xf8f9('0xe'),'fields':[_0xf8f9('0xf'),'to'],'type':_0xf8f9('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x10f190,_0x3e8a11,_0x451874){if(_0x10f190['substatus']){_0x10f190[_0xf8f9('0x11')]=moment()[_0xf8f9('0x12')](_0xf8f9('0x13'));}if(_0x10f190['closed']){_0x10f190[_0xf8f9('0x14')]=moment()['format'](_0xf8f9('0x13'));}_0x451874(null,_0x3e8a11);},'beforeUpdate':function(_0x3ef788,_0x4419e7,_0x47ef26){if(_0x3ef788['changed']('substatus')){_0x3ef788['substatusAt']=_0x3ef788['substatus']?moment()[_0xf8f9('0x12')](_0xf8f9('0x13')):null;}if(_0x3ef788[_0xf8f9('0x15')]('closed')){_0x3ef788[_0xf8f9('0x14')]=moment()[_0xf8f9('0x12')](_0xf8f9('0x13'));_0x3ef788[_0xf8f9('0x16')]=null;_0x3ef788[_0xf8f9('0x11')]=null;}_0x47ef26(null,_0x3ef788);},'afterUpdate':function(_0x1854a9,_0x264620,_0x3781d6){var _0x6a832d=_0x21159f[_0xf8f9('0x17')];var _0x5bc6c6=_0x1854a9[_0xf8f9('0x18')]({'plain':!![]});if(_0x5bc6c6[_0xf8f9('0x19')]){return _0x6a832d[_0xf8f9('0x1a')][_0xf8f9('0x1b')]({'read':!![]},{'where':{'MailInteractionId':_0x5bc6c6['id']}})['then'](function(){_0x3781d6();})[_0xf8f9('0x1c')](function(_0x12c6c1){_0x3781d6(_0x12c6c1);});}else{_0x3781d6();}}},'charset':'utf8mb4','collate':_0xf8f9('0x1d')});}; \ No newline at end of file +var _0xe0af=['closedAt','format','changed','models','get','update','then','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','MailInteraction','mail_interactions','subject','FULLTEXT','substatus','substatusAt','YYYY-MM-DD\x20HH:mm:ss','closed'];(function(_0x593cab,_0x48aa8b){var _0x12d0ee=function(_0x30c27b){while(--_0x30c27b){_0x593cab['push'](_0x593cab['shift']());}};_0x12d0ee(++_0x48aa8b);}(_0xe0af,0x1c9));var _0xfe0a=function(_0xd050c6,_0x58ffb4){_0xd050c6=_0xd050c6-0x0;var _0x7278a=_0xe0af[_0xd050c6];return _0x7278a;};'use strict';var _=require(_0xfe0a('0x0'));var util=require(_0xfe0a('0x1'));var logger=require(_0xfe0a('0x2'))('api');var moment=require(_0xfe0a('0x3'));var BPromise=require(_0xfe0a('0x4'));var rp=require(_0xfe0a('0x5'));var fs=require('fs');var path=require(_0xfe0a('0x6'));var rimraf=require(_0xfe0a('0x7'));var config=require(_0xfe0a('0x8'));var attributes=require(_0xfe0a('0x9'));module[_0xfe0a('0xa')]=function(_0x3ab18f,_0x5ba790){return _0x3ab18f['define'](_0xfe0a('0xb'),attributes,{'tableName':_0xfe0a('0xc'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xfe0a('0xd'),'to'],'type':_0xfe0a('0xe')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x5f4930,_0x39a2ac,_0x399b95){if(_0x5f4930[_0xfe0a('0xf')]){_0x5f4930[_0xfe0a('0x10')]=moment()['format'](_0xfe0a('0x11'));}if(_0x5f4930[_0xfe0a('0x12')]){_0x5f4930[_0xfe0a('0x13')]=moment()[_0xfe0a('0x14')](_0xfe0a('0x11'));}_0x399b95(null,_0x39a2ac);},'beforeUpdate':function(_0x289b2b,_0x585f7a,_0x5e983){if(_0x289b2b[_0xfe0a('0x15')]('substatus')){_0x289b2b[_0xfe0a('0x10')]=_0x289b2b[_0xfe0a('0xf')]?moment()[_0xfe0a('0x14')](_0xfe0a('0x11')):null;}if(_0x289b2b['changed'](_0xfe0a('0x12'))){_0x289b2b['closedAt']=moment()[_0xfe0a('0x14')](_0xfe0a('0x11'));_0x289b2b['substatus']=null;_0x289b2b['substatusAt']=null;}_0x5e983(null,_0x289b2b);},'afterUpdate':function(_0x3d695e,_0x28d7cd,_0x57ff67){var _0x414ef0=_0x3ab18f[_0xfe0a('0x16')];var _0x43168b=_0x3d695e[_0xfe0a('0x17')]({'plain':!![]});if(_0x43168b[_0xfe0a('0x12')]){return _0x414ef0['MailMessage'][_0xfe0a('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x43168b['id']}})[_0xfe0a('0x19')](function(){_0x57ff67();})['catch'](function(_0x308fcf){_0x57ff67(_0x308fcf);});}else{_0x57ff67();}}},'charset':_0xfe0a('0x1a'),'collate':_0xfe0a('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 1ec2bb1..b4133aa 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 _0x6599=['info','MailInteraction,\x20%s,\x20%s','request\x20sent','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateMailInteraction','MailInteraction','update','body','options','attributes','limit','debug','AddTagsToMailInteraction','where','ids','omit','spread','AddTags','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','redis','localhost','register','then'];(function(_0x5bd77e,_0x481b3e){var _0x11d377=function(_0x3272c1){while(--_0x3272c1){_0x5bd77e['push'](_0x5bd77e['shift']());}};_0x11d377(++_0x481b3e);}(_0x6599,0xb0));var _0x9659=function(_0x2a0350,_0x249319){_0x2a0350=_0x2a0350-0x0;var _0x425220=_0x6599[_0x2a0350];return _0x425220;};'use strict';var _=require('lodash');var util=require(_0x9659('0x0'));var moment=require(_0x9659('0x1'));var BPromise=require(_0x9659('0x2'));var rs=require(_0x9659('0x3'));var fs=require('fs');var Redis=require(_0x9659('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9659('0x5'));var logger=require('../../config/logger')(_0x9659('0x6'));var config=require('../../config/environment');var jayson=require(_0x9659('0x7'));var client=jayson[_0x9659('0x8')][_0x9659('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x9659('0xa')],{'host':_0x9659('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9659('0xa')]));require('./mailInteraction.socket')[_0x9659('0xc')](socket);function respondWithRpcPromise(_0x194d48,_0x58552a,_0x147cac){return new BPromise(function(_0x25a460,_0x349cfb){return client['request'](_0x194d48,_0x147cac)[_0x9659('0xd')](function(_0x520848){logger[_0x9659('0xe')](_0x9659('0xf'),_0x58552a,_0x9659('0x10'));logger['debug'](_0x9659('0x11'),_0x58552a,_0x9659('0x10'),JSON[_0x9659('0x12')](_0x520848));if(_0x520848[_0x9659('0x13')]){if(_0x520848[_0x9659('0x13')][_0x9659('0x14')]===0x1f4){logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x520848[_0x9659('0x13')][_0x9659('0x15')]);return _0x349cfb(_0x520848[_0x9659('0x13')][_0x9659('0x15')]);}logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x520848['error'][_0x9659('0x15')]);return _0x25a460(_0x520848[_0x9659('0x13')][_0x9659('0x15')]);}else{logger[_0x9659('0xe')](_0x9659('0xf'),_0x58552a,_0x9659('0x10'));_0x25a460(_0x520848[_0x9659('0x16')][_0x9659('0x15')]);}})[_0x9659('0x17')](function(_0x525d27){logger[_0x9659('0x13')](_0x9659('0xf'),_0x58552a,_0x525d27);_0x349cfb(_0x525d27);});});}exports[_0x9659('0x18')]=function(_0x582039){var _0x2d06ea=this;return new Promise(function(_0x52b880,_0x301c36){return db[_0x9659('0x19')][_0x9659('0x1a')](_0x582039[_0x9659('0x1b')],{'raw':_0x582039[_0x9659('0x1c')]?_0x582039[_0x9659('0x1c')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x582039[_0x9659('0x1c')]?_0x582039[_0x9659('0x1c')]['where']||null:null,'attributes':_0x582039[_0x9659('0x1c')]?_0x582039[_0x9659('0x1c')][_0x9659('0x1d')]||null:null,'limit':_0x582039['options']?_0x582039[_0x9659('0x1c')][_0x9659('0x1e')]||null:null})[_0x9659('0xd')](function(_0x46f3c6){logger[_0x9659('0xe')]('UpdateMailInteraction',_0x582039);logger[_0x9659('0x1f')](_0x9659('0x18'),_0x582039,JSON[_0x9659('0x12')](_0x46f3c6));_0x52b880(_0x46f3c6);})[_0x9659('0x17')](function(_0x5d8d0f){logger[_0x9659('0x13')](_0x9659('0x18'),_0x5d8d0f[_0x9659('0x15')],_0x582039);_0x301c36(_0x2d06ea[_0x9659('0x13')](0x1f4,_0x5d8d0f['message']));});});};exports[_0x9659('0x20')]=function(_0x4795d1){return new Promise(function(_0x326e47,_0x5bf928){return db[_0x9659('0x19')]['find']({'where':_0x4795d1['options']?_0x4795d1[_0x9659('0x1c')][_0x9659('0x21')]||null:null})['then'](function(_0x1396e9){if(_0x1396e9){return _0x1396e9['addTags'](_0x4795d1[_0x9659('0x1b')][_0x9659('0x22')],_[_0x9659('0x23')](_0x4795d1[_0x9659('0x1b')],[_0x9659('0x22'),'id'])||{});}})[_0x9659('0x24')](function(_0x24f2a5){logger['info'](_0x9659('0x25'),_0x4795d1);logger[_0x9659('0x1f')](_0x9659('0x25'),_0x4795d1,JSON['stringify'](_0x24f2a5));_0x326e47(_0x24f2a5);})[_0x9659('0x17')](function(_0x1eac07){logger['error'](_0x9659('0x25'),_0x1eac07[_0x9659('0x15')],_0x4795d1);_0x5bf928(_this['error'](0x1f4,_0x1eac07[_0x9659('0x15')]));});});}; \ No newline at end of file +var _0x0efe=['socket.io-emitter','./mailInteraction.socket','register','then','MailInteraction,\x20%s,\x20%s','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','UpdateMailInteraction','update','body','options','where','attributes','limit','info','MailInteraction','find','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0efe,0x110));var _0xe0ef=function(_0x11ca5d,_0x388912){_0x11ca5d=_0x11ca5d-0x0;var _0x403237=_0x0efe[_0x11ca5d];return _0x403237;};'use strict';var _=require(_0xe0ef('0x0'));var util=require(_0xe0ef('0x1'));var moment=require('moment');var BPromise=require(_0xe0ef('0x2'));var rs=require(_0xe0ef('0x3'));var fs=require('fs');var Redis=require(_0xe0ef('0x4'));var db=require(_0xe0ef('0x5'))['db'];var utils=require(_0xe0ef('0x6'));var logger=require(_0xe0ef('0x7'))(_0xe0ef('0x8'));var config=require(_0xe0ef('0x9'));var jayson=require(_0xe0ef('0xa'));var client=jayson[_0xe0ef('0xb')]['http']({'port':0x232a});config['redis']=_[_0xe0ef('0xc')](config[_0xe0ef('0xd')],{'host':_0xe0ef('0xe'),'port':0x18eb});var socket=require(_0xe0ef('0xf'))(new Redis(config[_0xe0ef('0xd')]));require(_0xe0ef('0x10'))[_0xe0ef('0x11')](socket);function respondWithRpcPromise(_0x4ec5dd,_0x538d1f,_0x12e93a){return new BPromise(function(_0x62fd61,_0x1e000c){return client['request'](_0x4ec5dd,_0x12e93a)[_0xe0ef('0x12')](function(_0x14569f){logger['info'](_0xe0ef('0x13'),_0x538d1f,'request\x20sent');logger[_0xe0ef('0x14')](_0xe0ef('0x15'),_0x538d1f,_0xe0ef('0x16'),JSON['stringify'](_0x14569f));if(_0x14569f['error']){if(_0x14569f[_0xe0ef('0x17')][_0xe0ef('0x18')]===0x1f4){logger[_0xe0ef('0x17')](_0xe0ef('0x13'),_0x538d1f,_0x14569f[_0xe0ef('0x17')][_0xe0ef('0x19')]);return _0x1e000c(_0x14569f[_0xe0ef('0x17')][_0xe0ef('0x19')]);}logger['error'](_0xe0ef('0x13'),_0x538d1f,_0x14569f[_0xe0ef('0x17')][_0xe0ef('0x19')]);return _0x62fd61(_0x14569f[_0xe0ef('0x17')][_0xe0ef('0x19')]);}else{logger['info'](_0xe0ef('0x13'),_0x538d1f,_0xe0ef('0x16'));_0x62fd61(_0x14569f[_0xe0ef('0x1a')][_0xe0ef('0x19')]);}})[_0xe0ef('0x1b')](function(_0x214c7f){logger[_0xe0ef('0x17')](_0xe0ef('0x13'),_0x538d1f,_0x214c7f);_0x1e000c(_0x214c7f);});});}exports[_0xe0ef('0x1c')]=function(_0x270f57){var _0xae50eb=this;return new Promise(function(_0x1e0dd8,_0x450321){return db['MailInteraction'][_0xe0ef('0x1d')](_0x270f57[_0xe0ef('0x1e')],{'raw':_0x270f57[_0xe0ef('0x1f')]?_0x270f57[_0xe0ef('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x270f57[_0xe0ef('0x1f')]?_0x270f57[_0xe0ef('0x1f')][_0xe0ef('0x20')]||null:null,'attributes':_0x270f57[_0xe0ef('0x1f')]?_0x270f57[_0xe0ef('0x1f')][_0xe0ef('0x21')]||null:null,'limit':_0x270f57[_0xe0ef('0x1f')]?_0x270f57['options'][_0xe0ef('0x22')]||null:null})[_0xe0ef('0x12')](function(_0x5a44a9){logger[_0xe0ef('0x23')](_0xe0ef('0x1c'),_0x270f57);logger['debug']('UpdateMailInteraction',_0x270f57,JSON['stringify'](_0x5a44a9));_0x1e0dd8(_0x5a44a9);})[_0xe0ef('0x1b')](function(_0x4ee2c1){logger[_0xe0ef('0x17')](_0xe0ef('0x1c'),_0x4ee2c1[_0xe0ef('0x19')],_0x270f57);_0x450321(_0xae50eb['error'](0x1f4,_0x4ee2c1['message']));});});};exports['AddTagsToMailInteraction']=function(_0x2c4bfd){return new Promise(function(_0xa5839b,_0x3dd451){return db[_0xe0ef('0x24')][_0xe0ef('0x25')]({'where':_0x2c4bfd[_0xe0ef('0x1f')]?_0x2c4bfd['options']['where']||null:null})[_0xe0ef('0x12')](function(_0x5b840b){if(_0x5b840b){return _0x5b840b[_0xe0ef('0x26')](_0x2c4bfd[_0xe0ef('0x1e')]['ids'],_['omit'](_0x2c4bfd[_0xe0ef('0x1e')],[_0xe0ef('0x27'),'id'])||{});}})['spread'](function(_0x6c563d){logger[_0xe0ef('0x23')](_0xe0ef('0x28'),_0x2c4bfd);logger['debug']('AddTags',_0x2c4bfd,JSON['stringify'](_0x6c563d));_0xa5839b(_0x6c563d);})[_0xe0ef('0x1b')](function(_0x4987df){logger[_0xe0ef('0x17')](_0xe0ef('0x28'),_0x4987df['message'],_0x2c4bfd);_0x3dd451(_this[_0xe0ef('0x17')](0x1f4,_0x4987df[_0xe0ef('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 0d192a4..0e0b163 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 _0x3e38=['mailInteraction:','./mailInteraction.events','save','remove','update','emit','removeListener','register','length'];(function(_0x30f5bb,_0x4db4bd){var _0x1cfc00=function(_0x20f833){while(--_0x20f833){_0x30f5bb['push'](_0x30f5bb['shift']());}};_0x1cfc00(++_0x4db4bd);}(_0x3e38,0x1f0));var _0x83e3=function(_0x4adcf2,_0x73eafd){_0x4adcf2=_0x4adcf2-0x0;var _0x4e11d4=_0x3e38[_0x4adcf2];return _0x4e11d4;};'use strict';var MailInteractionEvents=require(_0x83e3('0x0'));var events=[_0x83e3('0x1'),_0x83e3('0x2'),_0x83e3('0x3')];function createListener(_0x22dc35,_0x48134b){return function(_0x36a0f9){_0x48134b[_0x83e3('0x4')](_0x22dc35,_0x36a0f9);};}function removeListener(_0x3e3db6,_0x10e5d0){return function(){MailInteractionEvents[_0x83e3('0x5')](_0x3e3db6,_0x10e5d0);};}exports[_0x83e3('0x6')]=function(_0x4e41f0){for(var _0x2795f4=0x0,_0x20a0fc=events[_0x83e3('0x7')];_0x2795f4<_0x20a0fc;_0x2795f4++){var _0x5137d4=events[_0x2795f4];var _0x75f659=createListener(_0x83e3('0x8')+_0x5137d4,_0x4e41f0);MailInteractionEvents['on'](_0x5137d4,_0x75f659);}}; \ No newline at end of file +var _0x91b9=['emit','removeListener','register','mailInteraction:','./mailInteraction.events','save','update'];(function(_0x1403e4,_0x32da59){var _0x82c02a=function(_0x431285){while(--_0x431285){_0x1403e4['push'](_0x1403e4['shift']());}};_0x82c02a(++_0x32da59);}(_0x91b9,0xeb));var _0x991b=function(_0x57d71f,_0x598a0e){_0x57d71f=_0x57d71f-0x0;var _0x2d1d26=_0x91b9[_0x57d71f];return _0x2d1d26;};'use strict';var MailInteractionEvents=require(_0x991b('0x0'));var events=[_0x991b('0x1'),'remove',_0x991b('0x2')];function createListener(_0x50cdfd,_0x410bdf){return function(_0x562c97){_0x410bdf[_0x991b('0x3')](_0x50cdfd,_0x562c97);};}function removeListener(_0x50d517,_0x4213bb){return function(){MailInteractionEvents[_0x991b('0x4')](_0x50d517,_0x4213bb);};}exports[_0x991b('0x5')]=function(_0x5b2d22){for(var _0x4efe69=0x0,_0x5408fd=events['length'];_0x4efe69<_0x5408fd;_0x4efe69++){var _0x130744=events[_0x4efe69];var _0x40aea0=createListener(_0x991b('0x6')+_0x130744,_0x5b2d22);MailInteractionEvents['on'](_0x130744,_0x40aea0);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 2373bd6..1aa90c9 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 _0x84ab=['reject','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./mailMessage.controller','get','isAuthenticated','/:id','show','/:id/download','download','mail','mailmessage:create','create','put','update','/:id/accept','accept','/:id/reject'];(function(_0x39ae29,_0x3a8d55){var _0x3c9af0=function(_0x2bf23b){while(--_0x2bf23b){_0x39ae29['push'](_0x39ae29['shift']());}};_0x3c9af0(++_0x3a8d55);}(_0x84ab,0x12f));var _0xb84a=function(_0x15fc3c,_0x35665b){_0x15fc3c=_0x15fc3c-0x0;var _0x94c5c8=_0x84ab[_0x15fc3c];return _0x94c5c8;};'use strict';var multer=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var path=require(_0xb84a('0x2'));var timeout=require(_0xb84a('0x3'));var express=require(_0xb84a('0x4'));var router=express['Router']();var auth=require(_0xb84a('0x5'));var interaction=require(_0xb84a('0x6'));var config=require('../../config/environment');var controller=require(_0xb84a('0x7'));router[_0xb84a('0x8')]('/',auth[_0xb84a('0x9')](),controller['index']);router['get']('/describe',auth[_0xb84a('0x9')](),controller['describe']);router[_0xb84a('0x8')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0xb')]);router['get'](_0xb84a('0xc'),auth[_0xb84a('0x9')](),controller[_0xb84a('0xd')]);router['post']('/',auth['isAuthenticated'](),interaction['tracked'](_0xb84a('0xe'),_0xb84a('0xf')),controller[_0xb84a('0x10')]);router[_0xb84a('0x11')](_0xb84a('0xa'),auth['isAuthenticated'](),controller[_0xb84a('0x12')]);router[_0xb84a('0x11')](_0xb84a('0x13'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x14')]);router[_0xb84a('0x11')](_0xb84a('0x15'),auth[_0xb84a('0x9')](),controller[_0xb84a('0x16')]);router[_0xb84a('0x17')](_0xb84a('0xa'),auth[_0xb84a('0x9')](),controller['destroy']);module[_0xb84a('0x18')]=router; \ No newline at end of file +var _0x008c=['./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/download','tracked','mailmessage:create','create','put','update','accept','/:id/reject','reject','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x53396d,_0x21e4a7){var _0x32e10f=function(_0x32d67b){while(--_0x32d67b){_0x53396d['push'](_0x53396d['shift']());}};_0x32e10f(++_0x21e4a7);}(_0x008c,0x188));var _0xc008=function(_0xa339a9,_0x342371){_0xa339a9=_0xa339a9-0x0;var _0x125a36=_0x008c[_0xa339a9];return _0x125a36;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var auth=require(_0xc008('0x5'));var interaction=require(_0xc008('0x6'));var config=require(_0xc008('0x7'));var controller=require(_0xc008('0x8'));router[_0xc008('0x9')]('/',auth[_0xc008('0xa')](),controller[_0xc008('0xb')]);router[_0xc008('0x9')](_0xc008('0xc'),auth['isAuthenticated'](),controller[_0xc008('0xd')]);router['get'](_0xc008('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xc008('0x9')](_0xc008('0xf'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth[_0xc008('0xa')](),interaction[_0xc008('0x10')]('mail',_0xc008('0x11')),controller[_0xc008('0x12')]);router[_0xc008('0x13')](_0xc008('0xe'),auth[_0xc008('0xa')](),controller[_0xc008('0x14')]);router[_0xc008('0x13')]('/:id/accept',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router['put'](_0xc008('0x16'),auth[_0xc008('0xa')](),controller[_0xc008('0x17')]);router[_0xc008('0x18')](_0xc008('0xe'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index e03e340..c1694b0 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 _0x5f2f=['BOOLEAN','out','STRING','INTEGER','DATE','sequelize','lodash','exports','TEXT','long','medium'];(function(_0x33d233,_0xa4d74){var _0x5e67d3=function(_0x5a958d){while(--_0x5a958d){_0x33d233['push'](_0x33d233['shift']());}};_0x5e67d3(++_0xa4d74);}(_0x5f2f,0x73));var _0xf5f2=function(_0x5acd55,_0x31fe62){_0x5acd55=_0x5acd55-0x0;var _0x72f7d5=_0x5f2f[_0x5acd55];return _0x72f7d5;};'use strict';var Sequelize=require(_0xf5f2('0x0'));var _=require(_0xf5f2('0x1'));module[_0xf5f2('0x2')]={'body':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x5'))},'read':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0xf5f2('0x7'),'allowNull':![]},'messageId':{'type':Sequelize[_0xf5f2('0x8')](0x1fe)},'from':{'type':Sequelize[_0xf5f2('0x8')]},'to':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'))},'cc':{'type':Sequelize[_0xf5f2('0x3')]('long')},'bcc':{'type':Sequelize[_0xf5f2('0x3')](_0xf5f2('0x4'))},'subject':{'type':Sequelize[_0xf5f2('0x3')]},'sentAt':{'type':Sequelize['DATE']},'attach':{'type':Sequelize[_0xf5f2('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xf5f2('0x6')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xf5f2('0xa')]},'originTo':{'type':Sequelize['TEXT'](_0xf5f2('0x4'))},'originCc':{'type':Sequelize['TEXT']('long')}}; \ No newline at end of file +var _0x2a07=['long','medium','BOOLEAN','ENUM','out','STRING','DATE','INTEGER','sequelize','lodash','exports','TEXT'];(function(_0x2dac1b,_0x2db6a9){var _0xc6541a=function(_0x3f0814){while(--_0x3f0814){_0x2dac1b['push'](_0x2dac1b['shift']());}};_0xc6541a(++_0x2db6a9);}(_0x2a07,0x74));var _0x72a0=function(_0x16bc92,_0x1b0935){_0x16bc92=_0x16bc92-0x0;var _0x27a2d2=_0x2a07[_0x16bc92];return _0x27a2d2;};'use strict';var Sequelize=require(_0x72a0('0x0'));var _=require(_0x72a0('0x1'));module[_0x72a0('0x2')]={'body':{'type':Sequelize[_0x72a0('0x3')](_0x72a0('0x4')),'allowNull':![]},'plainBody':{'type':Sequelize['TEXT'](_0x72a0('0x5'))},'read':{'type':Sequelize[_0x72a0('0x6')],'defaultValue':![]},'direction':{'type':Sequelize[_0x72a0('0x7')]('in',_0x72a0('0x8')),'defaultValue':_0x72a0('0x8'),'allowNull':![]},'messageId':{'type':Sequelize[_0x72a0('0x9')](0x1fe)},'from':{'type':Sequelize[_0x72a0('0x9')]},'to':{'type':Sequelize[_0x72a0('0x3')](_0x72a0('0x4'))},'cc':{'type':Sequelize[_0x72a0('0x3')](_0x72a0('0x4'))},'bcc':{'type':Sequelize[_0x72a0('0x3')](_0x72a0('0x4'))},'subject':{'type':Sequelize[_0x72a0('0x3')]},'sentAt':{'type':Sequelize[_0x72a0('0xa')]},'attach':{'type':Sequelize[_0x72a0('0xb')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0x72a0('0xa')]},'originTo':{'type':Sequelize[_0x72a0('0x3')]('long')},'originCc':{'type':Sequelize[_0x72a0('0x3')](_0x72a0('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index f37e1c0..442361d 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 _0xb420=['offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','MailMessage','count','includeAll','include','findAll','show','params','rawAttributes','body','find','describe','create','direction','secret','split','MailAccountId','CmList','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','host','port','secure','authentication','auth','user','service','attachments','join','root','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','format','UserId','Contact','get','MailInteraction','MailInteractionId','read1stAt','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','mail-interactions','role','RejectMessage','download','unix','toString','files','server','from','bcc','Attachment','subject','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','readFileSync','build','writeFileSync','log','err','unlinkSync','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../mysqldb','redis','defaults','localhost','register','jayson/promise','http','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','MailMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','sendStatus','status','json'];(function(_0x4fdfaf,_0x500b8d){var _0x55f36e=function(_0x4eb471){while(--_0x4eb471){_0x4fdfaf['push'](_0x4fdfaf['shift']());}};_0x55f36e(++_0x500b8d);}(_0xb420,0x1be));var _0x0b42=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xb420[_0x14add3];return _0x4a174f;};'use strict';var pdf=require(_0x0b42('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x0b42('0x1'));var jsonpatch=require(_0x0b42('0x2'));var rp=require(_0x0b42('0x3'));var moment=require(_0x0b42('0x4'));var BPromise=require(_0x0b42('0x5'));var Mustache=require(_0x0b42('0x6'));var util=require('util');var path=require(_0x0b42('0x7'));var sox=require(_0x0b42('0x8'));var csv=require(_0x0b42('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x0b42('0xa'));var squel=require(_0x0b42('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0b42('0xc'));var toCsv=require(_0x0b42('0x9'));var querystring=require(_0x0b42('0xd'));var Papa=require(_0x0b42('0xe'));var Redis=require('ioredis');var authService=require(_0x0b42('0xf'));var qs=require(_0x0b42('0x10'));var as=require(_0x0b42('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0b42('0x12'))(_0x0b42('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0b42('0x14'))['db'];config[_0x0b42('0x15')]=_[_0x0b42('0x16')](config[_0x0b42('0x15')],{'host':_0x0b42('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0b42('0x15')]));require('./mailMessage.socket')[_0x0b42('0x18')](socket);var jayson=require(_0x0b42('0x19'));var client=jayson['client'][_0x0b42('0x1a')]({'port':0x232c});var client9003=jayson[_0x0b42('0x1b')][_0x0b42('0x1a')]({'port':0x232b});var client9002=jayson[_0x0b42('0x1b')][_0x0b42('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x26c414,_0x7251ce,_0x336860){if(_0x336860){var _0x4bc7b8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4bc7b8[_0x0b42('0x1c')](_0x7251ce)){return _0x26c414;}else{throw new db['Sequelize']['ValidationError'](_0x0b42('0x1d'));}}else{return _0x26c414;}}function respondWithRpcPromise(_0x5e1959,_0x2a2353,_0x29a5c2,_0x15fd00){return new BPromise(function(_0x1e2f1e,_0x43d520){var _0x2092f5=_0x15fd00||client;return _0x2092f5[_0x0b42('0x1e')](_0x5e1959,_0x29a5c2)['then'](function(_0x3a4af9){logger['info'](_0x0b42('0x1f'),_0x2a2353,_0x0b42('0x20'));logger[_0x0b42('0x21')]('MailMessage,\x20%s,\x20%s,\x20%s',_0x2a2353,_0x0b42('0x20'),JSON[_0x0b42('0x22')](_0x3a4af9));if(_0x3a4af9['error']){if(_0x3a4af9[_0x0b42('0x23')]['code']===0x1f4){logger[_0x0b42('0x23')](_0x0b42('0x1f'),_0x2a2353,_0x3a4af9[_0x0b42('0x23')][_0x0b42('0x24')]);return _0x43d520(_0x3a4af9[_0x0b42('0x23')][_0x0b42('0x24')]);}logger[_0x0b42('0x23')](_0x0b42('0x1f'),_0x2a2353,_0x3a4af9[_0x0b42('0x23')][_0x0b42('0x24')]);return _0x1e2f1e(_0x3a4af9['error'][_0x0b42('0x24')]);}else{logger[_0x0b42('0x25')]('MailMessage,\x20%s,\x20%s',_0x2a2353,'request\x20sent');_0x1e2f1e(_0x3a4af9[_0x0b42('0x26')]['message']);}})[_0x0b42('0x27')](function(_0xae9eaa){logger[_0x0b42('0x23')](_0x0b42('0x1f'),_0x2a2353,_0xae9eaa);_0x43d520(_0xae9eaa);});});}function respondWithStatusCode(_0x54711f,_0x57beb5){_0x57beb5=_0x57beb5||0xcc;return function(_0x11b584){if(_0x11b584){return _0x54711f[_0x0b42('0x28')](_0x57beb5);}return _0x54711f[_0x0b42('0x29')](_0x57beb5)['end']();};}function respondWithResult(_0x4eb4a2,_0x230d21){_0x230d21=_0x230d21||0xc8;return function(_0x380f4f){if(_0x380f4f){return _0x4eb4a2[_0x0b42('0x29')](_0x230d21)[_0x0b42('0x2a')](_0x380f4f);}};}function respondWithFilteredResult(_0x3a4a9a,_0x35978b){return function(_0x7e3341){if(_0x7e3341){var _0x1afdad=_0x7e3341['count'],_0x512340=_0x35978b[_0x0b42('0x2b')],_0x354fac=_0x35978b[_0x0b42('0x2b')]+_0x35978b[_0x0b42('0x2c')],_0x4a2f8b;if(_0x354fac>=_0x1afdad){_0x354fac=_0x1afdad;_0x4a2f8b=0xc8;}else{_0x4a2f8b=0xce;}_0x3a4a9a[_0x0b42('0x29')](_0x4a2f8b);return _0x3a4a9a[_0x0b42('0x2d')](_0x0b42('0x2e'),_0x512340+'-'+_0x354fac+'/'+_0x1afdad)[_0x0b42('0x2a')](_0x7e3341);}return null;};}function patchUpdates(_0x13a9df){return function(_0x418d6a){try{jsonpatch[_0x0b42('0x2f')](_0x418d6a,_0x13a9df,!![]);}catch(_0x5ef5be){return BPromise[_0x0b42('0x30')](_0x5ef5be);}return _0x418d6a[_0x0b42('0x31')]();};}function saveUpdates(_0x38a33a,_0x227245){return function(_0x5e4d12){if(_0x5e4d12){return _0x5e4d12[_0x0b42('0x32')](_0x38a33a)[_0x0b42('0x33')](function(_0x161ba4){return _0x161ba4;});}return null;};}function removeEntity(_0x3cc351,_0x2ed7a3){return function(_0xbc7c92){if(_0xbc7c92){return _0xbc7c92[_0x0b42('0x34')]()['then'](function(){_0x3cc351[_0x0b42('0x29')](0xcc)[_0x0b42('0x35')]();});}};}function handleEntityNotFound(_0x2aedb2,_0x9f2417){return function(_0x4391a3){if(!_0x4391a3){_0x2aedb2[_0x0b42('0x28')](0x194);}return _0x4391a3;};}function handleError(_0x45d042,_0x34525b){_0x34525b=_0x34525b||0x1f4;return function(_0x5a0c30){logger['error'](_0x5a0c30[_0x0b42('0x36')]);if(_0x5a0c30[_0x0b42('0x37')]){delete _0x5a0c30['name'];}_0x45d042[_0x0b42('0x29')](_0x34525b)[_0x0b42('0x38')](_0x5a0c30);};}exports[_0x0b42('0x39')]=function(_0x43bc7f,_0x3c80e8){var _0x33b386={},_0x3937cb={},_0xee00db={'count':0x0,'rows':[]};var _0x2d350e=_[_0x0b42('0x3a')](db['MailMessage']['rawAttributes'],function(_0x58d6d0){return{'name':_0x58d6d0['fieldName'],'type':_0x58d6d0[_0x0b42('0x3b')][_0x0b42('0x3c')]};});_0x3937cb[_0x0b42('0x3d')]=_[_0x0b42('0x3a')](_0x2d350e,_0x0b42('0x37'));_0x3937cb[_0x0b42('0x3e')]=_[_0x0b42('0x3f')](_0x43bc7f[_0x0b42('0x3e')]);_0x3937cb[_0x0b42('0x40')]=_[_0x0b42('0x41')](_0x3937cb[_0x0b42('0x3d')],_0x3937cb['query']);_0x33b386[_0x0b42('0x42')]=_[_0x0b42('0x41')](_0x3937cb[_0x0b42('0x3d')],qs[_0x0b42('0x43')](_0x43bc7f[_0x0b42('0x3e')][_0x0b42('0x43')]));_0x33b386[_0x0b42('0x42')]=_0x33b386[_0x0b42('0x42')][_0x0b42('0x44')]?_0x33b386[_0x0b42('0x42')]:_0x3937cb[_0x0b42('0x3d')];if(!_0x43bc7f[_0x0b42('0x3e')]['hasOwnProperty'](_0x0b42('0x45'))){_0x33b386[_0x0b42('0x2c')]=qs[_0x0b42('0x2c')](_0x43bc7f[_0x0b42('0x3e')]['limit']);_0x33b386[_0x0b42('0x2b')]=qs['offset'](_0x43bc7f[_0x0b42('0x3e')][_0x0b42('0x2b')]);}_0x33b386[_0x0b42('0x46')]=qs['sort'](_0x43bc7f['query'][_0x0b42('0x47')]);_0x33b386[_0x0b42('0x48')]=qs['filters'](_[_0x0b42('0x49')](_0x43bc7f[_0x0b42('0x3e')],_0x3937cb[_0x0b42('0x40')]));if(_0x43bc7f[_0x0b42('0x3e')][_0x0b42('0x4a')]){_0x33b386['where']=_[_0x0b42('0x4b')](_0x33b386['where'],{'$or':_[_0x0b42('0x3a')](_0x2d350e,function(_0x588fa2){if(_0x588fa2[_0x0b42('0x3b')]!=='VIRTUAL'){var _0x59b5c8={};_0x59b5c8[_0x588fa2['name']]={'$like':'%'+_0x43bc7f['query'][_0x0b42('0x4a')]+'%'};return _0x59b5c8;}})});}_0x33b386=_['merge']({},_0x33b386,_0x43bc7f[_0x0b42('0x4c')]);var _0x16e998={'where':_0x33b386[_0x0b42('0x48')]};return db[_0x0b42('0x4d')][_0x0b42('0x4e')](_0x16e998)[_0x0b42('0x33')](function(_0x4cd5b9){_0xee00db[_0x0b42('0x4e')]=_0x4cd5b9;if(_0x43bc7f['query'][_0x0b42('0x4f')]){_0x33b386[_0x0b42('0x50')]=[{'all':!![]}];}return db[_0x0b42('0x4d')][_0x0b42('0x51')](_0x33b386);})[_0x0b42('0x33')](function(_0xd2b3b2){_0xee00db['rows']=_0xd2b3b2;return _0xee00db;})[_0x0b42('0x33')](respondWithFilteredResult(_0x3c80e8,_0x33b386))[_0x0b42('0x27')](handleError(_0x3c80e8,null));};exports[_0x0b42('0x52')]=function(_0x44790c,_0x2dbe92){var _0xcfae84={'raw':!![],'where':{'id':_0x44790c[_0x0b42('0x53')]['id']}},_0x221951={};_0x221951['model']=_['keys'](db[_0x0b42('0x4d')][_0x0b42('0x54')]);_0x221951[_0x0b42('0x3e')]=_[_0x0b42('0x3f')](_0x44790c[_0x0b42('0x3e')]);_0x221951[_0x0b42('0x40')]=_[_0x0b42('0x41')](_0x221951[_0x0b42('0x3d')],_0x221951[_0x0b42('0x3e')]);_0xcfae84[_0x0b42('0x42')]=_[_0x0b42('0x41')](_0x221951[_0x0b42('0x3d')],qs[_0x0b42('0x43')](_0x44790c[_0x0b42('0x3e')]['fields']));_0xcfae84[_0x0b42('0x42')]=_0xcfae84[_0x0b42('0x42')][_0x0b42('0x44')]?_0xcfae84[_0x0b42('0x42')]:_0x221951['model'];if(_0x44790c[_0x0b42('0x3e')][_0x0b42('0x4f')]){_0xcfae84[_0x0b42('0x50')]=[{'all':!![]}];}_0xcfae84=_[_0x0b42('0x4b')]({},_0xcfae84,_0x44790c[_0x0b42('0x4c')]);return db[_0x0b42('0x4d')]['find'](_0xcfae84)[_0x0b42('0x33')](handleEntityNotFound(_0x2dbe92,null))[_0x0b42('0x33')](respondWithResult(_0x2dbe92,null))[_0x0b42('0x27')](handleError(_0x2dbe92,null));};exports[_0x0b42('0x32')]=function(_0x53d39e,_0x202466){if(_0x53d39e[_0x0b42('0x55')]['id']){delete _0x53d39e[_0x0b42('0x55')]['id'];}return db[_0x0b42('0x4d')][_0x0b42('0x56')]({'where':{'id':_0x53d39e[_0x0b42('0x53')]['id']}})[_0x0b42('0x33')](handleEntityNotFound(_0x202466,null))[_0x0b42('0x33')](saveUpdates(_0x53d39e[_0x0b42('0x55')],null))['then'](respondWithResult(_0x202466,null))[_0x0b42('0x27')](handleError(_0x202466,null));};exports[_0x0b42('0x34')]=function(_0x195aa0,_0x37c18e){return db[_0x0b42('0x4d')][_0x0b42('0x56')]({'where':{'id':_0x195aa0[_0x0b42('0x53')]['id']}})[_0x0b42('0x33')](handleEntityNotFound(_0x37c18e,null))[_0x0b42('0x33')](removeEntity(_0x37c18e,null))[_0x0b42('0x27')](handleError(_0x37c18e,null));};exports[_0x0b42('0x57')]=function(_0x5b9469,_0x257bf8){return db[_0x0b42('0x4d')]['describe']()[_0x0b42('0x33')](respondWithResult(_0x257bf8,null))[_0x0b42('0x27')](handleError(_0x257bf8,null));};exports['create']=function(_0x1a0a15,_0x459558){return db[_0x0b42('0x4d')][_0x0b42('0x58')](_0x1a0a15[_0x0b42('0x55')])[_0x0b42('0x33')](function(_0x9e08e0){if(_0x9e08e0){if(_0x9e08e0[_0x0b42('0x59')]==='out'&&!_0x9e08e0[_0x0b42('0x5a')]){var _0x299347,_0x1aed0d,_0x4e4a4a;if(_0x1a0a15[_0x0b42('0x55')]['to']){_0x1aed0d=_0x1a0a15['body']['to'][_0x0b42('0x5b')](',')[0x0];}return db['MailAccount']['findOne']({'where':{'id':_0x9e08e0[_0x0b42('0x5c')]},'include':[{'model':db[_0x0b42('0x5d')],'as':'List','include':[{'model':db[_0x0b42('0x5e')],'as':_0x0b42('0x5f'),'where':{'email':_0x1aed0d},'limit':0x1,'order':[[_0x0b42('0x60'),_0x0b42('0x61')]]}]},{'model':db['MailServerOut'],'as':_0x0b42('0x62'),'raw':!![]}]})[_0x0b42('0x33')](function(_0xf7ea1d){_0x299347=_0xf7ea1d;if(_0x299347&&_0x299347[_0x0b42('0x62')]){var _0x2544d8={'tls':{'rejectUnauthorized':![]}};if(_[_0x0b42('0x63')](_0x299347[_0x0b42('0x62')]['service'])){_0x2544d8['host']=_0x299347[_0x0b42('0x62')][_0x0b42('0x64')];_0x2544d8[_0x0b42('0x65')]=_0x299347[_0x0b42('0x62')][_0x0b42('0x65')];_0x2544d8[_0x0b42('0x66')]=_0x299347[_0x0b42('0x62')][_0x0b42('0x66')];if(_0x299347['Smtp'][_0x0b42('0x67')]){_0x2544d8[_0x0b42('0x68')]={'user':_0x299347[_0x0b42('0x62')][_0x0b42('0x69')],'pass':_0x299347[_0x0b42('0x62')]['pass']};}}else{_0x2544d8[_0x0b42('0x6a')]=_0x299347[_0x0b42('0x62')][_0x0b42('0x6a')];_0x2544d8['auth']={'user':_0x299347[_0x0b42('0x62')][_0x0b42('0x69')],'pass':_0x299347[_0x0b42('0x62')]['pass']};_0x2544d8[_0x0b42('0x66')]=_0x299347[_0x0b42('0x62')][_0x0b42('0x66')];}if(_0x1a0a15[_0x0b42('0x55')]['attachments']&&_0x1a0a15[_0x0b42('0x55')][_0x0b42('0x6b')][_0x0b42('0x44')]){for(var _0x2e5731=0x0;_0x2e5731<_0x1a0a15[_0x0b42('0x55')][_0x0b42('0x6b')][_0x0b42('0x44')];_0x2e5731+=0x1){_0x1a0a15[_0x0b42('0x55')]['attachments'][_0x2e5731]={'filename':_0x1a0a15[_0x0b42('0x55')][_0x0b42('0x6b')][_0x2e5731][_0x0b42('0x37')],'path':path[_0x0b42('0x6c')](config[_0x0b42('0x6d')],'server/files/attachments',_0x1a0a15[_0x0b42('0x55')][_0x0b42('0x6b')][_0x2e5731][_0x0b42('0x6e')])};}}_0x4e4a4a={'account':_0x2544d8,'message':_0x1a0a15[_0x0b42('0x55')]};return;}})['then'](function(){if(_0x299347[_0x0b42('0x6f')]){if(_0x299347['List'][_0x0b42('0x5f')][_0x0b42('0x44')]){return _0x299347[_0x0b42('0x6f')][_0x0b42('0x5f')][0x0];}else{return db[_0x0b42('0x5e')][_0x0b42('0x58')](_['defaults'](_0x1a0a15[_0x0b42('0x55')],{'firstName':_0x1a0a15[_0x0b42('0x55')]['to'],'email':_0x1a0a15[_0x0b42('0x55')]['to'],'phone':_0x1a0a15[_0x0b42('0x55')]['to'],'ListId':_0x299347[_0x0b42('0x70')]}));}}else{throw new Error(_0x0b42('0x71'));}})[_0x0b42('0x33')](function(){if(_0x4e4a4a){return respondWithRpcPromise(_0x0b42('0x72'),_0x0b42('0x73'),_0x4e4a4a,client9003)[_0x0b42('0x33')](function(_0x18d78b){return _0x9e08e0['update']({'read':!![],'messageId':_0x18d78b['messageId'],'sentAt':moment()['format'](_0x0b42('0x74'))});})[_0x0b42('0x27')](function(_0x1d12b3){logger['error']('%s',JSON[_0x0b42('0x22')](_0x1d12b3));return _0x9e08e0;});}return _0x9e08e0;});}return _0x9e08e0;}})[_0x0b42('0x33')](respondWithResult(_0x459558,0xc9))[_0x0b42('0x27')](handleError(_0x459558,null));};var interaction_log=require(_0x0b42('0x12'))('mail-interactions');exports[_0x0b42('0x75')]=function(_0x492d0f,_0x167c87,_0x900e63){var _0x5b6023={'channel':_0x0b42('0x76')};if(_0x492d0f[_0x0b42('0x55')]['id']){delete _0x492d0f[_0x0b42('0x55')]['id'];}_0x492d0f[_0x0b42('0x55')][_0x0b42('0x77')]=!![];_0x492d0f[_0x0b42('0x55')][_0x0b42('0x78')]=moment()[_0x0b42('0x79')](_0x0b42('0x74'));_0x492d0f['body'][_0x0b42('0x7a')]=_0x492d0f['body']['UserId']||_0x492d0f[_0x0b42('0x69')]['id'];return db[_0x0b42('0x4d')]['find']({'where':{'id':_0x492d0f[_0x0b42('0x53')]['id'],'UserId':null},'include':[{'model':db[_0x0b42('0x5e')],'as':_0x0b42('0x7b')}]})[_0x0b42('0x33')](handleEntityNotFound(_0x167c87,null))['then'](saveUpdates(_0x492d0f[_0x0b42('0x55')],null))[_0x0b42('0x33')](function(_0x3f8e2d){if(_0x3f8e2d){_0x5b6023[_0x0b42('0x24')]=_0x3f8e2d[_0x0b42('0x7c')]({'plain':!![]});return db[_0x0b42('0x7d')][_0x0b42('0x56')]({'where':{'id':_0x3f8e2d[_0x0b42('0x7e')]}});}return null;})['then'](handleEntityNotFound(_0x167c87,null))['then'](function(_0xe1fec){if(_0xe1fec){return _0xe1fec[_0x0b42('0x32')]({'UserId':_0x492d0f[_0x0b42('0x55')][_0x0b42('0x7a')],'read1stAt':_[_0x0b42('0x63')](_0xe1fec[_0x0b42('0x7f')])?moment()[_0x0b42('0x79')](_0x0b42('0x74')):undefined});}return null;})[_0x0b42('0x33')](function(_0x4d4d0c){if(_0x4d4d0c){_0x5b6023[_0x0b42('0x80')]=_0x4d4d0c['get']({'plain':!![]});interaction_log['info'](_0x0b42('0x81'),_0x492d0f[_0x0b42('0x69')]['id'],_0x492d0f['user'][_0x0b42('0x37')],_0x492d0f[_0x0b42('0x69')]['role'],_0x5b6023[_0x0b42('0x80')]['id'],_0x492d0f[_0x0b42('0x55')]?JSON['stringify'](_0x492d0f['body']):_0x0b42('0x82'));return respondWithRpcPromise(_0x0b42('0x83'),'acceptMessage',_0x5b6023);}return null;})[_0x0b42('0x33')](function(_0x4f1ff5){if(_0x4f1ff5){if(_0x492d0f[_0x0b42('0x55')][_0x0b42('0x84')]){_0x5b6023[_0x0b42('0x24')][_0x0b42('0x85')]=util[_0x0b42('0x79')](_0x0b42('0x86'),_0x492d0f[_0x0b42('0x69')][_0x0b42('0x37')]);_0x5b6023[_0x0b42('0x24')][_0x0b42('0x87')]=_0x5b6023['channel'];_0x5b6023[_0x0b42('0x24')][_0x0b42('0x88')]='accept';return respondWithRpcPromise(_0x0b42('0x89'),_0x0b42('0x89'),{'event':_0x0b42('0x8a'),'message':_0x5b6023[_0x0b42('0x24')]},client9002)[_0x0b42('0x33')](function(){return _0x5b6023;});}return _0x5b6023;}return null;})[_0x0b42('0x33')](respondWithResult(_0x167c87,null))[_0x0b42('0x27')](handleError(_0x167c87,null));};var interaction_log=require(_0x0b42('0x12'))(_0x0b42('0x8b'));exports['reject']=function(_0x60fc34,_0xfdd67f,_0x4fc8a7){var _0x2bb0bd={'agent':{},'channel':_0x0b42('0x76')};if(_0x60fc34['body']['id']){delete _0x60fc34[_0x0b42('0x55')]['id'];}_0x60fc34[_0x0b42('0x55')]['UserId']=_0x60fc34[_0x0b42('0x55')][_0x0b42('0x7a')]||_0x60fc34[_0x0b42('0x69')]['id'];_0x2bb0bd['agent']['id']=_0x60fc34[_0x0b42('0x55')]['UserId'];return db[_0x0b42('0x4d')][_0x0b42('0x56')]({'where':{'id':_0x60fc34['params']['id'],'UserId':null}})[_0x0b42('0x33')](handleEntityNotFound(_0xfdd67f,null))['then'](function(_0xa07156){if(_0xa07156){_0x2bb0bd[_0x0b42('0x24')]=_0xa07156['get']({'plain':!![]});return db[_0x0b42('0x7d')][_0x0b42('0x56')]({'where':{'id':_0xa07156[_0x0b42('0x7e')]}});}return null;})[_0x0b42('0x33')](handleEntityNotFound(_0xfdd67f,null))[_0x0b42('0x33')](function(_0x45f574){if(_0x45f574){_0x2bb0bd['interaction']=_0x45f574[_0x0b42('0x7c')]({'plain':!![]});interaction_log[_0x0b42('0x25')]('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x60fc34['user']['id'],_0x60fc34[_0x0b42('0x69')][_0x0b42('0x37')],_0x60fc34[_0x0b42('0x69')][_0x0b42('0x8c')],_0x2bb0bd['interaction']['id'],_0x60fc34[_0x0b42('0x55')]?JSON[_0x0b42('0x22')](_0x60fc34['body']):'null');return respondWithRpcPromise(_0x0b42('0x8d'),'rejectMessage',_0x2bb0bd);}return null;})[_0x0b42('0x33')](function(_0x3fee52){if(_0x3fee52){_0x3fee52[_0x0b42('0x24')][_0x0b42('0x85')]=util[_0x0b42('0x79')](_0x0b42('0x86'),_0x60fc34[_0x0b42('0x69')]['name']);_0x3fee52[_0x0b42('0x24')][_0x0b42('0x87')]=_0x2bb0bd[_0x0b42('0x87')];_0x3fee52[_0x0b42('0x24')][_0x0b42('0x88')]=_0x0b42('0x30');respondWithRpcPromise(_0x0b42('0x89'),'EventManager',{'event':'rejectmessage','message':_0x3fee52[_0x0b42('0x24')]},client9002);return _0x2bb0bd;}return null;})['then'](respondWithResult(_0xfdd67f,null))[_0x0b42('0x27')](handleError(_0xfdd67f,null));};exports[_0x0b42('0x8e')]=function(_0x42841c,_0x29ba6b){var _0x36341a=moment()[_0x0b42('0x8f')]()[_0x0b42('0x90')]();var _0x18e6bc=path[_0x0b42('0x6c')](config[_0x0b42('0x6d')],'server',_0x0b42('0x91'),'tmp');var _0x4ef78d=path[_0x0b42('0x6c')](config['root'],_0x0b42('0x92'),'files',_0x0b42('0x6b'));var _0x2c5de4=util['format']('message-%s.eml',_0x36341a);return db[_0x0b42('0x4d')][_0x0b42('0x56')]({'where':{'id':_0x42841c[_0x0b42('0x53')]['id']},'attributes':['id','body',_0x0b42('0x93'),'to','cc',_0x0b42('0x94'),'subject','createdAt'],'include':_0x42841c[_0x0b42('0x3e')][_0x0b42('0x6b')]?[{'model':db[_0x0b42('0x95')],'as':'Attachments'}]:undefined})[_0x0b42('0x33')](handleEntityNotFound(_0x29ba6b,null))[_0x0b42('0x33')](function(_0x2bb669){if(_0x2bb669){var _0x4b26a8=_0x2bb669;var _0x586e05={'from':_0x4b26a8[_0x0b42('0x93')],'to':_0x4b26a8['to'],'subject':_0x4b26a8[_0x0b42('0x96')],'html':_0x4b26a8['body'],'headers':{'Date':moment(_0x4b26a8[_0x0b42('0x97')])[_0x0b42('0x79')](_0x0b42('0x98'))},'attachments':[]};if(_0x2bb669['cc']){_0x586e05[_0x0b42('0x99')]['Cc']=_0x2bb669['cc'];}if(_0x2bb669[_0x0b42('0x94')]){_0x586e05[_0x0b42('0x99')][_0x0b42('0x9a')]=_0x2bb669[_0x0b42('0x94')];}return new BPromise(function(_0x27beab,_0x59bb7b){if(_0x2bb669[_0x0b42('0x9b')]){for(var _0x19293d=0x0;_0x19293d<_0x2bb669[_0x0b42('0x9b')][_0x0b42('0x44')];_0x19293d++){var _0x1bbc66=_0x2bb669[_0x0b42('0x9b')][_0x19293d];var _0x45e323=path[_0x0b42('0x6c')](_0x4ef78d,_0x1bbc66['basename']);if(fs[_0x0b42('0x9c')](_0x45e323)){_0x586e05[_0x0b42('0x6b')]['push']({'name':_0x1bbc66[_0x0b42('0x37')],'contentType':_0x1bbc66['type'],'data':fs[_0x0b42('0x9d')](_0x45e323)});}}}emlformat[_0x0b42('0x9e')](_0x586e05,function(_0x190095,_0x3e4ff7){if(_0x190095)return _0x59bb7b(_0x190095);fs[_0x0b42('0x9f')](path[_0x0b42('0x6c')](_0x18e6bc,_0x2c5de4),_0x3e4ff7);return _0x27beab(_0x3e4ff7);});});}})['then'](function(_0x25c303){if(_0x25c303){return _0x29ba6b[_0x0b42('0x8e')](path[_0x0b42('0x6c')](_0x18e6bc,_0x2c5de4),_0x2c5de4,function(_0x2485b3){if(_0x2485b3){console[_0x0b42('0xa0')](_0x0b42('0xa1'),_0x2485b3);}else{fs[_0x0b42('0xa2')](path[_0x0b42('0x6c')](_0x18e6bc,_0x2c5de4));}});}})[_0x0b42('0x27')](handleError(_0x29ba6b,null));}; \ No newline at end of file +var _0x4981=['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','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','count','offset','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','includeAll','include','MailMessage','catch','show','params','find','body','describe','create','direction','out','secret','split','MailAccount','findOne','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','MailServerOut','isNil','Smtp','host','port','secure','authentication','user','pass','service','auth','attachments','join','server/files/attachments','basename','ListId','SendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','../../config/logger','mail-interactions','accept','mail','UserId','get','MailInteraction','MailInteractionId','interaction','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','agent','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','unix','toString','root','server','tmp','files','from','bcc','subject','createdAt','Attachment','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Attachments','existsSync','push','build','writeFileSync','download','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x323baa,_0x4d4692){var _0x4b96de=function(_0xcb5414){while(--_0xcb5414){_0x323baa['push'](_0x323baa['shift']());}};_0x4b96de(++_0x4d4692);}(_0x4981,0x132));var _0x1498=function(_0x45c4ab,_0x5701c6){_0x45c4ab=_0x45c4ab-0x0;var _0x3d3775=_0x4981[_0x45c4ab];return _0x3d3775;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1498('0x0'));var rimraf=require(_0x1498('0x1'));var zipdir=require(_0x1498('0x2'));var jsonpatch=require(_0x1498('0x3'));var rp=require(_0x1498('0x4'));var moment=require(_0x1498('0x5'));var BPromise=require(_0x1498('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1498('0x7'));var sox=require(_0x1498('0x8'));var csv=require(_0x1498('0x9'));var ejs=require(_0x1498('0xa'));var fs=require('fs');var _=require(_0x1498('0xb'));var squel=require(_0x1498('0xc'));var crypto=require(_0x1498('0xd'));var jsforce=require(_0x1498('0xe'));var deskjs=require(_0x1498('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1498('0x10'));var Papa=require('papaparse');var Redis=require(_0x1498('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x1498('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1498('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x1498('0x14'))['db'];config[_0x1498('0x15')]=_[_0x1498('0x16')](config[_0x1498('0x15')],{'host':_0x1498('0x17'),'port':0x18eb});var socket=require(_0x1498('0x18'))(new Redis(config[_0x1498('0x15')]));require('./mailMessage.socket')[_0x1498('0x19')](socket);var jayson=require('jayson/promise');var client=jayson['client'][_0x1498('0x1a')]({'port':0x232c});var client9003=jayson['client'][_0x1498('0x1a')]({'port':0x232b});var client9002=jayson['client'][_0x1498('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x4ac207,_0x2e3d99,_0x5d7d45){if(_0x5d7d45){var _0xef8d63=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xef8d63[_0x1498('0x1b')](_0x2e3d99)){return _0x4ac207;}else{throw new db['Sequelize']['ValidationError'](_0x1498('0x1c'));}}else{return _0x4ac207;}}function respondWithRpcPromise(_0x3e1a24,_0x45ea4a,_0x4019b1,_0x291fb4){return new BPromise(function(_0xc9a4c1,_0x3ed468){var _0x3132d9=_0x291fb4||client;return _0x3132d9[_0x1498('0x1d')](_0x3e1a24,_0x4019b1)[_0x1498('0x1e')](function(_0xcd38f0){logger[_0x1498('0x1f')](_0x1498('0x20'),_0x45ea4a,_0x1498('0x21'));logger[_0x1498('0x22')](_0x1498('0x23'),_0x45ea4a,_0x1498('0x21'),JSON['stringify'](_0xcd38f0));if(_0xcd38f0[_0x1498('0x24')]){if(_0xcd38f0[_0x1498('0x24')][_0x1498('0x25')]===0x1f4){logger[_0x1498('0x24')](_0x1498('0x20'),_0x45ea4a,_0xcd38f0['error'][_0x1498('0x26')]);return _0x3ed468(_0xcd38f0['error'][_0x1498('0x26')]);}logger['error'](_0x1498('0x20'),_0x45ea4a,_0xcd38f0[_0x1498('0x24')][_0x1498('0x26')]);return _0xc9a4c1(_0xcd38f0['error'][_0x1498('0x26')]);}else{logger['info'](_0x1498('0x20'),_0x45ea4a,_0x1498('0x21'));_0xc9a4c1(_0xcd38f0[_0x1498('0x27')][_0x1498('0x26')]);}})['catch'](function(_0x14e5b3){logger[_0x1498('0x24')](_0x1498('0x20'),_0x45ea4a,_0x14e5b3);_0x3ed468(_0x14e5b3);});});}function respondWithStatusCode(_0x25f6cf,_0x3772ea){_0x3772ea=_0x3772ea||0xcc;return function(_0x374624){if(_0x374624){return _0x25f6cf[_0x1498('0x28')](_0x3772ea);}return _0x25f6cf[_0x1498('0x29')](_0x3772ea)[_0x1498('0x2a')]();};}function respondWithResult(_0x1f0ce3,_0x5eb083){_0x5eb083=_0x5eb083||0xc8;return function(_0x296977){if(_0x296977){return _0x1f0ce3[_0x1498('0x29')](_0x5eb083)[_0x1498('0x2b')](_0x296977);}};}function respondWithFilteredResult(_0x399744,_0x4c7c31){return function(_0x76d4b9){if(_0x76d4b9){var _0x5151a7=_0x76d4b9[_0x1498('0x2c')],_0x893883=_0x4c7c31[_0x1498('0x2d')],_0x3e50ad=_0x4c7c31['offset']+_0x4c7c31['limit'],_0x5569ed;if(_0x3e50ad>=_0x5151a7){_0x3e50ad=_0x5151a7;_0x5569ed=0xc8;}else{_0x5569ed=0xce;}_0x399744[_0x1498('0x29')](_0x5569ed);return _0x399744['set'](_0x1498('0x2e'),_0x893883+'-'+_0x3e50ad+'/'+_0x5151a7)[_0x1498('0x2b')](_0x76d4b9);}return null;};}function patchUpdates(_0x239b04){return function(_0x3c5cf2){try{jsonpatch[_0x1498('0x2f')](_0x3c5cf2,_0x239b04,!![]);}catch(_0x53d495){return BPromise[_0x1498('0x30')](_0x53d495);}return _0x3c5cf2[_0x1498('0x31')]();};}function saveUpdates(_0x43f102,_0x4fe018){return function(_0x29f2e8){if(_0x29f2e8){return _0x29f2e8[_0x1498('0x32')](_0x43f102)[_0x1498('0x1e')](function(_0x19b064){return _0x19b064;});}return null;};}function removeEntity(_0x56046f,_0x23ff0e){return function(_0xf39dd8){if(_0xf39dd8){return _0xf39dd8[_0x1498('0x33')]()['then'](function(){_0x56046f[_0x1498('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x17dd20,_0x2d3e46){return function(_0x2e2c8f){if(!_0x2e2c8f){_0x17dd20[_0x1498('0x28')](0x194);}return _0x2e2c8f;};}function handleError(_0x33cebe,_0x73a1a0){_0x73a1a0=_0x73a1a0||0x1f4;return function(_0x1b87ea){logger[_0x1498('0x24')](_0x1b87ea[_0x1498('0x34')]);if(_0x1b87ea[_0x1498('0x35')]){delete _0x1b87ea[_0x1498('0x35')];}_0x33cebe[_0x1498('0x29')](_0x73a1a0)[_0x1498('0x36')](_0x1b87ea);};}exports[_0x1498('0x37')]=function(_0x3a9f87,_0x3f1b9f){var _0x550202={},_0x27b44e={},_0x419a77={'count':0x0,'rows':[]};var _0x4783db=_['map'](db['MailMessage'][_0x1498('0x38')],function(_0x44a9d0){return{'name':_0x44a9d0['fieldName'],'type':_0x44a9d0[_0x1498('0x39')][_0x1498('0x3a')]};});_0x27b44e[_0x1498('0x3b')]=_['map'](_0x4783db,_0x1498('0x35'));_0x27b44e['query']=_[_0x1498('0x3c')](_0x3a9f87[_0x1498('0x3d')]);_0x27b44e[_0x1498('0x3e')]=_[_0x1498('0x3f')](_0x27b44e[_0x1498('0x3b')],_0x27b44e[_0x1498('0x3d')]);_0x550202['attributes']=_[_0x1498('0x3f')](_0x27b44e[_0x1498('0x3b')],qs['fields'](_0x3a9f87[_0x1498('0x3d')][_0x1498('0x40')]));_0x550202[_0x1498('0x41')]=_0x550202['attributes'][_0x1498('0x42')]?_0x550202[_0x1498('0x41')]:_0x27b44e[_0x1498('0x3b')];if(!_0x3a9f87[_0x1498('0x3d')][_0x1498('0x43')](_0x1498('0x44'))){_0x550202[_0x1498('0x45')]=qs[_0x1498('0x45')](_0x3a9f87['query'][_0x1498('0x45')]);_0x550202[_0x1498('0x2d')]=qs['offset'](_0x3a9f87[_0x1498('0x3d')]['offset']);}_0x550202[_0x1498('0x46')]=qs[_0x1498('0x47')](_0x3a9f87[_0x1498('0x3d')]['sort']);_0x550202[_0x1498('0x48')]=qs[_0x1498('0x3e')](_[_0x1498('0x49')](_0x3a9f87[_0x1498('0x3d')],_0x27b44e['filters']));if(_0x3a9f87[_0x1498('0x3d')][_0x1498('0x4a')]){_0x550202[_0x1498('0x48')]=_[_0x1498('0x4b')](_0x550202['where'],{'$or':_[_0x1498('0x4c')](_0x4783db,function(_0x48198f){if(_0x48198f[_0x1498('0x39')]!=='VIRTUAL'){var _0x360b77={};_0x360b77[_0x48198f[_0x1498('0x35')]]={'$like':'%'+_0x3a9f87[_0x1498('0x3d')]['filter']+'%'};return _0x360b77;}})});}_0x550202=_[_0x1498('0x4b')]({},_0x550202,_0x3a9f87['options']);var _0x565376={'where':_0x550202[_0x1498('0x48')]};return db['MailMessage'][_0x1498('0x2c')](_0x565376)[_0x1498('0x1e')](function(_0x23b345){_0x419a77['count']=_0x23b345;if(_0x3a9f87[_0x1498('0x3d')][_0x1498('0x4d')]){_0x550202[_0x1498('0x4e')]=[{'all':!![]}];}return db[_0x1498('0x4f')]['findAll'](_0x550202);})[_0x1498('0x1e')](function(_0x57c352){_0x419a77['rows']=_0x57c352;return _0x419a77;})[_0x1498('0x1e')](respondWithFilteredResult(_0x3f1b9f,_0x550202))[_0x1498('0x50')](handleError(_0x3f1b9f,null));};exports[_0x1498('0x51')]=function(_0x321c20,_0x3e4a1c){var _0x5d2cad={'raw':!![],'where':{'id':_0x321c20[_0x1498('0x52')]['id']}},_0x561e57={};_0x561e57[_0x1498('0x3b')]=_[_0x1498('0x3c')](db[_0x1498('0x4f')][_0x1498('0x38')]);_0x561e57[_0x1498('0x3d')]=_[_0x1498('0x3c')](_0x321c20[_0x1498('0x3d')]);_0x561e57['filters']=_[_0x1498('0x3f')](_0x561e57[_0x1498('0x3b')],_0x561e57[_0x1498('0x3d')]);_0x5d2cad[_0x1498('0x41')]=_[_0x1498('0x3f')](_0x561e57[_0x1498('0x3b')],qs['fields'](_0x321c20['query']['fields']));_0x5d2cad[_0x1498('0x41')]=_0x5d2cad[_0x1498('0x41')][_0x1498('0x42')]?_0x5d2cad[_0x1498('0x41')]:_0x561e57[_0x1498('0x3b')];if(_0x321c20[_0x1498('0x3d')]['includeAll']){_0x5d2cad[_0x1498('0x4e')]=[{'all':!![]}];}_0x5d2cad=_[_0x1498('0x4b')]({},_0x5d2cad,_0x321c20['options']);return db['MailMessage'][_0x1498('0x53')](_0x5d2cad)[_0x1498('0x1e')](handleEntityNotFound(_0x3e4a1c,null))[_0x1498('0x1e')](respondWithResult(_0x3e4a1c,null))[_0x1498('0x50')](handleError(_0x3e4a1c,null));};exports[_0x1498('0x32')]=function(_0x462c8b,_0x43a820){if(_0x462c8b['body']['id']){delete _0x462c8b['body']['id'];}return db[_0x1498('0x4f')][_0x1498('0x53')]({'where':{'id':_0x462c8b[_0x1498('0x52')]['id']}})['then'](handleEntityNotFound(_0x43a820,null))[_0x1498('0x1e')](saveUpdates(_0x462c8b[_0x1498('0x54')],null))[_0x1498('0x1e')](respondWithResult(_0x43a820,null))[_0x1498('0x50')](handleError(_0x43a820,null));};exports[_0x1498('0x33')]=function(_0x3137db,_0x318935){return db[_0x1498('0x4f')]['find']({'where':{'id':_0x3137db['params']['id']}})[_0x1498('0x1e')](handleEntityNotFound(_0x318935,null))[_0x1498('0x1e')](removeEntity(_0x318935,null))[_0x1498('0x50')](handleError(_0x318935,null));};exports[_0x1498('0x55')]=function(_0x3c56bf,_0x3c1904){return db['MailMessage']['describe']()[_0x1498('0x1e')](respondWithResult(_0x3c1904,null))[_0x1498('0x50')](handleError(_0x3c1904,null));};exports[_0x1498('0x56')]=function(_0x1c2d93,_0x19a39e){return db[_0x1498('0x4f')][_0x1498('0x56')](_0x1c2d93[_0x1498('0x54')])[_0x1498('0x1e')](function(_0x4ca6a4){if(_0x4ca6a4){if(_0x4ca6a4[_0x1498('0x57')]===_0x1498('0x58')&&!_0x4ca6a4[_0x1498('0x59')]){var _0x229638,_0x3b88d4,_0x54e072;if(_0x1c2d93['body']['to']){_0x3b88d4=_0x1c2d93[_0x1498('0x54')]['to'][_0x1498('0x5a')](',')[0x0];}return db[_0x1498('0x5b')][_0x1498('0x5c')]({'where':{'id':_0x4ca6a4[_0x1498('0x5d')]},'include':[{'model':db[_0x1498('0x5e')],'as':_0x1498('0x5f'),'include':[{'model':db[_0x1498('0x60')],'as':_0x1498('0x61'),'where':{'email':_0x3b88d4},'limit':0x1,'order':[[_0x1498('0x62'),'DESC']]}]},{'model':db[_0x1498('0x63')],'as':'Smtp','raw':!![]}]})[_0x1498('0x1e')](function(_0x18be93){_0x229638=_0x18be93;if(_0x229638&&_0x229638['Smtp']){var _0x4167be={'tls':{'rejectUnauthorized':![]}};if(_[_0x1498('0x64')](_0x229638[_0x1498('0x65')]['service'])){_0x4167be[_0x1498('0x66')]=_0x229638[_0x1498('0x65')]['host'];_0x4167be[_0x1498('0x67')]=_0x229638[_0x1498('0x65')]['port'];_0x4167be[_0x1498('0x68')]=_0x229638[_0x1498('0x65')]['secure'];if(_0x229638[_0x1498('0x65')][_0x1498('0x69')]){_0x4167be['auth']={'user':_0x229638[_0x1498('0x65')][_0x1498('0x6a')],'pass':_0x229638[_0x1498('0x65')][_0x1498('0x6b')]};}}else{_0x4167be[_0x1498('0x6c')]=_0x229638[_0x1498('0x65')]['service'];_0x4167be[_0x1498('0x6d')]={'user':_0x229638[_0x1498('0x65')][_0x1498('0x6a')],'pass':_0x229638[_0x1498('0x65')][_0x1498('0x6b')]};_0x4167be[_0x1498('0x68')]=_0x229638['Smtp'][_0x1498('0x68')];}if(_0x1c2d93['body'][_0x1498('0x6e')]&&_0x1c2d93['body'][_0x1498('0x6e')][_0x1498('0x42')]){for(var _0x5e57d2=0x0;_0x5e57d2<_0x1c2d93[_0x1498('0x54')][_0x1498('0x6e')][_0x1498('0x42')];_0x5e57d2+=0x1){_0x1c2d93[_0x1498('0x54')]['attachments'][_0x5e57d2]={'filename':_0x1c2d93[_0x1498('0x54')]['attachments'][_0x5e57d2]['name'],'path':path[_0x1498('0x6f')](config['root'],_0x1498('0x70'),_0x1c2d93[_0x1498('0x54')][_0x1498('0x6e')][_0x5e57d2][_0x1498('0x71')])};}}_0x54e072={'account':_0x4167be,'message':_0x1c2d93['body']};return;}})['then'](function(){if(_0x229638['List']){if(_0x229638[_0x1498('0x5f')][_0x1498('0x61')][_0x1498('0x42')]){return _0x229638['List']['Contacts'][0x0];}else{return db[_0x1498('0x60')]['create'](_[_0x1498('0x16')](_0x1c2d93[_0x1498('0x54')],{'firstName':_0x1c2d93[_0x1498('0x54')]['to'],'email':_0x1c2d93['body']['to'],'phone':_0x1c2d93[_0x1498('0x54')]['to'],'ListId':_0x229638[_0x1498('0x72')]}));}}else{throw new Error('List\x20not\x20found');}})[_0x1498('0x1e')](function(){if(_0x54e072){return respondWithRpcPromise(_0x1498('0x73'),'sendMail',_0x54e072,client9003)[_0x1498('0x1e')](function(_0x1d6cda){return _0x4ca6a4[_0x1498('0x32')]({'read':!![],'messageId':_0x1d6cda[_0x1498('0x74')],'sentAt':moment()[_0x1498('0x75')](_0x1498('0x76'))});})[_0x1498('0x50')](function(_0x2e8c15){logger[_0x1498('0x24')]('%s',JSON[_0x1498('0x77')](_0x2e8c15));return _0x4ca6a4;});}return _0x4ca6a4;});}return _0x4ca6a4;}})[_0x1498('0x1e')](respondWithResult(_0x19a39e,0xc9))[_0x1498('0x50')](handleError(_0x19a39e,null));};var interaction_log=require(_0x1498('0x78'))(_0x1498('0x79'));exports[_0x1498('0x7a')]=function(_0x563dce,_0x3041da,_0x1daa92){var _0x3c4bd6={'channel':_0x1498('0x7b')};if(_0x563dce[_0x1498('0x54')]['id']){delete _0x563dce['body']['id'];}_0x563dce[_0x1498('0x54')]['read']=!![];_0x563dce[_0x1498('0x54')]['readAt']=moment()['format'](_0x1498('0x76'));_0x563dce[_0x1498('0x54')][_0x1498('0x7c')]=_0x563dce[_0x1498('0x54')]['UserId']||_0x563dce[_0x1498('0x6a')]['id'];return db['MailMessage'][_0x1498('0x53')]({'where':{'id':_0x563dce[_0x1498('0x52')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0x1498('0x1e')](handleEntityNotFound(_0x3041da,null))[_0x1498('0x1e')](saveUpdates(_0x563dce['body'],null))['then'](function(_0x24beac){if(_0x24beac){_0x3c4bd6[_0x1498('0x26')]=_0x24beac[_0x1498('0x7d')]({'plain':!![]});return db[_0x1498('0x7e')][_0x1498('0x53')]({'where':{'id':_0x24beac[_0x1498('0x7f')]}});}return null;})[_0x1498('0x1e')](handleEntityNotFound(_0x3041da,null))[_0x1498('0x1e')](function(_0x38169f){if(_0x38169f){return _0x38169f[_0x1498('0x32')]({'UserId':_0x563dce[_0x1498('0x54')][_0x1498('0x7c')],'read1stAt':_[_0x1498('0x64')](_0x38169f['read1stAt'])?moment()[_0x1498('0x75')](_0x1498('0x76')):undefined});}return null;})[_0x1498('0x1e')](function(_0x3352ba){if(_0x3352ba){_0x3c4bd6[_0x1498('0x80')]=_0x3352ba[_0x1498('0x7d')]({'plain':!![]});interaction_log[_0x1498('0x1f')](_0x1498('0x81'),_0x563dce['user']['id'],_0x563dce['user']['name'],_0x563dce[_0x1498('0x6a')][_0x1498('0x82')],_0x3c4bd6['interaction']['id'],_0x563dce[_0x1498('0x54')]?JSON[_0x1498('0x77')](_0x563dce[_0x1498('0x54')]):_0x1498('0x83'));return respondWithRpcPromise(_0x1498('0x84'),_0x1498('0x85'),_0x3c4bd6);}return null;})[_0x1498('0x1e')](function(_0x5c9a38){if(_0x5c9a38){if(_0x563dce[_0x1498('0x54')][_0x1498('0x86')]){_0x3c4bd6[_0x1498('0x26')][_0x1498('0x87')]=util['format'](_0x1498('0x88'),_0x563dce[_0x1498('0x6a')][_0x1498('0x35')]);_0x3c4bd6[_0x1498('0x26')]['channel']=_0x3c4bd6[_0x1498('0x89')];_0x3c4bd6['message'][_0x1498('0x8a')]='accept';return respondWithRpcPromise(_0x1498('0x8b'),_0x1498('0x8b'),{'event':_0x1498('0x8c'),'message':_0x3c4bd6[_0x1498('0x26')]},client9002)['then'](function(){return _0x3c4bd6;});}return _0x3c4bd6;}return null;})[_0x1498('0x1e')](respondWithResult(_0x3041da,null))['catch'](handleError(_0x3041da,null));};var interaction_log=require('../../config/logger')(_0x1498('0x79'));exports['reject']=function(_0x116083,_0x1725e9,_0x31fbfe){var _0x31d195={'agent':{},'channel':_0x1498('0x7b')};if(_0x116083[_0x1498('0x54')]['id']){delete _0x116083[_0x1498('0x54')]['id'];}_0x116083['body'][_0x1498('0x7c')]=_0x116083[_0x1498('0x54')][_0x1498('0x7c')]||_0x116083[_0x1498('0x6a')]['id'];_0x31d195[_0x1498('0x8d')]['id']=_0x116083[_0x1498('0x54')][_0x1498('0x7c')];return db[_0x1498('0x4f')]['find']({'where':{'id':_0x116083[_0x1498('0x52')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x1725e9,null))[_0x1498('0x1e')](function(_0x4d1f56){if(_0x4d1f56){_0x31d195[_0x1498('0x26')]=_0x4d1f56[_0x1498('0x7d')]({'plain':!![]});return db[_0x1498('0x7e')]['find']({'where':{'id':_0x4d1f56[_0x1498('0x7f')]}});}return null;})[_0x1498('0x1e')](handleEntityNotFound(_0x1725e9,null))['then'](function(_0xc7d9a3){if(_0xc7d9a3){_0x31d195['interaction']=_0xc7d9a3[_0x1498('0x7d')]({'plain':!![]});interaction_log['info'](_0x1498('0x8e'),_0x116083[_0x1498('0x6a')]['id'],_0x116083[_0x1498('0x6a')][_0x1498('0x35')],_0x116083['user'][_0x1498('0x82')],_0x31d195[_0x1498('0x80')]['id'],_0x116083[_0x1498('0x54')]?JSON[_0x1498('0x77')](_0x116083[_0x1498('0x54')]):_0x1498('0x83'));return respondWithRpcPromise(_0x1498('0x8f'),'rejectMessage',_0x31d195);}return null;})[_0x1498('0x1e')](function(_0x14ef43){if(_0x14ef43){_0x14ef43[_0x1498('0x26')][_0x1498('0x87')]=util[_0x1498('0x75')](_0x1498('0x88'),_0x116083[_0x1498('0x6a')][_0x1498('0x35')]);_0x14ef43[_0x1498('0x26')][_0x1498('0x89')]=_0x31d195[_0x1498('0x89')];_0x14ef43[_0x1498('0x26')][_0x1498('0x8a')]='reject';respondWithRpcPromise(_0x1498('0x8b'),'EventManager',{'event':'rejectmessage','message':_0x14ef43['message']},client9002);return _0x31d195;}return null;})[_0x1498('0x1e')](respondWithResult(_0x1725e9,null))['catch'](handleError(_0x1725e9,null));};exports['download']=function(_0x2e0aae,_0xee531f){var _0x307d33=moment()[_0x1498('0x90')]()[_0x1498('0x91')]();var _0x4f8e4a=path[_0x1498('0x6f')](config[_0x1498('0x92')],_0x1498('0x93'),'files',_0x1498('0x94'));var _0x77e3af=path[_0x1498('0x6f')](config[_0x1498('0x92')],_0x1498('0x93'),_0x1498('0x95'),_0x1498('0x6e'));var _0x46477f=util[_0x1498('0x75')]('message-%s.eml',_0x307d33);return db['MailMessage'][_0x1498('0x53')]({'where':{'id':_0x2e0aae[_0x1498('0x52')]['id']},'attributes':['id',_0x1498('0x54'),_0x1498('0x96'),'to','cc',_0x1498('0x97'),_0x1498('0x98'),_0x1498('0x99')],'include':_0x2e0aae['query'][_0x1498('0x6e')]?[{'model':db[_0x1498('0x9a')],'as':'Attachments'}]:undefined})[_0x1498('0x1e')](handleEntityNotFound(_0xee531f,null))[_0x1498('0x1e')](function(_0x3b90d4){if(_0x3b90d4){var _0x473768=_0x3b90d4;var _0x248e0a={'from':_0x473768[_0x1498('0x96')],'to':_0x473768['to'],'subject':_0x473768['subject'],'html':_0x473768[_0x1498('0x54')],'headers':{'Date':moment(_0x473768['createdAt'])[_0x1498('0x75')](_0x1498('0x9b'))},'attachments':[]};if(_0x3b90d4['cc']){_0x248e0a[_0x1498('0x9c')]['Cc']=_0x3b90d4['cc'];}if(_0x3b90d4[_0x1498('0x97')]){_0x248e0a[_0x1498('0x9c')]['Bcc']=_0x3b90d4[_0x1498('0x97')];}return new BPromise(function(_0x42702d,_0x23e207){if(_0x3b90d4[_0x1498('0x9d')]){for(var _0x2a260a=0x0;_0x2a260a<_0x3b90d4[_0x1498('0x9d')]['length'];_0x2a260a++){var _0x4f0516=_0x3b90d4['Attachments'][_0x2a260a];var _0x498dee=path[_0x1498('0x6f')](_0x77e3af,_0x4f0516[_0x1498('0x71')]);if(fs[_0x1498('0x9e')](_0x498dee)){_0x248e0a[_0x1498('0x6e')][_0x1498('0x9f')]({'name':_0x4f0516[_0x1498('0x35')],'contentType':_0x4f0516[_0x1498('0x39')],'data':fs['readFileSync'](_0x498dee)});}}}emlformat[_0x1498('0xa0')](_0x248e0a,function(_0x425d42,_0x2ba5cf){if(_0x425d42)return _0x23e207(_0x425d42);fs[_0x1498('0xa1')](path['join'](_0x4f8e4a,_0x46477f),_0x2ba5cf);return _0x42702d(_0x2ba5cf);});});}})[_0x1498('0x1e')](function(_0x2b7979){if(_0x2b7979){return _0xee531f[_0x1498('0xa2')](path[_0x1498('0x6f')](_0x4f8e4a,_0x46477f),_0x46477f,function(_0x1f8056){if(_0x1f8056){console[_0x1498('0xa3')](_0x1498('0xa4'),_0x1f8056);}else{fs[_0x1498('0xa5')](path[_0x1498('0x6f')](_0x4f8e4a,_0x46477f));}});}})[_0x1498('0x50')](handleError(_0xee531f,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 3981cc3..d622a07 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 _0x96c2=['emit','hasOwnProperty','exports','events','../../mysqldb','MailMessage','save','update','remove'];(function(_0x13e5a7,_0x9d3471){var _0x2a981f=function(_0x4c9d96){while(--_0x4c9d96){_0x13e5a7['push'](_0x13e5a7['shift']());}};_0x2a981f(++_0x9d3471);}(_0x96c2,0x162));var _0x296c=function(_0x368e09,_0x2c1517){_0x368e09=_0x368e09-0x0;var _0x14b7df=_0x96c2[_0x368e09];return _0x14b7df;};'use strict';var EventEmitter=require(_0x296c('0x0'));var MailMessage=require(_0x296c('0x1'))['db'][_0x296c('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x296c('0x3'),'afterUpdate':_0x296c('0x4'),'afterDestroy':_0x296c('0x5')};function emitEvent(_0x5b95e7){return function(_0x161558,_0x4555df,_0x4e054a){MailMessageEvents[_0x296c('0x6')](_0x5b95e7+':'+_0x161558['id'],_0x161558);MailMessageEvents['emit'](_0x5b95e7,_0x161558);_0x4e054a(null);};}for(var e in events){if(events[_0x296c('0x7')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x296c('0x8')]=MailMessageEvents; \ No newline at end of file +var _0x882e=['MailMessage','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x30ef3d,_0x4befff){var _0x4a3620=function(_0x3083a7){while(--_0x3083a7){_0x30ef3d['push'](_0x30ef3d['shift']());}};_0x4a3620(++_0x4befff);}(_0x882e,0x1db));var _0xe882=function(_0x5c210b,_0x45f3b9){_0x5c210b=_0x5c210b-0x0;var _0x1531fd=_0x882e[_0x5c210b];return _0x1531fd;};'use strict';var EventEmitter=require(_0xe882('0x0'));var MailMessage=require(_0xe882('0x1'))['db'][_0xe882('0x2')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xe882('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xe882('0x4')};function emitEvent(_0x9ae77d){return function(_0x1e0ad3,_0x32aefa,_0x249cda){MailMessageEvents[_0xe882('0x5')](_0x9ae77d+':'+_0x1e0ad3['id'],_0x1e0ad3);MailMessageEvents[_0xe882('0x5')](_0x9ae77d,_0x1e0ad3);_0x249cda(null);};}for(var e in events){if(events[_0xe882('0x6')](e)){var event=events[e];MailMessage[_0xe882('0x7')](e,emitEvent(event));}}module[_0xe882('0x8')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index 2737800..47e01d8 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 _0x6fd4=['isNil','UserId','MailInteraction','findOne','catch','error','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','mail_messages','messageId','fti_mail_messages','subject','FULLTEXT','plainBody','models','get','direction','toLowerCase','out'];(function(_0x438920,_0x3f5a1b){var _0x474f47=function(_0x3767c2){while(--_0x3767c2){_0x438920['push'](_0x438920['shift']());}};_0x474f47(++_0x3f5a1b);}(_0x6fd4,0x17c));var _0x46fd=function(_0xe60b84,_0x1ba276){_0xe60b84=_0xe60b84-0x0;var _0x4224d1=_0x6fd4[_0xe60b84];return _0x4224d1;};'use strict';var _=require('lodash');var util=require(_0x46fd('0x0'));var logger=require(_0x46fd('0x1'))(_0x46fd('0x2'));var moment=require(_0x46fd('0x3'));var BPromise=require(_0x46fd('0x4'));var rp=require('request-promise');var htmlToText=require(_0x46fd('0x5'));var fs=require('fs');var path=require(_0x46fd('0x6'));var rimraf=require(_0x46fd('0x7'));var config=require(_0x46fd('0x8'));var attributes=require(_0x46fd('0x9'));module[_0x46fd('0xa')]=function(_0x1ca206,_0x5c58f7){return _0x1ca206[_0x46fd('0xb')]('MailMessage',attributes,{'tableName':_0x46fd('0xc'),'paranoid':![],'indexes':[{'name':_0x46fd('0xd'),'fields':['messageId']},{'name':_0x46fd('0xe'),'fields':['plainBody',_0x46fd('0xf')],'type':_0x46fd('0x10')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x532878,_0x56d776,_0x531945){if(_0x532878['body']){_0x532878[_0x46fd('0x11')]=htmlToText['fromString'](_0x532878['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x531945(null,_0x56d776);},'afterCreate':function(_0x108576,_0x413179,_0x59cece){var _0x25460a=_0x1ca206[_0x46fd('0x12')];var _0x29ba26=_0x108576[_0x46fd('0x13')]({'plain':!![]});if(_0x29ba26[_0x46fd('0x14')][_0x46fd('0x15')]()==='in'||_0x29ba26[_0x46fd('0x14')][_0x46fd('0x15')]()===_0x46fd('0x16')&&!_0x29ba26['secret']&&!_[_0x46fd('0x17')](_0x29ba26[_0x46fd('0x18')])){_0x25460a[_0x46fd('0x19')][_0x46fd('0x1a')]({'where':{'id':_0x29ba26['MailInteractionId']}})['then'](function(_0x31c8dc){if(_0x31c8dc){_0x31c8dc['update']({'lastMsgAt':_0x29ba26['createdAt'],'lastMsgDirection':_0x29ba26[_0x46fd('0x14')][_0x46fd('0x15')](),'lastMsgBody':_0x29ba26['body']});}})[_0x46fd('0x1b')](function(_0x2ae761){console[_0x46fd('0x1c')](_0x2ae761);});}_0x59cece();}},'charset':_0x46fd('0x1d'),'collate':_0x46fd('0x1e')});}; \ No newline at end of file +var _0x574d=['messageId','plainBody','subject','body','fromString','get','direction','toLowerCase','out','secret','UserId','MailInteraction','findOne','createdAt','catch','error','utf8mb4','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','MailMessage','mail_messages'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x574d,0xdc));var _0xd574=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x574d[_0x465a0c];return _0x1e202e;};'use strict';var _=require(_0xd574('0x0'));var util=require(_0xd574('0x1'));var logger=require('../../config/logger')(_0xd574('0x2'));var moment=require(_0xd574('0x3'));var BPromise=require(_0xd574('0x4'));var rp=require(_0xd574('0x5'));var htmlToText=require('html-to-text');var fs=require('fs');var path=require('path');var rimraf=require(_0xd574('0x6'));var config=require(_0xd574('0x7'));var attributes=require('./mailMessage.attributes');module[_0xd574('0x8')]=function(_0x5145d0,_0x2b0821){return _0x5145d0[_0xd574('0x9')](_0xd574('0xa'),attributes,{'tableName':_0xd574('0xb'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xd574('0xc')]},{'name':'fti_mail_messages','fields':[_0xd574('0xd'),_0xd574('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x21a483,_0x6c128f,_0x494cb8){if(_0x21a483[_0xd574('0xf')]){_0x21a483[_0xd574('0xd')]=htmlToText[_0xd574('0x10')](_0x21a483[_0xd574('0xf')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x494cb8(null,_0x6c128f);},'afterCreate':function(_0x3b278f,_0x1b92d3,_0x33d4c1){var _0x5ddc00=_0x5145d0['models'];var _0x37020a=_0x3b278f[_0xd574('0x11')]({'plain':!![]});if(_0x37020a[_0xd574('0x12')][_0xd574('0x13')]()==='in'||_0x37020a['direction'][_0xd574('0x13')]()===_0xd574('0x14')&&!_0x37020a[_0xd574('0x15')]&&!_['isNil'](_0x37020a[_0xd574('0x16')])){_0x5ddc00[_0xd574('0x17')][_0xd574('0x18')]({'where':{'id':_0x37020a['MailInteractionId']}})['then'](function(_0x3fe03e){if(_0x3fe03e){_0x3fe03e['update']({'lastMsgAt':_0x37020a[_0xd574('0x19')],'lastMsgDirection':_0x37020a[_0xd574('0x12')][_0xd574('0x13')](),'lastMsgBody':_0x37020a[_0xd574('0xf')]});}})[_0xd574('0x1a')](function(_0x113c26){console[_0xd574('0x1b')](_0x113c26);});}_0x33d4c1();}},'charset':_0xd574('0x1c'),'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 58e2515..19b37b9 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 _0xa899=['client','http','redis','defaults','./mailMessage.socket','request','then','info','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','MailMessage,\x20%s,\x20%s','CreateMailMessage','MailMessage','create','body','raw','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52ec4d,_0x1228e0){var _0x24c3d8=function(_0x572f2d){while(--_0x572f2d){_0x52ec4d['push'](_0x52ec4d['shift']());}};_0x24c3d8(++_0x1228e0);}(_0xa899,0x155));var _0x9a89=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0xa899[_0x56916d];return _0x2b7f1f;};'use strict';var _=require(_0x9a89('0x0'));var util=require(_0x9a89('0x1'));var moment=require(_0x9a89('0x2'));var BPromise=require('bluebird');var rs=require(_0x9a89('0x3'));var fs=require('fs');var Redis=require(_0x9a89('0x4'));var db=require(_0x9a89('0x5'))['db'];var utils=require(_0x9a89('0x6'));var logger=require(_0x9a89('0x7'))(_0x9a89('0x8'));var config=require(_0x9a89('0x9'));var jayson=require(_0x9a89('0xa'));var client=jayson[_0x9a89('0xb')][_0x9a89('0xc')]({'port':0x232a});config[_0x9a89('0xd')]=_[_0x9a89('0xe')](config[_0x9a89('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9a89('0xd')]));require(_0x9a89('0xf'))['register'](socket);function respondWithRpcPromise(_0xccf078,_0x4f487d,_0x111d99){return new BPromise(function(_0x2a9e30,_0x401680){return client[_0x9a89('0x10')](_0xccf078,_0x111d99)[_0x9a89('0x11')](function(_0xc61526){logger[_0x9a89('0x12')]('MailMessage,\x20%s,\x20%s',_0x4f487d,'request\x20sent');logger[_0x9a89('0x13')](_0x9a89('0x14'),_0x4f487d,_0x9a89('0x15'),JSON['stringify'](_0xc61526));if(_0xc61526['error']){if(_0xc61526['error'][_0x9a89('0x16')]===0x1f4){logger[_0x9a89('0x17')]('MailMessage,\x20%s,\x20%s',_0x4f487d,_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);return _0x401680(_0xc61526[_0x9a89('0x17')][_0x9a89('0x18')]);}logger['error'](_0x9a89('0x19'),_0x4f487d,_0xc61526[_0x9a89('0x17')]['message']);return _0x2a9e30(_0xc61526['error'][_0x9a89('0x18')]);}else{logger['info'](_0x9a89('0x19'),_0x4f487d,_0x9a89('0x15'));_0x2a9e30(_0xc61526['result'][_0x9a89('0x18')]);}})['catch'](function(_0x2d648f){logger[_0x9a89('0x17')]('MailMessage,\x20%s,\x20%s',_0x4f487d,_0x2d648f);_0x401680(_0x2d648f);});});}exports[_0x9a89('0x1a')]=function(_0x3759cb){var _0xf60649=this;return new Promise(function(_0x1619e0,_0x66f8c7){return db[_0x9a89('0x1b')][_0x9a89('0x1c')](_0x3759cb[_0x9a89('0x1d')],{'raw':_0x3759cb['options']?_0x3759cb['options'][_0x9a89('0x1e')]===undefined?!![]:![]:!![]})[_0x9a89('0x11')](function(_0xea8910){logger[_0x9a89('0x12')](_0x9a89('0x1a'),_0x3759cb);logger[_0x9a89('0x13')]('CreateMailMessage',_0x3759cb,JSON['stringify'](_0xea8910));_0x1619e0(_0xea8910);})[_0x9a89('0x1f')](function(_0x4f99e9){logger[_0x9a89('0x17')](_0x9a89('0x1a'),_0x4f99e9[_0x9a89('0x18')],_0x3759cb);_0x66f8c7(_0xf60649[_0x9a89('0x17')](0x1f4,_0x4f99e9[_0x9a89('0x18')]));});});}; \ No newline at end of file +var _0xfb15=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','create','body','options','raw','CreateMailMessage','stringify','lodash','util','moment'];(function(_0x10203f,_0x3eb373){var _0x14475f=function(_0x45f705){while(--_0x45f705){_0x10203f['push'](_0x10203f['shift']());}};_0x14475f(++_0x3eb373);}(_0xfb15,0x12f));var _0x5fb1=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xfb15[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x5fb1('0x0'));var util=require(_0x5fb1('0x1'));var moment=require(_0x5fb1('0x2'));var BPromise=require(_0x5fb1('0x3'));var rs=require(_0x5fb1('0x4'));var fs=require('fs');var Redis=require(_0x5fb1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5fb1('0x6'));var logger=require(_0x5fb1('0x7'))(_0x5fb1('0x8'));var config=require(_0x5fb1('0x9'));var jayson=require(_0x5fb1('0xa'));var client=jayson[_0x5fb1('0xb')]['http']({'port':0x232a});config[_0x5fb1('0xc')]=_['defaults'](config['redis'],{'host':_0x5fb1('0xd'),'port':0x18eb});var socket=require(_0x5fb1('0xe'))(new Redis(config[_0x5fb1('0xc')]));require(_0x5fb1('0xf'))[_0x5fb1('0x10')](socket);function respondWithRpcPromise(_0x226da1,_0xacf09e,_0x39c159){return new BPromise(function(_0x249e1a,_0x327e45){return client[_0x5fb1('0x11')](_0x226da1,_0x39c159)[_0x5fb1('0x12')](function(_0x150368){logger['info'](_0x5fb1('0x13'),_0xacf09e,_0x5fb1('0x14'));logger['debug'](_0x5fb1('0x15'),_0xacf09e,_0x5fb1('0x14'),JSON['stringify'](_0x150368));if(_0x150368[_0x5fb1('0x16')]){if(_0x150368[_0x5fb1('0x16')][_0x5fb1('0x17')]===0x1f4){logger[_0x5fb1('0x16')](_0x5fb1('0x13'),_0xacf09e,_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);return _0x327e45(_0x150368[_0x5fb1('0x16')]['message']);}logger['error']('MailMessage,\x20%s,\x20%s',_0xacf09e,_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);return _0x249e1a(_0x150368[_0x5fb1('0x16')][_0x5fb1('0x18')]);}else{logger[_0x5fb1('0x19')](_0x5fb1('0x13'),_0xacf09e,'request\x20sent');_0x249e1a(_0x150368[_0x5fb1('0x1a')][_0x5fb1('0x18')]);}})[_0x5fb1('0x1b')](function(_0x3548ff){logger[_0x5fb1('0x16')](_0x5fb1('0x13'),_0xacf09e,_0x3548ff);_0x327e45(_0x3548ff);});});}exports['CreateMailMessage']=function(_0x51189d){var _0x4f4c4c=this;return new Promise(function(_0x2174e5,_0x1fa373){return db['MailMessage'][_0x5fb1('0x1c')](_0x51189d[_0x5fb1('0x1d')],{'raw':_0x51189d[_0x5fb1('0x1e')]?_0x51189d[_0x5fb1('0x1e')][_0x5fb1('0x1f')]===undefined?!![]:![]:!![]})[_0x5fb1('0x12')](function(_0x549b56){logger[_0x5fb1('0x19')]('CreateMailMessage',_0x51189d);logger['debug'](_0x5fb1('0x20'),_0x51189d,JSON[_0x5fb1('0x21')](_0x549b56));_0x2174e5(_0x549b56);})[_0x5fb1('0x1b')](function(_0x3b1ac8){logger[_0x5fb1('0x16')]('CreateMailMessage',_0x3b1ac8[_0x5fb1('0x18')],_0x51189d);_0x1fa373(_0x4f4c4c[_0x5fb1('0x16')](0x1f4,_0x3b1ac8['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 2789165..d4788ad 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 _0xdead=['remove','removeListener','register','length','./mailMessage.events','save'];(function(_0x530151,_0x27ab6d){var _0x129774=function(_0x57f945){while(--_0x57f945){_0x530151['push'](_0x530151['shift']());}};_0x129774(++_0x27ab6d);}(_0xdead,0x172));var _0xddea=function(_0x450706,_0x144439){_0x450706=_0x450706-0x0;var _0x2e5de7=_0xdead[_0x450706];return _0x2e5de7;};'use strict';var MailMessageEvents=require(_0xddea('0x0'));var events=[_0xddea('0x1'),_0xddea('0x2'),'update'];function createListener(_0x2a631d,_0x519897){return function(_0x53421d){_0x519897['emit'](_0x2a631d,_0x53421d);};}function removeListener(_0x40db33,_0x5ef74c){return function(){MailMessageEvents[_0xddea('0x3')](_0x40db33,_0x5ef74c);};}exports[_0xddea('0x4')]=function(_0x5dca9e){for(var _0x18725c=0x0,_0x25a90c=events[_0xddea('0x5')];_0x18725c<_0x25a90c;_0x18725c++){var _0x1f6d31=events[_0x18725c];var _0x36cd2c=createListener('mailMessage:'+_0x1f6d31,_0x5dca9e);MailMessageEvents['on'](_0x1f6d31,_0x36cd2c);}}; \ No newline at end of file +var _0xe2f5=['remove','removeListener','register','length','./mailMessage.events','save'];(function(_0x453122,_0x103ec3){var _0x4c1d33=function(_0x67dfa3){while(--_0x67dfa3){_0x453122['push'](_0x453122['shift']());}};_0x4c1d33(++_0x103ec3);}(_0xe2f5,0x1ba));var _0x5e2f=function(_0x495c52,_0x177c06){_0x495c52=_0x495c52-0x0;var _0x473479=_0xe2f5[_0x495c52];return _0x473479;};'use strict';var MailMessageEvents=require(_0x5e2f('0x0'));var events=[_0x5e2f('0x1'),_0x5e2f('0x2'),'update'];function createListener(_0x27df0f,_0x359c4e){return function(_0x59b62b){_0x359c4e['emit'](_0x27df0f,_0x59b62b);};}function removeListener(_0x5e8885,_0x44646f){return function(){MailMessageEvents[_0x5e2f('0x3')](_0x5e8885,_0x44646f);};}exports[_0x5e2f('0x4')]=function(_0x18d8e7){for(var _0xd10bf0=0x0,_0x224dbb=events[_0x5e2f('0x5')];_0xd10bf0<_0x224dbb;_0xd10bf0++){var _0x1186b1=events[_0xd10bf0];var _0x12a67a=createListener('mailMessage:'+_0x1186b1,_0x18d8e7);MailMessageEvents['on'](_0x1186b1,_0x12a67a);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 4d21d4c..0769dbb 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 _0xe36b=['addAgents','put','delete','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/teams','/:id/users','post','create','addTeams'];(function(_0xd344ef,_0x132b5f){var _0x50a171=function(_0x1f7059){while(--_0x1f7059){_0xd344ef['push'](_0xd344ef['shift']());}};_0x50a171(++_0x132b5f);}(_0xe36b,0x1d9));var _0xbe36=function(_0xd24b23,_0x17da5a){_0xd24b23=_0xd24b23-0x0;var _0x125b60=_0xe36b[_0xd24b23];return _0x125b60;};'use strict';var multer=require(_0xbe36('0x0'));var util=require(_0xbe36('0x1'));var path=require(_0xbe36('0x2'));var timeout=require(_0xbe36('0x3'));var express=require(_0xbe36('0x4'));var router=express[_0xbe36('0x5')]();var auth=require(_0xbe36('0x6'));var interaction=require(_0xbe36('0x7'));var config=require(_0xbe36('0x8'));var controller=require(_0xbe36('0x9'));router[_0xbe36('0xa')]('/',auth[_0xbe36('0xb')](),controller[_0xbe36('0xc')]);router['get'](_0xbe36('0xd'),auth['isAuthenticated'](),controller['describe']);router[_0xbe36('0xa')](_0xbe36('0xe'),auth['isAuthenticated'](),controller[_0xbe36('0xf')]);router[_0xbe36('0xa')]('/:id/members',auth[_0xbe36('0xb')](),controller['getMembers']);router['get'](_0xbe36('0x10'),auth[_0xbe36('0xb')](),controller['getTeams']);router[_0xbe36('0xa')](_0xbe36('0x11'),auth[_0xbe36('0xb')](),controller['getAgents']);router[_0xbe36('0x12')]('/',auth['isAuthenticated'](),controller[_0xbe36('0x13')]);router[_0xbe36('0x12')](_0xbe36('0x10'),auth[_0xbe36('0xb')](),controller[_0xbe36('0x14')]);router[_0xbe36('0x12')](_0xbe36('0x11'),auth[_0xbe36('0xb')](),controller[_0xbe36('0x15')]);router[_0xbe36('0x16')](_0xbe36('0xe'),auth[_0xbe36('0xb')](),controller['update']);router[_0xbe36('0x17')]('/:id',auth[_0xbe36('0xb')](),controller['destroy']);router[_0xbe36('0x17')]('/:id/teams',auth[_0xbe36('0xb')](),controller[_0xbe36('0x18')]);router[_0xbe36('0x17')](_0xbe36('0x11'),auth[_0xbe36('0xb')](),controller[_0xbe36('0x19')]);module['exports']=router; \ No newline at end of file +var _0x325c=['Router','../../components/interaction/service','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','post','create','addTeams','/:id/users','addAgents','put','update','destroy','delete','removeAgents','exports','util','path','connect-timeout','express'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x325c,0x1d8));var _0xc325=function(_0x795e61,_0x4c80ca){_0x795e61=_0x795e61-0x0;var _0x1ab31e=_0x325c[_0x795e61];return _0x1ab31e;};'use strict';var multer=require('multer');var util=require(_0xc325('0x0'));var path=require(_0xc325('0x1'));var timeout=require(_0xc325('0x2'));var express=require(_0xc325('0x3'));var router=express[_0xc325('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xc325('0x5'));var config=require('../../config/environment');var controller=require(_0xc325('0x6'));router[_0xc325('0x7')]('/',auth[_0xc325('0x8')](),controller[_0xc325('0x9')]);router['get'](_0xc325('0xa'),auth[_0xc325('0x8')](),controller[_0xc325('0xb')]);router[_0xc325('0x7')](_0xc325('0xc'),auth[_0xc325('0x8')](),controller[_0xc325('0xd')]);router[_0xc325('0x7')](_0xc325('0xe'),auth[_0xc325('0x8')](),controller[_0xc325('0xf')]);router[_0xc325('0x7')](_0xc325('0x10'),auth[_0xc325('0x8')](),controller['getTeams']);router[_0xc325('0x7')]('/:id/users',auth[_0xc325('0x8')](),controller['getAgents']);router[_0xc325('0x11')]('/',auth['isAuthenticated'](),controller[_0xc325('0x12')]);router[_0xc325('0x11')](_0xc325('0x10'),auth[_0xc325('0x8')](),controller[_0xc325('0x13')]);router[_0xc325('0x11')](_0xc325('0x14'),auth[_0xc325('0x8')](),controller[_0xc325('0x15')]);router[_0xc325('0x16')]('/:id',auth[_0xc325('0x8')](),controller[_0xc325('0x17')]);router['delete'](_0xc325('0xc'),auth[_0xc325('0x8')](),controller[_0xc325('0x18')]);router[_0xc325('0x19')](_0xc325('0x10'),auth[_0xc325('0x8')](),controller['removeTeams']);router[_0xc325('0x19')](_0xc325('0x14'),auth['isAuthenticated'](),controller[_0xc325('0x1a')]);module[_0xc325('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 4cb715c..ba158c4 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 _0xf3d0=['roundrobin','sequelize','exports','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf3d0,0x160));var _0x0f3d=function(_0x5e0c65,_0x568d78){_0x5e0c65=_0x5e0c65-0x0;var _0x533fa0=_0xf3d0[_0x5e0c65];return _0x533fa0;};'use strict';var Sequelize=require(_0x0f3d('0x0'));module[_0x0f3d('0x1')]={'name':{'type':Sequelize[_0x0f3d('0x2')],'unique':_0x0f3d('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0f3d('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x0f3d('0x5')](_0x0f3d('0x6'),_0x0f3d('0x7'),_0x0f3d('0x8'))}}; \ No newline at end of file +var _0x9080=['STRING','name','INTEGER','rrmemory','roundrobin'];(function(_0x114ef3,_0x2957c8){var _0x5266e2=function(_0x254efa){while(--_0x254efa){_0x114ef3['push'](_0x114ef3['shift']());}};_0x5266e2(++_0x2957c8);}(_0x9080,0xeb));var _0x0908=function(_0x5ecf94,_0x2ad6cd){_0x5ecf94=_0x5ecf94-0x0;var _0x1dec75=_0x9080[_0x5ecf94];return _0x1dec75;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x0908('0x0')],'unique':_0x0908('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x0908('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x0908('0x3'),'beepall',_0x0908('0x4'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index d12a2c3..92d2286 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 _0xf53e=['removeTeams','select','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','ids','isEmpty','removeAgents','userMailQueue:remove','addAgents','spread','userMailQueue:save','isArray','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','localhost','./mailQueue.socket','register','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','MailQueues','UserProfileResource','end','stack','name','send','index','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','pick','where','merge','map','VIRTUAL','filter','options','MailQueue','includeAll','findAll','rows','catch','show','params','rawAttributes','length','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','body','find','describe','UserMailQueue','User','findAndCountAll','UserId','agent','mailPause','createdAt','format','%s/%s','SIP','updatedAt','getTeams','findOne','Team','nolimit','addTeams','Agents','online','voicePause','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit'];(function(_0x2067e9,_0x5e6a97){var _0x280ce4=function(_0x2eca23){while(--_0x2eca23){_0x2067e9['push'](_0x2067e9['shift']());}};_0x280ce4(++_0x5e6a97);}(_0xf53e,0x13d));var _0xef53=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf53e[_0x20a584];return _0x4b41a8;};'use strict';var pdf=require(_0xef53('0x0'));var emlformat=require(_0xef53('0x1'));var rimraf=require(_0xef53('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xef53('0x3'));var rp=require(_0xef53('0x4'));var moment=require(_0xef53('0x5'));var BPromise=require(_0xef53('0x6'));var Mustache=require(_0xef53('0x7'));var util=require('util');var path=require(_0xef53('0x8'));var sox=require(_0xef53('0x9'));var csv=require(_0xef53('0xa'));var ejs=require(_0xef53('0xb'));var fs=require('fs');var _=require(_0xef53('0xc'));var squel=require(_0xef53('0xd'));var crypto=require(_0xef53('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xef53('0xf'));var toCsv=require(_0xef53('0xa'));var querystring=require('querystring');var Papa=require(_0xef53('0x10'));var Redis=require(_0xef53('0x11'));var authService=require(_0xef53('0x12'));var qs=require(_0xef53('0x13'));var as=require(_0xef53('0x14'));var hardwareService=require(_0xef53('0x15'));var logger=require(_0xef53('0x16'))(_0xef53('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xef53('0x18'))['db'];config['redis']=_[_0xef53('0x19')](config['redis'],{'host':_0xef53('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xef53('0x1b'))[_0xef53('0x1c')](socket);function respondWithStatusCode(_0x182d6c,_0x5c8987){_0x5c8987=_0x5c8987||0xcc;return function(_0x56f8fa){if(_0x56f8fa){return _0x182d6c['sendStatus'](_0x5c8987);}return _0x182d6c[_0xef53('0x1d')](_0x5c8987)['end']();};}function respondWithResult(_0xec80,_0x105945){_0x105945=_0x105945||0xc8;return function(_0x4d6020){if(_0x4d6020){return _0xec80[_0xef53('0x1d')](_0x105945)[_0xef53('0x1e')](_0x4d6020);}};}function respondWithFilteredResult(_0x9bf13e,_0x1fbebd){return function(_0xe834f9){if(_0xe834f9){var _0x58bac1=_0xe834f9[_0xef53('0x1f')],_0x930e9=_0x1fbebd['offset'],_0x122e7a=_0x1fbebd[_0xef53('0x20')]+_0x1fbebd[_0xef53('0x21')],_0x41cb0a;if(_0x122e7a>=_0x58bac1){_0x122e7a=_0x58bac1;_0x41cb0a=0xc8;}else{_0x41cb0a=0xce;}_0x9bf13e['status'](_0x41cb0a);return _0x9bf13e[_0xef53('0x22')](_0xef53('0x23'),_0x930e9+'-'+_0x122e7a+'/'+_0x58bac1)[_0xef53('0x1e')](_0xe834f9);}return null;};}function patchUpdates(_0x363c43){return function(_0x441da9){try{jsonpatch[_0xef53('0x24')](_0x441da9,_0x363c43,!![]);}catch(_0x56ea8b){return BPromise[_0xef53('0x25')](_0x56ea8b);}return _0x441da9[_0xef53('0x26')]();};}function saveUpdates(_0x36d6b2,_0x5da130){return function(_0x165183){if(_0x165183){return _0x165183[_0xef53('0x27')](_0x36d6b2)[_0xef53('0x28')](function(_0x3fb706){return _0x3fb706;});}return null;};}function removeEntity(_0x226d78,_0x211102){return function(_0x283a49){if(_0x283a49){return _0x283a49[_0xef53('0x29')]()['then'](function(){var _0x3c175c=_0x283a49[_0xef53('0x2a')]({'plain':!![]});var _0x2518d2=_0xef53('0x2b');return db[_0xef53('0x2c')][_0xef53('0x29')]({'where':{'type':_0x2518d2,'resourceId':_0x3c175c['id']}})['then'](function(){return _0x283a49;});})[_0xef53('0x28')](function(){_0x226d78[_0xef53('0x1d')](0xcc)[_0xef53('0x2d')]();});}};}function handleEntityNotFound(_0x4338c9,_0x6157ed){return function(_0x46daee){if(!_0x46daee){_0x4338c9['sendStatus'](0x194);}return _0x46daee;};}function handleError(_0x1b77a4,_0x137d4c){_0x137d4c=_0x137d4c||0x1f4;return function(_0x57fcfe){logger['error'](_0x57fcfe[_0xef53('0x2e')]);if(_0x57fcfe[_0xef53('0x2f')]){delete _0x57fcfe[_0xef53('0x2f')];}_0x1b77a4['status'](_0x137d4c)[_0xef53('0x30')](_0x57fcfe);};}exports[_0xef53('0x31')]=function(_0x2c7c76,_0x1f19a7){var _0x2312e8={},_0x3ef5de={},_0x383523={'count':0x0,'rows':[]};var _0x497986=_['map'](db['MailQueue']['rawAttributes'],function(_0x40cd1b){return{'name':_0x40cd1b[_0xef53('0x32')],'type':_0x40cd1b[_0xef53('0x33')][_0xef53('0x34')]};});_0x3ef5de['model']=_['map'](_0x497986,_0xef53('0x2f'));_0x3ef5de[_0xef53('0x35')]=_[_0xef53('0x36')](_0x2c7c76[_0xef53('0x35')]);_0x3ef5de[_0xef53('0x37')]=_[_0xef53('0x38')](_0x3ef5de[_0xef53('0x39')],_0x3ef5de[_0xef53('0x35')]);_0x2312e8[_0xef53('0x3a')]=_[_0xef53('0x38')](_0x3ef5de[_0xef53('0x39')],qs['fields'](_0x2c7c76[_0xef53('0x35')][_0xef53('0x3b')]));_0x2312e8[_0xef53('0x3a')]=_0x2312e8['attributes']['length']?_0x2312e8[_0xef53('0x3a')]:_0x3ef5de[_0xef53('0x39')];if(!_0x2c7c76['query'][_0xef53('0x3c')]('nolimit')){_0x2312e8[_0xef53('0x21')]=qs['limit'](_0x2c7c76[_0xef53('0x35')][_0xef53('0x21')]);_0x2312e8[_0xef53('0x20')]=qs[_0xef53('0x20')](_0x2c7c76[_0xef53('0x35')]['offset']);}_0x2312e8[_0xef53('0x3d')]=qs[_0xef53('0x3e')](_0x2c7c76['query'][_0xef53('0x3e')]);_0x2312e8['where']=qs['filters'](_[_0xef53('0x3f')](_0x2c7c76[_0xef53('0x35')],_0x3ef5de['filters']));if(_0x2c7c76[_0xef53('0x35')]['filter']){_0x2312e8[_0xef53('0x40')]=_[_0xef53('0x41')](_0x2312e8[_0xef53('0x40')],{'$or':_[_0xef53('0x42')](_0x497986,function(_0x2d8b75){if(_0x2d8b75[_0xef53('0x33')]!==_0xef53('0x43')){var _0x25c5e3={};_0x25c5e3[_0x2d8b75[_0xef53('0x2f')]]={'$like':'%'+_0x2c7c76[_0xef53('0x35')][_0xef53('0x44')]+'%'};return _0x25c5e3;}})});}_0x2312e8=_[_0xef53('0x41')]({},_0x2312e8,_0x2c7c76[_0xef53('0x45')]);var _0x1c82d3={'where':_0x2312e8['where']};return db[_0xef53('0x46')][_0xef53('0x1f')](_0x1c82d3)[_0xef53('0x28')](function(_0x3763f2){_0x383523['count']=_0x3763f2;if(_0x2c7c76['query'][_0xef53('0x47')]){_0x2312e8['include']=[{'all':!![]}];}return db[_0xef53('0x46')][_0xef53('0x48')](_0x2312e8);})[_0xef53('0x28')](function(_0xd2f9dd){_0x383523[_0xef53('0x49')]=_0xd2f9dd;return _0x383523;})[_0xef53('0x28')](respondWithFilteredResult(_0x1f19a7,_0x2312e8))[_0xef53('0x4a')](handleError(_0x1f19a7,null));};exports[_0xef53('0x4b')]=function(_0x32a6ba,_0x1d4449){var _0x145619={'raw':!![],'where':{'id':_0x32a6ba[_0xef53('0x4c')]['id']}},_0x3c038e={};_0x3c038e[_0xef53('0x39')]=_['keys'](db[_0xef53('0x46')][_0xef53('0x4d')]);_0x3c038e['query']=_[_0xef53('0x36')](_0x32a6ba[_0xef53('0x35')]);_0x3c038e[_0xef53('0x37')]=_[_0xef53('0x38')](_0x3c038e[_0xef53('0x39')],_0x3c038e[_0xef53('0x35')]);_0x145619[_0xef53('0x3a')]=_['intersection'](_0x3c038e[_0xef53('0x39')],qs['fields'](_0x32a6ba['query']['fields']));_0x145619['attributes']=_0x145619['attributes'][_0xef53('0x4e')]?_0x145619[_0xef53('0x3a')]:_0x3c038e['model'];if(_0x32a6ba[_0xef53('0x35')]['includeAll']){_0x145619[_0xef53('0x4f')]=[{'all':!![]}];}_0x145619=_[_0xef53('0x41')]({},_0x145619,_0x32a6ba[_0xef53('0x45')]);return db[_0xef53('0x46')]['find'](_0x145619)[_0xef53('0x28')](handleEntityNotFound(_0x1d4449,null))[_0xef53('0x28')](respondWithResult(_0x1d4449,null))['catch'](handleError(_0x1d4449,null));};exports[_0xef53('0x50')]=function(_0x221e3f,_0x4f24b2){return db[_0xef53('0x46')]['create'](_0x221e3f['body'],{})['then'](function(_0xddc311){var _0x8bea12=_0x221e3f[_0xef53('0x51')][_0xef53('0x2a')]({'plain':!![]});if(!_0x8bea12)throw new Error(_0xef53('0x52'));if(_0x8bea12['role']===_0xef53('0x51')){var _0x50baa9=_0xddc311[_0xef53('0x2a')]({'plain':!![]});var _0xd71211=_0xef53('0x2b');return db[_0xef53('0x53')]['find']({'where':{'name':_0xd71211,'userProfileId':_0x8bea12[_0xef53('0x54')]},'raw':!![]})[_0xef53('0x28')](function(_0x5a6671){if(_0x5a6671&&_0x5a6671['autoAssociation']===0x0){return db['UserProfileResource'][_0xef53('0x50')]({'name':_0x50baa9[_0xef53('0x2f')],'resourceId':_0x50baa9['id'],'type':_0x5a6671[_0xef53('0x2f')],'sectionId':_0x5a6671['id']},{})[_0xef53('0x28')](function(){return _0xddc311;});}else{return _0xddc311;}})['catch'](function(_0x47a6a8){logger[_0xef53('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47a6a8);throw _0x47a6a8;});}return _0xddc311;})[_0xef53('0x28')](respondWithResult(_0x4f24b2,0xc9))['catch'](handleError(_0x4f24b2,null));};exports[_0xef53('0x27')]=function(_0x206f10,_0x4086f6){if(_0x206f10[_0xef53('0x56')]['id']){delete _0x206f10['body']['id'];}return db[_0xef53('0x46')][_0xef53('0x57')]({'where':{'id':_0x206f10[_0xef53('0x4c')]['id']}})[_0xef53('0x28')](handleEntityNotFound(_0x4086f6,null))['then'](saveUpdates(_0x206f10[_0xef53('0x56')],null))[_0xef53('0x28')](respondWithResult(_0x4086f6,null))[_0xef53('0x4a')](handleError(_0x4086f6,null));};exports[_0xef53('0x29')]=function(_0x1625bd,_0xc08b9f){return db[_0xef53('0x46')]['find']({'where':{'id':_0x1625bd[_0xef53('0x4c')]['id']}})['then'](handleEntityNotFound(_0xc08b9f,null))['then'](removeEntity(_0xc08b9f,null))[_0xef53('0x4a')](handleError(_0xc08b9f,null));};exports[_0xef53('0x58')]=function(_0x5e190b,_0x56a7a2){return db['MailQueue']['describe']()['then'](respondWithResult(_0x56a7a2,null))['catch'](handleError(_0x56a7a2,null));};exports['getMembers']=function(_0x52802e,_0x3e9d2e,_0x462836){var _0xa2324d={'raw':!![],'where':{}},_0x19991d={},_0x550944;return db[_0xef53('0x46')]['findOne']({'where':{'id':_0x52802e[_0xef53('0x4c')]['id']}})[_0xef53('0x28')](handleEntityNotFound(_0x3e9d2e,null))[_0xef53('0x28')](function(_0x22fd16){if(_0x22fd16){_0x550944=_0x22fd16[_0xef53('0x2a')]({'plain':!![]});_0x19991d['model']=_[_0xef53('0x36')](db[_0xef53('0x59')][_0xef53('0x4d')]);_0x19991d['query']=_[_0xef53('0x36')](_0x52802e['query']);_0x19991d[_0xef53('0x37')]=_[_0xef53('0x38')](_0x19991d['model'],_0x19991d[_0xef53('0x35')]);_0xa2324d['attributes']=_[_0xef53('0x38')](_0x19991d[_0xef53('0x39')],qs[_0xef53('0x3b')](_0x52802e[_0xef53('0x35')]['fields']));_0xa2324d[_0xef53('0x3a')]=_0xa2324d[_0xef53('0x3a')]['length']?_0xa2324d['attributes']:_0x19991d[_0xef53('0x39')];if(!_0x52802e['query'][_0xef53('0x3c')]('nolimit')){_0xa2324d[_0xef53('0x21')]=qs['limit'](_0x52802e['query']['limit']);_0xa2324d[_0xef53('0x20')]=qs[_0xef53('0x20')](_0x52802e[_0xef53('0x35')]['offset']);}_0xa2324d['order']=qs[_0xef53('0x3e')](_0x52802e[_0xef53('0x35')][_0xef53('0x3e')]);_0xa2324d[_0xef53('0x40')]=qs[_0xef53('0x37')](_[_0xef53('0x3f')](_0x52802e[_0xef53('0x35')],_0x19991d['filters']));_0xa2324d['where']['MailQueueId']=_0x22fd16['id'];if(_0x52802e[_0xef53('0x35')][_0xef53('0x44')]){_0xa2324d[_0xef53('0x40')]=_[_0xef53('0x41')](_0xa2324d[_0xef53('0x40')],{'$or':_['map'](_0xa2324d[_0xef53('0x3a')],function(_0x2959d1){var _0x466523={};_0x466523[_0x2959d1]={'$like':'%'+_0x52802e['query'][_0xef53('0x44')]+'%'};return _0x466523;})});}_0xa2324d=_[_0xef53('0x41')]({},_0xa2324d,_0x52802e[_0xef53('0x45')]);return db[_0xef53('0x59')][_0xef53('0x48')](_0xa2324d);}})[_0xef53('0x28')](function(_0xd454c3){if(_0xd454c3){return db[_0xef53('0x5a')][_0xef53('0x5b')]({'where':{'id':_[_0xef53('0x42')](_0xd454c3,_0xef53('0x5c')),'role':_0xef53('0x5d')},'attributes':['id',_0xef53('0x2f'),_0xef53('0x5e'),'updatedAt',_0xef53('0x5f')]});}})[_0xef53('0x28')](function(_0x352202){if(_0x352202){return{'count':_0x352202['count'],'rows':_[_0xef53('0x42')](_0x352202[_0xef53('0x49')],function(_0x1de304){return{'membername':_0x1de304[_0xef53('0x2f')],'UserId':_0x1de304['id'],'queue_name':_0x550944['name'],'MailQueueId':_0x550944['id'],'interface':util[_0xef53('0x60')](_0xef53('0x61'),_0xef53('0x62'),_0x1de304[_0xef53('0x2f')]),'penalty':0x0,'paused':_0x1de304['mailPause'],'createdAt':_0x1de304['createdAt'],'updatedAt':_0x1de304[_0xef53('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xef53('0x28')](respondWithFilteredResult(_0x3e9d2e,_0xa2324d))[_0xef53('0x4a')](handleError(_0x3e9d2e,null));};exports[_0xef53('0x64')]=function(_0x356752,_0x520200,_0x464141){var _0x384b9c={};var _0x32affd={};var _0x2b9ebd;var _0x34bce8;return db['MailQueue'][_0xef53('0x65')]({'where':{'id':_0x356752[_0xef53('0x4c')]['id']}})[_0xef53('0x28')](handleEntityNotFound(_0x520200,null))[_0xef53('0x28')](function(_0x1da65d){if(_0x1da65d){_0x2b9ebd=_0x1da65d;_0x32affd[_0xef53('0x39')]=_[_0xef53('0x36')](db[_0xef53('0x66')][_0xef53('0x4d')]);_0x32affd['query']=_['keys'](_0x356752['query']);_0x32affd['filters']=_[_0xef53('0x38')](_0x32affd[_0xef53('0x39')],_0x32affd[_0xef53('0x35')]);_0x384b9c['attributes']=_['intersection'](_0x32affd[_0xef53('0x39')],qs[_0xef53('0x3b')](_0x356752[_0xef53('0x35')][_0xef53('0x3b')]));_0x384b9c[_0xef53('0x3a')]=_0x384b9c['attributes'][_0xef53('0x4e')]?_0x384b9c[_0xef53('0x3a')]:_0x32affd[_0xef53('0x39')];_0x384b9c['order']=qs[_0xef53('0x3e')](_0x356752[_0xef53('0x35')]['sort']);_0x384b9c[_0xef53('0x40')]=qs[_0xef53('0x37')](_[_0xef53('0x3f')](_0x356752[_0xef53('0x35')],_0x32affd[_0xef53('0x37')]));if(_0x356752[_0xef53('0x35')][_0xef53('0x44')]){_0x384b9c[_0xef53('0x40')]=_[_0xef53('0x41')](_0x384b9c[_0xef53('0x40')],{'$or':_['map'](_0x384b9c[_0xef53('0x3a')],function(_0x137895){var _0x5c3d55={};_0x5c3d55[_0x137895]={'$like':'%'+_0x356752[_0xef53('0x35')][_0xef53('0x44')]+'%'};return _0x5c3d55;})});}_0x384b9c=_[_0xef53('0x41')]({},_0x384b9c,_0x356752[_0xef53('0x45')]);return _0x2b9ebd[_0xef53('0x64')](_0x384b9c);}})[_0xef53('0x28')](function(_0x1b725f){if(_0x1b725f){_0x34bce8=_0x1b725f[_0xef53('0x4e')];if(!_0x356752[_0xef53('0x35')][_0xef53('0x3c')](_0xef53('0x67'))){_0x384b9c['limit']=qs['limit'](_0x356752[_0xef53('0x35')][_0xef53('0x21')]);_0x384b9c[_0xef53('0x20')]=qs[_0xef53('0x20')](_0x356752[_0xef53('0x35')]['offset']);}return _0x2b9ebd[_0xef53('0x64')](_0x384b9c);}})[_0xef53('0x28')](function(_0x5c9b4b){if(_0x5c9b4b){return _0x5c9b4b?{'count':_0x34bce8,'rows':_0x5c9b4b}:null;}})[_0xef53('0x28')](respondWithResult(_0x520200,null))[_0xef53('0x4a')](handleError(_0x520200,null));};exports[_0xef53('0x68')]=function(_0x2bbc6b,_0x33250e,_0x5b5343){var _0x19880d=_0x2bbc6b[_0xef53('0x56')]['ids'];return db[_0xef53('0x66')]['findAll']({'where':{'id':_0x19880d},'attributes':['id'],'include':[{'model':db[_0xef53('0x5a')],'as':_0xef53('0x69'),'attributes':['id',_0xef53('0x2f'),_0xef53('0x6a'),_0xef53('0x6b'),'interface'],'raw':!![]}]})[_0xef53('0x28')](function(_0x561b09){if(_0x561b09){var _0x1df74d=_[_0xef53('0x6c')](_0x561b09,function(_0x145fdf){var _0x8309ea=_0x145fdf[_0xef53('0x2a')]({'plain':!![]});return _0x8309ea['Agents'];});return db[_0xef53('0x46')][_0xef53('0x57')]({'where':{'id':_0x2bbc6b['params']['id']}})['then'](function(_0x2d12ae){return db[_0xef53('0x6d')][_0xef53('0x6e')](function(_0x290398){return _0x2d12ae[_0xef53('0x68')](_0x19880d,{'transaction':_0x290398})[_0xef53('0x28')](function(){return BPromise[_0xef53('0x6f')](_0x1df74d,function(_0x200606){return db[_0xef53('0x59')][_0xef53('0x70')]({'where':{'UserId':_0x200606['id'],'MailQueueId':_0x2bbc6b[_0xef53('0x4c')]['id']},'transaction':_0x290398});});})['then'](function(){_0x1df74d[_0xef53('0x71')](function(_0x21c0a9){socket[_0xef53('0x72')]('userMailQueue:save',{'UserId':_0x21c0a9['id'],'MailQueueId':_0x2d12ae['id']});});});});});}})['then'](respondWithStatusCode(_0x33250e,null))[_0xef53('0x4a')](handleError(_0x33250e,null));};exports[_0xef53('0x73')]=function(_0x118f05,_0x4915fb,_0x5b1cfa){return db['Team'][_0xef53('0x48')]({'where':{'id':_0x118f05[_0xef53('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xef53('0x5a')],'as':_0xef53('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x4915fb,null))[_0xef53('0x28')](function(_0x28c377){var _0x1e1ea7=_['map'](_0x28c377,'id');var _0x46e2d3=[];var _0x34255e=[];var _0x584e62=squel[_0xef53('0x74')]();_0x584e62['field'](_0xef53('0x75'))[_0xef53('0x76')](_0xef53('0x77'),'tq')[_0xef53('0x78')]('user_has_teams','ut',_0xef53('0x79'))[_0xef53('0x40')](_0xef53('0x7a'),_0x118f05[_0xef53('0x4c')]['id']);for(var _0x15d76f=0x0;_0x15d76f<_0x28c377[_0xef53('0x4e')];_0x15d76f+=0x1){let _0xa7cefc=_0x28c377[_0x15d76f];for(var _0x307cad=0x0;_0x307cad<_0xa7cefc[_0xef53('0x69')][_0xef53('0x4e')];_0x307cad+=0x1){let _0x536dd8=_0xa7cefc[_0xef53('0x69')][_0x307cad];var _0x513055=_0x584e62[_0xef53('0x7b')]();_0x513055[_0xef53('0x40')](_0xef53('0x7c'),_0x536dd8['id']);_0x34255e['push'](db['sequelize'][_0xef53('0x35')](_0x513055[_0xef53('0x7d')](),{'type':db['sequelize'][_0xef53('0x7e')][_0xef53('0x7f')]})[_0xef53('0x28')](function(_0x1a33ff){if(_0x1a33ff[_0xef53('0x4e')]===0x1){return _0x536dd8['id'];}else{var _0x44319a=_[_0xef53('0x80')](_['map'](_0x1a33ff,_0xef53('0x81')),function(_0x2d76d1){return _[_0xef53('0x82')](_0x1e1ea7,_0x2d76d1);});if(_0x44319a){return _0x536dd8['id'];}}}));}}return BPromise[_0xef53('0x83')](_0x34255e)[_0xef53('0x28')](function(_0x40f4d9){_0x46e2d3=_(_0x46e2d3)[_0xef53('0x84')](_0x40f4d9)[_0xef53('0x85')]()[_0xef53('0x86')]();return db['MailQueue'][_0xef53('0x57')]({'where':{'id':_0x118f05['params']['id']}})[_0xef53('0x28')](function(_0x2c68f1){return db[_0xef53('0x6d')][_0xef53('0x6e')](function(_0x360f44){return _0x2c68f1[_0xef53('0x73')](_0x118f05[_0xef53('0x35')][_0xef53('0x87')],{'transaction':_0x360f44})[_0xef53('0x28')](function(){if(!_[_0xef53('0x88')](_0x46e2d3)){return _0x2c68f1[_0xef53('0x89')](_0x46e2d3,{'transaction':_0x360f44});}})[_0xef53('0x28')](function(){_0x46e2d3[_0xef53('0x71')](function(_0x5edfa2){socket[_0xef53('0x72')](_0xef53('0x8a'),{'UserId':_0x5edfa2,'MailQueueId':_0x2c68f1['id']});});});});});});})[_0xef53('0x28')](respondWithStatusCode(_0x4915fb,null))[_0xef53('0x4a')](handleError(_0x4915fb,null));};exports[_0xef53('0x8b')]=function(_0x3fb5e6,_0x29d8f9,_0x2faff9){return db[_0xef53('0x46')][_0xef53('0x57')]({'where':{'id':_0x3fb5e6[_0xef53('0x4c')]['id']}})[_0xef53('0x28')](handleEntityNotFound(_0x29d8f9,null))[_0xef53('0x28')](function(_0x537cbe){if(_0x537cbe){return _0x537cbe[_0xef53('0x8b')](_0x3fb5e6[_0xef53('0x56')][_0xef53('0x87')],_['omit'](_0x3fb5e6[_0xef53('0x56')],[_0xef53('0x87'),'id'])||{})[_0xef53('0x8c')](function(_0x366634){for(var _0x44ee2b=0x0;_0x44ee2b<_0x3fb5e6[_0xef53('0x56')][_0xef53('0x87')][_0xef53('0x4e')];_0x44ee2b+=0x1){socket[_0xef53('0x72')](_0xef53('0x8d'),{'UserId':_0x3fb5e6['body']['ids'][_0x44ee2b],'MailQueueId':_0x3fb5e6[_0xef53('0x4c')]['id']});}return _0x366634;});}})[_0xef53('0x28')](respondWithResult(_0x29d8f9,null))['catch'](handleError(_0x29d8f9,null));};exports['removeAgents']=function(_0x5337b4,_0x2d7764,_0x3931eb){return db[_0xef53('0x46')][_0xef53('0x57')]({'where':{'id':_0x5337b4['params']['id']}})[_0xef53('0x28')](handleEntityNotFound(_0x2d7764,null))[_0xef53('0x28')](function(_0x2d8c20){if(_0x2d8c20){return _0x2d8c20[_0xef53('0x89')](_0x5337b4[_0xef53('0x35')]['ids'])[_0xef53('0x28')](function(){if(_[_0xef53('0x8e')](_0x5337b4[_0xef53('0x35')][_0xef53('0x87')])){for(var _0x22a8eb=0x0;_0x22a8eb<_0x5337b4[_0xef53('0x35')][_0xef53('0x87')][_0xef53('0x4e')];_0x22a8eb+=0x1){socket[_0xef53('0x72')](_0xef53('0x8a'),{'UserId':Number(_0x5337b4[_0xef53('0x35')][_0xef53('0x87')][_0x22a8eb]),'MailQueueId':Number(_0x5337b4[_0xef53('0x4c')]['id'])});}}else{socket[_0xef53('0x72')](_0xef53('0x8a'),{'UserId':Number(_0x5337b4['query'][_0xef53('0x87')]),'MailQueueId':Number(_0x5337b4['params']['id'])});}});}})['then'](respondWithStatusCode(_0x2d7764,null))[_0xef53('0x4a')](handleError(_0x2d7764,null));};exports['getAgents']=function(_0x1a0646,_0xb160a7,_0x4bbeca){var _0xde95a4={};var _0x50e681={};var _0x4d5f4f;var _0x5d4305;return db[_0xef53('0x46')]['findOne']({'where':{'id':_0x1a0646[_0xef53('0x4c')]['id']}})['then'](handleEntityNotFound(_0xb160a7,null))[_0xef53('0x28')](function(_0xe53e17){if(_0xe53e17){_0x4d5f4f=_0xe53e17;_0x50e681['model']=_[_0xef53('0x36')](db['User'][_0xef53('0x4d')]);_0x50e681[_0xef53('0x35')]=_['keys'](_0x1a0646['query']);_0x50e681['filters']=_[_0xef53('0x38')](_0x50e681['model'],_0x50e681[_0xef53('0x35')]);_0xde95a4[_0xef53('0x3a')]=_[_0xef53('0x38')](_0x50e681[_0xef53('0x39')],qs[_0xef53('0x3b')](_0x1a0646[_0xef53('0x35')][_0xef53('0x3b')]));_0xde95a4['attributes']=_0xde95a4['attributes'][_0xef53('0x4e')]?_0xde95a4[_0xef53('0x3a')]:_0x50e681[_0xef53('0x39')];_0xde95a4[_0xef53('0x3d')]=qs[_0xef53('0x3e')](_0x1a0646['query'][_0xef53('0x3e')]);_0xde95a4[_0xef53('0x40')]=qs[_0xef53('0x37')](_[_0xef53('0x3f')](_0x1a0646[_0xef53('0x35')],_0x50e681[_0xef53('0x37')]));if(_0x1a0646['query'][_0xef53('0x44')]){_0xde95a4[_0xef53('0x40')]=_[_0xef53('0x41')](_0xde95a4[_0xef53('0x40')],{'$or':_['map'](_0xde95a4[_0xef53('0x3a')],function(_0x149a1e){var _0x79b430={};_0x79b430[_0x149a1e]={'$like':'%'+_0x1a0646['query'][_0xef53('0x44')]+'%'};return _0x79b430;})});}_0xde95a4=_[_0xef53('0x41')]({},_0xde95a4,_0x1a0646[_0xef53('0x45')]);return _0x4d5f4f[_0xef53('0x8f')](_0xde95a4);}})[_0xef53('0x28')](function(_0x16348e){if(_0x16348e){_0x5d4305=_0x16348e[_0xef53('0x4e')];if(!_0x1a0646[_0xef53('0x35')][_0xef53('0x3c')]('nolimit')){_0xde95a4[_0xef53('0x21')]=qs['limit'](_0x1a0646['query'][_0xef53('0x21')]);_0xde95a4[_0xef53('0x20')]=qs[_0xef53('0x20')](_0x1a0646['query'][_0xef53('0x20')]);}return _0x4d5f4f[_0xef53('0x8f')](_0xde95a4);}})['then'](function(_0x2929ba){if(_0x2929ba){return _0x2929ba?{'count':_0x5d4305,'rows':_0x2929ba}:null;}})[_0xef53('0x28')](respondWithResult(_0xb160a7,null))[_0xef53('0x4a')](handleError(_0xb160a7,null));}; \ No newline at end of file +var _0x5401=['findAndCountAll','UserId','agent','mailPause','rows','%s/%s','SIP','createdAt','updatedAt','getTeams','findOne','Team','nolimit','addTeams','ids','Agents','online','flatMap','sequelize','each','findOrCreate','forEach','emit','field','tq.TeamId','from','team_has_mail_queues','join','ut.TeamId\x20=\x20tq.TeamId','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','QueryTypes','SELECT','TeamId','includes','all','union','compact','transaction','isEmpty','removeAgents','addAgents','spread','userMailQueue:save','isArray','userMailQueue:remove','getAgents','html-pdf','eml-format','rimraf','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','sendStatus','status','json','count','limit','set','Content-Range','reject','update','destroy','get','MailQueues','UserProfileResource','then','end','stack','name','send','index','map','MailQueue','fieldName','type','model','query','keys','filters','attributes','fields','length','offset','order','sort','where','pick','filter','merge','VIRTUAL','include','findAll','catch','params','rawAttributes','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','describe','getMembers','UserMailQueue','hasOwnProperty','MailQueueId','User'];(function(_0x5976f8,_0x1265b7){var _0x179715=function(_0x2b2c4b){while(--_0x2b2c4b){_0x5976f8['push'](_0x5976f8['shift']());}};_0x179715(++_0x1265b7);}(_0x5401,0xb8));var _0x1540=function(_0x58a4b5,_0x182439){_0x58a4b5=_0x58a4b5-0x0;var _0x51821d=_0x5401[_0x58a4b5];return _0x51821d;};'use strict';var pdf=require(_0x1540('0x0'));var emlformat=require(_0x1540('0x1'));var rimraf=require(_0x1540('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x1540('0x3'));var moment=require(_0x1540('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1540('0x5'));var util=require(_0x1540('0x6'));var path=require(_0x1540('0x7'));var sox=require(_0x1540('0x8'));var csv=require(_0x1540('0x9'));var ejs=require(_0x1540('0xa'));var fs=require('fs');var _=require(_0x1540('0xb'));var squel=require('squel');var crypto=require(_0x1540('0xc'));var jsforce=require(_0x1540('0xd'));var deskjs=require(_0x1540('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x1540('0xf'));var Redis=require(_0x1540('0x10'));var authService=require(_0x1540('0x11'));var qs=require(_0x1540('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1540('0x13'))('api');var utils=require(_0x1540('0x14'));var config=require(_0x1540('0x15'));var db=require(_0x1540('0x16'))['db'];config[_0x1540('0x17')]=_[_0x1540('0x18')](config[_0x1540('0x17')],{'host':_0x1540('0x19'),'port':0x18eb});var socket=require(_0x1540('0x1a'))(new Redis(config[_0x1540('0x17')]));require(_0x1540('0x1b'))['register'](socket);function respondWithStatusCode(_0x493ca1,_0x1479ba){_0x1479ba=_0x1479ba||0xcc;return function(_0xc5c36d){if(_0xc5c36d){return _0x493ca1[_0x1540('0x1c')](_0x1479ba);}return _0x493ca1[_0x1540('0x1d')](_0x1479ba)['end']();};}function respondWithResult(_0x24a3fe,_0x4557a2){_0x4557a2=_0x4557a2||0xc8;return function(_0x124865){if(_0x124865){return _0x24a3fe[_0x1540('0x1d')](_0x4557a2)[_0x1540('0x1e')](_0x124865);}};}function respondWithFilteredResult(_0x1df3cb,_0x4fe97a){return function(_0x480648){if(_0x480648){var _0x1e7dd6=_0x480648[_0x1540('0x1f')],_0x22756f=_0x4fe97a['offset'],_0x4950d0=_0x4fe97a['offset']+_0x4fe97a[_0x1540('0x20')],_0x472ae7;if(_0x4950d0>=_0x1e7dd6){_0x4950d0=_0x1e7dd6;_0x472ae7=0xc8;}else{_0x472ae7=0xce;}_0x1df3cb[_0x1540('0x1d')](_0x472ae7);return _0x1df3cb[_0x1540('0x21')](_0x1540('0x22'),_0x22756f+'-'+_0x4950d0+'/'+_0x1e7dd6)[_0x1540('0x1e')](_0x480648);}return null;};}function patchUpdates(_0x42845e){return function(_0xc46f76){try{jsonpatch['apply'](_0xc46f76,_0x42845e,!![]);}catch(_0x36dfe0){return BPromise[_0x1540('0x23')](_0x36dfe0);}return _0xc46f76['save']();};}function saveUpdates(_0x5016cf,_0x40a7ad){return function(_0x538f5a){if(_0x538f5a){return _0x538f5a[_0x1540('0x24')](_0x5016cf)['then'](function(_0xd1e43c){return _0xd1e43c;});}return null;};}function removeEntity(_0x22a813,_0x42b892){return function(_0x1e0584){if(_0x1e0584){return _0x1e0584[_0x1540('0x25')]()['then'](function(){var _0x17d066=_0x1e0584[_0x1540('0x26')]({'plain':!![]});var _0xc573b4=_0x1540('0x27');return db[_0x1540('0x28')][_0x1540('0x25')]({'where':{'type':_0xc573b4,'resourceId':_0x17d066['id']}})[_0x1540('0x29')](function(){return _0x1e0584;});})[_0x1540('0x29')](function(){_0x22a813['status'](0xcc)[_0x1540('0x2a')]();});}};}function handleEntityNotFound(_0x269b28,_0xf6583a){return function(_0x3edd74){if(!_0x3edd74){_0x269b28['sendStatus'](0x194);}return _0x3edd74;};}function handleError(_0x321b17,_0x11d83a){_0x11d83a=_0x11d83a||0x1f4;return function(_0x296a6a){logger['error'](_0x296a6a[_0x1540('0x2b')]);if(_0x296a6a[_0x1540('0x2c')]){delete _0x296a6a['name'];}_0x321b17['status'](_0x11d83a)[_0x1540('0x2d')](_0x296a6a);};}exports[_0x1540('0x2e')]=function(_0xc38358,_0x26bc40){var _0x34951d={},_0x27e70f={},_0x28c880={'count':0x0,'rows':[]};var _0x1e392a=_[_0x1540('0x2f')](db[_0x1540('0x30')]['rawAttributes'],function(_0x3cd40a){return{'name':_0x3cd40a[_0x1540('0x31')],'type':_0x3cd40a[_0x1540('0x32')]['key']};});_0x27e70f[_0x1540('0x33')]=_['map'](_0x1e392a,_0x1540('0x2c'));_0x27e70f[_0x1540('0x34')]=_[_0x1540('0x35')](_0xc38358[_0x1540('0x34')]);_0x27e70f[_0x1540('0x36')]=_['intersection'](_0x27e70f[_0x1540('0x33')],_0x27e70f[_0x1540('0x34')]);_0x34951d[_0x1540('0x37')]=_['intersection'](_0x27e70f[_0x1540('0x33')],qs[_0x1540('0x38')](_0xc38358[_0x1540('0x34')][_0x1540('0x38')]));_0x34951d['attributes']=_0x34951d[_0x1540('0x37')][_0x1540('0x39')]?_0x34951d[_0x1540('0x37')]:_0x27e70f[_0x1540('0x33')];if(!_0xc38358[_0x1540('0x34')]['hasOwnProperty']('nolimit')){_0x34951d[_0x1540('0x20')]=qs[_0x1540('0x20')](_0xc38358[_0x1540('0x34')][_0x1540('0x20')]);_0x34951d[_0x1540('0x3a')]=qs[_0x1540('0x3a')](_0xc38358['query'][_0x1540('0x3a')]);}_0x34951d[_0x1540('0x3b')]=qs[_0x1540('0x3c')](_0xc38358[_0x1540('0x34')][_0x1540('0x3c')]);_0x34951d[_0x1540('0x3d')]=qs[_0x1540('0x36')](_[_0x1540('0x3e')](_0xc38358[_0x1540('0x34')],_0x27e70f[_0x1540('0x36')]));if(_0xc38358['query'][_0x1540('0x3f')]){_0x34951d[_0x1540('0x3d')]=_[_0x1540('0x40')](_0x34951d[_0x1540('0x3d')],{'$or':_[_0x1540('0x2f')](_0x1e392a,function(_0x468e46){if(_0x468e46[_0x1540('0x32')]!==_0x1540('0x41')){var _0x386037={};_0x386037[_0x468e46[_0x1540('0x2c')]]={'$like':'%'+_0xc38358[_0x1540('0x34')][_0x1540('0x3f')]+'%'};return _0x386037;}})});}_0x34951d=_[_0x1540('0x40')]({},_0x34951d,_0xc38358['options']);var _0x357ed1={'where':_0x34951d[_0x1540('0x3d')]};return db[_0x1540('0x30')][_0x1540('0x1f')](_0x357ed1)[_0x1540('0x29')](function(_0x56b3a8){_0x28c880[_0x1540('0x1f')]=_0x56b3a8;if(_0xc38358[_0x1540('0x34')]['includeAll']){_0x34951d[_0x1540('0x42')]=[{'all':!![]}];}return db[_0x1540('0x30')][_0x1540('0x43')](_0x34951d);})[_0x1540('0x29')](function(_0x59be26){_0x28c880['rows']=_0x59be26;return _0x28c880;})[_0x1540('0x29')](respondWithFilteredResult(_0x26bc40,_0x34951d))[_0x1540('0x44')](handleError(_0x26bc40,null));};exports['show']=function(_0x18b297,_0xd7a5bb){var _0x53fc8d={'raw':!![],'where':{'id':_0x18b297[_0x1540('0x45')]['id']}},_0x13a387={};_0x13a387['model']=_[_0x1540('0x35')](db[_0x1540('0x30')][_0x1540('0x46')]);_0x13a387['query']=_['keys'](_0x18b297[_0x1540('0x34')]);_0x13a387[_0x1540('0x36')]=_['intersection'](_0x13a387['model'],_0x13a387[_0x1540('0x34')]);_0x53fc8d[_0x1540('0x37')]=_[_0x1540('0x47')](_0x13a387[_0x1540('0x33')],qs['fields'](_0x18b297[_0x1540('0x34')][_0x1540('0x38')]));_0x53fc8d[_0x1540('0x37')]=_0x53fc8d[_0x1540('0x37')]['length']?_0x53fc8d['attributes']:_0x13a387[_0x1540('0x33')];if(_0x18b297[_0x1540('0x34')]['includeAll']){_0x53fc8d[_0x1540('0x42')]=[{'all':!![]}];}_0x53fc8d=_[_0x1540('0x40')]({},_0x53fc8d,_0x18b297[_0x1540('0x48')]);return db['MailQueue'][_0x1540('0x49')](_0x53fc8d)[_0x1540('0x29')](handleEntityNotFound(_0xd7a5bb,null))[_0x1540('0x29')](respondWithResult(_0xd7a5bb,null))['catch'](handleError(_0xd7a5bb,null));};exports[_0x1540('0x4a')]=function(_0x235abd,_0x4f8697){return db['MailQueue'][_0x1540('0x4a')](_0x235abd[_0x1540('0x4b')],{})[_0x1540('0x29')](function(_0x4b09f2){var _0x49f437=_0x235abd[_0x1540('0x4c')][_0x1540('0x26')]({'plain':!![]});if(!_0x49f437)throw new Error(_0x1540('0x4d'));if(_0x49f437[_0x1540('0x4e')]===_0x1540('0x4c')){var _0x4c0f70=_0x4b09f2['get']({'plain':!![]});var _0x54b2f6='MailQueues';return db[_0x1540('0x4f')][_0x1540('0x49')]({'where':{'name':_0x54b2f6,'userProfileId':_0x49f437[_0x1540('0x50')]},'raw':!![]})['then'](function(_0x628146){if(_0x628146&&_0x628146['autoAssociation']===0x0){return db['UserProfileResource'][_0x1540('0x4a')]({'name':_0x4c0f70[_0x1540('0x2c')],'resourceId':_0x4c0f70['id'],'type':_0x628146[_0x1540('0x2c')],'sectionId':_0x628146['id']},{})['then'](function(){return _0x4b09f2;});}else{return _0x4b09f2;}})['catch'](function(_0x509673){logger[_0x1540('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x509673);throw _0x509673;});}return _0x4b09f2;})[_0x1540('0x29')](respondWithResult(_0x4f8697,0xc9))['catch'](handleError(_0x4f8697,null));};exports[_0x1540('0x24')]=function(_0x62fda9,_0x34e554){if(_0x62fda9[_0x1540('0x4b')]['id']){delete _0x62fda9[_0x1540('0x4b')]['id'];}return db[_0x1540('0x30')][_0x1540('0x49')]({'where':{'id':_0x62fda9[_0x1540('0x45')]['id']}})[_0x1540('0x29')](handleEntityNotFound(_0x34e554,null))[_0x1540('0x29')](saveUpdates(_0x62fda9[_0x1540('0x4b')],null))['then'](respondWithResult(_0x34e554,null))[_0x1540('0x44')](handleError(_0x34e554,null));};exports[_0x1540('0x25')]=function(_0x2b33c7,_0x201945){return db[_0x1540('0x30')][_0x1540('0x49')]({'where':{'id':_0x2b33c7[_0x1540('0x45')]['id']}})[_0x1540('0x29')](handleEntityNotFound(_0x201945,null))['then'](removeEntity(_0x201945,null))[_0x1540('0x44')](handleError(_0x201945,null));};exports['describe']=function(_0x36eddc,_0x3b5598){return db[_0x1540('0x30')][_0x1540('0x52')]()[_0x1540('0x29')](respondWithResult(_0x3b5598,null))[_0x1540('0x44')](handleError(_0x3b5598,null));};exports[_0x1540('0x53')]=function(_0x498df7,_0x13e355,_0x3b5ced){var _0x51a12a={'raw':!![],'where':{}},_0x31890c={},_0x12e3e4;return db[_0x1540('0x30')]['findOne']({'where':{'id':_0x498df7['params']['id']}})['then'](handleEntityNotFound(_0x13e355,null))['then'](function(_0x4fac03){if(_0x4fac03){_0x12e3e4=_0x4fac03[_0x1540('0x26')]({'plain':!![]});_0x31890c[_0x1540('0x33')]=_[_0x1540('0x35')](db[_0x1540('0x54')][_0x1540('0x46')]);_0x31890c['query']=_[_0x1540('0x35')](_0x498df7[_0x1540('0x34')]);_0x31890c['filters']=_['intersection'](_0x31890c[_0x1540('0x33')],_0x31890c[_0x1540('0x34')]);_0x51a12a[_0x1540('0x37')]=_['intersection'](_0x31890c[_0x1540('0x33')],qs[_0x1540('0x38')](_0x498df7[_0x1540('0x34')][_0x1540('0x38')]));_0x51a12a[_0x1540('0x37')]=_0x51a12a[_0x1540('0x37')][_0x1540('0x39')]?_0x51a12a[_0x1540('0x37')]:_0x31890c[_0x1540('0x33')];if(!_0x498df7['query'][_0x1540('0x55')]('nolimit')){_0x51a12a[_0x1540('0x20')]=qs[_0x1540('0x20')](_0x498df7[_0x1540('0x34')][_0x1540('0x20')]);_0x51a12a[_0x1540('0x3a')]=qs['offset'](_0x498df7[_0x1540('0x34')][_0x1540('0x3a')]);}_0x51a12a['order']=qs['sort'](_0x498df7[_0x1540('0x34')][_0x1540('0x3c')]);_0x51a12a[_0x1540('0x3d')]=qs[_0x1540('0x36')](_[_0x1540('0x3e')](_0x498df7[_0x1540('0x34')],_0x31890c[_0x1540('0x36')]));_0x51a12a['where'][_0x1540('0x56')]=_0x4fac03['id'];if(_0x498df7[_0x1540('0x34')]['filter']){_0x51a12a[_0x1540('0x3d')]=_[_0x1540('0x40')](_0x51a12a[_0x1540('0x3d')],{'$or':_[_0x1540('0x2f')](_0x51a12a[_0x1540('0x37')],function(_0x22c2ce){var _0x478356={};_0x478356[_0x22c2ce]={'$like':'%'+_0x498df7[_0x1540('0x34')][_0x1540('0x3f')]+'%'};return _0x478356;})});}_0x51a12a=_[_0x1540('0x40')]({},_0x51a12a,_0x498df7[_0x1540('0x48')]);return db['UserMailQueue'][_0x1540('0x43')](_0x51a12a);}})['then'](function(_0x4aee3a){if(_0x4aee3a){return db[_0x1540('0x57')][_0x1540('0x58')]({'where':{'id':_[_0x1540('0x2f')](_0x4aee3a,_0x1540('0x59')),'role':_0x1540('0x5a')},'attributes':['id','name',_0x1540('0x5b'),'updatedAt','createdAt']});}})[_0x1540('0x29')](function(_0x1140d7){if(_0x1140d7){return{'count':_0x1140d7[_0x1540('0x1f')],'rows':_[_0x1540('0x2f')](_0x1140d7[_0x1540('0x5c')],function(_0x516382){return{'membername':_0x516382[_0x1540('0x2c')],'UserId':_0x516382['id'],'queue_name':_0x12e3e4[_0x1540('0x2c')],'MailQueueId':_0x12e3e4['id'],'interface':util['format'](_0x1540('0x5d'),_0x1540('0x5e'),_0x516382[_0x1540('0x2c')]),'penalty':0x0,'paused':_0x516382[_0x1540('0x5b')],'createdAt':_0x516382[_0x1540('0x5f')],'updatedAt':_0x516382[_0x1540('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x13e355,_0x51a12a))['catch'](handleError(_0x13e355,null));};exports[_0x1540('0x61')]=function(_0x4c9166,_0x28f6a1,_0x132130){var _0x41126d={};var _0x52571e={};var _0x23e1bf;var _0x4ed000;return db[_0x1540('0x30')][_0x1540('0x62')]({'where':{'id':_0x4c9166['params']['id']}})['then'](handleEntityNotFound(_0x28f6a1,null))[_0x1540('0x29')](function(_0xee25cf){if(_0xee25cf){_0x23e1bf=_0xee25cf;_0x52571e[_0x1540('0x33')]=_[_0x1540('0x35')](db[_0x1540('0x63')]['rawAttributes']);_0x52571e['query']=_[_0x1540('0x35')](_0x4c9166[_0x1540('0x34')]);_0x52571e[_0x1540('0x36')]=_['intersection'](_0x52571e[_0x1540('0x33')],_0x52571e[_0x1540('0x34')]);_0x41126d[_0x1540('0x37')]=_[_0x1540('0x47')](_0x52571e[_0x1540('0x33')],qs['fields'](_0x4c9166[_0x1540('0x34')][_0x1540('0x38')]));_0x41126d[_0x1540('0x37')]=_0x41126d[_0x1540('0x37')][_0x1540('0x39')]?_0x41126d['attributes']:_0x52571e[_0x1540('0x33')];_0x41126d[_0x1540('0x3b')]=qs[_0x1540('0x3c')](_0x4c9166[_0x1540('0x34')]['sort']);_0x41126d[_0x1540('0x3d')]=qs[_0x1540('0x36')](_[_0x1540('0x3e')](_0x4c9166[_0x1540('0x34')],_0x52571e[_0x1540('0x36')]));if(_0x4c9166[_0x1540('0x34')]['filter']){_0x41126d[_0x1540('0x3d')]=_[_0x1540('0x40')](_0x41126d[_0x1540('0x3d')],{'$or':_[_0x1540('0x2f')](_0x41126d[_0x1540('0x37')],function(_0x5b0b2c){var _0x350358={};_0x350358[_0x5b0b2c]={'$like':'%'+_0x4c9166[_0x1540('0x34')]['filter']+'%'};return _0x350358;})});}_0x41126d=_[_0x1540('0x40')]({},_0x41126d,_0x4c9166[_0x1540('0x48')]);return _0x23e1bf[_0x1540('0x61')](_0x41126d);}})['then'](function(_0x921a33){if(_0x921a33){_0x4ed000=_0x921a33['length'];if(!_0x4c9166['query'][_0x1540('0x55')](_0x1540('0x64'))){_0x41126d[_0x1540('0x20')]=qs[_0x1540('0x20')](_0x4c9166[_0x1540('0x34')]['limit']);_0x41126d[_0x1540('0x3a')]=qs['offset'](_0x4c9166['query'][_0x1540('0x3a')]);}return _0x23e1bf[_0x1540('0x61')](_0x41126d);}})['then'](function(_0x17a132){if(_0x17a132){return _0x17a132?{'count':_0x4ed000,'rows':_0x17a132}:null;}})[_0x1540('0x29')](respondWithResult(_0x28f6a1,null))[_0x1540('0x44')](handleError(_0x28f6a1,null));};exports[_0x1540('0x65')]=function(_0x5a4f8f,_0x4a3381,_0x1ead43){var _0x192e90=_0x5a4f8f[_0x1540('0x4b')][_0x1540('0x66')];return db[_0x1540('0x63')][_0x1540('0x43')]({'where':{'id':_0x192e90},'attributes':['id'],'include':[{'model':db[_0x1540('0x57')],'as':_0x1540('0x67'),'attributes':['id',_0x1540('0x2c'),_0x1540('0x68'),'voicePause','interface'],'raw':!![]}]})[_0x1540('0x29')](function(_0x53b737){if(_0x53b737){var _0x246413=_[_0x1540('0x69')](_0x53b737,function(_0x31482c){var _0x23a7f1=_0x31482c[_0x1540('0x26')]({'plain':!![]});return _0x23a7f1[_0x1540('0x67')];});return db['MailQueue'][_0x1540('0x49')]({'where':{'id':_0x5a4f8f[_0x1540('0x45')]['id']}})[_0x1540('0x29')](function(_0x56596a){return db[_0x1540('0x6a')]['transaction'](function(_0x31987d){return _0x56596a[_0x1540('0x65')](_0x192e90,{'transaction':_0x31987d})['then'](function(){return BPromise[_0x1540('0x6b')](_0x246413,function(_0x4a3364){return db['UserMailQueue'][_0x1540('0x6c')]({'where':{'UserId':_0x4a3364['id'],'MailQueueId':_0x5a4f8f[_0x1540('0x45')]['id']},'transaction':_0x31987d});});})[_0x1540('0x29')](function(){_0x246413[_0x1540('0x6d')](function(_0x9d0067){socket[_0x1540('0x6e')]('userMailQueue:save',{'UserId':_0x9d0067['id'],'MailQueueId':_0x56596a['id']});});});});});}})['then'](respondWithStatusCode(_0x4a3381,null))['catch'](handleError(_0x4a3381,null));};exports['removeTeams']=function(_0xbb452d,_0x499167,_0xfb89ee){return db[_0x1540('0x63')][_0x1540('0x43')]({'where':{'id':_0xbb452d['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x1540('0x57')],'as':_0x1540('0x67'),'attributes':['id'],'raw':!![]}]})[_0x1540('0x29')](handleEntityNotFound(_0x499167,null))[_0x1540('0x29')](function(_0x530593){var _0x3de67a=_[_0x1540('0x2f')](_0x530593,'id');var _0x485e4f=[];var _0x390840=[];var _0x25ebcb=squel['select']();_0x25ebcb[_0x1540('0x6f')](_0x1540('0x70'))[_0x1540('0x71')](_0x1540('0x72'),'tq')[_0x1540('0x73')]('user_has_teams','ut',_0x1540('0x74'))[_0x1540('0x3d')](_0x1540('0x75'),_0xbb452d[_0x1540('0x45')]['id']);for(var _0x570bae=0x0;_0x570bae<_0x530593['length'];_0x570bae+=0x1){let _0x34d89f=_0x530593[_0x570bae];for(var _0x2c00e0=0x0;_0x2c00e0<_0x34d89f['Agents'][_0x1540('0x39')];_0x2c00e0+=0x1){let _0x4b904c=_0x34d89f[_0x1540('0x67')][_0x2c00e0];var _0xd4ed22=_0x25ebcb[_0x1540('0x76')]();_0xd4ed22[_0x1540('0x3d')](_0x1540('0x77'),_0x4b904c['id']);_0x390840['push'](db[_0x1540('0x6a')][_0x1540('0x34')](_0xd4ed22['toString'](),{'type':db['sequelize'][_0x1540('0x78')][_0x1540('0x79')]})['then'](function(_0x156ba5){if(_0x156ba5['length']===0x1){return _0x4b904c['id'];}else{var _0x50286b=_['every'](_[_0x1540('0x2f')](_0x156ba5,_0x1540('0x7a')),function(_0xf8891c){return _[_0x1540('0x7b')](_0x3de67a,_0xf8891c);});if(_0x50286b){return _0x4b904c['id'];}}}));}}return BPromise[_0x1540('0x7c')](_0x390840)[_0x1540('0x29')](function(_0x2cad5d){_0x485e4f=_(_0x485e4f)[_0x1540('0x7d')](_0x2cad5d)[_0x1540('0x7e')]()['value']();return db[_0x1540('0x30')][_0x1540('0x49')]({'where':{'id':_0xbb452d[_0x1540('0x45')]['id']}})[_0x1540('0x29')](function(_0x428209){return db[_0x1540('0x6a')][_0x1540('0x7f')](function(_0x265a5f){return _0x428209['removeTeams'](_0xbb452d['query']['ids'],{'transaction':_0x265a5f})[_0x1540('0x29')](function(){if(!_[_0x1540('0x80')](_0x485e4f)){return _0x428209[_0x1540('0x81')](_0x485e4f,{'transaction':_0x265a5f});}})['then'](function(){_0x485e4f[_0x1540('0x6d')](function(_0x22ad82){socket[_0x1540('0x6e')]('userMailQueue:remove',{'UserId':_0x22ad82,'MailQueueId':_0x428209['id']});});});});});});})[_0x1540('0x29')](respondWithStatusCode(_0x499167,null))[_0x1540('0x44')](handleError(_0x499167,null));};exports[_0x1540('0x82')]=function(_0x2452de,_0x130bea,_0x1390ef){return db['MailQueue'][_0x1540('0x49')]({'where':{'id':_0x2452de[_0x1540('0x45')]['id']}})[_0x1540('0x29')](handleEntityNotFound(_0x130bea,null))['then'](function(_0x2b202c){if(_0x2b202c){return _0x2b202c[_0x1540('0x82')](_0x2452de['body'][_0x1540('0x66')],_['omit'](_0x2452de[_0x1540('0x4b')],['ids','id'])||{})[_0x1540('0x83')](function(_0x570b4e){for(var _0x10ac45=0x0;_0x10ac45<_0x2452de[_0x1540('0x4b')]['ids'][_0x1540('0x39')];_0x10ac45+=0x1){socket[_0x1540('0x6e')](_0x1540('0x84'),{'UserId':_0x2452de[_0x1540('0x4b')][_0x1540('0x66')][_0x10ac45],'MailQueueId':_0x2452de[_0x1540('0x45')]['id']});}return _0x570b4e;});}})[_0x1540('0x29')](respondWithResult(_0x130bea,null))[_0x1540('0x44')](handleError(_0x130bea,null));};exports[_0x1540('0x81')]=function(_0x1f01ae,_0x5f8359,_0xedaaae){return db[_0x1540('0x30')][_0x1540('0x49')]({'where':{'id':_0x1f01ae[_0x1540('0x45')]['id']}})[_0x1540('0x29')](handleEntityNotFound(_0x5f8359,null))[_0x1540('0x29')](function(_0x10edfb){if(_0x10edfb){return _0x10edfb[_0x1540('0x81')](_0x1f01ae[_0x1540('0x34')][_0x1540('0x66')])[_0x1540('0x29')](function(){if(_[_0x1540('0x85')](_0x1f01ae[_0x1540('0x34')]['ids'])){for(var _0x12dab7=0x0;_0x12dab7<_0x1f01ae[_0x1540('0x34')]['ids'][_0x1540('0x39')];_0x12dab7+=0x1){socket['emit'](_0x1540('0x86'),{'UserId':Number(_0x1f01ae[_0x1540('0x34')][_0x1540('0x66')][_0x12dab7]),'MailQueueId':Number(_0x1f01ae[_0x1540('0x45')]['id'])});}}else{socket[_0x1540('0x6e')](_0x1540('0x86'),{'UserId':Number(_0x1f01ae[_0x1540('0x34')][_0x1540('0x66')]),'MailQueueId':Number(_0x1f01ae['params']['id'])});}});}})['then'](respondWithStatusCode(_0x5f8359,null))[_0x1540('0x44')](handleError(_0x5f8359,null));};exports[_0x1540('0x87')]=function(_0x58f6b5,_0x44879e,_0x3d8d59){var _0x1dce57={};var _0x406ad8={};var _0x5b3a21;var _0x39b135;return db[_0x1540('0x30')][_0x1540('0x62')]({'where':{'id':_0x58f6b5[_0x1540('0x45')]['id']}})[_0x1540('0x29')](handleEntityNotFound(_0x44879e,null))['then'](function(_0x5ed2a2){if(_0x5ed2a2){_0x5b3a21=_0x5ed2a2;_0x406ad8['model']=_['keys'](db[_0x1540('0x57')]['rawAttributes']);_0x406ad8[_0x1540('0x34')]=_['keys'](_0x58f6b5['query']);_0x406ad8[_0x1540('0x36')]=_[_0x1540('0x47')](_0x406ad8[_0x1540('0x33')],_0x406ad8['query']);_0x1dce57[_0x1540('0x37')]=_['intersection'](_0x406ad8[_0x1540('0x33')],qs[_0x1540('0x38')](_0x58f6b5['query']['fields']));_0x1dce57[_0x1540('0x37')]=_0x1dce57[_0x1540('0x37')][_0x1540('0x39')]?_0x1dce57[_0x1540('0x37')]:_0x406ad8[_0x1540('0x33')];_0x1dce57['order']=qs[_0x1540('0x3c')](_0x58f6b5[_0x1540('0x34')]['sort']);_0x1dce57[_0x1540('0x3d')]=qs['filters'](_[_0x1540('0x3e')](_0x58f6b5[_0x1540('0x34')],_0x406ad8[_0x1540('0x36')]));if(_0x58f6b5[_0x1540('0x34')][_0x1540('0x3f')]){_0x1dce57[_0x1540('0x3d')]=_[_0x1540('0x40')](_0x1dce57[_0x1540('0x3d')],{'$or':_[_0x1540('0x2f')](_0x1dce57[_0x1540('0x37')],function(_0x3f8c2e){var _0x49f5c1={};_0x49f5c1[_0x3f8c2e]={'$like':'%'+_0x58f6b5['query'][_0x1540('0x3f')]+'%'};return _0x49f5c1;})});}_0x1dce57=_[_0x1540('0x40')]({},_0x1dce57,_0x58f6b5['options']);return _0x5b3a21['getAgents'](_0x1dce57);}})[_0x1540('0x29')](function(_0x1bf1a9){if(_0x1bf1a9){_0x39b135=_0x1bf1a9[_0x1540('0x39')];if(!_0x58f6b5[_0x1540('0x34')][_0x1540('0x55')](_0x1540('0x64'))){_0x1dce57['limit']=qs[_0x1540('0x20')](_0x58f6b5[_0x1540('0x34')][_0x1540('0x20')]);_0x1dce57[_0x1540('0x3a')]=qs[_0x1540('0x3a')](_0x58f6b5['query'][_0x1540('0x3a')]);}return _0x5b3a21[_0x1540('0x87')](_0x1dce57);}})[_0x1540('0x29')](function(_0x5767da){if(_0x5767da){return _0x5767da?{'count':_0x39b135,'rows':_0x5767da}:null;}})[_0x1540('0x29')](respondWithResult(_0x44879e,null))[_0x1540('0x44')](handleError(_0x44879e,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 3c7c13f..48d094e 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 _0x5ee1=['hook','events','../../mysqldb','MailQueue','save','update','remove','emit'];(function(_0x26d386,_0x1660c0){var _0x4ef9a8=function(_0x55e2d3){while(--_0x55e2d3){_0x26d386['push'](_0x26d386['shift']());}};_0x4ef9a8(++_0x1660c0);}(_0x5ee1,0x109));var _0x15ee=function(_0x46cb9d,_0x556b06){_0x46cb9d=_0x46cb9d-0x0;var _0x4d93ca=_0x5ee1[_0x46cb9d];return _0x4d93ca;};'use strict';var EventEmitter=require(_0x15ee('0x0'));var MailQueue=require(_0x15ee('0x1'))['db'][_0x15ee('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x15ee('0x3'),'afterUpdate':_0x15ee('0x4'),'afterDestroy':_0x15ee('0x5')};function emitEvent(_0x2af1c1){return function(_0x30ba72,_0x22b469,_0x4c2f8e){MailQueueEvents[_0x15ee('0x6')](_0x2af1c1+':'+_0x30ba72['id'],_0x30ba72);MailQueueEvents[_0x15ee('0x6')](_0x2af1c1,_0x30ba72);_0x4c2f8e(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x15ee('0x7')](e,emitEvent(event));}}module['exports']=MailQueueEvents; \ No newline at end of file +var _0x56f5=['update','remove','emit','hook','events','../../mysqldb','MailQueue','setMaxListeners','save'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x56f5,0xa6));var _0x556f=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x56f5[_0x3b380d];return _0x54502b;};'use strict';var EventEmitter=require(_0x556f('0x0'));var MailQueue=require(_0x556f('0x1'))['db'][_0x556f('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x556f('0x3')](0x0);var events={'afterCreate':_0x556f('0x4'),'afterUpdate':_0x556f('0x5'),'afterDestroy':_0x556f('0x6')};function emitEvent(_0x10c448){return function(_0x3c934f,_0x78a311,_0x8af396){MailQueueEvents[_0x556f('0x7')](_0x10c448+':'+_0x3c934f['id'],_0x3c934f);MailQueueEvents['emit'](_0x10c448,_0x3c934f);_0x8af396(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailQueue[_0x556f('0x8')](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 154092c..79d85f7 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 _0x9daa=['request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','lodash','util','../../config/logger','api'];(function(_0x2afb44,_0x249a57){var _0x15ccc2=function(_0x180748){while(--_0x180748){_0x2afb44['push'](_0x2afb44['shift']());}};_0x15ccc2(++_0x249a57);}(_0x9daa,0xf8));var _0xa9da=function(_0x18d1c5,_0x13c3f2){_0x18d1c5=_0x18d1c5-0x0;var _0x355772=_0x9daa[_0x18d1c5];return _0x355772;};'use strict';var _=require(_0xa9da('0x0'));var util=require(_0xa9da('0x1'));var logger=require(_0xa9da('0x2'))(_0xa9da('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa9da('0x4'));var fs=require('fs');var path=require(_0xa9da('0x5'));var rimraf=require('rimraf');var config=require(_0xa9da('0x6'));var attributes=require(_0xa9da('0x7'));module[_0xa9da('0x8')]=function(_0x354d59,_0x4756ed){return _0x354d59[_0xa9da('0x9')](_0xa9da('0xa'),attributes,{'tableName':_0xa9da('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9e26=['mail_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueue.attributes','define','MailQueue'];(function(_0x29de33,_0x3c8ffd){var _0x437555=function(_0x511ff4){while(--_0x511ff4){_0x29de33['push'](_0x29de33['shift']());}};_0x437555(++_0x3c8ffd);}(_0x9e26,0x91));var _0x69e2=function(_0x41c57b,_0x2f4118){_0x41c57b=_0x41c57b-0x0;var _0x3dbdfd=_0x9e26[_0x41c57b];return _0x3dbdfd;};'use strict';var _=require(_0x69e2('0x0'));var util=require(_0x69e2('0x1'));var logger=require(_0x69e2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x69e2('0x3'));var rp=require(_0x69e2('0x4'));var fs=require('fs');var path=require(_0x69e2('0x5'));var rimraf=require(_0x69e2('0x6'));var config=require(_0x69e2('0x7'));var attributes=require(_0x69e2('0x8'));module['exports']=function(_0x6963a6,_0x49e0e3){return _0x6963a6[_0x69e2('0x9')](_0x69e2('0xa'),attributes,{'tableName':_0x69e2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.rpc.js b/server/api/mailQueue/mailQueue.rpc.js index f405077..4ad3c4e 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 _0x0a17=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','ShowMailQueue','find','lodash','util'];(function(_0x4771d9,_0x269403){var _0x1f0144=function(_0x5b5f1e){while(--_0x5b5f1e){_0x4771d9['push'](_0x4771d9['shift']());}};_0x1f0144(++_0x269403);}(_0x0a17,0x16f));var _0x70a1=function(_0x31a422,_0x37e7c3){_0x31a422=_0x31a422-0x0;var _0x3d89ef=_0x0a17[_0x31a422];return _0x3d89ef;};'use strict';var _=require(_0x70a1('0x0'));var util=require(_0x70a1('0x1'));var moment=require(_0x70a1('0x2'));var BPromise=require(_0x70a1('0x3'));var rs=require(_0x70a1('0x4'));var fs=require('fs');var Redis=require(_0x70a1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x70a1('0x6'));var logger=require(_0x70a1('0x7'))(_0x70a1('0x8'));var config=require('../../config/environment');var jayson=require(_0x70a1('0x9'));var client=jayson[_0x70a1('0xa')]['http']({'port':0x232a});config[_0x70a1('0xb')]=_[_0x70a1('0xc')](config[_0x70a1('0xb')],{'host':_0x70a1('0xd'),'port':0x18eb});var socket=require(_0x70a1('0xe'))(new Redis(config[_0x70a1('0xb')]));require(_0x70a1('0xf'))[_0x70a1('0x10')](socket);function respondWithRpcPromise(_0x3713f0,_0x17db44,_0x269682){return new BPromise(function(_0x54cc36,_0x57f92b){return client[_0x70a1('0x11')](_0x3713f0,_0x269682)[_0x70a1('0x12')](function(_0x20859c){logger[_0x70a1('0x13')](_0x70a1('0x14'),_0x17db44,_0x70a1('0x15'));logger[_0x70a1('0x16')](_0x70a1('0x17'),_0x17db44,_0x70a1('0x15'),JSON[_0x70a1('0x18')](_0x20859c));if(_0x20859c['error']){if(_0x20859c[_0x70a1('0x19')][_0x70a1('0x1a')]===0x1f4){logger[_0x70a1('0x19')](_0x70a1('0x14'),_0x17db44,_0x20859c[_0x70a1('0x19')][_0x70a1('0x1b')]);return _0x57f92b(_0x20859c[_0x70a1('0x19')][_0x70a1('0x1b')]);}logger['error'](_0x70a1('0x14'),_0x17db44,_0x20859c[_0x70a1('0x19')][_0x70a1('0x1b')]);return _0x54cc36(_0x20859c['error'][_0x70a1('0x1b')]);}else{logger['info'](_0x70a1('0x14'),_0x17db44,_0x70a1('0x15'));_0x54cc36(_0x20859c['result'][_0x70a1('0x1b')]);}})[_0x70a1('0x1c')](function(_0x391e15){logger['error'](_0x70a1('0x14'),_0x17db44,_0x391e15);_0x57f92b(_0x391e15);});});}exports[_0x70a1('0x1d')]=function(_0x281ac7){var _0x4571b4=this;return new Promise(function(_0x8444e4,_0x28b963){return db[_0x70a1('0x1e')][_0x70a1('0x1f')]({'raw':_0x281ac7[_0x70a1('0x20')]?_0x281ac7[_0x70a1('0x20')][_0x70a1('0x21')]===undefined?!![]:![]:!![],'where':_0x281ac7[_0x70a1('0x20')]?_0x281ac7[_0x70a1('0x20')][_0x70a1('0x22')]||null:null,'attributes':_0x281ac7[_0x70a1('0x20')]?_0x281ac7[_0x70a1('0x20')][_0x70a1('0x23')]||null:null,'limit':_0x281ac7['options']?_0x281ac7[_0x70a1('0x20')]['limit']||null:null,'include':_0x281ac7['options']?_0x281ac7[_0x70a1('0x20')][_0x70a1('0x24')]?_[_0x70a1('0x25')](_0x281ac7[_0x70a1('0x20')][_0x70a1('0x24')],function(_0x967b7a){return{'model':db[_0x967b7a['model']],'as':_0x967b7a['as'],'attributes':_0x967b7a[_0x70a1('0x23')],'include':_0x967b7a['include']?_[_0x70a1('0x25')](_0x967b7a[_0x70a1('0x24')],function(_0x1b5590){return{'model':db[_0x1b5590[_0x70a1('0x26')]],'as':_0x1b5590['as'],'attributes':_0x1b5590[_0x70a1('0x23')],'include':_0x1b5590['include']?_[_0x70a1('0x25')](_0x1b5590[_0x70a1('0x24')],function(_0x4956a8){return{'model':db[_0x4956a8[_0x70a1('0x26')]],'as':_0x4956a8['as'],'attributes':_0x4956a8['attributes']};}):[]};}):[]};}):[]:[]})[_0x70a1('0x12')](function(_0x534d17){logger[_0x70a1('0x13')](_0x70a1('0x1d'),_0x281ac7);logger[_0x70a1('0x16')]('GetMailQueue',_0x281ac7,JSON['stringify'](_0x534d17));_0x8444e4(_0x534d17);})[_0x70a1('0x1c')](function(_0x46e8ee){logger[_0x70a1('0x19')]('GetMailQueue',_0x46e8ee[_0x70a1('0x1b')],_0x281ac7);_0x28b963(_0x4571b4['error'](0x1f4,_0x46e8ee[_0x70a1('0x1b')]));});});};exports[_0x70a1('0x27')]=function(_0x3caf20){var _0x3e32cc=this;return new Promise(function(_0xe646a2,_0x443bb1){return db['MailQueue'][_0x70a1('0x28')]({'raw':_0x3caf20[_0x70a1('0x20')]?_0x3caf20[_0x70a1('0x20')][_0x70a1('0x21')]===undefined?!![]:![]:!![],'where':_0x3caf20[_0x70a1('0x20')]?_0x3caf20[_0x70a1('0x20')][_0x70a1('0x22')]||null:null,'attributes':_0x3caf20[_0x70a1('0x20')]?_0x3caf20[_0x70a1('0x20')][_0x70a1('0x23')]||null:null,'include':_0x3caf20[_0x70a1('0x20')]?_0x3caf20[_0x70a1('0x20')]['include']?_[_0x70a1('0x25')](_0x3caf20[_0x70a1('0x20')][_0x70a1('0x24')],function(_0x43f28d){return{'model':db[_0x43f28d[_0x70a1('0x26')]],'as':_0x43f28d['as'],'attributes':_0x43f28d['attributes'],'include':_0x43f28d[_0x70a1('0x24')]?_[_0x70a1('0x25')](_0x43f28d[_0x70a1('0x24')],function(_0x57a287){return{'model':db[_0x57a287[_0x70a1('0x26')]],'as':_0x57a287['as'],'attributes':_0x57a287[_0x70a1('0x23')],'include':_0x57a287[_0x70a1('0x24')]?_[_0x70a1('0x25')](_0x57a287[_0x70a1('0x24')],function(_0x4ae40e){return{'model':db[_0x4ae40e[_0x70a1('0x26')]],'as':_0x4ae40e['as'],'attributes':_0x4ae40e[_0x70a1('0x23')]};}):[]};}):[]};}):[]:[]})[_0x70a1('0x12')](function(_0x286536){logger['info'](_0x70a1('0x27'),_0x3caf20);logger[_0x70a1('0x16')](_0x70a1('0x27'),_0x3caf20,JSON[_0x70a1('0x18')](_0x286536));_0xe646a2(_0x286536);})[_0x70a1('0x1c')](function(_0x430188){logger[_0x70a1('0x19')](_0x70a1('0x27'),_0x430188[_0x70a1('0x1b')],_0x3caf20);_0x443bb1(_0x3e32cc[_0x70a1('0x19')](0x1f4,_0x430188['message']));});});}; \ No newline at end of file +var _0xc86a=['defaults','localhost','socket.io-emitter','./mailQueue.socket','register','then','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetMailQueue','MailQueue','options','where','attributes','include','map','model','stringify','catch','ShowMailQueue','find','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis'];(function(_0x364c53,_0x4ecabb){var _0x76c76c=function(_0x3db7f7){while(--_0x3db7f7){_0x364c53['push'](_0x364c53['shift']());}};_0x76c76c(++_0x4ecabb);}(_0xc86a,0x1f0));var _0xac86=function(_0x5a636f,_0x3fec2b){_0x5a636f=_0x5a636f-0x0;var _0x6a8cfb=_0xc86a[_0x5a636f];return _0x6a8cfb;};'use strict';var _=require(_0xac86('0x0'));var util=require(_0xac86('0x1'));var moment=require('moment');var BPromise=require(_0xac86('0x2'));var rs=require(_0xac86('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xac86('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xac86('0x5'))(_0xac86('0x6'));var config=require(_0xac86('0x7'));var jayson=require(_0xac86('0x8'));var client=jayson['client'][_0xac86('0x9')]({'port':0x232a});config[_0xac86('0xa')]=_[_0xac86('0xb')](config[_0xac86('0xa')],{'host':_0xac86('0xc'),'port':0x18eb});var socket=require(_0xac86('0xd'))(new Redis(config['redis']));require(_0xac86('0xe'))[_0xac86('0xf')](socket);function respondWithRpcPromise(_0x210826,_0xcaff75,_0x10b33f){return new BPromise(function(_0x42d57b,_0x5c966a){return client['request'](_0x210826,_0x10b33f)[_0xac86('0x10')](function(_0x158daf){logger[_0xac86('0x11')](_0xac86('0x12'),_0xcaff75,'request\x20sent');logger[_0xac86('0x13')](_0xac86('0x14'),_0xcaff75,_0xac86('0x15'),JSON['stringify'](_0x158daf));if(_0x158daf[_0xac86('0x16')]){if(_0x158daf['error'][_0xac86('0x17')]===0x1f4){logger[_0xac86('0x16')](_0xac86('0x12'),_0xcaff75,_0x158daf[_0xac86('0x16')][_0xac86('0x18')]);return _0x5c966a(_0x158daf['error']['message']);}logger[_0xac86('0x16')](_0xac86('0x12'),_0xcaff75,_0x158daf[_0xac86('0x16')]['message']);return _0x42d57b(_0x158daf[_0xac86('0x16')]['message']);}else{logger[_0xac86('0x11')](_0xac86('0x12'),_0xcaff75,_0xac86('0x15'));_0x42d57b(_0x158daf[_0xac86('0x19')][_0xac86('0x18')]);}})['catch'](function(_0x55ab9d){logger[_0xac86('0x16')](_0xac86('0x12'),_0xcaff75,_0x55ab9d);_0x5c966a(_0x55ab9d);});});}exports[_0xac86('0x1a')]=function(_0x1411b0){var _0xdb4e61=this;return new Promise(function(_0x4bf1ba,_0x447101){return db[_0xac86('0x1b')]['findAll']({'raw':_0x1411b0[_0xac86('0x1c')]?_0x1411b0[_0xac86('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x1411b0[_0xac86('0x1c')]?_0x1411b0[_0xac86('0x1c')][_0xac86('0x1d')]||null:null,'attributes':_0x1411b0[_0xac86('0x1c')]?_0x1411b0[_0xac86('0x1c')][_0xac86('0x1e')]||null:null,'limit':_0x1411b0[_0xac86('0x1c')]?_0x1411b0['options']['limit']||null:null,'include':_0x1411b0[_0xac86('0x1c')]?_0x1411b0[_0xac86('0x1c')][_0xac86('0x1f')]?_[_0xac86('0x20')](_0x1411b0[_0xac86('0x1c')]['include'],function(_0x40034c){return{'model':db[_0x40034c['model']],'as':_0x40034c['as'],'attributes':_0x40034c[_0xac86('0x1e')],'include':_0x40034c['include']?_[_0xac86('0x20')](_0x40034c[_0xac86('0x1f')],function(_0x1b1634){return{'model':db[_0x1b1634[_0xac86('0x21')]],'as':_0x1b1634['as'],'attributes':_0x1b1634[_0xac86('0x1e')],'include':_0x1b1634['include']?_[_0xac86('0x20')](_0x1b1634[_0xac86('0x1f')],function(_0x380585){return{'model':db[_0x380585['model']],'as':_0x380585['as'],'attributes':_0x380585[_0xac86('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xac86('0x10')](function(_0x5931ea){logger[_0xac86('0x11')](_0xac86('0x1a'),_0x1411b0);logger['debug']('GetMailQueue',_0x1411b0,JSON[_0xac86('0x22')](_0x5931ea));_0x4bf1ba(_0x5931ea);})[_0xac86('0x23')](function(_0x58db33){logger[_0xac86('0x16')](_0xac86('0x1a'),_0x58db33[_0xac86('0x18')],_0x1411b0);_0x447101(_0xdb4e61[_0xac86('0x16')](0x1f4,_0x58db33[_0xac86('0x18')]));});});};exports[_0xac86('0x24')]=function(_0xa535de){var _0x26580e=this;return new Promise(function(_0x5da088,_0x364f02){return db[_0xac86('0x1b')][_0xac86('0x25')]({'raw':_0xa535de['options']?_0xa535de['options'][_0xac86('0x26')]===undefined?!![]:![]:!![],'where':_0xa535de[_0xac86('0x1c')]?_0xa535de[_0xac86('0x1c')]['where']||null:null,'attributes':_0xa535de[_0xac86('0x1c')]?_0xa535de['options'][_0xac86('0x1e')]||null:null,'include':_0xa535de[_0xac86('0x1c')]?_0xa535de[_0xac86('0x1c')]['include']?_['map'](_0xa535de['options'][_0xac86('0x1f')],function(_0x3f820f){return{'model':db[_0x3f820f[_0xac86('0x21')]],'as':_0x3f820f['as'],'attributes':_0x3f820f[_0xac86('0x1e')],'include':_0x3f820f[_0xac86('0x1f')]?_['map'](_0x3f820f[_0xac86('0x1f')],function(_0x49001b){return{'model':db[_0x49001b['model']],'as':_0x49001b['as'],'attributes':_0x49001b[_0xac86('0x1e')],'include':_0x49001b[_0xac86('0x1f')]?_[_0xac86('0x20')](_0x49001b[_0xac86('0x1f')],function(_0x4212fd){return{'model':db[_0x4212fd[_0xac86('0x21')]],'as':_0x4212fd['as'],'attributes':_0x4212fd[_0xac86('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xac86('0x10')](function(_0xe6f381){logger[_0xac86('0x11')](_0xac86('0x24'),_0xa535de);logger['debug']('ShowMailQueue',_0xa535de,JSON[_0xac86('0x22')](_0xe6f381));_0x5da088(_0xe6f381);})[_0xac86('0x23')](function(_0xb8c1b6){logger[_0xac86('0x16')](_0xac86('0x24'),_0xb8c1b6['message'],_0xa535de);_0x364f02(_0x26580e['error'](0x1f4,_0xb8c1b6[_0xac86('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 815e403..1563bd6 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 _0x211c=['remove','update','emit','register','mailQueue:','./mailQueue.events','save'];(function(_0x14d674,_0x538760){var _0x3a28f4=function(_0x1a006b){while(--_0x1a006b){_0x14d674['push'](_0x14d674['shift']());}};_0x3a28f4(++_0x538760);}(_0x211c,0x83));var _0xc211=function(_0xccc9cc,_0x4d6a79){_0xccc9cc=_0xccc9cc-0x0;var _0xb8ecc7=_0x211c[_0xccc9cc];return _0xb8ecc7;};'use strict';var MailQueueEvents=require(_0xc211('0x0'));var events=[_0xc211('0x1'),_0xc211('0x2'),_0xc211('0x3')];function createListener(_0x4eca24,_0x2e10bb){return function(_0x4a82e8){_0x2e10bb[_0xc211('0x4')](_0x4eca24,_0x4a82e8);};}function removeListener(_0x3cf44a,_0xd3f18d){return function(){MailQueueEvents['removeListener'](_0x3cf44a,_0xd3f18d);};}exports[_0xc211('0x5')]=function(_0x5f0ac1){for(var _0x2d4b9c=0x0,_0x4ee41e=events['length'];_0x2d4b9c<_0x4ee41e;_0x2d4b9c++){var _0x4761b4=events[_0x2d4b9c];var _0x2e7115=createListener(_0xc211('0x6')+_0x4761b4,_0x5f0ac1);MailQueueEvents['on'](_0x4761b4,_0x2e7115);}}; \ No newline at end of file +var _0xd0ea=['save','update','removeListener','register','mailQueue:','./mailQueue.events'];(function(_0x454165,_0x1f3e74){var _0x56db53=function(_0x23388c){while(--_0x23388c){_0x454165['push'](_0x454165['shift']());}};_0x56db53(++_0x1f3e74);}(_0xd0ea,0x71));var _0xad0e=function(_0xcc69c5,_0x5b35b2){_0xcc69c5=_0xcc69c5-0x0;var _0x14ec59=_0xd0ea[_0xcc69c5];return _0x14ec59;};'use strict';var MailQueueEvents=require(_0xad0e('0x0'));var events=[_0xad0e('0x1'),'remove',_0xad0e('0x2')];function createListener(_0x14efcf,_0x4612d7){return function(_0x3abaec){_0x4612d7['emit'](_0x14efcf,_0x3abaec);};}function removeListener(_0x4675c0,_0x2010c8){return function(){MailQueueEvents[_0xad0e('0x3')](_0x4675c0,_0x2010c8);};}exports[_0xad0e('0x4')]=function(_0x572352){for(var _0x350c24=0x0,_0x1ee60c=events['length'];_0x350c24<_0x1ee60c;_0x350c24++){var _0x5d79fa=events[_0x350c24];var _0x23f79d=createListener(_0xad0e('0x5')+_0x5d79fa,_0x572352);MailQueueEvents['on'](_0x5d79fa,_0x23f79d);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index b10cce6..c7697ab 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 _0x2d21=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueueReport.controller','isAuthenticated','index','get','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x2d21,0x136));var _0x12d2=function(_0x37e886,_0x17d0ad){_0x37e886=_0x37e886-0x0;var _0x57c5cd=_0x2d21[_0x37e886];return _0x57c5cd;};'use strict';var multer=require(_0x12d2('0x0'));var util=require(_0x12d2('0x1'));var path=require(_0x12d2('0x2'));var timeout=require(_0x12d2('0x3'));var express=require(_0x12d2('0x4'));var router=express[_0x12d2('0x5')]();var auth=require(_0x12d2('0x6'));var interaction=require(_0x12d2('0x7'));var config=require(_0x12d2('0x8'));var controller=require(_0x12d2('0x9'));router['get']('/',auth[_0x12d2('0xa')](),controller[_0x12d2('0xb')]);router[_0x12d2('0xc')]('/describe',auth[_0x12d2('0xa')](),controller[_0x12d2('0xd')]);router[_0x12d2('0xc')](_0x12d2('0xe'),auth[_0x12d2('0xa')](),controller[_0x12d2('0xf')]);router[_0x12d2('0x10')]('/',auth['isAuthenticated'](),controller[_0x12d2('0x11')]);router[_0x12d2('0x12')](_0x12d2('0xe'),auth[_0x12d2('0xa')](),controller['update']);router['delete'](_0x12d2('0xe'),auth[_0x12d2('0xa')](),controller[_0x12d2('0x13')]);module[_0x12d2('0x14')]=router; \ No newline at end of file +var _0x9418=['/:id','show','post','create','put','delete','destroy','exports','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','isAuthenticated','/describe','describe'];(function(_0x2b3a40,_0x386ecd){var _0x2ad588=function(_0x4c5829){while(--_0x4c5829){_0x2b3a40['push'](_0x2b3a40['shift']());}};_0x2ad588(++_0x386ecd);}(_0x9418,0x14c));var _0x8941=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x9418[_0x25e7cb];return _0x375d92;};'use strict';var multer=require('multer');var util=require(_0x8941('0x0'));var path=require('path');var timeout=require(_0x8941('0x1'));var express=require('express');var router=express[_0x8941('0x2')]();var auth=require(_0x8941('0x3'));var interaction=require(_0x8941('0x4'));var config=require('../../config/environment');var controller=require(_0x8941('0x5'));router[_0x8941('0x6')]('/',auth[_0x8941('0x7')](),controller['index']);router[_0x8941('0x6')](_0x8941('0x8'),auth[_0x8941('0x7')](),controller[_0x8941('0x9')]);router[_0x8941('0x6')](_0x8941('0xa'),auth[_0x8941('0x7')](),controller[_0x8941('0xb')]);router[_0x8941('0xc')]('/',auth[_0x8941('0x7')](),controller[_0x8941('0xd')]);router[_0x8941('0xe')](_0x8941('0xa'),auth[_0x8941('0x7')](),controller['update']);router[_0x8941('0xf')]('/:id',auth[_0x8941('0x7')](),controller[_0x8941('0x10')]);module[_0x8941('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 1e15614..0143d90 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 _0x0423=['sequelize','STRING','DATE','moment'];(function(_0x14e51e,_0xed289b){var _0xf93e94=function(_0x4ed5bb){while(--_0x4ed5bb){_0x14e51e['push'](_0x14e51e['shift']());}};_0xf93e94(++_0xed289b);}(_0x0423,0x183));var _0x3042=function(_0x37ed52,_0x2caac7){_0x37ed52=_0x37ed52-0x0;var _0x2b31dc=_0x0423[_0x37ed52];return _0x2b31dc;};'use strict';var moment=require(_0x3042('0x0'));var Sequelize=require(_0x3042('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x3042('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3042('0x3')]},'leaveAt':{'type':Sequelize[_0x3042('0x3')]},'acceptAt':{'type':Sequelize[_0x3042('0x3')]},'exitAt':{'type':Sequelize[_0x3042('0x3')]},'reason':{'type':Sequelize[_0x3042('0x2')]}}; \ No newline at end of file +var _0x29f2=['moment','STRING','DATE'];(function(_0x297a40,_0x24cbe0){var _0x4f2752=function(_0x21ed5a){while(--_0x21ed5a){_0x297a40['push'](_0x297a40['shift']());}};_0x4f2752(++_0x24cbe0);}(_0x29f2,0x7e));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var moment=require(_0x229f('0x0'));var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x229f('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x229f('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x229f('0x2')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x229f('0x2')]},'reason':{'type':Sequelize[_0x229f('0x1')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index d2b5abb..717a1d3 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 _0xcd55=['fieldName','key','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','params','keys','create','body','find','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','reject','save','update','destroy','then','error','name','send','index','MailQueueReport','rawAttributes'];(function(_0xb03f9,_0x588391){var _0x3ec30a=function(_0x3ef5e7){while(--_0x3ef5e7){_0xb03f9['push'](_0xb03f9['shift']());}};_0x3ec30a(++_0x588391);}(_0xcd55,0x110));var _0x5cd5=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xcd55[_0x2c91e9];return _0x13f0ff;};'use strict';var pdf=require(_0x5cd5('0x0'));var emlformat=require(_0x5cd5('0x1'));var rimraf=require(_0x5cd5('0x2'));var zipdir=require(_0x5cd5('0x3'));var jsonpatch=require(_0x5cd5('0x4'));var rp=require(_0x5cd5('0x5'));var moment=require(_0x5cd5('0x6'));var BPromise=require(_0x5cd5('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x5cd5('0x8'));var sox=require(_0x5cd5('0x9'));var csv=require(_0x5cd5('0xa'));var ejs=require(_0x5cd5('0xb'));var fs=require('fs');var _=require(_0x5cd5('0xc'));var squel=require(_0x5cd5('0xd'));var crypto=require(_0x5cd5('0xe'));var jsforce=require(_0x5cd5('0xf'));var deskjs=require(_0x5cd5('0x10'));var toCsv=require(_0x5cd5('0xa'));var querystring=require(_0x5cd5('0x11'));var Papa=require(_0x5cd5('0x12'));var Redis=require(_0x5cd5('0x13'));var authService=require(_0x5cd5('0x14'));var qs=require(_0x5cd5('0x15'));var as=require(_0x5cd5('0x16'));var hardwareService=require(_0x5cd5('0x17'));var logger=require(_0x5cd5('0x18'))(_0x5cd5('0x19'));var utils=require(_0x5cd5('0x1a'));var config=require(_0x5cd5('0x1b'));var db=require(_0x5cd5('0x1c'))['db'];function respondWithStatusCode(_0x563152,_0x78cabf){_0x78cabf=_0x78cabf||0xcc;return function(_0x4b2308){if(_0x4b2308){return _0x563152[_0x5cd5('0x1d')](_0x78cabf);}return _0x563152[_0x5cd5('0x1e')](_0x78cabf)[_0x5cd5('0x1f')]();};}function respondWithResult(_0xc1f762,_0x1d6237){_0x1d6237=_0x1d6237||0xc8;return function(_0x4bcbc0){if(_0x4bcbc0){return _0xc1f762[_0x5cd5('0x1e')](_0x1d6237)[_0x5cd5('0x20')](_0x4bcbc0);}};}function respondWithFilteredResult(_0x2d3588,_0x59b350){return function(_0x3f3d5d){if(_0x3f3d5d){var _0x25354e=_0x3f3d5d[_0x5cd5('0x21')],_0x35def9=_0x59b350[_0x5cd5('0x22')],_0x1abaee=_0x59b350[_0x5cd5('0x22')]+_0x59b350['limit'],_0x4db6e7;if(_0x1abaee>=_0x25354e){_0x1abaee=_0x25354e;_0x4db6e7=0xc8;}else{_0x4db6e7=0xce;}_0x2d3588[_0x5cd5('0x1e')](_0x4db6e7);return _0x2d3588[_0x5cd5('0x23')]('Content-Range',_0x35def9+'-'+_0x1abaee+'/'+_0x25354e)[_0x5cd5('0x20')](_0x3f3d5d);}return null;};}function patchUpdates(_0x30f842){return function(_0x33ca37){try{jsonpatch[_0x5cd5('0x24')](_0x33ca37,_0x30f842,!![]);}catch(_0x78ef8c){return BPromise[_0x5cd5('0x25')](_0x78ef8c);}return _0x33ca37[_0x5cd5('0x26')]();};}function saveUpdates(_0x4076d4,_0x223227){return function(_0x36388e){if(_0x36388e){return _0x36388e[_0x5cd5('0x27')](_0x4076d4)['then'](function(_0x18e28f){return _0x18e28f;});}return null;};}function removeEntity(_0x20e661,_0x27912f){return function(_0x24cf5d){if(_0x24cf5d){return _0x24cf5d[_0x5cd5('0x28')]()[_0x5cd5('0x29')](function(){_0x20e661[_0x5cd5('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27858e,_0x23c35c){return function(_0x372185){if(!_0x372185){_0x27858e[_0x5cd5('0x1d')](0x194);}return _0x372185;};}function handleError(_0x15d609,_0x561556){_0x561556=_0x561556||0x1f4;return function(_0x3684ef){logger[_0x5cd5('0x2a')](_0x3684ef['stack']);if(_0x3684ef[_0x5cd5('0x2b')]){delete _0x3684ef[_0x5cd5('0x2b')];}_0x15d609['status'](_0x561556)[_0x5cd5('0x2c')](_0x3684ef);};}exports[_0x5cd5('0x2d')]=function(_0x23bed3,_0x1aa3a7){var _0x4ba4d8={},_0x1a7c51={},_0x370235={'count':0x0,'rows':[]};var _0x5ee6c3=_['map'](db[_0x5cd5('0x2e')][_0x5cd5('0x2f')],function(_0x46886e){return{'name':_0x46886e[_0x5cd5('0x30')],'type':_0x46886e['type'][_0x5cd5('0x31')]};});_0x1a7c51[_0x5cd5('0x32')]=_[_0x5cd5('0x33')](_0x5ee6c3,_0x5cd5('0x2b'));_0x1a7c51[_0x5cd5('0x34')]=_['keys'](_0x23bed3[_0x5cd5('0x34')]);_0x1a7c51[_0x5cd5('0x35')]=_[_0x5cd5('0x36')](_0x1a7c51[_0x5cd5('0x32')],_0x1a7c51['query']);_0x4ba4d8['attributes']=_[_0x5cd5('0x36')](_0x1a7c51[_0x5cd5('0x32')],qs[_0x5cd5('0x37')](_0x23bed3[_0x5cd5('0x34')]['fields']));_0x4ba4d8[_0x5cd5('0x38')]=_0x4ba4d8['attributes'][_0x5cd5('0x39')]?_0x4ba4d8[_0x5cd5('0x38')]:_0x1a7c51[_0x5cd5('0x32')];if(!_0x23bed3[_0x5cd5('0x34')][_0x5cd5('0x3a')](_0x5cd5('0x3b'))){_0x4ba4d8[_0x5cd5('0x3c')]=qs[_0x5cd5('0x3c')](_0x23bed3[_0x5cd5('0x34')][_0x5cd5('0x3c')]);_0x4ba4d8[_0x5cd5('0x22')]=qs['offset'](_0x23bed3[_0x5cd5('0x34')][_0x5cd5('0x22')]);}_0x4ba4d8[_0x5cd5('0x3d')]=qs[_0x5cd5('0x3e')](_0x23bed3[_0x5cd5('0x34')]['sort']);_0x4ba4d8[_0x5cd5('0x3f')]=qs[_0x5cd5('0x35')](_[_0x5cd5('0x40')](_0x23bed3['query'],_0x1a7c51[_0x5cd5('0x35')]));if(_0x23bed3[_0x5cd5('0x34')][_0x5cd5('0x41')]){_0x4ba4d8['where']=_[_0x5cd5('0x42')](_0x4ba4d8[_0x5cd5('0x3f')],{'$or':_[_0x5cd5('0x33')](_0x5ee6c3,function(_0x5c28e6){if(_0x5c28e6[_0x5cd5('0x43')]!=='VIRTUAL'){var _0x3de350={};_0x3de350[_0x5c28e6[_0x5cd5('0x2b')]]={'$like':'%'+_0x23bed3[_0x5cd5('0x34')][_0x5cd5('0x41')]+'%'};return _0x3de350;}})});}_0x4ba4d8=_[_0x5cd5('0x42')]({},_0x4ba4d8,_0x23bed3[_0x5cd5('0x44')]);var _0xfc4592={'where':_0x4ba4d8[_0x5cd5('0x3f')]};return db['MailQueueReport'][_0x5cd5('0x21')](_0xfc4592)[_0x5cd5('0x29')](function(_0x23e4e7){_0x370235[_0x5cd5('0x21')]=_0x23e4e7;if(_0x23bed3['query'][_0x5cd5('0x45')]){_0x4ba4d8[_0x5cd5('0x46')]=[{'all':!![]}];}return db['MailQueueReport'][_0x5cd5('0x47')](_0x4ba4d8);})['then'](function(_0x28621b){_0x370235[_0x5cd5('0x48')]=_0x28621b;return _0x370235;})[_0x5cd5('0x29')](respondWithFilteredResult(_0x1aa3a7,_0x4ba4d8))[_0x5cd5('0x49')](handleError(_0x1aa3a7,null));};exports['show']=function(_0x36bc78,_0x35903c){var _0x2195c5={'raw':!![],'where':{'id':_0x36bc78[_0x5cd5('0x4a')]['id']}},_0x285f37={};_0x285f37[_0x5cd5('0x32')]=_['keys'](db[_0x5cd5('0x2e')][_0x5cd5('0x2f')]);_0x285f37[_0x5cd5('0x34')]=_[_0x5cd5('0x4b')](_0x36bc78[_0x5cd5('0x34')]);_0x285f37['filters']=_['intersection'](_0x285f37[_0x5cd5('0x32')],_0x285f37[_0x5cd5('0x34')]);_0x2195c5['attributes']=_[_0x5cd5('0x36')](_0x285f37[_0x5cd5('0x32')],qs['fields'](_0x36bc78[_0x5cd5('0x34')]['fields']));_0x2195c5[_0x5cd5('0x38')]=_0x2195c5[_0x5cd5('0x38')]['length']?_0x2195c5[_0x5cd5('0x38')]:_0x285f37['model'];if(_0x36bc78[_0x5cd5('0x34')]['includeAll']){_0x2195c5[_0x5cd5('0x46')]=[{'all':!![]}];}_0x2195c5=_['merge']({},_0x2195c5,_0x36bc78[_0x5cd5('0x44')]);return db[_0x5cd5('0x2e')]['find'](_0x2195c5)[_0x5cd5('0x29')](handleEntityNotFound(_0x35903c,null))[_0x5cd5('0x29')](respondWithResult(_0x35903c,null))[_0x5cd5('0x49')](handleError(_0x35903c,null));};exports[_0x5cd5('0x4c')]=function(_0x3d1fe2,_0x19b5a0){return db[_0x5cd5('0x2e')]['create'](_0x3d1fe2[_0x5cd5('0x4d')],{})['then'](respondWithResult(_0x19b5a0,0xc9))[_0x5cd5('0x49')](handleError(_0x19b5a0,null));};exports[_0x5cd5('0x27')]=function(_0x4ce117,_0x1e66eb){if(_0x4ce117[_0x5cd5('0x4d')]['id']){delete _0x4ce117[_0x5cd5('0x4d')]['id'];}return db[_0x5cd5('0x2e')][_0x5cd5('0x4e')]({'where':{'id':_0x4ce117[_0x5cd5('0x4a')]['id']}})[_0x5cd5('0x29')](handleEntityNotFound(_0x1e66eb,null))[_0x5cd5('0x29')](saveUpdates(_0x4ce117[_0x5cd5('0x4d')],null))[_0x5cd5('0x29')](respondWithResult(_0x1e66eb,null))[_0x5cd5('0x49')](handleError(_0x1e66eb,null));};exports[_0x5cd5('0x28')]=function(_0x1d02fe,_0xe5d2c6){return db[_0x5cd5('0x2e')][_0x5cd5('0x4e')]({'where':{'id':_0x1d02fe[_0x5cd5('0x4a')]['id']}})['then'](handleEntityNotFound(_0xe5d2c6,null))[_0x5cd5('0x29')](removeEntity(_0xe5d2c6,null))[_0x5cd5('0x49')](handleError(_0xe5d2c6,null));};exports[_0x5cd5('0x4f')]=function(_0x7b0c51,_0x115198){return db['MailQueueReport'][_0x5cd5('0x4f')]()[_0x5cd5('0x29')](respondWithResult(_0x115198,null))[_0x5cd5('0x49')](handleError(_0x115198,null));}; \ No newline at end of file +var _0x0cd9=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','set','Content-Range','json','apply','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','filter','where','merge','VIRTUAL','options','MailQueueReport','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0xaba68f,_0x976c94){var _0x52be9c=function(_0xb9e944){while(--_0xb9e944){_0xaba68f['push'](_0xaba68f['shift']());}};_0x52be9c(++_0x976c94);}(_0x0cd9,0x164));var _0x90cd=function(_0xadefad,_0x5ed2e8){_0xadefad=_0xadefad-0x0;var _0x2bf3ba=_0x0cd9[_0xadefad];return _0x2bf3ba;};'use strict';var pdf=require(_0x90cd('0x0'));var emlformat=require(_0x90cd('0x1'));var rimraf=require(_0x90cd('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x90cd('0x3'));var rp=require(_0x90cd('0x4'));var moment=require(_0x90cd('0x5'));var BPromise=require(_0x90cd('0x6'));var Mustache=require('mustache');var util=require(_0x90cd('0x7'));var path=require(_0x90cd('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x90cd('0x9'));var fs=require('fs');var _=require(_0x90cd('0xa'));var squel=require(_0x90cd('0xb'));var crypto=require(_0x90cd('0xc'));var jsforce=require(_0x90cd('0xd'));var deskjs=require(_0x90cd('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x90cd('0xf'));var Redis=require(_0x90cd('0x10'));var authService=require(_0x90cd('0x11'));var qs=require(_0x90cd('0x12'));var as=require(_0x90cd('0x13'));var hardwareService=require(_0x90cd('0x14'));var logger=require(_0x90cd('0x15'))(_0x90cd('0x16'));var utils=require(_0x90cd('0x17'));var config=require(_0x90cd('0x18'));var db=require(_0x90cd('0x19'))['db'];function respondWithStatusCode(_0x425d56,_0x24c677){_0x24c677=_0x24c677||0xcc;return function(_0x16b648){if(_0x16b648){return _0x425d56[_0x90cd('0x1a')](_0x24c677);}return _0x425d56[_0x90cd('0x1b')](_0x24c677)['end']();};}function respondWithResult(_0x24602f,_0x43f291){_0x43f291=_0x43f291||0xc8;return function(_0x24215a){if(_0x24215a){return _0x24602f[_0x90cd('0x1b')](_0x43f291)['json'](_0x24215a);}};}function respondWithFilteredResult(_0x5212ab,_0x2940d2){return function(_0x2c2114){if(_0x2c2114){var _0x2e7ad8=_0x2c2114[_0x90cd('0x1c')],_0x133c53=_0x2940d2[_0x90cd('0x1d')],_0x5b0958=_0x2940d2['offset']+_0x2940d2['limit'],_0x5718c2;if(_0x5b0958>=_0x2e7ad8){_0x5b0958=_0x2e7ad8;_0x5718c2=0xc8;}else{_0x5718c2=0xce;}_0x5212ab[_0x90cd('0x1b')](_0x5718c2);return _0x5212ab[_0x90cd('0x1e')](_0x90cd('0x1f'),_0x133c53+'-'+_0x5b0958+'/'+_0x2e7ad8)[_0x90cd('0x20')](_0x2c2114);}return null;};}function patchUpdates(_0x5688f1){return function(_0x4de2b9){try{jsonpatch[_0x90cd('0x21')](_0x4de2b9,_0x5688f1,!![]);}catch(_0x43c97b){return BPromise['reject'](_0x43c97b);}return _0x4de2b9[_0x90cd('0x22')]();};}function saveUpdates(_0x4da429,_0x449dbf){return function(_0x55ac88){if(_0x55ac88){return _0x55ac88[_0x90cd('0x23')](_0x4da429)['then'](function(_0x123d4d){return _0x123d4d;});}return null;};}function removeEntity(_0x3ab5c2,_0x423b3e){return function(_0x540b31){if(_0x540b31){return _0x540b31[_0x90cd('0x24')]()[_0x90cd('0x25')](function(){_0x3ab5c2[_0x90cd('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2edb8e,_0x3694c3){return function(_0x33e2ee){if(!_0x33e2ee){_0x2edb8e[_0x90cd('0x1a')](0x194);}return _0x33e2ee;};}function handleError(_0x28533b,_0x46cc20){_0x46cc20=_0x46cc20||0x1f4;return function(_0x5a83f2){logger[_0x90cd('0x26')](_0x5a83f2[_0x90cd('0x27')]);if(_0x5a83f2['name']){delete _0x5a83f2[_0x90cd('0x28')];}_0x28533b[_0x90cd('0x1b')](_0x46cc20)[_0x90cd('0x29')](_0x5a83f2);};}exports[_0x90cd('0x2a')]=function(_0x4b0c0b,_0x1b627d){var _0x3ccea5={},_0x555c56={},_0x58a870={'count':0x0,'rows':[]};var _0x282456=_[_0x90cd('0x2b')](db['MailQueueReport'][_0x90cd('0x2c')],function(_0x4e750a){return{'name':_0x4e750a['fieldName'],'type':_0x4e750a['type'][_0x90cd('0x2d')]};});_0x555c56['model']=_['map'](_0x282456,'name');_0x555c56[_0x90cd('0x2e')]=_[_0x90cd('0x2f')](_0x4b0c0b[_0x90cd('0x2e')]);_0x555c56[_0x90cd('0x30')]=_[_0x90cd('0x31')](_0x555c56[_0x90cd('0x32')],_0x555c56['query']);_0x3ccea5[_0x90cd('0x33')]=_[_0x90cd('0x31')](_0x555c56[_0x90cd('0x32')],qs['fields'](_0x4b0c0b[_0x90cd('0x2e')][_0x90cd('0x34')]));_0x3ccea5['attributes']=_0x3ccea5[_0x90cd('0x33')][_0x90cd('0x35')]?_0x3ccea5[_0x90cd('0x33')]:_0x555c56[_0x90cd('0x32')];if(!_0x4b0c0b['query'][_0x90cd('0x36')]('nolimit')){_0x3ccea5[_0x90cd('0x37')]=qs['limit'](_0x4b0c0b[_0x90cd('0x2e')]['limit']);_0x3ccea5[_0x90cd('0x1d')]=qs[_0x90cd('0x1d')](_0x4b0c0b[_0x90cd('0x2e')][_0x90cd('0x1d')]);}_0x3ccea5[_0x90cd('0x38')]=qs[_0x90cd('0x39')](_0x4b0c0b['query'][_0x90cd('0x39')]);_0x3ccea5['where']=qs[_0x90cd('0x30')](_['pick'](_0x4b0c0b[_0x90cd('0x2e')],_0x555c56['filters']));if(_0x4b0c0b[_0x90cd('0x2e')][_0x90cd('0x3a')]){_0x3ccea5[_0x90cd('0x3b')]=_[_0x90cd('0x3c')](_0x3ccea5['where'],{'$or':_[_0x90cd('0x2b')](_0x282456,function(_0x56172b){if(_0x56172b['type']!==_0x90cd('0x3d')){var _0x5e1839={};_0x5e1839[_0x56172b[_0x90cd('0x28')]]={'$like':'%'+_0x4b0c0b['query'][_0x90cd('0x3a')]+'%'};return _0x5e1839;}})});}_0x3ccea5=_[_0x90cd('0x3c')]({},_0x3ccea5,_0x4b0c0b[_0x90cd('0x3e')]);var _0x713548={'where':_0x3ccea5[_0x90cd('0x3b')]};return db[_0x90cd('0x3f')][_0x90cd('0x1c')](_0x713548)[_0x90cd('0x25')](function(_0x3f2b7e){_0x58a870[_0x90cd('0x1c')]=_0x3f2b7e;if(_0x4b0c0b[_0x90cd('0x2e')]['includeAll']){_0x3ccea5[_0x90cd('0x40')]=[{'all':!![]}];}return db[_0x90cd('0x3f')][_0x90cd('0x41')](_0x3ccea5);})[_0x90cd('0x25')](function(_0x508387){_0x58a870[_0x90cd('0x42')]=_0x508387;return _0x58a870;})['then'](respondWithFilteredResult(_0x1b627d,_0x3ccea5))[_0x90cd('0x43')](handleError(_0x1b627d,null));};exports[_0x90cd('0x44')]=function(_0x221763,_0x183f62){var _0x5855c7={'raw':!![],'where':{'id':_0x221763[_0x90cd('0x45')]['id']}},_0xad229b={};_0xad229b['model']=_['keys'](db[_0x90cd('0x3f')][_0x90cd('0x2c')]);_0xad229b['query']=_[_0x90cd('0x2f')](_0x221763[_0x90cd('0x2e')]);_0xad229b['filters']=_[_0x90cd('0x31')](_0xad229b['model'],_0xad229b['query']);_0x5855c7[_0x90cd('0x33')]=_[_0x90cd('0x31')](_0xad229b[_0x90cd('0x32')],qs['fields'](_0x221763[_0x90cd('0x2e')]['fields']));_0x5855c7[_0x90cd('0x33')]=_0x5855c7['attributes'][_0x90cd('0x35')]?_0x5855c7['attributes']:_0xad229b['model'];if(_0x221763[_0x90cd('0x2e')][_0x90cd('0x46')]){_0x5855c7['include']=[{'all':!![]}];}_0x5855c7=_['merge']({},_0x5855c7,_0x221763['options']);return db[_0x90cd('0x3f')]['find'](_0x5855c7)['then'](handleEntityNotFound(_0x183f62,null))[_0x90cd('0x25')](respondWithResult(_0x183f62,null))[_0x90cd('0x43')](handleError(_0x183f62,null));};exports[_0x90cd('0x47')]=function(_0x435fed,_0x214ab1){return db[_0x90cd('0x3f')][_0x90cd('0x47')](_0x435fed[_0x90cd('0x48')],{})['then'](respondWithResult(_0x214ab1,0xc9))['catch'](handleError(_0x214ab1,null));};exports[_0x90cd('0x23')]=function(_0x2d551f,_0x11e09c){if(_0x2d551f[_0x90cd('0x48')]['id']){delete _0x2d551f['body']['id'];}return db[_0x90cd('0x3f')][_0x90cd('0x49')]({'where':{'id':_0x2d551f[_0x90cd('0x45')]['id']}})[_0x90cd('0x25')](handleEntityNotFound(_0x11e09c,null))['then'](saveUpdates(_0x2d551f[_0x90cd('0x48')],null))[_0x90cd('0x25')](respondWithResult(_0x11e09c,null))[_0x90cd('0x43')](handleError(_0x11e09c,null));};exports[_0x90cd('0x24')]=function(_0x3e63fd,_0x48fd63){return db[_0x90cd('0x3f')][_0x90cd('0x49')]({'where':{'id':_0x3e63fd['params']['id']}})[_0x90cd('0x25')](handleEntityNotFound(_0x48fd63,null))[_0x90cd('0x25')](removeEntity(_0x48fd63,null))['catch'](handleError(_0x48fd63,null));};exports['describe']=function(_0x5610b5,_0x8f5d01){return db[_0x90cd('0x3f')][_0x90cd('0x4a')]()[_0x90cd('0x25')](respondWithResult(_0x8f5d01,null))['catch'](handleError(_0x8f5d01,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index f4a0612..6073434 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 _0xf3c9=['./mailQueueReport.attributes','exports','define','MailQueueReport','uniqueid','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x3d3dea,_0x4a7176){var _0x3547ca=function(_0x3b1e3e){while(--_0x3b1e3e){_0x3d3dea['push'](_0x3d3dea['shift']());}};_0x3547ca(++_0x4a7176);}(_0xf3c9,0xa1));var _0x9f3c=function(_0x57aa86,_0x1e2792){_0x57aa86=_0x57aa86-0x0;var _0x32e433=_0xf3c9[_0x57aa86];return _0x32e433;};'use strict';var _=require('lodash');var util=require(_0x9f3c('0x0'));var logger=require(_0x9f3c('0x1'))(_0x9f3c('0x2'));var moment=require('moment');var BPromise=require(_0x9f3c('0x3'));var rp=require(_0x9f3c('0x4'));var fs=require('fs');var path=require(_0x9f3c('0x5'));var rimraf=require(_0x9f3c('0x6'));var config=require('../../config/environment');var attributes=require(_0x9f3c('0x7'));module[_0x9f3c('0x8')]=function(_0x55be79,_0x1afe12){return _0x55be79[_0x9f3c('0x9')](_0x9f3c('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x9f3c('0xb'),'fields':[_0x9f3c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x31e7=['request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','MailQueueReport','report_mail_queue','uniqueid','util','api','moment','bluebird'];(function(_0x35a7e1,_0x346a12){var _0x4b771e=function(_0x24b0fc){while(--_0x24b0fc){_0x35a7e1['push'](_0x35a7e1['shift']());}};_0x4b771e(++_0x346a12);}(_0x31e7,0x74));var _0x731e=function(_0x12f54f,_0x28b55f){_0x12f54f=_0x12f54f-0x0;var _0x45b7a7=_0x31e7[_0x12f54f];return _0x45b7a7;};'use strict';var _=require('lodash');var util=require(_0x731e('0x0'));var logger=require('../../config/logger')(_0x731e('0x1'));var moment=require(_0x731e('0x2'));var BPromise=require(_0x731e('0x3'));var rp=require(_0x731e('0x4'));var fs=require('fs');var path=require(_0x731e('0x5'));var rimraf=require(_0x731e('0x6'));var config=require(_0x731e('0x7'));var attributes=require(_0x731e('0x8'));module['exports']=function(_0x1a2461,_0x5e12ce){return _0x1a2461['define'](_0x731e('0x9'),attributes,{'tableName':_0x731e('0xa'),'paranoid':![],'indexes':[{'name':_0x731e('0xb'),'fields':[_0x731e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index fbbd869..ac71e41 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 _0xf494=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailQueueReport,\x20%s,\x20%s','request\x20sent','MailQueueReport,\x20%s,\x20%s,\x20%s','error','message','catch','CreateMailQueueReport','create','body','options','debug','stringify','UpdateMailQueueReport','MailQueueReport','where','attributes','limit','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x34bf97,_0xc60f9d){var _0x292719=function(_0x31354e){while(--_0x31354e){_0x34bf97['push'](_0x34bf97['shift']());}};_0x292719(++_0xc60f9d);}(_0xf494,0x1c6));var _0x4f49=function(_0x407eac,_0x37bcfa){_0x407eac=_0x407eac-0x0;var _0x31c1fc=_0xf494[_0x407eac];return _0x31c1fc;};'use strict';var _=require(_0x4f49('0x0'));var util=require(_0x4f49('0x1'));var moment=require(_0x4f49('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f49('0x3'));var fs=require('fs');var Redis=require(_0x4f49('0x4'));var db=require(_0x4f49('0x5'))['db'];var utils=require(_0x4f49('0x6'));var logger=require(_0x4f49('0x7'))(_0x4f49('0x8'));var config=require(_0x4f49('0x9'));var jayson=require(_0x4f49('0xa'));var client=jayson[_0x4f49('0xb')][_0x4f49('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42b0e8,_0x5eb186,_0x58e9a0){return new BPromise(function(_0x169c95,_0x327bd5){return client[_0x4f49('0xd')](_0x42b0e8,_0x58e9a0)[_0x4f49('0xe')](function(_0x185174){logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,_0x4f49('0x11'));logger['debug'](_0x4f49('0x12'),_0x5eb186,_0x4f49('0x11'),JSON['stringify'](_0x185174));if(_0x185174[_0x4f49('0x13')]){if(_0x185174['error']['code']===0x1f4){logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174['error'][_0x4f49('0x14')]);return _0x327bd5(_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);}logger[_0x4f49('0x13')](_0x4f49('0x10'),_0x5eb186,_0x185174[_0x4f49('0x13')][_0x4f49('0x14')]);return _0x169c95(_0x185174['error'][_0x4f49('0x14')]);}else{logger[_0x4f49('0xf')](_0x4f49('0x10'),_0x5eb186,'request\x20sent');_0x169c95(_0x185174['result'][_0x4f49('0x14')]);}})[_0x4f49('0x15')](function(_0x74886e){logger['error'](_0x4f49('0x10'),_0x5eb186,_0x74886e);_0x327bd5(_0x74886e);});});}exports[_0x4f49('0x16')]=function(_0x4e85df){var _0x49cdaf=this;return new Promise(function(_0x5bb23b,_0x560592){return db['MailQueueReport'][_0x4f49('0x17')](_0x4e85df[_0x4f49('0x18')],{'raw':_0x4e85df[_0x4f49('0x19')]?_0x4e85df[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x4f49('0xe')](function(_0x2aed27){logger[_0x4f49('0xf')](_0x4f49('0x16'),_0x4e85df);logger[_0x4f49('0x1a')]('CreateMailQueueReport',_0x4e85df,JSON[_0x4f49('0x1b')](_0x2aed27));_0x5bb23b(_0x2aed27);})[_0x4f49('0x15')](function(_0x3ae590){logger['error'](_0x4f49('0x16'),_0x3ae590[_0x4f49('0x14')],_0x4e85df);_0x560592(_0x49cdaf[_0x4f49('0x13')](0x1f4,_0x3ae590[_0x4f49('0x14')]));});});};exports[_0x4f49('0x1c')]=function(_0x36187b){var _0x559d98=this;return new Promise(function(_0x4e9041,_0x3a947b){return db[_0x4f49('0x1d')]['update'](_0x36187b[_0x4f49('0x18')],{'raw':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1e')]||null:null,'attributes':_0x36187b[_0x4f49('0x19')]?_0x36187b[_0x4f49('0x19')][_0x4f49('0x1f')]||null:null,'limit':_0x36187b['options']?_0x36187b['options'][_0x4f49('0x20')]||null:null})[_0x4f49('0xe')](function(_0x605c91){logger['info'](_0x4f49('0x1c'),_0x36187b);logger[_0x4f49('0x1a')](_0x4f49('0x1c'),_0x36187b,JSON['stringify'](_0x605c91));_0x4e9041(_0x605c91);})['catch'](function(_0x3e207f){logger[_0x4f49('0x13')](_0x4f49('0x1c'),_0x3e207f['message'],_0x36187b);_0x3a947b(_0x559d98[_0x4f49('0x13')](0x1f4,_0x3e207f[_0x4f49('0x14')]));});});}; \ No newline at end of file +var _0x4c60=['message','info','catch','CreateMailQueueReport','MailQueueReport','create','raw','update','options','where','attributes','limit','UpdateMailQueueReport','lodash','util','moment','bluebird','ioredis','../../config/environment','jayson/promise','client','http','request','then','debug','request\x20sent','stringify','error','code','MailQueueReport,\x20%s,\x20%s'];(function(_0x4c2b29,_0x45bfca){var _0x2bc61c=function(_0x1b3520){while(--_0x1b3520){_0x4c2b29['push'](_0x4c2b29['shift']());}};_0x2bc61c(++_0x45bfca);}(_0x4c60,0xc1));var _0x04c6=function(_0xec0798,_0x44708b){_0xec0798=_0xec0798-0x0;var _0x3048d2=_0x4c60[_0xec0798];return _0x3048d2;};'use strict';var _=require(_0x04c6('0x0'));var util=require(_0x04c6('0x1'));var moment=require(_0x04c6('0x2'));var BPromise=require(_0x04c6('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04c6('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x04c6('0x5'));var jayson=require(_0x04c6('0x6'));var client=jayson[_0x04c6('0x7')][_0x04c6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2b9041,_0x39be2d,_0x8f9b13){return new BPromise(function(_0x530a48,_0x2a4b51){return client[_0x04c6('0x9')](_0x2b9041,_0x8f9b13)[_0x04c6('0xa')](function(_0x30b901){logger['info']('MailQueueReport,\x20%s,\x20%s',_0x39be2d,'request\x20sent');logger[_0x04c6('0xb')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x39be2d,_0x04c6('0xc'),JSON[_0x04c6('0xd')](_0x30b901));if(_0x30b901['error']){if(_0x30b901[_0x04c6('0xe')][_0x04c6('0xf')]===0x1f4){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x30b901['error'][_0x04c6('0x11')]);return _0x2a4b51(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}logger['error'](_0x04c6('0x10'),_0x39be2d,_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);return _0x530a48(_0x30b901[_0x04c6('0xe')][_0x04c6('0x11')]);}else{logger[_0x04c6('0x12')](_0x04c6('0x10'),_0x39be2d,_0x04c6('0xc'));_0x530a48(_0x30b901['result'][_0x04c6('0x11')]);}})[_0x04c6('0x13')](function(_0x382e58){logger[_0x04c6('0xe')](_0x04c6('0x10'),_0x39be2d,_0x382e58);_0x2a4b51(_0x382e58);});});}exports[_0x04c6('0x14')]=function(_0x21674a){var _0x423ea9=this;return new Promise(function(_0x47f400,_0x142065){return db[_0x04c6('0x15')][_0x04c6('0x16')](_0x21674a['body'],{'raw':_0x21674a['options']?_0x21674a['options'][_0x04c6('0x17')]===undefined?!![]:![]:!![]})[_0x04c6('0xa')](function(_0x50dd61){logger['info'](_0x04c6('0x14'),_0x21674a);logger[_0x04c6('0xb')](_0x04c6('0x14'),_0x21674a,JSON['stringify'](_0x50dd61));_0x47f400(_0x50dd61);})[_0x04c6('0x13')](function(_0x13f2dc){logger[_0x04c6('0xe')]('CreateMailQueueReport',_0x13f2dc[_0x04c6('0x11')],_0x21674a);_0x142065(_0x423ea9[_0x04c6('0xe')](0x1f4,_0x13f2dc['message']));});});};exports['UpdateMailQueueReport']=function(_0x4c8d72){var _0x348ea3=this;return new Promise(function(_0x3a2014,_0xd5828d){return db[_0x04c6('0x15')][_0x04c6('0x18')](_0x4c8d72['body'],{'raw':_0x4c8d72['options']?_0x4c8d72[_0x04c6('0x19')][_0x04c6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72[_0x04c6('0x19')][_0x04c6('0x1a')]||null:null,'attributes':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72['options'][_0x04c6('0x1b')]||null:null,'limit':_0x4c8d72[_0x04c6('0x19')]?_0x4c8d72['options'][_0x04c6('0x1c')]||null:null})[_0x04c6('0xa')](function(_0x5f1331){logger['info'](_0x04c6('0x1d'),_0x4c8d72);logger[_0x04c6('0xb')](_0x04c6('0x1d'),_0x4c8d72,JSON[_0x04c6('0xd')](_0x5f1331));_0x3a2014(_0x5f1331);})[_0x04c6('0x13')](function(_0x43884e){logger['error']('UpdateMailQueueReport',_0x43884e['message'],_0x4c8d72);_0xd5828d(_0x348ea3[_0x04c6('0xe')](0x1f4,_0x43884e['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 50f895e..cd2b0d2 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 _0x253f=['util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x5d637c,_0x3dee88){var _0x1bff9c=function(_0x400b9a){while(--_0x400b9a){_0x5d637c['push'](_0x5d637c['shift']());}};_0x1bff9c(++_0x3dee88);}(_0x253f,0x110));var _0xf253=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0x253f[_0x1f9f37];return _0x21c080;};'use strict';var multer=require('multer');var util=require(_0xf253('0x0'));var path=require('path');var timeout=require(_0xf253('0x1'));var express=require(_0xf253('0x2'));var router=express[_0xf253('0x3')]();var auth=require(_0xf253('0x4'));var interaction=require(_0xf253('0x5'));var config=require(_0xf253('0x6'));module[_0xf253('0x7')]=router; \ No newline at end of file +var _0xdd4a=['exports','multer','path','express','../../components/auth/service','../../components/interaction/service'];(function(_0x490ed7,_0x58fcf8){var _0x4b6ac0=function(_0x1eb830){while(--_0x1eb830){_0x490ed7['push'](_0x490ed7['shift']());}};_0x4b6ac0(++_0x58fcf8);}(_0xdd4a,0x73));var _0xadd4=function(_0x5fd828,_0xa7ede9){_0x5fd828=_0x5fd828-0x0;var _0x3c1eaa=_0xdd4a[_0x5fd828];return _0x3c1eaa;};'use strict';var multer=require(_0xadd4('0x0'));var util=require('util');var path=require(_0xadd4('0x1'));var timeout=require('connect-timeout');var express=require(_0xadd4('0x2'));var router=express['Router']();var auth=require(_0xadd4('0x3'));var interaction=require(_0xadd4('0x4'));var config=require('../../config/environment');module[_0xadd4('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 a412d4e..a4e9759 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 _0xe79b=['exports','STRING','BOOLEAN','username','INTEGER','INBOX','sequelize'];(function(_0x2147ae,_0x37d08e){var _0x577f4a=function(_0x2ba48c){while(--_0x2ba48c){_0x2147ae['push'](_0x2147ae['shift']());}};_0x577f4a(++_0x37d08e);}(_0xe79b,0x1e9));var _0xbe79=function(_0x48b810,_0x173a5e){_0x48b810=_0x48b810-0x0;var _0x23c17d=_0xe79b[_0x48b810];return _0x23c17d;};'use strict';var Sequelize=require(_0xbe79('0x0'));module[_0xbe79('0x1')]={'description':{'type':Sequelize[_0xbe79('0x2')]},'host':{'type':Sequelize[_0xbe79('0x2')]},'authentication':{'type':Sequelize[_0xbe79('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xbe79('0x2')],'unique':_0xbe79('0x4')},'password':{'type':Sequelize[_0xbe79('0x2')]},'port':{'type':Sequelize[_0xbe79('0x5')]},'tls':{'type':Sequelize[_0xbe79('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':_0xbe79('0x6')},'connTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xbe79('0x5')],'defaultValue':0x5},'service':{'type':Sequelize[_0xbe79('0x2')]}}; \ No newline at end of file +var _0x5c30=['sequelize','exports','STRING','BOOLEAN','username','INTEGER'];(function(_0x529cc1,_0x4a89a1){var _0x141710=function(_0x154cf8){while(--_0x154cf8){_0x529cc1['push'](_0x529cc1['shift']());}};_0x141710(++_0x4a89a1);}(_0x5c30,0x180));var _0x05c3=function(_0x3a1e85,_0x4921df){_0x3a1e85=_0x3a1e85-0x0;var _0x4f7568=_0x5c30[_0x3a1e85];return _0x4f7568;};'use strict';var Sequelize=require(_0x05c3('0x0'));module[_0x05c3('0x1')]={'description':{'type':Sequelize[_0x05c3('0x2')]},'host':{'type':Sequelize[_0x05c3('0x2')]},'authentication':{'type':Sequelize[_0x05c3('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0x05c3('0x2')],'unique':_0x05c3('0x4')},'password':{'type':Sequelize[_0x05c3('0x2')]},'port':{'type':Sequelize[_0x05c3('0x5')]},'tls':{'type':Sequelize[_0x05c3('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0x05c3('0x2')],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x05c3('0x5')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x05c3('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index e5d8d4e..77a010e 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 _0xdc91=['util','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','exports','MailServerIn','mail_servers_in','lodash'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0xdc91,0x8b));var _0x1dc9=function(_0x4d44d8,_0x973338){_0x4d44d8=_0x4d44d8-0x0;var _0x1af3ec=_0xdc91[_0x4d44d8];return _0x1af3ec;};'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':[],'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(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_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 0e67fa7..8e23053 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 _0x8534=['include','map','model','catch','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetMailServerIn','options','raw','where','attributes','limit'];(function(_0x2994bb,_0x43c4b1){var _0x2610f3=function(_0x23821c){while(--_0x23821c){_0x2994bb['push'](_0x2994bb['shift']());}};_0x2610f3(++_0x43c4b1);}(_0x8534,0x14e));var _0x4853=function(_0x28333a,_0x4e4038){_0x28333a=_0x28333a-0x0;var _0x4c5c1a=_0x8534[_0x28333a];return _0x4c5c1a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x4853('0x0'));var BPromise=require('bluebird');var rs=require(_0x4853('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4853('0x2'))['db'];var utils=require(_0x4853('0x3'));var logger=require(_0x4853('0x4'))(_0x4853('0x5'));var config=require('../../config/environment');var jayson=require(_0x4853('0x6'));var client=jayson[_0x4853('0x7')][_0x4853('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x596ac9,_0x460c7d,_0x2c550a){return new BPromise(function(_0x1c3dc4,_0x207254){return client[_0x4853('0x9')](_0x596ac9,_0x2c550a)[_0x4853('0xa')](function(_0x48ad48){logger[_0x4853('0xb')](_0x4853('0xc'),_0x460c7d,_0x4853('0xd'));logger[_0x4853('0xe')](_0x4853('0xf'),_0x460c7d,_0x4853('0xd'),JSON[_0x4853('0x10')](_0x48ad48));if(_0x48ad48[_0x4853('0x11')]){if(_0x48ad48[_0x4853('0x11')][_0x4853('0x12')]===0x1f4){logger[_0x4853('0x11')]('MailServerIn,\x20%s,\x20%s',_0x460c7d,_0x48ad48[_0x4853('0x11')][_0x4853('0x13')]);return _0x207254(_0x48ad48[_0x4853('0x11')][_0x4853('0x13')]);}logger[_0x4853('0x11')](_0x4853('0xc'),_0x460c7d,_0x48ad48[_0x4853('0x11')][_0x4853('0x13')]);return _0x1c3dc4(_0x48ad48[_0x4853('0x11')][_0x4853('0x13')]);}else{logger['info'](_0x4853('0xc'),_0x460c7d,_0x4853('0xd'));_0x1c3dc4(_0x48ad48['result']['message']);}})['catch'](function(_0x2f1434){logger[_0x4853('0x11')](_0x4853('0xc'),_0x460c7d,_0x2f1434);_0x207254(_0x2f1434);});});}exports[_0x4853('0x14')]=function(_0x41133b){var _0x51b0a3=this;return new Promise(function(_0x1ceb6d,_0x1ddfb0){return db['MailServerIn']['findAll']({'raw':_0x41133b[_0x4853('0x15')]?_0x41133b[_0x4853('0x15')][_0x4853('0x16')]===undefined?!![]:![]:!![],'where':_0x41133b[_0x4853('0x15')]?_0x41133b[_0x4853('0x15')][_0x4853('0x17')]||null:null,'attributes':_0x41133b[_0x4853('0x15')]?_0x41133b[_0x4853('0x15')][_0x4853('0x18')]||null:null,'limit':_0x41133b['options']?_0x41133b[_0x4853('0x15')][_0x4853('0x19')]||null:null,'include':_0x41133b[_0x4853('0x15')]?_0x41133b[_0x4853('0x15')][_0x4853('0x1a')]?_[_0x4853('0x1b')](_0x41133b['options'][_0x4853('0x1a')],function(_0x49a85){return{'model':db[_0x49a85[_0x4853('0x1c')]],'as':_0x49a85['as'],'attributes':_0x49a85['attributes'],'include':_0x49a85[_0x4853('0x1a')]?_[_0x4853('0x1b')](_0x49a85[_0x4853('0x1a')],function(_0x406252){return{'model':db[_0x406252[_0x4853('0x1c')]],'as':_0x406252['as'],'attributes':_0x406252[_0x4853('0x18')],'include':_0x406252[_0x4853('0x1a')]?_[_0x4853('0x1b')](_0x406252[_0x4853('0x1a')],function(_0x4e36e2){return{'model':db[_0x4e36e2['model']],'as':_0x4e36e2['as'],'attributes':_0x4e36e2['attributes']};}):[]};}):[]};}):[]:[]})[_0x4853('0xa')](function(_0x1671f6){logger['info'](_0x4853('0x14'),_0x41133b);logger[_0x4853('0xe')](_0x4853('0x14'),_0x41133b,JSON['stringify'](_0x1671f6));_0x1ceb6d(_0x1671f6);})[_0x4853('0x1d')](function(_0x49493a){logger[_0x4853('0x11')](_0x4853('0x14'),_0x49493a[_0x4853('0x13')],_0x41133b);_0x1ddfb0(_0x51b0a3[_0x4853('0x11')](0x1f4,_0x49493a['message']));});});}; \ No newline at end of file +var _0x0112=['info','request\x20sent','debug','MailServerIn,\x20%s,\x20%s,\x20%s','stringify','code','error','MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','MailServerIn','raw','options','where','attributes','limit','include','model','map','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x1f73e6,_0x3e8e99){var _0x33b417=function(_0x880cf3){while(--_0x880cf3){_0x1f73e6['push'](_0x1f73e6['shift']());}};_0x33b417(++_0x3e8e99);}(_0x0112,0x1f1));var _0x2011=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0x0112[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require(_0x2011('0x0'));var moment=require(_0x2011('0x1'));var BPromise=require(_0x2011('0x2'));var rs=require(_0x2011('0x3'));var fs=require('fs');var Redis=require(_0x2011('0x4'));var db=require(_0x2011('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2011('0x6'))(_0x2011('0x7'));var config=require(_0x2011('0x8'));var jayson=require(_0x2011('0x9'));var client=jayson[_0x2011('0xa')][_0x2011('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x17a6ea,_0x1a4f56,_0x24dbac){return new BPromise(function(_0x2fd39a,_0x5abd15){return client['request'](_0x17a6ea,_0x24dbac)[_0x2011('0xc')](function(_0xadca22){logger[_0x2011('0xd')]('MailServerIn,\x20%s,\x20%s',_0x1a4f56,_0x2011('0xe'));logger[_0x2011('0xf')](_0x2011('0x10'),_0x1a4f56,'request\x20sent',JSON[_0x2011('0x11')](_0xadca22));if(_0xadca22['error']){if(_0xadca22['error'][_0x2011('0x12')]===0x1f4){logger[_0x2011('0x13')](_0x2011('0x14'),_0x1a4f56,_0xadca22[_0x2011('0x13')][_0x2011('0x15')]);return _0x5abd15(_0xadca22[_0x2011('0x13')][_0x2011('0x15')]);}logger[_0x2011('0x13')](_0x2011('0x14'),_0x1a4f56,_0xadca22['error'][_0x2011('0x15')]);return _0x2fd39a(_0xadca22['error'][_0x2011('0x15')]);}else{logger[_0x2011('0xd')](_0x2011('0x14'),_0x1a4f56,_0x2011('0xe'));_0x2fd39a(_0xadca22[_0x2011('0x16')][_0x2011('0x15')]);}})['catch'](function(_0x53314b){logger[_0x2011('0x13')](_0x2011('0x14'),_0x1a4f56,_0x53314b);_0x5abd15(_0x53314b);});});}exports[_0x2011('0x17')]=function(_0x477236){var _0x38a534=this;return new Promise(function(_0x3593bc,_0x237628){return db[_0x2011('0x18')]['findAll']({'raw':_0x477236['options']?_0x477236['options'][_0x2011('0x19')]===undefined?!![]:![]:!![],'where':_0x477236[_0x2011('0x1a')]?_0x477236[_0x2011('0x1a')][_0x2011('0x1b')]||null:null,'attributes':_0x477236['options']?_0x477236[_0x2011('0x1a')][_0x2011('0x1c')]||null:null,'limit':_0x477236[_0x2011('0x1a')]?_0x477236[_0x2011('0x1a')][_0x2011('0x1d')]||null:null,'include':_0x477236[_0x2011('0x1a')]?_0x477236[_0x2011('0x1a')][_0x2011('0x1e')]?_['map'](_0x477236[_0x2011('0x1a')]['include'],function(_0x30fb40){return{'model':db[_0x30fb40[_0x2011('0x1f')]],'as':_0x30fb40['as'],'attributes':_0x30fb40['attributes'],'include':_0x30fb40[_0x2011('0x1e')]?_[_0x2011('0x20')](_0x30fb40[_0x2011('0x1e')],function(_0x3baf0f){return{'model':db[_0x3baf0f['model']],'as':_0x3baf0f['as'],'attributes':_0x3baf0f[_0x2011('0x1c')],'include':_0x3baf0f['include']?_['map'](_0x3baf0f['include'],function(_0x45c0af){return{'model':db[_0x45c0af['model']],'as':_0x45c0af['as'],'attributes':_0x45c0af[_0x2011('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2011('0xc')](function(_0x52b6c9){logger['info'](_0x2011('0x17'),_0x477236);logger['debug']('GetMailServerIn',_0x477236,JSON[_0x2011('0x11')](_0x52b6c9));_0x3593bc(_0x52b6c9);})[_0x2011('0x21')](function(_0x121077){logger[_0x2011('0x13')](_0x2011('0x17'),_0x121077[_0x2011('0x15')],_0x477236);_0x237628(_0x38a534[_0x2011('0x13')](0x1f4,_0x121077[_0x2011('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 0a33650..8cf6392 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 _0x8eb1=['put','/:id','delete','destroy','exports','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','isAuthenticated','index','show','create'];(function(_0x38fd75,_0x46f428){var _0x8ec24b=function(_0x4bd062){while(--_0x4bd062){_0x38fd75['push'](_0x38fd75['shift']());}};_0x8ec24b(++_0x46f428);}(_0x8eb1,0x145));var _0x18eb=function(_0x10762c,_0x5c9447){_0x10762c=_0x10762c-0x0;var _0x729cd8=_0x8eb1[_0x10762c];return _0x729cd8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x18eb('0x0'));var timeout=require(_0x18eb('0x1'));var express=require(_0x18eb('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x18eb('0x3'));var config=require(_0x18eb('0x4'));var controller=require(_0x18eb('0x5'));router[_0x18eb('0x6')]('/',auth[_0x18eb('0x7')](),controller[_0x18eb('0x8')]);router[_0x18eb('0x6')]('/:id',auth[_0x18eb('0x7')](),controller[_0x18eb('0x9')]);router['post']('/',auth[_0x18eb('0x7')](),controller[_0x18eb('0xa')]);router[_0x18eb('0xb')](_0x18eb('0xc'),auth[_0x18eb('0x7')](),controller['update']);router[_0x18eb('0xd')](_0x18eb('0xc'),auth['isAuthenticated'](),controller[_0x18eb('0xe')]);module[_0x18eb('0xf')]=router; \ No newline at end of file +var _0xb1a1=['destroy','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get','index','/:id','show','post','isAuthenticated','create','put','update','delete'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb1a1,0x1c9));var _0x1b1a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb1a1[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x1b1a('0x0'));var path=require(_0x1b1a('0x1'));var timeout=require(_0x1b1a('0x2'));var express=require('express');var router=express[_0x1b1a('0x3')]();var auth=require(_0x1b1a('0x4'));var interaction=require(_0x1b1a('0x5'));var config=require(_0x1b1a('0x6'));var controller=require(_0x1b1a('0x7'));router[_0x1b1a('0x8')]('/',auth['isAuthenticated'](),controller[_0x1b1a('0x9')]);router['get'](_0x1b1a('0xa'),auth['isAuthenticated'](),controller[_0x1b1a('0xb')]);router[_0x1b1a('0xc')]('/',auth[_0x1b1a('0xd')](),controller[_0x1b1a('0xe')]);router[_0x1b1a('0xf')](_0x1b1a('0xa'),auth['isAuthenticated'](),controller[_0x1b1a('0x10')]);router[_0x1b1a('0x11')](_0x1b1a('0xa'),auth[_0x1b1a('0xd')](),controller[_0x1b1a('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 24f3a12..362262a 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 _0x7409=['sequelize','exports','STRING','INTEGER','BOOLEAN'];(function(_0x5317af,_0xef1b78){var _0x3b186e=function(_0x13a852){while(--_0x13a852){_0x5317af['push'](_0x5317af['shift']());}};_0x3b186e(++_0xef1b78);}(_0x7409,0x6e));var _0x9740=function(_0x462582,_0x279982){_0x462582=_0x462582-0x0;var _0x176aac=_0x7409[_0x462582];return _0x176aac;};'use strict';var Sequelize=require(_0x9740('0x0'));module[_0x9740('0x1')]={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x9740('0x2')]},'user':{'type':Sequelize[_0x9740('0x2')]},'pass':{'type':Sequelize[_0x9740('0x2')]},'port':{'type':Sequelize[_0x9740('0x3')]},'secure':{'type':Sequelize[_0x9740('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x9740('0x2')]},'authentication':{'type':Sequelize[_0x9740('0x4')],'defaultValue':!![]}}; \ No newline at end of file +var _0x63d4=['exports','STRING','INTEGER','BOOLEAN','sequelize'];(function(_0x58ee29,_0x2f32b5){var _0x3e67cd=function(_0x507a0f){while(--_0x507a0f){_0x58ee29['push'](_0x58ee29['shift']());}};_0x3e67cd(++_0x2f32b5);}(_0x63d4,0x117));var _0x463d=function(_0x37951d,_0x21b6bb){_0x37951d=_0x37951d-0x0;var _0x423b3b=_0x63d4[_0x37951d];return _0x423b3b;};'use strict';var Sequelize=require(_0x463d('0x0'));module[_0x463d('0x1')]={'description':{'type':Sequelize[_0x463d('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x463d('0x2')]},'pass':{'type':Sequelize[_0x463d('0x2')]},'port':{'type':Sequelize[_0x463d('0x3')]},'secure':{'type':Sequelize[_0x463d('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x463d('0x2')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index ac9592c..e637a11 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 _0xb5b1=['../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','then','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','catch','show','params','keys','includeAll','options','create','body','update','find','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x3a90d5,_0x2d5c05){var _0x5817eb=function(_0x5e5735){while(--_0x5e5735){_0x3a90d5['push'](_0x3a90d5['shift']());}};_0x5817eb(++_0x2d5c05);}(_0xb5b1,0x1a3));var _0x1b5b=function(_0x29e3f2,_0x18b71f){_0x29e3f2=_0x29e3f2-0x0;var _0x539dd9=_0xb5b1[_0x29e3f2];return _0x539dd9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1b5b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1b5b('0x1'));var jsonpatch=require(_0x1b5b('0x2'));var rp=require('request-promise');var moment=require(_0x1b5b('0x3'));var BPromise=require(_0x1b5b('0x4'));var Mustache=require(_0x1b5b('0x5'));var util=require(_0x1b5b('0x6'));var path=require(_0x1b5b('0x7'));var sox=require(_0x1b5b('0x8'));var csv=require(_0x1b5b('0x9'));var ejs=require(_0x1b5b('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1b5b('0xb'));var crypto=require(_0x1b5b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1b5b('0xd'));var toCsv=require(_0x1b5b('0x9'));var querystring=require(_0x1b5b('0xe'));var Papa=require(_0x1b5b('0xf'));var Redis=require(_0x1b5b('0x10'));var authService=require(_0x1b5b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1b5b('0x12'));var hardwareService=require(_0x1b5b('0x13'));var logger=require(_0x1b5b('0x14'))('api');var utils=require('../../config/utils');var config=require(_0x1b5b('0x15'));var db=require(_0x1b5b('0x16'))['db'];function respondWithStatusCode(_0x25fa14,_0xc74b36){_0xc74b36=_0xc74b36||0xcc;return function(_0x135c22){if(_0x135c22){return _0x25fa14[_0x1b5b('0x17')](_0xc74b36);}return _0x25fa14[_0x1b5b('0x18')](_0xc74b36)[_0x1b5b('0x19')]();};}function respondWithResult(_0x51b961,_0x1b03db){_0x1b03db=_0x1b03db||0xc8;return function(_0x30f93f){if(_0x30f93f){return _0x51b961[_0x1b5b('0x18')](_0x1b03db)[_0x1b5b('0x1a')](_0x30f93f);}};}function respondWithFilteredResult(_0x117f72,_0x37e264){return function(_0x3052f0){if(_0x3052f0){var _0x7ff664=_0x3052f0[_0x1b5b('0x1b')],_0x4155b7=_0x37e264['offset'],_0x42d386=_0x37e264[_0x1b5b('0x1c')]+_0x37e264[_0x1b5b('0x1d')],_0x4891c0;if(_0x42d386>=_0x7ff664){_0x42d386=_0x7ff664;_0x4891c0=0xc8;}else{_0x4891c0=0xce;}_0x117f72[_0x1b5b('0x18')](_0x4891c0);return _0x117f72[_0x1b5b('0x1e')]('Content-Range',_0x4155b7+'-'+_0x42d386+'/'+_0x7ff664)[_0x1b5b('0x1a')](_0x3052f0);}return null;};}function patchUpdates(_0x2557d){return function(_0x19de3e){try{jsonpatch[_0x1b5b('0x1f')](_0x19de3e,_0x2557d,!![]);}catch(_0x5035b0){return BPromise[_0x1b5b('0x20')](_0x5035b0);}return _0x19de3e[_0x1b5b('0x21')]();};}function saveUpdates(_0xe86441,_0x1f8b80){return function(_0x4b304f){if(_0x4b304f){return _0x4b304f['update'](_0xe86441)[_0x1b5b('0x22')](function(_0xe9bdcb){return _0xe9bdcb;});}return null;};}function removeEntity(_0x36867d,_0x1bebd8){return function(_0x5b1da9){if(_0x5b1da9){return _0x5b1da9['destroy']()[_0x1b5b('0x22')](function(){_0x36867d['status'](0xcc)[_0x1b5b('0x19')]();});}};}function handleEntityNotFound(_0x19a727,_0x4558ba){return function(_0x58d675){if(!_0x58d675){_0x19a727[_0x1b5b('0x17')](0x194);}return _0x58d675;};}function handleError(_0x16eee7,_0x37bd2b){_0x37bd2b=_0x37bd2b||0x1f4;return function(_0x29f6f5){logger[_0x1b5b('0x23')](_0x29f6f5[_0x1b5b('0x24')]);if(_0x29f6f5[_0x1b5b('0x25')]){delete _0x29f6f5[_0x1b5b('0x25')];}_0x16eee7['status'](_0x37bd2b)['send'](_0x29f6f5);};}exports[_0x1b5b('0x26')]=function(_0x5f351c,_0x44306e){var _0x95b7db={},_0x2eae0f={},_0xa16b49={'count':0x0,'rows':[]};var _0x2a6a2b=_[_0x1b5b('0x27')](db[_0x1b5b('0x28')][_0x1b5b('0x29')],function(_0x98d0a){return{'name':_0x98d0a[_0x1b5b('0x2a')],'type':_0x98d0a['type'][_0x1b5b('0x2b')]};});_0x2eae0f['model']=_['map'](_0x2a6a2b,_0x1b5b('0x25'));_0x2eae0f[_0x1b5b('0x2c')]=_['keys'](_0x5f351c['query']);_0x2eae0f[_0x1b5b('0x2d')]=_[_0x1b5b('0x2e')](_0x2eae0f['model'],_0x2eae0f[_0x1b5b('0x2c')]);_0x95b7db[_0x1b5b('0x2f')]=_['intersection'](_0x2eae0f[_0x1b5b('0x30')],qs[_0x1b5b('0x31')](_0x5f351c[_0x1b5b('0x2c')][_0x1b5b('0x31')]));_0x95b7db[_0x1b5b('0x2f')]=_0x95b7db[_0x1b5b('0x2f')][_0x1b5b('0x32')]?_0x95b7db[_0x1b5b('0x2f')]:_0x2eae0f['model'];if(!_0x5f351c[_0x1b5b('0x2c')][_0x1b5b('0x33')](_0x1b5b('0x34'))){_0x95b7db['limit']=qs[_0x1b5b('0x1d')](_0x5f351c[_0x1b5b('0x2c')]['limit']);_0x95b7db[_0x1b5b('0x1c')]=qs['offset'](_0x5f351c[_0x1b5b('0x2c')][_0x1b5b('0x1c')]);}_0x95b7db[_0x1b5b('0x35')]=qs['sort'](_0x5f351c[_0x1b5b('0x2c')][_0x1b5b('0x36')]);_0x95b7db[_0x1b5b('0x37')]=qs[_0x1b5b('0x2d')](_[_0x1b5b('0x38')](_0x5f351c[_0x1b5b('0x2c')],_0x2eae0f[_0x1b5b('0x2d')]));if(_0x5f351c[_0x1b5b('0x2c')][_0x1b5b('0x39')]){_0x95b7db['where']=_[_0x1b5b('0x3a')](_0x95b7db[_0x1b5b('0x37')],{'$or':_[_0x1b5b('0x27')](_0x2a6a2b,function(_0x17e32a){if(_0x17e32a[_0x1b5b('0x3b')]!==_0x1b5b('0x3c')){var _0x1e5e34={};_0x1e5e34[_0x17e32a[_0x1b5b('0x25')]]={'$like':'%'+_0x5f351c[_0x1b5b('0x2c')]['filter']+'%'};return _0x1e5e34;}})});}_0x95b7db=_[_0x1b5b('0x3a')]({},_0x95b7db,_0x5f351c['options']);var _0x11bf1f={'where':_0x95b7db['where']};return db[_0x1b5b('0x28')][_0x1b5b('0x1b')](_0x11bf1f)['then'](function(_0x479e8e){_0xa16b49[_0x1b5b('0x1b')]=_0x479e8e;if(_0x5f351c['query']['includeAll']){_0x95b7db['include']=[{'all':!![]}];}return db[_0x1b5b('0x28')][_0x1b5b('0x3d')](_0x95b7db);})['then'](function(_0x3be508){_0xa16b49[_0x1b5b('0x3e')]=_0x3be508;return _0xa16b49;})[_0x1b5b('0x22')](respondWithFilteredResult(_0x44306e,_0x95b7db))[_0x1b5b('0x3f')](handleError(_0x44306e,null));};exports[_0x1b5b('0x40')]=function(_0x145c67,_0x5b9943){var _0xc2bec0={'raw':!![],'where':{'id':_0x145c67[_0x1b5b('0x41')]['id']}},_0x2648fd={};_0x2648fd[_0x1b5b('0x30')]=_[_0x1b5b('0x42')](db['MailServerOut']['rawAttributes']);_0x2648fd[_0x1b5b('0x2c')]=_[_0x1b5b('0x42')](_0x145c67['query']);_0x2648fd[_0x1b5b('0x2d')]=_[_0x1b5b('0x2e')](_0x2648fd[_0x1b5b('0x30')],_0x2648fd[_0x1b5b('0x2c')]);_0xc2bec0[_0x1b5b('0x2f')]=_['intersection'](_0x2648fd[_0x1b5b('0x30')],qs[_0x1b5b('0x31')](_0x145c67[_0x1b5b('0x2c')][_0x1b5b('0x31')]));_0xc2bec0[_0x1b5b('0x2f')]=_0xc2bec0[_0x1b5b('0x2f')][_0x1b5b('0x32')]?_0xc2bec0[_0x1b5b('0x2f')]:_0x2648fd[_0x1b5b('0x30')];if(_0x145c67[_0x1b5b('0x2c')][_0x1b5b('0x43')]){_0xc2bec0['include']=[{'all':!![]}];}_0xc2bec0=_['merge']({},_0xc2bec0,_0x145c67[_0x1b5b('0x44')]);return db[_0x1b5b('0x28')]['find'](_0xc2bec0)[_0x1b5b('0x22')](handleEntityNotFound(_0x5b9943,null))[_0x1b5b('0x22')](respondWithResult(_0x5b9943,null))[_0x1b5b('0x3f')](handleError(_0x5b9943,null));};exports[_0x1b5b('0x45')]=function(_0x1c20a5,_0x148a55){return db[_0x1b5b('0x28')][_0x1b5b('0x45')](_0x1c20a5[_0x1b5b('0x46')],{})[_0x1b5b('0x22')](respondWithResult(_0x148a55,0xc9))[_0x1b5b('0x3f')](handleError(_0x148a55,null));};exports[_0x1b5b('0x47')]=function(_0x30d23c,_0x164da1){if(_0x30d23c[_0x1b5b('0x46')]['id']){delete _0x30d23c[_0x1b5b('0x46')]['id'];}return db['MailServerOut'][_0x1b5b('0x48')]({'where':{'id':_0x30d23c[_0x1b5b('0x41')]['id']}})[_0x1b5b('0x22')](handleEntityNotFound(_0x164da1,null))[_0x1b5b('0x22')](saveUpdates(_0x30d23c[_0x1b5b('0x46')],null))[_0x1b5b('0x22')](respondWithResult(_0x164da1,null))[_0x1b5b('0x3f')](handleError(_0x164da1,null));};exports['destroy']=function(_0x47d277,_0x58bc20){return db[_0x1b5b('0x28')][_0x1b5b('0x48')]({'where':{'id':_0x47d277[_0x1b5b('0x41')]['id']}})[_0x1b5b('0x22')](handleEntityNotFound(_0x58bc20,null))[_0x1b5b('0x22')](removeEntity(_0x58bc20,null))[_0x1b5b('0x3f')](handleError(_0x58bc20,null));}; \ No newline at end of file +var _0x3815=['../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','json','count','status','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','limit','offset','pick','filters','filter','where','merge','VIRTUAL','options','MailServerOut','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3815,0x1ea));var _0x5381=function(_0x27a2e8,_0x38dabb){_0x27a2e8=_0x27a2e8-0x0;var _0x5e1af4=_0x3815[_0x27a2e8];return _0x5e1af4;};'use strict';var pdf=require(_0x5381('0x0'));var emlformat=require(_0x5381('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x5381('0x2'));var jsonpatch=require(_0x5381('0x3'));var rp=require(_0x5381('0x4'));var moment=require(_0x5381('0x5'));var BPromise=require(_0x5381('0x6'));var Mustache=require(_0x5381('0x7'));var util=require(_0x5381('0x8'));var path=require(_0x5381('0x9'));var sox=require(_0x5381('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x5381('0xb'));var squel=require(_0x5381('0xc'));var crypto=require(_0x5381('0xd'));var jsforce=require(_0x5381('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5381('0xf'));var Redis=require(_0x5381('0x10'));var authService=require(_0x5381('0x11'));var qs=require(_0x5381('0x12'));var as=require(_0x5381('0x13'));var hardwareService=require(_0x5381('0x14'));var logger=require(_0x5381('0x15'))(_0x5381('0x16'));var utils=require(_0x5381('0x17'));var config=require(_0x5381('0x18'));var db=require(_0x5381('0x19'))['db'];function respondWithStatusCode(_0x973ea2,_0x3dee8c){_0x3dee8c=_0x3dee8c||0xcc;return function(_0x30bbd4){if(_0x30bbd4){return _0x973ea2[_0x5381('0x1a')](_0x3dee8c);}return _0x973ea2['status'](_0x3dee8c)['end']();};}function respondWithResult(_0x3cb412,_0x171ba7){_0x171ba7=_0x171ba7||0xc8;return function(_0x3a8cbb){if(_0x3a8cbb){return _0x3cb412['status'](_0x171ba7)[_0x5381('0x1b')](_0x3a8cbb);}};}function respondWithFilteredResult(_0x1dcab9,_0x2fc418){return function(_0x356300){if(_0x356300){var _0x3ffc0c=_0x356300[_0x5381('0x1c')],_0x2adeac=_0x2fc418['offset'],_0x4c44d2=_0x2fc418['offset']+_0x2fc418['limit'],_0x2f44bb;if(_0x4c44d2>=_0x3ffc0c){_0x4c44d2=_0x3ffc0c;_0x2f44bb=0xc8;}else{_0x2f44bb=0xce;}_0x1dcab9[_0x5381('0x1d')](_0x2f44bb);return _0x1dcab9[_0x5381('0x1e')](_0x5381('0x1f'),_0x2adeac+'-'+_0x4c44d2+'/'+_0x3ffc0c)[_0x5381('0x1b')](_0x356300);}return null;};}function patchUpdates(_0x415d03){return function(_0xff8804){try{jsonpatch[_0x5381('0x20')](_0xff8804,_0x415d03,!![]);}catch(_0x26ea1d){return BPromise[_0x5381('0x21')](_0x26ea1d);}return _0xff8804[_0x5381('0x22')]();};}function saveUpdates(_0x440330,_0x5456c1){return function(_0x5e1327){if(_0x5e1327){return _0x5e1327[_0x5381('0x23')](_0x440330)[_0x5381('0x24')](function(_0x55a994){return _0x55a994;});}return null;};}function removeEntity(_0x3741bd,_0x320673){return function(_0x4d9d58){if(_0x4d9d58){return _0x4d9d58[_0x5381('0x25')]()[_0x5381('0x24')](function(){_0x3741bd[_0x5381('0x1d')](0xcc)[_0x5381('0x26')]();});}};}function handleEntityNotFound(_0x3f717d,_0x266218){return function(_0x41694e){if(!_0x41694e){_0x3f717d[_0x5381('0x1a')](0x194);}return _0x41694e;};}function handleError(_0x38540d,_0x3151f6){_0x3151f6=_0x3151f6||0x1f4;return function(_0x494958){logger['error'](_0x494958[_0x5381('0x27')]);if(_0x494958[_0x5381('0x28')]){delete _0x494958['name'];}_0x38540d['status'](_0x3151f6)['send'](_0x494958);};}exports[_0x5381('0x29')]=function(_0x448cec,_0x30c800){var _0xf137da={},_0x8ca0e1={},_0x2a542c={'count':0x0,'rows':[]};var _0x4abab9=_[_0x5381('0x2a')](db['MailServerOut']['rawAttributes'],function(_0x299734){return{'name':_0x299734[_0x5381('0x2b')],'type':_0x299734[_0x5381('0x2c')][_0x5381('0x2d')]};});_0x8ca0e1['model']=_[_0x5381('0x2a')](_0x4abab9,_0x5381('0x28'));_0x8ca0e1[_0x5381('0x2e')]=_[_0x5381('0x2f')](_0x448cec[_0x5381('0x2e')]);_0x8ca0e1['filters']=_[_0x5381('0x30')](_0x8ca0e1['model'],_0x8ca0e1['query']);_0xf137da['attributes']=_[_0x5381('0x30')](_0x8ca0e1[_0x5381('0x31')],qs[_0x5381('0x32')](_0x448cec[_0x5381('0x2e')][_0x5381('0x32')]));_0xf137da[_0x5381('0x33')]=_0xf137da['attributes'][_0x5381('0x34')]?_0xf137da['attributes']:_0x8ca0e1['model'];if(!_0x448cec[_0x5381('0x2e')]['hasOwnProperty']('nolimit')){_0xf137da['limit']=qs[_0x5381('0x35')](_0x448cec['query'][_0x5381('0x35')]);_0xf137da['offset']=qs[_0x5381('0x36')](_0x448cec[_0x5381('0x2e')][_0x5381('0x36')]);}_0xf137da['order']=qs['sort'](_0x448cec[_0x5381('0x2e')]['sort']);_0xf137da['where']=qs['filters'](_[_0x5381('0x37')](_0x448cec['query'],_0x8ca0e1[_0x5381('0x38')]));if(_0x448cec[_0x5381('0x2e')][_0x5381('0x39')]){_0xf137da[_0x5381('0x3a')]=_[_0x5381('0x3b')](_0xf137da[_0x5381('0x3a')],{'$or':_[_0x5381('0x2a')](_0x4abab9,function(_0x2e260f){if(_0x2e260f[_0x5381('0x2c')]!==_0x5381('0x3c')){var _0x15f0f3={};_0x15f0f3[_0x2e260f[_0x5381('0x28')]]={'$like':'%'+_0x448cec[_0x5381('0x2e')][_0x5381('0x39')]+'%'};return _0x15f0f3;}})});}_0xf137da=_['merge']({},_0xf137da,_0x448cec[_0x5381('0x3d')]);var _0x52058e={'where':_0xf137da['where']};return db[_0x5381('0x3e')][_0x5381('0x1c')](_0x52058e)['then'](function(_0x208e37){_0x2a542c[_0x5381('0x1c')]=_0x208e37;if(_0x448cec[_0x5381('0x2e')][_0x5381('0x3f')]){_0xf137da[_0x5381('0x40')]=[{'all':!![]}];}return db['MailServerOut'][_0x5381('0x41')](_0xf137da);})[_0x5381('0x24')](function(_0x5b0bb3){_0x2a542c['rows']=_0x5b0bb3;return _0x2a542c;})[_0x5381('0x24')](respondWithFilteredResult(_0x30c800,_0xf137da))[_0x5381('0x42')](handleError(_0x30c800,null));};exports[_0x5381('0x43')]=function(_0xdabf69,_0x174a20){var _0x5aad1d={'raw':!![],'where':{'id':_0xdabf69[_0x5381('0x44')]['id']}},_0x9c1189={};_0x9c1189[_0x5381('0x31')]=_['keys'](db['MailServerOut'][_0x5381('0x45')]);_0x9c1189[_0x5381('0x2e')]=_[_0x5381('0x2f')](_0xdabf69['query']);_0x9c1189[_0x5381('0x38')]=_[_0x5381('0x30')](_0x9c1189[_0x5381('0x31')],_0x9c1189[_0x5381('0x2e')]);_0x5aad1d[_0x5381('0x33')]=_[_0x5381('0x30')](_0x9c1189[_0x5381('0x31')],qs[_0x5381('0x32')](_0xdabf69[_0x5381('0x2e')][_0x5381('0x32')]));_0x5aad1d[_0x5381('0x33')]=_0x5aad1d['attributes'][_0x5381('0x34')]?_0x5aad1d[_0x5381('0x33')]:_0x9c1189['model'];if(_0xdabf69[_0x5381('0x2e')]['includeAll']){_0x5aad1d[_0x5381('0x40')]=[{'all':!![]}];}_0x5aad1d=_[_0x5381('0x3b')]({},_0x5aad1d,_0xdabf69[_0x5381('0x3d')]);return db[_0x5381('0x3e')]['find'](_0x5aad1d)[_0x5381('0x24')](handleEntityNotFound(_0x174a20,null))[_0x5381('0x24')](respondWithResult(_0x174a20,null))[_0x5381('0x42')](handleError(_0x174a20,null));};exports[_0x5381('0x46')]=function(_0x16e559,_0x5dbbbc){return db[_0x5381('0x3e')][_0x5381('0x46')](_0x16e559[_0x5381('0x47')],{})[_0x5381('0x24')](respondWithResult(_0x5dbbbc,0xc9))[_0x5381('0x42')](handleError(_0x5dbbbc,null));};exports[_0x5381('0x23')]=function(_0x2f74ea,_0x272aad){if(_0x2f74ea[_0x5381('0x47')]['id']){delete _0x2f74ea[_0x5381('0x47')]['id'];}return db[_0x5381('0x3e')][_0x5381('0x48')]({'where':{'id':_0x2f74ea['params']['id']}})[_0x5381('0x24')](handleEntityNotFound(_0x272aad,null))['then'](saveUpdates(_0x2f74ea['body'],null))[_0x5381('0x24')](respondWithResult(_0x272aad,null))[_0x5381('0x42')](handleError(_0x272aad,null));};exports[_0x5381('0x25')]=function(_0x56c268,_0x3bcffc){return db[_0x5381('0x3e')][_0x5381('0x48')]({'where':{'id':_0x56c268[_0x5381('0x44')]['id']}})['then'](handleEntityNotFound(_0x3bcffc,null))[_0x5381('0x24')](removeEntity(_0x3bcffc,null))[_0x5381('0x42')](handleError(_0x3bcffc,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index bd17f5e..5899732 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 _0x3f8a=['rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5bcff3,_0x12b180){var _0x241e2e=function(_0x52c055){while(--_0x52c055){_0x5bcff3['push'](_0x5bcff3['shift']());}};_0x241e2e(++_0x12b180);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x27c822,_0x4850f1){_0x27c822=_0x27c822-0x0;var _0x2e60b2=_0x3f8a[_0x27c822];return _0x2e60b2;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));module[_0xa3f8('0xa')]=function(_0x471464,_0x1f160a){return _0x471464[_0xa3f8('0xb')](_0xa3f8('0xc'),attributes,{'tableName':_0xa3f8('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdc97=['path','../../config/environment','./mailServerOut.attributes','exports','define','lodash','util','../../config/logger','moment','request-promise'];(function(_0x4492af,_0x47e25d){var _0x216729=function(_0x4964c8){while(--_0x4964c8){_0x4492af['push'](_0x4492af['shift']());}};_0x216729(++_0x47e25d);}(_0xdc97,0x13b));var _0x7dc9=function(_0x32d316,_0x4d8c98){_0x32d316=_0x32d316-0x0;var _0x2abe04=_0xdc97[_0x32d316];return _0x2abe04;};'use strict';var _=require(_0x7dc9('0x0'));var util=require(_0x7dc9('0x1'));var logger=require(_0x7dc9('0x2'))('api');var moment=require(_0x7dc9('0x3'));var BPromise=require('bluebird');var rp=require(_0x7dc9('0x4'));var fs=require('fs');var path=require(_0x7dc9('0x5'));var rimraf=require('rimraf');var config=require(_0x7dc9('0x6'));var attributes=require(_0x7dc9('0x7'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('MailServerOut',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 66936ee..567dfd3 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 _0xc037=['message','info','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x3b0120,_0x238204){var _0x35ff5c=function(_0x2c04f4){while(--_0x2c04f4){_0x3b0120['push'](_0x3b0120['shift']());}};_0x35ff5c(++_0x238204);}(_0xc037,0x1cb));var _0x7c03=function(_0x2a2287,_0x34b9a3){_0x2a2287=_0x2a2287-0x0;var _0x557488=_0xc037[_0x2a2287];return _0x557488;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x7c03('0x0'));var rs=require(_0x7c03('0x1'));var fs=require('fs');var Redis=require(_0x7c03('0x2'));var db=require(_0x7c03('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7c03('0x4'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c03('0x5')][_0x7c03('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x181e90,_0x17c5b0,_0x289b76){return new BPromise(function(_0x2afa25,_0x125b37){return client[_0x7c03('0x7')](_0x181e90,_0x289b76)[_0x7c03('0x8')](function(_0x228465){logger['info'](_0x7c03('0x9'),_0x17c5b0,_0x7c03('0xa'));logger[_0x7c03('0xb')](_0x7c03('0xc'),_0x17c5b0,'request\x20sent',JSON[_0x7c03('0xd')](_0x228465));if(_0x228465[_0x7c03('0xe')]){if(_0x228465[_0x7c03('0xe')][_0x7c03('0xf')]===0x1f4){logger['error']('MailServerOut,\x20%s,\x20%s',_0x17c5b0,_0x228465['error']['message']);return _0x125b37(_0x228465[_0x7c03('0xe')][_0x7c03('0x10')]);}logger[_0x7c03('0xe')](_0x7c03('0x9'),_0x17c5b0,_0x228465[_0x7c03('0xe')][_0x7c03('0x10')]);return _0x2afa25(_0x228465[_0x7c03('0xe')][_0x7c03('0x10')]);}else{logger[_0x7c03('0x11')](_0x7c03('0x9'),_0x17c5b0,_0x7c03('0xa'));_0x2afa25(_0x228465['result'][_0x7c03('0x10')]);}})[_0x7c03('0x12')](function(_0x56ba18){logger['error'](_0x7c03('0x9'),_0x17c5b0,_0x56ba18);_0x125b37(_0x56ba18);});});} \ No newline at end of file +var _0xa855=['MailServerOut,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x48db98,_0x2a40e4){var _0x11363f=function(_0x44bf99){while(--_0x44bf99){_0x48db98['push'](_0x48db98['shift']());}};_0x11363f(++_0x2a40e4);}(_0xa855,0x137));var _0x5a85=function(_0x1a05d8,_0x188aba){_0x1a05d8=_0x1a05d8-0x0;var _0x1f16bf=_0xa855[_0x1a05d8];return _0x1f16bf;};'use strict';var _=require(_0x5a85('0x0'));var util=require(_0x5a85('0x1'));var moment=require(_0x5a85('0x2'));var BPromise=require(_0x5a85('0x3'));var rs=require(_0x5a85('0x4'));var fs=require('fs');var Redis=require(_0x5a85('0x5'));var db=require(_0x5a85('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x5a85('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5a85('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29f8a2,_0x469396,_0x468888){return new BPromise(function(_0x201a6c,_0xd082be){return client['request'](_0x29f8a2,_0x468888)[_0x5a85('0x9')](function(_0x415b9d){logger['info'](_0x5a85('0xa'),_0x469396,_0x5a85('0xb'));logger[_0x5a85('0xc')](_0x5a85('0xd'),_0x469396,'request\x20sent',JSON[_0x5a85('0xe')](_0x415b9d));if(_0x415b9d[_0x5a85('0xf')]){if(_0x415b9d['error']['code']===0x1f4){logger[_0x5a85('0xf')](_0x5a85('0xa'),_0x469396,_0x415b9d[_0x5a85('0xf')][_0x5a85('0x10')]);return _0xd082be(_0x415b9d['error'][_0x5a85('0x10')]);}logger[_0x5a85('0xf')]('MailServerOut,\x20%s,\x20%s',_0x469396,_0x415b9d[_0x5a85('0xf')][_0x5a85('0x10')]);return _0x201a6c(_0x415b9d[_0x5a85('0xf')][_0x5a85('0x10')]);}else{logger['info']('MailServerOut,\x20%s,\x20%s',_0x469396,_0x5a85('0xb'));_0x201a6c(_0x415b9d['result']['message']);}})[_0x5a85('0x11')](function(_0x455003){logger['error'](_0x5a85('0xa'),_0x469396,_0x455003);_0xd082be(_0x455003);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 3a653d2..26c5c72 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 _0xcfc7=['get','/describe','describe','create','put','/:id','delete','destroy','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','isAuthenticated','index'];(function(_0x35c1db,_0xd75c15){var _0x4173ff=function(_0x5d6901){while(--_0x5d6901){_0x35c1db['push'](_0x35c1db['shift']());}};_0x4173ff(++_0xd75c15);}(_0xcfc7,0x107));var _0x7cfc=function(_0x9a6719,_0x191f24){_0x9a6719=_0x9a6719-0x0;var _0x138184=_0xcfc7[_0x9a6719];return _0x138184;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x7cfc('0x0'));var timeout=require(_0x7cfc('0x1'));var express=require(_0x7cfc('0x2'));var router=express[_0x7cfc('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x7cfc('0x4'));var config=require(_0x7cfc('0x5'));var controller=require(_0x7cfc('0x6'));router['get']('/',auth[_0x7cfc('0x7')](),controller[_0x7cfc('0x8')]);router[_0x7cfc('0x9')](_0x7cfc('0xa'),auth['isAuthenticated'](),controller[_0x7cfc('0xb')]);router[_0x7cfc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller[_0x7cfc('0xc')]);router[_0x7cfc('0xd')](_0x7cfc('0xe'),auth[_0x7cfc('0x7')](),controller['update']);router[_0x7cfc('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x7cfc('0x10')]);module['exports']=router; \ No newline at end of file +var _0xbfd3=['../../components/auth/service','../../config/environment','./mailSubstatus.controller','index','get','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router'];(function(_0xa409ae,_0x1fb79c){var _0x4b2b0b=function(_0x5c56a6){while(--_0x5c56a6){_0xa409ae['push'](_0xa409ae['shift']());}};_0x4b2b0b(++_0x1fb79c);}(_0xbfd3,0x14b));var _0x3bfd=function(_0x390982,_0x3c172c){_0x390982=_0x390982-0x0;var _0x35a0f7=_0xbfd3[_0x390982];return _0x35a0f7;};'use strict';var multer=require(_0x3bfd('0x0'));var util=require(_0x3bfd('0x1'));var path=require(_0x3bfd('0x2'));var timeout=require(_0x3bfd('0x3'));var express=require('express');var router=express[_0x3bfd('0x4')]();var auth=require(_0x3bfd('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3bfd('0x6'));var controller=require(_0x3bfd('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x3bfd('0x8')]);router[_0x3bfd('0x9')](_0x3bfd('0xa'),auth[_0x3bfd('0xb')](),controller[_0x3bfd('0xc')]);router[_0x3bfd('0x9')](_0x3bfd('0xd'),auth[_0x3bfd('0xb')](),controller[_0x3bfd('0xe')]);router[_0x3bfd('0xf')]('/',auth[_0x3bfd('0xb')](),controller[_0x3bfd('0x10')]);router[_0x3bfd('0x11')](_0x3bfd('0xd'),auth[_0x3bfd('0xb')](),controller[_0x3bfd('0x12')]);router['delete'](_0x3bfd('0xd'),auth[_0x3bfd('0xb')](),controller[_0x3bfd('0x13')]);module[_0x3bfd('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index 20899f7..43a7832 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 _0xb5dd=['name','sequelize','exports','STRING'];(function(_0x2c2d11,_0x4308ac){var _0x255f24=function(_0x1aa524){while(--_0x1aa524){_0x2c2d11['push'](_0x2c2d11['shift']());}};_0x255f24(++_0x4308ac);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xb5dd[_0x4b369d];return _0x571a98;};'use strict';var Sequelize=require(_0xdb5d('0x0'));module[_0xdb5d('0x1')]={'name':{'type':Sequelize[_0xdb5d('0x2')],'unique':_0xdb5d('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xdb5d('0x2')]}}; \ No newline at end of file +var _0xa064=['STRING','name','sequelize','exports'];(function(_0x4bb66f,_0x3cd682){var _0xf2772f=function(_0x2e3698){while(--_0x2e3698){_0x4bb66f['push'](_0x4bb66f['shift']());}};_0xf2772f(++_0x3cd682);}(_0xa064,0x192));var _0x4a06=function(_0x214642,_0xc9fac6){_0x214642=_0x214642-0x0;var _0x4ec937=_0xa064[_0x214642];return _0x4ec937;};'use strict';var Sequelize=require(_0x4a06('0x0'));module[_0x4a06('0x1')]={'name':{'type':Sequelize[_0x4a06('0x2')],'unique':_0x4a06('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4a06('0x2')]}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index d5f1c14..106c210 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 _0xc4aa=['request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','update','then','error','stack','name','send','index','map','MailSubstatus','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','options','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xc4aa,0x1b7));var _0xac4a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xc4aa[_0xa148b7];return _0x51efd3;};'use strict';var pdf=require(_0xac4a('0x0'));var emlformat=require(_0xac4a('0x1'));var rimraf=require(_0xac4a('0x2'));var zipdir=require(_0xac4a('0x3'));var jsonpatch=require(_0xac4a('0x4'));var rp=require(_0xac4a('0x5'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xac4a('0x6'));var path=require(_0xac4a('0x7'));var sox=require(_0xac4a('0x8'));var csv=require(_0xac4a('0x9'));var ejs=require(_0xac4a('0xa'));var fs=require('fs');var _=require(_0xac4a('0xb'));var squel=require(_0xac4a('0xc'));var crypto=require(_0xac4a('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xac4a('0x9'));var querystring=require(_0xac4a('0xe'));var Papa=require(_0xac4a('0xf'));var Redis=require('ioredis');var authService=require(_0xac4a('0x10'));var qs=require(_0xac4a('0x11'));var as=require(_0xac4a('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac4a('0x13'))('api');var utils=require(_0xac4a('0x14'));var config=require('../../config/environment');var db=require(_0xac4a('0x15'))['db'];function respondWithStatusCode(_0x2a0776,_0x24291d){_0x24291d=_0x24291d||0xcc;return function(_0x5e16aa){if(_0x5e16aa){return _0x2a0776[_0xac4a('0x16')](_0x24291d);}return _0x2a0776[_0xac4a('0x17')](_0x24291d)[_0xac4a('0x18')]();};}function respondWithResult(_0x6e00d4,_0x1b4313){_0x1b4313=_0x1b4313||0xc8;return function(_0x3b71c0){if(_0x3b71c0){return _0x6e00d4[_0xac4a('0x17')](_0x1b4313)[_0xac4a('0x19')](_0x3b71c0);}};}function respondWithFilteredResult(_0x190418,_0x42c7fc){return function(_0x11e101){if(_0x11e101){var _0x26dbb8=_0x11e101[_0xac4a('0x1a')],_0x4a2119=_0x42c7fc[_0xac4a('0x1b')],_0x402fff=_0x42c7fc[_0xac4a('0x1b')]+_0x42c7fc[_0xac4a('0x1c')],_0x34d797;if(_0x402fff>=_0x26dbb8){_0x402fff=_0x26dbb8;_0x34d797=0xc8;}else{_0x34d797=0xce;}_0x190418[_0xac4a('0x17')](_0x34d797);return _0x190418[_0xac4a('0x1d')]('Content-Range',_0x4a2119+'-'+_0x402fff+'/'+_0x26dbb8)['json'](_0x11e101);}return null;};}function patchUpdates(_0x21a729){return function(_0x13c8eb){try{jsonpatch[_0xac4a('0x1e')](_0x13c8eb,_0x21a729,!![]);}catch(_0x4d837c){return BPromise[_0xac4a('0x1f')](_0x4d837c);}return _0x13c8eb[_0xac4a('0x20')]();};}function saveUpdates(_0x3752e4,_0x3a3cdb){return function(_0x123694){if(_0x123694){return _0x123694[_0xac4a('0x21')](_0x3752e4)[_0xac4a('0x22')](function(_0x3ca790){return _0x3ca790;});}return null;};}function removeEntity(_0x534092,_0x3d8f0a){return function(_0x3204ad){if(_0x3204ad){return _0x3204ad['destroy']()[_0xac4a('0x22')](function(){_0x534092[_0xac4a('0x17')](0xcc)[_0xac4a('0x18')]();});}};}function handleEntityNotFound(_0x947d8e,_0x4d2d6c){return function(_0x1b7998){if(!_0x1b7998){_0x947d8e[_0xac4a('0x16')](0x194);}return _0x1b7998;};}function handleError(_0x15435c,_0x412494){_0x412494=_0x412494||0x1f4;return function(_0x594f36){logger[_0xac4a('0x23')](_0x594f36[_0xac4a('0x24')]);if(_0x594f36[_0xac4a('0x25')]){delete _0x594f36[_0xac4a('0x25')];}_0x15435c[_0xac4a('0x17')](_0x412494)[_0xac4a('0x26')](_0x594f36);};}exports[_0xac4a('0x27')]=function(_0x14832b,_0x472c57){var _0x1c13dc={},_0x20202c={},_0x4e17ce={'count':0x0,'rows':[]};var _0x23b061=_[_0xac4a('0x28')](db[_0xac4a('0x29')][_0xac4a('0x2a')],function(_0x116700){return{'name':_0x116700['fieldName'],'type':_0x116700['type'][_0xac4a('0x2b')]};});_0x20202c[_0xac4a('0x2c')]=_[_0xac4a('0x28')](_0x23b061,'name');_0x20202c['query']=_[_0xac4a('0x2d')](_0x14832b[_0xac4a('0x2e')]);_0x20202c[_0xac4a('0x2f')]=_[_0xac4a('0x30')](_0x20202c[_0xac4a('0x2c')],_0x20202c['query']);_0x1c13dc[_0xac4a('0x31')]=_['intersection'](_0x20202c[_0xac4a('0x2c')],qs['fields'](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x32')]));_0x1c13dc[_0xac4a('0x31')]=_0x1c13dc[_0xac4a('0x31')][_0xac4a('0x33')]?_0x1c13dc[_0xac4a('0x31')]:_0x20202c[_0xac4a('0x2c')];if(!_0x14832b[_0xac4a('0x2e')][_0xac4a('0x34')](_0xac4a('0x35'))){_0x1c13dc[_0xac4a('0x1c')]=qs[_0xac4a('0x1c')](_0x14832b[_0xac4a('0x2e')][_0xac4a('0x1c')]);_0x1c13dc['offset']=qs[_0xac4a('0x1b')](_0x14832b[_0xac4a('0x2e')]['offset']);}_0x1c13dc[_0xac4a('0x36')]=qs[_0xac4a('0x37')](_0x14832b['query']['sort']);_0x1c13dc[_0xac4a('0x38')]=qs[_0xac4a('0x2f')](_[_0xac4a('0x39')](_0x14832b[_0xac4a('0x2e')],_0x20202c['filters']));if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]){_0x1c13dc['where']=_[_0xac4a('0x3b')](_0x1c13dc[_0xac4a('0x38')],{'$or':_[_0xac4a('0x28')](_0x23b061,function(_0x5f0eb8){if(_0x5f0eb8[_0xac4a('0x3c')]!==_0xac4a('0x3d')){var _0x1b5427={};_0x1b5427[_0x5f0eb8['name']]={'$like':'%'+_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3a')]+'%'};return _0x1b5427;}})});}_0x1c13dc=_['merge']({},_0x1c13dc,_0x14832b['options']);var _0x4319a1={'where':_0x1c13dc['where']};return db['MailSubstatus']['count'](_0x4319a1)['then'](function(_0x41b757){_0x4e17ce[_0xac4a('0x1a')]=_0x41b757;if(_0x14832b[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1c13dc[_0xac4a('0x3f')]=[{'all':!![]}];}return db[_0xac4a('0x29')][_0xac4a('0x40')](_0x1c13dc);})[_0xac4a('0x22')](function(_0x28292c){_0x4e17ce[_0xac4a('0x41')]=_0x28292c;return _0x4e17ce;})[_0xac4a('0x22')](respondWithFilteredResult(_0x472c57,_0x1c13dc))[_0xac4a('0x42')](handleError(_0x472c57,null));};exports['show']=function(_0x5086ff,_0x5cd24f){var _0x1e1cc5={'raw':!![],'where':{'id':_0x5086ff[_0xac4a('0x43')]['id']}},_0x5c46a={};_0x5c46a[_0xac4a('0x2c')]=_[_0xac4a('0x2d')](db[_0xac4a('0x29')][_0xac4a('0x2a')]);_0x5c46a[_0xac4a('0x2e')]=_[_0xac4a('0x2d')](_0x5086ff[_0xac4a('0x2e')]);_0x5c46a['filters']=_[_0xac4a('0x30')](_0x5c46a[_0xac4a('0x2c')],_0x5c46a[_0xac4a('0x2e')]);_0x1e1cc5[_0xac4a('0x31')]=_[_0xac4a('0x30')](_0x5c46a['model'],qs[_0xac4a('0x32')](_0x5086ff[_0xac4a('0x2e')]['fields']));_0x1e1cc5[_0xac4a('0x31')]=_0x1e1cc5['attributes'][_0xac4a('0x33')]?_0x1e1cc5[_0xac4a('0x31')]:_0x5c46a[_0xac4a('0x2c')];if(_0x5086ff[_0xac4a('0x2e')][_0xac4a('0x3e')]){_0x1e1cc5[_0xac4a('0x3f')]=[{'all':!![]}];}_0x1e1cc5=_[_0xac4a('0x3b')]({},_0x1e1cc5,_0x5086ff[_0xac4a('0x44')]);return db[_0xac4a('0x29')][_0xac4a('0x45')](_0x1e1cc5)[_0xac4a('0x22')](handleEntityNotFound(_0x5cd24f,null))[_0xac4a('0x22')](respondWithResult(_0x5cd24f,null))['catch'](handleError(_0x5cd24f,null));};exports[_0xac4a('0x46')]=function(_0x41d11d,_0xeca4e9){return db['MailSubstatus'][_0xac4a('0x46')](_0x41d11d[_0xac4a('0x47')],{})['then'](respondWithResult(_0xeca4e9,0xc9))[_0xac4a('0x42')](handleError(_0xeca4e9,null));};exports['update']=function(_0x244950,_0xe620f6){if(_0x244950[_0xac4a('0x47')]['id']){delete _0x244950['body']['id'];}return db['MailSubstatus'][_0xac4a('0x45')]({'where':{'id':_0x244950['params']['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0xe620f6,null))['then'](saveUpdates(_0x244950[_0xac4a('0x47')],null))['then'](respondWithResult(_0xe620f6,null))[_0xac4a('0x42')](handleError(_0xe620f6,null));};exports[_0xac4a('0x48')]=function(_0x424f9b,_0x1c8c39){return db['MailSubstatus'][_0xac4a('0x45')]({'where':{'id':_0x424f9b[_0xac4a('0x43')]['id']}})[_0xac4a('0x22')](handleEntityNotFound(_0x1c8c39,null))[_0xac4a('0x22')](removeEntity(_0x1c8c39,null))[_0xac4a('0x42')](handleError(_0x1c8c39,null));};exports[_0xac4a('0x49')]=function(_0x187306,_0x4e6e19){return db[_0xac4a('0x29')][_0xac4a('0x49')]()['then'](respondWithResult(_0x4e6e19,null))[_0xac4a('0x42')](handleError(_0x4e6e19,null));}; \ No newline at end of file +var _0x5fc3=['sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','params','length','find','create','body','destroy','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','sendStatus','error','stack','name','send','index','MailSubstatus','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x5fc3,0xa8));var _0x35fc=function(_0xb833b1,_0x1c3d3f){_0xb833b1=_0xb833b1-0x0;var _0x1ab87a=_0x5fc3[_0xb833b1];return _0x1ab87a;};'use strict';var pdf=require(_0x35fc('0x0'));var emlformat=require(_0x35fc('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x35fc('0x2'));var jsonpatch=require(_0x35fc('0x3'));var rp=require(_0x35fc('0x4'));var moment=require(_0x35fc('0x5'));var BPromise=require(_0x35fc('0x6'));var Mustache=require('mustache');var util=require(_0x35fc('0x7'));var path=require(_0x35fc('0x8'));var sox=require(_0x35fc('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0xe'));var querystring=require(_0x35fc('0xf'));var Papa=require(_0x35fc('0x10'));var Redis=require(_0x35fc('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x12'));var as=require(_0x35fc('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x14'))(_0x35fc('0x15'));var utils=require('../../config/utils');var config=require(_0x35fc('0x16'));var db=require(_0x35fc('0x17'))['db'];function respondWithStatusCode(_0x5469f5,_0x4cbe74){_0x4cbe74=_0x4cbe74||0xcc;return function(_0x409357){if(_0x409357){return _0x5469f5['sendStatus'](_0x4cbe74);}return _0x5469f5[_0x35fc('0x18')](_0x4cbe74)[_0x35fc('0x19')]();};}function respondWithResult(_0x2a6ad2,_0x29730f){_0x29730f=_0x29730f||0xc8;return function(_0x38d9f2){if(_0x38d9f2){return _0x2a6ad2['status'](_0x29730f)['json'](_0x38d9f2);}};}function respondWithFilteredResult(_0x5eac0f,_0x558364){return function(_0x398b67){if(_0x398b67){var _0x229d56=_0x398b67[_0x35fc('0x1a')],_0x53b898=_0x558364['offset'],_0x154958=_0x558364[_0x35fc('0x1b')]+_0x558364[_0x35fc('0x1c')],_0x227a49;if(_0x154958>=_0x229d56){_0x154958=_0x229d56;_0x227a49=0xc8;}else{_0x227a49=0xce;}_0x5eac0f['status'](_0x227a49);return _0x5eac0f[_0x35fc('0x1d')](_0x35fc('0x1e'),_0x53b898+'-'+_0x154958+'/'+_0x229d56)[_0x35fc('0x1f')](_0x398b67);}return null;};}function patchUpdates(_0x5f56c6){return function(_0x1a86e9){try{jsonpatch[_0x35fc('0x20')](_0x1a86e9,_0x5f56c6,!![]);}catch(_0x465eb3){return BPromise['reject'](_0x465eb3);}return _0x1a86e9[_0x35fc('0x21')]();};}function saveUpdates(_0x350a27,_0x3229d1){return function(_0x251a1f){if(_0x251a1f){return _0x251a1f[_0x35fc('0x22')](_0x350a27)[_0x35fc('0x23')](function(_0x155016){return _0x155016;});}return null;};}function removeEntity(_0x3b05b0,_0x2405e8){return function(_0x427eae){if(_0x427eae){return _0x427eae['destroy']()[_0x35fc('0x23')](function(){_0x3b05b0[_0x35fc('0x18')](0xcc)[_0x35fc('0x19')]();});}};}function handleEntityNotFound(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(!_0x55e9e7){_0x2d8183[_0x35fc('0x24')](0x194);}return _0x55e9e7;};}function handleError(_0x4c587a,_0x561bf8){_0x561bf8=_0x561bf8||0x1f4;return function(_0x265324){logger[_0x35fc('0x25')](_0x265324[_0x35fc('0x26')]);if(_0x265324['name']){delete _0x265324[_0x35fc('0x27')];}_0x4c587a['status'](_0x561bf8)[_0x35fc('0x28')](_0x265324);};}exports[_0x35fc('0x29')]=function(_0x5cb986,_0x519264){var _0x47774c={},_0x58edb6={},_0x274208={'count':0x0,'rows':[]};var _0x1a5d92=_['map'](db[_0x35fc('0x2a')][_0x35fc('0x2b')],function(_0x383837){return{'name':_0x383837[_0x35fc('0x2c')],'type':_0x383837[_0x35fc('0x2d')][_0x35fc('0x2e')]};});_0x58edb6[_0x35fc('0x2f')]=_[_0x35fc('0x30')](_0x1a5d92,'name');_0x58edb6[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x5cb986[_0x35fc('0x31')]);_0x58edb6['filters']=_[_0x35fc('0x33')](_0x58edb6[_0x35fc('0x2f')],_0x58edb6[_0x35fc('0x31')]);_0x47774c[_0x35fc('0x34')]=_[_0x35fc('0x33')](_0x58edb6[_0x35fc('0x2f')],qs[_0x35fc('0x35')](_0x5cb986[_0x35fc('0x31')][_0x35fc('0x35')]));_0x47774c[_0x35fc('0x34')]=_0x47774c['attributes']['length']?_0x47774c[_0x35fc('0x34')]:_0x58edb6['model'];if(!_0x5cb986[_0x35fc('0x31')][_0x35fc('0x36')](_0x35fc('0x37'))){_0x47774c[_0x35fc('0x1c')]=qs[_0x35fc('0x1c')](_0x5cb986[_0x35fc('0x31')]['limit']);_0x47774c[_0x35fc('0x1b')]=qs[_0x35fc('0x1b')](_0x5cb986[_0x35fc('0x31')][_0x35fc('0x1b')]);}_0x47774c[_0x35fc('0x38')]=qs[_0x35fc('0x39')](_0x5cb986['query'][_0x35fc('0x39')]);_0x47774c[_0x35fc('0x3a')]=qs[_0x35fc('0x3b')](_['pick'](_0x5cb986[_0x35fc('0x31')],_0x58edb6['filters']));if(_0x5cb986[_0x35fc('0x31')][_0x35fc('0x3c')]){_0x47774c[_0x35fc('0x3a')]=_[_0x35fc('0x3d')](_0x47774c['where'],{'$or':_['map'](_0x1a5d92,function(_0x59e4fb){if(_0x59e4fb[_0x35fc('0x2d')]!=='VIRTUAL'){var _0x20f8bb={};_0x20f8bb[_0x59e4fb['name']]={'$like':'%'+_0x5cb986[_0x35fc('0x31')][_0x35fc('0x3c')]+'%'};return _0x20f8bb;}})});}_0x47774c=_[_0x35fc('0x3d')]({},_0x47774c,_0x5cb986[_0x35fc('0x3e')]);var _0x1c10e0={'where':_0x47774c[_0x35fc('0x3a')]};return db[_0x35fc('0x2a')]['count'](_0x1c10e0)[_0x35fc('0x23')](function(_0x16087d){_0x274208['count']=_0x16087d;if(_0x5cb986[_0x35fc('0x31')][_0x35fc('0x3f')]){_0x47774c[_0x35fc('0x40')]=[{'all':!![]}];}return db[_0x35fc('0x2a')][_0x35fc('0x41')](_0x47774c);})[_0x35fc('0x23')](function(_0x58f25c){_0x274208[_0x35fc('0x42')]=_0x58f25c;return _0x274208;})[_0x35fc('0x23')](respondWithFilteredResult(_0x519264,_0x47774c))[_0x35fc('0x43')](handleError(_0x519264,null));};exports['show']=function(_0x17821e,_0x350a96){var _0x596919={'raw':!![],'where':{'id':_0x17821e[_0x35fc('0x44')]['id']}},_0x237548={};_0x237548[_0x35fc('0x2f')]=_[_0x35fc('0x32')](db[_0x35fc('0x2a')][_0x35fc('0x2b')]);_0x237548[_0x35fc('0x31')]=_[_0x35fc('0x32')](_0x17821e['query']);_0x237548['filters']=_[_0x35fc('0x33')](_0x237548[_0x35fc('0x2f')],_0x237548['query']);_0x596919['attributes']=_['intersection'](_0x237548[_0x35fc('0x2f')],qs[_0x35fc('0x35')](_0x17821e['query'][_0x35fc('0x35')]));_0x596919[_0x35fc('0x34')]=_0x596919[_0x35fc('0x34')][_0x35fc('0x45')]?_0x596919['attributes']:_0x237548['model'];if(_0x17821e['query']['includeAll']){_0x596919['include']=[{'all':!![]}];}_0x596919=_[_0x35fc('0x3d')]({},_0x596919,_0x17821e[_0x35fc('0x3e')]);return db['MailSubstatus'][_0x35fc('0x46')](_0x596919)['then'](handleEntityNotFound(_0x350a96,null))[_0x35fc('0x23')](respondWithResult(_0x350a96,null))[_0x35fc('0x43')](handleError(_0x350a96,null));};exports[_0x35fc('0x47')]=function(_0x2de5d1,_0x16f7c8){return db['MailSubstatus'][_0x35fc('0x47')](_0x2de5d1[_0x35fc('0x48')],{})['then'](respondWithResult(_0x16f7c8,0xc9))[_0x35fc('0x43')](handleError(_0x16f7c8,null));};exports[_0x35fc('0x22')]=function(_0x2a8a09,_0x211746){if(_0x2a8a09['body']['id']){delete _0x2a8a09[_0x35fc('0x48')]['id'];}return db['MailSubstatus']['find']({'where':{'id':_0x2a8a09[_0x35fc('0x44')]['id']}})[_0x35fc('0x23')](handleEntityNotFound(_0x211746,null))[_0x35fc('0x23')](saveUpdates(_0x2a8a09[_0x35fc('0x48')],null))[_0x35fc('0x23')](respondWithResult(_0x211746,null))[_0x35fc('0x43')](handleError(_0x211746,null));};exports[_0x35fc('0x49')]=function(_0x16afa6,_0x4f555f){return db[_0x35fc('0x2a')][_0x35fc('0x46')]({'where':{'id':_0x16afa6[_0x35fc('0x44')]['id']}})[_0x35fc('0x23')](handleEntityNotFound(_0x4f555f,null))[_0x35fc('0x23')](removeEntity(_0x4f555f,null))[_0x35fc('0x43')](handleError(_0x4f555f,null));};exports[_0x35fc('0x4a')]=function(_0x347a4a,_0x35fb53){return db[_0x35fc('0x2a')][_0x35fc('0x4a')]()[_0x35fc('0x23')](respondWithResult(_0x35fb53,null))[_0x35fc('0x43')](handleError(_0x35fb53,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index c37d32d..95aa408 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 _0x8286=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','MailSubstatus','mail_substatuses','lodash','util'];(function(_0x12e6f9,_0x5c4f03){var _0x1afd27=function(_0x3e01ff){while(--_0x3e01ff){_0x12e6f9['push'](_0x12e6f9['shift']());}};_0x1afd27(++_0x5c4f03);}(_0x8286,0x66));var _0x6828=function(_0xc3182a,_0x5184a4){_0xc3182a=_0xc3182a-0x0;var _0x2759c6=_0x8286[_0xc3182a];return _0x2759c6;};'use strict';var _=require(_0x6828('0x0'));var util=require(_0x6828('0x1'));var logger=require(_0x6828('0x2'))(_0x6828('0x3'));var moment=require(_0x6828('0x4'));var BPromise=require(_0x6828('0x5'));var rp=require(_0x6828('0x6'));var fs=require('fs');var path=require(_0x6828('0x7'));var rimraf=require(_0x6828('0x8'));var config=require(_0x6828('0x9'));var attributes=require(_0x6828('0xa'));module['exports']=function(_0x31c3d0,_0xe4b9bb){return _0x31c3d0['define'](_0x6828('0xb'),attributes,{'tableName':_0x6828('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x896e=['request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','define','MailSubstatus','mail_substatuses','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1acdb3,_0x243849){var _0x2d3e77=function(_0x84de77){while(--_0x84de77){_0x1acdb3['push'](_0x1acdb3['shift']());}};_0x2d3e77(++_0x243849);}(_0x896e,0x1e9));var _0xe896=function(_0x38290a,_0x528943){_0x38290a=_0x38290a-0x0;var _0x35f9c9=_0x896e[_0x38290a];return _0x35f9c9;};'use strict';var _=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var logger=require(_0xe896('0x2'))(_0xe896('0x3'));var moment=require(_0xe896('0x4'));var BPromise=require(_0xe896('0x5'));var rp=require(_0xe896('0x6'));var fs=require('fs');var path=require(_0xe896('0x7'));var rimraf=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var attributes=require(_0xe896('0xa'));module[_0xe896('0xb')]=function(_0x52ac80,_0x24c430){return _0x52ac80[_0xe896('0xc')](_0xe896('0xd'),attributes,{'tableName':_0xe896('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index 4504a72..18027b7 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 _0x55e0=['lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','error','code','message','result','catch'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x55e0,0xdc));var _0x055e=function(_0x3fae29,_0x3d65b5){_0x3fae29=_0x3fae29-0x0;var _0x200226=_0x55e0[_0x3fae29];return _0x200226;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var moment=require(_0x055e('0x2'));var BPromise=require(_0x055e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x055e('0x4'))['db'];var utils=require(_0x055e('0x5'));var logger=require(_0x055e('0x6'))(_0x055e('0x7'));var config=require(_0x055e('0x8'));var jayson=require(_0x055e('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4384ff,_0x4a442e,_0x8e7824){return new BPromise(function(_0x3c4cf,_0x376618){return client[_0x055e('0xa')](_0x4384ff,_0x8e7824)[_0x055e('0xb')](function(_0x49540c){logger[_0x055e('0xc')](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));logger[_0x055e('0xf')](_0x055e('0x10'),_0x4a442e,'request\x20sent',JSON['stringify'](_0x49540c));if(_0x49540c[_0x055e('0x11')]){if(_0x49540c['error'][_0x055e('0x12')]===0x1f4){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x376618(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}logger['error'](_0x055e('0xd'),_0x4a442e,_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);return _0x3c4cf(_0x49540c[_0x055e('0x11')][_0x055e('0x13')]);}else{logger['info'](_0x055e('0xd'),_0x4a442e,_0x055e('0xe'));_0x3c4cf(_0x49540c[_0x055e('0x14')]['message']);}})[_0x055e('0x15')](function(_0x2c377c){logger[_0x055e('0x11')](_0x055e('0xd'),_0x4a442e,_0x2c377c);_0x376618(_0x2c377c);});});} \ No newline at end of file +var _0x153f=['message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x4d3f3e,_0x4ef8a8){var _0x3cacd4=function(_0x3da68e){while(--_0x3da68e){_0x4d3f3e['push'](_0x4d3f3e['shift']());}};_0x3cacd4(++_0x4ef8a8);}(_0x153f,0x15b));var _0xf153=function(_0x4f8cca,_0x3de0f1){_0x4f8cca=_0x4f8cca-0x0;var _0x211368=_0x153f[_0x4f8cca];return _0x211368;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 895c1e2..57740f1 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 _0x7a3c=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','destroy','multer'];(function(_0x2e58c7,_0x23d092){var _0x26eb00=function(_0x343124){while(--_0x343124){_0x2e58c7['push'](_0x2e58c7['shift']());}};_0x26eb00(++_0x23d092);}(_0x7a3c,0x1e5));var _0xc7a3=function(_0x1980d1,_0x2e3d5d){_0x1980d1=_0x1980d1-0x0;var _0x3f2f0a=_0x7a3c[_0x1980d1];return _0x3f2f0a;};'use strict';var multer=require(_0xc7a3('0x0'));var util=require('util');var path=require(_0xc7a3('0x1'));var timeout=require(_0xc7a3('0x2'));var express=require(_0xc7a3('0x3'));var router=express[_0xc7a3('0x4')]();var auth=require(_0xc7a3('0x5'));var interaction=require(_0xc7a3('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0xc7a3('0x7')](),controller[_0xc7a3('0x8')]);router[_0xc7a3('0x9')](_0xc7a3('0xa'),auth[_0xc7a3('0x7')](),controller[_0xc7a3('0xb')]);router[_0xc7a3('0x9')](_0xc7a3('0xc'),auth[_0xc7a3('0x7')](),controller['show']);router['post']('/',auth[_0xc7a3('0x7')](),controller[_0xc7a3('0xd')]);router[_0xc7a3('0xe')]('/:id',auth[_0xc7a3('0x7')](),controller[_0xc7a3('0xf')]);router[_0xc7a3('0x10')](_0xc7a3('0xc'),auth['isAuthenticated'](),controller[_0xc7a3('0x11')]);module['exports']=router; \ No newline at end of file +var _0xb973=['isAuthenticated','index','/:id','show','put','update','delete','multer','util','path','connect-timeout','express','../../components/interaction/service','./mailTransferReport.controller','get'];(function(_0x4ec613,_0x4db894){var _0x4100f6=function(_0x4e9810){while(--_0x4e9810){_0x4ec613['push'](_0x4ec613['shift']());}};_0x4100f6(++_0x4db894);}(_0xb973,0x9d));var _0x3b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb973[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x3b97('0x0'));var util=require(_0x3b97('0x1'));var path=require(_0x3b97('0x2'));var timeout=require(_0x3b97('0x3'));var express=require(_0x3b97('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x3b97('0x5'));var config=require('../../config/environment');var controller=require(_0x3b97('0x6'));router[_0x3b97('0x7')]('/',auth[_0x3b97('0x8')](),controller[_0x3b97('0x9')]);router[_0x3b97('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x3b97('0x7')](_0x3b97('0xa'),auth['isAuthenticated'](),controller[_0x3b97('0xb')]);router['post']('/',auth[_0x3b97('0x8')](),controller['create']);router[_0x3b97('0xc')](_0x3b97('0xa'),auth[_0x3b97('0x8')](),controller[_0x3b97('0xd')]);router[_0x3b97('0xe')](_0x3b97('0xa'),auth[_0x3b97('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index e11c377..366b1f0 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 _0x20b1=['queue','DATE','NOW','moment','exports','STRING','account','agent'];(function(_0x2c3376,_0x2fff50){var _0x392313=function(_0xe1bca6){while(--_0xe1bca6){_0x2c3376['push'](_0x2c3376['shift']());}};_0x392313(++_0x2fff50);}(_0x20b1,0x1eb));var _0x120b=function(_0x40d62f,_0x4eda1d){_0x40d62f=_0x40d62f-0x0;var _0x5637c1=_0x20b1[_0x40d62f];return _0x5637c1;};'use strict';var moment=require(_0x120b('0x0'));var Sequelize=require('sequelize');module[_0x120b('0x1')]={'uniqueid':{'type':Sequelize[_0x120b('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x120b('0x3'),_0x120b('0x4'),_0x120b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0x120b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x120b('0x7')]}}; \ No newline at end of file +var _0x8604=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x5d88c0,_0x5d7d83){var _0x1b40f0=function(_0x3fde10){while(--_0x3fde10){_0x5d88c0['push'](_0x5d88c0['shift']());}};_0x1b40f0(++_0x5d7d83);}(_0x8604,0x1be));var _0x4860=function(_0x3407be,_0x3ad78b){_0x3407be=_0x3407be-0x0;var _0x1743e2=_0x8604[_0x3407be];return _0x1743e2;};'use strict';var moment=require(_0x4860('0x0'));var Sequelize=require(_0x4860('0x1'));module[_0x4860('0x2')]={'uniqueid':{'type':Sequelize[_0x4860('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x4860('0x4'),_0x4860('0x5'),_0x4860('0x6')),'allowNull':![],'defaultValue':_0x4860('0x6')},'transferredAt':{'type':Sequelize[_0x4860('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x4860('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 2c335a3..05d07a9 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 _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0xeba0ba,_0x24052d){var _0x3e2fbe=function(_0x5ed6d1){while(--_0x5ed6d1){_0xeba0ba['push'](_0xeba0ba['shift']());}};_0x3e2fbe(++_0x24052d);}(_0x7a54,0x106));var _0x47a5=function(_0x362691,_0x49f56c){_0x362691=_0x362691-0x0;var _0x13b24e=_0x7a54[_0x362691];return _0x13b24e;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file +var _0x7a54=['Content-Range','apply','reject','save','then','destroy','sendStatus','error','name','send','map','MailTransferReport','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','count','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','update','describe','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','set'];(function(_0x2560ba,_0x348654){var _0x11b7e6=function(_0x3c1e56){while(--_0x3c1e56){_0x2560ba['push'](_0x2560ba['shift']());}};_0x11b7e6(++_0x348654);}(_0x7a54,0x106));var _0x47a5=function(_0xc8011a,_0x2a6792){_0xc8011a=_0xc8011a-0x0;var _0x7db7f6=_0x7a54[_0xc8011a];return _0x7db7f6;};'use strict';var pdf=require(_0x47a5('0x0'));var emlformat=require(_0x47a5('0x1'));var rimraf=require(_0x47a5('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x47a5('0x3'));var rp=require(_0x47a5('0x4'));var moment=require('moment');var BPromise=require(_0x47a5('0x5'));var Mustache=require(_0x47a5('0x6'));var util=require(_0x47a5('0x7'));var path=require(_0x47a5('0x8'));var sox=require(_0x47a5('0x9'));var csv=require('to-csv');var ejs=require(_0x47a5('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var db=require(_0x47a5('0x14'))['db'];function respondWithStatusCode(_0xd612dd,_0xd308b8){_0xd308b8=_0xd308b8||0xcc;return function(_0x1eae59){if(_0x1eae59){return _0xd612dd['sendStatus'](_0xd308b8);}return _0xd612dd[_0x47a5('0x15')](_0xd308b8)[_0x47a5('0x16')]();};}function respondWithResult(_0x1cf309,_0x711793){_0x711793=_0x711793||0xc8;return function(_0x139f25){if(_0x139f25){return _0x1cf309[_0x47a5('0x15')](_0x711793)[_0x47a5('0x17')](_0x139f25);}};}function respondWithFilteredResult(_0x190faa,_0x4e99a8){return function(_0x362359){if(_0x362359){var _0x11faf5=_0x362359['count'],_0x3b001e=_0x4e99a8['offset'],_0x2a2cbb=_0x4e99a8[_0x47a5('0x18')]+_0x4e99a8['limit'],_0x1ef44c;if(_0x2a2cbb>=_0x11faf5){_0x2a2cbb=_0x11faf5;_0x1ef44c=0xc8;}else{_0x1ef44c=0xce;}_0x190faa['status'](_0x1ef44c);return _0x190faa[_0x47a5('0x19')](_0x47a5('0x1a'),_0x3b001e+'-'+_0x2a2cbb+'/'+_0x11faf5)[_0x47a5('0x17')](_0x362359);}return null;};}function patchUpdates(_0x1ef371){return function(_0x477b1d){try{jsonpatch[_0x47a5('0x1b')](_0x477b1d,_0x1ef371,!![]);}catch(_0x2763d6){return BPromise[_0x47a5('0x1c')](_0x2763d6);}return _0x477b1d[_0x47a5('0x1d')]();};}function saveUpdates(_0x4a9fcb,_0x1570bc){return function(_0xf160ba){if(_0xf160ba){return _0xf160ba['update'](_0x4a9fcb)[_0x47a5('0x1e')](function(_0x1f03f7){return _0x1f03f7;});}return null;};}function removeEntity(_0x36874d,_0x4c5910){return function(_0xb8ae6c){if(_0xb8ae6c){return _0xb8ae6c[_0x47a5('0x1f')]()[_0x47a5('0x1e')](function(){_0x36874d[_0x47a5('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe2dea9,_0x385687){return function(_0x513981){if(!_0x513981){_0xe2dea9[_0x47a5('0x20')](0x194);}return _0x513981;};}function handleError(_0xc4cd63,_0x4437f1){_0x4437f1=_0x4437f1||0x1f4;return function(_0x129ce5){logger[_0x47a5('0x21')](_0x129ce5['stack']);if(_0x129ce5['name']){delete _0x129ce5[_0x47a5('0x22')];}_0xc4cd63['status'](_0x4437f1)[_0x47a5('0x23')](_0x129ce5);};}exports['index']=function(_0x23cb77,_0x378208){var _0x36ad34={},_0x1dac65={},_0x21f296={'count':0x0,'rows':[]};var _0x3ba0b7=_[_0x47a5('0x24')](db[_0x47a5('0x25')][_0x47a5('0x26')],function(_0x361bfa){return{'name':_0x361bfa[_0x47a5('0x27')],'type':_0x361bfa[_0x47a5('0x28')][_0x47a5('0x29')]};});_0x1dac65['model']=_[_0x47a5('0x24')](_0x3ba0b7,'name');_0x1dac65[_0x47a5('0x2a')]=_[_0x47a5('0x2b')](_0x23cb77[_0x47a5('0x2a')]);_0x1dac65['filters']=_[_0x47a5('0x2c')](_0x1dac65[_0x47a5('0x2d')],_0x1dac65[_0x47a5('0x2a')]);_0x36ad34[_0x47a5('0x2e')]=_['intersection'](_0x1dac65['model'],qs[_0x47a5('0x2f')](_0x23cb77[_0x47a5('0x2a')]['fields']));_0x36ad34['attributes']=_0x36ad34[_0x47a5('0x2e')][_0x47a5('0x30')]?_0x36ad34['attributes']:_0x1dac65[_0x47a5('0x2d')];if(!_0x23cb77['query'][_0x47a5('0x31')](_0x47a5('0x32'))){_0x36ad34['limit']=qs['limit'](_0x23cb77[_0x47a5('0x2a')]['limit']);_0x36ad34[_0x47a5('0x18')]=qs[_0x47a5('0x18')](_0x23cb77[_0x47a5('0x2a')]['offset']);}_0x36ad34[_0x47a5('0x33')]=qs['sort'](_0x23cb77['query'][_0x47a5('0x34')]);_0x36ad34['where']=qs[_0x47a5('0x35')](_['pick'](_0x23cb77[_0x47a5('0x2a')],_0x1dac65[_0x47a5('0x35')]));if(_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]){_0x36ad34[_0x47a5('0x37')]=_[_0x47a5('0x38')](_0x36ad34[_0x47a5('0x37')],{'$or':_[_0x47a5('0x24')](_0x3ba0b7,function(_0x1a0d23){if(_0x1a0d23['type']!==_0x47a5('0x39')){var _0x10f136={};_0x10f136[_0x1a0d23['name']]={'$like':'%'+_0x23cb77[_0x47a5('0x2a')][_0x47a5('0x36')]+'%'};return _0x10f136;}})});}_0x36ad34=_[_0x47a5('0x38')]({},_0x36ad34,_0x23cb77['options']);var _0x101f70={'where':_0x36ad34[_0x47a5('0x37')]};return db['MailTransferReport'][_0x47a5('0x3a')](_0x101f70)[_0x47a5('0x1e')](function(_0x54ae35){_0x21f296['count']=_0x54ae35;if(_0x23cb77['query'][_0x47a5('0x3b')]){_0x36ad34['include']=[{'all':!![]}];}return db[_0x47a5('0x25')][_0x47a5('0x3c')](_0x36ad34);})[_0x47a5('0x1e')](function(_0x111f0d){_0x21f296[_0x47a5('0x3d')]=_0x111f0d;return _0x21f296;})[_0x47a5('0x1e')](respondWithFilteredResult(_0x378208,_0x36ad34))[_0x47a5('0x3e')](handleError(_0x378208,null));};exports[_0x47a5('0x3f')]=function(_0x3fa2a8,_0x36a24e){var _0x280500={'raw':!![],'where':{'id':_0x3fa2a8[_0x47a5('0x40')]['id']}},_0x1658e8={};_0x1658e8['model']=_[_0x47a5('0x2b')](db[_0x47a5('0x25')][_0x47a5('0x26')]);_0x1658e8[_0x47a5('0x2a')]=_['keys'](_0x3fa2a8[_0x47a5('0x2a')]);_0x1658e8['filters']=_['intersection'](_0x1658e8['model'],_0x1658e8['query']);_0x280500[_0x47a5('0x2e')]=_['intersection'](_0x1658e8[_0x47a5('0x2d')],qs[_0x47a5('0x2f')](_0x3fa2a8[_0x47a5('0x2a')]['fields']));_0x280500[_0x47a5('0x2e')]=_0x280500[_0x47a5('0x2e')]['length']?_0x280500['attributes']:_0x1658e8[_0x47a5('0x2d')];if(_0x3fa2a8['query'][_0x47a5('0x3b')]){_0x280500[_0x47a5('0x41')]=[{'all':!![]}];}_0x280500=_[_0x47a5('0x38')]({},_0x280500,_0x3fa2a8[_0x47a5('0x42')]);return db[_0x47a5('0x25')][_0x47a5('0x43')](_0x280500)[_0x47a5('0x1e')](handleEntityNotFound(_0x36a24e,null))[_0x47a5('0x1e')](respondWithResult(_0x36a24e,null))[_0x47a5('0x3e')](handleError(_0x36a24e,null));};exports[_0x47a5('0x44')]=function(_0x24ecb1,_0x3c3ebf){return db[_0x47a5('0x25')][_0x47a5('0x44')](_0x24ecb1[_0x47a5('0x45')],{})[_0x47a5('0x1e')](respondWithResult(_0x3c3ebf,0xc9))['catch'](handleError(_0x3c3ebf,null));};exports[_0x47a5('0x46')]=function(_0x23bb04,_0x49eab1){if(_0x23bb04['body']['id']){delete _0x23bb04[_0x47a5('0x45')]['id'];}return db['MailTransferReport'][_0x47a5('0x43')]({'where':{'id':_0x23bb04[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x49eab1,null))['then'](saveUpdates(_0x23bb04[_0x47a5('0x45')],null))['then'](respondWithResult(_0x49eab1,null))[_0x47a5('0x3e')](handleError(_0x49eab1,null));};exports[_0x47a5('0x1f')]=function(_0x3548bc,_0x3e12a7){return db[_0x47a5('0x25')][_0x47a5('0x43')]({'where':{'id':_0x3548bc[_0x47a5('0x40')]['id']}})['then'](handleEntityNotFound(_0x3e12a7,null))['then'](removeEntity(_0x3e12a7,null))[_0x47a5('0x3e')](handleError(_0x3e12a7,null));};exports[_0x47a5('0x47')]=function(_0x1163e3,_0x9ea93e){return db[_0x47a5('0x25')][_0x47a5('0x47')]()[_0x47a5('0x1e')](respondWithResult(_0x9ea93e,null))['catch'](handleError(_0x9ea93e,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index b9095be..159251a 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 _0x9067=['rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x468e5f,_0x3a8f25){var _0x3b0afa=function(_0x1cde2c){while(--_0x1cde2c){_0x468e5f['push'](_0x468e5f['shift']());}};_0x3b0afa(++_0x3a8f25);}(_0x9067,0x19e));var _0x7906=function(_0x473d7a,_0x5623d9){_0x473d7a=_0x473d7a-0x0;var _0x1aba20=_0x9067[_0x473d7a];return _0x1aba20;};'use strict';var _=require(_0x7906('0x0'));var util=require(_0x7906('0x1'));var logger=require(_0x7906('0x2'))(_0x7906('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7906('0x4'));var config=require(_0x7906('0x5'));var attributes=require(_0x7906('0x6'));module[_0x7906('0x7')]=function(_0x2bb20d,_0x1f0416){return _0x2bb20d[_0x7906('0x8')]('MailTransferReport',attributes,{'tableName':_0x7906('0x9'),'paranoid':![],'indexes':[{'name':_0x7906('0xa'),'fields':[_0x7906('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf629=['path','./mailTransferReport.attributes','MailTransferReport','report_mail_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise'];(function(_0xe37f58,_0x1a167b){var _0x4dfcef=function(_0x3395b8){while(--_0x3395b8){_0xe37f58['push'](_0xe37f58['shift']());}};_0x4dfcef(++_0x1a167b);}(_0xf629,0xd7));var _0x9f62=function(_0x405db0,_0x17639e){_0x405db0=_0x405db0-0x0;var _0x5a278c=_0xf629[_0x405db0];return _0x5a278c;};'use strict';var _=require(_0x9f62('0x0'));var util=require('util');var logger=require(_0x9f62('0x1'))('api');var moment=require(_0x9f62('0x2'));var BPromise=require(_0x9f62('0x3'));var rp=require(_0x9f62('0x4'));var fs=require('fs');var path=require(_0x9f62('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9f62('0x6'));module['exports']=function(_0x50c6f0,_0x1f2980){return _0x50c6f0['define'](_0x9f62('0x7'),attributes,{'tableName':_0x9f62('0x8'),'paranoid':![],'indexes':[{'name':_0x9f62('0x9'),'fields':[_0x9f62('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index d0967ab..eb97497 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 _0x6dd1=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x6dd1,0x180));var _0x16dd=function(_0x244679,_0x3ea89c){_0x244679=_0x244679-0x0;var _0x285508=_0x6dd1[_0x244679];return _0x285508;};'use strict';var _=require(_0x16dd('0x0'));var util=require(_0x16dd('0x1'));var moment=require(_0x16dd('0x2'));var BPromise=require(_0x16dd('0x3'));var rs=require(_0x16dd('0x4'));var fs=require('fs');var Redis=require(_0x16dd('0x5'));var db=require(_0x16dd('0x6'))['db'];var utils=require(_0x16dd('0x7'));var logger=require(_0x16dd('0x8'))(_0x16dd('0x9'));var config=require(_0x16dd('0xa'));var jayson=require('jayson/promise');var client=jayson[_0x16dd('0xb')][_0x16dd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x36cf39,_0x516052,_0x303e34){return new BPromise(function(_0xb34d03,_0x4874be){return client[_0x16dd('0xd')](_0x36cf39,_0x303e34)['then'](function(_0x1c4ec4){logger[_0x16dd('0xe')](_0x16dd('0xf'),_0x516052,_0x16dd('0x10'));logger[_0x16dd('0x11')](_0x16dd('0x12'),_0x516052,_0x16dd('0x10'),JSON[_0x16dd('0x13')](_0x1c4ec4));if(_0x1c4ec4['error']){if(_0x1c4ec4[_0x16dd('0x14')]['code']===0x1f4){logger[_0x16dd('0x14')](_0x16dd('0xf'),_0x516052,_0x1c4ec4[_0x16dd('0x14')][_0x16dd('0x15')]);return _0x4874be(_0x1c4ec4[_0x16dd('0x14')]['message']);}logger['error']('MailTransferReport,\x20%s,\x20%s',_0x516052,_0x1c4ec4[_0x16dd('0x14')][_0x16dd('0x15')]);return _0xb34d03(_0x1c4ec4[_0x16dd('0x14')][_0x16dd('0x15')]);}else{logger[_0x16dd('0xe')](_0x16dd('0xf'),_0x516052,'request\x20sent');_0xb34d03(_0x1c4ec4[_0x16dd('0x16')][_0x16dd('0x15')]);}})[_0x16dd('0x17')](function(_0x3515c2){logger[_0x16dd('0x14')](_0x16dd('0xf'),_0x516052,_0x3515c2);_0x4874be(_0x3515c2);});});} \ No newline at end of file +var _0xf323=['randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','moment'];(function(_0xa330fd,_0x13e83d){var _0x133ca3=function(_0x5ed3af){while(--_0x5ed3af){_0xa330fd['push'](_0xa330fd['shift']());}};_0x133ca3(++_0x13e83d);}(_0xf323,0xef));var _0x3f32=function(_0x4fb1e6,_0x4dd6e5){_0x4fb1e6=_0x4fb1e6-0x0;var _0x5e0030=_0xf323[_0x4fb1e6];return _0x5e0030;};'use strict';var _=require(_0x3f32('0x0'));var util=require(_0x3f32('0x1'));var moment=require(_0x3f32('0x2'));var BPromise=require('bluebird');var rs=require(_0x3f32('0x3'));var fs=require('fs');var Redis=require(_0x3f32('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3f32('0x5'));var logger=require(_0x3f32('0x6'))(_0x3f32('0x7'));var config=require(_0x3f32('0x8'));var jayson=require(_0x3f32('0x9'));var client=jayson[_0x3f32('0xa')][_0x3f32('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x594bed,_0x2ff84f,_0x84fae){return new BPromise(function(_0x79c5e7,_0x91264b){return client[_0x3f32('0xc')](_0x594bed,_0x84fae)[_0x3f32('0xd')](function(_0x383d09){logger[_0x3f32('0xe')](_0x3f32('0xf'),_0x2ff84f,'request\x20sent');logger[_0x3f32('0x10')](_0x3f32('0x11'),_0x2ff84f,_0x3f32('0x12'),JSON['stringify'](_0x383d09));if(_0x383d09[_0x3f32('0x13')]){if(_0x383d09[_0x3f32('0x13')]['code']===0x1f4){logger[_0x3f32('0x13')]('MailTransferReport,\x20%s,\x20%s',_0x2ff84f,_0x383d09[_0x3f32('0x13')]['message']);return _0x91264b(_0x383d09[_0x3f32('0x13')]['message']);}logger[_0x3f32('0x13')](_0x3f32('0xf'),_0x2ff84f,_0x383d09[_0x3f32('0x13')][_0x3f32('0x14')]);return _0x79c5e7(_0x383d09[_0x3f32('0x13')]['message']);}else{logger[_0x3f32('0xe')](_0x3f32('0xf'),_0x2ff84f,'request\x20sent');_0x79c5e7(_0x383d09[_0x3f32('0x15')]['message']);}})['catch'](function(_0x11622d){logger[_0x3f32('0x13')](_0x3f32('0xf'),_0x2ff84f,_0x11622d);_0x91264b(_0x11622d);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 68ecc5c..b07e82c 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 _0xad9c=['get','isAuthenticated','index','/describe','show','post','create','/:id','update','delete','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./memberReport.controller'];(function(_0x169564,_0x3d3962){var _0x27a0b7=function(_0x57feb3){while(--_0x57feb3){_0x169564['push'](_0x169564['shift']());}};_0x27a0b7(++_0x3d3962);}(_0xad9c,0xad));var _0xcad9=function(_0x10daff,_0x27c559){_0x10daff=_0x10daff-0x0;var _0x16941d=_0xad9c[_0x10daff];return _0x16941d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xcad9('0x0'));var timeout=require(_0xcad9('0x1'));var express=require('express');var router=express[_0xcad9('0x2')]();var auth=require(_0xcad9('0x3'));var interaction=require(_0xcad9('0x4'));var config=require(_0xcad9('0x5'));var controller=require(_0xcad9('0x6'));router[_0xcad9('0x7')]('/',auth[_0xcad9('0x8')](),controller[_0xcad9('0x9')]);router[_0xcad9('0x7')](_0xcad9('0xa'),auth[_0xcad9('0x8')](),controller['describe']);router[_0xcad9('0x7')]('/:id',auth[_0xcad9('0x8')](),controller[_0xcad9('0xb')]);router[_0xcad9('0xc')]('/',auth[_0xcad9('0x8')](),controller[_0xcad9('0xd')]);router['put'](_0xcad9('0xe'),auth[_0xcad9('0x8')](),controller[_0xcad9('0xf')]);router[_0xcad9('0x10')](_0xcad9('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0xcad9('0x11')]=router; \ No newline at end of file +var _0x1e0e=['isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','../../components/interaction/service','./memberReport.controller','get'];(function(_0x37d80a,_0x591a57){var _0x422741=function(_0x2651bc){while(--_0x2651bc){_0x37d80a['push'](_0x37d80a['shift']());}};_0x422741(++_0x591a57);}(_0x1e0e,0x128));var _0xe1e0=function(_0x5433bc,_0xcfa0e7){_0x5433bc=_0x5433bc-0x0;var _0x50a029=_0x1e0e[_0x5433bc];return _0x50a029;};'use strict';var multer=require(_0xe1e0('0x0'));var util=require(_0xe1e0('0x1'));var path=require(_0xe1e0('0x2'));var timeout=require(_0xe1e0('0x3'));var express=require(_0xe1e0('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xe1e0('0x5'));var config=require('../../config/environment');var controller=require(_0xe1e0('0x6'));router[_0xe1e0('0x7')]('/',auth[_0xe1e0('0x8')](),controller['index']);router[_0xe1e0('0x7')](_0xe1e0('0x9'),auth[_0xe1e0('0x8')](),controller[_0xe1e0('0xa')]);router[_0xe1e0('0x7')](_0xe1e0('0xb'),auth[_0xe1e0('0x8')](),controller[_0xe1e0('0xc')]);router[_0xe1e0('0xd')]('/',auth[_0xe1e0('0x8')](),controller[_0xe1e0('0xe')]);router[_0xe1e0('0xf')](_0xe1e0('0xb'),auth[_0xe1e0('0x8')](),controller[_0xe1e0('0x10')]);router[_0xe1e0('0x11')]('/:id',auth['isAuthenticated'](),controller[_0xe1e0('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index c8d303c..ff4bd8b 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 _0xb62e=['talk:[queue]','sequelize','moment','exports','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','seconds','setDataValue','exitAt','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb62e,0x100));var _0xeb62=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb62e[_0x397e5f];return _0x5302b8;};'use strict';var Sequelize=require(_0xeb62('0x0'));var moment=require(_0xeb62('0x1'));module[_0xeb62('0x2')]={'channel':{'type':Sequelize[_0xeb62('0x3')]},'membername':{'type':Sequelize[_0xeb62('0x3')]},'interface':{'type':Sequelize[_0xeb62('0x3')]},'type':{'type':Sequelize['STRING'],'defaultValue':_0xeb62('0x4'),'comment':_0xeb62('0x5')},'duration':{'type':Sequelize[_0xeb62('0x6')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x3aa584){var _0x122c54=moment(_0x3aa584);var _0x35fdce=moment(this[_0xeb62('0x7')](_0xeb62('0x8')));var _0x494a46=_0x122c54['diff'](_0x35fdce,_0xeb62('0x9'));this[_0xeb62('0xa')](_0xeb62('0xb'),_0x3aa584);this['setDataValue']('duration',_0x494a46||null);}},'data1':{'type':Sequelize[_0xeb62('0x3')],'comment':_0xeb62('0xc')},'data2':{'type':Sequelize[_0xeb62('0x3')],'comment':_0xeb62('0xd')},'data3':{'type':Sequelize[_0xeb62('0x3')],'comment':_0xeb62('0xe')},'data4':{'type':Sequelize[_0xeb62('0x3')],'comment':_0xeb62('0xf')},'data5':{'type':Sequelize['STRING'],'comment':_0xeb62('0x10')},'role':{'type':Sequelize['STRING']},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xeb62('0x3')]}}; \ No newline at end of file +var _0xa06c=['diff','seconds','setDataValue','duration','talk:[destination]','talk:[queue]','moment','exports','STRING','DEFAULT\x20PAUSE','INTEGER','DATE','getDataValue','enterAt'];(function(_0x51f1b2,_0x4cb0af){var _0x104b67=function(_0x412411){while(--_0x412411){_0x51f1b2['push'](_0x51f1b2['shift']());}};_0x104b67(++_0x4cb0af);}(_0xa06c,0x1e2));var _0xca06=function(_0x1779a4,_0x1f8946){_0x1779a4=_0x1779a4-0x0;var _0x448a8b=_0xa06c[_0x1779a4];return _0x448a8b;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xca06('0x0'));module[_0xca06('0x1')]={'channel':{'type':Sequelize[_0xca06('0x2')]},'membername':{'type':Sequelize[_0xca06('0x2')]},'interface':{'type':Sequelize[_0xca06('0x2')]},'type':{'type':Sequelize[_0xca06('0x2')],'defaultValue':_0xca06('0x3'),'comment':'LOGIN,\x20PAUSE,\x20TALKING'},'duration':{'type':Sequelize[_0xca06('0x4')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xca06('0x5')],'set':function(_0x8b1907){var _0x2a9580=moment(_0x8b1907);var _0x165d1c=moment(this[_0xca06('0x6')](_0xca06('0x7')));var _0x5a80f6=_0x2a9580[_0xca06('0x8')](_0x165d1c,_0xca06('0x9'));this[_0xca06('0xa')]('exitAt',_0x8b1907);this[_0xca06('0xa')](_0xca06('0xb'),_0x5a80f6||null);}},'data1':{'type':Sequelize[_0xca06('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':'talk:[start]'},'data3':{'type':Sequelize['STRING'],'comment':_0xca06('0xc')},'data4':{'type':Sequelize['STRING'],'comment':'talk:[dial\x20string]'},'data5':{'type':Sequelize[_0xca06('0x2')],'comment':_0xca06('0xd')},'role':{'type':Sequelize[_0xca06('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 4b63f4c..8c2526d 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 _0x77ec=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','MemberReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','count','includeAll','include','findAll','rows','fields','options','catch','create','body','find','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x1e567d,_0x10e8fb){var _0x579841=function(_0x47e3f3){while(--_0x47e3f3){_0x1e567d['push'](_0x1e567d['shift']());}};_0x579841(++_0x10e8fb);}(_0x77ec,0x179));var _0xc77e=function(_0x405bb4,_0x4421ec){_0x405bb4=_0x405bb4-0x0;var _0x23fac0=_0x77ec[_0x405bb4];return _0x23fac0;};'use strict';var pdf=require(_0xc77e('0x0'));var emlformat=require(_0xc77e('0x1'));var rimraf=require(_0xc77e('0x2'));var zipdir=require(_0xc77e('0x3'));var jsonpatch=require(_0xc77e('0x4'));var rp=require(_0xc77e('0x5'));var moment=require(_0xc77e('0x6'));var BPromise=require(_0xc77e('0x7'));var Mustache=require(_0xc77e('0x8'));var util=require('util');var path=require('path');var sox=require(_0xc77e('0x9'));var csv=require(_0xc77e('0xa'));var ejs=require(_0xc77e('0xb'));var fs=require('fs');var _=require(_0xc77e('0xc'));var squel=require(_0xc77e('0xd'));var crypto=require(_0xc77e('0xe'));var jsforce=require(_0xc77e('0xf'));var deskjs=require(_0xc77e('0x10'));var toCsv=require('to-csv');var querystring=require(_0xc77e('0x11'));var Papa=require(_0xc77e('0x12'));var Redis=require(_0xc77e('0x13'));var authService=require(_0xc77e('0x14'));var qs=require(_0xc77e('0x15'));var as=require(_0xc77e('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc77e('0x17'))(_0xc77e('0x18'));var utils=require(_0xc77e('0x19'));var config=require(_0xc77e('0x1a'));var db=require(_0xc77e('0x1b'))['db'];function respondWithStatusCode(_0x49c545,_0x173938){_0x173938=_0x173938||0xcc;return function(_0x33e8e6){if(_0x33e8e6){return _0x49c545[_0xc77e('0x1c')](_0x173938);}return _0x49c545['status'](_0x173938)[_0xc77e('0x1d')]();};}function respondWithResult(_0x5eafd3,_0x121a51){_0x121a51=_0x121a51||0xc8;return function(_0x2eb8e2){if(_0x2eb8e2){return _0x5eafd3[_0xc77e('0x1e')](_0x121a51)[_0xc77e('0x1f')](_0x2eb8e2);}};}function respondWithFilteredResult(_0x46968a,_0x1df10e){return function(_0x49bf2b){if(_0x49bf2b){var _0x15c6c4=_0x49bf2b['count'],_0x29c507=_0x1df10e[_0xc77e('0x20')],_0x8c3491=_0x1df10e[_0xc77e('0x20')]+_0x1df10e[_0xc77e('0x21')],_0xf268d2;if(_0x8c3491>=_0x15c6c4){_0x8c3491=_0x15c6c4;_0xf268d2=0xc8;}else{_0xf268d2=0xce;}_0x46968a[_0xc77e('0x1e')](_0xf268d2);return _0x46968a[_0xc77e('0x22')](_0xc77e('0x23'),_0x29c507+'-'+_0x8c3491+'/'+_0x15c6c4)[_0xc77e('0x1f')](_0x49bf2b);}return null;};}function patchUpdates(_0x9f2c24){return function(_0x3ae06f){try{jsonpatch[_0xc77e('0x24')](_0x3ae06f,_0x9f2c24,!![]);}catch(_0x485500){return BPromise[_0xc77e('0x25')](_0x485500);}return _0x3ae06f[_0xc77e('0x26')]();};}function saveUpdates(_0x5261ba,_0x1d09b4){return function(_0x4d2742){if(_0x4d2742){return _0x4d2742['update'](_0x5261ba)[_0xc77e('0x27')](function(_0x1c464e){return _0x1c464e;});}return null;};}function removeEntity(_0x19d54a,_0x48d3d4){return function(_0xd51e7f){if(_0xd51e7f){return _0xd51e7f[_0xc77e('0x28')]()[_0xc77e('0x27')](function(){_0x19d54a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d4e11,_0x34427d){return function(_0x58541c){if(!_0x58541c){_0x5d4e11[_0xc77e('0x1c')](0x194);}return _0x58541c;};}function handleError(_0x674e58,_0x2e575){_0x2e575=_0x2e575||0x1f4;return function(_0x12a73b){logger[_0xc77e('0x29')](_0x12a73b['stack']);if(_0x12a73b[_0xc77e('0x2a')]){delete _0x12a73b[_0xc77e('0x2a')];}_0x674e58[_0xc77e('0x1e')](_0x2e575)[_0xc77e('0x2b')](_0x12a73b);};}exports[_0xc77e('0x2c')]=function(_0x44dd3f,_0x4a905b){var _0x9ee4b7={},_0xf82b42={},_0x21bf60={'count':0x0,'rows':[]};var _0x7727f2=_['map'](db[_0xc77e('0x2d')][_0xc77e('0x2e')],function(_0x32d81e){return{'name':_0x32d81e[_0xc77e('0x2f')],'type':_0x32d81e[_0xc77e('0x30')][_0xc77e('0x31')]};});_0xf82b42[_0xc77e('0x32')]=_['map'](_0x7727f2,'name');_0xf82b42[_0xc77e('0x33')]=_[_0xc77e('0x34')](_0x44dd3f['query']);_0xf82b42[_0xc77e('0x35')]=_['intersection'](_0xf82b42['model'],_0xf82b42[_0xc77e('0x33')]);_0x9ee4b7['attributes']=_[_0xc77e('0x36')](_0xf82b42[_0xc77e('0x32')],qs['fields'](_0x44dd3f[_0xc77e('0x33')]['fields']));_0x9ee4b7[_0xc77e('0x37')]=_0x9ee4b7[_0xc77e('0x37')][_0xc77e('0x38')]?_0x9ee4b7[_0xc77e('0x37')]:_0xf82b42[_0xc77e('0x32')];if(!_0x44dd3f[_0xc77e('0x33')][_0xc77e('0x39')]('nolimit')){_0x9ee4b7[_0xc77e('0x21')]=qs[_0xc77e('0x21')](_0x44dd3f['query'][_0xc77e('0x21')]);_0x9ee4b7[_0xc77e('0x20')]=qs[_0xc77e('0x20')](_0x44dd3f[_0xc77e('0x33')]['offset']);}_0x9ee4b7[_0xc77e('0x3a')]=qs[_0xc77e('0x3b')](_0x44dd3f[_0xc77e('0x33')]['sort']);_0x9ee4b7['where']=qs[_0xc77e('0x35')](_[_0xc77e('0x3c')](_0x44dd3f['query'],_0xf82b42[_0xc77e('0x35')]));if(_0x44dd3f['query'][_0xc77e('0x3d')]){_0x9ee4b7[_0xc77e('0x3e')]=_[_0xc77e('0x3f')](_0x9ee4b7[_0xc77e('0x3e')],{'$or':_[_0xc77e('0x40')](_0x7727f2,function(_0x107c40){if(_0x107c40[_0xc77e('0x30')]!==_0xc77e('0x41')){var _0x3c1aa8={};_0x3c1aa8[_0x107c40[_0xc77e('0x2a')]]={'$like':'%'+_0x44dd3f[_0xc77e('0x33')][_0xc77e('0x3d')]+'%'};return _0x3c1aa8;}})});}_0x9ee4b7=_[_0xc77e('0x3f')]({},_0x9ee4b7,_0x44dd3f['options']);var _0x7b9bcb={'where':_0x9ee4b7[_0xc77e('0x3e')]};return db[_0xc77e('0x2d')]['count'](_0x7b9bcb)['then'](function(_0x2c2abf){_0x21bf60[_0xc77e('0x42')]=_0x2c2abf;if(_0x44dd3f[_0xc77e('0x33')][_0xc77e('0x43')]){_0x9ee4b7[_0xc77e('0x44')]=[{'all':!![]}];}return db[_0xc77e('0x2d')][_0xc77e('0x45')](_0x9ee4b7);})[_0xc77e('0x27')](function(_0x57754a){_0x21bf60[_0xc77e('0x46')]=_0x57754a;return _0x21bf60;})[_0xc77e('0x27')](respondWithFilteredResult(_0x4a905b,_0x9ee4b7))['catch'](handleError(_0x4a905b,null));};exports['show']=function(_0x557f3a,_0x4d1a07){var _0x3be49e={'raw':!![],'where':{'id':_0x557f3a['params']['id']}},_0x3aa362={};_0x3aa362[_0xc77e('0x32')]=_[_0xc77e('0x34')](db[_0xc77e('0x2d')][_0xc77e('0x2e')]);_0x3aa362[_0xc77e('0x33')]=_[_0xc77e('0x34')](_0x557f3a[_0xc77e('0x33')]);_0x3aa362[_0xc77e('0x35')]=_[_0xc77e('0x36')](_0x3aa362['model'],_0x3aa362[_0xc77e('0x33')]);_0x3be49e[_0xc77e('0x37')]=_['intersection'](_0x3aa362['model'],qs['fields'](_0x557f3a[_0xc77e('0x33')][_0xc77e('0x47')]));_0x3be49e[_0xc77e('0x37')]=_0x3be49e[_0xc77e('0x37')][_0xc77e('0x38')]?_0x3be49e[_0xc77e('0x37')]:_0x3aa362['model'];if(_0x557f3a['query'][_0xc77e('0x43')]){_0x3be49e[_0xc77e('0x44')]=[{'all':!![]}];}_0x3be49e=_[_0xc77e('0x3f')]({},_0x3be49e,_0x557f3a[_0xc77e('0x48')]);return db['MemberReport']['find'](_0x3be49e)[_0xc77e('0x27')](handleEntityNotFound(_0x4d1a07,null))[_0xc77e('0x27')](respondWithResult(_0x4d1a07,null))[_0xc77e('0x49')](handleError(_0x4d1a07,null));};exports[_0xc77e('0x4a')]=function(_0x5c8bc6,_0x25a4af){return db[_0xc77e('0x2d')][_0xc77e('0x4a')](_0x5c8bc6[_0xc77e('0x4b')],{})[_0xc77e('0x27')](respondWithResult(_0x25a4af,0xc9))['catch'](handleError(_0x25a4af,null));};exports['update']=function(_0xbab28d,_0x41210d){if(_0xbab28d[_0xc77e('0x4b')]['id']){delete _0xbab28d[_0xc77e('0x4b')]['id'];}return db['MemberReport'][_0xc77e('0x4c')]({'where':{'id':_0xbab28d[_0xc77e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x41210d,null))[_0xc77e('0x27')](saveUpdates(_0xbab28d[_0xc77e('0x4b')],null))[_0xc77e('0x27')](respondWithResult(_0x41210d,null))[_0xc77e('0x49')](handleError(_0x41210d,null));};exports[_0xc77e('0x28')]=function(_0x54eca0,_0x2db024){return db[_0xc77e('0x2d')][_0xc77e('0x4c')]({'where':{'id':_0x54eca0[_0xc77e('0x4d')]['id']}})['then'](handleEntityNotFound(_0x2db024,null))[_0xc77e('0x27')](removeEntity(_0x2db024,null))[_0xc77e('0x49')](handleError(_0x2db024,null));};exports[_0xc77e('0x4e')]=function(_0x262738,_0x2af577){return db['MemberReport'][_0xc77e('0x4e')]()['then'](respondWithResult(_0x2af577,null))[_0xc77e('0x49')](handleError(_0x2af577,null));}; \ No newline at end of file +var _0xfac4=['filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','length','body','find','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','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','offset','apply','reject','update','then','destroy','sendStatus','stack','name','index','map','MemberReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick'];(function(_0x221ca3,_0xb25dd3){var _0x5974e4=function(_0x4c1607){while(--_0x4c1607){_0x221ca3['push'](_0x221ca3['shift']());}};_0x5974e4(++_0xb25dd3);}(_0xfac4,0x137));var _0x4fac=function(_0x5e3b3b,_0x60628f){_0x5e3b3b=_0x5e3b3b-0x0;var _0x4c3ae4=_0xfac4[_0x5e3b3b];return _0x4c3ae4;};'use strict';var pdf=require(_0x4fac('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4fac('0x1'));var zipdir=require(_0x4fac('0x2'));var jsonpatch=require(_0x4fac('0x3'));var rp=require(_0x4fac('0x4'));var moment=require(_0x4fac('0x5'));var BPromise=require(_0x4fac('0x6'));var Mustache=require('mustache');var util=require(_0x4fac('0x7'));var path=require(_0x4fac('0x8'));var sox=require(_0x4fac('0x9'));var csv=require(_0x4fac('0xa'));var ejs=require(_0x4fac('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4fac('0xc'));var crypto=require(_0x4fac('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4fac('0xe'));var toCsv=require(_0x4fac('0xa'));var querystring=require(_0x4fac('0xf'));var Papa=require(_0x4fac('0x10'));var Redis=require(_0x4fac('0x11'));var authService=require(_0x4fac('0x12'));var qs=require(_0x4fac('0x13'));var as=require(_0x4fac('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4fac('0x15'))(_0x4fac('0x16'));var utils=require(_0x4fac('0x17'));var config=require(_0x4fac('0x18'));var db=require(_0x4fac('0x19'))['db'];function respondWithStatusCode(_0x4332e6,_0x16313b){_0x16313b=_0x16313b||0xcc;return function(_0x493d59){if(_0x493d59){return _0x4332e6['sendStatus'](_0x16313b);}return _0x4332e6[_0x4fac('0x1a')](_0x16313b)[_0x4fac('0x1b')]();};}function respondWithResult(_0x47254e,_0x259206){_0x259206=_0x259206||0xc8;return function(_0x5410d8){if(_0x5410d8){return _0x47254e[_0x4fac('0x1a')](_0x259206)[_0x4fac('0x1c')](_0x5410d8);}};}function respondWithFilteredResult(_0x288741,_0x40e26e){return function(_0x505d46){if(_0x505d46){var _0x197665=_0x505d46[_0x4fac('0x1d')],_0x549e17=_0x40e26e[_0x4fac('0x1e')],_0x2e3fe1=_0x40e26e[_0x4fac('0x1e')]+_0x40e26e['limit'],_0x500447;if(_0x2e3fe1>=_0x197665){_0x2e3fe1=_0x197665;_0x500447=0xc8;}else{_0x500447=0xce;}_0x288741[_0x4fac('0x1a')](_0x500447);return _0x288741['set']('Content-Range',_0x549e17+'-'+_0x2e3fe1+'/'+_0x197665)[_0x4fac('0x1c')](_0x505d46);}return null;};}function patchUpdates(_0x53f01e){return function(_0x59bc45){try{jsonpatch[_0x4fac('0x1f')](_0x59bc45,_0x53f01e,!![]);}catch(_0x44706a){return BPromise[_0x4fac('0x20')](_0x44706a);}return _0x59bc45['save']();};}function saveUpdates(_0x5c9f0e,_0x455d03){return function(_0x396381){if(_0x396381){return _0x396381[_0x4fac('0x21')](_0x5c9f0e)[_0x4fac('0x22')](function(_0x30b524){return _0x30b524;});}return null;};}function removeEntity(_0x14fa66,_0x16dde4){return function(_0x542bb0){if(_0x542bb0){return _0x542bb0[_0x4fac('0x23')]()[_0x4fac('0x22')](function(){_0x14fa66[_0x4fac('0x1a')](0xcc)[_0x4fac('0x1b')]();});}};}function handleEntityNotFound(_0x273e4c,_0x51e3ab){return function(_0x30bfa3){if(!_0x30bfa3){_0x273e4c[_0x4fac('0x24')](0x194);}return _0x30bfa3;};}function handleError(_0x3351c8,_0x13a6be){_0x13a6be=_0x13a6be||0x1f4;return function(_0x1ca1c7){logger['error'](_0x1ca1c7[_0x4fac('0x25')]);if(_0x1ca1c7[_0x4fac('0x26')]){delete _0x1ca1c7[_0x4fac('0x26')];}_0x3351c8['status'](_0x13a6be)['send'](_0x1ca1c7);};}exports[_0x4fac('0x27')]=function(_0x6423,_0x1765e8){var _0xd24500={},_0x462067={},_0x4694d2={'count':0x0,'rows':[]};var _0x1ae3d1=_[_0x4fac('0x28')](db[_0x4fac('0x29')][_0x4fac('0x2a')],function(_0x4e502b){return{'name':_0x4e502b[_0x4fac('0x2b')],'type':_0x4e502b[_0x4fac('0x2c')][_0x4fac('0x2d')]};});_0x462067['model']=_['map'](_0x1ae3d1,_0x4fac('0x26'));_0x462067[_0x4fac('0x2e')]=_[_0x4fac('0x2f')](_0x6423[_0x4fac('0x2e')]);_0x462067[_0x4fac('0x30')]=_[_0x4fac('0x31')](_0x462067[_0x4fac('0x32')],_0x462067[_0x4fac('0x2e')]);_0xd24500[_0x4fac('0x33')]=_[_0x4fac('0x31')](_0x462067[_0x4fac('0x32')],qs['fields'](_0x6423[_0x4fac('0x2e')][_0x4fac('0x34')]));_0xd24500['attributes']=_0xd24500[_0x4fac('0x33')]['length']?_0xd24500['attributes']:_0x462067[_0x4fac('0x32')];if(!_0x6423['query'][_0x4fac('0x35')](_0x4fac('0x36'))){_0xd24500[_0x4fac('0x37')]=qs[_0x4fac('0x37')](_0x6423[_0x4fac('0x2e')][_0x4fac('0x37')]);_0xd24500[_0x4fac('0x1e')]=qs[_0x4fac('0x1e')](_0x6423[_0x4fac('0x2e')][_0x4fac('0x1e')]);}_0xd24500[_0x4fac('0x38')]=qs[_0x4fac('0x39')](_0x6423['query'][_0x4fac('0x39')]);_0xd24500['where']=qs[_0x4fac('0x30')](_[_0x4fac('0x3a')](_0x6423[_0x4fac('0x2e')],_0x462067[_0x4fac('0x30')]));if(_0x6423['query'][_0x4fac('0x3b')]){_0xd24500[_0x4fac('0x3c')]=_[_0x4fac('0x3d')](_0xd24500[_0x4fac('0x3c')],{'$or':_[_0x4fac('0x28')](_0x1ae3d1,function(_0x728ed2){if(_0x728ed2[_0x4fac('0x2c')]!==_0x4fac('0x3e')){var _0x245608={};_0x245608[_0x728ed2[_0x4fac('0x26')]]={'$like':'%'+_0x6423[_0x4fac('0x2e')][_0x4fac('0x3b')]+'%'};return _0x245608;}})});}_0xd24500=_[_0x4fac('0x3d')]({},_0xd24500,_0x6423['options']);var _0x4a44d0={'where':_0xd24500[_0x4fac('0x3c')]};return db[_0x4fac('0x29')][_0x4fac('0x1d')](_0x4a44d0)[_0x4fac('0x22')](function(_0x2fa858){_0x4694d2['count']=_0x2fa858;if(_0x6423['query'][_0x4fac('0x3f')]){_0xd24500[_0x4fac('0x40')]=[{'all':!![]}];}return db['MemberReport'][_0x4fac('0x41')](_0xd24500);})[_0x4fac('0x22')](function(_0xfe2415){_0x4694d2[_0x4fac('0x42')]=_0xfe2415;return _0x4694d2;})[_0x4fac('0x22')](respondWithFilteredResult(_0x1765e8,_0xd24500))[_0x4fac('0x43')](handleError(_0x1765e8,null));};exports[_0x4fac('0x44')]=function(_0x533ca9,_0xb1df57){var _0x26ea1d={'raw':!![],'where':{'id':_0x533ca9[_0x4fac('0x45')]['id']}},_0x3e71cc={};_0x3e71cc[_0x4fac('0x32')]=_['keys'](db['MemberReport'][_0x4fac('0x2a')]);_0x3e71cc['query']=_[_0x4fac('0x2f')](_0x533ca9['query']);_0x3e71cc[_0x4fac('0x30')]=_[_0x4fac('0x31')](_0x3e71cc[_0x4fac('0x32')],_0x3e71cc[_0x4fac('0x2e')]);_0x26ea1d[_0x4fac('0x33')]=_[_0x4fac('0x31')](_0x3e71cc[_0x4fac('0x32')],qs[_0x4fac('0x34')](_0x533ca9[_0x4fac('0x2e')][_0x4fac('0x34')]));_0x26ea1d['attributes']=_0x26ea1d[_0x4fac('0x33')][_0x4fac('0x46')]?_0x26ea1d['attributes']:_0x3e71cc[_0x4fac('0x32')];if(_0x533ca9['query'][_0x4fac('0x3f')]){_0x26ea1d['include']=[{'all':!![]}];}_0x26ea1d=_[_0x4fac('0x3d')]({},_0x26ea1d,_0x533ca9['options']);return db[_0x4fac('0x29')]['find'](_0x26ea1d)['then'](handleEntityNotFound(_0xb1df57,null))['then'](respondWithResult(_0xb1df57,null))[_0x4fac('0x43')](handleError(_0xb1df57,null));};exports['create']=function(_0x210b89,_0xd343a4){return db[_0x4fac('0x29')]['create'](_0x210b89['body'],{})[_0x4fac('0x22')](respondWithResult(_0xd343a4,0xc9))[_0x4fac('0x43')](handleError(_0xd343a4,null));};exports['update']=function(_0x49904b,_0x254738){if(_0x49904b[_0x4fac('0x47')]['id']){delete _0x49904b[_0x4fac('0x47')]['id'];}return db[_0x4fac('0x29')][_0x4fac('0x48')]({'where':{'id':_0x49904b[_0x4fac('0x45')]['id']}})[_0x4fac('0x22')](handleEntityNotFound(_0x254738,null))['then'](saveUpdates(_0x49904b['body'],null))[_0x4fac('0x22')](respondWithResult(_0x254738,null))[_0x4fac('0x43')](handleError(_0x254738,null));};exports[_0x4fac('0x23')]=function(_0x13c678,_0x184a40){return db[_0x4fac('0x29')][_0x4fac('0x48')]({'where':{'id':_0x13c678[_0x4fac('0x45')]['id']}})[_0x4fac('0x22')](handleEntityNotFound(_0x184a40,null))['then'](removeEntity(_0x184a40,null))[_0x4fac('0x43')](handleError(_0x184a40,null));};exports['describe']=function(_0x3b3844,_0x2dafb2){return db[_0x4fac('0x29')][_0x4fac('0x49')]()['then'](respondWithResult(_0x2dafb2,null))[_0x4fac('0x43')](handleError(_0x2dafb2,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 76c2730..6eeb1df 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 _0x94c0=['../../config/environment','exports','report_member','membername_interface','lodash','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x274598,_0x2c7251){var _0xbca5fa=function(_0x35459c){while(--_0x35459c){_0x274598['push'](_0x274598['shift']());}};_0xbca5fa(++_0x2c7251);}(_0x94c0,0x1dd));var _0x094c=function(_0x2e561f,_0x1b1660){_0x2e561f=_0x2e561f-0x0;var _0x4160ea=_0x94c0[_0x2e561f];return _0x4160ea;};'use strict';var _=require(_0x094c('0x0'));var util=require(_0x094c('0x1'));var logger=require('../../config/logger')(_0x094c('0x2'));var moment=require(_0x094c('0x3'));var BPromise=require(_0x094c('0x4'));var rp=require(_0x094c('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x094c('0x6'));var config=require(_0x094c('0x7'));var attributes=require('./memberReport.attributes');module[_0x094c('0x8')]=function(_0x1e1585,_0x3b6ed2){return _0x1e1585['define']('MemberReport',attributes,{'tableName':_0x094c('0x9'),'paranoid':![],'indexes':[{'name':_0x094c('0xa'),'fields':['membername','interface']}],'timestamps':!![]});}; \ No newline at end of file +var _0xaebf=['interface','lodash','util','../../config/logger','moment','bluebird','request-promise','path','./memberReport.attributes','report_member','membername_interface','membername'];(function(_0x5e4563,_0x3ff918){var _0x8d1bf5=function(_0x3bf7a9){while(--_0x3bf7a9){_0x5e4563['push'](_0x5e4563['shift']());}};_0x8d1bf5(++_0x3ff918);}(_0xaebf,0x18d));var _0xfaeb=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xaebf[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0xfaeb('0x0'));var util=require(_0xfaeb('0x1'));var logger=require(_0xfaeb('0x2'))('api');var moment=require(_0xfaeb('0x3'));var BPromise=require(_0xfaeb('0x4'));var rp=require(_0xfaeb('0x5'));var fs=require('fs');var path=require(_0xfaeb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfaeb('0x7'));module['exports']=function(_0x28718f,_0x47c326){return _0x28718f['define']('MemberReport',attributes,{'tableName':_0xfaeb('0x8'),'paranoid':![],'indexes':[{'name':_0xfaeb('0x9'),'fields':[_0xfaeb('0xa'),_0xfaeb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index e016543..d1a9853 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 _0x910f=['where','limit','map','include','model','attributes','GetMemberReport','catch','CreateMemberReport','body','raw','UpdateMemberReport','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','MemberReport','options'];(function(_0x3d908a,_0xdf8980){var _0x530bec=function(_0x59d34c){while(--_0x59d34c){_0x3d908a['push'](_0x3d908a['shift']());}};_0x530bec(++_0xdf8980);}(_0x910f,0xcc));var _0xf910=function(_0x305c8f,_0xc5f7fb){_0x305c8f=_0x305c8f-0x0;var _0x5ddc30=_0x910f[_0x305c8f];return _0x5ddc30;};'use strict';var _=require('lodash');var util=require(_0xf910('0x0'));var moment=require(_0xf910('0x1'));var BPromise=require(_0xf910('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf910('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf910('0x4'));var logger=require(_0xf910('0x5'))(_0xf910('0x6'));var config=require(_0xf910('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf910('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x52aad2,_0x3808f4,_0x418ed6){return new BPromise(function(_0x137dea,_0x221463){return client['request'](_0x52aad2,_0x418ed6)[_0xf910('0x9')](function(_0x27f831){logger['info'](_0xf910('0xa'),_0x3808f4,'request\x20sent');logger[_0xf910('0xb')](_0xf910('0xc'),_0x3808f4,'request\x20sent',JSON[_0xf910('0xd')](_0x27f831));if(_0x27f831[_0xf910('0xe')]){if(_0x27f831[_0xf910('0xe')]['code']===0x1f4){logger[_0xf910('0xe')]('MemberReport,\x20%s,\x20%s',_0x3808f4,_0x27f831[_0xf910('0xe')][_0xf910('0xf')]);return _0x221463(_0x27f831[_0xf910('0xe')]['message']);}logger[_0xf910('0xe')](_0xf910('0xa'),_0x3808f4,_0x27f831[_0xf910('0xe')][_0xf910('0xf')]);return _0x137dea(_0x27f831[_0xf910('0xe')][_0xf910('0xf')]);}else{logger[_0xf910('0x10')]('MemberReport,\x20%s,\x20%s',_0x3808f4,'request\x20sent');_0x137dea(_0x27f831[_0xf910('0x11')][_0xf910('0xf')]);}})['catch'](function(_0x2a9dc8){logger[_0xf910('0xe')](_0xf910('0xa'),_0x3808f4,_0x2a9dc8);_0x221463(_0x2a9dc8);});});}exports['GetMemberReport']=function(_0x281a6e){var _0x48e8c8=this;return new Promise(function(_0x5831ec,_0xadc71a){return db[_0xf910('0x12')]['findAll']({'raw':_0x281a6e['options']?_0x281a6e[_0xf910('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x281a6e['options']?_0x281a6e[_0xf910('0x13')][_0xf910('0x14')]||null:null,'attributes':_0x281a6e['options']?_0x281a6e[_0xf910('0x13')]['attributes']||null:null,'limit':_0x281a6e[_0xf910('0x13')]?_0x281a6e[_0xf910('0x13')][_0xf910('0x15')]||null:null,'include':_0x281a6e['options']?_0x281a6e[_0xf910('0x13')]['include']?_[_0xf910('0x16')](_0x281a6e[_0xf910('0x13')][_0xf910('0x17')],function(_0x1f5470){return{'model':db[_0x1f5470[_0xf910('0x18')]],'as':_0x1f5470['as'],'attributes':_0x1f5470[_0xf910('0x19')],'include':_0x1f5470[_0xf910('0x17')]?_[_0xf910('0x16')](_0x1f5470[_0xf910('0x17')],function(_0x3bbd21){return{'model':db[_0x3bbd21['model']],'as':_0x3bbd21['as'],'attributes':_0x3bbd21[_0xf910('0x19')],'include':_0x3bbd21[_0xf910('0x17')]?_['map'](_0x3bbd21[_0xf910('0x17')],function(_0x3485c6){return{'model':db[_0x3485c6[_0xf910('0x18')]],'as':_0x3485c6['as'],'attributes':_0x3485c6[_0xf910('0x19')]};}):[]};}):[]};}):[]:[]})[_0xf910('0x9')](function(_0x3921b2){logger['info'](_0xf910('0x1a'),_0x281a6e);logger['debug']('GetMemberReport',_0x281a6e,JSON[_0xf910('0xd')](_0x3921b2));_0x5831ec(_0x3921b2);})[_0xf910('0x1b')](function(_0x19f393){logger[_0xf910('0xe')]('GetMemberReport',_0x19f393[_0xf910('0xf')],_0x281a6e);_0xadc71a(_0x48e8c8[_0xf910('0xe')](0x1f4,_0x19f393[_0xf910('0xf')]));});});};exports[_0xf910('0x1c')]=function(_0xed1548){var _0x18462f=this;return new Promise(function(_0x3a49b7,_0x4dd0e5){return db['MemberReport']['create'](_0xed1548[_0xf910('0x1d')],{'raw':_0xed1548[_0xf910('0x13')]?_0xed1548[_0xf910('0x13')][_0xf910('0x1e')]===undefined?!![]:![]:!![]})[_0xf910('0x9')](function(_0x20d941){logger[_0xf910('0x10')](_0xf910('0x1c'),_0xed1548);logger[_0xf910('0xb')]('CreateMemberReport',_0xed1548,JSON['stringify'](_0x20d941));_0x3a49b7(_0x20d941);})['catch'](function(_0x2e1631){logger[_0xf910('0xe')](_0xf910('0x1c'),_0x2e1631[_0xf910('0xf')],_0xed1548);_0x4dd0e5(_0x18462f[_0xf910('0xe')](0x1f4,_0x2e1631['message']));});});};exports[_0xf910('0x1f')]=function(_0x1a05a8){var _0x363067=this;return new Promise(function(_0x13bd30,_0x16ff5b){return db[_0xf910('0x12')]['update'](_0x1a05a8[_0xf910('0x1d')],{'raw':_0x1a05a8[_0xf910('0x13')]?_0x1a05a8[_0xf910('0x13')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a05a8[_0xf910('0x13')]?_0x1a05a8['options']['where']||null:null,'attributes':_0x1a05a8[_0xf910('0x13')]?_0x1a05a8[_0xf910('0x13')][_0xf910('0x19')]||null:null,'limit':_0x1a05a8['options']?_0x1a05a8[_0xf910('0x13')]['limit']||null:null})[_0xf910('0x9')](function(_0x23041e){logger[_0xf910('0x10')](_0xf910('0x1f'),_0x1a05a8);logger[_0xf910('0xb')]('UpdateMemberReport',_0x1a05a8,JSON[_0xf910('0xd')](_0x23041e));_0x13bd30(_0x23041e);})[_0xf910('0x1b')](function(_0x50dc01){logger[_0xf910('0xe')]('UpdateMemberReport',_0x50dc01[_0xf910('0xf')],_0x1a05a8);_0x16ff5b(_0x363067[_0xf910('0xe')](0x1f4,_0x50dc01[_0xf910('0xf')]));});});}; \ No newline at end of file +var _0xf935=['message','result','catch','findAll','options','raw','where','limit','include','map','attributes','model','GetMemberReport','debug','CreateMemberReport','MemberReport','update','body','UpdateMemberReport','util','ioredis','../../mysqldb','../../config/logger','client','request','then','info','MemberReport,\x20%s,\x20%s','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x3f4927,_0x497b49){var _0x4831eb=function(_0x441bf5){while(--_0x441bf5){_0x3f4927['push'](_0x3f4927['shift']());}};_0x4831eb(++_0x497b49);}(_0xf935,0xfa));var _0x5f93=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf935[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x5f93('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5f93('0x1'));var db=require(_0x5f93('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x5f93('0x3'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5f93('0x4')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24884f,_0x35705d,_0x4eba89){return new BPromise(function(_0x2276f6,_0x239e2c){return client[_0x5f93('0x5')](_0x24884f,_0x4eba89)[_0x5f93('0x6')](function(_0x29f1c7){logger[_0x5f93('0x7')](_0x5f93('0x8'),_0x35705d,'request\x20sent');logger['debug'](_0x5f93('0x9'),_0x35705d,_0x5f93('0xa'),JSON[_0x5f93('0xb')](_0x29f1c7));if(_0x29f1c7[_0x5f93('0xc')]){if(_0x29f1c7['error'][_0x5f93('0xd')]===0x1f4){logger[_0x5f93('0xc')]('MemberReport,\x20%s,\x20%s',_0x35705d,_0x29f1c7[_0x5f93('0xc')]['message']);return _0x239e2c(_0x29f1c7[_0x5f93('0xc')][_0x5f93('0xe')]);}logger[_0x5f93('0xc')](_0x5f93('0x8'),_0x35705d,_0x29f1c7[_0x5f93('0xc')][_0x5f93('0xe')]);return _0x2276f6(_0x29f1c7[_0x5f93('0xc')][_0x5f93('0xe')]);}else{logger[_0x5f93('0x7')](_0x5f93('0x8'),_0x35705d,'request\x20sent');_0x2276f6(_0x29f1c7[_0x5f93('0xf')][_0x5f93('0xe')]);}})[_0x5f93('0x10')](function(_0x4aa805){logger[_0x5f93('0xc')](_0x5f93('0x8'),_0x35705d,_0x4aa805);_0x239e2c(_0x4aa805);});});}exports['GetMemberReport']=function(_0x4fd7fa){var _0xee1fbc=this;return new Promise(function(_0x2e5e2e,_0x507a7a){return db['MemberReport'][_0x5f93('0x11')]({'raw':_0x4fd7fa[_0x5f93('0x12')]?_0x4fd7fa[_0x5f93('0x12')][_0x5f93('0x13')]===undefined?!![]:![]:!![],'where':_0x4fd7fa[_0x5f93('0x12')]?_0x4fd7fa[_0x5f93('0x12')][_0x5f93('0x14')]||null:null,'attributes':_0x4fd7fa[_0x5f93('0x12')]?_0x4fd7fa['options']['attributes']||null:null,'limit':_0x4fd7fa['options']?_0x4fd7fa[_0x5f93('0x12')][_0x5f93('0x15')]||null:null,'include':_0x4fd7fa[_0x5f93('0x12')]?_0x4fd7fa[_0x5f93('0x12')][_0x5f93('0x16')]?_[_0x5f93('0x17')](_0x4fd7fa[_0x5f93('0x12')]['include'],function(_0x2c1aea){return{'model':db[_0x2c1aea['model']],'as':_0x2c1aea['as'],'attributes':_0x2c1aea[_0x5f93('0x18')],'include':_0x2c1aea[_0x5f93('0x16')]?_[_0x5f93('0x17')](_0x2c1aea[_0x5f93('0x16')],function(_0x5bd37c){return{'model':db[_0x5bd37c[_0x5f93('0x19')]],'as':_0x5bd37c['as'],'attributes':_0x5bd37c[_0x5f93('0x18')],'include':_0x5bd37c['include']?_[_0x5f93('0x17')](_0x5bd37c[_0x5f93('0x16')],function(_0x40cc64){return{'model':db[_0x40cc64[_0x5f93('0x19')]],'as':_0x40cc64['as'],'attributes':_0x40cc64[_0x5f93('0x18')]};}):[]};}):[]};}):[]:[]})[_0x5f93('0x6')](function(_0x618922){logger[_0x5f93('0x7')](_0x5f93('0x1a'),_0x4fd7fa);logger[_0x5f93('0x1b')](_0x5f93('0x1a'),_0x4fd7fa,JSON[_0x5f93('0xb')](_0x618922));_0x2e5e2e(_0x618922);})['catch'](function(_0x524399){logger[_0x5f93('0xc')](_0x5f93('0x1a'),_0x524399[_0x5f93('0xe')],_0x4fd7fa);_0x507a7a(_0xee1fbc[_0x5f93('0xc')](0x1f4,_0x524399['message']));});});};exports[_0x5f93('0x1c')]=function(_0x41dbb2){var _0xd7f920=this;return new Promise(function(_0x2b834d,_0x475cc6){return db[_0x5f93('0x1d')]['create'](_0x41dbb2['body'],{'raw':_0x41dbb2[_0x5f93('0x12')]?_0x41dbb2[_0x5f93('0x12')][_0x5f93('0x13')]===undefined?!![]:![]:!![]})['then'](function(_0x263f83){logger['info'](_0x5f93('0x1c'),_0x41dbb2);logger['debug'](_0x5f93('0x1c'),_0x41dbb2,JSON[_0x5f93('0xb')](_0x263f83));_0x2b834d(_0x263f83);})[_0x5f93('0x10')](function(_0x536d3a){logger[_0x5f93('0xc')]('CreateMemberReport',_0x536d3a[_0x5f93('0xe')],_0x41dbb2);_0x475cc6(_0xd7f920[_0x5f93('0xc')](0x1f4,_0x536d3a[_0x5f93('0xe')]));});});};exports['UpdateMemberReport']=function(_0xd9bcc2){var _0x32027d=this;return new Promise(function(_0x23dbc6,_0x855e6d){return db['MemberReport'][_0x5f93('0x1e')](_0xd9bcc2[_0x5f93('0x1f')],{'raw':_0xd9bcc2[_0x5f93('0x12')]?_0xd9bcc2[_0x5f93('0x12')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xd9bcc2['options']?_0xd9bcc2['options'][_0x5f93('0x14')]||null:null,'attributes':_0xd9bcc2[_0x5f93('0x12')]?_0xd9bcc2[_0x5f93('0x12')][_0x5f93('0x18')]||null:null,'limit':_0xd9bcc2[_0x5f93('0x12')]?_0xd9bcc2['options'][_0x5f93('0x15')]||null:null})[_0x5f93('0x6')](function(_0x862bbf){logger['info']('UpdateMemberReport',_0xd9bcc2);logger[_0x5f93('0x1b')](_0x5f93('0x20'),_0xd9bcc2,JSON['stringify'](_0x862bbf));_0x23dbc6(_0x862bbf);})[_0x5f93('0x10')](function(_0x583cf4){logger[_0x5f93('0xc')](_0x5f93('0x20'),_0x583cf4['message'],_0xd9bcc2);_0x855e6d(_0x32027d['error'](0x1f4,_0x583cf4[_0x5f93('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 2dbec8d..2b635c9 100644 --- a/server/api/migration/index.js +++ b/server/api/migration/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb688=['express','Router','../../components/auth/service','../../config/environment','./migration.controller','get','index','util','path','connect-timeout'];(function(_0x5a29e0,_0x56678a){var _0x5fc0a2=function(_0x6397d2){while(--_0x6397d2){_0x5a29e0['push'](_0x5a29e0['shift']());}};_0x5fc0a2(++_0x56678a);}(_0xb688,0xcf));var _0x8b68=function(_0x3c0f17,_0x4c1795){_0x3c0f17=_0x3c0f17-0x0;var _0x595c21=_0xb688[_0x3c0f17];return _0x595c21;};'use strict';var multer=require('multer');var util=require(_0x8b68('0x0'));var path=require(_0x8b68('0x1'));var timeout=require(_0x8b68('0x2'));var express=require(_0x8b68('0x3'));var router=express[_0x8b68('0x4')]();var auth=require(_0x8b68('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8b68('0x6'));var controller=require(_0x8b68('0x7'));router[_0x8b68('0x8')]('/',controller[_0x8b68('0x9')]);module['exports']=router; \ No newline at end of file +var _0x4ded=['get','index','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller'];(function(_0x72d206,_0x49459b){var _0x5bab43=function(_0x127b27){while(--_0x127b27){_0x72d206['push'](_0x72d206['shift']());}};_0x5bab43(++_0x49459b);}(_0x4ded,0x116));var _0xd4de=function(_0x574e3f,_0x39fa94){_0x574e3f=_0x574e3f-0x0;var _0x953319=_0x4ded[_0x574e3f];return _0x953319;};'use strict';var multer=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var path=require(_0xd4de('0x2'));var timeout=require(_0xd4de('0x3'));var express=require(_0xd4de('0x4'));var router=express[_0xd4de('0x5')]();var auth=require(_0xd4de('0x6'));var interaction=require(_0xd4de('0x7'));var config=require(_0xd4de('0x8'));var controller=require(_0xd4de('0x9'));router[_0xd4de('0xa')]('/',controller[_0xd4de('0xb')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index e2e47e9..c99b397 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 _0xec3b=['STRING','sequelize','exports'];(function(_0x3773dd,_0x2fb039){var _0x7d736e=function(_0x2a6af3){while(--_0x2a6af3){_0x3773dd['push'](_0x3773dd['shift']());}};_0x7d736e(++_0x2fb039);}(_0xec3b,0xa0));var _0xbec3=function(_0x19ceae,_0x19b404){_0x19ceae=_0x19ceae-0x0;var _0x99f3f3=_0xec3b[_0x19ceae];return _0x99f3f3;};'use strict';var Sequelize=require(_0xbec3('0x0'));module[_0xbec3('0x1')]={'version':{'type':Sequelize[_0xbec3('0x2')],'unique':'version'}}; \ No newline at end of file +var _0x9d5c=['exports','STRING','version','sequelize'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x9d5c,0xd7));var _0xc9d5=function(_0x2c711b,_0x99bf88){_0x2c711b=_0x2c711b-0x0;var _0x1f2bed=_0x9d5c[_0x2c711b];return _0x1f2bed;};'use strict';var Sequelize=require(_0xc9d5('0x0'));module[_0xc9d5('0x1')]={'version':{'type':Sequelize[_0xc9d5('0x2')],'unique':_0xc9d5('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 6aa6d37..ea506fd 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 _0xb10b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','Migration','include','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x3f047e,_0x3edf7a){var _0x3cd060=function(_0x71970b){while(--_0x71970b){_0x3f047e['push'](_0x3f047e['shift']());}};_0x3cd060(++_0x3edf7a);}(_0xb10b,0x12a));var _0xbb10=function(_0x46e182,_0x1046a8){_0x46e182=_0x46e182-0x0;var _0x42ade0=_0xb10b[_0x46e182];return _0x42ade0;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['Migration'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]));if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));}; \ No newline at end of file +var _0xb10b=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','then','destroy','name','send','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where','merge','Migration','include','rows','catch','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','querystring'];(function(_0x5d0919,_0x1b8e12){var _0x2506a8=function(_0x2ee7ab){while(--_0x2ee7ab){_0x5d0919['push'](_0x5d0919['shift']());}};_0x2506a8(++_0x1b8e12);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a27fd,_0x5357ea){_0x3a27fd=_0x3a27fd-0x0;var _0x2e519=_0xb10b[_0x3a27fd];return _0x2e519;};'use strict';var pdf=require(_0xbb10('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xbb10('0x1'));var zipdir=require(_0xbb10('0x2'));var jsonpatch=require(_0xbb10('0x3'));var rp=require('request-promise');var moment=require(_0xbb10('0x4'));var BPromise=require(_0xbb10('0x5'));var Mustache=require(_0xbb10('0x6'));var util=require(_0xbb10('0x7'));var path=require(_0xbb10('0x8'));var sox=require(_0xbb10('0x9'));var csv=require('to-csv');var ejs=require(_0xbb10('0xa'));var fs=require('fs');var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0xf'));var querystring=require(_0xbb10('0x10'));var Papa=require(_0xbb10('0x11'));var Redis=require(_0xbb10('0x12'));var authService=require(_0xbb10('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x14'));var logger=require(_0xbb10('0x15'))(_0xbb10('0x16'));var utils=require('../../config/utils');var config=require(_0xbb10('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x44fb19,_0x916a32){_0x916a32=_0x916a32||0xcc;return function(_0x285009){if(_0x285009){return _0x44fb19[_0xbb10('0x18')](_0x916a32);}return _0x44fb19[_0xbb10('0x19')](_0x916a32)[_0xbb10('0x1a')]();};}function respondWithResult(_0x58a612,_0x26e021){_0x26e021=_0x26e021||0xc8;return function(_0x42d7e4){if(_0x42d7e4){return _0x58a612[_0xbb10('0x19')](_0x26e021)[_0xbb10('0x1b')](_0x42d7e4);}};}function respondWithFilteredResult(_0x3df17b,_0x2f2ebf){return function(_0x24a57b){if(_0x24a57b){var _0x36b5e8=_0x24a57b[_0xbb10('0x1c')],_0x3e26f4=_0x2f2ebf[_0xbb10('0x1d')],_0x2b184e=_0x2f2ebf[_0xbb10('0x1d')]+_0x2f2ebf[_0xbb10('0x1e')],_0x4a2bfc;if(_0x2b184e>=_0x36b5e8){_0x2b184e=_0x36b5e8;_0x4a2bfc=0xc8;}else{_0x4a2bfc=0xce;}_0x3df17b[_0xbb10('0x19')](_0x4a2bfc);return _0x3df17b[_0xbb10('0x1f')](_0xbb10('0x20'),_0x3e26f4+'-'+_0x2b184e+'/'+_0x36b5e8)[_0xbb10('0x1b')](_0x24a57b);}return null;};}function patchUpdates(_0xbf2906){return function(_0xe1c665){try{jsonpatch['apply'](_0xe1c665,_0xbf2906,!![]);}catch(_0x5ff0cf){return BPromise[_0xbb10('0x21')](_0x5ff0cf);}return _0xe1c665[_0xbb10('0x22')]();};}function saveUpdates(_0x109908,_0xdf237d){return function(_0x44e563){if(_0x44e563){return _0x44e563['update'](_0x109908)[_0xbb10('0x23')](function(_0x12ef77){return _0x12ef77;});}return null;};}function removeEntity(_0x50aea1,_0x4c4b0d){return function(_0x8e2b97){if(_0x8e2b97){return _0x8e2b97[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x50aea1[_0xbb10('0x19')](0xcc)[_0xbb10('0x1a')]();});}};}function handleEntityNotFound(_0x1824b7,_0x407cb4){return function(_0x436104){if(!_0x436104){_0x1824b7[_0xbb10('0x18')](0x194);}return _0x436104;};}function handleError(_0x395404,_0x3ba6cd){_0x3ba6cd=_0x3ba6cd||0x1f4;return function(_0x26ad93){logger['error'](_0x26ad93['stack']);if(_0x26ad93['name']){delete _0x26ad93[_0xbb10('0x25')];}_0x395404[_0xbb10('0x19')](_0x3ba6cd)[_0xbb10('0x26')](_0x26ad93);};}exports['index']=function(_0x2fdde9,_0x24d586){var _0x6ed43b={},_0x1d5e95={},_0x1acce9={'count':0x0,'rows':[]};var _0x20d946=_[_0xbb10('0x27')](db['Migration'][_0xbb10('0x28')],function(_0x21ac54){return{'name':_0x21ac54[_0xbb10('0x29')],'type':_0x21ac54[_0xbb10('0x2a')][_0xbb10('0x2b')]};});_0x1d5e95[_0xbb10('0x2c')]=_['map'](_0x20d946,_0xbb10('0x25'));_0x1d5e95['query']=_[_0xbb10('0x2d')](_0x2fdde9['query']);_0x1d5e95[_0xbb10('0x2e')]=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],_0x1d5e95['query']);_0x6ed43b['attributes']=_[_0xbb10('0x2f')](_0x1d5e95[_0xbb10('0x2c')],qs['fields'](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x31')]));_0x6ed43b[_0xbb10('0x32')]=_0x6ed43b[_0xbb10('0x32')][_0xbb10('0x33')]?_0x6ed43b[_0xbb10('0x32')]:_0x1d5e95[_0xbb10('0x2c')];if(!_0x2fdde9['query'][_0xbb10('0x34')](_0xbb10('0x35'))){_0x6ed43b[_0xbb10('0x1e')]=qs[_0xbb10('0x1e')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x1e')]);_0x6ed43b[_0xbb10('0x1d')]=qs[_0xbb10('0x1d')](_0x2fdde9[_0xbb10('0x30')]['offset']);}_0x6ed43b[_0xbb10('0x36')]=qs[_0xbb10('0x37')](_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x37')]);_0x6ed43b['where']=qs[_0xbb10('0x2e')](_['pick'](_0x2fdde9['query'],_0x1d5e95[_0xbb10('0x2e')]));if(_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]){_0x6ed43b[_0xbb10('0x39')]=_[_0xbb10('0x3a')](_0x6ed43b[_0xbb10('0x39')],{'$or':_['map'](_0x20d946,function(_0x1e5bbd){if(_0x1e5bbd[_0xbb10('0x2a')]!=='VIRTUAL'){var _0x5e3fbd={};_0x5e3fbd[_0x1e5bbd['name']]={'$like':'%'+_0x2fdde9[_0xbb10('0x30')][_0xbb10('0x38')]+'%'};return _0x5e3fbd;}})});}_0x6ed43b=_[_0xbb10('0x3a')]({},_0x6ed43b,_0x2fdde9['options']);var _0x3c0cd7={'where':_0x6ed43b[_0xbb10('0x39')]};return db[_0xbb10('0x3b')]['count'](_0x3c0cd7)[_0xbb10('0x23')](function(_0x12238a){_0x1acce9[_0xbb10('0x1c')]=_0x12238a;if(_0x2fdde9[_0xbb10('0x30')]['includeAll']){_0x6ed43b[_0xbb10('0x3c')]=[{'all':!![]}];}return db[_0xbb10('0x3b')]['findAll'](_0x6ed43b);})[_0xbb10('0x23')](function(_0x2e3214){_0x1acce9[_0xbb10('0x3d')]=_0x2e3214;return _0x1acce9;})[_0xbb10('0x23')](respondWithFilteredResult(_0x24d586,_0x6ed43b))[_0xbb10('0x3e')](handleError(_0x24d586,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index 81b3733..d58ede6 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 _0x1938=['migrations','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes','exports','Migration'];(function(_0x432fca,_0xb0b1b5){var _0x3adba4=function(_0x5e3ae4){while(--_0x5e3ae4){_0x432fca['push'](_0x432fca['shift']());}};_0x3adba4(++_0xb0b1b5);}(_0x1938,0x139));var _0x8193=function(_0x2695c8,_0x130213){_0x2695c8=_0x2695c8-0x0;var _0x2c1aff=_0x1938[_0x2695c8];return _0x2c1aff;};'use strict';var _=require(_0x8193('0x0'));var util=require('util');var logger=require(_0x8193('0x1'))(_0x8193('0x2'));var moment=require(_0x8193('0x3'));var BPromise=require(_0x8193('0x4'));var rp=require(_0x8193('0x5'));var fs=require('fs');var path=require(_0x8193('0x6'));var rimraf=require(_0x8193('0x7'));var config=require(_0x8193('0x8'));var attributes=require(_0x8193('0x9'));module[_0x8193('0xa')]=function(_0x371905,_0x339ff0){return _0x371905['define'](_0x8193('0xb'),attributes,{'tableName':_0x8193('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x66c5=['define','Migration','migrations','lodash','util','api','bluebird','request-promise','../../config/environment','./migration.attributes','exports'];(function(_0x8587a,_0xb54945){var _0x4584e9=function(_0x26109f){while(--_0x26109f){_0x8587a['push'](_0x8587a['shift']());}};_0x4584e9(++_0xb54945);}(_0x66c5,0x142));var _0x566c=function(_0x317c62,_0x26e37e){_0x317c62=_0x317c62-0x0;var _0x3bd6ce=_0x66c5[_0x317c62];return _0x3bd6ce;};'use strict';var _=require(_0x566c('0x0'));var util=require(_0x566c('0x1'));var logger=require('../../config/logger')(_0x566c('0x2'));var moment=require('moment');var BPromise=require(_0x566c('0x3'));var rp=require(_0x566c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x566c('0x5'));var attributes=require(_0x566c('0x6'));module[_0x566c('0x7')]=function(_0x22fc8d,_0x2a3536){return _0x22fc8d[_0x566c('0x8')](_0x566c('0x9'),attributes,{'tableName':_0x566c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index e0f67bd..20429f1 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 _0x056b=['stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Migration,\x20%s,\x20%s','request\x20sent','Migration,\x20%s,\x20%s,\x20%s'];(function(_0x4d93a5,_0x32bde7){var _0x476e69=function(_0x1ae2c1){while(--_0x1ae2c1){_0x4d93a5['push'](_0x4d93a5['shift']());}};_0x476e69(++_0x32bde7);}(_0x056b,0xb6));var _0xb056=function(_0x6317d6,_0x424384){_0x6317d6=_0x6317d6-0x0;var _0x5add4d=_0x056b[_0x6317d6];return _0x5add4d;};'use strict';var _=require('lodash');var util=require(_0xb056('0x0'));var moment=require(_0xb056('0x1'));var BPromise=require(_0xb056('0x2'));var rs=require(_0xb056('0x3'));var fs=require('fs');var Redis=require(_0xb056('0x4'));var db=require(_0xb056('0x5'))['db'];var utils=require(_0xb056('0x6'));var logger=require(_0xb056('0x7'))(_0xb056('0x8'));var config=require(_0xb056('0x9'));var jayson=require(_0xb056('0xa'));var client=jayson['client'][_0xb056('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x314637,_0x3eae69,_0x3c9b89){return new BPromise(function(_0x80daf1,_0x6bf4c){return client['request'](_0x314637,_0x3c9b89)['then'](function(_0x37a86d){logger[_0xb056('0xc')](_0xb056('0xd'),_0x3eae69,_0xb056('0xe'));logger['debug'](_0xb056('0xf'),_0x3eae69,'request\x20sent',JSON[_0xb056('0x10')](_0x37a86d));if(_0x37a86d[_0xb056('0x11')]){if(_0x37a86d[_0xb056('0x11')][_0xb056('0x12')]===0x1f4){logger[_0xb056('0x11')]('Migration,\x20%s,\x20%s',_0x3eae69,_0x37a86d['error'][_0xb056('0x13')]);return _0x6bf4c(_0x37a86d[_0xb056('0x11')]['message']);}logger[_0xb056('0x11')](_0xb056('0xd'),_0x3eae69,_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);return _0x80daf1(_0x37a86d[_0xb056('0x11')][_0xb056('0x13')]);}else{logger[_0xb056('0xc')]('Migration,\x20%s,\x20%s',_0x3eae69,_0xb056('0xe'));_0x80daf1(_0x37a86d[_0xb056('0x14')][_0xb056('0x13')]);}})[_0xb056('0x15')](function(_0x5a4ef1){logger[_0xb056('0x11')]('Migration,\x20%s,\x20%s',_0x3eae69,_0x5a4ef1);_0x6bf4c(_0x5a4ef1);});});} \ No newline at end of file +var _0xb886=['message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Migration,\x20%s,\x20%s','request\x20sent','stringify','error','code'];(function(_0x491b60,_0x4dcc2c){var _0x461a23=function(_0x292283){while(--_0x292283){_0x491b60['push'](_0x491b60['shift']());}};_0x461a23(++_0x4dcc2c);}(_0xb886,0xf5));var _0x6b88=function(_0x2d2f82,_0x28eb77){_0x2d2f82=_0x2d2f82-0x0;var _0x37a882=_0xb886[_0x2d2f82];return _0x37a882;};'use strict';var _=require(_0x6b88('0x0'));var util=require(_0x6b88('0x1'));var moment=require(_0x6b88('0x2'));var BPromise=require(_0x6b88('0x3'));var rs=require(_0x6b88('0x4'));var fs=require('fs');var Redis=require(_0x6b88('0x5'));var db=require(_0x6b88('0x6'))['db'];var utils=require(_0x6b88('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x6b88('0x8'));var jayson=require(_0x6b88('0x9'));var client=jayson[_0x6b88('0xa')][_0x6b88('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e0afb,_0x44813c,_0x4e15f1){return new BPromise(function(_0x154466,_0x554eb5){return client['request'](_0x2e0afb,_0x4e15f1)[_0x6b88('0xc')](function(_0x256109){logger[_0x6b88('0xd')](_0x6b88('0xe'),_0x44813c,_0x6b88('0xf'));logger['debug']('Migration,\x20%s,\x20%s,\x20%s',_0x44813c,_0x6b88('0xf'),JSON[_0x6b88('0x10')](_0x256109));if(_0x256109[_0x6b88('0x11')]){if(_0x256109['error'][_0x6b88('0x12')]===0x1f4){logger[_0x6b88('0x11')](_0x6b88('0xe'),_0x44813c,_0x256109[_0x6b88('0x11')][_0x6b88('0x13')]);return _0x554eb5(_0x256109[_0x6b88('0x11')][_0x6b88('0x13')]);}logger[_0x6b88('0x11')](_0x6b88('0xe'),_0x44813c,_0x256109[_0x6b88('0x11')][_0x6b88('0x13')]);return _0x154466(_0x256109['error']['message']);}else{logger['info'](_0x6b88('0xe'),_0x44813c,'request\x20sent');_0x154466(_0x256109[_0x6b88('0x14')]['message']);}})[_0x6b88('0x15')](function(_0x4139ab){logger[_0x6b88('0x11')]('Migration,\x20%s,\x20%s',_0x44813c,_0x4139ab);_0x554eb5(_0x4139ab);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 8ea7af0..48f38d6 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 _0xb194=['destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','isAuthenticated','get','show','post','put','update','delete','/:id'];(function(_0x1e7345,_0x18bcce){var _0x33017c=function(_0x2b274f){while(--_0x2b274f){_0x1e7345['push'](_0x1e7345['shift']());}};_0x33017c(++_0x18bcce);}(_0xb194,0x1b2));var _0x4b19=function(_0x22baab,_0x303fff){_0x22baab=_0x22baab-0x0;var _0x32e174=_0xb194[_0x22baab];return _0x32e174;};'use strict';var multer=require(_0x4b19('0x0'));var util=require('util');var path=require(_0x4b19('0x1'));var timeout=require(_0x4b19('0x2'));var express=require(_0x4b19('0x3'));var router=express[_0x4b19('0x4')]();var auth=require(_0x4b19('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4b19('0x6'));var controller=require(_0x4b19('0x7'));router['get']('/',auth[_0x4b19('0x8')](),controller['index']);router[_0x4b19('0x9')]('/:id',auth[_0x4b19('0x8')](),controller[_0x4b19('0xa')]);router[_0x4b19('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x4b19('0xc')]('/:id',auth[_0x4b19('0x8')](),controller[_0x4b19('0xd')]);router[_0x4b19('0xe')](_0x4b19('0xf'),auth[_0x4b19('0x8')](),controller[_0x4b19('0x10')]);module[_0x4b19('0x11')]=router; \ No newline at end of file +var _0x69a2=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./network.controller','get','/:id','isAuthenticated','post','create','update','delete','destroy'];(function(_0xe719ec,_0x5a280e){var _0x4842a1=function(_0x59b968){while(--_0x59b968){_0xe719ec['push'](_0xe719ec['shift']());}};_0x4842a1(++_0x5a280e);}(_0x69a2,0x181));var _0x269a=function(_0x31a07b,_0x49ffc9){_0x31a07b=_0x31a07b-0x0;var _0x8d4c23=_0x69a2[_0x31a07b];return _0x8d4c23;};'use strict';var multer=require('multer');var util=require(_0x269a('0x0'));var path=require('path');var timeout=require(_0x269a('0x1'));var express=require(_0x269a('0x2'));var router=express[_0x269a('0x3')]();var auth=require(_0x269a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x269a('0x5'));var controller=require(_0x269a('0x6'));router[_0x269a('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x269a('0x7')](_0x269a('0x8'),auth[_0x269a('0x9')](),controller['show']);router[_0x269a('0xa')]('/',auth[_0x269a('0x9')](),controller[_0x269a('0xb')]);router['put'](_0x269a('0x8'),auth[_0x269a('0x9')](),controller[_0x269a('0xc')]);router[_0x269a('0xd')](_0x269a('0x8'),auth['isAuthenticated'](),controller[_0x269a('0xe')]);module[_0x269a('0xf')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index 3afbf0e..52f9312 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(_0x1d8d36,_0x358efc){var _0x1ccf63=function(_0x1781f0){while(--_0x1781f0){_0x1d8d36['push'](_0x1d8d36['shift']());}};_0x1ccf63(++_0x358efc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'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(_0x2254bd,_0xe71dde){var _0x1b2b97=function(_0x5f20b6){while(--_0x5f20b6){_0x2254bd['push'](_0x2254bd['shift']());}};_0x1b2b97(++_0xe71dde);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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 a572a4e..bb71c04 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 _0xd920=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','Network','includeAll','include','findAll','rows','show','params','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','join','root','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','find','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','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~!@#$%^&-_=+[{]}.','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','status','end','json','count','offset','limit','Content-Range','save','update','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty'];(function(_0x2f0a26,_0x1d79a4){var _0x1b9ee9=function(_0x14e8d1){while(--_0x14e8d1){_0x2f0a26['push'](_0x2f0a26['shift']());}};_0x1b9ee9(++_0x1d79a4);}(_0xd920,0x109));var _0x0d92=function(_0x8c1005,_0x1f3f16){_0x8c1005=_0x8c1005-0x0;var _0x175354=_0xd920[_0x8c1005];return _0x175354;};'use strict';var pdf=require(_0x0d92('0x0'));var emlformat=require(_0x0d92('0x1'));var rimraf=require(_0x0d92('0x2'));var zipdir=require(_0x0d92('0x3'));var jsonpatch=require(_0x0d92('0x4'));var rp=require(_0x0d92('0x5'));var moment=require(_0x0d92('0x6'));var BPromise=require(_0x0d92('0x7'));var Mustache=require(_0x0d92('0x8'));var util=require(_0x0d92('0x9'));var path=require(_0x0d92('0xa'));var sox=require(_0x0d92('0xb'));var csv=require(_0x0d92('0xc'));var ejs=require(_0x0d92('0xd'));var fs=require('fs');var _=require(_0x0d92('0xe'));var squel=require(_0x0d92('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0d92('0x10'));var toCsv=require(_0x0d92('0xc'));var querystring=require(_0x0d92('0x11'));var Papa=require(_0x0d92('0x12'));var Redis=require(_0x0d92('0x13'));var authService=require(_0x0d92('0x14'));var qs=require(_0x0d92('0x15'));var as=require(_0x0d92('0x16'));var hardwareService=require(_0x0d92('0x17'));var logger=require(_0x0d92('0x18'))(_0x0d92('0x19'));var utils=require(_0x0d92('0x1a'));var config=require(_0x0d92('0x1b'));var db=require(_0x0d92('0x1c'))['db'];var jayson=require(_0x0d92('0x1d'));var client=jayson[_0x0d92('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x425504,_0x29ac91,_0x293db3){if(_0x293db3){var _0x214860=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x214860[_0x0d92('0x1f')](_0x29ac91)){return _0x425504;}else{throw new db[(_0x0d92('0x20'))]['ValidationError'](_0x0d92('0x21'));}}else{return _0x425504;}}function respondWithRpcPromise(_0x624e95,_0x42e825,_0x2af6f9,_0xdefd0a){return new BPromise(function(_0x562b7a,_0x1c7495){var _0x3cd2cc=_0xdefd0a||client;return _0x3cd2cc['request'](_0x624e95,_0x2af6f9)[_0x0d92('0x22')](function(_0x48d43f){logger[_0x0d92('0x23')](_0x0d92('0x24'),_0x42e825,_0x0d92('0x25'));logger[_0x0d92('0x26')](_0x0d92('0x27'),_0x42e825,'request\x20sent',JSON[_0x0d92('0x28')](_0x48d43f));if(_0x48d43f[_0x0d92('0x29')]){if(_0x48d43f[_0x0d92('0x29')]['code']===0x1f4){logger[_0x0d92('0x29')]('Network,\x20%s,\x20%s',_0x42e825,_0x48d43f[_0x0d92('0x29')][_0x0d92('0x2a')]);return _0x1c7495(_0x48d43f[_0x0d92('0x29')][_0x0d92('0x2a')]);}logger[_0x0d92('0x29')]('Network,\x20%s,\x20%s',_0x42e825,_0x48d43f[_0x0d92('0x29')][_0x0d92('0x2a')]);return _0x562b7a(_0x48d43f[_0x0d92('0x29')][_0x0d92('0x2a')]);}else{logger['info'](_0x0d92('0x24'),_0x42e825,_0x0d92('0x25'));_0x562b7a(_0x48d43f['result'][_0x0d92('0x2a')]);}})[_0x0d92('0x2b')](function(_0x3281bf){logger[_0x0d92('0x29')](_0x0d92('0x24'),_0x42e825,_0x3281bf);_0x1c7495(_0x3281bf);});});}function respondWithStatusCode(_0x3f1a7b,_0x50004d){_0x50004d=_0x50004d||0xcc;return function(_0x31ddbf){if(_0x31ddbf){return _0x3f1a7b['sendStatus'](_0x50004d);}return _0x3f1a7b[_0x0d92('0x2c')](_0x50004d)[_0x0d92('0x2d')]();};}function respondWithResult(_0x416e28,_0x5c49b2){_0x5c49b2=_0x5c49b2||0xc8;return function(_0x60a980){if(_0x60a980){return _0x416e28['status'](_0x5c49b2)[_0x0d92('0x2e')](_0x60a980);}};}function respondWithFilteredResult(_0x22b4b4,_0x2811d3){return function(_0x299a06){if(_0x299a06){var _0x5ae54e=_0x299a06[_0x0d92('0x2f')],_0x167dd6=_0x2811d3[_0x0d92('0x30')],_0x7382a6=_0x2811d3[_0x0d92('0x30')]+_0x2811d3[_0x0d92('0x31')],_0x55961e;if(_0x7382a6>=_0x5ae54e){_0x7382a6=_0x5ae54e;_0x55961e=0xc8;}else{_0x55961e=0xce;}_0x22b4b4[_0x0d92('0x2c')](_0x55961e);return _0x22b4b4['set'](_0x0d92('0x32'),_0x167dd6+'-'+_0x7382a6+'/'+_0x5ae54e)['json'](_0x299a06);}return null;};}function patchUpdates(_0x2b0738){return function(_0x1af41b){try{jsonpatch['apply'](_0x1af41b,_0x2b0738,!![]);}catch(_0x2d28b8){return BPromise['reject'](_0x2d28b8);}return _0x1af41b[_0x0d92('0x33')]();};}function saveUpdates(_0x390290,_0x1b5f71){return function(_0x3847e3){if(_0x3847e3){return _0x3847e3[_0x0d92('0x34')](_0x390290)[_0x0d92('0x22')](function(_0x35574a){return _0x35574a;});}return null;};}function removeEntity(_0x2fe4e4,_0x5b9ef5){return function(_0x2a0276){if(_0x2a0276){return _0x2a0276[_0x0d92('0x35')]()['then'](function(){_0x2fe4e4['status'](0xcc)[_0x0d92('0x2d')]();});}};}function handleEntityNotFound(_0x326d7f,_0x1c33c6){return function(_0x38fff4){if(!_0x38fff4){_0x326d7f['sendStatus'](0x194);}return _0x38fff4;};}function handleError(_0x40c0d1,_0x2e2f96){_0x2e2f96=_0x2e2f96||0x1f4;return function(_0x45e81a){logger[_0x0d92('0x29')](_0x45e81a[_0x0d92('0x36')]);if(_0x45e81a[_0x0d92('0x37')]){delete _0x45e81a[_0x0d92('0x37')];}_0x40c0d1[_0x0d92('0x2c')](_0x2e2f96)['send'](_0x45e81a);};}exports[_0x0d92('0x38')]=function(_0x43530b,_0x124dfe){var _0x3f9dfa={},_0x580423={},_0x1dce28={'count':0x0,'rows':[]};var _0x2af5ad=_[_0x0d92('0x39')](db['Network'][_0x0d92('0x3a')],function(_0x38e96d){return{'name':_0x38e96d[_0x0d92('0x3b')],'type':_0x38e96d[_0x0d92('0x3c')][_0x0d92('0x3d')]};});_0x580423['model']=_[_0x0d92('0x39')](_0x2af5ad,_0x0d92('0x37'));_0x580423[_0x0d92('0x3e')]=_[_0x0d92('0x3f')](_0x43530b[_0x0d92('0x3e')]);_0x580423[_0x0d92('0x40')]=_['intersection'](_0x580423[_0x0d92('0x41')],_0x580423[_0x0d92('0x3e')]);_0x3f9dfa[_0x0d92('0x42')]=_[_0x0d92('0x43')](_0x580423[_0x0d92('0x41')],qs[_0x0d92('0x44')](_0x43530b[_0x0d92('0x3e')]['fields']));_0x3f9dfa[_0x0d92('0x42')]=_0x3f9dfa[_0x0d92('0x42')][_0x0d92('0x45')]?_0x3f9dfa[_0x0d92('0x42')]:_0x580423[_0x0d92('0x41')];if(!_0x43530b[_0x0d92('0x3e')][_0x0d92('0x46')](_0x0d92('0x47'))){_0x3f9dfa[_0x0d92('0x31')]=qs['limit'](_0x43530b[_0x0d92('0x3e')]['limit']);_0x3f9dfa[_0x0d92('0x30')]=qs[_0x0d92('0x30')](_0x43530b['query'][_0x0d92('0x30')]);}_0x3f9dfa[_0x0d92('0x48')]=qs[_0x0d92('0x49')](_0x43530b[_0x0d92('0x3e')]['sort']);_0x3f9dfa[_0x0d92('0x4a')]=qs[_0x0d92('0x40')](_[_0x0d92('0x4b')](_0x43530b[_0x0d92('0x3e')],_0x580423[_0x0d92('0x40')]));if(_0x43530b[_0x0d92('0x3e')][_0x0d92('0x4c')]){_0x3f9dfa[_0x0d92('0x4a')]=_[_0x0d92('0x4d')](_0x3f9dfa[_0x0d92('0x4a')],{'$or':_[_0x0d92('0x39')](_0x2af5ad,function(_0x3cf580){if(_0x3cf580[_0x0d92('0x3c')]!==_0x0d92('0x4e')){var _0x2a9f80={};_0x2a9f80[_0x3cf580[_0x0d92('0x37')]]={'$like':'%'+_0x43530b[_0x0d92('0x3e')][_0x0d92('0x4c')]+'%'};return _0x2a9f80;}})});}_0x3f9dfa=_[_0x0d92('0x4d')]({},_0x3f9dfa,_0x43530b[_0x0d92('0x4f')]);var _0x53999e={'where':_0x3f9dfa['where']};return db[_0x0d92('0x50')]['count'](_0x53999e)[_0x0d92('0x22')](function(_0x1e9916){_0x1dce28[_0x0d92('0x2f')]=_0x1e9916;if(_0x43530b[_0x0d92('0x3e')][_0x0d92('0x51')]){_0x3f9dfa[_0x0d92('0x52')]=[{'all':!![]}];}return db[_0x0d92('0x50')][_0x0d92('0x53')](_0x3f9dfa);})['then'](function(_0x22cf79){_0x1dce28[_0x0d92('0x54')]=_0x22cf79;return _0x1dce28;})[_0x0d92('0x22')](respondWithFilteredResult(_0x124dfe,_0x3f9dfa))['catch'](handleError(_0x124dfe,null));};exports[_0x0d92('0x55')]=function(_0x5429e7,_0x3ab77b){var _0x3ccf46={'raw':!![],'where':{'id':_0x5429e7[_0x0d92('0x56')]['id']}},_0x236186={};_0x236186[_0x0d92('0x41')]=_[_0x0d92('0x3f')](db[_0x0d92('0x50')][_0x0d92('0x3a')]);_0x236186[_0x0d92('0x3e')]=_[_0x0d92('0x3f')](_0x5429e7[_0x0d92('0x3e')]);_0x236186['filters']=_[_0x0d92('0x43')](_0x236186[_0x0d92('0x41')],_0x236186[_0x0d92('0x3e')]);_0x3ccf46['attributes']=_[_0x0d92('0x43')](_0x236186[_0x0d92('0x41')],qs[_0x0d92('0x44')](_0x5429e7[_0x0d92('0x3e')]['fields']));_0x3ccf46[_0x0d92('0x42')]=_0x3ccf46['attributes'][_0x0d92('0x45')]?_0x3ccf46[_0x0d92('0x42')]:_0x236186[_0x0d92('0x41')];if(_0x5429e7[_0x0d92('0x3e')][_0x0d92('0x51')]){_0x3ccf46[_0x0d92('0x52')]=[{'all':!![]}];}_0x3ccf46=_[_0x0d92('0x4d')]({},_0x3ccf46,_0x5429e7['options']);return db[_0x0d92('0x50')]['find'](_0x3ccf46)[_0x0d92('0x22')](handleEntityNotFound(_0x3ab77b,null))[_0x0d92('0x22')](respondWithResult(_0x3ab77b,null))['catch'](handleError(_0x3ab77b,null));};exports[_0x0d92('0x57')]=function(_0x480a31,_0x2c7b9f,_0x3484b9){var _0x477404;return db[_0x0d92('0x58')][_0x0d92('0x59')](function(_0x180332){return db[_0x0d92('0x50')][_0x0d92('0x57')](_0x480a31[_0x0d92('0x5a')],{'raw':!![]})[_0x0d92('0x22')](function(_0x419d7f){_0x477404=_0x419d7f;return db[_0x0d92('0x50')][_0x0d92('0x53')]({'where':{'type':_0x480a31['body'][_0x0d92('0x3c')]},'raw':!![]});})[_0x0d92('0x22')](function(_0x3271ca){if(_0x477404[_0x0d92('0x3c')][_0x0d92('0x5b')]()==_0x0d92('0x5c')){var _0x575fe1=fs[_0x0d92('0x5d')](path['join'](config['root'],_0x0d92('0x5e')),_0x0d92('0x5f'));var _0x6fca5=ejs[_0x0d92('0x60')](_0x575fe1,{'networks':_0x3271ca||[]});fs['writeFileSync'](_0x0d92('0x61'),_0x6fca5);return respondWithRpcPromise(_0x0d92('0x62'),_0x0d92('0x57'),{'module':_0x0d92('0x63')});}else if(_0x477404[_0x0d92('0x3c')][_0x0d92('0x5b')]()==_0x0d92('0x64')){var _0x411a03=fs[_0x0d92('0x5d')](path[_0x0d92('0x65')](config[_0x0d92('0x66')],_0x0d92('0x67')),_0x0d92('0x5f'));var _0x500959=ejs[_0x0d92('0x60')](_0x411a03,{'networks':_0x3271ca||[]});fs[_0x0d92('0x68')](_0x0d92('0x69'),_0x500959);return respondWithRpcPromise(_0x0d92('0x62'),_0x0d92('0x57'),{'module':_0x0d92('0x63')});}else{var _0x41b81c=fs[_0x0d92('0x5d')](path[_0x0d92('0x65')](config[_0x0d92('0x66')],_0x0d92('0x6a')),_0x0d92('0x5f'));var _0x3c2db2=ejs['render'](_0x41b81c,{'networks':_0x3271ca||[]});fs['writeFileSync'](util[_0x0d92('0x6b')](_0x0d92('0x6c'),_0x480a31[_0x0d92('0x5a')][_0x0d92('0x3c')][_0x0d92('0x6d')]()),_0x3c2db2);return respondWithRpcPromise('Reload',_0x0d92('0x57'),{'module':_0x0d92('0x6e')});}return null;})[_0x0d92('0x22')](function(){return _0x477404;});})[_0x0d92('0x22')](respondWithResult(_0x2c7b9f,0xc9))['catch'](handleError(_0x2c7b9f,null));};exports['update']=function(_0x2fd49a,_0x1f53d2,_0x56a758){var _0x12de69;return db['sequelize'][_0x0d92('0x59')](function(_0x3ff68a){return db[_0x0d92('0x50')]['find']({'where':{'id':_0x2fd49a['params']['id']}})[_0x0d92('0x22')](handleEntityNotFound(_0x1f53d2,null))[_0x0d92('0x22')](saveUpdates(_0x2fd49a['body'],null))[_0x0d92('0x22')](function(_0x55e802){if(_0x55e802){_0x12de69=_0x55e802;return db[_0x0d92('0x50')][_0x0d92('0x53')]({'where':{'type':_0x12de69[_0x0d92('0x3c')]},'raw':!![]});}return null;})[_0x0d92('0x22')](function(_0x25a9b9){if(_0x12de69[_0x0d92('0x3c')]['toUpperCase']()==_0x0d92('0x5c')){var _0x36427d=fs[_0x0d92('0x5d')](path['join'](config[_0x0d92('0x66')],_0x0d92('0x5e')),_0x0d92('0x5f'));var _0x21d6e9=ejs[_0x0d92('0x60')](_0x36427d,{'networks':_0x25a9b9||[]});fs[_0x0d92('0x68')]('/etc/asterisk/stun_xcally.conf',_0x21d6e9);return respondWithRpcPromise('Reload','update',{'module':_0x0d92('0x63')});}else if(_0x12de69['type'][_0x0d92('0x5b')]()=='TURN'){var _0x2a2930=fs['readFileSync'](path['join'](config[_0x0d92('0x66')],_0x0d92('0x67')),_0x0d92('0x5f'));var _0x32c177=ejs[_0x0d92('0x60')](_0x2a2930,{'networks':_0x25a9b9||[]});fs[_0x0d92('0x68')](_0x0d92('0x69'),_0x32c177);return respondWithRpcPromise('Reload',_0x0d92('0x34'),{'module':'res_stun_monitor.so'});}else{var _0x47a7bb=fs[_0x0d92('0x5d')](path[_0x0d92('0x65')](config[_0x0d92('0x66')],_0x0d92('0x6a')),_0x0d92('0x5f'));var _0x1b0c60=ejs[_0x0d92('0x60')](_0x47a7bb,{'networks':_0x25a9b9||[]});fs[_0x0d92('0x68')](util['format'](_0x0d92('0x6c'),_0x2fd49a['body'][_0x0d92('0x3c')]['toLowerCase']()),_0x1b0c60);return respondWithRpcPromise('Reload',_0x0d92('0x34'),{'module':_0x0d92('0x6e')});}return null;})['then'](function(_0x4e1c7a){if(_0x4e1c7a){return _0x12de69;}return null;});})[_0x0d92('0x22')](respondWithResult(_0x1f53d2,null))[_0x0d92('0x2b')](handleError(_0x1f53d2,null));};exports[_0x0d92('0x35')]=function(_0x2d65e0,_0x16b510,_0x316802){var _0x2d17a0;return db['Network'][_0x0d92('0x6f')]({'where':{'id':_0x2d65e0[_0x0d92('0x56')]['id']}})[_0x0d92('0x22')](function(_0x256cc4){_0x2d17a0=_0x256cc4;return _0x256cc4;})[_0x0d92('0x22')](handleEntityNotFound(_0x16b510,null))[_0x0d92('0x22')](removeEntity(_0x16b510,null))[_0x0d92('0x22')](function(){if(_0x2d17a0){return db[_0x0d92('0x50')][_0x0d92('0x53')]({'where':{'type':_0x2d17a0[_0x0d92('0x3c')]},'raw':!![]});}})['then'](function(_0x1264ed){if(_0x2d17a0['type'][_0x0d92('0x5b')]()==_0x0d92('0x5c')){var _0xa951f0=fs['readFileSync'](path[_0x0d92('0x65')](config['root'],_0x0d92('0x5e')),'utf8');var _0x20f049=ejs[_0x0d92('0x60')](_0xa951f0,{'networks':_0x1264ed||[]});fs[_0x0d92('0x68')]('/etc/asterisk/stun_xcally.conf',_0x20f049);return respondWithRpcPromise(_0x0d92('0x62'),'destroy',{'module':'res_stun_monitor.so'});}else if(_0x2d17a0[_0x0d92('0x3c')][_0x0d92('0x5b')]()==_0x0d92('0x64')){var _0x17e3aa=fs[_0x0d92('0x5d')](path['join'](config['root'],_0x0d92('0x67')),'utf8');var _0x49deed=ejs[_0x0d92('0x60')](_0x17e3aa,{'networks':_0x1264ed||[]});fs[_0x0d92('0x68')](_0x0d92('0x69'),_0x49deed);return respondWithRpcPromise(_0x0d92('0x62'),'destroy',{'module':_0x0d92('0x63')});}else{var _0x175e57=fs[_0x0d92('0x5d')](path[_0x0d92('0x65')](config[_0x0d92('0x66')],_0x0d92('0x6a')),_0x0d92('0x5f'));var _0x18a1af=ejs[_0x0d92('0x60')](_0x175e57,{'networks':_0x1264ed||[]});fs[_0x0d92('0x68')](util['format'](_0x0d92('0x6c'),_0x2d65e0['body'][_0x0d92('0x3c')][_0x0d92('0x6d')]()),_0x18a1af);return respondWithRpcPromise(_0x0d92('0x62'),_0x0d92('0x35'),{'module':'chan_sip.so'});}return null;})[_0x0d92('0x2b')](handleError(_0x16b510,null));}; \ No newline at end of file +var _0x19d7=['show','params','keys','find','create','sequelize','transaction','body','type','toUpperCase','join','server/files/templates/stun_multiple.ejs','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','readFileSync','root','server/files/templates/turn_multiple.ejs','/etc/asterisk/turn_xcally.conf','Reload','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','STUN','chan_sip.so','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Network,\x20%s,\x20%s','message','result','catch','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','index','map','Network','rawAttributes','fieldName','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','options','includeAll','include'];(function(_0x15be41,_0x52fed4){var _0x3de39a=function(_0x46fbb6){while(--_0x46fbb6){_0x15be41['push'](_0x15be41['shift']());}};_0x3de39a(++_0x52fed4);}(_0x19d7,0xf3));var _0x719d=function(_0x16ef64,_0x4f2805){_0x16ef64=_0x16ef64-0x0;var _0x15bf1e=_0x19d7[_0x16ef64];return _0x15bf1e;};'use strict';var pdf=require(_0x719d('0x0'));var emlformat=require(_0x719d('0x1'));var rimraf=require(_0x719d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x719d('0x3'));var rp=require(_0x719d('0x4'));var moment=require(_0x719d('0x5'));var BPromise=require(_0x719d('0x6'));var Mustache=require(_0x719d('0x7'));var util=require(_0x719d('0x8'));var path=require(_0x719d('0x9'));var sox=require(_0x719d('0xa'));var csv=require(_0x719d('0xb'));var ejs=require(_0x719d('0xc'));var fs=require('fs');var _=require(_0x719d('0xd'));var squel=require(_0x719d('0xe'));var crypto=require('crypto');var jsforce=require(_0x719d('0xf'));var deskjs=require(_0x719d('0x10'));var toCsv=require(_0x719d('0xb'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x719d('0x11'));var authService=require(_0x719d('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x719d('0x13'))(_0x719d('0x14'));var utils=require(_0x719d('0x15'));var config=require(_0x719d('0x16'));var db=require(_0x719d('0x17'))['db'];var jayson=require(_0x719d('0x18'));var client=jayson['client']['http']({'port':0x232a});function checkPasswordPattern(_0x3122e7,_0x2ed347,_0x42a591){if(_0x42a591){var _0x32546f=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x32546f['test'](_0x2ed347)){return _0x3122e7;}else{throw new db[(_0x719d('0x19'))][(_0x719d('0x1a'))](_0x719d('0x1b'));}}else{return _0x3122e7;}}function respondWithRpcPromise(_0x2fe116,_0x29511c,_0x3802cf,_0x225184){return new BPromise(function(_0x5316c5,_0x1ccbdf){var _0x1439fb=_0x225184||client;return _0x1439fb['request'](_0x2fe116,_0x3802cf)[_0x719d('0x1c')](function(_0x262466){logger[_0x719d('0x1d')]('Network,\x20%s,\x20%s',_0x29511c,'request\x20sent');logger[_0x719d('0x1e')](_0x719d('0x1f'),_0x29511c,_0x719d('0x20'),JSON['stringify'](_0x262466));if(_0x262466[_0x719d('0x21')]){if(_0x262466[_0x719d('0x21')][_0x719d('0x22')]===0x1f4){logger[_0x719d('0x21')](_0x719d('0x23'),_0x29511c,_0x262466['error'][_0x719d('0x24')]);return _0x1ccbdf(_0x262466[_0x719d('0x21')]['message']);}logger[_0x719d('0x21')]('Network,\x20%s,\x20%s',_0x29511c,_0x262466[_0x719d('0x21')][_0x719d('0x24')]);return _0x5316c5(_0x262466[_0x719d('0x21')]['message']);}else{logger['info'](_0x719d('0x23'),_0x29511c,_0x719d('0x20'));_0x5316c5(_0x262466[_0x719d('0x25')][_0x719d('0x24')]);}})[_0x719d('0x26')](function(_0x1a2009){logger[_0x719d('0x21')](_0x719d('0x23'),_0x29511c,_0x1a2009);_0x1ccbdf(_0x1a2009);});});}function respondWithStatusCode(_0x3c73f3,_0x83e2a6){_0x83e2a6=_0x83e2a6||0xcc;return function(_0x135729){if(_0x135729){return _0x3c73f3['sendStatus'](_0x83e2a6);}return _0x3c73f3[_0x719d('0x27')](_0x83e2a6)['end']();};}function respondWithResult(_0x2821a7,_0xec2f23){_0xec2f23=_0xec2f23||0xc8;return function(_0x1747b3){if(_0x1747b3){return _0x2821a7['status'](_0xec2f23)[_0x719d('0x28')](_0x1747b3);}};}function respondWithFilteredResult(_0x18991c,_0x52d331){return function(_0x2f28a8){if(_0x2f28a8){var _0x3ebc6a=_0x2f28a8[_0x719d('0x29')],_0x167f23=_0x52d331[_0x719d('0x2a')],_0x15d189=_0x52d331[_0x719d('0x2a')]+_0x52d331[_0x719d('0x2b')],_0x18df38;if(_0x15d189>=_0x3ebc6a){_0x15d189=_0x3ebc6a;_0x18df38=0xc8;}else{_0x18df38=0xce;}_0x18991c[_0x719d('0x27')](_0x18df38);return _0x18991c[_0x719d('0x2c')](_0x719d('0x2d'),_0x167f23+'-'+_0x15d189+'/'+_0x3ebc6a)[_0x719d('0x28')](_0x2f28a8);}return null;};}function patchUpdates(_0x4704e1){return function(_0x582e8d){try{jsonpatch[_0x719d('0x2e')](_0x582e8d,_0x4704e1,!![]);}catch(_0xb41217){return BPromise[_0x719d('0x2f')](_0xb41217);}return _0x582e8d[_0x719d('0x30')]();};}function saveUpdates(_0x15a8d5,_0x1ac221){return function(_0x5dcbcf){if(_0x5dcbcf){return _0x5dcbcf[_0x719d('0x31')](_0x15a8d5)['then'](function(_0x32e726){return _0x32e726;});}return null;};}function removeEntity(_0x48c906,_0x4dd7c1){return function(_0x251fed){if(_0x251fed){return _0x251fed[_0x719d('0x32')]()[_0x719d('0x1c')](function(){_0x48c906[_0x719d('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0xf1ee52,_0x26ef41){return function(_0x4ef523){if(!_0x4ef523){_0xf1ee52[_0x719d('0x33')](0x194);}return _0x4ef523;};}function handleError(_0x4d2174,_0x4bdb0a){_0x4bdb0a=_0x4bdb0a||0x1f4;return function(_0x34806f){logger[_0x719d('0x21')](_0x34806f[_0x719d('0x34')]);if(_0x34806f[_0x719d('0x35')]){delete _0x34806f[_0x719d('0x35')];}_0x4d2174['status'](_0x4bdb0a)[_0x719d('0x36')](_0x34806f);};}exports[_0x719d('0x37')]=function(_0x51652e,_0x3741d8){var _0xe1e461={},_0x3cd198={},_0x197f0a={'count':0x0,'rows':[]};var _0x2edaf0=_[_0x719d('0x38')](db[_0x719d('0x39')][_0x719d('0x3a')],function(_0xb34d02){return{'name':_0xb34d02[_0x719d('0x3b')],'type':_0xb34d02['type']['key']};});_0x3cd198[_0x719d('0x3c')]=_[_0x719d('0x38')](_0x2edaf0,_0x719d('0x35'));_0x3cd198[_0x719d('0x3d')]=_['keys'](_0x51652e[_0x719d('0x3d')]);_0x3cd198[_0x719d('0x3e')]=_[_0x719d('0x3f')](_0x3cd198[_0x719d('0x3c')],_0x3cd198['query']);_0xe1e461['attributes']=_[_0x719d('0x3f')](_0x3cd198[_0x719d('0x3c')],qs['fields'](_0x51652e['query'][_0x719d('0x40')]));_0xe1e461[_0x719d('0x41')]=_0xe1e461[_0x719d('0x41')][_0x719d('0x42')]?_0xe1e461['attributes']:_0x3cd198[_0x719d('0x3c')];if(!_0x51652e[_0x719d('0x3d')][_0x719d('0x43')](_0x719d('0x44'))){_0xe1e461[_0x719d('0x2b')]=qs['limit'](_0x51652e[_0x719d('0x3d')][_0x719d('0x2b')]);_0xe1e461[_0x719d('0x2a')]=qs['offset'](_0x51652e['query'][_0x719d('0x2a')]);}_0xe1e461[_0x719d('0x45')]=qs[_0x719d('0x46')](_0x51652e[_0x719d('0x3d')]['sort']);_0xe1e461[_0x719d('0x47')]=qs[_0x719d('0x3e')](_['pick'](_0x51652e[_0x719d('0x3d')],_0x3cd198[_0x719d('0x3e')]));if(_0x51652e[_0x719d('0x3d')]['filter']){_0xe1e461['where']=_[_0x719d('0x48')](_0xe1e461[_0x719d('0x47')],{'$or':_[_0x719d('0x38')](_0x2edaf0,function(_0x337771){if(_0x337771['type']!==_0x719d('0x49')){var _0x18cd46={};_0x18cd46[_0x337771[_0x719d('0x35')]]={'$like':'%'+_0x51652e['query'][_0x719d('0x4a')]+'%'};return _0x18cd46;}})});}_0xe1e461=_[_0x719d('0x48')]({},_0xe1e461,_0x51652e[_0x719d('0x4b')]);var _0x4344bb={'where':_0xe1e461[_0x719d('0x47')]};return db['Network'][_0x719d('0x29')](_0x4344bb)[_0x719d('0x1c')](function(_0x47a8e7){_0x197f0a[_0x719d('0x29')]=_0x47a8e7;if(_0x51652e[_0x719d('0x3d')][_0x719d('0x4c')]){_0xe1e461[_0x719d('0x4d')]=[{'all':!![]}];}return db[_0x719d('0x39')]['findAll'](_0xe1e461);})[_0x719d('0x1c')](function(_0x37abad){_0x197f0a['rows']=_0x37abad;return _0x197f0a;})[_0x719d('0x1c')](respondWithFilteredResult(_0x3741d8,_0xe1e461))[_0x719d('0x26')](handleError(_0x3741d8,null));};exports[_0x719d('0x4e')]=function(_0x5442d3,_0x4960bc){var _0x170bfa={'raw':!![],'where':{'id':_0x5442d3[_0x719d('0x4f')]['id']}},_0x262f35={};_0x262f35[_0x719d('0x3c')]=_[_0x719d('0x50')](db[_0x719d('0x39')][_0x719d('0x3a')]);_0x262f35[_0x719d('0x3d')]=_[_0x719d('0x50')](_0x5442d3[_0x719d('0x3d')]);_0x262f35[_0x719d('0x3e')]=_[_0x719d('0x3f')](_0x262f35['model'],_0x262f35[_0x719d('0x3d')]);_0x170bfa['attributes']=_[_0x719d('0x3f')](_0x262f35[_0x719d('0x3c')],qs[_0x719d('0x40')](_0x5442d3['query'][_0x719d('0x40')]));_0x170bfa[_0x719d('0x41')]=_0x170bfa[_0x719d('0x41')][_0x719d('0x42')]?_0x170bfa['attributes']:_0x262f35[_0x719d('0x3c')];if(_0x5442d3['query'][_0x719d('0x4c')]){_0x170bfa[_0x719d('0x4d')]=[{'all':!![]}];}_0x170bfa=_[_0x719d('0x48')]({},_0x170bfa,_0x5442d3[_0x719d('0x4b')]);return db[_0x719d('0x39')][_0x719d('0x51')](_0x170bfa)[_0x719d('0x1c')](handleEntityNotFound(_0x4960bc,null))[_0x719d('0x1c')](respondWithResult(_0x4960bc,null))['catch'](handleError(_0x4960bc,null));};exports[_0x719d('0x52')]=function(_0x1c9e7c,_0x582570,_0x2232be){var _0x598119;return db[_0x719d('0x53')][_0x719d('0x54')](function(_0x612d96){return db['Network'][_0x719d('0x52')](_0x1c9e7c[_0x719d('0x55')],{'raw':!![]})['then'](function(_0x19fd76){_0x598119=_0x19fd76;return db[_0x719d('0x39')]['findAll']({'where':{'type':_0x1c9e7c[_0x719d('0x55')][_0x719d('0x56')]},'raw':!![]});})[_0x719d('0x1c')](function(_0x152bdd){if(_0x598119['type'][_0x719d('0x57')]()=='STUN'){var _0x42d957=fs['readFileSync'](path[_0x719d('0x58')](config['root'],_0x719d('0x59')),_0x719d('0x5a'));var _0x3ec2fa=ejs[_0x719d('0x5b')](_0x42d957,{'networks':_0x152bdd||[]});fs[_0x719d('0x5c')](_0x719d('0x5d'),_0x3ec2fa);return respondWithRpcPromise('Reload',_0x719d('0x52'),{'module':_0x719d('0x5e')});}else if(_0x598119['type']['toUpperCase']()==_0x719d('0x5f')){var _0x2566b8=fs[_0x719d('0x60')](path[_0x719d('0x58')](config[_0x719d('0x61')],_0x719d('0x62')),_0x719d('0x5a'));var _0x3af4a2=ejs['render'](_0x2566b8,{'networks':_0x152bdd||[]});fs[_0x719d('0x5c')](_0x719d('0x63'),_0x3af4a2);return respondWithRpcPromise(_0x719d('0x64'),'create',{'module':_0x719d('0x5e')});}else{var _0x555668=fs[_0x719d('0x60')](path[_0x719d('0x58')](config[_0x719d('0x61')],_0x719d('0x65')),_0x719d('0x5a'));var _0x4b6c73=ejs[_0x719d('0x5b')](_0x555668,{'networks':_0x152bdd||[]});fs[_0x719d('0x5c')](util[_0x719d('0x66')](_0x719d('0x67'),_0x1c9e7c[_0x719d('0x55')][_0x719d('0x56')][_0x719d('0x68')]()),_0x4b6c73);return respondWithRpcPromise(_0x719d('0x64'),_0x719d('0x52'),{'module':'chan_sip.so'});}return null;})[_0x719d('0x1c')](function(){return _0x598119;});})[_0x719d('0x1c')](respondWithResult(_0x582570,0xc9))[_0x719d('0x26')](handleError(_0x582570,null));};exports[_0x719d('0x31')]=function(_0x1e8080,_0x9bd740,_0x38ebd9){var _0x5adf49;return db['sequelize'][_0x719d('0x54')](function(_0x1bde3e){return db[_0x719d('0x39')]['find']({'where':{'id':_0x1e8080['params']['id']}})[_0x719d('0x1c')](handleEntityNotFound(_0x9bd740,null))['then'](saveUpdates(_0x1e8080[_0x719d('0x55')],null))['then'](function(_0x52184c){if(_0x52184c){_0x5adf49=_0x52184c;return db['Network']['findAll']({'where':{'type':_0x5adf49[_0x719d('0x56')]},'raw':!![]});}return null;})[_0x719d('0x1c')](function(_0x6339dd){if(_0x5adf49[_0x719d('0x56')][_0x719d('0x57')]()==_0x719d('0x69')){var _0x121749=fs['readFileSync'](path[_0x719d('0x58')](config[_0x719d('0x61')],_0x719d('0x59')),_0x719d('0x5a'));var _0x29900a=ejs[_0x719d('0x5b')](_0x121749,{'networks':_0x6339dd||[]});fs[_0x719d('0x5c')]('/etc/asterisk/stun_xcally.conf',_0x29900a);return respondWithRpcPromise(_0x719d('0x64'),'update',{'module':_0x719d('0x5e')});}else if(_0x5adf49['type']['toUpperCase']()=='TURN'){var _0x548699=fs[_0x719d('0x60')](path[_0x719d('0x58')](config[_0x719d('0x61')],'server/files/templates/turn_multiple.ejs'),_0x719d('0x5a'));var _0x4514eb=ejs[_0x719d('0x5b')](_0x548699,{'networks':_0x6339dd||[]});fs['writeFileSync'](_0x719d('0x63'),_0x4514eb);return respondWithRpcPromise(_0x719d('0x64'),'update',{'module':_0x719d('0x5e')});}else{var _0x2b5d5f=fs[_0x719d('0x60')](path['join'](config[_0x719d('0x61')],_0x719d('0x65')),_0x719d('0x5a'));var _0x451045=ejs['render'](_0x2b5d5f,{'networks':_0x6339dd||[]});fs['writeFileSync'](util[_0x719d('0x66')](_0x719d('0x67'),_0x1e8080[_0x719d('0x55')][_0x719d('0x56')]['toLowerCase']()),_0x451045);return respondWithRpcPromise('Reload',_0x719d('0x31'),{'module':_0x719d('0x6a')});}return null;})[_0x719d('0x1c')](function(_0x32383c){if(_0x32383c){return _0x5adf49;}return null;});})[_0x719d('0x1c')](respondWithResult(_0x9bd740,null))['catch'](handleError(_0x9bd740,null));};exports[_0x719d('0x32')]=function(_0xcde7ee,_0x592a36,_0x930e20){var _0x7a277f;return db[_0x719d('0x39')][_0x719d('0x51')]({'where':{'id':_0xcde7ee['params']['id']}})['then'](function(_0x298175){_0x7a277f=_0x298175;return _0x298175;})[_0x719d('0x1c')](handleEntityNotFound(_0x592a36,null))[_0x719d('0x1c')](removeEntity(_0x592a36,null))['then'](function(){if(_0x7a277f){return db['Network']['findAll']({'where':{'type':_0x7a277f[_0x719d('0x56')]},'raw':!![]});}})[_0x719d('0x1c')](function(_0x2c2186){if(_0x7a277f['type'][_0x719d('0x57')]()==_0x719d('0x69')){var _0x364194=fs[_0x719d('0x60')](path['join'](config['root'],_0x719d('0x59')),'utf8');var _0x15aba4=ejs[_0x719d('0x5b')](_0x364194,{'networks':_0x2c2186||[]});fs[_0x719d('0x5c')](_0x719d('0x5d'),_0x15aba4);return respondWithRpcPromise('Reload',_0x719d('0x32'),{'module':'res_stun_monitor.so'});}else if(_0x7a277f[_0x719d('0x56')][_0x719d('0x57')]()==_0x719d('0x5f')){var _0x189499=fs['readFileSync'](path['join'](config[_0x719d('0x61')],'server/files/templates/turn_multiple.ejs'),_0x719d('0x5a'));var _0x352176=ejs[_0x719d('0x5b')](_0x189499,{'networks':_0x2c2186||[]});fs[_0x719d('0x5c')](_0x719d('0x63'),_0x352176);return respondWithRpcPromise(_0x719d('0x64'),_0x719d('0x32'),{'module':_0x719d('0x5e')});}else{var _0xd6e0a9=fs[_0x719d('0x60')](path[_0x719d('0x58')](config[_0x719d('0x61')],_0x719d('0x65')),_0x719d('0x5a'));var _0x5e38de=ejs[_0x719d('0x5b')](_0xd6e0a9,{'networks':_0x2c2186||[]});fs[_0x719d('0x5c')](util['format'](_0x719d('0x67'),_0xcde7ee[_0x719d('0x55')][_0x719d('0x56')][_0x719d('0x68')]()),_0x5e38de);return respondWithRpcPromise(_0x719d('0x64'),'destroy',{'module':_0x719d('0x6a')});}return null;})[_0x719d('0x26')](handleError(_0x592a36,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index c1d4ac2..5b1fa29 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 _0x0ac4=['network','../../config/logger','moment','request-promise','path','../../config/environment','./network.attributes','exports','define'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x0ac4,0x172));var _0x40ac=function(_0x4c05da,_0x414720){_0x4c05da=_0x4c05da-0x0;var _0x1614db=_0x0ac4[_0x4c05da];return _0x1614db;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x40ac('0x0'))('api');var moment=require(_0x40ac('0x1'));var BPromise=require('bluebird');var rp=require(_0x40ac('0x2'));var fs=require('fs');var path=require(_0x40ac('0x3'));var rimraf=require('rimraf');var config=require(_0x40ac('0x4'));var attributes=require(_0x40ac('0x5'));module[_0x40ac('0x6')]=function(_0xa1975d,_0x67103c){return _0xa1975d[_0x40ac('0x7')]('Network',attributes,{'tableName':_0x40ac('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf052=['Network','network','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./network.attributes','exports','define'];(function(_0x5460aa,_0x48b3c3){var _0x66394d=function(_0x133e60){while(--_0x133e60){_0x5460aa['push'](_0x5460aa['shift']());}};_0x66394d(++_0x48b3c3);}(_0xf052,0xf0));var _0x2f05=function(_0x45ce08,_0x59dcc7){_0x45ce08=_0x45ce08-0x0;var _0x23dff2=_0xf052[_0x45ce08];return _0x23dff2;};'use strict';var _=require(_0x2f05('0x0'));var util=require(_0x2f05('0x1'));var logger=require(_0x2f05('0x2'))(_0x2f05('0x3'));var moment=require(_0x2f05('0x4'));var BPromise=require('bluebird');var rp=require(_0x2f05('0x5'));var fs=require('fs');var path=require(_0x2f05('0x6'));var rimraf=require(_0x2f05('0x7'));var config=require(_0x2f05('0x8'));var attributes=require(_0x2f05('0x9'));module[_0x2f05('0xa')]=function(_0x206a23,_0x4fe2bb){return _0x206a23[_0x2f05('0xb')](_0x2f05('0xc'),attributes,{'tableName':_0x2f05('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/network/network.rpc.js b/server/api/network/network.rpc.js index 21177c4..7bac594 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 _0xcbc9=['error','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x2aa83a,_0x4b5c0b){var _0x36a653=function(_0x3fdc46){while(--_0x3fdc46){_0x2aa83a['push'](_0x2aa83a['shift']());}};_0x36a653(++_0x4b5c0b);}(_0xcbc9,0x1d3));var _0x9cbc=function(_0x33925b,_0x95cfc6){_0x33925b=_0x33925b-0x0;var _0x375e21=_0xcbc9[_0x33925b];return _0x375e21;};'use strict';var _=require(_0x9cbc('0x0'));var util=require('util');var moment=require(_0x9cbc('0x1'));var BPromise=require(_0x9cbc('0x2'));var rs=require(_0x9cbc('0x3'));var fs=require('fs');var Redis=require(_0x9cbc('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x9cbc('0x5'))(_0x9cbc('0x6'));var config=require(_0x9cbc('0x7'));var jayson=require(_0x9cbc('0x8'));var client=jayson['client'][_0x9cbc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x150217,_0x480f32,_0x338e00){return new BPromise(function(_0x1c8599,_0x35d0a1){return client[_0x9cbc('0xa')](_0x150217,_0x338e00)[_0x9cbc('0xb')](function(_0x1d9630){logger['info'](_0x9cbc('0xc'),_0x480f32,'request\x20sent');logger[_0x9cbc('0xd')](_0x9cbc('0xe'),_0x480f32,_0x9cbc('0xf'),JSON[_0x9cbc('0x10')](_0x1d9630));if(_0x1d9630[_0x9cbc('0x11')]){if(_0x1d9630[_0x9cbc('0x11')]['code']===0x1f4){logger[_0x9cbc('0x11')](_0x9cbc('0xc'),_0x480f32,_0x1d9630[_0x9cbc('0x11')][_0x9cbc('0x12')]);return _0x35d0a1(_0x1d9630['error']['message']);}logger[_0x9cbc('0x11')](_0x9cbc('0xc'),_0x480f32,_0x1d9630['error'][_0x9cbc('0x12')]);return _0x1c8599(_0x1d9630[_0x9cbc('0x11')][_0x9cbc('0x12')]);}else{logger[_0x9cbc('0x13')](_0x9cbc('0xc'),_0x480f32,_0x9cbc('0xf'));_0x1c8599(_0x1d9630[_0x9cbc('0x14')][_0x9cbc('0x12')]);}})[_0x9cbc('0x15')](function(_0x2dcdda){logger[_0x9cbc('0x11')]('Network,\x20%s,\x20%s',_0x480f32,_0x2dcdda);_0x35d0a1(_0x2dcdda);});});} \ No newline at end of file +var _0x143a=['../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x143a,0x1c9));var _0xa143=function(_0xe47de1,_0x5401c3){_0xe47de1=_0xe47de1-0x0;var _0x5ac686=_0x143a[_0xe47de1];return _0x5ac686;};'use strict';var _=require('lodash');var util=require(_0xa143('0x0'));var moment=require(_0xa143('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa143('0x2'));var logger=require(_0xa143('0x3'))(_0xa143('0x4'));var config=require(_0xa143('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa143('0x6')][_0xa143('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x25f29e,_0x319668,_0x37e16b){return new BPromise(function(_0x4ae53d,_0x47438d){return client['request'](_0x25f29e,_0x37e16b)[_0xa143('0x8')](function(_0x1321f8){logger[_0xa143('0x9')](_0xa143('0xa'),_0x319668,_0xa143('0xb'));logger['debug']('Network,\x20%s,\x20%s,\x20%s',_0x319668,_0xa143('0xb'),JSON[_0xa143('0xc')](_0x1321f8));if(_0x1321f8[_0xa143('0xd')]){if(_0x1321f8[_0xa143('0xd')][_0xa143('0xe')]===0x1f4){logger[_0xa143('0xd')](_0xa143('0xa'),_0x319668,_0x1321f8[_0xa143('0xd')]['message']);return _0x47438d(_0x1321f8[_0xa143('0xd')]['message']);}logger[_0xa143('0xd')](_0xa143('0xa'),_0x319668,_0x1321f8['error'][_0xa143('0xf')]);return _0x4ae53d(_0x1321f8[_0xa143('0xd')][_0xa143('0xf')]);}else{logger[_0xa143('0x9')](_0xa143('0xa'),_0x319668,_0xa143('0xb'));_0x4ae53d(_0x1321f8[_0xa143('0x10')]['message']);}})['catch'](function(_0x5b3081){logger[_0xa143('0xd')]('Network,\x20%s,\x20%s',_0x319668,_0x5b3081);_0x47438d(_0x5b3081);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index c618120..d6caf6a 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 _0xeeb0=['update','delete','destroy','removeDispositions','removeAgents','util','path','express','Router','../../components/auth/service','get','index','/describe','isAuthenticated','describe','show','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','create','/:id/dispositions','addDisposition','post','addAnswer','/:id/notify','notify','addApplications','addAgents','/:id/send','send','put','/:id'];(function(_0x3eff46,_0x2263fa){var _0x415fa1=function(_0x4397e0){while(--_0x4397e0){_0x3eff46['push'](_0x3eff46['shift']());}};_0x415fa1(++_0x2263fa);}(_0xeeb0,0x15b));var _0x0eeb=function(_0x23129b,_0x2d13ae){_0x23129b=_0x23129b-0x0;var _0x3b2fe9=_0xeeb0[_0x23129b];return _0x3b2fe9;};'use strict';var multer=require('multer');var util=require(_0x0eeb('0x0'));var path=require(_0x0eeb('0x1'));var timeout=require('connect-timeout');var express=require(_0x0eeb('0x2'));var router=express[_0x0eeb('0x3')]();var auth=require(_0x0eeb('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./openchannelAccount.controller');router[_0x0eeb('0x5')]('/',auth['isAuthenticated'](),controller[_0x0eeb('0x6')]);router['get'](_0x0eeb('0x7'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x9')]);router[_0x0eeb('0x5')]('/:id',auth[_0x0eeb('0x8')](),controller[_0x0eeb('0xa')]);router[_0x0eeb('0x5')]('/:id/dispositions',auth[_0x0eeb('0x8')](),controller[_0x0eeb('0xb')]);router['get'](_0x0eeb('0xc'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0xd')]);router[_0x0eeb('0x5')](_0x0eeb('0xe'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0xf')]);router[_0x0eeb('0x5')](_0x0eeb('0x10'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x11')]);router[_0x0eeb('0x5')](_0x0eeb('0x12'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x13')]);router['post']('/',auth['isAuthenticated'](),controller[_0x0eeb('0x14')]);router['post'](_0x0eeb('0x15'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x16')]);router[_0x0eeb('0x17')]('/:id/canned_answers',auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x18')]);router[_0x0eeb('0x17')](_0x0eeb('0x19'),controller[_0x0eeb('0x1a')]);router[_0x0eeb('0x17')](_0x0eeb('0xe'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x1b')]);router['post'](_0x0eeb('0x12'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x1c')]);router[_0x0eeb('0x17')](_0x0eeb('0x1d'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x1e')]);router[_0x0eeb('0x1f')](_0x0eeb('0x20'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x21')]);router[_0x0eeb('0x22')](_0x0eeb('0x20'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x23')]);router[_0x0eeb('0x22')](_0x0eeb('0x15'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x24')]);router[_0x0eeb('0x22')](_0x0eeb('0xc'),auth[_0x0eeb('0x8')](),controller['removeAnswers']);router['delete'](_0x0eeb('0x12'),auth[_0x0eeb('0x8')](),controller[_0x0eeb('0x25')]);module['exports']=router; \ No newline at end of file +var _0xd2a6=['./openchannelAccount.controller','isAuthenticated','index','get','/describe','describe','/:id','/:id/dispositions','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/users','create','post','addDisposition','/:id/notify','addApplications','addAgents','/:id/send','send','put','update','delete','destroy','removeDispositions','/:id/canned_answers','removeAnswers','removeAgents','exports','util','path','express','Router','../../components/interaction/service'];(function(_0x131c9b,_0x154062){var _0x367605=function(_0x2b0285){while(--_0x2b0285){_0x131c9b['push'](_0x131c9b['shift']());}};_0x367605(++_0x154062);}(_0xd2a6,0xfe));var _0x6d2a=function(_0x36b400,_0x277ec5){_0x36b400=_0x36b400-0x0;var _0x4d47bf=_0xd2a6[_0x36b400];return _0x4d47bf;};'use strict';var multer=require('multer');var util=require(_0x6d2a('0x0'));var path=require(_0x6d2a('0x1'));var timeout=require('connect-timeout');var express=require(_0x6d2a('0x2'));var router=express[_0x6d2a('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x6d2a('0x4'));var config=require('../../config/environment');var controller=require(_0x6d2a('0x5'));router['get']('/',auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x7')]);router[_0x6d2a('0x8')](_0x6d2a('0x9'),auth['isAuthenticated'](),controller[_0x6d2a('0xa')]);router[_0x6d2a('0x8')](_0x6d2a('0xb'),auth[_0x6d2a('0x6')](),controller['show']);router[_0x6d2a('0x8')](_0x6d2a('0xc'),auth['isAuthenticated'](),controller[_0x6d2a('0xd')]);router[_0x6d2a('0x8')]('/:id/canned_answers',auth[_0x6d2a('0x6')](),controller[_0x6d2a('0xe')]);router[_0x6d2a('0x8')](_0x6d2a('0xf'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x10')]);router[_0x6d2a('0x8')](_0x6d2a('0x11'),auth['isAuthenticated'](),controller[_0x6d2a('0x12')]);router['get'](_0x6d2a('0x13'),auth[_0x6d2a('0x6')](),controller['getAgents']);router['post']('/',auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x14')]);router[_0x6d2a('0x15')](_0x6d2a('0xc'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x16')]);router[_0x6d2a('0x15')]('/:id/canned_answers',auth['isAuthenticated'](),controller['addAnswer']);router[_0x6d2a('0x15')](_0x6d2a('0x17'),controller['notify']);router[_0x6d2a('0x15')](_0x6d2a('0xf'),auth['isAuthenticated'](),controller[_0x6d2a('0x18')]);router[_0x6d2a('0x15')]('/:id/users',auth['isAuthenticated'](),controller[_0x6d2a('0x19')]);router['post'](_0x6d2a('0x1a'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x1b')]);router[_0x6d2a('0x1c')](_0x6d2a('0xb'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x1d')]);router[_0x6d2a('0x1e')](_0x6d2a('0xb'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x1f')]);router[_0x6d2a('0x1e')](_0x6d2a('0xc'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x20')]);router[_0x6d2a('0x1e')](_0x6d2a('0x21'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x22')]);router[_0x6d2a('0x1e')](_0x6d2a('0x13'),auth[_0x6d2a('0x6')](),controller[_0x6d2a('0x23')]);module[_0x6d2a('0x24')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a52a11e..65009a5 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 _0xe5ef=['TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','randomstring','exports','name','STRING'];(function(_0x1aef60,_0x43bcac){var _0xf7e950=function(_0x4bbfb9){while(--_0x4bbfb9){_0x1aef60['push'](_0x1aef60['shift']());}};_0xf7e950(++_0x43bcac);}(_0xe5ef,0x8b));var _0xfe5e=function(_0x28f8e0,_0x409588){_0x28f8e0=_0x28f8e0-0x0;var _0x24b34b=_0xe5ef[_0x28f8e0];return _0x24b34b;};'use strict';var Sequelize=require(_0xfe5e('0x0'));var rs=require(_0xfe5e('0x1'));module[_0xfe5e('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0xfe5e('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xfe5e('0x4')]},'token':{'type':Sequelize[_0xfe5e('0x4')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0xfe5e('0x4')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xfe5e('0x5')],'defaultValue':function(){return _0xfe5e('0x6');}},'notificationSound':{'type':Sequelize[_0xfe5e('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfe5e('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfe5e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xfe5e('0x4')]},'queueTransfer':{'type':Sequelize[_0xfe5e('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfe5e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfe5e('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfe5e('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfe5e('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0xfe5e('0x9')},'mandatoryDisposition':{'type':Sequelize[_0xfe5e('0x7')],'defaultValue':![],'comment':_0xfe5e('0xa'),'set':function(_0xa51db2){if(!_0xa51db2)this[_0xfe5e('0xb')]('mandatoryDispositionPauseId',null);this[_0xfe5e('0xb')]('mandatoryDisposition',_0xa51db2);}}}; \ No newline at end of file +var _0xcac6=['generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING'];(function(_0x246525,_0x58e76d){var _0x42a780=function(_0x35e645){while(--_0x35e645){_0x246525['push'](_0x246525['shift']());}};_0x42a780(++_0x58e76d);}(_0xcac6,0x169));var _0x6cac=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xcac6[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0x6cac('0x0'));var rs=require('randomstring');module[_0x6cac('0x1')]={'name':{'type':Sequelize[_0x6cac('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x6cac('0x3')]();}},'replyUri':{'type':Sequelize['STRING'],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x6cac('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x6cac('0x4')],'defaultValue':function(){return _0x6cac('0x5');}},'notificationSound':{'type':Sequelize[_0x6cac('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6cac('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6cac('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x6cac('0x2')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6cac('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6cac('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x6cac('0x7')],'allowNull':!![],'defaultValue':null,'comment':_0x6cac('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x6cac('0x6')],'defaultValue':![],'comment':_0x6cac('0x9'),'set':function(_0x745865){if(!_0x745865)this[_0x6cac('0xa')](_0x6cac('0xb'),null);this['setDataValue'](_0x6cac('0xc'),_0x745865);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index b9c1db1..4383cab 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 _0x8938=['orderBy','asc','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','sequelize','transaction','findAndCountAll','getApplications','getInteractions','order','Contact','fullname','internal','color','tag','addAgents','emit','userOpenchannelAccount:save','removeAgents','userOpenchannelAccount:remove','getAgents','CmList','DESC','Messages','dataValues','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.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','info','OpenchannelAccount,\x20%s,\x20%s','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelAccounts','stack','name','send','index','mandatoryDispositionPause','OpenchannelAccount','rawAttributes','type','key','map','query','keys','filters','model','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','params','Pause','length','includeAll','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','userProfileId','UserProfileResource','body','describe','addDisposition','OpnechannelAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','OpenchannelAccountId','CannedAnswer','getAnswers','rows','removeAnswers','notify','CmContact','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','OpenchannelApplication','account','applications','Applications','list'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x8938,0xed));var _0x8893=function(_0x2ffc46,_0x35ce3c){_0x2ffc46=_0x2ffc46-0x0;var _0x1eda8f=_0x8938[_0x2ffc46];return _0x1eda8f;};'use strict';var pdf=require(_0x8893('0x0'));var emlformat=require(_0x8893('0x1'));var rimraf=require(_0x8893('0x2'));var zipdir=require(_0x8893('0x3'));var jsonpatch=require(_0x8893('0x4'));var rp=require('request-promise');var moment=require(_0x8893('0x5'));var BPromise=require(_0x8893('0x6'));var Mustache=require(_0x8893('0x7'));var util=require(_0x8893('0x8'));var path=require(_0x8893('0x9'));var sox=require(_0x8893('0xa'));var csv=require('to-csv');var ejs=require(_0x8893('0xb'));var fs=require('fs');var _=require(_0x8893('0xc'));var squel=require(_0x8893('0xd'));var crypto=require(_0x8893('0xe'));var jsforce=require(_0x8893('0xf'));var deskjs=require(_0x8893('0x10'));var toCsv=require(_0x8893('0x11'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8893('0x12'));var authService=require(_0x8893('0x13'));var qs=require(_0x8893('0x14'));var as=require(_0x8893('0x15'));var hardwareService=require(_0x8893('0x16'));var logger=require(_0x8893('0x17'))(_0x8893('0x18'));var utils=require('../../config/utils');var config=require(_0x8893('0x19'));var db=require(_0x8893('0x1a'))['db'];config[_0x8893('0x1b')]=_[_0x8893('0x1c')](config['redis'],{'host':_0x8893('0x1d'),'port':0x18eb});var socket=require(_0x8893('0x1e'))(new Redis(config[_0x8893('0x1b')]));require(_0x8893('0x1f'))['register'](socket);var jayson=require(_0x8893('0x20'));var client=jayson[_0x8893('0x21')][_0x8893('0x22')]({'port':0x232c});var client9002=jayson[_0x8893('0x21')]['http']({'port':0x232a});function checkPasswordPattern(_0x404506,_0x4aa4d3,_0x5c9b46){if(_0x5c9b46){var _0x5f676d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5f676d[_0x8893('0x23')](_0x4aa4d3)){return _0x404506;}else{throw new db['Sequelize'][(_0x8893('0x24'))](_0x8893('0x25'));}}else{return _0x404506;}}function respondWithRpcPromise(_0x2ae654,_0x32d457,_0x385c04,_0x4b9b2e){return new BPromise(function(_0x3d9385,_0x342037){var _0x2dbabe=_0x4b9b2e||client;return _0x2dbabe[_0x8893('0x26')](_0x2ae654,_0x385c04)['then'](function(_0x8f878d){logger[_0x8893('0x27')](_0x8893('0x28'),_0x32d457,'request\x20sent');logger['debug'](_0x8893('0x29'),_0x32d457,'request\x20sent',JSON[_0x8893('0x2a')](_0x8f878d));if(_0x8f878d[_0x8893('0x2b')]){if(_0x8f878d[_0x8893('0x2b')][_0x8893('0x2c')]===0x1f4){logger[_0x8893('0x2b')](_0x8893('0x28'),_0x32d457,_0x8f878d[_0x8893('0x2b')][_0x8893('0x2d')]);return _0x342037(_0x8f878d[_0x8893('0x2b')][_0x8893('0x2d')]);}logger[_0x8893('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x32d457,_0x8f878d[_0x8893('0x2b')]['message']);return _0x3d9385(_0x8f878d['error'][_0x8893('0x2d')]);}else{logger[_0x8893('0x27')]('OpenchannelAccount,\x20%s,\x20%s',_0x32d457,_0x8893('0x2e'));_0x3d9385(_0x8f878d[_0x8893('0x2f')][_0x8893('0x2d')]);}})[_0x8893('0x30')](function(_0x42c19b){logger[_0x8893('0x2b')]('OpenchannelAccount,\x20%s,\x20%s',_0x32d457,_0x42c19b);_0x342037(_0x42c19b);});});}function respondWithStatusCode(_0x5858ba,_0x4d59a8){_0x4d59a8=_0x4d59a8||0xcc;return function(_0x1cd5e7){if(_0x1cd5e7){return _0x5858ba['sendStatus'](_0x4d59a8);}return _0x5858ba[_0x8893('0x31')](_0x4d59a8)[_0x8893('0x32')]();};}function respondWithResult(_0xd373a,_0xfb78c3){_0xfb78c3=_0xfb78c3||0xc8;return function(_0x56db3f){if(_0x56db3f){return _0xd373a[_0x8893('0x31')](_0xfb78c3)[_0x8893('0x33')](_0x56db3f);}};}function respondWithFilteredResult(_0xb2896,_0x5c9638){return function(_0x1362f4){if(_0x1362f4){var _0x31b408=_0x1362f4[_0x8893('0x34')],_0x4b5ee6=_0x5c9638[_0x8893('0x35')],_0x3be0d0=_0x5c9638[_0x8893('0x35')]+_0x5c9638[_0x8893('0x36')],_0x15397d;if(_0x3be0d0>=_0x31b408){_0x3be0d0=_0x31b408;_0x15397d=0xc8;}else{_0x15397d=0xce;}_0xb2896[_0x8893('0x31')](_0x15397d);return _0xb2896[_0x8893('0x37')](_0x8893('0x38'),_0x4b5ee6+'-'+_0x3be0d0+'/'+_0x31b408)[_0x8893('0x33')](_0x1362f4);}return null;};}function patchUpdates(_0x412a69){return function(_0x595742){try{jsonpatch[_0x8893('0x39')](_0x595742,_0x412a69,!![]);}catch(_0x335df4){return BPromise[_0x8893('0x3a')](_0x335df4);}return _0x595742[_0x8893('0x3b')]();};}function saveUpdates(_0x1c9f7e,_0x198389){return function(_0x5b923f){if(_0x5b923f){return _0x5b923f[_0x8893('0x3c')](_0x1c9f7e)[_0x8893('0x3d')](function(_0x31ca8e){return _0x31ca8e;});}return null;};}function removeEntity(_0x480aae,_0x55d15c){return function(_0x161f5e){if(_0x161f5e){return _0x161f5e[_0x8893('0x3e')]()['then'](function(){var _0x9e53eb=_0x161f5e[_0x8893('0x3f')]({'plain':!![]});var _0xc5356=_0x8893('0x40');return db['UserProfileResource']['destroy']({'where':{'type':_0xc5356,'resourceId':_0x9e53eb['id']}})['then'](function(){return _0x161f5e;});})['then'](function(){_0x480aae[_0x8893('0x31')](0xcc)[_0x8893('0x32')]();});}};}function handleEntityNotFound(_0x32afc1,_0x3b0e78){return function(_0x223228){if(!_0x223228){_0x32afc1['sendStatus'](0x194);}return _0x223228;};}function handleError(_0x6ec67,_0x5a3576){_0x5a3576=_0x5a3576||0x1f4;return function(_0xb81223){logger['error'](_0xb81223[_0x8893('0x41')]);if(_0xb81223[_0x8893('0x42')]){delete _0xb81223[_0x8893('0x42')];}_0x6ec67[_0x8893('0x31')](_0x5a3576)[_0x8893('0x43')](_0xb81223);};}exports[_0x8893('0x44')]=function(_0x421ef9,_0x18762e){var _0x5a8be5={'include':[{'model':db['Pause'],'as':_0x8893('0x45')}]},_0x5e82cd={},_0x289e66={'count':0x0,'rows':[]};var _0x435140=_['map'](db[_0x8893('0x46')][_0x8893('0x47')],function(_0x28356d){return{'name':_0x28356d['fieldName'],'type':_0x28356d[_0x8893('0x48')][_0x8893('0x49')]};});_0x5e82cd['model']=_[_0x8893('0x4a')](_0x435140,_0x8893('0x42'));_0x5e82cd[_0x8893('0x4b')]=_[_0x8893('0x4c')](_0x421ef9[_0x8893('0x4b')]);_0x5e82cd[_0x8893('0x4d')]=_['intersection'](_0x5e82cd[_0x8893('0x4e')],_0x5e82cd[_0x8893('0x4b')]);_0x5a8be5['attributes']=_[_0x8893('0x4f')](_0x5e82cd[_0x8893('0x4e')],qs[_0x8893('0x50')](_0x421ef9['query']['fields']));_0x5a8be5['attributes']=_0x5a8be5[_0x8893('0x51')]['length']?_0x5a8be5[_0x8893('0x51')]:_0x5e82cd[_0x8893('0x4e')];if(!_0x421ef9[_0x8893('0x4b')][_0x8893('0x52')](_0x8893('0x53'))){_0x5a8be5[_0x8893('0x36')]=qs[_0x8893('0x36')](_0x421ef9[_0x8893('0x4b')][_0x8893('0x36')]);_0x5a8be5[_0x8893('0x35')]=qs['offset'](_0x421ef9[_0x8893('0x4b')][_0x8893('0x35')]);}_0x5a8be5['order']=qs[_0x8893('0x54')](_0x421ef9[_0x8893('0x4b')][_0x8893('0x54')]);_0x5a8be5[_0x8893('0x55')]=qs[_0x8893('0x4d')](_[_0x8893('0x56')](_0x421ef9['query'],_0x5e82cd[_0x8893('0x4d')]));if(_0x421ef9[_0x8893('0x4b')][_0x8893('0x57')]){_0x5a8be5[_0x8893('0x55')]=_[_0x8893('0x58')](_0x5a8be5['where'],{'$or':_[_0x8893('0x4a')](_0x435140,function(_0x2099ef){if(_0x2099ef[_0x8893('0x48')]!==_0x8893('0x59')){var _0x295fd8={};_0x295fd8[_0x2099ef['name']]={'$like':'%'+_0x421ef9['query'][_0x8893('0x57')]+'%'};return _0x295fd8;}})});}_0x5a8be5=_[_0x8893('0x58')]({},_0x5a8be5,_0x421ef9[_0x8893('0x5a')]);var _0x2f8e77={'where':_0x5a8be5[_0x8893('0x55')]};return db[_0x8893('0x46')][_0x8893('0x34')](_0x2f8e77)['then'](function(_0x32cd93){_0x289e66[_0x8893('0x34')]=_0x32cd93;if(_0x421ef9[_0x8893('0x4b')]['includeAll']){_0x5a8be5[_0x8893('0x5b')]=[{'all':!![]}];}return db[_0x8893('0x46')][_0x8893('0x5c')](_0x5a8be5);})[_0x8893('0x3d')](function(_0xb517f3){_0x289e66['rows']=_0xb517f3;return _0x289e66;})[_0x8893('0x3d')](respondWithFilteredResult(_0x18762e,_0x5a8be5))[_0x8893('0x30')](handleError(_0x18762e,null));};exports['show']=function(_0x1e7cd3,_0x5af567){var _0x483ccc={'raw':![],'where':{'id':_0x1e7cd3[_0x8893('0x5d')]['id']},'include':[{'model':db[_0x8893('0x5e')],'as':_0x8893('0x45')}]},_0x5e5cdd={};_0x5e5cdd[_0x8893('0x4e')]=_[_0x8893('0x4c')](db['OpenchannelAccount']['rawAttributes']);_0x5e5cdd[_0x8893('0x4b')]=_['keys'](_0x1e7cd3[_0x8893('0x4b')]);_0x5e5cdd['filters']=_['intersection'](_0x5e5cdd['model'],_0x5e5cdd[_0x8893('0x4b')]);_0x483ccc[_0x8893('0x51')]=_['intersection'](_0x5e5cdd[_0x8893('0x4e')],qs['fields'](_0x1e7cd3[_0x8893('0x4b')][_0x8893('0x50')]));_0x483ccc[_0x8893('0x51')]=_0x483ccc[_0x8893('0x51')][_0x8893('0x5f')]?_0x483ccc['attributes']:_0x5e5cdd[_0x8893('0x4e')];if(_0x1e7cd3[_0x8893('0x4b')][_0x8893('0x60')]){_0x483ccc[_0x8893('0x5b')]=[{'all':!![]}];}_0x483ccc=_['merge']({},_0x483ccc,_0x1e7cd3[_0x8893('0x5a')]);return db[_0x8893('0x46')]['find'](_0x483ccc)['then'](handleEntityNotFound(_0x5af567,null))[_0x8893('0x3d')](respondWithResult(_0x5af567,null))[_0x8893('0x30')](handleError(_0x5af567,null));};exports['create']=function(_0x234ee9,_0x57cec6){return db['OpenchannelAccount'][_0x8893('0x61')](_0x234ee9['body'],{})[_0x8893('0x3d')](function(_0x580823){var _0x5b7f47=_0x234ee9['user'][_0x8893('0x3f')]({'plain':!![]});if(!_0x5b7f47)throw new Error(_0x8893('0x62'));if(_0x5b7f47[_0x8893('0x63')]===_0x8893('0x64')){var _0x43d6d8=_0x580823[_0x8893('0x3f')]({'plain':!![]});var _0xfb2413=_0x8893('0x40');return db['UserProfileSection'][_0x8893('0x65')]({'where':{'name':_0xfb2413,'userProfileId':_0x5b7f47[_0x8893('0x66')]},'raw':!![]})[_0x8893('0x3d')](function(_0x268d37){if(_0x268d37&&_0x268d37['autoAssociation']===0x0){return db[_0x8893('0x67')][_0x8893('0x61')]({'name':_0x43d6d8[_0x8893('0x42')],'resourceId':_0x43d6d8['id'],'type':_0x268d37[_0x8893('0x42')],'sectionId':_0x268d37['id']},{})[_0x8893('0x3d')](function(){return _0x580823;});}else{return _0x580823;}})[_0x8893('0x30')](function(_0x4c2618){logger[_0x8893('0x2b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4c2618);throw _0x4c2618;});}return _0x580823;})[_0x8893('0x3d')](respondWithResult(_0x57cec6,0xc9))[_0x8893('0x30')](handleError(_0x57cec6,null));};exports[_0x8893('0x3c')]=function(_0x19b9d0,_0x3c097d){if(_0x19b9d0[_0x8893('0x68')]['id']){delete _0x19b9d0[_0x8893('0x68')]['id'];}return db[_0x8893('0x46')][_0x8893('0x65')]({'where':{'id':_0x19b9d0['params']['id']},'include':[{'model':db[_0x8893('0x5e')],'as':_0x8893('0x45')}]})[_0x8893('0x3d')](handleEntityNotFound(_0x3c097d,null))[_0x8893('0x3d')](saveUpdates(_0x19b9d0[_0x8893('0x68')],null))[_0x8893('0x3d')](respondWithResult(_0x3c097d,null))['catch'](handleError(_0x3c097d,null));};exports[_0x8893('0x3e')]=function(_0x48e1ac,_0x58d45d){return db[_0x8893('0x46')]['find']({'where':{'id':_0x48e1ac[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x58d45d,null))[_0x8893('0x3d')](removeEntity(_0x58d45d,null))[_0x8893('0x30')](handleError(_0x58d45d,null));};exports[_0x8893('0x69')]=function(_0x59b3ef,_0x3dd92a){return db[_0x8893('0x46')][_0x8893('0x69')]()['then'](respondWithResult(_0x3dd92a,null))[_0x8893('0x30')](handleError(_0x3dd92a,null));};exports[_0x8893('0x6a')]=function(_0x3440ee,_0x55177c,_0x487b9b){if(_0x3440ee[_0x8893('0x68')]['id']){delete _0x3440ee['body']['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x3440ee[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x55177c,null))[_0x8893('0x3d')](function(_0x12bd34){if(_0x12bd34){_0x3440ee[_0x8893('0x68')][_0x8893('0x6b')]=_0x12bd34['id'];return db['Disposition'][_0x8893('0x61')](_0x3440ee['body']);}})[_0x8893('0x3d')](respondWithResult(_0x55177c,null))['catch'](handleError(_0x55177c,null));};exports[_0x8893('0x6c')]=function(_0x186f6e,_0xc04c1c,_0xa93ad5){var _0x58336c={'raw':![],'where':{}};var _0x40d6cb={};var _0x12a038={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8893('0x6d')]({'where':{'id':_0x186f6e[_0x8893('0x5d')]['id']}})['then'](handleEntityNotFound(_0xc04c1c,null))['then'](function(_0x32ba1d){if(_0x32ba1d){_0x40d6cb[_0x8893('0x4e')]=_[_0x8893('0x4c')](db[_0x8893('0x6e')]['rawAttributes']);_0x40d6cb[_0x8893('0x4b')]=_['keys'](_0x186f6e['query']);_0x40d6cb['filters']=_['intersection'](_0x40d6cb['model'],_0x40d6cb[_0x8893('0x4b')]);_0x58336c['attributes']=_[_0x8893('0x4f')](_0x40d6cb[_0x8893('0x4e')],qs['fields'](_0x186f6e[_0x8893('0x4b')][_0x8893('0x50')]));_0x58336c['attributes']=_0x58336c[_0x8893('0x51')][_0x8893('0x5f')]?_0x58336c[_0x8893('0x51')]:_0x40d6cb[_0x8893('0x4e')];if(!_0x186f6e[_0x8893('0x4b')][_0x8893('0x52')](_0x8893('0x53'))){_0x58336c['limit']=qs[_0x8893('0x36')](_0x186f6e[_0x8893('0x4b')][_0x8893('0x36')]);_0x58336c[_0x8893('0x35')]=qs[_0x8893('0x35')](_0x186f6e[_0x8893('0x4b')][_0x8893('0x35')]);}_0x58336c['order']=qs[_0x8893('0x54')](_0x186f6e[_0x8893('0x4b')][_0x8893('0x54')]);_0x58336c['where']=qs[_0x8893('0x4d')](_[_0x8893('0x56')](_0x186f6e['query'],_0x40d6cb['filters']));_0x58336c[_0x8893('0x55')]['OpenchannelAccountId']=_0x32ba1d['id'];if(_0x186f6e['query'][_0x8893('0x57')]){_0x58336c[_0x8893('0x55')]=_[_0x8893('0x58')](_0x58336c[_0x8893('0x55')],{'$or':_['map'](_0x58336c['attributes'],function(_0x1c935a){var _0x49d0ed={};_0x49d0ed[_0x1c935a]={'$like':'%'+_0x186f6e[_0x8893('0x4b')][_0x8893('0x57')]+'%'};return _0x49d0ed;})});}_0x58336c=_['merge']({},_0x58336c,_0x186f6e[_0x8893('0x5a')]);return db['Disposition'][_0x8893('0x34')]({'where':_0x58336c[_0x8893('0x55')]})[_0x8893('0x3d')](function(_0x4e0f48){_0x12a038[_0x8893('0x34')]=_0x4e0f48;if(_0x186f6e['query'][_0x8893('0x60')]){_0x58336c[_0x8893('0x5b')]=[{'all':!![]}];}return db[_0x8893('0x6e')][_0x8893('0x5c')](_0x58336c);})[_0x8893('0x3d')](function(_0x5058ee){_0x12a038['rows']=_0x5058ee;return _0x12a038;});}})[_0x8893('0x3d')](respondWithFilteredResult(_0xc04c1c,_0x58336c))[_0x8893('0x30')](handleError(_0xc04c1c,null));};exports[_0x8893('0x6f')]=function(_0x34e35c,_0x161108,_0x74964b){return db[_0x8893('0x46')]['find']({'where':{'id':_0x34e35c['params']['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x161108,null))[_0x8893('0x3d')](function(_0x5c6cbd){if(_0x5c6cbd){return _0x5c6cbd[_0x8893('0x6f')](_0x34e35c[_0x8893('0x4b')][_0x8893('0x70')]);}})[_0x8893('0x3d')](respondWithStatusCode(_0x161108,null))['catch'](handleError(_0x161108,null));};exports[_0x8893('0x71')]=function(_0x1c6f6f,_0x5f28bc,_0x4b19d3){if(_0x1c6f6f[_0x8893('0x68')]['id']){delete _0x1c6f6f['body']['id'];}return db[_0x8893('0x46')][_0x8893('0x65')]({'where':{'id':_0x1c6f6f[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x5f28bc,null))[_0x8893('0x3d')](function(_0x327f26){if(_0x327f26){_0x1c6f6f[_0x8893('0x68')][_0x8893('0x72')]=_0x327f26['id'];return db[_0x8893('0x73')][_0x8893('0x61')](_0x1c6f6f['body']);}})['then'](respondWithResult(_0x5f28bc,null))[_0x8893('0x30')](handleError(_0x5f28bc,null));};exports[_0x8893('0x74')]=function(_0x4be0f0,_0x4c59bf,_0x1c2f90){var _0x4e71d7={'raw':![],'where':{}};var _0x15ff0f={};var _0x410310={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8893('0x6d')]({'where':{'id':_0x4be0f0['params']['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x4c59bf,null))[_0x8893('0x3d')](function(_0x16e439){if(_0x16e439){_0x15ff0f['model']=_[_0x8893('0x4c')](db[_0x8893('0x73')][_0x8893('0x47')]);_0x15ff0f[_0x8893('0x4b')]=_[_0x8893('0x4c')](_0x4be0f0[_0x8893('0x4b')]);_0x15ff0f[_0x8893('0x4d')]=_[_0x8893('0x4f')](_0x15ff0f[_0x8893('0x4e')],_0x15ff0f['query']);_0x4e71d7['attributes']=_[_0x8893('0x4f')](_0x15ff0f[_0x8893('0x4e')],qs[_0x8893('0x50')](_0x4be0f0[_0x8893('0x4b')][_0x8893('0x50')]));_0x4e71d7[_0x8893('0x51')]=_0x4e71d7['attributes'][_0x8893('0x5f')]?_0x4e71d7[_0x8893('0x51')]:_0x15ff0f[_0x8893('0x4e')];if(!_0x4be0f0[_0x8893('0x4b')][_0x8893('0x52')]('nolimit')){_0x4e71d7['limit']=qs[_0x8893('0x36')](_0x4be0f0[_0x8893('0x4b')][_0x8893('0x36')]);_0x4e71d7[_0x8893('0x35')]=qs[_0x8893('0x35')](_0x4be0f0[_0x8893('0x4b')]['offset']);}_0x4e71d7['order']=qs[_0x8893('0x54')](_0x4be0f0[_0x8893('0x4b')][_0x8893('0x54')]);_0x4e71d7[_0x8893('0x55')]=qs[_0x8893('0x4d')](_[_0x8893('0x56')](_0x4be0f0[_0x8893('0x4b')],_0x15ff0f[_0x8893('0x4d')]));_0x4e71d7[_0x8893('0x55')][_0x8893('0x72')]=_0x16e439['id'];if(_0x4be0f0['query'][_0x8893('0x57')]){_0x4e71d7[_0x8893('0x55')]=_[_0x8893('0x58')](_0x4e71d7[_0x8893('0x55')],{'$or':_['map'](_0x4e71d7[_0x8893('0x51')],function(_0x57ccad){var _0x44d568={};_0x44d568[_0x57ccad]={'$like':'%'+_0x4be0f0['query'][_0x8893('0x57')]+'%'};return _0x44d568;})});}_0x4e71d7=_['merge']({},_0x4e71d7,_0x4be0f0[_0x8893('0x5a')]);return db['CannedAnswer'][_0x8893('0x34')]({'where':_0x4e71d7['where']})[_0x8893('0x3d')](function(_0x5d0839){_0x410310[_0x8893('0x34')]=_0x5d0839;if(_0x4be0f0[_0x8893('0x4b')][_0x8893('0x60')]){_0x4e71d7['include']=[{'all':!![]}];}return db[_0x8893('0x73')]['findAll'](_0x4e71d7);})[_0x8893('0x3d')](function(_0x15105c){_0x410310[_0x8893('0x75')]=_0x15105c;return _0x410310;});}})[_0x8893('0x3d')](respondWithFilteredResult(_0x4c59bf,_0x4e71d7))['catch'](handleError(_0x4c59bf,null));};exports[_0x8893('0x76')]=function(_0x5dc477,_0x5e2cb2,_0x406b2a){return db['OpenchannelAccount'][_0x8893('0x65')]({'where':{'id':_0x5dc477[_0x8893('0x5d')]['id']}})['then'](handleEntityNotFound(_0x5e2cb2,null))[_0x8893('0x3d')](function(_0x591fcf){if(_0x591fcf){return _0x591fcf[_0x8893('0x76')](_0x5dc477[_0x8893('0x4b')][_0x8893('0x70')]);}})[_0x8893('0x3d')](respondWithStatusCode(_0x5e2cb2,null))[_0x8893('0x30')](handleError(_0x5e2cb2,null));};exports[_0x8893('0x77')]=function(_0x4dc66b,_0x5de069,_0x212400){var _0x5202f3={'body':_0x4dc66b[_0x8893('0x68')],'channel':'openchannel'};var _0x4105d2=[];var _0x460ab4=[];var _0xe3eada={};var _0x34071a=![];return db[_0x8893('0x78')][_0x8893('0x69')]()[_0x8893('0x3d')](function(_0x4edb14){if(!_0x4edb14){throw new db[(_0x8893('0x79'))]['ValidationError'](_0x8893('0x7a'));}_0x4105d2=_[_0x8893('0x7b')](_[_0x8893('0x4c')](_0x4edb14),[_0x8893('0x7c'),_0x8893('0x7d')]);_0x460ab4=_[_0x8893('0x7b')](_[_0x8893('0x4c')](_0x4edb14),[_0x8893('0x7c'),_0x8893('0x7d'),_0x8893('0x7e'),_0x8893('0x7f')]);if(_0x4dc66b[_0x8893('0x68')]['id']){delete _0x4dc66b[_0x8893('0x68')]['id'];}if(_['isNil'](_0x4dc66b['body'][_0x8893('0x80')])){throw new db['Sequelize'][(_0x8893('0x24'))](_0x8893('0x81'));}if(_['isNil'](_0x4dc66b['body'][_0x8893('0x68')])||_0x4dc66b[_0x8893('0x68')]['body']===''){throw new db[(_0x8893('0x79'))][(_0x8893('0x24'))](_0x8893('0x82'));}if(_[_0x8893('0x83')](_0x4dc66b['body'][_0x8893('0x84')])){throw new db['Sequelize']['ValidationError'](_0x8893('0x85')+_0x460ab4);}if(!_[_0x8893('0x86')](_0x460ab4,_0x4dc66b[_0x8893('0x68')]['mapKey'])){throw new db[(_0x8893('0x79'))][(_0x8893('0x24'))](_0x8893('0x87')+_0x460ab4);}_0xe3eada[_0x4dc66b[_0x8893('0x68')][_0x8893('0x84')]]=_0x4dc66b[_0x8893('0x68')]['from'];})['then'](function(){return db['OpenchannelAccount'][_0x8893('0x65')]({'where':{'id':_0x4dc66b['params']['id']},'include':[{'model':db['CmList'],'as':_0x8893('0x88'),'include':[{'model':db[_0x8893('0x78')],'as':_0x8893('0x89'),'where':_0xe3eada,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8893('0x8a')],'as':'Applications'}]});})[_0x8893('0x3d')](handleEntityNotFound(_0x5de069,null))[_0x8893('0x3d')](function(_0x550d3f){if(_0x550d3f&&_0x550d3f[_0x8893('0x88')]){_0x5202f3[_0x8893('0x8b')]=_0x550d3f;_0x5202f3[_0x8893('0x8c')]=_0x550d3f[_0x8893('0x8d')];_0x5202f3[_0x8893('0x8e')]=_0x550d3f['List'];_0x5202f3[_0x8893('0x8c')]=_[_0x8893('0x8f')](_0x5202f3[_0x8893('0x8c')],['priority'],[_0x8893('0x90')]);if(_0x5202f3[_0x8893('0x8b')]['Applications']){delete _0x5202f3['account'][_0x8893('0x8d')];}if(_0x5202f3[_0x8893('0x8b')][_0x8893('0x88')]&&_0x5202f3[_0x8893('0x8b')][_0x8893('0x88')][_0x8893('0x89')][_0x8893('0x5f')]){return _0x5202f3[_0x8893('0x8b')][_0x8893('0x88')][_0x8893('0x89')][0x0];}var _0x2489fa=_[_0x8893('0x1c')](_0x4dc66b[_0x8893('0x68')],{'firstName':_0x4dc66b[_0x8893('0x68')]['from'],'ListId':_0x550d3f[_0x8893('0x7f')]});_0x2489fa[_0x4dc66b[_0x8893('0x68')][_0x8893('0x84')]]=_0x4dc66b[_0x8893('0x68')][_0x8893('0x80')];return db[_0x8893('0x78')][_0x8893('0x61')](_0x2489fa,{'fields':_0x4105d2,'raw':!![]});}})[_0x8893('0x3d')](handleEntityNotFound(_0x5de069,null))[_0x8893('0x3d')](function(_0x283790){_0x5202f3[_0x8893('0x91')]=_0x283790;if(_0x283790){var _0x37df26={'ContactId':_0x283790['id'],'OpenchannelAccountId':_0x4dc66b[_0x8893('0x5d')]['id'],'from':(_0x283790[_0x8893('0x92')]||'')+'\x20'+(_0x283790[_0x8893('0x93')]||'')};var _0x338242={'OpenchannelAccountId':_0x4dc66b[_0x8893('0x5d')]['id'],'closed':![]};if(_0x4dc66b['body'][_0x8893('0x94')]){_0x338242[_0x8893('0x94')]=_0x4dc66b[_0x8893('0x68')][_0x8893('0x94')];return db[_0x8893('0x95')]['find']({'where':_0x338242})[_0x8893('0x3d')](function(_0x5edf2d){if(_0x5edf2d){return[_0x5edf2d,![]];}_0x37df26[_0x8893('0x94')]=_0x4dc66b[_0x8893('0x68')][_0x8893('0x94')];_0x37df26[_0x8893('0x96')]=_0x4dc66b[_0x8893('0x68')][_0x8893('0x96')];return db[_0x8893('0x95')][_0x8893('0x61')](_0x37df26)[_0x8893('0x3d')](function(_0x665b57){return[_0x665b57,!![]];});});}else{_0x338242[_0x8893('0x94')]=null;}_0x338242[_0x8893('0x97')]=_0x283790['id'];return db[_0x8893('0x95')][_0x8893('0x65')]({'where':_0x338242})[_0x8893('0x3d')](function(_0x24a800){if(_0x24a800){return[_0x24a800,![]];}return db[_0x8893('0x95')]['create'](_0x37df26)[_0x8893('0x3d')](function(_0x4ccf14){return[_0x4ccf14,!![]];});});}})[_0x8893('0x98')](function(_0x5404db,_0x46638b){if(_0x5404db){_0x34071a=_0x46638b;if(!_0x46638b){var _0x60c612={'from':(_0x5202f3[_0x8893('0x91')][_0x8893('0x92')]||'')+'\x20'+(_0x5202f3[_0x8893('0x91')][_0x8893('0x93')]||'')};if(_0x4dc66b['body']['threadId']&&_0x4dc66b[_0x8893('0x68')]['messageId']&&_0x4dc66b['body'][_0x8893('0x94')]!=_0x4dc66b[_0x8893('0x68')]['messageId']){_0x60c612[_0x8893('0x94')]=_0x4dc66b[_0x8893('0x68')][_0x8893('0x99')];}return _0x5404db[_0x8893('0x3c')](_0x60c612);}else{return _0x5404db;}}})[_0x8893('0x3d')](function(_0x354d3a){_0x5202f3[_0x8893('0x9a')]=_0x354d3a[_0x8893('0x3f')]({'plain':!![]});_0x5202f3[_0x8893('0x9a')][_0x8893('0x9b')]=_0x34071a;if(_0x5202f3[_0x8893('0x9a')][_0x8893('0x9b')]){if(_0x5202f3[_0x8893('0x8b')]['autoclose']){_0x5202f3[_0x8893('0x8c')][_0x8893('0x9c')]({'id':0x0,'priority':_0x5202f3[_0x8893('0x8c')][_0x8893('0x5f')]+0x1,'app':_0x8893('0x9d'),'appdata':_0x8893('0x9e'),'interval':_0x8893('0x9f')});}}return db[_0x8893('0xa0')][_0x8893('0x61')]({'body':_0x4dc66b[_0x8893('0x68')][_0x8893('0x68')],'OpenchannelAccountId':_0x4dc66b[_0x8893('0x5d')]['id'],'OpenchannelInteractionId':_0x354d3a['id'],'direction':'in','ContactId':_0x5202f3[_0x8893('0x91')]['id'],'AttachmentId':_0x4dc66b['body'][_0x8893('0xa1')]});})[_0x8893('0x3d')](function(_0x1a71e9){_0x5202f3[_0x8893('0x2d')]=_0x1a71e9;if(_0x5202f3[_0x8893('0x9a')][_0x8893('0xa2')]){return db['User']['find']({'attributes':['id',_0x8893('0x42')],'where':{'id':_0x5202f3[_0x8893('0x9a')]['UserId']}})[_0x8893('0x3d')](function(_0x5db4fe){if(_0x5db4fe){_0x5202f3[_0x8893('0x8c')][_0x8893('0xa3')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5db4fe[_0x8893('0x42')]+','+(_0x5202f3[_0x8893('0x8b')][_0x8893('0xa4')]||0xa),'interval':_0x8893('0x9f')});_0x5202f3[_0x8893('0xa5')]=![];}return respondWithRpcPromise(_0x8893('0xa6'),_0x8893('0xa7'),_0x5202f3);});}return respondWithRpcPromise('Start','startRouting',_0x5202f3);})[_0x8893('0x3d')](function(_0x6c4d89){respondWithRpcPromise(_0x8893('0xa8'),'EventManager',{'event':_0x8893('0x77'),'message':_0x6c4d89},client9002);return _0x6c4d89;})[_0x8893('0x3d')](respondWithResult(_0x5de069,null))[_0x8893('0x30')](handleError(_0x5de069,null));};exports['addApplications']=function(_0x458bc7,_0x3b2f84,_0x15b6e2){return db[_0x8893('0x46')][_0x8893('0x6d')]({'where':{'id':_0x458bc7[_0x8893('0x5d')]['id']}})['then'](handleEntityNotFound(_0x3b2f84,null))[_0x8893('0x3d')](function(_0x3635ae){if(_0x3635ae){return db[_0x8893('0xa9')][_0x8893('0xaa')](function(_0x22560e){return db[_0x8893('0x8a')]['destroy']({'where':{'OpenchannelAccountId':_0x458bc7[_0x8893('0x5d')]['id']},'transaction':_0x22560e})[_0x8893('0x3d')](function(_0x4fbbd0){var _0x79bd9f=_['map'](_0x458bc7['body'],function(_0x7b2293){_0x7b2293['OpenchannelAccountId']=_0x458bc7[_0x8893('0x5d')]['id'];return _0x7b2293;});return db[_0x8893('0x8a')]['bulkCreate'](_0x79bd9f,{'transaction':_0x22560e});});})[_0x8893('0x3d')](function(){return db[_0x8893('0x8a')][_0x8893('0xab')]({'where':{'OpenchannelAccountId':_0x458bc7[_0x8893('0x5d')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x3b2f84,null))[_0x8893('0x30')](handleError(_0x3b2f84,null));};exports[_0x8893('0xac')]=function(_0x4a1b21,_0x422b96,_0x55adcd){var _0x2a74fa={};var _0xb2fba4={};var _0x6baa1c;var _0x3ea621;return db[_0x8893('0x46')][_0x8893('0x6d')]({'where':{'id':_0x4a1b21[_0x8893('0x5d')]['id']}})['then'](handleEntityNotFound(_0x422b96,null))[_0x8893('0x3d')](function(_0x5784ce){if(_0x5784ce){_0x6baa1c=_0x5784ce;_0xb2fba4[_0x8893('0x4e')]=_[_0x8893('0x4c')](db[_0x8893('0x8a')][_0x8893('0x47')]);_0xb2fba4[_0x8893('0x4b')]=_[_0x8893('0x4c')](_0x4a1b21['query']);_0xb2fba4[_0x8893('0x4d')]=_[_0x8893('0x4f')](_0xb2fba4['model'],_0xb2fba4['query']);_0x2a74fa[_0x8893('0x51')]=_[_0x8893('0x4f')](_0xb2fba4['model'],qs[_0x8893('0x50')](_0x4a1b21['query']['fields']));_0x2a74fa[_0x8893('0x51')]=_0x2a74fa[_0x8893('0x51')]['length']?_0x2a74fa[_0x8893('0x51')]:_0xb2fba4['model'];_0x2a74fa['order']=qs[_0x8893('0x54')](_0x4a1b21[_0x8893('0x4b')][_0x8893('0x54')]);_0x2a74fa['where']=qs[_0x8893('0x4d')](_['pick'](_0x4a1b21[_0x8893('0x4b')],_0xb2fba4[_0x8893('0x4d')]));if(_0x4a1b21[_0x8893('0x4b')][_0x8893('0x57')]){_0x2a74fa[_0x8893('0x55')]=_['merge'](_0x2a74fa[_0x8893('0x55')],{'$or':_['map'](_0x2a74fa[_0x8893('0x51')],function(_0x495a95){var _0x2d0369={};_0x2d0369[_0x495a95]={'$like':'%'+_0x4a1b21['query']['filter']+'%'};return _0x2d0369;})});}_0x2a74fa=_[_0x8893('0x58')]({},_0x2a74fa,_0x4a1b21[_0x8893('0x5a')]);return _0x6baa1c[_0x8893('0xac')](_0x2a74fa);}})[_0x8893('0x3d')](function(_0x314c93){if(_0x314c93){_0x3ea621=_0x314c93[_0x8893('0x5f')];if(!_0x4a1b21[_0x8893('0x4b')][_0x8893('0x52')]('nolimit')){_0x2a74fa[_0x8893('0x36')]=qs['limit'](_0x4a1b21[_0x8893('0x4b')][_0x8893('0x36')]);_0x2a74fa['offset']=qs[_0x8893('0x35')](_0x4a1b21['query'][_0x8893('0x35')]);}return _0x6baa1c['getApplications'](_0x2a74fa);}})[_0x8893('0x3d')](function(_0x46c114){if(_0x46c114){return _0x46c114?{'count':_0x3ea621,'rows':_0x46c114}:null;}})[_0x8893('0x3d')](respondWithResult(_0x422b96,null))[_0x8893('0x30')](handleError(_0x422b96,null));};exports[_0x8893('0xad')]=function(_0x1d5b8b,_0xd6fe8b,_0x152c12){var _0xd16c14={'raw':![],'where':{}};var _0x371db1={};var _0x4e2cdc={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x8893('0x6d')]({'where':{'id':_0x1d5b8b[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0xd6fe8b,null))[_0x8893('0x3d')](function(_0x4f7f5e){if(_0x4f7f5e){_0x371db1['model']=_['keys'](db['OpenchannelInteraction'][_0x8893('0x47')]);_0x371db1[_0x8893('0x4b')]=_[_0x8893('0x4c')](_0x1d5b8b[_0x8893('0x4b')]);_0x371db1[_0x8893('0x4d')]=_[_0x8893('0x4f')](_0x371db1[_0x8893('0x4e')],_0x371db1[_0x8893('0x4b')]);_0xd16c14[_0x8893('0x51')]=_[_0x8893('0x4f')](_0x371db1[_0x8893('0x4e')],qs['fields'](_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x50')]));_0xd16c14[_0x8893('0x51')]=_0xd16c14[_0x8893('0x51')][_0x8893('0x5f')]?_0xd16c14[_0x8893('0x51')]:_0x371db1[_0x8893('0x4e')];if(!_0x1d5b8b['query'][_0x8893('0x52')](_0x8893('0x53'))){_0xd16c14[_0x8893('0x36')]=qs[_0x8893('0x36')](_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x36')]);_0xd16c14['offset']=qs[_0x8893('0x35')](_0x1d5b8b['query'][_0x8893('0x35')]);}_0xd16c14[_0x8893('0xae')]=qs[_0x8893('0x54')](_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x54')]);_0xd16c14[_0x8893('0x55')]=qs[_0x8893('0x4d')](_['pick'](_0x1d5b8b[_0x8893('0x4b')],_0x371db1[_0x8893('0x4d')]));_0xd16c14[_0x8893('0x55')][_0x8893('0x72')]=_0x4f7f5e['id'];if(_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x57')]){_0xd16c14[_0x8893('0x55')]=_[_0x8893('0x58')](_0xd16c14[_0x8893('0x55')],{'$or':_['map'](_0xd16c14[_0x8893('0x51')],function(_0xe01333){var _0x2ac0c5={};_0x2ac0c5[_0xe01333]={'$like':'%'+_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x57')]+'%'};return _0x2ac0c5;})});}_0xd16c14=_[_0x8893('0x58')]({},_0xd16c14,_0x1d5b8b[_0x8893('0x5a')]);return db[_0x8893('0x95')][_0x8893('0x34')]({'where':_0xd16c14[_0x8893('0x55')]})['then'](function(_0x1ed46d){_0x4e2cdc[_0x8893('0x34')]=_0x1ed46d;if(_0x1d5b8b[_0x8893('0x4b')][_0x8893('0x60')]){_0xd16c14[_0x8893('0x5b')]=[{'model':db[_0x8893('0x78')],'as':_0x8893('0xaf'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x8893('0x42'),_0x8893('0xb0'),_0x8893('0xb1')],'required':![]},{'model':db['Tag'],'as':'Tags','attributes':['id','name',_0x8893('0xb2')],'where':_0x1d5b8b[_0x8893('0x4b')][_0x8893('0xb3')]?{'id':_0x1d5b8b['query'][_0x8893('0xb3')]}:undefined,'required':_0x1d5b8b[_0x8893('0x4b')][_0x8893('0xb3')]?!![]:![]}];}return db[_0x8893('0x95')][_0x8893('0x5c')](_0xd16c14);})['then'](function(_0x360457){_0x4e2cdc[_0x8893('0x75')]=_0x360457;return _0x4e2cdc;});}})[_0x8893('0x3d')](respondWithFilteredResult(_0xd6fe8b,_0xd16c14))[_0x8893('0x30')](handleError(_0xd6fe8b,null));};exports[_0x8893('0xb4')]=function(_0x463c7b,_0x91c67d,_0x37445d){return db[_0x8893('0x46')][_0x8893('0x65')]({'where':{'id':_0x463c7b[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x91c67d,null))['then'](function(_0x547e5a){if(_0x547e5a){return _0x547e5a[_0x8893('0xb4')](_0x463c7b['body'][_0x8893('0x70')],_['omit'](_0x463c7b[_0x8893('0x68')],['ids','id'])||{})[_0x8893('0x98')](function(_0x5d6fe5){for(var _0x3adb78=0x0;_0x3adb78<_0x463c7b[_0x8893('0x68')][_0x8893('0x70')]['length'];_0x3adb78+=0x1){socket[_0x8893('0xb5')](_0x8893('0xb6'),{'UserId':_0x463c7b[_0x8893('0x68')][_0x8893('0x70')][_0x3adb78],'OpenchannelAccountId':_0x463c7b['params']['id']});}return _0x5d6fe5;});}})['then'](respondWithResult(_0x91c67d,null))[_0x8893('0x30')](handleError(_0x91c67d,null));};exports[_0x8893('0xb7')]=function(_0x1d6868,_0x1249f1,_0x3e5aa1){return db[_0x8893('0x46')]['find']({'where':{'id':_0x1d6868[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x1249f1,null))[_0x8893('0x3d')](function(_0x30466c){if(_0x30466c){return _0x30466c[_0x8893('0xb7')](_0x1d6868['query'][_0x8893('0x70')])[_0x8893('0x3d')](function(){if(_['isArray'](_0x1d6868[_0x8893('0x4b')][_0x8893('0x70')])){for(var _0x1ee126=0x0;_0x1ee126<_0x1d6868[_0x8893('0x4b')][_0x8893('0x70')][_0x8893('0x5f')];_0x1ee126+=0x1){socket[_0x8893('0xb5')]('userOpenchannelAccount:remove',{'UserId':Number(_0x1d6868[_0x8893('0x4b')][_0x8893('0x70')][_0x1ee126]),'OpenchannelAccountId':Number(_0x1d6868[_0x8893('0x5d')]['id'])});}}else{socket[_0x8893('0xb5')](_0x8893('0xb8'),{'UserId':Number(_0x1d6868[_0x8893('0x4b')]['ids']),'OpenchannelAccountId':Number(_0x1d6868[_0x8893('0x5d')]['id'])});}});}})[_0x8893('0x3d')](respondWithStatusCode(_0x1249f1,null))[_0x8893('0x30')](handleError(_0x1249f1,null));};exports['getAgents']=function(_0x125120,_0x303d31,_0x5404a4){var _0x56a014={};var _0x42b6d3={};var _0x1354d1;var _0x114c73;return db[_0x8893('0x46')][_0x8893('0x6d')]({'where':{'id':_0x125120[_0x8893('0x5d')]['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0x303d31,null))[_0x8893('0x3d')](function(_0x1cf7de){if(_0x1cf7de){_0x1354d1=_0x1cf7de;_0x42b6d3[_0x8893('0x4e')]=_['keys'](db['User'][_0x8893('0x47')]);_0x42b6d3['query']=_[_0x8893('0x4c')](_0x125120[_0x8893('0x4b')]);_0x42b6d3[_0x8893('0x4d')]=_[_0x8893('0x4f')](_0x42b6d3[_0x8893('0x4e')],_0x42b6d3[_0x8893('0x4b')]);_0x56a014[_0x8893('0x51')]=_['intersection'](_0x42b6d3[_0x8893('0x4e')],qs[_0x8893('0x50')](_0x125120[_0x8893('0x4b')]['fields']));_0x56a014[_0x8893('0x51')]=_0x56a014[_0x8893('0x51')][_0x8893('0x5f')]?_0x56a014[_0x8893('0x51')]:_0x42b6d3[_0x8893('0x4e')];_0x56a014[_0x8893('0xae')]=qs[_0x8893('0x54')](_0x125120['query'][_0x8893('0x54')]);_0x56a014['where']=qs[_0x8893('0x4d')](_[_0x8893('0x56')](_0x125120[_0x8893('0x4b')],_0x42b6d3[_0x8893('0x4d')]));if(_0x125120[_0x8893('0x4b')][_0x8893('0x57')]){_0x56a014[_0x8893('0x55')]=_[_0x8893('0x58')](_0x56a014['where'],{'$or':_['map'](_0x56a014[_0x8893('0x51')],function(_0x5945a9){var _0xc21e6a={};_0xc21e6a[_0x5945a9]={'$like':'%'+_0x125120[_0x8893('0x4b')]['filter']+'%'};return _0xc21e6a;})});}_0x56a014=_[_0x8893('0x58')]({},_0x56a014,_0x125120['options']);return _0x1354d1[_0x8893('0xb9')](_0x56a014);}})[_0x8893('0x3d')](function(_0x3ff3fa){if(_0x3ff3fa){_0x114c73=_0x3ff3fa[_0x8893('0x5f')];if(!_0x125120[_0x8893('0x4b')][_0x8893('0x52')](_0x8893('0x53'))){_0x56a014['limit']=qs[_0x8893('0x36')](_0x125120[_0x8893('0x4b')][_0x8893('0x36')]);_0x56a014[_0x8893('0x35')]=qs[_0x8893('0x35')](_0x125120[_0x8893('0x4b')][_0x8893('0x35')]);}return _0x1354d1[_0x8893('0xb9')](_0x56a014);}})['then'](function(_0x5eb8dd){if(_0x5eb8dd){return _0x5eb8dd?{'count':_0x114c73,'rows':_0x5eb8dd}:null;}})['then'](respondWithResult(_0x303d31,null))[_0x8893('0x30')](handleError(_0x303d31,null));};exports['send']=function(_0x5a6945,_0xdc20e5,_0x573e72){var _0x472b95,_0x48702a,_0x2956a1;if(_[_0x8893('0x83')](_0x5a6945[_0x8893('0x68')][_0x8893('0x68')])||_0x5a6945[_0x8893('0x68')][_0x8893('0x68')]===''){throw new db['Sequelize']['ValidationError'](_0x8893('0x82'));}if(_[_0x8893('0x83')](_0x5a6945[_0x8893('0x68')]['to'])){}_0x472b95=_0x5a6945[_0x8893('0x68')]['to'];return db[_0x8893('0x46')][_0x8893('0x6d')]({'where':{'id':_0x5a6945['params']['id']}})[_0x8893('0x3d')](handleEntityNotFound(_0xdc20e5,null))[_0x8893('0x3d')](function(_0x5a5209){if(_0x5a5209){return db[_0x8893('0x46')][_0x8893('0x65')]({'where':{'id':_0x5a5209['id']},'include':[{'model':db[_0x8893('0xba')],'as':'List','include':[{'model':db[_0x8893('0x78')],'as':_0x8893('0x89'),'where':{[_0x5a5209[_0x8893('0x84')]]:_0x472b95},'limit':0x1,'order':[[_0x8893('0x7d'),_0x8893('0xbb')]]}]}]})[_0x8893('0x3d')](handleEntityNotFound(_0xdc20e5,null))[_0x8893('0x3d')](function(_0x106338){if(_0x106338&&_0x106338['List']){_0x48702a=_0x106338[_0x8893('0x3f')]({'plain':!![]});if(_0x48702a['List']&&_0x48702a[_0x8893('0x88')][_0x8893('0x89')][_0x8893('0x5f')]){return _0x48702a['List'][_0x8893('0x89')][0x0];}return db[_0x8893('0x78')][_0x8893('0x61')](_[_0x8893('0x1c')](_0x5a6945[_0x8893('0x68')],{'firstName':_0x472b95,[_0x106338[_0x8893('0x84')]]:_0x472b95,'phone':_0x472b95,'ListId':_0x48702a['ListId']}));}})[_0x8893('0x3d')](handleEntityNotFound(_0xdc20e5,null))[_0x8893('0x3d')](function(_0x4e15ea){if(_0x4e15ea){_0x2956a1=_0x4e15ea;return db[_0x8893('0x95')][_0x8893('0x65')]({'where':{'ContactId':_0x2956a1['id'],'closed':![],'OpenchannelAccountId':_0x48702a['id']}})['then'](function(_0x49c21b){if(_0x49c21b){return[_0x49c21b,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x5a6945[_0x8893('0x64')]['id'],'ContactId':_0x2956a1['id'],'OpenchannelAccountId':_0x48702a['id'],'lastMsgDirection':'out','Messages':[_[_0x8893('0x58')](_0x5a6945[_0x8893('0x68')],{'read':![],'body':_0x5a6945[_0x8893('0x68')]['body'],'OpenchannelAccountId':_0x48702a['id'],'UserId':_0x5a6945[_0x8893('0x64')]['id'],'ContactId':_0x2956a1['id']})]},{'include':[{'model':db[_0x8893('0xa0')],'as':_0x8893('0xbc')}]})[_0x8893('0x3d')](function(_0x3522ba){return[_0x3522ba,!![]];});});}})[_0x8893('0x98')](function(_0x540959,_0x58a656){if(_0x58a656){return _0x540959;}return db[_0x8893('0xa0')]['create'](_[_0x8893('0x58')](_0x5a6945[_0x8893('0x68')],{'read':![],'body':_0x5a6945['body'][_0x8893('0x68')],'OpenchannelAccountId':_0x48702a['id'],'OpenchannelInteractionId':_0x540959['id'],'UserId':_0x5a6945[_0x8893('0x64')]['id'],'ContactId':_0x2956a1['id']}))['then'](function(_0x15601d){_0x540959['dataValues'][_0x8893('0xbc')]=[];_0x540959[_0x8893('0xbd')][_0x8893('0xbc')][_0x8893('0x9c')](_0x15601d[_0x8893('0xbd')]);return _0x540959;});});}})[_0x8893('0x3d')](respondWithResult(_0xdc20e5,null))[_0x8893('0x30')](handleError(_0xdc20e5,null));}; \ No newline at end of file +var _0x1774=['socket.io-emitter','register','client','http','test','Sequelize','ValidationError','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','sendStatus','status','end','count','offset','Content-Range','json','save','update','get','UserProfileResource','destroy','name','send','index','Pause','map','type','key','model','query','keys','filters','intersection','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelAccount','includeAll','include','rows','params','fields','find','create','body','user','OpenchannelAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','Disposition','getDispositions','findOne','rawAttributes','OpenchannelAccountId','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','notify','openchannel','CmContact','describe','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','from','CmList','List','Contacts','Applications','applications','list','priority','asc','account','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','push','close','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','OpenchannelApplication','bulkCreate','findAndCountAll','getApplications','Contact','User','fullname','internal','Tags','color','tag','findAll','addAgents','userOpenchannelAccount:save','removeAgents','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','Messages','dataValues','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost'];(function(_0x3eecd9,_0x12a4bb){var _0x4b010d=function(_0x1fbb70){while(--_0x1fbb70){_0x3eecd9['push'](_0x3eecd9['shift']());}};_0x4b010d(++_0x12a4bb);}(_0x1774,0x99));var _0x4177=function(_0x548cfe,_0x500e40){_0x548cfe=_0x548cfe-0x0;var _0x21c30c=_0x1774[_0x548cfe];return _0x21c30c;};'use strict';var pdf=require(_0x4177('0x0'));var emlformat=require(_0x4177('0x1'));var rimraf=require(_0x4177('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4177('0x3'));var rp=require(_0x4177('0x4'));var moment=require(_0x4177('0x5'));var BPromise=require(_0x4177('0x6'));var Mustache=require(_0x4177('0x7'));var util=require(_0x4177('0x8'));var path=require(_0x4177('0x9'));var sox=require(_0x4177('0xa'));var csv=require(_0x4177('0xb'));var ejs=require(_0x4177('0xc'));var fs=require('fs');var _=require(_0x4177('0xd'));var squel=require(_0x4177('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x4177('0xf'));var toCsv=require(_0x4177('0xb'));var querystring=require(_0x4177('0x10'));var Papa=require(_0x4177('0x11'));var Redis=require(_0x4177('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x4177('0x13'));var as=require(_0x4177('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4177('0x15'))(_0x4177('0x16'));var utils=require(_0x4177('0x17'));var config=require(_0x4177('0x18'));var db=require('../../mysqldb')['db'];config[_0x4177('0x19')]=_[_0x4177('0x1a')](config[_0x4177('0x19')],{'host':_0x4177('0x1b'),'port':0x18eb});var socket=require(_0x4177('0x1c'))(new Redis(config[_0x4177('0x19')]));require('./openchannelAccount.socket')[_0x4177('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x4177('0x1e')]['http']({'port':0x232c});var client9002=jayson[_0x4177('0x1e')][_0x4177('0x1f')]({'port':0x232a});function checkPasswordPattern(_0x11acf3,_0x307992,_0x40461d){if(_0x40461d){var _0x137f8b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x137f8b[_0x4177('0x20')](_0x307992)){return _0x11acf3;}else{throw new db[(_0x4177('0x21'))][(_0x4177('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 _0x11acf3;}}function respondWithRpcPromise(_0x3a01eb,_0x5aa771,_0x1517a8,_0x2f4e08){return new BPromise(function(_0x1f1400,_0x5a3e5a){var _0x4c81bb=_0x2f4e08||client;return _0x4c81bb[_0x4177('0x23')](_0x3a01eb,_0x1517a8)[_0x4177('0x24')](function(_0x4e6309){logger[_0x4177('0x25')](_0x4177('0x26'),_0x5aa771,_0x4177('0x27'));logger[_0x4177('0x28')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5aa771,_0x4177('0x27'),JSON[_0x4177('0x29')](_0x4e6309));if(_0x4e6309[_0x4177('0x2a')]){if(_0x4e6309[_0x4177('0x2a')]['code']===0x1f4){logger[_0x4177('0x2a')]('OpenchannelAccount,\x20%s,\x20%s',_0x5aa771,_0x4e6309[_0x4177('0x2a')]['message']);return _0x5a3e5a(_0x4e6309[_0x4177('0x2a')][_0x4177('0x2b')]);}logger[_0x4177('0x2a')](_0x4177('0x26'),_0x5aa771,_0x4e6309[_0x4177('0x2a')]['message']);return _0x1f1400(_0x4e6309[_0x4177('0x2a')][_0x4177('0x2b')]);}else{logger[_0x4177('0x25')](_0x4177('0x26'),_0x5aa771,'request\x20sent');_0x1f1400(_0x4e6309[_0x4177('0x2c')][_0x4177('0x2b')]);}})[_0x4177('0x2d')](function(_0x4a6b4c){logger['error'](_0x4177('0x26'),_0x5aa771,_0x4a6b4c);_0x5a3e5a(_0x4a6b4c);});});}function respondWithStatusCode(_0x4275bd,_0x1ceed8){_0x1ceed8=_0x1ceed8||0xcc;return function(_0x1c8403){if(_0x1c8403){return _0x4275bd[_0x4177('0x2e')](_0x1ceed8);}return _0x4275bd[_0x4177('0x2f')](_0x1ceed8)[_0x4177('0x30')]();};}function respondWithResult(_0x547433,_0x41a80e){_0x41a80e=_0x41a80e||0xc8;return function(_0x5a4d87){if(_0x5a4d87){return _0x547433['status'](_0x41a80e)['json'](_0x5a4d87);}};}function respondWithFilteredResult(_0x30f3ef,_0x48f48e){return function(_0x4cf962){if(_0x4cf962){var _0x2f5841=_0x4cf962[_0x4177('0x31')],_0x51739b=_0x48f48e[_0x4177('0x32')],_0xd37ebd=_0x48f48e['offset']+_0x48f48e['limit'],_0x18de51;if(_0xd37ebd>=_0x2f5841){_0xd37ebd=_0x2f5841;_0x18de51=0xc8;}else{_0x18de51=0xce;}_0x30f3ef[_0x4177('0x2f')](_0x18de51);return _0x30f3ef['set'](_0x4177('0x33'),_0x51739b+'-'+_0xd37ebd+'/'+_0x2f5841)[_0x4177('0x34')](_0x4cf962);}return null;};}function patchUpdates(_0x2e4190){return function(_0x307460){try{jsonpatch['apply'](_0x307460,_0x2e4190,!![]);}catch(_0x4688a5){return BPromise['reject'](_0x4688a5);}return _0x307460[_0x4177('0x35')]();};}function saveUpdates(_0x24f7e4,_0x3e6187){return function(_0x441133){if(_0x441133){return _0x441133[_0x4177('0x36')](_0x24f7e4)['then'](function(_0x15995c){return _0x15995c;});}return null;};}function removeEntity(_0x2e3f4a,_0x38d66b){return function(_0x28b0fe){if(_0x28b0fe){return _0x28b0fe['destroy']()[_0x4177('0x24')](function(){var _0x7810d7=_0x28b0fe[_0x4177('0x37')]({'plain':!![]});var _0x3336ec='OpenchannelAccounts';return db[_0x4177('0x38')][_0x4177('0x39')]({'where':{'type':_0x3336ec,'resourceId':_0x7810d7['id']}})[_0x4177('0x24')](function(){return _0x28b0fe;});})['then'](function(){_0x2e3f4a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4e6e33,_0x45883d){return function(_0x4b2de0){if(!_0x4b2de0){_0x4e6e33[_0x4177('0x2e')](0x194);}return _0x4b2de0;};}function handleError(_0x5c107b,_0x2688a5){_0x2688a5=_0x2688a5||0x1f4;return function(_0x543dad){logger[_0x4177('0x2a')](_0x543dad['stack']);if(_0x543dad[_0x4177('0x3a')]){delete _0x543dad[_0x4177('0x3a')];}_0x5c107b[_0x4177('0x2f')](_0x2688a5)[_0x4177('0x3b')](_0x543dad);};}exports[_0x4177('0x3c')]=function(_0x359b04,_0x1fef2c){var _0x1c2d5f={'include':[{'model':db[_0x4177('0x3d')],'as':'mandatoryDispositionPause'}]},_0x2fe62d={},_0x4bf18c={'count':0x0,'rows':[]};var _0x59a020=_[_0x4177('0x3e')](db['OpenchannelAccount']['rawAttributes'],function(_0x4162fb){return{'name':_0x4162fb['fieldName'],'type':_0x4162fb[_0x4177('0x3f')][_0x4177('0x40')]};});_0x2fe62d[_0x4177('0x41')]=_['map'](_0x59a020,_0x4177('0x3a'));_0x2fe62d[_0x4177('0x42')]=_[_0x4177('0x43')](_0x359b04['query']);_0x2fe62d[_0x4177('0x44')]=_[_0x4177('0x45')](_0x2fe62d[_0x4177('0x41')],_0x2fe62d[_0x4177('0x42')]);_0x1c2d5f['attributes']=_[_0x4177('0x45')](_0x2fe62d[_0x4177('0x41')],qs['fields'](_0x359b04['query']['fields']));_0x1c2d5f[_0x4177('0x46')]=_0x1c2d5f[_0x4177('0x46')][_0x4177('0x47')]?_0x1c2d5f[_0x4177('0x46')]:_0x2fe62d[_0x4177('0x41')];if(!_0x359b04[_0x4177('0x42')]['hasOwnProperty'](_0x4177('0x48'))){_0x1c2d5f[_0x4177('0x49')]=qs['limit'](_0x359b04['query'][_0x4177('0x49')]);_0x1c2d5f['offset']=qs['offset'](_0x359b04[_0x4177('0x42')][_0x4177('0x32')]);}_0x1c2d5f[_0x4177('0x4a')]=qs[_0x4177('0x4b')](_0x359b04[_0x4177('0x42')][_0x4177('0x4b')]);_0x1c2d5f[_0x4177('0x4c')]=qs[_0x4177('0x44')](_[_0x4177('0x4d')](_0x359b04[_0x4177('0x42')],_0x2fe62d[_0x4177('0x44')]));if(_0x359b04[_0x4177('0x42')][_0x4177('0x4e')]){_0x1c2d5f[_0x4177('0x4c')]=_[_0x4177('0x4f')](_0x1c2d5f[_0x4177('0x4c')],{'$or':_['map'](_0x59a020,function(_0x1e0ccd){if(_0x1e0ccd[_0x4177('0x3f')]!==_0x4177('0x50')){var _0x24523e={};_0x24523e[_0x1e0ccd[_0x4177('0x3a')]]={'$like':'%'+_0x359b04[_0x4177('0x42')][_0x4177('0x4e')]+'%'};return _0x24523e;}})});}_0x1c2d5f=_['merge']({},_0x1c2d5f,_0x359b04[_0x4177('0x51')]);var _0x42f7f3={'where':_0x1c2d5f[_0x4177('0x4c')]};return db[_0x4177('0x52')][_0x4177('0x31')](_0x42f7f3)[_0x4177('0x24')](function(_0x2deb39){_0x4bf18c[_0x4177('0x31')]=_0x2deb39;if(_0x359b04[_0x4177('0x42')][_0x4177('0x53')]){_0x1c2d5f[_0x4177('0x54')]=[{'all':!![]}];}return db[_0x4177('0x52')]['findAll'](_0x1c2d5f);})[_0x4177('0x24')](function(_0x1c5909){_0x4bf18c[_0x4177('0x55')]=_0x1c5909;return _0x4bf18c;})[_0x4177('0x24')](respondWithFilteredResult(_0x1fef2c,_0x1c2d5f))[_0x4177('0x2d')](handleError(_0x1fef2c,null));};exports['show']=function(_0x3e8f9d,_0x5c2ec0){var _0x591f65={'raw':![],'where':{'id':_0x3e8f9d[_0x4177('0x56')]['id']},'include':[{'model':db[_0x4177('0x3d')],'as':'mandatoryDispositionPause'}]},_0x3c0b45={};_0x3c0b45[_0x4177('0x41')]=_[_0x4177('0x43')](db[_0x4177('0x52')]['rawAttributes']);_0x3c0b45[_0x4177('0x42')]=_[_0x4177('0x43')](_0x3e8f9d[_0x4177('0x42')]);_0x3c0b45[_0x4177('0x44')]=_[_0x4177('0x45')](_0x3c0b45['model'],_0x3c0b45[_0x4177('0x42')]);_0x591f65['attributes']=_[_0x4177('0x45')](_0x3c0b45[_0x4177('0x41')],qs['fields'](_0x3e8f9d['query'][_0x4177('0x57')]));_0x591f65['attributes']=_0x591f65['attributes'][_0x4177('0x47')]?_0x591f65[_0x4177('0x46')]:_0x3c0b45['model'];if(_0x3e8f9d['query'][_0x4177('0x53')]){_0x591f65[_0x4177('0x54')]=[{'all':!![]}];}_0x591f65=_[_0x4177('0x4f')]({},_0x591f65,_0x3e8f9d[_0x4177('0x51')]);return db[_0x4177('0x52')][_0x4177('0x58')](_0x591f65)[_0x4177('0x24')](handleEntityNotFound(_0x5c2ec0,null))[_0x4177('0x24')](respondWithResult(_0x5c2ec0,null))[_0x4177('0x2d')](handleError(_0x5c2ec0,null));};exports[_0x4177('0x59')]=function(_0x5a5302,_0x1bfa04){return db['OpenchannelAccount'][_0x4177('0x59')](_0x5a5302[_0x4177('0x5a')],{})[_0x4177('0x24')](function(_0x19a250){var _0x6c435b=_0x5a5302[_0x4177('0x5b')][_0x4177('0x37')]({'plain':!![]});if(!_0x6c435b)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x6c435b['role']==='user'){var _0x44c824=_0x19a250[_0x4177('0x37')]({'plain':!![]});var _0x49e751=_0x4177('0x5c');return db[_0x4177('0x5d')][_0x4177('0x58')]({'where':{'name':_0x49e751,'userProfileId':_0x6c435b['userProfileId']},'raw':!![]})[_0x4177('0x24')](function(_0x1de457){if(_0x1de457&&_0x1de457[_0x4177('0x5e')]===0x0){return db['UserProfileResource'][_0x4177('0x59')]({'name':_0x44c824[_0x4177('0x3a')],'resourceId':_0x44c824['id'],'type':_0x1de457[_0x4177('0x3a')],'sectionId':_0x1de457['id']},{})['then'](function(){return _0x19a250;});}else{return _0x19a250;}})[_0x4177('0x2d')](function(_0x2208dd){logger[_0x4177('0x2a')](_0x4177('0x5f'),_0x2208dd);throw _0x2208dd;});}return _0x19a250;})['then'](respondWithResult(_0x1bfa04,0xc9))['catch'](handleError(_0x1bfa04,null));};exports[_0x4177('0x36')]=function(_0x1052a5,_0x51edd7){if(_0x1052a5[_0x4177('0x5a')]['id']){delete _0x1052a5[_0x4177('0x5a')]['id'];}return db[_0x4177('0x52')][_0x4177('0x58')]({'where':{'id':_0x1052a5[_0x4177('0x56')]['id']},'include':[{'model':db[_0x4177('0x3d')],'as':_0x4177('0x60')}]})[_0x4177('0x24')](handleEntityNotFound(_0x51edd7,null))['then'](saveUpdates(_0x1052a5[_0x4177('0x5a')],null))[_0x4177('0x24')](respondWithResult(_0x51edd7,null))[_0x4177('0x2d')](handleError(_0x51edd7,null));};exports['destroy']=function(_0x1e4137,_0x39c726){return db[_0x4177('0x52')][_0x4177('0x58')]({'where':{'id':_0x1e4137[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x39c726,null))['then'](removeEntity(_0x39c726,null))[_0x4177('0x2d')](handleError(_0x39c726,null));};exports['describe']=function(_0x3f5098,_0x334795){return db['OpenchannelAccount']['describe']()[_0x4177('0x24')](respondWithResult(_0x334795,null))[_0x4177('0x2d')](handleError(_0x334795,null));};exports['addDisposition']=function(_0x3b55dc,_0xf6ebbf,_0x41f47f){if(_0x3b55dc['body']['id']){delete _0x3b55dc[_0x4177('0x5a')]['id'];}return db[_0x4177('0x52')][_0x4177('0x58')]({'where':{'id':_0x3b55dc['params']['id']}})['then'](handleEntityNotFound(_0xf6ebbf,null))[_0x4177('0x24')](function(_0x12f2db){if(_0x12f2db){_0x3b55dc[_0x4177('0x5a')]['OpnechannelAccountId']=_0x12f2db['id'];return db[_0x4177('0x61')]['create'](_0x3b55dc['body']);}})[_0x4177('0x24')](respondWithResult(_0xf6ebbf,null))[_0x4177('0x2d')](handleError(_0xf6ebbf,null));};exports[_0x4177('0x62')]=function(_0x2f1c59,_0x27415e,_0x421944){var _0x235dba={'raw':![],'where':{}};var _0x4cac0d={};var _0x490c2d={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4177('0x63')]({'where':{'id':_0x2f1c59[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x27415e,null))['then'](function(_0x1eaa04){if(_0x1eaa04){_0x4cac0d[_0x4177('0x41')]=_['keys'](db[_0x4177('0x61')][_0x4177('0x64')]);_0x4cac0d[_0x4177('0x42')]=_[_0x4177('0x43')](_0x2f1c59[_0x4177('0x42')]);_0x4cac0d[_0x4177('0x44')]=_['intersection'](_0x4cac0d[_0x4177('0x41')],_0x4cac0d['query']);_0x235dba[_0x4177('0x46')]=_[_0x4177('0x45')](_0x4cac0d[_0x4177('0x41')],qs[_0x4177('0x57')](_0x2f1c59[_0x4177('0x42')][_0x4177('0x57')]));_0x235dba[_0x4177('0x46')]=_0x235dba[_0x4177('0x46')][_0x4177('0x47')]?_0x235dba[_0x4177('0x46')]:_0x4cac0d[_0x4177('0x41')];if(!_0x2f1c59[_0x4177('0x42')]['hasOwnProperty'](_0x4177('0x48'))){_0x235dba[_0x4177('0x49')]=qs[_0x4177('0x49')](_0x2f1c59[_0x4177('0x42')][_0x4177('0x49')]);_0x235dba[_0x4177('0x32')]=qs[_0x4177('0x32')](_0x2f1c59[_0x4177('0x42')][_0x4177('0x32')]);}_0x235dba[_0x4177('0x4a')]=qs[_0x4177('0x4b')](_0x2f1c59[_0x4177('0x42')][_0x4177('0x4b')]);_0x235dba[_0x4177('0x4c')]=qs[_0x4177('0x44')](_[_0x4177('0x4d')](_0x2f1c59[_0x4177('0x42')],_0x4cac0d[_0x4177('0x44')]));_0x235dba[_0x4177('0x4c')][_0x4177('0x65')]=_0x1eaa04['id'];if(_0x2f1c59[_0x4177('0x42')]['filter']){_0x235dba['where']=_[_0x4177('0x4f')](_0x235dba[_0x4177('0x4c')],{'$or':_['map'](_0x235dba[_0x4177('0x46')],function(_0x161e1c){var _0x40bee1={};_0x40bee1[_0x161e1c]={'$like':'%'+_0x2f1c59[_0x4177('0x42')][_0x4177('0x4e')]+'%'};return _0x40bee1;})});}_0x235dba=_[_0x4177('0x4f')]({},_0x235dba,_0x2f1c59[_0x4177('0x51')]);return db['Disposition'][_0x4177('0x31')]({'where':_0x235dba[_0x4177('0x4c')]})['then'](function(_0x54ed66){_0x490c2d[_0x4177('0x31')]=_0x54ed66;if(_0x2f1c59[_0x4177('0x42')][_0x4177('0x53')]){_0x235dba[_0x4177('0x54')]=[{'all':!![]}];}return db[_0x4177('0x61')]['findAll'](_0x235dba);})[_0x4177('0x24')](function(_0x3f304c){_0x490c2d[_0x4177('0x55')]=_0x3f304c;return _0x490c2d;});}})[_0x4177('0x24')](respondWithFilteredResult(_0x27415e,_0x235dba))[_0x4177('0x2d')](handleError(_0x27415e,null));};exports[_0x4177('0x66')]=function(_0x3e555a,_0x5753e9,_0x5a3ca7){return db[_0x4177('0x52')]['find']({'where':{'id':_0x3e555a[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x5753e9,null))['then'](function(_0x42d93f){if(_0x42d93f){return _0x42d93f[_0x4177('0x66')](_0x3e555a['query'][_0x4177('0x67')]);}})[_0x4177('0x24')](respondWithStatusCode(_0x5753e9,null))['catch'](handleError(_0x5753e9,null));};exports[_0x4177('0x68')]=function(_0x18237d,_0x321f15,_0x50e653){if(_0x18237d[_0x4177('0x5a')]['id']){delete _0x18237d[_0x4177('0x5a')]['id'];}return db['OpenchannelAccount']['find']({'where':{'id':_0x18237d[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x321f15,null))['then'](function(_0x8d1070){if(_0x8d1070){_0x18237d[_0x4177('0x5a')][_0x4177('0x65')]=_0x8d1070['id'];return db[_0x4177('0x69')][_0x4177('0x59')](_0x18237d[_0x4177('0x5a')]);}})['then'](respondWithResult(_0x321f15,null))[_0x4177('0x2d')](handleError(_0x321f15,null));};exports[_0x4177('0x6a')]=function(_0x44cb14,_0x546bf1,_0x33f96f){var _0x4ca5ec={'raw':![],'where':{}};var _0x31d71b={};var _0x4c6fc3={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x4177('0x63')]({'where':{'id':_0x44cb14[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x546bf1,null))[_0x4177('0x24')](function(_0x58874b){if(_0x58874b){_0x31d71b['model']=_[_0x4177('0x43')](db[_0x4177('0x69')][_0x4177('0x64')]);_0x31d71b[_0x4177('0x42')]=_[_0x4177('0x43')](_0x44cb14[_0x4177('0x42')]);_0x31d71b['filters']=_[_0x4177('0x45')](_0x31d71b[_0x4177('0x41')],_0x31d71b[_0x4177('0x42')]);_0x4ca5ec[_0x4177('0x46')]=_[_0x4177('0x45')](_0x31d71b['model'],qs['fields'](_0x44cb14['query'][_0x4177('0x57')]));_0x4ca5ec[_0x4177('0x46')]=_0x4ca5ec[_0x4177('0x46')][_0x4177('0x47')]?_0x4ca5ec['attributes']:_0x31d71b[_0x4177('0x41')];if(!_0x44cb14[_0x4177('0x42')][_0x4177('0x6b')](_0x4177('0x48'))){_0x4ca5ec[_0x4177('0x49')]=qs[_0x4177('0x49')](_0x44cb14[_0x4177('0x42')][_0x4177('0x49')]);_0x4ca5ec[_0x4177('0x32')]=qs['offset'](_0x44cb14[_0x4177('0x42')]['offset']);}_0x4ca5ec[_0x4177('0x4a')]=qs[_0x4177('0x4b')](_0x44cb14[_0x4177('0x42')][_0x4177('0x4b')]);_0x4ca5ec['where']=qs[_0x4177('0x44')](_[_0x4177('0x4d')](_0x44cb14[_0x4177('0x42')],_0x31d71b['filters']));_0x4ca5ec['where'][_0x4177('0x65')]=_0x58874b['id'];if(_0x44cb14[_0x4177('0x42')][_0x4177('0x4e')]){_0x4ca5ec['where']=_[_0x4177('0x4f')](_0x4ca5ec[_0x4177('0x4c')],{'$or':_[_0x4177('0x3e')](_0x4ca5ec[_0x4177('0x46')],function(_0x112e8a){var _0x91853c={};_0x91853c[_0x112e8a]={'$like':'%'+_0x44cb14[_0x4177('0x42')][_0x4177('0x4e')]+'%'};return _0x91853c;})});}_0x4ca5ec=_[_0x4177('0x4f')]({},_0x4ca5ec,_0x44cb14['options']);return db['CannedAnswer'][_0x4177('0x31')]({'where':_0x4ca5ec['where']})[_0x4177('0x24')](function(_0x4aed2c){_0x4c6fc3[_0x4177('0x31')]=_0x4aed2c;if(_0x44cb14[_0x4177('0x42')]['includeAll']){_0x4ca5ec['include']=[{'all':!![]}];}return db[_0x4177('0x69')]['findAll'](_0x4ca5ec);})[_0x4177('0x24')](function(_0x5b8d67){_0x4c6fc3['rows']=_0x5b8d67;return _0x4c6fc3;});}})[_0x4177('0x24')](respondWithFilteredResult(_0x546bf1,_0x4ca5ec))[_0x4177('0x2d')](handleError(_0x546bf1,null));};exports['removeAnswers']=function(_0x30a57d,_0x4af88d,_0x5dbbfd){return db['OpenchannelAccount']['find']({'where':{'id':_0x30a57d['params']['id']}})['then'](handleEntityNotFound(_0x4af88d,null))[_0x4177('0x24')](function(_0x770987){if(_0x770987){return _0x770987['removeAnswers'](_0x30a57d[_0x4177('0x42')][_0x4177('0x67')]);}})[_0x4177('0x24')](respondWithStatusCode(_0x4af88d,null))['catch'](handleError(_0x4af88d,null));};exports[_0x4177('0x6c')]=function(_0x4fc7cd,_0x3d96cf,_0x30b10e){var _0x40e009={'body':_0x4fc7cd[_0x4177('0x5a')],'channel':_0x4177('0x6d')};var _0x581e40=[];var _0x4ee077=[];var _0x1b05f4={};var _0xede209=![];return db[_0x4177('0x6e')][_0x4177('0x6f')]()[_0x4177('0x24')](function(_0x22df3d){if(!_0x22df3d){throw new db[(_0x4177('0x21'))][(_0x4177('0x22'))]('no\x20available\x20attributes');}_0x581e40=_[_0x4177('0x70')](_['keys'](_0x22df3d),[_0x4177('0x71'),_0x4177('0x72')]);_0x4ee077=_[_0x4177('0x70')](_[_0x4177('0x43')](_0x22df3d),[_0x4177('0x71'),_0x4177('0x72'),_0x4177('0x73'),_0x4177('0x74')]);if(_0x4fc7cd['body']['id']){delete _0x4fc7cd[_0x4177('0x5a')]['id'];}if(_[_0x4177('0x75')](_0x4fc7cd[_0x4177('0x5a')]['from'])){throw new db[(_0x4177('0x21'))][(_0x4177('0x22'))](_0x4177('0x76'));}if(_[_0x4177('0x75')](_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x5a')])||_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x5a')]===''){throw new db[(_0x4177('0x21'))][(_0x4177('0x22'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x4177('0x75')](_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x77')])){throw new db[(_0x4177('0x21'))][(_0x4177('0x22'))](_0x4177('0x78')+_0x4ee077);}if(!_[_0x4177('0x79')](_0x4ee077,_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x77')])){throw new db[(_0x4177('0x21'))][(_0x4177('0x22'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4ee077);}_0x1b05f4[_0x4fc7cd['body'][_0x4177('0x77')]]=_0x4fc7cd['body'][_0x4177('0x7a')];})[_0x4177('0x24')](function(){return db[_0x4177('0x52')][_0x4177('0x58')]({'where':{'id':_0x4fc7cd[_0x4177('0x56')]['id']},'include':[{'model':db[_0x4177('0x7b')],'as':_0x4177('0x7c'),'include':[{'model':db[_0x4177('0x6e')],'as':_0x4177('0x7d'),'where':_0x1b05f4,'limit':0x1,'order':[[_0x4177('0x72'),'DESC']]}]},{'model':db['OpenchannelApplication'],'as':_0x4177('0x7e')}]});})[_0x4177('0x24')](handleEntityNotFound(_0x3d96cf,null))[_0x4177('0x24')](function(_0x554855){if(_0x554855&&_0x554855['List']){_0x40e009['account']=_0x554855;_0x40e009[_0x4177('0x7f')]=_0x554855[_0x4177('0x7e')];_0x40e009[_0x4177('0x80')]=_0x554855[_0x4177('0x7c')];_0x40e009[_0x4177('0x7f')]=_['orderBy'](_0x40e009['applications'],[_0x4177('0x81')],[_0x4177('0x82')]);if(_0x40e009[_0x4177('0x83')]['Applications']){delete _0x40e009[_0x4177('0x83')][_0x4177('0x7e')];}if(_0x40e009[_0x4177('0x83')][_0x4177('0x7c')]&&_0x40e009['account'][_0x4177('0x7c')][_0x4177('0x7d')][_0x4177('0x47')]){return _0x40e009['account'][_0x4177('0x7c')][_0x4177('0x7d')][0x0];}var _0x37b0dd=_[_0x4177('0x1a')](_0x4fc7cd[_0x4177('0x5a')],{'firstName':_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x7a')],'ListId':_0x554855[_0x4177('0x74')]});_0x37b0dd[_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x77')]]=_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x7a')];return db[_0x4177('0x6e')]['create'](_0x37b0dd,{'fields':_0x581e40,'raw':!![]});}})[_0x4177('0x24')](handleEntityNotFound(_0x3d96cf,null))['then'](function(_0x39ca43){_0x40e009[_0x4177('0x84')]=_0x39ca43;if(_0x39ca43){var _0x4c3348={'ContactId':_0x39ca43['id'],'OpenchannelAccountId':_0x4fc7cd[_0x4177('0x56')]['id'],'from':(_0x39ca43[_0x4177('0x85')]||'')+'\x20'+(_0x39ca43[_0x4177('0x86')]||'')};var _0x25e5e1={'OpenchannelAccountId':_0x4fc7cd[_0x4177('0x56')]['id'],'closed':![]};if(_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x87')]){_0x25e5e1[_0x4177('0x87')]=_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x87')];return db['OpenchannelInteraction'][_0x4177('0x58')]({'where':_0x25e5e1})[_0x4177('0x24')](function(_0x5a8e4e){if(_0x5a8e4e){return[_0x5a8e4e,![]];}_0x4c3348[_0x4177('0x87')]=_0x4fc7cd[_0x4177('0x5a')]['threadId'];_0x4c3348[_0x4177('0x88')]=_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x88')];return db[_0x4177('0x89')]['create'](_0x4c3348)[_0x4177('0x24')](function(_0x3439fa){return[_0x3439fa,!![]];});});}else{_0x25e5e1['threadId']=null;}_0x25e5e1[_0x4177('0x8a')]=_0x39ca43['id'];return db['OpenchannelInteraction']['find']({'where':_0x25e5e1})['then'](function(_0x52ec50){if(_0x52ec50){return[_0x52ec50,![]];}return db[_0x4177('0x89')]['create'](_0x4c3348)[_0x4177('0x24')](function(_0xb4bccb){return[_0xb4bccb,!![]];});});}})[_0x4177('0x8b')](function(_0x7d7139,_0x2f5fbe){if(_0x7d7139){_0xede209=_0x2f5fbe;if(!_0x2f5fbe){var _0xf4a872={'from':(_0x40e009[_0x4177('0x84')][_0x4177('0x85')]||'')+'\x20'+(_0x40e009[_0x4177('0x84')][_0x4177('0x86')]||'')};if(_0x4fc7cd['body']['threadId']&&_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x8c')]&&_0x4fc7cd[_0x4177('0x5a')]['threadId']!=_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x8c')]){_0xf4a872['threadId']=_0x4fc7cd[_0x4177('0x5a')]['messageId'];}return _0x7d7139['update'](_0xf4a872);}else{return _0x7d7139;}}})[_0x4177('0x24')](function(_0x238755){_0x40e009['interaction']=_0x238755[_0x4177('0x37')]({'plain':!![]});_0x40e009[_0x4177('0x8d')][_0x4177('0x8e')]=_0xede209;if(_0x40e009['interaction'][_0x4177('0x8e')]){if(_0x40e009[_0x4177('0x83')][_0x4177('0x8f')]){_0x40e009[_0x4177('0x7f')][_0x4177('0x90')]({'id':0x0,'priority':_0x40e009[_0x4177('0x7f')][_0x4177('0x47')]+0x1,'app':_0x4177('0x91'),'appdata':_0x4177('0x92'),'interval':_0x4177('0x93')});}}return db[_0x4177('0x94')][_0x4177('0x59')]({'body':_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x5a')],'OpenchannelAccountId':_0x4fc7cd[_0x4177('0x56')]['id'],'OpenchannelInteractionId':_0x238755['id'],'direction':'in','ContactId':_0x40e009['contact']['id'],'AttachmentId':_0x4fc7cd[_0x4177('0x5a')][_0x4177('0x95')]});})[_0x4177('0x24')](function(_0x137fb9){_0x40e009[_0x4177('0x2b')]=_0x137fb9;if(_0x40e009[_0x4177('0x8d')]['UserId']){return db['User'][_0x4177('0x58')]({'attributes':['id',_0x4177('0x3a')],'where':{'id':_0x40e009[_0x4177('0x8d')]['UserId']}})[_0x4177('0x24')](function(_0x14871c){if(_0x14871c){_0x40e009[_0x4177('0x7f')][_0x4177('0x96')]({'id':0x0,'priority':0x0,'app':_0x4177('0x97'),'appdata':_0x14871c[_0x4177('0x3a')]+','+(_0x40e009[_0x4177('0x83')][_0x4177('0x98')]||0xa),'interval':'*,*,*,*'});_0x40e009[_0x4177('0x99')]=![];}return respondWithRpcPromise(_0x4177('0x9a'),_0x4177('0x9b'),_0x40e009);});}return respondWithRpcPromise('Start',_0x4177('0x9b'),_0x40e009);})[_0x4177('0x24')](function(_0x3a18ee){respondWithRpcPromise(_0x4177('0x9c'),_0x4177('0x9c'),{'event':_0x4177('0x6c'),'message':_0x3a18ee},client9002);return _0x3a18ee;})[_0x4177('0x24')](respondWithResult(_0x3d96cf,null))[_0x4177('0x2d')](handleError(_0x3d96cf,null));};exports[_0x4177('0x9d')]=function(_0x4588ea,_0x5c0083,_0x3f60fb){return db[_0x4177('0x52')]['findOne']({'where':{'id':_0x4588ea['params']['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x5c0083,null))[_0x4177('0x24')](function(_0x35fe15){if(_0x35fe15){return db[_0x4177('0x9e')]['transaction'](function(_0x11c5d6){return db[_0x4177('0x9f')][_0x4177('0x39')]({'where':{'OpenchannelAccountId':_0x4588ea[_0x4177('0x56')]['id']},'transaction':_0x11c5d6})[_0x4177('0x24')](function(_0x20e62c){var _0x38bddc=_[_0x4177('0x3e')](_0x4588ea['body'],function(_0x353430){_0x353430[_0x4177('0x65')]=_0x4588ea[_0x4177('0x56')]['id'];return _0x353430;});return db[_0x4177('0x9f')][_0x4177('0xa0')](_0x38bddc,{'transaction':_0x11c5d6});});})[_0x4177('0x24')](function(){return db[_0x4177('0x9f')][_0x4177('0xa1')]({'where':{'OpenchannelAccountId':_0x4588ea['params']['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5c0083,null))['catch'](handleError(_0x5c0083,null));};exports[_0x4177('0xa2')]=function(_0x2606c5,_0x3e130c,_0x139f3b){var _0x2582e7={};var _0x2ad74e={};var _0x362c7f;var _0x492e68;return db['OpenchannelAccount'][_0x4177('0x63')]({'where':{'id':_0x2606c5['params']['id']}})['then'](handleEntityNotFound(_0x3e130c,null))['then'](function(_0x137eac){if(_0x137eac){_0x362c7f=_0x137eac;_0x2ad74e[_0x4177('0x41')]=_[_0x4177('0x43')](db['OpenchannelApplication'][_0x4177('0x64')]);_0x2ad74e[_0x4177('0x42')]=_[_0x4177('0x43')](_0x2606c5['query']);_0x2ad74e[_0x4177('0x44')]=_[_0x4177('0x45')](_0x2ad74e['model'],_0x2ad74e['query']);_0x2582e7[_0x4177('0x46')]=_[_0x4177('0x45')](_0x2ad74e[_0x4177('0x41')],qs['fields'](_0x2606c5[_0x4177('0x42')][_0x4177('0x57')]));_0x2582e7[_0x4177('0x46')]=_0x2582e7['attributes'][_0x4177('0x47')]?_0x2582e7[_0x4177('0x46')]:_0x2ad74e['model'];_0x2582e7[_0x4177('0x4a')]=qs['sort'](_0x2606c5[_0x4177('0x42')]['sort']);_0x2582e7[_0x4177('0x4c')]=qs[_0x4177('0x44')](_['pick'](_0x2606c5[_0x4177('0x42')],_0x2ad74e['filters']));if(_0x2606c5[_0x4177('0x42')][_0x4177('0x4e')]){_0x2582e7['where']=_[_0x4177('0x4f')](_0x2582e7[_0x4177('0x4c')],{'$or':_[_0x4177('0x3e')](_0x2582e7['attributes'],function(_0x29bf2b){var _0x387628={};_0x387628[_0x29bf2b]={'$like':'%'+_0x2606c5[_0x4177('0x42')][_0x4177('0x4e')]+'%'};return _0x387628;})});}_0x2582e7=_[_0x4177('0x4f')]({},_0x2582e7,_0x2606c5[_0x4177('0x51')]);return _0x362c7f[_0x4177('0xa2')](_0x2582e7);}})[_0x4177('0x24')](function(_0x4cf6aa){if(_0x4cf6aa){_0x492e68=_0x4cf6aa[_0x4177('0x47')];if(!_0x2606c5['query']['hasOwnProperty'](_0x4177('0x48'))){_0x2582e7[_0x4177('0x49')]=qs[_0x4177('0x49')](_0x2606c5[_0x4177('0x42')][_0x4177('0x49')]);_0x2582e7[_0x4177('0x32')]=qs[_0x4177('0x32')](_0x2606c5[_0x4177('0x42')][_0x4177('0x32')]);}return _0x362c7f[_0x4177('0xa2')](_0x2582e7);}})[_0x4177('0x24')](function(_0x40374d){if(_0x40374d){return _0x40374d?{'count':_0x492e68,'rows':_0x40374d}:null;}})['then'](respondWithResult(_0x3e130c,null))[_0x4177('0x2d')](handleError(_0x3e130c,null));};exports['getInteractions']=function(_0x4d79ee,_0x4d2ffa,_0x30f039){var _0x1cda4b={'raw':![],'where':{}};var _0x14b927={};var _0x53b11a={'count':0x0,'rows':[]};return db[_0x4177('0x52')][_0x4177('0x63')]({'where':{'id':_0x4d79ee[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x4d2ffa,null))[_0x4177('0x24')](function(_0x5f0a5d){if(_0x5f0a5d){_0x14b927[_0x4177('0x41')]=_[_0x4177('0x43')](db[_0x4177('0x89')]['rawAttributes']);_0x14b927[_0x4177('0x42')]=_[_0x4177('0x43')](_0x4d79ee[_0x4177('0x42')]);_0x14b927[_0x4177('0x44')]=_['intersection'](_0x14b927['model'],_0x14b927[_0x4177('0x42')]);_0x1cda4b[_0x4177('0x46')]=_[_0x4177('0x45')](_0x14b927['model'],qs[_0x4177('0x57')](_0x4d79ee[_0x4177('0x42')]['fields']));_0x1cda4b[_0x4177('0x46')]=_0x1cda4b['attributes']['length']?_0x1cda4b[_0x4177('0x46')]:_0x14b927[_0x4177('0x41')];if(!_0x4d79ee[_0x4177('0x42')][_0x4177('0x6b')](_0x4177('0x48'))){_0x1cda4b[_0x4177('0x49')]=qs['limit'](_0x4d79ee[_0x4177('0x42')][_0x4177('0x49')]);_0x1cda4b['offset']=qs[_0x4177('0x32')](_0x4d79ee[_0x4177('0x42')][_0x4177('0x32')]);}_0x1cda4b['order']=qs[_0x4177('0x4b')](_0x4d79ee[_0x4177('0x42')][_0x4177('0x4b')]);_0x1cda4b[_0x4177('0x4c')]=qs['filters'](_[_0x4177('0x4d')](_0x4d79ee['query'],_0x14b927[_0x4177('0x44')]));_0x1cda4b['where'][_0x4177('0x65')]=_0x5f0a5d['id'];if(_0x4d79ee[_0x4177('0x42')]['filter']){_0x1cda4b[_0x4177('0x4c')]=_[_0x4177('0x4f')](_0x1cda4b[_0x4177('0x4c')],{'$or':_[_0x4177('0x3e')](_0x1cda4b[_0x4177('0x46')],function(_0x56de12){var _0x3723ba={};_0x3723ba[_0x56de12]={'$like':'%'+_0x4d79ee[_0x4177('0x42')]['filter']+'%'};return _0x3723ba;})});}_0x1cda4b=_[_0x4177('0x4f')]({},_0x1cda4b,_0x4d79ee['options']);return db['OpenchannelInteraction']['count']({'where':_0x1cda4b[_0x4177('0x4c')]})['then'](function(_0x377467){_0x53b11a[_0x4177('0x31')]=_0x377467;if(_0x4d79ee[_0x4177('0x42')][_0x4177('0x53')]){_0x1cda4b[_0x4177('0x54')]=[{'model':db[_0x4177('0x6e')],'as':_0x4177('0xa3'),'required':![]},{'model':db[_0x4177('0xa4')],'as':'Owner','attributes':[_0x4177('0x3a'),_0x4177('0xa5'),_0x4177('0xa6')],'required':![]},{'model':db['Tag'],'as':_0x4177('0xa7'),'attributes':['id',_0x4177('0x3a'),_0x4177('0xa8')],'where':_0x4d79ee[_0x4177('0x42')]['tag']?{'id':_0x4d79ee[_0x4177('0x42')][_0x4177('0xa9')]}:undefined,'required':_0x4d79ee[_0x4177('0x42')]['tag']?!![]:![]}];}return db[_0x4177('0x89')][_0x4177('0xaa')](_0x1cda4b);})[_0x4177('0x24')](function(_0x995b03){_0x53b11a[_0x4177('0x55')]=_0x995b03;return _0x53b11a;});}})[_0x4177('0x24')](respondWithFilteredResult(_0x4d2ffa,_0x1cda4b))[_0x4177('0x2d')](handleError(_0x4d2ffa,null));};exports[_0x4177('0xab')]=function(_0x3cc0a0,_0x420593,_0x1a23f8){return db['OpenchannelAccount']['find']({'where':{'id':_0x3cc0a0[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x420593,null))[_0x4177('0x24')](function(_0x38cab8){if(_0x38cab8){return _0x38cab8['addAgents'](_0x3cc0a0[_0x4177('0x5a')][_0x4177('0x67')],_['omit'](_0x3cc0a0['body'],['ids','id'])||{})[_0x4177('0x8b')](function(_0x5ba51c){for(var _0x53eb93=0x0;_0x53eb93<_0x3cc0a0[_0x4177('0x5a')][_0x4177('0x67')]['length'];_0x53eb93+=0x1){socket['emit'](_0x4177('0xac'),{'UserId':_0x3cc0a0[_0x4177('0x5a')]['ids'][_0x53eb93],'OpenchannelAccountId':_0x3cc0a0['params']['id']});}return _0x5ba51c;});}})[_0x4177('0x24')](respondWithResult(_0x420593,null))['catch'](handleError(_0x420593,null));};exports[_0x4177('0xad')]=function(_0x2489ee,_0x2f8dcc,_0x28b184){return db[_0x4177('0x52')][_0x4177('0x58')]({'where':{'id':_0x2489ee[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x2f8dcc,null))[_0x4177('0x24')](function(_0x21f09b){if(_0x21f09b){return _0x21f09b[_0x4177('0xad')](_0x2489ee['query'][_0x4177('0x67')])['then'](function(){if(_['isArray'](_0x2489ee[_0x4177('0x42')]['ids'])){for(var _0x32a022=0x0;_0x32a022<_0x2489ee['query'][_0x4177('0x67')][_0x4177('0x47')];_0x32a022+=0x1){socket[_0x4177('0xae')](_0x4177('0xaf'),{'UserId':Number(_0x2489ee[_0x4177('0x42')][_0x4177('0x67')][_0x32a022]),'OpenchannelAccountId':Number(_0x2489ee[_0x4177('0x56')]['id'])});}}else{socket[_0x4177('0xae')](_0x4177('0xaf'),{'UserId':Number(_0x2489ee[_0x4177('0x42')][_0x4177('0x67')]),'OpenchannelAccountId':Number(_0x2489ee[_0x4177('0x56')]['id'])});}});}})[_0x4177('0x24')](respondWithStatusCode(_0x2f8dcc,null))['catch'](handleError(_0x2f8dcc,null));};exports['getAgents']=function(_0x3aa329,_0x1559f4,_0x457740){var _0x193146={};var _0x44efb1={};var _0x16d522;var _0x243c96;return db[_0x4177('0x52')][_0x4177('0x63')]({'where':{'id':_0x3aa329[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x1559f4,null))[_0x4177('0x24')](function(_0x45ce19){if(_0x45ce19){_0x16d522=_0x45ce19;_0x44efb1[_0x4177('0x41')]=_[_0x4177('0x43')](db[_0x4177('0xa4')][_0x4177('0x64')]);_0x44efb1[_0x4177('0x42')]=_[_0x4177('0x43')](_0x3aa329[_0x4177('0x42')]);_0x44efb1['filters']=_['intersection'](_0x44efb1[_0x4177('0x41')],_0x44efb1[_0x4177('0x42')]);_0x193146['attributes']=_[_0x4177('0x45')](_0x44efb1['model'],qs[_0x4177('0x57')](_0x3aa329[_0x4177('0x42')][_0x4177('0x57')]));_0x193146['attributes']=_0x193146['attributes']['length']?_0x193146[_0x4177('0x46')]:_0x44efb1[_0x4177('0x41')];_0x193146['order']=qs[_0x4177('0x4b')](_0x3aa329[_0x4177('0x42')][_0x4177('0x4b')]);_0x193146[_0x4177('0x4c')]=qs[_0x4177('0x44')](_[_0x4177('0x4d')](_0x3aa329['query'],_0x44efb1[_0x4177('0x44')]));if(_0x3aa329[_0x4177('0x42')][_0x4177('0x4e')]){_0x193146[_0x4177('0x4c')]=_[_0x4177('0x4f')](_0x193146[_0x4177('0x4c')],{'$or':_[_0x4177('0x3e')](_0x193146[_0x4177('0x46')],function(_0x2034c4){var _0x1368ed={};_0x1368ed[_0x2034c4]={'$like':'%'+_0x3aa329[_0x4177('0x42')][_0x4177('0x4e')]+'%'};return _0x1368ed;})});}_0x193146=_[_0x4177('0x4f')]({},_0x193146,_0x3aa329['options']);return _0x16d522[_0x4177('0xb0')](_0x193146);}})['then'](function(_0x3f55ae){if(_0x3f55ae){_0x243c96=_0x3f55ae[_0x4177('0x47')];if(!_0x3aa329[_0x4177('0x42')][_0x4177('0x6b')]('nolimit')){_0x193146[_0x4177('0x49')]=qs[_0x4177('0x49')](_0x3aa329[_0x4177('0x42')][_0x4177('0x49')]);_0x193146['offset']=qs[_0x4177('0x32')](_0x3aa329[_0x4177('0x42')][_0x4177('0x32')]);}return _0x16d522[_0x4177('0xb0')](_0x193146);}})['then'](function(_0x2d58d7){if(_0x2d58d7){return _0x2d58d7?{'count':_0x243c96,'rows':_0x2d58d7}:null;}})['then'](respondWithResult(_0x1559f4,null))[_0x4177('0x2d')](handleError(_0x1559f4,null));};exports[_0x4177('0x3b')]=function(_0x283ea0,_0x1fbf9f,_0x1e005a){var _0x411405,_0x4091d9,_0x453a99;if(_[_0x4177('0x75')](_0x283ea0['body']['body'])||_0x283ea0[_0x4177('0x5a')][_0x4177('0x5a')]===''){throw new db[(_0x4177('0x21'))]['ValidationError'](_0x4177('0xb1'));}if(_[_0x4177('0x75')](_0x283ea0[_0x4177('0x5a')]['to'])){}_0x411405=_0x283ea0['body']['to'];return db[_0x4177('0x52')][_0x4177('0x63')]({'where':{'id':_0x283ea0[_0x4177('0x56')]['id']}})[_0x4177('0x24')](handleEntityNotFound(_0x1fbf9f,null))[_0x4177('0x24')](function(_0x23ebab){if(_0x23ebab){return db['OpenchannelAccount'][_0x4177('0x58')]({'where':{'id':_0x23ebab['id']},'include':[{'model':db['CmList'],'as':_0x4177('0x7c'),'include':[{'model':db[_0x4177('0x6e')],'as':_0x4177('0x7d'),'where':{[_0x23ebab[_0x4177('0x77')]]:_0x411405},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x4177('0x24')](handleEntityNotFound(_0x1fbf9f,null))[_0x4177('0x24')](function(_0x16caec){if(_0x16caec&&_0x16caec[_0x4177('0x7c')]){_0x4091d9=_0x16caec['get']({'plain':!![]});if(_0x4091d9[_0x4177('0x7c')]&&_0x4091d9[_0x4177('0x7c')][_0x4177('0x7d')][_0x4177('0x47')]){return _0x4091d9[_0x4177('0x7c')][_0x4177('0x7d')][0x0];}return db[_0x4177('0x6e')][_0x4177('0x59')](_[_0x4177('0x1a')](_0x283ea0[_0x4177('0x5a')],{'firstName':_0x411405,[_0x16caec[_0x4177('0x77')]]:_0x411405,'phone':_0x411405,'ListId':_0x4091d9[_0x4177('0x74')]}));}})['then'](handleEntityNotFound(_0x1fbf9f,null))[_0x4177('0x24')](function(_0x46e937){if(_0x46e937){_0x453a99=_0x46e937;return db[_0x4177('0x89')][_0x4177('0x58')]({'where':{'ContactId':_0x453a99['id'],'closed':![],'OpenchannelAccountId':_0x4091d9['id']}})[_0x4177('0x24')](function(_0x2aa35b){if(_0x2aa35b){return[_0x2aa35b,![]];}return db[_0x4177('0x89')][_0x4177('0x59')]({'UserId':_0x283ea0[_0x4177('0x5b')]['id'],'ContactId':_0x453a99['id'],'OpenchannelAccountId':_0x4091d9['id'],'lastMsgDirection':_0x4177('0xb2'),'Messages':[_[_0x4177('0x4f')](_0x283ea0[_0x4177('0x5a')],{'read':![],'body':_0x283ea0[_0x4177('0x5a')][_0x4177('0x5a')],'OpenchannelAccountId':_0x4091d9['id'],'UserId':_0x283ea0[_0x4177('0x5b')]['id'],'ContactId':_0x453a99['id']})]},{'include':[{'model':db[_0x4177('0x94')],'as':_0x4177('0xb3')}]})[_0x4177('0x24')](function(_0x5bc4a6){return[_0x5bc4a6,!![]];});});}})['spread'](function(_0x4031f7,_0xdf7934){if(_0xdf7934){return _0x4031f7;}return db[_0x4177('0x94')][_0x4177('0x59')](_[_0x4177('0x4f')](_0x283ea0[_0x4177('0x5a')],{'read':![],'body':_0x283ea0[_0x4177('0x5a')][_0x4177('0x5a')],'OpenchannelAccountId':_0x4091d9['id'],'OpenchannelInteractionId':_0x4031f7['id'],'UserId':_0x283ea0[_0x4177('0x5b')]['id'],'ContactId':_0x453a99['id']}))[_0x4177('0x24')](function(_0x3273d8){_0x4031f7[_0x4177('0xb4')][_0x4177('0xb3')]=[];_0x4031f7[_0x4177('0xb4')][_0x4177('0xb3')][_0x4177('0x90')](_0x3273d8[_0x4177('0xb4')]);return _0x4031f7;});});}})['then'](respondWithResult(_0x1fbf9f,null))[_0x4177('0x2d')](handleError(_0x1fbf9f,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index b06da50..56a2e8c 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 _0xd517=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events'];(function(_0x11a9c2,_0x16284d){var _0x4ab610=function(_0x39f980){while(--_0x39f980){_0x11a9c2['push'](_0x11a9c2['shift']());}};_0x4ab610(++_0x16284d);}(_0xd517,0x1a6));var _0x7d51=function(_0x54b396,_0x3612ee){_0x54b396=_0x54b396-0x0;var _0x532e6d=_0xd517[_0x54b396];return _0x532e6d;};'use strict';var EventEmitter=require(_0x7d51('0x0'));var OpenchannelAccount=require(_0x7d51('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x7d51('0x2')](0x0);var events={'afterCreate':_0x7d51('0x3'),'afterUpdate':_0x7d51('0x4'),'afterDestroy':'remove'};function emitEvent(_0x47a1f0){return function(_0x1f29da,_0x1dd30c,_0x36f223){OpenchannelAccountEvents[_0x7d51('0x5')](_0x47a1f0+':'+_0x1f29da['id'],_0x1f29da);OpenchannelAccountEvents['emit'](_0x47a1f0,_0x1f29da);_0x36f223(null);};}for(var e in events){if(events[_0x7d51('0x6')](e)){var event=events[e];OpenchannelAccount[_0x7d51('0x7')](e,emitEvent(event));}}module[_0x7d51('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2381=['events','../../mysqldb','OpenchannelAccount','setMaxListeners','save','emit','hasOwnProperty','hook','exports'];(function(_0x52b261,_0x25c300){var _0x3fc6d7=function(_0xc6763c){while(--_0xc6763c){_0x52b261['push'](_0x52b261['shift']());}};_0x3fc6d7(++_0x25c300);}(_0x2381,0x120));var _0x1238=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0x2381[_0x13b02f];return _0x12e9a6;};'use strict';var EventEmitter=require(_0x1238('0x0'));var OpenchannelAccount=require(_0x1238('0x1'))['db'][_0x1238('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x1238('0x3')](0x0);var events={'afterCreate':_0x1238('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x450c97){return function(_0x1cb759,_0x15d5ef,_0x5c53a3){OpenchannelAccountEvents[_0x1238('0x5')](_0x450c97+':'+_0x1cb759['id'],_0x1cb759);OpenchannelAccountEvents[_0x1238('0x5')](_0x450c97,_0x1cb759);_0x5c53a3(null);};}for(var e in events){if(events[_0x1238('0x6')](e)){var event=events[e];OpenchannelAccount[_0x1238('0x7')](e,emitEvent(event));}}module[_0x1238('0x8')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 27f2d57..47a5bb7 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 _0x1cea=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','OpenchannelAccount','openchannel_accounts','lodash','util','../../config/logger'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1cea,0x142));var _0xa1ce=function(_0x2f5a22,_0x5e9f03){_0x2f5a22=_0x2f5a22-0x0;var _0x326b70=_0x1cea[_0x2f5a22];return _0x326b70;};'use strict';var _=require(_0xa1ce('0x0'));var util=require(_0xa1ce('0x1'));var logger=require(_0xa1ce('0x2'))(_0xa1ce('0x3'));var moment=require(_0xa1ce('0x4'));var BPromise=require(_0xa1ce('0x5'));var rp=require(_0xa1ce('0x6'));var fs=require('fs');var path=require(_0xa1ce('0x7'));var rimraf=require(_0xa1ce('0x8'));var config=require(_0xa1ce('0x9'));var attributes=require('./openchannelAccount.attributes');module['exports']=function(_0x5f1fa0,_0xd97ffe){return _0x5f1fa0[_0xa1ce('0xa')](_0xa1ce('0xb'),attributes,{'tableName':_0xa1ce('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfd03=['../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','OpenchannelAccount'];(function(_0x2efd1d,_0x44f696){var _0x1ef3f6=function(_0x25da5f){while(--_0x25da5f){_0x2efd1d['push'](_0x2efd1d['shift']());}};_0x1ef3f6(++_0x44f696);}(_0xfd03,0xa2));var _0x3fd0=function(_0x20845e,_0x211e78){_0x20845e=_0x20845e-0x0;var _0x28cf2b=_0xfd03[_0x20845e];return _0x28cf2b;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x3fd0('0x0'))(_0x3fd0('0x1'));var moment=require(_0x3fd0('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fd0('0x3'));var rimraf=require(_0x3fd0('0x4'));var config=require(_0x3fd0('0x5'));var attributes=require('./openchannelAccount.attributes');module[_0x3fd0('0x6')]=function(_0x59d2f4,_0x35c9ba){return _0x59d2f4[_0x3fd0('0x7')](_0x3fd0('0x8'),attributes,{'tableName':'openchannel_accounts','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 591afcd..25fe0ab 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 _0x365a=['../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x1d15e3,_0x169246){var _0x343de1=function(_0x1e432d){while(--_0x1e432d){_0x1d15e3['push'](_0x1d15e3['shift']());}};_0x343de1(++_0x169246);}(_0x365a,0xaf));var _0xa365=function(_0x266f8b,_0x5a0b10){_0x266f8b=_0x266f8b-0x0;var _0x59b514=_0x365a[_0x266f8b];return _0x59b514;};'use strict';var _=require(_0xa365('0x0'));var util=require(_0xa365('0x1'));var moment=require(_0xa365('0x2'));var BPromise=require('bluebird');var rs=require(_0xa365('0x3'));var fs=require('fs');var Redis=require(_0xa365('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa365('0x5'));var logger=require(_0xa365('0x6'))('rpc');var config=require(_0xa365('0x7'));var jayson=require(_0xa365('0x8'));var client=jayson[_0xa365('0x9')][_0xa365('0xa')]({'port':0x232a});config[_0xa365('0xb')]=_['defaults'](config[_0xa365('0xb')],{'host':_0xa365('0xc'),'port':0x18eb});var socket=require(_0xa365('0xd'))(new Redis(config[_0xa365('0xb')]));require('./openchannelAccount.socket')[_0xa365('0xe')](socket);function respondWithRpcPromise(_0x7361b8,_0x2c6f87,_0x43b64f){return new BPromise(function(_0x25e87a,_0x347ae4){return client[_0xa365('0xf')](_0x7361b8,_0x43b64f)[_0xa365('0x10')](function(_0x1d1ad1){logger[_0xa365('0x11')](_0xa365('0x12'),_0x2c6f87,_0xa365('0x13'));logger[_0xa365('0x14')](_0xa365('0x15'),_0x2c6f87,'request\x20sent',JSON[_0xa365('0x16')](_0x1d1ad1));if(_0x1d1ad1[_0xa365('0x17')]){if(_0x1d1ad1[_0xa365('0x17')]['code']===0x1f4){logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x2c6f87,_0x1d1ad1[_0xa365('0x17')][_0xa365('0x18')]);return _0x347ae4(_0x1d1ad1[_0xa365('0x17')][_0xa365('0x18')]);}logger[_0xa365('0x17')](_0xa365('0x12'),_0x2c6f87,_0x1d1ad1[_0xa365('0x17')]['message']);return _0x25e87a(_0x1d1ad1[_0xa365('0x17')][_0xa365('0x18')]);}else{logger[_0xa365('0x11')](_0xa365('0x12'),_0x2c6f87,_0xa365('0x13'));_0x25e87a(_0x1d1ad1[_0xa365('0x19')][_0xa365('0x18')]);}})['catch'](function(_0x2ac69d){logger[_0xa365('0x17')](_0xa365('0x12'),_0x2c6f87,_0x2ac69d);_0x347ae4(_0x2ac69d);});});} \ No newline at end of file +var _0x6d35=['message','OpenchannelAccount,\x20%s,\x20%s','result','catch','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then','info','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error'];(function(_0x79c97d,_0x204205){var _0x3dfdbb=function(_0x5c3024){while(--_0x5c3024){_0x79c97d['push'](_0x79c97d['shift']());}};_0x3dfdbb(++_0x204205);}(_0x6d35,0x13c));var _0x56d3=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0x6d35[_0x4e1d03];return _0x362d4b;};'use strict';var _=require('lodash');var util=require(_0x56d3('0x0'));var moment=require(_0x56d3('0x1'));var BPromise=require(_0x56d3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x56d3('0x3'));var logger=require(_0x56d3('0x4'))(_0x56d3('0x5'));var config=require(_0x56d3('0x6'));var jayson=require(_0x56d3('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x56d3('0x8')]=_['defaults'](config['redis'],{'host':_0x56d3('0x9'),'port':0x18eb});var socket=require(_0x56d3('0xa'))(new Redis(config[_0x56d3('0x8')]));require(_0x56d3('0xb'))[_0x56d3('0xc')](socket);function respondWithRpcPromise(_0x4e5fed,_0x4abcb6,_0x436ab0){return new BPromise(function(_0x2b0895,_0x59c4c1){return client[_0x56d3('0xd')](_0x4e5fed,_0x436ab0)[_0x56d3('0xe')](function(_0x91dd74){logger[_0x56d3('0xf')]('OpenchannelAccount,\x20%s,\x20%s',_0x4abcb6,_0x56d3('0x10'));logger[_0x56d3('0x11')](_0x56d3('0x12'),_0x4abcb6,_0x56d3('0x10'),JSON['stringify'](_0x91dd74));if(_0x91dd74[_0x56d3('0x13')]){if(_0x91dd74[_0x56d3('0x13')]['code']===0x1f4){logger[_0x56d3('0x13')]('OpenchannelAccount,\x20%s,\x20%s',_0x4abcb6,_0x91dd74[_0x56d3('0x13')][_0x56d3('0x14')]);return _0x59c4c1(_0x91dd74['error'][_0x56d3('0x14')]);}logger[_0x56d3('0x13')](_0x56d3('0x15'),_0x4abcb6,_0x91dd74[_0x56d3('0x13')][_0x56d3('0x14')]);return _0x2b0895(_0x91dd74[_0x56d3('0x13')][_0x56d3('0x14')]);}else{logger['info'](_0x56d3('0x15'),_0x4abcb6,_0x56d3('0x10'));_0x2b0895(_0x91dd74[_0x56d3('0x16')][_0x56d3('0x14')]);}})[_0x56d3('0x17')](function(_0x2a7153){logger[_0x56d3('0x13')](_0x56d3('0x15'),_0x4abcb6,_0x2a7153);_0x59c4c1(_0x2a7153);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 2dc5178..a016641 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 _0xd68a=['register','./openchannelAccount.events','save','remove','emit','removeListener'];(function(_0x589f71,_0x212326){var _0x5763bd=function(_0x2cb8e1){while(--_0x2cb8e1){_0x589f71['push'](_0x589f71['shift']());}};_0x5763bd(++_0x212326);}(_0xd68a,0x1cf));var _0xad68=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xd68a[_0x164eca];return _0x2ce562;};'use strict';var OpenchannelAccountEvents=require(_0xad68('0x0'));var events=[_0xad68('0x1'),_0xad68('0x2'),'update'];function createListener(_0x2f6374,_0x43e40a){return function(_0x291825){_0x43e40a[_0xad68('0x3')](_0x2f6374,_0x291825);};}function removeListener(_0xee9483,_0x3da9cc){return function(){OpenchannelAccountEvents[_0xad68('0x4')](_0xee9483,_0x3da9cc);};}exports[_0xad68('0x5')]=function(_0x1a352a){for(var _0x1bfbc1=0x0,_0x51958c=events['length'];_0x1bfbc1<_0x51958c;_0x1bfbc1++){var _0x5dbff6=events[_0x1bfbc1];var _0x5a3785=createListener('openchannelAccount:'+_0x5dbff6,_0x1a352a);OpenchannelAccountEvents['on'](_0x5dbff6,_0x5a3785);}}; \ No newline at end of file +var _0xa172=['emit','removeListener','length','openchannelAccount:','save','remove','update'];(function(_0x379f22,_0xa35b4a){var _0x1c5680=function(_0x268a5b){while(--_0x268a5b){_0x379f22['push'](_0x379f22['shift']());}};_0x1c5680(++_0xa35b4a);}(_0xa172,0x1d9));var _0x2a17=function(_0x1afb79,_0x57d1e5){_0x1afb79=_0x1afb79-0x0;var _0x4fb720=_0xa172[_0x1afb79];return _0x4fb720;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x2a17('0x0'),_0x2a17('0x1'),_0x2a17('0x2')];function createListener(_0x14ef20,_0x305306){return function(_0x407000){_0x305306[_0x2a17('0x3')](_0x14ef20,_0x407000);};}function removeListener(_0x2b9e10,_0x1dbc01){return function(){OpenchannelAccountEvents[_0x2a17('0x4')](_0x2b9e10,_0x1dbc01);};}exports['register']=function(_0x4862d3){for(var _0x1f28db=0x0,_0x3ddd24=events[_0x2a17('0x5')];_0x1f28db<_0x3ddd24;_0x1f28db++){var _0x1a4746=events[_0x1f28db];var _0x41b4da=createListener(_0x2a17('0x6')+_0x1a4746,_0x4862d3);OpenchannelAccountEvents['on'](_0x1a4746,_0x41b4da);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index df286ad..4b7329b 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 _0xa2b4=['destroy','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','/:id','post','create','put','update'];(function(_0x39782f,_0x4aa931){var _0x47768c=function(_0x2672e4){while(--_0x2672e4){_0x39782f['push'](_0x39782f['shift']());}};_0x47768c(++_0x4aa931);}(_0xa2b4,0x1e7));var _0x4a2b=function(_0x37cfe5,_0x35d0dc){_0x37cfe5=_0x37cfe5-0x0;var _0x53ff78=_0xa2b4[_0x37cfe5];return _0x53ff78;};'use strict';var multer=require(_0x4a2b('0x0'));var util=require(_0x4a2b('0x1'));var path=require(_0x4a2b('0x2'));var timeout=require(_0x4a2b('0x3'));var express=require('express');var router=express[_0x4a2b('0x4')]();var auth=require(_0x4a2b('0x5'));var interaction=require(_0x4a2b('0x6'));var config=require(_0x4a2b('0x7'));var controller=require(_0x4a2b('0x8'));router[_0x4a2b('0x9')]('/',auth[_0x4a2b('0xa')](),controller[_0x4a2b('0xb')]);router[_0x4a2b('0x9')](_0x4a2b('0xc'),auth[_0x4a2b('0xa')](),controller['show']);router[_0x4a2b('0xd')]('/',auth[_0x4a2b('0xa')](),controller[_0x4a2b('0xe')]);router[_0x4a2b('0xf')](_0x4a2b('0xc'),auth[_0x4a2b('0xa')](),controller[_0x4a2b('0x10')]);router['delete'](_0x4a2b('0xc'),auth[_0x4a2b('0xa')](),controller[_0x4a2b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x54a3=['./openchannelApplication.controller','get','isAuthenticated','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x524518,_0x336dba){var _0x4e237b=function(_0x1ead59){while(--_0x1ead59){_0x524518['push'](_0x524518['shift']());}};_0x4e237b(++_0x336dba);}(_0x54a3,0x1ac));var _0x354a=function(_0x233843,_0x24e4be){_0x233843=_0x233843-0x0;var _0x58f461=_0x54a3[_0x233843];return _0x58f461;};'use strict';var multer=require(_0x354a('0x0'));var util=require(_0x354a('0x1'));var path=require(_0x354a('0x2'));var timeout=require(_0x354a('0x3'));var express=require(_0x354a('0x4'));var router=express['Router']();var auth=require(_0x354a('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x354a('0x6'));var controller=require(_0x354a('0x7'));router[_0x354a('0x8')]('/',auth[_0x354a('0x9')](),controller['index']);router[_0x354a('0x8')](_0x354a('0xa'),auth[_0x354a('0x9')](),controller['show']);router['post']('/',auth[_0x354a('0x9')](),controller['create']);router['put'](_0x354a('0xa'),auth[_0x354a('0x9')](),controller[_0x354a('0xb')]);router[_0x354a('0xc')](_0x354a('0xa'),auth['isAuthenticated'](),controller[_0x354a('0xd')]);module[_0x354a('0xe')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index c4363f2..91767ef 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 _0x8f5b=['STRING','noop','TEXT','*,*,*,*','sequelize','INTEGER'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x8f5b,0x196));var _0xb8f5=function(_0x55228b,_0x405709){_0x55228b=_0x55228b-0x0;var _0x3a54ef=_0x8f5b[_0x55228b];return _0x3a54ef;};'use strict';var Sequelize=require(_0xb8f5('0x0'));module['exports']={'priority':{'type':Sequelize[_0xb8f5('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xb8f5('0x2')],'allowNull':![],'defaultValue':_0xb8f5('0x3')},'appdata':{'type':Sequelize[_0xb8f5('0x4')]()},'description':{'type':Sequelize[_0xb8f5('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb8f5('0x5')}}; \ No newline at end of file +var _0x0738=['INTEGER','STRING','noop','TEXT','*,*,*,*','sequelize'];(function(_0x435c6d,_0x1be256){var _0x235029=function(_0x36a770){while(--_0x36a770){_0x435c6d['push'](_0x435c6d['shift']());}};_0x235029(++_0x1be256);}(_0x0738,0xe9));var _0x8073=function(_0x29df9a,_0x42aff3){_0x29df9a=_0x29df9a-0x0;var _0x3a8e96=_0x0738[_0x29df9a];return _0x3a8e96;};'use strict';var Sequelize=require(_0x8073('0x0'));module['exports']={'priority':{'type':Sequelize[_0x8073('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8073('0x2')],'allowNull':![],'defaultValue':_0x8073('0x3')},'appdata':{'type':Sequelize[_0x8073('0x4')]()},'description':{'type':Sequelize[_0x8073('0x2')]},'interval':{'type':Sequelize[_0x8073('0x2')],'defaultValue':_0x8073('0x5')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index bba9f5e..621e416 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 _0x6d2d=['filters','intersection','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','VIRTUAL','filter','merge','options','OpenchannelApplication','count','includeAll','include','rows','catch','show','params','keys','fields','find','create','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x4c24a2,_0x251511){var _0x1935ab=function(_0x3acffa){while(--_0x3acffa){_0x4c24a2['push'](_0x4c24a2['shift']());}};_0x1935ab(++_0x251511);}(_0x6d2d,0x13f));var _0xd6d2=function(_0x30e036,_0x5e443d){_0x30e036=_0x30e036-0x0;var _0x489466=_0x6d2d[_0x30e036];return _0x489466;};'use strict';var pdf=require(_0xd6d2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xd6d2('0x1'));var zipdir=require(_0xd6d2('0x2'));var jsonpatch=require(_0xd6d2('0x3'));var rp=require(_0xd6d2('0x4'));var moment=require(_0xd6d2('0x5'));var BPromise=require(_0xd6d2('0x6'));var Mustache=require(_0xd6d2('0x7'));var util=require(_0xd6d2('0x8'));var path=require(_0xd6d2('0x9'));var sox=require(_0xd6d2('0xa'));var csv=require(_0xd6d2('0xb'));var ejs=require(_0xd6d2('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0xd6d2('0xd'));var crypto=require(_0xd6d2('0xe'));var jsforce=require(_0xd6d2('0xf'));var deskjs=require(_0xd6d2('0x10'));var toCsv=require(_0xd6d2('0xb'));var querystring=require('querystring');var Papa=require(_0xd6d2('0x11'));var Redis=require(_0xd6d2('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6d2('0x13'));var logger=require(_0xd6d2('0x14'))('api');var utils=require(_0xd6d2('0x15'));var config=require('../../config/environment');var db=require(_0xd6d2('0x16'))['db'];function respondWithStatusCode(_0x2eea45,_0x3d815c){_0x3d815c=_0x3d815c||0xcc;return function(_0x42f097){if(_0x42f097){return _0x2eea45[_0xd6d2('0x17')](_0x3d815c);}return _0x2eea45[_0xd6d2('0x18')](_0x3d815c)[_0xd6d2('0x19')]();};}function respondWithResult(_0x29872a,_0x511c4f){_0x511c4f=_0x511c4f||0xc8;return function(_0x5d0cc9){if(_0x5d0cc9){return _0x29872a['status'](_0x511c4f)['json'](_0x5d0cc9);}};}function respondWithFilteredResult(_0x5c2842,_0xfca17c){return function(_0x536556){if(_0x536556){var _0x1411ba=_0x536556['count'],_0x28fce2=_0xfca17c[_0xd6d2('0x1a')],_0x196fbb=_0xfca17c['offset']+_0xfca17c['limit'],_0x2f634e;if(_0x196fbb>=_0x1411ba){_0x196fbb=_0x1411ba;_0x2f634e=0xc8;}else{_0x2f634e=0xce;}_0x5c2842['status'](_0x2f634e);return _0x5c2842[_0xd6d2('0x1b')](_0xd6d2('0x1c'),_0x28fce2+'-'+_0x196fbb+'/'+_0x1411ba)['json'](_0x536556);}return null;};}function patchUpdates(_0x21dc7e){return function(_0x2f86b8){try{jsonpatch[_0xd6d2('0x1d')](_0x2f86b8,_0x21dc7e,!![]);}catch(_0x11f3db){return BPromise[_0xd6d2('0x1e')](_0x11f3db);}return _0x2f86b8['save']();};}function saveUpdates(_0x4a8b0c,_0x4a749c){return function(_0xc270d0){if(_0xc270d0){return _0xc270d0[_0xd6d2('0x1f')](_0x4a8b0c)['then'](function(_0x2c5ba5){return _0x2c5ba5;});}return null;};}function removeEntity(_0x3136fe,_0x125717){return function(_0x3b93d9){if(_0x3b93d9){return _0x3b93d9[_0xd6d2('0x20')]()[_0xd6d2('0x21')](function(){_0x3136fe[_0xd6d2('0x18')](0xcc)[_0xd6d2('0x19')]();});}};}function handleEntityNotFound(_0x33f287,_0x51f493){return function(_0x1d0507){if(!_0x1d0507){_0x33f287[_0xd6d2('0x17')](0x194);}return _0x1d0507;};}function handleError(_0x952d9e,_0x5b2c7c){_0x5b2c7c=_0x5b2c7c||0x1f4;return function(_0x5d0294){logger[_0xd6d2('0x22')](_0x5d0294[_0xd6d2('0x23')]);if(_0x5d0294[_0xd6d2('0x24')]){delete _0x5d0294[_0xd6d2('0x24')];}_0x952d9e[_0xd6d2('0x18')](_0x5b2c7c)[_0xd6d2('0x25')](_0x5d0294);};}exports[_0xd6d2('0x26')]=function(_0x4d1a49,_0x2c22c0){var _0x46be6f={},_0x20d256={},_0x261c7c={'count':0x0,'rows':[]};var _0x2cb426=_['map'](db['OpenchannelApplication'][_0xd6d2('0x27')],function(_0x96923){return{'name':_0x96923[_0xd6d2('0x28')],'type':_0x96923[_0xd6d2('0x29')][_0xd6d2('0x2a')]};});_0x20d256[_0xd6d2('0x2b')]=_[_0xd6d2('0x2c')](_0x2cb426,_0xd6d2('0x24'));_0x20d256[_0xd6d2('0x2d')]=_['keys'](_0x4d1a49[_0xd6d2('0x2d')]);_0x20d256[_0xd6d2('0x2e')]=_[_0xd6d2('0x2f')](_0x20d256[_0xd6d2('0x2b')],_0x20d256[_0xd6d2('0x2d')]);_0x46be6f['attributes']=_[_0xd6d2('0x2f')](_0x20d256[_0xd6d2('0x2b')],qs['fields'](_0x4d1a49['query']['fields']));_0x46be6f[_0xd6d2('0x30')]=_0x46be6f['attributes'][_0xd6d2('0x31')]?_0x46be6f[_0xd6d2('0x30')]:_0x20d256[_0xd6d2('0x2b')];if(!_0x4d1a49[_0xd6d2('0x2d')][_0xd6d2('0x32')](_0xd6d2('0x33'))){_0x46be6f[_0xd6d2('0x34')]=qs[_0xd6d2('0x34')](_0x4d1a49[_0xd6d2('0x2d')][_0xd6d2('0x34')]);_0x46be6f[_0xd6d2('0x1a')]=qs['offset'](_0x4d1a49['query'][_0xd6d2('0x1a')]);}_0x46be6f[_0xd6d2('0x35')]=qs[_0xd6d2('0x36')](_0x4d1a49[_0xd6d2('0x2d')][_0xd6d2('0x36')]);_0x46be6f['where']=qs['filters'](_['pick'](_0x4d1a49[_0xd6d2('0x2d')],_0x20d256[_0xd6d2('0x2e')]));if(_0x4d1a49['query']['filter']){_0x46be6f[_0xd6d2('0x37')]=_['merge'](_0x46be6f['where'],{'$or':_[_0xd6d2('0x2c')](_0x2cb426,function(_0x15e55e){if(_0x15e55e['type']!==_0xd6d2('0x38')){var _0x560f1d={};_0x560f1d[_0x15e55e[_0xd6d2('0x24')]]={'$like':'%'+_0x4d1a49[_0xd6d2('0x2d')][_0xd6d2('0x39')]+'%'};return _0x560f1d;}})});}_0x46be6f=_[_0xd6d2('0x3a')]({},_0x46be6f,_0x4d1a49[_0xd6d2('0x3b')]);var _0x7b3f20={'where':_0x46be6f[_0xd6d2('0x37')]};return db[_0xd6d2('0x3c')]['count'](_0x7b3f20)[_0xd6d2('0x21')](function(_0x5178dd){_0x261c7c[_0xd6d2('0x3d')]=_0x5178dd;if(_0x4d1a49[_0xd6d2('0x2d')][_0xd6d2('0x3e')]){_0x46be6f[_0xd6d2('0x3f')]=[{'all':!![]}];}return db[_0xd6d2('0x3c')]['findAll'](_0x46be6f);})[_0xd6d2('0x21')](function(_0x5bd8ca){_0x261c7c[_0xd6d2('0x40')]=_0x5bd8ca;return _0x261c7c;})[_0xd6d2('0x21')](respondWithFilteredResult(_0x2c22c0,_0x46be6f))[_0xd6d2('0x41')](handleError(_0x2c22c0,null));};exports[_0xd6d2('0x42')]=function(_0x228b49,_0x57cfcf){var _0x48618e={'raw':!![],'where':{'id':_0x228b49[_0xd6d2('0x43')]['id']}},_0x14175f={};_0x14175f[_0xd6d2('0x2b')]=_[_0xd6d2('0x44')](db[_0xd6d2('0x3c')]['rawAttributes']);_0x14175f['query']=_['keys'](_0x228b49[_0xd6d2('0x2d')]);_0x14175f[_0xd6d2('0x2e')]=_[_0xd6d2('0x2f')](_0x14175f[_0xd6d2('0x2b')],_0x14175f[_0xd6d2('0x2d')]);_0x48618e['attributes']=_[_0xd6d2('0x2f')](_0x14175f[_0xd6d2('0x2b')],qs[_0xd6d2('0x45')](_0x228b49[_0xd6d2('0x2d')][_0xd6d2('0x45')]));_0x48618e[_0xd6d2('0x30')]=_0x48618e[_0xd6d2('0x30')][_0xd6d2('0x31')]?_0x48618e[_0xd6d2('0x30')]:_0x14175f[_0xd6d2('0x2b')];if(_0x228b49[_0xd6d2('0x2d')][_0xd6d2('0x3e')]){_0x48618e[_0xd6d2('0x3f')]=[{'all':!![]}];}_0x48618e=_[_0xd6d2('0x3a')]({},_0x48618e,_0x228b49[_0xd6d2('0x3b')]);return db['OpenchannelApplication'][_0xd6d2('0x46')](_0x48618e)[_0xd6d2('0x21')](handleEntityNotFound(_0x57cfcf,null))[_0xd6d2('0x21')](respondWithResult(_0x57cfcf,null))['catch'](handleError(_0x57cfcf,null));};exports[_0xd6d2('0x47')]=function(_0x18fd51,_0x56b2fa){return db[_0xd6d2('0x3c')][_0xd6d2('0x47')](_0x18fd51['body'],{})[_0xd6d2('0x21')](respondWithResult(_0x56b2fa,0xc9))['catch'](handleError(_0x56b2fa,null));};exports[_0xd6d2('0x1f')]=function(_0x58139c,_0x56e505){if(_0x58139c[_0xd6d2('0x48')]['id']){delete _0x58139c[_0xd6d2('0x48')]['id'];}return db[_0xd6d2('0x3c')][_0xd6d2('0x46')]({'where':{'id':_0x58139c[_0xd6d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x56e505,null))[_0xd6d2('0x21')](saveUpdates(_0x58139c[_0xd6d2('0x48')],null))[_0xd6d2('0x21')](respondWithResult(_0x56e505,null))[_0xd6d2('0x41')](handleError(_0x56e505,null));};exports[_0xd6d2('0x20')]=function(_0xab7339,_0x4406a6){return db[_0xd6d2('0x3c')][_0xd6d2('0x46')]({'where':{'id':_0xab7339[_0xd6d2('0x43')]['id']}})['then'](handleEntityNotFound(_0x4406a6,null))['then'](removeEntity(_0x4406a6,null))[_0xd6d2('0x41')](handleError(_0x4406a6,null));}; \ No newline at end of file +var _0x350f=['keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','catch','create','body','destroy','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','end','error','stack','name','index','map','OpenchannelApplication','rawAttributes','key','model'];(function(_0x31a8d4,_0x1dd2a7){var _0x3058ec=function(_0xd03c37){while(--_0xd03c37){_0x31a8d4['push'](_0x31a8d4['shift']());}};_0x3058ec(++_0x1dd2a7);}(_0x350f,0xa2));var _0xf350=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x350f[_0x11a55c];return _0x26c390;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf350('0x0'));var rimraf=require(_0xf350('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf350('0x2'));var rp=require(_0xf350('0x3'));var moment=require(_0xf350('0x4'));var BPromise=require(_0xf350('0x5'));var Mustache=require(_0xf350('0x6'));var util=require('util');var path=require(_0xf350('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf350('0x8'));var squel=require(_0xf350('0x9'));var crypto=require(_0xf350('0xa'));var jsforce=require(_0xf350('0xb'));var deskjs=require(_0xf350('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf350('0xd'));var Redis=require(_0xf350('0xe'));var authService=require(_0xf350('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xf350('0x10'));var hardwareService=require(_0xf350('0x11'));var logger=require(_0xf350('0x12'))(_0xf350('0x13'));var utils=require(_0xf350('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e1fe7,_0x1ca7e4){_0x1ca7e4=_0x1ca7e4||0xcc;return function(_0x3f5494){if(_0x3f5494){return _0x2e1fe7[_0xf350('0x15')](_0x1ca7e4);}return _0x2e1fe7[_0xf350('0x16')](_0x1ca7e4)['end']();};}function respondWithResult(_0x4f66c2,_0x59c564){_0x59c564=_0x59c564||0xc8;return function(_0x5062b9){if(_0x5062b9){return _0x4f66c2[_0xf350('0x16')](_0x59c564)[_0xf350('0x17')](_0x5062b9);}};}function respondWithFilteredResult(_0x3d49c8,_0x3e04e3){return function(_0x1bb35e){if(_0x1bb35e){var _0x1e8bf1=_0x1bb35e['count'],_0x474a4f=_0x3e04e3[_0xf350('0x18')],_0x5421ea=_0x3e04e3[_0xf350('0x18')]+_0x3e04e3[_0xf350('0x19')],_0x1d38b7;if(_0x5421ea>=_0x1e8bf1){_0x5421ea=_0x1e8bf1;_0x1d38b7=0xc8;}else{_0x1d38b7=0xce;}_0x3d49c8['status'](_0x1d38b7);return _0x3d49c8[_0xf350('0x1a')](_0xf350('0x1b'),_0x474a4f+'-'+_0x5421ea+'/'+_0x1e8bf1)[_0xf350('0x17')](_0x1bb35e);}return null;};}function patchUpdates(_0x3f4aaf){return function(_0xb2c28a){try{jsonpatch[_0xf350('0x1c')](_0xb2c28a,_0x3f4aaf,!![]);}catch(_0x335f5f){return BPromise['reject'](_0x335f5f);}return _0xb2c28a[_0xf350('0x1d')]();};}function saveUpdates(_0x4b8cf7,_0x2b7064){return function(_0x32ab6d){if(_0x32ab6d){return _0x32ab6d[_0xf350('0x1e')](_0x4b8cf7)[_0xf350('0x1f')](function(_0x27544c){return _0x27544c;});}return null;};}function removeEntity(_0x5495cc,_0x555c50){return function(_0x558df7){if(_0x558df7){return _0x558df7['destroy']()['then'](function(){_0x5495cc[_0xf350('0x16')](0xcc)[_0xf350('0x20')]();});}};}function handleEntityNotFound(_0x4c6ac9,_0x3ed7bf){return function(_0x365de8){if(!_0x365de8){_0x4c6ac9['sendStatus'](0x194);}return _0x365de8;};}function handleError(_0x37c922,_0x41c4c6){_0x41c4c6=_0x41c4c6||0x1f4;return function(_0xc50290){logger[_0xf350('0x21')](_0xc50290[_0xf350('0x22')]);if(_0xc50290[_0xf350('0x23')]){delete _0xc50290[_0xf350('0x23')];}_0x37c922[_0xf350('0x16')](_0x41c4c6)['send'](_0xc50290);};}exports[_0xf350('0x24')]=function(_0x2b7228,_0x472311){var _0x146350={},_0x1770e7={},_0x2a01a2={'count':0x0,'rows':[]};var _0x57ca3e=_[_0xf350('0x25')](db[_0xf350('0x26')][_0xf350('0x27')],function(_0x2b582b){return{'name':_0x2b582b['fieldName'],'type':_0x2b582b['type'][_0xf350('0x28')]};});_0x1770e7[_0xf350('0x29')]=_['map'](_0x57ca3e,_0xf350('0x23'));_0x1770e7['query']=_[_0xf350('0x2a')](_0x2b7228[_0xf350('0x2b')]);_0x1770e7[_0xf350('0x2c')]=_[_0xf350('0x2d')](_0x1770e7[_0xf350('0x29')],_0x1770e7['query']);_0x146350[_0xf350('0x2e')]=_['intersection'](_0x1770e7[_0xf350('0x29')],qs[_0xf350('0x2f')](_0x2b7228['query']['fields']));_0x146350['attributes']=_0x146350[_0xf350('0x2e')]['length']?_0x146350[_0xf350('0x2e')]:_0x1770e7[_0xf350('0x29')];if(!_0x2b7228[_0xf350('0x2b')][_0xf350('0x30')](_0xf350('0x31'))){_0x146350[_0xf350('0x19')]=qs[_0xf350('0x19')](_0x2b7228[_0xf350('0x2b')][_0xf350('0x19')]);_0x146350[_0xf350('0x18')]=qs[_0xf350('0x18')](_0x2b7228[_0xf350('0x2b')][_0xf350('0x18')]);}_0x146350[_0xf350('0x32')]=qs['sort'](_0x2b7228[_0xf350('0x2b')]['sort']);_0x146350[_0xf350('0x33')]=qs[_0xf350('0x2c')](_[_0xf350('0x34')](_0x2b7228['query'],_0x1770e7[_0xf350('0x2c')]));if(_0x2b7228[_0xf350('0x2b')][_0xf350('0x35')]){_0x146350[_0xf350('0x33')]=_[_0xf350('0x36')](_0x146350[_0xf350('0x33')],{'$or':_['map'](_0x57ca3e,function(_0x35d25a){if(_0x35d25a['type']!=='VIRTUAL'){var _0x5c5ef0={};_0x5c5ef0[_0x35d25a[_0xf350('0x23')]]={'$like':'%'+_0x2b7228[_0xf350('0x2b')][_0xf350('0x35')]+'%'};return _0x5c5ef0;}})});}_0x146350=_[_0xf350('0x36')]({},_0x146350,_0x2b7228[_0xf350('0x37')]);var _0x148951={'where':_0x146350['where']};return db['OpenchannelApplication'][_0xf350('0x38')](_0x148951)['then'](function(_0xd8538b){_0x2a01a2[_0xf350('0x38')]=_0xd8538b;if(_0x2b7228[_0xf350('0x2b')][_0xf350('0x39')]){_0x146350[_0xf350('0x3a')]=[{'all':!![]}];}return db[_0xf350('0x26')][_0xf350('0x3b')](_0x146350);})[_0xf350('0x1f')](function(_0x57441d){_0x2a01a2[_0xf350('0x3c')]=_0x57441d;return _0x2a01a2;})['then'](respondWithFilteredResult(_0x472311,_0x146350))['catch'](handleError(_0x472311,null));};exports[_0xf350('0x3d')]=function(_0x5a409d,_0x2d9c41){var _0x14107d={'raw':!![],'where':{'id':_0x5a409d[_0xf350('0x3e')]['id']}},_0xb9b3a5={};_0xb9b3a5[_0xf350('0x29')]=_[_0xf350('0x2a')](db[_0xf350('0x26')]['rawAttributes']);_0xb9b3a5[_0xf350('0x2b')]=_[_0xf350('0x2a')](_0x5a409d[_0xf350('0x2b')]);_0xb9b3a5['filters']=_[_0xf350('0x2d')](_0xb9b3a5[_0xf350('0x29')],_0xb9b3a5['query']);_0x14107d[_0xf350('0x2e')]=_[_0xf350('0x2d')](_0xb9b3a5[_0xf350('0x29')],qs[_0xf350('0x2f')](_0x5a409d[_0xf350('0x2b')][_0xf350('0x2f')]));_0x14107d[_0xf350('0x2e')]=_0x14107d[_0xf350('0x2e')]['length']?_0x14107d[_0xf350('0x2e')]:_0xb9b3a5[_0xf350('0x29')];if(_0x5a409d[_0xf350('0x2b')][_0xf350('0x39')]){_0x14107d['include']=[{'all':!![]}];}_0x14107d=_[_0xf350('0x36')]({},_0x14107d,_0x5a409d[_0xf350('0x37')]);return db[_0xf350('0x26')]['find'](_0x14107d)[_0xf350('0x1f')](handleEntityNotFound(_0x2d9c41,null))['then'](respondWithResult(_0x2d9c41,null))[_0xf350('0x3f')](handleError(_0x2d9c41,null));};exports[_0xf350('0x40')]=function(_0x489b70,_0x4667e0){return db[_0xf350('0x26')][_0xf350('0x40')](_0x489b70[_0xf350('0x41')],{})[_0xf350('0x1f')](respondWithResult(_0x4667e0,0xc9))[_0xf350('0x3f')](handleError(_0x4667e0,null));};exports[_0xf350('0x1e')]=function(_0x421eee,_0x3deddd){if(_0x421eee[_0xf350('0x41')]['id']){delete _0x421eee['body']['id'];}return db[_0xf350('0x26')]['find']({'where':{'id':_0x421eee['params']['id']}})[_0xf350('0x1f')](handleEntityNotFound(_0x3deddd,null))[_0xf350('0x1f')](saveUpdates(_0x421eee[_0xf350('0x41')],null))[_0xf350('0x1f')](respondWithResult(_0x3deddd,null))[_0xf350('0x3f')](handleError(_0x3deddd,null));};exports[_0xf350('0x42')]=function(_0x91e83c,_0x446d83){return db[_0xf350('0x26')][_0xf350('0x43')]({'where':{'id':_0x91e83c['params']['id']}})[_0xf350('0x1f')](handleEntityNotFound(_0x446d83,null))[_0xf350('0x1f')](removeEntity(_0x446d83,null))[_0xf350('0x3f')](handleError(_0x446d83,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index b66facf..3771135 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 _0x6523=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6523,0x191));var _0x3652=function(_0x253673,_0x3287fb){_0x253673=_0x253673-0x0;var _0x259903=_0x6523[_0x253673];return _0x259903;};'use strict';var _=require(_0x3652('0x0'));var util=require('util');var logger=require(_0x3652('0x1'))(_0x3652('0x2'));var moment=require(_0x3652('0x3'));var BPromise=require('bluebird');var rp=require(_0x3652('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3652('0x5'));var config=require(_0x3652('0x6'));var attributes=require(_0x3652('0x7'));module[_0x3652('0x8')]=function(_0x136ac4,_0x27a70c){return _0x136ac4[_0x3652('0x9')](_0x3652('0xa'),attributes,{'tableName':'openchannel_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3652('0xb')});}; \ No newline at end of file +var _0xd420=['rimraf','./openchannelApplication.attributes','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','bluebird','request-promise','path'];(function(_0x212bdd,_0x1003ec){var _0x45b639=function(_0xf2c2ff){while(--_0xf2c2ff){_0x212bdd['push'](_0x212bdd['shift']());}};_0x45b639(++_0x1003ec);}(_0xd420,0x1db));var _0x0d42=function(_0x4ae954,_0x4dcda3){_0x4ae954=_0x4ae954-0x0;var _0x175b48=_0xd420[_0x4ae954];return _0x175b48;};'use strict';var _=require(_0x0d42('0x0'));var util=require('util');var logger=require(_0x0d42('0x1'))('api');var moment=require('moment');var BPromise=require(_0x0d42('0x2'));var rp=require(_0x0d42('0x3'));var fs=require('fs');var path=require(_0x0d42('0x4'));var rimraf=require(_0x0d42('0x5'));var config=require('../../config/environment');var attributes=require(_0x0d42('0x6'));module['exports']=function(_0x43b772,_0x2baa7d){return _0x43b772['define']('OpenchannelApplication',attributes,{'tableName':_0x0d42('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x0d42('0x8'),'collate':_0x0d42('0x9')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index a3ad91b..78e62a6 100644 --- a/server/api/openchannelApplication/openchannelApplication.rpc.js +++ b/server/api/openchannelApplication/openchannelApplication.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['OpenchannelApplication','body','options','raw','where','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateOpenchannelApplication'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0d8b('0x2'));var db=require(_0x0d8b('0x3'))['db'];var utils=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0d8b('0x7')][_0x0d8b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x39f43a,_0x4a4470,_0x413284){return new BPromise(function(_0x284169,_0x58e4e2){return client[_0x0d8b('0x9')](_0x39f43a,_0x413284)[_0x0d8b('0xa')](function(_0x3b027f){logger[_0x0d8b('0xb')](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));logger[_0x0d8b('0xe')](_0x0d8b('0xf'),_0x4a4470,'request\x20sent',JSON[_0x0d8b('0x10')](_0x3b027f));if(_0x3b027f['error']){if(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x12')]===0x1f4){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x58e4e2(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);return _0x284169(_0x3b027f[_0x0d8b('0x11')][_0x0d8b('0x13')]);}else{logger['info'](_0x0d8b('0xc'),_0x4a4470,_0x0d8b('0xd'));_0x284169(_0x3b027f[_0x0d8b('0x14')][_0x0d8b('0x13')]);}})[_0x0d8b('0x15')](function(_0x5cd485){logger[_0x0d8b('0x11')](_0x0d8b('0xc'),_0x4a4470,_0x5cd485);_0x58e4e2(_0x5cd485);});});}exports[_0x0d8b('0x16')]=function(_0x5fecbd){var _0x333674=this;return new Promise(function(_0x18dd2d,_0x264b39){return db[_0x0d8b('0x17')]['update'](_0x5fecbd[_0x0d8b('0x18')],{'raw':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd[_0x0d8b('0x19')][_0x0d8b('0x1b')]||null:null,'attributes':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['attributes']||null:null,'limit':_0x5fecbd[_0x0d8b('0x19')]?_0x5fecbd['options']['limit']||null:null})['then'](function(_0x238728){logger[_0x0d8b('0xb')](_0x0d8b('0x16'),_0x5fecbd);logger[_0x0d8b('0xe')](_0x0d8b('0x16'),_0x5fecbd,JSON[_0x0d8b('0x10')](_0x238728));_0x18dd2d(_0x238728);})[_0x0d8b('0x15')](function(_0x4562cb){logger[_0x0d8b('0x11')]('UpdateOpenchannelApplication',_0x4562cb[_0x0d8b('0x13')],_0x5fecbd);_0x264b39(_0x333674[_0x0d8b('0x11')](0x1f4,_0x4562cb['message']));});});}; \ No newline at end of file +var _0xb10b=['then','info','OpenchannelApplication,\x20%s,\x20%s','OpenchannelApplication,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','UpdateOpenchannelApplication','OpenchannelApplication','update','options','raw','where','attributes','limit','debug','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request'];(function(_0x485ec0,_0x4c1c93){var _0x12cb19=function(_0x2b4941){while(--_0x2b4941){_0x485ec0['push'](_0x485ec0['shift']());}};_0x12cb19(++_0x4c1c93);}(_0xb10b,0x12a));var _0xbb10=function(_0x565de9,_0x114287){_0x565de9=_0x565de9-0x0;var _0x5f5dab=_0xb10b[_0x565de9];return _0x5f5dab;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1b')]||null:null,'limit':_0x378da8['options']?_0x378da8['options'][_0xbb10('0x1c')]||null:null})[_0xbb10('0xc')](function(_0x2e911d){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1d')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2e911d));_0x575cca(_0x2e911d);})[_0xbb10('0x1e')](function(_0x395404){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x395404['message'],_0x378da8);_0x30efc6(_0x1682a4['error'](0x1f4,_0x395404['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5ca505a..51d9671 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 _0xdc02=['delete','/:id','openchannelinteraction:destroy','destroy','removeTags','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','show','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannelinteraction:addtags','addTags','put','openchannel','openchannelinteraction:update','update'];(function(_0x191f84,_0x20f1a6){var _0x5ad4ec=function(_0x541c5b){while(--_0x541c5b){_0x191f84['push'](_0x191f84['shift']());}};_0x5ad4ec(++_0x20f1a6);}(_0xdc02,0x12e));var _0x2dc0=function(_0x4ccd32,_0x3b11c9){_0x4ccd32=_0x4ccd32-0x0;var _0x30b693=_0xdc02[_0x4ccd32];return _0x30b693;};'use strict';var multer=require(_0x2dc0('0x0'));var util=require(_0x2dc0('0x1'));var path=require(_0x2dc0('0x2'));var timeout=require(_0x2dc0('0x3'));var express=require(_0x2dc0('0x4'));var router=express[_0x2dc0('0x5')]();var auth=require(_0x2dc0('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x2dc0('0x7'));var controller=require(_0x2dc0('0x8'));router[_0x2dc0('0x9')]('/',auth[_0x2dc0('0xa')](),controller[_0x2dc0('0xb')]);router['get'](_0x2dc0('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2dc0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x2dc0('0xd')]);router[_0x2dc0('0x9')](_0x2dc0('0xe'),auth[_0x2dc0('0xa')](),controller[_0x2dc0('0xf')]);router[_0x2dc0('0x9')](_0x2dc0('0x10'),auth[_0x2dc0('0xa')](),controller[_0x2dc0('0x11')]);router['post']('/',auth[_0x2dc0('0xa')](),controller['create']);router[_0x2dc0('0x12')](_0x2dc0('0xe'),auth[_0x2dc0('0xa')](),controller[_0x2dc0('0x13')]);router['post'](_0x2dc0('0x14'),auth['isAuthenticated'](),interaction[_0x2dc0('0x15')]('openchannel',_0x2dc0('0x16')),controller[_0x2dc0('0x17')]);router[_0x2dc0('0x18')]('/:id',auth[_0x2dc0('0xa')](),interaction['tracked'](_0x2dc0('0x19'),_0x2dc0('0x1a')),controller[_0x2dc0('0x1b')]);router[_0x2dc0('0x1c')](_0x2dc0('0x1d'),auth[_0x2dc0('0xa')](),interaction[_0x2dc0('0x15')]('openchannel',_0x2dc0('0x1e')),controller[_0x2dc0('0x1f')]);router[_0x2dc0('0x1c')](_0x2dc0('0x14'),auth[_0x2dc0('0xa')](),controller[_0x2dc0('0x20')]);module['exports']=router; \ No newline at end of file +var _0x652b=['/describe','isAuthenticated','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','removeTags','exports','multer','path','connect-timeout','Router','../../config/environment','get','index'];(function(_0x4dc7b9,_0x319d5a){var _0x3ab114=function(_0x51a9df){while(--_0x51a9df){_0x4dc7b9['push'](_0x4dc7b9['shift']());}};_0x3ab114(++_0x319d5a);}(_0x652b,0x149));var _0xb652=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0x652b[_0xa388a2];return _0x7ce7f6;};'use strict';var multer=require(_0xb652('0x0'));var util=require('util');var path=require(_0xb652('0x1'));var timeout=require(_0xb652('0x2'));var express=require('express');var router=express[_0xb652('0x3')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb652('0x4'));var controller=require('./openchannelInteraction.controller');router[_0xb652('0x5')]('/',auth['isAuthenticated'](),controller[_0xb652('0x6')]);router['get'](_0xb652('0x7'),auth[_0xb652('0x8')](),controller['describe']);router[_0xb652('0x5')](_0xb652('0x9'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xb652('0xa'),auth[_0xb652('0x8')](),controller[_0xb652('0xb')]);router[_0xb652('0xc')]('/',auth[_0xb652('0x8')](),controller[_0xb652('0xd')]);router['post'](_0xb652('0xe'),auth[_0xb652('0x8')](),controller[_0xb652('0xf')]);router[_0xb652('0xc')](_0xb652('0x10'),auth[_0xb652('0x8')](),interaction[_0xb652('0x11')](_0xb652('0x12'),_0xb652('0x13')),controller[_0xb652('0x14')]);router[_0xb652('0x15')](_0xb652('0x9'),auth[_0xb652('0x8')](),interaction[_0xb652('0x11')](_0xb652('0x12'),_0xb652('0x16')),controller[_0xb652('0x17')]);router[_0xb652('0x18')](_0xb652('0x9'),auth[_0xb652('0x8')](),interaction[_0xb652('0x11')](_0xb652('0x12'),_0xb652('0x19')),controller['destroy']);router[_0xb652('0x18')](_0xb652('0x10'),auth['isAuthenticated'](),controller[_0xb652('0x1a')]);module[_0xb652('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index f2d475a..dbeb7d0 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 _0x4b0f=['sequelize','exports','STRING','ENUM','out'];(function(_0x1f6e37,_0x560390){var _0x3d17ad=function(_0x23a623){while(--_0x23a623){_0x1f6e37['push'](_0x1f6e37['shift']());}};_0x3d17ad(++_0x560390);}(_0x4b0f,0xb9));var _0xf4b0=function(_0x56a28a,_0x12b812){_0x56a28a=_0x56a28a-0x0;var _0x2f0161=_0x4b0f[_0x56a28a];return _0x2f0161;};'use strict';var Sequelize=require(_0xf4b0('0x0'));module[_0xf4b0('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0xf4b0('0x2')]},'note':{'type':Sequelize[_0xf4b0('0x2')]},'read1stAt':{'type':Sequelize['DATE']},'threadId':{'type':Sequelize[_0xf4b0('0x2')]},'externalUrl':{'type':Sequelize[_0xf4b0('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0xf4b0('0x3')]('in',_0xf4b0('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4709=['DATE','STRING','sequelize'];(function(_0x11d460,_0x54a609){var _0x4f22aa=function(_0x28e891){while(--_0x28e891){_0x11d460['push'](_0x11d460['shift']());}};_0x4f22aa(++_0x54a609);}(_0x4709,0x155));var _0x9470=function(_0x4dec17,_0x1b81f2){_0x4dec17=_0x4dec17-0x0;var _0x344c7f=_0x4709[_0x4dec17];return _0x344c7f;};'use strict';var Sequelize=require(_0x9470('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9470('0x1')]},'disposition':{'type':Sequelize[_0x9470('0x2')]},'note':{'type':Sequelize[_0x9470('0x2')]},'read1stAt':{'type':Sequelize[_0x9470('0x1')]},'threadId':{'type':Sequelize[_0x9470('0x2')]},'externalUrl':{'type':Sequelize[_0x9470('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x9470('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index d17650a..4f24e98 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 _0xea37=['expr','search','parseSearch','sqlOperator','conditions','find','having','`\x20=\x200','`\x20>\x200','operator','$substring','value','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','end','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','buildExpression','body','keys','some','compact','isEmpty','OpenchannelAccountId','where','i.OpenchannelAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','DESC','t.id\x20IN\x20?','resolve','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','toString','count','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.lastName','Contact.lastName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','OpenchannelInteractionId','all','rows','show','params','includeAll','create','describe','addMessage','ids','findOne','OpenchannelMessage','YYYY-MM-DD\x20HH:mm:ss','options','include','findAll','addTags','setTags','omit','spread','openchannelInteractionTags:save','removeTags','unix','join','root','server','tmp','files','attachments','format','transcript-%d-%s.zip','CmContact','Contact','firstName','Attachment','Messages','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','Openchannel','YYYY-MM-DD','Owner','closed','closedAt','disposition','threadId','Private','existsSync','pipe','basename','direction','out','System','lastName','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','err','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','sendStatus','status','offset','limit','set','apply','reject','update','then','destroy','error','stack','name','fullname','TagIds','Tags','split','forEach','push','catch','index','map','OpenchannelInteraction','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','select','field','color','from','u.id','u.fullname','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','users','o.id\x20=\x20i.UserId','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId'];(function(_0x37db2a,_0x203301){var _0x4ae4b1=function(_0x5b0d70){while(--_0x5b0d70){_0x37db2a['push'](_0x37db2a['shift']());}};_0x4ae4b1(++_0x203301);}(_0xea37,0x18e));var _0x7ea3=function(_0x5a7e3c,_0xdc9219){_0x5a7e3c=_0x5a7e3c-0x0;var _0x59252b=_0xea37[_0x5a7e3c];return _0x59252b;};'use strict';var pdf=require(_0x7ea3('0x0'));var emlformat=require(_0x7ea3('0x1'));var rimraf=require(_0x7ea3('0x2'));var zipdir=require(_0x7ea3('0x3'));var jsonpatch=require(_0x7ea3('0x4'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7ea3('0x5'));var Mustache=require(_0x7ea3('0x6'));var util=require('util');var path=require(_0x7ea3('0x7'));var sox=require(_0x7ea3('0x8'));var csv=require(_0x7ea3('0x9'));var ejs=require(_0x7ea3('0xa'));var fs=require('fs');var _=require(_0x7ea3('0xb'));var squel=require(_0x7ea3('0xc'));var crypto=require(_0x7ea3('0xd'));var jsforce=require(_0x7ea3('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7ea3('0xf'));var Papa=require('papaparse');var Redis=require(_0x7ea3('0x10'));var authService=require(_0x7ea3('0x11'));var qs=require(_0x7ea3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7ea3('0x13'));var logger=require('../../config/logger')(_0x7ea3('0x14'));var utils=require(_0x7ea3('0x15'));var config=require(_0x7ea3('0x16'));var db=require(_0x7ea3('0x17'))['db'];config[_0x7ea3('0x18')]=_['defaults'](config[_0x7ea3('0x18')],{'host':_0x7ea3('0x19'),'port':0x18eb});var socket=require(_0x7ea3('0x1a'))(new Redis(config[_0x7ea3('0x18')]));require(_0x7ea3('0x1b'))['register'](socket);function respondWithStatusCode(_0x470915,_0x32422c){_0x32422c=_0x32422c||0xcc;return function(_0x33165d){if(_0x33165d){return _0x470915[_0x7ea3('0x1c')](_0x32422c);}return _0x470915['status'](_0x32422c)['end']();};}function respondWithResult(_0x26c6af,_0xa07a02){_0xa07a02=_0xa07a02||0xc8;return function(_0x29add8){if(_0x29add8){return _0x26c6af[_0x7ea3('0x1d')](_0xa07a02)['json'](_0x29add8);}};}function respondWithFilteredResult(_0x3bfeb5,_0x21188d){return function(_0x1b03ea){if(_0x1b03ea){var _0x5c3b2f=_0x1b03ea['count'],_0x57362c=_0x21188d[_0x7ea3('0x1e')],_0x5de72d=_0x21188d[_0x7ea3('0x1e')]+_0x21188d[_0x7ea3('0x1f')],_0xd4acd7;if(_0x5de72d>=_0x5c3b2f){_0x5de72d=_0x5c3b2f;_0xd4acd7=0xc8;}else{_0xd4acd7=0xce;}_0x3bfeb5[_0x7ea3('0x1d')](_0xd4acd7);return _0x3bfeb5[_0x7ea3('0x20')]('Content-Range',_0x57362c+'-'+_0x5de72d+'/'+_0x5c3b2f)['json'](_0x1b03ea);}return null;};}function patchUpdates(_0x5a579a){return function(_0xde72f8){try{jsonpatch[_0x7ea3('0x21')](_0xde72f8,_0x5a579a,!![]);}catch(_0x5464c3){return BPromise[_0x7ea3('0x22')](_0x5464c3);}return _0xde72f8['save']();};}function saveUpdates(_0x12de3a,_0x179250){return function(_0x32f25d){if(_0x32f25d){return _0x32f25d[_0x7ea3('0x23')](_0x12de3a)[_0x7ea3('0x24')](function(_0x1af8c9){return _0x1af8c9;});}return null;};}function removeEntity(_0xb304fe,_0x5b71ce){return function(_0x1808db){if(_0x1808db){return _0x1808db[_0x7ea3('0x25')]()[_0x7ea3('0x24')](function(){_0xb304fe[_0x7ea3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x365b77,_0x212cd3){return function(_0x24a04a){if(!_0x24a04a){_0x365b77[_0x7ea3('0x1c')](0x194);}return _0x24a04a;};}function handleError(_0x246687,_0x1d1bee){_0x1d1bee=_0x1d1bee||0x1f4;return function(_0x32638a){logger[_0x7ea3('0x26')](_0x32638a[_0x7ea3('0x27')]);if(_0x32638a[_0x7ea3('0x28')]){delete _0x32638a[_0x7ea3('0x28')];}_0x246687['status'](_0x1d1bee)['send'](_0x32638a);};}function getInteractionUsers(_0x8a38bf,_0x588e9d){return new BPromise(function(_0x523363,_0x18ba17){try{if(_0x588e9d[_0x8a38bf['id']]){_0x8a38bf['Users']=_['map'](_0x588e9d[_0x8a38bf['id']],function(_0x455d23){return{'id':_0x455d23['id'],'fullname':_0x455d23[_0x7ea3('0x29')]};});}}catch(_0x1a542b){_0x18ba17(_0x1a542b);}_0x523363(_0x8a38bf);});}function getInteractionTags(_0x3a35ad,_0x46896e){return new BPromise(function(_0x50eda7,_0x52637a){try{if(_0x3a35ad[_0x7ea3('0x2a')]){_0x3a35ad[_0x7ea3('0x2b')]=[];_0x3a35ad['TagIds'][_0x7ea3('0x2c')](',')[_0x7ea3('0x2d')](function(_0x1582cd){_0x3a35ad['Tags'][_0x7ea3('0x2e')](_0x46896e[_0x1582cd]);});}delete _0x3a35ad['TagIds'];}catch(_0x13e317){_0x52637a(_0x13e317);}_0x50eda7(_0x3a35ad);});}function updateOpenchannelInteraction(_0x27ec35,_0x30d6ac,_0x52fd31){return new BPromise(function(_0x267ff4,_0x11a152){return getInteractionUsers(_0x27ec35,_0x52fd31)[_0x7ea3('0x24')](function(_0x5085e5){return getInteractionTags(_0x5085e5,_0x30d6ac);})[_0x7ea3('0x24')](function(_0x25ccd7){_0x267ff4(_0x25ccd7);})[_0x7ea3('0x2f')](function(_0xa65cf1){_0x11a152(_0xa65cf1);});});}exports[_0x7ea3('0x30')]=function(_0x8d8288,_0x280995){var _0x41ebf7={},_0x223b7c={},_0x163035={'count':0x0,'rows':[]};var _0x32edcc=_[_0x7ea3('0x31')](db[_0x7ea3('0x32')][_0x7ea3('0x33')],function(_0x1564c5){return{'name':_0x1564c5[_0x7ea3('0x34')],'type':_0x1564c5[_0x7ea3('0x35')]['key']};});_0x223b7c[_0x7ea3('0x36')]=_[_0x7ea3('0x31')](_0x32edcc,'name');_0x223b7c[_0x7ea3('0x37')]=_['keys'](_0x8d8288['query']);_0x223b7c[_0x7ea3('0x38')]=_['intersection'](_0x223b7c[_0x7ea3('0x36')],_0x223b7c[_0x7ea3('0x37')]);_0x41ebf7[_0x7ea3('0x39')]=_[_0x7ea3('0x3a')](_0x223b7c[_0x7ea3('0x36')],qs[_0x7ea3('0x3b')](_0x8d8288[_0x7ea3('0x37')]['fields']));_0x41ebf7['attributes']=_0x41ebf7['attributes'][_0x7ea3('0x3c')]?_0x41ebf7[_0x7ea3('0x39')]:_0x223b7c[_0x7ea3('0x36')];if(!_0x8d8288['query'][_0x7ea3('0x3d')](_0x7ea3('0x3e'))){_0x41ebf7[_0x7ea3('0x1f')]=qs['limit'](_0x8d8288[_0x7ea3('0x37')]['limit']);_0x41ebf7[_0x7ea3('0x1e')]=qs[_0x7ea3('0x1e')](_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x1e')]);}_0x41ebf7[_0x7ea3('0x3f')]=qs[_0x7ea3('0x40')](_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x40')]);_0x41ebf7['where']=qs[_0x7ea3('0x38')](_[_0x7ea3('0x41')](_0x8d8288[_0x7ea3('0x37')],_0x223b7c[_0x7ea3('0x38')]));var _0x591a36=[];var _0x5c97a9=squel[_0x7ea3('0x42')]()[_0x7ea3('0x43')]('id')[_0x7ea3('0x43')](_0x7ea3('0x28'))['field'](_0x7ea3('0x44'))[_0x7ea3('0x45')]('tools_tags');var _0x42bd5b=squel[_0x7ea3('0x42')]()[_0x7ea3('0x43')](_0x7ea3('0x46'))['field'](_0x7ea3('0x47'))[_0x7ea3('0x43')](_0x7ea3('0x48'))['from'](_0x7ea3('0x49'),'ui')[_0x7ea3('0x4a')]('users','u',_0x7ea3('0x4b'));var _0x3fe306=squel[_0x7ea3('0x42')]()[_0x7ea3('0x45')](_0x7ea3('0x4c'),'i')[_0x7ea3('0x4a')](_0x7ea3('0x4d'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x7ea3('0x4e'),'o',_0x7ea3('0x4f'))[_0x7ea3('0x4a')](_0x7ea3('0x50'),'a',_0x7ea3('0x51'))[_0x7ea3('0x4a')](_0x7ea3('0x52'),'me','me.OpenchannelInteractionId\x20=\x20i.id')[_0x7ea3('0x4a')]('openchannel_interaction_has_tags','it',_0x7ea3('0x53'))[_0x7ea3('0x4a')](_0x7ea3('0x54'),'t',_0x7ea3('0x55'));var _0x60bcd2=squel[_0x7ea3('0x56')]();var _0x5724e7=[];var _0x17fb7f=squel[_0x7ea3('0x56')]();var _0x488a3d;if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x57')]){_0x488a3d=as[_0x7ea3('0x58')](_0x8d8288[_0x7ea3('0x37')]['search']);var _0x46de3e=_0x488a3d[_0x7ea3('0x59')];for(var _0x3f71f7=0x0;_0x3f71f7<_0x488a3d[_0x7ea3('0x5a')][_0x7ea3('0x3c')];_0x3f71f7++){var _0x484aec=_0x488a3d[_0x7ea3('0x5a')][_0x3f71f7];var _0x20009b='i';var _0x4a28f2=_[_0x7ea3('0x5b')](_0x32edcc,[_0x7ea3('0x28'),_0x484aec[_0x7ea3('0x43')]]);if(!_0x4a28f2){switch(_0x484aec[_0x7ea3('0x43')]){case'unreadMessages':if(_0x484aec['value']==0x1){_0x3fe306[_0x7ea3('0x5c')]('`'+_0x484aec['field']+_0x7ea3('0x5d'));}else{_0x3fe306[_0x7ea3('0x5c')]('`'+_0x484aec[_0x7ea3('0x43')]+_0x7ea3('0x5e'));}break;case'Contact':if(_0x484aec[_0x7ea3('0x5f')]===_0x7ea3('0x60')){if(_0x484aec[_0x7ea3('0x61')][_0x7ea3('0x2c')]('\x20')[_0x7ea3('0x3c')]>0x1){_0x60bcd2[_0x46de3e]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7ea3('0x62')](_0x484aec['value']),null);}else{var _0x2f5c1f='%'+_0x484aec[_0x7ea3('0x61')]+'%';_0x60bcd2[_0x46de3e](_0x7ea3('0x63'),_0x2f5c1f,_0x2f5c1f,_0x2f5c1f);}}else{_0x4a28f2=_[_0x7ea3('0x5b')](_0x32edcc,[_0x7ea3('0x28'),_0x7ea3('0x64')]);_0x484aec['field']=_0x7ea3('0x64');_0x21e00a=as['buildExpression'](_0x20009b,_0x4a28f2[_0x7ea3('0x35')],_0x484aec);_0x60bcd2[_0x46de3e](_0x21e00a[_0x7ea3('0x65')],_0x21e00a[_0x7ea3('0x61')][_0x7ea3('0x66')],_0x21e00a[_0x7ea3('0x61')][_0x7ea3('0x67')]);}break;case _0x7ea3('0x68'):var _0x57cfca=_0x484aec[_0x7ea3('0x61')][_0x7ea3('0x2c')](',')[_0x7ea3('0x31')](function(_0x1d8e74){return Number(_0x1d8e74);});_0x57cfca[_0x7ea3('0x2d')](function(_0x255044){_0x17fb7f['or'](_0x7ea3('0x69'),'%,'+_0x255044+',%');});_0x5724e7=_['union'](_0x5724e7,_0x57cfca);break;case _0x7ea3('0x6a'):if(_0x484aec[_0x7ea3('0x5f')]===_0x7ea3('0x60')){_0x60bcd2[_0x46de3e](_0x7ea3('0x6b'),'%'+_0x484aec[_0x7ea3('0x61')]+'%',null);}else{_0x4a28f2=_[_0x7ea3('0x5b')](_0x32edcc,[_0x7ea3('0x28'),_0x7ea3('0x6c')]);_0x484aec[_0x7ea3('0x43')]=_0x7ea3('0x6c');_0x21e00a=as[_0x7ea3('0x6d')](_0x20009b,_0x4a28f2['type'],_0x484aec);_0x60bcd2[_0x46de3e](_0x21e00a[_0x7ea3('0x65')],_0x21e00a['value'][_0x7ea3('0x66')],_0x21e00a[_0x7ea3('0x61')][_0x7ea3('0x67')]);}break;case _0x7ea3('0x6e'):_0x21e00a=as[_0x7ea3('0x6d')]('me',null,_0x484aec);_0x60bcd2[_0x46de3e](_0x21e00a[_0x7ea3('0x65')],_0x21e00a[_0x7ea3('0x61')]['start'],_0x21e00a[_0x7ea3('0x61')]['end']);break;}}else{var _0x21e00a=as[_0x7ea3('0x6d')](_0x20009b,_0x4a28f2[_0x7ea3('0x35')],_0x484aec);_0x60bcd2[_0x46de3e](_0x21e00a[_0x7ea3('0x65')],_0x21e00a[_0x7ea3('0x61')][_0x7ea3('0x66')],_0x21e00a[_0x7ea3('0x61')][_0x7ea3('0x67')]);}}}else{var _0x520cb6=_(_0x8d8288[_0x7ea3('0x37')])[_0x7ea3('0x6f')]()['map'](function(_0x4849c9){return _[_0x7ea3('0x70')](_0x32edcc,[_0x7ea3('0x28'),_0x4849c9])?_0x4849c9:undefined;})[_0x7ea3('0x71')]()[_0x7ea3('0x61')]();if(!_[_0x7ea3('0x72')](_0x520cb6)){_0x520cb6[_0x7ea3('0x2d')](function(_0x489a5e){if(_0x489a5e===_0x7ea3('0x73')){_0x3fe306[_0x7ea3('0x74')](_0x7ea3('0x75'),[][_0x7ea3('0x76')](_0x8d8288['query'][_0x489a5e]));}else if(_0x489a5e===_0x7ea3('0x77')){var _0x35d8d0=JSON[_0x7ea3('0x78')](_0x8d8288[_0x7ea3('0x37')][_0x489a5e])[_0x7ea3('0x79')];var _0x421147=JSON['parse'](_0x8d8288[_0x7ea3('0x37')][_0x489a5e])[_0x7ea3('0x7a')];_0x3fe306[_0x7ea3('0x74')](_0x7ea3('0x7b'),_0x35d8d0,_0x421147);}else{if(_0x8d8288[_0x7ea3('0x37')][_0x489a5e]===_0x7ea3('0x7c')){_0x3fe306[_0x7ea3('0x74')]('i.'+_0x489a5e+_0x7ea3('0x7d'));}else{_0x3fe306[_0x7ea3('0x74')]('i.'+_0x489a5e+_0x7ea3('0x7e'),_0x8d8288[_0x7ea3('0x37')][_0x489a5e]);}}});}if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x7f')]){if(_0x8d8288[_0x7ea3('0x37')]['read']==0x1){_0x3fe306[_0x7ea3('0x5c')]('`unreadMessages`\x20=\x200');}else{_0x3fe306[_0x7ea3('0x5c')](_0x7ea3('0x80'));}}if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x81')]){_0x5724e7=_[_0x7ea3('0x82')](_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x81')])?_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x81')]:new Array(_0x8d8288['query'][_0x7ea3('0x81')]);_0x5724e7[_0x7ea3('0x2d')](function(_0x4d184e){_0x17fb7f['or'](_0x7ea3('0x69'),'%,'+_0x4d184e+',%');});}if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x83')]){var _0x2bc926=_0x8d8288[_0x7ea3('0x37')]['filter'][_0x7ea3('0x84')]('\x5c','\x5c\x5c')['replace']('\x27\x27',_0x7ea3('0x85'));if(qs['isNumeric'](_0x2bc926)){_0x60bcd2['or'](_0x7ea3('0x86'),_0x2bc926+'%');}else{_0x60bcd2['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x7ea3('0x62')](_0x2bc926))['or'](_0x7ea3('0x87'),_0x2bc926+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2bc926+'%');}}}_0x3fe306[_0x7ea3('0x74')](_0x60bcd2);_0x3fe306[_0x7ea3('0x88')]('i.id');var _0x467ffa={'type':db[_0x7ea3('0x89')][_0x7ea3('0x8a')][_0x7ea3('0x8b')],'raw':!![]};var _0x6880a9=_0x3fe306[_0x7ea3('0x8c')]();_0x6880a9[_0x7ea3('0x43')](_0x7ea3('0x8d'));_0x6880a9[_0x7ea3('0x43')](_0x7ea3('0x8e'),_0x7ea3('0x8f'));if(_0x41ebf7['order']){_0x41ebf7[_0x7ea3('0x3f')][_0x7ea3('0x2d')](function(_0x3c4a3b){_0x3fe306['order']('i.'+_0x3c4a3b[0x0],_0x3c4a3b[0x1]===_0x7ea3('0x90')?![]:!![]);});}if(!_[_0x7ea3('0x72')](_0x5724e7)){_0x3fe306[_0x7ea3('0x5c')](_0x17fb7f);_0x6880a9[_0x7ea3('0x74')](_0x7ea3('0x91'),_0x5724e7);}BPromise[_0x7ea3('0x92')]()[_0x7ea3('0x24')](function(){if(!_0x488a3d){if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x73')]||_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x93')])return;_0x6880a9['where'](_0x7ea3('0x94'));_0x3fe306[_0x7ea3('0x74')](_0x7ea3('0x94'));return;}return _0x8d8288[_0x7ea3('0x95')][_0x7ea3('0x96')]({'attributes':['id'],'raw':!![]})[_0x7ea3('0x24')](function(_0x39444b){if(_[_0x7ea3('0x72')](_0x39444b)){_0x6880a9[_0x7ea3('0x74')]('i.OpenchannelAccountId\x20IS\x20NULL');_0x3fe306[_0x7ea3('0x74')](_0x7ea3('0x97'));}else{_0x6880a9['where'](_0x7ea3('0x75'),_[_0x7ea3('0x31')](_0x39444b,'id'));_0x3fe306[_0x7ea3('0x74')](_0x7ea3('0x75'),_[_0x7ea3('0x31')](_0x39444b,'id'));}});})[_0x7ea3('0x24')](function(){db[_0x7ea3('0x98')][_0x7ea3('0x37')](_0x6880a9[_0x7ea3('0x99')](),_0x467ffa)['then'](function(_0x3d0700){_0x163035['count']=_0x3d0700[_0x7ea3('0x3c')];if(_0x163035[_0x7ea3('0x9a')]===0x0)return[];return db[_0x7ea3('0x98')][_0x7ea3('0x37')](_0x5c97a9[_0x7ea3('0x99')](),_0x467ffa)[_0x7ea3('0x24')](function(_0x2143c9){_0x591a36=_[_0x7ea3('0x9b')](_0x2143c9,'id');_0x467ffa=_[_0x7ea3('0x9c')](_0x467ffa,{'model':db[_0x7ea3('0x32')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x8d8288[_0x7ea3('0x37')][_0x7ea3('0x3b')]){_0x41ebf7[_0x7ea3('0x39')][_0x7ea3('0x2d')](function(_0x19056e){_0x3fe306[_0x7ea3('0x43')]('i.'+_0x19056e);});}else{_0x3fe306['field'](_0x7ea3('0x8e'),_0x7ea3('0x8f'));_0x3fe306['field'](_0x7ea3('0x9d'),_0x7ea3('0x9e'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0x9f'),_0x7ea3('0xa0'));_0x3fe306[_0x7ea3('0x43')]('i.*');_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xa1'),'Contact.firstName');_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xa2'),_0x7ea3('0xa3'));_0x3fe306['field']('c.email',_0x7ea3('0xa4'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xa5'),_0x7ea3('0xa6'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xa7'),_0x7ea3('0xa8'));_0x3fe306[_0x7ea3('0x43')]('c.fax',_0x7ea3('0xa9'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xaa'),_0x7ea3('0xab'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xac'),_0x7ea3('0xad'));_0x3fe306[_0x7ea3('0x43')](_0x7ea3('0xae'),'TagIds');}_0x3fe306[_0x7ea3('0x1f')](_0x41ebf7[_0x7ea3('0x1f')]);_0x3fe306[_0x7ea3('0x1e')](_0x41ebf7[_0x7ea3('0x1e')]);return db[_0x7ea3('0x98')][_0x7ea3('0x37')](_0x3fe306[_0x7ea3('0x99')](),_0x467ffa);})[_0x7ea3('0x24')](function(_0x562144){_0x42bd5b['where']('ui.OpenchannelInteractionId\x20IN\x20?',_['map'](_0x562144,'id'));return db['sequelize'][_0x7ea3('0x37')](_0x42bd5b[_0x7ea3('0x99')](),_0x467ffa)[_0x7ea3('0x24')](function(_0x2ac64d){var _0xed8e5a=_['groupBy'](_0x2ac64d,_0x7ea3('0xaf'));var _0x2d0e69=[];_0x562144[_0x7ea3('0x2d')](function(_0x998ac5){_0x2d0e69[_0x7ea3('0x2e')](updateOpenchannelInteraction(_0x998ac5,_0x591a36,_0xed8e5a));});return BPromise[_0x7ea3('0xb0')](_0x2d0e69);});});})[_0x7ea3('0x24')](function(_0x2bf861){_0x163035[_0x7ea3('0xb1')]=_0x2bf861;return _0x163035;})['then'](respondWithFilteredResult(_0x280995,_0x41ebf7));})[_0x7ea3('0x2f')](handleError(_0x280995,null));};exports[_0x7ea3('0xb2')]=function(_0x5eec48,_0xba4493){var _0x176e30={'raw':![],'where':{'id':_0x5eec48[_0x7ea3('0xb3')]['id']}},_0x1f4f65={};_0x1f4f65[_0x7ea3('0x36')]=_[_0x7ea3('0x6f')](db[_0x7ea3('0x32')][_0x7ea3('0x33')]);_0x1f4f65[_0x7ea3('0x37')]=_['keys'](_0x5eec48['query']);_0x1f4f65['filters']=_['intersection'](_0x1f4f65[_0x7ea3('0x36')],_0x1f4f65[_0x7ea3('0x37')]);_0x176e30[_0x7ea3('0x39')]=_[_0x7ea3('0x3a')](_0x1f4f65[_0x7ea3('0x36')],qs[_0x7ea3('0x3b')](_0x5eec48[_0x7ea3('0x37')][_0x7ea3('0x3b')]));_0x176e30[_0x7ea3('0x39')]=_0x176e30[_0x7ea3('0x39')][_0x7ea3('0x3c')]?_0x176e30[_0x7ea3('0x39')]:_0x1f4f65[_0x7ea3('0x36')];if(_0x5eec48[_0x7ea3('0x37')][_0x7ea3('0xb4')]){_0x176e30['include']=[{'all':!![]}];}_0x176e30=_[_0x7ea3('0x9c')]({},_0x176e30,_0x5eec48['options']);return db[_0x7ea3('0x32')][_0x7ea3('0x5b')](_0x176e30)[_0x7ea3('0x24')](handleEntityNotFound(_0xba4493,null))[_0x7ea3('0x24')](respondWithResult(_0xba4493,null))[_0x7ea3('0x2f')](handleError(_0xba4493,null));};exports[_0x7ea3('0xb5')]=function(_0xdc4dc1,_0x29ece1){return db[_0x7ea3('0x32')]['create'](_0xdc4dc1[_0x7ea3('0x6e')],{})[_0x7ea3('0x24')](respondWithResult(_0x29ece1,0xc9))['catch'](handleError(_0x29ece1,null));};exports['update']=function(_0x4cb0b2,_0x38e810){if(_0x4cb0b2[_0x7ea3('0x6e')]['id']){delete _0x4cb0b2[_0x7ea3('0x6e')]['id'];}return db[_0x7ea3('0x32')][_0x7ea3('0x5b')]({'where':{'id':_0x4cb0b2[_0x7ea3('0xb3')]['id']}})['then'](handleEntityNotFound(_0x38e810,null))[_0x7ea3('0x24')](saveUpdates(_0x4cb0b2[_0x7ea3('0x6e')],null))['then'](respondWithResult(_0x38e810,null))['catch'](handleError(_0x38e810,null));};exports[_0x7ea3('0x25')]=function(_0x203a5e,_0x4c02ee){return db[_0x7ea3('0x32')][_0x7ea3('0x5b')]({'where':{'id':_0x203a5e[_0x7ea3('0xb3')]['id']}})[_0x7ea3('0x24')](handleEntityNotFound(_0x4c02ee,null))[_0x7ea3('0x24')](removeEntity(_0x4c02ee,null))[_0x7ea3('0x2f')](handleError(_0x4c02ee,null));};exports['describe']=function(_0x5ebe20,_0x5d5eba){return db[_0x7ea3('0x32')][_0x7ea3('0xb6')]()[_0x7ea3('0x24')](respondWithResult(_0x5d5eba,null))[_0x7ea3('0x2f')](handleError(_0x5d5eba,null));};exports[_0x7ea3('0xb7')]=function(_0x21b691,_0x553521,_0x5dc9d8){return db['OpenchannelMessage']['find']({'where':{'id':_0x21b691[_0x7ea3('0xb3')]['id']}})[_0x7ea3('0x24')](handleEntityNotFound(_0x553521,null))[_0x7ea3('0x24')](function(_0x2950a6){if(_0x2950a6){return _0x2950a6[_0x7ea3('0xb7')](_0x21b691[_0x7ea3('0x6e')][_0x7ea3('0xb8')],_['omit'](_0x21b691[_0x7ea3('0x6e')],[_0x7ea3('0xb8'),'id'])||{});}})['then'](respondWithResult(_0x553521,null))[_0x7ea3('0x2f')](handleError(_0x553521,null));};exports['getMessages']=function(_0x47ac06,_0x374a36,_0x4ede9f){var _0x47cb93={'raw':![],'where':{}};var _0xb24401={};var _0x43f52f={'count':0x0,'rows':[]};return db[_0x7ea3('0x32')][_0x7ea3('0xb9')]({'where':{'id':_0x47ac06[_0x7ea3('0xb3')]['id']}})[_0x7ea3('0x24')](handleEntityNotFound(_0x374a36,null))[_0x7ea3('0x24')](function(_0x4e4cf9){if(_0x4e4cf9){_0xb24401['model']=_[_0x7ea3('0x6f')](db[_0x7ea3('0xba')][_0x7ea3('0x33')]);_0xb24401[_0x7ea3('0x37')]=_[_0x7ea3('0x6f')](_0x47ac06[_0x7ea3('0x37')]);_0xb24401[_0x7ea3('0x38')]=_['intersection'](_0xb24401['model'],_0xb24401[_0x7ea3('0x37')]);_0x47cb93['attributes']=_[_0x7ea3('0x3a')](_0xb24401['model'],qs['fields'](_0x47ac06[_0x7ea3('0x37')]['fields']));_0x47cb93['attributes']=_0x47cb93['attributes'][_0x7ea3('0x3c')]?_0x47cb93[_0x7ea3('0x39')]:_0xb24401[_0x7ea3('0x36')];if(!_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x3d')](_0x7ea3('0x3e'))){_0x47cb93['limit']=qs[_0x7ea3('0x1f')](_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x1f')]);_0x47cb93[_0x7ea3('0x1e')]=qs['offset'](_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x1e')]);}_0x47cb93[_0x7ea3('0x3f')]=qs['sort'](_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x40')]);_0x47cb93['where']=qs[_0x7ea3('0x38')](_[_0x7ea3('0x41')](_0x47ac06['query'],_0xb24401[_0x7ea3('0x38')]));_0x47cb93['where'][_0x7ea3('0xaf')]=_0x4e4cf9['id'];if(_0x47ac06['query'][_0x7ea3('0x83')]){_0x47cb93[_0x7ea3('0x74')]=_['merge'](_0x47cb93[_0x7ea3('0x74')],{'$or':_['map'](_0x47cb93[_0x7ea3('0x39')],function(_0x1bf34d){var _0x146a44={};_0x146a44[_0x1bf34d]={'$like':'%'+_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x83')]+'%'};return _0x146a44;})});}if(_0x47ac06[_0x7ea3('0x37')]['$gte']){var _0x5940ef=_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0x79')][_0x7ea3('0x2c')](',');var _0x2c6e8a={};_0x2c6e8a[_0x5940ef[0x0]]={'$gte':moment(_0x5940ef[0x1])['format'](_0x7ea3('0xbb'))};_0x47cb93[_0x7ea3('0x74')]=_[_0x7ea3('0x9c')](_0x47cb93[_0x7ea3('0x74')],_0x2c6e8a);}_0x47cb93=_[_0x7ea3('0x9c')]({},_0x47cb93,_0x47ac06[_0x7ea3('0xbc')]);return db['OpenchannelMessage'][_0x7ea3('0x9a')]({'where':_0x47cb93['where']})['then'](function(_0x112991){_0x43f52f[_0x7ea3('0x9a')]=_0x112991;if(_0x47ac06[_0x7ea3('0x37')][_0x7ea3('0xb4')]){_0x47cb93[_0x7ea3('0xbd')]=[{'all':!![]}];}return db['OpenchannelMessage'][_0x7ea3('0xbe')](_0x47cb93);})['then'](function(_0x13b2f3){_0x43f52f[_0x7ea3('0xb1')]=_0x13b2f3;return _0x43f52f;});}})[_0x7ea3('0x24')](respondWithFilteredResult(_0x374a36,_0x47cb93))[_0x7ea3('0x2f')](handleError(_0x374a36,null));};exports[_0x7ea3('0xbf')]=function(_0x5c5b51,_0x3dce9e,_0x351cbc){return db[_0x7ea3('0x32')][_0x7ea3('0x5b')]({'where':{'id':_0x5c5b51[_0x7ea3('0xb3')]['id']}})['then'](handleEntityNotFound(_0x3dce9e,null))[_0x7ea3('0x24')](function(_0xc0912e){if(_0xc0912e){return _0xc0912e[_0x7ea3('0xc0')](_0x5c5b51[_0x7ea3('0x6e')][_0x7ea3('0xb8')],_[_0x7ea3('0xc1')](_0x5c5b51[_0x7ea3('0x6e')],[_0x7ea3('0xb8'),'id'])||{})[_0x7ea3('0xc2')](function(){return db['Tag'][_0x7ea3('0xbe')]({'attributes':['id','name','color'],'where':{'id':_0x5c5b51['body']['ids']}});})[_0x7ea3('0x24')](function(_0x345372){socket['emit'](_0x7ea3('0xc3'),{'id':Number(_0x5c5b51[_0x7ea3('0xb3')]['id']),'tags':_0x345372||[]});return{'id':Number(_0x5c5b51['params']['id']),'tags':_0x345372||[]};});}})[_0x7ea3('0x24')](respondWithResult(_0x3dce9e,null))['catch'](handleError(_0x3dce9e,null));};exports[_0x7ea3('0xc4')]=function(_0x36b814,_0x29f70d,_0x2ef8c1){return db[_0x7ea3('0x32')][_0x7ea3('0x5b')]({'where':{'id':_0x36b814[_0x7ea3('0xb3')]['id']}})['then'](handleEntityNotFound(_0x29f70d,null))[_0x7ea3('0x24')](function(_0xee03ff){if(_0xee03ff){return _0xee03ff[_0x7ea3('0xc4')](_0x36b814[_0x7ea3('0x37')]['ids']);}})[_0x7ea3('0x24')](respondWithStatusCode(_0x29f70d,null))[_0x7ea3('0x2f')](handleError(_0x29f70d,null));};exports['download']=function(_0x19c0d3,_0x397793){var _0x3fbca8=moment()[_0x7ea3('0xc5')]()[_0x7ea3('0x99')]();var _0x50154b=path[_0x7ea3('0xc6')](config[_0x7ea3('0xc7')],_0x7ea3('0xc8'),'files',_0x7ea3('0xc9'));var _0x2f05a7=path['join'](config[_0x7ea3('0xc7')],_0x7ea3('0xc8'),_0x7ea3('0xca'),_0x7ea3('0xcb'));var _0x4425dc=path[_0x7ea3('0xc6')](_0x50154b,_0x3fbca8);var _0x4ac644=util[_0x7ea3('0xcc')](_0x7ea3('0xcd'),_0x19c0d3[_0x7ea3('0xb3')]['id'],_0x3fbca8);var _0x3a5b70=path[_0x7ea3('0xc6')](_0x50154b,_0x4ac644);var _0x55b96a=[];_0x55b96a[_0x7ea3('0x2e')]({'model':db[_0x7ea3('0x6a')],'as':_0x7ea3('0x6a'),'attributes':['id',_0x7ea3('0x29')],'raw':!![]});_0x55b96a[_0x7ea3('0x2e')]({'model':db[_0x7ea3('0xce')],'as':_0x7ea3('0xcf'),'attributes':['id',_0x7ea3('0xd0'),'lastName'],'raw':!![]});if(_0x19c0d3[_0x7ea3('0x37')]['attachments']){_0x55b96a[_0x7ea3('0x2e')]({'model':db[_0x7ea3('0xd1')],'as':_0x7ea3('0xd1'),'raw':!![]});}var _0x31ba6a=[{'model':db[_0x7ea3('0xba')],'as':_0x7ea3('0xd2'),'attributes':['id',_0x7ea3('0x6e'),'createdAt','direction',_0x7ea3('0xd3'),_0x7ea3('0x7f')],'include':_0x55b96a}];_0x31ba6a[_0x7ea3('0x2e')]({'model':db[_0x7ea3('0xd4')],'as':_0x7ea3('0xd5'),'attributes':['id',_0x7ea3('0x28')]});_0x31ba6a[_0x7ea3('0x2e')]({'model':db[_0x7ea3('0x6a')],'as':'Owner','attributes':['id',_0x7ea3('0x29')]});return db[_0x7ea3('0x32')][_0x7ea3('0x5b')]({'where':{'id':_0x19c0d3[_0x7ea3('0xb3')]['id']},'include':_0x31ba6a})[_0x7ea3('0x24')](handleEntityNotFound(_0x397793,null))['then'](function(_0x237606){if(_0x237606){var _0x5ee341=_0x237606[_0x7ea3('0xd6')]({'plain':!![]});fs[_0x7ea3('0xd7')](_0x4425dc);var _0x20e004={'format':'A4','border':_0x7ea3('0xd8'),'header':{'height':_0x7ea3('0xd9'),'contents':{'first':_0x7ea3('0xda')}},'footer':{'height':'30px','contents':{'default':util[_0x7ea3('0xcc')](_0x7ea3('0xdb'),util[_0x7ea3('0xcc')]('%s\x20#%d',_0x7ea3('0xdc'),_0x5ee341['id']),moment()['format'](_0x7ea3('0xdd'))[_0x7ea3('0x99')]())}}};var _0x5cf72c={'channel':'Openchannel','account':_0x5ee341[_0x7ea3('0xd5')][_0x7ea3('0x28')],'agent':_0x5ee341[_0x7ea3('0xde')]?_0x5ee341['Owner'][_0x7ea3('0x29')]:'N.A.','createdAt':moment(_0x5ee341[_0x7ea3('0x77')])['format'](_0x7ea3('0xbb'))['toString'](),'closedAt':_0x5ee341[_0x7ea3('0xdf')]?moment(_0x5ee341[_0x7ea3('0xe0')])[_0x7ea3('0xcc')](_0x7ea3('0xbb'))['toString']():'','disposition':_0x5ee341[_0x7ea3('0xe1')],'visibility':_0x5ee341[_0x7ea3('0xe2')]?'Public':_0x7ea3('0xe3'),'messages':_(_0x5ee341[_0x7ea3('0xd2')])[_0x7ea3('0x83')]({'secret':![]})[_0x7ea3('0x31')](function(_0x38703d){if(_0x38703d['Attachment']){var _0x50e6b7=path[_0x7ea3('0xc6')](_0x2f05a7,_0x38703d[_0x7ea3('0xd1')]['basename']);if(fs[_0x7ea3('0xe4')](_0x50e6b7)){fs['createReadStream'](_0x50e6b7)[_0x7ea3('0xe5')](fs['createWriteStream'](path['join'](_0x4425dc,_0x38703d[_0x7ea3('0xd1')][_0x7ea3('0xe6')])));}}return{'date':moment(_0x38703d[_0x7ea3('0x77')])[_0x7ea3('0xcc')]('YYYY-MM-DD\x20HH:mm:ss')[_0x7ea3('0x99')](),'sender':_0x38703d[_0x7ea3('0xe7')]===_0x7ea3('0xe8')?_0x38703d[_0x7ea3('0x6a')]?_0x38703d[_0x7ea3('0x6a')][_0x7ea3('0x29')]:_0x7ea3('0xe9'):_0x38703d[_0x7ea3('0xcf')]['firstName']+(_0x38703d[_0x7ea3('0xcf')][_0x7ea3('0xea')]?'\x20'+_0x38703d[_0x7ea3('0xcf')][_0x7ea3('0xea')]:''),'body':_0x38703d[_0x7ea3('0xd1')]?_0x38703d[_0x7ea3('0xd1')]['basename']:_0x38703d[_0x7ea3('0x6e')],'direction':_0x38703d[_0x7ea3('0xe7')]===_0x7ea3('0xe8')?'A':'C','secret':_0x38703d[_0x7ea3('0xd3')],'read':_0x38703d[_0x7ea3('0x7f')],'attachment':_0x38703d[_0x7ea3('0xd1')]};})['value']()};return ejs[_0x7ea3('0xeb')](path[_0x7ea3('0xc6')](config[_0x7ea3('0xc7')],_0x7ea3('0xc8'),_0x7ea3('0xec'),_0x7ea3('0xed')),{'interaction':_0x5cf72c})[_0x7ea3('0x24')](function(_0x51b34a){return new BPromise(function(_0x2a2498,_0x43ca9b){pdf[_0x7ea3('0xb5')](_0x51b34a,_0x20e004)[_0x7ea3('0xee')](path[_0x7ea3('0xc6')](_0x4425dc,_0x7ea3('0xef')+_0x5ee341['id']+'-'+_0x3fbca8+_0x7ea3('0xf0')),function(_0xce600f,_0x478626){if(_0xce600f)return _0x43ca9b(_0xce600f);_0x2a2498(_0x478626);});});})[_0x7ea3('0x24')](function(){return new BPromise(function(_0x593593,_0xab6e03){zipdir(_0x4425dc,{'saveTo':_0x3a5b70},function(_0x1db99d,_0x5b2200){if(_0x1db99d)return _0xab6e03(_0x1db99d);return _0x593593(_0x5b2200);});})[_0x7ea3('0x24')](function(){return new BPromise(function(_0x586333,_0x49488f){rimraf(_0x4425dc,function(_0x2368d8){if(_0x2368d8)_0x49488f(_0x2368d8);return _0x586333();});});})[_0x7ea3('0x24')](function(){return _0x397793['download'](_0x3a5b70,_0x4ac644,function(_0x2415ee){if(_0x2415ee){console['log'](_0x7ea3('0xf1'),_0x2415ee);}else{fs['unlinkSync'](_0x3a5b70);}});});});}else{return _0x397793[_0x7ea3('0x1c')](0xc8);}})[_0x7ea3('0x2f')](handleError(_0x397793,null));}; \ No newline at end of file +var _0x5f1a=['key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','field','name','tools_tags','u.fullname','from','user_has_openchannel_interactions','users','u.id\x20=\x20ui.UserId','select','openchannel_interactions','left_join','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','openchannel_accounts','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','value','having','`\x20>\x200','Contact','operator','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','buildExpression','type','start','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','User','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','keys','some','isEmpty','OpenchannelAccountId','i.OpenchannelAccountId\x20IN\x20?','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','filter','replace','\x27\x27\x27\x27','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','i.from\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','t.id\x20IN\x20?','journey','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','sequelize','count','toString','keyBy','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','c.phone','Contact.phone','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','push','all','rows','show','params','include','merge','create','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','pick','format','options','includeAll','addTags','setTags','Tag','findAll','color','openchannelInteractionTags:save','removeTags','unix','join','root','files','tmp','attachments','CmContact','firstName','lastName','Attachment','Messages','direction','secret','OpenchannelAccount','Account','Owner','get','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\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','Openchannel','YYYY-MM-DD','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','disposition','threadId','Public','Private','basename','existsSync','createWriteStream','out','renderFile','views','downloadInteraction.html','toFile','transcript-','.pdf','download','log','err','unlinkSync','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','socket.io-emitter','register','sendStatus','status','json','offset','set','Content-Range','apply','save','destroy','then','end','error','stack','send','Users','fullname','TagIds','Tags','split','catch','index','OpenchannelInteraction','rawAttributes','fieldName'];(function(_0x4008f0,_0x17f1b2){var _0xb42e88=function(_0xd8382b){while(--_0xd8382b){_0x4008f0['push'](_0x4008f0['shift']());}};_0xb42e88(++_0x17f1b2);}(_0x5f1a,0xbc));var _0xa5f1=function(_0x280f55,_0x5066b4){_0x280f55=_0x280f55-0x0;var _0x30dc1f=_0x5f1a[_0x280f55];return _0x30dc1f;};'use strict';var pdf=require(_0xa5f1('0x0'));var emlformat=require(_0xa5f1('0x1'));var rimraf=require(_0xa5f1('0x2'));var zipdir=require(_0xa5f1('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa5f1('0x4'));var BPromise=require(_0xa5f1('0x5'));var Mustache=require(_0xa5f1('0x6'));var util=require(_0xa5f1('0x7'));var path=require(_0xa5f1('0x8'));var sox=require(_0xa5f1('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xa5f1('0xa'));var squel=require(_0xa5f1('0xb'));var crypto=require(_0xa5f1('0xc'));var jsforce=require(_0xa5f1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa5f1('0xe'));var querystring=require(_0xa5f1('0xf'));var Papa=require(_0xa5f1('0x10'));var Redis=require(_0xa5f1('0x11'));var authService=require(_0xa5f1('0x12'));var qs=require(_0xa5f1('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa5f1('0x14'));var logger=require(_0xa5f1('0x15'))('api');var utils=require(_0xa5f1('0x16'));var config=require('../../config/environment');var db=require(_0xa5f1('0x17'))['db'];config[_0xa5f1('0x18')]=_['defaults'](config[_0xa5f1('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0xa5f1('0x19'))(new Redis(config[_0xa5f1('0x18')]));require('./openchannelInteraction.socket')[_0xa5f1('0x1a')](socket);function respondWithStatusCode(_0x4517e2,_0x55b40e){_0x55b40e=_0x55b40e||0xcc;return function(_0x2f9a20){if(_0x2f9a20){return _0x4517e2[_0xa5f1('0x1b')](_0x55b40e);}return _0x4517e2[_0xa5f1('0x1c')](_0x55b40e)['end']();};}function respondWithResult(_0x1c2ff3,_0x260b7a){_0x260b7a=_0x260b7a||0xc8;return function(_0x40565e){if(_0x40565e){return _0x1c2ff3[_0xa5f1('0x1c')](_0x260b7a)[_0xa5f1('0x1d')](_0x40565e);}};}function respondWithFilteredResult(_0x434826,_0x459c56){return function(_0x31e586){if(_0x31e586){var _0x3ed87a=_0x31e586['count'],_0x4cf88a=_0x459c56[_0xa5f1('0x1e')],_0x458208=_0x459c56[_0xa5f1('0x1e')]+_0x459c56['limit'],_0x58de8e;if(_0x458208>=_0x3ed87a){_0x458208=_0x3ed87a;_0x58de8e=0xc8;}else{_0x58de8e=0xce;}_0x434826[_0xa5f1('0x1c')](_0x58de8e);return _0x434826[_0xa5f1('0x1f')](_0xa5f1('0x20'),_0x4cf88a+'-'+_0x458208+'/'+_0x3ed87a)[_0xa5f1('0x1d')](_0x31e586);}return null;};}function patchUpdates(_0x4fdc1b){return function(_0x4153dc){try{jsonpatch[_0xa5f1('0x21')](_0x4153dc,_0x4fdc1b,!![]);}catch(_0x376cdf){return BPromise['reject'](_0x376cdf);}return _0x4153dc[_0xa5f1('0x22')]();};}function saveUpdates(_0x20f2b2,_0x4d76bf){return function(_0x32c47d){if(_0x32c47d){return _0x32c47d['update'](_0x20f2b2)['then'](function(_0x1233d1){return _0x1233d1;});}return null;};}function removeEntity(_0x198f45,_0x39fc91){return function(_0x13dff1){if(_0x13dff1){return _0x13dff1[_0xa5f1('0x23')]()[_0xa5f1('0x24')](function(){_0x198f45[_0xa5f1('0x1c')](0xcc)[_0xa5f1('0x25')]();});}};}function handleEntityNotFound(_0x10205c,_0x25aad0){return function(_0x57a9ae){if(!_0x57a9ae){_0x10205c['sendStatus'](0x194);}return _0x57a9ae;};}function handleError(_0x243dc3,_0x4e708e){_0x4e708e=_0x4e708e||0x1f4;return function(_0x280df9){logger[_0xa5f1('0x26')](_0x280df9[_0xa5f1('0x27')]);if(_0x280df9['name']){delete _0x280df9['name'];}_0x243dc3['status'](_0x4e708e)[_0xa5f1('0x28')](_0x280df9);};}function getInteractionUsers(_0x10e2f1,_0x4d594e){return new BPromise(function(_0x5ca14d,_0x17d776){try{if(_0x4d594e[_0x10e2f1['id']]){_0x10e2f1[_0xa5f1('0x29')]=_['map'](_0x4d594e[_0x10e2f1['id']],function(_0x5aec7d){return{'id':_0x5aec7d['id'],'fullname':_0x5aec7d[_0xa5f1('0x2a')]};});}}catch(_0x3c1bc5){_0x17d776(_0x3c1bc5);}_0x5ca14d(_0x10e2f1);});}function getInteractionTags(_0x519e3c,_0x56ebf7){return new BPromise(function(_0x302d6b,_0x5c801a){try{if(_0x519e3c[_0xa5f1('0x2b')]){_0x519e3c[_0xa5f1('0x2c')]=[];_0x519e3c['TagIds'][_0xa5f1('0x2d')](',')['forEach'](function(_0x58d924){_0x519e3c[_0xa5f1('0x2c')]['push'](_0x56ebf7[_0x58d924]);});}delete _0x519e3c['TagIds'];}catch(_0x52f104){_0x5c801a(_0x52f104);}_0x302d6b(_0x519e3c);});}function updateOpenchannelInteraction(_0xa980ba,_0x48f3f5,_0x5eb92f){return new BPromise(function(_0x246814,_0x1c01f9){return getInteractionUsers(_0xa980ba,_0x5eb92f)[_0xa5f1('0x24')](function(_0x273557){return getInteractionTags(_0x273557,_0x48f3f5);})['then'](function(_0xa56803){_0x246814(_0xa56803);})[_0xa5f1('0x2e')](function(_0x387825){_0x1c01f9(_0x387825);});});}exports[_0xa5f1('0x2f')]=function(_0x2f0549,_0x5dd402){var _0x1c3dc9={},_0x198c9b={},_0x417750={'count':0x0,'rows':[]};var _0x59d6ef=_['map'](db[_0xa5f1('0x30')][_0xa5f1('0x31')],function(_0x9708c8){return{'name':_0x9708c8[_0xa5f1('0x32')],'type':_0x9708c8['type'][_0xa5f1('0x33')]};});_0x198c9b[_0xa5f1('0x34')]=_[_0xa5f1('0x35')](_0x59d6ef,'name');_0x198c9b[_0xa5f1('0x36')]=_['keys'](_0x2f0549[_0xa5f1('0x36')]);_0x198c9b[_0xa5f1('0x37')]=_[_0xa5f1('0x38')](_0x198c9b['model'],_0x198c9b['query']);_0x1c3dc9[_0xa5f1('0x39')]=_[_0xa5f1('0x38')](_0x198c9b[_0xa5f1('0x34')],qs[_0xa5f1('0x3a')](_0x2f0549['query'][_0xa5f1('0x3a')]));_0x1c3dc9[_0xa5f1('0x39')]=_0x1c3dc9[_0xa5f1('0x39')][_0xa5f1('0x3b')]?_0x1c3dc9['attributes']:_0x198c9b[_0xa5f1('0x34')];if(!_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x3c')](_0xa5f1('0x3d'))){_0x1c3dc9[_0xa5f1('0x3e')]=qs[_0xa5f1('0x3e')](_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x3e')]);_0x1c3dc9[_0xa5f1('0x1e')]=qs[_0xa5f1('0x1e')](_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x1e')]);}_0x1c3dc9[_0xa5f1('0x3f')]=qs[_0xa5f1('0x40')](_0x2f0549[_0xa5f1('0x36')]['sort']);_0x1c3dc9[_0xa5f1('0x41')]=qs[_0xa5f1('0x37')](_['pick'](_0x2f0549[_0xa5f1('0x36')],_0x198c9b['filters']));var _0xa28248=[];var _0x2de375=squel['select']()[_0xa5f1('0x42')]('id')['field'](_0xa5f1('0x43'))[_0xa5f1('0x42')]('color')['from'](_0xa5f1('0x44'));var _0x191319=squel['select']()['field']('u.id')[_0xa5f1('0x42')](_0xa5f1('0x45'))[_0xa5f1('0x42')]('ui.OpenchannelInteractionId')[_0xa5f1('0x46')](_0xa5f1('0x47'),'ui')['left_join'](_0xa5f1('0x48'),'u',_0xa5f1('0x49'));var _0xc32f35=squel[_0xa5f1('0x4a')]()[_0xa5f1('0x46')](_0xa5f1('0x4b'),'i')[_0xa5f1('0x4c')]('cm_contacts','c',_0xa5f1('0x4d'))[_0xa5f1('0x4c')]('users','o','o.id\x20=\x20i.UserId')[_0xa5f1('0x4c')](_0xa5f1('0x4e'),'a',_0xa5f1('0x4f'))[_0xa5f1('0x4c')](_0xa5f1('0x50'),'me',_0xa5f1('0x51'))[_0xa5f1('0x4c')](_0xa5f1('0x52'),'it','it.OpenchannelInteractionId\x20=\x20i.id')['left_join'](_0xa5f1('0x44'),'t',_0xa5f1('0x53'));var _0x594fc3=squel[_0xa5f1('0x54')]();var _0x62ac38=[];var _0x49220a=squel[_0xa5f1('0x54')]();var _0x4e9c9e;if(_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x55')]){_0x4e9c9e=as[_0xa5f1('0x56')](_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x55')]);var _0x95dded=_0x4e9c9e[_0xa5f1('0x57')];for(var _0x5a52d3=0x0;_0x5a52d3<_0x4e9c9e['conditions'][_0xa5f1('0x3b')];_0x5a52d3++){var _0x8bde2d=_0x4e9c9e[_0xa5f1('0x58')][_0x5a52d3];var _0x254369='i';var _0x5e13b2=_[_0xa5f1('0x59')](_0x59d6ef,[_0xa5f1('0x43'),_0x8bde2d[_0xa5f1('0x42')]]);if(!_0x5e13b2){switch(_0x8bde2d['field']){case'unreadMessages':if(_0x8bde2d[_0xa5f1('0x5a')]==0x1){_0xc32f35[_0xa5f1('0x5b')]('`'+_0x8bde2d[_0xa5f1('0x42')]+'`\x20=\x200');}else{_0xc32f35[_0xa5f1('0x5b')]('`'+_0x8bde2d[_0xa5f1('0x42')]+_0xa5f1('0x5c'));}break;case _0xa5f1('0x5d'):if(_0x8bde2d[_0xa5f1('0x5e')]==='$substring'){if(_0x8bde2d[_0xa5f1('0x5a')]['split']('\x20')[_0xa5f1('0x3b')]>0x1){_0x594fc3[_0x95dded](_0xa5f1('0x5f'),qs['getFullTextValue'](_0x8bde2d['value']),null);}else{var _0x29c83c='%'+_0x8bde2d[_0xa5f1('0x5a')]+'%';_0x594fc3[_0x95dded](_0xa5f1('0x60'),_0x29c83c,_0x29c83c,_0x29c83c);}}else{_0x5e13b2=_['find'](_0x59d6ef,['name',_0xa5f1('0x61')]);_0x8bde2d[_0xa5f1('0x42')]=_0xa5f1('0x61');_0x36315b=as[_0xa5f1('0x62')](_0x254369,_0x5e13b2[_0xa5f1('0x63')],_0x8bde2d);_0x594fc3[_0x95dded](_0x36315b['text'],_0x36315b[_0xa5f1('0x5a')][_0xa5f1('0x64')],_0x36315b['value'][_0xa5f1('0x25')]);}break;case'Tag':var _0x500261=_0x8bde2d['value'][_0xa5f1('0x2d')](',')[_0xa5f1('0x35')](function(_0x53033c){return Number(_0x53033c);});_0x500261[_0xa5f1('0x65')](function(_0x32bb84){_0x49220a['or'](_0xa5f1('0x66'),'%,'+_0x32bb84+',%');});_0x62ac38=_['union'](_0x62ac38,_0x500261);break;case _0xa5f1('0x67'):if(_0x8bde2d[_0xa5f1('0x5e')]===_0xa5f1('0x68')){_0x594fc3[_0x95dded](_0xa5f1('0x69'),'%'+_0x8bde2d[_0xa5f1('0x5a')]+'%',null);}else{_0x5e13b2=_[_0xa5f1('0x59')](_0x59d6ef,[_0xa5f1('0x43'),'UserId']);_0x8bde2d['field']=_0xa5f1('0x6a');_0x36315b=as[_0xa5f1('0x62')](_0x254369,_0x5e13b2[_0xa5f1('0x63')],_0x8bde2d);_0x594fc3[_0x95dded](_0x36315b[_0xa5f1('0x6b')],_0x36315b[_0xa5f1('0x5a')][_0xa5f1('0x64')],_0x36315b[_0xa5f1('0x5a')][_0xa5f1('0x25')]);}break;case _0xa5f1('0x6c'):_0x36315b=as[_0xa5f1('0x62')]('me',null,_0x8bde2d);_0x594fc3[_0x95dded](_0x36315b[_0xa5f1('0x6b')],_0x36315b[_0xa5f1('0x5a')]['start'],_0x36315b['value'][_0xa5f1('0x25')]);break;}}else{var _0x36315b=as[_0xa5f1('0x62')](_0x254369,_0x5e13b2[_0xa5f1('0x63')],_0x8bde2d);_0x594fc3[_0x95dded](_0x36315b['text'],_0x36315b['value']['start'],_0x36315b['value'][_0xa5f1('0x25')]);}}}else{var _0x428f22=_(_0x2f0549[_0xa5f1('0x36')])[_0xa5f1('0x6d')]()[_0xa5f1('0x35')](function(_0xf39846){return _[_0xa5f1('0x6e')](_0x59d6ef,[_0xa5f1('0x43'),_0xf39846])?_0xf39846:undefined;})['compact']()[_0xa5f1('0x5a')]();if(!_[_0xa5f1('0x6f')](_0x428f22)){_0x428f22[_0xa5f1('0x65')](function(_0x2bebaa){if(_0x2bebaa===_0xa5f1('0x70')){_0xc32f35[_0xa5f1('0x41')](_0xa5f1('0x71'),[]['concat'](_0x2f0549[_0xa5f1('0x36')][_0x2bebaa]));}else if(_0x2bebaa===_0xa5f1('0x72')){var _0x4ec535=JSON[_0xa5f1('0x73')](_0x2f0549[_0xa5f1('0x36')][_0x2bebaa])[_0xa5f1('0x74')];var _0x48f390=JSON[_0xa5f1('0x73')](_0x2f0549[_0xa5f1('0x36')][_0x2bebaa])[_0xa5f1('0x75')];_0xc32f35[_0xa5f1('0x41')](_0xa5f1('0x76'),_0x4ec535,_0x48f390);}else{if(_0x2f0549['query'][_0x2bebaa]==='null'){_0xc32f35[_0xa5f1('0x41')]('i.'+_0x2bebaa+_0xa5f1('0x77'));}else{_0xc32f35[_0xa5f1('0x41')]('i.'+_0x2bebaa+_0xa5f1('0x78'),_0x2f0549['query'][_0x2bebaa]);}}});}if(_0x2f0549['query']['read']){if(_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x79')]==0x1){_0xc32f35[_0xa5f1('0x5b')](_0xa5f1('0x7a'));}else{_0xc32f35[_0xa5f1('0x5b')](_0xa5f1('0x7b'));}}if(_0x2f0549['query']['tag']){_0x62ac38=_[_0xa5f1('0x7c')](_0x2f0549[_0xa5f1('0x36')]['tag'])?_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x7d')]:new Array(_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x7d')]);_0x62ac38['forEach'](function(_0x115cac){_0x49220a['or'](_0xa5f1('0x66'),'%,'+_0x115cac+',%');});}if(_0x2f0549['query'][_0xa5f1('0x7e')]){var _0xc5e51f=_0x2f0549[_0xa5f1('0x36')]['filter'][_0xa5f1('0x7f')]('\x5c','\x5c\x5c')[_0xa5f1('0x7f')]('\x27\x27',_0xa5f1('0x80'));if(qs['isNumeric'](_0xc5e51f)){_0x594fc3['or'](_0xa5f1('0x81'),_0xc5e51f+'%');}else{_0x594fc3['or'](_0xa5f1('0x82'),qs[_0xa5f1('0x83')](_0xc5e51f))['or'](_0xa5f1('0x84'),_0xc5e51f+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0xc5e51f+'%');}}}_0xc32f35[_0xa5f1('0x41')](_0x594fc3);_0xc32f35[_0xa5f1('0x85')]('i.id');var _0x1020cc={'type':db[_0xa5f1('0x86')][_0xa5f1('0x87')][_0xa5f1('0x88')],'raw':!![]};var _0x123c2f=_0xc32f35[_0xa5f1('0x89')]();_0x123c2f[_0xa5f1('0x42')](_0xa5f1('0x8a'));_0x123c2f[_0xa5f1('0x42')](_0xa5f1('0x8b'),_0xa5f1('0x8c'));if(_0x1c3dc9[_0xa5f1('0x3f')]){_0x1c3dc9[_0xa5f1('0x3f')][_0xa5f1('0x65')](function(_0x26fd71){_0xc32f35[_0xa5f1('0x3f')]('i.'+_0x26fd71[0x0],_0x26fd71[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x62ac38)){_0xc32f35['having'](_0x49220a);_0x123c2f[_0xa5f1('0x41')](_0xa5f1('0x8d'),_0x62ac38);}BPromise['resolve']()[_0xa5f1('0x24')](function(){if(!_0x4e9c9e){if(_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x70')]||_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x8e')])return;_0x123c2f[_0xa5f1('0x41')](_0xa5f1('0x8f'));_0xc32f35[_0xa5f1('0x41')](_0xa5f1('0x8f'));return;}return _0x2f0549[_0xa5f1('0x90')][_0xa5f1('0x91')]({'attributes':['id'],'raw':!![]})[_0xa5f1('0x24')](function(_0x440d74){if(_[_0xa5f1('0x6f')](_0x440d74)){_0x123c2f['where'](_0xa5f1('0x92'));_0xc32f35[_0xa5f1('0x41')](_0xa5f1('0x92'));}else{_0x123c2f['where']('i.OpenchannelAccountId\x20IN\x20?',_[_0xa5f1('0x35')](_0x440d74,'id'));_0xc32f35[_0xa5f1('0x41')](_0xa5f1('0x71'),_[_0xa5f1('0x35')](_0x440d74,'id'));}});})['then'](function(){db[_0xa5f1('0x93')][_0xa5f1('0x36')](_0x123c2f['toString'](),_0x1020cc)[_0xa5f1('0x24')](function(_0x3ce83b){_0x417750[_0xa5f1('0x94')]=_0x3ce83b[_0xa5f1('0x3b')];if(_0x417750[_0xa5f1('0x94')]===0x0)return[];return db[_0xa5f1('0x93')][_0xa5f1('0x36')](_0x2de375[_0xa5f1('0x95')](),_0x1020cc)[_0xa5f1('0x24')](function(_0x20f4c7){_0xa28248=_[_0xa5f1('0x96')](_0x20f4c7,'id');_0x1020cc=_['merge'](_0x1020cc,{'model':db[_0xa5f1('0x30')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2f0549[_0xa5f1('0x36')][_0xa5f1('0x3a')]){_0x1c3dc9[_0xa5f1('0x39')][_0xa5f1('0x65')](function(_0x5c2f09){_0xc32f35['field']('i.'+_0x5c2f09);});}else{_0xc32f35[_0xa5f1('0x42')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0xa5f1('0x8c'));_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0x97'),_0xa5f1('0x98'));_0xc32f35['field'](_0xa5f1('0x99'),_0xa5f1('0x9a'));_0xc32f35[_0xa5f1('0x42')]('i.*');_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0x9b'),'Contact.firstName');_0xc32f35[_0xa5f1('0x42')]('c.lastName','Contact.lastName');_0xc32f35[_0xa5f1('0x42')]('c.email','Contact.email');_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0x9c'),_0xa5f1('0x9d'));_0xc32f35[_0xa5f1('0x42')]('c.mobile',_0xa5f1('0x9e'));_0xc32f35['field'](_0xa5f1('0x9f'),_0xa5f1('0xa0'));_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0xa1'),_0xa5f1('0xa2'));_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0xa3'),_0xa5f1('0xa4'));_0xc32f35[_0xa5f1('0x42')](_0xa5f1('0xa5'),_0xa5f1('0x2b'));}_0xc32f35[_0xa5f1('0x3e')](_0x1c3dc9[_0xa5f1('0x3e')]);_0xc32f35[_0xa5f1('0x1e')](_0x1c3dc9[_0xa5f1('0x1e')]);return db[_0xa5f1('0x93')][_0xa5f1('0x36')](_0xc32f35[_0xa5f1('0x95')](),_0x1020cc);})[_0xa5f1('0x24')](function(_0x39e73a){_0x191319[_0xa5f1('0x41')](_0xa5f1('0xa6'),_['map'](_0x39e73a,'id'));return db[_0xa5f1('0x93')]['query'](_0x191319[_0xa5f1('0x95')](),_0x1020cc)[_0xa5f1('0x24')](function(_0x4092a0){var _0x436a54=_[_0xa5f1('0xa7')](_0x4092a0,_0xa5f1('0xa8'));var _0x5bb2e0=[];_0x39e73a['forEach'](function(_0x598571){_0x5bb2e0[_0xa5f1('0xa9')](updateOpenchannelInteraction(_0x598571,_0xa28248,_0x436a54));});return BPromise[_0xa5f1('0xaa')](_0x5bb2e0);});});})['then'](function(_0x198dd8){_0x417750[_0xa5f1('0xab')]=_0x198dd8;return _0x417750;})[_0xa5f1('0x24')](respondWithFilteredResult(_0x5dd402,_0x1c3dc9));})[_0xa5f1('0x2e')](handleError(_0x5dd402,null));};exports[_0xa5f1('0xac')]=function(_0x3673f0,_0x41fc8f){var _0x5e2645={'raw':![],'where':{'id':_0x3673f0[_0xa5f1('0xad')]['id']}},_0x3dffff={};_0x3dffff[_0xa5f1('0x34')]=_[_0xa5f1('0x6d')](db[_0xa5f1('0x30')][_0xa5f1('0x31')]);_0x3dffff[_0xa5f1('0x36')]=_['keys'](_0x3673f0[_0xa5f1('0x36')]);_0x3dffff['filters']=_[_0xa5f1('0x38')](_0x3dffff[_0xa5f1('0x34')],_0x3dffff['query']);_0x5e2645[_0xa5f1('0x39')]=_[_0xa5f1('0x38')](_0x3dffff[_0xa5f1('0x34')],qs[_0xa5f1('0x3a')](_0x3673f0['query'][_0xa5f1('0x3a')]));_0x5e2645[_0xa5f1('0x39')]=_0x5e2645[_0xa5f1('0x39')]['length']?_0x5e2645[_0xa5f1('0x39')]:_0x3dffff[_0xa5f1('0x34')];if(_0x3673f0[_0xa5f1('0x36')]['includeAll']){_0x5e2645[_0xa5f1('0xae')]=[{'all':!![]}];}_0x5e2645=_[_0xa5f1('0xaf')]({},_0x5e2645,_0x3673f0['options']);return db['OpenchannelInteraction'][_0xa5f1('0x59')](_0x5e2645)[_0xa5f1('0x24')](handleEntityNotFound(_0x41fc8f,null))[_0xa5f1('0x24')](respondWithResult(_0x41fc8f,null))[_0xa5f1('0x2e')](handleError(_0x41fc8f,null));};exports['create']=function(_0xf77d3,_0x3f5234){return db[_0xa5f1('0x30')][_0xa5f1('0xb0')](_0xf77d3['body'],{})[_0xa5f1('0x24')](respondWithResult(_0x3f5234,0xc9))[_0xa5f1('0x2e')](handleError(_0x3f5234,null));};exports['update']=function(_0x31abf1,_0x59769b){if(_0x31abf1['body']['id']){delete _0x31abf1[_0xa5f1('0x6c')]['id'];}return db[_0xa5f1('0x30')]['find']({'where':{'id':_0x31abf1[_0xa5f1('0xad')]['id']}})['then'](handleEntityNotFound(_0x59769b,null))[_0xa5f1('0x24')](saveUpdates(_0x31abf1['body'],null))[_0xa5f1('0x24')](respondWithResult(_0x59769b,null))[_0xa5f1('0x2e')](handleError(_0x59769b,null));};exports[_0xa5f1('0x23')]=function(_0x40a91a,_0x5efc81){return db['OpenchannelInteraction']['find']({'where':{'id':_0x40a91a[_0xa5f1('0xad')]['id']}})['then'](handleEntityNotFound(_0x5efc81,null))[_0xa5f1('0x24')](removeEntity(_0x5efc81,null))[_0xa5f1('0x2e')](handleError(_0x5efc81,null));};exports['describe']=function(_0x4300ad,_0x2af1f6){return db[_0xa5f1('0x30')][_0xa5f1('0xb1')]()[_0xa5f1('0x24')](respondWithResult(_0x2af1f6,null))[_0xa5f1('0x2e')](handleError(_0x2af1f6,null));};exports[_0xa5f1('0xb2')]=function(_0x5e52b3,_0x4626c3,_0x3644ad){return db[_0xa5f1('0xb3')]['find']({'where':{'id':_0x5e52b3[_0xa5f1('0xad')]['id']}})['then'](handleEntityNotFound(_0x4626c3,null))['then'](function(_0x3c3ca7){if(_0x3c3ca7){return _0x3c3ca7[_0xa5f1('0xb2')](_0x5e52b3[_0xa5f1('0x6c')][_0xa5f1('0xb4')],_[_0xa5f1('0xb5')](_0x5e52b3[_0xa5f1('0x6c')],[_0xa5f1('0xb4'),'id'])||{});}})['then'](respondWithResult(_0x4626c3,null))[_0xa5f1('0x2e')](handleError(_0x4626c3,null));};exports[_0xa5f1('0xb6')]=function(_0x25b582,_0x3fb76d,_0x3c6e29){var _0x1bed09={'raw':![],'where':{}};var _0x22bf43={};var _0x1a66ce={'count':0x0,'rows':[]};return db[_0xa5f1('0x30')][_0xa5f1('0xb7')]({'where':{'id':_0x25b582[_0xa5f1('0xad')]['id']}})[_0xa5f1('0x24')](handleEntityNotFound(_0x3fb76d,null))[_0xa5f1('0x24')](function(_0x21f5ae){if(_0x21f5ae){_0x22bf43[_0xa5f1('0x34')]=_['keys'](db[_0xa5f1('0xb3')][_0xa5f1('0x31')]);_0x22bf43[_0xa5f1('0x36')]=_['keys'](_0x25b582[_0xa5f1('0x36')]);_0x22bf43['filters']=_['intersection'](_0x22bf43[_0xa5f1('0x34')],_0x22bf43[_0xa5f1('0x36')]);_0x1bed09['attributes']=_['intersection'](_0x22bf43[_0xa5f1('0x34')],qs[_0xa5f1('0x3a')](_0x25b582[_0xa5f1('0x36')]['fields']));_0x1bed09[_0xa5f1('0x39')]=_0x1bed09['attributes']['length']?_0x1bed09[_0xa5f1('0x39')]:_0x22bf43[_0xa5f1('0x34')];if(!_0x25b582['query']['hasOwnProperty'](_0xa5f1('0x3d'))){_0x1bed09[_0xa5f1('0x3e')]=qs[_0xa5f1('0x3e')](_0x25b582[_0xa5f1('0x36')][_0xa5f1('0x3e')]);_0x1bed09[_0xa5f1('0x1e')]=qs['offset'](_0x25b582[_0xa5f1('0x36')]['offset']);}_0x1bed09['order']=qs['sort'](_0x25b582[_0xa5f1('0x36')][_0xa5f1('0x40')]);_0x1bed09[_0xa5f1('0x41')]=qs['filters'](_[_0xa5f1('0xb8')](_0x25b582[_0xa5f1('0x36')],_0x22bf43[_0xa5f1('0x37')]));_0x1bed09['where'][_0xa5f1('0xa8')]=_0x21f5ae['id'];if(_0x25b582[_0xa5f1('0x36')][_0xa5f1('0x7e')]){_0x1bed09[_0xa5f1('0x41')]=_['merge'](_0x1bed09[_0xa5f1('0x41')],{'$or':_[_0xa5f1('0x35')](_0x1bed09[_0xa5f1('0x39')],function(_0x17253b){var _0x57b1f7={};_0x57b1f7[_0x17253b]={'$like':'%'+_0x25b582['query'][_0xa5f1('0x7e')]+'%'};return _0x57b1f7;})});}if(_0x25b582['query'][_0xa5f1('0x74')]){var _0x55af98=_0x25b582[_0xa5f1('0x36')][_0xa5f1('0x74')][_0xa5f1('0x2d')](',');var _0x4c4ca0={};_0x4c4ca0[_0x55af98[0x0]]={'$gte':moment(_0x55af98[0x1])[_0xa5f1('0xb9')]('YYYY-MM-DD\x20HH:mm:ss')};_0x1bed09[_0xa5f1('0x41')]=_[_0xa5f1('0xaf')](_0x1bed09[_0xa5f1('0x41')],_0x4c4ca0);}_0x1bed09=_['merge']({},_0x1bed09,_0x25b582[_0xa5f1('0xba')]);return db[_0xa5f1('0xb3')]['count']({'where':_0x1bed09[_0xa5f1('0x41')]})['then'](function(_0x4f2bbd){_0x1a66ce[_0xa5f1('0x94')]=_0x4f2bbd;if(_0x25b582[_0xa5f1('0x36')][_0xa5f1('0xbb')]){_0x1bed09[_0xa5f1('0xae')]=[{'all':!![]}];}return db[_0xa5f1('0xb3')]['findAll'](_0x1bed09);})['then'](function(_0x9d134c){_0x1a66ce[_0xa5f1('0xab')]=_0x9d134c;return _0x1a66ce;});}})[_0xa5f1('0x24')](respondWithFilteredResult(_0x3fb76d,_0x1bed09))[_0xa5f1('0x2e')](handleError(_0x3fb76d,null));};exports[_0xa5f1('0xbc')]=function(_0x1ee749,_0x3bf757,_0x50921c){return db[_0xa5f1('0x30')][_0xa5f1('0x59')]({'where':{'id':_0x1ee749[_0xa5f1('0xad')]['id']}})[_0xa5f1('0x24')](handleEntityNotFound(_0x3bf757,null))[_0xa5f1('0x24')](function(_0x4bcae2){if(_0x4bcae2){return _0x4bcae2[_0xa5f1('0xbd')](_0x1ee749[_0xa5f1('0x6c')][_0xa5f1('0xb4')],_[_0xa5f1('0xb5')](_0x1ee749[_0xa5f1('0x6c')],[_0xa5f1('0xb4'),'id'])||{})['spread'](function(){return db[_0xa5f1('0xbe')][_0xa5f1('0xbf')]({'attributes':['id',_0xa5f1('0x43'),_0xa5f1('0xc0')],'where':{'id':_0x1ee749[_0xa5f1('0x6c')][_0xa5f1('0xb4')]}});})[_0xa5f1('0x24')](function(_0x535612){socket['emit'](_0xa5f1('0xc1'),{'id':Number(_0x1ee749[_0xa5f1('0xad')]['id']),'tags':_0x535612||[]});return{'id':Number(_0x1ee749['params']['id']),'tags':_0x535612||[]};});}})[_0xa5f1('0x24')](respondWithResult(_0x3bf757,null))[_0xa5f1('0x2e')](handleError(_0x3bf757,null));};exports[_0xa5f1('0xc2')]=function(_0x1e8dff,_0x5c6628,_0x1e0f5d){return db[_0xa5f1('0x30')][_0xa5f1('0x59')]({'where':{'id':_0x1e8dff[_0xa5f1('0xad')]['id']}})[_0xa5f1('0x24')](handleEntityNotFound(_0x5c6628,null))[_0xa5f1('0x24')](function(_0x594156){if(_0x594156){return _0x594156[_0xa5f1('0xc2')](_0x1e8dff[_0xa5f1('0x36')]['ids']);}})[_0xa5f1('0x24')](respondWithStatusCode(_0x5c6628,null))[_0xa5f1('0x2e')](handleError(_0x5c6628,null));};exports['download']=function(_0x8b6410,_0x3532e0){var _0x1a67d3=moment()[_0xa5f1('0xc3')]()[_0xa5f1('0x95')]();var _0x4799e5=path[_0xa5f1('0xc4')](config[_0xa5f1('0xc5')],'server',_0xa5f1('0xc6'),_0xa5f1('0xc7'));var _0x438d75=path[_0xa5f1('0xc4')](config['root'],'server',_0xa5f1('0xc6'),_0xa5f1('0xc8'));var _0x2dc4e2=path[_0xa5f1('0xc4')](_0x4799e5,_0x1a67d3);var _0x46a53b=util['format']('transcript-%d-%s.zip',_0x8b6410[_0xa5f1('0xad')]['id'],_0x1a67d3);var _0x5b701e=path['join'](_0x4799e5,_0x46a53b);var _0x5d9e21=[];_0x5d9e21[_0xa5f1('0xa9')]({'model':db['User'],'as':_0xa5f1('0x67'),'attributes':['id',_0xa5f1('0x2a')],'raw':!![]});_0x5d9e21[_0xa5f1('0xa9')]({'model':db[_0xa5f1('0xc9')],'as':_0xa5f1('0x5d'),'attributes':['id',_0xa5f1('0xca'),_0xa5f1('0xcb')],'raw':!![]});if(_0x8b6410[_0xa5f1('0x36')][_0xa5f1('0xc8')]){_0x5d9e21['push']({'model':db[_0xa5f1('0xcc')],'as':_0xa5f1('0xcc'),'raw':!![]});}var _0x282717=[{'model':db[_0xa5f1('0xb3')],'as':_0xa5f1('0xcd'),'attributes':['id',_0xa5f1('0x6c'),_0xa5f1('0x72'),_0xa5f1('0xce'),_0xa5f1('0xcf'),_0xa5f1('0x79')],'include':_0x5d9e21}];_0x282717[_0xa5f1('0xa9')]({'model':db[_0xa5f1('0xd0')],'as':_0xa5f1('0xd1'),'attributes':['id',_0xa5f1('0x43')]});_0x282717['push']({'model':db[_0xa5f1('0x67')],'as':_0xa5f1('0xd2'),'attributes':['id',_0xa5f1('0x2a')]});return db[_0xa5f1('0x30')][_0xa5f1('0x59')]({'where':{'id':_0x8b6410[_0xa5f1('0xad')]['id']},'include':_0x282717})[_0xa5f1('0x24')](handleEntityNotFound(_0x3532e0,null))[_0xa5f1('0x24')](function(_0x59cdf1){if(_0x59cdf1){var _0x30b45b=_0x59cdf1[_0xa5f1('0xd3')]({'plain':!![]});fs['mkdirSync'](_0x2dc4e2);var _0x22327b={'format':'A4','border':'10px','header':{'height':_0xa5f1('0xd4'),'contents':{'first':_0xa5f1('0xd5')}},'footer':{'height':_0xa5f1('0xd6'),'contents':{'default':util[_0xa5f1('0xb9')](_0xa5f1('0xd7'),util[_0xa5f1('0xb9')]('%s\x20#%d',_0xa5f1('0xd8'),_0x30b45b['id']),moment()[_0xa5f1('0xb9')](_0xa5f1('0xd9'))[_0xa5f1('0x95')]())}}};var _0x25105f={'channel':_0xa5f1('0xd8'),'account':_0x30b45b[_0xa5f1('0xd1')][_0xa5f1('0x43')],'agent':_0x30b45b['Owner']?_0x30b45b[_0xa5f1('0xd2')][_0xa5f1('0x2a')]:_0xa5f1('0xda'),'createdAt':moment(_0x30b45b[_0xa5f1('0x72')])[_0xa5f1('0xb9')](_0xa5f1('0xdb'))[_0xa5f1('0x95')](),'closedAt':_0x30b45b[_0xa5f1('0xdc')]?moment(_0x30b45b['closedAt'])[_0xa5f1('0xb9')](_0xa5f1('0xdb'))[_0xa5f1('0x95')]():'','disposition':_0x30b45b[_0xa5f1('0xdd')],'visibility':_0x30b45b[_0xa5f1('0xde')]?_0xa5f1('0xdf'):_0xa5f1('0xe0'),'messages':_(_0x30b45b[_0xa5f1('0xcd')])[_0xa5f1('0x7e')]({'secret':![]})[_0xa5f1('0x35')](function(_0x2293ce){if(_0x2293ce['Attachment']){var _0x5f11f6=path['join'](_0x438d75,_0x2293ce['Attachment'][_0xa5f1('0xe1')]);if(fs[_0xa5f1('0xe2')](_0x5f11f6)){fs['createReadStream'](_0x5f11f6)['pipe'](fs[_0xa5f1('0xe3')](path[_0xa5f1('0xc4')](_0x2dc4e2,_0x2293ce[_0xa5f1('0xcc')]['basename'])));}}return{'date':moment(_0x2293ce[_0xa5f1('0x72')])['format'](_0xa5f1('0xdb'))['toString'](),'sender':_0x2293ce[_0xa5f1('0xce')]==='out'?_0x2293ce[_0xa5f1('0x67')]?_0x2293ce['User'][_0xa5f1('0x2a')]:'System':_0x2293ce[_0xa5f1('0x5d')][_0xa5f1('0xca')]+(_0x2293ce[_0xa5f1('0x5d')][_0xa5f1('0xcb')]?'\x20'+_0x2293ce[_0xa5f1('0x5d')]['lastName']:''),'body':_0x2293ce[_0xa5f1('0xcc')]?_0x2293ce['Attachment']['basename']:_0x2293ce[_0xa5f1('0x6c')],'direction':_0x2293ce[_0xa5f1('0xce')]===_0xa5f1('0xe4')?'A':'C','secret':_0x2293ce[_0xa5f1('0xcf')],'read':_0x2293ce['read'],'attachment':_0x2293ce['Attachment']};})['value']()};return ejs[_0xa5f1('0xe5')](path[_0xa5f1('0xc4')](config[_0xa5f1('0xc5')],'server',_0xa5f1('0xe6'),_0xa5f1('0xe7')),{'interaction':_0x25105f})[_0xa5f1('0x24')](function(_0x5b300e){return new BPromise(function(_0x2ded71,_0x5173c2){pdf[_0xa5f1('0xb0')](_0x5b300e,_0x22327b)[_0xa5f1('0xe8')](path['join'](_0x2dc4e2,_0xa5f1('0xe9')+_0x30b45b['id']+'-'+_0x1a67d3+_0xa5f1('0xea')),function(_0x4314f0,_0x39e9cc){if(_0x4314f0)return _0x5173c2(_0x4314f0);_0x2ded71(_0x39e9cc);});});})[_0xa5f1('0x24')](function(){return new BPromise(function(_0x1bbdcc,_0x2ca2ed){zipdir(_0x2dc4e2,{'saveTo':_0x5b701e},function(_0x5d6ca0,_0x2739e6){if(_0x5d6ca0)return _0x2ca2ed(_0x5d6ca0);return _0x1bbdcc(_0x2739e6);});})['then'](function(){return new BPromise(function(_0x2dc801,_0x242680){rimraf(_0x2dc4e2,function(_0xccd6d7){if(_0xccd6d7)_0x242680(_0xccd6d7);return _0x2dc801();});});})[_0xa5f1('0x24')](function(){return _0x3532e0[_0xa5f1('0xeb')](_0x5b701e,_0x46a53b,function(_0x792d85){if(_0x792d85){console[_0xa5f1('0xec')](_0xa5f1('0xed'),_0x792d85);}else{fs[_0xa5f1('0xee')](_0x5b701e);}});});});}else{return _0x3532e0[_0xa5f1('0x1b')](0xc8);}})['catch'](handleError(_0x3532e0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 8280b8c..dc27a7f 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 _0xb558=['getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','hook','exports','events','../../mysqldb','OpenchannelMessage','save','update'];(function(_0x4be9c0,_0x2a218a){var _0x25cc16=function(_0x31aa5d){while(--_0x31aa5d){_0x4be9c0['push'](_0x4be9c0['shift']());}};_0x25cc16(++_0x2a218a);}(_0xb558,0x72));var _0x8b55=function(_0x3131ab,_0x2a9074){_0x3131ab=_0x3131ab-0x0;var _0x444965=_0xb558[_0x3131ab];return _0x444965;};'use strict';var EventEmitter=require(_0x8b55('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0x8b55('0x1'))['db'][_0x8b55('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8b55('0x3'),'afterUpdate':_0x8b55('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3d0d6a){return function(_0x3863d0,_0x566066,_0xac88fb){_0x3863d0[_0x8b55('0x5')]({'attributes':['id'],'raw':!![]})[_0x8b55('0x6')](function(_0x9b5c13){_0x3863d0[_0x8b55('0x7')](_0x8b55('0x8'),_0x9b5c13[_0x8b55('0x9')](function(_0x49f649){return{'id':_0x49f649['id']};}));return OpenchannelMessage[_0x8b55('0xa')]({'where':{'OpenchannelInteractionId':_0x3863d0['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8b55('0x6')](function(_0x4118db){_0x3863d0[_0x8b55('0x7')](_0x8b55('0xb'),_0x4118db[_0x8b55('0xc')]);OpenchannelInteractionEvents[_0x8b55('0xd')](_0x3d0d6a+':'+_0x3863d0['id'],_0x3863d0);OpenchannelInteractionEvents[_0x8b55('0xd')](_0x3d0d6a,_0x3863d0);_0xac88fb(null);})[_0x8b55('0xe')](_0xac88fb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0x8b55('0xf')](e,emitEvent(event));}}module[_0x8b55('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0x51af=['hook','exports','events','OpenchannelInteraction','OpenchannelMessage','save','update','remove','then','setDataValue','Users','findAll','unreadMessages','length','emit','catch','hasOwnProperty'];(function(_0x32a6f4,_0x5db2c4){var _0x3909e5=function(_0x1ac6f9){while(--_0x1ac6f9){_0x32a6f4['push'](_0x32a6f4['shift']());}};_0x3909e5(++_0x5db2c4);}(_0x51af,0x68));var _0xf51a=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x51af[_0x1589dd];return _0x1bddd1;};'use strict';var EventEmitter=require(_0xf51a('0x0'));var OpenchannelInteraction=require('../../mysqldb')['db'][_0xf51a('0x1')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xf51a('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf51a('0x3'),'afterUpdate':_0xf51a('0x4'),'afterDestroy':_0xf51a('0x5')};function emitEvent(_0x295038){return function(_0x5e9659,_0x56e44d,_0x5d94ca){_0x5e9659['getUsers']({'attributes':['id'],'raw':!![]})[_0xf51a('0x6')](function(_0x20f610){_0x5e9659[_0xf51a('0x7')](_0xf51a('0x8'),_0x20f610['map'](function(_0xdbb961){return{'id':_0xdbb961['id']};}));return OpenchannelMessage[_0xf51a('0x9')]({'where':{'OpenchannelInteractionId':_0x5e9659['id'],'direction':'in','read':![]},'raw':!![]});})[_0xf51a('0x6')](function(_0x4319b3){_0x5e9659['setDataValue'](_0xf51a('0xa'),_0x4319b3[_0xf51a('0xb')]);OpenchannelInteractionEvents[_0xf51a('0xc')](_0x295038+':'+_0x5e9659['id'],_0x5e9659);OpenchannelInteractionEvents[_0xf51a('0xc')](_0x295038,_0x5e9659);_0x5d94ca(null);})[_0xf51a('0xd')](_0x5d94ca(null));};}for(var e in events){if(events[_0xf51a('0xe')](e)){var event=events[e];OpenchannelInteraction[_0xf51a('0xf')](e,emitEvent(event));}}module[_0xf51a('0x10')]=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index c742e3e..e1e6d0f 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 _0x43fd=['format','YYYY-MM-DD\x20HH:mm:ss','util','moment','bluebird','path','../../config/environment','./openchannelInteraction.attributes','exports','define','OpenchannelInteraction','openchannel_interactions','changed','closedAt'];(function(_0x184b4f,_0x588652){var _0x54f911=function(_0x53c44a){while(--_0x53c44a){_0x184b4f['push'](_0x184b4f['shift']());}};_0x54f911(++_0x588652);}(_0x43fd,0x1ec));var _0xd43f=function(_0xfd09fe,_0x7f794b){_0xfd09fe=_0xfd09fe-0x0;var _0x4d3bcd=_0x43fd[_0xfd09fe];return _0x4d3bcd;};'use strict';var _=require('lodash');var util=require(_0xd43f('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xd43f('0x1'));var BPromise=require(_0xd43f('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd43f('0x3'));var rimraf=require('rimraf');var config=require(_0xd43f('0x4'));var attributes=require(_0xd43f('0x5'));module[_0xd43f('0x6')]=function(_0x33ddff,_0x52e75f){return _0x33ddff[_0xd43f('0x7')](_0xd43f('0x8'),attributes,{'tableName':_0xd43f('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x331163,_0x547e12,_0x19c71d){if(_0x331163[_0xd43f('0xa')]('closed')){_0x331163[_0xd43f('0xb')]=moment()[_0xd43f('0xc')](_0xd43f('0xd'));}_0x19c71d(null,_0x331163);}}});}; \ No newline at end of file +var _0xb46f=['OpenchannelInteraction','format','lodash','util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define'];(function(_0x1035c1,_0x2d8583){var _0x308d67=function(_0x58ddb6){while(--_0x58ddb6){_0x1035c1['push'](_0x1035c1['shift']());}};_0x308d67(++_0x2d8583);}(_0xb46f,0xb6));var _0xfb46=function(_0x1314bc,_0x2b71a5){_0x1314bc=_0x1314bc-0x0;var _0x1a3e9d=_0xb46f[_0x1314bc];return _0x1a3e9d;};'use strict';var _=require(_0xfb46('0x0'));var util=require(_0xfb46('0x1'));var logger=require('../../config/logger')(_0xfb46('0x2'));var moment=require(_0xfb46('0x3'));var BPromise=require(_0xfb46('0x4'));var rp=require(_0xfb46('0x5'));var fs=require('fs');var path=require(_0xfb46('0x6'));var rimraf=require('rimraf');var config=require(_0xfb46('0x7'));var attributes=require('./openchannelInteraction.attributes');module[_0xfb46('0x8')]=function(_0x3a5255,_0x186da6){return _0x3a5255[_0xfb46('0x9')](_0xfb46('0xa'),attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x9871f5,_0x298a84,_0x4b1a94){if(_0x9871f5['changed']('closed')){_0x9871f5['closedAt']=moment()[_0xfb46('0xb')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4b1a94(null,_0x9871f5);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 54c1d95..e7ddacf 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 _0xc6fa=['result','UpdateOpenchannelInteraction','update','body','options','where','attributes','limit','catch','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','error','code','OpenchannelInteraction,\x20%s,\x20%s','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6fa,0xbd));var _0xac6f=function(_0x3c59fc,_0x10dbd2){_0x3c59fc=_0x3c59fc-0x0;var _0x2b78d4=_0xc6fa[_0x3c59fc];return _0x2b78d4;};'use strict';var _=require(_0xac6f('0x0'));var util=require(_0xac6f('0x1'));var moment=require(_0xac6f('0x2'));var BPromise=require(_0xac6f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xac6f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xac6f('0x5'));var logger=require(_0xac6f('0x6'))(_0xac6f('0x7'));var config=require(_0xac6f('0x8'));var jayson=require(_0xac6f('0x9'));var client=jayson['client'][_0xac6f('0xa')]({'port':0x232a});config[_0xac6f('0xb')]=_[_0xac6f('0xc')](config[_0xac6f('0xb')],{'host':_0xac6f('0xd'),'port':0x18eb});var socket=require(_0xac6f('0xe'))(new Redis(config['redis']));require('./openchannelInteraction.socket')[_0xac6f('0xf')](socket);function respondWithRpcPromise(_0x135a28,_0x25d2bb,_0x28b398){return new BPromise(function(_0x2e49e3,_0x11fdf2){return client[_0xac6f('0x10')](_0x135a28,_0x28b398)[_0xac6f('0x11')](function(_0xa0e280){logger[_0xac6f('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25d2bb,_0xac6f('0x13'));logger[_0xac6f('0x14')](_0xac6f('0x15'),_0x25d2bb,_0xac6f('0x13'),JSON['stringify'](_0xa0e280));if(_0xa0e280['error']){if(_0xa0e280[_0xac6f('0x16')][_0xac6f('0x17')]===0x1f4){logger['error'](_0xac6f('0x18'),_0x25d2bb,_0xa0e280[_0xac6f('0x16')][_0xac6f('0x19')]);return _0x11fdf2(_0xa0e280[_0xac6f('0x16')][_0xac6f('0x19')]);}logger[_0xac6f('0x16')](_0xac6f('0x18'),_0x25d2bb,_0xa0e280['error']['message']);return _0x2e49e3(_0xa0e280['error'][_0xac6f('0x19')]);}else{logger[_0xac6f('0x12')]('OpenchannelInteraction,\x20%s,\x20%s',_0x25d2bb,_0xac6f('0x13'));_0x2e49e3(_0xa0e280[_0xac6f('0x1a')]['message']);}})['catch'](function(_0x50db90){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x25d2bb,_0x50db90);_0x11fdf2(_0x50db90);});});}exports[_0xac6f('0x1b')]=function(_0x856b3){var _0x1804fa=this;return new Promise(function(_0x391a80,_0xd8936b){return db['OpenchannelInteraction'][_0xac6f('0x1c')](_0x856b3[_0xac6f('0x1d')],{'raw':_0x856b3[_0xac6f('0x1e')]?_0x856b3['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x856b3['options']?_0x856b3[_0xac6f('0x1e')][_0xac6f('0x1f')]||null:null,'attributes':_0x856b3[_0xac6f('0x1e')]?_0x856b3[_0xac6f('0x1e')][_0xac6f('0x20')]||null:null,'limit':_0x856b3[_0xac6f('0x1e')]?_0x856b3[_0xac6f('0x1e')][_0xac6f('0x21')]||null:null})[_0xac6f('0x11')](function(_0x2437dc){logger[_0xac6f('0x12')](_0xac6f('0x1b'),_0x856b3);logger[_0xac6f('0x14')](_0xac6f('0x1b'),_0x856b3,JSON['stringify'](_0x2437dc));_0x391a80(_0x2437dc);})[_0xac6f('0x22')](function(_0x4bbdf8){logger[_0xac6f('0x16')](_0xac6f('0x1b'),_0x4bbdf8[_0xac6f('0x19')],_0x856b3);_0xd8936b(_0x1804fa[_0xac6f('0x16')](0x1f4,_0x4bbdf8['message']));});});};exports[_0xac6f('0x23')]=function(_0x7870bd){return new Promise(function(_0x464260,_0x59477d){return db[_0xac6f('0x24')][_0xac6f('0x25')]({'where':_0x7870bd[_0xac6f('0x1e')]?_0x7870bd[_0xac6f('0x1e')][_0xac6f('0x1f')]||null:null})[_0xac6f('0x11')](function(_0x50c4c0){if(_0x50c4c0){return _0x50c4c0[_0xac6f('0x26')](_0x7870bd['body'][_0xac6f('0x27')],_[_0xac6f('0x28')](_0x7870bd[_0xac6f('0x1d')],[_0xac6f('0x27'),'id'])||{});}})[_0xac6f('0x29')](function(_0x128a3c){logger[_0xac6f('0x12')](_0xac6f('0x2a'),_0x7870bd);logger[_0xac6f('0x14')](_0xac6f('0x2a'),_0x7870bd,JSON['stringify'](_0x128a3c));_0x464260(_0x128a3c);})[_0xac6f('0x22')](function(_0x3eea45){logger[_0xac6f('0x16')](_0xac6f('0x2a'),_0x3eea45['message'],_0x7870bd);_0x59477d(_this[_0xac6f('0x16')](0x1f4,_0x3eea45[_0xac6f('0x19')]));});});}; \ No newline at end of file +var _0x0199=['../../config/environment','client','http','redis','defaults','socket.io-emitter','./openchannelInteraction.socket','register','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','UpdateOpenchannelInteraction','update','body','options','raw','where','attributes','AddTagsToOpenchannelInteraction','OpenchannelInteraction','find','addTags','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x13b28a,_0x4d3f80){var _0x28b767=function(_0x1f3022){while(--_0x1f3022){_0x13b28a['push'](_0x13b28a['shift']());}};_0x28b767(++_0x4d3f80);}(_0x0199,0x140));var _0x9019=function(_0x516b3a,_0x5fbbeb){_0x516b3a=_0x516b3a-0x0;var _0x567c68=_0x0199[_0x516b3a];return _0x567c68;};'use strict';var _=require(_0x9019('0x0'));var util=require(_0x9019('0x1'));var moment=require(_0x9019('0x2'));var BPromise=require(_0x9019('0x3'));var rs=require(_0x9019('0x4'));var fs=require('fs');var Redis=require(_0x9019('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x9019('0x6'));var logger=require(_0x9019('0x7'))('rpc');var config=require(_0x9019('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9019('0x9')][_0x9019('0xa')]({'port':0x232a});config[_0x9019('0xb')]=_[_0x9019('0xc')](config[_0x9019('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x9019('0xd'))(new Redis(config[_0x9019('0xb')]));require(_0x9019('0xe'))[_0x9019('0xf')](socket);function respondWithRpcPromise(_0x28d769,_0x2b9f45,_0x334699){return new BPromise(function(_0x1442b9,_0x5d16cb){return client['request'](_0x28d769,_0x334699)[_0x9019('0x10')](function(_0x17da6b){logger[_0x9019('0x11')](_0x9019('0x12'),_0x2b9f45,'request\x20sent');logger[_0x9019('0x13')](_0x9019('0x14'),_0x2b9f45,_0x9019('0x15'),JSON['stringify'](_0x17da6b));if(_0x17da6b[_0x9019('0x16')]){if(_0x17da6b[_0x9019('0x16')]['code']===0x1f4){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x2b9f45,_0x17da6b[_0x9019('0x16')][_0x9019('0x17')]);return _0x5d16cb(_0x17da6b[_0x9019('0x16')][_0x9019('0x17')]);}logger[_0x9019('0x16')](_0x9019('0x12'),_0x2b9f45,_0x17da6b[_0x9019('0x16')][_0x9019('0x17')]);return _0x1442b9(_0x17da6b[_0x9019('0x16')][_0x9019('0x17')]);}else{logger[_0x9019('0x11')](_0x9019('0x12'),_0x2b9f45,'request\x20sent');_0x1442b9(_0x17da6b[_0x9019('0x18')][_0x9019('0x17')]);}})[_0x9019('0x19')](function(_0x32d058){logger[_0x9019('0x16')](_0x9019('0x12'),_0x2b9f45,_0x32d058);_0x5d16cb(_0x32d058);});});}exports[_0x9019('0x1a')]=function(_0x43d920){var _0x42b267=this;return new Promise(function(_0x23b103,_0x3e5a00){return db['OpenchannelInteraction'][_0x9019('0x1b')](_0x43d920[_0x9019('0x1c')],{'raw':_0x43d920[_0x9019('0x1d')]?_0x43d920[_0x9019('0x1d')][_0x9019('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x43d920['options']?_0x43d920[_0x9019('0x1d')][_0x9019('0x1f')]||null:null,'attributes':_0x43d920['options']?_0x43d920[_0x9019('0x1d')][_0x9019('0x20')]||null:null,'limit':_0x43d920[_0x9019('0x1d')]?_0x43d920[_0x9019('0x1d')]['limit']||null:null})['then'](function(_0x2ad508){logger[_0x9019('0x11')]('UpdateOpenchannelInteraction',_0x43d920);logger[_0x9019('0x13')](_0x9019('0x1a'),_0x43d920,JSON['stringify'](_0x2ad508));_0x23b103(_0x2ad508);})['catch'](function(_0x4b0583){logger[_0x9019('0x16')](_0x9019('0x1a'),_0x4b0583[_0x9019('0x17')],_0x43d920);_0x3e5a00(_0x42b267[_0x9019('0x16')](0x1f4,_0x4b0583['message']));});});};exports[_0x9019('0x21')]=function(_0x5d4e3f){return new Promise(function(_0x4ca83a,_0x4d4ff4){return db[_0x9019('0x22')][_0x9019('0x23')]({'where':_0x5d4e3f['options']?_0x5d4e3f[_0x9019('0x1d')]['where']||null:null})['then'](function(_0x35af4e){if(_0x35af4e){return _0x35af4e[_0x9019('0x24')](_0x5d4e3f[_0x9019('0x1c')][_0x9019('0x25')],_[_0x9019('0x26')](_0x5d4e3f[_0x9019('0x1c')],[_0x9019('0x25'),'id'])||{});}})[_0x9019('0x27')](function(_0x379195){logger['info']('AddTags',_0x5d4e3f);logger[_0x9019('0x13')](_0x9019('0x28'),_0x5d4e3f,JSON['stringify'](_0x379195));_0x4ca83a(_0x379195);})[_0x9019('0x19')](function(_0x10c2ad){logger['error'](_0x9019('0x28'),_0x10c2ad['message'],_0x5d4e3f);_0x4d4ff4(_this[_0x9019('0x16')](0x1f4,_0x10c2ad[_0x9019('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 30b12a2..6c75f56 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 _0x27d7=['./openchannelInteraction.events','save','remove','update','removeListener','register'];(function(_0x5062c4,_0x8936b0){var _0x5cd252=function(_0x56a4ed){while(--_0x56a4ed){_0x5062c4['push'](_0x5062c4['shift']());}};_0x5cd252(++_0x8936b0);}(_0x27d7,0x66));var _0x727d=function(_0x515be2,_0x51b3ff){_0x515be2=_0x515be2-0x0;var _0x514679=_0x27d7[_0x515be2];return _0x514679;};'use strict';var OpenchannelInteractionEvents=require(_0x727d('0x0'));var events=[_0x727d('0x1'),_0x727d('0x2'),_0x727d('0x3')];function createListener(_0x25d240,_0x5b1fef){return function(_0x2812d8){_0x5b1fef['emit'](_0x25d240,_0x2812d8);};}function removeListener(_0x130a8f,_0x371957){return function(){OpenchannelInteractionEvents[_0x727d('0x4')](_0x130a8f,_0x371957);};}exports[_0x727d('0x5')]=function(_0x1c7465){for(var _0x197f2e=0x0,_0x54ab16=events['length'];_0x197f2e<_0x54ab16;_0x197f2e++){var _0x571e88=events[_0x197f2e];var _0x2a4dd0=createListener('openchannelInteraction:'+_0x571e88,_0x1c7465);OpenchannelInteractionEvents['on'](_0x571e88,_0x2a4dd0);}}; \ No newline at end of file +var _0x8c13=['update','removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove'];(function(_0x2a1584,_0x542881){var _0x4e22b3=function(_0x1298e0){while(--_0x1298e0){_0x2a1584['push'](_0x2a1584['shift']());}};_0x4e22b3(++_0x542881);}(_0x8c13,0x9e));var _0x38c1=function(_0x55db93,_0xae2f22){_0x55db93=_0x55db93-0x0;var _0x22530c=_0x8c13[_0x55db93];return _0x22530c;};'use strict';var OpenchannelInteractionEvents=require(_0x38c1('0x0'));var events=[_0x38c1('0x1'),_0x38c1('0x2'),_0x38c1('0x3')];function createListener(_0x392b25,_0x4732fe){return function(_0x31714f){_0x4732fe['emit'](_0x392b25,_0x31714f);};}function removeListener(_0x43d9e5,_0x33f8be){return function(){OpenchannelInteractionEvents[_0x38c1('0x4')](_0x43d9e5,_0x33f8be);};}exports['register']=function(_0x5d8236){for(var _0x4959ee=0x0,_0x4849f1=events[_0x38c1('0x5')];_0x4959ee<_0x4849f1;_0x4959ee++){var _0x34d51c=events[_0x4959ee];var _0x4e71c4=createListener(_0x38c1('0x6')+_0x34d51c,_0x5d8236);OpenchannelInteractionEvents['on'](_0x34d51c,_0x4e71c4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 30d5aa7..a055161 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 _0x7b9f=['/:id/accept','accept','reject','destroy','exports','multer','util','path','express','../../components/auth/service','../../config/environment','./openchannelMessage.controller','isAuthenticated','index','get','/describe','/:id','show','post','openchannel','openchannelmessage:create','put','update'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7b9f,0xa6));var _0xf7b9=function(_0x49c0c5,_0x66ba84){_0x49c0c5=_0x49c0c5-0x0;var _0x1ccf12=_0x7b9f[_0x49c0c5];return _0x1ccf12;};'use strict';var multer=require(_0xf7b9('0x0'));var util=require(_0xf7b9('0x1'));var path=require(_0xf7b9('0x2'));var timeout=require('connect-timeout');var express=require(_0xf7b9('0x3'));var router=express['Router']();var auth=require(_0xf7b9('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xf7b9('0x5'));var controller=require(_0xf7b9('0x6'));router['get']('/',auth[_0xf7b9('0x7')](),controller[_0xf7b9('0x8')]);router[_0xf7b9('0x9')](_0xf7b9('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xf7b9('0x9')](_0xf7b9('0xb'),auth['isAuthenticated'](),controller[_0xf7b9('0xc')]);router[_0xf7b9('0xd')]('/',auth[_0xf7b9('0x7')](),interaction['tracked'](_0xf7b9('0xe'),_0xf7b9('0xf')),controller['create']);router[_0xf7b9('0x10')](_0xf7b9('0xb'),auth[_0xf7b9('0x7')](),controller[_0xf7b9('0x11')]);router[_0xf7b9('0x10')](_0xf7b9('0x12'),auth[_0xf7b9('0x7')](),controller[_0xf7b9('0x13')]);router['put']('/:id/reject',auth[_0xf7b9('0x7')](),controller[_0xf7b9('0x14')]);router['delete']('/:id',auth[_0xf7b9('0x7')](),controller[_0xf7b9('0x15')]);module[_0xf7b9('0x16')]=router; \ No newline at end of file +var _0x9b54=['/:id/reject','reject','destroy','exports','util','path','Router','../../components/auth/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','/:id','show','post','tracked','openchannelmessage:create','put','update','accept'];(function(_0x954b3a,_0x10a7c1){var _0x3a313e=function(_0x1070ad){while(--_0x1070ad){_0x954b3a['push'](_0x954b3a['shift']());}};_0x3a313e(++_0x10a7c1);}(_0x9b54,0x88));var _0x49b5=function(_0x4536a6,_0x5ae218){_0x4536a6=_0x4536a6-0x0;var _0x479c5f=_0x9b54[_0x4536a6];return _0x479c5f;};'use strict';var multer=require('multer');var util=require(_0x49b5('0x0'));var path=require(_0x49b5('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x49b5('0x2')]();var auth=require(_0x49b5('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x49b5('0x4'));var controller=require(_0x49b5('0x5'));router[_0x49b5('0x6')]('/',auth[_0x49b5('0x7')](),controller[_0x49b5('0x8')]);router['get'](_0x49b5('0x9'),auth[_0x49b5('0x7')](),controller['describe']);router[_0x49b5('0x6')](_0x49b5('0xa'),auth[_0x49b5('0x7')](),controller[_0x49b5('0xb')]);router[_0x49b5('0xc')]('/',auth[_0x49b5('0x7')](),interaction[_0x49b5('0xd')]('openchannel',_0x49b5('0xe')),controller['create']);router[_0x49b5('0xf')](_0x49b5('0xa'),auth[_0x49b5('0x7')](),controller[_0x49b5('0x10')]);router[_0x49b5('0xf')]('/:id/accept',auth[_0x49b5('0x7')](),controller[_0x49b5('0x11')]);router[_0x49b5('0xf')](_0x49b5('0x12'),auth['isAuthenticated'](),controller[_0x49b5('0x13')]);router['delete']('/:id',auth[_0x49b5('0x7')](),controller[_0x49b5('0x14')]);module[_0x49b5('0x15')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 710f409..191b340 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 _0x9201=['DATE','sequelize','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x11b58d,_0x555c55){var _0xc2811b=function(_0x396d22){while(--_0x396d22){_0x11b58d['push'](_0x11b58d['shift']());}};_0xc2811b(++_0x555c55);}(_0x9201,0x14a));var _0x1920=function(_0x2afdff,_0x37a9c2){_0x2afdff=_0x2afdff-0x0;var _0x4680f2=_0x9201[_0x2afdff];return _0x4680f2;};'use strict';var Sequelize=require(_0x1920('0x0'));module['exports']={'body':{'type':Sequelize[_0x1920('0x1')](_0x1920('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1920('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x1920('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x1920('0x4')]('in',_0x1920('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x1920('0x6')]}}; \ No newline at end of file +var _0x24be=['DATE','TEXT','BOOLEAN','ENUM','out'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x24be,0x10a));var _0xe24b=function(_0x26a225,_0x1d61f5){_0x26a225=_0x26a225-0x0;var _0x1cb4eb=_0x24be[_0x26a225];return _0x1cb4eb;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xe24b('0x0')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe24b('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xe24b('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe24b('0x2')]('in',_0xe24b('0x3')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xe24b('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index f40eed5..ec9ae41 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 _0x0ec2=['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','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','client','http','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','status','end','json','offset','save','update','then','destroy','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','filters','pick','VIRTUAL','merge','options','count','includeAll','include','rows','show','params','find','create','body','describe','openchannel-interactions','openchannel','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','get','OpenchannelInteraction','OpenchannelInteractionId','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','stringify','null','acceptMessage','manual','channel','event','accept','EventManager','acceptmessage','reject','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','interface','SIP/%s','rejectmessage','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash'];(function(_0x4289bb,_0x4eeedb){var _0x5a1ce4=function(_0x1f48a2){while(--_0x1f48a2){_0x4289bb['push'](_0x4289bb['shift']());}};_0x5a1ce4(++_0x4eeedb);}(_0x0ec2,0x6f));var _0x20ec=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0x0ec2[_0x14e9f0];return _0xa63f7e;};'use strict';var pdf=require(_0x20ec('0x0'));var emlformat=require(_0x20ec('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x20ec('0x2'));var rp=require('request-promise');var moment=require(_0x20ec('0x3'));var BPromise=require(_0x20ec('0x4'));var Mustache=require(_0x20ec('0x5'));var util=require(_0x20ec('0x6'));var path=require(_0x20ec('0x7'));var sox=require(_0x20ec('0x8'));var csv=require(_0x20ec('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x20ec('0xa'));var squel=require('squel');var crypto=require(_0x20ec('0xb'));var jsforce=require(_0x20ec('0xc'));var deskjs=require(_0x20ec('0xd'));var toCsv=require(_0x20ec('0x9'));var querystring=require(_0x20ec('0xe'));var Papa=require('papaparse');var Redis=require(_0x20ec('0xf'));var authService=require(_0x20ec('0x10'));var qs=require(_0x20ec('0x11'));var as=require(_0x20ec('0x12'));var hardwareService=require(_0x20ec('0x13'));var logger=require(_0x20ec('0x14'))(_0x20ec('0x15'));var utils=require(_0x20ec('0x16'));var config=require(_0x20ec('0x17'));var db=require(_0x20ec('0x18'))['db'];config['redis']=_[_0x20ec('0x19')](config[_0x20ec('0x1a')],{'host':_0x20ec('0x1b'),'port':0x18eb});var socket=require(_0x20ec('0x1c'))(new Redis(config[_0x20ec('0x1a')]));require(_0x20ec('0x1d'))[_0x20ec('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0x20ec('0x1f')][_0x20ec('0x20')]({'port':0x232c});var client9002=jayson['client'][_0x20ec('0x20')]({'port':0x232a});function checkPasswordPattern(_0x45d407,_0x5ca004,_0x5a2b20){if(_0x5a2b20){var _0x438559=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x438559[_0x20ec('0x21')](_0x5ca004)){return _0x45d407;}else{throw new db[(_0x20ec('0x22'))]['ValidationError'](_0x20ec('0x23'));}}else{return _0x45d407;}}function respondWithRpcPromise(_0x340a93,_0x10a063,_0x4ee0d3,_0x4811df){return new BPromise(function(_0x2233bd,_0x19b033){var _0x69cd7=_0x4811df||client;return _0x69cd7[_0x20ec('0x24')](_0x340a93,_0x4ee0d3)['then'](function(_0x318033){logger[_0x20ec('0x25')]('OpenchannelMessage,\x20%s,\x20%s',_0x10a063,'request\x20sent');logger[_0x20ec('0x26')](_0x20ec('0x27'),_0x10a063,_0x20ec('0x28'),JSON['stringify'](_0x318033));if(_0x318033[_0x20ec('0x29')]){if(_0x318033[_0x20ec('0x29')][_0x20ec('0x2a')]===0x1f4){logger[_0x20ec('0x29')](_0x20ec('0x2b'),_0x10a063,_0x318033[_0x20ec('0x29')]['message']);return _0x19b033(_0x318033[_0x20ec('0x29')][_0x20ec('0x2c')]);}logger[_0x20ec('0x29')](_0x20ec('0x2b'),_0x10a063,_0x318033[_0x20ec('0x29')]['message']);return _0x2233bd(_0x318033[_0x20ec('0x29')][_0x20ec('0x2c')]);}else{logger['info'](_0x20ec('0x2b'),_0x10a063,_0x20ec('0x28'));_0x2233bd(_0x318033[_0x20ec('0x2d')][_0x20ec('0x2c')]);}})[_0x20ec('0x2e')](function(_0x371772){logger[_0x20ec('0x29')](_0x20ec('0x2b'),_0x10a063,_0x371772);_0x19b033(_0x371772);});});}function respondWithStatusCode(_0x3020f9,_0x53f942){_0x53f942=_0x53f942||0xcc;return function(_0x40d40c){if(_0x40d40c){return _0x3020f9['sendStatus'](_0x53f942);}return _0x3020f9[_0x20ec('0x2f')](_0x53f942)[_0x20ec('0x30')]();};}function respondWithResult(_0x5074db,_0x5d96fb){_0x5d96fb=_0x5d96fb||0xc8;return function(_0x3213c4){if(_0x3213c4){return _0x5074db[_0x20ec('0x2f')](_0x5d96fb)[_0x20ec('0x31')](_0x3213c4);}};}function respondWithFilteredResult(_0x4154aa,_0x42072f){return function(_0x4acc39){if(_0x4acc39){var _0x2d076a=_0x4acc39['count'],_0x1cc967=_0x42072f[_0x20ec('0x32')],_0x4ed766=_0x42072f[_0x20ec('0x32')]+_0x42072f['limit'],_0x37c9e2;if(_0x4ed766>=_0x2d076a){_0x4ed766=_0x2d076a;_0x37c9e2=0xc8;}else{_0x37c9e2=0xce;}_0x4154aa[_0x20ec('0x2f')](_0x37c9e2);return _0x4154aa['set']('Content-Range',_0x1cc967+'-'+_0x4ed766+'/'+_0x2d076a)['json'](_0x4acc39);}return null;};}function patchUpdates(_0x155a9a){return function(_0x26eda7){try{jsonpatch['apply'](_0x26eda7,_0x155a9a,!![]);}catch(_0x2f6509){return BPromise['reject'](_0x2f6509);}return _0x26eda7[_0x20ec('0x33')]();};}function saveUpdates(_0xba3095,_0x5ea5f4){return function(_0x7c9510){if(_0x7c9510){return _0x7c9510[_0x20ec('0x34')](_0xba3095)[_0x20ec('0x35')](function(_0x266efc){return _0x266efc;});}return null;};}function removeEntity(_0x61d660,_0x387e9c){return function(_0x1a3a16){if(_0x1a3a16){return _0x1a3a16[_0x20ec('0x36')]()['then'](function(){_0x61d660[_0x20ec('0x2f')](0xcc)[_0x20ec('0x30')]();});}};}function handleEntityNotFound(_0x1ba10d,_0xb052d1){return function(_0x4e8fc7){if(!_0x4e8fc7){_0x1ba10d[_0x20ec('0x37')](0x194);}return _0x4e8fc7;};}function handleError(_0x21fa0f,_0x5d2a78){_0x5d2a78=_0x5d2a78||0x1f4;return function(_0x8642c0){logger[_0x20ec('0x29')](_0x8642c0[_0x20ec('0x38')]);if(_0x8642c0[_0x20ec('0x39')]){delete _0x8642c0[_0x20ec('0x39')];}_0x21fa0f['status'](_0x5d2a78)[_0x20ec('0x3a')](_0x8642c0);};}exports['index']=function(_0x3df483,_0x2fd0bb){var _0x1b29eb={},_0xe75f51={},_0x1c8009={'count':0x0,'rows':[]};var _0x7524d=_[_0x20ec('0x3b')](db[_0x20ec('0x3c')][_0x20ec('0x3d')],function(_0x302c80){return{'name':_0x302c80[_0x20ec('0x3e')],'type':_0x302c80[_0x20ec('0x3f')][_0x20ec('0x40')]};});_0xe75f51[_0x20ec('0x41')]=_[_0x20ec('0x3b')](_0x7524d,'name');_0xe75f51['query']=_[_0x20ec('0x42')](_0x3df483[_0x20ec('0x43')]);_0xe75f51['filters']=_[_0x20ec('0x44')](_0xe75f51['model'],_0xe75f51[_0x20ec('0x43')]);_0x1b29eb['attributes']=_['intersection'](_0xe75f51[_0x20ec('0x41')],qs[_0x20ec('0x45')](_0x3df483[_0x20ec('0x43')][_0x20ec('0x45')]));_0x1b29eb['attributes']=_0x1b29eb[_0x20ec('0x46')][_0x20ec('0x47')]?_0x1b29eb[_0x20ec('0x46')]:_0xe75f51[_0x20ec('0x41')];if(!_0x3df483['query'][_0x20ec('0x48')](_0x20ec('0x49'))){_0x1b29eb[_0x20ec('0x4a')]=qs['limit'](_0x3df483['query']['limit']);_0x1b29eb['offset']=qs['offset'](_0x3df483[_0x20ec('0x43')]['offset']);}_0x1b29eb[_0x20ec('0x4b')]=qs['sort'](_0x3df483[_0x20ec('0x43')][_0x20ec('0x4c')]);_0x1b29eb[_0x20ec('0x4d')]=qs[_0x20ec('0x4e')](_[_0x20ec('0x4f')](_0x3df483[_0x20ec('0x43')],_0xe75f51['filters']));if(_0x3df483[_0x20ec('0x43')]['filter']){_0x1b29eb[_0x20ec('0x4d')]=_['merge'](_0x1b29eb[_0x20ec('0x4d')],{'$or':_[_0x20ec('0x3b')](_0x7524d,function(_0x2a7b24){if(_0x2a7b24[_0x20ec('0x3f')]!==_0x20ec('0x50')){var _0x50a8af={};_0x50a8af[_0x2a7b24[_0x20ec('0x39')]]={'$like':'%'+_0x3df483[_0x20ec('0x43')]['filter']+'%'};return _0x50a8af;}})});}_0x1b29eb=_[_0x20ec('0x51')]({},_0x1b29eb,_0x3df483[_0x20ec('0x52')]);var _0x13b56f={'where':_0x1b29eb['where']};return db[_0x20ec('0x3c')][_0x20ec('0x53')](_0x13b56f)['then'](function(_0x46dbee){_0x1c8009['count']=_0x46dbee;if(_0x3df483[_0x20ec('0x43')][_0x20ec('0x54')]){_0x1b29eb[_0x20ec('0x55')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x1b29eb);})[_0x20ec('0x35')](function(_0x433978){_0x1c8009[_0x20ec('0x56')]=_0x433978;return _0x1c8009;})[_0x20ec('0x35')](respondWithFilteredResult(_0x2fd0bb,_0x1b29eb))[_0x20ec('0x2e')](handleError(_0x2fd0bb,null));};exports[_0x20ec('0x57')]=function(_0x3f3930,_0x433741){var _0x50b469={'raw':!![],'where':{'id':_0x3f3930[_0x20ec('0x58')]['id']}},_0x37a91f={};_0x37a91f[_0x20ec('0x41')]=_[_0x20ec('0x42')](db[_0x20ec('0x3c')][_0x20ec('0x3d')]);_0x37a91f[_0x20ec('0x43')]=_[_0x20ec('0x42')](_0x3f3930[_0x20ec('0x43')]);_0x37a91f[_0x20ec('0x4e')]=_[_0x20ec('0x44')](_0x37a91f['model'],_0x37a91f[_0x20ec('0x43')]);_0x50b469[_0x20ec('0x46')]=_['intersection'](_0x37a91f[_0x20ec('0x41')],qs[_0x20ec('0x45')](_0x3f3930['query'][_0x20ec('0x45')]));_0x50b469[_0x20ec('0x46')]=_0x50b469[_0x20ec('0x46')]['length']?_0x50b469['attributes']:_0x37a91f[_0x20ec('0x41')];if(_0x3f3930[_0x20ec('0x43')]['includeAll']){_0x50b469[_0x20ec('0x55')]=[{'all':!![]}];}_0x50b469=_['merge']({},_0x50b469,_0x3f3930[_0x20ec('0x52')]);return db[_0x20ec('0x3c')][_0x20ec('0x59')](_0x50b469)[_0x20ec('0x35')](handleEntityNotFound(_0x433741,null))['then'](respondWithResult(_0x433741,null))[_0x20ec('0x2e')](handleError(_0x433741,null));};exports['create']=function(_0x10a8cc,_0x125484){return db[_0x20ec('0x3c')][_0x20ec('0x5a')](_0x10a8cc[_0x20ec('0x5b')],{})[_0x20ec('0x35')](respondWithResult(_0x125484,0xc9))[_0x20ec('0x2e')](handleError(_0x125484,null));};exports[_0x20ec('0x34')]=function(_0x183586,_0x770303){if(_0x183586[_0x20ec('0x5b')]['id']){delete _0x183586[_0x20ec('0x5b')]['id'];}return db[_0x20ec('0x3c')]['find']({'where':{'id':_0x183586['params']['id']}})[_0x20ec('0x35')](handleEntityNotFound(_0x770303,null))[_0x20ec('0x35')](saveUpdates(_0x183586['body'],null))[_0x20ec('0x35')](respondWithResult(_0x770303,null))['catch'](handleError(_0x770303,null));};exports[_0x20ec('0x36')]=function(_0x4ea447,_0x3e1f8b){return db[_0x20ec('0x3c')]['find']({'where':{'id':_0x4ea447[_0x20ec('0x58')]['id']}})[_0x20ec('0x35')](handleEntityNotFound(_0x3e1f8b,null))[_0x20ec('0x35')](removeEntity(_0x3e1f8b,null))[_0x20ec('0x2e')](handleError(_0x3e1f8b,null));};exports[_0x20ec('0x5c')]=function(_0x3e8827,_0x739acf){return db[_0x20ec('0x3c')][_0x20ec('0x5c')]()[_0x20ec('0x35')](respondWithResult(_0x739acf,null))['catch'](handleError(_0x739acf,null));};var interaction_log=require(_0x20ec('0x14'))(_0x20ec('0x5d'));exports['accept']=function(_0x15b706,_0x1eff84,_0x230e55){var _0x476c4c={'channel':_0x20ec('0x5e')};if(_0x15b706[_0x20ec('0x5b')]['id']){delete _0x15b706['body']['id'];}_0x15b706[_0x20ec('0x5b')]['read']=!![];_0x15b706[_0x20ec('0x5b')][_0x20ec('0x5f')]=moment()[_0x20ec('0x60')](_0x20ec('0x61'));_0x15b706[_0x20ec('0x5b')][_0x20ec('0x62')]=_0x15b706[_0x20ec('0x5b')][_0x20ec('0x62')]||_0x15b706[_0x20ec('0x63')]['id'];return db[_0x20ec('0x3c')][_0x20ec('0x59')]({'where':{'id':_0x15b706[_0x20ec('0x58')]['id'],'UserId':null},'include':[{'model':db[_0x20ec('0x64')],'as':'Contact'}]})['then'](handleEntityNotFound(_0x1eff84,null))[_0x20ec('0x35')](saveUpdates(_0x15b706['body'],null))[_0x20ec('0x35')](function(_0x1a13a4){if(_0x1a13a4){_0x476c4c[_0x20ec('0x2c')]=_0x1a13a4[_0x20ec('0x65')]({'plain':!![]});return db[_0x20ec('0x66')]['find']({'where':{'id':_0x1a13a4[_0x20ec('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x1eff84,null))['then'](function(_0x3c4b70){if(_0x3c4b70){return _0x3c4b70['update']({'UserId':_0x15b706[_0x20ec('0x5b')][_0x20ec('0x62')],'read1stAt':_['isNil'](_0x3c4b70['read1stAt'])?moment()[_0x20ec('0x60')](_0x20ec('0x61')):undefined});}return null;})[_0x20ec('0x35')](function(_0x465e36){if(_0x465e36){_0x476c4c['interaction']=_0x465e36[_0x20ec('0x65')]({'plain':!![]});interaction_log['info'](_0x20ec('0x68'),_0x15b706[_0x20ec('0x63')]['id'],_0x15b706[_0x20ec('0x63')][_0x20ec('0x39')],_0x15b706[_0x20ec('0x63')][_0x20ec('0x69')],_0x476c4c[_0x20ec('0x6a')]['id'],_0x15b706[_0x20ec('0x5b')]?JSON[_0x20ec('0x6b')](_0x15b706[_0x20ec('0x5b')]):_0x20ec('0x6c'));return respondWithRpcPromise('AcceptMessage',_0x20ec('0x6d'),_0x476c4c);}return null;})[_0x20ec('0x35')](function(_0xee100c){if(_0xee100c){if(_0x15b706[_0x20ec('0x5b')][_0x20ec('0x6e')]){_0x476c4c[_0x20ec('0x2c')]['interface']=util['format']('SIP/%s',_0x15b706[_0x20ec('0x63')][_0x20ec('0x39')]);_0x476c4c[_0x20ec('0x2c')][_0x20ec('0x6f')]=_0x476c4c[_0x20ec('0x6f')];_0x476c4c[_0x20ec('0x2c')][_0x20ec('0x70')]=_0x20ec('0x71');return respondWithRpcPromise(_0x20ec('0x72'),'EventManager',{'event':_0x20ec('0x73'),'message':_0x476c4c[_0x20ec('0x2c')]},client9002)[_0x20ec('0x35')](function(){return _0x476c4c;});}return _0x476c4c;}return null;})[_0x20ec('0x35')](respondWithResult(_0x1eff84,null))['catch'](handleError(_0x1eff84,null));};var interaction_log=require('../../config/logger')(_0x20ec('0x5d'));exports[_0x20ec('0x74')]=function(_0x16c3c8,_0x538dfd,_0x488a9a){var _0x2c971b={'agent':{},'channel':_0x20ec('0x5e')};if(_0x16c3c8[_0x20ec('0x5b')]['id']){delete _0x16c3c8[_0x20ec('0x5b')]['id'];}_0x16c3c8['body'][_0x20ec('0x62')]=_0x16c3c8[_0x20ec('0x5b')][_0x20ec('0x62')]||_0x16c3c8[_0x20ec('0x63')]['id'];_0x2c971b['agent']['id']=_0x16c3c8[_0x20ec('0x5b')]['UserId'];return db[_0x20ec('0x3c')]['find']({'where':{'id':_0x16c3c8[_0x20ec('0x58')]['id'],'UserId':null}})[_0x20ec('0x35')](handleEntityNotFound(_0x538dfd,null))['then'](function(_0x1f015e){if(_0x1f015e){_0x2c971b[_0x20ec('0x2c')]=_0x1f015e['get']({'plain':!![]});return db[_0x20ec('0x66')][_0x20ec('0x59')]({'where':{'id':_0x1f015e[_0x20ec('0x67')]}});}return null;})[_0x20ec('0x35')](handleEntityNotFound(_0x538dfd,null))[_0x20ec('0x35')](function(_0x1ad693){if(_0x1ad693){_0x2c971b['interaction']=_0x1ad693[_0x20ec('0x65')]({'plain':!![]});interaction_log[_0x20ec('0x25')](_0x20ec('0x75'),_0x16c3c8[_0x20ec('0x63')]['id'],_0x16c3c8['user'][_0x20ec('0x39')],_0x16c3c8[_0x20ec('0x63')][_0x20ec('0x69')],_0x2c971b[_0x20ec('0x6a')]['id'],_0x16c3c8[_0x20ec('0x5b')]?JSON[_0x20ec('0x6b')](_0x16c3c8[_0x20ec('0x5b')]):_0x20ec('0x6c'));return respondWithRpcPromise(_0x20ec('0x76'),'rejectMessage',_0x2c971b);}return null;})[_0x20ec('0x35')](function(_0x458a59){if(_0x458a59){_0x458a59[_0x20ec('0x2c')][_0x20ec('0x77')]=util['format'](_0x20ec('0x78'),_0x16c3c8[_0x20ec('0x63')]['name']);_0x458a59[_0x20ec('0x2c')][_0x20ec('0x6f')]=_0x2c971b[_0x20ec('0x6f')];_0x458a59[_0x20ec('0x2c')][_0x20ec('0x70')]=_0x20ec('0x74');respondWithRpcPromise(_0x20ec('0x72'),'EventManager',{'event':_0x20ec('0x79'),'message':_0x458a59[_0x20ec('0x2c')]},client9002);return _0x2c971b;}return null;})['then'](respondWithResult(_0x538dfd,null))[_0x20ec('0x2e')](handleError(_0x538dfd,null));}; \ No newline at end of file +var _0x27f1=['agent','OpenchannelInteractionId','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','SIP/%s','rejectmessage','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','OpenchannelMessage,\x20%s,\x20%s','error','code','message','request\x20sent','result','catch','sendStatus','status','end','json','offset','limit','set','apply','reject','save','update','destroy','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','count','findAll','rows','show','params','includeAll','include','find','create','body','describe','openchannel','read','readAt','format','UserId','user','CmContact','get','isNil','YYYY-MM-DD\x20HH:mm:ss','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','manual','interface','channel','event','accept','EventManager','acceptmessage'];(function(_0x4b92b9,_0x1bd47d){var _0x157b9d=function(_0x41d8e4){while(--_0x41d8e4){_0x4b92b9['push'](_0x4b92b9['shift']());}};_0x157b9d(++_0x1bd47d);}(_0x27f1,0x7f));var _0x127f=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x27f1[_0x2b4411];return _0x8e41ef;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x127f('0x0'));var jsonpatch=require(_0x127f('0x1'));var rp=require(_0x127f('0x2'));var moment=require(_0x127f('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x127f('0x4'));var path=require(_0x127f('0x5'));var sox=require(_0x127f('0x6'));var csv=require(_0x127f('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x127f('0x8'));var crypto=require(_0x127f('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x127f('0xa'));var toCsv=require(_0x127f('0x7'));var querystring=require(_0x127f('0xb'));var Papa=require(_0x127f('0xc'));var Redis=require(_0x127f('0xd'));var authService=require(_0x127f('0xe'));var qs=require(_0x127f('0xf'));var as=require(_0x127f('0x10'));var hardwareService=require(_0x127f('0x11'));var logger=require(_0x127f('0x12'))(_0x127f('0x13'));var utils=require(_0x127f('0x14'));var config=require(_0x127f('0x15'));var db=require(_0x127f('0x16'))['db'];config[_0x127f('0x17')]=_[_0x127f('0x18')](config[_0x127f('0x17')],{'host':_0x127f('0x19'),'port':0x18eb});var socket=require(_0x127f('0x1a'))(new Redis(config['redis']));require(_0x127f('0x1b'))[_0x127f('0x1c')](socket);var jayson=require(_0x127f('0x1d'));var client=jayson[_0x127f('0x1e')][_0x127f('0x1f')]({'port':0x232c});var client9002=jayson[_0x127f('0x1e')]['http']({'port':0x232a});function checkPasswordPattern(_0x1f7f09,_0x347899,_0x3a0046){if(_0x3a0046){var _0xe65aad=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0xe65aad[_0x127f('0x20')](_0x347899)){return _0x1f7f09;}else{throw new db[(_0x127f('0x21'))][(_0x127f('0x22'))](_0x127f('0x23'));}}else{return _0x1f7f09;}}function respondWithRpcPromise(_0x7b24df,_0x3f13c2,_0x282bc2,_0x26380e){return new BPromise(function(_0x33d9c7,_0x343c01){var _0x31bc07=_0x26380e||client;return _0x31bc07['request'](_0x7b24df,_0x282bc2)[_0x127f('0x24')](function(_0x5f0c9f){logger[_0x127f('0x25')](_0x127f('0x26'),_0x3f13c2,'request\x20sent');logger['debug']('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3f13c2,'request\x20sent',JSON['stringify'](_0x5f0c9f));if(_0x5f0c9f['error']){if(_0x5f0c9f[_0x127f('0x27')][_0x127f('0x28')]===0x1f4){logger[_0x127f('0x27')](_0x127f('0x26'),_0x3f13c2,_0x5f0c9f[_0x127f('0x27')][_0x127f('0x29')]);return _0x343c01(_0x5f0c9f[_0x127f('0x27')][_0x127f('0x29')]);}logger[_0x127f('0x27')](_0x127f('0x26'),_0x3f13c2,_0x5f0c9f['error']['message']);return _0x33d9c7(_0x5f0c9f[_0x127f('0x27')]['message']);}else{logger[_0x127f('0x25')](_0x127f('0x26'),_0x3f13c2,_0x127f('0x2a'));_0x33d9c7(_0x5f0c9f[_0x127f('0x2b')][_0x127f('0x29')]);}})[_0x127f('0x2c')](function(_0x24e5b6){logger[_0x127f('0x27')](_0x127f('0x26'),_0x3f13c2,_0x24e5b6);_0x343c01(_0x24e5b6);});});}function respondWithStatusCode(_0x34c021,_0x91fbd2){_0x91fbd2=_0x91fbd2||0xcc;return function(_0x541a32){if(_0x541a32){return _0x34c021[_0x127f('0x2d')](_0x91fbd2);}return _0x34c021[_0x127f('0x2e')](_0x91fbd2)[_0x127f('0x2f')]();};}function respondWithResult(_0xa6c31a,_0x5d6849){_0x5d6849=_0x5d6849||0xc8;return function(_0x419f40){if(_0x419f40){return _0xa6c31a[_0x127f('0x2e')](_0x5d6849)[_0x127f('0x30')](_0x419f40);}};}function respondWithFilteredResult(_0x56d91f,_0x4b00a2){return function(_0x12db1c){if(_0x12db1c){var _0x3120be=_0x12db1c['count'],_0x1e5b32=_0x4b00a2['offset'],_0x2eb52d=_0x4b00a2[_0x127f('0x31')]+_0x4b00a2[_0x127f('0x32')],_0x50ca9b;if(_0x2eb52d>=_0x3120be){_0x2eb52d=_0x3120be;_0x50ca9b=0xc8;}else{_0x50ca9b=0xce;}_0x56d91f[_0x127f('0x2e')](_0x50ca9b);return _0x56d91f[_0x127f('0x33')]('Content-Range',_0x1e5b32+'-'+_0x2eb52d+'/'+_0x3120be)[_0x127f('0x30')](_0x12db1c);}return null;};}function patchUpdates(_0x540e79){return function(_0x13274f){try{jsonpatch[_0x127f('0x34')](_0x13274f,_0x540e79,!![]);}catch(_0x31f317){return BPromise[_0x127f('0x35')](_0x31f317);}return _0x13274f[_0x127f('0x36')]();};}function saveUpdates(_0x1fd5ac,_0x170a91){return function(_0x565fa1){if(_0x565fa1){return _0x565fa1[_0x127f('0x37')](_0x1fd5ac)['then'](function(_0x187a02){return _0x187a02;});}return null;};}function removeEntity(_0xc4cc7f,_0x4df0bb){return function(_0x80e083){if(_0x80e083){return _0x80e083[_0x127f('0x38')]()['then'](function(){_0xc4cc7f['status'](0xcc)[_0x127f('0x2f')]();});}};}function handleEntityNotFound(_0xa5f94,_0x3bf2b3){return function(_0x20ac50){if(!_0x20ac50){_0xa5f94[_0x127f('0x2d')](0x194);}return _0x20ac50;};}function handleError(_0x129544,_0x4c09ad){_0x4c09ad=_0x4c09ad||0x1f4;return function(_0x2f0ad){logger[_0x127f('0x27')](_0x2f0ad['stack']);if(_0x2f0ad[_0x127f('0x39')]){delete _0x2f0ad[_0x127f('0x39')];}_0x129544[_0x127f('0x2e')](_0x4c09ad)[_0x127f('0x3a')](_0x2f0ad);};}exports[_0x127f('0x3b')]=function(_0x4fc547,_0x5b03e5){var _0x16a76c={},_0x47faaf={},_0x5457f5={'count':0x0,'rows':[]};var _0x151ace=_[_0x127f('0x3c')](db[_0x127f('0x3d')][_0x127f('0x3e')],function(_0x47f9b8){return{'name':_0x47f9b8[_0x127f('0x3f')],'type':_0x47f9b8[_0x127f('0x40')]['key']};});_0x47faaf[_0x127f('0x41')]=_[_0x127f('0x3c')](_0x151ace,_0x127f('0x39'));_0x47faaf[_0x127f('0x42')]=_[_0x127f('0x43')](_0x4fc547['query']);_0x47faaf[_0x127f('0x44')]=_[_0x127f('0x45')](_0x47faaf[_0x127f('0x41')],_0x47faaf[_0x127f('0x42')]);_0x16a76c['attributes']=_[_0x127f('0x45')](_0x47faaf[_0x127f('0x41')],qs[_0x127f('0x46')](_0x4fc547[_0x127f('0x42')][_0x127f('0x46')]));_0x16a76c[_0x127f('0x47')]=_0x16a76c[_0x127f('0x47')][_0x127f('0x48')]?_0x16a76c[_0x127f('0x47')]:_0x47faaf[_0x127f('0x41')];if(!_0x4fc547[_0x127f('0x42')][_0x127f('0x49')](_0x127f('0x4a'))){_0x16a76c[_0x127f('0x32')]=qs[_0x127f('0x32')](_0x4fc547[_0x127f('0x42')][_0x127f('0x32')]);_0x16a76c[_0x127f('0x31')]=qs[_0x127f('0x31')](_0x4fc547[_0x127f('0x42')][_0x127f('0x31')]);}_0x16a76c['order']=qs[_0x127f('0x4b')](_0x4fc547[_0x127f('0x42')]['sort']);_0x16a76c[_0x127f('0x4c')]=qs[_0x127f('0x44')](_['pick'](_0x4fc547[_0x127f('0x42')],_0x47faaf['filters']));if(_0x4fc547[_0x127f('0x42')][_0x127f('0x4d')]){_0x16a76c['where']=_['merge'](_0x16a76c['where'],{'$or':_['map'](_0x151ace,function(_0x4df8d8){if(_0x4df8d8[_0x127f('0x40')]!==_0x127f('0x4e')){var _0x2db7b9={};_0x2db7b9[_0x4df8d8[_0x127f('0x39')]]={'$like':'%'+_0x4fc547[_0x127f('0x42')][_0x127f('0x4d')]+'%'};return _0x2db7b9;}})});}_0x16a76c=_[_0x127f('0x4f')]({},_0x16a76c,_0x4fc547[_0x127f('0x50')]);var _0x4a7109={'where':_0x16a76c[_0x127f('0x4c')]};return db['OpenchannelMessage'][_0x127f('0x51')](_0x4a7109)[_0x127f('0x24')](function(_0x5b86e8){_0x5457f5[_0x127f('0x51')]=_0x5b86e8;if(_0x4fc547[_0x127f('0x42')]['includeAll']){_0x16a76c['include']=[{'all':!![]}];}return db[_0x127f('0x3d')][_0x127f('0x52')](_0x16a76c);})[_0x127f('0x24')](function(_0x358c20){_0x5457f5[_0x127f('0x53')]=_0x358c20;return _0x5457f5;})['then'](respondWithFilteredResult(_0x5b03e5,_0x16a76c))[_0x127f('0x2c')](handleError(_0x5b03e5,null));};exports[_0x127f('0x54')]=function(_0x234cdc,_0x1b6770){var _0x17cfec={'raw':!![],'where':{'id':_0x234cdc[_0x127f('0x55')]['id']}},_0x32dd71={};_0x32dd71['model']=_[_0x127f('0x43')](db[_0x127f('0x3d')][_0x127f('0x3e')]);_0x32dd71[_0x127f('0x42')]=_[_0x127f('0x43')](_0x234cdc['query']);_0x32dd71['filters']=_[_0x127f('0x45')](_0x32dd71['model'],_0x32dd71[_0x127f('0x42')]);_0x17cfec[_0x127f('0x47')]=_[_0x127f('0x45')](_0x32dd71[_0x127f('0x41')],qs['fields'](_0x234cdc[_0x127f('0x42')][_0x127f('0x46')]));_0x17cfec['attributes']=_0x17cfec['attributes'][_0x127f('0x48')]?_0x17cfec['attributes']:_0x32dd71[_0x127f('0x41')];if(_0x234cdc[_0x127f('0x42')][_0x127f('0x56')]){_0x17cfec[_0x127f('0x57')]=[{'all':!![]}];}_0x17cfec=_[_0x127f('0x4f')]({},_0x17cfec,_0x234cdc[_0x127f('0x50')]);return db[_0x127f('0x3d')][_0x127f('0x58')](_0x17cfec)[_0x127f('0x24')](handleEntityNotFound(_0x1b6770,null))['then'](respondWithResult(_0x1b6770,null))[_0x127f('0x2c')](handleError(_0x1b6770,null));};exports[_0x127f('0x59')]=function(_0x4f3bb4,_0x3a3ec9){return db['OpenchannelMessage']['create'](_0x4f3bb4['body'],{})[_0x127f('0x24')](respondWithResult(_0x3a3ec9,0xc9))[_0x127f('0x2c')](handleError(_0x3a3ec9,null));};exports[_0x127f('0x37')]=function(_0x261151,_0x43d696){if(_0x261151[_0x127f('0x5a')]['id']){delete _0x261151[_0x127f('0x5a')]['id'];}return db[_0x127f('0x3d')][_0x127f('0x58')]({'where':{'id':_0x261151[_0x127f('0x55')]['id']}})['then'](handleEntityNotFound(_0x43d696,null))[_0x127f('0x24')](saveUpdates(_0x261151[_0x127f('0x5a')],null))[_0x127f('0x24')](respondWithResult(_0x43d696,null))[_0x127f('0x2c')](handleError(_0x43d696,null));};exports[_0x127f('0x38')]=function(_0x13c1a4,_0x4e0d2e){return db['OpenchannelMessage'][_0x127f('0x58')]({'where':{'id':_0x13c1a4['params']['id']}})['then'](handleEntityNotFound(_0x4e0d2e,null))[_0x127f('0x24')](removeEntity(_0x4e0d2e,null))[_0x127f('0x2c')](handleError(_0x4e0d2e,null));};exports['describe']=function(_0x5bf9e2,_0x53ed32){return db['OpenchannelMessage'][_0x127f('0x5b')]()['then'](respondWithResult(_0x53ed32,null))['catch'](handleError(_0x53ed32,null));};var interaction_log=require(_0x127f('0x12'))('openchannel-interactions');exports['accept']=function(_0x295e40,_0x2fa24e,_0x431b24){var _0x56e3a3={'channel':_0x127f('0x5c')};if(_0x295e40['body']['id']){delete _0x295e40[_0x127f('0x5a')]['id'];}_0x295e40['body'][_0x127f('0x5d')]=!![];_0x295e40[_0x127f('0x5a')][_0x127f('0x5e')]=moment()[_0x127f('0x5f')]('YYYY-MM-DD\x20HH:mm:ss');_0x295e40[_0x127f('0x5a')]['UserId']=_0x295e40[_0x127f('0x5a')][_0x127f('0x60')]||_0x295e40[_0x127f('0x61')]['id'];return db[_0x127f('0x3d')][_0x127f('0x58')]({'where':{'id':_0x295e40[_0x127f('0x55')]['id'],'UserId':null},'include':[{'model':db[_0x127f('0x62')],'as':'Contact'}]})[_0x127f('0x24')](handleEntityNotFound(_0x2fa24e,null))[_0x127f('0x24')](saveUpdates(_0x295e40['body'],null))[_0x127f('0x24')](function(_0x4f627b){if(_0x4f627b){_0x56e3a3['message']=_0x4f627b[_0x127f('0x63')]({'plain':!![]});return db['OpenchannelInteraction'][_0x127f('0x58')]({'where':{'id':_0x4f627b['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x2fa24e,null))['then'](function(_0x486bbd){if(_0x486bbd){return _0x486bbd[_0x127f('0x37')]({'UserId':_0x295e40[_0x127f('0x5a')][_0x127f('0x60')],'read1stAt':_[_0x127f('0x64')](_0x486bbd['read1stAt'])?moment()[_0x127f('0x5f')](_0x127f('0x65')):undefined});}return null;})[_0x127f('0x24')](function(_0x26010f){if(_0x26010f){_0x56e3a3[_0x127f('0x66')]=_0x26010f[_0x127f('0x63')]({'plain':!![]});interaction_log['info'](_0x127f('0x67'),_0x295e40['user']['id'],_0x295e40[_0x127f('0x61')][_0x127f('0x39')],_0x295e40[_0x127f('0x61')]['role'],_0x56e3a3[_0x127f('0x66')]['id'],_0x295e40[_0x127f('0x5a')]?JSON[_0x127f('0x68')](_0x295e40[_0x127f('0x5a')]):_0x127f('0x69'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x56e3a3);}return null;})['then'](function(_0x446399){if(_0x446399){if(_0x295e40['body'][_0x127f('0x6a')]){_0x56e3a3['message'][_0x127f('0x6b')]=util[_0x127f('0x5f')]('SIP/%s',_0x295e40[_0x127f('0x61')][_0x127f('0x39')]);_0x56e3a3['message'][_0x127f('0x6c')]=_0x56e3a3[_0x127f('0x6c')];_0x56e3a3[_0x127f('0x29')][_0x127f('0x6d')]=_0x127f('0x6e');return respondWithRpcPromise('EventManager',_0x127f('0x6f'),{'event':_0x127f('0x70'),'message':_0x56e3a3[_0x127f('0x29')]},client9002)[_0x127f('0x24')](function(){return _0x56e3a3;});}return _0x56e3a3;}return null;})['then'](respondWithResult(_0x2fa24e,null))[_0x127f('0x2c')](handleError(_0x2fa24e,null));};var interaction_log=require(_0x127f('0x12'))('openchannel-interactions');exports['reject']=function(_0x4dec0b,_0x42a524,_0x27c547){var _0xbdd4ab={'agent':{},'channel':_0x127f('0x5c')};if(_0x4dec0b['body']['id']){delete _0x4dec0b['body']['id'];}_0x4dec0b[_0x127f('0x5a')][_0x127f('0x60')]=_0x4dec0b[_0x127f('0x5a')][_0x127f('0x60')]||_0x4dec0b['user']['id'];_0xbdd4ab[_0x127f('0x71')]['id']=_0x4dec0b[_0x127f('0x5a')][_0x127f('0x60')];return db['OpenchannelMessage']['find']({'where':{'id':_0x4dec0b[_0x127f('0x55')]['id'],'UserId':null}})[_0x127f('0x24')](handleEntityNotFound(_0x42a524,null))[_0x127f('0x24')](function(_0x3c3053){if(_0x3c3053){_0xbdd4ab['message']=_0x3c3053['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x127f('0x58')]({'where':{'id':_0x3c3053[_0x127f('0x72')]}});}return null;})['then'](handleEntityNotFound(_0x42a524,null))[_0x127f('0x24')](function(_0x2807f4){if(_0x2807f4){_0xbdd4ab[_0x127f('0x66')]=_0x2807f4[_0x127f('0x63')]({'plain':!![]});interaction_log[_0x127f('0x25')](_0x127f('0x73'),_0x4dec0b[_0x127f('0x61')]['id'],_0x4dec0b[_0x127f('0x61')][_0x127f('0x39')],_0x4dec0b['user'][_0x127f('0x74')],_0xbdd4ab[_0x127f('0x66')]['id'],_0x4dec0b[_0x127f('0x5a')]?JSON[_0x127f('0x68')](_0x4dec0b[_0x127f('0x5a')]):_0x127f('0x69'));return respondWithRpcPromise(_0x127f('0x75'),'rejectMessage',_0xbdd4ab);}return null;})['then'](function(_0x272d0f){if(_0x272d0f){_0x272d0f['message']['interface']=util[_0x127f('0x5f')](_0x127f('0x76'),_0x4dec0b[_0x127f('0x61')]['name']);_0x272d0f[_0x127f('0x29')]['channel']=_0xbdd4ab[_0x127f('0x6c')];_0x272d0f[_0x127f('0x29')][_0x127f('0x6d')]='reject';respondWithRpcPromise(_0x127f('0x6f'),_0x127f('0x6f'),{'event':_0x127f('0x77'),'message':_0x272d0f[_0x127f('0x29')]},client9002);return _0xbdd4ab;}return null;})['then'](respondWithResult(_0x42a524,null))['catch'](handleError(_0x42a524,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 8d1d101..6ca68fb 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 _0x95ca=['exports','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0x1017a7,_0x377c79){var _0x4e505e=function(_0x186b93){while(--_0x186b93){_0x1017a7['push'](_0x1017a7['shift']());}};_0x4e505e(++_0x377c79);}(_0x95ca,0xc9));var _0xa95c=function(_0x4aae35,_0x2d5af3){_0x4aae35=_0x4aae35-0x0;var _0x2340fe=_0x95ca[_0x4aae35];return _0x2340fe;};'use strict';var EventEmitter=require(_0xa95c('0x0'));var OpenchannelMessage=require(_0xa95c('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xa95c('0x2')](0x0);var events={'afterCreate':_0xa95c('0x3'),'afterUpdate':_0xa95c('0x4'),'afterDestroy':_0xa95c('0x5')};function emitEvent(_0x2990b3){return function(_0x5d56fe,_0x12c797,_0x4b81df){OpenchannelMessageEvents['emit'](_0x2990b3+':'+_0x5d56fe['id'],_0x5d56fe);OpenchannelMessageEvents[_0xa95c('0x6')](_0x2990b3,_0x5d56fe);_0x4b81df(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage['hook'](e,emitEvent(event));}}module[_0xa95c('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0035=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelMessage','setMaxListeners','update'];(function(_0x1477ef,_0x54a5d6){var _0x164acd=function(_0x139149){while(--_0x139149){_0x1477ef['push'](_0x1477ef['shift']());}};_0x164acd(++_0x54a5d6);}(_0x0035,0x176));var _0x5003=function(_0x39551a,_0x116007){_0x39551a=_0x39551a-0x0;var _0x4b0b62=_0x0035[_0x39551a];return _0x4b0b62;};'use strict';var EventEmitter=require(_0x5003('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0x5003('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x5003('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5003('0x3'),'afterDestroy':_0x5003('0x4')};function emitEvent(_0x7e9b03){return function(_0x17b88c,_0x38db5a,_0x314eb5){OpenchannelMessageEvents['emit'](_0x7e9b03+':'+_0x17b88c['id'],_0x17b88c);OpenchannelMessageEvents[_0x5003('0x5')](_0x7e9b03,_0x17b88c);_0x314eb5(null);};}for(var e in events){if(events[_0x5003('0x6')](e)){var event=events[e];OpenchannelMessage[_0x5003('0x7')](e,emitEvent(event));}}module[_0x5003('0x8')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 4d0acd0..9bc20f8 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 _0xf62e=['finally','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','createdAt','CmContact','OpenchannelAccount','find','OpenchannelAccountId','Contact','keys','replyUri','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','Interactions','length','Interaction','omit','POST','method','GET','info','Message\x20%d\x20forwarded\x20to\x20%s','threadId','error','inspect'];(function(_0x54bf67,_0x5381e5){var _0x5f18a9=function(_0x5fea82){while(--_0x5fea82){_0x54bf67['push'](_0x54bf67['shift']());}};_0x5f18a9(++_0x5381e5);}(_0xf62e,0xd7));var _0xef62=function(_0x2e7c66,_0x243cfd){_0x2e7c66=_0x2e7c66-0x0;var _0x4b254d=_0xf62e[_0x2e7c66];return _0x4b254d;};'use strict';var _=require(_0xef62('0x0'));var util=require('util');var logger=require(_0xef62('0x1'))(_0xef62('0x2'));var moment=require('moment');var BPromise=require(_0xef62('0x3'));var rp=require(_0xef62('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xef62('0x5'));var config=require(_0xef62('0x6'));var attributes=require(_0xef62('0x7'));module[_0xef62('0x8')]=function(_0x1a23e0,_0x1119d4){return _0x1a23e0['define'](_0xef62('0x9'),attributes,{'tableName':_0xef62('0xa'),'paranoid':![],'indexes':[{'name':_0xef62('0xb'),'fields':[_0xef62('0xc')],'type':_0xef62('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x678de3,_0xc216d6,_0x3ca7ab){var _0x189477=_0x1a23e0[_0xef62('0xe')];var _0x3bf484=_0x678de3[_0xef62('0xf')]({'plain':!![]});if(_0x3bf484[_0xef62('0x10')][_0xef62('0x11')]()==='in'||_0x3bf484[_0xef62('0x10')][_0xef62('0x11')]()===_0xef62('0x12')&&!_0x3bf484['secret']&&!_[_0xef62('0x13')](_0x3bf484[_0xef62('0x14')])){_0x189477[_0xef62('0x15')][_0xef62('0x16')]({'where':{'id':_0x3bf484[_0xef62('0x17')]}})[_0xef62('0x18')](function(_0xdc7bd4){if(_0xdc7bd4){_0xdc7bd4[_0xef62('0x19')]({'lastMsgAt':_0x3bf484[_0xef62('0x1a')],'lastMsgDirection':_0x3bf484[_0xef62('0x10')]['toLowerCase']()});}})['catch'](function(_0x1a38e7){console['error'](_0x1a38e7);});}if(_0x3bf484[_0xef62('0x10')]===_0xef62('0x12')&&!_0x3bf484['secret']){var _0x46b259;_0x189477[_0xef62('0x1b')]['describe']()['then'](function(_0xeb5ce6){return _0x189477[_0xef62('0x1c')][_0xef62('0x1d')]({'where':{'id':_0x3bf484[_0xef62('0x1e')]},'include':[{'model':_0x189477[_0xef62('0x15')],'as':'Interactions','where':{'id':_0x3bf484['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x189477[_0xef62('0x1b')],'as':_0xef62('0x1f'),'attributes':_[_0xef62('0x20')](_0xeb5ce6)}]}]});})[_0xef62('0x18')](function(_0x2fcc0a){_0x46b259=_0x2fcc0a[_0xef62('0xf')]({'plain':!![]});if(_0x46b259&&_0x46b259[_0xef62('0x21')]){logger['info'](_0xef62('0x22'),_0xef62('0x23'),util[_0xef62('0x24')](_0xef62('0x25'),_0x3bf484['id'],_0x46b259[_0xef62('0x21')]));if(_0x46b259[_0xef62('0x26')]&&_0x46b259[_0xef62('0x26')][_0xef62('0x27')]){_0x3bf484[_0xef62('0x28')]=_[_0xef62('0x29')](_0x46b259['Interactions'][0x0],_0xef62('0x1f'));_0x3bf484[_0xef62('0x1f')]=_0x46b259[_0xef62('0x26')][0x0][_0xef62('0x1f')];}var _0xc216d6={'method':_0xef62('0x2a'),'uri':encodeURI(_0x46b259['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0xc216d6[_0xef62('0x2b')]){case _0xef62('0x2c'):_0xc216d6['qs']=_0x3bf484;break;case'POST':_0xc216d6[_0xef62('0xc')]=_0x3bf484;break;}return rp(_0xc216d6)['then'](function(_0x75c092){logger[_0xef62('0x2d')](_0xef62('0x22'),_0xef62('0x23'),util[_0xef62('0x24')](_0xef62('0x2e'),_0x3bf484['id'],_0x46b259['replyUri']));if(_0x75c092[_0xef62('0xc')][_0xef62('0x2f')]&&_0x75c092['body'][_0xef62('0x2f')]!=_0x3bf484['Interaction'][_0xef62('0x2f')]){return _0x189477['OpenchannelInteraction'][_0xef62('0x19')]({'threadId':_0x75c092['body']['threadId']},{'logging':!![],'where':{'id':_0x3bf484['Interaction']['id']}});}else{return;}})['then'](function(){return _0x678de3[_0xef62('0x19')]({'read':!![]});})['catch'](function(_0x3b4e73){logger[_0xef62('0x30')](_0xef62('0x22'),_0xef62('0x23'),util[_0xef62('0x31')](_0x3b4e73,{'showHidden':![],'depth':null}));_0x3ca7ab();});}else{_0x3ca7ab();}})[_0xef62('0x32')](function(){_0x3ca7ab();});}else{_0x3ca7ab();}}},'charset':_0xef62('0x33'),'collate':_0xef62('0x34')});}; \ No newline at end of file +var _0x9691=['error','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','OpenchannelInteractionId','Contact','keys','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','POST','method','GET','Message\x20%d\x20forwarded\x20to\x20%s','threadId','Interaction','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./openchannelMessage.attributes','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','get','toLowerCase','direction','out','secret','UserId','OpenchannelInteraction','then','update','createdAt','catch'];(function(_0x2d714c,_0x33176f){var _0x4a8bd0=function(_0x16ef70){while(--_0x16ef70){_0x2d714c['push'](_0x2d714c['shift']());}};_0x4a8bd0(++_0x33176f);}(_0x9691,0x1e5));var _0x1969=function(_0x23373f,_0x5414f0){_0x23373f=_0x23373f-0x0;var _0x684e08=_0x9691[_0x23373f];return _0x684e08;};'use strict';var _=require('lodash');var util=require(_0x1969('0x0'));var logger=require(_0x1969('0x1'))(_0x1969('0x2'));var moment=require(_0x1969('0x3'));var BPromise=require('bluebird');var rp=require(_0x1969('0x4'));var fs=require('fs');var path=require(_0x1969('0x5'));var rimraf=require('rimraf');var config=require(_0x1969('0x6'));var attributes=require(_0x1969('0x7'));module['exports']=function(_0x1d89b7,_0x45ba26){return _0x1d89b7[_0x1969('0x8')](_0x1969('0x9'),attributes,{'tableName':_0x1969('0xa'),'paranoid':![],'indexes':[{'name':_0x1969('0xb'),'fields':[_0x1969('0xc')],'type':_0x1969('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e858d,_0x517816,_0x3a88dc){var _0x2156f3=_0x1d89b7['models'];var _0xf05c2a=_0x3e858d[_0x1969('0xe')]({'plain':!![]});if(_0xf05c2a['direction'][_0x1969('0xf')]()==='in'||_0xf05c2a[_0x1969('0x10')][_0x1969('0xf')]()===_0x1969('0x11')&&!_0xf05c2a[_0x1969('0x12')]&&!_['isNil'](_0xf05c2a[_0x1969('0x13')])){_0x2156f3[_0x1969('0x14')]['findOne']({'where':{'id':_0xf05c2a['OpenchannelInteractionId']}})[_0x1969('0x15')](function(_0x550d38){if(_0x550d38){_0x550d38[_0x1969('0x16')]({'lastMsgAt':_0xf05c2a[_0x1969('0x17')],'lastMsgDirection':_0xf05c2a[_0x1969('0x10')][_0x1969('0xf')]()});}})[_0x1969('0x18')](function(_0x458fda){console[_0x1969('0x19')](_0x458fda);});}if(_0xf05c2a['direction']===_0x1969('0x11')&&!_0xf05c2a[_0x1969('0x12')]){var _0x5360d6;_0x2156f3[_0x1969('0x1a')][_0x1969('0x1b')]()[_0x1969('0x15')](function(_0xadc0d7){return _0x2156f3[_0x1969('0x1c')][_0x1969('0x1d')]({'where':{'id':_0xf05c2a[_0x1969('0x1e')]},'include':[{'model':_0x2156f3[_0x1969('0x14')],'as':_0x1969('0x1f'),'where':{'id':_0xf05c2a[_0x1969('0x20')]},'limit':0x1,'include':[{'model':_0x2156f3[_0x1969('0x1a')],'as':_0x1969('0x21'),'attributes':_[_0x1969('0x22')](_0xadc0d7)}]}]});})[_0x1969('0x15')](function(_0x5767bb){_0x5360d6=_0x5767bb['get']({'plain':!![]});if(_0x5360d6&&_0x5360d6['replyUri']){logger[_0x1969('0x23')](_0x1969('0x24'),_0x1969('0x25'),util[_0x1969('0x26')](_0x1969('0x27'),_0xf05c2a['id'],_0x5360d6[_0x1969('0x28')]));if(_0x5360d6[_0x1969('0x1f')]&&_0x5360d6[_0x1969('0x1f')][_0x1969('0x29')]){_0xf05c2a['Interaction']=_['omit'](_0x5360d6['Interactions'][0x0],'Contact');_0xf05c2a[_0x1969('0x21')]=_0x5360d6[_0x1969('0x1f')][0x0][_0x1969('0x21')];}var _0x517816={'method':_0x1969('0x2a'),'uri':encodeURI(_0x5360d6[_0x1969('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x517816[_0x1969('0x2b')]){case _0x1969('0x2c'):_0x517816['qs']=_0xf05c2a;break;case _0x1969('0x2a'):_0x517816[_0x1969('0xc')]=_0xf05c2a;break;}return rp(_0x517816)[_0x1969('0x15')](function(_0x15741b){logger[_0x1969('0x23')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x1969('0x26')](_0x1969('0x2d'),_0xf05c2a['id'],_0x5360d6['replyUri']));if(_0x15741b[_0x1969('0xc')][_0x1969('0x2e')]&&_0x15741b[_0x1969('0xc')]['threadId']!=_0xf05c2a[_0x1969('0x2f')][_0x1969('0x2e')]){return _0x2156f3[_0x1969('0x14')][_0x1969('0x16')]({'threadId':_0x15741b[_0x1969('0xc')][_0x1969('0x2e')]},{'logging':!![],'where':{'id':_0xf05c2a[_0x1969('0x2f')]['id']}});}else{return;}})[_0x1969('0x15')](function(){return _0x3e858d[_0x1969('0x16')]({'read':!![]});})[_0x1969('0x18')](function(_0x51215e){logger[_0x1969('0x19')](_0x1969('0x24'),'afterCreate',util['inspect'](_0x51215e,{'showHidden':![],'depth':null}));_0x3a88dc();});}else{_0x3a88dc();}})[_0x1969('0x30')](function(){_0x3a88dc();});}else{_0x3a88dc();}}},'charset':_0x1969('0x31'),'collate':_0x1969('0x32')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 67b1b02..facd6c2 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 _0x2da6=['defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','error','code','message','catch','OpenchannelMessage','create','body','options','info','CreateOpenchannelMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','redis'];(function(_0x4edf06,_0x6f934a){var _0x4bfe59=function(_0x54164c){while(--_0x54164c){_0x4edf06['push'](_0x4edf06['shift']());}};_0x4bfe59(++_0x6f934a);}(_0x2da6,0x1dd));var _0x62da=function(_0x509c64,_0x4a2025){_0x509c64=_0x509c64-0x0;var _0x8048fd=_0x2da6[_0x509c64];return _0x8048fd;};'use strict';var _=require(_0x62da('0x0'));var util=require(_0x62da('0x1'));var moment=require(_0x62da('0x2'));var BPromise=require(_0x62da('0x3'));var rs=require(_0x62da('0x4'));var fs=require('fs');var Redis=require(_0x62da('0x5'));var db=require(_0x62da('0x6'))['db'];var utils=require(_0x62da('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0x62da('0x8'));var jayson=require(_0x62da('0x9'));var client=jayson[_0x62da('0xa')][_0x62da('0xb')]({'port':0x232a});config[_0x62da('0xc')]=_[_0x62da('0xd')](config[_0x62da('0xc')],{'host':_0x62da('0xe'),'port':0x18eb});var socket=require(_0x62da('0xf'))(new Redis(config['redis']));require(_0x62da('0x10'))[_0x62da('0x11')](socket);function respondWithRpcPromise(_0x2a3d7c,_0x1b68f8,_0x4cd5a2){return new BPromise(function(_0x241090,_0x3afe3b){return client[_0x62da('0x12')](_0x2a3d7c,_0x4cd5a2)[_0x62da('0x13')](function(_0x23be32){logger['info'](_0x62da('0x14'),_0x1b68f8,_0x62da('0x15'));logger[_0x62da('0x16')](_0x62da('0x17'),_0x1b68f8,_0x62da('0x15'),JSON['stringify'](_0x23be32));if(_0x23be32['error']){if(_0x23be32[_0x62da('0x18')][_0x62da('0x19')]===0x1f4){logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x3afe3b(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}logger[_0x62da('0x18')](_0x62da('0x14'),_0x1b68f8,_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);return _0x241090(_0x23be32[_0x62da('0x18')][_0x62da('0x1a')]);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x1b68f8,_0x62da('0x15'));_0x241090(_0x23be32['result'][_0x62da('0x1a')]);}})[_0x62da('0x1b')](function(_0x15b8d0){logger['error'](_0x62da('0x14'),_0x1b68f8,_0x15b8d0);_0x3afe3b(_0x15b8d0);});});}exports['CreateOpenchannelMessage']=function(_0x2e6b7e){var _0x37c15d=this;return new Promise(function(_0x3b90c8,_0x2f7b01){return db[_0x62da('0x1c')][_0x62da('0x1d')](_0x2e6b7e[_0x62da('0x1e')],{'raw':_0x2e6b7e[_0x62da('0x1f')]?_0x2e6b7e[_0x62da('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x62da('0x13')](function(_0x866a76){logger[_0x62da('0x20')](_0x62da('0x21'),_0x2e6b7e);logger[_0x62da('0x16')](_0x62da('0x21'),_0x2e6b7e,JSON[_0x62da('0x22')](_0x866a76));_0x3b90c8(_0x866a76);})['catch'](function(_0x55fd3b){logger['error'](_0x62da('0x21'),_0x55fd3b[_0x62da('0x1a')],_0x2e6b7e);_0x2f7b01(_0x37c15d[_0x62da('0x18')](0x1f4,_0x55fd3b[_0x62da('0x1a')]));});});}; \ No newline at end of file +var _0x762e=['error','code','message','catch','CreateOpenchannelMessage','create','body','options','raw','stringify','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','info','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x762e,0xea));var _0xe762=function(_0x1d7ac3,_0x538ad6){_0x1d7ac3=_0x1d7ac3-0x0;var _0x1b552e=_0x762e[_0x1d7ac3];return _0x1b552e;};'use strict';var _=require(_0xe762('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe762('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe762('0x2'))['db'];var utils=require(_0xe762('0x3'));var logger=require(_0xe762('0x4'))('rpc');var config=require(_0xe762('0x5'));var jayson=require(_0xe762('0x6'));var client=jayson[_0xe762('0x7')]['http']({'port':0x232a});config[_0xe762('0x8')]=_[_0xe762('0x9')](config[_0xe762('0x8')],{'host':_0xe762('0xa'),'port':0x18eb});var socket=require(_0xe762('0xb'))(new Redis(config[_0xe762('0x8')]));require('./openchannelMessage.socket')[_0xe762('0xc')](socket);function respondWithRpcPromise(_0x2c0793,_0x177ad9,_0x337e91){return new BPromise(function(_0x131d67,_0x3735d5){return client[_0xe762('0xd')](_0x2c0793,_0x337e91)['then'](function(_0xd978f3){logger[_0xe762('0xe')](_0xe762('0xf'),_0x177ad9,'request\x20sent');logger[_0xe762('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x177ad9,_0xe762('0x11'),JSON['stringify'](_0xd978f3));if(_0xd978f3[_0xe762('0x12')]){if(_0xd978f3[_0xe762('0x12')][_0xe762('0x13')]===0x1f4){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x177ad9,_0xd978f3[_0xe762('0x12')][_0xe762('0x14')]);return _0x3735d5(_0xd978f3[_0xe762('0x12')][_0xe762('0x14')]);}logger[_0xe762('0x12')](_0xe762('0xf'),_0x177ad9,_0xd978f3[_0xe762('0x12')][_0xe762('0x14')]);return _0x131d67(_0xd978f3['error'][_0xe762('0x14')]);}else{logger[_0xe762('0xe')](_0xe762('0xf'),_0x177ad9,_0xe762('0x11'));_0x131d67(_0xd978f3['result'][_0xe762('0x14')]);}})[_0xe762('0x15')](function(_0x4ba564){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x177ad9,_0x4ba564);_0x3735d5(_0x4ba564);});});}exports[_0xe762('0x16')]=function(_0x5505b1){var _0x428a59=this;return new Promise(function(_0x5bd84e,_0x8775aa){return db['OpenchannelMessage'][_0xe762('0x17')](_0x5505b1[_0xe762('0x18')],{'raw':_0x5505b1[_0xe762('0x19')]?_0x5505b1[_0xe762('0x19')][_0xe762('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x58a906){logger['info']('CreateOpenchannelMessage',_0x5505b1);logger[_0xe762('0x10')](_0xe762('0x16'),_0x5505b1,JSON[_0xe762('0x1b')](_0x58a906));_0x5bd84e(_0x58a906);})[_0xe762('0x15')](function(_0x278064){logger['error'](_0xe762('0x16'),_0x278064[_0xe762('0x14')],_0x5505b1);_0x8775aa(_0x428a59[_0xe762('0x12')](0x1f4,_0x278064[_0xe762('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 8cd80f2..18f1163 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 _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x5d2ed9,_0x16c436){var _0x4262c5=function(_0x124aee){while(--_0x124aee){_0x5d2ed9['push'](_0x5d2ed9['shift']());}};_0x4262c5(++_0x16c436);}(_0xe706,0xa3));var _0x6e70=function(_0x5d8fa1,_0x48f172){_0x5d8fa1=_0x5d8fa1-0x0;var _0x53a280=_0xe706[_0x5d8fa1];return _0x53a280;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file +var _0xe706=['register','length','openchannelMessage:','./openchannelMessage.events','save','remove','emit','removeListener'];(function(_0x23a042,_0x169361){var _0x57543a=function(_0x1fccec){while(--_0x1fccec){_0x23a042['push'](_0x23a042['shift']());}};_0x57543a(++_0x169361);}(_0xe706,0xa3));var _0x6e70=function(_0x2d0fff,_0x128adc){_0x2d0fff=_0x2d0fff-0x0;var _0x40c5b1=_0xe706[_0x2d0fff];return _0x40c5b1;};'use strict';var OpenchannelMessageEvents=require(_0x6e70('0x0'));var events=[_0x6e70('0x1'),_0x6e70('0x2'),'update'];function createListener(_0x2cae77,_0x315629){return function(_0x2ca810){_0x315629[_0x6e70('0x3')](_0x2cae77,_0x2ca810);};}function removeListener(_0x142c27,_0x2164a4){return function(){OpenchannelMessageEvents[_0x6e70('0x4')](_0x142c27,_0x2164a4);};}exports[_0x6e70('0x5')]=function(_0x1b0389){for(var _0x4381d1=0x0,_0x36357b=events[_0x6e70('0x6')];_0x4381d1<_0x36357b;_0x4381d1++){var _0x45a2d4=events[_0x4381d1];var _0x188ed3=createListener(_0x6e70('0x7')+_0x45a2d4,_0x1b0389);OpenchannelMessageEvents['on'](_0x45a2d4,_0x188ed3);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index ff4f30e..b5e183f 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 _0x535d=['post','create','put','update','destroy','delete','exports','multer','util','connect-timeout','express','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0xa555a6,_0x457c1c){var _0xc5e8fe=function(_0xeb7fe5){while(--_0xeb7fe5){_0xa555a6['push'](_0xa555a6['shift']());}};_0xc5e8fe(++_0x457c1c);}(_0x535d,0xe8));var _0xd535=function(_0x2aaed0,_0x40c604){_0x2aaed0=_0x2aaed0-0x0;var _0x3a45db=_0x535d[_0x2aaed0];return _0x3a45db;};'use strict';var multer=require(_0xd535('0x0'));var util=require(_0xd535('0x1'));var path=require('path');var timeout=require(_0xd535('0x2'));var express=require(_0xd535('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xd535('0x4'));var config=require(_0xd535('0x5'));var controller=require(_0xd535('0x6'));router[_0xd535('0x7')]('/',auth[_0xd535('0x8')](),controller[_0xd535('0x9')]);router['get']('/describe',auth[_0xd535('0x8')](),controller[_0xd535('0xa')]);router['get'](_0xd535('0xb'),auth['isAuthenticated'](),controller[_0xd535('0xc')]);router[_0xd535('0x7')](_0xd535('0xd'),auth[_0xd535('0x8')](),controller['getMembers']);router[_0xd535('0x7')](_0xd535('0xe'),auth[_0xd535('0x8')](),controller[_0xd535('0xf')]);router['get'](_0xd535('0x10'),auth[_0xd535('0x8')](),controller[_0xd535('0x11')]);router[_0xd535('0x12')]('/',auth[_0xd535('0x8')](),controller[_0xd535('0x13')]);router[_0xd535('0x12')]('/:id/teams',auth[_0xd535('0x8')](),controller['addTeams']);router['post'](_0xd535('0x10'),auth[_0xd535('0x8')](),controller['addAgents']);router[_0xd535('0x14')](_0xd535('0xb'),auth[_0xd535('0x8')](),controller[_0xd535('0x15')]);router['delete'](_0xd535('0xb'),auth[_0xd535('0x8')](),controller[_0xd535('0x16')]);router[_0xd535('0x17')]('/:id/teams',auth[_0xd535('0x8')](),controller['removeTeams']);router[_0xd535('0x17')]('/:id/users',auth[_0xd535('0x8')](),controller['removeAgents']);module[_0xd535('0x18')]=router; \ No newline at end of file +var _0x07d7=['getMembers','/:id/teams','getTeams','/:id/users','create','post','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/members'];(function(_0x15d870,_0x5aa4e9){var _0x58d670=function(_0x2e6e43){while(--_0x2e6e43){_0x15d870['push'](_0x15d870['shift']());}};_0x58d670(++_0x5aa4e9);}(_0x07d7,0x85));var _0x707d=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0x07d7[_0x53a7a8];return _0x555f71;};'use strict';var multer=require(_0x707d('0x0'));var util=require(_0x707d('0x1'));var path=require(_0x707d('0x2'));var timeout=require(_0x707d('0x3'));var express=require(_0x707d('0x4'));var router=express[_0x707d('0x5')]();var auth=require(_0x707d('0x6'));var interaction=require(_0x707d('0x7'));var config=require(_0x707d('0x8'));var controller=require(_0x707d('0x9'));router[_0x707d('0xa')]('/',auth[_0x707d('0xb')](),controller[_0x707d('0xc')]);router[_0x707d('0xa')](_0x707d('0xd'),auth[_0x707d('0xb')](),controller['describe']);router['get'](_0x707d('0xe'),auth[_0x707d('0xb')](),controller[_0x707d('0xf')]);router[_0x707d('0xa')](_0x707d('0x10'),auth['isAuthenticated'](),controller[_0x707d('0x11')]);router[_0x707d('0xa')](_0x707d('0x12'),auth['isAuthenticated'](),controller[_0x707d('0x13')]);router[_0x707d('0xa')](_0x707d('0x14'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth[_0x707d('0xb')](),controller[_0x707d('0x15')]);router[_0x707d('0x16')]('/:id/teams',auth[_0x707d('0xb')](),controller['addTeams']);router[_0x707d('0x16')](_0x707d('0x14'),auth['isAuthenticated'](),controller['addAgents']);router[_0x707d('0x17')]('/:id',auth[_0x707d('0xb')](),controller[_0x707d('0x18')]);router[_0x707d('0x19')](_0x707d('0xe'),auth[_0x707d('0xb')](),controller[_0x707d('0x1a')]);router[_0x707d('0x19')]('/:id/teams',auth[_0x707d('0xb')](),controller[_0x707d('0x1b')]);router[_0x707d('0x19')]('/:id/users',auth[_0x707d('0xb')](),controller[_0x707d('0x1c')]);module[_0x707d('0x1d')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index e8ab610..6a5e760 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 _0x870d=['name','INTEGER','ENUM','beepall','roundrobin','exports','STRING'];(function(_0xe85574,_0x25e253){var _0x1aea6e=function(_0x44f746){while(--_0x44f746){_0xe85574['push'](_0xe85574['shift']());}};_0x1aea6e(++_0x25e253);}(_0x870d,0xde));var _0xd870=function(_0x997401,_0x487526){_0x997401=_0x997401-0x0;var _0x620460=_0x870d[_0x997401];return _0x620460;};'use strict';var Sequelize=require('sequelize');module[_0xd870('0x0')]={'name':{'type':Sequelize[_0xd870('0x1')],'unique':_0xd870('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xd870('0x1')]},'timeout':{'type':Sequelize[_0xd870('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xd870('0x4')]('rrmemory',_0xd870('0x5'),_0xd870('0x6'))}}; \ No newline at end of file +var _0xce08=['INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','STRING','name'];(function(_0x448c53,_0x26dd23){var _0x456ac3=function(_0x5b1084){while(--_0x5b1084){_0x448c53['push'](_0x448c53['shift']());}};_0x456ac3(++_0x26dd23);}(_0xce08,0xb4));var _0x8ce0=function(_0x588a79,_0x2023ed){_0x588a79=_0x588a79-0x0;var _0x4d0fca=_0xce08[_0x588a79];return _0x4d0fca;};'use strict';var Sequelize=require(_0x8ce0('0x0'));module[_0x8ce0('0x1')]={'name':{'type':Sequelize[_0x8ce0('0x2')],'unique':_0x8ce0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8ce0('0x2')]},'timeout':{'type':Sequelize[_0x8ce0('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8ce0('0x5')](_0x8ce0('0x6'),'beepall',_0x8ce0('0x7'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 493d03e..c9adec8 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 _0x4e7f=['fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','OpenchannelQueue','rows','catch','show','params','includeAll','options','create','body','user','role','UserProfileSection','find','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','UserId','agent','openchannelPause','updatedAt','format','%s/%s','createdAt','getTeams','findOne','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userOpenchannelQueue:save','field','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','push','QueryTypes','every','TeamId','includes','union','compact','value','removeTeams','isEmpty','removeAgents','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','stack','name','index','rawAttributes'];(function(_0x32ebe5,_0x2eace0){var _0xfb42fc=function(_0x34e2f9){while(--_0x34e2f9){_0x32ebe5['push'](_0x32ebe5['shift']());}};_0xfb42fc(++_0x2eace0);}(_0x4e7f,0x1eb));var _0xf4e7=function(_0x1266f9,_0xbba76f){_0x1266f9=_0x1266f9-0x0;var _0x282acb=_0x4e7f[_0x1266f9];return _0x282acb;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf4e7('0x0'));var rimraf=require(_0xf4e7('0x1'));var zipdir=require(_0xf4e7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf4e7('0x3'));var BPromise=require(_0xf4e7('0x4'));var Mustache=require(_0xf4e7('0x5'));var util=require(_0xf4e7('0x6'));var path=require(_0xf4e7('0x7'));var sox=require('sox');var csv=require(_0xf4e7('0x8'));var ejs=require(_0xf4e7('0x9'));var fs=require('fs');var _=require(_0xf4e7('0xa'));var squel=require(_0xf4e7('0xb'));var crypto=require(_0xf4e7('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf4e7('0xd'));var Papa=require(_0xf4e7('0xe'));var Redis=require('ioredis');var authService=require(_0xf4e7('0xf'));var qs=require(_0xf4e7('0x10'));var as=require(_0xf4e7('0x11'));var hardwareService=require(_0xf4e7('0x12'));var logger=require(_0xf4e7('0x13'))(_0xf4e7('0x14'));var utils=require('../../config/utils');var config=require(_0xf4e7('0x15'));var db=require(_0xf4e7('0x16'))['db'];config[_0xf4e7('0x17')]=_[_0xf4e7('0x18')](config['redis'],{'host':_0xf4e7('0x19'),'port':0x18eb});var socket=require(_0xf4e7('0x1a'))(new Redis(config[_0xf4e7('0x17')]));require(_0xf4e7('0x1b'))['register'](socket);function respondWithStatusCode(_0x3f57e2,_0x191a7){_0x191a7=_0x191a7||0xcc;return function(_0x2319e7){if(_0x2319e7){return _0x3f57e2[_0xf4e7('0x1c')](_0x191a7);}return _0x3f57e2[_0xf4e7('0x1d')](_0x191a7)[_0xf4e7('0x1e')]();};}function respondWithResult(_0x599a88,_0xed8f83){_0xed8f83=_0xed8f83||0xc8;return function(_0x5cdd54){if(_0x5cdd54){return _0x599a88['status'](_0xed8f83)[_0xf4e7('0x1f')](_0x5cdd54);}};}function respondWithFilteredResult(_0x30127b,_0xad6490){return function(_0x168848){if(_0x168848){var _0x54b551=_0x168848[_0xf4e7('0x20')],_0x3863b4=_0xad6490[_0xf4e7('0x21')],_0x4e31a3=_0xad6490[_0xf4e7('0x21')]+_0xad6490[_0xf4e7('0x22')],_0x2961b3;if(_0x4e31a3>=_0x54b551){_0x4e31a3=_0x54b551;_0x2961b3=0xc8;}else{_0x2961b3=0xce;}_0x30127b[_0xf4e7('0x1d')](_0x2961b3);return _0x30127b[_0xf4e7('0x23')](_0xf4e7('0x24'),_0x3863b4+'-'+_0x4e31a3+'/'+_0x54b551)['json'](_0x168848);}return null;};}function patchUpdates(_0x413d9b){return function(_0x265225){try{jsonpatch['apply'](_0x265225,_0x413d9b,!![]);}catch(_0x5cb544){return BPromise[_0xf4e7('0x25')](_0x5cb544);}return _0x265225[_0xf4e7('0x26')]();};}function saveUpdates(_0x4188ed,_0x3cf66b){return function(_0x1212b5){if(_0x1212b5){return _0x1212b5[_0xf4e7('0x27')](_0x4188ed)[_0xf4e7('0x28')](function(_0x445cf2){return _0x445cf2;});}return null;};}function removeEntity(_0x2697c1,_0x2b04c6){return function(_0x1f5936){if(_0x1f5936){return _0x1f5936[_0xf4e7('0x29')]()[_0xf4e7('0x28')](function(){var _0x267c45=_0x1f5936[_0xf4e7('0x2a')]({'plain':!![]});var _0x9f7498=_0xf4e7('0x2b');return db[_0xf4e7('0x2c')][_0xf4e7('0x29')]({'where':{'type':_0x9f7498,'resourceId':_0x267c45['id']}})[_0xf4e7('0x28')](function(){return _0x1f5936;});})[_0xf4e7('0x28')](function(){_0x2697c1[_0xf4e7('0x1d')](0xcc)[_0xf4e7('0x1e')]();});}};}function handleEntityNotFound(_0x5de082,_0x5f35cc){return function(_0x1a8279){if(!_0x1a8279){_0x5de082[_0xf4e7('0x1c')](0x194);}return _0x1a8279;};}function handleError(_0x20ca44,_0x202bb2){_0x202bb2=_0x202bb2||0x1f4;return function(_0x229e90){logger['error'](_0x229e90[_0xf4e7('0x2d')]);if(_0x229e90[_0xf4e7('0x2e')]){delete _0x229e90[_0xf4e7('0x2e')];}_0x20ca44[_0xf4e7('0x1d')](_0x202bb2)['send'](_0x229e90);};}exports[_0xf4e7('0x2f')]=function(_0x29ef00,_0x283380){var _0x5eb74d={},_0x3e3530={},_0xe646e3={'count':0x0,'rows':[]};var _0x2502a8=_['map'](db['OpenchannelQueue'][_0xf4e7('0x30')],function(_0x564d10){return{'name':_0x564d10[_0xf4e7('0x31')],'type':_0x564d10[_0xf4e7('0x32')]['key']};});_0x3e3530[_0xf4e7('0x33')]=_[_0xf4e7('0x34')](_0x2502a8,_0xf4e7('0x2e'));_0x3e3530[_0xf4e7('0x35')]=_[_0xf4e7('0x36')](_0x29ef00[_0xf4e7('0x35')]);_0x3e3530[_0xf4e7('0x37')]=_[_0xf4e7('0x38')](_0x3e3530[_0xf4e7('0x33')],_0x3e3530['query']);_0x5eb74d[_0xf4e7('0x39')]=_['intersection'](_0x3e3530[_0xf4e7('0x33')],qs[_0xf4e7('0x3a')](_0x29ef00[_0xf4e7('0x35')][_0xf4e7('0x3a')]));_0x5eb74d[_0xf4e7('0x39')]=_0x5eb74d['attributes'][_0xf4e7('0x3b')]?_0x5eb74d[_0xf4e7('0x39')]:_0x3e3530[_0xf4e7('0x33')];if(!_0x29ef00[_0xf4e7('0x35')][_0xf4e7('0x3c')](_0xf4e7('0x3d'))){_0x5eb74d[_0xf4e7('0x22')]=qs[_0xf4e7('0x22')](_0x29ef00[_0xf4e7('0x35')][_0xf4e7('0x22')]);_0x5eb74d[_0xf4e7('0x21')]=qs[_0xf4e7('0x21')](_0x29ef00[_0xf4e7('0x35')]['offset']);}_0x5eb74d[_0xf4e7('0x3e')]=qs[_0xf4e7('0x3f')](_0x29ef00['query'][_0xf4e7('0x3f')]);_0x5eb74d[_0xf4e7('0x40')]=qs[_0xf4e7('0x37')](_[_0xf4e7('0x41')](_0x29ef00[_0xf4e7('0x35')],_0x3e3530[_0xf4e7('0x37')]));if(_0x29ef00[_0xf4e7('0x35')][_0xf4e7('0x42')]){_0x5eb74d[_0xf4e7('0x40')]=_[_0xf4e7('0x43')](_0x5eb74d[_0xf4e7('0x40')],{'$or':_[_0xf4e7('0x34')](_0x2502a8,function(_0x7449ba){if(_0x7449ba['type']!==_0xf4e7('0x44')){var _0x45c8bd={};_0x45c8bd[_0x7449ba[_0xf4e7('0x2e')]]={'$like':'%'+_0x29ef00[_0xf4e7('0x35')][_0xf4e7('0x42')]+'%'};return _0x45c8bd;}})});}_0x5eb74d=_['merge']({},_0x5eb74d,_0x29ef00['options']);var _0x1a54e1={'where':_0x5eb74d[_0xf4e7('0x40')]};return db['OpenchannelQueue'][_0xf4e7('0x20')](_0x1a54e1)[_0xf4e7('0x28')](function(_0x1f97b3){_0xe646e3[_0xf4e7('0x20')]=_0x1f97b3;if(_0x29ef00[_0xf4e7('0x35')]['includeAll']){_0x5eb74d['include']=[{'all':!![]}];}return db[_0xf4e7('0x45')]['findAll'](_0x5eb74d);})[_0xf4e7('0x28')](function(_0x291b17){_0xe646e3[_0xf4e7('0x46')]=_0x291b17;return _0xe646e3;})[_0xf4e7('0x28')](respondWithFilteredResult(_0x283380,_0x5eb74d))[_0xf4e7('0x47')](handleError(_0x283380,null));};exports[_0xf4e7('0x48')]=function(_0x6f2d0d,_0x1889a7){var _0x46ecab={'raw':!![],'where':{'id':_0x6f2d0d[_0xf4e7('0x49')]['id']}},_0x4d46fc={};_0x4d46fc[_0xf4e7('0x33')]=_['keys'](db[_0xf4e7('0x45')][_0xf4e7('0x30')]);_0x4d46fc[_0xf4e7('0x35')]=_[_0xf4e7('0x36')](_0x6f2d0d[_0xf4e7('0x35')]);_0x4d46fc[_0xf4e7('0x37')]=_['intersection'](_0x4d46fc[_0xf4e7('0x33')],_0x4d46fc[_0xf4e7('0x35')]);_0x46ecab[_0xf4e7('0x39')]=_[_0xf4e7('0x38')](_0x4d46fc[_0xf4e7('0x33')],qs[_0xf4e7('0x3a')](_0x6f2d0d[_0xf4e7('0x35')][_0xf4e7('0x3a')]));_0x46ecab[_0xf4e7('0x39')]=_0x46ecab[_0xf4e7('0x39')][_0xf4e7('0x3b')]?_0x46ecab[_0xf4e7('0x39')]:_0x4d46fc[_0xf4e7('0x33')];if(_0x6f2d0d[_0xf4e7('0x35')][_0xf4e7('0x4a')]){_0x46ecab['include']=[{'all':!![]}];}_0x46ecab=_[_0xf4e7('0x43')]({},_0x46ecab,_0x6f2d0d[_0xf4e7('0x4b')]);return db[_0xf4e7('0x45')]['find'](_0x46ecab)[_0xf4e7('0x28')](handleEntityNotFound(_0x1889a7,null))[_0xf4e7('0x28')](respondWithResult(_0x1889a7,null))[_0xf4e7('0x47')](handleError(_0x1889a7,null));};exports[_0xf4e7('0x4c')]=function(_0x1e2282,_0x1e56f1){return db['OpenchannelQueue'][_0xf4e7('0x4c')](_0x1e2282[_0xf4e7('0x4d')],{})['then'](function(_0x4e0478){var _0x2d5334=_0x1e2282[_0xf4e7('0x4e')]['get']({'plain':!![]});if(!_0x2d5334)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d5334[_0xf4e7('0x4f')]===_0xf4e7('0x4e')){var _0x290b7f=_0x4e0478[_0xf4e7('0x2a')]({'plain':!![]});var _0x4937f8=_0xf4e7('0x2b');return db[_0xf4e7('0x50')][_0xf4e7('0x51')]({'where':{'name':_0x4937f8,'userProfileId':_0x2d5334['userProfileId']},'raw':!![]})[_0xf4e7('0x28')](function(_0x19d6a0){if(_0x19d6a0&&_0x19d6a0['autoAssociation']===0x0){return db[_0xf4e7('0x2c')][_0xf4e7('0x4c')]({'name':_0x290b7f[_0xf4e7('0x2e')],'resourceId':_0x290b7f['id'],'type':_0x19d6a0['name'],'sectionId':_0x19d6a0['id']},{})[_0xf4e7('0x28')](function(){return _0x4e0478;});}else{return _0x4e0478;}})[_0xf4e7('0x47')](function(_0x5239d9){logger[_0xf4e7('0x52')](_0xf4e7('0x53'),_0x5239d9);throw _0x5239d9;});}return _0x4e0478;})[_0xf4e7('0x28')](respondWithResult(_0x1e56f1,0xc9))[_0xf4e7('0x47')](handleError(_0x1e56f1,null));};exports[_0xf4e7('0x27')]=function(_0x29ffde,_0x4d7e9f){if(_0x29ffde[_0xf4e7('0x4d')]['id']){delete _0x29ffde[_0xf4e7('0x4d')]['id'];}return db['OpenchannelQueue'][_0xf4e7('0x51')]({'where':{'id':_0x29ffde[_0xf4e7('0x49')]['id']}})[_0xf4e7('0x28')](handleEntityNotFound(_0x4d7e9f,null))['then'](saveUpdates(_0x29ffde[_0xf4e7('0x4d')],null))[_0xf4e7('0x28')](respondWithResult(_0x4d7e9f,null))[_0xf4e7('0x47')](handleError(_0x4d7e9f,null));};exports[_0xf4e7('0x29')]=function(_0x48d302,_0x86f208){return db[_0xf4e7('0x45')]['find']({'where':{'id':_0x48d302[_0xf4e7('0x49')]['id']}})[_0xf4e7('0x28')](handleEntityNotFound(_0x86f208,null))[_0xf4e7('0x28')](removeEntity(_0x86f208,null))[_0xf4e7('0x47')](handleError(_0x86f208,null));};exports[_0xf4e7('0x54')]=function(_0x38bf80,_0x38124d){return db['OpenchannelQueue'][_0xf4e7('0x54')]()['then'](respondWithResult(_0x38124d,null))['catch'](handleError(_0x38124d,null));};exports[_0xf4e7('0x55')]=function(_0x142456,_0x2f2095,_0x25a5e4){var _0x888c32={'raw':!![],'where':{}},_0x294459={},_0x3dd6d9;return db[_0xf4e7('0x45')]['findOne']({'where':{'id':_0x142456[_0xf4e7('0x49')]['id']}})[_0xf4e7('0x28')](handleEntityNotFound(_0x2f2095,null))['then'](function(_0x3ef53c){if(_0x3ef53c){_0x3dd6d9=_0x3ef53c[_0xf4e7('0x2a')]({'plain':!![]});_0x294459[_0xf4e7('0x33')]=_[_0xf4e7('0x36')](db[_0xf4e7('0x56')][_0xf4e7('0x30')]);_0x294459[_0xf4e7('0x35')]=_[_0xf4e7('0x36')](_0x142456[_0xf4e7('0x35')]);_0x294459[_0xf4e7('0x37')]=_[_0xf4e7('0x38')](_0x294459[_0xf4e7('0x33')],_0x294459[_0xf4e7('0x35')]);_0x888c32[_0xf4e7('0x39')]=_['intersection'](_0x294459[_0xf4e7('0x33')],qs[_0xf4e7('0x3a')](_0x142456['query'][_0xf4e7('0x3a')]));_0x888c32[_0xf4e7('0x39')]=_0x888c32[_0xf4e7('0x39')][_0xf4e7('0x3b')]?_0x888c32[_0xf4e7('0x39')]:_0x294459[_0xf4e7('0x33')];if(!_0x142456['query'][_0xf4e7('0x3c')]('nolimit')){_0x888c32['limit']=qs[_0xf4e7('0x22')](_0x142456[_0xf4e7('0x35')][_0xf4e7('0x22')]);_0x888c32[_0xf4e7('0x21')]=qs[_0xf4e7('0x21')](_0x142456[_0xf4e7('0x35')][_0xf4e7('0x21')]);}_0x888c32[_0xf4e7('0x3e')]=qs['sort'](_0x142456[_0xf4e7('0x35')][_0xf4e7('0x3f')]);_0x888c32[_0xf4e7('0x40')]=qs[_0xf4e7('0x37')](_[_0xf4e7('0x41')](_0x142456[_0xf4e7('0x35')],_0x294459[_0xf4e7('0x37')]));_0x888c32['where'][_0xf4e7('0x57')]=_0x3ef53c['id'];if(_0x142456[_0xf4e7('0x35')][_0xf4e7('0x42')]){_0x888c32[_0xf4e7('0x40')]=_[_0xf4e7('0x43')](_0x888c32['where'],{'$or':_['map'](_0x888c32[_0xf4e7('0x39')],function(_0x194577){var _0x3c9fc6={};_0x3c9fc6[_0x194577]={'$like':'%'+_0x142456[_0xf4e7('0x35')][_0xf4e7('0x42')]+'%'};return _0x3c9fc6;})});}_0x888c32=_['merge']({},_0x888c32,_0x142456['options']);return db['UserOpenchannelQueue'][_0xf4e7('0x58')](_0x888c32);}})[_0xf4e7('0x28')](function(_0x2683dd){if(_0x2683dd){return db[_0xf4e7('0x59')]['findAndCountAll']({'where':{'id':_[_0xf4e7('0x34')](_0x2683dd,_0xf4e7('0x5a')),'role':_0xf4e7('0x5b')},'attributes':['id',_0xf4e7('0x2e'),_0xf4e7('0x5c'),_0xf4e7('0x5d'),'createdAt']});}})['then'](function(_0x126ddd){if(_0x126ddd){return{'count':_0x126ddd['count'],'rows':_['map'](_0x126ddd[_0xf4e7('0x46')],function(_0x3ba457){return{'membername':_0x3ba457[_0xf4e7('0x2e')],'UserId':_0x3ba457['id'],'queue_name':_0x3dd6d9['name'],'OpenchannelQueueId':_0x3dd6d9['id'],'interface':util[_0xf4e7('0x5e')](_0xf4e7('0x5f'),'SIP',_0x3ba457['name']),'penalty':0x0,'paused':_0x3ba457['openchannelPause'],'createdAt':_0x3ba457[_0xf4e7('0x60')],'updatedAt':_0x3ba457[_0xf4e7('0x5d')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2f2095,_0x888c32))['catch'](handleError(_0x2f2095,null));};exports[_0xf4e7('0x61')]=function(_0x370599,_0x3a524,_0x291a20){var _0x7ff87={};var _0x3aedf6={};var _0x8f55e0;var _0x25aec1;return db[_0xf4e7('0x45')][_0xf4e7('0x62')]({'where':{'id':_0x370599['params']['id']}})[_0xf4e7('0x28')](handleEntityNotFound(_0x3a524,null))['then'](function(_0x294b8b){if(_0x294b8b){_0x8f55e0=_0x294b8b;_0x3aedf6[_0xf4e7('0x33')]=_[_0xf4e7('0x36')](db[_0xf4e7('0x63')]['rawAttributes']);_0x3aedf6[_0xf4e7('0x35')]=_['keys'](_0x370599[_0xf4e7('0x35')]);_0x3aedf6[_0xf4e7('0x37')]=_[_0xf4e7('0x38')](_0x3aedf6['model'],_0x3aedf6[_0xf4e7('0x35')]);_0x7ff87[_0xf4e7('0x39')]=_['intersection'](_0x3aedf6[_0xf4e7('0x33')],qs[_0xf4e7('0x3a')](_0x370599[_0xf4e7('0x35')]['fields']));_0x7ff87['attributes']=_0x7ff87[_0xf4e7('0x39')][_0xf4e7('0x3b')]?_0x7ff87[_0xf4e7('0x39')]:_0x3aedf6[_0xf4e7('0x33')];_0x7ff87[_0xf4e7('0x3e')]=qs[_0xf4e7('0x3f')](_0x370599[_0xf4e7('0x35')][_0xf4e7('0x3f')]);_0x7ff87[_0xf4e7('0x40')]=qs[_0xf4e7('0x37')](_[_0xf4e7('0x41')](_0x370599[_0xf4e7('0x35')],_0x3aedf6[_0xf4e7('0x37')]));if(_0x370599[_0xf4e7('0x35')][_0xf4e7('0x42')]){_0x7ff87['where']=_[_0xf4e7('0x43')](_0x7ff87[_0xf4e7('0x40')],{'$or':_[_0xf4e7('0x34')](_0x7ff87[_0xf4e7('0x39')],function(_0x36e93e){var _0xe333be={};_0xe333be[_0x36e93e]={'$like':'%'+_0x370599['query'][_0xf4e7('0x42')]+'%'};return _0xe333be;})});}_0x7ff87=_[_0xf4e7('0x43')]({},_0x7ff87,_0x370599[_0xf4e7('0x4b')]);return _0x8f55e0['getTeams'](_0x7ff87);}})[_0xf4e7('0x28')](function(_0x1d18a2){if(_0x1d18a2){_0x25aec1=_0x1d18a2['length'];if(!_0x370599['query']['hasOwnProperty'](_0xf4e7('0x3d'))){_0x7ff87[_0xf4e7('0x22')]=qs[_0xf4e7('0x22')](_0x370599[_0xf4e7('0x35')][_0xf4e7('0x22')]);_0x7ff87[_0xf4e7('0x21')]=qs['offset'](_0x370599['query']['offset']);}return _0x8f55e0[_0xf4e7('0x61')](_0x7ff87);}})[_0xf4e7('0x28')](function(_0x28df26){if(_0x28df26){return _0x28df26?{'count':_0x25aec1,'rows':_0x28df26}:null;}})['then'](respondWithResult(_0x3a524,null))[_0xf4e7('0x47')](handleError(_0x3a524,null));};exports[_0xf4e7('0x64')]=function(_0x2dc1f2,_0x3924e8,_0x2ac802){var _0x4222a4=_0x2dc1f2[_0xf4e7('0x4d')][_0xf4e7('0x65')];return db[_0xf4e7('0x63')]['findAll']({'where':{'id':_0x4222a4},'attributes':['id'],'include':[{'model':db[_0xf4e7('0x59')],'as':_0xf4e7('0x66'),'attributes':['id',_0xf4e7('0x2e'),_0xf4e7('0x67'),'voicePause',_0xf4e7('0x68')],'raw':!![]}]})[_0xf4e7('0x28')](function(_0x559e19){if(_0x559e19){var _0xd3b83c=_[_0xf4e7('0x69')](_0x559e19,function(_0x42cb5){var _0x4411a0=_0x42cb5[_0xf4e7('0x2a')]({'plain':!![]});return _0x4411a0[_0xf4e7('0x66')];});return db[_0xf4e7('0x45')][_0xf4e7('0x51')]({'where':{'id':_0x2dc1f2['params']['id']}})['then'](function(_0x1472e4){return db[_0xf4e7('0x6a')][_0xf4e7('0x6b')](function(_0x1cec9d){return _0x1472e4[_0xf4e7('0x64')](_0x4222a4,{'transaction':_0x1cec9d})[_0xf4e7('0x28')](function(){return BPromise[_0xf4e7('0x6c')](_0xd3b83c,function(_0x442f7a){return db[_0xf4e7('0x56')][_0xf4e7('0x6d')]({'where':{'UserId':_0x442f7a['id'],'OpenchannelQueueId':_0x2dc1f2[_0xf4e7('0x49')]['id']},'transaction':_0x1cec9d});});})[_0xf4e7('0x28')](function(){_0xd3b83c[_0xf4e7('0x6e')](function(_0xf8984){socket[_0xf4e7('0x6f')](_0xf4e7('0x70'),{'UserId':_0xf8984['id'],'OpenchannelQueueId':_0x1472e4['id']});});});});});}})[_0xf4e7('0x28')](respondWithStatusCode(_0x3924e8,null))[_0xf4e7('0x47')](handleError(_0x3924e8,null));};exports['removeTeams']=function(_0x20c1f1,_0x11fd3e,_0x292512){return db[_0xf4e7('0x63')]['findAll']({'where':{'id':_0x20c1f1[_0xf4e7('0x35')][_0xf4e7('0x65')]},'attributes':['id'],'include':[{'model':db[_0xf4e7('0x59')],'as':_0xf4e7('0x66'),'attributes':['id'],'raw':!![]}]})[_0xf4e7('0x28')](handleEntityNotFound(_0x11fd3e,null))['then'](function(_0x380805){var _0x4d04a3=_[_0xf4e7('0x34')](_0x380805,'id');var _0x48b4f1=[];var _0xcd95df=[];var _0x28ce62=squel['select']();_0x28ce62[_0xf4e7('0x71')]('tq.TeamId')[_0xf4e7('0x72')](_0xf4e7('0x73'),'tq')[_0xf4e7('0x74')]('user_has_teams','ut',_0xf4e7('0x75'))[_0xf4e7('0x40')]('OpenchannelQueueId\x20=\x20?',_0x20c1f1[_0xf4e7('0x49')]['id']);for(var _0x281cc9=0x0;_0x281cc9<_0x380805[_0xf4e7('0x3b')];_0x281cc9+=0x1){let _0x3b9dff=_0x380805[_0x281cc9];for(var _0x26d7ec=0x0;_0x26d7ec<_0x3b9dff[_0xf4e7('0x66')][_0xf4e7('0x3b')];_0x26d7ec+=0x1){let _0x320ad2=_0x3b9dff[_0xf4e7('0x66')][_0x26d7ec];var _0x56f75a=_0x28ce62['clone']();_0x56f75a[_0xf4e7('0x40')]('ut.UserId\x20=\x20?',_0x320ad2['id']);_0xcd95df[_0xf4e7('0x76')](db[_0xf4e7('0x6a')]['query'](_0x56f75a['toString'](),{'type':db['sequelize'][_0xf4e7('0x77')]['SELECT']})[_0xf4e7('0x28')](function(_0x2cd4cf){if(_0x2cd4cf[_0xf4e7('0x3b')]===0x1){return _0x320ad2['id'];}else{var _0xcbd045=_[_0xf4e7('0x78')](_[_0xf4e7('0x34')](_0x2cd4cf,_0xf4e7('0x79')),function(_0x49de35){return _[_0xf4e7('0x7a')](_0x4d04a3,_0x49de35);});if(_0xcbd045){return _0x320ad2['id'];}}}));}}return BPromise['all'](_0xcd95df)[_0xf4e7('0x28')](function(_0x5069c2){_0x48b4f1=_(_0x48b4f1)[_0xf4e7('0x7b')](_0x5069c2)[_0xf4e7('0x7c')]()[_0xf4e7('0x7d')]();return db['OpenchannelQueue'][_0xf4e7('0x51')]({'where':{'id':_0x20c1f1[_0xf4e7('0x49')]['id']}})['then'](function(_0x43abd1){return db[_0xf4e7('0x6a')][_0xf4e7('0x6b')](function(_0x21a84f){return _0x43abd1[_0xf4e7('0x7e')](_0x20c1f1[_0xf4e7('0x35')][_0xf4e7('0x65')],{'transaction':_0x21a84f})[_0xf4e7('0x28')](function(){if(!_[_0xf4e7('0x7f')](_0x48b4f1)){return _0x43abd1[_0xf4e7('0x80')](_0x48b4f1,{'transaction':_0x21a84f});}})[_0xf4e7('0x28')](function(){_0x48b4f1[_0xf4e7('0x6e')](function(_0x569973){socket[_0xf4e7('0x6f')](_0xf4e7('0x81'),{'UserId':_0x569973,'OpenchannelQueueId':_0x43abd1['id']});});});});});});})[_0xf4e7('0x28')](respondWithStatusCode(_0x11fd3e,null))[_0xf4e7('0x47')](handleError(_0x11fd3e,null));};exports[_0xf4e7('0x82')]=function(_0x21ab37,_0x576fff,_0x532b19){return db['OpenchannelQueue'][_0xf4e7('0x51')]({'where':{'id':_0x21ab37[_0xf4e7('0x49')]['id']}})[_0xf4e7('0x28')](handleEntityNotFound(_0x576fff,null))[_0xf4e7('0x28')](function(_0x350f99){if(_0x350f99){return _0x350f99[_0xf4e7('0x82')](_0x21ab37[_0xf4e7('0x4d')][_0xf4e7('0x65')],_[_0xf4e7('0x83')](_0x21ab37[_0xf4e7('0x4d')],[_0xf4e7('0x65'),'id'])||{})[_0xf4e7('0x84')](function(_0xd0e2ba){for(var _0x328a34=0x0;_0x328a34<_0x21ab37['body']['ids'][_0xf4e7('0x3b')];_0x328a34+=0x1){socket[_0xf4e7('0x6f')](_0xf4e7('0x70'),{'UserId':_0x21ab37[_0xf4e7('0x4d')][_0xf4e7('0x65')][_0x328a34],'OpenchannelQueueId':_0x21ab37[_0xf4e7('0x49')]['id']});}return _0xd0e2ba;});}})[_0xf4e7('0x28')](respondWithResult(_0x576fff,null))[_0xf4e7('0x47')](handleError(_0x576fff,null));};exports[_0xf4e7('0x80')]=function(_0xa2d607,_0x7fca6d,_0x2a7bb4){return db['OpenchannelQueue']['find']({'where':{'id':_0xa2d607[_0xf4e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x7fca6d,null))['then'](function(_0x132556){if(_0x132556){return _0x132556[_0xf4e7('0x80')](_0xa2d607[_0xf4e7('0x35')][_0xf4e7('0x65')])[_0xf4e7('0x28')](function(){if(_[_0xf4e7('0x85')](_0xa2d607['query'][_0xf4e7('0x65')])){for(var _0x4516b5=0x0;_0x4516b5<_0xa2d607[_0xf4e7('0x35')][_0xf4e7('0x65')][_0xf4e7('0x3b')];_0x4516b5+=0x1){socket['emit']('userOpenchannelQueue:remove',{'UserId':Number(_0xa2d607['query'][_0xf4e7('0x65')][_0x4516b5]),'OpenchannelQueueId':Number(_0xa2d607[_0xf4e7('0x49')]['id'])});}}else{socket[_0xf4e7('0x6f')]('userOpenchannelQueue:remove',{'UserId':Number(_0xa2d607[_0xf4e7('0x35')][_0xf4e7('0x65')]),'OpenchannelQueueId':Number(_0xa2d607[_0xf4e7('0x49')]['id'])});}});}})[_0xf4e7('0x28')](respondWithStatusCode(_0x7fca6d,null))[_0xf4e7('0x47')](handleError(_0x7fca6d,null));};exports['getAgents']=function(_0x6cf419,_0x35f69e,_0xf631da){var _0x429527={};var _0x367da9={};var _0x3324ab;var _0x45ef6f;return db[_0xf4e7('0x45')][_0xf4e7('0x62')]({'where':{'id':_0x6cf419[_0xf4e7('0x49')]['id']}})['then'](handleEntityNotFound(_0x35f69e,null))[_0xf4e7('0x28')](function(_0x4a1789){if(_0x4a1789){_0x3324ab=_0x4a1789;_0x367da9[_0xf4e7('0x33')]=_[_0xf4e7('0x36')](db[_0xf4e7('0x59')][_0xf4e7('0x30')]);_0x367da9['query']=_[_0xf4e7('0x36')](_0x6cf419[_0xf4e7('0x35')]);_0x367da9['filters']=_['intersection'](_0x367da9[_0xf4e7('0x33')],_0x367da9[_0xf4e7('0x35')]);_0x429527[_0xf4e7('0x39')]=_[_0xf4e7('0x38')](_0x367da9['model'],qs[_0xf4e7('0x3a')](_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x3a')]));_0x429527[_0xf4e7('0x39')]=_0x429527[_0xf4e7('0x39')][_0xf4e7('0x3b')]?_0x429527[_0xf4e7('0x39')]:_0x367da9['model'];_0x429527['order']=qs[_0xf4e7('0x3f')](_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x3f')]);_0x429527[_0xf4e7('0x40')]=qs[_0xf4e7('0x37')](_[_0xf4e7('0x41')](_0x6cf419[_0xf4e7('0x35')],_0x367da9[_0xf4e7('0x37')]));if(_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x42')]){_0x429527['where']=_[_0xf4e7('0x43')](_0x429527[_0xf4e7('0x40')],{'$or':_[_0xf4e7('0x34')](_0x429527[_0xf4e7('0x39')],function(_0x5ed1fb){var _0x2b5095={};_0x2b5095[_0x5ed1fb]={'$like':'%'+_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x42')]+'%'};return _0x2b5095;})});}_0x429527=_[_0xf4e7('0x43')]({},_0x429527,_0x6cf419[_0xf4e7('0x4b')]);return _0x3324ab['getAgents'](_0x429527);}})[_0xf4e7('0x28')](function(_0x4d783d){if(_0x4d783d){_0x45ef6f=_0x4d783d[_0xf4e7('0x3b')];if(!_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x3c')](_0xf4e7('0x3d'))){_0x429527[_0xf4e7('0x22')]=qs[_0xf4e7('0x22')](_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x22')]);_0x429527[_0xf4e7('0x21')]=qs[_0xf4e7('0x21')](_0x6cf419[_0xf4e7('0x35')][_0xf4e7('0x21')]);}return _0x3324ab[_0xf4e7('0x86')](_0x429527);}})[_0xf4e7('0x28')](function(_0x239037){if(_0x239037){return _0x239037?{'count':_0x45ef6f,'rows':_0x239037}:null;}})[_0xf4e7('0x28')](respondWithResult(_0x35f69e,null))[_0xf4e7('0x47')](handleError(_0x35f69e,null));}; \ No newline at end of file +var _0xe6ff=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','./openchannelQueue.socket','register','status','end','json','count','offset','set','Content-Range','apply','save','then','destroy','get','OpenchannelQueues','UserProfileResource','sendStatus','error','stack','name','index','map','OpenchannelQueue','fieldName','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','findAll','rows','params','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','pick','OpenchannelQueueId','UserOpenchannelQueue','User','findAndCountAll','UserId','agent','openchannelPause','createdAt','format','SIP','updatedAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','each','findOrCreate','forEach','userOpenchannelQueue:save','select','field','team_has_openchannel_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','push','toString','SELECT','every','includes','union','compact','value','removeTeams','isEmpty','emit','userOpenchannelQueue:remove','addAgents','omit','spread','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x136189,_0x5376bc){var _0x41d71d=function(_0x2c1fb1){while(--_0x2c1fb1){_0x136189['push'](_0x136189['shift']());}};_0x41d71d(++_0x5376bc);}(_0xe6ff,0x18d));var _0xfe6f=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe6ff[_0x42cae2];return _0x5f256f;};'use strict';var pdf=require(_0xfe6f('0x0'));var emlformat=require(_0xfe6f('0x1'));var rimraf=require(_0xfe6f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfe6f('0x3'));var rp=require(_0xfe6f('0x4'));var moment=require(_0xfe6f('0x5'));var BPromise=require(_0xfe6f('0x6'));var Mustache=require(_0xfe6f('0x7'));var util=require(_0xfe6f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xfe6f('0x9'));var ejs=require(_0xfe6f('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xfe6f('0xb'));var crypto=require(_0xfe6f('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfe6f('0xd'));var toCsv=require('to-csv');var querystring=require(_0xfe6f('0xe'));var Papa=require(_0xfe6f('0xf'));var Redis=require(_0xfe6f('0x10'));var authService=require(_0xfe6f('0x11'));var qs=require(_0xfe6f('0x12'));var as=require(_0xfe6f('0x13'));var hardwareService=require(_0xfe6f('0x14'));var logger=require(_0xfe6f('0x15'))('api');var utils=require(_0xfe6f('0x16'));var config=require(_0xfe6f('0x17'));var db=require(_0xfe6f('0x18'))['db'];config[_0xfe6f('0x19')]=_[_0xfe6f('0x1a')](config[_0xfe6f('0x19')],{'host':_0xfe6f('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfe6f('0x1c'))[_0xfe6f('0x1d')](socket);function respondWithStatusCode(_0x46a1b9,_0x6c189a){_0x6c189a=_0x6c189a||0xcc;return function(_0x50c869){if(_0x50c869){return _0x46a1b9['sendStatus'](_0x6c189a);}return _0x46a1b9[_0xfe6f('0x1e')](_0x6c189a)[_0xfe6f('0x1f')]();};}function respondWithResult(_0x509042,_0x4be08a){_0x4be08a=_0x4be08a||0xc8;return function(_0x291482){if(_0x291482){return _0x509042['status'](_0x4be08a)[_0xfe6f('0x20')](_0x291482);}};}function respondWithFilteredResult(_0x4a830a,_0x2f290d){return function(_0x19918b){if(_0x19918b){var _0x11762b=_0x19918b[_0xfe6f('0x21')],_0x2f9a2a=_0x2f290d[_0xfe6f('0x22')],_0xdaaee=_0x2f290d['offset']+_0x2f290d['limit'],_0x6bb941;if(_0xdaaee>=_0x11762b){_0xdaaee=_0x11762b;_0x6bb941=0xc8;}else{_0x6bb941=0xce;}_0x4a830a[_0xfe6f('0x1e')](_0x6bb941);return _0x4a830a[_0xfe6f('0x23')](_0xfe6f('0x24'),_0x2f9a2a+'-'+_0xdaaee+'/'+_0x11762b)[_0xfe6f('0x20')](_0x19918b);}return null;};}function patchUpdates(_0x294f09){return function(_0x3399f8){try{jsonpatch[_0xfe6f('0x25')](_0x3399f8,_0x294f09,!![]);}catch(_0x4b0582){return BPromise['reject'](_0x4b0582);}return _0x3399f8[_0xfe6f('0x26')]();};}function saveUpdates(_0x2c8965,_0x122e9b){return function(_0x1e94ff){if(_0x1e94ff){return _0x1e94ff['update'](_0x2c8965)[_0xfe6f('0x27')](function(_0x2a25dd){return _0x2a25dd;});}return null;};}function removeEntity(_0x21072e,_0x44fe9c){return function(_0x4cfa9c){if(_0x4cfa9c){return _0x4cfa9c[_0xfe6f('0x28')]()[_0xfe6f('0x27')](function(){var _0x4ad184=_0x4cfa9c[_0xfe6f('0x29')]({'plain':!![]});var _0x2b2aec=_0xfe6f('0x2a');return db[_0xfe6f('0x2b')]['destroy']({'where':{'type':_0x2b2aec,'resourceId':_0x4ad184['id']}})[_0xfe6f('0x27')](function(){return _0x4cfa9c;});})['then'](function(){_0x21072e[_0xfe6f('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e889f,_0x2b0aee){return function(_0x51b0ec){if(!_0x51b0ec){_0x3e889f[_0xfe6f('0x2c')](0x194);}return _0x51b0ec;};}function handleError(_0x413f81,_0x5d309c){_0x5d309c=_0x5d309c||0x1f4;return function(_0x43d4ea){logger[_0xfe6f('0x2d')](_0x43d4ea[_0xfe6f('0x2e')]);if(_0x43d4ea[_0xfe6f('0x2f')]){delete _0x43d4ea['name'];}_0x413f81[_0xfe6f('0x1e')](_0x5d309c)['send'](_0x43d4ea);};}exports[_0xfe6f('0x30')]=function(_0x249c27,_0xbceb76){var _0x1eff5d={},_0x43bc86={},_0x2dbbce={'count':0x0,'rows':[]};var _0x47478c=_[_0xfe6f('0x31')](db[_0xfe6f('0x32')]['rawAttributes'],function(_0x34fa66){return{'name':_0x34fa66[_0xfe6f('0x33')],'type':_0x34fa66[_0xfe6f('0x34')]['key']};});_0x43bc86['model']=_[_0xfe6f('0x31')](_0x47478c,_0xfe6f('0x2f'));_0x43bc86[_0xfe6f('0x35')]=_[_0xfe6f('0x36')](_0x249c27[_0xfe6f('0x35')]);_0x43bc86[_0xfe6f('0x37')]=_[_0xfe6f('0x38')](_0x43bc86[_0xfe6f('0x39')],_0x43bc86[_0xfe6f('0x35')]);_0x1eff5d[_0xfe6f('0x3a')]=_['intersection'](_0x43bc86[_0xfe6f('0x39')],qs[_0xfe6f('0x3b')](_0x249c27['query'][_0xfe6f('0x3b')]));_0x1eff5d[_0xfe6f('0x3a')]=_0x1eff5d['attributes'][_0xfe6f('0x3c')]?_0x1eff5d[_0xfe6f('0x3a')]:_0x43bc86[_0xfe6f('0x39')];if(!_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x3d')](_0xfe6f('0x3e'))){_0x1eff5d['limit']=qs[_0xfe6f('0x3f')](_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x3f')]);_0x1eff5d[_0xfe6f('0x22')]=qs['offset'](_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x22')]);}_0x1eff5d[_0xfe6f('0x40')]=qs[_0xfe6f('0x41')](_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x41')]);_0x1eff5d[_0xfe6f('0x42')]=qs[_0xfe6f('0x37')](_['pick'](_0x249c27[_0xfe6f('0x35')],_0x43bc86[_0xfe6f('0x37')]));if(_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x43')]){_0x1eff5d[_0xfe6f('0x42')]=_['merge'](_0x1eff5d['where'],{'$or':_[_0xfe6f('0x31')](_0x47478c,function(_0x47df1c){if(_0x47df1c[_0xfe6f('0x34')]!==_0xfe6f('0x44')){var _0x3b682c={};_0x3b682c[_0x47df1c[_0xfe6f('0x2f')]]={'$like':'%'+_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x43')]+'%'};return _0x3b682c;}})});}_0x1eff5d=_[_0xfe6f('0x45')]({},_0x1eff5d,_0x249c27[_0xfe6f('0x46')]);var _0xb00864={'where':_0x1eff5d[_0xfe6f('0x42')]};return db[_0xfe6f('0x32')][_0xfe6f('0x21')](_0xb00864)[_0xfe6f('0x27')](function(_0x328424){_0x2dbbce['count']=_0x328424;if(_0x249c27[_0xfe6f('0x35')][_0xfe6f('0x47')]){_0x1eff5d['include']=[{'all':!![]}];}return db[_0xfe6f('0x32')][_0xfe6f('0x48')](_0x1eff5d);})['then'](function(_0x4ed4fd){_0x2dbbce[_0xfe6f('0x49')]=_0x4ed4fd;return _0x2dbbce;})['then'](respondWithFilteredResult(_0xbceb76,_0x1eff5d))['catch'](handleError(_0xbceb76,null));};exports['show']=function(_0x446cdd,_0x39b2b8){var _0x2e1558={'raw':!![],'where':{'id':_0x446cdd[_0xfe6f('0x4a')]['id']}},_0x515183={};_0x515183[_0xfe6f('0x39')]=_[_0xfe6f('0x36')](db['OpenchannelQueue'][_0xfe6f('0x4b')]);_0x515183[_0xfe6f('0x35')]=_[_0xfe6f('0x36')](_0x446cdd[_0xfe6f('0x35')]);_0x515183[_0xfe6f('0x37')]=_[_0xfe6f('0x38')](_0x515183[_0xfe6f('0x39')],_0x515183[_0xfe6f('0x35')]);_0x2e1558['attributes']=_[_0xfe6f('0x38')](_0x515183[_0xfe6f('0x39')],qs[_0xfe6f('0x3b')](_0x446cdd[_0xfe6f('0x35')]['fields']));_0x2e1558[_0xfe6f('0x3a')]=_0x2e1558[_0xfe6f('0x3a')][_0xfe6f('0x3c')]?_0x2e1558['attributes']:_0x515183['model'];if(_0x446cdd[_0xfe6f('0x35')][_0xfe6f('0x47')]){_0x2e1558['include']=[{'all':!![]}];}_0x2e1558=_[_0xfe6f('0x45')]({},_0x2e1558,_0x446cdd[_0xfe6f('0x46')]);return db[_0xfe6f('0x32')][_0xfe6f('0x4c')](_0x2e1558)['then'](handleEntityNotFound(_0x39b2b8,null))['then'](respondWithResult(_0x39b2b8,null))[_0xfe6f('0x4d')](handleError(_0x39b2b8,null));};exports[_0xfe6f('0x4e')]=function(_0x1f39de,_0x28b7d3){return db[_0xfe6f('0x32')]['create'](_0x1f39de[_0xfe6f('0x4f')],{})[_0xfe6f('0x27')](function(_0x46cf4b){var _0x1b7164=_0x1f39de[_0xfe6f('0x50')][_0xfe6f('0x29')]({'plain':!![]});if(!_0x1b7164)throw new Error(_0xfe6f('0x51'));if(_0x1b7164[_0xfe6f('0x52')]===_0xfe6f('0x50')){var _0x96e01f=_0x46cf4b[_0xfe6f('0x29')]({'plain':!![]});var _0x219d66=_0xfe6f('0x2a');return db['UserProfileSection'][_0xfe6f('0x4c')]({'where':{'name':_0x219d66,'userProfileId':_0x1b7164[_0xfe6f('0x53')]},'raw':!![]})[_0xfe6f('0x27')](function(_0x1cb450){if(_0x1cb450&&_0x1cb450['autoAssociation']===0x0){return db[_0xfe6f('0x2b')][_0xfe6f('0x4e')]({'name':_0x96e01f[_0xfe6f('0x2f')],'resourceId':_0x96e01f['id'],'type':_0x1cb450[_0xfe6f('0x2f')],'sectionId':_0x1cb450['id']},{})[_0xfe6f('0x27')](function(){return _0x46cf4b;});}else{return _0x46cf4b;}})[_0xfe6f('0x4d')](function(_0x18c46b){logger[_0xfe6f('0x2d')](_0xfe6f('0x54'),_0x18c46b);throw _0x18c46b;});}return _0x46cf4b;})[_0xfe6f('0x27')](respondWithResult(_0x28b7d3,0xc9))[_0xfe6f('0x4d')](handleError(_0x28b7d3,null));};exports[_0xfe6f('0x55')]=function(_0x1ad420,_0xfe9670){if(_0x1ad420[_0xfe6f('0x4f')]['id']){delete _0x1ad420[_0xfe6f('0x4f')]['id'];}return db[_0xfe6f('0x32')][_0xfe6f('0x4c')]({'where':{'id':_0x1ad420[_0xfe6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0xfe9670,null))[_0xfe6f('0x27')](saveUpdates(_0x1ad420[_0xfe6f('0x4f')],null))[_0xfe6f('0x27')](respondWithResult(_0xfe9670,null))['catch'](handleError(_0xfe9670,null));};exports['destroy']=function(_0x32e93b,_0x5e5943){return db[_0xfe6f('0x32')]['find']({'where':{'id':_0x32e93b[_0xfe6f('0x4a')]['id']}})[_0xfe6f('0x27')](handleEntityNotFound(_0x5e5943,null))[_0xfe6f('0x27')](removeEntity(_0x5e5943,null))[_0xfe6f('0x4d')](handleError(_0x5e5943,null));};exports[_0xfe6f('0x56')]=function(_0x357d4f,_0x552711){return db['OpenchannelQueue']['describe']()['then'](respondWithResult(_0x552711,null))[_0xfe6f('0x4d')](handleError(_0x552711,null));};exports[_0xfe6f('0x57')]=function(_0x34fb42,_0x2303d7,_0x31678f){var _0xc1e5ae={'raw':!![],'where':{}},_0x12f7e9={},_0x2170a3;return db['OpenchannelQueue'][_0xfe6f('0x58')]({'where':{'id':_0x34fb42[_0xfe6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2303d7,null))[_0xfe6f('0x27')](function(_0x4ea83f){if(_0x4ea83f){_0x2170a3=_0x4ea83f[_0xfe6f('0x29')]({'plain':!![]});_0x12f7e9[_0xfe6f('0x39')]=_['keys'](db['UserOpenchannelQueue']['rawAttributes']);_0x12f7e9[_0xfe6f('0x35')]=_['keys'](_0x34fb42[_0xfe6f('0x35')]);_0x12f7e9[_0xfe6f('0x37')]=_[_0xfe6f('0x38')](_0x12f7e9[_0xfe6f('0x39')],_0x12f7e9[_0xfe6f('0x35')]);_0xc1e5ae[_0xfe6f('0x3a')]=_[_0xfe6f('0x38')](_0x12f7e9['model'],qs[_0xfe6f('0x3b')](_0x34fb42['query']['fields']));_0xc1e5ae[_0xfe6f('0x3a')]=_0xc1e5ae[_0xfe6f('0x3a')][_0xfe6f('0x3c')]?_0xc1e5ae[_0xfe6f('0x3a')]:_0x12f7e9[_0xfe6f('0x39')];if(!_0x34fb42[_0xfe6f('0x35')][_0xfe6f('0x3d')](_0xfe6f('0x3e'))){_0xc1e5ae['limit']=qs[_0xfe6f('0x3f')](_0x34fb42[_0xfe6f('0x35')][_0xfe6f('0x3f')]);_0xc1e5ae[_0xfe6f('0x22')]=qs[_0xfe6f('0x22')](_0x34fb42[_0xfe6f('0x35')][_0xfe6f('0x22')]);}_0xc1e5ae[_0xfe6f('0x40')]=qs[_0xfe6f('0x41')](_0x34fb42['query'][_0xfe6f('0x41')]);_0xc1e5ae[_0xfe6f('0x42')]=qs[_0xfe6f('0x37')](_[_0xfe6f('0x59')](_0x34fb42[_0xfe6f('0x35')],_0x12f7e9['filters']));_0xc1e5ae[_0xfe6f('0x42')][_0xfe6f('0x5a')]=_0x4ea83f['id'];if(_0x34fb42[_0xfe6f('0x35')][_0xfe6f('0x43')]){_0xc1e5ae['where']=_[_0xfe6f('0x45')](_0xc1e5ae[_0xfe6f('0x42')],{'$or':_[_0xfe6f('0x31')](_0xc1e5ae[_0xfe6f('0x3a')],function(_0x3f15e5){var _0x3cd25b={};_0x3cd25b[_0x3f15e5]={'$like':'%'+_0x34fb42[_0xfe6f('0x35')]['filter']+'%'};return _0x3cd25b;})});}_0xc1e5ae=_['merge']({},_0xc1e5ae,_0x34fb42['options']);return db[_0xfe6f('0x5b')][_0xfe6f('0x48')](_0xc1e5ae);}})[_0xfe6f('0x27')](function(_0xdbf2f5){if(_0xdbf2f5){return db[_0xfe6f('0x5c')][_0xfe6f('0x5d')]({'where':{'id':_[_0xfe6f('0x31')](_0xdbf2f5,_0xfe6f('0x5e')),'role':_0xfe6f('0x5f')},'attributes':['id','name',_0xfe6f('0x60'),'updatedAt',_0xfe6f('0x61')]});}})[_0xfe6f('0x27')](function(_0x835f82){if(_0x835f82){return{'count':_0x835f82[_0xfe6f('0x21')],'rows':_['map'](_0x835f82[_0xfe6f('0x49')],function(_0x5db97a){return{'membername':_0x5db97a[_0xfe6f('0x2f')],'UserId':_0x5db97a['id'],'queue_name':_0x2170a3[_0xfe6f('0x2f')],'OpenchannelQueueId':_0x2170a3['id'],'interface':util[_0xfe6f('0x62')]('%s/%s',_0xfe6f('0x63'),_0x5db97a[_0xfe6f('0x2f')]),'penalty':0x0,'paused':_0x5db97a[_0xfe6f('0x60')],'createdAt':_0x5db97a[_0xfe6f('0x61')],'updatedAt':_0x5db97a[_0xfe6f('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xfe6f('0x27')](respondWithFilteredResult(_0x2303d7,_0xc1e5ae))[_0xfe6f('0x4d')](handleError(_0x2303d7,null));};exports[_0xfe6f('0x65')]=function(_0x4efe2e,_0x3f9836,_0x5721bb){var _0x23bc58={};var _0xc8c9c0={};var _0x43ce21;var _0x556a52;return db[_0xfe6f('0x32')][_0xfe6f('0x58')]({'where':{'id':_0x4efe2e[_0xfe6f('0x4a')]['id']}})[_0xfe6f('0x27')](handleEntityNotFound(_0x3f9836,null))[_0xfe6f('0x27')](function(_0x164b78){if(_0x164b78){_0x43ce21=_0x164b78;_0xc8c9c0[_0xfe6f('0x39')]=_['keys'](db[_0xfe6f('0x66')][_0xfe6f('0x4b')]);_0xc8c9c0[_0xfe6f('0x35')]=_['keys'](_0x4efe2e[_0xfe6f('0x35')]);_0xc8c9c0[_0xfe6f('0x37')]=_['intersection'](_0xc8c9c0[_0xfe6f('0x39')],_0xc8c9c0[_0xfe6f('0x35')]);_0x23bc58[_0xfe6f('0x3a')]=_[_0xfe6f('0x38')](_0xc8c9c0[_0xfe6f('0x39')],qs[_0xfe6f('0x3b')](_0x4efe2e[_0xfe6f('0x35')][_0xfe6f('0x3b')]));_0x23bc58[_0xfe6f('0x3a')]=_0x23bc58[_0xfe6f('0x3a')][_0xfe6f('0x3c')]?_0x23bc58[_0xfe6f('0x3a')]:_0xc8c9c0[_0xfe6f('0x39')];_0x23bc58[_0xfe6f('0x40')]=qs[_0xfe6f('0x41')](_0x4efe2e['query'][_0xfe6f('0x41')]);_0x23bc58['where']=qs[_0xfe6f('0x37')](_[_0xfe6f('0x59')](_0x4efe2e[_0xfe6f('0x35')],_0xc8c9c0[_0xfe6f('0x37')]));if(_0x4efe2e['query'][_0xfe6f('0x43')]){_0x23bc58['where']=_[_0xfe6f('0x45')](_0x23bc58[_0xfe6f('0x42')],{'$or':_['map'](_0x23bc58[_0xfe6f('0x3a')],function(_0x16ed7c){var _0x3fce59={};_0x3fce59[_0x16ed7c]={'$like':'%'+_0x4efe2e[_0xfe6f('0x35')][_0xfe6f('0x43')]+'%'};return _0x3fce59;})});}_0x23bc58=_[_0xfe6f('0x45')]({},_0x23bc58,_0x4efe2e[_0xfe6f('0x46')]);return _0x43ce21[_0xfe6f('0x65')](_0x23bc58);}})[_0xfe6f('0x27')](function(_0x5490ce){if(_0x5490ce){_0x556a52=_0x5490ce[_0xfe6f('0x3c')];if(!_0x4efe2e['query'][_0xfe6f('0x3d')](_0xfe6f('0x3e'))){_0x23bc58[_0xfe6f('0x3f')]=qs[_0xfe6f('0x3f')](_0x4efe2e['query'][_0xfe6f('0x3f')]);_0x23bc58[_0xfe6f('0x22')]=qs[_0xfe6f('0x22')](_0x4efe2e['query']['offset']);}return _0x43ce21['getTeams'](_0x23bc58);}})[_0xfe6f('0x27')](function(_0x373287){if(_0x373287){return _0x373287?{'count':_0x556a52,'rows':_0x373287}:null;}})[_0xfe6f('0x27')](respondWithResult(_0x3f9836,null))[_0xfe6f('0x4d')](handleError(_0x3f9836,null));};exports[_0xfe6f('0x67')]=function(_0x55c43b,_0x27f98b,_0x3eec0a){var _0x4ffd3d=_0x55c43b[_0xfe6f('0x4f')][_0xfe6f('0x68')];return db[_0xfe6f('0x66')][_0xfe6f('0x48')]({'where':{'id':_0x4ffd3d},'attributes':['id'],'include':[{'model':db[_0xfe6f('0x5c')],'as':'Agents','attributes':['id',_0xfe6f('0x2f'),_0xfe6f('0x69'),_0xfe6f('0x6a'),_0xfe6f('0x6b')],'raw':!![]}]})['then'](function(_0x5d01f9){if(_0x5d01f9){var _0x209d06=_[_0xfe6f('0x6c')](_0x5d01f9,function(_0x576b9a){var _0x234d50=_0x576b9a['get']({'plain':!![]});return _0x234d50[_0xfe6f('0x6d')];});return db['OpenchannelQueue'][_0xfe6f('0x4c')]({'where':{'id':_0x55c43b[_0xfe6f('0x4a')]['id']}})[_0xfe6f('0x27')](function(_0x22014a){return db[_0xfe6f('0x6e')]['transaction'](function(_0x6aa047){return _0x22014a[_0xfe6f('0x67')](_0x4ffd3d,{'transaction':_0x6aa047})[_0xfe6f('0x27')](function(){return BPromise[_0xfe6f('0x6f')](_0x209d06,function(_0x25ab99){return db[_0xfe6f('0x5b')][_0xfe6f('0x70')]({'where':{'UserId':_0x25ab99['id'],'OpenchannelQueueId':_0x55c43b['params']['id']},'transaction':_0x6aa047});});})['then'](function(){_0x209d06[_0xfe6f('0x71')](function(_0x1265c6){socket['emit'](_0xfe6f('0x72'),{'UserId':_0x1265c6['id'],'OpenchannelQueueId':_0x22014a['id']});});});});});}})[_0xfe6f('0x27')](respondWithStatusCode(_0x27f98b,null))[_0xfe6f('0x4d')](handleError(_0x27f98b,null));};exports['removeTeams']=function(_0x9cb602,_0x276c67,_0x4ac052){return db['Team'][_0xfe6f('0x48')]({'where':{'id':_0x9cb602[_0xfe6f('0x35')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfe6f('0x5c')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfe6f('0x27')](handleEntityNotFound(_0x276c67,null))[_0xfe6f('0x27')](function(_0x43804f){var _0x4d3230=_['map'](_0x43804f,'id');var _0x32f484=[];var _0x33f66a=[];var _0x445928=squel[_0xfe6f('0x73')]();_0x445928[_0xfe6f('0x74')]('tq.TeamId')['from'](_0xfe6f('0x75'),'tq')[_0xfe6f('0x76')](_0xfe6f('0x77'),'ut',_0xfe6f('0x78'))[_0xfe6f('0x42')]('OpenchannelQueueId\x20=\x20?',_0x9cb602['params']['id']);for(var _0x3f3e31=0x0;_0x3f3e31<_0x43804f[_0xfe6f('0x3c')];_0x3f3e31+=0x1){let _0x113a36=_0x43804f[_0x3f3e31];for(var _0xa7784c=0x0;_0xa7784c<_0x113a36[_0xfe6f('0x6d')][_0xfe6f('0x3c')];_0xa7784c+=0x1){let _0x4038cc=_0x113a36[_0xfe6f('0x6d')][_0xa7784c];var _0x47876a=_0x445928[_0xfe6f('0x79')]();_0x47876a[_0xfe6f('0x42')]('ut.UserId\x20=\x20?',_0x4038cc['id']);_0x33f66a[_0xfe6f('0x7a')](db['sequelize'][_0xfe6f('0x35')](_0x47876a[_0xfe6f('0x7b')](),{'type':db[_0xfe6f('0x6e')]['QueryTypes'][_0xfe6f('0x7c')]})[_0xfe6f('0x27')](function(_0x2923a7){if(_0x2923a7[_0xfe6f('0x3c')]===0x1){return _0x4038cc['id'];}else{var _0x1fb4d7=_[_0xfe6f('0x7d')](_['map'](_0x2923a7,'TeamId'),function(_0x4a32b8){return _[_0xfe6f('0x7e')](_0x4d3230,_0x4a32b8);});if(_0x1fb4d7){return _0x4038cc['id'];}}}));}}return BPromise['all'](_0x33f66a)['then'](function(_0x46b9f6){_0x32f484=_(_0x32f484)[_0xfe6f('0x7f')](_0x46b9f6)[_0xfe6f('0x80')]()[_0xfe6f('0x81')]();return db['OpenchannelQueue']['find']({'where':{'id':_0x9cb602[_0xfe6f('0x4a')]['id']}})[_0xfe6f('0x27')](function(_0x14aa0c){return db[_0xfe6f('0x6e')]['transaction'](function(_0x19420d){return _0x14aa0c[_0xfe6f('0x82')](_0x9cb602['query'][_0xfe6f('0x68')],{'transaction':_0x19420d})[_0xfe6f('0x27')](function(){if(!_[_0xfe6f('0x83')](_0x32f484)){return _0x14aa0c['removeAgents'](_0x32f484,{'transaction':_0x19420d});}})[_0xfe6f('0x27')](function(){_0x32f484[_0xfe6f('0x71')](function(_0x351ef3){socket[_0xfe6f('0x84')](_0xfe6f('0x85'),{'UserId':_0x351ef3,'OpenchannelQueueId':_0x14aa0c['id']});});});});});});})[_0xfe6f('0x27')](respondWithStatusCode(_0x276c67,null))['catch'](handleError(_0x276c67,null));};exports[_0xfe6f('0x86')]=function(_0x3aa28f,_0x1ef8d6,_0x439399){return db[_0xfe6f('0x32')][_0xfe6f('0x4c')]({'where':{'id':_0x3aa28f[_0xfe6f('0x4a')]['id']}})[_0xfe6f('0x27')](handleEntityNotFound(_0x1ef8d6,null))['then'](function(_0x51d4e7){if(_0x51d4e7){return _0x51d4e7[_0xfe6f('0x86')](_0x3aa28f[_0xfe6f('0x4f')]['ids'],_[_0xfe6f('0x87')](_0x3aa28f['body'],[_0xfe6f('0x68'),'id'])||{})[_0xfe6f('0x88')](function(_0x1f3f63){for(var _0x561e73=0x0;_0x561e73<_0x3aa28f[_0xfe6f('0x4f')][_0xfe6f('0x68')][_0xfe6f('0x3c')];_0x561e73+=0x1){socket['emit'](_0xfe6f('0x72'),{'UserId':_0x3aa28f[_0xfe6f('0x4f')][_0xfe6f('0x68')][_0x561e73],'OpenchannelQueueId':_0x3aa28f['params']['id']});}return _0x1f3f63;});}})['then'](respondWithResult(_0x1ef8d6,null))['catch'](handleError(_0x1ef8d6,null));};exports['removeAgents']=function(_0x336852,_0x3e3ca8,_0x43b23c){return db[_0xfe6f('0x32')][_0xfe6f('0x4c')]({'where':{'id':_0x336852['params']['id']}})['then'](handleEntityNotFound(_0x3e3ca8,null))[_0xfe6f('0x27')](function(_0x5bd6eb){if(_0x5bd6eb){return _0x5bd6eb['removeAgents'](_0x336852['query'][_0xfe6f('0x68')])[_0xfe6f('0x27')](function(){if(_['isArray'](_0x336852['query'][_0xfe6f('0x68')])){for(var _0x4e451f=0x0;_0x4e451f<_0x336852[_0xfe6f('0x35')]['ids']['length'];_0x4e451f+=0x1){socket['emit'](_0xfe6f('0x85'),{'UserId':Number(_0x336852[_0xfe6f('0x35')]['ids'][_0x4e451f]),'OpenchannelQueueId':Number(_0x336852[_0xfe6f('0x4a')]['id'])});}}else{socket['emit'](_0xfe6f('0x85'),{'UserId':Number(_0x336852[_0xfe6f('0x35')][_0xfe6f('0x68')]),'OpenchannelQueueId':Number(_0x336852['params']['id'])});}});}})[_0xfe6f('0x27')](respondWithStatusCode(_0x3e3ca8,null))[_0xfe6f('0x4d')](handleError(_0x3e3ca8,null));};exports[_0xfe6f('0x89')]=function(_0x7e5fa5,_0x31215b,_0x1ddbd7){var _0x1c773d={};var _0x19228c={};var _0x5e405b;var _0x531c7b;return db['OpenchannelQueue'][_0xfe6f('0x58')]({'where':{'id':_0x7e5fa5[_0xfe6f('0x4a')]['id']}})['then'](handleEntityNotFound(_0x31215b,null))[_0xfe6f('0x27')](function(_0x347bd5){if(_0x347bd5){_0x5e405b=_0x347bd5;_0x19228c[_0xfe6f('0x39')]=_[_0xfe6f('0x36')](db[_0xfe6f('0x5c')][_0xfe6f('0x4b')]);_0x19228c[_0xfe6f('0x35')]=_[_0xfe6f('0x36')](_0x7e5fa5[_0xfe6f('0x35')]);_0x19228c[_0xfe6f('0x37')]=_[_0xfe6f('0x38')](_0x19228c[_0xfe6f('0x39')],_0x19228c[_0xfe6f('0x35')]);_0x1c773d[_0xfe6f('0x3a')]=_[_0xfe6f('0x38')](_0x19228c[_0xfe6f('0x39')],qs[_0xfe6f('0x3b')](_0x7e5fa5[_0xfe6f('0x35')][_0xfe6f('0x3b')]));_0x1c773d[_0xfe6f('0x3a')]=_0x1c773d['attributes'][_0xfe6f('0x3c')]?_0x1c773d[_0xfe6f('0x3a')]:_0x19228c['model'];_0x1c773d[_0xfe6f('0x40')]=qs[_0xfe6f('0x41')](_0x7e5fa5['query'][_0xfe6f('0x41')]);_0x1c773d[_0xfe6f('0x42')]=qs['filters'](_[_0xfe6f('0x59')](_0x7e5fa5[_0xfe6f('0x35')],_0x19228c[_0xfe6f('0x37')]));if(_0x7e5fa5['query'][_0xfe6f('0x43')]){_0x1c773d[_0xfe6f('0x42')]=_[_0xfe6f('0x45')](_0x1c773d[_0xfe6f('0x42')],{'$or':_[_0xfe6f('0x31')](_0x1c773d['attributes'],function(_0x1327d7){var _0x55d3ab={};_0x55d3ab[_0x1327d7]={'$like':'%'+_0x7e5fa5[_0xfe6f('0x35')][_0xfe6f('0x43')]+'%'};return _0x55d3ab;})});}_0x1c773d=_['merge']({},_0x1c773d,_0x7e5fa5['options']);return _0x5e405b[_0xfe6f('0x89')](_0x1c773d);}})['then'](function(_0xbf476b){if(_0xbf476b){_0x531c7b=_0xbf476b[_0xfe6f('0x3c')];if(!_0x7e5fa5[_0xfe6f('0x35')]['hasOwnProperty']('nolimit')){_0x1c773d[_0xfe6f('0x3f')]=qs['limit'](_0x7e5fa5[_0xfe6f('0x35')][_0xfe6f('0x3f')]);_0x1c773d[_0xfe6f('0x22')]=qs[_0xfe6f('0x22')](_0x7e5fa5['query'][_0xfe6f('0x22')]);}return _0x5e405b['getAgents'](_0x1c773d);}})[_0xfe6f('0x27')](function(_0x24debc){if(_0x24debc){return _0x24debc?{'count':_0x531c7b,'rows':_0x24debc}:null;}})['then'](respondWithResult(_0x31215b,null))[_0xfe6f('0x4d')](handleError(_0x31215b,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 82f7d12..fe12ed3 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 _0x35db=['../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','exports','events'];(function(_0xdcc206,_0x9c8f73){var _0x13e345=function(_0x104145){while(--_0x104145){_0xdcc206['push'](_0xdcc206['shift']());}};_0x13e345(++_0x9c8f73);}(_0x35db,0x107));var _0xb35d=function(_0x4a9edd,_0x3cb2fe){_0x4a9edd=_0x4a9edd-0x0;var _0x8321e6=_0x35db[_0x4a9edd];return _0x8321e6;};'use strict';var EventEmitter=require(_0xb35d('0x0'));var OpenchannelQueue=require(_0xb35d('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xb35d('0x2')](0x0);var events={'afterCreate':_0xb35d('0x3'),'afterUpdate':_0xb35d('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5a7055){return function(_0x16e450,_0xb70ca5,_0xee02b5){OpenchannelQueueEvents[_0xb35d('0x5')](_0x5a7055+':'+_0x16e450['id'],_0x16e450);OpenchannelQueueEvents[_0xb35d('0x5')](_0x5a7055,_0x16e450);_0xee02b5(null);};}for(var e in events){if(events[_0xb35d('0x6')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xb35d('0x7')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x3e5c=['../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','hasOwnProperty','exports','events'];(function(_0x3d9ee0,_0x3e106a){var _0x126719=function(_0x56d03f){while(--_0x56d03f){_0x3d9ee0['push'](_0x3d9ee0['shift']());}};_0x126719(++_0x3e106a);}(_0x3e5c,0xe9));var _0xc3e5=function(_0x60fbcf,_0x8bf696){_0x60fbcf=_0x60fbcf-0x0;var _0x4dd1a5=_0x3e5c[_0x60fbcf];return _0x4dd1a5;};'use strict';var EventEmitter=require(_0xc3e5('0x0'));var OpenchannelQueue=require(_0xc3e5('0x1'))['db'][_0xc3e5('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0xc3e5('0x3')](0x0);var events={'afterCreate':_0xc3e5('0x4'),'afterUpdate':_0xc3e5('0x5'),'afterDestroy':_0xc3e5('0x6')};function emitEvent(_0x530d89){return function(_0xaaf10d,_0x28afb8,_0x983c68){OpenchannelQueueEvents['emit'](_0x530d89+':'+_0xaaf10d['id'],_0xaaf10d);OpenchannelQueueEvents['emit'](_0x530d89,_0xaaf10d);_0x983c68(null);};}for(var e in events){if(events[_0xc3e5('0x7')](e)){var event=events[e];OpenchannelQueue['hook'](e,emitEvent(event));}}module[_0xc3e5('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 88a9f57..dce9260 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 _0xd5d8=['define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0xd5d8,0x1a3));var _0x8d5d=function(_0x903261,_0x5b1518){_0x903261=_0x903261-0x0;var _0x2aebf0=_0xd5d8[_0x903261];return _0x2aebf0;};'use strict';var _=require(_0x8d5d('0x0'));var util=require(_0x8d5d('0x1'));var logger=require(_0x8d5d('0x2'))(_0x8d5d('0x3'));var moment=require(_0x8d5d('0x4'));var BPromise=require(_0x8d5d('0x5'));var rp=require(_0x8d5d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8d5d('0x7'));var config=require(_0x8d5d('0x8'));var attributes=require('./openchannelQueue.attributes');module[_0x8d5d('0x9')]=function(_0x4b7a00,_0x51c8d5){return _0x4b7a00[_0x8d5d('0xa')]('OpenchannelQueue',attributes,{'tableName':'openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf186=['../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','api','bluebird','path','rimraf'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xf186,0x161));var _0x6f18=function(_0x221087,_0x111b2b){_0x221087=_0x221087-0x0;var _0x251247=_0xf186[_0x221087];return _0x251247;};'use strict';var _=require(_0x6f18('0x0'));var util=require(_0x6f18('0x1'));var logger=require(_0x6f18('0x2'))(_0x6f18('0x3'));var moment=require('moment');var BPromise=require(_0x6f18('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6f18('0x5'));var rimraf=require(_0x6f18('0x6'));var config=require(_0x6f18('0x7'));var attributes=require(_0x6f18('0x8'));module[_0x6f18('0x9')]=function(_0x1d2ada,_0x2b4300){return _0x1d2ada['define'](_0x6f18('0xa'),attributes,{'tableName':_0x6f18('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 44bb0f4..cb276ac 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 _0xe478=['attributes','model','then','GetOpenchannelQueue','catch','raw','ShowOpenchannelQueue','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','OpenchannelQueue','findAll','options','where','limit','include','map'];(function(_0x580a40,_0x5a34fa){var _0x220738=function(_0x4f72ce){while(--_0x4f72ce){_0x580a40['push'](_0x580a40['shift']());}};_0x220738(++_0x5a34fa);}(_0xe478,0x82));var _0x8e47=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xe478[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var util=require(_0x8e47('0x0'));var moment=require('moment');var BPromise=require(_0x8e47('0x1'));var rs=require(_0x8e47('0x2'));var fs=require('fs');var Redis=require(_0x8e47('0x3'));var db=require(_0x8e47('0x4'))['db'];var utils=require(_0x8e47('0x5'));var logger=require(_0x8e47('0x6'))(_0x8e47('0x7'));var config=require(_0x8e47('0x8'));var jayson=require(_0x8e47('0x9'));var client=jayson[_0x8e47('0xa')][_0x8e47('0xb')]({'port':0x232a});config[_0x8e47('0xc')]=_[_0x8e47('0xd')](config[_0x8e47('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8e47('0xc')]));require(_0x8e47('0xe'))[_0x8e47('0xf')](socket);function respondWithRpcPromise(_0x3b8c30,_0x86e8e4,_0x4293ab){return new BPromise(function(_0x24640e,_0x38cb2f){return client[_0x8e47('0x10')](_0x3b8c30,_0x4293ab)['then'](function(_0x494871){logger['info'](_0x8e47('0x11'),_0x86e8e4,_0x8e47('0x12'));logger[_0x8e47('0x13')](_0x8e47('0x14'),_0x86e8e4,'request\x20sent',JSON[_0x8e47('0x15')](_0x494871));if(_0x494871[_0x8e47('0x16')]){if(_0x494871[_0x8e47('0x16')][_0x8e47('0x17')]===0x1f4){logger['error'](_0x8e47('0x11'),_0x86e8e4,_0x494871[_0x8e47('0x16')]['message']);return _0x38cb2f(_0x494871[_0x8e47('0x16')][_0x8e47('0x18')]);}logger[_0x8e47('0x16')]('OpenchannelQueue,\x20%s,\x20%s',_0x86e8e4,_0x494871['error'][_0x8e47('0x18')]);return _0x24640e(_0x494871['error'][_0x8e47('0x18')]);}else{logger[_0x8e47('0x19')]('OpenchannelQueue,\x20%s,\x20%s',_0x86e8e4,_0x8e47('0x12'));_0x24640e(_0x494871[_0x8e47('0x1a')]['message']);}})['catch'](function(_0x1cb6e3){logger[_0x8e47('0x16')](_0x8e47('0x11'),_0x86e8e4,_0x1cb6e3);_0x38cb2f(_0x1cb6e3);});});}exports['GetOpenchannelQueue']=function(_0x3fb651){var _0xf16acf=this;return new Promise(function(_0x4ba491,_0xaa229f){return db[_0x8e47('0x1b')][_0x8e47('0x1c')]({'raw':_0x3fb651[_0x8e47('0x1d')]?_0x3fb651[_0x8e47('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x3fb651[_0x8e47('0x1d')]?_0x3fb651['options'][_0x8e47('0x1e')]||null:null,'attributes':_0x3fb651[_0x8e47('0x1d')]?_0x3fb651['options']['attributes']||null:null,'limit':_0x3fb651[_0x8e47('0x1d')]?_0x3fb651['options'][_0x8e47('0x1f')]||null:null,'include':_0x3fb651['options']?_0x3fb651[_0x8e47('0x1d')][_0x8e47('0x20')]?_[_0x8e47('0x21')](_0x3fb651[_0x8e47('0x1d')][_0x8e47('0x20')],function(_0x52f6c7){return{'model':db[_0x52f6c7['model']],'as':_0x52f6c7['as'],'attributes':_0x52f6c7[_0x8e47('0x22')],'include':_0x52f6c7[_0x8e47('0x20')]?_[_0x8e47('0x21')](_0x52f6c7[_0x8e47('0x20')],function(_0x241bcb){return{'model':db[_0x241bcb[_0x8e47('0x23')]],'as':_0x241bcb['as'],'attributes':_0x241bcb['attributes'],'include':_0x241bcb[_0x8e47('0x20')]?_['map'](_0x241bcb[_0x8e47('0x20')],function(_0x3386d9){return{'model':db[_0x3386d9['model']],'as':_0x3386d9['as'],'attributes':_0x3386d9['attributes']};}):[]};}):[]};}):[]:[]})[_0x8e47('0x24')](function(_0x4d932b){logger[_0x8e47('0x19')]('GetOpenchannelQueue',_0x3fb651);logger['debug'](_0x8e47('0x25'),_0x3fb651,JSON['stringify'](_0x4d932b));_0x4ba491(_0x4d932b);})[_0x8e47('0x26')](function(_0x482c8d){logger[_0x8e47('0x16')]('GetOpenchannelQueue',_0x482c8d[_0x8e47('0x18')],_0x3fb651);_0xaa229f(_0xf16acf[_0x8e47('0x16')](0x1f4,_0x482c8d[_0x8e47('0x18')]));});});};exports['ShowOpenchannelQueue']=function(_0x323da8){var _0x56e9cf=this;return new Promise(function(_0x1d164f,_0x38e9b0){return db[_0x8e47('0x1b')]['find']({'raw':_0x323da8[_0x8e47('0x1d')]?_0x323da8[_0x8e47('0x1d')][_0x8e47('0x27')]===undefined?!![]:![]:!![],'where':_0x323da8[_0x8e47('0x1d')]?_0x323da8['options']['where']||null:null,'attributes':_0x323da8[_0x8e47('0x1d')]?_0x323da8[_0x8e47('0x1d')][_0x8e47('0x22')]||null:null,'include':_0x323da8[_0x8e47('0x1d')]?_0x323da8['options'][_0x8e47('0x20')]?_[_0x8e47('0x21')](_0x323da8[_0x8e47('0x1d')][_0x8e47('0x20')],function(_0x90cda0){return{'model':db[_0x90cda0[_0x8e47('0x23')]],'as':_0x90cda0['as'],'attributes':_0x90cda0[_0x8e47('0x22')],'include':_0x90cda0[_0x8e47('0x20')]?_[_0x8e47('0x21')](_0x90cda0[_0x8e47('0x20')],function(_0x49c820){return{'model':db[_0x49c820[_0x8e47('0x23')]],'as':_0x49c820['as'],'attributes':_0x49c820[_0x8e47('0x22')],'include':_0x49c820['include']?_['map'](_0x49c820[_0x8e47('0x20')],function(_0x1b6745){return{'model':db[_0x1b6745[_0x8e47('0x23')]],'as':_0x1b6745['as'],'attributes':_0x1b6745[_0x8e47('0x22')]};}):[]};}):[]};}):[]:[]})[_0x8e47('0x24')](function(_0x2214b3){logger[_0x8e47('0x19')](_0x8e47('0x28'),_0x323da8);logger['debug'](_0x8e47('0x28'),_0x323da8,JSON['stringify'](_0x2214b3));_0x1d164f(_0x2214b3);})[_0x8e47('0x26')](function(_0x31e57d){logger[_0x8e47('0x16')]('ShowOpenchannelQueue',_0x31e57d[_0x8e47('0x18')],_0x323da8);_0x38e9b0(_0x56e9cf[_0x8e47('0x16')](0x1f4,_0x31e57d['message']));});});}; \ No newline at end of file +var _0x4867=['ShowOpenchannelQueue','find','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','redis','./openchannelQueue.socket','request','then','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetOpenchannelQueue','OpenchannelQueue','options','raw','where','attributes','limit','include','map','model'];(function(_0x4074f9,_0x316618){var _0x2b369c=function(_0x51a266){while(--_0x51a266){_0x4074f9['push'](_0x4074f9['shift']());}};_0x2b369c(++_0x316618);}(_0x4867,0x1ca));var _0x7486=function(_0x517586,_0xc97d01){_0x517586=_0x517586-0x0;var _0x4d7494=_0x4867[_0x517586];return _0x4d7494;};'use strict';var _=require(_0x7486('0x0'));var util=require(_0x7486('0x1'));var moment=require(_0x7486('0x2'));var BPromise=require(_0x7486('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7486('0x4'));var db=require(_0x7486('0x5'))['db'];var utils=require(_0x7486('0x6'));var logger=require(_0x7486('0x7'))('rpc');var config=require(_0x7486('0x8'));var jayson=require(_0x7486('0x9'));var client=jayson[_0x7486('0xa')]['http']({'port':0x232a});config['redis']=_[_0x7486('0xb')](config[_0x7486('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7486('0xc')]));require(_0x7486('0xd'))['register'](socket);function respondWithRpcPromise(_0x5ae167,_0x3bb1eb,_0x36377f){return new BPromise(function(_0x173585,_0x3ea495){return client[_0x7486('0xe')](_0x5ae167,_0x36377f)[_0x7486('0xf')](function(_0x310474){logger['info'](_0x7486('0x10'),_0x3bb1eb,_0x7486('0x11'));logger[_0x7486('0x12')](_0x7486('0x13'),_0x3bb1eb,'request\x20sent',JSON[_0x7486('0x14')](_0x310474));if(_0x310474[_0x7486('0x15')]){if(_0x310474['error'][_0x7486('0x16')]===0x1f4){logger['error'](_0x7486('0x10'),_0x3bb1eb,_0x310474['error'][_0x7486('0x17')]);return _0x3ea495(_0x310474[_0x7486('0x15')]['message']);}logger['error'](_0x7486('0x10'),_0x3bb1eb,_0x310474[_0x7486('0x15')][_0x7486('0x17')]);return _0x173585(_0x310474['error'][_0x7486('0x17')]);}else{logger[_0x7486('0x18')](_0x7486('0x10'),_0x3bb1eb,_0x7486('0x11'));_0x173585(_0x310474['result']['message']);}})[_0x7486('0x19')](function(_0x5bf027){logger[_0x7486('0x15')](_0x7486('0x10'),_0x3bb1eb,_0x5bf027);_0x3ea495(_0x5bf027);});});}exports[_0x7486('0x1a')]=function(_0x559087){var _0x249b98=this;return new Promise(function(_0x2c3184,_0x2c0ab9){return db[_0x7486('0x1b')]['findAll']({'raw':_0x559087['options']?_0x559087[_0x7486('0x1c')][_0x7486('0x1d')]===undefined?!![]:![]:!![],'where':_0x559087[_0x7486('0x1c')]?_0x559087[_0x7486('0x1c')][_0x7486('0x1e')]||null:null,'attributes':_0x559087[_0x7486('0x1c')]?_0x559087['options'][_0x7486('0x1f')]||null:null,'limit':_0x559087[_0x7486('0x1c')]?_0x559087[_0x7486('0x1c')][_0x7486('0x20')]||null:null,'include':_0x559087['options']?_0x559087[_0x7486('0x1c')][_0x7486('0x21')]?_[_0x7486('0x22')](_0x559087[_0x7486('0x1c')][_0x7486('0x21')],function(_0x40be00){return{'model':db[_0x40be00[_0x7486('0x23')]],'as':_0x40be00['as'],'attributes':_0x40be00[_0x7486('0x1f')],'include':_0x40be00['include']?_[_0x7486('0x22')](_0x40be00['include'],function(_0x4c6857){return{'model':db[_0x4c6857['model']],'as':_0x4c6857['as'],'attributes':_0x4c6857[_0x7486('0x1f')],'include':_0x4c6857[_0x7486('0x21')]?_[_0x7486('0x22')](_0x4c6857[_0x7486('0x21')],function(_0x16cdcb){return{'model':db[_0x16cdcb[_0x7486('0x23')]],'as':_0x16cdcb['as'],'attributes':_0x16cdcb[_0x7486('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7486('0xf')](function(_0x498227){logger[_0x7486('0x18')]('GetOpenchannelQueue',_0x559087);logger[_0x7486('0x12')](_0x7486('0x1a'),_0x559087,JSON[_0x7486('0x14')](_0x498227));_0x2c3184(_0x498227);})[_0x7486('0x19')](function(_0x6aa420){logger['error'](_0x7486('0x1a'),_0x6aa420['message'],_0x559087);_0x2c0ab9(_0x249b98['error'](0x1f4,_0x6aa420[_0x7486('0x17')]));});});};exports[_0x7486('0x24')]=function(_0x3febbd){var _0x59a07d=this;return new Promise(function(_0x1324fa,_0x574956){return db['OpenchannelQueue'][_0x7486('0x25')]({'raw':_0x3febbd['options']?_0x3febbd[_0x7486('0x1c')][_0x7486('0x1d')]===undefined?!![]:![]:!![],'where':_0x3febbd[_0x7486('0x1c')]?_0x3febbd[_0x7486('0x1c')][_0x7486('0x1e')]||null:null,'attributes':_0x3febbd['options']?_0x3febbd['options'][_0x7486('0x1f')]||null:null,'include':_0x3febbd[_0x7486('0x1c')]?_0x3febbd[_0x7486('0x1c')][_0x7486('0x21')]?_['map'](_0x3febbd[_0x7486('0x1c')][_0x7486('0x21')],function(_0x11e35d){return{'model':db[_0x11e35d[_0x7486('0x23')]],'as':_0x11e35d['as'],'attributes':_0x11e35d[_0x7486('0x1f')],'include':_0x11e35d['include']?_[_0x7486('0x22')](_0x11e35d[_0x7486('0x21')],function(_0x52817c){return{'model':db[_0x52817c[_0x7486('0x23')]],'as':_0x52817c['as'],'attributes':_0x52817c[_0x7486('0x1f')],'include':_0x52817c[_0x7486('0x21')]?_['map'](_0x52817c['include'],function(_0x23fcbf){return{'model':db[_0x23fcbf[_0x7486('0x23')]],'as':_0x23fcbf['as'],'attributes':_0x23fcbf[_0x7486('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x7486('0xf')](function(_0x5f117c){logger[_0x7486('0x18')](_0x7486('0x24'),_0x3febbd);logger[_0x7486('0x12')](_0x7486('0x24'),_0x3febbd,JSON[_0x7486('0x14')](_0x5f117c));_0x1324fa(_0x5f117c);})[_0x7486('0x19')](function(_0x20dc21){logger[_0x7486('0x15')]('ShowOpenchannelQueue',_0x20dc21[_0x7486('0x17')],_0x3febbd);_0x574956(_0x59a07d[_0x7486('0x15')](0x1f4,_0x20dc21['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index cee9c9c..b263a07 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 _0x3990=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0x3990,0x1c6));var _0x0399=function(_0xbe48c2,_0x3db103){_0xbe48c2=_0xbe48c2-0x0;var _0x39a679=_0x3990[_0xbe48c2];return _0x39a679;};'use strict';var OpenchannelQueueEvents=require(_0x0399('0x0'));var events=[_0x0399('0x1'),_0x0399('0x2'),_0x0399('0x3')];function createListener(_0x3a408b,_0x1dbf51){return function(_0x497cce){_0x1dbf51[_0x0399('0x4')](_0x3a408b,_0x497cce);};}function removeListener(_0xd0ba2d,_0xe001a3){return function(){OpenchannelQueueEvents[_0x0399('0x5')](_0xd0ba2d,_0xe001a3);};}exports[_0x0399('0x6')]=function(_0x5b9332){for(var _0x953358=0x0,_0x4bcc3d=events[_0x0399('0x7')];_0x953358<_0x4bcc3d;_0x953358++){var _0x28752b=events[_0x953358];var _0x11c1fb=createListener(_0x0399('0x8')+_0x28752b,_0x5b9332);OpenchannelQueueEvents['on'](_0x28752b,_0x11c1fb);}}; \ No newline at end of file +var _0x8c04=['openchannelQueue:','./openchannelQueue.events','save','remove','removeListener','register','length'];(function(_0xcad750,_0x105acb){var _0x1f8c59=function(_0x2429fd){while(--_0x2429fd){_0xcad750['push'](_0xcad750['shift']());}};_0x1f8c59(++_0x105acb);}(_0x8c04,0x151));var _0x48c0=function(_0x388d50,_0x56a03a){_0x388d50=_0x388d50-0x0;var _0x2a5868=_0x8c04[_0x388d50];return _0x2a5868;};'use strict';var OpenchannelQueueEvents=require(_0x48c0('0x0'));var events=[_0x48c0('0x1'),_0x48c0('0x2'),'update'];function createListener(_0x532325,_0x27d05b){return function(_0x4590ef){_0x27d05b['emit'](_0x532325,_0x4590ef);};}function removeListener(_0x3f6539,_0x3da217){return function(){OpenchannelQueueEvents[_0x48c0('0x3')](_0x3f6539,_0x3da217);};}exports[_0x48c0('0x4')]=function(_0x82aa32){for(var _0x4560fd=0x0,_0x472607=events[_0x48c0('0x5')];_0x4560fd<_0x472607;_0x4560fd++){var _0x3607ee=events[_0x4560fd];var _0x5d9d97=createListener(_0x48c0('0x6')+_0x3607ee,_0x82aa32);OpenchannelQueueEvents['on'](_0x3607ee,_0x5d9d97);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 4b0cd0a..ce93309 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 _0x5dea=['describe','/:id','show','post','create','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./openchannelQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x2ba380,_0x16aa16){var _0x9da985=function(_0x4db2d6){while(--_0x4db2d6){_0x2ba380['push'](_0x2ba380['shift']());}};_0x9da985(++_0x16aa16);}(_0x5dea,0x15d));var _0xa5de=function(_0x5f411f,_0x54f411){_0x5f411f=_0x5f411f-0x0;var _0x5aa8f5=_0x5dea[_0x5f411f];return _0x5aa8f5;};'use strict';var multer=require(_0xa5de('0x0'));var util=require(_0xa5de('0x1'));var path=require(_0xa5de('0x2'));var timeout=require(_0xa5de('0x3'));var express=require(_0xa5de('0x4'));var router=express['Router']();var auth=require(_0xa5de('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xa5de('0x6'));var controller=require(_0xa5de('0x7'));router[_0xa5de('0x8')]('/',auth['isAuthenticated'](),controller[_0xa5de('0x9')]);router[_0xa5de('0x8')](_0xa5de('0xa'),auth[_0xa5de('0xb')](),controller[_0xa5de('0xc')]);router[_0xa5de('0x8')](_0xa5de('0xd'),auth['isAuthenticated'](),controller[_0xa5de('0xe')]);router[_0xa5de('0xf')]('/',auth[_0xa5de('0xb')](),controller[_0xa5de('0x10')]);router['put'](_0xa5de('0xd'),auth[_0xa5de('0xb')](),controller[_0xa5de('0x11')]);router[_0xa5de('0x12')](_0xa5de('0xd'),auth[_0xa5de('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x2073=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','show','create','put','/:id','delete'];(function(_0x2398ed,_0x4176c3){var _0x31b1ae=function(_0x56d634){while(--_0x56d634){_0x2398ed['push'](_0x2398ed['shift']());}};_0x31b1ae(++_0x4176c3);}(_0x2073,0x19f));var _0x3207=function(_0x12dd11,_0x52b882){_0x12dd11=_0x12dd11-0x0;var _0x3a502b=_0x2073[_0x12dd11];return _0x3a502b;};'use strict';var multer=require(_0x3207('0x0'));var util=require(_0x3207('0x1'));var path=require(_0x3207('0x2'));var timeout=require(_0x3207('0x3'));var express=require(_0x3207('0x4'));var router=express[_0x3207('0x5')]();var auth=require(_0x3207('0x6'));var interaction=require(_0x3207('0x7'));var config=require(_0x3207('0x8'));var controller=require(_0x3207('0x9'));router[_0x3207('0xa')]('/',auth[_0x3207('0xb')](),controller['index']);router['get']('/describe',auth[_0x3207('0xb')](),controller['describe']);router[_0x3207('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3207('0xc')]);router['post']('/',auth[_0x3207('0xb')](),controller[_0x3207('0xd')]);router[_0x3207('0xe')](_0x3207('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x3207('0x10')](_0x3207('0xf'),auth[_0x3207('0xb')](),controller['destroy']);module[_0x3207('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 ce233de..a84e9e2 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 _0x416c=['STRING','DATE','moment','sequelize','exports'];(function(_0x268cbc,_0x2bece3){var _0x2f3302=function(_0x289a7f){while(--_0x289a7f){_0x268cbc['push'](_0x268cbc['shift']());}};_0x2f3302(++_0x2bece3);}(_0x416c,0x110));var _0xc416=function(_0x256d99,_0x5c10d5){_0x256d99=_0x256d99-0x0;var _0x37f28e=_0x416c[_0x256d99];return _0x37f28e;};'use strict';var moment=require(_0xc416('0x0'));var Sequelize=require(_0xc416('0x1'));module[_0xc416('0x2')]={'uniqueid':{'type':Sequelize[_0xc416('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0xc416('0x3')]},'joinAt':{'type':Sequelize[_0xc416('0x4')]},'leaveAt':{'type':Sequelize[_0xc416('0x4')]},'acceptAt':{'type':Sequelize[_0xc416('0x4')]},'exitAt':{'type':Sequelize[_0xc416('0x4')]},'reason':{'type':Sequelize[_0xc416('0x3')]}}; \ No newline at end of file +var _0x6b23=['moment','sequelize','STRING','DATE'];(function(_0x8c4af0,_0x1253a6){var _0x84701e=function(_0x17bca0){while(--_0x17bca0){_0x8c4af0['push'](_0x8c4af0['shift']());}};_0x84701e(++_0x1253a6);}(_0x6b23,0x178));var _0x36b2=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x6b23[_0x266618];return _0x54dbf5;};'use strict';var moment=require(_0x36b2('0x0'));var Sequelize=require(_0x36b2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x36b2('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x36b2('0x3')]},'leaveAt':{'type':Sequelize[_0x36b2('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x36b2('0x3')]},'reason':{'type':Sequelize[_0x36b2('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 0796ba6..04c21c9 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 _0x9c1d=['destroy','stack','name','send','index','map','OpenchannelQueueReport','rawAttributes','fieldName','type','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','includeAll','find','create','body','update','describe','html-pdf','eml-format','rimraf','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','set','Content-Range','reject','save','then'];(function(_0x5d53ff,_0x579a1d){var _0x1b036c=function(_0x5654b6){while(--_0x5654b6){_0x5d53ff['push'](_0x5d53ff['shift']());}};_0x1b036c(++_0x579a1d);}(_0x9c1d,0x1a9));var _0xd9c1=function(_0x51f028,_0x5387b5){_0x51f028=_0x51f028-0x0;var _0xfe4988=_0x9c1d[_0x51f028];return _0xfe4988;};'use strict';var pdf=require(_0xd9c1('0x0'));var emlformat=require(_0xd9c1('0x1'));var rimraf=require(_0xd9c1('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd9c1('0x3'));var rp=require(_0xd9c1('0x4'));var moment=require('moment');var BPromise=require(_0xd9c1('0x5'));var Mustache=require(_0xd9c1('0x6'));var util=require('util');var path=require(_0xd9c1('0x7'));var sox=require(_0xd9c1('0x8'));var csv=require(_0xd9c1('0x9'));var ejs=require(_0xd9c1('0xa'));var fs=require('fs');var _=require(_0xd9c1('0xb'));var squel=require(_0xd9c1('0xc'));var crypto=require(_0xd9c1('0xd'));var jsforce=require(_0xd9c1('0xe'));var deskjs=require(_0xd9c1('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9c1('0x10'));var Papa=require(_0xd9c1('0x11'));var Redis=require(_0xd9c1('0x12'));var authService=require(_0xd9c1('0x13'));var qs=require(_0xd9c1('0x14'));var as=require(_0xd9c1('0x15'));var hardwareService=require(_0xd9c1('0x16'));var logger=require('../../config/logger')(_0xd9c1('0x17'));var utils=require(_0xd9c1('0x18'));var config=require(_0xd9c1('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ead8c,_0x50b02c){_0x50b02c=_0x50b02c||0xcc;return function(_0x13f92d){if(_0x13f92d){return _0x1ead8c[_0xd9c1('0x1a')](_0x50b02c);}return _0x1ead8c[_0xd9c1('0x1b')](_0x50b02c)[_0xd9c1('0x1c')]();};}function respondWithResult(_0xb9cb5d,_0x221a24){_0x221a24=_0x221a24||0xc8;return function(_0x1d34f9){if(_0x1d34f9){return _0xb9cb5d[_0xd9c1('0x1b')](_0x221a24)[_0xd9c1('0x1d')](_0x1d34f9);}};}function respondWithFilteredResult(_0x259305,_0x2813bb){return function(_0x41e154){if(_0x41e154){var _0x35125=_0x41e154['count'],_0x174ccd=_0x2813bb[_0xd9c1('0x1e')],_0xe47aa2=_0x2813bb[_0xd9c1('0x1e')]+_0x2813bb[_0xd9c1('0x1f')],_0x5e500f;if(_0xe47aa2>=_0x35125){_0xe47aa2=_0x35125;_0x5e500f=0xc8;}else{_0x5e500f=0xce;}_0x259305[_0xd9c1('0x1b')](_0x5e500f);return _0x259305[_0xd9c1('0x20')](_0xd9c1('0x21'),_0x174ccd+'-'+_0xe47aa2+'/'+_0x35125)[_0xd9c1('0x1d')](_0x41e154);}return null;};}function patchUpdates(_0x332f19){return function(_0x3a8830){try{jsonpatch['apply'](_0x3a8830,_0x332f19,!![]);}catch(_0x184c4b){return BPromise[_0xd9c1('0x22')](_0x184c4b);}return _0x3a8830[_0xd9c1('0x23')]();};}function saveUpdates(_0x2aea78,_0x4643ad){return function(_0x36728a){if(_0x36728a){return _0x36728a['update'](_0x2aea78)[_0xd9c1('0x24')](function(_0x32b901){return _0x32b901;});}return null;};}function removeEntity(_0x2bd0ab,_0x5caaa1){return function(_0x5b62ac){if(_0x5b62ac){return _0x5b62ac[_0xd9c1('0x25')]()[_0xd9c1('0x24')](function(){_0x2bd0ab[_0xd9c1('0x1b')](0xcc)[_0xd9c1('0x1c')]();});}};}function handleEntityNotFound(_0x18d5f3,_0x5f6a76){return function(_0x27818f){if(!_0x27818f){_0x18d5f3['sendStatus'](0x194);}return _0x27818f;};}function handleError(_0x26df40,_0x241cf1){_0x241cf1=_0x241cf1||0x1f4;return function(_0x4ea9ed){logger['error'](_0x4ea9ed[_0xd9c1('0x26')]);if(_0x4ea9ed[_0xd9c1('0x27')]){delete _0x4ea9ed[_0xd9c1('0x27')];}_0x26df40['status'](_0x241cf1)[_0xd9c1('0x28')](_0x4ea9ed);};}exports[_0xd9c1('0x29')]=function(_0x5a384b,_0x4dcc10){var _0x298042={},_0x2d2f1c={},_0x5e193f={'count':0x0,'rows':[]};var _0x28bd8a=_[_0xd9c1('0x2a')](db[_0xd9c1('0x2b')][_0xd9c1('0x2c')],function(_0x5ba2fe){return{'name':_0x5ba2fe[_0xd9c1('0x2d')],'type':_0x5ba2fe[_0xd9c1('0x2e')][_0xd9c1('0x2f')]};});_0x2d2f1c[_0xd9c1('0x30')]=_[_0xd9c1('0x2a')](_0x28bd8a,_0xd9c1('0x27'));_0x2d2f1c[_0xd9c1('0x31')]=_[_0xd9c1('0x32')](_0x5a384b['query']);_0x2d2f1c['filters']=_['intersection'](_0x2d2f1c[_0xd9c1('0x30')],_0x2d2f1c['query']);_0x298042[_0xd9c1('0x33')]=_[_0xd9c1('0x34')](_0x2d2f1c['model'],qs[_0xd9c1('0x35')](_0x5a384b[_0xd9c1('0x31')][_0xd9c1('0x35')]));_0x298042[_0xd9c1('0x33')]=_0x298042[_0xd9c1('0x33')][_0xd9c1('0x36')]?_0x298042[_0xd9c1('0x33')]:_0x2d2f1c[_0xd9c1('0x30')];if(!_0x5a384b[_0xd9c1('0x31')][_0xd9c1('0x37')](_0xd9c1('0x38'))){_0x298042[_0xd9c1('0x1f')]=qs['limit'](_0x5a384b['query'][_0xd9c1('0x1f')]);_0x298042[_0xd9c1('0x1e')]=qs[_0xd9c1('0x1e')](_0x5a384b['query'][_0xd9c1('0x1e')]);}_0x298042[_0xd9c1('0x39')]=qs['sort'](_0x5a384b[_0xd9c1('0x31')][_0xd9c1('0x3a')]);_0x298042['where']=qs['filters'](_[_0xd9c1('0x3b')](_0x5a384b[_0xd9c1('0x31')],_0x2d2f1c[_0xd9c1('0x3c')]));if(_0x5a384b[_0xd9c1('0x31')][_0xd9c1('0x3d')]){_0x298042[_0xd9c1('0x3e')]=_['merge'](_0x298042[_0xd9c1('0x3e')],{'$or':_[_0xd9c1('0x2a')](_0x28bd8a,function(_0x46eb36){if(_0x46eb36['type']!==_0xd9c1('0x3f')){var _0x13b41f={};_0x13b41f[_0x46eb36[_0xd9c1('0x27')]]={'$like':'%'+_0x5a384b[_0xd9c1('0x31')][_0xd9c1('0x3d')]+'%'};return _0x13b41f;}})});}_0x298042=_[_0xd9c1('0x40')]({},_0x298042,_0x5a384b[_0xd9c1('0x41')]);var _0x2fa7c4={'where':_0x298042[_0xd9c1('0x3e')]};return db[_0xd9c1('0x2b')]['count'](_0x2fa7c4)[_0xd9c1('0x24')](function(_0x3d5cd8){_0x5e193f['count']=_0x3d5cd8;if(_0x5a384b['query']['includeAll']){_0x298042[_0xd9c1('0x42')]=[{'all':!![]}];}return db[_0xd9c1('0x2b')][_0xd9c1('0x43')](_0x298042);})[_0xd9c1('0x24')](function(_0x518cfa){_0x5e193f[_0xd9c1('0x44')]=_0x518cfa;return _0x5e193f;})[_0xd9c1('0x24')](respondWithFilteredResult(_0x4dcc10,_0x298042))[_0xd9c1('0x45')](handleError(_0x4dcc10,null));};exports['show']=function(_0x59a5bd,_0x2bb617){var _0xbf9915={'raw':!![],'where':{'id':_0x59a5bd[_0xd9c1('0x46')]['id']}},_0x282332={};_0x282332[_0xd9c1('0x30')]=_[_0xd9c1('0x32')](db[_0xd9c1('0x2b')][_0xd9c1('0x2c')]);_0x282332[_0xd9c1('0x31')]=_['keys'](_0x59a5bd[_0xd9c1('0x31')]);_0x282332[_0xd9c1('0x3c')]=_[_0xd9c1('0x34')](_0x282332['model'],_0x282332['query']);_0xbf9915[_0xd9c1('0x33')]=_['intersection'](_0x282332[_0xd9c1('0x30')],qs['fields'](_0x59a5bd['query'][_0xd9c1('0x35')]));_0xbf9915[_0xd9c1('0x33')]=_0xbf9915[_0xd9c1('0x33')][_0xd9c1('0x36')]?_0xbf9915[_0xd9c1('0x33')]:_0x282332[_0xd9c1('0x30')];if(_0x59a5bd[_0xd9c1('0x31')][_0xd9c1('0x47')]){_0xbf9915[_0xd9c1('0x42')]=[{'all':!![]}];}_0xbf9915=_[_0xd9c1('0x40')]({},_0xbf9915,_0x59a5bd[_0xd9c1('0x41')]);return db[_0xd9c1('0x2b')][_0xd9c1('0x48')](_0xbf9915)[_0xd9c1('0x24')](handleEntityNotFound(_0x2bb617,null))[_0xd9c1('0x24')](respondWithResult(_0x2bb617,null))[_0xd9c1('0x45')](handleError(_0x2bb617,null));};exports['create']=function(_0x4615ca,_0x4966fc){return db['OpenchannelQueueReport'][_0xd9c1('0x49')](_0x4615ca[_0xd9c1('0x4a')],{})[_0xd9c1('0x24')](respondWithResult(_0x4966fc,0xc9))[_0xd9c1('0x45')](handleError(_0x4966fc,null));};exports[_0xd9c1('0x4b')]=function(_0x46cb82,_0xdc46d7){if(_0x46cb82[_0xd9c1('0x4a')]['id']){delete _0x46cb82[_0xd9c1('0x4a')]['id'];}return db[_0xd9c1('0x2b')]['find']({'where':{'id':_0x46cb82[_0xd9c1('0x46')]['id']}})['then'](handleEntityNotFound(_0xdc46d7,null))['then'](saveUpdates(_0x46cb82[_0xd9c1('0x4a')],null))[_0xd9c1('0x24')](respondWithResult(_0xdc46d7,null))[_0xd9c1('0x45')](handleError(_0xdc46d7,null));};exports[_0xd9c1('0x25')]=function(_0x238fb9,_0x5cd01e){return db[_0xd9c1('0x2b')][_0xd9c1('0x48')]({'where':{'id':_0x238fb9['params']['id']}})[_0xd9c1('0x24')](handleEntityNotFound(_0x5cd01e,null))[_0xd9c1('0x24')](removeEntity(_0x5cd01e,null))[_0xd9c1('0x45')](handleError(_0x5cd01e,null));};exports[_0xd9c1('0x4c')]=function(_0x437a6a,_0x4c42b6){return db[_0xd9c1('0x2b')][_0xd9c1('0x4c')]()[_0xd9c1('0x24')](respondWithResult(_0x4c42b6,null))[_0xd9c1('0x45')](handleError(_0x4c42b6,null));}; \ No newline at end of file +var _0x1867=['key','query','keys','intersection','model','fields','length','hasOwnProperty','sort','where','filters','pick','merge','VIRTUAL','options','OpenchannelQueueReport','then','includeAll','include','findAll','rows','catch','show','params','attributes','create','body','update','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','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','set','Content-Range','apply','save','stack','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x12b83d,_0x4bcec7){var _0x1fd39d=function(_0x449185){while(--_0x449185){_0x12b83d['push'](_0x12b83d['shift']());}};_0x1fd39d(++_0x4bcec7);}(_0x1867,0xb5));var _0x7186=function(_0x3c03ff,_0x266c7b){_0x3c03ff=_0x3c03ff-0x0;var _0x414bd1=_0x1867[_0x3c03ff];return _0x414bd1;};'use strict';var pdf=require(_0x7186('0x0'));var emlformat=require(_0x7186('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x7186('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7186('0x3'));var moment=require(_0x7186('0x4'));var BPromise=require(_0x7186('0x5'));var Mustache=require(_0x7186('0x6'));var util=require(_0x7186('0x7'));var path=require(_0x7186('0x8'));var sox=require(_0x7186('0x9'));var csv=require(_0x7186('0xa'));var ejs=require(_0x7186('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x7186('0xc'));var crypto=require(_0x7186('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x7186('0xe'));var toCsv=require(_0x7186('0xa'));var querystring=require(_0x7186('0xf'));var Papa=require(_0x7186('0x10'));var Redis=require('ioredis');var authService=require(_0x7186('0x11'));var qs=require(_0x7186('0x12'));var as=require(_0x7186('0x13'));var hardwareService=require(_0x7186('0x14'));var logger=require(_0x7186('0x15'))('api');var utils=require(_0x7186('0x16'));var config=require(_0x7186('0x17'));var db=require(_0x7186('0x18'))['db'];function respondWithStatusCode(_0x19f803,_0x4a20df){_0x4a20df=_0x4a20df||0xcc;return function(_0x3493a6){if(_0x3493a6){return _0x19f803[_0x7186('0x19')](_0x4a20df);}return _0x19f803[_0x7186('0x1a')](_0x4a20df)[_0x7186('0x1b')]();};}function respondWithResult(_0x489e35,_0x58bbb8){_0x58bbb8=_0x58bbb8||0xc8;return function(_0x58d522){if(_0x58d522){return _0x489e35[_0x7186('0x1a')](_0x58bbb8)[_0x7186('0x1c')](_0x58d522);}};}function respondWithFilteredResult(_0x1e78f9,_0x1d392a){return function(_0x51d8d1){if(_0x51d8d1){var _0x2a8de4=_0x51d8d1[_0x7186('0x1d')],_0x1cc347=_0x1d392a[_0x7186('0x1e')],_0x915126=_0x1d392a[_0x7186('0x1e')]+_0x1d392a[_0x7186('0x1f')],_0x396e13;if(_0x915126>=_0x2a8de4){_0x915126=_0x2a8de4;_0x396e13=0xc8;}else{_0x396e13=0xce;}_0x1e78f9['status'](_0x396e13);return _0x1e78f9[_0x7186('0x20')](_0x7186('0x21'),_0x1cc347+'-'+_0x915126+'/'+_0x2a8de4)['json'](_0x51d8d1);}return null;};}function patchUpdates(_0x1394b7){return function(_0x40b42f){try{jsonpatch[_0x7186('0x22')](_0x40b42f,_0x1394b7,!![]);}catch(_0x4bdfad){return BPromise['reject'](_0x4bdfad);}return _0x40b42f[_0x7186('0x23')]();};}function saveUpdates(_0x584149,_0x3fc1f0){return function(_0x544341){if(_0x544341){return _0x544341['update'](_0x584149)['then'](function(_0x3f932b){return _0x3f932b;});}return null;};}function removeEntity(_0xb0ac28,_0x48bfaf){return function(_0x4af3f3){if(_0x4af3f3){return _0x4af3f3['destroy']()['then'](function(){_0xb0ac28[_0x7186('0x1a')](0xcc)[_0x7186('0x1b')]();});}};}function handleEntityNotFound(_0x116c93,_0x4b8176){return function(_0x25d760){if(!_0x25d760){_0x116c93[_0x7186('0x19')](0x194);}return _0x25d760;};}function handleError(_0xb5bb54,_0xa6be2b){_0xa6be2b=_0xa6be2b||0x1f4;return function(_0x1baf5b){logger['error'](_0x1baf5b[_0x7186('0x24')]);if(_0x1baf5b[_0x7186('0x25')]){delete _0x1baf5b[_0x7186('0x25')];}_0xb5bb54[_0x7186('0x1a')](_0xa6be2b)[_0x7186('0x26')](_0x1baf5b);};}exports[_0x7186('0x27')]=function(_0x156466,_0xf2db43){var _0x53c3fe={},_0x29d231={},_0x463f1e={'count':0x0,'rows':[]};var _0x49c1d5=_[_0x7186('0x28')](db['OpenchannelQueueReport'][_0x7186('0x29')],function(_0xa909b0){return{'name':_0xa909b0[_0x7186('0x2a')],'type':_0xa909b0[_0x7186('0x2b')][_0x7186('0x2c')]};});_0x29d231['model']=_[_0x7186('0x28')](_0x49c1d5,_0x7186('0x25'));_0x29d231[_0x7186('0x2d')]=_[_0x7186('0x2e')](_0x156466[_0x7186('0x2d')]);_0x29d231['filters']=_[_0x7186('0x2f')](_0x29d231[_0x7186('0x30')],_0x29d231[_0x7186('0x2d')]);_0x53c3fe['attributes']=_[_0x7186('0x2f')](_0x29d231[_0x7186('0x30')],qs[_0x7186('0x31')](_0x156466[_0x7186('0x2d')][_0x7186('0x31')]));_0x53c3fe['attributes']=_0x53c3fe['attributes'][_0x7186('0x32')]?_0x53c3fe['attributes']:_0x29d231[_0x7186('0x30')];if(!_0x156466[_0x7186('0x2d')][_0x7186('0x33')]('nolimit')){_0x53c3fe[_0x7186('0x1f')]=qs[_0x7186('0x1f')](_0x156466[_0x7186('0x2d')][_0x7186('0x1f')]);_0x53c3fe['offset']=qs['offset'](_0x156466['query'][_0x7186('0x1e')]);}_0x53c3fe['order']=qs['sort'](_0x156466['query'][_0x7186('0x34')]);_0x53c3fe[_0x7186('0x35')]=qs[_0x7186('0x36')](_[_0x7186('0x37')](_0x156466[_0x7186('0x2d')],_0x29d231[_0x7186('0x36')]));if(_0x156466[_0x7186('0x2d')]['filter']){_0x53c3fe['where']=_[_0x7186('0x38')](_0x53c3fe[_0x7186('0x35')],{'$or':_['map'](_0x49c1d5,function(_0x23fe6a){if(_0x23fe6a[_0x7186('0x2b')]!==_0x7186('0x39')){var _0x1e32b5={};_0x1e32b5[_0x23fe6a['name']]={'$like':'%'+_0x156466[_0x7186('0x2d')]['filter']+'%'};return _0x1e32b5;}})});}_0x53c3fe=_['merge']({},_0x53c3fe,_0x156466[_0x7186('0x3a')]);var _0x34b26c={'where':_0x53c3fe[_0x7186('0x35')]};return db[_0x7186('0x3b')]['count'](_0x34b26c)[_0x7186('0x3c')](function(_0x356407){_0x463f1e[_0x7186('0x1d')]=_0x356407;if(_0x156466['query'][_0x7186('0x3d')]){_0x53c3fe[_0x7186('0x3e')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x7186('0x3f')](_0x53c3fe);})[_0x7186('0x3c')](function(_0x4f4d40){_0x463f1e[_0x7186('0x40')]=_0x4f4d40;return _0x463f1e;})[_0x7186('0x3c')](respondWithFilteredResult(_0xf2db43,_0x53c3fe))[_0x7186('0x41')](handleError(_0xf2db43,null));};exports[_0x7186('0x42')]=function(_0x3c63c1,_0x41473a){var _0x1ec409={'raw':!![],'where':{'id':_0x3c63c1[_0x7186('0x43')]['id']}},_0x41081e={};_0x41081e[_0x7186('0x30')]=_['keys'](db[_0x7186('0x3b')][_0x7186('0x29')]);_0x41081e['query']=_[_0x7186('0x2e')](_0x3c63c1[_0x7186('0x2d')]);_0x41081e['filters']=_[_0x7186('0x2f')](_0x41081e[_0x7186('0x30')],_0x41081e[_0x7186('0x2d')]);_0x1ec409[_0x7186('0x44')]=_['intersection'](_0x41081e[_0x7186('0x30')],qs[_0x7186('0x31')](_0x3c63c1[_0x7186('0x2d')][_0x7186('0x31')]));_0x1ec409[_0x7186('0x44')]=_0x1ec409[_0x7186('0x44')][_0x7186('0x32')]?_0x1ec409[_0x7186('0x44')]:_0x41081e[_0x7186('0x30')];if(_0x3c63c1[_0x7186('0x2d')][_0x7186('0x3d')]){_0x1ec409[_0x7186('0x3e')]=[{'all':!![]}];}_0x1ec409=_[_0x7186('0x38')]({},_0x1ec409,_0x3c63c1[_0x7186('0x3a')]);return db['OpenchannelQueueReport']['find'](_0x1ec409)[_0x7186('0x3c')](handleEntityNotFound(_0x41473a,null))[_0x7186('0x3c')](respondWithResult(_0x41473a,null))['catch'](handleError(_0x41473a,null));};exports[_0x7186('0x45')]=function(_0x4e22b0,_0x18a8aa){return db[_0x7186('0x3b')]['create'](_0x4e22b0[_0x7186('0x46')],{})['then'](respondWithResult(_0x18a8aa,0xc9))['catch'](handleError(_0x18a8aa,null));};exports[_0x7186('0x47')]=function(_0x214686,_0x55e70c){if(_0x214686[_0x7186('0x46')]['id']){delete _0x214686[_0x7186('0x46')]['id'];}return db[_0x7186('0x3b')][_0x7186('0x48')]({'where':{'id':_0x214686[_0x7186('0x43')]['id']}})[_0x7186('0x3c')](handleEntityNotFound(_0x55e70c,null))['then'](saveUpdates(_0x214686[_0x7186('0x46')],null))[_0x7186('0x3c')](respondWithResult(_0x55e70c,null))[_0x7186('0x41')](handleError(_0x55e70c,null));};exports[_0x7186('0x49')]=function(_0x392ebc,_0x5ab66a){return db[_0x7186('0x3b')][_0x7186('0x48')]({'where':{'id':_0x392ebc['params']['id']}})[_0x7186('0x3c')](handleEntityNotFound(_0x5ab66a,null))['then'](removeEntity(_0x5ab66a,null))[_0x7186('0x41')](handleError(_0x5ab66a,null));};exports[_0x7186('0x4a')]=function(_0x41241f,_0x2008d5){return db[_0x7186('0x3b')]['describe']()[_0x7186('0x3c')](respondWithResult(_0x2008d5,null))[_0x7186('0x41')](handleError(_0x2008d5,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index ba51f65..c3447af 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 _0x0c29=['../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','../../config/logger','moment','bluebird','request-promise'];(function(_0x49ca18,_0x5e6d05){var _0x145d54=function(_0x30b9be){while(--_0x30b9be){_0x49ca18['push'](_0x49ca18['shift']());}};_0x145d54(++_0x5e6d05);}(_0x0c29,0xb7));var _0x90c2=function(_0x55ff79,_0x3d45e7){_0x55ff79=_0x55ff79-0x0;var _0x579067=_0x0c29[_0x55ff79];return _0x579067;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x90c2('0x0'))('api');var moment=require(_0x90c2('0x1'));var BPromise=require(_0x90c2('0x2'));var rp=require(_0x90c2('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x90c2('0x4'));var attributes=require(_0x90c2('0x5'));module[_0x90c2('0x6')]=function(_0x1aa5a4,_0xfbe17b){return _0x1aa5a4[_0x90c2('0x7')](_0x90c2('0x8'),attributes,{'tableName':_0x90c2('0x9'),'paranoid':![],'indexes':[{'name':_0x90c2('0xa'),'fields':[_0x90c2('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9b67=['util','../../config/logger','api','moment','request-promise','path','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash'];(function(_0x12cea1,_0x55b095){var _0xce9b7b=function(_0x32c5ef){while(--_0x32c5ef){_0x12cea1['push'](_0x12cea1['shift']());}};_0xce9b7b(++_0x55b095);}(_0x9b67,0xf6));var _0x79b6=function(_0x11f0d5,_0x1bf0d4){_0x11f0d5=_0x11f0d5-0x0;var _0x1ddf7c=_0x9b67[_0x11f0d5];return _0x1ddf7c;};'use strict';var _=require(_0x79b6('0x0'));var util=require(_0x79b6('0x1'));var logger=require(_0x79b6('0x2'))(_0x79b6('0x3'));var moment=require(_0x79b6('0x4'));var BPromise=require('bluebird');var rp=require(_0x79b6('0x5'));var fs=require('fs');var path=require(_0x79b6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79b6('0x7'));module[_0x79b6('0x8')]=function(_0x258103,_0xec367e){return _0x258103[_0x79b6('0x9')](_0x79b6('0xa'),attributes,{'tableName':_0x79b6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x79b6('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 a42bdc7..84f933c 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 _0x80c4=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','create','body','options','raw','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','OpenchannelQueueReport','update','lodash','moment'];(function(_0x3d3951,_0x3cffe2){var _0x47f3a7=function(_0x595e33){while(--_0x595e33){_0x3d3951['push'](_0x3d3951['shift']());}};_0x47f3a7(++_0x3cffe2);}(_0x80c4,0xa3));var _0x480c=function(_0x2b0523,_0x3ed985){_0x2b0523=_0x2b0523-0x0;var _0x31ca51=_0x80c4[_0x2b0523];return _0x31ca51;};'use strict';var _=require(_0x480c('0x0'));var util=require('util');var moment=require(_0x480c('0x1'));var BPromise=require(_0x480c('0x2'));var rs=require(_0x480c('0x3'));var fs=require('fs');var Redis=require(_0x480c('0x4'));var db=require(_0x480c('0x5'))['db'];var utils=require(_0x480c('0x6'));var logger=require('../../config/logger')(_0x480c('0x7'));var config=require(_0x480c('0x8'));var jayson=require(_0x480c('0x9'));var client=jayson[_0x480c('0xa')][_0x480c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x40a5a6,_0x3a69ec,_0x277efe){return new BPromise(function(_0x21545d,_0x510038){return client[_0x480c('0xc')](_0x40a5a6,_0x277efe)[_0x480c('0xd')](function(_0x292aca){logger[_0x480c('0xe')](_0x480c('0xf'),_0x3a69ec,_0x480c('0x10'));logger[_0x480c('0x11')](_0x480c('0x12'),_0x3a69ec,_0x480c('0x10'),JSON[_0x480c('0x13')](_0x292aca));if(_0x292aca[_0x480c('0x14')]){if(_0x292aca[_0x480c('0x14')][_0x480c('0x15')]===0x1f4){logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);return _0x510038(_0x292aca[_0x480c('0x14')]['message']);}logger[_0x480c('0x14')](_0x480c('0xf'),_0x3a69ec,_0x292aca['error'][_0x480c('0x16')]);return _0x21545d(_0x292aca[_0x480c('0x14')][_0x480c('0x16')]);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a69ec,_0x480c('0x10'));_0x21545d(_0x292aca[_0x480c('0x17')][_0x480c('0x16')]);}})[_0x480c('0x18')](function(_0x93d6c5){logger['error']('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a69ec,_0x93d6c5);_0x510038(_0x93d6c5);});});}exports['CreateOpenchannelQueueReport']=function(_0xfc8a9f){var _0x4412aa=this;return new Promise(function(_0x54750c,_0x172103){return db['OpenchannelQueueReport'][_0x480c('0x19')](_0xfc8a9f[_0x480c('0x1a')],{'raw':_0xfc8a9f[_0x480c('0x1b')]?_0xfc8a9f['options'][_0x480c('0x1c')]===undefined?!![]:![]:!![]})[_0x480c('0xd')](function(_0x9e5a12){logger['info'](_0x480c('0x1d'),_0xfc8a9f);logger['debug'](_0x480c('0x1d'),_0xfc8a9f,JSON[_0x480c('0x13')](_0x9e5a12));_0x54750c(_0x9e5a12);})['catch'](function(_0x3b5bca){logger[_0x480c('0x14')](_0x480c('0x1d'),_0x3b5bca[_0x480c('0x16')],_0xfc8a9f);_0x172103(_0x4412aa['error'](0x1f4,_0x3b5bca[_0x480c('0x16')]));});});};exports[_0x480c('0x1e')]=function(_0x5288f5){var _0xdc044f=this;return new Promise(function(_0x34238b,_0x16ddd6){return db[_0x480c('0x1f')][_0x480c('0x20')](_0x5288f5[_0x480c('0x1a')],{'raw':_0x5288f5[_0x480c('0x1b')]?_0x5288f5[_0x480c('0x1b')][_0x480c('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5288f5[_0x480c('0x1b')]?_0x5288f5[_0x480c('0x1b')]['where']||null:null,'attributes':_0x5288f5['options']?_0x5288f5[_0x480c('0x1b')]['attributes']||null:null,'limit':_0x5288f5['options']?_0x5288f5['options']['limit']||null:null})[_0x480c('0xd')](function(_0x6019aa){logger[_0x480c('0xe')](_0x480c('0x1e'),_0x5288f5);logger['debug']('UpdateOpenchannelQueueReport',_0x5288f5,JSON['stringify'](_0x6019aa));_0x34238b(_0x6019aa);})[_0x480c('0x18')](function(_0x3eabb3){logger[_0x480c('0x14')](_0x480c('0x1e'),_0x3eabb3['message'],_0x5288f5);_0x16ddd6(_0xdc044f['error'](0x1f4,_0x3eabb3[_0x480c('0x16')]));});});}; \ No newline at end of file +var _0xcaf2=['options','raw','CreateOpenchannelQueueReport','stringify','catch','UpdateOpenchannelQueueReport','update','where','attributes','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','OpenchannelQueueReport','body'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcaf2,0x8a));var _0x2caf=function(_0x47327a,_0xa744ab){_0x47327a=_0x47327a-0x0;var _0x258c4c=_0xcaf2[_0x47327a];return _0x258c4c;};'use strict';var _=require(_0x2caf('0x0'));var util=require('util');var moment=require(_0x2caf('0x1'));var BPromise=require(_0x2caf('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2caf('0x3'));var db=require(_0x2caf('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2caf('0x5'))('rpc');var config=require(_0x2caf('0x6'));var jayson=require(_0x2caf('0x7'));var client=jayson[_0x2caf('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc44e4e,_0x314486,_0x4667c6){return new BPromise(function(_0x34e792,_0x5611aa){return client[_0x2caf('0x9')](_0xc44e4e,_0x4667c6)[_0x2caf('0xa')](function(_0x45e520){logger[_0x2caf('0xb')](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));logger[_0x2caf('0xe')](_0x2caf('0xf'),_0x314486,_0x2caf('0xd'),JSON['stringify'](_0x45e520));if(_0x45e520[_0x2caf('0x10')]){if(_0x45e520[_0x2caf('0x10')][_0x2caf('0x11')]===0x1f4){logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520[_0x2caf('0x10')][_0x2caf('0x12')]);return _0x5611aa(_0x45e520[_0x2caf('0x10')]['message']);}logger[_0x2caf('0x10')](_0x2caf('0xc'),_0x314486,_0x45e520['error']['message']);return _0x34e792(_0x45e520['error'][_0x2caf('0x12')]);}else{logger['info'](_0x2caf('0xc'),_0x314486,_0x2caf('0xd'));_0x34e792(_0x45e520[_0x2caf('0x13')][_0x2caf('0x12')]);}})['catch'](function(_0x184355){logger['error'](_0x2caf('0xc'),_0x314486,_0x184355);_0x5611aa(_0x184355);});});}exports['CreateOpenchannelQueueReport']=function(_0x4a33fc){var _0x3e975f=this;return new Promise(function(_0x58047b,_0xe72440){return db[_0x2caf('0x14')]['create'](_0x4a33fc[_0x2caf('0x15')],{'raw':_0x4a33fc[_0x2caf('0x16')]?_0x4a33fc[_0x2caf('0x16')][_0x2caf('0x17')]===undefined?!![]:![]:!![]})[_0x2caf('0xa')](function(_0x595f2f){logger[_0x2caf('0xb')](_0x2caf('0x18'),_0x4a33fc);logger[_0x2caf('0xe')](_0x2caf('0x18'),_0x4a33fc,JSON[_0x2caf('0x19')](_0x595f2f));_0x58047b(_0x595f2f);})[_0x2caf('0x1a')](function(_0x4092ba){logger[_0x2caf('0x10')](_0x2caf('0x18'),_0x4092ba[_0x2caf('0x12')],_0x4a33fc);_0xe72440(_0x3e975f[_0x2caf('0x10')](0x1f4,_0x4092ba['message']));});});};exports[_0x2caf('0x1b')]=function(_0x14bfd2){var _0x1f29b0=this;return new Promise(function(_0x401ea2,_0x3efa4e){return db[_0x2caf('0x14')][_0x2caf('0x1c')](_0x14bfd2[_0x2caf('0x15')],{'raw':_0x14bfd2[_0x2caf('0x16')]?_0x14bfd2[_0x2caf('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14bfd2[_0x2caf('0x16')]?_0x14bfd2[_0x2caf('0x16')][_0x2caf('0x1d')]||null:null,'attributes':_0x14bfd2[_0x2caf('0x16')]?_0x14bfd2[_0x2caf('0x16')][_0x2caf('0x1e')]||null:null,'limit':_0x14bfd2[_0x2caf('0x16')]?_0x14bfd2[_0x2caf('0x16')][_0x2caf('0x1f')]||null:null})[_0x2caf('0xa')](function(_0x30da75){logger[_0x2caf('0xb')](_0x2caf('0x1b'),_0x14bfd2);logger['debug'](_0x2caf('0x1b'),_0x14bfd2,JSON[_0x2caf('0x19')](_0x30da75));_0x401ea2(_0x30da75);})[_0x2caf('0x1a')](function(_0x25bbfc){logger[_0x2caf('0x10')](_0x2caf('0x1b'),_0x25bbfc[_0x2caf('0x12')],_0x14bfd2);_0x3efa4e(_0x1f29b0['error'](0x1f4,_0x25bbfc[_0x2caf('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 396da12..dc90b0e 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(_0x28a5ad,_0x520afa){var _0x176b8a=function(_0x3d71b){while(--_0x3d71b){_0x28a5ad['push'](_0x28a5ad['shift']());}};_0x176b8a(++_0x520afa);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5447fd,_0x52a6b5){_0x5447fd=_0x5447fd-0x0;var _0x15b28a=_0xa9e0[_0x5447fd];return _0x15b28a;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x0a9e('0x4'));var config=require(_0x0a9e('0x5'));var controller=require(_0x0a9e('0x6'));router[_0x0a9e('0x7')]('/',auth[_0x0a9e('0x8')](),controller['index']);router[_0x0a9e('0x7')](_0x0a9e('0x9'),auth[_0x0a9e('0x8')](),controller['describe']);router['get'](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('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(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0xa9e0[_0x2d8fc2];return _0x3a9e53;};'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 1af80d1..7e0145f 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 _0x5fca=['ENUM','account','agent','queue','NOW','moment','sequelize','exports','STRING'];(function(_0x51bc8b,_0x2c8aca){var _0x279f96=function(_0x49e59e){while(--_0x49e59e){_0x51bc8b['push'](_0x51bc8b['shift']());}};_0x279f96(++_0x2c8aca);}(_0x5fca,0x95));var _0xa5fc=function(_0x11a220,_0x4e470a){_0x11a220=_0x11a220-0x0;var _0x20d8fe=_0x5fca[_0x11a220];return _0x20d8fe;};'use strict';var moment=require(_0xa5fc('0x0'));var Sequelize=require(_0xa5fc('0x1'));module[_0xa5fc('0x2')]={'uniqueid':{'type':Sequelize[_0xa5fc('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xa5fc('0x4')](_0xa5fc('0x5'),_0xa5fc('0x6'),_0xa5fc('0x7')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xa5fc('0x8')]}}; \ No newline at end of file +var _0x324c=['NOW','moment','sequelize','exports','STRING','ENUM','account','agent','queue'];(function(_0x2189d1,_0x4e67a0){var _0xc909eb=function(_0xf7894b){while(--_0xf7894b){_0x2189d1['push'](_0x2189d1['shift']());}};_0xc909eb(++_0x4e67a0);}(_0x324c,0xd9));var _0xc324=function(_0x1ea040,_0x21ca6e){_0x1ea040=_0x1ea040-0x0;var _0x5c5737=_0x324c[_0x1ea040];return _0x5c5737;};'use strict';var moment=require(_0xc324('0x0'));var Sequelize=require(_0xc324('0x1'));module[_0xc324('0x2')]={'uniqueid':{'type':Sequelize[_0xc324('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc324('0x4')](_0xc324('0x5'),_0xc324('0x6'),_0xc324('0x7')),'allowNull':![],'defaultValue':_0xc324('0x7')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0xc324('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 97c2d8b..9039a05 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 _0x53ba=['end','status','count','offset','limit','set','Content-Range','json','save','update','destroy','then','error','stack','name','index','map','OpenchannelTransferReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','keys','find','create','body','params','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus'];(function(_0x364d70,_0x378fa0){var _0x57890c=function(_0x3db0f4){while(--_0x3db0f4){_0x364d70['push'](_0x364d70['shift']());}};_0x57890c(++_0x378fa0);}(_0x53ba,0x158));var _0xa53b=function(_0x16cdf9,_0x3cbd88){_0x16cdf9=_0x16cdf9-0x0;var _0x2eadb8=_0x53ba[_0x16cdf9];return _0x2eadb8;};'use strict';var pdf=require(_0xa53b('0x0'));var emlformat=require(_0xa53b('0x1'));var rimraf=require(_0xa53b('0x2'));var zipdir=require(_0xa53b('0x3'));var jsonpatch=require(_0xa53b('0x4'));var rp=require('request-promise');var moment=require(_0xa53b('0x5'));var BPromise=require(_0xa53b('0x6'));var Mustache=require(_0xa53b('0x7'));var util=require(_0xa53b('0x8'));var path=require(_0xa53b('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xa53b('0xa'));var fs=require('fs');var _=require(_0xa53b('0xb'));var squel=require(_0xa53b('0xc'));var crypto=require(_0xa53b('0xd'));var jsforce=require(_0xa53b('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xa53b('0xf'));var querystring=require(_0xa53b('0x10'));var Papa=require(_0xa53b('0x11'));var Redis=require('ioredis');var authService=require(_0xa53b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa53b('0x13'));var hardwareService=require(_0xa53b('0x14'));var logger=require(_0xa53b('0x15'))(_0xa53b('0x16'));var utils=require('../../config/utils');var config=require(_0xa53b('0x17'));var db=require(_0xa53b('0x18'))['db'];function respondWithStatusCode(_0x4394fc,_0x513205){_0x513205=_0x513205||0xcc;return function(_0x496198){if(_0x496198){return _0x4394fc[_0xa53b('0x19')](_0x513205);}return _0x4394fc['status'](_0x513205)[_0xa53b('0x1a')]();};}function respondWithResult(_0x2f6f3a,_0x50aa4c){_0x50aa4c=_0x50aa4c||0xc8;return function(_0x386390){if(_0x386390){return _0x2f6f3a[_0xa53b('0x1b')](_0x50aa4c)['json'](_0x386390);}};}function respondWithFilteredResult(_0x14b00a,_0x158788){return function(_0x38fb83){if(_0x38fb83){var _0x8468c4=_0x38fb83[_0xa53b('0x1c')],_0x39071b=_0x158788['offset'],_0x22a6a2=_0x158788[_0xa53b('0x1d')]+_0x158788[_0xa53b('0x1e')],_0x4c1f02;if(_0x22a6a2>=_0x8468c4){_0x22a6a2=_0x8468c4;_0x4c1f02=0xc8;}else{_0x4c1f02=0xce;}_0x14b00a[_0xa53b('0x1b')](_0x4c1f02);return _0x14b00a[_0xa53b('0x1f')](_0xa53b('0x20'),_0x39071b+'-'+_0x22a6a2+'/'+_0x8468c4)[_0xa53b('0x21')](_0x38fb83);}return null;};}function patchUpdates(_0x5f3b74){return function(_0x54cfb3){try{jsonpatch['apply'](_0x54cfb3,_0x5f3b74,!![]);}catch(_0x3bed57){return BPromise['reject'](_0x3bed57);}return _0x54cfb3[_0xa53b('0x22')]();};}function saveUpdates(_0x1974b0,_0x3ea332){return function(_0x5a4212){if(_0x5a4212){return _0x5a4212[_0xa53b('0x23')](_0x1974b0)['then'](function(_0xe2efa9){return _0xe2efa9;});}return null;};}function removeEntity(_0x3a35e9,_0x20c2cd){return function(_0x1173da){if(_0x1173da){return _0x1173da[_0xa53b('0x24')]()[_0xa53b('0x25')](function(){_0x3a35e9['status'](0xcc)[_0xa53b('0x1a')]();});}};}function handleEntityNotFound(_0x3c5135,_0x15e4e9){return function(_0x3bd46d){if(!_0x3bd46d){_0x3c5135[_0xa53b('0x19')](0x194);}return _0x3bd46d;};}function handleError(_0x1640bd,_0x48703b){_0x48703b=_0x48703b||0x1f4;return function(_0x5a69b7){logger[_0xa53b('0x26')](_0x5a69b7[_0xa53b('0x27')]);if(_0x5a69b7[_0xa53b('0x28')]){delete _0x5a69b7['name'];}_0x1640bd[_0xa53b('0x1b')](_0x48703b)['send'](_0x5a69b7);};}exports[_0xa53b('0x29')]=function(_0x1aaa9d,_0x719e22){var _0x3965cf={},_0x45fde9={},_0x1f3418={'count':0x0,'rows':[]};var _0x1cf33b=_[_0xa53b('0x2a')](db[_0xa53b('0x2b')][_0xa53b('0x2c')],function(_0x29d697){return{'name':_0x29d697[_0xa53b('0x2d')],'type':_0x29d697[_0xa53b('0x2e')][_0xa53b('0x2f')]};});_0x45fde9[_0xa53b('0x30')]=_[_0xa53b('0x2a')](_0x1cf33b,_0xa53b('0x28'));_0x45fde9[_0xa53b('0x31')]=_['keys'](_0x1aaa9d[_0xa53b('0x31')]);_0x45fde9[_0xa53b('0x32')]=_[_0xa53b('0x33')](_0x45fde9['model'],_0x45fde9['query']);_0x3965cf[_0xa53b('0x34')]=_[_0xa53b('0x33')](_0x45fde9['model'],qs[_0xa53b('0x35')](_0x1aaa9d[_0xa53b('0x31')][_0xa53b('0x35')]));_0x3965cf[_0xa53b('0x34')]=_0x3965cf[_0xa53b('0x34')][_0xa53b('0x36')]?_0x3965cf[_0xa53b('0x34')]:_0x45fde9[_0xa53b('0x30')];if(!_0x1aaa9d[_0xa53b('0x31')][_0xa53b('0x37')]('nolimit')){_0x3965cf[_0xa53b('0x1e')]=qs[_0xa53b('0x1e')](_0x1aaa9d['query'][_0xa53b('0x1e')]);_0x3965cf[_0xa53b('0x1d')]=qs[_0xa53b('0x1d')](_0x1aaa9d[_0xa53b('0x31')]['offset']);}_0x3965cf[_0xa53b('0x38')]=qs[_0xa53b('0x39')](_0x1aaa9d[_0xa53b('0x31')][_0xa53b('0x39')]);_0x3965cf[_0xa53b('0x3a')]=qs[_0xa53b('0x32')](_[_0xa53b('0x3b')](_0x1aaa9d[_0xa53b('0x31')],_0x45fde9[_0xa53b('0x32')]));if(_0x1aaa9d[_0xa53b('0x31')]['filter']){_0x3965cf[_0xa53b('0x3a')]=_[_0xa53b('0x3c')](_0x3965cf[_0xa53b('0x3a')],{'$or':_[_0xa53b('0x2a')](_0x1cf33b,function(_0x5adc98){if(_0x5adc98[_0xa53b('0x2e')]!==_0xa53b('0x3d')){var _0x239114={};_0x239114[_0x5adc98['name']]={'$like':'%'+_0x1aaa9d[_0xa53b('0x31')]['filter']+'%'};return _0x239114;}})});}_0x3965cf=_[_0xa53b('0x3c')]({},_0x3965cf,_0x1aaa9d[_0xa53b('0x3e')]);var _0x3062bf={'where':_0x3965cf[_0xa53b('0x3a')]};return db[_0xa53b('0x2b')]['count'](_0x3062bf)[_0xa53b('0x25')](function(_0xf3610b){_0x1f3418[_0xa53b('0x1c')]=_0xf3610b;if(_0x1aaa9d[_0xa53b('0x31')][_0xa53b('0x3f')]){_0x3965cf[_0xa53b('0x40')]=[{'all':!![]}];}return db['OpenchannelTransferReport'][_0xa53b('0x41')](_0x3965cf);})[_0xa53b('0x25')](function(_0x515fef){_0x1f3418['rows']=_0x515fef;return _0x1f3418;})[_0xa53b('0x25')](respondWithFilteredResult(_0x719e22,_0x3965cf))[_0xa53b('0x42')](handleError(_0x719e22,null));};exports[_0xa53b('0x43')]=function(_0x4d8064,_0x41796a){var _0x42da39={'raw':!![],'where':{'id':_0x4d8064['params']['id']}},_0x325202={};_0x325202[_0xa53b('0x30')]=_['keys'](db[_0xa53b('0x2b')][_0xa53b('0x2c')]);_0x325202['query']=_[_0xa53b('0x44')](_0x4d8064[_0xa53b('0x31')]);_0x325202[_0xa53b('0x32')]=_[_0xa53b('0x33')](_0x325202[_0xa53b('0x30')],_0x325202[_0xa53b('0x31')]);_0x42da39['attributes']=_[_0xa53b('0x33')](_0x325202['model'],qs[_0xa53b('0x35')](_0x4d8064[_0xa53b('0x31')][_0xa53b('0x35')]));_0x42da39[_0xa53b('0x34')]=_0x42da39[_0xa53b('0x34')]['length']?_0x42da39['attributes']:_0x325202['model'];if(_0x4d8064[_0xa53b('0x31')]['includeAll']){_0x42da39[_0xa53b('0x40')]=[{'all':!![]}];}_0x42da39=_[_0xa53b('0x3c')]({},_0x42da39,_0x4d8064[_0xa53b('0x3e')]);return db[_0xa53b('0x2b')][_0xa53b('0x45')](_0x42da39)[_0xa53b('0x25')](handleEntityNotFound(_0x41796a,null))[_0xa53b('0x25')](respondWithResult(_0x41796a,null))[_0xa53b('0x42')](handleError(_0x41796a,null));};exports[_0xa53b('0x46')]=function(_0x2084a0,_0x338132){return db[_0xa53b('0x2b')][_0xa53b('0x46')](_0x2084a0[_0xa53b('0x47')],{})[_0xa53b('0x25')](respondWithResult(_0x338132,0xc9))[_0xa53b('0x42')](handleError(_0x338132,null));};exports[_0xa53b('0x23')]=function(_0x33c04e,_0x2281ab){if(_0x33c04e[_0xa53b('0x47')]['id']){delete _0x33c04e[_0xa53b('0x47')]['id'];}return db[_0xa53b('0x2b')][_0xa53b('0x45')]({'where':{'id':_0x33c04e[_0xa53b('0x48')]['id']}})['then'](handleEntityNotFound(_0x2281ab,null))[_0xa53b('0x25')](saveUpdates(_0x33c04e['body'],null))['then'](respondWithResult(_0x2281ab,null))[_0xa53b('0x42')](handleError(_0x2281ab,null));};exports[_0xa53b('0x24')]=function(_0x494797,_0x2d061e){return db['OpenchannelTransferReport'][_0xa53b('0x45')]({'where':{'id':_0x494797[_0xa53b('0x48')]['id']}})[_0xa53b('0x25')](handleEntityNotFound(_0x2d061e,null))[_0xa53b('0x25')](removeEntity(_0x2d061e,null))[_0xa53b('0x42')](handleError(_0x2d061e,null));};exports[_0xa53b('0x49')]=function(_0x4ffb53,_0x530890){return db[_0xa53b('0x2b')][_0xa53b('0x49')]()[_0xa53b('0x25')](respondWithResult(_0x530890,null))[_0xa53b('0x42')](handleError(_0x530890,null));}; \ No newline at end of file +var _0xf8a6=['params','options','create','body','find','destroy','describe','html-pdf','eml-format','zip-dir','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','send','map','OpenchannelTransferReport','rawAttributes','type','key','model','query','keys','intersection','attributes','fields','length','order','sort','where','filters','pick','filter','merge','count','includeAll','include','findAll','catch'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xf8a6,0x113));var _0x6f8a=function(_0xbffba9,_0x2556df){_0xbffba9=_0xbffba9-0x0;var _0xd8c2c7=_0xf8a6[_0xbffba9];return _0xd8c2c7;};'use strict';var pdf=require(_0x6f8a('0x0'));var emlformat=require(_0x6f8a('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x6f8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f8a('0x3'));var moment=require(_0x6f8a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6f8a('0x5'));var util=require(_0x6f8a('0x6'));var path=require(_0x6f8a('0x7'));var sox=require('sox');var csv=require(_0x6f8a('0x8'));var ejs=require(_0x6f8a('0x9'));var fs=require('fs');var _=require(_0x6f8a('0xa'));var squel=require(_0x6f8a('0xb'));var crypto=require('crypto');var jsforce=require(_0x6f8a('0xc'));var deskjs=require(_0x6f8a('0xd'));var toCsv=require(_0x6f8a('0x8'));var querystring=require(_0x6f8a('0xe'));var Papa=require('papaparse');var Redis=require(_0x6f8a('0xf'));var authService=require(_0x6f8a('0x10'));var qs=require(_0x6f8a('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8a('0x12'));var logger=require('../../config/logger')(_0x6f8a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x6f8a('0x14'))['db'];function respondWithStatusCode(_0x26a036,_0x277ac6){_0x277ac6=_0x277ac6||0xcc;return function(_0xcb731d){if(_0xcb731d){return _0x26a036[_0x6f8a('0x15')](_0x277ac6);}return _0x26a036[_0x6f8a('0x16')](_0x277ac6)[_0x6f8a('0x17')]();};}function respondWithResult(_0x34e6d9,_0x297af7){_0x297af7=_0x297af7||0xc8;return function(_0xd70a97){if(_0xd70a97){return _0x34e6d9[_0x6f8a('0x16')](_0x297af7)[_0x6f8a('0x18')](_0xd70a97);}};}function respondWithFilteredResult(_0x19a420,_0x1e5194){return function(_0x2deffe){if(_0x2deffe){var _0x186fbb=_0x2deffe['count'],_0x3750cf=_0x1e5194[_0x6f8a('0x19')],_0x3a4396=_0x1e5194[_0x6f8a('0x19')]+_0x1e5194[_0x6f8a('0x1a')],_0x1c0617;if(_0x3a4396>=_0x186fbb){_0x3a4396=_0x186fbb;_0x1c0617=0xc8;}else{_0x1c0617=0xce;}_0x19a420[_0x6f8a('0x16')](_0x1c0617);return _0x19a420[_0x6f8a('0x1b')](_0x6f8a('0x1c'),_0x3750cf+'-'+_0x3a4396+'/'+_0x186fbb)[_0x6f8a('0x18')](_0x2deffe);}return null;};}function patchUpdates(_0xc52a4e){return function(_0x2e5296){try{jsonpatch[_0x6f8a('0x1d')](_0x2e5296,_0xc52a4e,!![]);}catch(_0x182aaa){return BPromise[_0x6f8a('0x1e')](_0x182aaa);}return _0x2e5296['save']();};}function saveUpdates(_0x2fbd29,_0x235286){return function(_0xa3be7){if(_0xa3be7){return _0xa3be7[_0x6f8a('0x1f')](_0x2fbd29)[_0x6f8a('0x20')](function(_0x1fbf27){return _0x1fbf27;});}return null;};}function removeEntity(_0x3eb54b,_0x2a764e){return function(_0x153b36){if(_0x153b36){return _0x153b36['destroy']()[_0x6f8a('0x20')](function(){_0x3eb54b[_0x6f8a('0x16')](0xcc)[_0x6f8a('0x17')]();});}};}function handleEntityNotFound(_0x15ef26,_0x3048b9){return function(_0x2368b7){if(!_0x2368b7){_0x15ef26[_0x6f8a('0x15')](0x194);}return _0x2368b7;};}function handleError(_0x3a3599,_0x58f248){_0x58f248=_0x58f248||0x1f4;return function(_0x48eafd){logger['error'](_0x48eafd[_0x6f8a('0x21')]);if(_0x48eafd['name']){delete _0x48eafd[_0x6f8a('0x22')];}_0x3a3599['status'](_0x58f248)[_0x6f8a('0x23')](_0x48eafd);};}exports['index']=function(_0x4c4e4e,_0x58ffb4){var _0x2249dd={},_0x204755={},_0x2adcf7={'count':0x0,'rows':[]};var _0x5e271c=_[_0x6f8a('0x24')](db[_0x6f8a('0x25')][_0x6f8a('0x26')],function(_0x2f8416){return{'name':_0x2f8416['fieldName'],'type':_0x2f8416[_0x6f8a('0x27')][_0x6f8a('0x28')]};});_0x204755[_0x6f8a('0x29')]=_[_0x6f8a('0x24')](_0x5e271c,_0x6f8a('0x22'));_0x204755[_0x6f8a('0x2a')]=_[_0x6f8a('0x2b')](_0x4c4e4e['query']);_0x204755['filters']=_[_0x6f8a('0x2c')](_0x204755[_0x6f8a('0x29')],_0x204755[_0x6f8a('0x2a')]);_0x2249dd[_0x6f8a('0x2d')]=_[_0x6f8a('0x2c')](_0x204755[_0x6f8a('0x29')],qs['fields'](_0x4c4e4e[_0x6f8a('0x2a')][_0x6f8a('0x2e')]));_0x2249dd['attributes']=_0x2249dd[_0x6f8a('0x2d')][_0x6f8a('0x2f')]?_0x2249dd[_0x6f8a('0x2d')]:_0x204755[_0x6f8a('0x29')];if(!_0x4c4e4e[_0x6f8a('0x2a')]['hasOwnProperty']('nolimit')){_0x2249dd[_0x6f8a('0x1a')]=qs[_0x6f8a('0x1a')](_0x4c4e4e['query']['limit']);_0x2249dd[_0x6f8a('0x19')]=qs['offset'](_0x4c4e4e['query']['offset']);}_0x2249dd[_0x6f8a('0x30')]=qs['sort'](_0x4c4e4e['query'][_0x6f8a('0x31')]);_0x2249dd[_0x6f8a('0x32')]=qs[_0x6f8a('0x33')](_[_0x6f8a('0x34')](_0x4c4e4e[_0x6f8a('0x2a')],_0x204755[_0x6f8a('0x33')]));if(_0x4c4e4e['query'][_0x6f8a('0x35')]){_0x2249dd[_0x6f8a('0x32')]=_['merge'](_0x2249dd[_0x6f8a('0x32')],{'$or':_[_0x6f8a('0x24')](_0x5e271c,function(_0x558c9b){if(_0x558c9b[_0x6f8a('0x27')]!=='VIRTUAL'){var _0xa71f66={};_0xa71f66[_0x558c9b[_0x6f8a('0x22')]]={'$like':'%'+_0x4c4e4e[_0x6f8a('0x2a')][_0x6f8a('0x35')]+'%'};return _0xa71f66;}})});}_0x2249dd=_[_0x6f8a('0x36')]({},_0x2249dd,_0x4c4e4e['options']);var _0x51cd48={'where':_0x2249dd['where']};return db[_0x6f8a('0x25')]['count'](_0x51cd48)[_0x6f8a('0x20')](function(_0xeea817){_0x2adcf7[_0x6f8a('0x37')]=_0xeea817;if(_0x4c4e4e[_0x6f8a('0x2a')][_0x6f8a('0x38')]){_0x2249dd[_0x6f8a('0x39')]=[{'all':!![]}];}return db[_0x6f8a('0x25')][_0x6f8a('0x3a')](_0x2249dd);})[_0x6f8a('0x20')](function(_0x46d0fd){_0x2adcf7['rows']=_0x46d0fd;return _0x2adcf7;})['then'](respondWithFilteredResult(_0x58ffb4,_0x2249dd))[_0x6f8a('0x3b')](handleError(_0x58ffb4,null));};exports['show']=function(_0x50d5d6,_0x1b1b91){var _0x36d117={'raw':!![],'where':{'id':_0x50d5d6[_0x6f8a('0x3c')]['id']}},_0x5016be={};_0x5016be['model']=_['keys'](db[_0x6f8a('0x25')][_0x6f8a('0x26')]);_0x5016be[_0x6f8a('0x2a')]=_[_0x6f8a('0x2b')](_0x50d5d6[_0x6f8a('0x2a')]);_0x5016be['filters']=_[_0x6f8a('0x2c')](_0x5016be[_0x6f8a('0x29')],_0x5016be[_0x6f8a('0x2a')]);_0x36d117['attributes']=_[_0x6f8a('0x2c')](_0x5016be[_0x6f8a('0x29')],qs[_0x6f8a('0x2e')](_0x50d5d6[_0x6f8a('0x2a')][_0x6f8a('0x2e')]));_0x36d117[_0x6f8a('0x2d')]=_0x36d117['attributes'][_0x6f8a('0x2f')]?_0x36d117[_0x6f8a('0x2d')]:_0x5016be[_0x6f8a('0x29')];if(_0x50d5d6[_0x6f8a('0x2a')][_0x6f8a('0x38')]){_0x36d117[_0x6f8a('0x39')]=[{'all':!![]}];}_0x36d117=_['merge']({},_0x36d117,_0x50d5d6[_0x6f8a('0x3d')]);return db[_0x6f8a('0x25')]['find'](_0x36d117)[_0x6f8a('0x20')](handleEntityNotFound(_0x1b1b91,null))[_0x6f8a('0x20')](respondWithResult(_0x1b1b91,null))[_0x6f8a('0x3b')](handleError(_0x1b1b91,null));};exports[_0x6f8a('0x3e')]=function(_0x12698f,_0x4e9da0){return db[_0x6f8a('0x25')][_0x6f8a('0x3e')](_0x12698f[_0x6f8a('0x3f')],{})[_0x6f8a('0x20')](respondWithResult(_0x4e9da0,0xc9))['catch'](handleError(_0x4e9da0,null));};exports[_0x6f8a('0x1f')]=function(_0x62423a,_0x2004a5){if(_0x62423a['body']['id']){delete _0x62423a['body']['id'];}return db[_0x6f8a('0x25')][_0x6f8a('0x40')]({'where':{'id':_0x62423a[_0x6f8a('0x3c')]['id']}})[_0x6f8a('0x20')](handleEntityNotFound(_0x2004a5,null))[_0x6f8a('0x20')](saveUpdates(_0x62423a[_0x6f8a('0x3f')],null))[_0x6f8a('0x20')](respondWithResult(_0x2004a5,null))['catch'](handleError(_0x2004a5,null));};exports[_0x6f8a('0x41')]=function(_0x2ab24d,_0x19a8bc){return db[_0x6f8a('0x25')]['find']({'where':{'id':_0x2ab24d[_0x6f8a('0x3c')]['id']}})[_0x6f8a('0x20')](handleEntityNotFound(_0x19a8bc,null))['then'](removeEntity(_0x19a8bc,null))[_0x6f8a('0x3b')](handleError(_0x19a8bc,null));};exports[_0x6f8a('0x42')]=function(_0x35b25c,_0x3f29a3){return db[_0x6f8a('0x25')][_0x6f8a('0x42')]()[_0x6f8a('0x20')](respondWithResult(_0x3f29a3,null))[_0x6f8a('0x3b')](handleError(_0x3f29a3,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index cf280ad..a830513 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 _0x94a6=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','../../config/environment','./openchannelTransferReport.attributes','define','OpenchannelTransferReport','report_openchannel_transfer'];(function(_0x47ffce,_0x187178){var _0xfeabd7=function(_0x48bc7f){while(--_0x48bc7f){_0x47ffce['push'](_0x47ffce['shift']());}};_0xfeabd7(++_0x187178);}(_0x94a6,0x9d));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x694a('0x0'));var util=require(_0x694a('0x1'));var logger=require(_0x694a('0x2'))(_0x694a('0x3'));var moment=require(_0x694a('0x4'));var BPromise=require('bluebird');var rp=require(_0x694a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x694a('0x6'));var attributes=require(_0x694a('0x7'));module['exports']=function(_0x48201c,_0xef87eb){return _0x48201c[_0x694a('0x8')](_0x694a('0x9'),attributes,{'tableName':_0x694a('0xa'),'paranoid':![],'indexes':[{'name':_0x694a('0xb'),'fields':[_0x694a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3055=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes','define','uniqueid','lodash','util','../../config/logger'];(function(_0x1762b4,_0x33d836){var _0x29beda=function(_0x31c2fa){while(--_0x31c2fa){_0x1762b4['push'](_0x1762b4['shift']());}};_0x29beda(++_0x33d836);}(_0x3055,0xd5));var _0x5305=function(_0x28be25,_0x174e44){_0x28be25=_0x28be25-0x0;var _0x1ce45a=_0x3055[_0x28be25];return _0x1ce45a;};'use strict';var _=require(_0x5305('0x0'));var util=require(_0x5305('0x1'));var logger=require(_0x5305('0x2'))(_0x5305('0x3'));var moment=require('moment');var BPromise=require(_0x5305('0x4'));var rp=require(_0x5305('0x5'));var fs=require('fs');var path=require(_0x5305('0x6'));var rimraf=require(_0x5305('0x7'));var config=require(_0x5305('0x8'));var attributes=require(_0x5305('0x9'));module['exports']=function(_0x3a8784,_0x27450e){return _0x3a8784[_0x5305('0xa')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0x5305('0xb'),'fields':[_0x5305('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index f06c0bf..c37245a 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 _0xf29c=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x13b5b2,_0x514cc6){var _0x46d405=function(_0x1fad12){while(--_0x1fad12){_0x13b5b2['push'](_0x13b5b2['shift']());}};_0x46d405(++_0x514cc6);}(_0xf29c,0xc7));var _0xcf29=function(_0x4db4b8,_0x194916){_0x4db4b8=_0x4db4b8-0x0;var _0x254564=_0xf29c[_0x4db4b8];return _0x254564;};'use strict';var _=require('lodash');var util=require(_0xcf29('0x0'));var moment=require(_0xcf29('0x1'));var BPromise=require(_0xcf29('0x2'));var rs=require(_0xcf29('0x3'));var fs=require('fs');var Redis=require(_0xcf29('0x4'));var db=require(_0xcf29('0x5'))['db'];var utils=require(_0xcf29('0x6'));var logger=require(_0xcf29('0x7'))(_0xcf29('0x8'));var config=require(_0xcf29('0x9'));var jayson=require(_0xcf29('0xa'));var client=jayson[_0xcf29('0xb')][_0xcf29('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x157dfe,_0x15ab38,_0x435ced){return new BPromise(function(_0x4e6469,_0x5ec45f){return client[_0xcf29('0xd')](_0x157dfe,_0x435ced)[_0xcf29('0xe')](function(_0x2e9d52){logger[_0xcf29('0xf')](_0xcf29('0x10'),_0x15ab38,_0xcf29('0x11'));logger[_0xcf29('0x12')](_0xcf29('0x13'),_0x15ab38,_0xcf29('0x11'),JSON[_0xcf29('0x14')](_0x2e9d52));if(_0x2e9d52[_0xcf29('0x15')]){if(_0x2e9d52[_0xcf29('0x15')]['code']===0x1f4){logger[_0xcf29('0x15')](_0xcf29('0x10'),_0x15ab38,_0x2e9d52['error'][_0xcf29('0x16')]);return _0x5ec45f(_0x2e9d52['error'][_0xcf29('0x16')]);}logger[_0xcf29('0x15')](_0xcf29('0x10'),_0x15ab38,_0x2e9d52[_0xcf29('0x15')][_0xcf29('0x16')]);return _0x4e6469(_0x2e9d52[_0xcf29('0x15')][_0xcf29('0x16')]);}else{logger[_0xcf29('0xf')](_0xcf29('0x10'),_0x15ab38,'request\x20sent');_0x4e6469(_0x2e9d52[_0xcf29('0x17')]['message']);}})[_0xcf29('0x18')](function(_0x5f31f7){logger[_0xcf29('0x15')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x15ab38,_0x5f31f7);_0x5ec45f(_0x5f31f7);});});} \ No newline at end of file +var _0xb209=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb'];(function(_0x9d53fb,_0x4b898b){var _0x12f955=function(_0x5b03f9){while(--_0x5b03f9){_0x9d53fb['push'](_0x9d53fb['shift']());}};_0x12f955(++_0x4b898b);}(_0xb209,0x6d));var _0x9b20=function(_0x270371,_0x333fc8){_0x270371=_0x270371-0x0;var _0x3aa4bb=_0xb209[_0x270371];return _0x3aa4bb;};'use strict';var _=require(_0x9b20('0x0'));var util=require(_0x9b20('0x1'));var moment=require(_0x9b20('0x2'));var BPromise=require(_0x9b20('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9b20('0x4'));var db=require(_0x9b20('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x9b20('0x6'))('rpc');var config=require(_0x9b20('0x7'));var jayson=require(_0x9b20('0x8'));var client=jayson[_0x9b20('0x9')][_0x9b20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a5039,_0xf80424,_0x46f19b){return new BPromise(function(_0xd8aba3,_0x1a7678){return client[_0x9b20('0xb')](_0x2a5039,_0x46f19b)[_0x9b20('0xc')](function(_0x485e01){logger[_0x9b20('0xd')](_0x9b20('0xe'),_0xf80424,_0x9b20('0xf'));logger[_0x9b20('0x10')](_0x9b20('0x11'),_0xf80424,_0x9b20('0xf'),JSON[_0x9b20('0x12')](_0x485e01));if(_0x485e01[_0x9b20('0x13')]){if(_0x485e01[_0x9b20('0x13')][_0x9b20('0x14')]===0x1f4){logger['error'](_0x9b20('0xe'),_0xf80424,_0x485e01[_0x9b20('0x13')][_0x9b20('0x15')]);return _0x1a7678(_0x485e01[_0x9b20('0x13')][_0x9b20('0x15')]);}logger['error'](_0x9b20('0xe'),_0xf80424,_0x485e01[_0x9b20('0x13')][_0x9b20('0x15')]);return _0xd8aba3(_0x485e01[_0x9b20('0x13')][_0x9b20('0x15')]);}else{logger[_0x9b20('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0xf80424,_0x9b20('0xf'));_0xd8aba3(_0x485e01['result'][_0x9b20('0x15')]);}})[_0x9b20('0x16')](function(_0x45403f){logger[_0x9b20('0x13')](_0x9b20('0xe'),_0xf80424,_0x45403f);_0x1a7678(_0x45403f);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index d61c311..66be73d 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 _0x43b9=['path','connect-timeout','express','../../components/interaction/service','../../config/environment','./pause.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x439309,_0x3b6fcb){var _0x21c1be=function(_0x451029){while(--_0x451029){_0x439309['push'](_0x439309['shift']());}};_0x21c1be(++_0x3b6fcb);}(_0x43b9,0x76));var _0x943b=function(_0x55a652,_0x13a6de){_0x55a652=_0x55a652-0x0;var _0x40aa0a=_0x43b9[_0x55a652];return _0x40aa0a;};'use strict';var multer=require(_0x943b('0x0'));var util=require(_0x943b('0x1'));var path=require(_0x943b('0x2'));var timeout=require(_0x943b('0x3'));var express=require(_0x943b('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x943b('0x5'));var config=require(_0x943b('0x6'));var controller=require(_0x943b('0x7'));router[_0x943b('0x8')]('/',auth[_0x943b('0x9')](),controller[_0x943b('0xa')]);router[_0x943b('0x8')](_0x943b('0xb'),auth[_0x943b('0x9')](),controller[_0x943b('0xc')]);router[_0x943b('0xd')]('/',auth[_0x943b('0x9')](),controller[_0x943b('0xe')]);router[_0x943b('0xf')](_0x943b('0xb'),auth[_0x943b('0x9')](),controller[_0x943b('0x10')]);router[_0x943b('0x11')](_0x943b('0xb'),auth[_0x943b('0x9')](),controller[_0x943b('0x12')]);module[_0x943b('0x13')]=router; \ No newline at end of file +var _0x3ba1=['create','put','update','delete','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','index','get','/:id','show','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x3ba1,0xe1));var _0x13ba=function(_0x1a3fa7,_0x3d2038){_0x1a3fa7=_0x1a3fa7-0x0;var _0x1fb704=_0x3ba1[_0x1a3fa7];return _0x1fb704;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x13ba('0x0'));var timeout=require(_0x13ba('0x1'));var express=require(_0x13ba('0x2'));var router=express['Router']();var auth=require(_0x13ba('0x3'));var interaction=require(_0x13ba('0x4'));var config=require(_0x13ba('0x5'));var controller=require(_0x13ba('0x6'));router['get']('/',auth[_0x13ba('0x7')](),controller[_0x13ba('0x8')]);router[_0x13ba('0x9')](_0x13ba('0xa'),auth['isAuthenticated'](),controller[_0x13ba('0xb')]);router[_0x13ba('0xc')]('/',auth[_0x13ba('0x7')](),controller[_0x13ba('0xd')]);router[_0x13ba('0xe')]('/:id',auth[_0x13ba('0x7')](),controller[_0x13ba('0xf')]);router[_0x13ba('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index 42f416d..db86301 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 _0x9db5=['STRING','sequelize','exports'];(function(_0x25f615,_0x449afa){var _0x37f350=function(_0xf1a6ea){while(--_0xf1a6ea){_0x25f615['push'](_0x25f615['shift']());}};_0x37f350(++_0x449afa);}(_0x9db5,0x6d));var _0x59db=function(_0x1b5f02,_0x3abf41){_0x1b5f02=_0x1b5f02-0x0;var _0x58977b=_0x9db5[_0x1b5f02];return _0x58977b;};'use strict';var Sequelize=require(_0x59db('0x0'));module[_0x59db('0x1')]={'name':{'type':Sequelize[_0x59db('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x59db('0x2')]}}; \ No newline at end of file +var _0x77e8=['sequelize','name','STRING'];(function(_0x204ec9,_0x5b927b){var _0x3b567a=function(_0x4a7f35){while(--_0x4a7f35){_0x204ec9['push'](_0x204ec9['shift']());}};_0x3b567a(++_0x5b927b);}(_0x77e8,0x1b9));var _0x877e=function(_0x4a53e2,_0x13321e){_0x4a53e2=_0x4a53e2-0x0;var _0x3f2d76=_0x77e8[_0x4a53e2];return _0x3f2d76;};'use strict';var Sequelize=require(_0x877e('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x877e('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x877e('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 86462a3..4951f8e 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 _0x9fc2=['filters','intersection','attributes','fields','length','nolimit','offset','sort','where','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','to-csv','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','status','json','limit','apply','save','then','destroy','get','end','sendStatus','error','stack','name','send','index','map','Pause','fieldName','type','key','model','keys','query'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x9fc2,0x19e));var _0x29fc=function(_0x89e916,_0x53c7cc){_0x89e916=_0x89e916-0x0;var _0x17c253=_0x9fc2[_0x89e916];return _0x17c253;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0x29fc('0x0'));var zipdir=require(_0x29fc('0x1'));var jsonpatch=require(_0x29fc('0x2'));var rp=require(_0x29fc('0x3'));var moment=require('moment');var BPromise=require(_0x29fc('0x4'));var Mustache=require(_0x29fc('0x5'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x29fc('0x6'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x29fc('0x7'));var squel=require(_0x29fc('0x8'));var crypto=require(_0x29fc('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x29fc('0xa'));var toCsv=require(_0x29fc('0x6'));var querystring=require('querystring');var Papa=require(_0x29fc('0xb'));var Redis=require(_0x29fc('0xc'));var authService=require(_0x29fc('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x29fc('0xe'));var hardwareService=require(_0x29fc('0xf'));var logger=require('../../config/logger')(_0x29fc('0x10'));var utils=require('../../config/utils');var config=require(_0x29fc('0x11'));var db=require(_0x29fc('0x12'))['db'];function respondWithStatusCode(_0xd841e7,_0x54b97c){_0x54b97c=_0x54b97c||0xcc;return function(_0x4c2ef7){if(_0x4c2ef7){return _0xd841e7['sendStatus'](_0x54b97c);}return _0xd841e7['status'](_0x54b97c)['end']();};}function respondWithResult(_0x28f7b8,_0x5d994b){_0x5d994b=_0x5d994b||0xc8;return function(_0x439a71){if(_0x439a71){return _0x28f7b8[_0x29fc('0x13')](_0x5d994b)[_0x29fc('0x14')](_0x439a71);}};}function respondWithFilteredResult(_0x56a676,_0x38c193){return function(_0x3a3773){if(_0x3a3773){var _0x59d70b=_0x3a3773['count'],_0x3580ff=_0x38c193['offset'],_0x130854=_0x38c193['offset']+_0x38c193[_0x29fc('0x15')],_0x2de51b;if(_0x130854>=_0x59d70b){_0x130854=_0x59d70b;_0x2de51b=0xc8;}else{_0x2de51b=0xce;}_0x56a676[_0x29fc('0x13')](_0x2de51b);return _0x56a676['set']('Content-Range',_0x3580ff+'-'+_0x130854+'/'+_0x59d70b)[_0x29fc('0x14')](_0x3a3773);}return null;};}function patchUpdates(_0x5e59f5){return function(_0x2792ff){try{jsonpatch[_0x29fc('0x16')](_0x2792ff,_0x5e59f5,!![]);}catch(_0x542a03){return BPromise['reject'](_0x542a03);}return _0x2792ff[_0x29fc('0x17')]();};}function saveUpdates(_0x188b15,_0x189ee7){return function(_0x48bd0a){if(_0x48bd0a){return _0x48bd0a['update'](_0x188b15)[_0x29fc('0x18')](function(_0x43b11c){return _0x43b11c;});}return null;};}function removeEntity(_0x515e65,_0x451f03){return function(_0xd81a5){if(_0xd81a5){return _0xd81a5[_0x29fc('0x19')]()['then'](function(){var _0x5538a1=_0xd81a5[_0x29fc('0x1a')]({'plain':!![]});var _0x4b14df='Pauses';return db['UserProfileResource'][_0x29fc('0x19')]({'where':{'type':_0x4b14df,'resourceId':_0x5538a1['id']}})[_0x29fc('0x18')](function(){return _0xd81a5;});})['then'](function(){_0x515e65[_0x29fc('0x13')](0xcc)[_0x29fc('0x1b')]();});}};}function handleEntityNotFound(_0x999f8f,_0x78d21e){return function(_0x5ab84e){if(!_0x5ab84e){_0x999f8f[_0x29fc('0x1c')](0x194);}return _0x5ab84e;};}function handleError(_0x1d88f5,_0x4c4e61){_0x4c4e61=_0x4c4e61||0x1f4;return function(_0x1d58e7){logger[_0x29fc('0x1d')](_0x1d58e7[_0x29fc('0x1e')]);if(_0x1d58e7[_0x29fc('0x1f')]){delete _0x1d58e7[_0x29fc('0x1f')];}_0x1d88f5[_0x29fc('0x13')](_0x4c4e61)[_0x29fc('0x20')](_0x1d58e7);};}exports[_0x29fc('0x21')]=function(_0x42fb2a,_0x5d1f45){var _0x107fde={},_0x4f5b08={},_0x173783={'count':0x0,'rows':[]};var _0x424ea8=_[_0x29fc('0x22')](db[_0x29fc('0x23')]['rawAttributes'],function(_0x40c59a){return{'name':_0x40c59a[_0x29fc('0x24')],'type':_0x40c59a[_0x29fc('0x25')][_0x29fc('0x26')]};});_0x4f5b08[_0x29fc('0x27')]=_[_0x29fc('0x22')](_0x424ea8,_0x29fc('0x1f'));_0x4f5b08['query']=_[_0x29fc('0x28')](_0x42fb2a[_0x29fc('0x29')]);_0x4f5b08[_0x29fc('0x2a')]=_[_0x29fc('0x2b')](_0x4f5b08[_0x29fc('0x27')],_0x4f5b08[_0x29fc('0x29')]);_0x107fde[_0x29fc('0x2c')]=_[_0x29fc('0x2b')](_0x4f5b08[_0x29fc('0x27')],qs[_0x29fc('0x2d')](_0x42fb2a[_0x29fc('0x29')][_0x29fc('0x2d')]));_0x107fde['attributes']=_0x107fde[_0x29fc('0x2c')][_0x29fc('0x2e')]?_0x107fde['attributes']:_0x4f5b08[_0x29fc('0x27')];if(!_0x42fb2a['query']['hasOwnProperty'](_0x29fc('0x2f'))){_0x107fde[_0x29fc('0x15')]=qs[_0x29fc('0x15')](_0x42fb2a[_0x29fc('0x29')][_0x29fc('0x15')]);_0x107fde['offset']=qs[_0x29fc('0x30')](_0x42fb2a[_0x29fc('0x29')]['offset']);}_0x107fde['order']=qs[_0x29fc('0x31')](_0x42fb2a['query'][_0x29fc('0x31')]);_0x107fde[_0x29fc('0x32')]=qs['filters'](_[_0x29fc('0x33')](_0x42fb2a[_0x29fc('0x29')],_0x4f5b08['filters']));if(_0x42fb2a[_0x29fc('0x29')][_0x29fc('0x34')]){_0x107fde[_0x29fc('0x32')]=_[_0x29fc('0x35')](_0x107fde['where'],{'$or':_['map'](_0x424ea8,function(_0x3e7033){if(_0x3e7033[_0x29fc('0x25')]!=='VIRTUAL'){var _0x16ba45={};_0x16ba45[_0x3e7033[_0x29fc('0x1f')]]={'$like':'%'+_0x42fb2a['query'][_0x29fc('0x34')]+'%'};return _0x16ba45;}})});}_0x107fde=_[_0x29fc('0x35')]({},_0x107fde,_0x42fb2a[_0x29fc('0x36')]);var _0x197e6e={'where':_0x107fde['where']};return db[_0x29fc('0x23')][_0x29fc('0x37')](_0x197e6e)[_0x29fc('0x18')](function(_0x1b56a3){_0x173783[_0x29fc('0x37')]=_0x1b56a3;if(_0x42fb2a[_0x29fc('0x29')][_0x29fc('0x38')]){_0x107fde[_0x29fc('0x39')]=[{'all':!![]}];}return db[_0x29fc('0x23')][_0x29fc('0x3a')](_0x107fde);})[_0x29fc('0x18')](function(_0x6e5990){_0x173783[_0x29fc('0x3b')]=_0x6e5990;return _0x173783;})[_0x29fc('0x18')](respondWithFilteredResult(_0x5d1f45,_0x107fde))['catch'](handleError(_0x5d1f45,null));};exports[_0x29fc('0x3c')]=function(_0x3ec7d0,_0x1efaac){var _0x174f1f={'raw':!![],'where':{'id':_0x3ec7d0[_0x29fc('0x3d')]['id']}},_0x4da472={};_0x4da472[_0x29fc('0x27')]=_[_0x29fc('0x28')](db[_0x29fc('0x23')][_0x29fc('0x3e')]);_0x4da472[_0x29fc('0x29')]=_[_0x29fc('0x28')](_0x3ec7d0[_0x29fc('0x29')]);_0x4da472[_0x29fc('0x2a')]=_[_0x29fc('0x2b')](_0x4da472[_0x29fc('0x27')],_0x4da472['query']);_0x174f1f[_0x29fc('0x2c')]=_[_0x29fc('0x2b')](_0x4da472[_0x29fc('0x27')],qs[_0x29fc('0x2d')](_0x3ec7d0[_0x29fc('0x29')][_0x29fc('0x2d')]));_0x174f1f[_0x29fc('0x2c')]=_0x174f1f[_0x29fc('0x2c')][_0x29fc('0x2e')]?_0x174f1f[_0x29fc('0x2c')]:_0x4da472[_0x29fc('0x27')];if(_0x3ec7d0[_0x29fc('0x29')][_0x29fc('0x38')]){_0x174f1f[_0x29fc('0x39')]=[{'all':!![]}];}_0x174f1f=_[_0x29fc('0x35')]({},_0x174f1f,_0x3ec7d0[_0x29fc('0x36')]);return db['Pause']['find'](_0x174f1f)[_0x29fc('0x18')](handleEntityNotFound(_0x1efaac,null))[_0x29fc('0x18')](respondWithResult(_0x1efaac,null))[_0x29fc('0x3f')](handleError(_0x1efaac,null));};exports[_0x29fc('0x40')]=function(_0x41a0d3,_0x1fad0a){return db[_0x29fc('0x23')][_0x29fc('0x40')](_0x41a0d3[_0x29fc('0x41')],{})[_0x29fc('0x18')](function(_0x5891b0){var _0x5bb6d9=_0x41a0d3[_0x29fc('0x42')][_0x29fc('0x1a')]({'plain':!![]});if(!_0x5bb6d9)throw new Error(_0x29fc('0x43'));if(_0x5bb6d9[_0x29fc('0x44')]===_0x29fc('0x42')){var _0xbc4843=_0x5891b0[_0x29fc('0x1a')]({'plain':!![]});var _0xb367a0=_0x29fc('0x45');return db[_0x29fc('0x46')][_0x29fc('0x47')]({'where':{'name':_0xb367a0,'userProfileId':_0x5bb6d9[_0x29fc('0x48')]},'raw':!![]})[_0x29fc('0x18')](function(_0x492aa0){if(_0x492aa0&&_0x492aa0[_0x29fc('0x49')]===0x0){return db[_0x29fc('0x4a')][_0x29fc('0x40')]({'name':_0xbc4843[_0x29fc('0x1f')],'resourceId':_0xbc4843['id'],'type':_0x492aa0['name'],'sectionId':_0x492aa0['id']},{})[_0x29fc('0x18')](function(){return _0x5891b0;});}else{return _0x5891b0;}})['catch'](function(_0x1b9dee){logger[_0x29fc('0x1d')](_0x29fc('0x4b'),_0x1b9dee);throw _0x1b9dee;});}return _0x5891b0;})[_0x29fc('0x18')](respondWithResult(_0x1fad0a,0xc9))[_0x29fc('0x3f')](handleError(_0x1fad0a,null));};exports['update']=function(_0x2b1f4e,_0x5d8c4b){if(_0x2b1f4e[_0x29fc('0x41')]['id']){delete _0x2b1f4e[_0x29fc('0x41')]['id'];}return db[_0x29fc('0x23')][_0x29fc('0x47')]({'where':{'id':_0x2b1f4e[_0x29fc('0x3d')]['id']}})[_0x29fc('0x18')](handleEntityNotFound(_0x5d8c4b,null))[_0x29fc('0x18')](saveUpdates(_0x2b1f4e[_0x29fc('0x41')],null))[_0x29fc('0x18')](respondWithResult(_0x5d8c4b,null))[_0x29fc('0x3f')](handleError(_0x5d8c4b,null));};exports[_0x29fc('0x19')]=function(_0x13c058,_0x44d647){return db['Pause']['find']({'where':{'id':_0x13c058['params']['id']}})['then'](handleEntityNotFound(_0x44d647,null))[_0x29fc('0x18')](removeEntity(_0x44d647,null))['catch'](handleError(_0x44d647,null));}; \ No newline at end of file +var _0xa24b=['../../config/logger','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','destroy','get','Pauses','UserProfileResource','then','stack','name','send','index','Pause','type','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','update','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x1cc961,_0x2c42ee){var _0x471d86=function(_0x44e422){while(--_0x44e422){_0x1cc961['push'](_0x1cc961['shift']());}};_0x471d86(++_0x2c42ee);}(_0xa24b,0x1cb));var _0xba24=function(_0x215e19,_0x3203e3){_0x215e19=_0x215e19-0x0;var _0xc16cab=_0xa24b[_0x215e19];return _0xc16cab;};'use strict';var pdf=require(_0xba24('0x0'));var emlformat=require(_0xba24('0x1'));var rimraf=require(_0xba24('0x2'));var zipdir=require(_0xba24('0x3'));var jsonpatch=require(_0xba24('0x4'));var rp=require(_0xba24('0x5'));var moment=require(_0xba24('0x6'));var BPromise=require(_0xba24('0x7'));var Mustache=require('mustache');var util=require(_0xba24('0x8'));var path=require(_0xba24('0x9'));var sox=require(_0xba24('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xba24('0xb'));var squel=require(_0xba24('0xc'));var crypto=require(_0xba24('0xd'));var jsforce=require(_0xba24('0xe'));var deskjs=require(_0xba24('0xf'));var toCsv=require(_0xba24('0x10'));var querystring=require('querystring');var Papa=require(_0xba24('0x11'));var Redis=require(_0xba24('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xba24('0x13'));var as=require(_0xba24('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xba24('0x15'))('api');var utils=require(_0xba24('0x16'));var config=require(_0xba24('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2859fd,_0x57bab7){_0x57bab7=_0x57bab7||0xcc;return function(_0x1f2f47){if(_0x1f2f47){return _0x2859fd['sendStatus'](_0x57bab7);}return _0x2859fd[_0xba24('0x18')](_0x57bab7)[_0xba24('0x19')]();};}function respondWithResult(_0x572559,_0x22f71c){_0x22f71c=_0x22f71c||0xc8;return function(_0x199794){if(_0x199794){return _0x572559[_0xba24('0x18')](_0x22f71c)[_0xba24('0x1a')](_0x199794);}};}function respondWithFilteredResult(_0x302d92,_0x27e321){return function(_0x1de0dd){if(_0x1de0dd){var _0x558a02=_0x1de0dd[_0xba24('0x1b')],_0xf2918a=_0x27e321[_0xba24('0x1c')],_0x2b8227=_0x27e321[_0xba24('0x1c')]+_0x27e321[_0xba24('0x1d')],_0x185330;if(_0x2b8227>=_0x558a02){_0x2b8227=_0x558a02;_0x185330=0xc8;}else{_0x185330=0xce;}_0x302d92[_0xba24('0x18')](_0x185330);return _0x302d92[_0xba24('0x1e')](_0xba24('0x1f'),_0xf2918a+'-'+_0x2b8227+'/'+_0x558a02)[_0xba24('0x1a')](_0x1de0dd);}return null;};}function patchUpdates(_0x522d97){return function(_0x36df66){try{jsonpatch[_0xba24('0x20')](_0x36df66,_0x522d97,!![]);}catch(_0x29ea64){return BPromise[_0xba24('0x21')](_0x29ea64);}return _0x36df66['save']();};}function saveUpdates(_0x3ddd04,_0x4693fb){return function(_0x495f54){if(_0x495f54){return _0x495f54['update'](_0x3ddd04)['then'](function(_0x3061f6){return _0x3061f6;});}return null;};}function removeEntity(_0x31cf16,_0x57f31f){return function(_0x298e98){if(_0x298e98){return _0x298e98[_0xba24('0x22')]()['then'](function(){var _0x450dfe=_0x298e98[_0xba24('0x23')]({'plain':!![]});var _0x500776=_0xba24('0x24');return db[_0xba24('0x25')]['destroy']({'where':{'type':_0x500776,'resourceId':_0x450dfe['id']}})[_0xba24('0x26')](function(){return _0x298e98;});})[_0xba24('0x26')](function(){_0x31cf16['status'](0xcc)[_0xba24('0x19')]();});}};}function handleEntityNotFound(_0x2dd168,_0x1a1b64){return function(_0x16903e){if(!_0x16903e){_0x2dd168['sendStatus'](0x194);}return _0x16903e;};}function handleError(_0x4bd1f9,_0x5c01bc){_0x5c01bc=_0x5c01bc||0x1f4;return function(_0x5ec44c){logger['error'](_0x5ec44c[_0xba24('0x27')]);if(_0x5ec44c[_0xba24('0x28')]){delete _0x5ec44c[_0xba24('0x28')];}_0x4bd1f9[_0xba24('0x18')](_0x5c01bc)[_0xba24('0x29')](_0x5ec44c);};}exports[_0xba24('0x2a')]=function(_0x491623,_0x1e1784){var _0x559ae4={},_0x503be6={},_0x37b394={'count':0x0,'rows':[]};var _0x361b90=_['map'](db[_0xba24('0x2b')]['rawAttributes'],function(_0x2c0379){return{'name':_0x2c0379['fieldName'],'type':_0x2c0379[_0xba24('0x2c')]['key']};});_0x503be6[_0xba24('0x2d')]=_[_0xba24('0x2e')](_0x361b90,_0xba24('0x28'));_0x503be6['query']=_[_0xba24('0x2f')](_0x491623[_0xba24('0x30')]);_0x503be6[_0xba24('0x31')]=_[_0xba24('0x32')](_0x503be6['model'],_0x503be6[_0xba24('0x30')]);_0x559ae4[_0xba24('0x33')]=_['intersection'](_0x503be6[_0xba24('0x2d')],qs['fields'](_0x491623[_0xba24('0x30')][_0xba24('0x34')]));_0x559ae4['attributes']=_0x559ae4[_0xba24('0x33')][_0xba24('0x35')]?_0x559ae4[_0xba24('0x33')]:_0x503be6[_0xba24('0x2d')];if(!_0x491623[_0xba24('0x30')][_0xba24('0x36')](_0xba24('0x37'))){_0x559ae4[_0xba24('0x1d')]=qs['limit'](_0x491623[_0xba24('0x30')][_0xba24('0x1d')]);_0x559ae4[_0xba24('0x1c')]=qs[_0xba24('0x1c')](_0x491623[_0xba24('0x30')][_0xba24('0x1c')]);}_0x559ae4[_0xba24('0x38')]=qs[_0xba24('0x39')](_0x491623[_0xba24('0x30')][_0xba24('0x39')]);_0x559ae4[_0xba24('0x3a')]=qs[_0xba24('0x31')](_[_0xba24('0x3b')](_0x491623['query'],_0x503be6[_0xba24('0x31')]));if(_0x491623[_0xba24('0x30')][_0xba24('0x3c')]){_0x559ae4[_0xba24('0x3a')]=_['merge'](_0x559ae4['where'],{'$or':_['map'](_0x361b90,function(_0x5ce7ee){if(_0x5ce7ee[_0xba24('0x2c')]!=='VIRTUAL'){var _0x446659={};_0x446659[_0x5ce7ee[_0xba24('0x28')]]={'$like':'%'+_0x491623['query']['filter']+'%'};return _0x446659;}})});}_0x559ae4=_[_0xba24('0x3d')]({},_0x559ae4,_0x491623[_0xba24('0x3e')]);var _0x3fa1c3={'where':_0x559ae4[_0xba24('0x3a')]};return db['Pause'][_0xba24('0x1b')](_0x3fa1c3)['then'](function(_0x541d1c){_0x37b394[_0xba24('0x1b')]=_0x541d1c;if(_0x491623[_0xba24('0x30')][_0xba24('0x3f')]){_0x559ae4[_0xba24('0x40')]=[{'all':!![]}];}return db['Pause'][_0xba24('0x41')](_0x559ae4);})['then'](function(_0x4866b3){_0x37b394[_0xba24('0x42')]=_0x4866b3;return _0x37b394;})[_0xba24('0x26')](respondWithFilteredResult(_0x1e1784,_0x559ae4))[_0xba24('0x43')](handleError(_0x1e1784,null));};exports[_0xba24('0x44')]=function(_0x1f32e5,_0xaa8dd4){var _0xe3a598={'raw':!![],'where':{'id':_0x1f32e5['params']['id']}},_0x20f8de={};_0x20f8de[_0xba24('0x2d')]=_[_0xba24('0x2f')](db[_0xba24('0x2b')][_0xba24('0x45')]);_0x20f8de[_0xba24('0x30')]=_[_0xba24('0x2f')](_0x1f32e5[_0xba24('0x30')]);_0x20f8de[_0xba24('0x31')]=_[_0xba24('0x32')](_0x20f8de[_0xba24('0x2d')],_0x20f8de['query']);_0xe3a598[_0xba24('0x33')]=_[_0xba24('0x32')](_0x20f8de[_0xba24('0x2d')],qs[_0xba24('0x34')](_0x1f32e5[_0xba24('0x30')]['fields']));_0xe3a598[_0xba24('0x33')]=_0xe3a598['attributes'][_0xba24('0x35')]?_0xe3a598[_0xba24('0x33')]:_0x20f8de[_0xba24('0x2d')];if(_0x1f32e5[_0xba24('0x30')]['includeAll']){_0xe3a598[_0xba24('0x40')]=[{'all':!![]}];}_0xe3a598=_[_0xba24('0x3d')]({},_0xe3a598,_0x1f32e5[_0xba24('0x3e')]);return db[_0xba24('0x2b')][_0xba24('0x46')](_0xe3a598)[_0xba24('0x26')](handleEntityNotFound(_0xaa8dd4,null))[_0xba24('0x26')](respondWithResult(_0xaa8dd4,null))['catch'](handleError(_0xaa8dd4,null));};exports[_0xba24('0x47')]=function(_0x82fdf6,_0x191c70){return db[_0xba24('0x2b')][_0xba24('0x47')](_0x82fdf6[_0xba24('0x48')],{})[_0xba24('0x26')](function(_0x490480){var _0x2beed3=_0x82fdf6[_0xba24('0x49')][_0xba24('0x23')]({'plain':!![]});if(!_0x2beed3)throw new Error(_0xba24('0x4a'));if(_0x2beed3['role']===_0xba24('0x49')){var _0x218af1=_0x490480[_0xba24('0x23')]({'plain':!![]});var _0x2c0a2a=_0xba24('0x24');return db[_0xba24('0x4b')][_0xba24('0x46')]({'where':{'name':_0x2c0a2a,'userProfileId':_0x2beed3[_0xba24('0x4c')]},'raw':!![]})['then'](function(_0x230790){if(_0x230790&&_0x230790[_0xba24('0x4d')]===0x0){return db[_0xba24('0x25')][_0xba24('0x47')]({'name':_0x218af1[_0xba24('0x28')],'resourceId':_0x218af1['id'],'type':_0x230790['name'],'sectionId':_0x230790['id']},{})[_0xba24('0x26')](function(){return _0x490480;});}else{return _0x490480;}})[_0xba24('0x43')](function(_0x454f45){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x454f45);throw _0x454f45;});}return _0x490480;})[_0xba24('0x26')](respondWithResult(_0x191c70,0xc9))[_0xba24('0x43')](handleError(_0x191c70,null));};exports[_0xba24('0x4e')]=function(_0x4e2dbb,_0x34da30){if(_0x4e2dbb[_0xba24('0x48')]['id']){delete _0x4e2dbb['body']['id'];}return db[_0xba24('0x2b')][_0xba24('0x46')]({'where':{'id':_0x4e2dbb[_0xba24('0x4f')]['id']}})[_0xba24('0x26')](handleEntityNotFound(_0x34da30,null))[_0xba24('0x26')](saveUpdates(_0x4e2dbb[_0xba24('0x48')],null))[_0xba24('0x26')](respondWithResult(_0x34da30,null))[_0xba24('0x43')](handleError(_0x34da30,null));};exports['destroy']=function(_0x1304b7,_0x55649c){return db['Pause']['find']({'where':{'id':_0x1304b7[_0xba24('0x4f')]['id']}})[_0xba24('0x26')](handleEntityNotFound(_0x55649c,null))[_0xba24('0x26')](removeEntity(_0x55649c,null))[_0xba24('0x43')](handleError(_0x55649c,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 9f6cc6a..d0bd771 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 _0x40ac=['api','moment','bluebird','request-promise','path','rimraf','./pause.attributes','exports','Pause','tools_pauses','lodash','../../config/logger'];(function(_0x38cdab,_0x58005c){var _0x506ffc=function(_0x5366d3){while(--_0x5366d3){_0x38cdab['push'](_0x38cdab['shift']());}};_0x506ffc(++_0x58005c);}(_0x40ac,0x1de));var _0xc40a=function(_0x5d1566,_0x3fed4b){_0x5d1566=_0x5d1566-0x0;var _0x3441a2=_0x40ac[_0x5d1566];return _0x3441a2;};'use strict';var _=require(_0xc40a('0x0'));var util=require('util');var logger=require(_0xc40a('0x1'))(_0xc40a('0x2'));var moment=require(_0xc40a('0x3'));var BPromise=require(_0xc40a('0x4'));var rp=require(_0xc40a('0x5'));var fs=require('fs');var path=require(_0xc40a('0x6'));var rimraf=require(_0xc40a('0x7'));var config=require('../../config/environment');var attributes=require(_0xc40a('0x8'));module[_0xc40a('0x9')]=function(_0xd6d891,_0x5e179f){return _0xd6d891['define'](_0xc40a('0xa'),attributes,{'tableName':_0xc40a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x117c=['../../config/environment','./pause.attributes','exports','define','tools_pauses','api','request-promise','path','rimraf'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x117c,0x71));var _0xc117=function(_0x3bb859,_0x589816){_0x3bb859=_0x3bb859-0x0;var _0x3bf534=_0x117c[_0x3bb859];return _0x3bf534;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xc117('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc117('0x1'));var fs=require('fs');var path=require(_0xc117('0x2'));var rimraf=require(_0xc117('0x3'));var config=require(_0xc117('0x4'));var attributes=require(_0xc117('0x5'));module[_0xc117('0x6')]=function(_0x52d09e,_0x3bb859){return _0x52d09e[_0xc117('0x7')]('Pause',attributes,{'tableName':_0xc117('0x8'),'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 350d2dc..e737568 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 _0x8eca=['Pause,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowPause','Pause','find','options','where','attributes','include','map','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','http','request','then','Pause,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2112d4,_0x3c863c){var _0x434972=function(_0x477020){while(--_0x477020){_0x2112d4['push'](_0x2112d4['shift']());}};_0x434972(++_0x3c863c);}(_0x8eca,0x1e2));var _0xa8ec=function(_0x2d7906,_0x4aea10){_0x2d7906=_0x2d7906-0x0;var _0x2604fc=_0x8eca[_0x2d7906];return _0x2604fc;};'use strict';var _=require(_0xa8ec('0x0'));var util=require(_0xa8ec('0x1'));var moment=require(_0xa8ec('0x2'));var BPromise=require('bluebird');var rs=require(_0xa8ec('0x3'));var fs=require('fs');var Redis=require(_0xa8ec('0x4'));var db=require(_0xa8ec('0x5'))['db'];var utils=require(_0xa8ec('0x6'));var logger=require(_0xa8ec('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xa8ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53209c,_0x32a1bf,_0x5ec6fa){return new BPromise(function(_0x2b7477,_0x2babfc){return client[_0xa8ec('0x9')](_0x53209c,_0x5ec6fa)[_0xa8ec('0xa')](function(_0x910c7b){logger['info'](_0xa8ec('0xb'),_0x32a1bf,_0xa8ec('0xc'));logger[_0xa8ec('0xd')](_0xa8ec('0xe'),_0x32a1bf,_0xa8ec('0xc'),JSON[_0xa8ec('0xf')](_0x910c7b));if(_0x910c7b[_0xa8ec('0x10')]){if(_0x910c7b[_0xa8ec('0x10')][_0xa8ec('0x11')]===0x1f4){logger[_0xa8ec('0x10')](_0xa8ec('0xb'),_0x32a1bf,_0x910c7b[_0xa8ec('0x10')][_0xa8ec('0x12')]);return _0x2babfc(_0x910c7b[_0xa8ec('0x10')][_0xa8ec('0x12')]);}logger['error'](_0xa8ec('0xb'),_0x32a1bf,_0x910c7b[_0xa8ec('0x10')][_0xa8ec('0x12')]);return _0x2b7477(_0x910c7b[_0xa8ec('0x10')][_0xa8ec('0x12')]);}else{logger[_0xa8ec('0x13')](_0xa8ec('0xb'),_0x32a1bf,_0xa8ec('0xc'));_0x2b7477(_0x910c7b[_0xa8ec('0x14')][_0xa8ec('0x12')]);}})[_0xa8ec('0x15')](function(_0x202755){logger['error']('Pause,\x20%s,\x20%s',_0x32a1bf,_0x202755);_0x2babfc(_0x202755);});});}exports[_0xa8ec('0x16')]=function(_0x3a418d){var _0x3f5c37=this;return new Promise(function(_0x21fe84,_0x3294e9){return db[_0xa8ec('0x17')][_0xa8ec('0x18')]({'raw':_0x3a418d[_0xa8ec('0x19')]?_0x3a418d[_0xa8ec('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x3a418d[_0xa8ec('0x19')]?_0x3a418d[_0xa8ec('0x19')][_0xa8ec('0x1a')]||null:null,'attributes':_0x3a418d[_0xa8ec('0x19')]?_0x3a418d[_0xa8ec('0x19')][_0xa8ec('0x1b')]||null:null,'include':_0x3a418d['options']?_0x3a418d[_0xa8ec('0x19')][_0xa8ec('0x1c')]?_[_0xa8ec('0x1d')](_0x3a418d[_0xa8ec('0x19')][_0xa8ec('0x1c')],function(_0x266eda){return{'model':db[_0x266eda[_0xa8ec('0x1e')]],'as':_0x266eda['as'],'attributes':_0x266eda['attributes'],'include':_0x266eda[_0xa8ec('0x1c')]?_[_0xa8ec('0x1d')](_0x266eda[_0xa8ec('0x1c')],function(_0x1e8479){return{'model':db[_0x1e8479['model']],'as':_0x1e8479['as'],'attributes':_0x1e8479[_0xa8ec('0x1b')],'include':_0x1e8479[_0xa8ec('0x1c')]?_[_0xa8ec('0x1d')](_0x1e8479['include'],function(_0x1df884){return{'model':db[_0x1df884[_0xa8ec('0x1e')]],'as':_0x1df884['as'],'attributes':_0x1df884[_0xa8ec('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xa8ec('0xa')](function(_0x5211b6){logger[_0xa8ec('0x13')](_0xa8ec('0x16'),_0x3a418d);logger[_0xa8ec('0xd')](_0xa8ec('0x16'),_0x3a418d,JSON['stringify'](_0x5211b6));_0x21fe84(_0x5211b6);})[_0xa8ec('0x15')](function(_0x3e4ae9){logger['error'](_0xa8ec('0x16'),_0x3e4ae9[_0xa8ec('0x12')],_0x3a418d);_0x3294e9(_0x3f5c37['error'](0x1f4,_0x3e4ae9[_0xa8ec('0x12')]));});});}; \ No newline at end of file +var _0x9434=['Pause,\x20%s,\x20%s','message','result','catch','ShowPause','Pause','options','raw','where','attributes','include','map','model','stringify','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','Pause,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x7e1f88,_0x2a3ea5){var _0x15ab33=function(_0x5a9a4c){while(--_0x5a9a4c){_0x7e1f88['push'](_0x7e1f88['shift']());}};_0x15ab33(++_0x2a3ea5);}(_0x9434,0x74));var _0x4943=function(_0x261a22,_0x1091d4){_0x261a22=_0x261a22-0x0;var _0x5767f9=_0x9434[_0x261a22];return _0x5767f9;};'use strict';var _=require(_0x4943('0x0'));var util=require('util');var moment=require(_0x4943('0x1'));var BPromise=require('bluebird');var rs=require(_0x4943('0x2'));var fs=require('fs');var Redis=require(_0x4943('0x3'));var db=require(_0x4943('0x4'))['db'];var utils=require(_0x4943('0x5'));var logger=require(_0x4943('0x6'))(_0x4943('0x7'));var config=require(_0x4943('0x8'));var jayson=require(_0x4943('0x9'));var client=jayson[_0x4943('0xa')][_0x4943('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f29b9,_0x4ef6fc,_0x14c927){return new BPromise(function(_0x1a85c0,_0x2f09a4){return client[_0x4943('0xc')](_0x4f29b9,_0x14c927)[_0x4943('0xd')](function(_0xdc078c){logger[_0x4943('0xe')]('Pause,\x20%s,\x20%s',_0x4ef6fc,_0x4943('0xf'));logger[_0x4943('0x10')](_0x4943('0x11'),_0x4ef6fc,_0x4943('0xf'),JSON['stringify'](_0xdc078c));if(_0xdc078c[_0x4943('0x12')]){if(_0xdc078c[_0x4943('0x12')][_0x4943('0x13')]===0x1f4){logger[_0x4943('0x12')](_0x4943('0x14'),_0x4ef6fc,_0xdc078c['error'][_0x4943('0x15')]);return _0x2f09a4(_0xdc078c[_0x4943('0x12')][_0x4943('0x15')]);}logger['error']('Pause,\x20%s,\x20%s',_0x4ef6fc,_0xdc078c[_0x4943('0x12')]['message']);return _0x1a85c0(_0xdc078c[_0x4943('0x12')]['message']);}else{logger[_0x4943('0xe')](_0x4943('0x14'),_0x4ef6fc,_0x4943('0xf'));_0x1a85c0(_0xdc078c[_0x4943('0x16')][_0x4943('0x15')]);}})[_0x4943('0x17')](function(_0x1ba009){logger[_0x4943('0x12')](_0x4943('0x14'),_0x4ef6fc,_0x1ba009);_0x2f09a4(_0x1ba009);});});}exports[_0x4943('0x18')]=function(_0x157c6e){var _0x59edd5=this;return new Promise(function(_0x16d520,_0x24e33e){return db[_0x4943('0x19')]['find']({'raw':_0x157c6e[_0x4943('0x1a')]?_0x157c6e['options'][_0x4943('0x1b')]===undefined?!![]:![]:!![],'where':_0x157c6e['options']?_0x157c6e[_0x4943('0x1a')][_0x4943('0x1c')]||null:null,'attributes':_0x157c6e['options']?_0x157c6e[_0x4943('0x1a')][_0x4943('0x1d')]||null:null,'include':_0x157c6e[_0x4943('0x1a')]?_0x157c6e[_0x4943('0x1a')][_0x4943('0x1e')]?_[_0x4943('0x1f')](_0x157c6e[_0x4943('0x1a')]['include'],function(_0x343af3){return{'model':db[_0x343af3[_0x4943('0x20')]],'as':_0x343af3['as'],'attributes':_0x343af3['attributes'],'include':_0x343af3[_0x4943('0x1e')]?_[_0x4943('0x1f')](_0x343af3[_0x4943('0x1e')],function(_0x10542c){return{'model':db[_0x10542c[_0x4943('0x20')]],'as':_0x10542c['as'],'attributes':_0x10542c[_0x4943('0x1d')],'include':_0x10542c[_0x4943('0x1e')]?_[_0x4943('0x1f')](_0x10542c[_0x4943('0x1e')],function(_0x1e0859){return{'model':db[_0x1e0859['model']],'as':_0x1e0859['as'],'attributes':_0x1e0859[_0x4943('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4943('0xd')](function(_0x2c68f6){logger['info']('ShowPause',_0x157c6e);logger['debug'](_0x4943('0x18'),_0x157c6e,JSON[_0x4943('0x21')](_0x2c68f6));_0x16d520(_0x2c68f6);})['catch'](function(_0x2e4b1a){logger[_0x4943('0x12')](_0x4943('0x18'),_0x2e4b1a[_0x4943('0x15')],_0x157c6e);_0x24e33e(_0x59edd5[_0x4943('0x12')](0x1f4,_0x2e4b1a['message']));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 33ca5ec..a2da394 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 _0x827d=['util','path','connect-timeout','express','Router','../../config/environment','./plugin.controller','get','index','webhookGet','isAuthenticated','show','/:id/download','join','root','server/files/plugins','originalname','replace','%s-%s%s','basename','now','extname','post','single','upload','/webhook','put','update','delete','/:id','multer'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0x827d,0x116));var _0xd827=function(_0x481201,_0x3d01c1){_0x481201=_0x481201-0x0;var _0x24782d=_0x827d[_0x481201];return _0x24782d;};'use strict';var multer=require(_0xd827('0x0'));var util=require(_0xd827('0x1'));var path=require(_0xd827('0x2'));var timeout=require(_0xd827('0x3'));var express=require(_0xd827('0x4'));var router=express[_0xd827('0x5')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd827('0x6'));var controller=require(_0xd827('0x7'));router[_0xd827('0x8')]('/',auth['isAuthenticated'](),controller[_0xd827('0x9')]);router['get']('/webhook',controller[_0xd827('0xa')]);router[_0xd827('0x8')]('/:id',auth[_0xd827('0xb')](),controller[_0xd827('0xc')]);router[_0xd827('0x8')](_0xd827('0xd'),auth[_0xd827('0xb')](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x530b91,_0x1b41d4,_0x1696af){_0x1696af(null,path[_0xd827('0xe')](config[_0xd827('0xf')],_0xd827('0x10')));},'filename':function(_0x3f171f,_0x296523,_0x124568){_0x296523[_0xd827('0x11')]=_0x296523[_0xd827('0x11')][_0xd827('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x124568(null,util['format'](_0xd827('0x13'),path[_0xd827('0x14')](_0x296523[_0xd827('0x11')],path['extname'](_0x296523[_0xd827('0x11')])),Date[_0xd827('0x15')](),path[_0xd827('0x16')](_0x296523[_0xd827('0x11')])));}})});router[_0xd827('0x17')]('/',upload[_0xd827('0x18')]('file'),controller[_0xd827('0x19')]);router[_0xd827('0x17')](_0xd827('0x1a'),controller['webhookPost']);router[_0xd827('0x1b')]('/:id',auth[_0xd827('0xb')](),controller[_0xd827('0x1c')]);router[_0xd827('0x1d')](_0xd827('0x1e'),auth[_0xd827('0xb')](),controller[_0xd827('0x1d')]);module['exports']=router; \ No newline at end of file +var _0x5427=['isAuthenticated','show','/:id/download','diskStorage','originalname','replace','format','basename','extname','now','post','single','upload','webhookPost','update','delete','/:id','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','get','index','/webhook','webhookGet'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x5427,0x19a));var _0x7542=function(_0x2dd59a,_0x1d7030){_0x2dd59a=_0x2dd59a-0x0;var _0x4235fb=_0x5427[_0x2dd59a];return _0x4235fb;};'use strict';var multer=require(_0x7542('0x0'));var util=require(_0x7542('0x1'));var path=require(_0x7542('0x2'));var timeout=require(_0x7542('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x7542('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x7542('0x5'));var controller=require('./plugin.controller');router[_0x7542('0x6')]('/',auth['isAuthenticated'](),controller[_0x7542('0x7')]);router[_0x7542('0x6')](_0x7542('0x8'),controller[_0x7542('0x9')]);router[_0x7542('0x6')]('/:id',auth[_0x7542('0xa')](),controller[_0x7542('0xb')]);router['get'](_0x7542('0xc'),auth[_0x7542('0xa')](),controller['download']);var upload=multer({'storage':multer[_0x7542('0xd')]({'destination':function(_0x1d2c03,_0x3190f6,_0xd88bc8){_0xd88bc8(null,path['join'](config['root'],'server/files/plugins'));},'filename':function(_0x699886,_0x20a879,_0x6c571e){_0x20a879['originalname']=_0x20a879[_0x7542('0xe')][_0x7542('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x6c571e(null,util[_0x7542('0x10')]('%s-%s%s',path[_0x7542('0x11')](_0x20a879[_0x7542('0xe')],path[_0x7542('0x12')](_0x20a879[_0x7542('0xe')])),Date[_0x7542('0x13')](),path['extname'](_0x20a879[_0x7542('0xe')])));}})});router[_0x7542('0x14')]('/',upload[_0x7542('0x15')]('file'),controller[_0x7542('0x16')]);router['post']('/webhook',controller[_0x7542('0x17')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x7542('0x18')]);router[_0x7542('0x19')](_0x7542('0x1a'),auth[_0x7542('0xa')](),controller[_0x7542('0x19')]);module[_0x7542('0x1b')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index 3245335..40f6a35 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 _0xb8a4=['STRING','ENUM','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','exports'];(function(_0x3d9a9c,_0x399c94){var _0x42521e=function(_0x4a2535){while(--_0x4a2535){_0x3d9a9c['push'](_0x3d9a9c['shift']());}};_0x42521e(++_0x399c94);}(_0xb8a4,0x83));var _0x4b8a=function(_0x2cb3e1,_0x38ab56){_0x2cb3e1=_0x2cb3e1-0x0;var _0x3390b9=_0xb8a4[_0x2cb3e1];return _0x3390b9;};'use strict';var Sequelize=require('sequelize');module[_0x4b8a('0x0')]={'name':{'type':Sequelize[_0x4b8a('0x1')]},'type':{'type':Sequelize[_0x4b8a('0x2')]('html','script')},'description':{'type':Sequelize[_0x4b8a('0x3')]},'version':{'type':Sequelize[_0x4b8a('0x3')]},'path':{'type':Sequelize[_0x4b8a('0x1')],'comment':_0x4b8a('0x4')},'active':{'type':Sequelize[_0x4b8a('0x5')],'defaultValue':0x0,'comment':_0x4b8a('0x6')},'sidebar':{'type':Sequelize[_0x4b8a('0x2')](_0x4b8a('0x7'),_0x4b8a('0x8'),'always',_0x4b8a('0x9')),'defaultValue':'always','comment':_0x4b8a('0xa')},'icon':{'type':Sequelize[_0x4b8a('0x1')]},'adminUrl':{'type':Sequelize[_0x4b8a('0x1')]},'agentUrl':{'type':Sequelize[_0x4b8a('0x1')]},'scriptName':{'type':Sequelize[_0x4b8a('0x1')]},'scriptPath':{'type':Sequelize[_0x4b8a('0x1')]}}; \ No newline at end of file +var _0x4faa=['adminOnly','always','sequelize','exports','STRING','ENUM','html','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'];(function(_0xd0afc9,_0x56e8c9){var _0xfd8ba2=function(_0xfcf805){while(--_0xfcf805){_0xd0afc9['push'](_0xd0afc9['shift']());}};_0xfd8ba2(++_0x56e8c9);}(_0x4faa,0x18e));var _0xa4fa=function(_0x4bb66f,_0x3cd682){_0x4bb66f=_0x4bb66f-0x0;var _0xf2772f=_0x4faa[_0x4bb66f];return _0xf2772f;};'use strict';var Sequelize=require(_0xa4fa('0x0'));module[_0xa4fa('0x1')]={'name':{'type':Sequelize[_0xa4fa('0x2')]},'type':{'type':Sequelize[_0xa4fa('0x3')](_0xa4fa('0x4'),'script')},'description':{'type':Sequelize[_0xa4fa('0x5')]},'version':{'type':Sequelize[_0xa4fa('0x5')]},'path':{'type':Sequelize[_0xa4fa('0x2')],'comment':_0xa4fa('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize['ENUM'](_0xa4fa('0x7'),'agentOnly','always','never'),'defaultValue':_0xa4fa('0x8'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize[_0xa4fa('0x2')]},'agentUrl':{'type':Sequelize[_0xa4fa('0x2')]},'scriptName':{'type':Sequelize[_0xa4fa('0x2')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index 0da09b9..2c2217f 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 _0x155b=['Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','Invalid\x20plugin\x20structure','lstatSync','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','Invalid\x20manifest:\x20name\x20missing','undefined','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','views','Invalid\x20manifest:\x20views\x20missing','admin','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','version','html','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Extracted\x20folder\x20removed','params','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','method','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','extract-zip','rimraf','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','then','get','Plugins','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','includeAll','include','rows','catch','show','Plugin','rawAttributes','options','find','download','join','root','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','pipe','glob','dirname','attachments/**/*','finalize','close','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','server/files/plugins'];(function(_0x19db73,_0x4efa84){var _0x5601d4=function(_0x3c6c54){while(--_0x3c6c54){_0x19db73['push'](_0x19db73['shift']());}};_0x5601d4(++_0x4efa84);}(_0x155b,0xef));var _0xb155=function(_0xac3027,_0x59d1d9){_0xac3027=_0xac3027-0x0;var _0x4cc775=_0x155b[_0xac3027];return _0x4cc775;};'use strict';var pdf=require(_0xb155('0x0'));var emlformat=require(_0xb155('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb155('0x2'));var jsonpatch=require(_0xb155('0x3'));var rp=require('request-promise');var moment=require(_0xb155('0x4'));var BPromise=require(_0xb155('0x5'));var Mustache=require(_0xb155('0x6'));var util=require(_0xb155('0x7'));var path=require(_0xb155('0x8'));var sox=require(_0xb155('0x9'));var csv=require(_0xb155('0xa'));var ejs=require(_0xb155('0xb'));var fs=require('fs');var _=require(_0xb155('0xc'));var squel=require(_0xb155('0xd'));var crypto=require(_0xb155('0xe'));var jsforce=require(_0xb155('0xf'));var deskjs=require(_0xb155('0x10'));var toCsv=require(_0xb155('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0xb155('0x11'));var rimraf=require(_0xb155('0x12'));var archiver=require(_0xb155('0x13'));var Redis=require(_0xb155('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xb155('0x15'));var as=require(_0xb155('0x16'));var hardwareService=require(_0xb155('0x17'));var logger=require(_0xb155('0x18'))(_0xb155('0x19'));var utils=require('../../config/utils');var config=require(_0xb155('0x1a'));var db=require(_0xb155('0x1b'))['db'];config['redis']=_[_0xb155('0x1c')](config[_0xb155('0x1d')],{'host':_0xb155('0x1e'),'port':0x18eb});var socket=require(_0xb155('0x1f'))(new Redis(config[_0xb155('0x1d')]));require(_0xb155('0x20'))[_0xb155('0x21')](socket);function respondWithStatusCode(_0x39c30e,_0x53414a){_0x53414a=_0x53414a||0xcc;return function(_0x1e310c){if(_0x1e310c){return _0x39c30e[_0xb155('0x22')](_0x53414a);}return _0x39c30e[_0xb155('0x23')](_0x53414a)[_0xb155('0x24')]();};}function respondWithResult(_0x45578d,_0xaa28e7){_0xaa28e7=_0xaa28e7||0xc8;return function(_0x448621){if(_0x448621){return _0x45578d['status'](_0xaa28e7)[_0xb155('0x25')](_0x448621);}};}function respondWithFilteredResult(_0x6f07b4,_0x42b6d3){return function(_0x2a6da6){if(_0x2a6da6){var _0x449aff=_0x2a6da6[_0xb155('0x26')],_0x2b6001=_0x42b6d3[_0xb155('0x27')],_0x37ce4a=_0x42b6d3[_0xb155('0x27')]+_0x42b6d3[_0xb155('0x28')],_0x7bb01e;if(_0x37ce4a>=_0x449aff){_0x37ce4a=_0x449aff;_0x7bb01e=0xc8;}else{_0x7bb01e=0xce;}_0x6f07b4[_0xb155('0x23')](_0x7bb01e);return _0x6f07b4[_0xb155('0x29')](_0xb155('0x2a'),_0x2b6001+'-'+_0x37ce4a+'/'+_0x449aff)['json'](_0x2a6da6);}return null;};}function patchUpdates(_0x3779f0){return function(_0x5a5281){try{jsonpatch['apply'](_0x5a5281,_0x3779f0,!![]);}catch(_0x53c672){return BPromise[_0xb155('0x2b')](_0x53c672);}return _0x5a5281['save']();};}function saveUpdates(_0xe2bd7,_0x4c6dc5){return function(_0x595509){if(_0x595509){return _0x595509[_0xb155('0x2c')](_0xe2bd7)[_0xb155('0x2d')](function(_0x131060){return _0x131060;});}return null;};}function removeEntity(_0x46916c,_0x3c50f2){return function(_0x2ee536){if(_0x2ee536){return _0x2ee536['destroy']()[_0xb155('0x2d')](function(){var _0x471700=_0x2ee536[_0xb155('0x2e')]({'plain':!![]});var _0x3f668c=_0xb155('0x2f');return db[_0xb155('0x30')][_0xb155('0x31')]({'where':{'type':_0x3f668c,'resourceId':_0x471700['id']}})['then'](function(){return _0x2ee536;});})['then'](function(){_0x46916c[_0xb155('0x23')](0xcc)[_0xb155('0x24')]();});}};}function handleEntityNotFound(_0x266ad0,_0x114446){return function(_0x9472a1){if(!_0x9472a1){_0x266ad0[_0xb155('0x22')](0x194);}return _0x9472a1;};}function handleError(_0x59f12d,_0x32316a){_0x32316a=_0x32316a||0x1f4;return function(_0x64d1e){logger[_0xb155('0x32')](_0x64d1e[_0xb155('0x33')]);if(_0x64d1e[_0xb155('0x34')]){delete _0x64d1e[_0xb155('0x34')];}_0x59f12d[_0xb155('0x23')](_0x32316a)[_0xb155('0x35')](_0x64d1e);};}exports[_0xb155('0x36')]=function(_0x510443,_0x40e338){var _0x172254={},_0x30e5e0={},_0x25587a={'count':0x0,'rows':[]};var _0x1a99da=_[_0xb155('0x37')](db['Plugin']['rawAttributes'],function(_0xcdc993){return{'name':_0xcdc993[_0xb155('0x38')],'type':_0xcdc993[_0xb155('0x39')][_0xb155('0x3a')]};});_0x30e5e0[_0xb155('0x3b')]=_[_0xb155('0x37')](_0x1a99da,_0xb155('0x34'));_0x30e5e0['query']=_[_0xb155('0x3c')](_0x510443[_0xb155('0x3d')]);_0x30e5e0['filters']=_[_0xb155('0x3e')](_0x30e5e0['model'],_0x30e5e0[_0xb155('0x3d')]);_0x172254[_0xb155('0x3f')]=_[_0xb155('0x3e')](_0x30e5e0[_0xb155('0x3b')],qs[_0xb155('0x40')](_0x510443['query']['fields']));_0x172254[_0xb155('0x3f')]=_0x172254[_0xb155('0x3f')][_0xb155('0x41')]?_0x172254[_0xb155('0x3f')]:_0x30e5e0['model'];if(!_0x510443[_0xb155('0x3d')][_0xb155('0x42')](_0xb155('0x43'))){_0x172254[_0xb155('0x28')]=qs['limit'](_0x510443[_0xb155('0x3d')]['limit']);_0x172254[_0xb155('0x27')]=qs['offset'](_0x510443['query'][_0xb155('0x27')]);}_0x172254['order']=qs[_0xb155('0x44')](_0x510443['query'][_0xb155('0x44')]);_0x172254[_0xb155('0x45')]=qs[_0xb155('0x46')](_[_0xb155('0x47')](_0x510443[_0xb155('0x3d')],_0x30e5e0[_0xb155('0x46')]));if(_0x510443[_0xb155('0x3d')][_0xb155('0x48')]){_0x172254[_0xb155('0x45')]=_[_0xb155('0x49')](_0x172254[_0xb155('0x45')],{'$or':_[_0xb155('0x37')](_0x1a99da,function(_0xfb3ebd){if(_0xfb3ebd['type']!=='VIRTUAL'){var _0x198cec={};_0x198cec[_0xfb3ebd[_0xb155('0x34')]]={'$like':'%'+_0x510443[_0xb155('0x3d')][_0xb155('0x48')]+'%'};return _0x198cec;}})});}_0x172254=_[_0xb155('0x49')]({},_0x172254,_0x510443['options']);var _0x986713={'where':_0x172254[_0xb155('0x45')]};return db['Plugin'][_0xb155('0x26')](_0x986713)['then'](function(_0x46d92f){_0x25587a[_0xb155('0x26')]=_0x46d92f;if(_0x510443[_0xb155('0x3d')][_0xb155('0x4a')]){_0x172254[_0xb155('0x4b')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x172254);})[_0xb155('0x2d')](function(_0x3b41c0){_0x25587a[_0xb155('0x4c')]=_0x3b41c0;return _0x25587a;})['then'](respondWithFilteredResult(_0x40e338,_0x172254))[_0xb155('0x4d')](handleError(_0x40e338,null));};exports[_0xb155('0x4e')]=function(_0x199d80,_0x4e28d7){var _0x2d42e6={'raw':!![],'where':{'id':_0x199d80['params']['id']}},_0x52c6bb={};_0x52c6bb['model']=_[_0xb155('0x3c')](db[_0xb155('0x4f')][_0xb155('0x50')]);_0x52c6bb[_0xb155('0x3d')]=_[_0xb155('0x3c')](_0x199d80[_0xb155('0x3d')]);_0x52c6bb[_0xb155('0x46')]=_['intersection'](_0x52c6bb[_0xb155('0x3b')],_0x52c6bb[_0xb155('0x3d')]);_0x2d42e6[_0xb155('0x3f')]=_[_0xb155('0x3e')](_0x52c6bb[_0xb155('0x3b')],qs[_0xb155('0x40')](_0x199d80[_0xb155('0x3d')]['fields']));_0x2d42e6[_0xb155('0x3f')]=_0x2d42e6[_0xb155('0x3f')][_0xb155('0x41')]?_0x2d42e6[_0xb155('0x3f')]:_0x52c6bb['model'];if(_0x199d80[_0xb155('0x3d')]['includeAll']){_0x2d42e6[_0xb155('0x4b')]=[{'all':!![]}];}_0x2d42e6=_['merge']({},_0x2d42e6,_0x199d80[_0xb155('0x51')]);return db[_0xb155('0x4f')][_0xb155('0x52')](_0x2d42e6)[_0xb155('0x2d')](handleEntityNotFound(_0x4e28d7,null))[_0xb155('0x2d')](respondWithResult(_0x4e28d7,null))[_0xb155('0x4d')](handleError(_0x4e28d7,null));};exports[_0xb155('0x53')]=function(_0x5bf560,_0x15b1f0,_0x10b6a4){return db[_0xb155('0x4f')]['find']({'where':{'id':_0x5bf560['params']['id']},'attributes':[_0xb155('0x34'),_0xb155('0x8')],'raw':!![]})[_0xb155('0x2d')](handleEntityNotFound(_0x15b1f0,null))['then'](function(_0x40dbec){if(_0x40dbec){var _0x3df0f4=path[_0xb155('0x54')](config[_0xb155('0x55')],'server/files/plugins',util[_0xb155('0x56')](_0xb155('0x57'),path[_0xb155('0x58')](_0x40dbec['path'])));var _0x333da9=fs[_0xb155('0x59')](_0x3df0f4);var _0x18d03a=archiver(_0xb155('0x5a'),{'zlib':{'level':0x9}});_0x18d03a['on'](_0xb155('0x5b'),function(_0x3c8d45){if(_0x3c8d45[_0xb155('0x5c')]===_0xb155('0x5d')){logger[_0xb155('0x32')](_0x3c8d45);}else{throw new db['Sequelize']['Error'](_0xb155('0x5e'));}});_0x18d03a['on'](_0xb155('0x32'),function(_0x59f8c5){throw new db[(_0xb155('0x5f'))][(_0xb155('0x60'))](_0xb155('0x5e'));});_0x18d03a[_0xb155('0x61')](_0x333da9);_0x18d03a[_0xb155('0x62')]('**/*',{'cwd':path[_0xb155('0x54')](config['root'],'server/files/plugins',path[_0xb155('0x63')](_0x40dbec[_0xb155('0x8')])),'ignore':[path[_0xb155('0x54')](path[_0xb155('0x58')](_0x40dbec[_0xb155('0x8')]),'node_modules/**/*'),path[_0xb155('0x54')](path['basename'](_0x40dbec[_0xb155('0x8')]),_0xb155('0x64'))],'nodir':!![]})[_0xb155('0x65')]();_0x333da9['on'](_0xb155('0x66'),function(){if(!fs['existsSync'](_0x3df0f4)){throw new db[(_0xb155('0x5f'))][(_0xb155('0x60'))]('Plugin\x20not\x20found');}return _0x15b1f0[_0xb155('0x53')](_0x3df0f4,util[_0xb155('0x56')]('%s.zip',path[_0xb155('0x58')](_0x40dbec[_0xb155('0x8')])),function(_0x19b7cc){if(_0x19b7cc){throw new db[(_0xb155('0x5f'))][(_0xb155('0x60'))](_0xb155('0x67'));}fs[_0xb155('0x68')](_0x3df0f4);logger[_0xb155('0x69')](_0xb155('0x6a'));logger[_0xb155('0x69')](_0xb155('0x6b'));});});}return null;})[_0xb155('0x4d')](handleError(_0x15b1f0,null));};exports[_0xb155('0x6c')]=function(_0x30a8a7,_0x452c40,_0x3af8ae){var _0x1d77b1=path[_0xb155('0x58')](_0x30a8a7[_0xb155('0x6d')][_0xb155('0x6e')],path[_0xb155('0x6f')](_0x30a8a7[_0xb155('0x6d')][_0xb155('0x6e')]));var _0x189d8d=path[_0xb155('0x54')](config[_0xb155('0x55')],_0xb155('0x70'),_0x30a8a7[_0xb155('0x6d')][_0xb155('0x6e')]);var _0xd9b7fa=path[_0xb155('0x54')](config[_0xb155('0x55')],_0xb155('0x70'),_0x1d77b1);logger[_0xb155('0x69')](_0xb155('0x71'),_0x189d8d);logger[_0xb155('0x69')](_0xb155('0x72'),_0xd9b7fa);try{fs[_0xb155('0x73')](_0x189d8d,parseInt('0777',0x8));extract(_0x189d8d,{'dir':_0xd9b7fa},function(_0x35f6c6){if(_0x35f6c6){logger['error'](_0x35f6c6);handleError(_0x35f6c6,!![]);};var _0x2e462c=fs['readdirSync'](_0xd9b7fa);if(_0x2e462c[_0xb155('0x41')]>0x1){removeReferences(_0x189d8d,_0xd9b7fa);logger[_0xb155('0x32')](_0xb155('0x74'));return _0x3af8ae(new Error(_0xb155('0x74')));}var _0xa6a75c=fs[_0xb155('0x75')](path[_0xb155('0x54')](_0xd9b7fa,_0x2e462c[0x0]));if(_0xa6a75c[_0xb155('0x76')]()){removeReferences(_0x189d8d,_0xd9b7fa);logger[_0xb155('0x32')](_0xb155('0x74'));return _0x3af8ae(new Error(_0xb155('0x74')));}if(_0xa6a75c[_0xb155('0x77')]()){var _0x222414=fs['readdirSync'](path['join'](_0xd9b7fa,_0x2e462c[0x0]));if(_0x222414[_0xb155('0x41')]===0x0){removeReferences(_0x189d8d,_0xd9b7fa);logger[_0xb155('0x32')]('Invalid\x20plugin\x20structure');return _0x3af8ae(new Error(_0xb155('0x74')));}var _0x563fed=_0x222414[_0xb155('0x78')](function(_0x2bc60a){return _0x2bc60a===_0xb155('0x79');});if(!_0x563fed){return _0x3af8ae(new Error(_0xb155('0x7a')));}var _0x5056e1=fs[_0xb155('0x7b')](path[_0xb155('0x54')](_0xd9b7fa,_0x2e462c[0x0],_0xb155('0x79')));var _0x18001a=JSON['parse'](_0x5056e1);if('undefined'==typeof _0x18001a['name']){return _0x3af8ae(new Error(_0xb155('0x7c')));}if('undefined'==typeof _0x18001a[_0xb155('0x39')]){return _0x3af8ae(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xb155('0x7d')==typeof _0x18001a['version']){return _0x3af8ae(new Error(_0xb155('0x7e')));}if(_0xb155('0x7d')==typeof _0x18001a[_0xb155('0x7f')]){return _0x3af8ae(new Error(_0xb155('0x80')));}if(_0x18001a[_0xb155('0x39')]==='html'){if('undefined'==typeof _0x18001a['parameters'][_0xb155('0x81')]){return _0x3af8ae(new Error(_0xb155('0x82')));}if('undefined'==typeof _0x18001a[_0xb155('0x7f')]['views'][_0xb155('0x83')]&&'undefined'==typeof _0x18001a['parameters'][_0xb155('0x81')][_0xb155('0x84')]){return _0x3af8ae(new Error(_0xb155('0x85')));}}else if(_0x18001a['type']==='script'){if(_0xb155('0x7d')==typeof _0x18001a[_0xb155('0x7f')][_0xb155('0x86')]){return _0x3af8ae(new Error(_0xb155('0x87')));}if(_0xb155('0x7d')==typeof _0x18001a['parameters'][_0xb155('0x88')]){return _0x3af8ae(new Error(_0xb155('0x89')));}}else{return _0x3af8ae(new Error(_0xb155('0x8a')));}var _0x186c7f=_0x18001a[_0xb155('0x34')];var _0xa254a=_0x18001a[_0xb155('0x8b')];var _0xe501b=_0x18001a['type'];var _0x4f7fea=_0x18001a[_0xb155('0x8c')]?_0x18001a[_0xb155('0x8c')]:_0xb155('0x8d');var _0x36e30f=_0x18001a[_0xb155('0x8e')]?_0x18001a['icon']:'icon-apps';var _0x8c49a5='';var _0x378435='';var _0x36ea91='';var _0x25bc4e='';var _0x2e2e48=_0x18001a[_0xb155('0x8f')];if(_0xe501b===_0xb155('0x90')){if(_0xb155('0x7d')!=typeof _0x18001a[_0xb155('0x7f')][_0xb155('0x81')][_0xb155('0x83')]){var _0x1f9608=_0x18001a[_0xb155('0x7f')]['views'][_0xb155('0x83')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1f9608)){_0x8c49a5=path[_0xb155('0x54')](_0xb155('0x91'),_0x1d77b1,_0x2e462c[0x0],_0x1f9608);}else{_0x8c49a5=_0x1f9608;}}else{logger[_0xb155('0x69')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xb155('0x7d')!=typeof _0x18001a[_0xb155('0x7f')][_0xb155('0x81')][_0xb155('0x84')]){var _0x3f0ee2=_0x18001a[_0xb155('0x7f')][_0xb155('0x81')][_0xb155('0x84')];if(!/^(f|ht)tps?:\/\//i[_0xb155('0x92')](_0x3f0ee2)){_0x378435=path['join']('plugins',_0x1d77b1,_0x2e462c[0x0],_0x3f0ee2);}else{_0x378435=_0x3f0ee2;}}else{logger[_0xb155('0x69')](_0xb155('0x93'));}}else if(_0xe501b===_0xb155('0x94')){_0x36ea91=_0x18001a[_0xb155('0x7f')]['scriptName'];_0x25bc4e=_0x18001a[_0xb155('0x7f')][_0xb155('0x88')];if(_0xb155('0x7d')!=typeof _0x18001a[_0xb155('0x7f')]['views']){if(_0xb155('0x7d')!=typeof _0x18001a[_0xb155('0x7f')]['views'][_0xb155('0x83')]){var _0x1f9608=_0x18001a[_0xb155('0x7f')][_0xb155('0x81')]['admin'];if(!/^(f|ht)tps?:\/\//i[_0xb155('0x92')](_0x1f9608)){_0x8c49a5=path[_0xb155('0x54')]('plugins',_0x1d77b1,_0x2e462c[0x0],_0x1f9608);}else{_0x8c49a5=_0x1f9608;}}if('undefined'!=typeof _0x18001a['parameters']['views'][_0xb155('0x84')]){var _0x3f0ee2=_0x18001a[_0xb155('0x7f')][_0xb155('0x81')]['agent'];if(!/^(f|ht)tps?:\/\//i['test'](_0x3f0ee2)){_0x378435=path[_0xb155('0x54')](_0xb155('0x91'),_0x1d77b1,_0x2e462c[0x0],_0x3f0ee2);}else{_0x378435=_0x3f0ee2;}}}}var _0xcf43f2={'name':_0x186c7f,'description':_0xa254a,'path':path[_0xb155('0x54')](_0x1d77b1,_0x2e462c[0x0]),'type':_0xe501b,'sidebar':_0x4f7fea,'icon':_0x36e30f,'adminUrl':_0x8c49a5,'agentUrl':_0x378435,'scriptName':_0x36ea91,'scriptPath':_0x25bc4e,'version':_0x2e2e48};removeReferences(_0x189d8d,null);return db[_0xb155('0x4f')][_0xb155('0x95')](_0xcf43f2)[_0xb155('0x2d')](function(_0x5f3719){var _0x571fae={'role':_0x30a8a7[_0xb155('0x96')][_0xb155('0x97')],'userProfileId':_0x30a8a7[_0xb155('0x96')][_0xb155('0x98')]};if(!_0x571fae)throw new Error(_0xb155('0x99'));if(_0x571fae[_0xb155('0x97')]===_0xb155('0x9a')){var _0x247ace=_0x5f3719[_0xb155('0x2e')]({'plain':!![]});return db[_0xb155('0x9b')][_0xb155('0x52')]({'where':{'name':'Plugins','userProfileId':_0x571fae['userProfileId']},'raw':!![]})[_0xb155('0x2d')](function(_0xc5feef){if(_0xc5feef&&_0xc5feef[_0xb155('0x9c')]===0x0){return db[_0xb155('0x30')][_0xb155('0x95')]({'name':_0x247ace[_0xb155('0x34')],'resourceId':_0x247ace['id'],'type':_0xc5feef[_0xb155('0x34')],'sectionId':_0xc5feef['id']},{})[_0xb155('0x2d')](function(){return _0x5f3719;});}else{return _0x5f3719;}})[_0xb155('0x4d')](function(_0x5ec449){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5ec449);throw _0x5ec449;});}return _0x5f3719;})[_0xb155('0x2d')](respondWithResult(_0x452c40,null))[_0xb155('0x4d')](handleError(_0x452c40,null));}});}catch(_0x52cdcc){_0x452c40[_0xb155('0x23')](0x1f4)[_0xb155('0x35')](_0x52cdcc);}};function removeReferences(_0xe0bfee,_0x5b7a09){try{if(_0xe0bfee){fs['unlinkSync'](_0xe0bfee);logger[_0xb155('0x69')]('Zip\x20archive\x20removed');}if(_0x5b7a09){rimraf(_0x5b7a09,function(){});logger[_0xb155('0x69')](_0xb155('0x9d'));}}catch(_0x54b4b4){logger[_0xb155('0x32')](_0x54b4b4);}}exports[_0xb155('0x2c')]=function(_0x42f122,_0xefbc5b,_0x31015e){return db[_0xb155('0x4f')]['find']({'where':{'id':_0x42f122[_0xb155('0x9e')]['id']}})['then'](handleEntityNotFound(_0xefbc5b,null))[_0xb155('0x2d')](saveUpdates(_0x42f122['body'],null))['then'](respondWithResult(_0xefbc5b,null))[_0xb155('0x4d')](handleError(_0xefbc5b,null));};exports[_0xb155('0x9f')]=function(_0x1704b0,_0x23b1ab,_0x4727f2){return db['Plugin']['find']({'where':{'id':_0x1704b0[_0xb155('0x9e')]['id']}})[_0xb155('0x2d')](function(_0x231c3d){if(_0x231c3d){return _0x231c3d[_0xb155('0x31')]();}})[_0xb155('0x2d')](function(_0x1a22f1){rimraf(path['join'](config[_0xb155('0x55')],_0xb155('0x70'),path['dirname'](_0x1a22f1['path'])),function(){});return _0x1a22f1;})[_0xb155('0x2d')](handleEntityNotFound(_0x23b1ab,null))['then'](respondWithStatusCode(_0x23b1ab,null))['catch'](handleError(_0x23b1ab,null));};exports[_0xb155('0xa0')]=function(_0x5a5f09,_0x5d1645,_0x10dae2){return BPromise[_0xb155('0xa1')]()[_0xb155('0x2d')](function(){if(!_0x5a5f09[_0xb155('0x3d')][_0xb155('0x8')]){throw new Error(_0xb155('0xa2'));}if(!_0x5a5f09['query'][_0xb155('0xa3')]){throw new Error(_0xb155('0xa4'));}var _0x3ea15a=_0x5a5f09[_0xb155('0x3d')][_0xb155('0xa5')]?_0x5a5f09['query']['hostname']+':'+_0x5a5f09[_0xb155('0x3d')]['port']:_0xb155('0xa6')+_0x5a5f09[_0xb155('0x3d')]['port'];var _0xd00976=_0x5a5f09[_0xb155('0x3d')][_0xb155('0x25')]?_0x5a5f09['query']['json']:!![];var _0xedc91f=_0x5a5f09[_0xb155('0x3d')][_0xb155('0xa7')]?_0x5a5f09[_0xb155('0x3d')][_0xb155('0xa7')]:null;var _0x365921={'method':_0x5a5f09['method'],'uri':util[_0xb155('0x56')](_0xb155('0xa8'),_0x3ea15a,_0x5a5f09['query']['path']),'json':_0xd00976,'resolveWithFullResponse':!![],'encoding':_0xedc91f,'qs':_0x5a5f09[_0xb155('0x3d')]};if(_0x5a5f09[_0xb155('0xa9')]){_0x365921[_0xb155('0xa9')]=_0x5a5f09[_0xb155('0xa9')];if(_0x365921['headers'][_0xb155('0xaa')]){delete _0x365921[_0xb155('0xa9')][_0xb155('0xaa')];}}if(_0x365921[_0xb155('0xa9')][_0xb155('0xab')]){delete _0x365921[_0xb155('0xa9')][_0xb155('0xab')];}return rp(_0x365921);})[_0xb155('0x2d')](function(_0x2f132b){if(_0x2f132b){_0x5d1645[_0xb155('0x29')](_0x2f132b['headers']);logger['info'](_0x2f132b[_0xb155('0x96')]);if(_[_0xb155('0xac')](_0x5a5f09['query']['path'],_0xb155('0x53'))&&_0x2f132b[_0xb155('0xad')]==0x1f4){return _0x5d1645[_0xb155('0x22')](_0x2f132b[_0xb155('0xad')]);}else{return _0x5d1645[_0xb155('0x23')](_0x2f132b['statusCode'])[_0xb155('0x35')](_0x2f132b[_0xb155('0x96')]);}}else{return _0x5d1645[_0xb155('0x22')](0xc8);}})['catch'](handleError(_0x5d1645,null));};exports[_0xb155('0xae')]=function(_0x30ace7,_0x1641c1,_0x4bede8){return BPromise[_0xb155('0xa1')]()[_0xb155('0x2d')](function(){if(!_0x30ace7['query'][_0xb155('0x8')]){throw new Error(_0xb155('0xa2'));}if(!_0x30ace7['query']['port']){throw new Error(_0xb155('0xa4'));}var _0x16d1d6=_0x30ace7[_0xb155('0x3d')][_0xb155('0xa5')]?_0x30ace7[_0xb155('0x3d')]['hostname']+':'+_0x30ace7[_0xb155('0x3d')][_0xb155('0xa3')]:_0xb155('0xa6')+_0x30ace7[_0xb155('0x3d')][_0xb155('0xa3')];var _0x585d44=_0x30ace7[_0xb155('0x3d')][_0xb155('0x25')]?_0x30ace7[_0xb155('0x3d')]['json']:!![];var _0x2bd10d=_0x30ace7[_0xb155('0x3d')][_0xb155('0xa7')]?_0x30ace7['query'][_0xb155('0xa7')]:null;var _0xb3604e={'method':_0x30ace7[_0xb155('0xaf')],'uri':util[_0xb155('0x56')](_0xb155('0xa8'),_0x16d1d6,_0x30ace7['query'][_0xb155('0x8')]),'json':_0x585d44,'resolveWithFullResponse':!![],'encoding':_0x2bd10d,'body':_0x30ace7[_0xb155('0x96')]};if(_0x30ace7[_0xb155('0xa9')]){_0xb3604e[_0xb155('0xa9')]=_0x30ace7[_0xb155('0xa9')];if(_0xb3604e[_0xb155('0xa9')]['content-length']){delete _0xb3604e['headers'][_0xb155('0xaa')];}}if(_0xb3604e['headers'][_0xb155('0xab')]){delete _0xb3604e[_0xb155('0xa9')][_0xb155('0xab')];}return rp(_0xb3604e);})[_0xb155('0x2d')](function(_0x34457f){if(_0x34457f){_0x1641c1['set'](_0x34457f[_0xb155('0xa9')]);logger[_0xb155('0x69')](_0x34457f[_0xb155('0x96')]);return _0x1641c1['status'](_0x34457f[_0xb155('0xad')])['send'](_0x34457f[_0xb155('0x96')]);}else{return _0x1641c1['sendStatus'](0xc8);}})['catch'](handleError(_0x1641c1,null));}; \ No newline at end of file +var _0x4861=['pick','merge','filter','options','count','includeAll','findAll','params','include','find','catch','join','root','format','basename','zip','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','server/files/plugins','dirname','close','download','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','lstatSync','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','undefined','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','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','always','icon','icon-apps','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','webhookGet','resolve','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','method','%s%s','headers','content-length','content-type','set','endsWith','statusCode','\x27PATH\x27\x20parameter\x20not\x20specified','encoding','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','archiver','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./plugin.socket','sendStatus','status','offset','json','reject','save','update','then','destroy','get','Plugins','UserProfileResource','end','error','stack','name','send','index','map','Plugin','rawAttributes','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where'];(function(_0x1f591d,_0x20ef59){var _0x22a578=function(_0x34fd3c){while(--_0x34fd3c){_0x1f591d['push'](_0x1f591d['shift']());}};_0x22a578(++_0x20ef59);}(_0x4861,0x108));var _0x1486=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4861[_0x167cc1];return _0x10bc4b;};'use strict';var pdf=require(_0x1486('0x0'));var emlformat=require(_0x1486('0x1'));var rimraf=require(_0x1486('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1486('0x3'));var rp=require(_0x1486('0x4'));var moment=require(_0x1486('0x5'));var BPromise=require(_0x1486('0x6'));var Mustache=require(_0x1486('0x7'));var util=require(_0x1486('0x8'));var path=require(_0x1486('0x9'));var sox=require(_0x1486('0xa'));var csv=require(_0x1486('0xb'));var ejs=require(_0x1486('0xc'));var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require(_0x1486('0xd'));var jsforce=require(_0x1486('0xe'));var deskjs=require(_0x1486('0xf'));var toCsv=require(_0x1486('0xb'));var querystring=require(_0x1486('0x10'));var Papa=require(_0x1486('0x11'));var extract=require(_0x1486('0x12'));var rimraf=require('rimraf');var archiver=require(_0x1486('0x13'));var Redis=require(_0x1486('0x14'));var authService=require('../../components/auth/service');var qs=require(_0x1486('0x15'));var as=require(_0x1486('0x16'));var hardwareService=require(_0x1486('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0x1486('0x18'));var config=require(_0x1486('0x19'));var db=require(_0x1486('0x1a'))['db'];config['redis']=_[_0x1486('0x1b')](config[_0x1486('0x1c')],{'host':_0x1486('0x1d'),'port':0x18eb});var socket=require(_0x1486('0x1e'))(new Redis(config[_0x1486('0x1c')]));require(_0x1486('0x1f'))['register'](socket);function respondWithStatusCode(_0x9d2bf,_0x1ad134){_0x1ad134=_0x1ad134||0xcc;return function(_0x4415ff){if(_0x4415ff){return _0x9d2bf[_0x1486('0x20')](_0x1ad134);}return _0x9d2bf[_0x1486('0x21')](_0x1ad134)['end']();};}function respondWithResult(_0x2b29cd,_0x1caf5c){_0x1caf5c=_0x1caf5c||0xc8;return function(_0x2c991e){if(_0x2c991e){return _0x2b29cd[_0x1486('0x21')](_0x1caf5c)['json'](_0x2c991e);}};}function respondWithFilteredResult(_0x22a9c9,_0xe77b17){return function(_0x4df12e){if(_0x4df12e){var _0x55f8e4=_0x4df12e['count'],_0x3c2da9=_0xe77b17[_0x1486('0x22')],_0x57f558=_0xe77b17[_0x1486('0x22')]+_0xe77b17['limit'],_0x12e09f;if(_0x57f558>=_0x55f8e4){_0x57f558=_0x55f8e4;_0x12e09f=0xc8;}else{_0x12e09f=0xce;}_0x22a9c9['status'](_0x12e09f);return _0x22a9c9['set']('Content-Range',_0x3c2da9+'-'+_0x57f558+'/'+_0x55f8e4)[_0x1486('0x23')](_0x4df12e);}return null;};}function patchUpdates(_0x3fdc31){return function(_0x1d271f){try{jsonpatch['apply'](_0x1d271f,_0x3fdc31,!![]);}catch(_0x445587){return BPromise[_0x1486('0x24')](_0x445587);}return _0x1d271f[_0x1486('0x25')]();};}function saveUpdates(_0xb6a51,_0x452d63){return function(_0x3e8a79){if(_0x3e8a79){return _0x3e8a79[_0x1486('0x26')](_0xb6a51)[_0x1486('0x27')](function(_0x4e5d42){return _0x4e5d42;});}return null;};}function removeEntity(_0x2b3ad4,_0x238084){return function(_0x511670){if(_0x511670){return _0x511670[_0x1486('0x28')]()[_0x1486('0x27')](function(){var _0x38919a=_0x511670[_0x1486('0x29')]({'plain':!![]});var _0x47fc40=_0x1486('0x2a');return db[_0x1486('0x2b')][_0x1486('0x28')]({'where':{'type':_0x47fc40,'resourceId':_0x38919a['id']}})[_0x1486('0x27')](function(){return _0x511670;});})[_0x1486('0x27')](function(){_0x2b3ad4[_0x1486('0x21')](0xcc)[_0x1486('0x2c')]();});}};}function handleEntityNotFound(_0x5e4891,_0x289a70){return function(_0x34335f){if(!_0x34335f){_0x5e4891[_0x1486('0x20')](0x194);}return _0x34335f;};}function handleError(_0x4257e8,_0x355819){_0x355819=_0x355819||0x1f4;return function(_0x1de450){logger[_0x1486('0x2d')](_0x1de450[_0x1486('0x2e')]);if(_0x1de450[_0x1486('0x2f')]){delete _0x1de450[_0x1486('0x2f')];}_0x4257e8[_0x1486('0x21')](_0x355819)[_0x1486('0x30')](_0x1de450);};}exports[_0x1486('0x31')]=function(_0x5f52f6,_0xe9ce69){var _0x52e634={},_0x19ca7c={},_0x5e6a13={'count':0x0,'rows':[]};var _0x3621af=_[_0x1486('0x32')](db[_0x1486('0x33')][_0x1486('0x34')],function(_0x66b02c){return{'name':_0x66b02c['fieldName'],'type':_0x66b02c[_0x1486('0x35')][_0x1486('0x36')]};});_0x19ca7c['model']=_[_0x1486('0x32')](_0x3621af,_0x1486('0x2f'));_0x19ca7c[_0x1486('0x37')]=_[_0x1486('0x38')](_0x5f52f6['query']);_0x19ca7c[_0x1486('0x39')]=_[_0x1486('0x3a')](_0x19ca7c[_0x1486('0x3b')],_0x19ca7c[_0x1486('0x37')]);_0x52e634['attributes']=_[_0x1486('0x3a')](_0x19ca7c[_0x1486('0x3b')],qs[_0x1486('0x3c')](_0x5f52f6[_0x1486('0x37')][_0x1486('0x3c')]));_0x52e634[_0x1486('0x3d')]=_0x52e634[_0x1486('0x3d')][_0x1486('0x3e')]?_0x52e634[_0x1486('0x3d')]:_0x19ca7c[_0x1486('0x3b')];if(!_0x5f52f6['query'][_0x1486('0x3f')](_0x1486('0x40'))){_0x52e634[_0x1486('0x41')]=qs[_0x1486('0x41')](_0x5f52f6[_0x1486('0x37')][_0x1486('0x41')]);_0x52e634[_0x1486('0x22')]=qs[_0x1486('0x22')](_0x5f52f6[_0x1486('0x37')][_0x1486('0x22')]);}_0x52e634['order']=qs[_0x1486('0x42')](_0x5f52f6[_0x1486('0x37')][_0x1486('0x42')]);_0x52e634[_0x1486('0x43')]=qs['filters'](_[_0x1486('0x44')](_0x5f52f6[_0x1486('0x37')],_0x19ca7c[_0x1486('0x39')]));if(_0x5f52f6['query']['filter']){_0x52e634[_0x1486('0x43')]=_[_0x1486('0x45')](_0x52e634[_0x1486('0x43')],{'$or':_[_0x1486('0x32')](_0x3621af,function(_0x337ef8){if(_0x337ef8['type']!=='VIRTUAL'){var _0x4a7b3e={};_0x4a7b3e[_0x337ef8[_0x1486('0x2f')]]={'$like':'%'+_0x5f52f6[_0x1486('0x37')][_0x1486('0x46')]+'%'};return _0x4a7b3e;}})});}_0x52e634=_['merge']({},_0x52e634,_0x5f52f6[_0x1486('0x47')]);var _0x208f85={'where':_0x52e634[_0x1486('0x43')]};return db['Plugin'][_0x1486('0x48')](_0x208f85)[_0x1486('0x27')](function(_0x44f70b){_0x5e6a13['count']=_0x44f70b;if(_0x5f52f6[_0x1486('0x37')][_0x1486('0x49')]){_0x52e634['include']=[{'all':!![]}];}return db[_0x1486('0x33')][_0x1486('0x4a')](_0x52e634);})[_0x1486('0x27')](function(_0x450517){_0x5e6a13['rows']=_0x450517;return _0x5e6a13;})[_0x1486('0x27')](respondWithFilteredResult(_0xe9ce69,_0x52e634))['catch'](handleError(_0xe9ce69,null));};exports['show']=function(_0x22af2a,_0xbef025){var _0x39eba5={'raw':!![],'where':{'id':_0x22af2a[_0x1486('0x4b')]['id']}},_0x47839a={};_0x47839a[_0x1486('0x3b')]=_[_0x1486('0x38')](db['Plugin'][_0x1486('0x34')]);_0x47839a['query']=_[_0x1486('0x38')](_0x22af2a[_0x1486('0x37')]);_0x47839a[_0x1486('0x39')]=_[_0x1486('0x3a')](_0x47839a[_0x1486('0x3b')],_0x47839a['query']);_0x39eba5[_0x1486('0x3d')]=_[_0x1486('0x3a')](_0x47839a[_0x1486('0x3b')],qs['fields'](_0x22af2a[_0x1486('0x37')][_0x1486('0x3c')]));_0x39eba5[_0x1486('0x3d')]=_0x39eba5['attributes']['length']?_0x39eba5[_0x1486('0x3d')]:_0x47839a[_0x1486('0x3b')];if(_0x22af2a['query'][_0x1486('0x49')]){_0x39eba5[_0x1486('0x4c')]=[{'all':!![]}];}_0x39eba5=_[_0x1486('0x45')]({},_0x39eba5,_0x22af2a[_0x1486('0x47')]);return db[_0x1486('0x33')][_0x1486('0x4d')](_0x39eba5)[_0x1486('0x27')](handleEntityNotFound(_0xbef025,null))[_0x1486('0x27')](respondWithResult(_0xbef025,null))[_0x1486('0x4e')](handleError(_0xbef025,null));};exports['download']=function(_0x5d4605,_0x1cec24,_0x285a27){return db[_0x1486('0x33')][_0x1486('0x4d')]({'where':{'id':_0x5d4605[_0x1486('0x4b')]['id']},'attributes':[_0x1486('0x2f'),'path'],'raw':!![]})['then'](handleEntityNotFound(_0x1cec24,null))[_0x1486('0x27')](function(_0x46ef66){if(_0x46ef66){var _0xe4e54c=path[_0x1486('0x4f')](config[_0x1486('0x50')],'server/files/plugins',util[_0x1486('0x51')]('%s.zip',path[_0x1486('0x52')](_0x46ef66[_0x1486('0x9')])));var _0x273e95=fs['createWriteStream'](_0xe4e54c);var _0x2650f2=archiver(_0x1486('0x53'),{'zlib':{'level':0x9}});_0x2650f2['on']('warning',function(_0x36c744){if(_0x36c744['code']==='ENOENT'){logger['error'](_0x36c744);}else{throw new db[(_0x1486('0x54'))][(_0x1486('0x55'))](_0x1486('0x56'));}});_0x2650f2['on'](_0x1486('0x2d'),function(_0x4bad3e){throw new db[(_0x1486('0x54'))][(_0x1486('0x55'))](_0x1486('0x56'));});_0x2650f2[_0x1486('0x57')](_0x273e95);_0x2650f2[_0x1486('0x58')](_0x1486('0x59'),{'cwd':path[_0x1486('0x4f')](config[_0x1486('0x50')],_0x1486('0x5a'),path[_0x1486('0x5b')](_0x46ef66[_0x1486('0x9')])),'ignore':[path[_0x1486('0x4f')](path[_0x1486('0x52')](_0x46ef66['path']),'node_modules/**/*'),path[_0x1486('0x4f')](path['basename'](_0x46ef66['path']),'attachments/**/*')],'nodir':!![]})['finalize']();_0x273e95['on'](_0x1486('0x5c'),function(){if(!fs['existsSync'](_0xe4e54c)){throw new db[(_0x1486('0x54'))][(_0x1486('0x55'))]('Plugin\x20not\x20found');}return _0x1cec24[_0x1486('0x5d')](_0xe4e54c,util[_0x1486('0x51')]('%s.zip',path[_0x1486('0x52')](_0x46ef66[_0x1486('0x9')])),function(_0x3b0bf9){if(_0x3b0bf9){throw new db[(_0x1486('0x54'))]['Error'](_0x1486('0x5e'));}fs[_0x1486('0x5f')](_0xe4e54c);logger[_0x1486('0x60')](_0x1486('0x61'));logger[_0x1486('0x60')](_0x1486('0x62'));});});}return null;})['catch'](handleError(_0x1cec24,null));};exports[_0x1486('0x63')]=function(_0x1aa0a3,_0x3df384,_0x5eeaba){var _0x3dbf13=path[_0x1486('0x52')](_0x1aa0a3[_0x1486('0x64')]['filename'],path['extname'](_0x1aa0a3[_0x1486('0x64')][_0x1486('0x65')]));var _0x512f7e=path['join'](config[_0x1486('0x50')],_0x1486('0x5a'),_0x1aa0a3[_0x1486('0x64')][_0x1486('0x65')]);var _0x43ecb7=path[_0x1486('0x4f')](config[_0x1486('0x50')],_0x1486('0x5a'),_0x3dbf13);logger[_0x1486('0x60')]('Plugin\x20upload\x20filepath:\x20%s',_0x512f7e);logger[_0x1486('0x60')]('Plugin\x20upload\x20destination:\x20%s',_0x43ecb7);try{fs[_0x1486('0x66')](_0x512f7e,parseInt(_0x1486('0x67'),0x8));extract(_0x512f7e,{'dir':_0x43ecb7},function(_0x3e608f){if(_0x3e608f){logger[_0x1486('0x2d')](_0x3e608f);handleError(_0x3e608f,!![]);};var _0x1dfde0=fs[_0x1486('0x68')](_0x43ecb7);if(_0x1dfde0[_0x1486('0x3e')]>0x1){removeReferences(_0x512f7e,_0x43ecb7);logger[_0x1486('0x2d')](_0x1486('0x69'));return _0x5eeaba(new Error(_0x1486('0x69')));}var _0x5447d=fs[_0x1486('0x6a')](path['join'](_0x43ecb7,_0x1dfde0[0x0]));if(_0x5447d['isFile']()){removeReferences(_0x512f7e,_0x43ecb7);logger[_0x1486('0x2d')](_0x1486('0x69'));return _0x5eeaba(new Error(_0x1486('0x69')));}if(_0x5447d[_0x1486('0x6b')]()){var _0x12d19b=fs[_0x1486('0x68')](path[_0x1486('0x4f')](_0x43ecb7,_0x1dfde0[0x0]));if(_0x12d19b[_0x1486('0x3e')]===0x0){removeReferences(_0x512f7e,_0x43ecb7);logger[_0x1486('0x2d')](_0x1486('0x69'));return _0x5eeaba(new Error(_0x1486('0x69')));}var _0x34619a=_0x12d19b[_0x1486('0x6c')](function(_0x5c3c77){return _0x5c3c77===_0x1486('0x6d');});if(!_0x34619a){return _0x5eeaba(new Error(_0x1486('0x6e')));}var _0x45e038=fs[_0x1486('0x6f')](path[_0x1486('0x4f')](_0x43ecb7,_0x1dfde0[0x0],_0x1486('0x6d')));var _0x4f2add=JSON[_0x1486('0x70')](_0x45e038);if(_0x1486('0x71')==typeof _0x4f2add['name']){return _0x5eeaba(new Error(_0x1486('0x72')));}if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x35')]){return _0x5eeaba(new Error(_0x1486('0x73')));}if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x74')]){return _0x5eeaba(new Error(_0x1486('0x75')));}if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x76')]){return _0x5eeaba(new Error(_0x1486('0x77')));}if(_0x4f2add[_0x1486('0x35')]===_0x1486('0x78')){if('undefined'==typeof _0x4f2add['parameters'][_0x1486('0x79')]){return _0x5eeaba(new Error('Invalid\x20manifest:\x20views\x20missing'));}if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x76')][_0x1486('0x79')]['admin']&&_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x76')][_0x1486('0x79')][_0x1486('0x7a')]){return _0x5eeaba(new Error(_0x1486('0x7b')));}}else if(_0x4f2add[_0x1486('0x35')]===_0x1486('0x7c')){if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x76')][_0x1486('0x7d')]){return _0x5eeaba(new Error(_0x1486('0x7e')));}if(_0x1486('0x71')==typeof _0x4f2add[_0x1486('0x76')][_0x1486('0x7f')]){return _0x5eeaba(new Error(_0x1486('0x80')));}}else{return _0x5eeaba(new Error(_0x1486('0x81')));}var _0x1d69f8=_0x4f2add[_0x1486('0x2f')];var _0x33f208=_0x4f2add[_0x1486('0x82')];var _0x2f50e7=_0x4f2add[_0x1486('0x35')];var _0x143acd=_0x4f2add[_0x1486('0x83')]?_0x4f2add[_0x1486('0x83')]:_0x1486('0x84');var _0x25fa0b=_0x4f2add[_0x1486('0x85')]?_0x4f2add[_0x1486('0x85')]:_0x1486('0x86');var _0x423062='';var _0x399341='';var _0x44c1d7='';var _0x3f9ae5='';var _0x8f05c9=_0x4f2add['version'];if(_0x2f50e7===_0x1486('0x78')){if('undefined'!=typeof _0x4f2add[_0x1486('0x76')]['views']['admin']){var _0x2aa1ff=_0x4f2add['parameters'][_0x1486('0x79')][_0x1486('0x87')];if(!/^(f|ht)tps?:\/\//i['test'](_0x2aa1ff)){_0x423062=path[_0x1486('0x4f')](_0x1486('0x88'),_0x3dbf13,_0x1dfde0[0x0],_0x2aa1ff);}else{_0x423062=_0x2aa1ff;}}else{logger[_0x1486('0x60')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0x1486('0x71')!=typeof _0x4f2add[_0x1486('0x76')][_0x1486('0x79')]['agent']){var _0x3f4420=_0x4f2add[_0x1486('0x76')][_0x1486('0x79')]['agent'];if(!/^(f|ht)tps?:\/\//i[_0x1486('0x89')](_0x3f4420)){_0x399341=path[_0x1486('0x4f')](_0x1486('0x88'),_0x3dbf13,_0x1dfde0[0x0],_0x3f4420);}else{_0x399341=_0x3f4420;}}else{logger[_0x1486('0x60')](_0x1486('0x8a'));}}else if(_0x2f50e7===_0x1486('0x7c')){_0x44c1d7=_0x4f2add[_0x1486('0x76')][_0x1486('0x7d')];_0x3f9ae5=_0x4f2add[_0x1486('0x76')][_0x1486('0x7f')];if(_0x1486('0x71')!=typeof _0x4f2add[_0x1486('0x76')]['views']){if('undefined'!=typeof _0x4f2add[_0x1486('0x76')]['views']['admin']){var _0x2aa1ff=_0x4f2add[_0x1486('0x76')]['views']['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x2aa1ff)){_0x423062=path[_0x1486('0x4f')](_0x1486('0x88'),_0x3dbf13,_0x1dfde0[0x0],_0x2aa1ff);}else{_0x423062=_0x2aa1ff;}}if(_0x1486('0x71')!=typeof _0x4f2add['parameters'][_0x1486('0x79')][_0x1486('0x7a')]){var _0x3f4420=_0x4f2add[_0x1486('0x76')][_0x1486('0x79')][_0x1486('0x7a')];if(!/^(f|ht)tps?:\/\//i[_0x1486('0x89')](_0x3f4420)){_0x399341=path['join']('plugins',_0x3dbf13,_0x1dfde0[0x0],_0x3f4420);}else{_0x399341=_0x3f4420;}}}}var _0x5185f3={'name':_0x1d69f8,'description':_0x33f208,'path':path[_0x1486('0x4f')](_0x3dbf13,_0x1dfde0[0x0]),'type':_0x2f50e7,'sidebar':_0x143acd,'icon':_0x25fa0b,'adminUrl':_0x423062,'agentUrl':_0x399341,'scriptName':_0x44c1d7,'scriptPath':_0x3f9ae5,'version':_0x8f05c9};removeReferences(_0x512f7e,null);return db['Plugin'][_0x1486('0x8b')](_0x5185f3)['then'](function(_0x38af8c){var _0x1ba1f6={'role':_0x1aa0a3[_0x1486('0x8c')]['role'],'userProfileId':_0x1aa0a3['body'][_0x1486('0x8d')]};if(!_0x1ba1f6)throw new Error(_0x1486('0x8e'));if(_0x1ba1f6[_0x1486('0x8f')]===_0x1486('0x90')){var _0x4c8406=_0x38af8c[_0x1486('0x29')]({'plain':!![]});return db[_0x1486('0x91')]['find']({'where':{'name':_0x1486('0x2a'),'userProfileId':_0x1ba1f6[_0x1486('0x8d')]},'raw':!![]})[_0x1486('0x27')](function(_0x3695d0){if(_0x3695d0&&_0x3695d0[_0x1486('0x92')]===0x0){return db[_0x1486('0x2b')][_0x1486('0x8b')]({'name':_0x4c8406[_0x1486('0x2f')],'resourceId':_0x4c8406['id'],'type':_0x3695d0['name'],'sectionId':_0x3695d0['id']},{})[_0x1486('0x27')](function(){return _0x38af8c;});}else{return _0x38af8c;}})[_0x1486('0x4e')](function(_0x172268){logger[_0x1486('0x2d')](_0x1486('0x93'),_0x172268);throw _0x172268;});}return _0x38af8c;})[_0x1486('0x27')](respondWithResult(_0x3df384,null))[_0x1486('0x4e')](handleError(_0x3df384,null));}});}catch(_0x25c554){_0x3df384[_0x1486('0x21')](0x1f4)[_0x1486('0x30')](_0x25c554);}};function removeReferences(_0x77f3f,_0x26a117){try{if(_0x77f3f){fs[_0x1486('0x5f')](_0x77f3f);logger['info'](_0x1486('0x94'));}if(_0x26a117){rimraf(_0x26a117,function(){});logger['info'](_0x1486('0x95'));}}catch(_0x1de6e0){logger[_0x1486('0x2d')](_0x1de6e0);}}exports[_0x1486('0x26')]=function(_0x255e15,_0x2de016,_0x2c8b71){return db[_0x1486('0x33')][_0x1486('0x4d')]({'where':{'id':_0x255e15[_0x1486('0x4b')]['id']}})[_0x1486('0x27')](handleEntityNotFound(_0x2de016,null))['then'](saveUpdates(_0x255e15[_0x1486('0x8c')],null))[_0x1486('0x27')](respondWithResult(_0x2de016,null))[_0x1486('0x4e')](handleError(_0x2de016,null));};exports['delete']=function(_0x91ad70,_0x3061e9,_0x46ef30){return db['Plugin'][_0x1486('0x4d')]({'where':{'id':_0x91ad70[_0x1486('0x4b')]['id']}})['then'](function(_0x2bd185){if(_0x2bd185){return _0x2bd185[_0x1486('0x28')]();}})[_0x1486('0x27')](function(_0x49d322){rimraf(path['join'](config[_0x1486('0x50')],_0x1486('0x5a'),path[_0x1486('0x5b')](_0x49d322[_0x1486('0x9')])),function(){});return _0x49d322;})[_0x1486('0x27')](handleEntityNotFound(_0x3061e9,null))[_0x1486('0x27')](respondWithStatusCode(_0x3061e9,null))[_0x1486('0x4e')](handleError(_0x3061e9,null));};exports[_0x1486('0x96')]=function(_0x2462b9,_0x29186e,_0x552ac2){return BPromise[_0x1486('0x97')]()[_0x1486('0x27')](function(){if(!_0x2462b9[_0x1486('0x37')][_0x1486('0x9')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2462b9['query'][_0x1486('0x98')]){throw new Error(_0x1486('0x99'));}var _0x57bd76=_0x2462b9['query'][_0x1486('0x9a')]?_0x2462b9[_0x1486('0x37')][_0x1486('0x9a')]+':'+_0x2462b9[_0x1486('0x37')][_0x1486('0x98')]:_0x1486('0x9b')+_0x2462b9[_0x1486('0x37')][_0x1486('0x98')];var _0x1052e8=_0x2462b9['query'][_0x1486('0x23')]?_0x2462b9[_0x1486('0x37')][_0x1486('0x23')]:!![];var _0x4da5fb=_0x2462b9[_0x1486('0x37')]['encoding']?_0x2462b9['query']['encoding']:null;var _0x3102db={'method':_0x2462b9[_0x1486('0x9c')],'uri':util[_0x1486('0x51')](_0x1486('0x9d'),_0x57bd76,_0x2462b9['query'][_0x1486('0x9')]),'json':_0x1052e8,'resolveWithFullResponse':!![],'encoding':_0x4da5fb,'qs':_0x2462b9[_0x1486('0x37')]};if(_0x2462b9[_0x1486('0x9e')]){_0x3102db[_0x1486('0x9e')]=_0x2462b9['headers'];if(_0x3102db[_0x1486('0x9e')][_0x1486('0x9f')]){delete _0x3102db[_0x1486('0x9e')]['content-length'];}}if(_0x3102db[_0x1486('0x9e')]['content-type']){delete _0x3102db['headers'][_0x1486('0xa0')];}return rp(_0x3102db);})[_0x1486('0x27')](function(_0x43faff){if(_0x43faff){_0x29186e[_0x1486('0xa1')](_0x43faff[_0x1486('0x9e')]);logger['info'](_0x43faff['body']);if(_[_0x1486('0xa2')](_0x2462b9[_0x1486('0x37')]['path'],_0x1486('0x5d'))&&_0x43faff[_0x1486('0xa3')]==0x1f4){return _0x29186e[_0x1486('0x20')](_0x43faff[_0x1486('0xa3')]);}else{return _0x29186e['status'](_0x43faff[_0x1486('0xa3')])[_0x1486('0x30')](_0x43faff[_0x1486('0x8c')]);}}else{return _0x29186e[_0x1486('0x20')](0xc8);}})['catch'](handleError(_0x29186e,null));};exports['webhookPost']=function(_0x1de981,_0x531430,_0x44b7fa){return BPromise[_0x1486('0x97')]()[_0x1486('0x27')](function(){if(!_0x1de981['query'][_0x1486('0x9')]){throw new Error(_0x1486('0xa4'));}if(!_0x1de981[_0x1486('0x37')]['port']){throw new Error(_0x1486('0x99'));}var _0x3fccfa=_0x1de981['query'][_0x1486('0x9a')]?_0x1de981[_0x1486('0x37')][_0x1486('0x9a')]+':'+_0x1de981[_0x1486('0x37')][_0x1486('0x98')]:'http://localhost:'+_0x1de981['query'][_0x1486('0x98')];var _0x556511=_0x1de981[_0x1486('0x37')][_0x1486('0x23')]?_0x1de981['query'][_0x1486('0x23')]:!![];var _0x488315=_0x1de981[_0x1486('0x37')][_0x1486('0xa5')]?_0x1de981[_0x1486('0x37')][_0x1486('0xa5')]:null;var _0x3e5ded={'method':_0x1de981['method'],'uri':util[_0x1486('0x51')]('%s%s',_0x3fccfa,_0x1de981['query'][_0x1486('0x9')]),'json':_0x556511,'resolveWithFullResponse':!![],'encoding':_0x488315,'body':_0x1de981[_0x1486('0x8c')]};if(_0x1de981[_0x1486('0x9e')]){_0x3e5ded['headers']=_0x1de981[_0x1486('0x9e')];if(_0x3e5ded[_0x1486('0x9e')][_0x1486('0x9f')]){delete _0x3e5ded[_0x1486('0x9e')][_0x1486('0x9f')];}}if(_0x3e5ded[_0x1486('0x9e')]['content-type']){delete _0x3e5ded[_0x1486('0x9e')][_0x1486('0xa0')];}return rp(_0x3e5ded);})[_0x1486('0x27')](function(_0x463a7a){if(_0x463a7a){_0x531430[_0x1486('0xa1')](_0x463a7a[_0x1486('0x9e')]);logger[_0x1486('0x60')](_0x463a7a[_0x1486('0x8c')]);return _0x531430[_0x1486('0x21')](_0x463a7a[_0x1486('0xa3')])[_0x1486('0x30')](_0x463a7a[_0x1486('0x8c')]);}else{return _0x531430[_0x1486('0x20')](0xc8);}})[_0x1486('0x4e')](handleError(_0x531430,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 08852b6..0c44776 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 _0x7708=['events','../../mysqldb','setMaxListeners','emit','hasOwnProperty','hook','exports'];(function(_0x4a759f,_0x1441fd){var _0x3d0721=function(_0x450d68){while(--_0x450d68){_0x4a759f['push'](_0x4a759f['shift']());}};_0x3d0721(++_0x1441fd);}(_0x7708,0x188));var _0x8770=function(_0x5a26f5,_0x196300){_0x5a26f5=_0x5a26f5-0x0;var _0x2e9ef7=_0x7708[_0x5a26f5];return _0x2e9ef7;};'use strict';var EventEmitter=require(_0x8770('0x0'));var Plugin=require(_0x8770('0x1'))['db']['Plugin'];var PluginEvents=new EventEmitter();PluginEvents[_0x8770('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x4c494a){return function(_0x182d52,_0x1a796d,_0x577b13){PluginEvents[_0x8770('0x3')](_0x4c494a+':'+_0x182d52['id'],_0x182d52);PluginEvents['emit'](_0x4c494a,_0x182d52);_0x577b13(null);};}for(var e in events){if(events[_0x8770('0x4')](e)){var event=events[e];Plugin[_0x8770('0x5')](e,emitEvent(event));}}module[_0x8770('0x6')]=PluginEvents; \ No newline at end of file +var _0x955f=['save','remove','emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners'];(function(_0x3f81f8,_0x2bf739){var _0x22b24a=function(_0x331859){while(--_0x331859){_0x3f81f8['push'](_0x3f81f8['shift']());}};_0x22b24a(++_0x2bf739);}(_0x955f,0x1eb));var _0xf955=function(_0x123061,_0x482851){_0x123061=_0x123061-0x0;var _0x51804c=_0x955f[_0x123061];return _0x51804c;};'use strict';var EventEmitter=require(_0xf955('0x0'));var Plugin=require(_0xf955('0x1'))['db'][_0xf955('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xf955('0x3')](0x0);var events={'afterCreate':_0xf955('0x4'),'afterUpdate':'update','afterDestroy':_0xf955('0x5')};function emitEvent(_0x5655ef){return function(_0x5d0c95,_0x1db0dd,_0x5a20bc){PluginEvents[_0xf955('0x6')](_0x5655ef+':'+_0x5d0c95['id'],_0x5d0c95);PluginEvents[_0xf955('0x6')](_0x5655ef,_0x5d0c95);_0x5a20bc(null);};}for(var e in events){if(events[_0xf955('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xf955('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 0b5f1c6..1bab031 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 _0xac31=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','define','Plugin','plugins','lodash','util'];(function(_0x59ab5e,_0x34bab5){var _0x2684d7=function(_0xf3b931){while(--_0xf3b931){_0x59ab5e['push'](_0x59ab5e['shift']());}};_0x2684d7(++_0x34bab5);}(_0xac31,0xca));var _0x1ac3=function(_0x190384,_0x583602){_0x190384=_0x190384-0x0;var _0x5b3017=_0xac31[_0x190384];return _0x5b3017;};'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('./plugin.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 _0x8958=['define','Plugin','plugins','util','request-promise','rimraf','../../config/environment','./plugin.attributes'];(function(_0x49018d,_0x158e6b){var _0x3276b9=function(_0xa01d6e){while(--_0xa01d6e){_0x49018d['push'](_0x49018d['shift']());}};_0x3276b9(++_0x158e6b);}(_0x8958,0x93));var _0x8895=function(_0x15de03,_0xa8db94){_0x15de03=_0x15de03-0x0;var _0x348286=_0x8958[_0x15de03];return _0x348286;};'use strict';var _=require('lodash');var util=require(_0x8895('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8895('0x1'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8895('0x2'));var config=require(_0x8895('0x3'));var attributes=require(_0x8895('0x4'));module['exports']=function(_0x22fa52,_0x2f03ad){return _0x22fa52[_0x8895('0x5')](_0x8895('0x6'),attributes,{'tableName':_0x8895('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.rpc.js b/server/api/plugin/plugin.rpc.js index cc8ef5f..dd239cf 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 _0x102c=['./plugin.socket','register','request','then','Plugin,\x20%s,\x20%s','debug','Plugin,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result','CreatePlugin','body','options','raw','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x24c338,_0x14e8c4){var _0x34e21c=function(_0x430ccf){while(--_0x430ccf){_0x24c338['push'](_0x24c338['shift']());}};_0x34e21c(++_0x14e8c4);}(_0x102c,0x13c));var _0xc102=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0x102c[_0x3e112d];return _0x531c31;};'use strict';var _=require('lodash');var util=require(_0xc102('0x0'));var moment=require(_0xc102('0x1'));var BPromise=require(_0xc102('0x2'));var rs=require(_0xc102('0x3'));var fs=require('fs');var Redis=require(_0xc102('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xc102('0x5'));var logger=require(_0xc102('0x6'))(_0xc102('0x7'));var config=require(_0xc102('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xc102('0x9')][_0xc102('0xa')]({'port':0x232a});config[_0xc102('0xb')]=_[_0xc102('0xc')](config[_0xc102('0xb')],{'host':_0xc102('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc102('0xb')]));require(_0xc102('0xe'))[_0xc102('0xf')](socket);function respondWithRpcPromise(_0x4d7b18,_0x523c35,_0x1c9772){return new BPromise(function(_0x3c3118,_0x1023a1){return client[_0xc102('0x10')](_0x4d7b18,_0x1c9772)[_0xc102('0x11')](function(_0x5f4559){logger['info'](_0xc102('0x12'),_0x523c35,'request\x20sent');logger[_0xc102('0x13')](_0xc102('0x14'),_0x523c35,_0xc102('0x15'),JSON['stringify'](_0x5f4559));if(_0x5f4559['error']){if(_0x5f4559[_0xc102('0x16')][_0xc102('0x17')]===0x1f4){logger[_0xc102('0x16')]('Plugin,\x20%s,\x20%s',_0x523c35,_0x5f4559[_0xc102('0x16')]['message']);return _0x1023a1(_0x5f4559['error'][_0xc102('0x18')]);}logger['error'](_0xc102('0x12'),_0x523c35,_0x5f4559[_0xc102('0x16')]['message']);return _0x3c3118(_0x5f4559[_0xc102('0x16')]['message']);}else{logger[_0xc102('0x19')](_0xc102('0x12'),_0x523c35,'request\x20sent');_0x3c3118(_0x5f4559[_0xc102('0x1a')][_0xc102('0x18')]);}})['catch'](function(_0x563b78){logger[_0xc102('0x16')]('Plugin,\x20%s,\x20%s',_0x523c35,_0x563b78);_0x1023a1(_0x563b78);});});}exports[_0xc102('0x1b')]=function(_0x3a85ce){var _0x5f2f00=this;return new Promise(function(_0x377620,_0x1e7ab4){return db['Plugin']['create'](_0x3a85ce[_0xc102('0x1c')],{'raw':_0x3a85ce[_0xc102('0x1d')]?_0x3a85ce[_0xc102('0x1d')][_0xc102('0x1e')]===undefined?!![]:![]:!![]})[_0xc102('0x11')](function(_0x517fd3){logger['info'](_0xc102('0x1b'),_0x3a85ce);logger['debug'](_0xc102('0x1b'),_0x3a85ce,JSON[_0xc102('0x1f')](_0x517fd3));_0x377620(_0x517fd3);})[_0xc102('0x20')](function(_0x1463e6){logger[_0xc102('0x16')]('CreatePlugin',_0x1463e6[_0xc102('0x18')],_0x3a85ce);_0x1e7ab4(_0x5f2f00[_0xc102('0x16')](0x1f4,_0x1463e6[_0xc102('0x18')]));});});}; \ No newline at end of file +var _0xc3da=['info','result','catch','Plugin','create','body','options','raw','CreatePlugin','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','defaults','localhost','socket.io-emitter','redis','register','request','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc3da,0xf9));var _0xac3d=function(_0x8aec06,_0x3d5724){_0x8aec06=_0x8aec06-0x0;var _0x4c3613=_0xc3da[_0x8aec06];return _0x4c3613;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xac3d('0x0'));var BPromise=require(_0xac3d('0x1'));var rs=require(_0xac3d('0x2'));var fs=require('fs');var Redis=require(_0xac3d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xac3d('0x4'));var logger=require('../../config/logger')(_0xac3d('0x5'));var config=require('../../config/environment');var jayson=require(_0xac3d('0x6'));var client=jayson[_0xac3d('0x7')]['http']({'port':0x232a});config['redis']=_[_0xac3d('0x8')](config['redis'],{'host':_0xac3d('0x9'),'port':0x18eb});var socket=require(_0xac3d('0xa'))(new Redis(config[_0xac3d('0xb')]));require('./plugin.socket')[_0xac3d('0xc')](socket);function respondWithRpcPromise(_0x429ba3,_0x2d8dd4,_0x294858){return new BPromise(function(_0x253630,_0x4fb5fd){return client[_0xac3d('0xd')](_0x429ba3,_0x294858)['then'](function(_0x3f19fb){logger['info'](_0xac3d('0xe'),_0x2d8dd4,_0xac3d('0xf'));logger[_0xac3d('0x10')](_0xac3d('0x11'),_0x2d8dd4,_0xac3d('0xf'),JSON[_0xac3d('0x12')](_0x3f19fb));if(_0x3f19fb[_0xac3d('0x13')]){if(_0x3f19fb[_0xac3d('0x13')]['code']===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x2d8dd4,_0x3f19fb[_0xac3d('0x13')][_0xac3d('0x14')]);return _0x4fb5fd(_0x3f19fb[_0xac3d('0x13')][_0xac3d('0x14')]);}logger[_0xac3d('0x13')]('Plugin,\x20%s,\x20%s',_0x2d8dd4,_0x3f19fb[_0xac3d('0x13')][_0xac3d('0x14')]);return _0x253630(_0x3f19fb['error'][_0xac3d('0x14')]);}else{logger[_0xac3d('0x15')](_0xac3d('0xe'),_0x2d8dd4,_0xac3d('0xf'));_0x253630(_0x3f19fb[_0xac3d('0x16')]['message']);}})[_0xac3d('0x17')](function(_0x2164b0){logger[_0xac3d('0x13')](_0xac3d('0xe'),_0x2d8dd4,_0x2164b0);_0x4fb5fd(_0x2164b0);});});}exports['CreatePlugin']=function(_0x5ea1a0){var _0x570c2e=this;return new Promise(function(_0x4f0b8d,_0x43fe82){return db[_0xac3d('0x18')][_0xac3d('0x19')](_0x5ea1a0[_0xac3d('0x1a')],{'raw':_0x5ea1a0[_0xac3d('0x1b')]?_0x5ea1a0[_0xac3d('0x1b')][_0xac3d('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x9b36f0){logger[_0xac3d('0x15')](_0xac3d('0x1d'),_0x5ea1a0);logger['debug'](_0xac3d('0x1d'),_0x5ea1a0,JSON[_0xac3d('0x12')](_0x9b36f0));_0x4f0b8d(_0x9b36f0);})['catch'](function(_0x29043b){logger[_0xac3d('0x13')](_0xac3d('0x1d'),_0x29043b['message'],_0x5ea1a0);_0x43fe82(_0x570c2e[_0xac3d('0x13')](0x1f4,_0x29043b[_0xac3d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index f17e6ea..19367d4 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 _0x90aa=['register','length','./plugin.events','save','update','emit','removeListener'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x90aa,0x152));var _0xa90a=function(_0x33e6e3,_0x385ae9){_0x33e6e3=_0x33e6e3-0x0;var _0x26cf94=_0x90aa[_0x33e6e3];return _0x26cf94;};'use strict';var PluginEvents=require(_0xa90a('0x0'));var events=[_0xa90a('0x1'),'remove',_0xa90a('0x2')];function createListener(_0x12fa47,_0x586ab4){return function(_0x410de4){_0x586ab4[_0xa90a('0x3')](_0x12fa47,_0x410de4);};}function removeListener(_0x48c6b0,_0x138683){return function(){PluginEvents[_0xa90a('0x4')](_0x48c6b0,_0x138683);};}exports[_0xa90a('0x5')]=function(_0x5b320a){for(var _0x2d6858=0x0,_0x22593c=events[_0xa90a('0x6')];_0x2d6858<_0x22593c;_0x2d6858++){var _0x16c4e0=events[_0x2d6858];var _0x46c9ed=createListener('plugin:'+_0x16c4e0,_0x5b320a);PluginEvents['on'](_0x16c4e0,_0x46c9ed);}}; \ No newline at end of file +var _0x4729=['plugin:','./plugin.events','remove','removeListener','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4729,0x123));var _0x9472=function(_0x3c6a0c,_0x4c47ee){_0x3c6a0c=_0x3c6a0c-0x0;var _0x1d8cb1=_0x4729[_0x3c6a0c];return _0x1d8cb1;};'use strict';var PluginEvents=require(_0x9472('0x0'));var events=['save',_0x9472('0x1'),'update'];function createListener(_0x5eb6d4,_0x8ffdaa){return function(_0x358dd3){_0x8ffdaa['emit'](_0x5eb6d4,_0x358dd3);};}function removeListener(_0x13eb7,_0x377179){return function(){PluginEvents[_0x9472('0x2')](_0x13eb7,_0x377179);};}exports['register']=function(_0x53d523){for(var _0x1058f4=0x0,_0x23b16a=events[_0x9472('0x3')];_0x1058f4<_0x23b16a;_0x1058f4++){var _0x43c61c=events[_0x1058f4];var _0xe2f384=createListener(_0x9472('0x4')+_0x43c61c,_0x53d523);PluginEvents['on'](_0x43c61c,_0xe2f384);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index cfcfe1f..c2b724d 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 _0xcb3c=['./pm2.controller','get','isAuthenticated','/:id','post','create','put','delete','exports','express','Router','../../components/auth/service'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xcb3c,0x99));var _0xccb3=function(_0x3abf9a,_0x3d71df){_0x3abf9a=_0x3abf9a-0x0;var _0x1de11b=_0xcb3c[_0x3abf9a];return _0x1de11b;};'use strict';var express=require(_0xccb3('0x0'));var router=express[_0xccb3('0x1')]();var auth=require(_0xccb3('0x2'));var controller=require(_0xccb3('0x3'));router[_0xccb3('0x4')]('/',auth[_0xccb3('0x5')](),controller['index']);router[_0xccb3('0x4')](_0xccb3('0x6'),auth[_0xccb3('0x5')](),controller['show']);router[_0xccb3('0x7')]('/',auth[_0xccb3('0x5')](),controller[_0xccb3('0x8')]);router[_0xccb3('0x9')]('/:id',auth[_0xccb3('0x5')](),controller['update']);router[_0xccb3('0xa')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0xccb3('0xb')]=router; \ No newline at end of file +var _0x46e4=['index','show','post','/:id','update','exports','express','../../components/auth/service','./pm2.controller','get','isAuthenticated'];(function(_0x432aae,_0x3f06d1){var _0x391e81=function(_0x4d61dd){while(--_0x4d61dd){_0x432aae['push'](_0x432aae['shift']());}};_0x391e81(++_0x3f06d1);}(_0x46e4,0x7f));var _0x446e=function(_0x4a3acd,_0x4bf641){_0x4a3acd=_0x4a3acd-0x0;var _0x3efdaa=_0x46e4[_0x4a3acd];return _0x3efdaa;};'use strict';var express=require(_0x446e('0x0'));var router=express['Router']();var auth=require(_0x446e('0x1'));var controller=require(_0x446e('0x2'));router[_0x446e('0x3')]('/',auth[_0x446e('0x4')](),controller[_0x446e('0x5')]);router[_0x446e('0x3')]('/:id',auth[_0x446e('0x4')](),controller[_0x446e('0x6')]);router[_0x446e('0x7')]('/',auth[_0x446e('0x4')](),controller['create']);router['put'](_0x446e('0x8'),auth[_0x446e('0x4')](),controller[_0x446e('0x9')]);router['delete'](_0x446e('0x8'),auth[_0x446e('0x4')](),controller['destroy']);module[_0x446e('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 6ef4949..bba4ae5 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 _0xb3d2=['length','show','describe','params','create','body','script','../../files/plugins','cwd','dirname','chdir','dump','catch','Missing\x20name\x20and/or\x20path','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','api','path','child_process','exec','status','json','error','stack','name','send','npm\x20install','info','index','list','then','express','motion2'];(function(_0x354c2b,_0x5dc2a0){var _0x44209b=function(_0x5ed3e1){while(--_0x5ed3e1){_0x354c2b['push'](_0x354c2b['shift']());}};_0x44209b(++_0x5dc2a0);}(_0xb3d2,0x8a));var _0x2b3d=function(_0x2ffb00,_0x59d80c){_0x2ffb00=_0x2ffb00-0x0;var _0x57cd4a=_0xb3d2[_0x2ffb00];return _0x57cd4a;};'use strict';var _=require(_0x2b3d('0x0'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0x2b3d('0x1'));var path=require(_0x2b3d('0x2'));var exec=require(_0x2b3d('0x3'))[_0x2b3d('0x4')];var BPromise=require('bluebird');function handleEntityNotFound(_0x104249,_0xb9c639){return function(_0xedc237){if(!_0xedc237){_0x104249['sendStatus'](0x194);;}return _0xedc237;};}function respondWithResult(_0x2fa9a6,_0x36ff7f){_0x36ff7f=_0x36ff7f||0xc8;return function(_0x53aab5){if(_0x53aab5){return _0x2fa9a6[_0x2b3d('0x5')](_0x36ff7f)[_0x2b3d('0x6')](_0x53aab5);}return null;};}function handleError(_0x1e5e7b,_0x26b577){_0x26b577=_0x26b577||0x1f4;return function(_0x1be8e9){logger[_0x2b3d('0x7')](_0x1be8e9[_0x2b3d('0x8')]);if(_0x1be8e9[_0x2b3d('0x9')]){delete _0x1be8e9[_0x2b3d('0x9')];}_0x1e5e7b['status'](_0x26b577)[_0x2b3d('0xa')](_0x1be8e9);};}function execChildProcess(){return new BPromise(function(_0x4e0f65,_0x57b299){exec(_0x2b3d('0xb'),function(_0x309328,_0x3a0b26,_0x492a4d){logger['info'](_0x3a0b26);logger[_0x2b3d('0xc')](_0x492a4d);if(_0x309328){logger[_0x2b3d('0x7')](_0x309328);return _0x57b299(_0x309328);}return _0x4e0f65(_0x3a0b26);});});}exports[_0x2b3d('0xd')]=function(_0x245686,_0x37f93a){return pm2[_0x2b3d('0xe')]()[_0x2b3d('0xf')](function(_0x25adf9){if(_0x25adf9){var _0x5834c4=_['reject'](_0x25adf9,function(_0x423152){return _0x423152[_0x2b3d('0x9')]===_0x2b3d('0x10')||_0x423152[_0x2b3d('0x9')]===_0x2b3d('0x11');});return{'rows':_0x5834c4,'count':_0x5834c4[_0x2b3d('0x12')]};}return null;})['then'](respondWithResult(_0x37f93a,null))['catch'](handleError(_0x37f93a,null));};exports[_0x2b3d('0x13')]=function(_0x1c5033,_0x2381fa){return pm2[_0x2b3d('0x14')](_0x1c5033[_0x2b3d('0x15')]['id'])[_0x2b3d('0xf')](respondWithResult(_0x2381fa,null))['then'](handleEntityNotFound(_0x2381fa,null))['catch'](handleError(_0x2381fa,null));};exports[_0x2b3d('0x16')]=function(_0x37f148,_0x1759fd){if(_0x37f148[_0x2b3d('0x17')][_0x2b3d('0x9')]&&_0x37f148[_0x2b3d('0x17')][_0x2b3d('0x18')]){var _0x4ae904=path['join'](__dirname,_0x2b3d('0x19'),_0x37f148['body'][_0x2b3d('0x18')]);var _0x1b0c56=process[_0x2b3d('0x1a')]();process['chdir'](path[_0x2b3d('0x1b')](_0x4ae904));return execChildProcess()[_0x2b3d('0xf')](function(_0x2dbe37){process[_0x2b3d('0x1c')](_0x1b0c56);return pm2['start']({'name':_0x37f148['body'][_0x2b3d('0x9')],'script':_0x4ae904});})['then'](function(_0x55133b){pm2[_0x2b3d('0x1d')]();return _0x55133b[0x0];})[_0x2b3d('0xf')](respondWithResult(_0x1759fd,0xc9))[_0x2b3d('0x1e')](handleError(_0x1759fd,null));}else{return _0x1759fd[_0x2b3d('0x5')](0x1f4)['send']({'message':_0x2b3d('0x1f')});}};exports[_0x2b3d('0x20')]=function(_0x1e2f16,_0x357420){if(_0x1e2f16['body']['id']){delete _0x1e2f16[_0x2b3d('0x17')]['id'];}var _0x51c8c4={'online':_0x2b3d('0x21'),'stopped':_0x2b3d('0x22')};if(_0x51c8c4['hasOwnProperty'](_0x1e2f16['body']['status'])){return pm2[_0x51c8c4[_0x1e2f16['body'][_0x2b3d('0x5')]]](_0x1e2f16[_0x2b3d('0x15')]['id'])[_0x2b3d('0xf')](respondWithResult(_0x357420,0xc8))[_0x2b3d('0x1e')](handleError(_0x357420,null));}else{return _0x357420[_0x2b3d('0x5')](0x1f4)[_0x2b3d('0xa')]({'message':_0x2b3d('0x23')});}};exports[_0x2b3d('0x24')]=function(_0x742db1,_0x492a17){if(_0x742db1[_0x2b3d('0x17')]['id']){delete _0x742db1[_0x2b3d('0x17')]['id'];}if(_0x742db1[_0x2b3d('0x15')]['id']){return pm2[_0x2b3d('0x25')](_0x742db1['params']['id'])['then'](function(_0x47545f){pm2[_0x2b3d('0x1d')]();return _0x47545f[0x0];})[_0x2b3d('0xf')](respondWithResult(_0x492a17,null))[_0x2b3d('0x1e')](handleError(_0x492a17,null));}else{return _0x492a17[_0x2b3d('0x5')](0x1f4)['send']({'message':_0x2b3d('0x26')});}}; \ No newline at end of file +var _0xccb6=['../../files/plugins','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','error','stack','name','send','info','index','list','reject','motion2','then','catch','describe','params','body','script'];(function(_0x525cb3,_0x39925){var _0x3efed6=function(_0x131edc){while(--_0x131edc){_0x525cb3['push'](_0x525cb3['shift']());}};_0x3efed6(++_0x39925);}(_0xccb6,0x12b));var _0x6ccb=function(_0x2a3b3e,_0x415238){_0x2a3b3e=_0x2a3b3e-0x0;var _0x3bb5f6=_0xccb6[_0x2a3b3e];return _0x3bb5f6;};'use strict';var _=require(_0x6ccb('0x0'));var pm2=require(_0x6ccb('0x1'));var logger=require(_0x6ccb('0x2'))(_0x6ccb('0x3'));var path=require(_0x6ccb('0x4'));var exec=require('child_process')[_0x6ccb('0x5')];var BPromise=require(_0x6ccb('0x6'));function handleEntityNotFound(_0x2db9cd,_0x1b8808){return function(_0x525c29){if(!_0x525c29){_0x2db9cd[_0x6ccb('0x7')](0x194);;}return _0x525c29;};}function respondWithResult(_0x11b9c7,_0x3edcc1){_0x3edcc1=_0x3edcc1||0xc8;return function(_0x240c01){if(_0x240c01){return _0x11b9c7[_0x6ccb('0x8')](_0x3edcc1)[_0x6ccb('0x9')](_0x240c01);}return null;};}function handleError(_0x193c82,_0x2de6ca){_0x2de6ca=_0x2de6ca||0x1f4;return function(_0x148e41){logger[_0x6ccb('0xa')](_0x148e41[_0x6ccb('0xb')]);if(_0x148e41['name']){delete _0x148e41[_0x6ccb('0xc')];}_0x193c82[_0x6ccb('0x8')](_0x2de6ca)[_0x6ccb('0xd')](_0x148e41);};}function execChildProcess(){return new BPromise(function(_0x45cdde,_0x3e8f4f){exec('npm\x20install',function(_0x28e969,_0x3b38fc,_0x5a7e0a){logger[_0x6ccb('0xe')](_0x3b38fc);logger[_0x6ccb('0xe')](_0x5a7e0a);if(_0x28e969){logger[_0x6ccb('0xa')](_0x28e969);return _0x3e8f4f(_0x28e969);}return _0x45cdde(_0x3b38fc);});});}exports[_0x6ccb('0xf')]=function(_0x5015c4,_0x873e82){return pm2[_0x6ccb('0x10')]()['then'](function(_0xf7bc55){if(_0xf7bc55){var _0x9d02be=_[_0x6ccb('0x11')](_0xf7bc55,function(_0x521d8b){return _0x521d8b[_0x6ccb('0xc')]==='express'||_0x521d8b[_0x6ccb('0xc')]===_0x6ccb('0x12');});return{'rows':_0x9d02be,'count':_0x9d02be['length']};}return null;})[_0x6ccb('0x13')](respondWithResult(_0x873e82,null))[_0x6ccb('0x14')](handleError(_0x873e82,null));};exports['show']=function(_0x1e7ba2,_0x140ace){return pm2[_0x6ccb('0x15')](_0x1e7ba2[_0x6ccb('0x16')]['id'])[_0x6ccb('0x13')](respondWithResult(_0x140ace,null))[_0x6ccb('0x13')](handleEntityNotFound(_0x140ace,null))[_0x6ccb('0x14')](handleError(_0x140ace,null));};exports['create']=function(_0x407b46,_0x56c209){if(_0x407b46['body']['name']&&_0x407b46[_0x6ccb('0x17')][_0x6ccb('0x18')]){var _0x4d3c7c=path['join'](__dirname,_0x6ccb('0x19'),_0x407b46[_0x6ccb('0x17')][_0x6ccb('0x18')]);var _0x1bebac=process['cwd']();process[_0x6ccb('0x1a')](path[_0x6ccb('0x1b')](_0x4d3c7c));return execChildProcess()[_0x6ccb('0x13')](function(_0xc6f0c1){process[_0x6ccb('0x1a')](_0x1bebac);return pm2[_0x6ccb('0x1c')]({'name':_0x407b46[_0x6ccb('0x17')][_0x6ccb('0xc')],'script':_0x4d3c7c});})[_0x6ccb('0x13')](function(_0x5bacaf){pm2[_0x6ccb('0x1d')]();return _0x5bacaf[0x0];})[_0x6ccb('0x13')](respondWithResult(_0x56c209,0xc9))[_0x6ccb('0x14')](handleError(_0x56c209,null));}else{return _0x56c209[_0x6ccb('0x8')](0x1f4)[_0x6ccb('0xd')]({'message':_0x6ccb('0x1e')});}};exports[_0x6ccb('0x1f')]=function(_0x265790,_0x5b466c){if(_0x265790[_0x6ccb('0x17')]['id']){delete _0x265790[_0x6ccb('0x17')]['id'];}var _0x2aa1eb={'online':'restart','stopped':'stop'};if(_0x2aa1eb['hasOwnProperty'](_0x265790[_0x6ccb('0x17')][_0x6ccb('0x8')])){return pm2[_0x2aa1eb[_0x265790[_0x6ccb('0x17')][_0x6ccb('0x8')]]](_0x265790['params']['id'])[_0x6ccb('0x13')](respondWithResult(_0x5b466c,0xc8))[_0x6ccb('0x14')](handleError(_0x5b466c,null));}else{return _0x5b466c[_0x6ccb('0x8')](0x1f4)[_0x6ccb('0xd')]({'message':_0x6ccb('0x20')});}};exports[_0x6ccb('0x21')]=function(_0x9ad164,_0x1de985){if(_0x9ad164[_0x6ccb('0x17')]['id']){delete _0x9ad164[_0x6ccb('0x17')]['id'];}if(_0x9ad164['params']['id']){return pm2[_0x6ccb('0x22')](_0x9ad164['params']['id'])[_0x6ccb('0x13')](function(_0x45907a){pm2['dump']();return _0x45907a[0x0];})[_0x6ccb('0x13')](respondWithResult(_0x1de985,null))[_0x6ccb('0x14')](handleError(_0x1de985,null));}else{return _0x1de985[_0x6ccb('0x8')](0x1f4)[_0x6ccb('0xd')]({'message':_0x6ccb('0x23')});}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index bd7572b..6e27c94 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 _0xcc27=['connect-timeout','exports','multer','path'];(function(_0x35754d,_0x1efa55){var _0x21159b=function(_0x158df6){while(--_0x158df6){_0x35754d['push'](_0x35754d['shift']());}};_0x21159b(++_0x1efa55);}(_0xcc27,0x18e));var _0x7cc2=function(_0x2e7ceb,_0x5a6130){_0x2e7ceb=_0x2e7ceb-0x0;var _0x99068e=_0xcc27[_0x2e7ceb];return _0x99068e;};'use strict';var multer=require(_0x7cc2('0x0'));var util=require('util');var path=require(_0x7cc2('0x1'));var timeout=require(_0x7cc2('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x7cc2('0x3')]=router; \ No newline at end of file +var _0x71f1=['util','connect-timeout','express','exports','multer'];(function(_0x59d69a,_0x44bb02){var _0x25b076=function(_0x598ff3){while(--_0x598ff3){_0x59d69a['push'](_0x59d69a['shift']());}};_0x25b076(++_0x44bb02);}(_0x71f1,0xea));var _0x171f=function(_0xbb6da2,_0x24614b){_0xbb6da2=_0xbb6da2-0x0;var _0x2a84f5=_0x71f1[_0xbb6da2];return _0x2a84f5;};'use strict';var multer=require(_0x171f('0x0'));var util=require(_0x171f('0x1'));var path=require('path');var timeout=require(_0x171f('0x2'));var express=require(_0x171f('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x171f('0x4')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index ec67887..366804a 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 _0xeecc=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x5e3cef,_0x3c57f5){var _0x34c370=function(_0x4bc3e4){while(--_0x4bc3e4){_0x5e3cef['push'](_0x5e3cef['shift']());}};_0x34c370(++_0x3c57f5);}(_0xeecc,0x1d8));var _0xceec=function(_0x3179c0,_0x53cde9){_0x3179c0=_0x3179c0-0x0;var _0x343fb0=_0xeecc[_0x3179c0];return _0x343fb0;};'use strict';var Sequelize=require(_0xceec('0x0'));module[_0xceec('0x1')]={'state':{'type':Sequelize[_0xceec('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xceec('0x3')]},'scheduledat':{'type':Sequelize[_0xceec('0x4')]},'uniqueid':{'type':Sequelize[_0xceec('0x3')]},'starttime':{'type':Sequelize[_0xceec('0x4')]},'responsetime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xceec('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xceec('0x3')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xecef=['STRING','DATE','sequelize','exports','INTEGER'];(function(_0x3fc441,_0x1f9e83){var _0x32cdd2=function(_0x5f1879){while(--_0x5f1879){_0x3fc441['push'](_0x3fc441['shift']());}};_0x32cdd2(++_0x1f9e83);}(_0xecef,0xfc));var _0xfece=function(_0x10793a,_0x36ac51){_0x10793a=_0x10793a-0x0;var _0xe5563d=_0xecef[_0x10793a];return _0xe5563d;};'use strict';var Sequelize=require(_0xfece('0x0'));module[_0xfece('0x1')]={'state':{'type':Sequelize[_0xfece('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xfece('0x3')]},'scheduledat':{'type':Sequelize[_0xfece('0x4')]},'uniqueid':{'type':Sequelize[_0xfece('0x3')]},'starttime':{'type':Sequelize[_0xfece('0x4')]},'responsetime':{'type':Sequelize[_0xfece('0x4')]},'ringtime':{'type':Sequelize[_0xfece('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xfece('0x3')]},'campaigntype':{'type':Sequelize[_0xfece('0x3')]},'membername':{'type':Sequelize[_0xfece('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 2094ca4..3e3b552 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 _0xec2e=['bluebird','request-promise','path','exports','define','ReportAgentPreview','report_agent_preview','lodash','../../config/logger','api','moment'];(function(_0x26493a,_0x170da9){var _0x4b5c5b=function(_0x5938e0){while(--_0x5938e0){_0x26493a['push'](_0x26493a['shift']());}};_0x4b5c5b(++_0x170da9);}(_0xec2e,0x1bf));var _0xeec2=function(_0x1fb3ed,_0x88c234){_0x1fb3ed=_0x1fb3ed-0x0;var _0x5f33d5=_0xec2e[_0x1fb3ed];return _0x5f33d5;};'use strict';var _=require(_0xeec2('0x0'));var util=require('util');var logger=require(_0xeec2('0x1'))(_0xeec2('0x2'));var moment=require(_0xeec2('0x3'));var BPromise=require(_0xeec2('0x4'));var rp=require(_0xeec2('0x5'));var fs=require('fs');var path=require(_0xeec2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./reportAgentPreview.attributes');module[_0xeec2('0x7')]=function(_0x2685ec,_0xcd547f){return _0x2685ec[_0xeec2('0x8')](_0xeec2('0x9'),attributes,{'tableName':_0xeec2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f3d=['../../config/environment','./reportAgentPreview.attributes','exports','define','report_agent_preview','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x176393,_0x406e62){var _0x485487=function(_0x512609){while(--_0x512609){_0x176393['push'](_0x176393['shift']());}};_0x485487(++_0x406e62);}(_0x7f3d,0x179));var _0xd7f3=function(_0x4ac60a,_0x503a99){_0x4ac60a=_0x4ac60a-0x0;var _0x4b22e8=_0x7f3d[_0x4ac60a];return _0x4b22e8;};'use strict';var _=require(_0xd7f3('0x0'));var util=require(_0xd7f3('0x1'));var logger=require('../../config/logger')(_0xd7f3('0x2'));var moment=require(_0xd7f3('0x3'));var BPromise=require('bluebird');var rp=require(_0xd7f3('0x4'));var fs=require('fs');var path=require(_0xd7f3('0x5'));var rimraf=require(_0xd7f3('0x6'));var config=require(_0xd7f3('0x7'));var attributes=require(_0xd7f3('0x8'));module[_0xd7f3('0x9')]=function(_0x252c24,_0x29812f){return _0x252c24[_0xd7f3('0xa')]('ReportAgentPreview',attributes,{'tableName':_0xd7f3('0xb'),'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 ace2b44..105f188 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 _0xc6dc=['ReportAgentPreview,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','ReportAgentPreview','create','body','options','raw','CreateReportAgentPreview','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','ReportAgentPreview,\x20%s,\x20%s','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc6dc,0x125));var _0xcc6d=function(_0x459af3,_0x3b9f76){_0x459af3=_0x459af3-0x0;var _0x443dfe=_0xc6dc[_0x459af3];return _0x443dfe;};'use strict';var _=require(_0xcc6d('0x0'));var util=require('util');var moment=require(_0xcc6d('0x1'));var BPromise=require(_0xcc6d('0x2'));var rs=require(_0xcc6d('0x3'));var fs=require('fs');var Redis=require(_0xcc6d('0x4'));var db=require(_0xcc6d('0x5'))['db'];var utils=require(_0xcc6d('0x6'));var logger=require(_0xcc6d('0x7'))(_0xcc6d('0x8'));var config=require(_0xcc6d('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xcc6d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2683af,_0x3c8d7a,_0x1bd680){return new BPromise(function(_0x40e919,_0x240ab5){return client[_0xcc6d('0xb')](_0x2683af,_0x1bd680)[_0xcc6d('0xc')](function(_0x42def3){logger['info'](_0xcc6d('0xd'),_0x3c8d7a,'request\x20sent');logger[_0xcc6d('0xe')](_0xcc6d('0xf'),_0x3c8d7a,_0xcc6d('0x10'),JSON[_0xcc6d('0x11')](_0x42def3));if(_0x42def3[_0xcc6d('0x12')]){if(_0x42def3[_0xcc6d('0x12')]['code']===0x1f4){logger[_0xcc6d('0x12')]('ReportAgentPreview,\x20%s,\x20%s',_0x3c8d7a,_0x42def3[_0xcc6d('0x12')]['message']);return _0x240ab5(_0x42def3[_0xcc6d('0x12')][_0xcc6d('0x13')]);}logger[_0xcc6d('0x12')](_0xcc6d('0xd'),_0x3c8d7a,_0x42def3[_0xcc6d('0x12')]['message']);return _0x40e919(_0x42def3[_0xcc6d('0x12')][_0xcc6d('0x13')]);}else{logger['info'](_0xcc6d('0xd'),_0x3c8d7a,_0xcc6d('0x10'));_0x40e919(_0x42def3[_0xcc6d('0x14')][_0xcc6d('0x13')]);}})[_0xcc6d('0x15')](function(_0x53cc20){logger[_0xcc6d('0x12')](_0xcc6d('0xd'),_0x3c8d7a,_0x53cc20);_0x240ab5(_0x53cc20);});});}exports['CreateReportAgentPreview']=function(_0x34de3f){var _0x20bfdd=this;return new Promise(function(_0xea4b89,_0x83e7ac){return db[_0xcc6d('0x16')][_0xcc6d('0x17')](_0x34de3f[_0xcc6d('0x18')],{'raw':_0x34de3f[_0xcc6d('0x19')]?_0x34de3f[_0xcc6d('0x19')][_0xcc6d('0x1a')]===undefined?!![]:![]:!![]})[_0xcc6d('0xc')](function(_0x6089d1){logger['info'](_0xcc6d('0x1b'),_0x34de3f);logger[_0xcc6d('0xe')](_0xcc6d('0x1b'),_0x34de3f,JSON[_0xcc6d('0x11')](_0x6089d1));_0xea4b89(_0x6089d1);})[_0xcc6d('0x15')](function(_0x184eb5){logger['error']('CreateReportAgentPreview',_0x184eb5[_0xcc6d('0x13')],_0x34de3f);_0x83e7ac(_0x20bfdd[_0xcc6d('0x12')](0x1f4,_0x184eb5['message']));});});}; \ No newline at end of file +var _0x1cc9=['http','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','debug','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x1d1094,_0x37a655){var _0x4e5b2e=function(_0x3b7f9c){while(--_0x3b7f9c){_0x1d1094['push'](_0x1d1094['shift']());}};_0x4e5b2e(++_0x37a655);}(_0x1cc9,0x1c6));var _0x91cc=function(_0x2975cf,_0x4266c5){_0x2975cf=_0x2975cf-0x0;var _0x4c5b82=_0x1cc9[_0x2975cf];return _0x4c5b82;};'use strict';var _=require('lodash');var util=require(_0x91cc('0x0'));var moment=require(_0x91cc('0x1'));var BPromise=require(_0x91cc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91cc('0x3'));var db=require(_0x91cc('0x4'))['db'];var utils=require(_0x91cc('0x5'));var logger=require(_0x91cc('0x6'))(_0x91cc('0x7'));var config=require(_0x91cc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x91cc('0x9')][_0x91cc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf9b40b,_0x267d27,_0x369588){return new BPromise(function(_0x3ac1bf,_0x5f9840){return client[_0x91cc('0xb')](_0xf9b40b,_0x369588)[_0x91cc('0xc')](function(_0x507d32){logger['info'](_0x91cc('0xd'),_0x267d27,_0x91cc('0xe'));logger['debug'](_0x91cc('0xf'),_0x267d27,_0x91cc('0xe'),JSON[_0x91cc('0x10')](_0x507d32));if(_0x507d32[_0x91cc('0x11')]){if(_0x507d32[_0x91cc('0x11')][_0x91cc('0x12')]===0x1f4){logger[_0x91cc('0x11')]('ReportAgentPreview,\x20%s,\x20%s',_0x267d27,_0x507d32[_0x91cc('0x11')][_0x91cc('0x13')]);return _0x5f9840(_0x507d32['error'][_0x91cc('0x13')]);}logger['error'](_0x91cc('0xd'),_0x267d27,_0x507d32[_0x91cc('0x11')]['message']);return _0x3ac1bf(_0x507d32[_0x91cc('0x11')][_0x91cc('0x13')]);}else{logger['info'](_0x91cc('0xd'),_0x267d27,_0x91cc('0xe'));_0x3ac1bf(_0x507d32[_0x91cc('0x14')][_0x91cc('0x13')]);}})[_0x91cc('0x15')](function(_0x3cb83a){logger[_0x91cc('0x11')](_0x91cc('0xd'),_0x267d27,_0x3cb83a);_0x5f9840(_0x3cb83a);});});}exports[_0x91cc('0x16')]=function(_0x7d216e){var _0x3fdb89=this;return new Promise(function(_0x464baf,_0x5523fa){return db[_0x91cc('0x17')][_0x91cc('0x18')](_0x7d216e[_0x91cc('0x19')],{'raw':_0x7d216e['options']?_0x7d216e[_0x91cc('0x1a')][_0x91cc('0x1b')]===undefined?!![]:![]:!![]})[_0x91cc('0xc')](function(_0x40f1e2){logger['info']('CreateReportAgentPreview',_0x7d216e);logger[_0x91cc('0x1c')](_0x91cc('0x16'),_0x7d216e,JSON[_0x91cc('0x10')](_0x40f1e2));_0x464baf(_0x40f1e2);})[_0x91cc('0x15')](function(_0x3b2f3f){logger['error'](_0x91cc('0x16'),_0x3b2f3f[_0x91cc('0x13')],_0x7d216e);_0x5523fa(_0x3fdb89[_0x91cc('0x11')](0x1f4,_0x3b2f3f[_0x91cc('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index 2ec672e..550a223 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 _0x1e82=['/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','/outbound','/outbound/channels','outboundChannels','/agents','agents','/agents/:id/capacity','agentCapacity','/telephones','telephones','/trunks','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','queueNotify','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/agents/:id/notify','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','get','/voice/channels','voiceChannels'];(function(_0x35783b,_0x1be2fa){var _0x19e19b=function(_0x3fd261){while(--_0x3fd261){_0x35783b['push'](_0x35783b['shift']());}};_0x19e19b(++_0x1be2fa);}(_0x1e82,0x8b));var _0x21e8=function(_0x196156,_0x2454bb){_0x196156=_0x196156-0x0;var _0x403d26=_0x1e82[_0x196156];return _0x403d26;};'use strict';var multer=require(_0x21e8('0x0'));var util=require(_0x21e8('0x1'));var path=require(_0x21e8('0x2'));var express=require(_0x21e8('0x3'));var router=express[_0x21e8('0x4')]();var auth=require(_0x21e8('0x5'));var controller=require('./rpc.controller');router[_0x21e8('0x6')](_0x21e8('0x7'),auth['isAuthenticated'](),controller[_0x21e8('0x8')]);router['get'](_0x21e8('0x9'),auth[_0x21e8('0xa')](),controller[_0x21e8('0xb')]);router[_0x21e8('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x21e8('0xa')](),controller[_0x21e8('0xc')]);router[_0x21e8('0x6')]('/voice/queues',auth[_0x21e8('0xa')](),controller[_0x21e8('0xd')]);router[_0x21e8('0x6')](_0x21e8('0xe'),auth['isAuthenticated'](),controller['chatQueues']);router[_0x21e8('0x6')]('/mail/queues',auth[_0x21e8('0xa')](),controller[_0x21e8('0xf')]);router['get'](_0x21e8('0x10'),auth['isAuthenticated'](),controller[_0x21e8('0x11')]);router[_0x21e8('0x6')](_0x21e8('0x12'),auth['isAuthenticated'](),controller[_0x21e8('0x13')]);router['get'](_0x21e8('0x14'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x15')]);router['get']('/fax/queues',auth[_0x21e8('0xa')](),controller[_0x21e8('0x16')]);router[_0x21e8('0x6')](_0x21e8('0x17'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x18')]);router[_0x21e8('0x6')](_0x21e8('0x19'),auth[_0x21e8('0xa')](),controller['voiceQueuesChannels']);router[_0x21e8('0x6')]('/voice/queues/channels/:uniqueid',auth['isAuthenticated'](),controller[_0x21e8('0x1a')]);router[_0x21e8('0x6')](_0x21e8('0x1b'),auth[_0x21e8('0xa')](),controller['voiceQueuesChannelHangup']);router[_0x21e8('0x6')](_0x21e8('0x1c'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x1d')]);router[_0x21e8('0x6')](_0x21e8('0x1e'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x1f')]);router['get'](_0x21e8('0x20'),auth[_0x21e8('0xa')](),controller['outbound']);router[_0x21e8('0x6')](_0x21e8('0x21'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x22')]);router[_0x21e8('0x6')](_0x21e8('0x23'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x24')]);router['put'](_0x21e8('0x25'),auth['isAuthenticated'](),controller[_0x21e8('0x26')]);router[_0x21e8('0x6')](_0x21e8('0x27'),auth['isAuthenticated'](),controller[_0x21e8('0x28')]);router['get'](_0x21e8('0x29'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x2a')]);router['get'](_0x21e8('0x2b'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x2c')]);router['get'](_0x21e8('0x2d'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x2e')]);router[_0x21e8('0x6')](_0x21e8('0x2f'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x30')]);router[_0x21e8('0x6')](_0x21e8('0x31'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x32')]);router[_0x21e8('0x6')]('/openchannel/queues/waitinginteractions',auth[_0x21e8('0xa')](),controller[_0x21e8('0x33')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x21e8('0x34')]);router['get'](_0x21e8('0x35'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x36')]);router[_0x21e8('0x37')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller[_0x21e8('0x38')]('mail'));router[_0x21e8('0x6')](_0x21e8('0x39'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x3a')]);router['post'](_0x21e8('0x3b'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x38')](_0x21e8('0x3c')));router[_0x21e8('0x6')]('/chat/queues/:id',auth[_0x21e8('0xa')](),controller[_0x21e8('0x3d')]);router[_0x21e8('0x37')](_0x21e8('0x3e'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x38')](_0x21e8('0x3f')));router[_0x21e8('0x6')](_0x21e8('0x40'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x41')]);router[_0x21e8('0x37')](_0x21e8('0x42'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x38')]('openchannel'));router[_0x21e8('0x6')](_0x21e8('0x43'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x44')]);router[_0x21e8('0x37')](_0x21e8('0x45'),auth[_0x21e8('0xa')](),controller[_0x21e8('0x38')](_0x21e8('0x46')));router[_0x21e8('0x6')]('/sms/queues/:id',auth[_0x21e8('0xa')](),controller['showSmsQueues']);router[_0x21e8('0x37')](_0x21e8('0x47'),auth['isAuthenticated'](),controller[_0x21e8('0x48')]);module[_0x21e8('0x49')]=router; \ No newline at end of file +var _0x1ae6=['/telephones','/trunks','trunks','/campaigns','campaigns','faxAccounts','/chat/queues/waitinginteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/sms/queues/waitinginteractions','/fax/queues/waitinginteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','/sms/queues/:id','showSmsQueues','/agents/:id/notify','agentNotify','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/voice/queues','/chat/queues','chatQueues','/mail/queues','mailQueues','/openchannel/queues','openchannelQueues','/sms/queues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','voiceQueuesChannelRedirect','/voice/queues/:id','/outbound','outbound','/agents','/agents/:id/capacity','agentCapacity'];(function(_0x372693,_0x4e68d3){var _0x23b142=function(_0x27ad8b){while(--_0x27ad8b){_0x372693['push'](_0x372693['shift']());}};_0x23b142(++_0x4e68d3);}(_0x1ae6,0x65));var _0x61ae=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x1ae6[_0x5c351c];return _0x26f3b3;};'use strict';var multer=require(_0x61ae('0x0'));var util=require(_0x61ae('0x1'));var path=require(_0x61ae('0x2'));var express=require(_0x61ae('0x3'));var router=express[_0x61ae('0x4')]();var auth=require(_0x61ae('0x5'));var controller=require(_0x61ae('0x6'));router[_0x61ae('0x7')](_0x61ae('0x8'),auth[_0x61ae('0x9')](),controller[_0x61ae('0xa')]);router[_0x61ae('0x7')](_0x61ae('0xb'),auth['isAuthenticated'](),controller['voiceChannelMixMonitor']);router['get'](_0x61ae('0xc'),auth['isAuthenticated'](),controller['voiceChannelStopMixMonitor']);router[_0x61ae('0x7')](_0x61ae('0xd'),auth['isAuthenticated'](),controller['voiceQueues']);router['get'](_0x61ae('0xe'),auth['isAuthenticated'](),controller[_0x61ae('0xf')]);router[_0x61ae('0x7')](_0x61ae('0x10'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x11')]);router[_0x61ae('0x7')]('/mail/accounts',auth[_0x61ae('0x9')](),controller['mailAccounts']);router[_0x61ae('0x7')](_0x61ae('0x12'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x13')]);router[_0x61ae('0x7')](_0x61ae('0x14'),auth[_0x61ae('0x9')](),controller['smsQueues']);router['get'](_0x61ae('0x15'),auth[_0x61ae('0x9')](),controller['faxQueues']);router[_0x61ae('0x7')](_0x61ae('0x16'),auth['isAuthenticated'](),controller[_0x61ae('0x17')]);router[_0x61ae('0x7')](_0x61ae('0x18'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x19')]);router[_0x61ae('0x7')](_0x61ae('0x1a'),auth[_0x61ae('0x9')](),controller['voiceQueuesChannel']);router[_0x61ae('0x7')](_0x61ae('0x1b'),auth['isAuthenticated'](),controller[_0x61ae('0x1c')]);router['get'](_0x61ae('0x1d'),auth['isAuthenticated'](),controller[_0x61ae('0x1e')]);router[_0x61ae('0x7')](_0x61ae('0x1f'),auth[_0x61ae('0x9')](),controller['showVoiceQueues']);router[_0x61ae('0x7')](_0x61ae('0x20'),auth['isAuthenticated'](),controller[_0x61ae('0x21')]);router[_0x61ae('0x7')]('/outbound/channels',auth[_0x61ae('0x9')](),controller['outboundChannels']);router[_0x61ae('0x7')](_0x61ae('0x22'),auth[_0x61ae('0x9')](),controller['agents']);router['put'](_0x61ae('0x23'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x24')]);router[_0x61ae('0x7')](_0x61ae('0x25'),auth[_0x61ae('0x9')](),controller['telephones']);router[_0x61ae('0x7')](_0x61ae('0x26'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x27')]);router[_0x61ae('0x7')](_0x61ae('0x28'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x29')]);router[_0x61ae('0x7')]('/fax/accounts',auth['isAuthenticated'](),controller[_0x61ae('0x2a')]);router[_0x61ae('0x7')](_0x61ae('0x2b'),auth['isAuthenticated'](),controller['chatQueuesWaitingInteractions']);router[_0x61ae('0x7')]('/mail/queues/waitinginteractions',auth[_0x61ae('0x9')](),controller[_0x61ae('0x2c')]);router[_0x61ae('0x7')]('/openchannel/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x61ae('0x2d')]);router[_0x61ae('0x7')](_0x61ae('0x2e'),auth[_0x61ae('0x9')](),controller['smsQueuesWaitingInteractions']);router[_0x61ae('0x7')](_0x61ae('0x2f'),auth['isAuthenticated'](),controller[_0x61ae('0x30')]);router[_0x61ae('0x31')](_0x61ae('0x32'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x33')](_0x61ae('0x34')));router[_0x61ae('0x7')](_0x61ae('0x35'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x36')]);router[_0x61ae('0x31')](_0x61ae('0x37'),auth['isAuthenticated'](),controller['queueNotify']('chat'));router['get'](_0x61ae('0x38'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x39')]);router['post'](_0x61ae('0x3a'),auth['isAuthenticated'](),controller['queueNotify'](_0x61ae('0x3b')));router['get'](_0x61ae('0x3c'),auth['isAuthenticated'](),controller[_0x61ae('0x3d')]);router[_0x61ae('0x31')]('/openchannel/queues/:id/notify',auth[_0x61ae('0x9')](),controller['queueNotify']('openchannel'));router[_0x61ae('0x7')](_0x61ae('0x3e'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x3f')]);router[_0x61ae('0x31')](_0x61ae('0x40'),auth[_0x61ae('0x9')](),controller['queueNotify']('sms'));router[_0x61ae('0x7')](_0x61ae('0x41'),auth[_0x61ae('0x9')](),controller[_0x61ae('0x42')]);router[_0x61ae('0x31')](_0x61ae('0x43'),auth['isAuthenticated'](),controller[_0x61ae('0x44')]);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 e6440e8..4a0e21c 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 _0x9c61=['AgentCapacity','capacity','telephones','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','Website','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','create','Start','Account','agentNotify','Channel\x20field\x20is\x20mandatory','channel','capitalize','chat','User','Agent\x20not\x20found','TransferReport','*,*,*,*','bluebird','moment','lodash','../../config/logger','http','client','request','then','error','code','message','result','json','sendStatus','name','status','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','params','catch','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','VoiceQueues','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','Outbound','outboundChannels','OutboundChannels','agents','Agents','body','user','interaction','format','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','findOrCreate','INTERACTION','SIP/%s','interface','agent','internal'];(function(_0x2ee8be,_0x55b2e6){var _0x3dd2bf=function(_0x516a63){while(--_0x516a63){_0x2ee8be['push'](_0x2ee8be['shift']());}};_0x3dd2bf(++_0x55b2e6);}(_0x9c61,0x17d));var _0x19c6=function(_0x3337b6,_0x42c7f9){_0x3337b6=_0x3337b6-0x0;var _0x568270=_0x9c61[_0x3337b6];return _0x568270;};'use strict';var BPromise=require(_0x19c6('0x0'));var moment=require(_0x19c6('0x1'));var _=require(_0x19c6('0x2'));var util=require('util');var db=require('../../mysqldb')['db'];var logger=require(_0x19c6('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson['client'][_0x19c6('0x4')]({'port':0x232a});var mailClient=jayson[_0x19c6('0x5')][_0x19c6('0x4')]({'port':0x232b});var routingClient=jayson[_0x19c6('0x5')]['http']({'port':0x232c});function respondWithRpcPromise(_0xc179b4,_0x2bbf18,_0x2a647b){return new BPromise(function(_0x183c28,_0x413bc2){var _0x4455f6=_0x2a647b?_0x2a647b:amiClient;return _0x4455f6[_0x19c6('0x6')](_0xc179b4,_0x2bbf18)[_0x19c6('0x7')](function(_0x321404){if(_0x321404['error']){if(_0x321404[_0x19c6('0x8')][_0x19c6('0x9')]===0x1f4){return _0x413bc2(_0x321404[_0x19c6('0x8')][_0x19c6('0xa')]);}return _0x183c28(_0x321404[_0x19c6('0x8')]['message']);}else{_0x183c28(_0x321404[_0x19c6('0xb')]);}})['catch'](function(_0x2c135a){_0x413bc2(_0x2c135a);});});}function respondWithResult(_0x29850f,_0x3ea35f){_0x3ea35f=_0x3ea35f||0xc8;return function(_0x54ab14){if(_0x54ab14){return _0x29850f['status'](_0x3ea35f)[_0x19c6('0xc')](_0x54ab14);}return _0x29850f[_0x19c6('0xd')](0x194);};}function handleError(_0x2d9b88,_0x33b335){_0x33b335=_0x33b335||0x1f4;return function(_0x2dd822){logger[_0x19c6('0x8')](_0x2dd822['stack']);if(_0x2dd822[_0x19c6('0xe')]){delete _0x2dd822['name'];}_0x2d9b88[_0x19c6('0xf')](_0x33b335)['send'](_0x2dd822);};}function findById(_0x387251){return function(_0x5cbe04){if(!_[_0x19c6('0x10')](_0x387251)&&!_[_0x19c6('0x10')](_0x5cbe04)&&!_[_0x19c6('0x10')](_0x5cbe04[_0x19c6('0x11')])){return _[_0x19c6('0x12')](_0x5cbe04['rows'],function(_0x142773){return _0x142773['id']==_0x387251;});}return null;};}exports[_0x19c6('0x13')]=function(_0x26f48d,_0x338891){return respondWithRpcPromise(_0x19c6('0x14'),_0x26f48d[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x338891,null))['catch'](handleError(_0x338891,null));};exports[_0x19c6('0x16')]=function(_0x5822ed,_0x4f4ee1){return respondWithRpcPromise('VoiceChannelMixMonitor',_['merge'](_0x5822ed['query'],_0x5822ed[_0x19c6('0x17')]))[_0x19c6('0x7')](respondWithResult(_0x4f4ee1,null))[_0x19c6('0x18')](handleError(_0x4f4ee1,null));};exports[_0x19c6('0x19')]=function(_0x2a563c,_0xdb76f2){return respondWithRpcPromise(_0x19c6('0x1a'),_[_0x19c6('0x1b')](_0x2a563c[_0x19c6('0x15')],_0x2a563c[_0x19c6('0x17')]))[_0x19c6('0x7')](respondWithResult(_0xdb76f2,null))[_0x19c6('0x18')](handleError(_0xdb76f2,null));};exports['voiceQueues']=function(_0x5cb2b1,_0x3f1318){return respondWithRpcPromise(_0x19c6('0x1c'),_0x5cb2b1[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x3f1318,null))['catch'](handleError(_0x3f1318,null));};exports['showVoiceQueues']=function(_0x23c9f6,_0x2350cd){return respondWithRpcPromise(_0x19c6('0x1c'),_0x23c9f6[_0x19c6('0x15')])[_0x19c6('0x7')](findById(_0x23c9f6[_0x19c6('0x17')]['id']))[_0x19c6('0x7')](respondWithResult(_0x2350cd,null))[_0x19c6('0x18')](handleError(_0x2350cd,null));};exports[_0x19c6('0x1d')]=function(_0x584ee2,_0x1d0667){return respondWithRpcPromise(_0x19c6('0x1e'),_[_0x19c6('0x1b')](_0x584ee2[_0x19c6('0x15')],_0x584ee2[_0x19c6('0x17')]))[_0x19c6('0x7')](respondWithResult(_0x1d0667,null))['catch'](handleError(_0x1d0667,null));};exports[_0x19c6('0x1f')]=function(_0x41bb7e,_0x5a7454){return respondWithRpcPromise(_0x19c6('0x20'),_0x41bb7e[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x5a7454,null))['catch'](handleError(_0x5a7454,null));};exports[_0x19c6('0x21')]=function(_0x1c1b3d,_0x2444c1){return respondWithRpcPromise(_0x19c6('0x22'),_[_0x19c6('0x1b')](_0x1c1b3d[_0x19c6('0x15')],_0x1c1b3d[_0x19c6('0x17')]))[_0x19c6('0x7')](respondWithResult(_0x2444c1,null))['catch'](handleError(_0x2444c1,null));};exports[_0x19c6('0x23')]=function(_0x55452b,_0x3e4fb8){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0x19c6('0x1b')](_0x55452b[_0x19c6('0x15')],_0x55452b[_0x19c6('0x17')]))['then'](respondWithResult(_0x3e4fb8,null))[_0x19c6('0x18')](handleError(_0x3e4fb8,null));};exports[_0x19c6('0x24')]=function(_0x93bccf,_0x5686ad){return respondWithRpcPromise('VoiceQueuesChannelRedirect',_['merge'](_0x93bccf[_0x19c6('0x15')],_0x93bccf[_0x19c6('0x17')]))[_0x19c6('0x7')](respondWithResult(_0x5686ad,null))[_0x19c6('0x18')](handleError(_0x5686ad,null));};exports['outbound']=function(_0x4d0f3f,_0x3dbb8f){return respondWithRpcPromise(_0x19c6('0x25'),_0x4d0f3f[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x3dbb8f,null))[_0x19c6('0x18')](handleError(_0x3dbb8f,null));};exports[_0x19c6('0x26')]=function(_0x38574d,_0x585e16){return respondWithRpcPromise(_0x19c6('0x27'),_0x38574d[_0x19c6('0x15')])['then'](respondWithResult(_0x585e16,null))[_0x19c6('0x18')](handleError(_0x585e16,null));};exports[_0x19c6('0x28')]=function(_0x31c31d,_0x42afa4){var _0x57ecff;return respondWithRpcPromise(_0x19c6('0x29'),_0x31c31d['query'])['then'](function(_0x51e6ea){_0x57ecff=_0x51e6ea;return respondWithRpcPromise(_0x19c6('0x29'),_0x31c31d[_0x19c6('0x15')],routingClient);})[_0x19c6('0x7')](function(_0x21407e){return _[_0x19c6('0x1b')]({},_0x21407e,_0x57ecff);})['then'](respondWithResult(_0x42afa4,null))[_0x19c6('0x18')](handleError(_0x42afa4,null));};exports['agentCapacity']=function(_0x4207ba,_0x50f117){if(_0x4207ba[_0x19c6('0x2a')]&&_0x4207ba[_0x19c6('0x2a')]['interaction']&&_0x4207ba[_0x19c6('0x2b')]&&_0x4207ba[_0x19c6('0x2b')]['name']){for(var _0x27b771 in _0x4207ba[_0x19c6('0x2a')][_0x19c6('0x2c')]){if(_0x4207ba[_0x19c6('0x2a')]['interaction']['hasOwnProperty'](_0x27b771)){db['MemberReport']['findAll']({'where':{'channel':_0x27b771,'membername':_0x4207ba[_0x19c6('0x2b')][_0x19c6('0xe')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x4207ba[_0x19c6('0x2a')]['interaction'][_0x27b771]&&_0x4207ba[_0x19c6('0x2a')][_0x19c6('0x2c')][_0x27b771]['length']?{'$notIn':_0x4207ba['body'][_0x19c6('0x2c')][_0x27b771]}:{'$ne':null}}})[_0x19c6('0x7')](function(_0x33b4b1){var _0x45619f=moment()[_0x19c6('0x2d')](_0x19c6('0x2e'));for(var _0x4f6bfd=0x0,_0x5823cf=_0x33b4b1[_0x19c6('0x2f')];_0x4f6bfd<_0x5823cf;_0x4f6bfd+=0x1){_0x33b4b1[_0x4f6bfd][_0x19c6('0x30')]({'exitAt':_0x45619f});}});for(var _0x4dbb91=0x0;_0x4dbb91<_0x4207ba[_0x19c6('0x2a')][_0x19c6('0x2c')][_0x27b771][_0x19c6('0x2f')];_0x4dbb91+=0x1){db['MemberReport'][_0x19c6('0x31')]({'where':{'channel':_0x27b771,'membername':_0x4207ba[_0x19c6('0x2b')][_0x19c6('0xe')],'type':_0x19c6('0x32'),'uniqueid':_0x4207ba[_0x19c6('0x2a')]['interaction'][_0x27b771][_0x4dbb91],'exitAt':null},'defaults':{'channel':_0x27b771,'membername':_0x4207ba[_0x19c6('0x2b')][_0x19c6('0xe')],'interface':_[_0x19c6('0x10')](_0x4207ba[_0x19c6('0x2b')]['interface'])?util[_0x19c6('0x2d')](_0x19c6('0x33'),_0x4207ba['user']['name']):_0x4207ba['user'][_0x19c6('0x34')],'type':'INTERACTION','enterAt':moment()['format'](_0x19c6('0x2e')),'role':_0x19c6('0x35'),'internal':_0x4207ba[_0x19c6('0x2b')][_0x19c6('0x36')],'uniqueid':_0x4207ba['body']['interaction'][_0x27b771][_0x4dbb91]}});}}}}return respondWithRpcPromise(_0x19c6('0x37'),{'id':_0x4207ba[_0x19c6('0x17')]['id'],'capacity':_0x4207ba[_0x19c6('0x2a')][_0x19c6('0x38')]},routingClient)[_0x19c6('0x7')](respondWithResult(_0x50f117,null))['catch'](handleError(_0x50f117,null));};exports[_0x19c6('0x39')]=function(_0x4a6a89,_0x34afdc){return respondWithRpcPromise(_0x19c6('0x3a'),_0x4a6a89[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x34afdc,null))[_0x19c6('0x18')](handleError(_0x34afdc,null));};exports['trunks']=function(_0xf00717,_0x506ab9){return respondWithRpcPromise(_0x19c6('0x3b'),_0xf00717[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x506ab9,null))[_0x19c6('0x18')](handleError(_0x506ab9,null));};exports[_0x19c6('0x3c')]=function(_0x1deb64,_0x566b52){return respondWithRpcPromise('Campaigns',_0x1deb64['query'])['then'](respondWithResult(_0x566b52,null))[_0x19c6('0x18')](handleError(_0x566b52,null));};exports[_0x19c6('0x3d')]=function(_0x21adc6,_0x31383a){return respondWithRpcPromise(_0x19c6('0x3e'),_0x21adc6[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](respondWithResult(_0x31383a,null))[_0x19c6('0x18')](handleError(_0x31383a,null));};exports[_0x19c6('0x3f')]=function(_0x525f70,_0x143459){return respondWithRpcPromise('ChatQueues',_0x525f70[_0x19c6('0x15')],routingClient)['then'](findById(_0x525f70['params']['id']))['then'](respondWithResult(_0x143459,null))[_0x19c6('0x18')](handleError(_0x143459,null));};exports[_0x19c6('0x40')]=function(_0x4bebf0,_0x3985a0){return respondWithRpcPromise('MailQueues',_0x4bebf0['query'],routingClient)[_0x19c6('0x7')](respondWithResult(_0x3985a0,null))[_0x19c6('0x18')](handleError(_0x3985a0,null));};exports[_0x19c6('0x41')]=function(_0x488e69,_0x361170){return respondWithRpcPromise(_0x19c6('0x42'),_0x488e69[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](findById(_0x488e69[_0x19c6('0x17')]['id']))['then'](respondWithResult(_0x361170,null))[_0x19c6('0x18')](handleError(_0x361170,null));};exports[_0x19c6('0x43')]=function(_0x38b91f,_0x3baf18){return respondWithRpcPromise(_0x19c6('0x44'),_0x38b91f[_0x19c6('0x15')],mailClient)['then'](respondWithResult(_0x3baf18,null))[_0x19c6('0x18')](handleError(_0x3baf18,null));};exports[_0x19c6('0x45')]=function(_0x5d6117,_0x3664bc){return respondWithRpcPromise(_0x19c6('0x46'),_0x5d6117[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](respondWithResult(_0x3664bc,null))[_0x19c6('0x18')](handleError(_0x3664bc,null));};exports['showOpenchannelQueues']=function(_0x4f9621,_0x9854c8){return respondWithRpcPromise(_0x19c6('0x46'),_0x4f9621[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](findById(_0x4f9621[_0x19c6('0x17')]['id']))[_0x19c6('0x7')](respondWithResult(_0x9854c8,null))[_0x19c6('0x18')](handleError(_0x9854c8,null));};exports[_0x19c6('0x47')]=function(_0x137647,_0x46707e){return respondWithRpcPromise(_0x19c6('0x48'),_0x137647[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](respondWithResult(_0x46707e,null))[_0x19c6('0x18')](handleError(_0x46707e,null));};exports[_0x19c6('0x49')]=function(_0x193b6a,_0x17043a){return respondWithRpcPromise(_0x19c6('0x48'),_0x193b6a[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](findById(_0x193b6a['params']['id']))[_0x19c6('0x7')](respondWithResult(_0x17043a,null))[_0x19c6('0x18')](handleError(_0x17043a,null));};exports[_0x19c6('0x4a')]=function(_0xb4ad9,_0x36a61c){return respondWithRpcPromise(_0x19c6('0x4b'),_0xb4ad9['query'],routingClient)['then'](respondWithResult(_0x36a61c,null))[_0x19c6('0x18')](handleError(_0x36a61c,null));};exports[_0x19c6('0x4c')]=function(_0x58f387,_0x37b690){return respondWithRpcPromise(_0x19c6('0x4b'),_0x58f387[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](findById(_0x58f387[_0x19c6('0x17')]['id']))[_0x19c6('0x7')](respondWithResult(_0x37b690,null))[_0x19c6('0x18')](handleError(_0x37b690,null));};exports[_0x19c6('0x4d')]=function(_0x2031ba,_0x5c8d9b){return respondWithRpcPromise(_0x19c6('0x4e'),_0x2031ba[_0x19c6('0x15')])[_0x19c6('0x7')](respondWithResult(_0x5c8d9b,null))[_0x19c6('0x18')](handleError(_0x5c8d9b,null));};exports[_0x19c6('0x4f')]=function(_0x31afbd,_0x5b57f5){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x31afbd['query'],routingClient)[_0x19c6('0x7')](respondWithResult(_0x5b57f5,null))[_0x19c6('0x18')](handleError(_0x5b57f5,null));};exports[_0x19c6('0x50')]=function(_0x2cf9bb,_0x2d8eb9){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x2cf9bb[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](respondWithResult(_0x2d8eb9,null))[_0x19c6('0x18')](handleError(_0x2d8eb9,null));};exports[_0x19c6('0x51')]=function(_0x2bd50e,_0x144d19){return respondWithRpcPromise(_0x19c6('0x52'),_0x2bd50e['query'],routingClient)[_0x19c6('0x7')](respondWithResult(_0x144d19,null))[_0x19c6('0x18')](handleError(_0x144d19,null));};exports[_0x19c6('0x53')]=function(_0x56c8a9,_0x3d9a48){return respondWithRpcPromise('SmsQueuesWaitingInteractions',_0x56c8a9[_0x19c6('0x15')],routingClient)['then'](respondWithResult(_0x3d9a48,null))[_0x19c6('0x18')](handleError(_0x3d9a48,null));};exports[_0x19c6('0x54')]=function(_0x105ec5,_0xdd64e7){return respondWithRpcPromise('FaxQueuesWaitingInteractions',_0x105ec5[_0x19c6('0x15')],routingClient)[_0x19c6('0x7')](respondWithResult(_0xdd64e7,null))[_0x19c6('0x18')](handleError(_0xdd64e7,null));};exports['queueNotify']=function(_0x224634){return function(_0x20ad10,_0x31d61a){var _0x276faf,_0x2fe646;var _0x509944=_['capitalize'](_0x224634);var _0x220b06=_0x224634==='chat'?_0x19c6('0x55'):'Account';return db[_0x509944+'Queue'][_0x19c6('0x56')]({'raw':!![],'where':{'id':_0x20ad10[_0x19c6('0x17')]['id']}})[_0x19c6('0x7')](function(_0x1951e8){if(_[_0x19c6('0x10')](_0x1951e8)){throw new Error(_0x509944+_0x19c6('0x57'));}_0x276faf=_0x1951e8;return db[_0x509944+_0x19c6('0x58')][_0x19c6('0x56')]({'where':{'id':_0x20ad10[_0x19c6('0x2a')][_0x19c6('0x59')]},'include':[{'model':db[_0x509944+_0x19c6('0x5a')],'as':_0x19c6('0x5a')},{'model':db[_0x509944+_0x220b06],'as':'Account'}]});})[_0x19c6('0x7')](function(_0x1d96f4){if(_[_0x19c6('0x10')](_0x1d96f4)){throw new Error(_0x509944+_0x19c6('0x5b'));}_0x2fe646=_0x1d96f4;return _0x1d96f4[_0x19c6('0x5c')]({'read':0x0,'readAt':null,'UserId':null});})[_0x19c6('0x7')](function(){var _0x5bd20c={'uniqueid':_0x224634+'.'+_0x2fe646['id']+'.'+_0x2fe646[_0x19c6('0x5a')]['id'],'FromUserId':_0x20ad10['user']['id'],'type':_0x19c6('0x5d')};_0x5bd20c[_0x509944+_0x19c6('0x5e')]=_0x2fe646['id'];_0x5bd20c[_0x509944+_0x19c6('0x5f')]=_0x2fe646['Interaction']['id'];_0x5bd20c[_0x19c6('0x60')+_0x509944+_0x220b06+'Id']=_0x2fe646['Account']['id'];_0x5bd20c['To'+_0x509944+'QueueId']=_0x276faf['id'];return db[_0x509944+'TransferReport'][_0x19c6('0x61')](_0x5bd20c);})[_0x19c6('0x7')](function(){return respondWithRpcPromise(_0x19c6('0x62'),{'channel':_0x224634,'interaction':_0x2fe646[_0x19c6('0x5a')],'message':_0x2fe646,'account':_0x2fe646['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x19c6('0x5d'),'appdata':_0x276faf[_0x19c6('0xe')]+','+(_0x2fe646[_0x19c6('0x63')]['queueTransferTimeout']||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x19c6('0x7')](respondWithResult(_0x31d61a,null))['catch'](handleError(_0x31d61a,null));};};exports[_0x19c6('0x64')]=function(_0x44a15e,_0x21df6c){var _0x8f44d1,_0x1662b3;if(_[_0x19c6('0x10')](_0x44a15e['body']['channel'])){throw new Error(_0x19c6('0x65'));}var _0xef90a8=_0x44a15e[_0x19c6('0x2a')][_0x19c6('0x66')];var _0x45894b=_[_0x19c6('0x67')](_0xef90a8);var _0x390880=_0xef90a8===_0x19c6('0x68')?_0x19c6('0x55'):_0x19c6('0x63');return db[_0x19c6('0x69')][_0x19c6('0x56')]({'raw':!![],'where':{'id':_0x44a15e[_0x19c6('0x17')]['id'],'role':_0x19c6('0x35')}})[_0x19c6('0x7')](function(_0x264be2){if(_[_0x19c6('0x10')](_0x264be2)){throw new Error(_0x19c6('0x6a'));}_0x8f44d1=_0x264be2;return db[_0x45894b+_0x19c6('0x58')][_0x19c6('0x56')]({'where':{'id':_0x44a15e[_0x19c6('0x2a')]['messageId']},'include':[{'model':db[_0x45894b+_0x19c6('0x5a')],'as':'Interaction'},{'model':db[_0x45894b+_0x390880],'as':_0x19c6('0x63')}]});})[_0x19c6('0x7')](function(_0x64385f){if(_[_0x19c6('0x10')](_0x64385f)){throw new Error(_0x45894b+_0x19c6('0x5b'));}_0x1662b3=_0x64385f;return _0x64385f['update']({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3877c6={'uniqueid':_0xef90a8+'.'+_0x1662b3['id']+'.'+_0x1662b3[_0x19c6('0x5a')]['id'],'FromUserId':_0x44a15e['user']['id'],'type':_0x19c6('0x5d'),'ToUserId':_0x8f44d1['id']};_0x3877c6[_0x45894b+'MessageId']=_0x1662b3['id'];_0x3877c6[_0x45894b+'InteractionId']=_0x1662b3[_0x19c6('0x5a')]['id'];_0x3877c6[_0x19c6('0x60')+_0x45894b+_0x390880+'Id']=_0x1662b3['Account']['id'];return db[_0x45894b+_0x19c6('0x6b')][_0x19c6('0x61')](_0x3877c6);})[_0x19c6('0x7')](function(){return respondWithRpcPromise(_0x19c6('0x62'),{'channel':_0xef90a8,'interaction':_0x1662b3['Interaction'],'message':_0x1662b3,'account':_0x1662b3[_0x19c6('0x63')],'applications':[{'id':0x0,'priority':0x1,'app':'agent','appdata':_0x8f44d1[_0x19c6('0xe')]+','+(_0x1662b3[_0x19c6('0x63')]['agentTransferTimeout']||0x12c),'interval':_0x19c6('0x6c')}]},routingClient);})[_0x19c6('0x7')](respondWithResult(_0x21df6c,null))[_0x19c6('0x18')](handleError(_0x21df6c,null));}; \ No newline at end of file +var _0x376f=['smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','Account','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','From','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','channel','Channel\x20field\x20is\x20mandatory','Website','create','bluebird','moment','../../mysqldb','../../config/logger','client','http','request','error','code','message','result','catch','status','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','query','then','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','params','voiceQueues','VoiceQueues','showVoiceQueues','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','outboundChannels','Agents','agentCapacity','body','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','updateAttributes','findOrCreate','INTERACTION','interface','YYYY-MM-DD\x20HH:mm:ss','agent','AgentCapacity','telephones','Telephones','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions'];(function(_0x16b156,_0x50304a){var _0x4e65ef=function(_0x5e740c){while(--_0x5e740c){_0x16b156['push'](_0x16b156['shift']());}};_0x4e65ef(++_0x50304a);}(_0x376f,0x1d1));var _0xf376=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x376f[_0x29d915];return _0x160f86;};'use strict';var BPromise=require(_0xf376('0x0'));var moment=require(_0xf376('0x1'));var _=require('lodash');var util=require('util');var db=require(_0xf376('0x2'))['db'];var logger=require(_0xf376('0x3'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0xf376('0x4')]['http']({'port':0x232a});var mailClient=jayson['client'][_0xf376('0x5')]({'port':0x232b});var routingClient=jayson[_0xf376('0x4')]['http']({'port':0x232c});function respondWithRpcPromise(_0x301c22,_0x59142b,_0x8460ed){return new BPromise(function(_0x3227dd,_0x498b31){var _0x55a3be=_0x8460ed?_0x8460ed:amiClient;return _0x55a3be[_0xf376('0x6')](_0x301c22,_0x59142b)['then'](function(_0x36ea1b){if(_0x36ea1b[_0xf376('0x7')]){if(_0x36ea1b[_0xf376('0x7')][_0xf376('0x8')]===0x1f4){return _0x498b31(_0x36ea1b['error'][_0xf376('0x9')]);}return _0x3227dd(_0x36ea1b[_0xf376('0x7')][_0xf376('0x9')]);}else{_0x3227dd(_0x36ea1b[_0xf376('0xa')]);}})[_0xf376('0xb')](function(_0x3b8b5d){_0x498b31(_0x3b8b5d);});});}function respondWithResult(_0x2e9bfb,_0x57d586){_0x57d586=_0x57d586||0xc8;return function(_0x46012d){if(_0x46012d){return _0x2e9bfb[_0xf376('0xc')](_0x57d586)['json'](_0x46012d);}return _0x2e9bfb[_0xf376('0xd')](0x194);};}function handleError(_0x44a2b2,_0x4782b0){_0x4782b0=_0x4782b0||0x1f4;return function(_0x4f6cb3){logger['error'](_0x4f6cb3[_0xf376('0xe')]);if(_0x4f6cb3[_0xf376('0xf')]){delete _0x4f6cb3['name'];}_0x44a2b2[_0xf376('0xc')](_0x4782b0)[_0xf376('0x10')](_0x4f6cb3);};}function findById(_0x4a9277){return function(_0x599e33){if(!_[_0xf376('0x11')](_0x4a9277)&&!_['isNil'](_0x599e33)&&!_[_0xf376('0x11')](_0x599e33[_0xf376('0x12')])){return _[_0xf376('0x13')](_0x599e33['rows'],function(_0x2b68d3){return _0x2b68d3['id']==_0x4a9277;});}return null;};}exports[_0xf376('0x14')]=function(_0x7f414b,_0x2d92ec){return respondWithRpcPromise('VoiceChannels',_0x7f414b[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x2d92ec,null))[_0xf376('0xb')](handleError(_0x2d92ec,null));};exports[_0xf376('0x17')]=function(_0x3b4f38,_0x59ef7e){return respondWithRpcPromise(_0xf376('0x18'),_[_0xf376('0x19')](_0x3b4f38[_0xf376('0x15')],_0x3b4f38['params']))['then'](respondWithResult(_0x59ef7e,null))['catch'](handleError(_0x59ef7e,null));};exports[_0xf376('0x1a')]=function(_0x1564de,_0x566102){return respondWithRpcPromise(_0xf376('0x1b'),_[_0xf376('0x19')](_0x1564de[_0xf376('0x15')],_0x1564de[_0xf376('0x1c')]))['then'](respondWithResult(_0x566102,null))['catch'](handleError(_0x566102,null));};exports[_0xf376('0x1d')]=function(_0x26124a,_0x3eed29){return respondWithRpcPromise(_0xf376('0x1e'),_0x26124a[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x3eed29,null))[_0xf376('0xb')](handleError(_0x3eed29,null));};exports[_0xf376('0x1f')]=function(_0x5ca13e,_0x33efa7){return respondWithRpcPromise('VoiceQueues',_0x5ca13e[_0xf376('0x15')])[_0xf376('0x16')](findById(_0x5ca13e[_0xf376('0x1c')]['id']))[_0xf376('0x16')](respondWithResult(_0x33efa7,null))[_0xf376('0xb')](handleError(_0x33efa7,null));};exports[_0xf376('0x20')]=function(_0x2929a0,_0x2894cb){return respondWithRpcPromise('VoiceQueuesPreview',_[_0xf376('0x19')](_0x2929a0[_0xf376('0x15')],_0x2929a0[_0xf376('0x1c')]))[_0xf376('0x16')](respondWithResult(_0x2894cb,null))[_0xf376('0xb')](handleError(_0x2894cb,null));};exports[_0xf376('0x21')]=function(_0x1abdd4,_0x5583b5){return respondWithRpcPromise(_0xf376('0x22'),_0x1abdd4[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x5583b5,null))[_0xf376('0xb')](handleError(_0x5583b5,null));};exports[_0xf376('0x23')]=function(_0x47ac97,_0x4de8dc){return respondWithRpcPromise(_0xf376('0x24'),_[_0xf376('0x19')](_0x47ac97[_0xf376('0x15')],_0x47ac97[_0xf376('0x1c')]))[_0xf376('0x16')](respondWithResult(_0x4de8dc,null))['catch'](handleError(_0x4de8dc,null));};exports[_0xf376('0x25')]=function(_0x5eb967,_0x3f6a98){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xf376('0x19')](_0x5eb967[_0xf376('0x15')],_0x5eb967[_0xf376('0x1c')]))['then'](respondWithResult(_0x3f6a98,null))[_0xf376('0xb')](handleError(_0x3f6a98,null));};exports['voiceQueuesChannelRedirect']=function(_0x15892a,_0x21ceda){return respondWithRpcPromise(_0xf376('0x26'),_['merge'](_0x15892a[_0xf376('0x15')],_0x15892a[_0xf376('0x1c')]))[_0xf376('0x16')](respondWithResult(_0x21ceda,null))[_0xf376('0xb')](handleError(_0x21ceda,null));};exports[_0xf376('0x27')]=function(_0x1bae6e,_0x463ca4){return respondWithRpcPromise('Outbound',_0x1bae6e['query'])[_0xf376('0x16')](respondWithResult(_0x463ca4,null))['catch'](handleError(_0x463ca4,null));};exports[_0xf376('0x28')]=function(_0x37ba70,_0x5d9ca4){return respondWithRpcPromise('OutboundChannels',_0x37ba70[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x5d9ca4,null))[_0xf376('0xb')](handleError(_0x5d9ca4,null));};exports['agents']=function(_0x2dbd0b,_0x3eba22){var _0x2f262b;return respondWithRpcPromise(_0xf376('0x29'),_0x2dbd0b[_0xf376('0x15')])[_0xf376('0x16')](function(_0x7aad72){_0x2f262b=_0x7aad72;return respondWithRpcPromise(_0xf376('0x29'),_0x2dbd0b[_0xf376('0x15')],routingClient);})[_0xf376('0x16')](function(_0x99abc4){return _[_0xf376('0x19')]({},_0x99abc4,_0x2f262b);})[_0xf376('0x16')](respondWithResult(_0x3eba22,null))[_0xf376('0xb')](handleError(_0x3eba22,null));};exports[_0xf376('0x2a')]=function(_0x3a73b3,_0x4dc223){if(_0x3a73b3[_0xf376('0x2b')]&&_0x3a73b3['body'][_0xf376('0x2c')]&&_0x3a73b3[_0xf376('0x2d')]&&_0x3a73b3['user'][_0xf376('0xf')]){for(var _0x505500 in _0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')]){if(_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0xf376('0x2e')](_0x505500)){db[_0xf376('0x2f')][_0xf376('0x30')]({'where':{'channel':_0x505500,'membername':_0x3a73b3['user'][_0xf376('0xf')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0x505500]&&_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0x505500][_0xf376('0x31')]?{'$notIn':_0x3a73b3[_0xf376('0x2b')]['interaction'][_0x505500]}:{'$ne':null}}})[_0xf376('0x16')](function(_0x490792){var _0x3ca743=moment()[_0xf376('0x32')]('YYYY-MM-DD\x20HH:mm:ss');for(var _0xde3bd8=0x0,_0xdb70ab=_0x490792[_0xf376('0x31')];_0xde3bd8<_0xdb70ab;_0xde3bd8+=0x1){_0x490792[_0xde3bd8][_0xf376('0x33')]({'exitAt':_0x3ca743});}});for(var _0x35341a=0x0;_0x35341a<_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0x505500][_0xf376('0x31')];_0x35341a+=0x1){db['MemberReport'][_0xf376('0x34')]({'where':{'channel':_0x505500,'membername':_0x3a73b3['user'][_0xf376('0xf')],'type':_0xf376('0x35'),'uniqueid':_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0x505500][_0x35341a],'exitAt':null},'defaults':{'channel':_0x505500,'membername':_0x3a73b3['user'][_0xf376('0xf')],'interface':_['isNil'](_0x3a73b3[_0xf376('0x2d')][_0xf376('0x36')])?util[_0xf376('0x32')]('SIP/%s',_0x3a73b3[_0xf376('0x2d')][_0xf376('0xf')]):_0x3a73b3[_0xf376('0x2d')]['interface'],'type':_0xf376('0x35'),'enterAt':moment()[_0xf376('0x32')](_0xf376('0x37')),'role':_0xf376('0x38'),'internal':_0x3a73b3[_0xf376('0x2d')]['internal'],'uniqueid':_0x3a73b3[_0xf376('0x2b')][_0xf376('0x2c')][_0x505500][_0x35341a]}});}}}}return respondWithRpcPromise(_0xf376('0x39'),{'id':_0x3a73b3[_0xf376('0x1c')]['id'],'capacity':_0x3a73b3['body']['capacity']},routingClient)[_0xf376('0x16')](respondWithResult(_0x4dc223,null))['catch'](handleError(_0x4dc223,null));};exports[_0xf376('0x3a')]=function(_0x14995e,_0xfe9f72){return respondWithRpcPromise(_0xf376('0x3b'),_0x14995e[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0xfe9f72,null))[_0xf376('0xb')](handleError(_0xfe9f72,null));};exports['trunks']=function(_0x3c3ef5,_0x176b10){return respondWithRpcPromise(_0xf376('0x3c'),_0x3c3ef5[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x176b10,null))[_0xf376('0xb')](handleError(_0x176b10,null));};exports[_0xf376('0x3d')]=function(_0x1dc2d6,_0x5be494){return respondWithRpcPromise('Campaigns',_0x1dc2d6['query'])['then'](respondWithResult(_0x5be494,null))['catch'](handleError(_0x5be494,null));};exports[_0xf376('0x3e')]=function(_0x3841dc,_0x327051){return respondWithRpcPromise(_0xf376('0x3f'),_0x3841dc[_0xf376('0x15')],routingClient)[_0xf376('0x16')](respondWithResult(_0x327051,null))[_0xf376('0xb')](handleError(_0x327051,null));};exports[_0xf376('0x40')]=function(_0x434e10,_0x5439aa){return respondWithRpcPromise('ChatQueues',_0x434e10[_0xf376('0x15')],routingClient)[_0xf376('0x16')](findById(_0x434e10[_0xf376('0x1c')]['id']))[_0xf376('0x16')](respondWithResult(_0x5439aa,null))[_0xf376('0xb')](handleError(_0x5439aa,null));};exports['mailQueues']=function(_0x32695c,_0x3285a6){return respondWithRpcPromise(_0xf376('0x41'),_0x32695c['query'],routingClient)[_0xf376('0x16')](respondWithResult(_0x3285a6,null))[_0xf376('0xb')](handleError(_0x3285a6,null));};exports['showMailQueues']=function(_0x28e7b5,_0x36aa2d){return respondWithRpcPromise('MailQueues',_0x28e7b5[_0xf376('0x15')],routingClient)[_0xf376('0x16')](findById(_0x28e7b5[_0xf376('0x1c')]['id']))[_0xf376('0x16')](respondWithResult(_0x36aa2d,null))[_0xf376('0xb')](handleError(_0x36aa2d,null));};exports['mailAccounts']=function(_0x3956a8,_0x45cc72){return respondWithRpcPromise(_0xf376('0x42'),_0x3956a8[_0xf376('0x15')],mailClient)[_0xf376('0x16')](respondWithResult(_0x45cc72,null))['catch'](handleError(_0x45cc72,null));};exports[_0xf376('0x43')]=function(_0x2cf1ac,_0x202031){return respondWithRpcPromise(_0xf376('0x44'),_0x2cf1ac[_0xf376('0x15')],routingClient)[_0xf376('0x16')](respondWithResult(_0x202031,null))['catch'](handleError(_0x202031,null));};exports[_0xf376('0x45')]=function(_0x30ad70,_0x3cf19a){return respondWithRpcPromise(_0xf376('0x44'),_0x30ad70['query'],routingClient)[_0xf376('0x16')](findById(_0x30ad70[_0xf376('0x1c')]['id']))[_0xf376('0x16')](respondWithResult(_0x3cf19a,null))[_0xf376('0xb')](handleError(_0x3cf19a,null));};exports[_0xf376('0x46')]=function(_0x51d481,_0x3043a3){return respondWithRpcPromise(_0xf376('0x47'),_0x51d481[_0xf376('0x15')],routingClient)[_0xf376('0x16')](respondWithResult(_0x3043a3,null))[_0xf376('0xb')](handleError(_0x3043a3,null));};exports[_0xf376('0x48')]=function(_0x5a2142,_0x506c6d){return respondWithRpcPromise(_0xf376('0x47'),_0x5a2142[_0xf376('0x15')],routingClient)['then'](findById(_0x5a2142['params']['id']))['then'](respondWithResult(_0x506c6d,null))['catch'](handleError(_0x506c6d,null));};exports[_0xf376('0x49')]=function(_0x24a411,_0x17a437){return respondWithRpcPromise(_0xf376('0x4a'),_0x24a411[_0xf376('0x15')],routingClient)['then'](respondWithResult(_0x17a437,null))[_0xf376('0xb')](handleError(_0x17a437,null));};exports[_0xf376('0x4b')]=function(_0x459b72,_0x58f3cd){return respondWithRpcPromise(_0xf376('0x4a'),_0x459b72['query'],routingClient)[_0xf376('0x16')](findById(_0x459b72[_0xf376('0x1c')]['id']))[_0xf376('0x16')](respondWithResult(_0x58f3cd,null))[_0xf376('0xb')](handleError(_0x58f3cd,null));};exports[_0xf376('0x4c')]=function(_0x2ac836,_0x27d745){return respondWithRpcPromise('FaxAccounts',_0x2ac836[_0xf376('0x15')])[_0xf376('0x16')](respondWithResult(_0x27d745,null))['catch'](handleError(_0x27d745,null));};exports['chatQueuesWaitingInteractions']=function(_0x59e2f0,_0x510653){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x59e2f0['query'],routingClient)[_0xf376('0x16')](respondWithResult(_0x510653,null))['catch'](handleError(_0x510653,null));};exports[_0xf376('0x4d')]=function(_0x774fa,_0x3e7696){return respondWithRpcPromise('MailQueuesWaitingInteractions',_0x774fa['query'],routingClient)[_0xf376('0x16')](respondWithResult(_0x3e7696,null))[_0xf376('0xb')](handleError(_0x3e7696,null));};exports[_0xf376('0x4e')]=function(_0x3dd204,_0x1e0662){return respondWithRpcPromise(_0xf376('0x4f'),_0x3dd204[_0xf376('0x15')],routingClient)['then'](respondWithResult(_0x1e0662,null))[_0xf376('0xb')](handleError(_0x1e0662,null));};exports[_0xf376('0x50')]=function(_0x5730df,_0x1ae2e0){return respondWithRpcPromise(_0xf376('0x51'),_0x5730df[_0xf376('0x15')],routingClient)[_0xf376('0x16')](respondWithResult(_0x1ae2e0,null))['catch'](handleError(_0x1ae2e0,null));};exports[_0xf376('0x52')]=function(_0xa3c418,_0x2eb715){return respondWithRpcPromise(_0xf376('0x53'),_0xa3c418[_0xf376('0x15')],routingClient)['then'](respondWithResult(_0x2eb715,null))[_0xf376('0xb')](handleError(_0x2eb715,null));};exports[_0xf376('0x54')]=function(_0x56776d){return function(_0x324f0d,_0x2469d5){var _0x4716a9,_0x74499c;var _0x233fc6=_[_0xf376('0x55')](_0x56776d);var _0x118248=_0x56776d===_0xf376('0x56')?'Website':'Account';return db[_0x233fc6+_0xf376('0x57')][_0xf376('0x58')]({'raw':!![],'where':{'id':_0x324f0d[_0xf376('0x1c')]['id']}})[_0xf376('0x16')](function(_0x2f6d75){if(_[_0xf376('0x11')](_0x2f6d75)){throw new Error(_0x233fc6+_0xf376('0x59'));}_0x4716a9=_0x2f6d75;return db[_0x233fc6+_0xf376('0x5a')][_0xf376('0x58')]({'where':{'id':_0x324f0d[_0xf376('0x2b')][_0xf376('0x5b')]},'include':[{'model':db[_0x233fc6+_0xf376('0x5c')],'as':_0xf376('0x5c')},{'model':db[_0x233fc6+_0x118248],'as':_0xf376('0x5d')}]});})['then'](function(_0x5dd8b8){if(_['isNil'](_0x5dd8b8)){throw new Error(_0x233fc6+_0xf376('0x5e'));}_0x74499c=_0x5dd8b8;return _0x5dd8b8[_0xf376('0x5f')]({'read':0x0,'readAt':null,'UserId':null});})[_0xf376('0x16')](function(){var _0x319b9f={'uniqueid':_0x56776d+'.'+_0x74499c['id']+'.'+_0x74499c['Interaction']['id'],'FromUserId':_0x324f0d['user']['id'],'type':_0xf376('0x60')};_0x319b9f[_0x233fc6+_0xf376('0x61')]=_0x74499c['id'];_0x319b9f[_0x233fc6+_0xf376('0x62')]=_0x74499c['Interaction']['id'];_0x319b9f[_0xf376('0x63')+_0x233fc6+_0x118248+'Id']=_0x74499c['Account']['id'];_0x319b9f['To'+_0x233fc6+_0xf376('0x64')]=_0x4716a9['id'];return db[_0x233fc6+_0xf376('0x65')]['create'](_0x319b9f);})[_0xf376('0x16')](function(){return respondWithRpcPromise(_0xf376('0x66'),{'channel':_0x56776d,'interaction':_0x74499c[_0xf376('0x5c')],'message':_0x74499c,'account':_0x74499c[_0xf376('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf376('0x60'),'appdata':_0x4716a9[_0xf376('0xf')]+','+(_0x74499c[_0xf376('0x5d')][_0xf376('0x67')]||0x12c),'interval':_0xf376('0x68')}]},routingClient);})[_0xf376('0x16')](respondWithResult(_0x2469d5,null))[_0xf376('0xb')](handleError(_0x2469d5,null));};};exports['agentNotify']=function(_0x5c4aac,_0x1908f9){var _0x32e4fd,_0x557398;if(_['isNil'](_0x5c4aac[_0xf376('0x2b')][_0xf376('0x69')])){throw new Error(_0xf376('0x6a'));}var _0x45c0c9=_0x5c4aac['body'][_0xf376('0x69')];var _0x59165d=_[_0xf376('0x55')](_0x45c0c9);var _0x4a057e=_0x45c0c9==='chat'?_0xf376('0x6b'):'Account';return db['User']['findOne']({'raw':!![],'where':{'id':_0x5c4aac[_0xf376('0x1c')]['id'],'role':_0xf376('0x38')}})[_0xf376('0x16')](function(_0x512c42){if(_[_0xf376('0x11')](_0x512c42)){throw new Error('Agent\x20not\x20found');}_0x32e4fd=_0x512c42;return db[_0x59165d+'Message'][_0xf376('0x58')]({'where':{'id':_0x5c4aac['body'][_0xf376('0x5b')]},'include':[{'model':db[_0x59165d+'Interaction'],'as':'Interaction'},{'model':db[_0x59165d+_0x4a057e],'as':_0xf376('0x5d')}]});})[_0xf376('0x16')](function(_0x5ec5ba){if(_['isNil'](_0x5ec5ba)){throw new Error(_0x59165d+_0xf376('0x5e'));}_0x557398=_0x5ec5ba;return _0x5ec5ba['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xf376('0x16')](function(){var _0xa2505d={'uniqueid':_0x45c0c9+'.'+_0x557398['id']+'.'+_0x557398[_0xf376('0x5c')]['id'],'FromUserId':_0x5c4aac[_0xf376('0x2d')]['id'],'type':_0xf376('0x60'),'ToUserId':_0x32e4fd['id']};_0xa2505d[_0x59165d+_0xf376('0x61')]=_0x557398['id'];_0xa2505d[_0x59165d+_0xf376('0x62')]=_0x557398[_0xf376('0x5c')]['id'];_0xa2505d[_0xf376('0x63')+_0x59165d+_0x4a057e+'Id']=_0x557398[_0xf376('0x5d')]['id'];return db[_0x59165d+_0xf376('0x65')][_0xf376('0x6c')](_0xa2505d);})['then'](function(){return respondWithRpcPromise(_0xf376('0x66'),{'channel':_0x45c0c9,'interaction':_0x557398[_0xf376('0x5c')],'message':_0x557398,'account':_0x557398[_0xf376('0x5d')],'applications':[{'id':0x0,'priority':0x1,'app':_0xf376('0x38'),'appdata':_0x32e4fd[_0xf376('0xf')]+','+(_0x557398[_0xf376('0x5d')]['agentTransferTimeout']||0x12c),'interval':_0xf376('0x68')}]},routingClient);})['then'](respondWithResult(_0x1908f9,null))['catch'](handleError(_0x1908f9,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index a88dbd3..1c6d4d1 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 _0x8a9f=['show','post','put','update','delete','exports','multer','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x33ae4a,_0x5eaba3){var _0x13ed86=function(_0x416244){while(--_0x416244){_0x33ae4a['push'](_0x33ae4a['shift']());}};_0x13ed86(++_0x5eaba3);}(_0x8a9f,0x1c6));var _0xf8a9=function(_0x4bf264,_0x3be730){_0x4bf264=_0x4bf264-0x0;var _0x3c855f=_0x8a9f[_0x4bf264];return _0x3c855f;};'use strict';var multer=require(_0xf8a9('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf8a9('0x1'));var router=express[_0xf8a9('0x2')]();var auth=require(_0xf8a9('0x3'));var interaction=require(_0xf8a9('0x4'));var config=require(_0xf8a9('0x5'));var controller=require('./schedule.controller');router[_0xf8a9('0x6')]('/',auth[_0xf8a9('0x7')](),controller[_0xf8a9('0x8')]);router[_0xf8a9('0x6')](_0xf8a9('0x9'),auth['isAuthenticated'](),controller[_0xf8a9('0xa')]);router[_0xf8a9('0x6')]('/:id/run',auth[_0xf8a9('0x7')](),controller['run']);router[_0xf8a9('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0xf8a9('0xc')](_0xf8a9('0x9'),auth['isAuthenticated'](),controller[_0xf8a9('0xd')]);router[_0xf8a9('0xe')](_0xf8a9('0x9'),auth[_0xf8a9('0x7')](),controller['destroy']);module[_0xf8a9('0xf')]=router; \ No newline at end of file +var _0x819b=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller','get','isAuthenticated','index','show','/:id/run','run','post','create','put','update','/:id','destroy','exports','multer','util','connect-timeout'];(function(_0x3ff085,_0x27c92e){var _0x2b68c3=function(_0x37811e){while(--_0x37811e){_0x3ff085['push'](_0x3ff085['shift']());}};_0x2b68c3(++_0x27c92e);}(_0x819b,0x14d));var _0xb819=function(_0x1c6d4f,_0x37e880){_0x1c6d4f=_0x1c6d4f-0x0;var _0x2598af=_0x819b[_0x1c6d4f];return _0x2598af;};'use strict';var multer=require(_0xb819('0x0'));var util=require(_0xb819('0x1'));var path=require('path');var timeout=require(_0xb819('0x2'));var express=require('express');var router=express[_0xb819('0x3')]();var auth=require(_0xb819('0x4'));var interaction=require(_0xb819('0x5'));var config=require(_0xb819('0x6'));var controller=require(_0xb819('0x7'));router[_0xb819('0x8')]('/',auth[_0xb819('0x9')](),controller[_0xb819('0xa')]);router['get']('/:id',auth[_0xb819('0x9')](),controller[_0xb819('0xb')]);router[_0xb819('0x8')](_0xb819('0xc'),auth[_0xb819('0x9')](),controller[_0xb819('0xd')]);router[_0xb819('0xe')]('/',auth[_0xb819('0x9')](),controller[_0xb819('0xf')]);router[_0xb819('0x10')]('/:id',auth[_0xb819('0x9')](),controller[_0xb819('0x11')]);router['delete'](_0xb819('0x12'),auth[_0xb819('0x9')](),controller[_0xb819('0x13')]);module[_0xb819('0x14')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index a9815d5..1d6e324 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 _0xe714=['months','weeks','hours','minutes','days','csv','xlsx','custom','default','TEXT','sequelize','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters'];(function(_0x30c7c5,_0x168208){var _0x29e24e=function(_0x427d3e){while(--_0x427d3e){_0x30c7c5['push'](_0x30c7c5['shift']());}};_0x29e24e(++_0x168208);}(_0xe714,0xe2));var _0x4e71=function(_0x3781f2,_0x60f3f){_0x3781f2=_0x3781f2-0x0;var _0x40a777=_0xe714[_0x3781f2];return _0x40a777;};'use strict';var Sequelize=require(_0x4e71('0x0'));module['exports']={'name':{'type':Sequelize[_0x4e71('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x4e71('0x1')]},'active':{'type':Sequelize[_0x4e71('0x2')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4e71('0x1')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4e71('0x3')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4e71('0x4')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4e71('0x5')](_0x4e71('0x6'),_0x4e71('0x7'),_0x4e71('0x8'),_0x4e71('0x9'),'days',_0x4e71('0xa'),_0x4e71('0xb')),'allowNull':![],'defaultValue':_0x4e71('0xc')},'output':{'type':Sequelize['ENUM'](_0x4e71('0xd'),'pdf',_0x4e71('0xe')),'allowNull':![],'defaultValue':_0x4e71('0xd')},'type':{'type':Sequelize[_0x4e71('0x5')](_0x4e71('0xf'),_0x4e71('0x10')),'allowNull':![],'defaultValue':_0x4e71('0xf')},'sendMail':{'type':Sequelize[_0x4e71('0x2')],'defaultValue':![]},'email':{'type':Sequelize[_0x4e71('0x1')]},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize[_0x4e71('0x11')]},'sendIfEmpty':{'type':Sequelize[_0x4e71('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf006=['pdf','xlsx','custom','default','BOOLEAN','TEXT','STRING','DATE','ENUM','years','quarters','weeks','hours','minutes','days','csv'];(function(_0x275f22,_0x18d95c){var _0x5993ed=function(_0x2a1ff0){while(--_0x2a1ff0){_0x275f22['push'](_0x275f22['shift']());}};_0x5993ed(++_0x18d95c);}(_0xf006,0x146));var _0x6f00=function(_0x422068,_0x319ac3){_0x422068=_0x422068-0x0;var _0x32fc80=_0xf006[_0x422068];return _0x32fc80;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x6f00('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x6f00('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x6f00('0x0')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x6f00('0x1')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x6f00('0x2')](_0x6f00('0x3'),_0x6f00('0x4'),'months',_0x6f00('0x5'),'days',_0x6f00('0x6'),_0x6f00('0x7')),'allowNull':![],'defaultValue':_0x6f00('0x8')},'output':{'type':Sequelize[_0x6f00('0x2')](_0x6f00('0x9'),_0x6f00('0xa'),_0x6f00('0xb')),'allowNull':![],'defaultValue':_0x6f00('0x9')},'type':{'type':Sequelize[_0x6f00('0x2')](_0x6f00('0xc'),_0x6f00('0xd')),'allowNull':![],'defaultValue':_0x6f00('0xc')},'sendMail':{'type':Sequelize[_0x6f00('0xe')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x6f00('0xf')]},'bcc':{'type':Sequelize[_0x6f00('0xf')]},'sendIfEmpty':{'type':Sequelize[_0x6f00('0xe')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index b074f39..0261224 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 _0x5088=['query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','type','filter','options','findAll','rows','catch','keys','includeAll','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','name','params','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','save','update','destroy','then','get','Scheduler','UserProfileResource','error','stack','send','index','map','Schedule','rawAttributes','fieldName','key','model'];(function(_0x53a1dc,_0x20abd0){var _0x58304f=function(_0x45d518){while(--_0x45d518){_0x53a1dc['push'](_0x53a1dc['shift']());}};_0x58304f(++_0x20abd0);}(_0x5088,0xc3));var _0x8508=function(_0x121f61,_0x5174fc){_0x121f61=_0x121f61-0x0;var _0x393306=_0x5088[_0x121f61];return _0x393306;};'use strict';var pdf=require(_0x8508('0x0'));var emlformat=require(_0x8508('0x1'));var rimraf=require(_0x8508('0x2'));var zipdir=require(_0x8508('0x3'));var jsonpatch=require(_0x8508('0x4'));var rp=require(_0x8508('0x5'));var moment=require(_0x8508('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x8508('0x7'));var util=require(_0x8508('0x8'));var path=require('path');var sox=require(_0x8508('0x9'));var csv=require('to-csv');var ejs=require(_0x8508('0xa'));var fs=require('fs');var _=require(_0x8508('0xb'));var squel=require(_0x8508('0xc'));var crypto=require(_0x8508('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8508('0xe'));var toCsv=require(_0x8508('0xf'));var querystring=require('querystring');var Papa=require(_0x8508('0x10'));var Redis=require(_0x8508('0x11'));var authService=require(_0x8508('0x12'));var qs=require(_0x8508('0x13'));var as=require(_0x8508('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8508('0x15'))(_0x8508('0x16'));var utils=require(_0x8508('0x17'));var config=require(_0x8508('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a3e11,_0x10a18e){_0x10a18e=_0x10a18e||0xcc;return function(_0x291be7){if(_0x291be7){return _0x2a3e11[_0x8508('0x19')](_0x10a18e);}return _0x2a3e11[_0x8508('0x1a')](_0x10a18e)['end']();};}function respondWithResult(_0xe560dd,_0x1f9503){_0x1f9503=_0x1f9503||0xc8;return function(_0x5adb9c){if(_0x5adb9c){return _0xe560dd['status'](_0x1f9503)[_0x8508('0x1b')](_0x5adb9c);}};}function respondWithFilteredResult(_0x50f344,_0x4d7993){return function(_0x27b609){if(_0x27b609){var _0x3b9927=_0x27b609[_0x8508('0x1c')],_0x3d76f2=_0x4d7993[_0x8508('0x1d')],_0x450613=_0x4d7993[_0x8508('0x1d')]+_0x4d7993[_0x8508('0x1e')],_0x4256c2;if(_0x450613>=_0x3b9927){_0x450613=_0x3b9927;_0x4256c2=0xc8;}else{_0x4256c2=0xce;}_0x50f344[_0x8508('0x1a')](_0x4256c2);return _0x50f344['set'](_0x8508('0x1f'),_0x3d76f2+'-'+_0x450613+'/'+_0x3b9927)['json'](_0x27b609);}return null;};}function patchUpdates(_0x4b8448){return function(_0x2d0561){try{jsonpatch[_0x8508('0x20')](_0x2d0561,_0x4b8448,!![]);}catch(_0x4a5bd4){return BPromise[_0x8508('0x21')](_0x4a5bd4);}return _0x2d0561[_0x8508('0x22')]();};}function saveUpdates(_0x571a3f,_0x2c7b27){return function(_0x4517cf){if(_0x4517cf){return _0x4517cf[_0x8508('0x23')](_0x571a3f)['then'](function(_0x21672c){return _0x21672c;});}return null;};}function removeEntity(_0x34eed2,_0x389396){return function(_0x2668f6){if(_0x2668f6){return _0x2668f6[_0x8508('0x24')]()[_0x8508('0x25')](function(){var _0x34f383=_0x2668f6[_0x8508('0x26')]({'plain':!![]});var _0x190772=_0x8508('0x27');return db[_0x8508('0x28')][_0x8508('0x24')]({'where':{'type':_0x190772,'resourceId':_0x34f383['id']}})['then'](function(){return _0x2668f6;});})[_0x8508('0x25')](function(){_0x34eed2[_0x8508('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31163f,_0x19804e){return function(_0x40915f){if(!_0x40915f){_0x31163f['sendStatus'](0x194);}return _0x40915f;};}function handleError(_0x3257f6,_0x3eca31){_0x3eca31=_0x3eca31||0x1f4;return function(_0xb9e9bb){logger[_0x8508('0x29')](_0xb9e9bb[_0x8508('0x2a')]);if(_0xb9e9bb['name']){delete _0xb9e9bb['name'];}_0x3257f6[_0x8508('0x1a')](_0x3eca31)[_0x8508('0x2b')](_0xb9e9bb);};}exports[_0x8508('0x2c')]=function(_0x33d1cd,_0x15c7b0){var _0x2b1a56={},_0x7f8a2e={},_0xa43aa8={'count':0x0,'rows':[]};var _0x23cc8f=_[_0x8508('0x2d')](db[_0x8508('0x2e')][_0x8508('0x2f')],function(_0x192d6b){return{'name':_0x192d6b[_0x8508('0x30')],'type':_0x192d6b['type'][_0x8508('0x31')]};});_0x7f8a2e[_0x8508('0x32')]=_['map'](_0x23cc8f,'name');_0x7f8a2e[_0x8508('0x33')]=_['keys'](_0x33d1cd[_0x8508('0x33')]);_0x7f8a2e[_0x8508('0x34')]=_['intersection'](_0x7f8a2e[_0x8508('0x32')],_0x7f8a2e[_0x8508('0x33')]);_0x2b1a56[_0x8508('0x35')]=_[_0x8508('0x36')](_0x7f8a2e[_0x8508('0x32')],qs[_0x8508('0x37')](_0x33d1cd[_0x8508('0x33')][_0x8508('0x37')]));_0x2b1a56['attributes']=_0x2b1a56[_0x8508('0x35')]['length']?_0x2b1a56[_0x8508('0x35')]:_0x7f8a2e[_0x8508('0x32')];if(!_0x33d1cd[_0x8508('0x33')][_0x8508('0x38')](_0x8508('0x39'))){_0x2b1a56[_0x8508('0x1e')]=qs['limit'](_0x33d1cd[_0x8508('0x33')][_0x8508('0x1e')]);_0x2b1a56['offset']=qs[_0x8508('0x1d')](_0x33d1cd[_0x8508('0x33')]['offset']);}_0x2b1a56[_0x8508('0x3a')]=qs['sort'](_0x33d1cd['query'][_0x8508('0x3b')]);_0x2b1a56['where']=qs[_0x8508('0x34')](_[_0x8508('0x3c')](_0x33d1cd[_0x8508('0x33')],_0x7f8a2e['filters']));if(_0x33d1cd['query']['filter']){_0x2b1a56[_0x8508('0x3d')]=_[_0x8508('0x3e')](_0x2b1a56[_0x8508('0x3d')],{'$or':_[_0x8508('0x2d')](_0x23cc8f,function(_0x1be0d0){if(_0x1be0d0[_0x8508('0x3f')]!=='VIRTUAL'){var _0xad0b2e={};_0xad0b2e[_0x1be0d0['name']]={'$like':'%'+_0x33d1cd['query'][_0x8508('0x40')]+'%'};return _0xad0b2e;}})});}_0x2b1a56=_[_0x8508('0x3e')]({},_0x2b1a56,_0x33d1cd[_0x8508('0x41')]);var _0x5037b3={'where':_0x2b1a56[_0x8508('0x3d')]};return db[_0x8508('0x2e')][_0x8508('0x1c')](_0x5037b3)[_0x8508('0x25')](function(_0x200b32){_0xa43aa8[_0x8508('0x1c')]=_0x200b32;if(_0x33d1cd[_0x8508('0x33')]['includeAll']){_0x2b1a56['include']=[{'all':!![]}];}return db['Schedule'][_0x8508('0x42')](_0x2b1a56);})[_0x8508('0x25')](function(_0x3234cb){_0xa43aa8[_0x8508('0x43')]=_0x3234cb;return _0xa43aa8;})[_0x8508('0x25')](respondWithFilteredResult(_0x15c7b0,_0x2b1a56))[_0x8508('0x44')](handleError(_0x15c7b0,null));};exports['show']=function(_0x139e56,_0x457b05){var _0x29690c={'raw':![],'where':{'id':_0x139e56['params']['id']}},_0x5b9c1a={};_0x5b9c1a[_0x8508('0x32')]=_[_0x8508('0x45')](db[_0x8508('0x2e')][_0x8508('0x2f')]);_0x5b9c1a[_0x8508('0x33')]=_['keys'](_0x139e56[_0x8508('0x33')]);_0x5b9c1a[_0x8508('0x34')]=_[_0x8508('0x36')](_0x5b9c1a[_0x8508('0x32')],_0x5b9c1a[_0x8508('0x33')]);_0x29690c[_0x8508('0x35')]=_[_0x8508('0x36')](_0x5b9c1a[_0x8508('0x32')],qs[_0x8508('0x37')](_0x139e56[_0x8508('0x33')][_0x8508('0x37')]));_0x29690c[_0x8508('0x35')]=_0x29690c['attributes']['length']?_0x29690c[_0x8508('0x35')]:_0x5b9c1a[_0x8508('0x32')];if(_0x139e56['query'][_0x8508('0x46')]){_0x29690c[_0x8508('0x47')]=[{'all':!![]}];}_0x29690c=_[_0x8508('0x3e')]({},_0x29690c,_0x139e56[_0x8508('0x41')]);return db[_0x8508('0x2e')][_0x8508('0x48')](_0x29690c)['then'](handleEntityNotFound(_0x457b05,null))[_0x8508('0x25')](respondWithResult(_0x457b05,null))[_0x8508('0x44')](handleError(_0x457b05,null));};exports[_0x8508('0x49')]=function(_0x3ae551,_0x4a7448){return db[_0x8508('0x2e')][_0x8508('0x49')](_0x3ae551[_0x8508('0x4a')],{})[_0x8508('0x25')](function(_0x442b52){var _0x731563=_0x3ae551['user'][_0x8508('0x26')]({'plain':!![]});if(!_0x731563)throw new Error(_0x8508('0x4b'));if(_0x731563[_0x8508('0x4c')]==='user'){var _0x571ce1=_0x442b52[_0x8508('0x26')]({'plain':!![]});var _0x516d7a=_0x8508('0x27');return db['UserProfileSection'][_0x8508('0x48')]({'where':{'name':_0x516d7a,'userProfileId':_0x731563['userProfileId']},'raw':!![]})[_0x8508('0x25')](function(_0xe487ea){if(_0xe487ea&&_0xe487ea[_0x8508('0x4d')]===0x0){return db[_0x8508('0x28')][_0x8508('0x49')]({'name':_0x571ce1[_0x8508('0x4e')],'resourceId':_0x571ce1['id'],'type':_0xe487ea[_0x8508('0x4e')],'sectionId':_0xe487ea['id']},{})[_0x8508('0x25')](function(){return _0x442b52;});}else{return _0x442b52;}})['catch'](function(_0x38a692){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x38a692);throw _0x38a692;});}return _0x442b52;})[_0x8508('0x25')](respondWithResult(_0x4a7448,0xc9))[_0x8508('0x44')](handleError(_0x4a7448,null));};exports[_0x8508('0x23')]=function(_0x2ce31e,_0x46098b){if(_0x2ce31e['body']['id']){delete _0x2ce31e[_0x8508('0x4a')]['id'];}return db[_0x8508('0x2e')][_0x8508('0x48')]({'where':{'id':_0x2ce31e[_0x8508('0x4f')]['id']}})['then'](handleEntityNotFound(_0x46098b,null))['then'](saveUpdates(_0x2ce31e[_0x8508('0x4a')],null))[_0x8508('0x25')](respondWithResult(_0x46098b,null))['catch'](handleError(_0x46098b,null));};exports[_0x8508('0x24')]=function(_0x3f06fc,_0xf93ba5){return db[_0x8508('0x2e')][_0x8508('0x48')]({'where':{'id':_0x3f06fc['params']['id']}})[_0x8508('0x25')](handleEntityNotFound(_0xf93ba5,null))['then'](removeEntity(_0xf93ba5,null))[_0x8508('0x44')](handleError(_0xf93ba5,null));};exports[_0x8508('0x50')]=function(_0x3d6470,_0x52ae77,_0x41dcbc){var _0x57a0ca=require(_0x8508('0x51'));return db[_0x8508('0x2e')][_0x8508('0x48')]({'where':{'id':_0x3d6470[_0x8508('0x4f')]['id']},'raw':!![]})[_0x8508('0x25')](handleEntityNotFound(_0x52ae77,null))['then'](function(){_0x57a0ca[_0x8508('0x50')](_0x3d6470[_0x8508('0x4f')]['id']);})[_0x8508('0x25')](respondWithStatusCode(_0x52ae77,null))[_0x8508('0x44')](handleError(_0x52ae77,null));}; \ No newline at end of file +var _0x5d96=['stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','rows','catch','show','params','filters','create','Schedule','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','update','run','../../config/schedule','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','then','destroy','get','Scheduler','UserProfileResource','error'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x5d96,0x1cf));var _0x65d9=function(_0xd90039,_0x37c137){_0xd90039=_0xd90039-0x0;var _0x486dd9=_0x5d96[_0xd90039];return _0x486dd9;};'use strict';var pdf=require(_0x65d9('0x0'));var emlformat=require(_0x65d9('0x1'));var rimraf=require(_0x65d9('0x2'));var zipdir=require(_0x65d9('0x3'));var jsonpatch=require(_0x65d9('0x4'));var rp=require('request-promise');var moment=require(_0x65d9('0x5'));var BPromise=require(_0x65d9('0x6'));var Mustache=require('mustache');var util=require(_0x65d9('0x7'));var path=require(_0x65d9('0x8'));var sox=require(_0x65d9('0x9'));var csv=require(_0x65d9('0xa'));var ejs=require(_0x65d9('0xb'));var fs=require('fs');var _=require(_0x65d9('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x65d9('0xd'));var deskjs=require(_0x65d9('0xe'));var toCsv=require(_0x65d9('0xa'));var querystring=require(_0x65d9('0xf'));var Papa=require(_0x65d9('0x10'));var Redis=require('ioredis');var authService=require(_0x65d9('0x11'));var qs=require(_0x65d9('0x12'));var as=require(_0x65d9('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x65d9('0x14'));var utils=require(_0x65d9('0x15'));var config=require(_0x65d9('0x16'));var db=require(_0x65d9('0x17'))['db'];function respondWithStatusCode(_0x56a825,_0x87fef8){_0x87fef8=_0x87fef8||0xcc;return function(_0x50975c){if(_0x50975c){return _0x56a825[_0x65d9('0x18')](_0x87fef8);}return _0x56a825[_0x65d9('0x19')](_0x87fef8)[_0x65d9('0x1a')]();};}function respondWithResult(_0x30ea26,_0x1553e1){_0x1553e1=_0x1553e1||0xc8;return function(_0xb29362){if(_0xb29362){return _0x30ea26[_0x65d9('0x19')](_0x1553e1)[_0x65d9('0x1b')](_0xb29362);}};}function respondWithFilteredResult(_0x15e3af,_0x5155e7){return function(_0x54e438){if(_0x54e438){var _0x19cf6b=_0x54e438[_0x65d9('0x1c')],_0x1619ca=_0x5155e7[_0x65d9('0x1d')],_0x158715=_0x5155e7['offset']+_0x5155e7[_0x65d9('0x1e')],_0x3ce161;if(_0x158715>=_0x19cf6b){_0x158715=_0x19cf6b;_0x3ce161=0xc8;}else{_0x3ce161=0xce;}_0x15e3af[_0x65d9('0x19')](_0x3ce161);return _0x15e3af[_0x65d9('0x1f')](_0x65d9('0x20'),_0x1619ca+'-'+_0x158715+'/'+_0x19cf6b)[_0x65d9('0x1b')](_0x54e438);}return null;};}function patchUpdates(_0x4b3af6){return function(_0x4a9f05){try{jsonpatch[_0x65d9('0x21')](_0x4a9f05,_0x4b3af6,!![]);}catch(_0x2644bb){return BPromise['reject'](_0x2644bb);}return _0x4a9f05[_0x65d9('0x22')]();};}function saveUpdates(_0x2a380c,_0x5110fa){return function(_0x5a33bb){if(_0x5a33bb){return _0x5a33bb['update'](_0x2a380c)[_0x65d9('0x23')](function(_0x162a79){return _0x162a79;});}return null;};}function removeEntity(_0x52a155,_0x383b0a){return function(_0x513206){if(_0x513206){return _0x513206[_0x65d9('0x24')]()['then'](function(){var _0x3fd54c=_0x513206[_0x65d9('0x25')]({'plain':!![]});var _0x5a207e=_0x65d9('0x26');return db[_0x65d9('0x27')][_0x65d9('0x24')]({'where':{'type':_0x5a207e,'resourceId':_0x3fd54c['id']}})[_0x65d9('0x23')](function(){return _0x513206;});})[_0x65d9('0x23')](function(){_0x52a155[_0x65d9('0x19')](0xcc)[_0x65d9('0x1a')]();});}};}function handleEntityNotFound(_0x217ed2,_0x4c16ae){return function(_0x3ef76e){if(!_0x3ef76e){_0x217ed2[_0x65d9('0x18')](0x194);}return _0x3ef76e;};}function handleError(_0x453888,_0x4b0d07){_0x4b0d07=_0x4b0d07||0x1f4;return function(_0x290063){logger[_0x65d9('0x28')](_0x290063[_0x65d9('0x29')]);if(_0x290063['name']){delete _0x290063[_0x65d9('0x2a')];}_0x453888[_0x65d9('0x19')](_0x4b0d07)[_0x65d9('0x2b')](_0x290063);};}exports['index']=function(_0x569256,_0x388c5f){var _0x50e091={},_0x51f037={},_0x55ffb5={'count':0x0,'rows':[]};var _0x79b5d6=_['map'](db['Schedule'][_0x65d9('0x2c')],function(_0x2fcbd2){return{'name':_0x2fcbd2[_0x65d9('0x2d')],'type':_0x2fcbd2['type'][_0x65d9('0x2e')]};});_0x51f037[_0x65d9('0x2f')]=_[_0x65d9('0x30')](_0x79b5d6,'name');_0x51f037[_0x65d9('0x31')]=_[_0x65d9('0x32')](_0x569256[_0x65d9('0x31')]);_0x51f037['filters']=_['intersection'](_0x51f037[_0x65d9('0x2f')],_0x51f037['query']);_0x50e091[_0x65d9('0x33')]=_[_0x65d9('0x34')](_0x51f037[_0x65d9('0x2f')],qs[_0x65d9('0x35')](_0x569256['query']['fields']));_0x50e091[_0x65d9('0x33')]=_0x50e091[_0x65d9('0x33')][_0x65d9('0x36')]?_0x50e091['attributes']:_0x51f037[_0x65d9('0x2f')];if(!_0x569256[_0x65d9('0x31')][_0x65d9('0x37')](_0x65d9('0x38'))){_0x50e091[_0x65d9('0x1e')]=qs['limit'](_0x569256['query'][_0x65d9('0x1e')]);_0x50e091['offset']=qs[_0x65d9('0x1d')](_0x569256[_0x65d9('0x31')]['offset']);}_0x50e091['order']=qs[_0x65d9('0x39')](_0x569256['query'][_0x65d9('0x39')]);_0x50e091[_0x65d9('0x3a')]=qs['filters'](_[_0x65d9('0x3b')](_0x569256['query'],_0x51f037['filters']));if(_0x569256[_0x65d9('0x31')][_0x65d9('0x3c')]){_0x50e091[_0x65d9('0x3a')]=_[_0x65d9('0x3d')](_0x50e091['where'],{'$or':_[_0x65d9('0x30')](_0x79b5d6,function(_0x1dfa16){if(_0x1dfa16[_0x65d9('0x3e')]!==_0x65d9('0x3f')){var _0xd9959f={};_0xd9959f[_0x1dfa16[_0x65d9('0x2a')]]={'$like':'%'+_0x569256[_0x65d9('0x31')][_0x65d9('0x3c')]+'%'};return _0xd9959f;}})});}_0x50e091=_[_0x65d9('0x3d')]({},_0x50e091,_0x569256[_0x65d9('0x40')]);var _0x185101={'where':_0x50e091[_0x65d9('0x3a')]};return db['Schedule'][_0x65d9('0x1c')](_0x185101)[_0x65d9('0x23')](function(_0x28ef80){_0x55ffb5[_0x65d9('0x1c')]=_0x28ef80;if(_0x569256[_0x65d9('0x31')][_0x65d9('0x41')]){_0x50e091[_0x65d9('0x42')]=[{'all':!![]}];}return db['Schedule']['findAll'](_0x50e091);})[_0x65d9('0x23')](function(_0x2c77db){_0x55ffb5[_0x65d9('0x43')]=_0x2c77db;return _0x55ffb5;})[_0x65d9('0x23')](respondWithFilteredResult(_0x388c5f,_0x50e091))[_0x65d9('0x44')](handleError(_0x388c5f,null));};exports[_0x65d9('0x45')]=function(_0xf62323,_0x567d39){var _0x3182b3={'raw':![],'where':{'id':_0xf62323[_0x65d9('0x46')]['id']}},_0x2d56d4={};_0x2d56d4[_0x65d9('0x2f')]=_[_0x65d9('0x32')](db['Schedule']['rawAttributes']);_0x2d56d4[_0x65d9('0x31')]=_['keys'](_0xf62323[_0x65d9('0x31')]);_0x2d56d4[_0x65d9('0x47')]=_['intersection'](_0x2d56d4['model'],_0x2d56d4[_0x65d9('0x31')]);_0x3182b3[_0x65d9('0x33')]=_[_0x65d9('0x34')](_0x2d56d4[_0x65d9('0x2f')],qs[_0x65d9('0x35')](_0xf62323[_0x65d9('0x31')][_0x65d9('0x35')]));_0x3182b3[_0x65d9('0x33')]=_0x3182b3[_0x65d9('0x33')]['length']?_0x3182b3['attributes']:_0x2d56d4[_0x65d9('0x2f')];if(_0xf62323[_0x65d9('0x31')][_0x65d9('0x41')]){_0x3182b3[_0x65d9('0x42')]=[{'all':!![]}];}_0x3182b3=_[_0x65d9('0x3d')]({},_0x3182b3,_0xf62323[_0x65d9('0x40')]);return db['Schedule']['find'](_0x3182b3)[_0x65d9('0x23')](handleEntityNotFound(_0x567d39,null))[_0x65d9('0x23')](respondWithResult(_0x567d39,null))[_0x65d9('0x44')](handleError(_0x567d39,null));};exports[_0x65d9('0x48')]=function(_0x4c5a7f,_0x2cdbed){return db[_0x65d9('0x49')]['create'](_0x4c5a7f[_0x65d9('0x4a')],{})['then'](function(_0x532fa4){var _0x5cff5c=_0x4c5a7f[_0x65d9('0x4b')][_0x65d9('0x25')]({'plain':!![]});if(!_0x5cff5c)throw new Error(_0x65d9('0x4c'));if(_0x5cff5c[_0x65d9('0x4d')]===_0x65d9('0x4b')){var _0x4ebaed=_0x532fa4['get']({'plain':!![]});var _0x795919=_0x65d9('0x26');return db[_0x65d9('0x4e')][_0x65d9('0x4f')]({'where':{'name':_0x795919,'userProfileId':_0x5cff5c[_0x65d9('0x50')]},'raw':!![]})[_0x65d9('0x23')](function(_0x178c0c){if(_0x178c0c&&_0x178c0c['autoAssociation']===0x0){return db[_0x65d9('0x27')][_0x65d9('0x48')]({'name':_0x4ebaed[_0x65d9('0x2a')],'resourceId':_0x4ebaed['id'],'type':_0x178c0c[_0x65d9('0x2a')],'sectionId':_0x178c0c['id']},{})['then'](function(){return _0x532fa4;});}else{return _0x532fa4;}})[_0x65d9('0x44')](function(_0x48d503){logger[_0x65d9('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x48d503);throw _0x48d503;});}return _0x532fa4;})[_0x65d9('0x23')](respondWithResult(_0x2cdbed,0xc9))[_0x65d9('0x44')](handleError(_0x2cdbed,null));};exports[_0x65d9('0x51')]=function(_0x546d54,_0xf100e2){if(_0x546d54[_0x65d9('0x4a')]['id']){delete _0x546d54[_0x65d9('0x4a')]['id'];}return db[_0x65d9('0x49')]['find']({'where':{'id':_0x546d54[_0x65d9('0x46')]['id']}})['then'](handleEntityNotFound(_0xf100e2,null))[_0x65d9('0x23')](saveUpdates(_0x546d54[_0x65d9('0x4a')],null))['then'](respondWithResult(_0xf100e2,null))['catch'](handleError(_0xf100e2,null));};exports['destroy']=function(_0x2ef1c7,_0x2743b6){return db[_0x65d9('0x49')][_0x65d9('0x4f')]({'where':{'id':_0x2ef1c7['params']['id']}})[_0x65d9('0x23')](handleEntityNotFound(_0x2743b6,null))[_0x65d9('0x23')](removeEntity(_0x2743b6,null))[_0x65d9('0x44')](handleError(_0x2743b6,null));};exports[_0x65d9('0x52')]=function(_0x2f8374,_0x2d5540,_0x570e4f){var _0x11b18b=require(_0x65d9('0x53'));return db['Schedule'][_0x65d9('0x4f')]({'where':{'id':_0x2f8374[_0x65d9('0x46')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x2d5540,null))[_0x65d9('0x23')](function(){_0x11b18b[_0x65d9('0x52')](_0x2f8374['params']['id']);})[_0x65d9('0x23')](respondWithStatusCode(_0x2d5540,null))['catch'](handleError(_0x2d5540,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 9664148..5f902da 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 _0x20fb=['lodash','../../config/logger','api','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','tools_schedules'];(function(_0x34f3a1,_0x1962a7){var _0x414ab4=function(_0x1ac663){while(--_0x1ac663){_0x34f3a1['push'](_0x34f3a1['shift']());}};_0x414ab4(++_0x1962a7);}(_0x20fb,0x1ef));var _0xb20f=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x20fb[_0x13d07a];return _0x5ee0ee;};'use strict';var _=require(_0xb20f('0x0'));var util=require('util');var logger=require(_0xb20f('0x1'))(_0xb20f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb20f('0x3'));var config=require(_0xb20f('0x4'));var attributes=require(_0xb20f('0x5'));module[_0xb20f('0x6')]=function(_0xceea34,_0x34eb75){return _0xceea34['define'](_0xb20f('0x7'),attributes,{'tableName':_0xb20f('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7ee1=['rimraf','../../config/environment','exports','Schedule','tools_schedules','lodash','../../config/logger','moment','path'];(function(_0x333940,_0x2c6afe){var _0x1c6fe0=function(_0x346275){while(--_0x346275){_0x333940['push'](_0x333940['shift']());}};_0x1c6fe0(++_0x2c6afe);}(_0x7ee1,0xc2));var _0x17ee=function(_0x37ab40,_0xc6ce26){_0x37ab40=_0x37ab40-0x0;var _0x59d8f2=_0x7ee1[_0x37ab40];return _0x59d8f2;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var logger=require(_0x17ee('0x1'))('api');var moment=require(_0x17ee('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x17ee('0x3'));var rimraf=require(_0x17ee('0x4'));var config=require(_0x17ee('0x5'));var attributes=require('./schedule.attributes');module[_0x17ee('0x6')]=function(_0x51ee9b,_0x398e0f){return _0x51ee9b['define'](_0x17ee('0x7'),attributes,{'tableName':_0x17ee('0x8'),'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 fdb41da..d936fe0 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 _0x2070=['stringify','error','code','message','result','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x27a613,_0x27c97b){var _0x48b2cb=function(_0x1892a5){while(--_0x1892a5){_0x27a613['push'](_0x27a613['shift']());}};_0x48b2cb(++_0x27c97b);}(_0x2070,0xe9));var _0x0207=function(_0x294655,_0x395283){_0x294655=_0x294655-0x0;var _0x103d73=_0x2070[_0x294655];return _0x103d73;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x0207('0x0'));var fs=require('fs');var Redis=require(_0x0207('0x1'));var db=require(_0x0207('0x2'))['db'];var utils=require(_0x0207('0x3'));var logger=require('../../config/logger')(_0x0207('0x4'));var config=require(_0x0207('0x5'));var jayson=require(_0x0207('0x6'));var client=jayson[_0x0207('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a1469,_0x5253da,_0x415a98){return new BPromise(function(_0x45929f,_0x4d9d8f){return client[_0x0207('0x8')](_0x3a1469,_0x415a98)['then'](function(_0x34829c){logger[_0x0207('0x9')](_0x0207('0xa'),_0x5253da,'request\x20sent');logger[_0x0207('0xb')](_0x0207('0xc'),_0x5253da,_0x0207('0xd'),JSON[_0x0207('0xe')](_0x34829c));if(_0x34829c['error']){if(_0x34829c[_0x0207('0xf')][_0x0207('0x10')]===0x1f4){logger[_0x0207('0xf')](_0x0207('0xa'),_0x5253da,_0x34829c[_0x0207('0xf')]['message']);return _0x4d9d8f(_0x34829c[_0x0207('0xf')][_0x0207('0x11')]);}logger[_0x0207('0xf')](_0x0207('0xa'),_0x5253da,_0x34829c[_0x0207('0xf')][_0x0207('0x11')]);return _0x45929f(_0x34829c[_0x0207('0xf')][_0x0207('0x11')]);}else{logger['info'](_0x0207('0xa'),_0x5253da,_0x0207('0xd'));_0x45929f(_0x34829c[_0x0207('0x12')]['message']);}})['catch'](function(_0x28edef){logger[_0x0207('0xf')]('Schedule,\x20%s,\x20%s',_0x5253da,_0x28edef);_0x4d9d8f(_0x28edef);});});} \ No newline at end of file +var _0xb443=['../../config/environment','jayson/promise','client','http','request','then','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','Schedule,\x20%s,\x20%s','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2f5447,_0x2fc81e){var _0x9dd0f0=function(_0xdddc85){while(--_0xdddc85){_0x2f5447['push'](_0x2f5447['shift']());}};_0x9dd0f0(++_0x2fc81e);}(_0xb443,0x188));var _0x3b44=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xb443[_0x1694f5];return _0x5b4321;};'use strict';var _=require(_0x3b44('0x0'));var util=require('util');var moment=require(_0x3b44('0x1'));var BPromise=require(_0x3b44('0x2'));var rs=require(_0x3b44('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3b44('0x4'))['db'];var utils=require(_0x3b44('0x5'));var logger=require(_0x3b44('0x6'))(_0x3b44('0x7'));var config=require(_0x3b44('0x8'));var jayson=require(_0x3b44('0x9'));var client=jayson[_0x3b44('0xa')][_0x3b44('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5d4762,_0xa3068e,_0xec6452){return new BPromise(function(_0x215d7b,_0x9703f){return client[_0x3b44('0xc')](_0x5d4762,_0xec6452)[_0x3b44('0xd')](function(_0x5686fe){logger['info']('Schedule,\x20%s,\x20%s',_0xa3068e,'request\x20sent');logger['debug'](_0x3b44('0xe'),_0xa3068e,_0x3b44('0xf'),JSON['stringify'](_0x5686fe));if(_0x5686fe['error']){if(_0x5686fe[_0x3b44('0x10')]['code']===0x1f4){logger[_0x3b44('0x10')]('Schedule,\x20%s,\x20%s',_0xa3068e,_0x5686fe[_0x3b44('0x10')][_0x3b44('0x11')]);return _0x9703f(_0x5686fe[_0x3b44('0x10')]['message']);}logger['error'](_0x3b44('0x12'),_0xa3068e,_0x5686fe['error'][_0x3b44('0x11')]);return _0x215d7b(_0x5686fe[_0x3b44('0x10')][_0x3b44('0x11')]);}else{logger['info'](_0x3b44('0x12'),_0xa3068e,_0x3b44('0xf'));_0x215d7b(_0x5686fe[_0x3b44('0x13')][_0x3b44('0x11')]);}})['catch'](function(_0x2df16d){logger[_0x3b44('0x10')](_0x3b44('0x12'),_0xa3068e,_0x2df16d);_0x9703f(_0x2df16d);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 71a13c9..42c1808 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 _0x9fb4=['destroy','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated','/:id/download','post','put','update','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fb4,0x1cf));var _0x49fb=function(_0x30dfa4,_0x1a6275){_0x30dfa4=_0x30dfa4-0x0;var _0x185b37=_0x9fb4[_0x30dfa4];return _0x185b37;};'use strict';var multer=require(_0x49fb('0x0'));var util=require(_0x49fb('0x1'));var path=require(_0x49fb('0x2'));var timeout=require('connect-timeout');var express=require(_0x49fb('0x3'));var router=express[_0x49fb('0x4')]();var auth=require(_0x49fb('0x5'));var interaction=require(_0x49fb('0x6'));var config=require(_0x49fb('0x7'));var controller=require(_0x49fb('0x8'));router[_0x49fb('0x9')]('/',auth['isAuthenticated'](),controller[_0x49fb('0xa')]);router[_0x49fb('0x9')](_0x49fb('0xb'),auth['isAuthenticated'](),controller[_0x49fb('0xc')]);router[_0x49fb('0x9')](_0x49fb('0xd'),auth[_0x49fb('0xe')](),controller['show']);router['get'](_0x49fb('0xf'),auth[_0x49fb('0xe')](),controller['download']);router[_0x49fb('0x10')]('/',auth[_0x49fb('0xe')](),controller['create']);router[_0x49fb('0x11')](_0x49fb('0xd'),auth['isAuthenticated'](),controller[_0x49fb('0x12')]);router[_0x49fb('0x13')](_0x49fb('0xd'),auth[_0x49fb('0xe')](),controller[_0x49fb('0x14')]);module['exports']=router; \ No newline at end of file +var _0x5551=['download','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./screenRecording.controller','get','isAuthenticated','/describe','describe','show','/:id/download'];(function(_0x44e18b,_0x14b41f){var _0x363f72=function(_0x4591ba){while(--_0x4591ba){_0x44e18b['push'](_0x44e18b['shift']());}};_0x363f72(++_0x14b41f);}(_0x5551,0x179));var _0x1555=function(_0x3ad46e,_0x35db29){_0x3ad46e=_0x3ad46e-0x0;var _0x6665d1=_0x5551[_0x3ad46e];return _0x6665d1;};'use strict';var multer=require(_0x1555('0x0'));var util=require('util');var path=require(_0x1555('0x1'));var timeout=require(_0x1555('0x2'));var express=require(_0x1555('0x3'));var router=express[_0x1555('0x4')]();var auth=require(_0x1555('0x5'));var interaction=require(_0x1555('0x6'));var config=require('../../config/environment');var controller=require(_0x1555('0x7'));router[_0x1555('0x8')]('/',auth[_0x1555('0x9')](),controller['index']);router[_0x1555('0x8')](_0x1555('0xa'),auth[_0x1555('0x9')](),controller[_0x1555('0xb')]);router['get']('/:id',auth[_0x1555('0x9')](),controller[_0x1555('0xc')]);router['get'](_0x1555('0xd'),auth[_0x1555('0x9')](),controller[_0x1555('0xe')]);router[_0x1555('0xf')]('/',auth[_0x1555('0x9')](),controller[_0x1555('0x10')]);router[_0x1555('0x11')](_0x1555('0x12'),auth[_0x1555('0x9')](),controller[_0x1555('0x13')]);router[_0x1555('0x14')](_0x1555('0x12'),auth[_0x1555('0x9')](),controller[_0x1555('0x15')]);module[_0x1555('0x16')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 34a4cc3..7018f26 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 _0xdbf5=['getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','startedAt','duration','MM-DD-YYYY\x20HH:mm','toString','DATE','closedAt','createdAt','format','updatedAt','moment','exports','VIRTUAL'];(function(_0x211d20,_0x21e77c){var _0x784fb4=function(_0x4bee2c){while(--_0x4bee2c){_0x211d20['push'](_0x211d20['shift']());}};_0x784fb4(++_0x21e77c);}(_0xdbf5,0x18c));var _0x5dbf=function(_0x3272af,_0x31c2e9){_0x3272af=_0x3272af-0x0;var _0xfccd61=_0xdbf5[_0x3272af];return _0xfccd61;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x5dbf('0x0'));var path=require('path');var config=require('../../config/environment');module[_0x5dbf('0x1')]={'format':{'type':Sequelize[_0x5dbf('0x2')],'get':function(){return this[_0x5dbf('0x3')](_0x5dbf('0x4'))?path[_0x5dbf('0x5')](this[_0x5dbf('0x3')](_0x5dbf('0x4'))):undefined;}},'interactionid':{'type':Sequelize[_0x5dbf('0x6')]},'channel':{'type':Sequelize[_0x5dbf('0x6')]},'value':{'type':Sequelize[_0x5dbf('0x6')],'set':function(_0x209b7d){var _0x88128e=_0x209b7d[_0x5dbf('0x7')](/\\/g,'/');this['setDataValue'](_0x5dbf('0x4'),_0x88128e);}},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5dbf('0x8')],'set':function(_0x3bec50){this[_0x5dbf('0x9')](_0x5dbf('0xa'),moment()['subtract'](_0x3bec50,'ms'));this[_0x5dbf('0x9')]('closedAt',moment());this['setDataValue'](_0x5dbf('0xb'),_0x3bec50);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x5dbf('0xa')))['format'](_0x5dbf('0xc'))[_0x5dbf('0xd')]();}},'closedAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this[_0x5dbf('0x3')](_0x5dbf('0xf')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5dbf('0xd')]();}},'createdAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this['getDataValue'](_0x5dbf('0x10')))[_0x5dbf('0x11')](_0x5dbf('0xc'))[_0x5dbf('0xd')]();}},'updatedAt':{'type':Sequelize[_0x5dbf('0xe')],'get':function(){return moment(this[_0x5dbf('0x3')](_0x5dbf('0x12')))['format']('MM-DD-YYYY\x20HH:mm')[_0x5dbf('0xd')]();}}}; \ No newline at end of file +var _0x5fc3=['duration','startedAt','toString','closedAt','format','MM-DD-YYYY\x20HH:mm','DATE','updatedAt','sequelize','moment','../../config/environment','exports','VIRTUAL','getDataValue','value','STRING','replace','setDataValue','INTEGER','subtract'];(function(_0xd0238b,_0x1b6a7c){var _0x41a111=function(_0x15860a){while(--_0x15860a){_0xd0238b['push'](_0xd0238b['shift']());}};_0x41a111(++_0x1b6a7c);}(_0x5fc3,0xa8));var _0x35fc=function(_0x16337a,_0x4789a1){_0x16337a=_0x16337a-0x0;var _0x422365=_0x5fc3[_0x16337a];return _0x422365;};'use strict';var Sequelize=require(_0x35fc('0x0'));var moment=require(_0x35fc('0x1'));var path=require('path');var config=require(_0x35fc('0x2'));module[_0x35fc('0x3')]={'format':{'type':Sequelize[_0x35fc('0x4')],'get':function(){return this[_0x35fc('0x5')](_0x35fc('0x6'))?path['extname'](this[_0x35fc('0x5')](_0x35fc('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x35fc('0x7')]},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x19a0d1){var _0x508b32=_0x19a0d1[_0x35fc('0x8')](/\\/g,'/');this[_0x35fc('0x9')](_0x35fc('0x6'),_0x508b32);}},'rating':{'type':Sequelize[_0x35fc('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x35fc('0xa')],'set':function(_0xf9d3a6){this[_0x35fc('0x9')]('startedAt',moment()[_0x35fc('0xb')](_0xf9d3a6,'ms'));this[_0x35fc('0x9')]('closedAt',moment());this[_0x35fc('0x9')](_0x35fc('0xc'),_0xf9d3a6);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xd')))['format']('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0xf')))[_0x35fc('0x10')](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue']('createdAt'))['format'](_0x35fc('0x11'))[_0x35fc('0xe')]();}},'updatedAt':{'type':Sequelize[_0x35fc('0x12')],'get':function(){return moment(this[_0x35fc('0x5')](_0x35fc('0x13')))[_0x35fc('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x35fc('0xe')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 7218b78..ae3a609 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 _0xa1ad=['send','index','map','rawAttributes','fieldName','type','key','differenceBy','query','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','ScreenRecording','count','includeAll','include','findAll','rows','show','keys','find','catch','create','body','createdAt','params','describe','download','../../components/encryptor','uniqueid','value','join','root','server/files/screen_recordings','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','isNil','info','File:\x20\x22','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name'];(function(_0x4e170e,_0x207e58){var _0x338291=function(_0x4cb198){while(--_0x4cb198){_0x4e170e['push'](_0x4e170e['shift']());}};_0x338291(++_0x207e58);}(_0xa1ad,0x1e9));var _0xda1a=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0xa1ad[_0x51b661];return _0x5d1971;};'use strict';var pdf=require(_0xda1a('0x0'));var emlformat=require(_0xda1a('0x1'));var rimraf=require(_0xda1a('0x2'));var zipdir=require(_0xda1a('0x3'));var jsonpatch=require(_0xda1a('0x4'));var rp=require(_0xda1a('0x5'));var moment=require(_0xda1a('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xda1a('0x7'));var util=require(_0xda1a('0x8'));var path=require(_0xda1a('0x9'));var sox=require('sox');var csv=require(_0xda1a('0xa'));var ejs=require(_0xda1a('0xb'));var fs=require('fs');var _=require(_0xda1a('0xc'));var squel=require(_0xda1a('0xd'));var crypto=require(_0xda1a('0xe'));var jsforce=require(_0xda1a('0xf'));var deskjs=require(_0xda1a('0x10'));var toCsv=require(_0xda1a('0xa'));var querystring=require(_0xda1a('0x11'));var Papa=require('papaparse');var Redis=require(_0xda1a('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xda1a('0x13'));var as=require(_0xda1a('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xda1a('0x15'))('api');var utils=require(_0xda1a('0x16'));var config=require(_0xda1a('0x17'));var db=require(_0xda1a('0x18'))['db'];function respondWithStatusCode(_0x3ba43e,_0x47043b){_0x47043b=_0x47043b||0xcc;return function(_0x4b7cbc){if(_0x4b7cbc){return _0x3ba43e['sendStatus'](_0x47043b);}return _0x3ba43e[_0xda1a('0x19')](_0x47043b)[_0xda1a('0x1a')]();};}function respondWithResult(_0x563def,_0x511267){_0x511267=_0x511267||0xc8;return function(_0x30cf02){if(_0x30cf02){return _0x563def[_0xda1a('0x19')](_0x511267)[_0xda1a('0x1b')](_0x30cf02);}};}function respondWithFilteredResult(_0x910136,_0x596106){return function(_0x1407a7){if(_0x1407a7){var _0x5bad24=_0x1407a7['count'],_0x35eb81=_0x596106[_0xda1a('0x1c')],_0x51ead5=_0x596106['offset']+_0x596106[_0xda1a('0x1d')],_0x2e165b;if(_0x51ead5>=_0x5bad24){_0x51ead5=_0x5bad24;_0x2e165b=0xc8;}else{_0x2e165b=0xce;}_0x910136['status'](_0x2e165b);return _0x910136[_0xda1a('0x1e')](_0xda1a('0x1f'),_0x35eb81+'-'+_0x51ead5+'/'+_0x5bad24)[_0xda1a('0x1b')](_0x1407a7);}return null;};}function patchUpdates(_0x41101f){return function(_0x3cee48){try{jsonpatch[_0xda1a('0x20')](_0x3cee48,_0x41101f,!![]);}catch(_0x1aa4bb){return BPromise[_0xda1a('0x21')](_0x1aa4bb);}return _0x3cee48['save']();};}function saveUpdates(_0x2c7994,_0xdd36fa){return function(_0x2aea2f){if(_0x2aea2f){return _0x2aea2f[_0xda1a('0x22')](_0x2c7994)[_0xda1a('0x23')](function(_0x4b5ecd){return _0x4b5ecd;});}return null;};}function removeEntity(_0x40778a,_0x4a4b74){return function(_0x473f6c){if(_0x473f6c){return _0x473f6c[_0xda1a('0x24')]()[_0xda1a('0x23')](function(){_0x40778a[_0xda1a('0x19')](0xcc)[_0xda1a('0x1a')]();});}};}function handleEntityNotFound(_0x42116f,_0x1f58c7){return function(_0x305d8a){if(!_0x305d8a){_0x42116f[_0xda1a('0x25')](0x194);}return _0x305d8a;};}function handleError(_0x2c48d4,_0x543be3){_0x543be3=_0x543be3||0x1f4;return function(_0x58b29c){logger[_0xda1a('0x26')](_0x58b29c[_0xda1a('0x27')]);if(_0x58b29c[_0xda1a('0x28')]){delete _0x58b29c['name'];}_0x2c48d4[_0xda1a('0x19')](_0x543be3)[_0xda1a('0x29')](_0x58b29c);};}exports[_0xda1a('0x2a')]=function(_0x4bf776,_0x2764ca){var _0x357750={},_0x39dc62={},_0x16dddd={'count':0x0,'rows':[]};var _0x32492c=_[_0xda1a('0x2b')](db['ScreenRecording'][_0xda1a('0x2c')],function(_0x5d918a){return{'name':_0x5d918a[_0xda1a('0x2d')],'type':_0x5d918a[_0xda1a('0x2e')][_0xda1a('0x2f')]};});_0x39dc62['model']=_[_0xda1a('0x30')](_[_0xda1a('0x2b')](_0x32492c,_0xda1a('0x28')),['format']);_0x39dc62[_0xda1a('0x31')]=_['keys'](_0x4bf776[_0xda1a('0x31')]);_0x39dc62[_0xda1a('0x32')]=_[_0xda1a('0x33')](_0x39dc62[_0xda1a('0x34')],_0x39dc62[_0xda1a('0x31')]);_0x357750[_0xda1a('0x35')]=_[_0xda1a('0x33')](_0x39dc62[_0xda1a('0x34')],qs[_0xda1a('0x36')](_0x4bf776[_0xda1a('0x31')][_0xda1a('0x36')]));_0x357750['attributes']=_0x357750['attributes'][_0xda1a('0x37')]?_0x357750[_0xda1a('0x35')]:_0x39dc62[_0xda1a('0x34')];if(!_0x4bf776[_0xda1a('0x31')]['hasOwnProperty'](_0xda1a('0x38'))){_0x357750[_0xda1a('0x1d')]=qs[_0xda1a('0x1d')](_0x4bf776['query'][_0xda1a('0x1d')]);_0x357750[_0xda1a('0x1c')]=qs[_0xda1a('0x1c')](_0x4bf776['query']['offset']);}_0x357750[_0xda1a('0x39')]=qs[_0xda1a('0x3a')](_0x4bf776['query']['sort']);_0x357750[_0xda1a('0x3b')]=qs[_0xda1a('0x32')](_[_0xda1a('0x3c')](_0x4bf776[_0xda1a('0x31')],_0x39dc62[_0xda1a('0x32')]));if(_0x4bf776[_0xda1a('0x31')][_0xda1a('0x3d')]){_0x357750[_0xda1a('0x3b')]=_[_0xda1a('0x3e')](_0x357750['where'],{'$or':_[_0xda1a('0x2b')](_0x32492c,function(_0x1ea62e){if(_0x1ea62e[_0xda1a('0x2e')]!==_0xda1a('0x3f')){var _0x1fbfd7={};_0x1fbfd7[_0x1ea62e['name']]={'$like':'%'+_0x4bf776[_0xda1a('0x31')][_0xda1a('0x3d')]+'%'};return _0x1fbfd7;}})});}_0x357750=_[_0xda1a('0x3e')]({},_0x357750,_0x4bf776[_0xda1a('0x40')]);var _0x279bf8={'where':_0x357750[_0xda1a('0x3b')]};return db[_0xda1a('0x41')][_0xda1a('0x42')](_0x279bf8)[_0xda1a('0x23')](function(_0x523929){_0x16dddd[_0xda1a('0x42')]=_0x523929;if(_0x4bf776[_0xda1a('0x31')][_0xda1a('0x43')]){_0x357750[_0xda1a('0x44')]=[{'all':!![]}];}return db[_0xda1a('0x41')][_0xda1a('0x45')](_0x357750);})[_0xda1a('0x23')](function(_0x50f80f){_0x16dddd[_0xda1a('0x46')]=_0x50f80f;return _0x16dddd;})[_0xda1a('0x23')](respondWithFilteredResult(_0x2764ca,_0x357750))['catch'](handleError(_0x2764ca,null));};exports[_0xda1a('0x47')]=function(_0x6b84e5,_0x3a8f3d){var _0x523e78={'raw':![],'where':{'id':_0x6b84e5['params']['id']}},_0x48f96e={};_0x48f96e[_0xda1a('0x34')]=_[_0xda1a('0x48')](db['ScreenRecording']['rawAttributes']);_0x48f96e[_0xda1a('0x31')]=_['keys'](_0x6b84e5[_0xda1a('0x31')]);_0x48f96e[_0xda1a('0x32')]=_[_0xda1a('0x33')](_0x48f96e[_0xda1a('0x34')],_0x48f96e[_0xda1a('0x31')]);_0x523e78['attributes']=_[_0xda1a('0x33')](_0x48f96e[_0xda1a('0x34')],qs[_0xda1a('0x36')](_0x6b84e5[_0xda1a('0x31')]['fields']));_0x523e78[_0xda1a('0x35')]=_0x523e78['attributes']['length']?_0x523e78['attributes']:_0x48f96e[_0xda1a('0x34')];if(_0x6b84e5[_0xda1a('0x31')][_0xda1a('0x43')]){_0x523e78[_0xda1a('0x44')]=[{'all':!![]}];}_0x523e78=_[_0xda1a('0x3e')]({},_0x523e78,_0x6b84e5[_0xda1a('0x40')]);return db[_0xda1a('0x41')][_0xda1a('0x49')](_0x523e78)['then'](handleEntityNotFound(_0x3a8f3d,null))[_0xda1a('0x23')](respondWithResult(_0x3a8f3d,null))[_0xda1a('0x4a')](handleError(_0x3a8f3d,null));};exports[_0xda1a('0x4b')]=function(_0x4b89a6,_0x3c107f){return db[_0xda1a('0x41')][_0xda1a('0x4b')](_0x4b89a6[_0xda1a('0x4c')],{})[_0xda1a('0x23')](respondWithResult(_0x3c107f,0xc9))[_0xda1a('0x4a')](handleError(_0x3c107f,null));};exports[_0xda1a('0x22')]=function(_0x1c0a50,_0x5ea30e){if(_0x1c0a50[_0xda1a('0x4c')]['id']){delete _0x1c0a50['body']['id'];}delete _0x1c0a50[_0xda1a('0x4c')]['duration'];delete _0x1c0a50[_0xda1a('0x4c')][_0xda1a('0x4d')];delete _0x1c0a50[_0xda1a('0x4c')]['closedAt'];delete _0x1c0a50[_0xda1a('0x4c')]['value'];return db[_0xda1a('0x41')][_0xda1a('0x49')]({'where':{'id':_0x1c0a50[_0xda1a('0x4e')]['id']}})[_0xda1a('0x23')](handleEntityNotFound(_0x5ea30e,null))['then'](saveUpdates(_0x1c0a50[_0xda1a('0x4c')],null))[_0xda1a('0x23')](respondWithResult(_0x5ea30e,null))[_0xda1a('0x4a')](handleError(_0x5ea30e,null));};exports['describe']=function(_0x544e9e,_0x414931){return db[_0xda1a('0x41')][_0xda1a('0x4f')]()[_0xda1a('0x23')](respondWithResult(_0x414931,null))['catch'](handleError(_0x414931,null));};exports[_0xda1a('0x50')]=function(_0x505b6d,_0x4e21e0,_0x57a738){var _0x2e6b9d=require(_0xda1a('0x51'));var _0x3a6243=![];var _0x47b75f={};if(_0x505b6d[_0xda1a('0x31')][_0xda1a('0x2e')]&&_0x505b6d[_0xda1a('0x31')][_0xda1a('0x2e')]===_0xda1a('0x52')){_0x47b75f[_0xda1a('0x52')]=_0x505b6d['params']['id'];}else{_0x47b75f['id']=_0x505b6d[_0xda1a('0x4e')]['id'];}return db[_0xda1a('0x41')][_0xda1a('0x49')]({'where':_0x47b75f,'attributes':['id',_0xda1a('0x53')],'raw':!![]})[_0xda1a('0x23')](handleEntityNotFound(_0x4e21e0,null))['then'](function(_0x368c0d){if(_0x368c0d){var _0x5036bf=path[_0xda1a('0x54')](config[_0xda1a('0x55')],_0xda1a('0x56'),_0x368c0d[_0xda1a('0x53')]);var _0x462009=util['format'](_0xda1a('0x57'),_0x5036bf);if(fs[_0xda1a('0x58')](_0x462009)){_0x3a6243=!![];return _0x2e6b9d['decryptFile'](_0x462009,_0x5036bf,config[_0xda1a('0x59')][_0xda1a('0x5a')])['then'](function(){return _0x368c0d;});}return _0x368c0d;}})['then'](function(_0x4aef73){if(_0x4aef73){var _0x3642b6=path[_0xda1a('0x54')](config['root'],'server/files/screen_recordings',_0x4aef73[_0xda1a('0x53')]);if(!fs[_0xda1a('0x58')](_0x3642b6)){throw new db[(_0xda1a('0x5b'))][(_0xda1a('0x5c'))](_0xda1a('0x5d'));}if(_0x4aef73[_0xda1a('0x5e')]){return _0x4e21e0[_0xda1a('0x50')](_0x3642b6,_0x4aef73['filename']+path[_0xda1a('0x5f')](_0x3642b6),function(){if(_0x3a6243){fs[_0xda1a('0x60')](_0x3642b6);}});}else{return _0x4e21e0[_0xda1a('0x50')](_0x3642b6,function(_0x2bf028){if(_0x3a6243){fs['unlink'](_0x3642b6);}});}}})[_0xda1a('0x4a')](function(_0x4e0f8d){if(_0x4e0f8d[_0xda1a('0x61')]===_0xda1a('0x5d')){_0x4e21e0['status'](0x194)['send'](_0xda1a('0x62'));}else{return handleError(_0x4e21e0,null);}});};exports[_0xda1a('0x24')]=function(_0x301381,_0x8feee4){return db[_0xda1a('0x41')]['find']({'where':{'id':_0x301381['params']['id']}})[_0xda1a('0x23')](function(_0x368623){if(!_0x368623)throw new ReferenceError(_0xda1a('0x63'));return _0x368623;})['then'](function(_0x21716a){var _0x3b9915=path['join'](config[_0xda1a('0x55')],_0xda1a('0x56'),_0x21716a['value']);logger['info']('cancellazione\x20fisica\x20documento\x20%s',_0x3b9915);if(!_[_0xda1a('0x64')](_0x21716a[_0xda1a('0x53')])&&fs[_0xda1a('0x58')](_0x3b9915)){logger[_0xda1a('0x65')](_0xda1a('0x66')+_0x3b9915+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xda1a('0x67')](_0x3b9915);}_0x3b9915=_0x3b9915+_0xda1a('0x68');if(!_['isNil'](_0x21716a[_0xda1a('0x53')])&&fs[_0xda1a('0x58')](_0x3b9915)){logger[_0xda1a('0x65')](_0xda1a('0x66')+_0x3b9915+_0xda1a('0x69'));fs['unlinkSync'](_0x3b9915);}return _0x21716a;})[_0xda1a('0x23')](function(_0x2b26f3){if(!_0x2b26f3)throw new InternalError();return _0x2b26f3[_0xda1a('0x24')]();})['then'](function(){_0x8feee4[_0xda1a('0x19')](0xcc)[_0xda1a('0x1a')]();})[_0xda1a('0x4a')](handleError(_0x8feee4,null));}; \ No newline at end of file +var _0x7866=['closedAt','value','describe','download','../../components/encryptor','type','uniqueid','server/files/screen_recordings','%s.cypher','existsSync','decryptFile','secrets','recording','root','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','Entity\x20not\x20found','join','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','sendStatus','json','count','offset','limit','set','update','then','destroy','status','end','error','send','index','map','ScreenRecording','rawAttributes','model','differenceBy','name','format','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body'];(function(_0x32e01e,_0x5cdf41){var _0x1743ef=function(_0x211c03){while(--_0x211c03){_0x32e01e['push'](_0x32e01e['shift']());}};_0x1743ef(++_0x5cdf41);}(_0x7866,0x85));var _0x6786=function(_0x12fc8d,_0x19ee33){_0x12fc8d=_0x12fc8d-0x0;var _0x3f9d04=_0x7866[_0x12fc8d];return _0x3f9d04;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x6786('0x0'));var rimraf=require(_0x6786('0x1'));var zipdir=require(_0x6786('0x2'));var jsonpatch=require(_0x6786('0x3'));var rp=require(_0x6786('0x4'));var moment=require(_0x6786('0x5'));var BPromise=require(_0x6786('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6786('0x7'));var sox=require(_0x6786('0x8'));var csv=require(_0x6786('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6786('0xa'));var squel=require(_0x6786('0xb'));var crypto=require(_0x6786('0xc'));var jsforce=require(_0x6786('0xd'));var deskjs=require(_0x6786('0xe'));var toCsv=require(_0x6786('0x9'));var querystring=require(_0x6786('0xf'));var Papa=require(_0x6786('0x10'));var Redis=require(_0x6786('0x11'));var authService=require(_0x6786('0x12'));var qs=require(_0x6786('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6786('0x14'));var utils=require('../../config/utils');var config=require(_0x6786('0x15'));var db=require(_0x6786('0x16'))['db'];function respondWithStatusCode(_0x1c9c90,_0x1e5ca9){_0x1e5ca9=_0x1e5ca9||0xcc;return function(_0xab4765){if(_0xab4765){return _0x1c9c90[_0x6786('0x17')](_0x1e5ca9);}return _0x1c9c90['status'](_0x1e5ca9)['end']();};}function respondWithResult(_0x757454,_0x3a6524){_0x3a6524=_0x3a6524||0xc8;return function(_0x3d4e34){if(_0x3d4e34){return _0x757454['status'](_0x3a6524)[_0x6786('0x18')](_0x3d4e34);}};}function respondWithFilteredResult(_0x53b3c7,_0x36dc7c){return function(_0x592af8){if(_0x592af8){var _0x300a09=_0x592af8[_0x6786('0x19')],_0x3296f3=_0x36dc7c[_0x6786('0x1a')],_0x4ee3d1=_0x36dc7c['offset']+_0x36dc7c[_0x6786('0x1b')],_0x4fea3b;if(_0x4ee3d1>=_0x300a09){_0x4ee3d1=_0x300a09;_0x4fea3b=0xc8;}else{_0x4fea3b=0xce;}_0x53b3c7['status'](_0x4fea3b);return _0x53b3c7[_0x6786('0x1c')]('Content-Range',_0x3296f3+'-'+_0x4ee3d1+'/'+_0x300a09)[_0x6786('0x18')](_0x592af8);}return null;};}function patchUpdates(_0x3d569b){return function(_0x285f59){try{jsonpatch['apply'](_0x285f59,_0x3d569b,!![]);}catch(_0x12a17c){return BPromise['reject'](_0x12a17c);}return _0x285f59['save']();};}function saveUpdates(_0x22517c,_0x2e1cf6){return function(_0x398b8c){if(_0x398b8c){return _0x398b8c[_0x6786('0x1d')](_0x22517c)[_0x6786('0x1e')](function(_0xa36327){return _0xa36327;});}return null;};}function removeEntity(_0x4e091c,_0x39cab0){return function(_0x5b1ff8){if(_0x5b1ff8){return _0x5b1ff8[_0x6786('0x1f')]()[_0x6786('0x1e')](function(){_0x4e091c[_0x6786('0x20')](0xcc)[_0x6786('0x21')]();});}};}function handleEntityNotFound(_0x3539cd,_0x483abb){return function(_0x41aefb){if(!_0x41aefb){_0x3539cd['sendStatus'](0x194);}return _0x41aefb;};}function handleError(_0x343c4f,_0x1129be){_0x1129be=_0x1129be||0x1f4;return function(_0x2333d5){logger[_0x6786('0x22')](_0x2333d5['stack']);if(_0x2333d5['name']){delete _0x2333d5['name'];}_0x343c4f[_0x6786('0x20')](_0x1129be)[_0x6786('0x23')](_0x2333d5);};}exports[_0x6786('0x24')]=function(_0x396db1,_0x435787){var _0x869c2b={},_0x1e9ee2={},_0x1eddb3={'count':0x0,'rows':[]};var _0x2b3227=_[_0x6786('0x25')](db[_0x6786('0x26')][_0x6786('0x27')],function(_0x239fb0){return{'name':_0x239fb0['fieldName'],'type':_0x239fb0['type']['key']};});_0x1e9ee2[_0x6786('0x28')]=_[_0x6786('0x29')](_['map'](_0x2b3227,_0x6786('0x2a')),[_0x6786('0x2b')]);_0x1e9ee2[_0x6786('0x2c')]=_[_0x6786('0x2d')](_0x396db1[_0x6786('0x2c')]);_0x1e9ee2[_0x6786('0x2e')]=_[_0x6786('0x2f')](_0x1e9ee2['model'],_0x1e9ee2[_0x6786('0x2c')]);_0x869c2b[_0x6786('0x30')]=_[_0x6786('0x2f')](_0x1e9ee2['model'],qs['fields'](_0x396db1[_0x6786('0x2c')][_0x6786('0x31')]));_0x869c2b['attributes']=_0x869c2b['attributes']['length']?_0x869c2b[_0x6786('0x30')]:_0x1e9ee2[_0x6786('0x28')];if(!_0x396db1[_0x6786('0x2c')][_0x6786('0x32')](_0x6786('0x33'))){_0x869c2b[_0x6786('0x1b')]=qs[_0x6786('0x1b')](_0x396db1[_0x6786('0x2c')][_0x6786('0x1b')]);_0x869c2b[_0x6786('0x1a')]=qs[_0x6786('0x1a')](_0x396db1[_0x6786('0x2c')][_0x6786('0x1a')]);}_0x869c2b[_0x6786('0x34')]=qs[_0x6786('0x35')](_0x396db1[_0x6786('0x2c')][_0x6786('0x35')]);_0x869c2b[_0x6786('0x36')]=qs[_0x6786('0x2e')](_[_0x6786('0x37')](_0x396db1['query'],_0x1e9ee2[_0x6786('0x2e')]));if(_0x396db1[_0x6786('0x2c')][_0x6786('0x38')]){_0x869c2b[_0x6786('0x36')]=_[_0x6786('0x39')](_0x869c2b[_0x6786('0x36')],{'$or':_['map'](_0x2b3227,function(_0x181963){if(_0x181963['type']!==_0x6786('0x3a')){var _0x111b4c={};_0x111b4c[_0x181963[_0x6786('0x2a')]]={'$like':'%'+_0x396db1[_0x6786('0x2c')][_0x6786('0x38')]+'%'};return _0x111b4c;}})});}_0x869c2b=_['merge']({},_0x869c2b,_0x396db1[_0x6786('0x3b')]);var _0x26097a={'where':_0x869c2b[_0x6786('0x36')]};return db[_0x6786('0x26')]['count'](_0x26097a)[_0x6786('0x1e')](function(_0xc4809d){_0x1eddb3['count']=_0xc4809d;if(_0x396db1[_0x6786('0x2c')][_0x6786('0x3c')]){_0x869c2b[_0x6786('0x3d')]=[{'all':!![]}];}return db[_0x6786('0x26')][_0x6786('0x3e')](_0x869c2b);})[_0x6786('0x1e')](function(_0x31b503){_0x1eddb3[_0x6786('0x3f')]=_0x31b503;return _0x1eddb3;})[_0x6786('0x1e')](respondWithFilteredResult(_0x435787,_0x869c2b))[_0x6786('0x40')](handleError(_0x435787,null));};exports[_0x6786('0x41')]=function(_0x412f35,_0x3ea630){var _0x2bae39={'raw':![],'where':{'id':_0x412f35[_0x6786('0x42')]['id']}},_0x18899c={};_0x18899c[_0x6786('0x28')]=_[_0x6786('0x2d')](db[_0x6786('0x26')][_0x6786('0x27')]);_0x18899c['query']=_['keys'](_0x412f35['query']);_0x18899c[_0x6786('0x2e')]=_[_0x6786('0x2f')](_0x18899c[_0x6786('0x28')],_0x18899c[_0x6786('0x2c')]);_0x2bae39[_0x6786('0x30')]=_[_0x6786('0x2f')](_0x18899c['model'],qs['fields'](_0x412f35[_0x6786('0x2c')][_0x6786('0x31')]));_0x2bae39[_0x6786('0x30')]=_0x2bae39[_0x6786('0x30')][_0x6786('0x43')]?_0x2bae39[_0x6786('0x30')]:_0x18899c[_0x6786('0x28')];if(_0x412f35[_0x6786('0x2c')][_0x6786('0x3c')]){_0x2bae39['include']=[{'all':!![]}];}_0x2bae39=_['merge']({},_0x2bae39,_0x412f35[_0x6786('0x3b')]);return db[_0x6786('0x26')][_0x6786('0x44')](_0x2bae39)[_0x6786('0x1e')](handleEntityNotFound(_0x3ea630,null))[_0x6786('0x1e')](respondWithResult(_0x3ea630,null))[_0x6786('0x40')](handleError(_0x3ea630,null));};exports['create']=function(_0x46a2e7,_0x44901e){return db[_0x6786('0x26')][_0x6786('0x45')](_0x46a2e7[_0x6786('0x46')],{})['then'](respondWithResult(_0x44901e,0xc9))[_0x6786('0x40')](handleError(_0x44901e,null));};exports[_0x6786('0x1d')]=function(_0x2c322b,_0x26a643){if(_0x2c322b['body']['id']){delete _0x2c322b[_0x6786('0x46')]['id'];}delete _0x2c322b[_0x6786('0x46')]['duration'];delete _0x2c322b[_0x6786('0x46')]['createdAt'];delete _0x2c322b[_0x6786('0x46')][_0x6786('0x47')];delete _0x2c322b[_0x6786('0x46')][_0x6786('0x48')];return db[_0x6786('0x26')][_0x6786('0x44')]({'where':{'id':_0x2c322b[_0x6786('0x42')]['id']}})['then'](handleEntityNotFound(_0x26a643,null))[_0x6786('0x1e')](saveUpdates(_0x2c322b['body'],null))[_0x6786('0x1e')](respondWithResult(_0x26a643,null))[_0x6786('0x40')](handleError(_0x26a643,null));};exports[_0x6786('0x49')]=function(_0xe51a5b,_0x5d55b1){return db[_0x6786('0x26')]['describe']()['then'](respondWithResult(_0x5d55b1,null))[_0x6786('0x40')](handleError(_0x5d55b1,null));};exports[_0x6786('0x4a')]=function(_0x20819b,_0x7f64f2,_0x3d0960){var _0x576407=require(_0x6786('0x4b'));var _0x291381=![];var _0x416047={};if(_0x20819b[_0x6786('0x2c')]['type']&&_0x20819b[_0x6786('0x2c')][_0x6786('0x4c')]===_0x6786('0x4d')){_0x416047[_0x6786('0x4d')]=_0x20819b[_0x6786('0x42')]['id'];}else{_0x416047['id']=_0x20819b[_0x6786('0x42')]['id'];}return db['ScreenRecording'][_0x6786('0x44')]({'where':_0x416047,'attributes':['id',_0x6786('0x48')],'raw':!![]})[_0x6786('0x1e')](handleEntityNotFound(_0x7f64f2,null))[_0x6786('0x1e')](function(_0x513865){if(_0x513865){var _0x41496e=path['join'](config['root'],_0x6786('0x4e'),_0x513865[_0x6786('0x48')]);var _0x5c57d8=util[_0x6786('0x2b')](_0x6786('0x4f'),_0x41496e);if(fs[_0x6786('0x50')](_0x5c57d8)){_0x291381=!![];return _0x576407[_0x6786('0x51')](_0x5c57d8,_0x41496e,config[_0x6786('0x52')][_0x6786('0x53')])['then'](function(){return _0x513865;});}return _0x513865;}})['then'](function(_0x18c4b1){if(_0x18c4b1){var _0x564e11=path['join'](config[_0x6786('0x54')],'server/files/screen_recordings',_0x18c4b1['value']);if(!fs[_0x6786('0x50')](_0x564e11)){throw new db[(_0x6786('0x55'))][(_0x6786('0x56'))](_0x6786('0x57'));}if(_0x18c4b1[_0x6786('0x58')]){return _0x7f64f2[_0x6786('0x4a')](_0x564e11,_0x18c4b1[_0x6786('0x58')]+path[_0x6786('0x59')](_0x564e11),function(){if(_0x291381){fs[_0x6786('0x5a')](_0x564e11);}});}else{return _0x7f64f2[_0x6786('0x4a')](_0x564e11,function(_0x5a17ba){if(_0x291381){fs['unlink'](_0x564e11);}});}}})[_0x6786('0x40')](function(_0x17abc4){if(_0x17abc4[_0x6786('0x5b')]===_0x6786('0x57')){_0x7f64f2[_0x6786('0x20')](0x194)[_0x6786('0x23')](_0x6786('0x5c'));}else{return handleError(_0x7f64f2,null);}});};exports[_0x6786('0x1f')]=function(_0x25746d,_0x3bc2f0){return db[_0x6786('0x26')][_0x6786('0x44')]({'where':{'id':_0x25746d[_0x6786('0x42')]['id']}})[_0x6786('0x1e')](function(_0x4a5ea4){if(!_0x4a5ea4)throw new ReferenceError(_0x6786('0x5d'));return _0x4a5ea4;})[_0x6786('0x1e')](function(_0x2bce64){var _0x501bd5=path[_0x6786('0x5e')](config['root'],_0x6786('0x4e'),_0x2bce64[_0x6786('0x48')]);logger[_0x6786('0x5f')](_0x6786('0x60'),_0x501bd5);if(!_[_0x6786('0x61')](_0x2bce64[_0x6786('0x48')])&&fs['existsSync'](_0x501bd5)){logger[_0x6786('0x5f')](_0x6786('0x62')+_0x501bd5+_0x6786('0x63'));fs['unlinkSync'](_0x501bd5);}_0x501bd5=_0x501bd5+_0x6786('0x64');if(!_[_0x6786('0x61')](_0x2bce64[_0x6786('0x48')])&&fs[_0x6786('0x50')](_0x501bd5)){logger[_0x6786('0x5f')](_0x6786('0x62')+_0x501bd5+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x6786('0x65')](_0x501bd5);}return _0x2bce64;})[_0x6786('0x1e')](function(_0x15e415){if(!_0x15e415)throw new InternalError();return _0x15e415[_0x6786('0x1f')]();})[_0x6786('0x1e')](function(){_0x3bc2f0[_0x6786('0x20')](0xcc)[_0x6786('0x21')]();})[_0x6786('0x40')](handleError(_0x3bc2f0,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index a6bca24..55a0dc3 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 _0xc186=['rimraf','../../config/environment','exports','define','ScreenRecording','interactionid','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc186,0x1b3));var _0x6c18=function(_0x144da3,_0x4b7fca){_0x144da3=_0x144da3-0x0;var _0x3874f4=_0xc186[_0x144da3];return _0x3874f4;};'use strict';var _=require(_0x6c18('0x0'));var util=require(_0x6c18('0x1'));var logger=require(_0x6c18('0x2'))(_0x6c18('0x3'));var moment=require(_0x6c18('0x4'));var BPromise=require(_0x6c18('0x5'));var rp=require(_0x6c18('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c18('0x7'));var config=require(_0x6c18('0x8'));var attributes=require('./screenRecording.attributes');module[_0x6c18('0x9')]=function(_0x35d88c,_0x56f555){return _0x35d88c[_0x6c18('0xa')](_0x6c18('0xb'),attributes,{'tableName':'screen_recordings','paranoid':![],'indexes':[{'name':_0x6c18('0xc'),'fields':[_0x6c18('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xfb29=['../../config/logger','../../config/environment','./screenRecording.attributes','exports','define','screen_recordings','interactionid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb29,0x166));var _0x9fb2=function(_0x2e21dc,_0x4a317e){_0x2e21dc=_0x2e21dc-0x0;var _0x1c9a46=_0xfb29[_0x2e21dc];return _0x1c9a46;};'use strict';var _=require(_0x9fb2('0x0'));var util=require(_0x9fb2('0x1'));var logger=require(_0x9fb2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x9fb2('0x3'));var attributes=require(_0x9fb2('0x4'));module[_0x9fb2('0x5')]=function(_0x451617,_0x275a4f){return _0x451617[_0x9fb2('0x6')]('ScreenRecording',attributes,{'tableName':_0x9fb2('0x7'),'paranoid':![],'indexes':[{'name':_0x9fb2('0x8'),'fields':[_0x9fb2('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 29599fa..9ec601e 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(_0x41a348,_0x34987c){var _0x5e79f2=function(_0x3e8235){while(--_0x3e8235){_0x41a348['push'](_0x41a348['shift']());}};_0x5e79f2(++_0x34987c);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +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(_0x2b9fb9,_0x1b19d3){var _0x19669a=function(_0x449cc1){while(--_0x449cc1){_0x2b9fb9['push'](_0x2b9fb9['shift']());}};_0x19669a(++_0x1b19d3);}(_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 diff --git a/server/api/setting/index.js b/server/api/setting/index.js index dc6f547..5a436d6 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 _0xe66f=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','isAuthenticated','index','get','/:id/logo','getLogo','/:id/logo_login','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','root','server/files/images/logos/','format','%s%s','extname','originalname','single','file','addLogo','join','logologin','post','addLogoLogin','diskStorage','favicon','addFavicon','/:id','update'];(function(_0x18f72d,_0x5b26c5){var _0x252d08=function(_0x4965ac){while(--_0x4965ac){_0x18f72d['push'](_0x18f72d['shift']());}};_0x252d08(++_0x5b26c5);}(_0xe66f,0x112));var _0xfe66=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xe66f[_0x3d42d8];return _0x27fc41;};'use strict';var multer=require(_0xfe66('0x0'));var util=require(_0xfe66('0x1'));var path=require(_0xfe66('0x2'));var timeout=require(_0xfe66('0x3'));var express=require(_0xfe66('0x4'));var router=express[_0xfe66('0x5')]();var auth=require(_0xfe66('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xfe66('0x7'));var controller=require(_0xfe66('0x8'));router['get']('/',auth[_0xfe66('0x9')](),controller[_0xfe66('0xa')]);router[_0xfe66('0xb')]('/:id',controller['show']);router[_0xfe66('0xb')](_0xfe66('0xc'),controller[_0xfe66('0xd')]);router['get'](_0xfe66('0xe'),controller['getLogoLogin']);router['get']('/:id/gdpr',controller[_0xfe66('0xf')]);router[_0xfe66('0xb')](_0xfe66('0x10'),controller[_0xfe66('0x11')]);router['get'](_0xfe66('0x12'),controller[_0xfe66('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3658f4,_0x302990,_0x27b528){_0x27b528(null,path['join'](config[_0xfe66('0x14')],_0xfe66('0x15')));},'filename':function(_0x3ce747,_0x59b269,_0x149026){_0x149026(null,util[_0xfe66('0x16')](_0xfe66('0x17'),'logo',path[_0xfe66('0x18')](_0x59b269[_0xfe66('0x19')])));}})});router['post']('/:id/logo',upload[_0xfe66('0x1a')](_0xfe66('0x1b')),controller[_0xfe66('0x1c')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x2b71f3,_0x169327,_0x113c59){_0x113c59(null,path[_0xfe66('0x1d')](config['root'],_0xfe66('0x15')));},'filename':function(_0x152411,_0x49978e,_0xc246fc){_0xc246fc(null,util['format'](_0xfe66('0x17'),_0xfe66('0x1e'),path[_0xfe66('0x18')](_0x49978e[_0xfe66('0x19')])));}})});router[_0xfe66('0x1f')](_0xfe66('0xe'),upload[_0xfe66('0x1a')]('file'),controller[_0xfe66('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1104c6,_0x3d0919,_0x49a03c){_0x49a03c(null,path['join'](config[_0xfe66('0x14')],_0xfe66('0x15')));},'filename':function(_0x51d8a5,_0x59ec26,_0xcb7343){_0xcb7343(null,util[_0xfe66('0x16')](_0xfe66('0x17'),'preferred',path[_0xfe66('0x18')](_0x59ec26[_0xfe66('0x19')])));}})});router[_0xfe66('0x1f')](_0xfe66('0x10'),upload['single'](_0xfe66('0x1b')),controller['addPreferred']);var upload=multer({'storage':multer[_0xfe66('0x21')]({'destination':function(_0x37c589,_0x2b1ead,_0x3d6ac8){_0x3d6ac8(null,path[_0xfe66('0x1d')](config[_0xfe66('0x14')],_0xfe66('0x15')));},'filename':function(_0x37b9c3,_0xd8592f,_0x194435){_0x194435(null,util[_0xfe66('0x16')]('%s%s',_0xfe66('0x22'),path['extname'](_0xd8592f[_0xfe66('0x19')])));}})});router['post']('/:id/favicon',upload[_0xfe66('0x1a')](_0xfe66('0x1b')),controller[_0xfe66('0x23')]);router['put'](_0xfe66('0x24'),auth[_0xfe66('0x9')](),controller[_0xfe66('0x25')]);module[_0xfe66('0x26')]=router; \ No newline at end of file +var _0xd191=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./setting.controller','isAuthenticated','get','/:id','show','/:id/logo','getLogo','/:id/logo_login','/:id/gdpr','gdpr','/:id/preferred','getPreferred','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','extname','originalname','post','single','file','addLogo','logologin','addLogoLogin','preferred','addPreferred','/:id/favicon','put','multer'];(function(_0x473079,_0x4aa14b){var _0x138470=function(_0x4b68af){while(--_0x4b68af){_0x473079['push'](_0x473079['shift']());}};_0x138470(++_0x4aa14b);}(_0xd191,0x1ac));var _0x1d19=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd191[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1d19('0x0'));var util=require(_0x1d19('0x1'));var path=require(_0x1d19('0x2'));var timeout=require(_0x1d19('0x3'));var express=require(_0x1d19('0x4'));var router=express[_0x1d19('0x5')]();var auth=require(_0x1d19('0x6'));var interaction=require(_0x1d19('0x7'));var config=require('../../config/environment');var controller=require(_0x1d19('0x8'));router['get']('/',auth[_0x1d19('0x9')](),controller['index']);router[_0x1d19('0xa')](_0x1d19('0xb'),controller[_0x1d19('0xc')]);router[_0x1d19('0xa')](_0x1d19('0xd'),controller[_0x1d19('0xe')]);router['get'](_0x1d19('0xf'),controller['getLogoLogin']);router[_0x1d19('0xa')](_0x1d19('0x10'),controller[_0x1d19('0x11')]);router[_0x1d19('0xa')](_0x1d19('0x12'),controller[_0x1d19('0x13')]);router[_0x1d19('0xa')]('/:id/favicon',controller[_0x1d19('0x14')]);var upload=multer({'storage':multer[_0x1d19('0x15')]({'destination':function(_0x38c4c8,_0x5c4c6d,_0x1d3c23){_0x1d3c23(null,path[_0x1d19('0x16')](config[_0x1d19('0x17')],_0x1d19('0x18')));},'filename':function(_0x52eba8,_0x411681,_0x4e547a){_0x4e547a(null,util[_0x1d19('0x19')](_0x1d19('0x1a'),'logo',path[_0x1d19('0x1b')](_0x411681[_0x1d19('0x1c')])));}})});router[_0x1d19('0x1d')](_0x1d19('0xd'),upload[_0x1d19('0x1e')](_0x1d19('0x1f')),controller[_0x1d19('0x20')]);var upload=multer({'storage':multer[_0x1d19('0x15')]({'destination':function(_0x3844c0,_0x7332c5,_0x4c682c){_0x4c682c(null,path[_0x1d19('0x16')](config['root'],'server/files/images/logos/'));},'filename':function(_0x28a6c8,_0x47b013,_0x3f7127){_0x3f7127(null,util[_0x1d19('0x19')](_0x1d19('0x1a'),_0x1d19('0x21'),path[_0x1d19('0x1b')](_0x47b013[_0x1d19('0x1c')])));}})});router[_0x1d19('0x1d')](_0x1d19('0xf'),upload['single'](_0x1d19('0x1f')),controller[_0x1d19('0x22')]);var upload=multer({'storage':multer[_0x1d19('0x15')]({'destination':function(_0x2b6357,_0x57c989,_0x1ac588){_0x1ac588(null,path[_0x1d19('0x16')](config['root'],_0x1d19('0x18')));},'filename':function(_0x19ba58,_0x3ad7d8,_0x306e3d){_0x306e3d(null,util[_0x1d19('0x19')]('%s%s',_0x1d19('0x23'),path[_0x1d19('0x1b')](_0x3ad7d8[_0x1d19('0x1c')])));}})});router[_0x1d19('0x1d')]('/:id/preferred',upload['single'](_0x1d19('0x1f')),controller[_0x1d19('0x24')]);var upload=multer({'storage':multer[_0x1d19('0x15')]({'destination':function(_0x1024db,_0x46d705,_0x29c5a2){_0x29c5a2(null,path['join'](config['root'],'server/files/images/logos/'));},'filename':function(_0x1b6f36,_0x4bf7c7,_0xdd872b){_0xdd872b(null,util[_0x1d19('0x19')](_0x1d19('0x1a'),'favicon',path['extname'](_0x4bf7c7['originalname'])));}})});router['post'](_0x1d19('0x25'),upload[_0x1d19('0x1e')](_0x1d19('0x1f')),controller['addFavicon']);router[_0x1d19('0x26')]('/:id',auth[_0x1d19('0x9')](),controller['update']);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 b48da91..95d9c15 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 _0x9db8=['INTEGER','min_internal','min_mailbox','STRING','BOOLEAN','https://www.xcally.com/bar/phonebar/autoupdater.xml','alternate','sequelize'];(function(_0x133f29,_0x4ea93b){var _0x3e5f82=function(_0x8e7bfa){while(--_0x8e7bfa){_0x133f29['push'](_0x133f29['shift']());}};_0x3e5f82(++_0x4ea93b);}(_0x9db8,0x157));var _0x89db=function(_0x3e6647,_0x2c0d09){_0x3e6647=_0x3e6647-0x0;var _0x46bddd=_0x9db8[_0x3e6647];return _0x46bddd;};'use strict';var Sequelize=require(_0x89db('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0x89db('0x1')](0xb),'unique':_0x89db('0x2'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x89db('0x1')](0xb),'unique':_0x89db('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x89db('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x89db('0x4')],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize[_0x89db('0x4')]},'defaultLogo':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x89db('0x4')]},'defaultLoginLogo':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize['STRING']},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x89db('0x4')]},'turnusername':{'type':Sequelize[_0x89db('0x4')]},'turnpassword':{'type':Sequelize[_0x89db('0x4')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x89db('0x1')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':_0x89db('0x6')},'enableEmailPreview':{'type':Sequelize[_0x89db('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x89db('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x89db('0x4')],'defaultValue':_0x89db('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x89db('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x89db('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x89db('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize['INTEGER'],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x89db('0x4')]},'defaultFavicon':{'type':Sequelize[_0x89db('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x89db('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x2dc5=['STRING','https://www.xcally.com/bar/phonebar/autoupdater.xml','sequelize','exports','INTEGER','min_internal','BOOLEAN'];(function(_0x4f7d74,_0x20eeec){var _0x5047d=function(_0x308629){while(--_0x308629){_0x4f7d74['push'](_0x4f7d74['shift']());}};_0x5047d(++_0x20eeec);}(_0x2dc5,0x16e));var _0x52dc=function(_0x1de339,_0x166cef){_0x1de339=_0x1de339-0x0;var _0x3cd633=_0x2dc5[_0x1de339];return _0x3cd633;};'use strict';var Sequelize=require(_0x52dc('0x0'));module[_0x52dc('0x1')]={'min_internal':{'type':Sequelize[_0x52dc('0x2')](0xb),'unique':_0x52dc('0x3'),'defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x52dc('0x2')](0xb),'unique':'min_mailbox','defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0x52dc('0x2')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize['STRING'],'defaultValue':'/var/opt/motion2/server/files/sounds/converted'},'logo':{'type':Sequelize['STRING']},'defaultLogo':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x52dc('0x5')]},'defaultLoginLogo':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x52dc('0x5')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0x52dc('0x5')]},'turnaddr':{'type':Sequelize[_0x52dc('0x5')]},'turnusername':{'type':Sequelize[_0x52dc('0x5')]},'turnpassword':{'type':Sequelize[_0x52dc('0x5')]},'pageTitle':{'type':Sequelize[_0x52dc('0x5')]},'defaultPageTitle':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x52dc('0x5')],'defaultValue':_0x52dc('0x6')},'enableEmailPreview':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':![]},'split':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x52dc('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x52dc('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x52dc('0x5')],'defaultValue':'alternate'},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x52dc('0x5')]},'allowedLoginAttempts':{'type':Sequelize[_0x52dc('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x52dc('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x52dc('0x5')]},'defaultFavicon':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'googleSsoEnabled':{'type':Sequelize[_0x52dc('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index c5d2270..5efc1ec 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 _0x446d=['destroy','name','send','map','Setting','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','filters','filter','VIRTUAL','options','includeAll','include','findAll','rows','show','params','length','merge','find','update','body','file','filename','addLogoLogin','loginLogo','../../config/license/util','getLogo','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.png','upperFirst','custom','\x20not\x20found','getLogoLogin','server/files/images/logos','getLicense','defaultFavicon','download','addPreferred','getPreferred','default','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','html-pdf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','jayson/promise','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','info','request\x20sent','stringify','error','code','Setting,\x20%s,\x20%s','message','result','catch','sendStatus','status','end','json','count','limit','set','apply','reject','save','then'];(function(_0x3db285,_0x2ce3dc){var _0x287478=function(_0x146324){while(--_0x146324){_0x3db285['push'](_0x3db285['shift']());}};_0x287478(++_0x2ce3dc);}(_0x446d,0x1a4));var _0xd446=function(_0x8b2a7f,_0x5987a7){_0x8b2a7f=_0x8b2a7f-0x0;var _0x2116e4=_0x446d[_0x8b2a7f];return _0x2116e4;};'use strict';var pdf=require(_0xd446('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd446('0x1'));var jsonpatch=require(_0xd446('0x2'));var rp=require('request-promise');var moment=require(_0xd446('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xd446('0x4'));var util=require(_0xd446('0x5'));var path=require(_0xd446('0x6'));var sox=require(_0xd446('0x7'));var csv=require(_0xd446('0x8'));var ejs=require(_0xd446('0x9'));var fs=require('fs');var _=require(_0xd446('0xa'));var squel=require(_0xd446('0xb'));var crypto=require(_0xd446('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xd446('0xd'));var toCsv=require(_0xd446('0x8'));var querystring=require(_0xd446('0xe'));var Papa=require(_0xd446('0xf'));var Redis=require(_0xd446('0x10'));var authService=require(_0xd446('0x11'));var qs=require(_0xd446('0x12'));var as=require(_0xd446('0x13'));var hardwareService=require(_0xd446('0x14'));var logger=require('../../config/logger')(_0xd446('0x15'));var utils=require('../../config/utils');var config=require(_0xd446('0x16'));var db=require(_0xd446('0x17'))['db'];var jayson=require(_0xd446('0x18'));var client=jayson[_0xd446('0x19')][_0xd446('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x3ada2e,_0x32aa40,_0xa5ee8f){if(_0xa5ee8f){var _0x10bdd2=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x10bdd2[_0xd446('0x1b')](_0x32aa40)){return _0x3ada2e;}else{throw new db[(_0xd446('0x1c'))][(_0xd446('0x1d'))](_0xd446('0x1e'));}}else{return _0x3ada2e;}}function respondWithRpcPromise(_0x20edeb,_0x143641,_0x3cb4de,_0x2c434d){return new BPromise(function(_0x3a1c71,_0x1ec66d){var _0xddf53=_0x2c434d||client;return _0xddf53[_0xd446('0x1f')](_0x20edeb,_0x3cb4de)['then'](function(_0x4604bc){logger[_0xd446('0x20')]('Setting,\x20%s,\x20%s',_0x143641,_0xd446('0x21'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x143641,_0xd446('0x21'),JSON[_0xd446('0x22')](_0x4604bc));if(_0x4604bc[_0xd446('0x23')]){if(_0x4604bc['error'][_0xd446('0x24')]===0x1f4){logger['error'](_0xd446('0x25'),_0x143641,_0x4604bc[_0xd446('0x23')][_0xd446('0x26')]);return _0x1ec66d(_0x4604bc[_0xd446('0x23')][_0xd446('0x26')]);}logger[_0xd446('0x23')]('Setting,\x20%s,\x20%s',_0x143641,_0x4604bc[_0xd446('0x23')][_0xd446('0x26')]);return _0x3a1c71(_0x4604bc[_0xd446('0x23')][_0xd446('0x26')]);}else{logger[_0xd446('0x20')](_0xd446('0x25'),_0x143641,_0xd446('0x21'));_0x3a1c71(_0x4604bc[_0xd446('0x27')][_0xd446('0x26')]);}})[_0xd446('0x28')](function(_0x1c1b04){logger[_0xd446('0x23')](_0xd446('0x25'),_0x143641,_0x1c1b04);_0x1ec66d(_0x1c1b04);});});}function respondWithStatusCode(_0x45bba4,_0x935d27){_0x935d27=_0x935d27||0xcc;return function(_0x35faad){if(_0x35faad){return _0x45bba4[_0xd446('0x29')](_0x935d27);}return _0x45bba4[_0xd446('0x2a')](_0x935d27)[_0xd446('0x2b')]();};}function respondWithResult(_0x441f98,_0xe42a0d){_0xe42a0d=_0xe42a0d||0xc8;return function(_0x2fb0bc){if(_0x2fb0bc){return _0x441f98[_0xd446('0x2a')](_0xe42a0d)[_0xd446('0x2c')](_0x2fb0bc);}};}function respondWithFilteredResult(_0x12b201,_0x52171f){return function(_0x2b5447){if(_0x2b5447){var _0x3e0c9a=_0x2b5447[_0xd446('0x2d')],_0x31a6e1=_0x52171f['offset'],_0x3f6497=_0x52171f['offset']+_0x52171f[_0xd446('0x2e')],_0x1fdb67;if(_0x3f6497>=_0x3e0c9a){_0x3f6497=_0x3e0c9a;_0x1fdb67=0xc8;}else{_0x1fdb67=0xce;}_0x12b201[_0xd446('0x2a')](_0x1fdb67);return _0x12b201[_0xd446('0x2f')]('Content-Range',_0x31a6e1+'-'+_0x3f6497+'/'+_0x3e0c9a)['json'](_0x2b5447);}return null;};}function patchUpdates(_0x1855a6){return function(_0x43e232){try{jsonpatch[_0xd446('0x30')](_0x43e232,_0x1855a6,!![]);}catch(_0x50ed24){return BPromise[_0xd446('0x31')](_0x50ed24);}return _0x43e232[_0xd446('0x32')]();};}function saveUpdates(_0x2be625,_0x590533){return function(_0x18cb4e){if(_0x18cb4e){return _0x18cb4e['update'](_0x2be625)[_0xd446('0x33')](function(_0x7cd90d){return _0x7cd90d;});}return null;};}function removeEntity(_0x48ae3a,_0x9c7b5){return function(_0x2369fa){if(_0x2369fa){return _0x2369fa[_0xd446('0x34')]()[_0xd446('0x33')](function(){_0x48ae3a[_0xd446('0x2a')](0xcc)[_0xd446('0x2b')]();});}};}function handleEntityNotFound(_0x2f4e06,_0x8b085a){return function(_0x510ddf){if(!_0x510ddf){_0x2f4e06[_0xd446('0x29')](0x194);}return _0x510ddf;};}function handleError(_0x31f0b8,_0x43147f){_0x43147f=_0x43147f||0x1f4;return function(_0xfc0ff9){logger[_0xd446('0x23')](_0xfc0ff9['stack']);if(_0xfc0ff9[_0xd446('0x35')]){delete _0xfc0ff9[_0xd446('0x35')];}_0x31f0b8[_0xd446('0x2a')](_0x43147f)[_0xd446('0x36')](_0xfc0ff9);};}exports['index']=function(_0x3848ea,_0x2c01a9){var _0x144f9e={},_0x154fe3={},_0x2b6e92={'count':0x0,'rows':[]};var _0x50f0c7=_[_0xd446('0x37')](db[_0xd446('0x38')][_0xd446('0x39')],function(_0x4ec3f4){return{'name':_0x4ec3f4[_0xd446('0x3a')],'type':_0x4ec3f4[_0xd446('0x3b')][_0xd446('0x3c')]};});_0x154fe3[_0xd446('0x3d')]=_[_0xd446('0x37')](_0x50f0c7,_0xd446('0x35'));_0x154fe3[_0xd446('0x3e')]=_['keys'](_0x3848ea[_0xd446('0x3e')]);_0x154fe3['filters']=_[_0xd446('0x3f')](_0x154fe3['model'],_0x154fe3[_0xd446('0x3e')]);_0x144f9e[_0xd446('0x40')]=_[_0xd446('0x3f')](_0x154fe3['model'],qs[_0xd446('0x41')](_0x3848ea['query'][_0xd446('0x41')]));_0x144f9e[_0xd446('0x40')]=_0x144f9e[_0xd446('0x40')]['length']?_0x144f9e[_0xd446('0x40')]:_0x154fe3[_0xd446('0x3d')];if(!_0x3848ea[_0xd446('0x3e')][_0xd446('0x42')](_0xd446('0x43'))){_0x144f9e[_0xd446('0x2e')]=qs[_0xd446('0x2e')](_0x3848ea[_0xd446('0x3e')][_0xd446('0x2e')]);_0x144f9e[_0xd446('0x44')]=qs[_0xd446('0x44')](_0x3848ea[_0xd446('0x3e')][_0xd446('0x44')]);}_0x144f9e['order']=qs[_0xd446('0x45')](_0x3848ea[_0xd446('0x3e')][_0xd446('0x45')]);_0x144f9e[_0xd446('0x46')]=qs[_0xd446('0x47')](_['pick'](_0x3848ea[_0xd446('0x3e')],_0x154fe3[_0xd446('0x47')]));if(_0x3848ea[_0xd446('0x3e')][_0xd446('0x48')]){_0x144f9e[_0xd446('0x46')]=_['merge'](_0x144f9e['where'],{'$or':_['map'](_0x50f0c7,function(_0x421ee6){if(_0x421ee6[_0xd446('0x3b')]!==_0xd446('0x49')){var _0x3ee931={};_0x3ee931[_0x421ee6['name']]={'$like':'%'+_0x3848ea[_0xd446('0x3e')]['filter']+'%'};return _0x3ee931;}})});}_0x144f9e=_['merge']({},_0x144f9e,_0x3848ea[_0xd446('0x4a')]);var _0x3691b5={'where':_0x144f9e[_0xd446('0x46')]};return db[_0xd446('0x38')][_0xd446('0x2d')](_0x3691b5)[_0xd446('0x33')](function(_0x1bc288){_0x2b6e92[_0xd446('0x2d')]=_0x1bc288;if(_0x3848ea[_0xd446('0x3e')][_0xd446('0x4b')]){_0x144f9e[_0xd446('0x4c')]=[{'all':!![]}];}return db[_0xd446('0x38')][_0xd446('0x4d')](_0x144f9e);})[_0xd446('0x33')](function(_0x32ce7c){_0x2b6e92[_0xd446('0x4e')]=_0x32ce7c;return _0x2b6e92;})['then'](respondWithFilteredResult(_0x2c01a9,_0x144f9e))[_0xd446('0x28')](handleError(_0x2c01a9,null));};exports[_0xd446('0x4f')]=function(_0x288f77,_0x32cabf){var _0x1ff640={'raw':![],'where':{'id':_0x288f77[_0xd446('0x50')]['id']}},_0x2d9929={};_0x2d9929[_0xd446('0x3d')]=_['keys'](db[_0xd446('0x38')]['rawAttributes']);_0x2d9929[_0xd446('0x3e')]=_['keys'](_0x288f77[_0xd446('0x3e')]);_0x2d9929['filters']=_[_0xd446('0x3f')](_0x2d9929[_0xd446('0x3d')],_0x2d9929[_0xd446('0x3e')]);_0x1ff640[_0xd446('0x40')]=_['intersection'](_0x2d9929[_0xd446('0x3d')],qs[_0xd446('0x41')](_0x288f77[_0xd446('0x3e')][_0xd446('0x41')]));_0x1ff640['attributes']=_0x1ff640[_0xd446('0x40')][_0xd446('0x51')]?_0x1ff640['attributes']:_0x2d9929[_0xd446('0x3d')];if(_0x288f77[_0xd446('0x3e')]['includeAll']){_0x1ff640[_0xd446('0x4c')]=[{'all':!![]}];}_0x1ff640=_[_0xd446('0x52')]({},_0x1ff640,_0x288f77['options']);return db[_0xd446('0x38')][_0xd446('0x53')](_0x1ff640)['then'](handleEntityNotFound(_0x32cabf,null))[_0xd446('0x33')](respondWithResult(_0x32cabf,null))[_0xd446('0x28')](handleError(_0x32cabf,null));};exports[_0xd446('0x54')]=function(_0x886a9a,_0x516be5){if(_0x886a9a[_0xd446('0x55')]['id']){delete _0x886a9a['body']['id'];}return db[_0xd446('0x38')][_0xd446('0x53')]({'where':{'id':_0x886a9a[_0xd446('0x50')]['id']}})[_0xd446('0x33')](handleEntityNotFound(_0x516be5,null))[_0xd446('0x33')](saveUpdates(_0x886a9a[_0xd446('0x55')],null))[_0xd446('0x33')](respondWithResult(_0x516be5,null))[_0xd446('0x28')](handleError(_0x516be5,null));};exports['addLogo']=function(_0x4810b9,_0x525717,_0x28629e){if(_0x4810b9[_0xd446('0x56')]&&_0x4810b9['file'][_0xd446('0x57')]){_0x4810b9['body']['logo']=_0x4810b9[_0xd446('0x56')][_0xd446('0x57')];}return db['Setting'][_0xd446('0x53')]({'where':{'id':_0x4810b9[_0xd446('0x50')]['id']}})[_0xd446('0x33')](handleEntityNotFound(_0x525717,null))[_0xd446('0x33')](saveUpdates(_0x4810b9[_0xd446('0x55')],null))['then'](respondWithResult(_0x525717,null))[_0xd446('0x28')](handleError(_0x525717,null));};exports[_0xd446('0x58')]=function(_0x46aa80,_0x1b93ec,_0x4e8518){if(_0x46aa80[_0xd446('0x56')]&&_0x46aa80[_0xd446('0x56')][_0xd446('0x57')]){_0x46aa80['body'][_0xd446('0x59')]=_0x46aa80['file'][_0xd446('0x57')];}return db[_0xd446('0x38')][_0xd446('0x53')]({'where':{'id':_0x46aa80[_0xd446('0x50')]['id']}})[_0xd446('0x33')](handleEntityNotFound(_0x1b93ec,null))['then'](saveUpdates(_0x46aa80[_0xd446('0x55')],null))['then'](respondWithResult(_0x1b93ec,null))[_0xd446('0x28')](handleError(_0x1b93ec,null));};var utilLicense=require(_0xd446('0x5a'));exports[_0xd446('0x5b')]=function(_0x348dff,_0x8efdf8,_0x430b2e){var _0x5ea011='server/files/images/logos';var _0x36efd6={'custom':![]};return utilLicense['getLicense']()[_0xd446('0x33')](function(_0x12793e){if(_0x12793e){_0x36efd6=_0x12793e;}return db[_0xd446('0x38')][_0xd446('0x53')]({'where':{'id':_0x348dff[_0xd446('0x50')]['id']},'attributes':[_0xd446('0x5c'),'loginLogo',_0xd446('0x5d'),_0xd446('0x5e'),_0xd446('0x5f'),_0xd446('0x60'),_0xd446('0x61'),'defaultFavicon'],'raw':!![]});})[_0xd446('0x33')](handleEntityNotFound(_0x8efdf8,null))[_0xd446('0x33')](function(_0xcd0672){if(_0xcd0672){var _0x522102=_0xcd0672[_0xd446('0x5c')]&&fs[_0xd446('0x62')](path[_0xd446('0x63')](config[_0xd446('0x64')],_0x5ea011,_['toLower'](_0xcd0672['logo'])))?path[_0xd446('0x63')](config[_0xd446('0x64')],_0x5ea011,_['toLower'](_0xcd0672['logo'])):path[_0xd446('0x63')](config['root'],_0x5ea011,_[_0xd446('0x65')](_0xd446('0x66')));var _0x3bc907='default'+_[_0xd446('0x67')](_0xd446('0x5c'));if(_0xcd0672[_0x3bc907]||!_0x36efd6[_0xd446('0x68')]){_0x522102=path[_0xd446('0x63')](config['root'],_0x5ea011,_['toLower']('default_logo.png'));}if(!fs[_0xd446('0x62')](_0x522102)){throw new db[(_0xd446('0x1c'))][(_0xd446('0x1d'))](_[_0xd446('0x67')]('logo')+_0xd446('0x69'));}return _0x8efdf8['download'](_0x522102);}})[_0xd446('0x28')](handleError(_0x8efdf8,null));};var utilLicense=require('../../config/license/util');exports[_0xd446('0x6a')]=function(_0x3925d1,_0x4a1a24,_0x570d1d){var _0x14d0b5=_0xd446('0x6b');var _0x31df20={'custom':![]};return utilLicense[_0xd446('0x6c')]()['then'](function(_0x5ced90){if(_0x5ced90){_0x31df20=_0x5ced90;}return db[_0xd446('0x38')]['find']({'where':{'id':_0x3925d1[_0xd446('0x50')]['id']},'attributes':['logo','loginLogo',_0xd446('0x5d'),_0xd446('0x5e'),_0xd446('0x5f'),'defaultLoginLogo','defaultPreferred',_0xd446('0x6d')],'raw':!![]});})[_0xd446('0x33')](handleEntityNotFound(_0x4a1a24,null))[_0xd446('0x33')](function(_0xfad8bb){if(_0xfad8bb){var _0x4cd605=_0xfad8bb[_0xd446('0x59')]&&fs[_0xd446('0x62')](path[_0xd446('0x63')](config[_0xd446('0x64')],_0x14d0b5,_[_0xd446('0x65')](_0xfad8bb['loginLogo'])))?path[_0xd446('0x63')](config[_0xd446('0x64')],_0x14d0b5,_[_0xd446('0x65')](_0xfad8bb[_0xd446('0x59')])):path[_0xd446('0x63')](config[_0xd446('0x64')],_0x14d0b5,_[_0xd446('0x65')]('default_loginLogo.png'));var _0x4bcae7='default'+_[_0xd446('0x67')](_0xd446('0x59'));if(_0xfad8bb[_0x4bcae7]||!_0x31df20[_0xd446('0x68')]){_0x4cd605=path[_0xd446('0x63')](config['root'],_0x14d0b5,_[_0xd446('0x65')]('default_loginLogo.png'));}if(!fs['existsSync'](_0x4cd605)){throw new db[(_0xd446('0x1c'))][(_0xd446('0x1d'))](_[_0xd446('0x67')](_0xd446('0x59'))+'\x20not\x20found');}return _0x4a1a24[_0xd446('0x6e')](_0x4cd605);}})[_0xd446('0x28')](handleError(_0x4a1a24,null));};exports['gdpr']=function(_0x426736,_0x5ab000){return db['Setting'][_0xd446('0x53')]({'where':{'id':_0x426736[_0xd446('0x50')]['id']},'attributes':['securePassword']})['then'](respondWithResult(_0x5ab000,null))[_0xd446('0x28')](handleError(_0x5ab000,null));};exports[_0xd446('0x6f')]=function(_0x4874a5,_0x5f271a,_0x37e337){if(_0x4874a5[_0xd446('0x56')]&&_0x4874a5[_0xd446('0x56')][_0xd446('0x57')]){_0x4874a5[_0xd446('0x55')][_0xd446('0x5d')]=_0x4874a5['file'][_0xd446('0x57')];}return db[_0xd446('0x38')]['find']({'where':{'id':_0x4874a5[_0xd446('0x50')]['id']}})[_0xd446('0x33')](handleEntityNotFound(_0x5f271a,null))[_0xd446('0x33')](saveUpdates(_0x4874a5[_0xd446('0x55')],null))[_0xd446('0x33')](respondWithResult(_0x5f271a,null))['catch'](handleError(_0x5f271a,null));};var utilLicense=require('../../config/license/util');exports[_0xd446('0x70')]=function(_0x26ce64,_0x5a7211,_0x251ce2){var _0x2cb34b=_0xd446('0x6b');var _0x42b2bd={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x20d801){if(_0x20d801){_0x42b2bd=_0x20d801;}return db[_0xd446('0x38')][_0xd446('0x53')]({'where':{'id':_0x26ce64[_0xd446('0x50')]['id']},'attributes':[_0xd446('0x5c'),'loginLogo','preferred',_0xd446('0x5e'),_0xd446('0x5f'),'defaultLoginLogo',_0xd446('0x61'),_0xd446('0x6d')],'raw':!![]});})['then'](handleEntityNotFound(_0x5a7211,null))[_0xd446('0x33')](function(_0x2132af){if(_0x2132af){var _0x2cfc53=_0x2132af[_0xd446('0x5d')]&&fs[_0xd446('0x62')](path[_0xd446('0x63')](config[_0xd446('0x64')],_0x2cb34b,_['toLower'](_0x2132af[_0xd446('0x5d')])))?path['join'](config[_0xd446('0x64')],_0x2cb34b,_[_0xd446('0x65')](_0x2132af[_0xd446('0x5d')])):path[_0xd446('0x63')](config[_0xd446('0x64')],_0x2cb34b,_[_0xd446('0x65')]('default_preferred.png'));var _0x56dc57=_0xd446('0x71')+_['upperFirst'](_0xd446('0x5d'));if(_0x2132af[_0x56dc57]||!_0x42b2bd['custom']||!_0x42b2bd[_0xd446('0x5d')]){_0x2cfc53=path['join'](config['root'],_0x2cb34b,_[_0xd446('0x65')](_0xd446('0x72')));}if(!fs[_0xd446('0x62')](_0x2cfc53)){throw new db['Sequelize'][(_0xd446('0x1d'))](_[_0xd446('0x67')](_0xd446('0x5d'))+_0xd446('0x69'));}return _0x5a7211['download'](_0x2cfc53);}})[_0xd446('0x28')](handleError(_0x5a7211,null));};exports[_0xd446('0x73')]=function(_0xeb7aa7,_0x1290fa,_0x3f5012){if(_0xeb7aa7[_0xd446('0x56')]&&_0xeb7aa7[_0xd446('0x56')][_0xd446('0x57')]){_0xeb7aa7[_0xd446('0x55')]['favicon']=_0xeb7aa7[_0xd446('0x56')][_0xd446('0x57')];}return db[_0xd446('0x38')]['find']({'where':{'id':_0xeb7aa7['params']['id']}})[_0xd446('0x33')](handleEntityNotFound(_0x1290fa,null))[_0xd446('0x33')](saveUpdates(_0xeb7aa7[_0xd446('0x55')],null))['then'](respondWithResult(_0x1290fa,null))[_0xd446('0x28')](handleError(_0x1290fa,null));};var utilLicense=require(_0xd446('0x5a'));exports[_0xd446('0x74')]=function(_0x1fe75c,_0x414e62,_0x4924f2){var _0x2416fa='server/files/images/logos';var _0x47f90b={'custom':![]};return utilLicense[_0xd446('0x6c')]()['then'](function(_0x5dc8e8){if(_0x5dc8e8){_0x47f90b=_0x5dc8e8;}return db['Setting'][_0xd446('0x53')]({'where':{'id':_0x1fe75c[_0xd446('0x50')]['id']},'attributes':[_0xd446('0x5c'),_0xd446('0x59'),'preferred',_0xd446('0x5e'),_0xd446('0x5f'),'defaultLoginLogo',_0xd446('0x61'),_0xd446('0x6d')],'raw':!![]});})[_0xd446('0x33')](handleEntityNotFound(_0x414e62,null))[_0xd446('0x33')](function(_0x4f4db8){if(_0x4f4db8){var _0x54e2ff=_0x4f4db8[_0xd446('0x5e')]&&fs['existsSync'](path[_0xd446('0x63')](config[_0xd446('0x64')],_0x2416fa,_['toLower'](_0x4f4db8[_0xd446('0x5e')])))?path[_0xd446('0x63')](config[_0xd446('0x64')],_0x2416fa,_['toLower'](_0x4f4db8[_0xd446('0x5e')])):path[_0xd446('0x63')](config['root'],_0x2416fa,_[_0xd446('0x65')](_0xd446('0x75')));var _0x3ca2a5=_0xd446('0x71')+_['upperFirst']('favicon');if(_0x4f4db8[_0x3ca2a5]||!_0x47f90b['custom']){_0x54e2ff=path[_0xd446('0x63')](config[_0xd446('0x64')],_0x2416fa,_[_0xd446('0x65')]('default_favicon.ico'));}if(!fs[_0xd446('0x62')](_0x54e2ff)){throw new db[(_0xd446('0x1c'))]['ValidationError'](_[_0xd446('0x67')](_0xd446('0x5e'))+_0xd446('0x69'));}return _0x414e62[_0xd446('0x6e')](_0x54e2ff);}})[_0xd446('0x28')](handleError(_0x414e62,null));}; \ No newline at end of file +var _0x3780=['lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../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~!@#$%^&-_=+[{]}.','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','sendStatus','status','end','json','offset','set','Content-Range','apply','reject','update','stack','name','index','map','Setting','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','body','find','params','addLogo','file','filename','addLogoLogin','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultPreferred','existsSync','join','root','toLower','default_logo.png','custom','upperFirst','\x20not\x20found','download','../../config/license/util','getLogoLogin','loginLogo','default_loginLogo.png','gdpr','securePassword','addPreferred','defaultLoginLogo','default_preferred.png','default','addFavicon','getFavicon','defaultFavicon','default_favicon.ico','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','ejs'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x3780,0xe0));var _0x0378=function(_0xd02d0a,_0x141287){_0xd02d0a=_0xd02d0a-0x0;var _0x2114f2=_0x3780[_0xd02d0a];return _0x2114f2;};'use strict';var pdf=require(_0x0378('0x0'));var emlformat=require(_0x0378('0x1'));var rimraf=require(_0x0378('0x2'));var zipdir=require(_0x0378('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0378('0x4'));var BPromise=require(_0x0378('0x5'));var Mustache=require(_0x0378('0x6'));var util=require(_0x0378('0x7'));var path=require(_0x0378('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0378('0x9'));var fs=require('fs');var _=require(_0x0378('0xa'));var squel=require('squel');var crypto=require(_0x0378('0xb'));var jsforce=require(_0x0378('0xc'));var deskjs=require(_0x0378('0xd'));var toCsv=require('to-csv');var querystring=require(_0x0378('0xe'));var Papa=require(_0x0378('0xf'));var Redis=require('ioredis');var authService=require(_0x0378('0x10'));var qs=require(_0x0378('0x11'));var as=require(_0x0378('0x12'));var hardwareService=require(_0x0378('0x13'));var logger=require(_0x0378('0x14'))(_0x0378('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x0378('0x16'))['db'];var jayson=require(_0x0378('0x17'));var client=jayson[_0x0378('0x18')]['http']({'port':0x232a});function checkPasswordPattern(_0x12a867,_0x559f44,_0x301c5a){if(_0x301c5a){var _0x5d8251=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5d8251['test'](_0x559f44)){return _0x12a867;}else{throw new db[(_0x0378('0x19'))][(_0x0378('0x1a'))](_0x0378('0x1b'));}}else{return _0x12a867;}}function respondWithRpcPromise(_0x56a2f2,_0x2e8754,_0x69ed52,_0x7b2d07){return new BPromise(function(_0x35873d,_0xf9361){var _0x100ca4=_0x7b2d07||client;return _0x100ca4['request'](_0x56a2f2,_0x69ed52)[_0x0378('0x1c')](function(_0x1426ad){logger[_0x0378('0x1d')](_0x0378('0x1e'),_0x2e8754,_0x0378('0x1f'));logger[_0x0378('0x20')]('Setting,\x20%s,\x20%s,\x20%s',_0x2e8754,_0x0378('0x1f'),JSON[_0x0378('0x21')](_0x1426ad));if(_0x1426ad[_0x0378('0x22')]){if(_0x1426ad[_0x0378('0x22')][_0x0378('0x23')]===0x1f4){logger[_0x0378('0x22')](_0x0378('0x1e'),_0x2e8754,_0x1426ad['error']['message']);return _0xf9361(_0x1426ad['error'][_0x0378('0x24')]);}logger[_0x0378('0x22')](_0x0378('0x1e'),_0x2e8754,_0x1426ad[_0x0378('0x22')][_0x0378('0x24')]);return _0x35873d(_0x1426ad[_0x0378('0x22')][_0x0378('0x24')]);}else{logger[_0x0378('0x1d')](_0x0378('0x1e'),_0x2e8754,_0x0378('0x1f'));_0x35873d(_0x1426ad['result'][_0x0378('0x24')]);}})[_0x0378('0x25')](function(_0x3f183c){logger[_0x0378('0x22')](_0x0378('0x1e'),_0x2e8754,_0x3f183c);_0xf9361(_0x3f183c);});});}function respondWithStatusCode(_0xae3387,_0x2dac77){_0x2dac77=_0x2dac77||0xcc;return function(_0x3f1228){if(_0x3f1228){return _0xae3387[_0x0378('0x26')](_0x2dac77);}return _0xae3387[_0x0378('0x27')](_0x2dac77)[_0x0378('0x28')]();};}function respondWithResult(_0x3f38d7,_0x45ce69){_0x45ce69=_0x45ce69||0xc8;return function(_0x21a148){if(_0x21a148){return _0x3f38d7[_0x0378('0x27')](_0x45ce69)[_0x0378('0x29')](_0x21a148);}};}function respondWithFilteredResult(_0x53c6f9,_0x33a421){return function(_0x2ef845){if(_0x2ef845){var _0x3b4550=_0x2ef845['count'],_0x388d96=_0x33a421[_0x0378('0x2a')],_0xb24a14=_0x33a421[_0x0378('0x2a')]+_0x33a421['limit'],_0x322f4a;if(_0xb24a14>=_0x3b4550){_0xb24a14=_0x3b4550;_0x322f4a=0xc8;}else{_0x322f4a=0xce;}_0x53c6f9[_0x0378('0x27')](_0x322f4a);return _0x53c6f9[_0x0378('0x2b')](_0x0378('0x2c'),_0x388d96+'-'+_0xb24a14+'/'+_0x3b4550)[_0x0378('0x29')](_0x2ef845);}return null;};}function patchUpdates(_0x3acb65){return function(_0x1e384d){try{jsonpatch[_0x0378('0x2d')](_0x1e384d,_0x3acb65,!![]);}catch(_0x2a0ad2){return BPromise[_0x0378('0x2e')](_0x2a0ad2);}return _0x1e384d['save']();};}function saveUpdates(_0x4c9f22,_0x225616){return function(_0x165c1d){if(_0x165c1d){return _0x165c1d[_0x0378('0x2f')](_0x4c9f22)['then'](function(_0x50c373){return _0x50c373;});}return null;};}function removeEntity(_0x1c401e,_0x2a3f31){return function(_0x477dba){if(_0x477dba){return _0x477dba['destroy']()[_0x0378('0x1c')](function(){_0x1c401e[_0x0378('0x27')](0xcc)[_0x0378('0x28')]();});}};}function handleEntityNotFound(_0x457414,_0x25ecf9){return function(_0x137a7c){if(!_0x137a7c){_0x457414[_0x0378('0x26')](0x194);}return _0x137a7c;};}function handleError(_0x23d725,_0x4d7d4a){_0x4d7d4a=_0x4d7d4a||0x1f4;return function(_0x3d4c02){logger[_0x0378('0x22')](_0x3d4c02[_0x0378('0x30')]);if(_0x3d4c02['name']){delete _0x3d4c02[_0x0378('0x31')];}_0x23d725[_0x0378('0x27')](_0x4d7d4a)['send'](_0x3d4c02);};}exports[_0x0378('0x32')]=function(_0x42f33a,_0x49a9e9){var _0x192b9b={},_0x401eb9={},_0x58a204={'count':0x0,'rows':[]};var _0x3f83be=_[_0x0378('0x33')](db[_0x0378('0x34')][_0x0378('0x35')],function(_0x8c0695){return{'name':_0x8c0695[_0x0378('0x36')],'type':_0x8c0695['type'][_0x0378('0x37')]};});_0x401eb9['model']=_[_0x0378('0x33')](_0x3f83be,_0x0378('0x31'));_0x401eb9[_0x0378('0x38')]=_[_0x0378('0x39')](_0x42f33a[_0x0378('0x38')]);_0x401eb9[_0x0378('0x3a')]=_[_0x0378('0x3b')](_0x401eb9['model'],_0x401eb9[_0x0378('0x38')]);_0x192b9b[_0x0378('0x3c')]=_[_0x0378('0x3b')](_0x401eb9[_0x0378('0x3d')],qs['fields'](_0x42f33a['query'][_0x0378('0x3e')]));_0x192b9b[_0x0378('0x3c')]=_0x192b9b['attributes'][_0x0378('0x3f')]?_0x192b9b[_0x0378('0x3c')]:_0x401eb9[_0x0378('0x3d')];if(!_0x42f33a[_0x0378('0x38')][_0x0378('0x40')]('nolimit')){_0x192b9b[_0x0378('0x41')]=qs[_0x0378('0x41')](_0x42f33a[_0x0378('0x38')][_0x0378('0x41')]);_0x192b9b[_0x0378('0x2a')]=qs['offset'](_0x42f33a[_0x0378('0x38')][_0x0378('0x2a')]);}_0x192b9b[_0x0378('0x42')]=qs['sort'](_0x42f33a['query'][_0x0378('0x43')]);_0x192b9b[_0x0378('0x44')]=qs[_0x0378('0x3a')](_[_0x0378('0x45')](_0x42f33a[_0x0378('0x38')],_0x401eb9['filters']));if(_0x42f33a['query'][_0x0378('0x46')]){_0x192b9b['where']=_[_0x0378('0x47')](_0x192b9b[_0x0378('0x44')],{'$or':_[_0x0378('0x33')](_0x3f83be,function(_0x2f7aa7){if(_0x2f7aa7[_0x0378('0x48')]!==_0x0378('0x49')){var _0x392638={};_0x392638[_0x2f7aa7[_0x0378('0x31')]]={'$like':'%'+_0x42f33a[_0x0378('0x38')][_0x0378('0x46')]+'%'};return _0x392638;}})});}_0x192b9b=_[_0x0378('0x47')]({},_0x192b9b,_0x42f33a[_0x0378('0x4a')]);var _0x39afdb={'where':_0x192b9b[_0x0378('0x44')]};return db[_0x0378('0x34')][_0x0378('0x4b')](_0x39afdb)[_0x0378('0x1c')](function(_0x3ca03e){_0x58a204[_0x0378('0x4b')]=_0x3ca03e;if(_0x42f33a[_0x0378('0x38')]['includeAll']){_0x192b9b[_0x0378('0x4c')]=[{'all':!![]}];}return db[_0x0378('0x34')][_0x0378('0x4d')](_0x192b9b);})[_0x0378('0x1c')](function(_0x22d049){_0x58a204[_0x0378('0x4e')]=_0x22d049;return _0x58a204;})[_0x0378('0x1c')](respondWithFilteredResult(_0x49a9e9,_0x192b9b))[_0x0378('0x25')](handleError(_0x49a9e9,null));};exports['show']=function(_0x377a4a,_0x319803){var _0x278245={'raw':![],'where':{'id':_0x377a4a['params']['id']}},_0x47137d={};_0x47137d[_0x0378('0x3d')]=_[_0x0378('0x39')](db[_0x0378('0x34')]['rawAttributes']);_0x47137d['query']=_['keys'](_0x377a4a[_0x0378('0x38')]);_0x47137d[_0x0378('0x3a')]=_[_0x0378('0x3b')](_0x47137d['model'],_0x47137d[_0x0378('0x38')]);_0x278245[_0x0378('0x3c')]=_[_0x0378('0x3b')](_0x47137d['model'],qs[_0x0378('0x3e')](_0x377a4a[_0x0378('0x38')][_0x0378('0x3e')]));_0x278245[_0x0378('0x3c')]=_0x278245['attributes'][_0x0378('0x3f')]?_0x278245[_0x0378('0x3c')]:_0x47137d[_0x0378('0x3d')];if(_0x377a4a[_0x0378('0x38')]['includeAll']){_0x278245[_0x0378('0x4c')]=[{'all':!![]}];}_0x278245=_[_0x0378('0x47')]({},_0x278245,_0x377a4a[_0x0378('0x4a')]);return db['Setting']['find'](_0x278245)['then'](handleEntityNotFound(_0x319803,null))['then'](respondWithResult(_0x319803,null))[_0x0378('0x25')](handleError(_0x319803,null));};exports[_0x0378('0x2f')]=function(_0x27dcad,_0x16c5fa){if(_0x27dcad[_0x0378('0x4f')]['id']){delete _0x27dcad['body']['id'];}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x27dcad[_0x0378('0x51')]['id']}})[_0x0378('0x1c')](handleEntityNotFound(_0x16c5fa,null))[_0x0378('0x1c')](saveUpdates(_0x27dcad[_0x0378('0x4f')],null))[_0x0378('0x1c')](respondWithResult(_0x16c5fa,null))[_0x0378('0x25')](handleError(_0x16c5fa,null));};exports[_0x0378('0x52')]=function(_0x31b838,_0x4e55da,_0x3cd259){if(_0x31b838[_0x0378('0x53')]&&_0x31b838[_0x0378('0x53')][_0x0378('0x54')]){_0x31b838[_0x0378('0x4f')]['logo']=_0x31b838[_0x0378('0x53')][_0x0378('0x54')];}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x31b838[_0x0378('0x51')]['id']}})[_0x0378('0x1c')](handleEntityNotFound(_0x4e55da,null))[_0x0378('0x1c')](saveUpdates(_0x31b838[_0x0378('0x4f')],null))[_0x0378('0x1c')](respondWithResult(_0x4e55da,null))['catch'](handleError(_0x4e55da,null));};exports[_0x0378('0x55')]=function(_0x442c8d,_0x1d0302,_0xa784bd){if(_0x442c8d[_0x0378('0x53')]&&_0x442c8d[_0x0378('0x53')][_0x0378('0x54')]){_0x442c8d[_0x0378('0x4f')]['loginLogo']=_0x442c8d[_0x0378('0x53')][_0x0378('0x54')];}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x442c8d[_0x0378('0x51')]['id']}})[_0x0378('0x1c')](handleEntityNotFound(_0x1d0302,null))[_0x0378('0x1c')](saveUpdates(_0x442c8d['body'],null))[_0x0378('0x1c')](respondWithResult(_0x1d0302,null))[_0x0378('0x25')](handleError(_0x1d0302,null));};var utilLicense=require('../../config/license/util');exports[_0x0378('0x56')]=function(_0x749063,_0x2dad7d,_0x25477d){var _0x17e913=_0x0378('0x57');var _0x1a3bae={'custom':![]};return utilLicense[_0x0378('0x58')]()[_0x0378('0x1c')](function(_0x436ce1){if(_0x436ce1){_0x1a3bae=_0x436ce1;}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x749063[_0x0378('0x51')]['id']},'attributes':[_0x0378('0x59'),'loginLogo',_0x0378('0x5a'),_0x0378('0x5b'),_0x0378('0x5c'),'defaultLoginLogo',_0x0378('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x0378('0x1c')](handleEntityNotFound(_0x2dad7d,null))[_0x0378('0x1c')](function(_0x24b19a){if(_0x24b19a){var _0x4ec236=_0x24b19a['logo']&&fs[_0x0378('0x5e')](path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x17e913,_[_0x0378('0x61')](_0x24b19a[_0x0378('0x59')])))?path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x17e913,_[_0x0378('0x61')](_0x24b19a['logo'])):path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x17e913,_[_0x0378('0x61')](_0x0378('0x62')));var _0x2d0a43='default'+_['upperFirst'](_0x0378('0x59'));if(_0x24b19a[_0x2d0a43]||!_0x1a3bae[_0x0378('0x63')]){_0x4ec236=path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x17e913,_[_0x0378('0x61')](_0x0378('0x62')));}if(!fs['existsSync'](_0x4ec236)){throw new db['Sequelize'][(_0x0378('0x1a'))](_[_0x0378('0x64')]('logo')+_0x0378('0x65'));}return _0x2dad7d[_0x0378('0x66')](_0x4ec236);}})[_0x0378('0x25')](handleError(_0x2dad7d,null));};var utilLicense=require(_0x0378('0x67'));exports[_0x0378('0x68')]=function(_0x54671c,_0x590d9a,_0x87910b){var _0x5cdca3='server/files/images/logos';var _0x3fabbc={'custom':![]};return utilLicense[_0x0378('0x58')]()['then'](function(_0x11c2b6){if(_0x11c2b6){_0x3fabbc=_0x11c2b6;}return db['Setting'][_0x0378('0x50')]({'where':{'id':_0x54671c['params']['id']},'attributes':[_0x0378('0x59'),_0x0378('0x69'),'preferred',_0x0378('0x5b'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0x0378('0x1c')](handleEntityNotFound(_0x590d9a,null))[_0x0378('0x1c')](function(_0x2b69c7){if(_0x2b69c7){var _0x4105c0=_0x2b69c7[_0x0378('0x69')]&&fs[_0x0378('0x5e')](path['join'](config[_0x0378('0x60')],_0x5cdca3,_['toLower'](_0x2b69c7[_0x0378('0x69')])))?path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x5cdca3,_['toLower'](_0x2b69c7['loginLogo'])):path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x5cdca3,_[_0x0378('0x61')](_0x0378('0x6a')));var _0x35f596='default'+_[_0x0378('0x64')](_0x0378('0x69'));if(_0x2b69c7[_0x35f596]||!_0x3fabbc[_0x0378('0x63')]){_0x4105c0=path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x5cdca3,_[_0x0378('0x61')](_0x0378('0x6a')));}if(!fs['existsSync'](_0x4105c0)){throw new db[(_0x0378('0x19'))][(_0x0378('0x1a'))](_[_0x0378('0x64')](_0x0378('0x69'))+_0x0378('0x65'));}return _0x590d9a['download'](_0x4105c0);}})[_0x0378('0x25')](handleError(_0x590d9a,null));};exports[_0x0378('0x6b')]=function(_0x4f29b4,_0x3357f8){return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x4f29b4[_0x0378('0x51')]['id']},'attributes':[_0x0378('0x6c')]})['then'](respondWithResult(_0x3357f8,null))['catch'](handleError(_0x3357f8,null));};exports[_0x0378('0x6d')]=function(_0x4f8b69,_0x4a6f57,_0x3be499){if(_0x4f8b69[_0x0378('0x53')]&&_0x4f8b69[_0x0378('0x53')]['filename']){_0x4f8b69[_0x0378('0x4f')]['preferred']=_0x4f8b69['file'][_0x0378('0x54')];}return db[_0x0378('0x34')]['find']({'where':{'id':_0x4f8b69[_0x0378('0x51')]['id']}})[_0x0378('0x1c')](handleEntityNotFound(_0x4a6f57,null))[_0x0378('0x1c')](saveUpdates(_0x4f8b69[_0x0378('0x4f')],null))[_0x0378('0x1c')](respondWithResult(_0x4a6f57,null))[_0x0378('0x25')](handleError(_0x4a6f57,null));};var utilLicense=require(_0x0378('0x67'));exports['getPreferred']=function(_0x12223f,_0xb02239,_0x2d6fd){var _0x350020='server/files/images/logos';var _0x2b3142={'custom':![]};return utilLicense[_0x0378('0x58')]()[_0x0378('0x1c')](function(_0x46af82){if(_0x46af82){_0x2b3142=_0x46af82;}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x12223f['params']['id']},'attributes':[_0x0378('0x59'),_0x0378('0x69'),_0x0378('0x5a'),_0x0378('0x5b'),'defaultLogo',_0x0378('0x6e'),_0x0378('0x5d'),'defaultFavicon'],'raw':!![]});})[_0x0378('0x1c')](handleEntityNotFound(_0xb02239,null))[_0x0378('0x1c')](function(_0x4e398c){if(_0x4e398c){var _0x18e1d2=_0x4e398c[_0x0378('0x5a')]&&fs[_0x0378('0x5e')](path[_0x0378('0x5f')](config['root'],_0x350020,_[_0x0378('0x61')](_0x4e398c[_0x0378('0x5a')])))?path[_0x0378('0x5f')](config['root'],_0x350020,_[_0x0378('0x61')](_0x4e398c['preferred'])):path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x350020,_[_0x0378('0x61')](_0x0378('0x6f')));var _0x1ea287=_0x0378('0x70')+_[_0x0378('0x64')](_0x0378('0x5a'));if(_0x4e398c[_0x1ea287]||!_0x2b3142[_0x0378('0x63')]||!_0x2b3142[_0x0378('0x5a')]){_0x18e1d2=path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x350020,_['toLower'](_0x0378('0x6f')));}if(!fs[_0x0378('0x5e')](_0x18e1d2)){throw new db[(_0x0378('0x19'))][(_0x0378('0x1a'))](_[_0x0378('0x64')](_0x0378('0x5a'))+'\x20not\x20found');}return _0xb02239['download'](_0x18e1d2);}})[_0x0378('0x25')](handleError(_0xb02239,null));};exports[_0x0378('0x71')]=function(_0x59ec51,_0x46d905,_0xb53361){if(_0x59ec51[_0x0378('0x53')]&&_0x59ec51['file'][_0x0378('0x54')]){_0x59ec51[_0x0378('0x4f')]['favicon']=_0x59ec51['file'][_0x0378('0x54')];}return db[_0x0378('0x34')][_0x0378('0x50')]({'where':{'id':_0x59ec51['params']['id']}})['then'](handleEntityNotFound(_0x46d905,null))['then'](saveUpdates(_0x59ec51[_0x0378('0x4f')],null))[_0x0378('0x1c')](respondWithResult(_0x46d905,null))[_0x0378('0x25')](handleError(_0x46d905,null));};var utilLicense=require('../../config/license/util');exports[_0x0378('0x72')]=function(_0x3daad1,_0x7a63dc,_0x39484f){var _0x282f74=_0x0378('0x57');var _0x24b46a={'custom':![]};return utilLicense[_0x0378('0x58')]()['then'](function(_0x16bb3b){if(_0x16bb3b){_0x24b46a=_0x16bb3b;}return db[_0x0378('0x34')]['find']({'where':{'id':_0x3daad1['params']['id']},'attributes':['logo','loginLogo',_0x0378('0x5a'),_0x0378('0x5b'),'defaultLogo',_0x0378('0x6e'),_0x0378('0x5d'),_0x0378('0x73')],'raw':!![]});})[_0x0378('0x1c')](handleEntityNotFound(_0x7a63dc,null))['then'](function(_0x163412){if(_0x163412){var _0x4c9314=_0x163412['favicon']&&fs[_0x0378('0x5e')](path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x282f74,_['toLower'](_0x163412['favicon'])))?path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x282f74,_[_0x0378('0x61')](_0x163412['favicon'])):path['join'](config[_0x0378('0x60')],_0x282f74,_['toLower']('default_favicon.ico'));var _0x273213='default'+_[_0x0378('0x64')](_0x0378('0x5b'));if(_0x163412[_0x273213]||!_0x24b46a[_0x0378('0x63')]){_0x4c9314=path[_0x0378('0x5f')](config[_0x0378('0x60')],_0x282f74,_[_0x0378('0x61')](_0x0378('0x74')));}if(!fs['existsSync'](_0x4c9314)){throw new db[(_0x0378('0x19'))][(_0x0378('0x1a'))](_['upperFirst'](_0x0378('0x5b'))+_0x0378('0x65'));}return _0x7a63dc[_0x0378('0x66')](_0x4c9314);}})[_0x0378('0x25')](handleError(_0x7a63dc,null));}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index f7cf33a..b3c3327 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 _0x8581=['path','rimraf','./setting.attributes','exports','define','Setting','settings','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x5ccc17,_0x5364f8){var _0x11ddc4=function(_0x174c93){while(--_0x174c93){_0x5ccc17['push'](_0x5ccc17['shift']());}};_0x11ddc4(++_0x5364f8);}(_0x8581,0x1c7));var _0x1858=function(_0x6e8761,_0xaef231){_0x6e8761=_0x6e8761-0x0;var _0x4e2142=_0x8581[_0x6e8761];return _0x4e2142;};'use strict';var _=require(_0x1858('0x0'));var util=require(_0x1858('0x1'));var logger=require(_0x1858('0x2'))(_0x1858('0x3'));var moment=require(_0x1858('0x4'));var BPromise=require(_0x1858('0x5'));var rp=require(_0x1858('0x6'));var fs=require('fs');var path=require(_0x1858('0x7'));var rimraf=require(_0x1858('0x8'));var config=require('../../config/environment');var attributes=require(_0x1858('0x9'));module[_0x1858('0xa')]=function(_0x369ff5,_0x5b6af1){return _0x369ff5[_0x1858('0xb')](_0x1858('0xc'),attributes,{'tableName':_0x1858('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x102c=['./setting.attributes','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x537f13,_0x24ffe1){var _0x204d4a=function(_0x38293c){while(--_0x38293c){_0x537f13['push'](_0x537f13['shift']());}};_0x204d4a(++_0x24ffe1);}(_0x102c,0x16b));var _0xc102=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x102c[_0x5608a3];return _0x1ed50a;};'use strict';var _=require(_0xc102('0x0'));var util=require(_0xc102('0x1'));var logger=require(_0xc102('0x2'))(_0xc102('0x3'));var moment=require(_0xc102('0x4'));var BPromise=require(_0xc102('0x5'));var rp=require(_0xc102('0x6'));var fs=require('fs');var path=require(_0xc102('0x7'));var rimraf=require(_0xc102('0x8'));var config=require('../../config/environment');var attributes=require(_0xc102('0x9'));module[_0xc102('0xa')]=function(_0x463a6d,_0x37ca91){return _0x463a6d[_0xc102('0xb')]('Setting',attributes,{'tableName':'settings','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 7dccc85..11ba20c 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 _0xe44d=['debug','stringify','error','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x1e3aac,_0x5118ba){var _0x4e72d0=function(_0x15648c){while(--_0x15648c){_0x1e3aac['push'](_0x1e3aac['shift']());}};_0x4e72d0(++_0x5118ba);}(_0xe44d,0x15a));var _0xde44=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0xe44d[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xde44('0x0'));var util=require(_0xde44('0x1'));var moment=require('moment');var BPromise=require(_0xde44('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xde44('0x3'));var db=require(_0xde44('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde44('0x5'))('rpc');var config=require(_0xde44('0x6'));var jayson=require(_0xde44('0x7'));var client=jayson[_0xde44('0x8')][_0xde44('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xe6f334,_0x1a2fd5,_0x34f1dd){return new BPromise(function(_0x3fb2aa,_0x524949){return client['request'](_0xe6f334,_0x34f1dd)[_0xde44('0xa')](function(_0x5f87d0){logger[_0xde44('0xb')](_0xde44('0xc'),_0x1a2fd5,_0xde44('0xd'));logger[_0xde44('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x1a2fd5,_0xde44('0xd'),JSON[_0xde44('0xf')](_0x5f87d0));if(_0x5f87d0['error']){if(_0x5f87d0[_0xde44('0x10')]['code']===0x1f4){logger[_0xde44('0x10')](_0xde44('0xc'),_0x1a2fd5,_0x5f87d0['error']['message']);return _0x524949(_0x5f87d0[_0xde44('0x10')][_0xde44('0x11')]);}logger[_0xde44('0x10')](_0xde44('0xc'),_0x1a2fd5,_0x5f87d0['error'][_0xde44('0x11')]);return _0x3fb2aa(_0x5f87d0['error']['message']);}else{logger[_0xde44('0xb')](_0xde44('0xc'),_0x1a2fd5,_0xde44('0xd'));_0x3fb2aa(_0x5f87d0[_0xde44('0x12')][_0xde44('0x11')]);}})[_0xde44('0x13')](function(_0x2dd9df){logger[_0xde44('0x10')](_0xde44('0xc'),_0x1a2fd5,_0x2dd9df);_0x524949(_0x2dd9df);});});} \ No newline at end of file +var _0x4083=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','error','code','message','info','result','util','moment'];(function(_0x2bdb53,_0x3f1b2b){var _0x3ee68d=function(_0x396950){while(--_0x396950){_0x2bdb53['push'](_0x2bdb53['shift']());}};_0x3ee68d(++_0x3f1b2b);}(_0x4083,0x8e));var _0x3408=function(_0x1a625d,_0x1b1b97){_0x1a625d=_0x1a625d-0x0;var _0x597a23=_0x4083[_0x1a625d];return _0x597a23;};'use strict';var _=require('lodash');var util=require(_0x3408('0x0'));var moment=require(_0x3408('0x1'));var BPromise=require(_0x3408('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3408('0x3'));var db=require(_0x3408('0x4'))['db'];var utils=require(_0x3408('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3408('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x3408('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35e499,_0xba6841,_0x1c33e7){return new BPromise(function(_0x5d172d,_0x9de83f){return client[_0x3408('0x8')](_0x35e499,_0x1c33e7)['then'](function(_0x34c93d){logger['info'](_0x3408('0x9'),_0xba6841,_0x3408('0xa'));logger[_0x3408('0xb')](_0x3408('0xc'),_0xba6841,_0x3408('0xa'),JSON['stringify'](_0x34c93d));if(_0x34c93d[_0x3408('0xd')]){if(_0x34c93d[_0x3408('0xd')][_0x3408('0xe')]===0x1f4){logger[_0x3408('0xd')](_0x3408('0x9'),_0xba6841,_0x34c93d[_0x3408('0xd')][_0x3408('0xf')]);return _0x9de83f(_0x34c93d[_0x3408('0xd')][_0x3408('0xf')]);}logger[_0x3408('0xd')](_0x3408('0x9'),_0xba6841,_0x34c93d[_0x3408('0xd')][_0x3408('0xf')]);return _0x5d172d(_0x34c93d['error'][_0x3408('0xf')]);}else{logger[_0x3408('0x10')](_0x3408('0x9'),_0xba6841,_0x3408('0xa'));_0x5d172d(_0x34c93d[_0x3408('0x11')][_0x3408('0xf')]);}})['catch'](function(_0x3a9b1f){logger[_0x3408('0xd')](_0x3408('0x9'),_0xba6841,_0x3a9b1f);_0x9de83f(_0x3a9b1f);});});} \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index d4b474a..60f3b88 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 _0x95ae=['./smsAccount.controller','get','index','/describe','isAuthenticated','describe','show','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','/:id/status','statusGet','create','post','/:id/dispositions','notify','addApplications','/:id/send','send','status','/:id/users','addAgents','put','update','delete','/:id','removeAnswers','removeAgents','exports','multer','util','express','Router','../../components/auth/service'];(function(_0x171d44,_0x23686b){var _0x2c018c=function(_0x207405){while(--_0x207405){_0x171d44['push'](_0x171d44['shift']());}};_0x2c018c(++_0x23686b);}(_0x95ae,0xaa));var _0xe95a=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x95ae[_0x5f309e];return _0x487b5e;};'use strict';var multer=require(_0xe95a('0x0'));var util=require(_0xe95a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe95a('0x2'));var router=express[_0xe95a('0x3')]();var auth=require(_0xe95a('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe95a('0x5'));router[_0xe95a('0x6')]('/',auth['isAuthenticated'](),controller[_0xe95a('0x7')]);router[_0xe95a('0x6')](_0xe95a('0x8'),auth[_0xe95a('0x9')](),controller[_0xe95a('0xa')]);router['get']('/:id',auth[_0xe95a('0x9')](),controller[_0xe95a('0xb')]);router[_0xe95a('0x6')]('/:id/dispositions',auth['isAuthenticated'](),controller['getDispositions']);router[_0xe95a('0x6')](_0xe95a('0xc'),auth[_0xe95a('0x9')](),controller[_0xe95a('0xd')]);router[_0xe95a('0x6')](_0xe95a('0xe'),auth[_0xe95a('0x9')](),controller['getApplications']);router[_0xe95a('0x6')](_0xe95a('0xf'),auth['isAuthenticated'](),controller['getInteractions']);router[_0xe95a('0x6')](_0xe95a('0x10'),controller[_0xe95a('0x11')]);router[_0xe95a('0x6')]('/:id/users',auth[_0xe95a('0x9')](),controller['getAgents']);router['post']('/',auth[_0xe95a('0x9')](),controller[_0xe95a('0x12')]);router[_0xe95a('0x13')](_0xe95a('0x14'),auth['isAuthenticated'](),controller['addDisposition']);router[_0xe95a('0x13')]('/:id/canned_answers',auth[_0xe95a('0x9')](),controller['addAnswer']);router[_0xe95a('0x13')]('/:id/notify',controller[_0xe95a('0x15')]);router[_0xe95a('0x13')](_0xe95a('0xe'),auth['isAuthenticated'](),controller[_0xe95a('0x16')]);router['post'](_0xe95a('0x17'),auth[_0xe95a('0x9')](),controller[_0xe95a('0x18')]);router[_0xe95a('0x13')](_0xe95a('0x10'),controller[_0xe95a('0x19')]);router['post'](_0xe95a('0x1a'),auth[_0xe95a('0x9')](),controller[_0xe95a('0x1b')]);router[_0xe95a('0x1c')]('/:id',auth[_0xe95a('0x9')](),controller[_0xe95a('0x1d')]);router[_0xe95a('0x1e')](_0xe95a('0x1f'),auth[_0xe95a('0x9')](),controller['destroy']);router['delete'](_0xe95a('0x14'),auth[_0xe95a('0x9')](),controller['removeDispositions']);router['delete']('/:id/canned_answers',auth[_0xe95a('0x9')](),controller[_0xe95a('0x20')]);router[_0xe95a('0x1e')](_0xe95a('0x1a'),auth[_0xe95a('0x9')](),controller[_0xe95a('0x21')]);module[_0xe95a('0x22')]=router; \ No newline at end of file +var _0x9b3b=['removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','getDispositions','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','statusGet','getAgents','post','create','/:id/dispositions','addAnswer','/:id/notify','notify','/:id/send','/:id/status','/:id/users','update','delete','destroy','/:id/canned_answers','removeAnswers'];(function(_0x4dd9dc,_0x38722f){var _0x9e067e=function(_0x50bf5b){while(--_0x50bf5b){_0x4dd9dc['push'](_0x4dd9dc['shift']());}};_0x9e067e(++_0x38722f);}(_0x9b3b,0x17e));var _0xb9b3=function(_0x46cb35,_0x2b92ab){_0x46cb35=_0x46cb35-0x0;var _0x847507=_0x9b3b[_0x46cb35];return _0x847507;};'use strict';var multer=require(_0xb9b3('0x0'));var util=require(_0xb9b3('0x1'));var path=require(_0xb9b3('0x2'));var timeout=require(_0xb9b3('0x3'));var express=require(_0xb9b3('0x4'));var router=express[_0xb9b3('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9b3('0x6'));var config=require(_0xb9b3('0x7'));var controller=require('./smsAccount.controller');router[_0xb9b3('0x8')]('/',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0xa')]);router['get'](_0xb9b3('0xb'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0xc')]);router[_0xb9b3('0x8')](_0xb9b3('0xd'),auth[_0xb9b3('0x9')](),controller['show']);router['get']('/:id/dispositions',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0xe')]);router[_0xb9b3('0x8')]('/:id/canned_answers',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0xf')]);router[_0xb9b3('0x8')](_0xb9b3('0x10'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x11')]);router[_0xb9b3('0x8')](_0xb9b3('0x12'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x13')]);router[_0xb9b3('0x8')]('/:id/status',controller[_0xb9b3('0x14')]);router[_0xb9b3('0x8')]('/:id/users',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x15')]);router[_0xb9b3('0x16')]('/',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x17')]);router[_0xb9b3('0x16')](_0xb9b3('0x18'),auth[_0xb9b3('0x9')](),controller['addDisposition']);router[_0xb9b3('0x16')]('/:id/canned_answers',auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x19')]);router[_0xb9b3('0x16')](_0xb9b3('0x1a'),controller[_0xb9b3('0x1b')]);router[_0xb9b3('0x16')](_0xb9b3('0x10'),auth[_0xb9b3('0x9')](),controller['addApplications']);router[_0xb9b3('0x16')](_0xb9b3('0x1c'),auth[_0xb9b3('0x9')](),controller['send']);router['post'](_0xb9b3('0x1d'),controller['status']);router['post'](_0xb9b3('0x1e'),auth['isAuthenticated'](),controller['addAgents']);router['put'](_0xb9b3('0xd'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x1f')]);router[_0xb9b3('0x20')](_0xb9b3('0xd'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x21')]);router['delete'](_0xb9b3('0x18'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0xb9b3('0x20')](_0xb9b3('0x22'),auth[_0xb9b3('0x9')](),controller[_0xb9b3('0x23')]);router[_0xb9b3('0x20')]('/:id/users',auth['isAuthenticated'](),controller[_0xb9b3('0x24')]);module[_0xb9b3('0x25')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index cebc917..8f6d313 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 _0xa527=['setDataValue','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','skebby','connectel','plivo','clickatell','infobip','ENUM','TEXT','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa527,0x158));var _0x7a52=function(_0x485038,_0x3e26e8){_0x485038=_0x485038-0x0;var _0xa87ace=_0xa527[_0x485038];return _0xa87ace;};'use strict';var Sequelize=require(_0x7a52('0x0'));var rs=require(_0x7a52('0x1'));module[_0x7a52('0x2')]={'name':{'type':Sequelize[_0x7a52('0x3')],'unique':_0x7a52('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0x7a52('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x7a52('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x7a52('0x3')],'defaultValue':function(){return rs[_0x7a52('0x5')]();}},'phone':{'type':Sequelize[_0x7a52('0x3')]},'type':{'type':Sequelize['ENUM']('twilio',_0x7a52('0x6'),_0x7a52('0x7'),'clicksend',_0x7a52('0x8'),_0x7a52('0x9'),'csc',_0x7a52('0xa'),'intelepeer')},'accountSid':{'type':Sequelize[_0x7a52('0x3')]},'authId':{'type':Sequelize[_0x7a52('0x3')]},'authToken':{'type':Sequelize[_0x7a52('0x3')]},'smsMethod':{'type':Sequelize[_0x7a52('0xb')]('SI','TI','GP')},'username':{'type':Sequelize[_0x7a52('0x3')]},'password':{'type':Sequelize[_0x7a52('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0x7a52('0xc')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x7a52('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7a52('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7a52('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7a52('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a52('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a52('0xe')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x7a52('0xd')],'defaultValue':![],'comment':_0x7a52('0xf'),'set':function(_0x16e148){if(!_0x16e148)this[_0x7a52('0x10')]('mandatoryDispositionPauseId',null);this[_0x7a52('0x10')](_0x7a52('0x11'),_0x16e148);}}}; \ No newline at end of file +var _0xec0c=['infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','csc'];(function(_0x3b3490,_0x28d020){var _0x48ec37=function(_0x247212){while(--_0x247212){_0x3b3490['push'](_0x3b3490['shift']());}};_0x48ec37(++_0x28d020);}(_0xec0c,0xc2));var _0xcec0=function(_0x3c3c9c,_0x2006e4){_0x3c3c9c=_0x3c3c9c-0x0;var _0x430ef5=_0xec0c[_0x3c3c9c];return _0x430ef5;};'use strict';var Sequelize=require(_0xcec0('0x0'));var rs=require(_0xcec0('0x1'));module[_0xcec0('0x2')]={'name':{'type':Sequelize[_0xcec0('0x3')],'unique':_0xcec0('0x4'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0xcec0('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0xcec0('0x5')]();}},'phone':{'type':Sequelize[_0xcec0('0x3')]},'type':{'type':Sequelize[_0xcec0('0x6')](_0xcec0('0x7'),_0xcec0('0x8'),_0xcec0('0x9'),_0xcec0('0xa'),_0xcec0('0xb'),'clickatell',_0xcec0('0xc'),_0xcec0('0xd'),_0xcec0('0xe'))},'accountSid':{'type':Sequelize[_0xcec0('0x3')]},'authId':{'type':Sequelize[_0xcec0('0x3')]},'authToken':{'type':Sequelize[_0xcec0('0x3')]},'smsMethod':{'type':Sequelize[_0xcec0('0x6')]('SI','TI','GP')},'username':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0xcec0('0x3')]},'apiKey':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0xcec0('0x3')]},'deliveryReport':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xcec0('0x3')]},'notificationTemplate':{'type':Sequelize[_0xcec0('0x10')],'defaultValue':function(){return _0xcec0('0x11');}},'notificationSound':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xcec0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xcec0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xcec0('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xcec0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xcec0('0xf')],'defaultValue':![],'comment':_0xcec0('0x13'),'set':function(_0xb84fef){if(!_0xb84fef)this[_0xcec0('0x14')](_0xcec0('0x15'),null);this[_0xcec0('0x14')](_0xcec0('0x16'),_0xb84fef);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index e621b3a..ea0e6c9 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 _0xfb11=['defaults','localhost','./smsAccount.socket','register','jayson/promise','client','http','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','SmsAccount,\x20%s,\x20%s','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','catch','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','update','get','SmsAccounts','stack','name','index','Pause','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','keys','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','destroy','describe','addDisposition','Disposition','getDispositions','findOne','nolimit','SmsAccountId','removeDispositions','ids','CannedAnswer','findAll','removeAnswers','notify','SmsApplication','Applications','account','priority','asc','CmContact','no\x20available\x20attributes','difference','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','skebby','sender','connectel','message_id','plivo','MessageUUID','results','text','csc','originatingAddress','fromNumber','replyMessageId','intelepeer','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','contact','SmsInteraction','spread','interaction','created','close','unmanaged','*,*,*,*','SmsMessage','AttachmentId','UserId','applications','agent','waitForTheAssignedAgent','startRouting','Start','receiveMessage','entity\x20found','debug','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','send','\x0a','addApplications','sequelize','transaction','bulkCreate','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','to\x20is\x20mandatory','List','dataValues','Messages','push','log','endpoint\x20/status\x20POST\x20/','received\x20delivery\x20report\x20from','inspect','skebby_dispatch_id','statusInt','requestid','infobip','groupName','DELIVERED','clickatell','redif','clicksend','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','state','message-id','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis'];(function(_0x1fb22a,_0x26d964){var _0x5896ce=function(_0x2d162e){while(--_0x2d162e){_0x1fb22a['push'](_0x1fb22a['shift']());}};_0x5896ce(++_0x26d964);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xfb11[_0x139a3c];return _0x2b375b;};'use strict';var pdf=require(_0x1fb1('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1fb1('0x1'));var zipdir=require(_0x1fb1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fb1('0x3'));var moment=require('moment');var BPromise=require(_0x1fb1('0x4'));var Mustache=require('mustache');var util=require(_0x1fb1('0x5'));var path=require(_0x1fb1('0x6'));var sox=require('sox');var csv=require(_0x1fb1('0x7'));var ejs=require(_0x1fb1('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x1fb1('0x9'));var crypto=require(_0x1fb1('0xa'));var jsforce=require(_0x1fb1('0xb'));var deskjs=require(_0x1fb1('0xc'));var toCsv=require(_0x1fb1('0x7'));var querystring=require(_0x1fb1('0xd'));var Papa=require(_0x1fb1('0xe'));var Redis=require(_0x1fb1('0xf'));var authService=require(_0x1fb1('0x10'));var qs=require(_0x1fb1('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fb1('0x12'));var logger=require('../../config/logger')(_0x1fb1('0x13'));var utils=require('../../config/utils');var config=require(_0x1fb1('0x14'));var db=require(_0x1fb1('0x15'))['db'];config[_0x1fb1('0x16')]=_[_0x1fb1('0x17')](config[_0x1fb1('0x16')],{'host':_0x1fb1('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1fb1('0x16')]));require(_0x1fb1('0x19'))[_0x1fb1('0x1a')](socket);var jayson=require(_0x1fb1('0x1b'));var client=jayson[_0x1fb1('0x1c')][_0x1fb1('0x1d')]({'port':0x232c});function checkPasswordPattern(_0x151152,_0x316fe5,_0x358b58){if(_0x358b58){var _0x4cbe42=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x4cbe42['test'](_0x316fe5)){return _0x151152;}else{throw new db[(_0x1fb1('0x1e'))][(_0x1fb1('0x1f'))](_0x1fb1('0x20'));}}else{return _0x151152;}}function respondWithRpcPromise(_0x5e0f16,_0x161ca3,_0x23f1f5,_0x24d4df){return new BPromise(function(_0x34076b,_0x33c6b6){var _0x27d71f=_0x24d4df||client;return _0x27d71f[_0x1fb1('0x21')](_0x5e0f16,_0x23f1f5)[_0x1fb1('0x22')](function(_0x4041ea){logger['info'](_0x1fb1('0x23'),_0x161ca3,'request\x20sent');logger['debug'](_0x1fb1('0x24'),_0x161ca3,_0x1fb1('0x25'),JSON[_0x1fb1('0x26')](_0x4041ea));if(_0x4041ea['error']){if(_0x4041ea[_0x1fb1('0x27')]['code']===0x1f4){logger['error']('SmsAccount,\x20%s,\x20%s',_0x161ca3,_0x4041ea[_0x1fb1('0x27')][_0x1fb1('0x28')]);return _0x33c6b6(_0x4041ea[_0x1fb1('0x27')][_0x1fb1('0x28')]);}logger[_0x1fb1('0x27')]('SmsAccount,\x20%s,\x20%s',_0x161ca3,_0x4041ea[_0x1fb1('0x27')][_0x1fb1('0x28')]);return _0x34076b(_0x4041ea[_0x1fb1('0x27')][_0x1fb1('0x28')]);}else{logger[_0x1fb1('0x29')](_0x1fb1('0x23'),_0x161ca3,_0x1fb1('0x25'));_0x34076b(_0x4041ea[_0x1fb1('0x2a')]['message']);}})[_0x1fb1('0x2b')](function(_0x1aac7d){logger[_0x1fb1('0x27')](_0x1fb1('0x23'),_0x161ca3,_0x1aac7d);_0x33c6b6(_0x1aac7d);});});}function respondWithStatusCode(_0x1898e7,_0x29e1bd){_0x29e1bd=_0x29e1bd||0xcc;return function(_0x1a74c4){if(_0x1a74c4){return _0x1898e7[_0x1fb1('0x2c')](_0x29e1bd);}return _0x1898e7[_0x1fb1('0x2d')](_0x29e1bd)[_0x1fb1('0x2e')]();};}function respondWithResult(_0x5e99e7,_0x497017){_0x497017=_0x497017||0xc8;return function(_0x39fc43){if(_0x39fc43){return _0x5e99e7[_0x1fb1('0x2d')](_0x497017)[_0x1fb1('0x2f')](_0x39fc43);}};}function respondWithFilteredResult(_0x520ee2,_0x106134){return function(_0x316f7c){if(_0x316f7c){var _0x90d8ef=_0x316f7c[_0x1fb1('0x30')],_0x1b71cb=_0x106134['offset'],_0x5402e9=_0x106134[_0x1fb1('0x31')]+_0x106134['limit'],_0x245f84;if(_0x5402e9>=_0x90d8ef){_0x5402e9=_0x90d8ef;_0x245f84=0xc8;}else{_0x245f84=0xce;}_0x520ee2['status'](_0x245f84);return _0x520ee2[_0x1fb1('0x32')](_0x1fb1('0x33'),_0x1b71cb+'-'+_0x5402e9+'/'+_0x90d8ef)['json'](_0x316f7c);}return null;};}function patchUpdates(_0x5936d6){return function(_0x149753){try{jsonpatch[_0x1fb1('0x34')](_0x149753,_0x5936d6,!![]);}catch(_0x2ebb82){return BPromise[_0x1fb1('0x35')](_0x2ebb82);}return _0x149753['save']();};}function saveUpdates(_0x1cac1e,_0x366af4){return function(_0x9ad059){if(_0x9ad059){return _0x9ad059[_0x1fb1('0x36')](_0x1cac1e)[_0x1fb1('0x22')](function(_0x307700){return _0x307700;});}return null;};}function removeEntity(_0x28e986,_0x2a9a57){return function(_0x72a80d){if(_0x72a80d){return _0x72a80d['destroy']()[_0x1fb1('0x22')](function(){var _0x4b4271=_0x72a80d[_0x1fb1('0x37')]({'plain':!![]});var _0x482ddb=_0x1fb1('0x38');return db['UserProfileResource']['destroy']({'where':{'type':_0x482ddb,'resourceId':_0x4b4271['id']}})[_0x1fb1('0x22')](function(){return _0x72a80d;});})[_0x1fb1('0x22')](function(){_0x28e986[_0x1fb1('0x2d')](0xcc)[_0x1fb1('0x2e')]();});}};}function handleEntityNotFound(_0x564ed9,_0x3b0642){return function(_0x9a78df){if(!_0x9a78df){_0x564ed9[_0x1fb1('0x2c')](0x194);}return _0x9a78df;};}function handleError(_0x5be2f3,_0x3bbec9){_0x3bbec9=_0x3bbec9||0x1f4;return function(_0x35aa83){logger[_0x1fb1('0x27')](_0x35aa83[_0x1fb1('0x39')]);if(_0x35aa83[_0x1fb1('0x3a')]){delete _0x35aa83[_0x1fb1('0x3a')];}_0x5be2f3[_0x1fb1('0x2d')](_0x3bbec9)['send'](_0x35aa83);};}exports[_0x1fb1('0x3b')]=function(_0x2e04a9,_0x55d7ea){var _0x473894={'include':[{'model':db[_0x1fb1('0x3c')],'as':_0x1fb1('0x3d')}]},_0x51c83f={},_0x369146={'count':0x0,'rows':[]};var _0x439eec=_[_0x1fb1('0x3e')](db[_0x1fb1('0x3f')][_0x1fb1('0x40')],function(_0x582003){return{'name':_0x582003[_0x1fb1('0x41')],'type':_0x582003[_0x1fb1('0x42')][_0x1fb1('0x43')]};});_0x51c83f[_0x1fb1('0x44')]=_[_0x1fb1('0x3e')](_0x439eec,_0x1fb1('0x3a'));_0x51c83f[_0x1fb1('0x45')]=_['keys'](_0x2e04a9[_0x1fb1('0x45')]);_0x51c83f[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x51c83f[_0x1fb1('0x44')],_0x51c83f['query']);_0x473894['attributes']=_[_0x1fb1('0x47')](_0x51c83f[_0x1fb1('0x44')],qs[_0x1fb1('0x48')](_0x2e04a9[_0x1fb1('0x45')][_0x1fb1('0x48')]));_0x473894[_0x1fb1('0x49')]=_0x473894[_0x1fb1('0x49')][_0x1fb1('0x4a')]?_0x473894[_0x1fb1('0x49')]:_0x51c83f[_0x1fb1('0x44')];if(!_0x2e04a9['query'][_0x1fb1('0x4b')]('nolimit')){_0x473894['limit']=qs[_0x1fb1('0x4c')](_0x2e04a9[_0x1fb1('0x45')][_0x1fb1('0x4c')]);_0x473894[_0x1fb1('0x31')]=qs['offset'](_0x2e04a9['query'][_0x1fb1('0x31')]);}_0x473894[_0x1fb1('0x4d')]=qs[_0x1fb1('0x4e')](_0x2e04a9[_0x1fb1('0x45')][_0x1fb1('0x4e')]);_0x473894[_0x1fb1('0x4f')]=qs[_0x1fb1('0x46')](_[_0x1fb1('0x50')](_0x2e04a9[_0x1fb1('0x45')],_0x51c83f['filters']));if(_0x2e04a9['query'][_0x1fb1('0x51')]){_0x473894['where']=_[_0x1fb1('0x52')](_0x473894[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x439eec,function(_0x467bf1){if(_0x467bf1[_0x1fb1('0x42')]!==_0x1fb1('0x53')){var _0x5af135={};_0x5af135[_0x467bf1[_0x1fb1('0x3a')]]={'$like':'%'+_0x2e04a9[_0x1fb1('0x45')][_0x1fb1('0x51')]+'%'};return _0x5af135;}})});}_0x473894=_['merge']({},_0x473894,_0x2e04a9[_0x1fb1('0x54')]);var _0x4861b4={'where':_0x473894[_0x1fb1('0x4f')]};return db[_0x1fb1('0x3f')][_0x1fb1('0x30')](_0x4861b4)['then'](function(_0x285afd){_0x369146[_0x1fb1('0x30')]=_0x285afd;if(_0x2e04a9['query'][_0x1fb1('0x55')]){_0x473894[_0x1fb1('0x56')]=[{'all':!![]}];}return db[_0x1fb1('0x3f')]['findAll'](_0x473894);})['then'](function(_0x4db0c9){_0x369146[_0x1fb1('0x57')]=_0x4db0c9;return _0x369146;})[_0x1fb1('0x22')](respondWithFilteredResult(_0x55d7ea,_0x473894))[_0x1fb1('0x2b')](handleError(_0x55d7ea,null));};exports[_0x1fb1('0x58')]=function(_0x2cc60e,_0x30c878){var _0x53f794={'raw':![],'where':{'id':_0x2cc60e[_0x1fb1('0x59')]['id']},'include':[{'model':db[_0x1fb1('0x3c')],'as':_0x1fb1('0x3d')}]},_0x556529={};_0x556529[_0x1fb1('0x44')]=_['keys'](db['SmsAccount'][_0x1fb1('0x40')]);_0x556529['query']=_[_0x1fb1('0x5a')](_0x2cc60e['query']);_0x556529[_0x1fb1('0x46')]=_['intersection'](_0x556529[_0x1fb1('0x44')],_0x556529[_0x1fb1('0x45')]);_0x53f794[_0x1fb1('0x49')]=_[_0x1fb1('0x47')](_0x556529[_0x1fb1('0x44')],qs['fields'](_0x2cc60e['query'][_0x1fb1('0x48')]));_0x53f794[_0x1fb1('0x49')]=_0x53f794['attributes']['length']?_0x53f794[_0x1fb1('0x49')]:_0x556529[_0x1fb1('0x44')];if(_0x2cc60e[_0x1fb1('0x45')][_0x1fb1('0x55')]){_0x53f794[_0x1fb1('0x56')]=[{'all':!![]}];}_0x53f794=_[_0x1fb1('0x52')]({},_0x53f794,_0x2cc60e['options']);return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')](_0x53f794)[_0x1fb1('0x22')](handleEntityNotFound(_0x30c878,null))[_0x1fb1('0x22')](respondWithResult(_0x30c878,null))[_0x1fb1('0x2b')](handleError(_0x30c878,null));};exports[_0x1fb1('0x5c')]=function(_0x32899f,_0x5527ef){return db[_0x1fb1('0x3f')][_0x1fb1('0x5c')](_0x32899f[_0x1fb1('0x5d')],{})['then'](function(_0x2ccc4f){var _0x435855=_0x32899f[_0x1fb1('0x5e')]['get']({'plain':!![]});if(!_0x435855)throw new Error(_0x1fb1('0x5f'));if(_0x435855[_0x1fb1('0x60')]===_0x1fb1('0x5e')){var _0x4232cf=_0x2ccc4f[_0x1fb1('0x37')]({'plain':!![]});var _0x1b2ea4='SmsAccounts';return db['UserProfileSection'][_0x1fb1('0x5b')]({'where':{'name':_0x1b2ea4,'userProfileId':_0x435855[_0x1fb1('0x61')]},'raw':!![]})[_0x1fb1('0x22')](function(_0x34549c){if(_0x34549c&&_0x34549c[_0x1fb1('0x62')]===0x0){return db[_0x1fb1('0x63')][_0x1fb1('0x5c')]({'name':_0x4232cf['name'],'resourceId':_0x4232cf['id'],'type':_0x34549c[_0x1fb1('0x3a')],'sectionId':_0x34549c['id']},{})[_0x1fb1('0x22')](function(){return _0x2ccc4f;});}else{return _0x2ccc4f;}})[_0x1fb1('0x2b')](function(_0x2c0c36){logger[_0x1fb1('0x27')](_0x1fb1('0x64'),_0x2c0c36);throw _0x2c0c36;});}return _0x2ccc4f;})['then'](respondWithResult(_0x5527ef,0xc9))[_0x1fb1('0x2b')](handleError(_0x5527ef,null));};exports[_0x1fb1('0x36')]=function(_0x10445e,_0x1d2993){if(_0x10445e[_0x1fb1('0x5d')]['id']){delete _0x10445e['body']['id'];}return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x10445e['params']['id']},'include':[{'model':db[_0x1fb1('0x3c')],'as':'mandatoryDispositionPause'}]})[_0x1fb1('0x22')](handleEntityNotFound(_0x1d2993,null))[_0x1fb1('0x22')](saveUpdates(_0x10445e[_0x1fb1('0x5d')],null))[_0x1fb1('0x22')](respondWithResult(_0x1d2993,null))['catch'](handleError(_0x1d2993,null));};exports[_0x1fb1('0x65')]=function(_0x3fda2b,_0x352182){return db[_0x1fb1('0x3f')]['find']({'where':{'id':_0x3fda2b[_0x1fb1('0x59')]['id']}})['then'](handleEntityNotFound(_0x352182,null))[_0x1fb1('0x22')](removeEntity(_0x352182,null))[_0x1fb1('0x2b')](handleError(_0x352182,null));};exports['describe']=function(_0x3df5fa,_0x3fb4c9){return db[_0x1fb1('0x3f')][_0x1fb1('0x66')]()[_0x1fb1('0x22')](respondWithResult(_0x3fb4c9,null))[_0x1fb1('0x2b')](handleError(_0x3fb4c9,null));};exports[_0x1fb1('0x67')]=function(_0x4fae03,_0x27da64,_0x20f512){if(_0x4fae03['body']['id']){delete _0x4fae03['body']['id'];}return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x4fae03[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x27da64,null))[_0x1fb1('0x22')](function(_0x26715b){if(_0x26715b){_0x4fae03[_0x1fb1('0x5d')]['SmsAccountId']=_0x26715b['id'];return db[_0x1fb1('0x68')][_0x1fb1('0x5c')](_0x4fae03[_0x1fb1('0x5d')]);}})[_0x1fb1('0x22')](respondWithResult(_0x27da64,null))[_0x1fb1('0x2b')](handleError(_0x27da64,null));};exports[_0x1fb1('0x69')]=function(_0x3c0873,_0x3236df,_0x36e568){var _0x517397={'raw':![],'where':{}};var _0x3d2e2f={};var _0x32ca99={'count':0x0,'rows':[]};return db['SmsAccount'][_0x1fb1('0x6a')]({'where':{'id':_0x3c0873[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x3236df,null))['then'](function(_0x153ed5){if(_0x153ed5){_0x3d2e2f[_0x1fb1('0x44')]=_[_0x1fb1('0x5a')](db[_0x1fb1('0x68')][_0x1fb1('0x40')]);_0x3d2e2f[_0x1fb1('0x45')]=_[_0x1fb1('0x5a')](_0x3c0873[_0x1fb1('0x45')]);_0x3d2e2f[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x3d2e2f[_0x1fb1('0x44')],_0x3d2e2f[_0x1fb1('0x45')]);_0x517397[_0x1fb1('0x49')]=_[_0x1fb1('0x47')](_0x3d2e2f[_0x1fb1('0x44')],qs[_0x1fb1('0x48')](_0x3c0873[_0x1fb1('0x45')][_0x1fb1('0x48')]));_0x517397[_0x1fb1('0x49')]=_0x517397[_0x1fb1('0x49')][_0x1fb1('0x4a')]?_0x517397['attributes']:_0x3d2e2f['model'];if(!_0x3c0873[_0x1fb1('0x45')]['hasOwnProperty'](_0x1fb1('0x6b'))){_0x517397[_0x1fb1('0x4c')]=qs['limit'](_0x3c0873['query']['limit']);_0x517397['offset']=qs[_0x1fb1('0x31')](_0x3c0873[_0x1fb1('0x45')][_0x1fb1('0x31')]);}_0x517397[_0x1fb1('0x4d')]=qs[_0x1fb1('0x4e')](_0x3c0873[_0x1fb1('0x45')][_0x1fb1('0x4e')]);_0x517397[_0x1fb1('0x4f')]=qs['filters'](_['pick'](_0x3c0873[_0x1fb1('0x45')],_0x3d2e2f[_0x1fb1('0x46')]));_0x517397[_0x1fb1('0x4f')][_0x1fb1('0x6c')]=_0x153ed5['id'];if(_0x3c0873[_0x1fb1('0x45')][_0x1fb1('0x51')]){_0x517397[_0x1fb1('0x4f')]=_[_0x1fb1('0x52')](_0x517397[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x517397['attributes'],function(_0x3de862){var _0x27dc3e={};_0x27dc3e[_0x3de862]={'$like':'%'+_0x3c0873['query'][_0x1fb1('0x51')]+'%'};return _0x27dc3e;})});}_0x517397=_[_0x1fb1('0x52')]({},_0x517397,_0x3c0873[_0x1fb1('0x54')]);return db[_0x1fb1('0x68')][_0x1fb1('0x30')]({'where':_0x517397[_0x1fb1('0x4f')]})[_0x1fb1('0x22')](function(_0x50c22f){_0x32ca99[_0x1fb1('0x30')]=_0x50c22f;if(_0x3c0873[_0x1fb1('0x45')]['includeAll']){_0x517397[_0x1fb1('0x56')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x517397);})[_0x1fb1('0x22')](function(_0x2cc8ed){_0x32ca99[_0x1fb1('0x57')]=_0x2cc8ed;return _0x32ca99;});}})[_0x1fb1('0x22')](respondWithFilteredResult(_0x3236df,_0x517397))[_0x1fb1('0x2b')](handleError(_0x3236df,null));};exports[_0x1fb1('0x6d')]=function(_0x56efbc,_0x474bed,_0x34bba7){return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x56efbc['params']['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x474bed,null))[_0x1fb1('0x22')](function(_0x5dd570){if(_0x5dd570){return _0x5dd570['removeDispositions'](_0x56efbc[_0x1fb1('0x45')][_0x1fb1('0x6e')]);}})[_0x1fb1('0x22')](respondWithStatusCode(_0x474bed,null))[_0x1fb1('0x2b')](handleError(_0x474bed,null));};exports['addAnswer']=function(_0x18dd72,_0x5bac13,_0x53dd03){if(_0x18dd72['body']['id']){delete _0x18dd72['body']['id'];}return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x18dd72[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x5bac13,null))[_0x1fb1('0x22')](function(_0x27f6ef){if(_0x27f6ef){_0x18dd72['body'][_0x1fb1('0x6c')]=_0x27f6ef['id'];return db[_0x1fb1('0x6f')][_0x1fb1('0x5c')](_0x18dd72[_0x1fb1('0x5d')]);}})[_0x1fb1('0x22')](respondWithResult(_0x5bac13,null))[_0x1fb1('0x2b')](handleError(_0x5bac13,null));};exports['getAnswers']=function(_0x3c94b9,_0x1d2113,_0x10bf5f){var _0x1dbc01={'raw':![],'where':{}};var _0x2ef05a={};var _0x4abfb7={'count':0x0,'rows':[]};return db[_0x1fb1('0x3f')][_0x1fb1('0x6a')]({'where':{'id':_0x3c94b9[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x1d2113,null))[_0x1fb1('0x22')](function(_0x17492b){if(_0x17492b){_0x2ef05a['model']=_['keys'](db['CannedAnswer'][_0x1fb1('0x40')]);_0x2ef05a['query']=_['keys'](_0x3c94b9[_0x1fb1('0x45')]);_0x2ef05a[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x2ef05a[_0x1fb1('0x44')],_0x2ef05a[_0x1fb1('0x45')]);_0x1dbc01[_0x1fb1('0x49')]=_['intersection'](_0x2ef05a[_0x1fb1('0x44')],qs[_0x1fb1('0x48')](_0x3c94b9[_0x1fb1('0x45')][_0x1fb1('0x48')]));_0x1dbc01[_0x1fb1('0x49')]=_0x1dbc01[_0x1fb1('0x49')][_0x1fb1('0x4a')]?_0x1dbc01[_0x1fb1('0x49')]:_0x2ef05a[_0x1fb1('0x44')];if(!_0x3c94b9['query'][_0x1fb1('0x4b')](_0x1fb1('0x6b'))){_0x1dbc01[_0x1fb1('0x4c')]=qs[_0x1fb1('0x4c')](_0x3c94b9[_0x1fb1('0x45')]['limit']);_0x1dbc01[_0x1fb1('0x31')]=qs['offset'](_0x3c94b9[_0x1fb1('0x45')]['offset']);}_0x1dbc01['order']=qs[_0x1fb1('0x4e')](_0x3c94b9['query']['sort']);_0x1dbc01['where']=qs[_0x1fb1('0x46')](_['pick'](_0x3c94b9[_0x1fb1('0x45')],_0x2ef05a[_0x1fb1('0x46')]));_0x1dbc01[_0x1fb1('0x4f')][_0x1fb1('0x6c')]=_0x17492b['id'];if(_0x3c94b9[_0x1fb1('0x45')]['filter']){_0x1dbc01[_0x1fb1('0x4f')]=_[_0x1fb1('0x52')](_0x1dbc01[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x1dbc01[_0x1fb1('0x49')],function(_0x5429a9){var _0x92869={};_0x92869[_0x5429a9]={'$like':'%'+_0x3c94b9[_0x1fb1('0x45')][_0x1fb1('0x51')]+'%'};return _0x92869;})});}_0x1dbc01=_[_0x1fb1('0x52')]({},_0x1dbc01,_0x3c94b9[_0x1fb1('0x54')]);return db[_0x1fb1('0x6f')]['count']({'where':_0x1dbc01['where']})[_0x1fb1('0x22')](function(_0x3116c7){_0x4abfb7[_0x1fb1('0x30')]=_0x3116c7;if(_0x3c94b9[_0x1fb1('0x45')]['includeAll']){_0x1dbc01[_0x1fb1('0x56')]=[{'all':!![]}];}return db[_0x1fb1('0x6f')][_0x1fb1('0x70')](_0x1dbc01);})[_0x1fb1('0x22')](function(_0x2f5947){_0x4abfb7['rows']=_0x2f5947;return _0x4abfb7;});}})[_0x1fb1('0x22')](respondWithFilteredResult(_0x1d2113,_0x1dbc01))[_0x1fb1('0x2b')](handleError(_0x1d2113,null));};exports[_0x1fb1('0x71')]=function(_0x1455e4,_0x1cb1bd,_0x49a091){return db[_0x1fb1('0x3f')]['find']({'where':{'id':_0x1455e4[_0x1fb1('0x59')]['id']}})['then'](handleEntityNotFound(_0x1cb1bd,null))[_0x1fb1('0x22')](function(_0x25b7ed){if(_0x25b7ed){return _0x25b7ed[_0x1fb1('0x71')](_0x1455e4['query'][_0x1fb1('0x6e')]);}})[_0x1fb1('0x22')](respondWithStatusCode(_0x1cb1bd,null))[_0x1fb1('0x2b')](handleError(_0x1cb1bd,null));};exports[_0x1fb1('0x72')]=function(_0x42b73f,_0x1d7462,_0x2188c6){var _0x614e0d={'channel':'sms'};var _0x5f0b43=[];var _0x1d3789=[];var _0x3ae4d1={};return db['SmsAccount'][_0x1fb1('0x5b')]({'where':{'id':_0x42b73f[_0x1fb1('0x59')]['id']},'include':[{'model':db[_0x1fb1('0x73')],'as':_0x1fb1('0x74')}]})[_0x1fb1('0x22')](handleEntityNotFound(_0x1d7462,null))[_0x1fb1('0x22')](function(_0x219015){_0x614e0d[_0x1fb1('0x75')]=_0x219015;_0x614e0d['applications']=_['orderBy'](_0x219015['Applications'],[_0x1fb1('0x76')],[_0x1fb1('0x77')]);if(_0x614e0d[_0x1fb1('0x75')][_0x1fb1('0x74')]){delete _0x614e0d['account'][_0x1fb1('0x74')];}return db[_0x1fb1('0x78')]['describe']();})[_0x1fb1('0x22')](function(_0x1406e8){if(!_0x1406e8){throw new db[(_0x1fb1('0x1e'))][(_0x1fb1('0x1f'))](_0x1fb1('0x79'));}_0x5f0b43=_[_0x1fb1('0x7a')](_['keys'](_0x1406e8),['createdAt',_0x1fb1('0x7b')]);_0x1d3789=_[_0x1fb1('0x7a')](_[_0x1fb1('0x5a')](_0x1406e8),['createdAt',_0x1fb1('0x7b'),_0x1fb1('0x7c'),_0x1fb1('0x7d')]);_0x614e0d['body']={'mapKey':_0x1fb1('0x7e')};if(_0x614e0d[_0x1fb1('0x75')]['type']){switch(_0x614e0d['account'][_0x1fb1('0x42')]){case _0x1fb1('0x7f'):_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]=_0x42b73f['body'][_0x1fb1('0x81')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f['body'][_0x1fb1('0x82')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x84')];break;case _0x1fb1('0x85'):_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]='+'+_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x86')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f[_0x1fb1('0x5d')]['text'];break;case _0x1fb1('0x87'):_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x80')];_0x614e0d['body'][_0x1fb1('0x5d')]=_0x42b73f['body'][_0x1fb1('0x28')];break;case'clicksend':_0x614e0d['body'][_0x1fb1('0x80')]=_0x42b73f['body'][_0x1fb1('0x80')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x5d')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')]=_0x42b73f['body'][_0x1fb1('0x88')];break;case _0x1fb1('0x89'):_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x81')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f[_0x1fb1('0x5d')]['Text'];_0x614e0d['body'][_0x1fb1('0x83')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x8a')];break;case'infobip':_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]='+'+_0x42b73f[_0x1fb1('0x5d')]['results'][0x0][_0x1fb1('0x80')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x8b')][0x0][_0x1fb1('0x8c')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x8b')][0x0]['messageId'];break;case _0x1fb1('0x8d'):_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x8e')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f[_0x1fb1('0x5d')]['segmentedMessage'][_0x1fb1('0x28')];break;case'clickatell':_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x8f')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x5d')]=_0x42b73f['body'][_0x1fb1('0x8c')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x90')];break;case _0x1fb1('0x91'):_0x614e0d['body'][_0x1fb1('0x80')]=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x80')];_0x614e0d[_0x1fb1('0x5d')]['body']=_0x42b73f[_0x1fb1('0x5d')][_0x1fb1('0x28')];_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')]=_0x42b73f[_0x1fb1('0x5d')]['refid'];break;}}if(_0x614e0d[_0x1fb1('0x5d')]['id']){delete _0x614e0d[_0x1fb1('0x5d')]['id'];}if(_[_0x1fb1('0x92')](_0x614e0d['body']['from'])){throw new db[(_0x1fb1('0x1e'))][(_0x1fb1('0x1f'))](_0x1fb1('0x93'));}if(_['isNil'](_0x614e0d['body']['body'])||_0x614e0d[_0x1fb1('0x5d')]['body']===''){throw new db[(_0x1fb1('0x1e'))]['ValidationError'](_0x1fb1('0x94'));}if(_[_0x1fb1('0x92')](_0x614e0d['body'][_0x1fb1('0x95')])){throw new db['Sequelize'][(_0x1fb1('0x1f'))](_0x1fb1('0x96')+_0x1d3789);}if(!_[_0x1fb1('0x97')](_0x1d3789,_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x95')])){throw new db[(_0x1fb1('0x1e'))][(_0x1fb1('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1d3789);}_0x3ae4d1[_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x95')]]=_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')];return db[_0x1fb1('0x98')][_0x1fb1('0x5b')]({'where':{'id':_0x614e0d[_0x1fb1('0x75')][_0x1fb1('0x7d')]},'include':[{'model':db['CmContact'],'as':_0x1fb1('0x99'),'where':_0x3ae4d1,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x1fb1('0x22')](handleEntityNotFound(_0x1d7462,null))[_0x1fb1('0x22')](function(_0x586fa0){if(_0x586fa0){_0x614e0d[_0x1fb1('0x9a')]=_[_0x1fb1('0x9b')](_0x586fa0,[_0x1fb1('0x99')]);if(_0x586fa0[_0x1fb1('0x99')][_0x1fb1('0x4a')]){return _0x586fa0[_0x1fb1('0x99')][0x0];}var _0x58daa3=_[_0x1fb1('0x17')](_0x614e0d['body'],{'firstName':_0x614e0d[_0x1fb1('0x5d')]['from'],'ListId':_0x586fa0['id']});_0x58daa3[_0x614e0d['body']['mapKey']]=_0x614e0d['body'][_0x1fb1('0x80')];return db['CmContact']['create'](_0x58daa3,{'fields':_0x5f0b43,'raw':!![]});}})[_0x1fb1('0x22')](handleEntityNotFound(_0x1d7462,null))[_0x1fb1('0x22')](function(_0x4d5517){if(_0x4d5517){_0x614e0d[_0x1fb1('0x9c')]=_0x4d5517;var _0x5796cd={'ContactId':_0x4d5517['id'],'phone':_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x80')],'SmsAccountId':_0x42b73f[_0x1fb1('0x59')]['id']};var _0x59385a={'ContactId':_0x4d5517['id'],'SmsAccountId':_0x42b73f['params']['id'],'closed':![]};return db[_0x1fb1('0x9d')][_0x1fb1('0x5b')]({'where':_0x59385a})[_0x1fb1('0x22')](function(_0x722cc9){if(_0x722cc9){return[_0x722cc9,![]];}return db['SmsInteraction'][_0x1fb1('0x5c')](_0x5796cd)['then'](function(_0x4e4dac){return[_0x4e4dac,!![]];});});}})[_0x1fb1('0x9e')](function(_0x4d5d37,_0x19bc82){_0x614e0d[_0x1fb1('0x9f')]=_0x4d5d37[_0x1fb1('0x37')]({'plain':!![]});_0x614e0d[_0x1fb1('0x9f')][_0x1fb1('0xa0')]=![];if(_0x19bc82){if(_0x614e0d[_0x1fb1('0x75')]['autoclose']){_0x614e0d['applications']['push']({'id':0x0,'priority':_0x614e0d['applications'][_0x1fb1('0x4a')]+0x1,'app':_0x1fb1('0xa1'),'appdata':_0x1fb1('0xa2'),'interval':_0x1fb1('0xa3')});}_0x614e0d['interaction']['created']=!![];}return db[_0x1fb1('0xa4')]['create']({'phone':_0x614e0d['body'][_0x1fb1('0x80')],'messageId':_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0x83')],'body':_0x614e0d['body'][_0x1fb1('0x5d')],'SmsAccountId':_0x42b73f[_0x1fb1('0x59')]['id'],'SmsInteractionId':_0x4d5d37['id'],'direction':'in','ContactId':_0x4d5d37['ContactId'],'AttachmentId':_0x614e0d[_0x1fb1('0x5d')][_0x1fb1('0xa5')]});})[_0x1fb1('0x22')](function(_0x3a1a1b){_0x614e0d[_0x1fb1('0x28')]=_0x3a1a1b;if(_0x614e0d[_0x1fb1('0x9f')][_0x1fb1('0xa6')]){return db['User'][_0x1fb1('0x5b')]({'attributes':['id',_0x1fb1('0x3a')],'where':{'id':_0x614e0d[_0x1fb1('0x9f')][_0x1fb1('0xa6')]}})['then'](function(_0x3f57d4){if(_0x3f57d4){_0x614e0d[_0x1fb1('0xa7')]['unshift']({'id':0x0,'priority':0x0,'app':_0x1fb1('0xa8'),'appdata':_0x3f57d4[_0x1fb1('0x3a')]+','+(_0x614e0d[_0x1fb1('0x75')][_0x1fb1('0xa9')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0x1fb1('0xaa'),_0x614e0d);});}return respondWithRpcPromise(_0x1fb1('0xab'),_0x1fb1('0xaa'),_0x614e0d);})['then'](function(_0x5d1722){if(_0x5d1722){var _0x414232=0xc8;var _0x577d09=_0x1fb1('0xac');logger['info'](_0x1fb1('0x24'),_0x577d09,_0x414232,_0x1fb1('0xad'));logger[_0x1fb1('0xae')](_0x1fb1('0xaf'),_0x577d09,_0x414232,'entity\x20found',JSON[_0x1fb1('0x26')](_0x5d1722));if(_0x614e0d[_0x1fb1('0x75')][_0x1fb1('0x42')]===_0x1fb1('0x7f')){return _0x1d7462[_0x1fb1('0x2d')](_0x414232)[_0x1fb1('0x32')](_0x1fb1('0xb0'),_0x1fb1('0xb1'))[_0x1fb1('0xb2')](_0x1fb1('0xb3'));}else{return _0x1d7462[_0x1fb1('0x2d')](_0x414232)[_0x1fb1('0x2f')](_0x5d1722);}}})[_0x1fb1('0x2b')](handleError(_0x1d7462,null));};exports[_0x1fb1('0xb4')]=function(_0xb0df30,_0x5585ab,_0x11f397){return db[_0x1fb1('0x3f')][_0x1fb1('0x6a')]({'where':{'id':_0xb0df30['params']['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x5585ab,null))['then'](function(_0xd77388){if(_0xd77388){return db[_0x1fb1('0xb5')][_0x1fb1('0xb6')](function(_0x16a7d8){return db[_0x1fb1('0x73')]['destroy']({'where':{'SmsAccountId':_0xb0df30[_0x1fb1('0x59')]['id']},'transaction':_0x16a7d8})[_0x1fb1('0x22')](function(_0xfe7ac5){var _0x3c9e22=_['map'](_0xb0df30[_0x1fb1('0x5d')],function(_0x24e516){_0x24e516['SmsAccountId']=_0xb0df30[_0x1fb1('0x59')]['id'];return _0x24e516;});return db[_0x1fb1('0x73')][_0x1fb1('0xb7')](_0x3c9e22,{'transaction':_0x16a7d8});});})[_0x1fb1('0x22')](function(){return db[_0x1fb1('0x73')]['findAndCountAll']({'where':{'SmsAccountId':_0xb0df30[_0x1fb1('0x59')]['id']},'order':_0x1fb1('0x76')});});}})[_0x1fb1('0x22')](respondWithResult(_0x5585ab,null))[_0x1fb1('0x2b')](handleError(_0x5585ab,null));};exports['getApplications']=function(_0x1f0faa,_0x4c3d30,_0x3cbe72){var _0x28eeb1={};var _0x4beb4e={};var _0x376c42;var _0x38c288;return db[_0x1fb1('0x3f')][_0x1fb1('0x6a')]({'where':{'id':_0x1f0faa['params']['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x4c3d30,null))['then'](function(_0xb85a8a){if(_0xb85a8a){_0x376c42=_0xb85a8a;_0x4beb4e['model']=_[_0x1fb1('0x5a')](db[_0x1fb1('0x73')][_0x1fb1('0x40')]);_0x4beb4e['query']=_['keys'](_0x1f0faa[_0x1fb1('0x45')]);_0x4beb4e[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x4beb4e[_0x1fb1('0x44')],_0x4beb4e[_0x1fb1('0x45')]);_0x28eeb1[_0x1fb1('0x49')]=_[_0x1fb1('0x47')](_0x4beb4e['model'],qs[_0x1fb1('0x48')](_0x1f0faa[_0x1fb1('0x45')]['fields']));_0x28eeb1[_0x1fb1('0x49')]=_0x28eeb1['attributes'][_0x1fb1('0x4a')]?_0x28eeb1[_0x1fb1('0x49')]:_0x4beb4e[_0x1fb1('0x44')];_0x28eeb1[_0x1fb1('0x4d')]=qs[_0x1fb1('0x4e')](_0x1f0faa[_0x1fb1('0x45')][_0x1fb1('0x4e')]);_0x28eeb1[_0x1fb1('0x4f')]=qs[_0x1fb1('0x46')](_[_0x1fb1('0x50')](_0x1f0faa[_0x1fb1('0x45')],_0x4beb4e['filters']));if(_0x1f0faa[_0x1fb1('0x45')]['filter']){_0x28eeb1[_0x1fb1('0x4f')]=_[_0x1fb1('0x52')](_0x28eeb1[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x28eeb1[_0x1fb1('0x49')],function(_0x2ca153){var _0x4ac138={};_0x4ac138[_0x2ca153]={'$like':'%'+_0x1f0faa[_0x1fb1('0x45')]['filter']+'%'};return _0x4ac138;})});}_0x28eeb1=_[_0x1fb1('0x52')]({},_0x28eeb1,_0x1f0faa[_0x1fb1('0x54')]);return _0x376c42[_0x1fb1('0xb8')](_0x28eeb1);}})['then'](function(_0x7c09c7){if(_0x7c09c7){_0x38c288=_0x7c09c7[_0x1fb1('0x4a')];if(!_0x1f0faa[_0x1fb1('0x45')][_0x1fb1('0x4b')](_0x1fb1('0x6b'))){_0x28eeb1['limit']=qs[_0x1fb1('0x4c')](_0x1f0faa[_0x1fb1('0x45')]['limit']);_0x28eeb1[_0x1fb1('0x31')]=qs['offset'](_0x1f0faa['query'][_0x1fb1('0x31')]);}return _0x376c42[_0x1fb1('0xb8')](_0x28eeb1);}})[_0x1fb1('0x22')](function(_0x458812){if(_0x458812){return _0x458812?{'count':_0x38c288,'rows':_0x458812}:null;}})[_0x1fb1('0x22')](respondWithResult(_0x4c3d30,null))['catch'](handleError(_0x4c3d30,null));};exports[_0x1fb1('0xb9')]=function(_0x57e1a8,_0x525967,_0x174779){var _0x4659f8={'raw':![],'where':{}};var _0x1cdfd4={};var _0x157a42={'count':0x0,'rows':[]};return db[_0x1fb1('0x3f')][_0x1fb1('0x6a')]({'where':{'id':_0x57e1a8[_0x1fb1('0x59')]['id']}})['then'](handleEntityNotFound(_0x525967,null))[_0x1fb1('0x22')](function(_0x4b74d5){if(_0x4b74d5){_0x1cdfd4[_0x1fb1('0x44')]=_[_0x1fb1('0x5a')](db['SmsInteraction'][_0x1fb1('0x40')]);_0x1cdfd4['query']=_[_0x1fb1('0x5a')](_0x57e1a8[_0x1fb1('0x45')]);_0x1cdfd4[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x1cdfd4[_0x1fb1('0x44')],_0x1cdfd4[_0x1fb1('0x45')]);_0x4659f8[_0x1fb1('0x49')]=_[_0x1fb1('0x47')](_0x1cdfd4['model'],qs[_0x1fb1('0x48')](_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x48')]));_0x4659f8[_0x1fb1('0x49')]=_0x4659f8[_0x1fb1('0x49')][_0x1fb1('0x4a')]?_0x4659f8[_0x1fb1('0x49')]:_0x1cdfd4['model'];if(!_0x57e1a8['query'][_0x1fb1('0x4b')](_0x1fb1('0x6b'))){_0x4659f8['limit']=qs[_0x1fb1('0x4c')](_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x4c')]);_0x4659f8[_0x1fb1('0x31')]=qs['offset'](_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x31')]);}_0x4659f8[_0x1fb1('0x4d')]=qs[_0x1fb1('0x4e')](_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x4e')]);_0x4659f8['where']=qs[_0x1fb1('0x46')](_[_0x1fb1('0x50')](_0x57e1a8[_0x1fb1('0x45')],_0x1cdfd4[_0x1fb1('0x46')]));_0x4659f8[_0x1fb1('0x4f')][_0x1fb1('0x6c')]=_0x4b74d5['id'];if(_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x51')]){_0x4659f8['where']=_['merge'](_0x4659f8[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x4659f8[_0x1fb1('0x49')],function(_0x3f2134){var _0x593d0f={};_0x593d0f[_0x3f2134]={'$like':'%'+_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0x51')]+'%'};return _0x593d0f;})});}_0x4659f8=_[_0x1fb1('0x52')]({},_0x4659f8,_0x57e1a8[_0x1fb1('0x54')]);return db[_0x1fb1('0x9d')][_0x1fb1('0x30')]({'where':_0x4659f8[_0x1fb1('0x4f')]})[_0x1fb1('0x22')](function(_0x148ed8){_0x157a42[_0x1fb1('0x30')]=_0x148ed8;if(_0x57e1a8[_0x1fb1('0x45')]['includeAll']){_0x4659f8[_0x1fb1('0x56')]=[{'model':db[_0x1fb1('0x78')],'as':_0x1fb1('0xba'),'required':![]},{'model':db[_0x1fb1('0xbb')],'as':_0x1fb1('0xbc'),'attributes':[_0x1fb1('0x3a'),_0x1fb1('0xbd'),_0x1fb1('0xbe')],'required':![]},{'model':db[_0x1fb1('0xbf')],'as':_0x1fb1('0xc0'),'attributes':['id','name',_0x1fb1('0xc1')],'where':_0x57e1a8['query'][_0x1fb1('0xc2')]?{'id':_0x57e1a8['query']['tag']}:undefined,'required':_0x57e1a8[_0x1fb1('0x45')][_0x1fb1('0xc2')]?!![]:![]}];}return db['SmsInteraction'][_0x1fb1('0x70')](_0x4659f8);})['then'](function(_0x247ea5){_0x157a42[_0x1fb1('0x57')]=_0x247ea5;return _0x157a42;});}})[_0x1fb1('0x22')](respondWithFilteredResult(_0x525967,_0x4659f8))[_0x1fb1('0x2b')](handleError(_0x525967,null));};exports[_0x1fb1('0xb2')]=function(_0x221cd0,_0x511a2f,_0x4a7ab4){var _0x101d0b,_0x5402db,_0x435cad;if(_[_0x1fb1('0x92')](_0x221cd0[_0x1fb1('0x5d')]['body'])||_0x221cd0[_0x1fb1('0x5d')][_0x1fb1('0x5d')]===''){throw new db['Sequelize']['ValidationError'](_0x1fb1('0x94'));}if(_['isNil'](_0x221cd0[_0x1fb1('0x5d')]['to'])){throw new db[(_0x1fb1('0x1e'))][(_0x1fb1('0x1f'))](_0x1fb1('0xc3'));}_0x101d0b=_0x221cd0[_0x1fb1('0x5d')]['to'];return db['SmsAccount']['find']({'where':{'id':_0x221cd0[_0x1fb1('0x59')]['id']},'include':[{'model':db[_0x1fb1('0x98')],'as':_0x1fb1('0xc4'),'include':[{'model':db[_0x1fb1('0x78')],'as':_0x1fb1('0x99'),'where':{'mobile':_0x101d0b},'limit':0x1,'order':[[_0x1fb1('0x7b'),'DESC']]}]}]})[_0x1fb1('0x22')](handleEntityNotFound(_0x511a2f,null))[_0x1fb1('0x22')](function(_0x37bddc){if(_0x37bddc&&_0x37bddc[_0x1fb1('0xc4')]){_0x5402db=_0x37bddc[_0x1fb1('0x37')]({'plain':!![]});if(_0x5402db[_0x1fb1('0xc4')]&&_0x5402db['List'][_0x1fb1('0x99')]['length']){return _0x5402db[_0x1fb1('0xc4')][_0x1fb1('0x99')][0x0];}return db[_0x1fb1('0x78')][_0x1fb1('0x5c')](_[_0x1fb1('0x17')](_0x221cd0[_0x1fb1('0x5d')],{'firstName':_0x101d0b,'mobile':_0x101d0b,'phone':_0x101d0b,'ListId':_0x5402db['ListId']}));}})['then'](handleEntityNotFound(_0x511a2f,null))[_0x1fb1('0x22')](function(_0x1504f2){if(_0x1504f2){_0x435cad=_0x1504f2;return db['SmsInteraction']['find']({'where':{'ContactId':_0x435cad['id'],'closed':![],'SmsAccountId':_0x5402db['id']}})[_0x1fb1('0x22')](function(_0x50aced){if(_0x50aced){return[_0x50aced,![]];}return db[_0x1fb1('0x9d')][_0x1fb1('0x5c')]({'UserId':_0x221cd0[_0x1fb1('0x5e')]['id'],'ContactId':_0x435cad['id'],'SmsAccountId':_0x5402db['id'],'phone':_0x101d0b,'firstMsgDirection':'out','Messages':[_['merge'](_0x221cd0[_0x1fb1('0x5d')],{'read':![],'body':_0x221cd0[_0x1fb1('0x5d')]['body'],'phone':_0x101d0b,'SmsAccountId':_0x5402db['id'],'UserId':_0x221cd0[_0x1fb1('0x5e')]['id'],'ContactId':_0x435cad['id']})]},{'include':[{'model':db[_0x1fb1('0xa4')],'as':'Messages'}]})[_0x1fb1('0x22')](function(_0x4f2297){return[_0x4f2297,!![]];});});}})[_0x1fb1('0x9e')](function(_0x369407,_0xe7e766){if(_0xe7e766){return _0x369407;}return db[_0x1fb1('0xa4')][_0x1fb1('0x5c')](_[_0x1fb1('0x52')](_0x221cd0[_0x1fb1('0x5d')],{'read':![],'body':_0x221cd0['body'][_0x1fb1('0x5d')],'phone':_0x101d0b,'SmsAccountId':_0x5402db['id'],'SmsInteractionId':_0x369407['id'],'UserId':_0x221cd0[_0x1fb1('0x5e')]['id'],'ContactId':_0x435cad['id']}))[_0x1fb1('0x22')](function(_0x323648){_0x369407[_0x1fb1('0xc5')][_0x1fb1('0xc6')]=[];_0x369407[_0x1fb1('0xc5')][_0x1fb1('0xc6')][_0x1fb1('0xc7')](_0x323648[_0x1fb1('0xc5')]);return _0x369407;});})[_0x1fb1('0x22')](respondWithResult(_0x511a2f,null))[_0x1fb1('0x2b')](handleError(_0x511a2f,null));};exports['status']=function(_0x52dcfd,_0x1ebe1d,_0x1bc737){if(_0x52dcfd[_0x1fb1('0x5d')]['id']){delete _0x52dcfd[_0x1fb1('0x5d')]['id'];}console[_0x1fb1('0xc8')](_0x1fb1('0xc9'),_0x52dcfd[_0x1fb1('0x5d')]);var _0x209473,_0x5471af,_0x1e1db5;return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x52dcfd[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x1ebe1d,null))[_0x1fb1('0x22')](function(_0x15c90e){if(_0x15c90e){_0x1e1db5=_0x15c90e;logger[_0x1fb1('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1fb1('0x2d'),_0x1fb1('0xca'),_0x15c90e[_0x1fb1('0x42')],util[_0x1fb1('0xcb')](_0x52dcfd[_0x1fb1('0x5d')],{'showHidden':![],'depth':null}));switch(_0x15c90e['type']){case _0x1fb1('0x85'):if(_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xcc')]&&_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x2d')]){_0x5471af=_0x52dcfd['body']['status'];return db[_0x1fb1('0xa4')][_0x1fb1('0x5b')]({'where':{'messageId':_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xcc')]}});}break;case _0x1fb1('0x87'):if(_0x52dcfd[_0x1fb1('0x5d')]['requestid']&&_0x52dcfd[_0x1fb1('0x5d')]['statusInt']){_0x5471af=_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xcd')];return db['SmsMessage'][_0x1fb1('0x5b')]({'where':{'messageId':_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xce')]}});}break;case'clicksend':if(_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x88')]&&_0x52dcfd[_0x1fb1('0x5d')]['status_code']){_0x5471af=_0x52dcfd[_0x1fb1('0x5d')]['status_code'];return db['SmsMessage']['find']({'where':{'messageId':_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x88')]}});}break;case _0x1fb1('0xcf'):var _0x498f6d=_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x8b')][0x0];if(_0x498f6d['messageId']&&_0x498f6d['status'][_0x1fb1('0xd0')]===_0x1fb1('0xd1')){_0x5471af=_0x498f6d[_0x1fb1('0x2d')][_0x1fb1('0xd0')];return db['SmsMessage'][_0x1fb1('0x5b')]({'where':{'messageId':_0x498f6d[_0x1fb1('0x83')]}});}break;case _0x1fb1('0xd2'):if(_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x83')]&&_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x2d')]){_0x5471af=_0x52dcfd['body']['status'];return db[_0x1fb1('0xa4')][_0x1fb1('0x5b')]({'where':{'messageId':_0x52dcfd['body'][_0x1fb1('0x83')]}});}break;case _0x1fb1('0x91'):if(_0x52dcfd[_0x1fb1('0x5d')]['redif']&&_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x2d')]){_0x5471af=_0x52dcfd[_0x1fb1('0x5d')]['status'];return db[_0x1fb1('0xa4')][_0x1fb1('0x5b')]({'where':{'messageId':_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xd3')]}});}break;}}})[_0x1fb1('0x22')](handleEntityNotFound(_0x1ebe1d,null))[_0x1fb1('0x22')](function(_0x4e2d38){if(_0x4e2d38){_0x209473=_0x4e2d38;switch(_0x1e1db5[_0x1fb1('0x42')]){case _0x1fb1('0x85'):if(_0x5471af===_0x1fb1('0xd1')){return _0x209473[_0x1fb1('0x36')]({'read':!![]});}else{logger[_0x1fb1('0x27')](_0x1fb1('0x24'),'status',_0x1fb1('0x85'),util[_0x1fb1('0xcb')](_0x52dcfd[_0x1fb1('0x5d')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x5471af==='1'){return _0x209473[_0x1fb1('0x36')]({'read':!![]});}else{logger[_0x1fb1('0x27')](_0x1fb1('0x24'),_0x1fb1('0x2d'),_0x1fb1('0x85'),util[_0x1fb1('0xcb')](_0x52dcfd['body'],{'showHidden':![],'depth':null}));}break;case _0x1fb1('0xd4'):if(!_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0xd5')]&&_0x5471af>=0xc8&&_0x5471af<=0xce){return _0x209473[_0x1fb1('0x36')]({'read':!![]});}else{logger[_0x1fb1('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1fb1('0x2d'),_0x1fb1('0xd4'),util['inspect'](_0x52dcfd[_0x1fb1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1fb1('0xcf'):var _0x661901=_0x52dcfd[_0x1fb1('0x5d')][_0x1fb1('0x8b')][0x0];if(_0x661901['status'][_0x1fb1('0xd0')]===_0x1fb1('0xd1')){return _0x209473['update']({'read':!![]});}else{logger[_0x1fb1('0x27')](_0x1fb1('0x24'),'status',_0x1fb1('0xcf'),util[_0x1fb1('0xcb')](_0x52dcfd[_0x1fb1('0x5d')],{'showHidden':![],'depth':null}));}break;case _0x1fb1('0xd2'):if(_0x5471af==_0x1fb1('0xd6')||_0x5471af==_0x1fb1('0xd7')){return _0x209473['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1fb1('0x2d'),_0x1fb1('0xd2'),util[_0x1fb1('0xcb')](_0x52dcfd['body'],{'showHidden':![],'depth':null}));}break;case _0x1fb1('0x91'):if(_0x5471af===_0x1fb1('0xd8')||_0x5471af==='ACCEPTD'){return _0x209473['update']({'read':!![]});}else{logger[_0x1fb1('0x27')](_0x1fb1('0x24'),_0x1fb1('0x2d'),_0x1fb1('0x91'),util[_0x1fb1('0xcb')](_0x52dcfd[_0x1fb1('0x5d')],{'showHidden':![],'depth':null}));}break;}return _0x209473;}})['then'](respondWithResult(_0x1ebe1d,null))['catch'](handleError(_0x1ebe1d,null));};exports['statusGet']=function(_0x1d679c,_0x3c71f1,_0x253fbe){var _0x40057e,_0x1503d4,_0x113a93;return db['SmsAccount'][_0x1fb1('0x5b')]({'where':{'id':_0x1d679c[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x3c71f1,null))[_0x1fb1('0x22')](function(_0x5c687c){if(_0x5c687c){_0x113a93=_0x5c687c;logger[_0x1fb1('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x1fb1('0x2d'),'received\x20delivery\x20report\x20from',_0x5c687c[_0x1fb1('0x42')],util[_0x1fb1('0xcb')](_0x1d679c['query'],{'showHidden':![],'depth':null}));switch(_0x5c687c[_0x1fb1('0x42')]){case _0x1fb1('0x8d'):if(_0x1d679c[_0x1fb1('0x45')]['message-id']&&_0x1d679c[_0x1fb1('0x45')][_0x1fb1('0xd9')]){_0x1503d4=_0x1d679c[_0x1fb1('0x45')][_0x1fb1('0xd9')];return db[_0x1fb1('0xa4')][_0x1fb1('0x5b')]({'where':{'messageId':_0x1d679c[_0x1fb1('0x45')][_0x1fb1('0xda')]}});}break;}}})[_0x1fb1('0x22')](handleEntityNotFound(_0x3c71f1,null))['then'](function(_0x43c64f){if(_0x43c64f){_0x40057e=_0x43c64f;switch(_0x113a93[_0x1fb1('0x42')]){case _0x1fb1('0x8d'):if(_0x1503d4==='2'||_0x1503d4==='6'){return _0x40057e['update']({'read':!![]});}else{logger[_0x1fb1('0x27')](_0x1fb1('0x24'),_0x1fb1('0x2d'),'csc',util[_0x1fb1('0xcb')](_0x1d679c[_0x1fb1('0x45')],{'showHidden':![],'depth':null}));};break;}return _0x40057e;}})['then'](respondWithResult(_0x3c71f1,null))[_0x1fb1('0x2b')](handleError(_0x3c71f1,null));};exports['addAgents']=function(_0x15e286,_0x16f4c8,_0x3bcb0f){return db['SmsAccount'][_0x1fb1('0x5b')]({'where':{'id':_0x15e286[_0x1fb1('0x59')]['id']}})['then'](handleEntityNotFound(_0x16f4c8,null))[_0x1fb1('0x22')](function(_0x45d48d){if(_0x45d48d){return _0x45d48d[_0x1fb1('0xdb')](_0x15e286[_0x1fb1('0x5d')]['ids'],_[_0x1fb1('0x9b')](_0x15e286[_0x1fb1('0x5d')],['ids','id'])||{})[_0x1fb1('0x9e')](function(_0x4a738e){for(var _0xd50a60=0x0;_0xd50a60<_0x15e286[_0x1fb1('0x5d')][_0x1fb1('0x6e')][_0x1fb1('0x4a')];_0xd50a60+=0x1){socket[_0x1fb1('0xdc')](_0x1fb1('0xdd'),{'UserId':_0x15e286[_0x1fb1('0x5d')][_0x1fb1('0x6e')][_0xd50a60],'SmsAccountId':_0x15e286['params']['id']});}return _0x4a738e;});}})[_0x1fb1('0x22')](respondWithResult(_0x16f4c8,null))[_0x1fb1('0x2b')](handleError(_0x16f4c8,null));};exports[_0x1fb1('0xde')]=function(_0x2f43bb,_0x5c5cbc,_0x2038dc){return db[_0x1fb1('0x3f')][_0x1fb1('0x5b')]({'where':{'id':_0x2f43bb[_0x1fb1('0x59')]['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x5c5cbc,null))[_0x1fb1('0x22')](function(_0x441bd3){if(_0x441bd3){return _0x441bd3['removeAgents'](_0x2f43bb[_0x1fb1('0x45')][_0x1fb1('0x6e')])['then'](function(){if(_[_0x1fb1('0xdf')](_0x2f43bb[_0x1fb1('0x45')][_0x1fb1('0x6e')])){for(var _0x131387=0x0;_0x131387<_0x2f43bb['query'][_0x1fb1('0x6e')][_0x1fb1('0x4a')];_0x131387+=0x1){socket[_0x1fb1('0xdc')](_0x1fb1('0xe0'),{'UserId':Number(_0x2f43bb[_0x1fb1('0x45')][_0x1fb1('0x6e')][_0x131387]),'SmsAccountId':Number(_0x2f43bb[_0x1fb1('0x59')]['id'])});}}else{socket['emit'](_0x1fb1('0xe0'),{'UserId':Number(_0x2f43bb[_0x1fb1('0x45')][_0x1fb1('0x6e')]),'SmsAccountId':Number(_0x2f43bb[_0x1fb1('0x59')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c5cbc,null))['catch'](handleError(_0x5c5cbc,null));};exports['getAgents']=function(_0x3a94ec,_0x11182d,_0x12089e){var _0x253276={};var _0x421c7c={};var _0x23886a;var _0x37c1c3;return db[_0x1fb1('0x3f')][_0x1fb1('0x6a')]({'where':{'id':_0x3a94ec['params']['id']}})[_0x1fb1('0x22')](handleEntityNotFound(_0x11182d,null))[_0x1fb1('0x22')](function(_0x3cbc09){if(_0x3cbc09){_0x23886a=_0x3cbc09;_0x421c7c[_0x1fb1('0x44')]=_[_0x1fb1('0x5a')](db[_0x1fb1('0xbb')][_0x1fb1('0x40')]);_0x421c7c[_0x1fb1('0x45')]=_['keys'](_0x3a94ec[_0x1fb1('0x45')]);_0x421c7c[_0x1fb1('0x46')]=_[_0x1fb1('0x47')](_0x421c7c[_0x1fb1('0x44')],_0x421c7c[_0x1fb1('0x45')]);_0x253276[_0x1fb1('0x49')]=_[_0x1fb1('0x47')](_0x421c7c[_0x1fb1('0x44')],qs['fields'](_0x3a94ec[_0x1fb1('0x45')]['fields']));_0x253276['attributes']=_0x253276[_0x1fb1('0x49')][_0x1fb1('0x4a')]?_0x253276[_0x1fb1('0x49')]:_0x421c7c[_0x1fb1('0x44')];_0x253276[_0x1fb1('0x4d')]=qs['sort'](_0x3a94ec[_0x1fb1('0x45')][_0x1fb1('0x4e')]);_0x253276['where']=qs[_0x1fb1('0x46')](_[_0x1fb1('0x50')](_0x3a94ec[_0x1fb1('0x45')],_0x421c7c[_0x1fb1('0x46')]));if(_0x3a94ec['query'][_0x1fb1('0x51')]){_0x253276[_0x1fb1('0x4f')]=_[_0x1fb1('0x52')](_0x253276[_0x1fb1('0x4f')],{'$or':_[_0x1fb1('0x3e')](_0x253276[_0x1fb1('0x49')],function(_0x2db82d){var _0x30b78b={};_0x30b78b[_0x2db82d]={'$like':'%'+_0x3a94ec[_0x1fb1('0x45')]['filter']+'%'};return _0x30b78b;})});}_0x253276=_[_0x1fb1('0x52')]({},_0x253276,_0x3a94ec[_0x1fb1('0x54')]);return _0x23886a[_0x1fb1('0xe1')](_0x253276);}})[_0x1fb1('0x22')](function(_0x51bfc0){if(_0x51bfc0){_0x37c1c3=_0x51bfc0[_0x1fb1('0x4a')];if(!_0x3a94ec[_0x1fb1('0x45')][_0x1fb1('0x4b')](_0x1fb1('0x6b'))){_0x253276[_0x1fb1('0x4c')]=qs[_0x1fb1('0x4c')](_0x3a94ec[_0x1fb1('0x45')][_0x1fb1('0x4c')]);_0x253276['offset']=qs[_0x1fb1('0x31')](_0x3a94ec[_0x1fb1('0x45')][_0x1fb1('0x31')]);}return _0x23886a['getAgents'](_0x253276);}})[_0x1fb1('0x22')](function(_0x2c5aa9){if(_0x2c5aa9){return _0x2c5aa9?{'count':_0x37c1c3,'rows':_0x2c5aa9}:null;}})[_0x1fb1('0x22')](respondWithResult(_0x11182d,null))['catch'](handleError(_0x11182d,null));}; \ No newline at end of file +var _0x9158=['rows','show','params','length','includeAll','find','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','UserProfileSection','userProfileId','autoAssociation','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','mandatoryDispositionPause','describe','SmsAccountId','Disposition','getDispositions','findOne','nolimit','pick','removeDispositions','ids','addAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','updatedAt','difference','createdAt','CompanyId','mobile','From','Body','messageId','MessageSid','from','sender','text','connectel','clicksend','plivo','Text','MessageUUID','infobip','results','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','ListId','Contacts','DESC','omit','defaults','contact','SmsInteraction','spread','interaction','created','push','close','unmanaged','*,*,*,*','ContactId','UserId','User','waitForTheAssignedAgent','startRouting','Start','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','\x0a','sequelize','transaction','findAndCountAll','getApplications','getInteractions','CmContact','fullname','Tag','Tags','color','tag','to\x20is\x20mandatory','CmList','List','out','SmsMessage','Messages','dataValues','log','received\x20delivery\x20report\x20from','inspect','skebby','requestid','message_id','status_code','groupName','DELIVERED','redif','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','DELIVRD','ACCEPTD','statusGet','csc','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','html-pdf','eml-format','rimraf','fast-json-patch','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','register','client','http','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','end','status','json','count','offset','limit','apply','reject','save','update','destroy','SmsAccounts','UserProfileResource','stack','name','send','index','Pause','rawAttributes','fieldName','type','map','keys','query','model','intersection','fields','attributes','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','SmsAccount','include','findAll'];(function(_0x4f2473,_0x37e8b8){var _0x12d48c=function(_0x571ea1){while(--_0x571ea1){_0x4f2473['push'](_0x4f2473['shift']());}};_0x12d48c(++_0x37e8b8);}(_0x9158,0x16e));var _0x8915=function(_0x59cbb5,_0x456513){_0x59cbb5=_0x59cbb5-0x0;var _0x3a8975=_0x9158[_0x59cbb5];return _0x3a8975;};'use strict';var pdf=require(_0x8915('0x0'));var emlformat=require(_0x8915('0x1'));var rimraf=require(_0x8915('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8915('0x3'));var rp=require('request-promise');var moment=require(_0x8915('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x8915('0x5'));var path=require(_0x8915('0x6'));var sox=require(_0x8915('0x7'));var csv=require(_0x8915('0x8'));var ejs=require(_0x8915('0x9'));var fs=require('fs');var _=require(_0x8915('0xa'));var squel=require(_0x8915('0xb'));var crypto=require(_0x8915('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8915('0xd'));var toCsv=require(_0x8915('0x8'));var querystring=require(_0x8915('0xe'));var Papa=require(_0x8915('0xf'));var Redis=require(_0x8915('0x10'));var authService=require(_0x8915('0x11'));var qs=require(_0x8915('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8915('0x13'))(_0x8915('0x14'));var utils=require(_0x8915('0x15'));var config=require(_0x8915('0x16'));var db=require(_0x8915('0x17'))['db'];config[_0x8915('0x18')]=_['defaults'](config[_0x8915('0x18')],{'host':_0x8915('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8915('0x18')]));require('./smsAccount.socket')[_0x8915('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x8915('0x1b')][_0x8915('0x1c')]({'port':0x232c});function checkPasswordPattern(_0x2bc051,_0x430741,_0x8dff4d){if(_0x8dff4d){var _0x57c012=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x57c012[_0x8915('0x1d')](_0x430741)){return _0x2bc051;}else{throw new db[(_0x8915('0x1e'))][(_0x8915('0x1f'))](_0x8915('0x20'));}}else{return _0x2bc051;}}function respondWithRpcPromise(_0x2a0514,_0x57e453,_0x1a0e04,_0x913dc){return new BPromise(function(_0x5ccd36,_0x5987d4){var _0x17bb6c=_0x913dc||client;return _0x17bb6c[_0x8915('0x21')](_0x2a0514,_0x1a0e04)[_0x8915('0x22')](function(_0x19d295){logger[_0x8915('0x23')](_0x8915('0x24'),_0x57e453,_0x8915('0x25'));logger[_0x8915('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x57e453,'request\x20sent',JSON[_0x8915('0x27')](_0x19d295));if(_0x19d295[_0x8915('0x28')]){if(_0x19d295[_0x8915('0x28')][_0x8915('0x29')]===0x1f4){logger['error'](_0x8915('0x24'),_0x57e453,_0x19d295[_0x8915('0x28')][_0x8915('0x2a')]);return _0x5987d4(_0x19d295[_0x8915('0x28')][_0x8915('0x2a')]);}logger[_0x8915('0x28')](_0x8915('0x24'),_0x57e453,_0x19d295[_0x8915('0x28')]['message']);return _0x5ccd36(_0x19d295[_0x8915('0x28')]['message']);}else{logger[_0x8915('0x23')](_0x8915('0x24'),_0x57e453,'request\x20sent');_0x5ccd36(_0x19d295[_0x8915('0x2b')][_0x8915('0x2a')]);}})[_0x8915('0x2c')](function(_0x404266){logger[_0x8915('0x28')](_0x8915('0x24'),_0x57e453,_0x404266);_0x5987d4(_0x404266);});});}function respondWithStatusCode(_0x49373f,_0x5ea00f){_0x5ea00f=_0x5ea00f||0xcc;return function(_0x12e91f){if(_0x12e91f){return _0x49373f[_0x8915('0x2d')](_0x5ea00f);}return _0x49373f['status'](_0x5ea00f)[_0x8915('0x2e')]();};}function respondWithResult(_0x54d3c7,_0x3b133c){_0x3b133c=_0x3b133c||0xc8;return function(_0x5d0447){if(_0x5d0447){return _0x54d3c7[_0x8915('0x2f')](_0x3b133c)[_0x8915('0x30')](_0x5d0447);}};}function respondWithFilteredResult(_0x4f50df,_0x33c87f){return function(_0x2ebc38){if(_0x2ebc38){var _0x18296c=_0x2ebc38[_0x8915('0x31')],_0xff80f5=_0x33c87f['offset'],_0xd3eccb=_0x33c87f[_0x8915('0x32')]+_0x33c87f[_0x8915('0x33')],_0x492fa7;if(_0xd3eccb>=_0x18296c){_0xd3eccb=_0x18296c;_0x492fa7=0xc8;}else{_0x492fa7=0xce;}_0x4f50df[_0x8915('0x2f')](_0x492fa7);return _0x4f50df['set']('Content-Range',_0xff80f5+'-'+_0xd3eccb+'/'+_0x18296c)[_0x8915('0x30')](_0x2ebc38);}return null;};}function patchUpdates(_0x42d20c){return function(_0x55775d){try{jsonpatch[_0x8915('0x34')](_0x55775d,_0x42d20c,!![]);}catch(_0x4e6868){return BPromise[_0x8915('0x35')](_0x4e6868);}return _0x55775d[_0x8915('0x36')]();};}function saveUpdates(_0x404c9c,_0xca39df){return function(_0x1b0025){if(_0x1b0025){return _0x1b0025[_0x8915('0x37')](_0x404c9c)[_0x8915('0x22')](function(_0x158151){return _0x158151;});}return null;};}function removeEntity(_0x28f0d0,_0x1bc7e7){return function(_0x4e8426){if(_0x4e8426){return _0x4e8426[_0x8915('0x38')]()[_0x8915('0x22')](function(){var _0x13c810=_0x4e8426['get']({'plain':!![]});var _0x58ecf4=_0x8915('0x39');return db[_0x8915('0x3a')][_0x8915('0x38')]({'where':{'type':_0x58ecf4,'resourceId':_0x13c810['id']}})[_0x8915('0x22')](function(){return _0x4e8426;});})[_0x8915('0x22')](function(){_0x28f0d0[_0x8915('0x2f')](0xcc)[_0x8915('0x2e')]();});}};}function handleEntityNotFound(_0x50d9c0,_0x388843){return function(_0x444c42){if(!_0x444c42){_0x50d9c0[_0x8915('0x2d')](0x194);}return _0x444c42;};}function handleError(_0x15f1d4,_0x2e55c0){_0x2e55c0=_0x2e55c0||0x1f4;return function(_0x1e8ccb){logger[_0x8915('0x28')](_0x1e8ccb[_0x8915('0x3b')]);if(_0x1e8ccb[_0x8915('0x3c')]){delete _0x1e8ccb[_0x8915('0x3c')];}_0x15f1d4[_0x8915('0x2f')](_0x2e55c0)[_0x8915('0x3d')](_0x1e8ccb);};}exports[_0x8915('0x3e')]=function(_0x5e7a61,_0x1cb7da){var _0x4caed3={'include':[{'model':db[_0x8915('0x3f')],'as':'mandatoryDispositionPause'}]},_0x764d8a={},_0x2e075e={'count':0x0,'rows':[]};var _0x245343=_['map'](db['SmsAccount'][_0x8915('0x40')],function(_0x1c7a10){return{'name':_0x1c7a10[_0x8915('0x41')],'type':_0x1c7a10[_0x8915('0x42')]['key']};});_0x764d8a['model']=_[_0x8915('0x43')](_0x245343,_0x8915('0x3c'));_0x764d8a['query']=_[_0x8915('0x44')](_0x5e7a61[_0x8915('0x45')]);_0x764d8a['filters']=_['intersection'](_0x764d8a[_0x8915('0x46')],_0x764d8a[_0x8915('0x45')]);_0x4caed3['attributes']=_[_0x8915('0x47')](_0x764d8a['model'],qs[_0x8915('0x48')](_0x5e7a61[_0x8915('0x45')][_0x8915('0x48')]));_0x4caed3[_0x8915('0x49')]=_0x4caed3[_0x8915('0x49')]['length']?_0x4caed3[_0x8915('0x49')]:_0x764d8a[_0x8915('0x46')];if(!_0x5e7a61[_0x8915('0x45')][_0x8915('0x4a')]('nolimit')){_0x4caed3[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x5e7a61['query'][_0x8915('0x33')]);_0x4caed3[_0x8915('0x32')]=qs['offset'](_0x5e7a61['query'][_0x8915('0x32')]);}_0x4caed3[_0x8915('0x4b')]=qs[_0x8915('0x4c')](_0x5e7a61[_0x8915('0x45')][_0x8915('0x4c')]);_0x4caed3['where']=qs[_0x8915('0x4d')](_['pick'](_0x5e7a61[_0x8915('0x45')],_0x764d8a[_0x8915('0x4d')]));if(_0x5e7a61[_0x8915('0x45')][_0x8915('0x4e')]){_0x4caed3[_0x8915('0x4f')]=_[_0x8915('0x50')](_0x4caed3[_0x8915('0x4f')],{'$or':_['map'](_0x245343,function(_0xdb24e){if(_0xdb24e[_0x8915('0x42')]!==_0x8915('0x51')){var _0xed24a9={};_0xed24a9[_0xdb24e[_0x8915('0x3c')]]={'$like':'%'+_0x5e7a61[_0x8915('0x45')][_0x8915('0x4e')]+'%'};return _0xed24a9;}})});}_0x4caed3=_['merge']({},_0x4caed3,_0x5e7a61[_0x8915('0x52')]);var _0x2d2ea4={'where':_0x4caed3[_0x8915('0x4f')]};return db[_0x8915('0x53')][_0x8915('0x31')](_0x2d2ea4)['then'](function(_0x4ccb94){_0x2e075e[_0x8915('0x31')]=_0x4ccb94;if(_0x5e7a61[_0x8915('0x45')]['includeAll']){_0x4caed3[_0x8915('0x54')]=[{'all':!![]}];}return db[_0x8915('0x53')][_0x8915('0x55')](_0x4caed3);})['then'](function(_0x3763d6){_0x2e075e[_0x8915('0x56')]=_0x3763d6;return _0x2e075e;})['then'](respondWithFilteredResult(_0x1cb7da,_0x4caed3))[_0x8915('0x2c')](handleError(_0x1cb7da,null));};exports[_0x8915('0x57')]=function(_0x20c198,_0x33e91e){var _0x5a2822={'raw':![],'where':{'id':_0x20c198[_0x8915('0x58')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x47ce7c={};_0x47ce7c[_0x8915('0x46')]=_[_0x8915('0x44')](db[_0x8915('0x53')][_0x8915('0x40')]);_0x47ce7c[_0x8915('0x45')]=_[_0x8915('0x44')](_0x20c198[_0x8915('0x45')]);_0x47ce7c[_0x8915('0x4d')]=_['intersection'](_0x47ce7c[_0x8915('0x46')],_0x47ce7c[_0x8915('0x45')]);_0x5a2822[_0x8915('0x49')]=_[_0x8915('0x47')](_0x47ce7c[_0x8915('0x46')],qs[_0x8915('0x48')](_0x20c198[_0x8915('0x45')][_0x8915('0x48')]));_0x5a2822[_0x8915('0x49')]=_0x5a2822[_0x8915('0x49')][_0x8915('0x59')]?_0x5a2822['attributes']:_0x47ce7c['model'];if(_0x20c198[_0x8915('0x45')][_0x8915('0x5a')]){_0x5a2822[_0x8915('0x54')]=[{'all':!![]}];}_0x5a2822=_[_0x8915('0x50')]({},_0x5a2822,_0x20c198[_0x8915('0x52')]);return db[_0x8915('0x53')][_0x8915('0x5b')](_0x5a2822)[_0x8915('0x22')](handleEntityNotFound(_0x33e91e,null))[_0x8915('0x22')](respondWithResult(_0x33e91e,null))[_0x8915('0x2c')](handleError(_0x33e91e,null));};exports['create']=function(_0x26d035,_0x5f2df2){return db['SmsAccount']['create'](_0x26d035[_0x8915('0x5c')],{})[_0x8915('0x22')](function(_0x3b5ef6){var _0x4d4f85=_0x26d035[_0x8915('0x5d')]['get']({'plain':!![]});if(!_0x4d4f85)throw new Error(_0x8915('0x5e'));if(_0x4d4f85[_0x8915('0x5f')]==='user'){var _0x309faa=_0x3b5ef6[_0x8915('0x60')]({'plain':!![]});var _0x375c75=_0x8915('0x39');return db[_0x8915('0x61')]['find']({'where':{'name':_0x375c75,'userProfileId':_0x4d4f85[_0x8915('0x62')]},'raw':!![]})[_0x8915('0x22')](function(_0x38ad88){if(_0x38ad88&&_0x38ad88[_0x8915('0x63')]===0x0){return db[_0x8915('0x3a')][_0x8915('0x64')]({'name':_0x309faa[_0x8915('0x3c')],'resourceId':_0x309faa['id'],'type':_0x38ad88[_0x8915('0x3c')],'sectionId':_0x38ad88['id']},{})['then'](function(){return _0x3b5ef6;});}else{return _0x3b5ef6;}})[_0x8915('0x2c')](function(_0x5adb88){logger[_0x8915('0x28')](_0x8915('0x65'),_0x5adb88);throw _0x5adb88;});}return _0x3b5ef6;})['then'](respondWithResult(_0x5f2df2,0xc9))[_0x8915('0x2c')](handleError(_0x5f2df2,null));};exports[_0x8915('0x37')]=function(_0x2d1694,_0xb9a64d){if(_0x2d1694[_0x8915('0x5c')]['id']){delete _0x2d1694[_0x8915('0x5c')]['id'];}return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x2d1694[_0x8915('0x58')]['id']},'include':[{'model':db[_0x8915('0x3f')],'as':_0x8915('0x66')}]})['then'](handleEntityNotFound(_0xb9a64d,null))[_0x8915('0x22')](saveUpdates(_0x2d1694[_0x8915('0x5c')],null))[_0x8915('0x22')](respondWithResult(_0xb9a64d,null))['catch'](handleError(_0xb9a64d,null));};exports[_0x8915('0x38')]=function(_0x6c8883,_0x1b19fc){return db['SmsAccount'][_0x8915('0x5b')]({'where':{'id':_0x6c8883[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x1b19fc,null))[_0x8915('0x22')](removeEntity(_0x1b19fc,null))[_0x8915('0x2c')](handleError(_0x1b19fc,null));};exports[_0x8915('0x67')]=function(_0x3bf252,_0x4a1611){return db[_0x8915('0x53')][_0x8915('0x67')]()[_0x8915('0x22')](respondWithResult(_0x4a1611,null))[_0x8915('0x2c')](handleError(_0x4a1611,null));};exports['addDisposition']=function(_0x4912c1,_0x6fdd9e,_0xdd709c){if(_0x4912c1['body']['id']){delete _0x4912c1[_0x8915('0x5c')]['id'];}return db[_0x8915('0x53')]['find']({'where':{'id':_0x4912c1[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x6fdd9e,null))[_0x8915('0x22')](function(_0xd25c52){if(_0xd25c52){_0x4912c1[_0x8915('0x5c')][_0x8915('0x68')]=_0xd25c52['id'];return db[_0x8915('0x69')][_0x8915('0x64')](_0x4912c1[_0x8915('0x5c')]);}})[_0x8915('0x22')](respondWithResult(_0x6fdd9e,null))[_0x8915('0x2c')](handleError(_0x6fdd9e,null));};exports[_0x8915('0x6a')]=function(_0x305fdf,_0x1fd4cc,_0x2f1fc8){var _0x830289={'raw':![],'where':{}};var _0x73aec5={};var _0x556082={'count':0x0,'rows':[]};return db['SmsAccount'][_0x8915('0x6b')]({'where':{'id':_0x305fdf[_0x8915('0x58')]['id']}})['then'](handleEntityNotFound(_0x1fd4cc,null))[_0x8915('0x22')](function(_0x4b61a0){if(_0x4b61a0){_0x73aec5[_0x8915('0x46')]=_['keys'](db[_0x8915('0x69')][_0x8915('0x40')]);_0x73aec5[_0x8915('0x45')]=_[_0x8915('0x44')](_0x305fdf['query']);_0x73aec5['filters']=_[_0x8915('0x47')](_0x73aec5[_0x8915('0x46')],_0x73aec5[_0x8915('0x45')]);_0x830289['attributes']=_['intersection'](_0x73aec5[_0x8915('0x46')],qs['fields'](_0x305fdf[_0x8915('0x45')][_0x8915('0x48')]));_0x830289[_0x8915('0x49')]=_0x830289[_0x8915('0x49')][_0x8915('0x59')]?_0x830289[_0x8915('0x49')]:_0x73aec5['model'];if(!_0x305fdf['query'][_0x8915('0x4a')](_0x8915('0x6c'))){_0x830289[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x305fdf[_0x8915('0x45')][_0x8915('0x33')]);_0x830289[_0x8915('0x32')]=qs['offset'](_0x305fdf[_0x8915('0x45')][_0x8915('0x32')]);}_0x830289[_0x8915('0x4b')]=qs[_0x8915('0x4c')](_0x305fdf[_0x8915('0x45')][_0x8915('0x4c')]);_0x830289[_0x8915('0x4f')]=qs[_0x8915('0x4d')](_[_0x8915('0x6d')](_0x305fdf[_0x8915('0x45')],_0x73aec5['filters']));_0x830289[_0x8915('0x4f')][_0x8915('0x68')]=_0x4b61a0['id'];if(_0x305fdf[_0x8915('0x45')][_0x8915('0x4e')]){_0x830289[_0x8915('0x4f')]=_[_0x8915('0x50')](_0x830289[_0x8915('0x4f')],{'$or':_[_0x8915('0x43')](_0x830289[_0x8915('0x49')],function(_0x2a6d83){var _0x455ad1={};_0x455ad1[_0x2a6d83]={'$like':'%'+_0x305fdf['query']['filter']+'%'};return _0x455ad1;})});}_0x830289=_['merge']({},_0x830289,_0x305fdf[_0x8915('0x52')]);return db[_0x8915('0x69')]['count']({'where':_0x830289['where']})[_0x8915('0x22')](function(_0x636cac){_0x556082[_0x8915('0x31')]=_0x636cac;if(_0x305fdf[_0x8915('0x45')][_0x8915('0x5a')]){_0x830289[_0x8915('0x54')]=[{'all':!![]}];}return db[_0x8915('0x69')]['findAll'](_0x830289);})[_0x8915('0x22')](function(_0x44d65f){_0x556082[_0x8915('0x56')]=_0x44d65f;return _0x556082;});}})[_0x8915('0x22')](respondWithFilteredResult(_0x1fd4cc,_0x830289))[_0x8915('0x2c')](handleError(_0x1fd4cc,null));};exports[_0x8915('0x6e')]=function(_0x2ea13e,_0x425ca6,_0x1795cb){return db['SmsAccount'][_0x8915('0x5b')]({'where':{'id':_0x2ea13e['params']['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x425ca6,null))[_0x8915('0x22')](function(_0x2c8db8){if(_0x2c8db8){return _0x2c8db8[_0x8915('0x6e')](_0x2ea13e[_0x8915('0x45')][_0x8915('0x6f')]);}})[_0x8915('0x22')](respondWithStatusCode(_0x425ca6,null))[_0x8915('0x2c')](handleError(_0x425ca6,null));};exports[_0x8915('0x70')]=function(_0x3450dd,_0x9b7cfa,_0x1a51c0){if(_0x3450dd[_0x8915('0x5c')]['id']){delete _0x3450dd[_0x8915('0x5c')]['id'];}return db['SmsAccount'][_0x8915('0x5b')]({'where':{'id':_0x3450dd[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x9b7cfa,null))[_0x8915('0x22')](function(_0x1c85d5){if(_0x1c85d5){_0x3450dd[_0x8915('0x5c')][_0x8915('0x68')]=_0x1c85d5['id'];return db['CannedAnswer'][_0x8915('0x64')](_0x3450dd[_0x8915('0x5c')]);}})[_0x8915('0x22')](respondWithResult(_0x9b7cfa,null))['catch'](handleError(_0x9b7cfa,null));};exports[_0x8915('0x71')]=function(_0x202075,_0x4cbd38,_0xdc805d){var _0x48a068={'raw':![],'where':{}};var _0x4f4f50={};var _0x5de639={'count':0x0,'rows':[]};return db[_0x8915('0x53')][_0x8915('0x6b')]({'where':{'id':_0x202075[_0x8915('0x58')]['id']}})['then'](handleEntityNotFound(_0x4cbd38,null))[_0x8915('0x22')](function(_0x345d17){if(_0x345d17){_0x4f4f50[_0x8915('0x46')]=_['keys'](db['CannedAnswer']['rawAttributes']);_0x4f4f50[_0x8915('0x45')]=_[_0x8915('0x44')](_0x202075[_0x8915('0x45')]);_0x4f4f50['filters']=_[_0x8915('0x47')](_0x4f4f50[_0x8915('0x46')],_0x4f4f50['query']);_0x48a068['attributes']=_[_0x8915('0x47')](_0x4f4f50[_0x8915('0x46')],qs[_0x8915('0x48')](_0x202075[_0x8915('0x45')][_0x8915('0x48')]));_0x48a068[_0x8915('0x49')]=_0x48a068[_0x8915('0x49')][_0x8915('0x59')]?_0x48a068[_0x8915('0x49')]:_0x4f4f50[_0x8915('0x46')];if(!_0x202075['query'][_0x8915('0x4a')](_0x8915('0x6c'))){_0x48a068[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x202075[_0x8915('0x45')][_0x8915('0x33')]);_0x48a068[_0x8915('0x32')]=qs['offset'](_0x202075['query'][_0x8915('0x32')]);}_0x48a068[_0x8915('0x4b')]=qs['sort'](_0x202075[_0x8915('0x45')][_0x8915('0x4c')]);_0x48a068[_0x8915('0x4f')]=qs[_0x8915('0x4d')](_[_0x8915('0x6d')](_0x202075[_0x8915('0x45')],_0x4f4f50[_0x8915('0x4d')]));_0x48a068['where']['SmsAccountId']=_0x345d17['id'];if(_0x202075[_0x8915('0x45')][_0x8915('0x4e')]){_0x48a068[_0x8915('0x4f')]=_[_0x8915('0x50')](_0x48a068['where'],{'$or':_[_0x8915('0x43')](_0x48a068[_0x8915('0x49')],function(_0x38fa7f){var _0x209799={};_0x209799[_0x38fa7f]={'$like':'%'+_0x202075['query'][_0x8915('0x4e')]+'%'};return _0x209799;})});}_0x48a068=_[_0x8915('0x50')]({},_0x48a068,_0x202075[_0x8915('0x52')]);return db['CannedAnswer'][_0x8915('0x31')]({'where':_0x48a068[_0x8915('0x4f')]})[_0x8915('0x22')](function(_0xf8d778){_0x5de639[_0x8915('0x31')]=_0xf8d778;if(_0x202075[_0x8915('0x45')][_0x8915('0x5a')]){_0x48a068[_0x8915('0x54')]=[{'all':!![]}];}return db['CannedAnswer'][_0x8915('0x55')](_0x48a068);})[_0x8915('0x22')](function(_0x30018c){_0x5de639['rows']=_0x30018c;return _0x5de639;});}})['then'](respondWithFilteredResult(_0x4cbd38,_0x48a068))['catch'](handleError(_0x4cbd38,null));};exports[_0x8915('0x72')]=function(_0x23dfad,_0x2a1828,_0x3573ed){return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x23dfad[_0x8915('0x58')]['id']}})['then'](handleEntityNotFound(_0x2a1828,null))[_0x8915('0x22')](function(_0x3d2d89){if(_0x3d2d89){return _0x3d2d89[_0x8915('0x72')](_0x23dfad[_0x8915('0x45')][_0x8915('0x6f')]);}})[_0x8915('0x22')](respondWithStatusCode(_0x2a1828,null))['catch'](handleError(_0x2a1828,null));};exports[_0x8915('0x73')]=function(_0x5194f2,_0x2d3e5e,_0x15d523){var _0xbcaeb9={'channel':_0x8915('0x74')};var _0x352c39=[];var _0x4520a5=[];var _0x25056f={};return db['SmsAccount'][_0x8915('0x5b')]({'where':{'id':_0x5194f2['params']['id']},'include':[{'model':db[_0x8915('0x75')],'as':_0x8915('0x76')}]})[_0x8915('0x22')](handleEntityNotFound(_0x2d3e5e,null))[_0x8915('0x22')](function(_0x3ba5e8){_0xbcaeb9[_0x8915('0x77')]=_0x3ba5e8;_0xbcaeb9[_0x8915('0x78')]=_[_0x8915('0x79')](_0x3ba5e8[_0x8915('0x76')],[_0x8915('0x7a')],[_0x8915('0x7b')]);if(_0xbcaeb9[_0x8915('0x77')][_0x8915('0x76')]){delete _0xbcaeb9[_0x8915('0x77')][_0x8915('0x76')];}return db['CmContact'][_0x8915('0x67')]();})['then'](function(_0x1fe13e){if(!_0x1fe13e){throw new db[(_0x8915('0x1e'))][(_0x8915('0x1f'))]('no\x20available\x20attributes');}_0x352c39=_['difference'](_[_0x8915('0x44')](_0x1fe13e),['createdAt',_0x8915('0x7c')]);_0x4520a5=_[_0x8915('0x7d')](_['keys'](_0x1fe13e),[_0x8915('0x7e'),_0x8915('0x7c'),_0x8915('0x7f'),'ListId']);_0xbcaeb9[_0x8915('0x5c')]={'mapKey':_0x8915('0x80')};if(_0xbcaeb9[_0x8915('0x77')][_0x8915('0x42')]){switch(_0xbcaeb9[_0x8915('0x77')]['type']){case'twilio':_0xbcaeb9['body']['from']=_0x5194f2[_0x8915('0x5c')][_0x8915('0x81')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x82')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x83')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x84')];break;case'skebby':_0xbcaeb9['body'][_0x8915('0x85')]='+'+_0x5194f2[_0x8915('0x5c')][_0x8915('0x86')];_0xbcaeb9['body'][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x87')];break;case _0x8915('0x88'):_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')]=_0x5194f2[_0x8915('0x5c')]['from'];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x2a')];break;case _0x8915('0x89'):_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')]=_0x5194f2['body'][_0x8915('0x85')];_0xbcaeb9[_0x8915('0x5c')]['body']=_0x5194f2[_0x8915('0x5c')]['body'];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x83')]=_0x5194f2[_0x8915('0x5c')]['message_id'];break;case _0x8915('0x8a'):_0xbcaeb9[_0x8915('0x5c')]['from']=_0x5194f2[_0x8915('0x5c')][_0x8915('0x81')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x8b')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x83')]=_0x5194f2['body'][_0x8915('0x8c')];break;case _0x8915('0x8d'):_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')]='+'+_0x5194f2['body'][_0x8915('0x8e')][0x0][_0x8915('0x85')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x8e')][0x0]['text'];_0xbcaeb9['body'][_0x8915('0x83')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x8e')][0x0][_0x8915('0x83')];break;case'csc':_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x8f')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x90')][_0x8915('0x2a')];break;case _0x8915('0x91'):_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x92')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x87')];_0xbcaeb9['body'][_0x8915('0x83')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x93')];break;case _0x8915('0x94'):_0xbcaeb9[_0x8915('0x5c')]['from']=_0x5194f2[_0x8915('0x5c')][_0x8915('0x85')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x2a')];_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x83')]=_0x5194f2[_0x8915('0x5c')][_0x8915('0x95')];break;}}if(_0xbcaeb9[_0x8915('0x5c')]['id']){delete _0xbcaeb9[_0x8915('0x5c')]['id'];}if(_[_0x8915('0x96')](_0xbcaeb9['body'][_0x8915('0x85')])){throw new db['Sequelize']['ValidationError'](_0x8915('0x97'));}if(_['isNil'](_0xbcaeb9[_0x8915('0x5c')]['body'])||_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x5c')]===''){throw new db['Sequelize']['ValidationError'](_0x8915('0x98'));}if(_['isNil'](_0xbcaeb9['body'][_0x8915('0x99')])){throw new db['Sequelize'][(_0x8915('0x1f'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4520a5);}if(!_[_0x8915('0x9a')](_0x4520a5,_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x99')])){throw new db['Sequelize'][(_0x8915('0x1f'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x4520a5);}_0x25056f[_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x99')]]=_0xbcaeb9[_0x8915('0x5c')]['from'];return db['CmList'][_0x8915('0x5b')]({'where':{'id':_0xbcaeb9['account'][_0x8915('0x9b')]},'include':[{'model':db['CmContact'],'as':_0x8915('0x9c'),'where':_0x25056f,'limit':0x1,'order':[['updatedAt',_0x8915('0x9d')]]}]});})[_0x8915('0x22')](handleEntityNotFound(_0x2d3e5e,null))[_0x8915('0x22')](function(_0x4b4d76){if(_0x4b4d76){_0xbcaeb9['list']=_[_0x8915('0x9e')](_0x4b4d76,[_0x8915('0x9c')]);if(_0x4b4d76[_0x8915('0x9c')][_0x8915('0x59')]){return _0x4b4d76['Contacts'][0x0];}var _0x389f05=_[_0x8915('0x9f')](_0xbcaeb9[_0x8915('0x5c')],{'firstName':_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')],'ListId':_0x4b4d76['id']});_0x389f05[_0xbcaeb9['body'][_0x8915('0x99')]]=_0xbcaeb9['body']['from'];return db['CmContact'][_0x8915('0x64')](_0x389f05,{'fields':_0x352c39,'raw':!![]});}})[_0x8915('0x22')](handleEntityNotFound(_0x2d3e5e,null))[_0x8915('0x22')](function(_0x324f1c){if(_0x324f1c){_0xbcaeb9[_0x8915('0xa0')]=_0x324f1c;var _0x333a4d={'ContactId':_0x324f1c['id'],'phone':_0xbcaeb9[_0x8915('0x5c')][_0x8915('0x85')],'SmsAccountId':_0x5194f2[_0x8915('0x58')]['id']};var _0x175268={'ContactId':_0x324f1c['id'],'SmsAccountId':_0x5194f2[_0x8915('0x58')]['id'],'closed':![]};return db[_0x8915('0xa1')][_0x8915('0x5b')]({'where':_0x175268})[_0x8915('0x22')](function(_0x5c8002){if(_0x5c8002){return[_0x5c8002,![]];}return db[_0x8915('0xa1')]['create'](_0x333a4d)[_0x8915('0x22')](function(_0x1a9d98){return[_0x1a9d98,!![]];});});}})[_0x8915('0xa2')](function(_0x7916c7,_0x4a7687){_0xbcaeb9[_0x8915('0xa3')]=_0x7916c7[_0x8915('0x60')]({'plain':!![]});_0xbcaeb9['interaction'][_0x8915('0xa4')]=![];if(_0x4a7687){if(_0xbcaeb9['account']['autoclose']){_0xbcaeb9[_0x8915('0x78')][_0x8915('0xa5')]({'id':0x0,'priority':_0xbcaeb9['applications'][_0x8915('0x59')]+0x1,'app':_0x8915('0xa6'),'appdata':_0x8915('0xa7'),'interval':_0x8915('0xa8')});}_0xbcaeb9[_0x8915('0xa3')]['created']=!![];}return db['SmsMessage'][_0x8915('0x64')]({'phone':_0xbcaeb9[_0x8915('0x5c')]['from'],'messageId':_0xbcaeb9['body'][_0x8915('0x83')],'body':_0xbcaeb9['body']['body'],'SmsAccountId':_0x5194f2[_0x8915('0x58')]['id'],'SmsInteractionId':_0x7916c7['id'],'direction':'in','ContactId':_0x7916c7[_0x8915('0xa9')],'AttachmentId':_0xbcaeb9[_0x8915('0x5c')]['AttachmentId']});})[_0x8915('0x22')](function(_0x212458){_0xbcaeb9[_0x8915('0x2a')]=_0x212458;if(_0xbcaeb9['interaction'][_0x8915('0xaa')]){return db[_0x8915('0xab')]['find']({'attributes':['id',_0x8915('0x3c')],'where':{'id':_0xbcaeb9[_0x8915('0xa3')][_0x8915('0xaa')]}})[_0x8915('0x22')](function(_0x23c9fb){if(_0x23c9fb){_0xbcaeb9[_0x8915('0x78')]['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x23c9fb[_0x8915('0x3c')]+','+(_0xbcaeb9[_0x8915('0x77')][_0x8915('0xac')]||0xa),'interval':_0x8915('0xa8')});}return respondWithRpcPromise('Start',_0x8915('0xad'),_0xbcaeb9);});}return respondWithRpcPromise(_0x8915('0xae'),_0x8915('0xad'),_0xbcaeb9);})[_0x8915('0x22')](function(_0xaadd4e){if(_0xaadd4e){var _0x6bac88=0xc8;var _0x6217c4=_0x8915('0xaf');logger[_0x8915('0x23')](_0x8915('0xb0'),_0x6217c4,_0x6bac88,_0x8915('0xb1'));logger['debug'](_0x8915('0xb2'),_0x6217c4,_0x6bac88,_0x8915('0xb1'),JSON[_0x8915('0x27')](_0xaadd4e));if(_0xbcaeb9['account']['type']==='twilio'){return _0x2d3e5e[_0x8915('0x2f')](_0x6bac88)[_0x8915('0xb3')](_0x8915('0xb4'),'text/xml')[_0x8915('0x3d')](_0x8915('0xb5'));}else{return _0x2d3e5e[_0x8915('0x2f')](_0x6bac88)[_0x8915('0x30')](_0xaadd4e);}}})[_0x8915('0x2c')](handleError(_0x2d3e5e,null));};exports['addApplications']=function(_0x1eec15,_0x53ca6f,_0x493627){return db[_0x8915('0x53')][_0x8915('0x6b')]({'where':{'id':_0x1eec15[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x53ca6f,null))[_0x8915('0x22')](function(_0x5cafd5){if(_0x5cafd5){return db[_0x8915('0xb6')][_0x8915('0xb7')](function(_0x32f55d){return db[_0x8915('0x75')][_0x8915('0x38')]({'where':{'SmsAccountId':_0x1eec15['params']['id']},'transaction':_0x32f55d})['then'](function(_0x53c20c){var _0x2f58d8=_[_0x8915('0x43')](_0x1eec15[_0x8915('0x5c')],function(_0x32a63c){_0x32a63c['SmsAccountId']=_0x1eec15[_0x8915('0x58')]['id'];return _0x32a63c;});return db[_0x8915('0x75')]['bulkCreate'](_0x2f58d8,{'transaction':_0x32f55d});});})[_0x8915('0x22')](function(){return db[_0x8915('0x75')][_0x8915('0xb8')]({'where':{'SmsAccountId':_0x1eec15['params']['id']},'order':_0x8915('0x7a')});});}})['then'](respondWithResult(_0x53ca6f,null))[_0x8915('0x2c')](handleError(_0x53ca6f,null));};exports[_0x8915('0xb9')]=function(_0x5d9fee,_0x52a8b6,_0x1bbd82){var _0x32517f={};var _0x416328={};var _0x7c45fb;var _0x32d4c1;return db[_0x8915('0x53')]['findOne']({'where':{'id':_0x5d9fee[_0x8915('0x58')]['id']}})['then'](handleEntityNotFound(_0x52a8b6,null))[_0x8915('0x22')](function(_0x4e51a5){if(_0x4e51a5){_0x7c45fb=_0x4e51a5;_0x416328[_0x8915('0x46')]=_['keys'](db['SmsApplication'][_0x8915('0x40')]);_0x416328[_0x8915('0x45')]=_[_0x8915('0x44')](_0x5d9fee[_0x8915('0x45')]);_0x416328['filters']=_[_0x8915('0x47')](_0x416328[_0x8915('0x46')],_0x416328[_0x8915('0x45')]);_0x32517f[_0x8915('0x49')]=_['intersection'](_0x416328[_0x8915('0x46')],qs[_0x8915('0x48')](_0x5d9fee[_0x8915('0x45')][_0x8915('0x48')]));_0x32517f[_0x8915('0x49')]=_0x32517f[_0x8915('0x49')][_0x8915('0x59')]?_0x32517f[_0x8915('0x49')]:_0x416328[_0x8915('0x46')];_0x32517f[_0x8915('0x4b')]=qs['sort'](_0x5d9fee[_0x8915('0x45')][_0x8915('0x4c')]);_0x32517f[_0x8915('0x4f')]=qs[_0x8915('0x4d')](_[_0x8915('0x6d')](_0x5d9fee[_0x8915('0x45')],_0x416328[_0x8915('0x4d')]));if(_0x5d9fee[_0x8915('0x45')][_0x8915('0x4e')]){_0x32517f[_0x8915('0x4f')]=_['merge'](_0x32517f[_0x8915('0x4f')],{'$or':_[_0x8915('0x43')](_0x32517f[_0x8915('0x49')],function(_0x36423b){var _0x26ba09={};_0x26ba09[_0x36423b]={'$like':'%'+_0x5d9fee[_0x8915('0x45')][_0x8915('0x4e')]+'%'};return _0x26ba09;})});}_0x32517f=_['merge']({},_0x32517f,_0x5d9fee[_0x8915('0x52')]);return _0x7c45fb[_0x8915('0xb9')](_0x32517f);}})[_0x8915('0x22')](function(_0x2e27d1){if(_0x2e27d1){_0x32d4c1=_0x2e27d1[_0x8915('0x59')];if(!_0x5d9fee[_0x8915('0x45')][_0x8915('0x4a')](_0x8915('0x6c'))){_0x32517f[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x5d9fee['query'][_0x8915('0x33')]);_0x32517f[_0x8915('0x32')]=qs['offset'](_0x5d9fee[_0x8915('0x45')][_0x8915('0x32')]);}return _0x7c45fb[_0x8915('0xb9')](_0x32517f);}})[_0x8915('0x22')](function(_0x4d56c9){if(_0x4d56c9){return _0x4d56c9?{'count':_0x32d4c1,'rows':_0x4d56c9}:null;}})[_0x8915('0x22')](respondWithResult(_0x52a8b6,null))[_0x8915('0x2c')](handleError(_0x52a8b6,null));};exports[_0x8915('0xba')]=function(_0x550462,_0x40c4ad,_0x2a6610){var _0x287dad={'raw':![],'where':{}};var _0x5c5786={};var _0x5b3204={'count':0x0,'rows':[]};return db[_0x8915('0x53')][_0x8915('0x6b')]({'where':{'id':_0x550462[_0x8915('0x58')]['id']}})['then'](handleEntityNotFound(_0x40c4ad,null))[_0x8915('0x22')](function(_0x4e3fe0){if(_0x4e3fe0){_0x5c5786[_0x8915('0x46')]=_[_0x8915('0x44')](db['SmsInteraction'][_0x8915('0x40')]);_0x5c5786['query']=_[_0x8915('0x44')](_0x550462[_0x8915('0x45')]);_0x5c5786[_0x8915('0x4d')]=_['intersection'](_0x5c5786[_0x8915('0x46')],_0x5c5786[_0x8915('0x45')]);_0x287dad[_0x8915('0x49')]=_[_0x8915('0x47')](_0x5c5786[_0x8915('0x46')],qs[_0x8915('0x48')](_0x550462[_0x8915('0x45')][_0x8915('0x48')]));_0x287dad[_0x8915('0x49')]=_0x287dad['attributes'][_0x8915('0x59')]?_0x287dad[_0x8915('0x49')]:_0x5c5786['model'];if(!_0x550462[_0x8915('0x45')][_0x8915('0x4a')](_0x8915('0x6c'))){_0x287dad['limit']=qs[_0x8915('0x33')](_0x550462[_0x8915('0x45')][_0x8915('0x33')]);_0x287dad['offset']=qs['offset'](_0x550462['query'][_0x8915('0x32')]);}_0x287dad[_0x8915('0x4b')]=qs['sort'](_0x550462[_0x8915('0x45')][_0x8915('0x4c')]);_0x287dad[_0x8915('0x4f')]=qs['filters'](_['pick'](_0x550462['query'],_0x5c5786[_0x8915('0x4d')]));_0x287dad[_0x8915('0x4f')][_0x8915('0x68')]=_0x4e3fe0['id'];if(_0x550462[_0x8915('0x45')][_0x8915('0x4e')]){_0x287dad[_0x8915('0x4f')]=_[_0x8915('0x50')](_0x287dad['where'],{'$or':_[_0x8915('0x43')](_0x287dad[_0x8915('0x49')],function(_0x172098){var _0x2bbb4b={};_0x2bbb4b[_0x172098]={'$like':'%'+_0x550462[_0x8915('0x45')][_0x8915('0x4e')]+'%'};return _0x2bbb4b;})});}_0x287dad=_[_0x8915('0x50')]({},_0x287dad,_0x550462[_0x8915('0x52')]);return db[_0x8915('0xa1')][_0x8915('0x31')]({'where':_0x287dad[_0x8915('0x4f')]})[_0x8915('0x22')](function(_0x2c2a80){_0x5b3204[_0x8915('0x31')]=_0x2c2a80;if(_0x550462[_0x8915('0x45')][_0x8915('0x5a')]){_0x287dad['include']=[{'model':db[_0x8915('0xbb')],'as':'Contact','required':![]},{'model':db[_0x8915('0xab')],'as':'Owner','attributes':[_0x8915('0x3c'),_0x8915('0xbc'),'internal'],'required':![]},{'model':db[_0x8915('0xbd')],'as':_0x8915('0xbe'),'attributes':['id','name',_0x8915('0xbf')],'where':_0x550462[_0x8915('0x45')][_0x8915('0xc0')]?{'id':_0x550462[_0x8915('0x45')]['tag']}:undefined,'required':_0x550462[_0x8915('0x45')][_0x8915('0xc0')]?!![]:![]}];}return db['SmsInteraction'][_0x8915('0x55')](_0x287dad);})['then'](function(_0x3fd707){_0x5b3204['rows']=_0x3fd707;return _0x5b3204;});}})[_0x8915('0x22')](respondWithFilteredResult(_0x40c4ad,_0x287dad))[_0x8915('0x2c')](handleError(_0x40c4ad,null));};exports['send']=function(_0x293233,_0x2ae593,_0x386810){var _0x14e88,_0x2320f6,_0x3dae87;if(_[_0x8915('0x96')](_0x293233[_0x8915('0x5c')][_0x8915('0x5c')])||_0x293233[_0x8915('0x5c')][_0x8915('0x5c')]===''){throw new db[(_0x8915('0x1e'))]['ValidationError'](_0x8915('0x98'));}if(_['isNil'](_0x293233[_0x8915('0x5c')]['to'])){throw new db[(_0x8915('0x1e'))]['ValidationError'](_0x8915('0xc1'));}_0x14e88=_0x293233['body']['to'];return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x293233[_0x8915('0x58')]['id']},'include':[{'model':db[_0x8915('0xc2')],'as':'List','include':[{'model':db['CmContact'],'as':_0x8915('0x9c'),'where':{'mobile':_0x14e88},'limit':0x1,'order':[[_0x8915('0x7c'),'DESC']]}]}]})[_0x8915('0x22')](handleEntityNotFound(_0x2ae593,null))[_0x8915('0x22')](function(_0x4cd6a9){if(_0x4cd6a9&&_0x4cd6a9[_0x8915('0xc3')]){_0x2320f6=_0x4cd6a9[_0x8915('0x60')]({'plain':!![]});if(_0x2320f6[_0x8915('0xc3')]&&_0x2320f6[_0x8915('0xc3')][_0x8915('0x9c')]['length']){return _0x2320f6[_0x8915('0xc3')][_0x8915('0x9c')][0x0];}return db['CmContact'][_0x8915('0x64')](_['defaults'](_0x293233[_0x8915('0x5c')],{'firstName':_0x14e88,'mobile':_0x14e88,'phone':_0x14e88,'ListId':_0x2320f6['ListId']}));}})[_0x8915('0x22')](handleEntityNotFound(_0x2ae593,null))[_0x8915('0x22')](function(_0x5edfab){if(_0x5edfab){_0x3dae87=_0x5edfab;return db[_0x8915('0xa1')]['find']({'where':{'ContactId':_0x3dae87['id'],'closed':![],'SmsAccountId':_0x2320f6['id']}})[_0x8915('0x22')](function(_0x4a5bcc){if(_0x4a5bcc){return[_0x4a5bcc,![]];}return db['SmsInteraction'][_0x8915('0x64')]({'UserId':_0x293233[_0x8915('0x5d')]['id'],'ContactId':_0x3dae87['id'],'SmsAccountId':_0x2320f6['id'],'phone':_0x14e88,'firstMsgDirection':_0x8915('0xc4'),'Messages':[_[_0x8915('0x50')](_0x293233['body'],{'read':![],'body':_0x293233[_0x8915('0x5c')][_0x8915('0x5c')],'phone':_0x14e88,'SmsAccountId':_0x2320f6['id'],'UserId':_0x293233[_0x8915('0x5d')]['id'],'ContactId':_0x3dae87['id']})]},{'include':[{'model':db[_0x8915('0xc5')],'as':_0x8915('0xc6')}]})[_0x8915('0x22')](function(_0xd53f1b){return[_0xd53f1b,!![]];});});}})[_0x8915('0xa2')](function(_0x714d7c,_0x22c80e){if(_0x22c80e){return _0x714d7c;}return db[_0x8915('0xc5')][_0x8915('0x64')](_[_0x8915('0x50')](_0x293233['body'],{'read':![],'body':_0x293233[_0x8915('0x5c')][_0x8915('0x5c')],'phone':_0x14e88,'SmsAccountId':_0x2320f6['id'],'SmsInteractionId':_0x714d7c['id'],'UserId':_0x293233[_0x8915('0x5d')]['id'],'ContactId':_0x3dae87['id']}))[_0x8915('0x22')](function(_0x5e8a84){_0x714d7c[_0x8915('0xc7')]['Messages']=[];_0x714d7c['dataValues'][_0x8915('0xc6')][_0x8915('0xa5')](_0x5e8a84[_0x8915('0xc7')]);return _0x714d7c;});})['then'](respondWithResult(_0x2ae593,null))[_0x8915('0x2c')](handleError(_0x2ae593,null));};exports['status']=function(_0x5cec46,_0x5eb4da,_0x117211){if(_0x5cec46[_0x8915('0x5c')]['id']){delete _0x5cec46[_0x8915('0x5c')]['id'];}console[_0x8915('0xc8')]('endpoint\x20/status\x20POST\x20/',_0x5cec46['body']);var _0x161632,_0x34cfea,_0x501671;return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x5cec46[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x5eb4da,null))[_0x8915('0x22')](function(_0x3243be){if(_0x3243be){_0x501671=_0x3243be;logger['debug'](_0x8915('0xb0'),'status',_0x8915('0xc9'),_0x3243be[_0x8915('0x42')],util[_0x8915('0xca')](_0x5cec46[_0x8915('0x5c')],{'showHidden':![],'depth':null}));switch(_0x3243be[_0x8915('0x42')]){case _0x8915('0xcb'):if(_0x5cec46[_0x8915('0x5c')]['skebby_dispatch_id']&&_0x5cec46['body'][_0x8915('0x2f')]){_0x34cfea=_0x5cec46[_0x8915('0x5c')][_0x8915('0x2f')];return db[_0x8915('0xc5')]['find']({'where':{'messageId':_0x5cec46['body']['skebby_dispatch_id']}});}break;case _0x8915('0x88'):if(_0x5cec46[_0x8915('0x5c')][_0x8915('0xcc')]&&_0x5cec46[_0x8915('0x5c')]['statusInt']){_0x34cfea=_0x5cec46[_0x8915('0x5c')]['statusInt'];return db[_0x8915('0xc5')][_0x8915('0x5b')]({'where':{'messageId':_0x5cec46[_0x8915('0x5c')][_0x8915('0xcc')]}});}break;case _0x8915('0x89'):if(_0x5cec46['body'][_0x8915('0xcd')]&&_0x5cec46['body']['status_code']){_0x34cfea=_0x5cec46[_0x8915('0x5c')][_0x8915('0xce')];return db[_0x8915('0xc5')][_0x8915('0x5b')]({'where':{'messageId':_0x5cec46[_0x8915('0x5c')]['message_id']}});}break;case _0x8915('0x8d'):var _0x39061f=_0x5cec46[_0x8915('0x5c')]['results'][0x0];if(_0x39061f['messageId']&&_0x39061f[_0x8915('0x2f')][_0x8915('0xcf')]===_0x8915('0xd0')){_0x34cfea=_0x39061f[_0x8915('0x2f')][_0x8915('0xcf')];return db['SmsMessage'][_0x8915('0x5b')]({'where':{'messageId':_0x39061f[_0x8915('0x83')]}});}break;case _0x8915('0x91'):if(_0x5cec46[_0x8915('0x5c')][_0x8915('0x83')]&&_0x5cec46[_0x8915('0x5c')][_0x8915('0x2f')]){_0x34cfea=_0x5cec46[_0x8915('0x5c')][_0x8915('0x2f')];return db['SmsMessage']['find']({'where':{'messageId':_0x5cec46[_0x8915('0x5c')][_0x8915('0x83')]}});}break;case _0x8915('0x94'):if(_0x5cec46[_0x8915('0x5c')][_0x8915('0xd1')]&&_0x5cec46[_0x8915('0x5c')]['status']){_0x34cfea=_0x5cec46[_0x8915('0x5c')]['status'];return db[_0x8915('0xc5')]['find']({'where':{'messageId':_0x5cec46['body']['redif']}});}break;}}})[_0x8915('0x22')](handleEntityNotFound(_0x5eb4da,null))['then'](function(_0x477c69){if(_0x477c69){_0x161632=_0x477c69;switch(_0x501671[_0x8915('0x42')]){case _0x8915('0xcb'):if(_0x34cfea===_0x8915('0xd0')){return _0x161632[_0x8915('0x37')]({'read':!![]});}else{logger['error'](_0x8915('0xb0'),_0x8915('0x2f'),_0x8915('0xcb'),util[_0x8915('0xca')](_0x5cec46['body'],{'showHidden':![],'depth':null}));}break;case _0x8915('0x88'):if(_0x34cfea==='1'){return _0x161632[_0x8915('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8915('0x2f'),_0x8915('0xcb'),util[_0x8915('0xca')](_0x5cec46[_0x8915('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8915('0x89'):if(!_0x5cec46[_0x8915('0x5c')][_0x8915('0xd2')]&&_0x34cfea>=0xc8&&_0x34cfea<=0xce){return _0x161632[_0x8915('0x37')]({'read':!![]});}else{logger[_0x8915('0x28')](_0x8915('0xb0'),_0x8915('0x2f'),_0x8915('0x89'),util[_0x8915('0xca')](_0x5cec46[_0x8915('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8915('0x8d'):var _0x2af3c7=_0x5cec46['body'][_0x8915('0x8e')][0x0];if(_0x2af3c7[_0x8915('0x2f')][_0x8915('0xcf')]===_0x8915('0xd0')){return _0x161632[_0x8915('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8915('0x2f'),'infobip',util[_0x8915('0xca')](_0x5cec46[_0x8915('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x8915('0x91'):if(_0x34cfea==_0x8915('0xd3')||_0x34cfea==_0x8915('0xd4')){return _0x161632['update']({'read':!![]});}else{logger[_0x8915('0x28')](_0x8915('0xb0'),_0x8915('0x2f'),'clickatell',util['inspect'](_0x5cec46['body'],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0x34cfea===_0x8915('0xd5')||_0x34cfea===_0x8915('0xd6')){return _0x161632[_0x8915('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x8915('0x2f'),_0x8915('0x94'),util[_0x8915('0xca')](_0x5cec46[_0x8915('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x161632;}})[_0x8915('0x22')](respondWithResult(_0x5eb4da,null))[_0x8915('0x2c')](handleError(_0x5eb4da,null));};exports[_0x8915('0xd7')]=function(_0x124838,_0x304262,_0x59a92b){var _0xe45af3,_0x1636f1,_0x31ea9f;return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x124838[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0x304262,null))[_0x8915('0x22')](function(_0x3da1da){if(_0x3da1da){_0x31ea9f=_0x3da1da;logger[_0x8915('0x26')](_0x8915('0xb0'),_0x8915('0x2f'),_0x8915('0xc9'),_0x3da1da[_0x8915('0x42')],util[_0x8915('0xca')](_0x124838[_0x8915('0x45')],{'showHidden':![],'depth':null}));switch(_0x3da1da['type']){case _0x8915('0xd8'):if(_0x124838[_0x8915('0x45')][_0x8915('0xd9')]&&_0x124838['query'][_0x8915('0xda')]){_0x1636f1=_0x124838['query'][_0x8915('0xda')];return db[_0x8915('0xc5')][_0x8915('0x5b')]({'where':{'messageId':_0x124838[_0x8915('0x45')][_0x8915('0xd9')]}});}break;}}})[_0x8915('0x22')](handleEntityNotFound(_0x304262,null))[_0x8915('0x22')](function(_0x2fb62a){if(_0x2fb62a){_0xe45af3=_0x2fb62a;switch(_0x31ea9f[_0x8915('0x42')]){case _0x8915('0xd8'):if(_0x1636f1==='2'||_0x1636f1==='6'){return _0xe45af3[_0x8915('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x8915('0xd8'),util['inspect'](_0x124838[_0x8915('0x45')],{'showHidden':![],'depth':null}));};break;}return _0xe45af3;}})['then'](respondWithResult(_0x304262,null))['catch'](handleError(_0x304262,null));};exports[_0x8915('0xdb')]=function(_0x31aa55,_0xb248bd,_0x139bcc){return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x31aa55['params']['id']}})[_0x8915('0x22')](handleEntityNotFound(_0xb248bd,null))['then'](function(_0x69b1c0){if(_0x69b1c0){return _0x69b1c0['addAgents'](_0x31aa55[_0x8915('0x5c')]['ids'],_[_0x8915('0x9e')](_0x31aa55[_0x8915('0x5c')],[_0x8915('0x6f'),'id'])||{})[_0x8915('0xa2')](function(_0x1fce0d){for(var _0x39a040=0x0;_0x39a040<_0x31aa55[_0x8915('0x5c')]['ids'][_0x8915('0x59')];_0x39a040+=0x1){socket[_0x8915('0xdc')](_0x8915('0xdd'),{'UserId':_0x31aa55[_0x8915('0x5c')][_0x8915('0x6f')][_0x39a040],'SmsAccountId':_0x31aa55[_0x8915('0x58')]['id']});}return _0x1fce0d;});}})[_0x8915('0x22')](respondWithResult(_0xb248bd,null))['catch'](handleError(_0xb248bd,null));};exports[_0x8915('0xde')]=function(_0x77de65,_0xf563ca,_0x175038){return db[_0x8915('0x53')][_0x8915('0x5b')]({'where':{'id':_0x77de65[_0x8915('0x58')]['id']}})[_0x8915('0x22')](handleEntityNotFound(_0xf563ca,null))[_0x8915('0x22')](function(_0x2224b7){if(_0x2224b7){return _0x2224b7[_0x8915('0xde')](_0x77de65[_0x8915('0x45')]['ids'])['then'](function(){if(_[_0x8915('0xdf')](_0x77de65[_0x8915('0x45')][_0x8915('0x6f')])){for(var _0x4fad11=0x0;_0x4fad11<_0x77de65[_0x8915('0x45')][_0x8915('0x6f')][_0x8915('0x59')];_0x4fad11+=0x1){socket[_0x8915('0xdc')](_0x8915('0xe0'),{'UserId':Number(_0x77de65[_0x8915('0x45')][_0x8915('0x6f')][_0x4fad11]),'SmsAccountId':Number(_0x77de65['params']['id'])});}}else{socket[_0x8915('0xdc')](_0x8915('0xe0'),{'UserId':Number(_0x77de65[_0x8915('0x45')]['ids']),'SmsAccountId':Number(_0x77de65[_0x8915('0x58')]['id'])});}});}})[_0x8915('0x22')](respondWithStatusCode(_0xf563ca,null))[_0x8915('0x2c')](handleError(_0xf563ca,null));};exports['getAgents']=function(_0x202b44,_0x788b51,_0x21d9ac){var _0x3715c8={};var _0x7bcf94={};var _0x13a8f2;var _0x1de7a1;return db[_0x8915('0x53')][_0x8915('0x6b')]({'where':{'id':_0x202b44['params']['id']}})['then'](handleEntityNotFound(_0x788b51,null))[_0x8915('0x22')](function(_0x154e18){if(_0x154e18){_0x13a8f2=_0x154e18;_0x7bcf94[_0x8915('0x46')]=_[_0x8915('0x44')](db[_0x8915('0xab')][_0x8915('0x40')]);_0x7bcf94[_0x8915('0x45')]=_[_0x8915('0x44')](_0x202b44[_0x8915('0x45')]);_0x7bcf94[_0x8915('0x4d')]=_['intersection'](_0x7bcf94[_0x8915('0x46')],_0x7bcf94['query']);_0x3715c8['attributes']=_['intersection'](_0x7bcf94[_0x8915('0x46')],qs[_0x8915('0x48')](_0x202b44[_0x8915('0x45')]['fields']));_0x3715c8['attributes']=_0x3715c8[_0x8915('0x49')]['length']?_0x3715c8[_0x8915('0x49')]:_0x7bcf94[_0x8915('0x46')];_0x3715c8[_0x8915('0x4b')]=qs[_0x8915('0x4c')](_0x202b44[_0x8915('0x45')][_0x8915('0x4c')]);_0x3715c8[_0x8915('0x4f')]=qs['filters'](_[_0x8915('0x6d')](_0x202b44[_0x8915('0x45')],_0x7bcf94[_0x8915('0x4d')]));if(_0x202b44[_0x8915('0x45')][_0x8915('0x4e')]){_0x3715c8['where']=_[_0x8915('0x50')](_0x3715c8[_0x8915('0x4f')],{'$or':_[_0x8915('0x43')](_0x3715c8['attributes'],function(_0x286c68){var _0x114d0d={};_0x114d0d[_0x286c68]={'$like':'%'+_0x202b44[_0x8915('0x45')][_0x8915('0x4e')]+'%'};return _0x114d0d;})});}_0x3715c8=_['merge']({},_0x3715c8,_0x202b44[_0x8915('0x52')]);return _0x13a8f2['getAgents'](_0x3715c8);}})['then'](function(_0x584856){if(_0x584856){_0x1de7a1=_0x584856[_0x8915('0x59')];if(!_0x202b44[_0x8915('0x45')][_0x8915('0x4a')](_0x8915('0x6c'))){_0x3715c8[_0x8915('0x33')]=qs[_0x8915('0x33')](_0x202b44['query'][_0x8915('0x33')]);_0x3715c8[_0x8915('0x32')]=qs[_0x8915('0x32')](_0x202b44[_0x8915('0x45')][_0x8915('0x32')]);}return _0x13a8f2[_0x8915('0xe1')](_0x3715c8);}})[_0x8915('0x22')](function(_0x1d3c4d){if(_0x1d3c4d){return _0x1d3c4d?{'count':_0x1de7a1,'rows':_0x1d3c4d}:null;}})[_0x8915('0x22')](respondWithResult(_0x788b51,null))[_0x8915('0x2c')](handleError(_0x788b51,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 3e36bc5..4011f84 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 _0x3b4e=['emit','hasOwnProperty','exports','../../mysqldb','SmsAccount','setMaxListeners','save','update','remove'];(function(_0x483f75,_0x50e513){var _0x19343c=function(_0x1c6f26){while(--_0x1c6f26){_0x483f75['push'](_0x483f75['shift']());}};_0x19343c(++_0x50e513);}(_0x3b4e,0xae));var _0xe3b4=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x3b4e[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0xe3b4('0x0'))['db'][_0xe3b4('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xe3b4('0x2')](0x0);var events={'afterCreate':_0xe3b4('0x3'),'afterUpdate':_0xe3b4('0x4'),'afterDestroy':_0xe3b4('0x5')};function emitEvent(_0x220ef8){return function(_0x10f386,_0xa670ba,_0xeaa951){SmsAccountEvents[_0xe3b4('0x6')](_0x220ef8+':'+_0x10f386['id'],_0x10f386);SmsAccountEvents[_0xe3b4('0x6')](_0x220ef8,_0x10f386);_0xeaa951(null);};}for(var e in events){if(events[_0xe3b4('0x7')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0xe3b4('0x8')]=SmsAccountEvents; \ No newline at end of file +var _0x89e8=['remove','emit','hasOwnProperty','exports','../../mysqldb','SmsAccount','setMaxListeners','save'];(function(_0x58fa23,_0x5b7274){var _0x350932=function(_0x993740){while(--_0x993740){_0x58fa23['push'](_0x58fa23['shift']());}};_0x350932(++_0x5b7274);}(_0x89e8,0xf4));var _0x889e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x89e8[_0x501510];return _0x1e6ee5;};'use strict';var EventEmitter=require('events');var SmsAccount=require(_0x889e('0x0'))['db'][_0x889e('0x1')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x889e('0x2')](0x0);var events={'afterCreate':_0x889e('0x3'),'afterUpdate':'update','afterDestroy':_0x889e('0x4')};function emitEvent(_0xe41763){return function(_0x3accd2,_0x36e860,_0xcff662){SmsAccountEvents[_0x889e('0x5')](_0xe41763+':'+_0x3accd2['id'],_0x3accd2);SmsAccountEvents[_0x889e('0x5')](_0xe41763,_0x3accd2);_0xcff662(null);};}for(var e in events){if(events[_0x889e('0x6')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x889e('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 f04c6c1..7b86464 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 _0x001b=['lodash','util','api','moment','path','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts'];(function(_0x5f1391,_0x19c132){var _0x50ebe3=function(_0x3d00a3){while(--_0x3d00a3){_0x5f1391['push'](_0x5f1391['shift']());}};_0x50ebe3(++_0x19c132);}(_0x001b,0x79));var _0xb001=function(_0x606155,_0x3688a3){_0x606155=_0x606155-0x0;var _0x24ca91=_0x001b[_0x606155];return _0x24ca91;};'use strict';var _=require(_0xb001('0x0'));var util=require(_0xb001('0x1'));var logger=require('../../config/logger')(_0xb001('0x2'));var moment=require(_0xb001('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb001('0x4'));var rimraf=require(_0xb001('0x5'));var config=require(_0xb001('0x6'));var attributes=require('./smsAccount.attributes');module[_0xb001('0x7')]=function(_0x5ab4fd,_0x529262){return _0x5ab4fd[_0xb001('0x8')](_0xb001('0x9'),attributes,{'tableName':_0xb001('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabba=['moment','bluebird','request-promise','rimraf','../../config/environment','exports','define','SmsAccount','sms_accounts','util','../../config/logger','api'];(function(_0x213045,_0x4e2fc4){var _0x40c657=function(_0x5a3737){while(--_0x5a3737){_0x213045['push'](_0x213045['shift']());}};_0x40c657(++_0x4e2fc4);}(_0xabba,0x195));var _0xaabb=function(_0x2e5c2d,_0x48d0ff){_0x2e5c2d=_0x2e5c2d-0x0;var _0x4fd92=_0xabba[_0x2e5c2d];return _0x4fd92;};'use strict';var _=require('lodash');var util=require(_0xaabb('0x0'));var logger=require(_0xaabb('0x1'))(_0xaabb('0x2'));var moment=require(_0xaabb('0x3'));var BPromise=require(_0xaabb('0x4'));var rp=require(_0xaabb('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xaabb('0x6'));var config=require(_0xaabb('0x7'));var attributes=require('./smsAccount.attributes');module[_0xaabb('0x8')]=function(_0x44b755,_0x2dcb4d){return _0x44b755[_0xaabb('0x9')](_0xaabb('0xa'),attributes,{'tableName':_0xaabb('0xb'),'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 0901b8d..da2b1b9 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 _0x383b=['../../config/environment','jayson/promise','redis','defaults','./smsAccount.socket','request','info','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','find','options','raw','where','attributes','map','model','include','then','ShowSmsAccount','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4bbffb,_0x107d37){var _0x4e6dbd=function(_0x6b7581){while(--_0x6b7581){_0x4bbffb['push'](_0x4bbffb['shift']());}};_0x4e6dbd(++_0x107d37);}(_0x383b,0x110));var _0xb383=function(_0x40f482,_0x4d6efe){_0x40f482=_0x40f482-0x0;var _0x5bce67=_0x383b[_0x40f482];return _0x5bce67;};'use strict';var _=require(_0xb383('0x0'));var util=require(_0xb383('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb383('0x2'));var fs=require('fs');var Redis=require(_0xb383('0x3'));var db=require(_0xb383('0x4'))['db'];var utils=require(_0xb383('0x5'));var logger=require(_0xb383('0x6'))(_0xb383('0x7'));var config=require(_0xb383('0x8'));var jayson=require(_0xb383('0x9'));var client=jayson['client']['http']({'port':0x232a});config[_0xb383('0xa')]=_[_0xb383('0xb')](config[_0xb383('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb383('0xa')]));require(_0xb383('0xc'))['register'](socket);function respondWithRpcPromise(_0x51c435,_0x42ac01,_0x513ce8){return new BPromise(function(_0x320728,_0x59424e){return client[_0xb383('0xd')](_0x51c435,_0x513ce8)['then'](function(_0x2d26e3){logger[_0xb383('0xe')](_0xb383('0xf'),_0x42ac01,'request\x20sent');logger[_0xb383('0x10')](_0xb383('0x11'),_0x42ac01,_0xb383('0x12'),JSON[_0xb383('0x13')](_0x2d26e3));if(_0x2d26e3[_0xb383('0x14')]){if(_0x2d26e3['error'][_0xb383('0x15')]===0x1f4){logger[_0xb383('0x14')](_0xb383('0xf'),_0x42ac01,_0x2d26e3[_0xb383('0x14')][_0xb383('0x16')]);return _0x59424e(_0x2d26e3[_0xb383('0x14')]['message']);}logger[_0xb383('0x14')](_0xb383('0xf'),_0x42ac01,_0x2d26e3[_0xb383('0x14')][_0xb383('0x16')]);return _0x320728(_0x2d26e3[_0xb383('0x14')][_0xb383('0x16')]);}else{logger[_0xb383('0xe')]('SmsAccount,\x20%s,\x20%s',_0x42ac01,_0xb383('0x12'));_0x320728(_0x2d26e3[_0xb383('0x17')][_0xb383('0x16')]);}})[_0xb383('0x18')](function(_0x48210c){logger[_0xb383('0x14')](_0xb383('0xf'),_0x42ac01,_0x48210c);_0x59424e(_0x48210c);});});}exports['ShowSmsAccount']=function(_0x51062d){var _0x5e436f=this;return new Promise(function(_0xd71918,_0x2d9cf8){return db['SmsAccount'][_0xb383('0x19')]({'raw':_0x51062d[_0xb383('0x1a')]?_0x51062d[_0xb383('0x1a')][_0xb383('0x1b')]===undefined?!![]:![]:!![],'where':_0x51062d['options']?_0x51062d[_0xb383('0x1a')][_0xb383('0x1c')]||null:null,'attributes':_0x51062d['options']?_0x51062d[_0xb383('0x1a')][_0xb383('0x1d')]||null:null,'include':_0x51062d[_0xb383('0x1a')]?_0x51062d[_0xb383('0x1a')]['include']?_[_0xb383('0x1e')](_0x51062d[_0xb383('0x1a')]['include'],function(_0x2ff9a1){return{'model':db[_0x2ff9a1[_0xb383('0x1f')]],'as':_0x2ff9a1['as'],'attributes':_0x2ff9a1[_0xb383('0x1d')],'include':_0x2ff9a1[_0xb383('0x20')]?_[_0xb383('0x1e')](_0x2ff9a1['include'],function(_0x562916){return{'model':db[_0x562916[_0xb383('0x1f')]],'as':_0x562916['as'],'attributes':_0x562916['attributes'],'include':_0x562916[_0xb383('0x20')]?_[_0xb383('0x1e')](_0x562916[_0xb383('0x20')],function(_0x47a4c4){return{'model':db[_0x47a4c4['model']],'as':_0x47a4c4['as'],'attributes':_0x47a4c4[_0xb383('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xb383('0x21')](function(_0x5deace){logger['info'](_0xb383('0x22'),_0x51062d);logger[_0xb383('0x10')](_0xb383('0x22'),_0x51062d,JSON['stringify'](_0x5deace));_0xd71918(_0x5deace);})[_0xb383('0x18')](function(_0x20f94e){logger[_0xb383('0x14')](_0xb383('0x22'),_0x20f94e['message'],_0x51062d);_0x2d9cf8(_0x5e436f[_0xb383('0x14')](0x1f4,_0x20f94e['message']));});});}; \ No newline at end of file +var _0x71c3=['model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','defaults','socket.io-emitter','redis','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','error','message','result','catch','ShowSmsAccount','SmsAccount','options','raw','where','attributes','map','include'];(function(_0x39bda0,_0x232687){var _0x3f769a=function(_0x12a31b){while(--_0x12a31b){_0x39bda0['push'](_0x39bda0['shift']());}};_0x3f769a(++_0x232687);}(_0x71c3,0x16a));var _0x371c=function(_0x222e71,_0x2d827c){_0x222e71=_0x222e71-0x0;var _0x2ea69a=_0x71c3[_0x222e71];return _0x2ea69a;};'use strict';var _=require(_0x371c('0x0'));var util=require(_0x371c('0x1'));var moment=require(_0x371c('0x2'));var BPromise=require(_0x371c('0x3'));var rs=require(_0x371c('0x4'));var fs=require('fs');var Redis=require(_0x371c('0x5'));var db=require(_0x371c('0x6'))['db'];var utils=require(_0x371c('0x7'));var logger=require(_0x371c('0x8'))('rpc');var config=require(_0x371c('0x9'));var jayson=require(_0x371c('0xa'));var client=jayson[_0x371c('0xb')]['http']({'port':0x232a});config['redis']=_[_0x371c('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x371c('0xd'))(new Redis(config[_0x371c('0xe')]));require(_0x371c('0xf'))[_0x371c('0x10')](socket);function respondWithRpcPromise(_0x41c231,_0x2a72dd,_0x4c92f9){return new BPromise(function(_0x2b96c3,_0x1469b1){return client[_0x371c('0x11')](_0x41c231,_0x4c92f9)[_0x371c('0x12')](function(_0x36ccbd){logger[_0x371c('0x13')](_0x371c('0x14'),_0x2a72dd,_0x371c('0x15'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x2a72dd,'request\x20sent',JSON['stringify'](_0x36ccbd));if(_0x36ccbd[_0x371c('0x16')]){if(_0x36ccbd['error']['code']===0x1f4){logger[_0x371c('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2a72dd,_0x36ccbd[_0x371c('0x16')]['message']);return _0x1469b1(_0x36ccbd[_0x371c('0x16')][_0x371c('0x17')]);}logger[_0x371c('0x16')]('SmsAccount,\x20%s,\x20%s',_0x2a72dd,_0x36ccbd['error'][_0x371c('0x17')]);return _0x2b96c3(_0x36ccbd['error'][_0x371c('0x17')]);}else{logger[_0x371c('0x13')](_0x371c('0x14'),_0x2a72dd,'request\x20sent');_0x2b96c3(_0x36ccbd[_0x371c('0x18')][_0x371c('0x17')]);}})[_0x371c('0x19')](function(_0x59c8b4){logger[_0x371c('0x16')](_0x371c('0x14'),_0x2a72dd,_0x59c8b4);_0x1469b1(_0x59c8b4);});});}exports[_0x371c('0x1a')]=function(_0x4dda6e){var _0x2f00b3=this;return new Promise(function(_0x54aabe,_0x3b497){return db[_0x371c('0x1b')]['find']({'raw':_0x4dda6e[_0x371c('0x1c')]?_0x4dda6e[_0x371c('0x1c')][_0x371c('0x1d')]===undefined?!![]:![]:!![],'where':_0x4dda6e[_0x371c('0x1c')]?_0x4dda6e[_0x371c('0x1c')][_0x371c('0x1e')]||null:null,'attributes':_0x4dda6e[_0x371c('0x1c')]?_0x4dda6e[_0x371c('0x1c')][_0x371c('0x1f')]||null:null,'include':_0x4dda6e[_0x371c('0x1c')]?_0x4dda6e[_0x371c('0x1c')]['include']?_[_0x371c('0x20')](_0x4dda6e[_0x371c('0x1c')][_0x371c('0x21')],function(_0x14b8c8){return{'model':db[_0x14b8c8[_0x371c('0x22')]],'as':_0x14b8c8['as'],'attributes':_0x14b8c8[_0x371c('0x1f')],'include':_0x14b8c8['include']?_[_0x371c('0x20')](_0x14b8c8[_0x371c('0x21')],function(_0x48b5e3){return{'model':db[_0x48b5e3['model']],'as':_0x48b5e3['as'],'attributes':_0x48b5e3[_0x371c('0x1f')],'include':_0x48b5e3[_0x371c('0x21')]?_[_0x371c('0x20')](_0x48b5e3[_0x371c('0x21')],function(_0xea9d61){return{'model':db[_0xea9d61['model']],'as':_0xea9d61['as'],'attributes':_0xea9d61['attributes']};}):[]};}):[]};}):[]:[]})[_0x371c('0x12')](function(_0x3d291a){logger['info'](_0x371c('0x1a'),_0x4dda6e);logger[_0x371c('0x23')](_0x371c('0x1a'),_0x4dda6e,JSON['stringify'](_0x3d291a));_0x54aabe(_0x3d291a);})[_0x371c('0x19')](function(_0x568dc6){logger[_0x371c('0x16')](_0x371c('0x1a'),_0x568dc6['message'],_0x4dda6e);_0x3b497(_0x2f00b3['error'](0x1f4,_0x568dc6['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index a295d69..1a81e64 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 _0x4255=['register','length','smsAccount:','./smsAccount.events','remove','update','emit','removeListener'];(function(_0x5e1049,_0x48eb55){var _0x53e7b8=function(_0x121f97){while(--_0x121f97){_0x5e1049['push'](_0x5e1049['shift']());}};_0x53e7b8(++_0x48eb55);}(_0x4255,0x1bb));var _0x5425=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x4255[_0x57b54c];return _0x59cc19;};'use strict';var SmsAccountEvents=require(_0x5425('0x0'));var events=['save',_0x5425('0x1'),_0x5425('0x2')];function createListener(_0x41d664,_0x35d785){return function(_0x49fbf3){_0x35d785[_0x5425('0x3')](_0x41d664,_0x49fbf3);};}function removeListener(_0x475891,_0x21d258){return function(){SmsAccountEvents[_0x5425('0x4')](_0x475891,_0x21d258);};}exports[_0x5425('0x5')]=function(_0x439f1b){for(var _0xb9e88c=0x0,_0x37d5f9=events[_0x5425('0x6')];_0xb9e88c<_0x37d5f9;_0xb9e88c++){var _0x18c7e3=events[_0xb9e88c];var _0x44bae9=createListener(_0x5425('0x7')+_0x18c7e3,_0x439f1b);SmsAccountEvents['on'](_0x18c7e3,_0x44bae9);}}; \ No newline at end of file +var _0xbd49=['length','smsAccount:','remove','update','emit','register'];(function(_0x1c5dfc,_0x170bc7){var _0x1faadd=function(_0x61bdd0){while(--_0x61bdd0){_0x1c5dfc['push'](_0x1c5dfc['shift']());}};_0x1faadd(++_0x170bc7);}(_0xbd49,0x86));var _0x9bd4=function(_0x317543,_0x594617){_0x317543=_0x317543-0x0;var _0x14bb9b=_0xbd49[_0x317543];return _0x14bb9b;};'use strict';var SmsAccountEvents=require('./smsAccount.events');var events=['save',_0x9bd4('0x0'),_0x9bd4('0x1')];function createListener(_0x35e147,_0x5871af){return function(_0x51972b){_0x5871af[_0x9bd4('0x2')](_0x35e147,_0x51972b);};}function removeListener(_0x23166b,_0x11224e){return function(){SmsAccountEvents['removeListener'](_0x23166b,_0x11224e);};}exports[_0x9bd4('0x3')]=function(_0xb3ab11){for(var _0x25567a=0x0,_0x37d2e5=events[_0x9bd4('0x4')];_0x25567a<_0x37d2e5;_0x25567a++){var _0x52b2cc=events[_0x25567a];var _0x1fcc9b=createListener(_0x9bd4('0x5')+_0x52b2cc,_0xb3ab11);SmsAccountEvents['on'](_0x52b2cc,_0x1fcc9b);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index a5dd486..b224316 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 _0xa528=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy'];(function(_0x26b4cb,_0x1da7c0){var _0x37acfd=function(_0x4be5b2){while(--_0x4be5b2){_0x26b4cb['push'](_0x26b4cb['shift']());}};_0x37acfd(++_0x1da7c0);}(_0xa528,0x65));var _0x8a52=function(_0x9fb081,_0x48f480){_0x9fb081=_0x9fb081-0x0;var _0x43f8b0=_0xa528[_0x9fb081];return _0x43f8b0;};'use strict';var multer=require(_0x8a52('0x0'));var util=require(_0x8a52('0x1'));var path=require(_0x8a52('0x2'));var timeout=require(_0x8a52('0x3'));var express=require(_0x8a52('0x4'));var router=express[_0x8a52('0x5')]();var auth=require(_0x8a52('0x6'));var interaction=require(_0x8a52('0x7'));var config=require(_0x8a52('0x8'));var controller=require(_0x8a52('0x9'));router[_0x8a52('0xa')]('/',auth[_0x8a52('0xb')](),controller[_0x8a52('0xc')]);router[_0x8a52('0xa')](_0x8a52('0xd'),auth[_0x8a52('0xb')](),controller[_0x8a52('0xe')]);router['post']('/',auth[_0x8a52('0xb')](),controller[_0x8a52('0xf')]);router[_0x8a52('0x10')](_0x8a52('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x8a52('0x11')](_0x8a52('0xd'),auth[_0x8a52('0xb')](),controller[_0x8a52('0x12')]);module[_0x8a52('0x13')]=router; \ No newline at end of file +var _0x38fb=['update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','index','/:id','isAuthenticated','show','post','create','put'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x38fb,0xf4));var _0xb38f=function(_0x3bcf9e,_0x148a5d){_0x3bcf9e=_0x3bcf9e-0x0;var _0x1bb37c=_0x38fb[_0x3bcf9e];return _0x1bb37c;};'use strict';var multer=require(_0xb38f('0x0'));var util=require(_0xb38f('0x1'));var path=require('path');var timeout=require(_0xb38f('0x2'));var express=require(_0xb38f('0x3'));var router=express[_0xb38f('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xb38f('0x5'));var config=require(_0xb38f('0x6'));var controller=require(_0xb38f('0x7'));router[_0xb38f('0x8')]('/',auth['isAuthenticated'](),controller[_0xb38f('0x9')]);router['get'](_0xb38f('0xa'),auth[_0xb38f('0xb')](),controller[_0xb38f('0xc')]);router[_0xb38f('0xd')]('/',auth[_0xb38f('0xb')](),controller[_0xb38f('0xe')]);router[_0xb38f('0xf')](_0xb38f('0xa'),auth['isAuthenticated'](),controller[_0xb38f('0x10')]);router[_0xb38f('0x11')](_0xb38f('0xa'),auth['isAuthenticated'](),controller[_0xb38f('0x12')]);module[_0xb38f('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 7a542dd..9d9ed9a 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 _0xfd5c=['STRING','*,*,*,*'];(function(_0x4243a3,_0x447337){var _0x1b2a33=function(_0x6a8200){while(--_0x6a8200){_0x4243a3['push'](_0x4243a3['shift']());}};_0x1b2a33(++_0x447337);}(_0xfd5c,0xd6));var _0xcfd5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfd5c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xcfd5('0x0')],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xcfd5('0x0')]},'interval':{'type':Sequelize[_0xcfd5('0x0')],'defaultValue':_0xcfd5('0x1')}}; \ No newline at end of file +var _0xe7b1=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x480290,_0x4974cf){var _0x18261c=function(_0x4d810e){while(--_0x4d810e){_0x480290['push'](_0x480290['shift']());}};_0x18261c(++_0x4974cf);}(_0xe7b1,0x138));var _0x1e7b=function(_0x28a072,_0x4f0f8d){_0x28a072=_0x28a072-0x0;var _0x1522cc=_0xe7b1[_0x28a072];return _0x1522cc;};'use strict';var Sequelize=require(_0x1e7b('0x0'));module[_0x1e7b('0x1')]={'priority':{'type':Sequelize[_0x1e7b('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x1e7b('0x3')],'allowNull':![],'defaultValue':_0x1e7b('0x4')},'appdata':{'type':Sequelize[_0x1e7b('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 3720217..625e342 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 _0xc29e=['VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','html-pdf','eml-format','rimraf','zip-dir','moment','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','SmsApplication','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge'];(function(_0x186a06,_0x19587a){var _0x5ddf98=function(_0x5ab8ca){while(--_0x5ab8ca){_0x186a06['push'](_0x186a06['shift']());}};_0x5ddf98(++_0x19587a);}(_0xc29e,0xdd));var _0xec29=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0xc29e[_0x3ab9ee];return _0x82ee88;};'use strict';var pdf=require(_0xec29('0x0'));var emlformat=require(_0xec29('0x1'));var rimraf=require(_0xec29('0x2'));var zipdir=require(_0xec29('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xec29('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xec29('0x5'));var util=require('util');var path=require(_0xec29('0x6'));var sox=require('sox');var csv=require(_0xec29('0x7'));var ejs=require(_0xec29('0x8'));var fs=require('fs');var _=require(_0xec29('0x9'));var squel=require(_0xec29('0xa'));var crypto=require(_0xec29('0xb'));var jsforce=require(_0xec29('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xec29('0x7'));var querystring=require('querystring');var Papa=require(_0xec29('0xd'));var Redis=require(_0xec29('0xe'));var authService=require(_0xec29('0xf'));var qs=require(_0xec29('0x10'));var as=require(_0xec29('0x11'));var hardwareService=require(_0xec29('0x12'));var logger=require(_0xec29('0x13'))(_0xec29('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0xec29('0x15'))['db'];function respondWithStatusCode(_0x25ae2c,_0x2c09e6){_0x2c09e6=_0x2c09e6||0xcc;return function(_0x19efde){if(_0x19efde){return _0x25ae2c['sendStatus'](_0x2c09e6);}return _0x25ae2c[_0xec29('0x16')](_0x2c09e6)[_0xec29('0x17')]();};}function respondWithResult(_0x51bebb,_0x53510f){_0x53510f=_0x53510f||0xc8;return function(_0x1d3d61){if(_0x1d3d61){return _0x51bebb[_0xec29('0x16')](_0x53510f)['json'](_0x1d3d61);}};}function respondWithFilteredResult(_0x49028a,_0x566d3d){return function(_0x15677c){if(_0x15677c){var _0x5916c5=_0x15677c[_0xec29('0x18')],_0x12aa1f=_0x566d3d[_0xec29('0x19')],_0xab75e0=_0x566d3d['offset']+_0x566d3d[_0xec29('0x1a')],_0x4fcb32;if(_0xab75e0>=_0x5916c5){_0xab75e0=_0x5916c5;_0x4fcb32=0xc8;}else{_0x4fcb32=0xce;}_0x49028a[_0xec29('0x16')](_0x4fcb32);return _0x49028a[_0xec29('0x1b')](_0xec29('0x1c'),_0x12aa1f+'-'+_0xab75e0+'/'+_0x5916c5)[_0xec29('0x1d')](_0x15677c);}return null;};}function patchUpdates(_0x521e7a){return function(_0x5ae3f2){try{jsonpatch[_0xec29('0x1e')](_0x5ae3f2,_0x521e7a,!![]);}catch(_0x24ece6){return BPromise['reject'](_0x24ece6);}return _0x5ae3f2[_0xec29('0x1f')]();};}function saveUpdates(_0x33f038,_0x40fd2d){return function(_0x5cc617){if(_0x5cc617){return _0x5cc617[_0xec29('0x20')](_0x33f038)[_0xec29('0x21')](function(_0x215221){return _0x215221;});}return null;};}function removeEntity(_0x6c7b4c,_0x558cc4){return function(_0x3bf457){if(_0x3bf457){return _0x3bf457[_0xec29('0x22')]()[_0xec29('0x21')](function(){_0x6c7b4c[_0xec29('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x540384,_0x970e7a){return function(_0x3155f8){if(!_0x3155f8){_0x540384['sendStatus'](0x194);}return _0x3155f8;};}function handleError(_0x235c2c,_0x2abb84){_0x2abb84=_0x2abb84||0x1f4;return function(_0x46c0ed){logger[_0xec29('0x23')](_0x46c0ed[_0xec29('0x24')]);if(_0x46c0ed[_0xec29('0x25')]){delete _0x46c0ed[_0xec29('0x25')];}_0x235c2c['status'](_0x2abb84)[_0xec29('0x26')](_0x46c0ed);};}exports['index']=function(_0x487216,_0x6dda92){var _0x4a1c8c={},_0x104226={},_0xf00935={'count':0x0,'rows':[]};var _0x399fcd=_['map'](db[_0xec29('0x27')][_0xec29('0x28')],function(_0x57495f){return{'name':_0x57495f['fieldName'],'type':_0x57495f[_0xec29('0x29')][_0xec29('0x2a')]};});_0x104226[_0xec29('0x2b')]=_[_0xec29('0x2c')](_0x399fcd,_0xec29('0x25'));_0x104226[_0xec29('0x2d')]=_[_0xec29('0x2e')](_0x487216[_0xec29('0x2d')]);_0x104226[_0xec29('0x2f')]=_[_0xec29('0x30')](_0x104226[_0xec29('0x2b')],_0x104226['query']);_0x4a1c8c[_0xec29('0x31')]=_[_0xec29('0x30')](_0x104226[_0xec29('0x2b')],qs[_0xec29('0x32')](_0x487216[_0xec29('0x2d')][_0xec29('0x32')]));_0x4a1c8c[_0xec29('0x31')]=_0x4a1c8c[_0xec29('0x31')][_0xec29('0x33')]?_0x4a1c8c[_0xec29('0x31')]:_0x104226['model'];if(!_0x487216[_0xec29('0x2d')][_0xec29('0x34')](_0xec29('0x35'))){_0x4a1c8c[_0xec29('0x1a')]=qs['limit'](_0x487216[_0xec29('0x2d')][_0xec29('0x1a')]);_0x4a1c8c[_0xec29('0x19')]=qs[_0xec29('0x19')](_0x487216[_0xec29('0x2d')][_0xec29('0x19')]);}_0x4a1c8c['order']=qs[_0xec29('0x36')](_0x487216['query'][_0xec29('0x36')]);_0x4a1c8c[_0xec29('0x37')]=qs[_0xec29('0x2f')](_[_0xec29('0x38')](_0x487216[_0xec29('0x2d')],_0x104226[_0xec29('0x2f')]));if(_0x487216[_0xec29('0x2d')][_0xec29('0x39')]){_0x4a1c8c['where']=_[_0xec29('0x3a')](_0x4a1c8c['where'],{'$or':_[_0xec29('0x2c')](_0x399fcd,function(_0x3cfa36){if(_0x3cfa36[_0xec29('0x29')]!==_0xec29('0x3b')){var _0x13f203={};_0x13f203[_0x3cfa36[_0xec29('0x25')]]={'$like':'%'+_0x487216[_0xec29('0x2d')][_0xec29('0x39')]+'%'};return _0x13f203;}})});}_0x4a1c8c=_[_0xec29('0x3a')]({},_0x4a1c8c,_0x487216[_0xec29('0x3c')]);var _0x1e82c1={'where':_0x4a1c8c[_0xec29('0x37')]};return db[_0xec29('0x27')][_0xec29('0x18')](_0x1e82c1)[_0xec29('0x21')](function(_0x2c996){_0xf00935[_0xec29('0x18')]=_0x2c996;if(_0x487216[_0xec29('0x2d')]['includeAll']){_0x4a1c8c[_0xec29('0x3d')]=[{'all':!![]}];}return db[_0xec29('0x27')][_0xec29('0x3e')](_0x4a1c8c);})['then'](function(_0x1e7d3c){_0xf00935['rows']=_0x1e7d3c;return _0xf00935;})[_0xec29('0x21')](respondWithFilteredResult(_0x6dda92,_0x4a1c8c))[_0xec29('0x3f')](handleError(_0x6dda92,null));};exports[_0xec29('0x40')]=function(_0x5d6764,_0x28c08c){var _0x56259a={'raw':!![],'where':{'id':_0x5d6764[_0xec29('0x41')]['id']}},_0x1612d6={};_0x1612d6['model']=_[_0xec29('0x2e')](db[_0xec29('0x27')][_0xec29('0x28')]);_0x1612d6[_0xec29('0x2d')]=_['keys'](_0x5d6764['query']);_0x1612d6[_0xec29('0x2f')]=_['intersection'](_0x1612d6[_0xec29('0x2b')],_0x1612d6[_0xec29('0x2d')]);_0x56259a[_0xec29('0x31')]=_[_0xec29('0x30')](_0x1612d6[_0xec29('0x2b')],qs[_0xec29('0x32')](_0x5d6764[_0xec29('0x2d')][_0xec29('0x32')]));_0x56259a['attributes']=_0x56259a[_0xec29('0x31')][_0xec29('0x33')]?_0x56259a[_0xec29('0x31')]:_0x1612d6[_0xec29('0x2b')];if(_0x5d6764[_0xec29('0x2d')][_0xec29('0x42')]){_0x56259a[_0xec29('0x3d')]=[{'all':!![]}];}_0x56259a=_[_0xec29('0x3a')]({},_0x56259a,_0x5d6764[_0xec29('0x3c')]);return db['SmsApplication'][_0xec29('0x43')](_0x56259a)['then'](handleEntityNotFound(_0x28c08c,null))[_0xec29('0x21')](respondWithResult(_0x28c08c,null))[_0xec29('0x3f')](handleError(_0x28c08c,null));};exports[_0xec29('0x44')]=function(_0x373469,_0x35aea1){return db[_0xec29('0x27')][_0xec29('0x44')](_0x373469['body'],{})[_0xec29('0x21')](respondWithResult(_0x35aea1,0xc9))['catch'](handleError(_0x35aea1,null));};exports[_0xec29('0x20')]=function(_0x1f34d5,_0x17d163){if(_0x1f34d5[_0xec29('0x45')]['id']){delete _0x1f34d5[_0xec29('0x45')]['id'];}return db[_0xec29('0x27')]['find']({'where':{'id':_0x1f34d5['params']['id']}})[_0xec29('0x21')](handleEntityNotFound(_0x17d163,null))['then'](saveUpdates(_0x1f34d5[_0xec29('0x45')],null))[_0xec29('0x21')](respondWithResult(_0x17d163,null))[_0xec29('0x3f')](handleError(_0x17d163,null));};exports[_0xec29('0x22')]=function(_0x5b18b5,_0x100361){return db[_0xec29('0x27')][_0xec29('0x43')]({'where':{'id':_0x5b18b5[_0xec29('0x41')]['id']}})['then'](handleEntityNotFound(_0x100361,null))['then'](removeEntity(_0x100361,null))['catch'](handleError(_0x100361,null));}; \ No newline at end of file +var _0x2025=['hasOwnProperty','order','sort','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','then','sendStatus','error','stack','name','send','map','SmsApplication','fieldName','type','key','model','query','filters','intersection','attributes','fields','length'];(function(_0x413c62,_0x3cf222){var _0x204d36=function(_0x5a4259){while(--_0x5a4259){_0x413c62['push'](_0x413c62['shift']());}};_0x204d36(++_0x3cf222);}(_0x2025,0x182));var _0x5202=function(_0xe3bede,_0x409320){_0xe3bede=_0xe3bede-0x0;var _0x4b62d9=_0x2025[_0xe3bede];return _0x4b62d9;};'use strict';var pdf=require(_0x5202('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x5202('0x1'));var zipdir=require(_0x5202('0x2'));var jsonpatch=require(_0x5202('0x3'));var rp=require(_0x5202('0x4'));var moment=require(_0x5202('0x5'));var BPromise=require(_0x5202('0x6'));var Mustache=require(_0x5202('0x7'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5202('0x8'));var fs=require('fs');var _=require(_0x5202('0x9'));var squel=require(_0x5202('0xa'));var crypto=require(_0x5202('0xb'));var jsforce=require(_0x5202('0xc'));var deskjs=require(_0x5202('0xd'));var toCsv=require(_0x5202('0xe'));var querystring=require('querystring');var Papa=require(_0x5202('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5202('0x10'));var as=require(_0x5202('0x11'));var hardwareService=require(_0x5202('0x12'));var logger=require(_0x5202('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x5202('0x14'));var db=require(_0x5202('0x15'))['db'];function respondWithStatusCode(_0x116ed2,_0x489f0f){_0x489f0f=_0x489f0f||0xcc;return function(_0x3144d9){if(_0x3144d9){return _0x116ed2['sendStatus'](_0x489f0f);}return _0x116ed2[_0x5202('0x16')](_0x489f0f)[_0x5202('0x17')]();};}function respondWithResult(_0x4423bf,_0x8ef67c){_0x8ef67c=_0x8ef67c||0xc8;return function(_0x4a3ad2){if(_0x4a3ad2){return _0x4423bf[_0x5202('0x16')](_0x8ef67c)[_0x5202('0x18')](_0x4a3ad2);}};}function respondWithFilteredResult(_0x2a0078,_0x58453c){return function(_0x2fe0a1){if(_0x2fe0a1){var _0x34bedd=_0x2fe0a1[_0x5202('0x19')],_0x775f02=_0x58453c[_0x5202('0x1a')],_0x592729=_0x58453c['offset']+_0x58453c[_0x5202('0x1b')],_0x53592d;if(_0x592729>=_0x34bedd){_0x592729=_0x34bedd;_0x53592d=0xc8;}else{_0x53592d=0xce;}_0x2a0078[_0x5202('0x16')](_0x53592d);return _0x2a0078[_0x5202('0x1c')](_0x5202('0x1d'),_0x775f02+'-'+_0x592729+'/'+_0x34bedd)[_0x5202('0x18')](_0x2fe0a1);}return null;};}function patchUpdates(_0x517361){return function(_0x1107d){try{jsonpatch[_0x5202('0x1e')](_0x1107d,_0x517361,!![]);}catch(_0xfaee94){return BPromise[_0x5202('0x1f')](_0xfaee94);}return _0x1107d[_0x5202('0x20')]();};}function saveUpdates(_0xfce4a1,_0x9b479b){return function(_0x2415b4){if(_0x2415b4){return _0x2415b4['update'](_0xfce4a1)['then'](function(_0x5b672e){return _0x5b672e;});}return null;};}function removeEntity(_0x47245a,_0x469ef3){return function(_0x56acba){if(_0x56acba){return _0x56acba[_0x5202('0x21')]()[_0x5202('0x22')](function(){_0x47245a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16d6f5,_0x588c20){return function(_0x56e5b3){if(!_0x56e5b3){_0x16d6f5[_0x5202('0x23')](0x194);}return _0x56e5b3;};}function handleError(_0x3331d9,_0x45485e){_0x45485e=_0x45485e||0x1f4;return function(_0x236ebb){logger[_0x5202('0x24')](_0x236ebb[_0x5202('0x25')]);if(_0x236ebb[_0x5202('0x26')]){delete _0x236ebb[_0x5202('0x26')];}_0x3331d9['status'](_0x45485e)[_0x5202('0x27')](_0x236ebb);};}exports['index']=function(_0x4cef7c,_0x44a630){var _0x245493={},_0x5d3657={},_0x2737b6={'count':0x0,'rows':[]};var _0x1d2e07=_[_0x5202('0x28')](db[_0x5202('0x29')]['rawAttributes'],function(_0x53a187){return{'name':_0x53a187[_0x5202('0x2a')],'type':_0x53a187[_0x5202('0x2b')][_0x5202('0x2c')]};});_0x5d3657[_0x5202('0x2d')]=_['map'](_0x1d2e07,_0x5202('0x26'));_0x5d3657['query']=_['keys'](_0x4cef7c[_0x5202('0x2e')]);_0x5d3657[_0x5202('0x2f')]=_[_0x5202('0x30')](_0x5d3657[_0x5202('0x2d')],_0x5d3657[_0x5202('0x2e')]);_0x245493[_0x5202('0x31')]=_[_0x5202('0x30')](_0x5d3657[_0x5202('0x2d')],qs[_0x5202('0x32')](_0x4cef7c[_0x5202('0x2e')]['fields']));_0x245493[_0x5202('0x31')]=_0x245493[_0x5202('0x31')][_0x5202('0x33')]?_0x245493[_0x5202('0x31')]:_0x5d3657['model'];if(!_0x4cef7c[_0x5202('0x2e')][_0x5202('0x34')]('nolimit')){_0x245493[_0x5202('0x1b')]=qs['limit'](_0x4cef7c[_0x5202('0x2e')]['limit']);_0x245493[_0x5202('0x1a')]=qs[_0x5202('0x1a')](_0x4cef7c[_0x5202('0x2e')]['offset']);}_0x245493[_0x5202('0x35')]=qs[_0x5202('0x36')](_0x4cef7c[_0x5202('0x2e')][_0x5202('0x36')]);_0x245493['where']=qs[_0x5202('0x2f')](_['pick'](_0x4cef7c[_0x5202('0x2e')],_0x5d3657[_0x5202('0x2f')]));if(_0x4cef7c[_0x5202('0x2e')][_0x5202('0x37')]){_0x245493['where']=_['merge'](_0x245493[_0x5202('0x38')],{'$or':_[_0x5202('0x28')](_0x1d2e07,function(_0x2e9877){if(_0x2e9877[_0x5202('0x2b')]!==_0x5202('0x39')){var _0x42bb60={};_0x42bb60[_0x2e9877[_0x5202('0x26')]]={'$like':'%'+_0x4cef7c[_0x5202('0x2e')]['filter']+'%'};return _0x42bb60;}})});}_0x245493=_[_0x5202('0x3a')]({},_0x245493,_0x4cef7c[_0x5202('0x3b')]);var _0x443e41={'where':_0x245493[_0x5202('0x38')]};return db[_0x5202('0x29')][_0x5202('0x19')](_0x443e41)['then'](function(_0x504348){_0x2737b6[_0x5202('0x19')]=_0x504348;if(_0x4cef7c[_0x5202('0x2e')][_0x5202('0x3c')]){_0x245493[_0x5202('0x3d')]=[{'all':!![]}];}return db[_0x5202('0x29')][_0x5202('0x3e')](_0x245493);})['then'](function(_0x3dc747){_0x2737b6[_0x5202('0x3f')]=_0x3dc747;return _0x2737b6;})[_0x5202('0x22')](respondWithFilteredResult(_0x44a630,_0x245493))['catch'](handleError(_0x44a630,null));};exports[_0x5202('0x40')]=function(_0xb51a87,_0x348e37){var _0x3abd3c={'raw':!![],'where':{'id':_0xb51a87[_0x5202('0x41')]['id']}},_0x3d311d={};_0x3d311d[_0x5202('0x2d')]=_[_0x5202('0x42')](db[_0x5202('0x29')][_0x5202('0x43')]);_0x3d311d['query']=_['keys'](_0xb51a87[_0x5202('0x2e')]);_0x3d311d[_0x5202('0x2f')]=_['intersection'](_0x3d311d[_0x5202('0x2d')],_0x3d311d['query']);_0x3abd3c[_0x5202('0x31')]=_[_0x5202('0x30')](_0x3d311d['model'],qs[_0x5202('0x32')](_0xb51a87[_0x5202('0x2e')][_0x5202('0x32')]));_0x3abd3c['attributes']=_0x3abd3c['attributes'][_0x5202('0x33')]?_0x3abd3c[_0x5202('0x31')]:_0x3d311d[_0x5202('0x2d')];if(_0xb51a87[_0x5202('0x2e')][_0x5202('0x3c')]){_0x3abd3c[_0x5202('0x3d')]=[{'all':!![]}];}_0x3abd3c=_['merge']({},_0x3abd3c,_0xb51a87[_0x5202('0x3b')]);return db[_0x5202('0x29')][_0x5202('0x44')](_0x3abd3c)['then'](handleEntityNotFound(_0x348e37,null))[_0x5202('0x22')](respondWithResult(_0x348e37,null))[_0x5202('0x45')](handleError(_0x348e37,null));};exports[_0x5202('0x46')]=function(_0x3aa8db,_0x55b189){return db['SmsApplication'][_0x5202('0x46')](_0x3aa8db['body'],{})[_0x5202('0x22')](respondWithResult(_0x55b189,0xc9))[_0x5202('0x45')](handleError(_0x55b189,null));};exports[_0x5202('0x47')]=function(_0x3cc28c,_0x2526c1){if(_0x3cc28c[_0x5202('0x48')]['id']){delete _0x3cc28c['body']['id'];}return db[_0x5202('0x29')][_0x5202('0x44')]({'where':{'id':_0x3cc28c[_0x5202('0x41')]['id']}})[_0x5202('0x22')](handleEntityNotFound(_0x2526c1,null))[_0x5202('0x22')](saveUpdates(_0x3cc28c[_0x5202('0x48')],null))['then'](respondWithResult(_0x2526c1,null))[_0x5202('0x45')](handleError(_0x2526c1,null));};exports[_0x5202('0x21')]=function(_0x2b8296,_0x1b1bac){return db['SmsApplication'][_0x5202('0x44')]({'where':{'id':_0x2b8296['params']['id']}})[_0x5202('0x22')](handleEntityNotFound(_0x1b1bac,null))[_0x5202('0x22')](removeEntity(_0x1b1bac,null))['catch'](handleError(_0x1b1bac,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index db0ca62..008ca41 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 _0x42d6=['rimraf','./smsApplication.attributes','exports','define','SmsApplication','utf8mb4_unicode_ci','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x416d75,_0x2c8e81){var _0x10af66=function(_0x48f136){while(--_0x48f136){_0x416d75['push'](_0x416d75['shift']());}};_0x10af66(++_0x2c8e81);}(_0x42d6,0x1cd));var _0x642d=function(_0x416431,_0x3b674c){_0x416431=_0x416431-0x0;var _0x375d2c=_0x42d6[_0x416431];return _0x375d2c;};'use strict';var _=require(_0x642d('0x0'));var util=require(_0x642d('0x1'));var logger=require('../../config/logger')(_0x642d('0x2'));var moment=require(_0x642d('0x3'));var BPromise=require(_0x642d('0x4'));var rp=require(_0x642d('0x5'));var fs=require('fs');var path=require(_0x642d('0x6'));var rimraf=require(_0x642d('0x7'));var config=require('../../config/environment');var attributes=require(_0x642d('0x8'));module[_0x642d('0x9')]=function(_0x119161,_0x553b77){return _0x119161[_0x642d('0xa')](_0x642d('0xb'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x642d('0xc')});}; \ No newline at end of file +var _0xac58=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4_unicode_ci','lodash','util'];(function(_0x297df8,_0x14a1b3){var _0x384d86=function(_0x54cc99){while(--_0x54cc99){_0x297df8['push'](_0x297df8['shift']());}};_0x384d86(++_0x14a1b3);}(_0xac58,0x16a));var _0x8ac5=function(_0x37e4b7,_0x5aaa78){_0x37e4b7=_0x37e4b7-0x0;var _0x3af170=_0xac58[_0x37e4b7];return _0x3af170;};'use strict';var _=require(_0x8ac5('0x0'));var util=require(_0x8ac5('0x1'));var logger=require(_0x8ac5('0x2'))(_0x8ac5('0x3'));var moment=require(_0x8ac5('0x4'));var BPromise=require(_0x8ac5('0x5'));var rp=require(_0x8ac5('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x8ac5('0x7'));var attributes=require(_0x8ac5('0x8'));module[_0x8ac5('0x9')]=function(_0x107b16,_0x57ee7d){return _0x107b16[_0x8ac5('0xa')](_0x8ac5('0xb'),attributes,{'tableName':_0x8ac5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8ac5('0xd')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6750e60..1ff4d3a 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 _0xc43c=['../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x1a7e91,_0x458f25){var _0x490321=function(_0x3efb64){while(--_0x3efb64){_0x1a7e91['push'](_0x1a7e91['shift']());}};_0x490321(++_0x458f25);}(_0xc43c,0x152));var _0xcc43=function(_0x1b8328,_0x216c97){_0x1b8328=_0x1b8328-0x0;var _0x1f9710=_0xc43c[_0x1b8328];return _0x1f9710;};'use strict';var _=require(_0xcc43('0x0'));var util=require(_0xcc43('0x1'));var moment=require(_0xcc43('0x2'));var BPromise=require(_0xcc43('0x3'));var rs=require(_0xcc43('0x4'));var fs=require('fs');var Redis=require(_0xcc43('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc43('0x6'));var logger=require(_0xcc43('0x7'))('rpc');var config=require(_0xcc43('0x8'));var jayson=require(_0xcc43('0x9'));var client=jayson[_0xcc43('0xa')][_0xcc43('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9140b6,_0x13c316,_0x298aa7){return new BPromise(function(_0x3b8857,_0x1913c6){return client[_0xcc43('0xc')](_0x9140b6,_0x298aa7)['then'](function(_0x3f017e){logger[_0xcc43('0xd')](_0xcc43('0xe'),_0x13c316,_0xcc43('0xf'));logger[_0xcc43('0x10')](_0xcc43('0x11'),_0x13c316,'request\x20sent',JSON[_0xcc43('0x12')](_0x3f017e));if(_0x3f017e[_0xcc43('0x13')]){if(_0x3f017e[_0xcc43('0x13')][_0xcc43('0x14')]===0x1f4){logger[_0xcc43('0x13')](_0xcc43('0xe'),_0x13c316,_0x3f017e['error'][_0xcc43('0x15')]);return _0x1913c6(_0x3f017e['error'][_0xcc43('0x15')]);}logger[_0xcc43('0x13')]('SmsApplication,\x20%s,\x20%s',_0x13c316,_0x3f017e['error'][_0xcc43('0x15')]);return _0x3b8857(_0x3f017e[_0xcc43('0x13')][_0xcc43('0x15')]);}else{logger[_0xcc43('0xd')](_0xcc43('0xe'),_0x13c316,_0xcc43('0xf'));_0x3b8857(_0x3f017e['result']['message']);}})[_0xcc43('0x16')](function(_0x9b6dc){logger[_0xcc43('0x13')](_0xcc43('0xe'),_0x13c316,_0x9b6dc);_0x1913c6(_0x9b6dc);});});} \ No newline at end of file +var _0x0d4d=['moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','then','info','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','lodash','util'];(function(_0x302887,_0x573caf){var _0x3141bd=function(_0x48b5e2){while(--_0x48b5e2){_0x302887['push'](_0x302887['shift']());}};_0x3141bd(++_0x573caf);}(_0x0d4d,0x132));var _0xd0d4=function(_0x42aa52,_0x5b2cbd){_0x42aa52=_0x42aa52-0x0;var _0x4c499a=_0x0d4d[_0x42aa52];return _0x4c499a;};'use strict';var _=require(_0xd0d4('0x0'));var util=require(_0xd0d4('0x1'));var moment=require(_0xd0d4('0x2'));var BPromise=require(_0xd0d4('0x3'));var rs=require(_0xd0d4('0x4'));var fs=require('fs');var Redis=require(_0xd0d4('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xd0d4('0x6'));var logger=require('../../config/logger')(_0xd0d4('0x7'));var config=require(_0xd0d4('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd0d4('0x9')][_0xd0d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c5d01,_0x5c8c7b,_0x5bfae8){return new BPromise(function(_0x5403c0,_0x3fdd50){return client['request'](_0x1c5d01,_0x5bfae8)[_0xd0d4('0xb')](function(_0x314cd5){logger[_0xd0d4('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));logger[_0xd0d4('0xe')](_0xd0d4('0xf'),_0x5c8c7b,_0xd0d4('0xd'),JSON[_0xd0d4('0x10')](_0x314cd5));if(_0x314cd5[_0xd0d4('0x11')]){if(_0x314cd5['error'][_0xd0d4('0x12')]===0x1f4){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')][_0xd0d4('0x14')]);return _0x3fdd50(_0x314cd5[_0xd0d4('0x11')]['message']);}logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x314cd5[_0xd0d4('0x11')]['message']);return _0x5403c0(_0x314cd5['error'][_0xd0d4('0x14')]);}else{logger[_0xd0d4('0xc')]('SmsApplication,\x20%s,\x20%s',_0x5c8c7b,_0xd0d4('0xd'));_0x5403c0(_0x314cd5[_0xd0d4('0x15')]['message']);}})['catch'](function(_0x1b64f){logger[_0xd0d4('0x11')](_0xd0d4('0x13'),_0x5c8c7b,_0x1b64f);_0x3fdd50(_0x1b64f);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index c11c70d..ed23830 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 _0xcb1a=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','tracked','smsinteraction:addtags','put','update','delete','sms','smsinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get'];(function(_0x50e0f5,_0x56b5aa){var _0x47a4ff=function(_0x2b8d02){while(--_0x2b8d02){_0x50e0f5['push'](_0x50e0f5['shift']());}};_0x47a4ff(++_0x56b5aa);}(_0xcb1a,0xb6));var _0xacb1=function(_0x195be5,_0x57cbf1){_0x195be5=_0x195be5-0x0;var _0x3e7244=_0xcb1a[_0x195be5];return _0x3e7244;};'use strict';var multer=require(_0xacb1('0x0'));var util=require(_0xacb1('0x1'));var path=require(_0xacb1('0x2'));var timeout=require(_0xacb1('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0xacb1('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xacb1('0x5'));var controller=require(_0xacb1('0x6'));router['get']('/',auth[_0xacb1('0x7')](),controller[_0xacb1('0x8')]);router[_0xacb1('0x9')](_0xacb1('0xa'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xb')]);router['get'](_0xacb1('0xc'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xd')]);router[_0xacb1('0x9')](_0xacb1('0xe'),auth[_0xacb1('0x7')](),controller[_0xacb1('0xf')]);router[_0xacb1('0x9')](_0xacb1('0x10'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x11')]);router['post']('/',auth[_0xacb1('0x7')](),controller[_0xacb1('0x12')]);router['post']('/:id/messages',auth[_0xacb1('0x7')](),controller[_0xacb1('0x13')]);router[_0xacb1('0x14')](_0xacb1('0x15'),auth[_0xacb1('0x7')](),interaction[_0xacb1('0x16')]('sms',_0xacb1('0x17')),controller['addTags']);router[_0xacb1('0x18')](_0xacb1('0xc'),auth[_0xacb1('0x7')](),interaction[_0xacb1('0x16')]('sms','smsinteraction:update'),controller[_0xacb1('0x19')]);router[_0xacb1('0x1a')](_0xacb1('0xc'),auth[_0xacb1('0x7')](),interaction[_0xacb1('0x16')](_0xacb1('0x1b'),_0xacb1('0x1c')),controller[_0xacb1('0x1d')]);router[_0xacb1('0x1a')](_0xacb1('0x15'),auth[_0xacb1('0x7')](),controller[_0xacb1('0x1e')]);module[_0xacb1('0x1f')]=router; \ No newline at end of file +var _0xafcb=['/:id/tags','tracked','put','smsinteraction:update','delete','smsinteraction:destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./smsInteraction.controller','get','index','/describe','isAuthenticated','/:id','getMessages','/:id/download','download','post','create','/:id/messages','addMessage'];(function(_0x35dfe6,_0x4244fa){var _0x59651c=function(_0x3ff137){while(--_0x3ff137){_0x35dfe6['push'](_0x35dfe6['shift']());}};_0x59651c(++_0x4244fa);}(_0xafcb,0xb6));var _0xbafc=function(_0x780193,_0x29399d){_0x780193=_0x780193-0x0;var _0x5f51a4=_0xafcb[_0x780193];return _0x5f51a4;};'use strict';var multer=require(_0xbafc('0x0'));var util=require(_0xbafc('0x1'));var path=require(_0xbafc('0x2'));var timeout=require(_0xbafc('0x3'));var express=require(_0xbafc('0x4'));var router=express[_0xbafc('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xbafc('0x6'));var config=require(_0xbafc('0x7'));var controller=require(_0xbafc('0x8'));router[_0xbafc('0x9')]('/',auth['isAuthenticated'](),controller[_0xbafc('0xa')]);router[_0xbafc('0x9')](_0xbafc('0xb'),auth[_0xbafc('0xc')](),controller['describe']);router[_0xbafc('0x9')](_0xbafc('0xd'),auth[_0xbafc('0xc')](),controller['show']);router[_0xbafc('0x9')]('/:id/messages',auth[_0xbafc('0xc')](),controller[_0xbafc('0xe')]);router[_0xbafc('0x9')](_0xbafc('0xf'),auth[_0xbafc('0xc')](),controller[_0xbafc('0x10')]);router[_0xbafc('0x11')]('/',auth['isAuthenticated'](),controller[_0xbafc('0x12')]);router[_0xbafc('0x11')](_0xbafc('0x13'),auth[_0xbafc('0xc')](),controller[_0xbafc('0x14')]);router['post'](_0xbafc('0x15'),auth['isAuthenticated'](),interaction[_0xbafc('0x16')]('sms','smsinteraction:addtags'),controller['addTags']);router[_0xbafc('0x17')](_0xbafc('0xd'),auth['isAuthenticated'](),interaction[_0xbafc('0x16')]('sms',_0xbafc('0x18')),controller['update']);router[_0xbafc('0x19')]('/:id',auth[_0xbafc('0xc')](),interaction[_0xbafc('0x16')]('sms',_0xbafc('0x1a')),controller['destroy']);router[_0xbafc('0x19')](_0xbafc('0x15'),auth[_0xbafc('0xc')](),controller[_0xbafc('0x1b')]);module[_0xbafc('0x1c')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 9ee02d9..3412822 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 _0xe706=['ENUM','out','sequelize','moment','exports','DATE','STRING'];(function(_0x65009d,_0x3c2db6){var _0xfbf43f=function(_0x144202){while(--_0x144202){_0x65009d['push'](_0x65009d['shift']());}};_0xfbf43f(++_0x3c2db6);}(_0xe706,0xa3));var _0x6e70=function(_0x355ca3,_0xd3e1e7){_0x355ca3=_0x355ca3-0x0;var _0x55edba=_0xe706[_0x355ca3];return _0x55edba;};'use strict';var Sequelize=require(_0x6e70('0x0'));var moment=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6e70('0x3')]},'disposition':{'type':Sequelize[_0x6e70('0x4')]},'note':{'type':Sequelize[_0x6e70('0x4')]},'phone':{'type':Sequelize[_0x6e70('0x4')]},'read1stAt':{'type':Sequelize[_0x6e70('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6e70('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x6e70('0x5')]('in',_0x6e70('0x6')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xcb91=['exports','BOOLEAN','DATE','STRING','out'];(function(_0x568e3a,_0x2026b0){var _0x40a13d=function(_0x125fb7){while(--_0x125fb7){_0x568e3a['push'](_0x568e3a['shift']());}};_0x40a13d(++_0x2026b0);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0xcb91[_0x1acc2d];return _0xabfa6d;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module[_0x1cb9('0x0')]={'closed':{'type':Sequelize[_0x1cb9('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x1cb9('0x2')]},'disposition':{'type':Sequelize[_0x1cb9('0x3')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'read1stAt':{'type':Sequelize[_0x1cb9('0x2')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x1cb9('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x1cb9('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 7e4b921..6c8c75b 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 _0xda2d=['get','10px','40px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20
Interaction\x20Transcript
\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','30px','\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20{{page}}/{{pages}}\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20%s\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x0a\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','%s\x20#%d','Sms','YYYY-MM-DD','N.A.','createdAt','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','disposition','Messages','out','System','direction','renderFile','views','toFile','transcript-','.pdf','log','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','status','end','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','map','fullname','TagIds','Tags','then','catch','index','SmsInteraction','fieldName','type','key','query','keys','filters','model','fields','attributes','length','order','sort','select','field','color','tools_tags','u.id','u.fullname','ui.SmsInteractionId','from','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','cm_contacts','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','me.SmsInteractionId\x20=\x20i.id','sms_interaction_has_tags','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','ContactId','buildExpression','split','forEach','union','User','UserId','text','start','body','some','isEmpty','SmsAccountId','i.SmsAccountId\x20IN\x20?','concat','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','isArray','tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','\x27\x27\x27\x27','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','DESC','t.id\x20IN\x20?','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','sequelize','keyBy','merge','a.key','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','c.firstName','Contact.firstName','c.lastName','c.email','c.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','Owner.internal','toString','groupBy','SmsInteractionId','push','all','includeAll','include','options','create','params','describe','addMessage','SmsMessage','ids','getMessages','findOne','rawAttributes','intersection','hasOwnProperty','nolimit','pick','format','findAll','rows','addTags','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','download','unix','root','server','files','attachments','join','CmContact','firstName','lastName','secret','SmsAccount','Account','Owner'];(function(_0x212b4d,_0x5a173e){var _0x2d64ab=function(_0x11e0aa){while(--_0x11e0aa){_0x212b4d['push'](_0x212b4d['shift']());}};_0x2d64ab(++_0x5a173e);}(_0xda2d,0x102));var _0xdda2=function(_0x11a43c,_0x3496c5){_0x11a43c=_0x11a43c-0x0;var _0x5bfb14=_0xda2d[_0x11a43c];return _0x5bfb14;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xdda2('0x0'));var rimraf=require(_0xdda2('0x1'));var zipdir=require(_0xdda2('0x2'));var jsonpatch=require(_0xdda2('0x3'));var rp=require(_0xdda2('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xdda2('0x5'));var path=require(_0xdda2('0x6'));var sox=require(_0xdda2('0x7'));var csv=require(_0xdda2('0x8'));var ejs=require(_0xdda2('0x9'));var fs=require('fs');var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var hardwareService=require(_0xdda2('0x14'));var logger=require(_0xdda2('0x15'))(_0xdda2('0x16'));var utils=require(_0xdda2('0x17'));var config=require(_0xdda2('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xdda2('0x19')],{'host':_0xdda2('0x1a'),'port':0x18eb});var socket=require(_0xdda2('0x1b'))(new Redis(config[_0xdda2('0x19')]));require(_0xdda2('0x1c'))[_0xdda2('0x1d')](socket);function respondWithStatusCode(_0x3490f1,_0x4df902){_0x4df902=_0x4df902||0xcc;return function(_0x79c6d4){if(_0x79c6d4){return _0x3490f1['sendStatus'](_0x4df902);}return _0x3490f1[_0xdda2('0x1e')](_0x4df902)[_0xdda2('0x1f')]();};}function respondWithResult(_0x3553d5,_0x457764){_0x457764=_0x457764||0xc8;return function(_0x1922b1){if(_0x1922b1){return _0x3553d5['status'](_0x457764)['json'](_0x1922b1);}};}function respondWithFilteredResult(_0x43f67b,_0x518c6d){return function(_0x1a5192){if(_0x1a5192){var _0x1a3b35=_0x1a5192[_0xdda2('0x20')],_0x335fb5=_0x518c6d[_0xdda2('0x21')],_0x2b6ee8=_0x518c6d[_0xdda2('0x21')]+_0x518c6d[_0xdda2('0x22')],_0x8d44b7;if(_0x2b6ee8>=_0x1a3b35){_0x2b6ee8=_0x1a3b35;_0x8d44b7=0xc8;}else{_0x8d44b7=0xce;}_0x43f67b[_0xdda2('0x1e')](_0x8d44b7);return _0x43f67b[_0xdda2('0x23')](_0xdda2('0x24'),_0x335fb5+'-'+_0x2b6ee8+'/'+_0x1a3b35)['json'](_0x1a5192);}return null;};}function patchUpdates(_0x41fe7d){return function(_0x5dfce7){try{jsonpatch[_0xdda2('0x25')](_0x5dfce7,_0x41fe7d,!![]);}catch(_0x1a4db4){return BPromise[_0xdda2('0x26')](_0x1a4db4);}return _0x5dfce7['save']();};}function saveUpdates(_0x347ee6,_0x5a9bb8){return function(_0x425489){if(_0x425489){return _0x425489[_0xdda2('0x27')](_0x347ee6)['then'](function(_0x144f1e){return _0x144f1e;});}return null;};}function removeEntity(_0xfda248,_0x2528d7){return function(_0x13b0f3){if(_0x13b0f3){return _0x13b0f3[_0xdda2('0x28')]()['then'](function(){_0xfda248[_0xdda2('0x1e')](0xcc)[_0xdda2('0x1f')]();});}};}function handleEntityNotFound(_0x2391a5,_0x31d48b){return function(_0x5436d1){if(!_0x5436d1){_0x2391a5['sendStatus'](0x194);}return _0x5436d1;};}function handleError(_0x28da54,_0x4567e7){_0x4567e7=_0x4567e7||0x1f4;return function(_0x2e8591){logger['error'](_0x2e8591[_0xdda2('0x29')]);if(_0x2e8591[_0xdda2('0x2a')]){delete _0x2e8591[_0xdda2('0x2a')];}_0x28da54[_0xdda2('0x1e')](_0x4567e7)[_0xdda2('0x2b')](_0x2e8591);};}function getInteractionUsers(_0x91b41a,_0x4bb8a4){return new BPromise(function(_0x24c37d,_0x255bbc){try{if(_0x4bb8a4[_0x91b41a['id']]){_0x91b41a['Users']=_[_0xdda2('0x2c')](_0x4bb8a4[_0x91b41a['id']],function(_0x2cfaca){return{'id':_0x2cfaca['id'],'fullname':_0x2cfaca[_0xdda2('0x2d')]};});}}catch(_0x15e511){_0x255bbc(_0x15e511);}_0x24c37d(_0x91b41a);});}function getInteractionTags(_0x5540e5,_0x129eba){return new BPromise(function(_0x5e107f,_0x4b19b7){try{if(_0x5540e5[_0xdda2('0x2e')]){_0x5540e5['Tags']=[];_0x5540e5[_0xdda2('0x2e')]['split'](',')['forEach'](function(_0x510b7b){_0x5540e5[_0xdda2('0x2f')]['push'](_0x129eba[_0x510b7b]);});}delete _0x5540e5[_0xdda2('0x2e')];}catch(_0x508664){_0x4b19b7(_0x508664);}_0x5e107f(_0x5540e5);});}function updateSmsInteraction(_0x5cba58,_0x52a509,_0x4637c1){return new BPromise(function(_0x567717,_0xca6046){return getInteractionUsers(_0x5cba58,_0x4637c1)[_0xdda2('0x30')](function(_0x12e96d){return getInteractionTags(_0x12e96d,_0x52a509);})[_0xdda2('0x30')](function(_0x2bcfba){_0x567717(_0x2bcfba);})[_0xdda2('0x31')](function(_0x3cddbd){_0xca6046(_0x3cddbd);});});}exports[_0xdda2('0x32')]=function(_0x4a32ea,_0x461621){var _0x4212da={},_0x2f8674={},_0x3d510c={'count':0x0,'rows':[]};var _0x392373=_[_0xdda2('0x2c')](db[_0xdda2('0x33')]['rawAttributes'],function(_0x57269f){return{'name':_0x57269f[_0xdda2('0x34')],'type':_0x57269f[_0xdda2('0x35')][_0xdda2('0x36')]};});_0x2f8674['model']=_['map'](_0x392373,_0xdda2('0x2a'));_0x2f8674[_0xdda2('0x37')]=_[_0xdda2('0x38')](_0x4a32ea[_0xdda2('0x37')]);_0x2f8674[_0xdda2('0x39')]=_['intersection'](_0x2f8674[_0xdda2('0x3a')],_0x2f8674[_0xdda2('0x37')]);_0x4212da['attributes']=_['intersection'](_0x2f8674[_0xdda2('0x3a')],qs[_0xdda2('0x3b')](_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x3b')]));_0x4212da[_0xdda2('0x3c')]=_0x4212da['attributes'][_0xdda2('0x3d')]?_0x4212da[_0xdda2('0x3c')]:_0x2f8674[_0xdda2('0x3a')];if(!_0x4a32ea[_0xdda2('0x37')]['hasOwnProperty']('nolimit')){_0x4212da[_0xdda2('0x22')]=qs[_0xdda2('0x22')](_0x4a32ea[_0xdda2('0x37')]['limit']);_0x4212da[_0xdda2('0x21')]=qs['offset'](_0x4a32ea[_0xdda2('0x37')]['offset']);}_0x4212da[_0xdda2('0x3e')]=qs[_0xdda2('0x3f')](_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x3f')]);_0x4212da['where']=qs[_0xdda2('0x39')](_['pick'](_0x4a32ea[_0xdda2('0x37')],_0x2f8674['filters']));var _0x1d1678=[];var _0x12589b=squel[_0xdda2('0x40')]()[_0xdda2('0x41')]('id')[_0xdda2('0x41')]('name')[_0xdda2('0x41')](_0xdda2('0x42'))['from'](_0xdda2('0x43'));var _0x546847=squel[_0xdda2('0x40')]()[_0xdda2('0x41')](_0xdda2('0x44'))[_0xdda2('0x41')](_0xdda2('0x45'))[_0xdda2('0x41')](_0xdda2('0x46'))[_0xdda2('0x47')](_0xdda2('0x48'),'ui')[_0xdda2('0x49')](_0xdda2('0x4a'),'u',_0xdda2('0x4b'));var _0x7a2dbc=squel['select']()['from']('sms_interactions','i')[_0xdda2('0x49')](_0xdda2('0x4c'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0xdda2('0x49')](_0xdda2('0x4a'),'o',_0xdda2('0x4d'))['left_join'](_0xdda2('0x4e'),'a',_0xdda2('0x4f'))['left_join']('sms_messages','me',_0xdda2('0x50'))['left_join'](_0xdda2('0x51'),'it','it.SmsInteractionId\x20=\x20i.id')[_0xdda2('0x49')](_0xdda2('0x43'),'t','t.id\x20=\x20it.TagId');var _0x585665=squel[_0xdda2('0x52')]();var _0x413f8a=[];var _0x375741=squel[_0xdda2('0x52')]();var _0x578a6c;if(_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x53')]){_0x578a6c=as[_0xdda2('0x54')](_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x53')]);var _0x55528b=_0x578a6c[_0xdda2('0x55')];for(var _0x40b610=0x0;_0x40b610<_0x578a6c['conditions'][_0xdda2('0x3d')];_0x40b610++){var _0x123c2d=_0x578a6c[_0xdda2('0x56')][_0x40b610];var _0x2c2a4a='i';var _0x161d7b=_[_0xdda2('0x57')](_0x392373,['name',_0x123c2d[_0xdda2('0x41')]]);if(!_0x161d7b){switch(_0x123c2d['field']){case _0xdda2('0x58'):if(_0x123c2d['value']==0x1){_0x7a2dbc[_0xdda2('0x59')]('`'+_0x123c2d['field']+_0xdda2('0x5a'));}else{_0x7a2dbc[_0xdda2('0x59')]('`'+_0x123c2d[_0xdda2('0x41')]+_0xdda2('0x5b'));}break;case _0xdda2('0x5c'):if(_0x123c2d[_0xdda2('0x5d')]===_0xdda2('0x5e')){if(_0x123c2d[_0xdda2('0x5f')]['split']('\x20')[_0xdda2('0x3d')]>0x1){_0x585665[_0x55528b](_0xdda2('0x60'),qs[_0xdda2('0x61')](_0x123c2d['value']),null);}else{var _0xf380b0='%'+_0x123c2d[_0xdda2('0x5f')]+'%';_0x585665[_0x55528b]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0xf380b0,_0xf380b0,_0xf380b0);}}else{_0x161d7b=_[_0xdda2('0x57')](_0x392373,['name',_0xdda2('0x62')]);_0x123c2d[_0xdda2('0x41')]=_0xdda2('0x62');_0x90bb5c=as[_0xdda2('0x63')](_0x2c2a4a,_0x161d7b[_0xdda2('0x35')],_0x123c2d);_0x585665[_0x55528b](_0x90bb5c['text'],_0x90bb5c['value']['start'],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x1f')]);}break;case'Tag':var _0x44637d=_0x123c2d[_0xdda2('0x5f')][_0xdda2('0x64')](',')['map'](function(_0x3fd76c){return Number(_0x3fd76c);});_0x44637d[_0xdda2('0x65')](function(_0x113266){_0x375741['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x113266+',%');});_0x413f8a=_[_0xdda2('0x66')](_0x413f8a,_0x44637d);break;case _0xdda2('0x67'):if(_0x123c2d[_0xdda2('0x5d')]===_0xdda2('0x5e')){_0x585665[_0x55528b]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x123c2d[_0xdda2('0x5f')]+'%',null);}else{_0x161d7b=_['find'](_0x392373,['name','UserId']);_0x123c2d[_0xdda2('0x41')]=_0xdda2('0x68');_0x90bb5c=as[_0xdda2('0x63')](_0x2c2a4a,_0x161d7b[_0xdda2('0x35')],_0x123c2d);_0x585665[_0x55528b](_0x90bb5c[_0xdda2('0x69')],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x6a')],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x1f')]);}break;case _0xdda2('0x6b'):_0x90bb5c=as[_0xdda2('0x63')]('me',null,_0x123c2d);_0x585665[_0x55528b](_0x90bb5c['text'],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x6a')],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x1f')]);break;}}else{var _0x90bb5c=as[_0xdda2('0x63')](_0x2c2a4a,_0x161d7b[_0xdda2('0x35')],_0x123c2d);_0x585665[_0x55528b](_0x90bb5c['text'],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x6a')],_0x90bb5c[_0xdda2('0x5f')][_0xdda2('0x1f')]);}}}else{var _0x44f619=_(_0x4a32ea['query'])[_0xdda2('0x38')]()[_0xdda2('0x2c')](function(_0xbc441a){return _[_0xdda2('0x6c')](_0x392373,[_0xdda2('0x2a'),_0xbc441a])?_0xbc441a:undefined;})['compact']()[_0xdda2('0x5f')]();if(!_[_0xdda2('0x6d')](_0x44f619)){_0x44f619[_0xdda2('0x65')](function(_0x4530b7){if(_0x4530b7===_0xdda2('0x6e')){_0x7a2dbc['where'](_0xdda2('0x6f'),[][_0xdda2('0x70')](_0x4a32ea[_0xdda2('0x37')][_0x4530b7]));}else if(_0x4530b7==='createdAt'){var _0x1b7b96=JSON['parse'](_0x4a32ea[_0xdda2('0x37')][_0x4530b7])[_0xdda2('0x71')];var _0x646bab=JSON['parse'](_0x4a32ea[_0xdda2('0x37')][_0x4530b7])[_0xdda2('0x72')];_0x7a2dbc['where'](_0xdda2('0x73'),_0x1b7b96,_0x646bab);}else{if(_0x4a32ea['query'][_0x4530b7]===_0xdda2('0x74')){_0x7a2dbc[_0xdda2('0x75')]('i.'+_0x4530b7+_0xdda2('0x76'));}else{_0x7a2dbc[_0xdda2('0x75')]('i.'+_0x4530b7+_0xdda2('0x77'),_0x4a32ea['query'][_0x4530b7]);}}});}if(_0x4a32ea['query'][_0xdda2('0x78')]){if(_0x4a32ea[_0xdda2('0x37')]['read']==0x1){_0x7a2dbc['having'](_0xdda2('0x79'));}else{_0x7a2dbc['having'](_0xdda2('0x7a'));}}if(_0x4a32ea[_0xdda2('0x37')]['tag']){_0x413f8a=_[_0xdda2('0x7b')](_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x7c')])?_0x4a32ea[_0xdda2('0x37')][_0xdda2('0x7c')]:new Array(_0x4a32ea[_0xdda2('0x37')]['tag']);_0x413f8a[_0xdda2('0x65')](function(_0x22de37){_0x375741['or'](_0xdda2('0x7d'),'%,'+_0x22de37+',%');});}if(_0x4a32ea['query'][_0xdda2('0x7e')]){var _0x2ec405=_0x4a32ea['query']['filter'][_0xdda2('0x7f')]('\x5c','\x5c\x5c')[_0xdda2('0x7f')]('\x27\x27',_0xdda2('0x80'));if(qs['isNumeric'](_0x2ec405)){_0x585665['or']('i.id\x20LIKE\x20?',_0x2ec405+'%')['or'](_0xdda2('0x81'),_0x2ec405+'%');}else{_0x585665['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xdda2('0x61')](_0x2ec405))['or'](_0xdda2('0x82'),_0x2ec405+'%');}}}_0x7a2dbc[_0xdda2('0x75')](_0x585665);_0x7a2dbc[_0xdda2('0x83')](_0xdda2('0x84'));var _0x29006f={'type':db['Sequelize']['QueryTypes'][_0xdda2('0x85')],'raw':!![]};var _0x4eabc4=_0x7a2dbc[_0xdda2('0x86')]();_0x4eabc4[_0xdda2('0x41')](_0xdda2('0x84'));_0x4eabc4[_0xdda2('0x41')](_0xdda2('0x87'),_0xdda2('0x58'));if(_0x4212da[_0xdda2('0x3e')]){_0x4212da[_0xdda2('0x3e')][_0xdda2('0x65')](function(_0x495a28){_0x7a2dbc[_0xdda2('0x3e')]('i.'+_0x495a28[0x0],_0x495a28[0x1]===_0xdda2('0x88')?![]:!![]);});}if(!_[_0xdda2('0x6d')](_0x413f8a)){_0x7a2dbc[_0xdda2('0x59')](_0x375741);_0x4eabc4['where'](_0xdda2('0x89'),_0x413f8a);}BPromise[_0xdda2('0x8a')]()[_0xdda2('0x30')](function(){if(!_0x578a6c){if(_0x4a32ea[_0xdda2('0x37')]['SmsAccountId']||_0x4a32ea['query'][_0xdda2('0x8b')])return;_0x4eabc4[_0xdda2('0x75')](_0xdda2('0x8c'));_0x7a2dbc[_0xdda2('0x75')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x4a32ea[_0xdda2('0x8d')][_0xdda2('0x8e')]({'attributes':['id'],'raw':!![]})[_0xdda2('0x30')](function(_0x152ba3){if(_[_0xdda2('0x6d')](_0x152ba3)){_0x4eabc4[_0xdda2('0x75')](_0xdda2('0x8f'));_0x7a2dbc[_0xdda2('0x75')](_0xdda2('0x8f'));}else{_0x4eabc4[_0xdda2('0x75')](_0xdda2('0x6f'),_[_0xdda2('0x2c')](_0x152ba3,'id'));_0x7a2dbc[_0xdda2('0x75')](_0xdda2('0x6f'),_[_0xdda2('0x2c')](_0x152ba3,'id'));}});})['then'](function(){db[_0xdda2('0x90')][_0xdda2('0x37')](_0x4eabc4['toString'](),_0x29006f)['then'](function(_0x3cb641){_0x3d510c[_0xdda2('0x20')]=_0x3cb641[_0xdda2('0x3d')];if(_0x3d510c[_0xdda2('0x20')]===0x0)return[];return db[_0xdda2('0x90')][_0xdda2('0x37')](_0x12589b['toString'](),_0x29006f)[_0xdda2('0x30')](function(_0x1f3abe){_0x1d1678=_[_0xdda2('0x91')](_0x1f3abe,'id');_0x29006f=_[_0xdda2('0x92')](_0x29006f,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x4a32ea[_0xdda2('0x37')]['fields']){_0x4212da[_0xdda2('0x3c')][_0xdda2('0x65')](function(_0x4c8739){_0x7a2dbc[_0xdda2('0x41')]('i.'+_0x4c8739);});}else{_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x87'),_0xdda2('0x58'));_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x93'),_0xdda2('0x94'));_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x95'),_0xdda2('0x96'));_0x7a2dbc[_0xdda2('0x41')]('i.*');_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x97'),_0xdda2('0x98'));_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x99'),'Contact.lastName');_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x9a'),'Contact.email');_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x9b'),'Contact.phone');_0x7a2dbc['field'](_0xdda2('0x9c'),_0xdda2('0x9d'));_0x7a2dbc[_0xdda2('0x41')](_0xdda2('0x9e'),_0xdda2('0x9f'));_0x7a2dbc[_0xdda2('0x41')]('o.fullname',_0xdda2('0xa0'));_0x7a2dbc[_0xdda2('0x41')]('o.internal',_0xdda2('0xa1'));_0x7a2dbc[_0xdda2('0x41')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0xdda2('0x2e'));}_0x7a2dbc[_0xdda2('0x22')](_0x4212da[_0xdda2('0x22')]);_0x7a2dbc['offset'](_0x4212da[_0xdda2('0x21')]);return db['sequelize'][_0xdda2('0x37')](_0x7a2dbc[_0xdda2('0xa2')](),_0x29006f);})[_0xdda2('0x30')](function(_0x17852d){_0x546847['where']('ui.SmsInteractionId\x20IN\x20?',_[_0xdda2('0x2c')](_0x17852d,'id'));return db[_0xdda2('0x90')]['query'](_0x546847[_0xdda2('0xa2')](),_0x29006f)[_0xdda2('0x30')](function(_0x130108){var _0x152961=_[_0xdda2('0xa3')](_0x130108,_0xdda2('0xa4'));var _0x2d5ec4=[];_0x17852d[_0xdda2('0x65')](function(_0x3046c1){_0x2d5ec4[_0xdda2('0xa5')](updateSmsInteraction(_0x3046c1,_0x1d1678,_0x152961));});return BPromise[_0xdda2('0xa6')](_0x2d5ec4);});});})[_0xdda2('0x30')](function(_0x528185){_0x3d510c['rows']=_0x528185;return _0x3d510c;})['then'](respondWithFilteredResult(_0x461621,_0x4212da));})[_0xdda2('0x31')](handleError(_0x461621,null));};exports['show']=function(_0x2910b0,_0x323af8){var _0x2f18a0={'raw':![],'where':{'id':_0x2910b0['params']['id']}},_0xe797aa={};_0xe797aa[_0xdda2('0x3a')]=_[_0xdda2('0x38')](db[_0xdda2('0x33')]['rawAttributes']);_0xe797aa[_0xdda2('0x37')]=_[_0xdda2('0x38')](_0x2910b0[_0xdda2('0x37')]);_0xe797aa['filters']=_['intersection'](_0xe797aa[_0xdda2('0x3a')],_0xe797aa[_0xdda2('0x37')]);_0x2f18a0[_0xdda2('0x3c')]=_['intersection'](_0xe797aa[_0xdda2('0x3a')],qs[_0xdda2('0x3b')](_0x2910b0[_0xdda2('0x37')][_0xdda2('0x3b')]));_0x2f18a0[_0xdda2('0x3c')]=_0x2f18a0[_0xdda2('0x3c')][_0xdda2('0x3d')]?_0x2f18a0['attributes']:_0xe797aa[_0xdda2('0x3a')];if(_0x2910b0[_0xdda2('0x37')][_0xdda2('0xa7')]){_0x2f18a0[_0xdda2('0xa8')]=[{'all':!![]}];}_0x2f18a0=_['merge']({},_0x2f18a0,_0x2910b0[_0xdda2('0xa9')]);return db[_0xdda2('0x33')][_0xdda2('0x57')](_0x2f18a0)[_0xdda2('0x30')](handleEntityNotFound(_0x323af8,null))['then'](respondWithResult(_0x323af8,null))['catch'](handleError(_0x323af8,null));};exports['create']=function(_0x3b2e7c,_0x2ab7f9){return db[_0xdda2('0x33')][_0xdda2('0xaa')](_0x3b2e7c[_0xdda2('0x6b')],{})[_0xdda2('0x30')](respondWithResult(_0x2ab7f9,0xc9))['catch'](handleError(_0x2ab7f9,null));};exports[_0xdda2('0x27')]=function(_0x2d5781,_0xed5a58){if(_0x2d5781[_0xdda2('0x6b')]['id']){delete _0x2d5781[_0xdda2('0x6b')]['id'];}return db[_0xdda2('0x33')][_0xdda2('0x57')]({'where':{'id':_0x2d5781[_0xdda2('0xab')]['id']}})['then'](handleEntityNotFound(_0xed5a58,null))[_0xdda2('0x30')](saveUpdates(_0x2d5781['body'],null))[_0xdda2('0x30')](respondWithResult(_0xed5a58,null))['catch'](handleError(_0xed5a58,null));};exports[_0xdda2('0x28')]=function(_0x4b9243,_0x40a05c){return db[_0xdda2('0x33')][_0xdda2('0x57')]({'where':{'id':_0x4b9243[_0xdda2('0xab')]['id']}})[_0xdda2('0x30')](handleEntityNotFound(_0x40a05c,null))[_0xdda2('0x30')](removeEntity(_0x40a05c,null))[_0xdda2('0x31')](handleError(_0x40a05c,null));};exports[_0xdda2('0xac')]=function(_0x947086,_0x49db3b){return db[_0xdda2('0x33')][_0xdda2('0xac')]()['then'](respondWithResult(_0x49db3b,null))[_0xdda2('0x31')](handleError(_0x49db3b,null));};exports[_0xdda2('0xad')]=function(_0x2f3807,_0x5600da,_0x1702ae){return db[_0xdda2('0xae')][_0xdda2('0x57')]({'where':{'id':_0x2f3807[_0xdda2('0xab')]['id']}})[_0xdda2('0x30')](handleEntityNotFound(_0x5600da,null))[_0xdda2('0x30')](function(_0x4124a5){if(_0x4124a5){return _0x4124a5[_0xdda2('0xad')](_0x2f3807[_0xdda2('0x6b')][_0xdda2('0xaf')],_['omit'](_0x2f3807[_0xdda2('0x6b')],[_0xdda2('0xaf'),'id'])||{});}})[_0xdda2('0x30')](respondWithResult(_0x5600da,null))[_0xdda2('0x31')](handleError(_0x5600da,null));};exports[_0xdda2('0xb0')]=function(_0x4c540d,_0x320cf1,_0xc7e1e3){var _0xdd343d={'raw':![],'where':{}};var _0x56cd13={};var _0x19c36d={'count':0x0,'rows':[]};return db[_0xdda2('0x33')][_0xdda2('0xb1')]({'where':{'id':_0x4c540d['params']['id']}})[_0xdda2('0x30')](handleEntityNotFound(_0x320cf1,null))['then'](function(_0x579fc9){if(_0x579fc9){_0x56cd13[_0xdda2('0x3a')]=_[_0xdda2('0x38')](db[_0xdda2('0xae')][_0xdda2('0xb2')]);_0x56cd13[_0xdda2('0x37')]=_[_0xdda2('0x38')](_0x4c540d[_0xdda2('0x37')]);_0x56cd13['filters']=_['intersection'](_0x56cd13[_0xdda2('0x3a')],_0x56cd13[_0xdda2('0x37')]);_0xdd343d[_0xdda2('0x3c')]=_[_0xdda2('0xb3')](_0x56cd13[_0xdda2('0x3a')],qs['fields'](_0x4c540d[_0xdda2('0x37')][_0xdda2('0x3b')]));_0xdd343d[_0xdda2('0x3c')]=_0xdd343d[_0xdda2('0x3c')][_0xdda2('0x3d')]?_0xdd343d[_0xdda2('0x3c')]:_0x56cd13[_0xdda2('0x3a')];if(!_0x4c540d[_0xdda2('0x37')][_0xdda2('0xb4')](_0xdda2('0xb5'))){_0xdd343d[_0xdda2('0x22')]=qs[_0xdda2('0x22')](_0x4c540d[_0xdda2('0x37')][_0xdda2('0x22')]);_0xdd343d[_0xdda2('0x21')]=qs[_0xdda2('0x21')](_0x4c540d['query'][_0xdda2('0x21')]);}_0xdd343d['order']=qs[_0xdda2('0x3f')](_0x4c540d[_0xdda2('0x37')][_0xdda2('0x3f')]);_0xdd343d['where']=qs[_0xdda2('0x39')](_[_0xdda2('0xb6')](_0x4c540d[_0xdda2('0x37')],_0x56cd13['filters']));_0xdd343d[_0xdda2('0x75')][_0xdda2('0xa4')]=_0x579fc9['id'];if(_0x4c540d[_0xdda2('0x37')]['filter']){_0xdd343d['where']=_[_0xdda2('0x92')](_0xdd343d['where'],{'$or':_[_0xdda2('0x2c')](_0xdd343d[_0xdda2('0x3c')],function(_0x23b9bd){var _0x182570={};_0x182570[_0x23b9bd]={'$like':'%'+_0x4c540d['query'][_0xdda2('0x7e')]+'%'};return _0x182570;})});}if(_0x4c540d['query']['$gte']){var _0x50d63b=_0x4c540d['query'][_0xdda2('0x71')]['split'](',');var _0x155dc3={};_0x155dc3[_0x50d63b[0x0]]={'$gte':moment(_0x50d63b[0x1])[_0xdda2('0xb7')]('YYYY-MM-DD\x20HH:mm:ss')};_0xdd343d['where']=_[_0xdda2('0x92')](_0xdd343d[_0xdda2('0x75')],_0x155dc3);}_0xdd343d=_[_0xdda2('0x92')]({},_0xdd343d,_0x4c540d[_0xdda2('0xa9')]);return db['SmsMessage']['count']({'where':_0xdd343d[_0xdda2('0x75')]})[_0xdda2('0x30')](function(_0xaa5d94){_0x19c36d[_0xdda2('0x20')]=_0xaa5d94;if(_0x4c540d['query'][_0xdda2('0xa7')]){_0xdd343d[_0xdda2('0xa8')]=[{'all':!![]}];}return db[_0xdda2('0xae')][_0xdda2('0xb8')](_0xdd343d);})[_0xdda2('0x30')](function(_0x1fdc68){_0x19c36d[_0xdda2('0xb9')]=_0x1fdc68;return _0x19c36d;});}})[_0xdda2('0x30')](respondWithFilteredResult(_0x320cf1,_0xdd343d))[_0xdda2('0x31')](handleError(_0x320cf1,null));};exports[_0xdda2('0xba')]=function(_0xb49be,_0x26144b,_0x22f11c){return db[_0xdda2('0x33')][_0xdda2('0x57')]({'where':{'id':_0xb49be[_0xdda2('0xab')]['id']}})['then'](handleEntityNotFound(_0x26144b,null))[_0xdda2('0x30')](function(_0x1e5460){if(_0x1e5460){return _0x1e5460[_0xdda2('0xbb')](_0xb49be[_0xdda2('0x6b')][_0xdda2('0xaf')],_[_0xdda2('0xbc')](_0xb49be[_0xdda2('0x6b')],[_0xdda2('0xaf'),'id'])||{})[_0xdda2('0xbd')](function(){return db[_0xdda2('0xbe')][_0xdda2('0xb8')]({'attributes':['id',_0xdda2('0x2a'),_0xdda2('0x42')],'where':{'id':_0xb49be[_0xdda2('0x6b')][_0xdda2('0xaf')]}});})['then'](function(_0x17c084){socket[_0xdda2('0xbf')](_0xdda2('0xc0'),{'id':Number(_0xb49be[_0xdda2('0xab')]['id']),'tags':_0x17c084||[]});return{'id':Number(_0xb49be[_0xdda2('0xab')]['id']),'tags':_0x17c084||[]};});}})[_0xdda2('0x30')](respondWithResult(_0x26144b,null))[_0xdda2('0x31')](handleError(_0x26144b,null));};exports[_0xdda2('0xc1')]=function(_0x36c240,_0x324f36,_0x57dd62){return db[_0xdda2('0x33')]['find']({'where':{'id':_0x36c240['params']['id']}})[_0xdda2('0x30')](handleEntityNotFound(_0x324f36,null))[_0xdda2('0x30')](function(_0x28682b){if(_0x28682b){return _0x28682b[_0xdda2('0xc1')](_0x36c240[_0xdda2('0x37')]['ids']);}})[_0xdda2('0x30')](respondWithStatusCode(_0x324f36,null))[_0xdda2('0x31')](handleError(_0x324f36,null));};exports[_0xdda2('0xc2')]=function(_0x297bd1,_0xe6ffc9){var _0x1e7804=moment()[_0xdda2('0xc3')]()[_0xdda2('0xa2')]();var _0x577f44=path['join'](config[_0xdda2('0xc4')],_0xdda2('0xc5'),_0xdda2('0xc6'),'tmp');var _0x5980e3=path['join'](config[_0xdda2('0xc4')],_0xdda2('0xc5'),_0xdda2('0xc6'),_0xdda2('0xc7'));var _0x493b57=path[_0xdda2('0xc8')](_0x577f44,_0x1e7804);var _0x4b84f5=util[_0xdda2('0xb7')]('transcript-%d-%s.zip',_0x297bd1[_0xdda2('0xab')]['id'],_0x1e7804);var _0x223c52=path[_0xdda2('0xc8')](_0x577f44,_0x4b84f5);var _0x4d0e51=[];_0x4d0e51[_0xdda2('0xa5')]({'model':db[_0xdda2('0x67')],'as':_0xdda2('0x67'),'attributes':['id','fullname'],'raw':!![]});_0x4d0e51[_0xdda2('0xa5')]({'model':db[_0xdda2('0xc9')],'as':'Contact','attributes':['id',_0xdda2('0xca'),_0xdda2('0xcb')],'raw':!![]});var _0x48e6e6=[{'model':db['SmsMessage'],'as':'Messages','attributes':['id',_0xdda2('0x6b'),'createdAt','direction',_0xdda2('0xcc'),_0xdda2('0x78')],'include':_0x4d0e51}];_0x48e6e6[_0xdda2('0xa5')]({'model':db[_0xdda2('0xcd')],'as':_0xdda2('0xce'),'attributes':['id',_0xdda2('0x2a')]});_0x48e6e6['push']({'model':db['User'],'as':_0xdda2('0xcf'),'attributes':['id','fullname']});return db[_0xdda2('0x33')][_0xdda2('0x57')]({'where':{'id':_0x297bd1[_0xdda2('0xab')]['id']},'include':_0x48e6e6})[_0xdda2('0x30')](handleEntityNotFound(_0xe6ffc9,null))[_0xdda2('0x30')](function(_0x3b4600){if(_0x3b4600){var _0x546551=_0x3b4600[_0xdda2('0xd0')]({'plain':!![]});fs['mkdirSync'](_0x493b57);var _0x28faa7={'format':'A4','border':_0xdda2('0xd1'),'header':{'height':_0xdda2('0xd2'),'contents':{'first':_0xdda2('0xd3')}},'footer':{'height':_0xdda2('0xd4'),'contents':{'default':util[_0xdda2('0xb7')](_0xdda2('0xd5'),util[_0xdda2('0xb7')](_0xdda2('0xd6'),_0xdda2('0xd7'),_0x546551['id']),moment()[_0xdda2('0xb7')](_0xdda2('0xd8'))[_0xdda2('0xa2')]())}}};var _0x23add5={'channel':_0xdda2('0xd7'),'account':_0x546551[_0xdda2('0xce')]['name'],'agent':_0x546551[_0xdda2('0xcf')]?_0x546551[_0xdda2('0xcf')][_0xdda2('0x2d')]:_0xdda2('0xd9'),'createdAt':moment(_0x546551[_0xdda2('0xda')])[_0xdda2('0xb7')](_0xdda2('0xdb'))[_0xdda2('0xa2')](),'closedAt':_0x546551[_0xdda2('0xdc')]?moment(_0x546551[_0xdda2('0xdd')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x546551[_0xdda2('0xde')],'messages':_(_0x546551[_0xdda2('0xdf')])['filter']({'secret':![]})[_0xdda2('0x2c')](function(_0x241373){return{'date':moment(_0x241373[_0xdda2('0xda')])[_0xdda2('0xb7')](_0xdda2('0xdb'))[_0xdda2('0xa2')](),'sender':_0x241373['direction']===_0xdda2('0xe0')?_0x241373['User']?_0x241373[_0xdda2('0x67')][_0xdda2('0x2d')]:_0xdda2('0xe1'):_0x241373['Contact'][_0xdda2('0xca')]+(_0x241373[_0xdda2('0x5c')][_0xdda2('0xcb')]?'\x20'+_0x241373[_0xdda2('0x5c')]['lastName']:''),'body':_0x241373[_0xdda2('0x6b')],'direction':_0x241373[_0xdda2('0xe2')]===_0xdda2('0xe0')?'A':'C','secret':_0x241373[_0xdda2('0xcc')],'read':_0x241373[_0xdda2('0x78')]};})['value']()};return ejs[_0xdda2('0xe3')](path['join'](config[_0xdda2('0xc4')],_0xdda2('0xc5'),_0xdda2('0xe4'),'downloadInteraction.html'),{'interaction':_0x23add5})[_0xdda2('0x30')](function(_0x3e8409){return new BPromise(function(_0x36dbd3,_0x1894fc){pdf[_0xdda2('0xaa')](_0x3e8409,_0x28faa7)[_0xdda2('0xe5')](path[_0xdda2('0xc8')](_0x493b57,_0xdda2('0xe6')+_0x546551['id']+'-'+_0x1e7804+_0xdda2('0xe7')),function(_0x2c8031,_0x20b0cc){if(_0x2c8031)return _0x1894fc(_0x2c8031);_0x36dbd3(_0x20b0cc);});});})[_0xdda2('0x30')](function(){return new BPromise(function(_0x3ed7fa,_0x1d2039){zipdir(_0x493b57,{'saveTo':_0x223c52},function(_0xee0164,_0x58fa2a){if(_0xee0164)return _0x1d2039(_0xee0164);return _0x3ed7fa(_0x58fa2a);});})[_0xdda2('0x30')](function(){return new BPromise(function(_0x5b66f7,_0x32f17d){rimraf(_0x493b57,function(_0xbe4ca){if(_0xbe4ca)_0x32f17d(_0xbe4ca);return _0x5b66f7();});});})['then'](function(){return _0xe6ffc9[_0xdda2('0xc2')](_0x223c52,_0x4b84f5,function(_0x209f33){if(_0x209f33){console[_0xdda2('0xe8')]('err',_0x209f33);}else{fs['unlinkSync'](_0x223c52);}});});});}else{return _0xe6ffc9['sendStatus'](0xc8);}})[_0xdda2('0x31')](handleError(_0xe6ffc9,null));}; \ No newline at end of file +var _0x82c4=['closedAt','disposition','direction','out','secret','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','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','stack','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','fieldName','key','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','sms_messages','sms_interaction_has_tags','it.SmsInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','$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','type','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','SmsAccountId','concat','createdAt','parse','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','\x27\x27\x27\x27','isNumeric','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','order','isEmpty','resolve','journey','i.SmsAccountId\x20IS\x20NOT\x20NULL','user','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','sequelize','toString','count','merge','SmsInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','Contact.fax','o.fullname','o.internal','Owner.internal','groupBy','all','rows','show','include','options','params','describe','addMessage','ids','omit','findOne','SmsMessage','SmsInteractionId','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','spread','smsInteractionTags:save','removeTags','download','join','files','root','server','format','transcript-%d-%s.zip','User','CmContact','Contact','firstName','lastName','Messages','Owner','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','Account','N.A.'];(function(_0x1acc01,_0x5cb80c){var _0x5603f1=function(_0x5e7558){while(--_0x5e7558){_0x1acc01['push'](_0x1acc01['shift']());}};_0x5603f1(++_0x5cb80c);}(_0x82c4,0x1ca));var _0x482c=function(_0x25c934,_0x1531e6){_0x25c934=_0x25c934-0x0;var _0x22806e=_0x82c4[_0x25c934];return _0x22806e;};'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('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x14452b,_0xe3f853){_0xe3f853=_0xe3f853||0xcc;return function(_0x46016e){if(_0x46016e){return _0x14452b[_0x482c('0x1c')](_0xe3f853);}return _0x14452b[_0x482c('0x1d')](_0xe3f853)[_0x482c('0x1e')]();};}function respondWithResult(_0x3beedb,_0xf65563){_0xf65563=_0xf65563||0xc8;return function(_0x3fc79c){if(_0x3fc79c){return _0x3beedb[_0x482c('0x1d')](_0xf65563)[_0x482c('0x1f')](_0x3fc79c);}};}function respondWithFilteredResult(_0xedaee0,_0x4bdf15){return function(_0x244bb9){if(_0x244bb9){var _0x5b6f7e=_0x244bb9['count'],_0x3aed45=_0x4bdf15[_0x482c('0x20')],_0x258148=_0x4bdf15['offset']+_0x4bdf15[_0x482c('0x21')],_0x4af05a;if(_0x258148>=_0x5b6f7e){_0x258148=_0x5b6f7e;_0x4af05a=0xc8;}else{_0x4af05a=0xce;}_0xedaee0[_0x482c('0x1d')](_0x4af05a);return _0xedaee0[_0x482c('0x22')](_0x482c('0x23'),_0x3aed45+'-'+_0x258148+'/'+_0x5b6f7e)['json'](_0x244bb9);}return null;};}function patchUpdates(_0x1c9a7b){return function(_0x22eec6){try{jsonpatch[_0x482c('0x24')](_0x22eec6,_0x1c9a7b,!![]);}catch(_0xd18658){return BPromise[_0x482c('0x25')](_0xd18658);}return _0x22eec6['save']();};}function saveUpdates(_0x4afcd9,_0x238503){return function(_0x147d05){if(_0x147d05){return _0x147d05[_0x482c('0x26')](_0x4afcd9)['then'](function(_0x3d5490){return _0x3d5490;});}return null;};}function removeEntity(_0x579d2f,_0x2f3f96){return function(_0xc2df7){if(_0xc2df7){return _0xc2df7['destroy']()[_0x482c('0x27')](function(){_0x579d2f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2165af,_0x27f1b5){return function(_0x36b25c){if(!_0x36b25c){_0x2165af[_0x482c('0x1c')](0x194);}return _0x36b25c;};}function handleError(_0x3bd5bb,_0x215826){_0x215826=_0x215826||0x1f4;return function(_0x2981d2){logger['error'](_0x2981d2[_0x482c('0x28')]);if(_0x2981d2[_0x482c('0x29')]){delete _0x2981d2['name'];}_0x3bd5bb[_0x482c('0x1d')](_0x215826)['send'](_0x2981d2);};}function getInteractionUsers(_0x54782d,_0x207441){return new BPromise(function(_0x5af04c,_0x1ac1c4){try{if(_0x207441[_0x54782d['id']]){_0x54782d[_0x482c('0x2a')]=_[_0x482c('0x2b')](_0x207441[_0x54782d['id']],function(_0x11fa65){return{'id':_0x11fa65['id'],'fullname':_0x11fa65[_0x482c('0x2c')]};});}}catch(_0x11950f){_0x1ac1c4(_0x11950f);}_0x5af04c(_0x54782d);});}function getInteractionTags(_0x36b00d,_0x3e9b22){return new BPromise(function(_0x24b4df,_0x2d3800){try{if(_0x36b00d[_0x482c('0x2d')]){_0x36b00d[_0x482c('0x2e')]=[];_0x36b00d[_0x482c('0x2d')][_0x482c('0x2f')](',')[_0x482c('0x30')](function(_0x164417){_0x36b00d[_0x482c('0x2e')][_0x482c('0x31')](_0x3e9b22[_0x164417]);});}delete _0x36b00d['TagIds'];}catch(_0x4bc837){_0x2d3800(_0x4bc837);}_0x24b4df(_0x36b00d);});}function updateSmsInteraction(_0x520b6b,_0x2fd9d0,_0x22e759){return new BPromise(function(_0x46d06a,_0x38d3e2){return getInteractionUsers(_0x520b6b,_0x22e759)['then'](function(_0x12ad47){return getInteractionTags(_0x12ad47,_0x2fd9d0);})['then'](function(_0x31428c){_0x46d06a(_0x31428c);})[_0x482c('0x32')](function(_0xdb7f5a){_0x38d3e2(_0xdb7f5a);});});}exports[_0x482c('0x33')]=function(_0x15223b,_0x19cfc8){var _0x129a31={},_0x34e80c={},_0x5377ce={'count':0x0,'rows':[]};var _0x5783a7=_[_0x482c('0x2b')](db['SmsInteraction'][_0x482c('0x34')],function(_0x1974ad){return{'name':_0x1974ad[_0x482c('0x35')],'type':_0x1974ad['type'][_0x482c('0x36')]};});_0x34e80c[_0x482c('0x37')]=_[_0x482c('0x2b')](_0x5783a7,_0x482c('0x29'));_0x34e80c['query']=_[_0x482c('0x38')](_0x15223b['query']);_0x34e80c[_0x482c('0x39')]=_['intersection'](_0x34e80c[_0x482c('0x37')],_0x34e80c['query']);_0x129a31[_0x482c('0x3a')]=_[_0x482c('0x3b')](_0x34e80c['model'],qs[_0x482c('0x3c')](_0x15223b['query']['fields']));_0x129a31[_0x482c('0x3a')]=_0x129a31['attributes']['length']?_0x129a31['attributes']:_0x34e80c['model'];if(!_0x15223b[_0x482c('0x3d')][_0x482c('0x3e')](_0x482c('0x3f'))){_0x129a31[_0x482c('0x21')]=qs[_0x482c('0x21')](_0x15223b['query'][_0x482c('0x21')]);_0x129a31[_0x482c('0x20')]=qs[_0x482c('0x20')](_0x15223b[_0x482c('0x3d')]['offset']);}_0x129a31['order']=qs[_0x482c('0x40')](_0x15223b[_0x482c('0x3d')][_0x482c('0x40')]);_0x129a31[_0x482c('0x41')]=qs[_0x482c('0x39')](_[_0x482c('0x42')](_0x15223b[_0x482c('0x3d')],_0x34e80c[_0x482c('0x39')]));var _0x1bc15a=[];var _0x15fc22=squel[_0x482c('0x43')]()['field']('id')[_0x482c('0x44')](_0x482c('0x29'))[_0x482c('0x44')](_0x482c('0x45'))[_0x482c('0x46')](_0x482c('0x47'));var _0x1adccc=squel['select']()['field'](_0x482c('0x48'))[_0x482c('0x44')](_0x482c('0x49'))['field'](_0x482c('0x4a'))['from'](_0x482c('0x4b'),'ui')[_0x482c('0x4c')](_0x482c('0x4d'),'u',_0x482c('0x4e'));var _0x5f4e0a=squel[_0x482c('0x43')]()[_0x482c('0x46')](_0x482c('0x4f'),'i')['left_join'](_0x482c('0x50'),'c',_0x482c('0x51'))[_0x482c('0x4c')]('users','o','o.id\x20=\x20i.UserId')['left_join']('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')['left_join'](_0x482c('0x52'),'me','me.SmsInteractionId\x20=\x20i.id')[_0x482c('0x4c')](_0x482c('0x53'),'it',_0x482c('0x54'))[_0x482c('0x4c')](_0x482c('0x47'),'t',_0x482c('0x55'));var _0x37be4f=squel[_0x482c('0x56')]();var _0x240592=[];var _0x35eac3=squel[_0x482c('0x56')]();var _0x3f7ff7;if(_0x15223b[_0x482c('0x3d')][_0x482c('0x57')]){_0x3f7ff7=as[_0x482c('0x58')](_0x15223b[_0x482c('0x3d')][_0x482c('0x57')]);var _0x31ac21=_0x3f7ff7[_0x482c('0x59')];for(var _0x495aaa=0x0;_0x495aaa<_0x3f7ff7[_0x482c('0x5a')][_0x482c('0x5b')];_0x495aaa++){var _0x57e049=_0x3f7ff7[_0x482c('0x5a')][_0x495aaa];var _0x29cdb6='i';var _0x1f5e5b=_[_0x482c('0x5c')](_0x5783a7,[_0x482c('0x29'),_0x57e049['field']]);if(!_0x1f5e5b){switch(_0x57e049['field']){case _0x482c('0x5d'):if(_0x57e049[_0x482c('0x5e')]==0x1){_0x5f4e0a[_0x482c('0x5f')]('`'+_0x57e049[_0x482c('0x44')]+_0x482c('0x60'));}else{_0x5f4e0a[_0x482c('0x5f')]('`'+_0x57e049[_0x482c('0x44')]+'`\x20>\x200');}break;case'Contact':if(_0x57e049['operator']===_0x482c('0x61')){if(_0x57e049[_0x482c('0x5e')][_0x482c('0x2f')]('\x20')[_0x482c('0x5b')]>0x1){_0x37be4f[_0x31ac21](_0x482c('0x62'),qs[_0x482c('0x63')](_0x57e049[_0x482c('0x5e')]),null);}else{var _0x43fa40='%'+_0x57e049[_0x482c('0x5e')]+'%';_0x37be4f[_0x31ac21](_0x482c('0x64'),_0x43fa40,_0x43fa40,_0x43fa40);}}else{_0x1f5e5b=_[_0x482c('0x5c')](_0x5783a7,['name',_0x482c('0x65')]);_0x57e049[_0x482c('0x44')]=_0x482c('0x65');_0x337a09=as[_0x482c('0x66')](_0x29cdb6,_0x1f5e5b[_0x482c('0x67')],_0x57e049);_0x37be4f[_0x31ac21](_0x337a09[_0x482c('0x68')],_0x337a09[_0x482c('0x5e')][_0x482c('0x69')],_0x337a09[_0x482c('0x5e')][_0x482c('0x1e')]);}break;case _0x482c('0x6a'):var _0x1ff536=_0x57e049['value']['split'](',')[_0x482c('0x2b')](function(_0xe52d69){return Number(_0xe52d69);});_0x1ff536[_0x482c('0x30')](function(_0x5a75c1){_0x35eac3['or'](_0x482c('0x6b'),'%,'+_0x5a75c1+',%');});_0x240592=_[_0x482c('0x6c')](_0x240592,_0x1ff536);break;case'User':if(_0x57e049[_0x482c('0x6d')]===_0x482c('0x61')){_0x37be4f[_0x31ac21](_0x482c('0x6e'),'%'+_0x57e049[_0x482c('0x5e')]+'%',null);}else{_0x1f5e5b=_[_0x482c('0x5c')](_0x5783a7,[_0x482c('0x29'),_0x482c('0x6f')]);_0x57e049[_0x482c('0x44')]=_0x482c('0x6f');_0x337a09=as[_0x482c('0x66')](_0x29cdb6,_0x1f5e5b[_0x482c('0x67')],_0x57e049);_0x37be4f[_0x31ac21](_0x337a09[_0x482c('0x68')],_0x337a09['value'][_0x482c('0x69')],_0x337a09['value'][_0x482c('0x1e')]);}break;case _0x482c('0x70'):_0x337a09=as[_0x482c('0x66')]('me',null,_0x57e049);_0x37be4f[_0x31ac21](_0x337a09[_0x482c('0x68')],_0x337a09[_0x482c('0x5e')][_0x482c('0x69')],_0x337a09['value'][_0x482c('0x1e')]);break;}}else{var _0x337a09=as['buildExpression'](_0x29cdb6,_0x1f5e5b['type'],_0x57e049);_0x37be4f[_0x31ac21](_0x337a09[_0x482c('0x68')],_0x337a09[_0x482c('0x5e')]['start'],_0x337a09[_0x482c('0x5e')][_0x482c('0x1e')]);}}}else{var _0x1ca687=_(_0x15223b[_0x482c('0x3d')])['keys']()[_0x482c('0x2b')](function(_0x387fca){return _[_0x482c('0x71')](_0x5783a7,[_0x482c('0x29'),_0x387fca])?_0x387fca:undefined;})[_0x482c('0x72')]()[_0x482c('0x5e')]();if(!_['isEmpty'](_0x1ca687)){_0x1ca687['forEach'](function(_0x2cace1){if(_0x2cace1===_0x482c('0x73')){_0x5f4e0a[_0x482c('0x41')]('i.SmsAccountId\x20IN\x20?',[][_0x482c('0x74')](_0x15223b[_0x482c('0x3d')][_0x2cace1]));}else if(_0x2cace1===_0x482c('0x75')){var _0x3b7951=JSON[_0x482c('0x76')](_0x15223b[_0x482c('0x3d')][_0x2cace1])[_0x482c('0x77')];var _0x37e456=JSON[_0x482c('0x76')](_0x15223b['query'][_0x2cace1])['$lte'];_0x5f4e0a[_0x482c('0x41')](_0x482c('0x78'),_0x3b7951,_0x37e456);}else{if(_0x15223b['query'][_0x2cace1]==='null'){_0x5f4e0a[_0x482c('0x41')]('i.'+_0x2cace1+_0x482c('0x79'));}else{_0x5f4e0a[_0x482c('0x41')]('i.'+_0x2cace1+'\x20=\x20?',_0x15223b['query'][_0x2cace1]);}}});}if(_0x15223b['query'][_0x482c('0x7a')]){if(_0x15223b[_0x482c('0x3d')][_0x482c('0x7a')]==0x1){_0x5f4e0a[_0x482c('0x5f')](_0x482c('0x7b'));}else{_0x5f4e0a[_0x482c('0x5f')]('`unreadMessages`\x20>\x200');}}if(_0x15223b['query'][_0x482c('0x7c')]){_0x240592=_[_0x482c('0x7d')](_0x15223b[_0x482c('0x3d')][_0x482c('0x7c')])?_0x15223b[_0x482c('0x3d')][_0x482c('0x7c')]:new Array(_0x15223b[_0x482c('0x3d')][_0x482c('0x7c')]);_0x240592[_0x482c('0x30')](function(_0x142809){_0x35eac3['or'](_0x482c('0x6b'),'%,'+_0x142809+',%');});}if(_0x15223b[_0x482c('0x3d')]['filter']){var _0x20f5cb=_0x15223b[_0x482c('0x3d')][_0x482c('0x7e')]['replace']('\x5c','\x5c\x5c')[_0x482c('0x7f')]('\x27\x27',_0x482c('0x80'));if(qs[_0x482c('0x81')](_0x20f5cb)){_0x37be4f['or']('i.id\x20LIKE\x20?',_0x20f5cb+'%')['or'](_0x482c('0x82'),_0x20f5cb+'%');}else{_0x37be4f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x20f5cb))['or'](_0x482c('0x83'),_0x20f5cb+'%');}}}_0x5f4e0a[_0x482c('0x41')](_0x37be4f);_0x5f4e0a[_0x482c('0x84')](_0x482c('0x85'));var _0xcc3fe7={'type':db[_0x482c('0x86')][_0x482c('0x87')]['SELECT'],'raw':!![]};var _0x1d497b=_0x5f4e0a[_0x482c('0x88')]();_0x1d497b['field'](_0x482c('0x85'));_0x1d497b['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x129a31[_0x482c('0x89')]){_0x129a31['order']['forEach'](function(_0xc7bebc){_0x5f4e0a[_0x482c('0x89')]('i.'+_0xc7bebc[0x0],_0xc7bebc[0x1]==='DESC'?![]:!![]);});}if(!_[_0x482c('0x8a')](_0x240592)){_0x5f4e0a['having'](_0x35eac3);_0x1d497b['where']('t.id\x20IN\x20?',_0x240592);}BPromise[_0x482c('0x8b')]()[_0x482c('0x27')](function(){if(!_0x3f7ff7){if(_0x15223b['query']['SmsAccountId']||_0x15223b['query'][_0x482c('0x8c')])return;_0x1d497b[_0x482c('0x41')](_0x482c('0x8d'));_0x5f4e0a['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}return _0x15223b[_0x482c('0x8e')]['getSmsAccounts']({'attributes':['id'],'raw':!![]})[_0x482c('0x27')](function(_0x2c3702){if(_['isEmpty'](_0x2c3702)){_0x1d497b[_0x482c('0x41')]('i.SmsAccountId\x20IS\x20NULL');_0x5f4e0a['where'](_0x482c('0x8f'));}else{_0x1d497b['where'](_0x482c('0x90'),_['map'](_0x2c3702,'id'));_0x5f4e0a[_0x482c('0x41')]('i.SmsAccountId\x20IN\x20?',_[_0x482c('0x2b')](_0x2c3702,'id'));}});})[_0x482c('0x27')](function(){db[_0x482c('0x91')]['query'](_0x1d497b[_0x482c('0x92')](),_0xcc3fe7)[_0x482c('0x27')](function(_0x1b2aed){_0x5377ce['count']=_0x1b2aed[_0x482c('0x5b')];if(_0x5377ce[_0x482c('0x93')]===0x0)return[];return db[_0x482c('0x91')][_0x482c('0x3d')](_0x15fc22[_0x482c('0x92')](),_0xcc3fe7)[_0x482c('0x27')](function(_0x426e81){_0x1bc15a=_['keyBy'](_0x426e81,'id');_0xcc3fe7=_[_0x482c('0x94')](_0xcc3fe7,{'model':db[_0x482c('0x95')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x15223b[_0x482c('0x3d')]['fields']){_0x129a31['attributes']['forEach'](function(_0x2b6e16){_0x5f4e0a['field']('i.'+_0x2b6e16);});}else{_0x5f4e0a['field'](_0x482c('0x96'),'unreadMessages');_0x5f4e0a[_0x482c('0x44')](_0x482c('0x97'),_0x482c('0x98'));_0x5f4e0a[_0x482c('0x44')]('a.mandatoryDisposition',_0x482c('0x99'));_0x5f4e0a['field'](_0x482c('0x9a'));_0x5f4e0a[_0x482c('0x44')](_0x482c('0x9b'),'Contact.firstName');_0x5f4e0a['field'](_0x482c('0x9c'),_0x482c('0x9d'));_0x5f4e0a['field'](_0x482c('0x9e'),'Contact.email');_0x5f4e0a[_0x482c('0x44')](_0x482c('0x9f'),_0x482c('0xa0'));_0x5f4e0a['field'](_0x482c('0xa1'),_0x482c('0xa2'));_0x5f4e0a[_0x482c('0x44')]('c.fax',_0x482c('0xa3'));_0x5f4e0a[_0x482c('0x44')](_0x482c('0xa4'),'Owner.fullname');_0x5f4e0a['field'](_0x482c('0xa5'),_0x482c('0xa6'));_0x5f4e0a[_0x482c('0x44')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x482c('0x2d'));}_0x5f4e0a[_0x482c('0x21')](_0x129a31['limit']);_0x5f4e0a[_0x482c('0x20')](_0x129a31['offset']);return db[_0x482c('0x91')][_0x482c('0x3d')](_0x5f4e0a[_0x482c('0x92')](),_0xcc3fe7);})[_0x482c('0x27')](function(_0x2db600){_0x1adccc[_0x482c('0x41')]('ui.SmsInteractionId\x20IN\x20?',_['map'](_0x2db600,'id'));return db[_0x482c('0x91')][_0x482c('0x3d')](_0x1adccc[_0x482c('0x92')](),_0xcc3fe7)[_0x482c('0x27')](function(_0x7d0afa){var _0x13df33=_[_0x482c('0xa7')](_0x7d0afa,'SmsInteractionId');var _0x3f5eac=[];_0x2db600[_0x482c('0x30')](function(_0x330d0f){_0x3f5eac['push'](updateSmsInteraction(_0x330d0f,_0x1bc15a,_0x13df33));});return BPromise[_0x482c('0xa8')](_0x3f5eac);});});})[_0x482c('0x27')](function(_0x2eca83){_0x5377ce[_0x482c('0xa9')]=_0x2eca83;return _0x5377ce;})[_0x482c('0x27')](respondWithFilteredResult(_0x19cfc8,_0x129a31));})[_0x482c('0x32')](handleError(_0x19cfc8,null));};exports[_0x482c('0xaa')]=function(_0x52c53a,_0x3b4e27){var _0x1184a3={'raw':![],'where':{'id':_0x52c53a['params']['id']}},_0x1f42df={};_0x1f42df[_0x482c('0x37')]=_['keys'](db[_0x482c('0x95')][_0x482c('0x34')]);_0x1f42df[_0x482c('0x3d')]=_[_0x482c('0x38')](_0x52c53a['query']);_0x1f42df[_0x482c('0x39')]=_[_0x482c('0x3b')](_0x1f42df[_0x482c('0x37')],_0x1f42df[_0x482c('0x3d')]);_0x1184a3['attributes']=_[_0x482c('0x3b')](_0x1f42df[_0x482c('0x37')],qs[_0x482c('0x3c')](_0x52c53a[_0x482c('0x3d')][_0x482c('0x3c')]));_0x1184a3['attributes']=_0x1184a3[_0x482c('0x3a')][_0x482c('0x5b')]?_0x1184a3[_0x482c('0x3a')]:_0x1f42df[_0x482c('0x37')];if(_0x52c53a[_0x482c('0x3d')]['includeAll']){_0x1184a3[_0x482c('0xab')]=[{'all':!![]}];}_0x1184a3=_[_0x482c('0x94')]({},_0x1184a3,_0x52c53a[_0x482c('0xac')]);return db['SmsInteraction'][_0x482c('0x5c')](_0x1184a3)[_0x482c('0x27')](handleEntityNotFound(_0x3b4e27,null))[_0x482c('0x27')](respondWithResult(_0x3b4e27,null))[_0x482c('0x32')](handleError(_0x3b4e27,null));};exports['create']=function(_0x73c25f,_0x2da8de){return db[_0x482c('0x95')]['create'](_0x73c25f[_0x482c('0x70')],{})[_0x482c('0x27')](respondWithResult(_0x2da8de,0xc9))[_0x482c('0x32')](handleError(_0x2da8de,null));};exports[_0x482c('0x26')]=function(_0x561d86,_0x5529d0){if(_0x561d86['body']['id']){delete _0x561d86[_0x482c('0x70')]['id'];}return db[_0x482c('0x95')][_0x482c('0x5c')]({'where':{'id':_0x561d86[_0x482c('0xad')]['id']}})[_0x482c('0x27')](handleEntityNotFound(_0x5529d0,null))[_0x482c('0x27')](saveUpdates(_0x561d86[_0x482c('0x70')],null))['then'](respondWithResult(_0x5529d0,null))['catch'](handleError(_0x5529d0,null));};exports['destroy']=function(_0xf19f95,_0x3008de){return db[_0x482c('0x95')][_0x482c('0x5c')]({'where':{'id':_0xf19f95[_0x482c('0xad')]['id']}})[_0x482c('0x27')](handleEntityNotFound(_0x3008de,null))[_0x482c('0x27')](removeEntity(_0x3008de,null))[_0x482c('0x32')](handleError(_0x3008de,null));};exports[_0x482c('0xae')]=function(_0x522d2a,_0x1a84b){return db[_0x482c('0x95')][_0x482c('0xae')]()[_0x482c('0x27')](respondWithResult(_0x1a84b,null))[_0x482c('0x32')](handleError(_0x1a84b,null));};exports[_0x482c('0xaf')]=function(_0x3a8d3d,_0x4aa8f5,_0x48d158){return db['SmsMessage'][_0x482c('0x5c')]({'where':{'id':_0x3a8d3d['params']['id']}})[_0x482c('0x27')](handleEntityNotFound(_0x4aa8f5,null))[_0x482c('0x27')](function(_0x5d8f2d){if(_0x5d8f2d){return _0x5d8f2d[_0x482c('0xaf')](_0x3a8d3d[_0x482c('0x70')][_0x482c('0xb0')],_[_0x482c('0xb1')](_0x3a8d3d['body'],[_0x482c('0xb0'),'id'])||{});}})[_0x482c('0x27')](respondWithResult(_0x4aa8f5,null))[_0x482c('0x32')](handleError(_0x4aa8f5,null));};exports['getMessages']=function(_0x80e00d,_0x1d1d4e,_0x10331a){var _0x337096={'raw':![],'where':{}};var _0x28a24e={};var _0x47da5e={'count':0x0,'rows':[]};return db[_0x482c('0x95')][_0x482c('0xb2')]({'where':{'id':_0x80e00d['params']['id']}})['then'](handleEntityNotFound(_0x1d1d4e,null))['then'](function(_0x4e0516){if(_0x4e0516){_0x28a24e[_0x482c('0x37')]=_['keys'](db[_0x482c('0xb3')][_0x482c('0x34')]);_0x28a24e[_0x482c('0x3d')]=_[_0x482c('0x38')](_0x80e00d[_0x482c('0x3d')]);_0x28a24e[_0x482c('0x39')]=_[_0x482c('0x3b')](_0x28a24e[_0x482c('0x37')],_0x28a24e[_0x482c('0x3d')]);_0x337096[_0x482c('0x3a')]=_[_0x482c('0x3b')](_0x28a24e[_0x482c('0x37')],qs[_0x482c('0x3c')](_0x80e00d[_0x482c('0x3d')][_0x482c('0x3c')]));_0x337096[_0x482c('0x3a')]=_0x337096[_0x482c('0x3a')]['length']?_0x337096['attributes']:_0x28a24e[_0x482c('0x37')];if(!_0x80e00d[_0x482c('0x3d')][_0x482c('0x3e')](_0x482c('0x3f'))){_0x337096[_0x482c('0x21')]=qs[_0x482c('0x21')](_0x80e00d[_0x482c('0x3d')][_0x482c('0x21')]);_0x337096['offset']=qs['offset'](_0x80e00d[_0x482c('0x3d')]['offset']);}_0x337096[_0x482c('0x89')]=qs[_0x482c('0x40')](_0x80e00d[_0x482c('0x3d')][_0x482c('0x40')]);_0x337096[_0x482c('0x41')]=qs[_0x482c('0x39')](_[_0x482c('0x42')](_0x80e00d['query'],_0x28a24e[_0x482c('0x39')]));_0x337096[_0x482c('0x41')][_0x482c('0xb4')]=_0x4e0516['id'];if(_0x80e00d[_0x482c('0x3d')][_0x482c('0x7e')]){_0x337096['where']=_[_0x482c('0x94')](_0x337096[_0x482c('0x41')],{'$or':_[_0x482c('0x2b')](_0x337096['attributes'],function(_0x13bcab){var _0x155841={};_0x155841[_0x13bcab]={'$like':'%'+_0x80e00d[_0x482c('0x3d')][_0x482c('0x7e')]+'%'};return _0x155841;})});}if(_0x80e00d[_0x482c('0x3d')]['$gte']){var _0x34fd49=_0x80e00d[_0x482c('0x3d')]['$gte']['split'](',');var _0x555abd={};_0x555abd[_0x34fd49[0x0]]={'$gte':moment(_0x34fd49[0x1])['format'](_0x482c('0xb5'))};_0x337096[_0x482c('0x41')]=_[_0x482c('0x94')](_0x337096[_0x482c('0x41')],_0x555abd);}_0x337096=_[_0x482c('0x94')]({},_0x337096,_0x80e00d[_0x482c('0xac')]);return db['SmsMessage'][_0x482c('0x93')]({'where':_0x337096[_0x482c('0x41')]})['then'](function(_0x35f986){_0x47da5e[_0x482c('0x93')]=_0x35f986;if(_0x80e00d[_0x482c('0x3d')][_0x482c('0xb6')]){_0x337096['include']=[{'all':!![]}];}return db[_0x482c('0xb3')]['findAll'](_0x337096);})[_0x482c('0x27')](function(_0x7bf21e){_0x47da5e[_0x482c('0xa9')]=_0x7bf21e;return _0x47da5e;});}})['then'](respondWithFilteredResult(_0x1d1d4e,_0x337096))[_0x482c('0x32')](handleError(_0x1d1d4e,null));};exports[_0x482c('0xb7')]=function(_0x5766d6,_0x31481e,_0xf559eb){return db['SmsInteraction'][_0x482c('0x5c')]({'where':{'id':_0x5766d6[_0x482c('0xad')]['id']}})[_0x482c('0x27')](handleEntityNotFound(_0x31481e,null))[_0x482c('0x27')](function(_0x53f3f6){if(_0x53f3f6){return _0x53f3f6[_0x482c('0xb8')](_0x5766d6['body'][_0x482c('0xb0')],_[_0x482c('0xb1')](_0x5766d6[_0x482c('0x70')],[_0x482c('0xb0'),'id'])||{})[_0x482c('0xb9')](function(){return db['Tag']['findAll']({'attributes':['id',_0x482c('0x29'),_0x482c('0x45')],'where':{'id':_0x5766d6['body'][_0x482c('0xb0')]}});})[_0x482c('0x27')](function(_0x5b6932){socket['emit'](_0x482c('0xba'),{'id':Number(_0x5766d6['params']['id']),'tags':_0x5b6932||[]});return{'id':Number(_0x5766d6[_0x482c('0xad')]['id']),'tags':_0x5b6932||[]};});}})[_0x482c('0x27')](respondWithResult(_0x31481e,null))[_0x482c('0x32')](handleError(_0x31481e,null));};exports[_0x482c('0xbb')]=function(_0x2c49e0,_0x2a2b67,_0x454822){return db[_0x482c('0x95')][_0x482c('0x5c')]({'where':{'id':_0x2c49e0['params']['id']}})[_0x482c('0x27')](handleEntityNotFound(_0x2a2b67,null))['then'](function(_0x5a8f78){if(_0x5a8f78){return _0x5a8f78[_0x482c('0xbb')](_0x2c49e0[_0x482c('0x3d')]['ids']);}})[_0x482c('0x27')](respondWithStatusCode(_0x2a2b67,null))[_0x482c('0x32')](handleError(_0x2a2b67,null));};exports[_0x482c('0xbc')]=function(_0x5afa29,_0xd33eaa){var _0x4fc2bf=moment()['unix']()['toString']();var _0x3b827a=path[_0x482c('0xbd')](config['root'],'server',_0x482c('0xbe'),'tmp');var _0x5e0de9=path[_0x482c('0xbd')](config[_0x482c('0xbf')],_0x482c('0xc0'),_0x482c('0xbe'),'attachments');var _0x304ec8=path['join'](_0x3b827a,_0x4fc2bf);var _0x462894=util[_0x482c('0xc1')](_0x482c('0xc2'),_0x5afa29[_0x482c('0xad')]['id'],_0x4fc2bf);var _0x55ce96=path[_0x482c('0xbd')](_0x3b827a,_0x462894);var _0x5908d7=[];_0x5908d7[_0x482c('0x31')]({'model':db[_0x482c('0xc3')],'as':_0x482c('0xc3'),'attributes':['id','fullname'],'raw':!![]});_0x5908d7[_0x482c('0x31')]({'model':db[_0x482c('0xc4')],'as':_0x482c('0xc5'),'attributes':['id',_0x482c('0xc6'),_0x482c('0xc7')],'raw':!![]});var _0x4fdad6=[{'model':db[_0x482c('0xb3')],'as':_0x482c('0xc8'),'attributes':['id',_0x482c('0x70'),'createdAt','direction','secret',_0x482c('0x7a')],'include':_0x5908d7}];_0x4fdad6[_0x482c('0x31')]({'model':db['SmsAccount'],'as':'Account','attributes':['id',_0x482c('0x29')]});_0x4fdad6[_0x482c('0x31')]({'model':db[_0x482c('0xc3')],'as':_0x482c('0xc9'),'attributes':['id',_0x482c('0x2c')]});return db[_0x482c('0x95')]['find']({'where':{'id':_0x5afa29['params']['id']},'include':_0x4fdad6})[_0x482c('0x27')](handleEntityNotFound(_0xd33eaa,null))[_0x482c('0x27')](function(_0x5817c6){if(_0x5817c6){var _0x5e5edc=_0x5817c6['get']({'plain':!![]});fs['mkdirSync'](_0x304ec8);var _0x29f89c={'format':'A4','border':'10px','header':{'height':_0x482c('0xca'),'contents':{'first':_0x482c('0xcb')}},'footer':{'height':_0x482c('0xcc'),'contents':{'default':util[_0x482c('0xc1')](_0x482c('0xcd'),util['format']('%s\x20#%d','Sms',_0x5e5edc['id']),moment()['format']('YYYY-MM-DD')['toString']())}}};var _0x14e93a={'channel':'Sms','account':_0x5e5edc[_0x482c('0xce')][_0x482c('0x29')],'agent':_0x5e5edc[_0x482c('0xc9')]?_0x5e5edc[_0x482c('0xc9')]['fullname']:_0x482c('0xcf'),'createdAt':moment(_0x5e5edc[_0x482c('0x75')])[_0x482c('0xc1')](_0x482c('0xb5'))[_0x482c('0x92')](),'closedAt':_0x5e5edc['closed']?moment(_0x5e5edc[_0x482c('0xd0')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x5e5edc[_0x482c('0xd1')],'messages':_(_0x5e5edc[_0x482c('0xc8')])[_0x482c('0x7e')]({'secret':![]})[_0x482c('0x2b')](function(_0x59125c){return{'date':moment(_0x59125c['createdAt'])['format'](_0x482c('0xb5'))[_0x482c('0x92')](),'sender':_0x59125c[_0x482c('0xd2')]===_0x482c('0xd3')?_0x59125c[_0x482c('0xc3')]?_0x59125c[_0x482c('0xc3')][_0x482c('0x2c')]:'System':_0x59125c[_0x482c('0xc5')]['firstName']+(_0x59125c[_0x482c('0xc5')][_0x482c('0xc7')]?'\x20'+_0x59125c[_0x482c('0xc5')][_0x482c('0xc7')]:''),'body':_0x59125c[_0x482c('0x70')],'direction':_0x59125c[_0x482c('0xd2')]===_0x482c('0xd3')?'A':'C','secret':_0x59125c[_0x482c('0xd4')],'read':_0x59125c['read']};})['value']()};return ejs[_0x482c('0xd5')](path[_0x482c('0xbd')](config[_0x482c('0xbf')],_0x482c('0xc0'),_0x482c('0xd6'),_0x482c('0xd7')),{'interaction':_0x14e93a})[_0x482c('0x27')](function(_0x2507ae){return new BPromise(function(_0x47370d,_0x1d035f){pdf['create'](_0x2507ae,_0x29f89c)[_0x482c('0xd8')](path[_0x482c('0xbd')](_0x304ec8,_0x482c('0xd9')+_0x5e5edc['id']+'-'+_0x4fc2bf+_0x482c('0xda')),function(_0x1f5507,_0x36954b){if(_0x1f5507)return _0x1d035f(_0x1f5507);_0x47370d(_0x36954b);});});})[_0x482c('0x27')](function(){return new BPromise(function(_0x236ec2,_0x1880e7){zipdir(_0x304ec8,{'saveTo':_0x55ce96},function(_0x4be0d8,_0x41f9fe){if(_0x4be0d8)return _0x1880e7(_0x4be0d8);return _0x236ec2(_0x41f9fe);});})[_0x482c('0x27')](function(){return new BPromise(function(_0x428d83,_0x35656a){rimraf(_0x304ec8,function(_0x206ae8){if(_0x206ae8)_0x35656a(_0x206ae8);return _0x428d83();});});})['then'](function(){return _0xd33eaa[_0x482c('0xbc')](_0x55ce96,_0x462894,function(_0x24fb4e){if(_0x24fb4e){console[_0x482c('0xdb')](_0x482c('0xdc'),_0x24fb4e);}else{fs[_0x482c('0xdd')](_0x55ce96);}});});});}else{return _0xd33eaa[_0x482c('0x1c')](0xc8);}})[_0x482c('0x32')](handleError(_0xd33eaa,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 39323dd..b3cb441 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 _0x89c3=['setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','then','Users','map','findAll'];(function(_0x39d531,_0xa157c7){var _0x4de72b=function(_0x4e28a2){while(--_0x4e28a2){_0x39d531['push'](_0x39d531['shift']());}};_0x4de72b(++_0xa157c7);}(_0x89c3,0xff));var _0x389c=function(_0x1248ab,_0x4f690b){_0x1248ab=_0x1248ab-0x0;var _0xbb8589=_0x89c3[_0x1248ab];return _0xbb8589;};'use strict';var EventEmitter=require(_0x389c('0x0'));var SmsInteraction=require(_0x389c('0x1'))['db'][_0x389c('0x2')];var SmsMessage=require(_0x389c('0x1'))['db'][_0x389c('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x389c('0x4')](0x0);var events={'afterCreate':_0x389c('0x5'),'afterUpdate':_0x389c('0x6'),'afterDestroy':'remove'};function emitEvent(_0x3742ad){return function(_0x5d2bcb,_0x283ff9,_0x4bece6){_0x5d2bcb['getUsers']({'attributes':['id'],'raw':!![]})[_0x389c('0x7')](function(_0x4a83ab){_0x5d2bcb['setDataValue'](_0x389c('0x8'),_0x4a83ab[_0x389c('0x9')](function(_0x28d373){return{'id':_0x28d373['id']};}));return SmsMessage[_0x389c('0xa')]({'where':{'SmsInteractionId':_0x5d2bcb['id'],'direction':'in','read':![]},'raw':!![]});})[_0x389c('0x7')](function(_0x1c574b){_0x5d2bcb[_0x389c('0xb')](_0x389c('0xc'),_0x1c574b[_0x389c('0xd')]);SmsInteractionEvents['emit'](_0x3742ad+':'+_0x5d2bcb['id'],_0x5d2bcb);SmsInteractionEvents[_0x389c('0xe')](_0x3742ad,_0x5d2bcb);_0x4bece6(null);})[_0x389c('0xf')](_0x4bece6(null));};}for(var e in events){if(events[_0x389c('0x10')](e)){var event=events[e];SmsInteraction[_0x389c('0x11')](e,emitEvent(event));}}module[_0x389c('0x12')]=SmsInteractionEvents; \ No newline at end of file +var _0x303a=['setMaxListeners','update','remove','getUsers','then','findAll','unreadMessages','emit','catch','hasOwnProperty','exports','events','SmsInteraction','../../mysqldb','SmsMessage'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x303a,0x1a0));var _0xa303=function(_0x40f31d,_0x166318){_0x40f31d=_0x40f31d-0x0;var _0x10d4e4=_0x303a[_0x40f31d];return _0x10d4e4;};'use strict';var EventEmitter=require(_0xa303('0x0'));var SmsInteraction=require('../../mysqldb')['db'][_0xa303('0x1')];var SmsMessage=require(_0xa303('0x2'))['db'][_0xa303('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xa303('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa303('0x5'),'afterDestroy':_0xa303('0x6')};function emitEvent(_0x38a354){return function(_0x217275,_0x1c7fa3,_0x1c7ee9){_0x217275[_0xa303('0x7')]({'attributes':['id'],'raw':!![]})[_0xa303('0x8')](function(_0x69b173){_0x217275['setDataValue']('Users',_0x69b173['map'](function(_0x9142e7){return{'id':_0x9142e7['id']};}));return SmsMessage[_0xa303('0x9')]({'where':{'SmsInteractionId':_0x217275['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3313d0){_0x217275['setDataValue'](_0xa303('0xa'),_0x3313d0['length']);SmsInteractionEvents[_0xa303('0xb')](_0x38a354+':'+_0x217275['id'],_0x217275);SmsInteractionEvents[_0xa303('0xb')](_0x38a354,_0x217275);_0x1c7ee9(null);})[_0xa303('0xc')](_0x1c7ee9(null));};}for(var e in events){if(events[_0xa303('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0xa303('0xe')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1639e44..66613d6 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 _0x7a29=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','exports','define','SmsInteraction','sms_interactions','changed','closed','closedAt','format'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7a29,0x111));var _0x97a2=function(_0x59e6d5,_0x17ff81){_0x59e6d5=_0x59e6d5-0x0;var _0x908ad5=_0x7a29[_0x59e6d5];return _0x908ad5;};'use strict';var _=require(_0x97a2('0x0'));var util=require(_0x97a2('0x1'));var logger=require(_0x97a2('0x2'))('api');var moment=require('moment');var BPromise=require(_0x97a2('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x97a2('0x4'));var rimraf=require(_0x97a2('0x5'));var config=require(_0x97a2('0x6'));var attributes=require('./smsInteraction.attributes');module[_0x97a2('0x7')]=function(_0x193bf7,_0x39f20f){return _0x193bf7[_0x97a2('0x8')](_0x97a2('0x9'),attributes,{'tableName':_0x97a2('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x167083,_0x8c096f,_0x3f7f91){if(_0x167083[_0x97a2('0xb')](_0x97a2('0xc'))){_0x167083[_0x97a2('0xd')]=moment()[_0x97a2('0xe')](_0x97a2('0xf'));}_0x3f7f91(null,_0x167083);}}});}; \ No newline at end of file +var _0x32d8=['rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','sms_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x541785,_0x5e8e81){var _0x1c33b0=function(_0x251d18){while(--_0x251d18){_0x541785['push'](_0x541785['shift']());}};_0x1c33b0(++_0x5e8e81);}(_0x32d8,0x1e6));var _0x832d=function(_0x4ae6e9,_0x4a8468){_0x4ae6e9=_0x4ae6e9-0x0;var _0x2906ec=_0x32d8[_0x4ae6e9];return _0x2906ec;};'use strict';var _=require(_0x832d('0x0'));var util=require(_0x832d('0x1'));var logger=require(_0x832d('0x2'))(_0x832d('0x3'));var moment=require(_0x832d('0x4'));var BPromise=require('bluebird');var rp=require(_0x832d('0x5'));var fs=require('fs');var path=require(_0x832d('0x6'));var rimraf=require(_0x832d('0x7'));var config=require('../../config/environment');var attributes=require(_0x832d('0x8'));module[_0x832d('0x9')]=function(_0xed37c9,_0x2b813c){return _0xed37c9[_0x832d('0xa')](_0x832d('0xb'),attributes,{'tableName':_0x832d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2c1d2e,_0x1ab510,_0x48af1e){if(_0x2c1d2e[_0x832d('0xd')](_0x832d('0xe'))){_0x2c1d2e['closedAt']=moment()[_0x832d('0xf')](_0x832d('0x10'));}_0x48af1e(null,_0x2c1d2e);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 3ba94e3..d5e6ccf 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 _0x804e=['localhost','socket.io-emitter','register','request','then','info','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','update','body','options','raw','where','limit','AddTagsToSmsInteraction','find','omit','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','http','redis','defaults'];(function(_0x5e96da,_0x927901){var _0x1db7b8=function(_0x308121){while(--_0x308121){_0x5e96da['push'](_0x5e96da['shift']());}};_0x1db7b8(++_0x927901);}(_0x804e,0xc0));var _0xe804=function(_0xbbb317,_0x5aa9bd){_0xbbb317=_0xbbb317-0x0;var _0x2187e4=_0x804e[_0xbbb317];return _0x2187e4;};'use strict';var _=require(_0xe804('0x0'));var util=require(_0xe804('0x1'));var moment=require(_0xe804('0x2'));var BPromise=require(_0xe804('0x3'));var rs=require(_0xe804('0x4'));var fs=require('fs');var Redis=require(_0xe804('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe804('0x6'));var logger=require(_0xe804('0x7'))(_0xe804('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe804('0x9')][_0xe804('0xa')]({'port':0x232a});config[_0xe804('0xb')]=_[_0xe804('0xc')](config[_0xe804('0xb')],{'host':_0xe804('0xd'),'port':0x18eb});var socket=require(_0xe804('0xe'))(new Redis(config[_0xe804('0xb')]));require('./smsInteraction.socket')[_0xe804('0xf')](socket);function respondWithRpcPromise(_0x41e512,_0x5021a4,_0x323957){return new BPromise(function(_0x353ab1,_0x328219){return client[_0xe804('0x10')](_0x41e512,_0x323957)[_0xe804('0x11')](function(_0x365ef5){logger[_0xe804('0x12')]('SmsInteraction,\x20%s,\x20%s',_0x5021a4,'request\x20sent');logger[_0xe804('0x13')](_0xe804('0x14'),_0x5021a4,_0xe804('0x15'),JSON[_0xe804('0x16')](_0x365ef5));if(_0x365ef5[_0xe804('0x17')]){if(_0x365ef5[_0xe804('0x17')]['code']===0x1f4){logger[_0xe804('0x17')](_0xe804('0x18'),_0x5021a4,_0x365ef5[_0xe804('0x17')]['message']);return _0x328219(_0x365ef5['error']['message']);}logger[_0xe804('0x17')](_0xe804('0x18'),_0x5021a4,_0x365ef5[_0xe804('0x17')][_0xe804('0x19')]);return _0x353ab1(_0x365ef5['error'][_0xe804('0x19')]);}else{logger[_0xe804('0x12')](_0xe804('0x18'),_0x5021a4,_0xe804('0x15'));_0x353ab1(_0x365ef5[_0xe804('0x1a')][_0xe804('0x19')]);}})[_0xe804('0x1b')](function(_0xd8ddc0){logger[_0xe804('0x17')]('SmsInteraction,\x20%s,\x20%s',_0x5021a4,_0xd8ddc0);_0x328219(_0xd8ddc0);});});}exports[_0xe804('0x1c')]=function(_0x444ddd){var _0x551571=this;return new Promise(function(_0xb2ffbd,_0x3d92f7){return db[_0xe804('0x1d')][_0xe804('0x1e')](_0x444ddd[_0xe804('0x1f')],{'raw':_0x444ddd['options']?_0x444ddd[_0xe804('0x20')][_0xe804('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x444ddd['options']?_0x444ddd[_0xe804('0x20')][_0xe804('0x22')]||null:null,'attributes':_0x444ddd[_0xe804('0x20')]?_0x444ddd[_0xe804('0x20')]['attributes']||null:null,'limit':_0x444ddd[_0xe804('0x20')]?_0x444ddd['options'][_0xe804('0x23')]||null:null})[_0xe804('0x11')](function(_0x22c6d1){logger[_0xe804('0x12')]('UpdateSmsInteraction',_0x444ddd);logger['debug']('UpdateSmsInteraction',_0x444ddd,JSON[_0xe804('0x16')](_0x22c6d1));_0xb2ffbd(_0x22c6d1);})[_0xe804('0x1b')](function(_0xa0b553){logger[_0xe804('0x17')](_0xe804('0x1c'),_0xa0b553[_0xe804('0x19')],_0x444ddd);_0x3d92f7(_0x551571[_0xe804('0x17')](0x1f4,_0xa0b553[_0xe804('0x19')]));});});};exports[_0xe804('0x24')]=function(_0x268bfe){return new Promise(function(_0x1de4f9,_0x5c2623){return db[_0xe804('0x1d')][_0xe804('0x25')]({'where':_0x268bfe[_0xe804('0x20')]?_0x268bfe[_0xe804('0x20')][_0xe804('0x22')]||null:null})[_0xe804('0x11')](function(_0x3528ed){if(_0x3528ed){return _0x3528ed['addTags'](_0x268bfe[_0xe804('0x1f')]['ids'],_[_0xe804('0x26')](_0x268bfe['body'],[_0xe804('0x27'),'id'])||{});}})['spread'](function(_0x2d627b){logger[_0xe804('0x12')]('AddTags',_0x268bfe);logger['debug'](_0xe804('0x28'),_0x268bfe,JSON[_0xe804('0x16')](_0x2d627b));_0x1de4f9(_0x2d627b);})['catch'](function(_0x412511){logger[_0xe804('0x17')](_0xe804('0x28'),_0x412511[_0xe804('0x19')],_0x268bfe);_0x5c2623(_this[_0xe804('0x17')](0x1f4,_0x412511['message']));});});}; \ No newline at end of file +var _0x7db2=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','socket.io-emitter','./smsInteraction.socket','register','request','info','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','SmsInteraction,\x20%s,\x20%s','message','result','catch','UpdateSmsInteraction','SmsInteraction','body','options','raw','where','attributes','limit','then','AddTagsToSmsInteraction','find','addTags','ids','omit','spread','AddTags','stringify','lodash','util'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0x7db2,0x181));var _0x27db=function(_0x5250b2,_0x3a4ac9){_0x5250b2=_0x5250b2-0x0;var _0x24a392=_0x7db2[_0x5250b2];return _0x24a392;};'use strict';var _=require(_0x27db('0x0'));var util=require(_0x27db('0x1'));var moment=require(_0x27db('0x2'));var BPromise=require(_0x27db('0x3'));var rs=require(_0x27db('0x4'));var fs=require('fs');var Redis=require(_0x27db('0x5'));var db=require(_0x27db('0x6'))['db'];var utils=require(_0x27db('0x7'));var logger=require('../../config/logger')(_0x27db('0x8'));var config=require(_0x27db('0x9'));var jayson=require(_0x27db('0xa'));var client=jayson[_0x27db('0xb')]['http']({'port':0x232a});config[_0x27db('0xc')]=_['defaults'](config[_0x27db('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x27db('0xd'))(new Redis(config[_0x27db('0xc')]));require(_0x27db('0xe'))[_0x27db('0xf')](socket);function respondWithRpcPromise(_0x5c4b98,_0xf03b23,_0x302edb){return new BPromise(function(_0x18d6ac,_0x402544){return client[_0x27db('0x10')](_0x5c4b98,_0x302edb)['then'](function(_0x1e529d){logger[_0x27db('0x11')]('SmsInteraction,\x20%s,\x20%s',_0xf03b23,_0x27db('0x12'));logger[_0x27db('0x13')](_0x27db('0x14'),_0xf03b23,'request\x20sent',JSON['stringify'](_0x1e529d));if(_0x1e529d[_0x27db('0x15')]){if(_0x1e529d[_0x27db('0x15')]['code']===0x1f4){logger[_0x27db('0x15')](_0x27db('0x16'),_0xf03b23,_0x1e529d[_0x27db('0x15')][_0x27db('0x17')]);return _0x402544(_0x1e529d[_0x27db('0x15')]['message']);}logger[_0x27db('0x15')](_0x27db('0x16'),_0xf03b23,_0x1e529d[_0x27db('0x15')][_0x27db('0x17')]);return _0x18d6ac(_0x1e529d[_0x27db('0x15')][_0x27db('0x17')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0xf03b23,'request\x20sent');_0x18d6ac(_0x1e529d[_0x27db('0x18')][_0x27db('0x17')]);}})[_0x27db('0x19')](function(_0x39ce7c){logger[_0x27db('0x15')]('SmsInteraction,\x20%s,\x20%s',_0xf03b23,_0x39ce7c);_0x402544(_0x39ce7c);});});}exports[_0x27db('0x1a')]=function(_0x231f91){var _0x43279a=this;return new Promise(function(_0x44b7ad,_0x351c88){return db[_0x27db('0x1b')]['update'](_0x231f91[_0x27db('0x1c')],{'raw':_0x231f91[_0x27db('0x1d')]?_0x231f91['options'][_0x27db('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x231f91[_0x27db('0x1d')]?_0x231f91[_0x27db('0x1d')][_0x27db('0x1f')]||null:null,'attributes':_0x231f91['options']?_0x231f91[_0x27db('0x1d')][_0x27db('0x20')]||null:null,'limit':_0x231f91['options']?_0x231f91['options'][_0x27db('0x21')]||null:null})[_0x27db('0x22')](function(_0x466d1f){logger[_0x27db('0x11')](_0x27db('0x1a'),_0x231f91);logger['debug'](_0x27db('0x1a'),_0x231f91,JSON['stringify'](_0x466d1f));_0x44b7ad(_0x466d1f);})['catch'](function(_0x1e2f12){logger[_0x27db('0x15')](_0x27db('0x1a'),_0x1e2f12[_0x27db('0x17')],_0x231f91);_0x351c88(_0x43279a[_0x27db('0x15')](0x1f4,_0x1e2f12[_0x27db('0x17')]));});});};exports[_0x27db('0x23')]=function(_0xec5f2){return new Promise(function(_0xd49431,_0x341377){return db[_0x27db('0x1b')][_0x27db('0x24')]({'where':_0xec5f2[_0x27db('0x1d')]?_0xec5f2['options'][_0x27db('0x1f')]||null:null})[_0x27db('0x22')](function(_0x4a1231){if(_0x4a1231){return _0x4a1231[_0x27db('0x25')](_0xec5f2[_0x27db('0x1c')][_0x27db('0x26')],_[_0x27db('0x27')](_0xec5f2['body'],[_0x27db('0x26'),'id'])||{});}})[_0x27db('0x28')](function(_0x10bc61){logger[_0x27db('0x11')](_0x27db('0x29'),_0xec5f2);logger[_0x27db('0x13')](_0x27db('0x29'),_0xec5f2,JSON[_0x27db('0x2a')](_0x10bc61));_0xd49431(_0x10bc61);})['catch'](function(_0x29098b){logger[_0x27db('0x15')](_0x27db('0x29'),_0x29098b['message'],_0xec5f2);_0x341377(_this['error'](0x1f4,_0x29098b[_0x27db('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 072f91f..b011615 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 _0x757a=['save','remove','emit','removeListener','register','smsInteraction:'];(function(_0x2461ee,_0x1b068e){var _0xee8871=function(_0x354a1d){while(--_0x354a1d){_0x2461ee['push'](_0x2461ee['shift']());}};_0xee8871(++_0x1b068e);}(_0x757a,0xde));var _0xa757=function(_0x307612,_0x37f4d1){_0x307612=_0x307612-0x0;var _0x45888f=_0x757a[_0x307612];return _0x45888f;};'use strict';var SmsInteractionEvents=require('./smsInteraction.events');var events=[_0xa757('0x0'),_0xa757('0x1'),'update'];function createListener(_0x5c03c3,_0x5709ed){return function(_0x32be3b){_0x5709ed[_0xa757('0x2')](_0x5c03c3,_0x32be3b);};}function removeListener(_0x1c2932,_0x453d07){return function(){SmsInteractionEvents[_0xa757('0x3')](_0x1c2932,_0x453d07);};}exports[_0xa757('0x4')]=function(_0x5edca8){for(var _0xae0e7c=0x0,_0x4343b6=events['length'];_0xae0e7c<_0x4343b6;_0xae0e7c++){var _0x2930fa=events[_0xae0e7c];var _0x2f7793=createListener(_0xa757('0x5')+_0x2930fa,_0x5edca8);SmsInteractionEvents['on'](_0x2930fa,_0x2f7793);}}; \ No newline at end of file +var _0xb7e7=['remove','removeListener','length','smsInteraction:','./smsInteraction.events'];(function(_0x34bfc6,_0x133854){var _0x1f90eb=function(_0x25c37f){while(--_0x25c37f){_0x34bfc6['push'](_0x34bfc6['shift']());}};_0x1f90eb(++_0x133854);}(_0xb7e7,0x121));var _0x7b7e=function(_0x710815,_0x520da8){_0x710815=_0x710815-0x0;var _0x5b3b89=_0xb7e7[_0x710815];return _0x5b3b89;};'use strict';var SmsInteractionEvents=require(_0x7b7e('0x0'));var events=['save',_0x7b7e('0x1'),'update'];function createListener(_0x1b7cc7,_0x54a37f){return function(_0x3f5804){_0x54a37f['emit'](_0x1b7cc7,_0x3f5804);};}function removeListener(_0x31d0ed,_0x118577){return function(){SmsInteractionEvents[_0x7b7e('0x2')](_0x31d0ed,_0x118577);};}exports['register']=function(_0x53ed64){for(var _0x333fa4=0x0,_0x372bde=events[_0x7b7e('0x3')];_0x333fa4<_0x372bde;_0x333fa4++){var _0x55ce81=events[_0x333fa4];var _0x42b871=createListener(_0x7b7e('0x4')+_0x55ce81,_0x53ed64);SmsInteractionEvents['on'](_0x55ce81,_0x42b871);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 0d8edb2..311b38c 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 _0x4bff=['get','isAuthenticated','/describe','describe','/:id','show','tracked','smsmessage:create','create','post','/:id/status','status','put','update','accept','/:id/reject','reject','path','connect-timeout','express','Router','../../components/interaction/service','./smsMessage.controller'];(function(_0x32c40c,_0x5a48c1){var _0x56e979=function(_0x4ed72a){while(--_0x4ed72a){_0x32c40c['push'](_0x32c40c['shift']());}};_0x56e979(++_0x5a48c1);}(_0x4bff,0x84));var _0xf4bf=function(_0x561f25,_0x2d95c1){_0x561f25=_0x561f25-0x0;var _0x150e4c=_0x4bff[_0x561f25];return _0x150e4c;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf4bf('0x0'));var timeout=require(_0xf4bf('0x1'));var express=require(_0xf4bf('0x2'));var router=express[_0xf4bf('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xf4bf('0x4'));var config=require('../../config/environment');var controller=require(_0xf4bf('0x5'));router[_0xf4bf('0x6')]('/',auth[_0xf4bf('0x7')](),controller['index']);router[_0xf4bf('0x6')](_0xf4bf('0x8'),auth[_0xf4bf('0x7')](),controller[_0xf4bf('0x9')]);router['get'](_0xf4bf('0xa'),auth['isAuthenticated'](),controller[_0xf4bf('0xb')]);router['post']('/',auth['isAuthenticated'](),interaction[_0xf4bf('0xc')]('sms',_0xf4bf('0xd')),controller[_0xf4bf('0xe')]);router[_0xf4bf('0xf')](_0xf4bf('0x10'),controller[_0xf4bf('0x11')]);router[_0xf4bf('0x12')](_0xf4bf('0xa'),auth[_0xf4bf('0x7')](),controller[_0xf4bf('0x13')]);router['put']('/:id/accept',auth[_0xf4bf('0x7')](),controller[_0xf4bf('0x14')]);router['put'](_0xf4bf('0x15'),auth['isAuthenticated'](),controller[_0xf4bf('0x16')]);router['delete'](_0xf4bf('0xa'),auth[_0xf4bf('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xb2ee=['get','/describe','describe','/:id','show','post','sms','smsmessage:create','create','/:id/status','status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','exports','util','path','connect-timeout','express','../../components/interaction/service','isAuthenticated','index'];(function(_0x3d5d9a,_0x23b92a){var _0x20c208=function(_0x107684){while(--_0x107684){_0x3d5d9a['push'](_0x3d5d9a['shift']());}};_0x20c208(++_0x23b92a);}(_0xb2ee,0xe3));var _0xeb2e=function(_0x2a3f2b,_0x339199){_0x2a3f2b=_0x2a3f2b-0x0;var _0x162230=_0xb2ee[_0x2a3f2b];return _0x162230;};'use strict';var multer=require('multer');var util=require(_0xeb2e('0x0'));var path=require(_0xeb2e('0x1'));var timeout=require(_0xeb2e('0x2'));var express=require(_0xeb2e('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xeb2e('0x4'));var config=require('../../config/environment');var controller=require('./smsMessage.controller');router['get']('/',auth[_0xeb2e('0x5')](),controller[_0xeb2e('0x6')]);router[_0xeb2e('0x7')](_0xeb2e('0x8'),auth[_0xeb2e('0x5')](),controller[_0xeb2e('0x9')]);router['get'](_0xeb2e('0xa'),auth[_0xeb2e('0x5')](),controller[_0xeb2e('0xb')]);router[_0xeb2e('0xc')]('/',auth[_0xeb2e('0x5')](),interaction['tracked'](_0xeb2e('0xd'),_0xeb2e('0xe')),controller[_0xeb2e('0xf')]);router[_0xeb2e('0xc')](_0xeb2e('0x10'),controller[_0xeb2e('0x11')]);router[_0xeb2e('0x12')](_0xeb2e('0xa'),auth[_0xeb2e('0x5')](),controller['update']);router[_0xeb2e('0x12')](_0xeb2e('0x13'),auth[_0xeb2e('0x5')](),controller[_0xeb2e('0x14')]);router['put'](_0xeb2e('0x15'),auth[_0xeb2e('0x5')](),controller[_0xeb2e('0x16')]);router[_0xeb2e('0x17')](_0xeb2e('0xa'),auth[_0xeb2e('0x5')](),controller[_0xeb2e('0x18')]);module[_0xeb2e('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 2b5d9f1..4ecd330 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 _0x46b2=['STRING','exports','TEXT','ENUM','out'];(function(_0x318e53,_0x252ad7){var _0x3c5065=function(_0x1248f0){while(--_0x1248f0){_0x318e53['push'](_0x318e53['shift']());}};_0x3c5065(++_0x252ad7);}(_0x46b2,0x114));var _0x246b=function(_0x21d0b1,_0x3abc04){_0x21d0b1=_0x21d0b1-0x0;var _0xaa7e4=_0x46b2[_0x21d0b1];return _0xaa7e4;};'use strict';var Sequelize=require('sequelize');module[_0x246b('0x0')]={'body':{'type':Sequelize[_0x246b('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x246b('0x2')]('in',_0x246b('0x3')),'defaultValue':_0x246b('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x246b('0x4')](0xbe)},'phone':{'type':Sequelize[_0x246b('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3d38=['BOOLEAN','STRING','DATE','sequelize','medium'];(function(_0x27c9ef,_0x241a3d){var _0xe1b241=function(_0x51306e){while(--_0x51306e){_0x27c9ef['push'](_0x27c9ef['shift']());}};_0xe1b241(++_0x241a3d);}(_0x3d38,0xc1));var _0x83d3=function(_0x3c68ac,_0x38b406){_0x3c68ac=_0x3c68ac-0x0;var _0x35d849=_0x3d38[_0x3c68ac];return _0x35d849;};'use strict';var Sequelize=require(_0x83d3('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x83d3('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x83d3('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x83d3('0x3')](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize[_0x83d3('0x4')]},'secret':{'type':Sequelize[_0x83d3('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index f2ff7f4..6f09950 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 _0xea5f=['length','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','SmsMessage','includeAll','findAll','rows','show','params','rawAttributes','include','options','find','create','body','destroy','describe','sms-interactions','accept','sms','read','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','SmsInteractionId','update','read1stAt','interaction','info','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','interface','format','SIP/%s','channel','event','EventManager','SmsInteraction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','inspect','plivo','MessageUUID','indexOf','sent','delivered','Status','plivio','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','client','http','test','Sequelize','ValidationError','request','then','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','count','offset','limit','status','set','json','reject','save','stack','name','send','fieldName','type','key','model','map','query','keys','intersection','attributes','fields'];(function(_0x403c20,_0x4a7b99){var _0x2b271a=function(_0x106ecb){while(--_0x106ecb){_0x403c20['push'](_0x403c20['shift']());}};_0x2b271a(++_0x4a7b99);}(_0xea5f,0x156));var _0xfea5=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xea5f[_0x3b380d];return _0x54502b;};'use strict';var pdf=require(_0xfea5('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfea5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfea5('0x2'));var rp=require(_0xfea5('0x3'));var moment=require(_0xfea5('0x4'));var BPromise=require(_0xfea5('0x5'));var Mustache=require('mustache');var util=require(_0xfea5('0x6'));var path=require(_0xfea5('0x7'));var sox=require('sox');var csv=require(_0xfea5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfea5('0x9'));var squel=require(_0xfea5('0xa'));var crypto=require('crypto');var jsforce=require(_0xfea5('0xb'));var deskjs=require(_0xfea5('0xc'));var toCsv=require(_0xfea5('0x8'));var querystring=require(_0xfea5('0xd'));var Papa=require(_0xfea5('0xe'));var Redis=require(_0xfea5('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfea5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfea5('0x11'))('api');var utils=require(_0xfea5('0x12'));var config=require(_0xfea5('0x13'));var db=require(_0xfea5('0x14'))['db'];config['redis']=_['defaults'](config[_0xfea5('0x15')],{'host':_0xfea5('0x16'),'port':0x18eb});var socket=require(_0xfea5('0x17'))(new Redis(config['redis']));require(_0xfea5('0x18'))[_0xfea5('0x19')](socket);var jayson=require('jayson/promise');var client=jayson[_0xfea5('0x1a')][_0xfea5('0x1b')]({'port':0x232c});var client9002=jayson[_0xfea5('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0xe36cce,_0xc37600,_0x29333e){if(_0x29333e){var _0x5daab8=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5daab8[_0xfea5('0x1c')](_0xc37600)){return _0xe36cce;}else{throw new db[(_0xfea5('0x1d'))][(_0xfea5('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 _0xe36cce;}}function respondWithRpcPromise(_0x33836a,_0x53b102,_0x460e96,_0x239714){return new BPromise(function(_0x58c24e,_0x418c46){var _0x6d4112=_0x239714||client;return _0x6d4112[_0xfea5('0x1f')](_0x33836a,_0x460e96)[_0xfea5('0x20')](function(_0x9d74eb){logger['info'](_0xfea5('0x21'),_0x53b102,_0xfea5('0x22'));logger[_0xfea5('0x23')](_0xfea5('0x24'),_0x53b102,'request\x20sent',JSON[_0xfea5('0x25')](_0x9d74eb));if(_0x9d74eb[_0xfea5('0x26')]){if(_0x9d74eb[_0xfea5('0x26')][_0xfea5('0x27')]===0x1f4){logger[_0xfea5('0x26')](_0xfea5('0x21'),_0x53b102,_0x9d74eb[_0xfea5('0x26')][_0xfea5('0x28')]);return _0x418c46(_0x9d74eb['error'][_0xfea5('0x28')]);}logger['error']('SmsMessage,\x20%s,\x20%s',_0x53b102,_0x9d74eb['error'][_0xfea5('0x28')]);return _0x58c24e(_0x9d74eb[_0xfea5('0x26')][_0xfea5('0x28')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x53b102,_0xfea5('0x22'));_0x58c24e(_0x9d74eb[_0xfea5('0x29')]['message']);}})[_0xfea5('0x2a')](function(_0x8409ff){logger[_0xfea5('0x26')](_0xfea5('0x21'),_0x53b102,_0x8409ff);_0x418c46(_0x8409ff);});});}function respondWithStatusCode(_0x533e09,_0x188365){_0x188365=_0x188365||0xcc;return function(_0x2fec6d){if(_0x2fec6d){return _0x533e09[_0xfea5('0x2b')](_0x188365);}return _0x533e09['status'](_0x188365)[_0xfea5('0x2c')]();};}function respondWithResult(_0x5ebba7,_0x541282){_0x541282=_0x541282||0xc8;return function(_0x2c1910){if(_0x2c1910){return _0x5ebba7['status'](_0x541282)['json'](_0x2c1910);}};}function respondWithFilteredResult(_0x59a44c,_0x305b1b){return function(_0x2b3e61){if(_0x2b3e61){var _0x32ab5d=_0x2b3e61[_0xfea5('0x2d')],_0x2863a5=_0x305b1b[_0xfea5('0x2e')],_0x5348d3=_0x305b1b[_0xfea5('0x2e')]+_0x305b1b[_0xfea5('0x2f')],_0x3f7e18;if(_0x5348d3>=_0x32ab5d){_0x5348d3=_0x32ab5d;_0x3f7e18=0xc8;}else{_0x3f7e18=0xce;}_0x59a44c[_0xfea5('0x30')](_0x3f7e18);return _0x59a44c[_0xfea5('0x31')]('Content-Range',_0x2863a5+'-'+_0x5348d3+'/'+_0x32ab5d)[_0xfea5('0x32')](_0x2b3e61);}return null;};}function patchUpdates(_0x2168ae){return function(_0x26a2d3){try{jsonpatch['apply'](_0x26a2d3,_0x2168ae,!![]);}catch(_0x310310){return BPromise[_0xfea5('0x33')](_0x310310);}return _0x26a2d3[_0xfea5('0x34')]();};}function saveUpdates(_0x28a6c9,_0x11b6ca){return function(_0x496805){if(_0x496805){return _0x496805['update'](_0x28a6c9)[_0xfea5('0x20')](function(_0x568258){return _0x568258;});}return null;};}function removeEntity(_0x3b37f1,_0xd1740){return function(_0x4476f6){if(_0x4476f6){return _0x4476f6['destroy']()['then'](function(){_0x3b37f1[_0xfea5('0x30')](0xcc)[_0xfea5('0x2c')]();});}};}function handleEntityNotFound(_0x2ae288,_0x29ff2c){return function(_0x4937f9){if(!_0x4937f9){_0x2ae288['sendStatus'](0x194);}return _0x4937f9;};}function handleError(_0xc54940,_0xe666df){_0xe666df=_0xe666df||0x1f4;return function(_0x2e0430){logger['error'](_0x2e0430[_0xfea5('0x35')]);if(_0x2e0430[_0xfea5('0x36')]){delete _0x2e0430[_0xfea5('0x36')];}_0xc54940[_0xfea5('0x30')](_0xe666df)[_0xfea5('0x37')](_0x2e0430);};}exports['index']=function(_0x397b48,_0x4653e2){var _0x3d73ee={},_0x10018a={},_0x5b1770={'count':0x0,'rows':[]};var _0x2e11e8=_['map'](db['SmsMessage']['rawAttributes'],function(_0x1ffe20){return{'name':_0x1ffe20[_0xfea5('0x38')],'type':_0x1ffe20[_0xfea5('0x39')][_0xfea5('0x3a')]};});_0x10018a[_0xfea5('0x3b')]=_[_0xfea5('0x3c')](_0x2e11e8,_0xfea5('0x36'));_0x10018a[_0xfea5('0x3d')]=_[_0xfea5('0x3e')](_0x397b48[_0xfea5('0x3d')]);_0x10018a['filters']=_[_0xfea5('0x3f')](_0x10018a[_0xfea5('0x3b')],_0x10018a[_0xfea5('0x3d')]);_0x3d73ee[_0xfea5('0x40')]=_[_0xfea5('0x3f')](_0x10018a['model'],qs[_0xfea5('0x41')](_0x397b48['query']['fields']));_0x3d73ee[_0xfea5('0x40')]=_0x3d73ee[_0xfea5('0x40')][_0xfea5('0x42')]?_0x3d73ee['attributes']:_0x10018a['model'];if(!_0x397b48[_0xfea5('0x3d')]['hasOwnProperty'](_0xfea5('0x43'))){_0x3d73ee[_0xfea5('0x2f')]=qs[_0xfea5('0x2f')](_0x397b48[_0xfea5('0x3d')][_0xfea5('0x2f')]);_0x3d73ee[_0xfea5('0x2e')]=qs['offset'](_0x397b48['query']['offset']);}_0x3d73ee[_0xfea5('0x44')]=qs[_0xfea5('0x45')](_0x397b48[_0xfea5('0x3d')]['sort']);_0x3d73ee[_0xfea5('0x46')]=qs[_0xfea5('0x47')](_[_0xfea5('0x48')](_0x397b48[_0xfea5('0x3d')],_0x10018a['filters']));if(_0x397b48[_0xfea5('0x3d')][_0xfea5('0x49')]){_0x3d73ee[_0xfea5('0x46')]=_[_0xfea5('0x4a')](_0x3d73ee[_0xfea5('0x46')],{'$or':_['map'](_0x2e11e8,function(_0x479b59){if(_0x479b59[_0xfea5('0x39')]!==_0xfea5('0x4b')){var _0x36d499={};_0x36d499[_0x479b59[_0xfea5('0x36')]]={'$like':'%'+_0x397b48[_0xfea5('0x3d')]['filter']+'%'};return _0x36d499;}})});}_0x3d73ee=_[_0xfea5('0x4a')]({},_0x3d73ee,_0x397b48['options']);var _0x5d6f65={'where':_0x3d73ee[_0xfea5('0x46')]};return db[_0xfea5('0x4c')]['count'](_0x5d6f65)[_0xfea5('0x20')](function(_0x359a59){_0x5b1770['count']=_0x359a59;if(_0x397b48['query'][_0xfea5('0x4d')]){_0x3d73ee['include']=[{'all':!![]}];}return db['SmsMessage'][_0xfea5('0x4e')](_0x3d73ee);})[_0xfea5('0x20')](function(_0x399e50){_0x5b1770[_0xfea5('0x4f')]=_0x399e50;return _0x5b1770;})[_0xfea5('0x20')](respondWithFilteredResult(_0x4653e2,_0x3d73ee))[_0xfea5('0x2a')](handleError(_0x4653e2,null));};exports[_0xfea5('0x50')]=function(_0x4f6c86,_0x24c22f){var _0x12f043={'raw':!![],'where':{'id':_0x4f6c86[_0xfea5('0x51')]['id']}},_0x56f1bc={};_0x56f1bc['model']=_[_0xfea5('0x3e')](db[_0xfea5('0x4c')][_0xfea5('0x52')]);_0x56f1bc[_0xfea5('0x3d')]=_[_0xfea5('0x3e')](_0x4f6c86[_0xfea5('0x3d')]);_0x56f1bc[_0xfea5('0x47')]=_[_0xfea5('0x3f')](_0x56f1bc['model'],_0x56f1bc[_0xfea5('0x3d')]);_0x12f043[_0xfea5('0x40')]=_['intersection'](_0x56f1bc[_0xfea5('0x3b')],qs[_0xfea5('0x41')](_0x4f6c86['query'][_0xfea5('0x41')]));_0x12f043[_0xfea5('0x40')]=_0x12f043[_0xfea5('0x40')][_0xfea5('0x42')]?_0x12f043['attributes']:_0x56f1bc[_0xfea5('0x3b')];if(_0x4f6c86[_0xfea5('0x3d')][_0xfea5('0x4d')]){_0x12f043[_0xfea5('0x53')]=[{'all':!![]}];}_0x12f043=_['merge']({},_0x12f043,_0x4f6c86[_0xfea5('0x54')]);return db[_0xfea5('0x4c')][_0xfea5('0x55')](_0x12f043)[_0xfea5('0x20')](handleEntityNotFound(_0x24c22f,null))[_0xfea5('0x20')](respondWithResult(_0x24c22f,null))[_0xfea5('0x2a')](handleError(_0x24c22f,null));};exports[_0xfea5('0x56')]=function(_0x5cccd1,_0x47439a){return db[_0xfea5('0x4c')][_0xfea5('0x56')](_0x5cccd1[_0xfea5('0x57')],{})[_0xfea5('0x20')](respondWithResult(_0x47439a,0xc9))[_0xfea5('0x2a')](handleError(_0x47439a,null));};exports['update']=function(_0x1b1262,_0x323742){if(_0x1b1262['body']['id']){delete _0x1b1262[_0xfea5('0x57')]['id'];}return db[_0xfea5('0x4c')][_0xfea5('0x55')]({'where':{'id':_0x1b1262[_0xfea5('0x51')]['id']}})[_0xfea5('0x20')](handleEntityNotFound(_0x323742,null))[_0xfea5('0x20')](saveUpdates(_0x1b1262['body'],null))['then'](respondWithResult(_0x323742,null))['catch'](handleError(_0x323742,null));};exports[_0xfea5('0x58')]=function(_0x30556b,_0x5b4fc2){return db[_0xfea5('0x4c')][_0xfea5('0x55')]({'where':{'id':_0x30556b['params']['id']}})[_0xfea5('0x20')](handleEntityNotFound(_0x5b4fc2,null))[_0xfea5('0x20')](removeEntity(_0x5b4fc2,null))['catch'](handleError(_0x5b4fc2,null));};exports[_0xfea5('0x59')]=function(_0x4a2c66,_0x4fe95d){return db[_0xfea5('0x4c')][_0xfea5('0x59')]()[_0xfea5('0x20')](respondWithResult(_0x4fe95d,null))[_0xfea5('0x2a')](handleError(_0x4fe95d,null));};var interaction_log=require(_0xfea5('0x11'))(_0xfea5('0x5a'));exports[_0xfea5('0x5b')]=function(_0x33ca47,_0x178dbe,_0x3c56ed){var _0x4a8508={'channel':_0xfea5('0x5c')};if(_0x33ca47['body']['id']){delete _0x33ca47[_0xfea5('0x57')]['id'];}_0x33ca47[_0xfea5('0x57')][_0xfea5('0x5d')]=!![];_0x33ca47[_0xfea5('0x57')]['readAt']=moment()['format'](_0xfea5('0x5e'));_0x33ca47['body'][_0xfea5('0x5f')]=_0x33ca47[_0xfea5('0x57')]['UserId']||_0x33ca47[_0xfea5('0x60')]['id'];return db[_0xfea5('0x4c')]['find']({'where':{'id':_0x33ca47[_0xfea5('0x51')]['id'],'UserId':null},'include':[{'model':db['CmContact'],'as':'Contact'}]})[_0xfea5('0x20')](handleEntityNotFound(_0x178dbe,null))['then'](saveUpdates(_0x33ca47[_0xfea5('0x57')],null))[_0xfea5('0x20')](function(_0x4a2351){if(_0x4a2351){_0x4a8508[_0xfea5('0x28')]=_0x4a2351[_0xfea5('0x61')]({'plain':!![]});return db['SmsInteraction']['find']({'where':{'id':_0x4a2351[_0xfea5('0x62')]}});}return null;})[_0xfea5('0x20')](handleEntityNotFound(_0x178dbe,null))['then'](function(_0x4aca09){if(_0x4aca09){return _0x4aca09[_0xfea5('0x63')]({'UserId':_0x33ca47['body'][_0xfea5('0x5f')],'read1stAt':_['isNil'](_0x4aca09[_0xfea5('0x64')])?moment()['format'](_0xfea5('0x5e')):undefined});}return null;})[_0xfea5('0x20')](function(_0x5dfc2c){if(_0x5dfc2c){_0x4a8508[_0xfea5('0x65')]=_0x5dfc2c[_0xfea5('0x61')]({'plain':!![]});interaction_log[_0xfea5('0x66')](_0xfea5('0x67'),_0x33ca47[_0xfea5('0x60')]['id'],_0x33ca47[_0xfea5('0x60')][_0xfea5('0x36')],_0x33ca47[_0xfea5('0x60')][_0xfea5('0x68')],_0x4a8508[_0xfea5('0x65')]['id'],_0x33ca47[_0xfea5('0x57')]?JSON[_0xfea5('0x25')](_0x33ca47[_0xfea5('0x57')]):_0xfea5('0x69'));return respondWithRpcPromise(_0xfea5('0x6a'),_0xfea5('0x6b'),_0x4a8508);}return null;})[_0xfea5('0x20')](function(_0x1a861d){if(_0x1a861d){if(_0x33ca47[_0xfea5('0x57')]['manual']){_0x4a8508['message'][_0xfea5('0x6c')]=util[_0xfea5('0x6d')](_0xfea5('0x6e'),_0x33ca47[_0xfea5('0x60')]['name']);_0x4a8508[_0xfea5('0x28')][_0xfea5('0x6f')]=_0x4a8508[_0xfea5('0x6f')];_0x4a8508[_0xfea5('0x28')][_0xfea5('0x70')]=_0xfea5('0x5b');return respondWithRpcPromise(_0xfea5('0x71'),'EventManager',{'event':'acceptmessage','message':_0x4a8508[_0xfea5('0x28')]},client9002)['then'](function(){return _0x4a8508;});}return _0x4a8508;}return null;})[_0xfea5('0x20')](respondWithResult(_0x178dbe,null))[_0xfea5('0x2a')](handleError(_0x178dbe,null));};var interaction_log=require('../../config/logger')(_0xfea5('0x5a'));exports[_0xfea5('0x33')]=function(_0x5c0564,_0x3bc8cc,_0x208517){var _0x593c3c={'agent':{},'channel':_0xfea5('0x5c')};if(_0x5c0564[_0xfea5('0x57')]['id']){delete _0x5c0564[_0xfea5('0x57')]['id'];}_0x5c0564[_0xfea5('0x57')][_0xfea5('0x5f')]=_0x5c0564[_0xfea5('0x57')][_0xfea5('0x5f')]||_0x5c0564[_0xfea5('0x60')]['id'];_0x593c3c['agent']['id']=_0x5c0564[_0xfea5('0x57')][_0xfea5('0x5f')];return db[_0xfea5('0x4c')][_0xfea5('0x55')]({'where':{'id':_0x5c0564[_0xfea5('0x51')]['id'],'UserId':null}})[_0xfea5('0x20')](handleEntityNotFound(_0x3bc8cc,null))[_0xfea5('0x20')](function(_0x2ef7de){if(_0x2ef7de){_0x593c3c['message']=_0x2ef7de[_0xfea5('0x61')]({'plain':!![]});return db[_0xfea5('0x72')][_0xfea5('0x55')]({'where':{'id':_0x2ef7de[_0xfea5('0x62')]}});}return null;})[_0xfea5('0x20')](handleEntityNotFound(_0x3bc8cc,null))[_0xfea5('0x20')](function(_0x447612){if(_0x447612){_0x593c3c[_0xfea5('0x65')]=_0x447612[_0xfea5('0x61')]({'plain':!![]});interaction_log[_0xfea5('0x66')](_0xfea5('0x73'),_0x5c0564[_0xfea5('0x60')]['id'],_0x5c0564['user'][_0xfea5('0x36')],_0x5c0564['user'][_0xfea5('0x68')],_0x593c3c[_0xfea5('0x65')]['id'],_0x5c0564[_0xfea5('0x57')]?JSON[_0xfea5('0x25')](_0x5c0564[_0xfea5('0x57')]):_0xfea5('0x69'));return respondWithRpcPromise(_0xfea5('0x74'),_0xfea5('0x75'),_0x593c3c);}return null;})[_0xfea5('0x20')](function(_0x9d76a6){if(_0x9d76a6){_0x9d76a6['message'][_0xfea5('0x6c')]=util[_0xfea5('0x6d')](_0xfea5('0x6e'),_0x5c0564[_0xfea5('0x60')]['name']);_0x9d76a6[_0xfea5('0x28')][_0xfea5('0x6f')]=_0x593c3c[_0xfea5('0x6f')];_0x9d76a6['message'][_0xfea5('0x70')]=_0xfea5('0x33');respondWithRpcPromise('EventManager','EventManager',{'event':_0xfea5('0x76'),'message':_0x9d76a6[_0xfea5('0x28')]},client9002);return _0x593c3c;}return null;})['then'](respondWithResult(_0x3bc8cc,null))['catch'](handleError(_0x3bc8cc,null));};exports[_0xfea5('0x30')]=function(_0x148198,_0x243a11,_0x93bd9e){if(_0x148198[_0xfea5('0x57')]['id']){delete _0x148198[_0xfea5('0x57')]['id'];}var _0xf7f62f;return db[_0xfea5('0x4c')][_0xfea5('0x55')]({'where':{'id':_0x148198[_0xfea5('0x51')]['id']}})[_0xfea5('0x20')](handleEntityNotFound(_0x243a11,null))[_0xfea5('0x20')](function(_0x201ee6){if(_0x201ee6){_0xf7f62f=_0x201ee6;return db['SmsAccount'][_0xfea5('0x55')]({'where':{'id':_0x201ee6[_0xfea5('0x77')]}});}})[_0xfea5('0x20')](handleEntityNotFound(_0x243a11,null))[_0xfea5('0x20')](function(_0x5c3e59){if(_0x5c3e59){logger[_0xfea5('0x23')](_0xfea5('0x24'),'status',_0xfea5('0x78'),_0x5c3e59[_0xfea5('0x39')],util['inspect'](_0x148198[_0xfea5('0x57')],{'showHidden':![],'depth':null}));switch(_0x5c3e59[_0xfea5('0x39')]){case _0xfea5('0x79'):if(_0x148198['body'][_0xfea5('0x7a')]&&_0x148198['body']['MessageSid']===_0xf7f62f['messageId']){return _0xf7f62f[_0xfea5('0x63')]({'read':!![]});}else{logger[_0xfea5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfea5('0x30'),_0xfea5('0x79'),util[_0xfea5('0x7b')](_0x148198[_0xfea5('0x57')],{'showHidden':![],'depth':null}));}break;case _0xfea5('0x7c'):if(_0x148198['body'][_0xfea5('0x7d')]&&_0x148198[_0xfea5('0x57')][_0xfea5('0x7d')]===_0xf7f62f['messageId']&&_[_0xfea5('0x7e')]([_0xfea5('0x7f'),_0xfea5('0x80')],_0x148198[_0xfea5('0x57')][_0xfea5('0x81')])>=0x0){return _0xf7f62f['update']({'read':!![]});}else{logger[_0xfea5('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xfea5('0x30'),_0xfea5('0x82'),util[_0xfea5('0x7b')](_0x148198[_0xfea5('0x57')],{'showHidden':![],'depth':null}));}break;case _0xfea5('0x83'):var _0x1faa7f=_0x148198[_0xfea5('0x57')][_0xfea5('0x84')][0x0];if(_0x1faa7f['status'][_0xfea5('0x85')]===_0xfea5('0x86')){return _0xf7f62f[_0xfea5('0x63')]({'read':!![]});}else{logger[_0xfea5('0x26')](_0xfea5('0x87'),_0xfea5('0x30'),'infobip',util[_0xfea5('0x7b')](_0x148198[_0xfea5('0x57')],{'showHidden':![],'depth':null}));}break;}return _0xf7f62f;}})[_0xfea5('0x20')](respondWithResult(_0x243a11,null))[_0xfea5('0x2a')](handleError(_0x243a11,null));}; \ No newline at end of file +var _0x0946=['register','jayson/promise','client','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','SmsMessage,\x20%s,\x20%s','catch','sendStatus','status','json','count','offset','limit','set','Content-Range','reject','save','update','destroy','end','stack','name','send','index','map','SmsMessage','rawAttributes','type','key','filters','intersection','model','fields','query','attributes','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','rows','show','params','keys','find','create','body','describe','sms-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','CmContact','Contact','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','acceptMessage','manual','interface','channel','event','EventManager','acceptmessage','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','RejectMessage','rejectMessage','SIP/%s','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','results','groupName','DELIVERED','infobip','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsMessage.socket'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x0946,0xf5));var _0x6094=function(_0x5f3f88,_0x562baf){_0x5f3f88=_0x5f3f88-0x0;var _0xd08119=_0x0946[_0x5f3f88];return _0xd08119;};'use strict';var pdf=require(_0x6094('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6094('0x1'));var jsonpatch=require(_0x6094('0x2'));var rp=require(_0x6094('0x3'));var moment=require(_0x6094('0x4'));var BPromise=require(_0x6094('0x5'));var Mustache=require(_0x6094('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x6094('0x7'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x6094('0x8'));var squel=require('squel');var crypto=require(_0x6094('0x9'));var jsforce=require(_0x6094('0xa'));var deskjs=require(_0x6094('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6094('0xc'));var Papa=require(_0x6094('0xd'));var Redis=require(_0x6094('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x6094('0xf'));var as=require(_0x6094('0x10'));var hardwareService=require(_0x6094('0x11'));var logger=require(_0x6094('0x12'))(_0x6094('0x13'));var utils=require('../../config/utils');var config=require(_0x6094('0x14'));var db=require(_0x6094('0x15'))['db'];config[_0x6094('0x16')]=_[_0x6094('0x17')](config[_0x6094('0x16')],{'host':_0x6094('0x18'),'port':0x18eb});var socket=require(_0x6094('0x19'))(new Redis(config[_0x6094('0x16')]));require(_0x6094('0x1a'))[_0x6094('0x1b')](socket);var jayson=require(_0x6094('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0x6094('0x1d')]['http']({'port':0x232a});function checkPasswordPattern(_0x22a83e,_0x46a095,_0x34661f){if(_0x34661f){var _0x1ba4d0=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x1ba4d0['test'](_0x46a095)){return _0x22a83e;}else{throw new db['Sequelize'][(_0x6094('0x1e'))](_0x6094('0x1f'));}}else{return _0x22a83e;}}function respondWithRpcPromise(_0x2cc5b6,_0x448dd8,_0x13e266,_0x3ed5af){return new BPromise(function(_0x15bc0b,_0x4e046a){var _0x4dcb68=_0x3ed5af||client;return _0x4dcb68[_0x6094('0x20')](_0x2cc5b6,_0x13e266)[_0x6094('0x21')](function(_0x385e29){logger[_0x6094('0x22')]('SmsMessage,\x20%s,\x20%s',_0x448dd8,_0x6094('0x23'));logger[_0x6094('0x24')](_0x6094('0x25'),_0x448dd8,'request\x20sent',JSON['stringify'](_0x385e29));if(_0x385e29[_0x6094('0x26')]){if(_0x385e29[_0x6094('0x26')][_0x6094('0x27')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x448dd8,_0x385e29[_0x6094('0x26')]['message']);return _0x4e046a(_0x385e29[_0x6094('0x26')][_0x6094('0x28')]);}logger['error'](_0x6094('0x29'),_0x448dd8,_0x385e29['error']['message']);return _0x15bc0b(_0x385e29[_0x6094('0x26')][_0x6094('0x28')]);}else{logger[_0x6094('0x22')](_0x6094('0x29'),_0x448dd8,_0x6094('0x23'));_0x15bc0b(_0x385e29['result']['message']);}})[_0x6094('0x2a')](function(_0x564e4f){logger[_0x6094('0x26')](_0x6094('0x29'),_0x448dd8,_0x564e4f);_0x4e046a(_0x564e4f);});});}function respondWithStatusCode(_0x1352df,_0x32debd){_0x32debd=_0x32debd||0xcc;return function(_0x3b95a2){if(_0x3b95a2){return _0x1352df[_0x6094('0x2b')](_0x32debd);}return _0x1352df['status'](_0x32debd)['end']();};}function respondWithResult(_0x258c51,_0x1bcfa1){_0x1bcfa1=_0x1bcfa1||0xc8;return function(_0x3a206f){if(_0x3a206f){return _0x258c51[_0x6094('0x2c')](_0x1bcfa1)[_0x6094('0x2d')](_0x3a206f);}};}function respondWithFilteredResult(_0x4a6057,_0x3dbda3){return function(_0x5afee5){if(_0x5afee5){var _0x45938d=_0x5afee5[_0x6094('0x2e')],_0x12962f=_0x3dbda3[_0x6094('0x2f')],_0x421fc5=_0x3dbda3[_0x6094('0x2f')]+_0x3dbda3[_0x6094('0x30')],_0x105c6f;if(_0x421fc5>=_0x45938d){_0x421fc5=_0x45938d;_0x105c6f=0xc8;}else{_0x105c6f=0xce;}_0x4a6057[_0x6094('0x2c')](_0x105c6f);return _0x4a6057[_0x6094('0x31')](_0x6094('0x32'),_0x12962f+'-'+_0x421fc5+'/'+_0x45938d)[_0x6094('0x2d')](_0x5afee5);}return null;};}function patchUpdates(_0x1477e4){return function(_0x7a70a9){try{jsonpatch['apply'](_0x7a70a9,_0x1477e4,!![]);}catch(_0x8191ac){return BPromise[_0x6094('0x33')](_0x8191ac);}return _0x7a70a9[_0x6094('0x34')]();};}function saveUpdates(_0x42e0de,_0x613013){return function(_0x29a8f2){if(_0x29a8f2){return _0x29a8f2[_0x6094('0x35')](_0x42e0de)[_0x6094('0x21')](function(_0x522924){return _0x522924;});}return null;};}function removeEntity(_0x4946c9,_0x4757d0){return function(_0x249a6b){if(_0x249a6b){return _0x249a6b[_0x6094('0x36')]()[_0x6094('0x21')](function(){_0x4946c9[_0x6094('0x2c')](0xcc)[_0x6094('0x37')]();});}};}function handleEntityNotFound(_0x446e56,_0x23e221){return function(_0x9fecfc){if(!_0x9fecfc){_0x446e56[_0x6094('0x2b')](0x194);}return _0x9fecfc;};}function handleError(_0x58a27d,_0x325f6a){_0x325f6a=_0x325f6a||0x1f4;return function(_0x2864d5){logger[_0x6094('0x26')](_0x2864d5[_0x6094('0x38')]);if(_0x2864d5['name']){delete _0x2864d5[_0x6094('0x39')];}_0x58a27d[_0x6094('0x2c')](_0x325f6a)[_0x6094('0x3a')](_0x2864d5);};}exports[_0x6094('0x3b')]=function(_0x215e1e,_0x10133d){var _0x1a04ca={},_0x3b93d2={},_0x47af7d={'count':0x0,'rows':[]};var _0x1e1334=_[_0x6094('0x3c')](db[_0x6094('0x3d')][_0x6094('0x3e')],function(_0x860b4b){return{'name':_0x860b4b['fieldName'],'type':_0x860b4b[_0x6094('0x3f')][_0x6094('0x40')]};});_0x3b93d2['model']=_['map'](_0x1e1334,_0x6094('0x39'));_0x3b93d2['query']=_['keys'](_0x215e1e['query']);_0x3b93d2[_0x6094('0x41')]=_[_0x6094('0x42')](_0x3b93d2['model'],_0x3b93d2['query']);_0x1a04ca['attributes']=_[_0x6094('0x42')](_0x3b93d2[_0x6094('0x43')],qs[_0x6094('0x44')](_0x215e1e[_0x6094('0x45')][_0x6094('0x44')]));_0x1a04ca['attributes']=_0x1a04ca[_0x6094('0x46')][_0x6094('0x47')]?_0x1a04ca[_0x6094('0x46')]:_0x3b93d2['model'];if(!_0x215e1e['query']['hasOwnProperty'](_0x6094('0x48'))){_0x1a04ca[_0x6094('0x30')]=qs['limit'](_0x215e1e[_0x6094('0x45')][_0x6094('0x30')]);_0x1a04ca['offset']=qs['offset'](_0x215e1e[_0x6094('0x45')][_0x6094('0x2f')]);}_0x1a04ca[_0x6094('0x49')]=qs[_0x6094('0x4a')](_0x215e1e[_0x6094('0x45')][_0x6094('0x4a')]);_0x1a04ca['where']=qs[_0x6094('0x41')](_[_0x6094('0x4b')](_0x215e1e[_0x6094('0x45')],_0x3b93d2[_0x6094('0x41')]));if(_0x215e1e['query'][_0x6094('0x4c')]){_0x1a04ca[_0x6094('0x4d')]=_['merge'](_0x1a04ca['where'],{'$or':_[_0x6094('0x3c')](_0x1e1334,function(_0xb9a834){if(_0xb9a834['type']!==_0x6094('0x4e')){var _0x7c0065={};_0x7c0065[_0xb9a834['name']]={'$like':'%'+_0x215e1e[_0x6094('0x45')][_0x6094('0x4c')]+'%'};return _0x7c0065;}})});}_0x1a04ca=_[_0x6094('0x4f')]({},_0x1a04ca,_0x215e1e[_0x6094('0x50')]);var _0x5e660f={'where':_0x1a04ca[_0x6094('0x4d')]};return db[_0x6094('0x3d')][_0x6094('0x2e')](_0x5e660f)[_0x6094('0x21')](function(_0x4e46cb){_0x47af7d[_0x6094('0x2e')]=_0x4e46cb;if(_0x215e1e[_0x6094('0x45')][_0x6094('0x51')]){_0x1a04ca['include']=[{'all':!![]}];}return db['SmsMessage']['findAll'](_0x1a04ca);})[_0x6094('0x21')](function(_0x194804){_0x47af7d[_0x6094('0x52')]=_0x194804;return _0x47af7d;})[_0x6094('0x21')](respondWithFilteredResult(_0x10133d,_0x1a04ca))['catch'](handleError(_0x10133d,null));};exports[_0x6094('0x53')]=function(_0x509677,_0x417b23){var _0x6e36e3={'raw':!![],'where':{'id':_0x509677[_0x6094('0x54')]['id']}},_0x297536={};_0x297536[_0x6094('0x43')]=_[_0x6094('0x55')](db[_0x6094('0x3d')][_0x6094('0x3e')]);_0x297536['query']=_['keys'](_0x509677[_0x6094('0x45')]);_0x297536[_0x6094('0x41')]=_['intersection'](_0x297536['model'],_0x297536[_0x6094('0x45')]);_0x6e36e3['attributes']=_[_0x6094('0x42')](_0x297536[_0x6094('0x43')],qs[_0x6094('0x44')](_0x509677[_0x6094('0x45')]['fields']));_0x6e36e3['attributes']=_0x6e36e3[_0x6094('0x46')][_0x6094('0x47')]?_0x6e36e3[_0x6094('0x46')]:_0x297536['model'];if(_0x509677[_0x6094('0x45')][_0x6094('0x51')]){_0x6e36e3['include']=[{'all':!![]}];}_0x6e36e3=_[_0x6094('0x4f')]({},_0x6e36e3,_0x509677[_0x6094('0x50')]);return db[_0x6094('0x3d')][_0x6094('0x56')](_0x6e36e3)[_0x6094('0x21')](handleEntityNotFound(_0x417b23,null))['then'](respondWithResult(_0x417b23,null))[_0x6094('0x2a')](handleError(_0x417b23,null));};exports['create']=function(_0xbcb32f,_0x582333){return db[_0x6094('0x3d')][_0x6094('0x57')](_0xbcb32f[_0x6094('0x58')],{})['then'](respondWithResult(_0x582333,0xc9))[_0x6094('0x2a')](handleError(_0x582333,null));};exports['update']=function(_0x30ec5c,_0xbebb94){if(_0x30ec5c[_0x6094('0x58')]['id']){delete _0x30ec5c[_0x6094('0x58')]['id'];}return db[_0x6094('0x3d')][_0x6094('0x56')]({'where':{'id':_0x30ec5c['params']['id']}})[_0x6094('0x21')](handleEntityNotFound(_0xbebb94,null))[_0x6094('0x21')](saveUpdates(_0x30ec5c['body'],null))[_0x6094('0x21')](respondWithResult(_0xbebb94,null))['catch'](handleError(_0xbebb94,null));};exports[_0x6094('0x36')]=function(_0x5d8bf5,_0xb96d21){return db[_0x6094('0x3d')][_0x6094('0x56')]({'where':{'id':_0x5d8bf5[_0x6094('0x54')]['id']}})[_0x6094('0x21')](handleEntityNotFound(_0xb96d21,null))[_0x6094('0x21')](removeEntity(_0xb96d21,null))['catch'](handleError(_0xb96d21,null));};exports[_0x6094('0x59')]=function(_0xa28de2,_0xe8699c){return db[_0x6094('0x3d')][_0x6094('0x59')]()[_0x6094('0x21')](respondWithResult(_0xe8699c,null))['catch'](handleError(_0xe8699c,null));};var interaction_log=require(_0x6094('0x12'))(_0x6094('0x5a'));exports[_0x6094('0x5b')]=function(_0x2e005c,_0x326026,_0x4c583b){var _0x232d1f={'channel':'sms'};if(_0x2e005c['body']['id']){delete _0x2e005c[_0x6094('0x58')]['id'];}_0x2e005c[_0x6094('0x58')][_0x6094('0x5c')]=!![];_0x2e005c[_0x6094('0x58')]['readAt']=moment()[_0x6094('0x5d')](_0x6094('0x5e'));_0x2e005c['body'][_0x6094('0x5f')]=_0x2e005c['body'][_0x6094('0x5f')]||_0x2e005c[_0x6094('0x60')]['id'];return db[_0x6094('0x3d')][_0x6094('0x56')]({'where':{'id':_0x2e005c[_0x6094('0x54')]['id'],'UserId':null},'include':[{'model':db[_0x6094('0x61')],'as':_0x6094('0x62')}]})[_0x6094('0x21')](handleEntityNotFound(_0x326026,null))[_0x6094('0x21')](saveUpdates(_0x2e005c['body'],null))[_0x6094('0x21')](function(_0x9307b5){if(_0x9307b5){_0x232d1f[_0x6094('0x28')]=_0x9307b5[_0x6094('0x63')]({'plain':!![]});return db[_0x6094('0x64')]['find']({'where':{'id':_0x9307b5[_0x6094('0x65')]}});}return null;})[_0x6094('0x21')](handleEntityNotFound(_0x326026,null))[_0x6094('0x21')](function(_0x480f53){if(_0x480f53){return _0x480f53[_0x6094('0x35')]({'UserId':_0x2e005c[_0x6094('0x58')][_0x6094('0x5f')],'read1stAt':_[_0x6094('0x66')](_0x480f53[_0x6094('0x67')])?moment()['format'](_0x6094('0x5e')):undefined});}return null;})['then'](function(_0x9b4e3e){if(_0x9b4e3e){_0x232d1f[_0x6094('0x68')]=_0x9b4e3e['get']({'plain':!![]});interaction_log['info'](_0x6094('0x69'),_0x2e005c[_0x6094('0x60')]['id'],_0x2e005c[_0x6094('0x60')][_0x6094('0x39')],_0x2e005c[_0x6094('0x60')][_0x6094('0x6a')],_0x232d1f[_0x6094('0x68')]['id'],_0x2e005c['body']?JSON['stringify'](_0x2e005c['body']):'null');return respondWithRpcPromise('AcceptMessage',_0x6094('0x6b'),_0x232d1f);}return null;})[_0x6094('0x21')](function(_0x45203a){if(_0x45203a){if(_0x2e005c[_0x6094('0x58')][_0x6094('0x6c')]){_0x232d1f[_0x6094('0x28')][_0x6094('0x6d')]=util[_0x6094('0x5d')]('SIP/%s',_0x2e005c[_0x6094('0x60')][_0x6094('0x39')]);_0x232d1f[_0x6094('0x28')][_0x6094('0x6e')]=_0x232d1f[_0x6094('0x6e')];_0x232d1f['message'][_0x6094('0x6f')]=_0x6094('0x5b');return respondWithRpcPromise(_0x6094('0x70'),_0x6094('0x70'),{'event':_0x6094('0x71'),'message':_0x232d1f[_0x6094('0x28')]},client9002)[_0x6094('0x21')](function(){return _0x232d1f;});}return _0x232d1f;}return null;})[_0x6094('0x21')](respondWithResult(_0x326026,null))['catch'](handleError(_0x326026,null));};var interaction_log=require(_0x6094('0x12'))(_0x6094('0x5a'));exports[_0x6094('0x33')]=function(_0x3852f7,_0x5223a3,_0x256b66){var _0x459394={'agent':{},'channel':'sms'};if(_0x3852f7[_0x6094('0x58')]['id']){delete _0x3852f7[_0x6094('0x58')]['id'];}_0x3852f7['body'][_0x6094('0x5f')]=_0x3852f7[_0x6094('0x58')]['UserId']||_0x3852f7[_0x6094('0x60')]['id'];_0x459394['agent']['id']=_0x3852f7[_0x6094('0x58')]['UserId'];return db['SmsMessage']['find']({'where':{'id':_0x3852f7[_0x6094('0x54')]['id'],'UserId':null}})[_0x6094('0x21')](handleEntityNotFound(_0x5223a3,null))[_0x6094('0x21')](function(_0x15e586){if(_0x15e586){_0x459394[_0x6094('0x28')]=_0x15e586[_0x6094('0x63')]({'plain':!![]});return db['SmsInteraction'][_0x6094('0x56')]({'where':{'id':_0x15e586[_0x6094('0x65')]}});}return null;})[_0x6094('0x21')](handleEntityNotFound(_0x5223a3,null))[_0x6094('0x21')](function(_0x3f7e0c){if(_0x3f7e0c){_0x459394[_0x6094('0x68')]=_0x3f7e0c['get']({'plain':!![]});interaction_log[_0x6094('0x22')](_0x6094('0x72'),_0x3852f7[_0x6094('0x60')]['id'],_0x3852f7['user'][_0x6094('0x39')],_0x3852f7[_0x6094('0x60')]['role'],_0x459394[_0x6094('0x68')]['id'],_0x3852f7[_0x6094('0x58')]?JSON[_0x6094('0x73')](_0x3852f7['body']):_0x6094('0x74'));return respondWithRpcPromise(_0x6094('0x75'),_0x6094('0x76'),_0x459394);}return null;})[_0x6094('0x21')](function(_0x37178a){if(_0x37178a){_0x37178a[_0x6094('0x28')]['interface']=util[_0x6094('0x5d')](_0x6094('0x77'),_0x3852f7[_0x6094('0x60')]['name']);_0x37178a[_0x6094('0x28')][_0x6094('0x6e')]=_0x459394[_0x6094('0x6e')];_0x37178a[_0x6094('0x28')][_0x6094('0x6f')]=_0x6094('0x33');respondWithRpcPromise(_0x6094('0x70'),_0x6094('0x70'),{'event':_0x6094('0x78'),'message':_0x37178a[_0x6094('0x28')]},client9002);return _0x459394;}return null;})[_0x6094('0x21')](respondWithResult(_0x5223a3,null))[_0x6094('0x2a')](handleError(_0x5223a3,null));};exports[_0x6094('0x2c')]=function(_0x83980b,_0xa66d97,_0x237600){if(_0x83980b[_0x6094('0x58')]['id']){delete _0x83980b[_0x6094('0x58')]['id'];}var _0x4afaca;return db['SmsMessage'][_0x6094('0x56')]({'where':{'id':_0x83980b[_0x6094('0x54')]['id']}})[_0x6094('0x21')](handleEntityNotFound(_0xa66d97,null))[_0x6094('0x21')](function(_0x8c8114){if(_0x8c8114){_0x4afaca=_0x8c8114;return db['SmsAccount']['find']({'where':{'id':_0x8c8114[_0x6094('0x79')]}});}})[_0x6094('0x21')](handleEntityNotFound(_0xa66d97,null))[_0x6094('0x21')](function(_0x11a751){if(_0x11a751){logger[_0x6094('0x24')](_0x6094('0x25'),_0x6094('0x2c'),_0x6094('0x7a'),_0x11a751[_0x6094('0x3f')],util[_0x6094('0x7b')](_0x83980b[_0x6094('0x58')],{'showHidden':![],'depth':null}));switch(_0x11a751[_0x6094('0x3f')]){case'twilio':if(_0x83980b[_0x6094('0x58')]['MessageSid']&&_0x83980b['body'][_0x6094('0x7c')]===_0x4afaca[_0x6094('0x7d')]){return _0x4afaca[_0x6094('0x35')]({'read':!![]});}else{logger[_0x6094('0x26')](_0x6094('0x7e'),_0x6094('0x2c'),'twilio',util[_0x6094('0x7b')](_0x83980b[_0x6094('0x58')],{'showHidden':![],'depth':null}));}break;case _0x6094('0x7f'):if(_0x83980b[_0x6094('0x58')][_0x6094('0x80')]&&_0x83980b[_0x6094('0x58')]['MessageUUID']===_0x4afaca[_0x6094('0x7d')]&&_['indexOf']([_0x6094('0x81'),_0x6094('0x82')],_0x83980b[_0x6094('0x58')][_0x6094('0x83')])>=0x0){return _0x4afaca[_0x6094('0x35')]({'read':!![]});}else{logger[_0x6094('0x26')](_0x6094('0x7e'),_0x6094('0x2c'),'plivio',util[_0x6094('0x7b')](_0x83980b[_0x6094('0x58')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x5ea1bf=_0x83980b[_0x6094('0x58')][_0x6094('0x84')][0x0];if(_0x5ea1bf[_0x6094('0x2c')][_0x6094('0x85')]===_0x6094('0x86')){return _0x4afaca[_0x6094('0x35')]({'read':!![]});}else{logger[_0x6094('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6094('0x2c'),_0x6094('0x87'),util['inspect'](_0x83980b[_0x6094('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x4afaca;}})['then'](respondWithResult(_0xa66d97,null))['catch'](handleError(_0xa66d97,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 48766db..f8e94ca 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 _0x39a9=['update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x116b8e,_0x1da172){var _0x3a884b=function(_0x15a3fe){while(--_0x15a3fe){_0x116b8e['push'](_0x116b8e['shift']());}};_0x3a884b(++_0x1da172);}(_0x39a9,0x8b));var _0x939a=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0x39a9[_0x22dac7];return _0x3e6cfa;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x939a('0x0'))['db']['SmsMessage'];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x939a('0x1'),'afterDestroy':_0x939a('0x2')};function emitEvent(_0x31bd26){return function(_0x34ab45,_0x861c76,_0x45e5ac){SmsMessageEvents['emit'](_0x31bd26+':'+_0x34ab45['id'],_0x34ab45);SmsMessageEvents[_0x939a('0x3')](_0x31bd26,_0x34ab45);_0x45e5ac(null);};}for(var e in events){if(events[_0x939a('0x4')](e)){var event=events[e];SmsMessage[_0x939a('0x5')](e,emitEvent(event));}}module[_0x939a('0x6')]=SmsMessageEvents; \ No newline at end of file +var _0x0d17=['remove','hook','exports','../../mysqldb','SmsMessage','save','update'];(function(_0x217501,_0x13e5cf){var _0x504e20=function(_0x150011){while(--_0x150011){_0x217501['push'](_0x217501['shift']());}};_0x504e20(++_0x13e5cf);}(_0x0d17,0x73));var _0x70d1=function(_0x222235,_0x38059c){_0x222235=_0x222235-0x0;var _0x5c4d76=_0x0d17[_0x222235];return _0x5c4d76;};'use strict';var EventEmitter=require('events');var SmsMessage=require(_0x70d1('0x0'))['db'][_0x70d1('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x70d1('0x2'),'afterUpdate':_0x70d1('0x3'),'afterDestroy':_0x70d1('0x4')};function emitEvent(_0x51ff88){return function(_0x12c001,_0x42eb04,_0xff3b93){SmsMessageEvents['emit'](_0x51ff88+':'+_0x12c001['id'],_0x12c001);SmsMessageEvents['emit'](_0x51ff88,_0x12c001);_0xff3b93(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x70d1('0x5')](e,emitEvent(event));}}module[_0x70d1('0x6')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index 6750488..100c273 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 _0x0028=['message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','IBSSO\x20','csc','crypto','apiKey','login','text','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','Bearer\x20','status','refid','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','path','./smsMessage.attributes','exports','sms_messages','messageId','fti_sms_messages','models','get','direction','toLowerCase','out','secret','isNil','UserId','SmsInteraction','findOne','SmsInteractionId','createdAt','catch','error','SmsAccount','find','SmsAccountId','then','type','twilio','accountSid','authToken','phone','messages','create','body','remote','/api/sms/messages/','/status?token=','token','update','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','deliveryReport','skebby','inspect','connectel','senderString','https://smsapi.connectel.se/api/send/','requestid','clicksend','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','base64','http_code','data','head','read','clickSend','Missing\x20parameters:\x20username,\x20password','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','toString'];(function(_0x2b72fc,_0x2b539a){var _0x250040=function(_0x30331c){while(--_0x30331c){_0x2b72fc['push'](_0x2b72fc['shift']());}};_0x250040(++_0x2b539a);}(_0x0028,0x193));var _0x8002=function(_0x1ecae9,_0x3d5fb9){_0x1ecae9=_0x1ecae9-0x0;var _0x5518e1=_0x0028[_0x1ecae9];return _0x5518e1;};'use strict';var _=require(_0x8002('0x0'));var util=require(_0x8002('0x1'));var logger=require(_0x8002('0x2'))(_0x8002('0x3'));var moment=require(_0x8002('0x4'));var BPromise=require(_0x8002('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8002('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8002('0x7'));module[_0x8002('0x8')]=function(_0x1e90e3,_0x538e8c){return _0x1e90e3['define']('SmsMessage',attributes,{'tableName':_0x8002('0x9'),'paranoid':![],'indexes':[{'name':_0x8002('0xa'),'fields':[_0x8002('0xa')]},{'name':_0x8002('0xb'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a34ab,_0x49da63,_0x188949){var _0x29d418=_0x1e90e3[_0x8002('0xc')];var _0x413568=_0x2a34ab[_0x8002('0xd')]({'plain':!![]});if(_0x413568[_0x8002('0xe')][_0x8002('0xf')]()==='in'||_0x413568[_0x8002('0xe')][_0x8002('0xf')]()===_0x8002('0x10')&&!_0x413568[_0x8002('0x11')]&&!_[_0x8002('0x12')](_0x413568[_0x8002('0x13')])){_0x29d418[_0x8002('0x14')][_0x8002('0x15')]({'where':{'id':_0x413568[_0x8002('0x16')]}})['then'](function(_0x293b7a){if(_0x293b7a){_0x293b7a['update']({'lastMsgAt':_0x413568[_0x8002('0x17')],'lastMsgDirection':_0x413568['direction']['toLowerCase']()});}})[_0x8002('0x18')](function(_0x651ee5){console[_0x8002('0x19')](_0x651ee5);});}if(_0x413568[_0x8002('0xe')]===_0x8002('0x10')&&!_0x413568[_0x8002('0x11')]){var _0x340844;_0x29d418[_0x8002('0x1a')][_0x8002('0x1b')]({'where':{'id':_0x413568[_0x8002('0x1c')]},'raw':!![]})[_0x8002('0x1d')](function(_0x406ee8){_0x340844=_0x406ee8;if(_0x340844&&_0x340844[_0x8002('0x1e')]){switch(_0x340844['type']){case'twilio':var _0x287909=require(_0x8002('0x1f'));if(_0x340844[_0x8002('0x20')]&&_0x340844[_0x8002('0x21')]&&_0x340844[_0x8002('0x22')]){var _0x49b6d7=new _0x287909(_0x340844[_0x8002('0x20')],_0x340844['authToken']);_0x49b6d7[_0x8002('0x23')][_0x8002('0x24')]({'body':_0x413568[_0x8002('0x25')],'to':_0x413568[_0x8002('0x22')],'from':_0x340844[_0x8002('0x22')],'statusCallback':_0x340844[_0x8002('0x26')]+_0x8002('0x27')+_0x413568['id']+_0x8002('0x28')+_0x340844[_0x8002('0x29')]})[_0x8002('0x1d')](function(_0x4f2c70){if(_0x4f2c70['sid']){return _0x2a34ab[_0x8002('0x2a')]({'messageId':_0x4f2c70['sid']});}})[_0x8002('0x18')](function(_0x3aec62){logger[_0x8002('0x19')](_0x8002('0x2b'),'afterCreate','twilio',util['inspect'](_0x3aec62,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x1f'),_0x8002('0x2d'));}break;case'skebby':var _0x49008c='https://api.skebby.it/API/v1.0/REST/';if(_0x340844[_0x8002('0x2e')]&&_0x340844[_0x8002('0x2f')]){var _0x18a309={'recipient':[_0x413568[_0x8002('0x22')]],'message':_0x413568[_0x8002('0x25')],'message_type':_0x340844['smsMethod']};if(_0x340844[_0x8002('0x30')]&&_0x340844[_0x8002('0x30')]!=='SI'){_0x18a309[_0x8002('0x31')]=_0x340844['phone'];}var _0x47919a={'url':_0x49008c+_0x8002('0x32')+_0x340844[_0x8002('0x2e')]+_0x8002('0x33')+_0x340844[_0x8002('0x2f')],'method':_0x8002('0x34')};rp(_0x47919a)[_0x8002('0x1d')](function(_0x2c7948){var _0x4cb97b=_0x2c7948[_0x8002('0x35')](';');var _0x4cbd58={'user_key':_0x4cb97b[0x0],'session_key':_0x4cb97b[0x1]};_0x47919a={'url':_0x49008c+_0x8002('0x36'),'method':_0x8002('0x37'),'headers':{'user_key':_0x4cbd58[_0x8002('0x38')],'Session_key':_0x4cbd58['session_key']},'json':!![],'body':_0x18a309};return rp(_0x47919a);})['then'](function(_0x28087d){if(_0x28087d['total_sent']>=0x1){var _0x597500={'messageId':_0x28087d['internal_order_id']};if(_0x340844[_0x8002('0x30')]!=='GP'||!_0x340844[_0x8002('0x39')]){_0x597500['read']=!![];}return _0x2a34ab['update'](_0x597500);}else{return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x3a'),util[_0x8002('0x3b')](_0x28087d,{'showHidden':![],'depth':null}));}})[_0x8002('0x18')](function(_0xdbf793){return logger['error'](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x3a'),util[_0x8002('0x3b')](_0xdbf793,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),'afterCreate',_0x8002('0x3a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x8002('0x3c'):if(_0x340844[_0x8002('0x21')]){var _0x42b87d={'recipient':_0x413568['phone'],'message':_0x413568[_0x8002('0x25')],'sender':_0x340844[_0x8002('0x3d')]||_0x340844[_0x8002('0x22')],'authorization':_0x340844[_0x8002('0x21')]};var _0x49da63={'method':_0x8002('0x37'),'uri':_0x8002('0x3e'),'body':_0x42b87d,'json':!![]};rp(_0x49da63)['then'](function(_0x17d23c){var _0x37ba47={'messageId':_0x17d23c[_0x8002('0x3f')]};if(!_0x340844[_0x8002('0x39')]){_0x37ba47['read']=!![];}return _0x2a34ab[_0x8002('0x2a')](_0x37ba47);})['catch'](function(_0x519dfc){logger[_0x8002('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8002('0x2c'),'connectel',util[_0x8002('0x3b')](_0x519dfc,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x8002('0x40'):if(_0x340844[_0x8002('0x2e')]&&_0x340844['password']){var _0x42b87d={'messages':[{'source':_0x8002('0x41'),'to':_0x413568['phone'],'body':_0x413568[_0x8002('0x25')],'from':_0x340844[_0x8002('0x3d')]||_0x340844[_0x8002('0x22')]}]};var _0x2dce5d=util['format'](_0x8002('0x42'),_0x340844[_0x8002('0x2e')],_0x340844[_0x8002('0x2f')]);var _0x49da63={'method':'POST','uri':_0x8002('0x43'),'body':_0x42b87d,'headers':{'Authorization':util[_0x8002('0x44')](_0x8002('0x45'),new Buffer(_0x2dce5d)['toString'](_0x8002('0x46')))},'json':!![]};rp(_0x49da63)['then'](function(_0x1d405a){if(_0x1d405a[_0x8002('0x47')]>=0xc8&&_0x1d405a[_0x8002('0x47')]<=0xce){if(_0x1d405a[_0x8002('0x48')]&&_0x1d405a['data']['queued_count']>0x0){var _0x2b1de1=_[_0x8002('0x49')](_0x1d405a[_0x8002('0x48')][_0x8002('0x23')]);var _0x11faa2={'messageId':_0x2b1de1['message_id']};if(!_0x340844[_0x8002('0x39')]){_0x11faa2[_0x8002('0x4a')]=!![];}return _0x2a34ab['update'](_0x11faa2);}else{logger['error'](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x4b'),util[_0x8002('0x3b')](_0x1d405a,{'showHidden':![],'depth':null}));}}else{logger[_0x8002('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8002('0x2c'),_0x8002('0x4b'),util['inspect'](_0x1d405a,{'showHidden':![],'depth':null}));}})['catch'](function(_0xbd1d57){logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),'clickSend',util[_0x8002('0x3b')](_0xbd1d57,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x4b'),_0x8002('0x4c'));}break;case _0x8002('0x4d'):if(_0x340844[_0x8002('0x4e')]&&_0x340844['authToken']){var _0x42b87d={'dst':_0x413568[_0x8002('0x22')],'text':_0x413568[_0x8002('0x25')],'src':_0x340844[_0x8002('0x3d')]||_0x340844['phone'],'url':_0x340844[_0x8002('0x26')]+_0x8002('0x27')+_0x413568['id']+_0x8002('0x28')+_0x340844[_0x8002('0x29')]};var _0x2dce5d=util['format'](_0x8002('0x42'),_0x340844[_0x8002('0x4e')],_0x340844[_0x8002('0x21')]);var _0x49da63={'method':_0x8002('0x37'),'uri':util[_0x8002('0x44')](_0x8002('0x4f'),_0x340844[_0x8002('0x4e')]),'body':_0x42b87d,'headers':{'Authorization':util[_0x8002('0x44')](_0x8002('0x45'),new Buffer(_0x2dce5d)[_0x8002('0x50')](_0x8002('0x46')))},'json':!![]};rp(_0x49da63)[_0x8002('0x1d')](function(_0x42e169){var _0x17c9f3={'messageId':_0x42e169[_0x8002('0x51')][0x0]};return _0x2a34ab['update'](_0x17c9f3);})['catch'](function(_0x41b79b){logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x4d'),util[_0x8002('0x3b')](_0x41b79b,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x4d'),_0x8002('0x52'));}break;case _0x8002('0x53'):if(_0x340844[_0x8002('0x2e')]&&_0x340844[_0x8002('0x2f')]){if(_0x340844[_0x8002('0x54')]){var _0x408119={'method':'POST','uri':_0x340844['baseUrl']+_0x8002('0x55'),'body':{'username':_0x340844[_0x8002('0x2e')],'password':_0x340844[_0x8002('0x2f')]},'json':!![]};return rp(_0x408119)['then'](function(_0x5d22f6){var _0x1cd27b={'method':_0x8002('0x37'),'uri':_0x340844[_0x8002('0x54')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x340844[_0x8002('0x22')],'destinations':[{'to':_0x413568[_0x8002('0x22')]}],'text':_0x413568[_0x8002('0x25')],'notifyUrl':_0x340844[_0x8002('0x26')]+_0x8002('0x27')+_0x413568['id']+_0x8002('0x28')+_0x340844[_0x8002('0x29')],'notifyContentType':'application/json','callbackData':_0x340844[_0x8002('0x22')]+';'+_0x413568[_0x8002('0x25')]}]},'headers':{'Authorization':_0x8002('0x56')+_0x5d22f6[_0x8002('0x29')]},'json':!![]};return rp(_0x1cd27b)[_0x8002('0x1d')](function(_0x544992){if(_0x544992[_0x8002('0x23')]){var _0x54808e={'messageId':_0x544992[_0x8002('0x23')][0x0][_0x8002('0xa')]};if(!_0x340844[_0x8002('0x39')]){_0x54808e[_0x8002('0x4a')]=!![];}return _0x2a34ab[_0x8002('0x2a')](_0x54808e);}else{return logger[_0x8002('0x19')](_0x8002('0x2b'),'afterCreate',_0x8002('0x53'),util['inspect'](_0x544992,{'showHidden':![],'depth':null}));}});})[_0x8002('0x18')](function(_0x2ff4f8){return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x53'),util[_0x8002('0x3b')](_0x2ff4f8,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x53'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x8002('0x19')](_0x8002('0x2b'),'afterCreate',_0x8002('0x53'),_0x8002('0x4c'));}break;case _0x8002('0x57'):var _0x3664e7=require(_0x8002('0x58'));if(_0x340844[_0x8002('0x59')]){var _0x188e67={};_0x188e67[_0x8002('0x5a')]=_0x340844[_0x8002('0x2e')];_0x188e67[_0x8002('0x22')]=_0x413568[_0x8002('0x22')];_0x188e67['sender']=_0x340844[_0x8002('0x22')];_0x188e67[_0x8002('0x5b')]=_0x413568[_0x8002('0x25')];_0x188e67['timestamp']=+new Date();var _0x5b4a80='';var _0x391a44='';var _0x205578=Object[_0x8002('0x5c')](_0x188e67);_0x205578[_0x8002('0x5d')]();for(var _0x21bd84=0x0;_0x21bd84<_0x205578[_0x8002('0x5e')];_0x21bd84++){if(_0x5b4a80!=''){_0x5b4a80+='&';}_0x5b4a80+=_0x205578[_0x21bd84]+'='+encodeURIComponent(_0x188e67[_0x205578[_0x21bd84]]);_0x391a44+=_0x188e67[_0x205578[_0x21bd84]];}_0x391a44+=_0x340844[_0x8002('0x59')];_0x391a44=_0x3664e7[_0x8002('0x5f')](_0x8002('0x60'))[_0x8002('0x2a')](_0x391a44)[_0x8002('0x61')](_0x8002('0x62'));if(_0x5b4a80!==''){_0x5b4a80+='&';}_0x5b4a80+=_0x8002('0x63')+_0x391a44;var _0x47919a={'method':_0x8002('0x34'),'uri':_0x340844[_0x8002('0x54')]+_0x8002('0x64')+_0x5b4a80,'json':!![]};return rp(_0x47919a)[_0x8002('0x1d')](function(_0x521809){var _0xce3308=Object['keys'](_0x521809);if(_0x521809[_0xce3308[0x0]][_0x8002('0x19')]&&parseInt(_0x521809[_0xce3308[0x0]][_0x8002('0x19')])===0x0){var _0x580181={'messageId':_0x521809[_0xce3308[0x0]][_0x8002('0x65')]};if(!_0x340844[_0x8002('0x39')]){_0x580181['read']=!![];}return _0x2a34ab[_0x8002('0x2a')](_0x580181);}else{return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x57'),util[_0x8002('0x3b')](_0x521809[_0x8002('0x19')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bbe83){return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x57'),util['inspect'](_0x3bbe83,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8002('0x2c'),_0x8002('0x57'),_0x8002('0x66'));}break;case'clickatell':if(_0x340844[_0x8002('0x59')]){var _0x25fac6={'method':'POST','uri':_0x8002('0x67'),'headers':{'Authorization':_0x340844[_0x8002('0x59')]},'body':{'content':_0x413568[_0x8002('0x25')],'to':[_0x413568[_0x8002('0x22')]],'from':_0x340844['phone'],'binary':![],'clientMessageId':_0x8002('0x68'),'charset':_0x8002('0x69')},'json':!![]};rp(_0x25fac6)['then'](function(_0x588ad4){if(!_0x588ad4[_0x8002('0x19')]){var _0x207c1d={'messageId':_0x588ad4[_0x8002('0x23')][0x0][_0x8002('0x6a')]};if(!_0x340844[_0x8002('0x39')]){_0x207c1d['read']=!![];}return _0x2a34ab[_0x8002('0x2a')](_0x207c1d);}else{return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x6b'),util[_0x8002('0x3b')](_0x588ad4[_0x8002('0x19')],{'showHidden':![],'depth':null}));}})[_0x8002('0x18')](function(_0x911cc5){return logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x6b'),util[_0x8002('0x3b')](_0x911cc5,{'showHidden':![],'depth':null}));});}else{logger[_0x8002('0x19')](_0x8002('0x2b'),_0x8002('0x2c'),_0x8002('0x6b'),_0x8002('0x66'));}break;case _0x8002('0x6c'):if(_0x340844[_0x8002('0x59')]){var _0xd4c9d={};var _0x47919a={'method':_0x8002('0x37'),'uri':_0x8002('0x6d'),'headers':{'Authorization':'Bearer\x20'+_0x340844[_0x8002('0x59')],'Content-Type':_0x8002('0x6e')},'body':{'from':_0x340844['phone'],'to':_0x413568['phone'],'text':_0x413568[_0x8002('0x25')]},'json':!![]};return rp(_0x47919a)[_0x8002('0x1d')](function(_0x7a6ca1){if(_0x7a6ca1[_0x8002('0x6f')]==0xca){_0xd4c9d[_0x8002('0x70')]=_0x7a6ca1;var _0x2e736d={'method':_0x8002('0x37'),'uri':_0x8002('0x71'),'headers':{'Authorization':_0x8002('0x72')+_0x340844[_0x8002('0x59')],'Content-Type':_0x8002('0x6e')},'body':{'refid':_0xd4c9d[_0x8002('0x70')]['refid']},'json':!![]};return rp(_0x2e736d)[_0x8002('0x1d')](function(_0x59a1b1){_0xd4c9d[_0x8002('0x73')]=_0x59a1b1;var _0x416e0e={'messageId':_0xd4c9d[_0x8002('0x70')][_0x8002('0x74')],'read':!![]};return _0x2a34ab[_0x8002('0x2a')](_0x416e0e);});}else{return logger[_0x8002('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8002('0x2c'),_0x8002('0x6c'),util[_0x8002('0x3b')](_0x7a6ca1,{'showHidden':![],'depth':null}));}})['catch'](function(_0x4dc291){return logger[_0x8002('0x19')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x8002('0x2c'),'intelepeer',util[_0x8002('0x3b')](_0x4dc291,{'showHidden':![],'depth':null}));});}else{return logger[_0x8002('0x19')](_0x8002('0x2b'),'afterCreate',_0x8002('0x6c'),_0x8002('0x75'));}break;}}})[_0x8002('0x76')](function(){_0x188949();});}else{_0x188949();}}},'charset':_0x8002('0x77'),'collate':_0x8002('0x78')});}; \ No newline at end of file +var _0xeb92=['models','get','direction','out','secret','UserId','SmsInteraction','SmsInteractionId','then','update','createdAt','catch','error','SmsAccount','find','SmsAccountId','type','accountSid','authToken','phone','messages','create','remote','/api/sms/messages/','/status?token=','token','sid','afterCreate','twilio','inspect','SmsMessage,\x20%s,\x20%s,\x20%s','skebby','https://api.skebby.it/API/v1.0/REST/','password','body','smsMethod','login?username=','username','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','Missing\x20parameters:\x20username,\x20password','senderString','requestid','deliveryReport','read','connectel','Missing\x20parameters:\x20authToken','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','queued_count','head','message_id','clickSend','plivo','authId','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','infobip','Missing\x20parameters:\x20base_url','csc','apiKey','login','sender','text','timestamp','keys','sort','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','Missing\x20parameters:\x20apiKey','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','clickatell','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','status','intelepeer','Token\x20not\x20received','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','FULLTEXT'];(function(_0x20f4fb,_0xd72db5){var _0x51e9b2=function(_0x4cf0d8){while(--_0x4cf0d8){_0x20f4fb['push'](_0x20f4fb['shift']());}};_0x51e9b2(++_0xd72db5);}(_0xeb92,0x166));var _0x2eb9=function(_0x4dc747,_0x35333b){_0x4dc747=_0x4dc747-0x0;var _0x3a6b83=_0xeb92[_0x4dc747];return _0x3a6b83;};'use strict';var _=require(_0x2eb9('0x0'));var util=require(_0x2eb9('0x1'));var logger=require(_0x2eb9('0x2'))('api');var moment=require('moment');var BPromise=require(_0x2eb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2eb9('0x4'));var rimraf=require(_0x2eb9('0x5'));var config=require(_0x2eb9('0x6'));var attributes=require(_0x2eb9('0x7'));module[_0x2eb9('0x8')]=function(_0x367bc2,_0x4584b6){return _0x367bc2[_0x2eb9('0x9')](_0x2eb9('0xa'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0x2eb9('0xb'),'fields':['messageId']},{'name':_0x2eb9('0xc'),'fields':['body'],'type':_0x2eb9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xfa1a3c,_0x1d8215,_0x3fd592){var _0x4df402=_0x367bc2[_0x2eb9('0xe')];var _0x379b8b=_0xfa1a3c[_0x2eb9('0xf')]({'plain':!![]});if(_0x379b8b['direction']['toLowerCase']()==='in'||_0x379b8b[_0x2eb9('0x10')]['toLowerCase']()===_0x2eb9('0x11')&&!_0x379b8b[_0x2eb9('0x12')]&&!_['isNil'](_0x379b8b[_0x2eb9('0x13')])){_0x4df402[_0x2eb9('0x14')]['findOne']({'where':{'id':_0x379b8b[_0x2eb9('0x15')]}})[_0x2eb9('0x16')](function(_0x2a6a64){if(_0x2a6a64){_0x2a6a64[_0x2eb9('0x17')]({'lastMsgAt':_0x379b8b[_0x2eb9('0x18')],'lastMsgDirection':_0x379b8b[_0x2eb9('0x10')]['toLowerCase']()});}})[_0x2eb9('0x19')](function(_0x561a25){console[_0x2eb9('0x1a')](_0x561a25);});}if(_0x379b8b[_0x2eb9('0x10')]==='out'&&!_0x379b8b[_0x2eb9('0x12')]){var _0x35e454;_0x4df402[_0x2eb9('0x1b')][_0x2eb9('0x1c')]({'where':{'id':_0x379b8b[_0x2eb9('0x1d')]},'raw':!![]})['then'](function(_0x738dca){_0x35e454=_0x738dca;if(_0x35e454&&_0x35e454['type']){switch(_0x35e454[_0x2eb9('0x1e')]){case'twilio':var _0x37f6d7=require('twilio');if(_0x35e454[_0x2eb9('0x1f')]&&_0x35e454[_0x2eb9('0x20')]&&_0x35e454[_0x2eb9('0x21')]){var _0x19fa74=new _0x37f6d7(_0x35e454[_0x2eb9('0x1f')],_0x35e454['authToken']);_0x19fa74[_0x2eb9('0x22')][_0x2eb9('0x23')]({'body':_0x379b8b['body'],'to':_0x379b8b[_0x2eb9('0x21')],'from':_0x35e454[_0x2eb9('0x21')],'statusCallback':_0x35e454[_0x2eb9('0x24')]+_0x2eb9('0x25')+_0x379b8b['id']+_0x2eb9('0x26')+_0x35e454[_0x2eb9('0x27')]})['then'](function(_0x4f704e){if(_0x4f704e['sid']){return _0xfa1a3c['update']({'messageId':_0x4f704e[_0x2eb9('0x28')]});}})[_0x2eb9('0x19')](function(_0x276047){logger[_0x2eb9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),_0x2eb9('0x2a'),util[_0x2eb9('0x2b')](_0x276047,{'showHidden':![],'depth':null}));});}else{logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),'afterCreate',_0x2eb9('0x2a'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x2eb9('0x2d'):var _0x5e35a6=_0x2eb9('0x2e');if(_0x35e454['username']&&_0x35e454[_0x2eb9('0x2f')]){var _0x5b4e88={'recipient':[_0x379b8b['phone']],'message':_0x379b8b[_0x2eb9('0x30')],'message_type':_0x35e454[_0x2eb9('0x31')]};if(_0x35e454['smsMethod']&&_0x35e454[_0x2eb9('0x31')]!=='SI'){_0x5b4e88['sender']=_0x35e454['phone'];}var _0x25db82={'url':_0x5e35a6+_0x2eb9('0x32')+_0x35e454[_0x2eb9('0x33')]+'&password='+_0x35e454[_0x2eb9('0x2f')],'method':_0x2eb9('0x34')};rp(_0x25db82)[_0x2eb9('0x16')](function(_0x4f4c2d){var _0x3b2b04=_0x4f4c2d[_0x2eb9('0x35')](';');var _0x3df2a2={'user_key':_0x3b2b04[0x0],'session_key':_0x3b2b04[0x1]};_0x25db82={'url':_0x5e35a6+_0x2eb9('0x36'),'method':_0x2eb9('0x37'),'headers':{'user_key':_0x3df2a2[_0x2eb9('0x38')],'Session_key':_0x3df2a2[_0x2eb9('0x39')]},'json':!![],'body':_0x5b4e88};return rp(_0x25db82);})['then'](function(_0x2c366d){if(_0x2c366d[_0x2eb9('0x3a')]>=0x1){var _0x204ae4={'messageId':_0x2c366d[_0x2eb9('0x3b')]};if(_0x35e454[_0x2eb9('0x31')]!=='GP'||!_0x35e454['deliveryReport']){_0x204ae4['read']=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x204ae4);}else{return logger[_0x2eb9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','skebby',util[_0x2eb9('0x2b')](_0x2c366d,{'showHidden':![],'depth':null}));}})[_0x2eb9('0x19')](function(_0x28932b){return logger['error'](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x2d'),util[_0x2eb9('0x2b')](_0x28932b,{'showHidden':![],'depth':null}));});}else{logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),'skebby',_0x2eb9('0x3c'));}break;case'connectel':if(_0x35e454[_0x2eb9('0x20')]){var _0x323d8e={'recipient':_0x379b8b[_0x2eb9('0x21')],'message':_0x379b8b['body'],'sender':_0x35e454[_0x2eb9('0x3d')]||_0x35e454[_0x2eb9('0x21')],'authorization':_0x35e454[_0x2eb9('0x20')]};var _0x1d8215={'method':_0x2eb9('0x37'),'uri':'https://smsapi.connectel.se/api/send/','body':_0x323d8e,'json':!![]};rp(_0x1d8215)['then'](function(_0x279598){var _0x6c603c={'messageId':_0x279598[_0x2eb9('0x3e')]};if(!_0x35e454[_0x2eb9('0x3f')]){_0x6c603c[_0x2eb9('0x40')]=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x6c603c);})[_0x2eb9('0x19')](function(_0x137916){logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),'connectel',util[_0x2eb9('0x2b')](_0x137916,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x41'),_0x2eb9('0x42'));}break;case'clicksend':if(_0x35e454[_0x2eb9('0x33')]&&_0x35e454[_0x2eb9('0x2f')]){var _0x323d8e={'messages':[{'source':_0x2eb9('0x43'),'to':_0x379b8b[_0x2eb9('0x21')],'body':_0x379b8b[_0x2eb9('0x30')],'from':_0x35e454[_0x2eb9('0x3d')]||_0x35e454[_0x2eb9('0x21')]}]};var _0x5fe2e5=util['format'](_0x2eb9('0x44'),_0x35e454[_0x2eb9('0x33')],_0x35e454[_0x2eb9('0x2f')]);var _0x1d8215={'method':_0x2eb9('0x37'),'uri':_0x2eb9('0x45'),'body':_0x323d8e,'headers':{'Authorization':util[_0x2eb9('0x46')](_0x2eb9('0x47'),new Buffer(_0x5fe2e5)[_0x2eb9('0x48')](_0x2eb9('0x49')))},'json':!![]};rp(_0x1d8215)['then'](function(_0x5b2779){if(_0x5b2779[_0x2eb9('0x4a')]>=0xc8&&_0x5b2779[_0x2eb9('0x4a')]<=0xce){if(_0x5b2779['data']&&_0x5b2779[_0x2eb9('0x4b')][_0x2eb9('0x4c')]>0x0){var _0x1f3dbd=_[_0x2eb9('0x4d')](_0x5b2779[_0x2eb9('0x4b')][_0x2eb9('0x22')]);var _0x1c4d55={'messageId':_0x1f3dbd[_0x2eb9('0x4e')]};if(!_0x35e454['deliveryReport']){_0x1c4d55[_0x2eb9('0x40')]=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x1c4d55);}else{logger['error'](_0x2eb9('0x2c'),'afterCreate',_0x2eb9('0x4f'),util['inspect'](_0x5b2779,{'showHidden':![],'depth':null}));}}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),'clickSend',util[_0x2eb9('0x2b')](_0x5b2779,{'showHidden':![],'depth':null}));}})[_0x2eb9('0x19')](function(_0x35dc7b){logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x4f'),util['inspect'](_0x35dc7b,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x4f'),_0x2eb9('0x3c'));}break;case _0x2eb9('0x50'):if(_0x35e454['authId']&&_0x35e454[_0x2eb9('0x20')]){var _0x323d8e={'dst':_0x379b8b['phone'],'text':_0x379b8b['body'],'src':_0x35e454[_0x2eb9('0x3d')]||_0x35e454[_0x2eb9('0x21')],'url':_0x35e454[_0x2eb9('0x24')]+_0x2eb9('0x25')+_0x379b8b['id']+_0x2eb9('0x26')+_0x35e454[_0x2eb9('0x27')]};var _0x5fe2e5=util[_0x2eb9('0x46')](_0x2eb9('0x44'),_0x35e454[_0x2eb9('0x51')],_0x35e454[_0x2eb9('0x20')]);var _0x1d8215={'method':_0x2eb9('0x37'),'uri':util[_0x2eb9('0x46')](_0x2eb9('0x52'),_0x35e454['authId']),'body':_0x323d8e,'headers':{'Authorization':util['format'](_0x2eb9('0x47'),new Buffer(_0x5fe2e5)[_0x2eb9('0x48')](_0x2eb9('0x49')))},'json':!![]};rp(_0x1d8215)[_0x2eb9('0x16')](function(_0x136bfc){var _0x36f03c={'messageId':_0x136bfc[_0x2eb9('0x53')][0x0]};return _0xfa1a3c['update'](_0x36f03c);})[_0x2eb9('0x19')](function(_0x37c380){logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),'plivo',util[_0x2eb9('0x2b')](_0x37c380,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x2eb9('0x50'),_0x2eb9('0x54'));}break;case'infobip':if(_0x35e454[_0x2eb9('0x33')]&&_0x35e454[_0x2eb9('0x2f')]){if(_0x35e454[_0x2eb9('0x55')]){var _0x3908b2={'method':'POST','uri':_0x35e454['baseUrl']+_0x2eb9('0x56'),'body':{'username':_0x35e454['username'],'password':_0x35e454[_0x2eb9('0x2f')]},'json':!![]};return rp(_0x3908b2)['then'](function(_0x36a9f7){var _0x3989d2={'method':_0x2eb9('0x37'),'uri':_0x35e454['baseUrl']+_0x2eb9('0x57'),'body':{'messages':[{'from':_0x35e454[_0x2eb9('0x21')],'destinations':[{'to':_0x379b8b[_0x2eb9('0x21')]}],'text':_0x379b8b[_0x2eb9('0x30')],'notifyUrl':_0x35e454[_0x2eb9('0x24')]+'/api/sms/messages/'+_0x379b8b['id']+_0x2eb9('0x26')+_0x35e454[_0x2eb9('0x27')],'notifyContentType':_0x2eb9('0x58'),'callbackData':_0x35e454[_0x2eb9('0x21')]+';'+_0x379b8b[_0x2eb9('0x30')]}]},'headers':{'Authorization':_0x2eb9('0x59')+_0x36a9f7['token']},'json':!![]};return rp(_0x3989d2)['then'](function(_0x591be9){if(_0x591be9[_0x2eb9('0x22')]){var _0x78f828={'messageId':_0x591be9[_0x2eb9('0x22')][0x0][_0x2eb9('0xb')]};if(!_0x35e454[_0x2eb9('0x3f')]){_0x78f828[_0x2eb9('0x40')]=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x78f828);}else{return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x5a'),util[_0x2eb9('0x2b')](_0x591be9,{'showHidden':![],'depth':null}));}});})['catch'](function(_0x1c9066){return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x5a'),util[_0x2eb9('0x2b')](_0x1c9066,{'showHidden':![],'depth':null}));});}else{logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),'afterCreate',_0x2eb9('0x5a'),_0x2eb9('0x5b'));}}else{logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),'afterCreate',_0x2eb9('0x5a'),_0x2eb9('0x3c'));}break;case _0x2eb9('0x5c'):var _0x12a4f4=require('crypto');if(_0x35e454[_0x2eb9('0x5d')]){var _0xfdbfe9={};_0xfdbfe9[_0x2eb9('0x5e')]=_0x35e454[_0x2eb9('0x33')];_0xfdbfe9[_0x2eb9('0x21')]=_0x379b8b[_0x2eb9('0x21')];_0xfdbfe9[_0x2eb9('0x5f')]=_0x35e454[_0x2eb9('0x21')];_0xfdbfe9[_0x2eb9('0x60')]=_0x379b8b[_0x2eb9('0x30')];_0xfdbfe9[_0x2eb9('0x61')]=+new Date();var _0x5440e7='';var _0x473b94='';var _0x5a034f=Object[_0x2eb9('0x62')](_0xfdbfe9);_0x5a034f[_0x2eb9('0x63')]();for(var _0x3e9fd4=0x0;_0x3e9fd4<_0x5a034f[_0x2eb9('0x64')];_0x3e9fd4++){if(_0x5440e7!=''){_0x5440e7+='&';}_0x5440e7+=_0x5a034f[_0x3e9fd4]+'='+encodeURIComponent(_0xfdbfe9[_0x5a034f[_0x3e9fd4]]);_0x473b94+=_0xfdbfe9[_0x5a034f[_0x3e9fd4]];}_0x473b94+=_0x35e454['apiKey'];_0x473b94=_0x12a4f4[_0x2eb9('0x65')](_0x2eb9('0x66'))[_0x2eb9('0x17')](_0x473b94)[_0x2eb9('0x67')](_0x2eb9('0x68'));if(_0x5440e7!==''){_0x5440e7+='&';}_0x5440e7+=_0x2eb9('0x69')+_0x473b94;var _0x25db82={'method':'GET','uri':_0x35e454[_0x2eb9('0x55')]+_0x2eb9('0x6a')+_0x5440e7,'json':!![]};return rp(_0x25db82)[_0x2eb9('0x16')](function(_0x5ab104){var _0x23d115=Object['keys'](_0x5ab104);if(_0x5ab104[_0x23d115[0x0]]['error']&&parseInt(_0x5ab104[_0x23d115[0x0]][_0x2eb9('0x1a')])===0x0){var _0x3c9b28={'messageId':_0x5ab104[_0x23d115[0x0]]['id_sms']};if(!_0x35e454[_0x2eb9('0x3f')]){_0x3c9b28[_0x2eb9('0x40')]=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x3c9b28);}else{return logger['error'](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x5c'),util[_0x2eb9('0x2b')](_0x5ab104['error'],{'showHidden':![],'depth':null}));}})[_0x2eb9('0x19')](function(_0x4fd82c){return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x5c'),util[_0x2eb9('0x2b')](_0x4fd82c,{'showHidden':![],'depth':null}));});}else{logger[_0x2eb9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),'csc',_0x2eb9('0x6b'));}break;case'clickatell':if(_0x35e454[_0x2eb9('0x5d')]){var _0x14a30b={'method':_0x2eb9('0x37'),'uri':_0x2eb9('0x6c'),'headers':{'Authorization':_0x35e454[_0x2eb9('0x5d')]},'body':{'content':_0x379b8b[_0x2eb9('0x30')],'to':[_0x379b8b[_0x2eb9('0x21')]],'from':_0x35e454[_0x2eb9('0x21')],'binary':![],'clientMessageId':_0x2eb9('0x6d'),'charset':_0x2eb9('0x6e')},'json':!![]};rp(_0x14a30b)[_0x2eb9('0x16')](function(_0x4391da){if(!_0x4391da['error']){var _0x338d21={'messageId':_0x4391da[_0x2eb9('0x22')][0x0][_0x2eb9('0x6f')]};if(!_0x35e454['deliveryReport']){_0x338d21[_0x2eb9('0x40')]=!![];}return _0xfa1a3c[_0x2eb9('0x17')](_0x338d21);}else{return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x70'),util[_0x2eb9('0x2b')](_0x4391da[_0x2eb9('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3562e6){return logger[_0x2eb9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),'clickatell',util['inspect'](_0x3562e6,{'showHidden':![],'depth':null}));});}else{logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x70'),_0x2eb9('0x6b'));}break;case'intelepeer':if(_0x35e454[_0x2eb9('0x5d')]){var _0xd5d893={};var _0x25db82={'method':_0x2eb9('0x37'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/send','headers':{'Authorization':_0x2eb9('0x71')+_0x35e454[_0x2eb9('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x35e454[_0x2eb9('0x21')],'to':_0x379b8b['phone'],'text':_0x379b8b['body']},'json':!![]};return rp(_0x25db82)[_0x2eb9('0x16')](function(_0x2ef52d){if(_0x2ef52d[_0x2eb9('0x72')]==0xca){_0xd5d893[_0x2eb9('0x73')]=_0x2ef52d;var _0x4adc21={'method':'POST','uri':_0x2eb9('0x74'),'headers':{'Authorization':_0x2eb9('0x71')+_0x35e454[_0x2eb9('0x5d')],'Content-Type':'application/json'},'body':{'refid':_0xd5d893[_0x2eb9('0x73')][_0x2eb9('0x75')]},'json':!![]};return rp(_0x4adc21)[_0x2eb9('0x16')](function(_0x304e4f){_0xd5d893[_0x2eb9('0x76')]=_0x304e4f;var _0x1b98c0={'messageId':_0xd5d893['message']['refid'],'read':!![]};return _0xfa1a3c[_0x2eb9('0x17')](_0x1b98c0);});}else{return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),'afterCreate','intelepeer',util[_0x2eb9('0x2b')](_0x2ef52d,{'showHidden':![],'depth':null}));}})['catch'](function(_0x2c5cb5){return logger[_0x2eb9('0x1a')](_0x2eb9('0x2c'),_0x2eb9('0x29'),_0x2eb9('0x77'),util[_0x2eb9('0x2b')](_0x2c5cb5,{'showHidden':![],'depth':null}));});}else{return logger[_0x2eb9('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x2eb9('0x29'),_0x2eb9('0x77'),_0x2eb9('0x78'));}break;}}})[_0x2eb9('0x79')](function(){_0x3fd592();});}else{_0x3fd592();}}},'charset':_0x2eb9('0x7a'),'collate':_0x2eb9('0x7b')});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.rpc.js b/server/api/smsMessage/smsMessage.rpc.js index e33ab9c..3fbcf3f 100644 --- a/server/api/smsMessage/smsMessage.rpc.js +++ b/server/api/smsMessage/smsMessage.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5eb8=['client','http','defaults','redis','localhost','register','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','SmsMessage,\x20%s,\x20%s','message','result','catch','options','raw','then','stringify','CreateSmsMessage','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x19f6c8,_0x5a4e0a){var _0x317376=function(_0x1dd785){while(--_0x1dd785){_0x19f6c8['push'](_0x19f6c8['shift']());}};_0x317376(++_0x5a4e0a);}(_0x5eb8,0xb0));var _0x85eb=function(_0x594e11,_0x28f652){_0x594e11=_0x594e11-0x0;var _0x5418ad=_0x5eb8[_0x594e11];return _0x5418ad;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x85eb('0x0'));var BPromise=require(_0x85eb('0x1'));var rs=require(_0x85eb('0x2'));var fs=require('fs');var Redis=require(_0x85eb('0x3'));var db=require(_0x85eb('0x4'))['db'];var utils=require(_0x85eb('0x5'));var logger=require(_0x85eb('0x6'))(_0x85eb('0x7'));var config=require(_0x85eb('0x8'));var jayson=require(_0x85eb('0x9'));var client=jayson[_0x85eb('0xa')][_0x85eb('0xb')]({'port':0x232a});config['redis']=_[_0x85eb('0xc')](config[_0x85eb('0xd')],{'host':_0x85eb('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x85eb('0xd')]));require('./smsMessage.socket')[_0x85eb('0xf')](socket);function respondWithRpcPromise(_0x40d6b6,_0x673228,_0x29030b){return new BPromise(function(_0x1dacf2,_0x73e6d0){return client[_0x85eb('0x10')](_0x40d6b6,_0x29030b)['then'](function(_0x163f32){logger[_0x85eb('0x11')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x85eb('0x12'));logger[_0x85eb('0x13')](_0x85eb('0x14'),_0x673228,_0x85eb('0x12'),JSON['stringify'](_0x163f32));if(_0x163f32['error']){if(_0x163f32[_0x85eb('0x15')]['code']===0x1f4){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x73e6d0(_0x163f32[_0x85eb('0x15')]['message']);}logger[_0x85eb('0x15')]('SmsMessage,\x20%s,\x20%s',_0x673228,_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);return _0x1dacf2(_0x163f32[_0x85eb('0x15')][_0x85eb('0x17')]);}else{logger['info']('SmsMessage,\x20%s,\x20%s',_0x673228,'request\x20sent');_0x1dacf2(_0x163f32[_0x85eb('0x18')][_0x85eb('0x17')]);}})[_0x85eb('0x19')](function(_0x2e986c){logger[_0x85eb('0x15')](_0x85eb('0x16'),_0x673228,_0x2e986c);_0x73e6d0(_0x2e986c);});});}exports['CreateSmsMessage']=function(_0x24cf28){var _0x7244fc=this;return new Promise(function(_0xd9f06d,_0x4e8041){return db['SmsMessage']['create'](_0x24cf28['body'],{'raw':_0x24cf28[_0x85eb('0x1a')]?_0x24cf28[_0x85eb('0x1a')][_0x85eb('0x1b')]===undefined?!![]:![]:!![]})[_0x85eb('0x1c')](function(_0x465c74){logger[_0x85eb('0x11')]('CreateSmsMessage',_0x24cf28);logger['debug']('CreateSmsMessage',_0x24cf28,JSON[_0x85eb('0x1d')](_0x465c74));_0xd9f06d(_0x465c74);})[_0x85eb('0x19')](function(_0x3f7a4d){logger[_0x85eb('0x15')](_0x85eb('0x1e'),_0x3f7a4d[_0x85eb('0x17')],_0x24cf28);_0x4e8041(_0x7244fc['error'](0x1f4,_0x3f7a4d[_0x85eb('0x17')]));});});}; \ No newline at end of file +var _0x57ca=['jayson/promise','client','http','redis','defaults','localhost','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsMessage','create','body','options','raw','then','info','CreateSmsMessage','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x57ca,0x108));var _0xa57c=function(_0x5d2b8e,_0x3664af){_0x5d2b8e=_0x5d2b8e-0x0;var _0x1f715c=_0x57ca[_0x5d2b8e];return _0x1f715c;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var moment=require(_0xa57c('0x1'));var BPromise=require('bluebird');var rs=require(_0xa57c('0x2'));var fs=require('fs');var Redis=require(_0xa57c('0x3'));var db=require(_0xa57c('0x4'))['db'];var utils=require(_0xa57c('0x5'));var logger=require(_0xa57c('0x6'))('rpc');var config=require(_0xa57c('0x7'));var jayson=require(_0xa57c('0x8'));var client=jayson[_0xa57c('0x9')][_0xa57c('0xa')]({'port':0x232a});config[_0xa57c('0xb')]=_[_0xa57c('0xc')](config[_0xa57c('0xb')],{'host':_0xa57c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa57c('0xb')]));require('./smsMessage.socket')[_0xa57c('0xe')](socket);function respondWithRpcPromise(_0x932dcc,_0x4fa5ed,_0x156bca){return new BPromise(function(_0x51f287,_0x554101){return client[_0xa57c('0xf')](_0x932dcc,_0x156bca)['then'](function(_0x2ed4c6){logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));logger[_0xa57c('0x12')](_0xa57c('0x13'),_0x4fa5ed,_0xa57c('0x11'),JSON['stringify'](_0x2ed4c6));if(_0x2ed4c6[_0xa57c('0x14')]){if(_0x2ed4c6['error'][_0xa57c('0x15')]===0x1f4){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x554101(_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);}logger['error'](_0xa57c('0x10'),_0x4fa5ed,_0x2ed4c6[_0xa57c('0x14')][_0xa57c('0x16')]);return _0x51f287(_0x2ed4c6['error'][_0xa57c('0x16')]);}else{logger['info'](_0xa57c('0x10'),_0x4fa5ed,_0xa57c('0x11'));_0x51f287(_0x2ed4c6[_0xa57c('0x17')][_0xa57c('0x16')]);}})[_0xa57c('0x18')](function(_0x4728f9){logger[_0xa57c('0x14')](_0xa57c('0x10'),_0x4fa5ed,_0x4728f9);_0x554101(_0x4728f9);});});}exports['CreateSmsMessage']=function(_0x8a8856){var _0x4a53ab=this;return new Promise(function(_0x4a35bb,_0x418415){return db[_0xa57c('0x19')][_0xa57c('0x1a')](_0x8a8856[_0xa57c('0x1b')],{'raw':_0x8a8856['options']?_0x8a8856[_0xa57c('0x1c')][_0xa57c('0x1d')]===undefined?!![]:![]:!![]})[_0xa57c('0x1e')](function(_0x2213b2){logger[_0xa57c('0x1f')](_0xa57c('0x20'),_0x8a8856);logger[_0xa57c('0x12')](_0xa57c('0x20'),_0x8a8856,JSON[_0xa57c('0x21')](_0x2213b2));_0x4a35bb(_0x2213b2);})[_0xa57c('0x18')](function(_0x382a26){logger[_0xa57c('0x14')](_0xa57c('0x20'),_0x382a26[_0xa57c('0x16')],_0x8a8856);_0x418415(_0x4a53ab[_0xa57c('0x14')](0x1f4,_0x382a26['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index a0ee535..84a570a 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 _0x6d78=['emit','removeListener','register','./smsMessage.events','save'];(function(_0x476209,_0x5f289e){var _0x359647=function(_0x2bd25c){while(--_0x2bd25c){_0x476209['push'](_0x476209['shift']());}};_0x359647(++_0x5f289e);}(_0x6d78,0x19d));var _0x86d7=function(_0x14f904,_0x3290e8){_0x14f904=_0x14f904-0x0;var _0x538469=_0x6d78[_0x14f904];return _0x538469;};'use strict';var SmsMessageEvents=require(_0x86d7('0x0'));var events=[_0x86d7('0x1'),'remove','update'];function createListener(_0x5d5f2c,_0x316315){return function(_0x156bbd){_0x316315[_0x86d7('0x2')](_0x5d5f2c,_0x156bbd);};}function removeListener(_0x2244c0,_0x25ae7c){return function(){SmsMessageEvents[_0x86d7('0x3')](_0x2244c0,_0x25ae7c);};}exports[_0x86d7('0x4')]=function(_0x179213){for(var _0x2e0160=0x0,_0x49e071=events['length'];_0x2e0160<_0x49e071;_0x2e0160++){var _0xd56083=events[_0x2e0160];var _0x47994b=createListener('smsMessage:'+_0xd56083,_0x179213);SmsMessageEvents['on'](_0xd56083,_0x47994b);}}; \ No newline at end of file +var _0xf34d=['emit','removeListener','save','remove','update'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xf34d,0x11a));var _0xdf34=function(_0x4f45dd,_0x4b40ef){_0x4f45dd=_0x4f45dd-0x0;var _0xa6b731=_0xf34d[_0x4f45dd];return _0xa6b731;};'use strict';var SmsMessageEvents=require('./smsMessage.events');var events=[_0xdf34('0x0'),_0xdf34('0x1'),_0xdf34('0x2')];function createListener(_0x5c4627,_0x826566){return function(_0x53c566){_0x826566[_0xdf34('0x3')](_0x5c4627,_0x53c566);};}function removeListener(_0x3e6c91,_0x521a05){return function(){SmsMessageEvents[_0xdf34('0x4')](_0x3e6c91,_0x521a05);};}exports['register']=function(_0x1fb357){for(var _0x3ba4c4=0x0,_0x26e564=events['length'];_0x3ba4c4<_0x26e564;_0x3ba4c4++){var _0x190a6d=events[_0x3ba4c4];var _0x25f2b3=createListener('smsMessage:'+_0x190a6d,_0x1fb357);SmsMessageEvents['on'](_0x190a6d,_0x25f2b3);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index d6bdcb2..dfb530b 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 _0xd991=['create','put','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post'];(function(_0x46060a,_0x3ca70b){var _0x32fd79=function(_0x4d157c){while(--_0x4d157c){_0x46060a['push'](_0x46060a['shift']());}};_0x32fd79(++_0x3ca70b);}(_0xd991,0x115));var _0x1d99=function(_0xd97d18,_0x28b2b2){_0xd97d18=_0xd97d18-0x0;var _0x5c5024=_0xd991[_0xd97d18];return _0x5c5024;};'use strict';var multer=require(_0x1d99('0x0'));var util=require(_0x1d99('0x1'));var path=require(_0x1d99('0x2'));var timeout=require(_0x1d99('0x3'));var express=require(_0x1d99('0x4'));var router=express['Router']();var auth=require(_0x1d99('0x5'));var interaction=require(_0x1d99('0x6'));var config=require(_0x1d99('0x7'));var controller=require(_0x1d99('0x8'));router[_0x1d99('0x9')]('/',auth[_0x1d99('0xa')](),controller['index']);router[_0x1d99('0x9')](_0x1d99('0xb'),auth['isAuthenticated'](),controller[_0x1d99('0xc')]);router[_0x1d99('0x9')](_0x1d99('0xd'),auth[_0x1d99('0xa')](),controller[_0x1d99('0xe')]);router[_0x1d99('0x9')](_0x1d99('0xf'),auth[_0x1d99('0xa')](),controller[_0x1d99('0x10')]);router['get'](_0x1d99('0x11'),auth[_0x1d99('0xa')](),controller['getTeams']);router[_0x1d99('0x9')](_0x1d99('0x12'),auth[_0x1d99('0xa')](),controller['getAgents']);router[_0x1d99('0x13')]('/',auth[_0x1d99('0xa')](),controller[_0x1d99('0x14')]);router[_0x1d99('0x13')](_0x1d99('0x11'),auth[_0x1d99('0xa')](),controller['addTeams']);router[_0x1d99('0x13')]('/:id/users',auth[_0x1d99('0xa')](),controller['addAgents']);router[_0x1d99('0x15')](_0x1d99('0xd'),auth[_0x1d99('0xa')](),controller[_0x1d99('0x16')]);router[_0x1d99('0x17')](_0x1d99('0xd'),auth[_0x1d99('0xa')](),controller[_0x1d99('0x18')]);router['delete'](_0x1d99('0x11'),auth['isAuthenticated'](),controller[_0x1d99('0x19')]);router[_0x1d99('0x17')](_0x1d99('0x12'),auth[_0x1d99('0xa')](),controller[_0x1d99('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x6011=['getAgents','post','create','addAgents','/:id','update','destroy','delete','/:id/teams','removeTeams','Router','../../components/auth/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','/:id/users'];(function(_0x57727e,_0x419629){var _0xf59f36=function(_0x294ebf){while(--_0x294ebf){_0x57727e['push'](_0x57727e['shift']());}};_0xf59f36(++_0x419629);}(_0x6011,0x196));var _0x1601=function(_0x3a9f54,_0x3d26d0){_0x3a9f54=_0x3a9f54-0x0;var _0x3f7f92=_0x6011[_0x3a9f54];return _0x3f7f92;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1601('0x0')]();var auth=require(_0x1601('0x1'));var interaction=require('../../components/interaction/service');var config=require(_0x1601('0x2'));var controller=require(_0x1601('0x3'));router[_0x1601('0x4')]('/',auth[_0x1601('0x5')](),controller[_0x1601('0x6')]);router[_0x1601('0x4')](_0x1601('0x7'),auth[_0x1601('0x5')](),controller[_0x1601('0x8')]);router[_0x1601('0x4')]('/:id',auth[_0x1601('0x5')](),controller[_0x1601('0x9')]);router[_0x1601('0x4')](_0x1601('0xa'),auth[_0x1601('0x5')](),controller['getMembers']);router['get']('/:id/teams',auth[_0x1601('0x5')](),controller['getTeams']);router[_0x1601('0x4')](_0x1601('0xb'),auth[_0x1601('0x5')](),controller[_0x1601('0xc')]);router[_0x1601('0xd')]('/',auth[_0x1601('0x5')](),controller[_0x1601('0xe')]);router[_0x1601('0xd')]('/:id/teams',auth[_0x1601('0x5')](),controller['addTeams']);router[_0x1601('0xd')]('/:id/users',auth[_0x1601('0x5')](),controller[_0x1601('0xf')]);router['put'](_0x1601('0x10'),auth[_0x1601('0x5')](),controller[_0x1601('0x11')]);router['delete']('/:id',auth[_0x1601('0x5')](),controller[_0x1601('0x12')]);router[_0x1601('0x13')](_0x1601('0x14'),auth[_0x1601('0x5')](),controller[_0x1601('0x15')]);router[_0x1601('0x13')](_0x1601('0xb'),auth[_0x1601('0x5')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index 39d584a..53dba69 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 _0x3886=['STRING','INTEGER','rrmemory','beepall','sequelize','exports'];(function(_0x508da9,_0x161050){var _0x382a4f=function(_0x609873){while(--_0x609873){_0x508da9['push'](_0x508da9['shift']());}};_0x382a4f(++_0x161050);}(_0x3886,0x88));var _0x6388=function(_0x2fe2da,_0x415b93){_0x2fe2da=_0x2fe2da-0x0;var _0x50198b=_0x3886[_0x2fe2da];return _0x50198b;};'use strict';var Sequelize=require(_0x6388('0x0'));module[_0x6388('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6388('0x2')]},'timeout':{'type':Sequelize[_0x6388('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6388('0x4'),_0x6388('0x5'),'roundrobin')}}; \ No newline at end of file +var _0x9516=['rrmemory','beepall','roundrobin','sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9516,0xbd));var _0x6951=function(_0x333fc8,_0x2b292c){_0x333fc8=_0x333fc8-0x0;var _0x432439=_0x9516[_0x333fc8];return _0x432439;};'use strict';var Sequelize=require(_0x6951('0x0'));module[_0x6951('0x1')]={'name':{'type':Sequelize[_0x6951('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x6951('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x6951('0x3'),_0x6951('0x4'),_0x6951('0x5'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index c17d9e0..53c487e 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 _0x2032=['map','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','sort','where','pick','merge','type','VIRTUAL','filter','includeAll','include','SmsQueue','findAll','catch','show','params','keys','rawAttributes','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','SmsQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserSmsQueue','nolimit','order','SmsQueueId','options','User','findAndCountAll','smsPause','updatedAt','createdAt','rows','format','%s/%s','SIP','getTeams','ids','Team','online','voicePause','interface','Agents','sequelize','transaction','addTeams','forEach','emit','userSmsQueue:save','removeTeams','select','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ut.UserId\x20=\x20?','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','addAgents','omit','spread','userSmsQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../mysqldb','redis','./smsQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','reject','update','destroy','then','get','UserProfileResource','error','name','send'];(function(_0x3a9b89,_0x3d858b){var _0x116245=function(_0x3dee3d){while(--_0x3dee3d){_0x3a9b89['push'](_0x3a9b89['shift']());}};_0x116245(++_0x3d858b);}(_0x2032,0xd9));var _0x2203=function(_0x41c42c,_0x521157){_0x41c42c=_0x41c42c-0x0;var _0x211c25=_0x2032[_0x41c42c];return _0x211c25;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x2203('0x0'));var rimraf=require(_0x2203('0x1'));var zipdir=require(_0x2203('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2203('0x3'));var moment=require(_0x2203('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x2203('0x5'));var util=require(_0x2203('0x6'));var path=require(_0x2203('0x7'));var sox=require(_0x2203('0x8'));var csv=require(_0x2203('0x9'));var ejs=require(_0x2203('0xa'));var fs=require('fs');var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var db=require(_0x2203('0x16'))['db'];config[_0x2203('0x17')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2203('0x18'))['register'](socket);function respondWithStatusCode(_0x592e47,_0x21a3af){_0x21a3af=_0x21a3af||0xcc;return function(_0x472265){if(_0x472265){return _0x592e47[_0x2203('0x19')](_0x21a3af);}return _0x592e47[_0x2203('0x1a')](_0x21a3af)[_0x2203('0x1b')]();};}function respondWithResult(_0x3fe0a8,_0x2c36e6){_0x2c36e6=_0x2c36e6||0xc8;return function(_0x2c085c){if(_0x2c085c){return _0x3fe0a8[_0x2203('0x1a')](_0x2c36e6)[_0x2203('0x1c')](_0x2c085c);}};}function respondWithFilteredResult(_0x5129fb,_0x280eda){return function(_0x2ee127){if(_0x2ee127){var _0x4893ff=_0x2ee127[_0x2203('0x1d')],_0x3f9ef6=_0x280eda['offset'],_0x8906e1=_0x280eda[_0x2203('0x1e')]+_0x280eda[_0x2203('0x1f')],_0x4aeb9f;if(_0x8906e1>=_0x4893ff){_0x8906e1=_0x4893ff;_0x4aeb9f=0xc8;}else{_0x4aeb9f=0xce;}_0x5129fb[_0x2203('0x1a')](_0x4aeb9f);return _0x5129fb[_0x2203('0x20')](_0x2203('0x21'),_0x3f9ef6+'-'+_0x8906e1+'/'+_0x4893ff)[_0x2203('0x1c')](_0x2ee127);}return null;};}function patchUpdates(_0x538c23){return function(_0x13d3f7){try{jsonpatch['apply'](_0x13d3f7,_0x538c23,!![]);}catch(_0x5ac866){return BPromise[_0x2203('0x22')](_0x5ac866);}return _0x13d3f7['save']();};}function saveUpdates(_0x3b8ef9,_0x5bfe61){return function(_0x5d4c4e){if(_0x5d4c4e){return _0x5d4c4e[_0x2203('0x23')](_0x3b8ef9)['then'](function(_0x5c8da9){return _0x5c8da9;});}return null;};}function removeEntity(_0x226374,_0x2718f5){return function(_0x21f930){if(_0x21f930){return _0x21f930[_0x2203('0x24')]()[_0x2203('0x25')](function(){var _0x3114ef=_0x21f930[_0x2203('0x26')]({'plain':!![]});var _0x250349='SmsQueues';return db[_0x2203('0x27')][_0x2203('0x24')]({'where':{'type':_0x250349,'resourceId':_0x3114ef['id']}})[_0x2203('0x25')](function(){return _0x21f930;});})['then'](function(){_0x226374[_0x2203('0x1a')](0xcc)[_0x2203('0x1b')]();});}};}function handleEntityNotFound(_0x5c5fd3,_0xd6e109){return function(_0xd91f5d){if(!_0xd91f5d){_0x5c5fd3[_0x2203('0x19')](0x194);}return _0xd91f5d;};}function handleError(_0x46b8b9,_0x28ae02){_0x28ae02=_0x28ae02||0x1f4;return function(_0x1df508){logger[_0x2203('0x28')](_0x1df508['stack']);if(_0x1df508[_0x2203('0x29')]){delete _0x1df508[_0x2203('0x29')];}_0x46b8b9[_0x2203('0x1a')](_0x28ae02)[_0x2203('0x2a')](_0x1df508);};}exports['index']=function(_0x3a8e23,_0x21ff0d){var _0x287c95={},_0xf59954={},_0x520602={'count':0x0,'rows':[]};var _0xea1637=_[_0x2203('0x2b')](db['SmsQueue']['rawAttributes'],function(_0x1d5f74){return{'name':_0x1d5f74['fieldName'],'type':_0x1d5f74['type'][_0x2203('0x2c')]};});_0xf59954[_0x2203('0x2d')]=_[_0x2203('0x2b')](_0xea1637,_0x2203('0x29'));_0xf59954[_0x2203('0x2e')]=_['keys'](_0x3a8e23[_0x2203('0x2e')]);_0xf59954[_0x2203('0x2f')]=_['intersection'](_0xf59954[_0x2203('0x2d')],_0xf59954[_0x2203('0x2e')]);_0x287c95[_0x2203('0x30')]=_[_0x2203('0x31')](_0xf59954[_0x2203('0x2d')],qs[_0x2203('0x32')](_0x3a8e23[_0x2203('0x2e')][_0x2203('0x32')]));_0x287c95[_0x2203('0x30')]=_0x287c95['attributes'][_0x2203('0x33')]?_0x287c95[_0x2203('0x30')]:_0xf59954['model'];if(!_0x3a8e23['query'][_0x2203('0x34')]('nolimit')){_0x287c95[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x3a8e23[_0x2203('0x2e')]['limit']);_0x287c95['offset']=qs[_0x2203('0x1e')](_0x3a8e23['query'][_0x2203('0x1e')]);}_0x287c95['order']=qs[_0x2203('0x35')](_0x3a8e23['query'][_0x2203('0x35')]);_0x287c95[_0x2203('0x36')]=qs[_0x2203('0x2f')](_[_0x2203('0x37')](_0x3a8e23[_0x2203('0x2e')],_0xf59954['filters']));if(_0x3a8e23['query']['filter']){_0x287c95[_0x2203('0x36')]=_[_0x2203('0x38')](_0x287c95[_0x2203('0x36')],{'$or':_[_0x2203('0x2b')](_0xea1637,function(_0x3283fb){if(_0x3283fb[_0x2203('0x39')]!==_0x2203('0x3a')){var _0x590b4e={};_0x590b4e[_0x3283fb[_0x2203('0x29')]]={'$like':'%'+_0x3a8e23[_0x2203('0x2e')][_0x2203('0x3b')]+'%'};return _0x590b4e;}})});}_0x287c95=_[_0x2203('0x38')]({},_0x287c95,_0x3a8e23['options']);var _0x50d74a={'where':_0x287c95[_0x2203('0x36')]};return db['SmsQueue'][_0x2203('0x1d')](_0x50d74a)[_0x2203('0x25')](function(_0x132091){_0x520602['count']=_0x132091;if(_0x3a8e23['query'][_0x2203('0x3c')]){_0x287c95[_0x2203('0x3d')]=[{'all':!![]}];}return db[_0x2203('0x3e')][_0x2203('0x3f')](_0x287c95);})[_0x2203('0x25')](function(_0x1fa734){_0x520602['rows']=_0x1fa734;return _0x520602;})[_0x2203('0x25')](respondWithFilteredResult(_0x21ff0d,_0x287c95))[_0x2203('0x40')](handleError(_0x21ff0d,null));};exports[_0x2203('0x41')]=function(_0x266076,_0x16b452){var _0x36b99f={'raw':!![],'where':{'id':_0x266076[_0x2203('0x42')]['id']}},_0x5b4842={};_0x5b4842[_0x2203('0x2d')]=_[_0x2203('0x43')](db['SmsQueue'][_0x2203('0x44')]);_0x5b4842[_0x2203('0x2e')]=_[_0x2203('0x43')](_0x266076[_0x2203('0x2e')]);_0x5b4842['filters']=_['intersection'](_0x5b4842[_0x2203('0x2d')],_0x5b4842['query']);_0x36b99f[_0x2203('0x30')]=_[_0x2203('0x31')](_0x5b4842[_0x2203('0x2d')],qs[_0x2203('0x32')](_0x266076['query'][_0x2203('0x32')]));_0x36b99f[_0x2203('0x30')]=_0x36b99f['attributes'][_0x2203('0x33')]?_0x36b99f[_0x2203('0x30')]:_0x5b4842[_0x2203('0x2d')];if(_0x266076[_0x2203('0x2e')]['includeAll']){_0x36b99f['include']=[{'all':!![]}];}_0x36b99f=_[_0x2203('0x38')]({},_0x36b99f,_0x266076['options']);return db['SmsQueue'][_0x2203('0x45')](_0x36b99f)[_0x2203('0x25')](handleEntityNotFound(_0x16b452,null))[_0x2203('0x25')](respondWithResult(_0x16b452,null))['catch'](handleError(_0x16b452,null));};exports['create']=function(_0x131aec,_0x3eecb7){return db[_0x2203('0x3e')][_0x2203('0x46')](_0x131aec[_0x2203('0x47')],{})[_0x2203('0x25')](function(_0x4a7f4e){var _0x747dce=_0x131aec['user'][_0x2203('0x26')]({'plain':!![]});if(!_0x747dce)throw new Error(_0x2203('0x48'));if(_0x747dce[_0x2203('0x49')]===_0x2203('0x4a')){var _0x58b9bb=_0x4a7f4e['get']({'plain':!![]});var _0x30d503=_0x2203('0x4b');return db[_0x2203('0x4c')][_0x2203('0x45')]({'where':{'name':_0x30d503,'userProfileId':_0x747dce['userProfileId']},'raw':!![]})['then'](function(_0x49999a){if(_0x49999a&&_0x49999a[_0x2203('0x4d')]===0x0){return db[_0x2203('0x27')]['create']({'name':_0x58b9bb[_0x2203('0x29')],'resourceId':_0x58b9bb['id'],'type':_0x49999a[_0x2203('0x29')],'sectionId':_0x49999a['id']},{})['then'](function(){return _0x4a7f4e;});}else{return _0x4a7f4e;}})[_0x2203('0x40')](function(_0xb47204){logger[_0x2203('0x28')](_0x2203('0x4e'),_0xb47204);throw _0xb47204;});}return _0x4a7f4e;})['then'](respondWithResult(_0x3eecb7,0xc9))[_0x2203('0x40')](handleError(_0x3eecb7,null));};exports['update']=function(_0x3858f0,_0x1de713){if(_0x3858f0['body']['id']){delete _0x3858f0[_0x2203('0x47')]['id'];}return db[_0x2203('0x3e')][_0x2203('0x45')]({'where':{'id':_0x3858f0[_0x2203('0x42')]['id']}})[_0x2203('0x25')](handleEntityNotFound(_0x1de713,null))[_0x2203('0x25')](saveUpdates(_0x3858f0['body'],null))['then'](respondWithResult(_0x1de713,null))[_0x2203('0x40')](handleError(_0x1de713,null));};exports['destroy']=function(_0x56e881,_0xfddc3b){return db[_0x2203('0x3e')][_0x2203('0x45')]({'where':{'id':_0x56e881['params']['id']}})[_0x2203('0x25')](handleEntityNotFound(_0xfddc3b,null))['then'](removeEntity(_0xfddc3b,null))['catch'](handleError(_0xfddc3b,null));};exports[_0x2203('0x4f')]=function(_0x5be4b6,_0x54ec71){return db['SmsQueue'][_0x2203('0x4f')]()[_0x2203('0x25')](respondWithResult(_0x54ec71,null))[_0x2203('0x40')](handleError(_0x54ec71,null));};exports[_0x2203('0x50')]=function(_0x26d3d9,_0x32f593,_0x2baea2){var _0x91f70c={'raw':!![],'where':{}},_0x36b5fb={},_0x216641;return db[_0x2203('0x3e')][_0x2203('0x51')]({'where':{'id':_0x26d3d9['params']['id']}})['then'](handleEntityNotFound(_0x32f593,null))[_0x2203('0x25')](function(_0x43d8c0){if(_0x43d8c0){_0x216641=_0x43d8c0[_0x2203('0x26')]({'plain':!![]});_0x36b5fb[_0x2203('0x2d')]=_[_0x2203('0x43')](db[_0x2203('0x52')]['rawAttributes']);_0x36b5fb['query']=_[_0x2203('0x43')](_0x26d3d9[_0x2203('0x2e')]);_0x36b5fb[_0x2203('0x2f')]=_[_0x2203('0x31')](_0x36b5fb[_0x2203('0x2d')],_0x36b5fb[_0x2203('0x2e')]);_0x91f70c[_0x2203('0x30')]=_[_0x2203('0x31')](_0x36b5fb[_0x2203('0x2d')],qs[_0x2203('0x32')](_0x26d3d9[_0x2203('0x2e')]['fields']));_0x91f70c[_0x2203('0x30')]=_0x91f70c[_0x2203('0x30')][_0x2203('0x33')]?_0x91f70c[_0x2203('0x30')]:_0x36b5fb[_0x2203('0x2d')];if(!_0x26d3d9[_0x2203('0x2e')][_0x2203('0x34')](_0x2203('0x53'))){_0x91f70c[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x26d3d9[_0x2203('0x2e')][_0x2203('0x1f')]);_0x91f70c[_0x2203('0x1e')]=qs[_0x2203('0x1e')](_0x26d3d9[_0x2203('0x2e')][_0x2203('0x1e')]);}_0x91f70c[_0x2203('0x54')]=qs[_0x2203('0x35')](_0x26d3d9[_0x2203('0x2e')][_0x2203('0x35')]);_0x91f70c['where']=qs[_0x2203('0x2f')](_[_0x2203('0x37')](_0x26d3d9[_0x2203('0x2e')],_0x36b5fb['filters']));_0x91f70c[_0x2203('0x36')][_0x2203('0x55')]=_0x43d8c0['id'];if(_0x26d3d9[_0x2203('0x2e')][_0x2203('0x3b')]){_0x91f70c[_0x2203('0x36')]=_['merge'](_0x91f70c[_0x2203('0x36')],{'$or':_[_0x2203('0x2b')](_0x91f70c[_0x2203('0x30')],function(_0x4dde80){var _0x5507b6={};_0x5507b6[_0x4dde80]={'$like':'%'+_0x26d3d9['query']['filter']+'%'};return _0x5507b6;})});}_0x91f70c=_['merge']({},_0x91f70c,_0x26d3d9[_0x2203('0x56')]);return db[_0x2203('0x52')][_0x2203('0x3f')](_0x91f70c);}})[_0x2203('0x25')](function(_0x4287f4){if(_0x4287f4){return db[_0x2203('0x57')][_0x2203('0x58')]({'where':{'id':_[_0x2203('0x2b')](_0x4287f4,'UserId'),'role':'agent'},'attributes':['id',_0x2203('0x29'),_0x2203('0x59'),_0x2203('0x5a'),_0x2203('0x5b')]});}})[_0x2203('0x25')](function(_0x32a348){if(_0x32a348){return{'count':_0x32a348[_0x2203('0x1d')],'rows':_[_0x2203('0x2b')](_0x32a348[_0x2203('0x5c')],function(_0x231bf1){return{'membername':_0x231bf1[_0x2203('0x29')],'UserId':_0x231bf1['id'],'queue_name':_0x216641[_0x2203('0x29')],'SmsQueueId':_0x216641['id'],'interface':util[_0x2203('0x5d')](_0x2203('0x5e'),_0x2203('0x5f'),_0x231bf1[_0x2203('0x29')]),'penalty':0x0,'paused':_0x231bf1[_0x2203('0x59')],'createdAt':_0x231bf1[_0x2203('0x5b')],'updatedAt':_0x231bf1[_0x2203('0x5a')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x32f593,_0x91f70c))[_0x2203('0x40')](handleError(_0x32f593,null));};exports['getTeams']=function(_0x3382b7,_0x55ecbb,_0x5ba500){var _0xf71e7e={};var _0x269649={};var _0x2f3522;var _0x29c37d;return db[_0x2203('0x3e')][_0x2203('0x51')]({'where':{'id':_0x3382b7[_0x2203('0x42')]['id']}})['then'](handleEntityNotFound(_0x55ecbb,null))['then'](function(_0x38903b){if(_0x38903b){_0x2f3522=_0x38903b;_0x269649[_0x2203('0x2d')]=_[_0x2203('0x43')](db['Team']['rawAttributes']);_0x269649['query']=_[_0x2203('0x43')](_0x3382b7[_0x2203('0x2e')]);_0x269649[_0x2203('0x2f')]=_[_0x2203('0x31')](_0x269649['model'],_0x269649[_0x2203('0x2e')]);_0xf71e7e['attributes']=_[_0x2203('0x31')](_0x269649[_0x2203('0x2d')],qs[_0x2203('0x32')](_0x3382b7[_0x2203('0x2e')][_0x2203('0x32')]));_0xf71e7e['attributes']=_0xf71e7e[_0x2203('0x30')][_0x2203('0x33')]?_0xf71e7e[_0x2203('0x30')]:_0x269649['model'];_0xf71e7e[_0x2203('0x54')]=qs[_0x2203('0x35')](_0x3382b7[_0x2203('0x2e')][_0x2203('0x35')]);_0xf71e7e[_0x2203('0x36')]=qs[_0x2203('0x2f')](_[_0x2203('0x37')](_0x3382b7[_0x2203('0x2e')],_0x269649[_0x2203('0x2f')]));if(_0x3382b7[_0x2203('0x2e')][_0x2203('0x3b')]){_0xf71e7e['where']=_[_0x2203('0x38')](_0xf71e7e[_0x2203('0x36')],{'$or':_[_0x2203('0x2b')](_0xf71e7e[_0x2203('0x30')],function(_0x29670d){var _0x52c35e={};_0x52c35e[_0x29670d]={'$like':'%'+_0x3382b7[_0x2203('0x2e')][_0x2203('0x3b')]+'%'};return _0x52c35e;})});}_0xf71e7e=_[_0x2203('0x38')]({},_0xf71e7e,_0x3382b7[_0x2203('0x56')]);return _0x2f3522[_0x2203('0x60')](_0xf71e7e);}})[_0x2203('0x25')](function(_0x4c332f){if(_0x4c332f){_0x29c37d=_0x4c332f['length'];if(!_0x3382b7[_0x2203('0x2e')][_0x2203('0x34')](_0x2203('0x53'))){_0xf71e7e[_0x2203('0x1f')]=qs[_0x2203('0x1f')](_0x3382b7['query'][_0x2203('0x1f')]);_0xf71e7e[_0x2203('0x1e')]=qs['offset'](_0x3382b7['query']['offset']);}return _0x2f3522['getTeams'](_0xf71e7e);}})['then'](function(_0x2952fc){if(_0x2952fc){return _0x2952fc?{'count':_0x29c37d,'rows':_0x2952fc}:null;}})[_0x2203('0x25')](respondWithResult(_0x55ecbb,null))[_0x2203('0x40')](handleError(_0x55ecbb,null));};exports['addTeams']=function(_0x48a5d6,_0x4ae3ba,_0x1e1969){var _0x1e90c4=_0x48a5d6[_0x2203('0x47')][_0x2203('0x61')];return db[_0x2203('0x62')][_0x2203('0x3f')]({'where':{'id':_0x1e90c4},'attributes':['id'],'include':[{'model':db[_0x2203('0x57')],'as':'Agents','attributes':['id',_0x2203('0x29'),_0x2203('0x63'),_0x2203('0x64'),_0x2203('0x65')],'raw':!![]}]})[_0x2203('0x25')](function(_0x35d508){if(_0x35d508){var _0x13e11f=_['flatMap'](_0x35d508,function(_0x188722){var _0x51a2fe=_0x188722['get']({'plain':!![]});return _0x51a2fe[_0x2203('0x66')];});return db['SmsQueue'][_0x2203('0x45')]({'where':{'id':_0x48a5d6[_0x2203('0x42')]['id']}})['then'](function(_0x29d545){return db[_0x2203('0x67')][_0x2203('0x68')](function(_0x461f90){return _0x29d545[_0x2203('0x69')](_0x1e90c4,{'transaction':_0x461f90})[_0x2203('0x25')](function(){return BPromise['each'](_0x13e11f,function(_0x215638){return db[_0x2203('0x52')]['findOrCreate']({'where':{'UserId':_0x215638['id'],'SmsQueueId':_0x48a5d6['params']['id']},'transaction':_0x461f90});});})[_0x2203('0x25')](function(){_0x13e11f[_0x2203('0x6a')](function(_0x383d3e){socket[_0x2203('0x6b')](_0x2203('0x6c'),{'UserId':_0x383d3e['id'],'SmsQueueId':_0x29d545['id']});});});});});}})[_0x2203('0x25')](respondWithStatusCode(_0x4ae3ba,null))[_0x2203('0x40')](handleError(_0x4ae3ba,null));};exports[_0x2203('0x6d')]=function(_0x4749df,_0x2bfa45,_0x74d185){return db[_0x2203('0x62')][_0x2203('0x3f')]({'where':{'id':_0x4749df[_0x2203('0x2e')][_0x2203('0x61')]},'attributes':['id'],'include':[{'model':db[_0x2203('0x57')],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2bfa45,null))[_0x2203('0x25')](function(_0x1295a3){var _0x496637=_[_0x2203('0x2b')](_0x1295a3,'id');var _0x447a95=[];var _0x5b5e95=[];var _0x54014d=squel[_0x2203('0x6e')]();_0x54014d['field'](_0x2203('0x6f'))[_0x2203('0x70')]('team_has_sms_queues','tq')[_0x2203('0x71')](_0x2203('0x72'),'ut',_0x2203('0x73'))[_0x2203('0x36')]('SmsQueueId\x20=\x20?',_0x4749df['params']['id']);for(var _0x2df837=0x0;_0x2df837<_0x1295a3[_0x2203('0x33')];_0x2df837+=0x1){let _0x288980=_0x1295a3[_0x2df837];for(var _0x4ff77f=0x0;_0x4ff77f<_0x288980['Agents'][_0x2203('0x33')];_0x4ff77f+=0x1){let _0x199bec=_0x288980[_0x2203('0x66')][_0x4ff77f];var _0x586273=_0x54014d['clone']();_0x586273[_0x2203('0x36')](_0x2203('0x74'),_0x199bec['id']);_0x5b5e95['push'](db[_0x2203('0x67')][_0x2203('0x2e')](_0x586273['toString'](),{'type':db[_0x2203('0x67')]['QueryTypes'][_0x2203('0x75')]})['then'](function(_0x48f529){if(_0x48f529['length']===0x1){return _0x199bec['id'];}else{var _0x8efc68=_[_0x2203('0x76')](_['map'](_0x48f529,_0x2203('0x77')),function(_0x2d92b1){return _[_0x2203('0x78')](_0x496637,_0x2d92b1);});if(_0x8efc68){return _0x199bec['id'];}}}));}}return BPromise['all'](_0x5b5e95)[_0x2203('0x25')](function(_0x4deb18){_0x447a95=_(_0x447a95)[_0x2203('0x79')](_0x4deb18)[_0x2203('0x7a')]()['value']();return db[_0x2203('0x3e')][_0x2203('0x45')]({'where':{'id':_0x4749df['params']['id']}})[_0x2203('0x25')](function(_0x6e4b4c){return db[_0x2203('0x67')][_0x2203('0x68')](function(_0x34c8aa){return _0x6e4b4c['removeTeams'](_0x4749df[_0x2203('0x2e')][_0x2203('0x61')],{'transaction':_0x34c8aa})[_0x2203('0x25')](function(){if(!_[_0x2203('0x7b')](_0x447a95)){return _0x6e4b4c[_0x2203('0x7c')](_0x447a95,{'transaction':_0x34c8aa});}})[_0x2203('0x25')](function(){_0x447a95['forEach'](function(_0x29b41b){socket[_0x2203('0x6b')]('userSmsQueue:remove',{'UserId':_0x29b41b,'SmsQueueId':_0x6e4b4c['id']});});});});});});})[_0x2203('0x25')](respondWithStatusCode(_0x2bfa45,null))['catch'](handleError(_0x2bfa45,null));};exports[_0x2203('0x7d')]=function(_0x41eaa5,_0xc611e8,_0x59ff03){return db[_0x2203('0x3e')][_0x2203('0x45')]({'where':{'id':_0x41eaa5[_0x2203('0x42')]['id']}})[_0x2203('0x25')](handleEntityNotFound(_0xc611e8,null))[_0x2203('0x25')](function(_0x2cd816){if(_0x2cd816){return _0x2cd816[_0x2203('0x7d')](_0x41eaa5['body']['ids'],_[_0x2203('0x7e')](_0x41eaa5[_0x2203('0x47')],[_0x2203('0x61'),'id'])||{})[_0x2203('0x7f')](function(_0x2188d4){for(var _0xd81faa=0x0;_0xd81faa<_0x41eaa5[_0x2203('0x47')]['ids'][_0x2203('0x33')];_0xd81faa+=0x1){socket[_0x2203('0x6b')]('userSmsQueue:save',{'UserId':_0x41eaa5[_0x2203('0x47')]['ids'][_0xd81faa],'SmsQueueId':_0x41eaa5[_0x2203('0x42')]['id']});}return _0x2188d4;});}})[_0x2203('0x25')](respondWithResult(_0xc611e8,null))['catch'](handleError(_0xc611e8,null));};exports[_0x2203('0x7c')]=function(_0x9586e1,_0x266d7e,_0x9d0f9b){return db[_0x2203('0x3e')][_0x2203('0x45')]({'where':{'id':_0x9586e1[_0x2203('0x42')]['id']}})[_0x2203('0x25')](handleEntityNotFound(_0x266d7e,null))[_0x2203('0x25')](function(_0x2ad96e){if(_0x2ad96e){return _0x2ad96e[_0x2203('0x7c')](_0x9586e1[_0x2203('0x2e')]['ids'])[_0x2203('0x25')](function(){if(_['isArray'](_0x9586e1[_0x2203('0x2e')][_0x2203('0x61')])){for(var _0x3ef34d=0x0;_0x3ef34d<_0x9586e1[_0x2203('0x2e')][_0x2203('0x61')][_0x2203('0x33')];_0x3ef34d+=0x1){socket[_0x2203('0x6b')](_0x2203('0x80'),{'UserId':Number(_0x9586e1[_0x2203('0x2e')][_0x2203('0x61')][_0x3ef34d]),'SmsQueueId':Number(_0x9586e1[_0x2203('0x42')]['id'])});}}else{socket['emit'](_0x2203('0x80'),{'UserId':Number(_0x9586e1['query'][_0x2203('0x61')]),'SmsQueueId':Number(_0x9586e1[_0x2203('0x42')]['id'])});}});}})[_0x2203('0x25')](respondWithStatusCode(_0x266d7e,null))['catch'](handleError(_0x266d7e,null));};exports[_0x2203('0x81')]=function(_0x40a5ad,_0x1add92,_0x3b6426){var _0x4316ae={};var _0x5c1138={};var _0x389f7f;var _0x4914e8;return db[_0x2203('0x3e')][_0x2203('0x51')]({'where':{'id':_0x40a5ad['params']['id']}})[_0x2203('0x25')](handleEntityNotFound(_0x1add92,null))[_0x2203('0x25')](function(_0x138980){if(_0x138980){_0x389f7f=_0x138980;_0x5c1138[_0x2203('0x2d')]=_['keys'](db[_0x2203('0x57')]['rawAttributes']);_0x5c1138['query']=_[_0x2203('0x43')](_0x40a5ad[_0x2203('0x2e')]);_0x5c1138[_0x2203('0x2f')]=_[_0x2203('0x31')](_0x5c1138[_0x2203('0x2d')],_0x5c1138[_0x2203('0x2e')]);_0x4316ae[_0x2203('0x30')]=_['intersection'](_0x5c1138[_0x2203('0x2d')],qs[_0x2203('0x32')](_0x40a5ad[_0x2203('0x2e')]['fields']));_0x4316ae['attributes']=_0x4316ae['attributes'][_0x2203('0x33')]?_0x4316ae[_0x2203('0x30')]:_0x5c1138[_0x2203('0x2d')];_0x4316ae[_0x2203('0x54')]=qs['sort'](_0x40a5ad[_0x2203('0x2e')][_0x2203('0x35')]);_0x4316ae[_0x2203('0x36')]=qs[_0x2203('0x2f')](_['pick'](_0x40a5ad['query'],_0x5c1138[_0x2203('0x2f')]));if(_0x40a5ad[_0x2203('0x2e')][_0x2203('0x3b')]){_0x4316ae['where']=_[_0x2203('0x38')](_0x4316ae[_0x2203('0x36')],{'$or':_[_0x2203('0x2b')](_0x4316ae[_0x2203('0x30')],function(_0x263130){var _0x86d79a={};_0x86d79a[_0x263130]={'$like':'%'+_0x40a5ad[_0x2203('0x2e')]['filter']+'%'};return _0x86d79a;})});}_0x4316ae=_[_0x2203('0x38')]({},_0x4316ae,_0x40a5ad[_0x2203('0x56')]);return _0x389f7f[_0x2203('0x81')](_0x4316ae);}})[_0x2203('0x25')](function(_0x268aca){if(_0x268aca){_0x4914e8=_0x268aca[_0x2203('0x33')];if(!_0x40a5ad[_0x2203('0x2e')][_0x2203('0x34')](_0x2203('0x53'))){_0x4316ae['limit']=qs[_0x2203('0x1f')](_0x40a5ad[_0x2203('0x2e')][_0x2203('0x1f')]);_0x4316ae[_0x2203('0x1e')]=qs['offset'](_0x40a5ad[_0x2203('0x2e')][_0x2203('0x1e')]);}return _0x389f7f[_0x2203('0x81')](_0x4316ae);}})[_0x2203('0x25')](function(_0x35ded1){if(_0x35ded1){return _0x35ded1?{'count':_0x4914e8,'rows':_0x35ded1}:null;}})[_0x2203('0x25')](respondWithResult(_0x1add92,null))[_0x2203('0x40')](handleError(_0x1add92,null));}; \ No newline at end of file +var _0x66fa=['omit','spread','getAgents','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./smsQueue.socket','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','error','stack','name','index','map','SmsQueue','rawAttributes','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','include','rows','show','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','SmsQueueId','UserSmsQueue','findAll','User','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','forEach','userSmsQueue:save','removeTeams','select','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','removeAgents','emit','userSmsQueue:remove','addAgents'];(function(_0x4a2183,_0x53e74d){var _0xc7c01d=function(_0x526d67){while(--_0x526d67){_0x4a2183['push'](_0x4a2183['shift']());}};_0xc7c01d(++_0x53e74d);}(_0x66fa,0x117));var _0xa66f=function(_0x4d545c,_0x4feef1){_0x4d545c=_0x4d545c-0x0;var _0x3b0bd7=_0x66fa[_0x4d545c];return _0x3b0bd7;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){var _0x5e9639=_0x209f4d[_0xa66f('0x28')]({'plain':!![]});var _0x598942=_0xa66f('0x29');return db[_0xa66f('0x2a')][_0xa66f('0x27')]({'where':{'type':_0x598942,'resourceId':_0x5e9639['id']}})['then'](function(){return _0x209f4d;});})[_0xa66f('0x26')](function(){_0x337602[_0xa66f('0x1a')](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x238eb2,_0x17c103){return function(_0x236046){if(!_0x236046){_0x238eb2[_0xa66f('0x19')](0x194);}return _0x236046;};}function handleError(_0xea2c89,_0x20ee67){_0x20ee67=_0x20ee67||0x1f4;return function(_0x117d03){logger[_0xa66f('0x2b')](_0x117d03[_0xa66f('0x2c')]);if(_0x117d03[_0xa66f('0x2d')]){delete _0x117d03[_0xa66f('0x2d')];}_0xea2c89['status'](_0x20ee67)['send'](_0x117d03);};}exports[_0xa66f('0x2e')]=function(_0x27ceae,_0x55f309){var _0x44c79a={},_0x2de5f3={},_0x4cd7f2={'count':0x0,'rows':[]};var _0x332e86=_[_0xa66f('0x2f')](db[_0xa66f('0x30')][_0xa66f('0x31')],function(_0x395623){return{'name':_0x395623['fieldName'],'type':_0x395623[_0xa66f('0x32')]['key']};});_0x2de5f3[_0xa66f('0x33')]=_[_0xa66f('0x2f')](_0x332e86,_0xa66f('0x2d'));_0x2de5f3['query']=_[_0xa66f('0x34')](_0x27ceae[_0xa66f('0x35')]);_0x2de5f3['filters']=_[_0xa66f('0x36')](_0x2de5f3[_0xa66f('0x33')],_0x2de5f3[_0xa66f('0x35')]);_0x44c79a[_0xa66f('0x37')]=_[_0xa66f('0x36')](_0x2de5f3[_0xa66f('0x33')],qs[_0xa66f('0x38')](_0x27ceae[_0xa66f('0x35')][_0xa66f('0x38')]));_0x44c79a[_0xa66f('0x37')]=_0x44c79a['attributes'][_0xa66f('0x39')]?_0x44c79a['attributes']:_0x2de5f3[_0xa66f('0x33')];if(!_0x27ceae[_0xa66f('0x35')][_0xa66f('0x3a')](_0xa66f('0x3b'))){_0x44c79a[_0xa66f('0x1f')]=qs[_0xa66f('0x1f')](_0x27ceae[_0xa66f('0x35')][_0xa66f('0x1f')]);_0x44c79a['offset']=qs[_0xa66f('0x1e')](_0x27ceae['query'][_0xa66f('0x1e')]);}_0x44c79a[_0xa66f('0x3c')]=qs[_0xa66f('0x3d')](_0x27ceae['query']['sort']);_0x44c79a[_0xa66f('0x3e')]=qs[_0xa66f('0x3f')](_[_0xa66f('0x40')](_0x27ceae[_0xa66f('0x35')],_0x2de5f3[_0xa66f('0x3f')]));if(_0x27ceae['query']['filter']){_0x44c79a['where']=_[_0xa66f('0x41')](_0x44c79a['where'],{'$or':_['map'](_0x332e86,function(_0x5bf856){if(_0x5bf856[_0xa66f('0x32')]!=='VIRTUAL'){var _0x8965d3={};_0x8965d3[_0x5bf856[_0xa66f('0x2d')]]={'$like':'%'+_0x27ceae[_0xa66f('0x35')][_0xa66f('0x42')]+'%'};return _0x8965d3;}})});}_0x44c79a=_[_0xa66f('0x41')]({},_0x44c79a,_0x27ceae[_0xa66f('0x43')]);var _0x192033={'where':_0x44c79a[_0xa66f('0x3e')]};return db[_0xa66f('0x30')][_0xa66f('0x1d')](_0x192033)[_0xa66f('0x26')](function(_0x93f6ff){_0x4cd7f2[_0xa66f('0x1d')]=_0x93f6ff;if(_0x27ceae[_0xa66f('0x35')]['includeAll']){_0x44c79a[_0xa66f('0x44')]=[{'all':!![]}];}return db[_0xa66f('0x30')]['findAll'](_0x44c79a);})[_0xa66f('0x26')](function(_0x4b6e6b){_0x4cd7f2[_0xa66f('0x45')]=_0x4b6e6b;return _0x4cd7f2;})[_0xa66f('0x26')](respondWithFilteredResult(_0x55f309,_0x44c79a))['catch'](handleError(_0x55f309,null));};exports[_0xa66f('0x46')]=function(_0xa42041,_0x2126e8){var _0x5276ea={'raw':!![],'where':{'id':_0xa42041['params']['id']}},_0x394b1e={};_0x394b1e[_0xa66f('0x33')]=_[_0xa66f('0x34')](db[_0xa66f('0x30')][_0xa66f('0x31')]);_0x394b1e[_0xa66f('0x35')]=_[_0xa66f('0x34')](_0xa42041[_0xa66f('0x35')]);_0x394b1e['filters']=_[_0xa66f('0x36')](_0x394b1e[_0xa66f('0x33')],_0x394b1e[_0xa66f('0x35')]);_0x5276ea[_0xa66f('0x37')]=_[_0xa66f('0x36')](_0x394b1e['model'],qs['fields'](_0xa42041[_0xa66f('0x35')][_0xa66f('0x38')]));_0x5276ea[_0xa66f('0x37')]=_0x5276ea[_0xa66f('0x37')][_0xa66f('0x39')]?_0x5276ea[_0xa66f('0x37')]:_0x394b1e['model'];if(_0xa42041[_0xa66f('0x35')][_0xa66f('0x47')]){_0x5276ea[_0xa66f('0x44')]=[{'all':!![]}];}_0x5276ea=_['merge']({},_0x5276ea,_0xa42041['options']);return db[_0xa66f('0x30')][_0xa66f('0x48')](_0x5276ea)[_0xa66f('0x26')](handleEntityNotFound(_0x2126e8,null))['then'](respondWithResult(_0x2126e8,null))['catch'](handleError(_0x2126e8,null));};exports['create']=function(_0x19e7ce,_0x35e477){return db[_0xa66f('0x30')][_0xa66f('0x49')](_0x19e7ce[_0xa66f('0x4a')],{})[_0xa66f('0x26')](function(_0x164242){var _0x15de06=_0x19e7ce['user'][_0xa66f('0x28')]({'plain':!![]});if(!_0x15de06)throw new Error(_0xa66f('0x4b'));if(_0x15de06[_0xa66f('0x4c')]===_0xa66f('0x4d')){var _0x11597b=_0x164242[_0xa66f('0x28')]({'plain':!![]});var _0x56379e=_0xa66f('0x29');return db[_0xa66f('0x4e')][_0xa66f('0x48')]({'where':{'name':_0x56379e,'userProfileId':_0x15de06[_0xa66f('0x4f')]},'raw':!![]})[_0xa66f('0x26')](function(_0x5d77d1){if(_0x5d77d1&&_0x5d77d1[_0xa66f('0x50')]===0x0){return db['UserProfileResource'][_0xa66f('0x49')]({'name':_0x11597b['name'],'resourceId':_0x11597b['id'],'type':_0x5d77d1['name'],'sectionId':_0x5d77d1['id']},{})[_0xa66f('0x26')](function(){return _0x164242;});}else{return _0x164242;}})[_0xa66f('0x51')](function(_0x12271d){logger[_0xa66f('0x2b')](_0xa66f('0x52'),_0x12271d);throw _0x12271d;});}return _0x164242;})[_0xa66f('0x26')](respondWithResult(_0x35e477,0xc9))['catch'](handleError(_0x35e477,null));};exports[_0xa66f('0x25')]=function(_0x13822b,_0x1da406){if(_0x13822b[_0xa66f('0x4a')]['id']){delete _0x13822b['body']['id'];}return db[_0xa66f('0x30')]['find']({'where':{'id':_0x13822b[_0xa66f('0x53')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x1da406,null))[_0xa66f('0x26')](saveUpdates(_0x13822b[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x1da406,null))[_0xa66f('0x51')](handleError(_0x1da406,null));};exports[_0xa66f('0x27')]=function(_0x56b860,_0x2ab3c8){return db[_0xa66f('0x30')][_0xa66f('0x48')]({'where':{'id':_0x56b860[_0xa66f('0x53')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x2ab3c8,null))[_0xa66f('0x26')](removeEntity(_0x2ab3c8,null))[_0xa66f('0x51')](handleError(_0x2ab3c8,null));};exports[_0xa66f('0x54')]=function(_0x350fce,_0x4dfede){return db['SmsQueue'][_0xa66f('0x54')]()[_0xa66f('0x26')](respondWithResult(_0x4dfede,null))[_0xa66f('0x51')](handleError(_0x4dfede,null));};exports[_0xa66f('0x55')]=function(_0x2f1f1e,_0x1fd3f0,_0x8bea2b){var _0x4b10cf={'raw':!![],'where':{}},_0x1709eb={},_0x11c89e;return db[_0xa66f('0x30')][_0xa66f('0x56')]({'where':{'id':_0x2f1f1e['params']['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x1fd3f0,null))[_0xa66f('0x26')](function(_0x19ff30){if(_0x19ff30){_0x11c89e=_0x19ff30[_0xa66f('0x28')]({'plain':!![]});_0x1709eb[_0xa66f('0x33')]=_[_0xa66f('0x34')](db['UserSmsQueue']['rawAttributes']);_0x1709eb[_0xa66f('0x35')]=_[_0xa66f('0x34')](_0x2f1f1e[_0xa66f('0x35')]);_0x1709eb['filters']=_[_0xa66f('0x36')](_0x1709eb[_0xa66f('0x33')],_0x1709eb[_0xa66f('0x35')]);_0x4b10cf[_0xa66f('0x37')]=_[_0xa66f('0x36')](_0x1709eb[_0xa66f('0x33')],qs[_0xa66f('0x38')](_0x2f1f1e[_0xa66f('0x35')][_0xa66f('0x38')]));_0x4b10cf['attributes']=_0x4b10cf[_0xa66f('0x37')][_0xa66f('0x39')]?_0x4b10cf[_0xa66f('0x37')]:_0x1709eb[_0xa66f('0x33')];if(!_0x2f1f1e[_0xa66f('0x35')][_0xa66f('0x3a')](_0xa66f('0x3b'))){_0x4b10cf[_0xa66f('0x1f')]=qs['limit'](_0x2f1f1e['query'][_0xa66f('0x1f')]);_0x4b10cf[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x2f1f1e[_0xa66f('0x35')][_0xa66f('0x1e')]);}_0x4b10cf['order']=qs[_0xa66f('0x3d')](_0x2f1f1e['query'][_0xa66f('0x3d')]);_0x4b10cf[_0xa66f('0x3e')]=qs[_0xa66f('0x3f')](_[_0xa66f('0x40')](_0x2f1f1e['query'],_0x1709eb[_0xa66f('0x3f')]));_0x4b10cf[_0xa66f('0x3e')][_0xa66f('0x57')]=_0x19ff30['id'];if(_0x2f1f1e[_0xa66f('0x35')][_0xa66f('0x42')]){_0x4b10cf[_0xa66f('0x3e')]=_[_0xa66f('0x41')](_0x4b10cf[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x2f')](_0x4b10cf[_0xa66f('0x37')],function(_0x290323){var _0x3eb1f5={};_0x3eb1f5[_0x290323]={'$like':'%'+_0x2f1f1e['query'][_0xa66f('0x42')]+'%'};return _0x3eb1f5;})});}_0x4b10cf=_[_0xa66f('0x41')]({},_0x4b10cf,_0x2f1f1e[_0xa66f('0x43')]);return db[_0xa66f('0x58')][_0xa66f('0x59')](_0x4b10cf);}})[_0xa66f('0x26')](function(_0x324780){if(_0x324780){return db[_0xa66f('0x5a')]['findAndCountAll']({'where':{'id':_[_0xa66f('0x2f')](_0x324780,_0xa66f('0x5b')),'role':_0xa66f('0x5c')},'attributes':['id',_0xa66f('0x2d'),_0xa66f('0x5d'),_0xa66f('0x5e'),_0xa66f('0x5f')]});}})[_0xa66f('0x26')](function(_0x4b5785){if(_0x4b5785){return{'count':_0x4b5785['count'],'rows':_[_0xa66f('0x2f')](_0x4b5785[_0xa66f('0x45')],function(_0x34a590){return{'membername':_0x34a590['name'],'UserId':_0x34a590['id'],'queue_name':_0x11c89e['name'],'SmsQueueId':_0x11c89e['id'],'interface':util[_0xa66f('0x60')](_0xa66f('0x61'),_0xa66f('0x62'),_0x34a590[_0xa66f('0x2d')]),'penalty':0x0,'paused':_0x34a590['smsPause'],'createdAt':_0x34a590[_0xa66f('0x5f')],'updatedAt':_0x34a590[_0xa66f('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa66f('0x26')](respondWithFilteredResult(_0x1fd3f0,_0x4b10cf))[_0xa66f('0x51')](handleError(_0x1fd3f0,null));};exports[_0xa66f('0x63')]=function(_0x306129,_0x218128,_0x1396ae){var _0x534820={};var _0x231106={};var _0xbf4084;var _0x5c6c40;return db['SmsQueue'][_0xa66f('0x56')]({'where':{'id':_0x306129[_0xa66f('0x53')]['id']}})['then'](handleEntityNotFound(_0x218128,null))[_0xa66f('0x26')](function(_0x5ef2a3){if(_0x5ef2a3){_0xbf4084=_0x5ef2a3;_0x231106[_0xa66f('0x33')]=_['keys'](db['Team']['rawAttributes']);_0x231106[_0xa66f('0x35')]=_[_0xa66f('0x34')](_0x306129[_0xa66f('0x35')]);_0x231106[_0xa66f('0x3f')]=_[_0xa66f('0x36')](_0x231106[_0xa66f('0x33')],_0x231106[_0xa66f('0x35')]);_0x534820[_0xa66f('0x37')]=_[_0xa66f('0x36')](_0x231106[_0xa66f('0x33')],qs[_0xa66f('0x38')](_0x306129[_0xa66f('0x35')][_0xa66f('0x38')]));_0x534820[_0xa66f('0x37')]=_0x534820[_0xa66f('0x37')][_0xa66f('0x39')]?_0x534820['attributes']:_0x231106[_0xa66f('0x33')];_0x534820['order']=qs[_0xa66f('0x3d')](_0x306129['query'][_0xa66f('0x3d')]);_0x534820[_0xa66f('0x3e')]=qs[_0xa66f('0x3f')](_['pick'](_0x306129['query'],_0x231106[_0xa66f('0x3f')]));if(_0x306129[_0xa66f('0x35')][_0xa66f('0x42')]){_0x534820[_0xa66f('0x3e')]=_[_0xa66f('0x41')](_0x534820[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x2f')](_0x534820['attributes'],function(_0x4013b9){var _0x85de12={};_0x85de12[_0x4013b9]={'$like':'%'+_0x306129[_0xa66f('0x35')][_0xa66f('0x42')]+'%'};return _0x85de12;})});}_0x534820=_[_0xa66f('0x41')]({},_0x534820,_0x306129[_0xa66f('0x43')]);return _0xbf4084[_0xa66f('0x63')](_0x534820);}})[_0xa66f('0x26')](function(_0x15bff2){if(_0x15bff2){_0x5c6c40=_0x15bff2[_0xa66f('0x39')];if(!_0x306129[_0xa66f('0x35')][_0xa66f('0x3a')](_0xa66f('0x3b'))){_0x534820['limit']=qs[_0xa66f('0x1f')](_0x306129[_0xa66f('0x35')][_0xa66f('0x1f')]);_0x534820[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x306129[_0xa66f('0x35')][_0xa66f('0x1e')]);}return _0xbf4084[_0xa66f('0x63')](_0x534820);}})[_0xa66f('0x26')](function(_0x4bb74f){if(_0x4bb74f){return _0x4bb74f?{'count':_0x5c6c40,'rows':_0x4bb74f}:null;}})[_0xa66f('0x26')](respondWithResult(_0x218128,null))['catch'](handleError(_0x218128,null));};exports[_0xa66f('0x64')]=function(_0x5e19c5,_0x25d203,_0x5dbe8a){var _0x298bd8=_0x5e19c5['body'][_0xa66f('0x65')];return db[_0xa66f('0x66')][_0xa66f('0x59')]({'where':{'id':_0x298bd8},'attributes':['id'],'include':[{'model':db[_0xa66f('0x5a')],'as':_0xa66f('0x67'),'attributes':['id',_0xa66f('0x2d'),'online',_0xa66f('0x68'),_0xa66f('0x69')],'raw':!![]}]})[_0xa66f('0x26')](function(_0x49419c){if(_0x49419c){var _0x458275=_[_0xa66f('0x6a')](_0x49419c,function(_0x4e5f0d){var _0x1e8510=_0x4e5f0d[_0xa66f('0x28')]({'plain':!![]});return _0x1e8510['Agents'];});return db['SmsQueue'][_0xa66f('0x48')]({'where':{'id':_0x5e19c5[_0xa66f('0x53')]['id']}})[_0xa66f('0x26')](function(_0x2929fe){return db[_0xa66f('0x6b')]['transaction'](function(_0x3aaf96){return _0x2929fe[_0xa66f('0x64')](_0x298bd8,{'transaction':_0x3aaf96})['then'](function(){return BPromise[_0xa66f('0x6c')](_0x458275,function(_0x173409){return db['UserSmsQueue'][_0xa66f('0x6d')]({'where':{'UserId':_0x173409['id'],'SmsQueueId':_0x5e19c5[_0xa66f('0x53')]['id']},'transaction':_0x3aaf96});});})[_0xa66f('0x26')](function(){_0x458275[_0xa66f('0x6e')](function(_0x1f28e8){socket['emit'](_0xa66f('0x6f'),{'UserId':_0x1f28e8['id'],'SmsQueueId':_0x2929fe['id']});});});});});}})[_0xa66f('0x26')](respondWithStatusCode(_0x25d203,null))[_0xa66f('0x51')](handleError(_0x25d203,null));};exports[_0xa66f('0x70')]=function(_0x40fb75,_0x3224a5,_0x4e318d){return db[_0xa66f('0x66')][_0xa66f('0x59')]({'where':{'id':_0x40fb75[_0xa66f('0x35')][_0xa66f('0x65')]},'attributes':['id'],'include':[{'model':db[_0xa66f('0x5a')],'as':_0xa66f('0x67'),'attributes':['id'],'raw':!![]}]})[_0xa66f('0x26')](handleEntityNotFound(_0x3224a5,null))['then'](function(_0x5ec355){var _0x50192d=_['map'](_0x5ec355,'id');var _0x26cc07=[];var _0x148a8d=[];var _0x5a957c=squel[_0xa66f('0x71')]();_0x5a957c[_0xa66f('0x72')](_0xa66f('0x73'))['from']('team_has_sms_queues','tq')[_0xa66f('0x74')]('user_has_teams','ut',_0xa66f('0x75'))[_0xa66f('0x3e')](_0xa66f('0x76'),_0x40fb75['params']['id']);for(var _0x283ca2=0x0;_0x283ca2<_0x5ec355['length'];_0x283ca2+=0x1){let _0x3dd1a3=_0x5ec355[_0x283ca2];for(var _0xfdb067=0x0;_0xfdb067<_0x3dd1a3[_0xa66f('0x67')][_0xa66f('0x39')];_0xfdb067+=0x1){let _0x5a1838=_0x3dd1a3[_0xa66f('0x67')][_0xfdb067];var _0x3ac90f=_0x5a957c[_0xa66f('0x77')]();_0x3ac90f[_0xa66f('0x3e')](_0xa66f('0x78'),_0x5a1838['id']);_0x148a8d[_0xa66f('0x79')](db['sequelize'][_0xa66f('0x35')](_0x3ac90f[_0xa66f('0x7a')](),{'type':db[_0xa66f('0x6b')][_0xa66f('0x7b')][_0xa66f('0x7c')]})['then'](function(_0x520dbb){if(_0x520dbb[_0xa66f('0x39')]===0x1){return _0x5a1838['id'];}else{var _0x30468d=_[_0xa66f('0x7d')](_[_0xa66f('0x2f')](_0x520dbb,_0xa66f('0x7e')),function(_0x3285c6){return _[_0xa66f('0x7f')](_0x50192d,_0x3285c6);});if(_0x30468d){return _0x5a1838['id'];}}}));}}return BPromise[_0xa66f('0x80')](_0x148a8d)[_0xa66f('0x26')](function(_0x1704e3){_0x26cc07=_(_0x26cc07)[_0xa66f('0x81')](_0x1704e3)[_0xa66f('0x82')]()['value']();return db[_0xa66f('0x30')][_0xa66f('0x48')]({'where':{'id':_0x40fb75['params']['id']}})[_0xa66f('0x26')](function(_0x5c5445){return db[_0xa66f('0x6b')]['transaction'](function(_0x4fe5e1){return _0x5c5445[_0xa66f('0x70')](_0x40fb75['query'][_0xa66f('0x65')],{'transaction':_0x4fe5e1})[_0xa66f('0x26')](function(){if(!_['isEmpty'](_0x26cc07)){return _0x5c5445[_0xa66f('0x83')](_0x26cc07,{'transaction':_0x4fe5e1});}})[_0xa66f('0x26')](function(){_0x26cc07['forEach'](function(_0xa568ed){socket[_0xa66f('0x84')](_0xa66f('0x85'),{'UserId':_0xa568ed,'SmsQueueId':_0x5c5445['id']});});});});});});})[_0xa66f('0x26')](respondWithStatusCode(_0x3224a5,null))['catch'](handleError(_0x3224a5,null));};exports['addAgents']=function(_0x34daef,_0xdd2d09,_0x41f6a2){return db[_0xa66f('0x30')][_0xa66f('0x48')]({'where':{'id':_0x34daef[_0xa66f('0x53')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0xdd2d09,null))[_0xa66f('0x26')](function(_0x51f11a){if(_0x51f11a){return _0x51f11a[_0xa66f('0x86')](_0x34daef['body']['ids'],_[_0xa66f('0x87')](_0x34daef[_0xa66f('0x4a')],[_0xa66f('0x65'),'id'])||{})[_0xa66f('0x88')](function(_0x22ea68){for(var _0x59d4a5=0x0;_0x59d4a5<_0x34daef[_0xa66f('0x4a')][_0xa66f('0x65')][_0xa66f('0x39')];_0x59d4a5+=0x1){socket['emit']('userSmsQueue:save',{'UserId':_0x34daef['body'][_0xa66f('0x65')][_0x59d4a5],'SmsQueueId':_0x34daef['params']['id']});}return _0x22ea68;});}})[_0xa66f('0x26')](respondWithResult(_0xdd2d09,null))[_0xa66f('0x51')](handleError(_0xdd2d09,null));};exports[_0xa66f('0x83')]=function(_0x90b7f1,_0x4bf3f6,_0xbf5668){return db[_0xa66f('0x30')]['find']({'where':{'id':_0x90b7f1[_0xa66f('0x53')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x4bf3f6,null))['then'](function(_0x4fa27c){if(_0x4fa27c){return _0x4fa27c[_0xa66f('0x83')](_0x90b7f1[_0xa66f('0x35')][_0xa66f('0x65')])['then'](function(){if(_['isArray'](_0x90b7f1['query']['ids'])){for(var _0xb6b51b=0x0;_0xb6b51b<_0x90b7f1[_0xa66f('0x35')][_0xa66f('0x65')][_0xa66f('0x39')];_0xb6b51b+=0x1){socket[_0xa66f('0x84')](_0xa66f('0x85'),{'UserId':Number(_0x90b7f1['query'][_0xa66f('0x65')][_0xb6b51b]),'SmsQueueId':Number(_0x90b7f1[_0xa66f('0x53')]['id'])});}}else{socket[_0xa66f('0x84')](_0xa66f('0x85'),{'UserId':Number(_0x90b7f1['query']['ids']),'SmsQueueId':Number(_0x90b7f1[_0xa66f('0x53')]['id'])});}});}})[_0xa66f('0x26')](respondWithStatusCode(_0x4bf3f6,null))[_0xa66f('0x51')](handleError(_0x4bf3f6,null));};exports[_0xa66f('0x89')]=function(_0x10e0fd,_0x21a2d7,_0x1f4f4b){var _0xb01698={};var _0x7a57e9={};var _0x179eb7;var _0x5e0b36;return db['SmsQueue'][_0xa66f('0x56')]({'where':{'id':_0x10e0fd['params']['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x21a2d7,null))[_0xa66f('0x26')](function(_0x13f006){if(_0x13f006){_0x179eb7=_0x13f006;_0x7a57e9[_0xa66f('0x33')]=_[_0xa66f('0x34')](db['User']['rawAttributes']);_0x7a57e9['query']=_['keys'](_0x10e0fd[_0xa66f('0x35')]);_0x7a57e9[_0xa66f('0x3f')]=_[_0xa66f('0x36')](_0x7a57e9[_0xa66f('0x33')],_0x7a57e9['query']);_0xb01698[_0xa66f('0x37')]=_[_0xa66f('0x36')](_0x7a57e9['model'],qs[_0xa66f('0x38')](_0x10e0fd[_0xa66f('0x35')]['fields']));_0xb01698[_0xa66f('0x37')]=_0xb01698[_0xa66f('0x37')]['length']?_0xb01698[_0xa66f('0x37')]:_0x7a57e9[_0xa66f('0x33')];_0xb01698[_0xa66f('0x3c')]=qs[_0xa66f('0x3d')](_0x10e0fd[_0xa66f('0x35')][_0xa66f('0x3d')]);_0xb01698[_0xa66f('0x3e')]=qs[_0xa66f('0x3f')](_[_0xa66f('0x40')](_0x10e0fd[_0xa66f('0x35')],_0x7a57e9[_0xa66f('0x3f')]));if(_0x10e0fd['query']['filter']){_0xb01698[_0xa66f('0x3e')]=_[_0xa66f('0x41')](_0xb01698[_0xa66f('0x3e')],{'$or':_['map'](_0xb01698['attributes'],function(_0x2a6992){var _0x1d5f20={};_0x1d5f20[_0x2a6992]={'$like':'%'+_0x10e0fd[_0xa66f('0x35')][_0xa66f('0x42')]+'%'};return _0x1d5f20;})});}_0xb01698=_[_0xa66f('0x41')]({},_0xb01698,_0x10e0fd['options']);return _0x179eb7[_0xa66f('0x89')](_0xb01698);}})[_0xa66f('0x26')](function(_0x287f9e){if(_0x287f9e){_0x5e0b36=_0x287f9e[_0xa66f('0x39')];if(!_0x10e0fd['query'][_0xa66f('0x3a')](_0xa66f('0x3b'))){_0xb01698['limit']=qs[_0xa66f('0x1f')](_0x10e0fd[_0xa66f('0x35')]['limit']);_0xb01698[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x10e0fd[_0xa66f('0x35')][_0xa66f('0x1e')]);}return _0x179eb7[_0xa66f('0x89')](_0xb01698);}})[_0xa66f('0x26')](function(_0x2aca23){if(_0x2aca23){return _0x2aca23?{'count':_0x5e0b36,'rows':_0x2aca23}:null;}})['then'](respondWithResult(_0x21a2d7,null))['catch'](handleError(_0x21a2d7,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2580542..b4821e0 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 _0x66da=['SmsQueue','setMaxListeners','save','update','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x4347ec,_0x41c4b8){var _0x4c8314=function(_0x583acd){while(--_0x583acd){_0x4347ec['push'](_0x4347ec['shift']());}};_0x4c8314(++_0x41c4b8);}(_0x66da,0x1e4));var _0xa66d=function(_0x1098db,_0x39ba6b){_0x1098db=_0x1098db-0x0;var _0x14f090=_0x66da[_0x1098db];return _0x14f090;};'use strict';var EventEmitter=require(_0xa66d('0x0'));var SmsQueue=require(_0xa66d('0x1'))['db'][_0xa66d('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xa66d('0x3')](0x0);var events={'afterCreate':_0xa66d('0x4'),'afterUpdate':_0xa66d('0x5'),'afterDestroy':'remove'};function emitEvent(_0x58ef89){return function(_0x8acda9,_0x36defc,_0x335914){SmsQueueEvents[_0xa66d('0x6')](_0x58ef89+':'+_0x8acda9['id'],_0x8acda9);SmsQueueEvents[_0xa66d('0x6')](_0x58ef89,_0x8acda9);_0x335914(null);};}for(var e in events){if(events[_0xa66d('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0xa66d('0x8')]=SmsQueueEvents; \ No newline at end of file +var _0x5a3c=['remove','emit','hook','exports','../../mysqldb','SmsQueue','setMaxListeners','save','update'];(function(_0x3f811b,_0x49ea3b){var _0x2f8360=function(_0x160d5d){while(--_0x160d5d){_0x3f811b['push'](_0x3f811b['shift']());}};_0x2f8360(++_0x49ea3b);}(_0x5a3c,0x1b4));var _0xc5a3=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x5a3c[_0x2a6809];return _0x11c371;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xc5a3('0x0'))['db'][_0xc5a3('0x1')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xc5a3('0x2')](0x0);var events={'afterCreate':_0xc5a3('0x3'),'afterUpdate':_0xc5a3('0x4'),'afterDestroy':_0xc5a3('0x5')};function emitEvent(_0x21dcf6){return function(_0x120cdd,_0x4004e7,_0x3207b8){SmsQueueEvents[_0xc5a3('0x6')](_0x21dcf6+':'+_0x120cdd['id'],_0x120cdd);SmsQueueEvents[_0xc5a3('0x6')](_0x21dcf6,_0x120cdd);_0x3207b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xc5a3('0x7')](e,emitEvent(event));}}module[_0xc5a3('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 dff94d7..b11cc89 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 _0xeb58=['SmsQueue','sms_queues','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./smsQueue.attributes','exports'];(function(_0x4ad95c,_0x3a6c1b){var _0x1de49c=function(_0x1ba2b0){while(--_0x1ba2b0){_0x4ad95c['push'](_0x4ad95c['shift']());}};_0x1de49c(++_0x3a6c1b);}(_0xeb58,0x1a2));var _0x8eb5=function(_0x31e631,_0x2dadf7){_0x31e631=_0x31e631-0x0;var _0x1e278b=_0xeb58[_0x31e631];return _0x1e278b;};'use strict';var _=require(_0x8eb5('0x0'));var util=require(_0x8eb5('0x1'));var logger=require(_0x8eb5('0x2'))(_0x8eb5('0x3'));var moment=require(_0x8eb5('0x4'));var BPromise=require(_0x8eb5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8eb5('0x6'));var rimraf=require(_0x8eb5('0x7'));var config=require(_0x8eb5('0x8'));var attributes=require(_0x8eb5('0x9'));module[_0x8eb5('0xa')]=function(_0x3643e9,_0x5b15e1){return _0x3643e9['define'](_0x8eb5('0xb'),attributes,{'tableName':_0x8eb5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x061c=['util','api','moment','request-promise','path','rimraf','./smsQueue.attributes','SmsQueue'];(function(_0x1e05c1,_0x3cffa3){var _0x15f1ca=function(_0x3a9594){while(--_0x3a9594){_0x1e05c1['push'](_0x1e05c1['shift']());}};_0x15f1ca(++_0x3cffa3);}(_0x061c,0x1d0));var _0xc061=function(_0x5aca51,_0xe18cb3){_0x5aca51=_0x5aca51-0x0;var _0x208d79=_0x061c[_0x5aca51];return _0x208d79;};'use strict';var _=require('lodash');var util=require(_0xc061('0x0'));var logger=require('../../config/logger')(_0xc061('0x1'));var moment=require(_0xc061('0x2'));var BPromise=require('bluebird');var rp=require(_0xc061('0x3'));var fs=require('fs');var path=require(_0xc061('0x4'));var rimraf=require(_0xc061('0x5'));var config=require('../../config/environment');var attributes=require(_0xc061('0x6'));module['exports']=function(_0x40da6c,_0x49cef7){return _0x40da6c['define'](_0xc061('0x7'),attributes,{'tableName':'sms_queues','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 af4c965..1ceac6f 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 _0x6d55=['./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s','debug','SmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','SmsQueue','findAll','raw','options','where','attributes','limit','map','include','model','GetSmsQueue','ShowSmsQueue','find','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter'];(function(_0x30ef70,_0x48f421){var _0x496cb4=function(_0x331182){while(--_0x331182){_0x30ef70['push'](_0x30ef70['shift']());}};_0x496cb4(++_0x48f421);}(_0x6d55,0x10b));var _0x56d5=function(_0xab8668,_0x5204ac){_0xab8668=_0xab8668-0x0;var _0x571c10=_0x6d55[_0xab8668];return _0x571c10;};'use strict';var _=require('lodash');var util=require(_0x56d5('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x56d5('0x1'));var fs=require('fs');var Redis=require(_0x56d5('0x2'));var db=require(_0x56d5('0x3'))['db'];var utils=require(_0x56d5('0x4'));var logger=require(_0x56d5('0x5'))(_0x56d5('0x6'));var config=require('../../config/environment');var jayson=require(_0x56d5('0x7'));var client=jayson[_0x56d5('0x8')]['http']({'port':0x232a});config['redis']=_[_0x56d5('0x9')](config[_0x56d5('0xa')],{'host':_0x56d5('0xb'),'port':0x18eb});var socket=require(_0x56d5('0xc'))(new Redis(config[_0x56d5('0xa')]));require(_0x56d5('0xd'))[_0x56d5('0xe')](socket);function respondWithRpcPromise(_0x5001f2,_0x4bcda2,_0x13df7a){return new BPromise(function(_0x216708,_0x193ce2){return client[_0x56d5('0xf')](_0x5001f2,_0x13df7a)[_0x56d5('0x10')](function(_0x180d78){logger[_0x56d5('0x11')](_0x56d5('0x12'),_0x4bcda2,'request\x20sent');logger[_0x56d5('0x13')](_0x56d5('0x14'),_0x4bcda2,_0x56d5('0x15'),JSON[_0x56d5('0x16')](_0x180d78));if(_0x180d78[_0x56d5('0x17')]){if(_0x180d78[_0x56d5('0x17')][_0x56d5('0x18')]===0x1f4){logger['error'](_0x56d5('0x12'),_0x4bcda2,_0x180d78[_0x56d5('0x17')][_0x56d5('0x19')]);return _0x193ce2(_0x180d78['error'][_0x56d5('0x19')]);}logger[_0x56d5('0x17')](_0x56d5('0x12'),_0x4bcda2,_0x180d78['error'][_0x56d5('0x19')]);return _0x216708(_0x180d78[_0x56d5('0x17')][_0x56d5('0x19')]);}else{logger[_0x56d5('0x11')](_0x56d5('0x12'),_0x4bcda2,'request\x20sent');_0x216708(_0x180d78['result'][_0x56d5('0x19')]);}})[_0x56d5('0x1a')](function(_0xf579e){logger[_0x56d5('0x17')](_0x56d5('0x12'),_0x4bcda2,_0xf579e);_0x193ce2(_0xf579e);});});}exports['GetSmsQueue']=function(_0x5106fd){var _0x440393=this;return new Promise(function(_0x42b29c,_0x5bfeec){return db[_0x56d5('0x1b')][_0x56d5('0x1c')]({'raw':_0x5106fd['options']?_0x5106fd['options'][_0x56d5('0x1d')]===undefined?!![]:![]:!![],'where':_0x5106fd[_0x56d5('0x1e')]?_0x5106fd[_0x56d5('0x1e')][_0x56d5('0x1f')]||null:null,'attributes':_0x5106fd[_0x56d5('0x1e')]?_0x5106fd[_0x56d5('0x1e')][_0x56d5('0x20')]||null:null,'limit':_0x5106fd[_0x56d5('0x1e')]?_0x5106fd[_0x56d5('0x1e')][_0x56d5('0x21')]||null:null,'include':_0x5106fd[_0x56d5('0x1e')]?_0x5106fd[_0x56d5('0x1e')]['include']?_[_0x56d5('0x22')](_0x5106fd[_0x56d5('0x1e')][_0x56d5('0x23')],function(_0x3cbb5d){return{'model':db[_0x3cbb5d[_0x56d5('0x24')]],'as':_0x3cbb5d['as'],'attributes':_0x3cbb5d[_0x56d5('0x20')],'include':_0x3cbb5d[_0x56d5('0x23')]?_[_0x56d5('0x22')](_0x3cbb5d[_0x56d5('0x23')],function(_0x4a8b89){return{'model':db[_0x4a8b89[_0x56d5('0x24')]],'as':_0x4a8b89['as'],'attributes':_0x4a8b89[_0x56d5('0x20')],'include':_0x4a8b89[_0x56d5('0x23')]?_[_0x56d5('0x22')](_0x4a8b89[_0x56d5('0x23')],function(_0x5c3f66){return{'model':db[_0x5c3f66[_0x56d5('0x24')]],'as':_0x5c3f66['as'],'attributes':_0x5c3f66[_0x56d5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x574f4d){logger[_0x56d5('0x11')](_0x56d5('0x25'),_0x5106fd);logger[_0x56d5('0x13')](_0x56d5('0x25'),_0x5106fd,JSON[_0x56d5('0x16')](_0x574f4d));_0x42b29c(_0x574f4d);})[_0x56d5('0x1a')](function(_0x7eee4){logger[_0x56d5('0x17')](_0x56d5('0x25'),_0x7eee4[_0x56d5('0x19')],_0x5106fd);_0x5bfeec(_0x440393[_0x56d5('0x17')](0x1f4,_0x7eee4[_0x56d5('0x19')]));});});};exports[_0x56d5('0x26')]=function(_0x434c83){var _0x5f00ae=this;return new Promise(function(_0x4f5521,_0x118924){return db[_0x56d5('0x1b')][_0x56d5('0x27')]({'raw':_0x434c83[_0x56d5('0x1e')]?_0x434c83[_0x56d5('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x434c83[_0x56d5('0x1e')]?_0x434c83[_0x56d5('0x1e')][_0x56d5('0x1f')]||null:null,'attributes':_0x434c83['options']?_0x434c83[_0x56d5('0x1e')]['attributes']||null:null,'include':_0x434c83[_0x56d5('0x1e')]?_0x434c83[_0x56d5('0x1e')][_0x56d5('0x23')]?_['map'](_0x434c83[_0x56d5('0x1e')][_0x56d5('0x23')],function(_0x29c064){return{'model':db[_0x29c064['model']],'as':_0x29c064['as'],'attributes':_0x29c064[_0x56d5('0x20')],'include':_0x29c064[_0x56d5('0x23')]?_[_0x56d5('0x22')](_0x29c064[_0x56d5('0x23')],function(_0x349ff5){return{'model':db[_0x349ff5[_0x56d5('0x24')]],'as':_0x349ff5['as'],'attributes':_0x349ff5[_0x56d5('0x20')],'include':_0x349ff5[_0x56d5('0x23')]?_[_0x56d5('0x22')](_0x349ff5[_0x56d5('0x23')],function(_0x447b99){return{'model':db[_0x447b99['model']],'as':_0x447b99['as'],'attributes':_0x447b99[_0x56d5('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4a992b){logger[_0x56d5('0x11')](_0x56d5('0x26'),_0x434c83);logger[_0x56d5('0x13')](_0x56d5('0x26'),_0x434c83,JSON['stringify'](_0x4a992b));_0x4f5521(_0x4a992b);})['catch'](function(_0x38baf3){logger[_0x56d5('0x17')](_0x56d5('0x26'),_0x38baf3['message'],_0x434c83);_0x118924(_0x5f00ae[_0x56d5('0x17')](0x1f4,_0x38baf3[_0x56d5('0x19')]));});});}; \ No newline at end of file +var _0x7214=['findAll','options','where','limit','include','map','model','attributes','GetSmsQueue','debug','ShowSmsQueue','SmsQueue','raw','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x7214,0x146));var _0x4721=function(_0x4c4545,_0x44f6b7){_0x4c4545=_0x4c4545-0x0;var _0x2b5f4c=_0x7214[_0x4c4545];return _0x2b5f4c;};'use strict';var _=require('lodash');var util=require(_0x4721('0x0'));var moment=require(_0x4721('0x1'));var BPromise=require(_0x4721('0x2'));var rs=require(_0x4721('0x3'));var fs=require('fs');var Redis=require(_0x4721('0x4'));var db=require(_0x4721('0x5'))['db'];var utils=require(_0x4721('0x6'));var logger=require(_0x4721('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4721('0x8'));var client=jayson[_0x4721('0x9')][_0x4721('0xa')]({'port':0x232a});config[_0x4721('0xb')]=_[_0x4721('0xc')](config[_0x4721('0xb')],{'host':_0x4721('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4721('0xb')]));require(_0x4721('0xe'))[_0x4721('0xf')](socket);function respondWithRpcPromise(_0x9788be,_0x263e24,_0x488908){return new BPromise(function(_0x2a5dd8,_0x29b38b){return client[_0x4721('0x10')](_0x9788be,_0x488908)['then'](function(_0x3e1a8c){logger[_0x4721('0x11')](_0x4721('0x12'),_0x263e24,_0x4721('0x13'));logger['debug']('SmsQueue,\x20%s,\x20%s,\x20%s',_0x263e24,_0x4721('0x13'),JSON[_0x4721('0x14')](_0x3e1a8c));if(_0x3e1a8c['error']){if(_0x3e1a8c[_0x4721('0x15')][_0x4721('0x16')]===0x1f4){logger['error'](_0x4721('0x12'),_0x263e24,_0x3e1a8c[_0x4721('0x15')][_0x4721('0x17')]);return _0x29b38b(_0x3e1a8c['error'][_0x4721('0x17')]);}logger[_0x4721('0x15')](_0x4721('0x12'),_0x263e24,_0x3e1a8c[_0x4721('0x15')][_0x4721('0x17')]);return _0x2a5dd8(_0x3e1a8c[_0x4721('0x15')][_0x4721('0x17')]);}else{logger['info'](_0x4721('0x12'),_0x263e24,_0x4721('0x13'));_0x2a5dd8(_0x3e1a8c['result']['message']);}})[_0x4721('0x18')](function(_0x2cb771){logger[_0x4721('0x15')](_0x4721('0x12'),_0x263e24,_0x2cb771);_0x29b38b(_0x2cb771);});});}exports['GetSmsQueue']=function(_0x67bb4a){var _0x36e5f7=this;return new Promise(function(_0x30f69d,_0x50ed4e){return db['SmsQueue'][_0x4721('0x19')]({'raw':_0x67bb4a[_0x4721('0x1a')]?_0x67bb4a[_0x4721('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x67bb4a[_0x4721('0x1a')]?_0x67bb4a['options'][_0x4721('0x1b')]||null:null,'attributes':_0x67bb4a['options']?_0x67bb4a[_0x4721('0x1a')]['attributes']||null:null,'limit':_0x67bb4a[_0x4721('0x1a')]?_0x67bb4a[_0x4721('0x1a')][_0x4721('0x1c')]||null:null,'include':_0x67bb4a[_0x4721('0x1a')]?_0x67bb4a[_0x4721('0x1a')][_0x4721('0x1d')]?_[_0x4721('0x1e')](_0x67bb4a['options'][_0x4721('0x1d')],function(_0x12197e){return{'model':db[_0x12197e[_0x4721('0x1f')]],'as':_0x12197e['as'],'attributes':_0x12197e[_0x4721('0x20')],'include':_0x12197e[_0x4721('0x1d')]?_['map'](_0x12197e[_0x4721('0x1d')],function(_0x2d43b8){return{'model':db[_0x2d43b8[_0x4721('0x1f')]],'as':_0x2d43b8['as'],'attributes':_0x2d43b8['attributes'],'include':_0x2d43b8['include']?_['map'](_0x2d43b8[_0x4721('0x1d')],function(_0x22065e){return{'model':db[_0x22065e[_0x4721('0x1f')]],'as':_0x22065e['as'],'attributes':_0x22065e[_0x4721('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe9288c){logger[_0x4721('0x11')](_0x4721('0x21'),_0x67bb4a);logger[_0x4721('0x22')](_0x4721('0x21'),_0x67bb4a,JSON[_0x4721('0x14')](_0xe9288c));_0x30f69d(_0xe9288c);})[_0x4721('0x18')](function(_0x3b35ac){logger[_0x4721('0x15')](_0x4721('0x21'),_0x3b35ac[_0x4721('0x17')],_0x67bb4a);_0x50ed4e(_0x36e5f7['error'](0x1f4,_0x3b35ac[_0x4721('0x17')]));});});};exports[_0x4721('0x23')]=function(_0x32f2c2){var _0x39af7e=this;return new Promise(function(_0x34dbd3,_0x212860){return db[_0x4721('0x24')]['find']({'raw':_0x32f2c2['options']?_0x32f2c2[_0x4721('0x1a')][_0x4721('0x25')]===undefined?!![]:![]:!![],'where':_0x32f2c2[_0x4721('0x1a')]?_0x32f2c2['options']['where']||null:null,'attributes':_0x32f2c2[_0x4721('0x1a')]?_0x32f2c2[_0x4721('0x1a')]['attributes']||null:null,'include':_0x32f2c2[_0x4721('0x1a')]?_0x32f2c2[_0x4721('0x1a')][_0x4721('0x1d')]?_[_0x4721('0x1e')](_0x32f2c2[_0x4721('0x1a')][_0x4721('0x1d')],function(_0x500f59){return{'model':db[_0x500f59[_0x4721('0x1f')]],'as':_0x500f59['as'],'attributes':_0x500f59[_0x4721('0x20')],'include':_0x500f59[_0x4721('0x1d')]?_[_0x4721('0x1e')](_0x500f59[_0x4721('0x1d')],function(_0x29053e){return{'model':db[_0x29053e[_0x4721('0x1f')]],'as':_0x29053e['as'],'attributes':_0x29053e[_0x4721('0x20')],'include':_0x29053e['include']?_[_0x4721('0x1e')](_0x29053e[_0x4721('0x1d')],function(_0x35977c){return{'model':db[_0x35977c['model']],'as':_0x35977c['as'],'attributes':_0x35977c[_0x4721('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4721('0x26')](function(_0x3521ef){logger[_0x4721('0x11')](_0x4721('0x23'),_0x32f2c2);logger[_0x4721('0x22')](_0x4721('0x23'),_0x32f2c2,JSON['stringify'](_0x3521ef));_0x34dbd3(_0x3521ef);})['catch'](function(_0x27df07){logger[_0x4721('0x15')](_0x4721('0x23'),_0x27df07[_0x4721('0x17')],_0x32f2c2);_0x212860(_0x39af7e['error'](0x1f4,_0x27df07[_0x4721('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b15d9ee..25787e1 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 _0x0ba2=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x64411,_0x2dd485){var _0x19c7fe=function(_0x40599a){while(--_0x40599a){_0x64411['push'](_0x64411['shift']());}};_0x19c7fe(++_0x2dd485);}(_0x0ba2,0x170));var _0x20ba=function(_0x3d4864,_0x10ff93){_0x3d4864=_0x3d4864-0x0;var _0x489010=_0x0ba2[_0x3d4864];return _0x489010;};'use strict';var SmsQueueEvents=require(_0x20ba('0x0'));var events=[_0x20ba('0x1'),_0x20ba('0x2'),_0x20ba('0x3')];function createListener(_0x3d76d2,_0xa9fb47){return function(_0x3975f9){_0xa9fb47[_0x20ba('0x4')](_0x3d76d2,_0x3975f9);};}function removeListener(_0x5e1b96,_0x46354f){return function(){SmsQueueEvents[_0x20ba('0x5')](_0x5e1b96,_0x46354f);};}exports[_0x20ba('0x6')]=function(_0xaeed44){for(var _0x31537c=0x0,_0x2981f0=events[_0x20ba('0x7')];_0x31537c<_0x2981f0;_0x31537c++){var _0x25e689=events[_0x31537c];var _0x5da5fc=createListener(_0x20ba('0x8')+_0x25e689,_0xaeed44);SmsQueueEvents['on'](_0x25e689,_0x5da5fc);}}; \ No newline at end of file +var _0xe4aa=['smsQueue:','remove','removeListener','register'];(function(_0x1ad4c6,_0x1c6e4b){var _0x2a81c0=function(_0x2582b7){while(--_0x2582b7){_0x1ad4c6['push'](_0x1ad4c6['shift']());}};_0x2a81c0(++_0x1c6e4b);}(_0xe4aa,0x17d));var _0xae4a=function(_0x14b953,_0x3f6100){_0x14b953=_0x14b953-0x0;var _0x31555d=_0xe4aa[_0x14b953];return _0x31555d;};'use strict';var SmsQueueEvents=require('./smsQueue.events');var events=['save',_0xae4a('0x0'),'update'];function createListener(_0x2cfc27,_0x17e83e){return function(_0x54a5f2){_0x17e83e['emit'](_0x2cfc27,_0x54a5f2);};}function removeListener(_0x205a26,_0x5b1bcf){return function(){SmsQueueEvents[_0xae4a('0x1')](_0x205a26,_0x5b1bcf);};}exports[_0xae4a('0x2')]=function(_0x480c46){for(var _0x404e41=0x0,_0x17c972=events['length'];_0x404e41<_0x17c972;_0x404e41++){var _0x11835c=events[_0x404e41];var _0x39a75a=createListener(_0xae4a('0x3')+_0x11835c,_0x480c46);SmsQueueEvents['on'](_0x11835c,_0x39a75a);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index 9819dda..69b7c6e 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 _0x88ad=['index','/describe','isAuthenticated','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get'];(function(_0x12c5e6,_0x3b9ae0){var _0x387976=function(_0x5e47e3){while(--_0x5e47e3){_0x12c5e6['push'](_0x12c5e6['shift']());}};_0x387976(++_0x3b9ae0);}(_0x88ad,0x1f0));var _0xd88a=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x88ad[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0xd88a('0x0'));var util=require(_0xd88a('0x1'));var path=require(_0xd88a('0x2'));var timeout=require('connect-timeout');var express=require(_0xd88a('0x3'));var router=express[_0xd88a('0x4')]();var auth=require(_0xd88a('0x5'));var interaction=require(_0xd88a('0x6'));var config=require(_0xd88a('0x7'));var controller=require(_0xd88a('0x8'));router[_0xd88a('0x9')]('/',auth['isAuthenticated'](),controller[_0xd88a('0xa')]);router['get'](_0xd88a('0xb'),auth[_0xd88a('0xc')](),controller[_0xd88a('0xd')]);router['get'](_0xd88a('0xe'),auth[_0xd88a('0xc')](),controller[_0xd88a('0xf')]);router[_0xd88a('0x10')]('/',auth[_0xd88a('0xc')](),controller[_0xd88a('0x11')]);router[_0xd88a('0x12')](_0xd88a('0xe'),auth['isAuthenticated'](),controller[_0xd88a('0x13')]);router[_0xd88a('0x14')](_0xd88a('0xe'),auth[_0xd88a('0xc')](),controller[_0xd88a('0x15')]);module[_0xd88a('0x16')]=router; \ No newline at end of file +var _0x85d1=['path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','index','get','/describe','isAuthenticated','describe','/:id','show','create','update','destroy','exports','multer','util'];(function(_0x5b9cbc,_0x1d75a0){var _0x254af0=function(_0x46b668){while(--_0x46b668){_0x5b9cbc['push'](_0x5b9cbc['shift']());}};_0x254af0(++_0x1d75a0);}(_0x85d1,0x17a));var _0x185d=function(_0x754ab4,_0x56daa7){_0x754ab4=_0x754ab4-0x0;var _0x34079a=_0x85d1[_0x754ab4];return _0x34079a;};'use strict';var multer=require(_0x185d('0x0'));var util=require(_0x185d('0x1'));var path=require(_0x185d('0x2'));var timeout=require(_0x185d('0x3'));var express=require(_0x185d('0x4'));var router=express['Router']();var auth=require(_0x185d('0x5'));var interaction=require(_0x185d('0x6'));var config=require(_0x185d('0x7'));var controller=require(_0x185d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x185d('0x9')]);router[_0x185d('0xa')](_0x185d('0xb'),auth[_0x185d('0xc')](),controller[_0x185d('0xd')]);router[_0x185d('0xa')](_0x185d('0xe'),auth['isAuthenticated'](),controller[_0x185d('0xf')]);router['post']('/',auth[_0x185d('0xc')](),controller[_0x185d('0x10')]);router['put'](_0x185d('0xe'),auth[_0x185d('0xc')](),controller[_0x185d('0x11')]);router['delete'](_0x185d('0xe'),auth[_0x185d('0xc')](),controller[_0x185d('0x12')]);module[_0x185d('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 16853dc..ecdd723 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 _0x636b=['DATE','sequelize','exports','STRING'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x636b,0x161));var _0xb636=function(_0x4622ae,_0x2c98fa){_0x4622ae=_0x4622ae-0x0;var _0x8574ba=_0x636b[_0x4622ae];return _0x8574ba;};'use strict';var moment=require('moment');var Sequelize=require(_0xb636('0x0'));module[_0xb636('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xb636('0x2')]},'joinAt':{'type':Sequelize[_0xb636('0x3')]},'leaveAt':{'type':Sequelize[_0xb636('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xb636('0x3')]},'reason':{'type':Sequelize[_0xb636('0x2')]}}; \ No newline at end of file +var _0x23b1=['DATE','exports','STRING'];(function(_0x1a89df,_0x55a137){var _0x282029=function(_0x51d509){while(--_0x51d509){_0x1a89df['push'](_0x1a89df['shift']());}};_0x282029(++_0x55a137);}(_0x23b1,0x178));var _0x123b=function(_0x3bdfee,_0x4e9cf1){_0x3bdfee=_0x3bdfee-0x0;var _0x460001=_0x23b1[_0x3bdfee];return _0x460001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x123b('0x0')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x123b('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x123b('0x2')]},'acceptAt':{'type':Sequelize[_0x123b('0x2')]},'exitAt':{'type':Sequelize[_0x123b('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 2503f46..fe47c03 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 _0xeb2f=['rawAttributes','find','create','body','params','describe','html-pdf','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','save','update','then','destroy','end','error','stack','name','send','map','fieldName','type','model','query','filters','attributes','fields','length','nolimit','order','sort','where','merge','VIRTUAL','SmsQueueReport','count','includeAll','include','rows','catch','show','keys'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xeb2f,0x1a4));var _0xfeb2=function(_0x3bd068,_0xb17ea5){_0x3bd068=_0x3bd068-0x0;var _0x2aca57=_0xeb2f[_0x3bd068];return _0x2aca57;};'use strict';var pdf=require(_0xfeb2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfeb2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfeb2('0x2'));var rp=require(_0xfeb2('0x3'));var moment=require(_0xfeb2('0x4'));var BPromise=require(_0xfeb2('0x5'));var Mustache=require('mustache');var util=require(_0xfeb2('0x6'));var path=require(_0xfeb2('0x7'));var sox=require(_0xfeb2('0x8'));var csv=require(_0xfeb2('0x9'));var ejs=require(_0xfeb2('0xa'));var fs=require('fs');var _=require(_0xfeb2('0xb'));var squel=require('squel');var crypto=require(_0xfeb2('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xfeb2('0xd'));var toCsv=require(_0xfeb2('0x9'));var querystring=require(_0xfeb2('0xe'));var Papa=require('papaparse');var Redis=require(_0xfeb2('0xf'));var authService=require(_0xfeb2('0x10'));var qs=require(_0xfeb2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xfeb2('0x12'));var logger=require(_0xfeb2('0x13'))(_0xfeb2('0x14'));var utils=require(_0xfeb2('0x15'));var config=require(_0xfeb2('0x16'));var db=require(_0xfeb2('0x17'))['db'];function respondWithStatusCode(_0x39aa87,_0x201cca){_0x201cca=_0x201cca||0xcc;return function(_0x5af783){if(_0x5af783){return _0x39aa87[_0xfeb2('0x18')](_0x201cca);}return _0x39aa87['status'](_0x201cca)['end']();};}function respondWithResult(_0x307252,_0x331495){_0x331495=_0x331495||0xc8;return function(_0x29e1f7){if(_0x29e1f7){return _0x307252[_0xfeb2('0x19')](_0x331495)[_0xfeb2('0x1a')](_0x29e1f7);}};}function respondWithFilteredResult(_0x2f2fd9,_0x1839e6){return function(_0x30e556){if(_0x30e556){var _0x3c8784=_0x30e556['count'],_0x487540=_0x1839e6[_0xfeb2('0x1b')],_0x1613e6=_0x1839e6['offset']+_0x1839e6[_0xfeb2('0x1c')],_0x11fe59;if(_0x1613e6>=_0x3c8784){_0x1613e6=_0x3c8784;_0x11fe59=0xc8;}else{_0x11fe59=0xce;}_0x2f2fd9['status'](_0x11fe59);return _0x2f2fd9[_0xfeb2('0x1d')](_0xfeb2('0x1e'),_0x487540+'-'+_0x1613e6+'/'+_0x3c8784)['json'](_0x30e556);}return null;};}function patchUpdates(_0x2d9ba0){return function(_0x14e3ab){try{jsonpatch['apply'](_0x14e3ab,_0x2d9ba0,!![]);}catch(_0x20c632){return BPromise['reject'](_0x20c632);}return _0x14e3ab[_0xfeb2('0x1f')]();};}function saveUpdates(_0x669cc5,_0x250be0){return function(_0x12306f){if(_0x12306f){return _0x12306f[_0xfeb2('0x20')](_0x669cc5)[_0xfeb2('0x21')](function(_0x51f8f0){return _0x51f8f0;});}return null;};}function removeEntity(_0x4c98d2,_0x11a732){return function(_0x258854){if(_0x258854){return _0x258854[_0xfeb2('0x22')]()[_0xfeb2('0x21')](function(){_0x4c98d2[_0xfeb2('0x19')](0xcc)[_0xfeb2('0x23')]();});}};}function handleEntityNotFound(_0x49ab43,_0x36c7ac){return function(_0x585430){if(!_0x585430){_0x49ab43['sendStatus'](0x194);}return _0x585430;};}function handleError(_0x2bf705,_0x3cf444){_0x3cf444=_0x3cf444||0x1f4;return function(_0x372931){logger[_0xfeb2('0x24')](_0x372931[_0xfeb2('0x25')]);if(_0x372931['name']){delete _0x372931[_0xfeb2('0x26')];}_0x2bf705[_0xfeb2('0x19')](_0x3cf444)[_0xfeb2('0x27')](_0x372931);};}exports['index']=function(_0x19707c,_0x411639){var _0x5e7014={},_0x29be00={},_0x1bce5f={'count':0x0,'rows':[]};var _0x2c5a00=_[_0xfeb2('0x28')](db['SmsQueueReport']['rawAttributes'],function(_0x8350fe){return{'name':_0x8350fe[_0xfeb2('0x29')],'type':_0x8350fe[_0xfeb2('0x2a')]['key']};});_0x29be00[_0xfeb2('0x2b')]=_['map'](_0x2c5a00,'name');_0x29be00[_0xfeb2('0x2c')]=_['keys'](_0x19707c[_0xfeb2('0x2c')]);_0x29be00[_0xfeb2('0x2d')]=_['intersection'](_0x29be00[_0xfeb2('0x2b')],_0x29be00['query']);_0x5e7014[_0xfeb2('0x2e')]=_['intersection'](_0x29be00[_0xfeb2('0x2b')],qs[_0xfeb2('0x2f')](_0x19707c[_0xfeb2('0x2c')]['fields']));_0x5e7014[_0xfeb2('0x2e')]=_0x5e7014[_0xfeb2('0x2e')][_0xfeb2('0x30')]?_0x5e7014['attributes']:_0x29be00['model'];if(!_0x19707c[_0xfeb2('0x2c')]['hasOwnProperty'](_0xfeb2('0x31'))){_0x5e7014['limit']=qs['limit'](_0x19707c[_0xfeb2('0x2c')][_0xfeb2('0x1c')]);_0x5e7014[_0xfeb2('0x1b')]=qs[_0xfeb2('0x1b')](_0x19707c[_0xfeb2('0x2c')][_0xfeb2('0x1b')]);}_0x5e7014[_0xfeb2('0x32')]=qs[_0xfeb2('0x33')](_0x19707c[_0xfeb2('0x2c')]['sort']);_0x5e7014[_0xfeb2('0x34')]=qs['filters'](_['pick'](_0x19707c[_0xfeb2('0x2c')],_0x29be00[_0xfeb2('0x2d')]));if(_0x19707c[_0xfeb2('0x2c')]['filter']){_0x5e7014[_0xfeb2('0x34')]=_[_0xfeb2('0x35')](_0x5e7014[_0xfeb2('0x34')],{'$or':_[_0xfeb2('0x28')](_0x2c5a00,function(_0x1ef8ed){if(_0x1ef8ed['type']!==_0xfeb2('0x36')){var _0x53694e={};_0x53694e[_0x1ef8ed[_0xfeb2('0x26')]]={'$like':'%'+_0x19707c[_0xfeb2('0x2c')]['filter']+'%'};return _0x53694e;}})});}_0x5e7014=_['merge']({},_0x5e7014,_0x19707c['options']);var _0x16d5fb={'where':_0x5e7014[_0xfeb2('0x34')]};return db[_0xfeb2('0x37')]['count'](_0x16d5fb)[_0xfeb2('0x21')](function(_0x5cea80){_0x1bce5f[_0xfeb2('0x38')]=_0x5cea80;if(_0x19707c[_0xfeb2('0x2c')][_0xfeb2('0x39')]){_0x5e7014[_0xfeb2('0x3a')]=[{'all':!![]}];}return db[_0xfeb2('0x37')]['findAll'](_0x5e7014);})['then'](function(_0x7e09){_0x1bce5f[_0xfeb2('0x3b')]=_0x7e09;return _0x1bce5f;})[_0xfeb2('0x21')](respondWithFilteredResult(_0x411639,_0x5e7014))[_0xfeb2('0x3c')](handleError(_0x411639,null));};exports[_0xfeb2('0x3d')]=function(_0x218ee3,_0xb811fd){var _0x403c37={'raw':!![],'where':{'id':_0x218ee3['params']['id']}},_0x2bb8ea={};_0x2bb8ea[_0xfeb2('0x2b')]=_[_0xfeb2('0x3e')](db[_0xfeb2('0x37')][_0xfeb2('0x3f')]);_0x2bb8ea[_0xfeb2('0x2c')]=_['keys'](_0x218ee3[_0xfeb2('0x2c')]);_0x2bb8ea[_0xfeb2('0x2d')]=_['intersection'](_0x2bb8ea[_0xfeb2('0x2b')],_0x2bb8ea[_0xfeb2('0x2c')]);_0x403c37[_0xfeb2('0x2e')]=_['intersection'](_0x2bb8ea[_0xfeb2('0x2b')],qs[_0xfeb2('0x2f')](_0x218ee3[_0xfeb2('0x2c')][_0xfeb2('0x2f')]));_0x403c37['attributes']=_0x403c37[_0xfeb2('0x2e')]['length']?_0x403c37['attributes']:_0x2bb8ea['model'];if(_0x218ee3[_0xfeb2('0x2c')]['includeAll']){_0x403c37['include']=[{'all':!![]}];}_0x403c37=_[_0xfeb2('0x35')]({},_0x403c37,_0x218ee3['options']);return db['SmsQueueReport'][_0xfeb2('0x40')](_0x403c37)['then'](handleEntityNotFound(_0xb811fd,null))[_0xfeb2('0x21')](respondWithResult(_0xb811fd,null))[_0xfeb2('0x3c')](handleError(_0xb811fd,null));};exports['create']=function(_0x2cf245,_0x15b7df){return db[_0xfeb2('0x37')][_0xfeb2('0x41')](_0x2cf245[_0xfeb2('0x42')],{})[_0xfeb2('0x21')](respondWithResult(_0x15b7df,0xc9))[_0xfeb2('0x3c')](handleError(_0x15b7df,null));};exports[_0xfeb2('0x20')]=function(_0x499f56,_0x38fd5){if(_0x499f56[_0xfeb2('0x42')]['id']){delete _0x499f56[_0xfeb2('0x42')]['id'];}return db[_0xfeb2('0x37')]['find']({'where':{'id':_0x499f56[_0xfeb2('0x43')]['id']}})[_0xfeb2('0x21')](handleEntityNotFound(_0x38fd5,null))[_0xfeb2('0x21')](saveUpdates(_0x499f56[_0xfeb2('0x42')],null))[_0xfeb2('0x21')](respondWithResult(_0x38fd5,null))[_0xfeb2('0x3c')](handleError(_0x38fd5,null));};exports[_0xfeb2('0x22')]=function(_0x5dad20,_0x52edce){return db[_0xfeb2('0x37')]['find']({'where':{'id':_0x5dad20[_0xfeb2('0x43')]['id']}})[_0xfeb2('0x21')](handleEntityNotFound(_0x52edce,null))['then'](removeEntity(_0x52edce,null))['catch'](handleError(_0x52edce,null));};exports[_0xfeb2('0x44')]=function(_0x1d872b,_0x29a33b){return db[_0xfeb2('0x37')][_0xfeb2('0x44')]()['then'](respondWithResult(_0x29a33b,null))[_0xfeb2('0x3c')](handleError(_0x29a33b,null));}; \ No newline at end of file +var _0x7183=['then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','options','include','findAll','rows','catch','params','keys','includeAll','merge','find','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update'];(function(_0x5bc55b,_0x31eb26){var _0x506a93=function(_0x343dc7){while(--_0x343dc7){_0x5bc55b['push'](_0x5bc55b['shift']());}};_0x506a93(++_0x31eb26);}(_0x7183,0xc0));var _0x3718=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x7183[_0x565ed7];return _0x183ad7;};'use strict';var pdf=require(_0x3718('0x0'));var emlformat=require(_0x3718('0x1'));var rimraf=require(_0x3718('0x2'));var zipdir=require(_0x3718('0x3'));var jsonpatch=require(_0x3718('0x4'));var rp=require(_0x3718('0x5'));var moment=require(_0x3718('0x6'));var BPromise=require(_0x3718('0x7'));var Mustache=require(_0x3718('0x8'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x3718('0x9'));var ejs=require(_0x3718('0xa'));var fs=require('fs');var _=require(_0x3718('0xb'));var squel=require(_0x3718('0xc'));var crypto=require(_0x3718('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x3718('0xe'));var toCsv=require('to-csv');var querystring=require(_0x3718('0xf'));var Papa=require('papaparse');var Redis=require(_0x3718('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x3718('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3718('0x12'));var logger=require(_0x3718('0x13'))(_0x3718('0x14'));var utils=require(_0x3718('0x15'));var config=require(_0x3718('0x16'));var db=require(_0x3718('0x17'))['db'];function respondWithStatusCode(_0x3f8a9e,_0x4713a4){_0x4713a4=_0x4713a4||0xcc;return function(_0x51fd88){if(_0x51fd88){return _0x3f8a9e[_0x3718('0x18')](_0x4713a4);}return _0x3f8a9e[_0x3718('0x19')](_0x4713a4)[_0x3718('0x1a')]();};}function respondWithResult(_0x4a2f56,_0x3d9215){_0x3d9215=_0x3d9215||0xc8;return function(_0x3d697e){if(_0x3d697e){return _0x4a2f56[_0x3718('0x19')](_0x3d9215)['json'](_0x3d697e);}};}function respondWithFilteredResult(_0x1442e7,_0x3ad5f7){return function(_0x426485){if(_0x426485){var _0x4a3049=_0x426485[_0x3718('0x1b')],_0x385820=_0x3ad5f7['offset'],_0x32e369=_0x3ad5f7[_0x3718('0x1c')]+_0x3ad5f7[_0x3718('0x1d')],_0x2e0899;if(_0x32e369>=_0x4a3049){_0x32e369=_0x4a3049;_0x2e0899=0xc8;}else{_0x2e0899=0xce;}_0x1442e7[_0x3718('0x19')](_0x2e0899);return _0x1442e7['set'](_0x3718('0x1e'),_0x385820+'-'+_0x32e369+'/'+_0x4a3049)[_0x3718('0x1f')](_0x426485);}return null;};}function patchUpdates(_0x188ddf){return function(_0x2556c3){try{jsonpatch[_0x3718('0x20')](_0x2556c3,_0x188ddf,!![]);}catch(_0x5287e6){return BPromise[_0x3718('0x21')](_0x5287e6);}return _0x2556c3[_0x3718('0x22')]();};}function saveUpdates(_0x200c5e,_0x2a4947){return function(_0x2d6ee5){if(_0x2d6ee5){return _0x2d6ee5[_0x3718('0x23')](_0x200c5e)[_0x3718('0x24')](function(_0x4cb72b){return _0x4cb72b;});}return null;};}function removeEntity(_0x61167d,_0x19ada3){return function(_0x4c73da){if(_0x4c73da){return _0x4c73da[_0x3718('0x25')]()[_0x3718('0x24')](function(){_0x61167d[_0x3718('0x19')](0xcc)[_0x3718('0x1a')]();});}};}function handleEntityNotFound(_0x4a26e0,_0x569212){return function(_0x274791){if(!_0x274791){_0x4a26e0['sendStatus'](0x194);}return _0x274791;};}function handleError(_0x22ceb7,_0xa8fc7d){_0xa8fc7d=_0xa8fc7d||0x1f4;return function(_0x14a57e){logger[_0x3718('0x26')](_0x14a57e[_0x3718('0x27')]);if(_0x14a57e[_0x3718('0x28')]){delete _0x14a57e['name'];}_0x22ceb7[_0x3718('0x19')](_0xa8fc7d)[_0x3718('0x29')](_0x14a57e);};}exports[_0x3718('0x2a')]=function(_0x36fcb6,_0x41ee02){var _0x4abfd7={},_0x1208b8={},_0xe1c4d1={'count':0x0,'rows':[]};var _0x3bba85=_[_0x3718('0x2b')](db[_0x3718('0x2c')][_0x3718('0x2d')],function(_0x3d1f39){return{'name':_0x3d1f39['fieldName'],'type':_0x3d1f39[_0x3718('0x2e')][_0x3718('0x2f')]};});_0x1208b8['model']=_['map'](_0x3bba85,'name');_0x1208b8[_0x3718('0x30')]=_['keys'](_0x36fcb6['query']);_0x1208b8['filters']=_[_0x3718('0x31')](_0x1208b8['model'],_0x1208b8[_0x3718('0x30')]);_0x4abfd7[_0x3718('0x32')]=_['intersection'](_0x1208b8[_0x3718('0x33')],qs[_0x3718('0x34')](_0x36fcb6['query'][_0x3718('0x34')]));_0x4abfd7[_0x3718('0x32')]=_0x4abfd7[_0x3718('0x32')][_0x3718('0x35')]?_0x4abfd7[_0x3718('0x32')]:_0x1208b8[_0x3718('0x33')];if(!_0x36fcb6[_0x3718('0x30')][_0x3718('0x36')](_0x3718('0x37'))){_0x4abfd7[_0x3718('0x1d')]=qs[_0x3718('0x1d')](_0x36fcb6[_0x3718('0x30')][_0x3718('0x1d')]);_0x4abfd7['offset']=qs[_0x3718('0x1c')](_0x36fcb6[_0x3718('0x30')][_0x3718('0x1c')]);}_0x4abfd7[_0x3718('0x38')]=qs['sort'](_0x36fcb6[_0x3718('0x30')][_0x3718('0x39')]);_0x4abfd7[_0x3718('0x3a')]=qs[_0x3718('0x3b')](_[_0x3718('0x3c')](_0x36fcb6[_0x3718('0x30')],_0x1208b8['filters']));if(_0x36fcb6[_0x3718('0x30')]['filter']){_0x4abfd7['where']=_['merge'](_0x4abfd7[_0x3718('0x3a')],{'$or':_[_0x3718('0x2b')](_0x3bba85,function(_0x3a567e){if(_0x3a567e[_0x3718('0x2e')]!==_0x3718('0x3d')){var _0x26fbd2={};_0x26fbd2[_0x3a567e[_0x3718('0x28')]]={'$like':'%'+_0x36fcb6[_0x3718('0x30')][_0x3718('0x3e')]+'%'};return _0x26fbd2;}})});}_0x4abfd7=_['merge']({},_0x4abfd7,_0x36fcb6[_0x3718('0x3f')]);var _0x3da354={'where':_0x4abfd7['where']};return db[_0x3718('0x2c')][_0x3718('0x1b')](_0x3da354)['then'](function(_0x50a5fc){_0xe1c4d1[_0x3718('0x1b')]=_0x50a5fc;if(_0x36fcb6[_0x3718('0x30')]['includeAll']){_0x4abfd7[_0x3718('0x40')]=[{'all':!![]}];}return db['SmsQueueReport'][_0x3718('0x41')](_0x4abfd7);})[_0x3718('0x24')](function(_0x591e1f){_0xe1c4d1[_0x3718('0x42')]=_0x591e1f;return _0xe1c4d1;})['then'](respondWithFilteredResult(_0x41ee02,_0x4abfd7))[_0x3718('0x43')](handleError(_0x41ee02,null));};exports['show']=function(_0x282c3f,_0x441f48){var _0x29b246={'raw':!![],'where':{'id':_0x282c3f[_0x3718('0x44')]['id']}},_0x2354bd={};_0x2354bd[_0x3718('0x33')]=_[_0x3718('0x45')](db[_0x3718('0x2c')][_0x3718('0x2d')]);_0x2354bd['query']=_[_0x3718('0x45')](_0x282c3f[_0x3718('0x30')]);_0x2354bd['filters']=_[_0x3718('0x31')](_0x2354bd[_0x3718('0x33')],_0x2354bd[_0x3718('0x30')]);_0x29b246[_0x3718('0x32')]=_[_0x3718('0x31')](_0x2354bd[_0x3718('0x33')],qs['fields'](_0x282c3f[_0x3718('0x30')][_0x3718('0x34')]));_0x29b246[_0x3718('0x32')]=_0x29b246[_0x3718('0x32')]['length']?_0x29b246[_0x3718('0x32')]:_0x2354bd['model'];if(_0x282c3f[_0x3718('0x30')][_0x3718('0x46')]){_0x29b246['include']=[{'all':!![]}];}_0x29b246=_[_0x3718('0x47')]({},_0x29b246,_0x282c3f[_0x3718('0x3f')]);return db['SmsQueueReport'][_0x3718('0x48')](_0x29b246)[_0x3718('0x24')](handleEntityNotFound(_0x441f48,null))[_0x3718('0x24')](respondWithResult(_0x441f48,null))[_0x3718('0x43')](handleError(_0x441f48,null));};exports['create']=function(_0x22e251,_0x3734b1){return db['SmsQueueReport'][_0x3718('0x49')](_0x22e251[_0x3718('0x4a')],{})[_0x3718('0x24')](respondWithResult(_0x3734b1,0xc9))[_0x3718('0x43')](handleError(_0x3734b1,null));};exports[_0x3718('0x23')]=function(_0x15d343,_0x3cae69){if(_0x15d343[_0x3718('0x4a')]['id']){delete _0x15d343[_0x3718('0x4a')]['id'];}return db[_0x3718('0x2c')][_0x3718('0x48')]({'where':{'id':_0x15d343[_0x3718('0x44')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x3cae69,null))[_0x3718('0x24')](saveUpdates(_0x15d343[_0x3718('0x4a')],null))[_0x3718('0x24')](respondWithResult(_0x3cae69,null))['catch'](handleError(_0x3cae69,null));};exports[_0x3718('0x25')]=function(_0x3ee9ae,_0x149a7a){return db[_0x3718('0x2c')][_0x3718('0x48')]({'where':{'id':_0x3ee9ae[_0x3718('0x44')]['id']}})[_0x3718('0x24')](handleEntityNotFound(_0x149a7a,null))[_0x3718('0x24')](removeEntity(_0x149a7a,null))[_0x3718('0x43')](handleError(_0x149a7a,null));};exports[_0x3718('0x4b')]=function(_0x4d450d,_0x334471){return db[_0x3718('0x2c')]['describe']()[_0x3718('0x24')](respondWithResult(_0x334471,null))[_0x3718('0x43')](handleError(_0x334471,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index fc6d187..4b4a028 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 _0x3b46=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','exports','report_sms_queue','uniqueid','lodash','util'];(function(_0x1a87b3,_0x45ba68){var _0x37e84d=function(_0x39f49e){while(--_0x39f49e){_0x1a87b3['push'](_0x1a87b3['shift']());}};_0x37e84d(++_0x45ba68);}(_0x3b46,0x1a2));var _0x63b4=function(_0x50e40b,_0x338d17){_0x50e40b=_0x50e40b-0x0;var _0x2608b7=_0x3b46[_0x50e40b];return _0x2608b7;};'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']('SmsQueueReport',attributes,{'tableName':_0x63b4('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x63b4('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x24cb=['bluebird','request-promise','rimraf','../../config/environment','./smsQueueReport.attributes','define','report_sms_queue','lodash','util','../../config/logger','api','moment'];(function(_0x115d9a,_0x32b07e){var _0x8cde88=function(_0x2f2b6b){while(--_0x2f2b6b){_0x115d9a['push'](_0x115d9a['shift']());}};_0x8cde88(++_0x32b07e);}(_0x24cb,0x11b));var _0xb24c=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0x24cb[_0xbe200f];return _0x192597;};'use strict';var _=require(_0xb24c('0x0'));var util=require(_0xb24c('0x1'));var logger=require(_0xb24c('0x2'))(_0xb24c('0x3'));var moment=require(_0xb24c('0x4'));var BPromise=require(_0xb24c('0x5'));var rp=require(_0xb24c('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb24c('0x7'));var config=require(_0xb24c('0x8'));var attributes=require(_0xb24c('0x9'));module['exports']=function(_0xc3ad5c,_0xe11821){return _0xc3ad5c[_0xb24c('0xa')]('SmsQueueReport',attributes,{'tableName':_0xb24c('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 0188a01..19f2368 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 _0x7830=['util','moment','bluebird','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','SmsQueueReport,\x20%s,\x20%s','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','SmsQueueReport','create','options','raw','then','stringify','update','body','where','attributes','UpdateSmsQueueReport','lodash'];(function(_0x3ec884,_0x3cadda){var _0x1e4e7d=function(_0x2299d0){while(--_0x2299d0){_0x3ec884['push'](_0x3ec884['shift']());}};_0x1e4e7d(++_0x3cadda);}(_0x7830,0x15b));var _0x0783=function(_0x1f9c7b,_0x31b31d){_0x1f9c7b=_0x1f9c7b-0x0;var _0x26df69=_0x7830[_0x1f9c7b];return _0x26df69;};'use strict';var _=require(_0x0783('0x0'));var util=require(_0x0783('0x1'));var moment=require(_0x0783('0x2'));var BPromise=require(_0x0783('0x3'));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(_0x0783('0x4'))('rpc');var config=require(_0x0783('0x5'));var jayson=require(_0x0783('0x6'));var client=jayson[_0x0783('0x7')][_0x0783('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d3a38,_0x5989d4,_0x2aafd1){return new BPromise(function(_0x1c94bc,_0x2fda2e){return client[_0x0783('0x9')](_0x3d3a38,_0x2aafd1)['then'](function(_0x504309){logger[_0x0783('0xa')](_0x0783('0xb'),_0x5989d4,'request\x20sent');logger[_0x0783('0xc')](_0x0783('0xd'),_0x5989d4,'request\x20sent',JSON['stringify'](_0x504309));if(_0x504309[_0x0783('0xe')]){if(_0x504309[_0x0783('0xe')][_0x0783('0xf')]===0x1f4){logger['error'](_0x0783('0xb'),_0x5989d4,_0x504309[_0x0783('0xe')][_0x0783('0x10')]);return _0x2fda2e(_0x504309['error'][_0x0783('0x10')]);}logger[_0x0783('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x5989d4,_0x504309['error']['message']);return _0x1c94bc(_0x504309[_0x0783('0xe')][_0x0783('0x10')]);}else{logger[_0x0783('0xa')](_0x0783('0xb'),_0x5989d4,'request\x20sent');_0x1c94bc(_0x504309['result']['message']);}})[_0x0783('0x11')](function(_0x1ce2fb){logger[_0x0783('0xe')](_0x0783('0xb'),_0x5989d4,_0x1ce2fb);_0x2fda2e(_0x1ce2fb);});});}exports['CreateSmsQueueReport']=function(_0xd2674b){var _0xb39b93=this;return new Promise(function(_0x5d986f,_0x18aa57){return db[_0x0783('0x12')][_0x0783('0x13')](_0xd2674b['body'],{'raw':_0xd2674b['options']?_0xd2674b[_0x0783('0x14')][_0x0783('0x15')]===undefined?!![]:![]:!![]})[_0x0783('0x16')](function(_0xbf59c){logger[_0x0783('0xa')]('CreateSmsQueueReport',_0xd2674b);logger[_0x0783('0xc')]('CreateSmsQueueReport',_0xd2674b,JSON[_0x0783('0x17')](_0xbf59c));_0x5d986f(_0xbf59c);})[_0x0783('0x11')](function(_0x3b3be1){logger[_0x0783('0xe')]('CreateSmsQueueReport',_0x3b3be1['message'],_0xd2674b);_0x18aa57(_0xb39b93[_0x0783('0xe')](0x1f4,_0x3b3be1[_0x0783('0x10')]));});});};exports['UpdateSmsQueueReport']=function(_0x555a94){var _0x11ee1d=this;return new Promise(function(_0x345b53,_0x4d7c24){return db['SmsQueueReport'][_0x0783('0x18')](_0x555a94[_0x0783('0x19')],{'raw':_0x555a94[_0x0783('0x14')]?_0x555a94[_0x0783('0x14')][_0x0783('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x555a94[_0x0783('0x14')]?_0x555a94[_0x0783('0x14')][_0x0783('0x1a')]||null:null,'attributes':_0x555a94['options']?_0x555a94[_0x0783('0x14')][_0x0783('0x1b')]||null:null,'limit':_0x555a94[_0x0783('0x14')]?_0x555a94[_0x0783('0x14')]['limit']||null:null})[_0x0783('0x16')](function(_0x546003){logger[_0x0783('0xa')](_0x0783('0x1c'),_0x555a94);logger[_0x0783('0xc')](_0x0783('0x1c'),_0x555a94,JSON['stringify'](_0x546003));_0x345b53(_0x546003);})['catch'](function(_0x35b1ee){logger[_0x0783('0xe')](_0x0783('0x1c'),_0x35b1ee['message'],_0x555a94);_0x4d7c24(_0x11ee1d['error'](0x1f4,_0x35b1ee[_0x0783('0x10')]));});});}; \ No newline at end of file +var _0x895d=['SmsQueueReport','create','body','options','raw','debug','UpdateSmsQueueReport','update','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateSmsQueueReport'];(function(_0x41a429,_0x300df5){var _0x2b5b1f=function(_0x3d1916){while(--_0x3d1916){_0x41a429['push'](_0x41a429['shift']());}};_0x2b5b1f(++_0x300df5);}(_0x895d,0x146));var _0xd895=function(_0x35023d,_0x54f45f){_0x35023d=_0x35023d-0x0;var _0x4838bc=_0x895d[_0x35023d];return _0x4838bc;};'use strict';var _=require(_0xd895('0x0'));var util=require(_0xd895('0x1'));var moment=require(_0xd895('0x2'));var BPromise=require(_0xd895('0x3'));var rs=require(_0xd895('0x4'));var fs=require('fs');var Redis=require(_0xd895('0x5'));var db=require(_0xd895('0x6'))['db'];var utils=require(_0xd895('0x7'));var logger=require('../../config/logger')(_0xd895('0x8'));var config=require(_0xd895('0x9'));var jayson=require(_0xd895('0xa'));var client=jayson['client'][_0xd895('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c4173,_0x1ec9f7,_0x4206f2){return new BPromise(function(_0x510dc6,_0x1ddb98){return client[_0xd895('0xc')](_0x3c4173,_0x4206f2)[_0xd895('0xd')](function(_0x4e4884){logger[_0xd895('0xe')](_0xd895('0xf'),_0x1ec9f7,_0xd895('0x10'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x1ec9f7,_0xd895('0x10'),JSON[_0xd895('0x11')](_0x4e4884));if(_0x4e4884[_0xd895('0x12')]){if(_0x4e4884[_0xd895('0x12')][_0xd895('0x13')]===0x1f4){logger[_0xd895('0x12')](_0xd895('0xf'),_0x1ec9f7,_0x4e4884[_0xd895('0x12')][_0xd895('0x14')]);return _0x1ddb98(_0x4e4884['error'][_0xd895('0x14')]);}logger['error'](_0xd895('0xf'),_0x1ec9f7,_0x4e4884['error'][_0xd895('0x14')]);return _0x510dc6(_0x4e4884[_0xd895('0x12')][_0xd895('0x14')]);}else{logger[_0xd895('0xe')]('SmsQueueReport,\x20%s,\x20%s',_0x1ec9f7,'request\x20sent');_0x510dc6(_0x4e4884[_0xd895('0x15')]['message']);}})[_0xd895('0x16')](function(_0x2d9511){logger[_0xd895('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0x1ec9f7,_0x2d9511);_0x1ddb98(_0x2d9511);});});}exports[_0xd895('0x17')]=function(_0x564615){var _0x26333a=this;return new Promise(function(_0x5b380e,_0x327d04){return db[_0xd895('0x18')][_0xd895('0x19')](_0x564615[_0xd895('0x1a')],{'raw':_0x564615[_0xd895('0x1b')]?_0x564615[_0xd895('0x1b')][_0xd895('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x23329e){logger[_0xd895('0xe')](_0xd895('0x17'),_0x564615);logger[_0xd895('0x1d')](_0xd895('0x17'),_0x564615,JSON[_0xd895('0x11')](_0x23329e));_0x5b380e(_0x23329e);})[_0xd895('0x16')](function(_0xa27828){logger[_0xd895('0x12')](_0xd895('0x17'),_0xa27828[_0xd895('0x14')],_0x564615);_0x327d04(_0x26333a[_0xd895('0x12')](0x1f4,_0xa27828[_0xd895('0x14')]));});});};exports[_0xd895('0x1e')]=function(_0x25480f){var _0x50fd13=this;return new Promise(function(_0x7c5bfb,_0x11f518){return db[_0xd895('0x18')][_0xd895('0x1f')](_0x25480f[_0xd895('0x1a')],{'raw':_0x25480f[_0xd895('0x1b')]?_0x25480f['options'][_0xd895('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x25480f[_0xd895('0x1b')]?_0x25480f[_0xd895('0x1b')][_0xd895('0x20')]||null:null,'attributes':_0x25480f[_0xd895('0x1b')]?_0x25480f['options'][_0xd895('0x21')]||null:null,'limit':_0x25480f[_0xd895('0x1b')]?_0x25480f[_0xd895('0x1b')][_0xd895('0x22')]||null:null})['then'](function(_0x2fbcc7){logger[_0xd895('0xe')](_0xd895('0x1e'),_0x25480f);logger[_0xd895('0x1d')](_0xd895('0x1e'),_0x25480f,JSON[_0xd895('0x11')](_0x2fbcc7));_0x7c5bfb(_0x2fbcc7);})[_0xd895('0x16')](function(_0x1eada0){logger['error']('UpdateSmsQueueReport',_0x1eada0[_0xd895('0x14')],_0x25480f);_0x11f518(_0x50fd13['error'](0x1f4,_0x1eada0[_0xd895('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 910b993..7522a92 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 _0x5c00=['put','delete','destroy','exports','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create'];(function(_0x57fcd6,_0x70b457){var _0x5b6c73=function(_0x366b6a){while(--_0x366b6a){_0x57fcd6['push'](_0x57fcd6['shift']());}};_0x5b6c73(++_0x70b457);}(_0x5c00,0x17e));var _0x05c0=function(_0x11e90b,_0x3ec29a){_0x11e90b=_0x11e90b-0x0;var _0x31452e=_0x5c00[_0x11e90b];return _0x31452e;};'use strict';var multer=require(_0x05c0('0x0'));var util=require(_0x05c0('0x1'));var path=require(_0x05c0('0x2'));var timeout=require('connect-timeout');var express=require(_0x05c0('0x3'));var router=express['Router']();var auth=require(_0x05c0('0x4'));var interaction=require(_0x05c0('0x5'));var config=require(_0x05c0('0x6'));var controller=require(_0x05c0('0x7'));router['get']('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x9')]);router[_0x05c0('0xa')](_0x05c0('0xb'),auth['isAuthenticated'](),controller[_0x05c0('0xc')]);router[_0x05c0('0xa')](_0x05c0('0xd'),auth['isAuthenticated'](),controller[_0x05c0('0xe')]);router[_0x05c0('0xf')]('/',auth[_0x05c0('0x8')](),controller[_0x05c0('0x10')]);router[_0x05c0('0x11')](_0x05c0('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x05c0('0x12')]('/:id',auth[_0x05c0('0x8')](),controller[_0x05c0('0x13')]);module[_0x05c0('0x14')]=router; \ No newline at end of file +var _0x4fc2=['./smsTransferReport.controller','get','index','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x537458,_0x36a629){var _0x89ab6=function(_0x1c18ab){while(--_0x1c18ab){_0x537458['push'](_0x537458['shift']());}};_0x89ab6(++_0x36a629);}(_0x4fc2,0x111));var _0x24fc=function(_0x2d92cf,_0x434a92){_0x2d92cf=_0x2d92cf-0x0;var _0x592841=_0x4fc2[_0x2d92cf];return _0x592841;};'use strict';var multer=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var path=require(_0x24fc('0x2'));var timeout=require(_0x24fc('0x3'));var express=require('express');var router=express[_0x24fc('0x4')]();var auth=require(_0x24fc('0x5'));var interaction=require(_0x24fc('0x6'));var config=require('../../config/environment');var controller=require(_0x24fc('0x7'));router[_0x24fc('0x8')]('/',auth['isAuthenticated'](),controller[_0x24fc('0x9')]);router[_0x24fc('0x8')]('/describe',auth[_0x24fc('0xa')](),controller[_0x24fc('0xb')]);router[_0x24fc('0x8')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0xd')]);router['post']('/',auth[_0x24fc('0xa')](),controller[_0x24fc('0xe')]);router[_0x24fc('0xf')](_0x24fc('0xc'),auth[_0x24fc('0xa')](),controller[_0x24fc('0x10')]);router[_0x24fc('0x11')](_0x24fc('0xc'),auth['isAuthenticated'](),controller[_0x24fc('0x12')]);module[_0x24fc('0x13')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 7b7f601..55d9794 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 _0xfc05=['agent','queue','DATE','NOW','moment','exports','STRING','account'];(function(_0xbca15c,_0x5ac4cc){var _0x2f2a88=function(_0x1ab4b6){while(--_0x1ab4b6){_0xbca15c['push'](_0xbca15c['shift']());}};_0x2f2a88(++_0x5ac4cc);}(_0xfc05,0x164));var _0x5fc0=function(_0x107ba9,_0x3f7983){_0x107ba9=_0x107ba9-0x0;var _0x2fcfe7=_0xfc05[_0x107ba9];return _0x2fcfe7;};'use strict';var moment=require(_0x5fc0('0x0'));var Sequelize=require('sequelize');module[_0x5fc0('0x1')]={'uniqueid':{'type':Sequelize[_0x5fc0('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x5fc0('0x3'),_0x5fc0('0x4'),_0x5fc0('0x5')),'allowNull':![],'defaultValue':_0x5fc0('0x5')},'transferredAt':{'type':Sequelize[_0x5fc0('0x6')],'allowNull':![],'defaultValue':Sequelize[_0x5fc0('0x7')]}}; \ No newline at end of file +var _0xde85=['agent','queue','DATE','moment','exports'];(function(_0x19c1c2,_0x17c0f9){var _0x5a4395=function(_0x4a6cf2){while(--_0x4a6cf2){_0x19c1c2['push'](_0x19c1c2['shift']());}};_0x5a4395(++_0x17c0f9);}(_0xde85,0xa3));var _0x5de8=function(_0x21bff1,_0x4bf605){_0x21bff1=_0x21bff1-0x0;var _0xdf6556=_0xde85[_0x21bff1];return _0xdf6556;};'use strict';var moment=require(_0x5de8('0x0'));var Sequelize=require('sequelize');module[_0x5de8('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM']('account',_0x5de8('0x2'),'queue'),'allowNull':![],'defaultValue':_0x5de8('0x3')},'transferredAt':{'type':Sequelize[_0x5de8('0x4')],'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 d47bf4e..1c9b31b 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 _0xbcca=['name','send','SmsTransferReport','rawAttributes','key','model','map','query','keys','filters','intersection','fields','attributes','nolimit','limit','sort','filter','type','VIRTUAL','merge','options','where','count','includeAll','include','findAll','rows','show','params','length','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','jsforce','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','offset','set','Content-Range','json','apply','reject','update','then','destroy','error'];(function(_0x4bf4c4,_0x36804a){var _0x2090bb=function(_0x517e46){while(--_0x517e46){_0x4bf4c4['push'](_0x4bf4c4['shift']());}};_0x2090bb(++_0x36804a);}(_0xbcca,0xf8));var _0xabcc=function(_0x9ca619,_0x3c4426){_0x9ca619=_0x9ca619-0x0;var _0x5d7f45=_0xbcca[_0x9ca619];return _0x5d7f45;};'use strict';var pdf=require(_0xabcc('0x0'));var emlformat=require(_0xabcc('0x1'));var rimraf=require(_0xabcc('0x2'));var zipdir=require(_0xabcc('0x3'));var jsonpatch=require(_0xabcc('0x4'));var rp=require(_0xabcc('0x5'));var moment=require(_0xabcc('0x6'));var BPromise=require(_0xabcc('0x7'));var Mustache=require(_0xabcc('0x8'));var util=require(_0xabcc('0x9'));var path=require(_0xabcc('0xa'));var sox=require(_0xabcc('0xb'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xabcc('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xabcc('0xd'));var querystring=require(_0xabcc('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xabcc('0xf'));var qs=require(_0xabcc('0x10'));var as=require(_0xabcc('0x11'));var hardwareService=require(_0xabcc('0x12'));var logger=require(_0xabcc('0x13'))(_0xabcc('0x14'));var utils=require(_0xabcc('0x15'));var config=require('../../config/environment');var db=require(_0xabcc('0x16'))['db'];function respondWithStatusCode(_0xfe2135,_0x48e0cb){_0x48e0cb=_0x48e0cb||0xcc;return function(_0x277014){if(_0x277014){return _0xfe2135[_0xabcc('0x17')](_0x48e0cb);}return _0xfe2135[_0xabcc('0x18')](_0x48e0cb)[_0xabcc('0x19')]();};}function respondWithResult(_0x14de5d,_0x395202){_0x395202=_0x395202||0xc8;return function(_0x440a38){if(_0x440a38){return _0x14de5d[_0xabcc('0x18')](_0x395202)['json'](_0x440a38);}};}function respondWithFilteredResult(_0x79e0b4,_0x113444){return function(_0x3f0402){if(_0x3f0402){var _0x3673cc=_0x3f0402['count'],_0x483c6d=_0x113444[_0xabcc('0x1a')],_0x21c2f5=_0x113444['offset']+_0x113444['limit'],_0x418ad2;if(_0x21c2f5>=_0x3673cc){_0x21c2f5=_0x3673cc;_0x418ad2=0xc8;}else{_0x418ad2=0xce;}_0x79e0b4[_0xabcc('0x18')](_0x418ad2);return _0x79e0b4[_0xabcc('0x1b')](_0xabcc('0x1c'),_0x483c6d+'-'+_0x21c2f5+'/'+_0x3673cc)[_0xabcc('0x1d')](_0x3f0402);}return null;};}function patchUpdates(_0x5a27d1){return function(_0x7b1e6d){try{jsonpatch[_0xabcc('0x1e')](_0x7b1e6d,_0x5a27d1,!![]);}catch(_0x256c42){return BPromise[_0xabcc('0x1f')](_0x256c42);}return _0x7b1e6d['save']();};}function saveUpdates(_0x65fb8f,_0x4a23c7){return function(_0xd53735){if(_0xd53735){return _0xd53735[_0xabcc('0x20')](_0x65fb8f)[_0xabcc('0x21')](function(_0x5c03e5){return _0x5c03e5;});}return null;};}function removeEntity(_0x3790e7,_0x28a083){return function(_0x507d1a){if(_0x507d1a){return _0x507d1a[_0xabcc('0x22')]()[_0xabcc('0x21')](function(){_0x3790e7['status'](0xcc)[_0xabcc('0x19')]();});}};}function handleEntityNotFound(_0x10656c,_0x13a5d0){return function(_0x4f5ddf){if(!_0x4f5ddf){_0x10656c['sendStatus'](0x194);}return _0x4f5ddf;};}function handleError(_0x52fbfd,_0x30118b){_0x30118b=_0x30118b||0x1f4;return function(_0x6ad575){logger[_0xabcc('0x23')](_0x6ad575['stack']);if(_0x6ad575['name']){delete _0x6ad575[_0xabcc('0x24')];}_0x52fbfd[_0xabcc('0x18')](_0x30118b)[_0xabcc('0x25')](_0x6ad575);};}exports['index']=function(_0x59824f,_0xadb70e){var _0x30b6bc={},_0x1a066f={},_0x293075={'count':0x0,'rows':[]};var _0x48e073=_['map'](db[_0xabcc('0x26')][_0xabcc('0x27')],function(_0x37f3d6){return{'name':_0x37f3d6['fieldName'],'type':_0x37f3d6['type'][_0xabcc('0x28')]};});_0x1a066f[_0xabcc('0x29')]=_[_0xabcc('0x2a')](_0x48e073,'name');_0x1a066f[_0xabcc('0x2b')]=_[_0xabcc('0x2c')](_0x59824f[_0xabcc('0x2b')]);_0x1a066f[_0xabcc('0x2d')]=_[_0xabcc('0x2e')](_0x1a066f[_0xabcc('0x29')],_0x1a066f[_0xabcc('0x2b')]);_0x30b6bc['attributes']=_[_0xabcc('0x2e')](_0x1a066f[_0xabcc('0x29')],qs['fields'](_0x59824f[_0xabcc('0x2b')][_0xabcc('0x2f')]));_0x30b6bc['attributes']=_0x30b6bc[_0xabcc('0x30')]['length']?_0x30b6bc[_0xabcc('0x30')]:_0x1a066f[_0xabcc('0x29')];if(!_0x59824f[_0xabcc('0x2b')]['hasOwnProperty'](_0xabcc('0x31'))){_0x30b6bc['limit']=qs['limit'](_0x59824f[_0xabcc('0x2b')][_0xabcc('0x32')]);_0x30b6bc[_0xabcc('0x1a')]=qs[_0xabcc('0x1a')](_0x59824f[_0xabcc('0x2b')]['offset']);}_0x30b6bc['order']=qs['sort'](_0x59824f[_0xabcc('0x2b')][_0xabcc('0x33')]);_0x30b6bc['where']=qs['filters'](_['pick'](_0x59824f[_0xabcc('0x2b')],_0x1a066f[_0xabcc('0x2d')]));if(_0x59824f[_0xabcc('0x2b')][_0xabcc('0x34')]){_0x30b6bc['where']=_['merge'](_0x30b6bc['where'],{'$or':_['map'](_0x48e073,function(_0x23c183){if(_0x23c183[_0xabcc('0x35')]!==_0xabcc('0x36')){var _0x7ec70a={};_0x7ec70a[_0x23c183[_0xabcc('0x24')]]={'$like':'%'+_0x59824f[_0xabcc('0x2b')]['filter']+'%'};return _0x7ec70a;}})});}_0x30b6bc=_[_0xabcc('0x37')]({},_0x30b6bc,_0x59824f[_0xabcc('0x38')]);var _0x8a9969={'where':_0x30b6bc[_0xabcc('0x39')]};return db[_0xabcc('0x26')][_0xabcc('0x3a')](_0x8a9969)[_0xabcc('0x21')](function(_0x3469f6){_0x293075[_0xabcc('0x3a')]=_0x3469f6;if(_0x59824f[_0xabcc('0x2b')][_0xabcc('0x3b')]){_0x30b6bc[_0xabcc('0x3c')]=[{'all':!![]}];}return db[_0xabcc('0x26')][_0xabcc('0x3d')](_0x30b6bc);})[_0xabcc('0x21')](function(_0x303bfd){_0x293075[_0xabcc('0x3e')]=_0x303bfd;return _0x293075;})[_0xabcc('0x21')](respondWithFilteredResult(_0xadb70e,_0x30b6bc))['catch'](handleError(_0xadb70e,null));};exports[_0xabcc('0x3f')]=function(_0x3ba24f,_0x59a71f){var _0xb9f003={'raw':!![],'where':{'id':_0x3ba24f[_0xabcc('0x40')]['id']}},_0x4be432={};_0x4be432['model']=_[_0xabcc('0x2c')](db['SmsTransferReport'][_0xabcc('0x27')]);_0x4be432['query']=_[_0xabcc('0x2c')](_0x3ba24f[_0xabcc('0x2b')]);_0x4be432[_0xabcc('0x2d')]=_['intersection'](_0x4be432[_0xabcc('0x29')],_0x4be432[_0xabcc('0x2b')]);_0xb9f003['attributes']=_['intersection'](_0x4be432[_0xabcc('0x29')],qs['fields'](_0x3ba24f['query'][_0xabcc('0x2f')]));_0xb9f003[_0xabcc('0x30')]=_0xb9f003['attributes'][_0xabcc('0x41')]?_0xb9f003['attributes']:_0x4be432[_0xabcc('0x29')];if(_0x3ba24f[_0xabcc('0x2b')]['includeAll']){_0xb9f003['include']=[{'all':!![]}];}_0xb9f003=_[_0xabcc('0x37')]({},_0xb9f003,_0x3ba24f[_0xabcc('0x38')]);return db[_0xabcc('0x26')][_0xabcc('0x42')](_0xb9f003)[_0xabcc('0x21')](handleEntityNotFound(_0x59a71f,null))[_0xabcc('0x21')](respondWithResult(_0x59a71f,null))[_0xabcc('0x43')](handleError(_0x59a71f,null));};exports['create']=function(_0x120938,_0x3b35cf){return db['SmsTransferReport'][_0xabcc('0x44')](_0x120938[_0xabcc('0x45')],{})[_0xabcc('0x21')](respondWithResult(_0x3b35cf,0xc9))[_0xabcc('0x43')](handleError(_0x3b35cf,null));};exports[_0xabcc('0x20')]=function(_0x2e924f,_0x5de4f7){if(_0x2e924f[_0xabcc('0x45')]['id']){delete _0x2e924f[_0xabcc('0x45')]['id'];}return db['SmsTransferReport'][_0xabcc('0x42')]({'where':{'id':_0x2e924f[_0xabcc('0x40')]['id']}})['then'](handleEntityNotFound(_0x5de4f7,null))[_0xabcc('0x21')](saveUpdates(_0x2e924f[_0xabcc('0x45')],null))['then'](respondWithResult(_0x5de4f7,null))[_0xabcc('0x43')](handleError(_0x5de4f7,null));};exports[_0xabcc('0x22')]=function(_0x219520,_0x25fed0){return db['SmsTransferReport'][_0xabcc('0x42')]({'where':{'id':_0x219520[_0xabcc('0x40')]['id']}})['then'](handleEntityNotFound(_0x25fed0,null))[_0xabcc('0x21')](removeEntity(_0x25fed0,null))[_0xabcc('0x43')](handleError(_0x25fed0,null));};exports[_0xabcc('0x46')]=function(_0x2d8674,_0x203069){return db[_0xabcc('0x26')]['describe']()[_0xabcc('0x21')](respondWithResult(_0x203069,null))[_0xabcc('0x43')](handleError(_0x203069,null));}; \ No newline at end of file +var _0xdea5=['eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','set','apply','reject','then','destroy','stack','name','map','SmsTransferReport','type','model','query','keys','intersection','attributes','fields','length','nolimit','limit','order','sort','where','filters','filter','VIRTUAL','merge','count','include','findAll','rows','catch','show','params','rawAttributes','includeAll','options','find','create','body','update','describe','html-pdf'];(function(_0x1bc013,_0x7771c6){var _0x55df36=function(_0x1c02e0){while(--_0x1c02e0){_0x1bc013['push'](_0x1bc013['shift']());}};_0x55df36(++_0x7771c6);}(_0xdea5,0x11b));var _0x5dea=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdea5[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0x5dea('0x0'));var emlformat=require(_0x5dea('0x1'));var rimraf=require(_0x5dea('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5dea('0x3'));var rp=require(_0x5dea('0x4'));var moment=require(_0x5dea('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x5dea('0x6'));var util=require(_0x5dea('0x7'));var path=require(_0x5dea('0x8'));var sox=require(_0x5dea('0x9'));var csv=require(_0x5dea('0xa'));var ejs=require(_0x5dea('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x5dea('0xc'));var crypto=require(_0x5dea('0xd'));var jsforce=require(_0x5dea('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5dea('0xa'));var querystring=require(_0x5dea('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5dea('0x10'));var qs=require(_0x5dea('0x11'));var as=require(_0x5dea('0x12'));var hardwareService=require(_0x5dea('0x13'));var logger=require(_0x5dea('0x14'))(_0x5dea('0x15'));var utils=require(_0x5dea('0x16'));var config=require(_0x5dea('0x17'));var db=require(_0x5dea('0x18'))['db'];function respondWithStatusCode(_0x33eb67,_0x4bd515){_0x4bd515=_0x4bd515||0xcc;return function(_0x32bdea){if(_0x32bdea){return _0x33eb67[_0x5dea('0x19')](_0x4bd515);}return _0x33eb67['status'](_0x4bd515)[_0x5dea('0x1a')]();};}function respondWithResult(_0x27dd93,_0x453451){_0x453451=_0x453451||0xc8;return function(_0x281f86){if(_0x281f86){return _0x27dd93[_0x5dea('0x1b')](_0x453451)[_0x5dea('0x1c')](_0x281f86);}};}function respondWithFilteredResult(_0x17c1d4,_0x1c6cea){return function(_0x261e26){if(_0x261e26){var _0x149bcd=_0x261e26['count'],_0x379d08=_0x1c6cea['offset'],_0x1eea5a=_0x1c6cea[_0x5dea('0x1d')]+_0x1c6cea['limit'],_0x346488;if(_0x1eea5a>=_0x149bcd){_0x1eea5a=_0x149bcd;_0x346488=0xc8;}else{_0x346488=0xce;}_0x17c1d4['status'](_0x346488);return _0x17c1d4[_0x5dea('0x1e')]('Content-Range',_0x379d08+'-'+_0x1eea5a+'/'+_0x149bcd)[_0x5dea('0x1c')](_0x261e26);}return null;};}function patchUpdates(_0x11e645){return function(_0x4a270f){try{jsonpatch[_0x5dea('0x1f')](_0x4a270f,_0x11e645,!![]);}catch(_0x3c56cb){return BPromise[_0x5dea('0x20')](_0x3c56cb);}return _0x4a270f['save']();};}function saveUpdates(_0x588823,_0x356cd8){return function(_0x36f656){if(_0x36f656){return _0x36f656['update'](_0x588823)[_0x5dea('0x21')](function(_0x5222cb){return _0x5222cb;});}return null;};}function removeEntity(_0x528d68,_0x21f9a3){return function(_0x488440){if(_0x488440){return _0x488440[_0x5dea('0x22')]()[_0x5dea('0x21')](function(){_0x528d68['status'](0xcc)[_0x5dea('0x1a')]();});}};}function handleEntityNotFound(_0x1ea717,_0x7f46f6){return function(_0x13df5d){if(!_0x13df5d){_0x1ea717['sendStatus'](0x194);}return _0x13df5d;};}function handleError(_0x15f562,_0x18c985){_0x18c985=_0x18c985||0x1f4;return function(_0x3ec3a7){logger['error'](_0x3ec3a7[_0x5dea('0x23')]);if(_0x3ec3a7[_0x5dea('0x24')]){delete _0x3ec3a7['name'];}_0x15f562[_0x5dea('0x1b')](_0x18c985)['send'](_0x3ec3a7);};}exports['index']=function(_0x420781,_0x57fdfa){var _0x253f2d={},_0x23718b={},_0x1502ec={'count':0x0,'rows':[]};var _0x3e8f65=_[_0x5dea('0x25')](db[_0x5dea('0x26')]['rawAttributes'],function(_0x2bddce){return{'name':_0x2bddce['fieldName'],'type':_0x2bddce[_0x5dea('0x27')]['key']};});_0x23718b[_0x5dea('0x28')]=_[_0x5dea('0x25')](_0x3e8f65,'name');_0x23718b[_0x5dea('0x29')]=_[_0x5dea('0x2a')](_0x420781['query']);_0x23718b['filters']=_[_0x5dea('0x2b')](_0x23718b[_0x5dea('0x28')],_0x23718b[_0x5dea('0x29')]);_0x253f2d[_0x5dea('0x2c')]=_[_0x5dea('0x2b')](_0x23718b['model'],qs['fields'](_0x420781['query'][_0x5dea('0x2d')]));_0x253f2d['attributes']=_0x253f2d[_0x5dea('0x2c')][_0x5dea('0x2e')]?_0x253f2d[_0x5dea('0x2c')]:_0x23718b[_0x5dea('0x28')];if(!_0x420781['query']['hasOwnProperty'](_0x5dea('0x2f'))){_0x253f2d[_0x5dea('0x30')]=qs[_0x5dea('0x30')](_0x420781[_0x5dea('0x29')]['limit']);_0x253f2d['offset']=qs['offset'](_0x420781[_0x5dea('0x29')][_0x5dea('0x1d')]);}_0x253f2d[_0x5dea('0x31')]=qs[_0x5dea('0x32')](_0x420781[_0x5dea('0x29')][_0x5dea('0x32')]);_0x253f2d[_0x5dea('0x33')]=qs[_0x5dea('0x34')](_['pick'](_0x420781[_0x5dea('0x29')],_0x23718b[_0x5dea('0x34')]));if(_0x420781[_0x5dea('0x29')][_0x5dea('0x35')]){_0x253f2d['where']=_['merge'](_0x253f2d[_0x5dea('0x33')],{'$or':_[_0x5dea('0x25')](_0x3e8f65,function(_0x182a8d){if(_0x182a8d[_0x5dea('0x27')]!==_0x5dea('0x36')){var _0x381991={};_0x381991[_0x182a8d[_0x5dea('0x24')]]={'$like':'%'+_0x420781['query']['filter']+'%'};return _0x381991;}})});}_0x253f2d=_[_0x5dea('0x37')]({},_0x253f2d,_0x420781['options']);var _0x4b43b5={'where':_0x253f2d[_0x5dea('0x33')]};return db[_0x5dea('0x26')]['count'](_0x4b43b5)['then'](function(_0x3dba83){_0x1502ec[_0x5dea('0x38')]=_0x3dba83;if(_0x420781['query']['includeAll']){_0x253f2d[_0x5dea('0x39')]=[{'all':!![]}];}return db['SmsTransferReport'][_0x5dea('0x3a')](_0x253f2d);})[_0x5dea('0x21')](function(_0x3aa846){_0x1502ec[_0x5dea('0x3b')]=_0x3aa846;return _0x1502ec;})[_0x5dea('0x21')](respondWithFilteredResult(_0x57fdfa,_0x253f2d))[_0x5dea('0x3c')](handleError(_0x57fdfa,null));};exports[_0x5dea('0x3d')]=function(_0x42b4f9,_0x2965d9){var _0x19c3ce={'raw':!![],'where':{'id':_0x42b4f9[_0x5dea('0x3e')]['id']}},_0x3e7aee={};_0x3e7aee[_0x5dea('0x28')]=_['keys'](db[_0x5dea('0x26')][_0x5dea('0x3f')]);_0x3e7aee[_0x5dea('0x29')]=_[_0x5dea('0x2a')](_0x42b4f9[_0x5dea('0x29')]);_0x3e7aee['filters']=_['intersection'](_0x3e7aee[_0x5dea('0x28')],_0x3e7aee['query']);_0x19c3ce['attributes']=_[_0x5dea('0x2b')](_0x3e7aee['model'],qs[_0x5dea('0x2d')](_0x42b4f9[_0x5dea('0x29')]['fields']));_0x19c3ce[_0x5dea('0x2c')]=_0x19c3ce[_0x5dea('0x2c')][_0x5dea('0x2e')]?_0x19c3ce[_0x5dea('0x2c')]:_0x3e7aee[_0x5dea('0x28')];if(_0x42b4f9[_0x5dea('0x29')][_0x5dea('0x40')]){_0x19c3ce[_0x5dea('0x39')]=[{'all':!![]}];}_0x19c3ce=_[_0x5dea('0x37')]({},_0x19c3ce,_0x42b4f9[_0x5dea('0x41')]);return db['SmsTransferReport'][_0x5dea('0x42')](_0x19c3ce)['then'](handleEntityNotFound(_0x2965d9,null))['then'](respondWithResult(_0x2965d9,null))[_0x5dea('0x3c')](handleError(_0x2965d9,null));};exports[_0x5dea('0x43')]=function(_0x5bf997,_0x3b8bf5){return db['SmsTransferReport'][_0x5dea('0x43')](_0x5bf997[_0x5dea('0x44')],{})[_0x5dea('0x21')](respondWithResult(_0x3b8bf5,0xc9))[_0x5dea('0x3c')](handleError(_0x3b8bf5,null));};exports[_0x5dea('0x45')]=function(_0x50f918,_0x73b849){if(_0x50f918[_0x5dea('0x44')]['id']){delete _0x50f918[_0x5dea('0x44')]['id'];}return db[_0x5dea('0x26')][_0x5dea('0x42')]({'where':{'id':_0x50f918['params']['id']}})['then'](handleEntityNotFound(_0x73b849,null))[_0x5dea('0x21')](saveUpdates(_0x50f918['body'],null))[_0x5dea('0x21')](respondWithResult(_0x73b849,null))[_0x5dea('0x3c')](handleError(_0x73b849,null));};exports[_0x5dea('0x22')]=function(_0x11dc7d,_0x53251b){return db['SmsTransferReport'][_0x5dea('0x42')]({'where':{'id':_0x11dc7d[_0x5dea('0x3e')]['id']}})[_0x5dea('0x21')](handleEntityNotFound(_0x53251b,null))[_0x5dea('0x21')](removeEntity(_0x53251b,null))['catch'](handleError(_0x53251b,null));};exports[_0x5dea('0x46')]=function(_0x2897c9,_0x2207ec){return db[_0x5dea('0x26')][_0x5dea('0x46')]()[_0x5dea('0x21')](respondWithResult(_0x2207ec,null))[_0x5dea('0x3c')](handleError(_0x2207ec,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index b917d8b..1a9a75c 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 _0xc7a3=['SmsTransferReport','uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports'];(function(_0x3edf90,_0x5a14d7){var _0x39cbee=function(_0x549b81){while(--_0x549b81){_0x3edf90['push'](_0x3edf90['shift']());}};_0x39cbee(++_0x5a14d7);}(_0xc7a3,0xbd));var _0x3c7a=function(_0x38c810,_0x590705){_0x38c810=_0x38c810-0x0;var _0x5f380e=_0xc7a3[_0x38c810];return _0x5f380e;};'use strict';var _=require('lodash');var util=require(_0x3c7a('0x0'));var logger=require(_0x3c7a('0x1'))(_0x3c7a('0x2'));var moment=require(_0x3c7a('0x3'));var BPromise=require(_0x3c7a('0x4'));var rp=require(_0x3c7a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3c7a('0x6'));var config=require(_0x3c7a('0x7'));var attributes=require('./smsTransferReport.attributes');module[_0x3c7a('0x8')]=function(_0x2051ce,_0x2736c1){return _0x2051ce['define'](_0x3c7a('0x9'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':_0x3c7a('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x01d9=['SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define'];(function(_0xc24832,_0x2e9083){var _0x583cbc=function(_0x297597){while(--_0x297597){_0xc24832['push'](_0xc24832['shift']());}};_0x583cbc(++_0x2e9083);}(_0x01d9,0x6c));var _0x901d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x01d9[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x901d('0x0'));var util=require(_0x901d('0x1'));var logger=require(_0x901d('0x2'))(_0x901d('0x3'));var moment=require('moment');var BPromise=require(_0x901d('0x4'));var rp=require(_0x901d('0x5'));var fs=require('fs');var path=require(_0x901d('0x6'));var rimraf=require(_0x901d('0x7'));var config=require(_0x901d('0x8'));var attributes=require(_0x901d('0x9'));module[_0x901d('0xa')]=function(_0x4e7842,_0x1e5d7d){return _0x4e7842[_0x901d('0xb')](_0x901d('0xc'),attributes,{'tableName':_0x901d('0xd'),'paranoid':![],'indexes':[{'name':_0x901d('0xe'),'fields':[_0x901d('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 637b544..d973a9a 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 _0x9b7e=['message','catch','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x4baa27,_0x41e054){var _0x506306=function(_0x3a75d3){while(--_0x3a75d3){_0x4baa27['push'](_0x4baa27['shift']());}};_0x506306(++_0x41e054);}(_0x9b7e,0xb6));var _0xe9b7=function(_0x39479f,_0x822ae4){_0x39479f=_0x39479f-0x0;var _0x4a6d96=_0x9b7e[_0x39479f];return _0x4a6d96;};'use strict';var _=require('lodash');var util=require(_0xe9b7('0x0'));var moment=require(_0xe9b7('0x1'));var BPromise=require(_0xe9b7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe9b7('0x3'))['db'];var utils=require(_0xe9b7('0x4'));var logger=require(_0xe9b7('0x5'))(_0xe9b7('0x6'));var config=require(_0xe9b7('0x7'));var jayson=require(_0xe9b7('0x8'));var client=jayson['client'][_0xe9b7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2bb18a,_0x55a30b,_0x1a9786){return new BPromise(function(_0x5692f9,_0x5cbcc6){return client[_0xe9b7('0xa')](_0x2bb18a,_0x1a9786)[_0xe9b7('0xb')](function(_0xc2118a){logger[_0xe9b7('0xc')](_0xe9b7('0xd'),_0x55a30b,_0xe9b7('0xe'));logger['debug'](_0xe9b7('0xf'),_0x55a30b,'request\x20sent',JSON[_0xe9b7('0x10')](_0xc2118a));if(_0xc2118a[_0xe9b7('0x11')]){if(_0xc2118a[_0xe9b7('0x11')]['code']===0x1f4){logger[_0xe9b7('0x11')](_0xe9b7('0xd'),_0x55a30b,_0xc2118a['error'][_0xe9b7('0x12')]);return _0x5cbcc6(_0xc2118a[_0xe9b7('0x11')][_0xe9b7('0x12')]);}logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x55a30b,_0xc2118a['error'][_0xe9b7('0x12')]);return _0x5692f9(_0xc2118a['error'][_0xe9b7('0x12')]);}else{logger['info'](_0xe9b7('0xd'),_0x55a30b,_0xe9b7('0xe'));_0x5692f9(_0xc2118a['result'][_0xe9b7('0x12')]);}})[_0xe9b7('0x13')](function(_0x223e7f){logger[_0xe9b7('0x11')](_0xe9b7('0xd'),_0x55a30b,_0x223e7f);_0x5cbcc6(_0x223e7f);});});} \ No newline at end of file +var _0x4186=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','info','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4186,0x160));var _0x6418=function(_0x2b305c,_0x5ae303){_0x2b305c=_0x2b305c-0x0;var _0x5d8c85=_0x4186[_0x2b305c];return _0x5d8c85;};'use strict';var _=require(_0x6418('0x0'));var util=require(_0x6418('0x1'));var moment=require(_0x6418('0x2'));var BPromise=require(_0x6418('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6418('0x4'));var db=require(_0x6418('0x5'))['db'];var utils=require(_0x6418('0x6'));var logger=require(_0x6418('0x7'))(_0x6418('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6418('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x473c12,_0x40383d,_0x38e92){return new BPromise(function(_0x40272,_0x53c89b){return client[_0x6418('0xa')](_0x473c12,_0x38e92)['then'](function(_0x4ab1b2){logger[_0x6418('0xb')]('SmsTransferReport,\x20%s,\x20%s',_0x40383d,_0x6418('0xc'));logger[_0x6418('0xd')](_0x6418('0xe'),_0x40383d,_0x6418('0xc'),JSON[_0x6418('0xf')](_0x4ab1b2));if(_0x4ab1b2['error']){if(_0x4ab1b2[_0x6418('0x10')][_0x6418('0x11')]===0x1f4){logger['error'](_0x6418('0x12'),_0x40383d,_0x4ab1b2['error']['message']);return _0x53c89b(_0x4ab1b2[_0x6418('0x10')][_0x6418('0x13')]);}logger['error'](_0x6418('0x12'),_0x40383d,_0x4ab1b2['error'][_0x6418('0x13')]);return _0x40272(_0x4ab1b2[_0x6418('0x10')][_0x6418('0x13')]);}else{logger[_0x6418('0xb')](_0x6418('0x12'),_0x40383d,_0x6418('0xc'));_0x40272(_0x4ab1b2[_0x6418('0x14')]['message']);}})[_0x6418('0x15')](function(_0x527708){logger[_0x6418('0x10')](_0x6418('0x12'),_0x40383d,_0x527708);_0x53c89b(_0x527708);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index c5be343..1b669e0 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 _0x3e83=['create','update','delete','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','isAuthenticated','index','/:id','show','download','join','root','server/files/sounds/original/','originalname','replace','format','now','extname','post','single','file'];(function(_0x3ae5a2,_0x5e3a20){var _0x226026=function(_0x2d9433){while(--_0x2d9433){_0x3ae5a2['push'](_0x3ae5a2['shift']());}};_0x226026(++_0x5e3a20);}(_0x3e83,0x11b));var _0x33e8=function(_0x4c19a1,_0x15197f){_0x4c19a1=_0x4c19a1-0x0;var _0x58ac50=_0x3e83[_0x4c19a1];return _0x58ac50;};'use strict';var multer=require(_0x33e8('0x0'));var util=require(_0x33e8('0x1'));var path=require(_0x33e8('0x2'));var timeout=require(_0x33e8('0x3'));var express=require(_0x33e8('0x4'));var router=express['Router']();var auth=require(_0x33e8('0x5'));var interaction=require(_0x33e8('0x6'));var config=require(_0x33e8('0x7'));var controller=require(_0x33e8('0x8'));router['get']('/',auth[_0x33e8('0x9')](),controller[_0x33e8('0xa')]);router['get'](_0x33e8('0xb'),auth[_0x33e8('0x9')](),controller[_0x33e8('0xc')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x33e8('0xd')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xcc2b14,_0x2a2146,_0xc0c203){_0xc0c203(null,path[_0x33e8('0xe')](config[_0x33e8('0xf')],_0x33e8('0x10')));},'filename':function(_0x2be5f3,_0x3c2e8a,_0x2ad22a){_0x3c2e8a[_0x33e8('0x11')]=_0x3c2e8a[_0x33e8('0x11')][_0x33e8('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2ad22a(null,util[_0x33e8('0x13')]('%s-%s%s',path['basename'](_0x3c2e8a[_0x33e8('0x11')],path['extname'](_0x3c2e8a['originalname'])),Date[_0x33e8('0x14')](),path[_0x33e8('0x15')](_0x3c2e8a['originalname'])));}})});router[_0x33e8('0x16')]('/',upload[_0x33e8('0x17')](_0x33e8('0x18')),controller[_0x33e8('0x19')]);router['put']('/:id',auth[_0x33e8('0x9')](),controller[_0x33e8('0x1a')]);router[_0x33e8('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0x33e8('0x1b')]);module['exports']=router; \ No newline at end of file +var _0xff65=['originalname','replace','basename','extname','now','single','file','create','put','update','delete','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show','join'];(function(_0x19ffb9,_0x5a8bab){var _0xf155a2=function(_0x1d6a79){while(--_0x1d6a79){_0x19ffb9['push'](_0x19ffb9['shift']());}};_0xf155a2(++_0x5a8bab);}(_0xff65,0xcb));var _0x5ff6=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xff65[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x5ff6('0x0'));var util=require(_0x5ff6('0x1'));var path=require(_0x5ff6('0x2'));var timeout=require(_0x5ff6('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x5ff6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x5ff6('0x5'));var controller=require(_0x5ff6('0x6'));router[_0x5ff6('0x7')]('/',auth[_0x5ff6('0x8')](),controller[_0x5ff6('0x9')]);router[_0x5ff6('0x7')](_0x5ff6('0xa'),auth[_0x5ff6('0x8')](),controller[_0x5ff6('0xb')]);router[_0x5ff6('0x7')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x4af87e,_0x4d193e,_0x3d334a){_0x3d334a(null,path[_0x5ff6('0xc')](config['root'],'server/files/sounds/original/'));},'filename':function(_0x37a92a,_0x37995f,_0x478423){_0x37995f['originalname']=_0x37995f[_0x5ff6('0xd')][_0x5ff6('0xe')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x478423(null,util['format']('%s-%s%s',path[_0x5ff6('0xf')](_0x37995f[_0x5ff6('0xd')],path[_0x5ff6('0x10')](_0x37995f[_0x5ff6('0xd')])),Date[_0x5ff6('0x11')](),path['extname'](_0x37995f[_0x5ff6('0xd')])));}})});router['post']('/',upload[_0x5ff6('0x12')](_0x5ff6('0x13')),controller[_0x5ff6('0x14')]);router[_0x5ff6('0x15')](_0x5ff6('0xa'),auth[_0x5ff6('0x8')](),controller[_0x5ff6('0x16')]);router[_0x5ff6('0x17')](_0x5ff6('0xa'),auth[_0x5ff6('0x8')](),controller[_0x5ff6('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index a40b5e4..bc949af 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 _0x0344=['STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x2c3a88,_0x48637e){var _0x4a7925=function(_0x15780f){while(--_0x15780f){_0x2c3a88['push'](_0x2c3a88['shift']());}};_0x4a7925(++_0x48637e);}(_0x0344,0x113));var _0x4034=function(_0x21bf1c,_0x117d24){_0x21bf1c=_0x21bf1c-0x0;var _0x458040=_0x0344[_0x21bf1c];return _0x458040;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4034('0x0')],'unique':_0x4034('0x1'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x4034('0x0')],'defaultValue':''},'description':{'type':Sequelize[_0x4034('0x0')]},'original_format':{'type':Sequelize['STRING']},'original_duration':{'type':Sequelize[_0x4034('0x2')]},'original_sampleCount':{'type':Sequelize[_0x4034('0x3')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x4034('0x3')]},'original_sampleRate':{'type':Sequelize[_0x4034('0x4')]},'converted_format':{'type':Sequelize[_0x4034('0x0')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize['BIGINT']},'converted_sampleRate':{'type':Sequelize[_0x4034('0x4')]}}; \ No newline at end of file +var _0x88d3=['BIGINT','INTEGER','exports','STRING','FLOAT'];(function(_0x2c2066,_0x586e30){var _0x6e5812=function(_0x3fe32d){while(--_0x3fe32d){_0x2c2066['push'](_0x2c2066['shift']());}};_0x6e5812(++_0x586e30);}(_0x88d3,0x156));var _0x388d=function(_0x112285,_0x52c6cc){_0x112285=_0x112285-0x0;var _0x5b7555=_0x88d3[_0x112285];return _0x5b7555;};'use strict';var Sequelize=require('sequelize');module[_0x388d('0x0')]={'name':{'type':Sequelize[_0x388d('0x1')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x388d('0x1')]},'display_name':{'type':Sequelize[_0x388d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x388d('0x1')]},'original_format':{'type':Sequelize[_0x388d('0x1')]},'original_duration':{'type':Sequelize[_0x388d('0x2')]},'original_sampleCount':{'type':Sequelize[_0x388d('0x3')]},'original_channelCount':{'type':Sequelize[_0x388d('0x4')]},'original_bitRate':{'type':Sequelize[_0x388d('0x3')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x388d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x388d('0x3')]},'converted_channelCount':{'type':Sequelize[_0x388d('0x4')]},'converted_bitRate':{'type':Sequelize[_0x388d('0x3')]},'converted_sampleRate':{'type':Sequelize[_0x388d('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index b717b2b..af00da0 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 _0x0373=['get','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','delete','original_format','html-pdf','eml-format','rimraf','request-promise','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','count','offset','set','Content-Range','json','apply','reject','save','update','then','Sounds','UserProfileResource','destroy','error','name','send','map','fieldName','type','model','query','keys','filters','attributes','intersection','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','Sound','includeAll','include','params','rawAttributes','length','find','catch','download','converted_format','existsSync','root','Sequelize','ValidationError','Sound\x20not\x20found','join','format','%s.%s','save_name','create','file','extname','originalname','filename','substring','wav','server/files/sounds/original','server/files/sounds/converted','basename','Sound\x20upload\x20filepath:\x20%s','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','src','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','role','body','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x1993d4,_0x19d988){var _0x12b9ab=function(_0x5cf627){while(--_0x5cf627){_0x1993d4['push'](_0x1993d4['shift']());}};_0x12b9ab(++_0x19d988);}(_0x0373,0x1f0));var _0x3037=function(_0x552fce,_0x3f24bc){_0x552fce=_0x552fce-0x0;var _0x3e27a2=_0x0373[_0x552fce];return _0x3e27a2;};'use strict';var pdf=require(_0x3037('0x0'));var emlformat=require(_0x3037('0x1'));var rimraf=require(_0x3037('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x3037('0x3'));var moment=require('moment');var BPromise=require(_0x3037('0x4'));var Mustache=require(_0x3037('0x5'));var util=require('util');var path=require(_0x3037('0x6'));var sox=require('sox');var csv=require(_0x3037('0x7'));var ejs=require(_0x3037('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0x3037('0x9'));var crypto=require(_0x3037('0xa'));var jsforce=require(_0x3037('0xb'));var deskjs=require(_0x3037('0xc'));var toCsv=require(_0x3037('0x7'));var querystring=require(_0x3037('0xd'));var Papa=require(_0x3037('0xe'));var Redis=require(_0x3037('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x3037('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3037('0x11'));var logger=require(_0x3037('0x12'))(_0x3037('0x13'));var utils=require(_0x3037('0x14'));var config=require(_0x3037('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x50c418,_0x21f5d2){_0x21f5d2=_0x21f5d2||0xcc;return function(_0x55d382){if(_0x55d382){return _0x50c418[_0x3037('0x16')](_0x21f5d2);}return _0x50c418[_0x3037('0x17')](_0x21f5d2)[_0x3037('0x18')]();};}function respondWithResult(_0x4ed146,_0xb84b19){_0xb84b19=_0xb84b19||0xc8;return function(_0xda348c){if(_0xda348c){return _0x4ed146[_0x3037('0x17')](_0xb84b19)['json'](_0xda348c);}};}function respondWithFilteredResult(_0x3aa58b,_0x30416b){return function(_0x4cf580){if(_0x4cf580){var _0x19d99f=_0x4cf580[_0x3037('0x19')],_0x38efdb=_0x30416b['offset'],_0x2b33ed=_0x30416b[_0x3037('0x1a')]+_0x30416b['limit'],_0x231f25;if(_0x2b33ed>=_0x19d99f){_0x2b33ed=_0x19d99f;_0x231f25=0xc8;}else{_0x231f25=0xce;}_0x3aa58b[_0x3037('0x17')](_0x231f25);return _0x3aa58b[_0x3037('0x1b')](_0x3037('0x1c'),_0x38efdb+'-'+_0x2b33ed+'/'+_0x19d99f)[_0x3037('0x1d')](_0x4cf580);}return null;};}function patchUpdates(_0xf0a8f4){return function(_0x26100a){try{jsonpatch[_0x3037('0x1e')](_0x26100a,_0xf0a8f4,!![]);}catch(_0x4d460a){return BPromise[_0x3037('0x1f')](_0x4d460a);}return _0x26100a[_0x3037('0x20')]();};}function saveUpdates(_0x16383b,_0x10ff71){return function(_0x4684f0){if(_0x4684f0){return _0x4684f0[_0x3037('0x21')](_0x16383b)[_0x3037('0x22')](function(_0x63d67){return _0x63d67;});}return null;};}function removeEntity(_0x25293f,_0x3e7671){return function(_0x19935d){if(_0x19935d){return _0x19935d['destroy']()[_0x3037('0x22')](function(){var _0x2b8341=_0x19935d['get']({'plain':!![]});var _0x16f17d=_0x3037('0x23');return db[_0x3037('0x24')][_0x3037('0x25')]({'where':{'type':_0x16f17d,'resourceId':_0x2b8341['id']}})[_0x3037('0x22')](function(){return _0x19935d;});})['then'](function(){_0x25293f[_0x3037('0x17')](0xcc)[_0x3037('0x18')]();});}};}function handleEntityNotFound(_0x54c289,_0x186218){return function(_0x58a82c){if(!_0x58a82c){_0x54c289[_0x3037('0x16')](0x194);}return _0x58a82c;};}function handleError(_0x233fad,_0x2b892d){_0x2b892d=_0x2b892d||0x1f4;return function(_0x1ded1b){logger[_0x3037('0x26')](_0x1ded1b['stack']);if(_0x1ded1b['name']){delete _0x1ded1b[_0x3037('0x27')];}_0x233fad['status'](_0x2b892d)[_0x3037('0x28')](_0x1ded1b);};}exports['index']=function(_0x38d823,_0x485eb1){var _0xa65df1={},_0x1664b6={},_0xfcc4a5={'count':0x0,'rows':[]};var _0xa2539d=_[_0x3037('0x29')](db['Sound']['rawAttributes'],function(_0x3f8ba2){return{'name':_0x3f8ba2[_0x3037('0x2a')],'type':_0x3f8ba2[_0x3037('0x2b')]['key']};});_0x1664b6[_0x3037('0x2c')]=_[_0x3037('0x29')](_0xa2539d,_0x3037('0x27'));_0x1664b6[_0x3037('0x2d')]=_[_0x3037('0x2e')](_0x38d823[_0x3037('0x2d')]);_0x1664b6[_0x3037('0x2f')]=_['intersection'](_0x1664b6[_0x3037('0x2c')],_0x1664b6[_0x3037('0x2d')]);_0xa65df1[_0x3037('0x30')]=_[_0x3037('0x31')](_0x1664b6['model'],qs['fields'](_0x38d823[_0x3037('0x2d')][_0x3037('0x32')]));_0xa65df1[_0x3037('0x30')]=_0xa65df1[_0x3037('0x30')]['length']?_0xa65df1['attributes']:_0x1664b6[_0x3037('0x2c')];if(!_0x38d823[_0x3037('0x2d')][_0x3037('0x33')](_0x3037('0x34'))){_0xa65df1[_0x3037('0x35')]=qs[_0x3037('0x35')](_0x38d823[_0x3037('0x2d')]['limit']);_0xa65df1['offset']=qs[_0x3037('0x1a')](_0x38d823[_0x3037('0x2d')][_0x3037('0x1a')]);}_0xa65df1[_0x3037('0x36')]=qs[_0x3037('0x37')](_0x38d823[_0x3037('0x2d')][_0x3037('0x37')]);_0xa65df1[_0x3037('0x38')]=qs[_0x3037('0x2f')](_[_0x3037('0x39')](_0x38d823[_0x3037('0x2d')],_0x1664b6[_0x3037('0x2f')]));if(_0x38d823['query'][_0x3037('0x3a')]){_0xa65df1['where']=_[_0x3037('0x3b')](_0xa65df1[_0x3037('0x38')],{'$or':_[_0x3037('0x29')](_0xa2539d,function(_0x54f9f4){if(_0x54f9f4[_0x3037('0x2b')]!=='VIRTUAL'){var _0x39907d={};_0x39907d[_0x54f9f4[_0x3037('0x27')]]={'$like':'%'+_0x38d823['query'][_0x3037('0x3a')]+'%'};return _0x39907d;}})});}_0xa65df1=_[_0x3037('0x3b')]({},_0xa65df1,_0x38d823[_0x3037('0x3c')]);var _0x335ca2={'where':_0xa65df1[_0x3037('0x38')]};return db[_0x3037('0x3d')][_0x3037('0x19')](_0x335ca2)['then'](function(_0x5e271b){_0xfcc4a5['count']=_0x5e271b;if(_0x38d823['query'][_0x3037('0x3e')]){_0xa65df1[_0x3037('0x3f')]=[{'all':!![]}];}return db[_0x3037('0x3d')]['findAll'](_0xa65df1);})[_0x3037('0x22')](function(_0x205550){_0xfcc4a5['rows']=_0x205550;return _0xfcc4a5;})['then'](respondWithFilteredResult(_0x485eb1,_0xa65df1))['catch'](handleError(_0x485eb1,null));};exports['show']=function(_0x1bf408,_0xab453a){var _0x3f5c38={'raw':!![],'where':{'id':_0x1bf408[_0x3037('0x40')]['id']}},_0xb1e294={};_0xb1e294['model']=_['keys'](db[_0x3037('0x3d')][_0x3037('0x41')]);_0xb1e294[_0x3037('0x2d')]=_[_0x3037('0x2e')](_0x1bf408['query']);_0xb1e294[_0x3037('0x2f')]=_[_0x3037('0x31')](_0xb1e294[_0x3037('0x2c')],_0xb1e294[_0x3037('0x2d')]);_0x3f5c38[_0x3037('0x30')]=_[_0x3037('0x31')](_0xb1e294[_0x3037('0x2c')],qs[_0x3037('0x32')](_0x1bf408[_0x3037('0x2d')][_0x3037('0x32')]));_0x3f5c38[_0x3037('0x30')]=_0x3f5c38['attributes'][_0x3037('0x42')]?_0x3f5c38['attributes']:_0xb1e294[_0x3037('0x2c')];if(_0x1bf408[_0x3037('0x2d')][_0x3037('0x3e')]){_0x3f5c38[_0x3037('0x3f')]=[{'all':!![]}];}_0x3f5c38=_[_0x3037('0x3b')]({},_0x3f5c38,_0x1bf408[_0x3037('0x3c')]);return db['Sound'][_0x3037('0x43')](_0x3f5c38)[_0x3037('0x22')](handleEntityNotFound(_0xab453a,null))[_0x3037('0x22')](respondWithResult(_0xab453a,null))[_0x3037('0x44')](handleError(_0xab453a,null));};exports[_0x3037('0x45')]=function(_0x20e4aa,_0x1a9c1e,_0xe40222){return db[_0x3037('0x3d')][_0x3037('0x43')]({'where':{'id':_0x20e4aa['params']['id']},'attributes':[_0x3037('0x27'),'save_name',_0x3037('0x46')],'raw':!![]})['then'](handleEntityNotFound(_0x1a9c1e,null))[_0x3037('0x22')](function(_0x20c28e){if(_0x20c28e){if(!fs[_0x3037('0x47')](path['join'](config[_0x3037('0x48')],'server/files/sounds/converted',_0x20c28e['save_name']+'.'+_0x20c28e[_0x3037('0x46')]))){throw new db[(_0x3037('0x49'))][(_0x3037('0x4a'))](_0x3037('0x4b'));}return _0x1a9c1e['download'](path[_0x3037('0x4c')](config[_0x3037('0x48')],'server/files/sounds/converted',util[_0x3037('0x4d')](_0x3037('0x4e'),_0x20c28e[_0x3037('0x4f')],_0x20c28e[_0x3037('0x46')])),util['format'](_0x3037('0x4e'),_0x20c28e[_0x3037('0x27')],_0x20c28e['converted_format']));}return null;})[_0x3037('0x44')](handleError(_0x1a9c1e,null));};exports[_0x3037('0x50')]=function(_0xd0cf8a,_0x24b7a0,_0x355528){var _0x41a74a={'name':path['basename'](_0xd0cf8a[_0x3037('0x51')]['originalname'],path[_0x3037('0x52')](_0xd0cf8a['file'][_0x3037('0x53')])),'save_name':path['basename'](_0xd0cf8a['file'][_0x3037('0x54')],path[_0x3037('0x52')](_0xd0cf8a[_0x3037('0x51')][_0x3037('0x54')])),'original_format':path['extname'](_0xd0cf8a['file'][_0x3037('0x53')])[_0x3037('0x55')](0x1),'converted_format':_0x3037('0x56')};var _0x830625=path['join'](config[_0x3037('0x48')],_0x3037('0x57'),_0xd0cf8a[_0x3037('0x51')][_0x3037('0x54')]);var _0x2c56bb=path[_0x3037('0x4c')](config[_0x3037('0x48')],_0x3037('0x58'),util[_0x3037('0x4d')](_0x3037('0x4e'),path[_0x3037('0x59')](_0xd0cf8a[_0x3037('0x51')][_0x3037('0x54')],path[_0x3037('0x52')](_0xd0cf8a[_0x3037('0x51')][_0x3037('0x54')])),_0x41a74a['converted_format']));logger['info'](_0x3037('0x5a'),_0x830625);logger[_0x3037('0x5b')](_0x3037('0x5c'),_0x2c56bb);try{fs[_0x3037('0x5d')](_0x830625,parseInt(_0x3037('0x5e'),0x8));var _0x4201a1=sox['transcode'](_0x830625,_0x2c56bb,{'sampleRate':0x1f40,'format':_0x3037('0x56'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4201a1['on'](_0x3037('0x26'),function(_0x4314f3){fs[_0x3037('0x5f')](_0x830625);_0x24b7a0[_0x3037('0x17')](0x1f4)['send'](_0x4314f3);});_0x4201a1['on'](_0x3037('0x60'),function(_0x509aab){_0x41a74a['original_duration']=isNaN(_0x509aab[_0x3037('0x61')])?null:_0x509aab[_0x3037('0x61')]*0x3e8;_0x41a74a[_0x3037('0x62')]=isNaN(_0x509aab[_0x3037('0x63')])?null:_0x509aab['sampleCount'];_0x41a74a[_0x3037('0x64')]=isNaN(_0x509aab[_0x3037('0x65')])?null:_0x509aab[_0x3037('0x65')];_0x41a74a[_0x3037('0x66')]=isNaN(_0x509aab['bitRate'])?null:_0x509aab[_0x3037('0x67')];_0x41a74a[_0x3037('0x68')]=isNaN(_0x509aab[_0x3037('0x69')])?null:_0x509aab[_0x3037('0x69')];});_0x4201a1['on']('dest',function(_0x10ac1e){_0x41a74a[_0x3037('0x6a')]=isNaN(_0x10ac1e[_0x3037('0x61')])?null:_0x10ac1e[_0x3037('0x61')]*0x3e8;_0x41a74a[_0x3037('0x6b')]=isNaN(_0x10ac1e[_0x3037('0x63')])?null:_0x10ac1e[_0x3037('0x63')];_0x41a74a[_0x3037('0x6c')]=isNaN(_0x10ac1e['channelCount'])?null:_0x10ac1e[_0x3037('0x65')];_0x41a74a[_0x3037('0x6d')]=isNaN(_0x10ac1e['bitRate'])?null:_0x10ac1e[_0x3037('0x67')];_0x41a74a[_0x3037('0x6e')]=isNaN(_0x10ac1e[_0x3037('0x69')])?null:_0x10ac1e[_0x3037('0x69')];});_0x4201a1['on'](_0x3037('0x18'),function(){fs[_0x3037('0x5d')](_0x2c56bb,parseInt(_0x3037('0x5e'),0x8));return db[_0x3037('0x3d')]['create'](_0x41a74a)[_0x3037('0x22')](function(_0x587c10){var _0x2d1278={'role':_0xd0cf8a['body'][_0x3037('0x6f')],'userProfileId':_0xd0cf8a[_0x3037('0x70')]['userProfileId']};if(!_0x2d1278)throw new Error(_0x3037('0x71'));if(_0x2d1278['role']==='user'){var _0xbab971=_0x587c10[_0x3037('0x72')]({'plain':!![]});return db[_0x3037('0x73')][_0x3037('0x43')]({'where':{'name':_0x3037('0x23'),'userProfileId':_0x2d1278[_0x3037('0x74')]},'raw':!![]})[_0x3037('0x22')](function(_0xa83bed){if(_0xa83bed&&_0xa83bed[_0x3037('0x75')]===0x0){return db['UserProfileResource'][_0x3037('0x50')]({'name':_0xbab971['name'],'resourceId':_0xbab971['id'],'type':_0xa83bed['name'],'sectionId':_0xa83bed['id']},{})['then'](function(){return _0x587c10;});}else{return _0x587c10;}})[_0x3037('0x44')](function(_0xb8578d){logger[_0x3037('0x26')](_0x3037('0x76'),_0xb8578d);throw _0xb8578d;});}return _0x587c10;})[_0x3037('0x22')](respondWithResult(_0x24b7a0,null))['catch'](handleError(_0x24b7a0,null));});_0x4201a1[_0x3037('0x77')]();}catch(_0x4596a5){_0x24b7a0[_0x3037('0x17')](0x1f4)[_0x3037('0x28')](_0x4596a5);}};exports[_0x3037('0x21')]=function(_0x3d8b62,_0x41b85e,_0x24d125){return db['Sound'][_0x3037('0x43')]({'where':{'id':_0x3d8b62[_0x3037('0x40')]['id']}})[_0x3037('0x22')](handleEntityNotFound(_0x41b85e,null))['then'](saveUpdates(_[_0x3037('0x39')](_0x3d8b62[_0x3037('0x70')],[_0x3037('0x27'),'description']),null))[_0x3037('0x22')](respondWithResult(_0x41b85e,null))[_0x3037('0x44')](handleError(_0x41b85e,null));};exports[_0x3037('0x78')]=function(_0x5ceb6c,_0x5b1f42,_0x445328){return db[_0x3037('0x3d')][_0x3037('0x43')]({'where':{'id':_0x5ceb6c[_0x3037('0x40')]['id']}})[_0x3037('0x22')](function(_0x5c3d4a){if(_0x5c3d4a){return _0x5c3d4a['destroy']();}})[_0x3037('0x22')](function(_0x4f1b3f){var _0xfb0c41=path[_0x3037('0x4c')](config[_0x3037('0x48')],_0x3037('0x57'),util['format'](_0x3037('0x4e'),_0x4f1b3f[_0x3037('0x4f')],_0x4f1b3f[_0x3037('0x79')]));var _0x44c524=path['join'](config['root'],_0x3037('0x58'),util[_0x3037('0x4d')](_0x3037('0x4e'),_0x4f1b3f['save_name'],_0x4f1b3f[_0x3037('0x46')]));fs[_0x3037('0x5f')](_0xfb0c41);fs['unlinkSync'](_0x44c524);return _0x4f1b3f;})[_0x3037('0x22')](function(_0x12da57){if(_0x12da57){return _0x5b1f42[_0x3037('0x17')](0xcc)[_0x3037('0x18')]();}})[_0x3037('0x22')](handleEntityNotFound(_0x5b1f42,null))[_0x3037('0x44')](handleError(_0x5b1f42,null));}; \ No newline at end of file +var _0xcaef=['server/files/sounds/converted','Sound\x20not\x20found','download','format','%s.%s','converted_format','create','file','originalname','extname','basename','filename','substring','wav','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','unlinkSync','original_duration','duration','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','description','delete','server/files/sounds/original','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../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','update','then','destroy','get','Sounds','UserProfileResource','error','stack','name','send','index','Sound','fieldName','type','key','map','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','options','include','findAll','rows','show','params','rawAttributes','find','catch','save_name','existsSync','join','root'];(function(_0x1283ad,_0x33c0e0){var _0x12afe0=function(_0x231e75){while(--_0x231e75){_0x1283ad['push'](_0x1283ad['shift']());}};_0x12afe0(++_0x33c0e0);}(_0xcaef,0x11f));var _0xfcae=function(_0x273c39,_0x1052e6){_0x273c39=_0x273c39-0x0;var _0x46d6b5=_0xcaef[_0x273c39];return _0x46d6b5;};'use strict';var pdf=require(_0xfcae('0x0'));var emlformat=require(_0xfcae('0x1'));var rimraf=require(_0xfcae('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xfcae('0x3'));var rp=require(_0xfcae('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xfcae('0x5'));var util=require(_0xfcae('0x6'));var path=require(_0xfcae('0x7'));var sox=require(_0xfcae('0x8'));var csv=require(_0xfcae('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xfcae('0xa'));var squel=require(_0xfcae('0xb'));var crypto=require(_0xfcae('0xc'));var jsforce=require(_0xfcae('0xd'));var deskjs=require(_0xfcae('0xe'));var toCsv=require(_0xfcae('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfcae('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xfcae('0x10'));var hardwareService=require(_0xfcae('0x11'));var logger=require(_0xfcae('0x12'))(_0xfcae('0x13'));var utils=require(_0xfcae('0x14'));var config=require(_0xfcae('0x15'));var db=require(_0xfcae('0x16'))['db'];function respondWithStatusCode(_0xbf3782,_0x26106c){_0x26106c=_0x26106c||0xcc;return function(_0xb9c9bf){if(_0xb9c9bf){return _0xbf3782[_0xfcae('0x17')](_0x26106c);}return _0xbf3782[_0xfcae('0x18')](_0x26106c)[_0xfcae('0x19')]();};}function respondWithResult(_0x510f22,_0x34754f){_0x34754f=_0x34754f||0xc8;return function(_0x1b5604){if(_0x1b5604){return _0x510f22[_0xfcae('0x18')](_0x34754f)['json'](_0x1b5604);}};}function respondWithFilteredResult(_0x3974ce,_0x529613){return function(_0x27a4d3){if(_0x27a4d3){var _0x5cb102=_0x27a4d3[_0xfcae('0x1a')],_0xfff88c=_0x529613[_0xfcae('0x1b')],_0x241529=_0x529613[_0xfcae('0x1b')]+_0x529613[_0xfcae('0x1c')],_0xca5403;if(_0x241529>=_0x5cb102){_0x241529=_0x5cb102;_0xca5403=0xc8;}else{_0xca5403=0xce;}_0x3974ce[_0xfcae('0x18')](_0xca5403);return _0x3974ce['set'](_0xfcae('0x1d'),_0xfff88c+'-'+_0x241529+'/'+_0x5cb102)[_0xfcae('0x1e')](_0x27a4d3);}return null;};}function patchUpdates(_0x42bcaf){return function(_0x235ad2){try{jsonpatch[_0xfcae('0x1f')](_0x235ad2,_0x42bcaf,!![]);}catch(_0x37454c){return BPromise[_0xfcae('0x20')](_0x37454c);}return _0x235ad2[_0xfcae('0x21')]();};}function saveUpdates(_0x5b8f4a,_0x173c74){return function(_0x3ea510){if(_0x3ea510){return _0x3ea510[_0xfcae('0x22')](_0x5b8f4a)[_0xfcae('0x23')](function(_0x51c660){return _0x51c660;});}return null;};}function removeEntity(_0x5090d2,_0x2e4118){return function(_0x50d8e6){if(_0x50d8e6){return _0x50d8e6[_0xfcae('0x24')]()[_0xfcae('0x23')](function(){var _0x3eca9a=_0x50d8e6[_0xfcae('0x25')]({'plain':!![]});var _0x393def=_0xfcae('0x26');return db[_0xfcae('0x27')][_0xfcae('0x24')]({'where':{'type':_0x393def,'resourceId':_0x3eca9a['id']}})[_0xfcae('0x23')](function(){return _0x50d8e6;});})[_0xfcae('0x23')](function(){_0x5090d2[_0xfcae('0x18')](0xcc)[_0xfcae('0x19')]();});}};}function handleEntityNotFound(_0x38f2bf,_0x118686){return function(_0x452f84){if(!_0x452f84){_0x38f2bf[_0xfcae('0x17')](0x194);}return _0x452f84;};}function handleError(_0x4c0606,_0x8d4723){_0x8d4723=_0x8d4723||0x1f4;return function(_0x158c83){logger[_0xfcae('0x28')](_0x158c83[_0xfcae('0x29')]);if(_0x158c83[_0xfcae('0x2a')]){delete _0x158c83['name'];}_0x4c0606[_0xfcae('0x18')](_0x8d4723)[_0xfcae('0x2b')](_0x158c83);};}exports[_0xfcae('0x2c')]=function(_0x2c8693,_0x971739){var _0x315c04={},_0x4a356f={},_0x5ce472={'count':0x0,'rows':[]};var _0x4384e7=_['map'](db[_0xfcae('0x2d')]['rawAttributes'],function(_0x3dabcc){return{'name':_0x3dabcc[_0xfcae('0x2e')],'type':_0x3dabcc[_0xfcae('0x2f')][_0xfcae('0x30')]};});_0x4a356f['model']=_[_0xfcae('0x31')](_0x4384e7,_0xfcae('0x2a'));_0x4a356f['query']=_[_0xfcae('0x32')](_0x2c8693[_0xfcae('0x33')]);_0x4a356f[_0xfcae('0x34')]=_[_0xfcae('0x35')](_0x4a356f[_0xfcae('0x36')],_0x4a356f['query']);_0x315c04[_0xfcae('0x37')]=_[_0xfcae('0x35')](_0x4a356f[_0xfcae('0x36')],qs[_0xfcae('0x38')](_0x2c8693[_0xfcae('0x33')][_0xfcae('0x38')]));_0x315c04[_0xfcae('0x37')]=_0x315c04[_0xfcae('0x37')][_0xfcae('0x39')]?_0x315c04[_0xfcae('0x37')]:_0x4a356f[_0xfcae('0x36')];if(!_0x2c8693[_0xfcae('0x33')][_0xfcae('0x3a')](_0xfcae('0x3b'))){_0x315c04[_0xfcae('0x1c')]=qs[_0xfcae('0x1c')](_0x2c8693[_0xfcae('0x33')]['limit']);_0x315c04['offset']=qs['offset'](_0x2c8693[_0xfcae('0x33')][_0xfcae('0x1b')]);}_0x315c04[_0xfcae('0x3c')]=qs[_0xfcae('0x3d')](_0x2c8693[_0xfcae('0x33')]['sort']);_0x315c04[_0xfcae('0x3e')]=qs[_0xfcae('0x34')](_[_0xfcae('0x3f')](_0x2c8693[_0xfcae('0x33')],_0x4a356f[_0xfcae('0x34')]));if(_0x2c8693[_0xfcae('0x33')]['filter']){_0x315c04[_0xfcae('0x3e')]=_[_0xfcae('0x40')](_0x315c04[_0xfcae('0x3e')],{'$or':_[_0xfcae('0x31')](_0x4384e7,function(_0x13dae6){if(_0x13dae6[_0xfcae('0x2f')]!=='VIRTUAL'){var _0x2fc78b={};_0x2fc78b[_0x13dae6[_0xfcae('0x2a')]]={'$like':'%'+_0x2c8693[_0xfcae('0x33')][_0xfcae('0x41')]+'%'};return _0x2fc78b;}})});}_0x315c04=_[_0xfcae('0x40')]({},_0x315c04,_0x2c8693[_0xfcae('0x42')]);var _0x20a509={'where':_0x315c04[_0xfcae('0x3e')]};return db['Sound']['count'](_0x20a509)[_0xfcae('0x23')](function(_0x1857ef){_0x5ce472[_0xfcae('0x1a')]=_0x1857ef;if(_0x2c8693[_0xfcae('0x33')]['includeAll']){_0x315c04[_0xfcae('0x43')]=[{'all':!![]}];}return db[_0xfcae('0x2d')][_0xfcae('0x44')](_0x315c04);})[_0xfcae('0x23')](function(_0x1f891d){_0x5ce472[_0xfcae('0x45')]=_0x1f891d;return _0x5ce472;})['then'](respondWithFilteredResult(_0x971739,_0x315c04))['catch'](handleError(_0x971739,null));};exports[_0xfcae('0x46')]=function(_0x25d566,_0x56bb3e){var _0x1f059a={'raw':!![],'where':{'id':_0x25d566[_0xfcae('0x47')]['id']}},_0x7ffd92={};_0x7ffd92[_0xfcae('0x36')]=_['keys'](db['Sound'][_0xfcae('0x48')]);_0x7ffd92['query']=_[_0xfcae('0x32')](_0x25d566[_0xfcae('0x33')]);_0x7ffd92[_0xfcae('0x34')]=_[_0xfcae('0x35')](_0x7ffd92['model'],_0x7ffd92[_0xfcae('0x33')]);_0x1f059a[_0xfcae('0x37')]=_[_0xfcae('0x35')](_0x7ffd92['model'],qs[_0xfcae('0x38')](_0x25d566[_0xfcae('0x33')]['fields']));_0x1f059a[_0xfcae('0x37')]=_0x1f059a['attributes']['length']?_0x1f059a[_0xfcae('0x37')]:_0x7ffd92[_0xfcae('0x36')];if(_0x25d566['query']['includeAll']){_0x1f059a[_0xfcae('0x43')]=[{'all':!![]}];}_0x1f059a=_[_0xfcae('0x40')]({},_0x1f059a,_0x25d566[_0xfcae('0x42')]);return db[_0xfcae('0x2d')][_0xfcae('0x49')](_0x1f059a)[_0xfcae('0x23')](handleEntityNotFound(_0x56bb3e,null))['then'](respondWithResult(_0x56bb3e,null))[_0xfcae('0x4a')](handleError(_0x56bb3e,null));};exports['download']=function(_0x320a22,_0x5b5cba,_0x3212c4){return db[_0xfcae('0x2d')][_0xfcae('0x49')]({'where':{'id':_0x320a22['params']['id']},'attributes':[_0xfcae('0x2a'),_0xfcae('0x4b'),'converted_format'],'raw':!![]})[_0xfcae('0x23')](handleEntityNotFound(_0x5b5cba,null))['then'](function(_0x21e35f){if(_0x21e35f){if(!fs[_0xfcae('0x4c')](path[_0xfcae('0x4d')](config[_0xfcae('0x4e')],_0xfcae('0x4f'),_0x21e35f[_0xfcae('0x4b')]+'.'+_0x21e35f['converted_format']))){throw new db['Sequelize']['ValidationError'](_0xfcae('0x50'));}return _0x5b5cba[_0xfcae('0x51')](path['join'](config[_0xfcae('0x4e')],_0xfcae('0x4f'),util[_0xfcae('0x52')](_0xfcae('0x53'),_0x21e35f[_0xfcae('0x4b')],_0x21e35f[_0xfcae('0x54')])),util[_0xfcae('0x52')](_0xfcae('0x53'),_0x21e35f[_0xfcae('0x2a')],_0x21e35f[_0xfcae('0x54')]));}return null;})[_0xfcae('0x4a')](handleError(_0x5b5cba,null));};exports[_0xfcae('0x55')]=function(_0x1bc2c3,_0x6d6e5f,_0xbc24cd){var _0x10c673={'name':path['basename'](_0x1bc2c3[_0xfcae('0x56')][_0xfcae('0x57')],path[_0xfcae('0x58')](_0x1bc2c3['file'][_0xfcae('0x57')])),'save_name':path[_0xfcae('0x59')](_0x1bc2c3[_0xfcae('0x56')][_0xfcae('0x5a')],path['extname'](_0x1bc2c3[_0xfcae('0x56')]['filename'])),'original_format':path[_0xfcae('0x58')](_0x1bc2c3[_0xfcae('0x56')]['originalname'])[_0xfcae('0x5b')](0x1),'converted_format':_0xfcae('0x5c')};var _0x4aebe5=path[_0xfcae('0x4d')](config[_0xfcae('0x4e')],'server/files/sounds/original',_0x1bc2c3[_0xfcae('0x56')][_0xfcae('0x5a')]);var _0x6b900d=path[_0xfcae('0x4d')](config[_0xfcae('0x4e')],_0xfcae('0x4f'),util[_0xfcae('0x52')]('%s.%s',path['basename'](_0x1bc2c3[_0xfcae('0x56')][_0xfcae('0x5a')],path['extname'](_0x1bc2c3[_0xfcae('0x56')][_0xfcae('0x5a')])),_0x10c673['converted_format']));logger[_0xfcae('0x5d')](_0xfcae('0x5e'),_0x4aebe5);logger[_0xfcae('0x5d')](_0xfcae('0x5f'),_0x6b900d);try{fs[_0xfcae('0x60')](_0x4aebe5,parseInt(_0xfcae('0x61'),0x8));var _0x26e1d8=sox['transcode'](_0x4aebe5,_0x6b900d,{'sampleRate':0x1f40,'format':_0xfcae('0x5c'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x26e1d8['on'](_0xfcae('0x28'),function(_0x2da4dd){fs[_0xfcae('0x62')](_0x4aebe5);_0x6d6e5f['status'](0x1f4)[_0xfcae('0x2b')](_0x2da4dd);});_0x26e1d8['on']('src',function(_0x5112d0){_0x10c673[_0xfcae('0x63')]=isNaN(_0x5112d0[_0xfcae('0x64')])?null:_0x5112d0[_0xfcae('0x64')]*0x3e8;_0x10c673['original_sampleCount']=isNaN(_0x5112d0['sampleCount'])?null:_0x5112d0[_0xfcae('0x65')];_0x10c673['original_channelCount']=isNaN(_0x5112d0[_0xfcae('0x66')])?null:_0x5112d0[_0xfcae('0x66')];_0x10c673[_0xfcae('0x67')]=isNaN(_0x5112d0['bitRate'])?null:_0x5112d0[_0xfcae('0x68')];_0x10c673[_0xfcae('0x69')]=isNaN(_0x5112d0[_0xfcae('0x6a')])?null:_0x5112d0['sampleRate'];});_0x26e1d8['on'](_0xfcae('0x6b'),function(_0x13e45c){_0x10c673[_0xfcae('0x6c')]=isNaN(_0x13e45c['duration'])?null:_0x13e45c['duration']*0x3e8;_0x10c673[_0xfcae('0x6d')]=isNaN(_0x13e45c[_0xfcae('0x65')])?null:_0x13e45c[_0xfcae('0x65')];_0x10c673[_0xfcae('0x6e')]=isNaN(_0x13e45c[_0xfcae('0x66')])?null:_0x13e45c[_0xfcae('0x66')];_0x10c673['converted_bitRate']=isNaN(_0x13e45c[_0xfcae('0x68')])?null:_0x13e45c['bitRate'];_0x10c673['converted_sampleRate']=isNaN(_0x13e45c[_0xfcae('0x6a')])?null:_0x13e45c[_0xfcae('0x6a')];});_0x26e1d8['on'](_0xfcae('0x19'),function(){fs['chmodSync'](_0x6b900d,parseInt(_0xfcae('0x61'),0x8));return db[_0xfcae('0x2d')][_0xfcae('0x55')](_0x10c673)[_0xfcae('0x23')](function(_0x1d6d2d){var _0x16898c={'role':_0x1bc2c3['body'][_0xfcae('0x6f')],'userProfileId':_0x1bc2c3[_0xfcae('0x70')][_0xfcae('0x71')]};if(!_0x16898c)throw new Error(_0xfcae('0x72'));if(_0x16898c[_0xfcae('0x6f')]===_0xfcae('0x73')){var _0x3d6485=_0x1d6d2d['get']({'plain':!![]});return db[_0xfcae('0x74')][_0xfcae('0x49')]({'where':{'name':_0xfcae('0x26'),'userProfileId':_0x16898c[_0xfcae('0x71')]},'raw':!![]})[_0xfcae('0x23')](function(_0x236563){if(_0x236563&&_0x236563[_0xfcae('0x75')]===0x0){return db['UserProfileResource'][_0xfcae('0x55')]({'name':_0x3d6485[_0xfcae('0x2a')],'resourceId':_0x3d6485['id'],'type':_0x236563[_0xfcae('0x2a')],'sectionId':_0x236563['id']},{})['then'](function(){return _0x1d6d2d;});}else{return _0x1d6d2d;}})['catch'](function(_0x46bcbf){logger[_0xfcae('0x28')](_0xfcae('0x76'),_0x46bcbf);throw _0x46bcbf;});}return _0x1d6d2d;})[_0xfcae('0x23')](respondWithResult(_0x6d6e5f,null))[_0xfcae('0x4a')](handleError(_0x6d6e5f,null));});_0x26e1d8['start']();}catch(_0x43f872){_0x6d6e5f['status'](0x1f4)[_0xfcae('0x2b')](_0x43f872);}};exports['update']=function(_0xdd8946,_0x178426,_0xcdd64c){return db['Sound']['find']({'where':{'id':_0xdd8946[_0xfcae('0x47')]['id']}})[_0xfcae('0x23')](handleEntityNotFound(_0x178426,null))[_0xfcae('0x23')](saveUpdates(_[_0xfcae('0x3f')](_0xdd8946[_0xfcae('0x70')],[_0xfcae('0x2a'),_0xfcae('0x77')]),null))[_0xfcae('0x23')](respondWithResult(_0x178426,null))[_0xfcae('0x4a')](handleError(_0x178426,null));};exports[_0xfcae('0x78')]=function(_0x26da7a,_0x28fff3,_0xdf88c){return db[_0xfcae('0x2d')]['find']({'where':{'id':_0x26da7a[_0xfcae('0x47')]['id']}})['then'](function(_0x4217e8){if(_0x4217e8){return _0x4217e8[_0xfcae('0x24')]();}})[_0xfcae('0x23')](function(_0x902ed1){var _0xd68a68=path[_0xfcae('0x4d')](config[_0xfcae('0x4e')],_0xfcae('0x79'),util[_0xfcae('0x52')](_0xfcae('0x53'),_0x902ed1[_0xfcae('0x4b')],_0x902ed1['original_format']));var _0x3f9d0c=path['join'](config[_0xfcae('0x4e')],_0xfcae('0x4f'),util[_0xfcae('0x52')](_0xfcae('0x53'),_0x902ed1[_0xfcae('0x4b')],_0x902ed1[_0xfcae('0x54')]));fs[_0xfcae('0x62')](_0xd68a68);fs['unlinkSync'](_0x3f9d0c);return _0x902ed1;})['then'](function(_0x25cf9d){if(_0x25cf9d){return _0x28fff3[_0xfcae('0x18')](0xcc)[_0xfcae('0x19')]();}})[_0xfcae('0x23')](handleEntityNotFound(_0x28fff3,null))['catch'](handleError(_0x28fff3,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 052adc5..462d6c3 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 _0x85d1=['api','bluebird','request-promise','path','./sound.attributes','exports','define','Sound','tools_sounds','lodash','util','../../config/logger'];(function(_0x33c1b1,_0x2355fb){var _0x2c2037=function(_0x1200fd){while(--_0x1200fd){_0x33c1b1['push'](_0x33c1b1['shift']());}};_0x2c2037(++_0x2355fb);}(_0x85d1,0x165));var _0x185d=function(_0x295583,_0x4756aa){_0x295583=_0x295583-0x0;var _0x4c2ae6=_0x85d1[_0x295583];return _0x4c2ae6;};'use strict';var _=require(_0x185d('0x0'));var util=require(_0x185d('0x1'));var logger=require(_0x185d('0x2'))(_0x185d('0x3'));var moment=require('moment');var BPromise=require(_0x185d('0x4'));var rp=require(_0x185d('0x5'));var fs=require('fs');var path=require(_0x185d('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x185d('0x7'));module[_0x185d('0x8')]=function(_0x3d470f,_0x405184){return _0x3d470f[_0x185d('0x9')](_0x185d('0xa'),attributes,{'tableName':_0x185d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6c83=['rimraf','../../config/environment','./sound.attributes','define','Sound','tools_sounds','lodash','../../config/logger','api','moment','bluebird','path'];(function(_0x5d219d,_0x1b1e9c){var _0xd22c88=function(_0x4ab87e){while(--_0x4ab87e){_0x5d219d['push'](_0x5d219d['shift']());}};_0xd22c88(++_0x1b1e9c);}(_0x6c83,0x1f2));var _0x36c8=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6c83[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x36c8('0x0'));var util=require('util');var logger=require(_0x36c8('0x1'))(_0x36c8('0x2'));var moment=require(_0x36c8('0x3'));var BPromise=require(_0x36c8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x36c8('0x5'));var rimraf=require(_0x36c8('0x6'));var config=require(_0x36c8('0x7'));var attributes=require(_0x36c8('0x8'));module['exports']=function(_0x4aaa62,_0x2d3014){return _0x4aaa62[_0x36c8('0x9')](_0x36c8('0xa'),attributes,{'tableName':_0x36c8('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 adc8c19..183705e 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 _0x908c=['options','raw','where','attributes','model','include','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Sound,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','catch','ShowSound','Sound','find'];(function(_0x2fa931,_0x63006f){var _0x28ceae=function(_0x3ebea9){while(--_0x3ebea9){_0x2fa931['push'](_0x2fa931['shift']());}};_0x28ceae(++_0x63006f);}(_0x908c,0x127));var _0xc908=function(_0x5dfdf3,_0x1606df){_0x5dfdf3=_0x5dfdf3-0x0;var _0x4b9edc=_0x908c[_0x5dfdf3];return _0x4b9edc;};'use strict';var _=require('lodash');var util=require(_0xc908('0x0'));var moment=require(_0xc908('0x1'));var BPromise=require(_0xc908('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc908('0x3'));var db=require(_0xc908('0x4'))['db'];var utils=require(_0xc908('0x5'));var logger=require(_0xc908('0x6'))(_0xc908('0x7'));var config=require(_0xc908('0x8'));var jayson=require(_0xc908('0x9'));var client=jayson[_0xc908('0xa')][_0xc908('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xcf41cf,_0x16633c,_0xbf2e41){return new BPromise(function(_0xb603e9,_0x3b5566){return client[_0xc908('0xc')](_0xcf41cf,_0xbf2e41)['then'](function(_0xc60a29){logger[_0xc908('0xd')](_0xc908('0xe'),_0x16633c,'request\x20sent');logger[_0xc908('0xf')]('Sound,\x20%s,\x20%s,\x20%s',_0x16633c,_0xc908('0x10'),JSON[_0xc908('0x11')](_0xc60a29));if(_0xc60a29['error']){if(_0xc60a29[_0xc908('0x12')]['code']===0x1f4){logger['error'](_0xc908('0xe'),_0x16633c,_0xc60a29[_0xc908('0x12')][_0xc908('0x13')]);return _0x3b5566(_0xc60a29[_0xc908('0x12')]['message']);}logger[_0xc908('0x12')](_0xc908('0xe'),_0x16633c,_0xc60a29[_0xc908('0x12')][_0xc908('0x13')]);return _0xb603e9(_0xc60a29[_0xc908('0x12')][_0xc908('0x13')]);}else{logger[_0xc908('0xd')](_0xc908('0xe'),_0x16633c,_0xc908('0x10'));_0xb603e9(_0xc60a29[_0xc908('0x14')][_0xc908('0x13')]);}})[_0xc908('0x15')](function(_0x1dad92){logger[_0xc908('0x12')](_0xc908('0xe'),_0x16633c,_0x1dad92);_0x3b5566(_0x1dad92);});});}exports[_0xc908('0x16')]=function(_0x4c3120){var _0x1158b5=this;return new Promise(function(_0x29bf7a,_0x3d10f8){return db[_0xc908('0x17')][_0xc908('0x18')]({'raw':_0x4c3120[_0xc908('0x19')]?_0x4c3120[_0xc908('0x19')][_0xc908('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c3120[_0xc908('0x19')]?_0x4c3120[_0xc908('0x19')][_0xc908('0x1b')]||null:null,'attributes':_0x4c3120[_0xc908('0x19')]?_0x4c3120[_0xc908('0x19')][_0xc908('0x1c')]||null:null,'include':_0x4c3120[_0xc908('0x19')]?_0x4c3120['options']['include']?_['map'](_0x4c3120[_0xc908('0x19')]['include'],function(_0x193602){return{'model':db[_0x193602[_0xc908('0x1d')]],'as':_0x193602['as'],'attributes':_0x193602[_0xc908('0x1c')],'include':_0x193602[_0xc908('0x1e')]?_[_0xc908('0x1f')](_0x193602[_0xc908('0x1e')],function(_0x609979){return{'model':db[_0x609979[_0xc908('0x1d')]],'as':_0x609979['as'],'attributes':_0x609979[_0xc908('0x1c')],'include':_0x609979[_0xc908('0x1e')]?_[_0xc908('0x1f')](_0x609979[_0xc908('0x1e')],function(_0x2bb6b3){return{'model':db[_0x2bb6b3[_0xc908('0x1d')]],'as':_0x2bb6b3['as'],'attributes':_0x2bb6b3[_0xc908('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4af7df){logger[_0xc908('0xd')](_0xc908('0x16'),_0x4c3120);logger[_0xc908('0xf')](_0xc908('0x16'),_0x4c3120,JSON[_0xc908('0x11')](_0x4af7df));_0x29bf7a(_0x4af7df);})['catch'](function(_0x54e071){logger[_0xc908('0x12')](_0xc908('0x16'),_0x54e071[_0xc908('0x13')],_0x4c3120);_0x3d10f8(_0x1158b5[_0xc908('0x12')](0x1f4,_0x54e071['message']));});});}; \ No newline at end of file +var _0xc5b8=['Sound,\x20%s,\x20%s,\x20%s','error','message','result','ShowSound','find','options','raw','where','attributes','include','map','model','stringify','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc5b8,0x1bc));var _0x8c5b=function(_0x4aac5a,_0x15b04c){_0x4aac5a=_0x4aac5a-0x0;var _0x42e7bc=_0xc5b8[_0x4aac5a];return _0x42e7bc;};'use strict';var _=require(_0x8c5b('0x0'));var util=require(_0x8c5b('0x1'));var moment=require(_0x8c5b('0x2'));var BPromise=require(_0x8c5b('0x3'));var rs=require(_0x8c5b('0x4'));var fs=require('fs');var Redis=require(_0x8c5b('0x5'));var db=require(_0x8c5b('0x6'))['db'];var utils=require(_0x8c5b('0x7'));var logger=require(_0x8c5b('0x8'))(_0x8c5b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8c5b('0xa')][_0x8c5b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x32b155,_0x203bbe,_0x29c740){return new BPromise(function(_0x41cf92,_0x22bd3b){return client[_0x8c5b('0xc')](_0x32b155,_0x29c740)[_0x8c5b('0xd')](function(_0x4acfa4){logger[_0x8c5b('0xe')](_0x8c5b('0xf'),_0x203bbe,_0x8c5b('0x10'));logger[_0x8c5b('0x11')](_0x8c5b('0x12'),_0x203bbe,_0x8c5b('0x10'),JSON['stringify'](_0x4acfa4));if(_0x4acfa4[_0x8c5b('0x13')]){if(_0x4acfa4[_0x8c5b('0x13')]['code']===0x1f4){logger[_0x8c5b('0x13')](_0x8c5b('0xf'),_0x203bbe,_0x4acfa4[_0x8c5b('0x13')][_0x8c5b('0x14')]);return _0x22bd3b(_0x4acfa4[_0x8c5b('0x13')][_0x8c5b('0x14')]);}logger[_0x8c5b('0x13')](_0x8c5b('0xf'),_0x203bbe,_0x4acfa4[_0x8c5b('0x13')][_0x8c5b('0x14')]);return _0x41cf92(_0x4acfa4['error'][_0x8c5b('0x14')]);}else{logger[_0x8c5b('0xe')]('Sound,\x20%s,\x20%s',_0x203bbe,_0x8c5b('0x10'));_0x41cf92(_0x4acfa4[_0x8c5b('0x15')]['message']);}})['catch'](function(_0x446cd4){logger[_0x8c5b('0x13')](_0x8c5b('0xf'),_0x203bbe,_0x446cd4);_0x22bd3b(_0x446cd4);});});}exports[_0x8c5b('0x16')]=function(_0x13c90b){var _0x241553=this;return new Promise(function(_0x3bc136,_0x9d209){return db['Sound'][_0x8c5b('0x17')]({'raw':_0x13c90b[_0x8c5b('0x18')]?_0x13c90b[_0x8c5b('0x18')][_0x8c5b('0x19')]===undefined?!![]:![]:!![],'where':_0x13c90b[_0x8c5b('0x18')]?_0x13c90b[_0x8c5b('0x18')][_0x8c5b('0x1a')]||null:null,'attributes':_0x13c90b[_0x8c5b('0x18')]?_0x13c90b[_0x8c5b('0x18')][_0x8c5b('0x1b')]||null:null,'include':_0x13c90b[_0x8c5b('0x18')]?_0x13c90b[_0x8c5b('0x18')][_0x8c5b('0x1c')]?_[_0x8c5b('0x1d')](_0x13c90b[_0x8c5b('0x18')][_0x8c5b('0x1c')],function(_0x353ef6){return{'model':db[_0x353ef6[_0x8c5b('0x1e')]],'as':_0x353ef6['as'],'attributes':_0x353ef6[_0x8c5b('0x1b')],'include':_0x353ef6[_0x8c5b('0x1c')]?_[_0x8c5b('0x1d')](_0x353ef6[_0x8c5b('0x1c')],function(_0x4c30e3){return{'model':db[_0x4c30e3[_0x8c5b('0x1e')]],'as':_0x4c30e3['as'],'attributes':_0x4c30e3[_0x8c5b('0x1b')],'include':_0x4c30e3[_0x8c5b('0x1c')]?_[_0x8c5b('0x1d')](_0x4c30e3[_0x8c5b('0x1c')],function(_0x36fbd4){return{'model':db[_0x36fbd4[_0x8c5b('0x1e')]],'as':_0x36fbd4['as'],'attributes':_0x36fbd4[_0x8c5b('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8c5b('0xd')](function(_0x529563){logger[_0x8c5b('0xe')](_0x8c5b('0x16'),_0x13c90b);logger[_0x8c5b('0x11')](_0x8c5b('0x16'),_0x13c90b,JSON[_0x8c5b('0x1f')](_0x529563));_0x3bc136(_0x529563);})[_0x8c5b('0x20')](function(_0x2e62ae){logger[_0x8c5b('0x13')](_0x8c5b('0x16'),_0x2e62ae[_0x8c5b('0x14')],_0x13c90b);_0x9d209(_0x241553[_0x8c5b('0x13')](0x1f4,_0x2e62ae[_0x8c5b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index da7e086..1d38c9d 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 _0x3bb5=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','show','post','create','put','/:id','delete','util'];(function(_0x2836df,_0x391935){var _0x45c293=function(_0x1de626){while(--_0x1de626){_0x2836df['push'](_0x2836df['shift']());}};_0x45c293(++_0x391935);}(_0x3bb5,0x1cf));var _0x53bb=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x3bb5[_0x2235bf];return _0x4c3a64;};'use strict';var multer=require('multer');var util=require(_0x53bb('0x0'));var path=require(_0x53bb('0x1'));var timeout=require(_0x53bb('0x2'));var express=require(_0x53bb('0x3'));var router=express[_0x53bb('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x53bb('0x5'));var config=require(_0x53bb('0x6'));var controller=require(_0x53bb('0x7'));router[_0x53bb('0x8')]('/',auth[_0x53bb('0x9')](),controller['index']);router[_0x53bb('0x8')]('/:id',auth[_0x53bb('0x9')](),controller[_0x53bb('0xa')]);router[_0x53bb('0xb')]('/',auth['isAuthenticated'](),controller[_0x53bb('0xc')]);router[_0x53bb('0xd')](_0x53bb('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x53bb('0xf')]('/:id',auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1982=['/:id','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','index','isAuthenticated','show','post','create','put'];(function(_0x59aad5,_0x7350b3){var _0x3e30f9=function(_0x33a693){while(--_0x33a693){_0x59aad5['push'](_0x59aad5['shift']());}};_0x3e30f9(++_0x7350b3);}(_0x1982,0xd5));var _0x2198=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1982[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x2198('0x0'));var util=require('util');var path=require(_0x2198('0x1'));var timeout=require(_0x2198('0x2'));var express=require(_0x2198('0x3'));var router=express[_0x2198('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2198('0x5'));var config=require(_0x2198('0x6'));var controller=require(_0x2198('0x7'));router[_0x2198('0x8')]('/',auth['isAuthenticated'](),controller[_0x2198('0x9')]);router[_0x2198('0x8')]('/:id',auth[_0x2198('0xa')](),controller[_0x2198('0xb')]);router[_0x2198('0xc')]('/',auth[_0x2198('0xa')](),controller[_0x2198('0xd')]);router[_0x2198('0xe')](_0x2198('0xf'),auth[_0x2198('0xa')](),controller[_0x2198('0x10')]);router[_0x2198('0x11')](_0x2198('0xf'),auth[_0x2198('0xa')](),controller['destroy']);module[_0x2198('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 241450e..4a8b86a 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 _0x1b72=['out','sequelize','exports','STRING','ENUM'];(function(_0x12d66d,_0x5c72bf){var _0x3fb345=function(_0x2b32d9){while(--_0x2b32d9){_0x12d66d['push'](_0x12d66d['shift']());}};_0x3fb345(++_0x5c72bf);}(_0x1b72,0x100));var _0x21b7=function(_0x2aec52,_0x59d962){_0x2aec52=_0x2aec52-0x0;var _0x3b8835=_0x1b72[_0x2aec52];return _0x3b8835;};'use strict';var Sequelize=require(_0x21b7('0x0'));module[_0x21b7('0x1')]={'uniqueid':{'type':Sequelize[_0x21b7('0x2')]},'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x21b7('0x3')]('in',_0x21b7('0x4')),'defaultValue':_0x21b7('0x4'),'allowNull':![]}}; \ No newline at end of file +var _0xe088=['medium','out','sequelize','TEXT'];(function(_0x2ec695,_0x3ff6e9){var _0x3b4614=function(_0x2601f3){while(--_0x2601f3){_0x2ec695['push'](_0x2ec695['shift']());}};_0x3b4614(++_0x3ff6e9);}(_0xe088,0x152));var _0x8e08=function(_0x184759,_0x1cc38a){_0x184759=_0x184759-0x0;var _0xf26d5f=_0xe088[_0x184759];return _0xf26d5f;};'use strict';var Sequelize=require(_0x8e08('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING']},'body':{'type':Sequelize[_0x8e08('0x1')](_0x8e08('0x2')),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0x8e08('0x3')),'defaultValue':_0x8e08('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 607bdfd..bd7784d 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 _0x75ea=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','destroy','error','stack','name','index','map','SquareMessage','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','then','includeAll','include','findAll','rows','catch','params','keys','rawAttributes','options','create','body','find','html-pdf','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','../../components/auth/service'];(function(_0x3778d8,_0x5ce417){var _0x45a1b3=function(_0x28488a){while(--_0x28488a){_0x3778d8['push'](_0x3778d8['shift']());}};_0x45a1b3(++_0x5ce417);}(_0x75ea,0x7d));var _0xa75e=function(_0x8d5c76,_0x5cc0d4){_0x8d5c76=_0x8d5c76-0x0;var _0x44fc55=_0x75ea[_0x8d5c76];return _0x44fc55;};'use strict';var pdf=require(_0xa75e('0x0'));var emlformat=require(_0xa75e('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa75e('0x2'));var jsonpatch=require(_0xa75e('0x3'));var rp=require('request-promise');var moment=require(_0xa75e('0x4'));var BPromise=require(_0xa75e('0x5'));var Mustache=require(_0xa75e('0x6'));var util=require(_0xa75e('0x7'));var path=require(_0xa75e('0x8'));var sox=require('sox');var csv=require(_0xa75e('0x9'));var ejs=require(_0xa75e('0xa'));var fs=require('fs');var _=require(_0xa75e('0xb'));var squel=require(_0xa75e('0xc'));var crypto=require(_0xa75e('0xd'));var jsforce=require(_0xa75e('0xe'));var deskjs=require(_0xa75e('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa75e('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xa75e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa75e('0x12'))(_0xa75e('0x13'));var utils=require('../../config/utils');var config=require(_0xa75e('0x14'));var db=require(_0xa75e('0x15'))['db'];function respondWithStatusCode(_0x38dce8,_0x35c81b){_0x35c81b=_0x35c81b||0xcc;return function(_0x46d808){if(_0x46d808){return _0x38dce8[_0xa75e('0x16')](_0x35c81b);}return _0x38dce8[_0xa75e('0x17')](_0x35c81b)[_0xa75e('0x18')]();};}function respondWithResult(_0x3f6719,_0x5319e2){_0x5319e2=_0x5319e2||0xc8;return function(_0x171e67){if(_0x171e67){return _0x3f6719['status'](_0x5319e2)[_0xa75e('0x19')](_0x171e67);}};}function respondWithFilteredResult(_0x10a205,_0x530c38){return function(_0x235860){if(_0x235860){var _0x3179e2=_0x235860[_0xa75e('0x1a')],_0x1d78ce=_0x530c38[_0xa75e('0x1b')],_0x49cbf7=_0x530c38[_0xa75e('0x1b')]+_0x530c38[_0xa75e('0x1c')],_0xb55a6f;if(_0x49cbf7>=_0x3179e2){_0x49cbf7=_0x3179e2;_0xb55a6f=0xc8;}else{_0xb55a6f=0xce;}_0x10a205[_0xa75e('0x17')](_0xb55a6f);return _0x10a205[_0xa75e('0x1d')](_0xa75e('0x1e'),_0x1d78ce+'-'+_0x49cbf7+'/'+_0x3179e2)['json'](_0x235860);}return null;};}function patchUpdates(_0x280491){return function(_0xb8f964){try{jsonpatch[_0xa75e('0x1f')](_0xb8f964,_0x280491,!![]);}catch(_0x4e0fea){return BPromise['reject'](_0x4e0fea);}return _0xb8f964[_0xa75e('0x20')]();};}function saveUpdates(_0x5c14c0,_0x47b19c){return function(_0x4e0809){if(_0x4e0809){return _0x4e0809[_0xa75e('0x21')](_0x5c14c0)['then'](function(_0x2e4f8c){return _0x2e4f8c;});}return null;};}function removeEntity(_0x5da171,_0x32766b){return function(_0x38b3ad){if(_0x38b3ad){return _0x38b3ad[_0xa75e('0x22')]()['then'](function(){_0x5da171[_0xa75e('0x17')](0xcc)[_0xa75e('0x18')]();});}};}function handleEntityNotFound(_0x158caa,_0x4e64aa){return function(_0x227d81){if(!_0x227d81){_0x158caa[_0xa75e('0x16')](0x194);}return _0x227d81;};}function handleError(_0x1faeab,_0x9add90){_0x9add90=_0x9add90||0x1f4;return function(_0x117e25){logger[_0xa75e('0x23')](_0x117e25[_0xa75e('0x24')]);if(_0x117e25[_0xa75e('0x25')]){delete _0x117e25[_0xa75e('0x25')];}_0x1faeab['status'](_0x9add90)['send'](_0x117e25);};}exports[_0xa75e('0x26')]=function(_0x3273d6,_0x58bfef){var _0x909d5b={},_0x316197={},_0xdb92a2={'count':0x0,'rows':[]};var _0x23f5ce=_[_0xa75e('0x27')](db[_0xa75e('0x28')]['rawAttributes'],function(_0x455b8a){return{'name':_0x455b8a[_0xa75e('0x29')],'type':_0x455b8a[_0xa75e('0x2a')][_0xa75e('0x2b')]};});_0x316197[_0xa75e('0x2c')]=_['map'](_0x23f5ce,_0xa75e('0x25'));_0x316197['query']=_['keys'](_0x3273d6[_0xa75e('0x2d')]);_0x316197[_0xa75e('0x2e')]=_[_0xa75e('0x2f')](_0x316197[_0xa75e('0x2c')],_0x316197[_0xa75e('0x2d')]);_0x909d5b[_0xa75e('0x30')]=_[_0xa75e('0x2f')](_0x316197[_0xa75e('0x2c')],qs[_0xa75e('0x31')](_0x3273d6[_0xa75e('0x2d')][_0xa75e('0x31')]));_0x909d5b[_0xa75e('0x30')]=_0x909d5b[_0xa75e('0x30')]['length']?_0x909d5b[_0xa75e('0x30')]:_0x316197[_0xa75e('0x2c')];if(!_0x3273d6[_0xa75e('0x2d')][_0xa75e('0x32')](_0xa75e('0x33'))){_0x909d5b[_0xa75e('0x1c')]=qs['limit'](_0x3273d6['query']['limit']);_0x909d5b[_0xa75e('0x1b')]=qs['offset'](_0x3273d6['query'][_0xa75e('0x1b')]);}_0x909d5b['order']=qs[_0xa75e('0x34')](_0x3273d6[_0xa75e('0x2d')][_0xa75e('0x34')]);_0x909d5b[_0xa75e('0x35')]=qs['filters'](_[_0xa75e('0x36')](_0x3273d6[_0xa75e('0x2d')],_0x316197[_0xa75e('0x2e')]));if(_0x3273d6['query']['filter']){_0x909d5b[_0xa75e('0x35')]=_[_0xa75e('0x37')](_0x909d5b['where'],{'$or':_[_0xa75e('0x27')](_0x23f5ce,function(_0x1b065b){if(_0x1b065b['type']!==_0xa75e('0x38')){var _0x140464={};_0x140464[_0x1b065b['name']]={'$like':'%'+_0x3273d6[_0xa75e('0x2d')][_0xa75e('0x39')]+'%'};return _0x140464;}})});}_0x909d5b=_[_0xa75e('0x37')]({},_0x909d5b,_0x3273d6['options']);var _0x353744={'where':_0x909d5b[_0xa75e('0x35')]};return db[_0xa75e('0x28')][_0xa75e('0x1a')](_0x353744)[_0xa75e('0x3a')](function(_0x509cfb){_0xdb92a2[_0xa75e('0x1a')]=_0x509cfb;if(_0x3273d6['query'][_0xa75e('0x3b')]){_0x909d5b[_0xa75e('0x3c')]=[{'all':!![]}];}return db[_0xa75e('0x28')][_0xa75e('0x3d')](_0x909d5b);})[_0xa75e('0x3a')](function(_0x49f697){_0xdb92a2[_0xa75e('0x3e')]=_0x49f697;return _0xdb92a2;})[_0xa75e('0x3a')](respondWithFilteredResult(_0x58bfef,_0x909d5b))[_0xa75e('0x3f')](handleError(_0x58bfef,null));};exports['show']=function(_0x367d2c,_0x11e3ed){var _0x5988b7={'raw':!![],'where':{'id':_0x367d2c[_0xa75e('0x40')]['id']}},_0x153d2f={};_0x153d2f['model']=_[_0xa75e('0x41')](db[_0xa75e('0x28')][_0xa75e('0x42')]);_0x153d2f[_0xa75e('0x2d')]=_[_0xa75e('0x41')](_0x367d2c[_0xa75e('0x2d')]);_0x153d2f['filters']=_[_0xa75e('0x2f')](_0x153d2f[_0xa75e('0x2c')],_0x153d2f[_0xa75e('0x2d')]);_0x5988b7[_0xa75e('0x30')]=_['intersection'](_0x153d2f['model'],qs['fields'](_0x367d2c[_0xa75e('0x2d')][_0xa75e('0x31')]));_0x5988b7[_0xa75e('0x30')]=_0x5988b7[_0xa75e('0x30')]['length']?_0x5988b7[_0xa75e('0x30')]:_0x153d2f['model'];if(_0x367d2c[_0xa75e('0x2d')][_0xa75e('0x3b')]){_0x5988b7[_0xa75e('0x3c')]=[{'all':!![]}];}_0x5988b7=_['merge']({},_0x5988b7,_0x367d2c[_0xa75e('0x43')]);return db[_0xa75e('0x28')]['find'](_0x5988b7)[_0xa75e('0x3a')](handleEntityNotFound(_0x11e3ed,null))[_0xa75e('0x3a')](respondWithResult(_0x11e3ed,null))[_0xa75e('0x3f')](handleError(_0x11e3ed,null));};exports[_0xa75e('0x44')]=function(_0x598900,_0x2a8e32){return db[_0xa75e('0x28')][_0xa75e('0x44')](_0x598900[_0xa75e('0x45')],{})['then'](respondWithResult(_0x2a8e32,0xc9))[_0xa75e('0x3f')](handleError(_0x2a8e32,null));};exports['update']=function(_0x427a20,_0x240b83){if(_0x427a20[_0xa75e('0x45')]['id']){delete _0x427a20['body']['id'];}return db[_0xa75e('0x28')][_0xa75e('0x46')]({'where':{'id':_0x427a20[_0xa75e('0x40')]['id']}})['then'](handleEntityNotFound(_0x240b83,null))[_0xa75e('0x3a')](saveUpdates(_0x427a20[_0xa75e('0x45')],null))[_0xa75e('0x3a')](respondWithResult(_0x240b83,null))['catch'](handleError(_0x240b83,null));};exports[_0xa75e('0x22')]=function(_0x56f300,_0x4462d0){return db[_0xa75e('0x28')][_0xa75e('0x46')]({'where':{'id':_0x56f300['params']['id']}})[_0xa75e('0x3a')](handleEntityNotFound(_0x4462d0,null))[_0xa75e('0x3a')](removeEntity(_0x4462d0,null))['catch'](handleError(_0x4462d0,null));}; \ No newline at end of file +var _0x9ed4=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','limit','set','Content-Range','json','apply','reject','save','update','then','destroy','stack','name','send','index','map','SquareMessage','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','offset','sort','where','pick','merge','filter','options','includeAll','include','rows','catch','find','create','body','html-pdf','eml-format','rimraf'];(function(_0x18f0bd,_0x2675c3){var _0x314678=function(_0x558bff){while(--_0x558bff){_0x18f0bd['push'](_0x18f0bd['shift']());}};_0x314678(++_0x2675c3);}(_0x9ed4,0x1a7));var _0x49ed=function(_0x2ce794,_0x32c04c){_0x2ce794=_0x2ce794-0x0;var _0x1c3067=_0x9ed4[_0x2ce794];return _0x1c3067;};'use strict';var pdf=require(_0x49ed('0x0'));var emlformat=require(_0x49ed('0x1'));var rimraf=require(_0x49ed('0x2'));var zipdir=require(_0x49ed('0x3'));var jsonpatch=require(_0x49ed('0x4'));var rp=require(_0x49ed('0x5'));var moment=require(_0x49ed('0x6'));var BPromise=require(_0x49ed('0x7'));var Mustache=require(_0x49ed('0x8'));var util=require(_0x49ed('0x9'));var path=require(_0x49ed('0xa'));var sox=require('sox');var csv=require(_0x49ed('0xb'));var ejs=require(_0x49ed('0xc'));var fs=require('fs');var _=require(_0x49ed('0xd'));var squel=require(_0x49ed('0xe'));var crypto=require(_0x49ed('0xf'));var jsforce=require(_0x49ed('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49ed('0x11'));var Redis=require('ioredis');var authService=require(_0x49ed('0x12'));var qs=require(_0x49ed('0x13'));var as=require(_0x49ed('0x14'));var hardwareService=require(_0x49ed('0x15'));var logger=require(_0x49ed('0x16'))(_0x49ed('0x17'));var utils=require(_0x49ed('0x18'));var config=require(_0x49ed('0x19'));var db=require(_0x49ed('0x1a'))['db'];function respondWithStatusCode(_0x318263,_0x45701a){_0x45701a=_0x45701a||0xcc;return function(_0xfa7166){if(_0xfa7166){return _0x318263[_0x49ed('0x1b')](_0x45701a);}return _0x318263[_0x49ed('0x1c')](_0x45701a)['end']();};}function respondWithResult(_0x34bd88,_0x243361){_0x243361=_0x243361||0xc8;return function(_0x1f187b){if(_0x1f187b){return _0x34bd88[_0x49ed('0x1c')](_0x243361)['json'](_0x1f187b);}};}function respondWithFilteredResult(_0x5c1897,_0xb263e1){return function(_0x511674){if(_0x511674){var _0x5b8e91=_0x511674[_0x49ed('0x1d')],_0x3b50aa=_0xb263e1['offset'],_0xed3cc1=_0xb263e1['offset']+_0xb263e1[_0x49ed('0x1e')],_0x3e78a5;if(_0xed3cc1>=_0x5b8e91){_0xed3cc1=_0x5b8e91;_0x3e78a5=0xc8;}else{_0x3e78a5=0xce;}_0x5c1897[_0x49ed('0x1c')](_0x3e78a5);return _0x5c1897[_0x49ed('0x1f')](_0x49ed('0x20'),_0x3b50aa+'-'+_0xed3cc1+'/'+_0x5b8e91)[_0x49ed('0x21')](_0x511674);}return null;};}function patchUpdates(_0x2e72a8){return function(_0x438e88){try{jsonpatch[_0x49ed('0x22')](_0x438e88,_0x2e72a8,!![]);}catch(_0x42cbbf){return BPromise[_0x49ed('0x23')](_0x42cbbf);}return _0x438e88[_0x49ed('0x24')]();};}function saveUpdates(_0x2e5b87,_0x496661){return function(_0xd30fb1){if(_0xd30fb1){return _0xd30fb1[_0x49ed('0x25')](_0x2e5b87)[_0x49ed('0x26')](function(_0x578555){return _0x578555;});}return null;};}function removeEntity(_0x313e3b,_0x4c1268){return function(_0x26809c){if(_0x26809c){return _0x26809c[_0x49ed('0x27')]()[_0x49ed('0x26')](function(){_0x313e3b[_0x49ed('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cb36f,_0x577c0a){return function(_0x42420f){if(!_0x42420f){_0x1cb36f[_0x49ed('0x1b')](0x194);}return _0x42420f;};}function handleError(_0x4c9e84,_0x34c176){_0x34c176=_0x34c176||0x1f4;return function(_0xd731b3){logger['error'](_0xd731b3[_0x49ed('0x28')]);if(_0xd731b3[_0x49ed('0x29')]){delete _0xd731b3[_0x49ed('0x29')];}_0x4c9e84[_0x49ed('0x1c')](_0x34c176)[_0x49ed('0x2a')](_0xd731b3);};}exports[_0x49ed('0x2b')]=function(_0x4eb822,_0x44c3f0){var _0x2cf518={},_0x1ed088={},_0x30c8e2={'count':0x0,'rows':[]};var _0x5467fa=_[_0x49ed('0x2c')](db[_0x49ed('0x2d')][_0x49ed('0x2e')],function(_0x2b1ba4){return{'name':_0x2b1ba4['fieldName'],'type':_0x2b1ba4[_0x49ed('0x2f')][_0x49ed('0x30')]};});_0x1ed088[_0x49ed('0x31')]=_[_0x49ed('0x2c')](_0x5467fa,_0x49ed('0x29'));_0x1ed088['query']=_[_0x49ed('0x32')](_0x4eb822[_0x49ed('0x33')]);_0x1ed088[_0x49ed('0x34')]=_[_0x49ed('0x35')](_0x1ed088[_0x49ed('0x31')],_0x1ed088['query']);_0x2cf518[_0x49ed('0x36')]=_[_0x49ed('0x35')](_0x1ed088[_0x49ed('0x31')],qs[_0x49ed('0x37')](_0x4eb822['query'][_0x49ed('0x37')]));_0x2cf518[_0x49ed('0x36')]=_0x2cf518[_0x49ed('0x36')][_0x49ed('0x38')]?_0x2cf518[_0x49ed('0x36')]:_0x1ed088[_0x49ed('0x31')];if(!_0x4eb822[_0x49ed('0x33')]['hasOwnProperty']('nolimit')){_0x2cf518[_0x49ed('0x1e')]=qs[_0x49ed('0x1e')](_0x4eb822[_0x49ed('0x33')][_0x49ed('0x1e')]);_0x2cf518[_0x49ed('0x39')]=qs[_0x49ed('0x39')](_0x4eb822[_0x49ed('0x33')][_0x49ed('0x39')]);}_0x2cf518['order']=qs['sort'](_0x4eb822['query'][_0x49ed('0x3a')]);_0x2cf518[_0x49ed('0x3b')]=qs['filters'](_[_0x49ed('0x3c')](_0x4eb822[_0x49ed('0x33')],_0x1ed088[_0x49ed('0x34')]));if(_0x4eb822['query']['filter']){_0x2cf518[_0x49ed('0x3b')]=_[_0x49ed('0x3d')](_0x2cf518[_0x49ed('0x3b')],{'$or':_['map'](_0x5467fa,function(_0xa87505){if(_0xa87505[_0x49ed('0x2f')]!=='VIRTUAL'){var _0x210140={};_0x210140[_0xa87505['name']]={'$like':'%'+_0x4eb822[_0x49ed('0x33')][_0x49ed('0x3e')]+'%'};return _0x210140;}})});}_0x2cf518=_[_0x49ed('0x3d')]({},_0x2cf518,_0x4eb822[_0x49ed('0x3f')]);var _0x3fc7e6={'where':_0x2cf518[_0x49ed('0x3b')]};return db[_0x49ed('0x2d')][_0x49ed('0x1d')](_0x3fc7e6)[_0x49ed('0x26')](function(_0x152873){_0x30c8e2[_0x49ed('0x1d')]=_0x152873;if(_0x4eb822[_0x49ed('0x33')][_0x49ed('0x40')]){_0x2cf518[_0x49ed('0x41')]=[{'all':!![]}];}return db[_0x49ed('0x2d')]['findAll'](_0x2cf518);})[_0x49ed('0x26')](function(_0x54e783){_0x30c8e2[_0x49ed('0x42')]=_0x54e783;return _0x30c8e2;})[_0x49ed('0x26')](respondWithFilteredResult(_0x44c3f0,_0x2cf518))[_0x49ed('0x43')](handleError(_0x44c3f0,null));};exports['show']=function(_0x1cd80e,_0x1c5505){var _0xb020aa={'raw':!![],'where':{'id':_0x1cd80e['params']['id']}},_0x591242={};_0x591242[_0x49ed('0x31')]=_['keys'](db[_0x49ed('0x2d')][_0x49ed('0x2e')]);_0x591242[_0x49ed('0x33')]=_[_0x49ed('0x32')](_0x1cd80e[_0x49ed('0x33')]);_0x591242[_0x49ed('0x34')]=_['intersection'](_0x591242[_0x49ed('0x31')],_0x591242[_0x49ed('0x33')]);_0xb020aa['attributes']=_[_0x49ed('0x35')](_0x591242[_0x49ed('0x31')],qs['fields'](_0x1cd80e['query'][_0x49ed('0x37')]));_0xb020aa[_0x49ed('0x36')]=_0xb020aa[_0x49ed('0x36')][_0x49ed('0x38')]?_0xb020aa['attributes']:_0x591242[_0x49ed('0x31')];if(_0x1cd80e[_0x49ed('0x33')]['includeAll']){_0xb020aa[_0x49ed('0x41')]=[{'all':!![]}];}_0xb020aa=_[_0x49ed('0x3d')]({},_0xb020aa,_0x1cd80e['options']);return db[_0x49ed('0x2d')][_0x49ed('0x44')](_0xb020aa)[_0x49ed('0x26')](handleEntityNotFound(_0x1c5505,null))[_0x49ed('0x26')](respondWithResult(_0x1c5505,null))[_0x49ed('0x43')](handleError(_0x1c5505,null));};exports[_0x49ed('0x45')]=function(_0x437513,_0x40ee79){return db[_0x49ed('0x2d')]['create'](_0x437513[_0x49ed('0x46')],{})[_0x49ed('0x26')](respondWithResult(_0x40ee79,0xc9))[_0x49ed('0x43')](handleError(_0x40ee79,null));};exports[_0x49ed('0x25')]=function(_0x81fdcd,_0x37ce98){if(_0x81fdcd[_0x49ed('0x46')]['id']){delete _0x81fdcd['body']['id'];}return db[_0x49ed('0x2d')]['find']({'where':{'id':_0x81fdcd['params']['id']}})[_0x49ed('0x26')](handleEntityNotFound(_0x37ce98,null))[_0x49ed('0x26')](saveUpdates(_0x81fdcd[_0x49ed('0x46')],null))[_0x49ed('0x26')](respondWithResult(_0x37ce98,null))['catch'](handleError(_0x37ce98,null));};exports[_0x49ed('0x27')]=function(_0x51086d,_0x43ef2a){return db['SquareMessage'][_0x49ed('0x44')]({'where':{'id':_0x51086d['params']['id']}})[_0x49ed('0x26')](handleEntityNotFound(_0x43ef2a,null))[_0x49ed('0x26')](removeEntity(_0x43ef2a,null))[_0x49ed('0x43')](handleError(_0x43ef2a,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 350a730..f3829ca 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 _0xd174=['lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./squareMessage.attributes','exports','define','SquareMessage','square_messages'];(function(_0x7f212,_0x5b605f){var _0x1ffc9e=function(_0x4dcf13){while(--_0x4dcf13){_0x7f212['push'](_0x7f212['shift']());}};_0x1ffc9e(++_0x5b605f);}(_0xd174,0x9c));var _0x4d17=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd174[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4d17('0x0'));var util=require('util');var logger=require(_0x4d17('0x1'))(_0x4d17('0x2'));var moment=require(_0x4d17('0x3'));var BPromise=require(_0x4d17('0x4'));var rp=require(_0x4d17('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4d17('0x6'));var attributes=require(_0x4d17('0x7'));module[_0x4d17('0x8')]=function(_0x5b991d,_0x47e31b){return _0x5b991d[_0x4d17('0x9')](_0x4d17('0xa'),attributes,{'tableName':_0x4d17('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cb0=['./squareMessage.attributes','exports','define','SquareMessage','util','api','bluebird','request-promise','path'];(function(_0x257fbc,_0x4b3d45){var _0x31e0ce=function(_0x4cf79d){while(--_0x4cf79d){_0x257fbc['push'](_0x257fbc['shift']());}};_0x31e0ce(++_0x4b3d45);}(_0x9cb0,0xf7));var _0x09cb=function(_0x3027b1,_0x282484){_0x3027b1=_0x3027b1-0x0;var _0x59447f=_0x9cb0[_0x3027b1];return _0x59447f;};'use strict';var _=require('lodash');var util=require(_0x09cb('0x0'));var logger=require('../../config/logger')(_0x09cb('0x1'));var moment=require('moment');var BPromise=require(_0x09cb('0x2'));var rp=require(_0x09cb('0x3'));var fs=require('fs');var path=require(_0x09cb('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x09cb('0x5'));module[_0x09cb('0x6')]=function(_0x37a8f7,_0x3a4a5e){return _0x37a8f7[_0x09cb('0x7')](_0x09cb('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index a9d894f..56b60fb 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=['http','request','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','info','result','catch','SquareMessage','options','debug','CreateSquareMessage','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x15ad70,_0x2e6c67){var _0x3f44ef=function(_0x49a10e){while(--_0x49a10e){_0x15ad70['push'](_0x15ad70['shift']());}};_0x3f44ef(++_0x2e6c67);}(_0x8d0a,0x65));var _0xa8d0=function(_0x378c0d,_0x569fea){_0x378c0d=_0x378c0d-0x0;var _0x56546f=_0x8d0a[_0x378c0d];return _0x56546f;};'use strict';var _=require(_0xa8d0('0x0'));var util=require('util');var moment=require(_0xa8d0('0x1'));var BPromise=require(_0xa8d0('0x2'));var rs=require(_0xa8d0('0x3'));var fs=require('fs');var Redis=require(_0xa8d0('0x4'));var db=require(_0xa8d0('0x5'))['db'];var utils=require(_0xa8d0('0x6'));var logger=require(_0xa8d0('0x7'))(_0xa8d0('0x8'));var config=require(_0xa8d0('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xa8d0('0xa')][_0xa8d0('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f95a7,_0x1f8b78,_0x3ee6b4){return new BPromise(function(_0x55ffc0,_0x508238){return client[_0xa8d0('0xc')](_0x1f95a7,_0x3ee6b4)[_0xa8d0('0xd')](function(_0x49e137){logger['info']('SquareMessage,\x20%s,\x20%s',_0x1f8b78,_0xa8d0('0xe'));logger['debug'](_0xa8d0('0xf'),_0x1f8b78,_0xa8d0('0xe'),JSON[_0xa8d0('0x10')](_0x49e137));if(_0x49e137[_0xa8d0('0x11')]){if(_0x49e137[_0xa8d0('0x11')][_0xa8d0('0x12')]===0x1f4){logger[_0xa8d0('0x11')](_0xa8d0('0x13'),_0x1f8b78,_0x49e137[_0xa8d0('0x11')][_0xa8d0('0x14')]);return _0x508238(_0x49e137[_0xa8d0('0x11')]['message']);}logger[_0xa8d0('0x11')]('SquareMessage,\x20%s,\x20%s',_0x1f8b78,_0x49e137['error'][_0xa8d0('0x14')]);return _0x55ffc0(_0x49e137[_0xa8d0('0x11')]['message']);}else{logger[_0xa8d0('0x15')](_0xa8d0('0x13'),_0x1f8b78,_0xa8d0('0xe'));_0x55ffc0(_0x49e137[_0xa8d0('0x16')][_0xa8d0('0x14')]);}})[_0xa8d0('0x17')](function(_0x4ef7bf){logger[_0xa8d0('0x11')](_0xa8d0('0x13'),_0x1f8b78,_0x4ef7bf);_0x508238(_0x4ef7bf);});});}exports['CreateSquareMessage']=function(_0x2f0b00){var _0x1e325a=this;return new Promise(function(_0x53d168,_0x32b11a){return db[_0xa8d0('0x18')]['create'](_0x2f0b00['body'],{'raw':_0x2f0b00[_0xa8d0('0x19')]?_0x2f0b00[_0xa8d0('0x19')]['raw']===undefined?!![]:![]:!![]})[_0xa8d0('0xd')](function(_0x356a52){logger[_0xa8d0('0x15')]('CreateSquareMessage',_0x2f0b00);logger[_0xa8d0('0x1a')]('CreateSquareMessage',_0x2f0b00,JSON[_0xa8d0('0x10')](_0x356a52));_0x53d168(_0x356a52);})[_0xa8d0('0x17')](function(_0x337677){logger[_0xa8d0('0x11')](_0xa8d0('0x1b'),_0x337677[_0xa8d0('0x14')],_0x2f0b00);_0x32b11a(_0x1e325a[_0xa8d0('0x11')](0x1f4,_0x337677['message']));});});}; \ No newline at end of file +var _0x02a7=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SquareMessage,\x20%s,\x20%s','message','result','CreateSquareMessage','SquareMessage','options','raw','util','randomstring','ioredis'];(function(_0x1472c1,_0x402717){var _0x1e3719=function(_0x2acebe){while(--_0x2acebe){_0x1472c1['push'](_0x1472c1['shift']());}};_0x1e3719(++_0x402717);}(_0x02a7,0x7a));var _0x702a=function(_0x1750f3,_0x1acd7c){_0x1750f3=_0x1750f3-0x0;var _0x248034=_0x02a7[_0x1750f3];return _0x248034;};'use strict';var _=require('lodash');var util=require(_0x702a('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x702a('0x1'));var fs=require('fs');var Redis=require(_0x702a('0x2'));var db=require(_0x702a('0x3'))['db'];var utils=require(_0x702a('0x4'));var logger=require(_0x702a('0x5'))(_0x702a('0x6'));var config=require(_0x702a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x702a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b25e,_0x1aa2c2,_0x3f2954){return new BPromise(function(_0x161dee,_0x430cf3){return client[_0x702a('0x9')](_0x26b25e,_0x3f2954)[_0x702a('0xa')](function(_0x48469e){logger[_0x702a('0xb')]('SquareMessage,\x20%s,\x20%s',_0x1aa2c2,'request\x20sent');logger[_0x702a('0xc')](_0x702a('0xd'),_0x1aa2c2,_0x702a('0xe'),JSON[_0x702a('0xf')](_0x48469e));if(_0x48469e['error']){if(_0x48469e[_0x702a('0x10')][_0x702a('0x11')]===0x1f4){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x48469e[_0x702a('0x10')][_0x702a('0x13')]);return _0x430cf3(_0x48469e[_0x702a('0x10')]['message']);}logger['error'](_0x702a('0x12'),_0x1aa2c2,_0x48469e['error']['message']);return _0x161dee(_0x48469e['error']['message']);}else{logger['info'](_0x702a('0x12'),_0x1aa2c2,_0x702a('0xe'));_0x161dee(_0x48469e[_0x702a('0x14')]['message']);}})['catch'](function(_0x506772){logger[_0x702a('0x10')](_0x702a('0x12'),_0x1aa2c2,_0x506772);_0x430cf3(_0x506772);});});}exports[_0x702a('0x15')]=function(_0x492cfb){var _0x290591=this;return new Promise(function(_0x5ec1b3,_0x823794){return db[_0x702a('0x16')]['create'](_0x492cfb['body'],{'raw':_0x492cfb[_0x702a('0x17')]?_0x492cfb[_0x702a('0x17')][_0x702a('0x18')]===undefined?!![]:![]:!![]})[_0x702a('0xa')](function(_0x332254){logger[_0x702a('0xb')](_0x702a('0x15'),_0x492cfb);logger[_0x702a('0xc')](_0x702a('0x15'),_0x492cfb,JSON[_0x702a('0xf')](_0x332254));_0x5ec1b3(_0x332254);})['catch'](function(_0x1ecd28){logger[_0x702a('0x10')](_0x702a('0x15'),_0x1ecd28[_0x702a('0x13')],_0x492cfb);_0x823794(_0x290591[_0x702a('0x10')](0x1f4,_0x1ecd28[_0x702a('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index eaabef9..af92c26 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 _0x692a=['post','put','update','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','15s','test'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x692a,0x15b));var _0xa692=function(_0x985c1b,_0x329d89){_0x985c1b=_0x985c1b-0x0;var _0x1ef9cf=_0x692a[_0x985c1b];return _0x1ef9cf;};'use strict';var multer=require(_0xa692('0x0'));var util=require('util');var path=require(_0xa692('0x1'));var timeout=require('connect-timeout');var express=require(_0xa692('0x2'));var router=express[_0xa692('0x3')]();var auth=require(_0xa692('0x4'));var interaction=require(_0xa692('0x5'));var config=require(_0xa692('0x6'));var controller=require(_0xa692('0x7'));router[_0xa692('0x8')]('/',auth[_0xa692('0x9')](),controller[_0xa692('0xa')]);router[_0xa692('0x8')](_0xa692('0xb'),auth[_0xa692('0x9')](),controller['show']);router[_0xa692('0x8')]('/:id/test',auth[_0xa692('0x9')](),timeout(_0xa692('0xc')),controller[_0xa692('0xd')]);router[_0xa692('0xe')]('/',auth[_0xa692('0x9')](),controller['create']);router[_0xa692('0xf')](_0xa692('0xb'),auth[_0xa692('0x9')](),controller[_0xa692('0x10')]);router[_0xa692('0x11')](_0xa692('0xb'),auth[_0xa692('0x9')](),controller[_0xa692('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0df9=['/:id/test','15s','test','post','create','put','delete','destroy','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id'];(function(_0x3a4574,_0x388c28){var _0x333078=function(_0x997bba){while(--_0x997bba){_0x3a4574['push'](_0x3a4574['shift']());}};_0x333078(++_0x388c28);}(_0x0df9,0x170));var _0x90df=function(_0x3a8aa8,_0x5a2ce1){_0x3a8aa8=_0x3a8aa8-0x0;var _0x6fe9e=_0x0df9[_0x3a8aa8];return _0x6fe9e;};'use strict';var multer=require(_0x90df('0x0'));var util=require('util');var path=require(_0x90df('0x1'));var timeout=require(_0x90df('0x2'));var express=require('express');var router=express[_0x90df('0x3')]();var auth=require(_0x90df('0x4'));var interaction=require(_0x90df('0x5'));var config=require(_0x90df('0x6'));var controller=require(_0x90df('0x7'));router[_0x90df('0x8')]('/',auth[_0x90df('0x9')](),controller[_0x90df('0xa')]);router[_0x90df('0x8')](_0x90df('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x90df('0x8')](_0x90df('0xc'),auth['isAuthenticated'](),timeout(_0x90df('0xd')),controller[_0x90df('0xe')]);router[_0x90df('0xf')]('/',auth[_0x90df('0x9')](),controller[_0x90df('0x10')]);router[_0x90df('0x11')](_0x90df('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x90df('0x12')](_0x90df('0xb'),auth[_0x90df('0x9')](),controller[_0x90df('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 566d73e..11b0484 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 _0xeed2=['STRING','sequelize','exports'];(function(_0x2a55a7,_0x4b6676){var _0x19647a=function(_0x11f74){while(--_0x11f74){_0x2a55a7['push'](_0x2a55a7['shift']());}};_0x19647a(++_0x4b6676);}(_0xeed2,0x85));var _0x2eed=function(_0x2ecbc8,_0x56b64b){_0x2ecbc8=_0x2ecbc8-0x0;var _0x59ae52=_0xeed2[_0x2ecbc8];return _0x59ae52;};'use strict';var Sequelize=require(_0x2eed('0x0'));module[_0x2eed('0x1')]={'name':{'type':Sequelize[_0x2eed('0x2')],'unique':'name','allowNull':![]},'dsn':{'type':Sequelize[_0x2eed('0x2')]},'description':{'type':Sequelize[_0x2eed('0x2')]}}; \ No newline at end of file +var _0xedef=['name','sequelize','STRING'];(function(_0x1ba825,_0x57bd4d){var _0x2fe97e=function(_0x5038e8){while(--_0x5038e8){_0x1ba825['push'](_0x1ba825['shift']());}};_0x2fe97e(++_0x57bd4d);}(_0xedef,0x7c));var _0xfede=function(_0x3d5076,_0x106513){_0x3d5076=_0x3d5076-0x0;var _0x54afa0=_0xedef[_0x3d5076];return _0x54afa0;};'use strict';var Sequelize=require(_0xfede('0x0'));module['exports']={'name':{'type':Sequelize[_0xfede('0x1')],'unique':_0xfede('0x2'),'allowNull':![]},'dsn':{'type':Sequelize[_0xfede('0x1')]},'description':{'type':Sequelize[_0xfede('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index e035293..191d8a4 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 _0x8c66=['jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','ODBC','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','catch','show','params','include','find','body','user','role','userProfileId','UserProfileResource','create','error','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','crypto'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x8c66,0x1e6));var _0x68c6=function(_0x45bc3f,_0x234416){_0x45bc3f=_0x45bc3f-0x0;var _0x530329=_0x8c66[_0x45bc3f];return _0x530329;};'use strict';var pdf=require(_0x68c6('0x0'));var emlformat=require(_0x68c6('0x1'));var rimraf=require('rimraf');var zipdir=require(_0x68c6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x68c6('0x3'));var moment=require('moment');var BPromise=require(_0x68c6('0x4'));var Mustache=require(_0x68c6('0x5'));var util=require(_0x68c6('0x6'));var path=require(_0x68c6('0x7'));var sox=require(_0x68c6('0x8'));var csv=require(_0x68c6('0x9'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x68c6('0xa'));var crypto=require(_0x68c6('0xb'));var jsforce=require(_0x68c6('0xc'));var deskjs=require(_0x68c6('0xd'));var toCsv=require(_0x68c6('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x68c6('0xe'));var authService=require(_0x68c6('0xf'));var qs=require(_0x68c6('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x68c6('0x11'));var logger=require(_0x68c6('0x12'))(_0x68c6('0x13'));var utils=require('../../config/utils');var config=require(_0x68c6('0x14'));var db=require(_0x68c6('0x15'))['db'];function respondWithStatusCode(_0x11f4f6,_0x2312a0){_0x2312a0=_0x2312a0||0xcc;return function(_0x43b77e){if(_0x43b77e){return _0x11f4f6[_0x68c6('0x16')](_0x2312a0);}return _0x11f4f6[_0x68c6('0x17')](_0x2312a0)[_0x68c6('0x18')]();};}function respondWithResult(_0x58721d,_0x46b332){_0x46b332=_0x46b332||0xc8;return function(_0xdd96be){if(_0xdd96be){return _0x58721d[_0x68c6('0x17')](_0x46b332)[_0x68c6('0x19')](_0xdd96be);}};}function respondWithFilteredResult(_0x3c05fc,_0x323654){return function(_0xa224bf){if(_0xa224bf){var _0xa695ee=_0xa224bf[_0x68c6('0x1a')],_0x1a06f4=_0x323654['offset'],_0x38fffc=_0x323654[_0x68c6('0x1b')]+_0x323654[_0x68c6('0x1c')],_0x407baf;if(_0x38fffc>=_0xa695ee){_0x38fffc=_0xa695ee;_0x407baf=0xc8;}else{_0x407baf=0xce;}_0x3c05fc[_0x68c6('0x17')](_0x407baf);return _0x3c05fc[_0x68c6('0x1d')](_0x68c6('0x1e'),_0x1a06f4+'-'+_0x38fffc+'/'+_0xa695ee)[_0x68c6('0x19')](_0xa224bf);}return null;};}function patchUpdates(_0x5c6089){return function(_0x5a40e3){try{jsonpatch[_0x68c6('0x1f')](_0x5a40e3,_0x5c6089,!![]);}catch(_0x574c5e){return BPromise[_0x68c6('0x20')](_0x574c5e);}return _0x5a40e3[_0x68c6('0x21')]();};}function saveUpdates(_0x5bf24f,_0x328dd4){return function(_0x23040d){if(_0x23040d){return _0x23040d[_0x68c6('0x22')](_0x5bf24f)[_0x68c6('0x23')](function(_0x3e3c43){return _0x3e3c43;});}return null;};}function removeEntity(_0x45f5cb,_0x4e3fed){return function(_0xc251df){if(_0xc251df){return _0xc251df[_0x68c6('0x24')]()[_0x68c6('0x23')](function(){var _0x57fb3a=_0xc251df[_0x68c6('0x25')]({'plain':!![]});var _0x6324c8=_0x68c6('0x26');return db['UserProfileResource'][_0x68c6('0x24')]({'where':{'type':_0x6324c8,'resourceId':_0x57fb3a['id']}})[_0x68c6('0x23')](function(){return _0xc251df;});})[_0x68c6('0x23')](function(){_0x45f5cb[_0x68c6('0x17')](0xcc)[_0x68c6('0x18')]();});}};}function handleEntityNotFound(_0x329a05,_0x5556f9){return function(_0x305fa0){if(!_0x305fa0){_0x329a05['sendStatus'](0x194);}return _0x305fa0;};}function handleError(_0x456301,_0x49982f){_0x49982f=_0x49982f||0x1f4;return function(_0x54a157){logger['error'](_0x54a157['stack']);if(_0x54a157[_0x68c6('0x27')]){delete _0x54a157['name'];}_0x456301[_0x68c6('0x17')](_0x49982f)[_0x68c6('0x28')](_0x54a157);};}exports[_0x68c6('0x29')]=function(_0x2006f4,_0x378569){var _0x24c449={},_0x58b028={},_0x13a961={'count':0x0,'rows':[]};var _0x121486=_[_0x68c6('0x2a')](db[_0x68c6('0x2b')][_0x68c6('0x2c')],function(_0x3cb245){return{'name':_0x3cb245[_0x68c6('0x2d')],'type':_0x3cb245[_0x68c6('0x2e')][_0x68c6('0x2f')]};});_0x58b028['model']=_[_0x68c6('0x2a')](_0x121486,_0x68c6('0x27'));_0x58b028[_0x68c6('0x30')]=_[_0x68c6('0x31')](_0x2006f4['query']);_0x58b028['filters']=_[_0x68c6('0x32')](_0x58b028[_0x68c6('0x33')],_0x58b028['query']);_0x24c449[_0x68c6('0x34')]=_[_0x68c6('0x32')](_0x58b028[_0x68c6('0x33')],qs[_0x68c6('0x35')](_0x2006f4['query']['fields']));_0x24c449[_0x68c6('0x34')]=_0x24c449[_0x68c6('0x34')][_0x68c6('0x36')]?_0x24c449[_0x68c6('0x34')]:_0x58b028['model'];if(!_0x2006f4[_0x68c6('0x30')][_0x68c6('0x37')](_0x68c6('0x38'))){_0x24c449[_0x68c6('0x1c')]=qs['limit'](_0x2006f4[_0x68c6('0x30')]['limit']);_0x24c449[_0x68c6('0x1b')]=qs['offset'](_0x2006f4['query'][_0x68c6('0x1b')]);}_0x24c449['order']=qs[_0x68c6('0x39')](_0x2006f4[_0x68c6('0x30')][_0x68c6('0x39')]);_0x24c449[_0x68c6('0x3a')]=qs[_0x68c6('0x3b')](_[_0x68c6('0x3c')](_0x2006f4[_0x68c6('0x30')],_0x58b028['filters']));if(_0x2006f4['query'][_0x68c6('0x3d')]){_0x24c449[_0x68c6('0x3a')]=_[_0x68c6('0x3e')](_0x24c449[_0x68c6('0x3a')],{'$or':_[_0x68c6('0x2a')](_0x121486,function(_0x26e548){if(_0x26e548[_0x68c6('0x2e')]!==_0x68c6('0x3f')){var _0x3b923c={};_0x3b923c[_0x26e548[_0x68c6('0x27')]]={'$like':'%'+_0x2006f4[_0x68c6('0x30')][_0x68c6('0x3d')]+'%'};return _0x3b923c;}})});}_0x24c449=_['merge']({},_0x24c449,_0x2006f4[_0x68c6('0x40')]);var _0x1dcead={'where':_0x24c449['where']};return db[_0x68c6('0x2b')][_0x68c6('0x1a')](_0x1dcead)[_0x68c6('0x23')](function(_0x91f17f){_0x13a961[_0x68c6('0x1a')]=_0x91f17f;if(_0x2006f4['query'][_0x68c6('0x41')]){_0x24c449['include']=[{'all':!![]}];}return db[_0x68c6('0x2b')]['findAll'](_0x24c449);})[_0x68c6('0x23')](function(_0x1857ff){_0x13a961['rows']=_0x1857ff;return _0x13a961;})[_0x68c6('0x23')](respondWithFilteredResult(_0x378569,_0x24c449))[_0x68c6('0x42')](handleError(_0x378569,null));};exports[_0x68c6('0x43')]=function(_0x3902fb,_0x293a1d){var _0x4b9c3d={'raw':!![],'where':{'id':_0x3902fb[_0x68c6('0x44')]['id']}},_0xe0bc5b={};_0xe0bc5b[_0x68c6('0x33')]=_[_0x68c6('0x31')](db[_0x68c6('0x2b')][_0x68c6('0x2c')]);_0xe0bc5b[_0x68c6('0x30')]=_[_0x68c6('0x31')](_0x3902fb[_0x68c6('0x30')]);_0xe0bc5b[_0x68c6('0x3b')]=_[_0x68c6('0x32')](_0xe0bc5b[_0x68c6('0x33')],_0xe0bc5b[_0x68c6('0x30')]);_0x4b9c3d['attributes']=_[_0x68c6('0x32')](_0xe0bc5b[_0x68c6('0x33')],qs['fields'](_0x3902fb[_0x68c6('0x30')]['fields']));_0x4b9c3d[_0x68c6('0x34')]=_0x4b9c3d['attributes']['length']?_0x4b9c3d[_0x68c6('0x34')]:_0xe0bc5b['model'];if(_0x3902fb['query']['includeAll']){_0x4b9c3d[_0x68c6('0x45')]=[{'all':!![]}];}_0x4b9c3d=_[_0x68c6('0x3e')]({},_0x4b9c3d,_0x3902fb[_0x68c6('0x40')]);return db[_0x68c6('0x2b')][_0x68c6('0x46')](_0x4b9c3d)[_0x68c6('0x23')](handleEntityNotFound(_0x293a1d,null))[_0x68c6('0x23')](respondWithResult(_0x293a1d,null))['catch'](handleError(_0x293a1d,null));};exports['create']=function(_0x402065,_0x597796){return db[_0x68c6('0x2b')]['create'](_0x402065[_0x68c6('0x47')],{})[_0x68c6('0x23')](function(_0xaac34a){var _0x41dc14=_0x402065[_0x68c6('0x48')][_0x68c6('0x25')]({'plain':!![]});if(!_0x41dc14)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x41dc14[_0x68c6('0x49')]===_0x68c6('0x48')){var _0x285d91=_0xaac34a['get']({'plain':!![]});var _0x3543a4=_0x68c6('0x26');return db['UserProfileSection'][_0x68c6('0x46')]({'where':{'name':_0x3543a4,'userProfileId':_0x41dc14[_0x68c6('0x4a')]},'raw':!![]})[_0x68c6('0x23')](function(_0x12bc0b){if(_0x12bc0b&&_0x12bc0b['autoAssociation']===0x0){return db[_0x68c6('0x4b')][_0x68c6('0x4c')]({'name':_0x285d91[_0x68c6('0x27')],'resourceId':_0x285d91['id'],'type':_0x12bc0b[_0x68c6('0x27')],'sectionId':_0x12bc0b['id']},{})[_0x68c6('0x23')](function(){return _0xaac34a;});}else{return _0xaac34a;}})[_0x68c6('0x42')](function(_0x350b40){logger[_0x68c6('0x4d')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x350b40);throw _0x350b40;});}return _0xaac34a;})[_0x68c6('0x23')](respondWithResult(_0x597796,0xc9))[_0x68c6('0x42')](handleError(_0x597796,null));};exports[_0x68c6('0x22')]=function(_0x4e1765,_0x4bb312){if(_0x4e1765[_0x68c6('0x47')]['id']){delete _0x4e1765[_0x68c6('0x47')]['id'];}return db['SquareOdbc'][_0x68c6('0x46')]({'where':{'id':_0x4e1765['params']['id']}})['then'](handleEntityNotFound(_0x4bb312,null))['then'](saveUpdates(_0x4e1765[_0x68c6('0x47')],null))['then'](respondWithResult(_0x4bb312,null))[_0x68c6('0x42')](handleError(_0x4bb312,null));};exports[_0x68c6('0x24')]=function(_0x2b602e,_0x1b5bda){return db[_0x68c6('0x2b')][_0x68c6('0x46')]({'where':{'id':_0x2b602e['params']['id']}})[_0x68c6('0x23')](handleEntityNotFound(_0x1b5bda,null))[_0x68c6('0x23')](removeEntity(_0x1b5bda,null))[_0x68c6('0x42')](handleError(_0x1b5bda,null));};exports[_0x68c6('0x4e')]=function(_0x3bc000,_0x32268f,_0x4f0a5a){var _0x4d5c44;return db['SquareOdbc'][_0x68c6('0x46')]({'where':{'id':_0x3bc000[_0x68c6('0x44')]['id']},'attributes':['id',_0x68c6('0x4f')]})[_0x68c6('0x23')](handleEntityNotFound(_0x32268f,null))[_0x68c6('0x23')](function(_0x45912b){if(_0x45912b){var _0x1b2198=require(_0x68c6('0x50'))();_0x1b2198[_0x68c6('0x51')](_0x45912b[_0x68c6('0x4f')]);_0x1b2198[_0x68c6('0x52')]();return _0x45912b;}})['then'](respondWithResult(_0x32268f,null))[_0x68c6('0x42')](handleError(_0x32268f,null));}; \ No newline at end of file +var _0x2487=['fields','length','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','user','role','UserProfileSection','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','test','dsn','odbc','openSync','closeSync','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','util','path','to-csv','ejs','lodash','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','stack','name','send','map','SquareOdbc','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x2487,0x6f));var _0x7248=function(_0x439835,_0x2e3867){_0x439835=_0x439835-0x0;var _0x5a6e48=_0x2487[_0x439835];return _0x5a6e48;};'use strict';var pdf=require(_0x7248('0x0'));var emlformat=require(_0x7248('0x1'));var rimraf=require(_0x7248('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x7248('0x3'));var rp=require(_0x7248('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7248('0x5'));var path=require(_0x7248('0x6'));var sox=require('sox');var csv=require(_0x7248('0x7'));var ejs=require(_0x7248('0x8'));var fs=require('fs');var _=require(_0x7248('0x9'));var squel=require('squel');var crypto=require(_0x7248('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7248('0x7'));var querystring=require(_0x7248('0xb'));var Papa=require(_0x7248('0xc'));var Redis=require('ioredis');var authService=require(_0x7248('0xd'));var qs=require(_0x7248('0xe'));var as=require(_0x7248('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x7248('0x10'))(_0x7248('0x11'));var utils=require(_0x7248('0x12'));var config=require('../../config/environment');var db=require(_0x7248('0x13'))['db'];function respondWithStatusCode(_0xfbcef3,_0x48efc2){_0x48efc2=_0x48efc2||0xcc;return function(_0x479efa){if(_0x479efa){return _0xfbcef3[_0x7248('0x14')](_0x48efc2);}return _0xfbcef3['status'](_0x48efc2)[_0x7248('0x15')]();};}function respondWithResult(_0x32375f,_0x3a5630){_0x3a5630=_0x3a5630||0xc8;return function(_0x587e2b){if(_0x587e2b){return _0x32375f[_0x7248('0x16')](_0x3a5630)[_0x7248('0x17')](_0x587e2b);}};}function respondWithFilteredResult(_0x248f5f,_0x433995){return function(_0x321e83){if(_0x321e83){var _0x438c5b=_0x321e83[_0x7248('0x18')],_0x167666=_0x433995[_0x7248('0x19')],_0xb3fe4=_0x433995['offset']+_0x433995[_0x7248('0x1a')],_0x33e624;if(_0xb3fe4>=_0x438c5b){_0xb3fe4=_0x438c5b;_0x33e624=0xc8;}else{_0x33e624=0xce;}_0x248f5f[_0x7248('0x16')](_0x33e624);return _0x248f5f[_0x7248('0x1b')](_0x7248('0x1c'),_0x167666+'-'+_0xb3fe4+'/'+_0x438c5b)[_0x7248('0x17')](_0x321e83);}return null;};}function patchUpdates(_0x203f73){return function(_0x2e6e33){try{jsonpatch[_0x7248('0x1d')](_0x2e6e33,_0x203f73,!![]);}catch(_0x4b0620){return BPromise[_0x7248('0x1e')](_0x4b0620);}return _0x2e6e33[_0x7248('0x1f')]();};}function saveUpdates(_0x5d268e,_0x1a3e1f){return function(_0x517ba2){if(_0x517ba2){return _0x517ba2['update'](_0x5d268e)[_0x7248('0x20')](function(_0x2ea119){return _0x2ea119;});}return null;};}function removeEntity(_0x4f9bf5,_0x4aac0e){return function(_0x23aae9){if(_0x23aae9){return _0x23aae9[_0x7248('0x21')]()[_0x7248('0x20')](function(){var _0x457a77=_0x23aae9[_0x7248('0x22')]({'plain':!![]});var _0x1b5228='ODBC';return db[_0x7248('0x23')][_0x7248('0x21')]({'where':{'type':_0x1b5228,'resourceId':_0x457a77['id']}})[_0x7248('0x20')](function(){return _0x23aae9;});})['then'](function(){_0x4f9bf5[_0x7248('0x16')](0xcc)[_0x7248('0x15')]();});}};}function handleEntityNotFound(_0x3dad47,_0x2aada2){return function(_0x5c1838){if(!_0x5c1838){_0x3dad47[_0x7248('0x14')](0x194);}return _0x5c1838;};}function handleError(_0x32240d,_0x2c3c3f){_0x2c3c3f=_0x2c3c3f||0x1f4;return function(_0x3bbc22){logger['error'](_0x3bbc22[_0x7248('0x24')]);if(_0x3bbc22['name']){delete _0x3bbc22[_0x7248('0x25')];}_0x32240d[_0x7248('0x16')](_0x2c3c3f)[_0x7248('0x26')](_0x3bbc22);};}exports['index']=function(_0x203d5f,_0x1aa02d){var _0x2fc0f0={},_0x1b35d5={},_0x78b911={'count':0x0,'rows':[]};var _0x57f125=_[_0x7248('0x27')](db[_0x7248('0x28')][_0x7248('0x29')],function(_0x466a5a){return{'name':_0x466a5a[_0x7248('0x2a')],'type':_0x466a5a[_0x7248('0x2b')][_0x7248('0x2c')]};});_0x1b35d5[_0x7248('0x2d')]=_[_0x7248('0x27')](_0x57f125,_0x7248('0x25'));_0x1b35d5['query']=_[_0x7248('0x2e')](_0x203d5f[_0x7248('0x2f')]);_0x1b35d5[_0x7248('0x30')]=_[_0x7248('0x31')](_0x1b35d5['model'],_0x1b35d5[_0x7248('0x2f')]);_0x2fc0f0[_0x7248('0x32')]=_[_0x7248('0x31')](_0x1b35d5[_0x7248('0x2d')],qs[_0x7248('0x33')](_0x203d5f['query']['fields']));_0x2fc0f0[_0x7248('0x32')]=_0x2fc0f0[_0x7248('0x32')][_0x7248('0x34')]?_0x2fc0f0['attributes']:_0x1b35d5['model'];if(!_0x203d5f['query']['hasOwnProperty']('nolimit')){_0x2fc0f0['limit']=qs[_0x7248('0x1a')](_0x203d5f[_0x7248('0x2f')][_0x7248('0x1a')]);_0x2fc0f0[_0x7248('0x19')]=qs[_0x7248('0x19')](_0x203d5f['query'][_0x7248('0x19')]);}_0x2fc0f0['order']=qs[_0x7248('0x35')](_0x203d5f[_0x7248('0x2f')][_0x7248('0x35')]);_0x2fc0f0[_0x7248('0x36')]=qs[_0x7248('0x30')](_[_0x7248('0x37')](_0x203d5f['query'],_0x1b35d5[_0x7248('0x30')]));if(_0x203d5f[_0x7248('0x2f')][_0x7248('0x38')]){_0x2fc0f0[_0x7248('0x36')]=_[_0x7248('0x39')](_0x2fc0f0['where'],{'$or':_[_0x7248('0x27')](_0x57f125,function(_0x40f68a){if(_0x40f68a[_0x7248('0x2b')]!==_0x7248('0x3a')){var _0x2bee90={};_0x2bee90[_0x40f68a[_0x7248('0x25')]]={'$like':'%'+_0x203d5f[_0x7248('0x2f')][_0x7248('0x38')]+'%'};return _0x2bee90;}})});}_0x2fc0f0=_[_0x7248('0x39')]({},_0x2fc0f0,_0x203d5f[_0x7248('0x3b')]);var _0x545e9d={'where':_0x2fc0f0['where']};return db[_0x7248('0x28')][_0x7248('0x18')](_0x545e9d)[_0x7248('0x20')](function(_0x281633){_0x78b911[_0x7248('0x18')]=_0x281633;if(_0x203d5f[_0x7248('0x2f')][_0x7248('0x3c')]){_0x2fc0f0[_0x7248('0x3d')]=[{'all':!![]}];}return db[_0x7248('0x28')][_0x7248('0x3e')](_0x2fc0f0);})[_0x7248('0x20')](function(_0xef417f){_0x78b911[_0x7248('0x3f')]=_0xef417f;return _0x78b911;})['then'](respondWithFilteredResult(_0x1aa02d,_0x2fc0f0))[_0x7248('0x40')](handleError(_0x1aa02d,null));};exports[_0x7248('0x41')]=function(_0x530ceb,_0xb45b1e){var _0x11bd26={'raw':!![],'where':{'id':_0x530ceb['params']['id']}},_0xdbceab={};_0xdbceab[_0x7248('0x2d')]=_[_0x7248('0x2e')](db[_0x7248('0x28')]['rawAttributes']);_0xdbceab[_0x7248('0x2f')]=_[_0x7248('0x2e')](_0x530ceb[_0x7248('0x2f')]);_0xdbceab['filters']=_['intersection'](_0xdbceab['model'],_0xdbceab[_0x7248('0x2f')]);_0x11bd26[_0x7248('0x32')]=_[_0x7248('0x31')](_0xdbceab[_0x7248('0x2d')],qs['fields'](_0x530ceb[_0x7248('0x2f')][_0x7248('0x33')]));_0x11bd26['attributes']=_0x11bd26['attributes'][_0x7248('0x34')]?_0x11bd26[_0x7248('0x32')]:_0xdbceab[_0x7248('0x2d')];if(_0x530ceb[_0x7248('0x2f')][_0x7248('0x3c')]){_0x11bd26[_0x7248('0x3d')]=[{'all':!![]}];}_0x11bd26=_['merge']({},_0x11bd26,_0x530ceb['options']);return db[_0x7248('0x28')][_0x7248('0x42')](_0x11bd26)[_0x7248('0x20')](handleEntityNotFound(_0xb45b1e,null))['then'](respondWithResult(_0xb45b1e,null))[_0x7248('0x40')](handleError(_0xb45b1e,null));};exports[_0x7248('0x43')]=function(_0x484c4a,_0x58b17b){return db[_0x7248('0x28')][_0x7248('0x43')](_0x484c4a['body'],{})[_0x7248('0x20')](function(_0x3315ae){var _0x2b7d38=_0x484c4a[_0x7248('0x44')][_0x7248('0x22')]({'plain':!![]});if(!_0x2b7d38)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2b7d38[_0x7248('0x45')]==='user'){var _0x8e5b2f=_0x3315ae[_0x7248('0x22')]({'plain':!![]});var _0x2afaba='ODBC';return db[_0x7248('0x46')]['find']({'where':{'name':_0x2afaba,'userProfileId':_0x2b7d38['userProfileId']},'raw':!![]})[_0x7248('0x20')](function(_0x12e953){if(_0x12e953&&_0x12e953['autoAssociation']===0x0){return db[_0x7248('0x23')][_0x7248('0x43')]({'name':_0x8e5b2f[_0x7248('0x25')],'resourceId':_0x8e5b2f['id'],'type':_0x12e953['name'],'sectionId':_0x12e953['id']},{})['then'](function(){return _0x3315ae;});}else{return _0x3315ae;}})[_0x7248('0x40')](function(_0x1aee7b){logger[_0x7248('0x47')](_0x7248('0x48'),_0x1aee7b);throw _0x1aee7b;});}return _0x3315ae;})[_0x7248('0x20')](respondWithResult(_0x58b17b,0xc9))[_0x7248('0x40')](handleError(_0x58b17b,null));};exports[_0x7248('0x49')]=function(_0x42eeff,_0x416622){if(_0x42eeff[_0x7248('0x4a')]['id']){delete _0x42eeff[_0x7248('0x4a')]['id'];}return db[_0x7248('0x28')][_0x7248('0x42')]({'where':{'id':_0x42eeff['params']['id']}})[_0x7248('0x20')](handleEntityNotFound(_0x416622,null))[_0x7248('0x20')](saveUpdates(_0x42eeff['body'],null))[_0x7248('0x20')](respondWithResult(_0x416622,null))[_0x7248('0x40')](handleError(_0x416622,null));};exports[_0x7248('0x21')]=function(_0x365c93,_0x4f8cc4){return db[_0x7248('0x28')][_0x7248('0x42')]({'where':{'id':_0x365c93[_0x7248('0x4b')]['id']}})[_0x7248('0x20')](handleEntityNotFound(_0x4f8cc4,null))['then'](removeEntity(_0x4f8cc4,null))[_0x7248('0x40')](handleError(_0x4f8cc4,null));};exports[_0x7248('0x4c')]=function(_0x3189d6,_0x12a805,_0x5d2b15){var _0x23a8ca;return db[_0x7248('0x28')][_0x7248('0x42')]({'where':{'id':_0x3189d6['params']['id']},'attributes':['id',_0x7248('0x4d')]})[_0x7248('0x20')](handleEntityNotFound(_0x12a805,null))[_0x7248('0x20')](function(_0x50b3d9){if(_0x50b3d9){var _0x43da3b=require(_0x7248('0x4e'))();_0x43da3b[_0x7248('0x4f')](_0x50b3d9['dsn']);_0x43da3b[_0x7248('0x50')]();return _0x50b3d9;}})[_0x7248('0x20')](respondWithResult(_0x12a805,null))[_0x7248('0x40')](handleError(_0x12a805,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index a74bdfd..ac9038e 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 _0x464b=['exports','define','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./squareOdbc.attributes'];(function(_0x218ccb,_0x33e32f){var _0x592648=function(_0xb3e077){while(--_0xb3e077){_0x218ccb['push'](_0x218ccb['shift']());}};_0x592648(++_0x33e32f);}(_0x464b,0x161));var _0xb464=function(_0x43fdd9,_0x17929c){_0x43fdd9=_0x43fdd9-0x0;var _0x5d78b8=_0x464b[_0x43fdd9];return _0x5d78b8;};'use strict';var _=require(_0xb464('0x0'));var util=require(_0xb464('0x1'));var logger=require(_0xb464('0x2'))(_0xb464('0x3'));var moment=require(_0xb464('0x4'));var BPromise=require(_0xb464('0x5'));var rp=require(_0xb464('0x6'));var fs=require('fs');var path=require(_0xb464('0x7'));var rimraf=require(_0xb464('0x8'));var config=require(_0xb464('0x9'));var attributes=require(_0xb464('0xa'));module[_0xb464('0xb')]=function(_0x4553f7,_0x58b7ff){return _0x4553f7[_0xb464('0xc')]('SquareOdbc',attributes,{'tableName':_0xb464('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5607=['path','rimraf','./squareOdbc.attributes','define','SquareOdbc','lodash','util','../../config/logger','moment','request-promise'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x5607,0xc3));var _0x7560=function(_0x258a41,_0x586263){_0x258a41=_0x258a41-0x0;var _0x5188f3=_0x5607[_0x258a41];return _0x5188f3;};'use strict';var _=require(_0x7560('0x0'));var util=require(_0x7560('0x1'));var logger=require(_0x7560('0x2'))('api');var moment=require(_0x7560('0x3'));var BPromise=require('bluebird');var rp=require(_0x7560('0x4'));var fs=require('fs');var path=require(_0x7560('0x5'));var rimraf=require(_0x7560('0x6'));var config=require('../../config/environment');var attributes=require(_0x7560('0x7'));module['exports']=function(_0x17f7b8,_0x119848){return _0x17f7b8[_0x7560('0x8')](_0x7560('0x9'),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 147547d..9ff86e6 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 _0x55ca=['options','where','attributes','include','map','model','lodash','util','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSquareOdbc','SquareOdbc','find'];(function(_0x1dda39,_0x221826){var _0x269408=function(_0x545613){while(--_0x545613){_0x1dda39['push'](_0x1dda39['shift']());}};_0x269408(++_0x221826);}(_0x55ca,0x126));var _0xa55c=function(_0x45afc1,_0x52a029){_0x45afc1=_0x45afc1-0x0;var _0x182539=_0x55ca[_0x45afc1];return _0x182539;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa55c('0x2'));var db=require(_0xa55c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa55c('0x4'))(_0xa55c('0x5'));var config=require(_0xa55c('0x6'));var jayson=require(_0xa55c('0x7'));var client=jayson[_0xa55c('0x8')][_0xa55c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x36b623,_0x4d0624,_0x2121fd){return new BPromise(function(_0x2537f0,_0x57e069){return client[_0xa55c('0xa')](_0x36b623,_0x2121fd)[_0xa55c('0xb')](function(_0x52a3bc){logger['info'](_0xa55c('0xc'),_0x4d0624,_0xa55c('0xd'));logger[_0xa55c('0xe')](_0xa55c('0xf'),_0x4d0624,_0xa55c('0xd'),JSON[_0xa55c('0x10')](_0x52a3bc));if(_0x52a3bc[_0xa55c('0x11')]){if(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x12')]===0x1f4){logger[_0xa55c('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0x52a3bc['error'][_0xa55c('0x13')]);return _0x57e069(_0x52a3bc['error']['message']);}logger['error'](_0xa55c('0xc'),_0x4d0624,_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);return _0x2537f0(_0x52a3bc[_0xa55c('0x11')][_0xa55c('0x13')]);}else{logger[_0xa55c('0x14')]('SquareOdbc,\x20%s,\x20%s',_0x4d0624,_0xa55c('0xd'));_0x2537f0(_0x52a3bc[_0xa55c('0x15')][_0xa55c('0x13')]);}})[_0xa55c('0x16')](function(_0x1c4cfd){logger[_0xa55c('0x11')](_0xa55c('0xc'),_0x4d0624,_0x1c4cfd);_0x57e069(_0x1c4cfd);});});}exports[_0xa55c('0x17')]=function(_0x24783b){var _0x4cee3c=this;return new Promise(function(_0x3d4c9e,_0x104a99){return db[_0xa55c('0x18')][_0xa55c('0x19')]({'raw':_0x24783b[_0xa55c('0x1a')]?_0x24783b[_0xa55c('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x24783b['options']?_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1b')]||null:null,'attributes':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1c')]||null:null,'include':_0x24783b[_0xa55c('0x1a')]?_0x24783b['options'][_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x24783b[_0xa55c('0x1a')][_0xa55c('0x1d')],function(_0x234372){return{'model':db[_0x234372['model']],'as':_0x234372['as'],'attributes':_0x234372[_0xa55c('0x1c')],'include':_0x234372['include']?_['map'](_0x234372['include'],function(_0x19ae88){return{'model':db[_0x19ae88['model']],'as':_0x19ae88['as'],'attributes':_0x19ae88[_0xa55c('0x1c')],'include':_0x19ae88[_0xa55c('0x1d')]?_[_0xa55c('0x1e')](_0x19ae88[_0xa55c('0x1d')],function(_0x2313a9){return{'model':db[_0x2313a9[_0xa55c('0x1f')]],'as':_0x2313a9['as'],'attributes':_0x2313a9[_0xa55c('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa55c('0xb')](function(_0x192df2){logger[_0xa55c('0x14')](_0xa55c('0x17'),_0x24783b);logger['debug'](_0xa55c('0x17'),_0x24783b,JSON[_0xa55c('0x10')](_0x192df2));_0x3d4c9e(_0x192df2);})[_0xa55c('0x16')](function(_0x906caa){logger['error'](_0xa55c('0x17'),_0x906caa[_0xa55c('0x13')],_0x24783b);_0x104a99(_0x4cee3c[_0xa55c('0x11')](0x1f4,_0x906caa[_0xa55c('0x13')]));});});}; \ 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(_0x29e98f,_0x356d0d){var _0x55ca39=function(_0x49871b){while(--_0x49871b){_0x29e98f['push'](_0x29e98f['shift']());}};_0x55ca39(++_0x356d0d);}(_0x008c,0x188));var _0xc008=function(_0xdc4996,_0x15bedc){_0xdc4996=_0xdc4996-0x0;var _0x20fbb9=_0x008c[_0xdc4996];return _0x20fbb9;};'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 3bf69c1..9705c9c 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 _0x9c00=['express','Router','../../components/interaction/service','../../config/environment','./squareProject.controller','get','isAuthenticated','/:id','show','/:id/users','getUsers','post','create','addUsers','put','update','delete','destroy','removeUsers','exports','multer','util'];(function(_0x1d558c,_0x1e497c){var _0x15767d=function(_0x26326d){while(--_0x26326d){_0x1d558c['push'](_0x1d558c['shift']());}};_0x15767d(++_0x1e497c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x3c78e7,_0x19a615){_0x3c78e7=_0x3c78e7-0x0;var _0x46c763=_0x9c00[_0x3c78e7];return _0x46c763;};'use strict';var multer=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x09c0('0x2'));var router=express[_0x09c0('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x09c0('0x4'));var config=require(_0x09c0('0x5'));var controller=require(_0x09c0('0x6'));router[_0x09c0('0x7')]('/',auth[_0x09c0('0x8')](),controller['index']);router['get'](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xa')]);router[_0x09c0('0x7')](_0x09c0('0xb'),auth['isAuthenticated'](),controller[_0x09c0('0xc')]);router[_0x09c0('0xd')]('/',auth[_0x09c0('0x8')](),controller[_0x09c0('0xe')]);router[_0x09c0('0xd')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0xf')]);router[_0x09c0('0x10')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x11')]);router[_0x09c0('0x12')](_0x09c0('0x9'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x13')]);router[_0x09c0('0x12')](_0x09c0('0xb'),auth[_0x09c0('0x8')](),controller[_0x09c0('0x14')]);module[_0x09c0('0x15')]=router; \ No newline at end of file +var _0x1eba=['isAuthenticated','index','/:id','show','/:id/users','getUsers','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x3564e9,_0xc0548e){var _0x2827b3=function(_0x444f7e){while(--_0x444f7e){_0x3564e9['push'](_0x3564e9['shift']());}};_0x2827b3(++_0xc0548e);}(_0x1eba,0x1d7));var _0xa1eb=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0x1eba[_0x39bc44];return _0x2916d8;};'use strict';var multer=require(_0xa1eb('0x0'));var util=require(_0xa1eb('0x1'));var path=require(_0xa1eb('0x2'));var timeout=require(_0xa1eb('0x3'));var express=require(_0xa1eb('0x4'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xa1eb('0x5'));var config=require(_0xa1eb('0x6'));var controller=require(_0xa1eb('0x7'));router[_0xa1eb('0x8')]('/',auth[_0xa1eb('0x9')](),controller[_0xa1eb('0xa')]);router[_0xa1eb('0x8')](_0xa1eb('0xb'),auth[_0xa1eb('0x9')](),controller[_0xa1eb('0xc')]);router[_0xa1eb('0x8')](_0xa1eb('0xd'),auth['isAuthenticated'](),controller[_0xa1eb('0xe')]);router['post']('/',auth[_0xa1eb('0x9')](),controller['create']);router[_0xa1eb('0xf')]('/:id/users',auth[_0xa1eb('0x9')](),controller['addUsers']);router[_0xa1eb('0x10')](_0xa1eb('0xb'),auth[_0xa1eb('0x9')](),controller['update']);router[_0xa1eb('0x11')](_0xa1eb('0xb'),auth['isAuthenticated'](),controller[_0xa1eb('0x12')]);router['delete']('/:id/users',auth[_0xa1eb('0x9')](),controller['removeUsers']);module[_0xa1eb('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 ac84a73..cc26405 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 _0xbf8d=['production','sequelize','name','STRING','TEXT','BLOB','getDataValue','preproduction','toString','utf8'];(function(_0x593614,_0x2a9105){var _0x2f0f39=function(_0x4e1ef2){while(--_0x4e1ef2){_0x593614['push'](_0x593614['shift']());}};_0x2f0f39(++_0x2a9105);}(_0xbf8d,0x65));var _0xdbf8=function(_0x239e06,_0x36d5d2){_0x239e06=_0x239e06-0x0;var _0x1c134c=_0xbf8d[_0x239e06];return _0x1c134c;};'use strict';var Sequelize=require(_0xdbf8('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xdbf8('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xdbf8('0x2')]},'notes':{'type':Sequelize[_0xdbf8('0x3')]},'preproduction':{'type':Sequelize[_0xdbf8('0x4')]('long'),'get':function(){if(this[_0xdbf8('0x5')](_0xdbf8('0x6'))){return this[_0xdbf8('0x5')](_0xdbf8('0x6'))[_0xdbf8('0x7')](_0xdbf8('0x8'));}}},'production':{'type':Sequelize['BLOB']('long'),'get':function(){if(this[_0xdbf8('0x5')](_0xdbf8('0x9'))){return this[_0xdbf8('0x5')](_0xdbf8('0x9'))[_0xdbf8('0x7')](_0xdbf8('0x8'));}}}}; \ No newline at end of file +var _0xe59c=['getDataValue','preproduction','toString','utf8','production','sequelize','exports','name','STRING','TEXT','BLOB','long'];(function(_0xa75b0a,_0x443f77){var _0x2301f8=function(_0x155d31){while(--_0x155d31){_0xa75b0a['push'](_0xa75b0a['shift']());}};_0x2301f8(++_0x443f77);}(_0xe59c,0x19d));var _0xce59=function(_0x2d7bb3,_0x324bcb){_0x2d7bb3=_0x2d7bb3-0x0;var _0x20e4f9=_0xe59c[_0x2d7bb3];return _0x20e4f9;};'use strict';var Sequelize=require(_0xce59('0x0'));module[_0xce59('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xce59('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xce59('0x3')]},'notes':{'type':Sequelize[_0xce59('0x4')]},'preproduction':{'type':Sequelize[_0xce59('0x5')](_0xce59('0x6')),'get':function(){if(this[_0xce59('0x7')](_0xce59('0x8'))){return this[_0xce59('0x7')](_0xce59('0x8'))[_0xce59('0x9')](_0xce59('0xa'));}}},'production':{'type':Sequelize['BLOB'](_0xce59('0x6')),'get':function(){if(this['getDataValue'](_0xce59('0xb'))){return this[_0xce59('0x7')](_0xce59('0xb'))[_0xce59('0x9')](_0xce59('0xa'));}}}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index 6e3e114..9adc3a5 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 _0xbf6e=['filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','show','params','rawAttributes','length','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','SquareProjects','find','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','error','stack','name','index','map','SquareProject','fieldName','model','query','keys'];(function(_0x1b00da,_0x4d5a10){var _0x1aa22f=function(_0x25a64f){while(--_0x25a64f){_0x1b00da['push'](_0x1b00da['shift']());}};_0x1aa22f(++_0x4d5a10);}(_0xbf6e,0x149));var _0xebf6=function(_0x4fe566,_0x93c45f){_0x4fe566=_0x4fe566-0x0;var _0x5e38e0=_0xbf6e[_0x4fe566];return _0x5e38e0;};'use strict';var pdf=require('html-pdf');var emlformat=require('eml-format');var rimraf=require(_0xebf6('0x0'));var zipdir=require(_0xebf6('0x1'));var jsonpatch=require(_0xebf6('0x2'));var rp=require(_0xebf6('0x3'));var moment=require(_0xebf6('0x4'));var BPromise=require(_0xebf6('0x5'));var Mustache=require(_0xebf6('0x6'));var util=require('util');var path=require(_0xebf6('0x7'));var sox=require(_0xebf6('0x8'));var csv=require(_0xebf6('0x9'));var ejs=require(_0xebf6('0xa'));var fs=require('fs');var _=require(_0xebf6('0xb'));var squel=require(_0xebf6('0xc'));var crypto=require(_0xebf6('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xebf6('0xe'));var toCsv=require(_0xebf6('0x9'));var querystring=require(_0xebf6('0xf'));var Papa=require('papaparse');var Redis=require(_0xebf6('0x10'));var authService=require(_0xebf6('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xebf6('0x12'));var hardwareService=require(_0xebf6('0x13'));var logger=require(_0xebf6('0x14'))(_0xebf6('0x15'));var utils=require(_0xebf6('0x16'));var config=require(_0xebf6('0x17'));var db=require('../../mysqldb')['db'];config[_0xebf6('0x18')]=_[_0xebf6('0x19')](config['redis'],{'host':_0xebf6('0x1a'),'port':0x18eb});var socket=require(_0xebf6('0x1b'))(new Redis(config[_0xebf6('0x18')]));require(_0xebf6('0x1c'))[_0xebf6('0x1d')](socket);function respondWithStatusCode(_0x4dbf51,_0x4c01f4){_0x4c01f4=_0x4c01f4||0xcc;return function(_0x56b8f8){if(_0x56b8f8){return _0x4dbf51[_0xebf6('0x1e')](_0x4c01f4);}return _0x4dbf51[_0xebf6('0x1f')](_0x4c01f4)['end']();};}function respondWithResult(_0x35570e,_0x2c980f){_0x2c980f=_0x2c980f||0xc8;return function(_0xb164a1){if(_0xb164a1){return _0x35570e[_0xebf6('0x1f')](_0x2c980f)[_0xebf6('0x20')](_0xb164a1);}};}function respondWithFilteredResult(_0x13f495,_0x219621){return function(_0x2dc96f){if(_0x2dc96f){var _0x2d3984=_0x2dc96f[_0xebf6('0x21')],_0x308480=_0x219621[_0xebf6('0x22')],_0x55fa31=_0x219621[_0xebf6('0x22')]+_0x219621[_0xebf6('0x23')],_0x496dea;if(_0x55fa31>=_0x2d3984){_0x55fa31=_0x2d3984;_0x496dea=0xc8;}else{_0x496dea=0xce;}_0x13f495[_0xebf6('0x1f')](_0x496dea);return _0x13f495[_0xebf6('0x24')](_0xebf6('0x25'),_0x308480+'-'+_0x55fa31+'/'+_0x2d3984)[_0xebf6('0x20')](_0x2dc96f);}return null;};}function patchUpdates(_0x4fb497){return function(_0xbe39dd){try{jsonpatch[_0xebf6('0x26')](_0xbe39dd,_0x4fb497,!![]);}catch(_0x377934){return BPromise[_0xebf6('0x27')](_0x377934);}return _0xbe39dd[_0xebf6('0x28')]();};}function saveUpdates(_0x14c8ac,_0x2f419e){return function(_0xfce30a){if(_0xfce30a){return _0xfce30a[_0xebf6('0x29')](_0x14c8ac)[_0xebf6('0x2a')](function(_0x232074){return _0x232074;});}return null;};}function removeEntity(_0x2dd2ed,_0x43c4e2){return function(_0x3b8bc1){if(_0x3b8bc1){return _0x3b8bc1[_0xebf6('0x2b')]()[_0xebf6('0x2a')](function(){var _0x3b2b64=_0x3b8bc1[_0xebf6('0x2c')]({'plain':!![]});var _0x3b58cb='SquareProjects';return db['UserProfileResource'][_0xebf6('0x2b')]({'where':{'type':_0x3b58cb,'resourceId':_0x3b2b64['id']}})['then'](function(){return _0x3b8bc1;});})[_0xebf6('0x2a')](function(){_0x2dd2ed[_0xebf6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f39eb,_0x37950c){return function(_0x40ae57){if(!_0x40ae57){_0x4f39eb[_0xebf6('0x1e')](0x194);}return _0x40ae57;};}function handleError(_0x7959c8,_0xedaaeb){_0xedaaeb=_0xedaaeb||0x1f4;return function(_0x2dc0cf){logger[_0xebf6('0x2d')](_0x2dc0cf[_0xebf6('0x2e')]);if(_0x2dc0cf['name']){delete _0x2dc0cf[_0xebf6('0x2f')];}_0x7959c8[_0xebf6('0x1f')](_0xedaaeb)['send'](_0x2dc0cf);};}exports[_0xebf6('0x30')]=function(_0x28bbea,_0x5ea6b2){var _0x2901fc={},_0x1fa407={},_0x32afa3={'count':0x0,'rows':[]};var _0x221b6e=_[_0xebf6('0x31')](db[_0xebf6('0x32')]['rawAttributes'],function(_0x3818c9){return{'name':_0x3818c9[_0xebf6('0x33')],'type':_0x3818c9['type']['key']};});_0x1fa407[_0xebf6('0x34')]=_[_0xebf6('0x31')](_0x221b6e,'name');_0x1fa407[_0xebf6('0x35')]=_[_0xebf6('0x36')](_0x28bbea['query']);_0x1fa407[_0xebf6('0x37')]=_[_0xebf6('0x38')](_0x1fa407[_0xebf6('0x34')],_0x1fa407['query']);_0x2901fc[_0xebf6('0x39')]=_[_0xebf6('0x38')](_0x1fa407[_0xebf6('0x34')],qs[_0xebf6('0x3a')](_0x28bbea['query']['fields']));_0x2901fc[_0xebf6('0x39')]=_0x2901fc[_0xebf6('0x39')]['length']?_0x2901fc[_0xebf6('0x39')]:_0x1fa407[_0xebf6('0x34')];if(!_0x28bbea['query'][_0xebf6('0x3b')](_0xebf6('0x3c'))){_0x2901fc[_0xebf6('0x23')]=qs[_0xebf6('0x23')](_0x28bbea[_0xebf6('0x35')]['limit']);_0x2901fc[_0xebf6('0x22')]=qs['offset'](_0x28bbea[_0xebf6('0x35')]['offset']);}_0x2901fc[_0xebf6('0x3d')]=qs[_0xebf6('0x3e')](_0x28bbea[_0xebf6('0x35')][_0xebf6('0x3e')]);_0x2901fc[_0xebf6('0x3f')]=qs[_0xebf6('0x37')](_['pick'](_0x28bbea[_0xebf6('0x35')],_0x1fa407[_0xebf6('0x37')]));if(_0x28bbea[_0xebf6('0x35')][_0xebf6('0x40')]){_0x2901fc[_0xebf6('0x3f')]=_[_0xebf6('0x41')](_0x2901fc['where'],{'$or':_[_0xebf6('0x31')](_0x221b6e,function(_0x2782a5){if(_0x2782a5[_0xebf6('0x42')]!==_0xebf6('0x43')){var _0x1457e9={};_0x1457e9[_0x2782a5[_0xebf6('0x2f')]]={'$like':'%'+_0x28bbea['query']['filter']+'%'};return _0x1457e9;}})});}_0x2901fc=_['merge']({},_0x2901fc,_0x28bbea[_0xebf6('0x44')]);var _0x3056ee={'where':_0x2901fc[_0xebf6('0x3f')]};return db['SquareProject'][_0xebf6('0x21')](_0x3056ee)[_0xebf6('0x2a')](function(_0x36c270){_0x32afa3['count']=_0x36c270;if(_0x28bbea[_0xebf6('0x35')][_0xebf6('0x45')]){_0x2901fc['include']=[{'all':!![]}];}return db[_0xebf6('0x32')][_0xebf6('0x46')](_0x2901fc);})[_0xebf6('0x2a')](function(_0x4c93da){_0x32afa3[_0xebf6('0x47')]=_0x4c93da;return _0x32afa3;})['then'](respondWithFilteredResult(_0x5ea6b2,_0x2901fc))['catch'](handleError(_0x5ea6b2,null));};exports[_0xebf6('0x48')]=function(_0x470f62,_0x10ca29){var _0x2ac140={'raw':![],'where':{'id':_0x470f62[_0xebf6('0x49')]['id']}},_0x4fd568={};_0x4fd568['model']=_[_0xebf6('0x36')](db[_0xebf6('0x32')][_0xebf6('0x4a')]);_0x4fd568[_0xebf6('0x35')]=_[_0xebf6('0x36')](_0x470f62['query']);_0x4fd568['filters']=_[_0xebf6('0x38')](_0x4fd568[_0xebf6('0x34')],_0x4fd568[_0xebf6('0x35')]);_0x2ac140[_0xebf6('0x39')]=_['intersection'](_0x4fd568[_0xebf6('0x34')],qs[_0xebf6('0x3a')](_0x470f62[_0xebf6('0x35')][_0xebf6('0x3a')]));_0x2ac140[_0xebf6('0x39')]=_0x2ac140[_0xebf6('0x39')][_0xebf6('0x4b')]?_0x2ac140['attributes']:_0x4fd568[_0xebf6('0x34')];if(_0x470f62[_0xebf6('0x35')][_0xebf6('0x45')]){_0x2ac140[_0xebf6('0x4c')]=[{'all':!![]}];}_0x2ac140=_[_0xebf6('0x41')]({},_0x2ac140,_0x470f62[_0xebf6('0x44')]);return db[_0xebf6('0x32')]['find'](_0x2ac140)[_0xebf6('0x2a')](handleEntityNotFound(_0x10ca29,null))['then'](respondWithResult(_0x10ca29,null))[_0xebf6('0x4d')](handleError(_0x10ca29,null));};exports[_0xebf6('0x4e')]=function(_0x5d84ac,_0xd14e0a){return db['SquareProject'][_0xebf6('0x4e')](_0x5d84ac[_0xebf6('0x4f')],{})[_0xebf6('0x2a')](function(_0x32c8b1){var _0x82f1aa=_0x5d84ac['user'][_0xebf6('0x2c')]({'plain':!![]});if(!_0x82f1aa)throw new Error(_0xebf6('0x50'));if(_0x82f1aa['role']===_0xebf6('0x51')){var _0x2765f2=_0x32c8b1[_0xebf6('0x2c')]({'plain':!![]});var _0x34b203=_0xebf6('0x52');return db['UserProfileSection'][_0xebf6('0x53')]({'where':{'name':_0x34b203,'userProfileId':_0x82f1aa[_0xebf6('0x54')]},'raw':!![]})[_0xebf6('0x2a')](function(_0x4dd74b){if(_0x4dd74b&&_0x4dd74b['autoAssociation']===0x0){return db[_0xebf6('0x55')][_0xebf6('0x4e')]({'name':_0x2765f2[_0xebf6('0x2f')],'resourceId':_0x2765f2['id'],'type':_0x4dd74b[_0xebf6('0x2f')],'sectionId':_0x4dd74b['id']},{})[_0xebf6('0x2a')](function(){return _0x32c8b1;});}else{return _0x32c8b1;}})[_0xebf6('0x4d')](function(_0x1f9159){logger[_0xebf6('0x2d')](_0xebf6('0x56'),_0x1f9159);throw _0x1f9159;});}return _0x32c8b1;})['then'](respondWithResult(_0xd14e0a,0xc9))[_0xebf6('0x4d')](handleError(_0xd14e0a,null));};exports[_0xebf6('0x29')]=function(_0x24ed4e,_0x5c4061){if(_0x24ed4e[_0xebf6('0x4f')]['id']){delete _0x24ed4e['body']['id'];}return db['SquareProject'][_0xebf6('0x53')]({'where':{'id':_0x24ed4e[_0xebf6('0x49')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x5c4061,null))[_0xebf6('0x2a')](saveUpdates(_0x24ed4e[_0xebf6('0x4f')],null))['then'](respondWithResult(_0x5c4061,null))[_0xebf6('0x4d')](handleError(_0x5c4061,null));};exports['destroy']=function(_0x4ed306,_0x4ef686){return db[_0xebf6('0x32')][_0xebf6('0x53')]({'where':{'id':_0x4ed306['params']['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x4ef686,null))[_0xebf6('0x2a')](removeEntity(_0x4ef686,null))[_0xebf6('0x4d')](handleError(_0x4ef686,null));};exports[_0xebf6('0x57')]=function(_0x3a4b20,_0x8c16a8,_0x246f9f){return db['SquareProject'][_0xebf6('0x53')]({'where':{'id':_0x3a4b20[_0xebf6('0x49')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x8c16a8,null))[_0xebf6('0x2a')](function(_0x39637b){if(_0x39637b){return _0x39637b[_0xebf6('0x57')](_0x3a4b20['body'][_0xebf6('0x58')],_[_0xebf6('0x59')](_0x3a4b20[_0xebf6('0x4f')],[_0xebf6('0x58'),'id'])||{});}})[_0xebf6('0x2a')](respondWithResult(_0x8c16a8,null))[_0xebf6('0x4d')](handleError(_0x8c16a8,null));};exports['removeUsers']=function(_0x33c973,_0x193e5b,_0x1ea55c){return db[_0xebf6('0x32')][_0xebf6('0x53')]({'where':{'id':_0x33c973['params']['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x193e5b,null))[_0xebf6('0x2a')](function(_0x416b2a){if(_0x416b2a){return _0x416b2a[_0xebf6('0x5a')](_0x33c973[_0xebf6('0x35')][_0xebf6('0x58')])[_0xebf6('0x2a')](function(){if(_[_0xebf6('0x5b')](_0x33c973[_0xebf6('0x35')][_0xebf6('0x58')])){for(var _0x247439=0x0;_0x247439<_0x33c973['query'][_0xebf6('0x58')][_0xebf6('0x4b')];_0x247439+=0x1){socket[_0xebf6('0x5c')](_0xebf6('0x5d'),{'UserId':Number(_0x33c973[_0xebf6('0x35')][_0xebf6('0x58')][_0x247439]),'SquareProjectId':Number(_0x33c973['params']['id'])});}}else{socket[_0xebf6('0x5c')]('userSquareProject:remove',{'UserId':Number(_0x33c973[_0xebf6('0x35')][_0xebf6('0x58')]),'SquareProjectId':Number(_0x33c973[_0xebf6('0x49')]['id'])});}});}})[_0xebf6('0x2a')](respondWithStatusCode(_0x193e5b,null))[_0xebf6('0x4d')](handleError(_0x193e5b,null));};exports[_0xebf6('0x5e')]=function(_0x398074,_0x5e6951,_0x4ddbbd){var _0x14ff2d={};var _0x104842={};var _0x4b2b6d;var _0x3dc02c;return db[_0xebf6('0x32')]['findOne']({'where':{'id':_0x398074[_0xebf6('0x49')]['id']}})[_0xebf6('0x2a')](handleEntityNotFound(_0x5e6951,null))['then'](function(_0x35a5c4){if(_0x35a5c4){_0x4b2b6d=_0x35a5c4;_0x104842[_0xebf6('0x34')]=_[_0xebf6('0x36')](db[_0xebf6('0x5f')][_0xebf6('0x4a')]);_0x104842[_0xebf6('0x35')]=_[_0xebf6('0x36')](_0x398074['query']);_0x104842[_0xebf6('0x37')]=_[_0xebf6('0x38')](_0x104842[_0xebf6('0x34')],_0x104842[_0xebf6('0x35')]);_0x14ff2d[_0xebf6('0x39')]=_[_0xebf6('0x38')](_0x104842[_0xebf6('0x34')],qs[_0xebf6('0x3a')](_0x398074[_0xebf6('0x35')][_0xebf6('0x3a')]));_0x14ff2d['attributes']=_0x14ff2d['attributes'][_0xebf6('0x4b')]?_0x14ff2d[_0xebf6('0x39')]:_0x104842[_0xebf6('0x34')];_0x14ff2d[_0xebf6('0x3d')]=qs['sort'](_0x398074[_0xebf6('0x35')][_0xebf6('0x3e')]);_0x14ff2d[_0xebf6('0x3f')]=qs[_0xebf6('0x37')](_['pick'](_0x398074['query'],_0x104842['filters']));if(_0x398074[_0xebf6('0x35')][_0xebf6('0x40')]){_0x14ff2d[_0xebf6('0x3f')]=_[_0xebf6('0x41')](_0x14ff2d[_0xebf6('0x3f')],{'$or':_[_0xebf6('0x31')](_0x14ff2d[_0xebf6('0x39')],function(_0x3fc31a){var _0x5844ea={};_0x5844ea[_0x3fc31a]={'$like':'%'+_0x398074[_0xebf6('0x35')][_0xebf6('0x40')]+'%'};return _0x5844ea;})});}_0x14ff2d=_['merge']({},_0x14ff2d,_0x398074['options']);return _0x4b2b6d[_0xebf6('0x5e')](_0x14ff2d);}})['then'](function(_0x89be0){if(_0x89be0){_0x3dc02c=_0x89be0[_0xebf6('0x4b')];if(!_0x398074[_0xebf6('0x35')]['hasOwnProperty'](_0xebf6('0x3c'))){_0x14ff2d[_0xebf6('0x23')]=qs[_0xebf6('0x23')](_0x398074[_0xebf6('0x35')][_0xebf6('0x23')]);_0x14ff2d[_0xebf6('0x22')]=qs['offset'](_0x398074[_0xebf6('0x35')][_0xebf6('0x22')]);}return _0x4b2b6d['getUsers'](_0x14ff2d);}})[_0xebf6('0x2a')](function(_0x1f3606){if(_0x1f3606){return _0x1f3606?{'count':_0x3dc02c,'rows':_0x1f3606}:null;}})[_0xebf6('0x2a')](respondWithResult(_0x5e6951,null))['catch'](handleError(_0x5e6951,null));}; \ No newline at end of file +var _0xda55=['body','addUsers','ids','omit','removeUsers','isArray','emit','userSquareProject:remove','getUsers','findOne','User','order','html-pdf','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','path','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/utils','../../mysqldb','redis','localhost','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','count','offset','limit','Content-Range','json','apply','reject','save','update','destroy','then','get','error','stack','name','send','index','map','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','type','VIRTUAL','includeAll','include','SquareProject','findAll','rows','catch','show','params','rawAttributes','options','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','find','userProfileId','autoAssociation'];(function(_0x2ac4af,_0x288c53){var _0x3a36df=function(_0x271b11){while(--_0x271b11){_0x2ac4af['push'](_0x2ac4af['shift']());}};_0x3a36df(++_0x288c53);}(_0xda55,0x6d));var _0x5da5=function(_0x97acee,_0x202957){_0x97acee=_0x97acee-0x0;var _0x16cc43=_0xda55[_0x97acee];return _0x16cc43;};'use strict';var pdf=require(_0x5da5('0x0'));var emlformat=require(_0x5da5('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5da5('0x2'));var rp=require(_0x5da5('0x3'));var moment=require(_0x5da5('0x4'));var BPromise=require(_0x5da5('0x5'));var Mustache=require(_0x5da5('0x6'));var util=require('util');var path=require(_0x5da5('0x7'));var sox=require('sox');var csv=require(_0x5da5('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x5da5('0x9'));var squel=require(_0x5da5('0xa'));var crypto=require(_0x5da5('0xb'));var jsforce=require(_0x5da5('0xc'));var deskjs=require(_0x5da5('0xd'));var toCsv=require(_0x5da5('0x8'));var querystring=require(_0x5da5('0xe'));var Papa=require(_0x5da5('0xf'));var Redis=require('ioredis');var authService=require(_0x5da5('0x10'));var qs=require(_0x5da5('0x11'));var as=require(_0x5da5('0x12'));var hardwareService=require(_0x5da5('0x13'));var logger=require(_0x5da5('0x14'))(_0x5da5('0x15'));var utils=require(_0x5da5('0x16'));var config=require('../../config/environment');var db=require(_0x5da5('0x17'))['db'];config[_0x5da5('0x18')]=_['defaults'](config[_0x5da5('0x18')],{'host':_0x5da5('0x19'),'port':0x18eb});var socket=require(_0x5da5('0x1a'))(new Redis(config[_0x5da5('0x18')]));require(_0x5da5('0x1b'))[_0x5da5('0x1c')](socket);function respondWithStatusCode(_0x481562,_0x489b60){_0x489b60=_0x489b60||0xcc;return function(_0x4fa4b5){if(_0x4fa4b5){return _0x481562[_0x5da5('0x1d')](_0x489b60);}return _0x481562[_0x5da5('0x1e')](_0x489b60)[_0x5da5('0x1f')]();};}function respondWithResult(_0x665ce8,_0x11bd3){_0x11bd3=_0x11bd3||0xc8;return function(_0x134afa){if(_0x134afa){return _0x665ce8[_0x5da5('0x1e')](_0x11bd3)['json'](_0x134afa);}};}function respondWithFilteredResult(_0x124dc5,_0x290136){return function(_0x1a4849){if(_0x1a4849){var _0x16b11f=_0x1a4849[_0x5da5('0x20')],_0x3f7e98=_0x290136[_0x5da5('0x21')],_0x428b07=_0x290136[_0x5da5('0x21')]+_0x290136[_0x5da5('0x22')],_0x547c58;if(_0x428b07>=_0x16b11f){_0x428b07=_0x16b11f;_0x547c58=0xc8;}else{_0x547c58=0xce;}_0x124dc5[_0x5da5('0x1e')](_0x547c58);return _0x124dc5['set'](_0x5da5('0x23'),_0x3f7e98+'-'+_0x428b07+'/'+_0x16b11f)[_0x5da5('0x24')](_0x1a4849);}return null;};}function patchUpdates(_0x42a3cb){return function(_0x560ea7){try{jsonpatch[_0x5da5('0x25')](_0x560ea7,_0x42a3cb,!![]);}catch(_0x15aa62){return BPromise[_0x5da5('0x26')](_0x15aa62);}return _0x560ea7[_0x5da5('0x27')]();};}function saveUpdates(_0xec69f2,_0x436960){return function(_0x47d4e8){if(_0x47d4e8){return _0x47d4e8[_0x5da5('0x28')](_0xec69f2)['then'](function(_0x1b67c4){return _0x1b67c4;});}return null;};}function removeEntity(_0x716ab7,_0x2dd138){return function(_0x5d983c){if(_0x5d983c){return _0x5d983c[_0x5da5('0x29')]()[_0x5da5('0x2a')](function(){var _0x39dd93=_0x5d983c[_0x5da5('0x2b')]({'plain':!![]});var _0x55d517='SquareProjects';return db['UserProfileResource'][_0x5da5('0x29')]({'where':{'type':_0x55d517,'resourceId':_0x39dd93['id']}})['then'](function(){return _0x5d983c;});})['then'](function(){_0x716ab7[_0x5da5('0x1e')](0xcc)[_0x5da5('0x1f')]();});}};}function handleEntityNotFound(_0x5740a7,_0x1798ae){return function(_0x1ab83e){if(!_0x1ab83e){_0x5740a7['sendStatus'](0x194);}return _0x1ab83e;};}function handleError(_0x3b815e,_0x27de55){_0x27de55=_0x27de55||0x1f4;return function(_0x38bb86){logger[_0x5da5('0x2c')](_0x38bb86[_0x5da5('0x2d')]);if(_0x38bb86['name']){delete _0x38bb86[_0x5da5('0x2e')];}_0x3b815e[_0x5da5('0x1e')](_0x27de55)[_0x5da5('0x2f')](_0x38bb86);};}exports[_0x5da5('0x30')]=function(_0x55e2bf,_0x5ee7f2){var _0x4cb022={},_0x245273={},_0x27ed41={'count':0x0,'rows':[]};var _0x15344b=_[_0x5da5('0x31')](db['SquareProject']['rawAttributes'],function(_0x24e115){return{'name':_0x24e115['fieldName'],'type':_0x24e115['type'][_0x5da5('0x32')]};});_0x245273['model']=_[_0x5da5('0x31')](_0x15344b,_0x5da5('0x2e'));_0x245273[_0x5da5('0x33')]=_[_0x5da5('0x34')](_0x55e2bf[_0x5da5('0x33')]);_0x245273[_0x5da5('0x35')]=_[_0x5da5('0x36')](_0x245273[_0x5da5('0x37')],_0x245273['query']);_0x4cb022[_0x5da5('0x38')]=_['intersection'](_0x245273[_0x5da5('0x37')],qs[_0x5da5('0x39')](_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x39')]));_0x4cb022[_0x5da5('0x38')]=_0x4cb022[_0x5da5('0x38')][_0x5da5('0x3a')]?_0x4cb022[_0x5da5('0x38')]:_0x245273[_0x5da5('0x37')];if(!_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x3b')](_0x5da5('0x3c'))){_0x4cb022[_0x5da5('0x22')]=qs['limit'](_0x55e2bf[_0x5da5('0x33')]['limit']);_0x4cb022[_0x5da5('0x21')]=qs[_0x5da5('0x21')](_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x21')]);}_0x4cb022['order']=qs[_0x5da5('0x3d')](_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x3d')]);_0x4cb022['where']=qs[_0x5da5('0x35')](_[_0x5da5('0x3e')](_0x55e2bf['query'],_0x245273[_0x5da5('0x35')]));if(_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x3f')]){_0x4cb022[_0x5da5('0x40')]=_[_0x5da5('0x41')](_0x4cb022[_0x5da5('0x40')],{'$or':_['map'](_0x15344b,function(_0x1ab02){if(_0x1ab02[_0x5da5('0x42')]!==_0x5da5('0x43')){var _0x7d456f={};_0x7d456f[_0x1ab02[_0x5da5('0x2e')]]={'$like':'%'+_0x55e2bf['query'][_0x5da5('0x3f')]+'%'};return _0x7d456f;}})});}_0x4cb022=_[_0x5da5('0x41')]({},_0x4cb022,_0x55e2bf['options']);var _0x38caed={'where':_0x4cb022['where']};return db['SquareProject'][_0x5da5('0x20')](_0x38caed)[_0x5da5('0x2a')](function(_0x2f6026){_0x27ed41[_0x5da5('0x20')]=_0x2f6026;if(_0x55e2bf[_0x5da5('0x33')][_0x5da5('0x44')]){_0x4cb022[_0x5da5('0x45')]=[{'all':!![]}];}return db[_0x5da5('0x46')][_0x5da5('0x47')](_0x4cb022);})[_0x5da5('0x2a')](function(_0x22d47e){_0x27ed41[_0x5da5('0x48')]=_0x22d47e;return _0x27ed41;})[_0x5da5('0x2a')](respondWithFilteredResult(_0x5ee7f2,_0x4cb022))[_0x5da5('0x49')](handleError(_0x5ee7f2,null));};exports[_0x5da5('0x4a')]=function(_0x30be40,_0x1fc965){var _0x4464a7={'raw':![],'where':{'id':_0x30be40[_0x5da5('0x4b')]['id']}},_0x62183f={};_0x62183f['model']=_['keys'](db[_0x5da5('0x46')][_0x5da5('0x4c')]);_0x62183f['query']=_[_0x5da5('0x34')](_0x30be40[_0x5da5('0x33')]);_0x62183f[_0x5da5('0x35')]=_[_0x5da5('0x36')](_0x62183f[_0x5da5('0x37')],_0x62183f[_0x5da5('0x33')]);_0x4464a7[_0x5da5('0x38')]=_[_0x5da5('0x36')](_0x62183f[_0x5da5('0x37')],qs[_0x5da5('0x39')](_0x30be40['query'][_0x5da5('0x39')]));_0x4464a7['attributes']=_0x4464a7['attributes'][_0x5da5('0x3a')]?_0x4464a7[_0x5da5('0x38')]:_0x62183f[_0x5da5('0x37')];if(_0x30be40[_0x5da5('0x33')][_0x5da5('0x44')]){_0x4464a7[_0x5da5('0x45')]=[{'all':!![]}];}_0x4464a7=_['merge']({},_0x4464a7,_0x30be40[_0x5da5('0x4d')]);return db['SquareProject']['find'](_0x4464a7)[_0x5da5('0x2a')](handleEntityNotFound(_0x1fc965,null))[_0x5da5('0x2a')](respondWithResult(_0x1fc965,null))['catch'](handleError(_0x1fc965,null));};exports[_0x5da5('0x4e')]=function(_0x322b08,_0x783735){return db[_0x5da5('0x46')][_0x5da5('0x4e')](_0x322b08['body'],{})[_0x5da5('0x2a')](function(_0x5277bc){var _0x535b22=_0x322b08[_0x5da5('0x4f')]['get']({'plain':!![]});if(!_0x535b22)throw new Error(_0x5da5('0x50'));if(_0x535b22[_0x5da5('0x51')]===_0x5da5('0x4f')){var _0x1ec725=_0x5277bc[_0x5da5('0x2b')]({'plain':!![]});var _0xceea44='SquareProjects';return db['UserProfileSection'][_0x5da5('0x52')]({'where':{'name':_0xceea44,'userProfileId':_0x535b22[_0x5da5('0x53')]},'raw':!![]})['then'](function(_0x4fca4c){if(_0x4fca4c&&_0x4fca4c[_0x5da5('0x54')]===0x0){return db['UserProfileResource'][_0x5da5('0x4e')]({'name':_0x1ec725['name'],'resourceId':_0x1ec725['id'],'type':_0x4fca4c['name'],'sectionId':_0x4fca4c['id']},{})[_0x5da5('0x2a')](function(){return _0x5277bc;});}else{return _0x5277bc;}})[_0x5da5('0x49')](function(_0xc2b9a5){logger[_0x5da5('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xc2b9a5);throw _0xc2b9a5;});}return _0x5277bc;})[_0x5da5('0x2a')](respondWithResult(_0x783735,0xc9))[_0x5da5('0x49')](handleError(_0x783735,null));};exports[_0x5da5('0x28')]=function(_0x56523b,_0x2c316e){if(_0x56523b[_0x5da5('0x55')]['id']){delete _0x56523b[_0x5da5('0x55')]['id'];}return db[_0x5da5('0x46')][_0x5da5('0x52')]({'where':{'id':_0x56523b[_0x5da5('0x4b')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x2c316e,null))[_0x5da5('0x2a')](saveUpdates(_0x56523b[_0x5da5('0x55')],null))[_0x5da5('0x2a')](respondWithResult(_0x2c316e,null))[_0x5da5('0x49')](handleError(_0x2c316e,null));};exports[_0x5da5('0x29')]=function(_0x211b80,_0x197497){return db[_0x5da5('0x46')][_0x5da5('0x52')]({'where':{'id':_0x211b80[_0x5da5('0x4b')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x197497,null))[_0x5da5('0x2a')](removeEntity(_0x197497,null))[_0x5da5('0x49')](handleError(_0x197497,null));};exports[_0x5da5('0x56')]=function(_0x4cc539,_0x1d3625,_0x35939b){return db['SquareProject']['find']({'where':{'id':_0x4cc539['params']['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x1d3625,null))[_0x5da5('0x2a')](function(_0x20c269){if(_0x20c269){return _0x20c269['addUsers'](_0x4cc539['body'][_0x5da5('0x57')],_[_0x5da5('0x58')](_0x4cc539[_0x5da5('0x55')],[_0x5da5('0x57'),'id'])||{});}})['then'](respondWithResult(_0x1d3625,null))[_0x5da5('0x49')](handleError(_0x1d3625,null));};exports[_0x5da5('0x59')]=function(_0x34b4b0,_0x4e4ffa,_0x2d6e0f){return db['SquareProject'][_0x5da5('0x52')]({'where':{'id':_0x34b4b0[_0x5da5('0x4b')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x4e4ffa,null))[_0x5da5('0x2a')](function(_0x12c983){if(_0x12c983){return _0x12c983[_0x5da5('0x59')](_0x34b4b0[_0x5da5('0x33')][_0x5da5('0x57')])[_0x5da5('0x2a')](function(){if(_[_0x5da5('0x5a')](_0x34b4b0[_0x5da5('0x33')][_0x5da5('0x57')])){for(var _0x34697a=0x0;_0x34697a<_0x34b4b0[_0x5da5('0x33')][_0x5da5('0x57')][_0x5da5('0x3a')];_0x34697a+=0x1){socket[_0x5da5('0x5b')](_0x5da5('0x5c'),{'UserId':Number(_0x34b4b0[_0x5da5('0x33')][_0x5da5('0x57')][_0x34697a]),'SquareProjectId':Number(_0x34b4b0[_0x5da5('0x4b')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x34b4b0[_0x5da5('0x33')][_0x5da5('0x57')]),'SquareProjectId':Number(_0x34b4b0[_0x5da5('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4e4ffa,null))[_0x5da5('0x49')](handleError(_0x4e4ffa,null));};exports[_0x5da5('0x5d')]=function(_0x43b55e,_0x23af39,_0x50331b){var _0x2c6689={};var _0x5f3753={};var _0x228f9e;var _0x5f862f;return db[_0x5da5('0x46')][_0x5da5('0x5e')]({'where':{'id':_0x43b55e[_0x5da5('0x4b')]['id']}})[_0x5da5('0x2a')](handleEntityNotFound(_0x23af39,null))[_0x5da5('0x2a')](function(_0x512f01){if(_0x512f01){_0x228f9e=_0x512f01;_0x5f3753['model']=_['keys'](db[_0x5da5('0x5f')][_0x5da5('0x4c')]);_0x5f3753[_0x5da5('0x33')]=_[_0x5da5('0x34')](_0x43b55e[_0x5da5('0x33')]);_0x5f3753[_0x5da5('0x35')]=_[_0x5da5('0x36')](_0x5f3753[_0x5da5('0x37')],_0x5f3753['query']);_0x2c6689[_0x5da5('0x38')]=_[_0x5da5('0x36')](_0x5f3753['model'],qs['fields'](_0x43b55e[_0x5da5('0x33')]['fields']));_0x2c6689[_0x5da5('0x38')]=_0x2c6689['attributes'][_0x5da5('0x3a')]?_0x2c6689[_0x5da5('0x38')]:_0x5f3753[_0x5da5('0x37')];_0x2c6689[_0x5da5('0x60')]=qs[_0x5da5('0x3d')](_0x43b55e[_0x5da5('0x33')][_0x5da5('0x3d')]);_0x2c6689[_0x5da5('0x40')]=qs[_0x5da5('0x35')](_[_0x5da5('0x3e')](_0x43b55e[_0x5da5('0x33')],_0x5f3753[_0x5da5('0x35')]));if(_0x43b55e['query']['filter']){_0x2c6689[_0x5da5('0x40')]=_[_0x5da5('0x41')](_0x2c6689[_0x5da5('0x40')],{'$or':_[_0x5da5('0x31')](_0x2c6689['attributes'],function(_0x487282){var _0x52b71b={};_0x52b71b[_0x487282]={'$like':'%'+_0x43b55e[_0x5da5('0x33')][_0x5da5('0x3f')]+'%'};return _0x52b71b;})});}_0x2c6689=_[_0x5da5('0x41')]({},_0x2c6689,_0x43b55e[_0x5da5('0x4d')]);return _0x228f9e[_0x5da5('0x5d')](_0x2c6689);}})[_0x5da5('0x2a')](function(_0x245a85){if(_0x245a85){_0x5f862f=_0x245a85[_0x5da5('0x3a')];if(!_0x43b55e[_0x5da5('0x33')][_0x5da5('0x3b')](_0x5da5('0x3c'))){_0x2c6689[_0x5da5('0x22')]=qs[_0x5da5('0x22')](_0x43b55e[_0x5da5('0x33')][_0x5da5('0x22')]);_0x2c6689[_0x5da5('0x21')]=qs[_0x5da5('0x21')](_0x43b55e[_0x5da5('0x33')][_0x5da5('0x21')]);}return _0x228f9e[_0x5da5('0x5d')](_0x2c6689);}})[_0x5da5('0x2a')](function(_0x5a7f21){if(_0x5a7f21){return _0x5a7f21?{'count':_0x5f862f,'rows':_0x5a7f21}:null;}})[_0x5da5('0x2a')](respondWithResult(_0x23af39,null))[_0x5da5('0x49')](handleError(_0x23af39,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index acbeddf..00efff7 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 _0xf2cb=['update','emit','hasOwnProperty','hook','../../mysqldb','setMaxListeners'];(function(_0x2d6370,_0x408154){var _0x428c2e=function(_0x28f42a){while(--_0x28f42a){_0x2d6370['push'](_0x2d6370['shift']());}};_0x428c2e(++_0x408154);}(_0xf2cb,0x130));var _0xbf2c=function(_0x37c7c4,_0x22887a){_0x37c7c4=_0x37c7c4-0x0;var _0x22ac1d=_0xf2cb[_0x37c7c4];return _0x22ac1d;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0xbf2c('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xbf2c('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':_0xbf2c('0x2'),'afterDestroy':'remove'};function emitEvent(_0x1ecb79){return function(_0x41c649,_0x5abeb3,_0x52cc1a){SquareProjectEvents[_0xbf2c('0x3')](_0x1ecb79+':'+_0x41c649['id'],_0x41c649);SquareProjectEvents[_0xbf2c('0x3')](_0x1ecb79,_0x41c649);_0x52cc1a(null);};}for(var e in events){if(events[_0xbf2c('0x4')](e)){var event=events[e];SquareProject[_0xbf2c('0x5')](e,emitEvent(event));}}module['exports']=SquareProjectEvents; \ No newline at end of file +var _0x88f2=['SquareProject','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x1d1d34,_0x49c0ec){var _0x4d8023=function(_0x36ee56){while(--_0x36ee56){_0x1d1d34['push'](_0x1d1d34['shift']());}};_0x4d8023(++_0x49c0ec);}(_0x88f2,0x1c1));var _0x288f=function(_0x1d04c8,_0x43e69b){_0x1d04c8=_0x1d04c8-0x0;var _0x30ba8f=_0x88f2[_0x1d04c8];return _0x30ba8f;};'use strict';var EventEmitter=require(_0x288f('0x0'));var SquareProject=require(_0x288f('0x1'))['db'][_0x288f('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x288f('0x3')](0x0);var events={'afterCreate':_0x288f('0x4'),'afterUpdate':_0x288f('0x5'),'afterDestroy':_0x288f('0x6')};function emitEvent(_0x23248a){return function(_0x2750b7,_0x174387,_0x265aa9){SquareProjectEvents[_0x288f('0x7')](_0x23248a+':'+_0x2750b7['id'],_0x2750b7);SquareProjectEvents[_0x288f('0x7')](_0x23248a,_0x2750b7);_0x265aa9(null);};}for(var e in events){if(events[_0x288f('0x8')](e)){var event=events[e];SquareProject[_0x288f('0x9')](e,emitEvent(event));}}module[_0x288f('0xa')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index d5c42a5..cdadd16 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 _0x48f3=['bluebird','path','rimraf','./squareProject.attributes','exports','define','SquareProject','lodash','util','../../config/logger','api','moment'];(function(_0x3aae01,_0x3911e){var _0x964cd8=function(_0x52f8ae){while(--_0x52f8ae){_0x3aae01['push'](_0x3aae01['shift']());}};_0x964cd8(++_0x3911e);}(_0x48f3,0x193));var _0x348f=function(_0xba4839,_0x575d37){_0xba4839=_0xba4839-0x0;var _0x1969c8=_0x48f3[_0xba4839];return _0x1969c8;};'use strict';var _=require(_0x348f('0x0'));var util=require(_0x348f('0x1'));var logger=require(_0x348f('0x2'))(_0x348f('0x3'));var moment=require(_0x348f('0x4'));var BPromise=require(_0x348f('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x348f('0x6'));var rimraf=require(_0x348f('0x7'));var config=require('../../config/environment');var attributes=require(_0x348f('0x8'));module[_0x348f('0x9')]=function(_0x3c04c8,_0x332bf9){return _0x3c04c8[_0x348f('0xa')](_0x348f('0xb'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2f76=['path','rimraf','../../config/environment','exports','define','lodash','../../config/logger','api','moment','bluebird'];(function(_0x344357,_0x484651){var _0x1aaa49=function(_0x8392f0){while(--_0x8392f0){_0x344357['push'](_0x344357['shift']());}};_0x1aaa49(++_0x484651);}(_0x2f76,0x11d));var _0x62f7=function(_0x506f99,_0x24448f){_0x506f99=_0x506f99-0x0;var _0x5ac530=_0x2f76[_0x506f99];return _0x5ac530;};'use strict';var _=require(_0x62f7('0x0'));var util=require('util');var logger=require(_0x62f7('0x1'))(_0x62f7('0x2'));var moment=require(_0x62f7('0x3'));var BPromise=require(_0x62f7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x62f7('0x5'));var rimraf=require(_0x62f7('0x6'));var config=require(_0x62f7('0x7'));var attributes=require('./squareProject.attributes');module[_0x62f7('0x8')]=function(_0xd9362e,_0x3fb199){return _0xd9362e[_0x62f7('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 ea19eb0..f5a8aba 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 _0x9dbf=['../../config/environment','jayson/promise','client','redis','./squareProject.socket','register','request','then','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','find','options','raw','include','map','model','attributes','ShowSquareProject','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc'];(function(_0x3898c2,_0x58ba6d){var _0x10bf68=function(_0x2a98cf){while(--_0x2a98cf){_0x3898c2['push'](_0x3898c2['shift']());}};_0x10bf68(++_0x58ba6d);}(_0x9dbf,0x110));var _0xf9db=function(_0x519f80,_0x12782d){_0x519f80=_0x519f80-0x0;var _0x12db92=_0x9dbf[_0x519f80];return _0x12db92;};'use strict';var _=require(_0xf9db('0x0'));var util=require('util');var moment=require(_0xf9db('0x1'));var BPromise=require(_0xf9db('0x2'));var rs=require(_0xf9db('0x3'));var fs=require('fs');var Redis=require(_0xf9db('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf9db('0x5'));var logger=require(_0xf9db('0x6'))(_0xf9db('0x7'));var config=require(_0xf9db('0x8'));var jayson=require(_0xf9db('0x9'));var client=jayson[_0xf9db('0xa')]['http']({'port':0x232a});config['redis']=_['defaults'](config[_0xf9db('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf9db('0xb')]));require(_0xf9db('0xc'))[_0xf9db('0xd')](socket);function respondWithRpcPromise(_0x30512b,_0x7e080b,_0x55c22f){return new BPromise(function(_0x22b411,_0x468f44){return client[_0xf9db('0xe')](_0x30512b,_0x55c22f)[_0xf9db('0xf')](function(_0x11aee4){logger[_0xf9db('0x10')](_0xf9db('0x11'),_0x7e080b,_0xf9db('0x12'));logger[_0xf9db('0x13')](_0xf9db('0x14'),_0x7e080b,_0xf9db('0x12'),JSON[_0xf9db('0x15')](_0x11aee4));if(_0x11aee4['error']){if(_0x11aee4[_0xf9db('0x16')][_0xf9db('0x17')]===0x1f4){logger[_0xf9db('0x16')]('SquareProject,\x20%s,\x20%s',_0x7e080b,_0x11aee4[_0xf9db('0x16')]['message']);return _0x468f44(_0x11aee4[_0xf9db('0x16')][_0xf9db('0x18')]);}logger[_0xf9db('0x16')](_0xf9db('0x11'),_0x7e080b,_0x11aee4[_0xf9db('0x16')][_0xf9db('0x18')]);return _0x22b411(_0x11aee4[_0xf9db('0x16')]['message']);}else{logger['info'](_0xf9db('0x11'),_0x7e080b,_0xf9db('0x12'));_0x22b411(_0x11aee4[_0xf9db('0x19')][_0xf9db('0x18')]);}})['catch'](function(_0x1503c4){logger['error'](_0xf9db('0x11'),_0x7e080b,_0x1503c4);_0x468f44(_0x1503c4);});});}exports['ShowSquareProject']=function(_0x27031e){var _0x186e34=this;return new Promise(function(_0x238119,_0x298831){return db['SquareProject'][_0xf9db('0x1a')]({'raw':_0x27031e[_0xf9db('0x1b')]?_0x27031e['options'][_0xf9db('0x1c')]===undefined?!![]:![]:!![],'where':_0x27031e['options']?_0x27031e[_0xf9db('0x1b')]['where']||null:null,'attributes':_0x27031e['options']?_0x27031e[_0xf9db('0x1b')]['attributes']||null:null,'include':_0x27031e[_0xf9db('0x1b')]?_0x27031e[_0xf9db('0x1b')][_0xf9db('0x1d')]?_[_0xf9db('0x1e')](_0x27031e['options']['include'],function(_0x35d4e7){return{'model':db[_0x35d4e7[_0xf9db('0x1f')]],'as':_0x35d4e7['as'],'attributes':_0x35d4e7['attributes'],'include':_0x35d4e7[_0xf9db('0x1d')]?_[_0xf9db('0x1e')](_0x35d4e7[_0xf9db('0x1d')],function(_0x5606a5){return{'model':db[_0x5606a5[_0xf9db('0x1f')]],'as':_0x5606a5['as'],'attributes':_0x5606a5['attributes'],'include':_0x5606a5[_0xf9db('0x1d')]?_[_0xf9db('0x1e')](_0x5606a5['include'],function(_0xa91ff2){return{'model':db[_0xa91ff2[_0xf9db('0x1f')]],'as':_0xa91ff2['as'],'attributes':_0xa91ff2[_0xf9db('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf9db('0xf')](function(_0x11f5ef){logger[_0xf9db('0x10')](_0xf9db('0x21'),_0x27031e);logger[_0xf9db('0x13')](_0xf9db('0x21'),_0x27031e,JSON[_0xf9db('0x15')](_0x11f5ef));_0x238119(_0x11f5ef);})[_0xf9db('0x22')](function(_0x5d07fc){logger['error'](_0xf9db('0x21'),_0x5d07fc[_0xf9db('0x18')],_0x27031e);_0x298831(_0x186e34[_0xf9db('0x16')](0x1f4,_0x5d07fc['message']));});});}; \ No newline at end of file +var _0x9faa=['code','SquareProject,\x20%s,\x20%s','message','result','catch','ShowSquareProject','SquareProject','find','options','raw','where','attributes','include','map','model','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','request','then','info','debug','SquareProject,\x20%s,\x20%s,\x20%s','request\x20sent','error'];(function(_0x2991ea,_0x4a0231){var _0x4e1c51=function(_0x59ed64){while(--_0x59ed64){_0x2991ea['push'](_0x2991ea['shift']());}};_0x4e1c51(++_0x4a0231);}(_0x9faa,0x120));var _0xa9fa=function(_0x12b2ba,_0x2591fa){_0x12b2ba=_0x12b2ba-0x0;var _0x521d7f=_0x9faa[_0x12b2ba];return _0x521d7f;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa9fa('0x0'));var BPromise=require(_0xa9fa('0x1'));var rs=require(_0xa9fa('0x2'));var fs=require('fs');var Redis=require(_0xa9fa('0x3'));var db=require(_0xa9fa('0x4'))['db'];var utils=require(_0xa9fa('0x5'));var logger=require(_0xa9fa('0x6'))(_0xa9fa('0x7'));var config=require(_0xa9fa('0x8'));var jayson=require(_0xa9fa('0x9'));var client=jayson['client'][_0xa9fa('0xa')]({'port':0x232a});config[_0xa9fa('0xb')]=_[_0xa9fa('0xc')](config[_0xa9fa('0xb')],{'host':_0xa9fa('0xd'),'port':0x18eb});var socket=require(_0xa9fa('0xe'))(new Redis(config[_0xa9fa('0xb')]));require(_0xa9fa('0xf'))[_0xa9fa('0x10')](socket);function respondWithRpcPromise(_0x1b1c5e,_0x1b920f,_0x234e47){return new BPromise(function(_0x3363fb,_0x4b91f2){return client[_0xa9fa('0x11')](_0x1b1c5e,_0x234e47)[_0xa9fa('0x12')](function(_0x57661a){logger[_0xa9fa('0x13')]('SquareProject,\x20%s,\x20%s',_0x1b920f,'request\x20sent');logger[_0xa9fa('0x14')](_0xa9fa('0x15'),_0x1b920f,_0xa9fa('0x16'),JSON['stringify'](_0x57661a));if(_0x57661a[_0xa9fa('0x17')]){if(_0x57661a['error'][_0xa9fa('0x18')]===0x1f4){logger['error'](_0xa9fa('0x19'),_0x1b920f,_0x57661a[_0xa9fa('0x17')][_0xa9fa('0x1a')]);return _0x4b91f2(_0x57661a['error']['message']);}logger[_0xa9fa('0x17')]('SquareProject,\x20%s,\x20%s',_0x1b920f,_0x57661a[_0xa9fa('0x17')][_0xa9fa('0x1a')]);return _0x3363fb(_0x57661a[_0xa9fa('0x17')][_0xa9fa('0x1a')]);}else{logger['info'](_0xa9fa('0x19'),_0x1b920f,'request\x20sent');_0x3363fb(_0x57661a[_0xa9fa('0x1b')]['message']);}})[_0xa9fa('0x1c')](function(_0x4513a4){logger[_0xa9fa('0x17')](_0xa9fa('0x19'),_0x1b920f,_0x4513a4);_0x4b91f2(_0x4513a4);});});}exports[_0xa9fa('0x1d')]=function(_0x95c8aa){var _0x2e994b=this;return new Promise(function(_0x315fe8,_0x2413db){return db[_0xa9fa('0x1e')][_0xa9fa('0x1f')]({'raw':_0x95c8aa[_0xa9fa('0x20')]?_0x95c8aa['options'][_0xa9fa('0x21')]===undefined?!![]:![]:!![],'where':_0x95c8aa[_0xa9fa('0x20')]?_0x95c8aa[_0xa9fa('0x20')][_0xa9fa('0x22')]||null:null,'attributes':_0x95c8aa[_0xa9fa('0x20')]?_0x95c8aa[_0xa9fa('0x20')][_0xa9fa('0x23')]||null:null,'include':_0x95c8aa['options']?_0x95c8aa[_0xa9fa('0x20')][_0xa9fa('0x24')]?_[_0xa9fa('0x25')](_0x95c8aa[_0xa9fa('0x20')][_0xa9fa('0x24')],function(_0x2f6ad1){return{'model':db[_0x2f6ad1[_0xa9fa('0x26')]],'as':_0x2f6ad1['as'],'attributes':_0x2f6ad1[_0xa9fa('0x23')],'include':_0x2f6ad1['include']?_['map'](_0x2f6ad1[_0xa9fa('0x24')],function(_0x2f377f){return{'model':db[_0x2f377f[_0xa9fa('0x26')]],'as':_0x2f377f['as'],'attributes':_0x2f377f[_0xa9fa('0x23')],'include':_0x2f377f[_0xa9fa('0x24')]?_[_0xa9fa('0x25')](_0x2f377f[_0xa9fa('0x24')],function(_0x1bdf4a){return{'model':db[_0x1bdf4a[_0xa9fa('0x26')]],'as':_0x1bdf4a['as'],'attributes':_0x1bdf4a['attributes']};}):[]};}):[]};}):[]:[]})[_0xa9fa('0x12')](function(_0xe3a536){logger[_0xa9fa('0x13')]('ShowSquareProject',_0x95c8aa);logger[_0xa9fa('0x14')](_0xa9fa('0x1d'),_0x95c8aa,JSON['stringify'](_0xe3a536));_0x315fe8(_0xe3a536);})[_0xa9fa('0x1c')](function(_0x5e75a9){logger[_0xa9fa('0x17')](_0xa9fa('0x1d'),_0x5e75a9[_0xa9fa('0x1a')],_0x95c8aa);_0x2413db(_0x2e994b['error'](0x1f4,_0x5e75a9[_0xa9fa('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 0a61f7e..5e14d27 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 _0x71ab=['length','squareProject:','save','update','emit','removeListener','register'];(function(_0x26c568,_0x355fba){var _0x2fb394=function(_0x585446){while(--_0x585446){_0x26c568['push'](_0x26c568['shift']());}};_0x2fb394(++_0x355fba);}(_0x71ab,0x64));var _0xb71a=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x71ab[_0x21a9d9];return _0x46adce;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xb71a('0x0'),'remove',_0xb71a('0x1')];function createListener(_0x5bdf89,_0x3e985a){return function(_0x3f0529){_0x3e985a[_0xb71a('0x2')](_0x5bdf89,_0x3f0529);};}function removeListener(_0x4094b2,_0x37ce74){return function(){SquareProjectEvents[_0xb71a('0x3')](_0x4094b2,_0x37ce74);};}exports[_0xb71a('0x4')]=function(_0x38d931){for(var _0x22c072=0x0,_0x35a84e=events[_0xb71a('0x5')];_0x22c072<_0x35a84e;_0x22c072++){var _0x2a4c86=events[_0x22c072];var _0x43ca14=createListener(_0xb71a('0x6')+_0x2a4c86,_0x38d931);SquareProjectEvents['on'](_0x2a4c86,_0x43ca14);}}; \ No newline at end of file +var _0x33af=['emit','removeListener','register','length','squareProject:','save','update'];(function(_0x3792d0,_0x14e951){var _0x3b2877=function(_0x343ed5){while(--_0x343ed5){_0x3792d0['push'](_0x3792d0['shift']());}};_0x3b2877(++_0x14e951);}(_0x33af,0xec));var _0xf33a=function(_0x11e239,_0x3cfa93){_0x11e239=_0x11e239-0x0;var _0x4b1ee8=_0x33af[_0x11e239];return _0x4b1ee8;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0xf33a('0x0'),'remove',_0xf33a('0x1')];function createListener(_0x1111c6,_0x267057){return function(_0x4303f1){_0x267057[_0xf33a('0x2')](_0x1111c6,_0x4303f1);};}function removeListener(_0x25f156,_0x4c734e){return function(){SquareProjectEvents[_0xf33a('0x3')](_0x25f156,_0x4c734e);};}exports[_0xf33a('0x4')]=function(_0x583e54){for(var _0xc0dd13=0x0,_0x384b14=events[_0xf33a('0x5')];_0xc0dd13<_0x384b14;_0xc0dd13++){var _0x2f3730=events[_0xc0dd13];var _0x2baabb=createListener(_0xf33a('0x6')+_0x2f3730,_0x583e54);SquareProjectEvents['on'](_0x2f3730,_0x2baabb);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index dde67a8..48d47e2 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 _0x5985=['update','delete','/:id/delete','destroy','exports','multer','util','connect-timeout','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','post','create'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x5985,0x10f));var _0x5598=function(_0x434286,_0x3cec33){_0x434286=_0x434286-0x0;var _0x1e06d7=_0x5985[_0x434286];return _0x1e06d7;};'use strict';var multer=require(_0x5598('0x0'));var util=require(_0x5598('0x1'));var path=require('path');var timeout=require(_0x5598('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0x5598('0x3'));var config=require(_0x5598('0x4'));var controller=require(_0x5598('0x5'));router[_0x5598('0x6')]('/',auth[_0x5598('0x7')](),controller[_0x5598('0x8')]);router['get'](_0x5598('0x9'),auth[_0x5598('0x7')](),controller[_0x5598('0xa')]);router[_0x5598('0x6')](_0x5598('0xb'),auth[_0x5598('0x7')](),controller['download']);router[_0x5598('0xc')]('/',auth['isAuthenticated'](),controller[_0x5598('0xd')]);router['put']('/:id',auth[_0x5598('0x7')](),controller[_0x5598('0xe')]);router[_0x5598('0xf')](_0x5598('0x10'),auth[_0x5598('0x7')](),controller[_0x5598('0x11')]);module[_0x5598('0x12')]=router; \ No newline at end of file +var _0x0dd1=['/:id/delete','destroy','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete'];(function(_0x214596,_0x436156){var _0x39169b=function(_0x291d7a){while(--_0x291d7a){_0x214596['push'](_0x214596['shift']());}};_0x39169b(++_0x436156);}(_0x0dd1,0x80));var _0x10dd=function(_0x6ff3a9,_0x13b9c2){_0x6ff3a9=_0x6ff3a9-0x0;var _0x249066=_0x0dd1[_0x6ff3a9];return _0x249066;};'use strict';var multer=require(_0x10dd('0x0'));var util=require('util');var path=require(_0x10dd('0x1'));var timeout=require(_0x10dd('0x2'));var express=require(_0x10dd('0x3'));var router=express[_0x10dd('0x4')]();var auth=require(_0x10dd('0x5'));var interaction=require(_0x10dd('0x6'));var config=require(_0x10dd('0x7'));var controller=require(_0x10dd('0x8'));router[_0x10dd('0x9')]('/',auth[_0x10dd('0xa')](),controller[_0x10dd('0xb')]);router[_0x10dd('0x9')]('/:id',auth[_0x10dd('0xa')](),controller[_0x10dd('0xc')]);router[_0x10dd('0x9')]('/:id/download',auth[_0x10dd('0xa')](),controller['download']);router[_0x10dd('0xd')]('/',auth[_0x10dd('0xa')](),controller[_0x10dd('0xe')]);router[_0x10dd('0xf')](_0x10dd('0x10'),auth[_0x10dd('0xa')](),controller[_0x10dd('0x11')]);router[_0x10dd('0x12')](_0x10dd('0x13'),auth[_0x10dd('0xa')](),controller[_0x10dd('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 1dea45b..15a57d8 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 _0x3456=['exports','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf','sequelize'];(function(_0x3b6652,_0x32486d){var _0x14d39f=function(_0x3a595a){while(--_0x3a595a){_0x3b6652['push'](_0x3b6652['shift']());}};_0x14d39f(++_0x32486d);}(_0x3456,0x67));var _0x6345=function(_0xf2628e,_0x521bf7){_0xf2628e=_0xf2628e-0x0;var _0x13863a=_0x3456[_0xf2628e];return _0x13863a;};'use strict';var Sequelize=require(_0x6345('0x0'));module[_0x6345('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x6345('0x2')]},'context':{'type':Sequelize[_0x6345('0x2')]},'extension':{'type':Sequelize[_0x6345('0x2')]},'priority':{'type':Sequelize[_0x6345('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'projectName':{'type':Sequelize[_0x6345('0x2')]},'saveName':{'type':Sequelize[_0x6345('0x2')]},'filename':{'type':Sequelize[_0x6345('0x2')]},'savePath':{'type':Sequelize[_0x6345('0x2')]},'format':{'type':Sequelize[_0x6345('0x3')],'get':function(){var _0x44a690='';var _0x1c2a9b=this[_0x6345('0x4')](_0x6345('0x5'));if(_0x1c2a9b){_0x44a690=_0x1c2a9b[_0x6345('0x6')](_0x1c2a9b[_0x6345('0x7')]('.'));}return _0x44a690;}}}; \ No newline at end of file +var _0x6197=['sequelize','STRING','VIRTUAL','getDataValue','savePath','substring','lastIndexOf'];(function(_0x4abf13,_0x11696f){var _0x126df9=function(_0x222d82){while(--_0x222d82){_0x4abf13['push'](_0x4abf13['shift']());}};_0x126df9(++_0x11696f);}(_0x6197,0x142));var _0x7619=function(_0x14e7f7,_0x4e1e53){_0x14e7f7=_0x14e7f7-0x0;var _0x1cd6a7=_0x6197[_0x14e7f7];return _0x1cd6a7;};'use strict';var Sequelize=require(_0x7619('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x7619('0x1')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7619('0x1')]},'context':{'type':Sequelize[_0x7619('0x1')]},'extension':{'type':Sequelize[_0x7619('0x1')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x7619('0x1')]},'dnid':{'type':Sequelize[_0x7619('0x1')]},'projectName':{'type':Sequelize[_0x7619('0x1')]},'saveName':{'type':Sequelize[_0x7619('0x1')]},'filename':{'type':Sequelize[_0x7619('0x1')]},'savePath':{'type':Sequelize[_0x7619('0x1')]},'format':{'type':Sequelize[_0x7619('0x2')],'get':function(){var _0x42b027='';var _0x34f8e4=this[_0x7619('0x3')](_0x7619('0x4'));if(_0x34f8e4){_0x42b027=_0x34f8e4[_0x7619('0x5')](_0x34f8e4[_0x7619('0x6')]('.'));}return _0x42b027;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index c27231a..6f568e4 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 _0x0cba=['moment','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','stack','name','send','index','map','SquareRecording','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','count','include','findAll','rows','params','includeAll','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','%s.cypher','existsSync','secrets','recording','Sequelize','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','info','unlinkSync','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x267281,_0x58544b){var _0x255146=function(_0x5f3b4c){while(--_0x5f3b4c){_0x267281['push'](_0x267281['shift']());}};_0x255146(++_0x58544b);}(_0x0cba,0x183));var _0xa0cb=function(_0x3cb09b,_0x31c2a5){_0x3cb09b=_0x3cb09b-0x0;var _0x242048=_0x0cba[_0x3cb09b];return _0x242048;};'use strict';var pdf=require(_0xa0cb('0x0'));var emlformat=require(_0xa0cb('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa0cb('0x2'));var jsonpatch=require(_0xa0cb('0x3'));var rp=require(_0xa0cb('0x4'));var moment=require(_0xa0cb('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa0cb('0x6'));var path=require('path');var sox=require(_0xa0cb('0x7'));var csv=require(_0xa0cb('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa0cb('0x9'));var squel=require(_0xa0cb('0xa'));var crypto=require(_0xa0cb('0xb'));var jsforce=require(_0xa0cb('0xc'));var deskjs=require(_0xa0cb('0xd'));var toCsv=require(_0xa0cb('0x8'));var querystring=require('querystring');var Papa=require(_0xa0cb('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa0cb('0xf'));var as=require(_0xa0cb('0x10'));var hardwareService=require(_0xa0cb('0x11'));var logger=require(_0xa0cb('0x12'))(_0xa0cb('0x13'));var utils=require(_0xa0cb('0x14'));var config=require(_0xa0cb('0x15'));var db=require(_0xa0cb('0x16'))['db'];function respondWithStatusCode(_0x142460,_0x2907f2){_0x2907f2=_0x2907f2||0xcc;return function(_0x43a85c){if(_0x43a85c){return _0x142460['sendStatus'](_0x2907f2);}return _0x142460[_0xa0cb('0x17')](_0x2907f2)[_0xa0cb('0x18')]();};}function respondWithResult(_0x35d22e,_0xd72b0c){_0xd72b0c=_0xd72b0c||0xc8;return function(_0x9bda8){if(_0x9bda8){return _0x35d22e['status'](_0xd72b0c)[_0xa0cb('0x19')](_0x9bda8);}};}function respondWithFilteredResult(_0x54de0b,_0x53dd2d){return function(_0x182fd8){if(_0x182fd8){var _0x3e2590=_0x182fd8['count'],_0x193530=_0x53dd2d[_0xa0cb('0x1a')],_0x31d9a0=_0x53dd2d[_0xa0cb('0x1a')]+_0x53dd2d[_0xa0cb('0x1b')],_0x383919;if(_0x31d9a0>=_0x3e2590){_0x31d9a0=_0x3e2590;_0x383919=0xc8;}else{_0x383919=0xce;}_0x54de0b[_0xa0cb('0x17')](_0x383919);return _0x54de0b[_0xa0cb('0x1c')](_0xa0cb('0x1d'),_0x193530+'-'+_0x31d9a0+'/'+_0x3e2590)['json'](_0x182fd8);}return null;};}function patchUpdates(_0x1f464c){return function(_0x5af8a4){try{jsonpatch[_0xa0cb('0x1e')](_0x5af8a4,_0x1f464c,!![]);}catch(_0x179e03){return BPromise[_0xa0cb('0x1f')](_0x179e03);}return _0x5af8a4[_0xa0cb('0x20')]();};}function saveUpdates(_0x45a05c,_0x45e0f7){return function(_0x1014a4){if(_0x1014a4){return _0x1014a4[_0xa0cb('0x21')](_0x45a05c)['then'](function(_0x1804a5){return _0x1804a5;});}return null;};}function removeEntity(_0x5ee829,_0x44ffe7){return function(_0x37e127){if(_0x37e127){return _0x37e127[_0xa0cb('0x22')]()[_0xa0cb('0x23')](function(){_0x5ee829['status'](0xcc)[_0xa0cb('0x18')]();});}};}function handleEntityNotFound(_0x144bac,_0x26bd59){return function(_0x1996d7){if(!_0x1996d7){_0x144bac[_0xa0cb('0x24')](0x194);}return _0x1996d7;};}function handleError(_0x577e78,_0x171549){_0x171549=_0x171549||0x1f4;return function(_0x4df9da){logger[_0xa0cb('0x25')](_0x4df9da[_0xa0cb('0x26')]);if(_0x4df9da[_0xa0cb('0x27')]){delete _0x4df9da['name'];}_0x577e78['status'](_0x171549)[_0xa0cb('0x28')](_0x4df9da);};}exports[_0xa0cb('0x29')]=function(_0x3a1297,_0xe8e372){var _0x57446b={},_0x514eb7={},_0x46753a={'count':0x0,'rows':[]};var _0x466629=_[_0xa0cb('0x2a')](db[_0xa0cb('0x2b')][_0xa0cb('0x2c')],function(_0x4a17de){return{'name':_0x4a17de[_0xa0cb('0x2d')],'type':_0x4a17de[_0xa0cb('0x2e')][_0xa0cb('0x2f')]};});_0x514eb7[_0xa0cb('0x30')]=_[_0xa0cb('0x2a')](_0x466629,_0xa0cb('0x27'));_0x514eb7[_0xa0cb('0x31')]=_[_0xa0cb('0x32')](_0x3a1297[_0xa0cb('0x31')]);_0x514eb7['filters']=_[_0xa0cb('0x33')](_0x514eb7[_0xa0cb('0x30')],_0x514eb7[_0xa0cb('0x31')]);_0x57446b[_0xa0cb('0x34')]=_[_0xa0cb('0x33')](_0x514eb7[_0xa0cb('0x30')],qs[_0xa0cb('0x35')](_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x35')]));_0x57446b[_0xa0cb('0x34')]=_0x57446b[_0xa0cb('0x34')][_0xa0cb('0x36')]?_0x57446b['attributes']:_0x514eb7[_0xa0cb('0x30')];if(!_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x37')]('nolimit')){_0x57446b['limit']=qs[_0xa0cb('0x1b')](_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x1b')]);_0x57446b[_0xa0cb('0x1a')]=qs[_0xa0cb('0x1a')](_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x1a')]);}_0x57446b[_0xa0cb('0x38')]=qs[_0xa0cb('0x39')](_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x39')]);_0x57446b[_0xa0cb('0x3a')]=qs['filters'](_[_0xa0cb('0x3b')](_0x3a1297[_0xa0cb('0x31')],_0x514eb7['filters']));if(_0x3a1297[_0xa0cb('0x31')][_0xa0cb('0x3c')]){_0x57446b[_0xa0cb('0x3a')]=_['merge'](_0x57446b['where'],{'$or':_[_0xa0cb('0x2a')](_0x466629,function(_0x4b309d){if(_0x4b309d['type']!==_0xa0cb('0x3d')){var _0x4f0487={};_0x4f0487[_0x4b309d[_0xa0cb('0x27')]]={'$like':'%'+_0x3a1297['query'][_0xa0cb('0x3c')]+'%'};return _0x4f0487;}})});}_0x57446b=_[_0xa0cb('0x3e')]({},_0x57446b,_0x3a1297[_0xa0cb('0x3f')]);var _0x475b18={'where':_0x57446b['where']};return db['SquareRecording'][_0xa0cb('0x40')](_0x475b18)[_0xa0cb('0x23')](function(_0x5c5876){_0x46753a[_0xa0cb('0x40')]=_0x5c5876;if(_0x3a1297[_0xa0cb('0x31')]['includeAll']){_0x57446b[_0xa0cb('0x41')]=[{'all':!![]}];}return db[_0xa0cb('0x2b')][_0xa0cb('0x42')](_0x57446b);})['then'](function(_0x3a1566){_0x46753a[_0xa0cb('0x43')]=_0x3a1566;return _0x46753a;})[_0xa0cb('0x23')](respondWithFilteredResult(_0xe8e372,_0x57446b))['catch'](handleError(_0xe8e372,null));};exports['show']=function(_0x4130ed,_0x14aff){var _0x4adc13={'raw':!![],'where':{'id':_0x4130ed[_0xa0cb('0x44')]['id']}},_0x4f916b={};_0x4f916b[_0xa0cb('0x30')]=_[_0xa0cb('0x32')](db['SquareRecording'][_0xa0cb('0x2c')]);_0x4f916b[_0xa0cb('0x31')]=_[_0xa0cb('0x32')](_0x4130ed[_0xa0cb('0x31')]);_0x4f916b['filters']=_[_0xa0cb('0x33')](_0x4f916b[_0xa0cb('0x30')],_0x4f916b[_0xa0cb('0x31')]);_0x4adc13[_0xa0cb('0x34')]=_[_0xa0cb('0x33')](_0x4f916b['model'],qs[_0xa0cb('0x35')](_0x4130ed['query'][_0xa0cb('0x35')]));_0x4adc13[_0xa0cb('0x34')]=_0x4adc13['attributes'][_0xa0cb('0x36')]?_0x4adc13[_0xa0cb('0x34')]:_0x4f916b[_0xa0cb('0x30')];if(_0x4130ed[_0xa0cb('0x31')][_0xa0cb('0x45')]){_0x4adc13[_0xa0cb('0x41')]=[{'all':!![]}];}_0x4adc13=_[_0xa0cb('0x3e')]({},_0x4adc13,_0x4130ed[_0xa0cb('0x3f')]);return db[_0xa0cb('0x2b')][_0xa0cb('0x46')](_0x4adc13)[_0xa0cb('0x23')](handleEntityNotFound(_0x14aff,null))[_0xa0cb('0x23')](respondWithResult(_0x14aff,null))[_0xa0cb('0x47')](handleError(_0x14aff,null));};exports[_0xa0cb('0x48')]=function(_0x36863e,_0x3ed1ab){return db[_0xa0cb('0x2b')][_0xa0cb('0x48')](_0x36863e[_0xa0cb('0x49')],{})[_0xa0cb('0x23')](respondWithResult(_0x3ed1ab,0xc9))['catch'](handleError(_0x3ed1ab,null));};exports[_0xa0cb('0x21')]=function(_0x3d2339,_0x274364){if(_0x3d2339[_0xa0cb('0x49')]['id']){delete _0x3d2339['body']['id'];}return db[_0xa0cb('0x2b')][_0xa0cb('0x46')]({'where':{'id':_0x3d2339[_0xa0cb('0x44')]['id']}})[_0xa0cb('0x23')](handleEntityNotFound(_0x274364,null))[_0xa0cb('0x23')](saveUpdates(_0x3d2339[_0xa0cb('0x49')],null))[_0xa0cb('0x23')](respondWithResult(_0x274364,null))[_0xa0cb('0x47')](handleError(_0x274364,null));};exports[_0xa0cb('0x4a')]=function(_0x51b55e,_0x338e44,_0x157f1c){var _0x456ce1=require(_0xa0cb('0x4b'));var _0x505aba=![];var _0x3a18b7={};if(_0x51b55e[_0xa0cb('0x31')][_0xa0cb('0x2e')]&&_0x51b55e[_0xa0cb('0x31')][_0xa0cb('0x2e')]===_0xa0cb('0x4c')){_0x3a18b7[_0xa0cb('0x4c')]=_0x51b55e['params']['id'];}else{_0x3a18b7['id']=_0x51b55e[_0xa0cb('0x44')]['id'];}return db[_0xa0cb('0x2b')]['find']({'where':_0x3a18b7,'attributes':['id',_0xa0cb('0x4d'),_0xa0cb('0x4e')],'raw':!![]})[_0xa0cb('0x23')](handleEntityNotFound(_0x338e44,null))[_0xa0cb('0x23')](function(_0x228129){if(_0x228129){var _0x4fc88d=_0x228129[_0xa0cb('0x4d')];var _0x499fef=util[_0xa0cb('0x4f')](_0xa0cb('0x50'),_0x4fc88d);if(fs[_0xa0cb('0x51')](_0x499fef)){_0x505aba=!![];return _0x456ce1['decryptFile'](_0x499fef,_0x4fc88d,config[_0xa0cb('0x52')][_0xa0cb('0x53')])['then'](function(){return _0x228129;});}return _0x228129;}})[_0xa0cb('0x23')](function(_0x37ddda){if(_0x37ddda){var _0x4b868b=_0x37ddda['savePath'];if(!fs['existsSync'](_0x4b868b)){throw new db[(_0xa0cb('0x54'))]['ValidationError'](_0xa0cb('0x55'));}if(_0x37ddda['filename']){return _0x338e44[_0xa0cb('0x4a')](_0x4b868b,_0x37ddda[_0xa0cb('0x4e')]+path[_0xa0cb('0x56')](_0x4b868b),function(){if(_0x505aba){fs[_0xa0cb('0x57')](_0x4b868b);}});}else{return _0x338e44['download'](_0x4b868b,function(_0xb7000d){if(_0x505aba){fs[_0xa0cb('0x57')](_0x4b868b);}});}}})['catch'](function(_0x3b976e){if(_0x3b976e[_0xa0cb('0x58')]===_0xa0cb('0x55')){_0x338e44[_0xa0cb('0x17')](0x194)[_0xa0cb('0x28')](_0xa0cb('0x59'));}else{return handleError(_0x338e44,null);}});};exports[_0xa0cb('0x22')]=function(_0x147a3d,_0x3ec8b8){return db[_0xa0cb('0x2b')][_0xa0cb('0x46')]({'where':{'id':_0x147a3d[_0xa0cb('0x44')]['id']}})[_0xa0cb('0x23')](function(_0x48252e){if(!_0x48252e)throw new ReferenceError(_0xa0cb('0x5a'));return _0x48252e;})['then'](function(_0x2ef041){var _0x4a5346=_0x2ef041[_0xa0cb('0x4d')];logger['info'](_0xa0cb('0x5b'),_0x4a5346);if(!_[_0xa0cb('0x5c')](_0x2ef041[_0xa0cb('0x4d')])&&fs[_0xa0cb('0x51')](_0x4a5346)){logger['info'](_0xa0cb('0x5d')+_0x4a5346+_0xa0cb('0x5e'));fs['unlinkSync'](_0x4a5346);}_0x4a5346=_0x4a5346+_0xa0cb('0x5f');if(!_[_0xa0cb('0x5c')](_0x2ef041['savePath'])&&fs['existsSync'](_0x4a5346)){logger[_0xa0cb('0x60')](_0xa0cb('0x5d')+_0x4a5346+_0xa0cb('0x5e'));fs[_0xa0cb('0x61')](_0x4a5346);}return _0x2ef041;})[_0xa0cb('0x23')](function(_0x24e7e0){if(!_0x24e7e0)throw new InternalError();return _0x24e7e0[_0xa0cb('0x22')]();})[_0xa0cb('0x23')](function(){_0x3ec8b8[_0xa0cb('0x17')](0xcc)[_0xa0cb('0x18')]();})[_0xa0cb('0x47')](handleError(_0x3ec8b8,null));}; \ No newline at end of file +var _0x6abd=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','limit','set','Content-Range','reject','save','update','then','destroy','stack','name','send','index','map','SquareRecording','type','key','model','keys','query','filters','intersection','fields','attributes','hasOwnProperty','offset','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','findAll','catch','show','params','rawAttributes','length','include','options','create','body','find','download','uniqueid','savePath','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','html-pdf','eml-format','rimraf'];(function(_0xd54d1e,_0x9d67ec){var _0x51a6ee=function(_0x52be36){while(--_0x52be36){_0xd54d1e['push'](_0xd54d1e['shift']());}};_0x51a6ee(++_0x9d67ec);}(_0x6abd,0x185));var _0xd6ab=function(_0x24f306,_0x99ef58){_0x24f306=_0x24f306-0x0;var _0x4a77b0=_0x6abd[_0x24f306];return _0x4a77b0;};'use strict';var pdf=require(_0xd6ab('0x0'));var emlformat=require(_0xd6ab('0x1'));var rimraf=require(_0xd6ab('0x2'));var zipdir=require(_0xd6ab('0x3'));var jsonpatch=require(_0xd6ab('0x4'));var rp=require(_0xd6ab('0x5'));var moment=require(_0xd6ab('0x6'));var BPromise=require(_0xd6ab('0x7'));var Mustache=require(_0xd6ab('0x8'));var util=require(_0xd6ab('0x9'));var path=require(_0xd6ab('0xa'));var sox=require(_0xd6ab('0xb'));var csv=require(_0xd6ab('0xc'));var ejs=require(_0xd6ab('0xd'));var fs=require('fs');var _=require(_0xd6ab('0xe'));var squel=require(_0xd6ab('0xf'));var crypto=require(_0xd6ab('0x10'));var jsforce=require(_0xd6ab('0x11'));var deskjs=require(_0xd6ab('0x12'));var toCsv=require(_0xd6ab('0xc'));var querystring=require(_0xd6ab('0x13'));var Papa=require('papaparse');var Redis=require(_0xd6ab('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xd6ab('0x15'));var as=require(_0xd6ab('0x16'));var hardwareService=require(_0xd6ab('0x17'));var logger=require(_0xd6ab('0x18'))(_0xd6ab('0x19'));var utils=require('../../config/utils');var config=require(_0xd6ab('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cef1c,_0x499e75){_0x499e75=_0x499e75||0xcc;return function(_0x205215){if(_0x205215){return _0x3cef1c[_0xd6ab('0x1b')](_0x499e75);}return _0x3cef1c[_0xd6ab('0x1c')](_0x499e75)[_0xd6ab('0x1d')]();};}function respondWithResult(_0x4b9345,_0x47e7af){_0x47e7af=_0x47e7af||0xc8;return function(_0x1bab79){if(_0x1bab79){return _0x4b9345[_0xd6ab('0x1c')](_0x47e7af)[_0xd6ab('0x1e')](_0x1bab79);}};}function respondWithFilteredResult(_0x12751f,_0x519ab7){return function(_0x417af8){if(_0x417af8){var _0x140f9b=_0x417af8[_0xd6ab('0x1f')],_0x1ed251=_0x519ab7['offset'],_0x42f099=_0x519ab7['offset']+_0x519ab7[_0xd6ab('0x20')],_0x45c5a8;if(_0x42f099>=_0x140f9b){_0x42f099=_0x140f9b;_0x45c5a8=0xc8;}else{_0x45c5a8=0xce;}_0x12751f['status'](_0x45c5a8);return _0x12751f[_0xd6ab('0x21')](_0xd6ab('0x22'),_0x1ed251+'-'+_0x42f099+'/'+_0x140f9b)[_0xd6ab('0x1e')](_0x417af8);}return null;};}function patchUpdates(_0x55fbde){return function(_0x5d787a){try{jsonpatch['apply'](_0x5d787a,_0x55fbde,!![]);}catch(_0x546d12){return BPromise[_0xd6ab('0x23')](_0x546d12);}return _0x5d787a[_0xd6ab('0x24')]();};}function saveUpdates(_0x16ae33,_0x4e0963){return function(_0x134f00){if(_0x134f00){return _0x134f00[_0xd6ab('0x25')](_0x16ae33)[_0xd6ab('0x26')](function(_0x54cf04){return _0x54cf04;});}return null;};}function removeEntity(_0x58cc7b,_0x12d2af){return function(_0x9fea6d){if(_0x9fea6d){return _0x9fea6d[_0xd6ab('0x27')]()[_0xd6ab('0x26')](function(){_0x58cc7b[_0xd6ab('0x1c')](0xcc)[_0xd6ab('0x1d')]();});}};}function handleEntityNotFound(_0x3153a9,_0x809747){return function(_0x318afb){if(!_0x318afb){_0x3153a9[_0xd6ab('0x1b')](0x194);}return _0x318afb;};}function handleError(_0x2cab6d,_0x1e6143){_0x1e6143=_0x1e6143||0x1f4;return function(_0x32a89a){logger['error'](_0x32a89a[_0xd6ab('0x28')]);if(_0x32a89a[_0xd6ab('0x29')]){delete _0x32a89a[_0xd6ab('0x29')];}_0x2cab6d['status'](_0x1e6143)[_0xd6ab('0x2a')](_0x32a89a);};}exports[_0xd6ab('0x2b')]=function(_0x38db5f,_0x3e7b8c){var _0x3860ae={},_0x4cafc5={},_0x7de794={'count':0x0,'rows':[]};var _0x47840d=_[_0xd6ab('0x2c')](db[_0xd6ab('0x2d')]['rawAttributes'],function(_0x2f5675){return{'name':_0x2f5675['fieldName'],'type':_0x2f5675[_0xd6ab('0x2e')][_0xd6ab('0x2f')]};});_0x4cafc5[_0xd6ab('0x30')]=_['map'](_0x47840d,_0xd6ab('0x29'));_0x4cafc5['query']=_[_0xd6ab('0x31')](_0x38db5f[_0xd6ab('0x32')]);_0x4cafc5[_0xd6ab('0x33')]=_[_0xd6ab('0x34')](_0x4cafc5[_0xd6ab('0x30')],_0x4cafc5[_0xd6ab('0x32')]);_0x3860ae['attributes']=_[_0xd6ab('0x34')](_0x4cafc5[_0xd6ab('0x30')],qs['fields'](_0x38db5f[_0xd6ab('0x32')][_0xd6ab('0x35')]));_0x3860ae['attributes']=_0x3860ae[_0xd6ab('0x36')]['length']?_0x3860ae['attributes']:_0x4cafc5[_0xd6ab('0x30')];if(!_0x38db5f[_0xd6ab('0x32')][_0xd6ab('0x37')]('nolimit')){_0x3860ae['limit']=qs[_0xd6ab('0x20')](_0x38db5f[_0xd6ab('0x32')][_0xd6ab('0x20')]);_0x3860ae['offset']=qs[_0xd6ab('0x38')](_0x38db5f[_0xd6ab('0x32')]['offset']);}_0x3860ae[_0xd6ab('0x39')]=qs[_0xd6ab('0x3a')](_0x38db5f[_0xd6ab('0x32')]['sort']);_0x3860ae['where']=qs['filters'](_[_0xd6ab('0x3b')](_0x38db5f[_0xd6ab('0x32')],_0x4cafc5[_0xd6ab('0x33')]));if(_0x38db5f['query'][_0xd6ab('0x3c')]){_0x3860ae[_0xd6ab('0x3d')]=_[_0xd6ab('0x3e')](_0x3860ae['where'],{'$or':_['map'](_0x47840d,function(_0x7e4ee4){if(_0x7e4ee4[_0xd6ab('0x2e')]!==_0xd6ab('0x3f')){var _0x1b8b16={};_0x1b8b16[_0x7e4ee4[_0xd6ab('0x29')]]={'$like':'%'+_0x38db5f[_0xd6ab('0x32')][_0xd6ab('0x3c')]+'%'};return _0x1b8b16;}})});}_0x3860ae=_[_0xd6ab('0x3e')]({},_0x3860ae,_0x38db5f['options']);var _0x1434dd={'where':_0x3860ae[_0xd6ab('0x3d')]};return db[_0xd6ab('0x2d')][_0xd6ab('0x1f')](_0x1434dd)[_0xd6ab('0x26')](function(_0x23f9d7){_0x7de794[_0xd6ab('0x1f')]=_0x23f9d7;if(_0x38db5f[_0xd6ab('0x32')][_0xd6ab('0x40')]){_0x3860ae['include']=[{'all':!![]}];}return db['SquareRecording'][_0xd6ab('0x41')](_0x3860ae);})[_0xd6ab('0x26')](function(_0x4b6cc7){_0x7de794['rows']=_0x4b6cc7;return _0x7de794;})[_0xd6ab('0x26')](respondWithFilteredResult(_0x3e7b8c,_0x3860ae))[_0xd6ab('0x42')](handleError(_0x3e7b8c,null));};exports[_0xd6ab('0x43')]=function(_0x4a8879,_0x5be23c){var _0x4165e9={'raw':!![],'where':{'id':_0x4a8879[_0xd6ab('0x44')]['id']}},_0x49e791={};_0x49e791[_0xd6ab('0x30')]=_[_0xd6ab('0x31')](db[_0xd6ab('0x2d')][_0xd6ab('0x45')]);_0x49e791['query']=_['keys'](_0x4a8879[_0xd6ab('0x32')]);_0x49e791[_0xd6ab('0x33')]=_[_0xd6ab('0x34')](_0x49e791[_0xd6ab('0x30')],_0x49e791[_0xd6ab('0x32')]);_0x4165e9[_0xd6ab('0x36')]=_[_0xd6ab('0x34')](_0x49e791[_0xd6ab('0x30')],qs['fields'](_0x4a8879[_0xd6ab('0x32')][_0xd6ab('0x35')]));_0x4165e9[_0xd6ab('0x36')]=_0x4165e9[_0xd6ab('0x36')][_0xd6ab('0x46')]?_0x4165e9[_0xd6ab('0x36')]:_0x49e791[_0xd6ab('0x30')];if(_0x4a8879['query'][_0xd6ab('0x40')]){_0x4165e9[_0xd6ab('0x47')]=[{'all':!![]}];}_0x4165e9=_[_0xd6ab('0x3e')]({},_0x4165e9,_0x4a8879[_0xd6ab('0x48')]);return db[_0xd6ab('0x2d')]['find'](_0x4165e9)['then'](handleEntityNotFound(_0x5be23c,null))[_0xd6ab('0x26')](respondWithResult(_0x5be23c,null))[_0xd6ab('0x42')](handleError(_0x5be23c,null));};exports[_0xd6ab('0x49')]=function(_0x4dcaff,_0x2d971e){return db['SquareRecording'][_0xd6ab('0x49')](_0x4dcaff[_0xd6ab('0x4a')],{})[_0xd6ab('0x26')](respondWithResult(_0x2d971e,0xc9))[_0xd6ab('0x42')](handleError(_0x2d971e,null));};exports[_0xd6ab('0x25')]=function(_0x5e04e9,_0x1b2853){if(_0x5e04e9[_0xd6ab('0x4a')]['id']){delete _0x5e04e9[_0xd6ab('0x4a')]['id'];}return db[_0xd6ab('0x2d')][_0xd6ab('0x4b')]({'where':{'id':_0x5e04e9[_0xd6ab('0x44')]['id']}})[_0xd6ab('0x26')](handleEntityNotFound(_0x1b2853,null))[_0xd6ab('0x26')](saveUpdates(_0x5e04e9[_0xd6ab('0x4a')],null))['then'](respondWithResult(_0x1b2853,null))[_0xd6ab('0x42')](handleError(_0x1b2853,null));};exports[_0xd6ab('0x4c')]=function(_0x182b47,_0x44170c,_0x1a72f6){var _0x5de1b0=require('../../components/encryptor');var _0xc4e576=![];var _0x203277={};if(_0x182b47[_0xd6ab('0x32')]['type']&&_0x182b47[_0xd6ab('0x32')][_0xd6ab('0x2e')]===_0xd6ab('0x4d')){_0x203277[_0xd6ab('0x4d')]=_0x182b47[_0xd6ab('0x44')]['id'];}else{_0x203277['id']=_0x182b47[_0xd6ab('0x44')]['id'];}return db[_0xd6ab('0x2d')][_0xd6ab('0x4b')]({'where':_0x203277,'attributes':['id','savePath','filename'],'raw':!![]})[_0xd6ab('0x26')](handleEntityNotFound(_0x44170c,null))[_0xd6ab('0x26')](function(_0x3c6514){if(_0x3c6514){var _0x59493f=_0x3c6514[_0xd6ab('0x4e')];var _0x340ec4=util['format']('%s.cypher',_0x59493f);if(fs[_0xd6ab('0x4f')](_0x340ec4)){_0xc4e576=!![];return _0x5de1b0[_0xd6ab('0x50')](_0x340ec4,_0x59493f,config[_0xd6ab('0x51')][_0xd6ab('0x52')])[_0xd6ab('0x26')](function(){return _0x3c6514;});}return _0x3c6514;}})[_0xd6ab('0x26')](function(_0x1894f4){if(_0x1894f4){var _0x3af422=_0x1894f4[_0xd6ab('0x4e')];if(!fs[_0xd6ab('0x4f')](_0x3af422)){throw new db[(_0xd6ab('0x53'))][(_0xd6ab('0x54'))](_0xd6ab('0x55'));}if(_0x1894f4[_0xd6ab('0x56')]){return _0x44170c[_0xd6ab('0x4c')](_0x3af422,_0x1894f4[_0xd6ab('0x56')]+path[_0xd6ab('0x57')](_0x3af422),function(){if(_0xc4e576){fs[_0xd6ab('0x58')](_0x3af422);}});}else{return _0x44170c[_0xd6ab('0x4c')](_0x3af422,function(_0x35cc6d){if(_0xc4e576){fs[_0xd6ab('0x58')](_0x3af422);}});}}})['catch'](function(_0x236a43){if(_0x236a43[_0xd6ab('0x59')]==='SquareRecording\x20not\x20found'){_0x44170c[_0xd6ab('0x1c')](0x194)[_0xd6ab('0x2a')](_0xd6ab('0x5a'));}else{return handleError(_0x44170c,null);}});};exports[_0xd6ab('0x27')]=function(_0x3295e1,_0x5eed5e){return db['SquareRecording'][_0xd6ab('0x4b')]({'where':{'id':_0x3295e1['params']['id']}})[_0xd6ab('0x26')](function(_0x142046){if(!_0x142046)throw new ReferenceError('Entity\x20not\x20found');return _0x142046;})[_0xd6ab('0x26')](function(_0x47082a){var _0x5555af=_0x47082a[_0xd6ab('0x4e')];logger[_0xd6ab('0x5b')](_0xd6ab('0x5c'),_0x5555af);if(!_[_0xd6ab('0x5d')](_0x47082a['savePath'])&&fs[_0xd6ab('0x4f')](_0x5555af)){logger[_0xd6ab('0x5b')](_0xd6ab('0x5e')+_0x5555af+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x5555af);}_0x5555af=_0x5555af+_0xd6ab('0x5f');if(!_[_0xd6ab('0x5d')](_0x47082a[_0xd6ab('0x4e')])&&fs[_0xd6ab('0x4f')](_0x5555af)){logger[_0xd6ab('0x5b')]('File:\x20\x22'+_0x5555af+_0xd6ab('0x60'));fs[_0xd6ab('0x61')](_0x5555af);}return _0x47082a;})[_0xd6ab('0x26')](function(_0x5caef3){if(!_0x5caef3)throw new InternalError();return _0x5caef3[_0xd6ab('0x27')]();})[_0xd6ab('0x26')](function(){_0x5eed5e[_0xd6ab('0x1c')](0xcc)[_0xd6ab('0x1d')]();})[_0xd6ab('0x42')](handleError(_0x5eed5e,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index 69205e9..28f0a59 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 _0xfef3=['./squareRecording.attributes','exports','define','SquareRecording','square_recordings','lodash','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x4701a4,_0x1a2bf1){var _0x4e7522=function(_0x1c56f9){while(--_0x1c56f9){_0x4701a4['push'](_0x4701a4['shift']());}};_0x4e7522(++_0x1a2bf1);}(_0xfef3,0x118));var _0x3fef=function(_0x560589,_0x3889f0){_0x560589=_0x560589-0x0;var _0x386054=_0xfef3[_0x560589];return _0x386054;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var logger=require(_0x3fef('0x1'))('api');var moment=require(_0x3fef('0x2'));var BPromise=require(_0x3fef('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3fef('0x4'));var rimraf=require(_0x3fef('0x5'));var config=require('../../config/environment');var attributes=require(_0x3fef('0x6'));module[_0x3fef('0x7')]=function(_0x5dd9fb,_0x319a2a){return _0x5dd9fb[_0x3fef('0x8')](_0x3fef('0x9'),attributes,{'tableName':_0x3fef('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareRecording','square_recordings','lodash','util'];(function(_0x33de57,_0xc22bb0){var _0x88f5a5=function(_0x2a3f89){while(--_0x2a3f89){_0x33de57['push'](_0x33de57['shift']());}};_0x88f5a5(++_0xc22bb0);}(_0x1a37,0xb4));var _0x71a3=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x1a37[_0x5d2803];return _0xdcad2c;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./squareRecording.attributes');module[_0x71a3('0xa')]=function(_0x4f6b7a,_0xd09f7){return _0x4f6b7a[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':_0x71a3('0xd'),'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 243de9e..d3bb337 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 _0x660b=['then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareRecording','create','body','options','raw','debug','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x660b,0x89));var _0xb660=function(_0x229fa6,_0x83d3d7){_0x229fa6=_0x229fa6-0x0;var _0x57c815=_0x660b[_0x229fa6];return _0x57c815;};'use strict';var _=require(_0xb660('0x0'));var util=require(_0xb660('0x1'));var moment=require(_0xb660('0x2'));var BPromise=require('bluebird');var rs=require(_0xb660('0x3'));var fs=require('fs');var Redis=require(_0xb660('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb660('0x5'));var logger=require(_0xb660('0x6'))(_0xb660('0x7'));var config=require(_0xb660('0x8'));var jayson=require(_0xb660('0x9'));var client=jayson[_0xb660('0xa')][_0xb660('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x152dea,_0xc81f13,_0xeffa11){return new BPromise(function(_0x4c1755,_0x3017eb){return client[_0xb660('0xc')](_0x152dea,_0xeffa11)[_0xb660('0xd')](function(_0x3e0cad){logger[_0xb660('0xe')](_0xb660('0xf'),_0xc81f13,_0xb660('0x10'));logger['debug'](_0xb660('0x11'),_0xc81f13,_0xb660('0x10'),JSON[_0xb660('0x12')](_0x3e0cad));if(_0x3e0cad[_0xb660('0x13')]){if(_0x3e0cad['error'][_0xb660('0x14')]===0x1f4){logger[_0xb660('0x13')](_0xb660('0xf'),_0xc81f13,_0x3e0cad[_0xb660('0x13')][_0xb660('0x15')]);return _0x3017eb(_0x3e0cad[_0xb660('0x13')]['message']);}logger['error']('SquareRecording,\x20%s,\x20%s',_0xc81f13,_0x3e0cad[_0xb660('0x13')][_0xb660('0x15')]);return _0x4c1755(_0x3e0cad[_0xb660('0x13')][_0xb660('0x15')]);}else{logger[_0xb660('0xe')](_0xb660('0xf'),_0xc81f13,'request\x20sent');_0x4c1755(_0x3e0cad[_0xb660('0x16')]['message']);}})[_0xb660('0x17')](function(_0x4cd26a){logger['error'](_0xb660('0xf'),_0xc81f13,_0x4cd26a);_0x3017eb(_0x4cd26a);});});}exports[_0xb660('0x18')]=function(_0x1187f8){var _0x326528=this;return new Promise(function(_0x9c166f,_0x40644b){return db['SquareRecording'][_0xb660('0x19')](_0x1187f8[_0xb660('0x1a')],{'raw':_0x1187f8[_0xb660('0x1b')]?_0x1187f8[_0xb660('0x1b')][_0xb660('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x3df0b0){logger['info'](_0xb660('0x18'),_0x1187f8);logger[_0xb660('0x1d')](_0xb660('0x18'),_0x1187f8,JSON[_0xb660('0x12')](_0x3df0b0));_0x9c166f(_0x3df0b0);})['catch'](function(_0x4d4212){logger['error']('CreateSquareRecording',_0x4d4212[_0xb660('0x15')],_0x1187f8);_0x40644b(_0x326528[_0xb660('0x13')](0x1f4,_0x4d4212[_0xb660('0x15')]));});});}; \ No newline at end of file +var _0x493e=['message','info','result','catch','CreateSquareRecording','options','raw','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x4ce978,_0x23923){var _0x2db47d=function(_0x42141f){while(--_0x42141f){_0x4ce978['push'](_0x4ce978['shift']());}};_0x2db47d(++_0x23923);}(_0x493e,0x10b));var _0xe493=function(_0x3f8ec2,_0x5a6c61){_0x3f8ec2=_0x3f8ec2-0x0;var _0x145630=_0x493e[_0x3f8ec2];return _0x145630;};'use strict';var _=require(_0xe493('0x0'));var util=require(_0xe493('0x1'));var moment=require('moment');var BPromise=require(_0xe493('0x2'));var rs=require(_0xe493('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe493('0x4'))['db'];var utils=require(_0xe493('0x5'));var logger=require(_0xe493('0x6'))(_0xe493('0x7'));var config=require('../../config/environment');var jayson=require(_0xe493('0x8'));var client=jayson['client'][_0xe493('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x10fbcf,_0x2538ec,_0x2e15fb){return new BPromise(function(_0x1df8eb,_0x124dee){return client[_0xe493('0xa')](_0x10fbcf,_0x2e15fb)[_0xe493('0xb')](function(_0x643432){logger['info'](_0xe493('0xc'),_0x2538ec,_0xe493('0xd'));logger[_0xe493('0xe')](_0xe493('0xf'),_0x2538ec,'request\x20sent',JSON[_0xe493('0x10')](_0x643432));if(_0x643432[_0xe493('0x11')]){if(_0x643432[_0xe493('0x11')][_0xe493('0x12')]===0x1f4){logger[_0xe493('0x11')](_0xe493('0xc'),_0x2538ec,_0x643432[_0xe493('0x11')][_0xe493('0x13')]);return _0x124dee(_0x643432[_0xe493('0x11')]['message']);}logger[_0xe493('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2538ec,_0x643432[_0xe493('0x11')]['message']);return _0x1df8eb(_0x643432[_0xe493('0x11')][_0xe493('0x13')]);}else{logger[_0xe493('0x14')](_0xe493('0xc'),_0x2538ec,_0xe493('0xd'));_0x1df8eb(_0x643432[_0xe493('0x15')]['message']);}})[_0xe493('0x16')](function(_0x6f5bb9){logger[_0xe493('0x11')]('SquareRecording,\x20%s,\x20%s',_0x2538ec,_0x6f5bb9);_0x124dee(_0x6f5bb9);});});}exports[_0xe493('0x17')]=function(_0x41be4e){var _0x345bae=this;return new Promise(function(_0x58f5d8,_0x3143f1){return db['SquareRecording']['create'](_0x41be4e['body'],{'raw':_0x41be4e[_0xe493('0x18')]?_0x41be4e[_0xe493('0x18')][_0xe493('0x19')]===undefined?!![]:![]:!![]})[_0xe493('0xb')](function(_0x5b58e8){logger['info'](_0xe493('0x17'),_0x41be4e);logger[_0xe493('0xe')](_0xe493('0x17'),_0x41be4e,JSON[_0xe493('0x10')](_0x5b58e8));_0x58f5d8(_0x5b58e8);})['catch'](function(_0x5805bc){logger[_0xe493('0x11')](_0xe493('0x17'),_0x5805bc[_0xe493('0x13')],_0x41be4e);_0x3143f1(_0x345bae['error'](0x1f4,_0x5805bc[_0xe493('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index eb4f513..6a2cf2b 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 _0xb1c0=['destroy','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./squareReport.controller','get','index','/describe','isAuthenticated','describe','show','post','create','/:id','delete'];(function(_0x10f61b,_0x3a7a52){var _0x2165e2=function(_0x12fa10){while(--_0x12fa10){_0x10f61b['push'](_0x10f61b['shift']());}};_0x2165e2(++_0x3a7a52);}(_0xb1c0,0x1e1));var _0x0b1c=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xb1c0[_0x4a9fb1];return _0x348672;};'use strict';var multer=require(_0x0b1c('0x0'));var util=require(_0x0b1c('0x1'));var path=require(_0x0b1c('0x2'));var timeout=require(_0x0b1c('0x3'));var express=require(_0x0b1c('0x4'));var router=express[_0x0b1c('0x5')]();var auth=require(_0x0b1c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b1c('0x7'));var controller=require(_0x0b1c('0x8'));router[_0x0b1c('0x9')]('/',auth['isAuthenticated'](),controller[_0x0b1c('0xa')]);router[_0x0b1c('0x9')](_0x0b1c('0xb'),auth[_0x0b1c('0xc')](),controller[_0x0b1c('0xd')]);router['get']('/:id',auth[_0x0b1c('0xc')](),controller[_0x0b1c('0xe')]);router[_0x0b1c('0xf')]('/',auth[_0x0b1c('0xc')](),controller[_0x0b1c('0x10')]);router['put'](_0x0b1c('0x11'),auth[_0x0b1c('0xc')](),controller['update']);router[_0x0b1c('0x12')](_0x0b1c('0x11'),auth[_0x0b1c('0xc')](),controller[_0x0b1c('0x13')]);module['exports']=router; \ No newline at end of file +var _0xf71c=['index','describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated'];(function(_0x3c92bb,_0x2a9c8a){var _0x3f373e=function(_0x2c6191){while(--_0x2c6191){_0x3c92bb['push'](_0x3c92bb['shift']());}};_0x3f373e(++_0x2a9c8a);}(_0xf71c,0xfa));var _0xcf71=function(_0x2256d9,_0x54357e){_0x2256d9=_0x2256d9-0x0;var _0x28fb50=_0xf71c[_0x2256d9];return _0x28fb50;};'use strict';var multer=require(_0xcf71('0x0'));var util=require(_0xcf71('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcf71('0x2'));var router=express[_0xcf71('0x3')]();var auth=require(_0xcf71('0x4'));var interaction=require(_0xcf71('0x5'));var config=require(_0xcf71('0x6'));var controller=require(_0xcf71('0x7'));router[_0xcf71('0x8')]('/',auth[_0xcf71('0x9')](),controller[_0xcf71('0xa')]);router[_0xcf71('0x8')]('/describe',auth[_0xcf71('0x9')](),controller[_0xcf71('0xb')]);router['get'](_0xcf71('0xc'),auth[_0xcf71('0x9')](),controller[_0xcf71('0xd')]);router[_0xcf71('0xe')]('/',auth['isAuthenticated'](),controller[_0xcf71('0xf')]);router['put'](_0xcf71('0xc'),auth['isAuthenticated'](),controller[_0xcf71('0x10')]);router[_0xcf71('0x11')]('/:id',auth[_0xcf71('0x9')](),controller[_0xcf71('0x12')]);module[_0xcf71('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 4ee3bc7..3c0459e 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 _0x1524=['DATE','BOOLEAN','STRING'];(function(_0x5e3b04,_0xbb6795){var _0x1fc44d=function(_0x3472a1){while(--_0x3472a1){_0x5e3b04['push'](_0x5e3b04['shift']());}};_0x1fc44d(++_0xbb6795);}(_0x1524,0x11c));var _0x4152=function(_0x5b5c66,_0x232916){_0x5b5c66=_0x5b5c66-0x0;var _0x19c519=_0x1524[_0x5b5c66];return _0x19c519;};'use strict';var Sequelize=require('sequelize');module['exports']={'network':{'type':Sequelize[_0x4152('0x0')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x4152('0x0')]},'channel':{'type':Sequelize[_0x4152('0x0')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4152('0x0')]},'uniqueid':{'type':Sequelize[_0x4152('0x0')]},'version':{'type':Sequelize[_0x4152('0x0')]},'callerid':{'type':Sequelize[_0x4152('0x0')]},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize['STRING']},'callingani2':{'type':Sequelize[_0x4152('0x0')]},'callington':{'type':Sequelize[_0x4152('0x0')]},'callingtns':{'type':Sequelize[_0x4152('0x0')]},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4152('0x0')]},'extension':{'type':Sequelize[_0x4152('0x0')]},'priority':{'type':Sequelize[_0x4152('0x0')]},'enhanced':{'type':Sequelize[_0x4152('0x0')]},'accountcode':{'type':Sequelize['STRING']},'threadid':{'type':Sequelize[_0x4152('0x0')]},'project_name':{'type':Sequelize[_0x4152('0x0')]},'joinAt':{'type':Sequelize[_0x4152('0x1')]},'leaveAt':{'type':Sequelize[_0x4152('0x1')]},'bot':{'type':Sequelize[_0x4152('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x7393=['DATE','BOOLEAN','sequelize','exports','STRING'];(function(_0xf432ab,_0x2aeafc){var _0x4c4079=function(_0x458026){while(--_0x458026){_0xf432ab['push'](_0xf432ab['shift']());}};_0x4c4079(++_0x2aeafc);}(_0x7393,0xb6));var _0x3739=function(_0x1a6a8b,_0x18e227){_0x1a6a8b=_0x1a6a8b-0x0;var _0x2d1a0e=_0x7393[_0x1a6a8b];return _0x2d1a0e;};'use strict';var Sequelize=require(_0x3739('0x0'));module[_0x3739('0x1')]={'network':{'type':Sequelize[_0x3739('0x2')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0x3739('0x2')]},'channel':{'type':Sequelize[_0x3739('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x3739('0x2')]},'version':{'type':Sequelize[_0x3739('0x2')]},'callerid':{'type':Sequelize[_0x3739('0x2')]},'calleridname':{'type':Sequelize[_0x3739('0x2')]},'callingpres':{'type':Sequelize[_0x3739('0x2')]},'callingani2':{'type':Sequelize['STRING']},'callington':{'type':Sequelize[_0x3739('0x2')]},'callingtns':{'type':Sequelize[_0x3739('0x2')]},'dnid':{'type':Sequelize[_0x3739('0x2')]},'rdnis':{'type':Sequelize[_0x3739('0x2')]},'context':{'type':Sequelize[_0x3739('0x2')]},'extension':{'type':Sequelize[_0x3739('0x2')]},'priority':{'type':Sequelize[_0x3739('0x2')]},'enhanced':{'type':Sequelize[_0x3739('0x2')]},'accountcode':{'type':Sequelize[_0x3739('0x2')]},'threadid':{'type':Sequelize['STRING']},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x3739('0x3')]},'leaveAt':{'type':Sequelize['DATE']},'bot':{'type':Sequelize[_0x3739('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 0ec4104..f6eb5cf 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 _0x7217=['type','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','count','offset','status','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName'];(function(_0x36d625,_0x1a40b8){var _0x517960=function(_0x1615d3){while(--_0x1615d3){_0x36d625['push'](_0x36d625['shift']());}};_0x517960(++_0x1a40b8);}(_0x7217,0x19e));var _0x7721=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x7217[_0x5b644e];return _0x49c6bf;};'use strict';var pdf=require(_0x7721('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x7721('0x1'));var zipdir=require(_0x7721('0x2'));var jsonpatch=require(_0x7721('0x3'));var rp=require(_0x7721('0x4'));var moment=require(_0x7721('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x7721('0x6'));var path=require(_0x7721('0x7'));var sox=require(_0x7721('0x8'));var csv=require(_0x7721('0x9'));var ejs=require(_0x7721('0xa'));var fs=require('fs');var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x9'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var db=require(_0x7721('0x1a'))['db'];function respondWithStatusCode(_0x27b36b,_0x55b4ca){_0x55b4ca=_0x55b4ca||0xcc;return function(_0x2911ec){if(_0x2911ec){return _0x27b36b[_0x7721('0x1b')](_0x55b4ca);}return _0x27b36b['status'](_0x55b4ca)[_0x7721('0x1c')]();};}function respondWithResult(_0x30da54,_0x3f01c5){_0x3f01c5=_0x3f01c5||0xc8;return function(_0x2e9752){if(_0x2e9752){return _0x30da54['status'](_0x3f01c5)[_0x7721('0x1d')](_0x2e9752);}};}function respondWithFilteredResult(_0x25b1c0,_0x534f1b){return function(_0x4e199a){if(_0x4e199a){var _0x4b183e=_0x4e199a[_0x7721('0x1e')],_0x5ed54=_0x534f1b['offset'],_0x25a628=_0x534f1b[_0x7721('0x1f')]+_0x534f1b['limit'],_0x3cc909;if(_0x25a628>=_0x4b183e){_0x25a628=_0x4b183e;_0x3cc909=0xc8;}else{_0x3cc909=0xce;}_0x25b1c0[_0x7721('0x20')](_0x3cc909);return _0x25b1c0['set'](_0x7721('0x21'),_0x5ed54+'-'+_0x25a628+'/'+_0x4b183e)[_0x7721('0x1d')](_0x4e199a);}return null;};}function patchUpdates(_0x3ab5a5){return function(_0x3e140d){try{jsonpatch[_0x7721('0x22')](_0x3e140d,_0x3ab5a5,!![]);}catch(_0x40af90){return BPromise[_0x7721('0x23')](_0x40af90);}return _0x3e140d[_0x7721('0x24')]();};}function saveUpdates(_0x3b29ac,_0xaeccc4){return function(_0x4ce1db){if(_0x4ce1db){return _0x4ce1db[_0x7721('0x25')](_0x3b29ac)[_0x7721('0x26')](function(_0x3a053f){return _0x3a053f;});}return null;};}function removeEntity(_0xd8ad3c,_0x57140c){return function(_0x28f5a6){if(_0x28f5a6){return _0x28f5a6['destroy']()[_0x7721('0x26')](function(){_0xd8ad3c[_0x7721('0x20')](0xcc)[_0x7721('0x1c')]();});}};}function handleEntityNotFound(_0x1caad8,_0x121cc4){return function(_0x395b15){if(!_0x395b15){_0x1caad8[_0x7721('0x1b')](0x194);}return _0x395b15;};}function handleError(_0x5b4d74,_0x216f20){_0x216f20=_0x216f20||0x1f4;return function(_0x1abedb){logger[_0x7721('0x27')](_0x1abedb[_0x7721('0x28')]);if(_0x1abedb[_0x7721('0x29')]){delete _0x1abedb[_0x7721('0x29')];}_0x5b4d74[_0x7721('0x20')](_0x216f20)[_0x7721('0x2a')](_0x1abedb);};}exports[_0x7721('0x2b')]=function(_0x52316e,_0x258ddf){var _0x5b0551={},_0x499b87={},_0x315202={'count':0x0,'rows':[]};var _0x343c19=_[_0x7721('0x2c')](db[_0x7721('0x2d')][_0x7721('0x2e')],function(_0x37b9f0){return{'name':_0x37b9f0[_0x7721('0x2f')],'type':_0x37b9f0[_0x7721('0x30')]['key']};});_0x499b87[_0x7721('0x31')]=_[_0x7721('0x2c')](_0x343c19,'name');_0x499b87['query']=_[_0x7721('0x32')](_0x52316e[_0x7721('0x33')]);_0x499b87['filters']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],_0x499b87[_0x7721('0x33')]);_0x5b0551['attributes']=_[_0x7721('0x34')](_0x499b87[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52316e[_0x7721('0x33')][_0x7721('0x35')]));_0x5b0551['attributes']=_0x5b0551[_0x7721('0x36')][_0x7721('0x37')]?_0x5b0551[_0x7721('0x36')]:_0x499b87['model'];if(!_0x52316e[_0x7721('0x33')][_0x7721('0x38')]('nolimit')){_0x5b0551[_0x7721('0x39')]=qs['limit'](_0x52316e[_0x7721('0x33')][_0x7721('0x39')]);_0x5b0551[_0x7721('0x1f')]=qs[_0x7721('0x1f')](_0x52316e[_0x7721('0x33')][_0x7721('0x1f')]);}_0x5b0551[_0x7721('0x3a')]=qs[_0x7721('0x3b')](_0x52316e[_0x7721('0x33')][_0x7721('0x3b')]);_0x5b0551[_0x7721('0x3c')]=qs['filters'](_[_0x7721('0x3d')](_0x52316e['query'],_0x499b87[_0x7721('0x3e')]));if(_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]){_0x5b0551[_0x7721('0x3c')]=_[_0x7721('0x40')](_0x5b0551[_0x7721('0x3c')],{'$or':_['map'](_0x343c19,function(_0x557c34){if(_0x557c34['type']!=='VIRTUAL'){var _0x18001c={};_0x18001c[_0x557c34[_0x7721('0x29')]]={'$like':'%'+_0x52316e[_0x7721('0x33')][_0x7721('0x3f')]+'%'};return _0x18001c;}})});}_0x5b0551=_['merge']({},_0x5b0551,_0x52316e[_0x7721('0x41')]);var _0x4cf659={'where':_0x5b0551[_0x7721('0x3c')]};return db[_0x7721('0x2d')]['count'](_0x4cf659)[_0x7721('0x26')](function(_0x3a47c8){_0x315202['count']=_0x3a47c8;if(_0x52316e['query'][_0x7721('0x42')]){_0x5b0551[_0x7721('0x43')]=[{'all':!![]}];}return db[_0x7721('0x2d')][_0x7721('0x44')](_0x5b0551);})['then'](function(_0x2db173){_0x315202[_0x7721('0x45')]=_0x2db173;return _0x315202;})[_0x7721('0x26')](respondWithFilteredResult(_0x258ddf,_0x5b0551))[_0x7721('0x46')](handleError(_0x258ddf,null));};exports[_0x7721('0x47')]=function(_0x52ab67,_0x490d4){var _0x4a2c28={'raw':!![],'where':{'id':_0x52ab67['params']['id']}},_0xaa3216={};_0xaa3216[_0x7721('0x31')]=_[_0x7721('0x32')](db[_0x7721('0x2d')]['rawAttributes']);_0xaa3216[_0x7721('0x33')]=_[_0x7721('0x32')](_0x52ab67[_0x7721('0x33')]);_0xaa3216['filters']=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],_0xaa3216[_0x7721('0x33')]);_0x4a2c28[_0x7721('0x36')]=_[_0x7721('0x34')](_0xaa3216[_0x7721('0x31')],qs[_0x7721('0x35')](_0x52ab67['query']['fields']));_0x4a2c28[_0x7721('0x36')]=_0x4a2c28[_0x7721('0x36')][_0x7721('0x37')]?_0x4a2c28[_0x7721('0x36')]:_0xaa3216[_0x7721('0x31')];if(_0x52ab67[_0x7721('0x33')][_0x7721('0x42')]){_0x4a2c28[_0x7721('0x43')]=[{'all':!![]}];}_0x4a2c28=_[_0x7721('0x40')]({},_0x4a2c28,_0x52ab67[_0x7721('0x41')]);return db['SquareReport']['find'](_0x4a2c28)[_0x7721('0x26')](handleEntityNotFound(_0x490d4,null))[_0x7721('0x26')](respondWithResult(_0x490d4,null))[_0x7721('0x46')](handleError(_0x490d4,null));};exports[_0x7721('0x48')]=function(_0x589e95,_0x30107e){return db[_0x7721('0x2d')]['create'](_0x589e95[_0x7721('0x49')],{})['then'](respondWithResult(_0x30107e,0xc9))[_0x7721('0x46')](handleError(_0x30107e,null));};exports['update']=function(_0x334f23,_0x196be4){if(_0x334f23[_0x7721('0x49')]['id']){delete _0x334f23['body']['id'];}return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0x334f23['params']['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x196be4,null))[_0x7721('0x26')](saveUpdates(_0x334f23[_0x7721('0x49')],null))['then'](respondWithResult(_0x196be4,null))[_0x7721('0x46')](handleError(_0x196be4,null));};exports['destroy']=function(_0xdb1ca8,_0x310549){return db[_0x7721('0x2d')][_0x7721('0x4a')]({'where':{'id':_0xdb1ca8[_0x7721('0x4b')]['id']}})[_0x7721('0x26')](handleEntityNotFound(_0x310549,null))[_0x7721('0x26')](removeEntity(_0x310549,null))[_0x7721('0x46')](handleError(_0x310549,null));};exports[_0x7721('0x4c')]=function(_0x3386aa,_0x31770e){return db[_0x7721('0x2d')][_0x7721('0x4c')]()[_0x7721('0x26')](respondWithResult(_0x31770e,null))[_0x7721('0x46')](handleError(_0x31770e,null));}; \ No newline at end of file +var _0x5fab=['includeAll','rows','catch','show','params','include','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','SquareReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','merge','filter','options','count'];(function(_0x3fb5f9,_0xa4c2d9){var _0x541745=function(_0x4faa48){while(--_0x4faa48){_0x3fb5f9['push'](_0x3fb5f9['shift']());}};_0x541745(++_0xa4c2d9);}(_0x5fab,0x177));var _0xb5fa=function(_0x5f49bc,_0x548555){_0x5f49bc=_0x5f49bc-0x0;var _0x44bbb9=_0x5fab[_0x5f49bc];return _0x44bbb9;};'use strict';var pdf=require(_0xb5fa('0x0'));var emlformat=require(_0xb5fa('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xb5fa('0x2'));var jsonpatch=require(_0xb5fa('0x3'));var rp=require(_0xb5fa('0x4'));var moment=require(_0xb5fa('0x5'));var BPromise=require(_0xb5fa('0x6'));var Mustache=require(_0xb5fa('0x7'));var util=require(_0xb5fa('0x8'));var path=require(_0xb5fa('0x9'));var sox=require(_0xb5fa('0xa'));var csv=require(_0xb5fa('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xb5fa('0xc'));var crypto=require(_0xb5fa('0xd'));var jsforce=require(_0xb5fa('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb5fa('0xb'));var querystring=require(_0xb5fa('0xf'));var Papa=require(_0xb5fa('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb5fa('0x11'));var as=require(_0xb5fa('0x12'));var hardwareService=require(_0xb5fa('0x13'));var logger=require(_0xb5fa('0x14'))(_0xb5fa('0x15'));var utils=require(_0xb5fa('0x16'));var config=require(_0xb5fa('0x17'));var db=require(_0xb5fa('0x18'))['db'];function respondWithStatusCode(_0x309740,_0x4d3576){_0x4d3576=_0x4d3576||0xcc;return function(_0x2ad830){if(_0x2ad830){return _0x309740[_0xb5fa('0x19')](_0x4d3576);}return _0x309740['status'](_0x4d3576)[_0xb5fa('0x1a')]();};}function respondWithResult(_0x577af0,_0x265992){_0x265992=_0x265992||0xc8;return function(_0x3fc372){if(_0x3fc372){return _0x577af0[_0xb5fa('0x1b')](_0x265992)[_0xb5fa('0x1c')](_0x3fc372);}};}function respondWithFilteredResult(_0x8e9d1c,_0x5371cf){return function(_0x567f31){if(_0x567f31){var _0x38e964=_0x567f31['count'],_0x587043=_0x5371cf['offset'],_0x31f252=_0x5371cf[_0xb5fa('0x1d')]+_0x5371cf[_0xb5fa('0x1e')],_0x27c8f7;if(_0x31f252>=_0x38e964){_0x31f252=_0x38e964;_0x27c8f7=0xc8;}else{_0x27c8f7=0xce;}_0x8e9d1c[_0xb5fa('0x1b')](_0x27c8f7);return _0x8e9d1c[_0xb5fa('0x1f')](_0xb5fa('0x20'),_0x587043+'-'+_0x31f252+'/'+_0x38e964)[_0xb5fa('0x1c')](_0x567f31);}return null;};}function patchUpdates(_0x3b0f69){return function(_0x21f4f4){try{jsonpatch[_0xb5fa('0x21')](_0x21f4f4,_0x3b0f69,!![]);}catch(_0x368cb1){return BPromise[_0xb5fa('0x22')](_0x368cb1);}return _0x21f4f4[_0xb5fa('0x23')]();};}function saveUpdates(_0x5cd822,_0x432bfa){return function(_0x519e20){if(_0x519e20){return _0x519e20[_0xb5fa('0x24')](_0x5cd822)['then'](function(_0xd0fe2b){return _0xd0fe2b;});}return null;};}function removeEntity(_0x43c09f,_0x4e05c0){return function(_0x40dfdf){if(_0x40dfdf){return _0x40dfdf[_0xb5fa('0x25')]()[_0xb5fa('0x26')](function(){_0x43c09f['status'](0xcc)[_0xb5fa('0x1a')]();});}};}function handleEntityNotFound(_0xec108f,_0x444237){return function(_0x542348){if(!_0x542348){_0xec108f[_0xb5fa('0x19')](0x194);}return _0x542348;};}function handleError(_0x5d55f7,_0x106c4b){_0x106c4b=_0x106c4b||0x1f4;return function(_0x264591){logger[_0xb5fa('0x27')](_0x264591[_0xb5fa('0x28')]);if(_0x264591[_0xb5fa('0x29')]){delete _0x264591[_0xb5fa('0x29')];}_0x5d55f7[_0xb5fa('0x1b')](_0x106c4b)[_0xb5fa('0x2a')](_0x264591);};}exports['index']=function(_0x4ec294,_0x5bdf11){var _0x5a1c39={},_0x28a350={},_0x460b54={'count':0x0,'rows':[]};var _0x12c0d4=_[_0xb5fa('0x2b')](db[_0xb5fa('0x2c')][_0xb5fa('0x2d')],function(_0x358549){return{'name':_0x358549[_0xb5fa('0x2e')],'type':_0x358549[_0xb5fa('0x2f')][_0xb5fa('0x30')]};});_0x28a350[_0xb5fa('0x31')]=_[_0xb5fa('0x2b')](_0x12c0d4,_0xb5fa('0x29'));_0x28a350[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x4ec294[_0xb5fa('0x32')]);_0x28a350[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],_0x28a350[_0xb5fa('0x32')]);_0x5a1c39[_0xb5fa('0x36')]=_[_0xb5fa('0x35')](_0x28a350[_0xb5fa('0x31')],qs[_0xb5fa('0x37')](_0x4ec294['query'][_0xb5fa('0x37')]));_0x5a1c39['attributes']=_0x5a1c39['attributes']['length']?_0x5a1c39[_0xb5fa('0x36')]:_0x28a350['model'];if(!_0x4ec294[_0xb5fa('0x32')]['hasOwnProperty']('nolimit')){_0x5a1c39[_0xb5fa('0x1e')]=qs[_0xb5fa('0x1e')](_0x4ec294['query']['limit']);_0x5a1c39[_0xb5fa('0x1d')]=qs[_0xb5fa('0x1d')](_0x4ec294[_0xb5fa('0x32')]['offset']);}_0x5a1c39[_0xb5fa('0x38')]=qs[_0xb5fa('0x39')](_0x4ec294['query'][_0xb5fa('0x39')]);_0x5a1c39[_0xb5fa('0x3a')]=qs[_0xb5fa('0x34')](_['pick'](_0x4ec294[_0xb5fa('0x32')],_0x28a350[_0xb5fa('0x34')]));if(_0x4ec294[_0xb5fa('0x32')]['filter']){_0x5a1c39[_0xb5fa('0x3a')]=_[_0xb5fa('0x3b')](_0x5a1c39[_0xb5fa('0x3a')],{'$or':_[_0xb5fa('0x2b')](_0x12c0d4,function(_0x5e7770){if(_0x5e7770['type']!=='VIRTUAL'){var _0x49e786={};_0x49e786[_0x5e7770['name']]={'$like':'%'+_0x4ec294['query'][_0xb5fa('0x3c')]+'%'};return _0x49e786;}})});}_0x5a1c39=_['merge']({},_0x5a1c39,_0x4ec294[_0xb5fa('0x3d')]);var _0x3ae696={'where':_0x5a1c39[_0xb5fa('0x3a')]};return db[_0xb5fa('0x2c')][_0xb5fa('0x3e')](_0x3ae696)[_0xb5fa('0x26')](function(_0x4b4c4c){_0x460b54['count']=_0x4b4c4c;if(_0x4ec294['query'][_0xb5fa('0x3f')]){_0x5a1c39['include']=[{'all':!![]}];}return db[_0xb5fa('0x2c')]['findAll'](_0x5a1c39);})['then'](function(_0x3cdf63){_0x460b54[_0xb5fa('0x40')]=_0x3cdf63;return _0x460b54;})[_0xb5fa('0x26')](respondWithFilteredResult(_0x5bdf11,_0x5a1c39))[_0xb5fa('0x41')](handleError(_0x5bdf11,null));};exports[_0xb5fa('0x42')]=function(_0x26ef1b,_0x337c53){var _0x83df0b={'raw':!![],'where':{'id':_0x26ef1b[_0xb5fa('0x43')]['id']}},_0x19e370={};_0x19e370['model']=_[_0xb5fa('0x33')](db['SquareReport'][_0xb5fa('0x2d')]);_0x19e370[_0xb5fa('0x32')]=_[_0xb5fa('0x33')](_0x26ef1b[_0xb5fa('0x32')]);_0x19e370[_0xb5fa('0x34')]=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],_0x19e370[_0xb5fa('0x32')]);_0x83df0b['attributes']=_[_0xb5fa('0x35')](_0x19e370[_0xb5fa('0x31')],qs['fields'](_0x26ef1b[_0xb5fa('0x32')]['fields']));_0x83df0b[_0xb5fa('0x36')]=_0x83df0b[_0xb5fa('0x36')]['length']?_0x83df0b['attributes']:_0x19e370[_0xb5fa('0x31')];if(_0x26ef1b[_0xb5fa('0x32')][_0xb5fa('0x3f')]){_0x83df0b[_0xb5fa('0x44')]=[{'all':!![]}];}_0x83df0b=_[_0xb5fa('0x3b')]({},_0x83df0b,_0x26ef1b[_0xb5fa('0x3d')]);return db[_0xb5fa('0x2c')][_0xb5fa('0x45')](_0x83df0b)['then'](handleEntityNotFound(_0x337c53,null))[_0xb5fa('0x26')](respondWithResult(_0x337c53,null))[_0xb5fa('0x41')](handleError(_0x337c53,null));};exports['create']=function(_0xee6baa,_0x2c378a){return db[_0xb5fa('0x2c')][_0xb5fa('0x46')](_0xee6baa[_0xb5fa('0x47')],{})[_0xb5fa('0x26')](respondWithResult(_0x2c378a,0xc9))[_0xb5fa('0x41')](handleError(_0x2c378a,null));};exports[_0xb5fa('0x24')]=function(_0x20f5f5,_0x464e36){if(_0x20f5f5[_0xb5fa('0x47')]['id']){delete _0x20f5f5[_0xb5fa('0x47')]['id'];}return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x20f5f5[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x464e36,null))['then'](saveUpdates(_0x20f5f5['body'],null))[_0xb5fa('0x26')](respondWithResult(_0x464e36,null))['catch'](handleError(_0x464e36,null));};exports[_0xb5fa('0x25')]=function(_0x1049d9,_0x5404f6){return db[_0xb5fa('0x2c')][_0xb5fa('0x45')]({'where':{'id':_0x1049d9[_0xb5fa('0x43')]['id']}})[_0xb5fa('0x26')](handleEntityNotFound(_0x5404f6,null))[_0xb5fa('0x26')](removeEntity(_0x5404f6,null))[_0xb5fa('0x41')](handleError(_0x5404f6,null));};exports['describe']=function(_0x27a651,_0x4fd5bf){return db[_0xb5fa('0x2c')][_0xb5fa('0x48')]()[_0xb5fa('0x26')](respondWithResult(_0x4fd5bf,null))['catch'](handleError(_0x4fd5bf,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index b5b46f3..c910a9b 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 _0x2f23=['uniqueid','project_name','leaveAt','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./squareReport.attributes','exports','define','SquareReport','report_square'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2f23,0x103));var _0x32f2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2f23[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x32f2('0x0'));var util=require(_0x32f2('0x1'));var logger=require(_0x32f2('0x2'))(_0x32f2('0x3'));var moment=require('moment');var BPromise=require(_0x32f2('0x4'));var rp=require(_0x32f2('0x5'));var fs=require('fs');var path=require(_0x32f2('0x6'));var rimraf=require(_0x32f2('0x7'));var config=require('../../config/environment');var attributes=require(_0x32f2('0x8'));module[_0x32f2('0x9')]=function(_0x57280c,_0x475007){return _0x57280c[_0x32f2('0xa')](_0x32f2('0xb'),attributes,{'tableName':_0x32f2('0xc'),'paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0x32f2('0xd'),_0x32f2('0xe')]},{'name':_0x32f2('0xf'),'fields':[_0x32f2('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb103=['project_name','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./squareReport.attributes','define','SquareReport','report_square','uid_pname','uniqueid'];(function(_0x3d904e,_0x2d819f){var _0x656fb2=function(_0x28fec1){while(--_0x28fec1){_0x3d904e['push'](_0x3d904e['shift']());}};_0x656fb2(++_0x2d819f);}(_0xb103,0xd1));var _0x3b10=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xb103[_0x20e7e3];return _0x14b9de;};'use strict';var _=require(_0x3b10('0x0'));var util=require(_0x3b10('0x1'));var logger=require(_0x3b10('0x2'))(_0x3b10('0x3'));var moment=require(_0x3b10('0x4'));var BPromise=require(_0x3b10('0x5'));var rp=require(_0x3b10('0x6'));var fs=require('fs');var path=require(_0x3b10('0x7'));var rimraf=require('rimraf');var config=require(_0x3b10('0x8'));var attributes=require(_0x3b10('0x9'));module['exports']=function(_0x285570,_0x5d5bf8){return _0x285570[_0x3b10('0xa')](_0x3b10('0xb'),attributes,{'tableName':_0x3b10('0xc'),'paranoid':![],'indexes':[{'name':_0x3b10('0xd'),'fields':[_0x3b10('0xe'),_0x3b10('0xf')]},{'name':'leaveAt','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 7ff3fc8..811d73f 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 _0xccfb=['error','code','message','info','result','catch','body','options','raw','CreateSquareReport','UpdateSquareReport','SquareReport','update','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x364e5c,_0x1fc0e4){var _0x370035=function(_0x220ed6){while(--_0x220ed6){_0x364e5c['push'](_0x364e5c['shift']());}};_0x370035(++_0x1fc0e4);}(_0xccfb,0x1a7));var _0xbccf=function(_0x3044e8,_0x5ecca2){_0x3044e8=_0x3044e8-0x0;var _0x4b5dd5=_0xccfb[_0x3044e8];return _0x4b5dd5;};'use strict';var _=require(_0xbccf('0x0'));var util=require(_0xbccf('0x1'));var moment=require(_0xbccf('0x2'));var BPromise=require(_0xbccf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbccf('0x4'));var db=require(_0xbccf('0x5'))['db'];var utils=require(_0xbccf('0x6'));var logger=require(_0xbccf('0x7'))(_0xbccf('0x8'));var config=require(_0xbccf('0x9'));var jayson=require(_0xbccf('0xa'));var client=jayson[_0xbccf('0xb')][_0xbccf('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x285932,_0x15777d,_0x247a70){return new BPromise(function(_0x3f3d90,_0x50a820){return client[_0xbccf('0xd')](_0x285932,_0x247a70)[_0xbccf('0xe')](function(_0x53d596){logger['info'](_0xbccf('0xf'),_0x15777d,_0xbccf('0x10'));logger[_0xbccf('0x11')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x15777d,_0xbccf('0x10'),JSON[_0xbccf('0x12')](_0x53d596));if(_0x53d596[_0xbccf('0x13')]){if(_0x53d596['error'][_0xbccf('0x14')]===0x1f4){logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x53d596[_0xbccf('0x13')][_0xbccf('0x15')]);return _0x50a820(_0x53d596[_0xbccf('0x13')]['message']);}logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x53d596[_0xbccf('0x13')]['message']);return _0x3f3d90(_0x53d596['error']['message']);}else{logger[_0xbccf('0x16')](_0xbccf('0xf'),_0x15777d,'request\x20sent');_0x3f3d90(_0x53d596[_0xbccf('0x17')]['message']);}})[_0xbccf('0x18')](function(_0x1ec1b5){logger[_0xbccf('0x13')](_0xbccf('0xf'),_0x15777d,_0x1ec1b5);_0x50a820(_0x1ec1b5);});});}exports['CreateSquareReport']=function(_0x20d71f){var _0x32003a=this;return new Promise(function(_0x33c678,_0x562224){return db['SquareReport']['create'](_0x20d71f[_0xbccf('0x19')],{'raw':_0x20d71f['options']?_0x20d71f[_0xbccf('0x1a')][_0xbccf('0x1b')]===undefined?!![]:![]:!![]})[_0xbccf('0xe')](function(_0x2169c4){logger[_0xbccf('0x16')](_0xbccf('0x1c'),_0x20d71f);logger[_0xbccf('0x11')](_0xbccf('0x1c'),_0x20d71f,JSON['stringify'](_0x2169c4));_0x33c678(_0x2169c4);})[_0xbccf('0x18')](function(_0x2273e8){logger[_0xbccf('0x13')]('CreateSquareReport',_0x2273e8['message'],_0x20d71f);_0x562224(_0x32003a['error'](0x1f4,_0x2273e8['message']));});});};exports[_0xbccf('0x1d')]=function(_0x41ea0f){var _0x329759=this;return new Promise(function(_0x1ada61,_0x2c7156){return db[_0xbccf('0x1e')][_0xbccf('0x1f')](_0x41ea0f[_0xbccf('0x19')],{'raw':_0x41ea0f[_0xbccf('0x1a')]?_0x41ea0f[_0xbccf('0x1a')][_0xbccf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x41ea0f[_0xbccf('0x1a')]?_0x41ea0f['options'][_0xbccf('0x20')]||null:null,'attributes':_0x41ea0f[_0xbccf('0x1a')]?_0x41ea0f['options']['attributes']||null:null,'limit':_0x41ea0f['options']?_0x41ea0f[_0xbccf('0x1a')][_0xbccf('0x21')]||null:null})[_0xbccf('0xe')](function(_0x2c3f1f){logger[_0xbccf('0x16')]('UpdateSquareReport',_0x41ea0f);logger[_0xbccf('0x11')](_0xbccf('0x1d'),_0x41ea0f,JSON[_0xbccf('0x12')](_0x2c3f1f));_0x1ada61(_0x2c3f1f);})[_0xbccf('0x18')](function(_0x26bd90){logger[_0xbccf('0x13')]('UpdateSquareReport',_0x26bd90[_0xbccf('0x15')],_0x41ea0f);_0x2c7156(_0x329759[_0xbccf('0x13')](0x1f4,_0x26bd90[_0xbccf('0x15')]));});});}; \ No newline at end of file +var _0xf2b1=['error','code','message','result','catch','SquareReport','create','body','options','raw','then','CreateSquareReport','stringify','UpdateSquareReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','SquareReport,\x20%s,\x20%s,\x20%s'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xf2b1,0xf8));var _0x1f2b=function(_0x44b0de,_0x213afa){_0x44b0de=_0x44b0de-0x0;var _0x21da2a=_0xf2b1[_0x44b0de];return _0x21da2a;};'use strict';var _=require(_0x1f2b('0x0'));var util=require('util');var moment=require(_0x1f2b('0x1'));var BPromise=require(_0x1f2b('0x2'));var rs=require(_0x1f2b('0x3'));var fs=require('fs');var Redis=require(_0x1f2b('0x4'));var db=require(_0x1f2b('0x5'))['db'];var utils=require(_0x1f2b('0x6'));var logger=require(_0x1f2b('0x7'))('rpc');var config=require(_0x1f2b('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x1f2b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5f1dc9,_0x470d13,_0x4dea0d){return new BPromise(function(_0x2e43f4,_0x4da66b){return client[_0x1f2b('0xa')](_0x5f1dc9,_0x4dea0d)['then'](function(_0x52a5c0){logger[_0x1f2b('0xb')](_0x1f2b('0xc'),_0x470d13,_0x1f2b('0xd'));logger[_0x1f2b('0xe')](_0x1f2b('0xf'),_0x470d13,_0x1f2b('0xd'),JSON['stringify'](_0x52a5c0));if(_0x52a5c0[_0x1f2b('0x10')]){if(_0x52a5c0[_0x1f2b('0x10')][_0x1f2b('0x11')]===0x1f4){logger[_0x1f2b('0x10')](_0x1f2b('0xc'),_0x470d13,_0x52a5c0[_0x1f2b('0x10')][_0x1f2b('0x12')]);return _0x4da66b(_0x52a5c0[_0x1f2b('0x10')]['message']);}logger[_0x1f2b('0x10')](_0x1f2b('0xc'),_0x470d13,_0x52a5c0[_0x1f2b('0x10')][_0x1f2b('0x12')]);return _0x2e43f4(_0x52a5c0[_0x1f2b('0x10')][_0x1f2b('0x12')]);}else{logger[_0x1f2b('0xb')](_0x1f2b('0xc'),_0x470d13,'request\x20sent');_0x2e43f4(_0x52a5c0[_0x1f2b('0x13')][_0x1f2b('0x12')]);}})[_0x1f2b('0x14')](function(_0x575dcc){logger[_0x1f2b('0x10')](_0x1f2b('0xc'),_0x470d13,_0x575dcc);_0x4da66b(_0x575dcc);});});}exports['CreateSquareReport']=function(_0x235b4e){var _0x5d0cf9=this;return new Promise(function(_0x197da4,_0x26ecc7){return db[_0x1f2b('0x15')][_0x1f2b('0x16')](_0x235b4e[_0x1f2b('0x17')],{'raw':_0x235b4e[_0x1f2b('0x18')]?_0x235b4e[_0x1f2b('0x18')][_0x1f2b('0x19')]===undefined?!![]:![]:!![]})[_0x1f2b('0x1a')](function(_0x4b3147){logger[_0x1f2b('0xb')](_0x1f2b('0x1b'),_0x235b4e);logger[_0x1f2b('0xe')](_0x1f2b('0x1b'),_0x235b4e,JSON[_0x1f2b('0x1c')](_0x4b3147));_0x197da4(_0x4b3147);})['catch'](function(_0x35345d){logger['error']('CreateSquareReport',_0x35345d['message'],_0x235b4e);_0x26ecc7(_0x5d0cf9['error'](0x1f4,_0x35345d[_0x1f2b('0x12')]));});});};exports[_0x1f2b('0x1d')]=function(_0x4941cd){var _0x2c497e=this;return new Promise(function(_0xa5bcf1,_0x3c6860){return db[_0x1f2b('0x15')][_0x1f2b('0x1e')](_0x4941cd[_0x1f2b('0x17')],{'raw':_0x4941cd[_0x1f2b('0x18')]?_0x4941cd[_0x1f2b('0x18')][_0x1f2b('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4941cd['options']?_0x4941cd[_0x1f2b('0x18')][_0x1f2b('0x1f')]||null:null,'attributes':_0x4941cd[_0x1f2b('0x18')]?_0x4941cd['options']['attributes']||null:null,'limit':_0x4941cd['options']?_0x4941cd[_0x1f2b('0x18')][_0x1f2b('0x20')]||null:null})[_0x1f2b('0x1a')](function(_0x4543eb){logger[_0x1f2b('0xb')](_0x1f2b('0x1d'),_0x4941cd);logger['debug'](_0x1f2b('0x1d'),_0x4941cd,JSON['stringify'](_0x4543eb));_0xa5bcf1(_0x4543eb);})[_0x1f2b('0x14')](function(_0x574d89){logger['error']('UpdateSquareReport',_0x574d89[_0x1f2b('0x12')],_0x4941cd);_0x3c6860(_0x2c497e[_0x1f2b('0x10')](0x1f4,_0x574d89[_0x1f2b('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index 19b7f8f..a93ab7d 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(_0x15d95c,_0x279c4a){var _0x13728b=function(_0x177e19){while(--_0x177e19){_0x15d95c['push'](_0x15d95c['shift']());}};_0x13728b(++_0x279c4a);}(_0x7a54,0x106));var _0x47a5=function(_0x459f11,_0x474cd1){_0x459f11=_0x459f11-0x0;var _0x53a4e9=_0x7a54[_0x459f11];return _0x53a4e9;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x47a5('0x5'));var config=require(_0x47a5('0x6'));var controller=require(_0x47a5('0x7'));router[_0x47a5('0x8')]('/',auth[_0x47a5('0x9')](),controller['index']);router[_0x47a5('0x8')]('/describe',auth[_0x47a5('0x9')](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0x47a5('0x9')](),controller[_0x47a5('0xc')]);router['put'](_0x47a5('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x47a5('0xd')](_0x47a5('0xb'),auth[_0x47a5('0x9')](),controller[_0x47a5('0xe')]);module[_0x47a5('0xf')]=router; \ No newline at end of file +var _0x5f2f=['/describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index'];(function(_0x28108f,_0x395a0d){var _0x22ad22=function(_0x1c8fc9){while(--_0x1c8fc9){_0x28108f['push'](_0x28108f['shift']());}};_0x22ad22(++_0x395a0d);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13d9c5,_0x2c090c){_0x13d9c5=_0x13d9c5-0x0;var _0x53abc1=_0x5f2f[_0x13d9c5];return _0x53abc1;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./squareReportDetail.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0xd')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xe')]);router['put'](_0xf5f2('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xf5f2('0xf')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0x10')]);module[_0xf5f2('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 8f4bd86..3e30373 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 _0xae7a=['sequelize','exports','STRING'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xae7a,0x129));var _0xaae7=function(_0x2aefb6,_0x1bd384){_0x2aefb6=_0x2aefb6-0x0;var _0x202772=_0xae7a[_0x2aefb6];return _0x202772;};'use strict';var Sequelize=require(_0xaae7('0x0'));module[_0xaae7('0x1')]={'uniqueid':{'type':Sequelize[_0xaae7('0x2')]},'node':{'type':Sequelize[_0xaae7('0x2')]},'application':{'type':Sequelize[_0xaae7('0x2')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0xaae7('0x2')]},'callerid':{'type':Sequelize[_0xaae7('0x2')]}}; \ No newline at end of file +var _0xd5ac=['exports','STRING','TEXT','sequelize'];(function(_0x490e36,_0x5c9bf8){var _0x18ef5a=function(_0x54453e){while(--_0x54453e){_0x490e36['push'](_0x490e36['shift']());}};_0x18ef5a(++_0x5c9bf8);}(_0xd5ac,0x1df));var _0xcd5a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd5ac[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcd5a('0x0'));module[_0xcd5a('0x1')]={'uniqueid':{'type':Sequelize[_0xcd5a('0x2')]},'node':{'type':Sequelize[_0xcd5a('0x2')]},'application':{'type':Sequelize[_0xcd5a('0x2')]},'data':{'type':Sequelize[_0xcd5a('0x3')]},'project_name':{'type':Sequelize[_0xcd5a('0x2')]},'callerid':{'type':Sequelize[_0xcd5a('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0eb88dc..d40b278 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 _0xdcb4=['to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','limit','apply','save','update','then','sendStatus','stack','name','send','index','map','SquareDetailsReport','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','where','merge','filter','options','count','includeAll','rows','catch','show','params','rawAttributes','length','include','find','create','body','destroy','describe','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox'];(function(_0x4c00ea,_0x1cf606){var _0x2754b6=function(_0x2bf125){while(--_0x2bf125){_0x4c00ea['push'](_0x4c00ea['shift']());}};_0x2754b6(++_0x1cf606);}(_0xdcb4,0xc5));var _0x4dcb=function(_0x341fc2,_0x123979){_0x341fc2=_0x341fc2-0x0;var _0x59fd3c=_0xdcb4[_0x341fc2];return _0x59fd3c;};'use strict';var pdf=require(_0x4dcb('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4dcb('0x1'));var zipdir=require(_0x4dcb('0x2'));var jsonpatch=require(_0x4dcb('0x3'));var rp=require(_0x4dcb('0x4'));var moment=require(_0x4dcb('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4dcb('0x6'));var util=require(_0x4dcb('0x7'));var path=require(_0x4dcb('0x8'));var sox=require(_0x4dcb('0x9'));var csv=require(_0x4dcb('0xa'));var ejs=require(_0x4dcb('0xb'));var fs=require('fs');var _=require(_0x4dcb('0xc'));var squel=require('squel');var crypto=require(_0x4dcb('0xd'));var jsforce=require(_0x4dcb('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x4dcb('0xa'));var querystring=require(_0x4dcb('0xf'));var Papa=require('papaparse');var Redis=require(_0x4dcb('0x10'));var authService=require(_0x4dcb('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4dcb('0x12'));var logger=require(_0x4dcb('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x4dcb('0x14'))['db'];function respondWithStatusCode(_0x3bf2b0,_0x36d1f6){_0x36d1f6=_0x36d1f6||0xcc;return function(_0x3cc9ce){if(_0x3cc9ce){return _0x3bf2b0['sendStatus'](_0x36d1f6);}return _0x3bf2b0[_0x4dcb('0x15')](_0x36d1f6)[_0x4dcb('0x16')]();};}function respondWithResult(_0x5d2ca1,_0x26699e){_0x26699e=_0x26699e||0xc8;return function(_0x19c74d){if(_0x19c74d){return _0x5d2ca1[_0x4dcb('0x15')](_0x26699e)[_0x4dcb('0x17')](_0x19c74d);}};}function respondWithFilteredResult(_0x1052be,_0x348fda){return function(_0x512009){if(_0x512009){var _0x717ef3=_0x512009['count'],_0x3ab221=_0x348fda[_0x4dcb('0x18')],_0x4b9ed5=_0x348fda['offset']+_0x348fda[_0x4dcb('0x19')],_0x22c50d;if(_0x4b9ed5>=_0x717ef3){_0x4b9ed5=_0x717ef3;_0x22c50d=0xc8;}else{_0x22c50d=0xce;}_0x1052be[_0x4dcb('0x15')](_0x22c50d);return _0x1052be['set']('Content-Range',_0x3ab221+'-'+_0x4b9ed5+'/'+_0x717ef3)[_0x4dcb('0x17')](_0x512009);}return null;};}function patchUpdates(_0x2fd44f){return function(_0x3ebe84){try{jsonpatch[_0x4dcb('0x1a')](_0x3ebe84,_0x2fd44f,!![]);}catch(_0x5e9644){return BPromise['reject'](_0x5e9644);}return _0x3ebe84[_0x4dcb('0x1b')]();};}function saveUpdates(_0x5aabe6,_0x326cca){return function(_0x4d6f48){if(_0x4d6f48){return _0x4d6f48[_0x4dcb('0x1c')](_0x5aabe6)[_0x4dcb('0x1d')](function(_0x533bae){return _0x533bae;});}return null;};}function removeEntity(_0x18eedf,_0x69064e){return function(_0x24a305){if(_0x24a305){return _0x24a305['destroy']()['then'](function(){_0x18eedf[_0x4dcb('0x15')](0xcc)[_0x4dcb('0x16')]();});}};}function handleEntityNotFound(_0x570479,_0x57c490){return function(_0x3e8372){if(!_0x3e8372){_0x570479[_0x4dcb('0x1e')](0x194);}return _0x3e8372;};}function handleError(_0x2f7335,_0x5d0629){_0x5d0629=_0x5d0629||0x1f4;return function(_0x5bd123){logger['error'](_0x5bd123[_0x4dcb('0x1f')]);if(_0x5bd123['name']){delete _0x5bd123[_0x4dcb('0x20')];}_0x2f7335[_0x4dcb('0x15')](_0x5d0629)[_0x4dcb('0x21')](_0x5bd123);};}exports[_0x4dcb('0x22')]=function(_0x469757,_0x566151){var _0x15f578={},_0x56565e={},_0x562f3f={'count':0x0,'rows':[]};var _0x1a4e7d=_[_0x4dcb('0x23')](db[_0x4dcb('0x24')]['rawAttributes'],function(_0x277100){return{'name':_0x277100[_0x4dcb('0x25')],'type':_0x277100[_0x4dcb('0x26')][_0x4dcb('0x27')]};});_0x56565e[_0x4dcb('0x28')]=_[_0x4dcb('0x23')](_0x1a4e7d,_0x4dcb('0x20'));_0x56565e['query']=_[_0x4dcb('0x29')](_0x469757[_0x4dcb('0x2a')]);_0x56565e['filters']=_[_0x4dcb('0x2b')](_0x56565e[_0x4dcb('0x28')],_0x56565e[_0x4dcb('0x2a')]);_0x15f578['attributes']=_['intersection'](_0x56565e['model'],qs[_0x4dcb('0x2c')](_0x469757[_0x4dcb('0x2a')][_0x4dcb('0x2c')]));_0x15f578[_0x4dcb('0x2d')]=_0x15f578[_0x4dcb('0x2d')]['length']?_0x15f578[_0x4dcb('0x2d')]:_0x56565e[_0x4dcb('0x28')];if(!_0x469757[_0x4dcb('0x2a')]['hasOwnProperty'](_0x4dcb('0x2e'))){_0x15f578[_0x4dcb('0x19')]=qs[_0x4dcb('0x19')](_0x469757[_0x4dcb('0x2a')][_0x4dcb('0x19')]);_0x15f578['offset']=qs['offset'](_0x469757[_0x4dcb('0x2a')][_0x4dcb('0x18')]);}_0x15f578[_0x4dcb('0x2f')]=qs['sort'](_0x469757[_0x4dcb('0x2a')][_0x4dcb('0x30')]);_0x15f578['where']=qs[_0x4dcb('0x31')](_[_0x4dcb('0x32')](_0x469757[_0x4dcb('0x2a')],_0x56565e[_0x4dcb('0x31')]));if(_0x469757[_0x4dcb('0x2a')]['filter']){_0x15f578[_0x4dcb('0x33')]=_[_0x4dcb('0x34')](_0x15f578[_0x4dcb('0x33')],{'$or':_[_0x4dcb('0x23')](_0x1a4e7d,function(_0x4e16b9){if(_0x4e16b9['type']!=='VIRTUAL'){var _0x506d96={};_0x506d96[_0x4e16b9['name']]={'$like':'%'+_0x469757[_0x4dcb('0x2a')][_0x4dcb('0x35')]+'%'};return _0x506d96;}})});}_0x15f578=_[_0x4dcb('0x34')]({},_0x15f578,_0x469757[_0x4dcb('0x36')]);var _0x34f3c1={'where':_0x15f578[_0x4dcb('0x33')]};return db[_0x4dcb('0x24')][_0x4dcb('0x37')](_0x34f3c1)[_0x4dcb('0x1d')](function(_0x3cbf87){_0x562f3f['count']=_0x3cbf87;if(_0x469757['query'][_0x4dcb('0x38')]){_0x15f578['include']=[{'all':!![]}];}return db[_0x4dcb('0x24')]['findAll'](_0x15f578);})[_0x4dcb('0x1d')](function(_0x29b6d0){_0x562f3f[_0x4dcb('0x39')]=_0x29b6d0;return _0x562f3f;})[_0x4dcb('0x1d')](respondWithFilteredResult(_0x566151,_0x15f578))[_0x4dcb('0x3a')](handleError(_0x566151,null));};exports[_0x4dcb('0x3b')]=function(_0x2f4ac0,_0xf8ee51){var _0x335c7c={'raw':!![],'where':{'id':_0x2f4ac0[_0x4dcb('0x3c')]['id']}},_0x211d4f={};_0x211d4f['model']=_[_0x4dcb('0x29')](db[_0x4dcb('0x24')][_0x4dcb('0x3d')]);_0x211d4f[_0x4dcb('0x2a')]=_[_0x4dcb('0x29')](_0x2f4ac0[_0x4dcb('0x2a')]);_0x211d4f[_0x4dcb('0x31')]=_[_0x4dcb('0x2b')](_0x211d4f['model'],_0x211d4f[_0x4dcb('0x2a')]);_0x335c7c[_0x4dcb('0x2d')]=_[_0x4dcb('0x2b')](_0x211d4f['model'],qs['fields'](_0x2f4ac0[_0x4dcb('0x2a')][_0x4dcb('0x2c')]));_0x335c7c['attributes']=_0x335c7c['attributes'][_0x4dcb('0x3e')]?_0x335c7c[_0x4dcb('0x2d')]:_0x211d4f[_0x4dcb('0x28')];if(_0x2f4ac0[_0x4dcb('0x2a')][_0x4dcb('0x38')]){_0x335c7c[_0x4dcb('0x3f')]=[{'all':!![]}];}_0x335c7c=_[_0x4dcb('0x34')]({},_0x335c7c,_0x2f4ac0[_0x4dcb('0x36')]);return db[_0x4dcb('0x24')][_0x4dcb('0x40')](_0x335c7c)[_0x4dcb('0x1d')](handleEntityNotFound(_0xf8ee51,null))[_0x4dcb('0x1d')](respondWithResult(_0xf8ee51,null))[_0x4dcb('0x3a')](handleError(_0xf8ee51,null));};exports['create']=function(_0x54179a,_0xeda7b){return db['SquareDetailsReport'][_0x4dcb('0x41')](_0x54179a[_0x4dcb('0x42')],{})[_0x4dcb('0x1d')](respondWithResult(_0xeda7b,0xc9))[_0x4dcb('0x3a')](handleError(_0xeda7b,null));};exports[_0x4dcb('0x1c')]=function(_0x260592,_0x5e28b9){if(_0x260592[_0x4dcb('0x42')]['id']){delete _0x260592['body']['id'];}return db[_0x4dcb('0x24')][_0x4dcb('0x40')]({'where':{'id':_0x260592['params']['id']}})['then'](handleEntityNotFound(_0x5e28b9,null))['then'](saveUpdates(_0x260592[_0x4dcb('0x42')],null))[_0x4dcb('0x1d')](respondWithResult(_0x5e28b9,null))[_0x4dcb('0x3a')](handleError(_0x5e28b9,null));};exports[_0x4dcb('0x43')]=function(_0x36345e,_0x36af0c){return db[_0x4dcb('0x24')]['find']({'where':{'id':_0x36345e['params']['id']}})[_0x4dcb('0x1d')](handleEntityNotFound(_0x36af0c,null))[_0x4dcb('0x1d')](removeEntity(_0x36af0c,null))[_0x4dcb('0x3a')](handleError(_0x36af0c,null));};exports[_0x4dcb('0x44')]=function(_0xe52b15,_0x11fcfa){return db[_0x4dcb('0x24')]['describe']()['then'](respondWithResult(_0x11fcfa,null))['catch'](handleError(_0x11fcfa,null));}; \ No newline at end of file +var _0x93f9=['key','model','query','keys','filters','intersection','fields','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','update','body','describe','html-pdf','eml-format','rimraf','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','apply','reject','save','destroy','stack','name','index','map','SquareDetailsReport','rawAttributes'];(function(_0x409dbf,_0x14966c){var _0x49591b=function(_0x23f2bc){while(--_0x23f2bc){_0x409dbf['push'](_0x409dbf['shift']());}};_0x49591b(++_0x14966c);}(_0x93f9,0x136));var _0x993f=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x93f9[_0x33032e];return _0x13316b;};'use strict';var pdf=require(_0x993f('0x0'));var emlformat=require(_0x993f('0x1'));var rimraf=require(_0x993f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x993f('0x3'));var moment=require('moment');var BPromise=require(_0x993f('0x4'));var Mustache=require('mustache');var util=require(_0x993f('0x5'));var path=require(_0x993f('0x6'));var sox=require(_0x993f('0x7'));var csv=require(_0x993f('0x8'));var ejs=require(_0x993f('0x9'));var fs=require('fs');var _=require(_0x993f('0xa'));var squel=require(_0x993f('0xb'));var crypto=require(_0x993f('0xc'));var jsforce=require(_0x993f('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x993f('0x8'));var querystring=require(_0x993f('0xe'));var Papa=require(_0x993f('0xf'));var Redis=require(_0x993f('0x10'));var authService=require(_0x993f('0x11'));var qs=require(_0x993f('0x12'));var as=require(_0x993f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x993f('0x14'));var utils=require('../../config/utils');var config=require(_0x993f('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x31cc83,_0xb65fa3){_0xb65fa3=_0xb65fa3||0xcc;return function(_0x2a2d67){if(_0x2a2d67){return _0x31cc83[_0x993f('0x16')](_0xb65fa3);}return _0x31cc83[_0x993f('0x17')](_0xb65fa3)[_0x993f('0x18')]();};}function respondWithResult(_0x546f04,_0x3497e1){_0x3497e1=_0x3497e1||0xc8;return function(_0x837c57){if(_0x837c57){return _0x546f04[_0x993f('0x17')](_0x3497e1)[_0x993f('0x19')](_0x837c57);}};}function respondWithFilteredResult(_0x3dde18,_0xf32d32){return function(_0x56a4cc){if(_0x56a4cc){var _0x16309b=_0x56a4cc[_0x993f('0x1a')],_0x102027=_0xf32d32[_0x993f('0x1b')],_0xa9dcf7=_0xf32d32['offset']+_0xf32d32[_0x993f('0x1c')],_0x24c9ca;if(_0xa9dcf7>=_0x16309b){_0xa9dcf7=_0x16309b;_0x24c9ca=0xc8;}else{_0x24c9ca=0xce;}_0x3dde18[_0x993f('0x17')](_0x24c9ca);return _0x3dde18[_0x993f('0x1d')]('Content-Range',_0x102027+'-'+_0xa9dcf7+'/'+_0x16309b)['json'](_0x56a4cc);}return null;};}function patchUpdates(_0x3c6bce){return function(_0x128e02){try{jsonpatch[_0x993f('0x1e')](_0x128e02,_0x3c6bce,!![]);}catch(_0x3b0bd0){return BPromise[_0x993f('0x1f')](_0x3b0bd0);}return _0x128e02[_0x993f('0x20')]();};}function saveUpdates(_0x4db7be,_0x5518cf){return function(_0x4dcec3){if(_0x4dcec3){return _0x4dcec3['update'](_0x4db7be)['then'](function(_0x584ca2){return _0x584ca2;});}return null;};}function removeEntity(_0xd21f9d,_0x44d8a8){return function(_0x12bddf){if(_0x12bddf){return _0x12bddf[_0x993f('0x21')]()['then'](function(){_0xd21f9d[_0x993f('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2fe0a7,_0x1f53b7){return function(_0x3b300e){if(!_0x3b300e){_0x2fe0a7[_0x993f('0x16')](0x194);}return _0x3b300e;};}function handleError(_0x366fda,_0x4edf22){_0x4edf22=_0x4edf22||0x1f4;return function(_0x20b0fd){logger['error'](_0x20b0fd[_0x993f('0x22')]);if(_0x20b0fd['name']){delete _0x20b0fd[_0x993f('0x23')];}_0x366fda[_0x993f('0x17')](_0x4edf22)['send'](_0x20b0fd);};}exports[_0x993f('0x24')]=function(_0x14d973,_0x2c8c98){var _0x4037fa={},_0xce6795={},_0x146013={'count':0x0,'rows':[]};var _0x577a71=_[_0x993f('0x25')](db[_0x993f('0x26')][_0x993f('0x27')],function(_0xd0168e){return{'name':_0xd0168e['fieldName'],'type':_0xd0168e['type'][_0x993f('0x28')]};});_0xce6795[_0x993f('0x29')]=_[_0x993f('0x25')](_0x577a71,_0x993f('0x23'));_0xce6795[_0x993f('0x2a')]=_[_0x993f('0x2b')](_0x14d973['query']);_0xce6795[_0x993f('0x2c')]=_['intersection'](_0xce6795[_0x993f('0x29')],_0xce6795[_0x993f('0x2a')]);_0x4037fa['attributes']=_[_0x993f('0x2d')](_0xce6795[_0x993f('0x29')],qs[_0x993f('0x2e')](_0x14d973['query']['fields']));_0x4037fa['attributes']=_0x4037fa['attributes']['length']?_0x4037fa[_0x993f('0x2f')]:_0xce6795['model'];if(!_0x14d973['query']['hasOwnProperty'](_0x993f('0x30'))){_0x4037fa[_0x993f('0x1c')]=qs['limit'](_0x14d973['query'][_0x993f('0x1c')]);_0x4037fa[_0x993f('0x1b')]=qs[_0x993f('0x1b')](_0x14d973[_0x993f('0x2a')][_0x993f('0x1b')]);}_0x4037fa[_0x993f('0x31')]=qs[_0x993f('0x32')](_0x14d973[_0x993f('0x2a')]['sort']);_0x4037fa[_0x993f('0x33')]=qs[_0x993f('0x2c')](_['pick'](_0x14d973[_0x993f('0x2a')],_0xce6795['filters']));if(_0x14d973[_0x993f('0x2a')][_0x993f('0x34')]){_0x4037fa[_0x993f('0x33')]=_[_0x993f('0x35')](_0x4037fa[_0x993f('0x33')],{'$or':_[_0x993f('0x25')](_0x577a71,function(_0xa0649e){if(_0xa0649e['type']!==_0x993f('0x36')){var _0x56f1fb={};_0x56f1fb[_0xa0649e['name']]={'$like':'%'+_0x14d973[_0x993f('0x2a')][_0x993f('0x34')]+'%'};return _0x56f1fb;}})});}_0x4037fa=_[_0x993f('0x35')]({},_0x4037fa,_0x14d973[_0x993f('0x37')]);var _0x3ce9d5={'where':_0x4037fa[_0x993f('0x33')]};return db[_0x993f('0x26')][_0x993f('0x1a')](_0x3ce9d5)[_0x993f('0x38')](function(_0x1cc055){_0x146013['count']=_0x1cc055;if(_0x14d973[_0x993f('0x2a')][_0x993f('0x39')]){_0x4037fa[_0x993f('0x3a')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x993f('0x3b')](_0x4037fa);})['then'](function(_0x318305){_0x146013[_0x993f('0x3c')]=_0x318305;return _0x146013;})[_0x993f('0x38')](respondWithFilteredResult(_0x2c8c98,_0x4037fa))[_0x993f('0x3d')](handleError(_0x2c8c98,null));};exports[_0x993f('0x3e')]=function(_0x1193a6,_0x36a767){var _0x16c8d6={'raw':!![],'where':{'id':_0x1193a6[_0x993f('0x3f')]['id']}},_0x4eb3fe={};_0x4eb3fe['model']=_['keys'](db['SquareDetailsReport']['rawAttributes']);_0x4eb3fe[_0x993f('0x2a')]=_[_0x993f('0x2b')](_0x1193a6['query']);_0x4eb3fe[_0x993f('0x2c')]=_[_0x993f('0x2d')](_0x4eb3fe[_0x993f('0x29')],_0x4eb3fe[_0x993f('0x2a')]);_0x16c8d6[_0x993f('0x2f')]=_[_0x993f('0x2d')](_0x4eb3fe[_0x993f('0x29')],qs[_0x993f('0x2e')](_0x1193a6['query'][_0x993f('0x2e')]));_0x16c8d6[_0x993f('0x2f')]=_0x16c8d6[_0x993f('0x2f')][_0x993f('0x40')]?_0x16c8d6['attributes']:_0x4eb3fe[_0x993f('0x29')];if(_0x1193a6['query']['includeAll']){_0x16c8d6[_0x993f('0x3a')]=[{'all':!![]}];}_0x16c8d6=_[_0x993f('0x35')]({},_0x16c8d6,_0x1193a6['options']);return db[_0x993f('0x26')][_0x993f('0x41')](_0x16c8d6)[_0x993f('0x38')](handleEntityNotFound(_0x36a767,null))['then'](respondWithResult(_0x36a767,null))[_0x993f('0x3d')](handleError(_0x36a767,null));};exports[_0x993f('0x42')]=function(_0x271756,_0x4bd074){return db[_0x993f('0x26')][_0x993f('0x42')](_0x271756['body'],{})[_0x993f('0x38')](respondWithResult(_0x4bd074,0xc9))[_0x993f('0x3d')](handleError(_0x4bd074,null));};exports[_0x993f('0x43')]=function(_0x196c6b,_0x315aad){if(_0x196c6b['body']['id']){delete _0x196c6b[_0x993f('0x44')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x196c6b[_0x993f('0x3f')]['id']}})['then'](handleEntityNotFound(_0x315aad,null))[_0x993f('0x38')](saveUpdates(_0x196c6b[_0x993f('0x44')],null))[_0x993f('0x38')](respondWithResult(_0x315aad,null))[_0x993f('0x3d')](handleError(_0x315aad,null));};exports[_0x993f('0x21')]=function(_0x2879ed,_0x53bc54){return db['SquareDetailsReport']['find']({'where':{'id':_0x2879ed[_0x993f('0x3f')]['id']}})[_0x993f('0x38')](handleEntityNotFound(_0x53bc54,null))[_0x993f('0x38')](removeEntity(_0x53bc54,null))[_0x993f('0x3d')](handleError(_0x53bc54,null));};exports['describe']=function(_0x502d0b,_0x437341){return db[_0x993f('0x26')][_0x993f('0x45')]()[_0x993f('0x38')](respondWithResult(_0x437341,null))[_0x993f('0x3d')](handleError(_0x437341,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 5304c77..5db88ba 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 _0xf524=['../../config/environment','exports','define','SquareDetailsReport','report_square_details','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x3cc47c,_0x1e59e2){var _0x1fe90f=function(_0x1c024b){while(--_0x1c024b){_0x3cc47c['push'](_0x3cc47c['shift']());}};_0x1fe90f(++_0x1e59e2);}(_0xf524,0x14a));var _0x4f52=function(_0x1cbcb2,_0x1237a3){_0x1cbcb2=_0x1cbcb2-0x0;var _0x41ac9f=_0xf524[_0x1cbcb2];return _0x41ac9f;};'use strict';var _=require(_0x4f52('0x0'));var util=require('util');var logger=require(_0x4f52('0x1'))(_0x4f52('0x2'));var moment=require(_0x4f52('0x3'));var BPromise=require(_0x4f52('0x4'));var rp=require(_0x4f52('0x5'));var fs=require('fs');var path=require(_0x4f52('0x6'));var rimraf=require(_0x4f52('0x7'));var config=require(_0x4f52('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x4f52('0x9')]=function(_0x1a61a1,_0x45fbbd){return _0x1a61a1[_0x4f52('0xa')](_0x4f52('0xb'),attributes,{'tableName':_0x4f52('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x08af=['lodash','util','api','bluebird','request-promise','path','rimraf','define','SquareDetailsReport','report_square_details'];(function(_0x2ae8ce,_0x2a5a1f){var _0x4bf686=function(_0x41cabf){while(--_0x41cabf){_0x2ae8ce['push'](_0x2ae8ce['shift']());}};_0x4bf686(++_0x2a5a1f);}(_0x08af,0x1c2));var _0xf08a=function(_0x10b317,_0x2adf32){_0x10b317=_0x10b317-0x0;var _0x1e3054=_0x08af[_0x10b317];return _0x1e3054;};'use strict';var _=require(_0xf08a('0x0'));var util=require(_0xf08a('0x1'));var logger=require('../../config/logger')(_0xf08a('0x2'));var moment=require('moment');var BPromise=require(_0xf08a('0x3'));var rp=require(_0xf08a('0x4'));var fs=require('fs');var path=require(_0xf08a('0x5'));var rimraf=require(_0xf08a('0x6'));var config=require('../../config/environment');var attributes=require('./squareReportDetail.attributes');module['exports']=function(_0x14ab52,_0x1671bc){return _0x14ab52[_0xf08a('0x7')](_0xf08a('0x8'),attributes,{'tableName':_0xf08a('0x9'),'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 ba1a610..96ffc37 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 _0x6621=['info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','CreateSquareDetailsReport','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4bb2b9,_0x459c78){var _0x40e2a2=function(_0x19a26c){while(--_0x19a26c){_0x4bb2b9['push'](_0x4bb2b9['shift']());}};_0x40e2a2(++_0x459c78);}(_0x6621,0x13b));var _0x1662=function(_0x398d76,_0x525c04){_0x398d76=_0x398d76-0x0;var _0x521007=_0x6621[_0x398d76];return _0x521007;};'use strict';var _=require(_0x1662('0x0'));var util=require(_0x1662('0x1'));var moment=require(_0x1662('0x2'));var BPromise=require('bluebird');var rs=require(_0x1662('0x3'));var fs=require('fs');var Redis=require(_0x1662('0x4'));var db=require(_0x1662('0x5'))['db'];var utils=require(_0x1662('0x6'));var logger=require(_0x1662('0x7'))(_0x1662('0x8'));var config=require(_0x1662('0x9'));var jayson=require(_0x1662('0xa'));var client=jayson[_0x1662('0xb')][_0x1662('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc7e64f,_0x267fbe,_0x3e5947){return new BPromise(function(_0x37cb19,_0x46a9a2){return client[_0x1662('0xd')](_0xc7e64f,_0x3e5947)[_0x1662('0xe')](function(_0x556eaa){logger[_0x1662('0xf')](_0x1662('0x10'),_0x267fbe,_0x1662('0x11'));logger[_0x1662('0x12')]('SquareDetailsReport,\x20%s,\x20%s,\x20%s',_0x267fbe,_0x1662('0x11'),JSON[_0x1662('0x13')](_0x556eaa));if(_0x556eaa[_0x1662('0x14')]){if(_0x556eaa['error'][_0x1662('0x15')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x267fbe,_0x556eaa['error'][_0x1662('0x16')]);return _0x46a9a2(_0x556eaa[_0x1662('0x14')]['message']);}logger['error'](_0x1662('0x10'),_0x267fbe,_0x556eaa['error'][_0x1662('0x16')]);return _0x37cb19(_0x556eaa[_0x1662('0x14')][_0x1662('0x16')]);}else{logger[_0x1662('0xf')](_0x1662('0x10'),_0x267fbe,'request\x20sent');_0x37cb19(_0x556eaa[_0x1662('0x17')][_0x1662('0x16')]);}})[_0x1662('0x18')](function(_0x442b93){logger['error'](_0x1662('0x10'),_0x267fbe,_0x442b93);_0x46a9a2(_0x442b93);});});}exports[_0x1662('0x19')]=function(_0x1a6f5e){var _0x1ad410=this;return new Promise(function(_0x73da03,_0x177e77){return db['SquareDetailsReport'][_0x1662('0x1a')](_0x1a6f5e[_0x1662('0x1b')],{'raw':_0x1a6f5e[_0x1662('0x1c')]?_0x1a6f5e[_0x1662('0x1c')][_0x1662('0x1d')]===undefined?!![]:![]:!![]})[_0x1662('0xe')](function(_0x14acf0){logger[_0x1662('0xf')](_0x1662('0x19'),_0x1a6f5e);logger[_0x1662('0x12')](_0x1662('0x19'),_0x1a6f5e,JSON[_0x1662('0x13')](_0x14acf0));_0x73da03(_0x14acf0);})['catch'](function(_0x250010){logger['error'](_0x1662('0x19'),_0x250010[_0x1662('0x16')],_0x1a6f5e);_0x177e77(_0x1ad410[_0x1662('0x14')](0x1f4,_0x250010[_0x1662('0x16')]));});});}; \ No newline at end of file +var _0x4fbe=['then','CreateSquareDetailsReport','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','request','info','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SquareDetailsReport,\x20%s,\x20%s','result','catch','create','body','options','raw'];(function(_0x1babf4,_0x415dc1){var _0x569406=function(_0x396161){while(--_0x396161){_0x1babf4['push'](_0x1babf4['shift']());}};_0x569406(++_0x415dc1);}(_0x4fbe,0x1a2));var _0xe4fb=function(_0x5b20eb,_0x54dfaa){_0x5b20eb=_0x5b20eb-0x0;var _0x1c062d=_0x4fbe[_0x5b20eb];return _0x1c062d;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xe4fb('0x0'));var rs=require(_0xe4fb('0x1'));var fs=require('fs');var Redis=require(_0xe4fb('0x2'));var db=require(_0xe4fb('0x3'))['db'];var utils=require(_0xe4fb('0x4'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0xe4fb('0x5'));var client=jayson[_0xe4fb('0x6')][_0xe4fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37a9d0,_0x4662cc,_0x4b04f8){return new BPromise(function(_0x36d783,_0x42b359){return client[_0xe4fb('0x8')](_0x37a9d0,_0x4b04f8)['then'](function(_0x1bedb1){logger[_0xe4fb('0x9')]('SquareDetailsReport,\x20%s,\x20%s',_0x4662cc,_0xe4fb('0xa'));logger[_0xe4fb('0xb')](_0xe4fb('0xc'),_0x4662cc,_0xe4fb('0xa'),JSON[_0xe4fb('0xd')](_0x1bedb1));if(_0x1bedb1['error']){if(_0x1bedb1[_0xe4fb('0xe')][_0xe4fb('0xf')]===0x1f4){logger[_0xe4fb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x4662cc,_0x1bedb1[_0xe4fb('0xe')][_0xe4fb('0x10')]);return _0x42b359(_0x1bedb1[_0xe4fb('0xe')][_0xe4fb('0x10')]);}logger[_0xe4fb('0xe')](_0xe4fb('0x11'),_0x4662cc,_0x1bedb1[_0xe4fb('0xe')]['message']);return _0x36d783(_0x1bedb1[_0xe4fb('0xe')][_0xe4fb('0x10')]);}else{logger['info'](_0xe4fb('0x11'),_0x4662cc,'request\x20sent');_0x36d783(_0x1bedb1[_0xe4fb('0x12')][_0xe4fb('0x10')]);}})[_0xe4fb('0x13')](function(_0x2647c9){logger[_0xe4fb('0xe')]('SquareDetailsReport,\x20%s,\x20%s',_0x4662cc,_0x2647c9);_0x42b359(_0x2647c9);});});}exports['CreateSquareDetailsReport']=function(_0x3c0dcd){var _0x49c0af=this;return new Promise(function(_0x23484c,_0x1714b4){return db['SquareDetailsReport'][_0xe4fb('0x14')](_0x3c0dcd[_0xe4fb('0x15')],{'raw':_0x3c0dcd['options']?_0x3c0dcd[_0xe4fb('0x16')][_0xe4fb('0x17')]===undefined?!![]:![]:!![]})[_0xe4fb('0x18')](function(_0xf8ee33){logger['info'](_0xe4fb('0x19'),_0x3c0dcd);logger[_0xe4fb('0xb')](_0xe4fb('0x19'),_0x3c0dcd,JSON[_0xe4fb('0xd')](_0xf8ee33));_0x23484c(_0xf8ee33);})[_0xe4fb('0x13')](function(_0x1650fe){logger[_0xe4fb('0xe')](_0xe4fb('0x19'),_0x1650fe[_0xe4fb('0x10')],_0x3c0dcd);_0x1714b4(_0x49c0af['error'](0x1f4,_0x1650fe[_0xe4fb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e05bfba..6fb15c9 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 _0x5e22=['get','isAuthenticated','/process/:pid/kill','killProcess','exports','Router','./system.controller'];(function(_0x2d7a4b,_0xa36b04){var _0x603707=function(_0x498947){while(--_0x498947){_0x2d7a4b['push'](_0x2d7a4b['shift']());}};_0x603707(++_0xa36b04);}(_0x5e22,0x132));var _0x25e2=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0x5e22[_0x599e60];return _0x468e19;};'use strict';var express=require('express');var router=express[_0x25e2('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x25e2('0x1'));router[_0x25e2('0x2')]('/',auth[_0x25e2('0x3')](),controller['index']);router[_0x25e2('0x2')](_0x25e2('0x4'),auth[_0x25e2('0x3')](),controller[_0x25e2('0x5')]);module[_0x25e2('0x6')]=router; \ No newline at end of file +var _0x6c79=['../../components/auth/service','./system.controller','get','index','/process/:pid/kill','isAuthenticated','killProcess','exports','express','Router'];(function(_0x3ceeed,_0x213a9e){var _0x279112=function(_0x1616b3){while(--_0x1616b3){_0x3ceeed['push'](_0x3ceeed['shift']());}};_0x279112(++_0x213a9e);}(_0x6c79,0x184));var _0x96c7=function(_0x1e3b8c,_0x291f35){_0x1e3b8c=_0x1e3b8c-0x0;var _0x59c81e=_0x6c79[_0x1e3b8c];return _0x59c81e;};'use strict';var express=require(_0x96c7('0x0'));var router=express[_0x96c7('0x1')]();var auth=require(_0x96c7('0x2'));var controller=require(_0x96c7('0x3'));router[_0x96c7('0x4')]('/',auth['isAuthenticated'](),controller[_0x96c7('0x5')]);router['get'](_0x96c7('0x6'),auth[_0x96c7('0x7')](),controller[_0x96c7('0x8')]);module[_0x96c7('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 9838b08..3d203bd 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 _0xa958=['pid','then','split','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','systeminformation','child_process','exec','../../config/logger','api','bluebird','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','getAllData','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params'];(function(_0x1e4e22,_0x567aad){var _0x5a26ea=function(_0x1f9afd){while(--_0x1f9afd){_0x1e4e22['push'](_0x1e4e22['shift']());}};_0x5a26ea(++_0x567aad);}(_0xa958,0x116));var _0x8a95=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0xa958[_0x56482c];return _0x5aae7a;};'use strict';var info=require(_0x8a95('0x0'));var exec=require(_0x8a95('0x1'))[_0x8a95('0x2')];var logger=require(_0x8a95('0x3'))(_0x8a95('0x4'));var util=require('util');var BPromise=require(_0x8a95('0x5'));var _=require('lodash');function handleError(_0x380436,_0x36b3ae,_0x2411d3){_0x36b3ae=_0x36b3ae||0x1f4;return function(_0x304fb7){logger['error'](_0x8a95('0x6'),_0x2411d3,_0x36b3ae,util[_0x8a95('0x7')](_0x304fb7,{'showHidden':![],'depth':null}));delete _0x304fb7[_0x8a95('0x8')];_0x380436[_0x8a95('0x9')](_0x36b3ae)[_0x8a95('0xa')](_0x304fb7);};}exports['index']=function(_0x3b9d23,_0x2bbc1e){return info[_0x8a95('0xb')]()['then'](function(_0x20073b){return _0x2bbc1e[_0x8a95('0x9')](0xc8)[_0x8a95('0xc')](_0x20073b);})[_0x8a95('0xd')](function(_0x3f38f8){return _0x2bbc1e[_0x8a95('0x9')](0x1f4)[_0x8a95('0xc')](_0x3f38f8);});};exports[_0x8a95('0xe')]=function(_0x1efb5c,_0x26a36f){var _0x3429d9=[_0x8a95('0xf')];return new BPromise(function(_0x5e599f,_0x4bb348){return exec(util[_0x8a95('0x10')](_0x8a95('0x11'),_0x1efb5c[_0x8a95('0x12')][_0x8a95('0x13')]),function(_0x441457,_0x28db06,_0x588acd){if(_0x441457){return _0x4bb348(_0x441457);}return _0x5e599f(_0x28db06);});})[_0x8a95('0x14')](function(_0x2a4f97){var _0x304e0e=![];var _0x113691=_0x2a4f97[_0x8a95('0x15')](/\n/);for(var _0x239e27=0x0,_0x2335fa=_0x3429d9['length'];_0x239e27<_0x2335fa,_0x304e0e===![];_0x239e27+=0x1){if(_0x2a4f97[_0x8a95('0x16')](_0x3429d9[_0x239e27])>=0x0){_0x304e0e=!![];}}if(!_0x304e0e){throw new Error(util['format'](_0x8a95('0x17'),_0x1efb5c['params'][_0x8a95('0x13')]));}process[_0x8a95('0x18')](_0x1efb5c['params'][_0x8a95('0x13')],_0x8a95('0x19'));return _0x26a36f[_0x8a95('0x9')](0xc8)['json']({'message':util['format'](_0x8a95('0x1a'),_0x1efb5c[_0x8a95('0x12')][_0x8a95('0x13')])});})['catch'](handleError(_0x26a36f,null,'killProcess'));}; \ No newline at end of file +var _0xc040=['api','util','bluebird','lodash','error','inspect','name','send','index','then','status','catch','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','../../config/logger'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xc040,0xc6));var _0x0c04=function(_0x5dcf2d,_0x234849){_0x5dcf2d=_0x5dcf2d-0x0;var _0xaeb7c4=_0xc040[_0x5dcf2d];return _0xaeb7c4;};'use strict';var info=require('systeminformation');var exec=require(_0x0c04('0x0'))['exec'];var logger=require(_0x0c04('0x1'))(_0x0c04('0x2'));var util=require(_0x0c04('0x3'));var BPromise=require(_0x0c04('0x4'));var _=require(_0x0c04('0x5'));function handleError(_0x3c19c6,_0x131362,_0x48ebfe){_0x131362=_0x131362||0x1f4;return function(_0x1e7b18){logger[_0x0c04('0x6')]('<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s',_0x48ebfe,_0x131362,util[_0x0c04('0x7')](_0x1e7b18,{'showHidden':![],'depth':null}));delete _0x1e7b18[_0x0c04('0x8')];_0x3c19c6['status'](_0x131362)[_0x0c04('0x9')](_0x1e7b18);};}exports[_0x0c04('0xa')]=function(_0x143fb1,_0x5c150c){return info['getAllData']()[_0x0c04('0xb')](function(_0x1a08e2){return _0x5c150c[_0x0c04('0xc')](0xc8)['json'](_0x1a08e2);})[_0x0c04('0xd')](function(_0xa29bd6){return _0x5c150c[_0x0c04('0xc')](0x1f4)[_0x0c04('0xe')](_0xa29bd6);});};exports[_0x0c04('0xf')]=function(_0x5c9734,_0x648503){var _0x49ed0d=[_0x0c04('0x10')];return new BPromise(function(_0x1166b8,_0x4a2516){return exec(util[_0x0c04('0x11')](_0x0c04('0x12'),_0x5c9734[_0x0c04('0x13')][_0x0c04('0x14')]),function(_0x46e4a5,_0xdf0493,_0x3f86f1){if(_0x46e4a5){return _0x4a2516(_0x46e4a5);}return _0x1166b8(_0xdf0493);});})[_0x0c04('0xb')](function(_0x40e4b4){var _0x2037d8=![];var _0x284599=_0x40e4b4[_0x0c04('0x15')](/\n/);for(var _0x5a5cec=0x0,_0x228509=_0x49ed0d['length'];_0x5a5cec<_0x228509,_0x2037d8===![];_0x5a5cec+=0x1){if(_0x40e4b4['indexOf'](_0x49ed0d[_0x5a5cec])>=0x0){_0x2037d8=!![];}}if(!_0x2037d8){throw new Error(util['format'](_0x0c04('0x16'),_0x5c9734[_0x0c04('0x13')][_0x0c04('0x14')]));}process[_0x0c04('0x17')](_0x5c9734[_0x0c04('0x13')][_0x0c04('0x14')],'SIGINT');return _0x648503[_0x0c04('0xc')](0xc8)[_0x0c04('0xe')]({'message':util[_0x0c04('0x11')](_0x0c04('0x18'),_0x5c9734[_0x0c04('0x13')][_0x0c04('0x14')])});})[_0x0c04('0xd')](handleError(_0x648503,null,_0x0c04('0xf')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 4048119..be86288 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 _0x2dae=['put','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./tag.controller','get','isAuthenticated','/:id','show','post','create'];(function(_0x30feae,_0x63bf96){var _0x3975d4=function(_0x38dff9){while(--_0x38dff9){_0x30feae['push'](_0x30feae['shift']());}};_0x3975d4(++_0x63bf96);}(_0x2dae,0xc3));var _0xe2da=function(_0x34b87f,_0x28aef2){_0x34b87f=_0x34b87f-0x0;var _0x449805=_0x2dae[_0x34b87f];return _0x449805;};'use strict';var multer=require(_0xe2da('0x0'));var util=require('util');var path=require(_0xe2da('0x1'));var timeout=require(_0xe2da('0x2'));var express=require(_0xe2da('0x3'));var router=express[_0xe2da('0x4')]();var auth=require(_0xe2da('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xe2da('0x6'));var controller=require(_0xe2da('0x7'));router[_0xe2da('0x8')]('/',auth[_0xe2da('0x9')](),controller['index']);router[_0xe2da('0x8')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0xb')]);router[_0xe2da('0xc')]('/',auth[_0xe2da('0x9')](),controller[_0xe2da('0xd')]);router[_0xe2da('0xe')](_0xe2da('0xa'),auth['isAuthenticated'](),controller[_0xe2da('0xf')]);router[_0xe2da('0x10')](_0xe2da('0xa'),auth[_0xe2da('0x9')](),controller[_0xe2da('0x11')]);module[_0xe2da('0x12')]=router; \ No newline at end of file +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(_0x43071a,_0x3602bc){_0x43071a=_0x43071a-0x0;var _0x236389=_0x55e0[_0x43071a];return _0x236389;};'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 diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 459d7ce..c38548c 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 _0x878f=['STRING','name','#0091EA','exports'];(function(_0x5b7937,_0x1aa516){var _0x2c2d57=function(_0x1fd4b2){while(--_0x1fd4b2){_0x5b7937['push'](_0x5b7937['shift']());}};_0x2c2d57(++_0x1aa516);}(_0x878f,0x173));var _0xf878=function(_0x27c8ad,_0x173106){_0x27c8ad=_0x27c8ad-0x0;var _0x2ad205=_0x878f[_0x27c8ad];return _0x2ad205;};'use strict';var Sequelize=require('sequelize');module[_0xf878('0x0')]={'name':{'type':Sequelize[_0xf878('0x1')],'unique':_0xf878('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xf878('0x1')],'defaultValue':_0xf878('0x3')},'description':{'type':Sequelize[_0xf878('0x1')]}}; \ No newline at end of file +var _0xd7d1=['sequelize','exports','STRING','name','#0091EA'];(function(_0x75aecb,_0x3007da){var _0x240b42=function(_0x4d1729){while(--_0x4d1729){_0x75aecb['push'](_0x75aecb['shift']());}};_0x240b42(++_0x3007da);}(_0xd7d1,0x1b3));var _0x1d7d=function(_0x2cf5c5,_0x3e3532){_0x2cf5c5=_0x2cf5c5-0x0;var _0x1b0389=_0xd7d1[_0x2cf5c5];return _0x1b0389;};'use strict';var Sequelize=require(_0x1d7d('0x0'));module[_0x1d7d('0x1')]={'name':{'type':Sequelize[_0x1d7d('0x2')],'unique':_0x1d7d('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x1d7d('0x2')],'defaultValue':_0x1d7d('0x4')},'description':{'type':Sequelize[_0x1d7d('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 18c9671..5174f1f 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 _0x34ff=['merge','VIRTUAL','options','includeAll','include','findAll','catch','show','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','update','params','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','Tags','UserProfileResource','sendStatus','error','stack','name','send','Tag','rawAttributes','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter'];(function(_0x584291,_0x24b5b3){var _0x4e7d08=function(_0x59e0b1){while(--_0x59e0b1){_0x584291['push'](_0x584291['shift']());}};_0x4e7d08(++_0x24b5b3);}(_0x34ff,0x158));var _0xf34f=function(_0x402e9a,_0xd2f9a){_0x402e9a=_0x402e9a-0x0;var _0xc624d4=_0x34ff[_0x402e9a];return _0xc624d4;};'use strict';var pdf=require(_0xf34f('0x0'));var emlformat=require(_0xf34f('0x1'));var rimraf=require(_0xf34f('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf34f('0x3'));var rp=require(_0xf34f('0x4'));var moment=require(_0xf34f('0x5'));var BPromise=require(_0xf34f('0x6'));var Mustache=require('mustache');var util=require(_0xf34f('0x7'));var path=require(_0xf34f('0x8'));var sox=require(_0xf34f('0x9'));var csv=require(_0xf34f('0xa'));var ejs=require(_0xf34f('0xb'));var fs=require('fs');var _=require(_0xf34f('0xc'));var squel=require(_0xf34f('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf34f('0xe'));var Papa=require('papaparse');var Redis=require(_0xf34f('0xf'));var authService=require(_0xf34f('0x10'));var qs=require(_0xf34f('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf34f('0x12'));var logger=require('../../config/logger')(_0xf34f('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x52ae67,_0x5a60f8){_0x5a60f8=_0x5a60f8||0xcc;return function(_0x20ab0e){if(_0x20ab0e){return _0x52ae67['sendStatus'](_0x5a60f8);}return _0x52ae67[_0xf34f('0x14')](_0x5a60f8)[_0xf34f('0x15')]();};}function respondWithResult(_0x59a492,_0x4a0829){_0x4a0829=_0x4a0829||0xc8;return function(_0x3e6856){if(_0x3e6856){return _0x59a492[_0xf34f('0x14')](_0x4a0829)[_0xf34f('0x16')](_0x3e6856);}};}function respondWithFilteredResult(_0x5b2cab,_0x4fdbe8){return function(_0x4ec70e){if(_0x4ec70e){var _0x97207c=_0x4ec70e[_0xf34f('0x17')],_0x25a3c6=_0x4fdbe8[_0xf34f('0x18')],_0xcaf12e=_0x4fdbe8[_0xf34f('0x18')]+_0x4fdbe8['limit'],_0xa2b79a;if(_0xcaf12e>=_0x97207c){_0xcaf12e=_0x97207c;_0xa2b79a=0xc8;}else{_0xa2b79a=0xce;}_0x5b2cab['status'](_0xa2b79a);return _0x5b2cab[_0xf34f('0x19')](_0xf34f('0x1a'),_0x25a3c6+'-'+_0xcaf12e+'/'+_0x97207c)['json'](_0x4ec70e);}return null;};}function patchUpdates(_0x57ddc8){return function(_0x5f2175){try{jsonpatch[_0xf34f('0x1b')](_0x5f2175,_0x57ddc8,!![]);}catch(_0x274b7c){return BPromise[_0xf34f('0x1c')](_0x274b7c);}return _0x5f2175[_0xf34f('0x1d')]();};}function saveUpdates(_0x5cdc7b,_0x2b7714){return function(_0xa22344){if(_0xa22344){return _0xa22344['update'](_0x5cdc7b)[_0xf34f('0x1e')](function(_0x266ab5){return _0x266ab5;});}return null;};}function removeEntity(_0x301b5f,_0x27310e){return function(_0x3992bc){if(_0x3992bc){return _0x3992bc[_0xf34f('0x1f')]()[_0xf34f('0x1e')](function(){var _0x400ae2=_0x3992bc[_0xf34f('0x20')]({'plain':!![]});var _0x55e5bd=_0xf34f('0x21');return db[_0xf34f('0x22')][_0xf34f('0x1f')]({'where':{'type':_0x55e5bd,'resourceId':_0x400ae2['id']}})[_0xf34f('0x1e')](function(){return _0x3992bc;});})[_0xf34f('0x1e')](function(){_0x301b5f[_0xf34f('0x14')](0xcc)[_0xf34f('0x15')]();});}};}function handleEntityNotFound(_0x112006,_0x4e0c68){return function(_0x3af09b){if(!_0x3af09b){_0x112006[_0xf34f('0x23')](0x194);}return _0x3af09b;};}function handleError(_0xb29c59,_0x38cefe){_0x38cefe=_0x38cefe||0x1f4;return function(_0x12bbbb){logger[_0xf34f('0x24')](_0x12bbbb[_0xf34f('0x25')]);if(_0x12bbbb[_0xf34f('0x26')]){delete _0x12bbbb[_0xf34f('0x26')];}_0xb29c59[_0xf34f('0x14')](_0x38cefe)[_0xf34f('0x27')](_0x12bbbb);};}exports['index']=function(_0x354bad,_0x2304bd){var _0x1f9e9a={},_0x18f304={},_0x5268e8={'count':0x0,'rows':[]};var _0x2ae690=_['map'](db[_0xf34f('0x28')][_0xf34f('0x29')],function(_0x5e0614){return{'name':_0x5e0614['fieldName'],'type':_0x5e0614[_0xf34f('0x2a')][_0xf34f('0x2b')]};});_0x18f304[_0xf34f('0x2c')]=_[_0xf34f('0x2d')](_0x2ae690,_0xf34f('0x26'));_0x18f304['query']=_[_0xf34f('0x2e')](_0x354bad[_0xf34f('0x2f')]);_0x18f304[_0xf34f('0x30')]=_[_0xf34f('0x31')](_0x18f304[_0xf34f('0x2c')],_0x18f304['query']);_0x1f9e9a[_0xf34f('0x32')]=_[_0xf34f('0x31')](_0x18f304[_0xf34f('0x2c')],qs[_0xf34f('0x33')](_0x354bad[_0xf34f('0x2f')]['fields']));_0x1f9e9a[_0xf34f('0x32')]=_0x1f9e9a['attributes'][_0xf34f('0x34')]?_0x1f9e9a[_0xf34f('0x32')]:_0x18f304['model'];if(!_0x354bad[_0xf34f('0x2f')][_0xf34f('0x35')](_0xf34f('0x36'))){_0x1f9e9a['limit']=qs[_0xf34f('0x37')](_0x354bad[_0xf34f('0x2f')][_0xf34f('0x37')]);_0x1f9e9a['offset']=qs[_0xf34f('0x18')](_0x354bad[_0xf34f('0x2f')]['offset']);}_0x1f9e9a[_0xf34f('0x38')]=qs[_0xf34f('0x39')](_0x354bad['query'][_0xf34f('0x39')]);_0x1f9e9a[_0xf34f('0x3a')]=qs['filters'](_[_0xf34f('0x3b')](_0x354bad[_0xf34f('0x2f')],_0x18f304[_0xf34f('0x30')]));if(_0x354bad[_0xf34f('0x2f')][_0xf34f('0x3c')]){_0x1f9e9a[_0xf34f('0x3a')]=_[_0xf34f('0x3d')](_0x1f9e9a[_0xf34f('0x3a')],{'$or':_['map'](_0x2ae690,function(_0x169f03){if(_0x169f03[_0xf34f('0x2a')]!==_0xf34f('0x3e')){var _0x7e76f7={};_0x7e76f7[_0x169f03[_0xf34f('0x26')]]={'$like':'%'+_0x354bad['query'][_0xf34f('0x3c')]+'%'};return _0x7e76f7;}})});}_0x1f9e9a=_[_0xf34f('0x3d')]({},_0x1f9e9a,_0x354bad[_0xf34f('0x3f')]);var _0x1302ba={'where':_0x1f9e9a[_0xf34f('0x3a')]};return db['Tag']['count'](_0x1302ba)[_0xf34f('0x1e')](function(_0xdfb7fc){_0x5268e8[_0xf34f('0x17')]=_0xdfb7fc;if(_0x354bad[_0xf34f('0x2f')][_0xf34f('0x40')]){_0x1f9e9a[_0xf34f('0x41')]=[{'all':!![]}];}return db['Tag'][_0xf34f('0x42')](_0x1f9e9a);})['then'](function(_0x1f0ca3){_0x5268e8['rows']=_0x1f0ca3;return _0x5268e8;})[_0xf34f('0x1e')](respondWithFilteredResult(_0x2304bd,_0x1f9e9a))[_0xf34f('0x43')](handleError(_0x2304bd,null));};exports[_0xf34f('0x44')]=function(_0x2f4df9,_0x22fed6){var _0x24e418={'raw':!![],'where':{'id':_0x2f4df9['params']['id']}},_0x309eaa={};_0x309eaa[_0xf34f('0x2c')]=_[_0xf34f('0x2e')](db[_0xf34f('0x28')]['rawAttributes']);_0x309eaa[_0xf34f('0x2f')]=_[_0xf34f('0x2e')](_0x2f4df9['query']);_0x309eaa[_0xf34f('0x30')]=_['intersection'](_0x309eaa[_0xf34f('0x2c')],_0x309eaa[_0xf34f('0x2f')]);_0x24e418[_0xf34f('0x32')]=_[_0xf34f('0x31')](_0x309eaa[_0xf34f('0x2c')],qs[_0xf34f('0x33')](_0x2f4df9[_0xf34f('0x2f')][_0xf34f('0x33')]));_0x24e418[_0xf34f('0x32')]=_0x24e418[_0xf34f('0x32')]['length']?_0x24e418['attributes']:_0x309eaa[_0xf34f('0x2c')];if(_0x2f4df9['query'][_0xf34f('0x40')]){_0x24e418[_0xf34f('0x41')]=[{'all':!![]}];}_0x24e418=_[_0xf34f('0x3d')]({},_0x24e418,_0x2f4df9[_0xf34f('0x3f')]);return db[_0xf34f('0x28')][_0xf34f('0x45')](_0x24e418)[_0xf34f('0x1e')](handleEntityNotFound(_0x22fed6,null))[_0xf34f('0x1e')](respondWithResult(_0x22fed6,null))[_0xf34f('0x43')](handleError(_0x22fed6,null));};exports[_0xf34f('0x46')]=function(_0x32e4ce,_0x36bd16){return db['Tag'][_0xf34f('0x46')](_0x32e4ce[_0xf34f('0x47')],{})[_0xf34f('0x1e')](function(_0x188e55){var _0x3f8a6f=_0x32e4ce[_0xf34f('0x48')][_0xf34f('0x20')]({'plain':!![]});if(!_0x3f8a6f)throw new Error(_0xf34f('0x49'));if(_0x3f8a6f[_0xf34f('0x4a')]==='user'){var _0x4f88bb=_0x188e55['get']({'plain':!![]});var _0x53296a=_0xf34f('0x21');return db[_0xf34f('0x4b')][_0xf34f('0x45')]({'where':{'name':_0x53296a,'userProfileId':_0x3f8a6f[_0xf34f('0x4c')]},'raw':!![]})[_0xf34f('0x1e')](function(_0x3f7544){if(_0x3f7544&&_0x3f7544[_0xf34f('0x4d')]===0x0){return db['UserProfileResource'][_0xf34f('0x46')]({'name':_0x4f88bb[_0xf34f('0x26')],'resourceId':_0x4f88bb['id'],'type':_0x3f7544['name'],'sectionId':_0x3f7544['id']},{})[_0xf34f('0x1e')](function(){return _0x188e55;});}else{return _0x188e55;}})[_0xf34f('0x43')](function(_0x11b269){logger['error'](_0xf34f('0x4e'),_0x11b269);throw _0x11b269;});}return _0x188e55;})[_0xf34f('0x1e')](respondWithResult(_0x36bd16,0xc9))[_0xf34f('0x43')](handleError(_0x36bd16,null));};exports[_0xf34f('0x4f')]=function(_0x4b7423,_0x1f104d){if(_0x4b7423['body']['id']){delete _0x4b7423[_0xf34f('0x47')]['id'];}return db[_0xf34f('0x28')]['find']({'where':{'id':_0x4b7423[_0xf34f('0x50')]['id']}})[_0xf34f('0x1e')](handleEntityNotFound(_0x1f104d,null))['then'](saveUpdates(_0x4b7423[_0xf34f('0x47')],null))[_0xf34f('0x1e')](respondWithResult(_0x1f104d,null))[_0xf34f('0x43')](handleError(_0x1f104d,null));};exports[_0xf34f('0x1f')]=function(_0x5bd180,_0x262904){return db['Tag'][_0xf34f('0x45')]({'where':{'id':_0x5bd180[_0xf34f('0x50')]['id']}})[_0xf34f('0x1e')](handleEntityNotFound(_0x262904,null))[_0xf34f('0x1e')](removeEntity(_0x262904,null))[_0xf34f('0x43')](handleError(_0x262904,null));}; \ No newline at end of file +var _0xbc44=['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','../../config/utils','../../mysqldb','end','status','json','count','offset','limit','set','Content-Range','update','destroy','then','Tags','UserProfileResource','sendStatus','error','stack','name','send','index','Tag','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','nolimit','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','length','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','html-pdf','eml-format','rimraf','request-promise','moment','mustache'];(function(_0xdda192,_0x333354){var _0x4b320a=function(_0x2587bd){while(--_0x2587bd){_0xdda192['push'](_0xdda192['shift']());}};_0x4b320a(++_0x333354);}(_0xbc44,0x142));var _0x4bc4=function(_0x4bb0d4,_0x52c88f){_0x4bb0d4=_0x4bb0d4-0x0;var _0x3fd954=_0xbc44[_0x4bb0d4];return _0x3fd954;};'use strict';var pdf=require(_0x4bc4('0x0'));var emlformat=require(_0x4bc4('0x1'));var rimraf=require(_0x4bc4('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4bc4('0x3'));var moment=require(_0x4bc4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4bc4('0x5'));var util=require(_0x4bc4('0x6'));var path=require(_0x4bc4('0x7'));var sox=require('sox');var csv=require(_0x4bc4('0x8'));var ejs=require(_0x4bc4('0x9'));var fs=require('fs');var _=require(_0x4bc4('0xa'));var squel=require(_0x4bc4('0xb'));var crypto=require(_0x4bc4('0xc'));var jsforce=require(_0x4bc4('0xd'));var deskjs=require(_0x4bc4('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4bc4('0xf'));var Papa=require(_0x4bc4('0x10'));var Redis=require(_0x4bc4('0x11'));var authService=require(_0x4bc4('0x12'));var qs=require(_0x4bc4('0x13'));var as=require(_0x4bc4('0x14'));var hardwareService=require(_0x4bc4('0x15'));var logger=require(_0x4bc4('0x16'))('api');var utils=require(_0x4bc4('0x17'));var config=require('../../config/environment');var db=require(_0x4bc4('0x18'))['db'];function respondWithStatusCode(_0x4a57c5,_0x4a1ead){_0x4a1ead=_0x4a1ead||0xcc;return function(_0x2c0bdd){if(_0x2c0bdd){return _0x4a57c5['sendStatus'](_0x4a1ead);}return _0x4a57c5['status'](_0x4a1ead)[_0x4bc4('0x19')]();};}function respondWithResult(_0x81a083,_0x45e776){_0x45e776=_0x45e776||0xc8;return function(_0x97573){if(_0x97573){return _0x81a083[_0x4bc4('0x1a')](_0x45e776)[_0x4bc4('0x1b')](_0x97573);}};}function respondWithFilteredResult(_0x2f72ae,_0x4eb8e0){return function(_0x47eb1f){if(_0x47eb1f){var _0x3ea840=_0x47eb1f[_0x4bc4('0x1c')],_0x67cfac=_0x4eb8e0[_0x4bc4('0x1d')],_0x3f2db8=_0x4eb8e0[_0x4bc4('0x1d')]+_0x4eb8e0[_0x4bc4('0x1e')],_0x13b6e0;if(_0x3f2db8>=_0x3ea840){_0x3f2db8=_0x3ea840;_0x13b6e0=0xc8;}else{_0x13b6e0=0xce;}_0x2f72ae[_0x4bc4('0x1a')](_0x13b6e0);return _0x2f72ae[_0x4bc4('0x1f')](_0x4bc4('0x20'),_0x67cfac+'-'+_0x3f2db8+'/'+_0x3ea840)[_0x4bc4('0x1b')](_0x47eb1f);}return null;};}function patchUpdates(_0x205256){return function(_0x167b17){try{jsonpatch['apply'](_0x167b17,_0x205256,!![]);}catch(_0x22c651){return BPromise['reject'](_0x22c651);}return _0x167b17['save']();};}function saveUpdates(_0x3211d7,_0x34b7c6){return function(_0x40dfe8){if(_0x40dfe8){return _0x40dfe8[_0x4bc4('0x21')](_0x3211d7)['then'](function(_0x1ed860){return _0x1ed860;});}return null;};}function removeEntity(_0x33f208,_0x8b4f96){return function(_0x45a284){if(_0x45a284){return _0x45a284[_0x4bc4('0x22')]()[_0x4bc4('0x23')](function(){var _0x4daf9b=_0x45a284['get']({'plain':!![]});var _0x526beb=_0x4bc4('0x24');return db[_0x4bc4('0x25')][_0x4bc4('0x22')]({'where':{'type':_0x526beb,'resourceId':_0x4daf9b['id']}})[_0x4bc4('0x23')](function(){return _0x45a284;});})[_0x4bc4('0x23')](function(){_0x33f208['status'](0xcc)[_0x4bc4('0x19')]();});}};}function handleEntityNotFound(_0x2e292e,_0x326b82){return function(_0x449fdf){if(!_0x449fdf){_0x2e292e[_0x4bc4('0x26')](0x194);}return _0x449fdf;};}function handleError(_0x2aa61e,_0x203e9f){_0x203e9f=_0x203e9f||0x1f4;return function(_0x44aaf9){logger[_0x4bc4('0x27')](_0x44aaf9[_0x4bc4('0x28')]);if(_0x44aaf9[_0x4bc4('0x29')]){delete _0x44aaf9[_0x4bc4('0x29')];}_0x2aa61e['status'](_0x203e9f)[_0x4bc4('0x2a')](_0x44aaf9);};}exports[_0x4bc4('0x2b')]=function(_0x530520,_0x12596a){var _0x21a879={},_0xb7d7a1={},_0x207bef={'count':0x0,'rows':[]};var _0x72b6f0=_['map'](db[_0x4bc4('0x2c')][_0x4bc4('0x2d')],function(_0x59999f){return{'name':_0x59999f[_0x4bc4('0x2e')],'type':_0x59999f[_0x4bc4('0x2f')][_0x4bc4('0x30')]};});_0xb7d7a1[_0x4bc4('0x31')]=_[_0x4bc4('0x32')](_0x72b6f0,_0x4bc4('0x29'));_0xb7d7a1['query']=_[_0x4bc4('0x33')](_0x530520[_0x4bc4('0x34')]);_0xb7d7a1[_0x4bc4('0x35')]=_[_0x4bc4('0x36')](_0xb7d7a1[_0x4bc4('0x31')],_0xb7d7a1[_0x4bc4('0x34')]);_0x21a879['attributes']=_[_0x4bc4('0x36')](_0xb7d7a1[_0x4bc4('0x31')],qs[_0x4bc4('0x37')](_0x530520[_0x4bc4('0x34')][_0x4bc4('0x37')]));_0x21a879[_0x4bc4('0x38')]=_0x21a879[_0x4bc4('0x38')]['length']?_0x21a879[_0x4bc4('0x38')]:_0xb7d7a1[_0x4bc4('0x31')];if(!_0x530520[_0x4bc4('0x34')][_0x4bc4('0x39')](_0x4bc4('0x3a'))){_0x21a879[_0x4bc4('0x1e')]=qs['limit'](_0x530520[_0x4bc4('0x34')][_0x4bc4('0x1e')]);_0x21a879[_0x4bc4('0x1d')]=qs[_0x4bc4('0x1d')](_0x530520[_0x4bc4('0x34')][_0x4bc4('0x1d')]);}_0x21a879['order']=qs['sort'](_0x530520[_0x4bc4('0x34')]['sort']);_0x21a879[_0x4bc4('0x3b')]=qs[_0x4bc4('0x35')](_['pick'](_0x530520['query'],_0xb7d7a1[_0x4bc4('0x35')]));if(_0x530520[_0x4bc4('0x34')][_0x4bc4('0x3c')]){_0x21a879[_0x4bc4('0x3b')]=_[_0x4bc4('0x3d')](_0x21a879[_0x4bc4('0x3b')],{'$or':_[_0x4bc4('0x32')](_0x72b6f0,function(_0x3f70a5){if(_0x3f70a5[_0x4bc4('0x2f')]!==_0x4bc4('0x3e')){var _0x212a81={};_0x212a81[_0x3f70a5[_0x4bc4('0x29')]]={'$like':'%'+_0x530520['query'][_0x4bc4('0x3c')]+'%'};return _0x212a81;}})});}_0x21a879=_['merge']({},_0x21a879,_0x530520[_0x4bc4('0x3f')]);var _0x3ff5eb={'where':_0x21a879[_0x4bc4('0x3b')]};return db[_0x4bc4('0x2c')]['count'](_0x3ff5eb)['then'](function(_0xbb03f4){_0x207bef[_0x4bc4('0x1c')]=_0xbb03f4;if(_0x530520['query'][_0x4bc4('0x40')]){_0x21a879[_0x4bc4('0x41')]=[{'all':!![]}];}return db[_0x4bc4('0x2c')][_0x4bc4('0x42')](_0x21a879);})[_0x4bc4('0x23')](function(_0x5b717f){_0x207bef[_0x4bc4('0x43')]=_0x5b717f;return _0x207bef;})['then'](respondWithFilteredResult(_0x12596a,_0x21a879))[_0x4bc4('0x44')](handleError(_0x12596a,null));};exports['show']=function(_0x19dd58,_0x5f5c84){var _0x519e7e={'raw':!![],'where':{'id':_0x19dd58[_0x4bc4('0x45')]['id']}},_0x5b5674={};_0x5b5674[_0x4bc4('0x31')]=_[_0x4bc4('0x33')](db[_0x4bc4('0x2c')]['rawAttributes']);_0x5b5674[_0x4bc4('0x34')]=_[_0x4bc4('0x33')](_0x19dd58[_0x4bc4('0x34')]);_0x5b5674[_0x4bc4('0x35')]=_[_0x4bc4('0x36')](_0x5b5674[_0x4bc4('0x31')],_0x5b5674[_0x4bc4('0x34')]);_0x519e7e[_0x4bc4('0x38')]=_[_0x4bc4('0x36')](_0x5b5674['model'],qs[_0x4bc4('0x37')](_0x19dd58['query']['fields']));_0x519e7e[_0x4bc4('0x38')]=_0x519e7e[_0x4bc4('0x38')][_0x4bc4('0x46')]?_0x519e7e['attributes']:_0x5b5674['model'];if(_0x19dd58[_0x4bc4('0x34')][_0x4bc4('0x40')]){_0x519e7e['include']=[{'all':!![]}];}_0x519e7e=_['merge']({},_0x519e7e,_0x19dd58[_0x4bc4('0x3f')]);return db[_0x4bc4('0x2c')][_0x4bc4('0x47')](_0x519e7e)[_0x4bc4('0x23')](handleEntityNotFound(_0x5f5c84,null))['then'](respondWithResult(_0x5f5c84,null))['catch'](handleError(_0x5f5c84,null));};exports[_0x4bc4('0x48')]=function(_0x4686a7,_0x5f1504){return db[_0x4bc4('0x2c')][_0x4bc4('0x48')](_0x4686a7[_0x4bc4('0x49')],{})['then'](function(_0x4f1fb6){var _0x4f2cb1=_0x4686a7[_0x4bc4('0x4a')][_0x4bc4('0x4b')]({'plain':!![]});if(!_0x4f2cb1)throw new Error(_0x4bc4('0x4c'));if(_0x4f2cb1[_0x4bc4('0x4d')]===_0x4bc4('0x4a')){var _0x5ab523=_0x4f1fb6[_0x4bc4('0x4b')]({'plain':!![]});var _0x544cfc=_0x4bc4('0x24');return db[_0x4bc4('0x4e')]['find']({'where':{'name':_0x544cfc,'userProfileId':_0x4f2cb1[_0x4bc4('0x4f')]},'raw':!![]})[_0x4bc4('0x23')](function(_0x39939f){if(_0x39939f&&_0x39939f[_0x4bc4('0x50')]===0x0){return db[_0x4bc4('0x25')][_0x4bc4('0x48')]({'name':_0x5ab523[_0x4bc4('0x29')],'resourceId':_0x5ab523['id'],'type':_0x39939f['name'],'sectionId':_0x39939f['id']},{})[_0x4bc4('0x23')](function(){return _0x4f1fb6;});}else{return _0x4f1fb6;}})[_0x4bc4('0x44')](function(_0x399133){logger[_0x4bc4('0x27')](_0x4bc4('0x51'),_0x399133);throw _0x399133;});}return _0x4f1fb6;})[_0x4bc4('0x23')](respondWithResult(_0x5f1504,0xc9))[_0x4bc4('0x44')](handleError(_0x5f1504,null));};exports[_0x4bc4('0x21')]=function(_0x4f45a1,_0x309e60){if(_0x4f45a1['body']['id']){delete _0x4f45a1['body']['id'];}return db['Tag'][_0x4bc4('0x47')]({'where':{'id':_0x4f45a1[_0x4bc4('0x45')]['id']}})[_0x4bc4('0x23')](handleEntityNotFound(_0x309e60,null))[_0x4bc4('0x23')](saveUpdates(_0x4f45a1[_0x4bc4('0x49')],null))[_0x4bc4('0x23')](respondWithResult(_0x309e60,null))['catch'](handleError(_0x309e60,null));};exports[_0x4bc4('0x22')]=function(_0x157257,_0x11025a){return db[_0x4bc4('0x2c')][_0x4bc4('0x47')]({'where':{'id':_0x157257[_0x4bc4('0x45')]['id']}})[_0x4bc4('0x23')](handleEntityNotFound(_0x11025a,null))[_0x4bc4('0x23')](removeEntity(_0x11025a,null))['catch'](handleError(_0x11025a,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index 555de00..865f2c0 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 _0x04b0=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./tag.attributes','exports','Tag','tools_tags','util','../../config/logger','api'];(function(_0x462080,_0x5bcf80){var _0x135fc6=function(_0x11cd74){while(--_0x11cd74){_0x462080['push'](_0x462080['shift']());}};_0x135fc6(++_0x5bcf80);}(_0x04b0,0x7f));var _0x004b=function(_0x23fe5f,_0x4a6e0b){_0x23fe5f=_0x23fe5f-0x0;var _0x2300cf=_0x04b0[_0x23fe5f];return _0x2300cf;};'use strict';var _=require('lodash');var util=require(_0x004b('0x0'));var logger=require(_0x004b('0x1'))(_0x004b('0x2'));var moment=require(_0x004b('0x3'));var BPromise=require(_0x004b('0x4'));var rp=require(_0x004b('0x5'));var fs=require('fs');var path=require(_0x004b('0x6'));var rimraf=require(_0x004b('0x7'));var config=require(_0x004b('0x8'));var attributes=require(_0x004b('0x9'));module[_0x004b('0xa')]=function(_0x5d6f1f,_0x5b17a5){return _0x5d6f1f['define'](_0x004b('0xb'),attributes,{'tableName':_0x004b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34ed=['define','tools_tags','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./tag.attributes','exports'];(function(_0x2ae11f,_0x5af16d){var _0x3b3b15=function(_0x38c667){while(--_0x38c667){_0x2ae11f['push'](_0x2ae11f['shift']());}};_0x3b3b15(++_0x5af16d);}(_0x34ed,0x124));var _0xd34e=function(_0x3a9083,_0x3c9f8d){_0x3a9083=_0x3a9083-0x0;var _0x160306=_0x34ed[_0x3a9083];return _0x160306;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xd34e('0x0'))(_0xd34e('0x1'));var moment=require(_0xd34e('0x2'));var BPromise=require(_0xd34e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd34e('0x4'));var config=require(_0xd34e('0x5'));var attributes=require(_0xd34e('0x6'));module[_0xd34e('0x7')]=function(_0x578370,_0x15ea2c){return _0x578370[_0xd34e('0x8')]('Tag',attributes,{'tableName':_0xd34e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/tag/tag.rpc.js b/server/api/tag/tag.rpc.js index 1c8cdea..f692a00 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 _0x6f7a=['http','request','then','info','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','Tag,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x49e52e,_0x15f616){var _0x36a6e6=function(_0x2f7be2){while(--_0x2f7be2){_0x49e52e['push'](_0x49e52e['shift']());}};_0x36a6e6(++_0x15f616);}(_0x6f7a,0x1ae));var _0xa6f7=function(_0x202e99,_0x5982f6){_0x202e99=_0x202e99-0x0;var _0x452c42=_0x6f7a[_0x202e99];return _0x452c42;};'use strict';var _=require(_0xa6f7('0x0'));var util=require(_0xa6f7('0x1'));var moment=require(_0xa6f7('0x2'));var BPromise=require(_0xa6f7('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa6f7('0x4'));var db=require(_0xa6f7('0x5'))['db'];var utils=require(_0xa6f7('0x6'));var logger=require(_0xa6f7('0x7'))(_0xa6f7('0x8'));var config=require(_0xa6f7('0x9'));var jayson=require(_0xa6f7('0xa'));var client=jayson[_0xa6f7('0xb')][_0xa6f7('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x335aaa,_0x1a06d1,_0x481a8c){return new BPromise(function(_0x4b4f9e,_0x30f2a7){return client[_0xa6f7('0xd')](_0x335aaa,_0x481a8c)[_0xa6f7('0xe')](function(_0x362404){logger[_0xa6f7('0xf')]('Tag,\x20%s,\x20%s',_0x1a06d1,'request\x20sent');logger[_0xa6f7('0x10')](_0xa6f7('0x11'),_0x1a06d1,'request\x20sent',JSON[_0xa6f7('0x12')](_0x362404));if(_0x362404['error']){if(_0x362404[_0xa6f7('0x13')][_0xa6f7('0x14')]===0x1f4){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x30f2a7(_0x362404['error'][_0xa6f7('0x16')]);}logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x362404['error'][_0xa6f7('0x16')]);return _0x4b4f9e(_0x362404['error'][_0xa6f7('0x16')]);}else{logger['info'](_0xa6f7('0x15'),_0x1a06d1,_0xa6f7('0x17'));_0x4b4f9e(_0x362404[_0xa6f7('0x18')]['message']);}})[_0xa6f7('0x19')](function(_0x22635e){logger[_0xa6f7('0x13')](_0xa6f7('0x15'),_0x1a06d1,_0x22635e);_0x30f2a7(_0x22635e);});});} \ No newline at end of file +var _0x4ea3=['Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Tag,\x20%s,\x20%s'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x4ea3,0x70));var _0x34ea=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x4ea3[_0x4cf98e];return _0x1623ac;};'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')]('Tag,\x20%s,\x20%s',_0x18b461,_0x3fa3b0);_0x341727(_0x3fa3b0);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index cb29387..a7075fd 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 _0x26ab=['isAuthenticated','get','/:id','/:id/users','getAgents','post','create','put','update','delete','/:id/queues','removeAgents','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./team.controller'];(function(_0x3953f8,_0x4d1649){var _0x3d8960=function(_0x28f579){while(--_0x28f579){_0x3953f8['push'](_0x3953f8['shift']());}};_0x3d8960(++_0x4d1649);}(_0x26ab,0x199));var _0xb26a=function(_0x158f9d,_0x3497f0){_0x158f9d=_0x158f9d-0x0;var _0x8f812b=_0x26ab[_0x158f9d];return _0x8f812b;};'use strict';var multer=require(_0xb26a('0x0'));var util=require(_0xb26a('0x1'));var path=require(_0xb26a('0x2'));var timeout=require(_0xb26a('0x3'));var express=require(_0xb26a('0x4'));var router=express[_0xb26a('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb26a('0x6'));var config=require(_0xb26a('0x7'));var controller=require(_0xb26a('0x8'));router['get']('/',auth[_0xb26a('0x9')](),controller['index']);router[_0xb26a('0xa')](_0xb26a('0xb'),auth[_0xb26a('0x9')](),controller['show']);router[_0xb26a('0xa')]('/:id/queues',auth[_0xb26a('0x9')](),controller['getQueues']);router[_0xb26a('0xa')](_0xb26a('0xc'),auth[_0xb26a('0x9')](),controller[_0xb26a('0xd')]);router[_0xb26a('0xe')]('/',auth['isAuthenticated'](),controller[_0xb26a('0xf')]);router['post']('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);router['post']('/:id/users',auth[_0xb26a('0x9')](),controller['addAgents']);router[_0xb26a('0x10')](_0xb26a('0xb'),auth[_0xb26a('0x9')](),controller[_0xb26a('0x11')]);router[_0xb26a('0x12')](_0xb26a('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0xb26a('0x12')](_0xb26a('0x13'),auth[_0xb26a('0x9')](),controller['removeQueues']);router[_0xb26a('0x12')](_0xb26a('0xc'),auth['isAuthenticated'](),controller[_0xb26a('0x14')]);module[_0xb26a('0x15')]=router; \ No newline at end of file +var _0x7b78=['/:id','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../config/environment','isAuthenticated','get','show','/:id/queues','getQueues','/:id/users','getAgents','post','create','addQueues','addAgents','update','delete'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7b78,0xe9));var _0x87b7=function(_0xc8a97,_0xbedd75){_0xc8a97=_0xc8a97-0x0;var _0x192611=_0x7b78[_0xc8a97];return _0x192611;};'use strict';var multer=require(_0x87b7('0x0'));var util=require(_0x87b7('0x1'));var path=require(_0x87b7('0x2'));var timeout=require(_0x87b7('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x87b7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x87b7('0x5'));var controller=require('./team.controller');router['get']('/',auth[_0x87b7('0x6')](),controller['index']);router[_0x87b7('0x7')]('/:id',auth[_0x87b7('0x6')](),controller[_0x87b7('0x8')]);router['get'](_0x87b7('0x9'),auth[_0x87b7('0x6')](),controller[_0x87b7('0xa')]);router[_0x87b7('0x7')](_0x87b7('0xb'),auth[_0x87b7('0x6')](),controller[_0x87b7('0xc')]);router[_0x87b7('0xd')]('/',auth[_0x87b7('0x6')](),controller[_0x87b7('0xe')]);router['post']('/:id/queues',auth[_0x87b7('0x6')](),controller[_0x87b7('0xf')]);router[_0x87b7('0xd')](_0x87b7('0xb'),auth['isAuthenticated'](),controller[_0x87b7('0x10')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x87b7('0x11')]);router[_0x87b7('0x12')](_0x87b7('0x13'),auth['isAuthenticated'](),controller[_0x87b7('0x14')]);router[_0x87b7('0x12')]('/:id/queues',auth['isAuthenticated'](),controller['removeQueues']);router[_0x87b7('0x12')](_0x87b7('0xb'),auth[_0x87b7('0x6')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index fd1c67f..88ffc0f 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 _0x9305=['STRING','name','exports'];(function(_0x47c317,_0x303747){var _0x2d6244=function(_0x498c2b){while(--_0x498c2b){_0x47c317['push'](_0x47c317['shift']());}};_0x2d6244(++_0x303747);}(_0x9305,0x1e8));var _0x5930=function(_0x4a1a80,_0x110e3c){_0x4a1a80=_0x4a1a80-0x0;var _0x30ab85=_0x9305[_0x4a1a80];return _0x30ab85;};'use strict';var Sequelize=require('sequelize');module[_0x5930('0x0')]={'name':{'type':Sequelize[_0x5930('0x1')],'allowNull':![],'unique':_0x5930('0x2')},'description':{'type':Sequelize[_0x5930('0x1')]}}; \ No newline at end of file +var _0x5650=['exports','STRING','name','sequelize'];(function(_0x18adde,_0x2c12a6){var _0x11a4d0=function(_0x2d530f){while(--_0x2d530f){_0x18adde['push'](_0x18adde['shift']());}};_0x11a4d0(++_0x2c12a6);}(_0x5650,0x193));var _0x0565=function(_0x5b6d2a,_0x2a4e3b){_0x5b6d2a=_0x5b6d2a-0x0;var _0x536640=_0x5650[_0x5b6d2a];return _0x536640;};'use strict';var Sequelize=require(_0x0565('0x0'));module[_0x0565('0x1')]={'name':{'type':Sequelize[_0x0565('0x2')],'allowNull':![],'unique':_0x0565('0x3')},'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 a7d226a..7a25f23 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 _0xa5c9=['merge','VIRTUAL','name','options','findAll','rows','catch','show','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','channel','Sequelize','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','rawAttributes','order','get','Queues','addQueues','isValidChannel','add','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','each','ids','online','voicePause','interface','upsert','format','SIP/%s','omit','spread','emit','userTeam:save','removeAgents','voice','chat','mail','sms','fax','isArray','userTeam:remove','getAgents','findOne','User','hasOwnProperty','html-pdf','eml-format','rimraf','zip-dir','moment','bluebird','sox','to-csv','ejs','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','json','count','offset','limit','Content-Range','apply','save','update','then','destroy','Teams','UserProfileResource','end','stack','send','index','map','Team','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','nolimit','sort','where','pick','filter'];(function(_0x4c6d55,_0x28e5c3){var _0x38c3f6=function(_0x4431e5){while(--_0x4431e5){_0x4c6d55['push'](_0x4c6d55['shift']());}};_0x38c3f6(++_0x28e5c3);}(_0xa5c9,0x143));var _0x9a5c=function(_0x1064bc,_0x206f12){_0x1064bc=_0x1064bc-0x0;var _0x5edc45=_0xa5c9[_0x1064bc];return _0x5edc45;};'use strict';var pdf=require(_0x9a5c('0x0'));var emlformat=require(_0x9a5c('0x1'));var rimraf=require(_0x9a5c('0x2'));var zipdir=require(_0x9a5c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x9a5c('0x4'));var BPromise=require(_0x9a5c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9a5c('0x6'));var csv=require(_0x9a5c('0x7'));var ejs=require(_0x9a5c('0x8'));var fs=require('fs');var _=require(_0x9a5c('0x9'));var squel=require('squel');var crypto=require(_0x9a5c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x9a5c('0xb'));var toCsv=require(_0x9a5c('0x7'));var querystring=require('querystring');var Papa=require(_0x9a5c('0xc'));var Redis=require(_0x9a5c('0xd'));var authService=require(_0x9a5c('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9a5c('0xf'));var logger=require(_0x9a5c('0x10'))(_0x9a5c('0x11'));var utils=require(_0x9a5c('0x12'));var config=require(_0x9a5c('0x13'));var db=require(_0x9a5c('0x14'))['db'];config[_0x9a5c('0x15')]=_[_0x9a5c('0x16')](config[_0x9a5c('0x15')],{'host':_0x9a5c('0x17'),'port':0x18eb});var socket=require(_0x9a5c('0x18'))(new Redis(config[_0x9a5c('0x15')]));require('./team.socket')[_0x9a5c('0x19')](socket);function respondWithStatusCode(_0x3c39d6,_0x2b1cef){_0x2b1cef=_0x2b1cef||0xcc;return function(_0x4fdcdc){if(_0x4fdcdc){return _0x3c39d6[_0x9a5c('0x1a')](_0x2b1cef);}return _0x3c39d6[_0x9a5c('0x1b')](_0x2b1cef)['end']();};}function respondWithResult(_0x16422d,_0x5ef98e){_0x5ef98e=_0x5ef98e||0xc8;return function(_0x350bd5){if(_0x350bd5){return _0x16422d['status'](_0x5ef98e)[_0x9a5c('0x1c')](_0x350bd5);}};}function respondWithFilteredResult(_0x1e0c41,_0x59e410){return function(_0x2d509f){if(_0x2d509f){var _0x3f06b6=_0x2d509f[_0x9a5c('0x1d')],_0x39fbea=_0x59e410[_0x9a5c('0x1e')],_0x4bb262=_0x59e410['offset']+_0x59e410[_0x9a5c('0x1f')],_0x549a96;if(_0x4bb262>=_0x3f06b6){_0x4bb262=_0x3f06b6;_0x549a96=0xc8;}else{_0x549a96=0xce;}_0x1e0c41[_0x9a5c('0x1b')](_0x549a96);return _0x1e0c41['set'](_0x9a5c('0x20'),_0x39fbea+'-'+_0x4bb262+'/'+_0x3f06b6)[_0x9a5c('0x1c')](_0x2d509f);}return null;};}function patchUpdates(_0xe42960){return function(_0x53ad9f){try{jsonpatch[_0x9a5c('0x21')](_0x53ad9f,_0xe42960,!![]);}catch(_0x3c21cd){return BPromise['reject'](_0x3c21cd);}return _0x53ad9f[_0x9a5c('0x22')]();};}function saveUpdates(_0x191881,_0x5659b4){return function(_0x4b3d64){if(_0x4b3d64){return _0x4b3d64[_0x9a5c('0x23')](_0x191881)[_0x9a5c('0x24')](function(_0x5719eb){return _0x5719eb;});}return null;};}function removeEntity(_0x17dc2f,_0x3f7d13){return function(_0x163985){if(_0x163985){return _0x163985[_0x9a5c('0x25')]()[_0x9a5c('0x24')](function(){var _0x3c3112=_0x163985['get']({'plain':!![]});var _0x538e65=_0x9a5c('0x26');return db[_0x9a5c('0x27')][_0x9a5c('0x25')]({'where':{'type':_0x538e65,'resourceId':_0x3c3112['id']}})[_0x9a5c('0x24')](function(){return _0x163985;});})['then'](function(){_0x17dc2f[_0x9a5c('0x1b')](0xcc)[_0x9a5c('0x28')]();});}};}function handleEntityNotFound(_0x3b5d9c,_0x4119f7){return function(_0x439e6b){if(!_0x439e6b){_0x3b5d9c[_0x9a5c('0x1a')](0x194);}return _0x439e6b;};}function handleError(_0xf88f6b,_0x4146c9){_0x4146c9=_0x4146c9||0x1f4;return function(_0x3d3356){logger['error'](_0x3d3356[_0x9a5c('0x29')]);if(_0x3d3356['name']){delete _0x3d3356['name'];}_0xf88f6b['status'](_0x4146c9)[_0x9a5c('0x2a')](_0x3d3356);};}exports[_0x9a5c('0x2b')]=function(_0x214953,_0xb966ad){var _0x2f9161={},_0x35d472={},_0x56dcce={'count':0x0,'rows':[]};var _0x3f1815=_[_0x9a5c('0x2c')](db[_0x9a5c('0x2d')]['rawAttributes'],function(_0x39945c){return{'name':_0x39945c[_0x9a5c('0x2e')],'type':_0x39945c[_0x9a5c('0x2f')][_0x9a5c('0x30')]};});_0x35d472['model']=_[_0x9a5c('0x2c')](_0x3f1815,'name');_0x35d472[_0x9a5c('0x31')]=_['keys'](_0x214953[_0x9a5c('0x31')]);_0x35d472[_0x9a5c('0x32')]=_[_0x9a5c('0x33')](_0x35d472[_0x9a5c('0x34')],_0x35d472[_0x9a5c('0x31')]);_0x2f9161[_0x9a5c('0x35')]=_['intersection'](_0x35d472[_0x9a5c('0x34')],qs[_0x9a5c('0x36')](_0x214953[_0x9a5c('0x31')][_0x9a5c('0x36')]));_0x2f9161['attributes']=_0x2f9161[_0x9a5c('0x35')][_0x9a5c('0x37')]?_0x2f9161['attributes']:_0x35d472[_0x9a5c('0x34')];if(!_0x214953[_0x9a5c('0x31')]['hasOwnProperty'](_0x9a5c('0x38'))){_0x2f9161['limit']=qs[_0x9a5c('0x1f')](_0x214953[_0x9a5c('0x31')][_0x9a5c('0x1f')]);_0x2f9161[_0x9a5c('0x1e')]=qs[_0x9a5c('0x1e')](_0x214953['query']['offset']);}_0x2f9161['order']=qs['sort'](_0x214953[_0x9a5c('0x31')][_0x9a5c('0x39')]);_0x2f9161[_0x9a5c('0x3a')]=qs[_0x9a5c('0x32')](_[_0x9a5c('0x3b')](_0x214953[_0x9a5c('0x31')],_0x35d472[_0x9a5c('0x32')]));if(_0x214953[_0x9a5c('0x31')][_0x9a5c('0x3c')]){_0x2f9161[_0x9a5c('0x3a')]=_[_0x9a5c('0x3d')](_0x2f9161['where'],{'$or':_[_0x9a5c('0x2c')](_0x3f1815,function(_0x158376){if(_0x158376[_0x9a5c('0x2f')]!==_0x9a5c('0x3e')){var _0x4b4a6e={};_0x4b4a6e[_0x158376[_0x9a5c('0x3f')]]={'$like':'%'+_0x214953[_0x9a5c('0x31')]['filter']+'%'};return _0x4b4a6e;}})});}_0x2f9161=_[_0x9a5c('0x3d')]({},_0x2f9161,_0x214953[_0x9a5c('0x40')]);var _0x458d36={'where':_0x2f9161[_0x9a5c('0x3a')]};return db[_0x9a5c('0x2d')][_0x9a5c('0x1d')](_0x458d36)[_0x9a5c('0x24')](function(_0x2518e0){_0x56dcce[_0x9a5c('0x1d')]=_0x2518e0;if(_0x214953[_0x9a5c('0x31')]['includeAll']){_0x2f9161['include']=[{'all':!![]}];}return db[_0x9a5c('0x2d')][_0x9a5c('0x41')](_0x2f9161);})[_0x9a5c('0x24')](function(_0xe6e36d){_0x56dcce[_0x9a5c('0x42')]=_0xe6e36d;return _0x56dcce;})[_0x9a5c('0x24')](respondWithFilteredResult(_0xb966ad,_0x2f9161))[_0x9a5c('0x43')](handleError(_0xb966ad,null));};exports[_0x9a5c('0x44')]=function(_0x28775c,_0x38c031){var _0x718265={'raw':![],'where':{'id':_0x28775c['params']['id']}},_0x1322da={};_0x1322da['model']=_[_0x9a5c('0x45')](db[_0x9a5c('0x2d')]['rawAttributes']);_0x1322da[_0x9a5c('0x31')]=_[_0x9a5c('0x45')](_0x28775c['query']);_0x1322da['filters']=_['intersection'](_0x1322da[_0x9a5c('0x34')],_0x1322da['query']);_0x718265[_0x9a5c('0x35')]=_[_0x9a5c('0x33')](_0x1322da['model'],qs[_0x9a5c('0x36')](_0x28775c[_0x9a5c('0x31')]['fields']));_0x718265[_0x9a5c('0x35')]=_0x718265[_0x9a5c('0x35')]['length']?_0x718265['attributes']:_0x1322da[_0x9a5c('0x34')];if(_0x28775c[_0x9a5c('0x31')][_0x9a5c('0x46')]){_0x718265['include']=[{'all':!![]}];}_0x718265=_[_0x9a5c('0x3d')]({},_0x718265,_0x28775c[_0x9a5c('0x40')]);return db[_0x9a5c('0x2d')][_0x9a5c('0x47')](_0x718265)['then'](handleEntityNotFound(_0x38c031,null))[_0x9a5c('0x24')](respondWithResult(_0x38c031,null))[_0x9a5c('0x43')](handleError(_0x38c031,null));};exports['create']=function(_0x28a097,_0x932af5){return db[_0x9a5c('0x2d')][_0x9a5c('0x48')](_0x28a097[_0x9a5c('0x49')],{})[_0x9a5c('0x24')](function(_0xc5cbca){var _0x5e0297=_0x28a097[_0x9a5c('0x4a')]['get']({'plain':!![]});if(!_0x5e0297)throw new Error(_0x9a5c('0x4b'));if(_0x5e0297['role']===_0x9a5c('0x4a')){var _0x281139=_0xc5cbca['get']({'plain':!![]});var _0x32c24='Teams';return db['UserProfileSection'][_0x9a5c('0x47')]({'where':{'name':_0x32c24,'userProfileId':_0x5e0297[_0x9a5c('0x4c')]},'raw':!![]})[_0x9a5c('0x24')](function(_0x5b9f51){if(_0x5b9f51&&_0x5b9f51[_0x9a5c('0x4d')]===0x0){return db[_0x9a5c('0x27')][_0x9a5c('0x48')]({'name':_0x281139[_0x9a5c('0x3f')],'resourceId':_0x281139['id'],'type':_0x5b9f51[_0x9a5c('0x3f')],'sectionId':_0x5b9f51['id']},{})[_0x9a5c('0x24')](function(){return _0xc5cbca;});}else{return _0xc5cbca;}})[_0x9a5c('0x43')](function(_0x40665c){logger[_0x9a5c('0x4e')](_0x9a5c('0x4f'),_0x40665c);throw _0x40665c;});}return _0xc5cbca;})['then'](respondWithResult(_0x932af5,0xc9))['catch'](handleError(_0x932af5,null));};exports[_0x9a5c('0x23')]=function(_0x4545d8,_0x29a024){if(_0x4545d8[_0x9a5c('0x49')]['id']){delete _0x4545d8['body']['id'];}return db['Team'][_0x9a5c('0x47')]({'where':{'id':_0x4545d8[_0x9a5c('0x50')]['id']}})[_0x9a5c('0x24')](handleEntityNotFound(_0x29a024,null))[_0x9a5c('0x24')](saveUpdates(_0x4545d8['body'],null))[_0x9a5c('0x24')](respondWithResult(_0x29a024,null))[_0x9a5c('0x43')](handleError(_0x29a024,null));};exports['destroy']=function(_0x32fa49,_0x2b924c){return db[_0x9a5c('0x2d')][_0x9a5c('0x47')]({'where':{'id':_0x32fa49['params']['id']}})['then'](handleEntityNotFound(_0x2b924c,null))['then'](removeEntity(_0x2b924c,null))[_0x9a5c('0x43')](handleError(_0x2b924c,null));};exports[_0x9a5c('0x51')]=function(_0x546083,_0x40b041,_0x19024a){return db[_0x9a5c('0x2d')]['findOne']({'where':{'id':_0x546083[_0x9a5c('0x50')]['id']}})[_0x9a5c('0x24')](handleEntityNotFound(_0x40b041,null))[_0x9a5c('0x24')](function(_0x2170ac){if(!_0x546083[_0x9a5c('0x31')][_0x9a5c('0x52')]||!utils['isValidChannel'](_0x546083[_0x9a5c('0x31')][_0x9a5c('0x52')])){throw new db[(_0x9a5c('0x53'))][(_0x9a5c('0x54'))](_0x9a5c('0x55'));}var _0x3e14a4={};var _0x54e7ec={};_0x54e7ec[_0x9a5c('0x34')]=_[_0x9a5c('0x45')](db[_[_0x9a5c('0x56')](_0x546083[_0x9a5c('0x31')]['channel'][_0x9a5c('0x57')]())+_0x9a5c('0x58')][_0x9a5c('0x59')]);_0x54e7ec[_0x9a5c('0x31')]=_[_0x9a5c('0x45')](_0x546083['query']);_0x54e7ec[_0x9a5c('0x32')]=_[_0x9a5c('0x33')](_0x54e7ec[_0x9a5c('0x34')],_0x54e7ec[_0x9a5c('0x31')]);_0x3e14a4[_0x9a5c('0x35')]=_[_0x9a5c('0x33')](_0x54e7ec[_0x9a5c('0x34')],qs[_0x9a5c('0x36')](_0x546083['query'][_0x9a5c('0x36')]));_0x3e14a4[_0x9a5c('0x35')]=_0x3e14a4['attributes'][_0x9a5c('0x37')]?_0x3e14a4['attributes']:_0x54e7ec[_0x9a5c('0x34')];_0x3e14a4['limit']=qs[_0x9a5c('0x1f')](_0x546083[_0x9a5c('0x31')]['limit']);_0x3e14a4[_0x9a5c('0x1e')]=qs[_0x9a5c('0x1e')](_0x546083[_0x9a5c('0x31')][_0x9a5c('0x1e')]);_0x3e14a4[_0x9a5c('0x5a')]=qs[_0x9a5c('0x39')](_0x546083[_0x9a5c('0x31')][_0x9a5c('0x39')]);_0x3e14a4[_0x9a5c('0x3a')]=qs[_0x9a5c('0x32')](_[_0x9a5c('0x3b')](_0x546083[_0x9a5c('0x31')],_0x54e7ec['filters']));_0x3e14a4=_[_0x9a5c('0x3d')]({},_0x3e14a4,_0x546083[_0x9a5c('0x40')]);return _0x2170ac[_0x9a5c('0x5b')+_[_0x9a5c('0x56')](_0x546083[_0x9a5c('0x31')][_0x9a5c('0x52')][_0x9a5c('0x57')]())+_0x9a5c('0x5c')](_0x3e14a4);})[_0x9a5c('0x24')](respondWithResult(_0x40b041,null))[_0x9a5c('0x43')](handleError(_0x40b041,null));};exports[_0x9a5c('0x5d')]=function(_0xc82775,_0x5f14dd,_0x4619c8){return db[_0x9a5c('0x2d')]['findOne']({'where':{'id':_0xc82775[_0x9a5c('0x50')]['id']}})['then'](function(_0x911067){if(_0x911067){if(!_0xc82775[_0x9a5c('0x49')][_0x9a5c('0x52')]||!utils[_0x9a5c('0x5e')](_0xc82775[_0x9a5c('0x49')]['channel'])){throw new db[(_0x9a5c('0x53'))][(_0x9a5c('0x54'))](_0x9a5c('0x55'));}return _0x911067[_0x9a5c('0x5f')+_[_0x9a5c('0x56')](_0xc82775[_0x9a5c('0x49')]['channel'][_0x9a5c('0x57')]())+_0x9a5c('0x5c')](_0xc82775[_0x9a5c('0x49')]['ids']);}return null;})[_0x9a5c('0x24')](handleEntityNotFound(_0x5f14dd,null))['then'](respondWithStatusCode(_0x5f14dd,null))[_0x9a5c('0x43')](handleError(_0x5f14dd,null));};exports['removeQueues']=function(_0x6d5edd,_0x508ef5,_0x423b93){return db[_0x9a5c('0x2d')]['findOne']({'where':{'id':_0x6d5edd[_0x9a5c('0x50')]['id']}})[_0x9a5c('0x24')](function(_0x4b7cd6){if(_0x4b7cd6){if(!_0x6d5edd[_0x9a5c('0x31')][_0x9a5c('0x52')]||!utils['isValidChannel'](_0x6d5edd[_0x9a5c('0x31')][_0x9a5c('0x52')])){throw new db[(_0x9a5c('0x53'))][(_0x9a5c('0x54'))](_0x9a5c('0x55'));}return _0x4b7cd6[_0x9a5c('0x60')+_[_0x9a5c('0x56')](_0x6d5edd[_0x9a5c('0x31')][_0x9a5c('0x52')][_0x9a5c('0x57')]())+_0x9a5c('0x5c')](_0x6d5edd[_0x9a5c('0x31')]['ids']);}return null;})[_0x9a5c('0x24')](handleEntityNotFound(_0x508ef5,null))[_0x9a5c('0x24')](respondWithStatusCode(_0x508ef5,null))[_0x9a5c('0x43')](handleError(_0x508ef5,null));};exports[_0x9a5c('0x61')]=function(_0x187e09,_0x2a16c4,_0x18e204){return db[_0x9a5c('0x2d')][_0x9a5c('0x47')]({'where':{'id':_0x187e09['params']['id']}})['then'](handleEntityNotFound(_0x2a16c4,null))[_0x9a5c('0x24')](function(_0x487ee3){if(_0x487ee3){var _0x49cce7=[_0x9a5c('0x62'),_0x9a5c('0x63'),_0x9a5c('0x64'),_0x9a5c('0x65'),_0x9a5c('0x66'),_0x9a5c('0x67')];return BPromise[_0x9a5c('0x68')](_0x49cce7,function(_0x210368){return _0x487ee3[_0x9a5c('0x5b')+_0x210368+_0x9a5c('0x5c')]({'attributes':['id','name']})['then'](function(_0x1fb3ff){return BPromise[_0x9a5c('0x68')](_0x1fb3ff,function(_0x289e2c){return _0x289e2c['addAgents'](_0x187e09[_0x9a5c('0x49')][_0x9a5c('0x69')])['then'](function(){if(_0x210368===_0x9a5c('0x62')){return db['User'][_0x9a5c('0x41')]({'where':{'id':_0x187e09[_0x9a5c('0x49')]['ids']},'attributes':['id',_0x9a5c('0x3f'),_0x9a5c('0x6a'),_0x9a5c('0x6b'),_0x9a5c('0x6c')],'raw':!![]})['then'](function(_0x21f783){return BPromise[_0x9a5c('0x68')](_[_0x9a5c('0x3c')](_0x21f783,{'online':0x1}),function(_0x4a0f9d){return db['UserVoiceQueueRt'][_0x9a5c('0x6d')]({'membername':_0x4a0f9d['name'],'UserId':_0x4a0f9d['id'],'queue_name':_0x289e2c['name'],'VoiceQueueId':_0x289e2c['id'],'interface':_['isNil'](_0x4a0f9d[_0x9a5c('0x6c')])?util[_0x9a5c('0x6e')](_0x9a5c('0x6f'),_0x4a0f9d[_0x9a5c('0x3f')]):_0x4a0f9d[_0x9a5c('0x6c')],'paused':_0x4a0f9d[_0x9a5c('0x6b')]||![],'penalty':0x0});});});}});});})[_0x9a5c('0x24')](function(){return _0x487ee3;});})[_0x9a5c('0x24')](function(){return _0x487ee3;});}})[_0x9a5c('0x24')](function(_0x3c2f8c){if(_0x3c2f8c){return _0x3c2f8c['addAgents'](_0x187e09[_0x9a5c('0x49')][_0x9a5c('0x69')],_[_0x9a5c('0x70')](_0x187e09['body'],['ids','id'])||{})[_0x9a5c('0x71')](function(_0x3c6306){for(var _0x3cb5e4=0x0;_0x3cb5e4<_0x187e09[_0x9a5c('0x49')][_0x9a5c('0x69')][_0x9a5c('0x37')];_0x3cb5e4+=0x1){socket[_0x9a5c('0x72')](_0x9a5c('0x73'),{'UserId':_0x187e09[_0x9a5c('0x49')]['ids'][_0x3cb5e4],'TeamId':_0x187e09[_0x9a5c('0x50')]['id']});}return _0x3c6306;});}})[_0x9a5c('0x24')](respondWithResult(_0x2a16c4,null))['catch'](handleError(_0x2a16c4,null));};exports[_0x9a5c('0x74')]=function(_0x2c2535,_0x276a7c,_0x56b3e5){return db['Team'][_0x9a5c('0x47')]({'where':{'id':_0x2c2535['params']['id']}})[_0x9a5c('0x24')](handleEntityNotFound(_0x276a7c,null))[_0x9a5c('0x24')](function(_0x4f6866){if(_0x4f6866){return BPromise[_0x9a5c('0x68')]([_0x9a5c('0x75'),_0x9a5c('0x76'),_0x9a5c('0x77'),_0x9a5c('0x78'),_0x9a5c('0x79'),'openchannel'],function(_0x5af8aa){return _0x4f6866[_0x9a5c('0x5b')+_[_0x9a5c('0x56')](_0x5af8aa)+'Queues']({'attributes':['id',_0x9a5c('0x3f')]})[_0x9a5c('0x24')](function(_0x2451d5){return BPromise[_0x9a5c('0x68')](_0x2451d5,function(_0x1049e9){return _0x1049e9[_0x9a5c('0x74')](_0x2c2535['query']['ids'])['then'](function(){if(_0x5af8aa===_0x9a5c('0x75')){return db['UserVoiceQueueRt'][_0x9a5c('0x25')]({'where':{'VoiceQueueId':_0x1049e9['id'],'UserId':_0x2c2535[_0x9a5c('0x31')][_0x9a5c('0x69')]}});}});});})[_0x9a5c('0x24')](function(){return _0x4f6866;});})[_0x9a5c('0x24')](function(){return _0x4f6866;});}})[_0x9a5c('0x24')](function(_0x3987e6){if(_0x3987e6){return _0x3987e6[_0x9a5c('0x74')](_0x2c2535[_0x9a5c('0x31')][_0x9a5c('0x69')])[_0x9a5c('0x24')](function(){if(_[_0x9a5c('0x7a')](_0x2c2535[_0x9a5c('0x31')]['ids'])){for(var _0x1776b3=0x0;_0x1776b3<_0x2c2535['query'][_0x9a5c('0x69')]['length'];_0x1776b3+=0x1){socket['emit'](_0x9a5c('0x7b'),{'UserId':Number(_0x2c2535[_0x9a5c('0x31')][_0x9a5c('0x69')][_0x1776b3]),'TeamId':Number(_0x2c2535[_0x9a5c('0x50')]['id'])});}}else{socket[_0x9a5c('0x72')](_0x9a5c('0x7b'),{'UserId':Number(_0x2c2535[_0x9a5c('0x31')][_0x9a5c('0x69')]),'TeamId':Number(_0x2c2535[_0x9a5c('0x50')]['id'])});}});}})[_0x9a5c('0x24')](respondWithStatusCode(_0x276a7c,null))[_0x9a5c('0x43')](handleError(_0x276a7c,null));};exports[_0x9a5c('0x7c')]=function(_0x7fdc21,_0x52a555,_0x56dc26){var _0x34ec8a={};var _0x334d53={};var _0x21aa15;var _0x1672ce;return db['Team'][_0x9a5c('0x7d')]({'where':{'id':_0x7fdc21[_0x9a5c('0x50')]['id']}})[_0x9a5c('0x24')](handleEntityNotFound(_0x52a555,null))[_0x9a5c('0x24')](function(_0x4935a4){if(_0x4935a4){_0x21aa15=_0x4935a4;_0x334d53[_0x9a5c('0x34')]=_[_0x9a5c('0x45')](db[_0x9a5c('0x7e')][_0x9a5c('0x59')]);_0x334d53[_0x9a5c('0x31')]=_[_0x9a5c('0x45')](_0x7fdc21['query']);_0x334d53[_0x9a5c('0x32')]=_[_0x9a5c('0x33')](_0x334d53[_0x9a5c('0x34')],_0x334d53[_0x9a5c('0x31')]);_0x34ec8a[_0x9a5c('0x35')]=_[_0x9a5c('0x33')](_0x334d53[_0x9a5c('0x34')],qs[_0x9a5c('0x36')](_0x7fdc21[_0x9a5c('0x31')]['fields']));_0x34ec8a[_0x9a5c('0x35')]=_0x34ec8a[_0x9a5c('0x35')][_0x9a5c('0x37')]?_0x34ec8a[_0x9a5c('0x35')]:_0x334d53[_0x9a5c('0x34')];_0x34ec8a['order']=qs['sort'](_0x7fdc21[_0x9a5c('0x31')][_0x9a5c('0x39')]);_0x34ec8a['where']=qs[_0x9a5c('0x32')](_[_0x9a5c('0x3b')](_0x7fdc21[_0x9a5c('0x31')],_0x334d53[_0x9a5c('0x32')]));if(_0x7fdc21['query'][_0x9a5c('0x3c')]){_0x34ec8a[_0x9a5c('0x3a')]=_['merge'](_0x34ec8a[_0x9a5c('0x3a')],{'$or':_[_0x9a5c('0x2c')](_0x34ec8a[_0x9a5c('0x35')],function(_0x59303c){var _0x34c541={};_0x34c541[_0x59303c]={'$like':'%'+_0x7fdc21[_0x9a5c('0x31')][_0x9a5c('0x3c')]+'%'};return _0x34c541;})});}_0x34ec8a=_[_0x9a5c('0x3d')]({},_0x34ec8a,_0x7fdc21['options']);return _0x21aa15['getAgents'](_0x34ec8a);}})[_0x9a5c('0x24')](function(_0x15c5fd){if(_0x15c5fd){_0x1672ce=_0x15c5fd[_0x9a5c('0x37')];if(!_0x7fdc21['query'][_0x9a5c('0x7f')](_0x9a5c('0x38'))){_0x34ec8a[_0x9a5c('0x1f')]=qs[_0x9a5c('0x1f')](_0x7fdc21[_0x9a5c('0x31')][_0x9a5c('0x1f')]);_0x34ec8a[_0x9a5c('0x1e')]=qs[_0x9a5c('0x1e')](_0x7fdc21[_0x9a5c('0x31')][_0x9a5c('0x1e')]);}return _0x21aa15['getAgents'](_0x34ec8a);}})['then'](function(_0x39769d){if(_0x39769d){return _0x39769d?{'count':_0x1672ce,'rows':_0x39769d}:null;}})['then'](respondWithResult(_0x52a555,null))[_0x9a5c('0x43')](handleError(_0x52a555,null));}; \ No newline at end of file +var _0x34bd=['model','query','keys','filters','attributes','intersection','fields','nolimit','sort','pick','where','merge','VIRTUAL','filter','options','count','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getQueues','findOne','channel','ValidationError','Unknown\x20channel','capitalize','toLowerCase','Queue','order','Queues','addQueues','isValidChannel','add','removeQueues','Sequelize','remove','ids','addAgents','Voice','Chat','Sms','Fax','Openchannel','each','User','online','voicePause','interface','upsert','isNil','format','SIP/%s','spread','length','emit','userTeam:save','voice','chat','mail','sms','fax','removeAgents','UserVoiceQueueRt','userTeam:remove','getAgents','hasOwnProperty','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./team.socket','status','end','json','offset','limit','set','Content-Range','apply','reject','update','then','destroy','Teams','UserProfileResource','error','stack','name','send','map','Team','fieldName','type'];(function(_0x9069e,_0x108e36){var _0x2c7a9a=function(_0x206fc3){while(--_0x206fc3){_0x9069e['push'](_0x9069e['shift']());}};_0x2c7a9a(++_0x108e36);}(_0x34bd,0x1d2));var _0xd34b=function(_0x3e330a,_0x11bf04){_0x3e330a=_0x3e330a-0x0;var _0x451dee=_0x34bd[_0x3e330a];return _0x451dee;};'use strict';var pdf=require(_0xd34b('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xd34b('0x1'));var jsonpatch=require(_0xd34b('0x2'));var rp=require(_0xd34b('0x3'));var moment=require(_0xd34b('0x4'));var BPromise=require(_0xd34b('0x5'));var Mustache=require(_0xd34b('0x6'));var util=require(_0xd34b('0x7'));var path=require('path');var sox=require(_0xd34b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xd34b('0x9'));var crypto=require(_0xd34b('0xa'));var jsforce=require(_0xd34b('0xb'));var deskjs=require(_0xd34b('0xc'));var toCsv=require(_0xd34b('0xd'));var querystring=require(_0xd34b('0xe'));var Papa=require(_0xd34b('0xf'));var Redis=require(_0xd34b('0x10'));var authService=require(_0xd34b('0x11'));var qs=require(_0xd34b('0x12'));var as=require(_0xd34b('0x13'));var hardwareService=require(_0xd34b('0x14'));var logger=require('../../config/logger')(_0xd34b('0x15'));var utils=require('../../config/utils');var config=require(_0xd34b('0x16'));var db=require(_0xd34b('0x17'))['db'];config[_0xd34b('0x18')]=_[_0xd34b('0x19')](config[_0xd34b('0x18')],{'host':_0xd34b('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd34b('0x18')]));require(_0xd34b('0x1b'))['register'](socket);function respondWithStatusCode(_0x14e108,_0x2f4fe4){_0x2f4fe4=_0x2f4fe4||0xcc;return function(_0x1ebdc5){if(_0x1ebdc5){return _0x14e108['sendStatus'](_0x2f4fe4);}return _0x14e108[_0xd34b('0x1c')](_0x2f4fe4)[_0xd34b('0x1d')]();};}function respondWithResult(_0x5a46be,_0x3c74e2){_0x3c74e2=_0x3c74e2||0xc8;return function(_0x4ce87b){if(_0x4ce87b){return _0x5a46be[_0xd34b('0x1c')](_0x3c74e2)[_0xd34b('0x1e')](_0x4ce87b);}};}function respondWithFilteredResult(_0x2ace5a,_0x56ea27){return function(_0x152c8d){if(_0x152c8d){var _0x193965=_0x152c8d['count'],_0x1bbbb1=_0x56ea27['offset'],_0x105f67=_0x56ea27[_0xd34b('0x1f')]+_0x56ea27[_0xd34b('0x20')],_0x206f16;if(_0x105f67>=_0x193965){_0x105f67=_0x193965;_0x206f16=0xc8;}else{_0x206f16=0xce;}_0x2ace5a[_0xd34b('0x1c')](_0x206f16);return _0x2ace5a[_0xd34b('0x21')](_0xd34b('0x22'),_0x1bbbb1+'-'+_0x105f67+'/'+_0x193965)[_0xd34b('0x1e')](_0x152c8d);}return null;};}function patchUpdates(_0x4a3273){return function(_0xa8ffe5){try{jsonpatch[_0xd34b('0x23')](_0xa8ffe5,_0x4a3273,!![]);}catch(_0x1ae4ec){return BPromise[_0xd34b('0x24')](_0x1ae4ec);}return _0xa8ffe5['save']();};}function saveUpdates(_0x45c569,_0x259abb){return function(_0x92bcb3){if(_0x92bcb3){return _0x92bcb3[_0xd34b('0x25')](_0x45c569)[_0xd34b('0x26')](function(_0x27eb68){return _0x27eb68;});}return null;};}function removeEntity(_0x5afc42,_0x50da22){return function(_0x49c485){if(_0x49c485){return _0x49c485[_0xd34b('0x27')]()[_0xd34b('0x26')](function(){var _0x54c88a=_0x49c485['get']({'plain':!![]});var _0x5e5519=_0xd34b('0x28');return db[_0xd34b('0x29')][_0xd34b('0x27')]({'where':{'type':_0x5e5519,'resourceId':_0x54c88a['id']}})['then'](function(){return _0x49c485;});})[_0xd34b('0x26')](function(){_0x5afc42[_0xd34b('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21a653,_0x38637f){return function(_0x342885){if(!_0x342885){_0x21a653['sendStatus'](0x194);}return _0x342885;};}function handleError(_0x161529,_0x4f047d){_0x4f047d=_0x4f047d||0x1f4;return function(_0x182266){logger[_0xd34b('0x2a')](_0x182266[_0xd34b('0x2b')]);if(_0x182266['name']){delete _0x182266[_0xd34b('0x2c')];}_0x161529['status'](_0x4f047d)[_0xd34b('0x2d')](_0x182266);};}exports['index']=function(_0x311a09,_0x567b74){var _0x24ef6c={},_0x3f3ff0={},_0x49cdbe={'count':0x0,'rows':[]};var _0x2c573d=_[_0xd34b('0x2e')](db[_0xd34b('0x2f')]['rawAttributes'],function(_0xfe0957){return{'name':_0xfe0957[_0xd34b('0x30')],'type':_0xfe0957[_0xd34b('0x31')]['key']};});_0x3f3ff0[_0xd34b('0x32')]=_[_0xd34b('0x2e')](_0x2c573d,_0xd34b('0x2c'));_0x3f3ff0[_0xd34b('0x33')]=_[_0xd34b('0x34')](_0x311a09[_0xd34b('0x33')]);_0x3f3ff0[_0xd34b('0x35')]=_['intersection'](_0x3f3ff0[_0xd34b('0x32')],_0x3f3ff0[_0xd34b('0x33')]);_0x24ef6c[_0xd34b('0x36')]=_[_0xd34b('0x37')](_0x3f3ff0[_0xd34b('0x32')],qs['fields'](_0x311a09[_0xd34b('0x33')][_0xd34b('0x38')]));_0x24ef6c[_0xd34b('0x36')]=_0x24ef6c['attributes']['length']?_0x24ef6c[_0xd34b('0x36')]:_0x3f3ff0[_0xd34b('0x32')];if(!_0x311a09[_0xd34b('0x33')]['hasOwnProperty'](_0xd34b('0x39'))){_0x24ef6c[_0xd34b('0x20')]=qs[_0xd34b('0x20')](_0x311a09[_0xd34b('0x33')]['limit']);_0x24ef6c['offset']=qs[_0xd34b('0x1f')](_0x311a09[_0xd34b('0x33')]['offset']);}_0x24ef6c['order']=qs['sort'](_0x311a09[_0xd34b('0x33')][_0xd34b('0x3a')]);_0x24ef6c['where']=qs[_0xd34b('0x35')](_[_0xd34b('0x3b')](_0x311a09[_0xd34b('0x33')],_0x3f3ff0[_0xd34b('0x35')]));if(_0x311a09[_0xd34b('0x33')]['filter']){_0x24ef6c[_0xd34b('0x3c')]=_[_0xd34b('0x3d')](_0x24ef6c[_0xd34b('0x3c')],{'$or':_[_0xd34b('0x2e')](_0x2c573d,function(_0x589ec9){if(_0x589ec9[_0xd34b('0x31')]!==_0xd34b('0x3e')){var _0x539d27={};_0x539d27[_0x589ec9['name']]={'$like':'%'+_0x311a09[_0xd34b('0x33')][_0xd34b('0x3f')]+'%'};return _0x539d27;}})});}_0x24ef6c=_[_0xd34b('0x3d')]({},_0x24ef6c,_0x311a09[_0xd34b('0x40')]);var _0x4a9660={'where':_0x24ef6c[_0xd34b('0x3c')]};return db[_0xd34b('0x2f')]['count'](_0x4a9660)['then'](function(_0x4d4bfa){_0x49cdbe[_0xd34b('0x41')]=_0x4d4bfa;if(_0x311a09['query']['includeAll']){_0x24ef6c[_0xd34b('0x42')]=[{'all':!![]}];}return db['Team'][_0xd34b('0x43')](_0x24ef6c);})['then'](function(_0x10dd5b){_0x49cdbe[_0xd34b('0x44')]=_0x10dd5b;return _0x49cdbe;})[_0xd34b('0x26')](respondWithFilteredResult(_0x567b74,_0x24ef6c))[_0xd34b('0x45')](handleError(_0x567b74,null));};exports[_0xd34b('0x46')]=function(_0x5deab1,_0x168441){var _0x3fc4b0={'raw':![],'where':{'id':_0x5deab1[_0xd34b('0x47')]['id']}},_0x175a10={};_0x175a10[_0xd34b('0x32')]=_[_0xd34b('0x34')](db[_0xd34b('0x2f')][_0xd34b('0x48')]);_0x175a10[_0xd34b('0x33')]=_[_0xd34b('0x34')](_0x5deab1[_0xd34b('0x33')]);_0x175a10[_0xd34b('0x35')]=_['intersection'](_0x175a10['model'],_0x175a10[_0xd34b('0x33')]);_0x3fc4b0[_0xd34b('0x36')]=_['intersection'](_0x175a10[_0xd34b('0x32')],qs[_0xd34b('0x38')](_0x5deab1['query'][_0xd34b('0x38')]));_0x3fc4b0[_0xd34b('0x36')]=_0x3fc4b0['attributes']['length']?_0x3fc4b0[_0xd34b('0x36')]:_0x175a10[_0xd34b('0x32')];if(_0x5deab1[_0xd34b('0x33')]['includeAll']){_0x3fc4b0[_0xd34b('0x42')]=[{'all':!![]}];}_0x3fc4b0=_['merge']({},_0x3fc4b0,_0x5deab1[_0xd34b('0x40')]);return db['Team'][_0xd34b('0x49')](_0x3fc4b0)['then'](handleEntityNotFound(_0x168441,null))[_0xd34b('0x26')](respondWithResult(_0x168441,null))[_0xd34b('0x45')](handleError(_0x168441,null));};exports[_0xd34b('0x4a')]=function(_0x334661,_0x19508c){return db[_0xd34b('0x2f')][_0xd34b('0x4a')](_0x334661[_0xd34b('0x4b')],{})[_0xd34b('0x26')](function(_0x149b3f){var _0x9b5b9d=_0x334661[_0xd34b('0x4c')][_0xd34b('0x4d')]({'plain':!![]});if(!_0x9b5b9d)throw new Error(_0xd34b('0x4e'));if(_0x9b5b9d[_0xd34b('0x4f')]===_0xd34b('0x4c')){var _0x4dc1c5=_0x149b3f[_0xd34b('0x4d')]({'plain':!![]});var _0xdef8f2=_0xd34b('0x28');return db[_0xd34b('0x50')][_0xd34b('0x49')]({'where':{'name':_0xdef8f2,'userProfileId':_0x9b5b9d[_0xd34b('0x51')]},'raw':!![]})[_0xd34b('0x26')](function(_0x1a9a96){if(_0x1a9a96&&_0x1a9a96['autoAssociation']===0x0){return db[_0xd34b('0x29')][_0xd34b('0x4a')]({'name':_0x4dc1c5[_0xd34b('0x2c')],'resourceId':_0x4dc1c5['id'],'type':_0x1a9a96[_0xd34b('0x2c')],'sectionId':_0x1a9a96['id']},{})['then'](function(){return _0x149b3f;});}else{return _0x149b3f;}})[_0xd34b('0x45')](function(_0x2ad613){logger[_0xd34b('0x2a')](_0xd34b('0x52'),_0x2ad613);throw _0x2ad613;});}return _0x149b3f;})[_0xd34b('0x26')](respondWithResult(_0x19508c,0xc9))[_0xd34b('0x45')](handleError(_0x19508c,null));};exports[_0xd34b('0x25')]=function(_0x3075e9,_0x3a5856){if(_0x3075e9[_0xd34b('0x4b')]['id']){delete _0x3075e9[_0xd34b('0x4b')]['id'];}return db[_0xd34b('0x2f')][_0xd34b('0x49')]({'where':{'id':_0x3075e9[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](handleEntityNotFound(_0x3a5856,null))['then'](saveUpdates(_0x3075e9[_0xd34b('0x4b')],null))[_0xd34b('0x26')](respondWithResult(_0x3a5856,null))[_0xd34b('0x45')](handleError(_0x3a5856,null));};exports['destroy']=function(_0x1de8ca,_0x816bb9){return db[_0xd34b('0x2f')][_0xd34b('0x49')]({'where':{'id':_0x1de8ca[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](handleEntityNotFound(_0x816bb9,null))[_0xd34b('0x26')](removeEntity(_0x816bb9,null))['catch'](handleError(_0x816bb9,null));};exports[_0xd34b('0x53')]=function(_0x3bc817,_0x35d484,_0x4cae9e){return db[_0xd34b('0x2f')][_0xd34b('0x54')]({'where':{'id':_0x3bc817[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](handleEntityNotFound(_0x35d484,null))[_0xd34b('0x26')](function(_0x29b4c0){if(!_0x3bc817[_0xd34b('0x33')][_0xd34b('0x55')]||!utils['isValidChannel'](_0x3bc817[_0xd34b('0x33')][_0xd34b('0x55')])){throw new db['Sequelize'][(_0xd34b('0x56'))](_0xd34b('0x57'));}var _0x5e4fa2={};var _0x5b8151={};_0x5b8151[_0xd34b('0x32')]=_[_0xd34b('0x34')](db[_[_0xd34b('0x58')](_0x3bc817[_0xd34b('0x33')]['channel'][_0xd34b('0x59')]())+_0xd34b('0x5a')][_0xd34b('0x48')]);_0x5b8151[_0xd34b('0x33')]=_[_0xd34b('0x34')](_0x3bc817['query']);_0x5b8151[_0xd34b('0x35')]=_[_0xd34b('0x37')](_0x5b8151[_0xd34b('0x32')],_0x5b8151['query']);_0x5e4fa2[_0xd34b('0x36')]=_[_0xd34b('0x37')](_0x5b8151[_0xd34b('0x32')],qs[_0xd34b('0x38')](_0x3bc817[_0xd34b('0x33')][_0xd34b('0x38')]));_0x5e4fa2[_0xd34b('0x36')]=_0x5e4fa2['attributes']['length']?_0x5e4fa2[_0xd34b('0x36')]:_0x5b8151['model'];_0x5e4fa2[_0xd34b('0x20')]=qs[_0xd34b('0x20')](_0x3bc817[_0xd34b('0x33')]['limit']);_0x5e4fa2['offset']=qs[_0xd34b('0x1f')](_0x3bc817[_0xd34b('0x33')][_0xd34b('0x1f')]);_0x5e4fa2[_0xd34b('0x5b')]=qs['sort'](_0x3bc817['query'][_0xd34b('0x3a')]);_0x5e4fa2[_0xd34b('0x3c')]=qs[_0xd34b('0x35')](_['pick'](_0x3bc817['query'],_0x5b8151[_0xd34b('0x35')]));_0x5e4fa2=_[_0xd34b('0x3d')]({},_0x5e4fa2,_0x3bc817[_0xd34b('0x40')]);return _0x29b4c0[_0xd34b('0x4d')+_[_0xd34b('0x58')](_0x3bc817[_0xd34b('0x33')][_0xd34b('0x55')][_0xd34b('0x59')]())+_0xd34b('0x5c')](_0x5e4fa2);})[_0xd34b('0x26')](respondWithResult(_0x35d484,null))['catch'](handleError(_0x35d484,null));};exports[_0xd34b('0x5d')]=function(_0x24e6a2,_0x41510f,_0x338c7a){return db[_0xd34b('0x2f')][_0xd34b('0x54')]({'where':{'id':_0x24e6a2[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](function(_0x163f0f){if(_0x163f0f){if(!_0x24e6a2[_0xd34b('0x4b')][_0xd34b('0x55')]||!utils[_0xd34b('0x5e')](_0x24e6a2['body']['channel'])){throw new db['Sequelize'][(_0xd34b('0x56'))]('Unknown\x20channel');}return _0x163f0f[_0xd34b('0x5f')+_[_0xd34b('0x58')](_0x24e6a2['body'][_0xd34b('0x55')][_0xd34b('0x59')]())+'Queues'](_0x24e6a2[_0xd34b('0x4b')]['ids']);}return null;})[_0xd34b('0x26')](handleEntityNotFound(_0x41510f,null))['then'](respondWithStatusCode(_0x41510f,null))[_0xd34b('0x45')](handleError(_0x41510f,null));};exports[_0xd34b('0x60')]=function(_0x9be403,_0x44a95b,_0x155668){return db[_0xd34b('0x2f')]['findOne']({'where':{'id':_0x9be403['params']['id']}})['then'](function(_0xafc1d7){if(_0xafc1d7){if(!_0x9be403[_0xd34b('0x33')][_0xd34b('0x55')]||!utils[_0xd34b('0x5e')](_0x9be403['query'][_0xd34b('0x55')])){throw new db[(_0xd34b('0x61'))]['ValidationError']('Unknown\x20channel');}return _0xafc1d7[_0xd34b('0x62')+_[_0xd34b('0x58')](_0x9be403[_0xd34b('0x33')][_0xd34b('0x55')][_0xd34b('0x59')]())+_0xd34b('0x5c')](_0x9be403['query'][_0xd34b('0x63')]);}return null;})['then'](handleEntityNotFound(_0x44a95b,null))['then'](respondWithStatusCode(_0x44a95b,null))[_0xd34b('0x45')](handleError(_0x44a95b,null));};exports[_0xd34b('0x64')]=function(_0x348b4a,_0x19abe9,_0x38714d){return db[_0xd34b('0x2f')][_0xd34b('0x49')]({'where':{'id':_0x348b4a[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](handleEntityNotFound(_0x19abe9,null))[_0xd34b('0x26')](function(_0xac0a54){if(_0xac0a54){var _0x1497ee=[_0xd34b('0x65'),_0xd34b('0x66'),'Mail',_0xd34b('0x67'),_0xd34b('0x68'),_0xd34b('0x69')];return BPromise[_0xd34b('0x6a')](_0x1497ee,function(_0x4fa51c){return _0xac0a54[_0xd34b('0x4d')+_0x4fa51c+_0xd34b('0x5c')]({'attributes':['id',_0xd34b('0x2c')]})['then'](function(_0x92d639){return BPromise['each'](_0x92d639,function(_0x50b6a0){return _0x50b6a0['addAgents'](_0x348b4a['body'][_0xd34b('0x63')])['then'](function(){if(_0x4fa51c===_0xd34b('0x65')){return db[_0xd34b('0x6b')][_0xd34b('0x43')]({'where':{'id':_0x348b4a['body'][_0xd34b('0x63')]},'attributes':['id',_0xd34b('0x2c'),_0xd34b('0x6c'),_0xd34b('0x6d'),_0xd34b('0x6e')],'raw':!![]})['then'](function(_0xcfd416){return BPromise[_0xd34b('0x6a')](_[_0xd34b('0x3f')](_0xcfd416,{'online':0x1}),function(_0x2cc811){return db['UserVoiceQueueRt'][_0xd34b('0x6f')]({'membername':_0x2cc811[_0xd34b('0x2c')],'UserId':_0x2cc811['id'],'queue_name':_0x50b6a0[_0xd34b('0x2c')],'VoiceQueueId':_0x50b6a0['id'],'interface':_[_0xd34b('0x70')](_0x2cc811['interface'])?util[_0xd34b('0x71')](_0xd34b('0x72'),_0x2cc811[_0xd34b('0x2c')]):_0x2cc811[_0xd34b('0x6e')],'paused':_0x2cc811[_0xd34b('0x6d')]||![],'penalty':0x0});});});}});});})[_0xd34b('0x26')](function(){return _0xac0a54;});})[_0xd34b('0x26')](function(){return _0xac0a54;});}})[_0xd34b('0x26')](function(_0x493497){if(_0x493497){return _0x493497[_0xd34b('0x64')](_0x348b4a[_0xd34b('0x4b')][_0xd34b('0x63')],_['omit'](_0x348b4a[_0xd34b('0x4b')],[_0xd34b('0x63'),'id'])||{})[_0xd34b('0x73')](function(_0xf836a7){for(var _0x1290ab=0x0;_0x1290ab<_0x348b4a[_0xd34b('0x4b')][_0xd34b('0x63')][_0xd34b('0x74')];_0x1290ab+=0x1){socket[_0xd34b('0x75')](_0xd34b('0x76'),{'UserId':_0x348b4a[_0xd34b('0x4b')][_0xd34b('0x63')][_0x1290ab],'TeamId':_0x348b4a[_0xd34b('0x47')]['id']});}return _0xf836a7;});}})['then'](respondWithResult(_0x19abe9,null))['catch'](handleError(_0x19abe9,null));};exports['removeAgents']=function(_0x56502e,_0x106aa7,_0xaf6ebc){return db['Team'][_0xd34b('0x49')]({'where':{'id':_0x56502e[_0xd34b('0x47')]['id']}})[_0xd34b('0x26')](handleEntityNotFound(_0x106aa7,null))[_0xd34b('0x26')](function(_0x50f02d){if(_0x50f02d){return BPromise[_0xd34b('0x6a')]([_0xd34b('0x77'),_0xd34b('0x78'),_0xd34b('0x79'),_0xd34b('0x7a'),_0xd34b('0x7b'),'openchannel'],function(_0x5b3d55){return _0x50f02d[_0xd34b('0x4d')+_[_0xd34b('0x58')](_0x5b3d55)+_0xd34b('0x5c')]({'attributes':['id',_0xd34b('0x2c')]})[_0xd34b('0x26')](function(_0x5d1009){return BPromise[_0xd34b('0x6a')](_0x5d1009,function(_0x42ba74){return _0x42ba74[_0xd34b('0x7c')](_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')])[_0xd34b('0x26')](function(){if(_0x5b3d55==='voice'){return db[_0xd34b('0x7d')][_0xd34b('0x27')]({'where':{'VoiceQueueId':_0x42ba74['id'],'UserId':_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')]}});}});});})[_0xd34b('0x26')](function(){return _0x50f02d;});})[_0xd34b('0x26')](function(){return _0x50f02d;});}})[_0xd34b('0x26')](function(_0x164f09){if(_0x164f09){return _0x164f09[_0xd34b('0x7c')](_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')])[_0xd34b('0x26')](function(){if(_['isArray'](_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')])){for(var _0x414e00=0x0;_0x414e00<_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')][_0xd34b('0x74')];_0x414e00+=0x1){socket[_0xd34b('0x75')](_0xd34b('0x7e'),{'UserId':Number(_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')][_0x414e00]),'TeamId':Number(_0x56502e[_0xd34b('0x47')]['id'])});}}else{socket[_0xd34b('0x75')](_0xd34b('0x7e'),{'UserId':Number(_0x56502e[_0xd34b('0x33')][_0xd34b('0x63')]),'TeamId':Number(_0x56502e[_0xd34b('0x47')]['id'])});}});}})[_0xd34b('0x26')](respondWithStatusCode(_0x106aa7,null))[_0xd34b('0x45')](handleError(_0x106aa7,null));};exports[_0xd34b('0x7f')]=function(_0x2dd131,_0x11a876,_0xf34434){var _0x43add4={};var _0x4e1cb0={};var _0x3e141d;var _0xb3ec05;return db[_0xd34b('0x2f')][_0xd34b('0x54')]({'where':{'id':_0x2dd131[_0xd34b('0x47')]['id']}})['then'](handleEntityNotFound(_0x11a876,null))[_0xd34b('0x26')](function(_0x3eb15c){if(_0x3eb15c){_0x3e141d=_0x3eb15c;_0x4e1cb0[_0xd34b('0x32')]=_[_0xd34b('0x34')](db['User'][_0xd34b('0x48')]);_0x4e1cb0['query']=_[_0xd34b('0x34')](_0x2dd131['query']);_0x4e1cb0[_0xd34b('0x35')]=_[_0xd34b('0x37')](_0x4e1cb0[_0xd34b('0x32')],_0x4e1cb0[_0xd34b('0x33')]);_0x43add4['attributes']=_['intersection'](_0x4e1cb0[_0xd34b('0x32')],qs['fields'](_0x2dd131[_0xd34b('0x33')][_0xd34b('0x38')]));_0x43add4[_0xd34b('0x36')]=_0x43add4[_0xd34b('0x36')]['length']?_0x43add4['attributes']:_0x4e1cb0[_0xd34b('0x32')];_0x43add4[_0xd34b('0x5b')]=qs['sort'](_0x2dd131[_0xd34b('0x33')]['sort']);_0x43add4[_0xd34b('0x3c')]=qs[_0xd34b('0x35')](_['pick'](_0x2dd131[_0xd34b('0x33')],_0x4e1cb0[_0xd34b('0x35')]));if(_0x2dd131[_0xd34b('0x33')][_0xd34b('0x3f')]){_0x43add4['where']=_[_0xd34b('0x3d')](_0x43add4[_0xd34b('0x3c')],{'$or':_[_0xd34b('0x2e')](_0x43add4[_0xd34b('0x36')],function(_0x575aec){var _0x4526c1={};_0x4526c1[_0x575aec]={'$like':'%'+_0x2dd131[_0xd34b('0x33')]['filter']+'%'};return _0x4526c1;})});}_0x43add4=_[_0xd34b('0x3d')]({},_0x43add4,_0x2dd131[_0xd34b('0x40')]);return _0x3e141d[_0xd34b('0x7f')](_0x43add4);}})[_0xd34b('0x26')](function(_0x15d16f){if(_0x15d16f){_0xb3ec05=_0x15d16f[_0xd34b('0x74')];if(!_0x2dd131['query'][_0xd34b('0x80')]('nolimit')){_0x43add4[_0xd34b('0x20')]=qs[_0xd34b('0x20')](_0x2dd131[_0xd34b('0x33')][_0xd34b('0x20')]);_0x43add4['offset']=qs[_0xd34b('0x1f')](_0x2dd131[_0xd34b('0x33')][_0xd34b('0x1f')]);}return _0x3e141d[_0xd34b('0x7f')](_0x43add4);}})['then'](function(_0x103d21){if(_0x103d21){return _0x103d21?{'count':_0xb3ec05,'rows':_0x103d21}:null;}})[_0xd34b('0x26')](respondWithResult(_0x11a876,null))['catch'](handleError(_0x11a876,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 652410b..c02f660 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 _0xe3fd=['remove','hasOwnProperty','hook','exports','../../mysqldb','Team','save','update'];(function(_0x1a8c53,_0x18edd0){var _0x1315ac=function(_0x20e609){while(--_0x20e609){_0x1a8c53['push'](_0x1a8c53['shift']());}};_0x1315ac(++_0x18edd0);}(_0xe3fd,0x1d4));var _0xde3f=function(_0x24ac9b,_0x36ac5){_0x24ac9b=_0x24ac9b-0x0;var _0x3eeae3=_0xe3fd[_0x24ac9b];return _0x3eeae3;};'use strict';var EventEmitter=require('events');var Team=require(_0xde3f('0x0'))['db'][_0xde3f('0x1')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xde3f('0x2'),'afterUpdate':_0xde3f('0x3'),'afterDestroy':_0xde3f('0x4')};function emitEvent(_0x475b95){return function(_0x3deb65,_0x2e16a4,_0x5705ec){TeamEvents['emit'](_0x475b95+':'+_0x3deb65['id'],_0x3deb65);TeamEvents['emit'](_0x475b95,_0x3deb65);_0x5705ec(null);};}for(var e in events){if(events[_0xde3f('0x5')](e)){var event=events[e];Team[_0xde3f('0x6')](e,emitEvent(event));}}module[_0xde3f('0x7')]=TeamEvents; \ No newline at end of file +var _0x21f9=['events','../../mysqldb','Team','save','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x21f9,0xe6));var _0x921f=function(_0x314210,_0x337540){_0x314210=_0x314210-0x0;var _0x45b142=_0x21f9[_0x314210];return _0x45b142;};'use strict';var EventEmitter=require(_0x921f('0x0'));var Team=require(_0x921f('0x1'))['db'][_0x921f('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x921f('0x3'),'afterUpdate':_0x921f('0x4'),'afterDestroy':_0x921f('0x5')};function emitEvent(_0xd16659){return function(_0x62804,_0x35ec03,_0x562aae){TeamEvents['emit'](_0xd16659+':'+_0x62804['id'],_0x62804);TeamEvents[_0x921f('0x6')](_0xd16659,_0x62804);_0x562aae(null);};}for(var e in events){if(events[_0x921f('0x7')](e)){var event=events[e];Team[_0x921f('0x8')](e,emitEvent(event));}}module[_0x921f('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index c8f95e4..ad7965d 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 _0x087e=['bluebird','request-promise','path','../../config/environment','./team.attributes','exports','define','Team','teams','lodash','util','../../config/logger','api','moment'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x087e,0x1f3));var _0xe087=function(_0x1f4aca,_0x37220b){_0x1f4aca=_0x1f4aca-0x0;var _0x22b59f=_0x087e[_0x1f4aca];return _0x22b59f;};'use strict';var _=require(_0xe087('0x0'));var util=require(_0xe087('0x1'));var logger=require(_0xe087('0x2'))(_0xe087('0x3'));var moment=require(_0xe087('0x4'));var BPromise=require(_0xe087('0x5'));var rp=require(_0xe087('0x6'));var fs=require('fs');var path=require(_0xe087('0x7'));var rimraf=require('rimraf');var config=require(_0xe087('0x8'));var attributes=require(_0xe087('0x9'));module[_0xe087('0xa')]=function(_0x1698e9,_0x2d88df){return _0x1698e9[_0xe087('0xb')](_0xe087('0xc'),attributes,{'tableName':_0xe087('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4661=['api','moment','bluebird','request-promise','../../config/environment','./team.attributes','define','Team','teams','util'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x4661,0x135));var _0x1466=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x4661[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x1466('0x0'));var logger=require('../../config/logger')(_0x1466('0x1'));var moment=require(_0x1466('0x2'));var BPromise=require(_0x1466('0x3'));var rp=require(_0x1466('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1466('0x5'));var attributes=require(_0x1466('0x6'));module['exports']=function(_0x3d2fd6,_0x460c54){return _0x3d2fd6[_0x1466('0x7')](_0x1466('0x8'),attributes,{'tableName':_0x1466('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 4603f08..b8dd94f 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 _0x1721=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./team.socket','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Team,\x20%s,\x20%s','catch','lodash','util','moment'];(function(_0x22f48d,_0x51b8e1){var _0x26ba9a=function(_0x5ee718){while(--_0x5ee718){_0x22f48d['push'](_0x22f48d['shift']());}};_0x26ba9a(++_0x51b8e1);}(_0x1721,0x102));var _0x1172=function(_0x230c8c,_0x5a39c2){_0x230c8c=_0x230c8c-0x0;var _0x443f00=_0x1721[_0x230c8c];return _0x443f00;};'use strict';var _=require(_0x1172('0x0'));var util=require(_0x1172('0x1'));var moment=require(_0x1172('0x2'));var BPromise=require('bluebird');var rs=require(_0x1172('0x3'));var fs=require('fs');var Redis=require(_0x1172('0x4'));var db=require(_0x1172('0x5'))['db'];var utils=require(_0x1172('0x6'));var logger=require('../../config/logger')(_0x1172('0x7'));var config=require('../../config/environment');var jayson=require(_0x1172('0x8'));var client=jayson[_0x1172('0x9')][_0x1172('0xa')]({'port':0x232a});config[_0x1172('0xb')]=_[_0x1172('0xc')](config[_0x1172('0xb')],{'host':_0x1172('0xd'),'port':0x18eb});var socket=require(_0x1172('0xe'))(new Redis(config[_0x1172('0xb')]));require(_0x1172('0xf'))[_0x1172('0x10')](socket);function respondWithRpcPromise(_0x2bd401,_0x5b5b91,_0x250092){return new BPromise(function(_0x4f719d,_0x53769d){return client[_0x1172('0x11')](_0x2bd401,_0x250092)[_0x1172('0x12')](function(_0x177685){logger[_0x1172('0x13')]('Team,\x20%s,\x20%s',_0x5b5b91,_0x1172('0x14'));logger[_0x1172('0x15')](_0x1172('0x16'),_0x5b5b91,'request\x20sent',JSON[_0x1172('0x17')](_0x177685));if(_0x177685[_0x1172('0x18')]){if(_0x177685[_0x1172('0x18')][_0x1172('0x19')]===0x1f4){logger[_0x1172('0x18')]('Team,\x20%s,\x20%s',_0x5b5b91,_0x177685[_0x1172('0x18')][_0x1172('0x1a')]);return _0x53769d(_0x177685[_0x1172('0x18')][_0x1172('0x1a')]);}logger[_0x1172('0x18')](_0x1172('0x1b'),_0x5b5b91,_0x177685[_0x1172('0x18')][_0x1172('0x1a')]);return _0x4f719d(_0x177685['error']['message']);}else{logger[_0x1172('0x13')](_0x1172('0x1b'),_0x5b5b91,'request\x20sent');_0x4f719d(_0x177685['result']['message']);}})[_0x1172('0x1c')](function(_0x4d0702){logger['error']('Team,\x20%s,\x20%s',_0x5b5b91,_0x4d0702);_0x53769d(_0x4d0702);});});} \ No newline at end of file +var _0x214a=['http','redis','defaults','localhost','socket.io-emitter','./team.socket','request','then','info','Team,\x20%s,\x20%s','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x31a371,_0x50828e){var _0x2a5bd6=function(_0x2fb481){while(--_0x2fb481){_0x31a371['push'](_0x31a371['shift']());}};_0x2a5bd6(++_0x50828e);}(_0x214a,0x1f2));var _0xa214=function(_0x563e0d,_0x4da67e){_0x563e0d=_0x563e0d-0x0;var _0xd9fcfc=_0x214a[_0x563e0d];return _0xd9fcfc;};'use strict';var _=require(_0xa214('0x0'));var util=require(_0xa214('0x1'));var moment=require(_0xa214('0x2'));var BPromise=require(_0xa214('0x3'));var rs=require(_0xa214('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa214('0x5'))['db'];var utils=require(_0xa214('0x6'));var logger=require(_0xa214('0x7'))(_0xa214('0x8'));var config=require(_0xa214('0x9'));var jayson=require(_0xa214('0xa'));var client=jayson[_0xa214('0xb')][_0xa214('0xc')]({'port':0x232a});config[_0xa214('0xd')]=_[_0xa214('0xe')](config['redis'],{'host':_0xa214('0xf'),'port':0x18eb});var socket=require(_0xa214('0x10'))(new Redis(config[_0xa214('0xd')]));require(_0xa214('0x11'))['register'](socket);function respondWithRpcPromise(_0x4ad71d,_0x5c71e6,_0x3bbb0c){return new BPromise(function(_0x1a5524,_0x895b2f){return client[_0xa214('0x12')](_0x4ad71d,_0x3bbb0c)[_0xa214('0x13')](function(_0x13fba7){logger[_0xa214('0x14')](_0xa214('0x15'),_0x5c71e6,'request\x20sent');logger[_0xa214('0x16')](_0xa214('0x17'),_0x5c71e6,_0xa214('0x18'),JSON[_0xa214('0x19')](_0x13fba7));if(_0x13fba7[_0xa214('0x1a')]){if(_0x13fba7[_0xa214('0x1a')]['code']===0x1f4){logger[_0xa214('0x1a')](_0xa214('0x15'),_0x5c71e6,_0x13fba7[_0xa214('0x1a')][_0xa214('0x1b')]);return _0x895b2f(_0x13fba7[_0xa214('0x1a')]['message']);}logger[_0xa214('0x1a')]('Team,\x20%s,\x20%s',_0x5c71e6,_0x13fba7['error'][_0xa214('0x1b')]);return _0x1a5524(_0x13fba7['error'][_0xa214('0x1b')]);}else{logger['info'](_0xa214('0x15'),_0x5c71e6,_0xa214('0x18'));_0x1a5524(_0x13fba7[_0xa214('0x1c')]['message']);}})[_0xa214('0x1d')](function(_0x1ff405){logger[_0xa214('0x1a')](_0xa214('0x15'),_0x5c71e6,_0x1ff405);_0x895b2f(_0x1ff405);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e3f88e2..e339001 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 _0xb7f0=['emit','removeListener','register','length','team:','./team.events','save','remove','update'];(function(_0x26e9d8,_0x4e7d4c){var _0x1df29d=function(_0x3f5cbd){while(--_0x3f5cbd){_0x26e9d8['push'](_0x26e9d8['shift']());}};_0x1df29d(++_0x4e7d4c);}(_0xb7f0,0x1eb));var _0x0b7f=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xb7f0[_0x31e29a];return _0x32d892;};'use strict';var TeamEvents=require(_0x0b7f('0x0'));var events=[_0x0b7f('0x1'),_0x0b7f('0x2'),_0x0b7f('0x3')];function createListener(_0x4d30e5,_0x47efe2){return function(_0x3f0c98){_0x47efe2[_0x0b7f('0x4')](_0x4d30e5,_0x3f0c98);};}function removeListener(_0x228377,_0x188ea8){return function(){TeamEvents[_0x0b7f('0x5')](_0x228377,_0x188ea8);};}exports[_0x0b7f('0x6')]=function(_0x1c3c26){for(var _0x1ba1e8=0x0,_0x10dc6c=events[_0x0b7f('0x7')];_0x1ba1e8<_0x10dc6c;_0x1ba1e8++){var _0x53f9a5=events[_0x1ba1e8];var _0x98065a=createListener(_0x0b7f('0x8')+_0x53f9a5,_0x1c3c26);TeamEvents['on'](_0x53f9a5,_0x98065a);}}; \ No newline at end of file +var _0xd2f5=['length','team:','./team.events','remove','emit','removeListener','register'];(function(_0x258b2f,_0x16706c){var _0x4798a1=function(_0x127db8){while(--_0x127db8){_0x258b2f['push'](_0x258b2f['shift']());}};_0x4798a1(++_0x16706c);}(_0xd2f5,0x144));var _0x5d2f=function(_0x2654b3,_0xfc640b){_0x2654b3=_0x2654b3-0x0;var _0x49123b=_0xd2f5[_0x2654b3];return _0x49123b;};'use strict';var TeamEvents=require(_0x5d2f('0x0'));var events=['save',_0x5d2f('0x1'),'update'];function createListener(_0x2a7bb2,_0x4b9d79){return function(_0x784b59){_0x4b9d79[_0x5d2f('0x2')](_0x2a7bb2,_0x784b59);};}function removeListener(_0x102911,_0xc7102b){return function(){TeamEvents[_0x5d2f('0x3')](_0x102911,_0xc7102b);};}exports[_0x5d2f('0x4')]=function(_0x2392df){for(var _0x16e9fa=0x0,_0x4b2540=events[_0x5d2f('0x5')];_0x16e9fa<_0x4b2540;_0x16e9fa++){var _0x908c6=events[_0x16e9fa];var _0x1c8c59=createListener(_0x5d2f('0x6')+_0x908c6,_0x2392df);TeamEvents['on'](_0x908c6,_0x1c8c59);}}; \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 0bea5a0..76abdfa 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 _0xe5c9=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index','show','post','create','put','update','delete','/:id','destroy','exports'];(function(_0xe9660d,_0x5801c9){var _0x167062=function(_0x35c9d7){while(--_0x35c9d7){_0xe9660d['push'](_0xe9660d['shift']());}};_0x167062(++_0x5801c9);}(_0xe5c9,0x1e3));var _0x9e5c=function(_0x19a73e,_0x365967){_0x19a73e=_0x19a73e-0x0;var _0x4b3283=_0xe5c9[_0x19a73e];return _0x4b3283;};'use strict';var multer=require('multer');var util=require(_0x9e5c('0x0'));var path=require(_0x9e5c('0x1'));var timeout=require(_0x9e5c('0x2'));var express=require(_0x9e5c('0x3'));var router=express[_0x9e5c('0x4')]();var auth=require(_0x9e5c('0x5'));var interaction=require(_0x9e5c('0x6'));var config=require(_0x9e5c('0x7'));var controller=require(_0x9e5c('0x8'));router[_0x9e5c('0x9')]('/',auth[_0x9e5c('0xa')](),controller[_0x9e5c('0xb')]);router[_0x9e5c('0x9')]('/:id',auth[_0x9e5c('0xa')](),controller[_0x9e5c('0xc')]);router[_0x9e5c('0xd')]('/',auth[_0x9e5c('0xa')](),controller[_0x9e5c('0xe')]);router[_0x9e5c('0xf')]('/:id',auth[_0x9e5c('0xa')](),controller[_0x9e5c('0x10')]);router[_0x9e5c('0x11')](_0x9e5c('0x12'),auth[_0x9e5c('0xa')](),controller[_0x9e5c('0x13')]);module[_0x9e5c('0x14')]=router; \ No newline at end of file +var _0x1c7c=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','show','post','create','put','/:id','update','destroy'];(function(_0x4e676e,_0x2a7c6d){var _0x336a3c=function(_0x4767c4){while(--_0x4767c4){_0x4e676e['push'](_0x4e676e['shift']());}};_0x336a3c(++_0x2a7c6d);}(_0x1c7c,0x11e));var _0xc1c7=function(_0x8d13ed,_0x1449e5){_0x8d13ed=_0x8d13ed-0x0;var _0x5f0b91=_0x1c7c[_0x8d13ed];return _0x5f0b91;};'use strict';var multer=require(_0xc1c7('0x0'));var util=require(_0xc1c7('0x1'));var path=require(_0xc1c7('0x2'));var timeout=require(_0xc1c7('0x3'));var express=require('express');var router=express[_0xc1c7('0x4')]();var auth=require(_0xc1c7('0x5'));var interaction=require(_0xc1c7('0x6'));var config=require(_0xc1c7('0x7'));var controller=require(_0xc1c7('0x8'));router[_0xc1c7('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xc1c7('0x9')]('/:id',auth[_0xc1c7('0xa')](),controller[_0xc1c7('0xb')]);router[_0xc1c7('0xc')]('/',auth[_0xc1c7('0xa')](),controller[_0xc1c7('0xd')]);router[_0xc1c7('0xe')](_0xc1c7('0xf'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0x10')]);router['delete'](_0xc1c7('0xf'),auth[_0xc1c7('0xa')](),controller[_0xc1c7('0x11')]);module[_0xc1c7('0x12')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index a59ac96..75579ed 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 _0xa9a2=['STRING','TEXT','sequelize'];(function(_0x2612f6,_0x16d381){var _0x20d731=function(_0x4cf03d){while(--_0x4cf03d){_0x2612f6['push'](_0x2612f6['shift']());}};_0x20d731(++_0x16d381);}(_0xa9a2,0x1af));var _0x2a9a=function(_0x3ce6d2,_0x90364d){_0x3ce6d2=_0x3ce6d2-0x0;var _0x4c1dd4=_0xa9a2[_0x3ce6d2];return _0x4c1dd4;};'use strict';var Sequelize=require(_0x2a9a('0x0'));module['exports']={'name':{'type':Sequelize[_0x2a9a('0x1')]},'description':{'type':Sequelize[_0x2a9a('0x1')]},'html':{'type':Sequelize[_0x2a9a('0x2')]}}; \ No newline at end of file +var _0x0f95=['TEXT','sequelize','exports','STRING'];(function(_0x15a3d3,_0x1fe368){var _0x1fa778=function(_0x3ad80a){while(--_0x3ad80a){_0x15a3d3['push'](_0x15a3d3['shift']());}};_0x1fa778(++_0x1fe368);}(_0x0f95,0x125));var _0x50f9=function(_0x193e28,_0x3dac1d){_0x193e28=_0x193e28-0x0;var _0x20ef59=_0x0f95[_0x193e28];return _0x20ef59;};'use strict';var Sequelize=require(_0x50f9('0x0'));module[_0x50f9('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x50f9('0x2')]},'html':{'type':Sequelize[_0x50f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index d717937..6fdfedf 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 _0xaeff=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','end','status','count','offset','limit','set','json','apply','reject','update','then','get','Templates','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','Template','findAll','rows','catch','show','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','squel','crypto','to-csv','querystring'];(function(_0x240289,_0x2b1170){var _0x242b43=function(_0x3c96a6){while(--_0x3c96a6){_0x240289['push'](_0x240289['shift']());}};_0x242b43(++_0x2b1170);}(_0xaeff,0x1de));var _0xfaef=function(_0x977abd,_0x3d0eb4){_0x977abd=_0x977abd-0x0;var _0xb0d6c1=_0xaeff[_0x977abd];return _0xb0d6c1;};'use strict';var pdf=require(_0xfaef('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xfaef('0x1'));var zipdir=require(_0xfaef('0x2'));var jsonpatch=require(_0xfaef('0x3'));var rp=require(_0xfaef('0x4'));var moment=require('moment');var BPromise=require(_0xfaef('0x5'));var Mustache=require(_0xfaef('0x6'));var util=require(_0xfaef('0x7'));var path=require(_0xfaef('0x8'));var sox=require(_0xfaef('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0xfaef('0xa'));var crypto=require(_0xfaef('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xfaef('0xc'));var querystring=require(_0xfaef('0xd'));var Papa=require(_0xfaef('0xe'));var Redis=require(_0xfaef('0xf'));var authService=require(_0xfaef('0x10'));var qs=require(_0xfaef('0x11'));var as=require(_0xfaef('0x12'));var hardwareService=require(_0xfaef('0x13'));var logger=require('../../config/logger')(_0xfaef('0x14'));var utils=require(_0xfaef('0x15'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x922c44,_0x96d55d){_0x96d55d=_0x96d55d||0xcc;return function(_0x58f5a7){if(_0x58f5a7){return _0x922c44[_0xfaef('0x16')](_0x96d55d);}return _0x922c44['status'](_0x96d55d)[_0xfaef('0x17')]();};}function respondWithResult(_0x1fb3cf,_0x3e973d){_0x3e973d=_0x3e973d||0xc8;return function(_0x4cb604){if(_0x4cb604){return _0x1fb3cf[_0xfaef('0x18')](_0x3e973d)['json'](_0x4cb604);}};}function respondWithFilteredResult(_0x7d72dc,_0x5c820c){return function(_0x2c76f6){if(_0x2c76f6){var _0x2af6a8=_0x2c76f6[_0xfaef('0x19')],_0x1c27ae=_0x5c820c[_0xfaef('0x1a')],_0x9e3e2f=_0x5c820c[_0xfaef('0x1a')]+_0x5c820c[_0xfaef('0x1b')],_0x13f7a2;if(_0x9e3e2f>=_0x2af6a8){_0x9e3e2f=_0x2af6a8;_0x13f7a2=0xc8;}else{_0x13f7a2=0xce;}_0x7d72dc[_0xfaef('0x18')](_0x13f7a2);return _0x7d72dc[_0xfaef('0x1c')]('Content-Range',_0x1c27ae+'-'+_0x9e3e2f+'/'+_0x2af6a8)[_0xfaef('0x1d')](_0x2c76f6);}return null;};}function patchUpdates(_0x1d1d1e){return function(_0x502afd){try{jsonpatch[_0xfaef('0x1e')](_0x502afd,_0x1d1d1e,!![]);}catch(_0x37eb97){return BPromise[_0xfaef('0x1f')](_0x37eb97);}return _0x502afd['save']();};}function saveUpdates(_0x33ec4d,_0x430f37){return function(_0x209ad2){if(_0x209ad2){return _0x209ad2[_0xfaef('0x20')](_0x33ec4d)['then'](function(_0x33fe85){return _0x33fe85;});}return null;};}function removeEntity(_0x4e088e,_0x4f3435){return function(_0x161ec3){if(_0x161ec3){return _0x161ec3['destroy']()[_0xfaef('0x21')](function(){var _0x3a984a=_0x161ec3[_0xfaef('0x22')]({'plain':!![]});var _0x513dde=_0xfaef('0x23');return db['UserProfileResource'][_0xfaef('0x24')]({'where':{'type':_0x513dde,'resourceId':_0x3a984a['id']}})[_0xfaef('0x21')](function(){return _0x161ec3;});})[_0xfaef('0x21')](function(){_0x4e088e[_0xfaef('0x18')](0xcc)[_0xfaef('0x17')]();});}};}function handleEntityNotFound(_0x131837,_0x3424fb){return function(_0x31edda){if(!_0x31edda){_0x131837['sendStatus'](0x194);}return _0x31edda;};}function handleError(_0x37424d,_0x53bbb9){_0x53bbb9=_0x53bbb9||0x1f4;return function(_0x5c2311){logger[_0xfaef('0x25')](_0x5c2311[_0xfaef('0x26')]);if(_0x5c2311[_0xfaef('0x27')]){delete _0x5c2311[_0xfaef('0x27')];}_0x37424d['status'](_0x53bbb9)[_0xfaef('0x28')](_0x5c2311);};}exports[_0xfaef('0x29')]=function(_0x9a0320,_0x4a6007){var _0x3b2273={},_0x91e12={},_0x1fcd59={'count':0x0,'rows':[]};var _0x44019d=_[_0xfaef('0x2a')](db['Template'][_0xfaef('0x2b')],function(_0x4012f1){return{'name':_0x4012f1[_0xfaef('0x2c')],'type':_0x4012f1[_0xfaef('0x2d')][_0xfaef('0x2e')]};});_0x91e12[_0xfaef('0x2f')]=_[_0xfaef('0x2a')](_0x44019d,_0xfaef('0x27'));_0x91e12[_0xfaef('0x30')]=_[_0xfaef('0x31')](_0x9a0320['query']);_0x91e12[_0xfaef('0x32')]=_[_0xfaef('0x33')](_0x91e12[_0xfaef('0x2f')],_0x91e12[_0xfaef('0x30')]);_0x3b2273['attributes']=_[_0xfaef('0x33')](_0x91e12['model'],qs[_0xfaef('0x34')](_0x9a0320['query'][_0xfaef('0x34')]));_0x3b2273[_0xfaef('0x35')]=_0x3b2273['attributes'][_0xfaef('0x36')]?_0x3b2273[_0xfaef('0x35')]:_0x91e12[_0xfaef('0x2f')];if(!_0x9a0320['query'][_0xfaef('0x37')](_0xfaef('0x38'))){_0x3b2273[_0xfaef('0x1b')]=qs[_0xfaef('0x1b')](_0x9a0320['query'][_0xfaef('0x1b')]);_0x3b2273['offset']=qs[_0xfaef('0x1a')](_0x9a0320[_0xfaef('0x30')][_0xfaef('0x1a')]);}_0x3b2273[_0xfaef('0x39')]=qs[_0xfaef('0x3a')](_0x9a0320[_0xfaef('0x30')][_0xfaef('0x3a')]);_0x3b2273[_0xfaef('0x3b')]=qs[_0xfaef('0x32')](_['pick'](_0x9a0320[_0xfaef('0x30')],_0x91e12[_0xfaef('0x32')]));if(_0x9a0320[_0xfaef('0x30')][_0xfaef('0x3c')]){_0x3b2273[_0xfaef('0x3b')]=_['merge'](_0x3b2273[_0xfaef('0x3b')],{'$or':_[_0xfaef('0x2a')](_0x44019d,function(_0x5c250e){if(_0x5c250e[_0xfaef('0x2d')]!==_0xfaef('0x3d')){var _0x1299bc={};_0x1299bc[_0x5c250e[_0xfaef('0x27')]]={'$like':'%'+_0x9a0320[_0xfaef('0x30')][_0xfaef('0x3c')]+'%'};return _0x1299bc;}})});}_0x3b2273=_[_0xfaef('0x3e')]({},_0x3b2273,_0x9a0320[_0xfaef('0x3f')]);var _0x3a7c8a={'where':_0x3b2273[_0xfaef('0x3b')]};return db['Template'][_0xfaef('0x19')](_0x3a7c8a)[_0xfaef('0x21')](function(_0x122226){_0x1fcd59['count']=_0x122226;if(_0x9a0320['query'][_0xfaef('0x40')]){_0x3b2273[_0xfaef('0x41')]=[{'all':!![]}];}return db[_0xfaef('0x42')][_0xfaef('0x43')](_0x3b2273);})[_0xfaef('0x21')](function(_0x18f95c){_0x1fcd59[_0xfaef('0x44')]=_0x18f95c;return _0x1fcd59;})[_0xfaef('0x21')](respondWithFilteredResult(_0x4a6007,_0x3b2273))[_0xfaef('0x45')](handleError(_0x4a6007,null));};exports[_0xfaef('0x46')]=function(_0x2e5b9d,_0x206489){var _0x206a19={'raw':!![],'where':{'id':_0x2e5b9d['params']['id']}},_0xfb8054={};_0xfb8054['model']=_[_0xfaef('0x31')](db[_0xfaef('0x42')][_0xfaef('0x2b')]);_0xfb8054[_0xfaef('0x30')]=_['keys'](_0x2e5b9d[_0xfaef('0x30')]);_0xfb8054[_0xfaef('0x32')]=_[_0xfaef('0x33')](_0xfb8054[_0xfaef('0x2f')],_0xfb8054['query']);_0x206a19['attributes']=_[_0xfaef('0x33')](_0xfb8054[_0xfaef('0x2f')],qs[_0xfaef('0x34')](_0x2e5b9d[_0xfaef('0x30')][_0xfaef('0x34')]));_0x206a19[_0xfaef('0x35')]=_0x206a19['attributes']['length']?_0x206a19[_0xfaef('0x35')]:_0xfb8054[_0xfaef('0x2f')];if(_0x2e5b9d[_0xfaef('0x30')][_0xfaef('0x40')]){_0x206a19['include']=[{'all':!![]}];}_0x206a19=_[_0xfaef('0x3e')]({},_0x206a19,_0x2e5b9d['options']);return db[_0xfaef('0x42')][_0xfaef('0x47')](_0x206a19)['then'](handleEntityNotFound(_0x206489,null))[_0xfaef('0x21')](respondWithResult(_0x206489,null))[_0xfaef('0x45')](handleError(_0x206489,null));};exports[_0xfaef('0x48')]=function(_0x2b743c,_0x4ce4bf){return db['Template'][_0xfaef('0x48')](_0x2b743c[_0xfaef('0x49')],{})[_0xfaef('0x21')](function(_0x21bdc1){var _0x3d48ce=_0x2b743c[_0xfaef('0x4a')][_0xfaef('0x22')]({'plain':!![]});if(!_0x3d48ce)throw new Error(_0xfaef('0x4b'));if(_0x3d48ce['role']===_0xfaef('0x4a')){var _0x18f35b=_0x21bdc1[_0xfaef('0x22')]({'plain':!![]});var _0x36deaf=_0xfaef('0x23');return db[_0xfaef('0x4c')][_0xfaef('0x47')]({'where':{'name':_0x36deaf,'userProfileId':_0x3d48ce[_0xfaef('0x4d')]},'raw':!![]})[_0xfaef('0x21')](function(_0x57aa14){if(_0x57aa14&&_0x57aa14[_0xfaef('0x4e')]===0x0){return db[_0xfaef('0x4f')][_0xfaef('0x48')]({'name':_0x18f35b[_0xfaef('0x27')],'resourceId':_0x18f35b['id'],'type':_0x57aa14['name'],'sectionId':_0x57aa14['id']},{})[_0xfaef('0x21')](function(){return _0x21bdc1;});}else{return _0x21bdc1;}})['catch'](function(_0x1ccac7){logger[_0xfaef('0x25')](_0xfaef('0x50'),_0x1ccac7);throw _0x1ccac7;});}return _0x21bdc1;})[_0xfaef('0x21')](respondWithResult(_0x4ce4bf,0xc9))[_0xfaef('0x45')](handleError(_0x4ce4bf,null));};exports[_0xfaef('0x20')]=function(_0x341988,_0x3a20f6){if(_0x341988['body']['id']){delete _0x341988[_0xfaef('0x49')]['id'];}return db[_0xfaef('0x42')]['find']({'where':{'id':_0x341988[_0xfaef('0x51')]['id']}})['then'](handleEntityNotFound(_0x3a20f6,null))[_0xfaef('0x21')](saveUpdates(_0x341988['body'],null))['then'](respondWithResult(_0x3a20f6,null))[_0xfaef('0x45')](handleError(_0x3a20f6,null));};exports[_0xfaef('0x24')]=function(_0x49a1cd,_0x6b2875){return db['Template'][_0xfaef('0x47')]({'where':{'id':_0x49a1cd[_0xfaef('0x51')]['id']}})[_0xfaef('0x21')](handleEntityNotFound(_0x6b2875,null))[_0xfaef('0x21')](removeEntity(_0x6b2875,null))[_0xfaef('0x45')](handleError(_0x6b2875,null));}; \ No newline at end of file +var _0x8ef5=['zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','error','stack','name','index','map','Template','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','find','html-pdf','eml-format','rimraf'];(function(_0x2edfbf,_0x5f0e97){var _0x22560e=function(_0x4f66a7){while(--_0x4f66a7){_0x2edfbf['push'](_0x2edfbf['shift']());}};_0x22560e(++_0x5f0e97);}(_0x8ef5,0xed));var _0x58ef=function(_0x52b146,_0x30570d){_0x52b146=_0x52b146-0x0;var _0x245c8e=_0x8ef5[_0x52b146];return _0x245c8e;};'use strict';var pdf=require(_0x58ef('0x0'));var emlformat=require(_0x58ef('0x1'));var rimraf=require(_0x58ef('0x2'));var zipdir=require(_0x58ef('0x3'));var jsonpatch=require(_0x58ef('0x4'));var rp=require('request-promise');var moment=require(_0x58ef('0x5'));var BPromise=require(_0x58ef('0x6'));var Mustache=require(_0x58ef('0x7'));var util=require(_0x58ef('0x8'));var path=require(_0x58ef('0x9'));var sox=require(_0x58ef('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x58ef('0xb'));var deskjs=require(_0x58ef('0xc'));var toCsv=require(_0x58ef('0xd'));var querystring=require('querystring');var Papa=require(_0x58ef('0xe'));var Redis=require('ioredis');var authService=require(_0x58ef('0xf'));var qs=require(_0x58ef('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x58ef('0x11'));var logger=require(_0x58ef('0x12'))(_0x58ef('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x58ef('0x14'))['db'];function respondWithStatusCode(_0x51aea2,_0x492abe){_0x492abe=_0x492abe||0xcc;return function(_0x317b2a){if(_0x317b2a){return _0x51aea2[_0x58ef('0x15')](_0x492abe);}return _0x51aea2[_0x58ef('0x16')](_0x492abe)[_0x58ef('0x17')]();};}function respondWithResult(_0x2896fa,_0x1ee1c2){_0x1ee1c2=_0x1ee1c2||0xc8;return function(_0x4ea678){if(_0x4ea678){return _0x2896fa['status'](_0x1ee1c2)[_0x58ef('0x18')](_0x4ea678);}};}function respondWithFilteredResult(_0x347d02,_0x28e7dd){return function(_0x62ecf2){if(_0x62ecf2){var _0x34dfbe=_0x62ecf2[_0x58ef('0x19')],_0x4e117d=_0x28e7dd['offset'],_0x5bfb2e=_0x28e7dd[_0x58ef('0x1a')]+_0x28e7dd[_0x58ef('0x1b')],_0x53b356;if(_0x5bfb2e>=_0x34dfbe){_0x5bfb2e=_0x34dfbe;_0x53b356=0xc8;}else{_0x53b356=0xce;}_0x347d02[_0x58ef('0x16')](_0x53b356);return _0x347d02[_0x58ef('0x1c')](_0x58ef('0x1d'),_0x4e117d+'-'+_0x5bfb2e+'/'+_0x34dfbe)['json'](_0x62ecf2);}return null;};}function patchUpdates(_0x3d820e){return function(_0x4be0e6){try{jsonpatch[_0x58ef('0x1e')](_0x4be0e6,_0x3d820e,!![]);}catch(_0x39442d){return BPromise[_0x58ef('0x1f')](_0x39442d);}return _0x4be0e6[_0x58ef('0x20')]();};}function saveUpdates(_0x5caa1e,_0x2ab392){return function(_0x2b4438){if(_0x2b4438){return _0x2b4438[_0x58ef('0x21')](_0x5caa1e)[_0x58ef('0x22')](function(_0x4549da){return _0x4549da;});}return null;};}function removeEntity(_0x1fb031,_0x28eaee){return function(_0x3adcbd){if(_0x3adcbd){return _0x3adcbd[_0x58ef('0x23')]()['then'](function(){var _0x5f11ce=_0x3adcbd[_0x58ef('0x24')]({'plain':!![]});var _0x4f270f=_0x58ef('0x25');return db['UserProfileResource'][_0x58ef('0x23')]({'where':{'type':_0x4f270f,'resourceId':_0x5f11ce['id']}})[_0x58ef('0x22')](function(){return _0x3adcbd;});})[_0x58ef('0x22')](function(){_0x1fb031[_0x58ef('0x16')](0xcc)[_0x58ef('0x17')]();});}};}function handleEntityNotFound(_0x44b0ee,_0x59360a){return function(_0x3a3f1d){if(!_0x3a3f1d){_0x44b0ee[_0x58ef('0x15')](0x194);}return _0x3a3f1d;};}function handleError(_0x1d0afb,_0x4dc6bd){_0x4dc6bd=_0x4dc6bd||0x1f4;return function(_0x5f4569){logger[_0x58ef('0x26')](_0x5f4569[_0x58ef('0x27')]);if(_0x5f4569[_0x58ef('0x28')]){delete _0x5f4569[_0x58ef('0x28')];}_0x1d0afb[_0x58ef('0x16')](_0x4dc6bd)['send'](_0x5f4569);};}exports[_0x58ef('0x29')]=function(_0x14d1ab,_0x210d40){var _0x186d68={},_0x2a6666={},_0x1971b0={'count':0x0,'rows':[]};var _0x43fc3e=_[_0x58ef('0x2a')](db[_0x58ef('0x2b')][_0x58ef('0x2c')],function(_0x555c9f){return{'name':_0x555c9f[_0x58ef('0x2d')],'type':_0x555c9f[_0x58ef('0x2e')][_0x58ef('0x2f')]};});_0x2a6666['model']=_[_0x58ef('0x2a')](_0x43fc3e,_0x58ef('0x28'));_0x2a6666[_0x58ef('0x30')]=_[_0x58ef('0x31')](_0x14d1ab[_0x58ef('0x30')]);_0x2a6666[_0x58ef('0x32')]=_[_0x58ef('0x33')](_0x2a6666[_0x58ef('0x34')],_0x2a6666[_0x58ef('0x30')]);_0x186d68[_0x58ef('0x35')]=_['intersection'](_0x2a6666[_0x58ef('0x34')],qs['fields'](_0x14d1ab[_0x58ef('0x30')][_0x58ef('0x36')]));_0x186d68[_0x58ef('0x35')]=_0x186d68[_0x58ef('0x35')][_0x58ef('0x37')]?_0x186d68['attributes']:_0x2a6666['model'];if(!_0x14d1ab[_0x58ef('0x30')]['hasOwnProperty'](_0x58ef('0x38'))){_0x186d68[_0x58ef('0x1b')]=qs[_0x58ef('0x1b')](_0x14d1ab[_0x58ef('0x30')]['limit']);_0x186d68[_0x58ef('0x1a')]=qs['offset'](_0x14d1ab['query'][_0x58ef('0x1a')]);}_0x186d68[_0x58ef('0x39')]=qs[_0x58ef('0x3a')](_0x14d1ab[_0x58ef('0x30')][_0x58ef('0x3a')]);_0x186d68[_0x58ef('0x3b')]=qs['filters'](_['pick'](_0x14d1ab[_0x58ef('0x30')],_0x2a6666[_0x58ef('0x32')]));if(_0x14d1ab['query'][_0x58ef('0x3c')]){_0x186d68[_0x58ef('0x3b')]=_[_0x58ef('0x3d')](_0x186d68['where'],{'$or':_[_0x58ef('0x2a')](_0x43fc3e,function(_0x1e4d61){if(_0x1e4d61['type']!==_0x58ef('0x3e')){var _0x38e444={};_0x38e444[_0x1e4d61['name']]={'$like':'%'+_0x14d1ab[_0x58ef('0x30')][_0x58ef('0x3c')]+'%'};return _0x38e444;}})});}_0x186d68=_['merge']({},_0x186d68,_0x14d1ab[_0x58ef('0x3f')]);var _0x28bfce={'where':_0x186d68[_0x58ef('0x3b')]};return db[_0x58ef('0x2b')][_0x58ef('0x19')](_0x28bfce)['then'](function(_0x4b30ce){_0x1971b0[_0x58ef('0x19')]=_0x4b30ce;if(_0x14d1ab['query'][_0x58ef('0x40')]){_0x186d68[_0x58ef('0x41')]=[{'all':!![]}];}return db[_0x58ef('0x2b')][_0x58ef('0x42')](_0x186d68);})[_0x58ef('0x22')](function(_0x229954){_0x1971b0[_0x58ef('0x43')]=_0x229954;return _0x1971b0;})[_0x58ef('0x22')](respondWithFilteredResult(_0x210d40,_0x186d68))[_0x58ef('0x44')](handleError(_0x210d40,null));};exports[_0x58ef('0x45')]=function(_0x151a7b,_0x3a29c7){var _0x46a538={'raw':!![],'where':{'id':_0x151a7b[_0x58ef('0x46')]['id']}},_0x54dde3={};_0x54dde3['model']=_['keys'](db['Template'][_0x58ef('0x2c')]);_0x54dde3[_0x58ef('0x30')]=_[_0x58ef('0x31')](_0x151a7b[_0x58ef('0x30')]);_0x54dde3[_0x58ef('0x32')]=_[_0x58ef('0x33')](_0x54dde3[_0x58ef('0x34')],_0x54dde3[_0x58ef('0x30')]);_0x46a538[_0x58ef('0x35')]=_[_0x58ef('0x33')](_0x54dde3[_0x58ef('0x34')],qs['fields'](_0x151a7b[_0x58ef('0x30')]['fields']));_0x46a538[_0x58ef('0x35')]=_0x46a538[_0x58ef('0x35')][_0x58ef('0x37')]?_0x46a538[_0x58ef('0x35')]:_0x54dde3['model'];if(_0x151a7b[_0x58ef('0x30')][_0x58ef('0x40')]){_0x46a538[_0x58ef('0x41')]=[{'all':!![]}];}_0x46a538=_[_0x58ef('0x3d')]({},_0x46a538,_0x151a7b[_0x58ef('0x3f')]);return db['Template']['find'](_0x46a538)[_0x58ef('0x22')](handleEntityNotFound(_0x3a29c7,null))[_0x58ef('0x22')](respondWithResult(_0x3a29c7,null))[_0x58ef('0x44')](handleError(_0x3a29c7,null));};exports[_0x58ef('0x47')]=function(_0x703dbc,_0x328fff){return db[_0x58ef('0x2b')][_0x58ef('0x47')](_0x703dbc[_0x58ef('0x48')],{})[_0x58ef('0x22')](function(_0x58388e){var _0x2f9160=_0x703dbc[_0x58ef('0x49')][_0x58ef('0x24')]({'plain':!![]});if(!_0x2f9160)throw new Error(_0x58ef('0x4a'));if(_0x2f9160['role']===_0x58ef('0x49')){var _0x542e97=_0x58388e['get']({'plain':!![]});var _0x423b5c='Templates';return db[_0x58ef('0x4b')]['find']({'where':{'name':_0x423b5c,'userProfileId':_0x2f9160[_0x58ef('0x4c')]},'raw':!![]})[_0x58ef('0x22')](function(_0x315a0c){if(_0x315a0c&&_0x315a0c[_0x58ef('0x4d')]===0x0){return db[_0x58ef('0x4e')]['create']({'name':_0x542e97[_0x58ef('0x28')],'resourceId':_0x542e97['id'],'type':_0x315a0c[_0x58ef('0x28')],'sectionId':_0x315a0c['id']},{})['then'](function(){return _0x58388e;});}else{return _0x58388e;}})[_0x58ef('0x44')](function(_0x98415){logger[_0x58ef('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x98415);throw _0x98415;});}return _0x58388e;})[_0x58ef('0x22')](respondWithResult(_0x328fff,0xc9))['catch'](handleError(_0x328fff,null));};exports['update']=function(_0x574b5f,_0x34e81a){if(_0x574b5f[_0x58ef('0x48')]['id']){delete _0x574b5f[_0x58ef('0x48')]['id'];}return db[_0x58ef('0x2b')][_0x58ef('0x4f')]({'where':{'id':_0x574b5f[_0x58ef('0x46')]['id']}})[_0x58ef('0x22')](handleEntityNotFound(_0x34e81a,null))[_0x58ef('0x22')](saveUpdates(_0x574b5f['body'],null))[_0x58ef('0x22')](respondWithResult(_0x34e81a,null))[_0x58ef('0x44')](handleError(_0x34e81a,null));};exports[_0x58ef('0x23')]=function(_0x578fc8,_0x42a84d){return db['Template']['find']({'where':{'id':_0x578fc8['params']['id']}})[_0x58ef('0x22')](handleEntityNotFound(_0x42a84d,null))[_0x58ef('0x22')](removeEntity(_0x42a84d,null))['catch'](handleError(_0x42a84d,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index e3dfff2..2dd36ae 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 _0xced1=['./template.attributes','define','Template','tools_templates','util','../../config/logger','api','moment','request-promise','../../config/environment'];(function(_0x508bff,_0x13e6ec){var _0x485675=function(_0x310d26){while(--_0x310d26){_0x508bff['push'](_0x508bff['shift']());}};_0x485675(++_0x13e6ec);}(_0xced1,0xcc));var _0x1ced=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xced1[_0xbca1b1];return _0x4e1686;};'use strict';var _=require('lodash');var util=require(_0x1ced('0x0'));var logger=require(_0x1ced('0x1'))(_0x1ced('0x2'));var moment=require(_0x1ced('0x3'));var BPromise=require('bluebird');var rp=require(_0x1ced('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1ced('0x5'));var attributes=require(_0x1ced('0x6'));module['exports']=function(_0x58789c,_0x2b2f5f){return _0x58789c[_0x1ced('0x7')](_0x1ced('0x8'),attributes,{'tableName':_0x1ced('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18c6=['lodash','util','api','moment','request-promise','path','rimraf','./template.attributes','define','Template','tools_templates'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0x18c6,0xfd));var _0x618c=function(_0x4a7f27,_0x1ae54d){_0x4a7f27=_0x4a7f27-0x0;var _0x3d2190=_0x18c6[_0x4a7f27];return _0x3d2190;};'use strict';var _=require(_0x618c('0x0'));var util=require(_0x618c('0x1'));var logger=require('../../config/logger')(_0x618c('0x2'));var moment=require(_0x618c('0x3'));var BPromise=require('bluebird');var rp=require(_0x618c('0x4'));var fs=require('fs');var path=require(_0x618c('0x5'));var rimraf=require(_0x618c('0x6'));var config=require('../../config/environment');var attributes=require(_0x618c('0x7'));module['exports']=function(_0x17f271,_0x51f49a){return _0x17f271[_0x618c('0x8')](_0x618c('0x9'),attributes,{'tableName':_0x618c('0xa'),'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 9e2c1a8..7fa7f6a 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 _0x5004=['bluebird','ioredis','rpc','../../config/environment','jayson/promise','client','request','then','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw','where','attributes','limit','include','map','model','util','moment'];(function(_0x5b997c,_0x5bd491){var _0x4eb5d2=function(_0x41907c){while(--_0x41907c){_0x5b997c['push'](_0x5b997c['shift']());}};_0x4eb5d2(++_0x5bd491);}(_0x5004,0x134));var _0x4500=function(_0x1d498f,_0xaf35dd){_0x1d498f=_0x1d498f-0x0;var _0x40e01f=_0x5004[_0x1d498f];return _0x40e01f;};'use strict';var _=require('lodash');var util=require(_0x4500('0x0'));var moment=require(_0x4500('0x1'));var BPromise=require(_0x4500('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4500('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4500('0x4'));var config=require(_0x4500('0x5'));var jayson=require(_0x4500('0x6'));var client=jayson[_0x4500('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3f2c03,_0x53dfe3,_0x4a6975){return new BPromise(function(_0x160609,_0x5a516d){return client[_0x4500('0x8')](_0x3f2c03,_0x4a6975)[_0x4500('0x9')](function(_0x2f451a){logger[_0x4500('0xa')](_0x4500('0xb'),_0x53dfe3,_0x4500('0xc'));logger[_0x4500('0xd')](_0x4500('0xe'),_0x53dfe3,_0x4500('0xc'),JSON[_0x4500('0xf')](_0x2f451a));if(_0x2f451a[_0x4500('0x10')]){if(_0x2f451a['error'][_0x4500('0x11')]===0x1f4){logger[_0x4500('0x10')](_0x4500('0xb'),_0x53dfe3,_0x2f451a[_0x4500('0x10')]['message']);return _0x5a516d(_0x2f451a['error'][_0x4500('0x12')]);}logger[_0x4500('0x10')](_0x4500('0xb'),_0x53dfe3,_0x2f451a[_0x4500('0x10')]['message']);return _0x160609(_0x2f451a['error'][_0x4500('0x12')]);}else{logger[_0x4500('0xa')](_0x4500('0xb'),_0x53dfe3,_0x4500('0xc'));_0x160609(_0x2f451a[_0x4500('0x13')][_0x4500('0x12')]);}})[_0x4500('0x14')](function(_0x5eb343){logger[_0x4500('0x10')](_0x4500('0xb'),_0x53dfe3,_0x5eb343);_0x5a516d(_0x5eb343);});});}exports[_0x4500('0x15')]=function(_0x2b17a0){var _0x24e782=this;return new Promise(function(_0x5b756a,_0x268cb9){return db['Template'][_0x4500('0x16')]({'raw':_0x2b17a0[_0x4500('0x17')]?_0x2b17a0[_0x4500('0x17')][_0x4500('0x18')]===undefined?!![]:![]:!![],'where':_0x2b17a0[_0x4500('0x17')]?_0x2b17a0[_0x4500('0x17')][_0x4500('0x19')]||null:null,'attributes':_0x2b17a0[_0x4500('0x17')]?_0x2b17a0['options'][_0x4500('0x1a')]||null:null,'limit':_0x2b17a0['options']?_0x2b17a0[_0x4500('0x17')][_0x4500('0x1b')]||null:null,'include':_0x2b17a0['options']?_0x2b17a0[_0x4500('0x17')][_0x4500('0x1c')]?_['map'](_0x2b17a0[_0x4500('0x17')]['include'],function(_0x3447a7){return{'model':db[_0x3447a7['model']],'as':_0x3447a7['as'],'attributes':_0x3447a7[_0x4500('0x1a')],'include':_0x3447a7[_0x4500('0x1c')]?_[_0x4500('0x1d')](_0x3447a7[_0x4500('0x1c')],function(_0x22f23e){return{'model':db[_0x22f23e['model']],'as':_0x22f23e['as'],'attributes':_0x22f23e['attributes'],'include':_0x22f23e[_0x4500('0x1c')]?_[_0x4500('0x1d')](_0x22f23e[_0x4500('0x1c')],function(_0xd7a68f){return{'model':db[_0xd7a68f[_0x4500('0x1e')]],'as':_0xd7a68f['as'],'attributes':_0xd7a68f[_0x4500('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4500('0x9')](function(_0xd734a){logger[_0x4500('0xa')](_0x4500('0x15'),_0x2b17a0);logger[_0x4500('0xd')](_0x4500('0x15'),_0x2b17a0,JSON[_0x4500('0xf')](_0xd734a));_0x5b756a(_0xd734a);})[_0x4500('0x14')](function(_0x4f7f27){logger['error'](_0x4500('0x15'),_0x4f7f27['message'],_0x2b17a0);_0x268cb9(_0x24e782['error'](0x1f4,_0x4f7f27['message']));});});}; \ No newline at end of file +var _0xed10=['Template,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetTemplate','findAll','options','where','attributes','limit','include','map','model','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xed10,0x109));var _0x0ed1=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xed10[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0ed1('0x0'));var util=require('util');var moment=require(_0x0ed1('0x1'));var BPromise=require('bluebird');var rs=require(_0x0ed1('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0ed1('0x3'))['db'];var utils=require(_0x0ed1('0x4'));var logger=require(_0x0ed1('0x5'))(_0x0ed1('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ed1('0x7'));var client=jayson['client'][_0x0ed1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x360ab8,_0x465f07,_0xfa9598){return new BPromise(function(_0x19ce6e,_0xd003e7){return client[_0x0ed1('0x9')](_0x360ab8,_0xfa9598)[_0x0ed1('0xa')](function(_0x5ca392){logger['info'](_0x0ed1('0xb'),_0x465f07,_0x0ed1('0xc'));logger[_0x0ed1('0xd')](_0x0ed1('0xe'),_0x465f07,_0x0ed1('0xc'),JSON['stringify'](_0x5ca392));if(_0x5ca392[_0x0ed1('0xf')]){if(_0x5ca392[_0x0ed1('0xf')][_0x0ed1('0x10')]===0x1f4){logger['error'](_0x0ed1('0xb'),_0x465f07,_0x5ca392['error']['message']);return _0xd003e7(_0x5ca392[_0x0ed1('0xf')][_0x0ed1('0x11')]);}logger[_0x0ed1('0xf')]('Template,\x20%s,\x20%s',_0x465f07,_0x5ca392[_0x0ed1('0xf')][_0x0ed1('0x11')]);return _0x19ce6e(_0x5ca392[_0x0ed1('0xf')][_0x0ed1('0x11')]);}else{logger[_0x0ed1('0x12')]('Template,\x20%s,\x20%s',_0x465f07,_0x0ed1('0xc'));_0x19ce6e(_0x5ca392[_0x0ed1('0x13')][_0x0ed1('0x11')]);}})[_0x0ed1('0x14')](function(_0x225f9b){logger[_0x0ed1('0xf')](_0x0ed1('0xb'),_0x465f07,_0x225f9b);_0xd003e7(_0x225f9b);});});}exports[_0x0ed1('0x15')]=function(_0x24bed7){var _0xbe1399=this;return new Promise(function(_0x196997,_0x5bc335){return db['Template'][_0x0ed1('0x16')]({'raw':_0x24bed7['options']?_0x24bed7[_0x0ed1('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x24bed7[_0x0ed1('0x17')]?_0x24bed7[_0x0ed1('0x17')][_0x0ed1('0x18')]||null:null,'attributes':_0x24bed7['options']?_0x24bed7['options'][_0x0ed1('0x19')]||null:null,'limit':_0x24bed7[_0x0ed1('0x17')]?_0x24bed7[_0x0ed1('0x17')][_0x0ed1('0x1a')]||null:null,'include':_0x24bed7[_0x0ed1('0x17')]?_0x24bed7[_0x0ed1('0x17')][_0x0ed1('0x1b')]?_[_0x0ed1('0x1c')](_0x24bed7['options']['include'],function(_0x4bc420){return{'model':db[_0x4bc420[_0x0ed1('0x1d')]],'as':_0x4bc420['as'],'attributes':_0x4bc420['attributes'],'include':_0x4bc420[_0x0ed1('0x1b')]?_[_0x0ed1('0x1c')](_0x4bc420['include'],function(_0x494f63){return{'model':db[_0x494f63[_0x0ed1('0x1d')]],'as':_0x494f63['as'],'attributes':_0x494f63[_0x0ed1('0x19')],'include':_0x494f63[_0x0ed1('0x1b')]?_['map'](_0x494f63[_0x0ed1('0x1b')],function(_0x2678d2){return{'model':db[_0x2678d2[_0x0ed1('0x1d')]],'as':_0x2678d2['as'],'attributes':_0x2678d2[_0x0ed1('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23dbfb){logger[_0x0ed1('0x12')](_0x0ed1('0x15'),_0x24bed7);logger[_0x0ed1('0xd')](_0x0ed1('0x15'),_0x24bed7,JSON[_0x0ed1('0x1e')](_0x23dbfb));_0x196997(_0x23dbfb);})[_0x0ed1('0x14')](function(_0x801ec2){logger[_0x0ed1('0xf')](_0x0ed1('0x15'),_0x801ec2[_0x0ed1('0x11')],_0x24bed7);_0x5bc335(_0xbe1399['error'](0x1f4,_0x801ec2[_0x0ed1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 50857a5..70f403f 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 _0x2b41=['get','/:id','show','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','post','create','/:id/all_conditions','addAllCondition','addAction','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../config/environment','./trigger.controller','isAuthenticated'];(function(_0x4cbdc4,_0x8be7a8){var _0x413c70=function(_0x9da4a5){while(--_0x9da4a5){_0x4cbdc4['push'](_0x4cbdc4['shift']());}};_0x413c70(++_0x8be7a8);}(_0x2b41,0x118));var _0x12b4=function(_0x51461b,_0x32ad42){_0x51461b=_0x51461b-0x0;var _0x1a66c4=_0x2b41[_0x51461b];return _0x1a66c4;};'use strict';var multer=require(_0x12b4('0x0'));var util=require(_0x12b4('0x1'));var path=require(_0x12b4('0x2'));var timeout=require(_0x12b4('0x3'));var express=require('express');var router=express[_0x12b4('0x4')]();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x12b4('0x5'));var controller=require(_0x12b4('0x6'));router['get']('/',auth[_0x12b4('0x7')](),controller['index']);router[_0x12b4('0x8')](_0x12b4('0x9'),auth[_0x12b4('0x7')](),controller[_0x12b4('0xa')]);router[_0x12b4('0x8')]('/:id/all_conditions',auth['isAuthenticated'](),controller[_0x12b4('0xb')]);router[_0x12b4('0x8')](_0x12b4('0xc'),auth[_0x12b4('0x7')](),controller[_0x12b4('0xd')]);router['get'](_0x12b4('0xe'),auth[_0x12b4('0x7')](),controller['getActions']);router[_0x12b4('0xf')]('/',auth[_0x12b4('0x7')](),controller[_0x12b4('0x10')]);router[_0x12b4('0xf')](_0x12b4('0x11'),auth[_0x12b4('0x7')](),controller[_0x12b4('0x12')]);router[_0x12b4('0xf')]('/:id/any_conditions',auth[_0x12b4('0x7')](),controller['addAnyCondition']);router[_0x12b4('0xf')](_0x12b4('0xe'),auth['isAuthenticated'](),controller[_0x12b4('0x13')]);router[_0x12b4('0x14')](_0x12b4('0x9'),auth['isAuthenticated'](),controller[_0x12b4('0x15')]);router[_0x12b4('0x16')](_0x12b4('0x9'),auth[_0x12b4('0x7')](),controller[_0x12b4('0x17')]);module['exports']=router; \ No newline at end of file +var _0x3706=['/:id/any_conditions','/:id/actions','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','isAuthenticated','index','/:id','getAllConditions','getAnyConditions','create','post','/:id/all_conditions'];(function(_0x2605dc,_0x50cf7e){var _0x4568c9=function(_0x447f7c){while(--_0x447f7c){_0x2605dc['push'](_0x2605dc['shift']());}};_0x4568c9(++_0x50cf7e);}(_0x3706,0x101));var _0x6370=function(_0x3f4891,_0x4e6f62){_0x3f4891=_0x3f4891-0x0;var _0x54f2d8=_0x3706[_0x3f4891];return _0x54f2d8;};'use strict';var multer=require(_0x6370('0x0'));var util=require(_0x6370('0x1'));var path=require('path');var timeout=require(_0x6370('0x2'));var express=require(_0x6370('0x3'));var router=express[_0x6370('0x4')]();var auth=require(_0x6370('0x5'));var interaction=require(_0x6370('0x6'));var config=require(_0x6370('0x7'));var controller=require(_0x6370('0x8'));router[_0x6370('0x9')]('/',auth[_0x6370('0xa')](),controller[_0x6370('0xb')]);router[_0x6370('0x9')](_0x6370('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x6370('0x9')]('/:id/all_conditions',auth[_0x6370('0xa')](),controller[_0x6370('0xd')]);router[_0x6370('0x9')]('/:id/any_conditions',auth[_0x6370('0xa')](),controller[_0x6370('0xe')]);router['get']('/:id/actions',auth['isAuthenticated'](),controller['getActions']);router['post']('/',auth[_0x6370('0xa')](),controller[_0x6370('0xf')]);router[_0x6370('0x10')](_0x6370('0x11'),auth[_0x6370('0xa')](),controller['addAllCondition']);router[_0x6370('0x10')](_0x6370('0x12'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x6370('0x10')](_0x6370('0x13'),auth[_0x6370('0xa')](),controller['addAction']);router[_0x6370('0x14')](_0x6370('0xc'),auth[_0x6370('0xa')](),controller[_0x6370('0x15')]);router[_0x6370('0x16')](_0x6370('0xc'),auth[_0x6370('0xa')](),controller[_0x6370('0x17')]);module[_0x6370('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index e1fc2b2..ca16ea0 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 _0xa351=['BOOLEAN','sequelize','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa351,0x1c9));var _0x1a35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xa351[_0x57b54c];return _0x59cc19;};'use strict';var Sequelize=require(_0x1a35('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1a35('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x1a35('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x3a97=['BOOLEAN','sequelize','exports','STRING'];(function(_0x3a3655,_0x8e8ce5){var _0x4f6afc=function(_0x383f61){while(--_0x383f61){_0x3a3655['push'](_0x3a3655['shift']());}};_0x4f6afc(++_0x8e8ce5);}(_0x3a97,0x179));var _0x73a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a97[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x73a9('0x0'));module[_0x73a9('0x1')]={'name':{'type':Sequelize[_0x73a9('0x2')]},'channel':{'type':Sequelize[_0x73a9('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0x73a9('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 3de958b..6d0ef57 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 _0x2481=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','send','index','Trigger','rawAttributes','fieldName','type','key','map','name','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','rows','catch','show','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Triggers','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addAllCondition','TriggerAllId','Condition','addAnyCondition','TriggerAnyId','getAllConditions','findOne','getAnyConditions','addAction','TriggerId','Action','getActions','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x55be9e,_0x4b0df0){var _0x180d85=function(_0x3456bb){while(--_0x3456bb){_0x55be9e['push'](_0x55be9e['shift']());}};_0x180d85(++_0x4b0df0);}(_0x2481,0x119));var _0x1248=function(_0x107824,_0x1d2780){_0x107824=_0x107824-0x0;var _0x578fe2=_0x2481[_0x107824];return _0x578fe2;};'use strict';var pdf=require(_0x1248('0x0'));var emlformat=require(_0x1248('0x1'));var rimraf=require(_0x1248('0x2'));var zipdir=require(_0x1248('0x3'));var jsonpatch=require(_0x1248('0x4'));var rp=require(_0x1248('0x5'));var moment=require(_0x1248('0x6'));var BPromise=require(_0x1248('0x7'));var Mustache=require('mustache');var util=require(_0x1248('0x8'));var path=require(_0x1248('0x9'));var sox=require(_0x1248('0xa'));var csv=require('to-csv');var ejs=require(_0x1248('0xb'));var fs=require('fs');var _=require(_0x1248('0xc'));var squel=require('squel');var crypto=require(_0x1248('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x1248('0xe'));var toCsv=require(_0x1248('0xf'));var querystring=require(_0x1248('0x10'));var Papa=require(_0x1248('0x11'));var Redis=require(_0x1248('0x12'));var authService=require(_0x1248('0x13'));var qs=require(_0x1248('0x14'));var as=require(_0x1248('0x15'));var hardwareService=require(_0x1248('0x16'));var logger=require(_0x1248('0x17'))(_0x1248('0x18'));var utils=require(_0x1248('0x19'));var config=require(_0x1248('0x1a'));var db=require(_0x1248('0x1b'))['db'];function respondWithStatusCode(_0x144691,_0x25d976){_0x25d976=_0x25d976||0xcc;return function(_0x2d2d10){if(_0x2d2d10){return _0x144691[_0x1248('0x1c')](_0x25d976);}return _0x144691[_0x1248('0x1d')](_0x25d976)[_0x1248('0x1e')]();};}function respondWithResult(_0x249415,_0x3dd5c3){_0x3dd5c3=_0x3dd5c3||0xc8;return function(_0x462f13){if(_0x462f13){return _0x249415[_0x1248('0x1d')](_0x3dd5c3)[_0x1248('0x1f')](_0x462f13);}};}function respondWithFilteredResult(_0x28cb96,_0x4bbdeb){return function(_0x475b94){if(_0x475b94){var _0x91afaf=_0x475b94['count'],_0x5e70e6=_0x4bbdeb[_0x1248('0x20')],_0x5b0034=_0x4bbdeb[_0x1248('0x20')]+_0x4bbdeb['limit'],_0x342afb;if(_0x5b0034>=_0x91afaf){_0x5b0034=_0x91afaf;_0x342afb=0xc8;}else{_0x342afb=0xce;}_0x28cb96[_0x1248('0x1d')](_0x342afb);return _0x28cb96[_0x1248('0x21')](_0x1248('0x22'),_0x5e70e6+'-'+_0x5b0034+'/'+_0x91afaf)[_0x1248('0x1f')](_0x475b94);}return null;};}function patchUpdates(_0x21dce0){return function(_0x49a080){try{jsonpatch['apply'](_0x49a080,_0x21dce0,!![]);}catch(_0xa4ee35){return BPromise[_0x1248('0x23')](_0xa4ee35);}return _0x49a080[_0x1248('0x24')]();};}function saveUpdates(_0x2c8f76,_0x38f019){return function(_0x469c6a){if(_0x469c6a){return _0x469c6a[_0x1248('0x25')](_0x2c8f76)[_0x1248('0x26')](function(_0x3b7fea){return _0x3b7fea;});}return null;};}function removeEntity(_0x39c93f,_0x3c4782){return function(_0x586b52){if(_0x586b52){return _0x586b52['destroy']()['then'](function(){var _0xacea0b=_0x586b52[_0x1248('0x27')]({'plain':!![]});var _0x44381c='Triggers';return db[_0x1248('0x28')][_0x1248('0x29')]({'where':{'type':_0x44381c,'resourceId':_0xacea0b['id']}})[_0x1248('0x26')](function(){return _0x586b52;});})[_0x1248('0x26')](function(){_0x39c93f[_0x1248('0x1d')](0xcc)[_0x1248('0x1e')]();});}};}function handleEntityNotFound(_0x545008,_0x5d922f){return function(_0xdfb646){if(!_0xdfb646){_0x545008[_0x1248('0x1c')](0x194);}return _0xdfb646;};}function handleError(_0x3934af,_0x4963ca){_0x4963ca=_0x4963ca||0x1f4;return function(_0x1ab983){logger['error'](_0x1ab983['stack']);if(_0x1ab983['name']){delete _0x1ab983['name'];}_0x3934af[_0x1248('0x1d')](_0x4963ca)[_0x1248('0x2a')](_0x1ab983);};}exports[_0x1248('0x2b')]=function(_0x227dbb,_0x20c49c){var _0x13d273={},_0x4125e6={},_0x585fe7={'count':0x0,'rows':[]};var _0x13d4c9=_['map'](db[_0x1248('0x2c')][_0x1248('0x2d')],function(_0x2af275){return{'name':_0x2af275[_0x1248('0x2e')],'type':_0x2af275[_0x1248('0x2f')][_0x1248('0x30')]};});_0x4125e6['model']=_[_0x1248('0x31')](_0x13d4c9,_0x1248('0x32'));_0x4125e6[_0x1248('0x33')]=_[_0x1248('0x34')](_0x227dbb[_0x1248('0x33')]);_0x4125e6[_0x1248('0x35')]=_[_0x1248('0x36')](_0x4125e6[_0x1248('0x37')],_0x4125e6[_0x1248('0x33')]);_0x13d273['attributes']=_['intersection'](_0x4125e6[_0x1248('0x37')],qs[_0x1248('0x38')](_0x227dbb[_0x1248('0x33')][_0x1248('0x38')]));_0x13d273[_0x1248('0x39')]=_0x13d273[_0x1248('0x39')][_0x1248('0x3a')]?_0x13d273[_0x1248('0x39')]:_0x4125e6[_0x1248('0x37')];if(!_0x227dbb[_0x1248('0x33')][_0x1248('0x3b')](_0x1248('0x3c'))){_0x13d273[_0x1248('0x3d')]=qs[_0x1248('0x3d')](_0x227dbb[_0x1248('0x33')][_0x1248('0x3d')]);_0x13d273['offset']=qs[_0x1248('0x20')](_0x227dbb['query'][_0x1248('0x20')]);}_0x13d273[_0x1248('0x3e')]=qs[_0x1248('0x3f')](_0x227dbb[_0x1248('0x33')][_0x1248('0x3f')]);_0x13d273[_0x1248('0x40')]=qs[_0x1248('0x35')](_[_0x1248('0x41')](_0x227dbb['query'],_0x4125e6[_0x1248('0x35')]));if(_0x227dbb[_0x1248('0x33')][_0x1248('0x42')]){_0x13d273['where']=_[_0x1248('0x43')](_0x13d273['where'],{'$or':_[_0x1248('0x31')](_0x13d4c9,function(_0x32c4f4){if(_0x32c4f4[_0x1248('0x2f')]!==_0x1248('0x44')){var _0x4ae380={};_0x4ae380[_0x32c4f4[_0x1248('0x32')]]={'$like':'%'+_0x227dbb[_0x1248('0x33')][_0x1248('0x42')]+'%'};return _0x4ae380;}})});}_0x13d273=_[_0x1248('0x43')]({},_0x13d273,_0x227dbb[_0x1248('0x45')]);var _0x1729bb={'where':_0x13d273[_0x1248('0x40')]};return db['Trigger'][_0x1248('0x46')](_0x1729bb)[_0x1248('0x26')](function(_0x37ea96){_0x585fe7['count']=_0x37ea96;if(_0x227dbb[_0x1248('0x33')]['includeAll']){_0x13d273[_0x1248('0x47')]=[{'all':!![]}];}return db[_0x1248('0x2c')]['findAll'](_0x13d273);})[_0x1248('0x26')](function(_0x46a4d1){_0x585fe7[_0x1248('0x48')]=_0x46a4d1;return _0x585fe7;})[_0x1248('0x26')](respondWithFilteredResult(_0x20c49c,_0x13d273))[_0x1248('0x49')](handleError(_0x20c49c,null));};exports[_0x1248('0x4a')]=function(_0x183714,_0x7b3ca9){var _0x469673={'raw':![],'where':{'id':_0x183714[_0x1248('0x4b')]['id']}},_0x15b08c={};_0x15b08c[_0x1248('0x37')]=_[_0x1248('0x34')](db['Trigger'][_0x1248('0x2d')]);_0x15b08c[_0x1248('0x33')]=_[_0x1248('0x34')](_0x183714[_0x1248('0x33')]);_0x15b08c['filters']=_['intersection'](_0x15b08c[_0x1248('0x37')],_0x15b08c['query']);_0x469673[_0x1248('0x39')]=_[_0x1248('0x36')](_0x15b08c[_0x1248('0x37')],qs[_0x1248('0x38')](_0x183714[_0x1248('0x33')][_0x1248('0x38')]));_0x469673['attributes']=_0x469673[_0x1248('0x39')][_0x1248('0x3a')]?_0x469673[_0x1248('0x39')]:_0x15b08c[_0x1248('0x37')];if(_0x183714[_0x1248('0x33')][_0x1248('0x4c')]){_0x469673[_0x1248('0x47')]=[{'all':!![]}];}_0x469673=_[_0x1248('0x43')]({},_0x469673,_0x183714[_0x1248('0x45')]);return db[_0x1248('0x2c')][_0x1248('0x4d')](_0x469673)[_0x1248('0x26')](handleEntityNotFound(_0x7b3ca9,null))['then'](respondWithResult(_0x7b3ca9,null))[_0x1248('0x49')](handleError(_0x7b3ca9,null));};exports['create']=function(_0x3777b0,_0x4c62ff){return db['Trigger'][_0x1248('0x4e')](_0x3777b0[_0x1248('0x4f')],{})[_0x1248('0x26')](function(_0x4043b8){var _0x5599f3=_0x3777b0['user']['get']({'plain':!![]});if(!_0x5599f3)throw new Error(_0x1248('0x50'));if(_0x5599f3[_0x1248('0x51')]==='user'){var _0x56da7b=_0x4043b8[_0x1248('0x27')]({'plain':!![]});var _0x499495=_0x1248('0x52');return db[_0x1248('0x53')][_0x1248('0x4d')]({'where':{'name':_0x499495,'userProfileId':_0x5599f3[_0x1248('0x54')]},'raw':!![]})['then'](function(_0x288b26){if(_0x288b26&&_0x288b26[_0x1248('0x55')]===0x0){return db[_0x1248('0x28')][_0x1248('0x4e')]({'name':_0x56da7b['name'],'resourceId':_0x56da7b['id'],'type':_0x288b26['name'],'sectionId':_0x288b26['id']},{})[_0x1248('0x26')](function(){return _0x4043b8;});}else{return _0x4043b8;}})[_0x1248('0x49')](function(_0x1367f4){logger[_0x1248('0x56')](_0x1248('0x57'),_0x1367f4);throw _0x1367f4;});}return _0x4043b8;})[_0x1248('0x26')](respondWithResult(_0x4c62ff,0xc9))[_0x1248('0x49')](handleError(_0x4c62ff,null));};exports[_0x1248('0x25')]=function(_0x38d72a,_0x3cd024){if(_0x38d72a[_0x1248('0x4f')]['id']){delete _0x38d72a[_0x1248('0x4f')]['id'];}return db[_0x1248('0x2c')][_0x1248('0x4d')]({'where':{'id':_0x38d72a[_0x1248('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3cd024,null))[_0x1248('0x26')](saveUpdates(_0x38d72a[_0x1248('0x4f')],null))[_0x1248('0x26')](respondWithResult(_0x3cd024,null))[_0x1248('0x49')](handleError(_0x3cd024,null));};exports['destroy']=function(_0x57509a,_0x1782b1){return db['Trigger'][_0x1248('0x4d')]({'where':{'id':_0x57509a[_0x1248('0x4b')]['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x1782b1,null))['then'](removeEntity(_0x1782b1,null))[_0x1248('0x49')](handleError(_0x1782b1,null));};exports[_0x1248('0x58')]=function(_0x215bc2,_0x273ef6,_0x40956a){if(_0x215bc2[_0x1248('0x4f')]['id']){delete _0x215bc2[_0x1248('0x4f')]['id'];}return db[_0x1248('0x2c')]['find']({'where':{'id':_0x215bc2[_0x1248('0x4b')]['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x273ef6,null))[_0x1248('0x26')](function(_0x4a343c){if(_0x4a343c){_0x215bc2[_0x1248('0x4f')][_0x1248('0x59')]=_0x4a343c['id'];return db[_0x1248('0x5a')][_0x1248('0x4e')](_0x215bc2[_0x1248('0x4f')]);}})['then'](respondWithResult(_0x273ef6,null))[_0x1248('0x49')](handleError(_0x273ef6,null));};exports[_0x1248('0x5b')]=function(_0x44ea1b,_0x834a08,_0x2cdd72){if(_0x44ea1b[_0x1248('0x4f')]['id']){delete _0x44ea1b[_0x1248('0x4f')]['id'];}return db['Trigger'][_0x1248('0x4d')]({'where':{'id':_0x44ea1b['params']['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x834a08,null))['then'](function(_0x4d1c0b){if(_0x4d1c0b){_0x44ea1b[_0x1248('0x4f')][_0x1248('0x5c')]=_0x4d1c0b['id'];return db[_0x1248('0x5a')][_0x1248('0x4e')](_0x44ea1b[_0x1248('0x4f')]);}})['then'](respondWithResult(_0x834a08,null))['catch'](handleError(_0x834a08,null));};exports[_0x1248('0x5d')]=function(_0x38c9d0,_0x16b35d,_0x378ca3){var _0x1f2141={};var _0x17cc8f={};var _0xc07ac0;var _0x41874e;return db[_0x1248('0x2c')][_0x1248('0x5e')]({'where':{'id':_0x38c9d0[_0x1248('0x4b')]['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x16b35d,null))[_0x1248('0x26')](function(_0x235b7a){if(_0x235b7a){_0xc07ac0=_0x235b7a;_0x17cc8f[_0x1248('0x37')]=_[_0x1248('0x34')](db[_0x1248('0x5a')][_0x1248('0x2d')]);_0x17cc8f[_0x1248('0x33')]=_[_0x1248('0x34')](_0x38c9d0['query']);_0x17cc8f['filters']=_[_0x1248('0x36')](_0x17cc8f['model'],_0x17cc8f[_0x1248('0x33')]);_0x1f2141[_0x1248('0x39')]=_[_0x1248('0x36')](_0x17cc8f['model'],qs[_0x1248('0x38')](_0x38c9d0[_0x1248('0x33')][_0x1248('0x38')]));_0x1f2141[_0x1248('0x39')]=_0x1f2141[_0x1248('0x39')][_0x1248('0x3a')]?_0x1f2141[_0x1248('0x39')]:_0x17cc8f['model'];_0x1f2141[_0x1248('0x3e')]=qs[_0x1248('0x3f')](_0x38c9d0[_0x1248('0x33')][_0x1248('0x3f')]);_0x1f2141[_0x1248('0x40')]=qs['filters'](_['pick'](_0x38c9d0[_0x1248('0x33')],_0x17cc8f['filters']));if(_0x38c9d0[_0x1248('0x33')]['filter']){_0x1f2141[_0x1248('0x40')]=_['merge'](_0x1f2141['where'],{'$or':_[_0x1248('0x31')](_0x1f2141[_0x1248('0x39')],function(_0x138e58){var _0x4afae6={};_0x4afae6[_0x138e58]={'$like':'%'+_0x38c9d0['query'][_0x1248('0x42')]+'%'};return _0x4afae6;})});}_0x1f2141=_[_0x1248('0x43')]({},_0x1f2141,_0x38c9d0['options']);return _0xc07ac0['getAllConditions'](_0x1f2141);}})['then'](function(_0x4d1918){if(_0x4d1918){_0x41874e=_0x4d1918[_0x1248('0x3a')];if(!_0x38c9d0[_0x1248('0x33')]['hasOwnProperty'](_0x1248('0x3c'))){_0x1f2141['limit']=qs[_0x1248('0x3d')](_0x38c9d0[_0x1248('0x33')][_0x1248('0x3d')]);_0x1f2141[_0x1248('0x20')]=qs[_0x1248('0x20')](_0x38c9d0[_0x1248('0x33')]['offset']);}return _0xc07ac0[_0x1248('0x5d')](_0x1f2141);}})[_0x1248('0x26')](function(_0x5bdb6f){if(_0x5bdb6f){return _0x5bdb6f?{'count':_0x41874e,'rows':_0x5bdb6f}:null;}})['then'](respondWithResult(_0x16b35d,null))[_0x1248('0x49')](handleError(_0x16b35d,null));};exports[_0x1248('0x5f')]=function(_0x1f6fb,_0x4069c8,_0x433561){var _0x12f312={};var _0x5ef6ee={};var _0x169786;var _0x3b9f0f;return db[_0x1248('0x2c')][_0x1248('0x5e')]({'where':{'id':_0x1f6fb['params']['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x4069c8,null))[_0x1248('0x26')](function(_0x17bd74){if(_0x17bd74){_0x169786=_0x17bd74;_0x5ef6ee[_0x1248('0x37')]=_[_0x1248('0x34')](db[_0x1248('0x5a')][_0x1248('0x2d')]);_0x5ef6ee[_0x1248('0x33')]=_['keys'](_0x1f6fb[_0x1248('0x33')]);_0x5ef6ee[_0x1248('0x35')]=_['intersection'](_0x5ef6ee[_0x1248('0x37')],_0x5ef6ee[_0x1248('0x33')]);_0x12f312[_0x1248('0x39')]=_['intersection'](_0x5ef6ee[_0x1248('0x37')],qs['fields'](_0x1f6fb[_0x1248('0x33')]['fields']));_0x12f312[_0x1248('0x39')]=_0x12f312[_0x1248('0x39')][_0x1248('0x3a')]?_0x12f312[_0x1248('0x39')]:_0x5ef6ee[_0x1248('0x37')];_0x12f312[_0x1248('0x3e')]=qs[_0x1248('0x3f')](_0x1f6fb[_0x1248('0x33')][_0x1248('0x3f')]);_0x12f312[_0x1248('0x40')]=qs['filters'](_[_0x1248('0x41')](_0x1f6fb[_0x1248('0x33')],_0x5ef6ee[_0x1248('0x35')]));if(_0x1f6fb[_0x1248('0x33')][_0x1248('0x42')]){_0x12f312[_0x1248('0x40')]=_[_0x1248('0x43')](_0x12f312[_0x1248('0x40')],{'$or':_[_0x1248('0x31')](_0x12f312[_0x1248('0x39')],function(_0x3cb4d0){var _0x483c36={};_0x483c36[_0x3cb4d0]={'$like':'%'+_0x1f6fb['query'][_0x1248('0x42')]+'%'};return _0x483c36;})});}_0x12f312=_['merge']({},_0x12f312,_0x1f6fb[_0x1248('0x45')]);return _0x169786['getAnyConditions'](_0x12f312);}})[_0x1248('0x26')](function(_0x436005){if(_0x436005){_0x3b9f0f=_0x436005[_0x1248('0x3a')];if(!_0x1f6fb[_0x1248('0x33')]['hasOwnProperty'](_0x1248('0x3c'))){_0x12f312['limit']=qs['limit'](_0x1f6fb[_0x1248('0x33')][_0x1248('0x3d')]);_0x12f312[_0x1248('0x20')]=qs[_0x1248('0x20')](_0x1f6fb[_0x1248('0x33')][_0x1248('0x20')]);}return _0x169786[_0x1248('0x5f')](_0x12f312);}})['then'](function(_0x489341){if(_0x489341){return _0x489341?{'count':_0x3b9f0f,'rows':_0x489341}:null;}})['then'](respondWithResult(_0x4069c8,null))[_0x1248('0x49')](handleError(_0x4069c8,null));};exports[_0x1248('0x60')]=function(_0x2495dc,_0x1042de,_0x24ebe6){if(_0x2495dc[_0x1248('0x4f')]['id']){delete _0x2495dc['body']['id'];}return db['Trigger']['find']({'where':{'id':_0x2495dc[_0x1248('0x4b')]['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x1042de,null))[_0x1248('0x26')](function(_0x24f919){if(_0x24f919){_0x2495dc[_0x1248('0x4f')][_0x1248('0x61')]=_0x24f919['id'];return db[_0x1248('0x62')][_0x1248('0x4e')](_0x2495dc[_0x1248('0x4f')]);}})[_0x1248('0x26')](respondWithResult(_0x1042de,null))[_0x1248('0x49')](handleError(_0x1042de,null));};exports[_0x1248('0x63')]=function(_0x360fe0,_0x5acf52,_0x4c86a0){var _0x31afd7={};var _0x2184c8={};var _0x187c09;var _0x4fb035;return db[_0x1248('0x2c')][_0x1248('0x5e')]({'where':{'id':_0x360fe0[_0x1248('0x4b')]['id']}})[_0x1248('0x26')](handleEntityNotFound(_0x5acf52,null))['then'](function(_0x1d4076){if(_0x1d4076){_0x187c09=_0x1d4076;_0x2184c8['model']=_['keys'](db[_0x1248('0x62')][_0x1248('0x2d')]);_0x2184c8[_0x1248('0x33')]=_[_0x1248('0x34')](_0x360fe0[_0x1248('0x33')]);_0x2184c8[_0x1248('0x35')]=_[_0x1248('0x36')](_0x2184c8[_0x1248('0x37')],_0x2184c8['query']);_0x31afd7[_0x1248('0x39')]=_[_0x1248('0x36')](_0x2184c8['model'],qs['fields'](_0x360fe0[_0x1248('0x33')][_0x1248('0x38')]));_0x31afd7[_0x1248('0x39')]=_0x31afd7[_0x1248('0x39')][_0x1248('0x3a')]?_0x31afd7[_0x1248('0x39')]:_0x2184c8[_0x1248('0x37')];_0x31afd7['order']=qs[_0x1248('0x3f')](_0x360fe0[_0x1248('0x33')][_0x1248('0x3f')]);_0x31afd7[_0x1248('0x40')]=qs['filters'](_['pick'](_0x360fe0['query'],_0x2184c8[_0x1248('0x35')]));if(_0x360fe0['query']['filter']){_0x31afd7[_0x1248('0x40')]=_['merge'](_0x31afd7['where'],{'$or':_['map'](_0x31afd7[_0x1248('0x39')],function(_0x4995b1){var _0x3bde65={};_0x3bde65[_0x4995b1]={'$like':'%'+_0x360fe0[_0x1248('0x33')][_0x1248('0x42')]+'%'};return _0x3bde65;})});}_0x31afd7=_[_0x1248('0x43')]({},_0x31afd7,_0x360fe0[_0x1248('0x45')]);return _0x187c09[_0x1248('0x63')](_0x31afd7);}})[_0x1248('0x26')](function(_0x203cb5){if(_0x203cb5){_0x4fb035=_0x203cb5[_0x1248('0x3a')];if(!_0x360fe0[_0x1248('0x33')][_0x1248('0x3b')]('nolimit')){_0x31afd7[_0x1248('0x3d')]=qs[_0x1248('0x3d')](_0x360fe0[_0x1248('0x33')][_0x1248('0x3d')]);_0x31afd7['offset']=qs[_0x1248('0x20')](_0x360fe0[_0x1248('0x33')][_0x1248('0x20')]);}return _0x187c09[_0x1248('0x63')](_0x31afd7);}})[_0x1248('0x26')](function(_0x10c2c1){if(_0x10c2c1){return _0x10c2c1?{'count':_0x4fb035,'rows':_0x10c2c1}:null;}})[_0x1248('0x26')](respondWithResult(_0x5acf52,null))[_0x1248('0x49')](handleError(_0x5acf52,null));}; \ No newline at end of file +var _0xbb3b=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','json','apply','reject','update','destroy','then','get','Triggers','UserProfileResource','end','error','stack','name','index','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','Trigger','include','rows','catch','show','keys','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','TriggerAllId','Condition','TriggerAnyId','order','getAllConditions','hasOwnProperty','getAnyConditions','addAction','Action','getActions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x1aff98,_0x500f41){var _0x4c8670=function(_0x2b2623){while(--_0x2b2623){_0x1aff98['push'](_0x1aff98['shift']());}};_0x4c8670(++_0x500f41);}(_0xbb3b,0x1b6));var _0xbbb3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbb3b[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xbbb3('0x0'));var rimraf=require(_0xbbb3('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbb3('0x2'));var rp=require('request-promise');var moment=require(_0xbbb3('0x3'));var BPromise=require(_0xbbb3('0x4'));var Mustache=require(_0xbbb3('0x5'));var util=require('util');var path=require(_0xbbb3('0x6'));var sox=require(_0xbbb3('0x7'));var csv=require(_0xbbb3('0x8'));var ejs=require(_0xbbb3('0x9'));var fs=require('fs');var _=require(_0xbbb3('0xa'));var squel=require(_0xbbb3('0xb'));var crypto=require(_0xbbb3('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbbb3('0xd'));var toCsv=require(_0xbbb3('0x8'));var querystring=require(_0xbbb3('0xe'));var Papa=require(_0xbbb3('0xf'));var Redis=require(_0xbbb3('0x10'));var authService=require(_0xbbb3('0x11'));var qs=require(_0xbbb3('0x12'));var as=require(_0xbbb3('0x13'));var hardwareService=require(_0xbbb3('0x14'));var logger=require(_0xbbb3('0x15'))(_0xbbb3('0x16'));var utils=require(_0xbbb3('0x17'));var config=require(_0xbbb3('0x18'));var db=require(_0xbbb3('0x19'))['db'];function respondWithStatusCode(_0x42397e,_0x2686d9){_0x2686d9=_0x2686d9||0xcc;return function(_0x320e6c){if(_0x320e6c){return _0x42397e[_0xbbb3('0x1a')](_0x2686d9);}return _0x42397e['status'](_0x2686d9)['end']();};}function respondWithResult(_0x56b566,_0x2a43aa){_0x2a43aa=_0x2a43aa||0xc8;return function(_0x43f42f){if(_0x43f42f){return _0x56b566[_0xbbb3('0x1b')](_0x2a43aa)['json'](_0x43f42f);}};}function respondWithFilteredResult(_0x32f36a,_0x59a6e6){return function(_0x186051){if(_0x186051){var _0x496ada=_0x186051[_0xbbb3('0x1c')],_0x525b94=_0x59a6e6[_0xbbb3('0x1d')],_0xe0e853=_0x59a6e6[_0xbbb3('0x1d')]+_0x59a6e6[_0xbbb3('0x1e')],_0x15eec1;if(_0xe0e853>=_0x496ada){_0xe0e853=_0x496ada;_0x15eec1=0xc8;}else{_0x15eec1=0xce;}_0x32f36a['status'](_0x15eec1);return _0x32f36a[_0xbbb3('0x1f')](_0xbbb3('0x20'),_0x525b94+'-'+_0xe0e853+'/'+_0x496ada)[_0xbbb3('0x21')](_0x186051);}return null;};}function patchUpdates(_0xed9e96){return function(_0x2adfad){try{jsonpatch[_0xbbb3('0x22')](_0x2adfad,_0xed9e96,!![]);}catch(_0x5c6561){return BPromise[_0xbbb3('0x23')](_0x5c6561);}return _0x2adfad['save']();};}function saveUpdates(_0x1c7ead,_0x5216f4){return function(_0x32477e){if(_0x32477e){return _0x32477e[_0xbbb3('0x24')](_0x1c7ead)['then'](function(_0x5597b5){return _0x5597b5;});}return null;};}function removeEntity(_0x40adb9,_0x327558){return function(_0x17a6c2){if(_0x17a6c2){return _0x17a6c2[_0xbbb3('0x25')]()[_0xbbb3('0x26')](function(){var _0x55222d=_0x17a6c2[_0xbbb3('0x27')]({'plain':!![]});var _0x2f64ee=_0xbbb3('0x28');return db[_0xbbb3('0x29')]['destroy']({'where':{'type':_0x2f64ee,'resourceId':_0x55222d['id']}})[_0xbbb3('0x26')](function(){return _0x17a6c2;});})[_0xbbb3('0x26')](function(){_0x40adb9[_0xbbb3('0x1b')](0xcc)[_0xbbb3('0x2a')]();});}};}function handleEntityNotFound(_0x4a8a72,_0x5e8388){return function(_0x42d845){if(!_0x42d845){_0x4a8a72[_0xbbb3('0x1a')](0x194);}return _0x42d845;};}function handleError(_0x4cf299,_0xabfeae){_0xabfeae=_0xabfeae||0x1f4;return function(_0x1d2e3a){logger[_0xbbb3('0x2b')](_0x1d2e3a[_0xbbb3('0x2c')]);if(_0x1d2e3a[_0xbbb3('0x2d')]){delete _0x1d2e3a[_0xbbb3('0x2d')];}_0x4cf299[_0xbbb3('0x1b')](_0xabfeae)['send'](_0x1d2e3a);};}exports[_0xbbb3('0x2e')]=function(_0x432d93,_0x1a95b0){var _0x446153={},_0x3cad1d={},_0x3e04d0={'count':0x0,'rows':[]};var _0x5e47e3=_['map'](db['Trigger'][_0xbbb3('0x2f')],function(_0x1c2375){return{'name':_0x1c2375[_0xbbb3('0x30')],'type':_0x1c2375[_0xbbb3('0x31')]['key']};});_0x3cad1d[_0xbbb3('0x32')]=_[_0xbbb3('0x33')](_0x5e47e3,_0xbbb3('0x2d'));_0x3cad1d[_0xbbb3('0x34')]=_['keys'](_0x432d93[_0xbbb3('0x34')]);_0x3cad1d[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],_0x3cad1d[_0xbbb3('0x34')]);_0x446153['attributes']=_[_0xbbb3('0x36')](_0x3cad1d[_0xbbb3('0x32')],qs['fields'](_0x432d93['query'][_0xbbb3('0x37')]));_0x446153[_0xbbb3('0x38')]=_0x446153[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x446153['attributes']:_0x3cad1d[_0xbbb3('0x32')];if(!_0x432d93[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0x446153[_0xbbb3('0x1e')]=qs['limit'](_0x432d93['query'][_0xbbb3('0x1e')]);_0x446153[_0xbbb3('0x1d')]=qs['offset'](_0x432d93['query']['offset']);}_0x446153['order']=qs['sort'](_0x432d93['query'][_0xbbb3('0x3b')]);_0x446153[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x432d93[_0xbbb3('0x34')],_0x3cad1d[_0xbbb3('0x35')]));if(_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x446153[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x446153[_0xbbb3('0x3c')],{'$or':_[_0xbbb3('0x33')](_0x5e47e3,function(_0x4de361){if(_0x4de361[_0xbbb3('0x31')]!=='VIRTUAL'){var _0x197086={};_0x197086[_0x4de361[_0xbbb3('0x2d')]]={'$like':'%'+_0x432d93[_0xbbb3('0x34')][_0xbbb3('0x3e')]+'%'};return _0x197086;}})});}_0x446153=_['merge']({},_0x446153,_0x432d93['options']);var _0x3b8d6e={'where':_0x446153['where']};return db[_0xbbb3('0x40')]['count'](_0x3b8d6e)[_0xbbb3('0x26')](function(_0x166ac5){_0x3e04d0[_0xbbb3('0x1c')]=_0x166ac5;if(_0x432d93['query']['includeAll']){_0x446153[_0xbbb3('0x41')]=[{'all':!![]}];}return db[_0xbbb3('0x40')]['findAll'](_0x446153);})[_0xbbb3('0x26')](function(_0x45ca49){_0x3e04d0[_0xbbb3('0x42')]=_0x45ca49;return _0x3e04d0;})['then'](respondWithFilteredResult(_0x1a95b0,_0x446153))[_0xbbb3('0x43')](handleError(_0x1a95b0,null));};exports[_0xbbb3('0x44')]=function(_0x49f20d,_0x46d718){var _0x15176e={'raw':![],'where':{'id':_0x49f20d['params']['id']}},_0xd34788={};_0xd34788[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x40')][_0xbbb3('0x2f')]);_0xd34788['query']=_[_0xbbb3('0x45')](_0x49f20d[_0xbbb3('0x34')]);_0xd34788[_0xbbb3('0x35')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],_0xd34788['query']);_0x15176e[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0xd34788[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x49f20d[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x15176e[_0xbbb3('0x38')]=_0x15176e[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x15176e['attributes']:_0xd34788[_0xbbb3('0x32')];if(_0x49f20d['query'][_0xbbb3('0x46')]){_0x15176e['include']=[{'all':!![]}];}_0x15176e=_['merge']({},_0x15176e,_0x49f20d[_0xbbb3('0x47')]);return db[_0xbbb3('0x40')][_0xbbb3('0x48')](_0x15176e)[_0xbbb3('0x26')](handleEntityNotFound(_0x46d718,null))[_0xbbb3('0x26')](respondWithResult(_0x46d718,null))[_0xbbb3('0x43')](handleError(_0x46d718,null));};exports[_0xbbb3('0x49')]=function(_0x4cd64e,_0x567c24){return db[_0xbbb3('0x40')][_0xbbb3('0x49')](_0x4cd64e[_0xbbb3('0x4a')],{})[_0xbbb3('0x26')](function(_0xd5575){var _0x5221dc=_0x4cd64e[_0xbbb3('0x4b')][_0xbbb3('0x27')]({'plain':!![]});if(!_0x5221dc)throw new Error(_0xbbb3('0x4c'));if(_0x5221dc[_0xbbb3('0x4d')]===_0xbbb3('0x4b')){var _0x430f07=_0xd5575[_0xbbb3('0x27')]({'plain':!![]});var _0x48119c=_0xbbb3('0x28');return db['UserProfileSection'][_0xbbb3('0x48')]({'where':{'name':_0x48119c,'userProfileId':_0x5221dc[_0xbbb3('0x4e')]},'raw':!![]})['then'](function(_0x3f8d24){if(_0x3f8d24&&_0x3f8d24[_0xbbb3('0x4f')]===0x0){return db[_0xbbb3('0x29')][_0xbbb3('0x49')]({'name':_0x430f07[_0xbbb3('0x2d')],'resourceId':_0x430f07['id'],'type':_0x3f8d24[_0xbbb3('0x2d')],'sectionId':_0x3f8d24['id']},{})['then'](function(){return _0xd5575;});}else{return _0xd5575;}})['catch'](function(_0x45a393){logger[_0xbbb3('0x2b')](_0xbbb3('0x50'),_0x45a393);throw _0x45a393;});}return _0xd5575;})['then'](respondWithResult(_0x567c24,0xc9))['catch'](handleError(_0x567c24,null));};exports[_0xbbb3('0x24')]=function(_0x504403,_0x1a15b6){if(_0x504403[_0xbbb3('0x4a')]['id']){delete _0x504403['body']['id'];}return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x504403[_0xbbb3('0x51')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x1a15b6,null))[_0xbbb3('0x26')](saveUpdates(_0x504403[_0xbbb3('0x4a')],null))[_0xbbb3('0x26')](respondWithResult(_0x1a15b6,null))[_0xbbb3('0x43')](handleError(_0x1a15b6,null));};exports['destroy']=function(_0x5a79ff,_0x3c3a90){return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x5a79ff[_0xbbb3('0x51')]['id']}})['then'](handleEntityNotFound(_0x3c3a90,null))[_0xbbb3('0x26')](removeEntity(_0x3c3a90,null))[_0xbbb3('0x43')](handleError(_0x3c3a90,null));};exports['addAllCondition']=function(_0x12051b,_0x424c45,_0x358bc5){if(_0x12051b[_0xbbb3('0x4a')]['id']){delete _0x12051b[_0xbbb3('0x4a')]['id'];}return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x12051b[_0xbbb3('0x51')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x424c45,null))[_0xbbb3('0x26')](function(_0x3a656){if(_0x3a656){_0x12051b[_0xbbb3('0x4a')][_0xbbb3('0x52')]=_0x3a656['id'];return db[_0xbbb3('0x53')][_0xbbb3('0x49')](_0x12051b['body']);}})[_0xbbb3('0x26')](respondWithResult(_0x424c45,null))[_0xbbb3('0x43')](handleError(_0x424c45,null));};exports['addAnyCondition']=function(_0x2641ea,_0x4f9494,_0x41b441){if(_0x2641ea['body']['id']){delete _0x2641ea[_0xbbb3('0x4a')]['id'];}return db[_0xbbb3('0x40')][_0xbbb3('0x48')]({'where':{'id':_0x2641ea['params']['id']}})['then'](handleEntityNotFound(_0x4f9494,null))[_0xbbb3('0x26')](function(_0x3b3ef3){if(_0x3b3ef3){_0x2641ea[_0xbbb3('0x4a')][_0xbbb3('0x54')]=_0x3b3ef3['id'];return db['Condition']['create'](_0x2641ea[_0xbbb3('0x4a')]);}})[_0xbbb3('0x26')](respondWithResult(_0x4f9494,null))[_0xbbb3('0x43')](handleError(_0x4f9494,null));};exports['getAllConditions']=function(_0x591313,_0xd26021,_0x16bc95){var _0x5678d9={};var _0x4159f4={};var _0x57a6b1;var _0x18d75d;return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x591313['params']['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0xd26021,null))[_0xbbb3('0x26')](function(_0xe5486d){if(_0xe5486d){_0x57a6b1=_0xe5486d;_0x4159f4[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db['Condition'][_0xbbb3('0x2f')]);_0x4159f4[_0xbbb3('0x34')]=_[_0xbbb3('0x45')](_0x591313[_0xbbb3('0x34')]);_0x4159f4['filters']=_[_0xbbb3('0x36')](_0x4159f4[_0xbbb3('0x32')],_0x4159f4[_0xbbb3('0x34')]);_0x5678d9[_0xbbb3('0x38')]=_['intersection'](_0x4159f4[_0xbbb3('0x32')],qs[_0xbbb3('0x37')](_0x591313[_0xbbb3('0x34')]['fields']));_0x5678d9[_0xbbb3('0x38')]=_0x5678d9[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x5678d9[_0xbbb3('0x38')]:_0x4159f4[_0xbbb3('0x32')];_0x5678d9[_0xbbb3('0x55')]=qs[_0xbbb3('0x3b')](_0x591313[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x5678d9[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x591313[_0xbbb3('0x34')],_0x4159f4[_0xbbb3('0x35')]));if(_0x591313['query'][_0xbbb3('0x3e')]){_0x5678d9[_0xbbb3('0x3c')]=_[_0xbbb3('0x3f')](_0x5678d9['where'],{'$or':_[_0xbbb3('0x33')](_0x5678d9[_0xbbb3('0x38')],function(_0x59bc8b){var _0x5e103f={};_0x5e103f[_0x59bc8b]={'$like':'%'+_0x591313['query'][_0xbbb3('0x3e')]+'%'};return _0x5e103f;})});}_0x5678d9=_[_0xbbb3('0x3f')]({},_0x5678d9,_0x591313[_0xbbb3('0x47')]);return _0x57a6b1[_0xbbb3('0x56')](_0x5678d9);}})[_0xbbb3('0x26')](function(_0x390e9a){if(_0x390e9a){_0x18d75d=_0x390e9a[_0xbbb3('0x39')];if(!_0x591313['query'][_0xbbb3('0x57')](_0xbbb3('0x3a'))){_0x5678d9[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x591313['query'][_0xbbb3('0x1e')]);_0x5678d9['offset']=qs['offset'](_0x591313[_0xbbb3('0x34')]['offset']);}return _0x57a6b1[_0xbbb3('0x56')](_0x5678d9);}})[_0xbbb3('0x26')](function(_0x4e73cc){if(_0x4e73cc){return _0x4e73cc?{'count':_0x18d75d,'rows':_0x4e73cc}:null;}})['then'](respondWithResult(_0xd26021,null))['catch'](handleError(_0xd26021,null));};exports[_0xbbb3('0x58')]=function(_0x446e9c,_0x5eccee,_0xb1737e){var _0x136d14={};var _0x489b59={};var _0x316815;var _0x44cdf4;return db['Trigger']['findOne']({'where':{'id':_0x446e9c[_0xbbb3('0x51')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x5eccee,null))[_0xbbb3('0x26')](function(_0x854d42){if(_0x854d42){_0x316815=_0x854d42;_0x489b59[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x53')]['rawAttributes']);_0x489b59['query']=_[_0xbbb3('0x45')](_0x446e9c[_0xbbb3('0x34')]);_0x489b59['filters']=_[_0xbbb3('0x36')](_0x489b59['model'],_0x489b59['query']);_0x136d14[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x489b59['model'],qs[_0xbbb3('0x37')](_0x446e9c[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0x136d14[_0xbbb3('0x38')]=_0x136d14[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0x136d14[_0xbbb3('0x38')]:_0x489b59[_0xbbb3('0x32')];_0x136d14[_0xbbb3('0x55')]=qs[_0xbbb3('0x3b')](_0x446e9c[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0x136d14[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x446e9c[_0xbbb3('0x34')],_0x489b59['filters']));if(_0x446e9c[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0x136d14[_0xbbb3('0x3c')]=_['merge'](_0x136d14[_0xbbb3('0x3c')],{'$or':_['map'](_0x136d14[_0xbbb3('0x38')],function(_0x132ef0){var _0x2de6b8={};_0x2de6b8[_0x132ef0]={'$like':'%'+_0x446e9c['query'][_0xbbb3('0x3e')]+'%'};return _0x2de6b8;})});}_0x136d14=_[_0xbbb3('0x3f')]({},_0x136d14,_0x446e9c[_0xbbb3('0x47')]);return _0x316815[_0xbbb3('0x58')](_0x136d14);}})[_0xbbb3('0x26')](function(_0x320427){if(_0x320427){_0x44cdf4=_0x320427['length'];if(!_0x446e9c['query']['hasOwnProperty'](_0xbbb3('0x3a'))){_0x136d14[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x446e9c[_0xbbb3('0x34')]['limit']);_0x136d14['offset']=qs[_0xbbb3('0x1d')](_0x446e9c[_0xbbb3('0x34')][_0xbbb3('0x1d')]);}return _0x316815['getAnyConditions'](_0x136d14);}})[_0xbbb3('0x26')](function(_0x3b77fb){if(_0x3b77fb){return _0x3b77fb?{'count':_0x44cdf4,'rows':_0x3b77fb}:null;}})[_0xbbb3('0x26')](respondWithResult(_0x5eccee,null))[_0xbbb3('0x43')](handleError(_0x5eccee,null));};exports[_0xbbb3('0x59')]=function(_0x345f48,_0x4ceaab,_0x85d27){if(_0x345f48[_0xbbb3('0x4a')]['id']){delete _0x345f48[_0xbbb3('0x4a')]['id'];}return db['Trigger'][_0xbbb3('0x48')]({'where':{'id':_0x345f48[_0xbbb3('0x51')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0x4ceaab,null))[_0xbbb3('0x26')](function(_0x253d11){if(_0x253d11){_0x345f48[_0xbbb3('0x4a')]['TriggerId']=_0x253d11['id'];return db[_0xbbb3('0x5a')][_0xbbb3('0x49')](_0x345f48[_0xbbb3('0x4a')]);}})[_0xbbb3('0x26')](respondWithResult(_0x4ceaab,null))[_0xbbb3('0x43')](handleError(_0x4ceaab,null));};exports['getActions']=function(_0x46a23d,_0xf6b7fd,_0x503458){var _0xb017b0={};var _0x3a30ba={};var _0x2d6f0e;var _0x28c174;return db[_0xbbb3('0x40')]['findOne']({'where':{'id':_0x46a23d[_0xbbb3('0x51')]['id']}})[_0xbbb3('0x26')](handleEntityNotFound(_0xf6b7fd,null))[_0xbbb3('0x26')](function(_0x27bbeb){if(_0x27bbeb){_0x2d6f0e=_0x27bbeb;_0x3a30ba[_0xbbb3('0x32')]=_[_0xbbb3('0x45')](db[_0xbbb3('0x5a')][_0xbbb3('0x2f')]);_0x3a30ba[_0xbbb3('0x34')]=_['keys'](_0x46a23d[_0xbbb3('0x34')]);_0x3a30ba['filters']=_[_0xbbb3('0x36')](_0x3a30ba[_0xbbb3('0x32')],_0x3a30ba[_0xbbb3('0x34')]);_0xb017b0[_0xbbb3('0x38')]=_[_0xbbb3('0x36')](_0x3a30ba['model'],qs[_0xbbb3('0x37')](_0x46a23d[_0xbbb3('0x34')][_0xbbb3('0x37')]));_0xb017b0[_0xbbb3('0x38')]=_0xb017b0[_0xbbb3('0x38')][_0xbbb3('0x39')]?_0xb017b0[_0xbbb3('0x38')]:_0x3a30ba['model'];_0xb017b0[_0xbbb3('0x55')]=qs['sort'](_0x46a23d[_0xbbb3('0x34')][_0xbbb3('0x3b')]);_0xb017b0[_0xbbb3('0x3c')]=qs[_0xbbb3('0x35')](_[_0xbbb3('0x3d')](_0x46a23d[_0xbbb3('0x34')],_0x3a30ba[_0xbbb3('0x35')]));if(_0x46a23d[_0xbbb3('0x34')][_0xbbb3('0x3e')]){_0xb017b0['where']=_[_0xbbb3('0x3f')](_0xb017b0['where'],{'$or':_[_0xbbb3('0x33')](_0xb017b0[_0xbbb3('0x38')],function(_0x4c307c){var _0x5578e4={};_0x5578e4[_0x4c307c]={'$like':'%'+_0x46a23d['query'][_0xbbb3('0x3e')]+'%'};return _0x5578e4;})});}_0xb017b0=_[_0xbbb3('0x3f')]({},_0xb017b0,_0x46a23d[_0xbbb3('0x47')]);return _0x2d6f0e['getActions'](_0xb017b0);}})[_0xbbb3('0x26')](function(_0x1dff65){if(_0x1dff65){_0x28c174=_0x1dff65[_0xbbb3('0x39')];if(!_0x46a23d[_0xbbb3('0x34')]['hasOwnProperty'](_0xbbb3('0x3a'))){_0xb017b0[_0xbbb3('0x1e')]=qs[_0xbbb3('0x1e')](_0x46a23d[_0xbbb3('0x34')][_0xbbb3('0x1e')]);_0xb017b0[_0xbbb3('0x1d')]=qs[_0xbbb3('0x1d')](_0x46a23d[_0xbbb3('0x34')][_0xbbb3('0x1d')]);}return _0x2d6f0e[_0xbbb3('0x5b')](_0xb017b0);}})[_0xbbb3('0x26')](function(_0x2f3b7e){if(_0x2f3b7e){return _0x2f3b7e?{'count':_0x28c174,'rows':_0x2f3b7e}:null;}})[_0xbbb3('0x26')](respondWithResult(_0xf6b7fd,null))[_0xbbb3('0x43')](handleError(_0xf6b7fd,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index aea4de8..47b0cb3 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 _0x7d4c=['api','bluebird','path','rimraf','./trigger.attributes','exports','Trigger','tools_triggers','../../config/logger'];(function(_0x3f940e,_0x140c3b){var _0x424b2e=function(_0x3f2fb4){while(--_0x3f2fb4){_0x3f940e['push'](_0x3f940e['shift']());}};_0x424b2e(++_0x140c3b);}(_0x7d4c,0xa1));var _0xc7d4=function(_0x541ea6,_0x51cab6){_0x541ea6=_0x541ea6-0x0;var _0x3c3e84=_0x7d4c[_0x541ea6];return _0x3c3e84;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc7d4('0x0'))(_0xc7d4('0x1'));var moment=require('moment');var BPromise=require(_0xc7d4('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc7d4('0x3'));var rimraf=require(_0xc7d4('0x4'));var config=require('../../config/environment');var attributes=require(_0xc7d4('0x5'));module[_0xc7d4('0x6')]=function(_0x5cbccc,_0xa63155){return _0x5cbccc['define'](_0xc7d4('0x7'),attributes,{'tableName':_0xc7d4('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4621=['api','moment','request-promise','path','rimraf','exports','Trigger','util','../../config/logger'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x4621,0xa0));var _0x1462=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x4621[_0x122ef9];return _0x42fba0;};'use strict';var _=require('lodash');var util=require(_0x1462('0x0'));var logger=require(_0x1462('0x1'))(_0x1462('0x2'));var moment=require(_0x1462('0x3'));var BPromise=require('bluebird');var rp=require(_0x1462('0x4'));var fs=require('fs');var path=require(_0x1462('0x5'));var rimraf=require(_0x1462('0x6'));var config=require('../../config/environment');var attributes=require('./trigger.attributes');module[_0x1462('0x7')]=function(_0x27d939,_0x20f083){return _0x27d939['define'](_0x1462('0x8'),attributes,{'tableName':'tools_triggers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trigger/trigger.rpc.js b/server/api/trigger/trigger.rpc.js index e83070e..a8f6a57 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 _0xfef3=['error','message','result','GetTrigger','Trigger','options','raw','where','attributes','limit','include','model','map','catch','ShowTrigger','find','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','debug','Trigger,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x27a3cf,_0x59899c){var _0x3e0b94=function(_0x209008){while(--_0x209008){_0x27a3cf['push'](_0x27a3cf['shift']());}};_0x3e0b94(++_0x59899c);}(_0xfef3,0x118));var _0x3fef=function(_0x4fce10,_0x596096){_0x4fce10=_0x4fce10-0x0;var _0x180848=_0xfef3[_0x4fce10];return _0x180848;};'use strict';var _=require(_0x3fef('0x0'));var util=require('util');var moment=require(_0x3fef('0x1'));var BPromise=require('bluebird');var rs=require(_0x3fef('0x2'));var fs=require('fs');var Redis=require(_0x3fef('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3fef('0x4'));var logger=require(_0x3fef('0x5'))('rpc');var config=require(_0x3fef('0x6'));var jayson=require(_0x3fef('0x7'));var client=jayson['client'][_0x3fef('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5f5b72,_0x800850,_0x33e00a){return new BPromise(function(_0x1fffc5,_0x41960c){return client[_0x3fef('0x9')](_0x5f5b72,_0x33e00a)[_0x3fef('0xa')](function(_0x31c30f){logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));logger[_0x3fef('0xe')](_0x3fef('0xf'),_0x800850,'request\x20sent',JSON[_0x3fef('0x10')](_0x31c30f));if(_0x31c30f[_0x3fef('0x11')]){if(_0x31c30f[_0x3fef('0x11')]['code']===0x1f4){logger[_0x3fef('0x11')]('Trigger,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('Trigger,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x1fffc5(_0x31c30f['error'][_0x3fef('0x12')]);}else{logger[_0x3fef('0xb')](_0x3fef('0xc'),_0x800850,_0x3fef('0xd'));_0x1fffc5(_0x31c30f[_0x3fef('0x13')][_0x3fef('0x12')]);}})['catch'](function(_0x1cbdbb){logger[_0x3fef('0x11')](_0x3fef('0xc'),_0x800850,_0x1cbdbb);_0x41960c(_0x1cbdbb);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['findAll']({'raw':_0x1613ad[_0x3fef('0x16')]?_0x1613ad[_0x3fef('0x16')][_0x3fef('0x17')]===undefined?!![]:![]:!![],'where':_0x1613ad[_0x3fef('0x16')]?_0x1613ad[_0x3fef('0x16')][_0x3fef('0x18')]||null:null,'attributes':_0x1613ad[_0x3fef('0x16')]?_0x1613ad[_0x3fef('0x16')][_0x3fef('0x19')]||null:null,'limit':_0x1613ad[_0x3fef('0x16')]?_0x1613ad[_0x3fef('0x16')][_0x3fef('0x1a')]||null:null,'include':_0x1613ad[_0x3fef('0x16')]?_0x1613ad[_0x3fef('0x16')][_0x3fef('0x1b')]?_['map'](_0x1613ad['options']['include'],function(_0x378b03){return{'model':db[_0x378b03[_0x3fef('0x1c')]],'as':_0x378b03['as'],'attributes':_0x378b03[_0x3fef('0x19')],'include':_0x378b03['include']?_[_0x3fef('0x1d')](_0x378b03['include'],function(_0x45464b){return{'model':db[_0x45464b[_0x3fef('0x1c')]],'as':_0x45464b['as'],'attributes':_0x45464b[_0x3fef('0x19')],'include':_0x45464b[_0x3fef('0x1b')]?_[_0x3fef('0x1d')](_0x45464b['include'],function(_0x4b4dee){return{'model':db[_0x4b4dee['model']],'as':_0x4b4dee['as'],'attributes':_0x4b4dee[_0x3fef('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fef('0xa')](function(_0x4ea2ab){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger['debug'](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x4ea2ab));_0x53d993(_0x4ea2ab);})[_0x3fef('0x1e')](function(_0x2b73fb){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2b73fb[_0x3fef('0x12')],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2b73fb[_0x3fef('0x12')]));});});};exports[_0x3fef('0x1f')]=function(_0x21aad4){var _0x11bd40=this;return new Promise(function(_0x5dbbc0,_0xcd635d){return db['Trigger'][_0x3fef('0x20')]({'raw':_0x21aad4[_0x3fef('0x16')]?_0x21aad4[_0x3fef('0x16')][_0x3fef('0x17')]===undefined?!![]:![]:!![],'where':_0x21aad4[_0x3fef('0x16')]?_0x21aad4[_0x3fef('0x16')][_0x3fef('0x18')]||null:null,'attributes':_0x21aad4[_0x3fef('0x16')]?_0x21aad4[_0x3fef('0x16')][_0x3fef('0x19')]||null:null,'include':_0x21aad4['options']?_0x21aad4['options'][_0x3fef('0x1b')]?_['map'](_0x21aad4[_0x3fef('0x16')][_0x3fef('0x1b')],function(_0x4075ed){return{'model':db[_0x4075ed[_0x3fef('0x1c')]],'as':_0x4075ed['as'],'attributes':_0x4075ed[_0x3fef('0x19')],'include':_0x4075ed[_0x3fef('0x1b')]?_[_0x3fef('0x1d')](_0x4075ed[_0x3fef('0x1b')],function(_0x205690){return{'model':db[_0x205690[_0x3fef('0x1c')]],'as':_0x205690['as'],'attributes':_0x205690[_0x3fef('0x19')],'include':_0x205690[_0x3fef('0x1b')]?_[_0x3fef('0x1d')](_0x205690[_0x3fef('0x1b')],function(_0x58d276){return{'model':db[_0x58d276[_0x3fef('0x1c')]],'as':_0x58d276['as'],'attributes':_0x58d276[_0x3fef('0x19')]};}):[]};}):[]};}):[]:[]})[_0x3fef('0xa')](function(_0x19e935){logger[_0x3fef('0xb')](_0x3fef('0x1f'),_0x21aad4);logger['debug']('ShowTrigger',_0x21aad4,JSON[_0x3fef('0x10')](_0x19e935));_0x5dbbc0(_0x19e935);})[_0x3fef('0x1e')](function(_0x42490a){logger[_0x3fef('0x11')](_0x3fef('0x1f'),_0x42490a[_0x3fef('0x12')],_0x21aad4);_0xcd635d(_0x11bd40[_0x3fef('0x11')](0x1f4,_0x42490a[_0x3fef('0x12')]));});});}; \ No newline at end of file +var _0xb9be=['Trigger','findAll','options','limit','include','map','model','attributes','ShowTrigger','find','raw','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','Trigger,\x20%s,\x20%s','debug','stringify','error','code','request\x20sent','result','message','catch','GetTrigger'];(function(_0xd2ea71,_0x4bbb95){var _0x2180df=function(_0xa3ab6){while(--_0xa3ab6){_0xd2ea71['push'](_0xd2ea71['shift']());}};_0x2180df(++_0x4bbb95);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4327fe,_0x4f8040){_0x4327fe=_0x4327fe-0x0;var _0x138651=_0xb9be[_0x4327fe];return _0x138651;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x49a8b9,_0x1ee7e0,_0x58ca1d){return new BPromise(function(_0x210eeb,_0x28dc5f){return client[_0xeb9b('0xc')](_0x49a8b9,_0x58ca1d)[_0xeb9b('0xd')](function(_0x418204){logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,'request\x20sent');logger[_0xeb9b('0x10')]('Trigger,\x20%s,\x20%s,\x20%s',_0x1ee7e0,'request\x20sent',JSON[_0xeb9b('0x11')](_0x418204));if(_0x418204[_0xeb9b('0x12')]){if(_0x418204['error'][_0xeb9b('0x13')]===0x1f4){logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x28dc5f(_0x418204['error']['message']);}logger[_0xeb9b('0x12')](_0xeb9b('0xf'),_0x1ee7e0,_0x418204[_0xeb9b('0x12')]['message']);return _0x210eeb(_0x418204['error']['message']);}else{logger[_0xeb9b('0xe')](_0xeb9b('0xf'),_0x1ee7e0,_0xeb9b('0x14'));_0x210eeb(_0x418204[_0xeb9b('0x15')][_0xeb9b('0x16')]);}})[_0xeb9b('0x17')](function(_0x239ccf){logger['error'](_0xeb9b('0xf'),_0x1ee7e0,_0x239ccf);_0x28dc5f(_0x239ccf);});});}exports[_0xeb9b('0x18')]=function(_0x21aca6){var _0x3a11e3=this;return new Promise(function(_0x3cbe3e,_0x1a140c){return db[_0xeb9b('0x19')][_0xeb9b('0x1a')]({'raw':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6['options']['where']||null:null,'attributes':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')]['attributes']||null:null,'limit':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1c')]||null:null,'include':_0x21aca6[_0xeb9b('0x1b')]?_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x21aca6[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x46df93){return{'model':db[_0x46df93[_0xeb9b('0x1f')]],'as':_0x46df93['as'],'attributes':_0x46df93[_0xeb9b('0x20')],'include':_0x46df93[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x46df93[_0xeb9b('0x1d')],function(_0x434461){return{'model':db[_0x434461['model']],'as':_0x434461['as'],'attributes':_0x434461[_0xeb9b('0x20')],'include':_0x434461['include']?_[_0xeb9b('0x1e')](_0x434461['include'],function(_0x347ec1){return{'model':db[_0x347ec1[_0xeb9b('0x1f')]],'as':_0x347ec1['as'],'attributes':_0x347ec1[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})[_0xeb9b('0xd')](function(_0x52f6c1){logger[_0xeb9b('0xe')](_0xeb9b('0x18'),_0x21aca6);logger['debug'](_0xeb9b('0x18'),_0x21aca6,JSON[_0xeb9b('0x11')](_0x52f6c1));_0x3cbe3e(_0x52f6c1);})['catch'](function(_0x2a4b51){logger[_0xeb9b('0x12')](_0xeb9b('0x18'),_0x2a4b51['message'],_0x21aca6);_0x1a140c(_0x3a11e3[_0xeb9b('0x12')](0x1f4,_0x2a4b51['message']));});});};exports[_0xeb9b('0x21')]=function(_0x4c1331){var _0x411467=this;return new Promise(function(_0x54c659,_0x27578d){return db['Trigger'][_0xeb9b('0x22')]({'raw':_0x4c1331['options']?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x23')]===undefined?!![]:![]:!![],'where':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x24')]||null:null,'attributes':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x20')]||null:null,'include':_0x4c1331[_0xeb9b('0x1b')]?_0x4c1331[_0xeb9b('0x1b')]['include']?_[_0xeb9b('0x1e')](_0x4c1331[_0xeb9b('0x1b')][_0xeb9b('0x1d')],function(_0x21ecfd){return{'model':db[_0x21ecfd[_0xeb9b('0x1f')]],'as':_0x21ecfd['as'],'attributes':_0x21ecfd[_0xeb9b('0x20')],'include':_0x21ecfd[_0xeb9b('0x1d')]?_['map'](_0x21ecfd[_0xeb9b('0x1d')],function(_0x2f3179){return{'model':db[_0x2f3179[_0xeb9b('0x1f')]],'as':_0x2f3179['as'],'attributes':_0x2f3179['attributes'],'include':_0x2f3179[_0xeb9b('0x1d')]?_[_0xeb9b('0x1e')](_0x2f3179[_0xeb9b('0x1d')],function(_0xab9ad5){return{'model':db[_0xab9ad5[_0xeb9b('0x1f')]],'as':_0xab9ad5['as'],'attributes':_0xab9ad5[_0xeb9b('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x24d235){logger[_0xeb9b('0xe')]('ShowTrigger',_0x4c1331);logger[_0xeb9b('0x10')](_0xeb9b('0x21'),_0x4c1331,JSON[_0xeb9b('0x11')](_0x24d235));_0x54c659(_0x24d235);})[_0xeb9b('0x17')](function(_0x37c678){logger[_0xeb9b('0x12')](_0xeb9b('0x21'),_0x37c678['message'],_0x4c1331);_0x27578d(_0x411467[_0xeb9b('0x12')](0x1f4,_0x37c678[_0xeb9b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 25f14c3..8ce939f 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 _0x7bae=['index','/:id','show','post','/:id/clone','clone','create','put','update','delete','exports','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated'];(function(_0x3ebf8c,_0x3e1efd){var _0x32ee6f=function(_0x116798){while(--_0x116798){_0x3ebf8c['push'](_0x3ebf8c['shift']());}};_0x32ee6f(++_0x3e1efd);}(_0x7bae,0x13b));var _0xe7ba=function(_0x1eda20,_0x1149f4){_0x1eda20=_0x1eda20-0x0;var _0x31b953=_0x7bae[_0x1eda20];return _0x31b953;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0xe7ba('0x3'));var config=require(_0xe7ba('0x4'));var controller=require(_0xe7ba('0x5'));router[_0xe7ba('0x6')]('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x8')]);router[_0xe7ba('0x6')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xa')]);router[_0xe7ba('0xb')](_0xe7ba('0xc'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xd')]);router['post']('/',auth[_0xe7ba('0x7')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0x9'),auth[_0xe7ba('0x7')](),controller['destroy']);module[_0xe7ba('0x12')]=router; \ No newline at end of file +var _0x207c=['get','/:id','isAuthenticated','post','/:id/clone','create','put','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./trunk.controller'];(function(_0x58d787,_0x11801d){var _0x5222c4=function(_0x1c6bc5){while(--_0x1c6bc5){_0x58d787['push'](_0x58d787['shift']());}};_0x5222c4(++_0x11801d);}(_0x207c,0x1e8));var _0xc207=function(_0x104857,_0x34844c){_0x104857=_0x104857-0x0;var _0x5c7d6d=_0x207c[_0x104857];return _0x5c7d6d;};'use strict';var multer=require('multer');var util=require(_0xc207('0x0'));var path=require(_0xc207('0x1'));var timeout=require(_0xc207('0x2'));var express=require(_0xc207('0x3'));var router=express[_0xc207('0x4')]();var auth=require(_0xc207('0x5'));var interaction=require(_0xc207('0x6'));var config=require('../../config/environment');var controller=require(_0xc207('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xc207('0x8')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['show']);router[_0xc207('0xb')](_0xc207('0xc'),auth[_0xc207('0xa')](),controller['clone']);router[_0xc207('0xb')]('/',auth[_0xc207('0xa')](),controller[_0xc207('0xd')]);router[_0xc207('0xe')](_0xc207('0x9'),auth[_0xc207('0xa')](),controller['update']);router['delete']('/:id',auth[_0xc207('0xa')](),controller['destroy']);module[_0xc207('0xf')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 1f989bd..31931cd 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 _0x24a2=['peer','from-voip-provider','ENUM','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','getDataValue','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','update','outgoing','force_rport,comedia','nat','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','ulaw;alaw;gsm','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','sequelize','STRING','name','friend','user'];(function(_0x3553b1,_0x296a7b){var _0x468b12=function(_0x23f988){while(--_0x23f988){_0x3553b1['push'](_0x3553b1['shift']());}};_0x468b12(++_0x296a7b);}(_0x24a2,0x1c3));var _0x224a=function(_0x114b19,_0x11e70b){_0x114b19=_0x114b19-0x0;var _0x533650=_0x24a2[_0x114b19];return _0x533650;};'use strict';var Sequelize=require(_0x224a('0x0'));module['exports']={'name':{'type':Sequelize[_0x224a('0x1')],'allowNull':![],'unique':_0x224a('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x224a('0x3'),_0x224a('0x4'),_0x224a('0x5')),'allowNull':![],'defaultValue':_0x224a('0x3')},'context':{'type':Sequelize[_0x224a('0x1')],'allowNull':![],'defaultValue':_0x224a('0x6')},'callingpres':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x8'),_0x224a('0x9'),_0x224a('0xa'),'ALLOWED',_0x224a('0xb'),_0x224a('0xc'),_0x224a('0xd'),_0x224a('0xe'))},'deny':{'type':Sequelize[_0x224a('0x1')]},'permit':{'type':Sequelize[_0x224a('0x1')]},'secret':{'type':Sequelize['STRING']},'md5secret':{'type':Sequelize[_0x224a('0x1')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':_0x224a('0xf'),'set':function(_0x5d8f74){this[_0x224a('0x10')](_0x224a('0x11'),_0x5d8f74?_0x5d8f74['join'](','):null);},'get':function(){return this[_0x224a('0x12')](_0x224a('0x11'))?this[_0x224a('0x12')](_0x224a('0x11'))['split'](','):null;},'comment':_0x224a('0x13')},'dtmfmode':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x14'),_0x224a('0x15'),_0x224a('0x16'),_0x224a('0x17'),_0x224a('0x18')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no',_0x224a('0x1a'),_0x224a('0x1b'),_0x224a('0x1c')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x224a('0x7')]('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x224a('0x1')]},'nat':{'type':Sequelize[_0x224a('0x1')],'defaultValue':_0x224a('0x1d'),'set':function(_0x11bcb2){this[_0x224a('0x10')](_0x224a('0x1e'),_0x11bcb2?_0x11bcb2[_0x224a('0x1f')](','):null);},'get':function(){return this[_0x224a('0x12')](_0x224a('0x1e'))?this['getDataValue']('nat')[_0x224a('0x20')](','):null;},'comment':_0x224a('0x21')},'callgroup':{'type':Sequelize[_0x224a('0x1')]},'namedcallgroup':{'type':Sequelize[_0x224a('0x1')]},'pickupgroup':{'type':Sequelize[_0x224a('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x224a('0x1')]},'language':{'type':Sequelize[_0x224a('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x224a('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x224a('0x1')],'defaultValue':_0x224a('0x22')},'allow':{'type':Sequelize[_0x224a('0x1')],'allowNull':![],'defaultValue':_0x224a('0x23'),'set':function(_0x4bd431){this['setDataValue']('allow',_0x4bd431?_0x4bd431[_0x224a('0x1f')](';'):_0x224a('0x23'));},'get':function(){return this['getDataValue'](_0x224a('0x24'))?this[_0x224a('0x12')](_0x224a('0x24'))[_0x224a('0x20')](';'):null;},'comment':_0x224a('0x25')},'autoframing':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'insecure':{'type':Sequelize[_0x224a('0x1')],'defaultValue':_0x224a('0x26'),'set':function(_0x645a76){this[_0x224a('0x10')](_0x224a('0x27'),_0x645a76?_0x645a76[_0x224a('0x1f')](','):null);},'get':function(){return this[_0x224a('0x12')]('insecure')?this[_0x224a('0x12')](_0x224a('0x27'))['split'](','):null;},'comment':_0x224a('0x28')},'trustrpid':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no',_0x224a('0x29'))},'promiscredir':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'accountcode':{'type':Sequelize[_0x224a('0x2a')](0xb)},'setvar':{'type':Sequelize[_0x224a('0x1')]},'callerid':{'type':Sequelize[_0x224a('0x1')],'defaultValue':_0x224a('0x2b')},'amaflags':{'type':Sequelize[_0x224a('0x1')]},'callcounter':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no'),'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'ignoresdpversion':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'subscribecontext':{'type':Sequelize['STRING']},'template':{'type':Sequelize[_0x224a('0x1')]},'videosupport':{'type':Sequelize[_0x224a('0x7')]('yes','no',_0x224a('0x2c')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x224a('0x2a')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x2d'),_0x224a('0x2e'),_0x224a('0x2f'))},'session_expires':{'type':Sequelize[_0x224a('0x2a')](0xb)},'session_minse':{'type':Sequelize[_0x224a('0x2a')](0xb)},'session_refresher':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x30'),_0x224a('0x31')),'defaultValue':_0x224a('0x31')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x224a('0x1')]},'fromdomain':{'type':Sequelize[_0x224a('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x224a('0x2a')](0x5)},'qualify':{'type':Sequelize[_0x224a('0x7')]('yes','no'),'defaultValue':_0x224a('0x19')},'keepalive':{'type':Sequelize[_0x224a('0x2a')](0xb)},'defaultip':{'type':Sequelize[_0x224a('0x1')]},'defaultuser':{'type':Sequelize[_0x224a('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x224a('0x2a')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x224a('0x2a')](0xb)},'sendrpid':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no',_0x224a('0x32')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x224a('0x1')]},'callbackextension':{'type':Sequelize[_0x224a('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize['INTEGER'](0xb)},'qualifyfreq':{'type':Sequelize[_0x224a('0x2a')](0xb)},'contactpermit':{'type':Sequelize[_0x224a('0x1')]},'contactdeny':{'type':Sequelize[_0x224a('0x1')]},'contactacl':{'type':Sequelize[_0x224a('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0x224a('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x224a('0x7')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no')},'force_avp':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'icesupport':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no')},'dtlsenable':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x19'),'no',_0x224a('0x33'),_0x224a('0x34'))},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize[_0x224a('0x1')]},'dtlscipher':{'type':Sequelize['STRING']},'dtlscafile':{'type':Sequelize[_0x224a('0x1')]},'dtlscapath':{'type':Sequelize[_0x224a('0x1')]},'dtlssetup':{'type':Sequelize[_0x224a('0x7')](_0x224a('0x35'),_0x224a('0x36'),_0x224a('0x37')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x224a('0x1')]},'usereqphone':{'type':Sequelize[_0x224a('0x7')]('yes','no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x224a('0x1')]},'recordofffeature':{'type':Sequelize['STRING']},'call_limit':{'type':Sequelize[_0x224a('0x2a')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x224a('0x7')]('yes','no')},'subscribemwi':{'type':Sequelize['ENUM'](_0x224a('0x19'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x224a('0x1')]},'mohsuggest':{'type':Sequelize[_0x224a('0x1')]},'parkinglot':{'type':Sequelize[_0x224a('0x1')]},'description':{'type':Sequelize[_0x224a('0x1')]},'host':{'type':Sequelize[_0x224a('0x1')],'defaultValue':_0x224a('0x38')},'canreinvite':{'type':Sequelize[_0x224a('0x7')]('yes','no',_0x224a('0x1a'),'update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x224a('0x1')]},'otherFields':{'type':Sequelize['STRING']},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x224a('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x3c13=['String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','auto','nonat','update','outgoing','yes','force_rport,comedia','nat','join','allow','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]','port,invite','insecure','INTEGER','always','accept','refuse','originate','uac','uas','pai','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','exports','STRING','name','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','setDataValue','transport','getDataValue','split'];(function(_0x43fa1a,_0x3be06d){var _0x214e21=function(_0x5c2a2b){while(--_0x5c2a2b){_0x43fa1a['push'](_0x43fa1a['shift']());}};_0x214e21(++_0x3be06d);}(_0x3c13,0xdb));var _0x33c1=function(_0x5102a6,_0x15063d){_0x5102a6=_0x5102a6-0x0;var _0x420726=_0x3c13[_0x5102a6];return _0x420726;};'use strict';var Sequelize=require(_0x33c1('0x0'));module[_0x33c1('0x1')]={'name':{'type':Sequelize[_0x33c1('0x2')],'allowNull':![],'unique':_0x33c1('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x33c1('0x4'),_0x33c1('0x5'),'peer'),'allowNull':![],'defaultValue':_0x33c1('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x33c1('0x6')},'callingpres':{'type':Sequelize['ENUM'](_0x33c1('0x7'),'ALLOWED_PASSED_SCREEN',_0x33c1('0x8'),'ALLOWED','PROHIB_NOT_SCREENED',_0x33c1('0x9'),_0x33c1('0xa'),_0x33c1('0xb'))},'deny':{'type':Sequelize[_0x33c1('0x2')]},'permit':{'type':Sequelize[_0x33c1('0x2')]},'secret':{'type':Sequelize[_0x33c1('0x2')]},'md5secret':{'type':Sequelize[_0x33c1('0x2')]},'remotesecret':{'type':Sequelize['STRING']},'transport':{'type':Sequelize['STRING'],'defaultValue':'udp','set':function(_0x438f5d){this[_0x33c1('0xc')](_0x33c1('0xd'),_0x438f5d?_0x438f5d['join'](','):null);},'get':function(){return this[_0x33c1('0xe')](_0x33c1('0xd'))?this['getDataValue'](_0x33c1('0xd'))[_0x33c1('0xf')](','):null;},'comment':_0x33c1('0x10')},'dtmfmode':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x12'),_0x33c1('0x13'),_0x33c1('0x14'),'inband',_0x33c1('0x15')),'defaultValue':_0x33c1('0x12')},'directmedia':{'type':Sequelize[_0x33c1('0x11')]('yes','no',_0x33c1('0x16'),_0x33c1('0x17'),_0x33c1('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM'](_0x33c1('0x19'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x33c1('0x2')]},'directmediadeny':{'type':Sequelize[_0x33c1('0x2')]},'nat':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':_0x33c1('0x1a'),'set':function(_0x4d6087){this['setDataValue'](_0x33c1('0x1b'),_0x4d6087?_0x4d6087['join'](','):null);},'get':function(){return this[_0x33c1('0xe')]('nat')?this[_0x33c1('0xe')](_0x33c1('0x1b'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x33c1('0x2')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x33c1('0x2')]},'namedpickupgroup':{'type':Sequelize[_0x33c1('0x2')]},'language':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4f4866){this[_0x33c1('0xc')]('allow',_0x4f4866?_0x4f4866[_0x33c1('0x1c')](';'):'ulaw;alaw;gsm');},'get':function(){return this[_0x33c1('0xe')](_0x33c1('0x1d'))?this[_0x33c1('0xe')](_0x33c1('0x1d'))[_0x33c1('0xf')](';'):null;},'comment':_0x33c1('0x1e')},'autoframing':{'type':Sequelize['ENUM'](_0x33c1('0x19'),'no')},'insecure':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':_0x33c1('0x1f'),'set':function(_0x18c7c6){this['setDataValue'](_0x33c1('0x20'),_0x18c7c6?_0x18c7c6[_0x33c1('0x1c')](','):null);},'get':function(){return this[_0x33c1('0xe')](_0x33c1('0x20'))?this[_0x33c1('0xe')]('insecure')[_0x33c1('0xf')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no','never')},'promiscredir':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'useclientcode':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'accountcode':{'type':Sequelize[_0x33c1('0x21')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize[_0x33c1('0x2')]},'callcounter':{'type':Sequelize[_0x33c1('0x11')]('yes','no'),'defaultValue':_0x33c1('0x19')},'busylevel':{'type':Sequelize[_0x33c1('0x21')](0xb)},'allowoverlap':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'allowsubscribe':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'allowtransfer':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM']('yes','no')},'subscribecontext':{'type':Sequelize[_0x33c1('0x2')]},'template':{'type':Sequelize[_0x33c1('0x2')]},'videosupport':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no',_0x33c1('0x22')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x33c1('0x21')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'mailbox':{'type':Sequelize[_0x33c1('0x2')]},'session_timers':{'type':Sequelize['ENUM'](_0x33c1('0x23'),_0x33c1('0x24'),_0x33c1('0x25'))},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0x33c1('0x21')](0xb)},'session_refresher':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x26'),_0x33c1('0x27')),'defaultValue':_0x33c1('0x27')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0x33c1('0x2')]},'fromdomain':{'type':Sequelize[_0x33c1('0x2')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x33c1('0x21')](0x5)},'qualify':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no'),'defaultValue':_0x33c1('0x19')},'keepalive':{'type':Sequelize['INTEGER'](0xb)},'defaultip':{'type':Sequelize[_0x33c1('0x2')]},'defaultuser':{'type':Sequelize[_0x33c1('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x33c1('0x21')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x33c1('0x21')](0xb)},'sendrpid':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no',_0x33c1('0x28')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x33c1('0x2')]},'callbackextension':{'type':Sequelize[_0x33c1('0x2')]},'timert1':{'type':Sequelize[_0x33c1('0x21')](0xb)},'timerb':{'type':Sequelize[_0x33c1('0x21')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0x33c1('0x2')]},'contactacl':{'type':Sequelize[_0x33c1('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0x33c1('0x2')]},'use_q850_reason':{'type':Sequelize[_0x33c1('0x2')]},'maxforwards':{'type':Sequelize[_0x33c1('0x21')](0xb)},'encryption':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'force_avp':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'icesupport':{'type':Sequelize[_0x33c1('0x11')]('yes','no')},'dtlsenable':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'dtlsverify':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no','fingerprint','certificate')},'dtlsrekey':{'type':Sequelize[_0x33c1('0x21')](0xb)},'dtlscertfile':{'type':Sequelize[_0x33c1('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0x33c1('0x2')]},'dtlscipher':{'type':Sequelize[_0x33c1('0x2')]},'dtlscafile':{'type':Sequelize[_0x33c1('0x2')]},'dtlscapath':{'type':Sequelize[_0x33c1('0x2')]},'dtlssetup':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x29'),_0x33c1('0x2a'),_0x33c1('0x2b')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x33c1('0x2')]},'usereqphone':{'type':Sequelize['ENUM'](_0x33c1('0x19'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x33c1('0x2')]},'recordofffeature':{'type':Sequelize[_0x33c1('0x2')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'subscribemwi':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no')},'vmexten':{'type':Sequelize[_0x33c1('0x2')]},'mohinterpret':{'type':Sequelize[_0x33c1('0x2')]},'mohsuggest':{'type':Sequelize['STRING']},'parkinglot':{'type':Sequelize[_0x33c1('0x2')]},'description':{'type':Sequelize[_0x33c1('0x2')]},'host':{'type':Sequelize[_0x33c1('0x2')],'defaultValue':_0x33c1('0x2c')},'canreinvite':{'type':Sequelize[_0x33c1('0x11')](_0x33c1('0x19'),'no','nonat',_0x33c1('0x17'),_0x33c1('0x2d')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x33c1('0x2')]},'active':{'type':Sequelize[_0x33c1('0x2e')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'defaultValue':'no'}}; \ No newline at end of file diff --git a/server/api/trunk/trunk.controller.js b/server/api/trunk/trunk.controller.js index b13ede9..cbde85e 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 _0xdb28=['moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','jayson/promise','http','test','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','request','then','info','Trunk,\x20%s,\x20%s','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','end','status','json','offset','limit','Content-Range','apply','reject','save','update','destroy','get','name','send','index','map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','rows','show','params','includeAll','find','clone','omit','createdAt','updatedAt','body','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','readFileSync','root','server/files/templates/registry.ejs','utf8','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','chan_sip.so','user','userProfileId','UserProfileResource','/etc/asterisk/sip_xcally_registers.conf','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x28e384,_0x41ccea){var _0x44145e=function(_0x88be4d){while(--_0x88be4d){_0x28e384['push'](_0x28e384['shift']());}};_0x44145e(++_0x41ccea);}(_0xdb28,0xe0));var _0x8db2=function(_0x3314ad,_0x1485f9){_0x3314ad=_0x3314ad-0x0;var _0x148cd4=_0xdb28[_0x3314ad];return _0x148cd4;};'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(_0x8db2('0x4'));var rp=require(_0x8db2('0x5'));var moment=require(_0x8db2('0x6'));var BPromise=require(_0x8db2('0x7'));var Mustache=require('mustache');var util=require(_0x8db2('0x8'));var path=require(_0x8db2('0x9'));var sox=require(_0x8db2('0xa'));var csv=require(_0x8db2('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x8db2('0xc'));var squel=require(_0x8db2('0xd'));var crypto=require(_0x8db2('0xe'));var jsforce=require(_0x8db2('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x8db2('0x10'));var Redis=require(_0x8db2('0x11'));var authService=require(_0x8db2('0x12'));var qs=require(_0x8db2('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8db2('0x14'));var logger=require(_0x8db2('0x15'))(_0x8db2('0x16'));var utils=require(_0x8db2('0x17'));var config=require('../../config/environment');var db=require(_0x8db2('0x18'))['db'];var jayson=require(_0x8db2('0x19'));var client=jayson['client'][_0x8db2('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x5ef095,_0x1a771e,_0x265186){if(_0x265186){var _0x25d5da=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x25d5da[_0x8db2('0x1b')](_0x1a771e)){return _0x5ef095;}else{throw new db['Sequelize'][(_0x8db2('0x1c'))](_0x8db2('0x1d'));}}else{return _0x5ef095;}}function respondWithRpcPromise(_0x28ac4a,_0x3bc220,_0x5b8fa8,_0x40469c){return new BPromise(function(_0xb425a6,_0x5798bd){var _0x57f765=_0x40469c||client;return _0x57f765[_0x8db2('0x1e')](_0x28ac4a,_0x5b8fa8)[_0x8db2('0x1f')](function(_0x1fc086){logger[_0x8db2('0x20')](_0x8db2('0x21'),_0x3bc220,'request\x20sent');logger['debug'](_0x8db2('0x22'),_0x3bc220,_0x8db2('0x23'),JSON[_0x8db2('0x24')](_0x1fc086));if(_0x1fc086[_0x8db2('0x25')]){if(_0x1fc086[_0x8db2('0x25')]['code']===0x1f4){logger[_0x8db2('0x25')](_0x8db2('0x21'),_0x3bc220,_0x1fc086['error'][_0x8db2('0x26')]);return _0x5798bd(_0x1fc086[_0x8db2('0x25')][_0x8db2('0x26')]);}logger[_0x8db2('0x25')]('Trunk,\x20%s,\x20%s',_0x3bc220,_0x1fc086[_0x8db2('0x25')][_0x8db2('0x26')]);return _0xb425a6(_0x1fc086[_0x8db2('0x25')][_0x8db2('0x26')]);}else{logger[_0x8db2('0x20')](_0x8db2('0x21'),_0x3bc220,_0x8db2('0x23'));_0xb425a6(_0x1fc086[_0x8db2('0x27')]['message']);}})[_0x8db2('0x28')](function(_0x22253e){logger[_0x8db2('0x25')](_0x8db2('0x21'),_0x3bc220,_0x22253e);_0x5798bd(_0x22253e);});});}function respondWithStatusCode(_0x3d234e,_0x5bd07d){_0x5bd07d=_0x5bd07d||0xcc;return function(_0x3729a5){if(_0x3729a5){return _0x3d234e[_0x8db2('0x29')](_0x5bd07d);}return _0x3d234e['status'](_0x5bd07d)[_0x8db2('0x2a')]();};}function respondWithResult(_0x2187f5,_0x4d4505){_0x4d4505=_0x4d4505||0xc8;return function(_0x233123){if(_0x233123){return _0x2187f5[_0x8db2('0x2b')](_0x4d4505)[_0x8db2('0x2c')](_0x233123);}};}function respondWithFilteredResult(_0x38eb40,_0x1d7919){return function(_0x3336b4){if(_0x3336b4){var _0x42aea3=_0x3336b4['count'],_0x31ba4c=_0x1d7919[_0x8db2('0x2d')],_0x54c9ba=_0x1d7919[_0x8db2('0x2d')]+_0x1d7919[_0x8db2('0x2e')],_0x975b3b;if(_0x54c9ba>=_0x42aea3){_0x54c9ba=_0x42aea3;_0x975b3b=0xc8;}else{_0x975b3b=0xce;}_0x38eb40[_0x8db2('0x2b')](_0x975b3b);return _0x38eb40['set'](_0x8db2('0x2f'),_0x31ba4c+'-'+_0x54c9ba+'/'+_0x42aea3)[_0x8db2('0x2c')](_0x3336b4);}return null;};}function patchUpdates(_0x5d9084){return function(_0x172549){try{jsonpatch[_0x8db2('0x30')](_0x172549,_0x5d9084,!![]);}catch(_0x4e7dd0){return BPromise[_0x8db2('0x31')](_0x4e7dd0);}return _0x172549[_0x8db2('0x32')]();};}function saveUpdates(_0x45662c,_0x332b45){return function(_0x5f11e6){if(_0x5f11e6){return _0x5f11e6[_0x8db2('0x33')](_0x45662c)[_0x8db2('0x1f')](function(_0x213da1){return _0x213da1;});}return null;};}function removeEntity(_0x177b84,_0x352d26){return function(_0x53375c){if(_0x53375c){return _0x53375c[_0x8db2('0x34')]()[_0x8db2('0x1f')](function(){var _0x21758f=_0x53375c[_0x8db2('0x35')]({'plain':!![]});var _0x3573c9='Trunks';return db['UserProfileResource']['destroy']({'where':{'type':_0x3573c9,'resourceId':_0x21758f['id']}})[_0x8db2('0x1f')](function(){return _0x53375c;});})[_0x8db2('0x1f')](function(){_0x177b84[_0x8db2('0x2b')](0xcc)[_0x8db2('0x2a')]();});}};}function handleEntityNotFound(_0x3c28de,_0x857e78){return function(_0x416f0e){if(!_0x416f0e){_0x3c28de['sendStatus'](0x194);}return _0x416f0e;};}function handleError(_0x3b2b0b,_0x5b7925){_0x5b7925=_0x5b7925||0x1f4;return function(_0x1fe7cb){logger['error'](_0x1fe7cb['stack']);if(_0x1fe7cb[_0x8db2('0x36')]){delete _0x1fe7cb[_0x8db2('0x36')];}_0x3b2b0b['status'](_0x5b7925)[_0x8db2('0x37')](_0x1fe7cb);};}exports[_0x8db2('0x38')]=function(_0x2ceda6,_0x3992f3){var _0x4544f4={},_0x3a0bd2={},_0x5b1204={'count':0x0,'rows':[]};var _0x5a66a0=_[_0x8db2('0x39')](db[_0x8db2('0x3a')][_0x8db2('0x3b')],function(_0x11b152){return{'name':_0x11b152[_0x8db2('0x3c')],'type':_0x11b152['type'][_0x8db2('0x3d')]};});_0x3a0bd2[_0x8db2('0x3e')]=_[_0x8db2('0x39')](_0x5a66a0,_0x8db2('0x36'));_0x3a0bd2['query']=_[_0x8db2('0x3f')](_0x2ceda6[_0x8db2('0x40')]);_0x3a0bd2[_0x8db2('0x41')]=_[_0x8db2('0x42')](_0x3a0bd2[_0x8db2('0x3e')],_0x3a0bd2[_0x8db2('0x40')]);_0x4544f4['attributes']=_[_0x8db2('0x42')](_0x3a0bd2[_0x8db2('0x3e')],qs[_0x8db2('0x43')](_0x2ceda6[_0x8db2('0x40')]['fields']));_0x4544f4[_0x8db2('0x44')]=_0x4544f4[_0x8db2('0x44')][_0x8db2('0x45')]?_0x4544f4['attributes']:_0x3a0bd2['model'];if(!_0x2ceda6[_0x8db2('0x40')]['hasOwnProperty'](_0x8db2('0x46'))){_0x4544f4[_0x8db2('0x2e')]=qs[_0x8db2('0x2e')](_0x2ceda6[_0x8db2('0x40')][_0x8db2('0x2e')]);_0x4544f4['offset']=qs['offset'](_0x2ceda6[_0x8db2('0x40')][_0x8db2('0x2d')]);}_0x4544f4['order']=qs[_0x8db2('0x47')](_0x2ceda6[_0x8db2('0x40')][_0x8db2('0x47')]);_0x4544f4[_0x8db2('0x48')]=qs[_0x8db2('0x41')](_[_0x8db2('0x49')](_0x2ceda6[_0x8db2('0x40')],_0x3a0bd2[_0x8db2('0x41')]));if(_0x2ceda6[_0x8db2('0x40')][_0x8db2('0x4a')]){_0x4544f4['where']=_[_0x8db2('0x4b')](_0x4544f4['where'],{'$or':_[_0x8db2('0x39')](_0x5a66a0,function(_0x4c9542){if(_0x4c9542[_0x8db2('0x4c')]!==_0x8db2('0x4d')){var _0x40f2ae={};_0x40f2ae[_0x4c9542[_0x8db2('0x36')]]={'$like':'%'+_0x2ceda6[_0x8db2('0x40')][_0x8db2('0x4a')]+'%'};return _0x40f2ae;}})});}_0x4544f4=_[_0x8db2('0x4b')]({},_0x4544f4,_0x2ceda6[_0x8db2('0x4e')]);var _0x1f3327={'where':_0x4544f4[_0x8db2('0x48')]};return db[_0x8db2('0x3a')][_0x8db2('0x4f')](_0x1f3327)['then'](function(_0x39891e){_0x5b1204[_0x8db2('0x4f')]=_0x39891e;if(_0x2ceda6[_0x8db2('0x40')]['includeAll']){_0x4544f4[_0x8db2('0x50')]=[{'all':!![]}];}return db[_0x8db2('0x3a')][_0x8db2('0x51')](_0x4544f4);})['then'](function(_0x5da4de){_0x5b1204[_0x8db2('0x52')]=_0x5da4de;return _0x5b1204;})[_0x8db2('0x1f')](respondWithFilteredResult(_0x3992f3,_0x4544f4))[_0x8db2('0x28')](handleError(_0x3992f3,null));};exports[_0x8db2('0x53')]=function(_0x48ad6d,_0x441358){var _0x1a2b8b={'raw':![],'where':{'id':_0x48ad6d[_0x8db2('0x54')]['id']}},_0xe3ae3b={};_0xe3ae3b[_0x8db2('0x3e')]=_[_0x8db2('0x3f')](db[_0x8db2('0x3a')][_0x8db2('0x3b')]);_0xe3ae3b[_0x8db2('0x40')]=_[_0x8db2('0x3f')](_0x48ad6d[_0x8db2('0x40')]);_0xe3ae3b[_0x8db2('0x41')]=_[_0x8db2('0x42')](_0xe3ae3b['model'],_0xe3ae3b[_0x8db2('0x40')]);_0x1a2b8b['attributes']=_['intersection'](_0xe3ae3b[_0x8db2('0x3e')],qs[_0x8db2('0x43')](_0x48ad6d[_0x8db2('0x40')][_0x8db2('0x43')]));_0x1a2b8b[_0x8db2('0x44')]=_0x1a2b8b[_0x8db2('0x44')][_0x8db2('0x45')]?_0x1a2b8b[_0x8db2('0x44')]:_0xe3ae3b['model'];if(_0x48ad6d[_0x8db2('0x40')][_0x8db2('0x55')]){_0x1a2b8b[_0x8db2('0x50')]=[{'all':!![]}];}_0x1a2b8b=_[_0x8db2('0x4b')]({},_0x1a2b8b,_0x48ad6d[_0x8db2('0x4e')]);return db['Trunk'][_0x8db2('0x56')](_0x1a2b8b)[_0x8db2('0x1f')](handleEntityNotFound(_0x441358,null))[_0x8db2('0x1f')](respondWithResult(_0x441358,null))[_0x8db2('0x28')](handleError(_0x441358,null));};exports[_0x8db2('0x57')]=function(_0xd4e04,_0x40f57e){var _0x32bb2b={'where':{'id':_0xd4e04['params']['id']}},_0x5dbe27={};_0x5dbe27[_0x8db2('0x3e')]=_[_0x8db2('0x3f')](db[_0x8db2('0x3a')][_0x8db2('0x3b')]);_0x32bb2b[_0x8db2('0x44')]=_[_0x8db2('0x42')](_0x5dbe27[_0x8db2('0x3e')],qs[_0x8db2('0x43')](_0xd4e04[_0x8db2('0x40')][_0x8db2('0x43')]));_0x32bb2b[_0x8db2('0x44')]=_0x32bb2b[_0x8db2('0x44')][_0x8db2('0x45')]?_0x32bb2b[_0x8db2('0x44')]:_0x5dbe27['model'];if(_0xd4e04[_0x8db2('0x40')]['includeAll']){_0x32bb2b[_0x8db2('0x50')]=[{'all':!![]}];}_0x32bb2b=_['merge']({},_0x32bb2b,_0xd4e04[_0x8db2('0x4e')]);return db[_0x8db2('0x3a')][_0x8db2('0x56')](_0x32bb2b)[_0x8db2('0x1f')](handleEntityNotFound(_0x40f57e,null))[_0x8db2('0x1f')](function(_0x5b657f){if(_0x5b657f){var _0x545d4b=_0x5b657f['get']({'plain':!![]});_0x545d4b=qs[_0x8db2('0x58')](_0x545d4b,['id',_0x8db2('0x59'),_0x8db2('0x5a')]);_0xd4e04[_0x8db2('0x5b')]=_['omit'](_0xd4e04[_0x8db2('0x5b')],['id','createdAt',_0x8db2('0x5a')]);return db[_0x8db2('0x3a')][_0x8db2('0x5c')](_['merge'](_0x545d4b,_0xd4e04[_0x8db2('0x5b')]),{'include':_0xd4e04[_0x8db2('0x40')][_0x8db2('0x55')]?[{'all':!![]}]:undefined})['then'](function(_0x4cc818){var _0x14a866=_0xd4e04['user']['get']({'plain':!![]});if(!_0x14a866)throw new Error(_0x8db2('0x5d'));if(_0x14a866[_0x8db2('0x5e')]==='user'){var _0xccc123=_0x4cc818[_0x8db2('0x35')]({'plain':!![]});var _0x425e80=_0x8db2('0x5f');return db[_0x8db2('0x60')][_0x8db2('0x56')]({'where':{'name':_0x425e80,'userProfileId':_0x14a866['userProfileId']},'raw':!![]})['then'](function(_0x4cd796){if(_0x4cd796&&_0x4cd796[_0x8db2('0x61')]===0x0){return db['UserProfileResource']['create']({'name':_0xccc123[_0x8db2('0x36')],'resourceId':_0xccc123['id'],'type':_0x4cd796['name'],'sectionId':_0x4cd796['id']},{})[_0x8db2('0x1f')](function(){return _0x4cc818;});}else{return _0x4cc818;}})[_0x8db2('0x28')](function(_0x1512b1){logger['error'](_0x8db2('0x62'),_0x1512b1);throw _0x1512b1;});}return _0x4cc818;});}})[_0x8db2('0x1f')](respondWithResult(_0x40f57e,0xc9))[_0x8db2('0x28')](handleError(_0x40f57e,null));};exports[_0x8db2('0x5c')]=function(_0x482952,_0x1a351b,_0xd2a895){var _0x31506c;return db[_0x8db2('0x3a')][_0x8db2('0x5c')](_0x482952[_0x8db2('0x5b')],{'raw':!![]})[_0x8db2('0x1f')](function(_0x546c35){_0x31506c=_0x546c35;return db['Trunk'][_0x8db2('0x51')]({'raw':!![]});})[_0x8db2('0x1f')](function(_0x4ccb79){var _0x5ae18b=fs['readFileSync'](path[_0x8db2('0x63')](config['root'],_0x8db2('0x64')),'utf8');var _0x53fd9d=fs[_0x8db2('0x65')](path[_0x8db2('0x63')](config[_0x8db2('0x66')],_0x8db2('0x67')),_0x8db2('0x68'));var _0x4cfeb3=ejs[_0x8db2('0x69')](_0x5ae18b,{'trunks':_0x4ccb79||[]});fs[_0x8db2('0x6a')](_0x8db2('0x6b'),_0x4cfeb3);if(_0x31506c[_0x8db2('0x6c')]){var _0x47f13a=ejs[_0x8db2('0x69')](_0x53fd9d,{'trunks':_0x4ccb79||[]});fs[_0x8db2('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x47f13a);}})[_0x8db2('0x1f')](function(){return respondWithRpcPromise(_0x8db2('0x6d'),_0x8db2('0x5c'),{'module':_0x8db2('0x6e')});})[_0x8db2('0x1f')](function(){var _0x2f3eaf=_0x482952[_0x8db2('0x6f')][_0x8db2('0x35')]({'plain':!![]});if(!_0x2f3eaf)throw new Error(_0x8db2('0x5d'));if(_0x2f3eaf[_0x8db2('0x5e')]===_0x8db2('0x6f')){var _0x2ac773=_0x31506c['get']({'plain':!![]});return db['UserProfileSection'][_0x8db2('0x56')]({'where':{'name':_0x8db2('0x5f'),'userProfileId':_0x2f3eaf[_0x8db2('0x70')]},'raw':!![]})[_0x8db2('0x1f')](function(_0x16e45a){if(_0x16e45a&&_0x16e45a[_0x8db2('0x61')]===0x0){return db[_0x8db2('0x71')][_0x8db2('0x5c')]({'name':_0x2ac773[_0x8db2('0x36')],'resourceId':_0x2ac773['id'],'type':_0x16e45a[_0x8db2('0x36')],'sectionId':_0x16e45a['id']},{})[_0x8db2('0x1f')](function(){return _0x31506c;});}else{return _0x31506c;}})['catch'](function(_0x5e3ef5){logger[_0x8db2('0x25')](_0x8db2('0x62'),_0x5e3ef5);throw _0x5e3ef5;});}return _0x31506c;})[_0x8db2('0x1f')](respondWithResult(_0x1a351b,0xc9))[_0x8db2('0x28')](handleError(_0x1a351b,null));};exports[_0x8db2('0x33')]=function(_0x4355db,_0x53fae6,_0x39663f){var _0x1f6f1d;return db[_0x8db2('0x3a')][_0x8db2('0x56')]({'where':{'id':_0x4355db[_0x8db2('0x54')]['id']}})[_0x8db2('0x1f')](handleEntityNotFound(_0x53fae6,null))[_0x8db2('0x1f')](saveUpdates(_0x4355db[_0x8db2('0x5b')],null))[_0x8db2('0x1f')](function(_0x2dbf23){if(_0x2dbf23){_0x1f6f1d=_0x2dbf23;return db['Trunk']['findAll']({'raw':!![]});}})[_0x8db2('0x1f')](function(_0x1dc3c3){if(_0x1dc3c3){var _0x15ef4a=fs['readFileSync'](path[_0x8db2('0x63')](config[_0x8db2('0x66')],_0x8db2('0x64')),_0x8db2('0x68'));var _0x2a586a=fs[_0x8db2('0x65')](path[_0x8db2('0x63')](config['root'],_0x8db2('0x67')),'utf8');var _0x5e3fb6=ejs[_0x8db2('0x69')](_0x15ef4a,{'trunks':_0x1dc3c3||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x5e3fb6);var _0x149eee=ejs['render'](_0x2a586a,{'trunks':_0x1dc3c3||[]});fs['writeFileSync'](_0x8db2('0x72'),_0x149eee);return respondWithRpcPromise('Reload',_0x8db2('0x33'),{'module':_0x8db2('0x6e')});}return null;})[_0x8db2('0x1f')](function(_0x3834df){if(_0x3834df){return _0x1f6f1d;}})[_0x8db2('0x1f')](respondWithResult(_0x53fae6,null))[_0x8db2('0x28')](handleError(_0x53fae6,null));};exports[_0x8db2('0x34')]=function(_0x4ad8c1,_0x4460de,_0x26b56d){var _0x4e9ec1;return db['Trunk'][_0x8db2('0x56')]({'where':{'id':_0x4ad8c1[_0x8db2('0x54')]['id']}})[_0x8db2('0x1f')](handleEntityNotFound(_0x4460de,null))[_0x8db2('0x1f')](removeEntity(_0x4460de,null))[_0x8db2('0x1f')](function(){return db[_0x8db2('0x3a')][_0x8db2('0x51')]({'raw':!![]});})[_0x8db2('0x1f')](function(_0x32efa2){var _0x13237d=fs['readFileSync'](path[_0x8db2('0x63')](config[_0x8db2('0x66')],_0x8db2('0x64')),_0x8db2('0x68'));var _0x5baefe=fs[_0x8db2('0x65')](path[_0x8db2('0x63')](config[_0x8db2('0x66')],'server/files/templates/registry.ejs'),_0x8db2('0x68'));var _0x503a53=ejs[_0x8db2('0x69')](_0x13237d,{'trunks':_0x32efa2});var _0x1ac4ac=ejs[_0x8db2('0x69')](_0x5baefe,{'trunks':_0x32efa2});fs[_0x8db2('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x503a53);fs[_0x8db2('0x6a')]('/etc/asterisk/sip_xcally_registers.conf',_0x1ac4ac);return respondWithRpcPromise(_0x8db2('0x6d'),_0x8db2('0x34'),{'module':'chan_sip.so'});})['catch'](handleError(_0x4460de,null));}; \ No newline at end of file +var _0x8a8c=['Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','set','Content-Range','apply','update','destroy','get','Trunks','sendStatus','stack','name','send','map','Trunk','fieldName','type','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','params','rawAttributes','clone','find','createdAt','omit','body','updatedAt','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','readFileSync','join','root','server/files/templates/trunk.ejs','render','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','utf8','server/files/templates/registry.ejs','Reload','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','client','http','test','ValidationError','request','then','info'];(function(_0x183adc,_0x530a97){var _0x2f809b=function(_0x52aef3){while(--_0x52aef3){_0x183adc['push'](_0x183adc['shift']());}};_0x2f809b(++_0x530a97);}(_0x8a8c,0x1a0));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xc8a8('0x0'));var emlformat=require(_0xc8a8('0x1'));var rimraf=require(_0xc8a8('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc8a8('0x3'));var moment=require(_0xc8a8('0x4'));var BPromise=require(_0xc8a8('0x5'));var Mustache=require('mustache');var util=require(_0xc8a8('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xc8a8('0x7'));var ejs=require(_0xc8a8('0x8'));var fs=require('fs');var _=require(_0xc8a8('0x9'));var squel=require(_0xc8a8('0xa'));var crypto=require(_0xc8a8('0xb'));var jsforce=require(_0xc8a8('0xc'));var deskjs=require(_0xc8a8('0xd'));var toCsv=require(_0xc8a8('0x7'));var querystring=require(_0xc8a8('0xe'));var Papa=require(_0xc8a8('0xf'));var Redis=require(_0xc8a8('0x10'));var authService=require(_0xc8a8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xc8a8('0x12'));var hardwareService=require(_0xc8a8('0x13'));var logger=require(_0xc8a8('0x14'))(_0xc8a8('0x15'));var utils=require(_0xc8a8('0x16'));var config=require(_0xc8a8('0x17'));var db=require(_0xc8a8('0x18'))['db'];var jayson=require('jayson/promise');var client=jayson[_0xc8a8('0x19')][_0xc8a8('0x1a')]({'port':0x232a});function checkPasswordPattern(_0x492810,_0x22cecc,_0x4bb46e){if(_0x4bb46e){var _0x163072=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x163072[_0xc8a8('0x1b')](_0x22cecc)){return _0x492810;}else{throw new db['Sequelize'][(_0xc8a8('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 _0x492810;}}function respondWithRpcPromise(_0x51bd39,_0x4aa1d2,_0x160abe,_0x33a450){return new BPromise(function(_0x2b5e3a,_0x2bdd56){var _0x46e183=_0x33a450||client;return _0x46e183[_0xc8a8('0x1d')](_0x51bd39,_0x160abe)[_0xc8a8('0x1e')](function(_0x500414){logger[_0xc8a8('0x1f')](_0xc8a8('0x20'),_0x4aa1d2,_0xc8a8('0x21'));logger[_0xc8a8('0x22')](_0xc8a8('0x23'),_0x4aa1d2,'request\x20sent',JSON[_0xc8a8('0x24')](_0x500414));if(_0x500414['error']){if(_0x500414[_0xc8a8('0x25')]['code']===0x1f4){logger[_0xc8a8('0x25')]('Trunk,\x20%s,\x20%s',_0x4aa1d2,_0x500414[_0xc8a8('0x25')][_0xc8a8('0x26')]);return _0x2bdd56(_0x500414[_0xc8a8('0x25')][_0xc8a8('0x26')]);}logger[_0xc8a8('0x25')](_0xc8a8('0x20'),_0x4aa1d2,_0x500414['error']['message']);return _0x2b5e3a(_0x500414[_0xc8a8('0x25')]['message']);}else{logger['info']('Trunk,\x20%s,\x20%s',_0x4aa1d2,_0xc8a8('0x21'));_0x2b5e3a(_0x500414[_0xc8a8('0x27')][_0xc8a8('0x26')]);}})[_0xc8a8('0x28')](function(_0x3e8d7d){logger['error']('Trunk,\x20%s,\x20%s',_0x4aa1d2,_0x3e8d7d);_0x2bdd56(_0x3e8d7d);});});}function respondWithStatusCode(_0x5cd87c,_0x44ba45){_0x44ba45=_0x44ba45||0xcc;return function(_0x150e27){if(_0x150e27){return _0x5cd87c['sendStatus'](_0x44ba45);}return _0x5cd87c[_0xc8a8('0x29')](_0x44ba45)[_0xc8a8('0x2a')]();};}function respondWithResult(_0x234579,_0x549e38){_0x549e38=_0x549e38||0xc8;return function(_0x398958){if(_0x398958){return _0x234579[_0xc8a8('0x29')](_0x549e38)[_0xc8a8('0x2b')](_0x398958);}};}function respondWithFilteredResult(_0x396840,_0x3842cc){return function(_0x4c8290){if(_0x4c8290){var _0x5a76f7=_0x4c8290['count'],_0x37016a=_0x3842cc['offset'],_0x588ce1=_0x3842cc[_0xc8a8('0x2c')]+_0x3842cc['limit'],_0x1681c2;if(_0x588ce1>=_0x5a76f7){_0x588ce1=_0x5a76f7;_0x1681c2=0xc8;}else{_0x1681c2=0xce;}_0x396840[_0xc8a8('0x29')](_0x1681c2);return _0x396840[_0xc8a8('0x2d')](_0xc8a8('0x2e'),_0x37016a+'-'+_0x588ce1+'/'+_0x5a76f7)[_0xc8a8('0x2b')](_0x4c8290);}return null;};}function patchUpdates(_0x59a95f){return function(_0xbf053a){try{jsonpatch[_0xc8a8('0x2f')](_0xbf053a,_0x59a95f,!![]);}catch(_0x4b99af){return BPromise['reject'](_0x4b99af);}return _0xbf053a['save']();};}function saveUpdates(_0x5de415,_0x30229f){return function(_0x2ee723){if(_0x2ee723){return _0x2ee723[_0xc8a8('0x30')](_0x5de415)[_0xc8a8('0x1e')](function(_0x3f594b){return _0x3f594b;});}return null;};}function removeEntity(_0x1ada93,_0x1ba5ff){return function(_0x42e061){if(_0x42e061){return _0x42e061[_0xc8a8('0x31')]()[_0xc8a8('0x1e')](function(){var _0x1b8bcc=_0x42e061[_0xc8a8('0x32')]({'plain':!![]});var _0x1c56a0=_0xc8a8('0x33');return db['UserProfileResource'][_0xc8a8('0x31')]({'where':{'type':_0x1c56a0,'resourceId':_0x1b8bcc['id']}})['then'](function(){return _0x42e061;});})[_0xc8a8('0x1e')](function(){_0x1ada93[_0xc8a8('0x29')](0xcc)[_0xc8a8('0x2a')]();});}};}function handleEntityNotFound(_0x33ce86,_0x23d4f1){return function(_0xf08dbc){if(!_0xf08dbc){_0x33ce86[_0xc8a8('0x34')](0x194);}return _0xf08dbc;};}function handleError(_0x47dc59,_0x329b2c){_0x329b2c=_0x329b2c||0x1f4;return function(_0x56ceb9){logger['error'](_0x56ceb9[_0xc8a8('0x35')]);if(_0x56ceb9[_0xc8a8('0x36')]){delete _0x56ceb9[_0xc8a8('0x36')];}_0x47dc59[_0xc8a8('0x29')](_0x329b2c)[_0xc8a8('0x37')](_0x56ceb9);};}exports['index']=function(_0x50488e,_0x56dae6){var _0x539a0c={},_0x407906={},_0x4398bd={'count':0x0,'rows':[]};var _0x318b25=_[_0xc8a8('0x38')](db[_0xc8a8('0x39')]['rawAttributes'],function(_0x3317d){return{'name':_0x3317d[_0xc8a8('0x3a')],'type':_0x3317d[_0xc8a8('0x3b')]['key']};});_0x407906['model']=_['map'](_0x318b25,_0xc8a8('0x36'));_0x407906['query']=_[_0xc8a8('0x3c')](_0x50488e['query']);_0x407906[_0xc8a8('0x3d')]=_[_0xc8a8('0x3e')](_0x407906[_0xc8a8('0x3f')],_0x407906[_0xc8a8('0x40')]);_0x539a0c[_0xc8a8('0x41')]=_[_0xc8a8('0x3e')](_0x407906['model'],qs[_0xc8a8('0x42')](_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x42')]));_0x539a0c['attributes']=_0x539a0c[_0xc8a8('0x41')][_0xc8a8('0x43')]?_0x539a0c['attributes']:_0x407906[_0xc8a8('0x3f')];if(!_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x44')](_0xc8a8('0x45'))){_0x539a0c['limit']=qs[_0xc8a8('0x46')](_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x46')]);_0x539a0c[_0xc8a8('0x2c')]=qs[_0xc8a8('0x2c')](_0x50488e[_0xc8a8('0x40')]['offset']);}_0x539a0c[_0xc8a8('0x47')]=qs['sort'](_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x48')]);_0x539a0c[_0xc8a8('0x49')]=qs[_0xc8a8('0x3d')](_[_0xc8a8('0x4a')](_0x50488e[_0xc8a8('0x40')],_0x407906[_0xc8a8('0x3d')]));if(_0x50488e['query'][_0xc8a8('0x4b')]){_0x539a0c['where']=_[_0xc8a8('0x4c')](_0x539a0c[_0xc8a8('0x49')],{'$or':_[_0xc8a8('0x38')](_0x318b25,function(_0x3445b9){if(_0x3445b9['type']!==_0xc8a8('0x4d')){var _0x2fe25c={};_0x2fe25c[_0x3445b9[_0xc8a8('0x36')]]={'$like':'%'+_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x4b')]+'%'};return _0x2fe25c;}})});}_0x539a0c=_[_0xc8a8('0x4c')]({},_0x539a0c,_0x50488e[_0xc8a8('0x4e')]);var _0x3e0294={'where':_0x539a0c[_0xc8a8('0x49')]};return db['Trunk'][_0xc8a8('0x4f')](_0x3e0294)[_0xc8a8('0x1e')](function(_0x4d1c49){_0x4398bd[_0xc8a8('0x4f')]=_0x4d1c49;if(_0x50488e[_0xc8a8('0x40')][_0xc8a8('0x50')]){_0x539a0c[_0xc8a8('0x51')]=[{'all':!![]}];}return db[_0xc8a8('0x39')][_0xc8a8('0x52')](_0x539a0c);})[_0xc8a8('0x1e')](function(_0x35b1dc){_0x4398bd['rows']=_0x35b1dc;return _0x4398bd;})[_0xc8a8('0x1e')](respondWithFilteredResult(_0x56dae6,_0x539a0c))[_0xc8a8('0x28')](handleError(_0x56dae6,null));};exports['show']=function(_0x3d3193,_0xf6198e){var _0x10aaed={'raw':![],'where':{'id':_0x3d3193[_0xc8a8('0x53')]['id']}},_0x5c18ac={};_0x5c18ac[_0xc8a8('0x3f')]=_[_0xc8a8('0x3c')](db[_0xc8a8('0x39')][_0xc8a8('0x54')]);_0x5c18ac[_0xc8a8('0x40')]=_[_0xc8a8('0x3c')](_0x3d3193[_0xc8a8('0x40')]);_0x5c18ac[_0xc8a8('0x3d')]=_[_0xc8a8('0x3e')](_0x5c18ac[_0xc8a8('0x3f')],_0x5c18ac[_0xc8a8('0x40')]);_0x10aaed['attributes']=_[_0xc8a8('0x3e')](_0x5c18ac[_0xc8a8('0x3f')],qs['fields'](_0x3d3193[_0xc8a8('0x40')][_0xc8a8('0x42')]));_0x10aaed[_0xc8a8('0x41')]=_0x10aaed['attributes'][_0xc8a8('0x43')]?_0x10aaed['attributes']:_0x5c18ac[_0xc8a8('0x3f')];if(_0x3d3193['query']['includeAll']){_0x10aaed[_0xc8a8('0x51')]=[{'all':!![]}];}_0x10aaed=_[_0xc8a8('0x4c')]({},_0x10aaed,_0x3d3193[_0xc8a8('0x4e')]);return db['Trunk']['find'](_0x10aaed)['then'](handleEntityNotFound(_0xf6198e,null))[_0xc8a8('0x1e')](respondWithResult(_0xf6198e,null))[_0xc8a8('0x28')](handleError(_0xf6198e,null));};exports[_0xc8a8('0x55')]=function(_0x37e094,_0x802341){var _0x3c2f75={'where':{'id':_0x37e094[_0xc8a8('0x53')]['id']}},_0x446fc3={};_0x446fc3['model']=_['keys'](db[_0xc8a8('0x39')][_0xc8a8('0x54')]);_0x3c2f75['attributes']=_[_0xc8a8('0x3e')](_0x446fc3['model'],qs[_0xc8a8('0x42')](_0x37e094['query'][_0xc8a8('0x42')]));_0x3c2f75[_0xc8a8('0x41')]=_0x3c2f75[_0xc8a8('0x41')]['length']?_0x3c2f75[_0xc8a8('0x41')]:_0x446fc3['model'];if(_0x37e094[_0xc8a8('0x40')][_0xc8a8('0x50')]){_0x3c2f75[_0xc8a8('0x51')]=[{'all':!![]}];}_0x3c2f75=_[_0xc8a8('0x4c')]({},_0x3c2f75,_0x37e094[_0xc8a8('0x4e')]);return db[_0xc8a8('0x39')][_0xc8a8('0x56')](_0x3c2f75)['then'](handleEntityNotFound(_0x802341,null))[_0xc8a8('0x1e')](function(_0x558bdc){if(_0x558bdc){var _0x5df060=_0x558bdc[_0xc8a8('0x32')]({'plain':!![]});_0x5df060=qs['omit'](_0x5df060,['id',_0xc8a8('0x57'),'updatedAt']);_0x37e094['body']=_[_0xc8a8('0x58')](_0x37e094[_0xc8a8('0x59')],['id',_0xc8a8('0x57'),_0xc8a8('0x5a')]);return db['Trunk'][_0xc8a8('0x5b')](_[_0xc8a8('0x4c')](_0x5df060,_0x37e094[_0xc8a8('0x59')]),{'include':_0x37e094[_0xc8a8('0x40')]['includeAll']?[{'all':!![]}]:undefined})[_0xc8a8('0x1e')](function(_0x26fb63){var _0x291694=_0x37e094[_0xc8a8('0x5c')][_0xc8a8('0x32')]({'plain':!![]});if(!_0x291694)throw new Error(_0xc8a8('0x5d'));if(_0x291694[_0xc8a8('0x5e')]===_0xc8a8('0x5c')){var _0x15d812=_0x26fb63[_0xc8a8('0x32')]({'plain':!![]});var _0x578cdd=_0xc8a8('0x33');return db[_0xc8a8('0x5f')][_0xc8a8('0x56')]({'where':{'name':_0x578cdd,'userProfileId':_0x291694[_0xc8a8('0x60')]},'raw':!![]})['then'](function(_0x15479f){if(_0x15479f&&_0x15479f[_0xc8a8('0x61')]===0x0){return db[_0xc8a8('0x62')]['create']({'name':_0x15d812[_0xc8a8('0x36')],'resourceId':_0x15d812['id'],'type':_0x15479f[_0xc8a8('0x36')],'sectionId':_0x15479f['id']},{})['then'](function(){return _0x26fb63;});}else{return _0x26fb63;}})[_0xc8a8('0x28')](function(_0x2bbe9c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bbe9c);throw _0x2bbe9c;});}return _0x26fb63;});}})[_0xc8a8('0x1e')](respondWithResult(_0x802341,0xc9))[_0xc8a8('0x28')](handleError(_0x802341,null));};exports[_0xc8a8('0x5b')]=function(_0x2e151d,_0x388f06,_0x66d3d4){var _0x2b5d05;return db[_0xc8a8('0x39')][_0xc8a8('0x5b')](_0x2e151d[_0xc8a8('0x59')],{'raw':!![]})['then'](function(_0x216289){_0x2b5d05=_0x216289;return db[_0xc8a8('0x39')][_0xc8a8('0x52')]({'raw':!![]});})[_0xc8a8('0x1e')](function(_0x19bc27){var _0x4a976a=fs[_0xc8a8('0x63')](path[_0xc8a8('0x64')](config[_0xc8a8('0x65')],_0xc8a8('0x66')),'utf8');var _0x139c25=fs['readFileSync'](path[_0xc8a8('0x64')](config[_0xc8a8('0x65')],'server/files/templates/registry.ejs'),'utf8');var _0xff219a=ejs[_0xc8a8('0x67')](_0x4a976a,{'trunks':_0x19bc27||[]});fs[_0xc8a8('0x68')](_0xc8a8('0x69'),_0xff219a);if(_0x2b5d05[_0xc8a8('0x6a')]){var _0x8cc23=ejs[_0xc8a8('0x67')](_0x139c25,{'trunks':_0x19bc27||[]});fs[_0xc8a8('0x68')](_0xc8a8('0x6b'),_0x8cc23);}})[_0xc8a8('0x1e')](function(){return respondWithRpcPromise('Reload',_0xc8a8('0x5b'),{'module':_0xc8a8('0x6c')});})[_0xc8a8('0x1e')](function(){var _0x1e574b=_0x2e151d[_0xc8a8('0x5c')][_0xc8a8('0x32')]({'plain':!![]});if(!_0x1e574b)throw new Error(_0xc8a8('0x5d'));if(_0x1e574b[_0xc8a8('0x5e')]==='user'){var _0x59d48=_0x2b5d05[_0xc8a8('0x32')]({'plain':!![]});return db[_0xc8a8('0x5f')][_0xc8a8('0x56')]({'where':{'name':_0xc8a8('0x33'),'userProfileId':_0x1e574b[_0xc8a8('0x60')]},'raw':!![]})[_0xc8a8('0x1e')](function(_0x496778){if(_0x496778&&_0x496778['autoAssociation']===0x0){return db[_0xc8a8('0x62')]['create']({'name':_0x59d48['name'],'resourceId':_0x59d48['id'],'type':_0x496778[_0xc8a8('0x36')],'sectionId':_0x496778['id']},{})[_0xc8a8('0x1e')](function(){return _0x2b5d05;});}else{return _0x2b5d05;}})['catch'](function(_0x4534b6){logger[_0xc8a8('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4534b6);throw _0x4534b6;});}return _0x2b5d05;})[_0xc8a8('0x1e')](respondWithResult(_0x388f06,0xc9))[_0xc8a8('0x28')](handleError(_0x388f06,null));};exports[_0xc8a8('0x30')]=function(_0x5d5e39,_0x57f512,_0x2e5df6){var _0x357053;return db['Trunk'][_0xc8a8('0x56')]({'where':{'id':_0x5d5e39[_0xc8a8('0x53')]['id']}})[_0xc8a8('0x1e')](handleEntityNotFound(_0x57f512,null))[_0xc8a8('0x1e')](saveUpdates(_0x5d5e39['body'],null))[_0xc8a8('0x1e')](function(_0x411c09){if(_0x411c09){_0x357053=_0x411c09;return db[_0xc8a8('0x39')]['findAll']({'raw':!![]});}})[_0xc8a8('0x1e')](function(_0x4cc1c7){if(_0x4cc1c7){var _0x115325=fs[_0xc8a8('0x63')](path[_0xc8a8('0x64')](config['root'],_0xc8a8('0x66')),_0xc8a8('0x6d'));var _0x1e176e=fs['readFileSync'](path[_0xc8a8('0x64')](config['root'],_0xc8a8('0x6e')),_0xc8a8('0x6d'));var _0x5d2b06=ejs[_0xc8a8('0x67')](_0x115325,{'trunks':_0x4cc1c7||[]});fs[_0xc8a8('0x68')]('/etc/asterisk/sip_xcally_trunks.conf',_0x5d2b06);var _0x17adde=ejs[_0xc8a8('0x67')](_0x1e176e,{'trunks':_0x4cc1c7||[]});fs[_0xc8a8('0x68')](_0xc8a8('0x6b'),_0x17adde);return respondWithRpcPromise('Reload',_0xc8a8('0x30'),{'module':_0xc8a8('0x6c')});}return null;})[_0xc8a8('0x1e')](function(_0x1346ce){if(_0x1346ce){return _0x357053;}})[_0xc8a8('0x1e')](respondWithResult(_0x57f512,null))[_0xc8a8('0x28')](handleError(_0x57f512,null));};exports[_0xc8a8('0x31')]=function(_0x4d5993,_0x19bd4c,_0x399ca2){var _0x24d1f1;return db[_0xc8a8('0x39')][_0xc8a8('0x56')]({'where':{'id':_0x4d5993[_0xc8a8('0x53')]['id']}})[_0xc8a8('0x1e')](handleEntityNotFound(_0x19bd4c,null))[_0xc8a8('0x1e')](removeEntity(_0x19bd4c,null))[_0xc8a8('0x1e')](function(){return db[_0xc8a8('0x39')]['findAll']({'raw':!![]});})['then'](function(_0x1ca92d){var _0x274ef5=fs[_0xc8a8('0x63')](path[_0xc8a8('0x64')](config[_0xc8a8('0x65')],'server/files/templates/trunk.ejs'),_0xc8a8('0x6d'));var _0x3e9d51=fs[_0xc8a8('0x63')](path['join'](config[_0xc8a8('0x65')],_0xc8a8('0x6e')),_0xc8a8('0x6d'));var _0x2990a2=ejs[_0xc8a8('0x67')](_0x274ef5,{'trunks':_0x1ca92d});var _0x345399=ejs[_0xc8a8('0x67')](_0x3e9d51,{'trunks':_0x1ca92d});fs['writeFileSync']('/etc/asterisk/sip_xcally_trunks.conf',_0x2990a2);fs[_0xc8a8('0x68')](_0xc8a8('0x6b'),_0x345399);return respondWithRpcPromise(_0xc8a8('0x6f'),_0xc8a8('0x31'),{'module':_0xc8a8('0x6c')});})[_0xc8a8('0x28')](handleError(_0x19bd4c,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fae7f47..037098a 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 _0x4f64=['exports','define','Trunk','tools_trunks','lodash','util','../../config/logger','api','moment','request-promise','path','./trunk.attributes'];(function(_0x1fa21d,_0x39dcb6){var _0x3f40d2=function(_0xf2345d){while(--_0xf2345d){_0x1fa21d['push'](_0x1fa21d['shift']());}};_0x3f40d2(++_0x39dcb6);}(_0x4f64,0x70));var _0x44f6=function(_0x1f465f,_0x2427de){_0x1f465f=_0x1f465f-0x0;var _0x374185=_0x4f64[_0x1f465f];return _0x374185;};'use strict';var _=require(_0x44f6('0x0'));var util=require(_0x44f6('0x1'));var logger=require(_0x44f6('0x2'))(_0x44f6('0x3'));var moment=require(_0x44f6('0x4'));var BPromise=require('bluebird');var rp=require(_0x44f6('0x5'));var fs=require('fs');var path=require(_0x44f6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x44f6('0x7'));module[_0x44f6('0x8')]=function(_0x365b3b,_0x558897){return _0x365b3b[_0x44f6('0x9')](_0x44f6('0xa'),attributes,{'tableName':_0x44f6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd5fe=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./trunk.attributes','exports','define','Trunk','tools_trunks'];(function(_0x528c4b,_0x3aaa85){var _0x367caf=function(_0x43d4ba){while(--_0x43d4ba){_0x528c4b['push'](_0x528c4b['shift']());}};_0x367caf(++_0x3aaa85);}(_0xd5fe,0x168));var _0xed5f=function(_0xf10840,_0xad3916){_0xf10840=_0xf10840-0x0;var _0x1fdf7e=_0xd5fe[_0xf10840];return _0x1fdf7e;};'use strict';var _=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var logger=require(_0xed5f('0x2'))(_0xed5f('0x3'));var moment=require(_0xed5f('0x4'));var BPromise=require(_0xed5f('0x5'));var rp=require(_0xed5f('0x6'));var fs=require('fs');var path=require(_0xed5f('0x7'));var rimraf=require(_0xed5f('0x8'));var config=require(_0xed5f('0x9'));var attributes=require(_0xed5f('0xa'));module[_0xed5f('0xb')]=function(_0x482107,_0x1e8b10){return _0x482107[_0xed5f('0xc')](_0xed5f('0xd'),attributes,{'tableName':_0xed5f('0xe'),'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 041ed97..0f16716 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 _0x5f2f=['map','include','model','attributes','then','ShowTrunk','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','Trunk,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','GetTrunk','Trunk','findAll','options','raw','limit'];(function(_0x278e3c,_0x1c9cfd){var _0x3e2d9b=function(_0x34d928){while(--_0x34d928){_0x278e3c['push'](_0x278e3c['shift']());}};_0x3e2d9b(++_0x1c9cfd);}(_0x5f2f,0x73));var _0xf5f2=function(_0x6a8a68,_0x398fa5){_0x6a8a68=_0x6a8a68-0x0;var _0xcafce9=_0x5f2f[_0x6a8a68];return _0xcafce9;};'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')]('Trunk,\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')]({'raw':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd['options']['where']||null:null,'attributes':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['attributes']||null:null,'limit':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1c')]||null:null,'include':_0x20fccd[_0xf5f2('0x1a')]?_0x20fccd[_0xf5f2('0x1a')]['include']?_[_0xf5f2('0x1d')](_0x20fccd[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x2833fe){return{'model':db[_0x2833fe[_0xf5f2('0x1f')]],'as':_0x2833fe['as'],'attributes':_0x2833fe['attributes'],'include':_0x2833fe['include']?_[_0xf5f2('0x1d')](_0x2833fe[_0xf5f2('0x1e')],function(_0x13da6f){return{'model':db[_0x13da6f[_0xf5f2('0x1f')]],'as':_0x13da6f['as'],'attributes':_0x13da6f[_0xf5f2('0x20')],'include':_0x13da6f[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x13da6f[_0xf5f2('0x1e')],function(_0x294414){return{'model':db[_0x294414['model']],'as':_0x294414['as'],'attributes':_0x294414[_0xf5f2('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x375ca8){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')]('GetTrunk',_0x20fccd,JSON['stringify'](_0x375ca8));_0x4ff59b(_0x375ca8);})[_0xf5f2('0x16')](function(_0x14c829){logger[_0xf5f2('0x11')]('GetTrunk',_0x14c829['message'],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x14c829[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x22')]=function(_0x153924){var _0x1b381e=this;return new Promise(function(_0x54c0c8,_0x52e959){return db[_0xf5f2('0x18')]['find']({'raw':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1b')]===undefined?!![]:![]:!![],'where':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x23')]||null:null,'attributes':_0x153924[_0xf5f2('0x1a')]?_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x20')]||null:null,'include':_0x153924[_0xf5f2('0x1a')]?_0x153924['options'][_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x153924[_0xf5f2('0x1a')][_0xf5f2('0x1e')],function(_0x1408b9){return{'model':db[_0x1408b9[_0xf5f2('0x1f')]],'as':_0x1408b9['as'],'attributes':_0x1408b9[_0xf5f2('0x20')],'include':_0x1408b9['include']?_[_0xf5f2('0x1d')](_0x1408b9[_0xf5f2('0x1e')],function(_0x55989d){return{'model':db[_0x55989d[_0xf5f2('0x1f')]],'as':_0x55989d['as'],'attributes':_0x55989d['attributes'],'include':_0x55989d[_0xf5f2('0x1e')]?_[_0xf5f2('0x1d')](_0x55989d[_0xf5f2('0x1e')],function(_0x2e3cca){return{'model':db[_0x2e3cca['model']],'as':_0x2e3cca['as'],'attributes':_0x2e3cca['attributes']};}):[]};}):[]};}):[]:[]})[_0xf5f2('0x21')](function(_0x46ad4a){logger[_0xf5f2('0xd')]('ShowTrunk',_0x153924);logger[_0xf5f2('0xf')]('ShowTrunk',_0x153924,JSON[_0xf5f2('0x10')](_0x46ad4a));_0x54c0c8(_0x46ad4a);})['catch'](function(_0x46f464){logger[_0xf5f2('0x11')]('ShowTrunk',_0x46f464[_0xf5f2('0x13')],_0x153924);_0x52e959(_0x1b381e[_0xf5f2('0x11')](0x1f4,_0x46f464[_0xf5f2('0x13')]));});});}; \ No newline at end of file +var _0x5f66=['debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','code','message','error','info','catch','GetTrunk','findAll','options','attributes','limit','include','model','map','ShowTrunk','Trunk','raw','where','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent'];(function(_0x34cfd7,_0x209113){var _0x1d9742=function(_0x59e242){while(--_0x59e242){_0x34cfd7['push'](_0x34cfd7['shift']());}};_0x1d9742(++_0x209113);}(_0x5f66,0x1a0));var _0x65f6=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5f66[_0xefd519];return _0x4bb882;};'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')]('Trunk,\x20%s,\x20%s',_0x1c0e12,_0x65f6('0xc'));_0x112079(_0x48d85c['result']['message']);}})[_0x65f6('0x14')](function(_0x5c69f8){logger[_0x65f6('0x12')](_0x65f6('0xb'),_0x1c0e12,_0x5c69f8);_0x8f6451(_0x5c69f8);});});}exports[_0x65f6('0x15')]=function(_0x1f974c){var _0xc8660c=this;return new Promise(function(_0x18380e,_0x495dd6){return db['Trunk'][_0x65f6('0x16')]({'raw':_0x1f974c['options']?_0x1f974c['options']['raw']===undefined?!![]:![]:!![],'where':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')]['where']||null:null,'attributes':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x18')]||null:null,'limit':_0x1f974c[_0x65f6('0x17')]?_0x1f974c[_0x65f6('0x17')][_0x65f6('0x19')]||null:null,'include':_0x1f974c['options']?_0x1f974c[_0x65f6('0x17')]['include']?_['map'](_0x1f974c[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x524e42){return{'model':db[_0x524e42[_0x65f6('0x1b')]],'as':_0x524e42['as'],'attributes':_0x524e42[_0x65f6('0x18')],'include':_0x524e42[_0x65f6('0x1a')]?_[_0x65f6('0x1c')](_0x524e42['include'],function(_0x9d7bb0){return{'model':db[_0x9d7bb0[_0x65f6('0x1b')]],'as':_0x9d7bb0['as'],'attributes':_0x9d7bb0[_0x65f6('0x18')],'include':_0x9d7bb0['include']?_['map'](_0x9d7bb0['include'],function(_0x29abdb){return{'model':db[_0x29abdb[_0x65f6('0x1b')]],'as':_0x29abdb['as'],'attributes':_0x29abdb['attributes']};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x28f710){logger['info'](_0x65f6('0x15'),_0x1f974c);logger[_0x65f6('0xd')](_0x65f6('0x15'),_0x1f974c,JSON['stringify'](_0x28f710));_0x18380e(_0x28f710);})['catch'](function(_0x488d36){logger[_0x65f6('0x12')](_0x65f6('0x15'),_0x488d36[_0x65f6('0x11')],_0x1f974c);_0x495dd6(_0xc8660c[_0x65f6('0x12')](0x1f4,_0x488d36[_0x65f6('0x11')]));});});};exports[_0x65f6('0x1d')]=function(_0x144e55){var _0x4ace4c=this;return new Promise(function(_0x4ea23d,_0x154cbd){return db[_0x65f6('0x1e')]['find']({'raw':_0x144e55['options']?_0x144e55[_0x65f6('0x17')][_0x65f6('0x1f')]===undefined?!![]:![]:!![],'where':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')][_0x65f6('0x20')]||null:null,'attributes':_0x144e55[_0x65f6('0x17')]?_0x144e55['options'][_0x65f6('0x18')]||null:null,'include':_0x144e55[_0x65f6('0x17')]?_0x144e55[_0x65f6('0x17')]['include']?_[_0x65f6('0x1c')](_0x144e55[_0x65f6('0x17')][_0x65f6('0x1a')],function(_0x45510a){return{'model':db[_0x45510a[_0x65f6('0x1b')]],'as':_0x45510a['as'],'attributes':_0x45510a[_0x65f6('0x18')],'include':_0x45510a['include']?_[_0x65f6('0x1c')](_0x45510a[_0x65f6('0x1a')],function(_0x4f3e22){return{'model':db[_0x4f3e22[_0x65f6('0x1b')]],'as':_0x4f3e22['as'],'attributes':_0x4f3e22['attributes'],'include':_0x4f3e22[_0x65f6('0x1a')]?_['map'](_0x4f3e22[_0x65f6('0x1a')],function(_0x24f7fd){return{'model':db[_0x24f7fd['model']],'as':_0x24f7fd['as'],'attributes':_0x24f7fd[_0x65f6('0x18')]};}):[]};}):[]};}):[]:[]})[_0x65f6('0xa')](function(_0x3b261d){logger['info']('ShowTrunk',_0x144e55);logger[_0x65f6('0xd')]('ShowTrunk',_0x144e55,JSON[_0x65f6('0xf')](_0x3b261d));_0x4ea23d(_0x3b261d);})['catch'](function(_0x22d760){logger[_0x65f6('0x12')]('ShowTrunk',_0x22d760[_0x65f6('0x11')],_0x144e55);_0x154cbd(_0x4ace4c['error'](0x1f4,_0x22d760['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index dd0ef6f..dd507b5 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 _0x5f2f=['createApiKey','update','/:id/password','changePassword','removeQueues','removeTeams','destroy','delete','removeFaxInteractions','removeFaxAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeSquareProjects','removeApiKey','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/whoami','/:id','/:id/contacts','getContacts','/:id/queues','getQueues','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','/:id/openchannel/interactions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','getTeams','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','/:id/mail_accounts','getMailAccounts','/:id/openchannel_accounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','/:id/square_projects','/:id/api_key','getApiKey','post','/create_many','bulkCreate','addContacts','create','addQueues','join','root','server/files/images/','format','%s-%s','originalname','/:id/avatar','file','addAvatar','/:id/login','login','logout','/:id/pause','pause','/:id/unpause','unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','addSquareProjects'];(function(_0x1a9e78,_0x180720){var _0x113e06=function(_0x229c64){while(--_0x229c64){_0x1a9e78['push'](_0x1a9e78['shift']());}};_0x113e06(++_0x180720);}(_0x5f2f,0x73));var _0xf5f2=function(_0x56b913,_0x3ddf4e){_0x56b913=_0x56b913-0x0;var _0x4d2bcf=_0x5f2f[_0x56b913];return _0x4d2bcf;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var auth=require(_0xf5f2('0x6'));var interaction=require(_0xf5f2('0x7'));var config=require('../../config/environment');var controller=require('./user.controller');router[_0xf5f2('0x8')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0xa')]);router[_0xf5f2('0x8')](_0xf5f2('0xb'),auth[_0xf5f2('0x9')](),controller['describe']);router[_0xf5f2('0x8')](_0xf5f2('0xc'),auth[_0xf5f2('0x9')](),controller['whoami']);router[_0xf5f2('0x8')](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller['show']);router[_0xf5f2('0x8')]('/:id/avatar',controller['getAvatar']);router[_0xf5f2('0x8')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x8')](_0xf5f2('0x10'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x11')]);router[_0xf5f2('0x8')]('/:id/queues_rt',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x12')]);router[_0xf5f2('0x8')](_0xf5f2('0x13'),auth[_0xf5f2('0x9')](),controller['getGroups']);router[_0xf5f2('0x8')](_0xf5f2('0x14'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x15')]);router[_0xf5f2('0x8')](_0xf5f2('0x16'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x17')]);router[_0xf5f2('0x8')](_0xf5f2('0x18'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x19')]);router[_0xf5f2('0x8')](_0xf5f2('0x1a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1b')]);router[_0xf5f2('0x8')]('/:id/mail/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1c')]);router['get']('/:id/sms/interactions',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1d')]);router['get'](_0xf5f2('0x1e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x1f')]);router[_0xf5f2('0x8')](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x21')]);router[_0xf5f2('0x8')](_0xf5f2('0x22'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x23')]);router['get']('/:id/agents',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x24')]);router[_0xf5f2('0x8')](_0xf5f2('0x25'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x26')]);router[_0xf5f2('0x8')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller['getFaxAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x29')]);router[_0xf5f2('0x8')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller['getOpenchannelAccounts']);router[_0xf5f2('0x8')](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller['getSmsAccounts']);router['get'](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x2d')]);router[_0xf5f2('0x8')](_0xf5f2('0x2e'),auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xf5f2('0x8')]('/:id/scheduled_calls',auth[_0xf5f2('0x9')](),controller['getScheduledCalls']);router[_0xf5f2('0x8')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x30')]);router[_0xf5f2('0x31')](_0xf5f2('0x32'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x33')]);router['post'](_0xf5f2('0xe'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x34')]);router[_0xf5f2('0x31')]('/',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x35')]);router[_0xf5f2('0x31')]('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x36')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3fc168,_0x4b8c42,_0x18ae07){_0x18ae07(null,path[_0xf5f2('0x37')](config[_0xf5f2('0x38')],_0xf5f2('0x39')));},'filename':function(_0x59a6dd,_0x5a98d7,_0x41088b){_0x41088b(null,util[_0xf5f2('0x3a')](_0xf5f2('0x3b'),Date['now'](),_0x5a98d7[_0xf5f2('0x3c')]));}})});router['post'](_0xf5f2('0x3d'),upload['single'](_0xf5f2('0x3e')),controller[_0xf5f2('0x3f')]);router['post'](_0xf5f2('0x40'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x41')]);router[_0xf5f2('0x31')]('/:id/logout',auth['isAuthenticated'](),controller[_0xf5f2('0x42')]);router[_0xf5f2('0x31')](_0xf5f2('0x43'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x44')]);router[_0xf5f2('0x31')](_0xf5f2('0x45'),auth['isAuthenticated'](),controller[_0xf5f2('0x46')]);router[_0xf5f2('0x31')]('/:id/teams',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x47')]);router[_0xf5f2('0x31')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x49')]);router[_0xf5f2('0x31')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller[_0xf5f2('0x4b')]);router[_0xf5f2('0x31')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['addSmsInteractions']);router[_0xf5f2('0x31')](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x4f')]);router[_0xf5f2('0x31')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x50')]);router[_0xf5f2('0x31')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x51')]);router[_0xf5f2('0x31')](_0xf5f2('0x2a'),auth['isAuthenticated'](),controller[_0xf5f2('0x52')]);router['post'](_0xf5f2('0x2b'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x53')]);router[_0xf5f2('0x31')](_0xf5f2('0x2c'),auth[_0xf5f2('0x9')](),controller['addChatWebsites']);router[_0xf5f2('0x31')](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x54')]);router[_0xf5f2('0x31')](_0xf5f2('0x2f'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x55')]);router['put'](_0xf5f2('0xd'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x56')]);router['put'](_0xf5f2('0x57'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x58')]);router['delete']('/:id/queues',auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x59')]);router['delete'](_0xf5f2('0x20'),auth['isAuthenticated'](),controller[_0xf5f2('0x5a')]);router['delete'](_0xf5f2('0xd'),auth['isAuthenticated'](),controller[_0xf5f2('0x5b')]);router[_0xf5f2('0x5c')](_0xf5f2('0x48'),auth[_0xf5f2('0x9')](),controller['removeChatInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4a'),auth['isAuthenticated'](),controller['removeMailInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x4c'),auth['isAuthenticated'](),controller[_0xf5f2('0x5d')]);router[_0xf5f2('0x5c')](_0xf5f2('0x4d'),auth[_0xf5f2('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xf5f2('0x4e'),auth[_0xf5f2('0x9')](),controller['removeOpenchannelInteractions']);router[_0xf5f2('0x5c')](_0xf5f2('0x27'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5e')]);router[_0xf5f2('0x5c')](_0xf5f2('0x28'),auth[_0xf5f2('0x9')](),controller['removeMailAccounts']);router['delete'](_0xf5f2('0x2a'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x5f')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2b'),auth['isAuthenticated'](),controller[_0xf5f2('0x60')]);router[_0xf5f2('0x5c')](_0xf5f2('0x2c'),auth['isAuthenticated'](),controller[_0xf5f2('0x61')]);router['delete'](_0xf5f2('0x2e'),auth[_0xf5f2('0x9')](),controller[_0xf5f2('0x62')]);router[_0xf5f2('0x5c')]('/:id/api_key',auth['isAuthenticated'](),controller[_0xf5f2('0x63')]);module['exports']=router; \ No newline at end of file +var _0x5f66=['/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','/:id/sms_accounts','addChatWebsites','/:id/square_projects','addSquareProjects','put','/:id','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeSmsInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeApiKey','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./user.controller','isAuthenticated','index','describe','get','/whoami','whoami','show','/:id/avatar','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/teams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','getSquareProjects','getScheduledCalls','/:id/api_key','getApiKey','post','bulkCreate','addContacts','create','addQueues','root','server/files/images/','format','originalname','file','addAvatar','/:id/login','/:id/logout','logout','/:id/pause','pause','/:id/unpause','unpause'];(function(_0xff0c88,_0x35f357){var _0x24d5be=function(_0x57a563){while(--_0x57a563){_0xff0c88['push'](_0xff0c88['shift']());}};_0x24d5be(++_0x35f357);}(_0x5f66,0x1a0));var _0x65f6=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x5f66[_0x297fd3];return _0x2af381;};'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['get']('/:id',auth[_0x65f6('0x7')](),controller[_0x65f6('0xd')]);router[_0x65f6('0xa')](_0x65f6('0xe'),controller['getAvatar']);router[_0x65f6('0xa')]('/:id/contacts',auth['isAuthenticated'](),controller[_0x65f6('0xf')]);router['get'](_0x65f6('0x10'),auth['isAuthenticated'](),controller[_0x65f6('0x11')]);router[_0x65f6('0xa')](_0x65f6('0x12'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x13')]);router[_0x65f6('0xa')](_0x65f6('0x14'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x15')]);router[_0x65f6('0xa')]('/:id/recordings',auth[_0x65f6('0x7')](),controller['getRecordings']);router['get'](_0x65f6('0x16'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x17')]);router[_0x65f6('0xa')](_0x65f6('0x18'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x19')]);router[_0x65f6('0xa')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0x65f6('0x1a')]);router['get']('/:id/mail/interactions',auth['isAuthenticated'](),controller[_0x65f6('0x1b')]);router[_0x65f6('0xa')]('/:id/sms/interactions',auth[_0x65f6('0x7')](),controller[_0x65f6('0x1c')]);router[_0x65f6('0xa')](_0x65f6('0x1d'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x1e')]);router['get'](_0x65f6('0x1f'),auth['isAuthenticated'](),controller['getTeams']);router[_0x65f6('0xa')](_0x65f6('0x20'),auth['isAuthenticated'](),controller[_0x65f6('0x21')]);router[_0x65f6('0xa')](_0x65f6('0x22'),auth[_0x65f6('0x7')](),controller['getAgents']);router[_0x65f6('0xa')](_0x65f6('0x23'),auth[_0x65f6('0x7')](),controller['getVoicePrefixes']);router['get']('/:id/fax_accounts',auth[_0x65f6('0x7')](),controller[_0x65f6('0x24')]);router['get'](_0x65f6('0x25'),auth[_0x65f6('0x7')](),controller['getMailAccounts']);router[_0x65f6('0xa')](_0x65f6('0x26'),auth[_0x65f6('0x7')](),controller['getOpenchannelAccounts']);router['get']('/:id/sms_accounts',auth[_0x65f6('0x7')](),controller[_0x65f6('0x27')]);router[_0x65f6('0xa')](_0x65f6('0x28'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x29')]);router[_0x65f6('0xa')]('/:id/square_projects',auth['isAuthenticated'](),controller[_0x65f6('0x2a')]);router[_0x65f6('0xa')]('/:id/scheduled_calls',auth['isAuthenticated'](),controller[_0x65f6('0x2b')]);router[_0x65f6('0xa')](_0x65f6('0x2c'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x2d')]);router[_0x65f6('0x2e')]('/create_many',auth[_0x65f6('0x7')](),controller[_0x65f6('0x2f')]);router[_0x65f6('0x2e')]('/:id/contacts',auth[_0x65f6('0x7')](),controller[_0x65f6('0x30')]);router[_0x65f6('0x2e')]('/',auth[_0x65f6('0x7')](),controller[_0x65f6('0x31')]);router[_0x65f6('0x2e')]('/:id/queues',auth[_0x65f6('0x7')](),controller[_0x65f6('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x36dbf4,_0x5a740a,_0x2b403b){_0x2b403b(null,path['join'](config[_0x65f6('0x33')],_0x65f6('0x34')));},'filename':function(_0x5ce050,_0x12dee6,_0x13e41a){_0x13e41a(null,util[_0x65f6('0x35')]('%s-%s',Date['now'](),_0x12dee6[_0x65f6('0x36')]));}})});router['post'](_0x65f6('0xe'),upload['single'](_0x65f6('0x37')),controller[_0x65f6('0x38')]);router['post'](_0x65f6('0x39'),auth['isAuthenticated'](),controller['login']);router[_0x65f6('0x2e')](_0x65f6('0x3a'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x3b')]);router[_0x65f6('0x2e')](_0x65f6('0x3c'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x3d')]);router['post'](_0x65f6('0x3e'),auth['isAuthenticated'](),controller[_0x65f6('0x3f')]);router[_0x65f6('0x2e')](_0x65f6('0x1f'),auth[_0x65f6('0x7')](),controller['addTeams']);router[_0x65f6('0x2e')](_0x65f6('0x40'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x41')]);router[_0x65f6('0x2e')](_0x65f6('0x42'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x43')]);router[_0x65f6('0x2e')]('/:id/fax_interactions',auth[_0x65f6('0x7')](),controller[_0x65f6('0x44')]);router[_0x65f6('0x2e')](_0x65f6('0x45'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x46')]);router[_0x65f6('0x2e')](_0x65f6('0x47'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x48')]);router[_0x65f6('0x2e')](_0x65f6('0x49'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x4a')]);router[_0x65f6('0x2e')](_0x65f6('0x25'),auth['isAuthenticated'](),controller[_0x65f6('0x4b')]);router[_0x65f6('0x2e')](_0x65f6('0x26'),auth[_0x65f6('0x7')](),controller['addOpenchannelAccounts']);router[_0x65f6('0x2e')](_0x65f6('0x4c'),auth[_0x65f6('0x7')](),controller['addSmsAccounts']);router[_0x65f6('0x2e')](_0x65f6('0x28'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x4d')]);router['post'](_0x65f6('0x4e'),auth['isAuthenticated'](),controller[_0x65f6('0x4f')]);router[_0x65f6('0x2e')]('/:id/api_key',auth[_0x65f6('0x7')](),controller['createApiKey']);router[_0x65f6('0x50')](_0x65f6('0x51'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x52')]);router[_0x65f6('0x50')](_0x65f6('0x53'),auth['isAuthenticated'](),controller['changePassword']);router[_0x65f6('0x54')](_0x65f6('0x10'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x55')]);router[_0x65f6('0x54')](_0x65f6('0x1f'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x56')]);router[_0x65f6('0x54')]('/:id',auth[_0x65f6('0x7')](),controller[_0x65f6('0x57')]);router[_0x65f6('0x54')]('/:id/chat_interactions',auth[_0x65f6('0x7')](),controller[_0x65f6('0x58')]);router['delete'](_0x65f6('0x42'),auth[_0x65f6('0x7')](),controller['removeMailInteractions']);router[_0x65f6('0x54')]('/:id/fax_interactions',auth[_0x65f6('0x7')](),controller[_0x65f6('0x59')]);router[_0x65f6('0x54')]('/:id/sms_interactions',auth[_0x65f6('0x7')](),controller[_0x65f6('0x5a')]);router['delete'](_0x65f6('0x47'),auth[_0x65f6('0x7')](),controller['removeOpenchannelInteractions']);router[_0x65f6('0x54')](_0x65f6('0x49'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x5b')]);router[_0x65f6('0x54')](_0x65f6('0x25'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x5c')]);router['delete']('/:id/openchannel_accounts',auth['isAuthenticated'](),controller[_0x65f6('0x5d')]);router[_0x65f6('0x54')](_0x65f6('0x4c'),auth[_0x65f6('0x7')](),controller['removeSmsAccounts']);router[_0x65f6('0x54')](_0x65f6('0x28'),auth[_0x65f6('0x7')](),controller['removeChatWebsites']);router[_0x65f6('0x54')](_0x65f6('0x4e'),auth[_0x65f6('0x7')](),controller['removeSquareProjects']);router['delete'](_0x65f6('0x2c'),auth[_0x65f6('0x7')](),controller[_0x65f6('0x5e')]);module[_0x65f6('0x5f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index e312c33..c96b446 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 _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x3cdf50,_0x3e8eb2){var _0x22d47a=function(_0xdc5336){while(--_0xdc5336){_0x3cdf50['push'](_0x3cdf50['shift']());}};_0x22d47a(++_0x3e8eb2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xa9e0[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xa9e0=['\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','fingerprint','certificate','passive','update,nonat','showWebBar','get','wss','force_avp','dtlsenable','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','encryption','icesupport','actpass','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','DEFAULT\x20PAUSE','ENUM','peer','friend','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','join','transport','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','never'];(function(_0x402094,_0x33a6e6){var _0x2f2d3c=function(_0x497c72){while(--_0x497c72){_0x402094['push'](_0x402094['shift']());}};_0x2f2d3c(++_0x33a6e6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':_0x0a9e('0x14')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'description':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'dynamic'},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')]('friend',_0x0a9e('0xc'),_0x0a9e('0x16')),'allowNull':!![],'defaultValue':_0x0a9e('0x17')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x19'),_0x0a9e('0x1a'),'ALLOWED_FAILED_SCREEN',_0x0a9e('0x1b'),_0x0a9e('0x1c'),_0x0a9e('0x1d'),_0x0a9e('0x1e'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x2e8759){this[_0x0a9e('0x4')]('transport',_0x2e8759?_0x2e8759[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x23')},'dtmfmode':{'type':Sequelize['ENUM'](_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27'),_0x0a9e('0x28')),'allowNull':!![],'defaultValue':_0x0a9e('0x24')},'directmedia':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),'outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0xd1836d){this[_0x0a9e('0x4')](_0x0a9e('0x2c'),_0xd1836d?_0xd1836d['join'](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this['getDataValue'](_0x0a9e('0x2c'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x2d')},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':_0x0a9e('0x2e')},'allow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x546ef8){this[_0x0a9e('0x4')](_0x0a9e('0x2f'),_0x546ef8?_0x546ef8['join'](';'):_0x0a9e('0x30'));},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x2f'))?this[_0x0a9e('0x8')]('allow')['split'](';'):null;},'comment':_0x0a9e('0x31')},'autoframing':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x1dec2e){this[_0x0a9e('0x4')]('insecure',_0x1dec2e?_0x1dec2e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x32'))?this[_0x0a9e('0x8')](_0x0a9e('0x32'))[_0x0a9e('0x22')](','):null;},'comment':_0x0a9e('0x33')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no',_0x0a9e('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x35')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38'),_0x0a9e('0x39')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x3a'),'uas'),'allowNull':!![],'defaultValue':_0x0a9e('0x3b')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x29')},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize['STRING'],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no',_0x0a9e('0x3c'),_0x0a9e('0x3d')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3e'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0x0a9e('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize['STRING'],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no','nonat',_0x0a9e('0x2a'),_0x0a9e('0x3f')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x0a9e('0x13')]},'showWebBar':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0,'set':function(_0x5d86e9){this[_0x0a9e('0x4')](_0x0a9e('0x40'),_0x5d86e9);var _0x5239ef=this[_0x0a9e('0x41')]({'plain':!![]});switch(_0x5d86e9){case 0x0:case 0x1:var _0x5cc8fb=_0x5239ef[_0x0a9e('0x21')]?_['isArray'](_0x5239ef['transport'])?_0x5239ef['transport'][_0x0a9e('0x20')]():_0x5239ef['transport']:_0x0a9e('0x1f');if(_0x5cc8fb===_0x0a9e('0x42')){_0x5cc8fb=_0x0a9e('0x1f');}this[_0x0a9e('0x4')](_0x0a9e('0x21'),_0x5cc8fb);this[_0x0a9e('0x4')]('encryption','no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('icesupport',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this['setDataValue'](_0x0a9e('0x46'),null);this[_0x0a9e('0x4')]('dtlscertfile',null);this[_0x0a9e('0x4')](_0x0a9e('0x47'),null);this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x42'));this[_0x0a9e('0x4')](_0x0a9e('0x49'),'yes');this[_0x0a9e('0x4')]('avpf','yes');this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x4a'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x29'));this[_0x0a9e('0x4')](_0x0a9e('0x45'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x4b'));this[_0x0a9e('0x4')](_0x0a9e('0x4c'),_0x5239ef[_0x0a9e('0x4c')]||_0x0a9e('0x4d'));this['setDataValue'](_0x0a9e('0x47'),_0x5239ef[_0x0a9e('0x47')]||_0x0a9e('0x4e'));this['setDataValue'](_0x0a9e('0x48'),_0x0a9e('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x83f0b2){this[_0x0a9e('0x4')](_0x0a9e('0x4f'),_0x83f0b2?_0x83f0b2[_0x0a9e('0x20')](','):[]);},'get':function(){return this[_0x0a9e('0x8')]('permissions')?_['map'](this['getDataValue'](_0x0a9e('0x4f'))[_0x0a9e('0x22')](','),function(_0x1104ad){return parseInt(_0x1104ad,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x29'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0x0a9e('0x3')]},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x50'))?this[_0x0a9e('0x8')](_0x0a9e('0x50')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize['STRING'],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x30a4c7){if(typeof _0x30a4c7===_0x0a9e('0x51')){var _0x332367=_0x30a4c7==='1'?!![]:_0x30a4c7==='0'?![]:_0x30a4c7===_0x0a9e('0x52')?!![]:_0x30a4c7===_0x0a9e('0x53')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x332367);}else{this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0x30a4c7);}}},'blocked':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0x25744a){this[_0x0a9e('0x4')]('blocked',_0x25744a);if(_0x25744a===!![]){this[_0x0a9e('0x4')](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')]('loginAttempts',0x0);}else{this[_0x0a9e('0x4')](_0x0a9e('0x55'),null);}}},'blockedAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'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 64ba2bc..aca3735 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 _0x508a=['removeFaxInteractions','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','SmsAccount','getSmsAccounts','addSmsAccounts','removeSmsAccounts','getChatWebsites','ChatWebsite','addChatWebsites','removeChatWebsites','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','concat','$and','$or','$gt','$lt','$lte','$ne','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$contained','firstName','lastName','Contact','getApiKey','retrieveApiKey','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','API\x20key\x20not\x20available','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults','localhost','./user.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','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','limit','Content-Range','apply','reject','save','update','destroy','get','user','Agents','agent','Telephones','filter','ignore','value','includes','find','role','name','stack','index','map','User','rawAttributes','fieldName','type','model','password','salt','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','VIRTUAL','sequelize','lower','col','include','findAll','rows','differenceBy','options','bulkCreate','body','params','describe','addContacts','omit','ids','agent\x20role','telephone','../../config/license/util','telephones','users','isNil','License\x20limit\x20reached','count\x20%s:\x20%s','create','Setting','findById','securePassword','min_internal','internal','select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)','QueryTypes','from','voicemail','VoiceMail','email','101','102','103','110','104','105','106','107','108','109','100','111','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','changePassword','oldPassword','newPassword','Invalid\x20body\x20format.\x20Use\x20oldPassord\x20and\x20newPassword','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','admin','Invalid\x20body\x20format.\x20Use\x20newPassword','Unauthorized','addQueues','channel','loginInPause','voicePause','capitalize','toLowerCase','Queues','penalty','spread','QueueId','emit','Queue:save','voice','VoiceQueue','online','push','interface','format','SIP/%s','each','UserVoiceQueueRt','upsert','isValidChannel','remove','Queue:remove','addAvatar','userpic','file','join','root','download','server/files/images/','getContacts','findOne','CmContact','includeAll','CmList','List','Tag','Tags','color','tag','getQueues','Unknown\x20channel','Queue','Unknown\x20role','getVoiceQueuesRt','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','SmsInteraction','FaxInteraction','getFaxInteractions','phone','mobile','LOCAL/%s@from-sip/n','intrf','headers','x-forwarded-for','connection','remoteAddress','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','isMiddleware','logout','all','pause','QueuePause','MemberReport','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','faxPause','openchannelPause','smsPause','lastPauseAt','mail','chat','openchannel','manual','set','%s%s','Pause','getTeams','Team','addTeams','setDataValue','Voice','getChatQueues','Chat','getMailQueues','Mail','Sms','Openchannel','transaction','addAgent','getDataValue','removeTeams','getSmsQueues','getFaxQueues','Fax','flatten','removeAgent','getLists','getAgents','values','send','addChatInteractions','user_has_chat_interactions:save','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','removeMailInteractions','user_has_mail_interactions:remove','addFaxInteractions'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x508a,0x1aa));var _0xa508=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x508a[_0x3dd15e];return _0x231fd0;};'use strict';var pdf=require(_0xa508('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xa508('0x1'));var zipdir=require(_0xa508('0x2'));var jsonpatch=require(_0xa508('0x3'));var rp=require(_0xa508('0x4'));var moment=require(_0xa508('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa508('0x6'));var util=require(_0xa508('0x7'));var path=require(_0xa508('0x8'));var sox=require('sox');var csv=require(_0xa508('0x9'));var ejs=require(_0xa508('0xa'));var fs=require('fs');var _=require(_0xa508('0xb'));var squel=require('squel');var crypto=require(_0xa508('0xc'));var jsforce=require(_0xa508('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xa508('0x9'));var querystring=require(_0xa508('0xe'));var Papa=require('papaparse');var Redis=require(_0xa508('0xf'));var authService=require(_0xa508('0x10'));var qs=require(_0xa508('0x11'));var as=require(_0xa508('0x12'));var hardwareService=require(_0xa508('0x13'));var logger=require('../../config/logger')(_0xa508('0x14'));var utils=require(_0xa508('0x15'));var config=require('../../config/environment');var db=require(_0xa508('0x16'))['db'];config[_0xa508('0x17')]=_[_0xa508('0x18')](config['redis'],{'host':_0xa508('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xa508('0x17')]));require(_0xa508('0x1a'))[_0xa508('0x1b')](socket);var jayson=require(_0xa508('0x1c'));var client=jayson['client'][_0xa508('0x1d')]({'port':0x232a});function checkPasswordPattern(_0x45a0bc,_0x102adb,_0xb8b8f5){if(_0xb8b8f5){var _0x5e2d7d=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5e2d7d[_0xa508('0x1e')](_0x102adb)){return _0x45a0bc;}else{throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x21'));}}else{return _0x45a0bc;}}function respondWithRpcPromise(_0x507c9f,_0x1a366f,_0x27d102,_0x5e29a8){return new BPromise(function(_0x5d345d,_0x1984ae){var _0x226024=_0x5e29a8||client;return _0x226024[_0xa508('0x22')](_0x507c9f,_0x27d102)[_0xa508('0x23')](function(_0x421874){logger[_0xa508('0x24')](_0xa508('0x25'),_0x1a366f,_0xa508('0x26'));logger['debug'](_0xa508('0x27'),_0x1a366f,_0xa508('0x26'),JSON[_0xa508('0x28')](_0x421874));if(_0x421874[_0xa508('0x29')]){if(_0x421874[_0xa508('0x29')]['code']===0x1f4){logger[_0xa508('0x29')]('User,\x20%s,\x20%s',_0x1a366f,_0x421874[_0xa508('0x29')][_0xa508('0x2a')]);return _0x1984ae(_0x421874['error'][_0xa508('0x2a')]);}logger[_0xa508('0x29')](_0xa508('0x25'),_0x1a366f,_0x421874[_0xa508('0x29')]['message']);return _0x5d345d(_0x421874['error']['message']);}else{logger[_0xa508('0x24')](_0xa508('0x25'),_0x1a366f,_0xa508('0x26'));_0x5d345d(_0x421874[_0xa508('0x2b')][_0xa508('0x2a')]);}})[_0xa508('0x2c')](function(_0x2400ee){logger['error']('User,\x20%s,\x20%s',_0x1a366f,_0x2400ee);_0x1984ae(_0x2400ee);});});}function respondWithStatusCode(_0x98b1c8,_0x1bca04){_0x1bca04=_0x1bca04||0xcc;return function(_0x47d93b){if(_0x47d93b){return _0x98b1c8[_0xa508('0x2d')](_0x1bca04);}return _0x98b1c8['status'](_0x1bca04)[_0xa508('0x2e')]();};}function respondWithResult(_0x44616a,_0x528ae9){_0x528ae9=_0x528ae9||0xc8;return function(_0x370518){if(_0x370518){return _0x44616a[_0xa508('0x2f')](_0x528ae9)[_0xa508('0x30')](_0x370518);}};}function respondWithFilteredResult(_0x39189d,_0x572793){return function(_0x21fa3b){if(_0x21fa3b){var _0x405baa=_0x21fa3b[_0xa508('0x31')],_0x3eb26c=_0x572793['offset'],_0x5d971d=_0x572793['offset']+_0x572793[_0xa508('0x32')],_0x2affae;if(_0x5d971d>=_0x405baa){_0x5d971d=_0x405baa;_0x2affae=0xc8;}else{_0x2affae=0xce;}_0x39189d['status'](_0x2affae);return _0x39189d['set'](_0xa508('0x33'),_0x3eb26c+'-'+_0x5d971d+'/'+_0x405baa)['json'](_0x21fa3b);}return null;};}function patchUpdates(_0x4fee73){return function(_0xb542d7){try{jsonpatch[_0xa508('0x34')](_0xb542d7,_0x4fee73,!![]);}catch(_0x4a995c){return BPromise[_0xa508('0x35')](_0x4a995c);}return _0xb542d7[_0xa508('0x36')]();};}function saveUpdates(_0x1b94ef,_0x489e27){return function(_0x4a1c45){if(_0x4a1c45){return _0x4a1c45[_0xa508('0x37')](_0x1b94ef)[_0xa508('0x23')](function(_0x2a74dc){return _0x2a74dc;});}return null;};}function removeEntity(_0x20261f,_0x2a8a43){return function(_0x3c07a1){if(_0x3c07a1){return _0x3c07a1[_0xa508('0x38')]()[_0xa508('0x23')](function(){var _0x374293=_0x3c07a1[_0xa508('0x39')]({'plain':!![]});var _0x31b526=[{'name':'Users','value':_0xa508('0x3a'),'ignore':!![]},{'name':_0xa508('0x3b'),'value':_0xa508('0x3c'),'ignore':![]},{'name':_0xa508('0x3d'),'value':'telephone','ignore':![]}];var _0x283d26=_(_0x31b526)[_0xa508('0x3e')](_0xa508('0x3f'))['map'](_0xa508('0x40'))[_0xa508('0x40')]();if(_[_0xa508('0x41')](_0x283d26,_0x374293['role'])){return;}var _0x4cc50e=_[_0xa508('0x42')](_0x31b526,[_0xa508('0x40'),_0x374293[_0xa508('0x43')]])[_0xa508('0x44')];return db['UserProfileResource'][_0xa508('0x38')]({'where':{'type':_0x4cc50e,'resourceId':_0x374293['id']}})[_0xa508('0x23')](function(){return _0x3c07a1;});})[_0xa508('0x23')](function(){_0x20261f[_0xa508('0x2f')](0xcc)[_0xa508('0x2e')]();});}};}function handleEntityNotFound(_0x3438bb,_0x1fdc2b){return function(_0x399191){if(!_0x399191){_0x3438bb[_0xa508('0x2d')](0x194);}return _0x399191;};}function handleError(_0x41c6f8,_0x3d1e10){_0x3d1e10=_0x3d1e10||0x1f4;return function(_0xd4d205){logger['error'](_0xd4d205[_0xa508('0x45')]);if(_0xd4d205[_0xa508('0x44')]){delete _0xd4d205[_0xa508('0x44')];}_0x41c6f8[_0xa508('0x2f')](_0x3d1e10)['send'](_0xd4d205);};}exports[_0xa508('0x46')]=function(_0x34406f,_0x224972){var _0x3326d8={},_0x1aa7d8={},_0x180c0d={'count':0x0,'rows':[]};var _0x3fed24=_[_0xa508('0x47')](db[_0xa508('0x48')][_0xa508('0x49')],function(_0x159351){return{'name':_0x159351[_0xa508('0x4a')],'type':_0x159351[_0xa508('0x4b')]['key']};});_0x1aa7d8[_0xa508('0x4c')]=_['differenceBy'](_[_0xa508('0x47')](_0x3fed24,_0xa508('0x44')),[_0xa508('0x4d'),_0xa508('0x4e')]);_0x1aa7d8[_0xa508('0x4f')]=_[_0xa508('0x50')](_0x34406f[_0xa508('0x4f')]);_0x1aa7d8[_0xa508('0x51')]=_['intersection'](_0x1aa7d8[_0xa508('0x4c')],_0x1aa7d8[_0xa508('0x4f')]);_0x3326d8[_0xa508('0x52')]=_[_0xa508('0x53')](_0x1aa7d8[_0xa508('0x4c')],qs[_0xa508('0x54')](_0x34406f[_0xa508('0x4f')][_0xa508('0x54')]));_0x3326d8[_0xa508('0x52')]=_0x3326d8[_0xa508('0x52')][_0xa508('0x55')]?_0x3326d8[_0xa508('0x52')]:_0x1aa7d8[_0xa508('0x4c')];if(!_0x34406f[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0x3326d8[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x34406f[_0xa508('0x4f')][_0xa508('0x32')]);_0x3326d8[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x34406f[_0xa508('0x4f')][_0xa508('0x58')]);}_0x3326d8[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x34406f['query'][_0xa508('0x5a')]);_0x3326d8[_0xa508('0x5b')]=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x34406f[_0xa508('0x4f')],_0x1aa7d8['filters']));if(_0x34406f[_0xa508('0x4f')][_0xa508('0x3e')]){_0x3326d8[_0xa508('0x5b')]=_[_0xa508('0x5d')](_0x3326d8[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x3fed24,function(_0x3d99ee){if(_0x3d99ee['type']!==_0xa508('0x5e')){return db[_0xa508('0x5f')][_0xa508('0x5b')](db['sequelize']['fn'](_0xa508('0x60'),db[_0xa508('0x5f')][_0xa508('0x61')](_0x3d99ee[_0xa508('0x44')])),{'$like':db[_0xa508('0x5f')]['fn'](_0xa508('0x60'),'%'+_0x34406f[_0xa508('0x4f')][_0xa508('0x3e')]+'%')});}})});}_0x3326d8=_[_0xa508('0x5d')]({},_0x3326d8,_0x34406f['options']);var _0x3a4ec6={'where':_0x3326d8[_0xa508('0x5b')]};return db[_0xa508('0x48')][_0xa508('0x31')](_0x3a4ec6)['then'](function(_0x2ef77e){_0x180c0d[_0xa508('0x31')]=_0x2ef77e;if(_0x34406f[_0xa508('0x4f')]['includeAll']){_0x3326d8[_0xa508('0x62')]=[{'all':!![]}];}return db[_0xa508('0x48')][_0xa508('0x63')](_0x3326d8);})[_0xa508('0x23')](function(_0x378773){_0x180c0d[_0xa508('0x64')]=_0x378773;return _0x180c0d;})[_0xa508('0x23')](respondWithFilteredResult(_0x224972,_0x3326d8))[_0xa508('0x2c')](handleError(_0x224972,null));};exports['show']=function(_0x1240ef,_0x340642){var _0x5184fe={'raw':![],'where':{'id':_0x1240ef['params']['id']}},_0x498915={};_0x498915[_0xa508('0x4c')]=_[_0xa508('0x65')](_[_0xa508('0x50')](db['User'][_0xa508('0x49')]),[_0xa508('0x4d'),_0xa508('0x4e')]);_0x498915[_0xa508('0x4f')]=_['keys'](_0x1240ef['query']);_0x498915[_0xa508('0x51')]=_['intersection'](_0x498915[_0xa508('0x4c')],_0x498915[_0xa508('0x4f')]);_0x5184fe['attributes']=_[_0xa508('0x53')](_0x498915['model'],qs[_0xa508('0x54')](_0x1240ef['query'][_0xa508('0x54')]));_0x5184fe['attributes']=_0x5184fe['attributes'][_0xa508('0x55')]?_0x5184fe['attributes']:_0x498915[_0xa508('0x4c')];if(_0x1240ef[_0xa508('0x4f')]['includeAll']){_0x5184fe[_0xa508('0x62')]=[{'all':!![]}];}_0x5184fe=_[_0xa508('0x5d')]({},_0x5184fe,_0x1240ef[_0xa508('0x66')]);return db[_0xa508('0x48')][_0xa508('0x42')](_0x5184fe)[_0xa508('0x23')](handleEntityNotFound(_0x340642,null))[_0xa508('0x23')](respondWithResult(_0x340642,null))[_0xa508('0x2c')](handleError(_0x340642,null));};exports[_0xa508('0x67')]=function(_0x31387d,_0x177b2e){return db[_0xa508('0x48')][_0xa508('0x67')](_0x31387d[_0xa508('0x68')],{'raw':![],'individualHooks':!![]})[_0xa508('0x23')](respondWithResult(_0x177b2e,0xc9))[_0xa508('0x2c')](handleError(_0x177b2e,null));};exports[_0xa508('0x37')]=function(_0x2c1dcb,_0x1e0f85){if(_0x2c1dcb[_0xa508('0x68')]['id']){delete _0x2c1dcb[_0xa508('0x68')]['id'];}delete _0x2c1dcb[_0xa508('0x68')][_0xa508('0x43')];return db[_0xa508('0x48')]['find']({'where':{'id':_0x2c1dcb[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x1e0f85,null))[_0xa508('0x23')](saveUpdates(_0x2c1dcb[_0xa508('0x68')],null))[_0xa508('0x23')](respondWithResult(_0x1e0f85,null))[_0xa508('0x2c')](handleError(_0x1e0f85,null));};exports[_0xa508('0x6a')]=function(_0x22a0ba,_0x5d605d){return db[_0xa508('0x48')][_0xa508('0x6a')]()[_0xa508('0x23')](respondWithResult(_0x5d605d,null))[_0xa508('0x2c')](handleError(_0x5d605d,null));};exports[_0xa508('0x6b')]=function(_0x1bf857,_0xcb3675,_0x33aaef){return db['User'][_0xa508('0x42')]({'where':{'id':_0x1bf857[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0xcb3675,null))[_0xa508('0x23')](function(_0x4ce6a3){if(_0x4ce6a3){return _0x4ce6a3[_0xa508('0x6b')](_0x1bf857[_0xa508('0x68')]['ids'],_[_0xa508('0x6c')](_0x1bf857['body'],[_0xa508('0x6d'),'id'])||{});}})[_0xa508('0x23')](respondWithResult(_0xcb3675,null))['catch'](handleError(_0xcb3675,null));};var getLicense=function(_0x12f815){return new BPromise(function(_0x540a18,_0x6a74cc){var _0x2c67dc=0x0;_0x12f815[_0xa508('0x68')][_0xa508('0x43')]===_0xa508('0x3c')&&_0x540a18(_0xa508('0x6e'));return db[_0xa508('0x48')][_0xa508('0x31')]({'where':{'$or':[{'role':_0x12f815[_0xa508('0x68')]['role']===_0xa508('0x6f')?'telephone':['admin',_0xa508('0x3a')]}]}})[_0xa508('0x23')](function(_0x35880e){_0x2c67dc=_0x35880e;return require(_0xa508('0x70'))['getLicense']();})[_0xa508('0x23')](function(_0x2b71b6){var _0x5cdbc8=_0x12f815[_0xa508('0x68')]['role']===_0xa508('0x6f')?_0xa508('0x71'):_0xa508('0x72');if(!_[_0xa508('0x73')](_0x2b71b6[_0x5cdbc8])&&_0x2c67dc>=_0x2b71b6[_0x5cdbc8]){return _0x6a74cc({'message':_0xa508('0x74')});}return _0x540a18(util['format'](_0xa508('0x75'),_0x5cdbc8,_0x2c67dc));})[_0xa508('0x2c')](function(_0x52f1e3){return _0x6a74cc(_0x52f1e3);});});};exports[_0xa508('0x76')]=function(_0x270cb8,_0x239823){return getLicense(_0x270cb8)[_0xa508('0x23')](function(_0x5f304f){if(!_0x270cb8[_0xa508('0x68')]['internal']){var _0x6d9fdf;return db[_0xa508('0x77')][_0xa508('0x78')](0x1)[_0xa508('0x23')](function(_0x2df27f){return checkPasswordPattern(_0x2df27f,_0x270cb8[_0xa508('0x68')][_0xa508('0x4d')],_0x2df27f[_0xa508('0x79')]);})['then'](function(_0x2f04e4){_0x6d9fdf=_0x2f04e4[_0xa508('0x7a')];return db['User']['max'](_0xa508('0x7b'));})['then'](function(_0x41e9b8){if(_[_0xa508('0x73')](_0x41e9b8)){if(_0x6d9fdf){_0x270cb8[_0xa508('0x68')]['internal']=_0x6d9fdf;}else{_0x270cb8[_0xa508('0x68')][_0xa508('0x7b')]=0x1;}}else{if(_[_0xa508('0x73')](_0x6d9fdf)||_0x6d9fdf==_0x41e9b8){_0x270cb8[_0xa508('0x68')][_0xa508('0x7b')]=_0x41e9b8+0x1;}else if(_0x6d9fdf>_0x41e9b8){_0x270cb8[_0xa508('0x68')][_0xa508('0x7b')]=_0x6d9fdf;}else{return db[_0xa508('0x5f')][_0xa508('0x4f')](_0xa508('0x7c'),{'type':db[_0xa508('0x5f')][_0xa508('0x7d')]['SELECT']})[_0xa508('0x23')](function(_0x2e16a4){if(_0x2e16a4&&_0x2e16a4['length']){for(var _0x7733e8=0x0,_0xcfb60d=_0x2e16a4[_0xa508('0x55')];_0x7733e8<_0xcfb60d&&_[_0xa508('0x73')](_0x270cb8[_0xa508('0x68')]['internal']);_0x7733e8++){if(_0x6d9fdf<=_0x2e16a4[_0x7733e8][_0xa508('0x7e')]){_0x270cb8['body'][_0xa508('0x7b')]=_0x2e16a4[_0x7733e8][_0xa508('0x7e')];}else if(_0x6d9fdf>_0x2e16a4[_0x7733e8][_0xa508('0x7e')]&&_0x6d9fdf<=_0x2e16a4[_0x7733e8]['to']){_0x270cb8[_0xa508('0x68')]['internal']=_0x6d9fdf;}}}if(_[_0xa508('0x73')](_0x270cb8[_0xa508('0x68')][_0xa508('0x7b')])){_0x270cb8[_0xa508('0x68')]['internal']=_0x41e9b8+0x1;}});}}});}})[_0xa508('0x23')](function(){if(_0x270cb8[_0xa508('0x68')][_0xa508('0x7f')]){_0x270cb8[_0xa508('0x68')]['mailbox']=_0x270cb8[_0xa508('0x68')]['internal'];_0x270cb8[_0xa508('0x68')][_0xa508('0x80')]={'mailbox':_0x270cb8[_0xa508('0x68')][_0xa508('0x7b')],'password':_0x270cb8[_0xa508('0x68')][_0xa508('0x4d')],'fullname':_0x270cb8[_0xa508('0x68')]['fullname'],'email':_0x270cb8[_0xa508('0x68')][_0xa508('0x81')]};}if(_0x270cb8[_0xa508('0x68')]&&_0x270cb8[_0xa508('0x68')][_0xa508('0x43')]==='agent'){_0x270cb8[_0xa508('0x68')]['permissions']=[_0xa508('0x82'),_0xa508('0x83'),_0xa508('0x84'),_0xa508('0x85'),_0xa508('0x86'),_0xa508('0x87'),_0xa508('0x88'),_0xa508('0x89'),_0xa508('0x8a'),_0xa508('0x8b'),_0xa508('0x8c'),_0xa508('0x8d')];}return db['User']['create'](_0x270cb8[_0xa508('0x68')],{'include':[{'model':db[_0xa508('0x80')],'as':_0xa508('0x80')}]});})[_0xa508('0x23')](function(_0x380514){if(_0x270cb8[_0xa508('0x68')][_0xa508('0x43')]==='user')return _0x380514;var _0x44d56e=_0x270cb8['user'][_0xa508('0x39')]({'plain':!![]});if(!_0x44d56e)throw new Error(_0xa508('0x8e'));if(_0x44d56e[_0xa508('0x43')]==='user'){var _0x3c3d73=_0x380514[_0xa508('0x39')]({'plain':!![]});var _0x36a8a4=[{'name':'Agents','value':_0xa508('0x3c')},{'name':_0xa508('0x3d'),'value':_0xa508('0x6f')}];var _0x203eda=_[_0xa508('0x42')](_0x36a8a4,['value',_0x3c3d73['role']])[_0xa508('0x44')];return db[_0xa508('0x8f')][_0xa508('0x42')]({'where':{'name':_0x203eda,'userProfileId':_0x44d56e['userProfileId']},'raw':!![]})[_0xa508('0x23')](function(_0x335992){if(_0x335992&&_0x335992[_0xa508('0x90')]===0x0){return db[_0xa508('0x91')][_0xa508('0x76')]({'name':_0x3c3d73[_0xa508('0x44')],'resourceId':_0x3c3d73['id'],'type':_0x335992[_0xa508('0x44')],'sectionId':_0x335992['id']},{})[_0xa508('0x23')](function(){return _0x380514;});}else{return _0x380514;}})[_0xa508('0x2c')](function(_0x305ee0){logger[_0xa508('0x29')](_0xa508('0x92'),_0x305ee0);throw _0x305ee0;});}return _0x380514;})[_0xa508('0x23')](respondWithResult(_0x239823,0xc9))[_0xa508('0x2c')](handleError(_0x239823,null));};exports[_0xa508('0x93')]=function(_0x19c2f0,_0x12f395,_0x70657c){var _0x26e773=![];if(_0x19c2f0[_0xa508('0x68')]['id']){delete _0x19c2f0[_0xa508('0x68')]['id'];}return db[_0xa508('0x77')]['findOne']({'attributes':['id',_0xa508('0x79')]})[_0xa508('0x23')](function(_0x5e09d7){_0x26e773=_0x5e09d7['securePassword'];return db['User']['find']({'where':{'id':_0x19c2f0['params']['id']}});})[_0xa508('0x23')](function(_0x1e55a4){if(_0x1e55a4){if(_0x1e55a4['id']==_0x19c2f0[_0xa508('0x3a')]['id']){if(!_0x19c2f0['body'][_0xa508('0x94')]||!_0x19c2f0['body'][_0xa508('0x95')]){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x96'));}if(!_0x1e55a4['authenticate'](_0x19c2f0[_0xa508('0x68')][_0xa508('0x94')])){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x97'));}if(_0x19c2f0[_0xa508('0x68')][_0xa508('0x94')]==_0x19c2f0[_0xa508('0x68')][_0xa508('0x95')]){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x98'));}return _0x1e55a4;}else if(_0x19c2f0['user'][_0xa508('0x43')]==_0xa508('0x99')){if(!_0x19c2f0[_0xa508('0x68')][_0xa508('0x95')]){throw new db['Sequelize'][(_0xa508('0x20'))](_0xa508('0x9a'));}return _0x1e55a4;}else if(_0x19c2f0[_0xa508('0x3a')][_0xa508('0x43')]==_0xa508('0x3a')){if(!_0x19c2f0[_0xa508('0x68')][_0xa508('0x95')]){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x9a'));}if(_0x1e55a4[_0xa508('0x43')]!='agent'){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x9b'));}return _0x1e55a4;}else{throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0x9b'));}}return null;})[_0xa508('0x23')](handleEntityNotFound(_0x12f395,null))[_0xa508('0x23')](function(_0x127645){return checkPasswordPattern(_0x127645,_0x19c2f0[_0xa508('0x68')][_0xa508('0x95')],_0x26e773);})['then'](saveUpdates({'password':_0x19c2f0[_0xa508('0x68')][_0xa508('0x95')],'passwordResetAt':_0x19c2f0[_0xa508('0x3a')]['id']==_0x19c2f0[_0xa508('0x69')]['id']?moment():null},null))[_0xa508('0x23')](respondWithResult(_0x12f395,null))[_0xa508('0x2c')](handleError(_0x12f395,null));};exports[_0xa508('0x9c')]=function(_0x5e0c66,_0x470d51,_0x42a3e7){var _0x394767=_0x5e0c66['body'][_0xa508('0x9d')];return db[_0xa508('0x48')]['find']({'where':{'id':_0x5e0c66[_0xa508('0x69')]['id']},'attributes':['id',_0xa508('0x44'),_0xa508('0x43'),'online',_0xa508('0x9e'),_0xa508('0x9f'),'interface']})['then'](handleEntityNotFound(_0x470d51,null))[_0xa508('0x23')](function(_0x7914c0){if(_0x7914c0){if(!utils['isValidChannel'](_0x394767)){throw new db['Sequelize']['ValidationError']('Unknown\x20channel');}return _0x7914c0['add'+_[_0xa508('0xa0')](_0x394767[_0xa508('0xa1')]())+_0xa508('0xa2')](_0x5e0c66[_0xa508('0x68')]['ids'],{'penalty':_0x5e0c66[_0xa508('0x68')][_0xa508('0xa3')]||0x0})[_0xa508('0xa4')](function(_0x2a1f47){for(var _0x19d6ca=0x0;_0x19d6ca<_0x5e0c66[_0xa508('0x68')]['ids']['length'];_0x19d6ca+=0x1){var _0x2105b1={'UserId':_0x5e0c66[_0xa508('0x69')]['id']};_0x2105b1[_[_0xa508('0xa0')](_0x394767['toLowerCase']())+_0xa508('0xa5')]=_0x5e0c66[_0xa508('0x68')][_0xa508('0x6d')][_0x19d6ca];socket[_0xa508('0xa6')](_0xa508('0x3a')+_[_0xa508('0xa0')](_0x394767[_0xa508('0xa1')]())+_0xa508('0xa7'),_0x2105b1);}return _0x2a1f47;})['then'](function(){if(_0x394767===_0xa508('0xa8')){return db[_0xa508('0xa9')][_0xa508('0x63')]({'where':{'id':_0x5e0c66[_0xa508('0x68')][_0xa508('0x6d')]||[]},'raw':!![],'attributes':['id','name']});}})[_0xa508('0x23')](function(_0x393029){var _0x2c1b3c=_0x7914c0[_0xa508('0x39')]({'plain':!![]});var _0x16ca0f=[];if(_0x394767==='voice'&&_0x2c1b3c['role']===_0xa508('0x3c')&&_0x2c1b3c[_0xa508('0xaa')]){for(var _0x1e6744=0x0;_0x1e6744<_0x393029[_0xa508('0x55')];_0x1e6744+=0x1){_0x16ca0f[_0xa508('0xab')]({'membername':_0x2c1b3c[_0xa508('0x44')],'UserId':_0x2c1b3c['id'],'queue_name':_0x393029[_0x1e6744][_0xa508('0x44')],'VoiceQueueId':_0x393029[_0x1e6744]['id'],'interface':_[_0xa508('0x73')](_0x2c1b3c[_0xa508('0xac')])?util[_0xa508('0xad')](_0xa508('0xae'),_0x2c1b3c[_0xa508('0x44')]):_0x2c1b3c[_0xa508('0xac')],'paused':_0x2c1b3c[_0xa508('0x9f')]||![],'penalty':_0x5e0c66['body'][_0xa508('0xa3')]||0x0});}return BPromise[_0xa508('0xaf')](_0x16ca0f,function(_0x4ba9a3){return db[_0xa508('0xb0')][_0xa508('0xb1')](_0x4ba9a3);});}return _0x7914c0;});}})['then'](respondWithStatusCode(_0x470d51,null))['catch'](handleError(_0x470d51,null));};exports['removeQueues']=function(_0x3ba0f5,_0x42d8e7,_0x12b110){var _0x548bf0;return db['User'][_0xa508('0x42')]({'where':{'id':_0x3ba0f5['params']['id']},'attributes':['id',_0xa508('0x44'),'role']})[_0xa508('0x23')](handleEntityNotFound(_0x42d8e7,null))['then'](function(_0x2df65c){if(_0x2df65c){_0x548bf0=_0x2df65c;if(!_0x3ba0f5[_0xa508('0x4f')]['channel']||!utils[_0xa508('0xb2')](_0x3ba0f5[_0xa508('0x4f')][_0xa508('0x9d')])){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))]('Unknown\x20channel');}return _0x2df65c[_0xa508('0xb3')+_[_0xa508('0xa0')](_0x3ba0f5['query'][_0xa508('0x9d')][_0xa508('0xa1')]())+_0xa508('0xa2')](_0x3ba0f5['query']['ids']);}})[_0xa508('0x23')](function(_0x2a2319){for(var _0x1f6b7e=0x0;_0x1f6b7e<_0x3ba0f5['query'][_0xa508('0x6d')][_0xa508('0x55')];_0x1f6b7e+=0x1){var _0x459763={'UserId':_0x3ba0f5['params']['id']};_0x459763[_[_0xa508('0xa0')](_0x3ba0f5['query'][_0xa508('0x9d')]['toLowerCase']())+_0xa508('0xa5')]=_0x3ba0f5[_0xa508('0x4f')][_0xa508('0x6d')][_0x1f6b7e];socket['emit'](_0xa508('0x3a')+_[_0xa508('0xa0')](_0x3ba0f5['query'][_0xa508('0x9d')][_0xa508('0xa1')]())+_0xa508('0xb4'),_0x459763);}return _0x2a2319;})[_0xa508('0x23')](function(){if(_0x3ba0f5[_0xa508('0x4f')][_0xa508('0x9d')]===_0xa508('0xa8')){return db[_0xa508('0xb0')][_0xa508('0x38')]({'where':{'UserId':_0x3ba0f5[_0xa508('0x69')]['id'],'VoiceQueueId':_0x3ba0f5[_0xa508('0x4f')][_0xa508('0x6d')]},'individualHooks':!![]})['then'](function(){return _0x548bf0;});}return _0x548bf0;})[_0xa508('0x23')](respondWithStatusCode(_0x42d8e7,null))[_0xa508('0x2c')](handleError(_0x42d8e7,null));};exports[_0xa508('0xb5')]=function(_0x38ab39,_0x1d0a87,_0x2e2f68){_0x38ab39[_0xa508('0x68')][_0xa508('0xb6')]=_0x38ab39[_0xa508('0xb7')]['filename'];return db[_0xa508('0x48')][_0xa508('0x42')]({'where':{'id':_0x38ab39[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x1d0a87,null))['then'](saveUpdates(_0x38ab39['body'],null))[_0xa508('0x23')](respondWithResult(_0x1d0a87,null))['catch'](handleError(_0x1d0a87,null));};exports['getAvatar']=function(_0x129469,_0x1a1c30,_0x1ea869){var _0x2c2bf8=path[_0xa508('0xb8')](config[_0xa508('0xb9')],'server/files/images/logos/default_profile.png');return db['User'][_0xa508('0x42')]({'where':{'id':_0x129469['params']['id']},'attributes':['id',_0xa508('0xb6')],'raw':!![]})[_0xa508('0x23')](handleEntityNotFound(_0x1a1c30,null))[_0xa508('0x23')](function(_0x365c78){if(_0x365c78){if(_[_0xa508('0x73')](_0x365c78[_0xa508('0xb6')])){return _0x1a1c30[_0xa508('0xba')](_0x2c2bf8);}else{if(!fs['existsSync'](path['join'](config[_0xa508('0xb9')],_0xa508('0xbb'),_0x365c78[_0xa508('0xb6')]))){return _0x1a1c30[_0xa508('0xba')](_0x2c2bf8);}return _0x1a1c30['download'](path[_0xa508('0xb8')](config['root'],'server/files/images/',_0x365c78['userpic']));}}})[_0xa508('0x2c')](handleError(_0x1a1c30,null));};exports[_0xa508('0xbc')]=function(_0x3be09e,_0x17fbd8,_0x19a669){var _0x50855a={};var _0x16004e={};var _0xd023c4;var _0x311565;return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x3be09e['params']['id']}})['then'](handleEntityNotFound(_0x17fbd8,null))[_0xa508('0x23')](function(_0x250871){if(_0x250871){_0xd023c4=_0x250871;_0x16004e['model']=_[_0xa508('0x50')](db[_0xa508('0xbe')]['rawAttributes']);_0x16004e[_0xa508('0x4f')]=_['keys'](_0x3be09e[_0xa508('0x4f')]);_0x16004e[_0xa508('0x51')]=_[_0xa508('0x53')](_0x16004e[_0xa508('0x4c')],_0x16004e[_0xa508('0x4f')]);_0x50855a[_0xa508('0x52')]=_[_0xa508('0x53')](_0x16004e[_0xa508('0x4c')],qs['fields'](_0x3be09e[_0xa508('0x4f')][_0xa508('0x54')]));_0x50855a[_0xa508('0x52')]=_0x50855a[_0xa508('0x52')]['length']?_0x50855a[_0xa508('0x52')]:_0x16004e[_0xa508('0x4c')];_0x50855a['order']=qs['sort'](_0x3be09e['query'][_0xa508('0x5a')]);_0x50855a['where']=qs['filters'](_[_0xa508('0x5c')](_0x3be09e[_0xa508('0x4f')],_0x16004e['filters']));if(_0x3be09e[_0xa508('0x4f')][_0xa508('0x3e')]){_0x50855a[_0xa508('0x5b')]=_[_0xa508('0x5d')](_0x50855a[_0xa508('0x5b')],{'$or':_['map'](_0x50855a['attributes'],function(_0x1d193a){var _0xfe8d95={};_0xfe8d95[_0x1d193a]={'$like':'%'+_0x3be09e['query']['filter']+'%'};return _0xfe8d95;})});}_0x50855a=_[_0xa508('0x5d')]({},_0x50855a,_0x3be09e[_0xa508('0x66')]);return _0xd023c4['getContacts'](_0x50855a);}})['then'](function(_0x18caaf){if(_0x18caaf){_0x311565=_0x18caaf[_0xa508('0x55')];if(_0x3be09e[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0xbf'))){_0x50855a['include']=[{'model':db[_0xa508('0xc0')],'as':_0xa508('0xc1'),'required':![]},{'model':db[_0xa508('0xc2')],'as':_0xa508('0xc3'),'attributes':['id','name',_0xa508('0xc4')],'where':_0x3be09e[_0xa508('0x4f')]['tag']?{'id':_0x3be09e['query']['tag']}:undefined,'required':_0x3be09e['query'][_0xa508('0xc5')]?!![]:![]}];}if(!_0x3be09e['query'][_0xa508('0x56')](_0xa508('0x57'))){_0x50855a[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x3be09e[_0xa508('0x4f')]['limit']);_0x50855a[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x3be09e[_0xa508('0x4f')]['offset']);}return _0xd023c4['getContacts'](_0x50855a);}})[_0xa508('0x23')](function(_0xa6eb2a){if(_0xa6eb2a){return _0xa6eb2a?{'count':_0x311565,'rows':_0xa6eb2a}:null;}})[_0xa508('0x23')](respondWithResult(_0x17fbd8,null))[_0xa508('0x2c')](handleError(_0x17fbd8,null));};exports[_0xa508('0xc6')]=function(_0x334912,_0x55b6de,_0x2f4d0d){var _0x49e406;var _0xf47a7d;var _0x338327={};var _0x4b16d6;return db[_0xa508('0x48')]['findOne']({'where':{'id':_0x334912[_0xa508('0x69')]['id']},'attributes':['id','name',_0xa508('0x43')]})[_0xa508('0x23')](handleEntityNotFound(_0x55b6de,null))['then'](function(_0x2979e4){if(!utils[_0xa508('0xb2')](_0x334912[_0xa508('0x4f')][_0xa508('0x9d')])){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0xc7'));}_0x49e406=_0x2979e4;var _0x5aa7ca={};_0x5aa7ca[_0xa508('0x4c')]=_['keys'](db[_[_0xa508('0xa0')](_0x334912[_0xa508('0x4f')]['channel'])+_0xa508('0xc8')]['rawAttributes']);_0x5aa7ca[_0xa508('0x4f')]=_[_0xa508('0x50')](_0x334912['query']);_0x5aa7ca[_0xa508('0x51')]=_['intersection'](_0x5aa7ca[_0xa508('0x4c')],_0x5aa7ca[_0xa508('0x4f')]);_0x338327[_0xa508('0x52')]=_[_0xa508('0x53')](_0x5aa7ca[_0xa508('0x4c')],qs[_0xa508('0x54')](_0x334912['query'][_0xa508('0x54')]));_0x338327[_0xa508('0x52')]=_0x338327['attributes'][_0xa508('0x55')]?_0x338327[_0xa508('0x52')]:_0x5aa7ca[_0xa508('0x4c')];_0x338327[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x334912[_0xa508('0x4f')][_0xa508('0x5a')]);_0x338327[_0xa508('0x5b')]=qs['filters'](_[_0xa508('0x5c')](_0x334912['query'],_0x5aa7ca[_0xa508('0x51')]));if(_0x334912['query'][_0xa508('0x3e')]){_0x338327['where']=_['merge'](_0x338327[_0xa508('0x5b')],{'$or':_['map'](_0x338327['attributes'],function(_0x30cfd7){var _0x234be4={};_0x234be4[_0x30cfd7]={'$like':'%'+_0x334912[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x234be4;})});}_0x338327=_['merge']({},_0x338327,_0x334912['options']);switch(_0x49e406[_0xa508('0x43')]){case'admin':return db[_[_0xa508('0xa0')](_0x334912[_0xa508('0x4f')][_0xa508('0x9d')])+_0xa508('0xc8')]['findAll'](_0x338327);case _0xa508('0x3a'):case'agent':return _0x49e406[_0xa508('0x39')+_[_0xa508('0xa0')](_0x334912['query'][_0xa508('0x9d')])+_0xa508('0xa2')](_0x338327);default:throw new db[(_0xa508('0x1f'))]['ValidationError'](_0xa508('0xc9'));}})[_0xa508('0x23')](function(_0x17ee2a){_0x4b16d6=_0x17ee2a[_0xa508('0x55')];if(!_0x334912['query'][_0xa508('0x56')](_0xa508('0x57'))){_0x338327[_0xa508('0x32')]=qs['limit'](_0x334912[_0xa508('0x4f')]['limit']);_0x338327[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x334912['query'][_0xa508('0x58')]);}switch(_0x49e406[_0xa508('0x43')]){case _0xa508('0x99'):return db[_[_0xa508('0xa0')](_0x334912[_0xa508('0x4f')]['channel'])+_0xa508('0xc8')][_0xa508('0x63')](_0x338327);case'user':case _0xa508('0x3c'):return _0x49e406[_0xa508('0x39')+_['capitalize'](_0x334912[_0xa508('0x4f')]['channel'])+'Queues'](_0x338327);}})['then'](function(_0x504e01){return{'count':_0x4b16d6,'rows':_0x504e01};})[_0xa508('0x23')](respondWithResult(_0x55b6de,null))['catch'](handleError(_0x55b6de,null));};exports[_0xa508('0xca')]=function(_0xa71e21,_0x5baaf8,_0xf6cc0c){var _0x5bb91b={};var _0x4a9afc={};var _0x15f14a;var _0x2cc31a;return db['User']['findOne']({'where':{'id':_0xa71e21[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x5baaf8,null))['then'](function(_0x32afa2){if(_0x32afa2){_0x15f14a=_0x32afa2;_0x4a9afc[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0xb0')]['rawAttributes']);_0x4a9afc[_0xa508('0x4f')]=_[_0xa508('0x50')](_0xa71e21[_0xa508('0x4f')]);_0x4a9afc[_0xa508('0x51')]=_[_0xa508('0x53')](_0x4a9afc[_0xa508('0x4c')],_0x4a9afc[_0xa508('0x4f')]);_0x5bb91b[_0xa508('0x52')]=_[_0xa508('0x53')](_0x4a9afc[_0xa508('0x4c')],qs[_0xa508('0x54')](_0xa71e21['query'][_0xa508('0x54')]));_0x5bb91b[_0xa508('0x52')]=_0x5bb91b[_0xa508('0x52')][_0xa508('0x55')]?_0x5bb91b[_0xa508('0x52')]:_0x4a9afc[_0xa508('0x4c')];_0x5bb91b[_0xa508('0x59')]=qs['sort'](_0xa71e21['query']['sort']);_0x5bb91b['where']=qs['filters'](_[_0xa508('0x5c')](_0xa71e21[_0xa508('0x4f')],_0x4a9afc[_0xa508('0x51')]));if(_0xa71e21[_0xa508('0x4f')][_0xa508('0x3e')]){_0x5bb91b['where']=_[_0xa508('0x5d')](_0x5bb91b[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x5bb91b[_0xa508('0x52')],function(_0x1f6778){var _0x13a716={};_0x13a716[_0x1f6778]={'$like':'%'+_0xa71e21[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x13a716;})});}_0x5bb91b=_[_0xa508('0x5d')]({},_0x5bb91b,_0xa71e21[_0xa508('0x66')]);return _0x15f14a[_0xa508('0xca')](_0x5bb91b);}})[_0xa508('0x23')](function(_0x1a2455){if(_0x1a2455){_0x2cc31a=_0x1a2455[_0xa508('0x55')];if(!_0xa71e21[_0xa508('0x4f')][_0xa508('0x56')]('nolimit')){_0x5bb91b[_0xa508('0x32')]=qs[_0xa508('0x32')](_0xa71e21[_0xa508('0x4f')][_0xa508('0x32')]);_0x5bb91b['offset']=qs[_0xa508('0x58')](_0xa71e21[_0xa508('0x4f')][_0xa508('0x58')]);}return _0x15f14a[_0xa508('0xca')](_0x5bb91b);}})['then'](function(_0x17c9fb){if(_0x17c9fb){return _0x17c9fb?{'count':_0x2cc31a,'rows':_0x17c9fb}:null;}})[_0xa508('0x23')](respondWithResult(_0x5baaf8,null))[_0xa508('0x2c')](handleError(_0x5baaf8,null));};exports[_0xa508('0xcb')]=function(_0xef5a27,_0x173a95,_0x57c79d){var _0x1f46bc={};var _0x5ba979={};var _0x443fca;var _0x4b3909;return db['User']['findOne']({'where':{'id':_0xef5a27[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x173a95,null))[_0xa508('0x23')](function(_0x1e234f){if(_0x1e234f){_0x443fca=_0x1e234f;_0x5ba979['model']=_[_0xa508('0x50')](db[_0xa508('0xcc')][_0xa508('0x49')]);_0x5ba979[_0xa508('0x4f')]=_['keys'](_0xef5a27[_0xa508('0x4f')]);_0x5ba979['filters']=_[_0xa508('0x53')](_0x5ba979[_0xa508('0x4c')],_0x5ba979['query']);_0x1f46bc[_0xa508('0x52')]=_[_0xa508('0x53')](_0x5ba979[_0xa508('0x4c')],qs[_0xa508('0x54')](_0xef5a27[_0xa508('0x4f')][_0xa508('0x54')]));_0x1f46bc[_0xa508('0x52')]=_0x1f46bc['attributes'][_0xa508('0x55')]?_0x1f46bc[_0xa508('0x52')]:_0x5ba979[_0xa508('0x4c')];_0x1f46bc['order']=qs['sort'](_0xef5a27[_0xa508('0x4f')][_0xa508('0x5a')]);_0x1f46bc['where']=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0xef5a27[_0xa508('0x4f')],_0x5ba979[_0xa508('0x51')]));if(_0xef5a27['query']['filter']){_0x1f46bc[_0xa508('0x5b')]=_[_0xa508('0x5d')](_0x1f46bc[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x1f46bc['attributes'],function(_0xc73541){var _0xd2352b={};_0xd2352b[_0xc73541]={'$like':'%'+_0xef5a27[_0xa508('0x4f')]['filter']+'%'};return _0xd2352b;})});}_0x1f46bc=_[_0xa508('0x5d')]({},_0x1f46bc,_0xef5a27[_0xa508('0x66')]);return _0x443fca['getGroups'](_0x1f46bc);}})[_0xa508('0x23')](function(_0x510ba0){if(_0x510ba0){_0x4b3909=_0x510ba0[_0xa508('0x55')];if(!_0xef5a27[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0x1f46bc[_0xa508('0x32')]=qs[_0xa508('0x32')](_0xef5a27['query'][_0xa508('0x32')]);_0x1f46bc[_0xa508('0x58')]=qs['offset'](_0xef5a27[_0xa508('0x4f')]['offset']);}return _0x443fca[_0xa508('0xcb')](_0x1f46bc);}})['then'](function(_0x474c4b){if(_0x474c4b){return _0x474c4b?{'count':_0x4b3909,'rows':_0x474c4b}:null;}})[_0xa508('0x23')](respondWithResult(_0x173a95,null))[_0xa508('0x2c')](handleError(_0x173a95,null));};exports[_0xa508('0xcd')]=function(_0x36becb,_0x24992a,_0x4852ea){var _0x3dd900={'raw':!![],'where':{}};var _0x5d7cf0={};var _0x40c2e7={'count':0x0,'rows':[]};return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x36becb[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x24992a,null))[_0xa508('0x23')](function(_0x44299b){if(_0x44299b){_0x5d7cf0[_0xa508('0x4c')]=_['keys'](db[_0xa508('0xce')][_0xa508('0x49')]);_0x5d7cf0[_0xa508('0x4f')]=_['keys'](_0x36becb[_0xa508('0x4f')]);_0x5d7cf0['filters']=_['intersection'](_0x5d7cf0['model'],_0x5d7cf0[_0xa508('0x4f')]);_0x3dd900[_0xa508('0x52')]=_[_0xa508('0x53')](_0x5d7cf0[_0xa508('0x4c')],qs[_0xa508('0x54')](_0x36becb['query'][_0xa508('0x54')]));_0x3dd900[_0xa508('0x52')]=_0x3dd900['attributes'][_0xa508('0x55')]?_0x3dd900[_0xa508('0x52')]:_0x5d7cf0[_0xa508('0x4c')];if(!_0x36becb[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0x3dd900['limit']=qs[_0xa508('0x32')](_0x36becb[_0xa508('0x4f')][_0xa508('0x32')]);_0x3dd900['offset']=qs[_0xa508('0x58')](_0x36becb[_0xa508('0x4f')][_0xa508('0x58')]);}_0x3dd900[_0xa508('0x59')]=qs['sort'](_0x36becb[_0xa508('0x4f')]['sort']);_0x3dd900['where']=qs['filters'](_[_0xa508('0x5c')](_0x36becb[_0xa508('0x4f')],_0x5d7cf0[_0xa508('0x51')]));_0x3dd900[_0xa508('0x5b')][_0xa508('0xcf')]=_0x44299b['id'];if(_0x36becb['query']['filter']){_0x3dd900[_0xa508('0x5b')]=_['merge'](_0x3dd900[_0xa508('0x5b')],{'$or':_['map'](_0x3dd900[_0xa508('0x52')],function(_0x3e98fb){var _0x23b9e2={};_0x23b9e2[_0x3e98fb]={'$like':'%'+_0x36becb[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x23b9e2;})});}_0x3dd900=_['merge']({},_0x3dd900,_0x36becb['options']);return db[_0xa508('0xce')]['count']({'where':_0x3dd900[_0xa508('0x5b')]})[_0xa508('0x23')](function(_0x1b2eb5){_0x40c2e7[_0xa508('0x31')]=_0x1b2eb5;if(_0x36becb['query'][_0xa508('0xbf')]){_0x3dd900[_0xa508('0x62')]=[{'all':!![]}];}return db['VoiceRecording'][_0xa508('0x63')](_0x3dd900);})[_0xa508('0x23')](function(_0x57f6cf){_0x40c2e7[_0xa508('0x64')]=_0x57f6cf;return _0x40c2e7;});}})[_0xa508('0x23')](respondWithFilteredResult(_0x24992a,_0x3dd900))['catch'](handleError(_0x24992a,null));};exports[_0xa508('0xd0')]=function(_0x1f3f0d,_0x2a92a6,_0x3deeef){var _0x11c10a={'raw':!![],'where':{}};var _0x22a31b={};var _0x276875={'count':0x0,'rows':[]};return db['User']['findOne']({'where':{'id':_0x1f3f0d[_0xa508('0x69')]['id']}})['then'](handleEntityNotFound(_0x2a92a6,null))[_0xa508('0x23')](function(_0x4e1e3b){if(_0x4e1e3b){_0x22a31b[_0xa508('0x4c')]=_['keys'](db[_0xa508('0xd1')][_0xa508('0x49')]);_0x22a31b[_0xa508('0x4f')]=_[_0xa508('0x50')](_0x1f3f0d['query']);_0x22a31b[_0xa508('0x51')]=_['intersection'](_0x22a31b[_0xa508('0x4c')],_0x22a31b[_0xa508('0x4f')]);_0x11c10a[_0xa508('0x52')]=_['intersection'](_0x22a31b['model'],qs['fields'](_0x1f3f0d[_0xa508('0x4f')]['fields']));_0x11c10a[_0xa508('0x52')]=_0x11c10a[_0xa508('0x52')][_0xa508('0x55')]?_0x11c10a[_0xa508('0x52')]:_0x22a31b[_0xa508('0x4c')];if(!_0x1f3f0d['query'][_0xa508('0x56')]('nolimit')){_0x11c10a[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x1f3f0d[_0xa508('0x4f')][_0xa508('0x32')]);_0x11c10a[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x1f3f0d[_0xa508('0x4f')][_0xa508('0x58')]);}_0x11c10a[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x1f3f0d[_0xa508('0x4f')]['sort']);_0x11c10a[_0xa508('0x5b')]=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x1f3f0d[_0xa508('0x4f')],_0x22a31b[_0xa508('0x51')]));_0x11c10a['where'][_0xa508('0xcf')]=_0x4e1e3b['id'];if(_0x1f3f0d[_0xa508('0x4f')][_0xa508('0x3e')]){_0x11c10a[_0xa508('0x5b')]=_['merge'](_0x11c10a[_0xa508('0x5b')],{'$or':_['map'](_0x11c10a[_0xa508('0x52')],function(_0x19b331){var _0x4b780d={};_0x4b780d[_0x19b331]={'$like':'%'+_0x1f3f0d['query'][_0xa508('0x3e')]+'%'};return _0x4b780d;})});}_0x11c10a=_[_0xa508('0x5d')]({},_0x11c10a,_0x1f3f0d[_0xa508('0x66')]);return db['ScreenRecording'][_0xa508('0x31')]({'where':_0x11c10a[_0xa508('0x5b')]})[_0xa508('0x23')](function(_0x3c82e3){_0x276875[_0xa508('0x31')]=_0x3c82e3;if(_0x1f3f0d[_0xa508('0x4f')][_0xa508('0xbf')]){_0x11c10a[_0xa508('0x62')]=[{'all':!![]}];}return db[_0xa508('0xd1')]['findAll'](_0x11c10a);})[_0xa508('0x23')](function(_0xbc173b){_0x276875['rows']=_0xbc173b;return _0x276875;});}})[_0xa508('0x23')](respondWithFilteredResult(_0x2a92a6,_0x11c10a))[_0xa508('0x2c')](handleError(_0x2a92a6,null));};exports[_0xa508('0xd2')]=function(_0x3773d7,_0x379c19,_0x251af8){var _0x2a2271={};var _0x37c126={};var _0x53ee30;var _0x3fbc96;return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x3773d7[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x379c19,null))[_0xa508('0x23')](function(_0x53758e){if(_0x53758e){_0x53ee30=_0x53758e;_0x37c126[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0xd3')][_0xa508('0x49')]);_0x37c126[_0xa508('0x4f')]=_['keys'](_0x3773d7['query']);_0x37c126[_0xa508('0x51')]=_[_0xa508('0x53')](_0x37c126['model'],_0x37c126[_0xa508('0x4f')]);_0x2a2271[_0xa508('0x52')]=_[_0xa508('0x53')](_0x37c126['model'],qs[_0xa508('0x54')](_0x3773d7[_0xa508('0x4f')][_0xa508('0x54')]));_0x2a2271[_0xa508('0x52')]=_0x2a2271[_0xa508('0x52')][_0xa508('0x55')]?_0x2a2271[_0xa508('0x52')]:_0x37c126[_0xa508('0x4c')];_0x2a2271['order']=qs[_0xa508('0x5a')](_0x3773d7[_0xa508('0x4f')][_0xa508('0x5a')]);_0x2a2271[_0xa508('0x5b')]=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x3773d7[_0xa508('0x4f')],_0x37c126[_0xa508('0x51')]));if(_0x3773d7[_0xa508('0x4f')]['filter']){_0x2a2271['where']=_[_0xa508('0x5d')](_0x2a2271[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x2a2271[_0xa508('0x52')],function(_0x5f447){var _0x1bdfe5={};_0x1bdfe5[_0x5f447]={'$like':'%'+_0x3773d7['query'][_0xa508('0x3e')]+'%'};return _0x1bdfe5;})});}_0x2a2271=_[_0xa508('0x5d')]({},_0x2a2271,_0x3773d7['options']);return _0x53ee30[_0xa508('0xd2')](_0x2a2271);}})['then'](function(_0x32010d){if(_0x32010d){_0x3fbc96=_0x32010d[_0xa508('0x55')];if(!_0x3773d7[_0xa508('0x4f')][_0xa508('0x56')]('nolimit')){_0x2a2271[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x3773d7[_0xa508('0x4f')][_0xa508('0x32')]);_0x2a2271[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x3773d7[_0xa508('0x4f')][_0xa508('0x58')]);}return _0x53ee30[_0xa508('0xd2')](_0x2a2271);}})[_0xa508('0x23')](function(_0xfd6ef3){if(_0xfd6ef3){return _0xfd6ef3?{'count':_0x3fbc96,'rows':_0xfd6ef3}:null;}})[_0xa508('0x23')](respondWithResult(_0x379c19,null))['catch'](handleError(_0x379c19,null));};exports[_0xa508('0xd4')]=function(_0x3c8ca8,_0x386d4c,_0x14cc7f){var _0xe0c615={};var _0x13ec4f={};var _0x45f98a;var _0x3e7c5f;return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x3c8ca8['params']['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x386d4c,null))[_0xa508('0x23')](function(_0x573ab8){if(_0x573ab8){_0x45f98a=_0x573ab8;_0x13ec4f[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0xd5')][_0xa508('0x49')]);_0x13ec4f[_0xa508('0x4f')]=_['keys'](_0x3c8ca8['query']);_0x13ec4f[_0xa508('0x51')]=_[_0xa508('0x53')](_0x13ec4f[_0xa508('0x4c')],_0x13ec4f[_0xa508('0x4f')]);_0xe0c615[_0xa508('0x52')]=_[_0xa508('0x53')](_0x13ec4f['model'],qs[_0xa508('0x54')](_0x3c8ca8[_0xa508('0x4f')][_0xa508('0x54')]));_0xe0c615[_0xa508('0x52')]=_0xe0c615[_0xa508('0x52')]['length']?_0xe0c615[_0xa508('0x52')]:_0x13ec4f[_0xa508('0x4c')];_0xe0c615[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x3c8ca8['query'][_0xa508('0x5a')]);_0xe0c615[_0xa508('0x5b')]=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x3c8ca8[_0xa508('0x4f')],_0x13ec4f[_0xa508('0x51')]));if(_0x3c8ca8[_0xa508('0x4f')]['filter']){_0xe0c615['where']=_[_0xa508('0x5d')](_0xe0c615[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0xe0c615[_0xa508('0x52')],function(_0x2aba2c){var _0x450cf2={};_0x450cf2[_0x2aba2c]={'$like':'%'+_0x3c8ca8[_0xa508('0x4f')]['filter']+'%'};return _0x450cf2;})});}_0xe0c615=_[_0xa508('0x5d')]({},_0xe0c615,_0x3c8ca8['options']);return _0x45f98a[_0xa508('0xd4')](_0xe0c615);}})[_0xa508('0x23')](function(_0x35023a){if(_0x35023a){_0x3e7c5f=_0x35023a[_0xa508('0x55')];if(!_0x3c8ca8[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0xe0c615[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x3c8ca8[_0xa508('0x4f')][_0xa508('0x32')]);_0xe0c615[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x3c8ca8['query'][_0xa508('0x58')]);}return _0x45f98a[_0xa508('0xd4')](_0xe0c615);}})[_0xa508('0x23')](function(_0x48974a){if(_0x48974a){return _0x48974a?{'count':_0x3e7c5f,'rows':_0x48974a}:null;}})[_0xa508('0x23')](respondWithResult(_0x386d4c,null))[_0xa508('0x2c')](handleError(_0x386d4c,null));};exports[_0xa508('0xd6')]=function(_0x2053a0,_0x1376f5,_0xa2ce7f){var _0x42e524={'raw':!![],'where':{}};var _0x37f02e={};var _0x2d38b6={'count':0x0,'rows':[]};return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x2053a0[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x1376f5,null))[_0xa508('0x23')](function(_0x347714){if(_0x347714){_0x37f02e[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0xd7')][_0xa508('0x49')]);_0x37f02e[_0xa508('0x4f')]=_['keys'](_0x2053a0['query']);_0x37f02e['filters']=_[_0xa508('0x53')](_0x37f02e[_0xa508('0x4c')],_0x37f02e['query']);_0x42e524['attributes']=_[_0xa508('0x53')](_0x37f02e[_0xa508('0x4c')],qs['fields'](_0x2053a0[_0xa508('0x4f')][_0xa508('0x54')]));_0x42e524[_0xa508('0x52')]=_0x42e524[_0xa508('0x52')][_0xa508('0x55')]?_0x42e524[_0xa508('0x52')]:_0x37f02e[_0xa508('0x4c')];if(!_0x2053a0[_0xa508('0x4f')][_0xa508('0x56')]('nolimit')){_0x42e524[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x2053a0['query'][_0xa508('0x32')]);_0x42e524[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x2053a0[_0xa508('0x4f')][_0xa508('0x58')]);}_0x42e524[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x2053a0[_0xa508('0x4f')]['sort']);_0x42e524[_0xa508('0x5b')]=qs['filters'](_[_0xa508('0x5c')](_0x2053a0[_0xa508('0x4f')],_0x37f02e[_0xa508('0x51')]));_0x42e524[_0xa508('0x5b')][_0xa508('0xcf')]=_0x347714['id'];if(_0x2053a0[_0xa508('0x4f')][_0xa508('0x3e')]){_0x42e524[_0xa508('0x5b')]=_['merge'](_0x42e524['where'],{'$or':_[_0xa508('0x47')](_0x42e524['attributes'],function(_0x58e245){var _0x432feb={};_0x432feb[_0x58e245]={'$like':'%'+_0x2053a0[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x432feb;})});}_0x42e524=_['merge']({},_0x42e524,_0x2053a0[_0xa508('0x66')]);return db[_0xa508('0xd7')][_0xa508('0x31')]({'where':_0x42e524[_0xa508('0x5b')]})[_0xa508('0x23')](function(_0x42be6a){_0x2d38b6['count']=_0x42be6a;if(_0x2053a0[_0xa508('0x4f')]['includeAll']){_0x42e524[_0xa508('0x62')]=[{'all':!![]}];}return db['MailInteraction'][_0xa508('0x63')](_0x42e524);})[_0xa508('0x23')](function(_0x520b48){_0x2d38b6[_0xa508('0x64')]=_0x520b48;return _0x2d38b6;});}})[_0xa508('0x23')](respondWithFilteredResult(_0x1376f5,_0x42e524))[_0xa508('0x2c')](handleError(_0x1376f5,null));};exports[_0xa508('0xd8')]=function(_0x1a6041,_0x2038b6,_0x4c1ddd){var _0x331934={};var _0xb0b6a8={};var _0x4ac35e;var _0x318c4b;return db['User'][_0xa508('0xbd')]({'where':{'id':_0x1a6041[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x2038b6,null))[_0xa508('0x23')](function(_0x1d4b00){if(_0x1d4b00){_0x4ac35e=_0x1d4b00;_0xb0b6a8[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0xd9')][_0xa508('0x49')]);_0xb0b6a8[_0xa508('0x4f')]=_[_0xa508('0x50')](_0x1a6041[_0xa508('0x4f')]);_0xb0b6a8[_0xa508('0x51')]=_[_0xa508('0x53')](_0xb0b6a8[_0xa508('0x4c')],_0xb0b6a8[_0xa508('0x4f')]);_0x331934[_0xa508('0x52')]=_[_0xa508('0x53')](_0xb0b6a8[_0xa508('0x4c')],qs['fields'](_0x1a6041[_0xa508('0x4f')][_0xa508('0x54')]));_0x331934[_0xa508('0x52')]=_0x331934[_0xa508('0x52')][_0xa508('0x55')]?_0x331934[_0xa508('0x52')]:_0xb0b6a8[_0xa508('0x4c')];_0x331934[_0xa508('0x59')]=qs['sort'](_0x1a6041[_0xa508('0x4f')][_0xa508('0x5a')]);_0x331934['where']=qs[_0xa508('0x51')](_['pick'](_0x1a6041['query'],_0xb0b6a8[_0xa508('0x51')]));if(_0x1a6041[_0xa508('0x4f')][_0xa508('0x3e')]){_0x331934[_0xa508('0x5b')]=_['merge'](_0x331934[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x331934[_0xa508('0x52')],function(_0x52aa9e){var _0x6ec4ba={};_0x6ec4ba[_0x52aa9e]={'$like':'%'+_0x1a6041[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x6ec4ba;})});}_0x331934=_[_0xa508('0x5d')]({},_0x331934,_0x1a6041['options']);return _0x4ac35e[_0xa508('0xd8')](_0x331934);}})['then'](function(_0x3f4d13){if(_0x3f4d13){_0x318c4b=_0x3f4d13[_0xa508('0x55')];if(!_0x1a6041[_0xa508('0x4f')][_0xa508('0x56')]('nolimit')){_0x331934[_0xa508('0x32')]=qs['limit'](_0x1a6041[_0xa508('0x4f')][_0xa508('0x32')]);_0x331934[_0xa508('0x58')]=qs['offset'](_0x1a6041['query']['offset']);}return _0x4ac35e['getSmsInteractions'](_0x331934);}})[_0xa508('0x23')](function(_0x37008b){if(_0x37008b){return _0x37008b?{'count':_0x318c4b,'rows':_0x37008b}:null;}})[_0xa508('0x23')](respondWithResult(_0x2038b6,null))[_0xa508('0x2c')](handleError(_0x2038b6,null));};exports['getFaxInteractions']=function(_0x392a44,_0x4eaf6e,_0x216672){var _0xc7f716={};var _0x3243d8={};var _0x1c0430;var _0x2394c7;return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x392a44[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x4eaf6e,null))[_0xa508('0x23')](function(_0x3c8bbd){if(_0x3c8bbd){_0x1c0430=_0x3c8bbd;_0x3243d8['model']=_['keys'](db[_0xa508('0xda')][_0xa508('0x49')]);_0x3243d8[_0xa508('0x4f')]=_['keys'](_0x392a44[_0xa508('0x4f')]);_0x3243d8[_0xa508('0x51')]=_['intersection'](_0x3243d8['model'],_0x3243d8['query']);_0xc7f716['attributes']=_[_0xa508('0x53')](_0x3243d8[_0xa508('0x4c')],qs[_0xa508('0x54')](_0x392a44['query']['fields']));_0xc7f716['attributes']=_0xc7f716['attributes']['length']?_0xc7f716['attributes']:_0x3243d8['model'];_0xc7f716[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x392a44[_0xa508('0x4f')][_0xa508('0x5a')]);_0xc7f716['where']=qs[_0xa508('0x51')](_['pick'](_0x392a44[_0xa508('0x4f')],_0x3243d8['filters']));if(_0x392a44['query'][_0xa508('0x3e')]){_0xc7f716[_0xa508('0x5b')]=_[_0xa508('0x5d')](_0xc7f716[_0xa508('0x5b')],{'$or':_['map'](_0xc7f716['attributes'],function(_0x196d89){var _0x63bd64={};_0x63bd64[_0x196d89]={'$like':'%'+_0x392a44['query']['filter']+'%'};return _0x63bd64;})});}_0xc7f716=_[_0xa508('0x5d')]({},_0xc7f716,_0x392a44['options']);return _0x1c0430[_0xa508('0xdb')](_0xc7f716);}})[_0xa508('0x23')](function(_0x213d24){if(_0x213d24){_0x2394c7=_0x213d24[_0xa508('0x55')];if(!_0x392a44[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0xc7f716['limit']=qs[_0xa508('0x32')](_0x392a44[_0xa508('0x4f')][_0xa508('0x32')]);_0xc7f716[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x392a44[_0xa508('0x4f')][_0xa508('0x58')]);}return _0x1c0430[_0xa508('0xdb')](_0xc7f716);}})[_0xa508('0x23')](function(_0xb3e9dd){if(_0xb3e9dd){return _0xb3e9dd?{'count':_0x2394c7,'rows':_0xb3e9dd}:null;}})[_0xa508('0x23')](respondWithResult(_0x4eaf6e,null))[_0xa508('0x2c')](handleError(_0x4eaf6e,null));};exports['login']=function(_0x3906f2,_0x5b98f1,_0x191f54){var _0x12556a;var _0x49ab13;var _0x46da3d;var _0x464153=!_[_0xa508('0x73')](_0x3906f2[_0xa508('0x69')]['id'])?_0x3906f2[_0xa508('0x69')]['id']:!_[_0xa508('0x73')](_0x3906f2[_0xa508('0x3a')]['id'])?_0x3906f2[_0xa508('0x3a')]['id']:null;return db[_0xa508('0x48')][_0xa508('0x42')]({'where':{'id':_0x464153,'role':{'$or':['admin',_0xa508('0x3a'),'agent']}},'attributes':['id','name',_0xa508('0xdc'),_0xa508('0xdd'),'role','internal',_0xa508('0x9e')]})['then'](function(_0x57ab35){if(_0x57ab35){if(_0x57ab35[_0xa508('0x43')]===_0xa508('0x3c')){_0x12556a=_0x57ab35;if(_0x3906f2[_0xa508('0x68')][_0xa508('0xac')]){_0x46da3d=util[_0xa508('0xad')](_0xa508('0xde'),_0x12556a[_0x3906f2[_0xa508('0x68')][_0xa508('0xac')]]);}else if(_0x3906f2[_0xa508('0x68')][_0xa508('0xdf')]){_0x46da3d=util['format'](_0xa508('0xae'),_0x3906f2['body'][_0xa508('0xdf')]);}else{_0x46da3d=util[_0xa508('0xad')](_0xa508('0xae'),_0x12556a['name']);}socket['to'](util[_0xa508('0xad')]('user:%s',_0x12556a[_0xa508('0x44')]))[_0xa508('0xa6')]('user:forcelogout',{'ip':_0x3906f2[_0xa508('0xe0')][_0xa508('0xe1')]||_0x3906f2[_0xa508('0xe2')][_0xa508('0xe3')]||_0x3906f2['socket'][_0xa508('0xe3')]||_0x3906f2[_0xa508('0xe2')][_0xa508('0xe4')][_0xa508('0xe3')]});return db['UserVoiceQueueRt']['destroy']({'where':{'membername':_0x12556a[_0xa508('0x44')]},'individualHooks':!![]});}}else{throw new db[(_0xa508('0x1f'))]['ValidationError'](_0xa508('0xe5'));}})[_0xa508('0x23')](function(){if(_0x12556a){return _0x12556a[_0xa508('0xe6')]({'raw':!![]});}})[_0xa508('0x23')](function(_0x3ea1ea){if(_0x12556a){var _0x2e9927=[];if(_0x3ea1ea){_0x49ab13=_0x3ea1ea;if(_0x49ab13[_0xa508('0x55')]){for(var _0x391063=0x0;_0x391063<_0x49ab13[_0xa508('0x55')];_0x391063++){_0x2e9927[_0xa508('0xab')]({'membername':_0x12556a['name'],'UserId':_0x12556a['id'],'queue_name':_0x49ab13[_0x391063][_0xa508('0x44')],'VoiceQueueId':_0x49ab13[_0x391063]['id'],'interface':_0x46da3d,'paused':_0x12556a[_0xa508('0x9e')]||![],'penalty':_0x49ab13[_0x391063][_0xa508('0xe7')]||0x0});}return BPromise['each'](_0x2e9927,function(_0x4e6196){return db['UserVoiceQueueRt']['upsert'](_0x4e6196);});}}}})[_0xa508('0x23')](function(){if(_0x12556a){return db['MemberReport'][_0xa508('0x63')]({'where':{'membername':_0x12556a['name'],'exitAt':null}});}})[_0xa508('0x23')](function(_0x3a539a){if(_0x12556a){var _0x426448=[];_0x3a539a[_0xa508('0xe8')](function(_0x2981d9){_0x426448[_0xa508('0xab')](_0x2981d9['update']({'exitAt':moment()[_0xa508('0xad')](_0xa508('0xe9'))}));});return BPromise['all'](_0x426448);}})['then'](function(){if(_0x12556a){var _0x107acd=[];var _0x3bca39=[];var _0x32d570=utils[_0xa508('0xea')]();var _0x21433f={'membername':_0x12556a['name'],'interface':_0x46da3d,'enterAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'role':_0x12556a[_0xa508('0x43')],'internal':_0x12556a[_0xa508('0x7b')]};_0x32d570[_0xa508('0xe8')](function(_0x2d1626){_0x107acd[_0xa508('0xab')](_[_0xa508('0x5d')]({'channel':_0x2d1626,'type':_0xa508('0xeb'),'data1':_0x3906f2[_0xa508('0x68')]['device'],'data2':_0x46da3d},_0x21433f));if(_0x12556a[_0xa508('0x9e')]){_0x3bca39['push'](_[_0xa508('0x5d')]({'channel':_0x2d1626,'type':_0xa508('0xec'),'data1':_0xa508('0xed')},_0x21433f));}});return db['MemberReport']['bulkCreate'](_0x107acd['concat'](_0x3bca39),{'individualHooks':!![]});}})[_0xa508('0x23')](function(){if(_0x12556a){return _0x12556a['update']({'online':!![],'lastLoginAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'voicePause':_0x12556a['loginInPause']||![],'mailPause':_0x12556a[_0xa508('0x9e')]||![],'chatPause':_0x12556a[_0xa508('0x9e')]||![],'faxPause':_0x12556a[_0xa508('0x9e')]||![],'smsPause':_0x12556a[_0xa508('0x9e')]||![],'openchannelPause':_0x12556a[_0xa508('0x9e')]||![],'pauseType':_0x12556a[_0xa508('0x9e')]?_0xa508('0xed'):null,'interface':_0x46da3d,'lastPauseAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xa508('0x23')](function(_0x30272d){if(_0x3906f2[_0xa508('0xee')]){return _0x191f54();}else{return BPromise['resolve'](_0x30272d)['then'](respondWithResult(_0x5b98f1,null));}})[_0xa508('0x2c')](handleError(_0x5b98f1,null));};exports[_0xa508('0xef')]=function(_0x3ae8fd,_0x1cfb33,_0x3b0932){var _0x42d590;return db['User']['find']({'where':{'id':_0x3ae8fd[_0xa508('0x69')]['id'],'role':_0xa508('0x3c')},'attributes':['id',_0xa508('0x44'),'role']})[_0xa508('0x23')](handleEntityNotFound(_0x1cfb33,null))[_0xa508('0x23')](function(_0x445a12){if(_0x445a12){_0x42d590=_0x445a12;return db['UserVoiceQueueRt'][_0xa508('0x38')]({'where':{'membername':_0x42d590[_0xa508('0x44')]},'individualHooks':!![]});}})['then'](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x42d590[_0xa508('0x44')],'exitAt':null}});})[_0xa508('0x23')](function(_0x2e999b){var _0x113e3d=[];_0x2e999b[_0xa508('0xe8')](function(_0x3bb916){_0x113e3d[_0xa508('0xab')](_0x3bb916[_0xa508('0x37')]({'exitAt':moment()[_0xa508('0xad')](_0xa508('0xe9'))}));});return BPromise[_0xa508('0xf0')](_0x113e3d);})[_0xa508('0x23')](function(){return _0x42d590['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xa508('0x23')](respondWithResult(_0x1cfb33,null))[_0xa508('0x2c')](handleError(_0x1cfb33,null));};exports[_0xa508('0xf1')]=function(_0x15ba85,_0x534716,_0x5b63bb){var _0x47046f;return db[_0xa508('0xb0')][_0xa508('0x37')]({'paused':0x1},{'where':{'UserId':_0x15ba85[_0xa508('0x69')]['id']},'individualHooks':!![]})[_0xa508('0x23')](function(){return db[_0xa508('0x48')][_0xa508('0x42')]({'where':{'id':_0x15ba85[_0xa508('0x69')]['id'],'role':_0xa508('0x3c')},'attributes':['id',_0xa508('0x44'),_0xa508('0x43'),'internal','interface']});})[_0xa508('0x23')](handleEntityNotFound(_0x534716,null))[_0xa508('0x23')](function(_0x461778){if(_0x461778){_0x47046f=_0x461778;return respondWithRpcPromise(_0xa508('0xf2'),_0xa508('0xf1'),{'id':_0x47046f['id'],'name':_0x47046f[_0xa508('0x44')],'pause':!![]});}})[_0xa508('0x23')](function(){if(_0x47046f){return db[_0xa508('0xf3')]['findAll']({'where':{'membername':_0x47046f[_0xa508('0x44')],'type':_0xa508('0xec'),'exitAt':null}});}})[_0xa508('0x23')](function(_0x45b669){if(_0x45b669[_0xa508('0x55')]){var _0x18f4b9=moment()['format'](_0xa508('0xe9'));for(var _0x9a531d=0x0,_0x5ee170=_0x45b669[_0xa508('0x55')];_0x9a531d<_0x5ee170;_0x9a531d++){_0x45b669[_0x9a531d]['updateAttributes']({'exitAt':_0x18f4b9});}}})[_0xa508('0x23')](function(){var _0x56050d=[];var _0x366f36=utils[_0xa508('0xea')]();_0x366f36['forEach'](function(_0x204989){_0x56050d[_0xa508('0xab')]({'channel':_0x204989,'membername':_0x47046f[_0xa508('0x44')],'interface':_[_0xa508('0x73')](_0x47046f[_0xa508('0xac')])?util[_0xa508('0xad')]('SIP/%s',_0x47046f[_0xa508('0x44')]):_0x47046f[_0xa508('0xac')],'type':_0xa508('0xec'),'enterAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'data1':_0x15ba85['body'][_0xa508('0x4b')]||_0xa508('0xf4'),'role':_0x47046f[_0xa508('0x43')],'internal':_0x47046f[_0xa508('0x7b')]});});return db[_0xa508('0xf3')][_0xa508('0x67')](_0x56050d,{'individualHooks':!![]});})['then'](function(){return _0x47046f['update']({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x15ba85[_0xa508('0x68')][_0xa508('0x4b')]||_0xa508('0xf4'),'lastPauseAt':moment()[_0xa508('0xad')](_0xa508('0xe9'))});})[_0xa508('0x23')](respondWithResult(_0x534716,null))['catch'](handleError(_0x534716,null));};exports[_0xa508('0xf5')]=function(_0x258e73,_0x3638b2,_0x1e66cc){var _0x5d977e;return db[_0xa508('0x48')][_0xa508('0x42')]({'where':{'id':_0x258e73['params']['id']},'attributes':['id',_0xa508('0x44'),_0xa508('0x43'),'voicePause',_0xa508('0xf6'),_0xa508('0xf7'),_0xa508('0xf8'),_0xa508('0xf9'),_0xa508('0xfa'),'pauseType',_0xa508('0xfb')]})[_0xa508('0x23')](handleEntityNotFound(_0x3638b2,null))[_0xa508('0x23')](function(_0x30a6b4){if(_0x30a6b4){_0x5d977e=_0x30a6b4;if(_0x258e73['body'][_0xa508('0x9d')]&&!utils[_0xa508('0xb2')](_0x258e73[_0xa508('0x68')][_0xa508('0x9d')])){throw new db[(_0xa508('0x1f'))][(_0xa508('0x20'))](_0xa508('0xc7'));}switch(_0x258e73[_0xa508('0x68')][_0xa508('0x9d')]){case _0xa508('0xa8'):return respondWithRpcPromise(_0xa508('0xf2'),_0xa508('0xf5'),{'id':_0x5d977e['id'],'name':_0x5d977e[_0xa508('0x44')],'pause':![]})[_0xa508('0x23')](function(){return db[_0xa508('0xb0')][_0xa508('0x37')]({'paused':0x0},{'where':{'UserId':_0x5d977e['id']},'individualHooks':!![]});})[_0xa508('0x23')](function(){return db[_0xa508('0xf3')][_0xa508('0x42')]({'where':{'channel':_0x258e73[_0xa508('0x68')][_0xa508('0x9d')],'membername':_0x5d977e[_0xa508('0x44')],'type':_0xa508('0xec'),'exitAt':null}});})[_0xa508('0x23')](function(_0x391ad3){if(_0x391ad3){return _0x391ad3['update']({'exitAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'data2':'manual'},{'individualHooks':!![]});}return null;})[_0xa508('0x23')](function(){return _0x5d977e[_0xa508('0x37')]({'voicePause':![]});});case _0xa508('0xfc'):case _0xa508('0xfd'):case'fax':case'sms':case _0xa508('0xfe'):return db['MemberReport']['find']({'where':{'channel':_0x258e73['body']['channel'],'membername':_0x5d977e[_0xa508('0x44')],'type':_0xa508('0xec'),'exitAt':null}})[_0xa508('0x23')](function(_0x3bca7e){if(_0x3bca7e){return _0x3bca7e[_0xa508('0x37')]({'exitAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'data2':_0xa508('0xff')},{'individualHooks':!![]});}return null;})[_0xa508('0x23')](function(){var _0x4e6e65={};_[_0xa508('0x100')](_0x4e6e65,util[_0xa508('0xad')](_0xa508('0x101'),_0x258e73['body'][_0xa508('0x9d')],_0xa508('0x102')),![]);return _0x5d977e[_0xa508('0x37')](_0x4e6e65);});default:return respondWithRpcPromise(_0xa508('0xf2'),_0xa508('0xf5'),{'id':_0x5d977e['id'],'name':_0x5d977e[_0xa508('0x44')],'pause':![]})['then'](function(){return db[_0xa508('0xb0')]['update']({'paused':0x0},{'where':{'UserId':_0x5d977e['id']}});})[_0xa508('0x23')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x5d977e[_0xa508('0x44')],'type':_0xa508('0xec'),'exitAt':null}});})[_0xa508('0x23')](function(_0x81ae0f){var _0x5e6293=[];_0x81ae0f[_0xa508('0xe8')](function(_0x2ddf88){_0x5e6293['push'](_0x2ddf88[_0xa508('0x37')]({'exitAt':moment()[_0xa508('0xad')](_0xa508('0xe9')),'data2':_0xa508('0xff')}));});return BPromise['all'](_0x5e6293);})[_0xa508('0x23')](function(){return _0x5d977e['update']({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xa508('0x23')](respondWithResult(_0x3638b2,null))[_0xa508('0x2c')](handleError(_0x3638b2,null));};exports[_0xa508('0x103')]=function(_0x278394,_0x1bb67c,_0xd96b32){var _0x4cdd4e={};var _0x422537={};var _0x5d6fc8;var _0x2a515d;return db[_0xa508('0x48')]['findOne']({'where':{'id':_0x278394[_0xa508('0x69')]['id']}})[_0xa508('0x23')](handleEntityNotFound(_0x1bb67c,null))[_0xa508('0x23')](function(_0x46548a){if(_0x46548a){_0x5d6fc8=_0x46548a;_0x422537[_0xa508('0x4c')]=_['keys'](db[_0xa508('0x104')]['rawAttributes']);_0x422537[_0xa508('0x4f')]=_['keys'](_0x278394[_0xa508('0x4f')]);_0x422537[_0xa508('0x51')]=_[_0xa508('0x53')](_0x422537[_0xa508('0x4c')],_0x422537['query']);_0x4cdd4e[_0xa508('0x52')]=_[_0xa508('0x53')](_0x422537[_0xa508('0x4c')],qs['fields'](_0x278394['query'][_0xa508('0x54')]));_0x4cdd4e['attributes']=_0x4cdd4e['attributes'][_0xa508('0x55')]?_0x4cdd4e[_0xa508('0x52')]:_0x422537['model'];_0x4cdd4e['order']=qs[_0xa508('0x5a')](_0x278394[_0xa508('0x4f')][_0xa508('0x5a')]);_0x4cdd4e[_0xa508('0x5b')]=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x278394[_0xa508('0x4f')],_0x422537[_0xa508('0x51')]));if(_0x278394[_0xa508('0x4f')][_0xa508('0x3e')]){_0x4cdd4e[_0xa508('0x5b')]=_['merge'](_0x4cdd4e[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x4cdd4e['attributes'],function(_0xf41b09){var _0x370891={};_0x370891[_0xf41b09]={'$like':'%'+_0x278394[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x370891;})});}_0x4cdd4e=_[_0xa508('0x5d')]({},_0x4cdd4e,_0x278394[_0xa508('0x66')]);return _0x5d6fc8[_0xa508('0x103')](_0x4cdd4e);}})[_0xa508('0x23')](function(_0x4b5727){if(_0x4b5727){_0x2a515d=_0x4b5727[_0xa508('0x55')];if(!_0x278394['query']['hasOwnProperty'](_0xa508('0x57'))){_0x4cdd4e[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x278394[_0xa508('0x4f')][_0xa508('0x32')]);_0x4cdd4e[_0xa508('0x58')]=qs['offset'](_0x278394[_0xa508('0x4f')][_0xa508('0x58')]);}return _0x5d6fc8[_0xa508('0x103')](_0x4cdd4e);}})['then'](function(_0x122775){if(_0x122775){return _0x122775?{'count':_0x2a515d,'rows':_0x122775}:null;}})[_0xa508('0x23')](respondWithResult(_0x1bb67c,null))['catch'](handleError(_0x1bb67c,null));};exports[_0xa508('0x105')]=function(_0x4d0f2e,_0x4c00ad){return db[_0xa508('0x48')][_0xa508('0x42')]({'where':{'id':_0x4d0f2e[_0xa508('0x69')]['id']}})['then'](handleEntityNotFound(_0x4c00ad,null))[_0xa508('0x23')](function(_0x44acec){if(_0x44acec){var _0x225304=_0x44acec['get']({'plain':!![]});return _0x44acec[_0xa508('0x105')](_0x4d0f2e['body']['ids'],_[_0xa508('0x6c')](_0x4d0f2e['body'],['ids','id'])||{})[_0xa508('0x23')](function(){for(var _0x4ac85e=0x0;_0x4ac85e<_0x4d0f2e['body'][_0xa508('0x6d')][_0xa508('0x55')];_0x4ac85e++){var _0x3b42d7=[];db['Team'][_0xa508('0xbd')]({'where':{'id':_0x4d0f2e[_0xa508('0x68')][_0xa508('0x6d')][_0x4ac85e]}})[_0xa508('0x23')](function(_0x472930){_0x3b42d7[_0xa508('0xab')](_0x472930[_0xa508('0xe6')]()[_0xa508('0x23')](function(_0x5408a2){for(var _0x58aa13=0x0;_0x58aa13<_0x5408a2[_0xa508('0x55')];_0x58aa13++){_0x5408a2[_0x58aa13][_0xa508('0x106')](_0xa508('0x9d'),_0xa508('0x107'));}return _0x5408a2;}));_0x3b42d7[_0xa508('0xab')](_0x472930[_0xa508('0x108')]()['then'](function(_0x3771b7){for(var _0x229cb7=0x0;_0x229cb7<_0x3771b7[_0xa508('0x55')];_0x229cb7++){_0x3771b7[_0x229cb7]['setDataValue'](_0xa508('0x9d'),_0xa508('0x109'));}return _0x3771b7;}));_0x3b42d7[_0xa508('0xab')](_0x472930[_0xa508('0x10a')]()[_0xa508('0x23')](function(_0x48b6fa){for(var _0x4cee99=0x0;_0x4cee99<_0x48b6fa[_0xa508('0x55')];_0x4cee99++){_0x48b6fa[_0x4cee99][_0xa508('0x106')](_0xa508('0x9d'),_0xa508('0x10b'));}return _0x48b6fa;}));_0x3b42d7[_0xa508('0xab')](_0x472930['getSmsQueues']()[_0xa508('0x23')](function(_0x312c0a){for(var _0x16aaec=0x0;_0x16aaec<_0x312c0a[_0xa508('0x55')];_0x16aaec++){_0x312c0a[_0x16aaec][_0xa508('0x106')]('channel',_0xa508('0x10c'));}return _0x312c0a;}));_0x3b42d7[_0xa508('0xab')](_0x472930['getFaxQueues']()['then'](function(_0x39044b){for(var _0x21c21e=0x0;_0x21c21e<_0x39044b['length'];_0x21c21e++){_0x39044b[_0x21c21e][_0xa508('0x106')](_0xa508('0x9d'),'Fax');}return _0x39044b;}));_0x3b42d7[_0xa508('0xab')](_0x472930['getOpenchannelQueues']()[_0xa508('0x23')](function(_0x4ed93f){for(var _0xdc850e=0x0;_0xdc850e<_0x4ed93f[_0xa508('0x55')];_0xdc850e++){_0x4ed93f[_0xdc850e]['setDataValue']('channel',_0xa508('0x10d'));}return _0x4ed93f;}));return BPromise['all'](_0x3b42d7);})['then'](function(_0x43cbcd){var _0x3c6e4c=_['flatten'](_0x43cbcd);_0x3b42d7=[];return db['sequelize'][_0xa508('0x10e')](function(_0x55668a){for(var _0x3fde96=0x0;_0x3fde96<_0x3c6e4c[_0xa508('0x55')];_0x3fde96++){_0x3b42d7['push'](_0x3c6e4c[_0x3fde96][_0xa508('0x10f')](_0x225304['id']),{'transaction':_0x55668a});}return BPromise[_0xa508('0xf0')](_0x3b42d7)['then'](function(){if(_0x225304['online']){return BPromise[_0xa508('0xaf')](_['filter'](_0x3c6e4c,function(_0x3ea5d3){return _0x3ea5d3[_0xa508('0x110')](_0xa508('0x9d'))===_0xa508('0x107');}),function(_0x187524){return db[_0xa508('0xb0')]['upsert']({'membername':_0x225304['name'],'UserId':_0x225304['id'],'queue_name':_0x187524[_0xa508('0x44')],'VoiceQueueId':_0x187524['id'],'interface':_[_0xa508('0x73')](_0x225304[_0xa508('0xac')])?util[_0xa508('0xad')](_0xa508('0xae'),_0x225304['name']):_0x225304[_0xa508('0xac')],'paused':_0x225304[_0xa508('0x9f')]||![],'penalty':_0x225304['penalty']},{'transaction':_0x55668a});});}else{return;}})[_0xa508('0x23')](function(){for(var _0x50ea38=0x0;_0x50ea38<_0x3c6e4c[_0xa508('0x55')];_0x50ea38++){var _0x30ac7f=_0x3c6e4c[_0x50ea38]['getDataValue'](_0xa508('0x9d'));var _0x46edc8=_0x30ac7f+_0xa508('0xa5');socket[_0xa508('0xa6')](_0xa508('0x3a')+_0x30ac7f+_0xa508('0xa7'),{'UserId':_0x225304['id'],['queueField']:_0x3c6e4c[_0x50ea38]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x4c00ad,null))['catch'](handleError(_0x4c00ad,null));};exports[_0xa508('0x111')]=function(_0x4e5a15,_0x41ffc6){return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x4e5a15[_0xa508('0x69')]['id']}})['then'](handleEntityNotFound(_0x41ffc6,null))['then'](function(_0x4aaf51){if(_0x4aaf51){var _0x188025=_0x4aaf51[_0xa508('0x39')]({'plain':!![]});var _0x510353=_0x4e5a15[_0xa508('0x4f')]['ids'];return _0x4aaf51[_0xa508('0x111')](_0x510353)[_0xa508('0x23')](function(){for(var _0x568714=0x0;_0x568714<_0x510353[_0xa508('0x55')];_0x568714++){var _0x548a44=[];db[_0xa508('0x104')][_0xa508('0xbd')]({'where':{'id':_0x510353[_0x568714]}})[_0xa508('0x23')](function(_0x8ef0ab){_0x548a44['push'](_0x8ef0ab[_0xa508('0xe6')]()['then'](function(_0x3179f1){for(var _0x4b04a1=0x0;_0x4b04a1<_0x3179f1[_0xa508('0x55')];_0x4b04a1++){_0x3179f1[_0x4b04a1][_0xa508('0x106')](_0xa508('0x9d'),'Voice');}return _0x3179f1;}));_0x548a44[_0xa508('0xab')](_0x8ef0ab[_0xa508('0x108')]()[_0xa508('0x23')](function(_0x4e46d8){for(var _0x28906e=0x0;_0x28906e<_0x4e46d8['length'];_0x28906e++){_0x4e46d8[_0x28906e][_0xa508('0x106')](_0xa508('0x9d'),_0xa508('0x109'));}return _0x4e46d8;}));_0x548a44[_0xa508('0xab')](_0x8ef0ab[_0xa508('0x10a')]()[_0xa508('0x23')](function(_0x588246){for(var _0xfe22a7=0x0;_0xfe22a7<_0x588246[_0xa508('0x55')];_0xfe22a7++){_0x588246[_0xfe22a7][_0xa508('0x106')]('channel',_0xa508('0x10b'));}return _0x588246;}));_0x548a44[_0xa508('0xab')](_0x8ef0ab[_0xa508('0x112')]()[_0xa508('0x23')](function(_0x74ba8){for(var _0xca2681=0x0;_0xca2681<_0x74ba8['length'];_0xca2681++){_0x74ba8[_0xca2681][_0xa508('0x106')]('channel',_0xa508('0x10c'));}return _0x74ba8;}));_0x548a44[_0xa508('0xab')](_0x8ef0ab[_0xa508('0x113')]()[_0xa508('0x23')](function(_0x2590d4){for(var _0x33ed22=0x0;_0x33ed22<_0x2590d4['length'];_0x33ed22++){_0x2590d4[_0x33ed22][_0xa508('0x106')]('channel',_0xa508('0x114'));}return _0x2590d4;}));_0x548a44[_0xa508('0xab')](_0x8ef0ab['getOpenchannelQueues']()['then'](function(_0x85ec99){for(var _0x12ea55=0x0;_0x12ea55<_0x85ec99[_0xa508('0x55')];_0x12ea55++){_0x85ec99[_0x12ea55][_0xa508('0x106')]('channel',_0xa508('0x10d'));}return _0x85ec99;}));return BPromise[_0xa508('0xf0')](_0x548a44);})[_0xa508('0x23')](function(_0x5599ad){var _0x42fee0=_[_0xa508('0x115')](_0x5599ad);_0x548a44=[];return db['sequelize']['transaction'](function(_0x232021){for(var _0x3a815c=0x0;_0x3a815c<_0x42fee0['length'];_0x3a815c++){_0x548a44[_0xa508('0xab')](_0x42fee0[_0x3a815c][_0xa508('0x116')](_0x188025['id']),{'transaction':_0x232021});}return BPromise[_0xa508('0xf0')](_0x548a44)[_0xa508('0x23')](function(){if(_0x188025[_0xa508('0xaa')]){return BPromise[_0xa508('0xaf')](_[_0xa508('0x3e')](_0x42fee0,function(_0x1f01b8){return _0x1f01b8[_0xa508('0x110')]('channel')==='Voice';}),function(_0x3da1e1){return db[_0xa508('0xb0')][_0xa508('0x38')]({'where':{'VoiceQueueId':_0x3da1e1['id'],'UserId':_0x188025['id']},'transaction':_0x232021});});}else{return;}})[_0xa508('0x23')](function(){for(var _0x17ac16=0x0;_0x17ac16<_0x42fee0[_0xa508('0x55')];_0x17ac16++){var _0xb7356a=_0x42fee0[_0x17ac16]['getDataValue'](_0xa508('0x9d'));var _0x2866d5=_0xb7356a+'QueueId';socket['emit'](_0xa508('0x3a')+_0xb7356a+_0xa508('0xb4'),{'UserId':_0x188025['id'],['queueField']:_0x42fee0[_0x17ac16]['id']});}});});});}});}})[_0xa508('0x23')](respondWithStatusCode(_0x41ffc6,null))['catch'](handleError(_0x41ffc6,null));};exports['getLists']=function(_0x4c5f08,_0x590db6,_0xae547d){var _0x58d228={};var _0xa98bd5={};var _0x2a89cd;var _0x3d3376;return db[_0xa508('0x48')][_0xa508('0xbd')]({'where':{'id':_0x4c5f08[_0xa508('0x69')]['id']}})['then'](handleEntityNotFound(_0x590db6,null))[_0xa508('0x23')](function(_0x3ea17b){if(_0x3ea17b){_0x2a89cd=_0x3ea17b;_0xa98bd5[_0xa508('0x4c')]=_[_0xa508('0x50')](db['CmList']['rawAttributes']);_0xa98bd5['query']=_['keys'](_0x4c5f08[_0xa508('0x4f')]);_0xa98bd5['filters']=_['intersection'](_0xa98bd5[_0xa508('0x4c')],_0xa98bd5[_0xa508('0x4f')]);_0x58d228[_0xa508('0x52')]=_[_0xa508('0x53')](_0xa98bd5[_0xa508('0x4c')],qs[_0xa508('0x54')](_0x4c5f08[_0xa508('0x4f')][_0xa508('0x54')]));_0x58d228[_0xa508('0x52')]=_0x58d228[_0xa508('0x52')][_0xa508('0x55')]?_0x58d228['attributes']:_0xa98bd5['model'];_0x58d228[_0xa508('0x59')]=qs[_0xa508('0x5a')](_0x4c5f08[_0xa508('0x4f')]['sort']);_0x58d228['where']=qs[_0xa508('0x51')](_[_0xa508('0x5c')](_0x4c5f08[_0xa508('0x4f')],_0xa98bd5[_0xa508('0x51')]));if(_0x4c5f08[_0xa508('0x4f')]['filter']){_0x58d228['where']=_[_0xa508('0x5d')](_0x58d228[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x58d228[_0xa508('0x52')],function(_0x2ec5b0){var _0x30131a={};_0x30131a[_0x2ec5b0]={'$like':'%'+_0x4c5f08[_0xa508('0x4f')]['filter']+'%'};return _0x30131a;})});}_0x58d228=_['merge']({},_0x58d228,_0x4c5f08[_0xa508('0x66')]);return _0x2a89cd[_0xa508('0x117')](_0x58d228);}})[_0xa508('0x23')](function(_0x110a20){if(_0x110a20){_0x3d3376=_0x110a20[_0xa508('0x55')];if(!_0x4c5f08[_0xa508('0x4f')][_0xa508('0x56')](_0xa508('0x57'))){_0x58d228[_0xa508('0x32')]=qs[_0xa508('0x32')](_0x4c5f08['query'][_0xa508('0x32')]);_0x58d228[_0xa508('0x58')]=qs[_0xa508('0x58')](_0x4c5f08['query'][_0xa508('0x58')]);}return _0x2a89cd[_0xa508('0x117')](_0x58d228);}})[_0xa508('0x23')](function(_0x454d09){if(_0x454d09){return _0x454d09?{'count':_0x3d3376,'rows':_0x454d09}:null;}})[_0xa508('0x23')](respondWithResult(_0x590db6,null))[_0xa508('0x2c')](handleError(_0x590db6,null));};exports[_0xa508('0x118')]=function(_0x2f8d25,_0x2604f8,_0x1af1aa){var _0x2254c5={};var _0x4184cd={};var _0x3cf36d;var _0x3c445f;return db['User'][_0xa508('0xbd')]({'where':{'id':_0x2f8d25[_0xa508('0x69')]['id']}})['then'](handleEntityNotFound(_0x2604f8,null))['then'](function(_0x426462){if(_0x426462){_0x3cf36d=_0x426462;_0x4184cd[_0xa508('0x4c')]=_[_0xa508('0x50')](db[_0xa508('0x48')][_0xa508('0x49')]);_0x4184cd[_0xa508('0x4f')]=_['keys'](_0x2f8d25[_0xa508('0x4f')]);_0x4184cd[_0xa508('0x51')]=_['intersection'](_0x4184cd[_0xa508('0x4c')],_0x4184cd[_0xa508('0x4f')]);_0x2254c5[_0xa508('0x52')]=_[_0xa508('0x53')](_0x4184cd[_0xa508('0x4c')],qs['fields'](_0x2f8d25[_0xa508('0x4f')]['fields']));_0x2254c5[_0xa508('0x52')]=_0x2254c5[_0xa508('0x52')][_0xa508('0x55')]?_0x2254c5[_0xa508('0x52')]:_0x4184cd[_0xa508('0x4c')];_0x2254c5[_0xa508('0x59')]=qs['sort'](_0x2f8d25[_0xa508('0x4f')][_0xa508('0x5a')]);_0x2254c5['where']=qs[_0xa508('0x51')](_['pick'](_0x2f8d25[_0xa508('0x4f')],_0x4184cd[_0xa508('0x51')]));if(_0x2f8d25[_0xa508('0x4f')][_0xa508('0x3e')]){_0x2254c5['where']=_[_0xa508('0x5d')](_0x2254c5[_0xa508('0x5b')],{'$or':_[_0xa508('0x47')](_0x2254c5[_0xa508('0x52')],function(_0x35dc8b){var _0x164005={};_0x164005[_0x35dc8b]={'$like':'%'+_0x2f8d25[_0xa508('0x4f')][_0xa508('0x3e')]+'%'};return _0x164005;})});}_0x2254c5[_0xa508('0x4c')]=db[_0xa508('0x48')];_0x2254c5['as']='Agents';_0x2254c5=_[_0xa508('0x5d')]({},_0x2254c5,_0x2f8d25[_0xa508('0x66')]);return _0x3cf36d['getVoiceQueues']({'include':[_0x2254c5]});}})[_0xa508('0x23')](function(_0x3119f0){if(_0x3119f0){var _0x4b5973={},_0x5efa4a=[],_0x98ca45=0x0;for(var _0x172aa1=0x0;_0x172aa1<_0x3119f0['length'];_0x172aa1+=0x1){for(var _0x472efe=0x0,_0x41c809;_0x472efe<_0x3119f0[_0x172aa1][_0xa508('0x3b')][_0xa508('0x55')];_0x472efe+=0x1){_0x41c809=_0x3119f0[_0x172aa1][_0xa508('0x3b')][_0x472efe][_0xa508('0x39')]({'plain':!![]});_0x4b5973[_0x41c809['id']]=_0x41c809;}}_0x4b5973=_[_0xa508('0x119')](_0x4b5973);for(var _0x3d2336=qs[_0xa508('0x58')](_0x2f8d25[_0xa508('0x4f')]['offset']);_0x3d2336<_0x4b5973[_0xa508('0x55')]&&_0x5efa4a[_0xa508('0x55')]=_0x49aeab){_0x2ce1eb=_0x49aeab;_0x107c08=0xc8;}else{_0x107c08=0xce;}_0x52f1c9[_0xdbbd('0x29')](_0x107c08);return _0x52f1c9[_0xdbbd('0x2f')](_0xdbbd('0x30'),_0x24da65+'-'+_0x2ce1eb+'/'+_0x49aeab)['json'](_0x1337bf);}return null;};}function patchUpdates(_0x35e87a){return function(_0x3c5d79){try{jsonpatch[_0xdbbd('0x31')](_0x3c5d79,_0x35e87a,!![]);}catch(_0x226bb){return BPromise[_0xdbbd('0x32')](_0x226bb);}return _0x3c5d79['save']();};}function saveUpdates(_0x252eb4,_0x420db4){return function(_0x14189a){if(_0x14189a){return _0x14189a[_0xdbbd('0x33')](_0x252eb4)[_0xdbbd('0x34')](function(_0x5460e7){return _0x5460e7;});}return null;};}function removeEntity(_0x479b91,_0x35120f){return function(_0x189c8b){if(_0x189c8b){return _0x189c8b[_0xdbbd('0x35')]()[_0xdbbd('0x34')](function(){var _0x57aa55=_0x189c8b[_0xdbbd('0x36')]({'plain':!![]});var _0x5e26bc=[{'name':_0xdbbd('0x37'),'value':_0xdbbd('0x38'),'ignore':!![]},{'name':'Agents','value':_0xdbbd('0x39'),'ignore':![]},{'name':_0xdbbd('0x3a'),'value':_0xdbbd('0x3b'),'ignore':![]}];var _0x82b1d7=_(_0x5e26bc)['filter']('ignore')[_0xdbbd('0x3c')](_0xdbbd('0x3d'))[_0xdbbd('0x3d')]();if(_[_0xdbbd('0x3e')](_0x82b1d7,_0x57aa55[_0xdbbd('0x3f')])){return;}var _0x40e247=_['find'](_0x5e26bc,['value',_0x57aa55[_0xdbbd('0x3f')]])[_0xdbbd('0x40')];return db['UserProfileResource'][_0xdbbd('0x35')]({'where':{'type':_0x40e247,'resourceId':_0x57aa55['id']}})[_0xdbbd('0x34')](function(){return _0x189c8b;});})['then'](function(){_0x479b91[_0xdbbd('0x29')](0xcc)[_0xdbbd('0x2a')]();});}};}function handleEntityNotFound(_0xbf3b81,_0x573568){return function(_0x10cd3f){if(!_0x10cd3f){_0xbf3b81[_0xdbbd('0x28')](0x194);}return _0x10cd3f;};}function handleError(_0x53da26,_0x52c574){_0x52c574=_0x52c574||0x1f4;return function(_0xc61d6f){logger[_0xdbbd('0x23')](_0xc61d6f[_0xdbbd('0x41')]);if(_0xc61d6f[_0xdbbd('0x40')]){delete _0xc61d6f[_0xdbbd('0x40')];}_0x53da26[_0xdbbd('0x29')](_0x52c574)[_0xdbbd('0x42')](_0xc61d6f);};}exports[_0xdbbd('0x43')]=function(_0xceeac3,_0x373788){var _0x3122f4={},_0x1bf934={},_0x1f26b9={'count':0x0,'rows':[]};var _0xa42562=_[_0xdbbd('0x3c')](db[_0xdbbd('0x44')][_0xdbbd('0x45')],function(_0x4c93e0){return{'name':_0x4c93e0[_0xdbbd('0x46')],'type':_0x4c93e0['type'][_0xdbbd('0x47')]};});_0x1bf934['model']=_[_0xdbbd('0x48')](_['map'](_0xa42562,_0xdbbd('0x40')),[_0xdbbd('0x49'),'salt']);_0x1bf934[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0xceeac3[_0xdbbd('0x4a')]);_0x1bf934['filters']=_[_0xdbbd('0x4c')](_0x1bf934[_0xdbbd('0x4d')],_0x1bf934[_0xdbbd('0x4a')]);_0x3122f4['attributes']=_['intersection'](_0x1bf934[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0xceeac3[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x3122f4[_0xdbbd('0x4f')]=_0x3122f4[_0xdbbd('0x4f')]['length']?_0x3122f4[_0xdbbd('0x4f')]:_0x1bf934[_0xdbbd('0x4d')];if(!_0xceeac3[_0xdbbd('0x4a')][_0xdbbd('0x50')]('nolimit')){_0x3122f4[_0xdbbd('0x2e')]=qs['limit'](_0xceeac3[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x3122f4['offset']=qs[_0xdbbd('0x2d')](_0xceeac3[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}_0x3122f4[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0xceeac3['query'][_0xdbbd('0x52')]);_0x3122f4[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_['pick'](_0xceeac3[_0xdbbd('0x4a')],_0x1bf934[_0xdbbd('0x54')]));if(_0xceeac3[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x3122f4[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x3122f4[_0xdbbd('0x53')],{'$or':_['map'](_0xa42562,function(_0x37191c){if(_0x37191c[_0xdbbd('0x57')]!==_0xdbbd('0x58')){return db[_0xdbbd('0x59')]['where'](db['sequelize']['fn'](_0xdbbd('0x5a'),db['sequelize']['col'](_0x37191c['name'])),{'$like':db['sequelize']['fn'](_0xdbbd('0x5a'),'%'+_0xceeac3['query'][_0xdbbd('0x55')]+'%')});}})});}_0x3122f4=_[_0xdbbd('0x56')]({},_0x3122f4,_0xceeac3[_0xdbbd('0x5b')]);var _0x235c6a={'where':_0x3122f4[_0xdbbd('0x53')]};return db[_0xdbbd('0x44')]['count'](_0x235c6a)[_0xdbbd('0x34')](function(_0x17a0e8){_0x1f26b9[_0xdbbd('0x2c')]=_0x17a0e8;if(_0xceeac3[_0xdbbd('0x4a')]['includeAll']){_0x3122f4[_0xdbbd('0x5c')]=[{'all':!![]}];}return db[_0xdbbd('0x44')][_0xdbbd('0x5d')](_0x3122f4);})[_0xdbbd('0x34')](function(_0x4bd45e){_0x1f26b9[_0xdbbd('0x5e')]=_0x4bd45e;return _0x1f26b9;})['then'](respondWithFilteredResult(_0x373788,_0x3122f4))[_0xdbbd('0x27')](handleError(_0x373788,null));};exports[_0xdbbd('0x5f')]=function(_0x580ec9,_0x62526){var _0x47ce0b={'raw':![],'where':{'id':_0x580ec9[_0xdbbd('0x60')]['id']}},_0x3c30db={};_0x3c30db[_0xdbbd('0x4d')]=_['differenceBy'](_[_0xdbbd('0x4b')](db[_0xdbbd('0x44')][_0xdbbd('0x45')]),['password',_0xdbbd('0x61')]);_0x3c30db[_0xdbbd('0x4a')]=_['keys'](_0x580ec9[_0xdbbd('0x4a')]);_0x3c30db['filters']=_[_0xdbbd('0x4c')](_0x3c30db[_0xdbbd('0x4d')],_0x3c30db[_0xdbbd('0x4a')]);_0x47ce0b[_0xdbbd('0x4f')]=_['intersection'](_0x3c30db[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x580ec9['query'][_0xdbbd('0x4e')]));_0x47ce0b[_0xdbbd('0x4f')]=_0x47ce0b[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x47ce0b[_0xdbbd('0x4f')]:_0x3c30db[_0xdbbd('0x4d')];if(_0x580ec9['query'][_0xdbbd('0x63')]){_0x47ce0b[_0xdbbd('0x5c')]=[{'all':!![]}];}_0x47ce0b=_['merge']({},_0x47ce0b,_0x580ec9[_0xdbbd('0x5b')]);return db[_0xdbbd('0x44')]['find'](_0x47ce0b)['then'](handleEntityNotFound(_0x62526,null))['then'](respondWithResult(_0x62526,null))[_0xdbbd('0x27')](handleError(_0x62526,null));};exports[_0xdbbd('0x64')]=function(_0xc87709,_0x252949){return db['User'][_0xdbbd('0x64')](_0xc87709[_0xdbbd('0x65')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x252949,0xc9))[_0xdbbd('0x27')](handleError(_0x252949,null));};exports[_0xdbbd('0x33')]=function(_0xa594f1,_0x14f5fe){if(_0xa594f1[_0xdbbd('0x65')]['id']){delete _0xa594f1[_0xdbbd('0x65')]['id'];}delete _0xa594f1[_0xdbbd('0x65')][_0xdbbd('0x3f')];return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0xa594f1[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x14f5fe,null))['then'](saveUpdates(_0xa594f1['body'],null))[_0xdbbd('0x34')](respondWithResult(_0x14f5fe,null))[_0xdbbd('0x27')](handleError(_0x14f5fe,null));};exports[_0xdbbd('0x67')]=function(_0x2efe76,_0x32f75d){return db[_0xdbbd('0x44')]['describe']()[_0xdbbd('0x34')](respondWithResult(_0x32f75d,null))[_0xdbbd('0x27')](handleError(_0x32f75d,null));};exports[_0xdbbd('0x68')]=function(_0x167bb2,_0x4457ae,_0x5cfeac){return db['User'][_0xdbbd('0x66')]({'where':{'id':_0x167bb2[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x4457ae,null))[_0xdbbd('0x34')](function(_0x1bcad2){if(_0x1bcad2){return _0x1bcad2[_0xdbbd('0x68')](_0x167bb2[_0xdbbd('0x65')][_0xdbbd('0x69')],_[_0xdbbd('0x6a')](_0x167bb2['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x4457ae,null))[_0xdbbd('0x27')](handleError(_0x4457ae,null));};var getLicense=function(_0x9dd1de){return new BPromise(function(_0x5605fc,_0x348744){var _0x3a2d6a=0x0;_0x9dd1de['body']['role']===_0xdbbd('0x39')&&_0x5605fc('agent\x20role');return db[_0xdbbd('0x44')]['count']({'where':{'$or':[{'role':_0x9dd1de['body'][_0xdbbd('0x3f')]==='telephone'?_0xdbbd('0x3b'):[_0xdbbd('0x6b'),'user']}]}})['then'](function(_0x519143){_0x3a2d6a=_0x519143;return require(_0xdbbd('0x6c'))[_0xdbbd('0x6d')]();})[_0xdbbd('0x34')](function(_0x4f7635){var _0x4e6074=_0x9dd1de[_0xdbbd('0x65')][_0xdbbd('0x3f')]===_0xdbbd('0x3b')?_0xdbbd('0x6e'):_0xdbbd('0x6f');if(!_[_0xdbbd('0x70')](_0x4f7635[_0x4e6074])&&_0x3a2d6a>=_0x4f7635[_0x4e6074]){return _0x348744({'message':_0xdbbd('0x71')});}return _0x5605fc(util[_0xdbbd('0x72')](_0xdbbd('0x73'),_0x4e6074,_0x3a2d6a));})[_0xdbbd('0x27')](function(_0x170452){return _0x348744(_0x170452);});});};exports[_0xdbbd('0x74')]=function(_0x5e469d,_0x391cad){return getLicense(_0x5e469d)[_0xdbbd('0x34')](function(_0x5c3854){if(!_0x5e469d['body'][_0xdbbd('0x75')]){var _0x474868;return db[_0xdbbd('0x76')][_0xdbbd('0x77')](0x1)['then'](function(_0x4fc613){return checkPasswordPattern(_0x4fc613,_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x49')],_0x4fc613[_0xdbbd('0x78')]);})['then'](function(_0x2e69c3){_0x474868=_0x2e69c3[_0xdbbd('0x79')];return db['User'][_0xdbbd('0x7a')](_0xdbbd('0x75'));})[_0xdbbd('0x34')](function(_0x4fa9c2){if(_['isNil'](_0x4fa9c2)){if(_0x474868){_0x5e469d['body'][_0xdbbd('0x75')]=_0x474868;}else{_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')]=0x1;}}else{if(_[_0xdbbd('0x70')](_0x474868)||_0x474868==_0x4fa9c2){_0x5e469d['body'][_0xdbbd('0x75')]=_0x4fa9c2+0x1;}else if(_0x474868>_0x4fa9c2){_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')]=_0x474868;}else{return db[_0xdbbd('0x59')][_0xdbbd('0x4a')]('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[_0xdbbd('0x59')][_0xdbbd('0x7b')][_0xdbbd('0x7c')]})['then'](function(_0x4b356f){if(_0x4b356f&&_0x4b356f[_0xdbbd('0x62')]){for(var _0x526df6=0x0,_0x14eebf=_0x4b356f[_0xdbbd('0x62')];_0x526df6<_0x14eebf&&_[_0xdbbd('0x70')](_0x5e469d[_0xdbbd('0x65')]['internal']);_0x526df6++){if(_0x474868<=_0x4b356f[_0x526df6][_0xdbbd('0x7d')]){_0x5e469d['body'][_0xdbbd('0x75')]=_0x4b356f[_0x526df6][_0xdbbd('0x7d')];}else if(_0x474868>_0x4b356f[_0x526df6][_0xdbbd('0x7d')]&&_0x474868<=_0x4b356f[_0x526df6]['to']){_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')]=_0x474868;}}}if(_['isNil'](_0x5e469d['body']['internal'])){_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')]=_0x4fa9c2+0x1;}});}}});}})[_0xdbbd('0x34')](function(){if(_0x5e469d[_0xdbbd('0x65')]['voicemail']){_0x5e469d['body'][_0xdbbd('0x7e')]=_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')];_0x5e469d['body']['VoiceMail']={'mailbox':_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x75')],'password':_0x5e469d['body']['password'],'fullname':_0x5e469d[_0xdbbd('0x65')]['fullname'],'email':_0x5e469d['body'][_0xdbbd('0x7f')]};}if(_0x5e469d[_0xdbbd('0x65')]&&_0x5e469d[_0xdbbd('0x65')]['role']===_0xdbbd('0x39')){_0x5e469d['body'][_0xdbbd('0x80')]=[_0xdbbd('0x81'),_0xdbbd('0x82'),_0xdbbd('0x83'),'110',_0xdbbd('0x84'),'105',_0xdbbd('0x85'),'107',_0xdbbd('0x86'),_0xdbbd('0x87'),_0xdbbd('0x88'),_0xdbbd('0x89')];}return db[_0xdbbd('0x44')]['create'](_0x5e469d[_0xdbbd('0x65')],{'include':[{'model':db['VoiceMail'],'as':_0xdbbd('0x8a')}]});})[_0xdbbd('0x34')](function(_0x1728e9){if(_0x5e469d[_0xdbbd('0x65')][_0xdbbd('0x3f')]===_0xdbbd('0x38'))return _0x1728e9;var _0x158c91=_0x5e469d[_0xdbbd('0x38')][_0xdbbd('0x36')]({'plain':!![]});if(!_0x158c91)throw new Error(_0xdbbd('0x8b'));if(_0x158c91[_0xdbbd('0x3f')]===_0xdbbd('0x38')){var _0x129c91=_0x1728e9['get']({'plain':!![]});var _0x152a1f=[{'name':'Agents','value':_0xdbbd('0x39')},{'name':_0xdbbd('0x3a'),'value':_0xdbbd('0x3b')}];var _0x3e6591=_[_0xdbbd('0x66')](_0x152a1f,[_0xdbbd('0x3d'),_0x129c91[_0xdbbd('0x3f')]])[_0xdbbd('0x40')];return db[_0xdbbd('0x8c')]['find']({'where':{'name':_0x3e6591,'userProfileId':_0x158c91[_0xdbbd('0x8d')]},'raw':!![]})[_0xdbbd('0x34')](function(_0x17f25e){if(_0x17f25e&&_0x17f25e[_0xdbbd('0x8e')]===0x0){return db[_0xdbbd('0x8f')][_0xdbbd('0x74')]({'name':_0x129c91['name'],'resourceId':_0x129c91['id'],'type':_0x17f25e[_0xdbbd('0x40')],'sectionId':_0x17f25e['id']},{})[_0xdbbd('0x34')](function(){return _0x1728e9;});}else{return _0x1728e9;}})[_0xdbbd('0x27')](function(_0x542f96){logger[_0xdbbd('0x23')](_0xdbbd('0x90'),_0x542f96);throw _0x542f96;});}return _0x1728e9;})[_0xdbbd('0x34')](respondWithResult(_0x391cad,0xc9))['catch'](handleError(_0x391cad,null));};exports[_0xdbbd('0x91')]=function(_0x128e0e,_0x50b7a9,_0x2c95af){var _0x2265e0=![];if(_0x128e0e[_0xdbbd('0x65')]['id']){delete _0x128e0e[_0xdbbd('0x65')]['id'];}return db['Setting']['findOne']({'attributes':['id',_0xdbbd('0x78')]})[_0xdbbd('0x34')](function(_0x3bec26){_0x2265e0=_0x3bec26[_0xdbbd('0x78')];return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0x128e0e[_0xdbbd('0x60')]['id']}});})['then'](function(_0x293ed7){if(_0x293ed7){if(_0x293ed7['id']==_0x128e0e[_0xdbbd('0x38')]['id']){if(!_0x128e0e[_0xdbbd('0x65')][_0xdbbd('0x92')]||!_0x128e0e['body'][_0xdbbd('0x93')]){throw new db['Sequelize'][(_0xdbbd('0x1c'))](_0xdbbd('0x94'));}if(!_0x293ed7[_0xdbbd('0x95')](_0x128e0e['body']['oldPassword'])){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0x97'));}if(_0x128e0e[_0xdbbd('0x65')]['oldPassword']==_0x128e0e['body'][_0xdbbd('0x93')]){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0x98'));}return _0x293ed7;}else if(_0x128e0e['user']['role']=='admin'){if(!_0x128e0e['body'][_0xdbbd('0x93')]){throw new db['Sequelize'][(_0xdbbd('0x1c'))](_0xdbbd('0x99'));}return _0x293ed7;}else if(_0x128e0e['user'][_0xdbbd('0x3f')]=='user'){if(!_0x128e0e[_0xdbbd('0x65')]['newPassword']){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0x99'));}if(_0x293ed7['role']!='agent'){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))]('Unauthorized');}return _0x293ed7;}else{throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0x9a'));}}return null;})[_0xdbbd('0x34')](handleEntityNotFound(_0x50b7a9,null))[_0xdbbd('0x34')](function(_0x4813ce){return checkPasswordPattern(_0x4813ce,_0x128e0e[_0xdbbd('0x65')]['newPassword'],_0x2265e0);})[_0xdbbd('0x34')](saveUpdates({'password':_0x128e0e[_0xdbbd('0x65')][_0xdbbd('0x93')],'passwordResetAt':_0x128e0e[_0xdbbd('0x38')]['id']==_0x128e0e[_0xdbbd('0x60')]['id']?moment():null},null))['then'](respondWithResult(_0x50b7a9,null))[_0xdbbd('0x27')](handleError(_0x50b7a9,null));};exports[_0xdbbd('0x9b')]=function(_0x2a5ffb,_0x1aeb1c,_0x17cb1f){var _0x1c1820=_0x2a5ffb[_0xdbbd('0x65')][_0xdbbd('0x9c')];return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0x2a5ffb['params']['id']},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0x3f'),_0xdbbd('0x9d'),_0xdbbd('0x9e'),_0xdbbd('0x9f'),_0xdbbd('0xa0')]})[_0xdbbd('0x34')](handleEntityNotFound(_0x1aeb1c,null))[_0xdbbd('0x34')](function(_0x20a81a){if(_0x20a81a){if(!utils[_0xdbbd('0xa1')](_0x1c1820)){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0xa2'));}return _0x20a81a['add'+_[_0xdbbd('0xa3')](_0x1c1820[_0xdbbd('0xa4')]())+_0xdbbd('0xa5')](_0x2a5ffb['body'][_0xdbbd('0x69')],{'penalty':_0x2a5ffb[_0xdbbd('0x65')][_0xdbbd('0xa6')]||0x0})[_0xdbbd('0xa7')](function(_0xd3d319){for(var _0x41252e=0x0;_0x41252e<_0x2a5ffb[_0xdbbd('0x65')][_0xdbbd('0x69')]['length'];_0x41252e+=0x1){var _0x394db7={'UserId':_0x2a5ffb['params']['id']};_0x394db7[_[_0xdbbd('0xa3')](_0x1c1820['toLowerCase']())+'QueueId']=_0x2a5ffb['body'][_0xdbbd('0x69')][_0x41252e];socket[_0xdbbd('0xa8')]('user'+_[_0xdbbd('0xa3')](_0x1c1820[_0xdbbd('0xa4')]())+'Queue:save',_0x394db7);}return _0xd3d319;})['then'](function(){if(_0x1c1820===_0xdbbd('0xa9')){return db[_0xdbbd('0xaa')][_0xdbbd('0x5d')]({'where':{'id':_0x2a5ffb[_0xdbbd('0x65')]['ids']||[]},'raw':!![],'attributes':['id',_0xdbbd('0x40')]});}})[_0xdbbd('0x34')](function(_0x505d7f){var _0x341326=_0x20a81a[_0xdbbd('0x36')]({'plain':!![]});var _0x429276=[];if(_0x1c1820===_0xdbbd('0xa9')&&_0x341326['role']==='agent'&&_0x341326[_0xdbbd('0x9d')]){for(var _0x56c699=0x0;_0x56c699<_0x505d7f[_0xdbbd('0x62')];_0x56c699+=0x1){_0x429276[_0xdbbd('0xab')]({'membername':_0x341326['name'],'UserId':_0x341326['id'],'queue_name':_0x505d7f[_0x56c699][_0xdbbd('0x40')],'VoiceQueueId':_0x505d7f[_0x56c699]['id'],'interface':_[_0xdbbd('0x70')](_0x341326['interface'])?util['format'](_0xdbbd('0xac'),_0x341326[_0xdbbd('0x40')]):_0x341326[_0xdbbd('0xa0')],'paused':_0x341326['voicePause']||![],'penalty':_0x2a5ffb[_0xdbbd('0x65')][_0xdbbd('0xa6')]||0x0});}return BPromise[_0xdbbd('0xad')](_0x429276,function(_0x499a48){return db[_0xdbbd('0xae')][_0xdbbd('0xaf')](_0x499a48);});}return _0x20a81a;});}})[_0xdbbd('0x34')](respondWithStatusCode(_0x1aeb1c,null))[_0xdbbd('0x27')](handleError(_0x1aeb1c,null));};exports[_0xdbbd('0xb0')]=function(_0x5a061a,_0x2448da,_0x1de27c){var _0x31a704;return db['User']['find']({'where':{'id':_0x5a061a[_0xdbbd('0x60')]['id']},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0x3f')]})['then'](handleEntityNotFound(_0x2448da,null))[_0xdbbd('0x34')](function(_0x5d7933){if(_0x5d7933){_0x31a704=_0x5d7933;if(!_0x5a061a['query']['channel']||!utils[_0xdbbd('0xa1')](_0x5a061a['query'][_0xdbbd('0x9c')])){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))]('Unknown\x20channel');}return _0x5d7933['remove'+_[_0xdbbd('0xa3')](_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x9c')]['toLowerCase']())+'Queues'](_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x69')]);}})[_0xdbbd('0x34')](function(_0x2c19d3){for(var _0x3a3814=0x0;_0x3a3814<_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x69')][_0xdbbd('0x62')];_0x3a3814+=0x1){var _0x3363f0={'UserId':_0x5a061a[_0xdbbd('0x60')]['id']};_0x3363f0[_[_0xdbbd('0xa3')](_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x9c')]['toLowerCase']())+_0xdbbd('0xb1')]=_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x69')][_0x3a3814];socket['emit']('user'+_[_0xdbbd('0xa3')](_0x5a061a[_0xdbbd('0x4a')][_0xdbbd('0x9c')]['toLowerCase']())+'Queue:remove',_0x3363f0);}return _0x2c19d3;})[_0xdbbd('0x34')](function(){if(_0x5a061a['query'][_0xdbbd('0x9c')]===_0xdbbd('0xa9')){return db[_0xdbbd('0xae')][_0xdbbd('0x35')]({'where':{'UserId':_0x5a061a[_0xdbbd('0x60')]['id'],'VoiceQueueId':_0x5a061a['query'][_0xdbbd('0x69')]},'individualHooks':!![]})[_0xdbbd('0x34')](function(){return _0x31a704;});}return _0x31a704;})[_0xdbbd('0x34')](respondWithStatusCode(_0x2448da,null))['catch'](handleError(_0x2448da,null));};exports[_0xdbbd('0xb2')]=function(_0x3b9285,_0x21b1d0,_0x1e8f61){_0x3b9285[_0xdbbd('0x65')][_0xdbbd('0xb3')]=_0x3b9285[_0xdbbd('0xb4')]['filename'];return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0x3b9285['params']['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x21b1d0,null))[_0xdbbd('0x34')](saveUpdates(_0x3b9285[_0xdbbd('0x65')],null))['then'](respondWithResult(_0x21b1d0,null))[_0xdbbd('0x27')](handleError(_0x21b1d0,null));};exports[_0xdbbd('0xb5')]=function(_0x1a0401,_0x55be46,_0x4f9ef9){var _0x396525=path[_0xdbbd('0xb6')](config['root'],_0xdbbd('0xb7'));return db['User']['find']({'where':{'id':_0x1a0401[_0xdbbd('0x60')]['id']},'attributes':['id','userpic'],'raw':!![]})['then'](handleEntityNotFound(_0x55be46,null))[_0xdbbd('0x34')](function(_0x425744){if(_0x425744){if(_['isNil'](_0x425744['userpic'])){return _0x55be46[_0xdbbd('0xb8')](_0x396525);}else{if(!fs[_0xdbbd('0xb9')](path[_0xdbbd('0xb6')](config['root'],_0xdbbd('0xba'),_0x425744[_0xdbbd('0xb3')]))){return _0x55be46[_0xdbbd('0xb8')](_0x396525);}return _0x55be46['download'](path[_0xdbbd('0xb6')](config[_0xdbbd('0xbb')],'server/files/images/',_0x425744[_0xdbbd('0xb3')]));}}})[_0xdbbd('0x27')](handleError(_0x55be46,null));};exports[_0xdbbd('0xbc')]=function(_0x37fed6,_0x5d1a85,_0x426c23){var _0x45fee3={};var _0xc63391={};var _0x5c320d;var _0x1b0d44;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x37fed6[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x5d1a85,null))[_0xdbbd('0x34')](function(_0x5e342f){if(_0x5e342f){_0x5c320d=_0x5e342f;_0xc63391[_0xdbbd('0x4d')]=_[_0xdbbd('0x4b')](db[_0xdbbd('0xbe')][_0xdbbd('0x45')]);_0xc63391['query']=_[_0xdbbd('0x4b')](_0x37fed6[_0xdbbd('0x4a')]);_0xc63391[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0xc63391[_0xdbbd('0x4d')],_0xc63391[_0xdbbd('0x4a')]);_0x45fee3[_0xdbbd('0x4f')]=_[_0xdbbd('0x4c')](_0xc63391[_0xdbbd('0x4d')],qs['fields'](_0x37fed6['query']['fields']));_0x45fee3[_0xdbbd('0x4f')]=_0x45fee3['attributes'][_0xdbbd('0x62')]?_0x45fee3[_0xdbbd('0x4f')]:_0xc63391[_0xdbbd('0x4d')];_0x45fee3[_0xdbbd('0x51')]=qs['sort'](_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x45fee3[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_['pick'](_0x37fed6[_0xdbbd('0x4a')],_0xc63391[_0xdbbd('0x54')]));if(_0x37fed6[_0xdbbd('0x4a')]['filter']){_0x45fee3['where']=_[_0xdbbd('0x56')](_0x45fee3[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x45fee3[_0xdbbd('0x4f')],function(_0x1118ce){var _0x2a67bc={};_0x2a67bc[_0x1118ce]={'$like':'%'+_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x2a67bc;})});}_0x45fee3=_[_0xdbbd('0x56')]({},_0x45fee3,_0x37fed6[_0xdbbd('0x5b')]);return _0x5c320d[_0xdbbd('0xbc')](_0x45fee3);}})[_0xdbbd('0x34')](function(_0x3703a5){if(_0x3703a5){_0x1b0d44=_0x3703a5[_0xdbbd('0x62')];if(_0x37fed6[_0xdbbd('0x4a')]['hasOwnProperty'](_0xdbbd('0x63'))){_0x45fee3[_0xdbbd('0x5c')]=[{'model':db[_0xdbbd('0xbf')],'as':_0xdbbd('0xc0'),'required':![]},{'model':db['Tag'],'as':_0xdbbd('0xc1'),'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0xc2')],'where':_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0xc3')]?{'id':_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0xc3')]}:undefined,'required':_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0xc3')]?!![]:![]}];}if(!_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0x50')]('nolimit')){_0x45fee3['limit']=qs[_0xdbbd('0x2e')](_0x37fed6[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x45fee3[_0xdbbd('0x2d')]=qs[_0xdbbd('0x2d')](_0x37fed6['query'][_0xdbbd('0x2d')]);}return _0x5c320d[_0xdbbd('0xbc')](_0x45fee3);}})[_0xdbbd('0x34')](function(_0x2ba876){if(_0x2ba876){return _0x2ba876?{'count':_0x1b0d44,'rows':_0x2ba876}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x5d1a85,null))[_0xdbbd('0x27')](handleError(_0x5d1a85,null));};exports[_0xdbbd('0xc4')]=function(_0x21a85e,_0x54e401,_0x20b3d2){var _0x1b59ec;var _0x3c7823;var _0xd696a8={};var _0x535918;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x21a85e[_0xdbbd('0x60')]['id']},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0x3f')]})['then'](handleEntityNotFound(_0x54e401,null))[_0xdbbd('0x34')](function(_0x9a4b9b){if(!utils[_0xdbbd('0xa1')](_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x9c')])){throw new db[(_0xdbbd('0x96'))]['ValidationError']('Unknown\x20channel');}_0x1b59ec=_0x9a4b9b;var _0x304774={};_0x304774[_0xdbbd('0x4d')]=_['keys'](db[_[_0xdbbd('0xa3')](_0x21a85e[_0xdbbd('0x4a')]['channel'])+_0xdbbd('0xc5')][_0xdbbd('0x45')]);_0x304774[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x21a85e[_0xdbbd('0x4a')]);_0x304774[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x304774[_0xdbbd('0x4d')],_0x304774['query']);_0xd696a8['attributes']=_[_0xdbbd('0x4c')](_0x304774['model'],qs['fields'](_0x21a85e['query'][_0xdbbd('0x4e')]));_0xd696a8[_0xdbbd('0x4f')]=_0xd696a8[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0xd696a8['attributes']:_0x304774[_0xdbbd('0x4d')];_0xd696a8[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0xd696a8[_0xdbbd('0x53')]=qs['filters'](_[_0xdbbd('0xc6')](_0x21a85e[_0xdbbd('0x4a')],_0x304774[_0xdbbd('0x54')]));if(_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0xd696a8[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0xd696a8[_0xdbbd('0x53')],{'$or':_['map'](_0xd696a8[_0xdbbd('0x4f')],function(_0x1b2e36){var _0x57d27d={};_0x57d27d[_0x1b2e36]={'$like':'%'+_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x57d27d;})});}_0xd696a8=_[_0xdbbd('0x56')]({},_0xd696a8,_0x21a85e['options']);switch(_0x1b59ec[_0xdbbd('0x3f')]){case _0xdbbd('0x6b'):return db[_[_0xdbbd('0xa3')](_0x21a85e[_0xdbbd('0x4a')]['channel'])+'Queue'][_0xdbbd('0x5d')](_0xd696a8);case _0xdbbd('0x38'):case _0xdbbd('0x39'):return _0x1b59ec[_0xdbbd('0x36')+_[_0xdbbd('0xa3')](_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x9c')])+_0xdbbd('0xa5')](_0xd696a8);default:throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0xc7'));}})[_0xdbbd('0x34')](function(_0xaade96){_0x535918=_0xaade96[_0xdbbd('0x62')];if(!_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x50')]('nolimit')){_0xd696a8[_0xdbbd('0x2e')]=qs['limit'](_0x21a85e[_0xdbbd('0x4a')]['limit']);_0xd696a8[_0xdbbd('0x2d')]=qs[_0xdbbd('0x2d')](_0x21a85e[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}switch(_0x1b59ec[_0xdbbd('0x3f')]){case _0xdbbd('0x6b'):return db[_[_0xdbbd('0xa3')](_0x21a85e[_0xdbbd('0x4a')]['channel'])+_0xdbbd('0xc5')][_0xdbbd('0x5d')](_0xd696a8);case _0xdbbd('0x38'):case _0xdbbd('0x39'):return _0x1b59ec[_0xdbbd('0x36')+_[_0xdbbd('0xa3')](_0x21a85e[_0xdbbd('0x4a')]['channel'])+'Queues'](_0xd696a8);}})[_0xdbbd('0x34')](function(_0x52dded){return{'count':_0x535918,'rows':_0x52dded};})[_0xdbbd('0x34')](respondWithResult(_0x54e401,null))[_0xdbbd('0x27')](handleError(_0x54e401,null));};exports[_0xdbbd('0xc8')]=function(_0x38d2e2,_0x32cb3d,_0x3114ed){var _0x4d569a={};var _0x592eac={};var _0x34e99d;var _0x35735d;return db['User'][_0xdbbd('0xbd')]({'where':{'id':_0x38d2e2[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x32cb3d,null))[_0xdbbd('0x34')](function(_0x4aefd5){if(_0x4aefd5){_0x34e99d=_0x4aefd5;_0x592eac[_0xdbbd('0x4d')]=_['keys'](db['UserVoiceQueueRt'][_0xdbbd('0x45')]);_0x592eac[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x38d2e2[_0xdbbd('0x4a')]);_0x592eac['filters']=_['intersection'](_0x592eac[_0xdbbd('0x4d')],_0x592eac[_0xdbbd('0x4a')]);_0x4d569a['attributes']=_[_0xdbbd('0x4c')](_0x592eac[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x38d2e2['query'][_0xdbbd('0x4e')]));_0x4d569a['attributes']=_0x4d569a[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x4d569a[_0xdbbd('0x4f')]:_0x592eac[_0xdbbd('0x4d')];_0x4d569a[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x38d2e2['query'][_0xdbbd('0x52')]);_0x4d569a['where']=qs['filters'](_[_0xdbbd('0xc6')](_0x38d2e2['query'],_0x592eac['filters']));if(_0x38d2e2['query'][_0xdbbd('0x55')]){_0x4d569a[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x4d569a[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x4d569a[_0xdbbd('0x4f')],function(_0x550b87){var _0x390602={};_0x390602[_0x550b87]={'$like':'%'+_0x38d2e2[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x390602;})});}_0x4d569a=_[_0xdbbd('0x56')]({},_0x4d569a,_0x38d2e2['options']);return _0x34e99d[_0xdbbd('0xc8')](_0x4d569a);}})[_0xdbbd('0x34')](function(_0x1c9a8a){if(_0x1c9a8a){_0x35735d=_0x1c9a8a[_0xdbbd('0x62')];if(!_0x38d2e2['query'][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x4d569a[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x38d2e2[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x4d569a[_0xdbbd('0x2d')]=qs[_0xdbbd('0x2d')](_0x38d2e2['query'][_0xdbbd('0x2d')]);}return _0x34e99d[_0xdbbd('0xc8')](_0x4d569a);}})['then'](function(_0x357f4e){if(_0x357f4e){return _0x357f4e?{'count':_0x35735d,'rows':_0x357f4e}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x32cb3d,null))[_0xdbbd('0x27')](handleError(_0x32cb3d,null));};exports[_0xdbbd('0xca')]=function(_0x209787,_0x20100e,_0x44b0ca){var _0x37fc73={};var _0x28bcef={};var _0x37b368;var _0x2f478c;return db['User']['findOne']({'where':{'id':_0x209787[_0xdbbd('0x60')]['id']}})['then'](handleEntityNotFound(_0x20100e,null))[_0xdbbd('0x34')](function(_0x2a05dc){if(_0x2a05dc){_0x37b368=_0x2a05dc;_0x28bcef[_0xdbbd('0x4d')]=_['keys'](db['ChatGroup'][_0xdbbd('0x45')]);_0x28bcef[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x209787['query']);_0x28bcef[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x28bcef[_0xdbbd('0x4d')],_0x28bcef[_0xdbbd('0x4a')]);_0x37fc73[_0xdbbd('0x4f')]=_[_0xdbbd('0x4c')](_0x28bcef[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x209787[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x37fc73[_0xdbbd('0x4f')]=_0x37fc73[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x37fc73[_0xdbbd('0x4f')]:_0x28bcef[_0xdbbd('0x4d')];_0x37fc73[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x209787[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x37fc73[_0xdbbd('0x53')]=qs['filters'](_[_0xdbbd('0xc6')](_0x209787[_0xdbbd('0x4a')],_0x28bcef[_0xdbbd('0x54')]));if(_0x209787['query']['filter']){_0x37fc73[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x37fc73[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x37fc73[_0xdbbd('0x4f')],function(_0x125502){var _0xd3a98e={};_0xd3a98e[_0x125502]={'$like':'%'+_0x209787[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0xd3a98e;})});}_0x37fc73=_[_0xdbbd('0x56')]({},_0x37fc73,_0x209787['options']);return _0x37b368[_0xdbbd('0xca')](_0x37fc73);}})[_0xdbbd('0x34')](function(_0x565576){if(_0x565576){_0x2f478c=_0x565576[_0xdbbd('0x62')];if(!_0x209787[_0xdbbd('0x4a')][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x37fc73[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x209787[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x37fc73['offset']=qs[_0xdbbd('0x2d')](_0x209787['query']['offset']);}return _0x37b368[_0xdbbd('0xca')](_0x37fc73);}})[_0xdbbd('0x34')](function(_0x3e021a){if(_0x3e021a){return _0x3e021a?{'count':_0x2f478c,'rows':_0x3e021a}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x20100e,null))[_0xdbbd('0x27')](handleError(_0x20100e,null));};exports[_0xdbbd('0xcb')]=function(_0x2cacee,_0x4ba1df,_0x3b5154){var _0x381333={'raw':!![],'where':{}};var _0x4cda5e={};var _0x378dd3={'count':0x0,'rows':[]};return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x2cacee[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x4ba1df,null))[_0xdbbd('0x34')](function(_0x4bb8b6){if(_0x4bb8b6){_0x4cda5e[_0xdbbd('0x4d')]=_[_0xdbbd('0x4b')](db[_0xdbbd('0xcc')][_0xdbbd('0x45')]);_0x4cda5e[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x2cacee[_0xdbbd('0x4a')]);_0x4cda5e[_0xdbbd('0x54')]=_['intersection'](_0x4cda5e[_0xdbbd('0x4d')],_0x4cda5e['query']);_0x381333['attributes']=_[_0xdbbd('0x4c')](_0x4cda5e[_0xdbbd('0x4d')],qs['fields'](_0x2cacee[_0xdbbd('0x4a')]['fields']));_0x381333['attributes']=_0x381333[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x381333[_0xdbbd('0x4f')]:_0x4cda5e[_0xdbbd('0x4d')];if(!_0x2cacee[_0xdbbd('0x4a')][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x381333[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x2cacee['query'][_0xdbbd('0x2e')]);_0x381333['offset']=qs[_0xdbbd('0x2d')](_0x2cacee['query']['offset']);}_0x381333[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x2cacee[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x381333[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_[_0xdbbd('0xc6')](_0x2cacee[_0xdbbd('0x4a')],_0x4cda5e['filters']));_0x381333[_0xdbbd('0x53')][_0xdbbd('0xcd')]=_0x4bb8b6['id'];if(_0x2cacee[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x381333['where']=_[_0xdbbd('0x56')](_0x381333[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x381333[_0xdbbd('0x4f')],function(_0x108906){var _0x8ee6b3={};_0x8ee6b3[_0x108906]={'$like':'%'+_0x2cacee['query'][_0xdbbd('0x55')]+'%'};return _0x8ee6b3;})});}_0x381333=_[_0xdbbd('0x56')]({},_0x381333,_0x2cacee[_0xdbbd('0x5b')]);return db[_0xdbbd('0xcc')][_0xdbbd('0x2c')]({'where':_0x381333['where']})[_0xdbbd('0x34')](function(_0x4d61fa){_0x378dd3['count']=_0x4d61fa;if(_0x2cacee[_0xdbbd('0x4a')][_0xdbbd('0x63')]){_0x381333['include']=[{'all':!![]}];}return db['VoiceRecording'][_0xdbbd('0x5d')](_0x381333);})[_0xdbbd('0x34')](function(_0xb4e4d0){_0x378dd3[_0xdbbd('0x5e')]=_0xb4e4d0;return _0x378dd3;});}})[_0xdbbd('0x34')](respondWithFilteredResult(_0x4ba1df,_0x381333))[_0xdbbd('0x27')](handleError(_0x4ba1df,null));};exports[_0xdbbd('0xce')]=function(_0x4ba83b,_0x399b2d,_0x225bc7){var _0x5aba23={'raw':!![],'where':{}};var _0x4fff8f={};var _0x1a6ac9={'count':0x0,'rows':[]};return db[_0xdbbd('0x44')]['findOne']({'where':{'id':_0x4ba83b[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x399b2d,null))[_0xdbbd('0x34')](function(_0x19052a){if(_0x19052a){_0x4fff8f[_0xdbbd('0x4d')]=_[_0xdbbd('0x4b')](db['ScreenRecording'][_0xdbbd('0x45')]);_0x4fff8f[_0xdbbd('0x4a')]=_['keys'](_0x4ba83b[_0xdbbd('0x4a')]);_0x4fff8f[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x4fff8f[_0xdbbd('0x4d')],_0x4fff8f[_0xdbbd('0x4a')]);_0x5aba23[_0xdbbd('0x4f')]=_[_0xdbbd('0x4c')](_0x4fff8f[_0xdbbd('0x4d')],qs['fields'](_0x4ba83b['query'][_0xdbbd('0x4e')]));_0x5aba23['attributes']=_0x5aba23[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x5aba23[_0xdbbd('0x4f')]:_0x4fff8f[_0xdbbd('0x4d')];if(!_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x5aba23['limit']=qs[_0xdbbd('0x2e')](_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x5aba23[_0xdbbd('0x2d')]=qs[_0xdbbd('0x2d')](_0x4ba83b['query'][_0xdbbd('0x2d')]);}_0x5aba23['order']=qs['sort'](_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x5aba23[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_[_0xdbbd('0xc6')](_0x4ba83b[_0xdbbd('0x4a')],_0x4fff8f[_0xdbbd('0x54')]));_0x5aba23['where']['UserId']=_0x19052a['id'];if(_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x5aba23[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x5aba23[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x5aba23['attributes'],function(_0x4bcf42){var _0x3b810a={};_0x3b810a[_0x4bcf42]={'$like':'%'+_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x3b810a;})});}_0x5aba23=_[_0xdbbd('0x56')]({},_0x5aba23,_0x4ba83b[_0xdbbd('0x5b')]);return db['ScreenRecording'][_0xdbbd('0x2c')]({'where':_0x5aba23['where']})[_0xdbbd('0x34')](function(_0x257736){_0x1a6ac9[_0xdbbd('0x2c')]=_0x257736;if(_0x4ba83b[_0xdbbd('0x4a')][_0xdbbd('0x63')]){_0x5aba23[_0xdbbd('0x5c')]=[{'all':!![]}];}return db[_0xdbbd('0xcf')][_0xdbbd('0x5d')](_0x5aba23);})['then'](function(_0x52febf){_0x1a6ac9[_0xdbbd('0x5e')]=_0x52febf;return _0x1a6ac9;});}})[_0xdbbd('0x34')](respondWithFilteredResult(_0x399b2d,_0x5aba23))[_0xdbbd('0x27')](handleError(_0x399b2d,null));};exports[_0xdbbd('0xd0')]=function(_0x5303e8,_0xd94740,_0xe63a5e){var _0x31c1ef={};var _0x5811e5={};var _0x26236a;var _0x41d1dd;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x5303e8[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0xd94740,null))[_0xdbbd('0x34')](function(_0x4f205e){if(_0x4f205e){_0x26236a=_0x4f205e;_0x5811e5[_0xdbbd('0x4d')]=_['keys'](db[_0xdbbd('0xd1')][_0xdbbd('0x45')]);_0x5811e5[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x5303e8[_0xdbbd('0x4a')]);_0x5811e5[_0xdbbd('0x54')]=_['intersection'](_0x5811e5[_0xdbbd('0x4d')],_0x5811e5['query']);_0x31c1ef[_0xdbbd('0x4f')]=_['intersection'](_0x5811e5[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x5303e8['query'][_0xdbbd('0x4e')]));_0x31c1ef['attributes']=_0x31c1ef[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x31c1ef[_0xdbbd('0x4f')]:_0x5811e5['model'];_0x31c1ef['order']=qs['sort'](_0x5303e8[_0xdbbd('0x4a')]['sort']);_0x31c1ef['where']=qs['filters'](_[_0xdbbd('0xc6')](_0x5303e8[_0xdbbd('0x4a')],_0x5811e5['filters']));if(_0x5303e8[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x31c1ef[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x31c1ef[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x31c1ef[_0xdbbd('0x4f')],function(_0x4d564d){var _0x5dc68d={};_0x5dc68d[_0x4d564d]={'$like':'%'+_0x5303e8[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x5dc68d;})});}_0x31c1ef=_['merge']({},_0x31c1ef,_0x5303e8[_0xdbbd('0x5b')]);return _0x26236a['getChatInteractions'](_0x31c1ef);}})['then'](function(_0x489923){if(_0x489923){_0x41d1dd=_0x489923['length'];if(!_0x5303e8['query'][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x31c1ef[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x5303e8[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x31c1ef[_0xdbbd('0x2d')]=qs['offset'](_0x5303e8[_0xdbbd('0x4a')]['offset']);}return _0x26236a[_0xdbbd('0xd0')](_0x31c1ef);}})[_0xdbbd('0x34')](function(_0x5dc211){if(_0x5dc211){return _0x5dc211?{'count':_0x41d1dd,'rows':_0x5dc211}:null;}})[_0xdbbd('0x34')](respondWithResult(_0xd94740,null))[_0xdbbd('0x27')](handleError(_0xd94740,null));};exports['getOpenchannelInteractions']=function(_0x264f65,_0x5d199c,_0x1fc0ac){var _0x45ff8d={};var _0x4266c2={};var _0x3999fc;var _0x31a803;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x264f65[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x5d199c,null))[_0xdbbd('0x34')](function(_0x578aab){if(_0x578aab){_0x3999fc=_0x578aab;_0x4266c2['model']=_[_0xdbbd('0x4b')](db['OpenchannelInteraction'][_0xdbbd('0x45')]);_0x4266c2['query']=_[_0xdbbd('0x4b')](_0x264f65[_0xdbbd('0x4a')]);_0x4266c2[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x4266c2['model'],_0x4266c2[_0xdbbd('0x4a')]);_0x45ff8d['attributes']=_['intersection'](_0x4266c2[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x264f65['query'][_0xdbbd('0x4e')]));_0x45ff8d[_0xdbbd('0x4f')]=_0x45ff8d[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x45ff8d[_0xdbbd('0x4f')]:_0x4266c2[_0xdbbd('0x4d')];_0x45ff8d[_0xdbbd('0x51')]=qs['sort'](_0x264f65[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x45ff8d[_0xdbbd('0x53')]=qs['filters'](_[_0xdbbd('0xc6')](_0x264f65[_0xdbbd('0x4a')],_0x4266c2[_0xdbbd('0x54')]));if(_0x264f65[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x45ff8d[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x45ff8d[_0xdbbd('0x53')],{'$or':_['map'](_0x45ff8d[_0xdbbd('0x4f')],function(_0x5238e3){var _0x35c385={};_0x35c385[_0x5238e3]={'$like':'%'+_0x264f65[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x35c385;})});}_0x45ff8d=_['merge']({},_0x45ff8d,_0x264f65[_0xdbbd('0x5b')]);return _0x3999fc[_0xdbbd('0xd2')](_0x45ff8d);}})[_0xdbbd('0x34')](function(_0x1ec9fd){if(_0x1ec9fd){_0x31a803=_0x1ec9fd[_0xdbbd('0x62')];if(!_0x264f65[_0xdbbd('0x4a')]['hasOwnProperty'](_0xdbbd('0xc9'))){_0x45ff8d[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x264f65['query'][_0xdbbd('0x2e')]);_0x45ff8d[_0xdbbd('0x2d')]=qs['offset'](_0x264f65[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}return _0x3999fc['getOpenchannelInteractions'](_0x45ff8d);}})['then'](function(_0x1ec278){if(_0x1ec278){return _0x1ec278?{'count':_0x31a803,'rows':_0x1ec278}:null;}})['then'](respondWithResult(_0x5d199c,null))[_0xdbbd('0x27')](handleError(_0x5d199c,null));};exports[_0xdbbd('0xd3')]=function(_0x3c87de,_0x9453d0,_0x5e3a19){var _0x388629={'raw':!![],'where':{}};var _0xbef779={};var _0x5d60a9={'count':0x0,'rows':[]};return db['User'][_0xdbbd('0xbd')]({'where':{'id':_0x3c87de['params']['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x9453d0,null))[_0xdbbd('0x34')](function(_0x5b0777){if(_0x5b0777){_0xbef779['model']=_['keys'](db[_0xdbbd('0xd4')][_0xdbbd('0x45')]);_0xbef779[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x3c87de[_0xdbbd('0x4a')]);_0xbef779[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0xbef779[_0xdbbd('0x4d')],_0xbef779[_0xdbbd('0x4a')]);_0x388629[_0xdbbd('0x4f')]=_['intersection'](_0xbef779[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x388629[_0xdbbd('0x4f')]=_0x388629[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x388629['attributes']:_0xbef779[_0xdbbd('0x4d')];if(!_0x3c87de[_0xdbbd('0x4a')]['hasOwnProperty'](_0xdbbd('0xc9'))){_0x388629[_0xdbbd('0x2e')]=qs['limit'](_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x388629['offset']=qs[_0xdbbd('0x2d')](_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}_0x388629[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x388629['where']=qs[_0xdbbd('0x54')](_[_0xdbbd('0xc6')](_0x3c87de[_0xdbbd('0x4a')],_0xbef779[_0xdbbd('0x54')]));_0x388629[_0xdbbd('0x53')][_0xdbbd('0xcd')]=_0x5b0777['id'];if(_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x388629[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x388629[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x388629['attributes'],function(_0x357e93){var _0xa4442a={};_0xa4442a[_0x357e93]={'$like':'%'+_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0xa4442a;})});}_0x388629=_['merge']({},_0x388629,_0x3c87de['options']);return db[_0xdbbd('0xd4')][_0xdbbd('0x2c')]({'where':_0x388629[_0xdbbd('0x53')]})['then'](function(_0x17871d){_0x5d60a9[_0xdbbd('0x2c')]=_0x17871d;if(_0x3c87de[_0xdbbd('0x4a')][_0xdbbd('0x63')]){_0x388629[_0xdbbd('0x5c')]=[{'all':!![]}];}return db[_0xdbbd('0xd4')][_0xdbbd('0x5d')](_0x388629);})['then'](function(_0x60ede5){_0x5d60a9[_0xdbbd('0x5e')]=_0x60ede5;return _0x5d60a9;});}})[_0xdbbd('0x34')](respondWithFilteredResult(_0x9453d0,_0x388629))['catch'](handleError(_0x9453d0,null));};exports[_0xdbbd('0xd5')]=function(_0x330dc1,_0x3bff86,_0x55edcf){var _0x3c2f70={};var _0x1d505c={};var _0x32c76a;var _0x226fd6;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x330dc1[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x3bff86,null))[_0xdbbd('0x34')](function(_0x3498b3){if(_0x3498b3){_0x32c76a=_0x3498b3;_0x1d505c[_0xdbbd('0x4d')]=_['keys'](db['SmsInteraction'][_0xdbbd('0x45')]);_0x1d505c[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x330dc1[_0xdbbd('0x4a')]);_0x1d505c[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x1d505c[_0xdbbd('0x4d')],_0x1d505c[_0xdbbd('0x4a')]);_0x3c2f70[_0xdbbd('0x4f')]=_['intersection'](_0x1d505c[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x330dc1[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x3c2f70[_0xdbbd('0x4f')]=_0x3c2f70[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x3c2f70[_0xdbbd('0x4f')]:_0x1d505c[_0xdbbd('0x4d')];_0x3c2f70[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x330dc1[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x3c2f70[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_[_0xdbbd('0xc6')](_0x330dc1[_0xdbbd('0x4a')],_0x1d505c[_0xdbbd('0x54')]));if(_0x330dc1[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x3c2f70['where']=_[_0xdbbd('0x56')](_0x3c2f70[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x3c2f70[_0xdbbd('0x4f')],function(_0x3ae77c){var _0x274556={};_0x274556[_0x3ae77c]={'$like':'%'+_0x330dc1[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x274556;})});}_0x3c2f70=_[_0xdbbd('0x56')]({},_0x3c2f70,_0x330dc1[_0xdbbd('0x5b')]);return _0x32c76a[_0xdbbd('0xd5')](_0x3c2f70);}})['then'](function(_0xa356ec){if(_0xa356ec){_0x226fd6=_0xa356ec[_0xdbbd('0x62')];if(!_0x330dc1['query']['hasOwnProperty'](_0xdbbd('0xc9'))){_0x3c2f70[_0xdbbd('0x2e')]=qs[_0xdbbd('0x2e')](_0x330dc1['query'][_0xdbbd('0x2e')]);_0x3c2f70['offset']=qs[_0xdbbd('0x2d')](_0x330dc1['query']['offset']);}return _0x32c76a['getSmsInteractions'](_0x3c2f70);}})[_0xdbbd('0x34')](function(_0x3d1cc2){if(_0x3d1cc2){return _0x3d1cc2?{'count':_0x226fd6,'rows':_0x3d1cc2}:null;}})['then'](respondWithResult(_0x3bff86,null))[_0xdbbd('0x27')](handleError(_0x3bff86,null));};exports[_0xdbbd('0xd6')]=function(_0x50209f,_0x22a3a2,_0x2352ed){var _0x13dbae={};var _0x5a6287={};var _0xda7da9;var _0x1036d9;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x50209f['params']['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x22a3a2,null))[_0xdbbd('0x34')](function(_0x14436a){if(_0x14436a){_0xda7da9=_0x14436a;_0x5a6287[_0xdbbd('0x4d')]=_['keys'](db[_0xdbbd('0xd7')][_0xdbbd('0x45')]);_0x5a6287[_0xdbbd('0x4a')]=_['keys'](_0x50209f['query']);_0x5a6287['filters']=_[_0xdbbd('0x4c')](_0x5a6287[_0xdbbd('0x4d')],_0x5a6287[_0xdbbd('0x4a')]);_0x13dbae[_0xdbbd('0x4f')]=_['intersection'](_0x5a6287[_0xdbbd('0x4d')],qs['fields'](_0x50209f[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x13dbae[_0xdbbd('0x4f')]=_0x13dbae['attributes'][_0xdbbd('0x62')]?_0x13dbae[_0xdbbd('0x4f')]:_0x5a6287[_0xdbbd('0x4d')];_0x13dbae['order']=qs[_0xdbbd('0x52')](_0x50209f['query'][_0xdbbd('0x52')]);_0x13dbae[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_['pick'](_0x50209f[_0xdbbd('0x4a')],_0x5a6287[_0xdbbd('0x54')]));if(_0x50209f[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x13dbae[_0xdbbd('0x53')]=_['merge'](_0x13dbae[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x13dbae[_0xdbbd('0x4f')],function(_0x2ff178){var _0x4157c7={};_0x4157c7[_0x2ff178]={'$like':'%'+_0x50209f['query'][_0xdbbd('0x55')]+'%'};return _0x4157c7;})});}_0x13dbae=_[_0xdbbd('0x56')]({},_0x13dbae,_0x50209f[_0xdbbd('0x5b')]);return _0xda7da9['getFaxInteractions'](_0x13dbae);}})[_0xdbbd('0x34')](function(_0x3c1c9b){if(_0x3c1c9b){_0x1036d9=_0x3c1c9b['length'];if(!_0x50209f[_0xdbbd('0x4a')][_0xdbbd('0x50')]('nolimit')){_0x13dbae[_0xdbbd('0x2e')]=qs['limit'](_0x50209f[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x13dbae[_0xdbbd('0x2d')]=qs[_0xdbbd('0x2d')](_0x50209f[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}return _0xda7da9['getFaxInteractions'](_0x13dbae);}})[_0xdbbd('0x34')](function(_0x1a5dba){if(_0x1a5dba){return _0x1a5dba?{'count':_0x1036d9,'rows':_0x1a5dba}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x22a3a2,null))[_0xdbbd('0x27')](handleError(_0x22a3a2,null));};exports[_0xdbbd('0xd8')]=function(_0x4a3bfc,_0x57b447,_0x25b5fa){var _0x16da96;var _0x1b6174;var _0x909e43;var _0x49ebdc=!_['isNil'](_0x4a3bfc[_0xdbbd('0x60')]['id'])?_0x4a3bfc[_0xdbbd('0x60')]['id']:!_[_0xdbbd('0x70')](_0x4a3bfc['user']['id'])?_0x4a3bfc[_0xdbbd('0x38')]['id']:null;return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0x49ebdc,'role':{'$or':['admin','user',_0xdbbd('0x39')]}},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0xd9'),_0xdbbd('0xda'),_0xdbbd('0x3f'),_0xdbbd('0x75'),_0xdbbd('0x9e')]})['then'](function(_0x19fb7b){if(_0x19fb7b){if(_0x19fb7b[_0xdbbd('0x3f')]===_0xdbbd('0x39')){_0x16da96=_0x19fb7b;if(_0x4a3bfc[_0xdbbd('0x65')]['interface']){_0x909e43=util[_0xdbbd('0x72')](_0xdbbd('0xdb'),_0x16da96[_0x4a3bfc[_0xdbbd('0x65')][_0xdbbd('0xa0')]]);}else if(_0x4a3bfc[_0xdbbd('0x65')][_0xdbbd('0xdc')]){_0x909e43=util[_0xdbbd('0x72')](_0xdbbd('0xac'),_0x4a3bfc[_0xdbbd('0x65')][_0xdbbd('0xdc')]);}else{_0x909e43=util[_0xdbbd('0x72')](_0xdbbd('0xac'),_0x16da96[_0xdbbd('0x40')]);}socket['to'](util['format'](_0xdbbd('0xdd'),_0x16da96['name']))[_0xdbbd('0xa8')]('user:forcelogout',{'ip':_0x4a3bfc[_0xdbbd('0xde')][_0xdbbd('0xdf')]||_0x4a3bfc[_0xdbbd('0xe0')]['remoteAddress']||_0x4a3bfc[_0xdbbd('0xe1')]['remoteAddress']||_0x4a3bfc[_0xdbbd('0xe0')][_0xdbbd('0xe1')][_0xdbbd('0xe2')]});return db[_0xdbbd('0xae')][_0xdbbd('0x35')]({'where':{'membername':_0x16da96[_0xdbbd('0x40')]},'individualHooks':!![]});}}else{throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0xe3'));}})[_0xdbbd('0x34')](function(){if(_0x16da96){return _0x16da96['getVoiceQueues']({'raw':!![]});}})[_0xdbbd('0x34')](function(_0x3f2c1a){if(_0x16da96){var _0x254ff0=[];if(_0x3f2c1a){_0x1b6174=_0x3f2c1a;if(_0x1b6174[_0xdbbd('0x62')]){for(var _0x38564d=0x0;_0x38564d<_0x1b6174[_0xdbbd('0x62')];_0x38564d++){_0x254ff0['push']({'membername':_0x16da96[_0xdbbd('0x40')],'UserId':_0x16da96['id'],'queue_name':_0x1b6174[_0x38564d][_0xdbbd('0x40')],'VoiceQueueId':_0x1b6174[_0x38564d]['id'],'interface':_0x909e43,'paused':_0x16da96[_0xdbbd('0x9e')]||![],'penalty':_0x1b6174[_0x38564d]['UserVoiceQueue.penalty']||0x0});}return BPromise['each'](_0x254ff0,function(_0x1f61b2){return db[_0xdbbd('0xae')][_0xdbbd('0xaf')](_0x1f61b2);});}}}})[_0xdbbd('0x34')](function(){if(_0x16da96){return db[_0xdbbd('0xe4')][_0xdbbd('0x5d')]({'where':{'membername':_0x16da96[_0xdbbd('0x40')],'exitAt':null}});}})[_0xdbbd('0x34')](function(_0x410a20){if(_0x16da96){var _0x5339c2=[];_0x410a20[_0xdbbd('0xe5')](function(_0x14c78f){_0x5339c2[_0xdbbd('0xab')](_0x14c78f[_0xdbbd('0x33')]({'exitAt':moment()[_0xdbbd('0x72')](_0xdbbd('0xe6'))}));});return BPromise[_0xdbbd('0xe7')](_0x5339c2);}})[_0xdbbd('0x34')](function(){if(_0x16da96){var _0x2955fe=[];var _0x1b0105=[];var _0x4e8114=utils['getChannels']();var _0x2599e5={'membername':_0x16da96[_0xdbbd('0x40')],'interface':_0x909e43,'enterAt':moment()['format'](_0xdbbd('0xe6')),'role':_0x16da96['role'],'internal':_0x16da96[_0xdbbd('0x75')]};_0x4e8114[_0xdbbd('0xe5')](function(_0x12d308){_0x2955fe[_0xdbbd('0xab')](_['merge']({'channel':_0x12d308,'type':_0xdbbd('0xe8'),'data1':_0x4a3bfc['body']['device'],'data2':_0x909e43},_0x2599e5));if(_0x16da96[_0xdbbd('0x9e')]){_0x1b0105[_0xdbbd('0xab')](_[_0xdbbd('0x56')]({'channel':_0x12d308,'type':_0xdbbd('0xe9'),'data1':_0xdbbd('0xea')},_0x2599e5));}});return db[_0xdbbd('0xe4')][_0xdbbd('0x64')](_0x2955fe[_0xdbbd('0xeb')](_0x1b0105),{'individualHooks':!![]});}})[_0xdbbd('0x34')](function(){if(_0x16da96){return _0x16da96[_0xdbbd('0x33')]({'online':!![],'lastLoginAt':moment()[_0xdbbd('0x72')](_0xdbbd('0xe6')),'voicePause':_0x16da96[_0xdbbd('0x9e')]||![],'mailPause':_0x16da96[_0xdbbd('0x9e')]||![],'chatPause':_0x16da96[_0xdbbd('0x9e')]||![],'faxPause':_0x16da96[_0xdbbd('0x9e')]||![],'smsPause':_0x16da96[_0xdbbd('0x9e')]||![],'openchannelPause':_0x16da96[_0xdbbd('0x9e')]||![],'pauseType':_0x16da96[_0xdbbd('0x9e')]?_0xdbbd('0xea'):null,'interface':_0x909e43,'lastPauseAt':moment()[_0xdbbd('0x72')]('YYYY-MM-DD\x20HH:mm:ss')});}})[_0xdbbd('0x34')](function(_0x5639ec){if(_0x4a3bfc[_0xdbbd('0xec')]){return _0x25b5fa();}else{return BPromise[_0xdbbd('0xed')](_0x5639ec)[_0xdbbd('0x34')](respondWithResult(_0x57b447,null));}})[_0xdbbd('0x27')](handleError(_0x57b447,null));};exports[_0xdbbd('0xee')]=function(_0x3fb9a1,_0x4829f0,_0xd921a5){var _0x17e8b2;return db['User'][_0xdbbd('0x66')]({'where':{'id':_0x3fb9a1[_0xdbbd('0x60')]['id'],'role':'agent'},'attributes':['id','name',_0xdbbd('0x3f')]})['then'](handleEntityNotFound(_0x4829f0,null))['then'](function(_0x568e23){if(_0x568e23){_0x17e8b2=_0x568e23;return db[_0xdbbd('0xae')][_0xdbbd('0x35')]({'where':{'membername':_0x17e8b2['name']},'individualHooks':!![]});}})[_0xdbbd('0x34')](function(){return db[_0xdbbd('0xe4')][_0xdbbd('0x5d')]({'where':{'membername':_0x17e8b2[_0xdbbd('0x40')],'exitAt':null}});})[_0xdbbd('0x34')](function(_0x33c89d){var _0x4c3f53=[];_0x33c89d['forEach'](function(_0x301d54){_0x4c3f53[_0xdbbd('0xab')](_0x301d54[_0xdbbd('0x33')]({'exitAt':moment()[_0xdbbd('0x72')](_0xdbbd('0xe6'))}));});return BPromise['all'](_0x4c3f53);})[_0xdbbd('0x34')](function(){return _0x17e8b2['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'interface':null});})[_0xdbbd('0x34')](respondWithResult(_0x4829f0,null))[_0xdbbd('0x27')](handleError(_0x4829f0,null));};exports[_0xdbbd('0xef')]=function(_0x45a860,_0x198df7,_0x37c152){var _0x56961c;return db[_0xdbbd('0xae')]['update']({'paused':0x1},{'where':{'UserId':_0x45a860[_0xdbbd('0x60')]['id']},'individualHooks':!![]})[_0xdbbd('0x34')](function(){return db['User']['find']({'where':{'id':_0x45a860[_0xdbbd('0x60')]['id'],'role':'agent'},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0x3f'),'internal',_0xdbbd('0xa0')]});})[_0xdbbd('0x34')](handleEntityNotFound(_0x198df7,null))[_0xdbbd('0x34')](function(_0x2b164f){if(_0x2b164f){_0x56961c=_0x2b164f;return respondWithRpcPromise(_0xdbbd('0xf0'),'pause',{'id':_0x56961c['id'],'name':_0x56961c['name'],'pause':!![]});}})[_0xdbbd('0x34')](function(){if(_0x56961c){return db[_0xdbbd('0xe4')][_0xdbbd('0x5d')]({'where':{'membername':_0x56961c['name'],'type':'PAUSE','exitAt':null}});}})[_0xdbbd('0x34')](function(_0x452e61){if(_0x452e61[_0xdbbd('0x62')]){var _0x468db8=moment()[_0xdbbd('0x72')](_0xdbbd('0xe6'));for(var _0x34207f=0x0,_0x5a22c3=_0x452e61['length'];_0x34207f<_0x5a22c3;_0x34207f++){_0x452e61[_0x34207f]['updateAttributes']({'exitAt':_0x468db8});}}})[_0xdbbd('0x34')](function(){var _0x3e2885=[];var _0x7f5f15=utils[_0xdbbd('0xf1')]();_0x7f5f15[_0xdbbd('0xe5')](function(_0x5650a1){_0x3e2885[_0xdbbd('0xab')]({'channel':_0x5650a1,'membername':_0x56961c[_0xdbbd('0x40')],'interface':_[_0xdbbd('0x70')](_0x56961c[_0xdbbd('0xa0')])?util[_0xdbbd('0x72')](_0xdbbd('0xac'),_0x56961c[_0xdbbd('0x40')]):_0x56961c[_0xdbbd('0xa0')],'type':_0xdbbd('0xe9'),'enterAt':moment()[_0xdbbd('0x72')](_0xdbbd('0xe6')),'data1':_0x45a860[_0xdbbd('0x65')][_0xdbbd('0x57')]||'DEFAULT\x20PAUSE','role':_0x56961c['role'],'internal':_0x56961c['internal']});});return db[_0xdbbd('0xe4')]['bulkCreate'](_0x3e2885,{'individualHooks':!![]});})[_0xdbbd('0x34')](function(){return _0x56961c[_0xdbbd('0x33')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x45a860[_0xdbbd('0x65')][_0xdbbd('0x57')]||_0xdbbd('0xf2'),'lastPauseAt':moment()[_0xdbbd('0x72')](_0xdbbd('0xe6'))});})['then'](respondWithResult(_0x198df7,null))[_0xdbbd('0x27')](handleError(_0x198df7,null));};exports['unpause']=function(_0xca4bf1,_0x289026,_0xf67915){var _0x525aff;return db[_0xdbbd('0x44')][_0xdbbd('0x66')]({'where':{'id':_0xca4bf1[_0xdbbd('0x60')]['id']},'attributes':['id',_0xdbbd('0x40'),_0xdbbd('0x3f'),_0xdbbd('0x9f'),_0xdbbd('0xf3'),'chatPause',_0xdbbd('0xf4'),_0xdbbd('0xf5'),_0xdbbd('0xf6'),_0xdbbd('0xf7'),_0xdbbd('0xf8')]})[_0xdbbd('0x34')](handleEntityNotFound(_0x289026,null))['then'](function(_0x134325){if(_0x134325){_0x525aff=_0x134325;if(_0xca4bf1[_0xdbbd('0x65')][_0xdbbd('0x9c')]&&!utils['isValidChannel'](_0xca4bf1[_0xdbbd('0x65')][_0xdbbd('0x9c')])){throw new db[(_0xdbbd('0x96'))][(_0xdbbd('0x1c'))](_0xdbbd('0xa2'));}switch(_0xca4bf1[_0xdbbd('0x65')][_0xdbbd('0x9c')]){case'voice':return respondWithRpcPromise('QueuePause','unpause',{'id':_0x525aff['id'],'name':_0x525aff[_0xdbbd('0x40')],'pause':![]})[_0xdbbd('0x34')](function(){return db['UserVoiceQueueRt']['update']({'paused':0x0},{'where':{'UserId':_0x525aff['id']},'individualHooks':!![]});})['then'](function(){return db[_0xdbbd('0xe4')][_0xdbbd('0x66')]({'where':{'channel':_0xca4bf1[_0xdbbd('0x65')]['channel'],'membername':_0x525aff[_0xdbbd('0x40')],'type':'PAUSE','exitAt':null}});})[_0xdbbd('0x34')](function(_0x4ba0c5){if(_0x4ba0c5){return _0x4ba0c5[_0xdbbd('0x33')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data2':_0xdbbd('0xf9')},{'individualHooks':!![]});}return null;})[_0xdbbd('0x34')](function(){return _0x525aff[_0xdbbd('0x33')]({'voicePause':![]});});case _0xdbbd('0xfa'):case _0xdbbd('0xfb'):case _0xdbbd('0xfc'):case _0xdbbd('0xfd'):case _0xdbbd('0xfe'):return db['MemberReport'][_0xdbbd('0x66')]({'where':{'channel':_0xca4bf1['body']['channel'],'membername':_0x525aff[_0xdbbd('0x40')],'type':_0xdbbd('0xe9'),'exitAt':null}})['then'](function(_0x4fdb8a){if(_0x4fdb8a){return _0x4fdb8a[_0xdbbd('0x33')]({'exitAt':moment()['format'](_0xdbbd('0xe6')),'data2':_0xdbbd('0xf9')},{'individualHooks':!![]});}return null;})[_0xdbbd('0x34')](function(){var _0x2e1e56={};_[_0xdbbd('0x2f')](_0x2e1e56,util['format'](_0xdbbd('0xff'),_0xca4bf1[_0xdbbd('0x65')][_0xdbbd('0x9c')],_0xdbbd('0x100')),![]);return _0x525aff['update'](_0x2e1e56);});default:return respondWithRpcPromise(_0xdbbd('0xf0'),_0xdbbd('0x101'),{'id':_0x525aff['id'],'name':_0x525aff[_0xdbbd('0x40')],'pause':![]})[_0xdbbd('0x34')](function(){return db['UserVoiceQueueRt'][_0xdbbd('0x33')]({'paused':0x0},{'where':{'UserId':_0x525aff['id']}});})[_0xdbbd('0x34')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x525aff[_0xdbbd('0x40')],'type':_0xdbbd('0xe9'),'exitAt':null}});})[_0xdbbd('0x34')](function(_0x5dd0e0){var _0x564bee=[];_0x5dd0e0[_0xdbbd('0xe5')](function(_0x38fee2){_0x564bee[_0xdbbd('0xab')](_0x38fee2[_0xdbbd('0x33')]({'exitAt':moment()['format'](_0xdbbd('0xe6')),'data2':'manual'}));});return BPromise[_0xdbbd('0xe7')](_0x564bee);})[_0xdbbd('0x34')](function(){return _0x525aff[_0xdbbd('0x33')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0xdbbd('0x34')](respondWithResult(_0x289026,null))[_0xdbbd('0x27')](handleError(_0x289026,null));};exports[_0xdbbd('0x102')]=function(_0x39f1e2,_0x250234,_0x2e1ebc){var _0x45eda3={};var _0x4b8d64={};var _0x31d12f;var _0x46d7c7;return db['User']['findOne']({'where':{'id':_0x39f1e2['params']['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x250234,null))['then'](function(_0x376f35){if(_0x376f35){_0x31d12f=_0x376f35;_0x4b8d64[_0xdbbd('0x4d')]=_['keys'](db['Team']['rawAttributes']);_0x4b8d64[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x39f1e2[_0xdbbd('0x4a')]);_0x4b8d64[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x4b8d64[_0xdbbd('0x4d')],_0x4b8d64['query']);_0x45eda3[_0xdbbd('0x4f')]=_['intersection'](_0x4b8d64[_0xdbbd('0x4d')],qs['fields'](_0x39f1e2['query']['fields']));_0x45eda3[_0xdbbd('0x4f')]=_0x45eda3[_0xdbbd('0x4f')]['length']?_0x45eda3['attributes']:_0x4b8d64[_0xdbbd('0x4d')];_0x45eda3[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x39f1e2[_0xdbbd('0x4a')][_0xdbbd('0x52')]);_0x45eda3[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_['pick'](_0x39f1e2[_0xdbbd('0x4a')],_0x4b8d64[_0xdbbd('0x54')]));if(_0x39f1e2[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x45eda3['where']=_[_0xdbbd('0x56')](_0x45eda3[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x45eda3[_0xdbbd('0x4f')],function(_0x27b448){var _0x1f005a={};_0x1f005a[_0x27b448]={'$like':'%'+_0x39f1e2[_0xdbbd('0x4a')][_0xdbbd('0x55')]+'%'};return _0x1f005a;})});}_0x45eda3=_['merge']({},_0x45eda3,_0x39f1e2[_0xdbbd('0x5b')]);return _0x31d12f[_0xdbbd('0x102')](_0x45eda3);}})[_0xdbbd('0x34')](function(_0x16e182){if(_0x16e182){_0x46d7c7=_0x16e182['length'];if(!_0x39f1e2['query'][_0xdbbd('0x50')](_0xdbbd('0xc9'))){_0x45eda3[_0xdbbd('0x2e')]=qs['limit'](_0x39f1e2[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x45eda3[_0xdbbd('0x2d')]=qs['offset'](_0x39f1e2[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}return _0x31d12f[_0xdbbd('0x102')](_0x45eda3);}})[_0xdbbd('0x34')](function(_0x19acc1){if(_0x19acc1){return _0x19acc1?{'count':_0x46d7c7,'rows':_0x19acc1}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x250234,null))[_0xdbbd('0x27')](handleError(_0x250234,null));};exports[_0xdbbd('0x103')]=function(_0x4748b2,_0x5a21ae){return db[_0xdbbd('0x44')]['find']({'where':{'id':_0x4748b2['params']['id']}})['then'](handleEntityNotFound(_0x5a21ae,null))[_0xdbbd('0x34')](function(_0x18de01){if(_0x18de01){var _0x5a7a70=_0x18de01[_0xdbbd('0x36')]({'plain':!![]});return _0x18de01[_0xdbbd('0x103')](_0x4748b2['body'][_0xdbbd('0x69')],_[_0xdbbd('0x6a')](_0x4748b2[_0xdbbd('0x65')],['ids','id'])||{})[_0xdbbd('0x34')](function(){for(var _0xb2ab6f=0x0;_0xb2ab6f<_0x4748b2[_0xdbbd('0x65')][_0xdbbd('0x69')][_0xdbbd('0x62')];_0xb2ab6f++){var _0x2464db=[];db[_0xdbbd('0x104')][_0xdbbd('0xbd')]({'where':{'id':_0x4748b2[_0xdbbd('0x65')][_0xdbbd('0x69')][_0xb2ab6f]}})[_0xdbbd('0x34')](function(_0x2e9d17){_0x2464db[_0xdbbd('0xab')](_0x2e9d17['getVoiceQueues']()[_0xdbbd('0x34')](function(_0x486129){for(var _0x381507=0x0;_0x381507<_0x486129[_0xdbbd('0x62')];_0x381507++){_0x486129[_0x381507][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x106'));}return _0x486129;}));_0x2464db[_0xdbbd('0xab')](_0x2e9d17[_0xdbbd('0x107')]()[_0xdbbd('0x34')](function(_0x499985){for(var _0x2e183d=0x0;_0x2e183d<_0x499985[_0xdbbd('0x62')];_0x2e183d++){_0x499985[_0x2e183d]['setDataValue'](_0xdbbd('0x9c'),_0xdbbd('0x108'));}return _0x499985;}));_0x2464db[_0xdbbd('0xab')](_0x2e9d17[_0xdbbd('0x109')]()[_0xdbbd('0x34')](function(_0x1e4e83){for(var _0x2396d8=0x0;_0x2396d8<_0x1e4e83[_0xdbbd('0x62')];_0x2396d8++){_0x1e4e83[_0x2396d8]['setDataValue']('channel',_0xdbbd('0x10a'));}return _0x1e4e83;}));_0x2464db[_0xdbbd('0xab')](_0x2e9d17[_0xdbbd('0x10b')]()[_0xdbbd('0x34')](function(_0x304946){for(var _0x2b1b76=0x0;_0x2b1b76<_0x304946[_0xdbbd('0x62')];_0x2b1b76++){_0x304946[_0x2b1b76]['setDataValue'](_0xdbbd('0x9c'),'Sms');}return _0x304946;}));_0x2464db['push'](_0x2e9d17[_0xdbbd('0x10c')]()[_0xdbbd('0x34')](function(_0xd2e12){for(var _0x1e09d5=0x0;_0x1e09d5<_0xd2e12[_0xdbbd('0x62')];_0x1e09d5++){_0xd2e12[_0x1e09d5][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x10d'));}return _0xd2e12;}));_0x2464db[_0xdbbd('0xab')](_0x2e9d17[_0xdbbd('0x10e')]()[_0xdbbd('0x34')](function(_0x3ebbb1){for(var _0x75d2cf=0x0;_0x75d2cf<_0x3ebbb1[_0xdbbd('0x62')];_0x75d2cf++){_0x3ebbb1[_0x75d2cf][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x10f'));}return _0x3ebbb1;}));return BPromise[_0xdbbd('0xe7')](_0x2464db);})['then'](function(_0x482930){var _0x2eb56b=_['flatten'](_0x482930);_0x2464db=[];return db[_0xdbbd('0x59')][_0xdbbd('0x110')](function(_0x280bd2){for(var _0x2efc0f=0x0;_0x2efc0f<_0x2eb56b['length'];_0x2efc0f++){_0x2464db[_0xdbbd('0xab')](_0x2eb56b[_0x2efc0f][_0xdbbd('0x111')](_0x5a7a70['id']),{'transaction':_0x280bd2});}return BPromise[_0xdbbd('0xe7')](_0x2464db)['then'](function(){if(_0x5a7a70[_0xdbbd('0x9d')]){return BPromise[_0xdbbd('0xad')](_[_0xdbbd('0x55')](_0x2eb56b,function(_0x193160){return _0x193160['getDataValue'](_0xdbbd('0x9c'))==='Voice';}),function(_0x3b7522){return db[_0xdbbd('0xae')][_0xdbbd('0xaf')]({'membername':_0x5a7a70[_0xdbbd('0x40')],'UserId':_0x5a7a70['id'],'queue_name':_0x3b7522['name'],'VoiceQueueId':_0x3b7522['id'],'interface':_[_0xdbbd('0x70')](_0x5a7a70[_0xdbbd('0xa0')])?util[_0xdbbd('0x72')](_0xdbbd('0xac'),_0x5a7a70[_0xdbbd('0x40')]):_0x5a7a70[_0xdbbd('0xa0')],'paused':_0x5a7a70['voicePause']||![],'penalty':_0x5a7a70[_0xdbbd('0xa6')]},{'transaction':_0x280bd2});});}else{return;}})['then'](function(){for(var _0x31b46d=0x0;_0x31b46d<_0x2eb56b[_0xdbbd('0x62')];_0x31b46d++){var _0x1df635=_0x2eb56b[_0x31b46d][_0xdbbd('0x112')](_0xdbbd('0x9c'));var _0x114e32=_0x1df635+_0xdbbd('0xb1');socket[_0xdbbd('0xa8')](_0xdbbd('0x38')+_0x1df635+_0xdbbd('0x113'),{'UserId':_0x5a7a70['id'],['queueField']:_0x2eb56b[_0x31b46d]['id']});}});});});}});}})[_0xdbbd('0x34')](respondWithStatusCode(_0x5a21ae,null))[_0xdbbd('0x27')](handleError(_0x5a21ae,null));};exports['removeTeams']=function(_0x2c8b07,_0x566542){return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x2c8b07['params']['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x566542,null))[_0xdbbd('0x34')](function(_0x17c8d5){if(_0x17c8d5){var _0xc936ee=_0x17c8d5[_0xdbbd('0x36')]({'plain':!![]});var _0x2cccbb=_0x2c8b07[_0xdbbd('0x4a')][_0xdbbd('0x69')];return _0x17c8d5[_0xdbbd('0x114')](_0x2cccbb)[_0xdbbd('0x34')](function(){for(var _0x12422a=0x0;_0x12422a<_0x2cccbb[_0xdbbd('0x62')];_0x12422a++){var _0x102582=[];db[_0xdbbd('0x104')][_0xdbbd('0xbd')]({'where':{'id':_0x2cccbb[_0x12422a]}})[_0xdbbd('0x34')](function(_0x168594){_0x102582[_0xdbbd('0xab')](_0x168594[_0xdbbd('0x115')]()['then'](function(_0x65f42){for(var _0x3033e8=0x0;_0x3033e8<_0x65f42[_0xdbbd('0x62')];_0x3033e8++){_0x65f42[_0x3033e8][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x106'));}return _0x65f42;}));_0x102582[_0xdbbd('0xab')](_0x168594[_0xdbbd('0x107')]()[_0xdbbd('0x34')](function(_0x28452d){for(var _0x519ba7=0x0;_0x519ba7<_0x28452d[_0xdbbd('0x62')];_0x519ba7++){_0x28452d[_0x519ba7]['setDataValue']('channel',_0xdbbd('0x108'));}return _0x28452d;}));_0x102582[_0xdbbd('0xab')](_0x168594['getMailQueues']()[_0xdbbd('0x34')](function(_0x1e5567){for(var _0x2ce4f9=0x0;_0x2ce4f9<_0x1e5567[_0xdbbd('0x62')];_0x2ce4f9++){_0x1e5567[_0x2ce4f9][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x10a'));}return _0x1e5567;}));_0x102582[_0xdbbd('0xab')](_0x168594[_0xdbbd('0x10b')]()[_0xdbbd('0x34')](function(_0x260c74){for(var _0x1905e2=0x0;_0x1905e2<_0x260c74['length'];_0x1905e2++){_0x260c74[_0x1905e2]['setDataValue']('channel','Sms');}return _0x260c74;}));_0x102582[_0xdbbd('0xab')](_0x168594[_0xdbbd('0x10c')]()[_0xdbbd('0x34')](function(_0x15b854){for(var _0xb2a096=0x0;_0xb2a096<_0x15b854[_0xdbbd('0x62')];_0xb2a096++){_0x15b854[_0xb2a096][_0xdbbd('0x105')](_0xdbbd('0x9c'),_0xdbbd('0x10d'));}return _0x15b854;}));_0x102582[_0xdbbd('0xab')](_0x168594['getOpenchannelQueues']()[_0xdbbd('0x34')](function(_0x40bdee){for(var _0x2ac345=0x0;_0x2ac345<_0x40bdee[_0xdbbd('0x62')];_0x2ac345++){_0x40bdee[_0x2ac345]['setDataValue'](_0xdbbd('0x9c'),_0xdbbd('0x10f'));}return _0x40bdee;}));return BPromise['all'](_0x102582);})['then'](function(_0x2afafa){var _0x671061=_[_0xdbbd('0x116')](_0x2afafa);_0x102582=[];return db['sequelize'][_0xdbbd('0x110')](function(_0x1ccc95){for(var _0x4906ec=0x0;_0x4906ec<_0x671061[_0xdbbd('0x62')];_0x4906ec++){_0x102582[_0xdbbd('0xab')](_0x671061[_0x4906ec][_0xdbbd('0x117')](_0xc936ee['id']),{'transaction':_0x1ccc95});}return BPromise[_0xdbbd('0xe7')](_0x102582)[_0xdbbd('0x34')](function(){if(_0xc936ee[_0xdbbd('0x9d')]){return BPromise[_0xdbbd('0xad')](_[_0xdbbd('0x55')](_0x671061,function(_0x3f31bd){return _0x3f31bd[_0xdbbd('0x112')]('channel')===_0xdbbd('0x106');}),function(_0x5924ea){return db[_0xdbbd('0xae')][_0xdbbd('0x35')]({'where':{'VoiceQueueId':_0x5924ea['id'],'UserId':_0xc936ee['id']},'transaction':_0x1ccc95});});}else{return;}})[_0xdbbd('0x34')](function(){for(var _0x30a226=0x0;_0x30a226<_0x671061[_0xdbbd('0x62')];_0x30a226++){var _0x1f3f26=_0x671061[_0x30a226][_0xdbbd('0x112')]('channel');var _0x4c32cd=_0x1f3f26+_0xdbbd('0xb1');socket['emit'](_0xdbbd('0x38')+_0x1f3f26+_0xdbbd('0x118'),{'UserId':_0xc936ee['id'],['queueField']:_0x671061[_0x30a226]['id']});}});});});}});}})['then'](respondWithStatusCode(_0x566542,null))[_0xdbbd('0x27')](handleError(_0x566542,null));};exports['getLists']=function(_0x385ddb,_0x51643e,_0x3da8d4){var _0x55954d={};var _0x5be23a={};var _0x1d0834;var _0x405df6;return db[_0xdbbd('0x44')][_0xdbbd('0xbd')]({'where':{'id':_0x385ddb[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x51643e,null))['then'](function(_0xc1f9c0){if(_0xc1f9c0){_0x1d0834=_0xc1f9c0;_0x5be23a[_0xdbbd('0x4d')]=_['keys'](db[_0xdbbd('0xbf')][_0xdbbd('0x45')]);_0x5be23a[_0xdbbd('0x4a')]=_[_0xdbbd('0x4b')](_0x385ddb[_0xdbbd('0x4a')]);_0x5be23a['filters']=_['intersection'](_0x5be23a[_0xdbbd('0x4d')],_0x5be23a[_0xdbbd('0x4a')]);_0x55954d[_0xdbbd('0x4f')]=_[_0xdbbd('0x4c')](_0x5be23a[_0xdbbd('0x4d')],qs['fields'](_0x385ddb['query'][_0xdbbd('0x4e')]));_0x55954d['attributes']=_0x55954d['attributes'][_0xdbbd('0x62')]?_0x55954d['attributes']:_0x5be23a['model'];_0x55954d[_0xdbbd('0x51')]=qs['sort'](_0x385ddb['query']['sort']);_0x55954d[_0xdbbd('0x53')]=qs[_0xdbbd('0x54')](_[_0xdbbd('0xc6')](_0x385ddb[_0xdbbd('0x4a')],_0x5be23a[_0xdbbd('0x54')]));if(_0x385ddb[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x55954d[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x55954d[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x55954d[_0xdbbd('0x4f')],function(_0x2c43dc){var _0x534a72={};_0x534a72[_0x2c43dc]={'$like':'%'+_0x385ddb[_0xdbbd('0x4a')]['filter']+'%'};return _0x534a72;})});}_0x55954d=_[_0xdbbd('0x56')]({},_0x55954d,_0x385ddb[_0xdbbd('0x5b')]);return _0x1d0834[_0xdbbd('0x119')](_0x55954d);}})[_0xdbbd('0x34')](function(_0x1b9024){if(_0x1b9024){_0x405df6=_0x1b9024[_0xdbbd('0x62')];if(!_0x385ddb[_0xdbbd('0x4a')][_0xdbbd('0x50')]('nolimit')){_0x55954d[_0xdbbd('0x2e')]=qs['limit'](_0x385ddb[_0xdbbd('0x4a')][_0xdbbd('0x2e')]);_0x55954d[_0xdbbd('0x2d')]=qs['offset'](_0x385ddb[_0xdbbd('0x4a')][_0xdbbd('0x2d')]);}return _0x1d0834[_0xdbbd('0x119')](_0x55954d);}})[_0xdbbd('0x34')](function(_0x507935){if(_0x507935){return _0x507935?{'count':_0x405df6,'rows':_0x507935}:null;}})[_0xdbbd('0x34')](respondWithResult(_0x51643e,null))['catch'](handleError(_0x51643e,null));};exports[_0xdbbd('0x11a')]=function(_0x3a63a8,_0x46641e,_0x255bb3){var _0x346fa5={};var _0x646fa3={};var _0x5b3f2d;var _0x55cd;return db[_0xdbbd('0x44')]['findOne']({'where':{'id':_0x3a63a8[_0xdbbd('0x60')]['id']}})[_0xdbbd('0x34')](handleEntityNotFound(_0x46641e,null))['then'](function(_0x1c80a5){if(_0x1c80a5){_0x5b3f2d=_0x1c80a5;_0x646fa3[_0xdbbd('0x4d')]=_[_0xdbbd('0x4b')](db['User'][_0xdbbd('0x45')]);_0x646fa3['query']=_[_0xdbbd('0x4b')](_0x3a63a8[_0xdbbd('0x4a')]);_0x646fa3[_0xdbbd('0x54')]=_[_0xdbbd('0x4c')](_0x646fa3[_0xdbbd('0x4d')],_0x646fa3[_0xdbbd('0x4a')]);_0x346fa5['attributes']=_['intersection'](_0x646fa3[_0xdbbd('0x4d')],qs[_0xdbbd('0x4e')](_0x3a63a8[_0xdbbd('0x4a')][_0xdbbd('0x4e')]));_0x346fa5[_0xdbbd('0x4f')]=_0x346fa5[_0xdbbd('0x4f')][_0xdbbd('0x62')]?_0x346fa5[_0xdbbd('0x4f')]:_0x646fa3['model'];_0x346fa5[_0xdbbd('0x51')]=qs[_0xdbbd('0x52')](_0x3a63a8[_0xdbbd('0x4a')]['sort']);_0x346fa5['where']=qs['filters'](_['pick'](_0x3a63a8[_0xdbbd('0x4a')],_0x646fa3['filters']));if(_0x3a63a8[_0xdbbd('0x4a')][_0xdbbd('0x55')]){_0x346fa5[_0xdbbd('0x53')]=_[_0xdbbd('0x56')](_0x346fa5[_0xdbbd('0x53')],{'$or':_[_0xdbbd('0x3c')](_0x346fa5['attributes'],function(_0x1f79dc){var _0x8c7d22={};_0x8c7d22[_0x1f79dc]={'$like':'%'+_0x3a63a8['query'][_0xdbbd('0x55')]+'%'};return _0x8c7d22;})});}_0x346fa5['model']=db[_0xdbbd('0x44')];_0x346fa5['as']=_0xdbbd('0x11b');_0x346fa5=_[_0xdbbd('0x56')]({},_0x346fa5,_0x3a63a8[_0xdbbd('0x5b')]);return _0x5b3f2d['getVoiceQueues']({'include':[_0x346fa5]});}})[_0xdbbd('0x34')](function(_0x3cfe81){if(_0x3cfe81){var _0x10f367={},_0x4406a9=[],_0x5a5ee7=0x0;for(var _0x502e38=0x0;_0x502e38<_0x3cfe81[_0xdbbd('0x62')];_0x502e38+=0x1){for(var _0x2b3275=0x0,_0x13f77b;_0x2b3275<_0x3cfe81[_0x502e38]['Agents'][_0xdbbd('0x62')];_0x2b3275+=0x1){_0x13f77b=_0x3cfe81[_0x502e38]['Agents'][_0x2b3275][_0xdbbd('0x36')]({'plain':!![]});_0x10f367[_0x13f77b['id']]=_0x13f77b;}}_0x10f367=_[_0xdbbd('0x11c')](_0x10f367);for(var _0x535040=qs[_0xdbbd('0x2d')](_0x3a63a8[_0xdbbd('0x4a')]['offset']);_0x535040<_0x10f367['length']&&_0x4406a9[_0xdbbd('0x62')]=_0x58bf09[_0x6bb5('0x50')]){throw new Error(_0x6bb5('0x51'));}})[_0x6bb5('0xf')](function(){if(_0x464edd){return db[_0x6bb5('0x52')][_0x6bb5('0x48')]({'where':{'membername':_0x464edd[_0x6bb5('0x27')]},'individualHooks':!![]});}})[_0x6bb5('0xf')](function(){if(_0x464edd){return _0x464edd[_0x6bb5('0x53')]({'raw':!![]});}})[_0x6bb5('0xf')](function(_0x21a974){if(_0x464edd){if(_0x21a974){var _0x42d946=[];_0x42cf33=_0x21a974;if(_0x42cf33[_0x6bb5('0x2c')]){for(var _0x41b0b1=0x0;_0x41b0b1<_0x42cf33[_0x6bb5('0x2c')];_0x41b0b1++){_0x42d946[_0x6bb5('0x31')](db['UserVoiceQueueRt'][_0x6bb5('0x54')]({'membername':_0x464edd[_0x6bb5('0x27')],'UserId':_0x464edd['id'],'queue_name':_0x42cf33[_0x41b0b1][_0x6bb5('0x27')],'VoiceQueueId':_0x42cf33[_0x41b0b1]['id'],'interface':_0x2c1452,'paused':_0x464edd[_0x6bb5('0x55')]||![],'penalty':_0x42cf33[_0x41b0b1][_0x6bb5('0x56')]||0x0}));}return BPromise[_0x6bb5('0x45')](_0x42d946);}}}})[_0x6bb5('0xf')](function(){if(_0x464edd){return db[_0x6bb5('0x35')][_0x6bb5('0x2a')]({'where':{'membername':_0x464edd[_0x6bb5('0x27')],'exitAt':null}});}})[_0x6bb5('0xf')](function(_0x1ee51a){if(_0x464edd){if(_0x1ee51a&&_0x1ee51a['length']){var _0xb788a8=[];_0x1ee51a['forEach'](function(_0x25bcb6){_0xb788a8['push'](_0x25bcb6[_0x6bb5('0x37')]({'exitAt':moment()['format'](_0x6bb5('0x2e'))}));});return BPromise['all'](_0xb788a8);}}})[_0x6bb5('0xf')](function(_0x102171){if(_0x464edd){var _0x5c715a=[];var _0x469a78=[];var _0x5bb48f=utils['getChannels']();var _0x305c03={'membername':_0x464edd[_0x6bb5('0x27')],'interface':_0x2c1452,'enterAt':moment()[_0x6bb5('0x2d')](_0x6bb5('0x2e')),'role':_0x464edd[_0x6bb5('0x4a')],'internal':_0x464edd['internal']};_0x5bb48f[_0x6bb5('0x30')](function(_0x4f5c6f){_0x5c715a[_0x6bb5('0x31')](_[_0x6bb5('0x57')]({'channel':_0x4f5c6f,'type':_0x6bb5('0x58'),'data1':_0x6bb5('0x59'),'data2':_0x2c1452},_0x305c03));if(_0x464edd[_0x6bb5('0x55')]){_0x469a78[_0x6bb5('0x31')](_[_0x6bb5('0x57')]({'channel':_0x4f5c6f,'type':_0x6bb5('0x2b'),'data1':_0x6bb5('0x5a')},_0x305c03));}});return db[_0x6bb5('0x35')][_0x6bb5('0x36')](_0x5c715a[_0x6bb5('0x5b')](_0x469a78),{'individualHooks':!![]});}})[_0x6bb5('0xf')](function(){if(_0x464edd){return _0x464edd[_0x6bb5('0x37')]({'online':!![],'lastLoginAt':moment()[_0x6bb5('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'voicePause':_0x464edd[_0x6bb5('0x55')]||![],'mailPause':_0x464edd['loginInPause']||![],'chatPause':_0x464edd[_0x6bb5('0x55')]||![],'faxPause':_0x464edd[_0x6bb5('0x55')]||![],'smsPause':_0x464edd[_0x6bb5('0x55')]||![],'openchannelPause':_0x464edd['loginInPause']||![],'pauseType':_0x464edd[_0x6bb5('0x55')]?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x6bb5('0x2d')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x2c1452});}})['then'](function(_0x594fa0){_0x2d8bf9(_0x594fa0);})[_0x6bb5('0x18')](function(_0x30a4f3){_0x56c8fb(_0x7a6127[_0x6bb5('0x14')](0x1f4,_0x30a4f3[_0x6bb5('0x16')]));});});}; \ No newline at end of file +var _0x4337=['../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','upsert','loginInPause','UserVoiceQueue.penalty','merge','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./user.socket','register','debug','User,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','User,\x20%s,\x20%s','message','info','result','catch','GetUser','User','findAll','raw','options','map','include','model','attributes','stringify','ShowUser','find','where','then','PauseUser','name','internal','UserVoiceQueueRt','update','PAUSE','YYYY-MM-DD\x20HH:mm:ss','length','updateAttributes','getChannels','forEach','push','isNil','interface','format','SIP/%s','body','type','role','uniqueid','MemberReport','bulkCreate','DEFAULT\x20PAUSE','UnpauseUser','findOne','channel','isValidChannel','system','mail','chat','sms','openchannel','set','Pause','all','LogoutUser','destroy','LoginUser','count'];(function(_0x58e7ef,_0x1c64b4){var _0x56f2da=function(_0x29141b){while(--_0x29141b){_0x58e7ef['push'](_0x58e7ef['shift']());}};_0x56f2da(++_0x1c64b4);}(_0x4337,0x17f));var _0x7433=function(_0x505b2b,_0x4facfb){_0x505b2b=_0x505b2b-0x0;var _0x1d6072=_0x4337[_0x505b2b];return _0x1d6072;};'use strict';var _=require(_0x7433('0x0'));var util=require(_0x7433('0x1'));var moment=require(_0x7433('0x2'));var BPromise=require(_0x7433('0x3'));var rs=require(_0x7433('0x4'));var fs=require('fs');var Redis=require(_0x7433('0x5'));var db=require(_0x7433('0x6'))['db'];var utils=require(_0x7433('0x7'));var logger=require(_0x7433('0x8'))(_0x7433('0x9'));var config=require(_0x7433('0xa'));var jayson=require(_0x7433('0xb'));var client=jayson['client'][_0x7433('0xc')]({'port':0x232a});config[_0x7433('0xd')]=_[_0x7433('0xe')](config[_0x7433('0xd')],{'host':_0x7433('0xf'),'port':0x18eb});var socket=require(_0x7433('0x10'))(new Redis(config[_0x7433('0xd')]));require(_0x7433('0x11'))[_0x7433('0x12')](socket);function respondWithRpcPromise(_0x53bd5d,_0x3a08ab,_0x5d0c68){return new BPromise(function(_0x387632,_0x2265d4){return client['request'](_0x53bd5d,_0x5d0c68)['then'](function(_0x4e0f24){logger['info']('User,\x20%s,\x20%s',_0x3a08ab,'request\x20sent');logger[_0x7433('0x13')](_0x7433('0x14'),_0x3a08ab,_0x7433('0x15'),JSON['stringify'](_0x4e0f24));if(_0x4e0f24[_0x7433('0x16')]){if(_0x4e0f24['error'][_0x7433('0x17')]===0x1f4){logger[_0x7433('0x16')](_0x7433('0x18'),_0x3a08ab,_0x4e0f24[_0x7433('0x16')]['message']);return _0x2265d4(_0x4e0f24[_0x7433('0x16')][_0x7433('0x19')]);}logger[_0x7433('0x16')](_0x7433('0x18'),_0x3a08ab,_0x4e0f24[_0x7433('0x16')][_0x7433('0x19')]);return _0x387632(_0x4e0f24[_0x7433('0x16')]['message']);}else{logger[_0x7433('0x1a')](_0x7433('0x18'),_0x3a08ab,_0x7433('0x15'));_0x387632(_0x4e0f24[_0x7433('0x1b')]['message']);}})[_0x7433('0x1c')](function(_0x8429c3){logger[_0x7433('0x16')](_0x7433('0x18'),_0x3a08ab,_0x8429c3);_0x2265d4(_0x8429c3);});});}exports[_0x7433('0x1d')]=function(_0x18c4bc){var _0x27c52f=this;return new Promise(function(_0xb1be5b,_0x33fa5e){return db[_0x7433('0x1e')][_0x7433('0x1f')]({'raw':_0x18c4bc['options']?_0x18c4bc['options'][_0x7433('0x20')]===undefined?!![]:![]:!![],'where':_0x18c4bc[_0x7433('0x21')]?_0x18c4bc['options']['where']||null:null,'attributes':_0x18c4bc[_0x7433('0x21')]?_0x18c4bc[_0x7433('0x21')]['attributes']||null:null,'limit':_0x18c4bc[_0x7433('0x21')]?_0x18c4bc[_0x7433('0x21')]['limit']||null:null,'include':_0x18c4bc[_0x7433('0x21')]?_0x18c4bc['options']['include']?_[_0x7433('0x22')](_0x18c4bc['options'][_0x7433('0x23')],function(_0x36d43f){return{'model':db[_0x36d43f[_0x7433('0x24')]],'as':_0x36d43f['as'],'attributes':_0x36d43f[_0x7433('0x25')],'include':_0x36d43f[_0x7433('0x23')]?_[_0x7433('0x22')](_0x36d43f[_0x7433('0x23')],function(_0x44679b){return{'model':db[_0x44679b[_0x7433('0x24')]],'as':_0x44679b['as'],'attributes':_0x44679b[_0x7433('0x25')],'include':_0x44679b[_0x7433('0x23')]?_[_0x7433('0x22')](_0x44679b[_0x7433('0x23')],function(_0x365e23){return{'model':db[_0x365e23[_0x7433('0x24')]],'as':_0x365e23['as'],'attributes':_0x365e23[_0x7433('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b5434){logger['info'](_0x7433('0x1d'),_0x18c4bc);logger[_0x7433('0x13')](_0x7433('0x1d'),_0x18c4bc,JSON[_0x7433('0x26')](_0x3b5434));_0xb1be5b(_0x3b5434);})[_0x7433('0x1c')](function(_0x557bc9){logger[_0x7433('0x16')]('GetUser',_0x557bc9['message'],_0x18c4bc);_0x33fa5e(_0x27c52f[_0x7433('0x16')](0x1f4,_0x557bc9['message']));});});};exports[_0x7433('0x27')]=function(_0x35e8c6){var _0x36954d=this;return new Promise(function(_0x57b18b,_0x237356){return db[_0x7433('0x1e')][_0x7433('0x28')]({'raw':_0x35e8c6[_0x7433('0x21')]?_0x35e8c6[_0x7433('0x21')][_0x7433('0x20')]===undefined?!![]:![]:!![],'where':_0x35e8c6['options']?_0x35e8c6[_0x7433('0x21')][_0x7433('0x29')]||null:null,'attributes':_0x35e8c6[_0x7433('0x21')]?_0x35e8c6[_0x7433('0x21')]['attributes']||null:null,'include':_0x35e8c6[_0x7433('0x21')]?_0x35e8c6[_0x7433('0x21')]['include']?_['map'](_0x35e8c6[_0x7433('0x21')][_0x7433('0x23')],function(_0x33c793){return{'model':db[_0x33c793[_0x7433('0x24')]],'as':_0x33c793['as'],'attributes':_0x33c793['attributes'],'include':_0x33c793[_0x7433('0x23')]?_[_0x7433('0x22')](_0x33c793[_0x7433('0x23')],function(_0x44ccae){return{'model':db[_0x44ccae[_0x7433('0x24')]],'as':_0x44ccae['as'],'attributes':_0x44ccae['attributes'],'include':_0x44ccae['include']?_[_0x7433('0x22')](_0x44ccae[_0x7433('0x23')],function(_0x5c22ba){return{'model':db[_0x5c22ba['model']],'as':_0x5c22ba['as'],'attributes':_0x5c22ba[_0x7433('0x25')]};}):[]};}):[]};}):[]:[]})[_0x7433('0x2a')](function(_0x548325){logger['info'](_0x7433('0x27'),_0x35e8c6);logger[_0x7433('0x13')](_0x7433('0x27'),_0x35e8c6,JSON[_0x7433('0x26')](_0x548325));_0x57b18b(_0x548325);})[_0x7433('0x1c')](function(_0x45088b){logger[_0x7433('0x16')](_0x7433('0x27'),_0x45088b[_0x7433('0x19')],_0x35e8c6);_0x237356(_0x36954d['error'](0x1f4,_0x45088b[_0x7433('0x19')]));});});};exports[_0x7433('0x2b')]=function(_0x21e38a){var _0x1ad5c8=this;return new Promise(function(_0x4c7d55,_0x2dc6fb){var _0x432697;return db[_0x7433('0x1e')][_0x7433('0x28')]({'where':_0x21e38a[_0x7433('0x21')]['where']||{},'attributes':['id',_0x7433('0x2c'),'role',_0x7433('0x2d'),'interface']})[_0x7433('0x2a')](function(_0x479374){if(_0x479374){_0x432697=_0x479374;return db[_0x7433('0x2e')][_0x7433('0x2f')]({'paused':0x1},{'where':{'UserId':_0x432697['id']},'individualHooks':!![]});}})[_0x7433('0x2a')](function(){if(_0x432697){return db['MemberReport'][_0x7433('0x1f')]({'where':{'membername':_0x432697[_0x7433('0x2c')],'type':_0x7433('0x30'),'exitAt':null}});}})[_0x7433('0x2a')](function(_0x101778){if(_0x432697){if(_0x101778&&_0x101778['length']){var _0x130546=moment()['format'](_0x7433('0x31'));for(var _0x3f94ad=0x0,_0x4cc524=_0x101778[_0x7433('0x32')];_0x3f94ad<_0x4cc524;_0x3f94ad++){_0x101778[_0x3f94ad][_0x7433('0x33')]({'exitAt':_0x130546});}}}})[_0x7433('0x2a')](function(){if(_0x432697){var _0xf6b8cf=[];var _0x50b6b0=utils[_0x7433('0x34')]();_0x50b6b0[_0x7433('0x35')](function(_0x2fa1ed){_0xf6b8cf[_0x7433('0x36')]({'channel':_0x2fa1ed,'membername':_0x432697['name'],'interface':_[_0x7433('0x37')](_0x432697[_0x7433('0x38')])?util[_0x7433('0x39')](_0x7433('0x3a'),_0x432697['name']):_0x432697[_0x7433('0x38')],'type':_0x7433('0x30'),'enterAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x21e38a[_0x7433('0x3b')][_0x7433('0x3c')]||'DEFAULT\x20PAUSE','role':_0x432697[_0x7433('0x3d')],'internal':_0x432697[_0x7433('0x2d')],'uniqueid':_0x21e38a[_0x7433('0x3b')][_0x7433('0x3e')]||null});});return db[_0x7433('0x3f')][_0x7433('0x40')](_0xf6b8cf,{'individualHooks':!![]});}})[_0x7433('0x2a')](function(){if(_0x432697){return _0x432697[_0x7433('0x2f')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'pauseType':_0x21e38a['body'][_0x7433('0x3c')]||_0x7433('0x41'),'lastPauseAt':moment()[_0x7433('0x39')]('YYYY-MM-DD\x20HH:mm:ss')});}})['then'](function(_0x57d6b7){_0x4c7d55(_0x57d6b7);})[_0x7433('0x1c')](function(_0x59cbc9){_0x2dc6fb(_0x1ad5c8[_0x7433('0x16')](0x1f4,_0x59cbc9['message']));});});};exports[_0x7433('0x42')]=function(_0x269ce4){var _0x235d31=this;return new Promise(function(_0x158048,_0x15bc47){var _0x43ed33;return db[_0x7433('0x1e')][_0x7433('0x43')]({'where':_0x269ce4[_0x7433('0x21')][_0x7433('0x29')]||{},'attributes':['id',_0x7433('0x2c')]})[_0x7433('0x2a')](function(_0xdcd02){if(_0xdcd02){_0x43ed33=_0xdcd02;if(_0x269ce4[_0x7433('0x3b')][_0x7433('0x44')]&&!utils[_0x7433('0x45')](_0x269ce4[_0x7433('0x3b')][_0x7433('0x44')])){throw new Error('Unknown\x20channel');}switch(_0x269ce4[_0x7433('0x3b')]['channel']){case'voice':return db[_0x7433('0x2e')][_0x7433('0x2f')]({'paused':0x0},{'where':{'UserId':_0x43ed33['id']}})[_0x7433('0x2a')](function(){return db[_0x7433('0x3f')][_0x7433('0x28')]({'where':{'channel':_0x269ce4[_0x7433('0x3b')][_0x7433('0x44')],'membername':_0x43ed33[_0x7433('0x2c')],'type':_0x7433('0x30'),'exitAt':null}});})[_0x7433('0x2a')](function(_0x103181){if(_0x103181){return _0x103181[_0x7433('0x2f')]({'exitAt':moment()['format'](_0x7433('0x31')),'data2':_0x7433('0x46')},{'individualHooks':!![]});}return null;})[_0x7433('0x2a')](function(){return _0x43ed33[_0x7433('0x2f')]({'voicePause':![]});});case _0x7433('0x47'):case _0x7433('0x48'):case'fax':case _0x7433('0x49'):case _0x7433('0x4a'):return db['MemberReport'][_0x7433('0x28')]({'where':{'channel':_0x269ce4[_0x7433('0x3b')][_0x7433('0x44')],'membername':_0x43ed33[_0x7433('0x2c')],'type':'PAUSE','exitAt':null}})['then'](function(_0x3360c2){return _0x3360c2[_0x7433('0x2f')]({'exitAt':moment()[_0x7433('0x39')](_0x7433('0x31')),'data2':'system'},{'individualHooks':!![]});})[_0x7433('0x2a')](function(){var _0x40a06c={};_[_0x7433('0x4b')](_0x40a06c,util['format']('%s%s',_0x269ce4[_0x7433('0x3b')][_0x7433('0x44')],_0x7433('0x4c')),![]);return _0x43ed33[_0x7433('0x2f')](_0x40a06c);});default:return db[_0x7433('0x2e')][_0x7433('0x2f')]({'paused':0x0},{'where':{'UserId':_0x43ed33['id']}})[_0x7433('0x2a')](function(){return db['MemberReport']['findAll']({'where':{'membername':_0x43ed33['name'],'type':_0x7433('0x30'),'exitAt':null}});})[_0x7433('0x2a')](function(_0x33729d){var _0x13333a=[];_0x33729d[_0x7433('0x35')](function(_0xd3f338){_0x13333a[_0x7433('0x36')](_0xd3f338[_0x7433('0x2f')]({'exitAt':moment()[_0x7433('0x39')](_0x7433('0x31')),'data2':_0x7433('0x46')}));});return BPromise[_0x7433('0x4d')](_0x13333a);})[_0x7433('0x2a')](function(){return _0x43ed33[_0x7433('0x2f')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});});}}})[_0x7433('0x2a')](function(_0x40a2d7){_0x158048(_0x40a2d7);})[_0x7433('0x1c')](function(_0x1d0e8a){_0x15bc47(_0x235d31[_0x7433('0x16')](0x1f4,_0x1d0e8a[_0x7433('0x19')]));});});};exports[_0x7433('0x4e')]=function(_0x3a3bb7){var _0x29042d=this;return new Promise(function(_0x443171,_0x5d9811){var _0x264e10;return db['User']['findOne']({'where':_0x3a3bb7[_0x7433('0x21')][_0x7433('0x29')]||{},'attributes':['id',_0x7433('0x2c')]})[_0x7433('0x2a')](function(_0x1311ea){if(_0x1311ea){_0x264e10=_0x1311ea;return db[_0x7433('0x2e')][_0x7433('0x4f')]({'where':{'membername':_0x264e10[_0x7433('0x2c')]},'individualHooks':!![]});}})[_0x7433('0x2a')](function(){if(_0x264e10){return db[_0x7433('0x3f')]['findAll']({'where':{'membername':_0x264e10['name'],'exitAt':null}});}})[_0x7433('0x2a')](function(_0x460839){if(_0x264e10){if(_0x460839&&_0x460839['length']){var _0x4261f2=[];_0x460839[_0x7433('0x35')](function(_0x3e294c){_0x4261f2[_0x7433('0x36')](_0x3e294c['update']({'exitAt':moment()[_0x7433('0x39')](_0x7433('0x31'))}));});return BPromise['all'](_0x4261f2);}}})[_0x7433('0x2a')](function(){if(_0x264e10){return _0x264e10['update']({'online':![],'lastLoginAt':null,'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x7433('0x2a')](function(_0x35c3a4){_0x443171(_0x35c3a4);})['catch'](function(_0x5526e8){_0x5d9811(_0x29042d[_0x7433('0x16')](0x1f4,_0x5526e8[_0x7433('0x19')]));});});};exports[_0x7433('0x50')]=function(_0x38b53e){var _0x304fab=this;return new Promise(function(_0x4156cf,_0x9653e3){var _0x522000;var _0x56a6c1;var _0x723c5d;var _0x50af54;return db[_0x7433('0x1e')][_0x7433('0x43')]({'where':_0x38b53e[_0x7433('0x21')][_0x7433('0x29')]||{},'attributes':['id',_0x7433('0x2c'),_0x7433('0x3d'),'mobile','phone',_0x7433('0x2d'),'loginInPause',_0x7433('0x38')]})[_0x7433('0x2a')](function(_0x1bb7d8){if(_0x1bb7d8){_0x522000=_0x1bb7d8;_0x50af54=_0x38b53e[_0x7433('0x3b')][_0x7433('0x38')]?_0x38b53e[_0x7433('0x3b')][_0x7433('0x38')]:util[_0x7433('0x39')]('SIP/%s',_0x522000[_0x7433('0x2c')]);return db[_0x7433('0x1e')][_0x7433('0x51')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x522000['id']}}});}})[_0x7433('0x2a')](function(_0x5a8b63){if(_0x5a8b63){_0x723c5d=_0x5a8b63;return require(_0x7433('0x52'))[_0x7433('0x53')]();}})['then'](function(_0x23fe9a){if(_0x23fe9a&&_0x23fe9a[_0x7433('0x54')]&&_0x723c5d>=_0x23fe9a[_0x7433('0x54')]){throw new Error(_0x7433('0x55'));}})[_0x7433('0x2a')](function(){if(_0x522000){return db[_0x7433('0x2e')][_0x7433('0x4f')]({'where':{'membername':_0x522000[_0x7433('0x2c')]},'individualHooks':!![]});}})[_0x7433('0x2a')](function(){if(_0x522000){return _0x522000['getVoiceQueues']({'raw':!![]});}})[_0x7433('0x2a')](function(_0x335fa0){if(_0x522000){if(_0x335fa0){var _0x302ad2=[];_0x56a6c1=_0x335fa0;if(_0x56a6c1[_0x7433('0x32')]){for(var _0x22b9cf=0x0;_0x22b9cf<_0x56a6c1[_0x7433('0x32')];_0x22b9cf++){_0x302ad2[_0x7433('0x36')](db[_0x7433('0x2e')][_0x7433('0x56')]({'membername':_0x522000[_0x7433('0x2c')],'UserId':_0x522000['id'],'queue_name':_0x56a6c1[_0x22b9cf][_0x7433('0x2c')],'VoiceQueueId':_0x56a6c1[_0x22b9cf]['id'],'interface':_0x50af54,'paused':_0x522000[_0x7433('0x57')]||![],'penalty':_0x56a6c1[_0x22b9cf][_0x7433('0x58')]||0x0}));}return BPromise[_0x7433('0x4d')](_0x302ad2);}}}})['then'](function(){if(_0x522000){return db[_0x7433('0x3f')][_0x7433('0x1f')]({'where':{'membername':_0x522000[_0x7433('0x2c')],'exitAt':null}});}})['then'](function(_0x1a3e50){if(_0x522000){if(_0x1a3e50&&_0x1a3e50['length']){var _0x2b8bbc=[];_0x1a3e50[_0x7433('0x35')](function(_0x8a77c){_0x2b8bbc['push'](_0x8a77c[_0x7433('0x2f')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0x7433('0x4d')](_0x2b8bbc);}}})[_0x7433('0x2a')](function(_0x53f847){if(_0x522000){var _0x3acae7=[];var _0xe11a72=[];var _0x571bff=utils[_0x7433('0x34')]();var _0x3f2a95={'membername':_0x522000[_0x7433('0x2c')],'interface':_0x50af54,'enterAt':moment()[_0x7433('0x39')](_0x7433('0x31')),'role':_0x522000[_0x7433('0x3d')],'internal':_0x522000[_0x7433('0x2d')]};_0x571bff['forEach'](function(_0x59c7e6){_0x3acae7[_0x7433('0x36')](_[_0x7433('0x59')]({'channel':_0x59c7e6,'type':'LOGIN','data1':_0x7433('0x5a'),'data2':_0x50af54},_0x3f2a95));if(_0x522000[_0x7433('0x57')]){_0xe11a72[_0x7433('0x36')](_[_0x7433('0x59')]({'channel':_0x59c7e6,'type':_0x7433('0x30'),'data1':_0x7433('0x5b')},_0x3f2a95));}});return db[_0x7433('0x3f')][_0x7433('0x40')](_0x3acae7[_0x7433('0x5c')](_0xe11a72),{'individualHooks':!![]});}})[_0x7433('0x2a')](function(){if(_0x522000){return _0x522000[_0x7433('0x2f')]({'online':!![],'lastLoginAt':moment()['format'](_0x7433('0x31')),'voicePause':_0x522000[_0x7433('0x57')]||![],'mailPause':_0x522000[_0x7433('0x57')]||![],'chatPause':_0x522000[_0x7433('0x57')]||![],'faxPause':_0x522000['loginInPause']||![],'smsPause':_0x522000[_0x7433('0x57')]||![],'openchannelPause':_0x522000[_0x7433('0x57')]||![],'pauseType':_0x522000[_0x7433('0x57')]?_0x7433('0x5b'):null,'lastPauseAt':moment()['format'](_0x7433('0x31')),'interface':_0x50af54});}})[_0x7433('0x2a')](function(_0x39d228){_0x4156cf(_0x39d228);})[_0x7433('0x1c')](function(_0x3e3d56){_0x9653e3(_0x304fab['error'](0x1f4,_0x3e3d56[_0x7433('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index cf0ce5e..be78686 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 _0x38da=['update','removeListener','register','length','user:','save','remove'];(function(_0x23884b,_0x50c307){var _0x28113b=function(_0xce3fea){while(--_0xce3fea){_0x23884b['push'](_0x23884b['shift']());}};_0x28113b(++_0x50c307);}(_0x38da,0x8a));var _0xa38d=function(_0x3ae38e,_0x3aaa14){_0x3ae38e=_0x3ae38e-0x0;var _0x483595=_0x38da[_0x3ae38e];return _0x483595;};'use strict';var UserEvents=require('./user.events');var events=[_0xa38d('0x0'),_0xa38d('0x1'),_0xa38d('0x2')];function createListener(_0x5bf4fb,_0xdab8e){return function(_0x48f34b){_0xdab8e['emit'](_0x5bf4fb,_0x48f34b);};}function removeListener(_0x33ce43,_0x352836){return function(){UserEvents[_0xa38d('0x3')](_0x33ce43,_0x352836);};}exports[_0xa38d('0x4')]=function(_0x281a73){for(var _0x401b21=0x0,_0x4a9e36=events[_0xa38d('0x5')];_0x401b21<_0x4a9e36;_0x401b21++){var _0x273763=events[_0x401b21];var _0x542e20=createListener(_0xa38d('0x6')+_0x273763,_0x281a73);UserEvents['on'](_0x273763,_0x542e20);}}; \ No newline at end of file +var _0xa1b0=['remove','update','emit','register','user:','./user.events','save'];(function(_0x39106e,_0x586f3d){var _0x892aec=function(_0xded1b5){while(--_0xded1b5){_0x39106e['push'](_0x39106e['shift']());}};_0x892aec(++_0x586f3d);}(_0xa1b0,0x1c5));var _0x0a1b=function(_0x42ba84,_0x4a3c10){_0x42ba84=_0x42ba84-0x0;var _0x22a316=_0xa1b0[_0x42ba84];return _0x22a316;};'use strict';var UserEvents=require(_0x0a1b('0x0'));var events=[_0x0a1b('0x1'),_0x0a1b('0x2'),_0x0a1b('0x3')];function createListener(_0x57a75d,_0x1726a6){return function(_0x4ad999){_0x1726a6[_0x0a1b('0x4')](_0x57a75d,_0x4ad999);};}function removeListener(_0x5c4e51,_0x284336){return function(){UserEvents['removeListener'](_0x5c4e51,_0x284336);};}exports[_0x0a1b('0x5')]=function(_0x1560f4){for(var _0x3f22e1=0x0,_0x446b8d=events['length'];_0x3f22e1<_0x446b8d;_0x3f22e1++){var _0x5a2a62=events[_0x3f22e1];var _0x599af8=createListener(_0x0a1b('0x6')+_0x5a2a62,_0x1560f4);UserEvents['on'](_0x5a2a62,_0x599af8);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index 2c760bf..eeaf52b 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 _0x6c13=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router'];(function(_0x44deee,_0x191c21){var _0x2d015a=function(_0x2005dd){while(--_0x2005dd){_0x44deee['push'](_0x44deee['shift']());}};_0x2d015a(++_0x191c21);}(_0x6c13,0xb4));var _0x36c1=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x6c13[_0x413feb];return _0x40ee88;};'use strict';var multer=require(_0x36c1('0x0'));var util=require(_0x36c1('0x1'));var path=require('path');var timeout=require(_0x36c1('0x2'));var express=require('express');var router=express[_0x36c1('0x3')]();var auth=require(_0x36c1('0x4'));var interaction=require(_0x36c1('0x5'));var config=require(_0x36c1('0x6'));module[_0x36c1('0x7')]=router; \ No newline at end of file +var _0x2cb0=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','path','connect-timeout'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x2cb0,0x1cc));var _0x02cb=function(_0x1329c2,_0x14c07){_0x1329c2=_0x1329c2-0x0;var _0xc675f1=_0x2cb0[_0x1329c2];return _0xc675f1;};'use strict';var multer=require(_0x02cb('0x0'));var util=require(_0x02cb('0x1'));var path=require(_0x02cb('0x2'));var timeout=require(_0x02cb('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x02cb('0x4'));var interaction=require(_0x02cb('0x5'));var config=require(_0x02cb('0x6'));module[_0x02cb('0x7')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index e3e162d..3474887 100644 --- a/server/api/userChatQueue/userChatQueue.attributes.js +++ b/server/api/userChatQueue/userChatQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x4c8240,_0x2726cb){var _0x197de3=function(_0x7aa97c){while(--_0x7aa97c){_0x4c8240['push'](_0x4c8240['shift']());}};_0x197de3(++_0x2726cb);}(_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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x58d792,_0x18b0f8){var _0x3b7f69=function(_0x47d324){while(--_0x47d324){_0x58d792['push'](_0x58d792['shift']());}};_0x3b7f69(++_0x18b0f8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 23fc6de..dd8ddb1 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 _0xe77c=['UserChatQueue','user_has_chat_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userChatQueue.attributes'];(function(_0x55db3b,_0x15f413){var _0x2412dc=function(_0x45caa7){while(--_0x45caa7){_0x55db3b['push'](_0x55db3b['shift']());}};_0x2412dc(++_0x15f413);}(_0xe77c,0x176));var _0xce77=function(_0x3dc30d,_0x3eee3c){_0x3dc30d=_0x3dc30d-0x0;var _0x225236=_0xe77c[_0x3dc30d];return _0x225236;};'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 +var _0x0e5a=['exports','define','UserChatQueue','user_has_chat_queues','lodash','util','moment','bluebird','request-promise','path','../../config/environment','./userChatQueue.attributes'];(function(_0x298bd1,_0x28f9d3){var _0x413aa6=function(_0x285a37){while(--_0x285a37){_0x298bd1['push'](_0x298bd1['shift']());}};_0x413aa6(++_0x28f9d3);}(_0x0e5a,0x70));var _0xa0e5=function(_0x5b84d9,_0x1bddf8){_0x5b84d9=_0x5b84d9-0x0;var _0x38a9b2=_0x0e5a[_0x5b84d9];return _0x38a9b2;};'use strict';var _=require(_0xa0e5('0x0'));var util=require(_0xa0e5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa0e5('0x2'));var BPromise=require(_0xa0e5('0x3'));var rp=require(_0xa0e5('0x4'));var fs=require('fs');var path=require(_0xa0e5('0x5'));var rimraf=require('rimraf');var config=require(_0xa0e5('0x6'));var attributes=require(_0xa0e5('0x7'));module[_0xa0e5('0x8')]=function(_0x51deae,_0x49182b){return _0x51deae[_0xa0e5('0x9')](_0xa0e5('0xa'),attributes,{'tableName':_0xa0e5('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 eff0e1b..2d5c730 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 _0xe6a4=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xe6a4,0x7f));var _0x4e6a=function(_0x175bc6,_0xd90ea1){_0x175bc6=_0x175bc6-0x0;var _0x47cfc8=_0xe6a4[_0x175bc6];return _0x47cfc8;};'use strict';var _=require('lodash');var util=require(_0x4e6a('0x0'));var moment=require(_0x4e6a('0x1'));var BPromise=require(_0x4e6a('0x2'));var rs=require(_0x4e6a('0x3'));var fs=require('fs');var Redis=require(_0x4e6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4e6a('0x5'));var logger=require(_0x4e6a('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4e6a('0x7'));var client=jayson[_0x4e6a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x7bd966,_0x505463,_0x57814b){return new BPromise(function(_0x56f84b,_0xe7663d){return client[_0x4e6a('0x9')](_0x7bd966,_0x57814b)['then'](function(_0x5c6f88){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x505463,'request\x20sent');logger[_0x4e6a('0xa')](_0x4e6a('0xb'),_0x505463,_0x4e6a('0xc'),JSON[_0x4e6a('0xd')](_0x5c6f88));if(_0x5c6f88['error']){if(_0x5c6f88[_0x4e6a('0xe')][_0x4e6a('0xf')]===0x1f4){logger[_0x4e6a('0xe')](_0x4e6a('0x10'),_0x505463,_0x5c6f88[_0x4e6a('0xe')][_0x4e6a('0x11')]);return _0xe7663d(_0x5c6f88['error'][_0x4e6a('0x11')]);}logger[_0x4e6a('0xe')](_0x4e6a('0x10'),_0x505463,_0x5c6f88[_0x4e6a('0xe')][_0x4e6a('0x11')]);return _0x56f84b(_0x5c6f88[_0x4e6a('0xe')][_0x4e6a('0x11')]);}else{logger[_0x4e6a('0x12')](_0x4e6a('0x10'),_0x505463,_0x4e6a('0xc'));_0x56f84b(_0x5c6f88[_0x4e6a('0x13')][_0x4e6a('0x11')]);}})[_0x4e6a('0x14')](function(_0x2e10b5){logger[_0x4e6a('0xe')](_0x4e6a('0x10'),_0x505463,_0x2e10b5);_0xe7663d(_0x2e10b5);});});} \ No newline at end of file +var _0x32c0=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash'];(function(_0x1fc41b,_0x563845){var _0x2d2bee=function(_0x2f47b1){while(--_0x2f47b1){_0x1fc41b['push'](_0x1fc41b['shift']());}};_0x2d2bee(++_0x563845);}(_0x32c0,0x1a3));var _0x032c=function(_0x280cc2,_0x4edcbb){_0x280cc2=_0x280cc2-0x0;var _0x251cc9=_0x32c0[_0x280cc2];return _0x251cc9;};'use strict';var _=require(_0x032c('0x0'));var util=require('util');var moment=require(_0x032c('0x1'));var BPromise=require('bluebird');var rs=require(_0x032c('0x2'));var fs=require('fs');var Redis=require(_0x032c('0x3'));var db=require(_0x032c('0x4'))['db'];var utils=require(_0x032c('0x5'));var logger=require(_0x032c('0x6'))(_0x032c('0x7'));var config=require(_0x032c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x032c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56942f,_0x2e1aee,_0x476188){return new BPromise(function(_0x1216c9,_0x5d7670){return client[_0x032c('0xa')](_0x56942f,_0x476188)[_0x032c('0xb')](function(_0x52f8c2){logger[_0x032c('0xc')](_0x032c('0xd'),_0x2e1aee,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2e1aee,_0x032c('0xe'),JSON[_0x032c('0xf')](_0x52f8c2));if(_0x52f8c2[_0x032c('0x10')]){if(_0x52f8c2[_0x032c('0x10')][_0x032c('0x11')]===0x1f4){logger['error'](_0x032c('0xd'),_0x2e1aee,_0x52f8c2['error'][_0x032c('0x12')]);return _0x5d7670(_0x52f8c2['error'][_0x032c('0x12')]);}logger[_0x032c('0x10')](_0x032c('0xd'),_0x2e1aee,_0x52f8c2[_0x032c('0x10')][_0x032c('0x12')]);return _0x1216c9(_0x52f8c2[_0x032c('0x10')]['message']);}else{logger[_0x032c('0xc')](_0x032c('0xd'),_0x2e1aee,_0x032c('0xe'));_0x1216c9(_0x52f8c2[_0x032c('0x13')]['message']);}})['catch'](function(_0x75f051){logger[_0x032c('0x10')](_0x032c('0xd'),_0x2e1aee,_0x75f051);_0x5d7670(_0x75f051);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index beaddd3..29323ae 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 _0x6076=['path','connect-timeout','express','Router','../../components/interaction/service','multer','util'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x6076,0xb4));var _0x6607=function(_0x12cd7b,_0x22af03){_0x12cd7b=_0x12cd7b-0x0;var _0x2358a0=_0x6076[_0x12cd7b];return _0x2358a0;};'use strict';var multer=require(_0x6607('0x0'));var util=require(_0x6607('0x1'));var path=require(_0x6607('0x2'));var timeout=require(_0x6607('0x3'));var express=require(_0x6607('0x4'));var router=express[_0x6607('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0x6607('0x6'));var config=require('../../config/environment');module['exports']=router; \ No newline at end of file +var _0x0132=['../../components/auth/service','../../config/environment','exports','multer','util','connect-timeout','express','Router'];(function(_0x565ed7,_0x398228){var _0x183ad7=function(_0x5a43d7){while(--_0x5a43d7){_0x565ed7['push'](_0x565ed7['shift']());}};_0x183ad7(++_0x398228);}(_0x0132,0x153));var _0x2013=function(_0x460763,_0x388eb8){_0x460763=_0x460763-0x0;var _0xdc541=_0x0132[_0x460763];return _0xdc541;};'use strict';var multer=require(_0x2013('0x0'));var util=require(_0x2013('0x1'));var path=require('path');var timeout=require(_0x2013('0x2'));var express=require(_0x2013('0x3'));var router=express[_0x2013('0x4')]();var auth=require(_0x2013('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2013('0x6'));module[_0x2013('0x7')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 8e4a5d0..42ba8e1 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 _0x7916=['sequelize','INTEGER'];(function(_0x3ef2d5,_0x423d46){var _0x2fefb2=function(_0x54f82f){while(--_0x54f82f){_0x3ef2d5['push'](_0x3ef2d5['shift']());}};_0x2fefb2(++_0x423d46);}(_0x7916,0x128));var _0x6791=function(_0x5d6bd7,_0x3d97d2){_0x5d6bd7=_0x5d6bd7-0x0;var _0x29a88b=_0x7916[_0x5d6bd7];return _0x29a88b;};'use strict';var Sequelize=require(_0x6791('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x6791('0x1')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xea28=['INTEGER','STRING','sequelize','exports'];(function(_0x199ea0,_0x10ec35){var _0x214f76=function(_0x2fdb6b){while(--_0x2fdb6b){_0x199ea0['push'](_0x199ea0['shift']());}};_0x214f76(++_0x10ec35);}(_0xea28,0x13a));var _0x8ea2=function(_0x436082,_0x161887){_0x436082=_0x436082-0x0;var _0x1d266c=_0xea28[_0x436082];return _0x1d266c;};'use strict';var Sequelize=require(_0x8ea2('0x0'));module[_0x8ea2('0x1')]={'penalty':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x8ea2('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x8ea2('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 1337863..490a6a3 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 _0x6838=['lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','UserFaxQueue','user_has_fax_queues'];(function(_0x1c4b4c,_0x4e1f48){var _0x158ba7=function(_0x3fbec6){while(--_0x3fbec6){_0x1c4b4c['push'](_0x1c4b4c['shift']());}};_0x158ba7(++_0x4e1f48);}(_0x6838,0xa8));var _0x8683=function(_0x4631eb,_0x55649e){_0x4631eb=_0x4631eb-0x0;var _0x562eca=_0x6838[_0x4631eb];return _0x562eca;};'use strict';var _=require(_0x8683('0x0'));var util=require(_0x8683('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8683('0x2'));var BPromise=require(_0x8683('0x3'));var rp=require(_0x8683('0x4'));var fs=require('fs');var path=require(_0x8683('0x5'));var rimraf=require(_0x8683('0x6'));var config=require(_0x8683('0x7'));var attributes=require(_0x8683('0x8'));module[_0x8683('0x9')]=function(_0x186884,_0x2145f2){return _0x186884['define'](_0x8683('0xa'),attributes,{'tableName':_0x8683('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f1b=['moment','path','rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0x4608e9,_0x111a90){var _0x46c7f3=function(_0x30873a){while(--_0x30873a){_0x4608e9['push'](_0x4608e9['shift']());}};_0x46c7f3(++_0x111a90);}(_0x7f1b,0x12b));var _0xb7f1=function(_0x187d1f,_0x4cfbba){_0x187d1f=_0x187d1f-0x0;var _0x4e043b=_0x7f1b[_0x187d1f];return _0x4e043b;};'use strict';var _=require(_0xb7f1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb7f1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb7f1('0x2'));var rimraf=require(_0xb7f1('0x3'));var config=require(_0xb7f1('0x4'));var attributes=require(_0xb7f1('0x5'));module[_0xb7f1('0x6')]=function(_0x5a7d99,_0x36be46){return _0x5a7d99[_0xb7f1('0x7')](_0xb7f1('0x8'),attributes,{'tableName':_0xb7f1('0x9'),'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 1da0bf7..784b5f5 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 _0xcb62=['../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','request\x20sent','stringify','error','code','UserFaxQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb'];(function(_0x6e0bf4,_0x3a3699){var _0x1f6a65=function(_0x445e4f){while(--_0x445e4f){_0x6e0bf4['push'](_0x6e0bf4['shift']());}};_0x1f6a65(++_0x3a3699);}(_0xcb62,0xf7));var _0x2cb6=function(_0x2e9e07,_0x1ec21b){_0x2e9e07=_0x2e9e07-0x0;var _0xd03eef=_0xcb62[_0x2e9e07];return _0xd03eef;};'use strict';var _=require(_0x2cb6('0x0'));var util=require(_0x2cb6('0x1'));var moment=require(_0x2cb6('0x2'));var BPromise=require('bluebird');var rs=require(_0x2cb6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2cb6('0x4'))['db'];var utils=require(_0x2cb6('0x5'));var logger=require(_0x2cb6('0x6'))('rpc');var config=require(_0x2cb6('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cb6('0x8')][_0x2cb6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2ae30a,_0x893a1f,_0x123ea3){return new BPromise(function(_0x176633,_0x25dda9){return client[_0x2cb6('0xa')](_0x2ae30a,_0x123ea3)[_0x2cb6('0xb')](function(_0x4c8637){logger[_0x2cb6('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x893a1f,_0x2cb6('0xd'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x893a1f,_0x2cb6('0xd'),JSON[_0x2cb6('0xe')](_0x4c8637));if(_0x4c8637['error']){if(_0x4c8637[_0x2cb6('0xf')][_0x2cb6('0x10')]===0x1f4){logger['error'](_0x2cb6('0x11'),_0x893a1f,_0x4c8637[_0x2cb6('0xf')][_0x2cb6('0x12')]);return _0x25dda9(_0x4c8637[_0x2cb6('0xf')]['message']);}logger[_0x2cb6('0xf')]('UserFaxQueue,\x20%s,\x20%s',_0x893a1f,_0x4c8637[_0x2cb6('0xf')][_0x2cb6('0x12')]);return _0x176633(_0x4c8637[_0x2cb6('0xf')][_0x2cb6('0x12')]);}else{logger[_0x2cb6('0xc')]('UserFaxQueue,\x20%s,\x20%s',_0x893a1f,_0x2cb6('0xd'));_0x176633(_0x4c8637[_0x2cb6('0x13')][_0x2cb6('0x12')]);}})[_0x2cb6('0x14')](function(_0x403652){logger[_0x2cb6('0xf')](_0x2cb6('0x11'),_0x893a1f,_0x403652);_0x25dda9(_0x403652);});});} \ No newline at end of file +var _0x9b94=['request\x20sent','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserFaxQueue,\x20%s,\x20%s'];(function(_0x8ef06a,_0x247f09){var _0x494cda=function(_0x25e762){while(--_0x25e762){_0x8ef06a['push'](_0x8ef06a['shift']());}};_0x494cda(++_0x247f09);}(_0x9b94,0x135));var _0x49b9=function(_0x406347,_0x3afc59){_0x406347=_0x406347-0x0;var _0x75e14e=_0x9b94[_0x406347];return _0x75e14e;};'use strict';var _=require(_0x49b9('0x0'));var util=require(_0x49b9('0x1'));var moment=require(_0x49b9('0x2'));var BPromise=require(_0x49b9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x49b9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x49b9('0x5'));var logger=require(_0x49b9('0x6'))(_0x49b9('0x7'));var config=require(_0x49b9('0x8'));var jayson=require(_0x49b9('0x9'));var client=jayson[_0x49b9('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x357e54,_0x162c6b,_0x35b409){return new BPromise(function(_0x111aa6,_0x4d6b43){return client[_0x49b9('0xb')](_0x357e54,_0x35b409)[_0x49b9('0xc')](function(_0x3303c8){logger[_0x49b9('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x162c6b,'request\x20sent');logger[_0x49b9('0xe')](_0x49b9('0xf'),_0x162c6b,'request\x20sent',JSON[_0x49b9('0x10')](_0x3303c8));if(_0x3303c8['error']){if(_0x3303c8[_0x49b9('0x11')][_0x49b9('0x12')]===0x1f4){logger[_0x49b9('0x11')]('UserFaxQueue,\x20%s,\x20%s',_0x162c6b,_0x3303c8[_0x49b9('0x11')]['message']);return _0x4d6b43(_0x3303c8[_0x49b9('0x11')][_0x49b9('0x13')]);}logger[_0x49b9('0x11')](_0x49b9('0x14'),_0x162c6b,_0x3303c8[_0x49b9('0x11')]['message']);return _0x111aa6(_0x3303c8[_0x49b9('0x11')]['message']);}else{logger[_0x49b9('0xd')]('UserFaxQueue,\x20%s,\x20%s',_0x162c6b,_0x49b9('0x15'));_0x111aa6(_0x3303c8['result']['message']);}})['catch'](function(_0x45d3e2){logger['error'](_0x49b9('0x14'),_0x162c6b,_0x45d3e2);_0x4d6b43(_0x45d3e2);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 8c559df..4541e33 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 _0xab50=['../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router','../../components/auth/service'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0xab50,0x1e3));var _0x0ab5=function(_0x13af99,_0x361303){_0x13af99=_0x13af99-0x0;var _0x326b6a=_0xab50[_0x13af99];return _0x326b6a;};'use strict';var multer=require(_0x0ab5('0x0'));var util=require(_0x0ab5('0x1'));var path=require('path');var timeout=require(_0x0ab5('0x2'));var express=require('express');var router=express[_0x0ab5('0x3')]();var auth=require(_0x0ab5('0x4'));var interaction=require(_0x0ab5('0x5'));var config=require(_0x0ab5('0x6'));module[_0x0ab5('0x7')]=router; \ No newline at end of file +var _0xa8db=['exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x4de8ce,_0x38b57a){var _0x495a63=function(_0x6ccf96){while(--_0x6ccf96){_0x4de8ce['push'](_0x4de8ce['shift']());}};_0x495a63(++_0x38b57a);}(_0xa8db,0x12a));var _0xba8d=function(_0x4b6778,_0x505a76){_0x4b6778=_0x4b6778-0x0;var _0x22dbb9=_0xa8db[_0x4b6778];return _0x22dbb9;};'use strict';var multer=require(_0xba8d('0x0'));var util=require(_0xba8d('0x1'));var path=require(_0xba8d('0x2'));var timeout=require(_0xba8d('0x3'));var express=require(_0xba8d('0x4'));var router=express['Router']();var auth=require(_0xba8d('0x5'));var interaction=require(_0xba8d('0x6'));var config=require(_0xba8d('0x7'));module[_0xba8d('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index c66bae8..ba7623a 100644 --- a/server/api/userMailQueue/userMailQueue.attributes.js +++ b/server/api/userMailQueue/userMailQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['exports','sequelize'];(function(_0x71ae3c,_0x404627){var _0x194072=function(_0x13c008){while(--_0x13c008){_0x71ae3c['push'](_0x71ae3c['shift']());}};_0x194072(++_0x404627);}(_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 _0xe706=['INTEGER','sequelize','exports'];(function(_0x3f6115,_0x3c8ad0){var _0x3ed5f0=function(_0x5f5814){while(--_0x5f5814){_0x3f6115['push'](_0x3f6115['shift']());}};_0x3ed5f0(++_0x3c8ad0);}(_0xe706,0xa3));var _0x6e70=function(_0x338f03,_0x28941b){_0x338f03=_0x338f03-0x0;var _0x514d7e=_0xe706[_0x338f03];return _0x514d7e;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'penalty':{'type':Sequelize[_0x6e70('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 39660b4..b7b2040 100644 --- a/server/api/userMailQueue/userMailQueue.model.js +++ b/server/api/userMailQueue/userMailQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','exports','define','UserMailQueue','user_has_mail_queues','util'];(function(_0x5c19f7,_0x4868d9){var _0xa330bd=function(_0x43b487){while(--_0x43b487){_0x5c19f7['push'](_0x5c19f7['shift']());}};_0xa330bd(++_0x4868d9);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require(_0x0baf('0x0'));var logger=require(_0x0baf('0x1'))(_0x0baf('0x2'));var moment=require(_0x0baf('0x3'));var BPromise=require(_0x0baf('0x4'));var rp=require(_0x0baf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var attributes=require(_0x0baf('0x8'));module[_0x0baf('0x9')]=function(_0xe4c3c4,_0x335e24){return _0xe4c3c4[_0x0baf('0xa')](_0x0baf('0xb'),attributes,{'tableName':_0x0baf('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['UserMailQueue','lodash','../../config/logger','moment','request-promise','rimraf','../../config/environment','./userMailQueue.attributes','define'];(function(_0x16bee2,_0x2d3a79){var _0x393c93=function(_0x3ccd87){while(--_0x3ccd87){_0x16bee2['push'](_0x16bee2['shift']());}};_0x393c93(++_0x2d3a79);}(_0xb7e7,0x121));var _0x7b7e=function(_0x38ced4,_0x24263f){_0x38ced4=_0x38ced4-0x0;var _0x547c07=_0xb7e7[_0x38ced4];return _0x547c07;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var logger=require(_0x7b7e('0x1'))('api');var moment=require(_0x7b7e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b7e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b7e('0x4'));var config=require(_0x7b7e('0x5'));var attributes=require(_0x7b7e('0x6'));module['exports']=function(_0x53ed64,_0x333fa4){return _0x53ed64[_0x7b7e('0x7')](_0x7b7e('0x8'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index 82939f2..b54f61b 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 _0x734f=['jayson/promise','client','http','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','util','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x558e97,_0x24311a){var _0x4ccdd4=function(_0x441824){while(--_0x441824){_0x558e97['push'](_0x558e97['shift']());}};_0x4ccdd4(++_0x24311a);}(_0x734f,0x71));var _0xf734=function(_0x3f2fea,_0x3c4ea8){_0x3f2fea=_0x3f2fea-0x0;var _0x69a4d5=_0x734f[_0x3f2fea];return _0x69a4d5;};'use strict';var _=require(_0xf734('0x0'));var util=require(_0xf734('0x1'));var moment=require('moment');var BPromise=require(_0xf734('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf734('0x3'))['db'];var utils=require(_0xf734('0x4'));var logger=require(_0xf734('0x5'))(_0xf734('0x6'));var config=require('../../config/environment');var jayson=require(_0xf734('0x7'));var client=jayson[_0xf734('0x8')][_0xf734('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1c23b9,_0x3f04e9,_0x157bc3){return new BPromise(function(_0x33a2c8,_0x492fd5){return client[_0xf734('0xa')](_0x1c23b9,_0x157bc3)[_0xf734('0xb')](function(_0x5acf04){logger[_0xf734('0xc')](_0xf734('0xd'),_0x3f04e9,_0xf734('0xe'));logger[_0xf734('0xf')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x3f04e9,'request\x20sent',JSON[_0xf734('0x10')](_0x5acf04));if(_0x5acf04[_0xf734('0x11')]){if(_0x5acf04[_0xf734('0x11')]['code']===0x1f4){logger[_0xf734('0x11')](_0xf734('0xd'),_0x3f04e9,_0x5acf04[_0xf734('0x11')]['message']);return _0x492fd5(_0x5acf04['error'][_0xf734('0x12')]);}logger[_0xf734('0x11')](_0xf734('0xd'),_0x3f04e9,_0x5acf04[_0xf734('0x11')][_0xf734('0x12')]);return _0x33a2c8(_0x5acf04[_0xf734('0x11')][_0xf734('0x12')]);}else{logger[_0xf734('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x3f04e9,'request\x20sent');_0x33a2c8(_0x5acf04[_0xf734('0x13')][_0xf734('0x12')]);}})['catch'](function(_0x313b9a){logger[_0xf734('0x11')](_0xf734('0xd'),_0x3f04e9,_0x313b9a);_0x492fd5(_0x313b9a);});});} \ No newline at end of file +var _0x1602=['../../mysqldb','../../config/utils','../../config/logger','rpc','http','request','UserMailQueue,\x20%s,\x20%s','debug','stringify','error','code','message','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x40ce06,_0x2b829e){var _0x40491a=function(_0x3053f9){while(--_0x3053f9){_0x40ce06['push'](_0x40ce06['shift']());}};_0x40491a(++_0x2b829e);}(_0x1602,0x135));var _0x2160=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1602[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x2160('0x0'));var util=require(_0x2160('0x1'));var moment=require(_0x2160('0x2'));var BPromise=require(_0x2160('0x3'));var rs=require(_0x2160('0x4'));var fs=require('fs');var Redis=require(_0x2160('0x5'));var db=require(_0x2160('0x6'))['db'];var utils=require(_0x2160('0x7'));var logger=require(_0x2160('0x8'))(_0x2160('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x2160('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x67e499,_0x33a580,_0x4b33e2){return new BPromise(function(_0x1f2586,_0x308c7d){return client[_0x2160('0xb')](_0x67e499,_0x4b33e2)['then'](function(_0x44c7bf){logger['info'](_0x2160('0xc'),_0x33a580,'request\x20sent');logger[_0x2160('0xd')]('UserMailQueue,\x20%s,\x20%s,\x20%s',_0x33a580,'request\x20sent',JSON[_0x2160('0xe')](_0x44c7bf));if(_0x44c7bf[_0x2160('0xf')]){if(_0x44c7bf[_0x2160('0xf')][_0x2160('0x10')]===0x1f4){logger[_0x2160('0xf')](_0x2160('0xc'),_0x33a580,_0x44c7bf[_0x2160('0xf')][_0x2160('0x11')]);return _0x308c7d(_0x44c7bf[_0x2160('0xf')][_0x2160('0x11')]);}logger[_0x2160('0xf')](_0x2160('0xc'),_0x33a580,_0x44c7bf['error']['message']);return _0x1f2586(_0x44c7bf[_0x2160('0xf')][_0x2160('0x11')]);}else{logger[_0x2160('0x12')](_0x2160('0xc'),_0x33a580,_0x2160('0x13'));_0x1f2586(_0x44c7bf['result'][_0x2160('0x11')]);}})[_0x2160('0x14')](function(_0x10b771){logger['error'](_0x2160('0xc'),_0x33a580,_0x10b771);_0x308c7d(_0x10b771);});});} \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index e6fc96f..edd6e87 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 _0x29ed=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x155d44,_0x356cde){var _0x594a7a=function(_0x314b3e){while(--_0x314b3e){_0x155d44['push'](_0x155d44['shift']());}};_0x594a7a(++_0x356cde);}(_0x29ed,0x15c));var _0xd29e=function(_0x4174b3,_0x274e24){_0x4174b3=_0x4174b3-0x0;var _0x16cb3d=_0x29ed[_0x4174b3];return _0x16cb3d;};'use strict';var multer=require(_0xd29e('0x0'));var util=require(_0xd29e('0x1'));var path=require(_0xd29e('0x2'));var timeout=require(_0xd29e('0x3'));var express=require(_0xd29e('0x4'));var router=express[_0xd29e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xd29e('0x6'));var config=require(_0xd29e('0x7'));module[_0xd29e('0x8')]=router; \ No newline at end of file +var _0x0755=['../../components/auth/service','../../components/interaction/service','../../config/environment','exports','multer','util','connect-timeout','Router'];(function(_0xf9297,_0x1e8622){var _0x5a6e6e=function(_0x3901c9){while(--_0x3901c9){_0xf9297['push'](_0xf9297['shift']());}};_0x5a6e6e(++_0x1e8622);}(_0x0755,0x194));var _0x5075=function(_0x3d4454,_0x25d4d3){_0x3d4454=_0x3d4454-0x0;var _0x2425f9=_0x0755[_0x3d4454];return _0x2425f9;};'use strict';var multer=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var path=require('path');var timeout=require(_0x5075('0x2'));var express=require('express');var router=express[_0x5075('0x3')]();var auth=require(_0x5075('0x4'));var interaction=require(_0x5075('0x5'));var config=require(_0x5075('0x6'));module[_0x5075('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 28c41e4..587d59d 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 _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x2a11c8,_0x25b238){var _0x5bf10b=function(_0x2ba18b){while(--_0x2ba18b){_0x2a11c8['push'](_0x2a11c8['shift']());}};_0x5bf10b(++_0x25b238);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'penalty':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xbaf0=['exports','INTEGER'];(function(_0x4ac48d,_0x171a68){var _0x7537af=function(_0x1c6ca6){while(--_0x1c6ca6){_0x4ac48d['push'](_0x4ac48d['shift']());}};_0x7537af(++_0x171a68);}(_0xbaf0,0x12a));var _0x0baf=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xbaf0[_0x3947c9];return _0x2e7871;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 7c83c95..2d992e7 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 _0x2037=['user_has_openchannel_queues','lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x56ef59,_0x2d1bc9){var _0x2432a6=function(_0x44430f){while(--_0x44430f){_0x56ef59['push'](_0x56ef59['shift']());}};_0x2432a6(++_0x2d1bc9);}(_0x2037,0xdd));var _0x7203=function(_0x55d911,_0x2b768c){_0x55d911=_0x55d911-0x0;var _0x3104c2=_0x2037[_0x55d911];return _0x3104c2;};'use strict';var _=require(_0x7203('0x0'));var util=require(_0x7203('0x1'));var logger=require('../../config/logger')(_0x7203('0x2'));var moment=require('moment');var BPromise=require(_0x7203('0x3'));var rp=require(_0x7203('0x4'));var fs=require('fs');var path=require(_0x7203('0x5'));var rimraf=require(_0x7203('0x6'));var config=require(_0x7203('0x7'));var attributes=require('./userOpenchannelQueue.attributes');module[_0x7203('0x8')]=function(_0x1321f3,_0x16e54d){return _0x1321f3[_0x7203('0x9')]('UserOpenchannelQueue',attributes,{'tableName':_0x7203('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x491d=['api','bluebird','request-promise','rimraf','exports','define','UserOpenchannelQueue','user_has_openchannel_queues','lodash'];(function(_0x2e2b45,_0x2a07e3){var _0x2bf3c2=function(_0x51d98d){while(--_0x51d98d){_0x2e2b45['push'](_0x2e2b45['shift']());}};_0x2bf3c2(++_0x2a07e3);}(_0x491d,0xbc));var _0xd491=function(_0x40e313,_0x4333f7){_0x40e313=_0x40e313-0x0;var _0x176932=_0x491d[_0x40e313];return _0x176932;};'use strict';var _=require(_0xd491('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd491('0x1'));var moment=require('moment');var BPromise=require(_0xd491('0x2'));var rp=require(_0xd491('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd491('0x4'));var config=require('../../config/environment');var attributes=require('./userOpenchannelQueue.attributes');module[_0xd491('0x5')]=function(_0x8d5d3f,_0x4e95b3){return _0x8d5d3f[_0xd491('0x6')](_0xd491('0x7'),attributes,{'tableName':_0xd491('0x8'),'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 8f9b6c0..a22959c 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 _0x69db=['info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http'];(function(_0x3d6620,_0x112662){var _0x1324d4=function(_0x427864){while(--_0x427864){_0x3d6620['push'](_0x3d6620['shift']());}};_0x1324d4(++_0x112662);}(_0x69db,0x187));var _0xb69d=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x69db[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0xb69d('0x0'));var util=require('util');var moment=require(_0xb69d('0x1'));var BPromise=require(_0xb69d('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb69d('0x3'));var db=require(_0xb69d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb69d('0x5'));var config=require(_0xb69d('0x6'));var jayson=require(_0xb69d('0x7'));var client=jayson['client'][_0xb69d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29172c,_0x8e9497,_0x519fb8){return new BPromise(function(_0x165060,_0x11f59f){return client['request'](_0x29172c,_0x519fb8)['then'](function(_0x4b0587){logger[_0xb69d('0x9')](_0xb69d('0xa'),_0x8e9497,_0xb69d('0xb'));logger[_0xb69d('0xc')](_0xb69d('0xd'),_0x8e9497,_0xb69d('0xb'),JSON[_0xb69d('0xe')](_0x4b0587));if(_0x4b0587[_0xb69d('0xf')]){if(_0x4b0587[_0xb69d('0xf')][_0xb69d('0x10')]===0x1f4){logger[_0xb69d('0xf')](_0xb69d('0xa'),_0x8e9497,_0x4b0587[_0xb69d('0xf')][_0xb69d('0x11')]);return _0x11f59f(_0x4b0587['error'][_0xb69d('0x11')]);}logger[_0xb69d('0xf')](_0xb69d('0xa'),_0x8e9497,_0x4b0587[_0xb69d('0xf')][_0xb69d('0x11')]);return _0x165060(_0x4b0587[_0xb69d('0xf')][_0xb69d('0x11')]);}else{logger[_0xb69d('0x9')](_0xb69d('0xa'),_0x8e9497,_0xb69d('0xb'));_0x165060(_0x4b0587[_0xb69d('0x12')][_0xb69d('0x11')]);}})[_0xb69d('0x13')](function(_0xac43fa){logger[_0xb69d('0xf')](_0xb69d('0xa'),_0x8e9497,_0xac43fa);_0x11f59f(_0xac43fa);});});} \ No newline at end of file +var _0x0681=['error','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','stringify'];(function(_0x2df6d7,_0x86cea6){var _0x222040=function(_0x1cc1d1){while(--_0x1cc1d1){_0x2df6d7['push'](_0x2df6d7['shift']());}};_0x222040(++_0x86cea6);}(_0x0681,0x101));var _0x1068=function(_0x3f7e37,_0x32f790){_0x3f7e37=_0x3f7e37-0x0;var _0x2a3ec7=_0x0681[_0x3f7e37];return _0x2a3ec7;};'use strict';var _=require(_0x1068('0x0'));var util=require(_0x1068('0x1'));var moment=require(_0x1068('0x2'));var BPromise=require(_0x1068('0x3'));var rs=require(_0x1068('0x4'));var fs=require('fs');var Redis=require(_0x1068('0x5'));var db=require(_0x1068('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x1068('0x7'))(_0x1068('0x8'));var config=require(_0x1068('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1068('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe971b6,_0x22ccde,_0x16a787){return new BPromise(function(_0xe6c676,_0x6236a1){return client[_0x1068('0xb')](_0xe971b6,_0x16a787)[_0x1068('0xc')](function(_0x312196){logger[_0x1068('0xd')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x22ccde,_0x1068('0xe'));logger['debug']('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x22ccde,_0x1068('0xe'),JSON[_0x1068('0xf')](_0x312196));if(_0x312196['error']){if(_0x312196[_0x1068('0x10')]['code']===0x1f4){logger['error'](_0x1068('0x11'),_0x22ccde,_0x312196[_0x1068('0x10')]['message']);return _0x6236a1(_0x312196[_0x1068('0x10')][_0x1068('0x12')]);}logger[_0x1068('0x10')](_0x1068('0x11'),_0x22ccde,_0x312196[_0x1068('0x10')][_0x1068('0x12')]);return _0xe6c676(_0x312196[_0x1068('0x10')][_0x1068('0x12')]);}else{logger[_0x1068('0xd')](_0x1068('0x11'),_0x22ccde,_0x1068('0xe'));_0xe6c676(_0x312196[_0x1068('0x13')][_0x1068('0x12')]);}})[_0x1068('0x14')](function(_0x4aab3f){logger[_0x1068('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x22ccde,_0x4aab3f);_0x6236a1(_0x4aab3f);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 796458a..648820a 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 _0xd5a6=['isAuthenticated','index','get','describe','/:id','/:id/sections','getSections','getResources','post','create','/:id/clone','clone','addSections','/:id/resources','addResources','put','update','delete','removeSections','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./userProfile.controller'];(function(_0xc16013,_0x1ba88c){var _0x532a68=function(_0x235fa5){while(--_0x235fa5){_0xc16013['push'](_0xc16013['shift']());}};_0x532a68(++_0x1ba88c);}(_0xd5a6,0xa5));var _0x6d5a=function(_0x46f08a,_0x223e23){_0x46f08a=_0x46f08a-0x0;var _0x1ff88b=_0xd5a6[_0x46f08a];return _0x1ff88b;};'use strict';var multer=require(_0x6d5a('0x0'));var util=require(_0x6d5a('0x1'));var path=require(_0x6d5a('0x2'));var timeout=require(_0x6d5a('0x3'));var express=require(_0x6d5a('0x4'));var router=express[_0x6d5a('0x5')]();var auth=require(_0x6d5a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6d5a('0x7'));var controller=require(_0x6d5a('0x8'));router['get']('/',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0xa')]);router[_0x6d5a('0xb')]('/describe',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0xc')]);router[_0x6d5a('0xb')](_0x6d5a('0xd'),auth[_0x6d5a('0x9')](),controller['show']);router[_0x6d5a('0xb')](_0x6d5a('0xe'),auth[_0x6d5a('0x9')](),controller[_0x6d5a('0xf')]);router[_0x6d5a('0xb')]('/:id/resources',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x10')]);router[_0x6d5a('0x11')]('/',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x12')]);router[_0x6d5a('0x11')](_0x6d5a('0x13'),auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x14')]);router[_0x6d5a('0x11')]('/:id/sections',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x15')]);router[_0x6d5a('0x11')](_0x6d5a('0x16'),auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x17')]);router[_0x6d5a('0x18')]('/:id',auth[_0x6d5a('0x9')](),controller[_0x6d5a('0x19')]);router[_0x6d5a('0x1a')](_0x6d5a('0xd'),auth['isAuthenticated'](),controller['destroy']);router[_0x6d5a('0x1a')](_0x6d5a('0xe'),auth['isAuthenticated'](),controller[_0x6d5a('0x1b')]);router[_0x6d5a('0x1a')](_0x6d5a('0x16'),auth[_0x6d5a('0x9')](),controller['removeResources']);module[_0x6d5a('0x1c')]=router; \ No newline at end of file +var _0x1d7e=['multer','express','Router','../../components/auth/service','./userProfile.controller','get','isAuthenticated','index','/describe','show','/:id/resources','post','create','/:id/clone','clone','/:id/sections','addSections','addResources','put','/:id','delete','destroy','removeSections','removeResources','exports'];(function(_0x2472f3,_0x42952d){var _0x5a6f54=function(_0x253b8b){while(--_0x253b8b){_0x2472f3['push'](_0x2472f3['shift']());}};_0x5a6f54(++_0x42952d);}(_0x1d7e,0x1f4));var _0xe1d7=function(_0x50007c,_0x1cbf11){_0x50007c=_0x50007c-0x0;var _0x5c1ec7=_0x1d7e[_0x50007c];return _0x5c1ec7;};'use strict';var multer=require(_0xe1d7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xe1d7('0x1'));var router=express[_0xe1d7('0x2')]();var auth=require(_0xe1d7('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xe1d7('0x4'));router[_0xe1d7('0x5')]('/',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x7')]);router[_0xe1d7('0x5')](_0xe1d7('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xe1d7('0x5')]('/:id',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x9')]);router[_0xe1d7('0x5')]('/:id/sections',auth[_0xe1d7('0x6')](),controller['getSections']);router[_0xe1d7('0x5')](_0xe1d7('0xa'),auth[_0xe1d7('0x6')](),controller['getResources']);router[_0xe1d7('0xb')]('/',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0xc')]);router['post'](_0xe1d7('0xd'),auth['isAuthenticated'](),controller[_0xe1d7('0xe')]);router['post'](_0xe1d7('0xf'),auth['isAuthenticated'](),controller[_0xe1d7('0x10')]);router['post'](_0xe1d7('0xa'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x11')]);router[_0xe1d7('0x12')](_0xe1d7('0x13'),auth['isAuthenticated'](),controller['update']);router[_0xe1d7('0x14')]('/:id',auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x15')]);router[_0xe1d7('0x14')](_0xe1d7('0xf'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x16')]);router[_0xe1d7('0x14')](_0xe1d7('0xa'),auth[_0xe1d7('0x6')](),controller[_0xe1d7('0x17')]);module[_0xe1d7('0x18')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index d0e134d..267a4ae 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 _0xdf2b=['STRING','setDataValue','crudPermissions','join','getDataValue','exports'];(function(_0x4cc2ad,_0x578dc9){var _0x590f13=function(_0x200dd4){while(--_0x200dd4){_0x4cc2ad['push'](_0x4cc2ad['shift']());}};_0x590f13(++_0x578dc9);}(_0xdf2b,0x125));var _0xbdf2=function(_0x37b7ba,_0x37fd44){_0x37b7ba=_0x37b7ba-0x0;var _0x5d88e7=_0xdf2b[_0x37b7ba];return _0x5d88e7;};'use strict';var Sequelize=require('sequelize');module[_0xbdf2('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0xbdf2('0x1')],'set':function(_0x4bdf94){this[_0xbdf2('0x2')](_0xbdf2('0x3'),_0x4bdf94?_0x4bdf94[_0xbdf2('0x4')](''):[]);},'get':function(){return this[_0xbdf2('0x5')](_0xbdf2('0x3'))?this[_0xbdf2('0x5')](_0xbdf2('0x3'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xbdf2('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0x590a=['join','getDataValue','crudPermissions','exports','STRING','name'];(function(_0x44f0c1,_0x38a68f){var _0x12d335=function(_0x119b49){while(--_0x119b49){_0x44f0c1['push'](_0x44f0c1['shift']());}};_0x12d335(++_0x38a68f);}(_0x590a,0x159));var _0xa590=function(_0x15eafd,_0x46ba79){_0x15eafd=_0x15eafd-0x0;var _0x5a89ce=_0x590a[_0x15eafd];return _0x5a89ce;};'use strict';var Sequelize=require('sequelize');module[_0xa590('0x0')]={'name':{'type':Sequelize[_0xa590('0x1')],'allowNull':![],'unique':_0xa590('0x2')},'crudPermissions':{'type':Sequelize[_0xa590('0x1')],'set':function(_0x379aed){this['setDataValue']('crudPermissions',_0x379aed?_0x379aed[_0xa590('0x3')](''):[]);},'get':function(){return this[_0xa590('0x4')](_0xa590('0x5'))?this['getDataValue'](_0xa590('0x5'))['split'](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xa590('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 ea5d7ea..3b0c29b 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 _0x5a1d=['Resources','update','describe','addSections','sequelize','UserProfileSection','push','removeSections','ids','getSections','enabled','includes','isEmpty','subsections','Dashboard','forEach','resourceId','bulkCreate','removeResources','undefined','Sequelize','ValidationError','Unknown\x20section','childModel','Invalid\x20section\x20\x27','parentSections','findOne','all','pick','VIRTUAL','field','AnalyticExtractedReport','foreignKey','associatedResources','reportType','default','reportId','custom','CmContact','Tag','Tags','color','tag','rows','value','toLowerCase','squareprojects','SquareProject','SquareOdbc','squarerecordings','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','lists','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','membername','User','agent','role','telephone','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoicePrefix','ivrcampaigns','mailaccounts','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','Team','voicequeues','queuecampaigns','users','telephones','Users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','SugarcrmAccount','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','Disposition','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','templates','triggers','Trigger','trunks','variables','Variable','plugins','Plugin','Reports','metrics','AnalyticMetric','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','redis','defaults','localhost','socket.io-emitter','register','sendStatus','end','status','json','limit','set','Content-Range','save','then','destroy','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','filter','merge','UserProfile','count','includeAll','include','findAll','show','params','keys','options','find','create','catch','clone','get','omit','createdAt','updatedAt','crudPermissions','body','transaction','autoAssociation','UserProfileResource','sectionId','userProfileId'];(function(_0x2a89d6,_0x5dc178){var _0x13139a=function(_0x24b5e1){while(--_0x24b5e1){_0x2a89d6['push'](_0x2a89d6['shift']());}};_0x13139a(++_0x5dc178);}(_0x5a1d,0x8f));var _0xd5a1=function(_0x501d8d,_0x592133){_0x501d8d=_0x501d8d-0x0;var _0xcd05f1=_0x5a1d[_0x501d8d];return _0xcd05f1;};'use strict';var pdf=require(_0xd5a1('0x0'));var emlformat=require(_0xd5a1('0x1'));var rimraf=require(_0xd5a1('0x2'));var zipdir=require(_0xd5a1('0x3'));var jsonpatch=require(_0xd5a1('0x4'));var rp=require(_0xd5a1('0x5'));var moment=require('moment');var BPromise=require(_0xd5a1('0x6'));var Mustache=require('mustache');var util=require(_0xd5a1('0x7'));var path=require(_0xd5a1('0x8'));var sox=require(_0xd5a1('0x9'));var csv=require(_0xd5a1('0xa'));var ejs=require(_0xd5a1('0xb'));var fs=require('fs');var _=require(_0xd5a1('0xc'));var squel=require(_0xd5a1('0xd'));var crypto=require(_0xd5a1('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd5a1('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xd5a1('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xd5a1('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd5a1('0x11'))(_0xd5a1('0x12'));var utils=require(_0xd5a1('0x13'));var config=require(_0xd5a1('0x14'));var db=require('../../mysqldb')['db'];config[_0xd5a1('0x15')]=_[_0xd5a1('0x16')](config[_0xd5a1('0x15')],{'host':_0xd5a1('0x17'),'port':0x18eb});var socket=require(_0xd5a1('0x18'))(new Redis(config[_0xd5a1('0x15')]));require('./userProfile.socket')[_0xd5a1('0x19')](socket);function respondWithStatusCode(_0x1ffe51,_0x3c9c1a){_0x3c9c1a=_0x3c9c1a||0xcc;return function(_0x6d3f95){if(_0x6d3f95){return _0x1ffe51[_0xd5a1('0x1a')](_0x3c9c1a);}return _0x1ffe51['status'](_0x3c9c1a)[_0xd5a1('0x1b')]();};}function respondWithResult(_0x3fe876,_0x267a36){_0x267a36=_0x267a36||0xc8;return function(_0x3adbd0){if(_0x3adbd0){return _0x3fe876[_0xd5a1('0x1c')](_0x267a36)[_0xd5a1('0x1d')](_0x3adbd0);}};}function respondWithFilteredResult(_0x7560c3,_0x393543){return function(_0x2a330c){if(_0x2a330c){var _0x2ddf41=_0x2a330c['count'],_0x306e0d=_0x393543['offset'],_0x3dce20=_0x393543['offset']+_0x393543[_0xd5a1('0x1e')],_0x4c241b;if(_0x3dce20>=_0x2ddf41){_0x3dce20=_0x2ddf41;_0x4c241b=0xc8;}else{_0x4c241b=0xce;}_0x7560c3[_0xd5a1('0x1c')](_0x4c241b);return _0x7560c3[_0xd5a1('0x1f')](_0xd5a1('0x20'),_0x306e0d+'-'+_0x3dce20+'/'+_0x2ddf41)[_0xd5a1('0x1d')](_0x2a330c);}return null;};}function patchUpdates(_0x42f829){return function(_0x4a29){try{jsonpatch['apply'](_0x4a29,_0x42f829,!![]);}catch(_0x4d5012){return BPromise['reject'](_0x4d5012);}return _0x4a29[_0xd5a1('0x21')]();};}function saveUpdates(_0x20aa16,_0x48488a){return function(_0x3448d7){if(_0x3448d7){return _0x3448d7['update'](_0x20aa16)[_0xd5a1('0x22')](function(_0x29f8eb){return _0x29f8eb;});}return null;};}function removeEntity(_0x40fbe1,_0x1a9a64){return function(_0x379989){if(_0x379989){return _0x379989[_0xd5a1('0x23')]()[_0xd5a1('0x22')](function(){_0x40fbe1['status'](0xcc)[_0xd5a1('0x1b')]();});}};}function handleEntityNotFound(_0x3371d3,_0x3300ff){return function(_0x467a51){if(!_0x467a51){_0x3371d3['sendStatus'](0x194);}return _0x467a51;};}function handleError(_0x491e3f,_0x14b909){_0x14b909=_0x14b909||0x1f4;return function(_0x5078a4){logger[_0xd5a1('0x24')](_0x5078a4['stack']);if(_0x5078a4[_0xd5a1('0x25')]){delete _0x5078a4['name'];}_0x491e3f['status'](_0x14b909)[_0xd5a1('0x26')](_0x5078a4);};}exports[_0xd5a1('0x27')]=function(_0x28eabb,_0x2a0e9e){var _0x307f90={},_0x5a71e1={},_0x24b6fe={'count':0x0,'rows':[]};var _0x32c979=_[_0xd5a1('0x28')](db['UserProfile'][_0xd5a1('0x29')],function(_0x5ebbe7){return{'name':_0x5ebbe7[_0xd5a1('0x2a')],'type':_0x5ebbe7[_0xd5a1('0x2b')][_0xd5a1('0x2c')]};});_0x5a71e1[_0xd5a1('0x2d')]=_['map'](_0x32c979,'name');_0x5a71e1[_0xd5a1('0x2e')]=_['keys'](_0x28eabb[_0xd5a1('0x2e')]);_0x5a71e1[_0xd5a1('0x2f')]=_[_0xd5a1('0x30')](_0x5a71e1[_0xd5a1('0x2d')],_0x5a71e1[_0xd5a1('0x2e')]);_0x307f90[_0xd5a1('0x31')]=_['intersection'](_0x5a71e1[_0xd5a1('0x2d')],qs[_0xd5a1('0x32')](_0x28eabb['query']['fields']));_0x307f90[_0xd5a1('0x31')]=_0x307f90[_0xd5a1('0x31')][_0xd5a1('0x33')]?_0x307f90[_0xd5a1('0x31')]:_0x5a71e1[_0xd5a1('0x2d')];if(!_0x28eabb[_0xd5a1('0x2e')][_0xd5a1('0x34')](_0xd5a1('0x35'))){_0x307f90['limit']=qs[_0xd5a1('0x1e')](_0x28eabb['query'][_0xd5a1('0x1e')]);_0x307f90['offset']=qs[_0xd5a1('0x36')](_0x28eabb['query'][_0xd5a1('0x36')]);}_0x307f90[_0xd5a1('0x37')]=qs[_0xd5a1('0x38')](_0x28eabb[_0xd5a1('0x2e')][_0xd5a1('0x38')]);_0x307f90[_0xd5a1('0x39')]=qs['filters'](_['pick'](_0x28eabb[_0xd5a1('0x2e')],_0x5a71e1[_0xd5a1('0x2f')]));if(_0x28eabb['query'][_0xd5a1('0x3a')]){_0x307f90['where']=_[_0xd5a1('0x3b')](_0x307f90[_0xd5a1('0x39')],{'$or':_[_0xd5a1('0x28')](_0x32c979,function(_0x4cac9f){if(_0x4cac9f['type']!=='VIRTUAL'){var _0x2046b0={};_0x2046b0[_0x4cac9f['name']]={'$like':'%'+_0x28eabb[_0xd5a1('0x2e')]['filter']+'%'};return _0x2046b0;}})});}_0x307f90=_['merge']({},_0x307f90,_0x28eabb['options']);var _0xe12ca9={'where':_0x307f90[_0xd5a1('0x39')]};return db[_0xd5a1('0x3c')][_0xd5a1('0x3d')](_0xe12ca9)[_0xd5a1('0x22')](function(_0x1a603c){_0x24b6fe[_0xd5a1('0x3d')]=_0x1a603c;if(_0x28eabb['query'][_0xd5a1('0x3e')]){_0x307f90[_0xd5a1('0x3f')]=[{'all':!![]}];}return db[_0xd5a1('0x3c')][_0xd5a1('0x40')](_0x307f90);})['then'](function(_0x1c9587){_0x24b6fe['rows']=_0x1c9587;return _0x24b6fe;})[_0xd5a1('0x22')](respondWithFilteredResult(_0x2a0e9e,_0x307f90))['catch'](handleError(_0x2a0e9e,null));};exports[_0xd5a1('0x41')]=function(_0x267a5d,_0x3d8256){var _0x59137e={'raw':![],'where':{'id':_0x267a5d[_0xd5a1('0x42')]['id']}},_0x421db3={};_0x421db3[_0xd5a1('0x2d')]=_['keys'](db[_0xd5a1('0x3c')][_0xd5a1('0x29')]);_0x421db3['query']=_[_0xd5a1('0x43')](_0x267a5d[_0xd5a1('0x2e')]);_0x421db3[_0xd5a1('0x2f')]=_[_0xd5a1('0x30')](_0x421db3[_0xd5a1('0x2d')],_0x421db3[_0xd5a1('0x2e')]);_0x59137e[_0xd5a1('0x31')]=_[_0xd5a1('0x30')](_0x421db3[_0xd5a1('0x2d')],qs[_0xd5a1('0x32')](_0x267a5d[_0xd5a1('0x2e')][_0xd5a1('0x32')]));_0x59137e['attributes']=_0x59137e[_0xd5a1('0x31')]['length']?_0x59137e[_0xd5a1('0x31')]:_0x421db3['model'];if(_0x267a5d[_0xd5a1('0x2e')]['includeAll']){_0x59137e[_0xd5a1('0x3f')]=[{'all':!![]}];}_0x59137e=_[_0xd5a1('0x3b')]({},_0x59137e,_0x267a5d[_0xd5a1('0x44')]);return db[_0xd5a1('0x3c')][_0xd5a1('0x45')](_0x59137e)[_0xd5a1('0x22')](handleEntityNotFound(_0x3d8256,null))[_0xd5a1('0x22')](respondWithResult(_0x3d8256,null))['catch'](handleError(_0x3d8256,null));};exports[_0xd5a1('0x46')]=function(_0x5743eb,_0x1b9efa){return db[_0xd5a1('0x3c')][_0xd5a1('0x46')](_0x5743eb['body'],{})[_0xd5a1('0x22')](respondWithResult(_0x1b9efa,0xc9))[_0xd5a1('0x47')](handleError(_0x1b9efa,null));};exports[_0xd5a1('0x48')]=function(_0x53994f,_0x374fbb){var _0x1b4d8c={'where':{'id':_0x53994f[_0xd5a1('0x42')]['id']}},_0x340210={};_0x340210[_0xd5a1('0x2d')]=_[_0xd5a1('0x43')](db[_0xd5a1('0x3c')][_0xd5a1('0x29')]);_0x1b4d8c[_0xd5a1('0x31')]=_[_0xd5a1('0x30')](_0x340210['model'],qs['fields'](_0x53994f[_0xd5a1('0x2e')]['fields']));_0x1b4d8c[_0xd5a1('0x31')]=_0x1b4d8c['attributes'][_0xd5a1('0x33')]?_0x1b4d8c[_0xd5a1('0x31')]:_0x340210[_0xd5a1('0x2d')];if(_0x53994f[_0xd5a1('0x2e')][_0xd5a1('0x3e')]){_0x1b4d8c['include']=[{'all':!![]}];}_0x1b4d8c=_[_0xd5a1('0x3b')]({},_0x1b4d8c,_0x53994f[_0xd5a1('0x44')]);return db[_0xd5a1('0x3c')][_0xd5a1('0x45')](_0x1b4d8c)['then'](handleEntityNotFound(_0x374fbb,null))[_0xd5a1('0x22')](function(_0xc815cf){if(_0xc815cf){var _0x2c0ac8=_0xc815cf[_0xd5a1('0x49')]({'plain':!![]});_0x2c0ac8=qs[_0xd5a1('0x4a')](_0x2c0ac8,['id',_0xd5a1('0x4b'),_0xd5a1('0x4c'),_0xd5a1('0x4d')]);_0x53994f[_0xd5a1('0x4e')]=_[_0xd5a1('0x4a')](_0x53994f['body'],['id',_0xd5a1('0x4b'),_0xd5a1('0x4c')]);return db['sequelize'][_0xd5a1('0x4f')](function(_0x41d5f9){return db[_0xd5a1('0x3c')][_0xd5a1('0x46')](_['merge'](_0x2c0ac8,_0x53994f[_0xd5a1('0x4e')]),{'include':_0x53994f['query']['includeAll']?[{'all':!![]}]:undefined,'transaction':_0x41d5f9})[_0xd5a1('0x22')](function(_0x436cae){var _0x2a7162=_0x436cae[_0xd5a1('0x49')]({'plain':!![]});return db['UserProfileSection'][_0xd5a1('0x40')]({'where':{'userProfileId':_0x53994f[_0xd5a1('0x42')]['id']},'raw':!![]})[_0xd5a1('0x22')](function(_0x154cb3){if(_0x154cb3){return BPromise['each'](_0x154cb3,function(_0x31d28e){return new BPromise(function(_0x30f85a,_0x23c6f8){if(_0x31d28e[_0xd5a1('0x50')]===null||_0x31d28e[_0xd5a1('0x50')]===0x1)_0x30f85a(null);return db[_0xd5a1('0x51')]['findAll']({'where':{'sectionId':_0x31d28e['id']},'raw':!![]})[_0xd5a1('0x22')](function(_0xb48c98){var _0x49d960=_['map'](_0xb48c98,function(_0x181908){return qs[_0xd5a1('0x4a')](_0x181908,['id',_0xd5a1('0x4b'),_0xd5a1('0x4c'),_0xd5a1('0x52')]);});_0x30f85a(_0x49d960);})[_0xd5a1('0x47')](function(_0x172084){_0x23c6f8(_0x172084);});})['then'](function(_0x513131){var _0x2eb112=qs['omit'](_0x31d28e,['id',_0xd5a1('0x4b'),_0xd5a1('0x4c')]);_0x2eb112[_0xd5a1('0x53')]=_0x2a7162['id'];if(_0x513131)_0x2eb112[_0xd5a1('0x54')]=_0x513131;return _0x2eb112;})[_0xd5a1('0x22')](function(_0x8c02ac){return db['UserProfileSection']['create'](_0x8c02ac,{'include':[{'model':db[_0xd5a1('0x51')],'as':_0xd5a1('0x54')}],'raw':!![],'transaction':_0x41d5f9});});})[_0xd5a1('0x22')](function(){return _0x2a7162;});}});});});}})[_0xd5a1('0x22')](respondWithResult(_0x374fbb,0xc9))[_0xd5a1('0x47')](handleError(_0x374fbb,null));};exports[_0xd5a1('0x55')]=function(_0x51c819,_0x2e30b0){if(_0x51c819['body']['id']){delete _0x51c819[_0xd5a1('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x51c819[_0xd5a1('0x42')]['id']}})[_0xd5a1('0x22')](handleEntityNotFound(_0x2e30b0,null))['then'](saveUpdates(_0x51c819['body'],null))[_0xd5a1('0x22')](respondWithResult(_0x2e30b0,null))[_0xd5a1('0x47')](handleError(_0x2e30b0,null));};exports[_0xd5a1('0x23')]=function(_0x262a26,_0xf842d8){return db[_0xd5a1('0x3c')][_0xd5a1('0x45')]({'where':{'id':_0x262a26[_0xd5a1('0x42')]['id']}})[_0xd5a1('0x22')](handleEntityNotFound(_0xf842d8,null))[_0xd5a1('0x22')](removeEntity(_0xf842d8,null))['catch'](handleError(_0xf842d8,null));};exports[_0xd5a1('0x56')]=function(_0x18df31,_0x1aa26f){return db[_0xd5a1('0x3c')][_0xd5a1('0x56')]()[_0xd5a1('0x22')](respondWithResult(_0x1aa26f,null))[_0xd5a1('0x47')](handleError(_0x1aa26f,null));};exports[_0xd5a1('0x57')]=function(_0x24a670,_0x5b3bc3){var _0x420e78=_0x24a670[_0xd5a1('0x4e')];return db[_0xd5a1('0x3c')][_0xd5a1('0x45')]({'where':{'id':_0x24a670[_0xd5a1('0x42')]['id']}})[_0xd5a1('0x22')](handleEntityNotFound(_0x5b3bc3,null))[_0xd5a1('0x22')](function(_0x4bf7f7){if(_0x4bf7f7){return db[_0xd5a1('0x58')][_0xd5a1('0x4f')](function(_0x2c8898){return db[_0xd5a1('0x59')][_0xd5a1('0x23')]({'where':{'userProfileId':_0x24a670[_0xd5a1('0x42')]['id'],'sectionId':_[_0xd5a1('0x28')](_0x420e78,function(_0x5961b5){return _0x5961b5['sectionId'];})},'transaction':_0x2c8898})['then'](function(){var _0x3756c3=_['map'](_0x420e78,function(_0x5130d8){_0x5130d8[_0xd5a1('0x53')]=_0x24a670[_0xd5a1('0x42')]['id'];return _0x5130d8;});var _0x45d006=[];return BPromise['each'](_0x3756c3,function(_0x4f97bd){return db[_0xd5a1('0x59')][_0xd5a1('0x46')](_0x4f97bd,{'include':[{'model':db['UserProfileResource'],'as':_0xd5a1('0x54')}],'raw':!![],'transaction':_0x2c8898})[_0xd5a1('0x22')](function(_0x551c2f){_0x45d006[_0xd5a1('0x5a')](_0x551c2f[_0xd5a1('0x49')]({'plain':!![]}));});})['then'](function(){return _0x45d006;});});});}})[_0xd5a1('0x22')](function(_0x22ba4c){return _0x22ba4c;})['then'](respondWithResult(_0x5b3bc3,null))[_0xd5a1('0x47')](handleError(_0x5b3bc3,null));};exports[_0xd5a1('0x5b')]=function(_0x3f9972,_0x3a8d86){var _0x4a099c;return db[_0xd5a1('0x3c')][_0xd5a1('0x45')]({'where':{'id':_0x3f9972[_0xd5a1('0x42')]['id']},'attributes':['id',_0xd5a1('0x25')]})[_0xd5a1('0x22')](handleEntityNotFound(_0x3a8d86,null))['then'](function(_0x3d3c1a){if(_0x3d3c1a){_0x4a099c=_0x3d3c1a;return db['UserProfileSection'][_0xd5a1('0x23')]({'where':{'userProfileId':_0x3f9972[_0xd5a1('0x42')]['id'],'sectionId':_0x3f9972['query'][_0xd5a1('0x5c')]}});}})[_0xd5a1('0x22')](function(){return _0x4a099c;})['then'](respondWithStatusCode(_0x3a8d86,null))[_0xd5a1('0x47')](handleError(_0x3a8d86,null));};exports[_0xd5a1('0x5d')]=function(_0x86152,_0x2d0a6d){var _0x57fe79=[];var _0x17a47f=[];return db['UserProfileSection'][_0xd5a1('0x40')]({'where':{'userProfileId':_0x86152[_0xd5a1('0x42')]['id']},'raw':!![]})['then'](function(_0x3c77ab){_0x57fe79=_[_0xd5a1('0x3a')](_0x3c77ab,function(_0x5678cb){return _0x5678cb[_0xd5a1('0x5e')]===0x1||_[_0xd5a1('0x5f')]([0x3eb,0x709],_0x5678cb[_0xd5a1('0x52')]);});if(!_[_0xd5a1('0x60')](_0x57fe79)){return _[_0xd5a1('0x28')](_0x57fe79,function(_0x73e20d){return _0x73e20d['sectionId'];});}else{return;}})['then'](function(_0x51b917){if(_0x51b917)_0x17a47f=_0x51b917;if(_[_0xd5a1('0x5f')](_0x17a47f,0x64)){var _0x3b4342=_[_0xd5a1('0x45')](_0x57fe79,{'sectionId':0x64});return hasDefaultDashboard(_0x3b4342)[_0xd5a1('0x22')](function(_0x1a4073){return _['map'](_0x57fe79,function(_0x42f8fe){if(_0x42f8fe[_0xd5a1('0x52')]===0x64){_0x42f8fe[_0xd5a1('0x61')]=_0x1a4073;}return _0x42f8fe;});});}else{return;}})[_0xd5a1('0x22')](function(_0x278d07){if(_0x278d07)_0x57fe79=_0x278d07;if(_[_0xd5a1('0x5f')](_0x17a47f,0x3eb)){var _0x4f33e8=_[_0xd5a1('0x45')](_0x57fe79,{'sectionId':0x3eb});return getCustomDashboards(_0x4f33e8)[_0xd5a1('0x22')](function(_0x4fbe3c){return _['map'](_0x57fe79,function(_0x578e93){if(_0x4f33e8[_0xd5a1('0x5e')]){if(_0x578e93[_0xd5a1('0x52')]===0x3eb){_0x578e93[_0xd5a1('0x61')]=_0x4fbe3c;}}else{if(_0x578e93[_0xd5a1('0x52')]===0x64){_0x578e93[_0xd5a1('0x61')]=_0x4fbe3c;}}return _0x578e93;});});}else{return;}})[_0xd5a1('0x22')](function(_0x150213){if(_0x150213)_0x57fe79=_0x150213;if(_[_0xd5a1('0x5f')](_0x17a47f,0x709)){var _0x38c420=_['find'](_0x57fe79,{'sectionId':0x709});return getPlugins(_0x38c420)[_0xd5a1('0x22')](function(_0x266a05){if(_0x38c420['enabled']){return _[_0xd5a1('0x28')](_0x57fe79,function(_0x194120){if(_0x194120[_0xd5a1('0x52')]===0x709){_0x194120[_0xd5a1('0x61')]=_0x266a05;}return _0x194120;});}else{var _0x2ff74e={'sectionId':0x76c,'enabled':0x1,'subsections':_0x266a05};var _0x28e72e=_['map'](_0x57fe79);_0x28e72e[_0xd5a1('0x5a')](_0x2ff74e);return _0x28e72e;}});}else{return;}})[_0xd5a1('0x22')](function(_0x3f93cb){if(_0x3f93cb)_0x57fe79=_0x3f93cb;return _[_0xd5a1('0x3a')](_0x57fe79,[_0xd5a1('0x5e'),0x1]);})[_0xd5a1('0x22')](respondWithResult(_0x2d0a6d,null))[_0xd5a1('0x47')](handleError(_0x2d0a6d,null));};function hasDefaultDashboard(_0x485ce9){var _0x5627b7=[0x65];return new BPromise(function(_0x103f78,_0x3428b6){try{if(_0x485ce9[_0xd5a1('0x50')]){_0x103f78(_0x5627b7);}else{return db[_0xd5a1('0x51')]['findOne']({'where':{'sectionId':_0x485ce9['id']},'raw':!![]})[_0xd5a1('0x22')](function(_0xaa7123){_0xaa7123?_0x103f78(_0x5627b7):_0x103f78();});}}catch(_0x4ade11){_0x3428b6(_0x4ade11);}});}function getCustomDashboards(_0xdba51){var _0x5c8b78=[];return new BPromise(function(_0xe244bc,_0x335c5c){try{if(_0xdba51[_0xd5a1('0x50')]){return db[_0xd5a1('0x62')][_0xd5a1('0x40')]({'raw':!![]})[_0xd5a1('0x22')](function(_0x4acdc0){_0x4acdc0[_0xd5a1('0x63')](function(_0x53a929){_0x5c8b78['push'](_0x53a929['id']+0x1869f);});_0xe244bc(_0x5c8b78);});}else{return db[_0xd5a1('0x51')][_0xd5a1('0x40')]({'where':{'sectionId':_0xdba51['id']},'raw':!![]})['then'](function(_0x22bb00){_0x22bb00[_0xd5a1('0x63')](function(_0xab7acd){_0x5c8b78[_0xd5a1('0x5a')](_0xab7acd['resourceId']+0x1869f);});_0xe244bc(_0x5c8b78);});}}catch(_0x2ca4fd){_0x335c5c(_0x2ca4fd);}});}function getPlugins(_0x18370b){var _0x175cbf=[];return new BPromise(function(_0xcaa8e0,_0x41fdf3){try{if(_0x18370b[_0xd5a1('0x50')]){return db['Plugin'][_0xd5a1('0x40')]({'raw':!![]})['then'](function(_0x1bac0e){_0x1bac0e[_0xd5a1('0x63')](function(_0x1cc3df){_0x175cbf[_0xd5a1('0x5a')](_0x1cc3df['id']+0x15b38);});_0xcaa8e0(_0x175cbf);});}else{return db[_0xd5a1('0x51')]['findAll']({'where':{'sectionId':_0x18370b['id']},'raw':!![]})[_0xd5a1('0x22')](function(_0x5398cc){_0x5398cc[_0xd5a1('0x63')](function(_0x22eb95){_0x175cbf[_0xd5a1('0x5a')](_0x22eb95[_0xd5a1('0x64')]+0x15b38);});_0xcaa8e0(_0x175cbf);});}}catch(_0xadcf1e){_0x41fdf3(_0xadcf1e);}});}exports['addResources']=function(_0xe0a9a8,_0x1fccca){return db[_0xd5a1('0x3c')]['find']({'where':{'id':_0xe0a9a8[_0xd5a1('0x42')]['id']}})[_0xd5a1('0x22')](handleEntityNotFound(_0x1fccca,null))['then'](function(_0x19d55b){if(_0x19d55b){return db['sequelize'][_0xd5a1('0x4f')](function(_0x2aff5d){return db[_0xd5a1('0x59')]['findAll']({'where':{'userProfileId':_0xe0a9a8[_0xd5a1('0x42')]['id']},'attributes':['id'],'raw':!![]})[_0xd5a1('0x22')](function(_0x1545a5){if(_0x1545a5){return db[_0xd5a1('0x59')][_0xd5a1('0x23')]({'where':{'userProfileId':_0xe0a9a8[_0xd5a1('0x42')]['id'],'id':_[_0xd5a1('0x28')](_0x1545a5,function(_0x206756){return _0x206756['id'];})},'transaction':_0x2aff5d});}})[_0xd5a1('0x22')](function(_0x59156e){var _0x180bcd=_[_0xd5a1('0x28')](_0xe0a9a8[_0xd5a1('0x4e')],function(_0x18fe81){_0x18fe81[_0xd5a1('0x53')]=_0xe0a9a8[_0xd5a1('0x42')]['id'];return _0x18fe81;});return db[_0xd5a1('0x59')][_0xd5a1('0x65')](_0x180bcd,{'raw':!![],'transaction':_0x2aff5d});})['then'](function(_0x3e87c6){var _0x4daffe=_['filter'](_['map'](_0x3e87c6,function(_0x38a781){return _0x38a781['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4daffe){return db[_0xd5a1('0x59')][_0xd5a1('0x40')]({'where':{'userProfileId':_0xe0a9a8['params']['id'],'sectionId':_[_0xd5a1('0x28')](_0x4daffe,function(_0x141384){return _0x141384[_0xd5a1('0x52')];})},'attributes':['id','sectionId'],'raw':!![]})[_0xd5a1('0x22')](function(_0x28dc66){var _0x45e864=_['map'](_0xe0a9a8[_0xd5a1('0x4e')],function(_0x2f2b6b){_0x2f2b6b['userProfileId']=_0xe0a9a8[_0xd5a1('0x42')]['id'];return _0x2f2b6b;});return db[_0xd5a1('0x51')]['bulkCreate'](_0x45e864,{'raw':!![],'transaction':_0x2aff5d});});}})[_0xd5a1('0x47')](handleError(_0x1fccca,null));});}})[_0xd5a1('0x22')](function(_0x47e06b){var _0x5c13f0=_[_0xd5a1('0x28')](_0x47e06b,function(_0x52746b){return _0x52746b[_0xd5a1('0x49')]({'plain':!![]});});})[_0xd5a1('0x22')](respondWithResult(_0x1fccca,null))[_0xd5a1('0x47')](handleError(_0x1fccca,null));};exports[_0xd5a1('0x66')]=function(_0x541955,_0xc828c5,_0xc16ef1){return db[_0xd5a1('0x3c')]['find']({'where':{'id':_0x541955[_0xd5a1('0x42')]['id']}})[_0xd5a1('0x22')](handleEntityNotFound(_0xc828c5,null))[_0xd5a1('0x22')](function(_0x33f4f7){if(_0x33f4f7){return _0x33f4f7[_0xd5a1('0x66')](_0x541955[_0xd5a1('0x2e')]['ids']);}})[_0xd5a1('0x22')](respondWithStatusCode(_0xc828c5,null))[_0xd5a1('0x47')](handleError(_0xc828c5,null));};exports['getResources']=function(_0x303835,_0x5a14e0){var _0x21a080={'raw':![],'where':{}};var _0x231fa6={};var _0x3e6451={'count':0x0,'rows':[]};var _0xf8b9d9=_0x303835[_0xd5a1('0x2e')]['section'];if(typeof _0xf8b9d9===_0xd5a1('0x67')){throw new db[(_0xd5a1('0x68'))][(_0xd5a1('0x69'))](_0xd5a1('0x6a'));}var _0x169936=_0x303835[_0xd5a1('0x2e')]['mergeResources']||![];var _0x3a369d=getQueryModels(_0xf8b9d9,_0x169936);if(typeof _0x3a369d[_0xd5a1('0x6b')]===_0xd5a1('0x67')){throw new db['Sequelize'][(_0xd5a1('0x69'))](_0xd5a1('0x6c')+_0xf8b9d9+'\x27');}var _0x1f276a=[];if(!_[_0xd5a1('0x60')](_0x3a369d[_0xd5a1('0x6d')])){_0x1f276a=_0x3a369d[_0xd5a1('0x6d')];}else{_0x1f276a=[{'name':_0xf8b9d9}];}return db[_0xd5a1('0x3c')][_0xd5a1('0x6e')]({'where':{'id':_0x303835[_0xd5a1('0x42')]['id']}})['then'](handleEntityNotFound(_0x5a14e0,null))[_0xd5a1('0x22')](function(_0x1145a3){if(_0x1145a3){var _0x429177=[];for(var _0x2be89d=0x0;_0x2be89d<_0x1f276a['length'];_0x2be89d++){_0x429177[_0xd5a1('0x5a')](db[_0xd5a1('0x59')][_0xd5a1('0x6e')]({'where':{'userProfileId':_0x1145a3['id'],'name':_0x1f276a[_0x2be89d][_0xd5a1('0x25')]},'raw':!![]}));}return BPromise[_0xd5a1('0x6f')](_0x429177);}})['then'](function(_0x6f2c36){var _0x5c48be=_['filter'](_0x6f2c36,function(_0x5e7c99){return _0x5e7c99?_0x5e7c99:undefined;});var _0x5c2121=_[_0xd5a1('0x3a')](_0x1f276a,['ignore',!![]]);var _0x1274be=_[_0xd5a1('0x60')](_0x5c48be)&&_[_0xd5a1('0x60')](_0x5c2121)?null:_['union'](_0x5c2121,_0x5c48be);if(_0x1274be){var _0x5dce79=[];for(var _0x30a119=0x0;_0x30a119<_0x1274be['length'];_0x30a119++){var _0x5de190=_[_0xd5a1('0x45')](_0x1f276a,function(_0x2096f4){return _0x1274be[_0x30a119]?_0x2096f4[_0xd5a1('0x25')]===_0x1274be[_0x30a119][_0xd5a1('0x25')]:null;});if(_0x5de190){if(_0x1274be[_0x30a119]['ignore']){_0x5dce79[_0xd5a1('0x5a')](getAllResources(_0x3a369d[_0xd5a1('0x6b')],_0x1274be[_0x30a119]));}else{if(!_0x1274be[_0x30a119][_0xd5a1('0x50')]){_0x5dce79[_0xd5a1('0x5a')](getAllowedResources(_0x5de190,_0x1274be[_0x30a119],_0x3a369d[_0xd5a1('0x6b')]));}else{if(_0x5de190[_0xd5a1('0x2d')]){_0x5dce79[_0xd5a1('0x5a')](getAllFilteredResources(_0x5de190,_0x1274be[_0x30a119]));}}}}}return BPromise[_0xd5a1('0x6f')](_0x5dce79);}else{return null;}})[_0xd5a1('0x22')](function(_0x423172){var _0x3caaa2=_0x423172;var _0x3bbfa2=null;if(_0x3caaa2){_0x3bbfa2=_0x3caaa2[_0xd5a1('0x33')]===0x1?_0x3caaa2[0x0]:null;}if(_0x3bbfa2||_0x3caaa2){var _0x1d688f=db[_0x3a369d[_0xd5a1('0x6b')]]['rawAttributes'];_0x231fa6[_0xd5a1('0x2d')]=_[_0xd5a1('0x43')](_0x1d688f);_0x231fa6[_0xd5a1('0x2e')]=_['keys'](_0x303835[_0xd5a1('0x2e')]);_0x231fa6[_0xd5a1('0x2f')]=_[_0xd5a1('0x30')](_0x231fa6[_0xd5a1('0x2d')],_0x231fa6[_0xd5a1('0x2e')]);_0x21a080['attributes']=_[_0xd5a1('0x30')](_0x231fa6[_0xd5a1('0x2d')],qs['fields'](_0x303835['query'][_0xd5a1('0x32')]));_0x21a080[_0xd5a1('0x31')]=_0x21a080[_0xd5a1('0x31')]['length']?_0x21a080['attributes']:_0x231fa6[_0xd5a1('0x2d')];if(!_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x34')]('nolimit')){_0x21a080['limit']=qs[_0xd5a1('0x1e')](_0x303835['query'][_0xd5a1('0x1e')]);_0x21a080[_0xd5a1('0x36')]=qs[_0xd5a1('0x36')](_0x303835['query'][_0xd5a1('0x36')]);}_0x21a080[_0xd5a1('0x37')]=qs[_0xd5a1('0x38')](_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x38')]);_0x21a080[_0xd5a1('0x39')]=qs[_0xd5a1('0x2f')](_[_0xd5a1('0x70')](_0x303835[_0xd5a1('0x2e')],_0x231fa6[_0xd5a1('0x2f')]));if(_0x303835['query'][_0xd5a1('0x3a')]){_0x21a080[_0xd5a1('0x39')]=_[_0xd5a1('0x3b')](_0x21a080[_0xd5a1('0x39')],{'$or':_[_0xd5a1('0x28')](_0x1d688f,function(_0x40ae6e){if(_0x40ae6e['type'][_0xd5a1('0x2c')]!==_0xd5a1('0x71')){var _0x513cde={};_0x513cde[_0x40ae6e[_0xd5a1('0x72')]]={'$like':'%'+_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x3a')]+'%'};return _0x513cde;}})});}var _0x392c53=[];if(_0x3bbfa2){var _0x1aa8ba=_['find'](_0x1f276a,[_0xd5a1('0x25'),_0x3bbfa2[_0xd5a1('0x25')]]);if(_0x1aa8ba[_0xd5a1('0x72')]){var _0x362b91={};if(_0x3a369d[_0xd5a1('0x6b')]===_0xd5a1('0x73')){_0x362b91[_0x1aa8ba[_0xd5a1('0x74')]]=_['map'](_0x3bbfa2['associatedResources'],'id');}else{_0x362b91[_0x1aa8ba[_0xd5a1('0x74')]]=_0x3bbfa2[_0xd5a1('0x75')];}_0x392c53[_0xd5a1('0x5a')](_0x362b91);}else{_0x21a080['where']['id']=_0x3bbfa2[_0xd5a1('0x75')];}}else{for(var _0x79d702=0x0;_0x79d702<_0x3caaa2[_0xd5a1('0x33')];_0x79d702++){var _0x1aa8ba=_[_0xd5a1('0x45')](_0x1f276a,[_0xd5a1('0x25'),_0x3caaa2[_0x79d702][_0xd5a1('0x25')]]);if(_0x1aa8ba[_0xd5a1('0x72')]){var _0x362b91={};_0x362b91[_0x1aa8ba['foreignKey']]=_0x3caaa2[_0x79d702][_0xd5a1('0x75')];_0x392c53[_0xd5a1('0x5a')](_0x362b91);}else{if(!_0x21a080[_0xd5a1('0x39')]['id'])_0x21a080[_0xd5a1('0x39')]['id']=[];_0x3caaa2[_0x79d702][_0xd5a1('0x75')]['forEach'](function(_0x57dea2){_0x21a080['where']['id'][_0xd5a1('0x5a')](_0x57dea2);});}}}if(!_['isEmpty'](_0x392c53)){_0x21a080[_0xd5a1('0x39')]=_['merge'](_0x21a080['where'],{'$and':{'$or':_0x392c53}});}_0x21a080=_[_0xd5a1('0x3b')]({},_0x21a080,_0x303835[_0xd5a1('0x44')]);if(_0x3bbfa2&&!_0x3bbfa2['autoAssociation']&&_0x3a369d[_0xd5a1('0x6b')]===_0xd5a1('0x73')){if(_0x303835['query'][_0xd5a1('0x3e')]){_0x21a080[_0xd5a1('0x3f')]=[{'all':!![]}];}return db[_0x3a369d['childModel']][_0xd5a1('0x40')](_0x21a080)[_0xd5a1('0x22')](function(_0x17107b){var _0x478560=[];_0x17107b['forEach'](function(_0x1e1f11){var _0x544d3a;switch(_0x1e1f11[_0xd5a1('0x76')]){case _0xd5a1('0x77'):_0x544d3a=_[_0xd5a1('0x45')](_0x3bbfa2[_0xd5a1('0x75')],function(_0x191e82){return _0x191e82['id']===_0x1e1f11[_0xd5a1('0x78')]&&_0x191e82[_0xd5a1('0x2b')]==='DefaultReports';});break;case _0xd5a1('0x79'):_0x544d3a=_[_0xd5a1('0x45')](_0x3bbfa2[_0xd5a1('0x75')],function(_0x573b5a){return _0x573b5a['id']===_0x1e1f11[_0xd5a1('0x78')]&&_0x573b5a[_0xd5a1('0x2b')]==='CustomReports';});break;}if(_0x544d3a)_0x478560[_0xd5a1('0x5a')](_0x1e1f11);});_0x3e6451[_0xd5a1('0x3d')]=_0x478560[_0xd5a1('0x33')];_0x3e6451['rows']=_0x478560;return _0x3e6451;});}else{return db[_0x3a369d[_0xd5a1('0x6b')]][_0xd5a1('0x3d')]({'where':_0x21a080[_0xd5a1('0x39')]})[_0xd5a1('0x22')](function(_0x494ac9){_0x3e6451[_0xd5a1('0x3d')]=_0x494ac9;if(_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x3e')]){if(_0x3a369d[_0xd5a1('0x6b')]===_0xd5a1('0x7a')){_0x21a080[_0xd5a1('0x3f')]=[{'model':db[_0xd5a1('0x7b')],'as':_0xd5a1('0x7c'),'attributes':['id','name',_0xd5a1('0x7d')],'required':_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x7e')]?!![]:![]},{'model':db[_0xd5a1('0x7b')],'as':'ThroughTags','attributes':['id','name',_0xd5a1('0x7d')],'through':_0x303835[_0xd5a1('0x2e')]['tag']?{'attributes':[],'where':{'TagId':_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x7e')]||undefined}}:{},'required':_0x303835[_0xd5a1('0x2e')][_0xd5a1('0x7e')]?!![]:![]}];}else{_0x21a080[_0xd5a1('0x3f')]=[{'all':!![]}];}}return db[_0x3a369d[_0xd5a1('0x6b')]][_0xd5a1('0x40')](_0x21a080);})[_0xd5a1('0x22')](function(_0x48e40f){_0x3e6451[_0xd5a1('0x7f')]=_0x48e40f;return _0x3e6451;});}}else{return _0x3e6451;}})['then'](respondWithFilteredResult(_0x5a14e0,_0x21a080))[_0xd5a1('0x47')](handleError(_0x5a14e0,null));};function getAllResources(_0x92e9d,_0x53d396){return new BPromise(function(_0x58dcf6,_0x355685){if(_0x53d396){var _0x3d16dc=_0x53d396['filter']?{[_0x53d396[_0xd5a1('0x3a')][_0xd5a1('0x72')]]:_0x53d396['filter'][_0xd5a1('0x80')]}:undefined;return db[_0x92e9d][_0xd5a1('0x40')]({'where':_0x3d16dc,'raw':!![]})[_0xd5a1('0x22')](function(_0x33271a){_0x53d396['associatedResources']=_['map'](_0x33271a,'id');_0x58dcf6(_0x53d396);})[_0xd5a1('0x47')](function(_0x179f89){_0x355685(_0x179f89);});}else{_0x58dcf6(null);}});}function getAllFilteredResources(_0x38b9b9,_0x5f52c9){return new BPromise(function(_0x360151,_0x4c12c8){var _0x1dcf80=_0x38b9b9[_0xd5a1('0x3a')]?{[_0x38b9b9[_0xd5a1('0x3a')][_0xd5a1('0x72')]]:_0x38b9b9[_0xd5a1('0x3a')]['value']}:undefined;return db[_0x38b9b9['model']][_0xd5a1('0x40')]({'where':_0x1dcf80,'raw':!![]})[_0xd5a1('0x22')](function(_0x206034){_0x5f52c9[_0xd5a1('0x75')]=_[_0xd5a1('0x28')](_0x206034,function(_0x4d5bae){return _0x4d5bae['name'];});_0x360151(_0x5f52c9);})[_0xd5a1('0x47')](function(_0x2d5264){_0x4c12c8(_0x2d5264);});});}function getAllowedResources(_0x553e99,_0x3f5425,_0x28c68f){return new BPromise(function(_0xe04e42,_0x2ab206){if(_0x3f5425){return db['UserProfileResource'][_0xd5a1('0x40')]({'where':{'sectionId':_0x3f5425['id']},'raw':!![]})['then'](function(_0x3e7667){if(_0x553e99['field']&&_0x553e99[_0xd5a1('0x72')]!=='id'){_0x3f5425[_0xd5a1('0x75')]=_[_0xd5a1('0x28')](_0x3e7667,function(_0x2fff22){return _0x2fff22[_0x553e99[_0xd5a1('0x72')]];});}else{if(_0x28c68f===_0xd5a1('0x73')){_0x3f5425[_0xd5a1('0x75')]=_[_0xd5a1('0x28')](_0x3e7667,function(_0x22d9a6){return{'id':_0x22d9a6[_0xd5a1('0x64')],'type':_0x22d9a6[_0xd5a1('0x2b')]};});}else{_0x3f5425[_0xd5a1('0x75')]=_[_0xd5a1('0x28')](_0x3e7667,function(_0x391c5b){return _0x391c5b['resourceId'];});}}_0xe04e42(_0x3f5425);})[_0xd5a1('0x47')](function(_0x65668a){_0x2ab206(_0x65668a);});}else{_0xe04e42(null);}});}function getQueryModels(_0x455aed,_0x2d1e1f){var _0x2e3f09=_0x455aed[_0xd5a1('0x81')]();var _0x2e85a6={'childModel':undefined,'parentSections':[]};switch(_0x2e3f09){case _0xd5a1('0x82'):_0x2e85a6['childModel']=_0xd5a1('0x83');break;case'odbc':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x84');break;case _0xd5a1('0x85'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x86');_0x2e85a6[_0xd5a1('0x6d')]=[{'name':_0xd5a1('0x87'),'field':'name','foreignKey':_0xd5a1('0x88')}];break;case _0xd5a1('0x89'):_0x2e85a6['childModel']=_0xd5a1('0x8a');break;case'contacts':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x7a');_0x2e85a6[_0xd5a1('0x6d')]=[{'name':'Lists','field':'id','foreignKey':'ListId'}];break;case _0xd5a1('0x8b'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x8c');break;case _0xd5a1('0x8d'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x8e');break;case _0xd5a1('0x8f'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x90');break;case _0xd5a1('0x91'):_0x2e85a6['childModel']=_0xd5a1('0x92');break;case'chatwebsites':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x93');break;case'faxqueues':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x94');break;case _0xd5a1('0x95'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x96');break;case _0xd5a1('0x97'):case'internalroutes':case'outboundroutes':_0x2e85a6['childModel']=_0xd5a1('0x98');break;case'contexts':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x99');break;case _0xd5a1('0x9a'):_0x2e85a6['childModel']=_0xd5a1('0x9b');break;case _0xd5a1('0x9c'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x9d');_0x2e85a6[_0xd5a1('0x6d')]=[{'name':'Agents','field':_0xd5a1('0x25'),'foreignKey':_0xd5a1('0x9e'),'model':_0xd5a1('0x9f'),'filter':{'field':'role','value':[_0xd5a1('0xa0')]}},{'name':'Telephones','field':_0xd5a1('0x25'),'foreignKey':_0xd5a1('0x9e'),'model':_0xd5a1('0x9f'),'filter':{'field':_0xd5a1('0xa1'),'value':[_0xd5a1('0xa2')]}},{'name':_0xd5a1('0xa3'),'field':_0xd5a1('0x25'),'foreignKey':_0xd5a1('0xa4'),'model':_0xd5a1('0xa5'),'filter':{'field':_0xd5a1('0x2b'),'value':[_0xd5a1('0xa6')]}},{'name':_0xd5a1('0xa7'),'field':_0xd5a1('0x25'),'foreignKey':_0xd5a1('0xa4'),'model':'VoiceQueue','filter':{'field':_0xd5a1('0x2b'),'value':[_0xd5a1('0xa8')]}}];break;case'musiconholds':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xa9');break;case _0xd5a1('0xaa'):_0x2e85a6[_0xd5a1('0x6b')]='VoiceChanSpy';break;case'voiceprefixes':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xab');break;case _0xd5a1('0xac'):_0x2e85a6['childModel']='Campaign';break;case'mailqueues':_0x2e85a6[_0xd5a1('0x6b')]='MailQueue';break;case _0xd5a1('0xad'):_0x2e85a6['childModel']='MailAccount';break;case _0xd5a1('0xae'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xaf');break;case _0xd5a1('0xb0'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xb1');break;case _0xd5a1('0xb2'):_0x2e85a6['childModel']=_0xd5a1('0xb3');break;case _0xd5a1('0xb4'):_0x2e85a6['childModel']=_0xd5a1('0xb5');break;case _0xd5a1('0xb6'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xb7');break;case _0xd5a1('0xb8'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xb9');break;case _0xd5a1('0xba'):case _0xd5a1('0xbb'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xa5');if(_0x2d1e1f){_0x2e85a6[_0xd5a1('0x6d')]=[{'name':'VoiceQueues'},{'name':_0xd5a1('0xa7')}];}break;case _0xd5a1('0xbc'):case'agents':case _0xd5a1('0xbd'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x9f');if(_0x2d1e1f){_0x2e85a6[_0xd5a1('0x6d')]=[{'name':_0xd5a1('0xbe'),'filter':{'field':'role','value':[_0xd5a1('0xbf'),_0xd5a1('0xc0')]},'ignore':!![]},{'name':_0xd5a1('0xc1')},{'name':'Telephones'}];}break;case _0xd5a1('0xc2'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xc3');break;case _0xd5a1('0xc4'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xc5');break;case _0xd5a1('0xc6'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xc7');break;case _0xd5a1('0xc8'):_0x2e85a6['childModel']=_0xd5a1('0xc9');break;case _0xd5a1('0xca'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xcb');break;case _0xd5a1('0xcc'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xcd');break;case _0xd5a1('0xce'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x9f');break;case'cannedanswers':_0x2e85a6['childModel']=_0xd5a1('0xcf');break;case'dispositions':_0x2e85a6['childModel']=_0xd5a1('0xd0');break;case'customdashboards':_0x2e85a6[_0xd5a1('0x6b')]='Dashboard';break;case'intervals':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xd1');break;case _0xd5a1('0xd2'):_0x2e85a6[_0xd5a1('0x6b')]='Pause';break;case _0xd5a1('0xd3'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xd4');break;case _0xd5a1('0xd5'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xd6');break;case _0xd5a1('0xd7'):_0x2e85a6['childModel']=_0xd5a1('0x7b');break;case _0xd5a1('0xd8'):_0x2e85a6[_0xd5a1('0x6b')]='Template';break;case _0xd5a1('0xd9'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xda');break;case _0xd5a1('0xdb'):_0x2e85a6[_0xd5a1('0x6b')]='Trunk';break;case _0xd5a1('0xdc'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xdd');break;case _0xd5a1('0xde'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xdf');break;case'extractedreports':_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0x73');_0x2e85a6[_0xd5a1('0x6d')]=[{'name':_0xd5a1('0xe0'),'field':'id','foreignKey':_0xd5a1('0x78')}];break;case _0xd5a1('0xe1'):_0x2e85a6[_0xd5a1('0x6b')]=_0xd5a1('0xe2');break;default:return _0x2e85a6;}return _0x2e85a6;} \ No newline at end of file +var _0x3891=['VoiceMail','voicerecordings','VoiceRecording','Agents','User','role','agent','Telephones','membername','telephone','VoiceQueues','queue','inbound','QueueCampaigns','VoiceQueue','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','MailQueue','mailaccounts','MailAccount','openchannelqueues','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','SmsQueue','smsaccounts','SmsAccount','teams','voicequeues','queuecampaigns','users','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','DeskAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','templates','triggers','Trigger','trunks','Trunk','variables','plugins','extractedreports','Reports','metrics','AnalyticMetric','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./userProfile.socket','register','sendStatus','status','end','json','count','offset','limit','set','reject','save','destroy','error','name','index','map','UserProfile','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','nolimit','sort','where','VIRTUAL','filter','merge','options','then','includeAll','include','findAll','rows','catch','show','params','length','find','create','clone','get','omit','createdAt','crudPermissions','body','updatedAt','sequelize','each','autoAssociation','sectionId','UserProfileSection','UserProfileResource','Resources','update','describe','addSections','userProfileId','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','findOne','forEach','resourceId','Plugin','addResources','bulkCreate','removeResources','section','undefined','Sequelize','Unknown\x20section','mergeResources','childModel','ValidationError','Invalid\x20section\x20\x27','parentSections','all','ignore','union','hasOwnProperty','pick','field','AnalyticExtractedReport','associatedResources','reportType','default','reportId','DefaultReports','custom','CustomReports','Tag','Tags','color','tag','value','toLowerCase','odbc','SquareOdbc','SquareRecording','SquareProjects','projectName','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','faxaccounts','FaxAccount','inboundroutes','VoiceExtension','VoiceContext','voicemails'];(function(_0x54d4fa,_0x3f2dff){var _0x4a8f19=function(_0x573df8){while(--_0x573df8){_0x54d4fa['push'](_0x54d4fa['shift']());}};_0x4a8f19(++_0x3f2dff);}(_0x3891,0x132));var _0x1389=function(_0x4b7895,_0x3c4f5d){_0x4b7895=_0x4b7895-0x0;var _0x264180=_0x3891[_0x4b7895];return _0x264180;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x1389('0x0'));var rimraf=require(_0x1389('0x1'));var zipdir=require(_0x1389('0x2'));var jsonpatch=require(_0x1389('0x3'));var rp=require(_0x1389('0x4'));var moment=require(_0x1389('0x5'));var BPromise=require(_0x1389('0x6'));var Mustache=require(_0x1389('0x7'));var util=require('util');var path=require(_0x1389('0x8'));var sox=require(_0x1389('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x1389('0xa'));var squel=require(_0x1389('0xb'));var crypto=require('crypto');var jsforce=require(_0x1389('0xc'));var deskjs=require(_0x1389('0xd'));var toCsv=require(_0x1389('0xe'));var querystring=require(_0x1389('0xf'));var Papa=require(_0x1389('0x10'));var Redis=require(_0x1389('0x11'));var authService=require(_0x1389('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x1389('0x13'));var hardwareService=require(_0x1389('0x14'));var logger=require(_0x1389('0x15'))(_0x1389('0x16'));var utils=require(_0x1389('0x17'));var config=require('../../config/environment');var db=require(_0x1389('0x18'))['db'];config[_0x1389('0x19')]=_['defaults'](config[_0x1389('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x1389('0x1a'))(new Redis(config[_0x1389('0x19')]));require(_0x1389('0x1b'))[_0x1389('0x1c')](socket);function respondWithStatusCode(_0x11cff4,_0x5b6cbb){_0x5b6cbb=_0x5b6cbb||0xcc;return function(_0x129788){if(_0x129788){return _0x11cff4[_0x1389('0x1d')](_0x5b6cbb);}return _0x11cff4[_0x1389('0x1e')](_0x5b6cbb)[_0x1389('0x1f')]();};}function respondWithResult(_0x105cd9,_0x1ecd6d){_0x1ecd6d=_0x1ecd6d||0xc8;return function(_0x4a8da4){if(_0x4a8da4){return _0x105cd9[_0x1389('0x1e')](_0x1ecd6d)[_0x1389('0x20')](_0x4a8da4);}};}function respondWithFilteredResult(_0x41bd5e,_0xbcf125){return function(_0x83f00d){if(_0x83f00d){var _0x2af6b3=_0x83f00d[_0x1389('0x21')],_0x27e63c=_0xbcf125[_0x1389('0x22')],_0x10d44e=_0xbcf125[_0x1389('0x22')]+_0xbcf125[_0x1389('0x23')],_0x1bb8ee;if(_0x10d44e>=_0x2af6b3){_0x10d44e=_0x2af6b3;_0x1bb8ee=0xc8;}else{_0x1bb8ee=0xce;}_0x41bd5e[_0x1389('0x1e')](_0x1bb8ee);return _0x41bd5e[_0x1389('0x24')]('Content-Range',_0x27e63c+'-'+_0x10d44e+'/'+_0x2af6b3)[_0x1389('0x20')](_0x83f00d);}return null;};}function patchUpdates(_0x44b92a){return function(_0x2ed65a){try{jsonpatch['apply'](_0x2ed65a,_0x44b92a,!![]);}catch(_0x333359){return BPromise[_0x1389('0x25')](_0x333359);}return _0x2ed65a[_0x1389('0x26')]();};}function saveUpdates(_0x528653,_0x36863b){return function(_0x5ddf29){if(_0x5ddf29){return _0x5ddf29['update'](_0x528653)['then'](function(_0x138c7e){return _0x138c7e;});}return null;};}function removeEntity(_0x24637b,_0x569eda){return function(_0x48494b){if(_0x48494b){return _0x48494b[_0x1389('0x27')]()['then'](function(){_0x24637b[_0x1389('0x1e')](0xcc)[_0x1389('0x1f')]();});}};}function handleEntityNotFound(_0x51a706,_0x18578f){return function(_0x230d77){if(!_0x230d77){_0x51a706[_0x1389('0x1d')](0x194);}return _0x230d77;};}function handleError(_0xadd2f8,_0xe69fb1){_0xe69fb1=_0xe69fb1||0x1f4;return function(_0x43d588){logger[_0x1389('0x28')](_0x43d588['stack']);if(_0x43d588[_0x1389('0x29')]){delete _0x43d588[_0x1389('0x29')];}_0xadd2f8['status'](_0xe69fb1)['send'](_0x43d588);};}exports[_0x1389('0x2a')]=function(_0x35c053,_0x1a9e8c){var _0x216a62={},_0x3fbd04={},_0x50b500={'count':0x0,'rows':[]};var _0x4a5c96=_[_0x1389('0x2b')](db[_0x1389('0x2c')][_0x1389('0x2d')],function(_0xfb908d){return{'name':_0xfb908d[_0x1389('0x2e')],'type':_0xfb908d[_0x1389('0x2f')][_0x1389('0x30')]};});_0x3fbd04['model']=_[_0x1389('0x2b')](_0x4a5c96,'name');_0x3fbd04['query']=_[_0x1389('0x31')](_0x35c053[_0x1389('0x32')]);_0x3fbd04[_0x1389('0x33')]=_[_0x1389('0x34')](_0x3fbd04[_0x1389('0x35')],_0x3fbd04[_0x1389('0x32')]);_0x216a62[_0x1389('0x36')]=_[_0x1389('0x34')](_0x3fbd04[_0x1389('0x35')],qs[_0x1389('0x37')](_0x35c053[_0x1389('0x32')][_0x1389('0x37')]));_0x216a62['attributes']=_0x216a62[_0x1389('0x36')]['length']?_0x216a62[_0x1389('0x36')]:_0x3fbd04['model'];if(!_0x35c053[_0x1389('0x32')]['hasOwnProperty'](_0x1389('0x38'))){_0x216a62[_0x1389('0x23')]=qs[_0x1389('0x23')](_0x35c053['query']['limit']);_0x216a62[_0x1389('0x22')]=qs[_0x1389('0x22')](_0x35c053[_0x1389('0x32')][_0x1389('0x22')]);}_0x216a62['order']=qs['sort'](_0x35c053['query'][_0x1389('0x39')]);_0x216a62[_0x1389('0x3a')]=qs['filters'](_['pick'](_0x35c053[_0x1389('0x32')],_0x3fbd04[_0x1389('0x33')]));if(_0x35c053[_0x1389('0x32')]['filter']){_0x216a62[_0x1389('0x3a')]=_['merge'](_0x216a62[_0x1389('0x3a')],{'$or':_[_0x1389('0x2b')](_0x4a5c96,function(_0x23afc9){if(_0x23afc9[_0x1389('0x2f')]!==_0x1389('0x3b')){var _0x2fa401={};_0x2fa401[_0x23afc9[_0x1389('0x29')]]={'$like':'%'+_0x35c053['query'][_0x1389('0x3c')]+'%'};return _0x2fa401;}})});}_0x216a62=_[_0x1389('0x3d')]({},_0x216a62,_0x35c053[_0x1389('0x3e')]);var _0x2a8e33={'where':_0x216a62[_0x1389('0x3a')]};return db[_0x1389('0x2c')][_0x1389('0x21')](_0x2a8e33)[_0x1389('0x3f')](function(_0x5df425){_0x50b500[_0x1389('0x21')]=_0x5df425;if(_0x35c053[_0x1389('0x32')][_0x1389('0x40')]){_0x216a62[_0x1389('0x41')]=[{'all':!![]}];}return db[_0x1389('0x2c')][_0x1389('0x42')](_0x216a62);})[_0x1389('0x3f')](function(_0xc2c537){_0x50b500[_0x1389('0x43')]=_0xc2c537;return _0x50b500;})[_0x1389('0x3f')](respondWithFilteredResult(_0x1a9e8c,_0x216a62))[_0x1389('0x44')](handleError(_0x1a9e8c,null));};exports[_0x1389('0x45')]=function(_0x132c70,_0x259ef4){var _0x1157a0={'raw':![],'where':{'id':_0x132c70[_0x1389('0x46')]['id']}},_0x146595={};_0x146595[_0x1389('0x35')]=_['keys'](db['UserProfile'][_0x1389('0x2d')]);_0x146595[_0x1389('0x32')]=_['keys'](_0x132c70[_0x1389('0x32')]);_0x146595[_0x1389('0x33')]=_[_0x1389('0x34')](_0x146595[_0x1389('0x35')],_0x146595[_0x1389('0x32')]);_0x1157a0[_0x1389('0x36')]=_[_0x1389('0x34')](_0x146595[_0x1389('0x35')],qs[_0x1389('0x37')](_0x132c70[_0x1389('0x32')][_0x1389('0x37')]));_0x1157a0['attributes']=_0x1157a0['attributes'][_0x1389('0x47')]?_0x1157a0[_0x1389('0x36')]:_0x146595[_0x1389('0x35')];if(_0x132c70[_0x1389('0x32')][_0x1389('0x40')]){_0x1157a0[_0x1389('0x41')]=[{'all':!![]}];}_0x1157a0=_['merge']({},_0x1157a0,_0x132c70[_0x1389('0x3e')]);return db[_0x1389('0x2c')][_0x1389('0x48')](_0x1157a0)[_0x1389('0x3f')](handleEntityNotFound(_0x259ef4,null))['then'](respondWithResult(_0x259ef4,null))[_0x1389('0x44')](handleError(_0x259ef4,null));};exports[_0x1389('0x49')]=function(_0x29d3fe,_0x4de941){return db[_0x1389('0x2c')][_0x1389('0x49')](_0x29d3fe['body'],{})[_0x1389('0x3f')](respondWithResult(_0x4de941,0xc9))[_0x1389('0x44')](handleError(_0x4de941,null));};exports[_0x1389('0x4a')]=function(_0x198cf3,_0x3ccf0d){var _0x5220af={'where':{'id':_0x198cf3[_0x1389('0x46')]['id']}},_0x3af7e4={};_0x3af7e4[_0x1389('0x35')]=_[_0x1389('0x31')](db['UserProfile']['rawAttributes']);_0x5220af[_0x1389('0x36')]=_[_0x1389('0x34')](_0x3af7e4[_0x1389('0x35')],qs[_0x1389('0x37')](_0x198cf3['query'][_0x1389('0x37')]));_0x5220af['attributes']=_0x5220af[_0x1389('0x36')][_0x1389('0x47')]?_0x5220af[_0x1389('0x36')]:_0x3af7e4[_0x1389('0x35')];if(_0x198cf3['query'][_0x1389('0x40')]){_0x5220af['include']=[{'all':!![]}];}_0x5220af=_[_0x1389('0x3d')]({},_0x5220af,_0x198cf3[_0x1389('0x3e')]);return db[_0x1389('0x2c')][_0x1389('0x48')](_0x5220af)[_0x1389('0x3f')](handleEntityNotFound(_0x3ccf0d,null))['then'](function(_0x2ea9e5){if(_0x2ea9e5){var _0x4716ea=_0x2ea9e5[_0x1389('0x4b')]({'plain':!![]});_0x4716ea=qs[_0x1389('0x4c')](_0x4716ea,['id',_0x1389('0x4d'),'updatedAt',_0x1389('0x4e')]);_0x198cf3[_0x1389('0x4f')]=_[_0x1389('0x4c')](_0x198cf3[_0x1389('0x4f')],['id',_0x1389('0x4d'),_0x1389('0x50')]);return db[_0x1389('0x51')]['transaction'](function(_0x10aacd){return db['UserProfile']['create'](_['merge'](_0x4716ea,_0x198cf3['body']),{'include':_0x198cf3[_0x1389('0x32')][_0x1389('0x40')]?[{'all':!![]}]:undefined,'transaction':_0x10aacd})['then'](function(_0x1617ac){var _0x59fd3c=_0x1617ac[_0x1389('0x4b')]({'plain':!![]});return db['UserProfileSection'][_0x1389('0x42')]({'where':{'userProfileId':_0x198cf3[_0x1389('0x46')]['id']},'raw':!![]})[_0x1389('0x3f')](function(_0x421ac8){if(_0x421ac8){return BPromise[_0x1389('0x52')](_0x421ac8,function(_0x5d0a44){return new BPromise(function(_0x215002,_0x251087){if(_0x5d0a44[_0x1389('0x53')]===null||_0x5d0a44['autoAssociation']===0x1)_0x215002(null);return db['UserProfileResource'][_0x1389('0x42')]({'where':{'sectionId':_0x5d0a44['id']},'raw':!![]})['then'](function(_0x5ac460){var _0x33ac03=_[_0x1389('0x2b')](_0x5ac460,function(_0x4d03d4){return qs[_0x1389('0x4c')](_0x4d03d4,['id',_0x1389('0x4d'),_0x1389('0x50'),_0x1389('0x54')]);});_0x215002(_0x33ac03);})[_0x1389('0x44')](function(_0x21e26a){_0x251087(_0x21e26a);});})[_0x1389('0x3f')](function(_0x4cad04){var _0x556e86=qs[_0x1389('0x4c')](_0x5d0a44,['id','createdAt',_0x1389('0x50')]);_0x556e86['userProfileId']=_0x59fd3c['id'];if(_0x4cad04)_0x556e86['Resources']=_0x4cad04;return _0x556e86;})[_0x1389('0x3f')](function(_0x5b24a6){return db[_0x1389('0x55')][_0x1389('0x49')](_0x5b24a6,{'include':[{'model':db[_0x1389('0x56')],'as':_0x1389('0x57')}],'raw':!![],'transaction':_0x10aacd});});})[_0x1389('0x3f')](function(){return _0x59fd3c;});}});});});}})[_0x1389('0x3f')](respondWithResult(_0x3ccf0d,0xc9))[_0x1389('0x44')](handleError(_0x3ccf0d,null));};exports[_0x1389('0x58')]=function(_0x4e8834,_0x461c41){if(_0x4e8834['body']['id']){delete _0x4e8834['body']['id'];}return db['UserProfile']['find']({'where':{'id':_0x4e8834[_0x1389('0x46')]['id']}})['then'](handleEntityNotFound(_0x461c41,null))[_0x1389('0x3f')](saveUpdates(_0x4e8834['body'],null))[_0x1389('0x3f')](respondWithResult(_0x461c41,null))[_0x1389('0x44')](handleError(_0x461c41,null));};exports[_0x1389('0x27')]=function(_0x3bc1b5,_0x25b207){return db[_0x1389('0x2c')][_0x1389('0x48')]({'where':{'id':_0x3bc1b5[_0x1389('0x46')]['id']}})[_0x1389('0x3f')](handleEntityNotFound(_0x25b207,null))[_0x1389('0x3f')](removeEntity(_0x25b207,null))[_0x1389('0x44')](handleError(_0x25b207,null));};exports[_0x1389('0x59')]=function(_0x690eab,_0x49dffe){return db[_0x1389('0x2c')][_0x1389('0x59')]()[_0x1389('0x3f')](respondWithResult(_0x49dffe,null))[_0x1389('0x44')](handleError(_0x49dffe,null));};exports[_0x1389('0x5a')]=function(_0xc538b9,_0x3d0866){var _0x5e018b=_0xc538b9[_0x1389('0x4f')];return db['UserProfile']['find']({'where':{'id':_0xc538b9[_0x1389('0x46')]['id']}})['then'](handleEntityNotFound(_0x3d0866,null))['then'](function(_0x2c028a){if(_0x2c028a){return db['sequelize']['transaction'](function(_0x5b9dd5){return db[_0x1389('0x55')][_0x1389('0x27')]({'where':{'userProfileId':_0xc538b9['params']['id'],'sectionId':_[_0x1389('0x2b')](_0x5e018b,function(_0x428cb2){return _0x428cb2[_0x1389('0x54')];})},'transaction':_0x5b9dd5})[_0x1389('0x3f')](function(){var _0x4cecd3=_['map'](_0x5e018b,function(_0x3551d2){_0x3551d2[_0x1389('0x5b')]=_0xc538b9[_0x1389('0x46')]['id'];return _0x3551d2;});var _0x55965b=[];return BPromise[_0x1389('0x52')](_0x4cecd3,function(_0x3417bb){return db[_0x1389('0x55')][_0x1389('0x49')](_0x3417bb,{'include':[{'model':db[_0x1389('0x56')],'as':_0x1389('0x57')}],'raw':!![],'transaction':_0x5b9dd5})['then'](function(_0x5334f3){_0x55965b[_0x1389('0x5c')](_0x5334f3[_0x1389('0x4b')]({'plain':!![]}));});})['then'](function(){return _0x55965b;});});});}})[_0x1389('0x3f')](function(_0x2d43ac){return _0x2d43ac;})[_0x1389('0x3f')](respondWithResult(_0x3d0866,null))[_0x1389('0x44')](handleError(_0x3d0866,null));};exports[_0x1389('0x5d')]=function(_0x32e3a2,_0x55e942){var _0x5dd779;return db['UserProfile'][_0x1389('0x48')]({'where':{'id':_0x32e3a2[_0x1389('0x46')]['id']},'attributes':['id','name']})[_0x1389('0x3f')](handleEntityNotFound(_0x55e942,null))[_0x1389('0x3f')](function(_0x38b377){if(_0x38b377){_0x5dd779=_0x38b377;return db[_0x1389('0x55')][_0x1389('0x27')]({'where':{'userProfileId':_0x32e3a2[_0x1389('0x46')]['id'],'sectionId':_0x32e3a2['query'][_0x1389('0x5e')]}});}})[_0x1389('0x3f')](function(){return _0x5dd779;})[_0x1389('0x3f')](respondWithStatusCode(_0x55e942,null))['catch'](handleError(_0x55e942,null));};exports[_0x1389('0x5f')]=function(_0xe11b53,_0x5f3ad4){var _0x251787=[];var _0x3664c2=[];return db[_0x1389('0x55')][_0x1389('0x42')]({'where':{'userProfileId':_0xe11b53['params']['id']},'raw':!![]})[_0x1389('0x3f')](function(_0x559f9c){_0x251787=_[_0x1389('0x3c')](_0x559f9c,function(_0x26293c){return _0x26293c[_0x1389('0x60')]===0x1||_['includes']([0x3eb,0x709],_0x26293c[_0x1389('0x54')]);});if(!_[_0x1389('0x61')](_0x251787)){return _[_0x1389('0x2b')](_0x251787,function(_0x303227){return _0x303227['sectionId'];});}else{return;}})[_0x1389('0x3f')](function(_0x5d79f7){if(_0x5d79f7)_0x3664c2=_0x5d79f7;if(_[_0x1389('0x62')](_0x3664c2,0x64)){var _0x3e0d11=_[_0x1389('0x48')](_0x251787,{'sectionId':0x64});return hasDefaultDashboard(_0x3e0d11)['then'](function(_0x1602a1){return _[_0x1389('0x2b')](_0x251787,function(_0xcaf6f3){if(_0xcaf6f3['sectionId']===0x64){_0xcaf6f3[_0x1389('0x63')]=_0x1602a1;}return _0xcaf6f3;});});}else{return;}})[_0x1389('0x3f')](function(_0x208fbb){if(_0x208fbb)_0x251787=_0x208fbb;if(_[_0x1389('0x62')](_0x3664c2,0x3eb)){var _0x1b30e8=_[_0x1389('0x48')](_0x251787,{'sectionId':0x3eb});return getCustomDashboards(_0x1b30e8)[_0x1389('0x3f')](function(_0x4b037f){return _[_0x1389('0x2b')](_0x251787,function(_0x51ca74){if(_0x1b30e8['enabled']){if(_0x51ca74[_0x1389('0x54')]===0x3eb){_0x51ca74[_0x1389('0x63')]=_0x4b037f;}}else{if(_0x51ca74[_0x1389('0x54')]===0x64){_0x51ca74[_0x1389('0x63')]=_0x4b037f;}}return _0x51ca74;});});}else{return;}})[_0x1389('0x3f')](function(_0xbcf2a4){if(_0xbcf2a4)_0x251787=_0xbcf2a4;if(_[_0x1389('0x62')](_0x3664c2,0x709)){var _0x5195d5=_[_0x1389('0x48')](_0x251787,{'sectionId':0x709});return getPlugins(_0x5195d5)[_0x1389('0x3f')](function(_0x553ef2){if(_0x5195d5[_0x1389('0x60')]){return _['map'](_0x251787,function(_0x578289){if(_0x578289['sectionId']===0x709){_0x578289[_0x1389('0x63')]=_0x553ef2;}return _0x578289;});}else{var _0xc30405={'sectionId':0x76c,'enabled':0x1,'subsections':_0x553ef2};var _0x2a99c3=_[_0x1389('0x2b')](_0x251787);_0x2a99c3[_0x1389('0x5c')](_0xc30405);return _0x2a99c3;}});}else{return;}})[_0x1389('0x3f')](function(_0x99589c){if(_0x99589c)_0x251787=_0x99589c;return _[_0x1389('0x3c')](_0x251787,[_0x1389('0x60'),0x1]);})['then'](respondWithResult(_0x5f3ad4,null))[_0x1389('0x44')](handleError(_0x5f3ad4,null));};function hasDefaultDashboard(_0x41dfbd){var _0x7cfad3=[0x65];return new BPromise(function(_0xc0792b,_0x532bdf){try{if(_0x41dfbd['autoAssociation']){_0xc0792b(_0x7cfad3);}else{return db[_0x1389('0x56')][_0x1389('0x64')]({'where':{'sectionId':_0x41dfbd['id']},'raw':!![]})[_0x1389('0x3f')](function(_0x38e9ee){_0x38e9ee?_0xc0792b(_0x7cfad3):_0xc0792b();});}}catch(_0x3df679){_0x532bdf(_0x3df679);}});}function getCustomDashboards(_0x539258){var _0x34ffc1=[];return new BPromise(function(_0x3c4163,_0xb97cf8){try{if(_0x539258[_0x1389('0x53')]){return db['Dashboard'][_0x1389('0x42')]({'raw':!![]})[_0x1389('0x3f')](function(_0x194c07){_0x194c07[_0x1389('0x65')](function(_0x501f50){_0x34ffc1[_0x1389('0x5c')](_0x501f50['id']+0x1869f);});_0x3c4163(_0x34ffc1);});}else{return db[_0x1389('0x56')][_0x1389('0x42')]({'where':{'sectionId':_0x539258['id']},'raw':!![]})['then'](function(_0x4eb49d){_0x4eb49d[_0x1389('0x65')](function(_0x517b35){_0x34ffc1['push'](_0x517b35[_0x1389('0x66')]+0x1869f);});_0x3c4163(_0x34ffc1);});}}catch(_0x70f410){_0xb97cf8(_0x70f410);}});}function getPlugins(_0x5cdfea){var _0x36205d=[];return new BPromise(function(_0x538c3a,_0x5dbb4a){try{if(_0x5cdfea[_0x1389('0x53')]){return db[_0x1389('0x67')][_0x1389('0x42')]({'raw':!![]})[_0x1389('0x3f')](function(_0x23d706){_0x23d706[_0x1389('0x65')](function(_0x50fc31){_0x36205d[_0x1389('0x5c')](_0x50fc31['id']+0x15b38);});_0x538c3a(_0x36205d);});}else{return db[_0x1389('0x56')][_0x1389('0x42')]({'where':{'sectionId':_0x5cdfea['id']},'raw':!![]})[_0x1389('0x3f')](function(_0x47fa22){_0x47fa22[_0x1389('0x65')](function(_0x450507){_0x36205d[_0x1389('0x5c')](_0x450507['resourceId']+0x15b38);});_0x538c3a(_0x36205d);});}}catch(_0x398270){_0x5dbb4a(_0x398270);}});}exports[_0x1389('0x68')]=function(_0x3d52ad,_0x4113ed){return db[_0x1389('0x2c')][_0x1389('0x48')]({'where':{'id':_0x3d52ad[_0x1389('0x46')]['id']}})['then'](handleEntityNotFound(_0x4113ed,null))[_0x1389('0x3f')](function(_0x35b085){if(_0x35b085){return db[_0x1389('0x51')]['transaction'](function(_0x3edc37){return db['UserProfileSection'][_0x1389('0x42')]({'where':{'userProfileId':_0x3d52ad['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x3c2c33){if(_0x3c2c33){return db[_0x1389('0x55')][_0x1389('0x27')]({'where':{'userProfileId':_0x3d52ad[_0x1389('0x46')]['id'],'id':_['map'](_0x3c2c33,function(_0x574bc0){return _0x574bc0['id'];})},'transaction':_0x3edc37});}})[_0x1389('0x3f')](function(_0x4d4797){var _0x37e6db=_[_0x1389('0x2b')](_0x3d52ad[_0x1389('0x4f')],function(_0x8c735b){_0x8c735b['userProfileId']=_0x3d52ad[_0x1389('0x46')]['id'];return _0x8c735b;});return db[_0x1389('0x55')][_0x1389('0x69')](_0x37e6db,{'raw':!![],'transaction':_0x3edc37});})[_0x1389('0x3f')](function(_0x52e21a){var _0x4f4137=_[_0x1389('0x3c')](_[_0x1389('0x2b')](_0x52e21a,function(_0x4c85a0){return _0x4c85a0[_0x1389('0x4b')]({'plain':!![]});}),{'includeAll':![]});if(_0x4f4137){return db[_0x1389('0x55')][_0x1389('0x42')]({'where':{'userProfileId':_0x3d52ad[_0x1389('0x46')]['id'],'sectionId':_[_0x1389('0x2b')](_0x4f4137,function(_0x5a3f2c){return _0x5a3f2c[_0x1389('0x54')];})},'attributes':['id','sectionId'],'raw':!![]})['then'](function(_0x350425){var _0x117e5a=_['map'](_0x3d52ad['body'],function(_0x1e767e){_0x1e767e[_0x1389('0x5b')]=_0x3d52ad[_0x1389('0x46')]['id'];return _0x1e767e;});return db[_0x1389('0x56')]['bulkCreate'](_0x117e5a,{'raw':!![],'transaction':_0x3edc37});});}})['catch'](handleError(_0x4113ed,null));});}})[_0x1389('0x3f')](function(_0x76f88f){var _0x35d419=_[_0x1389('0x2b')](_0x76f88f,function(_0x2365df){return _0x2365df['get']({'plain':!![]});});})['then'](respondWithResult(_0x4113ed,null))['catch'](handleError(_0x4113ed,null));};exports[_0x1389('0x6a')]=function(_0x20aaec,_0x562ebf,_0x18ed10){return db[_0x1389('0x2c')]['find']({'where':{'id':_0x20aaec[_0x1389('0x46')]['id']}})[_0x1389('0x3f')](handleEntityNotFound(_0x562ebf,null))['then'](function(_0x1d3421){if(_0x1d3421){return _0x1d3421[_0x1389('0x6a')](_0x20aaec[_0x1389('0x32')][_0x1389('0x5e')]);}})[_0x1389('0x3f')](respondWithStatusCode(_0x562ebf,null))[_0x1389('0x44')](handleError(_0x562ebf,null));};exports['getResources']=function(_0x1b6d30,_0x4778a4){var _0x5cadef={'raw':![],'where':{}};var _0x335dbe={};var _0x12d8cf={'count':0x0,'rows':[]};var _0x262f19=_0x1b6d30[_0x1389('0x32')][_0x1389('0x6b')];if(typeof _0x262f19===_0x1389('0x6c')){throw new db[(_0x1389('0x6d'))]['ValidationError'](_0x1389('0x6e'));}var _0xf51a79=_0x1b6d30[_0x1389('0x32')][_0x1389('0x6f')]||![];var _0x58da34=getQueryModels(_0x262f19,_0xf51a79);if(typeof _0x58da34[_0x1389('0x70')]===_0x1389('0x6c')){throw new db[(_0x1389('0x6d'))][(_0x1389('0x71'))](_0x1389('0x72')+_0x262f19+'\x27');}var _0x6077f5=[];if(!_['isEmpty'](_0x58da34[_0x1389('0x73')])){_0x6077f5=_0x58da34['parentSections'];}else{_0x6077f5=[{'name':_0x262f19}];}return db['UserProfile'][_0x1389('0x64')]({'where':{'id':_0x1b6d30[_0x1389('0x46')]['id']}})[_0x1389('0x3f')](handleEntityNotFound(_0x4778a4,null))['then'](function(_0x50bda8){if(_0x50bda8){var _0x490894=[];for(var _0x291fc8=0x0;_0x291fc8<_0x6077f5['length'];_0x291fc8++){_0x490894[_0x1389('0x5c')](db[_0x1389('0x55')]['findOne']({'where':{'userProfileId':_0x50bda8['id'],'name':_0x6077f5[_0x291fc8][_0x1389('0x29')]},'raw':!![]}));}return BPromise[_0x1389('0x74')](_0x490894);}})[_0x1389('0x3f')](function(_0x2aef1a){var _0x2ecaf8=_['filter'](_0x2aef1a,function(_0xf4cf33){return _0xf4cf33?_0xf4cf33:undefined;});var _0x5d8112=_[_0x1389('0x3c')](_0x6077f5,[_0x1389('0x75'),!![]]);var _0x9c75b3=_[_0x1389('0x61')](_0x2ecaf8)&&_['isEmpty'](_0x5d8112)?null:_[_0x1389('0x76')](_0x5d8112,_0x2ecaf8);if(_0x9c75b3){var _0x5f23ff=[];for(var _0x31ac4c=0x0;_0x31ac4c<_0x9c75b3[_0x1389('0x47')];_0x31ac4c++){var _0x2641a6=_[_0x1389('0x48')](_0x6077f5,function(_0x48306e){return _0x9c75b3[_0x31ac4c]?_0x48306e[_0x1389('0x29')]===_0x9c75b3[_0x31ac4c][_0x1389('0x29')]:null;});if(_0x2641a6){if(_0x9c75b3[_0x31ac4c][_0x1389('0x75')]){_0x5f23ff[_0x1389('0x5c')](getAllResources(_0x58da34[_0x1389('0x70')],_0x9c75b3[_0x31ac4c]));}else{if(!_0x9c75b3[_0x31ac4c][_0x1389('0x53')]){_0x5f23ff[_0x1389('0x5c')](getAllowedResources(_0x2641a6,_0x9c75b3[_0x31ac4c],_0x58da34[_0x1389('0x70')]));}else{if(_0x2641a6[_0x1389('0x35')]){_0x5f23ff['push'](getAllFilteredResources(_0x2641a6,_0x9c75b3[_0x31ac4c]));}}}}}return BPromise['all'](_0x5f23ff);}else{return null;}})[_0x1389('0x3f')](function(_0x432bf8){var _0xff6ff6=_0x432bf8;var _0x3e5b42=null;if(_0xff6ff6){_0x3e5b42=_0xff6ff6['length']===0x1?_0xff6ff6[0x0]:null;}if(_0x3e5b42||_0xff6ff6){var _0x462a42=db[_0x58da34[_0x1389('0x70')]][_0x1389('0x2d')];_0x335dbe[_0x1389('0x35')]=_['keys'](_0x462a42);_0x335dbe[_0x1389('0x32')]=_[_0x1389('0x31')](_0x1b6d30[_0x1389('0x32')]);_0x335dbe[_0x1389('0x33')]=_[_0x1389('0x34')](_0x335dbe[_0x1389('0x35')],_0x335dbe[_0x1389('0x32')]);_0x5cadef[_0x1389('0x36')]=_['intersection'](_0x335dbe['model'],qs['fields'](_0x1b6d30[_0x1389('0x32')][_0x1389('0x37')]));_0x5cadef[_0x1389('0x36')]=_0x5cadef[_0x1389('0x36')][_0x1389('0x47')]?_0x5cadef[_0x1389('0x36')]:_0x335dbe['model'];if(!_0x1b6d30[_0x1389('0x32')][_0x1389('0x77')](_0x1389('0x38'))){_0x5cadef[_0x1389('0x23')]=qs[_0x1389('0x23')](_0x1b6d30[_0x1389('0x32')][_0x1389('0x23')]);_0x5cadef[_0x1389('0x22')]=qs[_0x1389('0x22')](_0x1b6d30[_0x1389('0x32')][_0x1389('0x22')]);}_0x5cadef['order']=qs['sort'](_0x1b6d30[_0x1389('0x32')][_0x1389('0x39')]);_0x5cadef[_0x1389('0x3a')]=qs['filters'](_[_0x1389('0x78')](_0x1b6d30[_0x1389('0x32')],_0x335dbe[_0x1389('0x33')]));if(_0x1b6d30[_0x1389('0x32')][_0x1389('0x3c')]){_0x5cadef[_0x1389('0x3a')]=_['merge'](_0x5cadef[_0x1389('0x3a')],{'$or':_[_0x1389('0x2b')](_0x462a42,function(_0xb14acd){if(_0xb14acd[_0x1389('0x2f')][_0x1389('0x30')]!=='VIRTUAL'){var _0x2aae81={};_0x2aae81[_0xb14acd['field']]={'$like':'%'+_0x1b6d30[_0x1389('0x32')][_0x1389('0x3c')]+'%'};return _0x2aae81;}})});}var _0x1381dc=[];if(_0x3e5b42){var _0x51b810=_[_0x1389('0x48')](_0x6077f5,['name',_0x3e5b42[_0x1389('0x29')]]);if(_0x51b810[_0x1389('0x79')]){var _0x1411d5={};if(_0x58da34['childModel']===_0x1389('0x7a')){_0x1411d5[_0x51b810['foreignKey']]=_[_0x1389('0x2b')](_0x3e5b42['associatedResources'],'id');}else{_0x1411d5[_0x51b810['foreignKey']]=_0x3e5b42['associatedResources'];}_0x1381dc[_0x1389('0x5c')](_0x1411d5);}else{_0x5cadef[_0x1389('0x3a')]['id']=_0x3e5b42[_0x1389('0x7b')];}}else{for(var _0x33dab8=0x0;_0x33dab8<_0xff6ff6[_0x1389('0x47')];_0x33dab8++){var _0x51b810=_[_0x1389('0x48')](_0x6077f5,[_0x1389('0x29'),_0xff6ff6[_0x33dab8][_0x1389('0x29')]]);if(_0x51b810[_0x1389('0x79')]){var _0x1411d5={};_0x1411d5[_0x51b810['foreignKey']]=_0xff6ff6[_0x33dab8][_0x1389('0x7b')];_0x1381dc[_0x1389('0x5c')](_0x1411d5);}else{if(!_0x5cadef[_0x1389('0x3a')]['id'])_0x5cadef['where']['id']=[];_0xff6ff6[_0x33dab8][_0x1389('0x7b')][_0x1389('0x65')](function(_0x527915){_0x5cadef[_0x1389('0x3a')]['id']['push'](_0x527915);});}}}if(!_[_0x1389('0x61')](_0x1381dc)){_0x5cadef['where']=_[_0x1389('0x3d')](_0x5cadef['where'],{'$and':{'$or':_0x1381dc}});}_0x5cadef=_[_0x1389('0x3d')]({},_0x5cadef,_0x1b6d30['options']);if(_0x3e5b42&&!_0x3e5b42[_0x1389('0x53')]&&_0x58da34[_0x1389('0x70')]==='AnalyticExtractedReport'){if(_0x1b6d30[_0x1389('0x32')][_0x1389('0x40')]){_0x5cadef[_0x1389('0x41')]=[{'all':!![]}];}return db[_0x58da34[_0x1389('0x70')]][_0x1389('0x42')](_0x5cadef)['then'](function(_0x23229b){var _0xea562=[];_0x23229b[_0x1389('0x65')](function(_0x5212a3){var _0x45e9e6;switch(_0x5212a3[_0x1389('0x7c')]){case _0x1389('0x7d'):_0x45e9e6=_[_0x1389('0x48')](_0x3e5b42[_0x1389('0x7b')],function(_0x10a3b8){return _0x10a3b8['id']===_0x5212a3[_0x1389('0x7e')]&&_0x10a3b8['type']===_0x1389('0x7f');});break;case _0x1389('0x80'):_0x45e9e6=_['find'](_0x3e5b42[_0x1389('0x7b')],function(_0x47d0bd){return _0x47d0bd['id']===_0x5212a3[_0x1389('0x7e')]&&_0x47d0bd[_0x1389('0x2f')]===_0x1389('0x81');});break;}if(_0x45e9e6)_0xea562[_0x1389('0x5c')](_0x5212a3);});_0x12d8cf[_0x1389('0x21')]=_0xea562[_0x1389('0x47')];_0x12d8cf[_0x1389('0x43')]=_0xea562;return _0x12d8cf;});}else{return db[_0x58da34[_0x1389('0x70')]][_0x1389('0x21')]({'where':_0x5cadef[_0x1389('0x3a')]})[_0x1389('0x3f')](function(_0x3bf7f8){_0x12d8cf['count']=_0x3bf7f8;if(_0x1b6d30[_0x1389('0x32')][_0x1389('0x40')]){if(_0x58da34['childModel']==='CmContact'){_0x5cadef[_0x1389('0x41')]=[{'model':db[_0x1389('0x82')],'as':_0x1389('0x83'),'attributes':['id',_0x1389('0x29'),_0x1389('0x84')],'required':_0x1b6d30[_0x1389('0x32')]['tag']?!![]:![]},{'model':db[_0x1389('0x82')],'as':'ThroughTags','attributes':['id','name',_0x1389('0x84')],'through':_0x1b6d30['query'][_0x1389('0x85')]?{'attributes':[],'where':{'TagId':_0x1b6d30[_0x1389('0x32')]['tag']||undefined}}:{},'required':_0x1b6d30[_0x1389('0x32')][_0x1389('0x85')]?!![]:![]}];}else{_0x5cadef[_0x1389('0x41')]=[{'all':!![]}];}}return db[_0x58da34[_0x1389('0x70')]][_0x1389('0x42')](_0x5cadef);})[_0x1389('0x3f')](function(_0x2b67bf){_0x12d8cf[_0x1389('0x43')]=_0x2b67bf;return _0x12d8cf;});}}else{return _0x12d8cf;}})[_0x1389('0x3f')](respondWithFilteredResult(_0x4778a4,_0x5cadef))[_0x1389('0x44')](handleError(_0x4778a4,null));};function getAllResources(_0x5660be,_0x41f0be){return new BPromise(function(_0x55487e,_0x7b6150){if(_0x41f0be){var _0x34c53e=_0x41f0be['filter']?{[_0x41f0be[_0x1389('0x3c')][_0x1389('0x79')]]:_0x41f0be[_0x1389('0x3c')][_0x1389('0x86')]}:undefined;return db[_0x5660be][_0x1389('0x42')]({'where':_0x34c53e,'raw':!![]})[_0x1389('0x3f')](function(_0x4d1f09){_0x41f0be['associatedResources']=_['map'](_0x4d1f09,'id');_0x55487e(_0x41f0be);})[_0x1389('0x44')](function(_0x4e7add){_0x7b6150(_0x4e7add);});}else{_0x55487e(null);}});}function getAllFilteredResources(_0x63e971,_0x2f194e){return new BPromise(function(_0x5e2ed2,_0x220297){var _0x21da6d=_0x63e971['filter']?{[_0x63e971['filter'][_0x1389('0x79')]]:_0x63e971[_0x1389('0x3c')][_0x1389('0x86')]}:undefined;return db[_0x63e971[_0x1389('0x35')]]['findAll']({'where':_0x21da6d,'raw':!![]})['then'](function(_0x5319de){_0x2f194e[_0x1389('0x7b')]=_['map'](_0x5319de,function(_0xaf805c){return _0xaf805c[_0x1389('0x29')];});_0x5e2ed2(_0x2f194e);})['catch'](function(_0x4626ae){_0x220297(_0x4626ae);});});}function getAllowedResources(_0x6f2670,_0x309cc8,_0x3ad849){return new BPromise(function(_0x1a6482,_0x105dab){if(_0x309cc8){return db[_0x1389('0x56')][_0x1389('0x42')]({'where':{'sectionId':_0x309cc8['id']},'raw':!![]})[_0x1389('0x3f')](function(_0x59c842){if(_0x6f2670['field']&&_0x6f2670[_0x1389('0x79')]!=='id'){_0x309cc8['associatedResources']=_['map'](_0x59c842,function(_0x5a5b50){return _0x5a5b50[_0x6f2670[_0x1389('0x79')]];});}else{if(_0x3ad849===_0x1389('0x7a')){_0x309cc8['associatedResources']=_['map'](_0x59c842,function(_0x267997){return{'id':_0x267997[_0x1389('0x66')],'type':_0x267997['type']};});}else{_0x309cc8[_0x1389('0x7b')]=_[_0x1389('0x2b')](_0x59c842,function(_0x433bd0){return _0x433bd0[_0x1389('0x66')];});}}_0x1a6482(_0x309cc8);})['catch'](function(_0x816510){_0x105dab(_0x816510);});}else{_0x1a6482(null);}});}function getQueryModels(_0x25866e,_0x1f75bf){var _0x526c77=_0x25866e[_0x1389('0x87')]();var _0xf32b0f={'childModel':undefined,'parentSections':[]};switch(_0x526c77){case'squareprojects':_0xf32b0f['childModel']='SquareProject';break;case _0x1389('0x88'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x89');break;case'squarerecordings':_0xf32b0f['childModel']=_0x1389('0x8a');_0xf32b0f[_0x1389('0x73')]=[{'name':_0x1389('0x8b'),'field':'name','foreignKey':_0x1389('0x8c')}];break;case _0x1389('0x8d'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x8e');break;case _0x1389('0x8f'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x90');_0xf32b0f[_0x1389('0x73')]=[{'name':_0x1389('0x91'),'field':'id','foreignKey':_0x1389('0x92')}];break;case'lists':_0xf32b0f[_0x1389('0x70')]=_0x1389('0x93');break;case'companies':_0xf32b0f[_0x1389('0x70')]='CmCompany';break;case'globalcustomfields':_0xf32b0f[_0x1389('0x70')]=_0x1389('0x94');break;case _0x1389('0x95'):_0xf32b0f['childModel']=_0x1389('0x96');break;case _0x1389('0x97'):_0xf32b0f['childModel']=_0x1389('0x98');break;case'faxqueues':_0xf32b0f[_0x1389('0x70')]=_0x1389('0x99');break;case _0x1389('0x9a'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x9b');break;case _0x1389('0x9c'):case'internalroutes':case'outboundroutes':_0xf32b0f['childModel']=_0x1389('0x9d');break;case'contexts':_0xf32b0f[_0x1389('0x70')]=_0x1389('0x9e');break;case _0x1389('0x9f'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xa0');break;case _0x1389('0xa1'):_0xf32b0f['childModel']=_0x1389('0xa2');_0xf32b0f[_0x1389('0x73')]=[{'name':_0x1389('0xa3'),'field':_0x1389('0x29'),'foreignKey':'membername','model':_0x1389('0xa4'),'filter':{'field':_0x1389('0xa5'),'value':[_0x1389('0xa6')]}},{'name':_0x1389('0xa7'),'field':_0x1389('0x29'),'foreignKey':_0x1389('0xa8'),'model':_0x1389('0xa4'),'filter':{'field':'role','value':[_0x1389('0xa9')]}},{'name':_0x1389('0xaa'),'field':'name','foreignKey':_0x1389('0xab'),'model':'VoiceQueue','filter':{'field':'type','value':[_0x1389('0xac')]}},{'name':_0x1389('0xad'),'field':_0x1389('0x29'),'foreignKey':'queue','model':_0x1389('0xae'),'filter':{'field':_0x1389('0x2f'),'value':[_0x1389('0xaf')]}}];break;case _0x1389('0xb0'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xb1');break;case _0x1389('0xb2'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xb3');break;case _0x1389('0xb4'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xb5');break;case'ivrcampaigns':_0xf32b0f['childModel']=_0x1389('0xb6');break;case'mailqueues':_0xf32b0f['childModel']=_0x1389('0xb7');break;case _0x1389('0xb8'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xb9');break;case'mailsubstatuses':_0xf32b0f[_0x1389('0x70')]='MailSubstatus';break;case _0x1389('0xba'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xbb');break;case _0x1389('0xbc'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xbd');break;case _0x1389('0xbe'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xbf');break;case _0x1389('0xc0'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xc1');break;case _0x1389('0xc2'):_0xf32b0f[_0x1389('0x70')]='Team';break;case _0x1389('0xc3'):case _0x1389('0xc4'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xae');if(_0x1f75bf){_0xf32b0f['parentSections']=[{'name':'VoiceQueues'},{'name':_0x1389('0xad')}];}break;case _0x1389('0xc5'):case'agents':case _0x1389('0xc6'):_0xf32b0f['childModel']=_0x1389('0xa4');if(_0x1f75bf){_0xf32b0f[_0x1389('0x73')]=[{'name':_0x1389('0xc7'),'filter':{'field':_0x1389('0xa5'),'value':[_0x1389('0xc8'),'user']},'ignore':!![]},{'name':_0x1389('0xa3')},{'name':_0x1389('0xa7')}];}break;case _0x1389('0xc9'):_0xf32b0f['childModel']=_0x1389('0xca');break;case _0x1389('0xcb'):_0xf32b0f[_0x1389('0x70')]='SalesforceAccount';break;case _0x1389('0xcc'):_0xf32b0f['childModel']=_0x1389('0xcd');break;case _0x1389('0xce'):_0xf32b0f['childModel']='SugarcrmAccount';break;case'deskaccounts':_0xf32b0f[_0x1389('0x70')]=_0x1389('0xcf');break;case'zohoaccounts':_0xf32b0f['childModel']='ZohoAccount';break;case _0x1389('0xd0'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xa4');break;case _0x1389('0xd1'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xd2');break;case _0x1389('0xd3'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xd4');break;case'customdashboards':_0xf32b0f['childModel']=_0x1389('0xd5');break;case _0x1389('0xd6'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xd7');break;case _0x1389('0xd8'):_0xf32b0f['childModel']='Pause';break;case _0x1389('0xd9'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xda');break;case _0x1389('0xdb'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xdc');break;case _0x1389('0xdd'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x82');break;case _0x1389('0xde'):_0xf32b0f['childModel']='Template';break;case _0x1389('0xdf'):_0xf32b0f['childModel']=_0x1389('0xe0');break;case _0x1389('0xe1'):_0xf32b0f['childModel']=_0x1389('0xe2');break;case _0x1389('0xe3'):_0xf32b0f[_0x1389('0x70')]='Variable';break;case _0x1389('0xe4'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0x67');break;case _0x1389('0xe5'):_0xf32b0f['childModel']='AnalyticExtractedReport';_0xf32b0f[_0x1389('0x73')]=[{'name':_0x1389('0xe6'),'field':'id','foreignKey':_0x1389('0x7e')}];break;case _0x1389('0xe7'):_0xf32b0f[_0x1389('0x70')]=_0x1389('0xe8');break;default:return _0xf32b0f;}return _0xf32b0f;} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index be171b6..0a4afe4 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 _0xc54c=['setMaxListeners','save','hasOwnProperty','hook','events','../../mysqldb','UserProfile'];(function(_0x4fa3cf,_0x5ee88d){var _0x1d1e2c=function(_0x5000e3){while(--_0x5000e3){_0x4fa3cf['push'](_0x4fa3cf['shift']());}};_0x1d1e2c(++_0x5ee88d);}(_0xc54c,0x19a));var _0xcc54=function(_0x3a3c17,_0x5b7b7e){_0x3a3c17=_0x3a3c17-0x0;var _0xd07f21=_0xc54c[_0x3a3c17];return _0xd07f21;};'use strict';var EventEmitter=require(_0xcc54('0x0'));var UserProfile=require(_0xcc54('0x1'))['db'][_0xcc54('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xcc54('0x3')](0x0);var events={'afterCreate':_0xcc54('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x5dea2b){return function(_0x4c92a7,_0x3a99d0,_0x4d3353){UserProfileEvents['emit'](_0x5dea2b+':'+_0x4c92a7['id'],_0x4c92a7);UserProfileEvents['emit'](_0x5dea2b,_0x4c92a7);_0x4d3353(null);};}for(var e in events){if(events[_0xcc54('0x5')](e)){var event=events[e];UserProfile[_0xcc54('0x6')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0x80ea=['events','../../mysqldb','UserProfile','setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x80ea,0x82));var _0xa80e=function(_0x3bfd5e,_0x2e8c70){_0x3bfd5e=_0x3bfd5e-0x0;var _0x3f5359=_0x80ea[_0x3bfd5e];return _0x3f5359;};'use strict';var EventEmitter=require(_0xa80e('0x0'));var UserProfile=require(_0xa80e('0x1'))['db'][_0xa80e('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xa80e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xa80e('0x4'),'afterDestroy':_0xa80e('0x5')};function emitEvent(_0xaaffb9){return function(_0x478367,_0x438c30,_0x2a8171){UserProfileEvents['emit'](_0xaaffb9+':'+_0x478367['id'],_0x478367);UserProfileEvents[_0xa80e('0x6')](_0xaaffb9,_0x478367);_0x2a8171(null);};}for(var e in events){if(events[_0xa80e('0x7')](e)){var event=events[e];UserProfile[_0xa80e('0x8')](e,emitEvent(event));}}module[_0xa80e('0x9')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index a788873..2855e8d 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 _0x7b38=['UserProfile','user_profiles','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','define'];(function(_0x535412,_0x420e3f){var _0x1485fd=function(_0x55f50e){while(--_0x55f50e){_0x535412['push'](_0x535412['shift']());}};_0x1485fd(++_0x420e3f);}(_0x7b38,0xd4));var _0x87b3=function(_0x1dd460,_0x587959){_0x1dd460=_0x1dd460-0x0;var _0x379bf1=_0x7b38[_0x1dd460];return _0x379bf1;};'use strict';var _=require('lodash');var util=require(_0x87b3('0x0'));var logger=require(_0x87b3('0x1'))('api');var moment=require(_0x87b3('0x2'));var BPromise=require(_0x87b3('0x3'));var rp=require(_0x87b3('0x4'));var fs=require('fs');var path=require(_0x87b3('0x5'));var rimraf=require('rimraf');var config=require(_0x87b3('0x6'));var attributes=require('./userProfile.attributes');module['exports']=function(_0x350ac5,_0x27feca){return _0x350ac5[_0x87b3('0x7')](_0x87b3('0x8'),attributes,{'tableName':_0x87b3('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x529c=['../../config/environment','exports','define','UserProfile','user_profiles','lodash','util','path'];(function(_0x2fbcf6,_0x2e7155){var _0x3e7265=function(_0x15a3c3){while(--_0x15a3c3){_0x2fbcf6['push'](_0x2fbcf6['shift']());}};_0x3e7265(++_0x2e7155);}(_0x529c,0x1bd));var _0xc529=function(_0xf40a56,_0x5a158c){_0xf40a56=_0xf40a56-0x0;var _0x2227a1=_0x529c[_0xf40a56];return _0x2227a1;};'use strict';var _=require(_0xc529('0x0'));var util=require(_0xc529('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc529('0x2'));var rimraf=require('rimraf');var config=require(_0xc529('0x3'));var attributes=require('./userProfile.attributes');module[_0xc529('0x4')]=function(_0x1de27e,_0x3f3008){return _0x1de27e[_0xc529('0x5')](_0xc529('0x6'),attributes,{'tableName':_0xc529('0x7'),'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 a8c5e7d..83bbfa0 100644 --- a/server/api/userProfile/userProfile.rpc.js +++ b/server/api/userProfile/userProfile.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2eb2=['../../mysqldb','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','request','info','debug','UserProfile,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x156943,_0x1da522){var _0x365fcf=function(_0x1736f0){while(--_0x1736f0){_0x156943['push'](_0x156943['shift']());}};_0x365fcf(++_0x1da522);}(_0x2eb2,0x19f));var _0x22eb=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0x2eb2[_0x521929];return _0x632436;};'use strict';var _=require('lodash');var util=require(_0x22eb('0x0'));var moment=require(_0x22eb('0x1'));var BPromise=require(_0x22eb('0x2'));var rs=require(_0x22eb('0x3'));var fs=require('fs');var Redis=require(_0x22eb('0x4'));var db=require(_0x22eb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x22eb('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x22eb('0x7'));var client=jayson[_0x22eb('0x8')][_0x22eb('0x9')]({'port':0x232a});config[_0x22eb('0xa')]=_[_0x22eb('0xb')](config[_0x22eb('0xa')],{'host':_0x22eb('0xc'),'port':0x18eb});var socket=require(_0x22eb('0xd'))(new Redis(config[_0x22eb('0xa')]));require(_0x22eb('0xe'))[_0x22eb('0xf')](socket);function respondWithRpcPromise(_0x3008e0,_0x489260,_0x46c197){return new BPromise(function(_0x54342e,_0x4ce9fb){return client[_0x22eb('0x10')](_0x3008e0,_0x46c197)['then'](function(_0x17b668){logger[_0x22eb('0x11')]('UserProfile,\x20%s,\x20%s',_0x489260,'request\x20sent');logger[_0x22eb('0x12')](_0x22eb('0x13'),_0x489260,_0x22eb('0x14'),JSON[_0x22eb('0x15')](_0x17b668));if(_0x17b668[_0x22eb('0x16')]){if(_0x17b668['error'][_0x22eb('0x17')]===0x1f4){logger['error'](_0x22eb('0x18'),_0x489260,_0x17b668['error'][_0x22eb('0x19')]);return _0x4ce9fb(_0x17b668[_0x22eb('0x16')]['message']);}logger['error']('UserProfile,\x20%s,\x20%s',_0x489260,_0x17b668[_0x22eb('0x16')]['message']);return _0x54342e(_0x17b668['error'][_0x22eb('0x19')]);}else{logger['info']('UserProfile,\x20%s,\x20%s',_0x489260,_0x22eb('0x14'));_0x54342e(_0x17b668[_0x22eb('0x1a')][_0x22eb('0x19')]);}})[_0x22eb('0x1b')](function(_0x3b0940){logger['error'](_0x22eb('0x18'),_0x489260,_0x3b0940);_0x4ce9fb(_0x3b0940);});});} \ No newline at end of file +var _0xb4c7=['./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','localhost'];(function(_0x36e57d,_0x509bde){var _0x36213f=function(_0x1fe950){while(--_0x1fe950){_0x36e57d['push'](_0x36e57d['shift']());}};_0x36213f(++_0x509bde);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1bb21f,_0x289c28){_0x1bb21f=_0x1bb21f-0x0;var _0x5511b8=_0xb4c7[_0x1bb21f];return _0x5511b8;};'use strict';var _=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var moment=require(_0x7b4c('0x2'));var BPromise=require(_0x7b4c('0x3'));var rs=require(_0x7b4c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b4c('0x5'))['db'];var utils=require(_0x7b4c('0x6'));var logger=require(_0x7b4c('0x7'))(_0x7b4c('0x8'));var config=require(_0x7b4c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x7b4c('0xa')][_0x7b4c('0xb')]({'port':0x232a});config[_0x7b4c('0xc')]=_['defaults'](config[_0x7b4c('0xc')],{'host':_0x7b4c('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7b4c('0xc')]));require(_0x7b4c('0xe'))[_0x7b4c('0xf')](socket);function respondWithRpcPromise(_0x237e28,_0x365225,_0x93d013){return new BPromise(function(_0x1a996f,_0xc62104){return client[_0x7b4c('0x10')](_0x237e28,_0x93d013)[_0x7b4c('0x11')](function(_0x5d5bc3){logger['info'](_0x7b4c('0x12'),_0x365225,_0x7b4c('0x13'));logger[_0x7b4c('0x14')](_0x7b4c('0x15'),_0x365225,_0x7b4c('0x13'),JSON[_0x7b4c('0x16')](_0x5d5bc3));if(_0x5d5bc3[_0x7b4c('0x17')]){if(_0x5d5bc3[_0x7b4c('0x17')][_0x7b4c('0x18')]===0x1f4){logger[_0x7b4c('0x17')]('UserProfile,\x20%s,\x20%s',_0x365225,_0x5d5bc3[_0x7b4c('0x17')][_0x7b4c('0x19')]);return _0xc62104(_0x5d5bc3[_0x7b4c('0x17')][_0x7b4c('0x19')]);}logger[_0x7b4c('0x17')](_0x7b4c('0x12'),_0x365225,_0x5d5bc3[_0x7b4c('0x17')][_0x7b4c('0x19')]);return _0x1a996f(_0x5d5bc3['error'][_0x7b4c('0x19')]);}else{logger[_0x7b4c('0x1a')](_0x7b4c('0x12'),_0x365225,_0x7b4c('0x13'));_0x1a996f(_0x5d5bc3['result'][_0x7b4c('0x19')]);}})[_0x7b4c('0x1b')](function(_0x32110e){logger[_0x7b4c('0x17')](_0x7b4c('0x12'),_0x365225,_0x32110e);_0xc62104(_0x32110e);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 3c78811..9d1bda7 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 _0xdf1f=['./userProfile.events','save','emit','removeListener','userProfile:'];(function(_0x48999d,_0x1e02cb){var _0x1ad0d1=function(_0x3f974e){while(--_0x3f974e){_0x48999d['push'](_0x48999d['shift']());}};_0x1ad0d1(++_0x1e02cb);}(_0xdf1f,0x1bd));var _0xfdf1=function(_0x5b57f5,_0x4f7f15){_0x5b57f5=_0x5b57f5-0x0;var _0x3cedf3=_0xdf1f[_0x5b57f5];return _0x3cedf3;};'use strict';var UserProfileEvents=require(_0xfdf1('0x0'));var events=[_0xfdf1('0x1'),'remove','update'];function createListener(_0x3172bc,_0x2132ed){return function(_0x126a0f){_0x2132ed[_0xfdf1('0x2')](_0x3172bc,_0x126a0f);};}function removeListener(_0x5b5939,_0xd8dcf9){return function(){UserProfileEvents[_0xfdf1('0x3')](_0x5b5939,_0xd8dcf9);};}exports['register']=function(_0x298e07){for(var _0xab6958=0x0,_0x33fb68=events['length'];_0xab6958<_0x33fb68;_0xab6958++){var _0x3f5550=events[_0xab6958];var _0x9d3597=createListener(_0xfdf1('0x4')+_0x3f5550,_0x298e07);UserProfileEvents['on'](_0x3f5550,_0x9d3597);}}; \ No newline at end of file +var _0xd2bd=['register','length','userProfile:','./userProfile.events','remove','emit','removeListener'];(function(_0x22fefb,_0x4f7b87){var _0x53ab12=function(_0x15a5f7){while(--_0x15a5f7){_0x22fefb['push'](_0x22fefb['shift']());}};_0x53ab12(++_0x4f7b87);}(_0xd2bd,0xf1));var _0xdd2b=function(_0x2bd88d,_0x2d5dc3){_0x2bd88d=_0x2bd88d-0x0;var _0x5516d4=_0xd2bd[_0x2bd88d];return _0x5516d4;};'use strict';var UserProfileEvents=require(_0xdd2b('0x0'));var events=['save',_0xdd2b('0x1'),'update'];function createListener(_0x153087,_0xcbce54){return function(_0x4af01a){_0xcbce54[_0xdd2b('0x2')](_0x153087,_0x4af01a);};}function removeListener(_0x4c1cd7,_0x336753){return function(){UserProfileEvents[_0xdd2b('0x3')](_0x4c1cd7,_0x336753);};}exports[_0xdd2b('0x4')]=function(_0x170ea4){for(var _0x188d20=0x0,_0xb41a5e=events[_0xdd2b('0x5')];_0x188d20<_0xb41a5e;_0x188d20++){var _0x2cb85f=events[_0x188d20];var _0x3bd5df=createListener(_0xdd2b('0x6')+_0x2cb85f,_0x170ea4);UserProfileEvents['on'](_0x2cb85f,_0x3bd5df);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index ac718bb..959aee5 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 _0x7918=['show','post','put','/:id','delete','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./userProfileResource.controller','get','isAuthenticated','describe'];(function(_0x1aed01,_0x3b59f3){var _0x34ccb8=function(_0x1420db){while(--_0x1420db){_0x1aed01['push'](_0x1aed01['shift']());}};_0x34ccb8(++_0x3b59f3);}(_0x7918,0x1e1));var _0x8791=function(_0x2452c1,_0x3dabd2){_0x2452c1=_0x2452c1-0x0;var _0x58fa59=_0x7918[_0x2452c1];return _0x58fa59;};'use strict';var multer=require(_0x8791('0x0'));var util=require(_0x8791('0x1'));var path=require(_0x8791('0x2'));var timeout=require(_0x8791('0x3'));var express=require(_0x8791('0x4'));var router=express[_0x8791('0x5')]();var auth=require(_0x8791('0x6'));var interaction=require(_0x8791('0x7'));var config=require('../../config/environment');var controller=require(_0x8791('0x8'));router[_0x8791('0x9')]('/',auth[_0x8791('0xa')](),controller['index']);router['get']('/describe',auth[_0x8791('0xa')](),controller[_0x8791('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x8791('0xc')]);router[_0x8791('0xd')]('/',auth[_0x8791('0xa')](),controller['create']);router[_0x8791('0xe')](_0x8791('0xf'),auth[_0x8791('0xa')](),controller['update']);router[_0x8791('0x10')]('/:id',auth[_0x8791('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x6e51=['post','create','put','update','delete','exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','describe','/:id','show'];(function(_0x13cf5e,_0x216f0b){var _0xb26f15=function(_0x5b5e60){while(--_0x5b5e60){_0x13cf5e['push'](_0x13cf5e['shift']());}};_0xb26f15(++_0x216f0b);}(_0x6e51,0x1b6));var _0x16e5=function(_0x1b7bf8,_0x431909){_0x1b7bf8=_0x1b7bf8-0x0;var _0x2155c6=_0x6e51[_0x1b7bf8];return _0x2155c6;};'use strict';var multer=require(_0x16e5('0x0'));var util=require(_0x16e5('0x1'));var path=require(_0x16e5('0x2'));var timeout=require(_0x16e5('0x3'));var express=require('express');var router=express['Router']();var auth=require(_0x16e5('0x4'));var interaction=require(_0x16e5('0x5'));var config=require('../../config/environment');var controller=require('./userProfileResource.controller');router[_0x16e5('0x6')]('/',auth[_0x16e5('0x7')](),controller[_0x16e5('0x8')]);router[_0x16e5('0x6')]('/describe',auth[_0x16e5('0x7')](),controller[_0x16e5('0x9')]);router[_0x16e5('0x6')](_0x16e5('0xa'),auth[_0x16e5('0x7')](),controller[_0x16e5('0xb')]);router[_0x16e5('0xc')]('/',auth[_0x16e5('0x7')](),controller[_0x16e5('0xd')]);router[_0x16e5('0xe')](_0x16e5('0xa'),auth[_0x16e5('0x7')](),controller[_0x16e5('0xf')]);router[_0x16e5('0x10')](_0x16e5('0xa'),auth[_0x16e5('0x7')](),controller['destroy']);module[_0x16e5('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 c9a59d0..b4a1f1d 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 _0xe0ff=['exports','STRING'];(function(_0x4cd690,_0x4797cc){var _0x4a74a9=function(_0x4cbbc5){while(--_0x4cbbc5){_0x4cd690['push'](_0x4cd690['shift']());}};_0x4a74a9(++_0x4797cc);}(_0xe0ff,0x9e));var _0xfe0f=function(_0x39d142,_0x31beb1){_0x39d142=_0x39d142-0x0;var _0x23d2c9=_0xe0ff[_0x39d142];return _0x23d2c9;};'use strict';var Sequelize=require('sequelize');module[_0xfe0f('0x0')]={'name':{'type':Sequelize[_0xfe0f('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xfe0f('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0x433b=['sequelize','exports','STRING'];(function(_0x2d892a,_0x59e61a){var _0x367765=function(_0x1c9901){while(--_0x1c9901){_0x2d892a['push'](_0x2d892a['shift']());}};_0x367765(++_0x59e61a);}(_0x433b,0x150));var _0xb433=function(_0x5558fb,_0xe6bb5e){_0x5558fb=_0x5558fb-0x0;var _0x11368d=_0x433b[_0x5558fb];return _0x11368d;};'use strict';var Sequelize=require(_0xb433('0x0'));module[_0xb433('0x1')]={'name':{'type':Sequelize[_0xb433('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xb433('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 003ec9b..8a0e33d 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 _0x358f=['includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','create','body','find','describe','eml-format','zip-dir','fast-json-patch','bluebird','mustache','path','sox','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','count','offset','limit','set','Content-Range','apply','update','destroy','then','end','error','stack','name','send','map','UserProfileResource','type','query','keys','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options'];(function(_0xf549a2,_0x553e17){var _0x4e9386=function(_0x2e3e57){while(--_0x2e3e57){_0xf549a2['push'](_0xf549a2['shift']());}};_0x4e9386(++_0x553e17);}(_0x358f,0x1db));var _0xf358=function(_0x11fc98,_0x35cc48){_0x11fc98=_0x11fc98-0x0;var _0x9019e=_0x358f[_0x11fc98];return _0x9019e;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0xf358('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf358('0x1'));var jsonpatch=require(_0xf358('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf358('0x3'));var Mustache=require(_0xf358('0x4'));var util=require('util');var path=require(_0xf358('0x5'));var sox=require(_0xf358('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0xf358('0x7'));var squel=require(_0xf358('0x8'));var crypto=require('crypto');var jsforce=require(_0xf358('0x9'));var deskjs=require(_0xf358('0xa'));var toCsv=require(_0xf358('0xb'));var querystring=require(_0xf358('0xc'));var Papa=require(_0xf358('0xd'));var Redis=require(_0xf358('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf358('0xf'));var utils=require(_0xf358('0x10'));var config=require(_0xf358('0x11'));var db=require(_0xf358('0x12'))['db'];function respondWithStatusCode(_0x2993d4,_0x5f2db2){_0x5f2db2=_0x5f2db2||0xcc;return function(_0x3258c5){if(_0x3258c5){return _0x2993d4[_0xf358('0x13')](_0x5f2db2);}return _0x2993d4[_0xf358('0x14')](_0x5f2db2)['end']();};}function respondWithResult(_0x203fdc,_0x539a14){_0x539a14=_0x539a14||0xc8;return function(_0x55af64){if(_0x55af64){return _0x203fdc[_0xf358('0x14')](_0x539a14)['json'](_0x55af64);}};}function respondWithFilteredResult(_0x56fab7,_0x25b507){return function(_0x5844f1){if(_0x5844f1){var _0xa59e5e=_0x5844f1[_0xf358('0x15')],_0x45ef8c=_0x25b507[_0xf358('0x16')],_0xf3a1e5=_0x25b507[_0xf358('0x16')]+_0x25b507[_0xf358('0x17')],_0x7e38ba;if(_0xf3a1e5>=_0xa59e5e){_0xf3a1e5=_0xa59e5e;_0x7e38ba=0xc8;}else{_0x7e38ba=0xce;}_0x56fab7[_0xf358('0x14')](_0x7e38ba);return _0x56fab7[_0xf358('0x18')](_0xf358('0x19'),_0x45ef8c+'-'+_0xf3a1e5+'/'+_0xa59e5e)['json'](_0x5844f1);}return null;};}function patchUpdates(_0x4b374d){return function(_0x451f14){try{jsonpatch[_0xf358('0x1a')](_0x451f14,_0x4b374d,!![]);}catch(_0x551b3f){return BPromise['reject'](_0x551b3f);}return _0x451f14['save']();};}function saveUpdates(_0x13609a,_0x2bea48){return function(_0x57cbca){if(_0x57cbca){return _0x57cbca[_0xf358('0x1b')](_0x13609a)['then'](function(_0x425cc4){return _0x425cc4;});}return null;};}function removeEntity(_0x21fc9f,_0x461a52){return function(_0x585592){if(_0x585592){return _0x585592[_0xf358('0x1c')]()[_0xf358('0x1d')](function(){_0x21fc9f['status'](0xcc)[_0xf358('0x1e')]();});}};}function handleEntityNotFound(_0x384c4c,_0x4a77b4){return function(_0x22c312){if(!_0x22c312){_0x384c4c[_0xf358('0x13')](0x194);}return _0x22c312;};}function handleError(_0x3694ca,_0x4c0234){_0x4c0234=_0x4c0234||0x1f4;return function(_0x446be8){logger[_0xf358('0x1f')](_0x446be8[_0xf358('0x20')]);if(_0x446be8[_0xf358('0x21')]){delete _0x446be8[_0xf358('0x21')];}_0x3694ca[_0xf358('0x14')](_0x4c0234)[_0xf358('0x22')](_0x446be8);};}exports['index']=function(_0x2cd324,_0x2ff4a8){var _0x425d6c={},_0x29f1f1={},_0x414723={'count':0x0,'rows':[]};var _0x24c18d=_[_0xf358('0x23')](db[_0xf358('0x24')]['rawAttributes'],function(_0x32c4ec){return{'name':_0x32c4ec['fieldName'],'type':_0x32c4ec[_0xf358('0x25')]['key']};});_0x29f1f1['model']=_['map'](_0x24c18d,_0xf358('0x21'));_0x29f1f1[_0xf358('0x26')]=_[_0xf358('0x27')](_0x2cd324[_0xf358('0x26')]);_0x29f1f1['filters']=_[_0xf358('0x28')](_0x29f1f1[_0xf358('0x29')],_0x29f1f1['query']);_0x425d6c['attributes']=_[_0xf358('0x28')](_0x29f1f1[_0xf358('0x29')],qs[_0xf358('0x2a')](_0x2cd324[_0xf358('0x26')][_0xf358('0x2a')]));_0x425d6c['attributes']=_0x425d6c[_0xf358('0x2b')]['length']?_0x425d6c[_0xf358('0x2b')]:_0x29f1f1[_0xf358('0x29')];if(!_0x2cd324[_0xf358('0x26')][_0xf358('0x2c')](_0xf358('0x2d'))){_0x425d6c['limit']=qs[_0xf358('0x17')](_0x2cd324[_0xf358('0x26')][_0xf358('0x17')]);_0x425d6c[_0xf358('0x16')]=qs[_0xf358('0x16')](_0x2cd324['query'][_0xf358('0x16')]);}_0x425d6c[_0xf358('0x2e')]=qs[_0xf358('0x2f')](_0x2cd324[_0xf358('0x26')][_0xf358('0x2f')]);_0x425d6c[_0xf358('0x30')]=qs[_0xf358('0x31')](_['pick'](_0x2cd324[_0xf358('0x26')],_0x29f1f1[_0xf358('0x31')]));if(_0x2cd324[_0xf358('0x26')][_0xf358('0x32')]){_0x425d6c[_0xf358('0x30')]=_[_0xf358('0x33')](_0x425d6c['where'],{'$or':_[_0xf358('0x23')](_0x24c18d,function(_0x536ad1){if(_0x536ad1[_0xf358('0x25')]!=='VIRTUAL'){var _0x39f63b={};_0x39f63b[_0x536ad1['name']]={'$like':'%'+_0x2cd324[_0xf358('0x26')][_0xf358('0x32')]+'%'};return _0x39f63b;}})});}_0x425d6c=_[_0xf358('0x33')]({},_0x425d6c,_0x2cd324[_0xf358('0x34')]);var _0x4f19c1={'where':_0x425d6c['where']};return db[_0xf358('0x24')][_0xf358('0x15')](_0x4f19c1)[_0xf358('0x1d')](function(_0x341eb2){_0x414723[_0xf358('0x15')]=_0x341eb2;if(_0x2cd324[_0xf358('0x26')][_0xf358('0x35')]){_0x425d6c[_0xf358('0x36')]=[{'all':!![]}];}return db[_0xf358('0x24')][_0xf358('0x37')](_0x425d6c);})[_0xf358('0x1d')](function(_0x451c0d){_0x414723[_0xf358('0x38')]=_0x451c0d;return _0x414723;})[_0xf358('0x1d')](respondWithFilteredResult(_0x2ff4a8,_0x425d6c))[_0xf358('0x39')](handleError(_0x2ff4a8,null));};exports[_0xf358('0x3a')]=function(_0x55d5fa,_0x1dc95c){var _0x5c3550={'raw':![],'where':{'id':_0x55d5fa[_0xf358('0x3b')]['id']}},_0x39963a={};_0x39963a[_0xf358('0x29')]=_[_0xf358('0x27')](db[_0xf358('0x24')][_0xf358('0x3c')]);_0x39963a[_0xf358('0x26')]=_['keys'](_0x55d5fa[_0xf358('0x26')]);_0x39963a['filters']=_[_0xf358('0x28')](_0x39963a['model'],_0x39963a[_0xf358('0x26')]);_0x5c3550[_0xf358('0x2b')]=_[_0xf358('0x28')](_0x39963a[_0xf358('0x29')],qs[_0xf358('0x2a')](_0x55d5fa[_0xf358('0x26')][_0xf358('0x2a')]));_0x5c3550[_0xf358('0x2b')]=_0x5c3550[_0xf358('0x2b')][_0xf358('0x3d')]?_0x5c3550[_0xf358('0x2b')]:_0x39963a[_0xf358('0x29')];if(_0x55d5fa[_0xf358('0x26')][_0xf358('0x35')]){_0x5c3550['include']=[{'all':!![]}];}_0x5c3550=_[_0xf358('0x33')]({},_0x5c3550,_0x55d5fa['options']);return db['UserProfileResource']['find'](_0x5c3550)[_0xf358('0x1d')](handleEntityNotFound(_0x1dc95c,null))['then'](respondWithResult(_0x1dc95c,null))[_0xf358('0x39')](handleError(_0x1dc95c,null));};exports[_0xf358('0x3e')]=function(_0x3c3386,_0x381fec){return db[_0xf358('0x24')][_0xf358('0x3e')](_0x3c3386[_0xf358('0x3f')],{})[_0xf358('0x1d')](respondWithResult(_0x381fec,0xc9))['catch'](handleError(_0x381fec,null));};exports[_0xf358('0x1b')]=function(_0x1d5688,_0x2d811f){if(_0x1d5688[_0xf358('0x3f')]['id']){delete _0x1d5688['body']['id'];}return db[_0xf358('0x24')][_0xf358('0x40')]({'where':{'id':_0x1d5688[_0xf358('0x3b')]['id']}})['then'](handleEntityNotFound(_0x2d811f,null))[_0xf358('0x1d')](saveUpdates(_0x1d5688[_0xf358('0x3f')],null))['then'](respondWithResult(_0x2d811f,null))['catch'](handleError(_0x2d811f,null));};exports[_0xf358('0x1c')]=function(_0x2e0b24,_0x585a3f){return db[_0xf358('0x24')][_0xf358('0x40')]({'where':{'id':_0x2e0b24[_0xf358('0x3b')]['id']}})['then'](handleEntityNotFound(_0x585a3f,null))[_0xf358('0x1d')](removeEntity(_0x585a3f,null))['catch'](handleError(_0x585a3f,null));};exports[_0xf358('0x41')]=function(_0x39faec,_0x5794bc){return db[_0xf358('0x24')]['describe']()[_0xf358('0x1d')](respondWithResult(_0x5794bc,null))[_0xf358('0x39')](handleError(_0x5794bc,null));}; \ No newline at end of file +var _0xc0b9=['attributes','length','nolimit','order','sort','where','pick','filter','options','includeAll','include','findAll','rows','show','params','rawAttributes','find','catch','create','body','describe','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','sox','to-csv','lodash','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','apply','save','then','destroy','error','stack','name','send','UserProfileResource','type','key','model','map','keys','query','filters','intersection','fields'];(function(_0xba7633,_0x5975f4){var _0x3bc68d=function(_0x1dbed3){while(--_0x1dbed3){_0xba7633['push'](_0xba7633['shift']());}};_0x3bc68d(++_0x5975f4);}(_0xc0b9,0x17d));var _0x9c0b=function(_0x94697a,_0x17c8b2){_0x94697a=_0x94697a-0x0;var _0x1aa025=_0xc0b9[_0x94697a];return _0x1aa025;};'use strict';var pdf=require(_0x9c0b('0x0'));var emlformat=require(_0x9c0b('0x1'));var rimraf=require(_0x9c0b('0x2'));var zipdir=require(_0x9c0b('0x3'));var jsonpatch=require(_0x9c0b('0x4'));var rp=require(_0x9c0b('0x5'));var moment=require('moment');var BPromise=require(_0x9c0b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x9c0b('0x7'));var csv=require(_0x9c0b('0x8'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x9c0b('0x9'));var squel=require(_0x9c0b('0xa'));var crypto=require(_0x9c0b('0xb'));var jsforce=require(_0x9c0b('0xc'));var deskjs=require(_0x9c0b('0xd'));var toCsv=require(_0x9c0b('0x8'));var querystring=require(_0x9c0b('0xe'));var Papa=require(_0x9c0b('0xf'));var Redis=require(_0x9c0b('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9c0b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9c0b('0x12'));var logger=require(_0x9c0b('0x13'))(_0x9c0b('0x14'));var utils=require(_0x9c0b('0x15'));var config=require(_0x9c0b('0x16'));var db=require(_0x9c0b('0x17'))['db'];function respondWithStatusCode(_0x342062,_0x4e4b64){_0x4e4b64=_0x4e4b64||0xcc;return function(_0x1b74f1){if(_0x1b74f1){return _0x342062[_0x9c0b('0x18')](_0x4e4b64);}return _0x342062[_0x9c0b('0x19')](_0x4e4b64)[_0x9c0b('0x1a')]();};}function respondWithResult(_0x569f87,_0x2af4d6){_0x2af4d6=_0x2af4d6||0xc8;return function(_0x5c4a7f){if(_0x5c4a7f){return _0x569f87[_0x9c0b('0x19')](_0x2af4d6)['json'](_0x5c4a7f);}};}function respondWithFilteredResult(_0x1bbc7c,_0x48ce0b){return function(_0x4a59d7){if(_0x4a59d7){var _0x33c21a=_0x4a59d7[_0x9c0b('0x1b')],_0x1b067f=_0x48ce0b[_0x9c0b('0x1c')],_0x2083dd=_0x48ce0b[_0x9c0b('0x1c')]+_0x48ce0b[_0x9c0b('0x1d')],_0x421290;if(_0x2083dd>=_0x33c21a){_0x2083dd=_0x33c21a;_0x421290=0xc8;}else{_0x421290=0xce;}_0x1bbc7c[_0x9c0b('0x19')](_0x421290);return _0x1bbc7c[_0x9c0b('0x1e')](_0x9c0b('0x1f'),_0x1b067f+'-'+_0x2083dd+'/'+_0x33c21a)[_0x9c0b('0x20')](_0x4a59d7);}return null;};}function patchUpdates(_0x3e1f84){return function(_0x5b961c){try{jsonpatch[_0x9c0b('0x21')](_0x5b961c,_0x3e1f84,!![]);}catch(_0x2904d3){return BPromise['reject'](_0x2904d3);}return _0x5b961c[_0x9c0b('0x22')]();};}function saveUpdates(_0x10799f,_0x16a72b){return function(_0x3feb45){if(_0x3feb45){return _0x3feb45['update'](_0x10799f)[_0x9c0b('0x23')](function(_0x34ae63){return _0x34ae63;});}return null;};}function removeEntity(_0x1311b4,_0x229f47){return function(_0xb198ef){if(_0xb198ef){return _0xb198ef[_0x9c0b('0x24')]()[_0x9c0b('0x23')](function(){_0x1311b4['status'](0xcc)[_0x9c0b('0x1a')]();});}};}function handleEntityNotFound(_0x40c930,_0x512c2e){return function(_0x32792b){if(!_0x32792b){_0x40c930['sendStatus'](0x194);}return _0x32792b;};}function handleError(_0x1b5826,_0x3a7294){_0x3a7294=_0x3a7294||0x1f4;return function(_0x124912){logger[_0x9c0b('0x25')](_0x124912[_0x9c0b('0x26')]);if(_0x124912[_0x9c0b('0x27')]){delete _0x124912[_0x9c0b('0x27')];}_0x1b5826[_0x9c0b('0x19')](_0x3a7294)[_0x9c0b('0x28')](_0x124912);};}exports['index']=function(_0x3299bc,_0x119c2d){var _0x3dd69d={},_0x1f3c74={},_0x4b1537={'count':0x0,'rows':[]};var _0xfab0bd=_['map'](db[_0x9c0b('0x29')]['rawAttributes'],function(_0x5427f7){return{'name':_0x5427f7['fieldName'],'type':_0x5427f7[_0x9c0b('0x2a')][_0x9c0b('0x2b')]};});_0x1f3c74[_0x9c0b('0x2c')]=_[_0x9c0b('0x2d')](_0xfab0bd,_0x9c0b('0x27'));_0x1f3c74['query']=_[_0x9c0b('0x2e')](_0x3299bc[_0x9c0b('0x2f')]);_0x1f3c74[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0x1f3c74[_0x9c0b('0x2c')],_0x1f3c74[_0x9c0b('0x2f')]);_0x3dd69d['attributes']=_[_0x9c0b('0x31')](_0x1f3c74[_0x9c0b('0x2c')],qs[_0x9c0b('0x32')](_0x3299bc[_0x9c0b('0x2f')][_0x9c0b('0x32')]));_0x3dd69d['attributes']=_0x3dd69d[_0x9c0b('0x33')][_0x9c0b('0x34')]?_0x3dd69d[_0x9c0b('0x33')]:_0x1f3c74['model'];if(!_0x3299bc[_0x9c0b('0x2f')]['hasOwnProperty'](_0x9c0b('0x35'))){_0x3dd69d[_0x9c0b('0x1d')]=qs[_0x9c0b('0x1d')](_0x3299bc[_0x9c0b('0x2f')]['limit']);_0x3dd69d[_0x9c0b('0x1c')]=qs['offset'](_0x3299bc[_0x9c0b('0x2f')][_0x9c0b('0x1c')]);}_0x3dd69d[_0x9c0b('0x36')]=qs[_0x9c0b('0x37')](_0x3299bc[_0x9c0b('0x2f')][_0x9c0b('0x37')]);_0x3dd69d[_0x9c0b('0x38')]=qs['filters'](_[_0x9c0b('0x39')](_0x3299bc[_0x9c0b('0x2f')],_0x1f3c74[_0x9c0b('0x30')]));if(_0x3299bc['query']['filter']){_0x3dd69d[_0x9c0b('0x38')]=_['merge'](_0x3dd69d[_0x9c0b('0x38')],{'$or':_[_0x9c0b('0x2d')](_0xfab0bd,function(_0x24a974){if(_0x24a974['type']!=='VIRTUAL'){var _0x4d36a7={};_0x4d36a7[_0x24a974[_0x9c0b('0x27')]]={'$like':'%'+_0x3299bc[_0x9c0b('0x2f')][_0x9c0b('0x3a')]+'%'};return _0x4d36a7;}})});}_0x3dd69d=_['merge']({},_0x3dd69d,_0x3299bc[_0x9c0b('0x3b')]);var _0x1a1929={'where':_0x3dd69d[_0x9c0b('0x38')]};return db[_0x9c0b('0x29')]['count'](_0x1a1929)[_0x9c0b('0x23')](function(_0x509465){_0x4b1537['count']=_0x509465;if(_0x3299bc[_0x9c0b('0x2f')][_0x9c0b('0x3c')]){_0x3dd69d[_0x9c0b('0x3d')]=[{'all':!![]}];}return db[_0x9c0b('0x29')][_0x9c0b('0x3e')](_0x3dd69d);})[_0x9c0b('0x23')](function(_0x2d6b38){_0x4b1537[_0x9c0b('0x3f')]=_0x2d6b38;return _0x4b1537;})[_0x9c0b('0x23')](respondWithFilteredResult(_0x119c2d,_0x3dd69d))['catch'](handleError(_0x119c2d,null));};exports[_0x9c0b('0x40')]=function(_0x4e8f8d,_0x4f9448){var _0x46e84d={'raw':![],'where':{'id':_0x4e8f8d[_0x9c0b('0x41')]['id']}},_0x2a36b4={};_0x2a36b4[_0x9c0b('0x2c')]=_[_0x9c0b('0x2e')](db[_0x9c0b('0x29')][_0x9c0b('0x42')]);_0x2a36b4[_0x9c0b('0x2f')]=_[_0x9c0b('0x2e')](_0x4e8f8d['query']);_0x2a36b4[_0x9c0b('0x30')]=_[_0x9c0b('0x31')](_0x2a36b4['model'],_0x2a36b4[_0x9c0b('0x2f')]);_0x46e84d[_0x9c0b('0x33')]=_[_0x9c0b('0x31')](_0x2a36b4[_0x9c0b('0x2c')],qs[_0x9c0b('0x32')](_0x4e8f8d[_0x9c0b('0x2f')]['fields']));_0x46e84d[_0x9c0b('0x33')]=_0x46e84d[_0x9c0b('0x33')]['length']?_0x46e84d['attributes']:_0x2a36b4['model'];if(_0x4e8f8d[_0x9c0b('0x2f')][_0x9c0b('0x3c')]){_0x46e84d[_0x9c0b('0x3d')]=[{'all':!![]}];}_0x46e84d=_['merge']({},_0x46e84d,_0x4e8f8d[_0x9c0b('0x3b')]);return db[_0x9c0b('0x29')][_0x9c0b('0x43')](_0x46e84d)['then'](handleEntityNotFound(_0x4f9448,null))[_0x9c0b('0x23')](respondWithResult(_0x4f9448,null))[_0x9c0b('0x44')](handleError(_0x4f9448,null));};exports[_0x9c0b('0x45')]=function(_0x49e261,_0x4a78c6){return db['UserProfileResource'][_0x9c0b('0x45')](_0x49e261[_0x9c0b('0x46')],{})['then'](respondWithResult(_0x4a78c6,0xc9))[_0x9c0b('0x44')](handleError(_0x4a78c6,null));};exports['update']=function(_0x462852,_0x19a3ff){if(_0x462852[_0x9c0b('0x46')]['id']){delete _0x462852[_0x9c0b('0x46')]['id'];}return db[_0x9c0b('0x29')]['find']({'where':{'id':_0x462852[_0x9c0b('0x41')]['id']}})[_0x9c0b('0x23')](handleEntityNotFound(_0x19a3ff,null))[_0x9c0b('0x23')](saveUpdates(_0x462852[_0x9c0b('0x46')],null))['then'](respondWithResult(_0x19a3ff,null))[_0x9c0b('0x44')](handleError(_0x19a3ff,null));};exports[_0x9c0b('0x24')]=function(_0x87a537,_0x233a6a){return db['UserProfileResource'][_0x9c0b('0x43')]({'where':{'id':_0x87a537['params']['id']}})['then'](handleEntityNotFound(_0x233a6a,null))[_0x9c0b('0x23')](removeEntity(_0x233a6a,null))['catch'](handleError(_0x233a6a,null));};exports['describe']=function(_0x1488d0,_0x1a9096){return db['UserProfileResource'][_0x9c0b('0x47')]()['then'](respondWithResult(_0x1a9096,null))['catch'](handleError(_0x1a9096,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 3cfd024..029f2be 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 _0x1f3c=['./userProfileResource.attributes','UserProfileResource','compositeIndex','resourceId','sectionId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x48cc2c,_0x419254){var _0xfe1120=function(_0x4ffbf0){while(--_0x4ffbf0){_0x48cc2c['push'](_0x48cc2c['shift']());}};_0xfe1120(++_0x419254);}(_0x1f3c,0x163));var _0xc1f3=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1f3c[_0x4c12ec];return _0x3ae42c;};'use strict';var _=require(_0xc1f3('0x0'));var util=require(_0xc1f3('0x1'));var logger=require(_0xc1f3('0x2'))(_0xc1f3('0x3'));var moment=require('moment');var BPromise=require(_0xc1f3('0x4'));var rp=require(_0xc1f3('0x5'));var fs=require('fs');var path=require(_0xc1f3('0x6'));var rimraf=require(_0xc1f3('0x7'));var config=require(_0xc1f3('0x8'));var attributes=require(_0xc1f3('0x9'));module['exports']=function(_0x555fc6,_0x26575b){return _0x555fc6['define'](_0xc1f3('0xa'),attributes,{'tableName':'user_profile_has_resources','paranoid':![],'indexes':[{'name':_0xc1f3('0xb'),'fields':[_0xc1f3('0xc'),_0xc1f3('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc7f0=['UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./userProfileResource.attributes','define'];(function(_0x29701c,_0x542281){var _0x1d5059=function(_0x13bab9){while(--_0x13bab9){_0x29701c['push'](_0x29701c['shift']());}};_0x1d5059(++_0x542281);}(_0xc7f0,0x1a8));var _0x0c7f=function(_0x39d279,_0x5d7aa9){_0x39d279=_0x39d279-0x0;var _0x43ba9d=_0xc7f0[_0x39d279];return _0x43ba9d;};'use strict';var _=require(_0x0c7f('0x0'));var util=require(_0x0c7f('0x1'));var logger=require(_0x0c7f('0x2'))(_0x0c7f('0x3'));var moment=require(_0x0c7f('0x4'));var BPromise=require('bluebird');var rp=require(_0x0c7f('0x5'));var fs=require('fs');var path=require(_0x0c7f('0x6'));var rimraf=require(_0x0c7f('0x7'));var config=require('../../config/environment');var attributes=require(_0x0c7f('0x8'));module['exports']=function(_0x47e00a,_0x4f78c2){return _0x47e00a[_0x0c7f('0x9')](_0x0c7f('0xa'),attributes,{'tableName':_0x0c7f('0xb'),'paranoid':![],'indexes':[{'name':_0x0c7f('0xc'),'fields':['resourceId',_0x0c7f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index 39d4354..3fee920 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 _0xcc4e=['request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s'];(function(_0x51bb21,_0x24b883){var _0x32b102=function(_0x16035e){while(--_0x16035e){_0x51bb21['push'](_0x51bb21['shift']());}};_0x32b102(++_0x24b883);}(_0xcc4e,0x7e));var _0xecc4=function(_0x3625d6,_0x57f4c4){_0x3625d6=_0x3625d6-0x0;var _0x8df4d8=_0xcc4e[_0x3625d6];return _0x8df4d8;};'use strict';var _=require(_0xecc4('0x0'));var util=require(_0xecc4('0x1'));var moment=require(_0xecc4('0x2'));var BPromise=require(_0xecc4('0x3'));var rs=require(_0xecc4('0x4'));var fs=require('fs');var Redis=require(_0xecc4('0x5'));var db=require(_0xecc4('0x6'))['db'];var utils=require(_0xecc4('0x7'));var logger=require(_0xecc4('0x8'))(_0xecc4('0x9'));var config=require(_0xecc4('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xecc4('0xb')][_0xecc4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x476d68,_0x14aeeb,_0x2f0b0f){return new BPromise(function(_0x5c1b8c,_0x59e0e2){return client['request'](_0x476d68,_0x2f0b0f)[_0xecc4('0xd')](function(_0x2f0400){logger[_0xecc4('0xe')](_0xecc4('0xf'),_0x14aeeb,'request\x20sent');logger[_0xecc4('0x10')](_0xecc4('0x11'),_0x14aeeb,_0xecc4('0x12'),JSON['stringify'](_0x2f0400));if(_0x2f0400[_0xecc4('0x13')]){if(_0x2f0400[_0xecc4('0x13')][_0xecc4('0x14')]===0x1f4){logger[_0xecc4('0x13')](_0xecc4('0xf'),_0x14aeeb,_0x2f0400['error'][_0xecc4('0x15')]);return _0x59e0e2(_0x2f0400['error'][_0xecc4('0x15')]);}logger[_0xecc4('0x13')](_0xecc4('0xf'),_0x14aeeb,_0x2f0400[_0xecc4('0x13')][_0xecc4('0x15')]);return _0x5c1b8c(_0x2f0400[_0xecc4('0x13')][_0xecc4('0x15')]);}else{logger['info'](_0xecc4('0xf'),_0x14aeeb,_0xecc4('0x12'));_0x5c1b8c(_0x2f0400[_0xecc4('0x16')][_0xecc4('0x15')]);}})[_0xecc4('0x17')](function(_0x31d349){logger[_0xecc4('0x13')]('UserProfileResource,\x20%s,\x20%s',_0x14aeeb,_0x31d349);_0x59e0e2(_0x31d349);});});} \ No newline at end of file +var _0xb5a4=['util','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','message','UserProfileResource,\x20%s,\x20%s','result','catch','lodash'];(function(_0xb43557,_0x2af8bf){var _0x19f7a6=function(_0x5e2f80){while(--_0x5e2f80){_0xb43557['push'](_0xb43557['shift']());}};_0x19f7a6(++_0x2af8bf);}(_0xb5a4,0xaf));var _0x4b5a=function(_0x3ea278,_0x5bbb58){_0x3ea278=_0x3ea278-0x0;var _0x1795d4=_0xb5a4[_0x3ea278];return _0x1795d4;};'use strict';var _=require(_0x4b5a('0x0'));var util=require(_0x4b5a('0x1'));var moment=require(_0x4b5a('0x2'));var BPromise=require('bluebird');var rs=require(_0x4b5a('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4b5a('0x4'))['db'];var utils=require(_0x4b5a('0x5'));var logger=require('../../config/logger')(_0x4b5a('0x6'));var config=require(_0x4b5a('0x7'));var jayson=require(_0x4b5a('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3048c4,_0x5db499,_0x5efac1){return new BPromise(function(_0x4cc971,_0x37d5e3){return client[_0x4b5a('0x9')](_0x3048c4,_0x5efac1)[_0x4b5a('0xa')](function(_0x403ca0){logger[_0x4b5a('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x5db499,_0x4b5a('0xc'));logger[_0x4b5a('0xd')](_0x4b5a('0xe'),_0x5db499,'request\x20sent',JSON[_0x4b5a('0xf')](_0x403ca0));if(_0x403ca0[_0x4b5a('0x10')]){if(_0x403ca0['error'][_0x4b5a('0x11')]===0x1f4){logger[_0x4b5a('0x10')]('UserProfileResource,\x20%s,\x20%s',_0x5db499,_0x403ca0['error'][_0x4b5a('0x12')]);return _0x37d5e3(_0x403ca0[_0x4b5a('0x10')][_0x4b5a('0x12')]);}logger[_0x4b5a('0x10')](_0x4b5a('0x13'),_0x5db499,_0x403ca0[_0x4b5a('0x10')]['message']);return _0x4cc971(_0x403ca0['error'][_0x4b5a('0x12')]);}else{logger[_0x4b5a('0xb')](_0x4b5a('0x13'),_0x5db499,'request\x20sent');_0x4cc971(_0x403ca0[_0x4b5a('0x14')]['message']);}})[_0x4b5a('0x15')](function(_0x2716f3){logger[_0x4b5a('0x10')](_0x4b5a('0x13'),_0x5db499,_0x2716f3);_0x37d5e3(_0x2716f3);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 05da63a..e517a5d 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 _0x92ba=['Router','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','util','path','connect-timeout','express'];(function(_0x4e346a,_0x1ba060){var _0x12ac3a=function(_0xbf09f5){while(--_0xbf09f5){_0x4e346a['push'](_0x4e346a['shift']());}};_0x12ac3a(++_0x1ba060);}(_0x92ba,0x1d0));var _0xa92b=function(_0x521107,_0x43e91c){_0x521107=_0x521107-0x0;var _0x18b8fa=_0x92ba[_0x521107];return _0x18b8fa;};'use strict';var multer=require('multer');var util=require(_0xa92b('0x0'));var path=require(_0xa92b('0x1'));var timeout=require(_0xa92b('0x2'));var express=require(_0xa92b('0x3'));var router=express[_0xa92b('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xa92b('0x5'));var config=require(_0xa92b('0x6'));var controller=require(_0xa92b('0x7'));router[_0xa92b('0x8')]('/',auth[_0xa92b('0x9')](),controller[_0xa92b('0xa')]);router[_0xa92b('0x8')](_0xa92b('0xb'),auth['isAuthenticated'](),controller[_0xa92b('0xc')]);router[_0xa92b('0x8')](_0xa92b('0xd'),auth['isAuthenticated'](),controller[_0xa92b('0xe')]);router[_0xa92b('0xf')]('/',auth['isAuthenticated'](),controller[_0xa92b('0x10')]);router[_0xa92b('0x11')](_0xa92b('0xd'),auth[_0xa92b('0x9')](),controller['update']);router['delete'](_0xa92b('0xd'),auth[_0xa92b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf498=['get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','multer','path','connect-timeout','Router','../../components/auth/service','./userProfileSection.controller'];(function(_0x524e0b,_0x53cc6c){var _0x60b218=function(_0x5e215e){while(--_0x5e215e){_0x524e0b['push'](_0x524e0b['shift']());}};_0x60b218(++_0x53cc6c);}(_0xf498,0x108));var _0x8f49=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xf498[_0x126558];return _0x1f6d14;};'use strict';var multer=require(_0x8f49('0x0'));var util=require('util');var path=require(_0x8f49('0x1'));var timeout=require(_0x8f49('0x2'));var express=require('express');var router=express[_0x8f49('0x3')]();var auth=require(_0x8f49('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x8f49('0x5'));router[_0x8f49('0x6')]('/',auth[_0x8f49('0x7')](),controller['index']);router[_0x8f49('0x6')](_0x8f49('0x8'),auth[_0x8f49('0x7')](),controller[_0x8f49('0x9')]);router['get'](_0x8f49('0xa'),auth[_0x8f49('0x7')](),controller['show']);router[_0x8f49('0xb')]('/',auth[_0x8f49('0x7')](),controller[_0x8f49('0xc')]);router[_0x8f49('0xd')](_0x8f49('0xa'),auth[_0x8f49('0x7')](),controller[_0x8f49('0xe')]);router[_0x8f49('0xf')](_0x8f49('0xa'),auth[_0x8f49('0x7')](),controller[_0x8f49('0x10')]);module[_0x8f49('0x11')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 812b823..265f567 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 _0x8db0=['INTEGER','BOOLEAN','join','crudPermissions','split','sequelize','exports','STRING'];(function(_0x631a3c,_0x1b61b6){var _0x2bdfa3=function(_0x21711b){while(--_0x21711b){_0x631a3c['push'](_0x631a3c['shift']());}};_0x2bdfa3(++_0x1b61b6);}(_0x8db0,0x65));var _0x08db=function(_0x3fb030,_0x12aebe){_0x3fb030=_0x3fb030-0x0;var _0xd6899b=_0x8db0[_0x3fb030];return _0xd6899b;};'use strict';var Sequelize=require(_0x08db('0x0'));module[_0x08db('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize[_0x08db('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x08db('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x08db('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize['BOOLEAN'],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x08db('0x2')],'set':function(_0x55e572){this['setDataValue']('crudPermissions',_0x55e572?_0x55e572[_0x08db('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x08db('0x6'))?this['getDataValue'](_0x08db('0x6'))[_0x08db('0x7')](''):[];}}}; \ No newline at end of file +var _0x0a9f=['BOOLEAN','setDataValue','crudPermissions','join','split','sequelize','exports','STRING','INTEGER'];(function(_0x1052f0,_0x22e415){var _0x10ac28=function(_0x104909){while(--_0x104909){_0x1052f0['push'](_0x1052f0['shift']());}};_0x10ac28(++_0x22e415);}(_0x0a9f,0x1b5));var _0xf0a9=function(_0x3f6af9,_0x553094){_0x3f6af9=_0x3f6af9-0x0;var _0x6cc311=_0x0a9f[_0x3f6af9];return _0x6cc311;};'use strict';var Sequelize=require(_0xf0a9('0x0'));module[_0xf0a9('0x1')]={'name':{'type':Sequelize[_0xf0a9('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xf0a9('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0xf0a9('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0xf0a9('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xf0a9('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xf0a9('0x2')],'set':function(_0x5b9064){this[_0xf0a9('0x5')](_0xf0a9('0x6'),_0x5b9064?_0x5b9064[_0xf0a9('0x7')](''):[]);},'get':function(){return this['getDataValue'](_0xf0a9('0x6'))?this['getDataValue'](_0xf0a9('0x6'))[_0xf0a9('0x8')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 06ff2a5..e7c8f97 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 _0x20da=['nolimit','sort','where','filters','filter','merge','VIRTUAL','name','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','error','index','UserProfileSection','rawAttributes','fieldName','type','model','map','query','keys','attributes','intersection','fields','hasOwnProperty'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x20da,0x1d2));var _0xa20d=function(_0x2adf1c,_0x3005c){_0x2adf1c=_0x2adf1c-0x0;var _0x401ed9=_0x20da[_0x2adf1c];return _0x401ed9;};'use strict';var pdf=require(_0xa20d('0x0'));var emlformat=require(_0xa20d('0x1'));var rimraf=require(_0xa20d('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa20d('0x3'));var moment=require(_0xa20d('0x4'));var BPromise=require(_0xa20d('0x5'));var Mustache=require(_0xa20d('0x6'));var util=require(_0xa20d('0x7'));var path=require(_0xa20d('0x8'));var sox=require(_0xa20d('0x9'));var csv=require(_0xa20d('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xa20d('0xb'));var squel=require('squel');var crypto=require(_0xa20d('0xc'));var jsforce=require(_0xa20d('0xd'));var deskjs=require(_0xa20d('0xe'));var toCsv=require(_0xa20d('0xa'));var querystring=require(_0xa20d('0xf'));var Papa=require(_0xa20d('0x10'));var Redis=require(_0xa20d('0x11'));var authService=require(_0xa20d('0x12'));var qs=require(_0xa20d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa20d('0x14'));var logger=require('../../config/logger')(_0xa20d('0x15'));var utils=require(_0xa20d('0x16'));var config=require(_0xa20d('0x17'));var db=require(_0xa20d('0x18'))['db'];function respondWithStatusCode(_0x2b09f6,_0x336671){_0x336671=_0x336671||0xcc;return function(_0x1caaac){if(_0x1caaac){return _0x2b09f6[_0xa20d('0x19')](_0x336671);}return _0x2b09f6[_0xa20d('0x1a')](_0x336671)['end']();};}function respondWithResult(_0xb99787,_0x22c694){_0x22c694=_0x22c694||0xc8;return function(_0x50945c){if(_0x50945c){return _0xb99787[_0xa20d('0x1a')](_0x22c694)[_0xa20d('0x1b')](_0x50945c);}};}function respondWithFilteredResult(_0x39bbb7,_0x5ba641){return function(_0x5e7be1){if(_0x5e7be1){var _0x250bb7=_0x5e7be1['count'],_0x29fbeb=_0x5ba641[_0xa20d('0x1c')],_0x2fb4ee=_0x5ba641[_0xa20d('0x1c')]+_0x5ba641[_0xa20d('0x1d')],_0x389ea0;if(_0x2fb4ee>=_0x250bb7){_0x2fb4ee=_0x250bb7;_0x389ea0=0xc8;}else{_0x389ea0=0xce;}_0x39bbb7[_0xa20d('0x1a')](_0x389ea0);return _0x39bbb7[_0xa20d('0x1e')](_0xa20d('0x1f'),_0x29fbeb+'-'+_0x2fb4ee+'/'+_0x250bb7)[_0xa20d('0x1b')](_0x5e7be1);}return null;};}function patchUpdates(_0xeefc21){return function(_0x3e426e){try{jsonpatch[_0xa20d('0x20')](_0x3e426e,_0xeefc21,!![]);}catch(_0x39ff93){return BPromise['reject'](_0x39ff93);}return _0x3e426e[_0xa20d('0x21')]();};}function saveUpdates(_0x1a4bc0,_0xc0160f){return function(_0x1a03b9){if(_0x1a03b9){return _0x1a03b9[_0xa20d('0x22')](_0x1a4bc0)[_0xa20d('0x23')](function(_0x495ca7){return _0x495ca7;});}return null;};}function removeEntity(_0x2eaa9b,_0x27c7e6){return function(_0x5e74cb){if(_0x5e74cb){return _0x5e74cb[_0xa20d('0x24')]()[_0xa20d('0x23')](function(){_0x2eaa9b[_0xa20d('0x1a')](0xcc)[_0xa20d('0x25')]();});}};}function handleEntityNotFound(_0x52557a,_0x196064){return function(_0x59b429){if(!_0x59b429){_0x52557a[_0xa20d('0x19')](0x194);}return _0x59b429;};}function handleError(_0x40621b,_0x47891d){_0x47891d=_0x47891d||0x1f4;return function(_0x536b05){logger[_0xa20d('0x26')](_0x536b05['stack']);if(_0x536b05['name']){delete _0x536b05['name'];}_0x40621b[_0xa20d('0x1a')](_0x47891d)['send'](_0x536b05);};}exports[_0xa20d('0x27')]=function(_0x335396,_0x5762bf){var _0x7c2dd9={},_0x115df0={},_0x50d4f7={'count':0x0,'rows':[]};var _0x247a27=_['map'](db[_0xa20d('0x28')][_0xa20d('0x29')],function(_0x32c887){return{'name':_0x32c887[_0xa20d('0x2a')],'type':_0x32c887[_0xa20d('0x2b')]['key']};});_0x115df0[_0xa20d('0x2c')]=_[_0xa20d('0x2d')](_0x247a27,'name');_0x115df0[_0xa20d('0x2e')]=_[_0xa20d('0x2f')](_0x335396[_0xa20d('0x2e')]);_0x115df0['filters']=_['intersection'](_0x115df0['model'],_0x115df0['query']);_0x7c2dd9[_0xa20d('0x30')]=_[_0xa20d('0x31')](_0x115df0[_0xa20d('0x2c')],qs['fields'](_0x335396[_0xa20d('0x2e')][_0xa20d('0x32')]));_0x7c2dd9['attributes']=_0x7c2dd9['attributes']['length']?_0x7c2dd9[_0xa20d('0x30')]:_0x115df0[_0xa20d('0x2c')];if(!_0x335396[_0xa20d('0x2e')][_0xa20d('0x33')](_0xa20d('0x34'))){_0x7c2dd9[_0xa20d('0x1d')]=qs[_0xa20d('0x1d')](_0x335396[_0xa20d('0x2e')][_0xa20d('0x1d')]);_0x7c2dd9[_0xa20d('0x1c')]=qs[_0xa20d('0x1c')](_0x335396['query'][_0xa20d('0x1c')]);}_0x7c2dd9['order']=qs[_0xa20d('0x35')](_0x335396[_0xa20d('0x2e')][_0xa20d('0x35')]);_0x7c2dd9[_0xa20d('0x36')]=qs['filters'](_['pick'](_0x335396['query'],_0x115df0[_0xa20d('0x37')]));if(_0x335396[_0xa20d('0x2e')][_0xa20d('0x38')]){_0x7c2dd9[_0xa20d('0x36')]=_[_0xa20d('0x39')](_0x7c2dd9[_0xa20d('0x36')],{'$or':_['map'](_0x247a27,function(_0x5cd044){if(_0x5cd044[_0xa20d('0x2b')]!==_0xa20d('0x3a')){var _0x18e7b2={};_0x18e7b2[_0x5cd044[_0xa20d('0x3b')]]={'$like':'%'+_0x335396['query'][_0xa20d('0x38')]+'%'};return _0x18e7b2;}})});}_0x7c2dd9=_[_0xa20d('0x39')]({},_0x7c2dd9,_0x335396[_0xa20d('0x3c')]);var _0x3b223f={'where':_0x7c2dd9['where']};return db[_0xa20d('0x28')][_0xa20d('0x3d')](_0x3b223f)[_0xa20d('0x23')](function(_0x19bc17){_0x50d4f7[_0xa20d('0x3d')]=_0x19bc17;if(_0x335396['query'][_0xa20d('0x3e')]){_0x7c2dd9[_0xa20d('0x3f')]=[{'all':!![]}];}return db[_0xa20d('0x28')][_0xa20d('0x40')](_0x7c2dd9);})[_0xa20d('0x23')](function(_0xf8f11d){_0x50d4f7[_0xa20d('0x41')]=_0xf8f11d;return _0x50d4f7;})[_0xa20d('0x23')](respondWithFilteredResult(_0x5762bf,_0x7c2dd9))[_0xa20d('0x42')](handleError(_0x5762bf,null));};exports[_0xa20d('0x43')]=function(_0x165535,_0x2cad1c){var _0x81f1da={'raw':![],'where':{'id':_0x165535[_0xa20d('0x44')]['id']}},_0x198db7={};_0x198db7[_0xa20d('0x2c')]=_[_0xa20d('0x2f')](db[_0xa20d('0x28')][_0xa20d('0x29')]);_0x198db7[_0xa20d('0x2e')]=_[_0xa20d('0x2f')](_0x165535[_0xa20d('0x2e')]);_0x198db7[_0xa20d('0x37')]=_[_0xa20d('0x31')](_0x198db7[_0xa20d('0x2c')],_0x198db7[_0xa20d('0x2e')]);_0x81f1da[_0xa20d('0x30')]=_[_0xa20d('0x31')](_0x198db7[_0xa20d('0x2c')],qs[_0xa20d('0x32')](_0x165535['query'][_0xa20d('0x32')]));_0x81f1da['attributes']=_0x81f1da['attributes'][_0xa20d('0x45')]?_0x81f1da[_0xa20d('0x30')]:_0x198db7[_0xa20d('0x2c')];if(_0x165535[_0xa20d('0x2e')]['includeAll']){_0x81f1da[_0xa20d('0x3f')]=[{'all':!![]}];}_0x81f1da=_[_0xa20d('0x39')]({},_0x81f1da,_0x165535['options']);return db[_0xa20d('0x28')][_0xa20d('0x46')](_0x81f1da)[_0xa20d('0x23')](handleEntityNotFound(_0x2cad1c,null))[_0xa20d('0x23')](respondWithResult(_0x2cad1c,null))[_0xa20d('0x42')](handleError(_0x2cad1c,null));};exports[_0xa20d('0x47')]=function(_0xe0b660,_0x184d0c){return db[_0xa20d('0x28')]['create'](_0xe0b660['body'],{})['then'](respondWithResult(_0x184d0c,0xc9))[_0xa20d('0x42')](handleError(_0x184d0c,null));};exports[_0xa20d('0x22')]=function(_0x3fc543,_0x1418c6){if(_0x3fc543[_0xa20d('0x48')]['id']){delete _0x3fc543[_0xa20d('0x48')]['id'];}return db['UserProfileSection'][_0xa20d('0x46')]({'where':{'id':_0x3fc543[_0xa20d('0x44')]['id']}})[_0xa20d('0x23')](handleEntityNotFound(_0x1418c6,null))[_0xa20d('0x23')](saveUpdates(_0x3fc543[_0xa20d('0x48')],null))[_0xa20d('0x23')](respondWithResult(_0x1418c6,null))[_0xa20d('0x42')](handleError(_0x1418c6,null));};exports['destroy']=function(_0x42903d,_0x3ac4d5){return db[_0xa20d('0x28')]['find']({'where':{'id':_0x42903d[_0xa20d('0x44')]['id']}})[_0xa20d('0x23')](handleEntityNotFound(_0x3ac4d5,null))[_0xa20d('0x23')](removeEntity(_0x3ac4d5,null))[_0xa20d('0x42')](handleError(_0x3ac4d5,null));};exports[_0xa20d('0x49')]=function(_0x320dba,_0x3dd877){return db[_0xa20d('0x28')][_0xa20d('0x49')]()['then'](respondWithResult(_0x3dd877,null))['catch'](handleError(_0x3dd877,null));}; \ No newline at end of file +var _0x7631=['UserProfileSection','include','findAll','rows','catch','show','params','includeAll','create','body','find','describe','html-pdf','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/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','apply','save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','keys','query','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','merge','map','VIRTUAL','filter','options'];(function(_0x19e887,_0x33d40c){var _0xb1d814=function(_0x576ade){while(--_0x576ade){_0x19e887['push'](_0x19e887['shift']());}};_0xb1d814(++_0x33d40c);}(_0x7631,0x188));var _0x1763=function(_0x4c6c6a,_0x1b70bf){_0x4c6c6a=_0x4c6c6a-0x0;var _0x1a7106=_0x7631[_0x4c6c6a];return _0x1a7106;};'use strict';var pdf=require(_0x1763('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x1763('0x1'));var zipdir=require(_0x1763('0x2'));var jsonpatch=require(_0x1763('0x3'));var rp=require(_0x1763('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1763('0x5'));var util=require(_0x1763('0x6'));var path=require(_0x1763('0x7'));var sox=require(_0x1763('0x8'));var csv=require(_0x1763('0x9'));var ejs=require(_0x1763('0xa'));var fs=require('fs');var _=require(_0x1763('0xb'));var squel=require(_0x1763('0xc'));var crypto=require(_0x1763('0xd'));var jsforce=require(_0x1763('0xe'));var deskjs=require(_0x1763('0xf'));var toCsv=require(_0x1763('0x9'));var querystring=require(_0x1763('0x10'));var Papa=require(_0x1763('0x11'));var Redis=require(_0x1763('0x12'));var authService=require(_0x1763('0x13'));var qs=require(_0x1763('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1763('0x15'));var logger=require(_0x1763('0x16'))(_0x1763('0x17'));var utils=require(_0x1763('0x18'));var config=require(_0x1763('0x19'));var db=require(_0x1763('0x1a'))['db'];function respondWithStatusCode(_0x18c617,_0x287f3f){_0x287f3f=_0x287f3f||0xcc;return function(_0x2786f9){if(_0x2786f9){return _0x18c617[_0x1763('0x1b')](_0x287f3f);}return _0x18c617[_0x1763('0x1c')](_0x287f3f)[_0x1763('0x1d')]();};}function respondWithResult(_0x515d90,_0x412b64){_0x412b64=_0x412b64||0xc8;return function(_0x5f488a){if(_0x5f488a){return _0x515d90[_0x1763('0x1c')](_0x412b64)[_0x1763('0x1e')](_0x5f488a);}};}function respondWithFilteredResult(_0x1bd1fd,_0x5e2c34){return function(_0x3c35f1){if(_0x3c35f1){var _0x55590a=_0x3c35f1[_0x1763('0x1f')],_0x49c3b5=_0x5e2c34[_0x1763('0x20')],_0x34542c=_0x5e2c34[_0x1763('0x20')]+_0x5e2c34['limit'],_0xc2313e;if(_0x34542c>=_0x55590a){_0x34542c=_0x55590a;_0xc2313e=0xc8;}else{_0xc2313e=0xce;}_0x1bd1fd[_0x1763('0x1c')](_0xc2313e);return _0x1bd1fd[_0x1763('0x21')]('Content-Range',_0x49c3b5+'-'+_0x34542c+'/'+_0x55590a)[_0x1763('0x1e')](_0x3c35f1);}return null;};}function patchUpdates(_0x2adf90){return function(_0xc0e100){try{jsonpatch[_0x1763('0x22')](_0xc0e100,_0x2adf90,!![]);}catch(_0x58f005){return BPromise['reject'](_0x58f005);}return _0xc0e100[_0x1763('0x23')]();};}function saveUpdates(_0x2f5bb4,_0x5500c3){return function(_0x5690d4){if(_0x5690d4){return _0x5690d4[_0x1763('0x24')](_0x2f5bb4)[_0x1763('0x25')](function(_0x128987){return _0x128987;});}return null;};}function removeEntity(_0x4759f5,_0x50f1a8){return function(_0x5b11e0){if(_0x5b11e0){return _0x5b11e0[_0x1763('0x26')]()[_0x1763('0x25')](function(){_0x4759f5['status'](0xcc)[_0x1763('0x1d')]();});}};}function handleEntityNotFound(_0x18d7d2,_0x688790){return function(_0x21281d){if(!_0x21281d){_0x18d7d2[_0x1763('0x1b')](0x194);}return _0x21281d;};}function handleError(_0x18720d,_0x436b13){_0x436b13=_0x436b13||0x1f4;return function(_0x5b6f64){logger[_0x1763('0x27')](_0x5b6f64['stack']);if(_0x5b6f64[_0x1763('0x28')]){delete _0x5b6f64[_0x1763('0x28')];}_0x18720d[_0x1763('0x1c')](_0x436b13)[_0x1763('0x29')](_0x5b6f64);};}exports[_0x1763('0x2a')]=function(_0x5f5236,_0x400365){var _0xa6218={},_0x258bc9={},_0x393000={'count':0x0,'rows':[]};var _0x110f09=_['map'](db['UserProfileSection'][_0x1763('0x2b')],function(_0x599f7f){return{'name':_0x599f7f[_0x1763('0x2c')],'type':_0x599f7f[_0x1763('0x2d')]['key']};});_0x258bc9['model']=_['map'](_0x110f09,_0x1763('0x28'));_0x258bc9['query']=_[_0x1763('0x2e')](_0x5f5236[_0x1763('0x2f')]);_0x258bc9[_0x1763('0x30')]=_[_0x1763('0x31')](_0x258bc9['model'],_0x258bc9['query']);_0xa6218['attributes']=_[_0x1763('0x31')](_0x258bc9[_0x1763('0x32')],qs[_0x1763('0x33')](_0x5f5236[_0x1763('0x2f')]['fields']));_0xa6218[_0x1763('0x34')]=_0xa6218[_0x1763('0x34')][_0x1763('0x35')]?_0xa6218[_0x1763('0x34')]:_0x258bc9['model'];if(!_0x5f5236['query'][_0x1763('0x36')]('nolimit')){_0xa6218['limit']=qs[_0x1763('0x37')](_0x5f5236[_0x1763('0x2f')][_0x1763('0x37')]);_0xa6218[_0x1763('0x20')]=qs[_0x1763('0x20')](_0x5f5236[_0x1763('0x2f')]['offset']);}_0xa6218[_0x1763('0x38')]=qs[_0x1763('0x39')](_0x5f5236[_0x1763('0x2f')][_0x1763('0x39')]);_0xa6218['where']=qs['filters'](_['pick'](_0x5f5236['query'],_0x258bc9[_0x1763('0x30')]));if(_0x5f5236['query']['filter']){_0xa6218[_0x1763('0x3a')]=_[_0x1763('0x3b')](_0xa6218['where'],{'$or':_[_0x1763('0x3c')](_0x110f09,function(_0x191de2){if(_0x191de2[_0x1763('0x2d')]!==_0x1763('0x3d')){var _0x5dc4a6={};_0x5dc4a6[_0x191de2['name']]={'$like':'%'+_0x5f5236[_0x1763('0x2f')][_0x1763('0x3e')]+'%'};return _0x5dc4a6;}})});}_0xa6218=_[_0x1763('0x3b')]({},_0xa6218,_0x5f5236[_0x1763('0x3f')]);var _0x52aa88={'where':_0xa6218[_0x1763('0x3a')]};return db[_0x1763('0x40')][_0x1763('0x1f')](_0x52aa88)[_0x1763('0x25')](function(_0x22897c){_0x393000[_0x1763('0x1f')]=_0x22897c;if(_0x5f5236[_0x1763('0x2f')]['includeAll']){_0xa6218[_0x1763('0x41')]=[{'all':!![]}];}return db[_0x1763('0x40')][_0x1763('0x42')](_0xa6218);})['then'](function(_0x5a5983){_0x393000[_0x1763('0x43')]=_0x5a5983;return _0x393000;})['then'](respondWithFilteredResult(_0x400365,_0xa6218))[_0x1763('0x44')](handleError(_0x400365,null));};exports[_0x1763('0x45')]=function(_0x44252a,_0x2cb0ed){var _0x240866={'raw':![],'where':{'id':_0x44252a[_0x1763('0x46')]['id']}},_0x15abad={};_0x15abad[_0x1763('0x32')]=_[_0x1763('0x2e')](db['UserProfileSection'][_0x1763('0x2b')]);_0x15abad['query']=_[_0x1763('0x2e')](_0x44252a[_0x1763('0x2f')]);_0x15abad[_0x1763('0x30')]=_[_0x1763('0x31')](_0x15abad['model'],_0x15abad[_0x1763('0x2f')]);_0x240866[_0x1763('0x34')]=_[_0x1763('0x31')](_0x15abad[_0x1763('0x32')],qs[_0x1763('0x33')](_0x44252a[_0x1763('0x2f')][_0x1763('0x33')]));_0x240866[_0x1763('0x34')]=_0x240866['attributes']['length']?_0x240866[_0x1763('0x34')]:_0x15abad[_0x1763('0x32')];if(_0x44252a[_0x1763('0x2f')][_0x1763('0x47')]){_0x240866['include']=[{'all':!![]}];}_0x240866=_[_0x1763('0x3b')]({},_0x240866,_0x44252a[_0x1763('0x3f')]);return db['UserProfileSection']['find'](_0x240866)['then'](handleEntityNotFound(_0x2cb0ed,null))[_0x1763('0x25')](respondWithResult(_0x2cb0ed,null))[_0x1763('0x44')](handleError(_0x2cb0ed,null));};exports['create']=function(_0x444891,_0x39568a){return db[_0x1763('0x40')][_0x1763('0x48')](_0x444891['body'],{})[_0x1763('0x25')](respondWithResult(_0x39568a,0xc9))[_0x1763('0x44')](handleError(_0x39568a,null));};exports[_0x1763('0x24')]=function(_0x1935ff,_0x5995d7){if(_0x1935ff[_0x1763('0x49')]['id']){delete _0x1935ff[_0x1763('0x49')]['id'];}return db[_0x1763('0x40')][_0x1763('0x4a')]({'where':{'id':_0x1935ff['params']['id']}})[_0x1763('0x25')](handleEntityNotFound(_0x5995d7,null))[_0x1763('0x25')](saveUpdates(_0x1935ff[_0x1763('0x49')],null))['then'](respondWithResult(_0x5995d7,null))[_0x1763('0x44')](handleError(_0x5995d7,null));};exports['destroy']=function(_0x4e49e8,_0x242c7a){return db[_0x1763('0x40')][_0x1763('0x4a')]({'where':{'id':_0x4e49e8[_0x1763('0x46')]['id']}})['then'](handleEntityNotFound(_0x242c7a,null))[_0x1763('0x25')](removeEntity(_0x242c7a,null))['catch'](handleError(_0x242c7a,null));};exports[_0x1763('0x4b')]=function(_0x6add37,_0x4bcc19){return db['UserProfileSection'][_0x1763('0x4b')]()['then'](respondWithResult(_0x4bcc19,null))[_0x1763('0x44')](handleError(_0x4bcc19,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index b6d8fab..cdeec15 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 _0xca57=['user_profile_has_sections','compositeIndex','sectionId','userProfileId','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./userProfileSection.attributes','exports','define','UserProfileSection'];(function(_0x2c4a34,_0x3d5f02){var _0x55b223=function(_0x1ff096){while(--_0x1ff096){_0x2c4a34['push'](_0x2c4a34['shift']());}};_0x55b223(++_0x3d5f02);}(_0xca57,0x1d5));var _0x7ca5=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xca57[_0x42245d];return _0x4b211a;};'use strict';var _=require(_0x7ca5('0x0'));var util=require(_0x7ca5('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7ca5('0x2'));var BPromise=require(_0x7ca5('0x3'));var rp=require(_0x7ca5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7ca5('0x5'));var config=require(_0x7ca5('0x6'));var attributes=require(_0x7ca5('0x7'));module[_0x7ca5('0x8')]=function(_0x5cfdb9,_0x13a4aa){return _0x5cfdb9[_0x7ca5('0x9')](_0x7ca5('0xa'),attributes,{'tableName':_0x7ca5('0xb'),'paranoid':![],'indexes':[{'name':_0x7ca5('0xc'),'fields':[_0x7ca5('0xd'),_0x7ca5('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xaebe=['bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','user_profile_has_sections','userProfileId','lodash','util','../../config/logger'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0xaebe,0xed));var _0xeaeb=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xaebe[_0x20589d];return _0x422de9;};'use strict';var _=require(_0xeaeb('0x0'));var util=require(_0xeaeb('0x1'));var logger=require(_0xeaeb('0x2'))('api');var moment=require('moment');var BPromise=require(_0xeaeb('0x3'));var rp=require(_0xeaeb('0x4'));var fs=require('fs');var path=require(_0xeaeb('0x5'));var rimraf=require(_0xeaeb('0x6'));var config=require('../../config/environment');var attributes=require(_0xeaeb('0x7'));module[_0xeaeb('0x8')]=function(_0x2d542c,_0x1a1a6c){return _0x2d542c[_0xeaeb('0x9')]('UserProfileSection',attributes,{'tableName':_0xeaeb('0xa'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':['sectionId',_0xeaeb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 4fd178b..c6f4f33 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 _0x4ee9=['info','request\x20sent','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileSection,\x20%s,\x20%s','message','result','lodash','moment','bluebird','ioredis','../../config/logger','jayson/promise','http','request','then'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0x4ee9,0x1d2));var _0x94ee=function(_0x28e68e,_0x426d50){_0x28e68e=_0x28e68e-0x0;var _0x47ee76=_0x4ee9[_0x28e68e];return _0x47ee76;};'use strict';var _=require(_0x94ee('0x0'));var util=require('util');var moment=require(_0x94ee('0x1'));var BPromise=require(_0x94ee('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x94ee('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x94ee('0x4'))('rpc');var config=require('../../config/environment');var jayson=require(_0x94ee('0x5'));var client=jayson['client'][_0x94ee('0x6')]({'port':0x232a});function respondWithRpcPromise(_0xe15af6,_0x1975ac,_0x2cbd97){return new BPromise(function(_0x2c9c07,_0x1d817f){return client[_0x94ee('0x7')](_0xe15af6,_0x2cbd97)[_0x94ee('0x8')](function(_0x4ec822){logger[_0x94ee('0x9')]('UserProfileSection,\x20%s,\x20%s',_0x1975ac,_0x94ee('0xa'));logger[_0x94ee('0xb')](_0x94ee('0xc'),_0x1975ac,_0x94ee('0xa'),JSON[_0x94ee('0xd')](_0x4ec822));if(_0x4ec822['error']){if(_0x4ec822[_0x94ee('0xe')][_0x94ee('0xf')]===0x1f4){logger[_0x94ee('0xe')](_0x94ee('0x10'),_0x1975ac,_0x4ec822[_0x94ee('0xe')][_0x94ee('0x11')]);return _0x1d817f(_0x4ec822[_0x94ee('0xe')][_0x94ee('0x11')]);}logger[_0x94ee('0xe')](_0x94ee('0x10'),_0x1975ac,_0x4ec822['error'][_0x94ee('0x11')]);return _0x2c9c07(_0x4ec822[_0x94ee('0xe')][_0x94ee('0x11')]);}else{logger['info'](_0x94ee('0x10'),_0x1975ac,_0x94ee('0xa'));_0x2c9c07(_0x4ec822[_0x94ee('0x12')][_0x94ee('0x11')]);}})['catch'](function(_0x23cefb){logger[_0x94ee('0xe')](_0x94ee('0x10'),_0x1975ac,_0x23cefb);_0x1d817f(_0x23cefb);});});} \ No newline at end of file +var _0x3822=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','UserProfileSection,\x20%s,\x20%s','debug','UserProfileSection,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0x3822,0x197));var _0x2382=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x3822[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0x2382('0x0'));var util=require(_0x2382('0x1'));var moment=require(_0x2382('0x2'));var BPromise=require(_0x2382('0x3'));var rs=require(_0x2382('0x4'));var fs=require('fs');var Redis=require(_0x2382('0x5'));var db=require(_0x2382('0x6'))['db'];var utils=require(_0x2382('0x7'));var logger=require(_0x2382('0x8'))(_0x2382('0x9'));var config=require(_0x2382('0xa'));var jayson=require(_0x2382('0xb'));var client=jayson[_0x2382('0xc')][_0x2382('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3f50c1,_0x508508,_0x2e57e2){return new BPromise(function(_0xd29c1d,_0x3cb9e3){return client[_0x2382('0xe')](_0x3f50c1,_0x2e57e2)[_0x2382('0xf')](function(_0x2f5188){logger['info'](_0x2382('0x10'),_0x508508,'request\x20sent');logger[_0x2382('0x11')](_0x2382('0x12'),_0x508508,_0x2382('0x13'),JSON[_0x2382('0x14')](_0x2f5188));if(_0x2f5188[_0x2382('0x15')]){if(_0x2f5188[_0x2382('0x15')][_0x2382('0x16')]===0x1f4){logger[_0x2382('0x15')](_0x2382('0x10'),_0x508508,_0x2f5188[_0x2382('0x15')][_0x2382('0x17')]);return _0x3cb9e3(_0x2f5188['error']['message']);}logger['error']('UserProfileSection,\x20%s,\x20%s',_0x508508,_0x2f5188[_0x2382('0x15')][_0x2382('0x17')]);return _0xd29c1d(_0x2f5188[_0x2382('0x15')][_0x2382('0x17')]);}else{logger[_0x2382('0x18')]('UserProfileSection,\x20%s,\x20%s',_0x508508,_0x2382('0x13'));_0xd29c1d(_0x2f5188[_0x2382('0x19')][_0x2382('0x17')]);}})[_0x2382('0x1a')](function(_0x161335){logger[_0x2382('0x15')]('UserProfileSection,\x20%s,\x20%s',_0x508508,_0x161335);_0x3cb9e3(_0x161335);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index fe0f7c8..ed99827 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 _0x870c=['multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x50424f,_0x50aa88){var _0xd5e2de=function(_0x31dc63){while(--_0x31dc63){_0x50424f['push'](_0x50424f['shift']());}};_0xd5e2de(++_0x50aa88);}(_0x870c,0x1b9));var _0xc870=function(_0x57b925,_0x29faf7){_0x57b925=_0x57b925-0x0;var _0x11e9ad=_0x870c[_0x57b925];return _0x11e9ad;};'use strict';var multer=require(_0xc870('0x0'));var util=require(_0xc870('0x1'));var path=require('path');var timeout=require(_0xc870('0x2'));var express=require(_0xc870('0x3'));var router=express[_0xc870('0x4')]();var auth=require(_0xc870('0x5'));var interaction=require(_0xc870('0x6'));var config=require(_0xc870('0x7'));module[_0xc870('0x8')]=router; \ No newline at end of file +var _0xbb27=['util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','exports','multer'];(function(_0x2c095b,_0x6a1632){var _0x4ec55f=function(_0x2d171b){while(--_0x2d171b){_0x2c095b['push'](_0x2c095b['shift']());}};_0x4ec55f(++_0x6a1632);}(_0xbb27,0x1cd));var _0x7bb2=function(_0x3be3be,_0x224591){_0x3be3be=_0x3be3be-0x0;var _0x464642=_0xbb27[_0x3be3be];return _0x464642;};'use strict';var multer=require(_0x7bb2('0x0'));var util=require(_0x7bb2('0x1'));var path=require('path');var timeout=require(_0x7bb2('0x2'));var express=require(_0x7bb2('0x3'));var router=express['Router']();var auth=require(_0x7bb2('0x4'));var interaction=require(_0x7bb2('0x5'));var config=require('../../config/environment');module[_0x7bb2('0x6')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index a198f93..ec320e4 100644 --- a/server/api/userSmsQueue/userSmsQueue.attributes.js +++ b/server/api/userSmsQueue/userSmsQueue.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['INTEGER','sequelize','exports'];(function(_0x51cb2d,_0x13e29d){var _0x242722=function(_0x2777fe){while(--_0x2777fe){_0x51cb2d['push'](_0x51cb2d['shift']());}};_0x242722(++_0x13e29d);}(_0xe706,0xa3));var _0x6e70=function(_0x151f00,_0x4ca3a1){_0x151f00=_0x151f00-0x0;var _0x418d9b=_0xe706[_0x151f00];return _0x418d9b;};'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(_0xeadc11,_0x27e378){var _0x4257b6=function(_0x38bb40){while(--_0x38bb40){_0xeadc11['push'](_0xeadc11['shift']());}};_0x4257b6(++_0x27e378);}(_0xbaf0,0x12a));var _0x0baf=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xbaf0[_0x465028];return _0xb783d4;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'penalty':{'type':Sequelize[_0x0baf('0x1')],'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 77ba56b..7b518a6 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 _0x496e=['user_has_sms_queues','../../config/logger','moment','bluebird','path','rimraf','exports','UserSmsQueue'];(function(_0x221a0f,_0x3970f6){var _0x30309e=function(_0x2a6cf4){while(--_0x2a6cf4){_0x221a0f['push'](_0x221a0f['shift']());}};_0x30309e(++_0x3970f6);}(_0x496e,0x79));var _0xe496=function(_0x3f71a0,_0x452c96){_0x3f71a0=_0x3f71a0-0x0;var _0x1d06d4=_0x496e[_0x3f71a0];return _0x1d06d4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe496('0x0'))('api');var moment=require(_0xe496('0x1'));var BPromise=require(_0xe496('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe496('0x3'));var rimraf=require(_0xe496('0x4'));var config=require('../../config/environment');var attributes=require('./userSmsQueue.attributes');module[_0xe496('0x5')]=function(_0xed8c69,_0x1942fa){return _0xed8c69['define'](_0xe496('0x6'),attributes,{'tableName':_0xe496('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfbcd=['path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','define','UserSmsQueue','user_has_sms_queues','lodash','util','../../config/logger','api'];(function(_0x100d4c,_0x1d1e60){var _0x1bce92=function(_0x2dcb8d){while(--_0x2dcb8d){_0x100d4c['push'](_0x100d4c['shift']());}};_0x1bce92(++_0x1d1e60);}(_0xfbcd,0x110));var _0xdfbc=function(_0x15bc08,_0x4eeed7){_0x15bc08=_0x15bc08-0x0;var _0x3e67ee=_0xfbcd[_0x15bc08];return _0x3e67ee;};'use strict';var _=require(_0xdfbc('0x0'));var util=require(_0xdfbc('0x1'));var logger=require(_0xdfbc('0x2'))(_0xdfbc('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdfbc('0x4'));var rimraf=require(_0xdfbc('0x5'));var config=require(_0xdfbc('0x6'));var attributes=require(_0xdfbc('0x7'));module[_0xdfbc('0x8')]=function(_0x29c8b6,_0x407412){return _0x29c8b6[_0xdfbc('0x9')](_0xdfbc('0xa'),attributes,{'tableName':_0xdfbc('0xb'),'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 be6e74b..3994b90 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 _0x1cb0=['lodash','util','moment','bluebird','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch'];(function(_0x43a484,_0xb16492){var _0x1c13ae=function(_0x18f96c){while(--_0x18f96c){_0x43a484['push'](_0x43a484['shift']());}};_0x1c13ae(++_0xb16492);}(_0x1cb0,0x187));var _0x01cb=function(_0x19a465,_0x47790a){_0x19a465=_0x19a465-0x0;var _0xda00f8=_0x1cb0[_0x19a465];return _0xda00f8;};'use strict';var _=require(_0x01cb('0x0'));var util=require(_0x01cb('0x1'));var moment=require(_0x01cb('0x2'));var BPromise=require(_0x01cb('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x01cb('0x5'))(_0x01cb('0x6'));var config=require('../../config/environment');var jayson=require(_0x01cb('0x7'));var client=jayson[_0x01cb('0x8')][_0x01cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c2914,_0x456ca1,_0x3e5f11){return new BPromise(function(_0x249b50,_0x22a4c5){return client[_0x01cb('0xa')](_0x4c2914,_0x3e5f11)[_0x01cb('0xb')](function(_0x4b5d2a){logger[_0x01cb('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x456ca1,_0x01cb('0xd'));logger[_0x01cb('0xe')](_0x01cb('0xf'),_0x456ca1,_0x01cb('0xd'),JSON[_0x01cb('0x10')](_0x4b5d2a));if(_0x4b5d2a[_0x01cb('0x11')]){if(_0x4b5d2a[_0x01cb('0x11')][_0x01cb('0x12')]===0x1f4){logger[_0x01cb('0x11')](_0x01cb('0x13'),_0x456ca1,_0x4b5d2a['error'][_0x01cb('0x14')]);return _0x22a4c5(_0x4b5d2a['error']['message']);}logger[_0x01cb('0x11')](_0x01cb('0x13'),_0x456ca1,_0x4b5d2a['error']['message']);return _0x249b50(_0x4b5d2a[_0x01cb('0x11')][_0x01cb('0x14')]);}else{logger[_0x01cb('0xc')](_0x01cb('0x13'),_0x456ca1,_0x01cb('0xd'));_0x249b50(_0x4b5d2a[_0x01cb('0x15')][_0x01cb('0x14')]);}})[_0x01cb('0x16')](function(_0x57e53b){logger[_0x01cb('0x11')]('UserSmsQueue,\x20%s,\x20%s',_0x456ca1,_0x57e53b);_0x22a4c5(_0x57e53b);});});} \ No newline at end of file +var _0x02b5=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserSmsQueue,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x23c6f2,_0x4e033c){var _0x4c270b=function(_0x4913f0){while(--_0x4913f0){_0x23c6f2['push'](_0x23c6f2['shift']());}};_0x4c270b(++_0x4e033c);}(_0x02b5,0x11e));var _0x502b=function(_0x542560,_0x491653){_0x542560=_0x542560-0x0;var _0x4b6f20=_0x02b5[_0x542560];return _0x4b6f20;};'use strict';var _=require(_0x502b('0x0'));var util=require('util');var moment=require(_0x502b('0x1'));var BPromise=require(_0x502b('0x2'));var rs=require(_0x502b('0x3'));var fs=require('fs');var Redis=require(_0x502b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x502b('0x5'));var logger=require(_0x502b('0x6'))(_0x502b('0x7'));var config=require(_0x502b('0x8'));var jayson=require(_0x502b('0x9'));var client=jayson[_0x502b('0xa')][_0x502b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2a326f,_0x572d72,_0x46e858){return new BPromise(function(_0x3681b8,_0x392e7f){return client[_0x502b('0xc')](_0x2a326f,_0x46e858)[_0x502b('0xd')](function(_0x1d8740){logger[_0x502b('0xe')]('UserSmsQueue,\x20%s,\x20%s',_0x572d72,_0x502b('0xf'));logger['debug'](_0x502b('0x10'),_0x572d72,'request\x20sent',JSON[_0x502b('0x11')](_0x1d8740));if(_0x1d8740[_0x502b('0x12')]){if(_0x1d8740['error'][_0x502b('0x13')]===0x1f4){logger[_0x502b('0x12')](_0x502b('0x14'),_0x572d72,_0x1d8740[_0x502b('0x12')]['message']);return _0x392e7f(_0x1d8740[_0x502b('0x12')][_0x502b('0x15')]);}logger['error']('UserSmsQueue,\x20%s,\x20%s',_0x572d72,_0x1d8740[_0x502b('0x12')][_0x502b('0x15')]);return _0x3681b8(_0x1d8740['error'][_0x502b('0x15')]);}else{logger['info'](_0x502b('0x14'),_0x572d72,_0x502b('0xf'));_0x3681b8(_0x1d8740[_0x502b('0x16')][_0x502b('0x15')]);}})[_0x502b('0x17')](function(_0x24ce2d){logger[_0x502b('0x12')](_0x502b('0x14'),_0x572d72,_0x24ce2d);_0x392e7f(_0x24ce2d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index c59c7d4..75568bf 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 _0xbdf9=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','exports'];(function(_0x3aa48e,_0x1ed916){var _0x1105ac=function(_0x27915c){while(--_0x27915c){_0x3aa48e['push'](_0x3aa48e['shift']());}};_0x1105ac(++_0x1ed916);}(_0xbdf9,0x1e0));var _0x9bdf=function(_0x1c9c24,_0x2a517b){_0x1c9c24=_0x1c9c24-0x0;var _0x349c69=_0xbdf9[_0x1c9c24];return _0x349c69;};'use strict';var multer=require(_0x9bdf('0x0'));var util=require(_0x9bdf('0x1'));var path=require(_0x9bdf('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9bdf('0x3')]();var auth=require(_0x9bdf('0x4'));var interaction=require(_0x9bdf('0x5'));var config=require(_0x9bdf('0x6'));module[_0x9bdf('0x7')]=router; \ No newline at end of file +var _0xdded=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util','path'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xdded,0x14a));var _0xddde=function(_0x128dd7,_0x2eee8e){_0x128dd7=_0x128dd7-0x0;var _0x51f070=_0xdded[_0x128dd7];return _0x51f070;};'use strict';var multer=require(_0xddde('0x0'));var util=require(_0xddde('0x1'));var path=require(_0xddde('0x2'));var timeout=require(_0xddde('0x3'));var express=require(_0xddde('0x4'));var router=express[_0xddde('0x5')]();var auth=require(_0xddde('0x6'));var interaction=require(_0xddde('0x7'));var config=require(_0xddde('0x8'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index e0b7b89..c10683b 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(_0x4986a9,_0x311d65){var _0x2d31fe=function(_0x369848){while(--_0x369848){_0x4986a9['push'](_0x4986a9['shift']());}};_0x2d31fe(++_0x311d65);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['sequelize','exports','INTEGER'];(function(_0x1d6a2c,_0xcf2361){var _0x58fa00=function(_0x2e2f34){while(--_0x2e2f34){_0x1d6a2c['push'](_0x1d6a2c['shift']());}};_0x58fa00(++_0xcf2361);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'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/userVoiceQueue/userVoiceQueue.model.js b/server/api/userVoiceQueue/userVoiceQueue.model.js index 318ac32..b3b586d 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 _0x0a9a=['bluebird','request-promise','rimraf','../../config/environment','exports','define','user_has_voice_queues','util','api','moment'];(function(_0x24cf99,_0x2e2189){var _0x210865=function(_0x2d0ff8){while(--_0x2d0ff8){_0x24cf99['push'](_0x24cf99['shift']());}};_0x210865(++_0x2e2189);}(_0x0a9a,0x183));var _0xa0a9=function(_0x54ceaa,_0x1d07fd){_0x54ceaa=_0x54ceaa-0x0;var _0x26ed50=_0x0a9a[_0x54ceaa];return _0x26ed50;};'use strict';var _=require('lodash');var util=require(_0xa0a9('0x0'));var logger=require('../../config/logger')(_0xa0a9('0x1'));var moment=require(_0xa0a9('0x2'));var BPromise=require(_0xa0a9('0x3'));var rp=require(_0xa0a9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa0a9('0x5'));var config=require(_0xa0a9('0x6'));var attributes=require('./userVoiceQueue.attributes');module[_0xa0a9('0x7')]=function(_0xc65bbb,_0x1aa717){return _0xc65bbb[_0xa0a9('0x8')]('UserVoiceQueue',attributes,{'tableName':_0xa0a9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xed1f=['user_has_voice_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','exports','define','UserVoiceQueue'];(function(_0x4ae56a,_0x103522){var _0x3399ec=function(_0x54977f){while(--_0x54977f){_0x4ae56a['push'](_0x4ae56a['shift']());}};_0x3399ec(++_0x103522);}(_0xed1f,0x6a));var _0xfed1=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xed1f[_0x1b6c6d];return _0x290d9d;};'use strict';var _=require(_0xfed1('0x0'));var util=require(_0xfed1('0x1'));var logger=require(_0xfed1('0x2'))(_0xfed1('0x3'));var moment=require(_0xfed1('0x4'));var BPromise=require(_0xfed1('0x5'));var rp=require(_0xfed1('0x6'));var fs=require('fs');var path=require(_0xfed1('0x7'));var rimraf=require(_0xfed1('0x8'));var config=require(_0xfed1('0x9'));var attributes=require(_0xfed1('0xa'));module[_0xfed1('0xb')]=function(_0x3d6706,_0x42751d){return _0x3d6706[_0xfed1('0xc')](_0xfed1('0xd'),attributes,{'tableName':_0xfed1('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.rpc.js b/server/api/userVoiceQueue/userVoiceQueue.rpc.js index e009e1f..1d20e90 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 _0x42e4=['bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment'];(function(_0x2a71c0,_0x4a1b8f){var _0x3745b6=function(_0x4841a8){while(--_0x4841a8){_0x2a71c0['push'](_0x2a71c0['shift']());}};_0x3745b6(++_0x4a1b8f);}(_0x42e4,0x1cc));var _0x442e=function(_0x3e8925,_0x426a92){_0x3e8925=_0x3e8925-0x0;var _0x448cbf=_0x42e4[_0x3e8925];return _0x448cbf;};'use strict';var _=require('lodash');var util=require(_0x442e('0x0'));var moment=require(_0x442e('0x1'));var BPromise=require(_0x442e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x442e('0x3'))['db'];var utils=require(_0x442e('0x4'));var logger=require(_0x442e('0x5'))(_0x442e('0x6'));var config=require(_0x442e('0x7'));var jayson=require(_0x442e('0x8'));var client=jayson['client'][_0x442e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xad3992,_0x4d3683,_0x148624){return new BPromise(function(_0x23cc33,_0x32fdb3){return client[_0x442e('0xa')](_0xad3992,_0x148624)[_0x442e('0xb')](function(_0x3fc593){logger[_0x442e('0xc')](_0x442e('0xd'),_0x4d3683,_0x442e('0xe'));logger['debug'](_0x442e('0xf'),_0x4d3683,_0x442e('0xe'),JSON['stringify'](_0x3fc593));if(_0x3fc593[_0x442e('0x10')]){if(_0x3fc593[_0x442e('0x10')][_0x442e('0x11')]===0x1f4){logger[_0x442e('0x10')](_0x442e('0xd'),_0x4d3683,_0x3fc593[_0x442e('0x10')][_0x442e('0x12')]);return _0x32fdb3(_0x3fc593[_0x442e('0x10')][_0x442e('0x12')]);}logger[_0x442e('0x10')](_0x442e('0xd'),_0x4d3683,_0x3fc593[_0x442e('0x10')][_0x442e('0x12')]);return _0x23cc33(_0x3fc593['error'][_0x442e('0x12')]);}else{logger['info'](_0x442e('0xd'),_0x4d3683,_0x442e('0xe'));_0x23cc33(_0x3fc593[_0x442e('0x13')][_0x442e('0x12')]);}})[_0x442e('0x14')](function(_0x5aa50f){logger[_0x442e('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x4d3683,_0x5aa50f);_0x32fdb3(_0x5aa50f);});});} \ No newline at end of file +var _0xacc2=['UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','randomstring','../../mysqldb','rpc','jayson/promise','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x10136e,_0x1bb577){var _0x34be9a=function(_0x3af687){while(--_0x3af687){_0x10136e['push'](_0x10136e['shift']());}};_0x34be9a(++_0x1bb577);}(_0xacc2,0x126));var _0x2acc=function(_0x5c878f,_0x2c49c1){_0x5c878f=_0x5c878f-0x0;var _0x1f0c5b=_0xacc2[_0x5c878f];return _0x1f0c5b;};'use strict';var _=require(_0x2acc('0x0'));var util=require(_0x2acc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x2acc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2acc('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2acc('0x4'));var config=require('../../config/environment');var jayson=require(_0x2acc('0x5'));var client=jayson[_0x2acc('0x6')][_0x2acc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16f8f2,_0x36fc6f,_0x4cec40){return new BPromise(function(_0x3c9e7f,_0x4aff24){return client['request'](_0x16f8f2,_0x4cec40)['then'](function(_0x4164f9){logger[_0x2acc('0x8')](_0x2acc('0x9'),_0x36fc6f,_0x2acc('0xa'));logger[_0x2acc('0xb')](_0x2acc('0xc'),_0x36fc6f,_0x2acc('0xa'),JSON[_0x2acc('0xd')](_0x4164f9));if(_0x4164f9[_0x2acc('0xe')]){if(_0x4164f9[_0x2acc('0xe')]['code']===0x1f4){logger[_0x2acc('0xe')](_0x2acc('0x9'),_0x36fc6f,_0x4164f9[_0x2acc('0xe')]['message']);return _0x4aff24(_0x4164f9[_0x2acc('0xe')][_0x2acc('0xf')]);}logger[_0x2acc('0xe')](_0x2acc('0x9'),_0x36fc6f,_0x4164f9['error'][_0x2acc('0xf')]);return _0x3c9e7f(_0x4164f9[_0x2acc('0xe')][_0x2acc('0xf')]);}else{logger[_0x2acc('0x8')](_0x2acc('0x9'),_0x36fc6f,_0x2acc('0xa'));_0x3c9e7f(_0x4164f9[_0x2acc('0x10')][_0x2acc('0xf')]);}})[_0x2acc('0x11')](function(_0x436e48){logger[_0x2acc('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x36fc6f,_0x436e48);_0x4aff24(_0x436e48);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index 5a406ed..92bd362 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 _0xc7e8=['exports','multer','connect-timeout','express','../../config/environment'];(function(_0x11c573,_0x9e7c6e){var _0x6b72de=function(_0x2e8a61){while(--_0x2e8a61){_0x11c573['push'](_0x11c573['shift']());}};_0x6b72de(++_0x9e7c6e);}(_0xc7e8,0x10f));var _0x8c7e=function(_0x4b91c4,_0x23f35f){_0x4b91c4=_0x4b91c4-0x0;var _0x25cb80=_0xc7e8[_0x4b91c4];return _0x25cb80;};'use strict';var multer=require(_0x8c7e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8c7e('0x1'));var express=require(_0x8c7e('0x2'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8c7e('0x3'));module[_0x8c7e('0x4')]=router; \ No newline at end of file +var _0x06eb=['connect-timeout','express','Router','../../components/interaction/service','../../config/environment','exports','multer','util','path'];(function(_0x52e68e,_0x309912){var _0x3211a4=function(_0x467c01){while(--_0x467c01){_0x52e68e['push'](_0x52e68e['shift']());}};_0x3211a4(++_0x309912);}(_0x06eb,0x1c8));var _0xb06e=function(_0x5aee55,_0x1f2203){_0x5aee55=_0x5aee55-0x0;var _0x3ef38f=_0x06eb[_0x5aee55];return _0x3ef38f;};'use strict';var multer=require(_0xb06e('0x0'));var util=require(_0xb06e('0x1'));var path=require(_0xb06e('0x2'));var timeout=require(_0xb06e('0x3'));var express=require(_0xb06e('0x4'));var router=express[_0xb06e('0x5')]();var auth=require('../../components/auth/service');var interaction=require(_0xb06e('0x6'));var config=require(_0xb06e('0x7'));module[_0xb06e('0x8')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index f4aa10b..70ab2ff 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 _0xe7a8=['sequelize','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface'];(function(_0x28741e,_0x488691){var _0x5b94bb=function(_0x18a6a8){while(--_0x18a6a8){_0x28741e['push'](_0x28741e['shift']());}};_0x5b94bb(++_0x488691);}(_0xe7a8,0x16d));var _0x8e7a=function(_0x3d3531,_0x1e4748){_0x3d3531=_0x3d3531-0x0;var _0x299781=_0xe7a8[_0x3d3531];return _0x299781;};'use strict';var Sequelize=require(_0x8e7a('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x8e7a('0x1')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0x8e7a('0x2')},'UserId':{'type':Sequelize['INTEGER'],'allowNull':![]},'queue_name':{'type':Sequelize[_0x8e7a('0x3')],'allowNull':![],'unique':_0x8e7a('0x4'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x8e7a('0x1')],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8e7a('0x4'),'comment':_0x8e7a('0x2')},'penalty':{'type':Sequelize[_0x8e7a('0x1')](0xb),'defaultValue':0x0,'comment':_0x8e7a('0x2')},'paused':{'type':Sequelize[_0x8e7a('0x1')](0xb),'defaultValue':0x0,'comment':_0x8e7a('0x2')}}; \ No newline at end of file +var _0x98a0=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x10d6cd,_0xd52be){var _0x3657e5=function(_0x37e281){while(--_0x37e281){_0x10d6cd['push'](_0x10d6cd['shift']());}};_0x3657e5(++_0xd52be);}(_0x98a0,0x1c5));var _0x098a=function(_0x50a35b,_0xea2c16){_0x50a35b=_0x50a35b-0x0;var _0x5c75dd=_0x98a0[_0x50a35b];return _0x5c75dd;};'use strict';var Sequelize=require(_0x098a('0x0'));module[_0x098a('0x1')]={'uniqueid':{'type':Sequelize[_0x098a('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x098a('0x3')},'membername':{'type':Sequelize[_0x098a('0x4')],'allowNull':![],'comment':_0x098a('0x3')},'UserId':{'type':Sequelize[_0x098a('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x098a('0x4')],'allowNull':![],'unique':_0x098a('0x5'),'comment':'Required\x20by\x20Asterisk'},'VoiceQueueId':{'type':Sequelize[_0x098a('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x098a('0x4')],'allowNull':![],'unique':'queue_interface','comment':_0x098a('0x3')},'penalty':{'type':Sequelize[_0x098a('0x2')](0xb),'defaultValue':0x0,'comment':_0x098a('0x3')},'paused':{'type':Sequelize['INTEGER'](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 06280f5..9e1bdfa 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 _0x85e7=['UserVoiceQueueRt','save','update','emit','hook','exports','events','../../mysqldb'];(function(_0x4b4d08,_0x2dd246){var _0x15cd66=function(_0x5b9915){while(--_0x5b9915){_0x4b4d08['push'](_0x4b4d08['shift']());}};_0x15cd66(++_0x2dd246);}(_0x85e7,0x1e6));var _0x785e=function(_0x178d6d,_0x54ad61){_0x178d6d=_0x178d6d-0x0;var _0xba0226=_0x85e7[_0x178d6d];return _0xba0226;};'use strict';var EventEmitter=require(_0x785e('0x0'));var UserVoiceQueueRt=require(_0x785e('0x1'))['db'][_0x785e('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x785e('0x3'),'afterUpdate':_0x785e('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5357a2){return function(_0x2e3204,_0x49de9c,_0x5a4bba){UserVoiceQueueRtEvents['emit'](_0x5357a2+':'+_0x2e3204['id'],_0x2e3204);UserVoiceQueueRtEvents[_0x785e('0x5')](_0x5357a2,_0x2e3204);_0x5a4bba(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0x785e('0x6')](e,emitEvent(event));}}module[_0x785e('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xc41a=['save','update','emit','hasOwnProperty','events','../../mysqldb','UserVoiceQueueRt','setMaxListeners'];(function(_0x26600e,_0x243088){var _0x5347f8=function(_0x21702c){while(--_0x21702c){_0x26600e['push'](_0x26600e['shift']());}};_0x5347f8(++_0x243088);}(_0xc41a,0x194));var _0xac41=function(_0x4a8996,_0x1ffa34){_0x4a8996=_0x4a8996-0x0;var _0x3baac1=_0xc41a[_0x4a8996];return _0x3baac1;};'use strict';var EventEmitter=require(_0xac41('0x0'));var UserVoiceQueueRt=require(_0xac41('0x1'))['db'][_0xac41('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xac41('0x3')](0x0);var events={'afterCreate':_0xac41('0x4'),'afterUpdate':_0xac41('0x5'),'afterDestroy':'remove'};function emitEvent(_0x4b2522){return function(_0x38e96f,_0x207c0e,_0x2c9a61){UserVoiceQueueRtEvents[_0xac41('0x6')](_0x4b2522+':'+_0x38e96f['id'],_0x38e96f);UserVoiceQueueRtEvents[_0xac41('0x6')](_0x4b2522,_0x38e96f);_0x2c9a61(null);};}for(var e in events){if(events[_0xac41('0x7')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module['exports']=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1c0499e..561d45b 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 _0x2b55=['../../config/environment','./userVoiceQueueRt.attributes','exports','user_has_voice_queues_rt','lodash','util','api','request-promise','path'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x2b55,0x1c6));var _0x52b5=function(_0xbe354d,_0x49ff69){_0xbe354d=_0xbe354d-0x0;var _0x4c2dfe=_0x2b55[_0xbe354d];return _0x4c2dfe;};'use strict';var _=require(_0x52b5('0x0'));var util=require(_0x52b5('0x1'));var logger=require('../../config/logger')(_0x52b5('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x52b5('0x3'));var fs=require('fs');var path=require(_0x52b5('0x4'));var rimraf=require('rimraf');var config=require(_0x52b5('0x5'));var attributes=require(_0x52b5('0x6'));module[_0x52b5('0x7')]=function(_0x4f363b,_0x2efbd7){return _0x4f363b['define']('UserVoiceQueueRt',attributes,{'tableName':_0x52b5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9689=['request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','user_has_voice_queues_rt','util','../../config/logger','api','moment','bluebird'];(function(_0x54ac2b,_0x51f6dd){var _0x5b1586=function(_0x11912d){while(--_0x11912d){_0x54ac2b['push'](_0x54ac2b['shift']());}};_0x5b1586(++_0x51f6dd);}(_0x9689,0x69));var _0x9968=function(_0xe3470f,_0x547dcb){_0xe3470f=_0xe3470f-0x0;var _0x5b7ee3=_0x9689[_0xe3470f];return _0x5b7ee3;};'use strict';var _=require('lodash');var util=require(_0x9968('0x0'));var logger=require(_0x9968('0x1'))(_0x9968('0x2'));var moment=require(_0x9968('0x3'));var BPromise=require(_0x9968('0x4'));var rp=require(_0x9968('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9968('0x6'));var config=require(_0x9968('0x7'));var attributes=require(_0x9968('0x8'));module['exports']=function(_0x440c75,_0x1eeaba){return _0x440c75['define']('UserVoiceQueueRt',attributes,{'tableName':_0x9968('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 a0e7548..cf2de56 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 _0xc791=['raw','where','sequelize','COUNT','literal','outboundQueuePauses','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','code','UserVoiceQueueRt,\x20%s,\x20%s','message','request\x20sent','result','catch','GetVoiceQueueRtPauses','findAll','options'];(function(_0x32a4cf,_0x515527){var _0x4f5f3f=function(_0x47196c){while(--_0x47196c){_0x32a4cf['push'](_0x32a4cf['shift']());}};_0x4f5f3f(++_0x515527);}(_0xc791,0x80));var _0x1c79=function(_0x5316d4,_0x3e273a){_0x5316d4=_0x5316d4-0x0;var _0x590f57=_0xc791[_0x5316d4];return _0x590f57;};'use strict';var _=require(_0x1c79('0x0'));var util=require(_0x1c79('0x1'));var moment=require(_0x1c79('0x2'));var BPromise=require(_0x1c79('0x3'));var rs=require(_0x1c79('0x4'));var fs=require('fs');var Redis=require(_0x1c79('0x5'));var db=require(_0x1c79('0x6'))['db'];var utils=require(_0x1c79('0x7'));var logger=require(_0x1c79('0x8'))(_0x1c79('0x9'));var config=require('../../config/environment');var jayson=require(_0x1c79('0xa'));var client=jayson[_0x1c79('0xb')][_0x1c79('0xc')]({'port':0x232a});config[_0x1c79('0xd')]=_[_0x1c79('0xe')](config[_0x1c79('0xd')],{'host':_0x1c79('0xf'),'port':0x18eb});var socket=require(_0x1c79('0x10'))(new Redis(config[_0x1c79('0xd')]));require(_0x1c79('0x11'))[_0x1c79('0x12')](socket);function respondWithRpcPromise(_0x4ddc8d,_0x465853,_0x6f7d5){return new BPromise(function(_0x1a98b6,_0x551c2c){return client['request'](_0x4ddc8d,_0x6f7d5)[_0x1c79('0x13')](function(_0x40ba77){logger[_0x1c79('0x14')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x465853,'request\x20sent');logger['debug'](_0x1c79('0x15'),_0x465853,'request\x20sent',JSON['stringify'](_0x40ba77));if(_0x40ba77['error']){if(_0x40ba77[_0x1c79('0x16')][_0x1c79('0x17')]===0x1f4){logger[_0x1c79('0x16')](_0x1c79('0x18'),_0x465853,_0x40ba77[_0x1c79('0x16')][_0x1c79('0x19')]);return _0x551c2c(_0x40ba77[_0x1c79('0x16')][_0x1c79('0x19')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x465853,_0x40ba77[_0x1c79('0x16')]['message']);return _0x1a98b6(_0x40ba77['error']['message']);}else{logger[_0x1c79('0x14')](_0x1c79('0x18'),_0x465853,_0x1c79('0x1a'));_0x1a98b6(_0x40ba77[_0x1c79('0x1b')][_0x1c79('0x19')]);}})[_0x1c79('0x1c')](function(_0x18bc8d){logger['error'](_0x1c79('0x18'),_0x465853,_0x18bc8d);_0x551c2c(_0x18bc8d);});});}exports[_0x1c79('0x1d')]=function(_0x495050){var _0x57ef58=this;return new Promise(function(_0x22a103,_0x58fd39){return db['UserVoiceQueueRt'][_0x1c79('0x1e')]({'raw':_0x495050[_0x1c79('0x1f')]?_0x495050[_0x1c79('0x1f')][_0x1c79('0x20')]===undefined?!![]:![]:!![],'where':_0x495050['options']?_0x495050['options'][_0x1c79('0x21')]||null:null,'attributes':[[db[_0x1c79('0x22')]['fn'](_0x1c79('0x23'),db['sequelize']['fn']('IF',db[_0x1c79('0x22')][_0x1c79('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x1c79('0x25')]]})[_0x1c79('0x13')](function(_0xde6cac){logger['info']('GetVoiceQueueRtPauses',_0x495050);logger[_0x1c79('0x26')](_0x1c79('0x1d'),_0x495050,JSON[_0x1c79('0x27')](_0xde6cac));_0x22a103(_0xde6cac);})[_0x1c79('0x1c')](function(_0x4d9d17){logger[_0x1c79('0x16')](_0x1c79('0x1d'),_0x4d9d17[_0x1c79('0x19')],_0x495050);_0x58fd39(_0x57ef58['error'](0x1f4,_0x4d9d17['message']));});});}; \ No newline at end of file +var _0x7a68=['code','error','message','result','catch','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','sequelize','COUNT','literal','outboundQueuePauses','debug','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x12c562,_0x4a15a9){var _0x184d9c=function(_0x2d5b73){while(--_0x2d5b73){_0x12c562['push'](_0x12c562['shift']());}};_0x184d9c(++_0x4a15a9);}(_0x7a68,0x84));var _0x87a6=function(_0x14bd60,_0x73b2f9){_0x14bd60=_0x14bd60-0x0;var _0x4b0a31=_0x7a68[_0x14bd60];return _0x4b0a31;};'use strict';var _=require(_0x87a6('0x0'));var util=require(_0x87a6('0x1'));var moment=require(_0x87a6('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x87a6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x87a6('0x4'));var logger=require(_0x87a6('0x5'))(_0x87a6('0x6'));var config=require(_0x87a6('0x7'));var jayson=require(_0x87a6('0x8'));var client=jayson[_0x87a6('0x9')][_0x87a6('0xa')]({'port':0x232a});config[_0x87a6('0xb')]=_[_0x87a6('0xc')](config['redis'],{'host':_0x87a6('0xd'),'port':0x18eb});var socket=require(_0x87a6('0xe'))(new Redis(config[_0x87a6('0xb')]));require(_0x87a6('0xf'))[_0x87a6('0x10')](socket);function respondWithRpcPromise(_0x32ca78,_0x155f4a,_0xed7758){return new BPromise(function(_0x225c20,_0x17eb94){return client[_0x87a6('0x11')](_0x32ca78,_0xed7758)[_0x87a6('0x12')](function(_0x42c10f){logger[_0x87a6('0x13')](_0x87a6('0x14'),_0x155f4a,_0x87a6('0x15'));logger['debug'](_0x87a6('0x16'),_0x155f4a,_0x87a6('0x15'),JSON[_0x87a6('0x17')](_0x42c10f));if(_0x42c10f['error']){if(_0x42c10f['error'][_0x87a6('0x18')]===0x1f4){logger[_0x87a6('0x19')](_0x87a6('0x14'),_0x155f4a,_0x42c10f[_0x87a6('0x19')][_0x87a6('0x1a')]);return _0x17eb94(_0x42c10f['error'][_0x87a6('0x1a')]);}logger[_0x87a6('0x19')](_0x87a6('0x14'),_0x155f4a,_0x42c10f[_0x87a6('0x19')][_0x87a6('0x1a')]);return _0x225c20(_0x42c10f[_0x87a6('0x19')]['message']);}else{logger[_0x87a6('0x13')](_0x87a6('0x14'),_0x155f4a,'request\x20sent');_0x225c20(_0x42c10f[_0x87a6('0x1b')][_0x87a6('0x1a')]);}})[_0x87a6('0x1c')](function(_0x4dae0e){logger['error'](_0x87a6('0x14'),_0x155f4a,_0x4dae0e);_0x17eb94(_0x4dae0e);});});}exports[_0x87a6('0x1d')]=function(_0x1ca466){var _0x11a84d=this;return new Promise(function(_0x372493,_0x583720){return db[_0x87a6('0x1e')][_0x87a6('0x1f')]({'raw':_0x1ca466['options']?_0x1ca466[_0x87a6('0x20')][_0x87a6('0x21')]===undefined?!![]:![]:!![],'where':_0x1ca466[_0x87a6('0x20')]?_0x1ca466['options']['where']||null:null,'attributes':[[db[_0x87a6('0x22')]['fn'](_0x87a6('0x23'),db[_0x87a6('0x22')]['fn']('IF',db[_0x87a6('0x22')][_0x87a6('0x24')]('`paused`\x20=\x201,\x201,\x20null'))),_0x87a6('0x25')]]})[_0x87a6('0x12')](function(_0xd7dd88){logger[_0x87a6('0x13')](_0x87a6('0x1d'),_0x1ca466);logger[_0x87a6('0x26')]('GetVoiceQueueRtPauses',_0x1ca466,JSON[_0x87a6('0x17')](_0xd7dd88));_0x372493(_0xd7dd88);})[_0x87a6('0x1c')](function(_0x2d4a84){logger[_0x87a6('0x19')]('GetVoiceQueueRtPauses',_0x2d4a84['message'],_0x1ca466);_0x583720(_0x11a84d['error'](0x1f4,_0x2d4a84['message']));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index f79d520..9d7ed04 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 _0x8f80=['removeListener','register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','update','emit'];(function(_0x25c8aa,_0x25ee75){var _0x47b440=function(_0x40b0f0){while(--_0x40b0f0){_0x25c8aa['push'](_0x25c8aa['shift']());}};_0x47b440(++_0x25ee75);}(_0x8f80,0x187));var _0x08f8=function(_0x57d534,_0x3a2041){_0x57d534=_0x57d534-0x0;var _0xdac558=_0x8f80[_0x57d534];return _0xdac558;};'use strict';var UserVoiceQueueRtEvents=require(_0x08f8('0x0'));var events=[_0x08f8('0x1'),_0x08f8('0x2'),_0x08f8('0x3')];function createListener(_0x439bbe,_0x5e5ffa){return function(_0x270d99){_0x5e5ffa[_0x08f8('0x4')](_0x439bbe,_0x270d99);};}function removeListener(_0x1ed3df,_0x2e6a0e){return function(){UserVoiceQueueRtEvents[_0x08f8('0x5')](_0x1ed3df,_0x2e6a0e);};}exports[_0x08f8('0x6')]=function(_0x400638){for(var _0x1c45f4=0x0,_0xe242c0=events[_0x08f8('0x7')];_0x1c45f4<_0xe242c0;_0x1c45f4++){var _0x2f205b=events[_0x1c45f4];var _0x3350d1=createListener(_0x08f8('0x8')+_0x2f205b,_0x400638);UserVoiceQueueRtEvents['on'](_0x2f205b,_0x3350d1);}}; \ No newline at end of file +var _0x9e94=['length','userVoiceQueueRt:','./userVoiceQueueRt.events','update','emit','removeListener','register'];(function(_0x307430,_0x5e8161){var _0x16b75a=function(_0x2dd25e){while(--_0x2dd25e){_0x307430['push'](_0x307430['shift']());}};_0x16b75a(++_0x5e8161);}(_0x9e94,0x12f));var _0x49e9=function(_0x10e6b4,_0xd89b9b){_0x10e6b4=_0x10e6b4-0x0;var _0x1c69c4=_0x9e94[_0x10e6b4];return _0x1c69c4;};'use strict';var UserVoiceQueueRtEvents=require(_0x49e9('0x0'));var events=['save','remove',_0x49e9('0x1')];function createListener(_0x1f258f,_0x645191){return function(_0x20d42e){_0x645191[_0x49e9('0x2')](_0x1f258f,_0x20d42e);};}function removeListener(_0x2da599,_0x53bf3d){return function(){UserVoiceQueueRtEvents[_0x49e9('0x3')](_0x2da599,_0x53bf3d);};}exports[_0x49e9('0x4')]=function(_0x4d031d){for(var _0x4ababa=0x0,_0x24a402=events[_0x49e9('0x5')];_0x4ababa<_0x24a402;_0x4ababa++){var _0x1dc065=events[_0x4ababa];var _0x243b74=createListener(_0x49e9('0x6')+_0x1dc065,_0x4d031d);UserVoiceQueueRtEvents['on'](_0x1dc065,_0x243b74);}}; \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index d4148fb..40507e0 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 _0x50a5=['../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','get','isAuthenticated','index','post','create','put','/:id','exports','multer','util','path','express','Router'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x50a5,0x1e8));var _0x550a=function(_0x34e59f,_0x549173){_0x34e59f=_0x34e59f-0x0;var _0x42461f=_0x50a5[_0x34e59f];return _0x42461f;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require(_0x550a('0x2'));var timeout=require('connect-timeout');var express=require(_0x550a('0x3'));var router=express[_0x550a('0x4')]();var auth=require(_0x550a('0x5'));var interaction=require(_0x550a('0x6'));var config=require(_0x550a('0x7'));var controller=require(_0x550a('0x8'));router[_0x550a('0x9')]('/',auth[_0x550a('0xa')](),controller[_0x550a('0xb')]);router['get']('/:id',auth[_0x550a('0xa')](),controller['show']);router[_0x550a('0xc')]('/',auth[_0x550a('0xa')](),controller[_0x550a('0xd')]);router[_0x550a('0xe')](_0x550a('0xf'),auth[_0x550a('0xa')](),controller['update']);router['delete'](_0x550a('0xf'),auth[_0x550a('0xa')](),controller['destroy']);module[_0x550a('0x10')]=router; \ No newline at end of file +var _0x4b32=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','index','get','/:id','isAuthenticated','show','create','put','destroy','exports','multer','connect-timeout','express'];(function(_0x5163c7,_0x5e4498){var _0x41c36f=function(_0x13f33d){while(--_0x13f33d){_0x5163c7['push'](_0x5163c7['shift']());}};_0x41c36f(++_0x5e4498);}(_0x4b32,0x96));var _0x24b3=function(_0x3397b4,_0x477b27){_0x3397b4=_0x3397b4-0x0;var _0x5717c7=_0x4b32[_0x3397b4];return _0x5717c7;};'use strict';var multer=require(_0x24b3('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x24b3('0x1'));var express=require(_0x24b3('0x2'));var router=express[_0x24b3('0x3')]();var auth=require(_0x24b3('0x4'));var interaction=require(_0x24b3('0x5'));var config=require(_0x24b3('0x6'));var controller=require(_0x24b3('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x24b3('0x8')]);router[_0x24b3('0x9')](_0x24b3('0xa'),auth[_0x24b3('0xb')](),controller[_0x24b3('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x24b3('0xd')]);router[_0x24b3('0xe')](_0x24b3('0xa'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x24b3('0xa'),auth[_0x24b3('0xb')](),controller[_0x24b3('0xf')]);module[_0x24b3('0x10')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index 7f9bbc4..8341542 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 _0xcacf=['STRING','name','sequelize'];(function(_0x11f9fe,_0x5e3648){var _0x291b9e=function(_0x3413b1){while(--_0x3413b1){_0x11f9fe['push'](_0x11f9fe['shift']());}};_0x291b9e(++_0x5e3648);}(_0xcacf,0x134));var _0xfcac=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xcacf[_0x134c2e];return _0x2825db;};'use strict';var Sequelize=require(_0xfcac('0x0'));module['exports']={'name':{'type':Sequelize[_0xfcac('0x1')],'unique':_0xfcac('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xfcac('0x1')]}}; \ No newline at end of file +var _0xa614=['name','sequelize'];(function(_0x554091,_0x3905ed){var _0x1d4809=function(_0x5ba5fe){while(--_0x5ba5fe){_0x554091['push'](_0x554091['shift']());}};_0x1d4809(++_0x3905ed);}(_0xa614,0xd3));var _0x4a61=function(_0x310a1b,_0x4c9129){_0x310a1b=_0x310a1b-0x0;var _0xdea206=_0xa614[_0x310a1b];return _0xdea206;};'use strict';var Sequelize=require(_0x4a61('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x4a61('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index d1f52a9..5087995 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 _0x1a8f=['../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','get','Variables','UserProfileResource','stack','name','send','map','Variable','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','sox','to-csv','ejs','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x3ea386,_0x4b45f3){var _0x4114e8=function(_0x53c514){while(--_0x53c514){_0x3ea386['push'](_0x3ea386['shift']());}};_0x4114e8(++_0x4b45f3);}(_0x1a8f,0x87));var _0xf1a8=function(_0x50514b,_0x83db65){_0x50514b=_0x50514b-0x0;var _0x5d8587=_0x1a8f[_0x50514b];return _0x5d8587;};'use strict';var pdf=require(_0xf1a8('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf1a8('0x1'));var zipdir=require(_0xf1a8('0x2'));var jsonpatch=require(_0xf1a8('0x3'));var rp=require(_0xf1a8('0x4'));var moment=require(_0xf1a8('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xf1a8('0x6'));var csv=require(_0xf1a8('0x7'));var ejs=require(_0xf1a8('0x8'));var fs=require('fs');var _=require('lodash');var squel=require(_0xf1a8('0x9'));var crypto=require('crypto');var jsforce=require(_0xf1a8('0xa'));var deskjs=require(_0xf1a8('0xb'));var toCsv=require(_0xf1a8('0x7'));var querystring=require('querystring');var Papa=require(_0xf1a8('0xc'));var Redis=require('ioredis');var authService=require(_0xf1a8('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0xf1a8('0xe'));var hardwareService=require(_0xf1a8('0xf'));var logger=require(_0xf1a8('0x10'))(_0xf1a8('0x11'));var utils=require('../../config/utils');var config=require(_0xf1a8('0x12'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x250103,_0x482274){_0x482274=_0x482274||0xcc;return function(_0x3aef2b){if(_0x3aef2b){return _0x250103[_0xf1a8('0x13')](_0x482274);}return _0x250103[_0xf1a8('0x14')](_0x482274)[_0xf1a8('0x15')]();};}function respondWithResult(_0x2d0965,_0x292f03){_0x292f03=_0x292f03||0xc8;return function(_0x4fbba7){if(_0x4fbba7){return _0x2d0965[_0xf1a8('0x14')](_0x292f03)[_0xf1a8('0x16')](_0x4fbba7);}};}function respondWithFilteredResult(_0x5854c5,_0xd9c1bf){return function(_0x3efcf1){if(_0x3efcf1){var _0x18533d=_0x3efcf1[_0xf1a8('0x17')],_0x65d930=_0xd9c1bf[_0xf1a8('0x18')],_0x7c2937=_0xd9c1bf[_0xf1a8('0x18')]+_0xd9c1bf[_0xf1a8('0x19')],_0x2280f2;if(_0x7c2937>=_0x18533d){_0x7c2937=_0x18533d;_0x2280f2=0xc8;}else{_0x2280f2=0xce;}_0x5854c5[_0xf1a8('0x14')](_0x2280f2);return _0x5854c5[_0xf1a8('0x1a')](_0xf1a8('0x1b'),_0x65d930+'-'+_0x7c2937+'/'+_0x18533d)['json'](_0x3efcf1);}return null;};}function patchUpdates(_0x159d9d){return function(_0x35a6f3){try{jsonpatch[_0xf1a8('0x1c')](_0x35a6f3,_0x159d9d,!![]);}catch(_0x22420e){return BPromise[_0xf1a8('0x1d')](_0x22420e);}return _0x35a6f3['save']();};}function saveUpdates(_0xd2839,_0x5a558a){return function(_0x1205bb){if(_0x1205bb){return _0x1205bb[_0xf1a8('0x1e')](_0xd2839)[_0xf1a8('0x1f')](function(_0x366b72){return _0x366b72;});}return null;};}function removeEntity(_0x32ada6,_0x1b0fc0){return function(_0x40bf24){if(_0x40bf24){return _0x40bf24[_0xf1a8('0x20')]()['then'](function(){var _0x3a284c=_0x40bf24[_0xf1a8('0x21')]({'plain':!![]});var _0x1fa221=_0xf1a8('0x22');return db[_0xf1a8('0x23')]['destroy']({'where':{'type':_0x1fa221,'resourceId':_0x3a284c['id']}})[_0xf1a8('0x1f')](function(){return _0x40bf24;});})[_0xf1a8('0x1f')](function(){_0x32ada6[_0xf1a8('0x14')](0xcc)[_0xf1a8('0x15')]();});}};}function handleEntityNotFound(_0x4b90a5,_0x2db901){return function(_0x4f843d){if(!_0x4f843d){_0x4b90a5[_0xf1a8('0x13')](0x194);}return _0x4f843d;};}function handleError(_0xd75dfb,_0x2903c8){_0x2903c8=_0x2903c8||0x1f4;return function(_0x5ef78e){logger['error'](_0x5ef78e[_0xf1a8('0x24')]);if(_0x5ef78e[_0xf1a8('0x25')]){delete _0x5ef78e[_0xf1a8('0x25')];}_0xd75dfb['status'](_0x2903c8)[_0xf1a8('0x26')](_0x5ef78e);};}exports['index']=function(_0x1424bc,_0x1acbba){var _0x566154={},_0xe6e6e3={},_0x4cf9f1={'count':0x0,'rows':[]};var _0x504563=_[_0xf1a8('0x27')](db[_0xf1a8('0x28')][_0xf1a8('0x29')],function(_0x5f3f5d){return{'name':_0x5f3f5d[_0xf1a8('0x2a')],'type':_0x5f3f5d[_0xf1a8('0x2b')][_0xf1a8('0x2c')]};});_0xe6e6e3['model']=_[_0xf1a8('0x27')](_0x504563,_0xf1a8('0x25'));_0xe6e6e3[_0xf1a8('0x2d')]=_[_0xf1a8('0x2e')](_0x1424bc[_0xf1a8('0x2d')]);_0xe6e6e3[_0xf1a8('0x2f')]=_[_0xf1a8('0x30')](_0xe6e6e3[_0xf1a8('0x31')],_0xe6e6e3[_0xf1a8('0x2d')]);_0x566154[_0xf1a8('0x32')]=_['intersection'](_0xe6e6e3[_0xf1a8('0x31')],qs[_0xf1a8('0x33')](_0x1424bc[_0xf1a8('0x2d')]['fields']));_0x566154['attributes']=_0x566154[_0xf1a8('0x32')][_0xf1a8('0x34')]?_0x566154[_0xf1a8('0x32')]:_0xe6e6e3[_0xf1a8('0x31')];if(!_0x1424bc[_0xf1a8('0x2d')]['hasOwnProperty'](_0xf1a8('0x35'))){_0x566154['limit']=qs[_0xf1a8('0x19')](_0x1424bc[_0xf1a8('0x2d')]['limit']);_0x566154[_0xf1a8('0x18')]=qs[_0xf1a8('0x18')](_0x1424bc[_0xf1a8('0x2d')][_0xf1a8('0x18')]);}_0x566154[_0xf1a8('0x36')]=qs[_0xf1a8('0x37')](_0x1424bc['query'][_0xf1a8('0x37')]);_0x566154[_0xf1a8('0x38')]=qs[_0xf1a8('0x2f')](_['pick'](_0x1424bc[_0xf1a8('0x2d')],_0xe6e6e3[_0xf1a8('0x2f')]));if(_0x1424bc['query'][_0xf1a8('0x39')]){_0x566154[_0xf1a8('0x38')]=_['merge'](_0x566154[_0xf1a8('0x38')],{'$or':_[_0xf1a8('0x27')](_0x504563,function(_0x5e0af1){if(_0x5e0af1[_0xf1a8('0x2b')]!==_0xf1a8('0x3a')){var _0x1be9cf={};_0x1be9cf[_0x5e0af1[_0xf1a8('0x25')]]={'$like':'%'+_0x1424bc['query'][_0xf1a8('0x39')]+'%'};return _0x1be9cf;}})});}_0x566154=_[_0xf1a8('0x3b')]({},_0x566154,_0x1424bc['options']);var _0x19e767={'where':_0x566154['where']};return db[_0xf1a8('0x28')][_0xf1a8('0x17')](_0x19e767)['then'](function(_0x109271){_0x4cf9f1[_0xf1a8('0x17')]=_0x109271;if(_0x1424bc[_0xf1a8('0x2d')][_0xf1a8('0x3c')]){_0x566154[_0xf1a8('0x3d')]=[{'all':!![]}];}return db[_0xf1a8('0x28')]['findAll'](_0x566154);})[_0xf1a8('0x1f')](function(_0x48e8ca){_0x4cf9f1[_0xf1a8('0x3e')]=_0x48e8ca;return _0x4cf9f1;})[_0xf1a8('0x1f')](respondWithFilteredResult(_0x1acbba,_0x566154))[_0xf1a8('0x3f')](handleError(_0x1acbba,null));};exports['show']=function(_0x159a9c,_0x127328){var _0x3d2769={'raw':!![],'where':{'id':_0x159a9c[_0xf1a8('0x40')]['id']}},_0x3796e6={};_0x3796e6[_0xf1a8('0x31')]=_['keys'](db[_0xf1a8('0x28')]['rawAttributes']);_0x3796e6[_0xf1a8('0x2d')]=_[_0xf1a8('0x2e')](_0x159a9c[_0xf1a8('0x2d')]);_0x3796e6[_0xf1a8('0x2f')]=_[_0xf1a8('0x30')](_0x3796e6[_0xf1a8('0x31')],_0x3796e6[_0xf1a8('0x2d')]);_0x3d2769[_0xf1a8('0x32')]=_[_0xf1a8('0x30')](_0x3796e6[_0xf1a8('0x31')],qs[_0xf1a8('0x33')](_0x159a9c[_0xf1a8('0x2d')][_0xf1a8('0x33')]));_0x3d2769[_0xf1a8('0x32')]=_0x3d2769[_0xf1a8('0x32')][_0xf1a8('0x34')]?_0x3d2769[_0xf1a8('0x32')]:_0x3796e6[_0xf1a8('0x31')];if(_0x159a9c[_0xf1a8('0x2d')]['includeAll']){_0x3d2769[_0xf1a8('0x3d')]=[{'all':!![]}];}_0x3d2769=_['merge']({},_0x3d2769,_0x159a9c[_0xf1a8('0x41')]);return db[_0xf1a8('0x28')][_0xf1a8('0x42')](_0x3d2769)[_0xf1a8('0x1f')](handleEntityNotFound(_0x127328,null))['then'](respondWithResult(_0x127328,null))[_0xf1a8('0x3f')](handleError(_0x127328,null));};exports[_0xf1a8('0x43')]=function(_0x2da253,_0x4bb994){return db[_0xf1a8('0x28')][_0xf1a8('0x43')](_0x2da253[_0xf1a8('0x44')],{})[_0xf1a8('0x1f')](function(_0x44c330){var _0xf69e59=_0x2da253[_0xf1a8('0x45')][_0xf1a8('0x21')]({'plain':!![]});if(!_0xf69e59)throw new Error(_0xf1a8('0x46'));if(_0xf69e59[_0xf1a8('0x47')]==='user'){var _0x3b4e06=_0x44c330[_0xf1a8('0x21')]({'plain':!![]});var _0x4c2da3=_0xf1a8('0x22');return db[_0xf1a8('0x48')][_0xf1a8('0x42')]({'where':{'name':_0x4c2da3,'userProfileId':_0xf69e59[_0xf1a8('0x49')]},'raw':!![]})[_0xf1a8('0x1f')](function(_0xdc48ee){if(_0xdc48ee&&_0xdc48ee[_0xf1a8('0x4a')]===0x0){return db[_0xf1a8('0x23')][_0xf1a8('0x43')]({'name':_0x3b4e06['name'],'resourceId':_0x3b4e06['id'],'type':_0xdc48ee[_0xf1a8('0x25')],'sectionId':_0xdc48ee['id']},{})[_0xf1a8('0x1f')](function(){return _0x44c330;});}else{return _0x44c330;}})[_0xf1a8('0x3f')](function(_0x4ea297){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4ea297);throw _0x4ea297;});}return _0x44c330;})['then'](respondWithResult(_0x4bb994,0xc9))[_0xf1a8('0x3f')](handleError(_0x4bb994,null));};exports[_0xf1a8('0x1e')]=function(_0x257ca9,_0x1c677f){if(_0x257ca9[_0xf1a8('0x44')]['id']){delete _0x257ca9[_0xf1a8('0x44')]['id'];}return db[_0xf1a8('0x28')][_0xf1a8('0x42')]({'where':{'id':_0x257ca9[_0xf1a8('0x40')]['id']}})['then'](handleEntityNotFound(_0x1c677f,null))[_0xf1a8('0x1f')](saveUpdates(_0x257ca9[_0xf1a8('0x44')],null))['then'](respondWithResult(_0x1c677f,null))[_0xf1a8('0x3f')](handleError(_0x1c677f,null));};exports['destroy']=function(_0xb4f2e,_0x12e667){return db['Variable'][_0xf1a8('0x42')]({'where':{'id':_0xb4f2e[_0xf1a8('0x40')]['id']}})[_0xf1a8('0x1f')](handleEntityNotFound(_0x12e667,null))['then'](removeEntity(_0x12e667,null))['catch'](handleError(_0x12e667,null));}; \ No newline at end of file +var _0x96c1=['user','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','Variables','UserProfileResource','error','stack','name','send','index','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','params','Variable','keys','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1daa21,_0x346bb2){var _0x1e32e7=function(_0x5320cf){while(--_0x5320cf){_0x1daa21['push'](_0x1daa21['shift']());}};_0x1e32e7(++_0x346bb2);}(_0x96c1,0x1bd));var _0x196c=function(_0x4fcaa0,_0xcb1d8b){_0x4fcaa0=_0x4fcaa0-0x0;var _0x489a68=_0x96c1[_0x4fcaa0];return _0x489a68;};'use strict';var pdf=require(_0x196c('0x0'));var emlformat=require(_0x196c('0x1'));var rimraf=require(_0x196c('0x2'));var zipdir=require(_0x196c('0x3'));var jsonpatch=require(_0x196c('0x4'));var rp=require(_0x196c('0x5'));var moment=require(_0x196c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x196c('0x7'));var util=require(_0x196c('0x8'));var path=require(_0x196c('0x9'));var sox=require(_0x196c('0xa'));var csv=require(_0x196c('0xb'));var ejs=require(_0x196c('0xc'));var fs=require('fs');var _=require(_0x196c('0xd'));var squel=require(_0x196c('0xe'));var crypto=require(_0x196c('0xf'));var jsforce=require(_0x196c('0x10'));var deskjs=require(_0x196c('0x11'));var toCsv=require(_0x196c('0xb'));var querystring=require(_0x196c('0x12'));var Papa=require(_0x196c('0x13'));var Redis=require(_0x196c('0x14'));var authService=require(_0x196c('0x15'));var qs=require(_0x196c('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x196c('0x17'))(_0x196c('0x18'));var utils=require(_0x196c('0x19'));var config=require(_0x196c('0x1a'));var db=require(_0x196c('0x1b'))['db'];function respondWithStatusCode(_0x3133d7,_0x495fc3){_0x495fc3=_0x495fc3||0xcc;return function(_0x202657){if(_0x202657){return _0x3133d7[_0x196c('0x1c')](_0x495fc3);}return _0x3133d7[_0x196c('0x1d')](_0x495fc3)[_0x196c('0x1e')]();};}function respondWithResult(_0x3d30f7,_0x4e4080){_0x4e4080=_0x4e4080||0xc8;return function(_0x48839c){if(_0x48839c){return _0x3d30f7[_0x196c('0x1d')](_0x4e4080)[_0x196c('0x1f')](_0x48839c);}};}function respondWithFilteredResult(_0x5243e4,_0x5a1848){return function(_0x56db05){if(_0x56db05){var _0x4122f8=_0x56db05['count'],_0x307416=_0x5a1848[_0x196c('0x20')],_0x5c0b4e=_0x5a1848['offset']+_0x5a1848[_0x196c('0x21')],_0x149519;if(_0x5c0b4e>=_0x4122f8){_0x5c0b4e=_0x4122f8;_0x149519=0xc8;}else{_0x149519=0xce;}_0x5243e4['status'](_0x149519);return _0x5243e4[_0x196c('0x22')](_0x196c('0x23'),_0x307416+'-'+_0x5c0b4e+'/'+_0x4122f8)['json'](_0x56db05);}return null;};}function patchUpdates(_0x5ef4ef){return function(_0x2cb514){try{jsonpatch[_0x196c('0x24')](_0x2cb514,_0x5ef4ef,!![]);}catch(_0x42ce12){return BPromise[_0x196c('0x25')](_0x42ce12);}return _0x2cb514[_0x196c('0x26')]();};}function saveUpdates(_0x589f4e,_0x3e9902){return function(_0x16c8d8){if(_0x16c8d8){return _0x16c8d8[_0x196c('0x27')](_0x589f4e)[_0x196c('0x28')](function(_0x2c1a03){return _0x2c1a03;});}return null;};}function removeEntity(_0x50d99e,_0x5ab980){return function(_0x434816){if(_0x434816){return _0x434816[_0x196c('0x29')]()[_0x196c('0x28')](function(){var _0x5050d2=_0x434816[_0x196c('0x2a')]({'plain':!![]});var _0x12d16b=_0x196c('0x2b');return db[_0x196c('0x2c')][_0x196c('0x29')]({'where':{'type':_0x12d16b,'resourceId':_0x5050d2['id']}})[_0x196c('0x28')](function(){return _0x434816;});})[_0x196c('0x28')](function(){_0x50d99e[_0x196c('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x18c780,_0xb9234a){return function(_0xfb779e){if(!_0xfb779e){_0x18c780['sendStatus'](0x194);}return _0xfb779e;};}function handleError(_0x3bbd0f,_0x2dd102){_0x2dd102=_0x2dd102||0x1f4;return function(_0x257b9f){logger[_0x196c('0x2d')](_0x257b9f[_0x196c('0x2e')]);if(_0x257b9f[_0x196c('0x2f')]){delete _0x257b9f['name'];}_0x3bbd0f[_0x196c('0x1d')](_0x2dd102)[_0x196c('0x30')](_0x257b9f);};}exports[_0x196c('0x31')]=function(_0xfa0c28,_0x5e8ea2){var _0x176265={},_0x238771={},_0x196e51={'count':0x0,'rows':[]};var _0x37a81f=_['map'](db['Variable']['rawAttributes'],function(_0x320451){return{'name':_0x320451[_0x196c('0x32')],'type':_0x320451['type'][_0x196c('0x33')]};});_0x238771[_0x196c('0x34')]=_[_0x196c('0x35')](_0x37a81f,_0x196c('0x2f'));_0x238771[_0x196c('0x36')]=_['keys'](_0xfa0c28[_0x196c('0x36')]);_0x238771[_0x196c('0x37')]=_[_0x196c('0x38')](_0x238771[_0x196c('0x34')],_0x238771[_0x196c('0x36')]);_0x176265[_0x196c('0x39')]=_[_0x196c('0x38')](_0x238771['model'],qs[_0x196c('0x3a')](_0xfa0c28[_0x196c('0x36')][_0x196c('0x3a')]));_0x176265[_0x196c('0x39')]=_0x176265[_0x196c('0x39')][_0x196c('0x3b')]?_0x176265[_0x196c('0x39')]:_0x238771['model'];if(!_0xfa0c28[_0x196c('0x36')][_0x196c('0x3c')]('nolimit')){_0x176265[_0x196c('0x21')]=qs['limit'](_0xfa0c28[_0x196c('0x36')]['limit']);_0x176265[_0x196c('0x20')]=qs[_0x196c('0x20')](_0xfa0c28[_0x196c('0x36')]['offset']);}_0x176265[_0x196c('0x3d')]=qs[_0x196c('0x3e')](_0xfa0c28['query'][_0x196c('0x3e')]);_0x176265['where']=qs['filters'](_[_0x196c('0x3f')](_0xfa0c28['query'],_0x238771['filters']));if(_0xfa0c28[_0x196c('0x36')][_0x196c('0x40')]){_0x176265['where']=_['merge'](_0x176265[_0x196c('0x41')],{'$or':_[_0x196c('0x35')](_0x37a81f,function(_0x29d50c){if(_0x29d50c['type']!==_0x196c('0x42')){var _0x3cd974={};_0x3cd974[_0x29d50c[_0x196c('0x2f')]]={'$like':'%'+_0xfa0c28['query'][_0x196c('0x40')]+'%'};return _0x3cd974;}})});}_0x176265=_[_0x196c('0x43')]({},_0x176265,_0xfa0c28[_0x196c('0x44')]);var _0x559fc8={'where':_0x176265[_0x196c('0x41')]};return db['Variable'][_0x196c('0x45')](_0x559fc8)[_0x196c('0x28')](function(_0x3179b5){_0x196e51[_0x196c('0x45')]=_0x3179b5;if(_0xfa0c28[_0x196c('0x36')][_0x196c('0x46')]){_0x176265[_0x196c('0x47')]=[{'all':!![]}];}return db['Variable'][_0x196c('0x48')](_0x176265);})[_0x196c('0x28')](function(_0x3ee439){_0x196e51[_0x196c('0x49')]=_0x3ee439;return _0x196e51;})['then'](respondWithFilteredResult(_0x5e8ea2,_0x176265))[_0x196c('0x4a')](handleError(_0x5e8ea2,null));};exports[_0x196c('0x4b')]=function(_0x101083,_0x5efec7){var _0x4a2bb8={'raw':!![],'where':{'id':_0x101083[_0x196c('0x4c')]['id']}},_0x3757ee={};_0x3757ee[_0x196c('0x34')]=_['keys'](db[_0x196c('0x4d')]['rawAttributes']);_0x3757ee[_0x196c('0x36')]=_[_0x196c('0x4e')](_0x101083[_0x196c('0x36')]);_0x3757ee[_0x196c('0x37')]=_[_0x196c('0x38')](_0x3757ee[_0x196c('0x34')],_0x3757ee[_0x196c('0x36')]);_0x4a2bb8[_0x196c('0x39')]=_[_0x196c('0x38')](_0x3757ee[_0x196c('0x34')],qs['fields'](_0x101083[_0x196c('0x36')][_0x196c('0x3a')]));_0x4a2bb8[_0x196c('0x39')]=_0x4a2bb8[_0x196c('0x39')][_0x196c('0x3b')]?_0x4a2bb8[_0x196c('0x39')]:_0x3757ee[_0x196c('0x34')];if(_0x101083[_0x196c('0x36')][_0x196c('0x46')]){_0x4a2bb8[_0x196c('0x47')]=[{'all':!![]}];}_0x4a2bb8=_[_0x196c('0x43')]({},_0x4a2bb8,_0x101083['options']);return db[_0x196c('0x4d')]['find'](_0x4a2bb8)['then'](handleEntityNotFound(_0x5efec7,null))[_0x196c('0x28')](respondWithResult(_0x5efec7,null))[_0x196c('0x4a')](handleError(_0x5efec7,null));};exports[_0x196c('0x4f')]=function(_0x2873b1,_0xa917a5){return db[_0x196c('0x4d')]['create'](_0x2873b1[_0x196c('0x50')],{})['then'](function(_0x746197){var _0x23d4ec=_0x2873b1['user'][_0x196c('0x2a')]({'plain':!![]});if(!_0x23d4ec)throw new Error(_0x196c('0x51'));if(_0x23d4ec[_0x196c('0x52')]===_0x196c('0x53')){var _0x163c87=_0x746197[_0x196c('0x2a')]({'plain':!![]});var _0x15aa4b='Variables';return db[_0x196c('0x54')][_0x196c('0x55')]({'where':{'name':_0x15aa4b,'userProfileId':_0x23d4ec['userProfileId']},'raw':!![]})['then'](function(_0x22fe85){if(_0x22fe85&&_0x22fe85[_0x196c('0x56')]===0x0){return db[_0x196c('0x2c')]['create']({'name':_0x163c87[_0x196c('0x2f')],'resourceId':_0x163c87['id'],'type':_0x22fe85[_0x196c('0x2f')],'sectionId':_0x22fe85['id']},{})['then'](function(){return _0x746197;});}else{return _0x746197;}})[_0x196c('0x4a')](function(_0x153671){logger[_0x196c('0x2d')](_0x196c('0x57'),_0x153671);throw _0x153671;});}return _0x746197;})[_0x196c('0x28')](respondWithResult(_0xa917a5,0xc9))[_0x196c('0x4a')](handleError(_0xa917a5,null));};exports[_0x196c('0x27')]=function(_0x290982,_0x50ab80){if(_0x290982[_0x196c('0x50')]['id']){delete _0x290982[_0x196c('0x50')]['id'];}return db[_0x196c('0x4d')][_0x196c('0x55')]({'where':{'id':_0x290982[_0x196c('0x4c')]['id']}})[_0x196c('0x28')](handleEntityNotFound(_0x50ab80,null))[_0x196c('0x28')](saveUpdates(_0x290982['body'],null))['then'](respondWithResult(_0x50ab80,null))[_0x196c('0x4a')](handleError(_0x50ab80,null));};exports[_0x196c('0x29')]=function(_0x3e9059,_0x5ee47d){return db[_0x196c('0x4d')][_0x196c('0x55')]({'where':{'id':_0x3e9059[_0x196c('0x4c')]['id']}})[_0x196c('0x28')](handleEntityNotFound(_0x5ee47d,null))['then'](removeEntity(_0x5ee47d,null))['catch'](handleError(_0x5ee47d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 740dae1..5eef867 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 _0x1e69=['tools_variables','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./variable.attributes','exports','define','Variable'];(function(_0x459d7d,_0x55db19){var _0x26abf1=function(_0x39e5d5){while(--_0x39e5d5){_0x459d7d['push'](_0x459d7d['shift']());}};_0x26abf1(++_0x55db19);}(_0x1e69,0x85));var _0x91e6=function(_0x3ad2be,_0x36fe53){_0x3ad2be=_0x3ad2be-0x0;var _0xefbd6a=_0x1e69[_0x3ad2be];return _0xefbd6a;};'use strict';var _=require('lodash');var util=require(_0x91e6('0x0'));var logger=require(_0x91e6('0x1'))(_0x91e6('0x2'));var moment=require(_0x91e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x91e6('0x4'));var rimraf=require(_0x91e6('0x5'));var config=require(_0x91e6('0x6'));var attributes=require(_0x91e6('0x7'));module[_0x91e6('0x8')]=function(_0x42fe90,_0x4091b8){return _0x42fe90[_0x91e6('0x9')](_0x91e6('0xa'),attributes,{'tableName':_0x91e6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9ffd=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','define','Variable','lodash','util'];(function(_0x111719,_0xec696b){var _0x4dd3bf=function(_0x503689){while(--_0x503689){_0x111719['push'](_0x111719['shift']());}};_0x4dd3bf(++_0xec696b);}(_0x9ffd,0x1d7));var _0xd9ff=function(_0x13a951,_0x23c9a7){_0x13a951=_0x13a951-0x0;var _0x3c3e11=_0x9ffd[_0x13a951];return _0x3c3e11;};'use strict';var _=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var logger=require(_0xd9ff('0x2'))(_0xd9ff('0x3'));var moment=require('moment');var BPromise=require(_0xd9ff('0x4'));var rp=require(_0xd9ff('0x5'));var fs=require('fs');var path=require(_0xd9ff('0x6'));var rimraf=require(_0xd9ff('0x7'));var config=require(_0xd9ff('0x8'));var attributes=require('./variable.attributes');module['exports']=function(_0x43bc7f,_0x5d5f0d){return _0x43bc7f[_0xd9ff('0x9')](_0xd9ff('0xa'),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 729e9a7..4e8bd8f 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 _0xbcc8=['error','code','message','info','catch','ShowVariable','Variable','options','raw','attributes','include','map','model','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xeb4b98,_0x214d34){var _0x34c6b4=function(_0x381455){while(--_0x381455){_0xeb4b98['push'](_0xeb4b98['shift']());}};_0x34c6b4(++_0x214d34);}(_0xbcc8,0x67));var _0x8bcc=function(_0x1b2255,_0x3de34f){_0x1b2255=_0x1b2255-0x0;var _0x33e57d=_0xbcc8[_0x1b2255];return _0x33e57d;};'use strict';var _=require('lodash');var util=require(_0x8bcc('0x0'));var moment=require(_0x8bcc('0x1'));var BPromise=require(_0x8bcc('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8bcc('0x3'))['db'];var utils=require(_0x8bcc('0x4'));var logger=require(_0x8bcc('0x5'))('rpc');var config=require(_0x8bcc('0x6'));var jayson=require(_0x8bcc('0x7'));var client=jayson[_0x8bcc('0x8')][_0x8bcc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x420743,_0x54ac79,_0x3dda72){return new BPromise(function(_0x384c7e,_0x5400c1){return client[_0x8bcc('0xa')](_0x420743,_0x3dda72)[_0x8bcc('0xb')](function(_0x58a7fe){logger['info'](_0x8bcc('0xc'),_0x54ac79,_0x8bcc('0xd'));logger[_0x8bcc('0xe')](_0x8bcc('0xf'),_0x54ac79,_0x8bcc('0xd'),JSON[_0x8bcc('0x10')](_0x58a7fe));if(_0x58a7fe[_0x8bcc('0x11')]){if(_0x58a7fe[_0x8bcc('0x11')][_0x8bcc('0x12')]===0x1f4){logger[_0x8bcc('0x11')](_0x8bcc('0xc'),_0x54ac79,_0x58a7fe[_0x8bcc('0x11')]['message']);return _0x5400c1(_0x58a7fe[_0x8bcc('0x11')]['message']);}logger[_0x8bcc('0x11')](_0x8bcc('0xc'),_0x54ac79,_0x58a7fe[_0x8bcc('0x11')][_0x8bcc('0x13')]);return _0x384c7e(_0x58a7fe[_0x8bcc('0x11')][_0x8bcc('0x13')]);}else{logger[_0x8bcc('0x14')]('Variable,\x20%s,\x20%s',_0x54ac79,_0x8bcc('0xd'));_0x384c7e(_0x58a7fe['result'][_0x8bcc('0x13')]);}})[_0x8bcc('0x15')](function(_0x120340){logger[_0x8bcc('0x11')]('Variable,\x20%s,\x20%s',_0x54ac79,_0x120340);_0x5400c1(_0x120340);});});}exports[_0x8bcc('0x16')]=function(_0x3e4c7a){var _0x198f89=this;return new Promise(function(_0x139ad9,_0x3cf688){return db[_0x8bcc('0x17')]['find']({'raw':_0x3e4c7a['options']?_0x3e4c7a[_0x8bcc('0x18')][_0x8bcc('0x19')]===undefined?!![]:![]:!![],'where':_0x3e4c7a[_0x8bcc('0x18')]?_0x3e4c7a[_0x8bcc('0x18')]['where']||null:null,'attributes':_0x3e4c7a['options']?_0x3e4c7a[_0x8bcc('0x18')][_0x8bcc('0x1a')]||null:null,'include':_0x3e4c7a[_0x8bcc('0x18')]?_0x3e4c7a[_0x8bcc('0x18')][_0x8bcc('0x1b')]?_[_0x8bcc('0x1c')](_0x3e4c7a['options'][_0x8bcc('0x1b')],function(_0x2d3e78){return{'model':db[_0x2d3e78[_0x8bcc('0x1d')]],'as':_0x2d3e78['as'],'attributes':_0x2d3e78['attributes'],'include':_0x2d3e78['include']?_['map'](_0x2d3e78[_0x8bcc('0x1b')],function(_0x1e6c24){return{'model':db[_0x1e6c24[_0x8bcc('0x1d')]],'as':_0x1e6c24['as'],'attributes':_0x1e6c24[_0x8bcc('0x1a')],'include':_0x1e6c24['include']?_[_0x8bcc('0x1c')](_0x1e6c24[_0x8bcc('0x1b')],function(_0x21adef){return{'model':db[_0x21adef[_0x8bcc('0x1d')]],'as':_0x21adef['as'],'attributes':_0x21adef[_0x8bcc('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4e0509){logger[_0x8bcc('0x14')](_0x8bcc('0x16'),_0x3e4c7a);logger['debug'](_0x8bcc('0x16'),_0x3e4c7a,JSON[_0x8bcc('0x10')](_0x4e0509));_0x139ad9(_0x4e0509);})['catch'](function(_0x4c3cab){logger[_0x8bcc('0x11')](_0x8bcc('0x16'),_0x4c3cab[_0x8bcc('0x13')],_0x3e4c7a);_0x3cf688(_0x198f89[_0x8bcc('0x11')](0x1f4,_0x4c3cab['message']));});});}; \ No newline at end of file +var _0x0771=['randomstring','ioredis','../../mysqldb','../../config/utils','rpc','http','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','Variable','find','options','attributes','include','map','lodash','bluebird'];(function(_0x233637,_0x55b3d7){var _0x3ec050=function(_0x5a6469){while(--_0x5a6469){_0x233637['push'](_0x233637['shift']());}};_0x3ec050(++_0x55b3d7);}(_0x0771,0x193));var _0x1077=function(_0x420516,_0x5ce5ca){_0x420516=_0x420516-0x0;var _0x16484e=_0x0771[_0x420516];return _0x16484e;};'use strict';var _=require(_0x1077('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1077('0x1'));var rs=require(_0x1077('0x2'));var fs=require('fs');var Redis=require(_0x1077('0x3'));var db=require(_0x1077('0x4'))['db'];var utils=require(_0x1077('0x5'));var logger=require('../../config/logger')(_0x1077('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x1077('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x278a27,_0x52d96e,_0x3fd7d2){return new BPromise(function(_0x3ec0e5,_0x41a88c){return client['request'](_0x278a27,_0x3fd7d2)[_0x1077('0x8')](function(_0x40410d){logger[_0x1077('0x9')](_0x1077('0xa'),_0x52d96e,_0x1077('0xb'));logger[_0x1077('0xc')](_0x1077('0xd'),_0x52d96e,_0x1077('0xb'),JSON[_0x1077('0xe')](_0x40410d));if(_0x40410d[_0x1077('0xf')]){if(_0x40410d[_0x1077('0xf')][_0x1077('0x10')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x52d96e,_0x40410d[_0x1077('0xf')]['message']);return _0x41a88c(_0x40410d[_0x1077('0xf')][_0x1077('0x11')]);}logger[_0x1077('0xf')](_0x1077('0xa'),_0x52d96e,_0x40410d['error'][_0x1077('0x11')]);return _0x3ec0e5(_0x40410d[_0x1077('0xf')]['message']);}else{logger['info'](_0x1077('0xa'),_0x52d96e,_0x1077('0xb'));_0x3ec0e5(_0x40410d[_0x1077('0x12')]['message']);}})[_0x1077('0x13')](function(_0xfea71d){logger[_0x1077('0xf')]('Variable,\x20%s,\x20%s',_0x52d96e,_0xfea71d);_0x41a88c(_0xfea71d);});});}exports[_0x1077('0x14')]=function(_0x5c8f4c){var _0x40e717=this;return new Promise(function(_0x52331d,_0x53429d){return db[_0x1077('0x15')][_0x1077('0x16')]({'raw':_0x5c8f4c[_0x1077('0x17')]?_0x5c8f4c[_0x1077('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x5c8f4c['options']?_0x5c8f4c[_0x1077('0x17')]['where']||null:null,'attributes':_0x5c8f4c[_0x1077('0x17')]?_0x5c8f4c[_0x1077('0x17')][_0x1077('0x18')]||null:null,'include':_0x5c8f4c[_0x1077('0x17')]?_0x5c8f4c[_0x1077('0x17')]['include']?_['map'](_0x5c8f4c[_0x1077('0x17')][_0x1077('0x19')],function(_0x376dc6){return{'model':db[_0x376dc6['model']],'as':_0x376dc6['as'],'attributes':_0x376dc6[_0x1077('0x18')],'include':_0x376dc6[_0x1077('0x19')]?_[_0x1077('0x1a')](_0x376dc6[_0x1077('0x19')],function(_0x23802a){return{'model':db[_0x23802a['model']],'as':_0x23802a['as'],'attributes':_0x23802a[_0x1077('0x18')],'include':_0x23802a[_0x1077('0x19')]?_[_0x1077('0x1a')](_0x23802a[_0x1077('0x19')],function(_0x242cf2){return{'model':db[_0x242cf2['model']],'as':_0x242cf2['as'],'attributes':_0x242cf2[_0x1077('0x18')]};}):[]};}):[]};}):[]:[]})[_0x1077('0x8')](function(_0x2d7b74){logger[_0x1077('0x9')](_0x1077('0x14'),_0x5c8f4c);logger[_0x1077('0xc')](_0x1077('0x14'),_0x5c8f4c,JSON['stringify'](_0x2d7b74));_0x52331d(_0x2d7b74);})[_0x1077('0x13')](function(_0x26e483){logger[_0x1077('0xf')]('ShowVariable',_0x26e483[_0x1077('0x11')],_0x5c8f4c);_0x53429d(_0x40e717[_0x1077('0xf')](0x1f4,_0x26e483[_0x1077('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 4187950..749713f 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 _0x46df=['isAuthenticated','canUpdate','/pull','/restart','restart','migrations','exports','express','./version.controller','get','index'];(function(_0x2a8b21,_0x5cd96b){var _0x114314=function(_0xd17a7){while(--_0xd17a7){_0x2a8b21['push'](_0x2a8b21['shift']());}};_0x114314(++_0x5cd96b);}(_0x46df,0x1e0));var _0xf46d=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x46df[_0x1facfa];return _0x9ec701;};'use strict';var express=require(_0xf46d('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xf46d('0x1'));router[_0xf46d('0x2')]('/',controller[_0xf46d('0x3')]);router['get']('/fetch',auth[_0xf46d('0x4')](),auth['canUpdate'](),controller['fetch']);router['get']('/reset',auth['isAuthenticated'](),auth[_0xf46d('0x5')](),controller['reset']);router[_0xf46d('0x2')](_0xf46d('0x6'),auth[_0xf46d('0x4')](),auth[_0xf46d('0x5')](),controller['pull']);router['get'](_0xf46d('0x7'),auth['isAuthenticated'](),controller[_0xf46d('0x8')]);router['get']('/migrations',controller[_0xf46d('0x9')]);module[_0xf46d('0xa')]=router; \ No newline at end of file +var _0xe45d=['Router','./version.controller','get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','reset','restart','/migrations','migrations','express'];(function(_0x51e99b,_0x2d7d42){var _0x2af489=function(_0xade5a3){while(--_0xade5a3){_0x51e99b['push'](_0x51e99b['shift']());}};_0x2af489(++_0x2d7d42);}(_0xe45d,0xed));var _0xde45=function(_0x4c487a,_0xb8f3ea){_0x4c487a=_0x4c487a-0x0;var _0x3e31cb=_0xe45d[_0x4c487a];return _0x3e31cb;};'use strict';var express=require(_0xde45('0x0'));var router=express[_0xde45('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xde45('0x2'));router[_0xde45('0x3')]('/',controller[_0xde45('0x4')]);router[_0xde45('0x3')](_0xde45('0x5'),auth[_0xde45('0x6')](),auth[_0xde45('0x7')](),controller[_0xde45('0x8')]);router['get'](_0xde45('0x9'),auth[_0xde45('0x6')](),auth['canUpdate'](),controller[_0xde45('0xa')]);router[_0xde45('0x3')]('/pull',auth['isAuthenticated'](),auth[_0xde45('0x7')](),controller['pull']);router[_0xde45('0x3')]('/restart',auth[_0xde45('0x6')](),controller[_0xde45('0xb')]);router[_0xde45('0x3')](_0xde45('0xc'),controller[_0xde45('0xd')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index bac3613..172b51a 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 _0x9e2e=['getQueryInterface','sequelize','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','Database\x20migrated\x20successfully\x20from\x20version\x20','Database\x20already\x20up-to-date','umzug','path','lodash','version','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','index','query','latest','fetch','exports','status','json','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','error','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','info','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','root','server','length','replace','.js','push','sort','Migration'];(function(_0x43aee5,_0x11268b){var _0x76d1d0=function(_0x3faee6){while(--_0x3faee6){_0x43aee5['push'](_0x43aee5['shift']());}};_0x76d1d0(++_0x11268b);}(_0x9e2e,0xd6));var _0xe9e2=function(_0x2b5a55,_0x54bd23){_0x2b5a55=_0x2b5a55-0x0;var _0x2f41cb=_0x9e2e[_0x2b5a55];return _0x2f41cb;};'use strict';var Umzug=require(_0xe9e2('0x0'));var path=require(_0xe9e2('0x1'));var fs=require('fs');var _=require(_0xe9e2('0x2'));var pkginfo=require('pkginfo')(module,_0xe9e2('0x3'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xe9e2('0x4')];var db=require(_0xe9e2('0x5'))['db'];var config=require(_0xe9e2('0x6'));var pm2=require(_0xe9e2('0x7'));var logger=require(_0xe9e2('0x8'))(_0xe9e2('0x9'));var git=require(_0xe9e2('0xa'))(config['root']);exports[_0xe9e2('0xb')]=function(_0x4f1ef7,_0x2bec58){var _0x1ade12={'current':module['exports'][_0xe9e2('0x3')],'phonebar':0x2};if(_0x4f1ef7[_0xe9e2('0xc')]&&_0x4f1ef7['query'][_0xe9e2('0xd')]){return git[_0xe9e2('0xe')]()['tags'](function(_0x53e3c5,_0x116094){_0x1ade12[_0xe9e2('0xd')]=(_0x53e3c5?module[_0xe9e2('0xf')][_0xe9e2('0x3')]:_0x116094['latest'])||'2.0.0';return _0x2bec58[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')](_0x1ade12);});}else{return _0x2bec58[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')](_0x1ade12);}};exports[_0xe9e2('0xe')]=function(_0x23331d,_0x41ea08){return git[_0xe9e2('0xe')]([_0xe9e2('0x12'),_0xe9e2('0x13')],function(_0x58f329){if(_0x58f329){logger['error'](_0x58f329);return _0x41ea08[_0xe9e2('0x10')](0x1f4)['json'](_0x58f329);}logger['info'](_0xe9e2('0x14'));return _0x41ea08[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':_0xe9e2('0x15')});});};exports[_0xe9e2('0x16')]=function(_0x25d70f,_0x5f3fc8){return git[_0xe9e2('0x16')]([_0xe9e2('0x17'),_0xe9e2('0x18')],function(_0x5b804f){if(_0x5b804f){logger[_0xe9e2('0x19')](_0x5b804f);return _0x5f3fc8[_0xe9e2('0x10')](0x1f4)[_0xe9e2('0x11')](_0x5b804f);}logger['info'](_0xe9e2('0x1a'));return _0x5f3fc8[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':'git\x20reset\x20--hard'});});};exports[_0xe9e2('0x1b')]=function(_0x36c8a3,_0x456455){exec(_0xe9e2('0x1c'),function(_0x5bb286,_0x183680,_0x1655fe){logger[_0xe9e2('0x1d')](_0x183680);logger[_0xe9e2('0x1d')](_0x1655fe);if(_0x5bb286){logger[_0xe9e2('0x19')](_0x5bb286);return _0x456455[_0xe9e2('0x10')](0x1f4)[_0xe9e2('0x11')](_0x5bb286);}return _0x456455[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':_0x183680});});};exports[_0xe9e2('0x1e')]=function(_0x1c22f6,_0x2e8577){return pm2[_0xe9e2('0x1e')](_0xe9e2('0x1f'))[_0xe9e2('0x20')](function(_0x1bf061){logger[_0xe9e2('0x1d')]('pm2\x20restart\x20motion\x20%s',_0x1bf061);return _0x2e8577[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':_0xe9e2('0x21')});})[_0xe9e2('0x22')](function(_0x57254c){logger[_0xe9e2('0x19')](_0x57254c);return _0x2e8577[_0xe9e2('0x10')](0x1f4)[_0xe9e2('0x11')](_0x57254c);});};exports[_0xe9e2('0x23')]=function(_0x257a3a,_0x4fc1ce){var _0x4cf43f=fs[_0xe9e2('0x24')](path[_0xe9e2('0x25')](config[_0xe9e2('0x26')],_0xe9e2('0x27'),_0xe9e2('0x23')));var _0x42b8ca=[];for(var _0x5da7b3=0x0;_0x5da7b3<_0x4cf43f[_0xe9e2('0x28')];_0x5da7b3++){var _0x546961=_0x4cf43f[_0x5da7b3][_0xe9e2('0x29')](_0xe9e2('0x2a'),'');if(compareVersions(module[_0xe9e2('0xf')][_0xe9e2('0x3')],_0x546961)===-0x1){_0x42b8ca[_0xe9e2('0x2b')](_0x546961);}}if(_0x42b8ca['length']){var _0x5331aa=_0x42b8ca[_0xe9e2('0x2c')](compareVersions);var _0xecccbc=new Umzug({'storage':'sequelize','storageOptions':{'model':db[_0xe9e2('0x2d')],'modelName':_0xe9e2('0x2d'),'columnName':_0xe9e2('0x3')},'migrations':{'params':[db['sequelize'][_0xe9e2('0x2e')](),db[_0xe9e2('0x2f')][_0xe9e2('0x30')],function(){throw new Error(_0xe9e2('0x31'));}],'path':path['join'](config[_0xe9e2('0x26')],_0xe9e2('0x27'),_0xe9e2('0x23')),'pattern':/\.js$/}});_0xecccbc['up']({'migrations':_['map'](_0x5331aa,function(_0x47e133){return _0x47e133+_0xe9e2('0x2a');})})[_0xe9e2('0x20')](function(){return _0x4fc1ce[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':_0xe9e2('0x32')+module[_0xe9e2('0xf')][_0xe9e2('0x3')]+'\x20to\x20'+_['last'](_0x5331aa),'migrations':_[_0xe9e2('0x25')](_0x5331aa)});})['catch'](function(_0x33ea98){if(_0x33ea98 instanceof db[_0xe9e2('0x2f')]['UniqueConstraintError']){return _0x4fc1ce[_0xe9e2('0x10')](0xc8)[_0xe9e2('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x4fc1ce[_0xe9e2('0x10')](0x1f4)[_0xe9e2('0x11')](_0x33ea98);}});}else{return _0x4fc1ce['status'](0xc8)['json']({'output':_0xe9e2('0x33')});}}; \ No newline at end of file +var _0xd4ad=['last','catch','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','exec','../../mysqldb','simple-git','index','exports','query','fetch','tags','2.0.0','json','status','master','error','info','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','migrations','readdirSync','join','root','server','length','.js','push','sort','sequelize','Migration','getQueryInterface','Database\x20migrated\x20successfully\x20from\x20version\x20'];(function(_0x59ac82,_0x421954){var _0x4ad620=function(_0x3526a3){while(--_0x3526a3){_0x59ac82['push'](_0x59ac82['shift']());}};_0x4ad620(++_0x421954);}(_0xd4ad,0x1e4));var _0xdd4a=function(_0x19b689,_0x21d2e8){_0x19b689=_0x19b689-0x0;var _0x51c5ee=_0xd4ad[_0x19b689];return _0x51c5ee;};'use strict';var Umzug=require(_0xdd4a('0x0'));var path=require(_0xdd4a('0x1'));var fs=require('fs');var _=require(_0xdd4a('0x2'));var pkginfo=require(_0xdd4a('0x3'))(module,_0xdd4a('0x4'));var compareVersions=require('compare-versions');var exec=require('child_process')[_0xdd4a('0x5')];var db=require(_0xdd4a('0x6'))['db'];var config=require('../../config/environment');var pm2=require('../../config/pm2');var logger=require('../../config/logger')('update');var git=require(_0xdd4a('0x7'))(config['root']);exports[_0xdd4a('0x8')]=function(_0x5b5ab3,_0x3c7a01){var _0x45647c={'current':module[_0xdd4a('0x9')][_0xdd4a('0x4')],'phonebar':0x2};if(_0x5b5ab3[_0xdd4a('0xa')]&&_0x5b5ab3[_0xdd4a('0xa')]['latest']){return git[_0xdd4a('0xb')]()[_0xdd4a('0xc')](function(_0x2616be,_0x5d7550){_0x45647c['latest']=(_0x2616be?module[_0xdd4a('0x9')][_0xdd4a('0x4')]:_0x5d7550['latest'])||_0xdd4a('0xd');return _0x3c7a01['status'](0xc8)[_0xdd4a('0xe')](_0x45647c);});}else{return _0x3c7a01[_0xdd4a('0xf')](0xc8)[_0xdd4a('0xe')](_0x45647c);}};exports[_0xdd4a('0xb')]=function(_0x3077e1,_0x3d3656){return git[_0xdd4a('0xb')](['origin',_0xdd4a('0x10')],function(_0x1098fc){if(_0x1098fc){logger[_0xdd4a('0x11')](_0x1098fc);return _0x3d3656[_0xdd4a('0xf')](0x1f4)[_0xdd4a('0xe')](_0x1098fc);}logger[_0xdd4a('0x12')](_0xdd4a('0x13'));return _0x3d3656[_0xdd4a('0xf')](0xc8)[_0xdd4a('0xe')]({'output':_0xdd4a('0x14')});});};exports[_0xdd4a('0x15')]=function(_0x295142,_0x95c5ec){return git[_0xdd4a('0x15')]([_0xdd4a('0x16'),_0xdd4a('0x17')],function(_0x19078a){if(_0x19078a){logger['error'](_0x19078a);return _0x95c5ec[_0xdd4a('0xf')](0x1f4)['json'](_0x19078a);}logger['info'](_0xdd4a('0x18'));return _0x95c5ec['status'](0xc8)[_0xdd4a('0xe')]({'output':'git\x20reset\x20--hard'});});};exports['pull']=function(_0xfc51f,_0x18d81c){exec(_0xdd4a('0x19'),function(_0x21b4fc,_0x55b94f,_0x4e67a5){logger[_0xdd4a('0x12')](_0x55b94f);logger[_0xdd4a('0x12')](_0x4e67a5);if(_0x21b4fc){logger['error'](_0x21b4fc);return _0x18d81c['status'](0x1f4)[_0xdd4a('0xe')](_0x21b4fc);}return _0x18d81c['status'](0xc8)[_0xdd4a('0xe')]({'output':_0x55b94f});});};exports[_0xdd4a('0x1a')]=function(_0x42189e,_0x56e6a5){return pm2[_0xdd4a('0x1a')](_0xdd4a('0x1b'))[_0xdd4a('0x1c')](function(_0x29304a){logger['info'](_0xdd4a('0x1d'),_0x29304a);return _0x56e6a5[_0xdd4a('0xf')](0xc8)[_0xdd4a('0xe')]({'output':_0xdd4a('0x1e')});})['catch'](function(_0x40c8cf){logger['error'](_0x40c8cf);return _0x56e6a5['status'](0x1f4)['json'](_0x40c8cf);});};exports[_0xdd4a('0x1f')]=function(_0x233119,_0x154d3c){var _0x3a5033=fs[_0xdd4a('0x20')](path[_0xdd4a('0x21')](config[_0xdd4a('0x22')],_0xdd4a('0x23'),'migrations'));var _0x3d4b1f=[];for(var _0x2c574f=0x0;_0x2c574f<_0x3a5033[_0xdd4a('0x24')];_0x2c574f++){var _0x33c767=_0x3a5033[_0x2c574f]['replace'](_0xdd4a('0x25'),'');if(compareVersions(module[_0xdd4a('0x9')][_0xdd4a('0x4')],_0x33c767)===-0x1){_0x3d4b1f[_0xdd4a('0x26')](_0x33c767);}}if(_0x3d4b1f[_0xdd4a('0x24')]){var _0x57aa3c=_0x3d4b1f[_0xdd4a('0x27')](compareVersions);var _0x16d211=new Umzug({'storage':_0xdd4a('0x28'),'storageOptions':{'model':db[_0xdd4a('0x29')],'modelName':'Migration','columnName':'version'},'migrations':{'params':[db['sequelize'][_0xdd4a('0x2a')](),db[_0xdd4a('0x28')]['constructor'],function(){throw new Error('Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.');}],'path':path[_0xdd4a('0x21')](config[_0xdd4a('0x22')],_0xdd4a('0x23'),'migrations'),'pattern':/\.js$/}});_0x16d211['up']({'migrations':_['map'](_0x57aa3c,function(_0x44e470){return _0x44e470+'.js';})})[_0xdd4a('0x1c')](function(){return _0x154d3c[_0xdd4a('0xf')](0xc8)['json']({'output':_0xdd4a('0x2b')+module['exports']['version']+'\x20to\x20'+_[_0xdd4a('0x2c')](_0x57aa3c),'migrations':_[_0xdd4a('0x21')](_0x57aa3c)});})[_0xdd4a('0x2d')](function(_0x5c48fb){if(_0x5c48fb instanceof db[_0xdd4a('0x28')][_0xdd4a('0x2e')]){return _0x154d3c[_0xdd4a('0xf')](0xc8)[_0xdd4a('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x154d3c[_0xdd4a('0xf')](0x1f4)['json'](_0x5c48fb);}});}else{return _0x154d3c['status'](0xc8)[_0xdd4a('0xe')]({'output':_0xdd4a('0x2f')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index beb74ae..f90bef0 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 _0x9f6b=['multer','util','path','Router','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x9f6b,0x12c));var _0xb9f6=function(_0x56a40d,_0x931121){_0x56a40d=_0x56a40d-0x0;var _0xc9b722=_0x9f6b[_0x56a40d];return _0xc9b722;};'use strict';var multer=require(_0xb9f6('0x0'));var util=require(_0xb9f6('0x1'));var path=require(_0xb9f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb9f6('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0xb9f6('0x4'));var config=require(_0xb9f6('0x5'));var controller=require(_0xb9f6('0x6'));router[_0xb9f6('0x7')]('/',auth[_0xb9f6('0x8')](),controller['index']);router['get'](_0xb9f6('0x9'),auth[_0xb9f6('0x8')](),controller[_0xb9f6('0xa')]);router[_0xb9f6('0x7')](_0xb9f6('0xb'),auth[_0xb9f6('0x8')](),controller[_0xb9f6('0xc')]);router['post']('/',auth[_0xb9f6('0x8')](),controller['create']);router[_0xb9f6('0xd')](_0xb9f6('0xb'),auth['isAuthenticated'](),controller[_0xb9f6('0xe')]);router['delete']('/:id',auth[_0xb9f6('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd236=['/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','index','get','/describe','describe','show','put'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xd236,0x17f));var _0x6d23=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd236[_0x122096];return _0x3d1966;};'use strict';var multer=require(_0x6d23('0x0'));var util=require('util');var path=require(_0x6d23('0x1'));var timeout=require(_0x6d23('0x2'));var express=require(_0x6d23('0x3'));var router=express[_0x6d23('0x4')]();var auth=require(_0x6d23('0x5'));var interaction=require(_0x6d23('0x6'));var config=require(_0x6d23('0x7'));var controller=require(_0x6d23('0x8'));router['get']('/',auth[_0x6d23('0x9')](),controller[_0x6d23('0xa')]);router[_0x6d23('0xb')](_0x6d23('0xc'),auth['isAuthenticated'](),controller[_0x6d23('0xd')]);router[_0x6d23('0xb')]('/:id',auth[_0x6d23('0x9')](),controller[_0x6d23('0xe')]);router['post']('/',auth[_0x6d23('0x9')](),controller['create']);router[_0x6d23('0xf')](_0x6d23('0x10'),auth[_0x6d23('0x9')](),controller[_0x6d23('0x11')]);router[_0x6d23('0x12')](_0x6d23('0x10'),auth[_0x6d23('0x9')](),controller[_0x6d23('0x13')]);module[_0x6d23('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index 37b1208..740bee8 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 _0x814b=['STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','exports'];(function(_0x414df0,_0x3b902f){var _0x2cf357=function(_0x528c3c){while(--_0x528c3c){_0x414df0['push'](_0x414df0['shift']());}};_0x2cf357(++_0x3b902f);}(_0x814b,0x1a2));var _0xb814=function(_0x1ce236,_0xca922e){_0x1ce236=_0x1ce236-0x0;var _0x241819=_0x814b[_0x1ce236];return _0x241819;};'use strict';var Sequelize=require(_0xb814('0x0'));module[_0xb814('0x1')]={'type':{'type':Sequelize[_0xb814('0x2')]},'uniqueid':{'type':Sequelize[_0xb814('0x2')]},'calleridnum':{'type':Sequelize[_0xb814('0x2')]},'calleridname':{'type':Sequelize[_0xb814('0x2')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0xb814('0x2')]},'membername':{'type':Sequelize[_0xb814('0x2')]},'agentcalledAt':{'type':Sequelize[_0xb814('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb814('0x3')]},'agentcompleteAt':{'type':Sequelize[_0xb814('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0xb814('0x3')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0xb814('0x4')]},'agentcomplete':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0xb814('0x4')]},'agentacw':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xb814('0x4')]},'reason':{'type':Sequelize[_0xb814('0x2')]},'lastevent':{'type':Sequelize[_0xb814('0x2')]},'channel':{'type':Sequelize[_0xb814('0x2')]},'channelstate':{'type':Sequelize[_0xb814('0x4')]},'channelstatedesc':{'type':Sequelize[_0xb814('0x2')]},'connectedlinenum':{'type':Sequelize[_0xb814('0x2')]},'connectedlinename':{'type':Sequelize[_0xb814('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xb814('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xb814('0x2')]},'priority':{'type':Sequelize[_0xb814('0x2')]},'destchannel':{'type':Sequelize[_0xb814('0x2')]},'destchannelstate':{'type':Sequelize[_0xb814('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xb814('0x2')]},'destcalleridnum':{'type':Sequelize[_0xb814('0x2')]},'destcalleridname':{'type':Sequelize[_0xb814('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xb814('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb814('0x2')]},'destlanguage':{'type':Sequelize[_0xb814('0x2')]},'destaccountcode':{'type':Sequelize[_0xb814('0x2')]},'destcontext':{'type':Sequelize[_0xb814('0x2')]},'destexten':{'type':Sequelize[_0xb814('0x2')]},'destpriority':{'type':Sequelize[_0xb814('0x2')]},'destuniqueid':{'type':Sequelize[_0xb814('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xb814('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0xb814('0x2')]},'transfer':{'type':Sequelize[_0xb814('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0xb814('0x2')],'comment':_0xb814('0x6')},'transferexten':{'type':Sequelize[_0xb814('0x2')]},'transferuniqueid':{'type':Sequelize['STRING']},'agententerreason':{'type':Sequelize[_0xb814('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x6aa7=['BOOLEAN','sequelize','STRING','DATE','INTEGER'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x6aa7,0x178));var _0x76aa=function(_0x2450a7,_0x1a722e){_0x2450a7=_0x2450a7-0x0;var _0x310f15=_0x6aa7[_0x2450a7];return _0x310f15;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'type':{'type':Sequelize[_0x76aa('0x1')]},'uniqueid':{'type':Sequelize[_0x76aa('0x1')]},'calleridnum':{'type':Sequelize[_0x76aa('0x1')]},'calleridname':{'type':Sequelize[_0x76aa('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x76aa('0x1')]},'membername':{'type':Sequelize[_0x76aa('0x1')]},'agentcalledAt':{'type':Sequelize[_0x76aa('0x2')]},'agentconnectAt':{'type':Sequelize['DATE']},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x76aa('0x2')]},'agentdumpAt':{'type':Sequelize['DATE']},'holdtime':{'type':Sequelize[_0x76aa('0x3')]},'agentcomplete':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x76aa('0x3')]},'agentacw':{'type':Sequelize[_0x76aa('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x76aa('0x3')]},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0x76aa('0x1')]},'channel':{'type':Sequelize[_0x76aa('0x1')]},'channelstate':{'type':Sequelize[_0x76aa('0x3')]},'channelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'connectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'language':{'type':Sequelize[_0x76aa('0x1')]},'accountcode':{'type':Sequelize[_0x76aa('0x1')]},'context':{'type':Sequelize[_0x76aa('0x1')]},'exten':{'type':Sequelize[_0x76aa('0x1')]},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x76aa('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridnum':{'type':Sequelize[_0x76aa('0x1')]},'destcalleridname':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0x76aa('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x76aa('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x76aa('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x76aa('0x1')]},'destuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize['STRING']},'answeredelsewheremembername':{'type':Sequelize[_0x76aa('0x1')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x76aa('0x1')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x76aa('0x1')]},'transferuniqueid':{'type':Sequelize[_0x76aa('0x1')]},'agententerreason':{'type':Sequelize[_0x76aa('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 42db5eb..80097a0 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 _0xd37b=['reject','save','update','then','stack','name','send','map','VoiceAgentReport','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','html-pdf','eml-format','rimraf','request-promise','moment','bluebird','path','sox','to-csv','ejs','lodash','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','apply'];(function(_0x348ec8,_0x4f3207){var _0x53dd91=function(_0x42f6ac){while(--_0x42f6ac){_0x348ec8['push'](_0x348ec8['shift']());}};_0x53dd91(++_0x4f3207);}(_0xd37b,0xfe));var _0xbd37=function(_0x4b2733,_0xe211a3){_0x4b2733=_0x4b2733-0x0;var _0x4996e9=_0xd37b[_0x4b2733];return _0x4996e9;};'use strict';var pdf=require(_0xbd37('0x0'));var emlformat=require(_0xbd37('0x1'));var rimraf=require(_0xbd37('0x2'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xbd37('0x3'));var moment=require(_0xbd37('0x4'));var BPromise=require(_0xbd37('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0xbd37('0x6'));var sox=require(_0xbd37('0x7'));var csv=require(_0xbd37('0x8'));var ejs=require(_0xbd37('0x9'));var fs=require('fs');var _=require(_0xbd37('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbd37('0xb'));var deskjs=require(_0xbd37('0xc'));var toCsv=require(_0xbd37('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbd37('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xbd37('0xe'));var as=require(_0xbd37('0xf'));var hardwareService=require(_0xbd37('0x10'));var logger=require('../../config/logger')(_0xbd37('0x11'));var utils=require(_0xbd37('0x12'));var config=require(_0xbd37('0x13'));var db=require(_0xbd37('0x14'))['db'];function respondWithStatusCode(_0x34aa11,_0x51d80f){_0x51d80f=_0x51d80f||0xcc;return function(_0x31eb5f){if(_0x31eb5f){return _0x34aa11[_0xbd37('0x15')](_0x51d80f);}return _0x34aa11[_0xbd37('0x16')](_0x51d80f)[_0xbd37('0x17')]();};}function respondWithResult(_0x432f15,_0x49624b){_0x49624b=_0x49624b||0xc8;return function(_0x5ad25c){if(_0x5ad25c){return _0x432f15[_0xbd37('0x16')](_0x49624b)[_0xbd37('0x18')](_0x5ad25c);}};}function respondWithFilteredResult(_0x302950,_0x591dd6){return function(_0x46da84){if(_0x46da84){var _0x35fff0=_0x46da84[_0xbd37('0x19')],_0x529a76=_0x591dd6[_0xbd37('0x1a')],_0x419a36=_0x591dd6[_0xbd37('0x1a')]+_0x591dd6[_0xbd37('0x1b')],_0x3563fd;if(_0x419a36>=_0x35fff0){_0x419a36=_0x35fff0;_0x3563fd=0xc8;}else{_0x3563fd=0xce;}_0x302950[_0xbd37('0x16')](_0x3563fd);return _0x302950[_0xbd37('0x1c')]('Content-Range',_0x529a76+'-'+_0x419a36+'/'+_0x35fff0)['json'](_0x46da84);}return null;};}function patchUpdates(_0x4cdfcf){return function(_0xf27a99){try{jsonpatch[_0xbd37('0x1d')](_0xf27a99,_0x4cdfcf,!![]);}catch(_0x5808cd){return BPromise[_0xbd37('0x1e')](_0x5808cd);}return _0xf27a99[_0xbd37('0x1f')]();};}function saveUpdates(_0x117b43,_0x1da44a){return function(_0x33d164){if(_0x33d164){return _0x33d164[_0xbd37('0x20')](_0x117b43)[_0xbd37('0x21')](function(_0x2d7d96){return _0x2d7d96;});}return null;};}function removeEntity(_0x3fa4fc,_0x594a8b){return function(_0x2d7f18){if(_0x2d7f18){return _0x2d7f18['destroy']()['then'](function(){_0x3fa4fc[_0xbd37('0x16')](0xcc)[_0xbd37('0x17')]();});}};}function handleEntityNotFound(_0x55cebd,_0x33de6e){return function(_0x24803d){if(!_0x24803d){_0x55cebd['sendStatus'](0x194);}return _0x24803d;};}function handleError(_0x4460e8,_0x597be6){_0x597be6=_0x597be6||0x1f4;return function(_0x1c83e3){logger['error'](_0x1c83e3[_0xbd37('0x22')]);if(_0x1c83e3[_0xbd37('0x23')]){delete _0x1c83e3[_0xbd37('0x23')];}_0x4460e8['status'](_0x597be6)[_0xbd37('0x24')](_0x1c83e3);};}exports['index']=function(_0x4764eb,_0x2cb7ad){var _0x1cb876={},_0x34a7e2={},_0x40f14e={'count':0x0,'rows':[]};var _0x391329=_[_0xbd37('0x25')](db[_0xbd37('0x26')]['rawAttributes'],function(_0x50955a){return{'name':_0x50955a['fieldName'],'type':_0x50955a[_0xbd37('0x27')][_0xbd37('0x28')]};});_0x34a7e2[_0xbd37('0x29')]=_[_0xbd37('0x25')](_0x391329,'name');_0x34a7e2['query']=_[_0xbd37('0x2a')](_0x4764eb['query']);_0x34a7e2[_0xbd37('0x2b')]=_[_0xbd37('0x2c')](_0x34a7e2[_0xbd37('0x29')],_0x34a7e2[_0xbd37('0x2d')]);_0x1cb876[_0xbd37('0x2e')]=_['intersection'](_0x34a7e2[_0xbd37('0x29')],qs[_0xbd37('0x2f')](_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x2f')]));_0x1cb876['attributes']=_0x1cb876[_0xbd37('0x2e')][_0xbd37('0x30')]?_0x1cb876['attributes']:_0x34a7e2[_0xbd37('0x29')];if(!_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x31')](_0xbd37('0x32'))){_0x1cb876['limit']=qs[_0xbd37('0x1b')](_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x1b')]);_0x1cb876[_0xbd37('0x1a')]=qs[_0xbd37('0x1a')](_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x1a')]);}_0x1cb876[_0xbd37('0x33')]=qs[_0xbd37('0x34')](_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x34')]);_0x1cb876['where']=qs[_0xbd37('0x2b')](_['pick'](_0x4764eb[_0xbd37('0x2d')],_0x34a7e2[_0xbd37('0x2b')]));if(_0x4764eb[_0xbd37('0x2d')]['filter']){_0x1cb876[_0xbd37('0x35')]=_['merge'](_0x1cb876[_0xbd37('0x35')],{'$or':_['map'](_0x391329,function(_0x5bf1c3){if(_0x5bf1c3['type']!==_0xbd37('0x36')){var _0x5c2b5a={};_0x5c2b5a[_0x5bf1c3[_0xbd37('0x23')]]={'$like':'%'+_0x4764eb['query'][_0xbd37('0x37')]+'%'};return _0x5c2b5a;}})});}_0x1cb876=_[_0xbd37('0x38')]({},_0x1cb876,_0x4764eb[_0xbd37('0x39')]);var _0x288eb4={'where':_0x1cb876['where']};return db[_0xbd37('0x26')][_0xbd37('0x19')](_0x288eb4)[_0xbd37('0x21')](function(_0xa23a76){_0x40f14e[_0xbd37('0x19')]=_0xa23a76;if(_0x4764eb[_0xbd37('0x2d')][_0xbd37('0x3a')]){_0x1cb876[_0xbd37('0x3b')]=[{'all':!![]}];}return db[_0xbd37('0x26')][_0xbd37('0x3c')](_0x1cb876);})['then'](function(_0x444127){_0x40f14e[_0xbd37('0x3d')]=_0x444127;return _0x40f14e;})['then'](respondWithFilteredResult(_0x2cb7ad,_0x1cb876))[_0xbd37('0x3e')](handleError(_0x2cb7ad,null));};exports[_0xbd37('0x3f')]=function(_0x78b9ae,_0x564331){var _0x1eba0a={'raw':![],'where':{'id':_0x78b9ae[_0xbd37('0x40')]['id']}},_0x458ffb={};_0x458ffb[_0xbd37('0x29')]=_[_0xbd37('0x2a')](db['VoiceAgentReport'][_0xbd37('0x41')]);_0x458ffb['query']=_['keys'](_0x78b9ae['query']);_0x458ffb[_0xbd37('0x2b')]=_['intersection'](_0x458ffb['model'],_0x458ffb['query']);_0x1eba0a[_0xbd37('0x2e')]=_[_0xbd37('0x2c')](_0x458ffb['model'],qs[_0xbd37('0x2f')](_0x78b9ae[_0xbd37('0x2d')][_0xbd37('0x2f')]));_0x1eba0a['attributes']=_0x1eba0a[_0xbd37('0x2e')][_0xbd37('0x30')]?_0x1eba0a[_0xbd37('0x2e')]:_0x458ffb[_0xbd37('0x29')];if(_0x78b9ae[_0xbd37('0x2d')][_0xbd37('0x3a')]){_0x1eba0a[_0xbd37('0x3b')]=[{'all':!![]}];}_0x1eba0a=_[_0xbd37('0x38')]({},_0x1eba0a,_0x78b9ae['options']);return db[_0xbd37('0x26')][_0xbd37('0x42')](_0x1eba0a)[_0xbd37('0x21')](handleEntityNotFound(_0x564331,null))[_0xbd37('0x21')](respondWithResult(_0x564331,null))[_0xbd37('0x3e')](handleError(_0x564331,null));};exports[_0xbd37('0x43')]=function(_0x3d79cb,_0x40b390){return db[_0xbd37('0x26')][_0xbd37('0x43')](_0x3d79cb['body'],{})['then'](respondWithResult(_0x40b390,0xc9))['catch'](handleError(_0x40b390,null));};exports[_0xbd37('0x20')]=function(_0x597b43,_0x1e4147){if(_0x597b43[_0xbd37('0x44')]['id']){delete _0x597b43[_0xbd37('0x44')]['id'];}return db[_0xbd37('0x26')][_0xbd37('0x42')]({'where':{'id':_0x597b43[_0xbd37('0x40')]['id']}})[_0xbd37('0x21')](handleEntityNotFound(_0x1e4147,null))['then'](saveUpdates(_0x597b43[_0xbd37('0x44')],null))[_0xbd37('0x21')](respondWithResult(_0x1e4147,null))['catch'](handleError(_0x1e4147,null));};exports[_0xbd37('0x45')]=function(_0x196af3,_0x179eab){return db[_0xbd37('0x26')][_0xbd37('0x42')]({'where':{'id':_0x196af3[_0xbd37('0x40')]['id']}})[_0xbd37('0x21')](handleEntityNotFound(_0x179eab,null))[_0xbd37('0x21')](removeEntity(_0x179eab,null))[_0xbd37('0x3e')](handleError(_0x179eab,null));};exports['describe']=function(_0x3386e3,_0x253952){return db[_0xbd37('0x26')][_0xbd37('0x46')]()[_0xbd37('0x21')](respondWithResult(_0x253952,null))[_0xbd37('0x3e')](handleError(_0x253952,null));}; \ No newline at end of file +var _0x4e3c=['rows','catch','show','params','find','create','body','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../config/license/hardware','api','sendStatus','status','json','count','offset','set','Content-Range','apply','update','destroy','then','end','error','stack','name','index','map','VoiceAgentReport','rawAttributes','fieldName','key','query','keys','filters','intersection','attributes','model','fields','length','nolimit','limit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','findAll'];(function(_0x25b729,_0x5ae23b){var _0x9ae96a=function(_0x50b9bf){while(--_0x50b9bf){_0x25b729['push'](_0x25b729['shift']());}};_0x9ae96a(++_0x5ae23b);}(_0x4e3c,0x1f2));var _0xc4e3=function(_0x3e23fd,_0x324cb8){_0x3e23fd=_0x3e23fd-0x0;var _0x23e70d=_0x4e3c[_0x3e23fd];return _0x23e70d;};'use strict';var pdf=require(_0xc4e3('0x0'));var emlformat=require(_0xc4e3('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xc4e3('0x2'));var jsonpatch=require(_0xc4e3('0x3'));var rp=require(_0xc4e3('0x4'));var moment=require(_0xc4e3('0x5'));var BPromise=require(_0xc4e3('0x6'));var Mustache=require(_0xc4e3('0x7'));var util=require(_0xc4e3('0x8'));var path=require(_0xc4e3('0x9'));var sox=require(_0xc4e3('0xa'));var csv=require(_0xc4e3('0xb'));var ejs=require('ejs');var fs=require('fs');var _=require(_0xc4e3('0xc'));var squel=require(_0xc4e3('0xd'));var crypto=require(_0xc4e3('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xc4e3('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc4e3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc4e3('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc4e3('0x12'));var logger=require('../../config/logger')(_0xc4e3('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4bdb9b,_0x1847b4){_0x1847b4=_0x1847b4||0xcc;return function(_0x3ab42d){if(_0x3ab42d){return _0x4bdb9b[_0xc4e3('0x14')](_0x1847b4);}return _0x4bdb9b[_0xc4e3('0x15')](_0x1847b4)['end']();};}function respondWithResult(_0x3c6835,_0x3161d5){_0x3161d5=_0x3161d5||0xc8;return function(_0x51be3c){if(_0x51be3c){return _0x3c6835['status'](_0x3161d5)[_0xc4e3('0x16')](_0x51be3c);}};}function respondWithFilteredResult(_0x7a310,_0x4859f7){return function(_0x22f516){if(_0x22f516){var _0x4671e6=_0x22f516[_0xc4e3('0x17')],_0x4f2d2f=_0x4859f7[_0xc4e3('0x18')],_0xadf27d=_0x4859f7[_0xc4e3('0x18')]+_0x4859f7['limit'],_0xd1ec36;if(_0xadf27d>=_0x4671e6){_0xadf27d=_0x4671e6;_0xd1ec36=0xc8;}else{_0xd1ec36=0xce;}_0x7a310[_0xc4e3('0x15')](_0xd1ec36);return _0x7a310[_0xc4e3('0x19')](_0xc4e3('0x1a'),_0x4f2d2f+'-'+_0xadf27d+'/'+_0x4671e6)[_0xc4e3('0x16')](_0x22f516);}return null;};}function patchUpdates(_0x5a5424){return function(_0x17df42){try{jsonpatch[_0xc4e3('0x1b')](_0x17df42,_0x5a5424,!![]);}catch(_0x5c22d7){return BPromise['reject'](_0x5c22d7);}return _0x17df42['save']();};}function saveUpdates(_0x2d1ac0,_0x278fe7){return function(_0x46c7e6){if(_0x46c7e6){return _0x46c7e6[_0xc4e3('0x1c')](_0x2d1ac0)['then'](function(_0x14bef8){return _0x14bef8;});}return null;};}function removeEntity(_0xc388b8,_0x42ab56){return function(_0x331559){if(_0x331559){return _0x331559[_0xc4e3('0x1d')]()[_0xc4e3('0x1e')](function(){_0xc388b8[_0xc4e3('0x15')](0xcc)[_0xc4e3('0x1f')]();});}};}function handleEntityNotFound(_0x1f768d,_0x650cc3){return function(_0x11ff42){if(!_0x11ff42){_0x1f768d[_0xc4e3('0x14')](0x194);}return _0x11ff42;};}function handleError(_0x1aea66,_0x13192e){_0x13192e=_0x13192e||0x1f4;return function(_0x4d25e6){logger[_0xc4e3('0x20')](_0x4d25e6[_0xc4e3('0x21')]);if(_0x4d25e6['name']){delete _0x4d25e6[_0xc4e3('0x22')];}_0x1aea66['status'](_0x13192e)['send'](_0x4d25e6);};}exports[_0xc4e3('0x23')]=function(_0x45ecf1,_0x1acaaf){var _0x1296b0={},_0x56e42a={},_0x469abb={'count':0x0,'rows':[]};var _0x539bda=_[_0xc4e3('0x24')](db[_0xc4e3('0x25')][_0xc4e3('0x26')],function(_0x31ca31){return{'name':_0x31ca31[_0xc4e3('0x27')],'type':_0x31ca31['type'][_0xc4e3('0x28')]};});_0x56e42a['model']=_['map'](_0x539bda,_0xc4e3('0x22'));_0x56e42a[_0xc4e3('0x29')]=_[_0xc4e3('0x2a')](_0x45ecf1[_0xc4e3('0x29')]);_0x56e42a[_0xc4e3('0x2b')]=_[_0xc4e3('0x2c')](_0x56e42a['model'],_0x56e42a[_0xc4e3('0x29')]);_0x1296b0[_0xc4e3('0x2d')]=_[_0xc4e3('0x2c')](_0x56e42a[_0xc4e3('0x2e')],qs[_0xc4e3('0x2f')](_0x45ecf1[_0xc4e3('0x29')]['fields']));_0x1296b0['attributes']=_0x1296b0[_0xc4e3('0x2d')][_0xc4e3('0x30')]?_0x1296b0[_0xc4e3('0x2d')]:_0x56e42a['model'];if(!_0x45ecf1[_0xc4e3('0x29')]['hasOwnProperty'](_0xc4e3('0x31'))){_0x1296b0['limit']=qs[_0xc4e3('0x32')](_0x45ecf1[_0xc4e3('0x29')][_0xc4e3('0x32')]);_0x1296b0[_0xc4e3('0x18')]=qs['offset'](_0x45ecf1[_0xc4e3('0x29')][_0xc4e3('0x18')]);}_0x1296b0[_0xc4e3('0x33')]=qs['sort'](_0x45ecf1[_0xc4e3('0x29')][_0xc4e3('0x34')]);_0x1296b0['where']=qs['filters'](_[_0xc4e3('0x35')](_0x45ecf1['query'],_0x56e42a[_0xc4e3('0x2b')]));if(_0x45ecf1[_0xc4e3('0x29')][_0xc4e3('0x36')]){_0x1296b0['where']=_[_0xc4e3('0x37')](_0x1296b0[_0xc4e3('0x38')],{'$or':_[_0xc4e3('0x24')](_0x539bda,function(_0x1237b0){if(_0x1237b0['type']!==_0xc4e3('0x39')){var _0x2ab6bb={};_0x2ab6bb[_0x1237b0['name']]={'$like':'%'+_0x45ecf1['query']['filter']+'%'};return _0x2ab6bb;}})});}_0x1296b0=_['merge']({},_0x1296b0,_0x45ecf1[_0xc4e3('0x3a')]);var _0x69dab4={'where':_0x1296b0[_0xc4e3('0x38')]};return db[_0xc4e3('0x25')][_0xc4e3('0x17')](_0x69dab4)['then'](function(_0x5268df){_0x469abb[_0xc4e3('0x17')]=_0x5268df;if(_0x45ecf1['query'][_0xc4e3('0x3b')]){_0x1296b0[_0xc4e3('0x3c')]=[{'all':!![]}];}return db[_0xc4e3('0x25')][_0xc4e3('0x3d')](_0x1296b0);})[_0xc4e3('0x1e')](function(_0x176574){_0x469abb[_0xc4e3('0x3e')]=_0x176574;return _0x469abb;})[_0xc4e3('0x1e')](respondWithFilteredResult(_0x1acaaf,_0x1296b0))[_0xc4e3('0x3f')](handleError(_0x1acaaf,null));};exports[_0xc4e3('0x40')]=function(_0x10d721,_0x209c60){var _0x47c157={'raw':![],'where':{'id':_0x10d721[_0xc4e3('0x41')]['id']}},_0x41c548={};_0x41c548[_0xc4e3('0x2e')]=_[_0xc4e3('0x2a')](db[_0xc4e3('0x25')][_0xc4e3('0x26')]);_0x41c548[_0xc4e3('0x29')]=_[_0xc4e3('0x2a')](_0x10d721['query']);_0x41c548[_0xc4e3('0x2b')]=_[_0xc4e3('0x2c')](_0x41c548['model'],_0x41c548[_0xc4e3('0x29')]);_0x47c157['attributes']=_['intersection'](_0x41c548['model'],qs[_0xc4e3('0x2f')](_0x10d721[_0xc4e3('0x29')][_0xc4e3('0x2f')]));_0x47c157[_0xc4e3('0x2d')]=_0x47c157['attributes']['length']?_0x47c157['attributes']:_0x41c548[_0xc4e3('0x2e')];if(_0x10d721[_0xc4e3('0x29')]['includeAll']){_0x47c157[_0xc4e3('0x3c')]=[{'all':!![]}];}_0x47c157=_[_0xc4e3('0x37')]({},_0x47c157,_0x10d721[_0xc4e3('0x3a')]);return db[_0xc4e3('0x25')][_0xc4e3('0x42')](_0x47c157)['then'](handleEntityNotFound(_0x209c60,null))[_0xc4e3('0x1e')](respondWithResult(_0x209c60,null))[_0xc4e3('0x3f')](handleError(_0x209c60,null));};exports[_0xc4e3('0x43')]=function(_0x14ea48,_0x1a9f09){return db['VoiceAgentReport']['create'](_0x14ea48[_0xc4e3('0x44')],{})[_0xc4e3('0x1e')](respondWithResult(_0x1a9f09,0xc9))[_0xc4e3('0x3f')](handleError(_0x1a9f09,null));};exports[_0xc4e3('0x1c')]=function(_0x2c5576,_0x42faf3){if(_0x2c5576[_0xc4e3('0x44')]['id']){delete _0x2c5576[_0xc4e3('0x44')]['id'];}return db[_0xc4e3('0x25')][_0xc4e3('0x42')]({'where':{'id':_0x2c5576[_0xc4e3('0x41')]['id']}})['then'](handleEntityNotFound(_0x42faf3,null))[_0xc4e3('0x1e')](saveUpdates(_0x2c5576[_0xc4e3('0x44')],null))[_0xc4e3('0x1e')](respondWithResult(_0x42faf3,null))['catch'](handleError(_0x42faf3,null));};exports[_0xc4e3('0x1d')]=function(_0x43b666,_0x291c4c){return db['VoiceAgentReport'][_0xc4e3('0x42')]({'where':{'id':_0x43b666[_0xc4e3('0x41')]['id']}})[_0xc4e3('0x1e')](handleEntityNotFound(_0x291c4c,null))[_0xc4e3('0x1e')](removeEntity(_0x291c4c,null))[_0xc4e3('0x3f')](handleError(_0x291c4c,null));};exports[_0xc4e3('0x45')]=function(_0x3e9134,_0x4c1b6d){return db[_0xc4e3('0x25')][_0xc4e3('0x45')]()[_0xc4e3('0x1e')](respondWithResult(_0x4c1b6d,null))['catch'](handleError(_0x4c1b6d,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index 2399921..673d4c7 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 _0xb190=['../../config/logger','api','bluebird','path','exports','VoiceAgentReport','lodash','util'];(function(_0x4fe7ae,_0x2a9bc9){var _0x2c5722=function(_0x49754e){while(--_0x49754e){_0x4fe7ae['push'](_0x4fe7ae['shift']());}};_0x2c5722(++_0x2a9bc9);}(_0xb190,0xce));var _0x0b19=function(_0x111f58,_0x3f9421){_0x111f58=_0x111f58-0x0;var _0x336488=_0xb190[_0x111f58];return _0x336488;};'use strict';var _=require(_0x0b19('0x0'));var util=require(_0x0b19('0x1'));var logger=require(_0x0b19('0x2'))(_0x0b19('0x3'));var moment=require('moment');var BPromise=require(_0x0b19('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0b19('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceAgentReport.attributes');module[_0x0b19('0x6')]=function(_0x81dca3,_0x2de62d){return _0x81dca3['define'](_0x0b19('0x7'),attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':['uniqueid','destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x8446=['report_agent','lodash','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x297c55,_0x34fa75){var _0x120389=function(_0x595108){while(--_0x595108){_0x297c55['push'](_0x297c55['shift']());}};_0x120389(++_0x34fa75);}(_0x8446,0xfb));var _0x6844=function(_0x500dd2,_0x23bd28){_0x500dd2=_0x500dd2-0x0;var _0xa7c859=_0x8446[_0x500dd2];return _0xa7c859;};'use strict';var _=require(_0x6844('0x0'));var util=require(_0x6844('0x1'));var logger=require(_0x6844('0x2'))(_0x6844('0x3'));var moment=require('moment');var BPromise=require(_0x6844('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6844('0x5'));var config=require(_0x6844('0x6'));var attributes=require(_0x6844('0x7'));module[_0x6844('0x8')]=function(_0x5575a2,_0x252367){return _0x5575a2['define']('VoiceAgentReport',attributes,{'tableName':_0x6844('0x9'),'paranoid':![],'indexes':[{'fields':['uniqueid','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 007bb20..167a3d7 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 _0x6484=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','debug','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','UpdateVoiceAgentReport','update','where','limit','lodash','util','moment','bluebird','randomstring'];(function(_0x224361,_0x1a7924){var _0x32678c=function(_0x331660){while(--_0x331660){_0x224361['push'](_0x224361['shift']());}};_0x32678c(++_0x1a7924);}(_0x6484,0x64));var _0x4648=function(_0x112e39,_0x39e445){_0x112e39=_0x112e39-0x0;var _0xd883de=_0x6484[_0x112e39];return _0xd883de;};'use strict';var _=require(_0x4648('0x0'));var util=require(_0x4648('0x1'));var moment=require(_0x4648('0x2'));var BPromise=require(_0x4648('0x3'));var rs=require(_0x4648('0x4'));var fs=require('fs');var Redis=require(_0x4648('0x5'));var db=require(_0x4648('0x6'))['db'];var utils=require(_0x4648('0x7'));var logger=require(_0x4648('0x8'))(_0x4648('0x9'));var config=require('../../config/environment');var jayson=require(_0x4648('0xa'));var client=jayson[_0x4648('0xb')][_0x4648('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x37efab,_0x284f92,_0x467e26){return new BPromise(function(_0x598072,_0xdd8612){return client[_0x4648('0xd')](_0x37efab,_0x467e26)[_0x4648('0xe')](function(_0x5ea0e2){logger[_0x4648('0xf')](_0x4648('0x10'),_0x284f92,_0x4648('0x11'));logger[_0x4648('0x12')](_0x4648('0x13'),_0x284f92,_0x4648('0x11'),JSON[_0x4648('0x14')](_0x5ea0e2));if(_0x5ea0e2[_0x4648('0x15')]){if(_0x5ea0e2[_0x4648('0x15')][_0x4648('0x16')]===0x1f4){logger[_0x4648('0x15')](_0x4648('0x10'),_0x284f92,_0x5ea0e2[_0x4648('0x15')][_0x4648('0x17')]);return _0xdd8612(_0x5ea0e2[_0x4648('0x15')][_0x4648('0x17')]);}logger[_0x4648('0x15')]('VoiceAgentReport,\x20%s,\x20%s',_0x284f92,_0x5ea0e2[_0x4648('0x15')]['message']);return _0x598072(_0x5ea0e2[_0x4648('0x15')][_0x4648('0x17')]);}else{logger[_0x4648('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x284f92,_0x4648('0x11'));_0x598072(_0x5ea0e2['result'][_0x4648('0x17')]);}})[_0x4648('0x18')](function(_0x5890a7){logger['error']('VoiceAgentReport,\x20%s,\x20%s',_0x284f92,_0x5890a7);_0xdd8612(_0x5890a7);});});}exports[_0x4648('0x19')]=function(_0x5d608b){var _0x2fc0c2=this;return new Promise(function(_0x1dd805,_0x4b304a){return db[_0x4648('0x1a')][_0x4648('0x1b')](_0x5d608b[_0x4648('0x1c')],{'raw':_0x5d608b['options']?_0x5d608b[_0x4648('0x1d')][_0x4648('0x1e')]===undefined?!![]:![]:!![]})[_0x4648('0xe')](function(_0xb022b8){logger[_0x4648('0xf')](_0x4648('0x19'),_0x5d608b);logger[_0x4648('0x12')](_0x4648('0x19'),_0x5d608b,JSON[_0x4648('0x14')](_0xb022b8));_0x1dd805(_0xb022b8);})[_0x4648('0x18')](function(_0x481965){logger[_0x4648('0x15')](_0x4648('0x19'),_0x481965['message'],_0x5d608b);_0x4b304a(_0x2fc0c2[_0x4648('0x15')](0x1f4,_0x481965['message']));});});};exports[_0x4648('0x1f')]=function(_0x197a4d){var _0x480e4c=this;return new Promise(function(_0x4118a7,_0x2ff371){return db[_0x4648('0x1a')][_0x4648('0x20')](_0x197a4d[_0x4648('0x1c')],{'raw':_0x197a4d[_0x4648('0x1d')]?_0x197a4d[_0x4648('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x197a4d['options']?_0x197a4d[_0x4648('0x1d')][_0x4648('0x21')]||null:null,'attributes':_0x197a4d['options']?_0x197a4d[_0x4648('0x1d')]['attributes']||null:null,'limit':_0x197a4d[_0x4648('0x1d')]?_0x197a4d[_0x4648('0x1d')][_0x4648('0x22')]||null:null})['then'](function(_0x3f4355){logger[_0x4648('0xf')]('UpdateVoiceAgentReport',_0x197a4d);logger[_0x4648('0x12')](_0x4648('0x1f'),_0x197a4d,JSON[_0x4648('0x14')](_0x3f4355));_0x4118a7(_0x3f4355);})['catch'](function(_0x206c60){logger[_0x4648('0x15')](_0x4648('0x1f'),_0x206c60[_0x4648('0x17')],_0x197a4d);_0x2ff371(_0x480e4c['error'](0x1f4,_0x206c60['message']));});});}; \ No newline at end of file +var _0x1be9=['UpdateVoiceAgentReport','update','where','attributes','then','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','CreateVoiceAgentReport','VoiceAgentReport','create','body','options','raw','catch'];(function(_0x2a3b0b,_0x51c1cb){var _0xcb702d=function(_0x22e5bf){while(--_0x22e5bf){_0x2a3b0b['push'](_0x2a3b0b['shift']());}};_0xcb702d(++_0x51c1cb);}(_0x1be9,0x116));var _0x91be=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x1be9[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x91be('0x0'));var util=require(_0x91be('0x1'));var moment=require(_0x91be('0x2'));var BPromise=require(_0x91be('0x3'));var rs=require(_0x91be('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x91be('0x5'))['db'];var utils=require(_0x91be('0x6'));var logger=require(_0x91be('0x7'))(_0x91be('0x8'));var config=require(_0x91be('0x9'));var jayson=require(_0x91be('0xa'));var client=jayson['client'][_0x91be('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x25f330,_0x569fa7,_0x53f1a7){return new BPromise(function(_0x15de96,_0x113486){return client['request'](_0x25f330,_0x53f1a7)['then'](function(_0x4340ad){logger[_0x91be('0xc')](_0x91be('0xd'),_0x569fa7,_0x91be('0xe'));logger['debug'](_0x91be('0xf'),_0x569fa7,_0x91be('0xe'),JSON[_0x91be('0x10')](_0x4340ad));if(_0x4340ad[_0x91be('0x11')]){if(_0x4340ad[_0x91be('0x11')][_0x91be('0x12')]===0x1f4){logger[_0x91be('0x11')](_0x91be('0xd'),_0x569fa7,_0x4340ad[_0x91be('0x11')][_0x91be('0x13')]);return _0x113486(_0x4340ad[_0x91be('0x11')]['message']);}logger[_0x91be('0x11')](_0x91be('0xd'),_0x569fa7,_0x4340ad[_0x91be('0x11')][_0x91be('0x13')]);return _0x15de96(_0x4340ad['error'][_0x91be('0x13')]);}else{logger[_0x91be('0xc')](_0x91be('0xd'),_0x569fa7,_0x91be('0xe'));_0x15de96(_0x4340ad[_0x91be('0x14')][_0x91be('0x13')]);}})['catch'](function(_0x292131){logger[_0x91be('0x11')]('VoiceAgentReport,\x20%s,\x20%s',_0x569fa7,_0x292131);_0x113486(_0x292131);});});}exports[_0x91be('0x15')]=function(_0x514d7e){var _0x5f5022=this;return new Promise(function(_0x3ff3a7,_0x23df77){return db[_0x91be('0x16')][_0x91be('0x17')](_0x514d7e[_0x91be('0x18')],{'raw':_0x514d7e[_0x91be('0x19')]?_0x514d7e[_0x91be('0x19')][_0x91be('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x32dd74){logger[_0x91be('0xc')]('CreateVoiceAgentReport',_0x514d7e);logger['debug'](_0x91be('0x15'),_0x514d7e,JSON[_0x91be('0x10')](_0x32dd74));_0x3ff3a7(_0x32dd74);})[_0x91be('0x1b')](function(_0x35a762){logger['error']('CreateVoiceAgentReport',_0x35a762[_0x91be('0x13')],_0x514d7e);_0x23df77(_0x5f5022[_0x91be('0x11')](0x1f4,_0x35a762[_0x91be('0x13')]));});});};exports[_0x91be('0x1c')]=function(_0x609103){var _0x529558=this;return new Promise(function(_0x2a890c,_0x2e1bcb){return db[_0x91be('0x16')][_0x91be('0x1d')](_0x609103[_0x91be('0x18')],{'raw':_0x609103[_0x91be('0x19')]?_0x609103[_0x91be('0x19')][_0x91be('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x609103[_0x91be('0x19')]?_0x609103['options'][_0x91be('0x1e')]||null:null,'attributes':_0x609103[_0x91be('0x19')]?_0x609103[_0x91be('0x19')][_0x91be('0x1f')]||null:null,'limit':_0x609103[_0x91be('0x19')]?_0x609103[_0x91be('0x19')]['limit']||null:null})[_0x91be('0x20')](function(_0x13e7e6){logger['info'](_0x91be('0x1c'),_0x609103);logger[_0x91be('0x21')]('UpdateVoiceAgentReport',_0x609103,JSON['stringify'](_0x13e7e6));_0x2a890c(_0x13e7e6);})[_0x91be('0x1b')](function(_0x1a1bcb){logger[_0x91be('0x11')](_0x91be('0x1c'),_0x1a1bcb['message'],_0x609103);_0x2e1bcb(_0x529558[_0x91be('0x11')](0x1f4,_0x1a1bcb[_0x91be('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 655c736..196ec49 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 _0xaf61=['multer','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','exports'];(function(_0x513863,_0x44062e){var _0x90ac2f=function(_0xe94c5d){while(--_0xe94c5d){_0x513863['push'](_0x513863['shift']());}};_0x90ac2f(++_0x44062e);}(_0xaf61,0x126));var _0x1af6=function(_0x3889f6,_0x5b50d3){_0x3889f6=_0x3889f6-0x0;var _0x17c783=_0xaf61[_0x3889f6];return _0x17c783;};'use strict';var multer=require(_0x1af6('0x0'));var util=require('util');var path=require(_0x1af6('0x1'));var timeout=require(_0x1af6('0x2'));var express=require(_0x1af6('0x3'));var router=express[_0x1af6('0x4')]();var auth=require(_0x1af6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x1af6('0x6'));var controller=require(_0x1af6('0x7'));router[_0x1af6('0x8')]('/',auth[_0x1af6('0x9')](),controller[_0x1af6('0xa')]);router[_0x1af6('0x8')](_0x1af6('0xb'),auth[_0x1af6('0x9')](),controller[_0x1af6('0xc')]);router['get'](_0x1af6('0xd'),auth['isAuthenticated'](),controller['show']);router[_0x1af6('0xe')]('/',auth[_0x1af6('0x9')](),controller[_0x1af6('0xf')]);router[_0x1af6('0x10')](_0x1af6('0xd'),auth[_0x1af6('0x9')](),controller[_0x1af6('0x11')]);router[_0x1af6('0x12')](_0x1af6('0xd'),auth[_0x1af6('0x9')](),controller[_0x1af6('0x13')]);module[_0x1af6('0x14')]=router; \ No newline at end of file +var _0xab8a=['/:id','update','delete','destroy','exports','multer','util','path','express','../../components/interaction/service','./voiceCallReport.controller','get','isAuthenticated','index','/describe','post','put'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xab8a,0x9e));var _0xaab8=function(_0x31a371,_0x50828e){_0x31a371=_0x31a371-0x0;var _0x2a5bd6=_0xab8a[_0x31a371];return _0x2a5bd6;};'use strict';var multer=require(_0xaab8('0x0'));var util=require(_0xaab8('0x1'));var path=require(_0xaab8('0x2'));var timeout=require('connect-timeout');var express=require(_0xaab8('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xaab8('0x4'));var config=require('../../config/environment');var controller=require(_0xaab8('0x5'));router[_0xaab8('0x6')]('/',auth[_0xaab8('0x7')](),controller[_0xaab8('0x8')]);router[_0xaab8('0x6')](_0xaab8('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0xaab8('0x6')]('/:id',auth[_0xaab8('0x7')](),controller['show']);router[_0xaab8('0xa')]('/',auth[_0xaab8('0x7')](),controller['create']);router[_0xaab8('0xb')](_0xaab8('0xc'),auth[_0xaab8('0x7')](),controller[_0xaab8('0xd')]);router[_0xaab8('0xe')](_0xaab8('0xc'),auth[_0xaab8('0x7')](),controller[_0xaab8('0xf')]);module[_0xaab8('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 874b7a8..4ef8443 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(_0x58a6d2,_0x198bd5){var _0x33bd7d=function(_0x376676){while(--_0x376676){_0x58a6d2['push'](_0x58a6d2['shift']());}};_0x33bd7d(++_0x198bd5);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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(_0xb1496a,_0x190543){var _0x301916=function(_0x4e17ab){while(--_0x4e17ab){_0xb1496a['push'](_0xb1496a['shift']());}};_0x301916(++_0x190543);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xa9e0[_0x5783f4];return _0x28e380;};'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 c98a81f..3a786ac 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 _0xc3ed=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','fullname','alias','User','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','uniqueid','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','Content-Range','apply','reject','save','update','then','destroy','end','error','name','send','index','map','VoiceCallReport','fieldName','key','model'];(function(_0x456ce9,_0x307b39){var _0x3bd143=function(_0x397790){while(--_0x397790){_0x456ce9['push'](_0x456ce9['shift']());}};_0x3bd143(++_0x307b39);}(_0xc3ed,0xc3));var _0xdc3e=function(_0x150a49,_0x47b070){_0x150a49=_0x150a49-0x0;var _0xe8c345=_0xc3ed[_0x150a49];return _0xe8c345;};'use strict';var pdf=require(_0xdc3e('0x0'));var emlformat=require(_0xdc3e('0x1'));var rimraf=require(_0xdc3e('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xdc3e('0x3'));var rp=require(_0xdc3e('0x4'));var moment=require(_0xdc3e('0x5'));var BPromise=require(_0xdc3e('0x6'));var Mustache=require(_0xdc3e('0x7'));var util=require('util');var path=require(_0xdc3e('0x8'));var sox=require('sox');var csv=require(_0xdc3e('0x9'));var ejs=require(_0xdc3e('0xa'));var fs=require('fs');var _=require(_0xdc3e('0xb'));var squel=require(_0xdc3e('0xc'));var crypto=require(_0xdc3e('0xd'));var jsforce=require(_0xdc3e('0xe'));var deskjs=require(_0xdc3e('0xf'));var toCsv=require(_0xdc3e('0x9'));var querystring=require(_0xdc3e('0x10'));var Papa=require(_0xdc3e('0x11'));var Redis=require('ioredis');var authService=require(_0xdc3e('0x12'));var qs=require(_0xdc3e('0x13'));var as=require(_0xdc3e('0x14'));var hardwareService=require(_0xdc3e('0x15'));var logger=require(_0xdc3e('0x16'))(_0xdc3e('0x17'));var utils=require('../../config/utils');var config=require(_0xdc3e('0x18'));var db=require(_0xdc3e('0x19'))['db'];function respondWithStatusCode(_0x15e25e,_0x34a45e){_0x34a45e=_0x34a45e||0xcc;return function(_0x2e4c43){if(_0x2e4c43){return _0x15e25e[_0xdc3e('0x1a')](_0x34a45e);}return _0x15e25e['status'](_0x34a45e)['end']();};}function respondWithResult(_0x495efa,_0x1037a6){_0x1037a6=_0x1037a6||0xc8;return function(_0x10e062){if(_0x10e062){return _0x495efa[_0xdc3e('0x1b')](_0x1037a6)[_0xdc3e('0x1c')](_0x10e062);}};}function respondWithFilteredResult(_0x30670c,_0x513e0c){return function(_0x317718){if(_0x317718){var _0x2c4ec8=_0x317718[_0xdc3e('0x1d')],_0xd42189=_0x513e0c[_0xdc3e('0x1e')],_0x3cc046=_0x513e0c[_0xdc3e('0x1e')]+_0x513e0c['limit'],_0x3151f1;if(_0x3cc046>=_0x2c4ec8){_0x3cc046=_0x2c4ec8;_0x3151f1=0xc8;}else{_0x3151f1=0xce;}_0x30670c[_0xdc3e('0x1b')](_0x3151f1);return _0x30670c['set'](_0xdc3e('0x1f'),_0xd42189+'-'+_0x3cc046+'/'+_0x2c4ec8)[_0xdc3e('0x1c')](_0x317718);}return null;};}function patchUpdates(_0x1c8ba0){return function(_0x66c819){try{jsonpatch[_0xdc3e('0x20')](_0x66c819,_0x1c8ba0,!![]);}catch(_0x4c3d01){return BPromise[_0xdc3e('0x21')](_0x4c3d01);}return _0x66c819[_0xdc3e('0x22')]();};}function saveUpdates(_0x53ae30,_0x50b4d6){return function(_0x320e3e){if(_0x320e3e){return _0x320e3e[_0xdc3e('0x23')](_0x53ae30)[_0xdc3e('0x24')](function(_0x39fee1){return _0x39fee1;});}return null;};}function removeEntity(_0x347cd4,_0x1b75e7){return function(_0xd698cc){if(_0xd698cc){return _0xd698cc[_0xdc3e('0x25')]()[_0xdc3e('0x24')](function(){_0x347cd4[_0xdc3e('0x1b')](0xcc)[_0xdc3e('0x26')]();});}};}function handleEntityNotFound(_0x4564fe,_0x5b2fa9){return function(_0x24d5e8){if(!_0x24d5e8){_0x4564fe[_0xdc3e('0x1a')](0x194);}return _0x24d5e8;};}function handleError(_0x4ccbc5,_0x3e0723){_0x3e0723=_0x3e0723||0x1f4;return function(_0x10eb63){logger[_0xdc3e('0x27')](_0x10eb63['stack']);if(_0x10eb63[_0xdc3e('0x28')]){delete _0x10eb63['name'];}_0x4ccbc5['status'](_0x3e0723)[_0xdc3e('0x29')](_0x10eb63);};}exports[_0xdc3e('0x2a')]=function(_0xc3032,_0x78d060){var _0x3a4ead={},_0x2da974={},_0x589d6c={'count':0x0,'rows':[]};var _0x2fd6f9=_[_0xdc3e('0x2b')](db[_0xdc3e('0x2c')]['rawAttributes'],function(_0x5da05c){return{'name':_0x5da05c[_0xdc3e('0x2d')],'type':_0x5da05c['type'][_0xdc3e('0x2e')]};});_0x2da974[_0xdc3e('0x2f')]=_[_0xdc3e('0x2b')](_0x2fd6f9,_0xdc3e('0x28'));_0x2da974[_0xdc3e('0x30')]=_[_0xdc3e('0x31')](_0xc3032[_0xdc3e('0x30')]);_0x2da974[_0xdc3e('0x32')]=_[_0xdc3e('0x33')](_0x2da974[_0xdc3e('0x2f')],_0x2da974[_0xdc3e('0x30')]);_0x3a4ead[_0xdc3e('0x34')]=_[_0xdc3e('0x33')](_0x2da974[_0xdc3e('0x2f')],qs[_0xdc3e('0x35')](_0xc3032['query'][_0xdc3e('0x35')]));_0x3a4ead['attributes']=_0x3a4ead[_0xdc3e('0x34')][_0xdc3e('0x36')]?_0x3a4ead[_0xdc3e('0x34')]:_0x2da974[_0xdc3e('0x2f')];if(!_0xc3032[_0xdc3e('0x30')][_0xdc3e('0x37')](_0xdc3e('0x38'))){_0x3a4ead[_0xdc3e('0x39')]=qs['limit'](_0xc3032['query'][_0xdc3e('0x39')]);_0x3a4ead[_0xdc3e('0x1e')]=qs[_0xdc3e('0x1e')](_0xc3032['query']['offset']);}_0x3a4ead[_0xdc3e('0x3a')]=qs[_0xdc3e('0x3b')](_0xc3032[_0xdc3e('0x30')][_0xdc3e('0x3b')]);_0x3a4ead['where']=qs[_0xdc3e('0x32')](_[_0xdc3e('0x3c')](_0xc3032['query'],_0x2da974[_0xdc3e('0x32')]));if(_0xc3032[_0xdc3e('0x30')][_0xdc3e('0x3d')]){_0x3a4ead[_0xdc3e('0x3e')]=_[_0xdc3e('0x3f')](_0x3a4ead[_0xdc3e('0x3e')],{'$or':_[_0xdc3e('0x2b')](_0x2fd6f9,function(_0x4251e5){if(_0x4251e5['type']!==_0xdc3e('0x40')){var _0x46ba57={};_0x46ba57[_0x4251e5['name']]={'$like':'%'+_0xc3032[_0xdc3e('0x30')]['filter']+'%'};return _0x46ba57;}})});}_0x3a4ead=_[_0xdc3e('0x3f')]({},_0x3a4ead,_0xc3032[_0xdc3e('0x41')]);var _0x46a1bd={'where':_0x3a4ead[_0xdc3e('0x3e')]};return db['VoiceCallReport']['count'](_0x46a1bd)[_0xdc3e('0x24')](function(_0x2b480c){_0x589d6c['count']=_0x2b480c;if(_0xc3032[_0xdc3e('0x30')]['includeAll']){_0x3a4ead[_0xdc3e('0x42')]=[{'attributes':['id',_0xdc3e('0x28'),_0xdc3e('0x43'),_0xdc3e('0x44')],'model':db[_0xdc3e('0x45')],'as':_0xdc3e('0x45')}];}return db[_0xdc3e('0x2c')][_0xdc3e('0x46')](_0x3a4ead);})['then'](function(_0x44d9e0){_0x589d6c[_0xdc3e('0x47')]=_0x44d9e0;return _0x589d6c;})[_0xdc3e('0x24')](respondWithFilteredResult(_0x78d060,_0x3a4ead))[_0xdc3e('0x48')](handleError(_0x78d060,null));};exports[_0xdc3e('0x49')]=function(_0x3e27bc,_0x571314){var _0x5a58b1={'raw':!![],'where':{'id':_0x3e27bc[_0xdc3e('0x4a')]['id']}},_0x2855d3={};_0x2855d3[_0xdc3e('0x2f')]=_['keys'](db[_0xdc3e('0x2c')][_0xdc3e('0x4b')]);_0x2855d3[_0xdc3e('0x30')]=_['keys'](_0x3e27bc[_0xdc3e('0x30')]);_0x2855d3['filters']=_[_0xdc3e('0x33')](_0x2855d3['model'],_0x2855d3[_0xdc3e('0x30')]);_0x5a58b1[_0xdc3e('0x34')]=_['intersection'](_0x2855d3[_0xdc3e('0x2f')],qs[_0xdc3e('0x35')](_0x3e27bc['query']['fields']));_0x5a58b1[_0xdc3e('0x34')]=_0x5a58b1[_0xdc3e('0x34')]['length']?_0x5a58b1[_0xdc3e('0x34')]:_0x2855d3[_0xdc3e('0x2f')];if(_0x3e27bc[_0xdc3e('0x30')][_0xdc3e('0x4c')]){_0x5a58b1[_0xdc3e('0x42')]=[{'all':!![]}];}_0x5a58b1=_[_0xdc3e('0x3f')]({},_0x5a58b1,_0x3e27bc[_0xdc3e('0x41')]);return db['VoiceCallReport'][_0xdc3e('0x4d')](_0x5a58b1)[_0xdc3e('0x24')](handleEntityNotFound(_0x571314,null))[_0xdc3e('0x24')](respondWithResult(_0x571314,null))['catch'](handleError(_0x571314,null));};exports[_0xdc3e('0x4e')]=function(_0x32195b,_0x3eb9d3){return db[_0xdc3e('0x2c')][_0xdc3e('0x4e')](_0x32195b[_0xdc3e('0x4f')],{})[_0xdc3e('0x24')](respondWithResult(_0x3eb9d3,0xc9))[_0xdc3e('0x48')](handleError(_0x3eb9d3,null));};exports[_0xdc3e('0x25')]=function(_0x1dd796,_0x4abca4){return db[_0xdc3e('0x2c')]['find']({'where':{'id':_0x1dd796['params']['id']}})[_0xdc3e('0x24')](handleEntityNotFound(_0x4abca4,null))[_0xdc3e('0x24')](removeEntity(_0x4abca4,null))['catch'](handleError(_0x4abca4,null));};exports['describe']=function(_0x19cdb6,_0x3c1d81){return db[_0xdc3e('0x2c')]['describe']()[_0xdc3e('0x24')](respondWithResult(_0x3c1d81,null))[_0xdc3e('0x48')](handleError(_0x3c1d81,null));};exports[_0xdc3e('0x23')]=function(_0x5d5228,_0x3f966a){if(_0x5d5228[_0xdc3e('0x4f')]['uniqueid']){delete _0x5d5228['body'][_0xdc3e('0x50')];}return db[_0xdc3e('0x2c')][_0xdc3e('0x4d')]({'where':{'uniqueid':_0x5d5228['params']['id'],'UserId':{'$or':[null,_0x5d5228['user']['id']]}}})['then'](handleEntityNotFound(_0x3f966a,null))['then'](saveUpdates(_0x5d5228[_0xdc3e('0x4f')],null))['then'](respondWithResult(_0x3f966a,null))[_0xdc3e('0x48')](handleError(_0x3f966a,null));}; \ No newline at end of file +var _0x5a9b=['hasOwnProperty','sort','where','filter','VIRTUAL','merge','options','VoiceCallReport','then','include','fullname','alias','User','findAll','rows','catch','show','params','includeAll','create','body','find','describe','uniqueid','user','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','limit','set','Content-Range','apply','reject','save','destroy','sendStatus','error','stack','send','map','type','key','model','name','query','keys','filters','intersection','attributes','fields','length'];(function(_0x1c582b,_0x37af43){var _0x444b40=function(_0x18bbc8){while(--_0x18bbc8){_0x1c582b['push'](_0x1c582b['shift']());}};_0x444b40(++_0x37af43);}(_0x5a9b,0x103));var _0xb5a9=function(_0x59e06e,_0x3b453d){_0x59e06e=_0x59e06e-0x0;var _0xe2f12b=_0x5a9b[_0x59e06e];return _0xe2f12b;};'use strict';var pdf=require(_0xb5a9('0x0'));var emlformat=require(_0xb5a9('0x1'));var rimraf=require(_0xb5a9('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb5a9('0x3'));var rp=require(_0xb5a9('0x4'));var moment=require(_0xb5a9('0x5'));var BPromise=require(_0xb5a9('0x6'));var Mustache=require('mustache');var util=require(_0xb5a9('0x7'));var path=require(_0xb5a9('0x8'));var sox=require(_0xb5a9('0x9'));var csv=require(_0xb5a9('0xa'));var ejs=require(_0xb5a9('0xb'));var fs=require('fs');var _=require(_0xb5a9('0xc'));var squel=require(_0xb5a9('0xd'));var crypto=require(_0xb5a9('0xe'));var jsforce=require(_0xb5a9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb5a9('0x10'));var Papa=require(_0xb5a9('0x11'));var Redis=require(_0xb5a9('0x12'));var authService=require(_0xb5a9('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xb5a9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb5a9('0x15'))(_0xb5a9('0x16'));var utils=require(_0xb5a9('0x17'));var config=require(_0xb5a9('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x42d455,_0x5c4012){_0x5c4012=_0x5c4012||0xcc;return function(_0x4cffdf){if(_0x4cffdf){return _0x42d455['sendStatus'](_0x5c4012);}return _0x42d455[_0xb5a9('0x19')](_0x5c4012)[_0xb5a9('0x1a')]();};}function respondWithResult(_0x47b2fd,_0x4e1648){_0x4e1648=_0x4e1648||0xc8;return function(_0x4292d2){if(_0x4292d2){return _0x47b2fd[_0xb5a9('0x19')](_0x4e1648)[_0xb5a9('0x1b')](_0x4292d2);}};}function respondWithFilteredResult(_0x338467,_0x5b2abf){return function(_0x58907e){if(_0x58907e){var _0x14311c=_0x58907e[_0xb5a9('0x1c')],_0x5a4b10=_0x5b2abf[_0xb5a9('0x1d')],_0xb7df3b=_0x5b2abf[_0xb5a9('0x1d')]+_0x5b2abf[_0xb5a9('0x1e')],_0x44d600;if(_0xb7df3b>=_0x14311c){_0xb7df3b=_0x14311c;_0x44d600=0xc8;}else{_0x44d600=0xce;}_0x338467[_0xb5a9('0x19')](_0x44d600);return _0x338467[_0xb5a9('0x1f')](_0xb5a9('0x20'),_0x5a4b10+'-'+_0xb7df3b+'/'+_0x14311c)[_0xb5a9('0x1b')](_0x58907e);}return null;};}function patchUpdates(_0x23e8fb){return function(_0x4d6c87){try{jsonpatch[_0xb5a9('0x21')](_0x4d6c87,_0x23e8fb,!![]);}catch(_0x49c1a9){return BPromise[_0xb5a9('0x22')](_0x49c1a9);}return _0x4d6c87[_0xb5a9('0x23')]();};}function saveUpdates(_0xbccc03,_0x18529c){return function(_0x805050){if(_0x805050){return _0x805050['update'](_0xbccc03)['then'](function(_0x5920e0){return _0x5920e0;});}return null;};}function removeEntity(_0xe5dab,_0x463cdb){return function(_0x4aef1a){if(_0x4aef1a){return _0x4aef1a[_0xb5a9('0x24')]()['then'](function(){_0xe5dab[_0xb5a9('0x19')](0xcc)[_0xb5a9('0x1a')]();});}};}function handleEntityNotFound(_0x2705ae,_0x5a1763){return function(_0x4721bb){if(!_0x4721bb){_0x2705ae[_0xb5a9('0x25')](0x194);}return _0x4721bb;};}function handleError(_0x1c9227,_0x2a3912){_0x2a3912=_0x2a3912||0x1f4;return function(_0x4199ab){logger[_0xb5a9('0x26')](_0x4199ab[_0xb5a9('0x27')]);if(_0x4199ab['name']){delete _0x4199ab['name'];}_0x1c9227[_0xb5a9('0x19')](_0x2a3912)[_0xb5a9('0x28')](_0x4199ab);};}exports['index']=function(_0x56254f,_0x3aab56){var _0x1a890a={},_0x35fa08={},_0x563d8c={'count':0x0,'rows':[]};var _0x4e8166=_[_0xb5a9('0x29')](db['VoiceCallReport']['rawAttributes'],function(_0x26d556){return{'name':_0x26d556['fieldName'],'type':_0x26d556[_0xb5a9('0x2a')][_0xb5a9('0x2b')]};});_0x35fa08[_0xb5a9('0x2c')]=_['map'](_0x4e8166,_0xb5a9('0x2d'));_0x35fa08[_0xb5a9('0x2e')]=_[_0xb5a9('0x2f')](_0x56254f[_0xb5a9('0x2e')]);_0x35fa08[_0xb5a9('0x30')]=_[_0xb5a9('0x31')](_0x35fa08['model'],_0x35fa08['query']);_0x1a890a[_0xb5a9('0x32')]=_[_0xb5a9('0x31')](_0x35fa08[_0xb5a9('0x2c')],qs[_0xb5a9('0x33')](_0x56254f[_0xb5a9('0x2e')][_0xb5a9('0x33')]));_0x1a890a[_0xb5a9('0x32')]=_0x1a890a[_0xb5a9('0x32')][_0xb5a9('0x34')]?_0x1a890a['attributes']:_0x35fa08['model'];if(!_0x56254f['query'][_0xb5a9('0x35')]('nolimit')){_0x1a890a[_0xb5a9('0x1e')]=qs[_0xb5a9('0x1e')](_0x56254f[_0xb5a9('0x2e')][_0xb5a9('0x1e')]);_0x1a890a[_0xb5a9('0x1d')]=qs[_0xb5a9('0x1d')](_0x56254f[_0xb5a9('0x2e')][_0xb5a9('0x1d')]);}_0x1a890a['order']=qs[_0xb5a9('0x36')](_0x56254f[_0xb5a9('0x2e')]['sort']);_0x1a890a[_0xb5a9('0x37')]=qs[_0xb5a9('0x30')](_['pick'](_0x56254f[_0xb5a9('0x2e')],_0x35fa08[_0xb5a9('0x30')]));if(_0x56254f[_0xb5a9('0x2e')][_0xb5a9('0x38')]){_0x1a890a['where']=_['merge'](_0x1a890a['where'],{'$or':_[_0xb5a9('0x29')](_0x4e8166,function(_0x4adf33){if(_0x4adf33[_0xb5a9('0x2a')]!==_0xb5a9('0x39')){var _0x47dadb={};_0x47dadb[_0x4adf33[_0xb5a9('0x2d')]]={'$like':'%'+_0x56254f[_0xb5a9('0x2e')]['filter']+'%'};return _0x47dadb;}})});}_0x1a890a=_[_0xb5a9('0x3a')]({},_0x1a890a,_0x56254f[_0xb5a9('0x3b')]);var _0x4bc922={'where':_0x1a890a[_0xb5a9('0x37')]};return db[_0xb5a9('0x3c')][_0xb5a9('0x1c')](_0x4bc922)[_0xb5a9('0x3d')](function(_0x36cb85){_0x563d8c['count']=_0x36cb85;if(_0x56254f[_0xb5a9('0x2e')]['includeAll']){_0x1a890a[_0xb5a9('0x3e')]=[{'attributes':['id','name',_0xb5a9('0x3f'),_0xb5a9('0x40')],'model':db[_0xb5a9('0x41')],'as':_0xb5a9('0x41')}];}return db['VoiceCallReport'][_0xb5a9('0x42')](_0x1a890a);})['then'](function(_0x5c11d0){_0x563d8c[_0xb5a9('0x43')]=_0x5c11d0;return _0x563d8c;})[_0xb5a9('0x3d')](respondWithFilteredResult(_0x3aab56,_0x1a890a))[_0xb5a9('0x44')](handleError(_0x3aab56,null));};exports[_0xb5a9('0x45')]=function(_0x5b439d,_0x3b3beb){var _0x53b45a={'raw':!![],'where':{'id':_0x5b439d[_0xb5a9('0x46')]['id']}},_0xe4e4fd={};_0xe4e4fd[_0xb5a9('0x2c')]=_['keys'](db['VoiceCallReport']['rawAttributes']);_0xe4e4fd[_0xb5a9('0x2e')]=_[_0xb5a9('0x2f')](_0x5b439d[_0xb5a9('0x2e')]);_0xe4e4fd[_0xb5a9('0x30')]=_[_0xb5a9('0x31')](_0xe4e4fd[_0xb5a9('0x2c')],_0xe4e4fd[_0xb5a9('0x2e')]);_0x53b45a['attributes']=_[_0xb5a9('0x31')](_0xe4e4fd[_0xb5a9('0x2c')],qs[_0xb5a9('0x33')](_0x5b439d['query'][_0xb5a9('0x33')]));_0x53b45a[_0xb5a9('0x32')]=_0x53b45a['attributes'][_0xb5a9('0x34')]?_0x53b45a['attributes']:_0xe4e4fd[_0xb5a9('0x2c')];if(_0x5b439d['query'][_0xb5a9('0x47')]){_0x53b45a[_0xb5a9('0x3e')]=[{'all':!![]}];}_0x53b45a=_[_0xb5a9('0x3a')]({},_0x53b45a,_0x5b439d[_0xb5a9('0x3b')]);return db[_0xb5a9('0x3c')]['find'](_0x53b45a)[_0xb5a9('0x3d')](handleEntityNotFound(_0x3b3beb,null))[_0xb5a9('0x3d')](respondWithResult(_0x3b3beb,null))['catch'](handleError(_0x3b3beb,null));};exports[_0xb5a9('0x48')]=function(_0x5d3444,_0x546efa){return db[_0xb5a9('0x3c')][_0xb5a9('0x48')](_0x5d3444[_0xb5a9('0x49')],{})[_0xb5a9('0x3d')](respondWithResult(_0x546efa,0xc9))[_0xb5a9('0x44')](handleError(_0x546efa,null));};exports[_0xb5a9('0x24')]=function(_0xb39e9d,_0x3195c4){return db[_0xb5a9('0x3c')][_0xb5a9('0x4a')]({'where':{'id':_0xb39e9d[_0xb5a9('0x46')]['id']}})['then'](handleEntityNotFound(_0x3195c4,null))[_0xb5a9('0x3d')](removeEntity(_0x3195c4,null))['catch'](handleError(_0x3195c4,null));};exports['describe']=function(_0x59caec,_0x127c83){return db['VoiceCallReport'][_0xb5a9('0x4b')]()['then'](respondWithResult(_0x127c83,null))[_0xb5a9('0x44')](handleError(_0x127c83,null));};exports['update']=function(_0x26be4f,_0xdd9b0c){if(_0x26be4f[_0xb5a9('0x49')]['uniqueid']){delete _0x26be4f[_0xb5a9('0x49')][_0xb5a9('0x4c')];}return db[_0xb5a9('0x3c')][_0xb5a9('0x4a')]({'where':{'uniqueid':_0x26be4f['params']['id'],'UserId':{'$or':[null,_0x26be4f[_0xb5a9('0x4d')]['id']]}}})['then'](handleEntityNotFound(_0xdd9b0c,null))['then'](saveUpdates(_0x26be4f[_0xb5a9('0x49')],null))['then'](respondWithResult(_0xdd9b0c,null))[_0xb5a9('0x44')](handleError(_0xdd9b0c,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 1c2525c..ad8ab53 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 _0x33a6=['exports','VoiceCallReport','report_call','uniqueid','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./voiceCallReport.attributes'];(function(_0xec1513,_0x2486f5){var _0x110167=function(_0x568409){while(--_0x568409){_0xec1513['push'](_0xec1513['shift']());}};_0x110167(++_0x2486f5);}(_0x33a6,0x17a));var _0x633a=function(_0x257d87,_0x3b6dcd){_0x257d87=_0x257d87-0x0;var _0x305bf4=_0x33a6[_0x257d87];return _0x305bf4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x633a('0x0'))('api');var moment=require(_0x633a('0x1'));var BPromise=require(_0x633a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x633a('0x3'));var rimraf=require(_0x633a('0x4'));var config=require(_0x633a('0x5'));var attributes=require(_0x633a('0x6'));module[_0x633a('0x7')]=function(_0x5502b2,_0x3af3f5){return _0x5502b2['define'](_0x633a('0x8'),attributes,{'tableName':_0x633a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x633a('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5998=['uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','VoiceCallReport','report_call'];(function(_0x5e5820,_0x5e4cfd){var _0x2f7654=function(_0x510682){while(--_0x510682){_0x5e5820['push'](_0x5e5820['shift']());}};_0x2f7654(++_0x5e4cfd);}(_0x5998,0xeb));var _0x8599=function(_0x3708ea,_0x406786){_0x3708ea=_0x3708ea-0x0;var _0x3c0a70=_0x5998[_0x3708ea];return _0x3c0a70;};'use strict';var _=require(_0x8599('0x0'));var util=require(_0x8599('0x1'));var logger=require(_0x8599('0x2'))(_0x8599('0x3'));var moment=require(_0x8599('0x4'));var BPromise=require(_0x8599('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8599('0x6'));var rimraf=require('rimraf');var config=require(_0x8599('0x7'));var attributes=require('./voiceCallReport.attributes');module[_0x8599('0x8')]=function(_0x114bc8,_0x18f179){return _0x114bc8[_0x8599('0x9')](_0x8599('0xa'),attributes,{'tableName':_0x8599('0xb'),'paranoid':![],'indexes':[{'fields':[_0x8599('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 5585395..0ada188 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 _0x7b70=['error','message','result','catch','GetVoiceCallReport','options','attributes','limit','include','model','map','debug','CreateVoiceCallReport','raw','UpdateVoiceCallReport','VoiceCallReport','body','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x1ba8c6,_0xec5c5f){var _0x4a08cf=function(_0x16d16a){while(--_0x16d16a){_0x1ba8c6['push'](_0x1ba8c6['shift']());}};_0x4a08cf(++_0xec5c5f);}(_0x7b70,0xcb));var _0x07b7=function(_0x11c573,_0x9e7c6e){_0x11c573=_0x11c573-0x0;var _0x6b72de=_0x7b70[_0x11c573];return _0x6b72de;};'use strict';var _=require(_0x07b7('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x07b7('0x1'));var fs=require('fs');var Redis=require(_0x07b7('0x2'));var db=require(_0x07b7('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x07b7('0x4'))(_0x07b7('0x5'));var config=require(_0x07b7('0x6'));var jayson=require(_0x07b7('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x550995,_0x5b6d14,_0x113d07){return new BPromise(function(_0x59dda7,_0x1439b7){return client[_0x07b7('0x8')](_0x550995,_0x113d07)[_0x07b7('0x9')](function(_0x416188){logger[_0x07b7('0xa')](_0x07b7('0xb'),_0x5b6d14,_0x07b7('0xc'));logger['debug']('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x5b6d14,'request\x20sent',JSON[_0x07b7('0xd')](_0x416188));if(_0x416188[_0x07b7('0xe')]){if(_0x416188['error']['code']===0x1f4){logger[_0x07b7('0xe')](_0x07b7('0xb'),_0x5b6d14,_0x416188[_0x07b7('0xe')]['message']);return _0x1439b7(_0x416188['error']['message']);}logger['error'](_0x07b7('0xb'),_0x5b6d14,_0x416188['error'][_0x07b7('0xf')]);return _0x59dda7(_0x416188['error'][_0x07b7('0xf')]);}else{logger['info'](_0x07b7('0xb'),_0x5b6d14,_0x07b7('0xc'));_0x59dda7(_0x416188[_0x07b7('0x10')][_0x07b7('0xf')]);}})[_0x07b7('0x11')](function(_0x307d4f){logger[_0x07b7('0xe')](_0x07b7('0xb'),_0x5b6d14,_0x307d4f);_0x1439b7(_0x307d4f);});});}exports[_0x07b7('0x12')]=function(_0x409c16){var _0x44731f=this;return new Promise(function(_0x49c22e,_0x1bf6d4){return db['VoiceCallReport']['findAll']({'raw':_0x409c16[_0x07b7('0x13')]?_0x409c16[_0x07b7('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x409c16[_0x07b7('0x13')]?_0x409c16['options']['where']||null:null,'attributes':_0x409c16[_0x07b7('0x13')]?_0x409c16[_0x07b7('0x13')][_0x07b7('0x14')]||null:null,'limit':_0x409c16[_0x07b7('0x13')]?_0x409c16[_0x07b7('0x13')][_0x07b7('0x15')]||null:null,'include':_0x409c16['options']?_0x409c16[_0x07b7('0x13')][_0x07b7('0x16')]?_['map'](_0x409c16[_0x07b7('0x13')][_0x07b7('0x16')],function(_0x4d93f8){return{'model':db[_0x4d93f8[_0x07b7('0x17')]],'as':_0x4d93f8['as'],'attributes':_0x4d93f8[_0x07b7('0x14')],'include':_0x4d93f8[_0x07b7('0x16')]?_[_0x07b7('0x18')](_0x4d93f8[_0x07b7('0x16')],function(_0x2a924f){return{'model':db[_0x2a924f[_0x07b7('0x17')]],'as':_0x2a924f['as'],'attributes':_0x2a924f[_0x07b7('0x14')],'include':_0x2a924f[_0x07b7('0x16')]?_[_0x07b7('0x18')](_0x2a924f[_0x07b7('0x16')],function(_0x24ee57){return{'model':db[_0x24ee57[_0x07b7('0x17')]],'as':_0x24ee57['as'],'attributes':_0x24ee57[_0x07b7('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x8be6a5){logger[_0x07b7('0xa')](_0x07b7('0x12'),_0x409c16);logger[_0x07b7('0x19')]('GetVoiceCallReport',_0x409c16,JSON[_0x07b7('0xd')](_0x8be6a5));_0x49c22e(_0x8be6a5);})[_0x07b7('0x11')](function(_0x5d1f52){logger[_0x07b7('0xe')](_0x07b7('0x12'),_0x5d1f52[_0x07b7('0xf')],_0x409c16);_0x1bf6d4(_0x44731f[_0x07b7('0xe')](0x1f4,_0x5d1f52[_0x07b7('0xf')]));});});};exports[_0x07b7('0x1a')]=function(_0x5c8b53){var _0xb2c68b=this;return new Promise(function(_0xe88559,_0x52a651){return db['VoiceCallReport']['create'](_0x5c8b53['body'],{'raw':_0x5c8b53['options']?_0x5c8b53[_0x07b7('0x13')][_0x07b7('0x1b')]===undefined?!![]:![]:!![]})[_0x07b7('0x9')](function(_0x396705){logger[_0x07b7('0xa')](_0x07b7('0x1a'),_0x5c8b53);logger[_0x07b7('0x19')](_0x07b7('0x1a'),_0x5c8b53,JSON[_0x07b7('0xd')](_0x396705));_0xe88559(_0x396705);})[_0x07b7('0x11')](function(_0x3c0263){logger['error'](_0x07b7('0x1a'),_0x3c0263['message'],_0x5c8b53);_0x52a651(_0xb2c68b['error'](0x1f4,_0x3c0263[_0x07b7('0xf')]));});});};exports[_0x07b7('0x1c')]=function(_0x5a5248){var _0x2a23b0=this;return new Promise(function(_0x25a63d,_0x279ea5){return db[_0x07b7('0x1d')]['update'](_0x5a5248[_0x07b7('0x1e')],{'raw':_0x5a5248[_0x07b7('0x13')]?_0x5a5248[_0x07b7('0x13')][_0x07b7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5a5248[_0x07b7('0x13')]?_0x5a5248['options']['where']||null:null,'attributes':_0x5a5248['options']?_0x5a5248[_0x07b7('0x13')][_0x07b7('0x14')]||null:null,'limit':_0x5a5248['options']?_0x5a5248[_0x07b7('0x13')][_0x07b7('0x15')]||null:null})[_0x07b7('0x9')](function(_0x4f6daa){logger['info']('UpdateVoiceCallReport',_0x5a5248);logger[_0x07b7('0x19')](_0x07b7('0x1c'),_0x5a5248,JSON[_0x07b7('0xd')](_0x4f6daa));_0x25a63d(_0x4f6daa);})[_0x07b7('0x11')](function(_0x1ca46a){logger[_0x07b7('0xe')](_0x07b7('0x1c'),_0x1ca46a[_0x07b7('0xf')],_0x5a5248);_0x279ea5(_0x2a23b0[_0x07b7('0xe')](0x1f4,_0x1ca46a[_0x07b7('0xf')]));});});}; \ No newline at end of file +var _0x7e1b=['http','request','then','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceCallReport','findAll','options','where','limit','include','map','model','attributes','GetVoiceCallReport','CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x30fa99,_0x4a5db1){var _0x268542=function(_0x1f6a4b){while(--_0x1f6a4b){_0x30fa99['push'](_0x30fa99['shift']());}};_0x268542(++_0x4a5db1);}(_0x7e1b,0x17c));var _0xb7e1=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x7e1b[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require(_0xb7e1('0x0'));var util=require(_0xb7e1('0x1'));var moment=require('moment');var BPromise=require(_0xb7e1('0x2'));var rs=require(_0xb7e1('0x3'));var fs=require('fs');var Redis=require(_0xb7e1('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb7e1('0x5'));var logger=require(_0xb7e1('0x6'))(_0xb7e1('0x7'));var config=require('../../config/environment');var jayson=require(_0xb7e1('0x8'));var client=jayson[_0xb7e1('0x9')][_0xb7e1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bf7ad,_0x1dc01,_0x4617b2){return new BPromise(function(_0x3bf997,_0x456582){return client[_0xb7e1('0xb')](_0x5bf7ad,_0x4617b2)[_0xb7e1('0xc')](function(_0x569819){logger[_0xb7e1('0xd')](_0xb7e1('0xe'),_0x1dc01,_0xb7e1('0xf'));logger[_0xb7e1('0x10')](_0xb7e1('0x11'),_0x1dc01,'request\x20sent',JSON[_0xb7e1('0x12')](_0x569819));if(_0x569819[_0xb7e1('0x13')]){if(_0x569819[_0xb7e1('0x13')][_0xb7e1('0x14')]===0x1f4){logger['error'](_0xb7e1('0xe'),_0x1dc01,_0x569819[_0xb7e1('0x13')][_0xb7e1('0x15')]);return _0x456582(_0x569819[_0xb7e1('0x13')][_0xb7e1('0x15')]);}logger[_0xb7e1('0x13')]('VoiceCallReport,\x20%s,\x20%s',_0x1dc01,_0x569819[_0xb7e1('0x13')]['message']);return _0x3bf997(_0x569819['error'][_0xb7e1('0x15')]);}else{logger[_0xb7e1('0xd')](_0xb7e1('0xe'),_0x1dc01,'request\x20sent');_0x3bf997(_0x569819[_0xb7e1('0x16')][_0xb7e1('0x15')]);}})[_0xb7e1('0x17')](function(_0x564a9d){logger['error'](_0xb7e1('0xe'),_0x1dc01,_0x564a9d);_0x456582(_0x564a9d);});});}exports['GetVoiceCallReport']=function(_0x13b06c){var _0x331eb7=this;return new Promise(function(_0x4366b9,_0x4e203b){return db[_0xb7e1('0x18')][_0xb7e1('0x19')]({'raw':_0x13b06c[_0xb7e1('0x1a')]?_0x13b06c['options']['raw']===undefined?!![]:![]:!![],'where':_0x13b06c[_0xb7e1('0x1a')]?_0x13b06c['options'][_0xb7e1('0x1b')]||null:null,'attributes':_0x13b06c[_0xb7e1('0x1a')]?_0x13b06c[_0xb7e1('0x1a')]['attributes']||null:null,'limit':_0x13b06c[_0xb7e1('0x1a')]?_0x13b06c[_0xb7e1('0x1a')][_0xb7e1('0x1c')]||null:null,'include':_0x13b06c[_0xb7e1('0x1a')]?_0x13b06c['options'][_0xb7e1('0x1d')]?_[_0xb7e1('0x1e')](_0x13b06c[_0xb7e1('0x1a')]['include'],function(_0xfd37d1){return{'model':db[_0xfd37d1[_0xb7e1('0x1f')]],'as':_0xfd37d1['as'],'attributes':_0xfd37d1[_0xb7e1('0x20')],'include':_0xfd37d1[_0xb7e1('0x1d')]?_[_0xb7e1('0x1e')](_0xfd37d1[_0xb7e1('0x1d')],function(_0x16cddc){return{'model':db[_0x16cddc[_0xb7e1('0x1f')]],'as':_0x16cddc['as'],'attributes':_0x16cddc[_0xb7e1('0x20')],'include':_0x16cddc[_0xb7e1('0x1d')]?_[_0xb7e1('0x1e')](_0x16cddc[_0xb7e1('0x1d')],function(_0x436ea4){return{'model':db[_0x436ea4['model']],'as':_0x436ea4['as'],'attributes':_0x436ea4[_0xb7e1('0x20')]};}):[]};}):[]};}):[]:[]})[_0xb7e1('0xc')](function(_0x5b9df3){logger[_0xb7e1('0xd')](_0xb7e1('0x21'),_0x13b06c);logger[_0xb7e1('0x10')](_0xb7e1('0x21'),_0x13b06c,JSON[_0xb7e1('0x12')](_0x5b9df3));_0x4366b9(_0x5b9df3);})['catch'](function(_0x2f9de9){logger[_0xb7e1('0x13')]('GetVoiceCallReport',_0x2f9de9[_0xb7e1('0x15')],_0x13b06c);_0x4e203b(_0x331eb7['error'](0x1f4,_0x2f9de9[_0xb7e1('0x15')]));});});};exports[_0xb7e1('0x22')]=function(_0x3b5fde){var _0x7b5281=this;return new Promise(function(_0x4754ef,_0x119276){return db['VoiceCallReport'][_0xb7e1('0x23')](_0x3b5fde[_0xb7e1('0x24')],{'raw':_0x3b5fde[_0xb7e1('0x1a')]?_0x3b5fde[_0xb7e1('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xb7e1('0xc')](function(_0x2cc5b1){logger['info'](_0xb7e1('0x22'),_0x3b5fde);logger[_0xb7e1('0x10')]('CreateVoiceCallReport',_0x3b5fde,JSON[_0xb7e1('0x12')](_0x2cc5b1));_0x4754ef(_0x2cc5b1);})['catch'](function(_0x33c330){logger[_0xb7e1('0x13')]('CreateVoiceCallReport',_0x33c330[_0xb7e1('0x15')],_0x3b5fde);_0x119276(_0x7b5281[_0xb7e1('0x13')](0x1f4,_0x33c330[_0xb7e1('0x15')]));});});};exports[_0xb7e1('0x25')]=function(_0x5426c9){var _0x47709e=this;return new Promise(function(_0x273a19,_0x4602f1){return db[_0xb7e1('0x18')][_0xb7e1('0x26')](_0x5426c9[_0xb7e1('0x24')],{'raw':_0x5426c9['options']?_0x5426c9[_0xb7e1('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5426c9['options']?_0x5426c9[_0xb7e1('0x1a')][_0xb7e1('0x1b')]||null:null,'attributes':_0x5426c9[_0xb7e1('0x1a')]?_0x5426c9[_0xb7e1('0x1a')][_0xb7e1('0x20')]||null:null,'limit':_0x5426c9[_0xb7e1('0x1a')]?_0x5426c9['options']['limit']||null:null})['then'](function(_0x754a2d){logger[_0xb7e1('0xd')](_0xb7e1('0x25'),_0x5426c9);logger[_0xb7e1('0x10')]('UpdateVoiceCallReport',_0x5426c9,JSON[_0xb7e1('0x12')](_0x754a2d));_0x273a19(_0x754a2d);})[_0xb7e1('0x17')](function(_0x2d7d8e){logger['error'](_0xb7e1('0x25'),_0x2d7d8e[_0xb7e1('0x15')],_0x5426c9);_0x4602f1(_0x47709e[_0xb7e1('0x13')](0x1f4,_0x2d7d8e[_0xb7e1('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index a7f7cee..c53890e 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 _0x8ff3=['post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','get','index','/:id','isAuthenticated','show'];(function(_0x4745d9,_0x411b00){var _0x38f2ac=function(_0x436be3){while(--_0x436be3){_0x4745d9['push'](_0x4745d9['shift']());}};_0x38f2ac(++_0x411b00);}(_0x8ff3,0x72));var _0x38ff=function(_0x53fcd0,_0x294576){_0x53fcd0=_0x53fcd0-0x0;var _0x456acb=_0x8ff3[_0x53fcd0];return _0x456acb;};'use strict';var multer=require(_0x38ff('0x0'));var util=require(_0x38ff('0x1'));var path=require('path');var timeout=require(_0x38ff('0x2'));var express=require(_0x38ff('0x3'));var router=express[_0x38ff('0x4')]();var auth=require(_0x38ff('0x5'));var interaction=require(_0x38ff('0x6'));var config=require('../../config/environment');var controller=require('./voiceChanSpy.controller');router[_0x38ff('0x7')]('/',auth['isAuthenticated'](),controller[_0x38ff('0x8')]);router['get'](_0x38ff('0x9'),auth[_0x38ff('0xa')](),controller[_0x38ff('0xb')]);router[_0x38ff('0xc')]('/',auth[_0x38ff('0xa')](),controller[_0x38ff('0xd')]);router[_0x38ff('0xe')](_0x38ff('0x9'),auth[_0x38ff('0xa')](),controller[_0x38ff('0xf')]);router[_0x38ff('0x10')](_0x38ff('0x9'),auth[_0x38ff('0xa')](),controller['destroy']);module[_0x38ff('0x11')]=router; \ No newline at end of file +var _0x29b1=['isAuthenticated','index','/:id','show','post','put','update','delete','destroy','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','get'];(function(_0x393658,_0x4f642b){var _0x23f7e6=function(_0x37cc9d){while(--_0x37cc9d){_0x393658['push'](_0x393658['shift']());}};_0x23f7e6(++_0x4f642b);}(_0x29b1,0x13b));var _0x129b=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x29b1[_0x3ea913];return _0x2b4f28;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x129b('0x0'));var timeout=require(_0x129b('0x1'));var express=require(_0x129b('0x2'));var router=express[_0x129b('0x3')]();var auth=require(_0x129b('0x4'));var interaction=require(_0x129b('0x5'));var config=require(_0x129b('0x6'));var controller=require(_0x129b('0x7'));router[_0x129b('0x8')]('/',auth[_0x129b('0x9')](),controller[_0x129b('0xa')]);router['get'](_0x129b('0xb'),auth['isAuthenticated'](),controller[_0x129b('0xc')]);router[_0x129b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x129b('0xe')]('/:id',auth[_0x129b('0x9')](),controller[_0x129b('0xf')]);router[_0x129b('0x10')](_0x129b('0xb'),auth[_0x129b('0x9')](),controller[_0x129b('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6c5e39b..94f2945 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 _0x555b=['join','getDataValue','sequelize','exports','STRING','name','options'];(function(_0x13b02f,_0x462a53){var _0x12e9a6=function(_0x187d57){while(--_0x187d57){_0x13b02f['push'](_0x13b02f['shift']());}};_0x12e9a6(++_0x462a53);}(_0x555b,0x1de));var _0xb555=function(_0x480c86,_0x279ef1){_0x480c86=_0x480c86-0x0;var _0x3c4527=_0x555b[_0x480c86];return _0x3c4527;};'use strict';var Sequelize=require(_0xb555('0x0'));module[_0xb555('0x1')]={'name':{'type':Sequelize[_0xb555('0x2')]},'prefix':{'type':Sequelize[_0xb555('0x2')],'unique':_0xb555('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x46ee56){this['setDataValue'](_0xb555('0x4'),_0x46ee56?_0x46ee56[_0xb555('0x5')](''):[]);},'get':function(){return this[_0xb555('0x6')](_0xb555('0x4'))?this[_0xb555('0x6')](_0xb555('0x4'))['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xb555('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xb555('0x2')]},'description':{'type':Sequelize[_0xb555('0x2')]}}; \ No newline at end of file +var _0xa5d8=['exports','name','STRING','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0xa5d8,0x1b7));var _0x8a5d=function(_0xc11b27,_0x4d387e){_0xc11b27=_0xc11b27-0x0;var _0x237e70=_0xa5d8[_0xc11b27];return _0x237e70;};'use strict';var Sequelize=require(_0x8a5d('0x0'));module[_0x8a5d('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize['STRING'],'unique':_0x8a5d('0x2'),'allowNull':![]},'options':{'type':Sequelize[_0x8a5d('0x3')],'set':function(_0x3256fc){this[_0x8a5d('0x4')](_0x8a5d('0x5'),_0x3256fc?_0x3256fc[_0x8a5d('0x6')](''):[]);},'get':function(){return this[_0x8a5d('0x7')](_0x8a5d('0x5'))?this[_0x8a5d('0x7')](_0x8a5d('0x5'))[_0x8a5d('0x8')](''):[];}},'auth':{'type':Sequelize[_0x8a5d('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x8a5d('0x3')]},'record':{'type':Sequelize[_0x8a5d('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8a5d('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 874fa52..943090a 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 _0x89bf=['intersection','fields','attributes','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','rows','show','find','create','body','get','ChanSpies','autoAssociation','catch','params','html-pdf','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','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','count','offset','limit','set','Content-Range','json','reject','save','update','then','destroy','UserProfileResource','error','name','send','index','VoiceChanSpy','rawAttributes','fieldName','type','key','model','map','query','keys'];(function(_0x284885,_0x34b143){var _0x3a9710=function(_0x31eda3){while(--_0x31eda3){_0x284885['push'](_0x284885['shift']());}};_0x3a9710(++_0x34b143);}(_0x89bf,0xb5));var _0xf89b=function(_0x4a8788,_0x432f7e){_0x4a8788=_0x4a8788-0x0;var _0x547da5=_0x89bf[_0x4a8788];return _0x547da5;};'use strict';var pdf=require(_0xf89b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0xf89b('0x1'));var zipdir=require(_0xf89b('0x2'));var jsonpatch=require(_0xf89b('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf89b('0x4'));var Mustache=require(_0xf89b('0x5'));var util=require('util');var path=require(_0xf89b('0x6'));var sox=require(_0xf89b('0x7'));var csv=require(_0xf89b('0x8'));var ejs=require(_0xf89b('0x9'));var fs=require('fs');var _=require(_0xf89b('0xa'));var squel=require(_0xf89b('0xb'));var crypto=require(_0xf89b('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf89b('0xd'));var Papa=require(_0xf89b('0xe'));var Redis=require(_0xf89b('0xf'));var authService=require(_0xf89b('0x10'));var qs=require(_0xf89b('0x11'));var as=require(_0xf89b('0x12'));var hardwareService=require(_0xf89b('0x13'));var logger=require(_0xf89b('0x14'))(_0xf89b('0x15'));var utils=require(_0xf89b('0x16'));var config=require(_0xf89b('0x17'));var db=require(_0xf89b('0x18'))['db'];function respondWithStatusCode(_0x97cb1b,_0xd0bb76){_0xd0bb76=_0xd0bb76||0xcc;return function(_0x56f31b){if(_0x56f31b){return _0x97cb1b[_0xf89b('0x19')](_0xd0bb76);}return _0x97cb1b['status'](_0xd0bb76)[_0xf89b('0x1a')]();};}function respondWithResult(_0x549e90,_0x29de93){_0x29de93=_0x29de93||0xc8;return function(_0xe486f2){if(_0xe486f2){return _0x549e90[_0xf89b('0x1b')](_0x29de93)['json'](_0xe486f2);}};}function respondWithFilteredResult(_0x13cd9a,_0x1414a1){return function(_0x5e84ff){if(_0x5e84ff){var _0x51c6b1=_0x5e84ff[_0xf89b('0x1c')],_0x1d0239=_0x1414a1[_0xf89b('0x1d')],_0x1434c1=_0x1414a1['offset']+_0x1414a1[_0xf89b('0x1e')],_0x41444e;if(_0x1434c1>=_0x51c6b1){_0x1434c1=_0x51c6b1;_0x41444e=0xc8;}else{_0x41444e=0xce;}_0x13cd9a[_0xf89b('0x1b')](_0x41444e);return _0x13cd9a[_0xf89b('0x1f')](_0xf89b('0x20'),_0x1d0239+'-'+_0x1434c1+'/'+_0x51c6b1)[_0xf89b('0x21')](_0x5e84ff);}return null;};}function patchUpdates(_0x65d4bd){return function(_0x1c29a0){try{jsonpatch['apply'](_0x1c29a0,_0x65d4bd,!![]);}catch(_0x2dbdaf){return BPromise[_0xf89b('0x22')](_0x2dbdaf);}return _0x1c29a0[_0xf89b('0x23')]();};}function saveUpdates(_0x1d640d,_0x19250a){return function(_0x2112f6){if(_0x2112f6){return _0x2112f6[_0xf89b('0x24')](_0x1d640d)[_0xf89b('0x25')](function(_0x44b233){return _0x44b233;});}return null;};}function removeEntity(_0x1eafb4,_0x53bc88){return function(_0x19a638){if(_0x19a638){return _0x19a638[_0xf89b('0x26')]()[_0xf89b('0x25')](function(){var _0x229b9d=_0x19a638['get']({'plain':!![]});var _0x4e9bf8='ChanSpies';return db[_0xf89b('0x27')][_0xf89b('0x26')]({'where':{'type':_0x4e9bf8,'resourceId':_0x229b9d['id']}})['then'](function(){return _0x19a638;});})['then'](function(){_0x1eafb4[_0xf89b('0x1b')](0xcc)[_0xf89b('0x1a')]();});}};}function handleEntityNotFound(_0x2ebdd6,_0x925d81){return function(_0x405342){if(!_0x405342){_0x2ebdd6['sendStatus'](0x194);}return _0x405342;};}function handleError(_0x178199,_0x1de5c3){_0x1de5c3=_0x1de5c3||0x1f4;return function(_0x81a86){logger[_0xf89b('0x28')](_0x81a86['stack']);if(_0x81a86[_0xf89b('0x29')]){delete _0x81a86['name'];}_0x178199[_0xf89b('0x1b')](_0x1de5c3)[_0xf89b('0x2a')](_0x81a86);};}exports[_0xf89b('0x2b')]=function(_0x2e0ece,_0x55dd34){var _0x7135a4={},_0x4b627d={},_0x49fd39={'count':0x0,'rows':[]};var _0x3d74e9=_['map'](db[_0xf89b('0x2c')][_0xf89b('0x2d')],function(_0x30ba3b){return{'name':_0x30ba3b[_0xf89b('0x2e')],'type':_0x30ba3b[_0xf89b('0x2f')][_0xf89b('0x30')]};});_0x4b627d[_0xf89b('0x31')]=_[_0xf89b('0x32')](_0x3d74e9,_0xf89b('0x29'));_0x4b627d[_0xf89b('0x33')]=_[_0xf89b('0x34')](_0x2e0ece['query']);_0x4b627d['filters']=_[_0xf89b('0x35')](_0x4b627d[_0xf89b('0x31')],_0x4b627d[_0xf89b('0x33')]);_0x7135a4['attributes']=_[_0xf89b('0x35')](_0x4b627d[_0xf89b('0x31')],qs[_0xf89b('0x36')](_0x2e0ece[_0xf89b('0x33')]['fields']));_0x7135a4[_0xf89b('0x37')]=_0x7135a4[_0xf89b('0x37')][_0xf89b('0x38')]?_0x7135a4[_0xf89b('0x37')]:_0x4b627d[_0xf89b('0x31')];if(!_0x2e0ece['query'][_0xf89b('0x39')]('nolimit')){_0x7135a4[_0xf89b('0x1e')]=qs[_0xf89b('0x1e')](_0x2e0ece[_0xf89b('0x33')][_0xf89b('0x1e')]);_0x7135a4[_0xf89b('0x1d')]=qs['offset'](_0x2e0ece[_0xf89b('0x33')]['offset']);}_0x7135a4[_0xf89b('0x3a')]=qs[_0xf89b('0x3b')](_0x2e0ece[_0xf89b('0x33')][_0xf89b('0x3b')]);_0x7135a4[_0xf89b('0x3c')]=qs[_0xf89b('0x3d')](_[_0xf89b('0x3e')](_0x2e0ece[_0xf89b('0x33')],_0x4b627d['filters']));if(_0x2e0ece[_0xf89b('0x33')][_0xf89b('0x3f')]){_0x7135a4[_0xf89b('0x3c')]=_[_0xf89b('0x40')](_0x7135a4['where'],{'$or':_[_0xf89b('0x32')](_0x3d74e9,function(_0x3f09eb){if(_0x3f09eb['type']!==_0xf89b('0x41')){var _0x2b5c85={};_0x2b5c85[_0x3f09eb[_0xf89b('0x29')]]={'$like':'%'+_0x2e0ece['query'][_0xf89b('0x3f')]+'%'};return _0x2b5c85;}})});}_0x7135a4=_['merge']({},_0x7135a4,_0x2e0ece[_0xf89b('0x42')]);var _0x2ea99e={'where':_0x7135a4[_0xf89b('0x3c')]};return db[_0xf89b('0x2c')][_0xf89b('0x1c')](_0x2ea99e)[_0xf89b('0x25')](function(_0x38ea54){_0x49fd39[_0xf89b('0x1c')]=_0x38ea54;if(_0x2e0ece[_0xf89b('0x33')][_0xf89b('0x43')]){_0x7135a4['include']=[{'all':!![]}];}return db['VoiceChanSpy']['findAll'](_0x7135a4);})[_0xf89b('0x25')](function(_0x1f268e){_0x49fd39[_0xf89b('0x44')]=_0x1f268e;return _0x49fd39;})[_0xf89b('0x25')](respondWithFilteredResult(_0x55dd34,_0x7135a4))['catch'](handleError(_0x55dd34,null));};exports[_0xf89b('0x45')]=function(_0x16d906,_0x30582f){var _0x42fb6e={'raw':![],'where':{'id':_0x16d906['params']['id']}},_0x1dd5a8={};_0x1dd5a8[_0xf89b('0x31')]=_['keys'](db['VoiceChanSpy'][_0xf89b('0x2d')]);_0x1dd5a8['query']=_[_0xf89b('0x34')](_0x16d906['query']);_0x1dd5a8[_0xf89b('0x3d')]=_[_0xf89b('0x35')](_0x1dd5a8['model'],_0x1dd5a8[_0xf89b('0x33')]);_0x42fb6e['attributes']=_['intersection'](_0x1dd5a8[_0xf89b('0x31')],qs[_0xf89b('0x36')](_0x16d906[_0xf89b('0x33')][_0xf89b('0x36')]));_0x42fb6e[_0xf89b('0x37')]=_0x42fb6e[_0xf89b('0x37')][_0xf89b('0x38')]?_0x42fb6e['attributes']:_0x1dd5a8[_0xf89b('0x31')];if(_0x16d906[_0xf89b('0x33')][_0xf89b('0x43')]){_0x42fb6e['include']=[{'all':!![]}];}_0x42fb6e=_[_0xf89b('0x40')]({},_0x42fb6e,_0x16d906['options']);return db[_0xf89b('0x2c')][_0xf89b('0x46')](_0x42fb6e)['then'](handleEntityNotFound(_0x30582f,null))[_0xf89b('0x25')](respondWithResult(_0x30582f,null))['catch'](handleError(_0x30582f,null));};exports[_0xf89b('0x47')]=function(_0x49b8f0,_0x4e3c8e){return db[_0xf89b('0x2c')][_0xf89b('0x47')](_0x49b8f0[_0xf89b('0x48')],{})[_0xf89b('0x25')](function(_0x2818c8){var _0x2c0eb5=_0x49b8f0['user'][_0xf89b('0x49')]({'plain':!![]});if(!_0x2c0eb5)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c0eb5['role']==='user'){var _0x1154bf=_0x2818c8[_0xf89b('0x49')]({'plain':!![]});var _0x54ef9f=_0xf89b('0x4a');return db['UserProfileSection'][_0xf89b('0x46')]({'where':{'name':_0x54ef9f,'userProfileId':_0x2c0eb5['userProfileId']},'raw':!![]})['then'](function(_0x292319){if(_0x292319&&_0x292319[_0xf89b('0x4b')]===0x0){return db[_0xf89b('0x27')][_0xf89b('0x47')]({'name':_0x1154bf[_0xf89b('0x29')],'resourceId':_0x1154bf['id'],'type':_0x292319[_0xf89b('0x29')],'sectionId':_0x292319['id']},{})['then'](function(){return _0x2818c8;});}else{return _0x2818c8;}})[_0xf89b('0x4c')](function(_0x2f961e){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f961e);throw _0x2f961e;});}return _0x2818c8;})[_0xf89b('0x25')](respondWithResult(_0x4e3c8e,0xc9))['catch'](handleError(_0x4e3c8e,null));};exports[_0xf89b('0x24')]=function(_0x5d15cb,_0x10fa40){if(_0x5d15cb[_0xf89b('0x48')]['id']){delete _0x5d15cb[_0xf89b('0x48')]['id'];}return db[_0xf89b('0x2c')][_0xf89b('0x46')]({'where':{'id':_0x5d15cb[_0xf89b('0x4d')]['id']}})[_0xf89b('0x25')](handleEntityNotFound(_0x10fa40,null))[_0xf89b('0x25')](saveUpdates(_0x5d15cb[_0xf89b('0x48')],null))[_0xf89b('0x25')](respondWithResult(_0x10fa40,null))[_0xf89b('0x4c')](handleError(_0x10fa40,null));};exports[_0xf89b('0x26')]=function(_0x3f6a08,_0x92e0ec){return db[_0xf89b('0x2c')][_0xf89b('0x46')]({'where':{'id':_0x3f6a08[_0xf89b('0x4d')]['id']}})[_0xf89b('0x25')](handleEntityNotFound(_0x92e0ec,null))[_0xf89b('0x25')](removeEntity(_0x92e0ec,null))[_0xf89b('0x4c')](handleError(_0x92e0ec,null));}; \ No newline at end of file +var _0xffe6=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','options','count','includeAll','findAll','catch','keys','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','ChanSpies','userProfileId','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','moment','bluebird','util','path','sox','to-csv','ejs','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','limit','apply','reject','save','destroy','then','get','UserProfileResource','error','stack','name','send','index','map','VoiceChanSpy','fieldName','key','query','filters','model','intersection','fields','attributes'];(function(_0x34f070,_0x155063){var _0x12fb44=function(_0x42a88e){while(--_0x42a88e){_0x34f070['push'](_0x34f070['shift']());}};_0x12fb44(++_0x155063);}(_0xffe6,0x1f4));var _0x6ffe=function(_0x44adb5,_0x339102){_0x44adb5=_0x44adb5-0x0;var _0x48451e=_0xffe6[_0x44adb5];return _0x48451e;};'use strict';var pdf=require(_0x6ffe('0x0'));var emlformat=require(_0x6ffe('0x1'));var rimraf=require(_0x6ffe('0x2'));var zipdir=require(_0x6ffe('0x3'));var jsonpatch=require(_0x6ffe('0x4'));var rp=require(_0x6ffe('0x5'));var moment=require(_0x6ffe('0x6'));var BPromise=require(_0x6ffe('0x7'));var Mustache=require('mustache');var util=require(_0x6ffe('0x8'));var path=require(_0x6ffe('0x9'));var sox=require(_0x6ffe('0xa'));var csv=require(_0x6ffe('0xb'));var ejs=require(_0x6ffe('0xc'));var fs=require('fs');var _=require('lodash');var squel=require(_0x6ffe('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6ffe('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ffe('0xf'));var Papa=require('papaparse');var Redis=require(_0x6ffe('0x10'));var authService=require(_0x6ffe('0x11'));var qs=require(_0x6ffe('0x12'));var as=require(_0x6ffe('0x13'));var hardwareService=require(_0x6ffe('0x14'));var logger=require(_0x6ffe('0x15'))('api');var utils=require(_0x6ffe('0x16'));var config=require(_0x6ffe('0x17'));var db=require(_0x6ffe('0x18'))['db'];function respondWithStatusCode(_0x484e81,_0x4fe900){_0x4fe900=_0x4fe900||0xcc;return function(_0x5c6c1a){if(_0x5c6c1a){return _0x484e81[_0x6ffe('0x19')](_0x4fe900);}return _0x484e81[_0x6ffe('0x1a')](_0x4fe900)[_0x6ffe('0x1b')]();};}function respondWithResult(_0x5b7ff2,_0x476f94){_0x476f94=_0x476f94||0xc8;return function(_0x1e6330){if(_0x1e6330){return _0x5b7ff2['status'](_0x476f94)[_0x6ffe('0x1c')](_0x1e6330);}};}function respondWithFilteredResult(_0x3fa20d,_0x27d3c0){return function(_0x4bac30){if(_0x4bac30){var _0x248190=_0x4bac30['count'],_0x392271=_0x27d3c0['offset'],_0x5ee854=_0x27d3c0[_0x6ffe('0x1d')]+_0x27d3c0[_0x6ffe('0x1e')],_0x29ad71;if(_0x5ee854>=_0x248190){_0x5ee854=_0x248190;_0x29ad71=0xc8;}else{_0x29ad71=0xce;}_0x3fa20d[_0x6ffe('0x1a')](_0x29ad71);return _0x3fa20d['set']('Content-Range',_0x392271+'-'+_0x5ee854+'/'+_0x248190)[_0x6ffe('0x1c')](_0x4bac30);}return null;};}function patchUpdates(_0x4c7075){return function(_0x5abb29){try{jsonpatch[_0x6ffe('0x1f')](_0x5abb29,_0x4c7075,!![]);}catch(_0x4040be){return BPromise[_0x6ffe('0x20')](_0x4040be);}return _0x5abb29[_0x6ffe('0x21')]();};}function saveUpdates(_0x4f4d7,_0x353e16){return function(_0x2d4964){if(_0x2d4964){return _0x2d4964['update'](_0x4f4d7)['then'](function(_0x19526b){return _0x19526b;});}return null;};}function removeEntity(_0x110407,_0xe0521c){return function(_0x5c1770){if(_0x5c1770){return _0x5c1770[_0x6ffe('0x22')]()[_0x6ffe('0x23')](function(){var _0x16eb3c=_0x5c1770[_0x6ffe('0x24')]({'plain':!![]});var _0x330931='ChanSpies';return db[_0x6ffe('0x25')][_0x6ffe('0x22')]({'where':{'type':_0x330931,'resourceId':_0x16eb3c['id']}})[_0x6ffe('0x23')](function(){return _0x5c1770;});})[_0x6ffe('0x23')](function(){_0x110407[_0x6ffe('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48d179,_0x560d44){return function(_0x2efca0){if(!_0x2efca0){_0x48d179[_0x6ffe('0x19')](0x194);}return _0x2efca0;};}function handleError(_0x1b869b,_0x1e3bd9){_0x1e3bd9=_0x1e3bd9||0x1f4;return function(_0x4048fd){logger[_0x6ffe('0x26')](_0x4048fd[_0x6ffe('0x27')]);if(_0x4048fd[_0x6ffe('0x28')]){delete _0x4048fd[_0x6ffe('0x28')];}_0x1b869b[_0x6ffe('0x1a')](_0x1e3bd9)[_0x6ffe('0x29')](_0x4048fd);};}exports[_0x6ffe('0x2a')]=function(_0x118e82,_0x2ccbc7){var _0x1a2345={},_0x1d57a4={},_0x5496f0={'count':0x0,'rows':[]};var _0x412f02=_[_0x6ffe('0x2b')](db[_0x6ffe('0x2c')]['rawAttributes'],function(_0x166509){return{'name':_0x166509[_0x6ffe('0x2d')],'type':_0x166509['type'][_0x6ffe('0x2e')]};});_0x1d57a4['model']=_[_0x6ffe('0x2b')](_0x412f02,_0x6ffe('0x28'));_0x1d57a4[_0x6ffe('0x2f')]=_['keys'](_0x118e82[_0x6ffe('0x2f')]);_0x1d57a4[_0x6ffe('0x30')]=_['intersection'](_0x1d57a4[_0x6ffe('0x31')],_0x1d57a4[_0x6ffe('0x2f')]);_0x1a2345['attributes']=_[_0x6ffe('0x32')](_0x1d57a4[_0x6ffe('0x31')],qs[_0x6ffe('0x33')](_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x33')]));_0x1a2345[_0x6ffe('0x34')]=_0x1a2345[_0x6ffe('0x34')]['length']?_0x1a2345[_0x6ffe('0x34')]:_0x1d57a4[_0x6ffe('0x31')];if(!_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x35')](_0x6ffe('0x36'))){_0x1a2345[_0x6ffe('0x1e')]=qs['limit'](_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x1e')]);_0x1a2345['offset']=qs[_0x6ffe('0x1d')](_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x1d')]);}_0x1a2345['order']=qs[_0x6ffe('0x37')](_0x118e82['query']['sort']);_0x1a2345[_0x6ffe('0x38')]=qs[_0x6ffe('0x30')](_[_0x6ffe('0x39')](_0x118e82[_0x6ffe('0x2f')],_0x1d57a4['filters']));if(_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x3a')]){_0x1a2345[_0x6ffe('0x38')]=_[_0x6ffe('0x3b')](_0x1a2345[_0x6ffe('0x38')],{'$or':_[_0x6ffe('0x2b')](_0x412f02,function(_0x267052){if(_0x267052[_0x6ffe('0x3c')]!=='VIRTUAL'){var _0x3bff1e={};_0x3bff1e[_0x267052[_0x6ffe('0x28')]]={'$like':'%'+_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x3a')]+'%'};return _0x3bff1e;}})});}_0x1a2345=_[_0x6ffe('0x3b')]({},_0x1a2345,_0x118e82[_0x6ffe('0x3d')]);var _0x217e8f={'where':_0x1a2345[_0x6ffe('0x38')]};return db[_0x6ffe('0x2c')][_0x6ffe('0x3e')](_0x217e8f)['then'](function(_0x47632c){_0x5496f0['count']=_0x47632c;if(_0x118e82[_0x6ffe('0x2f')][_0x6ffe('0x3f')]){_0x1a2345['include']=[{'all':!![]}];}return db['VoiceChanSpy'][_0x6ffe('0x40')](_0x1a2345);})[_0x6ffe('0x23')](function(_0x1477f4){_0x5496f0['rows']=_0x1477f4;return _0x5496f0;})[_0x6ffe('0x23')](respondWithFilteredResult(_0x2ccbc7,_0x1a2345))[_0x6ffe('0x41')](handleError(_0x2ccbc7,null));};exports['show']=function(_0x6a7628,_0x193c8d){var _0x2c7a83={'raw':![],'where':{'id':_0x6a7628['params']['id']}},_0x87c670={};_0x87c670['model']=_[_0x6ffe('0x42')](db[_0x6ffe('0x2c')][_0x6ffe('0x43')]);_0x87c670['query']=_[_0x6ffe('0x42')](_0x6a7628['query']);_0x87c670[_0x6ffe('0x30')]=_[_0x6ffe('0x32')](_0x87c670[_0x6ffe('0x31')],_0x87c670[_0x6ffe('0x2f')]);_0x2c7a83['attributes']=_[_0x6ffe('0x32')](_0x87c670['model'],qs['fields'](_0x6a7628[_0x6ffe('0x2f')][_0x6ffe('0x33')]));_0x2c7a83[_0x6ffe('0x34')]=_0x2c7a83[_0x6ffe('0x34')][_0x6ffe('0x44')]?_0x2c7a83['attributes']:_0x87c670[_0x6ffe('0x31')];if(_0x6a7628[_0x6ffe('0x2f')][_0x6ffe('0x3f')]){_0x2c7a83['include']=[{'all':!![]}];}_0x2c7a83=_['merge']({},_0x2c7a83,_0x6a7628[_0x6ffe('0x3d')]);return db[_0x6ffe('0x2c')][_0x6ffe('0x45')](_0x2c7a83)['then'](handleEntityNotFound(_0x193c8d,null))[_0x6ffe('0x23')](respondWithResult(_0x193c8d,null))['catch'](handleError(_0x193c8d,null));};exports[_0x6ffe('0x46')]=function(_0x137960,_0x10b9d1){return db[_0x6ffe('0x2c')][_0x6ffe('0x46')](_0x137960[_0x6ffe('0x47')],{})[_0x6ffe('0x23')](function(_0x5c6973){var _0x4bb505=_0x137960[_0x6ffe('0x48')][_0x6ffe('0x24')]({'plain':!![]});if(!_0x4bb505)throw new Error(_0x6ffe('0x49'));if(_0x4bb505['role']===_0x6ffe('0x48')){var _0x3d0106=_0x5c6973[_0x6ffe('0x24')]({'plain':!![]});var _0x5a2bab=_0x6ffe('0x4a');return db['UserProfileSection'][_0x6ffe('0x45')]({'where':{'name':_0x5a2bab,'userProfileId':_0x4bb505[_0x6ffe('0x4b')]},'raw':!![]})[_0x6ffe('0x23')](function(_0x45610a){if(_0x45610a&&_0x45610a['autoAssociation']===0x0){return db[_0x6ffe('0x25')][_0x6ffe('0x46')]({'name':_0x3d0106[_0x6ffe('0x28')],'resourceId':_0x3d0106['id'],'type':_0x45610a[_0x6ffe('0x28')],'sectionId':_0x45610a['id']},{})['then'](function(){return _0x5c6973;});}else{return _0x5c6973;}})[_0x6ffe('0x41')](function(_0x4e693b){logger[_0x6ffe('0x26')](_0x6ffe('0x4c'),_0x4e693b);throw _0x4e693b;});}return _0x5c6973;})[_0x6ffe('0x23')](respondWithResult(_0x10b9d1,0xc9))[_0x6ffe('0x41')](handleError(_0x10b9d1,null));};exports[_0x6ffe('0x4d')]=function(_0xdca54d,_0xe462c3){if(_0xdca54d[_0x6ffe('0x47')]['id']){delete _0xdca54d['body']['id'];}return db[_0x6ffe('0x2c')]['find']({'where':{'id':_0xdca54d[_0x6ffe('0x4e')]['id']}})[_0x6ffe('0x23')](handleEntityNotFound(_0xe462c3,null))[_0x6ffe('0x23')](saveUpdates(_0xdca54d[_0x6ffe('0x47')],null))['then'](respondWithResult(_0xe462c3,null))['catch'](handleError(_0xe462c3,null));};exports[_0x6ffe('0x22')]=function(_0xee2ded,_0x4835b1){return db['VoiceChanSpy'][_0x6ffe('0x45')]({'where':{'id':_0xee2ded[_0x6ffe('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4835b1,null))['then'](removeEntity(_0x4835b1,null))[_0x6ffe('0x41')](handleError(_0x4835b1,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 87b67ac..80554fd 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 _0x36e2=['password','push','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','length','concat','internal','User','findAll','then','catch','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','destroy','lodash','util','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','merge','Set','CDR(type)=%s','chanspy','record','${UNIQUEID}.%s,ab','recordingFormat','Authenticate'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x36e2,0x187));var _0x236e=function(_0x338888,_0x4e437b){_0x338888=_0x338888-0x0;var _0xced6fc=_0x36e2[_0x338888];return _0xced6fc;};'use strict';var _=require(_0x236e('0x0'));var util=require(_0x236e('0x1'));var BPromise=require('bluebird');var attributes=require(_0x236e('0x2'));var getUserApplications=function(_0x209856,_0x5e9bb7,_0x3ba623){var _0x51b28e=0x1;var _0x20500b=[];var _0x5cc80e={'context':_0x5e9bb7['context']||_0x236e('0x3'),'exten':util[_0x236e('0x4')](_0x236e('0x5'),_0x209856[_0x236e('0x6')],_0x3ba623),'type':_0x236e('0x7'),'isApp':![],'ChanSpyId':_0x209856['id'],'UserId':_0x5e9bb7['id']};_0x20500b['push'](_[_0x236e('0x8')]({'app':_0x236e('0x9'),'appdata':util[_0x236e('0x4')](_0x236e('0xa'),_0x236e('0xb')),'priority':_0x51b28e++},_0x5cc80e));if(_0x209856[_0x236e('0xc')]){_0x20500b['push'](_['merge']({'app':'MixMonitor','appdata':util['format'](_0x236e('0xd'),_0x209856[_0x236e('0xe')]),'priority':_0x51b28e++},_0x5cc80e));}if(_0x209856['auth']){_0x20500b['push'](_[_0x236e('0x8')]({'app':_0x236e('0xf'),'appdata':_0x209856[_0x236e('0x10')],'priority':_0x51b28e++},_0x5cc80e));}_0x20500b[_0x236e('0x11')](_[_0x236e('0x8')]({'app':_0x236e('0x12'),'appdata':util[_0x236e('0x4')](_0x236e('0x13'),_0x5e9bb7[_0x236e('0x14')],_0x209856['options']?_0x209856[_0x236e('0x15')][_0x236e('0x16')](''):''),'priority':_0x51b28e++},_0x5cc80e));if(_0x209856[_0x236e('0xc')]){_0x20500b['push'](_['merge']({'app':_0x236e('0x17'),'priority':_0x51b28e++},_0x5cc80e));}return _0x20500b;};var getChanSpyApplications=function(_0x3aca03,_0xcc9c01){var _0x94e4c0=[];for(var _0x55b3b7=0x0,_0x3badf7=0x1;_0x55b3b7<_0xcc9c01[_0x236e('0x18')];_0x55b3b7++,_0x3badf7=0x1){_0x94e4c0=_0x94e4c0[_0x236e('0x19')](getUserApplications(_0x3aca03,_0xcc9c01[_0x55b3b7],_0xcc9c01[_0x55b3b7][_0x236e('0x1a')]));if(_0xcc9c01[_0x55b3b7]['internal']!=_0xcc9c01[_0x55b3b7]['name']){_0x94e4c0=_0x94e4c0[_0x236e('0x19')](getUserApplications(_0x3aca03,_0xcc9c01[_0x55b3b7],_0xcc9c01[_0x55b3b7][_0x236e('0x14')]));}}return _0x94e4c0;};var getChanSpyPromise=function(_0x1761d8,_0x216403){return new BPromise(function(_0x165c49,_0x675810){return _0x1761d8[_0x236e('0x1b')][_0x236e('0x1c')]({'attributes':['id','name',_0x236e('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x236e('0x1d')](function(_0x4f0462){if(_0x4f0462){return _0x165c49(getChanSpyApplications(_0x216403,_0x4f0462));}return _0x165c49([]);})[_0x236e('0x1e')](function(_0x86bb62){_0x675810(_0x86bb62);});});};module['exports']=function(_0x39aba5,_0x2e07e4){var _0x2ead21=_0x39aba5[_0x236e('0x1f')];return _0x39aba5[_0x236e('0x20')](_0x236e('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4cccba,_0x2115a6,_0x536c99){return getChanSpyPromise(_0x2ead21,_0x4cccba)[_0x236e('0x1d')](function(_0x15a1e7){if(_0x15a1e7&&_0x15a1e7[_0x236e('0x18')]){return _0x2ead21[_0x236e('0x22')][_0x236e('0x23')](_0x15a1e7);}})[_0x236e('0x1d')](function(){_0x536c99();})[_0x236e('0x1e')](function(_0x498d20){_0x536c99(_0x498d20);});},'afterUpdate':function(_0xee2fbd,_0x5f1285,_0x28c2dd){return _0x2ead21['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0xee2fbd['id']}})[_0x236e('0x1d')](function(){return getChanSpyPromise(_0x2ead21,_0xee2fbd);})['then'](function(_0x50b2cc){if(_0x50b2cc&&_0x50b2cc[_0x236e('0x18')]){return _0x2ead21[_0x236e('0x22')][_0x236e('0x23')](_0x50b2cc);}})[_0x236e('0x1d')](function(){_0x28c2dd();})['catch'](function(_0x42f24c){_0x28c2dd(_0x42f24c);});},'afterDestroy':function(_0x28336b,_0x23c023,_0x3b6e1e){return _0x2ead21[_0x236e('0x22')][_0x236e('0x24')]({'where':{'ChanSpyId':_0x28336b['id']}})[_0x236e('0x1d')](function(){_0x3b6e1e();})[_0x236e('0x1e')](function(_0x2a71a1){_0x3b6e1e(_0x2a71a1);});}}});}; \ No newline at end of file +var _0x9619=['merge','MixMonitor','${UNIQUEID}.%s,ab','recordingFormat','auth','Authenticate','password','ChanSpy','SIP/%s,%s','options','StopMixMonitor','length','internal','name','concat','User','findAll','agent','then','exports','models','define','VoiceChanSpy','VoiceExtension','bulkCreate','catch','destroy','util','bluebird','./voiceChanSpy.attributes','from-sip','format','%s%s','prefix','system','Set','CDR(type)=%s','push'];(function(_0x2a54ff,_0x501491){var _0x4b2d5b=function(_0x483fdd){while(--_0x483fdd){_0x2a54ff['push'](_0x2a54ff['shift']());}};_0x4b2d5b(++_0x501491);}(_0x9619,0xff));var _0x9961=function(_0x45d4e5,_0x5a6da4){_0x45d4e5=_0x45d4e5-0x0;var _0x42bef5=_0x9619[_0x45d4e5];return _0x42bef5;};'use strict';var _=require('lodash');var util=require(_0x9961('0x0'));var BPromise=require(_0x9961('0x1'));var attributes=require(_0x9961('0x2'));var getUserApplications=function(_0x4fbff3,_0x50d8cb,_0x4cbf0a){var _0x2f7363=0x1;var _0x1ad782=[];var _0x570e34={'context':_0x50d8cb['context']||_0x9961('0x3'),'exten':util[_0x9961('0x4')](_0x9961('0x5'),_0x4fbff3[_0x9961('0x6')],_0x4cbf0a),'type':_0x9961('0x7'),'isApp':![],'ChanSpyId':_0x4fbff3['id'],'UserId':_0x50d8cb['id']};_0x1ad782['push'](_['merge']({'app':_0x9961('0x8'),'appdata':util[_0x9961('0x4')](_0x9961('0x9'),'chanspy'),'priority':_0x2f7363++},_0x570e34));if(_0x4fbff3['record']){_0x1ad782[_0x9961('0xa')](_[_0x9961('0xb')]({'app':_0x9961('0xc'),'appdata':util[_0x9961('0x4')](_0x9961('0xd'),_0x4fbff3[_0x9961('0xe')]),'priority':_0x2f7363++},_0x570e34));}if(_0x4fbff3[_0x9961('0xf')]){_0x1ad782[_0x9961('0xa')](_[_0x9961('0xb')]({'app':_0x9961('0x10'),'appdata':_0x4fbff3[_0x9961('0x11')],'priority':_0x2f7363++},_0x570e34));}_0x1ad782[_0x9961('0xa')](_[_0x9961('0xb')]({'app':_0x9961('0x12'),'appdata':util[_0x9961('0x4')](_0x9961('0x13'),_0x50d8cb['name'],_0x4fbff3[_0x9961('0x14')]?_0x4fbff3[_0x9961('0x14')]['join'](''):''),'priority':_0x2f7363++},_0x570e34));if(_0x4fbff3['record']){_0x1ad782[_0x9961('0xa')](_[_0x9961('0xb')]({'app':_0x9961('0x15'),'priority':_0x2f7363++},_0x570e34));}return _0x1ad782;};var getChanSpyApplications=function(_0x1dea24,_0x3392cd){var _0x426df0=[];for(var _0x49aeea=0x0,_0x13a4c7=0x1;_0x49aeea<_0x3392cd[_0x9961('0x16')];_0x49aeea++,_0x13a4c7=0x1){_0x426df0=_0x426df0['concat'](getUserApplications(_0x1dea24,_0x3392cd[_0x49aeea],_0x3392cd[_0x49aeea]['internal']));if(_0x3392cd[_0x49aeea][_0x9961('0x17')]!=_0x3392cd[_0x49aeea][_0x9961('0x18')]){_0x426df0=_0x426df0[_0x9961('0x19')](getUserApplications(_0x1dea24,_0x3392cd[_0x49aeea],_0x3392cd[_0x49aeea]['name']));}}return _0x426df0;};var getChanSpyPromise=function(_0x25ff0f,_0x1e5e84){return new BPromise(function(_0x5972a2,_0x241f04){return _0x25ff0f[_0x9961('0x1a')][_0x9961('0x1b')]({'attributes':['id','name',_0x9961('0x17')],'where':{'role':_0x9961('0x1c'),'chanspy':!![]},'raw':!![]})[_0x9961('0x1d')](function(_0x40ef43){if(_0x40ef43){return _0x5972a2(getChanSpyApplications(_0x1e5e84,_0x40ef43));}return _0x5972a2([]);})['catch'](function(_0xa16dd1){_0x241f04(_0xa16dd1);});});};module[_0x9961('0x1e')]=function(_0x3b0ed6,_0x42dfed){var _0x4a8792=_0x3b0ed6[_0x9961('0x1f')];return _0x3b0ed6[_0x9961('0x20')](_0x9961('0x21'),attributes,{'tableName':'voice_chanspy','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x54c690,_0x14ac20,_0x53e082){return getChanSpyPromise(_0x4a8792,_0x54c690)[_0x9961('0x1d')](function(_0x842e4a){if(_0x842e4a&&_0x842e4a['length']){return _0x4a8792[_0x9961('0x22')][_0x9961('0x23')](_0x842e4a);}})[_0x9961('0x1d')](function(){_0x53e082();})[_0x9961('0x24')](function(_0x58741b){_0x53e082(_0x58741b);});},'afterUpdate':function(_0x1efaf8,_0x5d3b6d,_0x21c642){return _0x4a8792['VoiceExtension'][_0x9961('0x25')]({'where':{'ChanSpyId':_0x1efaf8['id']}})[_0x9961('0x1d')](function(){return getChanSpyPromise(_0x4a8792,_0x1efaf8);})[_0x9961('0x1d')](function(_0x1fb742){if(_0x1fb742&&_0x1fb742['length']){return _0x4a8792[_0x9961('0x22')][_0x9961('0x23')](_0x1fb742);}})[_0x9961('0x1d')](function(){_0x21c642();})[_0x9961('0x24')](function(_0x271900){_0x21c642(_0x271900);});},'afterDestroy':function(_0x19d76a,_0x2e1f5b,_0x239c0d){return _0x4a8792[_0x9961('0x22')][_0x9961('0x25')]({'where':{'ChanSpyId':_0x19d76a['id']}})[_0x9961('0x1d')](function(){_0x239c0d();})[_0x9961('0x24')](function(_0x286d04){_0x239c0d(_0x286d04);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 7693530..27e347f 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 _0x8d7d=['../../config/logger','../../config/environment','jayson/promise','client','http','request','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','../../mysqldb','../../config/utils'];(function(_0x4b80c3,_0x3b227f){var _0x432cfe=function(_0xa31c05){while(--_0xa31c05){_0x4b80c3['push'](_0x4b80c3['shift']());}};_0x432cfe(++_0x3b227f);}(_0x8d7d,0xd7));var _0xd8d7=function(_0x2bc272,_0x28bc2c){_0x2bc272=_0x2bc272-0x0;var _0x24ad78=_0x8d7d[_0x2bc272];return _0x24ad78;};'use strict';var _=require(_0xd8d7('0x0'));var util=require(_0xd8d7('0x1'));var moment=require('moment');var BPromise=require(_0xd8d7('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd8d7('0x3'))['db'];var utils=require(_0xd8d7('0x4'));var logger=require(_0xd8d7('0x5'))('rpc');var config=require(_0xd8d7('0x6'));var jayson=require(_0xd8d7('0x7'));var client=jayson[_0xd8d7('0x8')][_0xd8d7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x41f195,_0xf25d32,_0x34e2da){return new BPromise(function(_0x129f05,_0x469bfd){return client[_0xd8d7('0xa')](_0x41f195,_0x34e2da)['then'](function(_0x3b5c3f){logger['info'](_0xd8d7('0xb'),_0xf25d32,_0xd8d7('0xc'));logger[_0xd8d7('0xd')](_0xd8d7('0xe'),_0xf25d32,_0xd8d7('0xc'),JSON['stringify'](_0x3b5c3f));if(_0x3b5c3f[_0xd8d7('0xf')]){if(_0x3b5c3f[_0xd8d7('0xf')][_0xd8d7('0x10')]===0x1f4){logger[_0xd8d7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xf25d32,_0x3b5c3f['error'][_0xd8d7('0x11')]);return _0x469bfd(_0x3b5c3f[_0xd8d7('0xf')]['message']);}logger[_0xd8d7('0xf')](_0xd8d7('0xb'),_0xf25d32,_0x3b5c3f[_0xd8d7('0xf')][_0xd8d7('0x11')]);return _0x129f05(_0x3b5c3f['error'][_0xd8d7('0x11')]);}else{logger[_0xd8d7('0x12')](_0xd8d7('0xb'),_0xf25d32,_0xd8d7('0xc'));_0x129f05(_0x3b5c3f['result'][_0xd8d7('0x11')]);}})[_0xd8d7('0x13')](function(_0x8fd7a3){logger[_0xd8d7('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0xf25d32,_0x8fd7a3);_0x469bfd(_0x8fd7a3);});});} \ No newline at end of file +var _0xaa45=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xaa45,0xef));var _0x5aa4=function(_0x29e3b6,_0x40b0b4){_0x29e3b6=_0x29e3b6-0x0;var _0x55d4b0=_0xaa45[_0x29e3b6];return _0x55d4b0;};'use strict';var _=require(_0x5aa4('0x0'));var util=require(_0x5aa4('0x1'));var moment=require(_0x5aa4('0x2'));var BPromise=require(_0x5aa4('0x3'));var rs=require(_0x5aa4('0x4'));var fs=require('fs');var Redis=require(_0x5aa4('0x5'));var db=require(_0x5aa4('0x6'))['db'];var utils=require(_0x5aa4('0x7'));var logger=require(_0x5aa4('0x8'))(_0x5aa4('0x9'));var config=require(_0x5aa4('0xa'));var jayson=require(_0x5aa4('0xb'));var client=jayson[_0x5aa4('0xc')][_0x5aa4('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x3dfe03,_0x1b1265,_0x21f851){return new BPromise(function(_0x39438c,_0x36ca61){return client[_0x5aa4('0xe')](_0x3dfe03,_0x21f851)['then'](function(_0x4f5695){logger[_0x5aa4('0xf')](_0x5aa4('0x10'),_0x1b1265,_0x5aa4('0x11'));logger['debug']('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x1b1265,_0x5aa4('0x11'),JSON[_0x5aa4('0x12')](_0x4f5695));if(_0x4f5695[_0x5aa4('0x13')]){if(_0x4f5695[_0x5aa4('0x13')][_0x5aa4('0x14')]===0x1f4){logger[_0x5aa4('0x13')](_0x5aa4('0x10'),_0x1b1265,_0x4f5695[_0x5aa4('0x13')][_0x5aa4('0x15')]);return _0x36ca61(_0x4f5695['error']['message']);}logger[_0x5aa4('0x13')](_0x5aa4('0x10'),_0x1b1265,_0x4f5695[_0x5aa4('0x13')][_0x5aa4('0x15')]);return _0x39438c(_0x4f5695[_0x5aa4('0x13')]['message']);}else{logger[_0x5aa4('0xf')](_0x5aa4('0x10'),_0x1b1265,_0x5aa4('0x11'));_0x39438c(_0x4f5695[_0x5aa4('0x16')][_0x5aa4('0x15')]);}})[_0x5aa4('0x17')](function(_0x99004c){logger['error'](_0x5aa4('0x10'),_0x1b1265,_0x99004c);_0x36ca61(_0x99004c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2f09974..91f35ac 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 _0xb306=['exports','multer','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./voiceContext.controller','get','isAuthenticated','index','/:id','show','put','update'];(function(_0x3cb6c3,_0x191af3){var _0x18cd33=function(_0x537913){while(--_0x537913){_0x3cb6c3['push'](_0x3cb6c3['shift']());}};_0x18cd33(++_0x191af3);}(_0xb306,0xc5));var _0x6b30=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb306[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x6b30('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x6b30('0x1'));var express=require('express');var router=express[_0x6b30('0x2')]();var auth=require(_0x6b30('0x3'));var interaction=require(_0x6b30('0x4'));var config=require('../../config/environment');var controller=require(_0x6b30('0x5'));router[_0x6b30('0x6')]('/',auth[_0x6b30('0x7')](),controller[_0x6b30('0x8')]);router[_0x6b30('0x6')](_0x6b30('0x9'),auth[_0x6b30('0x7')](),controller[_0x6b30('0xa')]);router['post']('/',auth[_0x6b30('0x7')](),controller['create']);router[_0x6b30('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x6b30('0xc')]);router['delete'](_0x6b30('0x9'),auth[_0x6b30('0x7')](),controller['destroy']);module[_0x6b30('0xd')]=router; \ No newline at end of file +var _0xc15f=['exports','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceContext.controller','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy'];(function(_0x5d3903,_0x3d6c3e){var _0x4b8bc9=function(_0x92b297){while(--_0x92b297){_0x5d3903['push'](_0x5d3903['shift']());}};_0x4b8bc9(++_0x3d6c3e);}(_0xc15f,0x18d));var _0xfc15=function(_0x25a42a,_0x3d489b){_0x25a42a=_0x25a42a-0x0;var _0x1129b1=_0xc15f[_0x25a42a];return _0x1129b1;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfc15('0x0'));var timeout=require(_0xfc15('0x1'));var express=require(_0xfc15('0x2'));var router=express[_0xfc15('0x3')]();var auth=require(_0xfc15('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xfc15('0x5'));var controller=require(_0xfc15('0x6'));router['get']('/',auth[_0xfc15('0x7')](),controller[_0xfc15('0x8')]);router[_0xfc15('0x9')](_0xfc15('0xa'),auth[_0xfc15('0x7')](),controller[_0xfc15('0xb')]);router[_0xfc15('0xc')]('/',auth[_0xfc15('0x7')](),controller[_0xfc15('0xd')]);router[_0xfc15('0xe')]('/:id',auth[_0xfc15('0x7')](),controller[_0xfc15('0xf')]);router['delete'](_0xfc15('0xa'),auth[_0xfc15('0x7')](),controller[_0xfc15('0x10')]);module[_0xfc15('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index f0acffa..9e7fe7e 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(_0x44f274,_0x204885){var _0x2b5f73=function(_0x97da8a){while(--_0x97da8a){_0x44f274['push'](_0x44f274['shift']());}};_0x2b5f73(++_0x204885);}(_0x3e74,0x175));var _0x43e7=function(_0x25691a,_0xe3574e){_0x25691a=_0x25691a-0x0;var _0x36a531=_0x3e74[_0x25691a];return _0x36a531;};'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 _0xe14b=['exports','STRING','BOOLEAN','sequelize'];(function(_0x3ef4a8,_0x1702ed){var _0x23b6cf=function(_0x21c439){while(--_0x21c439){_0x3ef4a8['push'](_0x3ef4a8['shift']());}};_0x23b6cf(++_0x1702ed);}(_0xe14b,0x93));var _0xbe14=function(_0x16dbe,_0x98dfaa){_0x16dbe=_0x16dbe-0x0;var _0x525c03=_0xe14b[_0x16dbe];return _0x525c03;};'use strict';var Sequelize=require(_0xbe14('0x0'));module[_0xbe14('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name'},'description':{'type':Sequelize[_0xbe14('0x2')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbe14('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index d9732d4..fc5cc70 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 _0xabe4=['UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','utf8','render','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../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~!@#$%^&-_=+[{]}.','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceContext,\x20%s,\x20%s','request\x20sent','result','catch','sendStatus','status','json','count','offset','Content-Range','apply','save','update','destroy','get','Contexts','end','stack','name','send','map','VoiceContext','rawAttributes','type','key','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','params','keys','find','create','body','findAll','readFileSync','root','server/files/templates/context.ejs','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','role'];(function(_0x30af91,_0x233834){var _0x3e4134=function(_0x35ebfc){while(--_0x35ebfc){_0x30af91['push'](_0x30af91['shift']());}};_0x3e4134(++_0x233834);}(_0xabe4,0x1af));var _0x4abe=function(_0x317b63,_0x2acf92){_0x317b63=_0x317b63-0x0;var _0x36a2e2=_0xabe4[_0x317b63];return _0x36a2e2;};'use strict';var pdf=require(_0x4abe('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4abe('0x1'));var jsonpatch=require(_0x4abe('0x2'));var rp=require(_0x4abe('0x3'));var moment=require(_0x4abe('0x4'));var BPromise=require(_0x4abe('0x5'));var Mustache=require(_0x4abe('0x6'));var util=require(_0x4abe('0x7'));var path=require(_0x4abe('0x8'));var sox=require(_0x4abe('0x9'));var csv=require(_0x4abe('0xa'));var ejs=require(_0x4abe('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4abe('0xc'));var crypto=require('crypto');var jsforce=require(_0x4abe('0xd'));var deskjs=require(_0x4abe('0xe'));var toCsv=require(_0x4abe('0xa'));var querystring=require(_0x4abe('0xf'));var Papa=require(_0x4abe('0x10'));var Redis=require(_0x4abe('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x4abe('0x12'));var as=require(_0x4abe('0x13'));var hardwareService=require(_0x4abe('0x14'));var logger=require('../../config/logger')(_0x4abe('0x15'));var utils=require(_0x4abe('0x16'));var config=require(_0x4abe('0x17'));var db=require(_0x4abe('0x18'))['db'];var jayson=require(_0x4abe('0x19'));var client=jayson[_0x4abe('0x1a')]['http']({'port':0x232a});function checkPasswordPattern(_0x3b04e9,_0x3733d0,_0x4bbf39){if(_0x4bbf39){var _0x5a331a=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5a331a[_0x4abe('0x1b')](_0x3733d0)){return _0x3b04e9;}else{throw new db['Sequelize'][(_0x4abe('0x1c'))](_0x4abe('0x1d'));}}else{return _0x3b04e9;}}function respondWithRpcPromise(_0x231da3,_0x495776,_0x2bb51b,_0x1437fe){return new BPromise(function(_0x3cba6f,_0x420a85){var _0x4414ca=_0x1437fe||client;return _0x4414ca[_0x4abe('0x1e')](_0x231da3,_0x2bb51b)[_0x4abe('0x1f')](function(_0x474426){logger[_0x4abe('0x20')]('VoiceContext,\x20%s,\x20%s',_0x495776,'request\x20sent');logger[_0x4abe('0x21')](_0x4abe('0x22'),_0x495776,'request\x20sent',JSON[_0x4abe('0x23')](_0x474426));if(_0x474426[_0x4abe('0x24')]){if(_0x474426['error'][_0x4abe('0x25')]===0x1f4){logger[_0x4abe('0x24')]('VoiceContext,\x20%s,\x20%s',_0x495776,_0x474426[_0x4abe('0x24')][_0x4abe('0x26')]);return _0x420a85(_0x474426[_0x4abe('0x24')][_0x4abe('0x26')]);}logger['error']('VoiceContext,\x20%s,\x20%s',_0x495776,_0x474426[_0x4abe('0x24')][_0x4abe('0x26')]);return _0x3cba6f(_0x474426[_0x4abe('0x24')]['message']);}else{logger['info'](_0x4abe('0x27'),_0x495776,_0x4abe('0x28'));_0x3cba6f(_0x474426[_0x4abe('0x29')][_0x4abe('0x26')]);}})[_0x4abe('0x2a')](function(_0x137619){logger['error'](_0x4abe('0x27'),_0x495776,_0x137619);_0x420a85(_0x137619);});});}function respondWithStatusCode(_0x3dcd0a,_0x36fbd4){_0x36fbd4=_0x36fbd4||0xcc;return function(_0x56fb5b){if(_0x56fb5b){return _0x3dcd0a[_0x4abe('0x2b')](_0x36fbd4);}return _0x3dcd0a[_0x4abe('0x2c')](_0x36fbd4)['end']();};}function respondWithResult(_0x464d79,_0x4c62ac){_0x4c62ac=_0x4c62ac||0xc8;return function(_0x57b17a){if(_0x57b17a){return _0x464d79[_0x4abe('0x2c')](_0x4c62ac)[_0x4abe('0x2d')](_0x57b17a);}};}function respondWithFilteredResult(_0x5c20d8,_0x5e5864){return function(_0xea7e54){if(_0xea7e54){var _0x32875a=_0xea7e54[_0x4abe('0x2e')],_0x5a7a22=_0x5e5864[_0x4abe('0x2f')],_0x57e6b9=_0x5e5864[_0x4abe('0x2f')]+_0x5e5864['limit'],_0x315d47;if(_0x57e6b9>=_0x32875a){_0x57e6b9=_0x32875a;_0x315d47=0xc8;}else{_0x315d47=0xce;}_0x5c20d8['status'](_0x315d47);return _0x5c20d8['set'](_0x4abe('0x30'),_0x5a7a22+'-'+_0x57e6b9+'/'+_0x32875a)[_0x4abe('0x2d')](_0xea7e54);}return null;};}function patchUpdates(_0x1424a7){return function(_0x21f655){try{jsonpatch[_0x4abe('0x31')](_0x21f655,_0x1424a7,!![]);}catch(_0x1d0afb){return BPromise['reject'](_0x1d0afb);}return _0x21f655[_0x4abe('0x32')]();};}function saveUpdates(_0x20c4da,_0x420d88){return function(_0x11391d){if(_0x11391d){return _0x11391d[_0x4abe('0x33')](_0x20c4da)[_0x4abe('0x1f')](function(_0x546b2b){return _0x546b2b;});}return null;};}function removeEntity(_0x1f1b44,_0x2391e8){return function(_0xafaa8c){if(_0xafaa8c){return _0xafaa8c[_0x4abe('0x34')]()[_0x4abe('0x1f')](function(){var _0x12de67=_0xafaa8c[_0x4abe('0x35')]({'plain':!![]});var _0x4e757f=_0x4abe('0x36');return db['UserProfileResource']['destroy']({'where':{'type':_0x4e757f,'resourceId':_0x12de67['id']}})['then'](function(){return _0xafaa8c;});})[_0x4abe('0x1f')](function(){_0x1f1b44['status'](0xcc)[_0x4abe('0x37')]();});}};}function handleEntityNotFound(_0x5464f2,_0x72885){return function(_0x87479b){if(!_0x87479b){_0x5464f2['sendStatus'](0x194);}return _0x87479b;};}function handleError(_0x31a257,_0x1b0e6c){_0x1b0e6c=_0x1b0e6c||0x1f4;return function(_0x1e7a47){logger[_0x4abe('0x24')](_0x1e7a47[_0x4abe('0x38')]);if(_0x1e7a47[_0x4abe('0x39')]){delete _0x1e7a47[_0x4abe('0x39')];}_0x31a257[_0x4abe('0x2c')](_0x1b0e6c)[_0x4abe('0x3a')](_0x1e7a47);};}exports['index']=function(_0x19eb19,_0x48b924){var _0x92cbbd={},_0x29d0e3={},_0x407c3b={'count':0x0,'rows':[]};var _0x411a4c=_[_0x4abe('0x3b')](db[_0x4abe('0x3c')][_0x4abe('0x3d')],function(_0x16f9b8){return{'name':_0x16f9b8['fieldName'],'type':_0x16f9b8[_0x4abe('0x3e')][_0x4abe('0x3f')]};});_0x29d0e3['model']=_['map'](_0x411a4c,'name');_0x29d0e3[_0x4abe('0x40')]=_['keys'](_0x19eb19[_0x4abe('0x40')]);_0x29d0e3[_0x4abe('0x41')]=_['intersection'](_0x29d0e3[_0x4abe('0x42')],_0x29d0e3[_0x4abe('0x40')]);_0x92cbbd[_0x4abe('0x43')]=_[_0x4abe('0x44')](_0x29d0e3[_0x4abe('0x42')],qs[_0x4abe('0x45')](_0x19eb19[_0x4abe('0x40')][_0x4abe('0x45')]));_0x92cbbd['attributes']=_0x92cbbd[_0x4abe('0x43')][_0x4abe('0x46')]?_0x92cbbd[_0x4abe('0x43')]:_0x29d0e3[_0x4abe('0x42')];if(!_0x19eb19[_0x4abe('0x40')][_0x4abe('0x47')](_0x4abe('0x48'))){_0x92cbbd[_0x4abe('0x49')]=qs[_0x4abe('0x49')](_0x19eb19[_0x4abe('0x40')]['limit']);_0x92cbbd[_0x4abe('0x2f')]=qs['offset'](_0x19eb19[_0x4abe('0x40')][_0x4abe('0x2f')]);}_0x92cbbd[_0x4abe('0x4a')]=qs[_0x4abe('0x4b')](_0x19eb19[_0x4abe('0x40')][_0x4abe('0x4b')]);_0x92cbbd[_0x4abe('0x4c')]=qs[_0x4abe('0x41')](_[_0x4abe('0x4d')](_0x19eb19['query'],_0x29d0e3[_0x4abe('0x41')]));if(_0x19eb19[_0x4abe('0x40')][_0x4abe('0x4e')]){_0x92cbbd[_0x4abe('0x4c')]=_[_0x4abe('0x4f')](_0x92cbbd[_0x4abe('0x4c')],{'$or':_['map'](_0x411a4c,function(_0x2cb4f4){if(_0x2cb4f4[_0x4abe('0x3e')]!==_0x4abe('0x50')){var _0x186bb0={};_0x186bb0[_0x2cb4f4[_0x4abe('0x39')]]={'$like':'%'+_0x19eb19[_0x4abe('0x40')][_0x4abe('0x4e')]+'%'};return _0x186bb0;}})});}_0x92cbbd=_[_0x4abe('0x4f')]({},_0x92cbbd,_0x19eb19[_0x4abe('0x51')]);var _0x28e892={'where':_0x92cbbd[_0x4abe('0x4c')]};return db['VoiceContext'][_0x4abe('0x2e')](_0x28e892)['then'](function(_0x579c1f){_0x407c3b[_0x4abe('0x2e')]=_0x579c1f;if(_0x19eb19['query'][_0x4abe('0x52')]){_0x92cbbd[_0x4abe('0x53')]=[{'all':!![]}];}return db['VoiceContext']['findAll'](_0x92cbbd);})['then'](function(_0x9cf51c){_0x407c3b[_0x4abe('0x54')]=_0x9cf51c;return _0x407c3b;})['then'](respondWithFilteredResult(_0x48b924,_0x92cbbd))[_0x4abe('0x2a')](handleError(_0x48b924,null));};exports['show']=function(_0x51092f,_0x2a2b7f){var _0x21d7c9={'raw':![],'where':{'id':_0x51092f[_0x4abe('0x55')]['id']}},_0xa14f8={};_0xa14f8[_0x4abe('0x42')]=_[_0x4abe('0x56')](db[_0x4abe('0x3c')]['rawAttributes']);_0xa14f8[_0x4abe('0x40')]=_[_0x4abe('0x56')](_0x51092f[_0x4abe('0x40')]);_0xa14f8['filters']=_['intersection'](_0xa14f8[_0x4abe('0x42')],_0xa14f8[_0x4abe('0x40')]);_0x21d7c9[_0x4abe('0x43')]=_['intersection'](_0xa14f8[_0x4abe('0x42')],qs[_0x4abe('0x45')](_0x51092f['query']['fields']));_0x21d7c9[_0x4abe('0x43')]=_0x21d7c9['attributes'][_0x4abe('0x46')]?_0x21d7c9[_0x4abe('0x43')]:_0xa14f8['model'];if(_0x51092f[_0x4abe('0x40')]['includeAll']){_0x21d7c9[_0x4abe('0x53')]=[{'all':!![]}];}_0x21d7c9=_['merge']({},_0x21d7c9,_0x51092f['options']);return db[_0x4abe('0x3c')][_0x4abe('0x57')](_0x21d7c9)[_0x4abe('0x1f')](handleEntityNotFound(_0x2a2b7f,null))[_0x4abe('0x1f')](respondWithResult(_0x2a2b7f,null))[_0x4abe('0x2a')](handleError(_0x2a2b7f,null));};exports['create']=function(_0x427f14,_0xca2e,_0x5d6652){var _0x5a62de;return db[_0x4abe('0x3c')][_0x4abe('0x58')](_0x427f14[_0x4abe('0x59')],{'raw':!![]})[_0x4abe('0x1f')](function(_0xc88397){_0x5a62de=_0xc88397;return db['VoiceContext'][_0x4abe('0x5a')]({'raw':!![]});})[_0x4abe('0x1f')](function(_0xacf584){var _0x2e8c47=fs[_0x4abe('0x5b')](path['join'](config[_0x4abe('0x5c')],_0x4abe('0x5d')),'utf8');var _0x372e61=ejs['render'](_0x2e8c47,{'contexts':_0xacf584||[]});fs[_0x4abe('0x5e')](_0x4abe('0x5f'),_0x372e61);})[_0x4abe('0x1f')](function(){return respondWithRpcPromise(_0x4abe('0x60'),'create',{'module':_0x4abe('0x61')});})['then'](function(){var _0x3e4fc2=_0x427f14['user']['get']({'plain':!![]});if(!_0x3e4fc2)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3e4fc2[_0x4abe('0x62')]==='user'){var _0x4cfe00=_0x5a62de[_0x4abe('0x35')]({'plain':!![]});return db[_0x4abe('0x63')][_0x4abe('0x57')]({'where':{'name':_0x4abe('0x36'),'userProfileId':_0x3e4fc2[_0x4abe('0x64')]},'raw':!![]})['then'](function(_0x5c4da2){if(_0x5c4da2&&_0x5c4da2['autoAssociation']===0x0){return db[_0x4abe('0x65')][_0x4abe('0x58')]({'name':_0x4cfe00[_0x4abe('0x39')],'resourceId':_0x4cfe00['id'],'type':_0x5c4da2[_0x4abe('0x39')],'sectionId':_0x5c4da2['id']},{})[_0x4abe('0x1f')](function(){return _0x5a62de;});}else{return _0x5a62de;}})['catch'](function(_0x27b156){logger[_0x4abe('0x24')](_0x4abe('0x66'),_0x27b156);throw _0x27b156;});}return _0x5a62de;})[_0x4abe('0x1f')](respondWithResult(_0xca2e,0xc9))[_0x4abe('0x2a')](handleError(_0xca2e,null));};exports[_0x4abe('0x33')]=function(_0x3d280e,_0x31c563,_0x15a6da){var _0x131e5c;return db[_0x4abe('0x3c')]['find']({'where':{'id':_0x3d280e['params']['id']}})[_0x4abe('0x1f')](handleEntityNotFound(_0x31c563,null))[_0x4abe('0x1f')](saveUpdates(_0x3d280e[_0x4abe('0x59')],null))['then'](function(_0xf33c7d){if(_0xf33c7d){_0x131e5c=_0xf33c7d;return db[_0x4abe('0x3c')][_0x4abe('0x5a')]({'raw':!![]});}})[_0x4abe('0x1f')](function(_0x278054){var _0x1c3629=fs[_0x4abe('0x5b')](path[_0x4abe('0x67')](config[_0x4abe('0x5c')],'server/files/templates/context.ejs'),_0x4abe('0x68'));var _0x5d102f=ejs[_0x4abe('0x69')](_0x1c3629,{'contexts':_0x278054||[]});fs[_0x4abe('0x5e')](_0x4abe('0x5f'),_0x5d102f);})[_0x4abe('0x1f')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x4abe('0x61')});})[_0x4abe('0x1f')](function(){return _0x131e5c;})[_0x4abe('0x1f')](respondWithResult(_0x31c563,null))['catch'](handleError(_0x31c563,null));};exports[_0x4abe('0x34')]=function(_0x5ecae1,_0x2ba908,_0x2092e2){var _0xfd10b;return db[_0x4abe('0x3c')][_0x4abe('0x57')]({'where':{'id':_0x5ecae1['params']['id']}})[_0x4abe('0x1f')](handleEntityNotFound(_0x2ba908,null))[_0x4abe('0x1f')](removeEntity(_0x2ba908,null))[_0x4abe('0x1f')](function(){return db[_0x4abe('0x3c')][_0x4abe('0x5a')]({'raw':!![]});})[_0x4abe('0x1f')](function(_0x1f30ef){var _0x152b5b=fs[_0x4abe('0x5b')](path[_0x4abe('0x67')](config[_0x4abe('0x5c')],_0x4abe('0x5d')),_0x4abe('0x68'));var _0xc265e1=ejs['render'](_0x152b5b,{'contexts':_0x1f30ef});fs[_0x4abe('0x5e')](_0x4abe('0x5f'),_0xc265e1);return respondWithRpcPromise(_0x4abe('0x60'),_0x4abe('0x34'),{'module':_0x4abe('0x61')});})[_0x4abe('0x2a')](handleError(_0x2ba908,null));}; \ No newline at end of file +var _0xe9a4=['join','root','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findAll','utf8','chan_sip.so','server/files/templates/context.ejs','render','html-pdf','rimraf','fast-json-patch','moment','mustache','path','to-csv','ejs','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','client','test','Sequelize','ValidationError','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','end','status','json','count','offset','set','Content-Range','apply','reject','save','update','get','Contexts','destroy','stack','name','send','index','map','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','VoiceContext','includeAll','include','rows','show','params','length','find','create','body','readFileSync'];(function(_0x422c5d,_0x395613){var _0x2c580e=function(_0xae60f6){while(--_0xae60f6){_0x422c5d['push'](_0x422c5d['shift']());}};_0x2c580e(++_0x395613);}(_0xe9a4,0x1c1));var _0x4e9a=function(_0x196ce1,_0x46e836){_0x196ce1=_0x196ce1-0x0;var _0x360a64=_0xe9a4[_0x196ce1];return _0x360a64;};'use strict';var pdf=require(_0x4e9a('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x4e9a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e9a('0x2'));var rp=require('request-promise');var moment=require(_0x4e9a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x4e9a('0x4'));var util=require('util');var path=require(_0x4e9a('0x5'));var sox=require('sox');var csv=require(_0x4e9a('0x6'));var ejs=require(_0x4e9a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x4e9a('0x8'));var crypto=require(_0x4e9a('0x9'));var jsforce=require(_0x4e9a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x4e9a('0x6'));var querystring=require(_0x4e9a('0xb'));var Papa=require(_0x4e9a('0xc'));var Redis=require(_0x4e9a('0xd'));var authService=require(_0x4e9a('0xe'));var qs=require(_0x4e9a('0xf'));var as=require(_0x4e9a('0x10'));var hardwareService=require(_0x4e9a('0x11'));var logger=require(_0x4e9a('0x12'))(_0x4e9a('0x13'));var utils=require('../../config/utils');var config=require(_0x4e9a('0x14'));var db=require(_0x4e9a('0x15'))['db'];var jayson=require(_0x4e9a('0x16'));var client=jayson[_0x4e9a('0x17')]['http']({'port':0x232a});function checkPasswordPattern(_0x23a4cf,_0x296645,_0x2a63a7){if(_0x2a63a7){var _0x5b7891=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(_0x5b7891[_0x4e9a('0x18')](_0x296645)){return _0x23a4cf;}else{throw new db[(_0x4e9a('0x19'))][(_0x4e9a('0x1a'))](_0x4e9a('0x1b'));}}else{return _0x23a4cf;}}function respondWithRpcPromise(_0x13109a,_0xda021b,_0x398a12,_0x2e73f4){return new BPromise(function(_0xdca440,_0x105ae1){var _0x299870=_0x2e73f4||client;return _0x299870['request'](_0x13109a,_0x398a12)[_0x4e9a('0x1c')](function(_0x90ec62){logger[_0x4e9a('0x1d')](_0x4e9a('0x1e'),_0xda021b,_0x4e9a('0x1f'));logger[_0x4e9a('0x20')](_0x4e9a('0x21'),_0xda021b,_0x4e9a('0x1f'),JSON[_0x4e9a('0x22')](_0x90ec62));if(_0x90ec62[_0x4e9a('0x23')]){if(_0x90ec62[_0x4e9a('0x23')]['code']===0x1f4){logger['error'](_0x4e9a('0x1e'),_0xda021b,_0x90ec62[_0x4e9a('0x23')]['message']);return _0x105ae1(_0x90ec62[_0x4e9a('0x23')][_0x4e9a('0x24')]);}logger[_0x4e9a('0x23')]('VoiceContext,\x20%s,\x20%s',_0xda021b,_0x90ec62['error'][_0x4e9a('0x24')]);return _0xdca440(_0x90ec62[_0x4e9a('0x23')]['message']);}else{logger[_0x4e9a('0x1d')](_0x4e9a('0x1e'),_0xda021b,_0x4e9a('0x1f'));_0xdca440(_0x90ec62[_0x4e9a('0x25')][_0x4e9a('0x24')]);}})[_0x4e9a('0x26')](function(_0xa3305b){logger['error'](_0x4e9a('0x1e'),_0xda021b,_0xa3305b);_0x105ae1(_0xa3305b);});});}function respondWithStatusCode(_0x8fbc8b,_0x53b2a2){_0x53b2a2=_0x53b2a2||0xcc;return function(_0x29f61d){if(_0x29f61d){return _0x8fbc8b[_0x4e9a('0x27')](_0x53b2a2);}return _0x8fbc8b['status'](_0x53b2a2)[_0x4e9a('0x28')]();};}function respondWithResult(_0x463953,_0x3fb34){_0x3fb34=_0x3fb34||0xc8;return function(_0x56837b){if(_0x56837b){return _0x463953[_0x4e9a('0x29')](_0x3fb34)[_0x4e9a('0x2a')](_0x56837b);}};}function respondWithFilteredResult(_0x275ab9,_0x32b9d4){return function(_0x397716){if(_0x397716){var _0x2610d5=_0x397716[_0x4e9a('0x2b')],_0x5b2f1c=_0x32b9d4[_0x4e9a('0x2c')],_0x463101=_0x32b9d4[_0x4e9a('0x2c')]+_0x32b9d4['limit'],_0x53c347;if(_0x463101>=_0x2610d5){_0x463101=_0x2610d5;_0x53c347=0xc8;}else{_0x53c347=0xce;}_0x275ab9['status'](_0x53c347);return _0x275ab9[_0x4e9a('0x2d')](_0x4e9a('0x2e'),_0x5b2f1c+'-'+_0x463101+'/'+_0x2610d5)[_0x4e9a('0x2a')](_0x397716);}return null;};}function patchUpdates(_0x4b51c2){return function(_0x11d03b){try{jsonpatch[_0x4e9a('0x2f')](_0x11d03b,_0x4b51c2,!![]);}catch(_0x191a06){return BPromise[_0x4e9a('0x30')](_0x191a06);}return _0x11d03b[_0x4e9a('0x31')]();};}function saveUpdates(_0x56f82d,_0x11c9dc){return function(_0x29b997){if(_0x29b997){return _0x29b997[_0x4e9a('0x32')](_0x56f82d)[_0x4e9a('0x1c')](function(_0x309d44){return _0x309d44;});}return null;};}function removeEntity(_0x249ad8,_0x426550){return function(_0x32a1cc){if(_0x32a1cc){return _0x32a1cc['destroy']()[_0x4e9a('0x1c')](function(){var _0x518b21=_0x32a1cc[_0x4e9a('0x33')]({'plain':!![]});var _0x2ab52a=_0x4e9a('0x34');return db['UserProfileResource'][_0x4e9a('0x35')]({'where':{'type':_0x2ab52a,'resourceId':_0x518b21['id']}})[_0x4e9a('0x1c')](function(){return _0x32a1cc;});})[_0x4e9a('0x1c')](function(){_0x249ad8[_0x4e9a('0x29')](0xcc)[_0x4e9a('0x28')]();});}};}function handleEntityNotFound(_0x324d51,_0x319a29){return function(_0x39da88){if(!_0x39da88){_0x324d51[_0x4e9a('0x27')](0x194);}return _0x39da88;};}function handleError(_0x1d1366,_0x199171){_0x199171=_0x199171||0x1f4;return function(_0x6f83e3){logger[_0x4e9a('0x23')](_0x6f83e3[_0x4e9a('0x36')]);if(_0x6f83e3[_0x4e9a('0x37')]){delete _0x6f83e3[_0x4e9a('0x37')];}_0x1d1366['status'](_0x199171)[_0x4e9a('0x38')](_0x6f83e3);};}exports[_0x4e9a('0x39')]=function(_0x335bfa,_0x1fac1c){var _0x8d85dd={},_0x3cada5={},_0x27ecbd={'count':0x0,'rows':[]};var _0x3aecb3=_[_0x4e9a('0x3a')](db['VoiceContext'][_0x4e9a('0x3b')],function(_0x7c1517){return{'name':_0x7c1517['fieldName'],'type':_0x7c1517[_0x4e9a('0x3c')][_0x4e9a('0x3d')]};});_0x3cada5[_0x4e9a('0x3e')]=_[_0x4e9a('0x3a')](_0x3aecb3,_0x4e9a('0x37'));_0x3cada5['query']=_[_0x4e9a('0x3f')](_0x335bfa[_0x4e9a('0x40')]);_0x3cada5[_0x4e9a('0x41')]=_[_0x4e9a('0x42')](_0x3cada5['model'],_0x3cada5[_0x4e9a('0x40')]);_0x8d85dd[_0x4e9a('0x43')]=_[_0x4e9a('0x42')](_0x3cada5['model'],qs[_0x4e9a('0x44')](_0x335bfa[_0x4e9a('0x40')]['fields']));_0x8d85dd[_0x4e9a('0x43')]=_0x8d85dd[_0x4e9a('0x43')]['length']?_0x8d85dd[_0x4e9a('0x43')]:_0x3cada5[_0x4e9a('0x3e')];if(!_0x335bfa[_0x4e9a('0x40')][_0x4e9a('0x45')](_0x4e9a('0x46'))){_0x8d85dd[_0x4e9a('0x47')]=qs[_0x4e9a('0x47')](_0x335bfa[_0x4e9a('0x40')][_0x4e9a('0x47')]);_0x8d85dd['offset']=qs['offset'](_0x335bfa['query']['offset']);}_0x8d85dd[_0x4e9a('0x48')]=qs[_0x4e9a('0x49')](_0x335bfa['query'][_0x4e9a('0x49')]);_0x8d85dd['where']=qs[_0x4e9a('0x41')](_[_0x4e9a('0x4a')](_0x335bfa['query'],_0x3cada5['filters']));if(_0x335bfa['query'][_0x4e9a('0x4b')]){_0x8d85dd[_0x4e9a('0x4c')]=_['merge'](_0x8d85dd[_0x4e9a('0x4c')],{'$or':_[_0x4e9a('0x3a')](_0x3aecb3,function(_0x4f848c){if(_0x4f848c[_0x4e9a('0x3c')]!==_0x4e9a('0x4d')){var _0x3af39c={};_0x3af39c[_0x4f848c[_0x4e9a('0x37')]]={'$like':'%'+_0x335bfa[_0x4e9a('0x40')][_0x4e9a('0x4b')]+'%'};return _0x3af39c;}})});}_0x8d85dd=_[_0x4e9a('0x4e')]({},_0x8d85dd,_0x335bfa[_0x4e9a('0x4f')]);var _0x2399a8={'where':_0x8d85dd['where']};return db[_0x4e9a('0x50')][_0x4e9a('0x2b')](_0x2399a8)[_0x4e9a('0x1c')](function(_0x1d4192){_0x27ecbd[_0x4e9a('0x2b')]=_0x1d4192;if(_0x335bfa[_0x4e9a('0x40')][_0x4e9a('0x51')]){_0x8d85dd[_0x4e9a('0x52')]=[{'all':!![]}];}return db[_0x4e9a('0x50')]['findAll'](_0x8d85dd);})[_0x4e9a('0x1c')](function(_0x3b99ab){_0x27ecbd[_0x4e9a('0x53')]=_0x3b99ab;return _0x27ecbd;})['then'](respondWithFilteredResult(_0x1fac1c,_0x8d85dd))['catch'](handleError(_0x1fac1c,null));};exports[_0x4e9a('0x54')]=function(_0x28ef98,_0x3fdcf1){var _0x306c5c={'raw':![],'where':{'id':_0x28ef98[_0x4e9a('0x55')]['id']}},_0x1521d7={};_0x1521d7[_0x4e9a('0x3e')]=_[_0x4e9a('0x3f')](db['VoiceContext'][_0x4e9a('0x3b')]);_0x1521d7['query']=_[_0x4e9a('0x3f')](_0x28ef98[_0x4e9a('0x40')]);_0x1521d7[_0x4e9a('0x41')]=_[_0x4e9a('0x42')](_0x1521d7[_0x4e9a('0x3e')],_0x1521d7[_0x4e9a('0x40')]);_0x306c5c[_0x4e9a('0x43')]=_[_0x4e9a('0x42')](_0x1521d7[_0x4e9a('0x3e')],qs[_0x4e9a('0x44')](_0x28ef98[_0x4e9a('0x40')][_0x4e9a('0x44')]));_0x306c5c[_0x4e9a('0x43')]=_0x306c5c['attributes'][_0x4e9a('0x56')]?_0x306c5c[_0x4e9a('0x43')]:_0x1521d7[_0x4e9a('0x3e')];if(_0x28ef98[_0x4e9a('0x40')][_0x4e9a('0x51')]){_0x306c5c[_0x4e9a('0x52')]=[{'all':!![]}];}_0x306c5c=_[_0x4e9a('0x4e')]({},_0x306c5c,_0x28ef98[_0x4e9a('0x4f')]);return db['VoiceContext'][_0x4e9a('0x57')](_0x306c5c)[_0x4e9a('0x1c')](handleEntityNotFound(_0x3fdcf1,null))[_0x4e9a('0x1c')](respondWithResult(_0x3fdcf1,null))[_0x4e9a('0x26')](handleError(_0x3fdcf1,null));};exports[_0x4e9a('0x58')]=function(_0x181df8,_0x43d7bd,_0x223713){var _0xc2d672;return db['VoiceContext']['create'](_0x181df8[_0x4e9a('0x59')],{'raw':!![]})[_0x4e9a('0x1c')](function(_0x1da803){_0xc2d672=_0x1da803;return db['VoiceContext']['findAll']({'raw':!![]});})[_0x4e9a('0x1c')](function(_0x5ef872){var _0x178197=fs[_0x4e9a('0x5a')](path[_0x4e9a('0x5b')](config[_0x4e9a('0x5c')],'server/files/templates/context.ejs'),'utf8');var _0x260e0b=ejs['render'](_0x178197,{'contexts':_0x5ef872||[]});fs[_0x4e9a('0x5d')](_0x4e9a('0x5e'),_0x260e0b);})[_0x4e9a('0x1c')](function(){return respondWithRpcPromise(_0x4e9a('0x5f'),_0x4e9a('0x58'),{'module':'chan_sip.so'});})['then'](function(){var _0x1c8ef1=_0x181df8[_0x4e9a('0x60')]['get']({'plain':!![]});if(!_0x1c8ef1)throw new Error(_0x4e9a('0x61'));if(_0x1c8ef1[_0x4e9a('0x62')]===_0x4e9a('0x60')){var _0x402ea5=_0xc2d672[_0x4e9a('0x33')]({'plain':!![]});return db[_0x4e9a('0x63')][_0x4e9a('0x57')]({'where':{'name':_0x4e9a('0x34'),'userProfileId':_0x1c8ef1[_0x4e9a('0x64')]},'raw':!![]})['then'](function(_0x19213b){if(_0x19213b&&_0x19213b[_0x4e9a('0x65')]===0x0){return db['UserProfileResource']['create']({'name':_0x402ea5[_0x4e9a('0x37')],'resourceId':_0x402ea5['id'],'type':_0x19213b[_0x4e9a('0x37')],'sectionId':_0x19213b['id']},{})[_0x4e9a('0x1c')](function(){return _0xc2d672;});}else{return _0xc2d672;}})[_0x4e9a('0x26')](function(_0x40274d){logger['error'](_0x4e9a('0x66'),_0x40274d);throw _0x40274d;});}return _0xc2d672;})[_0x4e9a('0x1c')](respondWithResult(_0x43d7bd,0xc9))['catch'](handleError(_0x43d7bd,null));};exports[_0x4e9a('0x32')]=function(_0x2aa33f,_0xbd8c49,_0x4f2ff5){var _0x5e2a65;return db[_0x4e9a('0x50')][_0x4e9a('0x57')]({'where':{'id':_0x2aa33f['params']['id']}})['then'](handleEntityNotFound(_0xbd8c49,null))[_0x4e9a('0x1c')](saveUpdates(_0x2aa33f['body'],null))[_0x4e9a('0x1c')](function(_0xc7d42d){if(_0xc7d42d){_0x5e2a65=_0xc7d42d;return db[_0x4e9a('0x50')][_0x4e9a('0x67')]({'raw':!![]});}})[_0x4e9a('0x1c')](function(_0x455d7f){var _0x3dd9c0=fs['readFileSync'](path[_0x4e9a('0x5b')](config['root'],'server/files/templates/context.ejs'),_0x4e9a('0x68'));var _0x2b1f0b=ejs['render'](_0x3dd9c0,{'contexts':_0x455d7f||[]});fs[_0x4e9a('0x5d')]('/etc/asterisk/extensions_xcally_contexts.conf',_0x2b1f0b);})[_0x4e9a('0x1c')](function(){return respondWithRpcPromise('Reload','update',{'module':_0x4e9a('0x69')});})['then'](function(){return _0x5e2a65;})[_0x4e9a('0x1c')](respondWithResult(_0xbd8c49,null))[_0x4e9a('0x26')](handleError(_0xbd8c49,null));};exports[_0x4e9a('0x35')]=function(_0x4e3ff4,_0x7b929e,_0x164a45){var _0x51aff0;return db[_0x4e9a('0x50')][_0x4e9a('0x57')]({'where':{'id':_0x4e3ff4[_0x4e9a('0x55')]['id']}})[_0x4e9a('0x1c')](handleEntityNotFound(_0x7b929e,null))[_0x4e9a('0x1c')](removeEntity(_0x7b929e,null))[_0x4e9a('0x1c')](function(){return db[_0x4e9a('0x50')][_0x4e9a('0x67')]({'raw':!![]});})[_0x4e9a('0x1c')](function(_0x426ec0){var _0x5a9536=fs[_0x4e9a('0x5a')](path['join'](config[_0x4e9a('0x5c')],_0x4e9a('0x6a')),_0x4e9a('0x68'));var _0x5c5707=ejs[_0x4e9a('0x6b')](_0x5a9536,{'contexts':_0x426ec0});fs['writeFileSync'](_0x4e9a('0x5e'),_0x5c5707);return respondWithRpcPromise(_0x4e9a('0x5f'),_0x4e9a('0x35'),{'module':'chan_sip.so'});})['catch'](handleError(_0x7b929e,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index c4f0db6..1e504b0 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 _0xb3e1=['lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x5a05b6,_0x4c8435){var _0x4cd107=function(_0x347343){while(--_0x347343){_0x5a05b6['push'](_0x5a05b6['shift']());}};_0x4cd107(++_0x4c8435);}(_0xb3e1,0xd2));var _0x1b3e=function(_0x386c3e,_0x44a375){_0x386c3e=_0x386c3e-0x0;var _0x4b8e13=_0xb3e1[_0x386c3e];return _0x4b8e13;};'use strict';var _=require(_0x1b3e('0x0'));var util=require(_0x1b3e('0x1'));var logger=require('../../config/logger')(_0x1b3e('0x2'));var moment=require(_0x1b3e('0x3'));var BPromise=require(_0x1b3e('0x4'));var rp=require(_0x1b3e('0x5'));var fs=require('fs');var path=require(_0x1b3e('0x6'));var rimraf=require(_0x1b3e('0x7'));var config=require(_0x1b3e('0x8'));var attributes=require(_0x1b3e('0x9'));module[_0x1b3e('0xa')]=function(_0x3e2413,_0x43d9f9){return _0x3e2413[_0x1b3e('0xb')](_0x1b3e('0xc'),attributes,{'tableName':_0x1b3e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc6c4=['exports','define','request-promise','path','../../config/environment','./voiceContext.attributes'];(function(_0x2a409c,_0x589035){var _0x1f2fbb=function(_0x1647f6){while(--_0x1647f6){_0x2a409c['push'](_0x2a409c['shift']());}};_0x1f2fbb(++_0x589035);}(_0xc6c4,0x8c));var _0x4c6c=function(_0x14252b,_0x124186){_0x14252b=_0x14252b-0x0;var _0x111129=_0xc6c4[_0x14252b];return _0x111129;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x4c6c('0x0'));var fs=require('fs');var path=require(_0x4c6c('0x1'));var rimraf=require('rimraf');var config=require(_0x4c6c('0x2'));var attributes=require(_0x4c6c('0x3'));module[_0x4c6c('0x4')]=function(_0x57b02a,_0x395d53){return _0x57b02a[_0x4c6c('0x5')]('VoiceContext',attributes,{'tableName':'voice_contexts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.rpc.js b/server/api/voiceContext/voiceContext.rpc.js index 26b962c..bb5a64b 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 _0x9bcd=['error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x36ccd3,_0x518fb0){var _0x1b40cd=function(_0x336c4d){while(--_0x336c4d){_0x36ccd3['push'](_0x36ccd3['shift']());}};_0x1b40cd(++_0x518fb0);}(_0x9bcd,0x100));var _0xd9bc=function(_0x3ec644,_0x4fe0ac){_0x3ec644=_0x3ec644-0x0;var _0x443fd1=_0x9bcd[_0x3ec644];return _0x443fd1;};'use strict';var _=require(_0xd9bc('0x0'));var util=require(_0xd9bc('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xd9bc('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd9bc('0x3'))['db'];var utils=require(_0xd9bc('0x4'));var logger=require(_0xd9bc('0x5'))(_0xd9bc('0x6'));var config=require('../../config/environment');var jayson=require(_0xd9bc('0x7'));var client=jayson[_0xd9bc('0x8')][_0xd9bc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e4bf2,_0x2d0fc8,_0x2d471e){return new BPromise(function(_0x4c6378,_0x293503){return client[_0xd9bc('0xa')](_0x4e4bf2,_0x2d471e)[_0xd9bc('0xb')](function(_0x2b645c){logger[_0xd9bc('0xc')](_0xd9bc('0xd'),_0x2d0fc8,_0xd9bc('0xe'));logger[_0xd9bc('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x2d0fc8,_0xd9bc('0xe'),JSON[_0xd9bc('0x10')](_0x2b645c));if(_0x2b645c[_0xd9bc('0x11')]){if(_0x2b645c[_0xd9bc('0x11')][_0xd9bc('0x12')]===0x1f4){logger[_0xd9bc('0x11')](_0xd9bc('0xd'),_0x2d0fc8,_0x2b645c[_0xd9bc('0x11')]['message']);return _0x293503(_0x2b645c[_0xd9bc('0x11')][_0xd9bc('0x13')]);}logger['error'](_0xd9bc('0xd'),_0x2d0fc8,_0x2b645c[_0xd9bc('0x11')][_0xd9bc('0x13')]);return _0x4c6378(_0x2b645c['error'][_0xd9bc('0x13')]);}else{logger[_0xd9bc('0xc')]('VoiceContext,\x20%s,\x20%s',_0x2d0fc8,_0xd9bc('0xe'));_0x4c6378(_0x2b645c[_0xd9bc('0x14')][_0xd9bc('0x13')]);}})['catch'](function(_0x240600){logger['error'](_0xd9bc('0xd'),_0x2d0fc8,_0x240600);_0x293503(_0x240600);});});} \ No newline at end of file +var _0x0aab=['request\x20sent','debug','VoiceContext,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','info','VoiceContext,\x20%s,\x20%s'];(function(_0x5bf407,_0x10939c){var _0x1d3a28=function(_0x54d328){while(--_0x54d328){_0x5bf407['push'](_0x5bf407['shift']());}};_0x1d3a28(++_0x10939c);}(_0x0aab,0x169));var _0xb0aa=function(_0x513047,_0x2199c5){_0x513047=_0x513047-0x0;var _0x15b779=_0x0aab[_0x513047];return _0x15b779;};'use strict';var _=require(_0xb0aa('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb0aa('0x1'));var rs=require(_0xb0aa('0x2'));var fs=require('fs');var Redis=require(_0xb0aa('0x3'));var db=require(_0xb0aa('0x4'))['db'];var utils=require(_0xb0aa('0x5'));var logger=require(_0xb0aa('0x6'))('rpc');var config=require(_0xb0aa('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb0aa('0x8')][_0xb0aa('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58bcfd,_0x4c1b16,_0x1e180e){return new BPromise(function(_0x388a53,_0x53dd65){return client['request'](_0x58bcfd,_0x1e180e)[_0xb0aa('0xa')](function(_0xc81721){logger[_0xb0aa('0xb')](_0xb0aa('0xc'),_0x4c1b16,_0xb0aa('0xd'));logger[_0xb0aa('0xe')](_0xb0aa('0xf'),_0x4c1b16,_0xb0aa('0xd'),JSON[_0xb0aa('0x10')](_0xc81721));if(_0xc81721[_0xb0aa('0x11')]){if(_0xc81721[_0xb0aa('0x11')][_0xb0aa('0x12')]===0x1f4){logger['error'](_0xb0aa('0xc'),_0x4c1b16,_0xc81721[_0xb0aa('0x11')][_0xb0aa('0x13')]);return _0x53dd65(_0xc81721['error'][_0xb0aa('0x13')]);}logger[_0xb0aa('0x11')](_0xb0aa('0xc'),_0x4c1b16,_0xc81721[_0xb0aa('0x11')][_0xb0aa('0x13')]);return _0x388a53(_0xc81721[_0xb0aa('0x11')][_0xb0aa('0x13')]);}else{logger[_0xb0aa('0xb')]('VoiceContext,\x20%s,\x20%s',_0x4c1b16,_0xb0aa('0xd'));_0x388a53(_0xc81721[_0xb0aa('0x14')][_0xb0aa('0x13')]);}})[_0xb0aa('0x15')](function(_0x52f4f3){logger[_0xb0aa('0x11')]('VoiceContext,\x20%s,\x20%s',_0x4c1b16,_0x52f4f3);_0x53dd65(_0x52f4f3);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index 0573f8c..6f76adc 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 _0xcf15=['describe','post','/:id','delete','destroy','exports','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe'];(function(_0xa22583,_0x564cdd){var _0x3e2d07=function(_0x56520a){while(--_0x56520a){_0xa22583['push'](_0xa22583['shift']());}};_0x3e2d07(++_0x564cdd);}(_0xcf15,0x7d));var _0x5cf1=function(_0x5ff027,_0x451702){_0x5ff027=_0x5ff027-0x0;var _0x2ca147=_0xcf15[_0x5ff027];return _0x2ca147;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5cf1('0x0'));var timeout=require(_0x5cf1('0x1'));var express=require(_0x5cf1('0x2'));var router=express[_0x5cf1('0x3')]();var auth=require('../../components/auth/service');var interaction=require(_0x5cf1('0x4'));var config=require(_0x5cf1('0x5'));var controller=require(_0x5cf1('0x6'));router[_0x5cf1('0x7')]('/',auth[_0x5cf1('0x8')](),controller[_0x5cf1('0x9')]);router[_0x5cf1('0x7')](_0x5cf1('0xa'),auth[_0x5cf1('0x8')](),controller[_0x5cf1('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x5cf1('0xc')]('/',auth[_0x5cf1('0x8')](),controller['create']);router['put'](_0x5cf1('0xd'),auth['isAuthenticated'](),controller['update']);router[_0x5cf1('0xe')](_0x5cf1('0xd'),auth['isAuthenticated'](),controller[_0x5cf1('0xf')]);module[_0x5cf1('0x10')]=router; \ No newline at end of file +var _0x3c47=['show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x141449,_0x4f2291){var _0x30db77=function(_0x5b6021){while(--_0x5b6021){_0x141449['push'](_0x141449['shift']());}};_0x30db77(++_0x4f2291);}(_0x3c47,0x188));var _0x73c4=function(_0x51ed77,_0x35baf6){_0x51ed77=_0x51ed77-0x0;var _0x1e3512=_0x3c47[_0x51ed77];return _0x1e3512;};'use strict';var multer=require(_0x73c4('0x0'));var util=require(_0x73c4('0x1'));var path=require(_0x73c4('0x2'));var timeout=require(_0x73c4('0x3'));var express=require(_0x73c4('0x4'));var router=express[_0x73c4('0x5')]();var auth=require(_0x73c4('0x6'));var interaction=require(_0x73c4('0x7'));var config=require(_0x73c4('0x8'));var controller=require(_0x73c4('0x9'));router[_0x73c4('0xa')]('/',auth[_0x73c4('0xb')](),controller[_0x73c4('0xc')]);router[_0x73c4('0xa')](_0x73c4('0xd'),auth[_0x73c4('0xb')](),controller[_0x73c4('0xe')]);router[_0x73c4('0xa')](_0x73c4('0xf'),auth[_0x73c4('0xb')](),controller[_0x73c4('0x10')]);router[_0x73c4('0x11')]('/',auth['isAuthenticated'](),controller[_0x73c4('0x12')]);router[_0x73c4('0x13')](_0x73c4('0xf'),auth['isAuthenticated'](),controller[_0x73c4('0x14')]);router[_0x73c4('0x15')](_0x73c4('0xf'),auth[_0x73c4('0xb')](),controller[_0x73c4('0x16')]);module[_0x73c4('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index 9322ea6..c58810d 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 _0x0d68=['DATE','sequelize','STRING','INTEGER'];(function(_0x53d017,_0x11565c){var _0x4f369f=function(_0x529785){while(--_0x529785){_0x53d017['push'](_0x53d017['shift']());}};_0x4f369f(++_0x11565c);}(_0x0d68,0x129));var _0x80d6=function(_0x9076ca,_0x57e87b){_0x9076ca=_0x9076ca-0x0;var _0x557f0a=_0x0d68[_0x9076ca];return _0x557f0a;};'use strict';var Sequelize=require(_0x80d6('0x0'));module['exports']={'privilege':{'type':Sequelize[_0x80d6('0x1')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x80d6('0x2')]},'channelstatedesc':{'type':Sequelize[_0x80d6('0x1')]},'calleridnum':{'type':Sequelize[_0x80d6('0x1')]},'calleridname':{'type':Sequelize[_0x80d6('0x1')]},'connectedlinenum':{'type':Sequelize[_0x80d6('0x1')]},'connectedlinename':{'type':Sequelize[_0x80d6('0x1')]},'language':{'type':Sequelize[_0x80d6('0x1')]},'accountcode':{'type':Sequelize[_0x80d6('0x1')]},'context':{'type':Sequelize[_0x80d6('0x1')]},'exten':{'type':Sequelize[_0x80d6('0x1')]},'priority':{'type':Sequelize[_0x80d6('0x2')]},'uniqueid':{'type':Sequelize[_0x80d6('0x1')]},'linkedid':{'type':Sequelize[_0x80d6('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x80d6('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x80d6('0x1')]},'destcalleridnum':{'type':Sequelize[_0x80d6('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x80d6('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x80d6('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize['STRING']},'destexten':{'type':Sequelize[_0x80d6('0x1')]},'destpriority':{'type':Sequelize[_0x80d6('0x2')]},'destuniqueid':{'type':Sequelize[_0x80d6('0x1')]},'destlinkedid':{'type':Sequelize[_0x80d6('0x1')]},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0x80d6('0x1')]},'starttime':{'type':Sequelize[_0x80d6('0x3')]},'answertime':{'type':Sequelize[_0x80d6('0x3')]},'endtime':{'type':Sequelize[_0x80d6('0x3')]},'lastevent':{'type':Sequelize['STRING'],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x80d6('0x2')]},'duration':{'type':Sequelize[_0x80d6('0x2')]},'holdtime':{'type':Sequelize[_0x80d6('0x2')]},'billableseconds':{'type':Sequelize[_0x80d6('0x2')]}}; \ No newline at end of file +var _0x1554=['STRING','INTEGER','DATE','called,connect,complete','exports'];(function(_0x3af126,_0x230eb7){var _0x2c094c=function(_0x2c0dc8){while(--_0x2c0dc8){_0x3af126['push'](_0x3af126['shift']());}};_0x2c094c(++_0x230eb7);}(_0x1554,0x108));var _0x4155=function(_0x160e7b,_0x31b29c){_0x160e7b=_0x160e7b-0x0;var _0x3fc88a=_0x1554[_0x160e7b];return _0x3fc88a;};'use strict';var Sequelize=require('sequelize');module[_0x4155('0x0')]={'privilege':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x4155('0x1')]},'channelstate':{'type':Sequelize[_0x4155('0x2')]},'channelstatedesc':{'type':Sequelize[_0x4155('0x1')]},'calleridnum':{'type':Sequelize[_0x4155('0x1')]},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x4155('0x1')]},'connectedlinename':{'type':Sequelize[_0x4155('0x1')]},'language':{'type':Sequelize[_0x4155('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4155('0x1')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x4155('0x2')]},'uniqueid':{'type':Sequelize[_0x4155('0x1')]},'linkedid':{'type':Sequelize[_0x4155('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0x4155('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x4155('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize[_0x4155('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x4155('0x1')]},'destaccountcode':{'type':Sequelize[_0x4155('0x1')]},'destcontext':{'type':Sequelize[_0x4155('0x1')]},'destexten':{'type':Sequelize[_0x4155('0x1')]},'destpriority':{'type':Sequelize['INTEGER']},'destuniqueid':{'type':Sequelize[_0x4155('0x1')]},'destlinkedid':{'type':Sequelize[_0x4155('0x1')]},'dialstring':{'type':Sequelize[_0x4155('0x1')]},'dialstatus':{'type':Sequelize[_0x4155('0x1')]},'starttime':{'type':Sequelize[_0x4155('0x3')]},'answertime':{'type':Sequelize[_0x4155('0x3')]},'endtime':{'type':Sequelize[_0x4155('0x3')]},'lastevent':{'type':Sequelize[_0x4155('0x1')],'comment':_0x4155('0x4')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0x4155('0x2')]},'holdtime':{'type':Sequelize[_0x4155('0x2')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index cfdf61f..60baab0 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 _0x6f26=['desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','limit','Content-Range','reject','then','destroy','error','stack','name','send','index','map','VoiceDialReport','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','params','find','create','update','body','html-pdf','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','squel'];(function(_0x173ea4,_0x1ed6ce){var _0x2491ff=function(_0x1d4405){while(--_0x1d4405){_0x173ea4['push'](_0x173ea4['shift']());}};_0x2491ff(++_0x1ed6ce);}(_0x6f26,0x19e));var _0x66f2=function(_0x2e9662,_0xba0b06){_0x2e9662=_0x2e9662-0x0;var _0xec0122=_0x6f26[_0x2e9662];return _0xec0122;};'use strict';var pdf=require(_0x66f2('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x66f2('0x1'));var zipdir=require(_0x66f2('0x2'));var jsonpatch=require(_0x66f2('0x3'));var rp=require('request-promise');var moment=require(_0x66f2('0x4'));var BPromise=require(_0x66f2('0x5'));var Mustache=require(_0x66f2('0x6'));var util=require(_0x66f2('0x7'));var path=require(_0x66f2('0x8'));var sox=require(_0x66f2('0x9'));var csv=require('to-csv');var ejs=require(_0x66f2('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0x66f2('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x66f2('0xc'));var toCsv=require(_0x66f2('0xd'));var querystring=require('querystring');var Papa=require(_0x66f2('0xe'));var Redis=require(_0x66f2('0xf'));var authService=require(_0x66f2('0x10'));var qs=require(_0x66f2('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66f2('0x12'));var logger=require(_0x66f2('0x13'))(_0x66f2('0x14'));var utils=require(_0x66f2('0x15'));var config=require(_0x66f2('0x16'));var db=require(_0x66f2('0x17'))['db'];function respondWithStatusCode(_0x39da66,_0x1cb0be){_0x1cb0be=_0x1cb0be||0xcc;return function(_0x17956d){if(_0x17956d){return _0x39da66[_0x66f2('0x18')](_0x1cb0be);}return _0x39da66['status'](_0x1cb0be)[_0x66f2('0x19')]();};}function respondWithResult(_0x569576,_0x170ef3){_0x170ef3=_0x170ef3||0xc8;return function(_0x2596ce){if(_0x2596ce){return _0x569576[_0x66f2('0x1a')](_0x170ef3)[_0x66f2('0x1b')](_0x2596ce);}};}function respondWithFilteredResult(_0x4f8dc5,_0x2d2ddf){return function(_0x1f7ea9){if(_0x1f7ea9){var _0x22597c=_0x1f7ea9['count'],_0xc492af=_0x2d2ddf[_0x66f2('0x1c')],_0x212968=_0x2d2ddf[_0x66f2('0x1c')]+_0x2d2ddf[_0x66f2('0x1d')],_0xb2f980;if(_0x212968>=_0x22597c){_0x212968=_0x22597c;_0xb2f980=0xc8;}else{_0xb2f980=0xce;}_0x4f8dc5[_0x66f2('0x1a')](_0xb2f980);return _0x4f8dc5['set'](_0x66f2('0x1e'),_0xc492af+'-'+_0x212968+'/'+_0x22597c)[_0x66f2('0x1b')](_0x1f7ea9);}return null;};}function patchUpdates(_0x163324){return function(_0x4aa075){try{jsonpatch['apply'](_0x4aa075,_0x163324,!![]);}catch(_0x5cf803){return BPromise[_0x66f2('0x1f')](_0x5cf803);}return _0x4aa075['save']();};}function saveUpdates(_0x2e891a,_0x4c71ab){return function(_0x522e0a){if(_0x522e0a){return _0x522e0a['update'](_0x2e891a)[_0x66f2('0x20')](function(_0x3a8340){return _0x3a8340;});}return null;};}function removeEntity(_0x3c32d3,_0x5a141f){return function(_0x2c4420){if(_0x2c4420){return _0x2c4420[_0x66f2('0x21')]()[_0x66f2('0x20')](function(){_0x3c32d3['status'](0xcc)[_0x66f2('0x19')]();});}};}function handleEntityNotFound(_0x28ab19,_0x3802e1){return function(_0x3fbdce){if(!_0x3fbdce){_0x28ab19[_0x66f2('0x18')](0x194);}return _0x3fbdce;};}function handleError(_0xeb8730,_0x72d4ca){_0x72d4ca=_0x72d4ca||0x1f4;return function(_0x49fcb9){logger[_0x66f2('0x22')](_0x49fcb9[_0x66f2('0x23')]);if(_0x49fcb9[_0x66f2('0x24')]){delete _0x49fcb9[_0x66f2('0x24')];}_0xeb8730[_0x66f2('0x1a')](_0x72d4ca)[_0x66f2('0x25')](_0x49fcb9);};}exports[_0x66f2('0x26')]=function(_0x1cf6b3,_0x128bc7){var _0x459b63={},_0x5c7c23={},_0x44a9ce={'count':0x0,'rows':[]};var _0x1ae4fa=_[_0x66f2('0x27')](db[_0x66f2('0x28')][_0x66f2('0x29')],function(_0x5d206c){return{'name':_0x5d206c[_0x66f2('0x2a')],'type':_0x5d206c['type']['key']};});_0x5c7c23['model']=_[_0x66f2('0x27')](_0x1ae4fa,_0x66f2('0x24'));_0x5c7c23[_0x66f2('0x2b')]=_[_0x66f2('0x2c')](_0x1cf6b3[_0x66f2('0x2b')]);_0x5c7c23[_0x66f2('0x2d')]=_[_0x66f2('0x2e')](_0x5c7c23[_0x66f2('0x2f')],_0x5c7c23[_0x66f2('0x2b')]);_0x459b63[_0x66f2('0x30')]=_[_0x66f2('0x2e')](_0x5c7c23[_0x66f2('0x2f')],qs['fields'](_0x1cf6b3['query'][_0x66f2('0x31')]));_0x459b63['attributes']=_0x459b63[_0x66f2('0x30')][_0x66f2('0x32')]?_0x459b63[_0x66f2('0x30')]:_0x5c7c23[_0x66f2('0x2f')];if(!_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x33')]('nolimit')){_0x459b63[_0x66f2('0x1d')]=qs[_0x66f2('0x1d')](_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x1d')]);_0x459b63[_0x66f2('0x1c')]=qs['offset'](_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x1c')]);}_0x459b63['order']=qs[_0x66f2('0x34')](_0x1cf6b3['query'][_0x66f2('0x34')]);_0x459b63[_0x66f2('0x35')]=qs[_0x66f2('0x2d')](_[_0x66f2('0x36')](_0x1cf6b3[_0x66f2('0x2b')],_0x5c7c23[_0x66f2('0x2d')]));if(_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x37')]){_0x459b63[_0x66f2('0x35')]=_[_0x66f2('0x38')](_0x459b63[_0x66f2('0x35')],{'$or':_['map'](_0x1ae4fa,function(_0x298d1d){if(_0x298d1d[_0x66f2('0x39')]!==_0x66f2('0x3a')){var _0x302b31={};_0x302b31[_0x298d1d[_0x66f2('0x24')]]={'$like':'%'+_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x37')]+'%'};return _0x302b31;}})});}_0x459b63=_[_0x66f2('0x38')]({},_0x459b63,_0x1cf6b3[_0x66f2('0x3b')]);var _0x5cacc6={'where':_0x459b63[_0x66f2('0x35')]};return db[_0x66f2('0x28')]['count'](_0x5cacc6)[_0x66f2('0x20')](function(_0x2f2999){_0x44a9ce[_0x66f2('0x3c')]=_0x2f2999;if(_0x1cf6b3[_0x66f2('0x2b')][_0x66f2('0x3d')]){_0x459b63[_0x66f2('0x3e')]=[{'all':!![]}];}return db[_0x66f2('0x28')][_0x66f2('0x3f')](_0x459b63);})[_0x66f2('0x20')](function(_0x12ed44){_0x44a9ce[_0x66f2('0x40')]=_0x12ed44;return _0x44a9ce;})[_0x66f2('0x20')](respondWithFilteredResult(_0x128bc7,_0x459b63))[_0x66f2('0x41')](handleError(_0x128bc7,null));};exports['show']=function(_0x5b8349,_0x5cb329){var _0x25c287={'raw':!![],'where':{'id':_0x5b8349[_0x66f2('0x42')]['id']}},_0x500ee9={};_0x500ee9[_0x66f2('0x2f')]=_[_0x66f2('0x2c')](db['VoiceDialReport'][_0x66f2('0x29')]);_0x500ee9['query']=_[_0x66f2('0x2c')](_0x5b8349['query']);_0x500ee9['filters']=_[_0x66f2('0x2e')](_0x500ee9[_0x66f2('0x2f')],_0x500ee9[_0x66f2('0x2b')]);_0x25c287['attributes']=_[_0x66f2('0x2e')](_0x500ee9[_0x66f2('0x2f')],qs[_0x66f2('0x31')](_0x5b8349[_0x66f2('0x2b')][_0x66f2('0x31')]));_0x25c287[_0x66f2('0x30')]=_0x25c287[_0x66f2('0x30')][_0x66f2('0x32')]?_0x25c287[_0x66f2('0x30')]:_0x500ee9[_0x66f2('0x2f')];if(_0x5b8349[_0x66f2('0x2b')]['includeAll']){_0x25c287[_0x66f2('0x3e')]=[{'all':!![]}];}_0x25c287=_[_0x66f2('0x38')]({},_0x25c287,_0x5b8349[_0x66f2('0x3b')]);return db['VoiceDialReport'][_0x66f2('0x43')](_0x25c287)['then'](handleEntityNotFound(_0x5cb329,null))[_0x66f2('0x20')](respondWithResult(_0x5cb329,null))[_0x66f2('0x41')](handleError(_0x5cb329,null));};exports[_0x66f2('0x44')]=function(_0x1566ed,_0x3bc7a6){return db['VoiceDialReport']['create'](_0x1566ed['body'],{})['then'](respondWithResult(_0x3bc7a6,0xc9))[_0x66f2('0x41')](handleError(_0x3bc7a6,null));};exports[_0x66f2('0x45')]=function(_0x778c94,_0x192e5a){if(_0x778c94[_0x66f2('0x46')]['id']){delete _0x778c94[_0x66f2('0x46')]['id'];}return db[_0x66f2('0x28')][_0x66f2('0x43')]({'where':{'id':_0x778c94[_0x66f2('0x42')]['id']}})[_0x66f2('0x20')](handleEntityNotFound(_0x192e5a,null))[_0x66f2('0x20')](saveUpdates(_0x778c94[_0x66f2('0x46')],null))[_0x66f2('0x20')](respondWithResult(_0x192e5a,null))[_0x66f2('0x41')](handleError(_0x192e5a,null));};exports[_0x66f2('0x21')]=function(_0x26fc93,_0x1f0e30){return db['VoiceDialReport'][_0x66f2('0x43')]({'where':{'id':_0x26fc93[_0x66f2('0x42')]['id']}})['then'](handleEntityNotFound(_0x1f0e30,null))[_0x66f2('0x20')](removeEntity(_0x1f0e30,null))[_0x66f2('0x41')](handleError(_0x1f0e30,null));};exports['describe']=function(_0xfae500,_0x1598c9){return db['VoiceDialReport']['describe']()[_0x66f2('0x20')](respondWithResult(_0x1598c9,null))[_0x66f2('0x41')](handleError(_0x1598c9,null));}; \ No newline at end of file +var _0x088d=['find','describe','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','end','name','VoiceDialReport','fieldName','type','key','model','map','query','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','limit','sort','where','pick','merge','filter','options','rows','catch','show','params','keys','includeAll','create','body'];(function(_0x3a4a1f,_0x406fb5){var _0x18112d=function(_0x8c3f34){while(--_0x8c3f34){_0x3a4a1f['push'](_0x3a4a1f['shift']());}};_0x18112d(++_0x406fb5);}(_0x088d,0x16a));var _0xd088=function(_0xa4ff36,_0x3e673c){_0xa4ff36=_0xa4ff36-0x0;var _0x2772fc=_0x088d[_0xa4ff36];return _0x2772fc;};'use strict';var pdf=require(_0xd088('0x0'));var emlformat=require(_0xd088('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xd088('0x2'));var jsonpatch=require(_0xd088('0x3'));var rp=require(_0xd088('0x4'));var moment=require(_0xd088('0x5'));var BPromise=require(_0xd088('0x6'));var Mustache=require(_0xd088('0x7'));var util=require(_0xd088('0x8'));var path=require(_0xd088('0x9'));var sox=require(_0xd088('0xa'));var csv=require('to-csv');var ejs=require(_0xd088('0xb'));var fs=require('fs');var _=require(_0xd088('0xc'));var squel=require(_0xd088('0xd'));var crypto=require('crypto');var jsforce=require(_0xd088('0xe'));var deskjs=require(_0xd088('0xf'));var toCsv=require(_0xd088('0x10'));var querystring=require(_0xd088('0x11'));var Papa=require(_0xd088('0x12'));var Redis=require(_0xd088('0x13'));var authService=require(_0xd088('0x14'));var qs=require(_0xd088('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd088('0x16'));var logger=require('../../config/logger')(_0xd088('0x17'));var utils=require('../../config/utils');var config=require(_0xd088('0x18'));var db=require(_0xd088('0x19'))['db'];function respondWithStatusCode(_0x162ef3,_0x430034){_0x430034=_0x430034||0xcc;return function(_0x3d0e8d){if(_0x3d0e8d){return _0x162ef3[_0xd088('0x1a')](_0x430034);}return _0x162ef3[_0xd088('0x1b')](_0x430034)['end']();};}function respondWithResult(_0x5b3423,_0x4355e5){_0x4355e5=_0x4355e5||0xc8;return function(_0x9176a){if(_0x9176a){return _0x5b3423[_0xd088('0x1b')](_0x4355e5)[_0xd088('0x1c')](_0x9176a);}};}function respondWithFilteredResult(_0x46662e,_0x11d611){return function(_0x2bc98b){if(_0x2bc98b){var _0x5058dd=_0x2bc98b[_0xd088('0x1d')],_0x4f4c00=_0x11d611['offset'],_0x147e76=_0x11d611[_0xd088('0x1e')]+_0x11d611['limit'],_0x5b09e9;if(_0x147e76>=_0x5058dd){_0x147e76=_0x5058dd;_0x5b09e9=0xc8;}else{_0x5b09e9=0xce;}_0x46662e[_0xd088('0x1b')](_0x5b09e9);return _0x46662e[_0xd088('0x1f')](_0xd088('0x20'),_0x4f4c00+'-'+_0x147e76+'/'+_0x5058dd)['json'](_0x2bc98b);}return null;};}function patchUpdates(_0x244790){return function(_0x44a53e){try{jsonpatch[_0xd088('0x21')](_0x44a53e,_0x244790,!![]);}catch(_0x5a23cd){return BPromise[_0xd088('0x22')](_0x5a23cd);}return _0x44a53e[_0xd088('0x23')]();};}function saveUpdates(_0x35cc2a,_0x52c4be){return function(_0x4b0d0e){if(_0x4b0d0e){return _0x4b0d0e[_0xd088('0x24')](_0x35cc2a)['then'](function(_0x2599a2){return _0x2599a2;});}return null;};}function removeEntity(_0x280497,_0x428b13){return function(_0x19aa79){if(_0x19aa79){return _0x19aa79[_0xd088('0x25')]()[_0xd088('0x26')](function(){_0x280497[_0xd088('0x1b')](0xcc)[_0xd088('0x27')]();});}};}function handleEntityNotFound(_0x3fc15f,_0x379560){return function(_0x8c9c2d){if(!_0x8c9c2d){_0x3fc15f['sendStatus'](0x194);}return _0x8c9c2d;};}function handleError(_0x2201dd,_0x173e2b){_0x173e2b=_0x173e2b||0x1f4;return function(_0x3ddacf){logger['error'](_0x3ddacf['stack']);if(_0x3ddacf[_0xd088('0x28')]){delete _0x3ddacf[_0xd088('0x28')];}_0x2201dd[_0xd088('0x1b')](_0x173e2b)['send'](_0x3ddacf);};}exports['index']=function(_0x50befc,_0x301897){var _0x25a655={},_0x2a549c={},_0x1734c6={'count':0x0,'rows':[]};var _0x5684c0=_['map'](db[_0xd088('0x29')]['rawAttributes'],function(_0x4f4b61){return{'name':_0x4f4b61[_0xd088('0x2a')],'type':_0x4f4b61[_0xd088('0x2b')][_0xd088('0x2c')]};});_0x2a549c[_0xd088('0x2d')]=_[_0xd088('0x2e')](_0x5684c0,_0xd088('0x28'));_0x2a549c[_0xd088('0x2f')]=_['keys'](_0x50befc['query']);_0x2a549c[_0xd088('0x30')]=_[_0xd088('0x31')](_0x2a549c['model'],_0x2a549c[_0xd088('0x2f')]);_0x25a655['attributes']=_[_0xd088('0x31')](_0x2a549c[_0xd088('0x2d')],qs[_0xd088('0x32')](_0x50befc[_0xd088('0x2f')][_0xd088('0x32')]));_0x25a655['attributes']=_0x25a655['attributes'][_0xd088('0x33')]?_0x25a655[_0xd088('0x34')]:_0x2a549c[_0xd088('0x2d')];if(!_0x50befc[_0xd088('0x2f')][_0xd088('0x35')](_0xd088('0x36'))){_0x25a655[_0xd088('0x37')]=qs[_0xd088('0x37')](_0x50befc[_0xd088('0x2f')][_0xd088('0x37')]);_0x25a655['offset']=qs[_0xd088('0x1e')](_0x50befc[_0xd088('0x2f')]['offset']);}_0x25a655['order']=qs[_0xd088('0x38')](_0x50befc[_0xd088('0x2f')][_0xd088('0x38')]);_0x25a655[_0xd088('0x39')]=qs['filters'](_[_0xd088('0x3a')](_0x50befc['query'],_0x2a549c['filters']));if(_0x50befc['query']['filter']){_0x25a655['where']=_[_0xd088('0x3b')](_0x25a655[_0xd088('0x39')],{'$or':_[_0xd088('0x2e')](_0x5684c0,function(_0x46eb56){if(_0x46eb56['type']!=='VIRTUAL'){var _0x126279={};_0x126279[_0x46eb56[_0xd088('0x28')]]={'$like':'%'+_0x50befc[_0xd088('0x2f')][_0xd088('0x3c')]+'%'};return _0x126279;}})});}_0x25a655=_[_0xd088('0x3b')]({},_0x25a655,_0x50befc[_0xd088('0x3d')]);var _0x45f972={'where':_0x25a655[_0xd088('0x39')]};return db[_0xd088('0x29')][_0xd088('0x1d')](_0x45f972)[_0xd088('0x26')](function(_0x233f34){_0x1734c6['count']=_0x233f34;if(_0x50befc['query']['includeAll']){_0x25a655['include']=[{'all':!![]}];}return db[_0xd088('0x29')]['findAll'](_0x25a655);})[_0xd088('0x26')](function(_0x2da8a8){_0x1734c6[_0xd088('0x3e')]=_0x2da8a8;return _0x1734c6;})[_0xd088('0x26')](respondWithFilteredResult(_0x301897,_0x25a655))[_0xd088('0x3f')](handleError(_0x301897,null));};exports[_0xd088('0x40')]=function(_0x55765c,_0x55253f){var _0x4d8d9a={'raw':!![],'where':{'id':_0x55765c[_0xd088('0x41')]['id']}},_0x31fff4={};_0x31fff4['model']=_[_0xd088('0x42')](db[_0xd088('0x29')]['rawAttributes']);_0x31fff4[_0xd088('0x2f')]=_[_0xd088('0x42')](_0x55765c[_0xd088('0x2f')]);_0x31fff4[_0xd088('0x30')]=_[_0xd088('0x31')](_0x31fff4['model'],_0x31fff4['query']);_0x4d8d9a[_0xd088('0x34')]=_['intersection'](_0x31fff4[_0xd088('0x2d')],qs[_0xd088('0x32')](_0x55765c[_0xd088('0x2f')][_0xd088('0x32')]));_0x4d8d9a[_0xd088('0x34')]=_0x4d8d9a[_0xd088('0x34')][_0xd088('0x33')]?_0x4d8d9a[_0xd088('0x34')]:_0x31fff4[_0xd088('0x2d')];if(_0x55765c['query'][_0xd088('0x43')]){_0x4d8d9a['include']=[{'all':!![]}];}_0x4d8d9a=_[_0xd088('0x3b')]({},_0x4d8d9a,_0x55765c[_0xd088('0x3d')]);return db[_0xd088('0x29')]['find'](_0x4d8d9a)[_0xd088('0x26')](handleEntityNotFound(_0x55253f,null))['then'](respondWithResult(_0x55253f,null))[_0xd088('0x3f')](handleError(_0x55253f,null));};exports[_0xd088('0x44')]=function(_0x2a4fc4,_0xba65d4){return db[_0xd088('0x29')][_0xd088('0x44')](_0x2a4fc4[_0xd088('0x45')],{})['then'](respondWithResult(_0xba65d4,0xc9))[_0xd088('0x3f')](handleError(_0xba65d4,null));};exports[_0xd088('0x24')]=function(_0x1d1a6a,_0x380450){if(_0x1d1a6a[_0xd088('0x45')]['id']){delete _0x1d1a6a[_0xd088('0x45')]['id'];}return db[_0xd088('0x29')][_0xd088('0x46')]({'where':{'id':_0x1d1a6a[_0xd088('0x41')]['id']}})[_0xd088('0x26')](handleEntityNotFound(_0x380450,null))['then'](saveUpdates(_0x1d1a6a['body'],null))[_0xd088('0x26')](respondWithResult(_0x380450,null))[_0xd088('0x3f')](handleError(_0x380450,null));};exports[_0xd088('0x25')]=function(_0x14f9ab,_0x28694d){return db[_0xd088('0x29')][_0xd088('0x46')]({'where':{'id':_0x14f9ab[_0xd088('0x41')]['id']}})[_0xd088('0x26')](handleEntityNotFound(_0x28694d,null))['then'](removeEntity(_0x28694d,null))[_0xd088('0x3f')](handleError(_0x28694d,null));};exports[_0xd088('0x47')]=function(_0x4a5bb5,_0x1e11e7){return db[_0xd088('0x29')]['describe']()['then'](respondWithResult(_0x1e11e7,null))[_0xd088('0x3f')](handleError(_0x1e11e7,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index 54105f8..5e536a8 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 _0xd218=['request-promise','path','../../config/environment','./voiceDialReport.attributes','exports','VoiceDialReport','report_dial','uniqueid','../../config/logger','api','moment'];(function(_0x221869,_0x18f121){var _0x62421=function(_0x4f1422){while(--_0x4f1422){_0x221869['push'](_0x221869['shift']());}};_0x62421(++_0x18f121);}(_0xd218,0x81));var _0x8d21=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xd218[_0xae7c2f];return _0x5d7001;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d21('0x0'))(_0x8d21('0x1'));var moment=require(_0x8d21('0x2'));var BPromise=require('bluebird');var rp=require(_0x8d21('0x3'));var fs=require('fs');var path=require(_0x8d21('0x4'));var rimraf=require('rimraf');var config=require(_0x8d21('0x5'));var attributes=require(_0x8d21('0x6'));module[_0x8d21('0x7')]=function(_0x302db8,_0xed320f){return _0x302db8['define'](_0x8d21('0x8'),attributes,{'tableName':_0x8d21('0x9'),'paranoid':![],'indexes':[{'fields':[_0x8d21('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5744=['moment','bluebird','rimraf','../../config/environment','./voiceDialReport.attributes','exports','report_dial','uniqueid','../../config/logger','api'];(function(_0x1f109c,_0xd9952e){var _0x3984e8=function(_0x40b60b){while(--_0x40b60b){_0x1f109c['push'](_0x1f109c['shift']());}};_0x3984e8(++_0xd9952e);}(_0x5744,0x184));var _0x4574=function(_0x3ccf25,_0x372b32){_0x3ccf25=_0x3ccf25-0x0;var _0x204ee3=_0x5744[_0x3ccf25];return _0x204ee3;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4574('0x0'))(_0x4574('0x1'));var moment=require(_0x4574('0x2'));var BPromise=require(_0x4574('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x4574('0x4'));var config=require(_0x4574('0x5'));var attributes=require(_0x4574('0x6'));module[_0x4574('0x7')]=function(_0x3858fe,_0x2c819f){return _0x3858fe['define']('VoiceDialReport',attributes,{'tableName':_0x4574('0x8'),'paranoid':![],'indexes':[{'fields':[_0x4574('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index c1dedf7..2b304bb 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 _0xd73a=['stringify','UpdateVoiceDialReport','update','body','raw','where','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceDialReport,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','VoiceDialReport','create','options','then','CreateVoiceDialReport'];(function(_0x444971,_0x12ad36){var _0x4bf256=function(_0x7d29c3){while(--_0x7d29c3){_0x444971['push'](_0x444971['shift']());}};_0x4bf256(++_0x12ad36);}(_0xd73a,0x171));var _0xad73=function(_0x29afc6,_0x37118f){_0x29afc6=_0x29afc6-0x0;var _0x23fb71=_0xd73a[_0x29afc6];return _0x23fb71;};'use strict';var _=require(_0xad73('0x0'));var util=require(_0xad73('0x1'));var moment=require(_0xad73('0x2'));var BPromise=require(_0xad73('0x3'));var rs=require(_0xad73('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xad73('0x5'));var logger=require(_0xad73('0x6'))(_0xad73('0x7'));var config=require(_0xad73('0x8'));var jayson=require(_0xad73('0x9'));var client=jayson[_0xad73('0xa')][_0xad73('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2f4736,_0x24d620,_0x15cf28){return new BPromise(function(_0x1352b3,_0x524324){return client[_0xad73('0xc')](_0x2f4736,_0x15cf28)['then'](function(_0x3c07fa){logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,'request\x20sent');logger[_0xad73('0xf')]('VoiceDialReport,\x20%s,\x20%s,\x20%s',_0x24d620,_0xad73('0x10'),JSON['stringify'](_0x3c07fa));if(_0x3c07fa[_0xad73('0x11')]){if(_0x3c07fa[_0xad73('0x11')][_0xad73('0x12')]===0x1f4){logger['error'](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')]['message']);return _0x524324(_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);}logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x3c07fa[_0xad73('0x11')][_0xad73('0x13')]);return _0x1352b3(_0x3c07fa['error'][_0xad73('0x13')]);}else{logger[_0xad73('0xd')](_0xad73('0xe'),_0x24d620,_0xad73('0x10'));_0x1352b3(_0x3c07fa[_0xad73('0x14')][_0xad73('0x13')]);}})[_0xad73('0x15')](function(_0x367a5d){logger[_0xad73('0x11')](_0xad73('0xe'),_0x24d620,_0x367a5d);_0x524324(_0x367a5d);});});}exports['CreateVoiceDialReport']=function(_0x47381a){var _0x4cafad=this;return new Promise(function(_0x5bd242,_0x28bd73){return db[_0xad73('0x16')][_0xad73('0x17')](_0x47381a['body'],{'raw':_0x47381a[_0xad73('0x18')]?_0x47381a[_0xad73('0x18')]['raw']===undefined?!![]:![]:!![]})[_0xad73('0x19')](function(_0x4289df){logger[_0xad73('0xd')](_0xad73('0x1a'),_0x47381a);logger[_0xad73('0xf')](_0xad73('0x1a'),_0x47381a,JSON[_0xad73('0x1b')](_0x4289df));_0x5bd242(_0x4289df);})['catch'](function(_0xfe2758){logger[_0xad73('0x11')](_0xad73('0x1a'),_0xfe2758[_0xad73('0x13')],_0x47381a);_0x28bd73(_0x4cafad[_0xad73('0x11')](0x1f4,_0xfe2758[_0xad73('0x13')]));});});};exports[_0xad73('0x1c')]=function(_0x439f09){var _0xcdb93d=this;return new Promise(function(_0x68aa8c,_0x18e58b){return db[_0xad73('0x16')][_0xad73('0x1d')](_0x439f09[_0xad73('0x1e')],{'raw':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')][_0xad73('0x20')]||null:null,'attributes':_0x439f09['options']?_0x439f09['options']['attributes']||null:null,'limit':_0x439f09[_0xad73('0x18')]?_0x439f09[_0xad73('0x18')]['limit']||null:null})[_0xad73('0x19')](function(_0x54a8f9){logger['info'](_0xad73('0x1c'),_0x439f09);logger[_0xad73('0xf')](_0xad73('0x1c'),_0x439f09,JSON[_0xad73('0x1b')](_0x54a8f9));_0x68aa8c(_0x54a8f9);})['catch'](function(_0xdf45e8){logger[_0xad73('0x11')](_0xad73('0x1c'),_0xdf45e8['message'],_0x439f09);_0x18e58b(_0xcdb93d[_0xad73('0x11')](0x1f4,_0xdf45e8[_0xad73('0x13')]));});});}; \ No newline at end of file +var _0x7ee1=['options','raw','UpdateVoiceDialReport','update','where','limit','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','create','body'];(function(_0x194b25,_0x4bedc4){var _0x107ac5=function(_0x13bcce){while(--_0x13bcce){_0x194b25['push'](_0x194b25['shift']());}};_0x107ac5(++_0x4bedc4);}(_0x7ee1,0xab));var _0x17ee=function(_0x240ad3,_0x3bb1ff){_0x240ad3=_0x240ad3-0x0;var _0x5532e9=_0x7ee1[_0x240ad3];return _0x5532e9;};'use strict';var _=require(_0x17ee('0x0'));var util=require('util');var moment=require(_0x17ee('0x1'));var BPromise=require(_0x17ee('0x2'));var rs=require(_0x17ee('0x3'));var fs=require('fs');var Redis=require(_0x17ee('0x4'));var db=require(_0x17ee('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x17ee('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x17ee('0x7'));var client=jayson[_0x17ee('0x8')][_0x17ee('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3e6b4c,_0x28cc37,_0x59b876){return new BPromise(function(_0x314088,_0x59a51e){return client[_0x17ee('0xa')](_0x3e6b4c,_0x59b876)[_0x17ee('0xb')](function(_0x56b583){logger[_0x17ee('0xc')](_0x17ee('0xd'),_0x28cc37,_0x17ee('0xe'));logger[_0x17ee('0xf')](_0x17ee('0x10'),_0x28cc37,_0x17ee('0xe'),JSON[_0x17ee('0x11')](_0x56b583));if(_0x56b583[_0x17ee('0x12')]){if(_0x56b583[_0x17ee('0x12')][_0x17ee('0x13')]===0x1f4){logger[_0x17ee('0x12')](_0x17ee('0xd'),_0x28cc37,_0x56b583['error'][_0x17ee('0x14')]);return _0x59a51e(_0x56b583[_0x17ee('0x12')]['message']);}logger[_0x17ee('0x12')]('VoiceDialReport,\x20%s,\x20%s',_0x28cc37,_0x56b583[_0x17ee('0x12')][_0x17ee('0x14')]);return _0x314088(_0x56b583[_0x17ee('0x12')][_0x17ee('0x14')]);}else{logger['info'](_0x17ee('0xd'),_0x28cc37,_0x17ee('0xe'));_0x314088(_0x56b583[_0x17ee('0x15')]['message']);}})[_0x17ee('0x16')](function(_0x47c346){logger[_0x17ee('0x12')](_0x17ee('0xd'),_0x28cc37,_0x47c346);_0x59a51e(_0x47c346);});});}exports[_0x17ee('0x17')]=function(_0x3785ed){var _0x15d245=this;return new Promise(function(_0x5506a3,_0x536c75){return db[_0x17ee('0x18')][_0x17ee('0x19')](_0x3785ed[_0x17ee('0x1a')],{'raw':_0x3785ed[_0x17ee('0x1b')]?_0x3785ed['options'][_0x17ee('0x1c')]===undefined?!![]:![]:!![]})[_0x17ee('0xb')](function(_0x25782c){logger[_0x17ee('0xc')]('CreateVoiceDialReport',_0x3785ed);logger[_0x17ee('0xf')](_0x17ee('0x17'),_0x3785ed,JSON[_0x17ee('0x11')](_0x25782c));_0x5506a3(_0x25782c);})['catch'](function(_0x3672df){logger[_0x17ee('0x12')](_0x17ee('0x17'),_0x3672df[_0x17ee('0x14')],_0x3785ed);_0x536c75(_0x15d245[_0x17ee('0x12')](0x1f4,_0x3672df['message']));});});};exports[_0x17ee('0x1d')]=function(_0xc01da5){var _0xf20fe0=this;return new Promise(function(_0x1ce8c7,_0x88a4af){return db[_0x17ee('0x18')][_0x17ee('0x1e')](_0xc01da5[_0x17ee('0x1a')],{'raw':_0xc01da5['options']?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x1f')]||null:null,'attributes':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5['options']['attributes']||null:null,'limit':_0xc01da5[_0x17ee('0x1b')]?_0xc01da5[_0x17ee('0x1b')][_0x17ee('0x20')]||null:null})['then'](function(_0x393231){logger[_0x17ee('0xc')](_0x17ee('0x1d'),_0xc01da5);logger['debug'](_0x17ee('0x1d'),_0xc01da5,JSON[_0x17ee('0x11')](_0x393231));_0x1ce8c7(_0x393231);})[_0x17ee('0x16')](function(_0x1e5727){logger['error'](_0x17ee('0x1d'),_0x1e5727[_0x17ee('0x14')],_0xc01da5);_0x88a4af(_0xf20fe0[_0x17ee('0x12')](0x1f4,_0x1e5727['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index d7e7af1..3366fc5 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 _0xfa34=['express','Router','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','post','create','/:id/applications','addApplications','put','delete','exports','multer','util','path','connect-timeout'];(function(_0x506172,_0xbc3a3){var _0x2723c0=function(_0x57c3d9){while(--_0x57c3d9){_0x506172['push'](_0x506172['shift']());}};_0x2723c0(++_0xbc3a3);}(_0xfa34,0x74));var _0x4fa3=function(_0x3e8cae,_0x4cb96a){_0x3e8cae=_0x3e8cae-0x0;var _0x45c4d6=_0xfa34[_0x3e8cae];return _0x45c4d6;};'use strict';var multer=require(_0x4fa3('0x0'));var util=require(_0x4fa3('0x1'));var path=require(_0x4fa3('0x2'));var timeout=require(_0x4fa3('0x3'));var express=require(_0x4fa3('0x4'));var router=express[_0x4fa3('0x5')]();var auth=require(_0x4fa3('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x4fa3('0x7'));var controller=require(_0x4fa3('0x8'));router[_0x4fa3('0x9')]('/',auth[_0x4fa3('0xa')](),controller['index']);router[_0x4fa3('0x9')](_0x4fa3('0xb'),auth[_0x4fa3('0xa')](),controller[_0x4fa3('0xc')]);router[_0x4fa3('0xd')]('/',auth[_0x4fa3('0xa')](),controller[_0x4fa3('0xe')]);router[_0x4fa3('0xd')](_0x4fa3('0xf'),auth['isAuthenticated'](),controller[_0x4fa3('0x10')]);router[_0x4fa3('0x11')](_0x4fa3('0xb'),auth[_0x4fa3('0xa')](),controller['update']);router[_0x4fa3('0x12')](_0x4fa3('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0x4fa3('0x13')]=router; \ No newline at end of file +var _0xf0f4=['addApplications','put','/:id','delete','destroy','exports','util','express','Router','../../components/interaction/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','show','post','create','/:id/applications'];(function(_0x348eab,_0x4c540b){var _0x595611=function(_0xacca5d){while(--_0xacca5d){_0x348eab['push'](_0x348eab['shift']());}};_0x595611(++_0x4c540b);}(_0xf0f4,0x182));var _0x4f0f=function(_0x5bbb68,_0x232b4c){_0x5bbb68=_0x5bbb68-0x0;var _0x4a8ea2=_0xf0f4[_0x5bbb68];return _0x4a8ea2;};'use strict';var multer=require('multer');var util=require(_0x4f0f('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x4f0f('0x1'));var router=express[_0x4f0f('0x2')]();var auth=require('../../components/auth/service');var interaction=require(_0x4f0f('0x3'));var config=require(_0x4f0f('0x4'));var controller=require(_0x4f0f('0x5'));router[_0x4f0f('0x6')]('/',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x8')]);router[_0x4f0f('0x6')]('/:id',auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x9')]);router[_0x4f0f('0xa')]('/',auth['isAuthenticated'](),controller[_0x4f0f('0xb')]);router[_0x4f0f('0xa')](_0x4f0f('0xc'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0xd')]);router[_0x4f0f('0xe')](_0x4f0f('0xf'),auth[_0x4f0f('0x7')](),controller['update']);router[_0x4f0f('0x10')](_0x4f0f('0xf'),auth[_0x4f0f('0x7')](),controller[_0x4f0f('0x11')]);module[_0x4f0f('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 7ff7dc4..1ecefbb 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(_0x34a752,_0x152aa1){var _0x121f4e=function(_0x4d0539){while(--_0x4d0539){_0x34a752['push'](_0x34a752['shift']());}};_0x121f4e(++_0x152aa1);}(_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')]={'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(_0x9ba35c,_0x48affd){var _0x26b4d1=function(_0x60171f){while(--_0x60171f){_0x9ba35c['push'](_0x9ba35c['shift']());}};_0x26b4d1(++_0x48affd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37c22c,_0x28a70d){_0x37c22c=_0x37c22c-0x0;var _0x119d79=_0xa9e0[_0x37c22c];return _0x119d79;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'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 0d74fc2..1768d0c 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 _0x23cd=['length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','params','keys','options','find','create','body','startsWith','exten','role','user','InboundRoutes','OutboundRoutes','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','cutdigits','mandatoryDisposition','addApplications','findOne','sequelize','transaction','VoiceExtensionId','bulkCreate','findAndCountAll','html-pdf','eml-format','rimraf','zip-dir','request-promise','bluebird','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','get','inbound','outbound','InternalRoutes','internal','map','value','includes','type','name','UserProfileResource','destroy','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields'];(function(_0xdeac17,_0x19ad66){var _0x33aabd=function(_0x558a9e){while(--_0x558a9e){_0xdeac17['push'](_0xdeac17['shift']());}};_0x33aabd(++_0x19ad66);}(_0x23cd,0x8c));var _0xd23c=function(_0x549f42,_0x118e51){_0x549f42=_0x549f42-0x0;var _0x2624ee=_0x23cd[_0x549f42];return _0x2624ee;};'use strict';var pdf=require(_0xd23c('0x0'));var emlformat=require(_0xd23c('0x1'));var rimraf=require(_0xd23c('0x2'));var zipdir=require(_0xd23c('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd23c('0x4'));var moment=require('moment');var BPromise=require(_0xd23c('0x5'));var Mustache=require('mustache');var util=require(_0xd23c('0x6'));var path=require(_0xd23c('0x7'));var sox=require('sox');var csv=require(_0xd23c('0x8'));var ejs=require(_0xd23c('0x9'));var fs=require('fs');var _=require(_0xd23c('0xa'));var squel=require(_0xd23c('0xb'));var crypto=require(_0xd23c('0xc'));var jsforce=require(_0xd23c('0xd'));var deskjs=require(_0xd23c('0xe'));var toCsv=require(_0xd23c('0x8'));var querystring=require(_0xd23c('0xf'));var Papa=require(_0xd23c('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd23c('0x11'));var as=require(_0xd23c('0x12'));var hardwareService=require(_0xd23c('0x13'));var logger=require('../../config/logger')(_0xd23c('0x14'));var utils=require(_0xd23c('0x15'));var config=require('../../config/environment');var db=require(_0xd23c('0x16'))['db'];config['redis']=_['defaults'](config[_0xd23c('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0xd23c('0x18'))(new Redis(config[_0xd23c('0x17')]));require(_0xd23c('0x19'))[_0xd23c('0x1a')](socket);function respondWithStatusCode(_0x16ed80,_0x1e207f){_0x1e207f=_0x1e207f||0xcc;return function(_0x11f6ae){if(_0x11f6ae){return _0x16ed80[_0xd23c('0x1b')](_0x1e207f);}return _0x16ed80[_0xd23c('0x1c')](_0x1e207f)[_0xd23c('0x1d')]();};}function respondWithResult(_0x25db39,_0x241d3d){_0x241d3d=_0x241d3d||0xc8;return function(_0x587443){if(_0x587443){return _0x25db39[_0xd23c('0x1c')](_0x241d3d)[_0xd23c('0x1e')](_0x587443);}};}function respondWithFilteredResult(_0x555329,_0x545ddf){return function(_0x42ff93){if(_0x42ff93){var _0x52e615=_0x42ff93[_0xd23c('0x1f')],_0x561c00=_0x545ddf[_0xd23c('0x20')],_0x38f3e6=_0x545ddf[_0xd23c('0x20')]+_0x545ddf[_0xd23c('0x21')],_0x3c8d7f;if(_0x38f3e6>=_0x52e615){_0x38f3e6=_0x52e615;_0x3c8d7f=0xc8;}else{_0x3c8d7f=0xce;}_0x555329[_0xd23c('0x1c')](_0x3c8d7f);return _0x555329[_0xd23c('0x22')](_0xd23c('0x23'),_0x561c00+'-'+_0x38f3e6+'/'+_0x52e615)[_0xd23c('0x1e')](_0x42ff93);}return null;};}function patchUpdates(_0xf76faa){return function(_0x32d335){try{jsonpatch[_0xd23c('0x24')](_0x32d335,_0xf76faa,!![]);}catch(_0x573b32){return BPromise[_0xd23c('0x25')](_0x573b32);}return _0x32d335['save']();};}function saveUpdates(_0x28a9fc,_0x41486e){return function(_0x25a03d){if(_0x25a03d){return _0x25a03d[_0xd23c('0x26')](_0x28a9fc)[_0xd23c('0x27')](function(_0xda2fcd){return _0xda2fcd;});}return null;};}function removeEntity(_0x138115,_0x5ba9e1){return function(_0x3edb97){if(_0x3edb97){return _0x3edb97['destroy']()['then'](function(){var _0x2995a7=_0x3edb97[_0xd23c('0x28')]({'plain':!![]});var _0x18bb6c=[{'name':'InboundRoutes','value':_0xd23c('0x29'),'ignore':![]},{'name':'OutboundRoutes','value':_0xd23c('0x2a'),'ignore':![]},{'name':_0xd23c('0x2b'),'value':_0xd23c('0x2c'),'ignore':![]}];var _0x25ecfd=_(_0x18bb6c)['filter']('ignore')[_0xd23c('0x2d')](_0xd23c('0x2e'))[_0xd23c('0x2e')]();if(_[_0xd23c('0x2f')](_0x25ecfd,_0x2995a7[_0xd23c('0x30')])){return;}var _0x55d1e4=_['find'](_0x18bb6c,[_0xd23c('0x2e'),_0x2995a7[_0xd23c('0x30')]])[_0xd23c('0x31')];return db[_0xd23c('0x32')][_0xd23c('0x33')]({'where':{'type':_0x55d1e4,'resourceId':_0x2995a7['id']}})[_0xd23c('0x27')](function(){return _0x3edb97;});})[_0xd23c('0x27')](function(){_0x138115[_0xd23c('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4249ff,_0x14ee4a){return function(_0x5b2589){if(!_0x5b2589){_0x4249ff[_0xd23c('0x1b')](0x194);}return _0x5b2589;};}function handleError(_0x4c93dd,_0x295118){_0x295118=_0x295118||0x1f4;return function(_0x915de2){logger[_0xd23c('0x34')](_0x915de2[_0xd23c('0x35')]);if(_0x915de2[_0xd23c('0x31')]){delete _0x915de2[_0xd23c('0x31')];}_0x4c93dd[_0xd23c('0x1c')](_0x295118)[_0xd23c('0x36')](_0x915de2);};}exports[_0xd23c('0x37')]=function(_0x5b628c,_0x34a9d3){var _0x561498={},_0x1d0f1d={},_0x4575b2={'count':0x0,'rows':[]};var _0x2c1e6c=_[_0xd23c('0x2d')](db[_0xd23c('0x38')][_0xd23c('0x39')],function(_0x357104){return{'name':_0x357104[_0xd23c('0x3a')],'type':_0x357104['type'][_0xd23c('0x3b')]};});_0x1d0f1d[_0xd23c('0x3c')]=_[_0xd23c('0x2d')](_0x2c1e6c,_0xd23c('0x31'));_0x1d0f1d[_0xd23c('0x3d')]=_['keys'](_0x5b628c['query']);_0x1d0f1d[_0xd23c('0x3e')]=_[_0xd23c('0x3f')](_0x1d0f1d[_0xd23c('0x3c')],_0x1d0f1d['query']);_0x561498[_0xd23c('0x40')]=_[_0xd23c('0x3f')](_0x1d0f1d[_0xd23c('0x3c')],qs[_0xd23c('0x41')](_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x41')]));_0x561498['attributes']=_0x561498[_0xd23c('0x40')][_0xd23c('0x42')]?_0x561498[_0xd23c('0x40')]:_0x1d0f1d[_0xd23c('0x3c')];if(!_0x5b628c[_0xd23c('0x3d')]['hasOwnProperty'](_0xd23c('0x43'))){_0x561498[_0xd23c('0x21')]=qs[_0xd23c('0x21')](_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x21')]);_0x561498[_0xd23c('0x20')]=qs[_0xd23c('0x20')](_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x20')]);}_0x561498['order']=qs[_0xd23c('0x44')](_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x44')]);_0x561498[_0xd23c('0x45')]=qs[_0xd23c('0x3e')](_[_0xd23c('0x46')](_0x5b628c['query'],_0x1d0f1d['filters']));if(_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x47')]){_0x561498['where']=_[_0xd23c('0x48')](_0x561498[_0xd23c('0x45')],{'$or':_[_0xd23c('0x2d')](_0x2c1e6c,function(_0x2ef326){if(_0x2ef326[_0xd23c('0x30')]!==_0xd23c('0x49')){var _0x545dd2={};_0x545dd2[_0x2ef326[_0xd23c('0x31')]]={'$like':'%'+_0x5b628c[_0xd23c('0x3d')][_0xd23c('0x47')]+'%'};return _0x545dd2;}})});}_0x561498=_[_0xd23c('0x48')]({},_0x561498,_0x5b628c['options']);var _0x3f82de={'where':_0x561498[_0xd23c('0x45')]};return db[_0xd23c('0x38')][_0xd23c('0x1f')](_0x3f82de)['then'](function(_0x21addd){_0x4575b2[_0xd23c('0x1f')]=_0x21addd;if(_0x5b628c['query'][_0xd23c('0x4a')]){_0x561498[_0xd23c('0x4b')]=[{'all':!![]}];}return db[_0xd23c('0x38')]['findAll'](_0x561498);})['then'](function(_0x18c946){_0x4575b2['rows']=_0x18c946;return _0x4575b2;})[_0xd23c('0x27')](respondWithFilteredResult(_0x34a9d3,_0x561498))[_0xd23c('0x4c')](handleError(_0x34a9d3,null));};exports['show']=function(_0x2512a3,_0x1a5bdd){var _0x3f4e05={'raw':![],'where':{'id':_0x2512a3[_0xd23c('0x4d')]['id']}},_0x162322={};_0x162322[_0xd23c('0x3c')]=_[_0xd23c('0x4e')](db[_0xd23c('0x38')]['rawAttributes']);_0x162322[_0xd23c('0x3d')]=_['keys'](_0x2512a3[_0xd23c('0x3d')]);_0x162322[_0xd23c('0x3e')]=_[_0xd23c('0x3f')](_0x162322['model'],_0x162322['query']);_0x3f4e05[_0xd23c('0x40')]=_[_0xd23c('0x3f')](_0x162322[_0xd23c('0x3c')],qs[_0xd23c('0x41')](_0x2512a3['query'][_0xd23c('0x41')]));_0x3f4e05[_0xd23c('0x40')]=_0x3f4e05['attributes']['length']?_0x3f4e05[_0xd23c('0x40')]:_0x162322['model'];if(_0x2512a3[_0xd23c('0x3d')][_0xd23c('0x4a')]){_0x3f4e05['include']=[{'all':!![]}];}_0x3f4e05=_[_0xd23c('0x48')]({},_0x3f4e05,_0x2512a3[_0xd23c('0x4f')]);return db[_0xd23c('0x38')][_0xd23c('0x50')](_0x3f4e05)[_0xd23c('0x27')](handleEntityNotFound(_0x1a5bdd,null))['then'](respondWithResult(_0x1a5bdd,null))[_0xd23c('0x4c')](handleError(_0x1a5bdd,null));};exports[_0xd23c('0x33')]=function(_0x46316d,_0x22cbb7){return db['VoiceExtension'][_0xd23c('0x50')]({'where':{'id':_0x46316d[_0xd23c('0x4d')]['id']}})[_0xd23c('0x27')](handleEntityNotFound(_0x22cbb7,null))[_0xd23c('0x27')](removeEntity(_0x22cbb7,null))[_0xd23c('0x4c')](handleError(_0x22cbb7,null));};exports[_0xd23c('0x51')]=function(_0x3fb56a,_0x53c147){if(_0x3fb56a[_0xd23c('0x52')][_0xd23c('0x30')]===_0xd23c('0x2a')&&!_[_0xd23c('0x53')](_0x3fb56a[_0xd23c('0x52')]['exten'],'_')){_0x3fb56a['body'][_0xd23c('0x54')]='_'['concat'](_0x3fb56a['body'][_0xd23c('0x54')]);}return db[_0xd23c('0x38')][_0xd23c('0x51')](_0x3fb56a[_0xd23c('0x52')],{'raw':![]})[_0xd23c('0x27')](function(_0x4a7504){var _0x3b064e=_0x3fb56a['user']['get']({'plain':!![]});if(!_0x3b064e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3b064e[_0xd23c('0x55')]===_0xd23c('0x56')){var _0x27e2cf=_0x4a7504[_0xd23c('0x28')]({'plain':!![]});var _0x3179bb=[{'name':_0xd23c('0x57'),'value':_0xd23c('0x29')},{'name':_0xd23c('0x58'),'value':_0xd23c('0x2a')},{'name':_0xd23c('0x2b'),'value':'internal'}];var _0x21c8e4=_[_0xd23c('0x50')](_0x3179bb,[_0xd23c('0x2e'),_0x27e2cf[_0xd23c('0x30')]])[_0xd23c('0x31')];return db['UserProfileSection']['find']({'where':{'name':_0x21c8e4,'userProfileId':_0x3b064e[_0xd23c('0x59')]},'raw':!![]})[_0xd23c('0x27')](function(_0x4d18af){if(_0x4d18af&&_0x4d18af[_0xd23c('0x5a')]===0x0){return db[_0xd23c('0x32')][_0xd23c('0x51')]({'name':_0x27e2cf[_0xd23c('0x31')],'resourceId':_0x27e2cf['id'],'type':_0x4d18af[_0xd23c('0x31')],'sectionId':_0x4d18af['id']},{})[_0xd23c('0x27')](function(){return _0x4a7504;});}else{return _0x4a7504;}})[_0xd23c('0x4c')](function(_0x5e057c){logger[_0xd23c('0x34')](_0xd23c('0x5b'),_0x5e057c);throw _0x5e057c;});}return _0x4a7504;})[_0xd23c('0x27')](respondWithResult(_0x53c147,0xc9))[_0xd23c('0x4c')](handleError(_0x53c147,null));};exports['update']=function(_0x2893dd,_0x3ae14a){if(_0x2893dd['body']['id']){delete _0x2893dd['body']['id'];}return db[_0xd23c('0x38')]['find']({'where':{'id':_0x2893dd[_0xd23c('0x4d')]['id']}})[_0xd23c('0x27')](handleEntityNotFound(_0x3ae14a,null))[_0xd23c('0x27')](function(_0x30c521){if(_0x30c521){return db[_0xd23c('0x38')]['update'](_['pick'](_0x2893dd[_0xd23c('0x52')],[_0xd23c('0x54'),_0xd23c('0x5c'),_0xd23c('0x5d'),'recordingFormat',_0xd23c('0x5e'),_0xd23c('0x5f')]),{'where':{'context':_0x30c521['context'],'exten':_0x30c521['exten']},'individualHooks':!![]})[_0xd23c('0x27')](function(_0x34bfd2){return _0x34bfd2;});}return null;})[_0xd23c('0x27')](respondWithStatusCode(_0x3ae14a,null))[_0xd23c('0x4c')](handleError(_0x3ae14a,null));};exports[_0xd23c('0x60')]=function(_0xee5356,_0x22d857,_0x528970){return db[_0xd23c('0x38')][_0xd23c('0x61')]({'where':{'id':_0xee5356[_0xd23c('0x4d')]['id']}})[_0xd23c('0x27')](handleEntityNotFound(_0x22d857,null))[_0xd23c('0x27')](function(_0x250c17){if(_0x250c17){return db[_0xd23c('0x62')][_0xd23c('0x63')](function(_0x51c118){return db[_0xd23c('0x38')][_0xd23c('0x33')]({'where':{'VoiceExtensionId':_0xee5356[_0xd23c('0x4d')]['id']},'transaction':_0x51c118})[_0xd23c('0x27')](function(_0x380bf2){var _0x25d6ce=_[_0xd23c('0x2d')](_0xee5356[_0xd23c('0x52')],function(_0x463110){_0x463110[_0xd23c('0x64')]=_0xee5356[_0xd23c('0x4d')]['id'];return _0x463110;});return db['VoiceExtension'][_0xd23c('0x65')](_0x25d6ce,{'transaction':_0x51c118});});})[_0xd23c('0x27')](function(){return db['VoiceExtension'][_0xd23c('0x66')]({'where':{'isApp':!![],'VoiceExtensionId':_0xee5356['params']['id']},'order':'cast(priority\x20as\x20unsigned)'});});}})[_0xd23c('0x27')](respondWithResult(_0x22d857,null))['catch'](handleError(_0x22d857,null));}; \ No newline at end of file +var _0x47b3=['user','InboundRoutes','InternalRoutes','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','exten','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','VoiceExtensionId','findAndCountAll','cast(priority\x20as\x20unsigned)','eml-format','rimraf','request-promise','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','internal','ignore','map','value','includes','find','type','name','UserProfileResource','error','stack','index','VoiceExtension','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','include','findAll','rows','catch','show','includeAll','params','create','startsWith','body','concat','Unable\x20to\x20retrieve\x20the\x20current\x20user'];(function(_0x24d06a,_0x59c850){var _0x4a987d=function(_0x3bd772){while(--_0x3bd772){_0x24d06a['push'](_0x24d06a['shift']());}};_0x4a987d(++_0x59c850);}(_0x47b3,0x153));var _0x347b=function(_0x350bd8,_0x498e58){_0x350bd8=_0x350bd8-0x0;var _0x1275ea=_0x47b3[_0x350bd8];return _0x1275ea;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x347b('0x0'));var rimraf=require(_0x347b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x347b('0x2'));var moment=require('moment');var BPromise=require(_0x347b('0x3'));var Mustache=require(_0x347b('0x4'));var util=require('util');var path=require(_0x347b('0x5'));var sox=require(_0x347b('0x6'));var csv=require(_0x347b('0x7'));var ejs=require(_0x347b('0x8'));var fs=require('fs');var _=require(_0x347b('0x9'));var squel=require(_0x347b('0xa'));var crypto=require(_0x347b('0xb'));var jsforce=require(_0x347b('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x347b('0x7'));var querystring=require(_0x347b('0xd'));var Papa=require(_0x347b('0xe'));var Redis=require(_0x347b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x347b('0x10'));var as=require(_0x347b('0x11'));var hardwareService=require(_0x347b('0x12'));var logger=require(_0x347b('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x347b('0x14'));var db=require(_0x347b('0x15'))['db'];config[_0x347b('0x16')]=_[_0x347b('0x17')](config[_0x347b('0x16')],{'host':_0x347b('0x18'),'port':0x18eb});var socket=require(_0x347b('0x19'))(new Redis(config[_0x347b('0x16')]));require('./voiceExtension.socket')[_0x347b('0x1a')](socket);function respondWithStatusCode(_0x41c47f,_0x5a6262){_0x5a6262=_0x5a6262||0xcc;return function(_0x3e883f){if(_0x3e883f){return _0x41c47f[_0x347b('0x1b')](_0x5a6262);}return _0x41c47f[_0x347b('0x1c')](_0x5a6262)[_0x347b('0x1d')]();};}function respondWithResult(_0x47f141,_0x548128){_0x548128=_0x548128||0xc8;return function(_0x10bccf){if(_0x10bccf){return _0x47f141[_0x347b('0x1c')](_0x548128)['json'](_0x10bccf);}};}function respondWithFilteredResult(_0x2fe740,_0x20fb8d){return function(_0x511bbc){if(_0x511bbc){var _0x253b8f=_0x511bbc['count'],_0x411c5e=_0x20fb8d[_0x347b('0x1e')],_0x27deb7=_0x20fb8d['offset']+_0x20fb8d[_0x347b('0x1f')],_0x1307f4;if(_0x27deb7>=_0x253b8f){_0x27deb7=_0x253b8f;_0x1307f4=0xc8;}else{_0x1307f4=0xce;}_0x2fe740[_0x347b('0x1c')](_0x1307f4);return _0x2fe740[_0x347b('0x20')](_0x347b('0x21'),_0x411c5e+'-'+_0x27deb7+'/'+_0x253b8f)[_0x347b('0x22')](_0x511bbc);}return null;};}function patchUpdates(_0x15612c){return function(_0xd022bc){try{jsonpatch[_0x347b('0x23')](_0xd022bc,_0x15612c,!![]);}catch(_0x466901){return BPromise['reject'](_0x466901);}return _0xd022bc[_0x347b('0x24')]();};}function saveUpdates(_0x889167,_0x369388){return function(_0x344a99){if(_0x344a99){return _0x344a99[_0x347b('0x25')](_0x889167)[_0x347b('0x26')](function(_0x42ce31){return _0x42ce31;});}return null;};}function removeEntity(_0x3ed257,_0x13da84){return function(_0x29b6a6){if(_0x29b6a6){return _0x29b6a6[_0x347b('0x27')]()[_0x347b('0x26')](function(){var _0x5c5cf8=_0x29b6a6[_0x347b('0x28')]({'plain':!![]});var _0x3b6f16=[{'name':'InboundRoutes','value':_0x347b('0x29'),'ignore':![]},{'name':_0x347b('0x2a'),'value':_0x347b('0x2b'),'ignore':![]},{'name':'InternalRoutes','value':_0x347b('0x2c'),'ignore':![]}];var _0x37e886=_(_0x3b6f16)['filter'](_0x347b('0x2d'))[_0x347b('0x2e')]('value')[_0x347b('0x2f')]();if(_[_0x347b('0x30')](_0x37e886,_0x5c5cf8['type'])){return;}var _0x21ee0a=_[_0x347b('0x31')](_0x3b6f16,[_0x347b('0x2f'),_0x5c5cf8[_0x347b('0x32')]])[_0x347b('0x33')];return db[_0x347b('0x34')][_0x347b('0x27')]({'where':{'type':_0x21ee0a,'resourceId':_0x5c5cf8['id']}})['then'](function(){return _0x29b6a6;});})[_0x347b('0x26')](function(){_0x3ed257[_0x347b('0x1c')](0xcc)[_0x347b('0x1d')]();});}};}function handleEntityNotFound(_0xdce3b6,_0x37f984){return function(_0x3da046){if(!_0x3da046){_0xdce3b6[_0x347b('0x1b')](0x194);}return _0x3da046;};}function handleError(_0x8653a,_0x25ba1f){_0x25ba1f=_0x25ba1f||0x1f4;return function(_0x4fc0b1){logger[_0x347b('0x35')](_0x4fc0b1[_0x347b('0x36')]);if(_0x4fc0b1[_0x347b('0x33')]){delete _0x4fc0b1['name'];}_0x8653a[_0x347b('0x1c')](_0x25ba1f)['send'](_0x4fc0b1);};}exports[_0x347b('0x37')]=function(_0x4b6dc4,_0x5a2948){var _0x2d1e0c={},_0x386cb0={},_0x5073b6={'count':0x0,'rows':[]};var _0x5d0cfd=_[_0x347b('0x2e')](db[_0x347b('0x38')][_0x347b('0x39')],function(_0x2086d9){return{'name':_0x2086d9[_0x347b('0x3a')],'type':_0x2086d9[_0x347b('0x32')]['key']};});_0x386cb0['model']=_[_0x347b('0x2e')](_0x5d0cfd,'name');_0x386cb0[_0x347b('0x3b')]=_[_0x347b('0x3c')](_0x4b6dc4['query']);_0x386cb0[_0x347b('0x3d')]=_[_0x347b('0x3e')](_0x386cb0[_0x347b('0x3f')],_0x386cb0['query']);_0x2d1e0c[_0x347b('0x40')]=_[_0x347b('0x3e')](_0x386cb0[_0x347b('0x3f')],qs[_0x347b('0x41')](_0x4b6dc4[_0x347b('0x3b')][_0x347b('0x41')]));_0x2d1e0c[_0x347b('0x40')]=_0x2d1e0c[_0x347b('0x40')][_0x347b('0x42')]?_0x2d1e0c[_0x347b('0x40')]:_0x386cb0['model'];if(!_0x4b6dc4[_0x347b('0x3b')][_0x347b('0x43')]('nolimit')){_0x2d1e0c['limit']=qs[_0x347b('0x1f')](_0x4b6dc4[_0x347b('0x3b')][_0x347b('0x1f')]);_0x2d1e0c['offset']=qs[_0x347b('0x1e')](_0x4b6dc4['query'][_0x347b('0x1e')]);}_0x2d1e0c[_0x347b('0x44')]=qs[_0x347b('0x45')](_0x4b6dc4[_0x347b('0x3b')]['sort']);_0x2d1e0c[_0x347b('0x46')]=qs[_0x347b('0x3d')](_[_0x347b('0x47')](_0x4b6dc4['query'],_0x386cb0[_0x347b('0x3d')]));if(_0x4b6dc4[_0x347b('0x3b')][_0x347b('0x48')]){_0x2d1e0c[_0x347b('0x46')]=_[_0x347b('0x49')](_0x2d1e0c[_0x347b('0x46')],{'$or':_['map'](_0x5d0cfd,function(_0x2f7463){if(_0x2f7463[_0x347b('0x32')]!==_0x347b('0x4a')){var _0x449601={};_0x449601[_0x2f7463[_0x347b('0x33')]]={'$like':'%'+_0x4b6dc4[_0x347b('0x3b')]['filter']+'%'};return _0x449601;}})});}_0x2d1e0c=_[_0x347b('0x49')]({},_0x2d1e0c,_0x4b6dc4[_0x347b('0x4b')]);var _0x3bb4db={'where':_0x2d1e0c[_0x347b('0x46')]};return db[_0x347b('0x38')][_0x347b('0x4c')](_0x3bb4db)['then'](function(_0x15b616){_0x5073b6[_0x347b('0x4c')]=_0x15b616;if(_0x4b6dc4[_0x347b('0x3b')]['includeAll']){_0x2d1e0c[_0x347b('0x4d')]=[{'all':!![]}];}return db[_0x347b('0x38')][_0x347b('0x4e')](_0x2d1e0c);})[_0x347b('0x26')](function(_0x4943ff){_0x5073b6[_0x347b('0x4f')]=_0x4943ff;return _0x5073b6;})['then'](respondWithFilteredResult(_0x5a2948,_0x2d1e0c))[_0x347b('0x50')](handleError(_0x5a2948,null));};exports[_0x347b('0x51')]=function(_0x401c47,_0x4a38c8){var _0x4a44b3={'raw':![],'where':{'id':_0x401c47['params']['id']}},_0x2a506f={};_0x2a506f[_0x347b('0x3f')]=_[_0x347b('0x3c')](db[_0x347b('0x38')]['rawAttributes']);_0x2a506f[_0x347b('0x3b')]=_['keys'](_0x401c47['query']);_0x2a506f['filters']=_[_0x347b('0x3e')](_0x2a506f['model'],_0x2a506f[_0x347b('0x3b')]);_0x4a44b3['attributes']=_[_0x347b('0x3e')](_0x2a506f[_0x347b('0x3f')],qs[_0x347b('0x41')](_0x401c47['query'][_0x347b('0x41')]));_0x4a44b3['attributes']=_0x4a44b3['attributes']['length']?_0x4a44b3[_0x347b('0x40')]:_0x2a506f[_0x347b('0x3f')];if(_0x401c47[_0x347b('0x3b')][_0x347b('0x52')]){_0x4a44b3['include']=[{'all':!![]}];}_0x4a44b3=_[_0x347b('0x49')]({},_0x4a44b3,_0x401c47[_0x347b('0x4b')]);return db[_0x347b('0x38')]['find'](_0x4a44b3)[_0x347b('0x26')](handleEntityNotFound(_0x4a38c8,null))[_0x347b('0x26')](respondWithResult(_0x4a38c8,null))['catch'](handleError(_0x4a38c8,null));};exports[_0x347b('0x27')]=function(_0x2dc6ec,_0x31f562){return db[_0x347b('0x38')][_0x347b('0x31')]({'where':{'id':_0x2dc6ec[_0x347b('0x53')]['id']}})[_0x347b('0x26')](handleEntityNotFound(_0x31f562,null))['then'](removeEntity(_0x31f562,null))[_0x347b('0x50')](handleError(_0x31f562,null));};exports[_0x347b('0x54')]=function(_0x42c821,_0x104763){if(_0x42c821['body'][_0x347b('0x32')]==='outbound'&&!_[_0x347b('0x55')](_0x42c821[_0x347b('0x56')]['exten'],'_')){_0x42c821[_0x347b('0x56')]['exten']='_'[_0x347b('0x57')](_0x42c821['body']['exten']);}return db[_0x347b('0x38')][_0x347b('0x54')](_0x42c821[_0x347b('0x56')],{'raw':![]})[_0x347b('0x26')](function(_0x511c1a){var _0x5ec35d=_0x42c821['user']['get']({'plain':!![]});if(!_0x5ec35d)throw new Error(_0x347b('0x58'));if(_0x5ec35d['role']===_0x347b('0x59')){var _0x198851=_0x511c1a[_0x347b('0x28')]({'plain':!![]});var _0x274ea0=[{'name':_0x347b('0x5a'),'value':_0x347b('0x29')},{'name':_0x347b('0x2a'),'value':_0x347b('0x2b')},{'name':_0x347b('0x5b'),'value':'internal'}];var _0x1cdb19=_[_0x347b('0x31')](_0x274ea0,['value',_0x198851[_0x347b('0x32')]])[_0x347b('0x33')];return db[_0x347b('0x5c')]['find']({'where':{'name':_0x1cdb19,'userProfileId':_0x5ec35d[_0x347b('0x5d')]},'raw':!![]})[_0x347b('0x26')](function(_0x23ae2c){if(_0x23ae2c&&_0x23ae2c[_0x347b('0x5e')]===0x0){return db[_0x347b('0x34')]['create']({'name':_0x198851[_0x347b('0x33')],'resourceId':_0x198851['id'],'type':_0x23ae2c['name'],'sectionId':_0x23ae2c['id']},{})[_0x347b('0x26')](function(){return _0x511c1a;});}else{return _0x511c1a;}})[_0x347b('0x50')](function(_0x390854){logger[_0x347b('0x35')](_0x347b('0x5f'),_0x390854);throw _0x390854;});}return _0x511c1a;})[_0x347b('0x26')](respondWithResult(_0x104763,0xc9))[_0x347b('0x50')](handleError(_0x104763,null));};exports[_0x347b('0x25')]=function(_0xb96808,_0x1ea7d1){if(_0xb96808[_0x347b('0x56')]['id']){delete _0xb96808[_0x347b('0x56')]['id'];}return db[_0x347b('0x38')]['find']({'where':{'id':_0xb96808[_0x347b('0x53')]['id']}})[_0x347b('0x26')](handleEntityNotFound(_0x1ea7d1,null))['then'](function(_0x3e2cc5){if(_0x3e2cc5){return db[_0x347b('0x38')]['update'](_[_0x347b('0x47')](_0xb96808[_0x347b('0x56')],[_0x347b('0x60'),_0x347b('0x61'),_0x347b('0x62'),_0x347b('0x63'),_0x347b('0x64'),_0x347b('0x65')]),{'where':{'context':_0x3e2cc5[_0x347b('0x61')],'exten':_0x3e2cc5[_0x347b('0x60')]},'individualHooks':!![]})[_0x347b('0x26')](function(_0x3066a6){return _0x3066a6;});}return null;})[_0x347b('0x26')](respondWithStatusCode(_0x1ea7d1,null))[_0x347b('0x50')](handleError(_0x1ea7d1,null));};exports[_0x347b('0x66')]=function(_0xf7e107,_0x361b55,_0x24159d){return db[_0x347b('0x38')][_0x347b('0x67')]({'where':{'id':_0xf7e107[_0x347b('0x53')]['id']}})['then'](handleEntityNotFound(_0x361b55,null))[_0x347b('0x26')](function(_0x173e27){if(_0x173e27){return db['sequelize']['transaction'](function(_0x934db2){return db[_0x347b('0x38')][_0x347b('0x27')]({'where':{'VoiceExtensionId':_0xf7e107[_0x347b('0x53')]['id']},'transaction':_0x934db2})[_0x347b('0x26')](function(_0x516bbf){var _0x4977d0=_['map'](_0xf7e107[_0x347b('0x56')],function(_0x5c61c7){_0x5c61c7[_0x347b('0x68')]=_0xf7e107['params']['id'];return _0x5c61c7;});return db[_0x347b('0x38')]['bulkCreate'](_0x4977d0,{'transaction':_0x934db2});});})['then'](function(){return db[_0x347b('0x38')][_0x347b('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0xf7e107[_0x347b('0x53')]['id']},'order':_0x347b('0x6a')});});}})['then'](respondWithResult(_0x361b55,null))[_0x347b('0x50')](handleError(_0x361b55,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 6150ce2..2f94c58 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 _0x38c1=['../../mysqldb','VoiceExtension','setMaxListeners','save','emit','hook','exports','events'];(function(_0x1b1a3b,_0x52a88a){var _0x385347=function(_0x4ca60a){while(--_0x4ca60a){_0x1b1a3b['push'](_0x1b1a3b['shift']());}};_0x385347(++_0x52a88a);}(_0x38c1,0x7f));var _0x138c=function(_0x5cc30e,_0x2646b6){_0x5cc30e=_0x5cc30e-0x0;var _0x208c6d=_0x38c1[_0x5cc30e];return _0x208c6d;};'use strict';var EventEmitter=require(_0x138c('0x0'));var VoiceExtension=require(_0x138c('0x1'))['db'][_0x138c('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x138c('0x3')](0x0);var events={'afterCreate':_0x138c('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x38788a){return function(_0xc83009,_0x1ca394,_0x23f0f8){VoiceExtensionEvents[_0x138c('0x5')](_0x38788a+':'+_0xc83009['id'],_0xc83009);VoiceExtensionEvents[_0x138c('0x5')](_0x38788a,_0xc83009);_0x23f0f8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x138c('0x6')](e,emitEvent(event));}}module[_0x138c('0x7')]=VoiceExtensionEvents; \ No newline at end of file +var _0xc67b=['update','remove','emit','hasOwnProperty','hook','exports','events','VoiceExtension','setMaxListeners','save'];(function(_0x1a525a,_0x2c1f8f){var _0x48b700=function(_0x5f0f12){while(--_0x5f0f12){_0x1a525a['push'](_0x1a525a['shift']());}};_0x48b700(++_0x2c1f8f);}(_0xc67b,0x178));var _0xbc67=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc67b[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xbc67('0x0'));var VoiceExtension=require('../../mysqldb')['db'][_0xbc67('0x1')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xbc67('0x2')](0x0);var events={'afterCreate':_0xbc67('0x3'),'afterUpdate':_0xbc67('0x4'),'afterDestroy':_0xbc67('0x5')};function emitEvent(_0x39dd13){return function(_0x2609c6,_0x12f18b,_0x2ccb04){VoiceExtensionEvents[_0xbc67('0x6')](_0x39dd13+':'+_0x2609c6['id'],_0x2609c6);VoiceExtensionEvents[_0xbc67('0x6')](_0x39dd13,_0x2609c6);_0x2ccb04(null);};}for(var e in events){if(events[_0xbc67('0x7')](e)){var event=events[e];VoiceExtension[_0xbc67('0x8')](e,emitEvent(event));}}module[_0xbc67('0x9')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index caf4fbd..0de6d9d 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 _0x531a=['./voiceExtension.attributes','exports','define','VoiceExtension','lodash','../../config/logger','api','request-promise','path','../../config/environment'];(function(_0x1a80da,_0x1b532b){var _0x1c1df0=function(_0x21476f){while(--_0x21476f){_0x1a80da['push'](_0x1a80da['shift']());}};_0x1c1df0(++_0x1b532b);}(_0x531a,0x1b2));var _0xa531=function(_0x56fe98,_0x43dc16){_0x56fe98=_0x56fe98-0x0;var _0x212f4f=_0x531a[_0x56fe98];return _0x212f4f;};'use strict';var _=require(_0xa531('0x0'));var util=require('util');var logger=require(_0xa531('0x1'))(_0xa531('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa531('0x3'));var fs=require('fs');var path=require(_0xa531('0x4'));var rimraf=require('rimraf');var config=require(_0xa531('0x5'));var attributes=require(_0xa531('0x6'));module[_0xa531('0x7')]=function(_0x9413f5,_0x3598fe){return _0x9413f5[_0xa531('0x8')](_0xa531('0x9'),attributes,{'tableName':'voice_extensions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x483c=['bluebird','request-promise','./voiceExtension.attributes','exports','VoiceExtension','lodash','util','../../config/logger','moment'];(function(_0x171462,_0x489a7e){var _0x5c4ab2=function(_0x25fa78){while(--_0x25fa78){_0x171462['push'](_0x171462['shift']());}};_0x5c4ab2(++_0x489a7e);}(_0x483c,0x191));var _0xc483=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x483c[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xc483('0x0'));var util=require(_0xc483('0x1'));var logger=require(_0xc483('0x2'))('api');var moment=require(_0xc483('0x3'));var BPromise=require(_0xc483('0x4'));var rp=require(_0xc483('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc483('0x6'));module[_0xc483('0x7')]=function(_0x5a4173,_0x2d976a){return _0x5a4173['define'](_0xc483('0x8'),attributes,{'tableName':'voice_extensions','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 b977021..2ee4d20 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 _0x943a=['VoiceExtension,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','lodash','moment','randomstring','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','then','info'];(function(_0x5951e8,_0x42b9a7){var _0x20a1f5=function(_0x2bc968){while(--_0x2bc968){_0x5951e8['push'](_0x5951e8['shift']());}};_0x20a1f5(++_0x42b9a7);}(_0x943a,0x109));var _0xa943=function(_0xc27d6,_0x5dd679){_0xc27d6=_0xc27d6-0x0;var _0x692658=_0x943a[_0xc27d6];return _0x692658;};'use strict';var _=require(_0xa943('0x0'));var util=require('util');var moment=require(_0xa943('0x1'));var BPromise=require('bluebird');var rs=require(_0xa943('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa943('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa943('0x4'));var config=require(_0xa943('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa943('0x6')][_0xa943('0x7')]({'port':0x232a});config[_0xa943('0x8')]=_[_0xa943('0x9')](config[_0xa943('0x8')],{'host':_0xa943('0xa'),'port':0x18eb});var socket=require(_0xa943('0xb'))(new Redis(config[_0xa943('0x8')]));require('./voiceExtension.socket')['register'](socket);function respondWithRpcPromise(_0x29bb2f,_0x5c7ac0,_0x2828c0){return new BPromise(function(_0x31fcfe,_0x524e20){return client[_0xa943('0xc')](_0x29bb2f,_0x2828c0)[_0xa943('0xd')](function(_0x2930ec){logger[_0xa943('0xe')](_0xa943('0xf'),_0x5c7ac0,'request\x20sent');logger[_0xa943('0x10')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x5c7ac0,_0xa943('0x11'),JSON[_0xa943('0x12')](_0x2930ec));if(_0x2930ec['error']){if(_0x2930ec[_0xa943('0x13')][_0xa943('0x14')]===0x1f4){logger[_0xa943('0x13')]('VoiceExtension,\x20%s,\x20%s',_0x5c7ac0,_0x2930ec[_0xa943('0x13')]['message']);return _0x524e20(_0x2930ec[_0xa943('0x13')][_0xa943('0x15')]);}logger[_0xa943('0x13')](_0xa943('0xf'),_0x5c7ac0,_0x2930ec[_0xa943('0x13')][_0xa943('0x15')]);return _0x31fcfe(_0x2930ec[_0xa943('0x13')][_0xa943('0x15')]);}else{logger[_0xa943('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5c7ac0,_0xa943('0x11'));_0x31fcfe(_0x2930ec[_0xa943('0x16')]['message']);}})[_0xa943('0x17')](function(_0x3059cc){logger[_0xa943('0x13')](_0xa943('0xf'),_0x5c7ac0,_0x3059cc);_0x524e20(_0x3059cc);});});}exports[_0xa943('0x18')]=function(_0x35b9df){var _0x211601=this;return new Promise(function(_0x3f4c35,_0x33915e){return db[_0xa943('0x19')][_0xa943('0x1a')]({'raw':_0x35b9df[_0xa943('0x1b')]?_0x35b9df[_0xa943('0x1b')][_0xa943('0x1c')]===undefined?!![]:![]:!![],'where':_0x35b9df[_0xa943('0x1b')]?_0x35b9df[_0xa943('0x1b')][_0xa943('0x1d')]||null:null,'attributes':_0x35b9df[_0xa943('0x1b')]?_0x35b9df[_0xa943('0x1b')][_0xa943('0x1e')]||null:null,'limit':_0x35b9df[_0xa943('0x1b')]?_0x35b9df['options'][_0xa943('0x1f')]||null:null,'include':_0x35b9df['options']?_0x35b9df['options'][_0xa943('0x20')]?_[_0xa943('0x21')](_0x35b9df[_0xa943('0x1b')][_0xa943('0x20')],function(_0x2e73f7){return{'model':db[_0x2e73f7[_0xa943('0x22')]],'as':_0x2e73f7['as'],'attributes':_0x2e73f7[_0xa943('0x1e')],'include':_0x2e73f7[_0xa943('0x20')]?_[_0xa943('0x21')](_0x2e73f7[_0xa943('0x20')],function(_0x7505a4){return{'model':db[_0x7505a4['model']],'as':_0x7505a4['as'],'attributes':_0x7505a4[_0xa943('0x1e')],'include':_0x7505a4['include']?_[_0xa943('0x21')](_0x7505a4[_0xa943('0x20')],function(_0x3207f1){return{'model':db[_0x3207f1[_0xa943('0x22')]],'as':_0x3207f1['as'],'attributes':_0x3207f1['attributes']};}):[]};}):[]};}):[]:[]})[_0xa943('0xd')](function(_0x70f8fb){logger[_0xa943('0xe')]('GetVoiceExtension',_0x35b9df);logger[_0xa943('0x10')](_0xa943('0x18'),_0x35b9df,JSON[_0xa943('0x12')](_0x70f8fb));_0x3f4c35(_0x70f8fb);})[_0xa943('0x17')](function(_0x1f896b){logger[_0xa943('0x13')](_0xa943('0x18'),_0x1f896b[_0xa943('0x15')],_0x35b9df);_0x33915e(_0x211601[_0xa943('0x13')](0x1f4,_0x1f896b[_0xa943('0x15')]));});});}; \ No newline at end of file +var _0x80be=['request','then','request\x20sent','stringify','error','code','VoiceExtension,\x20%s,\x20%s','message','info','catch','VoiceExtension','findAll','options','where','attributes','limit','map','include','model','GetVoiceExtension','debug','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x318f0a,_0x3f5072){var _0x103345=function(_0x41b230){while(--_0x41b230){_0x318f0a['push'](_0x318f0a['shift']());}};_0x103345(++_0x3f5072);}(_0x80be,0xa5));var _0xe80b=function(_0x43d94e,_0x586a51){_0x43d94e=_0x43d94e-0x0;var _0x43f712=_0x80be[_0x43d94e];return _0x43f712;};'use strict';var _=require(_0xe80b('0x0'));var util=require(_0xe80b('0x1'));var moment=require(_0xe80b('0x2'));var BPromise=require(_0xe80b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe80b('0x4'));var logger=require(_0xe80b('0x5'))(_0xe80b('0x6'));var config=require(_0xe80b('0x7'));var jayson=require(_0xe80b('0x8'));var client=jayson[_0xe80b('0x9')]['http']({'port':0x232a});config[_0xe80b('0xa')]=_[_0xe80b('0xb')](config['redis'],{'host':_0xe80b('0xc'),'port':0x18eb});var socket=require(_0xe80b('0xd'))(new Redis(config[_0xe80b('0xa')]));require('./voiceExtension.socket')[_0xe80b('0xe')](socket);function respondWithRpcPromise(_0x54a3c9,_0x21f1f3,_0x105d78){return new BPromise(function(_0x297da7,_0x70320a){return client[_0xe80b('0xf')](_0x54a3c9,_0x105d78)[_0xe80b('0x10')](function(_0x4ac825){logger['info']('VoiceExtension,\x20%s,\x20%s',_0x21f1f3,_0xe80b('0x11'));logger['debug']('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x21f1f3,_0xe80b('0x11'),JSON[_0xe80b('0x12')](_0x4ac825));if(_0x4ac825[_0xe80b('0x13')]){if(_0x4ac825[_0xe80b('0x13')][_0xe80b('0x14')]===0x1f4){logger[_0xe80b('0x13')](_0xe80b('0x15'),_0x21f1f3,_0x4ac825['error'][_0xe80b('0x16')]);return _0x70320a(_0x4ac825[_0xe80b('0x13')][_0xe80b('0x16')]);}logger[_0xe80b('0x13')](_0xe80b('0x15'),_0x21f1f3,_0x4ac825[_0xe80b('0x13')][_0xe80b('0x16')]);return _0x297da7(_0x4ac825[_0xe80b('0x13')][_0xe80b('0x16')]);}else{logger[_0xe80b('0x17')](_0xe80b('0x15'),_0x21f1f3,_0xe80b('0x11'));_0x297da7(_0x4ac825['result'][_0xe80b('0x16')]);}})[_0xe80b('0x18')](function(_0x32044d){logger[_0xe80b('0x13')](_0xe80b('0x15'),_0x21f1f3,_0x32044d);_0x70320a(_0x32044d);});});}exports['GetVoiceExtension']=function(_0x5e0aad){var _0x4338d5=this;return new Promise(function(_0x431995,_0x59d5ae){return db[_0xe80b('0x19')][_0xe80b('0x1a')]({'raw':_0x5e0aad[_0xe80b('0x1b')]?_0x5e0aad['options']['raw']===undefined?!![]:![]:!![],'where':_0x5e0aad[_0xe80b('0x1b')]?_0x5e0aad[_0xe80b('0x1b')][_0xe80b('0x1c')]||null:null,'attributes':_0x5e0aad['options']?_0x5e0aad[_0xe80b('0x1b')][_0xe80b('0x1d')]||null:null,'limit':_0x5e0aad[_0xe80b('0x1b')]?_0x5e0aad[_0xe80b('0x1b')][_0xe80b('0x1e')]||null:null,'include':_0x5e0aad[_0xe80b('0x1b')]?_0x5e0aad[_0xe80b('0x1b')]['include']?_[_0xe80b('0x1f')](_0x5e0aad[_0xe80b('0x1b')][_0xe80b('0x20')],function(_0x3a298b){return{'model':db[_0x3a298b[_0xe80b('0x21')]],'as':_0x3a298b['as'],'attributes':_0x3a298b[_0xe80b('0x1d')],'include':_0x3a298b[_0xe80b('0x20')]?_[_0xe80b('0x1f')](_0x3a298b[_0xe80b('0x20')],function(_0x3fff7b){return{'model':db[_0x3fff7b[_0xe80b('0x21')]],'as':_0x3fff7b['as'],'attributes':_0x3fff7b[_0xe80b('0x1d')],'include':_0x3fff7b[_0xe80b('0x20')]?_[_0xe80b('0x1f')](_0x3fff7b[_0xe80b('0x20')],function(_0x1aec49){return{'model':db[_0x1aec49[_0xe80b('0x21')]],'as':_0x1aec49['as'],'attributes':_0x1aec49['attributes']};}):[]};}):[]};}):[]:[]})[_0xe80b('0x10')](function(_0x311120){logger[_0xe80b('0x17')](_0xe80b('0x22'),_0x5e0aad);logger[_0xe80b('0x23')](_0xe80b('0x22'),_0x5e0aad,JSON[_0xe80b('0x12')](_0x311120));_0x431995(_0x311120);})[_0xe80b('0x18')](function(_0x202f93){logger[_0xe80b('0x13')]('GetVoiceExtension',_0x202f93[_0xe80b('0x16')],_0x5e0aad);_0x59d5ae(_0x4338d5['error'](0x1f4,_0x202f93[_0xe80b('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 9efd5eb..d6ec345 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 _0x48f5=['length','voiceExtension:','./voiceExtension.events','save','remove','update','removeListener'];(function(_0x2132a3,_0x4639e9){var _0x21890c=function(_0x34b73d){while(--_0x34b73d){_0x2132a3['push'](_0x2132a3['shift']());}};_0x21890c(++_0x4639e9);}(_0x48f5,0x12f));var _0x548f=function(_0x262866,_0xd3896d){_0x262866=_0x262866-0x0;var _0x2e7114=_0x48f5[_0x262866];return _0x2e7114;};'use strict';var VoiceExtensionEvents=require(_0x548f('0x0'));var events=[_0x548f('0x1'),_0x548f('0x2'),_0x548f('0x3')];function createListener(_0x21578b,_0x2b966d){return function(_0x6d2be1){_0x2b966d['emit'](_0x21578b,_0x6d2be1);};}function removeListener(_0x190d96,_0x3f694a){return function(){VoiceExtensionEvents[_0x548f('0x4')](_0x190d96,_0x3f694a);};}exports['register']=function(_0x40913c){for(var _0x5265d4=0x0,_0xbcc28b=events[_0x548f('0x5')];_0x5265d4<_0xbcc28b;_0x5265d4++){var _0x3dd362=events[_0x5265d4];var _0x56f67f=createListener(_0x548f('0x6')+_0x3dd362,_0x40913c);VoiceExtensionEvents['on'](_0x3dd362,_0x56f67f);}}; \ No newline at end of file +var _0xdcaa=['update','emit','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x1efbd1,_0x3354b9){var _0x1d6a0d=function(_0xec0e15){while(--_0xec0e15){_0x1efbd1['push'](_0x1efbd1['shift']());}};_0x1d6a0d(++_0x3354b9);}(_0xdcaa,0x172));var _0xadca=function(_0x45b541,_0x3ad37e){_0x45b541=_0x45b541-0x0;var _0x33ca51=_0xdcaa[_0x45b541];return _0x33ca51;};'use strict';var VoiceExtensionEvents=require(_0xadca('0x0'));var events=[_0xadca('0x1'),'remove',_0xadca('0x2')];function createListener(_0x43881c,_0x3470c8){return function(_0x1cafeb){_0x3470c8[_0xadca('0x3')](_0x43881c,_0x1cafeb);};}function removeListener(_0x58ad6a,_0x235cab){return function(){VoiceExtensionEvents['removeListener'](_0x58ad6a,_0x235cab);};}exports['register']=function(_0x3962f0){for(var _0x504969=0x0,_0x2cad97=events[_0xadca('0x4')];_0x504969<_0x2cad97;_0x504969++){var _0x3295a2=events[_0x504969];var _0x2ba833=createListener(_0xadca('0x5')+_0x3295a2,_0x3962f0);VoiceExtensionEvents['on'](_0x3295a2,_0x2ba833);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 9335e91..7a4787a 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 _0x740c=['../../config/environment','index','get','/:id','isAuthenticated','/:id/messages','post','put','update','delete','multer','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4c9d00,_0x5092d5){var _0x4a73f5=function(_0xc0bfc7){while(--_0xc0bfc7){_0x4c9d00['push'](_0x4c9d00['shift']());}};_0x4a73f5(++_0x5092d5);}(_0x740c,0xda));var _0xc740=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x740c[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xc740('0x0'));var util=require('util');var path=require(_0xc740('0x1'));var timeout=require(_0xc740('0x2'));var express=require(_0xc740('0x3'));var router=express[_0xc740('0x4')]();var auth=require(_0xc740('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xc740('0x6'));var controller=require('./voiceMail.controller');router['get']('/',auth['isAuthenticated'](),controller[_0xc740('0x7')]);router[_0xc740('0x8')](_0xc740('0x9'),auth[_0xc740('0xa')](),controller['show']);router[_0xc740('0x8')](_0xc740('0xb'),auth[_0xc740('0xa')](),controller['getMessages']);router[_0xc740('0xc')]('/',auth[_0xc740('0xa')](),controller['create']);router[_0xc740('0xd')](_0xc740('0x9'),auth[_0xc740('0xa')](),controller[_0xc740('0xe')]);router[_0xc740('0xf')](_0xc740('0x9'),auth[_0xc740('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x805e=['multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceMail.controller','get','isAuthenticated','/:id','show','/:id/messages','getMessages','post','create','put','update','exports'];(function(_0x26d319,_0x3d6f33){var _0x373d42=function(_0x268f7b){while(--_0x268f7b){_0x26d319['push'](_0x26d319['shift']());}};_0x373d42(++_0x3d6f33);}(_0x805e,0xab));var _0xe805=function(_0x4b89d9,_0x3a4a59){_0x4b89d9=_0x4b89d9-0x0;var _0x5648ac=_0x805e[_0x4b89d9];return _0x5648ac;};'use strict';var multer=require(_0xe805('0x0'));var util=require(_0xe805('0x1'));var path=require(_0xe805('0x2'));var timeout=require(_0xe805('0x3'));var express=require(_0xe805('0x4'));var router=express['Router']();var auth=require(_0xe805('0x5'));var interaction=require(_0xe805('0x6'));var config=require('../../config/environment');var controller=require(_0xe805('0x7'));router[_0xe805('0x8')]('/',auth[_0xe805('0x9')](),controller['index']);router[_0xe805('0x8')](_0xe805('0xa'),auth[_0xe805('0x9')](),controller[_0xe805('0xb')]);router[_0xe805('0x8')](_0xe805('0xc'),auth[_0xe805('0x9')](),controller[_0xe805('0xd')]);router[_0xe805('0xe')]('/',auth[_0xe805('0x9')](),controller[_0xe805('0xf')]);router[_0xe805('0x10')](_0xe805('0xa'),auth[_0xe805('0x9')](),controller[_0xe805('0x11')]);router['delete'](_0xe805('0xa'),auth[_0xe805('0x9')](),controller['destroy']);module[_0xe805('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index 5ada7fa..a968006 100644 --- a/server/api/voiceMail/voiceMail.attributes.js +++ b/server/api/voiceMail/voiceMail.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xed3c=['INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','contest_mailbox','setDataValue','email','yes','ENUM','TINYINT(4)','TIMESTAMP'];(function(_0x3ec981,_0x39c978){var _0x31522f=function(_0x1e402a){while(--_0x1e402a){_0x3ec981['push'](_0x3ec981['shift']());}};_0x31522f(++_0x39c978);}(_0xed3c,0x1a6));var _0xced3=function(_0x402eff,_0x2525f2){_0x402eff=_0x402eff-0x0;var _0x2eb371=_0xed3c[_0x402eff];return _0x2eb371;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'customer_id':{'type':Sequelize[_0xced3('0x2')]},'context':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'from-voicemail','unique':_0xced3('0x3')},'mailbox':{'type':Sequelize[_0xced3('0x2')],'defaultValue':'','allowNull':![],'unique':_0xced3('0x3')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0xced3('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1ada18){this[_0xced3('0x4')](_0xced3('0x5'),typeof _0x1ada18==='string'&&_0x1ada18['trim']()?_0x1ada18['trim']():null);}},'pager':{'type':Sequelize[_0xced3('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':'central'},'attach':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0xced3('0x2')]},'review':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xced3('0x8'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'forcename':{'type':Sequelize[_0xced3('0x7')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xced3('0x7')](_0xced3('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM'](_0xced3('0x6'),'no'),'defaultValue':_0xced3('0x6'),'allowNull':![]},'stamp':{'type':_0xced3('0x9')},'emailsubject':{'type':Sequelize[_0xced3('0x2')]},'emailbody':{'type':Sequelize['STRING']},'maxsecs':{'type':Sequelize[_0xced3('0xa')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xced3('0xb')],'get':function(){return this[_0xced3('0xc')](_0xced3('0xd'))+_0xced3('0xe')+this[_0xced3('0xc')](_0xced3('0xf'));}}}; \ No newline at end of file +var _0x13f6=['getDataValue','fullname','\x20-\x20','sequelize','exports','from-voicemail','contest_mailbox','STRING','setDataValue','email','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL'];(function(_0x4dd15b,_0x1d880a){var _0x2445f2=function(_0x236d63){while(--_0x236d63){_0x4dd15b['push'](_0x4dd15b['shift']());}};_0x2445f2(++_0x1d880a);}(_0x13f6,0x124));var _0x613f=function(_0x2d25d9,_0x27554f){_0x2d25d9=_0x2d25d9-0x0;var _0x2391d7=_0x13f6[_0x2d25d9];return _0x2391d7;};'use strict';var Sequelize=require(_0x613f('0x0'));module[_0x613f('0x1')]={'customer_id':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING'],'defaultValue':_0x613f('0x2'),'unique':_0x613f('0x3')},'mailbox':{'type':Sequelize[_0x613f('0x4')],'defaultValue':'','allowNull':![],'unique':'contest_mailbox'},'password':{'type':Sequelize[_0x613f('0x4')]},'fullname':{'type':Sequelize[_0x613f('0x4')]},'email':{'type':Sequelize[_0x613f('0x4')],'validate':{'isEmail':!![]},'set':function(_0x5c9aa9){this[_0x613f('0x5')](_0x613f('0x6'),typeof _0x5c9aa9==='string'&&_0x5c9aa9['trim']()?_0x5c9aa9['trim']():null);}},'pager':{'type':Sequelize['STRING']},'tz':{'type':Sequelize[_0x613f('0x4')],'defaultValue':_0x613f('0x7')},'attach':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize[_0x613f('0x4')]},'review':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x613f('0x8')]('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x613f('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'forcename':{'type':Sequelize[_0x613f('0x8')](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0x613f('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x613f('0x9'),'allowNull':![]},'stamp':{'type':_0x613f('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0x613f('0x4')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x613f('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x613f('0xd')],'get':function(){return this[_0x613f('0xe')](_0x613f('0xf'))+_0x613f('0x10')+this[_0x613f('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 60b9dfa..1986e48 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 _0xf2a9=['where','pick','filter','VIRTUAL','VoiceMail','include','findAll','rows','show','params','rawAttributes','merge','options','catch','create','body','user','role','Voicemails','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','findOne','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort'];(function(_0x1fddfd,_0x153a74){var _0x595b32=function(_0x2512d4){while(--_0x2512d4){_0x1fddfd['push'](_0x1fddfd['shift']());}};_0x595b32(++_0x153a74);}(_0xf2a9,0x77));var _0x9f2a=function(_0x270a0c,_0x1efc27){_0x270a0c=_0x270a0c-0x0;var _0x1cd130=_0xf2a9[_0x270a0c];return _0x1cd130;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x9f2a('0x0'));var rimraf=require(_0x9f2a('0x1'));var zipdir=require(_0x9f2a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9f2a('0x3'));var moment=require(_0x9f2a('0x4'));var BPromise=require(_0x9f2a('0x5'));var Mustache=require(_0x9f2a('0x6'));var util=require(_0x9f2a('0x7'));var path=require('path');var sox=require(_0x9f2a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var _=require(_0x9f2a('0x9'));var squel=require('squel');var crypto=require(_0x9f2a('0xa'));var jsforce=require(_0x9f2a('0xb'));var deskjs=require(_0x9f2a('0xc'));var toCsv=require(_0x9f2a('0xd'));var querystring=require(_0x9f2a('0xe'));var Papa=require(_0x9f2a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9f2a('0x10'));var as=require(_0x9f2a('0x11'));var hardwareService=require(_0x9f2a('0x12'));var logger=require('../../config/logger')(_0x9f2a('0x13'));var utils=require(_0x9f2a('0x14'));var config=require(_0x9f2a('0x15'));var db=require(_0x9f2a('0x16'))['db'];function respondWithStatusCode(_0x32a207,_0x486314){_0x486314=_0x486314||0xcc;return function(_0x27e0bc){if(_0x27e0bc){return _0x32a207[_0x9f2a('0x17')](_0x486314);}return _0x32a207[_0x9f2a('0x18')](_0x486314)[_0x9f2a('0x19')]();};}function respondWithResult(_0x519c63,_0x4f001d){_0x4f001d=_0x4f001d||0xc8;return function(_0x5241f8){if(_0x5241f8){return _0x519c63[_0x9f2a('0x18')](_0x4f001d)[_0x9f2a('0x1a')](_0x5241f8);}};}function respondWithFilteredResult(_0x1b55d2,_0x240c7b){return function(_0x4d1813){if(_0x4d1813){var _0x1cd0c4=_0x4d1813[_0x9f2a('0x1b')],_0x3b0e4b=_0x240c7b[_0x9f2a('0x1c')],_0x3f7fc3=_0x240c7b[_0x9f2a('0x1c')]+_0x240c7b['limit'],_0x6d6bf9;if(_0x3f7fc3>=_0x1cd0c4){_0x3f7fc3=_0x1cd0c4;_0x6d6bf9=0xc8;}else{_0x6d6bf9=0xce;}_0x1b55d2[_0x9f2a('0x18')](_0x6d6bf9);return _0x1b55d2[_0x9f2a('0x1d')](_0x9f2a('0x1e'),_0x3b0e4b+'-'+_0x3f7fc3+'/'+_0x1cd0c4)[_0x9f2a('0x1a')](_0x4d1813);}return null;};}function patchUpdates(_0x5244d0){return function(_0x41a5a4){try{jsonpatch[_0x9f2a('0x1f')](_0x41a5a4,_0x5244d0,!![]);}catch(_0x1a2f7e){return BPromise[_0x9f2a('0x20')](_0x1a2f7e);}return _0x41a5a4[_0x9f2a('0x21')]();};}function saveUpdates(_0x1d891f,_0x111016){return function(_0x4bcf7e){if(_0x4bcf7e){return _0x4bcf7e['update'](_0x1d891f)[_0x9f2a('0x22')](function(_0x35c8d9){return _0x35c8d9;});}return null;};}function removeEntity(_0x377d8c,_0x5035ec){return function(_0x10cdd2){if(_0x10cdd2){return _0x10cdd2['destroy']()['then'](function(){var _0x47bc38=_0x10cdd2[_0x9f2a('0x23')]({'plain':!![]});var _0x56b638='Voicemails';return db[_0x9f2a('0x24')][_0x9f2a('0x25')]({'where':{'type':_0x56b638,'resourceId':_0x47bc38['id']}})[_0x9f2a('0x22')](function(){return _0x10cdd2;});})[_0x9f2a('0x22')](function(){_0x377d8c[_0x9f2a('0x18')](0xcc)[_0x9f2a('0x19')]();});}};}function handleEntityNotFound(_0x1d84fe,_0x5eddbd){return function(_0x38e107){if(!_0x38e107){_0x1d84fe['sendStatus'](0x194);}return _0x38e107;};}function handleError(_0x45f0ba,_0x51d8f8){_0x51d8f8=_0x51d8f8||0x1f4;return function(_0x3d9480){logger[_0x9f2a('0x26')](_0x3d9480[_0x9f2a('0x27')]);if(_0x3d9480[_0x9f2a('0x28')]){delete _0x3d9480[_0x9f2a('0x28')];}_0x45f0ba['status'](_0x51d8f8)[_0x9f2a('0x29')](_0x3d9480);};}exports[_0x9f2a('0x2a')]=function(_0x4bda1f,_0xc0a1b7){var _0x165bb3={},_0x2de7c5={},_0x22906a={'count':0x0,'rows':[]};var _0x1c17e2=_[_0x9f2a('0x2b')](db['VoiceMail']['rawAttributes'],function(_0x43a46d){return{'name':_0x43a46d[_0x9f2a('0x2c')],'type':_0x43a46d[_0x9f2a('0x2d')][_0x9f2a('0x2e')]};});_0x2de7c5[_0x9f2a('0x2f')]=_['map'](_0x1c17e2,_0x9f2a('0x28'));_0x2de7c5[_0x9f2a('0x30')]=_[_0x9f2a('0x31')](_0x4bda1f[_0x9f2a('0x30')]);_0x2de7c5[_0x9f2a('0x32')]=_[_0x9f2a('0x33')](_0x2de7c5['model'],_0x2de7c5[_0x9f2a('0x30')]);_0x165bb3[_0x9f2a('0x34')]=_[_0x9f2a('0x33')](_0x2de7c5[_0x9f2a('0x2f')],qs[_0x9f2a('0x35')](_0x4bda1f[_0x9f2a('0x30')][_0x9f2a('0x35')]));_0x165bb3[_0x9f2a('0x34')]=_0x165bb3[_0x9f2a('0x34')][_0x9f2a('0x36')]?_0x165bb3['attributes']:_0x2de7c5[_0x9f2a('0x2f')];if(!_0x4bda1f['query']['hasOwnProperty'](_0x9f2a('0x37'))){_0x165bb3[_0x9f2a('0x38')]=qs[_0x9f2a('0x38')](_0x4bda1f['query'][_0x9f2a('0x38')]);_0x165bb3[_0x9f2a('0x1c')]=qs[_0x9f2a('0x1c')](_0x4bda1f[_0x9f2a('0x30')]['offset']);}_0x165bb3[_0x9f2a('0x39')]=qs[_0x9f2a('0x3a')](_0x4bda1f['query'][_0x9f2a('0x3a')]);_0x165bb3[_0x9f2a('0x3b')]=qs['filters'](_[_0x9f2a('0x3c')](_0x4bda1f[_0x9f2a('0x30')],_0x2de7c5[_0x9f2a('0x32')]));if(_0x4bda1f[_0x9f2a('0x30')][_0x9f2a('0x3d')]){_0x165bb3['where']=_['merge'](_0x165bb3[_0x9f2a('0x3b')],{'$or':_[_0x9f2a('0x2b')](_0x1c17e2,function(_0x94ab1b){if(_0x94ab1b[_0x9f2a('0x2d')]!==_0x9f2a('0x3e')){var _0x296d7a={};_0x296d7a[_0x94ab1b[_0x9f2a('0x28')]]={'$like':'%'+_0x4bda1f[_0x9f2a('0x30')]['filter']+'%'};return _0x296d7a;}})});}_0x165bb3=_['merge']({},_0x165bb3,_0x4bda1f['options']);var _0x49178c={'where':_0x165bb3[_0x9f2a('0x3b')]};return db[_0x9f2a('0x3f')][_0x9f2a('0x1b')](_0x49178c)[_0x9f2a('0x22')](function(_0xa3603e){_0x22906a[_0x9f2a('0x1b')]=_0xa3603e;if(_0x4bda1f[_0x9f2a('0x30')]['includeAll']){_0x165bb3[_0x9f2a('0x40')]=[{'all':!![]}];}return db[_0x9f2a('0x3f')][_0x9f2a('0x41')](_0x165bb3);})[_0x9f2a('0x22')](function(_0x34efb5){_0x22906a[_0x9f2a('0x42')]=_0x34efb5;return _0x22906a;})[_0x9f2a('0x22')](respondWithFilteredResult(_0xc0a1b7,_0x165bb3))['catch'](handleError(_0xc0a1b7,null));};exports[_0x9f2a('0x43')]=function(_0x1e0670,_0x1addff){var _0x338d22={'raw':!![],'where':{'id':_0x1e0670[_0x9f2a('0x44')]['id']}},_0x4335a3={};_0x4335a3[_0x9f2a('0x2f')]=_[_0x9f2a('0x31')](db[_0x9f2a('0x3f')][_0x9f2a('0x45')]);_0x4335a3['query']=_[_0x9f2a('0x31')](_0x1e0670[_0x9f2a('0x30')]);_0x4335a3['filters']=_[_0x9f2a('0x33')](_0x4335a3[_0x9f2a('0x2f')],_0x4335a3['query']);_0x338d22[_0x9f2a('0x34')]=_[_0x9f2a('0x33')](_0x4335a3[_0x9f2a('0x2f')],qs[_0x9f2a('0x35')](_0x1e0670[_0x9f2a('0x30')][_0x9f2a('0x35')]));_0x338d22[_0x9f2a('0x34')]=_0x338d22[_0x9f2a('0x34')]['length']?_0x338d22['attributes']:_0x4335a3[_0x9f2a('0x2f')];if(_0x1e0670['query']['includeAll']){_0x338d22[_0x9f2a('0x40')]=[{'all':!![]}];}_0x338d22=_[_0x9f2a('0x46')]({},_0x338d22,_0x1e0670[_0x9f2a('0x47')]);return db[_0x9f2a('0x3f')]['find'](_0x338d22)[_0x9f2a('0x22')](handleEntityNotFound(_0x1addff,null))[_0x9f2a('0x22')](respondWithResult(_0x1addff,null))[_0x9f2a('0x48')](handleError(_0x1addff,null));};exports['create']=function(_0xdfa311,_0x269368){return db[_0x9f2a('0x3f')][_0x9f2a('0x49')](_0xdfa311[_0x9f2a('0x4a')],{})['then'](function(_0x43af77){var _0x226496=_0xdfa311[_0x9f2a('0x4b')]['get']({'plain':!![]});if(!_0x226496)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x226496[_0x9f2a('0x4c')]==='user'){var _0xa0af15=_0x43af77['get']({'plain':!![]});var _0x1ee137=_0x9f2a('0x4d');return db[_0x9f2a('0x4e')]['find']({'where':{'name':_0x1ee137,'userProfileId':_0x226496[_0x9f2a('0x4f')]},'raw':!![]})[_0x9f2a('0x22')](function(_0x3c87ac){if(_0x3c87ac&&_0x3c87ac[_0x9f2a('0x50')]===0x0){return db['UserProfileResource']['create']({'name':_0xa0af15[_0x9f2a('0x28')],'resourceId':_0xa0af15['id'],'type':_0x3c87ac[_0x9f2a('0x28')],'sectionId':_0x3c87ac['id']},{})[_0x9f2a('0x22')](function(){return _0x43af77;});}else{return _0x43af77;}})['catch'](function(_0x36ae5b){logger[_0x9f2a('0x26')](_0x9f2a('0x51'),_0x36ae5b);throw _0x36ae5b;});}return _0x43af77;})[_0x9f2a('0x22')](respondWithResult(_0x269368,0xc9))['catch'](handleError(_0x269368,null));};exports[_0x9f2a('0x52')]=function(_0xdf53b8,_0x514853){if(_0xdf53b8[_0x9f2a('0x4a')]['id']){delete _0xdf53b8[_0x9f2a('0x4a')]['id'];}return db[_0x9f2a('0x3f')][_0x9f2a('0x53')]({'where':{'id':_0xdf53b8[_0x9f2a('0x44')]['id']}})[_0x9f2a('0x22')](handleEntityNotFound(_0x514853,null))[_0x9f2a('0x22')](saveUpdates(_0xdf53b8[_0x9f2a('0x4a')],null))[_0x9f2a('0x22')](respondWithResult(_0x514853,null))['catch'](handleError(_0x514853,null));};exports[_0x9f2a('0x25')]=function(_0x5a2d91,_0x1c02f6){return db[_0x9f2a('0x3f')]['find']({'where':{'id':_0x5a2d91['params']['id']}})[_0x9f2a('0x22')](handleEntityNotFound(_0x1c02f6,null))['then'](removeEntity(_0x1c02f6,null))[_0x9f2a('0x48')](handleError(_0x1c02f6,null));};exports['getMessages']=function(_0x2ec6d1,_0x4a0adb,_0x7538ff){return db[_0x9f2a('0x3f')][_0x9f2a('0x54')]({'where':{'id':_0x2ec6d1[_0x9f2a('0x44')]['id']}})[_0x9f2a('0x22')](handleEntityNotFound(_0x4a0adb,null))[_0x9f2a('0x22')](function(_0x4c5b3d){var _0x39a8be;var _0x1ac836={},_0x44ee0c={};_0x44ee0c['model']=_[_0x9f2a('0x31')](db[_0x9f2a('0x55')]['rawAttributes']);_0x44ee0c[_0x9f2a('0x30')]=_['keys'](_0x2ec6d1[_0x9f2a('0x30')]);_0x44ee0c[_0x9f2a('0x32')]=_['intersection'](_0x44ee0c[_0x9f2a('0x2f')],_0x44ee0c[_0x9f2a('0x30')]);_0x1ac836[_0x9f2a('0x34')]=_[_0x9f2a('0x33')](_0x44ee0c['model'],qs['fields'](_0x2ec6d1[_0x9f2a('0x30')]['fields']));_0x1ac836[_0x9f2a('0x34')]=_0x1ac836['attributes'][_0x9f2a('0x36')]?_0x1ac836[_0x9f2a('0x34')]:_0x44ee0c[_0x9f2a('0x2f')];if(!_0x2ec6d1['query'][_0x9f2a('0x56')](_0x9f2a('0x37'))){_0x1ac836[_0x9f2a('0x38')]=qs[_0x9f2a('0x38')](_0x2ec6d1['query'][_0x9f2a('0x38')]);_0x1ac836[_0x9f2a('0x1c')]=qs[_0x9f2a('0x1c')](_0x2ec6d1[_0x9f2a('0x30')][_0x9f2a('0x1c')]);}_0x1ac836['order']=qs[_0x9f2a('0x3a')](_0x2ec6d1['query'][_0x9f2a('0x3a')]);_0x1ac836[_0x9f2a('0x3b')]=qs[_0x9f2a('0x32')](_[_0x9f2a('0x3c')](_0x2ec6d1[_0x9f2a('0x30')],_0x44ee0c[_0x9f2a('0x32')]));if(_0x2ec6d1[_0x9f2a('0x30')][_0x9f2a('0x3d')]){_0x1ac836[_0x9f2a('0x3b')]=_[_0x9f2a('0x46')](_0x1ac836[_0x9f2a('0x3b')],{'$or':_[_0x9f2a('0x2b')](_0x1ac836[_0x9f2a('0x34')],function(_0x47875e){var _0x268196={};_0x268196[_0x47875e]={'$like':'%'+_0x2ec6d1[_0x9f2a('0x30')][_0x9f2a('0x3d')]+'%'};return _0x268196;})});}_0x1ac836['where']=_['merge'](_0x1ac836[_0x9f2a('0x3b')],{'mailboxuser':_0x4c5b3d[_0x9f2a('0x57')]});_0x1ac836=_['merge']({},_0x1ac836,_0x2ec6d1[_0x9f2a('0x47')]);return db[_0x9f2a('0x55')][_0x9f2a('0x58')](_0x1ac836)[_0x9f2a('0x22')](respondWithFilteredResult(_0x4a0adb,_0x1ac836));})[_0x9f2a('0x48')](handleError(_0x4a0adb,null));}; \ No newline at end of file +var _0x1789=['offset','limit','set','Content-Range','json','apply','save','update','then','Voicemails','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','show','params','find','catch','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','getMessages','VoiceMailMessage','hasOwnProperty','mailbox','findAndCountAll','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','count'];(function(_0x4f92e8,_0x36916f){var _0x25ded9=function(_0x2f51b8){while(--_0x2f51b8){_0x4f92e8['push'](_0x4f92e8['shift']());}};_0x25ded9(++_0x36916f);}(_0x1789,0x92));var _0x9178=function(_0x3bcb39,_0x2e1bd0){_0x3bcb39=_0x3bcb39-0x0;var _0x158bc4=_0x1789[_0x3bcb39];return _0x158bc4;};'use strict';var pdf=require(_0x9178('0x0'));var emlformat=require(_0x9178('0x1'));var rimraf=require(_0x9178('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9178('0x3'));var rp=require(_0x9178('0x4'));var moment=require(_0x9178('0x5'));var BPromise=require(_0x9178('0x6'));var Mustache=require(_0x9178('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9178('0x8'));var csv=require(_0x9178('0x9'));var ejs=require(_0x9178('0xa'));var fs=require('fs');var _=require(_0x9178('0xb'));var squel=require('squel');var crypto=require(_0x9178('0xc'));var jsforce=require(_0x9178('0xd'));var deskjs=require(_0x9178('0xe'));var toCsv=require(_0x9178('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x9178('0xf'));var qs=require(_0x9178('0x10'));var as=require(_0x9178('0x11'));var hardwareService=require(_0x9178('0x12'));var logger=require('../../config/logger')(_0x9178('0x13'));var utils=require(_0x9178('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b3737,_0x1400a4){_0x1400a4=_0x1400a4||0xcc;return function(_0x321d98){if(_0x321d98){return _0x5b3737['sendStatus'](_0x1400a4);}return _0x5b3737[_0x9178('0x15')](_0x1400a4)[_0x9178('0x16')]();};}function respondWithResult(_0x2b01d0,_0x496489){_0x496489=_0x496489||0xc8;return function(_0x2daff3){if(_0x2daff3){return _0x2b01d0[_0x9178('0x15')](_0x496489)['json'](_0x2daff3);}};}function respondWithFilteredResult(_0x38f96a,_0x4d931e){return function(_0x4281aa){if(_0x4281aa){var _0x703536=_0x4281aa[_0x9178('0x17')],_0x26eeb9=_0x4d931e[_0x9178('0x18')],_0x45d428=_0x4d931e[_0x9178('0x18')]+_0x4d931e[_0x9178('0x19')],_0x1fdaf9;if(_0x45d428>=_0x703536){_0x45d428=_0x703536;_0x1fdaf9=0xc8;}else{_0x1fdaf9=0xce;}_0x38f96a[_0x9178('0x15')](_0x1fdaf9);return _0x38f96a[_0x9178('0x1a')](_0x9178('0x1b'),_0x26eeb9+'-'+_0x45d428+'/'+_0x703536)[_0x9178('0x1c')](_0x4281aa);}return null;};}function patchUpdates(_0x30c430){return function(_0x5c9fef){try{jsonpatch[_0x9178('0x1d')](_0x5c9fef,_0x30c430,!![]);}catch(_0x1cef7f){return BPromise['reject'](_0x1cef7f);}return _0x5c9fef[_0x9178('0x1e')]();};}function saveUpdates(_0x59b1d2,_0x94c136){return function(_0x1de1a2){if(_0x1de1a2){return _0x1de1a2[_0x9178('0x1f')](_0x59b1d2)[_0x9178('0x20')](function(_0x3f570b){return _0x3f570b;});}return null;};}function removeEntity(_0x16e535,_0x327b4b){return function(_0x4c13cf){if(_0x4c13cf){return _0x4c13cf['destroy']()[_0x9178('0x20')](function(){var _0x53995e=_0x4c13cf['get']({'plain':!![]});var _0x2c40c1=_0x9178('0x21');return db[_0x9178('0x22')][_0x9178('0x23')]({'where':{'type':_0x2c40c1,'resourceId':_0x53995e['id']}})[_0x9178('0x20')](function(){return _0x4c13cf;});})[_0x9178('0x20')](function(){_0x16e535[_0x9178('0x15')](0xcc)[_0x9178('0x16')]();});}};}function handleEntityNotFound(_0x1b39c5,_0x2114ec){return function(_0x16cebe){if(!_0x16cebe){_0x1b39c5[_0x9178('0x24')](0x194);}return _0x16cebe;};}function handleError(_0x3dccbf,_0x3af74d){_0x3af74d=_0x3af74d||0x1f4;return function(_0x4d2c72){logger[_0x9178('0x25')](_0x4d2c72[_0x9178('0x26')]);if(_0x4d2c72['name']){delete _0x4d2c72[_0x9178('0x27')];}_0x3dccbf[_0x9178('0x15')](_0x3af74d)[_0x9178('0x28')](_0x4d2c72);};}exports[_0x9178('0x29')]=function(_0x23e54c,_0x3b2487){var _0x5d9747={},_0x267f42={},_0x47201c={'count':0x0,'rows':[]};var _0x553a32=_[_0x9178('0x2a')](db[_0x9178('0x2b')][_0x9178('0x2c')],function(_0x3b4ad8){return{'name':_0x3b4ad8[_0x9178('0x2d')],'type':_0x3b4ad8[_0x9178('0x2e')][_0x9178('0x2f')]};});_0x267f42['model']=_[_0x9178('0x2a')](_0x553a32,'name');_0x267f42[_0x9178('0x30')]=_[_0x9178('0x31')](_0x23e54c['query']);_0x267f42[_0x9178('0x32')]=_[_0x9178('0x33')](_0x267f42[_0x9178('0x34')],_0x267f42[_0x9178('0x30')]);_0x5d9747['attributes']=_[_0x9178('0x33')](_0x267f42[_0x9178('0x34')],qs[_0x9178('0x35')](_0x23e54c[_0x9178('0x30')][_0x9178('0x35')]));_0x5d9747[_0x9178('0x36')]=_0x5d9747[_0x9178('0x36')][_0x9178('0x37')]?_0x5d9747['attributes']:_0x267f42[_0x9178('0x34')];if(!_0x23e54c[_0x9178('0x30')]['hasOwnProperty'](_0x9178('0x38'))){_0x5d9747['limit']=qs[_0x9178('0x19')](_0x23e54c['query']['limit']);_0x5d9747[_0x9178('0x18')]=qs[_0x9178('0x18')](_0x23e54c['query'][_0x9178('0x18')]);}_0x5d9747[_0x9178('0x39')]=qs['sort'](_0x23e54c['query'][_0x9178('0x3a')]);_0x5d9747[_0x9178('0x3b')]=qs[_0x9178('0x32')](_[_0x9178('0x3c')](_0x23e54c['query'],_0x267f42['filters']));if(_0x23e54c[_0x9178('0x30')]['filter']){_0x5d9747['where']=_[_0x9178('0x3d')](_0x5d9747[_0x9178('0x3b')],{'$or':_[_0x9178('0x2a')](_0x553a32,function(_0x481b75){if(_0x481b75[_0x9178('0x2e')]!==_0x9178('0x3e')){var _0x3f8528={};_0x3f8528[_0x481b75['name']]={'$like':'%'+_0x23e54c[_0x9178('0x30')][_0x9178('0x3f')]+'%'};return _0x3f8528;}})});}_0x5d9747=_[_0x9178('0x3d')]({},_0x5d9747,_0x23e54c[_0x9178('0x40')]);var _0xcdfb9c={'where':_0x5d9747[_0x9178('0x3b')]};return db[_0x9178('0x2b')]['count'](_0xcdfb9c)[_0x9178('0x20')](function(_0xd407db){_0x47201c[_0x9178('0x17')]=_0xd407db;if(_0x23e54c[_0x9178('0x30')]['includeAll']){_0x5d9747[_0x9178('0x41')]=[{'all':!![]}];}return db[_0x9178('0x2b')][_0x9178('0x42')](_0x5d9747);})[_0x9178('0x20')](function(_0x49b282){_0x47201c[_0x9178('0x43')]=_0x49b282;return _0x47201c;})['then'](respondWithFilteredResult(_0x3b2487,_0x5d9747))['catch'](handleError(_0x3b2487,null));};exports[_0x9178('0x44')]=function(_0x1bd23a,_0x20f9c7){var _0x69ad3c={'raw':!![],'where':{'id':_0x1bd23a[_0x9178('0x45')]['id']}},_0x490262={};_0x490262[_0x9178('0x34')]=_[_0x9178('0x31')](db['VoiceMail'][_0x9178('0x2c')]);_0x490262[_0x9178('0x30')]=_[_0x9178('0x31')](_0x1bd23a['query']);_0x490262[_0x9178('0x32')]=_[_0x9178('0x33')](_0x490262[_0x9178('0x34')],_0x490262['query']);_0x69ad3c[_0x9178('0x36')]=_[_0x9178('0x33')](_0x490262['model'],qs[_0x9178('0x35')](_0x1bd23a[_0x9178('0x30')]['fields']));_0x69ad3c[_0x9178('0x36')]=_0x69ad3c[_0x9178('0x36')][_0x9178('0x37')]?_0x69ad3c['attributes']:_0x490262['model'];if(_0x1bd23a[_0x9178('0x30')]['includeAll']){_0x69ad3c[_0x9178('0x41')]=[{'all':!![]}];}_0x69ad3c=_[_0x9178('0x3d')]({},_0x69ad3c,_0x1bd23a[_0x9178('0x40')]);return db[_0x9178('0x2b')][_0x9178('0x46')](_0x69ad3c)['then'](handleEntityNotFound(_0x20f9c7,null))[_0x9178('0x20')](respondWithResult(_0x20f9c7,null))[_0x9178('0x47')](handleError(_0x20f9c7,null));};exports['create']=function(_0x42acef,_0x3b30c6){return db['VoiceMail'][_0x9178('0x48')](_0x42acef['body'],{})[_0x9178('0x20')](function(_0x33ce2a){var _0x322f19=_0x42acef[_0x9178('0x49')][_0x9178('0x4a')]({'plain':!![]});if(!_0x322f19)throw new Error(_0x9178('0x4b'));if(_0x322f19['role']===_0x9178('0x49')){var _0x3f5278=_0x33ce2a[_0x9178('0x4a')]({'plain':!![]});var _0x3d4ea0=_0x9178('0x21');return db[_0x9178('0x4c')][_0x9178('0x46')]({'where':{'name':_0x3d4ea0,'userProfileId':_0x322f19[_0x9178('0x4d')]},'raw':!![]})[_0x9178('0x20')](function(_0x4624e9){if(_0x4624e9&&_0x4624e9['autoAssociation']===0x0){return db[_0x9178('0x22')][_0x9178('0x48')]({'name':_0x3f5278[_0x9178('0x27')],'resourceId':_0x3f5278['id'],'type':_0x4624e9[_0x9178('0x27')],'sectionId':_0x4624e9['id']},{})[_0x9178('0x20')](function(){return _0x33ce2a;});}else{return _0x33ce2a;}})[_0x9178('0x47')](function(_0x3bd3da){logger['error'](_0x9178('0x4e'),_0x3bd3da);throw _0x3bd3da;});}return _0x33ce2a;})[_0x9178('0x20')](respondWithResult(_0x3b30c6,0xc9))[_0x9178('0x47')](handleError(_0x3b30c6,null));};exports[_0x9178('0x1f')]=function(_0x4f2165,_0x304614){if(_0x4f2165[_0x9178('0x4f')]['id']){delete _0x4f2165[_0x9178('0x4f')]['id'];}return db['VoiceMail'][_0x9178('0x46')]({'where':{'id':_0x4f2165[_0x9178('0x45')]['id']}})[_0x9178('0x20')](handleEntityNotFound(_0x304614,null))[_0x9178('0x20')](saveUpdates(_0x4f2165[_0x9178('0x4f')],null))[_0x9178('0x20')](respondWithResult(_0x304614,null))['catch'](handleError(_0x304614,null));};exports['destroy']=function(_0x8581f1,_0x395d55){return db[_0x9178('0x2b')][_0x9178('0x46')]({'where':{'id':_0x8581f1[_0x9178('0x45')]['id']}})[_0x9178('0x20')](handleEntityNotFound(_0x395d55,null))[_0x9178('0x20')](removeEntity(_0x395d55,null))[_0x9178('0x47')](handleError(_0x395d55,null));};exports[_0x9178('0x50')]=function(_0x3ca4b1,_0x406411,_0x34fc20){return db[_0x9178('0x2b')]['findOne']({'where':{'id':_0x3ca4b1[_0x9178('0x45')]['id']}})['then'](handleEntityNotFound(_0x406411,null))[_0x9178('0x20')](function(_0x4f0a77){var _0x40ea60;var _0x580a5c={},_0x1ca6f3={};_0x1ca6f3['model']=_['keys'](db[_0x9178('0x51')][_0x9178('0x2c')]);_0x1ca6f3[_0x9178('0x30')]=_['keys'](_0x3ca4b1[_0x9178('0x30')]);_0x1ca6f3[_0x9178('0x32')]=_[_0x9178('0x33')](_0x1ca6f3['model'],_0x1ca6f3[_0x9178('0x30')]);_0x580a5c[_0x9178('0x36')]=_[_0x9178('0x33')](_0x1ca6f3[_0x9178('0x34')],qs[_0x9178('0x35')](_0x3ca4b1[_0x9178('0x30')]['fields']));_0x580a5c[_0x9178('0x36')]=_0x580a5c[_0x9178('0x36')][_0x9178('0x37')]?_0x580a5c['attributes']:_0x1ca6f3['model'];if(!_0x3ca4b1[_0x9178('0x30')][_0x9178('0x52')](_0x9178('0x38'))){_0x580a5c['limit']=qs[_0x9178('0x19')](_0x3ca4b1[_0x9178('0x30')][_0x9178('0x19')]);_0x580a5c['offset']=qs[_0x9178('0x18')](_0x3ca4b1[_0x9178('0x30')]['offset']);}_0x580a5c[_0x9178('0x39')]=qs[_0x9178('0x3a')](_0x3ca4b1[_0x9178('0x30')]['sort']);_0x580a5c['where']=qs[_0x9178('0x32')](_[_0x9178('0x3c')](_0x3ca4b1['query'],_0x1ca6f3[_0x9178('0x32')]));if(_0x3ca4b1[_0x9178('0x30')][_0x9178('0x3f')]){_0x580a5c['where']=_['merge'](_0x580a5c[_0x9178('0x3b')],{'$or':_['map'](_0x580a5c['attributes'],function(_0x5ab1bc){var _0x22eb98={};_0x22eb98[_0x5ab1bc]={'$like':'%'+_0x3ca4b1[_0x9178('0x30')][_0x9178('0x3f')]+'%'};return _0x22eb98;})});}_0x580a5c['where']=_[_0x9178('0x3d')](_0x580a5c[_0x9178('0x3b')],{'mailboxuser':_0x4f0a77[_0x9178('0x53')]});_0x580a5c=_[_0x9178('0x3d')]({},_0x580a5c,_0x3ca4b1[_0x9178('0x40')]);return db[_0x9178('0x51')][_0x9178('0x54')](_0x580a5c)[_0x9178('0x20')](respondWithFilteredResult(_0x406411,_0x580a5c));})['catch'](handleError(_0x406411,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index 99c2686..549dc2a 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 _0x1541=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','voice_voicemail','mailbox_context','mailbox','context','util'];(function(_0x3eea6e,_0x2016fe){var _0xc02bc4=function(_0x4dffd9){while(--_0x4dffd9){_0x3eea6e['push'](_0x3eea6e['shift']());}};_0xc02bc4(++_0x2016fe);}(_0x1541,0x158));var _0x1154=function(_0x912d27,_0x28e0e3){_0x912d27=_0x912d27-0x0;var _0x31b918=_0x1541[_0x912d27];return _0x31b918;};'use strict';var _=require('lodash');var util=require(_0x1154('0x0'));var logger=require(_0x1154('0x1'))('api');var moment=require(_0x1154('0x2'));var BPromise=require(_0x1154('0x3'));var rp=require(_0x1154('0x4'));var fs=require('fs');var path=require(_0x1154('0x5'));var rimraf=require(_0x1154('0x6'));var config=require(_0x1154('0x7'));var attributes=require(_0x1154('0x8'));module[_0x1154('0x9')]=function(_0xd0d446,_0x4ec72b){return _0xd0d446[_0x1154('0xa')]('VoiceMail',attributes,{'tableName':_0x1154('0xb'),'paranoid':![],'indexes':[{'name':_0x1154('0xc'),'fields':[_0x1154('0xd'),_0x1154('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xacc5=['path','rimraf','./voiceMail.attributes','exports','VoiceMail','voice_voicemail','mailbox','context','lodash','api','bluebird','request-promise'];(function(_0x3ea416,_0x380f69){var _0x1f8eb0=function(_0x32ef27){while(--_0x32ef27){_0x3ea416['push'](_0x3ea416['shift']());}};_0x1f8eb0(++_0x380f69);}(_0xacc5,0x188));var _0x5acc=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xacc5[_0x17d9e3];return _0x14192d;};'use strict';var _=require(_0x5acc('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5acc('0x1'));var moment=require('moment');var BPromise=require(_0x5acc('0x2'));var rp=require(_0x5acc('0x3'));var fs=require('fs');var path=require(_0x5acc('0x4'));var rimraf=require(_0x5acc('0x5'));var config=require('../../config/environment');var attributes=require(_0x5acc('0x6'));module[_0x5acc('0x7')]=function(_0x175a0a,_0x117067){return _0x175a0a['define'](_0x5acc('0x8'),attributes,{'tableName':_0x5acc('0x9'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x5acc('0xa'),_0x5acc('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 1627bf5..07ae665 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 _0xb610=['stringify','error','code','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x224474,_0x4870eb){var _0x175527=function(_0xdb3520){while(--_0xdb3520){_0x224474['push'](_0x224474['shift']());}};_0x175527(++_0x4870eb);}(_0xb610,0x18d));var _0x0b61=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xb610[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0x0b61('0x0'));var util=require('util');var moment=require(_0x0b61('0x1'));var BPromise=require(_0x0b61('0x2'));var rs=require(_0x0b61('0x3'));var fs=require('fs');var Redis=require(_0x0b61('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x0b61('0x5'));var logger=require(_0x0b61('0x6'))(_0x0b61('0x7'));var config=require(_0x0b61('0x8'));var jayson=require(_0x0b61('0x9'));var client=jayson[_0x0b61('0xa')][_0x0b61('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x59c3e3,_0x5776a1,_0x3d9eef){return new BPromise(function(_0xd75d44,_0x2b94c7){return client['request'](_0x59c3e3,_0x3d9eef)[_0x0b61('0xc')](function(_0x11e751){logger['info'](_0x0b61('0xd'),_0x5776a1,'request\x20sent');logger[_0x0b61('0xe')](_0x0b61('0xf'),_0x5776a1,_0x0b61('0x10'),JSON[_0x0b61('0x11')](_0x11e751));if(_0x11e751[_0x0b61('0x12')]){if(_0x11e751[_0x0b61('0x12')][_0x0b61('0x13')]===0x1f4){logger[_0x0b61('0x12')](_0x0b61('0xd'),_0x5776a1,_0x11e751[_0x0b61('0x12')][_0x0b61('0x14')]);return _0x2b94c7(_0x11e751[_0x0b61('0x12')][_0x0b61('0x14')]);}logger[_0x0b61('0x12')](_0x0b61('0xd'),_0x5776a1,_0x11e751[_0x0b61('0x12')][_0x0b61('0x14')]);return _0xd75d44(_0x11e751[_0x0b61('0x12')][_0x0b61('0x14')]);}else{logger[_0x0b61('0x15')](_0x0b61('0xd'),_0x5776a1,_0x0b61('0x10'));_0xd75d44(_0x11e751['result'][_0x0b61('0x14')]);}})[_0x0b61('0x16')](function(_0x426a1e){logger[_0x0b61('0x12')]('VoiceMail,\x20%s,\x20%s',_0x5776a1,_0x426a1e);_0x2b94c7(_0x426a1e);});});} \ No newline at end of file +var _0x2826=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x4e002d,_0xef5495){var _0x3b43f0=function(_0x1f5240){while(--_0x1f5240){_0x4e002d['push'](_0x4e002d['shift']());}};_0x3b43f0(++_0xef5495);}(_0x2826,0x103));var _0x6282=function(_0x422311,_0x54125c){_0x422311=_0x422311-0x0;var _0x356858=_0x2826[_0x422311];return _0x356858;};'use strict';var _=require(_0x6282('0x0'));var util=require(_0x6282('0x1'));var moment=require(_0x6282('0x2'));var BPromise=require('bluebird');var rs=require(_0x6282('0x3'));var fs=require('fs');var Redis=require(_0x6282('0x4'));var db=require(_0x6282('0x5'))['db'];var utils=require(_0x6282('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6282('0x7'));var jayson=require(_0x6282('0x8'));var client=jayson[_0x6282('0x9')][_0x6282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3d2cab,_0x140954,_0x2bde38){return new BPromise(function(_0x243af8,_0x199c31){return client['request'](_0x3d2cab,_0x2bde38)[_0x6282('0xb')](function(_0x352f69){logger[_0x6282('0xc')](_0x6282('0xd'),_0x140954,_0x6282('0xe'));logger[_0x6282('0xf')](_0x6282('0x10'),_0x140954,_0x6282('0xe'),JSON['stringify'](_0x352f69));if(_0x352f69[_0x6282('0x11')]){if(_0x352f69[_0x6282('0x11')][_0x6282('0x12')]===0x1f4){logger[_0x6282('0x11')]('VoiceMail,\x20%s,\x20%s',_0x140954,_0x352f69[_0x6282('0x11')][_0x6282('0x13')]);return _0x199c31(_0x352f69[_0x6282('0x11')]['message']);}logger[_0x6282('0x11')](_0x6282('0xd'),_0x140954,_0x352f69['error'][_0x6282('0x13')]);return _0x243af8(_0x352f69[_0x6282('0x11')][_0x6282('0x13')]);}else{logger[_0x6282('0xc')](_0x6282('0xd'),_0x140954,_0x6282('0xe'));_0x243af8(_0x352f69[_0x6282('0x14')][_0x6282('0x13')]);}})[_0x6282('0x15')](function(_0x544ea9){logger['error'](_0x6282('0xd'),_0x140954,_0x544ea9);_0x199c31(_0x544ea9);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 6d11b30..7153e42 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 _0x1261=['exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','/:id','show','/:id/download','isAuthenticated','download','create','put','destroy'];(function(_0x3064a3,_0x20e71a){var _0x4319b6=function(_0x2e5240){while(--_0x2e5240){_0x3064a3['push'](_0x3064a3['shift']());}};_0x4319b6(++_0x20e71a);}(_0x1261,0x144));var _0x1126=function(_0x2ad1b8,_0x1ea09b){_0x2ad1b8=_0x2ad1b8-0x0;var _0x52547d=_0x1261[_0x2ad1b8];return _0x52547d;};'use strict';var multer=require('multer');var util=require(_0x1126('0x0'));var path=require(_0x1126('0x1'));var timeout=require(_0x1126('0x2'));var express=require(_0x1126('0x3'));var router=express[_0x1126('0x4')]();var auth=require(_0x1126('0x5'));var interaction=require(_0x1126('0x6'));var config=require(_0x1126('0x7'));var controller=require(_0x1126('0x8'));router[_0x1126('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1126('0x9')](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0xb')]);router[_0x1126('0x9')](_0x1126('0xc'),auth[_0x1126('0xd')](),controller[_0x1126('0xe')]);router['post']('/',auth[_0x1126('0xd')](),controller[_0x1126('0xf')]);router[_0x1126('0x10')]('/:id',auth[_0x1126('0xd')](),controller['update']);router['delete'](_0x1126('0xa'),auth['isAuthenticated'](),controller[_0x1126('0x11')]);module[_0x1126('0x12')]=router; \ No newline at end of file +var _0x46ed=['multer','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/download','download','create','update','delete','exports'];(function(_0x26a349,_0x4ced97){var _0x1c5fd8=function(_0x3fd9f3){while(--_0x3fd9f3){_0x26a349['push'](_0x26a349['shift']());}};_0x1c5fd8(++_0x4ced97);}(_0x46ed,0x168));var _0xd46e=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0x46ed[_0x599f41];return _0x2e4d58;};'use strict';var multer=require(_0xd46e('0x0'));var util=require(_0xd46e('0x1'));var path=require('path');var timeout=require(_0xd46e('0x2'));var express=require(_0xd46e('0x3'));var router=express[_0xd46e('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0xd46e('0x5'));var config=require(_0xd46e('0x6'));var controller=require('./voiceMailMessage.controller');router[_0xd46e('0x7')]('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0x9')]);router[_0xd46e('0x7')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xb')]);router[_0xd46e('0x7')](_0xd46e('0xc'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xd')]);router['post']('/',auth[_0xd46e('0x8')](),controller[_0xd46e('0xe')]);router['put'](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller[_0xd46e('0xf')]);router[_0xd46e('0x10')](_0xd46e('0xa'),auth[_0xd46e('0x8')](),controller['destroy']);module[_0xd46e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 9de4612..3447854 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 _0x6d11=['STRING','BLOB','long','TIMESTAMP','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x50ac35,_0x2f4323){var _0x4947de=function(_0x10d02d){while(--_0x10d02d){_0x50ac35['push'](_0x50ac35['shift']());}};_0x4947de(++_0x2f4323);}(_0x6d11,0x175));var _0x16d1=function(_0x824415,_0x19f60b){_0x824415=_0x824415-0x0;var _0x5445a7=_0x6d11[_0x824415];return _0x5445a7;};'use strict';var Sequelize=require(_0x16d1('0x0'));module[_0x16d1('0x1')]={'name':{'type':Sequelize[_0x16d1('0x2')],'get':function(_0x43a777){return this[_0x16d1('0x3')]('id');}},'msgnum':{'type':Sequelize[_0x16d1('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'recording':{'type':Sequelize[_0x16d1('0x6')](_0x16d1('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0x16d1('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x16d1('0x8'),'allowNull':![]}}; \ No newline at end of file +var _0xa13e=['STRING','BLOB','long','sequelize','exports','VIRTUAL','getDataValue','INTEGER'];(function(_0x4b1ac6,_0x33c5df){var _0x5c39ab=function(_0x2b77f4){while(--_0x2b77f4){_0x4b1ac6['push'](_0x4b1ac6['shift']());}};_0x5c39ab(++_0x33c5df);}(_0xa13e,0x1e3));var _0xea13=function(_0x148d8b,_0x1e3b3b){_0x148d8b=_0x148d8b-0x0;var _0x27e191=_0xa13e[_0x148d8b];return _0x27e191;};'use strict';var Sequelize=require(_0xea13('0x0'));module[_0xea13('0x1')]={'name':{'type':Sequelize[_0xea13('0x2')],'get':function(_0x2990f6){return this[_0xea13('0x3')]('id');}},'msgnum':{'type':Sequelize[_0xea13('0x4')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'context':{'type':Sequelize['STRING'],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'callerid':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'mailboxcontext':{'type':Sequelize['STRING'],'defaultValue':''},'recording':{'type':Sequelize[_0xea13('0x6')](_0xea13('0x7')),'defaultValue':null},'flag':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xea13('0x5')],'defaultValue':''},'stamp':{'type':'TIMESTAMP','allowNull':![]}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index d3db0f2..a4750d1 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 _0x5075=['fieldName','type','model','differenceBy','query','filters','intersection','attributes','fields','order','sort','filter','where','merge','options','includeAll','include','rows','catch','show','params','keys','length','find','create','body','download','recording','msg_id','Sequelize','audio/wav','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','send','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','error','name','index','map','VoiceMailMessage','rawAttributes'];(function(_0x364c9c,_0x3c57a0){var _0x3f52a1=function(_0x5a1748){while(--_0x5a1748){_0x364c9c['push'](_0x364c9c['shift']());}};_0x3f52a1(++_0x3c57a0);}(_0x5075,0x73));var _0x5507=function(_0x3ee935,_0x293a98){_0x3ee935=_0x3ee935-0x0;var _0x586db7=_0x5075[_0x3ee935];return _0x586db7;};'use strict';var pdf=require(_0x5507('0x0'));var emlformat=require(_0x5507('0x1'));var rimraf=require(_0x5507('0x2'));var zipdir=require(_0x5507('0x3'));var jsonpatch=require(_0x5507('0x4'));var rp=require(_0x5507('0x5'));var moment=require(_0x5507('0x6'));var BPromise=require('bluebird');var Mustache=require(_0x5507('0x7'));var util=require(_0x5507('0x8'));var path=require(_0x5507('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x5507('0xa'));var fs=require('fs');var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x37a1de,_0x2a2ea0){_0x2a2ea0=_0x2a2ea0||0xcc;return function(_0x32c872){if(_0x32c872){return _0x37a1de[_0x5507('0x17')](_0x2a2ea0);}return _0x37a1de[_0x5507('0x18')](_0x2a2ea0)[_0x5507('0x19')]();};}function respondWithResult(_0x59889b,_0x9cc3f9){_0x9cc3f9=_0x9cc3f9||0xc8;return function(_0x2b7c43){if(_0x2b7c43){return _0x59889b[_0x5507('0x18')](_0x9cc3f9)[_0x5507('0x1a')](_0x2b7c43);}};}function respondWithFilteredResult(_0x4df473,_0x49e400){return function(_0x10d7b9){if(_0x10d7b9){var _0x2dfd06=_0x10d7b9[_0x5507('0x1b')],_0x1ab167=_0x49e400[_0x5507('0x1c')],_0xa6e4b3=_0x49e400[_0x5507('0x1c')]+_0x49e400[_0x5507('0x1d')],_0x2ede34;if(_0xa6e4b3>=_0x2dfd06){_0xa6e4b3=_0x2dfd06;_0x2ede34=0xc8;}else{_0x2ede34=0xce;}_0x4df473[_0x5507('0x18')](_0x2ede34);return _0x4df473[_0x5507('0x1e')](_0x5507('0x1f'),_0x1ab167+'-'+_0xa6e4b3+'/'+_0x2dfd06)['json'](_0x10d7b9);}return null;};}function patchUpdates(_0x14dab0){return function(_0x276a81){try{jsonpatch[_0x5507('0x20')](_0x276a81,_0x14dab0,!![]);}catch(_0x193eda){return BPromise['reject'](_0x193eda);}return _0x276a81[_0x5507('0x21')]();};}function saveUpdates(_0x1af06e,_0x1a54b0){return function(_0x3ca1f7){if(_0x3ca1f7){return _0x3ca1f7[_0x5507('0x22')](_0x1af06e)[_0x5507('0x23')](function(_0x501a94){return _0x501a94;});}return null;};}function removeEntity(_0x475970,_0x105535){return function(_0x1f6325){if(_0x1f6325){return _0x1f6325[_0x5507('0x24')]()[_0x5507('0x23')](function(){_0x475970[_0x5507('0x18')](0xcc)[_0x5507('0x19')]();});}};}function handleEntityNotFound(_0x10f149,_0x398911){return function(_0xa47641){if(!_0xa47641){_0x10f149[_0x5507('0x17')](0x194);}return _0xa47641;};}function handleError(_0x414e74,_0x164ac7){_0x164ac7=_0x164ac7||0x1f4;return function(_0x2ee6ed){logger[_0x5507('0x25')](_0x2ee6ed['stack']);if(_0x2ee6ed[_0x5507('0x26')]){delete _0x2ee6ed['name'];}_0x414e74[_0x5507('0x18')](_0x164ac7)['send'](_0x2ee6ed);};}exports[_0x5507('0x27')]=function(_0x24668b,_0x4beb0a){var _0x5cbb09={},_0xbe8d32={},_0x1a18d0={'count':0x0,'rows':[]};var _0x5912d4=_[_0x5507('0x28')](db[_0x5507('0x29')][_0x5507('0x2a')],function(_0x38f4d9){return{'name':_0x38f4d9[_0x5507('0x2b')],'type':_0x38f4d9[_0x5507('0x2c')]['key']};});_0xbe8d32[_0x5507('0x2d')]=_[_0x5507('0x2e')](_[_0x5507('0x28')](_0x5912d4,_0x5507('0x26')),[_0x5507('0x26')]);_0xbe8d32['query']=_['keys'](_0x24668b[_0x5507('0x2f')]);_0xbe8d32[_0x5507('0x30')]=_[_0x5507('0x31')](_0xbe8d32[_0x5507('0x2d')],_0xbe8d32['query']);_0x5cbb09[_0x5507('0x32')]=_[_0x5507('0x31')](_0xbe8d32[_0x5507('0x2d')],qs[_0x5507('0x33')](_0x24668b[_0x5507('0x2f')][_0x5507('0x33')]));_0x5cbb09[_0x5507('0x32')]=_0x5cbb09[_0x5507('0x32')]['length']?_0x5cbb09[_0x5507('0x32')]:_0xbe8d32[_0x5507('0x2d')];if(!_0x24668b[_0x5507('0x2f')]['hasOwnProperty']('nolimit')){_0x5cbb09[_0x5507('0x1d')]=qs[_0x5507('0x1d')](_0x24668b[_0x5507('0x2f')][_0x5507('0x1d')]);_0x5cbb09[_0x5507('0x1c')]=qs['offset'](_0x24668b['query'][_0x5507('0x1c')]);}_0x5cbb09[_0x5507('0x34')]=qs[_0x5507('0x35')](_0x24668b[_0x5507('0x2f')]['sort']);_0x5cbb09['where']=qs[_0x5507('0x30')](_['pick'](_0x24668b[_0x5507('0x2f')],_0xbe8d32[_0x5507('0x30')]));if(_0x24668b[_0x5507('0x2f')][_0x5507('0x36')]){_0x5cbb09[_0x5507('0x37')]=_[_0x5507('0x38')](_0x5cbb09[_0x5507('0x37')],{'$or':_[_0x5507('0x28')](_0x5912d4,function(_0x44502c){if(_0x44502c[_0x5507('0x2c')]!=='VIRTUAL'){var _0x4bddfb={};_0x4bddfb[_0x44502c['name']]={'$like':'%'+_0x24668b['query'][_0x5507('0x36')]+'%'};return _0x4bddfb;}})});}_0x5cbb09=_[_0x5507('0x38')]({},_0x5cbb09,_0x24668b[_0x5507('0x39')]);var _0x854262={'where':_0x5cbb09[_0x5507('0x37')]};return db[_0x5507('0x29')][_0x5507('0x1b')](_0x854262)[_0x5507('0x23')](function(_0xbc9f93){_0x1a18d0[_0x5507('0x1b')]=_0xbc9f93;if(_0x24668b[_0x5507('0x2f')][_0x5507('0x3a')]){_0x5cbb09[_0x5507('0x3b')]=[{'all':!![]}];}return db[_0x5507('0x29')]['findAll'](_0x5cbb09);})['then'](function(_0x50eb32){_0x1a18d0[_0x5507('0x3c')]=_0x50eb32;return _0x1a18d0;})[_0x5507('0x23')](respondWithFilteredResult(_0x4beb0a,_0x5cbb09))[_0x5507('0x3d')](handleError(_0x4beb0a,null));};exports[_0x5507('0x3e')]=function(_0xcd4df5,_0x17d7db){var _0x340c4c={'raw':!![],'where':{'id':_0xcd4df5[_0x5507('0x3f')]['id']}},_0x371136={};_0x371136[_0x5507('0x2d')]=_[_0x5507('0x40')](db[_0x5507('0x29')][_0x5507('0x2a')]);_0x371136[_0x5507('0x2f')]=_[_0x5507('0x40')](_0xcd4df5[_0x5507('0x2f')]);_0x371136[_0x5507('0x30')]=_[_0x5507('0x31')](_0x371136[_0x5507('0x2d')],_0x371136['query']);_0x340c4c[_0x5507('0x32')]=_[_0x5507('0x31')](_0x371136['model'],qs['fields'](_0xcd4df5[_0x5507('0x2f')][_0x5507('0x33')]));_0x340c4c[_0x5507('0x32')]=_0x340c4c[_0x5507('0x32')][_0x5507('0x41')]?_0x340c4c['attributes']:_0x371136[_0x5507('0x2d')];if(_0xcd4df5[_0x5507('0x2f')][_0x5507('0x3a')]){_0x340c4c['include']=[{'all':!![]}];}_0x340c4c=_[_0x5507('0x38')]({},_0x340c4c,_0xcd4df5[_0x5507('0x39')]);return db[_0x5507('0x29')][_0x5507('0x42')](_0x340c4c)[_0x5507('0x23')](handleEntityNotFound(_0x17d7db,null))['then'](respondWithResult(_0x17d7db,null))[_0x5507('0x3d')](handleError(_0x17d7db,null));};exports['create']=function(_0x36c29f,_0x3504bd){return db[_0x5507('0x29')][_0x5507('0x43')](_0x36c29f[_0x5507('0x44')],{})[_0x5507('0x23')](respondWithResult(_0x3504bd,0xc9))[_0x5507('0x3d')](handleError(_0x3504bd,null));};exports[_0x5507('0x22')]=function(_0x549cf0,_0x36aee1){if(_0x549cf0[_0x5507('0x44')]['id']){delete _0x549cf0['body']['id'];}return db['VoiceMailMessage']['find']({'where':{'id':_0x549cf0[_0x5507('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aee1,null))[_0x5507('0x23')](saveUpdates(_0x549cf0['body'],null))[_0x5507('0x23')](respondWithResult(_0x36aee1,null))['catch'](handleError(_0x36aee1,null));};exports['destroy']=function(_0x3b98ae,_0x350c7e){return db[_0x5507('0x29')][_0x5507('0x42')]({'where':{'id':_0x3b98ae[_0x5507('0x3f')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x350c7e,null))['then'](removeEntity(_0x350c7e,null))[_0x5507('0x3d')](handleError(_0x350c7e,null));};exports[_0x5507('0x45')]=function(_0x2f795c,_0x4b5722,_0x1ec672){return db[_0x5507('0x29')][_0x5507('0x42')]({'where':{'id':_0x2f795c[_0x5507('0x3f')]['id']},'attributes':['id',_0x5507('0x46'),_0x5507('0x47')]})[_0x5507('0x23')](handleEntityNotFound(_0x4b5722,null))[_0x5507('0x23')](function(_0x4674f9){if(_0x4674f9){if(!_0x4674f9[_0x5507('0x46')]){throw new db[(_0x5507('0x48'))]['ValidationError']('VoiceMailMessage\x20not\x20found');}var _0x1992fa={'Content-Type':_0x5507('0x49'),'Content-Disposition':_0x5507('0x4a')};if(_0x4674f9[_0x5507('0x47')]){_0x1992fa[_0x5507('0x4b')]=_0x5507('0x4c')+_0x4674f9[_0x5507('0x47')]+_0x5507('0x4d');}_0x4b5722[_0x5507('0x1e')](_0x1992fa);return _0x4b5722[_0x5507('0x4e')](new Buffer(_0x4674f9[_0x5507('0x46')]));}})[_0x5507('0x3d')](handleError(_0x4b5722,null));}; \ No newline at end of file +var _0x8958=['to-csv','ejs','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','status','end','count','offset','limit','set','Content-Range','json','apply','update','then','error','name','map','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','sort','where','filters','pick','filter','merge','options','VoiceMailMessage','includeAll','include','findAll','rows','catch','rawAttributes','find','create','body','params','download','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','audio/wav','attachment','msg_id','Content-Disposition','attachment;\x20filename=\x22','send','eml-format','moment','mustache','util','path'];(function(_0xcc8e3e,_0x2f7ddb){var _0x5edf94=function(_0x494554){while(--_0x494554){_0xcc8e3e['push'](_0xcc8e3e['shift']());}};_0x5edf94(++_0x2f7ddb);}(_0x8958,0x93));var _0x8895=function(_0x3cb731,_0x207931){_0x3cb731=_0x3cb731-0x0;var _0x5566e9=_0x8958[_0x3cb731];return _0x5566e9;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x8895('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x8895('0x1'));var BPromise=require('bluebird');var Mustache=require(_0x8895('0x2'));var util=require(_0x8895('0x3'));var path=require(_0x8895('0x4'));var sox=require('sox');var csv=require(_0x8895('0x5'));var ejs=require(_0x8895('0x6'));var fs=require('fs');var _=require(_0x8895('0x7'));var squel=require(_0x8895('0x8'));var crypto=require(_0x8895('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x8895('0xa'));var toCsv=require(_0x8895('0x5'));var querystring=require(_0x8895('0xb'));var Papa=require(_0x8895('0xc'));var Redis=require(_0x8895('0xd'));var authService=require(_0x8895('0xe'));var qs=require(_0x8895('0xf'));var as=require(_0x8895('0x10'));var hardwareService=require(_0x8895('0x11'));var logger=require(_0x8895('0x12'))('api');var utils=require(_0x8895('0x13'));var config=require(_0x8895('0x14'));var db=require(_0x8895('0x15'))['db'];function respondWithStatusCode(_0x301bec,_0x446e1a){_0x446e1a=_0x446e1a||0xcc;return function(_0xaf93bc){if(_0xaf93bc){return _0x301bec['sendStatus'](_0x446e1a);}return _0x301bec[_0x8895('0x16')](_0x446e1a)[_0x8895('0x17')]();};}function respondWithResult(_0x56c18e,_0x57d40a){_0x57d40a=_0x57d40a||0xc8;return function(_0x47b9fe){if(_0x47b9fe){return _0x56c18e[_0x8895('0x16')](_0x57d40a)['json'](_0x47b9fe);}};}function respondWithFilteredResult(_0x4156f5,_0x337101){return function(_0x195789){if(_0x195789){var _0x3d7b59=_0x195789[_0x8895('0x18')],_0x2c9d40=_0x337101[_0x8895('0x19')],_0x5b4c2e=_0x337101[_0x8895('0x19')]+_0x337101[_0x8895('0x1a')],_0x4128e2;if(_0x5b4c2e>=_0x3d7b59){_0x5b4c2e=_0x3d7b59;_0x4128e2=0xc8;}else{_0x4128e2=0xce;}_0x4156f5[_0x8895('0x16')](_0x4128e2);return _0x4156f5[_0x8895('0x1b')](_0x8895('0x1c'),_0x2c9d40+'-'+_0x5b4c2e+'/'+_0x3d7b59)[_0x8895('0x1d')](_0x195789);}return null;};}function patchUpdates(_0x2da618){return function(_0x24fef0){try{jsonpatch[_0x8895('0x1e')](_0x24fef0,_0x2da618,!![]);}catch(_0x2df795){return BPromise['reject'](_0x2df795);}return _0x24fef0['save']();};}function saveUpdates(_0x4fcbc3,_0x3daf43){return function(_0x456282){if(_0x456282){return _0x456282[_0x8895('0x1f')](_0x4fcbc3)[_0x8895('0x20')](function(_0x3f7d5a){return _0x3f7d5a;});}return null;};}function removeEntity(_0x35bda5,_0x461346){return function(_0xc1ce17){if(_0xc1ce17){return _0xc1ce17['destroy']()[_0x8895('0x20')](function(){_0x35bda5[_0x8895('0x16')](0xcc)[_0x8895('0x17')]();});}};}function handleEntityNotFound(_0x1f71f3,_0x29223d){return function(_0x4d092d){if(!_0x4d092d){_0x1f71f3['sendStatus'](0x194);}return _0x4d092d;};}function handleError(_0x278c81,_0x398382){_0x398382=_0x398382||0x1f4;return function(_0x38f7ad){logger[_0x8895('0x21')](_0x38f7ad['stack']);if(_0x38f7ad[_0x8895('0x22')]){delete _0x38f7ad[_0x8895('0x22')];}_0x278c81[_0x8895('0x16')](_0x398382)['send'](_0x38f7ad);};}exports['index']=function(_0x78b57,_0x555e60){var _0x3d51b0={},_0x3e3b48={},_0x10b48f={'count':0x0,'rows':[]};var _0xf5fb66=_[_0x8895('0x23')](db['VoiceMailMessage']['rawAttributes'],function(_0x6e449d){return{'name':_0x6e449d[_0x8895('0x24')],'type':_0x6e449d[_0x8895('0x25')][_0x8895('0x26')]};});_0x3e3b48[_0x8895('0x27')]=_['differenceBy'](_['map'](_0xf5fb66,_0x8895('0x22')),[_0x8895('0x22')]);_0x3e3b48[_0x8895('0x28')]=_[_0x8895('0x29')](_0x78b57[_0x8895('0x28')]);_0x3e3b48['filters']=_[_0x8895('0x2a')](_0x3e3b48['model'],_0x3e3b48[_0x8895('0x28')]);_0x3d51b0['attributes']=_[_0x8895('0x2a')](_0x3e3b48[_0x8895('0x27')],qs[_0x8895('0x2b')](_0x78b57[_0x8895('0x28')][_0x8895('0x2b')]));_0x3d51b0['attributes']=_0x3d51b0[_0x8895('0x2c')][_0x8895('0x2d')]?_0x3d51b0[_0x8895('0x2c')]:_0x3e3b48[_0x8895('0x27')];if(!_0x78b57[_0x8895('0x28')]['hasOwnProperty'](_0x8895('0x2e'))){_0x3d51b0['limit']=qs[_0x8895('0x1a')](_0x78b57['query'][_0x8895('0x1a')]);_0x3d51b0[_0x8895('0x19')]=qs[_0x8895('0x19')](_0x78b57[_0x8895('0x28')][_0x8895('0x19')]);}_0x3d51b0['order']=qs[_0x8895('0x2f')](_0x78b57['query'][_0x8895('0x2f')]);_0x3d51b0[_0x8895('0x30')]=qs[_0x8895('0x31')](_[_0x8895('0x32')](_0x78b57[_0x8895('0x28')],_0x3e3b48[_0x8895('0x31')]));if(_0x78b57['query'][_0x8895('0x33')]){_0x3d51b0[_0x8895('0x30')]=_['merge'](_0x3d51b0[_0x8895('0x30')],{'$or':_['map'](_0xf5fb66,function(_0x134d5c){if(_0x134d5c[_0x8895('0x25')]!=='VIRTUAL'){var _0xa01540={};_0xa01540[_0x134d5c[_0x8895('0x22')]]={'$like':'%'+_0x78b57['query']['filter']+'%'};return _0xa01540;}})});}_0x3d51b0=_[_0x8895('0x34')]({},_0x3d51b0,_0x78b57[_0x8895('0x35')]);var _0x55aacc={'where':_0x3d51b0[_0x8895('0x30')]};return db[_0x8895('0x36')]['count'](_0x55aacc)[_0x8895('0x20')](function(_0x25c854){_0x10b48f[_0x8895('0x18')]=_0x25c854;if(_0x78b57[_0x8895('0x28')][_0x8895('0x37')]){_0x3d51b0[_0x8895('0x38')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x8895('0x39')](_0x3d51b0);})['then'](function(_0x20a521){_0x10b48f[_0x8895('0x3a')]=_0x20a521;return _0x10b48f;})['then'](respondWithFilteredResult(_0x555e60,_0x3d51b0))[_0x8895('0x3b')](handleError(_0x555e60,null));};exports['show']=function(_0x1e6395,_0x5e6413){var _0x4af3b1={'raw':!![],'where':{'id':_0x1e6395['params']['id']}},_0x51277b={};_0x51277b['model']=_['keys'](db[_0x8895('0x36')][_0x8895('0x3c')]);_0x51277b['query']=_['keys'](_0x1e6395[_0x8895('0x28')]);_0x51277b[_0x8895('0x31')]=_['intersection'](_0x51277b[_0x8895('0x27')],_0x51277b[_0x8895('0x28')]);_0x4af3b1[_0x8895('0x2c')]=_[_0x8895('0x2a')](_0x51277b[_0x8895('0x27')],qs['fields'](_0x1e6395['query']['fields']));_0x4af3b1[_0x8895('0x2c')]=_0x4af3b1['attributes'][_0x8895('0x2d')]?_0x4af3b1[_0x8895('0x2c')]:_0x51277b[_0x8895('0x27')];if(_0x1e6395[_0x8895('0x28')]['includeAll']){_0x4af3b1[_0x8895('0x38')]=[{'all':!![]}];}_0x4af3b1=_[_0x8895('0x34')]({},_0x4af3b1,_0x1e6395[_0x8895('0x35')]);return db[_0x8895('0x36')][_0x8895('0x3d')](_0x4af3b1)[_0x8895('0x20')](handleEntityNotFound(_0x5e6413,null))[_0x8895('0x20')](respondWithResult(_0x5e6413,null))[_0x8895('0x3b')](handleError(_0x5e6413,null));};exports['create']=function(_0x4740df,_0x3bf0e3){return db['VoiceMailMessage'][_0x8895('0x3e')](_0x4740df['body'],{})['then'](respondWithResult(_0x3bf0e3,0xc9))[_0x8895('0x3b')](handleError(_0x3bf0e3,null));};exports[_0x8895('0x1f')]=function(_0x130018,_0x53c4a2){if(_0x130018[_0x8895('0x3f')]['id']){delete _0x130018['body']['id'];}return db[_0x8895('0x36')][_0x8895('0x3d')]({'where':{'id':_0x130018[_0x8895('0x40')]['id']}})[_0x8895('0x20')](handleEntityNotFound(_0x53c4a2,null))[_0x8895('0x20')](saveUpdates(_0x130018[_0x8895('0x3f')],null))[_0x8895('0x20')](respondWithResult(_0x53c4a2,null))['catch'](handleError(_0x53c4a2,null));};exports['destroy']=function(_0x2a933c,_0x113c8c){return db['VoiceMailMessage'][_0x8895('0x3d')]({'where':{'id':_0x2a933c['params']['id']}})['then'](handleEntityNotFound(_0x113c8c,null))[_0x8895('0x20')](removeEntity(_0x113c8c,null))['catch'](handleError(_0x113c8c,null));};exports[_0x8895('0x41')]=function(_0x2c2979,_0x43aada,_0x459e1a){return db[_0x8895('0x36')][_0x8895('0x3d')]({'where':{'id':_0x2c2979[_0x8895('0x40')]['id']},'attributes':['id',_0x8895('0x42'),'msg_id']})[_0x8895('0x20')](handleEntityNotFound(_0x43aada,null))[_0x8895('0x20')](function(_0x2f81f7){if(_0x2f81f7){if(!_0x2f81f7['recording']){throw new db[(_0x8895('0x43'))][(_0x8895('0x44'))](_0x8895('0x45'));}var _0x14e769={'Content-Type':_0x8895('0x46'),'Content-Disposition':_0x8895('0x47')};if(_0x2f81f7[_0x8895('0x48')]){_0x14e769[_0x8895('0x49')]=_0x8895('0x4a')+_0x2f81f7[_0x8895('0x48')]+'.wav\x22';}_0x43aada[_0x8895('0x1b')](_0x14e769);return _0x43aada[_0x8895('0x4b')](new Buffer(_0x2f81f7[_0x8895('0x42')]));}})[_0x8895('0x3b')](handleError(_0x43aada,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index 1029dd2..9de99b7 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 _0x0e9d=['request-promise','rimraf','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','util','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e9d,0xbb));var _0xd0e9=function(_0x413213,_0x38efbd){_0x413213=_0x413213-0x0;var _0x1c844d=_0x0e9d[_0x413213];return _0x1c844d;};'use strict';var _=require('lodash');var util=require(_0xd0e9('0x0'));var logger=require(_0xd0e9('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd0e9('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd0e9('0x3'));var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0xd0e9('0x4')]=function(_0x21aff5,_0x1b0584){return _0x21aff5[_0xd0e9('0x5')](_0xd0e9('0x6'),attributes,{'tableName':_0xd0e9('0x7'),'paranoid':![],'indexes':[{'name':_0xd0e9('0x8'),'fields':[_0xd0e9('0x8')]}],'timestamps':![]});}; \ No newline at end of file +var _0x41c2=['util','bluebird','request-promise','path','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','dir'];(function(_0x3cf1d8,_0x1a60c5){var _0x4ace84=function(_0x2417e7){while(--_0x2417e7){_0x3cf1d8['push'](_0x3cf1d8['shift']());}};_0x4ace84(++_0x1a60c5);}(_0x41c2,0x1a7));var _0x241c=function(_0x145973,_0x23a7ce){_0x145973=_0x145973-0x0;var _0x7141ce=_0x41c2[_0x145973];return _0x7141ce;};'use strict';var _=require('lodash');var util=require(_0x241c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x241c('0x1'));var rp=require(_0x241c('0x2'));var fs=require('fs');var path=require(_0x241c('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x241c('0x4'));module[_0x241c('0x5')]=function(_0x4ae826,_0x12d0e7){return _0x4ae826[_0x241c('0x6')](_0x241c('0x7'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':[_0x241c('0x8')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 2aa16de..d784a45 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 _0x1a85=['../../config/logger','rpc','jayson/promise','http','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','../../config/utils'];(function(_0x64460d,_0x557fd6){var _0x4f60cf=function(_0x23f878){while(--_0x23f878){_0x64460d['push'](_0x64460d['shift']());}};_0x4f60cf(++_0x557fd6);}(_0x1a85,0x178));var _0x51a8=function(_0x3ae8f4,_0x2920f4){_0x3ae8f4=_0x3ae8f4-0x0;var _0x367312=_0x1a85[_0x3ae8f4];return _0x367312;};'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')]('VoiceMailMessage,\x20%s,\x20%s',_0x331117,_0x3e0603);_0x228c64(_0x3e0603);});});} \ No newline at end of file +var _0x4975=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','randomstring'];(function(_0x6cf19c,_0x2f3f02){var _0xce14f3=function(_0x474587){while(--_0x474587){_0x6cf19c['push'](_0x6cf19c['shift']());}};_0xce14f3(++_0x2f3f02);}(_0x4975,0x86));var _0x5497=function(_0x4a9e7f,_0x1f4fd2){_0x4a9e7f=_0x4a9e7f-0x0;var _0xc8e66e=_0x4975[_0x4a9e7f];return _0xc8e66e;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var moment=require(_0x5497('0x1'));var BPromise=require(_0x5497('0x2'));var rs=require(_0x5497('0x3'));var fs=require('fs');var Redis=require(_0x5497('0x4'));var db=require(_0x5497('0x5'))['db'];var utils=require(_0x5497('0x6'));var logger=require(_0x5497('0x7'))(_0x5497('0x8'));var config=require(_0x5497('0x9'));var jayson=require(_0x5497('0xa'));var client=jayson['client'][_0x5497('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f563d,_0x1d0019,_0x674a2a){return new BPromise(function(_0x368e8b,_0x57f930){return client[_0x5497('0xc')](_0x4f563d,_0x674a2a)['then'](function(_0x1f63d8){logger[_0x5497('0xd')](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));logger[_0x5497('0x10')](_0x5497('0x11'),_0x1d0019,_0x5497('0xf'),JSON[_0x5497('0x12')](_0x1f63d8));if(_0x1f63d8['error']){if(_0x1f63d8['error']['code']===0x1f4){logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x57f930(_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);}logger[_0x5497('0x13')](_0x5497('0xe'),_0x1d0019,_0x1f63d8[_0x5497('0x13')][_0x5497('0x14')]);return _0x368e8b(_0x1f63d8['error'][_0x5497('0x14')]);}else{logger['info'](_0x5497('0xe'),_0x1d0019,_0x5497('0xf'));_0x368e8b(_0x1f63d8[_0x5497('0x15')][_0x5497('0x14')]);}})[_0x5497('0x16')](function(_0x4073e6){logger[_0x5497('0x13')]('VoiceMailMessage,\x20%s,\x20%s',_0x1d0019,_0x4073e6);_0x57f930(_0x4073e6);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 3d06bcf..3082381 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 _0x7b36=['addSound','destroy','delete','removeSound','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','index','get','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create'];(function(_0x56fd03,_0x1723c8){var _0x38a694=function(_0x380d97){while(--_0x380d97){_0x56fd03['push'](_0x56fd03['shift']());}};_0x38a694(++_0x1723c8);}(_0x7b36,0x9e));var _0x67b3=function(_0x1d1fc0,_0x11a809){_0x1d1fc0=_0x1d1fc0-0x0;var _0x62d605=_0x7b36[_0x1d1fc0];return _0x62d605;};'use strict';var multer=require(_0x67b3('0x0'));var util=require('util');var path=require(_0x67b3('0x1'));var timeout=require(_0x67b3('0x2'));var express=require(_0x67b3('0x3'));var router=express[_0x67b3('0x4')]();var auth=require(_0x67b3('0x5'));var interaction=require(_0x67b3('0x6'));var config=require(_0x67b3('0x7'));var controller=require(_0x67b3('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x67b3('0x9')]);router[_0x67b3('0xa')](_0x67b3('0xb'),auth[_0x67b3('0xc')](),controller[_0x67b3('0xd')]);router['get'](_0x67b3('0xe'),auth[_0x67b3('0xc')](),controller[_0x67b3('0xf')]);router[_0x67b3('0x10')]('/',auth[_0x67b3('0xc')](),controller[_0x67b3('0x11')]);router[_0x67b3('0x10')](_0x67b3('0xe'),auth[_0x67b3('0xc')](),controller[_0x67b3('0x12')]);router['put'](_0x67b3('0xb'),auth[_0x67b3('0xc')](),controller['update']);router['delete'](_0x67b3('0xb'),auth['isAuthenticated'](),controller[_0x67b3('0x13')]);router[_0x67b3('0x14')]('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x67b3('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe978=['isAuthenticated','index','/:id','/:id/sounds','getSounds','post','create','put','update','destroy','removeSound','exports','multer','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get'];(function(_0x18c292,_0xb66e7d){var _0x495418=function(_0x3a26f8){while(--_0x3a26f8){_0x18c292['push'](_0x18c292['shift']());}};_0x495418(++_0xb66e7d);}(_0xe978,0xfc));var _0x8e97=function(_0xee2962,_0x30b614){_0xee2962=_0xee2962-0x0;var _0x115838=_0xe978[_0xee2962];return _0x115838;};'use strict';var multer=require(_0x8e97('0x0'));var util=require(_0x8e97('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8e97('0x2'));var router=express[_0x8e97('0x3')]();var auth=require(_0x8e97('0x4'));var interaction=require(_0x8e97('0x5'));var config=require(_0x8e97('0x6'));var controller=require('./voiceMusicOnHold.controller');router[_0x8e97('0x7')]('/',auth[_0x8e97('0x8')](),controller[_0x8e97('0x9')]);router['get'](_0x8e97('0xa'),auth[_0x8e97('0x8')](),controller['show']);router[_0x8e97('0x7')](_0x8e97('0xb'),auth[_0x8e97('0x8')](),controller[_0x8e97('0xc')]);router[_0x8e97('0xd')]('/',auth['isAuthenticated'](),controller[_0x8e97('0xe')]);router['post'](_0x8e97('0xb'),auth[_0x8e97('0x8')](),controller['addSound']);router[_0x8e97('0xf')](_0x8e97('0xa'),auth[_0x8e97('0x8')](),controller[_0x8e97('0x10')]);router['delete'](_0x8e97('0xa'),auth[_0x8e97('0x8')](),controller[_0x8e97('0x11')]);router['delete']('/:id/sounds/:id2',auth['isAuthenticated'](),controller[_0x8e97('0x12')]);module[_0x8e97('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 4181e09..3e34115 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 _0xa286=['quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name','ENUM','files','mp3nb','quietmp3nb'];(function(_0x5ed65f,_0x23d121){var _0x1f43ae=function(_0x3b7368){while(--_0x3b7368){_0x5ed65f['push'](_0x5ed65f['shift']());}};_0x1f43ae(++_0x23d121);}(_0xa286,0x161));var _0x6a28=function(_0x53abe5,_0x33a9e5){_0x53abe5=_0x53abe5-0x0;var _0xc1c37e=_0xa286[_0x53abe5];return _0xc1c37e;};'use strict';var Sequelize=require(_0x6a28('0x0'));module['exports']={'name':{'type':Sequelize[_0x6a28('0x1')],'allowNull':![],'unique':_0x6a28('0x2')},'mode':{'type':Sequelize[_0x6a28('0x3')]('custom',_0x6a28('0x4'),_0x6a28('0x5'),_0x6a28('0x6'),_0x6a28('0x7'),_0x6a28('0x8')),'allowNull':!![],'defaultValue':_0x6a28('0x4')},'directory':{'type':Sequelize[_0x6a28('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0x6a28('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0x6a28('0x1')],'allowNull':!![],'defaultValue':_0x6a28('0x9')},'format':{'type':Sequelize[_0x6a28('0x1')],'allowNull':!![]},'stamp':{'type':_0x6a28('0xa')},'defaultEntry':{'type':Sequelize[_0x6a28('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0xecbe=['name','custom','mp3nb','quietmp3nb','mp3','TIMESTAMP','BOOLEAN','sequelize','exports','STRING'];(function(_0x5d92c2,_0x26d815){var _0x415601=function(_0x507e8f){while(--_0x507e8f){_0x5d92c2['push'](_0x5d92c2['shift']());}};_0x415601(++_0x26d815);}(_0xecbe,0x1a1));var _0xeecb=function(_0x571714,_0x30d2b3){_0x571714=_0x571714-0x0;var _0x599a14=_0xecbe[_0x571714];return _0x599a14;};'use strict';var Sequelize=require(_0xeecb('0x0'));module[_0xeecb('0x1')]={'name':{'type':Sequelize[_0xeecb('0x2')],'allowNull':![],'unique':_0xeecb('0x3')},'mode':{'type':Sequelize['ENUM'](_0xeecb('0x4'),'files',_0xeecb('0x5'),_0xeecb('0x6'),'quietmp3',_0xeecb('0x7')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xeecb('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0xeecb('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xeecb('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xeecb('0x2')],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0xeecb('0x2')],'allowNull':!![]},'stamp':{'type':_0xeecb('0x8')},'defaultEntry':{'type':Sequelize[_0xeecb('0x9')],'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 fce8dd1..71ac5c9 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 _0x08cb=['rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','body','find','create','mode','files','directory','root','server/files/moh','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','sequelize','transaction','readdirSync','unlinkSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','createdAt','join','server/files/sounds/converted','format','%s.%s','basename','extname','converted_format','symlinkSync','removeSound','id2','getSounds','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','count','offset','limit','set','apply','reject','save','update','then','destroy','get','MusicOnHolds','UserProfileResource','sendStatus','error','name','send','map','VoiceMusicOnHold'];(function(_0x427001,_0x549755){var _0x406095=function(_0x32022b){while(--_0x32022b){_0x427001['push'](_0x427001['shift']());}};_0x406095(++_0x549755);}(_0x08cb,0x18f));var _0xb08c=function(_0x1f7772,_0xcb0069){_0x1f7772=_0x1f7772-0x0;var _0x151c54=_0x08cb[_0x1f7772];return _0x151c54;};'use strict';var pdf=require(_0xb08c('0x0'));var emlformat=require(_0xb08c('0x1'));var rimraf=require(_0xb08c('0x2'));var zipdir=require(_0xb08c('0x3'));var jsonpatch=require(_0xb08c('0x4'));var rp=require(_0xb08c('0x5'));var moment=require(_0xb08c('0x6'));var BPromise=require('bluebird');var Mustache=require(_0xb08c('0x7'));var util=require(_0xb08c('0x8'));var path=require(_0xb08c('0x9'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xb08c('0xa'));var fs=require('fs');var _=require('lodash');var squel=require(_0xb08c('0xb'));var crypto=require('crypto');var jsforce=require(_0xb08c('0xc'));var deskjs=require(_0xb08c('0xd'));var toCsv=require('to-csv');var querystring=require(_0xb08c('0xe'));var Papa=require(_0xb08c('0xf'));var Redis=require(_0xb08c('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb08c('0x11'));var logger=require(_0xb08c('0x12'))(_0xb08c('0x13'));var utils=require(_0xb08c('0x14'));var config=require(_0xb08c('0x15'));var db=require(_0xb08c('0x16'))['db'];function respondWithStatusCode(_0x1d4457,_0x1feebf){_0x1feebf=_0x1feebf||0xcc;return function(_0x2e7bb4){if(_0x2e7bb4){return _0x1d4457['sendStatus'](_0x1feebf);}return _0x1d4457[_0xb08c('0x17')](_0x1feebf)[_0xb08c('0x18')]();};}function respondWithResult(_0xbf70f9,_0x216f2c){_0x216f2c=_0x216f2c||0xc8;return function(_0x4fa134){if(_0x4fa134){return _0xbf70f9[_0xb08c('0x17')](_0x216f2c)[_0xb08c('0x19')](_0x4fa134);}};}function respondWithFilteredResult(_0x36184c,_0x354768){return function(_0x3ae9e4){if(_0x3ae9e4){var _0x5b4ba3=_0x3ae9e4[_0xb08c('0x1a')],_0x2d3277=_0x354768[_0xb08c('0x1b')],_0x47afef=_0x354768[_0xb08c('0x1b')]+_0x354768[_0xb08c('0x1c')],_0x1d5b4c;if(_0x47afef>=_0x5b4ba3){_0x47afef=_0x5b4ba3;_0x1d5b4c=0xc8;}else{_0x1d5b4c=0xce;}_0x36184c[_0xb08c('0x17')](_0x1d5b4c);return _0x36184c[_0xb08c('0x1d')]('Content-Range',_0x2d3277+'-'+_0x47afef+'/'+_0x5b4ba3)['json'](_0x3ae9e4);}return null;};}function patchUpdates(_0x34455d){return function(_0xc0b815){try{jsonpatch[_0xb08c('0x1e')](_0xc0b815,_0x34455d,!![]);}catch(_0x4da208){return BPromise[_0xb08c('0x1f')](_0x4da208);}return _0xc0b815[_0xb08c('0x20')]();};}function saveUpdates(_0x330377,_0x1e728b){return function(_0x11a322){if(_0x11a322){return _0x11a322[_0xb08c('0x21')](_0x330377)[_0xb08c('0x22')](function(_0x44b2d2){return _0x44b2d2;});}return null;};}function removeEntity(_0x26e44b,_0x450dc9){return function(_0x4529f5){if(_0x4529f5){return _0x4529f5[_0xb08c('0x23')]()[_0xb08c('0x22')](function(){var _0x108132=_0x4529f5[_0xb08c('0x24')]({'plain':!![]});var _0xe44a38=_0xb08c('0x25');return db[_0xb08c('0x26')][_0xb08c('0x23')]({'where':{'type':_0xe44a38,'resourceId':_0x108132['id']}})[_0xb08c('0x22')](function(){return _0x4529f5;});})[_0xb08c('0x22')](function(){_0x26e44b[_0xb08c('0x17')](0xcc)[_0xb08c('0x18')]();});}};}function handleEntityNotFound(_0x1d8841,_0x4be5b3){return function(_0x297c0a){if(!_0x297c0a){_0x1d8841[_0xb08c('0x27')](0x194);}return _0x297c0a;};}function handleError(_0x52ff06,_0x2b2b90){_0x2b2b90=_0x2b2b90||0x1f4;return function(_0x3a1e37){logger[_0xb08c('0x28')](_0x3a1e37['stack']);if(_0x3a1e37[_0xb08c('0x29')]){delete _0x3a1e37[_0xb08c('0x29')];}_0x52ff06[_0xb08c('0x17')](_0x2b2b90)[_0xb08c('0x2a')](_0x3a1e37);};}exports['index']=function(_0x19e6e6,_0x37d638){var _0x272e84={},_0x1a075f={},_0x4c54a8={'count':0x0,'rows':[]};var _0x2c501d=_[_0xb08c('0x2b')](db[_0xb08c('0x2c')][_0xb08c('0x2d')],function(_0x276a42){return{'name':_0x276a42[_0xb08c('0x2e')],'type':_0x276a42[_0xb08c('0x2f')][_0xb08c('0x30')]};});_0x1a075f[_0xb08c('0x31')]=_[_0xb08c('0x2b')](_0x2c501d,_0xb08c('0x29'));_0x1a075f[_0xb08c('0x32')]=_[_0xb08c('0x33')](_0x19e6e6[_0xb08c('0x32')]);_0x1a075f[_0xb08c('0x34')]=_[_0xb08c('0x35')](_0x1a075f[_0xb08c('0x31')],_0x1a075f[_0xb08c('0x32')]);_0x272e84[_0xb08c('0x36')]=_[_0xb08c('0x35')](_0x1a075f[_0xb08c('0x31')],qs[_0xb08c('0x37')](_0x19e6e6[_0xb08c('0x32')]['fields']));_0x272e84[_0xb08c('0x36')]=_0x272e84[_0xb08c('0x36')][_0xb08c('0x38')]?_0x272e84['attributes']:_0x1a075f[_0xb08c('0x31')];if(!_0x19e6e6[_0xb08c('0x32')][_0xb08c('0x39')](_0xb08c('0x3a'))){_0x272e84['limit']=qs[_0xb08c('0x1c')](_0x19e6e6[_0xb08c('0x32')][_0xb08c('0x1c')]);_0x272e84[_0xb08c('0x1b')]=qs[_0xb08c('0x1b')](_0x19e6e6['query'][_0xb08c('0x1b')]);}_0x272e84[_0xb08c('0x3b')]=qs[_0xb08c('0x3c')](_0x19e6e6[_0xb08c('0x32')]['sort']);_0x272e84[_0xb08c('0x3d')]=qs[_0xb08c('0x34')](_[_0xb08c('0x3e')](_0x19e6e6[_0xb08c('0x32')],_0x1a075f[_0xb08c('0x34')]));if(_0x19e6e6['query'][_0xb08c('0x3f')]){_0x272e84[_0xb08c('0x3d')]=_[_0xb08c('0x40')](_0x272e84['where'],{'$or':_['map'](_0x2c501d,function(_0x5852ea){if(_0x5852ea[_0xb08c('0x2f')]!=='VIRTUAL'){var _0x40f72d={};_0x40f72d[_0x5852ea[_0xb08c('0x29')]]={'$like':'%'+_0x19e6e6[_0xb08c('0x32')]['filter']+'%'};return _0x40f72d;}})});}_0x272e84=_['merge']({},_0x272e84,_0x19e6e6[_0xb08c('0x41')]);var _0x2c9cfc={'where':_0x272e84['where']};return db[_0xb08c('0x2c')][_0xb08c('0x1a')](_0x2c9cfc)[_0xb08c('0x22')](function(_0x439ccb){_0x4c54a8[_0xb08c('0x1a')]=_0x439ccb;if(_0x19e6e6['query'][_0xb08c('0x42')]){_0x272e84[_0xb08c('0x43')]=[{'all':!![]}];}return db[_0xb08c('0x2c')][_0xb08c('0x44')](_0x272e84);})[_0xb08c('0x22')](function(_0x321f97){_0x4c54a8['rows']=_0x321f97;return _0x4c54a8;})[_0xb08c('0x22')](respondWithFilteredResult(_0x37d638,_0x272e84))[_0xb08c('0x45')](handleError(_0x37d638,null));};exports[_0xb08c('0x46')]=function(_0x285e46,_0x52c944){var _0x56bfd8={'raw':![],'where':{'id':_0x285e46[_0xb08c('0x47')]['id']}},_0x4eb6a1={};_0x4eb6a1[_0xb08c('0x31')]=_['keys'](db[_0xb08c('0x2c')][_0xb08c('0x2d')]);_0x4eb6a1['query']=_['keys'](_0x285e46['query']);_0x4eb6a1[_0xb08c('0x34')]=_[_0xb08c('0x35')](_0x4eb6a1[_0xb08c('0x31')],_0x4eb6a1['query']);_0x56bfd8[_0xb08c('0x36')]=_[_0xb08c('0x35')](_0x4eb6a1[_0xb08c('0x31')],qs[_0xb08c('0x37')](_0x285e46['query'][_0xb08c('0x37')]));_0x56bfd8[_0xb08c('0x36')]=_0x56bfd8[_0xb08c('0x36')][_0xb08c('0x38')]?_0x56bfd8[_0xb08c('0x36')]:_0x4eb6a1[_0xb08c('0x31')];if(_0x285e46[_0xb08c('0x32')][_0xb08c('0x42')]){_0x56bfd8['include']=[{'all':!![]}];}_0x56bfd8=_[_0xb08c('0x40')]({},_0x56bfd8,_0x285e46[_0xb08c('0x41')]);return db[_0xb08c('0x2c')]['find'](_0x56bfd8)[_0xb08c('0x22')](handleEntityNotFound(_0x52c944,null))[_0xb08c('0x22')](respondWithResult(_0x52c944,null))[_0xb08c('0x45')](handleError(_0x52c944,null));};exports[_0xb08c('0x21')]=function(_0x249133,_0x1e2c74){if(_0x249133[_0xb08c('0x48')]['id']){delete _0x249133['body']['id'];}return db['VoiceMusicOnHold'][_0xb08c('0x49')]({'where':{'id':_0x249133[_0xb08c('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e2c74,null))[_0xb08c('0x22')](saveUpdates(_0x249133[_0xb08c('0x48')],null))[_0xb08c('0x22')](respondWithResult(_0x1e2c74,null))[_0xb08c('0x45')](handleError(_0x1e2c74,null));};exports[_0xb08c('0x4a')]=function(_0x2cd21d,_0x483610,_0x19b28d){return db['sequelize']['transaction'](function(_0x2232e4){if(_0x2cd21d[_0xb08c('0x48')][_0xb08c('0x4b')]===_0xb08c('0x4c')){_0x2cd21d[_0xb08c('0x48')][_0xb08c('0x4d')]=path['join'](config[_0xb08c('0x4e')],_0xb08c('0x4f'),_0x2cd21d['body'][_0xb08c('0x29')]);}return db[_0xb08c('0x2c')][_0xb08c('0x4a')](_0x2cd21d[_0xb08c('0x48')],{'transaction':_0x2232e4})[_0xb08c('0x22')](function(_0x1041fa){if(_0x2cd21d[_0xb08c('0x48')][_0xb08c('0x4b')]===_0xb08c('0x4c')){fs[_0xb08c('0x50')](_0x1041fa[_0xb08c('0x4d')],parseInt(_0xb08c('0x51'),0x8));}var _0x48c437=_0x2cd21d[_0xb08c('0x52')][_0xb08c('0x24')]({'plain':!![]});if(!_0x48c437)throw new Error(_0xb08c('0x53'));if(_0x48c437['role']===_0xb08c('0x52')){var _0xfde97b=_0x1041fa['get']({'plain':!![]});return db[_0xb08c('0x54')][_0xb08c('0x49')]({'where':{'name':_0xb08c('0x25'),'userProfileId':_0x48c437[_0xb08c('0x55')]},'raw':!![]})['then'](function(_0x265ef5){if(_0x265ef5&&_0x265ef5[_0xb08c('0x56')]===0x0){return db[_0xb08c('0x26')][_0xb08c('0x4a')]({'name':_0xfde97b['name'],'resourceId':_0xfde97b['id'],'type':_0x265ef5[_0xb08c('0x29')],'sectionId':_0x265ef5['id']},{})[_0xb08c('0x22')](function(){return _0x1041fa;});}else{return _0x1041fa;}})[_0xb08c('0x45')](function(_0x1a96e7){logger[_0xb08c('0x28')](_0xb08c('0x57'),_0x1a96e7);});}return _0x1041fa;});})[_0xb08c('0x22')](respondWithResult(_0x483610,0xc9))['catch'](handleError(_0x483610,null));};exports[_0xb08c('0x23')]=function(_0x156320,_0x2ab3a7,_0x371fba){var _0xa617b6;return db[_0xb08c('0x2c')][_0xb08c('0x49')]({'where':{'id':_0x156320[_0xb08c('0x47')]['id']}})['then'](function(_0x4398f6){if(_0x4398f6){return db[_0xb08c('0x58')][_0xb08c('0x59')](function(_0x45592){return _0x4398f6[_0xb08c('0x23')]({'transaction':_0x45592,'raw':!![]})[_0xb08c('0x22')](function(_0x283832){if(_0x283832[_0xb08c('0x4d')]){fs[_0xb08c('0x5a')](_0x283832[_0xb08c('0x4d')])['forEach'](function(_0x2465ff){fs[_0xb08c('0x5b')](path['join'](_0x283832['directory'],_0x2465ff));});fs['rmdirSync'](_0x283832['directory']);}return _0x283832;});})[_0xb08c('0x45')](function(_0x206df4){throw new db[(_0xb08c('0x5c'))][(_0xb08c('0x5d'))](_0x206df4[_0xb08c('0x5e')]);});}})['then'](handleEntityNotFound(_0x2ab3a7,null))[_0xb08c('0x22')](removeEntity(_0x2ab3a7,null))[_0xb08c('0x45')](handleError(_0x2ab3a7,null));};exports['addSound']=function(_0x34e699,_0x3356d7,_0x3e8613){return db[_0xb08c('0x58')][_0xb08c('0x59')](function(_0x550628){var _0x253800;return db[_0xb08c('0x2c')][_0xb08c('0x49')]({'where':{'id':_0x34e699[_0xb08c('0x47')]['id']}})[_0xb08c('0x22')](function(_0x3a2d49){if(_0x3a2d49){_0x253800=_0x3a2d49;return _0x3a2d49[_0xb08c('0x5f')](_0x34e699[_0xb08c('0x48')]['id'],{'transaction':_0x550628});}})['then'](function(_0x51020c){if(_0x51020c){return db[_0xb08c('0x60')][_0xb08c('0x61')]({'where':{'id':_0x34e699['body']['id']},'attributes':['id',_0xb08c('0x29'),_0xb08c('0x62'),'converted_format',_0xb08c('0x63')],'raw':!![]});}})[_0xb08c('0x22')](function(_0x7c310a){if(_0x7c310a){var _0x2ec418=path[_0xb08c('0x64')](config[_0xb08c('0x4e')],_0xb08c('0x65'),util[_0xb08c('0x66')](_0xb08c('0x67'),path[_0xb08c('0x68')](_0x7c310a[_0xb08c('0x62')],path[_0xb08c('0x69')](_0x7c310a['save_name'])),_0x7c310a['converted_format']));var _0x4eadb9=path[_0xb08c('0x64')](config[_0xb08c('0x4e')],'server/files/moh',_0x253800[_0xb08c('0x29')],util['format'](_0xb08c('0x67'),_0x7c310a[_0xb08c('0x29')],_0x7c310a[_0xb08c('0x6a')]));fs[_0xb08c('0x6b')](_0x2ec418,_0x4eadb9);return _0x7c310a;}})[_0xb08c('0x45')](function(_0x136d06){throw new db[(_0xb08c('0x5c'))][(_0xb08c('0x5d'))](_0x136d06[_0xb08c('0x5e')]);});})['then'](handleEntityNotFound(_0x3356d7,null))['then'](respondWithResult(_0x3356d7,0xc9))[_0xb08c('0x45')](handleError(_0x3356d7,null));};exports[_0xb08c('0x6c')]=function(_0xa51fab,_0x1f97da,_0x3ae5fd){return db[_0xb08c('0x58')][_0xb08c('0x59')](function(_0x5c6c8e){var _0x20fa16;return db[_0xb08c('0x2c')][_0xb08c('0x61')]({'where':{'id':_0xa51fab['params']['id']}})['then'](handleEntityNotFound(_0x1f97da,null))[_0xb08c('0x22')](function(_0xdde1db){if(_0xdde1db){_0x20fa16=_0xdde1db;return _0xdde1db[_0xb08c('0x6c')](_0xa51fab[_0xb08c('0x47')][_0xb08c('0x6d')]);}})['then'](function(_0x3337ad){if(_0x3337ad){return db[_0xb08c('0x60')]['findOne']({'where':{'id':_0xa51fab[_0xb08c('0x47')][_0xb08c('0x6d')]},'attributes':['id',_0xb08c('0x29'),_0xb08c('0x62'),_0xb08c('0x6a'),_0xb08c('0x63')],'raw':!![]});}})['then'](function(_0x4afb72){if(_0x4afb72){fs['unlinkSync'](path['join'](_0x20fa16['directory'],util[_0xb08c('0x66')]('%s.%s',_0x4afb72[_0xb08c('0x29')],_0x4afb72[_0xb08c('0x6a')])));return _0x4afb72;}})[_0xb08c('0x45')](function(_0x52c762){throw new db[(_0xb08c('0x5c'))][(_0xb08c('0x5d'))](_0x52c762['message']);});})[_0xb08c('0x22')](handleEntityNotFound(_0x1f97da,null))['then'](respondWithStatusCode(_0x1f97da,0xcc))['catch'](handleError(_0x1f97da,null));};exports[_0xb08c('0x6e')]=function(_0x1619aa,_0x24ee6e,_0x2d8bfc){var _0x38a5ab={};var _0x177a9f={};var _0x48ba17;var _0x28ce3b;return db['VoiceMusicOnHold'][_0xb08c('0x61')]({'where':{'id':_0x1619aa['params']['id']}})['then'](handleEntityNotFound(_0x24ee6e,null))[_0xb08c('0x22')](function(_0x21d2dc){if(_0x21d2dc){_0x48ba17=_0x21d2dc;_0x177a9f['model']=_[_0xb08c('0x33')](db[_0xb08c('0x60')]['rawAttributes']);_0x177a9f['query']=_[_0xb08c('0x33')](_0x1619aa[_0xb08c('0x32')]);_0x177a9f[_0xb08c('0x34')]=_[_0xb08c('0x35')](_0x177a9f[_0xb08c('0x31')],_0x177a9f[_0xb08c('0x32')]);_0x38a5ab[_0xb08c('0x36')]=_[_0xb08c('0x35')](_0x177a9f[_0xb08c('0x31')],qs[_0xb08c('0x37')](_0x1619aa['query'][_0xb08c('0x37')]));_0x38a5ab[_0xb08c('0x36')]=_0x38a5ab[_0xb08c('0x36')][_0xb08c('0x38')]?_0x38a5ab['attributes']:_0x177a9f[_0xb08c('0x31')];_0x38a5ab['order']=qs[_0xb08c('0x3c')](_0x1619aa[_0xb08c('0x32')]['sort']);_0x38a5ab[_0xb08c('0x3d')]=qs[_0xb08c('0x34')](_[_0xb08c('0x3e')](_0x1619aa[_0xb08c('0x32')],_0x177a9f[_0xb08c('0x34')]));if(_0x1619aa[_0xb08c('0x32')][_0xb08c('0x3f')]){_0x38a5ab[_0xb08c('0x3d')]=_[_0xb08c('0x40')](_0x38a5ab[_0xb08c('0x3d')],{'$or':_[_0xb08c('0x2b')](_0x38a5ab[_0xb08c('0x36')],function(_0x18fc9f){var _0x285919={};_0x285919[_0x18fc9f]={'$like':'%'+_0x1619aa[_0xb08c('0x32')][_0xb08c('0x3f')]+'%'};return _0x285919;})});}_0x38a5ab=_['merge']({},_0x38a5ab,_0x1619aa[_0xb08c('0x41')]);return _0x48ba17[_0xb08c('0x6e')](_0x38a5ab);}})['then'](function(_0x30ba2a){if(_0x30ba2a){_0x28ce3b=_0x30ba2a[_0xb08c('0x38')];if(!_0x1619aa[_0xb08c('0x32')]['hasOwnProperty']('nolimit')){_0x38a5ab[_0xb08c('0x1c')]=qs[_0xb08c('0x1c')](_0x1619aa['query'][_0xb08c('0x1c')]);_0x38a5ab[_0xb08c('0x1b')]=qs[_0xb08c('0x1b')](_0x1619aa[_0xb08c('0x32')][_0xb08c('0x1b')]);}return _0x48ba17[_0xb08c('0x6e')](_0x38a5ab);}})['then'](function(_0x16016f){if(_0x16016f){return _0x16016f?{'count':_0x28ce3b,'rows':_0x16016f}:null;}})[_0xb08c('0x22')](respondWithResult(_0x24ee6e,null))[_0xb08c('0x45')](handleError(_0x24ee6e,null));}; \ No newline at end of file +var _0xa8a1=['attributes','hasOwnProperty','sort','where','pick','filter','merge','options','VoiceMusicOnHold','includeAll','findAll','rows','catch','show','params','fields','length','include','find','update','body','create','sequelize','transaction','files','join','root','server/files/moh','mode','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','readdirSync','directory','forEach','rmdirSync','Sequelize','ValidationError','addSound','findOne','save_name','converted_format','createdAt','format','%s.%s','extname','removeSound','id2','unlinkSync','getSounds','Sound','order','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','count','offset','limit','Content-Range','apply','reject','destroy','then','get','MusicOnHolds','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0xa8a1,0x1ef));var _0x1a8a=function(_0x41bfa1,_0x15e28c){_0x41bfa1=_0x41bfa1-0x0;var _0x49b8d5=_0xa8a1[_0x41bfa1];return _0x49b8d5;};'use strict';var pdf=require(_0x1a8a('0x0'));var emlformat=require(_0x1a8a('0x1'));var rimraf=require(_0x1a8a('0x2'));var zipdir=require(_0x1a8a('0x3'));var jsonpatch=require(_0x1a8a('0x4'));var rp=require(_0x1a8a('0x5'));var moment=require(_0x1a8a('0x6'));var BPromise=require(_0x1a8a('0x7'));var Mustache=require(_0x1a8a('0x8'));var util=require(_0x1a8a('0x9'));var path=require(_0x1a8a('0xa'));var sox=require('sox');var csv=require(_0x1a8a('0xb'));var ejs=require(_0x1a8a('0xc'));var fs=require('fs');var _=require(_0x1a8a('0xd'));var squel=require(_0x1a8a('0xe'));var crypto=require('crypto');var jsforce=require(_0x1a8a('0xf'));var deskjs=require(_0x1a8a('0x10'));var toCsv=require(_0x1a8a('0xb'));var querystring=require('querystring');var Papa=require(_0x1a8a('0x11'));var Redis=require(_0x1a8a('0x12'));var authService=require(_0x1a8a('0x13'));var qs=require(_0x1a8a('0x14'));var as=require(_0x1a8a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1a8a('0x16'))(_0x1a8a('0x17'));var utils=require(_0x1a8a('0x18'));var config=require('../../config/environment');var db=require(_0x1a8a('0x19'))['db'];function respondWithStatusCode(_0x16c6a6,_0xb39da3){_0xb39da3=_0xb39da3||0xcc;return function(_0x57afda){if(_0x57afda){return _0x16c6a6[_0x1a8a('0x1a')](_0xb39da3);}return _0x16c6a6[_0x1a8a('0x1b')](_0xb39da3)['end']();};}function respondWithResult(_0x36d6d7,_0x5b089c){_0x5b089c=_0x5b089c||0xc8;return function(_0xec6e4a){if(_0xec6e4a){return _0x36d6d7[_0x1a8a('0x1b')](_0x5b089c)[_0x1a8a('0x1c')](_0xec6e4a);}};}function respondWithFilteredResult(_0x4bcd25,_0x851fb8){return function(_0x9a19a1){if(_0x9a19a1){var _0x5e9f0b=_0x9a19a1[_0x1a8a('0x1d')],_0x25ad58=_0x851fb8[_0x1a8a('0x1e')],_0xdf84a=_0x851fb8['offset']+_0x851fb8[_0x1a8a('0x1f')],_0x18bc77;if(_0xdf84a>=_0x5e9f0b){_0xdf84a=_0x5e9f0b;_0x18bc77=0xc8;}else{_0x18bc77=0xce;}_0x4bcd25['status'](_0x18bc77);return _0x4bcd25['set'](_0x1a8a('0x20'),_0x25ad58+'-'+_0xdf84a+'/'+_0x5e9f0b)[_0x1a8a('0x1c')](_0x9a19a1);}return null;};}function patchUpdates(_0x4b3fa5){return function(_0x1ba7ee){try{jsonpatch[_0x1a8a('0x21')](_0x1ba7ee,_0x4b3fa5,!![]);}catch(_0x3d0f19){return BPromise[_0x1a8a('0x22')](_0x3d0f19);}return _0x1ba7ee['save']();};}function saveUpdates(_0xae7520,_0x5f5a13){return function(_0x37f596){if(_0x37f596){return _0x37f596['update'](_0xae7520)['then'](function(_0xdbb57b){return _0xdbb57b;});}return null;};}function removeEntity(_0x1f7793,_0x31cab1){return function(_0x176181){if(_0x176181){return _0x176181[_0x1a8a('0x23')]()[_0x1a8a('0x24')](function(){var _0xe1e562=_0x176181[_0x1a8a('0x25')]({'plain':!![]});var _0x20b26d=_0x1a8a('0x26');return db['UserProfileResource'][_0x1a8a('0x23')]({'where':{'type':_0x20b26d,'resourceId':_0xe1e562['id']}})[_0x1a8a('0x24')](function(){return _0x176181;});})['then'](function(){_0x1f7793['status'](0xcc)[_0x1a8a('0x27')]();});}};}function handleEntityNotFound(_0x852f9e,_0x30540e){return function(_0x318478){if(!_0x318478){_0x852f9e[_0x1a8a('0x1a')](0x194);}return _0x318478;};}function handleError(_0x354df2,_0x1c3e9d){_0x1c3e9d=_0x1c3e9d||0x1f4;return function(_0x45494e){logger[_0x1a8a('0x28')](_0x45494e[_0x1a8a('0x29')]);if(_0x45494e[_0x1a8a('0x2a')]){delete _0x45494e['name'];}_0x354df2[_0x1a8a('0x1b')](_0x1c3e9d)[_0x1a8a('0x2b')](_0x45494e);};}exports[_0x1a8a('0x2c')]=function(_0x15be15,_0x2df590){var _0x27223c={},_0x188438={},_0x570cf0={'count':0x0,'rows':[]};var _0x1ea3c7=_[_0x1a8a('0x2d')](db['VoiceMusicOnHold'][_0x1a8a('0x2e')],function(_0x5f2534){return{'name':_0x5f2534[_0x1a8a('0x2f')],'type':_0x5f2534[_0x1a8a('0x30')][_0x1a8a('0x31')]};});_0x188438[_0x1a8a('0x32')]=_[_0x1a8a('0x2d')](_0x1ea3c7,_0x1a8a('0x2a'));_0x188438['query']=_[_0x1a8a('0x33')](_0x15be15[_0x1a8a('0x34')]);_0x188438[_0x1a8a('0x35')]=_[_0x1a8a('0x36')](_0x188438['model'],_0x188438[_0x1a8a('0x34')]);_0x27223c[_0x1a8a('0x37')]=_[_0x1a8a('0x36')](_0x188438[_0x1a8a('0x32')],qs['fields'](_0x15be15[_0x1a8a('0x34')]['fields']));_0x27223c[_0x1a8a('0x37')]=_0x27223c['attributes']['length']?_0x27223c[_0x1a8a('0x37')]:_0x188438[_0x1a8a('0x32')];if(!_0x15be15[_0x1a8a('0x34')][_0x1a8a('0x38')]('nolimit')){_0x27223c[_0x1a8a('0x1f')]=qs[_0x1a8a('0x1f')](_0x15be15[_0x1a8a('0x34')][_0x1a8a('0x1f')]);_0x27223c[_0x1a8a('0x1e')]=qs[_0x1a8a('0x1e')](_0x15be15['query'][_0x1a8a('0x1e')]);}_0x27223c['order']=qs[_0x1a8a('0x39')](_0x15be15[_0x1a8a('0x34')]['sort']);_0x27223c[_0x1a8a('0x3a')]=qs['filters'](_[_0x1a8a('0x3b')](_0x15be15[_0x1a8a('0x34')],_0x188438[_0x1a8a('0x35')]));if(_0x15be15[_0x1a8a('0x34')][_0x1a8a('0x3c')]){_0x27223c['where']=_['merge'](_0x27223c['where'],{'$or':_['map'](_0x1ea3c7,function(_0x227b21){if(_0x227b21[_0x1a8a('0x30')]!=='VIRTUAL'){var _0x578b41={};_0x578b41[_0x227b21[_0x1a8a('0x2a')]]={'$like':'%'+_0x15be15[_0x1a8a('0x34')][_0x1a8a('0x3c')]+'%'};return _0x578b41;}})});}_0x27223c=_[_0x1a8a('0x3d')]({},_0x27223c,_0x15be15[_0x1a8a('0x3e')]);var _0x5e24aa={'where':_0x27223c['where']};return db[_0x1a8a('0x3f')][_0x1a8a('0x1d')](_0x5e24aa)[_0x1a8a('0x24')](function(_0x3e04e0){_0x570cf0[_0x1a8a('0x1d')]=_0x3e04e0;if(_0x15be15['query'][_0x1a8a('0x40')]){_0x27223c['include']=[{'all':!![]}];}return db[_0x1a8a('0x3f')][_0x1a8a('0x41')](_0x27223c);})['then'](function(_0x58e4a3){_0x570cf0[_0x1a8a('0x42')]=_0x58e4a3;return _0x570cf0;})['then'](respondWithFilteredResult(_0x2df590,_0x27223c))[_0x1a8a('0x43')](handleError(_0x2df590,null));};exports[_0x1a8a('0x44')]=function(_0x50cf33,_0x42393e){var _0x5e2286={'raw':![],'where':{'id':_0x50cf33[_0x1a8a('0x45')]['id']}},_0x4d87ab={};_0x4d87ab[_0x1a8a('0x32')]=_[_0x1a8a('0x33')](db[_0x1a8a('0x3f')][_0x1a8a('0x2e')]);_0x4d87ab[_0x1a8a('0x34')]=_[_0x1a8a('0x33')](_0x50cf33[_0x1a8a('0x34')]);_0x4d87ab[_0x1a8a('0x35')]=_['intersection'](_0x4d87ab[_0x1a8a('0x32')],_0x4d87ab['query']);_0x5e2286[_0x1a8a('0x37')]=_[_0x1a8a('0x36')](_0x4d87ab[_0x1a8a('0x32')],qs[_0x1a8a('0x46')](_0x50cf33[_0x1a8a('0x34')]['fields']));_0x5e2286[_0x1a8a('0x37')]=_0x5e2286[_0x1a8a('0x37')][_0x1a8a('0x47')]?_0x5e2286[_0x1a8a('0x37')]:_0x4d87ab[_0x1a8a('0x32')];if(_0x50cf33['query'][_0x1a8a('0x40')]){_0x5e2286[_0x1a8a('0x48')]=[{'all':!![]}];}_0x5e2286=_[_0x1a8a('0x3d')]({},_0x5e2286,_0x50cf33[_0x1a8a('0x3e')]);return db['VoiceMusicOnHold'][_0x1a8a('0x49')](_0x5e2286)[_0x1a8a('0x24')](handleEntityNotFound(_0x42393e,null))['then'](respondWithResult(_0x42393e,null))[_0x1a8a('0x43')](handleError(_0x42393e,null));};exports[_0x1a8a('0x4a')]=function(_0x3ffdae,_0x39fc06){if(_0x3ffdae[_0x1a8a('0x4b')]['id']){delete _0x3ffdae[_0x1a8a('0x4b')]['id'];}return db[_0x1a8a('0x3f')][_0x1a8a('0x49')]({'where':{'id':_0x3ffdae[_0x1a8a('0x45')]['id']}})[_0x1a8a('0x24')](handleEntityNotFound(_0x39fc06,null))['then'](saveUpdates(_0x3ffdae['body'],null))['then'](respondWithResult(_0x39fc06,null))[_0x1a8a('0x43')](handleError(_0x39fc06,null));};exports[_0x1a8a('0x4c')]=function(_0x44eef8,_0x57e29e,_0x194eaa){return db[_0x1a8a('0x4d')][_0x1a8a('0x4e')](function(_0x245baa){if(_0x44eef8[_0x1a8a('0x4b')]['mode']===_0x1a8a('0x4f')){_0x44eef8['body']['directory']=path[_0x1a8a('0x50')](config[_0x1a8a('0x51')],_0x1a8a('0x52'),_0x44eef8[_0x1a8a('0x4b')][_0x1a8a('0x2a')]);}return db[_0x1a8a('0x3f')][_0x1a8a('0x4c')](_0x44eef8['body'],{'transaction':_0x245baa})[_0x1a8a('0x24')](function(_0x3d3d18){if(_0x44eef8['body'][_0x1a8a('0x53')]===_0x1a8a('0x4f')){fs[_0x1a8a('0x54')](_0x3d3d18['directory'],parseInt('0777',0x8));}var _0x40a3d9=_0x44eef8[_0x1a8a('0x55')][_0x1a8a('0x25')]({'plain':!![]});if(!_0x40a3d9)throw new Error(_0x1a8a('0x56'));if(_0x40a3d9[_0x1a8a('0x57')]===_0x1a8a('0x55')){var _0x47ba3e=_0x3d3d18['get']({'plain':!![]});return db['UserProfileSection'][_0x1a8a('0x49')]({'where':{'name':_0x1a8a('0x26'),'userProfileId':_0x40a3d9[_0x1a8a('0x58')]},'raw':!![]})[_0x1a8a('0x24')](function(_0x346ae3){if(_0x346ae3&&_0x346ae3[_0x1a8a('0x59')]===0x0){return db['UserProfileResource'][_0x1a8a('0x4c')]({'name':_0x47ba3e[_0x1a8a('0x2a')],'resourceId':_0x47ba3e['id'],'type':_0x346ae3['name'],'sectionId':_0x346ae3['id']},{})[_0x1a8a('0x24')](function(){return _0x3d3d18;});}else{return _0x3d3d18;}})[_0x1a8a('0x43')](function(_0x41909f){logger[_0x1a8a('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x41909f);});}return _0x3d3d18;});})['then'](respondWithResult(_0x57e29e,0xc9))[_0x1a8a('0x43')](handleError(_0x57e29e,null));};exports[_0x1a8a('0x23')]=function(_0x43015d,_0x4234ae,_0x243acb){var _0x360755;return db[_0x1a8a('0x3f')][_0x1a8a('0x49')]({'where':{'id':_0x43015d['params']['id']}})[_0x1a8a('0x24')](function(_0x507940){if(_0x507940){return db[_0x1a8a('0x4d')]['transaction'](function(_0x1330bd){return _0x507940[_0x1a8a('0x23')]({'transaction':_0x1330bd,'raw':!![]})[_0x1a8a('0x24')](function(_0x301f17){if(_0x301f17['directory']){fs[_0x1a8a('0x5a')](_0x301f17[_0x1a8a('0x5b')])[_0x1a8a('0x5c')](function(_0x1a34b){fs['unlinkSync'](path['join'](_0x301f17[_0x1a8a('0x5b')],_0x1a34b));});fs[_0x1a8a('0x5d')](_0x301f17[_0x1a8a('0x5b')]);}return _0x301f17;});})[_0x1a8a('0x43')](function(_0x2490dc){throw new db[(_0x1a8a('0x5e'))][(_0x1a8a('0x5f'))](_0x2490dc['message']);});}})[_0x1a8a('0x24')](handleEntityNotFound(_0x4234ae,null))[_0x1a8a('0x24')](removeEntity(_0x4234ae,null))[_0x1a8a('0x43')](handleError(_0x4234ae,null));};exports[_0x1a8a('0x60')]=function(_0x276eb5,_0x1ed706,_0x58e301){return db[_0x1a8a('0x4d')][_0x1a8a('0x4e')](function(_0xc2856b){var _0x2a7185;return db[_0x1a8a('0x3f')]['find']({'where':{'id':_0x276eb5[_0x1a8a('0x45')]['id']}})['then'](function(_0x5e52f1){if(_0x5e52f1){_0x2a7185=_0x5e52f1;return _0x5e52f1[_0x1a8a('0x60')](_0x276eb5[_0x1a8a('0x4b')]['id'],{'transaction':_0xc2856b});}})[_0x1a8a('0x24')](function(_0x1f1ce2){if(_0x1f1ce2){return db['Sound'][_0x1a8a('0x61')]({'where':{'id':_0x276eb5[_0x1a8a('0x4b')]['id']},'attributes':['id',_0x1a8a('0x2a'),_0x1a8a('0x62'),_0x1a8a('0x63'),_0x1a8a('0x64')],'raw':!![]});}})[_0x1a8a('0x24')](function(_0x2db363){if(_0x2db363){var _0x1269bc=path[_0x1a8a('0x50')](config[_0x1a8a('0x51')],'server/files/sounds/converted',util[_0x1a8a('0x65')](_0x1a8a('0x66'),path['basename'](_0x2db363[_0x1a8a('0x62')],path[_0x1a8a('0x67')](_0x2db363[_0x1a8a('0x62')])),_0x2db363[_0x1a8a('0x63')]));var _0x110def=path['join'](config[_0x1a8a('0x51')],_0x1a8a('0x52'),_0x2a7185[_0x1a8a('0x2a')],util[_0x1a8a('0x65')](_0x1a8a('0x66'),_0x2db363['name'],_0x2db363[_0x1a8a('0x63')]));fs['symlinkSync'](_0x1269bc,_0x110def);return _0x2db363;}})['catch'](function(_0x475e69){throw new db['Sequelize']['ValidationError'](_0x475e69['message']);});})[_0x1a8a('0x24')](handleEntityNotFound(_0x1ed706,null))[_0x1a8a('0x24')](respondWithResult(_0x1ed706,0xc9))[_0x1a8a('0x43')](handleError(_0x1ed706,null));};exports[_0x1a8a('0x68')]=function(_0x4211e2,_0x1840c1,_0x328c97){return db[_0x1a8a('0x4d')][_0x1a8a('0x4e')](function(_0x206084){var _0x49eba8;return db[_0x1a8a('0x3f')][_0x1a8a('0x61')]({'where':{'id':_0x4211e2[_0x1a8a('0x45')]['id']}})[_0x1a8a('0x24')](handleEntityNotFound(_0x1840c1,null))['then'](function(_0x4f638e){if(_0x4f638e){_0x49eba8=_0x4f638e;return _0x4f638e[_0x1a8a('0x68')](_0x4211e2['params']['id2']);}})[_0x1a8a('0x24')](function(_0x1b03e3){if(_0x1b03e3){return db['Sound'][_0x1a8a('0x61')]({'where':{'id':_0x4211e2[_0x1a8a('0x45')][_0x1a8a('0x69')]},'attributes':['id','name',_0x1a8a('0x62'),'converted_format',_0x1a8a('0x64')],'raw':!![]});}})[_0x1a8a('0x24')](function(_0x40e8a0){if(_0x40e8a0){fs[_0x1a8a('0x6a')](path['join'](_0x49eba8[_0x1a8a('0x5b')],util[_0x1a8a('0x65')](_0x1a8a('0x66'),_0x40e8a0[_0x1a8a('0x2a')],_0x40e8a0[_0x1a8a('0x63')])));return _0x40e8a0;}})[_0x1a8a('0x43')](function(_0x22e327){throw new db[(_0x1a8a('0x5e'))][(_0x1a8a('0x5f'))](_0x22e327['message']);});})[_0x1a8a('0x24')](handleEntityNotFound(_0x1840c1,null))['then'](respondWithStatusCode(_0x1840c1,0xcc))[_0x1a8a('0x43')](handleError(_0x1840c1,null));};exports[_0x1a8a('0x6b')]=function(_0x448eb7,_0x18b68b,_0x3390b7){var _0x215a2d={};var _0x31b699={};var _0x2e1228;var _0x29470b;return db[_0x1a8a('0x3f')]['findOne']({'where':{'id':_0x448eb7['params']['id']}})[_0x1a8a('0x24')](handleEntityNotFound(_0x18b68b,null))['then'](function(_0x41beca){if(_0x41beca){_0x2e1228=_0x41beca;_0x31b699[_0x1a8a('0x32')]=_['keys'](db[_0x1a8a('0x6c')]['rawAttributes']);_0x31b699[_0x1a8a('0x34')]=_['keys'](_0x448eb7[_0x1a8a('0x34')]);_0x31b699[_0x1a8a('0x35')]=_[_0x1a8a('0x36')](_0x31b699[_0x1a8a('0x32')],_0x31b699['query']);_0x215a2d[_0x1a8a('0x37')]=_[_0x1a8a('0x36')](_0x31b699[_0x1a8a('0x32')],qs[_0x1a8a('0x46')](_0x448eb7[_0x1a8a('0x34')][_0x1a8a('0x46')]));_0x215a2d['attributes']=_0x215a2d['attributes']['length']?_0x215a2d[_0x1a8a('0x37')]:_0x31b699[_0x1a8a('0x32')];_0x215a2d[_0x1a8a('0x6d')]=qs[_0x1a8a('0x39')](_0x448eb7[_0x1a8a('0x34')]['sort']);_0x215a2d[_0x1a8a('0x3a')]=qs[_0x1a8a('0x35')](_[_0x1a8a('0x3b')](_0x448eb7[_0x1a8a('0x34')],_0x31b699[_0x1a8a('0x35')]));if(_0x448eb7[_0x1a8a('0x34')][_0x1a8a('0x3c')]){_0x215a2d[_0x1a8a('0x3a')]=_[_0x1a8a('0x3d')](_0x215a2d['where'],{'$or':_[_0x1a8a('0x2d')](_0x215a2d['attributes'],function(_0x56957d){var _0x19fb0f={};_0x19fb0f[_0x56957d]={'$like':'%'+_0x448eb7[_0x1a8a('0x34')][_0x1a8a('0x3c')]+'%'};return _0x19fb0f;})});}_0x215a2d=_[_0x1a8a('0x3d')]({},_0x215a2d,_0x448eb7[_0x1a8a('0x3e')]);return _0x2e1228['getSounds'](_0x215a2d);}})['then'](function(_0x471928){if(_0x471928){_0x29470b=_0x471928[_0x1a8a('0x47')];if(!_0x448eb7[_0x1a8a('0x34')][_0x1a8a('0x38')]('nolimit')){_0x215a2d[_0x1a8a('0x1f')]=qs[_0x1a8a('0x1f')](_0x448eb7['query'][_0x1a8a('0x1f')]);_0x215a2d[_0x1a8a('0x1e')]=qs['offset'](_0x448eb7[_0x1a8a('0x34')]['offset']);}return _0x2e1228[_0x1a8a('0x6b')](_0x215a2d);}})[_0x1a8a('0x24')](function(_0x315807){if(_0x315807){return _0x315807?{'count':_0x29470b,'rows':_0x315807}:null;}})[_0x1a8a('0x24')](respondWithResult(_0x18b68b,null))['catch'](handleError(_0x18b68b,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 14df2f7..701dba3 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 _0xff9e=['voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold'];(function(_0x2543d6,_0x3a5e78){var _0x55213c=function(_0x292768){while(--_0x292768){_0x2543d6['push'](_0x2543d6['shift']());}};_0x55213c(++_0x3a5e78);}(_0xff9e,0x194));var _0xeff9=function(_0x388169,_0x1e572a){_0x388169=_0x388169-0x0;var _0x1673ec=_0xff9e[_0x388169];return _0x1673ec;};'use strict';var _=require(_0xeff9('0x0'));var util=require(_0xeff9('0x1'));var logger=require('../../config/logger')(_0xeff9('0x2'));var moment=require(_0xeff9('0x3'));var BPromise=require(_0xeff9('0x4'));var rp=require(_0xeff9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeff9('0x6'));var config=require(_0xeff9('0x7'));var attributes=require(_0xeff9('0x8'));module[_0xeff9('0x9')]=function(_0x1b2c40,_0x230050){return _0x1b2c40[_0xeff9('0xa')](_0xeff9('0xb'),attributes,{'tableName':_0xeff9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4114=['request-promise','path','rimraf','exports','define','voice_musiconhold','lodash','util','moment','bluebird'];(function(_0xb83b07,_0x144185){var _0x537229=function(_0xeab552){while(--_0xeab552){_0xb83b07['push'](_0xb83b07['shift']());}};_0x537229(++_0x144185);}(_0x4114,0xa6));var _0x4411=function(_0x39ce53,_0x4f847b){_0x39ce53=_0x39ce53-0x0;var _0x5da850=_0x4114[_0x39ce53];return _0x5da850;};'use strict';var _=require(_0x4411('0x0'));var util=require(_0x4411('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x4411('0x2'));var BPromise=require(_0x4411('0x3'));var rp=require(_0x4411('0x4'));var fs=require('fs');var path=require(_0x4411('0x5'));var rimraf=require(_0x4411('0x6'));var config=require('../../config/environment');var attributes=require('./voiceMusicOnHold.attributes');module[_0x4411('0x7')]=function(_0x44472c,_0x516d24){return _0x44472c[_0x4411('0x8')]('VoiceMusicOnHold',attributes,{'tableName':_0x4411('0x9'),'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 69f36f4..cb64e25 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 _0xdd03=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMusicOnHold,\x20%s,\x20%s','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','util','moment','bluebird','ioredis'];(function(_0x1442eb,_0x19951e){var _0x5c31ea=function(_0xcc03b8){while(--_0xcc03b8){_0x1442eb['push'](_0x1442eb['shift']());}};_0x5c31ea(++_0x19951e);}(_0xdd03,0x18b));var _0x3dd0=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xdd03[_0x3b380d];return _0x54502b;};'use strict';var _=require('lodash');var util=require(_0x3dd0('0x0'));var moment=require(_0x3dd0('0x1'));var BPromise=require(_0x3dd0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3dd0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3dd0('0x4'));var logger=require(_0x3dd0('0x5'))('rpc');var config=require(_0x3dd0('0x6'));var jayson=require(_0x3dd0('0x7'));var client=jayson[_0x3dd0('0x8')][_0x3dd0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1843f1,_0x1f1a18,_0x1e676b){return new BPromise(function(_0x10e627,_0x19f84d){return client[_0x3dd0('0xa')](_0x1843f1,_0x1e676b)[_0x3dd0('0xb')](function(_0x589d6e){logger[_0x3dd0('0xc')](_0x3dd0('0xd'),_0x1f1a18,'request\x20sent');logger[_0x3dd0('0xe')](_0x3dd0('0xf'),_0x1f1a18,_0x3dd0('0x10'),JSON['stringify'](_0x589d6e));if(_0x589d6e['error']){if(_0x589d6e[_0x3dd0('0x11')][_0x3dd0('0x12')]===0x1f4){logger[_0x3dd0('0x11')](_0x3dd0('0xd'),_0x1f1a18,_0x589d6e['error'][_0x3dd0('0x13')]);return _0x19f84d(_0x589d6e[_0x3dd0('0x11')][_0x3dd0('0x13')]);}logger['error'](_0x3dd0('0xd'),_0x1f1a18,_0x589d6e[_0x3dd0('0x11')][_0x3dd0('0x13')]);return _0x10e627(_0x589d6e[_0x3dd0('0x11')][_0x3dd0('0x13')]);}else{logger[_0x3dd0('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x1f1a18,_0x3dd0('0x10'));_0x10e627(_0x589d6e[_0x3dd0('0x14')]['message']);}})['catch'](function(_0x5e1ab0){logger[_0x3dd0('0x11')](_0x3dd0('0xd'),_0x1f1a18,_0x5e1ab0);_0x19f84d(_0x5e1ab0);});});} \ No newline at end of file +var _0x9314=['message','info','result','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xcd2662,_0x3f8cdc){var _0x139665=function(_0x59755f){while(--_0x59755f){_0xcd2662['push'](_0xcd2662['shift']());}};_0x139665(++_0x3f8cdc);}(_0x9314,0x1bd));var _0x4931=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9314[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4931('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4931('0x1'));var rs=require(_0x4931('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4931('0x3'))['db'];var utils=require(_0x4931('0x4'));var logger=require('../../config/logger')(_0x4931('0x5'));var config=require(_0x4931('0x6'));var jayson=require(_0x4931('0x7'));var client=jayson[_0x4931('0x8')][_0x4931('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5addb8,_0x11787b,_0x5d1c11){return new BPromise(function(_0xe12ae4,_0x1bcb12){return client['request'](_0x5addb8,_0x5d1c11)[_0x4931('0xa')](function(_0x366695){logger['info'](_0x4931('0xb'),_0x11787b,_0x4931('0xc'));logger[_0x4931('0xd')](_0x4931('0xe'),_0x11787b,_0x4931('0xc'),JSON[_0x4931('0xf')](_0x366695));if(_0x366695['error']){if(_0x366695[_0x4931('0x10')]['code']===0x1f4){logger[_0x4931('0x10')](_0x4931('0xb'),_0x11787b,_0x366695[_0x4931('0x10')][_0x4931('0x11')]);return _0x1bcb12(_0x366695[_0x4931('0x10')]['message']);}logger[_0x4931('0x10')](_0x4931('0xb'),_0x11787b,_0x366695[_0x4931('0x10')][_0x4931('0x11')]);return _0xe12ae4(_0x366695[_0x4931('0x10')][_0x4931('0x11')]);}else{logger[_0x4931('0x12')](_0x4931('0xb'),_0x11787b,_0x4931('0xc'));_0xe12ae4(_0x366695[_0x4931('0x13')][_0x4931('0x11')]);}})[_0x4931('0x14')](function(_0x2c391d){logger[_0x4931('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x11787b,_0x2c391d);_0x1bcb12(_0x2c391d);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 30504a2..5a405ee 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 _0xa32f=['index','/describe','/:id','show','/:id/users','getAgents','post','create','update','delete','removeAgents','exports','multer','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated'];(function(_0x10c507,_0x3153d1){var _0x4bd358=function(_0x49288a){while(--_0x49288a){_0x10c507['push'](_0x10c507['shift']());}};_0x4bd358(++_0x3153d1);}(_0xa32f,0x19c));var _0xfa32=function(_0x3e0c70,_0x27653d){_0x3e0c70=_0x3e0c70-0x0;var _0x19a245=_0xa32f[_0x3e0c70];return _0x19a245;};'use strict';var multer=require(_0xfa32('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xfa32('0x1'));var router=express['Router']();var auth=require(_0xfa32('0x2'));var interaction=require(_0xfa32('0x3'));var config=require(_0xfa32('0x4'));var controller=require(_0xfa32('0x5'));router[_0xfa32('0x6')]('/',auth[_0xfa32('0x7')](),controller[_0xfa32('0x8')]);router[_0xfa32('0x6')](_0xfa32('0x9'),auth[_0xfa32('0x7')](),controller['describe']);router[_0xfa32('0x6')](_0xfa32('0xa'),auth[_0xfa32('0x7')](),controller[_0xfa32('0xb')]);router[_0xfa32('0x6')](_0xfa32('0xc'),auth[_0xfa32('0x7')](),controller[_0xfa32('0xd')]);router[_0xfa32('0xe')]('/',auth[_0xfa32('0x7')](),controller[_0xfa32('0xf')]);router[_0xfa32('0xe')](_0xfa32('0xc'),auth[_0xfa32('0x7')](),controller['addAgents']);router['put']('/:id',auth[_0xfa32('0x7')](),controller[_0xfa32('0x10')]);router[_0xfa32('0x11')](_0xfa32('0xa'),auth[_0xfa32('0x7')](),controller['destroy']);router[_0xfa32('0x11')](_0xfa32('0xc'),auth[_0xfa32('0x7')](),controller[_0xfa32('0x12')]);module[_0xfa32('0x13')]=router; \ No newline at end of file +var _0xdba2=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','describe','/:id','getAgents','post','create','addAgents','delete','destroy','removeAgents','exports','path','express','Router'];(function(_0x6f186b,_0x39b1df){var _0x28f9a8=function(_0x4b857f){while(--_0x4b857f){_0x6f186b['push'](_0x6f186b['shift']());}};_0x28f9a8(++_0x39b1df);}(_0xdba2,0x129));var _0x2dba=function(_0x440964,_0x56c481){_0x440964=_0x440964-0x0;var _0x4b5276=_0xdba2[_0x440964];return _0x4b5276;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2dba('0x0'));var timeout=require('connect-timeout');var express=require(_0x2dba('0x1'));var router=express[_0x2dba('0x2')]();var auth=require(_0x2dba('0x3'));var interaction=require(_0x2dba('0x4'));var config=require(_0x2dba('0x5'));var controller=require(_0x2dba('0x6'));router[_0x2dba('0x7')]('/',auth[_0x2dba('0x8')](),controller[_0x2dba('0x9')]);router[_0x2dba('0x7')]('/describe',auth[_0x2dba('0x8')](),controller[_0x2dba('0xa')]);router[_0x2dba('0x7')](_0x2dba('0xb'),auth[_0x2dba('0x8')](),controller['show']);router[_0x2dba('0x7')]('/:id/users',auth[_0x2dba('0x8')](),controller[_0x2dba('0xc')]);router[_0x2dba('0xd')]('/',auth['isAuthenticated'](),controller[_0x2dba('0xe')]);router[_0x2dba('0xd')]('/:id/users',auth[_0x2dba('0x8')](),controller[_0x2dba('0xf')]);router['put'](_0x2dba('0xb'),auth[_0x2dba('0x8')](),controller['update']);router[_0x2dba('0x10')](_0x2dba('0xb'),auth[_0x2dba('0x8')](),controller[_0x2dba('0x11')]);router['delete']('/:id/users',auth[_0x2dba('0x8')](),controller[_0x2dba('0x12')]);module[_0x2dba('0x13')]=router; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.attributes.js b/server/api/voicePrefix/voicePrefix.attributes.js index 9b20a04..696b88d 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 _0xc2e4=['name','INTEGER','sequelize','STRING','VIRTUAL','system-'];(function(_0x13fbf5,_0x27f5f6){var _0x121d4c=function(_0x385af7){while(--_0x385af7){_0x13fbf5['push'](_0x13fbf5['shift']());}};_0x121d4c(++_0x27f5f6);}(_0xc2e4,0x6e));var _0x4c2e=function(_0x29bf1d,_0x621bd2){_0x29bf1d=_0x29bf1d-0x0;var _0x38edec=_0xc2e4[_0x29bf1d];return _0x38edec;};'use strict';var Sequelize=require(_0x4c2e('0x0'));module['exports']={'name':{'type':Sequelize[_0x4c2e('0x1')],'allowNull':![],'unique':'name'},'prefix':{'type':Sequelize[_0x4c2e('0x2')],'get':function(_0xdd4e0d){return _0x4c2e('0x3')+this['getDataValue'](_0x4c2e('0x4'))+'-';}},'description':{'type':Sequelize[_0x4c2e('0x1')]},'callerIdAll':{'type':Sequelize['STRING']},'VoiceExtensionId':{'type':Sequelize[_0x4c2e('0x5')]}}; \ No newline at end of file +var _0xafaf=['sequelize','exports','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x19abee,_0x4c892a){var _0x4e6570=function(_0xdc95ed){while(--_0xdc95ed){_0x19abee['push'](_0x19abee['shift']());}};_0x4e6570(++_0x4c892a);}(_0xafaf,0xfc));var _0xfafa=function(_0x51ebbb,_0xb1fb10){_0x51ebbb=_0x51ebbb-0x0;var _0x4a7c9b=_0xafaf[_0x51ebbb];return _0x4a7c9b;};'use strict';var Sequelize=require(_0xfafa('0x0'));module[_0xfafa('0x1')]={'name':{'type':Sequelize[_0xfafa('0x2')],'allowNull':![],'unique':_0xfafa('0x3')},'prefix':{'type':Sequelize[_0xfafa('0x4')],'get':function(_0x3dd6da){return _0xfafa('0x5')+this[_0xfafa('0x6')](_0xfafa('0x3'))+'-';}},'description':{'type':Sequelize[_0xfafa('0x2')]},'callerIdAll':{'type':Sequelize[_0xfafa('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index dfe4978..25658ca 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 _0x4c57=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','VoicePrefix','includeAll','include','findAll','rows','show','params','keys','rawAttributes','catch','find','describe','create','sequelize','transaction','body','get','VoiceExtension','VoiceExtensionId','user','role','UserProfileSection','userProfileId','error','context','exten','system','Voice\x20Prefix\x20Extension','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','ejs','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','sendStatus','end','status','json','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','send','index','map','fieldName','type','key','model','name','query','filters','intersection','attributes'];(function(_0x224897,_0x18e414){var _0x910924=function(_0x1bb333){while(--_0x1bb333){_0x224897['push'](_0x224897['shift']());}};_0x910924(++_0x18e414);}(_0x4c57,0x1ad));var _0x74c5=function(_0x1fbcac,_0x232833){_0x1fbcac=_0x1fbcac-0x0;var _0x401b24=_0x4c57[_0x1fbcac];return _0x401b24;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x74c5('0x0'));var rimraf=require(_0x74c5('0x1'));var zipdir=require(_0x74c5('0x2'));var jsonpatch=require(_0x74c5('0x3'));var rp=require('request-promise');var moment=require(_0x74c5('0x4'));var BPromise=require(_0x74c5('0x5'));var Mustache=require(_0x74c5('0x6'));var util=require('util');var path=require(_0x74c5('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x74c5('0x8'));var fs=require('fs');var _=require(_0x74c5('0x9'));var squel=require(_0x74c5('0xa'));var crypto=require(_0x74c5('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x74c5('0xc'));var toCsv=require(_0x74c5('0xd'));var querystring=require(_0x74c5('0xe'));var Papa=require('papaparse');var Redis=require(_0x74c5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x74c5('0x10'));var as=require(_0x74c5('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x74c5('0x12'))(_0x74c5('0x13'));var utils=require('../../config/utils');var config=require(_0x74c5('0x14'));var db=require(_0x74c5('0x15'))['db'];config[_0x74c5('0x16')]=_['defaults'](config[_0x74c5('0x16')],{'host':_0x74c5('0x17'),'port':0x18eb});var socket=require(_0x74c5('0x18'))(new Redis(config[_0x74c5('0x16')]));require(_0x74c5('0x19'))[_0x74c5('0x1a')](socket);function respondWithStatusCode(_0x59f636,_0x2ccc19){_0x2ccc19=_0x2ccc19||0xcc;return function(_0x25f786){if(_0x25f786){return _0x59f636[_0x74c5('0x1b')](_0x2ccc19);}return _0x59f636['status'](_0x2ccc19)[_0x74c5('0x1c')]();};}function respondWithResult(_0x28f348,_0x45ad4c){_0x45ad4c=_0x45ad4c||0xc8;return function(_0xfda3d0){if(_0xfda3d0){return _0x28f348[_0x74c5('0x1d')](_0x45ad4c)[_0x74c5('0x1e')](_0xfda3d0);}};}function respondWithFilteredResult(_0x48dbe9,_0x4d56e8){return function(_0x31aa1f){if(_0x31aa1f){var _0x3d50dc=_0x31aa1f[_0x74c5('0x1f')],_0x29ae03=_0x4d56e8[_0x74c5('0x20')],_0x1fdbc9=_0x4d56e8['offset']+_0x4d56e8[_0x74c5('0x21')],_0x50acc6;if(_0x1fdbc9>=_0x3d50dc){_0x1fdbc9=_0x3d50dc;_0x50acc6=0xc8;}else{_0x50acc6=0xce;}_0x48dbe9[_0x74c5('0x1d')](_0x50acc6);return _0x48dbe9[_0x74c5('0x22')](_0x74c5('0x23'),_0x29ae03+'-'+_0x1fdbc9+'/'+_0x3d50dc)[_0x74c5('0x1e')](_0x31aa1f);}return null;};}function patchUpdates(_0x5b5665){return function(_0x373c35){try{jsonpatch[_0x74c5('0x24')](_0x373c35,_0x5b5665,!![]);}catch(_0x5a741e){return BPromise['reject'](_0x5a741e);}return _0x373c35[_0x74c5('0x25')]();};}function saveUpdates(_0xbef793,_0x56ae6f){return function(_0x419eb2){if(_0x419eb2){return _0x419eb2[_0x74c5('0x26')](_0xbef793)[_0x74c5('0x27')](function(_0x4d5fa6){return _0x4d5fa6;});}return null;};}function removeEntity(_0xf4fea3,_0x55c08e){return function(_0x5e92c6){if(_0x5e92c6){return _0x5e92c6[_0x74c5('0x28')]()[_0x74c5('0x27')](function(){var _0x533a9f=_0x5e92c6['get']({'plain':!![]});var _0x1cc7c2=_0x74c5('0x29');return db[_0x74c5('0x2a')][_0x74c5('0x28')]({'where':{'type':_0x1cc7c2,'resourceId':_0x533a9f['id']}})[_0x74c5('0x27')](function(){return _0x5e92c6;});})[_0x74c5('0x27')](function(){_0xf4fea3[_0x74c5('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52b044,_0x4c41b3){return function(_0x314628){if(!_0x314628){_0x52b044[_0x74c5('0x1b')](0x194);}return _0x314628;};}function handleError(_0x5e29f3,_0x27e0d5){_0x27e0d5=_0x27e0d5||0x1f4;return function(_0x9b1a41){logger['error'](_0x9b1a41['stack']);if(_0x9b1a41['name']){delete _0x9b1a41['name'];}_0x5e29f3['status'](_0x27e0d5)[_0x74c5('0x2b')](_0x9b1a41);};}exports[_0x74c5('0x2c')]=function(_0x8a4b6,_0x2c3f21){var _0x24d58d={},_0x2fdcd1={},_0x3df3f4={'count':0x0,'rows':[]};var _0x323bc4=_[_0x74c5('0x2d')](db['VoicePrefix']['rawAttributes'],function(_0x4bb566){return{'name':_0x4bb566[_0x74c5('0x2e')],'type':_0x4bb566[_0x74c5('0x2f')][_0x74c5('0x30')]};});_0x2fdcd1[_0x74c5('0x31')]=_[_0x74c5('0x2d')](_0x323bc4,_0x74c5('0x32'));_0x2fdcd1[_0x74c5('0x33')]=_['keys'](_0x8a4b6[_0x74c5('0x33')]);_0x2fdcd1[_0x74c5('0x34')]=_[_0x74c5('0x35')](_0x2fdcd1[_0x74c5('0x31')],_0x2fdcd1[_0x74c5('0x33')]);_0x24d58d[_0x74c5('0x36')]=_['intersection'](_0x2fdcd1[_0x74c5('0x31')],qs[_0x74c5('0x37')](_0x8a4b6[_0x74c5('0x33')][_0x74c5('0x37')]));_0x24d58d[_0x74c5('0x36')]=_0x24d58d['attributes'][_0x74c5('0x38')]?_0x24d58d['attributes']:_0x2fdcd1[_0x74c5('0x31')];if(!_0x8a4b6[_0x74c5('0x33')][_0x74c5('0x39')](_0x74c5('0x3a'))){_0x24d58d[_0x74c5('0x21')]=qs['limit'](_0x8a4b6['query'][_0x74c5('0x21')]);_0x24d58d[_0x74c5('0x20')]=qs['offset'](_0x8a4b6[_0x74c5('0x33')]['offset']);}_0x24d58d[_0x74c5('0x3b')]=qs[_0x74c5('0x3c')](_0x8a4b6[_0x74c5('0x33')][_0x74c5('0x3c')]);_0x24d58d[_0x74c5('0x3d')]=qs[_0x74c5('0x34')](_[_0x74c5('0x3e')](_0x8a4b6['query'],_0x2fdcd1[_0x74c5('0x34')]));if(_0x8a4b6['query']['filter']){_0x24d58d['where']=_[_0x74c5('0x3f')](_0x24d58d[_0x74c5('0x3d')],{'$or':_[_0x74c5('0x2d')](_0x323bc4,function(_0x44d609){if(_0x44d609[_0x74c5('0x2f')]!==_0x74c5('0x40')){var _0x2a65f2={};_0x2a65f2[_0x44d609['name']]={'$like':'%'+_0x8a4b6[_0x74c5('0x33')][_0x74c5('0x41')]+'%'};return _0x2a65f2;}})});}_0x24d58d=_[_0x74c5('0x3f')]({},_0x24d58d,_0x8a4b6[_0x74c5('0x42')]);var _0x268627={'where':_0x24d58d['where']};return db[_0x74c5('0x43')]['count'](_0x268627)[_0x74c5('0x27')](function(_0x17cc91){_0x3df3f4[_0x74c5('0x1f')]=_0x17cc91;if(_0x8a4b6[_0x74c5('0x33')][_0x74c5('0x44')]){_0x24d58d[_0x74c5('0x45')]=[{'all':!![]}];}return db['VoicePrefix'][_0x74c5('0x46')](_0x24d58d);})[_0x74c5('0x27')](function(_0x1cc67d){_0x3df3f4[_0x74c5('0x47')]=_0x1cc67d;return _0x3df3f4;})[_0x74c5('0x27')](respondWithFilteredResult(_0x2c3f21,_0x24d58d))['catch'](handleError(_0x2c3f21,null));};exports[_0x74c5('0x48')]=function(_0x79f72c,_0xa0f2e){var _0x115758={'raw':![],'where':{'id':_0x79f72c[_0x74c5('0x49')]['id']}},_0x37ee5d={};_0x37ee5d[_0x74c5('0x31')]=_[_0x74c5('0x4a')](db['VoicePrefix'][_0x74c5('0x4b')]);_0x37ee5d[_0x74c5('0x33')]=_[_0x74c5('0x4a')](_0x79f72c[_0x74c5('0x33')]);_0x37ee5d[_0x74c5('0x34')]=_[_0x74c5('0x35')](_0x37ee5d['model'],_0x37ee5d[_0x74c5('0x33')]);_0x115758[_0x74c5('0x36')]=_[_0x74c5('0x35')](_0x37ee5d[_0x74c5('0x31')],qs[_0x74c5('0x37')](_0x79f72c[_0x74c5('0x33')][_0x74c5('0x37')]));_0x115758[_0x74c5('0x36')]=_0x115758[_0x74c5('0x36')]['length']?_0x115758['attributes']:_0x37ee5d[_0x74c5('0x31')];if(_0x79f72c[_0x74c5('0x33')][_0x74c5('0x44')]){_0x115758[_0x74c5('0x45')]=[{'all':!![]}];}_0x115758=_[_0x74c5('0x3f')]({},_0x115758,_0x79f72c['options']);return db[_0x74c5('0x43')]['find'](_0x115758)['then'](handleEntityNotFound(_0xa0f2e,null))[_0x74c5('0x27')](respondWithResult(_0xa0f2e,null))[_0x74c5('0x4c')](handleError(_0xa0f2e,null));};exports[_0x74c5('0x28')]=function(_0x4b6975,_0x146d25){return db[_0x74c5('0x43')][_0x74c5('0x4d')]({'where':{'id':_0x4b6975[_0x74c5('0x49')]['id']}})[_0x74c5('0x27')](handleEntityNotFound(_0x146d25,null))[_0x74c5('0x27')](removeEntity(_0x146d25,null))[_0x74c5('0x4c')](handleError(_0x146d25,null));};exports[_0x74c5('0x4e')]=function(_0x128c6b,_0x50ef17){return db[_0x74c5('0x43')]['describe']()[_0x74c5('0x27')](respondWithResult(_0x50ef17,null))[_0x74c5('0x4c')](handleError(_0x50ef17,null));};exports[_0x74c5('0x4f')]=function(_0x3532a6,_0x2ef636){var _0x3dbd56;return db[_0x74c5('0x50')][_0x74c5('0x51')](function(_0x13342c){return db[_0x74c5('0x43')][_0x74c5('0x4f')](_0x3532a6[_0x74c5('0x52')],{'transaction':_0x13342c})[_0x74c5('0x27')](function(_0x192fd7){_0x3dbd56=_0x192fd7[_0x74c5('0x53')]({'plain':!![]});return db[_0x74c5('0x54')]['find']({'where':{'id':_0x3dbd56[_0x74c5('0x55')]},'raw':!![]})[_0x74c5('0x27')](function(_0xb94d18){return createVoicePrefixExtensions(_0x3dbd56,_0xb94d18,_0x13342c);});});})[_0x74c5('0x27')](function(){var _0x318c5f=_0x3532a6[_0x74c5('0x56')][_0x74c5('0x53')]({'plain':!![]});if(!_0x318c5f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x318c5f[_0x74c5('0x57')]==='user'){var _0xf9ba27=_0x3dbd56;return db[_0x74c5('0x58')]['find']({'where':{'name':_0x74c5('0x29'),'userProfileId':_0x318c5f[_0x74c5('0x59')]},'raw':!![]})[_0x74c5('0x27')](function(_0x3b68c8){if(_0x3b68c8&&_0x3b68c8['autoAssociation']===0x0){return db[_0x74c5('0x2a')][_0x74c5('0x4f')]({'name':_0xf9ba27['name'],'resourceId':_0xf9ba27['id'],'type':_0x3b68c8[_0x74c5('0x32')],'sectionId':_0x3b68c8['id']},{})[_0x74c5('0x27')](function(){return _0x3dbd56;});}else{return _0x3dbd56;}})[_0x74c5('0x4c')](function(_0x1af25a){logger[_0x74c5('0x5a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1af25a);throw _0x1af25a;});}return _0x3dbd56;})[_0x74c5('0x27')](respondWithResult(_0x2ef636,null))[_0x74c5('0x4c')](handleError(_0x2ef636,null));};function Extension(_0x50191c,_0x92469f,_0x237590,_0x305cbf){this[_0x74c5('0x5b')]='from-sip';this[_0x74c5('0x5c')]=_0x50191c;this['app']=_0x237590;this[_0x74c5('0x2f')]=_0x74c5('0x5d');this['description']=_0x74c5('0x5e');this['priority']=_0x92469f;this[_0x74c5('0x5f')]=_0x305cbf;}function createVoicePrefixExtensions(_0x453ec9,_0x1168c1,_0x3b84b2){return new BPromise(function(_0x25ed4d,_0x4119ce){var _0x4a9371=new Extension(formatPrefixName(_0x453ec9['prefix']),0x1,_0x74c5('0x60'),_0x74c5('0x61'));_0x4a9371[_0x74c5('0x62')]=_0x453ec9['id'];return db['VoiceExtension'][_0x74c5('0x4f')](_0x4a9371,{'transaction':_0x3b84b2})[_0x74c5('0x27')](function(_0xfc7e3d){var _0x35c065=_0xfc7e3d[_0x74c5('0x53')]({'plain':!![]});var _0x19cc9e=_[_0x74c5('0x2d')](addVoicePrefixExtensions(_0x453ec9,_0x1168c1),function(_0x5edf6d){_0x5edf6d[_0x74c5('0x55')]=_0x35c065['id'];_0x5edf6d[_0x74c5('0x62')]=_0x453ec9['id'];return _0x5edf6d;});return db[_0x74c5('0x54')][_0x74c5('0x63')](_0x19cc9e,{'transaction':_0x3b84b2})['then'](function(_0x1217bc){if(!_0x1217bc){return _0x4119ce(_0x74c5('0x64'));}else{return _0x25ed4d(_0x1217bc);}})[_0x74c5('0x4c')](function(_0x409868){return _0x4119ce(_0x409868);});});;});};function addVoicePrefixExtensions(_0x23cc21,_0x5b237a){var _0x6cafaa=[];var _0x47ecfa=formatPrefixName(_0x23cc21[_0x74c5('0x65')]);_0x6cafaa[_0x74c5('0x66')](new Extension(_0x47ecfa,0x2,_0x74c5('0x67'),'CDR(prefix)='+_0x23cc21['name']));if(_0x23cc21[_0x74c5('0x68')]){_0x6cafaa[_0x74c5('0x66')](new Extension(_0x47ecfa,0x3,_0x74c5('0x67'),_0x74c5('0x69')+_0x23cc21[_0x74c5('0x68')]));}else{_0x6cafaa[_0x74c5('0x66')](new Extension(_0x47ecfa,0x3,_0x74c5('0x60'),_0x74c5('0x6a')));}_0x6cafaa['push'](new Extension(_0x47ecfa,0x4,_0x74c5('0x6b'),_0x5b237a[_0x74c5('0x5b')]+','+_0x74c5('0x6c')+(0x8+_0x23cc21[_0x74c5('0x32')][_0x74c5('0x38')])+'}'+','+0x1));return _0x6cafaa;}function formatPrefixName(_0x1df794){var _0x589578='_';for(var _0x26b9a4=0x0;_0x26b9a4<_0x1df794[_0x74c5('0x38')];_0x26b9a4++){if(_0x1df794['charAt'](_0x26b9a4)=='-'){_0x589578+=_0x1df794[_0x74c5('0x6d')](_0x26b9a4);}else{_0x589578+='['+_0x1df794[_0x74c5('0x6d')](_0x26b9a4)+']';}}_0x589578+='.';return _0x589578;}exports[_0x74c5('0x26')]=function(_0xcbc1d2,_0x970a9b,_0x3de59c){var _0x553515=_0xcbc1d2[_0x74c5('0x52')];_0x553515[_0x74c5('0x65')]='system-'+_0x553515[_0x74c5('0x32')]+'-';return db[_0x74c5('0x50')][_0x74c5('0x51')](function(_0xe1e587){return db[_0x74c5('0x43')][_0x74c5('0x26')](_0x553515,{'where':{'id':_0x553515['id']},'transaction':_0xe1e587})['then'](function(){return db[_0x74c5('0x54')]['destroy']({'where':{'VoicePrefixId':_0x553515['id']},'transaction':_0xe1e587})[_0x74c5('0x27')](function(){return db[_0x74c5('0x54')]['find']({'where':{'id':_0x553515[_0x74c5('0x55')]},'raw':!![]})['then'](function(_0xcd4d49){return createVoicePrefixExtensions(_0x553515,_0xcd4d49,_0xe1e587);});});});})[_0x74c5('0x27')](function(){return db[_0x74c5('0x43')][_0x74c5('0x6e')](_0x553515['id']);})[_0x74c5('0x27')](respondWithResult(_0x970a9b,null))[_0x74c5('0x4c')](handleError(_0x970a9b,null));};exports[_0x74c5('0x6f')]=function(_0x1bcd55,_0x100de8,_0x2eff40){return db[_0x74c5('0x43')][_0x74c5('0x4d')]({'where':{'id':_0x1bcd55['params']['id']}})[_0x74c5('0x27')](handleEntityNotFound(_0x100de8,null))[_0x74c5('0x27')](function(_0x9c062f){if(_0x9c062f){return _0x9c062f[_0x74c5('0x6f')](_0x1bcd55['body'][_0x74c5('0x70')],_[_0x74c5('0x71')](_0x1bcd55['body'],[_0x74c5('0x70'),'id'])||{})['spread'](function(_0x2708d5){for(var _0x473a74=0x0;_0x473a74<_0x1bcd55[_0x74c5('0x52')][_0x74c5('0x70')][_0x74c5('0x38')];_0x473a74+=0x1){socket[_0x74c5('0x72')](_0x74c5('0x73'),{'UserId':_0x1bcd55[_0x74c5('0x52')][_0x74c5('0x70')][_0x473a74],'VoicePrefixId':_0x1bcd55[_0x74c5('0x49')]['id']});}return _0x2708d5;});}})[_0x74c5('0x27')](respondWithResult(_0x100de8,null))[_0x74c5('0x4c')](handleError(_0x100de8,null));};exports[_0x74c5('0x74')]=function(_0x633255,_0x4c6fd8,_0x25b542){return db['VoicePrefix'][_0x74c5('0x4d')]({'where':{'id':_0x633255[_0x74c5('0x49')]['id']}})['then'](handleEntityNotFound(_0x4c6fd8,null))[_0x74c5('0x27')](function(_0x5894d9){if(_0x5894d9){return _0x5894d9[_0x74c5('0x74')](_0x633255[_0x74c5('0x33')][_0x74c5('0x70')])[_0x74c5('0x27')](function(){if(_['isArray'](_0x633255['query']['ids'])){for(var _0x36a587=0x0;_0x36a587<_0x633255['query'][_0x74c5('0x70')][_0x74c5('0x38')];_0x36a587+=0x1){socket['emit'](_0x74c5('0x75'),{'UserId':Number(_0x633255['query'][_0x74c5('0x70')][_0x36a587]),'VoicePrefixId':Number(_0x633255[_0x74c5('0x49')]['id'])});}}else{socket[_0x74c5('0x72')](_0x74c5('0x75'),{'UserId':Number(_0x633255[_0x74c5('0x33')][_0x74c5('0x70')]),'VoicePrefixId':Number(_0x633255[_0x74c5('0x49')]['id'])});}});}})[_0x74c5('0x27')](respondWithStatusCode(_0x4c6fd8,null))[_0x74c5('0x4c')](handleError(_0x4c6fd8,null));};exports[_0x74c5('0x76')]=function(_0x462b42,_0x96999b,_0x47eb82){var _0xe93cd9={};var _0x1dba83={};var _0x170b3b;var _0x24db96;return db[_0x74c5('0x43')][_0x74c5('0x77')]({'where':{'id':_0x462b42['params']['id']}})['then'](handleEntityNotFound(_0x96999b,null))[_0x74c5('0x27')](function(_0xe3411d){if(_0xe3411d){_0x170b3b=_0xe3411d;_0x1dba83[_0x74c5('0x31')]=_['keys'](db[_0x74c5('0x78')][_0x74c5('0x4b')]);_0x1dba83['query']=_[_0x74c5('0x4a')](_0x462b42[_0x74c5('0x33')]);_0x1dba83['filters']=_['intersection'](_0x1dba83[_0x74c5('0x31')],_0x1dba83['query']);_0xe93cd9['attributes']=_[_0x74c5('0x35')](_0x1dba83[_0x74c5('0x31')],qs[_0x74c5('0x37')](_0x462b42[_0x74c5('0x33')][_0x74c5('0x37')]));_0xe93cd9[_0x74c5('0x36')]=_0xe93cd9[_0x74c5('0x36')][_0x74c5('0x38')]?_0xe93cd9['attributes']:_0x1dba83['model'];_0xe93cd9[_0x74c5('0x3b')]=qs['sort'](_0x462b42['query'][_0x74c5('0x3c')]);_0xe93cd9[_0x74c5('0x3d')]=qs[_0x74c5('0x34')](_[_0x74c5('0x3e')](_0x462b42[_0x74c5('0x33')],_0x1dba83[_0x74c5('0x34')]));if(_0x462b42[_0x74c5('0x33')][_0x74c5('0x41')]){_0xe93cd9[_0x74c5('0x3d')]=_[_0x74c5('0x3f')](_0xe93cd9[_0x74c5('0x3d')],{'$or':_['map'](_0xe93cd9[_0x74c5('0x36')],function(_0x10eafc){var _0x1cc051={};_0x1cc051[_0x10eafc]={'$like':'%'+_0x462b42['query'][_0x74c5('0x41')]+'%'};return _0x1cc051;})});}_0xe93cd9=_['merge']({},_0xe93cd9,_0x462b42[_0x74c5('0x42')]);return _0x170b3b['getAgents'](_0xe93cd9);}})[_0x74c5('0x27')](function(_0x16c212){if(_0x16c212){_0x24db96=_0x16c212[_0x74c5('0x38')];if(!_0x462b42[_0x74c5('0x33')][_0x74c5('0x39')](_0x74c5('0x3a'))){_0xe93cd9[_0x74c5('0x21')]=qs[_0x74c5('0x21')](_0x462b42[_0x74c5('0x33')][_0x74c5('0x21')]);_0xe93cd9[_0x74c5('0x20')]=qs[_0x74c5('0x20')](_0x462b42[_0x74c5('0x33')][_0x74c5('0x20')]);}return _0x170b3b['getAgents'](_0xe93cd9);}})['then'](function(_0x89481b){if(_0x89481b){return _0x89481b?{'count':_0x24db96,'rows':_0x89481b}:null;}})[_0x74c5('0x27')](respondWithResult(_0x96999b,null))['catch'](handleError(_0x96999b,null));}; \ No newline at end of file +var _0x7839=['CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','NoOp','goto','context','${EXTEN:','charAt','update','sequelize','transaction','findById','addAgents','ids','omit','spread','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','emit','findOne','User','pick','getAgents','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','localhost','./voicePrefix.socket','status','end','json','offset','limit','set','Content-Range','apply','reject','save','then','get','VoicePrefixes','UserProfileResource','destroy','sendStatus','error','stack','name','VoicePrefix','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','map','VIRTUAL','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','describe','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','appdata','prefix','Voice\x20Prefix','VoicePrefixId','VoiceExtension','VoiceExtensionId','Extensions\x20creation\x20failed','push','Set'];(function(_0x15fe57,_0x50c402){var _0x21c3d8=function(_0x737874){while(--_0x737874){_0x15fe57['push'](_0x15fe57['shift']());}};_0x21c3d8(++_0x50c402);}(_0x7839,0x190));var _0x9783=function(_0x30b36d,_0x1988f4){_0x30b36d=_0x30b36d-0x0;var _0x452d50=_0x7839[_0x30b36d];return _0x452d50;};'use strict';var pdf=require(_0x9783('0x0'));var emlformat=require(_0x9783('0x1'));var rimraf=require(_0x9783('0x2'));var zipdir=require(_0x9783('0x3'));var jsonpatch=require(_0x9783('0x4'));var rp=require('request-promise');var moment=require(_0x9783('0x5'));var BPromise=require(_0x9783('0x6'));var Mustache=require(_0x9783('0x7'));var util=require(_0x9783('0x8'));var path=require(_0x9783('0x9'));var sox=require(_0x9783('0xa'));var csv=require(_0x9783('0xb'));var ejs=require(_0x9783('0xc'));var fs=require('fs');var _=require(_0x9783('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x9783('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x9783('0xf'));var Papa=require(_0x9783('0x10'));var Redis=require('ioredis');var authService=require(_0x9783('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9783('0x12'));var hardwareService=require(_0x9783('0x13'));var logger=require(_0x9783('0x14'))(_0x9783('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x9783('0x16'))['db'];config[_0x9783('0x17')]=_[_0x9783('0x18')](config[_0x9783('0x17')],{'host':_0x9783('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9783('0x17')]));require(_0x9783('0x1a'))['register'](socket);function respondWithStatusCode(_0x3ba5ab,_0x453fab){_0x453fab=_0x453fab||0xcc;return function(_0xb6652){if(_0xb6652){return _0x3ba5ab['sendStatus'](_0x453fab);}return _0x3ba5ab[_0x9783('0x1b')](_0x453fab)[_0x9783('0x1c')]();};}function respondWithResult(_0x2d3003,_0x3f6a90){_0x3f6a90=_0x3f6a90||0xc8;return function(_0x28f528){if(_0x28f528){return _0x2d3003[_0x9783('0x1b')](_0x3f6a90)[_0x9783('0x1d')](_0x28f528);}};}function respondWithFilteredResult(_0x517b88,_0x81d600){return function(_0x6547e4){if(_0x6547e4){var _0x21653e=_0x6547e4['count'],_0x5406f6=_0x81d600['offset'],_0x452792=_0x81d600[_0x9783('0x1e')]+_0x81d600[_0x9783('0x1f')],_0x109f95;if(_0x452792>=_0x21653e){_0x452792=_0x21653e;_0x109f95=0xc8;}else{_0x109f95=0xce;}_0x517b88[_0x9783('0x1b')](_0x109f95);return _0x517b88[_0x9783('0x20')](_0x9783('0x21'),_0x5406f6+'-'+_0x452792+'/'+_0x21653e)[_0x9783('0x1d')](_0x6547e4);}return null;};}function patchUpdates(_0x2d900e){return function(_0x2a90c9){try{jsonpatch[_0x9783('0x22')](_0x2a90c9,_0x2d900e,!![]);}catch(_0x54c2fd){return BPromise[_0x9783('0x23')](_0x54c2fd);}return _0x2a90c9[_0x9783('0x24')]();};}function saveUpdates(_0x2b4b92,_0x1fa66b){return function(_0x5bd550){if(_0x5bd550){return _0x5bd550['update'](_0x2b4b92)[_0x9783('0x25')](function(_0xc3bad){return _0xc3bad;});}return null;};}function removeEntity(_0xa6d2ee,_0x432583){return function(_0x407fc2){if(_0x407fc2){return _0x407fc2['destroy']()[_0x9783('0x25')](function(){var _0x265b07=_0x407fc2[_0x9783('0x26')]({'plain':!![]});var _0x4f9067=_0x9783('0x27');return db[_0x9783('0x28')][_0x9783('0x29')]({'where':{'type':_0x4f9067,'resourceId':_0x265b07['id']}})[_0x9783('0x25')](function(){return _0x407fc2;});})[_0x9783('0x25')](function(){_0xa6d2ee['status'](0xcc)[_0x9783('0x1c')]();});}};}function handleEntityNotFound(_0x2595f6,_0x1cd275){return function(_0x5e7ceb){if(!_0x5e7ceb){_0x2595f6[_0x9783('0x2a')](0x194);}return _0x5e7ceb;};}function handleError(_0x5d7ec1,_0x4f602c){_0x4f602c=_0x4f602c||0x1f4;return function(_0x208d80){logger[_0x9783('0x2b')](_0x208d80[_0x9783('0x2c')]);if(_0x208d80[_0x9783('0x2d')]){delete _0x208d80[_0x9783('0x2d')];}_0x5d7ec1[_0x9783('0x1b')](_0x4f602c)['send'](_0x208d80);};}exports['index']=function(_0x17d603,_0x3197ac){var _0x2cb512={},_0x1cdfce={},_0x50a0f6={'count':0x0,'rows':[]};var _0x31afc6=_['map'](db[_0x9783('0x2e')]['rawAttributes'],function(_0x1d2c21){return{'name':_0x1d2c21['fieldName'],'type':_0x1d2c21[_0x9783('0x2f')][_0x9783('0x30')]};});_0x1cdfce['model']=_['map'](_0x31afc6,_0x9783('0x2d'));_0x1cdfce[_0x9783('0x31')]=_[_0x9783('0x32')](_0x17d603[_0x9783('0x31')]);_0x1cdfce[_0x9783('0x33')]=_['intersection'](_0x1cdfce[_0x9783('0x34')],_0x1cdfce['query']);_0x2cb512[_0x9783('0x35')]=_[_0x9783('0x36')](_0x1cdfce['model'],qs['fields'](_0x17d603[_0x9783('0x31')][_0x9783('0x37')]));_0x2cb512[_0x9783('0x35')]=_0x2cb512[_0x9783('0x35')][_0x9783('0x38')]?_0x2cb512['attributes']:_0x1cdfce[_0x9783('0x34')];if(!_0x17d603[_0x9783('0x31')][_0x9783('0x39')](_0x9783('0x3a'))){_0x2cb512[_0x9783('0x1f')]=qs['limit'](_0x17d603[_0x9783('0x31')][_0x9783('0x1f')]);_0x2cb512[_0x9783('0x1e')]=qs[_0x9783('0x1e')](_0x17d603['query'][_0x9783('0x1e')]);}_0x2cb512['order']=qs['sort'](_0x17d603[_0x9783('0x31')][_0x9783('0x3b')]);_0x2cb512['where']=qs['filters'](_['pick'](_0x17d603[_0x9783('0x31')],_0x1cdfce[_0x9783('0x33')]));if(_0x17d603[_0x9783('0x31')][_0x9783('0x3c')]){_0x2cb512['where']=_[_0x9783('0x3d')](_0x2cb512[_0x9783('0x3e')],{'$or':_[_0x9783('0x3f')](_0x31afc6,function(_0x308b3d){if(_0x308b3d[_0x9783('0x2f')]!==_0x9783('0x40')){var _0x3068b3={};_0x3068b3[_0x308b3d[_0x9783('0x2d')]]={'$like':'%'+_0x17d603[_0x9783('0x31')][_0x9783('0x3c')]+'%'};return _0x3068b3;}})});}_0x2cb512=_[_0x9783('0x3d')]({},_0x2cb512,_0x17d603[_0x9783('0x41')]);var _0x3b531b={'where':_0x2cb512[_0x9783('0x3e')]};return db['VoicePrefix'][_0x9783('0x42')](_0x3b531b)[_0x9783('0x25')](function(_0x4b24c6){_0x50a0f6[_0x9783('0x42')]=_0x4b24c6;if(_0x17d603[_0x9783('0x31')][_0x9783('0x43')]){_0x2cb512['include']=[{'all':!![]}];}return db[_0x9783('0x2e')][_0x9783('0x44')](_0x2cb512);})[_0x9783('0x25')](function(_0x5e6430){_0x50a0f6[_0x9783('0x45')]=_0x5e6430;return _0x50a0f6;})[_0x9783('0x25')](respondWithFilteredResult(_0x3197ac,_0x2cb512))[_0x9783('0x46')](handleError(_0x3197ac,null));};exports[_0x9783('0x47')]=function(_0xf032fb,_0x440016){var _0x7f7615={'raw':![],'where':{'id':_0xf032fb[_0x9783('0x48')]['id']}},_0xe75751={};_0xe75751['model']=_[_0x9783('0x32')](db[_0x9783('0x2e')][_0x9783('0x49')]);_0xe75751[_0x9783('0x31')]=_[_0x9783('0x32')](_0xf032fb[_0x9783('0x31')]);_0xe75751[_0x9783('0x33')]=_[_0x9783('0x36')](_0xe75751[_0x9783('0x34')],_0xe75751[_0x9783('0x31')]);_0x7f7615['attributes']=_[_0x9783('0x36')](_0xe75751[_0x9783('0x34')],qs[_0x9783('0x37')](_0xf032fb['query'][_0x9783('0x37')]));_0x7f7615['attributes']=_0x7f7615[_0x9783('0x35')][_0x9783('0x38')]?_0x7f7615[_0x9783('0x35')]:_0xe75751['model'];if(_0xf032fb[_0x9783('0x31')]['includeAll']){_0x7f7615[_0x9783('0x4a')]=[{'all':!![]}];}_0x7f7615=_[_0x9783('0x3d')]({},_0x7f7615,_0xf032fb[_0x9783('0x41')]);return db[_0x9783('0x2e')][_0x9783('0x4b')](_0x7f7615)[_0x9783('0x25')](handleEntityNotFound(_0x440016,null))[_0x9783('0x25')](respondWithResult(_0x440016,null))[_0x9783('0x46')](handleError(_0x440016,null));};exports[_0x9783('0x29')]=function(_0x2a984a,_0x4c3525){return db[_0x9783('0x2e')]['find']({'where':{'id':_0x2a984a[_0x9783('0x48')]['id']}})[_0x9783('0x25')](handleEntityNotFound(_0x4c3525,null))[_0x9783('0x25')](removeEntity(_0x4c3525,null))[_0x9783('0x46')](handleError(_0x4c3525,null));};exports[_0x9783('0x4c')]=function(_0x56e32b,_0x12911d){return db[_0x9783('0x2e')][_0x9783('0x4c')]()[_0x9783('0x25')](respondWithResult(_0x12911d,null))[_0x9783('0x46')](handleError(_0x12911d,null));};exports[_0x9783('0x4d')]=function(_0x470104,_0x4b9c7b){var _0x5d219c;return db['sequelize']['transaction'](function(_0xd587fd){return db[_0x9783('0x2e')][_0x9783('0x4d')](_0x470104[_0x9783('0x4e')],{'transaction':_0xd587fd})[_0x9783('0x25')](function(_0x3356c9){_0x5d219c=_0x3356c9['get']({'plain':!![]});return db['VoiceExtension'][_0x9783('0x4b')]({'where':{'id':_0x5d219c['VoiceExtensionId']},'raw':!![]})[_0x9783('0x25')](function(_0x2bfbd9){return createVoicePrefixExtensions(_0x5d219c,_0x2bfbd9,_0xd587fd);});});})['then'](function(){var _0x3d5d23=_0x470104[_0x9783('0x4f')]['get']({'plain':!![]});if(!_0x3d5d23)throw new Error(_0x9783('0x50'));if(_0x3d5d23['role']===_0x9783('0x4f')){var _0x22efd0=_0x5d219c;return db[_0x9783('0x51')]['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x3d5d23[_0x9783('0x52')]},'raw':!![]})[_0x9783('0x25')](function(_0xed5d49){if(_0xed5d49&&_0xed5d49[_0x9783('0x53')]===0x0){return db[_0x9783('0x28')][_0x9783('0x4d')]({'name':_0x22efd0[_0x9783('0x2d')],'resourceId':_0x22efd0['id'],'type':_0xed5d49[_0x9783('0x2d')],'sectionId':_0xed5d49['id']},{})[_0x9783('0x25')](function(){return _0x5d219c;});}else{return _0x5d219c;}})['catch'](function(_0x4391b7){logger[_0x9783('0x2b')](_0x9783('0x54'),_0x4391b7);throw _0x4391b7;});}return _0x5d219c;})[_0x9783('0x25')](respondWithResult(_0x4b9c7b,null))[_0x9783('0x46')](handleError(_0x4b9c7b,null));};function Extension(_0x4a42a7,_0x12514d,_0x2763d9,_0x333bb){this['context']=_0x9783('0x55');this[_0x9783('0x56')]=_0x4a42a7;this[_0x9783('0x57')]=_0x2763d9;this[_0x9783('0x2f')]=_0x9783('0x58');this[_0x9783('0x59')]=_0x9783('0x5a');this['priority']=_0x12514d;this[_0x9783('0x5b')]=_0x333bb;}function createVoicePrefixExtensions(_0x54fb50,_0x1c516b,_0xab9f8f){return new BPromise(function(_0xe7a284,_0x2e0161){var _0x449d28=new Extension(formatPrefixName(_0x54fb50[_0x9783('0x5c')]),0x1,'NoOp',_0x9783('0x5d'));_0x449d28[_0x9783('0x5e')]=_0x54fb50['id'];return db[_0x9783('0x5f')][_0x9783('0x4d')](_0x449d28,{'transaction':_0xab9f8f})[_0x9783('0x25')](function(_0x321e6e){var _0x15199f=_0x321e6e[_0x9783('0x26')]({'plain':!![]});var _0x1f228f=_['map'](addVoicePrefixExtensions(_0x54fb50,_0x1c516b),function(_0x30a01b){_0x30a01b[_0x9783('0x60')]=_0x15199f['id'];_0x30a01b[_0x9783('0x5e')]=_0x54fb50['id'];return _0x30a01b;});return db[_0x9783('0x5f')]['bulkCreate'](_0x1f228f,{'transaction':_0xab9f8f})[_0x9783('0x25')](function(_0x25b08d){if(!_0x25b08d){return _0x2e0161(_0x9783('0x61'));}else{return _0xe7a284(_0x25b08d);}})[_0x9783('0x46')](function(_0x35cd87){return _0x2e0161(_0x35cd87);});});;});};function addVoicePrefixExtensions(_0x4fb9b7,_0x39f53b){var _0x239a5c=[];var _0x352ec1=formatPrefixName(_0x4fb9b7[_0x9783('0x5c')]);_0x239a5c[_0x9783('0x62')](new Extension(_0x352ec1,0x2,_0x9783('0x63'),_0x9783('0x64')+_0x4fb9b7['name']));if(_0x4fb9b7[_0x9783('0x65')]){_0x239a5c[_0x9783('0x62')](new Extension(_0x352ec1,0x3,'Set',_0x9783('0x66')+_0x4fb9b7[_0x9783('0x65')]));}else{_0x239a5c[_0x9783('0x62')](new Extension(_0x352ec1,0x3,_0x9783('0x67'),'No\x20callerid\x20available'));}_0x239a5c[_0x9783('0x62')](new Extension(_0x352ec1,0x4,_0x9783('0x68'),_0x39f53b[_0x9783('0x69')]+','+_0x9783('0x6a')+(0x8+_0x4fb9b7[_0x9783('0x2d')]['length'])+'}'+','+0x1));return _0x239a5c;}function formatPrefixName(_0x329273){var _0x35a6c3='_';for(var _0x3c7f03=0x0;_0x3c7f03<_0x329273[_0x9783('0x38')];_0x3c7f03++){if(_0x329273['charAt'](_0x3c7f03)=='-'){_0x35a6c3+=_0x329273[_0x9783('0x6b')](_0x3c7f03);}else{_0x35a6c3+='['+_0x329273[_0x9783('0x6b')](_0x3c7f03)+']';}}_0x35a6c3+='.';return _0x35a6c3;}exports[_0x9783('0x6c')]=function(_0x472bcb,_0x2d7c8e,_0x35d700){var _0x41f8ba=_0x472bcb[_0x9783('0x4e')];_0x41f8ba['prefix']='system-'+_0x41f8ba[_0x9783('0x2d')]+'-';return db[_0x9783('0x6d')][_0x9783('0x6e')](function(_0x5b3891){return db[_0x9783('0x2e')]['update'](_0x41f8ba,{'where':{'id':_0x41f8ba['id']},'transaction':_0x5b3891})[_0x9783('0x25')](function(){return db[_0x9783('0x5f')]['destroy']({'where':{'VoicePrefixId':_0x41f8ba['id']},'transaction':_0x5b3891})[_0x9783('0x25')](function(){return db[_0x9783('0x5f')][_0x9783('0x4b')]({'where':{'id':_0x41f8ba[_0x9783('0x60')]},'raw':!![]})[_0x9783('0x25')](function(_0x5de100){return createVoicePrefixExtensions(_0x41f8ba,_0x5de100,_0x5b3891);});});});})[_0x9783('0x25')](function(){return db['VoicePrefix'][_0x9783('0x6f')](_0x41f8ba['id']);})['then'](respondWithResult(_0x2d7c8e,null))[_0x9783('0x46')](handleError(_0x2d7c8e,null));};exports[_0x9783('0x70')]=function(_0x27ffcb,_0x59150e,_0x425419){return db[_0x9783('0x2e')][_0x9783('0x4b')]({'where':{'id':_0x27ffcb['params']['id']}})[_0x9783('0x25')](handleEntityNotFound(_0x59150e,null))[_0x9783('0x25')](function(_0x3b3374){if(_0x3b3374){return _0x3b3374['addAgents'](_0x27ffcb[_0x9783('0x4e')][_0x9783('0x71')],_[_0x9783('0x72')](_0x27ffcb[_0x9783('0x4e')],[_0x9783('0x71'),'id'])||{})[_0x9783('0x73')](function(_0x5f1b42){for(var _0x4d2da9=0x0;_0x4d2da9<_0x27ffcb[_0x9783('0x4e')][_0x9783('0x71')][_0x9783('0x38')];_0x4d2da9+=0x1){socket['emit'](_0x9783('0x74'),{'UserId':_0x27ffcb[_0x9783('0x4e')][_0x9783('0x71')][_0x4d2da9],'VoicePrefixId':_0x27ffcb[_0x9783('0x48')]['id']});}return _0x5f1b42;});}})[_0x9783('0x25')](respondWithResult(_0x59150e,null))[_0x9783('0x46')](handleError(_0x59150e,null));};exports[_0x9783('0x75')]=function(_0x10c7ea,_0x11cf67,_0x5bd6a9){return db[_0x9783('0x2e')][_0x9783('0x4b')]({'where':{'id':_0x10c7ea['params']['id']}})[_0x9783('0x25')](handleEntityNotFound(_0x11cf67,null))[_0x9783('0x25')](function(_0x38dc89){if(_0x38dc89){return _0x38dc89['removeAgents'](_0x10c7ea[_0x9783('0x31')]['ids'])[_0x9783('0x25')](function(){if(_[_0x9783('0x76')](_0x10c7ea[_0x9783('0x31')][_0x9783('0x71')])){for(var _0x3c0709=0x0;_0x3c0709<_0x10c7ea['query'][_0x9783('0x71')][_0x9783('0x38')];_0x3c0709+=0x1){socket['emit'](_0x9783('0x77'),{'UserId':Number(_0x10c7ea['query'][_0x9783('0x71')][_0x3c0709]),'VoicePrefixId':Number(_0x10c7ea[_0x9783('0x48')]['id'])});}}else{socket[_0x9783('0x78')]('userVoicePrefix:remove',{'UserId':Number(_0x10c7ea[_0x9783('0x31')]['ids']),'VoicePrefixId':Number(_0x10c7ea[_0x9783('0x48')]['id'])});}});}})[_0x9783('0x25')](respondWithStatusCode(_0x11cf67,null))[_0x9783('0x46')](handleError(_0x11cf67,null));};exports['getAgents']=function(_0x15a120,_0x14edc0,_0x43a91c){var _0x31e107={};var _0x206058={};var _0x26261f;var _0x32714f;return db['VoicePrefix'][_0x9783('0x79')]({'where':{'id':_0x15a120[_0x9783('0x48')]['id']}})['then'](handleEntityNotFound(_0x14edc0,null))[_0x9783('0x25')](function(_0xea19ff){if(_0xea19ff){_0x26261f=_0xea19ff;_0x206058[_0x9783('0x34')]=_[_0x9783('0x32')](db[_0x9783('0x7a')]['rawAttributes']);_0x206058[_0x9783('0x31')]=_[_0x9783('0x32')](_0x15a120['query']);_0x206058['filters']=_[_0x9783('0x36')](_0x206058[_0x9783('0x34')],_0x206058[_0x9783('0x31')]);_0x31e107['attributes']=_[_0x9783('0x36')](_0x206058[_0x9783('0x34')],qs[_0x9783('0x37')](_0x15a120['query'][_0x9783('0x37')]));_0x31e107[_0x9783('0x35')]=_0x31e107[_0x9783('0x35')][_0x9783('0x38')]?_0x31e107[_0x9783('0x35')]:_0x206058[_0x9783('0x34')];_0x31e107['order']=qs[_0x9783('0x3b')](_0x15a120[_0x9783('0x31')][_0x9783('0x3b')]);_0x31e107['where']=qs[_0x9783('0x33')](_[_0x9783('0x7b')](_0x15a120[_0x9783('0x31')],_0x206058[_0x9783('0x33')]));if(_0x15a120[_0x9783('0x31')]['filter']){_0x31e107['where']=_['merge'](_0x31e107[_0x9783('0x3e')],{'$or':_['map'](_0x31e107[_0x9783('0x35')],function(_0x3db839){var _0x278867={};_0x278867[_0x3db839]={'$like':'%'+_0x15a120['query']['filter']+'%'};return _0x278867;})});}_0x31e107=_[_0x9783('0x3d')]({},_0x31e107,_0x15a120[_0x9783('0x41')]);return _0x26261f[_0x9783('0x7c')](_0x31e107);}})[_0x9783('0x25')](function(_0x31774a){if(_0x31774a){_0x32714f=_0x31774a[_0x9783('0x38')];if(!_0x15a120['query']['hasOwnProperty'](_0x9783('0x3a'))){_0x31e107[_0x9783('0x1f')]=qs[_0x9783('0x1f')](_0x15a120[_0x9783('0x31')][_0x9783('0x1f')]);_0x31e107[_0x9783('0x1e')]=qs[_0x9783('0x1e')](_0x15a120[_0x9783('0x31')]['offset']);}return _0x26261f['getAgents'](_0x31e107);}})[_0x9783('0x25')](function(_0x4e91dd){if(_0x4e91dd){return _0x4e91dd?{'count':_0x32714f,'rows':_0x4e91dd}:null;}})[_0x9783('0x25')](respondWithResult(_0x14edc0,null))[_0x9783('0x46')](handleError(_0x14edc0,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 960bc80..53dc780 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 _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0x1f9435,_0x176fe1){var _0xd0926=function(_0xf11e15){while(--_0xf11e15){_0x1f9435['push'](_0x1f9435['shift']());}};_0xd0926(++_0x176fe1);}(_0x008c,0x188));var _0xc008=function(_0x3a094d,_0x2811f1){_0x3a094d=_0x3a094d-0x0;var _0x2fce9f=_0x008c[_0x3a094d];return _0x2fce9f;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file +var _0x008c=['save','remove','emit','hasOwnProperty','hook','events','../../mysqldb','VoicePrefix','setMaxListeners'];(function(_0xa5441f,_0x157c4c){var _0x3b2259=function(_0x1a3531){while(--_0x1a3531){_0xa5441f['push'](_0xa5441f['shift']());}};_0x3b2259(++_0x157c4c);}(_0x008c,0x188));var _0xc008=function(_0x1123bb,_0x54472a){_0x1123bb=_0x1123bb-0x0;var _0xdeb602=_0x008c[_0x1123bb];return _0xdeb602;};'use strict';var EventEmitter=require(_0xc008('0x0'));var VoicePrefix=require(_0xc008('0x1'))['db'][_0xc008('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xc008('0x3')](0x0);var events={'afterCreate':_0xc008('0x4'),'afterUpdate':'update','afterDestroy':_0xc008('0x5')};function emitEvent(_0x47063f){return function(_0x10b33c,_0x163bd9,_0x1cbe76){VoicePrefixEvents[_0xc008('0x6')](_0x47063f+':'+_0x10b33c['id'],_0x10b33c);VoicePrefixEvents[_0xc008('0x6')](_0x47063f,_0x10b33c);_0x1cbe76(null);};}for(var e in events){if(events[_0xc008('0x7')](e)){var event=events[e];VoicePrefix[_0xc008('0x8')](e,emitEvent(event));}}module['exports']=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 96111d5..264c73a 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 _0xbd71=['moment','bluebird','path','rimraf','../../config/environment','./voicePrefix.attributes','define','VoicePrefix','voice_prefixes','lodash','../../config/logger','api'];(function(_0x55c979,_0x36c5f0){var _0x690107=function(_0xa61dad){while(--_0xa61dad){_0x55c979['push'](_0x55c979['shift']());}};_0x690107(++_0x36c5f0);}(_0xbd71,0x81));var _0x1bd7=function(_0x2d1c48,_0x3230cd){_0x2d1c48=_0x2d1c48-0x0;var _0x3bdc70=_0xbd71[_0x2d1c48];return _0x3bdc70;};'use strict';var _=require(_0x1bd7('0x0'));var util=require('util');var logger=require(_0x1bd7('0x1'))(_0x1bd7('0x2'));var moment=require(_0x1bd7('0x3'));var BPromise=require(_0x1bd7('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bd7('0x5'));var rimraf=require(_0x1bd7('0x6'));var config=require(_0x1bd7('0x7'));var attributes=require(_0x1bd7('0x8'));module['exports']=function(_0x5b69d3,_0x504728){return _0x5b69d3[_0x1bd7('0x9')](_0x1bd7('0xa'),attributes,{'tableName':_0x1bd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb942=['../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x35288d,_0x1908d2){var _0x1d2c2b=function(_0x19bfac){while(--_0x19bfac){_0x35288d['push'](_0x35288d['shift']());}};_0x1d2c2b(++_0x1908d2);}(_0xb942,0x7e));var _0x2b94=function(_0x3421b0,_0x22c2d9){_0x3421b0=_0x3421b0-0x0;var _0x39bd77=_0xb942[_0x3421b0];return _0x39bd77;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b94('0x0'))(_0x2b94('0x1'));var moment=require('moment');var BPromise=require(_0x2b94('0x2'));var rp=require(_0x2b94('0x3'));var fs=require('fs');var path=require(_0x2b94('0x4'));var rimraf=require(_0x2b94('0x5'));var config=require(_0x2b94('0x6'));var attributes=require(_0x2b94('0x7'));module[_0x2b94('0x8')]=function(_0xc1f79d,_0x973f06){return _0xc1f79d[_0x2b94('0x9')](_0x2b94('0xa'),attributes,{'tableName':_0x2b94('0xb'),'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 4e3ec5b..573563d 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 _0x07e8=['then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./voicePrefix.socket','register','request'];(function(_0x560331,_0x39e881){var _0x35f1ae=function(_0x74ad75){while(--_0x74ad75){_0x560331['push'](_0x560331['shift']());}};_0x35f1ae(++_0x39e881);}(_0x07e8,0x10f));var _0x807e=function(_0x41f3fd,_0x50d0c2){_0x41f3fd=_0x41f3fd-0x0;var _0x3a836f=_0x07e8[_0x41f3fd];return _0x3a836f;};'use strict';var _=require(_0x807e('0x0'));var util=require(_0x807e('0x1'));var moment=require(_0x807e('0x2'));var BPromise=require('bluebird');var rs=require(_0x807e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x807e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x807e('0x5'));var config=require(_0x807e('0x6'));var jayson=require(_0x807e('0x7'));var client=jayson['client'][_0x807e('0x8')]({'port':0x232a});config[_0x807e('0x9')]=_[_0x807e('0xa')](config[_0x807e('0x9')],{'host':_0x807e('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x807e('0x9')]));require(_0x807e('0xc'))[_0x807e('0xd')](socket);function respondWithRpcPromise(_0x3c6c7a,_0x1c2fdd,_0x45e953){return new BPromise(function(_0x382931,_0x2f44db){return client[_0x807e('0xe')](_0x3c6c7a,_0x45e953)[_0x807e('0xf')](function(_0x2ca6f0){logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,_0x807e('0x12'));logger['debug'](_0x807e('0x13'),_0x1c2fdd,_0x807e('0x12'),JSON[_0x807e('0x14')](_0x2ca6f0));if(_0x2ca6f0[_0x807e('0x15')]){if(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x16')]===0x1f4){logger[_0x807e('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0['error'][_0x807e('0x17')]);return _0x2f44db(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}logger[_0x807e('0x15')]('VoicePrefix,\x20%s,\x20%s',_0x1c2fdd,_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);return _0x382931(_0x2ca6f0[_0x807e('0x15')][_0x807e('0x17')]);}else{logger[_0x807e('0x10')](_0x807e('0x11'),_0x1c2fdd,'request\x20sent');_0x382931(_0x2ca6f0[_0x807e('0x18')]['message']);}})[_0x807e('0x19')](function(_0x328290){logger[_0x807e('0x15')](_0x807e('0x11'),_0x1c2fdd,_0x328290);_0x2f44db(_0x328290);});});} \ No newline at end of file +var _0x0782=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x3d6135,_0x256136){var _0x16f3c1=function(_0x5e7576){while(--_0x5e7576){_0x3d6135['push'](_0x3d6135['shift']());}};_0x16f3c1(++_0x256136);}(_0x0782,0x7e));var _0x2078=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x0782[_0x2b4411];return _0x8e41ef;};'use strict';var _=require('lodash');var util=require(_0x2078('0x0'));var moment=require(_0x2078('0x1'));var BPromise=require(_0x2078('0x2'));var rs=require(_0x2078('0x3'));var fs=require('fs');var Redis=require(_0x2078('0x4'));var db=require(_0x2078('0x5'))['db'];var utils=require(_0x2078('0x6'));var logger=require('../../config/logger')(_0x2078('0x7'));var config=require(_0x2078('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x2078('0x9')][_0x2078('0xa')]({'port':0x232a});config[_0x2078('0xb')]=_[_0x2078('0xc')](config['redis'],{'host':_0x2078('0xd'),'port':0x18eb});var socket=require(_0x2078('0xe'))(new Redis(config[_0x2078('0xb')]));require(_0x2078('0xf'))['register'](socket);function respondWithRpcPromise(_0x44600d,_0x257d12,_0xd2205d){return new BPromise(function(_0x549c2a,_0x2a54d9){return client['request'](_0x44600d,_0xd2205d)['then'](function(_0x206917){logger[_0x2078('0x10')](_0x2078('0x11'),_0x257d12,_0x2078('0x12'));logger[_0x2078('0x13')](_0x2078('0x14'),_0x257d12,_0x2078('0x12'),JSON[_0x2078('0x15')](_0x206917));if(_0x206917[_0x2078('0x16')]){if(_0x206917['error']['code']===0x1f4){logger[_0x2078('0x16')](_0x2078('0x11'),_0x257d12,_0x206917['error'][_0x2078('0x17')]);return _0x2a54d9(_0x206917[_0x2078('0x16')][_0x2078('0x17')]);}logger[_0x2078('0x16')](_0x2078('0x11'),_0x257d12,_0x206917[_0x2078('0x16')][_0x2078('0x17')]);return _0x549c2a(_0x206917[_0x2078('0x16')][_0x2078('0x17')]);}else{logger[_0x2078('0x10')](_0x2078('0x11'),_0x257d12,'request\x20sent');_0x549c2a(_0x206917[_0x2078('0x18')][_0x2078('0x17')]);}})[_0x2078('0x19')](function(_0x370b53){logger[_0x2078('0x16')](_0x2078('0x11'),_0x257d12,_0x370b53);_0x2a54d9(_0x370b53);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 3ab5b37..64dbf6d 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 _0x2f97=['length','voicePrefix:','./voicePrefix.events','remove','removeListener'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2f97,0xc0));var _0x72f9=function(_0x1a0d40,_0xda8c93){_0x1a0d40=_0x1a0d40-0x0;var _0x3f3ae4=_0x2f97[_0x1a0d40];return _0x3f3ae4;};'use strict';var VoicePrefixEvents=require(_0x72f9('0x0'));var events=['save',_0x72f9('0x1'),'update'];function createListener(_0x2fedda,_0x3740fc){return function(_0x1516b8){_0x3740fc['emit'](_0x2fedda,_0x1516b8);};}function removeListener(_0x4d9460,_0xbb4e48){return function(){VoicePrefixEvents[_0x72f9('0x2')](_0x4d9460,_0xbb4e48);};}exports['register']=function(_0xd37e40){for(var _0x4894e5=0x0,_0x38da8f=events[_0x72f9('0x3')];_0x4894e5<_0x38da8f;_0x4894e5++){var _0x21e92e=events[_0x4894e5];var _0x44ca9a=createListener(_0x72f9('0x4')+_0x21e92e,_0xd37e40);VoicePrefixEvents['on'](_0x21e92e,_0x44ca9a);}}; \ No newline at end of file +var _0xfbef=['./voicePrefix.events','save','remove','update','emit','removeListener','register','length','voicePrefix:'];(function(_0x15278d,_0x313596){var _0x21c8a7=function(_0x321be9){while(--_0x321be9){_0x15278d['push'](_0x15278d['shift']());}};_0x21c8a7(++_0x313596);}(_0xfbef,0x99));var _0xffbe=function(_0x3d0ce5,_0x4fc389){_0x3d0ce5=_0x3d0ce5-0x0;var _0x461bc5=_0xfbef[_0x3d0ce5];return _0x461bc5;};'use strict';var VoicePrefixEvents=require(_0xffbe('0x0'));var events=[_0xffbe('0x1'),_0xffbe('0x2'),_0xffbe('0x3')];function createListener(_0x4d35cb,_0x9f0361){return function(_0x53505b){_0x9f0361[_0xffbe('0x4')](_0x4d35cb,_0x53505b);};}function removeListener(_0x571ae3,_0x59bb38){return function(){VoicePrefixEvents[_0xffbe('0x5')](_0x571ae3,_0x59bb38);};}exports[_0xffbe('0x6')]=function(_0x8f4eea){for(var _0x1a915b=0x0,_0x24e9f7=events[_0xffbe('0x7')];_0x1a915b<_0x24e9f7;_0x1a915b++){var _0x1c49ec=events[_0x1a915b];var _0x36b58a=createListener(_0xffbe('0x8')+_0x1c49ec,_0x8f4eea);VoicePrefixEvents['on'](_0x1c49ec,_0x36b58a);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index d12679a..3f6f125 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 _0x4133=['/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','addTeams','/:id/users','addAgents','addLists','addBlackLists','put','destroy','delete','removeTeams','removeAgents','/:id/lists','removeBlackLists','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','/:id/teams','getAgents','/:id/members','getMembers','getLists'];(function(_0x45f779,_0xd14a77){var _0xb28541=function(_0x596394){while(--_0x596394){_0x45f779['push'](_0x45f779['shift']());}};_0xb28541(++_0xd14a77);}(_0x4133,0xe5));var _0x3413=function(_0x53a7d,_0x3df61f){_0x53a7d=_0x53a7d-0x0;var _0x1f0308=_0x4133[_0x53a7d];return _0x1f0308;};'use strict';var multer=require(_0x3413('0x0'));var util=require('util');var path=require(_0x3413('0x1'));var timeout=require('connect-timeout');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('./voiceQueue.controller');router['get']('/',auth[_0x3413('0x7')](),controller[_0x3413('0x8')]);router[_0x3413('0x9')](_0x3413('0xa'),auth[_0x3413('0x7')](),controller[_0x3413('0xb')]);router['get'](_0x3413('0xc'),auth[_0x3413('0x7')](),controller[_0x3413('0xd')]);router['get'](_0x3413('0xe'),auth[_0x3413('0x7')](),controller[_0x3413('0xf')]);router[_0x3413('0x9')](_0x3413('0x10'),auth[_0x3413('0x7')](),controller['getHopperFinals']);router[_0x3413('0x9')](_0x3413('0x11'),auth[_0x3413('0x7')](),controller['getHopperBlacks']);router['get'](_0x3413('0x12'),auth['isAuthenticated'](),controller['getTeams']);router[_0x3413('0x9')]('/:id/users',auth['isAuthenticated'](),controller[_0x3413('0x13')]);router[_0x3413('0x9')](_0x3413('0x14'),auth[_0x3413('0x7')](),controller[_0x3413('0x15')]);router[_0x3413('0x9')]('/:id/lists',auth[_0x3413('0x7')](),controller[_0x3413('0x16')]);router[_0x3413('0x9')](_0x3413('0x17'),auth[_0x3413('0x7')](),controller[_0x3413('0x18')]);router[_0x3413('0x19')]('/',auth['isAuthenticated'](),controller[_0x3413('0x1a')]);router[_0x3413('0x19')](_0x3413('0x1b'),auth[_0x3413('0x7')](),controller[_0x3413('0x1c')]);router[_0x3413('0x19')]('/:id/teams',auth[_0x3413('0x7')](),controller[_0x3413('0x1d')]);router[_0x3413('0x19')](_0x3413('0x1e'),auth['isAuthenticated'](),controller[_0x3413('0x1f')]);router[_0x3413('0x19')]('/:id/lists',auth[_0x3413('0x7')](),controller[_0x3413('0x20')]);router[_0x3413('0x19')](_0x3413('0x17'),auth['isAuthenticated'](),controller[_0x3413('0x21')]);router[_0x3413('0x22')](_0x3413('0xa'),auth[_0x3413('0x7')](),controller['update']);router['delete'](_0x3413('0xa'),auth[_0x3413('0x7')](),controller[_0x3413('0x23')]);router[_0x3413('0x24')](_0x3413('0x12'),auth[_0x3413('0x7')](),controller[_0x3413('0x25')]);router['delete']('/:id/users',auth[_0x3413('0x7')](),controller[_0x3413('0x26')]);router['delete'](_0x3413('0x27'),auth['isAuthenticated'](),controller['removeLists']);router[_0x3413('0x24')](_0x3413('0x17'),auth[_0x3413('0x7')](),controller[_0x3413('0x28')]);module[_0x3413('0x29')]=router; \ No newline at end of file +var _0xd59a=['../../config/environment','./voiceQueue.controller','get','isAuthenticated','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','getTeams','/:id/users','getAgents','getLists','/:id/blacklists','getBlackLists','post','create','/:id/clone','clone','/:id/teams','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x100338,_0x5cdbcc){var _0x330d32=function(_0x50c3dc){while(--_0x50c3dc){_0x100338['push'](_0x100338['shift']());}};_0x330d32(++_0x5cdbcc);}(_0xd59a,0x81));var _0xad59=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xd59a[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0xad59('0x0'));var path=require(_0xad59('0x1'));var timeout=require('connect-timeout');var express=require(_0xad59('0x2'));var router=express[_0xad59('0x3')]();var auth=require(_0xad59('0x4'));var interaction=require(_0xad59('0x5'));var config=require(_0xad59('0x6'));var controller=require(_0xad59('0x7'));router[_0xad59('0x8')]('/',auth[_0xad59('0x9')](),controller['index']);router[_0xad59('0x8')](_0xad59('0xa'),auth[_0xad59('0x9')](),controller[_0xad59('0xb')]);router['get'](_0xad59('0xc'),auth['isAuthenticated'](),controller[_0xad59('0xd')]);router[_0xad59('0x8')](_0xad59('0xe'),auth[_0xad59('0x9')](),controller[_0xad59('0xf')]);router['get'](_0xad59('0x10'),auth['isAuthenticated'](),controller[_0xad59('0x11')]);router['get'](_0xad59('0x12'),auth[_0xad59('0x9')](),controller[_0xad59('0x13')]);router[_0xad59('0x8')]('/:id/teams',auth[_0xad59('0x9')](),controller[_0xad59('0x14')]);router['get'](_0xad59('0x15'),auth[_0xad59('0x9')](),controller[_0xad59('0x16')]);router[_0xad59('0x8')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router['get']('/:id/lists',auth['isAuthenticated'](),controller[_0xad59('0x17')]);router[_0xad59('0x8')](_0xad59('0x18'),auth[_0xad59('0x9')](),controller[_0xad59('0x19')]);router[_0xad59('0x1a')]('/',auth[_0xad59('0x9')](),controller[_0xad59('0x1b')]);router[_0xad59('0x1a')](_0xad59('0x1c'),auth[_0xad59('0x9')](),controller[_0xad59('0x1d')]);router['post'](_0xad59('0x1e'),auth['isAuthenticated'](),controller[_0xad59('0x1f')]);router[_0xad59('0x1a')](_0xad59('0x15'),auth['isAuthenticated'](),controller[_0xad59('0x20')]);router[_0xad59('0x1a')](_0xad59('0x21'),auth[_0xad59('0x9')](),controller[_0xad59('0x22')]);router[_0xad59('0x1a')](_0xad59('0x18'),auth[_0xad59('0x9')](),controller[_0xad59('0x23')]);router[_0xad59('0x24')](_0xad59('0xa'),auth[_0xad59('0x9')](),controller[_0xad59('0x25')]);router[_0xad59('0x26')](_0xad59('0xa'),auth[_0xad59('0x9')](),controller[_0xad59('0x27')]);router[_0xad59('0x26')]('/:id/teams',auth['isAuthenticated'](),controller[_0xad59('0x28')]);router['delete'](_0xad59('0x15'),auth['isAuthenticated'](),controller[_0xad59('0x29')]);router[_0xad59('0x26')](_0xad59('0x21'),auth[_0xad59('0x9')](),controller[_0xad59('0x2a')]);router[_0xad59('0x26')](_0xad59('0x18'),auth[_0xad59('0x9')](),controller[_0xad59('0x2b')]);module[_0xad59('0x2c')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index b0a423a..cc8bea9 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(_0x487f15,_0x1cf5fb){var _0x32c8a1=function(_0x255c2f){while(--_0x255c2f){_0x487f15['push'](_0x487f15['shift']());}};_0x32c8a1(++_0x1cf5fb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa9e0[_0x4e1d03];return _0x362d4b;};'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(_0x3003fc,_0x5ac5de){var _0x22cb43=function(_0x478661){while(--_0x478661){_0x3003fc['push'](_0x3003fc['shift']());}};_0x22cb43(++_0x5ac5de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa9e0[_0x1facfa];return _0x9ec701;};'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 3240597..4efff4c 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 _0xdf92=['getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','Team','addTeams','teams','User','online','voicePause','interface','flatMap','Agents','penalty','sequelize','transaction','each','findOrCreate','UserVoiceQueueRt','upsert','format','SIP/%s','forEach','emit','userVoiceQueue:save','ids','field','tq.TeamId','team_has_voice_queues','join','user_has_teams','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','SELECT','TeamId','all','compact','removeTeams','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','push','isArray','getAgents','getMembers','getLists','CmList','addLists','spread','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','NOW()','ContactId','ListId\x20=\x20?','CmListId','phone\x20NOT\x20IN\x20(?)','select','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','phone','cm_contacts','phone\x20IS\x20NOT\x20NULL','deletedAt\x20IS\x20NULL','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','./voiceQueue.socket','register','sendStatus','status','end','count','offset','Content-Range','json','apply','reject','save','then','destroy','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','find','UserProfileResource','error','stack','name','send','index','map','VoiceQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','params','keys','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','VoiceQueues','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','updatedAt','createdAt','role','UserProfileSection','update','getHoppers','findOne','CmHopper','hasOwnProperty','nolimit','VoiceQueueId','findAll','rows','getHopperHistories','CmHopperHistory'];(function(_0xc618bc,_0x42b9e4){var _0x462e3f=function(_0x10e4ff){while(--_0x10e4ff){_0xc618bc['push'](_0xc618bc['shift']());}};_0x462e3f(++_0x42b9e4);}(_0xdf92,0x10c));var _0x2df9=function(_0x41e429,_0x168fd){_0x41e429=_0x41e429-0x0;var _0x3124e=_0xdf92[_0x41e429];return _0x3124e;};'use strict';var pdf=require(_0x2df9('0x0'));var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2df9('0x1'));var jsonpatch=require(_0x2df9('0x2'));var rp=require(_0x2df9('0x3'));var moment=require(_0x2df9('0x4'));var BPromise=require(_0x2df9('0x5'));var Mustache=require(_0x2df9('0x6'));var util=require(_0x2df9('0x7'));var path=require(_0x2df9('0x8'));var sox=require(_0x2df9('0x9'));var csv=require(_0x2df9('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2df9('0xb'));var squel=require(_0x2df9('0xc'));var crypto=require(_0x2df9('0xd'));var jsforce=require(_0x2df9('0xe'));var deskjs=require(_0x2df9('0xf'));var toCsv=require('to-csv');var querystring=require(_0x2df9('0x10'));var Papa=require(_0x2df9('0x11'));var Redis=require(_0x2df9('0x12'));var authService=require(_0x2df9('0x13'));var qs=require(_0x2df9('0x14'));var as=require(_0x2df9('0x15'));var hardwareService=require(_0x2df9('0x16'));var logger=require(_0x2df9('0x17'))(_0x2df9('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var db=require(_0x2df9('0x19'))['db'];config['redis']=_[_0x2df9('0x1a')](config[_0x2df9('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2df9('0x1b')]));require(_0x2df9('0x1c'))[_0x2df9('0x1d')](socket);function respondWithStatusCode(_0x2be1d2,_0x5737dc){_0x5737dc=_0x5737dc||0xcc;return function(_0x2dc037){if(_0x2dc037){return _0x2be1d2[_0x2df9('0x1e')](_0x5737dc);}return _0x2be1d2[_0x2df9('0x1f')](_0x5737dc)[_0x2df9('0x20')]();};}function respondWithResult(_0x3e5ec5,_0x544736){_0x544736=_0x544736||0xc8;return function(_0x1a955a){if(_0x1a955a){return _0x3e5ec5[_0x2df9('0x1f')](_0x544736)['json'](_0x1a955a);}};}function respondWithFilteredResult(_0x3eb28b,_0x3e19b9){return function(_0x19524e){if(_0x19524e){var _0xd48d46=_0x19524e[_0x2df9('0x21')],_0x2ed7e3=_0x3e19b9['offset'],_0x46763a=_0x3e19b9[_0x2df9('0x22')]+_0x3e19b9['limit'],_0x4e6e3e;if(_0x46763a>=_0xd48d46){_0x46763a=_0xd48d46;_0x4e6e3e=0xc8;}else{_0x4e6e3e=0xce;}_0x3eb28b[_0x2df9('0x1f')](_0x4e6e3e);return _0x3eb28b['set'](_0x2df9('0x23'),_0x2ed7e3+'-'+_0x46763a+'/'+_0xd48d46)[_0x2df9('0x24')](_0x19524e);}return null;};}function patchUpdates(_0x2bf7ff){return function(_0x110d9b){try{jsonpatch[_0x2df9('0x25')](_0x110d9b,_0x2bf7ff,!![]);}catch(_0xf37b82){return BPromise[_0x2df9('0x26')](_0xf37b82);}return _0x110d9b[_0x2df9('0x27')]();};}function saveUpdates(_0x4b70f5,_0x5a1586){return function(_0x38fa9f){if(_0x38fa9f){return _0x38fa9f['update'](_0x4b70f5)[_0x2df9('0x28')](function(_0x37a1c4){return _0x37a1c4;});}return null;};}function removeEntity(_0x160a25,_0x294fea){return function(_0x41150b){if(_0x41150b){return _0x41150b[_0x2df9('0x29')]()['then'](function(){var _0x5c77a0=_0x41150b['get']({'plain':!![]});var _0x59c2bb=[{'name':'VoiceQueues','value':_0x2df9('0x2a'),'ignore':![]},{'name':_0x2df9('0x2b'),'value':_0x2df9('0x2c'),'ignore':![]}];var _0x19855e=_(_0x59c2bb)[_0x2df9('0x2d')](_0x2df9('0x2e'))['map'](_0x2df9('0x2f'))[_0x2df9('0x2f')]();if(_[_0x2df9('0x30')](_0x19855e,_0x5c77a0[_0x2df9('0x31')])){return;}var _0x588fe5=_[_0x2df9('0x32')](_0x59c2bb,[_0x2df9('0x2f'),_0x5c77a0[_0x2df9('0x31')]])['name'];return db[_0x2df9('0x33')][_0x2df9('0x29')]({'where':{'type':_0x588fe5,'resourceId':_0x5c77a0['id']}})[_0x2df9('0x28')](function(){return _0x41150b;});})[_0x2df9('0x28')](function(){_0x160a25[_0x2df9('0x1f')](0xcc)[_0x2df9('0x20')]();});}};}function handleEntityNotFound(_0x1e010f,_0x5d96f6){return function(_0x43726b){if(!_0x43726b){_0x1e010f['sendStatus'](0x194);}return _0x43726b;};}function handleError(_0x32a11e,_0x3f0a65){_0x3f0a65=_0x3f0a65||0x1f4;return function(_0x3b0ace){logger[_0x2df9('0x34')](_0x3b0ace[_0x2df9('0x35')]);if(_0x3b0ace[_0x2df9('0x36')]){delete _0x3b0ace['name'];}_0x32a11e[_0x2df9('0x1f')](_0x3f0a65)[_0x2df9('0x37')](_0x3b0ace);};}exports[_0x2df9('0x38')]=function(_0x2957b4,_0x90ec05){var _0x366c60={},_0x98f0bd={},_0x50b2d1={'count':0x0,'rows':[]};var _0x4c371b=_[_0x2df9('0x39')](db[_0x2df9('0x3a')][_0x2df9('0x3b')],function(_0x6e6e72){return{'name':_0x6e6e72[_0x2df9('0x3c')],'type':_0x6e6e72[_0x2df9('0x31')][_0x2df9('0x3d')]};});_0x98f0bd['model']=_[_0x2df9('0x39')](_0x4c371b,_0x2df9('0x36'));_0x98f0bd[_0x2df9('0x3e')]=_['keys'](_0x2957b4[_0x2df9('0x3e')]);_0x98f0bd[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x98f0bd[_0x2df9('0x41')],_0x98f0bd[_0x2df9('0x3e')]);_0x366c60[_0x2df9('0x42')]=_['intersection'](_0x98f0bd[_0x2df9('0x41')],qs[_0x2df9('0x43')](_0x2957b4[_0x2df9('0x3e')]['fields']));_0x366c60[_0x2df9('0x42')]=_0x366c60[_0x2df9('0x42')][_0x2df9('0x44')]?_0x366c60[_0x2df9('0x42')]:_0x98f0bd['model'];if(!_0x2957b4[_0x2df9('0x3e')]['hasOwnProperty']('nolimit')){_0x366c60[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x2957b4[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x366c60['offset']=qs[_0x2df9('0x22')](_0x2957b4[_0x2df9('0x3e')][_0x2df9('0x22')]);}_0x366c60[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x2957b4[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x366c60[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x2957b4[_0x2df9('0x3e')],_0x98f0bd['filters']));if(_0x2957b4[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x366c60[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x366c60[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x4c371b,function(_0x50ed9a){if(_0x50ed9a[_0x2df9('0x31')]!==_0x2df9('0x4b')){var _0x49036c={};_0x49036c[_0x50ed9a[_0x2df9('0x36')]]={'$like':'%'+_0x2957b4['query'][_0x2df9('0x2d')]+'%'};return _0x49036c;}})});}_0x366c60=_[_0x2df9('0x4a')]({},_0x366c60,_0x2957b4[_0x2df9('0x4c')]);var _0x407a8b={'where':_0x366c60[_0x2df9('0x48')]};return db[_0x2df9('0x3a')][_0x2df9('0x21')](_0x407a8b)[_0x2df9('0x28')](function(_0x39698a){_0x50b2d1[_0x2df9('0x21')]=_0x39698a;if(_0x2957b4[_0x2df9('0x3e')][_0x2df9('0x4d')]){_0x366c60[_0x2df9('0x4e')]=[{'all':!![]}];}return db[_0x2df9('0x3a')]['findAll'](_0x366c60);})[_0x2df9('0x28')](function(_0x4a5134){_0x50b2d1['rows']=_0x4a5134;return _0x50b2d1;})['then'](respondWithFilteredResult(_0x90ec05,_0x366c60))['catch'](handleError(_0x90ec05,null));};exports['show']=function(_0x976c6e,_0x274268){var _0xb78868={'raw':![],'where':{'id':_0x976c6e[_0x2df9('0x4f')]['id']}},_0xd34970={};_0xd34970[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x3a')]['rawAttributes']);_0xd34970[_0x2df9('0x3e')]=_['keys'](_0x976c6e[_0x2df9('0x3e')]);_0xd34970[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0xd34970['model'],_0xd34970[_0x2df9('0x3e')]);_0xb78868[_0x2df9('0x42')]=_['intersection'](_0xd34970[_0x2df9('0x41')],qs['fields'](_0x976c6e[_0x2df9('0x3e')]['fields']));_0xb78868['attributes']=_0xb78868[_0x2df9('0x42')][_0x2df9('0x44')]?_0xb78868['attributes']:_0xd34970[_0x2df9('0x41')];if(_0x976c6e[_0x2df9('0x3e')][_0x2df9('0x4d')]){_0xb78868['include']=[{'all':!![]}];}_0xb78868=_[_0x2df9('0x4a')]({},_0xb78868,_0x976c6e[_0x2df9('0x4c')]);return db[_0x2df9('0x3a')][_0x2df9('0x32')](_0xb78868)[_0x2df9('0x28')](handleEntityNotFound(_0x274268,null))[_0x2df9('0x28')](respondWithResult(_0x274268,null))[_0x2df9('0x51')](handleError(_0x274268,null));};exports[_0x2df9('0x52')]=function(_0x30d5a7,_0x46c416){return db[_0x2df9('0x3a')][_0x2df9('0x52')](_0x30d5a7[_0x2df9('0x53')],{})[_0x2df9('0x28')](function(_0x316f86){var _0x3e73a3=_0x30d5a7[_0x2df9('0x54')][_0x2df9('0x55')]({'plain':!![]});if(!_0x3e73a3)throw new Error(_0x2df9('0x56'));if(_0x3e73a3['role']===_0x2df9('0x54')){var _0x2efdef=_0x316f86[_0x2df9('0x55')]({'plain':!![]});var _0x37ce18=[{'name':_0x2df9('0x57'),'value':'inbound'},{'name':_0x2df9('0x2b'),'value':_0x2df9('0x2c')}];var _0x4392bd=_[_0x2df9('0x32')](_0x37ce18,[_0x2df9('0x2f'),_0x2efdef[_0x2df9('0x31')]])[_0x2df9('0x36')];return db['UserProfileSection']['find']({'where':{'name':_0x4392bd,'userProfileId':_0x3e73a3[_0x2df9('0x58')]},'raw':!![]})[_0x2df9('0x28')](function(_0x7bf0c5){if(_0x7bf0c5&&_0x7bf0c5[_0x2df9('0x59')]===0x0){return db[_0x2df9('0x33')]['create']({'name':_0x2efdef[_0x2df9('0x36')],'resourceId':_0x2efdef['id'],'type':_0x7bf0c5[_0x2df9('0x36')],'sectionId':_0x7bf0c5['id']},{})[_0x2df9('0x28')](function(){return _0x316f86;});}else{return _0x316f86;}})['catch'](function(_0x1bec31){logger['error'](_0x2df9('0x5a'),_0x1bec31);throw _0x1bec31;});}return _0x316f86;})['then'](respondWithResult(_0x46c416,0xc9))[_0x2df9('0x51')](handleError(_0x46c416,null));};exports[_0x2df9('0x5b')]=function(_0x5e3196,_0x6b0830){var _0x7fc7b8={'where':{'id':_0x5e3196[_0x2df9('0x4f')]['id']}},_0x40334d={};_0x40334d[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x3a')][_0x2df9('0x3b')]);_0x7fc7b8[_0x2df9('0x42')]=_['intersection'](_0x40334d[_0x2df9('0x41')],qs[_0x2df9('0x43')](_0x5e3196[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x7fc7b8[_0x2df9('0x42')]=_0x7fc7b8[_0x2df9('0x42')][_0x2df9('0x44')]?_0x7fc7b8[_0x2df9('0x42')]:_0x40334d[_0x2df9('0x41')];if(_0x5e3196['query'][_0x2df9('0x4d')]){_0x7fc7b8[_0x2df9('0x4e')]=[{'all':!![]}];}_0x7fc7b8=_[_0x2df9('0x4a')]({},_0x7fc7b8,_0x5e3196[_0x2df9('0x4c')]);return db['VoiceQueue'][_0x2df9('0x32')](_0x7fc7b8)[_0x2df9('0x28')](handleEntityNotFound(_0x6b0830,null))[_0x2df9('0x28')](function(_0x2835df){if(_0x2835df){var _0x2045fd=_0x2835df[_0x2df9('0x55')]({'plain':!![]});_0x2045fd=qs[_0x2df9('0x5c')](_0x2045fd,['id','createdAt',_0x2df9('0x5d')]);_0x5e3196[_0x2df9('0x53')]=_[_0x2df9('0x5c')](_0x5e3196[_0x2df9('0x53')],['id',_0x2df9('0x5e'),_0x2df9('0x5d')]);return db[_0x2df9('0x3a')]['create'](_['merge'](_0x2045fd,_0x5e3196[_0x2df9('0x53')]),{'include':_0x5e3196[_0x2df9('0x3e')]['includeAll']?[{'all':!![]}]:undefined})[_0x2df9('0x28')](function(_0x1ba18c){var _0x142d75=_0x5e3196['user'][_0x2df9('0x55')]({'plain':!![]});if(!_0x142d75)throw new Error(_0x2df9('0x56'));if(_0x142d75[_0x2df9('0x5f')]===_0x2df9('0x54')){var _0x285612=_0x1ba18c[_0x2df9('0x55')]({'plain':!![]});var _0x4268a1=[{'name':_0x2df9('0x57'),'value':_0x2df9('0x2a')},{'name':_0x2df9('0x2b'),'value':_0x2df9('0x2c')}];var _0x4df79c=_[_0x2df9('0x32')](_0x4268a1,[_0x2df9('0x2f'),_0x285612[_0x2df9('0x31')]])[_0x2df9('0x36')];return db[_0x2df9('0x60')][_0x2df9('0x32')]({'where':{'name':_0x4df79c,'userProfileId':_0x142d75['userProfileId']},'raw':!![]})[_0x2df9('0x28')](function(_0x5d81f5){if(_0x5d81f5&&_0x5d81f5[_0x2df9('0x59')]===0x0){return db[_0x2df9('0x33')][_0x2df9('0x52')]({'name':_0x285612[_0x2df9('0x36')],'resourceId':_0x285612['id'],'type':_0x5d81f5[_0x2df9('0x36')],'sectionId':_0x5d81f5['id']},{})['then'](function(){return _0x1ba18c;});}else{return _0x1ba18c;}})[_0x2df9('0x51')](function(_0xf0d41e){logger['error'](_0x2df9('0x5a'),_0xf0d41e);throw _0xf0d41e;});}return _0x1ba18c;});}})[_0x2df9('0x28')](respondWithResult(_0x6b0830,0xc9))[_0x2df9('0x51')](handleError(_0x6b0830,null));};exports[_0x2df9('0x61')]=function(_0x21828d,_0x56d5f2){if(_0x21828d[_0x2df9('0x53')]['id']){delete _0x21828d[_0x2df9('0x53')]['id'];}return db[_0x2df9('0x3a')][_0x2df9('0x32')]({'where':{'id':_0x21828d['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x56d5f2,null))[_0x2df9('0x28')](saveUpdates(_0x21828d[_0x2df9('0x53')],null))[_0x2df9('0x28')](respondWithResult(_0x56d5f2,null))['catch'](handleError(_0x56d5f2,null));};exports[_0x2df9('0x29')]=function(_0x10b42b,_0x276f37){return db[_0x2df9('0x3a')][_0x2df9('0x32')]({'where':{'id':_0x10b42b[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x276f37,null))['then'](removeEntity(_0x276f37,null))['catch'](handleError(_0x276f37,null));};exports[_0x2df9('0x62')]=function(_0x20bb7e,_0x1d9bd4,_0x259975){var _0x25edca={'raw':![],'where':{}};var _0x35c466={};var _0x434c54={'count':0x0,'rows':[]};return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x20bb7e[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x1d9bd4,null))[_0x2df9('0x28')](function(_0x26f977){if(_0x26f977){_0x35c466['model']=_[_0x2df9('0x50')](db[_0x2df9('0x64')]['rawAttributes']);_0x35c466[_0x2df9('0x3e')]=_[_0x2df9('0x50')](_0x20bb7e[_0x2df9('0x3e')]);_0x35c466[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x35c466['model'],_0x35c466[_0x2df9('0x3e')]);_0x25edca[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x35c466[_0x2df9('0x41')],qs[_0x2df9('0x43')](_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x25edca[_0x2df9('0x42')]=_0x25edca[_0x2df9('0x42')]['length']?_0x25edca[_0x2df9('0x42')]:_0x35c466[_0x2df9('0x41')];if(!_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x65')](_0x2df9('0x66'))){_0x25edca[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x25edca['offset']=qs['offset'](_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x22')]);}_0x25edca[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x20bb7e['query'][_0x2df9('0x47')]);_0x25edca[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x20bb7e[_0x2df9('0x3e')],_0x35c466[_0x2df9('0x3f')]));_0x25edca['where'][_0x2df9('0x67')]=_0x26f977['id'];if(_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x25edca['where']=_[_0x2df9('0x4a')](_0x25edca['where'],{'$or':_[_0x2df9('0x39')](_0x25edca[_0x2df9('0x42')],function(_0x44db0d){var _0x5cfb23={};_0x5cfb23[_0x44db0d]={'$like':'%'+_0x20bb7e[_0x2df9('0x3e')][_0x2df9('0x2d')]+'%'};return _0x5cfb23;})});}_0x25edca=_[_0x2df9('0x4a')]({},_0x25edca,_0x20bb7e[_0x2df9('0x4c')]);return db[_0x2df9('0x64')][_0x2df9('0x21')]({'where':_0x25edca[_0x2df9('0x48')]})[_0x2df9('0x28')](function(_0x478320){_0x434c54[_0x2df9('0x21')]=_0x478320;if(_0x20bb7e[_0x2df9('0x3e')]['includeAll']){_0x25edca[_0x2df9('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0x2df9('0x68')](_0x25edca);})[_0x2df9('0x28')](function(_0x460779){_0x434c54[_0x2df9('0x69')]=_0x460779;return _0x434c54;});}})['then'](respondWithFilteredResult(_0x1d9bd4,_0x25edca))[_0x2df9('0x51')](handleError(_0x1d9bd4,null));};exports[_0x2df9('0x6a')]=function(_0x4b845b,_0x59cbf9,_0x5362bd){var _0x2a49cf={'raw':!![],'where':{}};var _0x418ffe={};var _0x586efe={'count':0x0,'rows':[]};return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x4b845b['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x59cbf9,null))[_0x2df9('0x28')](function(_0xae14ed){if(_0xae14ed){_0x418ffe[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x6b')][_0x2df9('0x3b')]);_0x418ffe['query']=_[_0x2df9('0x50')](_0x4b845b[_0x2df9('0x3e')]);_0x418ffe[_0x2df9('0x3f')]=_['intersection'](_0x418ffe['model'],_0x418ffe['query']);_0x2a49cf[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x418ffe['model'],qs[_0x2df9('0x43')](_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x2a49cf[_0x2df9('0x42')]=_0x2a49cf[_0x2df9('0x42')]['length']?_0x2a49cf[_0x2df9('0x42')]:_0x418ffe[_0x2df9('0x41')];if(!_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x65')]('nolimit')){_0x2a49cf[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x4b845b['query'][_0x2df9('0x45')]);_0x2a49cf[_0x2df9('0x22')]=qs[_0x2df9('0x22')](_0x4b845b['query'][_0x2df9('0x22')]);}_0x2a49cf[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x2a49cf[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x4b845b[_0x2df9('0x3e')],_0x418ffe[_0x2df9('0x3f')]));_0x2a49cf[_0x2df9('0x48')][_0x2df9('0x67')]=_0xae14ed['id'];if(_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x2a49cf[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x2a49cf[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x2a49cf[_0x2df9('0x42')],function(_0x20cbe4){var _0x197a72={};_0x197a72[_0x20cbe4]={'$like':'%'+_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x2d')]+'%'};return _0x197a72;})});}_0x2a49cf=_[_0x2df9('0x4a')]({},_0x2a49cf,_0x4b845b[_0x2df9('0x4c')]);return db[_0x2df9('0x6b')][_0x2df9('0x21')]({'where':_0x2a49cf[_0x2df9('0x48')]})[_0x2df9('0x28')](function(_0x2f75de){_0x586efe[_0x2df9('0x21')]=_0x2f75de;if(_0x4b845b[_0x2df9('0x3e')][_0x2df9('0x4d')]){_0x2a49cf[_0x2df9('0x4e')]=[{'all':!![]}];}return db[_0x2df9('0x6b')][_0x2df9('0x68')](_0x2a49cf);})[_0x2df9('0x28')](function(_0x517523){_0x586efe[_0x2df9('0x69')]=_0x517523;return _0x586efe;});}})[_0x2df9('0x28')](respondWithFilteredResult(_0x59cbf9,_0x2a49cf))[_0x2df9('0x51')](handleError(_0x59cbf9,null));};exports[_0x2df9('0x6c')]=function(_0x5b9220,_0x13dca3,_0x279eb6){var _0x270455={'raw':!![],'where':{}};var _0x40aa52={};var _0x43e197={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x2df9('0x63')]({'where':{'id':_0x5b9220[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x13dca3,null))[_0x2df9('0x28')](function(_0xa30871){if(_0xa30871){_0x40aa52[_0x2df9('0x41')]=_['keys'](db[_0x2df9('0x6d')]['rawAttributes']);_0x40aa52['query']=_[_0x2df9('0x50')](_0x5b9220[_0x2df9('0x3e')]);_0x40aa52[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x40aa52[_0x2df9('0x41')],_0x40aa52[_0x2df9('0x3e')]);_0x270455[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x40aa52['model'],qs[_0x2df9('0x43')](_0x5b9220['query'][_0x2df9('0x43')]));_0x270455[_0x2df9('0x42')]=_0x270455[_0x2df9('0x42')][_0x2df9('0x44')]?_0x270455[_0x2df9('0x42')]:_0x40aa52[_0x2df9('0x41')];if(!_0x5b9220['query'][_0x2df9('0x65')]('nolimit')){_0x270455[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x5b9220[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x270455[_0x2df9('0x22')]=qs[_0x2df9('0x22')](_0x5b9220[_0x2df9('0x3e')][_0x2df9('0x22')]);}_0x270455[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x5b9220['query'][_0x2df9('0x47')]);_0x270455['where']=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x5b9220[_0x2df9('0x3e')],_0x40aa52[_0x2df9('0x3f')]));_0x270455[_0x2df9('0x48')][_0x2df9('0x67')]=_0xa30871['id'];if(_0x5b9220[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x270455[_0x2df9('0x48')]=_['merge'](_0x270455['where'],{'$or':_['map'](_0x270455[_0x2df9('0x42')],function(_0x142e1d){var _0x2e72d8={};_0x2e72d8[_0x142e1d]={'$like':'%'+_0x5b9220['query']['filter']+'%'};return _0x2e72d8;})});}_0x270455=_['merge']({},_0x270455,_0x5b9220['options']);return db[_0x2df9('0x6d')][_0x2df9('0x21')]({'where':_0x270455[_0x2df9('0x48')]})[_0x2df9('0x28')](function(_0x1d518e){_0x43e197['count']=_0x1d518e;if(_0x5b9220['query'][_0x2df9('0x4d')]){_0x270455[_0x2df9('0x4e')]=[{'all':!![]}];}return db[_0x2df9('0x6d')][_0x2df9('0x68')](_0x270455);})[_0x2df9('0x28')](function(_0x26c261){_0x43e197['rows']=_0x26c261;return _0x43e197;});}})[_0x2df9('0x28')](respondWithFilteredResult(_0x13dca3,_0x270455))['catch'](handleError(_0x13dca3,null));};exports[_0x2df9('0x6e')]=function(_0x1d4197,_0x11c43c,_0x196501){var _0x2a1331={'raw':!![],'where':{}};var _0x1a5273={};var _0x248570={'count':0x0,'rows':[]};return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x1d4197['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x11c43c,null))['then'](function(_0x1d12b8){if(_0x1d12b8){_0x1a5273[_0x2df9('0x41')]=_[_0x2df9('0x50')](db['CmHopperBlack']['rawAttributes']);_0x1a5273[_0x2df9('0x3e')]=_[_0x2df9('0x50')](_0x1d4197[_0x2df9('0x3e')]);_0x1a5273[_0x2df9('0x3f')]=_['intersection'](_0x1a5273[_0x2df9('0x41')],_0x1a5273[_0x2df9('0x3e')]);_0x2a1331[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x1a5273[_0x2df9('0x41')],qs[_0x2df9('0x43')](_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x2a1331[_0x2df9('0x42')]=_0x2a1331[_0x2df9('0x42')][_0x2df9('0x44')]?_0x2a1331['attributes']:_0x1a5273[_0x2df9('0x41')];if(!_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x65')](_0x2df9('0x66'))){_0x2a1331[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x2a1331[_0x2df9('0x22')]=qs['offset'](_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x22')]);}_0x2a1331[_0x2df9('0x46')]=qs['sort'](_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x2a1331['where']=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x1d4197['query'],_0x1a5273[_0x2df9('0x3f')]));_0x2a1331[_0x2df9('0x48')]['VoiceQueueId']=_0x1d12b8['id'];if(_0x1d4197[_0x2df9('0x3e')]['filter']){_0x2a1331[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x2a1331[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x2a1331[_0x2df9('0x42')],function(_0x476eef){var _0x18125f={};_0x18125f[_0x476eef]={'$like':'%'+_0x1d4197[_0x2df9('0x3e')]['filter']+'%'};return _0x18125f;})});}_0x2a1331=_['merge']({},_0x2a1331,_0x1d4197[_0x2df9('0x4c')]);return db['CmHopperBlack'][_0x2df9('0x21')]({'where':_0x2a1331[_0x2df9('0x48')]})[_0x2df9('0x28')](function(_0x445f5f){_0x248570['count']=_0x445f5f;if(_0x1d4197[_0x2df9('0x3e')][_0x2df9('0x4d')]){_0x2a1331['include']=[{'all':!![]}];}return db[_0x2df9('0x6f')][_0x2df9('0x68')](_0x2a1331);})[_0x2df9('0x28')](function(_0x239fa0){_0x248570[_0x2df9('0x69')]=_0x239fa0;return _0x248570;});}})['then'](respondWithFilteredResult(_0x11c43c,_0x2a1331))[_0x2df9('0x51')](handleError(_0x11c43c,null));};exports[_0x2df9('0x70')]=function(_0x7b0b7e,_0x2a7e20,_0x3e5598){var _0x31597b={};var _0x9c9395={};var _0x5b69fd;var _0x421795;return db[_0x2df9('0x3a')]['findOne']({'where':{'id':_0x7b0b7e[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x2a7e20,null))[_0x2df9('0x28')](function(_0x5bbeb3){if(_0x5bbeb3){_0x5b69fd=_0x5bbeb3;_0x9c9395[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x71')][_0x2df9('0x3b')]);_0x9c9395[_0x2df9('0x3e')]=_[_0x2df9('0x50')](_0x7b0b7e[_0x2df9('0x3e')]);_0x9c9395[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x9c9395['model'],_0x9c9395[_0x2df9('0x3e')]);_0x31597b['attributes']=_[_0x2df9('0x40')](_0x9c9395[_0x2df9('0x41')],qs['fields'](_0x7b0b7e[_0x2df9('0x3e')]['fields']));_0x31597b[_0x2df9('0x42')]=_0x31597b[_0x2df9('0x42')][_0x2df9('0x44')]?_0x31597b['attributes']:_0x9c9395[_0x2df9('0x41')];_0x31597b[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x7b0b7e['query'][_0x2df9('0x47')]);_0x31597b['where']=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x7b0b7e['query'],_0x9c9395[_0x2df9('0x3f')]));if(_0x7b0b7e['query'][_0x2df9('0x2d')]){_0x31597b['where']=_[_0x2df9('0x4a')](_0x31597b[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x31597b[_0x2df9('0x42')],function(_0x5f0d4d){var _0x3d6c92={};_0x3d6c92[_0x5f0d4d]={'$like':'%'+_0x7b0b7e[_0x2df9('0x3e')][_0x2df9('0x2d')]+'%'};return _0x3d6c92;})});}_0x31597b=_[_0x2df9('0x4a')]({},_0x31597b,_0x7b0b7e[_0x2df9('0x4c')]);return _0x5b69fd[_0x2df9('0x70')](_0x31597b);}})[_0x2df9('0x28')](function(_0x354dae){if(_0x354dae){_0x421795=_0x354dae[_0x2df9('0x44')];if(!_0x7b0b7e[_0x2df9('0x3e')][_0x2df9('0x65')](_0x2df9('0x66'))){_0x31597b[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x7b0b7e[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x31597b[_0x2df9('0x22')]=qs[_0x2df9('0x22')](_0x7b0b7e['query'][_0x2df9('0x22')]);}return _0x5b69fd[_0x2df9('0x70')](_0x31597b);}})['then'](function(_0x117f4f){if(_0x117f4f){return _0x117f4f?{'count':_0x421795,'rows':_0x117f4f}:null;}})[_0x2df9('0x28')](respondWithResult(_0x2a7e20,null))[_0x2df9('0x51')](handleError(_0x2a7e20,null));};exports[_0x2df9('0x72')]=function(_0x35eb9c,_0x401b17,_0x2b7715){var _0x1b671b=_0x35eb9c[_0x2df9('0x53')][_0x2df9('0x73')];var _0x12c57a=_[_0x2df9('0x39')](_0x1b671b,'id');return db[_0x2df9('0x71')][_0x2df9('0x68')]({'where':{'id':_0x12c57a},'attributes':['id'],'include':[{'model':db[_0x2df9('0x74')],'as':'Agents','attributes':['id','name',_0x2df9('0x75'),_0x2df9('0x76'),_0x2df9('0x77')],'raw':!![]}]})[_0x2df9('0x28')](function(_0xa9c821){if(_0xa9c821){var _0x204d4c=_[_0x2df9('0x78')](_0xa9c821,function(_0x3915e8){var _0x1aaca7=_0x3915e8['get']({'plain':!![]});_0x1aaca7[_0x2df9('0x79')]['forEach'](function(_0x27edaf){_0x27edaf[_0x2df9('0x7a')]=_['find'](_0x1b671b,{'id':_0x1aaca7['id']})['penalty'];});return _0x1aaca7['Agents'];});return db['VoiceQueue']['find']({'where':{'id':_0x35eb9c[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](function(_0x1cef1c){return db[_0x2df9('0x7b')][_0x2df9('0x7c')](function(_0x2e18e1){return _0x1cef1c['addTeams'](_0x12c57a,{'transaction':_0x2e18e1})[_0x2df9('0x28')](function(){return BPromise[_0x2df9('0x7d')](_0x204d4c,function(_0x3b204b){return db['UserVoiceQueue'][_0x2df9('0x7e')]({'where':{'UserId':_0x3b204b['id'],'VoiceQueueId':_0x35eb9c['params']['id']},'defaults':{'penalty':_0x3b204b[_0x2df9('0x7a')]},'transaction':_0x2e18e1});});})['then'](function(){return BPromise[_0x2df9('0x7d')](_[_0x2df9('0x2d')](_0x204d4c,{'online':!![]}),function(_0x48559a){return db[_0x2df9('0x7f')][_0x2df9('0x80')]({'membername':_0x48559a[_0x2df9('0x36')],'UserId':_0x48559a['id'],'queue_name':_0x1cef1c[_0x2df9('0x36')],'VoiceQueueId':_0x1cef1c['id'],'interface':_['isNil'](_0x48559a[_0x2df9('0x77')])?util[_0x2df9('0x81')](_0x2df9('0x82'),_0x48559a[_0x2df9('0x36')]):_0x48559a[_0x2df9('0x77')],'paused':_0x48559a[_0x2df9('0x76')]||![],'penalty':_0x48559a[_0x2df9('0x7a')]},{'transaction':_0x2e18e1});});})[_0x2df9('0x28')](function(){_0x204d4c[_0x2df9('0x83')](function(_0x92924d){socket[_0x2df9('0x84')](_0x2df9('0x85'),{'UserId':_0x92924d['id'],'VoiceQueueId':_0x1cef1c['id']});});});});});}})[_0x2df9('0x28')](respondWithStatusCode(_0x401b17,null))['catch'](handleError(_0x401b17,null));};exports['removeTeams']=function(_0x298079,_0x59c562,_0xf14895){return db['Team'][_0x2df9('0x68')]({'where':{'id':_0x298079['query'][_0x2df9('0x86')]},'attributes':['id'],'include':[{'model':db[_0x2df9('0x74')],'as':_0x2df9('0x79'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x59c562,null))[_0x2df9('0x28')](function(_0x5da9ed){var _0xbb54a=_[_0x2df9('0x39')](_0x5da9ed,'id');var _0x3a0b39=[];var _0x52a5d0=[];var _0x177e6f=squel['select']();_0x177e6f[_0x2df9('0x87')](_0x2df9('0x88'))['from'](_0x2df9('0x89'),'tq')[_0x2df9('0x8a')](_0x2df9('0x8b'),'ut','ut.TeamId\x20=\x20tq.TeamId')['where'](_0x2df9('0x8c'),_0x298079[_0x2df9('0x4f')]['id']);for(var _0x5d30e9=0x0;_0x5d30e9<_0x5da9ed['length'];_0x5d30e9+=0x1){let _0x51c884=_0x5da9ed[_0x5d30e9];for(var _0x559141=0x0;_0x559141<_0x51c884[_0x2df9('0x79')][_0x2df9('0x44')];_0x559141+=0x1){let _0x5e3c31=_0x51c884[_0x2df9('0x79')][_0x559141];var _0x2c415f=_0x177e6f[_0x2df9('0x5b')]();_0x2c415f[_0x2df9('0x48')](_0x2df9('0x8d'),_0x5e3c31['id']);_0x52a5d0['push'](db['sequelize'][_0x2df9('0x3e')](_0x2c415f[_0x2df9('0x8e')](),{'type':db['sequelize']['QueryTypes'][_0x2df9('0x8f')]})[_0x2df9('0x28')](function(_0x56cd5b){if(_0x56cd5b[_0x2df9('0x44')]===0x1){return _0x5e3c31['id'];}else{var _0x110edf=_['every'](_['map'](_0x56cd5b,_0x2df9('0x90')),function(_0x1a70f8){return _['includes'](_0xbb54a,_0x1a70f8);});if(_0x110edf){return _0x5e3c31['id'];}}}));}}return BPromise[_0x2df9('0x91')](_0x52a5d0)['then'](function(_0x591a49){_0x3a0b39=_(_0x3a0b39)['union'](_0x591a49)[_0x2df9('0x92')]()[_0x2df9('0x2f')]();return db[_0x2df9('0x3a')][_0x2df9('0x32')]({'where':{'id':_0x298079[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](function(_0x224ec0){return db[_0x2df9('0x7b')]['transaction'](function(_0x3af2e5){return _0x224ec0[_0x2df9('0x93')](_0x298079[_0x2df9('0x3e')]['ids'],{'transaction':_0x3af2e5})['then'](function(){if(!_[_0x2df9('0x94')](_0x3a0b39)){return _0x224ec0[_0x2df9('0x95')](_0x3a0b39,{'transaction':_0x3af2e5})[_0x2df9('0x28')](function(){return db[_0x2df9('0x7f')][_0x2df9('0x29')]({'where':{'VoiceQueueId':_0x298079[_0x2df9('0x4f')]['id'],'UserId':_0x3a0b39},'transaction':_0x3af2e5});});}})['then'](function(){_0x3a0b39[_0x2df9('0x83')](function(_0x5e78c0){socket[_0x2df9('0x84')](_0x2df9('0x96'),{'UserId':_0x5e78c0,'VoiceQueueId':_0x224ec0['id']});});});});});});})[_0x2df9('0x28')](respondWithStatusCode(_0x59c562,null))[_0x2df9('0x51')](handleError(_0x59c562,null));};exports[_0x2df9('0x97')]=function(_0x3d8c7b,_0x2630c0,_0x315dd7){var _0x23f184,_0x48e449;return db[_0x2df9('0x3a')]['find']({'where':{'id':_0x3d8c7b[_0x2df9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x2630c0,null))[_0x2df9('0x28')](function(_0x24aa44){if(_0x24aa44){_0x48e449=_0x24aa44;return _0x24aa44[_0x2df9('0x97')](_0x3d8c7b['body'][_0x2df9('0x86')],_[_0x2df9('0x5c')](_0x3d8c7b['body'],['ids','id'])||{})['spread'](function(_0x406ca9){for(var _0xfd0406=0x0;_0xfd0406<_0x3d8c7b[_0x2df9('0x53')][_0x2df9('0x86')][_0x2df9('0x44')];_0xfd0406+=0x1){socket[_0x2df9('0x84')](_0x2df9('0x85'),{'UserId':_0x3d8c7b['body']['ids'][_0xfd0406],'VoiceQueueId':_0x3d8c7b['params']['id']});}return _0x406ca9;});}})[_0x2df9('0x28')](function(_0x4fe28a){_0x23f184=_0x4fe28a||[];if(_0x48e449){return db[_0x2df9('0x74')][_0x2df9('0x68')]({'where':{'id':_0x3d8c7b['body'][_0x2df9('0x86')]},'attributes':['id',_0x2df9('0x36'),_0x2df9('0x75'),_0x2df9('0x76'),'interface'],'raw':!![]});}})['then'](function(_0x3b0624){if(!_[_0x2df9('0x94')](_0x3b0624)){var _0x101423=[];for(var _0x3b4027=0x0;_0x3b4027<_0x3b0624[_0x2df9('0x44')];_0x3b4027++){if(_0x3b0624[_0x3b4027][_0x2df9('0x75')]){_0x101423[_0x2df9('0x98')](db[_0x2df9('0x7f')][_0x2df9('0x80')]({'membername':_0x3b0624[_0x3b4027]['name'],'UserId':_0x3b0624[_0x3b4027]['id'],'queue_name':_0x48e449[_0x2df9('0x36')],'VoiceQueueId':_0x48e449['id'],'interface':_['isNil'](_0x3b0624[_0x3b4027][_0x2df9('0x77')])?util['format'](_0x2df9('0x82'),_0x3b0624[_0x3b4027]['name']):_0x3b0624[_0x3b4027][_0x2df9('0x77')],'paused':_0x3b0624[_0x3b4027][_0x2df9('0x76')]||![],'penalty':_0x3d8c7b['body'][_0x2df9('0x7a')]||0x0}));}}return BPromise['all'](_0x101423);}})[_0x2df9('0x28')](function(){return _0x23f184;})[_0x2df9('0x28')](respondWithResult(_0x2630c0,null))['catch'](handleError(_0x2630c0,null));};exports[_0x2df9('0x95')]=function(_0x58b4ab,_0x16fe8f,_0x28cbe8){return db['VoiceQueue'][_0x2df9('0x32')]({'where':{'id':_0x58b4ab[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x16fe8f,null))[_0x2df9('0x28')](function(_0xaea1d8){if(_0xaea1d8){return _0xaea1d8[_0x2df9('0x95')](_0x58b4ab[_0x2df9('0x3e')]['ids'])[_0x2df9('0x28')](function(){if(_[_0x2df9('0x99')](_0x58b4ab[_0x2df9('0x3e')][_0x2df9('0x86')])){for(var _0x536886=0x0;_0x536886<_0x58b4ab['query'][_0x2df9('0x86')][_0x2df9('0x44')];_0x536886+=0x1){socket[_0x2df9('0x84')](_0x2df9('0x96'),{'UserId':Number(_0x58b4ab[_0x2df9('0x3e')][_0x2df9('0x86')][_0x536886]),'VoiceQueueId':Number(_0x58b4ab[_0x2df9('0x4f')]['id'])});}}else{socket[_0x2df9('0x84')](_0x2df9('0x96'),{'UserId':Number(_0x58b4ab[_0x2df9('0x3e')][_0x2df9('0x86')]),'VoiceQueueId':Number(_0x58b4ab[_0x2df9('0x4f')]['id'])});}});}})[_0x2df9('0x28')](function(_0x113e59){return db[_0x2df9('0x7f')][_0x2df9('0x29')]({'where':{'VoiceQueueId':_0x58b4ab[_0x2df9('0x4f')]['id'],'UserId':_0x58b4ab[_0x2df9('0x3e')]['ids']}})['then'](function(){return _0x113e59;});})[_0x2df9('0x28')](respondWithStatusCode(_0x16fe8f,null))['catch'](handleError(_0x16fe8f,null));};exports[_0x2df9('0x9a')]=function(_0x444797,_0x471556,_0x4b7027){var _0x45a048={};var _0x2e4f69={};var _0x29370b;var _0x1a32fa;return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x444797['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x471556,null))[_0x2df9('0x28')](function(_0x33db4){if(_0x33db4){_0x29370b=_0x33db4;_0x2e4f69['model']=_['keys'](db[_0x2df9('0x74')]['rawAttributes']);_0x2e4f69['query']=_[_0x2df9('0x50')](_0x444797[_0x2df9('0x3e')]);_0x2e4f69['filters']=_[_0x2df9('0x40')](_0x2e4f69[_0x2df9('0x41')],_0x2e4f69[_0x2df9('0x3e')]);_0x45a048[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x2e4f69[_0x2df9('0x41')],qs[_0x2df9('0x43')](_0x444797['query'][_0x2df9('0x43')]));_0x45a048[_0x2df9('0x42')]=_0x45a048[_0x2df9('0x42')][_0x2df9('0x44')]?_0x45a048['attributes']:_0x2e4f69[_0x2df9('0x41')];_0x45a048[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x444797['query'][_0x2df9('0x47')]);_0x45a048[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x444797[_0x2df9('0x3e')],_0x2e4f69[_0x2df9('0x3f')]));if(_0x444797['query'][_0x2df9('0x2d')]){_0x45a048[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x45a048[_0x2df9('0x48')],{'$or':_['map'](_0x45a048['attributes'],function(_0x430eb8){var _0x11310e={};_0x11310e[_0x430eb8]={'$like':'%'+_0x444797[_0x2df9('0x3e')][_0x2df9('0x2d')]+'%'};return _0x11310e;})});}_0x45a048=_['merge']({},_0x45a048,_0x444797[_0x2df9('0x4c')]);return _0x29370b[_0x2df9('0x9a')](_0x45a048);}})[_0x2df9('0x28')](function(_0x36b803){if(_0x36b803){_0x1a32fa=_0x36b803[_0x2df9('0x44')];if(!_0x444797[_0x2df9('0x3e')]['hasOwnProperty']('nolimit')){_0x45a048[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x444797[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x45a048['offset']=qs['offset'](_0x444797['query']['offset']);}return _0x29370b['getAgents'](_0x45a048);}})[_0x2df9('0x28')](function(_0x40fae2){if(_0x40fae2){return _0x40fae2?{'count':_0x1a32fa,'rows':_0x40fae2}:null;}})['then'](respondWithResult(_0x471556,null))['catch'](handleError(_0x471556,null));};exports['getMembers']=function(_0x499e3f,_0xb77334,_0x55f588){var _0x3f934f={};var _0x4a8841={};var _0x32e718;var _0x4d8a36;return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x499e3f['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0xb77334,null))[_0x2df9('0x28')](function(_0x3521c3){if(_0x3521c3){_0x32e718=_0x3521c3;_0x4a8841[_0x2df9('0x41')]=_['keys'](db[_0x2df9('0x7f')][_0x2df9('0x3b')]);_0x4a8841[_0x2df9('0x3e')]=_[_0x2df9('0x50')](_0x499e3f[_0x2df9('0x3e')]);_0x4a8841[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x4a8841['model'],_0x4a8841[_0x2df9('0x3e')]);_0x3f934f[_0x2df9('0x42')]=_[_0x2df9('0x40')](_0x4a8841['model'],qs[_0x2df9('0x43')](_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x3f934f['attributes']=_0x3f934f['attributes'][_0x2df9('0x44')]?_0x3f934f[_0x2df9('0x42')]:_0x4a8841[_0x2df9('0x41')];_0x3f934f[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x3f934f[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x499e3f['query'],_0x4a8841[_0x2df9('0x3f')]));if(_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x3f934f[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x3f934f[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x3f934f[_0x2df9('0x42')],function(_0xc141cf){var _0x1b88d3={};_0x1b88d3[_0xc141cf]={'$like':'%'+_0x499e3f[_0x2df9('0x3e')]['filter']+'%'};return _0x1b88d3;})});}_0x3f934f=_['merge']({},_0x3f934f,_0x499e3f[_0x2df9('0x4c')]);return _0x32e718[_0x2df9('0x9b')](_0x3f934f);}})[_0x2df9('0x28')](function(_0x46d777){if(_0x46d777){_0x4d8a36=_0x46d777[_0x2df9('0x44')];if(!_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x65')](_0x2df9('0x66'))){_0x3f934f['limit']=qs[_0x2df9('0x45')](_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x3f934f[_0x2df9('0x22')]=qs[_0x2df9('0x22')](_0x499e3f[_0x2df9('0x3e')][_0x2df9('0x22')]);}return _0x32e718[_0x2df9('0x9b')](_0x3f934f);}})['then'](function(_0x539c48){return _0x539c48?{'count':_0x4d8a36,'rows':_0x539c48}:null;})['then'](respondWithResult(_0xb77334,null))[_0x2df9('0x51')](handleError(_0xb77334,null));};exports[_0x2df9('0x9c')]=function(_0xfa2dd6,_0x1eb568,_0x3a2c5c){var _0x2679f4={};var _0x7777eb={};var _0x2c9a9a;var _0x3bc49f;return db[_0x2df9('0x3a')]['findOne']({'where':{'id':_0xfa2dd6[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x1eb568,null))[_0x2df9('0x28')](function(_0x1575f3){if(_0x1575f3){_0x2c9a9a=_0x1575f3;_0x7777eb[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x9d')]['rawAttributes']);_0x7777eb['query']=_['keys'](_0xfa2dd6[_0x2df9('0x3e')]);_0x7777eb['filters']=_['intersection'](_0x7777eb[_0x2df9('0x41')],_0x7777eb[_0x2df9('0x3e')]);_0x2679f4['attributes']=_[_0x2df9('0x40')](_0x7777eb['model'],qs[_0x2df9('0x43')](_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x2679f4[_0x2df9('0x42')]=_0x2679f4['attributes'][_0x2df9('0x44')]?_0x2679f4['attributes']:_0x7777eb['model'];_0x2679f4[_0x2df9('0x46')]=qs[_0x2df9('0x47')](_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x2679f4[_0x2df9('0x48')]=qs['filters'](_[_0x2df9('0x49')](_0xfa2dd6[_0x2df9('0x3e')],_0x7777eb['filters']));if(_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x2d')]){_0x2679f4[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x2679f4[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x2679f4['attributes'],function(_0x2fcc02){var _0x28020a={};_0x28020a[_0x2fcc02]={'$like':'%'+_0xfa2dd6['query'][_0x2df9('0x2d')]+'%'};return _0x28020a;})});}_0x2679f4=_[_0x2df9('0x4a')]({},_0x2679f4,_0xfa2dd6[_0x2df9('0x4c')]);return _0x2c9a9a[_0x2df9('0x9c')](_0x2679f4);}})['then'](function(_0x1ac79a){if(_0x1ac79a){_0x3bc49f=_0x1ac79a[_0x2df9('0x44')];if(!_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x65')](_0x2df9('0x66'))){_0x2679f4[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x2679f4['offset']=qs['offset'](_0xfa2dd6[_0x2df9('0x3e')][_0x2df9('0x22')]);}return _0x2c9a9a[_0x2df9('0x9c')](_0x2679f4);}})[_0x2df9('0x28')](function(_0x4a98b4){if(_0x4a98b4){return _0x4a98b4?{'count':_0x3bc49f,'rows':_0x4a98b4}:null;}})[_0x2df9('0x28')](respondWithResult(_0x1eb568,null))[_0x2df9('0x51')](handleError(_0x1eb568,null));};exports[_0x2df9('0x9e')]=function(_0x389138,_0x7e2d2,_0x36e078){var _0x513446,_0x52f3db;return db['VoiceQueue'][_0x2df9('0x32')]({'where':{'id':_0x389138['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x7e2d2,null))[_0x2df9('0x28')](function(_0x5eac83){if(_0x5eac83){_0x52f3db=_0x5eac83;return _0x5eac83[_0x2df9('0x9e')](_0x389138[_0x2df9('0x53')][_0x2df9('0x86')],_[_0x2df9('0x5c')](_0x389138[_0x2df9('0x53')],['ids','id'])||{});}return null;})[_0x2df9('0x9f')](function(_0xcb46d7){var _0x47dad0;_0x513446=_0xcb46d7||[];var _0x548cd2=[];if(_0xcb46d7){for(var _0x46eb09=0x0;_0x46eb09<_0xcb46d7[_0x2df9('0x44')];_0x46eb09+=0x1){var _0x2a4cd6=_0xcb46d7[_0x46eb09][_0x2df9('0x55')]({'plain':!![]});_0x52f3db[_0x2df9('0xa0')]=_0x389138[_0x2df9('0x53')][_0x2df9('0xa0')]?_0x389138['body'][_0x2df9('0xa0')]:_0x52f3db['dialCheckDuplicateType'];switch(_0x52f3db[_0x2df9('0xa0')]){case _0x2df9('0xa1'):_0x47dad0=squel[_0x2df9('0xa2')]()[_0x2df9('0xa3')](_0x2df9('0xa4'))[_0x2df9('0xa5')](['phone',_0x2df9('0xa6'),'ContactId',_0x2df9('0xa7'),_0x2df9('0x67'),_0x2df9('0x5e'),_0x2df9('0x5d')],squel['select']()[_0x2df9('0x87')]('phone','phone')[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0xa6'))[_0x2df9('0x87')]('id',_0x2df9('0xa9'))[_0x2df9('0x87')](_0x2a4cd6['CmListId'][_0x2df9('0x8e')](),_0x2df9('0xa7'))[_0x2df9('0x87')](_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')](),_0x2df9('0x67'))[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0x5e'))[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0x5d'))['from']('cm_contacts')['where']('deletedAt\x20IS\x20NULL')[_0x2df9('0x48')](_0x2df9('0xaa'),_0x2a4cd6[_0x2df9('0xab')][_0x2df9('0x8e')]())[_0x2df9('0x48')]('phone\x20IS\x20NOT\x20NULL')[_0x2df9('0x48')](_0x2df9('0xac'),squel[_0x2df9('0xad')]()[_0x2df9('0x87')](_0x2df9('0xae'))[_0x2df9('0xaf')](_0x2df9('0xb0'))[_0x2df9('0x48')](_0x2df9('0x8c'),_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')]()))[_0x2df9('0x48')](_0x2df9('0xac'),squel[_0x2df9('0xad')]()[_0x2df9('0x87')](_0x2df9('0xb1'))[_0x2df9('0xaf')](_0x2df9('0xa4'))[_0x2df9('0x48')](_0x2df9('0x8c'),_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')]())))['toString']();break;case _0x2df9('0xb2'):_0x47dad0=squel['insert']()['into'](_0x2df9('0xa4'))[_0x2df9('0xa5')]([_0x2df9('0xb3'),_0x2df9('0xa6'),'ContactId','ListId',_0x2df9('0x67'),'createdAt',_0x2df9('0x5d')],squel['select']()['field'](_0x2df9('0xb3'),'phone')[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0xa6'))[_0x2df9('0x87')]('id','ContactId')[_0x2df9('0x87')](_0x2a4cd6[_0x2df9('0xab')][_0x2df9('0x8e')](),_0x2df9('0xa7'))[_0x2df9('0x87')](_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')](),'VoiceQueueId')[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0x5e'))[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0x5d'))[_0x2df9('0xaf')](_0x2df9('0xb4'))[_0x2df9('0x48')]('deletedAt\x20IS\x20NULL')['where'](_0x2df9('0xaa'),_0x2a4cd6[_0x2df9('0xab')]['toString']())['where'](_0x2df9('0xb5'))[_0x2df9('0x48')]('phone\x20NOT\x20IN\x20(?)',squel[_0x2df9('0xad')]()[_0x2df9('0x87')](_0x2df9('0xb1'))[_0x2df9('0xaf')]('cm_hopper')[_0x2df9('0x48')]('VoiceQueueId\x20=\x20?',_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')]())))['toString']();break;default:_0x47dad0=squel['insert']()['into']('cm_hopper')[_0x2df9('0xa5')]([_0x2df9('0xb3'),_0x2df9('0xa6'),_0x2df9('0xa9'),_0x2df9('0xa7'),_0x2df9('0x67'),_0x2df9('0x5e'),_0x2df9('0x5d')],squel[_0x2df9('0xad')]()[_0x2df9('0x87')](_0x2df9('0xb3'),_0x2df9('0xb3'))[_0x2df9('0x87')]('NOW()',_0x2df9('0xa6'))[_0x2df9('0x87')]('id',_0x2df9('0xa9'))[_0x2df9('0x87')](_0x2a4cd6[_0x2df9('0xab')]['toString'](),'ListId')[_0x2df9('0x87')](_0x389138[_0x2df9('0x4f')]['id'][_0x2df9('0x8e')](),'VoiceQueueId')['field'](_0x2df9('0xa8'),_0x2df9('0x5e'))[_0x2df9('0x87')]('NOW()',_0x2df9('0x5d'))[_0x2df9('0xaf')](_0x2df9('0xb4'))['where'](_0x2df9('0xb6'))[_0x2df9('0x48')](_0x2df9('0xaa'),_0x2a4cd6[_0x2df9('0xab')][_0x2df9('0x8e')]())['where'](_0x2df9('0xb5')))[_0x2df9('0x8e')]();}_0x548cd2['push'](db[_0x2df9('0x7b')][_0x2df9('0x3e')](_0x47dad0));}return BPromise[_0x2df9('0x91')](_0x548cd2);}})['then'](function(){return _0x513446;})['then'](respondWithResult(_0x7e2d2,null))[_0x2df9('0x51')](handleError(_0x7e2d2,null));};exports['removeLists']=function(_0x574ec0,_0x12c1b3,_0x182ab4){return db[_0x2df9('0x3a')][_0x2df9('0x32')]({'where':{'id':_0x574ec0[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x12c1b3,null))[_0x2df9('0x28')](function(_0x10678a){if(_0x10678a){return _0x10678a[_0x2df9('0xb7')](_0x574ec0['query']['ids']);}})[_0x2df9('0x28')](function(_0xe717fb){if(_0xe717fb){return db[_0x2df9('0x64')][_0x2df9('0x29')]({'where':{'ListId':_0x574ec0[_0x2df9('0x3e')][_0x2df9('0x86')],'VoiceQueueId':_0x574ec0[_0x2df9('0x4f')]['id']}})['then'](function(){return _0xe717fb;});}})[_0x2df9('0x28')](respondWithStatusCode(_0x12c1b3,null))[_0x2df9('0x51')](handleError(_0x12c1b3,null));};exports['getBlackLists']=function(_0x1fe6c7,_0xff4f58,_0x476084){var _0x2fb900={};var _0x7c9a1d={};var _0x2bd268;var _0x1c742e;return db[_0x2df9('0x3a')][_0x2df9('0x63')]({'where':{'id':_0x1fe6c7[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0xff4f58,null))[_0x2df9('0x28')](function(_0x40206d){if(_0x40206d){_0x2bd268=_0x40206d;_0x7c9a1d[_0x2df9('0x41')]=_[_0x2df9('0x50')](db[_0x2df9('0x9d')]['rawAttributes']);_0x7c9a1d[_0x2df9('0x3e')]=_[_0x2df9('0x50')](_0x1fe6c7['query']);_0x7c9a1d[_0x2df9('0x3f')]=_[_0x2df9('0x40')](_0x7c9a1d['model'],_0x7c9a1d[_0x2df9('0x3e')]);_0x2fb900[_0x2df9('0x42')]=_['intersection'](_0x7c9a1d['model'],qs[_0x2df9('0x43')](_0x1fe6c7[_0x2df9('0x3e')][_0x2df9('0x43')]));_0x2fb900[_0x2df9('0x42')]=_0x2fb900[_0x2df9('0x42')][_0x2df9('0x44')]?_0x2fb900[_0x2df9('0x42')]:_0x7c9a1d[_0x2df9('0x41')];_0x2fb900[_0x2df9('0x46')]=qs['sort'](_0x1fe6c7[_0x2df9('0x3e')][_0x2df9('0x47')]);_0x2fb900[_0x2df9('0x48')]=qs[_0x2df9('0x3f')](_[_0x2df9('0x49')](_0x1fe6c7[_0x2df9('0x3e')],_0x7c9a1d[_0x2df9('0x3f')]));if(_0x1fe6c7['query'][_0x2df9('0x2d')]){_0x2fb900[_0x2df9('0x48')]=_[_0x2df9('0x4a')](_0x2fb900[_0x2df9('0x48')],{'$or':_[_0x2df9('0x39')](_0x2fb900['attributes'],function(_0x31e984){var _0x2c0c3b={};_0x2c0c3b[_0x31e984]={'$like':'%'+_0x1fe6c7[_0x2df9('0x3e')][_0x2df9('0x2d')]+'%'};return _0x2c0c3b;})});}_0x2fb900=_[_0x2df9('0x4a')]({},_0x2fb900,_0x1fe6c7[_0x2df9('0x4c')]);return _0x2bd268[_0x2df9('0xb8')](_0x2fb900);}})[_0x2df9('0x28')](function(_0x3f994d){if(_0x3f994d){_0x1c742e=_0x3f994d['length'];if(!_0x1fe6c7[_0x2df9('0x3e')][_0x2df9('0x65')]('nolimit')){_0x2fb900[_0x2df9('0x45')]=qs[_0x2df9('0x45')](_0x1fe6c7[_0x2df9('0x3e')][_0x2df9('0x45')]);_0x2fb900[_0x2df9('0x22')]=qs[_0x2df9('0x22')](_0x1fe6c7[_0x2df9('0x3e')]['offset']);}return _0x2bd268[_0x2df9('0xb8')](_0x2fb900);}})[_0x2df9('0x28')](function(_0x2f6d62){if(_0x2f6d62){return _0x2f6d62?{'count':_0x1c742e,'rows':_0x2f6d62}:null;}})['then'](respondWithResult(_0xff4f58,null))[_0x2df9('0x51')](handleError(_0xff4f58,null));};exports[_0x2df9('0xb9')]=function(_0xebb92e,_0x580971,_0x58dc17){var _0x4b6a2a,_0x2afe84;return db['VoiceQueue'][_0x2df9('0x32')]({'where':{'id':_0xebb92e['params']['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x580971,null))[_0x2df9('0x28')](function(_0x32e1f2){if(_0x32e1f2){_0x2afe84=_0x32e1f2;return _0x32e1f2[_0x2df9('0xb9')](_0xebb92e[_0x2df9('0x53')][_0x2df9('0x86')],_[_0x2df9('0x5c')](_0xebb92e['body'],[_0x2df9('0x86'),'id'])||{});}return null;})[_0x2df9('0x9f')](function(_0x536255){var _0x1c0f0b;_0x4b6a2a=_0x536255||[];var _0x521e3d=[];if(_0x536255){for(var _0x5aa811=0x0;_0x5aa811<_0x536255[_0x2df9('0x44')];_0x5aa811+=0x1){var _0x1d5f74=_0x536255[_0x5aa811][_0x2df9('0x55')]({'plain':!![]});_0x1c0f0b=squel[_0x2df9('0xa2')]()['into'](_0x2df9('0xba'))['fromQuery'](['phone',_0x2df9('0xa9'),_0x2df9('0xa7'),'VoiceQueueId',_0x2df9('0x5e'),_0x2df9('0x5d')],squel['select']()[_0x2df9('0x87')]('phone',_0x2df9('0xb3'))[_0x2df9('0x87')]('id',_0x2df9('0xa9'))['field'](_0x1d5f74[_0x2df9('0xab')][_0x2df9('0x8e')](),'ListId')[_0x2df9('0x87')](_0xebb92e['params']['id'][_0x2df9('0x8e')](),_0x2df9('0x67'))['field']('NOW()',_0x2df9('0x5e'))[_0x2df9('0x87')](_0x2df9('0xa8'),_0x2df9('0x5d'))[_0x2df9('0xaf')](_0x2df9('0xb4'))[_0x2df9('0x48')](_0x2df9('0xb6'))[_0x2df9('0x48')](_0x2df9('0xaa'),_0x1d5f74['CmListId']['toString']())[_0x2df9('0x48')](_0x2df9('0xb5')))['toString']();_0x521e3d[_0x2df9('0x98')](db['sequelize'][_0x2df9('0x3e')](_0x1c0f0b));}return BPromise[_0x2df9('0x91')](_0x521e3d);}})[_0x2df9('0x28')](function(){return _0x4b6a2a;})['then'](respondWithResult(_0x580971,null))[_0x2df9('0x51')](handleError(_0x580971,null));};exports[_0x2df9('0xbb')]=function(_0x4b425c,_0x3be70f,_0x5266e9){return db[_0x2df9('0x3a')][_0x2df9('0x32')]({'where':{'id':_0x4b425c[_0x2df9('0x4f')]['id']}})[_0x2df9('0x28')](handleEntityNotFound(_0x3be70f,null))[_0x2df9('0x28')](function(_0x5b0dea){if(_0x5b0dea){return _0x5b0dea[_0x2df9('0xbb')](_0x4b425c[_0x2df9('0x3e')][_0x2df9('0x86')]);}})[_0x2df9('0x28')](function(_0x163643){if(_0x163643){return db[_0x2df9('0x6f')][_0x2df9('0x29')]({'where':{'ListId':_0x4b425c[_0x2df9('0x3e')]['ids'],'VoiceQueueId':_0x4b425c[_0x2df9('0x4f')]['id']}})['then'](function(){return _0x163643;});}})['then'](respondWithStatusCode(_0x3be70f,null))[_0x2df9('0x51')](handleError(_0x3be70f,null));}; \ No newline at end of file +var _0xa1b9=['findAll','rows','catch','show','length','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','inbound','outbound','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','params','includeAll','omit','updatedAt','QueueCampaigns','getHoppers','findOne','hasOwnProperty','nolimit','CmHopper','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','Team','getTeams','addTeams','Agents','voicePause','interface','flatMap','sequelize','transaction','each','UserVoiceQueue','findOrCreate','penalty','UserVoiceQueueRt','upsert','isNil','format','SIP/%s','forEach','userVoiceQueue:save','removeTeams','ids','User','field','tq.TeamId','join','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','toString','SELECT','every','all','union','compact','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','emit','online','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','select','ContactId','CmListId','ListId','NOW()','createdAt','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','from','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','removeLists','getBlackLists','addBlackLists','cm_hopper_black','removeBlackLists','html-pdf','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','VoiceQueues','ignore','map','value','includes','type','find','end','stack','name','send','index','VoiceQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','order','sort','where','pick','filter','merge','VIRTUAL','options','include'];(function(_0x57d631,_0x3792f6){var _0x1fb8ac=function(_0x233c33){while(--_0x233c33){_0x57d631['push'](_0x57d631['shift']());}};_0x1fb8ac(++_0x3792f6);}(_0xa1b9,0x71));var _0x9a1b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xa1b9[_0x1facfa];return _0x9ec701;};'use strict';var pdf=require(_0x9a1b('0x0'));var emlformat=require('eml-format');var rimraf=require(_0x9a1b('0x1'));var zipdir=require(_0x9a1b('0x2'));var jsonpatch=require(_0x9a1b('0x3'));var rp=require(_0x9a1b('0x4'));var moment=require(_0x9a1b('0x5'));var BPromise=require(_0x9a1b('0x6'));var Mustache=require(_0x9a1b('0x7'));var util=require('util');var path=require(_0x9a1b('0x8'));var sox=require(_0x9a1b('0x9'));var csv=require(_0x9a1b('0xa'));var ejs=require(_0x9a1b('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x9a1b('0xc'));var crypto=require('crypto');var jsforce=require(_0x9a1b('0xd'));var deskjs=require(_0x9a1b('0xe'));var toCsv=require(_0x9a1b('0xa'));var querystring=require(_0x9a1b('0xf'));var Papa=require(_0x9a1b('0x10'));var Redis=require('ioredis');var authService=require(_0x9a1b('0x11'));var qs=require(_0x9a1b('0x12'));var as=require(_0x9a1b('0x13'));var hardwareService=require(_0x9a1b('0x14'));var logger=require(_0x9a1b('0x15'))(_0x9a1b('0x16'));var utils=require(_0x9a1b('0x17'));var config=require('../../config/environment');var db=require(_0x9a1b('0x18'))['db'];config[_0x9a1b('0x19')]=_[_0x9a1b('0x1a')](config['redis'],{'host':_0x9a1b('0x1b'),'port':0x18eb});var socket=require(_0x9a1b('0x1c'))(new Redis(config[_0x9a1b('0x19')]));require(_0x9a1b('0x1d'))[_0x9a1b('0x1e')](socket);function respondWithStatusCode(_0x157b6f,_0x3fe388){_0x3fe388=_0x3fe388||0xcc;return function(_0x18df50){if(_0x18df50){return _0x157b6f[_0x9a1b('0x1f')](_0x3fe388);}return _0x157b6f[_0x9a1b('0x20')](_0x3fe388)['end']();};}function respondWithResult(_0x357cd9,_0x2440fc){_0x2440fc=_0x2440fc||0xc8;return function(_0x5a1d3b){if(_0x5a1d3b){return _0x357cd9[_0x9a1b('0x20')](_0x2440fc)[_0x9a1b('0x21')](_0x5a1d3b);}};}function respondWithFilteredResult(_0x80245,_0x1a7324){return function(_0x402d0c){if(_0x402d0c){var _0x478626=_0x402d0c[_0x9a1b('0x22')],_0xe7a820=_0x1a7324[_0x9a1b('0x23')],_0x599325=_0x1a7324[_0x9a1b('0x23')]+_0x1a7324[_0x9a1b('0x24')],_0x403250;if(_0x599325>=_0x478626){_0x599325=_0x478626;_0x403250=0xc8;}else{_0x403250=0xce;}_0x80245['status'](_0x403250);return _0x80245[_0x9a1b('0x25')](_0x9a1b('0x26'),_0xe7a820+'-'+_0x599325+'/'+_0x478626)[_0x9a1b('0x21')](_0x402d0c);}return null;};}function patchUpdates(_0x1977a7){return function(_0x4a0ccd){try{jsonpatch[_0x9a1b('0x27')](_0x4a0ccd,_0x1977a7,!![]);}catch(_0x303110){return BPromise[_0x9a1b('0x28')](_0x303110);}return _0x4a0ccd[_0x9a1b('0x29')]();};}function saveUpdates(_0x1c9ab3,_0x327cac){return function(_0x2b8cfe){if(_0x2b8cfe){return _0x2b8cfe[_0x9a1b('0x2a')](_0x1c9ab3)[_0x9a1b('0x2b')](function(_0x37971c){return _0x37971c;});}return null;};}function removeEntity(_0x5841c1,_0x2439e9){return function(_0x3392da){if(_0x3392da){return _0x3392da[_0x9a1b('0x2c')]()['then'](function(){var _0x5cf12d=_0x3392da[_0x9a1b('0x2d')]({'plain':!![]});var _0x52fce9=[{'name':_0x9a1b('0x2e'),'value':'inbound','ignore':![]},{'name':'QueueCampaigns','value':'outbound','ignore':![]}];var _0x432a3d=_(_0x52fce9)['filter'](_0x9a1b('0x2f'))[_0x9a1b('0x30')](_0x9a1b('0x31'))[_0x9a1b('0x31')]();if(_[_0x9a1b('0x32')](_0x432a3d,_0x5cf12d[_0x9a1b('0x33')])){return;}var _0x1c13d6=_[_0x9a1b('0x34')](_0x52fce9,[_0x9a1b('0x31'),_0x5cf12d[_0x9a1b('0x33')]])['name'];return db['UserProfileResource'][_0x9a1b('0x2c')]({'where':{'type':_0x1c13d6,'resourceId':_0x5cf12d['id']}})[_0x9a1b('0x2b')](function(){return _0x3392da;});})['then'](function(){_0x5841c1[_0x9a1b('0x20')](0xcc)[_0x9a1b('0x35')]();});}};}function handleEntityNotFound(_0x4028f0,_0x3bc034){return function(_0x311432){if(!_0x311432){_0x4028f0[_0x9a1b('0x1f')](0x194);}return _0x311432;};}function handleError(_0xc93663,_0xd428e0){_0xd428e0=_0xd428e0||0x1f4;return function(_0x1e7f23){logger['error'](_0x1e7f23[_0x9a1b('0x36')]);if(_0x1e7f23['name']){delete _0x1e7f23[_0x9a1b('0x37')];}_0xc93663[_0x9a1b('0x20')](_0xd428e0)[_0x9a1b('0x38')](_0x1e7f23);};}exports[_0x9a1b('0x39')]=function(_0x53a7db,_0xfc101c){var _0x3bf81e={},_0x2f56ae={},_0x39e26b={'count':0x0,'rows':[]};var _0x12dc16=_[_0x9a1b('0x30')](db[_0x9a1b('0x3a')][_0x9a1b('0x3b')],function(_0x2ec5d6){return{'name':_0x2ec5d6['fieldName'],'type':_0x2ec5d6[_0x9a1b('0x33')][_0x9a1b('0x3c')]};});_0x2f56ae[_0x9a1b('0x3d')]=_[_0x9a1b('0x30')](_0x12dc16,_0x9a1b('0x37'));_0x2f56ae[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x53a7db['query']);_0x2f56ae[_0x9a1b('0x40')]=_[_0x9a1b('0x41')](_0x2f56ae[_0x9a1b('0x3d')],_0x2f56ae[_0x9a1b('0x3e')]);_0x3bf81e[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0x2f56ae[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0x53a7db[_0x9a1b('0x3e')]['fields']));_0x3bf81e[_0x9a1b('0x42')]=_0x3bf81e[_0x9a1b('0x42')]['length']?_0x3bf81e[_0x9a1b('0x42')]:_0x2f56ae[_0x9a1b('0x3d')];if(!_0x53a7db['query']['hasOwnProperty']('nolimit')){_0x3bf81e[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0x53a7db[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x3bf81e[_0x9a1b('0x23')]=qs['offset'](_0x53a7db[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}_0x3bf81e[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x53a7db[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x3bf81e[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0x53a7db[_0x9a1b('0x3e')],_0x2f56ae['filters']));if(_0x53a7db[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x3bf81e[_0x9a1b('0x46')]=_[_0x9a1b('0x49')](_0x3bf81e['where'],{'$or':_[_0x9a1b('0x30')](_0x12dc16,function(_0x392045){if(_0x392045[_0x9a1b('0x33')]!==_0x9a1b('0x4a')){var _0x1863d8={};_0x1863d8[_0x392045[_0x9a1b('0x37')]]={'$like':'%'+_0x53a7db['query'][_0x9a1b('0x48')]+'%'};return _0x1863d8;}})});}_0x3bf81e=_[_0x9a1b('0x49')]({},_0x3bf81e,_0x53a7db[_0x9a1b('0x4b')]);var _0x483277={'where':_0x3bf81e[_0x9a1b('0x46')]};return db[_0x9a1b('0x3a')][_0x9a1b('0x22')](_0x483277)[_0x9a1b('0x2b')](function(_0x3275f2){_0x39e26b[_0x9a1b('0x22')]=_0x3275f2;if(_0x53a7db[_0x9a1b('0x3e')]['includeAll']){_0x3bf81e[_0x9a1b('0x4c')]=[{'all':!![]}];}return db[_0x9a1b('0x3a')][_0x9a1b('0x4d')](_0x3bf81e);})[_0x9a1b('0x2b')](function(_0x4f067b){_0x39e26b[_0x9a1b('0x4e')]=_0x4f067b;return _0x39e26b;})[_0x9a1b('0x2b')](respondWithFilteredResult(_0xfc101c,_0x3bf81e))[_0x9a1b('0x4f')](handleError(_0xfc101c,null));};exports[_0x9a1b('0x50')]=function(_0x2a49a0,_0x925a3b){var _0x2e3f2f={'raw':![],'where':{'id':_0x2a49a0['params']['id']}},_0x4a3939={};_0x4a3939[_0x9a1b('0x3d')]=_[_0x9a1b('0x3f')](db['VoiceQueue'][_0x9a1b('0x3b')]);_0x4a3939[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x2a49a0['query']);_0x4a3939['filters']=_['intersection'](_0x4a3939[_0x9a1b('0x3d')],_0x4a3939[_0x9a1b('0x3e')]);_0x2e3f2f['attributes']=_[_0x9a1b('0x41')](_0x4a3939[_0x9a1b('0x3d')],qs['fields'](_0x2a49a0['query'][_0x9a1b('0x43')]));_0x2e3f2f[_0x9a1b('0x42')]=_0x2e3f2f['attributes'][_0x9a1b('0x51')]?_0x2e3f2f[_0x9a1b('0x42')]:_0x4a3939[_0x9a1b('0x3d')];if(_0x2a49a0[_0x9a1b('0x3e')]['includeAll']){_0x2e3f2f['include']=[{'all':!![]}];}_0x2e3f2f=_['merge']({},_0x2e3f2f,_0x2a49a0[_0x9a1b('0x4b')]);return db[_0x9a1b('0x3a')][_0x9a1b('0x34')](_0x2e3f2f)[_0x9a1b('0x2b')](handleEntityNotFound(_0x925a3b,null))[_0x9a1b('0x2b')](respondWithResult(_0x925a3b,null))[_0x9a1b('0x4f')](handleError(_0x925a3b,null));};exports[_0x9a1b('0x52')]=function(_0x3a29ce,_0xfd1edc){return db[_0x9a1b('0x3a')][_0x9a1b('0x52')](_0x3a29ce[_0x9a1b('0x53')],{})[_0x9a1b('0x2b')](function(_0x2bc22a){var _0x5cb018=_0x3a29ce['user'][_0x9a1b('0x2d')]({'plain':!![]});if(!_0x5cb018)throw new Error(_0x9a1b('0x54'));if(_0x5cb018[_0x9a1b('0x55')]===_0x9a1b('0x56')){var _0x47b452=_0x2bc22a[_0x9a1b('0x2d')]({'plain':!![]});var _0x2fc033=[{'name':_0x9a1b('0x2e'),'value':_0x9a1b('0x57')},{'name':'QueueCampaigns','value':_0x9a1b('0x58')}];var _0x33c3b3=_[_0x9a1b('0x34')](_0x2fc033,[_0x9a1b('0x31'),_0x47b452['type']])[_0x9a1b('0x37')];return db[_0x9a1b('0x59')]['find']({'where':{'name':_0x33c3b3,'userProfileId':_0x5cb018[_0x9a1b('0x5a')]},'raw':!![]})['then'](function(_0x5da24f){if(_0x5da24f&&_0x5da24f[_0x9a1b('0x5b')]===0x0){return db[_0x9a1b('0x5c')][_0x9a1b('0x52')]({'name':_0x47b452['name'],'resourceId':_0x47b452['id'],'type':_0x5da24f[_0x9a1b('0x37')],'sectionId':_0x5da24f['id']},{})[_0x9a1b('0x2b')](function(){return _0x2bc22a;});}else{return _0x2bc22a;}})[_0x9a1b('0x4f')](function(_0x271fc7){logger[_0x9a1b('0x5d')](_0x9a1b('0x5e'),_0x271fc7);throw _0x271fc7;});}return _0x2bc22a;})[_0x9a1b('0x2b')](respondWithResult(_0xfd1edc,0xc9))[_0x9a1b('0x4f')](handleError(_0xfd1edc,null));};exports[_0x9a1b('0x5f')]=function(_0x3f2894,_0x364c1f){var _0x39be22={'where':{'id':_0x3f2894[_0x9a1b('0x60')]['id']}},_0x62fa15={};_0x62fa15[_0x9a1b('0x3d')]=_[_0x9a1b('0x3f')](db[_0x9a1b('0x3a')][_0x9a1b('0x3b')]);_0x39be22[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0x62fa15[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0x3f2894[_0x9a1b('0x3e')]['fields']));_0x39be22[_0x9a1b('0x42')]=_0x39be22[_0x9a1b('0x42')]['length']?_0x39be22[_0x9a1b('0x42')]:_0x62fa15[_0x9a1b('0x3d')];if(_0x3f2894[_0x9a1b('0x3e')][_0x9a1b('0x61')]){_0x39be22['include']=[{'all':!![]}];}_0x39be22=_[_0x9a1b('0x49')]({},_0x39be22,_0x3f2894[_0x9a1b('0x4b')]);return db['VoiceQueue'][_0x9a1b('0x34')](_0x39be22)[_0x9a1b('0x2b')](handleEntityNotFound(_0x364c1f,null))['then'](function(_0x3a2a97){if(_0x3a2a97){var _0xeb21a7=_0x3a2a97['get']({'plain':!![]});_0xeb21a7=qs[_0x9a1b('0x62')](_0xeb21a7,['id','createdAt',_0x9a1b('0x63')]);_0x3f2894[_0x9a1b('0x53')]=_[_0x9a1b('0x62')](_0x3f2894[_0x9a1b('0x53')],['id','createdAt',_0x9a1b('0x63')]);return db[_0x9a1b('0x3a')][_0x9a1b('0x52')](_[_0x9a1b('0x49')](_0xeb21a7,_0x3f2894['body']),{'include':_0x3f2894[_0x9a1b('0x3e')][_0x9a1b('0x61')]?[{'all':!![]}]:undefined})[_0x9a1b('0x2b')](function(_0x47d925){var _0x3a553d=_0x3f2894['user']['get']({'plain':!![]});if(!_0x3a553d)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3a553d[_0x9a1b('0x55')]==='user'){var _0x39f727=_0x47d925[_0x9a1b('0x2d')]({'plain':!![]});var _0x899dfa=[{'name':_0x9a1b('0x2e'),'value':'inbound'},{'name':_0x9a1b('0x64'),'value':_0x9a1b('0x58')}];var _0x53b4d4=_[_0x9a1b('0x34')](_0x899dfa,[_0x9a1b('0x31'),_0x39f727[_0x9a1b('0x33')]])['name'];return db[_0x9a1b('0x59')][_0x9a1b('0x34')]({'where':{'name':_0x53b4d4,'userProfileId':_0x3a553d[_0x9a1b('0x5a')]},'raw':!![]})[_0x9a1b('0x2b')](function(_0x4766e8){if(_0x4766e8&&_0x4766e8[_0x9a1b('0x5b')]===0x0){return db[_0x9a1b('0x5c')]['create']({'name':_0x39f727['name'],'resourceId':_0x39f727['id'],'type':_0x4766e8[_0x9a1b('0x37')],'sectionId':_0x4766e8['id']},{})[_0x9a1b('0x2b')](function(){return _0x47d925;});}else{return _0x47d925;}})[_0x9a1b('0x4f')](function(_0x3448a3){logger[_0x9a1b('0x5d')](_0x9a1b('0x5e'),_0x3448a3);throw _0x3448a3;});}return _0x47d925;});}})[_0x9a1b('0x2b')](respondWithResult(_0x364c1f,0xc9))[_0x9a1b('0x4f')](handleError(_0x364c1f,null));};exports[_0x9a1b('0x2a')]=function(_0x3c14bd,_0x5ce2b0){if(_0x3c14bd[_0x9a1b('0x53')]['id']){delete _0x3c14bd[_0x9a1b('0x53')]['id'];}return db['VoiceQueue']['find']({'where':{'id':_0x3c14bd[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x5ce2b0,null))['then'](saveUpdates(_0x3c14bd['body'],null))[_0x9a1b('0x2b')](respondWithResult(_0x5ce2b0,null))[_0x9a1b('0x4f')](handleError(_0x5ce2b0,null));};exports[_0x9a1b('0x2c')]=function(_0x18b4bb,_0x1c51c8){return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x18b4bb[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x1c51c8,null))[_0x9a1b('0x2b')](removeEntity(_0x1c51c8,null))[_0x9a1b('0x4f')](handleError(_0x1c51c8,null));};exports[_0x9a1b('0x65')]=function(_0x2ec66d,_0x6dc531,_0x33008a){var _0x685f86={'raw':![],'where':{}};var _0x1919ec={};var _0x39a969={'count':0x0,'rows':[]};return db[_0x9a1b('0x3a')][_0x9a1b('0x66')]({'where':{'id':_0x2ec66d[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x6dc531,null))['then'](function(_0x107fb2){if(_0x107fb2){_0x1919ec['model']=_[_0x9a1b('0x3f')](db['CmHopper'][_0x9a1b('0x3b')]);_0x1919ec[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x2ec66d[_0x9a1b('0x3e')]);_0x1919ec['filters']=_[_0x9a1b('0x41')](_0x1919ec['model'],_0x1919ec[_0x9a1b('0x3e')]);_0x685f86['attributes']=_['intersection'](_0x1919ec['model'],qs[_0x9a1b('0x43')](_0x2ec66d[_0x9a1b('0x3e')][_0x9a1b('0x43')]));_0x685f86[_0x9a1b('0x42')]=_0x685f86['attributes'][_0x9a1b('0x51')]?_0x685f86['attributes']:_0x1919ec['model'];if(!_0x2ec66d['query'][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0x685f86[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0x2ec66d[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x685f86[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0x2ec66d[_0x9a1b('0x3e')]['offset']);}_0x685f86[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x2ec66d[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x685f86[_0x9a1b('0x46')]=qs[_0x9a1b('0x40')](_['pick'](_0x2ec66d[_0x9a1b('0x3e')],_0x1919ec[_0x9a1b('0x40')]));_0x685f86['where']['VoiceQueueId']=_0x107fb2['id'];if(_0x2ec66d[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x685f86[_0x9a1b('0x46')]=_[_0x9a1b('0x49')](_0x685f86[_0x9a1b('0x46')],{'$or':_[_0x9a1b('0x30')](_0x685f86[_0x9a1b('0x42')],function(_0x3f0c90){var _0x4501c7={};_0x4501c7[_0x3f0c90]={'$like':'%'+_0x2ec66d['query'][_0x9a1b('0x48')]+'%'};return _0x4501c7;})});}_0x685f86=_[_0x9a1b('0x49')]({},_0x685f86,_0x2ec66d[_0x9a1b('0x4b')]);return db[_0x9a1b('0x69')][_0x9a1b('0x22')]({'where':_0x685f86[_0x9a1b('0x46')]})[_0x9a1b('0x2b')](function(_0x2bef9d){_0x39a969['count']=_0x2bef9d;if(_0x2ec66d[_0x9a1b('0x3e')][_0x9a1b('0x61')]){_0x685f86[_0x9a1b('0x4c')]=[{'all':!![]}];}return db['CmHopper'][_0x9a1b('0x4d')](_0x685f86);})[_0x9a1b('0x2b')](function(_0x114951){_0x39a969[_0x9a1b('0x4e')]=_0x114951;return _0x39a969;});}})[_0x9a1b('0x2b')](respondWithFilteredResult(_0x6dc531,_0x685f86))[_0x9a1b('0x4f')](handleError(_0x6dc531,null));};exports[_0x9a1b('0x6a')]=function(_0xd82974,_0x40a399,_0x34b8a4){var _0x5b4d49={'raw':!![],'where':{}};var _0xe48949={};var _0x3b762a={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0xd82974[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x40a399,null))['then'](function(_0x56cd90){if(_0x56cd90){_0xe48949[_0x9a1b('0x3d')]=_['keys'](db[_0x9a1b('0x6b')][_0x9a1b('0x3b')]);_0xe48949[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0xd82974[_0x9a1b('0x3e')]);_0xe48949['filters']=_[_0x9a1b('0x41')](_0xe48949['model'],_0xe48949['query']);_0x5b4d49[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0xe48949[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0xd82974['query'][_0x9a1b('0x43')]));_0x5b4d49[_0x9a1b('0x42')]=_0x5b4d49[_0x9a1b('0x42')][_0x9a1b('0x51')]?_0x5b4d49['attributes']:_0xe48949['model'];if(!_0xd82974['query'][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0x5b4d49[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0xd82974[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x5b4d49[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0xd82974[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}_0x5b4d49[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0xd82974[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x5b4d49[_0x9a1b('0x46')]=qs[_0x9a1b('0x40')](_[_0x9a1b('0x47')](_0xd82974[_0x9a1b('0x3e')],_0xe48949['filters']));_0x5b4d49[_0x9a1b('0x46')][_0x9a1b('0x6c')]=_0x56cd90['id'];if(_0xd82974[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x5b4d49[_0x9a1b('0x46')]=_['merge'](_0x5b4d49['where'],{'$or':_[_0x9a1b('0x30')](_0x5b4d49[_0x9a1b('0x42')],function(_0x4d3994){var _0x3b118b={};_0x3b118b[_0x4d3994]={'$like':'%'+_0xd82974[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x3b118b;})});}_0x5b4d49=_['merge']({},_0x5b4d49,_0xd82974[_0x9a1b('0x4b')]);return db[_0x9a1b('0x6b')][_0x9a1b('0x22')]({'where':_0x5b4d49[_0x9a1b('0x46')]})['then'](function(_0x2096b5){_0x3b762a[_0x9a1b('0x22')]=_0x2096b5;if(_0xd82974[_0x9a1b('0x3e')]['includeAll']){_0x5b4d49[_0x9a1b('0x4c')]=[{'all':!![]}];}return db[_0x9a1b('0x6b')][_0x9a1b('0x4d')](_0x5b4d49);})[_0x9a1b('0x2b')](function(_0x256e89){_0x3b762a['rows']=_0x256e89;return _0x3b762a;});}})[_0x9a1b('0x2b')](respondWithFilteredResult(_0x40a399,_0x5b4d49))[_0x9a1b('0x4f')](handleError(_0x40a399,null));};exports[_0x9a1b('0x6d')]=function(_0xcac44e,_0x5c4c0e,_0x2c235d){var _0x307f43={'raw':!![],'where':{}};var _0x35904e={};var _0x147b28={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x9a1b('0x66')]({'where':{'id':_0xcac44e[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x5c4c0e,null))[_0x9a1b('0x2b')](function(_0x1ea563){if(_0x1ea563){_0x35904e[_0x9a1b('0x3d')]=_['keys'](db[_0x9a1b('0x6e')][_0x9a1b('0x3b')]);_0x35904e['query']=_[_0x9a1b('0x3f')](_0xcac44e[_0x9a1b('0x3e')]);_0x35904e[_0x9a1b('0x40')]=_[_0x9a1b('0x41')](_0x35904e[_0x9a1b('0x3d')],_0x35904e[_0x9a1b('0x3e')]);_0x307f43['attributes']=_[_0x9a1b('0x41')](_0x35904e[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0xcac44e[_0x9a1b('0x3e')][_0x9a1b('0x43')]));_0x307f43[_0x9a1b('0x42')]=_0x307f43['attributes']['length']?_0x307f43['attributes']:_0x35904e[_0x9a1b('0x3d')];if(!_0xcac44e[_0x9a1b('0x3e')]['hasOwnProperty'](_0x9a1b('0x68'))){_0x307f43['limit']=qs[_0x9a1b('0x24')](_0xcac44e[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x307f43[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0xcac44e[_0x9a1b('0x3e')]['offset']);}_0x307f43[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0xcac44e[_0x9a1b('0x3e')]['sort']);_0x307f43[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0xcac44e[_0x9a1b('0x3e')],_0x35904e[_0x9a1b('0x40')]));_0x307f43[_0x9a1b('0x46')][_0x9a1b('0x6c')]=_0x1ea563['id'];if(_0xcac44e['query'][_0x9a1b('0x48')]){_0x307f43['where']=_[_0x9a1b('0x49')](_0x307f43[_0x9a1b('0x46')],{'$or':_[_0x9a1b('0x30')](_0x307f43[_0x9a1b('0x42')],function(_0x36b6aa){var _0x1c39ed={};_0x1c39ed[_0x36b6aa]={'$like':'%'+_0xcac44e[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x1c39ed;})});}_0x307f43=_[_0x9a1b('0x49')]({},_0x307f43,_0xcac44e[_0x9a1b('0x4b')]);return db[_0x9a1b('0x6e')][_0x9a1b('0x22')]({'where':_0x307f43[_0x9a1b('0x46')]})[_0x9a1b('0x2b')](function(_0x4c27b5){_0x147b28['count']=_0x4c27b5;if(_0xcac44e[_0x9a1b('0x3e')][_0x9a1b('0x61')]){_0x307f43[_0x9a1b('0x4c')]=[{'all':!![]}];}return db[_0x9a1b('0x6e')][_0x9a1b('0x4d')](_0x307f43);})[_0x9a1b('0x2b')](function(_0x2260c5){_0x147b28[_0x9a1b('0x4e')]=_0x2260c5;return _0x147b28;});}})['then'](respondWithFilteredResult(_0x5c4c0e,_0x307f43))[_0x9a1b('0x4f')](handleError(_0x5c4c0e,null));};exports[_0x9a1b('0x6f')]=function(_0x394271,_0x721289,_0x47f1a9){var _0x1d141e={'raw':!![],'where':{}};var _0x1b1831={};var _0x5a4717={'count':0x0,'rows':[]};return db[_0x9a1b('0x3a')][_0x9a1b('0x66')]({'where':{'id':_0x394271[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x721289,null))['then'](function(_0x1b49c0){if(_0x1b49c0){_0x1b1831[_0x9a1b('0x3d')]=_[_0x9a1b('0x3f')](db[_0x9a1b('0x70')]['rawAttributes']);_0x1b1831[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x394271[_0x9a1b('0x3e')]);_0x1b1831[_0x9a1b('0x40')]=_[_0x9a1b('0x41')](_0x1b1831[_0x9a1b('0x3d')],_0x1b1831[_0x9a1b('0x3e')]);_0x1d141e[_0x9a1b('0x42')]=_['intersection'](_0x1b1831[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0x394271[_0x9a1b('0x3e')][_0x9a1b('0x43')]));_0x1d141e[_0x9a1b('0x42')]=_0x1d141e['attributes'][_0x9a1b('0x51')]?_0x1d141e[_0x9a1b('0x42')]:_0x1b1831[_0x9a1b('0x3d')];if(!_0x394271['query']['hasOwnProperty'](_0x9a1b('0x68'))){_0x1d141e['limit']=qs[_0x9a1b('0x24')](_0x394271[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x1d141e['offset']=qs['offset'](_0x394271[_0x9a1b('0x3e')]['offset']);}_0x1d141e[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x394271['query'][_0x9a1b('0x45')]);_0x1d141e[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0x394271['query'],_0x1b1831['filters']));_0x1d141e[_0x9a1b('0x46')][_0x9a1b('0x6c')]=_0x1b49c0['id'];if(_0x394271[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x1d141e[_0x9a1b('0x46')]=_['merge'](_0x1d141e['where'],{'$or':_[_0x9a1b('0x30')](_0x1d141e[_0x9a1b('0x42')],function(_0x71e75){var _0x3c62a8={};_0x3c62a8[_0x71e75]={'$like':'%'+_0x394271[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x3c62a8;})});}_0x1d141e=_[_0x9a1b('0x49')]({},_0x1d141e,_0x394271['options']);return db[_0x9a1b('0x70')][_0x9a1b('0x22')]({'where':_0x1d141e['where']})['then'](function(_0x5240df){_0x5a4717['count']=_0x5240df;if(_0x394271[_0x9a1b('0x3e')][_0x9a1b('0x61')]){_0x1d141e[_0x9a1b('0x4c')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x9a1b('0x4d')](_0x1d141e);})[_0x9a1b('0x2b')](function(_0x4781c1){_0x5a4717[_0x9a1b('0x4e')]=_0x4781c1;return _0x5a4717;});}})['then'](respondWithFilteredResult(_0x721289,_0x1d141e))[_0x9a1b('0x4f')](handleError(_0x721289,null));};exports['getTeams']=function(_0xd2328d,_0x21d3af,_0x1588ac){var _0x5979fe={};var _0x201f1c={};var _0x2eac96;var _0x3aa3a4;return db[_0x9a1b('0x3a')][_0x9a1b('0x66')]({'where':{'id':_0xd2328d['params']['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x21d3af,null))[_0x9a1b('0x2b')](function(_0x319f45){if(_0x319f45){_0x2eac96=_0x319f45;_0x201f1c['model']=_[_0x9a1b('0x3f')](db[_0x9a1b('0x71')][_0x9a1b('0x3b')]);_0x201f1c[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0xd2328d['query']);_0x201f1c[_0x9a1b('0x40')]=_['intersection'](_0x201f1c['model'],_0x201f1c['query']);_0x5979fe[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0x201f1c['model'],qs[_0x9a1b('0x43')](_0xd2328d['query'][_0x9a1b('0x43')]));_0x5979fe[_0x9a1b('0x42')]=_0x5979fe[_0x9a1b('0x42')][_0x9a1b('0x51')]?_0x5979fe[_0x9a1b('0x42')]:_0x201f1c[_0x9a1b('0x3d')];_0x5979fe['order']=qs[_0x9a1b('0x45')](_0xd2328d[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x5979fe[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0xd2328d['query'],_0x201f1c[_0x9a1b('0x40')]));if(_0xd2328d['query'][_0x9a1b('0x48')]){_0x5979fe['where']=_[_0x9a1b('0x49')](_0x5979fe[_0x9a1b('0x46')],{'$or':_['map'](_0x5979fe[_0x9a1b('0x42')],function(_0x14531a){var _0x264fb4={};_0x264fb4[_0x14531a]={'$like':'%'+_0xd2328d[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x264fb4;})});}_0x5979fe=_['merge']({},_0x5979fe,_0xd2328d[_0x9a1b('0x4b')]);return _0x2eac96[_0x9a1b('0x72')](_0x5979fe);}})[_0x9a1b('0x2b')](function(_0x256e09){if(_0x256e09){_0x3aa3a4=_0x256e09[_0x9a1b('0x51')];if(!_0xd2328d[_0x9a1b('0x3e')][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0x5979fe[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0xd2328d[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x5979fe[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0xd2328d[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}return _0x2eac96['getTeams'](_0x5979fe);}})['then'](function(_0x4b4882){if(_0x4b4882){return _0x4b4882?{'count':_0x3aa3a4,'rows':_0x4b4882}:null;}})[_0x9a1b('0x2b')](respondWithResult(_0x21d3af,null))[_0x9a1b('0x4f')](handleError(_0x21d3af,null));};exports[_0x9a1b('0x73')]=function(_0x44a715,_0x3e4899,_0x3c2fa1){var _0x4d8197=_0x44a715[_0x9a1b('0x53')]['teams'];var _0x14ec43=_[_0x9a1b('0x30')](_0x4d8197,'id');return db['Team'][_0x9a1b('0x4d')]({'where':{'id':_0x14ec43},'attributes':['id'],'include':[{'model':db['User'],'as':_0x9a1b('0x74'),'attributes':['id',_0x9a1b('0x37'),'online',_0x9a1b('0x75'),_0x9a1b('0x76')],'raw':!![]}]})[_0x9a1b('0x2b')](function(_0x3481b8){if(_0x3481b8){var _0x1d4b6a=_[_0x9a1b('0x77')](_0x3481b8,function(_0x2999eb){var _0x5183dd=_0x2999eb['get']({'plain':!![]});_0x5183dd[_0x9a1b('0x74')]['forEach'](function(_0x11d29a){_0x11d29a['penalty']=_[_0x9a1b('0x34')](_0x4d8197,{'id':_0x5183dd['id']})['penalty'];});return _0x5183dd[_0x9a1b('0x74')];});return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x44a715[_0x9a1b('0x60')]['id']}})['then'](function(_0x4efc21){return db[_0x9a1b('0x78')][_0x9a1b('0x79')](function(_0x2575da){return _0x4efc21[_0x9a1b('0x73')](_0x14ec43,{'transaction':_0x2575da})[_0x9a1b('0x2b')](function(){return BPromise[_0x9a1b('0x7a')](_0x1d4b6a,function(_0x2e4a2f){return db[_0x9a1b('0x7b')][_0x9a1b('0x7c')]({'where':{'UserId':_0x2e4a2f['id'],'VoiceQueueId':_0x44a715[_0x9a1b('0x60')]['id']},'defaults':{'penalty':_0x2e4a2f[_0x9a1b('0x7d')]},'transaction':_0x2575da});});})[_0x9a1b('0x2b')](function(){return BPromise[_0x9a1b('0x7a')](_[_0x9a1b('0x48')](_0x1d4b6a,{'online':!![]}),function(_0x2eac89){return db[_0x9a1b('0x7e')][_0x9a1b('0x7f')]({'membername':_0x2eac89[_0x9a1b('0x37')],'UserId':_0x2eac89['id'],'queue_name':_0x4efc21['name'],'VoiceQueueId':_0x4efc21['id'],'interface':_[_0x9a1b('0x80')](_0x2eac89['interface'])?util[_0x9a1b('0x81')](_0x9a1b('0x82'),_0x2eac89[_0x9a1b('0x37')]):_0x2eac89[_0x9a1b('0x76')],'paused':_0x2eac89[_0x9a1b('0x75')]||![],'penalty':_0x2eac89[_0x9a1b('0x7d')]},{'transaction':_0x2575da});});})[_0x9a1b('0x2b')](function(){_0x1d4b6a[_0x9a1b('0x83')](function(_0x275f2b){socket['emit'](_0x9a1b('0x84'),{'UserId':_0x275f2b['id'],'VoiceQueueId':_0x4efc21['id']});});});});});}})[_0x9a1b('0x2b')](respondWithStatusCode(_0x3e4899,null))['catch'](handleError(_0x3e4899,null));};exports[_0x9a1b('0x85')]=function(_0x2d6ce8,_0x2dd66b,_0x2f6e32){return db[_0x9a1b('0x71')][_0x9a1b('0x4d')]({'where':{'id':_0x2d6ce8[_0x9a1b('0x3e')][_0x9a1b('0x86')]},'attributes':['id'],'include':[{'model':db[_0x9a1b('0x87')],'as':_0x9a1b('0x74'),'attributes':['id'],'raw':!![]}]})[_0x9a1b('0x2b')](handleEntityNotFound(_0x2dd66b,null))[_0x9a1b('0x2b')](function(_0x35aa75){var _0x32152f=_[_0x9a1b('0x30')](_0x35aa75,'id');var _0x369aaf=[];var _0x3b3f4c=[];var _0x5e8a1e=squel['select']();_0x5e8a1e[_0x9a1b('0x88')](_0x9a1b('0x89'))['from']('team_has_voice_queues','tq')[_0x9a1b('0x8a')]('user_has_teams','ut',_0x9a1b('0x8b'))[_0x9a1b('0x46')](_0x9a1b('0x8c'),_0x2d6ce8[_0x9a1b('0x60')]['id']);for(var _0x133d2c=0x0;_0x133d2c<_0x35aa75['length'];_0x133d2c+=0x1){let _0xf10acc=_0x35aa75[_0x133d2c];for(var _0xd098b1=0x0;_0xd098b1<_0xf10acc[_0x9a1b('0x74')][_0x9a1b('0x51')];_0xd098b1+=0x1){let _0x44871c=_0xf10acc[_0x9a1b('0x74')][_0xd098b1];var _0x2aa95d=_0x5e8a1e['clone']();_0x2aa95d[_0x9a1b('0x46')]('ut.UserId\x20=\x20?',_0x44871c['id']);_0x3b3f4c[_0x9a1b('0x8d')](db[_0x9a1b('0x78')]['query'](_0x2aa95d[_0x9a1b('0x8e')](),{'type':db[_0x9a1b('0x78')]['QueryTypes'][_0x9a1b('0x8f')]})[_0x9a1b('0x2b')](function(_0x2bd71a){if(_0x2bd71a['length']===0x1){return _0x44871c['id'];}else{var _0x21b78e=_[_0x9a1b('0x90')](_[_0x9a1b('0x30')](_0x2bd71a,'TeamId'),function(_0x21cc24){return _[_0x9a1b('0x32')](_0x32152f,_0x21cc24);});if(_0x21b78e){return _0x44871c['id'];}}}));}}return BPromise[_0x9a1b('0x91')](_0x3b3f4c)['then'](function(_0x51a095){_0x369aaf=_(_0x369aaf)[_0x9a1b('0x92')](_0x51a095)[_0x9a1b('0x93')]()[_0x9a1b('0x31')]();return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x2d6ce8[_0x9a1b('0x60')]['id']}})['then'](function(_0x51b152){return db['sequelize'][_0x9a1b('0x79')](function(_0x2b825c){return _0x51b152[_0x9a1b('0x85')](_0x2d6ce8[_0x9a1b('0x3e')]['ids'],{'transaction':_0x2b825c})[_0x9a1b('0x2b')](function(){if(!_[_0x9a1b('0x94')](_0x369aaf)){return _0x51b152[_0x9a1b('0x95')](_0x369aaf,{'transaction':_0x2b825c})[_0x9a1b('0x2b')](function(){return db['UserVoiceQueueRt'][_0x9a1b('0x2c')]({'where':{'VoiceQueueId':_0x2d6ce8['params']['id'],'UserId':_0x369aaf},'transaction':_0x2b825c});});}})[_0x9a1b('0x2b')](function(){_0x369aaf['forEach'](function(_0x289101){socket['emit'](_0x9a1b('0x96'),{'UserId':_0x289101,'VoiceQueueId':_0x51b152['id']});});});});});});})[_0x9a1b('0x2b')](respondWithStatusCode(_0x2dd66b,null))['catch'](handleError(_0x2dd66b,null));};exports['addAgents']=function(_0x2a8228,_0x2e085f,_0x4948a9){var _0x52d44f,_0x2f5e9c;return db[_0x9a1b('0x3a')]['find']({'where':{'id':_0x2a8228[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x2e085f,null))[_0x9a1b('0x2b')](function(_0x56f859){if(_0x56f859){_0x2f5e9c=_0x56f859;return _0x56f859[_0x9a1b('0x97')](_0x2a8228[_0x9a1b('0x53')]['ids'],_[_0x9a1b('0x62')](_0x2a8228[_0x9a1b('0x53')],[_0x9a1b('0x86'),'id'])||{})[_0x9a1b('0x98')](function(_0x419d2e){for(var _0x417af5=0x0;_0x417af5<_0x2a8228[_0x9a1b('0x53')]['ids']['length'];_0x417af5+=0x1){socket[_0x9a1b('0x99')](_0x9a1b('0x84'),{'UserId':_0x2a8228[_0x9a1b('0x53')][_0x9a1b('0x86')][_0x417af5],'VoiceQueueId':_0x2a8228[_0x9a1b('0x60')]['id']});}return _0x419d2e;});}})[_0x9a1b('0x2b')](function(_0x2d5214){_0x52d44f=_0x2d5214||[];if(_0x2f5e9c){return db[_0x9a1b('0x87')][_0x9a1b('0x4d')]({'where':{'id':_0x2a8228[_0x9a1b('0x53')][_0x9a1b('0x86')]},'attributes':['id','name','online',_0x9a1b('0x75'),_0x9a1b('0x76')],'raw':!![]});}})['then'](function(_0x4c82bd){if(!_['isEmpty'](_0x4c82bd)){var _0x3598b7=[];for(var _0x5356d0=0x0;_0x5356d0<_0x4c82bd['length'];_0x5356d0++){if(_0x4c82bd[_0x5356d0][_0x9a1b('0x9a')]){_0x3598b7[_0x9a1b('0x8d')](db['UserVoiceQueueRt'][_0x9a1b('0x7f')]({'membername':_0x4c82bd[_0x5356d0][_0x9a1b('0x37')],'UserId':_0x4c82bd[_0x5356d0]['id'],'queue_name':_0x2f5e9c[_0x9a1b('0x37')],'VoiceQueueId':_0x2f5e9c['id'],'interface':_['isNil'](_0x4c82bd[_0x5356d0][_0x9a1b('0x76')])?util[_0x9a1b('0x81')]('SIP/%s',_0x4c82bd[_0x5356d0][_0x9a1b('0x37')]):_0x4c82bd[_0x5356d0][_0x9a1b('0x76')],'paused':_0x4c82bd[_0x5356d0][_0x9a1b('0x75')]||![],'penalty':_0x2a8228[_0x9a1b('0x53')]['penalty']||0x0}));}}return BPromise[_0x9a1b('0x91')](_0x3598b7);}})[_0x9a1b('0x2b')](function(){return _0x52d44f;})['then'](respondWithResult(_0x2e085f,null))[_0x9a1b('0x4f')](handleError(_0x2e085f,null));};exports[_0x9a1b('0x95')]=function(_0x1ed9de,_0x125e33,_0x1cb4f5){return db[_0x9a1b('0x3a')]['find']({'where':{'id':_0x1ed9de[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x125e33,null))[_0x9a1b('0x2b')](function(_0x1203fd){if(_0x1203fd){return _0x1203fd[_0x9a1b('0x95')](_0x1ed9de[_0x9a1b('0x3e')][_0x9a1b('0x86')])[_0x9a1b('0x2b')](function(){if(_[_0x9a1b('0x9b')](_0x1ed9de['query'][_0x9a1b('0x86')])){for(var _0x59d0d6=0x0;_0x59d0d6<_0x1ed9de[_0x9a1b('0x3e')]['ids'][_0x9a1b('0x51')];_0x59d0d6+=0x1){socket[_0x9a1b('0x99')](_0x9a1b('0x96'),{'UserId':Number(_0x1ed9de[_0x9a1b('0x3e')][_0x9a1b('0x86')][_0x59d0d6]),'VoiceQueueId':Number(_0x1ed9de['params']['id'])});}}else{socket['emit'](_0x9a1b('0x96'),{'UserId':Number(_0x1ed9de[_0x9a1b('0x3e')][_0x9a1b('0x86')]),'VoiceQueueId':Number(_0x1ed9de[_0x9a1b('0x60')]['id'])});}});}})['then'](function(_0x12a64e){return db[_0x9a1b('0x7e')]['destroy']({'where':{'VoiceQueueId':_0x1ed9de[_0x9a1b('0x60')]['id'],'UserId':_0x1ed9de[_0x9a1b('0x3e')][_0x9a1b('0x86')]}})['then'](function(){return _0x12a64e;});})['then'](respondWithStatusCode(_0x125e33,null))[_0x9a1b('0x4f')](handleError(_0x125e33,null));};exports[_0x9a1b('0x9c')]=function(_0x52c65c,_0x4b0f13,_0x449bbc){var _0x133228={};var _0x5426c2={};var _0x4177f3;var _0x44f73d;return db[_0x9a1b('0x3a')]['findOne']({'where':{'id':_0x52c65c[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x4b0f13,null))[_0x9a1b('0x2b')](function(_0x4f574a){if(_0x4f574a){_0x4177f3=_0x4f574a;_0x5426c2[_0x9a1b('0x3d')]=_[_0x9a1b('0x3f')](db[_0x9a1b('0x87')][_0x9a1b('0x3b')]);_0x5426c2['query']=_[_0x9a1b('0x3f')](_0x52c65c[_0x9a1b('0x3e')]);_0x5426c2[_0x9a1b('0x40')]=_['intersection'](_0x5426c2[_0x9a1b('0x3d')],_0x5426c2['query']);_0x133228[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0x5426c2[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0x52c65c['query'][_0x9a1b('0x43')]));_0x133228[_0x9a1b('0x42')]=_0x133228[_0x9a1b('0x42')][_0x9a1b('0x51')]?_0x133228[_0x9a1b('0x42')]:_0x5426c2['model'];_0x133228[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x52c65c[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x133228[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0x52c65c[_0x9a1b('0x3e')],_0x5426c2['filters']));if(_0x52c65c[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x133228['where']=_[_0x9a1b('0x49')](_0x133228['where'],{'$or':_[_0x9a1b('0x30')](_0x133228[_0x9a1b('0x42')],function(_0x3bffee){var _0x1e8554={};_0x1e8554[_0x3bffee]={'$like':'%'+_0x52c65c[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x1e8554;})});}_0x133228=_[_0x9a1b('0x49')]({},_0x133228,_0x52c65c[_0x9a1b('0x4b')]);return _0x4177f3[_0x9a1b('0x9c')](_0x133228);}})[_0x9a1b('0x2b')](function(_0x3de127){if(_0x3de127){_0x44f73d=_0x3de127['length'];if(!_0x52c65c[_0x9a1b('0x3e')][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0x133228[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0x52c65c[_0x9a1b('0x3e')]['limit']);_0x133228[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0x52c65c[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}return _0x4177f3['getAgents'](_0x133228);}})['then'](function(_0x4d88dd){if(_0x4d88dd){return _0x4d88dd?{'count':_0x44f73d,'rows':_0x4d88dd}:null;}})[_0x9a1b('0x2b')](respondWithResult(_0x4b0f13,null))[_0x9a1b('0x4f')](handleError(_0x4b0f13,null));};exports['getMembers']=function(_0x59cb30,_0x20b24c,_0x136807){var _0x2a2af5={};var _0xae40e={};var _0x164638;var _0x3897d0;return db[_0x9a1b('0x3a')]['findOne']({'where':{'id':_0x59cb30[_0x9a1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x20b24c,null))[_0x9a1b('0x2b')](function(_0x599504){if(_0x599504){_0x164638=_0x599504;_0xae40e['model']=_[_0x9a1b('0x3f')](db[_0x9a1b('0x7e')][_0x9a1b('0x3b')]);_0xae40e[_0x9a1b('0x3e')]=_['keys'](_0x59cb30[_0x9a1b('0x3e')]);_0xae40e[_0x9a1b('0x40')]=_[_0x9a1b('0x41')](_0xae40e[_0x9a1b('0x3d')],_0xae40e[_0x9a1b('0x3e')]);_0x2a2af5[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0xae40e[_0x9a1b('0x3d')],qs[_0x9a1b('0x43')](_0x59cb30['query'][_0x9a1b('0x43')]));_0x2a2af5['attributes']=_0x2a2af5['attributes'][_0x9a1b('0x51')]?_0x2a2af5[_0x9a1b('0x42')]:_0xae40e[_0x9a1b('0x3d')];_0x2a2af5[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x59cb30[_0x9a1b('0x3e')]['sort']);_0x2a2af5[_0x9a1b('0x46')]=qs[_0x9a1b('0x40')](_[_0x9a1b('0x47')](_0x59cb30[_0x9a1b('0x3e')],_0xae40e[_0x9a1b('0x40')]));if(_0x59cb30[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x2a2af5[_0x9a1b('0x46')]=_[_0x9a1b('0x49')](_0x2a2af5['where'],{'$or':_[_0x9a1b('0x30')](_0x2a2af5[_0x9a1b('0x42')],function(_0x5a222a){var _0x5c9607={};_0x5c9607[_0x5a222a]={'$like':'%'+_0x59cb30['query'][_0x9a1b('0x48')]+'%'};return _0x5c9607;})});}_0x2a2af5=_[_0x9a1b('0x49')]({},_0x2a2af5,_0x59cb30[_0x9a1b('0x4b')]);return _0x164638[_0x9a1b('0x9d')](_0x2a2af5);}})[_0x9a1b('0x2b')](function(_0x3da46a){if(_0x3da46a){_0x3897d0=_0x3da46a['length'];if(!_0x59cb30[_0x9a1b('0x3e')][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0x2a2af5[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0x59cb30[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x2a2af5[_0x9a1b('0x23')]=qs[_0x9a1b('0x23')](_0x59cb30[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}return _0x164638['getMembers'](_0x2a2af5);}})[_0x9a1b('0x2b')](function(_0x13511a){return _0x13511a?{'count':_0x3897d0,'rows':_0x13511a}:null;})[_0x9a1b('0x2b')](respondWithResult(_0x20b24c,null))['catch'](handleError(_0x20b24c,null));};exports[_0x9a1b('0x9e')]=function(_0x58ffc0,_0x4b13d2,_0x58f51c){var _0xb06bc9={};var _0x5a7c6f={};var _0x49d72d;var _0x1a0ceb;return db[_0x9a1b('0x3a')]['findOne']({'where':{'id':_0x58ffc0[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x4b13d2,null))[_0x9a1b('0x2b')](function(_0x36caab){if(_0x36caab){_0x49d72d=_0x36caab;_0x5a7c6f[_0x9a1b('0x3d')]=_[_0x9a1b('0x3f')](db[_0x9a1b('0x9f')]['rawAttributes']);_0x5a7c6f[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x58ffc0['query']);_0x5a7c6f['filters']=_[_0x9a1b('0x41')](_0x5a7c6f['model'],_0x5a7c6f[_0x9a1b('0x3e')]);_0xb06bc9[_0x9a1b('0x42')]=_[_0x9a1b('0x41')](_0x5a7c6f[_0x9a1b('0x3d')],qs['fields'](_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x43')]));_0xb06bc9[_0x9a1b('0x42')]=_0xb06bc9[_0x9a1b('0x42')]['length']?_0xb06bc9['attributes']:_0x5a7c6f['model'];_0xb06bc9['order']=qs[_0x9a1b('0x45')](_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0xb06bc9[_0x9a1b('0x46')]=qs[_0x9a1b('0x40')](_[_0x9a1b('0x47')](_0x58ffc0[_0x9a1b('0x3e')],_0x5a7c6f[_0x9a1b('0x40')]));if(_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0xb06bc9[_0x9a1b('0x46')]=_['merge'](_0xb06bc9[_0x9a1b('0x46')],{'$or':_[_0x9a1b('0x30')](_0xb06bc9[_0x9a1b('0x42')],function(_0x5c11c6){var _0x191396={};_0x191396[_0x5c11c6]={'$like':'%'+_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x191396;})});}_0xb06bc9=_[_0x9a1b('0x49')]({},_0xb06bc9,_0x58ffc0['options']);return _0x49d72d[_0x9a1b('0x9e')](_0xb06bc9);}})['then'](function(_0x48bc73){if(_0x48bc73){_0x1a0ceb=_0x48bc73['length'];if(!_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x67')](_0x9a1b('0x68'))){_0xb06bc9[_0x9a1b('0x24')]=qs['limit'](_0x58ffc0[_0x9a1b('0x3e')]['limit']);_0xb06bc9['offset']=qs['offset'](_0x58ffc0[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}return _0x49d72d[_0x9a1b('0x9e')](_0xb06bc9);}})[_0x9a1b('0x2b')](function(_0x2c49f1){if(_0x2c49f1){return _0x2c49f1?{'count':_0x1a0ceb,'rows':_0x2c49f1}:null;}})[_0x9a1b('0x2b')](respondWithResult(_0x4b13d2,null))[_0x9a1b('0x4f')](handleError(_0x4b13d2,null));};exports['addLists']=function(_0x52ba24,_0x39fb72,_0x14c2b9){var _0x53da5f,_0x10b371;return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x52ba24[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x39fb72,null))[_0x9a1b('0x2b')](function(_0x36404d){if(_0x36404d){_0x10b371=_0x36404d;return _0x36404d[_0x9a1b('0xa0')](_0x52ba24[_0x9a1b('0x53')][_0x9a1b('0x86')],_[_0x9a1b('0x62')](_0x52ba24[_0x9a1b('0x53')],[_0x9a1b('0x86'),'id'])||{});}return null;})[_0x9a1b('0x98')](function(_0x329ce0){var _0x515a9b;_0x53da5f=_0x329ce0||[];var _0xaee330=[];if(_0x329ce0){for(var _0xdfa9e=0x0;_0xdfa9e<_0x329ce0[_0x9a1b('0x51')];_0xdfa9e+=0x1){var _0x1db668=_0x329ce0[_0xdfa9e]['get']({'plain':!![]});_0x10b371['dialCheckDuplicateType']=_0x52ba24[_0x9a1b('0x53')]['dialCheckDuplicateType']?_0x52ba24[_0x9a1b('0x53')][_0x9a1b('0xa1')]:_0x10b371[_0x9a1b('0xa1')];switch(_0x10b371[_0x9a1b('0xa1')]){case _0x9a1b('0xa2'):_0x515a9b=squel[_0x9a1b('0xa3')]()[_0x9a1b('0xa4')](_0x9a1b('0xa5'))[_0x9a1b('0xa6')]([_0x9a1b('0xa7'),_0x9a1b('0xa8'),'ContactId','ListId',_0x9a1b('0x6c'),'createdAt',_0x9a1b('0x63')],squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')](_0x9a1b('0xa7'),'phone')[_0x9a1b('0x88')]('NOW()',_0x9a1b('0xa8'))[_0x9a1b('0x88')]('id',_0x9a1b('0xaa'))[_0x9a1b('0x88')](_0x1db668[_0x9a1b('0xab')][_0x9a1b('0x8e')](),_0x9a1b('0xac'))[_0x9a1b('0x88')](_0x52ba24[_0x9a1b('0x60')]['id'][_0x9a1b('0x8e')](),_0x9a1b('0x6c'))[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0xae'))[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0x63'))['from'](_0x9a1b('0xaf'))[_0x9a1b('0x46')](_0x9a1b('0xb0'))['where'](_0x9a1b('0xb1'),_0x1db668[_0x9a1b('0xab')]['toString']())[_0x9a1b('0x46')](_0x9a1b('0xb2'))[_0x9a1b('0x46')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x9a1b('0x88')](_0x9a1b('0xb3'))[_0x9a1b('0xb4')](_0x9a1b('0xb5'))[_0x9a1b('0x46')](_0x9a1b('0x8c'),_0x52ba24[_0x9a1b('0x60')]['id'][_0x9a1b('0x8e')]()))['where'](_0x9a1b('0xb6'),squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')](_0x9a1b('0xb7'))[_0x9a1b('0xb4')](_0x9a1b('0xa5'))[_0x9a1b('0x46')]('VoiceQueueId\x20=\x20?',_0x52ba24['params']['id']['toString']())))[_0x9a1b('0x8e')]();break;case _0x9a1b('0xb8'):_0x515a9b=squel[_0x9a1b('0xa3')]()[_0x9a1b('0xa4')](_0x9a1b('0xa5'))['fromQuery']([_0x9a1b('0xa7'),_0x9a1b('0xa8'),_0x9a1b('0xaa'),'ListId',_0x9a1b('0x6c'),_0x9a1b('0xae'),'updatedAt'],squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')](_0x9a1b('0xa7'),_0x9a1b('0xa7'))[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0xa8'))['field']('id',_0x9a1b('0xaa'))[_0x9a1b('0x88')](_0x1db668['CmListId'][_0x9a1b('0x8e')](),'ListId')['field'](_0x52ba24['params']['id']['toString'](),'VoiceQueueId')['field'](_0x9a1b('0xad'),_0x9a1b('0xae'))['field'](_0x9a1b('0xad'),_0x9a1b('0x63'))[_0x9a1b('0xb4')](_0x9a1b('0xaf'))[_0x9a1b('0x46')](_0x9a1b('0xb0'))[_0x9a1b('0x46')]('ListId\x20=\x20?',_0x1db668[_0x9a1b('0xab')][_0x9a1b('0x8e')]())[_0x9a1b('0x46')]('phone\x20IS\x20NOT\x20NULL')[_0x9a1b('0x46')](_0x9a1b('0xb6'),squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')](_0x9a1b('0xb7'))[_0x9a1b('0xb4')](_0x9a1b('0xa5'))[_0x9a1b('0x46')](_0x9a1b('0x8c'),_0x52ba24[_0x9a1b('0x60')]['id']['toString']())))[_0x9a1b('0x8e')]();break;default:_0x515a9b=squel[_0x9a1b('0xa3')]()[_0x9a1b('0xa4')]('cm_hopper')['fromQuery'](['phone',_0x9a1b('0xa8'),'ContactId',_0x9a1b('0xac'),_0x9a1b('0x6c'),_0x9a1b('0xae'),_0x9a1b('0x63')],squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')](_0x9a1b('0xa7'),'phone')['field']('NOW()',_0x9a1b('0xa8'))['field']('id',_0x9a1b('0xaa'))[_0x9a1b('0x88')](_0x1db668[_0x9a1b('0xab')][_0x9a1b('0x8e')](),'ListId')[_0x9a1b('0x88')](_0x52ba24[_0x9a1b('0x60')]['id'][_0x9a1b('0x8e')](),'VoiceQueueId')[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0xae'))[_0x9a1b('0x88')]('NOW()',_0x9a1b('0x63'))[_0x9a1b('0xb4')](_0x9a1b('0xaf'))[_0x9a1b('0x46')]('deletedAt\x20IS\x20NULL')[_0x9a1b('0x46')](_0x9a1b('0xb1'),_0x1db668['CmListId'][_0x9a1b('0x8e')]())[_0x9a1b('0x46')](_0x9a1b('0xb2')))[_0x9a1b('0x8e')]();}_0xaee330['push'](db[_0x9a1b('0x78')][_0x9a1b('0x3e')](_0x515a9b));}return BPromise[_0x9a1b('0x91')](_0xaee330);}})[_0x9a1b('0x2b')](function(){return _0x53da5f;})[_0x9a1b('0x2b')](respondWithResult(_0x39fb72,null))[_0x9a1b('0x4f')](handleError(_0x39fb72,null));};exports[_0x9a1b('0xb9')]=function(_0x568eb5,_0x1f84a9,_0x31a3a8){return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x568eb5[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x1f84a9,null))[_0x9a1b('0x2b')](function(_0x38eb2b){if(_0x38eb2b){return _0x38eb2b[_0x9a1b('0xb9')](_0x568eb5[_0x9a1b('0x3e')][_0x9a1b('0x86')]);}})['then'](function(_0x5de3c8){if(_0x5de3c8){return db[_0x9a1b('0x69')]['destroy']({'where':{'ListId':_0x568eb5[_0x9a1b('0x3e')][_0x9a1b('0x86')],'VoiceQueueId':_0x568eb5['params']['id']}})[_0x9a1b('0x2b')](function(){return _0x5de3c8;});}})[_0x9a1b('0x2b')](respondWithStatusCode(_0x1f84a9,null))['catch'](handleError(_0x1f84a9,null));};exports['getBlackLists']=function(_0x2ea3b7,_0x26e976,_0x49a734){var _0x67d33a={};var _0x354674={};var _0x45f76e;var _0x430bea;return db[_0x9a1b('0x3a')][_0x9a1b('0x66')]({'where':{'id':_0x2ea3b7[_0x9a1b('0x60')]['id']}})['then'](handleEntityNotFound(_0x26e976,null))['then'](function(_0x33e703){if(_0x33e703){_0x45f76e=_0x33e703;_0x354674[_0x9a1b('0x3d')]=_['keys'](db[_0x9a1b('0x9f')][_0x9a1b('0x3b')]);_0x354674[_0x9a1b('0x3e')]=_[_0x9a1b('0x3f')](_0x2ea3b7[_0x9a1b('0x3e')]);_0x354674[_0x9a1b('0x40')]=_[_0x9a1b('0x41')](_0x354674[_0x9a1b('0x3d')],_0x354674[_0x9a1b('0x3e')]);_0x67d33a['attributes']=_[_0x9a1b('0x41')](_0x354674['model'],qs[_0x9a1b('0x43')](_0x2ea3b7['query']['fields']));_0x67d33a['attributes']=_0x67d33a[_0x9a1b('0x42')][_0x9a1b('0x51')]?_0x67d33a[_0x9a1b('0x42')]:_0x354674[_0x9a1b('0x3d')];_0x67d33a[_0x9a1b('0x44')]=qs[_0x9a1b('0x45')](_0x2ea3b7[_0x9a1b('0x3e')][_0x9a1b('0x45')]);_0x67d33a[_0x9a1b('0x46')]=qs['filters'](_[_0x9a1b('0x47')](_0x2ea3b7['query'],_0x354674[_0x9a1b('0x40')]));if(_0x2ea3b7[_0x9a1b('0x3e')][_0x9a1b('0x48')]){_0x67d33a[_0x9a1b('0x46')]=_[_0x9a1b('0x49')](_0x67d33a[_0x9a1b('0x46')],{'$or':_[_0x9a1b('0x30')](_0x67d33a[_0x9a1b('0x42')],function(_0x22c72d){var _0x4f2750={};_0x4f2750[_0x22c72d]={'$like':'%'+_0x2ea3b7[_0x9a1b('0x3e')][_0x9a1b('0x48')]+'%'};return _0x4f2750;})});}_0x67d33a=_[_0x9a1b('0x49')]({},_0x67d33a,_0x2ea3b7[_0x9a1b('0x4b')]);return _0x45f76e['getBlackLists'](_0x67d33a);}})[_0x9a1b('0x2b')](function(_0x585830){if(_0x585830){_0x430bea=_0x585830[_0x9a1b('0x51')];if(!_0x2ea3b7[_0x9a1b('0x3e')]['hasOwnProperty'](_0x9a1b('0x68'))){_0x67d33a[_0x9a1b('0x24')]=qs[_0x9a1b('0x24')](_0x2ea3b7[_0x9a1b('0x3e')][_0x9a1b('0x24')]);_0x67d33a[_0x9a1b('0x23')]=qs['offset'](_0x2ea3b7[_0x9a1b('0x3e')][_0x9a1b('0x23')]);}return _0x45f76e[_0x9a1b('0xba')](_0x67d33a);}})[_0x9a1b('0x2b')](function(_0x2c310d){if(_0x2c310d){return _0x2c310d?{'count':_0x430bea,'rows':_0x2c310d}:null;}})[_0x9a1b('0x2b')](respondWithResult(_0x26e976,null))[_0x9a1b('0x4f')](handleError(_0x26e976,null));};exports['addBlackLists']=function(_0x5e8fe5,_0x5b7bcf,_0x374d24){var _0x252b14,_0x5b1ddd;return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x5e8fe5[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x5b7bcf,null))[_0x9a1b('0x2b')](function(_0x2d7a9b){if(_0x2d7a9b){_0x5b1ddd=_0x2d7a9b;return _0x2d7a9b[_0x9a1b('0xbb')](_0x5e8fe5[_0x9a1b('0x53')][_0x9a1b('0x86')],_[_0x9a1b('0x62')](_0x5e8fe5[_0x9a1b('0x53')],[_0x9a1b('0x86'),'id'])||{});}return null;})[_0x9a1b('0x98')](function(_0x42fa66){var _0x52366c;_0x252b14=_0x42fa66||[];var _0x51bd5b=[];if(_0x42fa66){for(var _0x59598f=0x0;_0x59598f<_0x42fa66[_0x9a1b('0x51')];_0x59598f+=0x1){var _0xbf9178=_0x42fa66[_0x59598f]['get']({'plain':!![]});_0x52366c=squel[_0x9a1b('0xa3')]()['into'](_0x9a1b('0xbc'))[_0x9a1b('0xa6')](['phone','ContactId',_0x9a1b('0xac'),'VoiceQueueId',_0x9a1b('0xae'),'updatedAt'],squel[_0x9a1b('0xa9')]()[_0x9a1b('0x88')]('phone',_0x9a1b('0xa7'))[_0x9a1b('0x88')]('id',_0x9a1b('0xaa'))[_0x9a1b('0x88')](_0xbf9178[_0x9a1b('0xab')][_0x9a1b('0x8e')](),_0x9a1b('0xac'))[_0x9a1b('0x88')](_0x5e8fe5['params']['id']['toString'](),_0x9a1b('0x6c'))[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0xae'))[_0x9a1b('0x88')](_0x9a1b('0xad'),_0x9a1b('0x63'))[_0x9a1b('0xb4')](_0x9a1b('0xaf'))[_0x9a1b('0x46')]('deletedAt\x20IS\x20NULL')['where'](_0x9a1b('0xb1'),_0xbf9178[_0x9a1b('0xab')][_0x9a1b('0x8e')]())[_0x9a1b('0x46')](_0x9a1b('0xb2')))[_0x9a1b('0x8e')]();_0x51bd5b['push'](db[_0x9a1b('0x78')]['query'](_0x52366c));}return BPromise[_0x9a1b('0x91')](_0x51bd5b);}})[_0x9a1b('0x2b')](function(){return _0x252b14;})[_0x9a1b('0x2b')](respondWithResult(_0x5b7bcf,null))[_0x9a1b('0x4f')](handleError(_0x5b7bcf,null));};exports[_0x9a1b('0xbd')]=function(_0x55fa92,_0x386e6f,_0x1f9eae){return db[_0x9a1b('0x3a')][_0x9a1b('0x34')]({'where':{'id':_0x55fa92['params']['id']}})[_0x9a1b('0x2b')](handleEntityNotFound(_0x386e6f,null))[_0x9a1b('0x2b')](function(_0x4dc229){if(_0x4dc229){return _0x4dc229[_0x9a1b('0xbd')](_0x55fa92[_0x9a1b('0x3e')][_0x9a1b('0x86')]);}})[_0x9a1b('0x2b')](function(_0x5f4786){if(_0x5f4786){return db[_0x9a1b('0x70')][_0x9a1b('0x2c')]({'where':{'ListId':_0x55fa92['query'][_0x9a1b('0x86')],'VoiceQueueId':_0x55fa92[_0x9a1b('0x60')]['id']}})[_0x9a1b('0x2b')](function(){return _0x5f4786;});}})[_0x9a1b('0x2b')](respondWithStatusCode(_0x386e6f,null))[_0x9a1b('0x4f')](handleError(_0x386e6f,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 2236c07..0e42995 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 _0xbe60=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x4baae2,_0x487ab6){var _0x1a2285=function(_0x1cea47){while(--_0x1cea47){_0x4baae2['push'](_0x4baae2['shift']());}};_0x1a2285(++_0x487ab6);}(_0xbe60,0x10c));var _0x0be6=function(_0x4328cc,_0x255c02){_0x4328cc=_0x4328cc-0x0;var _0x1a96d3=_0xbe60[_0x4328cc];return _0x1a96d3;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x0be6('0x0'))['db'][_0x0be6('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x0be6('0x2')](0x0);var events={'afterCreate':_0x0be6('0x3'),'afterUpdate':_0x0be6('0x4'),'afterDestroy':_0x0be6('0x5')};function emitEvent(_0x47be15){return function(_0x1bdae3,_0x1f99b5,_0x29d66b){VoiceQueueEvents[_0x0be6('0x6')](_0x47be15+':'+_0x1bdae3['id'],_0x1bdae3);VoiceQueueEvents[_0x0be6('0x6')](_0x47be15,_0x1bdae3);_0x29d66b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x0be6('0x7')](e,emitEvent(event));}}module[_0x0be6('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0x1c5f=['emit','hasOwnProperty','hook','exports','events','VoiceQueue','setMaxListeners','update','remove'];(function(_0x49a57c,_0x2eb02c){var _0x4e0316=function(_0x37e2e5){while(--_0x37e2e5){_0x49a57c['push'](_0x49a57c['shift']());}};_0x4e0316(++_0x2eb02c);}(_0x1c5f,0x1ea));var _0xf1c5=function(_0x2ddb2f,_0x17ed63){_0x2ddb2f=_0x2ddb2f-0x0;var _0x352f4f=_0x1c5f[_0x2ddb2f];return _0x352f4f;};'use strict';var EventEmitter=require(_0xf1c5('0x0'));var VoiceQueue=require('../../mysqldb')['db'][_0xf1c5('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0xf1c5('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf1c5('0x3'),'afterDestroy':_0xf1c5('0x4')};function emitEvent(_0x37d7ae){return function(_0x46aa8d,_0x4496ab,_0x378fb8){VoiceQueueEvents['emit'](_0x37d7ae+':'+_0x46aa8d['id'],_0x46aa8d);VoiceQueueEvents[_0xf1c5('0x5')](_0x37d7ae,_0x46aa8d);_0x378fb8(null);};}for(var e in events){if(events[_0xf1c5('0x6')](e)){var event=events[e];VoiceQueue[_0xf1c5('0x7')](e,emitEvent(event));}}module[_0xf1c5('0x8')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index d8de174..dce1d5b 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 _0x3a50=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceQueue.attributes','VoiceQueue','voice_queues','lodash','util'];(function(_0x46cb37,_0x1e1692){var _0x335f57=function(_0x5d1446){while(--_0x5d1446){_0x46cb37['push'](_0x46cb37['shift']());}};_0x335f57(++_0x1e1692);}(_0x3a50,0xe5));var _0x03a5=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0x3a50[_0x1cc8fe];return _0x230054;};'use strict';var _=require(_0x03a5('0x0'));var util=require(_0x03a5('0x1'));var logger=require(_0x03a5('0x2'))(_0x03a5('0x3'));var moment=require(_0x03a5('0x4'));var BPromise=require(_0x03a5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x03a5('0x6'));var config=require(_0x03a5('0x7'));var attributes=require(_0x03a5('0x8'));module['exports']=function(_0x473225,_0x24b62b){return _0x473225['define'](_0x03a5('0x9'),attributes,{'tableName':_0x03a5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7706=['voice_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceQueue'];(function(_0x28394f,_0x5ebdd2){var _0x2618d2=function(_0x2ffed6){while(--_0x2ffed6){_0x28394f['push'](_0x28394f['shift']());}};_0x2618d2(++_0x5ebdd2);}(_0x7706,0x85));var _0x6770=function(_0x49d320,_0x50a5c7){_0x49d320=_0x49d320-0x0;var _0x478006=_0x7706[_0x49d320];return _0x478006;};'use strict';var _=require(_0x6770('0x0'));var util=require(_0x6770('0x1'));var logger=require(_0x6770('0x2'))('api');var moment=require(_0x6770('0x3'));var BPromise=require(_0x6770('0x4'));var rp=require(_0x6770('0x5'));var fs=require('fs');var path=require(_0x6770('0x6'));var rimraf=require(_0x6770('0x7'));var config=require(_0x6770('0x8'));var attributes=require('./voiceQueue.attributes');module['exports']=function(_0x1d23f2,_0x250864){return _0x1d23f2[_0x6770('0x9')](_0x6770('0xa'),attributes,{'tableName':_0x6770('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index a3f2ad9..7b6d099 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 _0x4ff0=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','defaults','localhost','socket.io-emitter','redis','./voiceQueue.socket','register','request','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueue','options','raw','where','attributes','limit','include','map','model','then','GetVoiceQueue','ShowVoiceQueue','lodash','util','bluebird','randomstring'];(function(_0xb50bc,_0x41d8ec){var _0x31ec0f=function(_0x47d1a8){while(--_0x47d1a8){_0xb50bc['push'](_0xb50bc['shift']());}};_0x31ec0f(++_0x41d8ec);}(_0x4ff0,0x196));var _0x04ff=function(_0x38f55f,_0x349ce0){_0x38f55f=_0x38f55f-0x0;var _0x98b5c0=_0x4ff0[_0x38f55f];return _0x98b5c0;};'use strict';var _=require(_0x04ff('0x0'));var util=require(_0x04ff('0x1'));var moment=require('moment');var BPromise=require(_0x04ff('0x2'));var rs=require(_0x04ff('0x3'));var fs=require('fs');var Redis=require(_0x04ff('0x4'));var db=require(_0x04ff('0x5'))['db'];var utils=require(_0x04ff('0x6'));var logger=require('../../config/logger')(_0x04ff('0x7'));var config=require('../../config/environment');var jayson=require(_0x04ff('0x8'));var client=jayson[_0x04ff('0x9')][_0x04ff('0xa')]({'port':0x232a});config['redis']=_[_0x04ff('0xb')](config['redis'],{'host':_0x04ff('0xc'),'port':0x18eb});var socket=require(_0x04ff('0xd'))(new Redis(config[_0x04ff('0xe')]));require(_0x04ff('0xf'))[_0x04ff('0x10')](socket);function respondWithRpcPromise(_0x56bc2d,_0x296561,_0x5ddfbf){return new BPromise(function(_0x3d91a9,_0x2a4cca){return client[_0x04ff('0x11')](_0x56bc2d,_0x5ddfbf)['then'](function(_0xe0ea59){logger[_0x04ff('0x12')](_0x04ff('0x13'),_0x296561,_0x04ff('0x14'));logger[_0x04ff('0x15')](_0x04ff('0x16'),_0x296561,'request\x20sent',JSON[_0x04ff('0x17')](_0xe0ea59));if(_0xe0ea59[_0x04ff('0x18')]){if(_0xe0ea59[_0x04ff('0x18')][_0x04ff('0x19')]===0x1f4){logger[_0x04ff('0x18')](_0x04ff('0x13'),_0x296561,_0xe0ea59['error'][_0x04ff('0x1a')]);return _0x2a4cca(_0xe0ea59[_0x04ff('0x18')][_0x04ff('0x1a')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x296561,_0xe0ea59[_0x04ff('0x18')][_0x04ff('0x1a')]);return _0x3d91a9(_0xe0ea59['error'][_0x04ff('0x1a')]);}else{logger['info'](_0x04ff('0x13'),_0x296561,_0x04ff('0x14'));_0x3d91a9(_0xe0ea59[_0x04ff('0x1b')][_0x04ff('0x1a')]);}})[_0x04ff('0x1c')](function(_0x5509d0){logger[_0x04ff('0x18')](_0x04ff('0x13'),_0x296561,_0x5509d0);_0x2a4cca(_0x5509d0);});});}exports['GetVoiceQueue']=function(_0x54c778){var _0x2daf59=this;return new Promise(function(_0x142874,_0x1a1d1a){return db[_0x04ff('0x1d')]['findAll']({'raw':_0x54c778[_0x04ff('0x1e')]?_0x54c778['options'][_0x04ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x54c778[_0x04ff('0x1e')]?_0x54c778[_0x04ff('0x1e')][_0x04ff('0x20')]||null:null,'attributes':_0x54c778['options']?_0x54c778['options'][_0x04ff('0x21')]||null:null,'limit':_0x54c778[_0x04ff('0x1e')]?_0x54c778[_0x04ff('0x1e')][_0x04ff('0x22')]||null:null,'include':_0x54c778[_0x04ff('0x1e')]?_0x54c778[_0x04ff('0x1e')][_0x04ff('0x23')]?_[_0x04ff('0x24')](_0x54c778[_0x04ff('0x1e')][_0x04ff('0x23')],function(_0x2dca16){return{'model':db[_0x2dca16[_0x04ff('0x25')]],'as':_0x2dca16['as'],'attributes':_0x2dca16[_0x04ff('0x21')],'include':_0x2dca16['include']?_[_0x04ff('0x24')](_0x2dca16['include'],function(_0x417a91){return{'model':db[_0x417a91[_0x04ff('0x25')]],'as':_0x417a91['as'],'attributes':_0x417a91[_0x04ff('0x21')],'include':_0x417a91[_0x04ff('0x23')]?_['map'](_0x417a91[_0x04ff('0x23')],function(_0x2013d1){return{'model':db[_0x2013d1['model']],'as':_0x2013d1['as'],'attributes':_0x2013d1[_0x04ff('0x21')]};}):[]};}):[]};}):[]:[]})[_0x04ff('0x26')](function(_0x20e8df){logger['info'](_0x04ff('0x27'),_0x54c778);logger[_0x04ff('0x15')]('GetVoiceQueue',_0x54c778,JSON[_0x04ff('0x17')](_0x20e8df));_0x142874(_0x20e8df);})['catch'](function(_0x1fa17d){logger['error'](_0x04ff('0x27'),_0x1fa17d[_0x04ff('0x1a')],_0x54c778);_0x1a1d1a(_0x2daf59[_0x04ff('0x18')](0x1f4,_0x1fa17d['message']));});});};exports[_0x04ff('0x28')]=function(_0x1274ab){var _0x793544=this;return new Promise(function(_0x4feb59,_0x1ae9cd){return db[_0x04ff('0x1d')]['find']({'raw':_0x1274ab[_0x04ff('0x1e')]?_0x1274ab[_0x04ff('0x1e')][_0x04ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x1274ab[_0x04ff('0x1e')]?_0x1274ab[_0x04ff('0x1e')][_0x04ff('0x20')]||null:null,'attributes':_0x1274ab[_0x04ff('0x1e')]?_0x1274ab[_0x04ff('0x1e')][_0x04ff('0x21')]||null:null,'include':_0x1274ab[_0x04ff('0x1e')]?_0x1274ab[_0x04ff('0x1e')]['include']?_[_0x04ff('0x24')](_0x1274ab[_0x04ff('0x1e')][_0x04ff('0x23')],function(_0x3d9d6e){return{'model':db[_0x3d9d6e['model']],'as':_0x3d9d6e['as'],'attributes':_0x3d9d6e[_0x04ff('0x21')],'include':_0x3d9d6e[_0x04ff('0x23')]?_[_0x04ff('0x24')](_0x3d9d6e['include'],function(_0x3c4774){return{'model':db[_0x3c4774[_0x04ff('0x25')]],'as':_0x3c4774['as'],'attributes':_0x3c4774['attributes'],'include':_0x3c4774[_0x04ff('0x23')]?_['map'](_0x3c4774[_0x04ff('0x23')],function(_0x5b53e3){return{'model':db[_0x5b53e3[_0x04ff('0x25')]],'as':_0x5b53e3['as'],'attributes':_0x5b53e3['attributes']};}):[]};}):[]};}):[]:[]})[_0x04ff('0x26')](function(_0x60fb72){logger[_0x04ff('0x12')](_0x04ff('0x28'),_0x1274ab);logger[_0x04ff('0x15')](_0x04ff('0x28'),_0x1274ab,JSON[_0x04ff('0x17')](_0x60fb72));_0x4feb59(_0x60fb72);})[_0x04ff('0x1c')](function(_0x5a3f63){logger[_0x04ff('0x18')](_0x04ff('0x28'),_0x5a3f63['message'],_0x1274ab);_0x1ae9cd(_0x793544[_0x04ff('0x18')](0x1f4,_0x5a3f63[_0x04ff('0x1a')]));});});}; \ No newline at end of file +var _0x20ab=['rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','./voiceQueue.socket','register','request','then','VoiceQueue,\x20%s,\x20%s','request\x20sent','debug','VoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','map','include','model','ShowVoiceQueue','find','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5ff517,_0x3e4ee0){var _0x19a245=function(_0x4c00ac){while(--_0x4c00ac){_0x5ff517['push'](_0x5ff517['shift']());}};_0x19a245(++_0x3e4ee0);}(_0x20ab,0x142));var _0xb20a=function(_0x269fba,_0xa68777){_0x269fba=_0x269fba-0x0;var _0x1eeb74=_0x20ab[_0x269fba];return _0x1eeb74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xb20a('0x0'));var BPromise=require(_0xb20a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb20a('0x2'));var db=require(_0xb20a('0x3'))['db'];var utils=require(_0xb20a('0x4'));var logger=require(_0xb20a('0x5'))(_0xb20a('0x6'));var config=require(_0xb20a('0x7'));var jayson=require(_0xb20a('0x8'));var client=jayson[_0xb20a('0x9')]['http']({'port':0x232a});config[_0xb20a('0xa')]=_[_0xb20a('0xb')](config[_0xb20a('0xa')],{'host':_0xb20a('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb20a('0xa')]));require(_0xb20a('0xd'))[_0xb20a('0xe')](socket);function respondWithRpcPromise(_0x3c35fe,_0x3aa93f,_0xfa8277){return new BPromise(function(_0x57dc19,_0x45d170){return client[_0xb20a('0xf')](_0x3c35fe,_0xfa8277)[_0xb20a('0x10')](function(_0x4af158){logger['info'](_0xb20a('0x11'),_0x3aa93f,_0xb20a('0x12'));logger[_0xb20a('0x13')](_0xb20a('0x14'),_0x3aa93f,'request\x20sent',JSON[_0xb20a('0x15')](_0x4af158));if(_0x4af158[_0xb20a('0x16')]){if(_0x4af158[_0xb20a('0x16')][_0xb20a('0x17')]===0x1f4){logger[_0xb20a('0x16')]('VoiceQueue,\x20%s,\x20%s',_0x3aa93f,_0x4af158[_0xb20a('0x16')][_0xb20a('0x18')]);return _0x45d170(_0x4af158[_0xb20a('0x16')][_0xb20a('0x18')]);}logger['error']('VoiceQueue,\x20%s,\x20%s',_0x3aa93f,_0x4af158[_0xb20a('0x16')][_0xb20a('0x18')]);return _0x57dc19(_0x4af158[_0xb20a('0x16')][_0xb20a('0x18')]);}else{logger[_0xb20a('0x19')]('VoiceQueue,\x20%s,\x20%s',_0x3aa93f,_0xb20a('0x12'));_0x57dc19(_0x4af158[_0xb20a('0x1a')]['message']);}})[_0xb20a('0x1b')](function(_0x5b8af5){logger[_0xb20a('0x16')](_0xb20a('0x11'),_0x3aa93f,_0x5b8af5);_0x45d170(_0x5b8af5);});});}exports[_0xb20a('0x1c')]=function(_0x5833d1){var _0x520704=this;return new Promise(function(_0x498008,_0x2315ce){return db[_0xb20a('0x1d')][_0xb20a('0x1e')]({'raw':_0x5833d1[_0xb20a('0x1f')]?_0x5833d1['options'][_0xb20a('0x20')]===undefined?!![]:![]:!![],'where':_0x5833d1[_0xb20a('0x1f')]?_0x5833d1[_0xb20a('0x1f')][_0xb20a('0x21')]||null:null,'attributes':_0x5833d1[_0xb20a('0x1f')]?_0x5833d1['options'][_0xb20a('0x22')]||null:null,'limit':_0x5833d1[_0xb20a('0x1f')]?_0x5833d1[_0xb20a('0x1f')][_0xb20a('0x23')]||null:null,'include':_0x5833d1[_0xb20a('0x1f')]?_0x5833d1[_0xb20a('0x1f')]['include']?_[_0xb20a('0x24')](_0x5833d1['options'][_0xb20a('0x25')],function(_0x323ff7){return{'model':db[_0x323ff7[_0xb20a('0x26')]],'as':_0x323ff7['as'],'attributes':_0x323ff7[_0xb20a('0x22')],'include':_0x323ff7[_0xb20a('0x25')]?_[_0xb20a('0x24')](_0x323ff7[_0xb20a('0x25')],function(_0x51af1d){return{'model':db[_0x51af1d['model']],'as':_0x51af1d['as'],'attributes':_0x51af1d[_0xb20a('0x22')],'include':_0x51af1d[_0xb20a('0x25')]?_[_0xb20a('0x24')](_0x51af1d[_0xb20a('0x25')],function(_0x43bb83){return{'model':db[_0x43bb83['model']],'as':_0x43bb83['as'],'attributes':_0x43bb83[_0xb20a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb20a('0x10')](function(_0x5e4ca7){logger[_0xb20a('0x19')](_0xb20a('0x1c'),_0x5833d1);logger['debug'](_0xb20a('0x1c'),_0x5833d1,JSON[_0xb20a('0x15')](_0x5e4ca7));_0x498008(_0x5e4ca7);})[_0xb20a('0x1b')](function(_0x40dee3){logger[_0xb20a('0x16')](_0xb20a('0x1c'),_0x40dee3['message'],_0x5833d1);_0x2315ce(_0x520704[_0xb20a('0x16')](0x1f4,_0x40dee3[_0xb20a('0x18')]));});});};exports[_0xb20a('0x27')]=function(_0x5b1ad3){var _0x19ab40=this;return new Promise(function(_0x2dadf9,_0x1e0ca9){return db[_0xb20a('0x1d')][_0xb20a('0x28')]({'raw':_0x5b1ad3[_0xb20a('0x1f')]?_0x5b1ad3[_0xb20a('0x1f')][_0xb20a('0x20')]===undefined?!![]:![]:!![],'where':_0x5b1ad3[_0xb20a('0x1f')]?_0x5b1ad3[_0xb20a('0x1f')]['where']||null:null,'attributes':_0x5b1ad3[_0xb20a('0x1f')]?_0x5b1ad3[_0xb20a('0x1f')][_0xb20a('0x22')]||null:null,'include':_0x5b1ad3[_0xb20a('0x1f')]?_0x5b1ad3['options'][_0xb20a('0x25')]?_[_0xb20a('0x24')](_0x5b1ad3[_0xb20a('0x1f')]['include'],function(_0x382ccb){return{'model':db[_0x382ccb['model']],'as':_0x382ccb['as'],'attributes':_0x382ccb[_0xb20a('0x22')],'include':_0x382ccb[_0xb20a('0x25')]?_[_0xb20a('0x24')](_0x382ccb['include'],function(_0xf01ad3){return{'model':db[_0xf01ad3[_0xb20a('0x26')]],'as':_0xf01ad3['as'],'attributes':_0xf01ad3[_0xb20a('0x22')],'include':_0xf01ad3[_0xb20a('0x25')]?_['map'](_0xf01ad3['include'],function(_0x366c4b){return{'model':db[_0x366c4b[_0xb20a('0x26')]],'as':_0x366c4b['as'],'attributes':_0x366c4b[_0xb20a('0x22')]};}):[]};}):[]};}):[]:[]})[_0xb20a('0x10')](function(_0x43a03f){logger[_0xb20a('0x19')]('ShowVoiceQueue',_0x5b1ad3);logger[_0xb20a('0x13')](_0xb20a('0x27'),_0x5b1ad3,JSON[_0xb20a('0x15')](_0x43a03f));_0x2dadf9(_0x43a03f);})[_0xb20a('0x1b')](function(_0x3d52fc){logger['error'](_0xb20a('0x27'),_0x3d52fc[_0xb20a('0x18')],_0x5b1ad3);_0x1e0ca9(_0x19ab40[_0xb20a('0x16')](0x1f4,_0x3d52fc[_0xb20a('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 0cb8492..660a0c3 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 _0x210b=['save','remove','removeListener','length','voiceQueue:'];(function(_0x5750df,_0x5441ff){var _0x1288b6=function(_0x5b9c3a){while(--_0x5b9c3a){_0x5750df['push'](_0x5750df['shift']());}};_0x1288b6(++_0x5441ff);}(_0x210b,0xfa));var _0xb210=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x210b[_0x47a7d0];return _0xb9bd08;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0xb210('0x0'),_0xb210('0x1'),'update'];function createListener(_0x1408e1,_0x37bfe8){return function(_0x2a98b3){_0x37bfe8['emit'](_0x1408e1,_0x2a98b3);};}function removeListener(_0x3673e6,_0x593960){return function(){VoiceQueueEvents[_0xb210('0x2')](_0x3673e6,_0x593960);};}exports['register']=function(_0x557590){for(var _0x3177de=0x0,_0x5da442=events[_0xb210('0x3')];_0x3177de<_0x5da442;_0x3177de++){var _0x311d1e=events[_0x3177de];var _0xcf817a=createListener(_0xb210('0x4')+_0x311d1e,_0x557590);VoiceQueueEvents['on'](_0x311d1e,_0xcf817a);}}; \ No newline at end of file +var _0xa8e2=['update','emit','removeListener','register','length','save','remove'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa8e2,0xa6));var _0x2a8e=function(_0x32e44f,_0x20542c){_0x32e44f=_0x32e44f-0x0;var _0x5d3ae8=_0xa8e2[_0x32e44f];return _0x5d3ae8;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x2a8e('0x0'),_0x2a8e('0x1'),_0x2a8e('0x2')];function createListener(_0x15738,_0x582474){return function(_0x59a4d7){_0x582474[_0x2a8e('0x3')](_0x15738,_0x59a4d7);};}function removeListener(_0x3c742a,_0x4ba93d){return function(){VoiceQueueEvents[_0x2a8e('0x4')](_0x3c742a,_0x4ba93d);};}exports[_0x2a8e('0x5')]=function(_0x13e7ea){for(var _0xbe3722=0x0,_0x2dc3cf=events[_0x2a8e('0x6')];_0xbe3722<_0x2dc3cf;_0xbe3722++){var _0x1c5bd6=events[_0xbe3722];var _0x53abad=createListener('voiceQueue:'+_0x1c5bd6,_0x13e7ea);VoiceQueueEvents['on'](_0x1c5bd6,_0x53abad);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 642454a..74177b5 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 _0x3a6d=['/index','getVoiceQueuesReport','/:id','show','create','put','destroy','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x388879,_0xe0b81b){var _0x42ce08=function(_0x29f2aa){while(--_0x29f2aa){_0x388879['push'](_0x388879['shift']());}};_0x42ce08(++_0xe0b81b);}(_0x3a6d,0x143));var _0xd3a6=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x3a6d[_0x1694f5];return _0x5b4321;};'use strict';var multer=require(_0xd3a6('0x0'));var util=require(_0xd3a6('0x1'));var path=require('path');var timeout=require(_0xd3a6('0x2'));var express=require(_0xd3a6('0x3'));var router=express[_0xd3a6('0x4')]();var auth=require(_0xd3a6('0x5'));var interaction=require(_0xd3a6('0x6'));var config=require('../../config/environment');var controller=require(_0xd3a6('0x7'));router[_0xd3a6('0x8')]('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xa')]);router[_0xd3a6('0x8')](_0xd3a6('0xb'),auth['isAuthenticated'](),controller[_0xd3a6('0xc')]);router[_0xd3a6('0x8')](_0xd3a6('0xd'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0xe')]);router[_0xd3a6('0x8')](_0xd3a6('0xf'),auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x10')]);router['post']('/',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x11')]);router[_0xd3a6('0x12')](_0xd3a6('0xf'),auth[_0xd3a6('0x9')](),controller['update']);router['delete']('/:id',auth[_0xd3a6('0x9')](),controller[_0xd3a6('0x13')]);module[_0xd3a6('0x14')]=router; \ No newline at end of file +var _0x8af6=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','get','/describe','describe','/index','/:id','post','create','put','exports','multer','util'];(function(_0x586937,_0x2e0632){var _0x2cfdc3=function(_0x344c2b){while(--_0x344c2b){_0x586937['push'](_0x586937['shift']());}};_0x2cfdc3(++_0x2e0632);}(_0x8af6,0x76));var _0x68af=function(_0x4edc56,_0x5f54de){_0x4edc56=_0x4edc56-0x0;var _0x3d0aca=_0x8af6[_0x4edc56];return _0x3d0aca;};'use strict';var multer=require(_0x68af('0x0'));var util=require(_0x68af('0x1'));var path=require(_0x68af('0x2'));var timeout=require(_0x68af('0x3'));var express=require(_0x68af('0x4'));var router=express[_0x68af('0x5')]();var auth=require(_0x68af('0x6'));var interaction=require(_0x68af('0x7'));var config=require(_0x68af('0x8'));var controller=require(_0x68af('0x9'));router['get']('/',auth[_0x68af('0xa')](),controller['index']);router[_0x68af('0xb')](_0x68af('0xc'),auth[_0x68af('0xa')](),controller[_0x68af('0xd')]);router[_0x68af('0xb')](_0x68af('0xe'),auth[_0x68af('0xa')](),controller['getVoiceQueuesReport']);router['get'](_0x68af('0xf'),auth[_0x68af('0xa')](),controller['show']);router[_0x68af('0x10')]('/',auth[_0x68af('0xa')](),controller[_0x68af('0x11')]);router[_0x68af('0x12')](_0x68af('0xf'),auth[_0x68af('0xa')](),controller['update']);router['delete'](_0x68af('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x68af('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index d07682a..abe52af 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 _0x3a40=['COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN'];(function(_0x118c30,_0x7eb1eb){var _0x569999=function(_0x550ba2){while(--_0x550ba2){_0x118c30['push'](_0x118c30['shift']());}};_0x569999(++_0x7eb1eb);}(_0x3a40,0x1ab));var _0x03a4=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x3a40[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x03a4('0x0'));var moment=require(_0x03a4('0x1'));module[_0x03a4('0x2')]={'type':{'type':Sequelize[_0x03a4('0x3')]},'uniqueid':{'type':Sequelize[_0x03a4('0x3')]},'calleridnum':{'type':Sequelize[_0x03a4('0x3')]},'calleridname':{'type':Sequelize[_0x03a4('0x3')]},'queue':{'type':Sequelize[_0x03a4('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0x03a4('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x03a4('0x4')],'set':function(_0x3d4fcd){var _0x72a44=moment(_0x3d4fcd);var _0xa10c61=moment(this[_0x03a4('0x5')](_0x03a4('0x6')))[_0x03a4('0x7')](_0x03a4('0x8'));var _0x258213=_0x72a44[_0x03a4('0x9')](_0xa10c61,'seconds');this[_0x03a4('0xa')](_0x03a4('0xb'),_0x3d4fcd);this[_0x03a4('0xa')](_0x03a4('0xc'),_0x258213||null);}},'position':{'type':Sequelize[_0x03a4('0xd')]},'count':{'type':Sequelize[_0x03a4('0xd')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize['DATE']},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x03a4('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x03a4('0x4')]},'queuecallerexitreason':{'type':Sequelize[_0x03a4('0x3')],'comment':_0x03a4('0xf')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x03a4('0x3')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x03a4('0x3')]},'exten':{'type':Sequelize[_0x03a4('0x3')]},'priority':{'type':Sequelize[_0x03a4('0x3')]},'holdtime':{'type':Sequelize[_0x03a4('0xd')]},'mohtime':{'type':Sequelize[_0x03a4('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x03a4('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x03a4('0x3')]},'transfer':{'type':Sequelize[_0x03a4('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x03a4('0x3')],'comment':_0x03a4('0x10')},'transferexten':{'type':Sequelize[_0x03a4('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x03a4('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x03a4('0xd')],'defaultValue':0x0}}; \ No newline at end of file +var _0xfaeb=['sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','queuecallerleaveAt','setDataValue','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x40ddc0,_0x41c082){var _0x1aebf1=function(_0x3ba1f6){while(--_0x3ba1f6){_0x40ddc0['push'](_0x40ddc0['shift']());}};_0x1aebf1(++_0x41c082);}(_0xfaeb,0x1a4));var _0xbfae=function(_0x11ce46,_0x177a85){_0x11ce46=_0x11ce46-0x0;var _0x368a1e=_0xfaeb[_0x11ce46];return _0x368a1e;};'use strict';var Sequelize=require(_0xbfae('0x0'));var moment=require(_0xbfae('0x1'));module[_0xbfae('0x2')]={'type':{'type':Sequelize[_0xbfae('0x3')]},'uniqueid':{'type':Sequelize[_0xbfae('0x3')]},'calleridnum':{'type':Sequelize[_0xbfae('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xbfae('0x3')]},'queuecallerjoinAt':{'type':Sequelize[_0xbfae('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0xbfae('0x4')],'set':function(_0x31206c){var _0x26143c=moment(_0x31206c);var _0x2d2c62=moment(this[_0xbfae('0x5')](_0xbfae('0x6')))[_0xbfae('0x7')](_0xbfae('0x8'));var _0x75465d=_0x26143c['diff'](_0x2d2c62,'seconds');this['setDataValue'](_0xbfae('0x9'),_0x31206c);this[_0xbfae('0xa')]('holdtime',_0x75465d||null);}},'position':{'type':Sequelize[_0xbfae('0xb')]},'count':{'type':Sequelize[_0xbfae('0xb')]},'queuecallerabandon':{'type':Sequelize[_0xbfae('0xc')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xbfae('0x4')]},'queuecallercomplete':{'type':Sequelize[_0xbfae('0xc')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xbfae('0x4')]},'queuecallerexit':{'type':Sequelize[_0xbfae('0xc')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0xbfae('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0xbfae('0xd')},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xbfae('0x3')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xbfae('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xbfae('0x3')]},'exten':{'type':Sequelize[_0xbfae('0x3')]},'priority':{'type':Sequelize['STRING']},'holdtime':{'type':Sequelize['INTEGER']},'mohtime':{'type':Sequelize[_0xbfae('0xb')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xbfae('0xc')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0xbfae('0x3')]},'transfer':{'type':Sequelize[_0xbfae('0xc')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xbfae('0xe')},'transferexten':{'type':Sequelize[_0xbfae('0x3')]},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0xbfae('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0xbfae('0xb')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 0775bce..551ba9c 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 _0x66fa=['Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceQueueReport','rawAttributes','fieldName','type','model','map','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','merge','where','includeAll','include','findAll','rows','show','params','intersection','options','find','catch','create','body','getVoiceQueuesReport','pick','filter','html-pdf','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','defaults','redis','localhost','./voiceQueueReport.socket','sendStatus','status','end','json','count','offset','limit','set'];(function(_0x243b2f,_0x30aa15){var _0xcb3c2d=function(_0x213bb2){while(--_0x213bb2){_0x243b2f['push'](_0x243b2f['shift']());}};_0xcb3c2d(++_0x30aa15);}(_0x66fa,0x117));var _0xa66f=function(_0x1715a3,_0x5e3bd2){_0x1715a3=_0x1715a3-0x0;var _0xd88f25=_0x66fa[_0x1715a3];return _0xd88f25;};'use strict';var pdf=require(_0xa66f('0x0'));var emlformat=require(_0xa66f('0x1'));var rimraf=require('rimraf');var zipdir=require(_0xa66f('0x2'));var jsonpatch=require(_0xa66f('0x3'));var rp=require(_0xa66f('0x4'));var moment=require(_0xa66f('0x5'));var BPromise=require(_0xa66f('0x6'));var Mustache=require(_0xa66f('0x7'));var util=require(_0xa66f('0x8'));var path=require('path');var sox=require('sox');var csv=require(_0xa66f('0x9'));var ejs=require(_0xa66f('0xa'));var fs=require('fs');var _=require(_0xa66f('0xb'));var squel=require(_0xa66f('0xc'));var crypto=require(_0xa66f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xa66f('0xe'));var toCsv=require('to-csv');var querystring=require(_0xa66f('0xf'));var Papa=require('papaparse');var Redis=require(_0xa66f('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa66f('0x11'));var logger=require(_0xa66f('0x12'))('api');var utils=require(_0xa66f('0x13'));var config=require('../../config/environment');var db=require(_0xa66f('0x14'))['db'];config['redis']=_[_0xa66f('0x15')](config[_0xa66f('0x16')],{'host':_0xa66f('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa66f('0x18'))['register'](socket);function respondWithStatusCode(_0x528427,_0x5a7b16){_0x5a7b16=_0x5a7b16||0xcc;return function(_0x3ac0ac){if(_0x3ac0ac){return _0x528427[_0xa66f('0x19')](_0x5a7b16);}return _0x528427[_0xa66f('0x1a')](_0x5a7b16)[_0xa66f('0x1b')]();};}function respondWithResult(_0xd348f9,_0x567d4f){_0x567d4f=_0x567d4f||0xc8;return function(_0x5510dc){if(_0x5510dc){return _0xd348f9[_0xa66f('0x1a')](_0x567d4f)[_0xa66f('0x1c')](_0x5510dc);}};}function respondWithFilteredResult(_0x295acf,_0x403f4d){return function(_0x5c67f5){if(_0x5c67f5){var _0x1cbe64=_0x5c67f5[_0xa66f('0x1d')],_0x55b59d=_0x403f4d[_0xa66f('0x1e')],_0x4a28d4=_0x403f4d[_0xa66f('0x1e')]+_0x403f4d[_0xa66f('0x1f')],_0x2f9da2;if(_0x4a28d4>=_0x1cbe64){_0x4a28d4=_0x1cbe64;_0x2f9da2=0xc8;}else{_0x2f9da2=0xce;}_0x295acf[_0xa66f('0x1a')](_0x2f9da2);return _0x295acf[_0xa66f('0x20')](_0xa66f('0x21'),_0x55b59d+'-'+_0x4a28d4+'/'+_0x1cbe64)[_0xa66f('0x1c')](_0x5c67f5);}return null;};}function patchUpdates(_0x2d9602){return function(_0x235b61){try{jsonpatch[_0xa66f('0x22')](_0x235b61,_0x2d9602,!![]);}catch(_0x3c4eb1){return BPromise[_0xa66f('0x23')](_0x3c4eb1);}return _0x235b61[_0xa66f('0x24')]();};}function saveUpdates(_0x5cd613,_0x27f570){return function(_0xc5c82e){if(_0xc5c82e){return _0xc5c82e[_0xa66f('0x25')](_0x5cd613)[_0xa66f('0x26')](function(_0x5cbd82){return _0x5cbd82;});}return null;};}function removeEntity(_0x337602,_0x473822){return function(_0x209f4d){if(_0x209f4d){return _0x209f4d[_0xa66f('0x27')]()['then'](function(){_0x337602['status'](0xcc)[_0xa66f('0x1b')]();});}};}function handleEntityNotFound(_0x598942,_0x3a3e4f){return function(_0xc661f2){if(!_0xc661f2){_0x598942[_0xa66f('0x19')](0x194);}return _0xc661f2;};}function handleError(_0x57da7f,_0x4683c7){_0x4683c7=_0x4683c7||0x1f4;return function(_0x1c2903){logger[_0xa66f('0x28')](_0x1c2903[_0xa66f('0x29')]);if(_0x1c2903[_0xa66f('0x2a')]){delete _0x1c2903[_0xa66f('0x2a')];}_0x57da7f[_0xa66f('0x1a')](_0x4683c7)[_0xa66f('0x2b')](_0x1c2903);};}exports[_0xa66f('0x2c')]=function(_0x117d03,_0x45f71c){var _0x63650b={},_0x42b966={},_0xeeb22e={'count':0x0,'rows':[]};var _0x49f615=_['map'](db[_0xa66f('0x2d')][_0xa66f('0x2e')],function(_0x55f309){return{'name':_0x55f309[_0xa66f('0x2f')],'type':_0x55f309[_0xa66f('0x30')]['key']};});_0x42b966[_0xa66f('0x31')]=_[_0xa66f('0x32')](_0x49f615,_0xa66f('0x2a'));_0x42b966[_0xa66f('0x33')]=_[_0xa66f('0x34')](_0x117d03['query']);_0x42b966[_0xa66f('0x35')]=_['intersection'](_0x42b966[_0xa66f('0x31')],_0x42b966[_0xa66f('0x33')]);_0x63650b[_0xa66f('0x36')]=_['intersection'](_0x42b966[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x117d03['query'][_0xa66f('0x37')]));_0x63650b[_0xa66f('0x36')]=_0x63650b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x63650b[_0xa66f('0x36')]:_0x42b966[_0xa66f('0x31')];if(!_0x117d03[_0xa66f('0x33')][_0xa66f('0x39')](_0xa66f('0x3a'))){_0x63650b[_0xa66f('0x1f')]=qs['limit'](_0x117d03[_0xa66f('0x33')]['limit']);_0x63650b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x63650b[_0xa66f('0x3b')]=qs[_0xa66f('0x3c')](_0x117d03[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x63650b['where']=qs[_0xa66f('0x35')](_['pick'](_0x117d03[_0xa66f('0x33')],_0x42b966[_0xa66f('0x35')]));if(_0x117d03[_0xa66f('0x33')]['filter']){_0x63650b['where']=_[_0xa66f('0x3d')](_0x63650b[_0xa66f('0x3e')],{'$or':_[_0xa66f('0x32')](_0x49f615,function(_0x1f5a5f){if(_0x1f5a5f[_0xa66f('0x30')]!=='VIRTUAL'){var _0x5cb0a9={};_0x5cb0a9[_0x1f5a5f['name']]={'$like':'%'+_0x117d03[_0xa66f('0x33')]['filter']+'%'};return _0x5cb0a9;}})});}_0x63650b=_['merge']({},_0x63650b,_0x117d03['options']);var _0x5fdc3e={'where':_0x63650b['where']};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x5fdc3e)[_0xa66f('0x26')](function(_0x1647a0){_0xeeb22e[_0xa66f('0x1d')]=_0x1647a0;if(_0x117d03[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x63650b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x63650b);})[_0xa66f('0x26')](function(_0x93f6ff){_0xeeb22e[_0xa66f('0x42')]=_0x93f6ff;return _0xeeb22e;})[_0xa66f('0x26')](respondWithFilteredResult(_0x45f71c,_0x63650b))['catch'](handleError(_0x45f71c,null));};exports[_0xa66f('0x43')]=function(_0x25c2cb,_0x58c1f2){var _0x248587={'raw':![],'where':{'id':_0x25c2cb[_0xa66f('0x44')]['id']}},_0x4b6e6b={};_0x4b6e6b[_0xa66f('0x31')]=_['keys'](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0x4b6e6b[_0xa66f('0x33')]=_['keys'](_0x25c2cb[_0xa66f('0x33')]);_0x4b6e6b['filters']=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],_0x4b6e6b[_0xa66f('0x33')]);_0x248587[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0x4b6e6b[_0xa66f('0x31')],qs[_0xa66f('0x37')](_0x25c2cb['query'][_0xa66f('0x37')]));_0x248587[_0xa66f('0x36')]=_0x248587[_0xa66f('0x36')][_0xa66f('0x38')]?_0x248587[_0xa66f('0x36')]:_0x4b6e6b['model'];if(_0x25c2cb['query'][_0xa66f('0x3f')]){_0x248587[_0xa66f('0x40')]=[{'all':!![]}];}_0x248587=_[_0xa66f('0x3d')]({},_0x248587,_0x25c2cb[_0xa66f('0x46')]);return db[_0xa66f('0x2d')][_0xa66f('0x47')](_0x248587)['then'](handleEntityNotFound(_0x58c1f2,null))[_0xa66f('0x26')](respondWithResult(_0x58c1f2,null))[_0xa66f('0x48')](handleError(_0x58c1f2,null));};exports[_0xa66f('0x49')]=function(_0x5651e9,_0x57c8a0){return db[_0xa66f('0x2d')][_0xa66f('0x49')](_0x5651e9[_0xa66f('0x4a')],{})['then'](respondWithResult(_0x57c8a0,0xc9))['catch'](handleError(_0x57c8a0,null));};exports['update']=function(_0x19e7ce,_0x35e477){if(_0x19e7ce[_0xa66f('0x4a')]['id']){delete _0x19e7ce[_0xa66f('0x4a')]['id'];}return db[_0xa66f('0x2d')][_0xa66f('0x47')]({'where':{'id':_0x19e7ce[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x35e477,null))['then'](saveUpdates(_0x19e7ce[_0xa66f('0x4a')],null))[_0xa66f('0x26')](respondWithResult(_0x35e477,null))[_0xa66f('0x48')](handleError(_0x35e477,null));};exports[_0xa66f('0x27')]=function(_0x11597b,_0x33cdc7){return db['VoiceQueueReport'][_0xa66f('0x47')]({'where':{'id':_0x11597b[_0xa66f('0x44')]['id']}})[_0xa66f('0x26')](handleEntityNotFound(_0x33cdc7,null))[_0xa66f('0x26')](removeEntity(_0x33cdc7,null))[_0xa66f('0x48')](handleError(_0x33cdc7,null));};exports['describe']=function(_0x389b9a,_0x50e0cd){return db[_0xa66f('0x2d')]['describe']()['then'](respondWithResult(_0x50e0cd,null))[_0xa66f('0x48')](handleError(_0x50e0cd,null));};exports[_0xa66f('0x4b')]=function(_0x12271d,_0x2c79df){var _0x35ed5b={},_0xe97cf4={},_0x53a62f={'count':0x0,'rows':[]};_0xe97cf4[_0xa66f('0x31')]=_[_0xa66f('0x34')](db[_0xa66f('0x2d')][_0xa66f('0x2e')]);_0xe97cf4['query']=_[_0xa66f('0x34')](_0x12271d['query']);_0xe97cf4[_0xa66f('0x35')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],_0xe97cf4[_0xa66f('0x33')]);_0x35ed5b[_0xa66f('0x36')]=_[_0xa66f('0x45')](_0xe97cf4[_0xa66f('0x31')],qs['fields'](_0x12271d[_0xa66f('0x33')][_0xa66f('0x37')]));_0x35ed5b[_0xa66f('0x36')]=_0x35ed5b[_0xa66f('0x36')][_0xa66f('0x38')]?_0x35ed5b[_0xa66f('0x36')]:_0xe97cf4[_0xa66f('0x31')];if(!_0x12271d[_0xa66f('0x33')][_0xa66f('0x39')]('nolimit')){_0x35ed5b['limit']=qs[_0xa66f('0x1f')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1f')]);_0x35ed5b[_0xa66f('0x1e')]=qs[_0xa66f('0x1e')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x1e')]);}_0x35ed5b['order']=qs[_0xa66f('0x3c')](_0x12271d[_0xa66f('0x33')][_0xa66f('0x3c')]);_0x35ed5b[_0xa66f('0x3e')]=qs['filters'](_[_0xa66f('0x4c')](_0x12271d[_0xa66f('0x33')],_0xe97cf4[_0xa66f('0x35')]));if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]){_0x35ed5b[_0xa66f('0x3e')]=_['merge'](_0x35ed5b['where'],{'$or':_[_0xa66f('0x32')](_0x35ed5b[_0xa66f('0x36')],function(_0x174aad){var _0x52edb3={};_0x52edb3[_0x174aad]={'$like':'%'+_0x12271d[_0xa66f('0x33')][_0xa66f('0x4d')]+'%'};return _0x52edb3;})});}_0x35ed5b=_[_0xa66f('0x3d')]({},_0x35ed5b,_0x12271d[_0xa66f('0x46')]);var _0x17b2cf={'where':_0x35ed5b[_0xa66f('0x3e')]};return db[_0xa66f('0x2d')][_0xa66f('0x1d')](_0x17b2cf)[_0xa66f('0x26')](function(_0x5d4299){_0x53a62f[_0xa66f('0x1d')]=_0x5d4299;if(_0x12271d[_0xa66f('0x33')][_0xa66f('0x3f')]){_0x35ed5b[_0xa66f('0x40')]=[{'all':!![]}];}return db[_0xa66f('0x2d')][_0xa66f('0x41')](_0x35ed5b);})[_0xa66f('0x26')](function(_0x3b38ad){_0x53a62f['rows']=_0x3b38ad;return _0x53a62f;})['then'](respondWithFilteredResult(_0x2c79df,_0x35ed5b,_0xa66f('0x4b')))[_0xa66f('0x48')](handleError(_0x2c79df,null,_0xa66f('0x4b')));}; \ No newline at end of file +var _0xdb28=['merge','VIRTUAL','filter','options','VoiceQueueReport','count','include','catch','show','rawAttributes','includeAll','find','create','body','params','destroy','describe','getVoiceQueuesReport','rows','html-pdf','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','./voiceQueueReport.socket','register','sendStatus','status','end','offset','limit','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','map','fieldName','type','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters'];(function(_0x33a232,_0xabbf43){var _0x5530f6=function(_0x208d2d){while(--_0x208d2d){_0x33a232['push'](_0x33a232['shift']());}};_0x5530f6(++_0xabbf43);}(_0xdb28,0x106));var _0x8db2=function(_0x1a9e0e,_0x276691){_0x1a9e0e=_0x1a9e0e-0x0;var _0x2617fb=_0xdb28[_0x1a9e0e];return _0x2617fb;};'use strict';var pdf=require(_0x8db2('0x0'));var emlformat=require(_0x8db2('0x1'));var rimraf=require(_0x8db2('0x2'));var zipdir=require(_0x8db2('0x3'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8db2('0x4'));var moment=require(_0x8db2('0x5'));var BPromise=require(_0x8db2('0x6'));var Mustache=require(_0x8db2('0x7'));var util=require(_0x8db2('0x8'));var path=require('path');var sox=require(_0x8db2('0x9'));var csv=require(_0x8db2('0xa'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0xa'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var db=require(_0x8db2('0x17'))['db'];config[_0x8db2('0x18')]=_[_0x8db2('0x19')](config[_0x8db2('0x18')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8db2('0x18')]));require(_0x8db2('0x1a'))[_0x8db2('0x1b')](socket);function respondWithStatusCode(_0x1d6a15,_0x227355){_0x227355=_0x227355||0xcc;return function(_0xfa285b){if(_0xfa285b){return _0x1d6a15[_0x8db2('0x1c')](_0x227355);}return _0x1d6a15[_0x8db2('0x1d')](_0x227355)[_0x8db2('0x1e')]();};}function respondWithResult(_0x16c8c2,_0x5489a9){_0x5489a9=_0x5489a9||0xc8;return function(_0x13b0f5){if(_0x13b0f5){return _0x16c8c2[_0x8db2('0x1d')](_0x5489a9)['json'](_0x13b0f5);}};}function respondWithFilteredResult(_0x2b3f73,_0x44957d){return function(_0x21db8c){if(_0x21db8c){var _0x3fddc2=_0x21db8c['count'],_0x2efd06=_0x44957d[_0x8db2('0x1f')],_0x46ce14=_0x44957d[_0x8db2('0x1f')]+_0x44957d[_0x8db2('0x20')],_0x51d60d;if(_0x46ce14>=_0x3fddc2){_0x46ce14=_0x3fddc2;_0x51d60d=0xc8;}else{_0x51d60d=0xce;}_0x2b3f73[_0x8db2('0x1d')](_0x51d60d);return _0x2b3f73['set'](_0x8db2('0x21'),_0x2efd06+'-'+_0x46ce14+'/'+_0x3fddc2)[_0x8db2('0x22')](_0x21db8c);}return null;};}function patchUpdates(_0x260940){return function(_0x297ba3){try{jsonpatch[_0x8db2('0x23')](_0x297ba3,_0x260940,!![]);}catch(_0x597260){return BPromise[_0x8db2('0x24')](_0x597260);}return _0x297ba3[_0x8db2('0x25')]();};}function saveUpdates(_0x18f69c,_0x125be2){return function(_0x2260d8){if(_0x2260d8){return _0x2260d8[_0x8db2('0x26')](_0x18f69c)[_0x8db2('0x27')](function(_0x5c6614){return _0x5c6614;});}return null;};}function removeEntity(_0x256202,_0x4f6516){return function(_0x5725f0){if(_0x5725f0){return _0x5725f0['destroy']()['then'](function(){_0x256202[_0x8db2('0x1d')](0xcc)[_0x8db2('0x1e')]();});}};}function handleEntityNotFound(_0x3be281,_0x2baed0){return function(_0x145328){if(!_0x145328){_0x3be281[_0x8db2('0x1c')](0x194);}return _0x145328;};}function handleError(_0x58cd9d,_0x3544ba){_0x3544ba=_0x3544ba||0x1f4;return function(_0x372311){logger[_0x8db2('0x28')](_0x372311[_0x8db2('0x29')]);if(_0x372311['name']){delete _0x372311[_0x8db2('0x2a')];}_0x58cd9d[_0x8db2('0x1d')](_0x3544ba)[_0x8db2('0x2b')](_0x372311);};}exports[_0x8db2('0x2c')]=function(_0xbe5ece,_0x21bae5){var _0xa54ea3={},_0x3124d5={},_0xbc5366={'count':0x0,'rows':[]};var _0x493cab=_[_0x8db2('0x2d')](db['VoiceQueueReport']['rawAttributes'],function(_0x302188){return{'name':_0x302188[_0x8db2('0x2e')],'type':_0x302188[_0x8db2('0x2f')]['key']};});_0x3124d5[_0x8db2('0x30')]=_['map'](_0x493cab,_0x8db2('0x2a'));_0x3124d5[_0x8db2('0x31')]=_[_0x8db2('0x32')](_0xbe5ece['query']);_0x3124d5['filters']=_[_0x8db2('0x33')](_0x3124d5[_0x8db2('0x30')],_0x3124d5['query']);_0xa54ea3['attributes']=_[_0x8db2('0x33')](_0x3124d5[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0xbe5ece[_0x8db2('0x31')][_0x8db2('0x34')]));_0xa54ea3[_0x8db2('0x35')]=_0xa54ea3[_0x8db2('0x35')][_0x8db2('0x36')]?_0xa54ea3[_0x8db2('0x35')]:_0x3124d5[_0x8db2('0x30')];if(!_0xbe5ece['query'][_0x8db2('0x37')](_0x8db2('0x38'))){_0xa54ea3['limit']=qs[_0x8db2('0x20')](_0xbe5ece[_0x8db2('0x31')]['limit']);_0xa54ea3['offset']=qs[_0x8db2('0x1f')](_0xbe5ece['query'][_0x8db2('0x1f')]);}_0xa54ea3[_0x8db2('0x39')]=qs[_0x8db2('0x3a')](_0xbe5ece[_0x8db2('0x31')]['sort']);_0xa54ea3[_0x8db2('0x3b')]=qs['filters'](_[_0x8db2('0x3c')](_0xbe5ece[_0x8db2('0x31')],_0x3124d5[_0x8db2('0x3d')]));if(_0xbe5ece[_0x8db2('0x31')]['filter']){_0xa54ea3['where']=_[_0x8db2('0x3e')](_0xa54ea3[_0x8db2('0x3b')],{'$or':_['map'](_0x493cab,function(_0x2bac57){if(_0x2bac57[_0x8db2('0x2f')]!==_0x8db2('0x3f')){var _0x4cb253={};_0x4cb253[_0x2bac57[_0x8db2('0x2a')]]={'$like':'%'+_0xbe5ece[_0x8db2('0x31')][_0x8db2('0x40')]+'%'};return _0x4cb253;}})});}_0xa54ea3=_[_0x8db2('0x3e')]({},_0xa54ea3,_0xbe5ece[_0x8db2('0x41')]);var _0x40d82a={'where':_0xa54ea3[_0x8db2('0x3b')]};return db[_0x8db2('0x42')][_0x8db2('0x43')](_0x40d82a)[_0x8db2('0x27')](function(_0x21cf7c){_0xbc5366[_0x8db2('0x43')]=_0x21cf7c;if(_0xbe5ece[_0x8db2('0x31')]['includeAll']){_0xa54ea3[_0x8db2('0x44')]=[{'all':!![]}];}return db[_0x8db2('0x42')]['findAll'](_0xa54ea3);})['then'](function(_0x249c73){_0xbc5366['rows']=_0x249c73;return _0xbc5366;})[_0x8db2('0x27')](respondWithFilteredResult(_0x21bae5,_0xa54ea3))[_0x8db2('0x45')](handleError(_0x21bae5,null));};exports[_0x8db2('0x46')]=function(_0x307783,_0xb4fe2c){var _0x30d606={'raw':![],'where':{'id':_0x307783['params']['id']}},_0xa53fba={};_0xa53fba[_0x8db2('0x30')]=_[_0x8db2('0x32')](db[_0x8db2('0x42')][_0x8db2('0x47')]);_0xa53fba['query']=_[_0x8db2('0x32')](_0x307783[_0x8db2('0x31')]);_0xa53fba[_0x8db2('0x3d')]=_[_0x8db2('0x33')](_0xa53fba['model'],_0xa53fba[_0x8db2('0x31')]);_0x30d606['attributes']=_[_0x8db2('0x33')](_0xa53fba[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0x307783['query']['fields']));_0x30d606[_0x8db2('0x35')]=_0x30d606['attributes'][_0x8db2('0x36')]?_0x30d606[_0x8db2('0x35')]:_0xa53fba[_0x8db2('0x30')];if(_0x307783[_0x8db2('0x31')][_0x8db2('0x48')]){_0x30d606[_0x8db2('0x44')]=[{'all':!![]}];}_0x30d606=_[_0x8db2('0x3e')]({},_0x30d606,_0x307783[_0x8db2('0x41')]);return db[_0x8db2('0x42')][_0x8db2('0x49')](_0x30d606)[_0x8db2('0x27')](handleEntityNotFound(_0xb4fe2c,null))[_0x8db2('0x27')](respondWithResult(_0xb4fe2c,null))['catch'](handleError(_0xb4fe2c,null));};exports[_0x8db2('0x4a')]=function(_0x2ada52,_0xdbba64){return db[_0x8db2('0x42')]['create'](_0x2ada52['body'],{})[_0x8db2('0x27')](respondWithResult(_0xdbba64,0xc9))[_0x8db2('0x45')](handleError(_0xdbba64,null));};exports[_0x8db2('0x26')]=function(_0x4c66e5,_0x540d90){if(_0x4c66e5['body']['id']){delete _0x4c66e5[_0x8db2('0x4b')]['id'];}return db[_0x8db2('0x42')][_0x8db2('0x49')]({'where':{'id':_0x4c66e5[_0x8db2('0x4c')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x540d90,null))[_0x8db2('0x27')](saveUpdates(_0x4c66e5[_0x8db2('0x4b')],null))['then'](respondWithResult(_0x540d90,null))['catch'](handleError(_0x540d90,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x42')][_0x8db2('0x49')]({'where':{'id':_0x18c6ef[_0x8db2('0x4c')]['id']}})[_0x8db2('0x27')](handleEntityNotFound(_0x2908e4,null))[_0x8db2('0x27')](removeEntity(_0x2908e4,null))[_0x8db2('0x45')](handleError(_0x2908e4,null));};exports[_0x8db2('0x4e')]=function(_0x3bc632,_0x319273){return db[_0x8db2('0x42')][_0x8db2('0x4e')]()[_0x8db2('0x27')](respondWithResult(_0x319273,null))['catch'](handleError(_0x319273,null));};exports[_0x8db2('0x4f')]=function(_0xb4b0a,_0x579317){var _0x27b644={},_0xd78022={},_0x3af298={'count':0x0,'rows':[]};_0xd78022['model']=_[_0x8db2('0x32')](db[_0x8db2('0x42')][_0x8db2('0x47')]);_0xd78022[_0x8db2('0x31')]=_[_0x8db2('0x32')](_0xb4b0a['query']);_0xd78022[_0x8db2('0x3d')]=_[_0x8db2('0x33')](_0xd78022[_0x8db2('0x30')],_0xd78022['query']);_0x27b644[_0x8db2('0x35')]=_[_0x8db2('0x33')](_0xd78022[_0x8db2('0x30')],qs[_0x8db2('0x34')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x34')]));_0x27b644[_0x8db2('0x35')]=_0x27b644['attributes'][_0x8db2('0x36')]?_0x27b644[_0x8db2('0x35')]:_0xd78022['model'];if(!_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x37')]('nolimit')){_0x27b644[_0x8db2('0x20')]=qs[_0x8db2('0x20')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x20')]);_0x27b644[_0x8db2('0x1f')]=qs[_0x8db2('0x1f')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x1f')]);}_0x27b644[_0x8db2('0x39')]=qs[_0x8db2('0x3a')](_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x3a')]);_0x27b644[_0x8db2('0x3b')]=qs[_0x8db2('0x3d')](_[_0x8db2('0x3c')](_0xb4b0a[_0x8db2('0x31')],_0xd78022['filters']));if(_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x40')]){_0x27b644[_0x8db2('0x3b')]=_[_0x8db2('0x3e')](_0x27b644[_0x8db2('0x3b')],{'$or':_['map'](_0x27b644[_0x8db2('0x35')],function(_0x2c3087){var _0x3ab670={};_0x3ab670[_0x2c3087]={'$like':'%'+_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x40')]+'%'};return _0x3ab670;})});}_0x27b644=_[_0x8db2('0x3e')]({},_0x27b644,_0xb4b0a[_0x8db2('0x41')]);var _0x2c7b04={'where':_0x27b644[_0x8db2('0x3b')]};return db[_0x8db2('0x42')][_0x8db2('0x43')](_0x2c7b04)[_0x8db2('0x27')](function(_0x170a72){_0x3af298[_0x8db2('0x43')]=_0x170a72;if(_0xb4b0a[_0x8db2('0x31')][_0x8db2('0x48')]){_0x27b644[_0x8db2('0x44')]=[{'all':!![]}];}return db[_0x8db2('0x42')]['findAll'](_0x27b644);})[_0x8db2('0x27')](function(_0x536ac1){_0x3af298[_0x8db2('0x50')]=_0x536ac1;return _0x3af298;})['then'](respondWithFilteredResult(_0x579317,_0x27b644,_0x8db2('0x4f')))[_0x8db2('0x45')](handleError(_0x579317,null,_0x8db2('0x4f')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 1191d75..d4a380a 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 _0x3a9f=['remove','emit','hook','exports','../../mysqldb','VoiceQueueReport','setMaxListeners','save'];(function(_0x5434dd,_0x5b6caa){var _0x5d55de=function(_0x5515fe){while(--_0x5515fe){_0x5434dd['push'](_0x5434dd['shift']());}};_0x5d55de(++_0x5b6caa);}(_0x3a9f,0x1cc));var _0xf3a9=function(_0x51fe5f,_0x1d8632){_0x51fe5f=_0x51fe5f-0x0;var _0x4abce9=_0x3a9f[_0x51fe5f];return _0x4abce9;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xf3a9('0x0'))['db'][_0xf3a9('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xf3a9('0x2')](0x0);var events={'afterCreate':_0xf3a9('0x3'),'afterUpdate':'update','afterDestroy':_0xf3a9('0x4')};function emitEvent(_0x455497){return function(_0x1df7e6,_0x17e510,_0x145b04){VoiceQueueReportEvents[_0xf3a9('0x5')](_0x455497+':'+_0x1df7e6['id'],_0x1df7e6);VoiceQueueReportEvents[_0xf3a9('0x5')](_0x455497,_0x1df7e6);_0x145b04(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xf3a9('0x6')](e,emitEvent(event));}}module[_0xf3a9('0x7')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xd8ab=['../../mysqldb','VoiceQueueReport','setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x22b8a3,_0x2a79a7){var _0x199a0c=function(_0x544c66){while(--_0x544c66){_0x22b8a3['push'](_0x22b8a3['shift']());}};_0x199a0c(++_0x2a79a7);}(_0xd8ab,0x195));var _0xbd8a=function(_0x548c87,_0x1fc4d4){_0x548c87=_0x548c87-0x0;var _0x359797=_0xd8ab[_0x548c87];return _0x359797;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require(_0xbd8a('0x0'))['db'][_0xbd8a('0x1')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xbd8a('0x2')](0x0);var events={'afterCreate':_0xbd8a('0x3'),'afterUpdate':'update','afterDestroy':_0xbd8a('0x4')};function emitEvent(_0x1366ab){return function(_0x237899,_0x553669,_0x5acdfe){VoiceQueueReportEvents[_0xbd8a('0x5')](_0x1366ab+':'+_0x237899['id'],_0x237899);VoiceQueueReportEvents[_0xbd8a('0x5')](_0x1366ab,_0x237899);_0x5acdfe(null);};}for(var e in events){if(events[_0xbd8a('0x6')](e)){var event=events[e];VoiceQueueReport[_0xbd8a('0x7')](e,emitEvent(event));}}module[_0xbd8a('0x8')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index ff7de0c..58baf14 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 _0x5f66=['request-promise','path','../../config/environment','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','util','api','moment','bluebird'];(function(_0xf0744c,_0x123219){var _0x4bf463=function(_0x3e6c5c){while(--_0x3e6c5c){_0xf0744c['push'](_0xf0744c['shift']());}};_0x4bf463(++_0x123219);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var logger=require('../../config/logger')(_0x65f6('0x1'));var moment=require(_0x65f6('0x2'));var BPromise=require(_0x65f6('0x3'));var rp=require(_0x65f6('0x4'));var fs=require('fs');var path=require(_0x65f6('0x5'));var rimraf=require('rimraf');var config=require(_0x65f6('0x6'));var attributes=require('./voiceQueueReport.attributes');module[_0x65f6('0x7')]=function(_0x22b017,_0x4ec221){return _0x22b017['define'](_0x65f6('0x8'),attributes,{'tableName':_0x65f6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x65f6('0xa')]},{'fields':[_0x65f6('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb10b=['define','report_queue','uniqueid','calleridnum','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports'];(function(_0x49c653,_0x390195){var _0x31e169=function(_0x3684ac){while(--_0x3684ac){_0x49c653['push'](_0x49c653['shift']());}};_0x31e169(++_0x390195);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b08de,_0x63ddd0){_0x3b08de=_0x3b08de-0x0;var _0x53fbe4=_0xb10b[_0x3b08de];return _0x53fbe4;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var logger=require(_0xbb10('0x1'))(_0xbb10('0x2'));var moment=require(_0xbb10('0x3'));var BPromise=require('bluebird');var rp=require(_0xbb10('0x4'));var fs=require('fs');var path=require(_0xbb10('0x5'));var rimraf=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var attributes=require(_0xbb10('0x8'));module[_0xbb10('0x9')]=function(_0x481979,_0x328583){return _0x481979[_0xbb10('0xa')]('VoiceQueueReport',attributes,{'tableName':_0xbb10('0xb'),'paranoid':![],'indexes':[{'fields':[_0xbb10('0xc')]},{'fields':[_0xbb10('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index e47286d..aa5d7af 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 _0x1a40=['update','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','VoiceQueueReport','options','where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','body','raw','UpdateVoiceQueueReport'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x1a40,0xd3));var _0x01a4=function(_0x5de1ca,_0x122002){_0x5de1ca=_0x5de1ca-0x0;var _0x2e4d27=_0x1a40[_0x5de1ca];return _0x2e4d27;};'use strict';var _=require('lodash');var util=require(_0x01a4('0x0'));var moment=require(_0x01a4('0x1'));var BPromise=require(_0x01a4('0x2'));var rs=require(_0x01a4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x01a4('0x4'))['db'];var utils=require(_0x01a4('0x5'));var logger=require(_0x01a4('0x6'))(_0x01a4('0x7'));var config=require(_0x01a4('0x8'));var jayson=require(_0x01a4('0x9'));var client=jayson[_0x01a4('0xa')][_0x01a4('0xb')]({'port':0x232a});config[_0x01a4('0xc')]=_['defaults'](config[_0x01a4('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x01a4('0xd'))(new Redis(config[_0x01a4('0xc')]));require(_0x01a4('0xe'))[_0x01a4('0xf')](socket);function respondWithRpcPromise(_0xea48e,_0x5da08f,_0x53ad6e){return new BPromise(function(_0x1b326a,_0x3fda5b){return client[_0x01a4('0x10')](_0xea48e,_0x53ad6e)[_0x01a4('0x11')](function(_0x3e7b5f){logger[_0x01a4('0x12')](_0x01a4('0x13'),_0x5da08f,_0x01a4('0x14'));logger[_0x01a4('0x15')](_0x01a4('0x16'),_0x5da08f,'request\x20sent',JSON[_0x01a4('0x17')](_0x3e7b5f));if(_0x3e7b5f[_0x01a4('0x18')]){if(_0x3e7b5f[_0x01a4('0x18')][_0x01a4('0x19')]===0x1f4){logger[_0x01a4('0x18')]('VoiceQueueReport,\x20%s,\x20%s',_0x5da08f,_0x3e7b5f['error'][_0x01a4('0x1a')]);return _0x3fda5b(_0x3e7b5f[_0x01a4('0x18')][_0x01a4('0x1a')]);}logger[_0x01a4('0x18')](_0x01a4('0x13'),_0x5da08f,_0x3e7b5f[_0x01a4('0x18')][_0x01a4('0x1a')]);return _0x1b326a(_0x3e7b5f['error'][_0x01a4('0x1a')]);}else{logger[_0x01a4('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x5da08f,_0x01a4('0x14'));_0x1b326a(_0x3e7b5f['result'][_0x01a4('0x1a')]);}})[_0x01a4('0x1b')](function(_0x4d607a){logger['error'](_0x01a4('0x13'),_0x5da08f,_0x4d607a);_0x3fda5b(_0x4d607a);});});}exports['GetVoiceQueueReport']=function(_0xdecc74){var _0x23ddd3=this;return new Promise(function(_0x49fc8d,_0x2bcf84){return db[_0x01a4('0x1c')]['findAll']({'raw':_0xdecc74[_0x01a4('0x1d')]?_0xdecc74[_0x01a4('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0xdecc74[_0x01a4('0x1d')]?_0xdecc74[_0x01a4('0x1d')][_0x01a4('0x1e')]||null:null,'attributes':_0xdecc74[_0x01a4('0x1d')]?_0xdecc74[_0x01a4('0x1d')][_0x01a4('0x1f')]||null:null,'limit':_0xdecc74[_0x01a4('0x1d')]?_0xdecc74[_0x01a4('0x1d')][_0x01a4('0x20')]||null:null,'include':_0xdecc74[_0x01a4('0x1d')]?_0xdecc74[_0x01a4('0x1d')][_0x01a4('0x21')]?_[_0x01a4('0x22')](_0xdecc74[_0x01a4('0x1d')][_0x01a4('0x21')],function(_0x4465ff){return{'model':db[_0x4465ff[_0x01a4('0x23')]],'as':_0x4465ff['as'],'attributes':_0x4465ff[_0x01a4('0x1f')],'include':_0x4465ff[_0x01a4('0x21')]?_[_0x01a4('0x22')](_0x4465ff[_0x01a4('0x21')],function(_0x206bc2){return{'model':db[_0x206bc2['model']],'as':_0x206bc2['as'],'attributes':_0x206bc2['attributes'],'include':_0x206bc2[_0x01a4('0x21')]?_[_0x01a4('0x22')](_0x206bc2[_0x01a4('0x21')],function(_0x1201c2){return{'model':db[_0x1201c2[_0x01a4('0x23')]],'as':_0x1201c2['as'],'attributes':_0x1201c2[_0x01a4('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x01a4('0x11')](function(_0x350605){logger[_0x01a4('0x12')]('GetVoiceQueueReport',_0xdecc74);logger[_0x01a4('0x15')](_0x01a4('0x24'),_0xdecc74,JSON['stringify'](_0x350605));_0x49fc8d(_0x350605);})[_0x01a4('0x1b')](function(_0x57f8d0){logger['error'](_0x01a4('0x24'),_0x57f8d0[_0x01a4('0x1a')],_0xdecc74);_0x2bcf84(_0x23ddd3['error'](0x1f4,_0x57f8d0['message']));});});};exports[_0x01a4('0x25')]=function(_0x3eab9a){var _0x5ac753=this;return new Promise(function(_0x34db9a,_0x3a4500){return db[_0x01a4('0x1c')]['create'](_0x3eab9a[_0x01a4('0x26')],{'raw':_0x3eab9a[_0x01a4('0x1d')]?_0x3eab9a[_0x01a4('0x1d')][_0x01a4('0x27')]===undefined?!![]:![]:!![]})[_0x01a4('0x11')](function(_0x2e00bb){logger[_0x01a4('0x12')]('CreateVoiceQueueReport',_0x3eab9a);logger['debug'](_0x01a4('0x25'),_0x3eab9a,JSON[_0x01a4('0x17')](_0x2e00bb));_0x34db9a(_0x2e00bb);})['catch'](function(_0x209709){logger[_0x01a4('0x18')](_0x01a4('0x25'),_0x209709['message'],_0x3eab9a);_0x3a4500(_0x5ac753[_0x01a4('0x18')](0x1f4,_0x209709[_0x01a4('0x1a')]));});});};exports[_0x01a4('0x28')]=function(_0x48435a){var _0x5cc9a4=this;return new Promise(function(_0x90b533,_0x55e982){return db[_0x01a4('0x1c')][_0x01a4('0x29')](_0x48435a[_0x01a4('0x26')],{'raw':_0x48435a[_0x01a4('0x1d')]?_0x48435a[_0x01a4('0x1d')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48435a[_0x01a4('0x1d')]?_0x48435a['options'][_0x01a4('0x1e')]||null:null,'attributes':_0x48435a[_0x01a4('0x1d')]?_0x48435a[_0x01a4('0x1d')]['attributes']||null:null,'limit':_0x48435a[_0x01a4('0x1d')]?_0x48435a[_0x01a4('0x1d')][_0x01a4('0x20')]||null:null})[_0x01a4('0x11')](function(_0xab6f16){logger[_0x01a4('0x12')](_0x01a4('0x28'),_0x48435a);logger[_0x01a4('0x15')](_0x01a4('0x28'),_0x48435a,JSON[_0x01a4('0x17')](_0xab6f16));_0x90b533(_0xab6f16);})[_0x01a4('0x1b')](function(_0x182d9a){logger[_0x01a4('0x18')](_0x01a4('0x28'),_0x182d9a[_0x01a4('0x1a')],_0x48435a);_0x55e982(_0x5cc9a4['error'](0x1f4,_0x182d9a['message']));});});}; \ No newline at end of file +var _0x1fab=['where','attributes','limit','include','map','model','GetVoiceQueueReport','CreateVoiceQueueReport','create','body','update','UpdateVoiceQueueReport','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','VoiceQueueReport','findAll','options','raw'];(function(_0x1ae465,_0x284bdc){var _0x14dd28=function(_0x26c7c1){while(--_0x26c7c1){_0x1ae465['push'](_0x1ae465['shift']());}};_0x14dd28(++_0x284bdc);}(_0x1fab,0xf2));var _0xb1fa=function(_0x43edd6,_0x2c182a){_0x43edd6=_0x43edd6-0x0;var _0x42b948=_0x1fab[_0x43edd6];return _0x42b948;};'use strict';var _=require(_0xb1fa('0x0'));var util=require(_0xb1fa('0x1'));var moment=require(_0xb1fa('0x2'));var BPromise=require('bluebird');var rs=require(_0xb1fa('0x3'));var fs=require('fs');var Redis=require(_0xb1fa('0x4'));var db=require(_0xb1fa('0x5'))['db'];var utils=require(_0xb1fa('0x6'));var logger=require(_0xb1fa('0x7'))(_0xb1fa('0x8'));var config=require(_0xb1fa('0x9'));var jayson=require(_0xb1fa('0xa'));var client=jayson[_0xb1fa('0xb')][_0xb1fa('0xc')]({'port':0x232a});config[_0xb1fa('0xd')]=_[_0xb1fa('0xe')](config[_0xb1fa('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xb1fa('0xf'))(new Redis(config[_0xb1fa('0xd')]));require('./voiceQueueReport.socket')[_0xb1fa('0x10')](socket);function respondWithRpcPromise(_0x371589,_0x574c6b,_0x431dc9){return new BPromise(function(_0x2c2304,_0x18008a){return client[_0xb1fa('0x11')](_0x371589,_0x431dc9)[_0xb1fa('0x12')](function(_0x295138){logger[_0xb1fa('0x13')](_0xb1fa('0x14'),_0x574c6b,_0xb1fa('0x15'));logger[_0xb1fa('0x16')](_0xb1fa('0x17'),_0x574c6b,_0xb1fa('0x15'),JSON[_0xb1fa('0x18')](_0x295138));if(_0x295138[_0xb1fa('0x19')]){if(_0x295138[_0xb1fa('0x19')][_0xb1fa('0x1a')]===0x1f4){logger[_0xb1fa('0x19')](_0xb1fa('0x14'),_0x574c6b,_0x295138[_0xb1fa('0x19')]['message']);return _0x18008a(_0x295138[_0xb1fa('0x19')][_0xb1fa('0x1b')]);}logger['error'](_0xb1fa('0x14'),_0x574c6b,_0x295138[_0xb1fa('0x19')][_0xb1fa('0x1b')]);return _0x2c2304(_0x295138['error'][_0xb1fa('0x1b')]);}else{logger[_0xb1fa('0x13')](_0xb1fa('0x14'),_0x574c6b,_0xb1fa('0x15'));_0x2c2304(_0x295138[_0xb1fa('0x1c')][_0xb1fa('0x1b')]);}})[_0xb1fa('0x1d')](function(_0x54b74a){logger[_0xb1fa('0x19')]('VoiceQueueReport,\x20%s,\x20%s',_0x574c6b,_0x54b74a);_0x18008a(_0x54b74a);});});}exports['GetVoiceQueueReport']=function(_0x2fff28){var _0xb50ff0=this;return new Promise(function(_0x4d7238,_0x32f864){return db[_0xb1fa('0x1e')][_0xb1fa('0x1f')]({'raw':_0x2fff28[_0xb1fa('0x20')]?_0x2fff28['options'][_0xb1fa('0x21')]===undefined?!![]:![]:!![],'where':_0x2fff28[_0xb1fa('0x20')]?_0x2fff28['options'][_0xb1fa('0x22')]||null:null,'attributes':_0x2fff28[_0xb1fa('0x20')]?_0x2fff28['options'][_0xb1fa('0x23')]||null:null,'limit':_0x2fff28[_0xb1fa('0x20')]?_0x2fff28[_0xb1fa('0x20')][_0xb1fa('0x24')]||null:null,'include':_0x2fff28[_0xb1fa('0x20')]?_0x2fff28[_0xb1fa('0x20')][_0xb1fa('0x25')]?_['map'](_0x2fff28[_0xb1fa('0x20')]['include'],function(_0x3378ff){return{'model':db[_0x3378ff['model']],'as':_0x3378ff['as'],'attributes':_0x3378ff[_0xb1fa('0x23')],'include':_0x3378ff[_0xb1fa('0x25')]?_[_0xb1fa('0x26')](_0x3378ff['include'],function(_0x52f9c7){return{'model':db[_0x52f9c7[_0xb1fa('0x27')]],'as':_0x52f9c7['as'],'attributes':_0x52f9c7[_0xb1fa('0x23')],'include':_0x52f9c7[_0xb1fa('0x25')]?_[_0xb1fa('0x26')](_0x52f9c7[_0xb1fa('0x25')],function(_0x14fac9){return{'model':db[_0x14fac9[_0xb1fa('0x27')]],'as':_0x14fac9['as'],'attributes':_0x14fac9[_0xb1fa('0x23')]};}):[]};}):[]};}):[]:[]})[_0xb1fa('0x12')](function(_0x1e630c){logger[_0xb1fa('0x13')](_0xb1fa('0x28'),_0x2fff28);logger[_0xb1fa('0x16')](_0xb1fa('0x28'),_0x2fff28,JSON['stringify'](_0x1e630c));_0x4d7238(_0x1e630c);})[_0xb1fa('0x1d')](function(_0x3dc2c3){logger[_0xb1fa('0x19')](_0xb1fa('0x28'),_0x3dc2c3[_0xb1fa('0x1b')],_0x2fff28);_0x32f864(_0xb50ff0['error'](0x1f4,_0x3dc2c3['message']));});});};exports[_0xb1fa('0x29')]=function(_0x8de373){var _0x2272c7=this;return new Promise(function(_0x1ba2cb,_0x5e6ee4){return db[_0xb1fa('0x1e')][_0xb1fa('0x2a')](_0x8de373[_0xb1fa('0x2b')],{'raw':_0x8de373[_0xb1fa('0x20')]?_0x8de373[_0xb1fa('0x20')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x558304){logger['info'](_0xb1fa('0x29'),_0x8de373);logger[_0xb1fa('0x16')]('CreateVoiceQueueReport',_0x8de373,JSON[_0xb1fa('0x18')](_0x558304));_0x1ba2cb(_0x558304);})[_0xb1fa('0x1d')](function(_0x358fcc){logger['error']('CreateVoiceQueueReport',_0x358fcc['message'],_0x8de373);_0x5e6ee4(_0x2272c7['error'](0x1f4,_0x358fcc['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x3a4590){var _0x57aaa7=this;return new Promise(function(_0x58688d,_0xc64617){return db[_0xb1fa('0x1e')][_0xb1fa('0x2c')](_0x3a4590[_0xb1fa('0x2b')],{'raw':_0x3a4590['options']?_0x3a4590[_0xb1fa('0x20')][_0xb1fa('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3a4590[_0xb1fa('0x20')]?_0x3a4590[_0xb1fa('0x20')][_0xb1fa('0x22')]||null:null,'attributes':_0x3a4590[_0xb1fa('0x20')]?_0x3a4590[_0xb1fa('0x20')][_0xb1fa('0x23')]||null:null,'limit':_0x3a4590[_0xb1fa('0x20')]?_0x3a4590[_0xb1fa('0x20')][_0xb1fa('0x24')]||null:null})[_0xb1fa('0x12')](function(_0x191494){logger[_0xb1fa('0x13')](_0xb1fa('0x2d'),_0x3a4590);logger[_0xb1fa('0x16')](_0xb1fa('0x2d'),_0x3a4590,JSON[_0xb1fa('0x18')](_0x191494));_0x58688d(_0x191494);})[_0xb1fa('0x1d')](function(_0x3de5c2){logger[_0xb1fa('0x19')](_0xb1fa('0x2d'),_0x3de5c2['message'],_0x3a4590);_0xc64617(_0x57aaa7[_0xb1fa('0x19')](0x1f4,_0x3de5c2['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 616be46..af0c3d6 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 _0xd378=['length','remove','removeListener','register'];(function(_0x3cc8a2,_0x1f897a){var _0x1946e3=function(_0x6b1fe1){while(--_0x6b1fe1){_0x3cc8a2['push'](_0x3cc8a2['shift']());}};_0x1946e3(++_0x1f897a);}(_0xd378,0x129));var _0x8d37=function(_0xabae5f,_0x22c9de){_0xabae5f=_0xabae5f-0x0;var _0x9b3535=_0xd378[_0xabae5f];return _0x9b3535;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=['save',_0x8d37('0x0'),'update'];function createListener(_0x2a11ad,_0x1bfb86){return function(_0x275554){_0x1bfb86['emit'](_0x2a11ad,_0x275554);};}function removeListener(_0x68c4aa,_0x3e72a0){return function(){VoiceQueueReportEvents[_0x8d37('0x1')](_0x68c4aa,_0x3e72a0);};}exports[_0x8d37('0x2')]=function(_0x5daa3b){for(var _0x71564a=0x0,_0x53a013=events[_0x8d37('0x3')];_0x71564a<_0x53a013;_0x71564a++){var _0x407f84=events[_0x71564a];var _0x452db2=createListener('voiceQueueReport:'+_0x407f84,_0x5daa3b);VoiceQueueReportEvents['on'](_0x407f84,_0x452db2);}}; \ No newline at end of file +var _0x6add=['emit','register','./voiceQueueReport.events','save'];(function(_0x47792c,_0xddb627){var _0x35432d=function(_0x5acb78){while(--_0x5acb78){_0x47792c['push'](_0x47792c['shift']());}};_0x35432d(++_0xddb627);}(_0x6add,0x17a));var _0xd6ad=function(_0x4c89dd,_0x408798){_0x4c89dd=_0x4c89dd-0x0;var _0x38a1a3=_0x6add[_0x4c89dd];return _0x38a1a3;};'use strict';var VoiceQueueReportEvents=require(_0xd6ad('0x0'));var events=[_0xd6ad('0x1'),'remove','update'];function createListener(_0x34ab48,_0x238efe){return function(_0x2111e1){_0x238efe[_0xd6ad('0x2')](_0x34ab48,_0x2111e1);};}function removeListener(_0x54bab9,_0x41da77){return function(){VoiceQueueReportEvents['removeListener'](_0x54bab9,_0x41da77);};}exports[_0xd6ad('0x3')]=function(_0xd9377b){for(var _0x3e124c=0x0,_0x5b1be6=events['length'];_0x3e124c<_0x5b1be6;_0x3e124c++){var _0x3a92d1=events[_0x3e124c];var _0x4a3c6e=createListener('voiceQueueReport:'+_0x3a92d1,_0xd9377b);VoiceQueueReportEvents['on'](_0x3a92d1,_0x4a3c6e);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index b9079fe..7b1916f 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 _0xd5b1=['index','/:id','post','create','put','update','delete','exports','multer','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated'];(function(_0x21bfce,_0x4c2c80){var _0x1cd9e0=function(_0x3fb74c){while(--_0x3fb74c){_0x21bfce['push'](_0x21bfce['shift']());}};_0x1cd9e0(++_0x4c2c80);}(_0xd5b1,0x116));var _0x1d5b=function(_0x29dda1,_0x508e13){_0x29dda1=_0x29dda1-0x0;var _0x21b0ef=_0xd5b1[_0x29dda1];return _0x21b0ef;};'use strict';var multer=require(_0x1d5b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1d5b('0x1'));var express=require('express');var router=express[_0x1d5b('0x2')]();var auth=require(_0x1d5b('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x1d5b('0x4'));var controller=require('./voiceQueuesLog.controller');router[_0x1d5b('0x5')]('/',auth[_0x1d5b('0x6')](),controller[_0x1d5b('0x7')]);router[_0x1d5b('0x5')](_0x1d5b('0x8'),auth[_0x1d5b('0x6')](),controller['show']);router[_0x1d5b('0x9')]('/',auth[_0x1d5b('0x6')](),controller[_0x1d5b('0xa')]);router[_0x1d5b('0xb')](_0x1d5b('0x8'),auth[_0x1d5b('0x6')](),controller[_0x1d5b('0xc')]);router[_0x1d5b('0xd')]('/:id',auth[_0x1d5b('0x6')](),controller['destroy']);module[_0x1d5b('0xe')]=router; \ No newline at end of file +var _0xff19=['exports','multer','util','express','Router','../../components/auth/service','./voiceQueuesLog.controller','get','index','/:id','isAuthenticated','show','post','create','update','delete','destroy'];(function(_0x49a052,_0x104825){var _0x36960a=function(_0xeb527){while(--_0xeb527){_0x49a052['push'](_0x49a052['shift']());}};_0x36960a(++_0x104825);}(_0xff19,0x100));var _0x9ff1=function(_0x45c542,_0x45c9f1){_0x45c542=_0x45c542-0x0;var _0xf21697=_0xff19[_0x45c542];return _0xf21697;};'use strict';var multer=require(_0x9ff1('0x0'));var util=require(_0x9ff1('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x9ff1('0x2'));var router=express[_0x9ff1('0x3')]();var auth=require(_0x9ff1('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9ff1('0x5'));router[_0x9ff1('0x6')]('/',auth['isAuthenticated'](),controller[_0x9ff1('0x7')]);router[_0x9ff1('0x6')](_0x9ff1('0x8'),auth[_0x9ff1('0x9')](),controller[_0x9ff1('0xa')]);router[_0x9ff1('0xb')]('/',auth[_0x9ff1('0x9')](),controller[_0x9ff1('0xc')]);router['put'](_0x9ff1('0x8'),auth['isAuthenticated'](),controller[_0x9ff1('0xd')]);router[_0x9ff1('0xe')]('/:id',auth[_0x9ff1('0x9')](),controller[_0x9ff1('0xf')]);module[_0x9ff1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js b/server/api/voiceQueuesLog/voiceQueuesLog.attributes.js index 85d86c7..27f96cd 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 _0x6b6a=['YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports','STRING','DATE'];(function(_0x572c8a,_0x320aca){var _0x2f11f2=function(_0xd6c9d0){while(--_0xd6c9d0){_0x572c8a['push'](_0x572c8a['shift']());}};_0x2f11f2(++_0x320aca);}(_0x6b6a,0xe5));var _0xa6b6=function(_0x5bcd0a,_0x2a552d){_0x5bcd0a=_0x5bcd0a-0x0;var _0x5293a6=_0x6b6a[_0x5bcd0a];return _0x5293a6;};'use strict';var Sequelize=require(_0xa6b6('0x0'));var moment=require(_0xa6b6('0x1'));module[_0xa6b6('0x2')]={'time':{'type':Sequelize['STRING']},'callid':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0xa6b6('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0xa6b6('0x4')],'allowNull':![],'defaultValue':moment()['format'](_0xa6b6('0x5'))}}; \ No newline at end of file +var _0x8be4=['STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss','sequelize','moment','exports'];(function(_0x45693f,_0x5d7a47){var _0x476dd0=function(_0xf7d8dd){while(--_0xf7d8dd){_0x45693f['push'](_0x45693f['shift']());}};_0x476dd0(++_0x5d7a47);}(_0x8be4,0x1a8));var _0x48be=function(_0x2307fa,_0x266e5e){_0x2307fa=_0x2307fa-0x0;var _0x496486=_0x8be4[_0x2307fa];return _0x496486;};'use strict';var Sequelize=require(_0x48be('0x0'));var moment=require(_0x48be('0x1'));module[_0x48be('0x2')]={'time':{'type':Sequelize[_0x48be('0x3')]},'callid':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x48be('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x48be('0x4')],'allowNull':![],'defaultValue':moment()[_0x48be('0x5')](_0x48be('0x6'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 871775b..dbaae44 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 _0x9400=['type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','merge','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','rawAttributes','fieldName'];(function(_0xb9a3dc,_0x3c05b6){var _0xa8c6f7=function(_0x2652eb){while(--_0x2652eb){_0xb9a3dc['push'](_0xb9a3dc['shift']());}};_0xa8c6f7(++_0x3c05b6);}(_0x9400,0x65));var _0x0940=function(_0x4c3fbf,_0x1228a5){_0x4c3fbf=_0x4c3fbf-0x0;var _0x41513b=_0x9400[_0x4c3fbf];return _0x41513b;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x0940('0x0'));var rimraf=require(_0x0940('0x1'));var zipdir=require(_0x0940('0x2'));var jsonpatch=require(_0x0940('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0940('0x4'));var Mustache=require(_0x0940('0x5'));var util=require(_0x0940('0x6'));var path=require(_0x0940('0x7'));var sox=require(_0x0940('0x8'));var csv=require('to-csv');var ejs=require(_0x0940('0x9'));var fs=require('fs');var _=require('lodash');var squel=require(_0x0940('0xa'));var crypto=require('crypto');var jsforce=require(_0x0940('0xb'));var deskjs=require(_0x0940('0xc'));var toCsv=require(_0x0940('0xd'));var querystring=require(_0x0940('0xe'));var Papa=require(_0x0940('0xf'));var Redis=require('ioredis');var authService=require(_0x0940('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0940('0x11'));var hardwareService=require(_0x0940('0x12'));var logger=require('../../config/logger')(_0x0940('0x13'));var utils=require(_0x0940('0x14'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x10cc27,_0x239f2f){_0x239f2f=_0x239f2f||0xcc;return function(_0x4cac6f){if(_0x4cac6f){return _0x10cc27['sendStatus'](_0x239f2f);}return _0x10cc27[_0x0940('0x15')](_0x239f2f)[_0x0940('0x16')]();};}function respondWithResult(_0x4d6284,_0x531fe7){_0x531fe7=_0x531fe7||0xc8;return function(_0x33616c){if(_0x33616c){return _0x4d6284[_0x0940('0x15')](_0x531fe7)[_0x0940('0x17')](_0x33616c);}};}function respondWithFilteredResult(_0x57851c,_0x228822){return function(_0x233ab5){if(_0x233ab5){var _0x2fe893=_0x233ab5[_0x0940('0x18')],_0x5c2e9d=_0x228822[_0x0940('0x19')],_0x5376ad=_0x228822[_0x0940('0x19')]+_0x228822[_0x0940('0x1a')],_0x35a582;if(_0x5376ad>=_0x2fe893){_0x5376ad=_0x2fe893;_0x35a582=0xc8;}else{_0x35a582=0xce;}_0x57851c[_0x0940('0x15')](_0x35a582);return _0x57851c[_0x0940('0x1b')](_0x0940('0x1c'),_0x5c2e9d+'-'+_0x5376ad+'/'+_0x2fe893)['json'](_0x233ab5);}return null;};}function patchUpdates(_0x119757){return function(_0x293c3a){try{jsonpatch[_0x0940('0x1d')](_0x293c3a,_0x119757,!![]);}catch(_0x20989c){return BPromise[_0x0940('0x1e')](_0x20989c);}return _0x293c3a['save']();};}function saveUpdates(_0x34b09d,_0x1308b0){return function(_0xfd6c19){if(_0xfd6c19){return _0xfd6c19[_0x0940('0x1f')](_0x34b09d)[_0x0940('0x20')](function(_0x139768){return _0x139768;});}return null;};}function removeEntity(_0x16de74,_0x1bf545){return function(_0x1f9e16){if(_0x1f9e16){return _0x1f9e16[_0x0940('0x21')]()[_0x0940('0x20')](function(){_0x16de74[_0x0940('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc9c383,_0x4d8d33){return function(_0x1eb43e){if(!_0x1eb43e){_0xc9c383['sendStatus'](0x194);}return _0x1eb43e;};}function handleError(_0x121007,_0x49dbcd){_0x49dbcd=_0x49dbcd||0x1f4;return function(_0x263246){logger[_0x0940('0x22')](_0x263246[_0x0940('0x23')]);if(_0x263246[_0x0940('0x24')]){delete _0x263246['name'];}_0x121007[_0x0940('0x15')](_0x49dbcd)[_0x0940('0x25')](_0x263246);};}exports[_0x0940('0x26')]=function(_0x16cd28,_0x30f0b7){var _0x15188f={},_0x36d4bc={},_0x491c7f={'count':0x0,'rows':[]};var _0x6828d4=_[_0x0940('0x27')](db[_0x0940('0x28')][_0x0940('0x29')],function(_0x31faa0){return{'name':_0x31faa0[_0x0940('0x2a')],'type':_0x31faa0[_0x0940('0x2b')][_0x0940('0x2c')]};});_0x36d4bc[_0x0940('0x2d')]=_[_0x0940('0x27')](_0x6828d4,_0x0940('0x24'));_0x36d4bc[_0x0940('0x2e')]=_[_0x0940('0x2f')](_0x16cd28[_0x0940('0x2e')]);_0x36d4bc[_0x0940('0x30')]=_[_0x0940('0x31')](_0x36d4bc[_0x0940('0x2d')],_0x36d4bc[_0x0940('0x2e')]);_0x15188f[_0x0940('0x32')]=_[_0x0940('0x31')](_0x36d4bc['model'],qs['fields'](_0x16cd28[_0x0940('0x2e')][_0x0940('0x33')]));_0x15188f[_0x0940('0x32')]=_0x15188f[_0x0940('0x32')][_0x0940('0x34')]?_0x15188f[_0x0940('0x32')]:_0x36d4bc[_0x0940('0x2d')];if(!_0x16cd28[_0x0940('0x2e')]['hasOwnProperty'](_0x0940('0x35'))){_0x15188f['limit']=qs[_0x0940('0x1a')](_0x16cd28[_0x0940('0x2e')][_0x0940('0x1a')]);_0x15188f[_0x0940('0x19')]=qs[_0x0940('0x19')](_0x16cd28[_0x0940('0x2e')]['offset']);}_0x15188f[_0x0940('0x36')]=qs[_0x0940('0x37')](_0x16cd28['query'][_0x0940('0x37')]);_0x15188f[_0x0940('0x38')]=qs[_0x0940('0x30')](_[_0x0940('0x39')](_0x16cd28[_0x0940('0x2e')],_0x36d4bc[_0x0940('0x30')]));if(_0x16cd28[_0x0940('0x2e')][_0x0940('0x3a')]){_0x15188f[_0x0940('0x38')]=_['merge'](_0x15188f[_0x0940('0x38')],{'$or':_[_0x0940('0x27')](_0x6828d4,function(_0x2d1d6a){if(_0x2d1d6a[_0x0940('0x2b')]!==_0x0940('0x3b')){var _0x5168ad={};_0x5168ad[_0x2d1d6a[_0x0940('0x24')]]={'$like':'%'+_0x16cd28[_0x0940('0x2e')]['filter']+'%'};return _0x5168ad;}})});}_0x15188f=_['merge']({},_0x15188f,_0x16cd28[_0x0940('0x3c')]);var _0x5739ae={'where':_0x15188f[_0x0940('0x38')]};return db[_0x0940('0x28')][_0x0940('0x18')](_0x5739ae)['then'](function(_0x504d5f){_0x491c7f[_0x0940('0x18')]=_0x504d5f;if(_0x16cd28[_0x0940('0x2e')]['includeAll']){_0x15188f[_0x0940('0x3d')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x0940('0x3e')](_0x15188f);})[_0x0940('0x20')](function(_0x570b52){_0x491c7f[_0x0940('0x3f')]=_0x570b52;return _0x491c7f;})['then'](respondWithFilteredResult(_0x30f0b7,_0x15188f))[_0x0940('0x40')](handleError(_0x30f0b7,null));};exports[_0x0940('0x41')]=function(_0x910e02,_0x5df06b){var _0x21b1a5={'raw':!![],'where':{'id':_0x910e02[_0x0940('0x42')]['id']}},_0x4e4cd3={};_0x4e4cd3[_0x0940('0x2d')]=_[_0x0940('0x2f')](db[_0x0940('0x28')][_0x0940('0x29')]);_0x4e4cd3[_0x0940('0x2e')]=_[_0x0940('0x2f')](_0x910e02[_0x0940('0x2e')]);_0x4e4cd3[_0x0940('0x30')]=_[_0x0940('0x31')](_0x4e4cd3['model'],_0x4e4cd3[_0x0940('0x2e')]);_0x21b1a5[_0x0940('0x32')]=_[_0x0940('0x31')](_0x4e4cd3[_0x0940('0x2d')],qs[_0x0940('0x33')](_0x910e02[_0x0940('0x2e')][_0x0940('0x33')]));_0x21b1a5[_0x0940('0x32')]=_0x21b1a5[_0x0940('0x32')][_0x0940('0x34')]?_0x21b1a5['attributes']:_0x4e4cd3[_0x0940('0x2d')];if(_0x910e02['query'][_0x0940('0x43')]){_0x21b1a5[_0x0940('0x3d')]=[{'all':!![]}];}_0x21b1a5=_[_0x0940('0x44')]({},_0x21b1a5,_0x910e02[_0x0940('0x3c')]);return db[_0x0940('0x28')][_0x0940('0x45')](_0x21b1a5)[_0x0940('0x20')](handleEntityNotFound(_0x5df06b,null))['then'](respondWithResult(_0x5df06b,null))[_0x0940('0x40')](handleError(_0x5df06b,null));};exports[_0x0940('0x46')]=function(_0x1c695e,_0x3be15c){return db[_0x0940('0x28')][_0x0940('0x46')](_0x1c695e['body'],{})[_0x0940('0x20')](respondWithResult(_0x3be15c,0xc9))['catch'](handleError(_0x3be15c,null));};exports[_0x0940('0x1f')]=function(_0x7a5a48,_0x8301a2){if(_0x7a5a48[_0x0940('0x47')]['id']){delete _0x7a5a48[_0x0940('0x47')]['id'];}return db[_0x0940('0x28')][_0x0940('0x45')]({'where':{'id':_0x7a5a48[_0x0940('0x42')]['id']}})[_0x0940('0x20')](handleEntityNotFound(_0x8301a2,null))['then'](saveUpdates(_0x7a5a48[_0x0940('0x47')],null))['then'](respondWithResult(_0x8301a2,null))[_0x0940('0x40')](handleError(_0x8301a2,null));};exports[_0x0940('0x21')]=function(_0x5ba407,_0x385b33){return db[_0x0940('0x28')]['find']({'where':{'id':_0x5ba407[_0x0940('0x42')]['id']}})[_0x0940('0x20')](handleEntityNotFound(_0x385b33,null))[_0x0940('0x20')](removeEntity(_0x385b33,null))[_0x0940('0x40')](handleError(_0x385b33,null));}; \ No newline at end of file +var _0x9d42=['../../components/parsers/qs','../../config/environment','../../mysqldb','sendStatus','status','json','count','offset','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','map','VoiceQueuesLog','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','create','body','find','params','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service'];(function(_0xa3bb66,_0x4cf7b8){var _0x2e6524=function(_0x29f38f){while(--_0x29f38f){_0xa3bb66['push'](_0xa3bb66['shift']());}};_0x2e6524(++_0x4cf7b8);}(_0x9d42,0x1a8));var _0x29d4=function(_0x561f10,_0x581c75){_0x561f10=_0x561f10-0x0;var _0x31150c=_0x9d42[_0x561f10];return _0x31150c;};'use strict';var pdf=require(_0x29d4('0x0'));var emlformat=require(_0x29d4('0x1'));var rimraf=require(_0x29d4('0x2'));var zipdir=require(_0x29d4('0x3'));var jsonpatch=require(_0x29d4('0x4'));var rp=require(_0x29d4('0x5'));var moment=require(_0x29d4('0x6'));var BPromise=require(_0x29d4('0x7'));var Mustache=require('mustache');var util=require('util');var path=require(_0x29d4('0x8'));var sox=require(_0x29d4('0x9'));var csv=require(_0x29d4('0xa'));var ejs=require(_0x29d4('0xb'));var fs=require('fs');var _=require('lodash');var squel=require(_0x29d4('0xc'));var crypto=require(_0x29d4('0xd'));var jsforce=require(_0x29d4('0xe'));var deskjs=require(_0x29d4('0xf'));var toCsv=require(_0x29d4('0xa'));var querystring=require(_0x29d4('0x10'));var Papa=require(_0x29d4('0x11'));var Redis=require(_0x29d4('0x12'));var authService=require(_0x29d4('0x13'));var qs=require(_0x29d4('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x29d4('0x15'));var db=require(_0x29d4('0x16'))['db'];function respondWithStatusCode(_0x315d46,_0x3900fb){_0x3900fb=_0x3900fb||0xcc;return function(_0x1577d8){if(_0x1577d8){return _0x315d46[_0x29d4('0x17')](_0x3900fb);}return _0x315d46[_0x29d4('0x18')](_0x3900fb)['end']();};}function respondWithResult(_0x4d39c5,_0x438a3a){_0x438a3a=_0x438a3a||0xc8;return function(_0x586177){if(_0x586177){return _0x4d39c5[_0x29d4('0x18')](_0x438a3a)[_0x29d4('0x19')](_0x586177);}};}function respondWithFilteredResult(_0x41168f,_0x4a606f){return function(_0x1924ee){if(_0x1924ee){var _0x15a717=_0x1924ee[_0x29d4('0x1a')],_0x451e84=_0x4a606f[_0x29d4('0x1b')],_0x5513d5=_0x4a606f[_0x29d4('0x1b')]+_0x4a606f[_0x29d4('0x1c')],_0x17ffa3;if(_0x5513d5>=_0x15a717){_0x5513d5=_0x15a717;_0x17ffa3=0xc8;}else{_0x17ffa3=0xce;}_0x41168f['status'](_0x17ffa3);return _0x41168f[_0x29d4('0x1d')](_0x29d4('0x1e'),_0x451e84+'-'+_0x5513d5+'/'+_0x15a717)[_0x29d4('0x19')](_0x1924ee);}return null;};}function patchUpdates(_0x90f771){return function(_0xa650f){try{jsonpatch[_0x29d4('0x1f')](_0xa650f,_0x90f771,!![]);}catch(_0x2948a8){return BPromise[_0x29d4('0x20')](_0x2948a8);}return _0xa650f[_0x29d4('0x21')]();};}function saveUpdates(_0x4efe06,_0xfccf7a){return function(_0x422b2d){if(_0x422b2d){return _0x422b2d[_0x29d4('0x22')](_0x4efe06)[_0x29d4('0x23')](function(_0x791c2c){return _0x791c2c;});}return null;};}function removeEntity(_0x7b94fa,_0xc4240e){return function(_0x24e518){if(_0x24e518){return _0x24e518[_0x29d4('0x24')]()[_0x29d4('0x23')](function(){_0x7b94fa[_0x29d4('0x18')](0xcc)[_0x29d4('0x25')]();});}};}function handleEntityNotFound(_0x157213,_0x194979){return function(_0x1b13bd){if(!_0x1b13bd){_0x157213[_0x29d4('0x17')](0x194);}return _0x1b13bd;};}function handleError(_0x13e9eb,_0xf23a45){_0xf23a45=_0xf23a45||0x1f4;return function(_0x4d3469){logger[_0x29d4('0x26')](_0x4d3469[_0x29d4('0x27')]);if(_0x4d3469[_0x29d4('0x28')]){delete _0x4d3469[_0x29d4('0x28')];}_0x13e9eb['status'](_0xf23a45)['send'](_0x4d3469);};}exports['index']=function(_0x119b7d,_0x442212){var _0x49f7b5={},_0x897390={},_0x5cae2d={'count':0x0,'rows':[]};var _0xdd2e60=_[_0x29d4('0x29')](db[_0x29d4('0x2a')][_0x29d4('0x2b')],function(_0x137983){return{'name':_0x137983[_0x29d4('0x2c')],'type':_0x137983[_0x29d4('0x2d')][_0x29d4('0x2e')]};});_0x897390[_0x29d4('0x2f')]=_[_0x29d4('0x29')](_0xdd2e60,_0x29d4('0x28'));_0x897390[_0x29d4('0x30')]=_[_0x29d4('0x31')](_0x119b7d[_0x29d4('0x30')]);_0x897390[_0x29d4('0x32')]=_[_0x29d4('0x33')](_0x897390['model'],_0x897390[_0x29d4('0x30')]);_0x49f7b5[_0x29d4('0x34')]=_[_0x29d4('0x33')](_0x897390[_0x29d4('0x2f')],qs[_0x29d4('0x35')](_0x119b7d[_0x29d4('0x30')][_0x29d4('0x35')]));_0x49f7b5[_0x29d4('0x34')]=_0x49f7b5['attributes'][_0x29d4('0x36')]?_0x49f7b5['attributes']:_0x897390[_0x29d4('0x2f')];if(!_0x119b7d[_0x29d4('0x30')][_0x29d4('0x37')](_0x29d4('0x38'))){_0x49f7b5[_0x29d4('0x1c')]=qs[_0x29d4('0x1c')](_0x119b7d[_0x29d4('0x30')][_0x29d4('0x1c')]);_0x49f7b5[_0x29d4('0x1b')]=qs[_0x29d4('0x1b')](_0x119b7d[_0x29d4('0x30')]['offset']);}_0x49f7b5[_0x29d4('0x39')]=qs[_0x29d4('0x3a')](_0x119b7d[_0x29d4('0x30')][_0x29d4('0x3a')]);_0x49f7b5[_0x29d4('0x3b')]=qs[_0x29d4('0x32')](_[_0x29d4('0x3c')](_0x119b7d['query'],_0x897390['filters']));if(_0x119b7d['query'][_0x29d4('0x3d')]){_0x49f7b5[_0x29d4('0x3b')]=_[_0x29d4('0x3e')](_0x49f7b5['where'],{'$or':_['map'](_0xdd2e60,function(_0x2af0d2){if(_0x2af0d2[_0x29d4('0x2d')]!==_0x29d4('0x3f')){var _0x52287a={};_0x52287a[_0x2af0d2[_0x29d4('0x28')]]={'$like':'%'+_0x119b7d[_0x29d4('0x30')]['filter']+'%'};return _0x52287a;}})});}_0x49f7b5=_[_0x29d4('0x3e')]({},_0x49f7b5,_0x119b7d[_0x29d4('0x40')]);var _0x2a8107={'where':_0x49f7b5[_0x29d4('0x3b')]};return db['VoiceQueuesLog']['count'](_0x2a8107)[_0x29d4('0x23')](function(_0x598f10){_0x5cae2d[_0x29d4('0x1a')]=_0x598f10;if(_0x119b7d['query'][_0x29d4('0x41')]){_0x49f7b5[_0x29d4('0x42')]=[{'all':!![]}];}return db['VoiceQueuesLog'][_0x29d4('0x43')](_0x49f7b5);})[_0x29d4('0x23')](function(_0x2a9bcb){_0x5cae2d[_0x29d4('0x44')]=_0x2a9bcb;return _0x5cae2d;})['then'](respondWithFilteredResult(_0x442212,_0x49f7b5))[_0x29d4('0x45')](handleError(_0x442212,null));};exports['show']=function(_0x3c5655,_0x6f7889){var _0x44db67={'raw':!![],'where':{'id':_0x3c5655['params']['id']}},_0x297e5e={};_0x297e5e[_0x29d4('0x2f')]=_[_0x29d4('0x31')](db['VoiceQueuesLog'][_0x29d4('0x2b')]);_0x297e5e[_0x29d4('0x30')]=_['keys'](_0x3c5655[_0x29d4('0x30')]);_0x297e5e[_0x29d4('0x32')]=_['intersection'](_0x297e5e[_0x29d4('0x2f')],_0x297e5e['query']);_0x44db67[_0x29d4('0x34')]=_[_0x29d4('0x33')](_0x297e5e[_0x29d4('0x2f')],qs[_0x29d4('0x35')](_0x3c5655[_0x29d4('0x30')][_0x29d4('0x35')]));_0x44db67[_0x29d4('0x34')]=_0x44db67[_0x29d4('0x34')][_0x29d4('0x36')]?_0x44db67[_0x29d4('0x34')]:_0x297e5e[_0x29d4('0x2f')];if(_0x3c5655[_0x29d4('0x30')][_0x29d4('0x41')]){_0x44db67[_0x29d4('0x42')]=[{'all':!![]}];}_0x44db67=_['merge']({},_0x44db67,_0x3c5655['options']);return db[_0x29d4('0x2a')]['find'](_0x44db67)['then'](handleEntityNotFound(_0x6f7889,null))[_0x29d4('0x23')](respondWithResult(_0x6f7889,null))[_0x29d4('0x45')](handleError(_0x6f7889,null));};exports[_0x29d4('0x46')]=function(_0x5546f7,_0x22611c){return db[_0x29d4('0x2a')][_0x29d4('0x46')](_0x5546f7[_0x29d4('0x47')],{})[_0x29d4('0x23')](respondWithResult(_0x22611c,0xc9))[_0x29d4('0x45')](handleError(_0x22611c,null));};exports['update']=function(_0x14d272,_0x4393aa){if(_0x14d272[_0x29d4('0x47')]['id']){delete _0x14d272[_0x29d4('0x47')]['id'];}return db[_0x29d4('0x2a')][_0x29d4('0x48')]({'where':{'id':_0x14d272['params']['id']}})[_0x29d4('0x23')](handleEntityNotFound(_0x4393aa,null))[_0x29d4('0x23')](saveUpdates(_0x14d272['body'],null))[_0x29d4('0x23')](respondWithResult(_0x4393aa,null))['catch'](handleError(_0x4393aa,null));};exports[_0x29d4('0x24')]=function(_0x1623fb,_0x4cee66){return db[_0x29d4('0x2a')][_0x29d4('0x48')]({'where':{'id':_0x1623fb[_0x29d4('0x49')]['id']}})['then'](handleEntityNotFound(_0x4cee66,null))[_0x29d4('0x23')](removeEntity(_0x4cee66,null))[_0x29d4('0x45')](handleError(_0x4cee66,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 5a302e6..b584421 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 _0xca20=['rimraf','../../config/environment','exports','define','VoiceQueuesLog','voice_queues_log','event','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0xca20,0x1a7));var _0x0ca2=function(_0x2b9b7f,_0x4d47df){_0x2b9b7f=_0x2b9b7f-0x0;var _0x4ed19a=_0xca20[_0x2b9b7f];return _0x4ed19a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x0ca2('0x0'))(_0x0ca2('0x1'));var moment=require(_0x0ca2('0x2'));var BPromise=require(_0x0ca2('0x3'));var rp=require(_0x0ca2('0x4'));var fs=require('fs');var path=require(_0x0ca2('0x5'));var rimraf=require(_0x0ca2('0x6'));var config=require(_0x0ca2('0x7'));var attributes=require('./voiceQueuesLog.attributes');module[_0x0ca2('0x8')]=function(_0xb6e2b6,_0x33f609){return _0xb6e2b6[_0x0ca2('0x9')](_0x0ca2('0xa'),attributes,{'tableName':_0x0ca2('0xb'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x0ca2('0xc'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0xc087=['rimraf','../../config/environment','voice_queues_log','event','dtm','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x7f1ac3,_0x4085fa){var _0x40d1d4=function(_0x5575dc){while(--_0x5575dc){_0x7f1ac3['push'](_0x7f1ac3['shift']());}};_0x40d1d4(++_0x4085fa);}(_0xc087,0xe1));var _0x7c08=function(_0x407bd8,_0x277add){_0x407bd8=_0x407bd8-0x0;var _0x20b6c9=_0xc087[_0x407bd8];return _0x20b6c9;};'use strict';var _=require('lodash');var util=require(_0x7c08('0x0'));var logger=require(_0x7c08('0x1'))(_0x7c08('0x2'));var moment=require(_0x7c08('0x3'));var BPromise=require(_0x7c08('0x4'));var rp=require(_0x7c08('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7c08('0x6'));var config=require(_0x7c08('0x7'));var attributes=require('./voiceQueuesLog.attributes');module['exports']=function(_0x2205e5,_0x1f6568){return _0x2205e5['define']('VoiceQueuesLog',attributes,{'tableName':_0x7c08('0x8'),'paranoid':![],'indexes':[{'name':'event_dtm','fields':[_0x7c08('0x9'),_0x7c08('0xa')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index ba146df..5a024b7 100644 --- a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js +++ b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa699=['request','then','info','VoiceQueuesLog,\x20%s,\x20%s','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3382f5,_0x14183e){var _0x2e5007=function(_0x459f58){while(--_0x459f58){_0x3382f5['push'](_0x3382f5['shift']());}};_0x2e5007(++_0x14183e);}(_0xa699,0x6b));var _0x9a69=function(_0x2fa1c6,_0x4a5b8d){_0x2fa1c6=_0x2fa1c6-0x0;var _0x5f3257=_0xa699[_0x2fa1c6];return _0x5f3257;};'use strict';var _=require(_0x9a69('0x0'));var util=require(_0x9a69('0x1'));var moment=require(_0x9a69('0x2'));var BPromise=require(_0x9a69('0x3'));var rs=require(_0x9a69('0x4'));var fs=require('fs');var Redis=require(_0x9a69('0x5'));var db=require(_0x9a69('0x6'))['db'];var utils=require(_0x9a69('0x7'));var logger=require(_0x9a69('0x8'))(_0x9a69('0x9'));var config=require(_0x9a69('0xa'));var jayson=require(_0x9a69('0xb'));var client=jayson[_0x9a69('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x26b842,_0x3f9bce,_0x3bb021){return new BPromise(function(_0x4665a9,_0x5031b0){return client[_0x9a69('0xd')](_0x26b842,_0x3bb021)[_0x9a69('0xe')](function(_0x3fb953){logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,'request\x20sent');logger['debug'](_0x9a69('0x11'),_0x3f9bce,'request\x20sent',JSON[_0x9a69('0x12')](_0x3fb953));if(_0x3fb953[_0x9a69('0x13')]){if(_0x3fb953['error'][_0x9a69('0x14')]===0x1f4){logger[_0x9a69('0x13')]('VoiceQueuesLog,\x20%s,\x20%s',_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x5031b0(_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);}logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x3fb953[_0x9a69('0x13')][_0x9a69('0x15')]);return _0x4665a9(_0x3fb953[_0x9a69('0x13')]['message']);}else{logger[_0x9a69('0xf')](_0x9a69('0x10'),_0x3f9bce,_0x9a69('0x16'));_0x4665a9(_0x3fb953['result'][_0x9a69('0x15')]);}})[_0x9a69('0x17')](function(_0x380e46){logger[_0x9a69('0x13')](_0x9a69('0x10'),_0x3f9bce,_0x380e46);_0x5031b0(_0x380e46);});});} \ No newline at end of file +var _0x42f4=['jayson/promise','http','then','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceQueuesLog,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment'];(function(_0x5e10ce,_0x102392){var _0x3ca8bf=function(_0x12414c){while(--_0x12414c){_0x5e10ce['push'](_0x5e10ce['shift']());}};_0x3ca8bf(++_0x102392);}(_0x42f4,0x19d));var _0x442f=function(_0x1e3671,_0x9ae4fc){_0x1e3671=_0x1e3671-0x0;var _0x48d5f5=_0x42f4[_0x1e3671];return _0x48d5f5;};'use strict';var _=require(_0x442f('0x0'));var util=require('util');var moment=require(_0x442f('0x1'));var BPromise=require(_0x442f('0x2'));var rs=require(_0x442f('0x3'));var fs=require('fs');var Redis=require(_0x442f('0x4'));var db=require(_0x442f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x442f('0x6'));var jayson=require(_0x442f('0x7'));var client=jayson['client'][_0x442f('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11b450,_0x23c5ba,_0x37dfe7){return new BPromise(function(_0x6c0b4b,_0x476480){return client['request'](_0x11b450,_0x37dfe7)[_0x442f('0x9')](function(_0x4e32af){logger['info']('VoiceQueuesLog,\x20%s,\x20%s',_0x23c5ba,_0x442f('0xa'));logger[_0x442f('0xb')](_0x442f('0xc'),_0x23c5ba,_0x442f('0xa'),JSON[_0x442f('0xd')](_0x4e32af));if(_0x4e32af[_0x442f('0xe')]){if(_0x4e32af[_0x442f('0xe')][_0x442f('0xf')]===0x1f4){logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af['error'][_0x442f('0x11')]);return _0x476480(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}logger[_0x442f('0xe')](_0x442f('0x10'),_0x23c5ba,_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);return _0x6c0b4b(_0x4e32af[_0x442f('0xe')][_0x442f('0x11')]);}else{logger[_0x442f('0x12')](_0x442f('0x10'),_0x23c5ba,_0x442f('0xa'));_0x6c0b4b(_0x4e32af[_0x442f('0x13')][_0x442f('0x11')]);}})[_0x442f('0x14')](function(_0x3ff2b1){logger['error'](_0x442f('0x10'),_0x23c5ba,_0x3ff2b1);_0x476480(_0x3ff2b1);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index e0900c2..6e5b7e8 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 _0x0f1f=['show','/:id/download','download','/:id/downloads','downloads','create','put','destroy','util','path','connect-timeout','express','../../components/interaction/service','../../config/environment','./voiceRecording.controller','isAuthenticated','/describe','get','/:id'];(function(_0x2a5099,_0x329e92){var _0x2802f1=function(_0x53f99b){while(--_0x53f99b){_0x2a5099['push'](_0x2a5099['shift']());}};_0x2802f1(++_0x329e92);}(_0x0f1f,0xd9));var _0xf0f1=function(_0x3cdf50,_0x3e8eb2){_0x3cdf50=_0x3cdf50-0x0;var _0x22d47a=_0x0f1f[_0x3cdf50];return _0x22d47a;};'use strict';var multer=require('multer');var util=require(_0xf0f1('0x0'));var path=require(_0xf0f1('0x1'));var timeout=require(_0xf0f1('0x2'));var express=require(_0xf0f1('0x3'));var router=express['Router']();var auth=require('../../components/auth/service');var interaction=require(_0xf0f1('0x4'));var config=require(_0xf0f1('0x5'));var controller=require(_0xf0f1('0x6'));router['get']('/',auth[_0xf0f1('0x7')](),controller['index']);router['get'](_0xf0f1('0x8'),auth['isAuthenticated'](),controller['describe']);router[_0xf0f1('0x9')](_0xf0f1('0xa'),auth['isAuthenticated'](),controller[_0xf0f1('0xb')]);router['get'](_0xf0f1('0xc'),auth[_0xf0f1('0x7')](),controller[_0xf0f1('0xd')]);router['get'](_0xf0f1('0xe'),controller[_0xf0f1('0xf')]);router['post']('/',auth[_0xf0f1('0x7')](),controller[_0xf0f1('0x10')]);router[_0xf0f1('0x11')]('/:id',auth[_0xf0f1('0x7')](),controller['update']);router['delete'](_0xf0f1('0xa'),auth[_0xf0f1('0x7')](),controller[_0xf0f1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x1913=['delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./voiceRecording.controller','index','get','/describe','isAuthenticated','describe','/:id','show','download','downloads','create','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1913,0x66));var _0x3191=function(_0x24b801,_0x3aeb72){_0x24b801=_0x24b801-0x0;var _0x4e7855=_0x1913[_0x24b801];return _0x4e7855;};'use strict';var multer=require(_0x3191('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3191('0x1'));var express=require(_0x3191('0x2'));var router=express[_0x3191('0x3')]();var auth=require(_0x3191('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x3191('0x5'));var controller=require(_0x3191('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x3191('0x7')]);router[_0x3191('0x8')](_0x3191('0x9'),auth[_0x3191('0xa')](),controller[_0x3191('0xb')]);router[_0x3191('0x8')](_0x3191('0xc'),auth[_0x3191('0xa')](),controller[_0x3191('0xd')]);router[_0x3191('0x8')]('/:id/download',auth[_0x3191('0xa')](),controller[_0x3191('0xe')]);router[_0x3191('0x8')]('/:id/downloads',controller[_0x3191('0xf')]);router['post']('/',auth[_0x3191('0xa')](),controller[_0x3191('0x10')]);router['put']('/:id',auth[_0x3191('0xa')](),controller[_0x3191('0x11')]);router[_0x3191('0x12')](_0x3191('0xc'),auth[_0x3191('0xa')](),controller[_0x3191('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 38406de..0544145 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 _0xf12f=['createdAt','DATE','updatedAt','toString','moment','path','getDataValue','value','extname','STRING','setDataValue','channel','membername','split'];(function(_0x178f52,_0x5d9675){var _0x556f99=function(_0x4a7b17){while(--_0x4a7b17){_0x178f52['push'](_0x178f52['shift']());}};_0x556f99(++_0x5d9675);}(_0xf12f,0x11c));var _0xff12=function(_0x18b306,_0x34065a){_0x18b306=_0x18b306-0x0;var _0x5818dd=_0xf12f[_0x18b306];return _0x5818dd;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xff12('0x0'));var path=require(_0xff12('0x1'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0xff12('0x2')](_0xff12('0x3'))?path[_0xff12('0x4')](this[_0xff12('0x2')](_0xff12('0x3'))):undefined;}},'uniqueid':{'type':Sequelize[_0xff12('0x5')]},'channel':{'type':Sequelize[_0xff12('0x5')],'set':function(_0x504fd5){if(_0x504fd5){this[_0xff12('0x6')](_0xff12('0x7'),_0x504fd5);this[_0xff12('0x6')](_0xff12('0x8'),_0x504fd5[_0xff12('0x9')](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0xff12('0x5')]},'calleridnum':{'type':Sequelize[_0xff12('0x5')]},'calleridname':{'type':Sequelize[_0xff12('0x5')]},'connectedlinenum':{'type':Sequelize[_0xff12('0x5')]},'connectedlinename':{'type':Sequelize[_0xff12('0x5')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xff12('0x5')]},'exten':{'type':Sequelize[_0xff12('0x5')]},'value':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xff12('0x5')]},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0xff12('0x5')]},'userDisposition':{'type':Sequelize[_0xff12('0x5')]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0xff12('0x2')](_0xff12('0xa')))['format']('MM-DD-YYYY\x20HH:mm')['toString']();}},'updatedAt':{'type':Sequelize[_0xff12('0xb')],'get':function(){return moment(this[_0xff12('0x2')](_0xff12('0xc')))['format']('MM-DD-YYYY\x20HH:mm')[_0xff12('0xd')]();}}}; \ No newline at end of file +var _0x2560=['STRING','setDataValue','channel','membername','INTEGER','DATE','format','MM-DD-YYYY\x20HH:mm','toString','updatedAt','sequelize','moment','path','exports','VIRTUAL','getDataValue','value','extname'];(function(_0x247502,_0x33d44a){var _0xe6e7d6=function(_0x453341){while(--_0x453341){_0x247502['push'](_0x247502['shift']());}};_0xe6e7d6(++_0x33d44a);}(_0x2560,0x9a));var _0x0256=function(_0x4d9dee,_0x477058){_0x4d9dee=_0x4d9dee-0x0;var _0x1e209c=_0x2560[_0x4d9dee];return _0x1e209c;};'use strict';var Sequelize=require(_0x0256('0x0'));var moment=require(_0x0256('0x1'));var path=require(_0x0256('0x2'));module[_0x0256('0x3')]={'format':{'type':Sequelize[_0x0256('0x4')],'get':function(){return this[_0x0256('0x5')](_0x0256('0x6'))?path[_0x0256('0x7')](this[_0x0256('0x5')](_0x0256('0x6'))):undefined;}},'uniqueid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x0256('0x8')],'set':function(_0x234793){if(_0x234793){this[_0x0256('0x9')](_0x0256('0xa'),_0x234793);this['setDataValue'](_0x0256('0xb'),_0x234793['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0256('0x8')]},'calleridnum':{'type':Sequelize[_0x0256('0x8')]},'calleridname':{'type':Sequelize[_0x0256('0x8')]},'connectedlinenum':{'type':Sequelize[_0x0256('0x8')]},'connectedlinename':{'type':Sequelize[_0x0256('0x8')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x0256('0x8')]},'exten':{'type':Sequelize[_0x0256('0x8')]},'value':{'type':Sequelize[_0x0256('0x8')]},'type':{'type':Sequelize[_0x0256('0x8')]},'rating':{'type':Sequelize[_0x0256('0xc')],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize[_0x0256('0x8')]},'userDisposition':{'type':Sequelize[_0x0256('0x8')]},'createdAt':{'type':Sequelize[_0x0256('0xd')],'get':function(){return moment(this['getDataValue']('createdAt'))[_0x0256('0xe')](_0x0256('0xf'))[_0x0256('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0256('0x5')](_0x0256('0x11')))[_0x0256('0xe')](_0x0256('0xf'))[_0x0256('0x10')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index a376510..926176d 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 _0xc984=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','end','json','count','offset','limit','status','apply','save','update','then','destroy','sendStatus','error','name','send','map','VoiceRecording','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','hasOwnProperty','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','existsSync','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','VoiceRecording\x20not\x20found','Not\x20found','downloads','sequelize','MD5','col','token','$and','push','decryptFile','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','html-pdf','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xc984,0xc1));var _0x4c98=function(_0x47aa1c,_0x6d799){_0x47aa1c=_0x47aa1c-0x0;var _0x5ef98a=_0xc984[_0x47aa1c];return _0x5ef98a;};'use strict';var pdf=require(_0x4c98('0x0'));var emlformat=require(_0x4c98('0x1'));var rimraf=require(_0x4c98('0x2'));var zipdir=require(_0x4c98('0x3'));var jsonpatch=require(_0x4c98('0x4'));var rp=require(_0x4c98('0x5'));var moment=require(_0x4c98('0x6'));var BPromise=require(_0x4c98('0x7'));var Mustache=require(_0x4c98('0x8'));var util=require(_0x4c98('0x9'));var path=require(_0x4c98('0xa'));var sox=require(_0x4c98('0xb'));var csv=require('to-csv');var ejs=require(_0x4c98('0xc'));var fs=require('fs');var _=require(_0x4c98('0xd'));var squel=require(_0x4c98('0xe'));var crypto=require(_0x4c98('0xf'));var jsforce=require(_0x4c98('0x10'));var deskjs=require(_0x4c98('0x11'));var toCsv=require('to-csv');var querystring=require(_0x4c98('0x12'));var Papa=require('papaparse');var Redis=require(_0x4c98('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x4c98('0x14'));var as=require(_0x4c98('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4c98('0x16'))(_0x4c98('0x17'));var utils=require(_0x4c98('0x18'));var config=require('../../config/environment');var db=require(_0x4c98('0x19'))['db'];function respondWithStatusCode(_0x226637,_0x2fbba5){_0x2fbba5=_0x2fbba5||0xcc;return function(_0x28490e){if(_0x28490e){return _0x226637['sendStatus'](_0x2fbba5);}return _0x226637['status'](_0x2fbba5)[_0x4c98('0x1a')]();};}function respondWithResult(_0x22be59,_0x39b109){_0x39b109=_0x39b109||0xc8;return function(_0x3ba5d4){if(_0x3ba5d4){return _0x22be59['status'](_0x39b109)[_0x4c98('0x1b')](_0x3ba5d4);}};}function respondWithFilteredResult(_0x5b2b40,_0x71f813){return function(_0x175258){if(_0x175258){var _0x280c65=_0x175258[_0x4c98('0x1c')],_0x43b064=_0x71f813[_0x4c98('0x1d')],_0x2900e0=_0x71f813[_0x4c98('0x1d')]+_0x71f813[_0x4c98('0x1e')],_0x5ed9c8;if(_0x2900e0>=_0x280c65){_0x2900e0=_0x280c65;_0x5ed9c8=0xc8;}else{_0x5ed9c8=0xce;}_0x5b2b40[_0x4c98('0x1f')](_0x5ed9c8);return _0x5b2b40['set']('Content-Range',_0x43b064+'-'+_0x2900e0+'/'+_0x280c65)[_0x4c98('0x1b')](_0x175258);}return null;};}function patchUpdates(_0xb971aa){return function(_0x45ee77){try{jsonpatch[_0x4c98('0x20')](_0x45ee77,_0xb971aa,!![]);}catch(_0x437d03){return BPromise['reject'](_0x437d03);}return _0x45ee77[_0x4c98('0x21')]();};}function saveUpdates(_0x4573de,_0x43e400){return function(_0x102cfb){if(_0x102cfb){return _0x102cfb[_0x4c98('0x22')](_0x4573de)[_0x4c98('0x23')](function(_0x1c2920){return _0x1c2920;});}return null;};}function removeEntity(_0x442b9b,_0x28371d){return function(_0x3a9129){if(_0x3a9129){return _0x3a9129[_0x4c98('0x24')]()[_0x4c98('0x23')](function(){_0x442b9b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cfc29,_0x2ce32b){return function(_0x1149a7){if(!_0x1149a7){_0x1cfc29[_0x4c98('0x25')](0x194);}return _0x1149a7;};}function handleError(_0x58e89c,_0x1957c1){_0x1957c1=_0x1957c1||0x1f4;return function(_0x5508b1){logger[_0x4c98('0x26')](_0x5508b1['stack']);if(_0x5508b1[_0x4c98('0x27')]){delete _0x5508b1[_0x4c98('0x27')];}_0x58e89c[_0x4c98('0x1f')](_0x1957c1)[_0x4c98('0x28')](_0x5508b1);};}exports['index']=function(_0x550ac1,_0x446c2f){var _0x411517={},_0x36b04d={},_0x6591bf={'count':0x0,'rows':[]};var _0x176186=_[_0x4c98('0x29')](db[_0x4c98('0x2a')][_0x4c98('0x2b')],function(_0x1b0382){return{'name':_0x1b0382[_0x4c98('0x2c')],'type':_0x1b0382[_0x4c98('0x2d')][_0x4c98('0x2e')]};});_0x36b04d[_0x4c98('0x2f')]=_[_0x4c98('0x30')](_[_0x4c98('0x29')](_0x176186,_0x4c98('0x27')),['format']);_0x36b04d[_0x4c98('0x31')]=_[_0x4c98('0x32')](_0x550ac1[_0x4c98('0x31')]);_0x36b04d[_0x4c98('0x33')]=_[_0x4c98('0x34')](_0x36b04d['model'],_0x36b04d[_0x4c98('0x31')]);_0x411517[_0x4c98('0x35')]=_[_0x4c98('0x34')](_0x36b04d['model'],qs[_0x4c98('0x36')](_0x550ac1[_0x4c98('0x31')]['fields']));_0x411517[_0x4c98('0x35')]=_0x411517[_0x4c98('0x35')]['length']?_0x411517[_0x4c98('0x35')]:_0x36b04d[_0x4c98('0x2f')];if(!_0x550ac1[_0x4c98('0x31')][_0x4c98('0x37')]('nolimit')){_0x411517['limit']=qs[_0x4c98('0x1e')](_0x550ac1[_0x4c98('0x31')]['limit']);_0x411517[_0x4c98('0x1d')]=qs['offset'](_0x550ac1[_0x4c98('0x31')][_0x4c98('0x1d')]);}_0x411517['order']=qs['sort'](_0x550ac1[_0x4c98('0x31')][_0x4c98('0x38')]);_0x411517[_0x4c98('0x39')]=qs[_0x4c98('0x33')](_[_0x4c98('0x3a')](_0x550ac1[_0x4c98('0x31')],_0x36b04d[_0x4c98('0x33')]));if(_0x550ac1[_0x4c98('0x31')][_0x4c98('0x3b')]){_0x411517[_0x4c98('0x39')]=_['merge'](_0x411517['where'],{'$or':_['map'](_0x176186,function(_0x4aaa5d){if(_0x4aaa5d['type']!==_0x4c98('0x3c')){var _0x2e2658={};_0x2e2658[_0x4aaa5d['name']]={'$like':'%'+_0x550ac1['query'][_0x4c98('0x3b')]+'%'};return _0x2e2658;}})});}_0x411517=_[_0x4c98('0x3d')]({},_0x411517,_0x550ac1['options']);var _0x45ebf2={'where':_0x411517['where']};return db[_0x4c98('0x2a')][_0x4c98('0x1c')](_0x45ebf2)[_0x4c98('0x23')](function(_0x42b7c8){_0x6591bf[_0x4c98('0x1c')]=_0x42b7c8;if(_0x550ac1[_0x4c98('0x31')][_0x4c98('0x3e')]){_0x411517[_0x4c98('0x3f')]=[{'all':!![]}];}return db[_0x4c98('0x2a')][_0x4c98('0x40')](_0x411517);})[_0x4c98('0x23')](function(_0x552cd2){_0x6591bf[_0x4c98('0x41')]=_0x552cd2;return _0x6591bf;})[_0x4c98('0x23')](respondWithFilteredResult(_0x446c2f,_0x411517))[_0x4c98('0x42')](handleError(_0x446c2f,null));};exports[_0x4c98('0x43')]=function(_0x4f875d,_0x30fe4){var _0x6fcc14={'raw':![],'where':{'id':_0x4f875d[_0x4c98('0x44')]['id']}},_0x228eaf={};_0x228eaf[_0x4c98('0x2f')]=_[_0x4c98('0x32')](db['VoiceRecording'][_0x4c98('0x2b')]);_0x228eaf[_0x4c98('0x31')]=_[_0x4c98('0x32')](_0x4f875d[_0x4c98('0x31')]);_0x228eaf[_0x4c98('0x33')]=_['intersection'](_0x228eaf[_0x4c98('0x2f')],_0x228eaf['query']);_0x6fcc14[_0x4c98('0x35')]=_[_0x4c98('0x34')](_0x228eaf['model'],qs[_0x4c98('0x36')](_0x4f875d[_0x4c98('0x31')][_0x4c98('0x36')]));_0x6fcc14[_0x4c98('0x35')]=_0x6fcc14[_0x4c98('0x35')][_0x4c98('0x45')]?_0x6fcc14[_0x4c98('0x35')]:_0x228eaf[_0x4c98('0x2f')];if(_0x4f875d[_0x4c98('0x31')][_0x4c98('0x3e')]){_0x6fcc14[_0x4c98('0x3f')]=[{'all':!![]}];}_0x6fcc14=_['merge']({},_0x6fcc14,_0x4f875d[_0x4c98('0x46')]);return db[_0x4c98('0x2a')][_0x4c98('0x47')](_0x6fcc14)[_0x4c98('0x23')](handleEntityNotFound(_0x30fe4,null))[_0x4c98('0x23')](respondWithResult(_0x30fe4,null))[_0x4c98('0x42')](handleError(_0x30fe4,null));};exports[_0x4c98('0x48')]=function(_0x16aeb7,_0x6f05d8){return db[_0x4c98('0x2a')][_0x4c98('0x48')](_0x16aeb7[_0x4c98('0x49')],{})[_0x4c98('0x23')](respondWithResult(_0x6f05d8,0xc9))[_0x4c98('0x42')](handleError(_0x6f05d8,null));};exports[_0x4c98('0x22')]=function(_0x43019e,_0x1438f7){if(_0x43019e['body']['id']){delete _0x43019e[_0x4c98('0x49')]['id'];}return db[_0x4c98('0x2a')]['find']({'where':{'id':_0x43019e[_0x4c98('0x44')]['id']}})[_0x4c98('0x23')](handleEntityNotFound(_0x1438f7,null))['then'](saveUpdates(_0x43019e[_0x4c98('0x49')],null))[_0x4c98('0x23')](respondWithResult(_0x1438f7,null))[_0x4c98('0x42')](handleError(_0x1438f7,null));};exports[_0x4c98('0x4a')]=function(_0x5aa25a,_0x202246){return db[_0x4c98('0x2a')][_0x4c98('0x4a')]()[_0x4c98('0x23')](respondWithResult(_0x202246,null))[_0x4c98('0x42')](handleError(_0x202246,null));};exports[_0x4c98('0x4b')]=function(_0x4338fd,_0xbd3d54,_0x5354ae){var _0x480289=require(_0x4c98('0x4c'));var _0x1201e9=![];var _0x2d54f0={};if(_0x4338fd['query'][_0x4c98('0x2d')]&&_0x4338fd[_0x4c98('0x31')]['type']===_0x4c98('0x4d')){_0x2d54f0[_0x4c98('0x4d')]=_0x4338fd[_0x4c98('0x44')]['id'];}else{_0x2d54f0['id']=_0x4338fd[_0x4c98('0x44')]['id'];}return db[_0x4c98('0x2a')][_0x4c98('0x47')]({'where':_0x2d54f0,'attributes':['id','value'],'raw':!![]})[_0x4c98('0x23')](handleEntityNotFound(_0xbd3d54,null))[_0x4c98('0x23')](function(_0x5f06da){if(_0x5f06da){var _0xae34cd=_0x5f06da[_0x4c98('0x4e')];var _0x5773e0=util['format'](_0x4c98('0x4f'),_0xae34cd);if(fs[_0x4c98('0x50')](_0x5773e0)){_0x1201e9=!![];return _0x480289['decryptFile'](_0x5773e0,_0xae34cd,config[_0x4c98('0x51')][_0x4c98('0x52')])['then'](function(){return _0x5f06da;});}return _0x5f06da;}})['then'](function(_0x3a5602){if(_0x3a5602){var _0x358332=_0x3a5602['value'];if(!fs['existsSync'](_0x358332)){throw new db[(_0x4c98('0x53'))][(_0x4c98('0x54'))]('VoiceRecording\x20not\x20found');}if(_0x3a5602[_0x4c98('0x55')]){return _0xbd3d54['download'](_0x358332,_0x3a5602[_0x4c98('0x55')]+path[_0x4c98('0x56')](_0x358332),function(){if(_0x1201e9){fs[_0x4c98('0x57')](_0x358332);}});}else{return _0xbd3d54[_0x4c98('0x4b')](_0x358332,function(_0x58463f){if(_0x1201e9){fs[_0x4c98('0x57')](_0x358332);}});}}})[_0x4c98('0x42')](function(_0x3c91f8){if(_0x3c91f8[_0x4c98('0x58')]===_0x4c98('0x59')){_0xbd3d54['status'](0x194)['send'](_0x4c98('0x5a'));}else{return handleError(_0xbd3d54,null);}});};exports[_0x4c98('0x5b')]=function(_0x1e9432,_0x35ab6f,_0x5286bc){var _0x48d26a=require(_0x4c98('0x4c'));var _0x49fa4a=![];var _0x13c35d={'$and':[db[_0x4c98('0x5c')][_0x4c98('0x39')](db[_0x4c98('0x5c')]['fn'](_0x4c98('0x5d'),db[_0x4c98('0x5c')][_0x4c98('0x5e')](_0x4c98('0x4d'))),_0x1e9432[_0x4c98('0x31')][_0x4c98('0x5f')])]};if(_0x1e9432[_0x4c98('0x31')][_0x4c98('0x2d')]&&_0x1e9432[_0x4c98('0x31')]['type']==='uniqueid'){_0x13c35d[_0x4c98('0x60')][_0x4c98('0x61')]({'uniqueid':_0x1e9432[_0x4c98('0x44')]['id']});}else{_0x13c35d[_0x4c98('0x60')][_0x4c98('0x61')]({'id':_0x1e9432['params']['id']});}return db[_0x4c98('0x2a')][_0x4c98('0x47')]({'where':_0x13c35d,'attributes':['id',_0x4c98('0x4e')],'raw':!![]})[_0x4c98('0x23')](handleEntityNotFound(_0x35ab6f,null))[_0x4c98('0x23')](function(_0x68eaae){if(_0x68eaae){var _0x52cef7=util['format'](_0x4c98('0x4f'),_0x68eaae[_0x4c98('0x4e')]);if(fs[_0x4c98('0x50')](_0x52cef7)){_0x49fa4a=!![];return _0x48d26a[_0x4c98('0x62')](_0x52cef7,_0x68eaae[_0x4c98('0x4e')],config['secrets']['recording'])[_0x4c98('0x23')](function(){return _0x68eaae;});}return _0x68eaae;}})[_0x4c98('0x23')](function(_0xa50034){if(_0xa50034){if(!fs[_0x4c98('0x50')](_0xa50034[_0x4c98('0x4e')])){throw new db['Sequelize']['ValidationError']('VoiceRecording\x20not\x20found');}if(_0xa50034[_0x4c98('0x55')]){return _0x35ab6f['download'](_0xa50034['value'],_0xa50034[_0x4c98('0x55')]+path[_0x4c98('0x56')](_0xa50034[_0x4c98('0x4e')]),function(){if(_0x49fa4a){fs[_0x4c98('0x57')](_0xa50034['value']);}});}else{return _0x35ab6f[_0x4c98('0x4b')](_0xa50034['value'],function(_0x420787){if(_0x49fa4a){fs[_0x4c98('0x57')](_0xa50034[_0x4c98('0x4e')]);}});}}})[_0x4c98('0x42')](handleError(_0x35ab6f,null));};exports[_0x4c98('0x24')]=function(_0x52d072,_0x3e955d){return db[_0x4c98('0x2a')][_0x4c98('0x47')]({'where':{'id':_0x52d072[_0x4c98('0x44')]['id']}})[_0x4c98('0x23')](function(_0x55a6e5){if(!_0x55a6e5)throw new ReferenceError(_0x4c98('0x63'));return _0x55a6e5;})[_0x4c98('0x23')](function(_0xe3788d){var _0x35cf56=_0xe3788d[_0x4c98('0x4e')];logger['info'](_0x4c98('0x64'),_0x35cf56);if(!_[_0x4c98('0x65')](_0xe3788d[_0x4c98('0x4e')])&&fs[_0x4c98('0x50')](_0x35cf56)){logger[_0x4c98('0x66')](_0x4c98('0x67')+_0x35cf56+_0x4c98('0x68'));fs[_0x4c98('0x69')](_0x35cf56);}_0x35cf56=_0x35cf56+_0x4c98('0x6a');if(!_[_0x4c98('0x65')](_0xe3788d['value'])&&fs[_0x4c98('0x50')](_0x35cf56)){logger[_0x4c98('0x66')](_0x4c98('0x67')+_0x35cf56+_0x4c98('0x68'));fs[_0x4c98('0x69')](_0x35cf56);}return _0xe3788d;})[_0x4c98('0x23')](function(_0x83d190){if(!_0x83d190)throw new InternalError();return _0x83d190[_0x4c98('0x24')]();})[_0x4c98('0x23')](function(){_0x3e955d[_0x4c98('0x1f')](0xcc)[_0x4c98('0x1a')]();})[_0x4c98('0x42')](handleError(_0x3e955d,null));}; \ No newline at end of file +var _0xc893=['nolimit','sort','where','filters','pick','filter','merge','type','options','VoiceRecording','then','includeAll','include','findAll','rows','catch','params','find','create','body','describe','download','uniqueid','value','%s.cypher','decryptFile','secrets','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','extname','unlink','Not\x20found','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording','filename','info','cancellazione\x20fisica\x20documento\x20%s','unlinkSync','.cypher','isNil','File:\x20\x22','html-pdf','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','count','offset','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xc893,0x169));var _0x3c89=function(_0x51ae0c,_0x440983){_0x51ae0c=_0x51ae0c-0x0;var _0x47283f=_0xc893[_0x51ae0c];return _0x47283f;};'use strict';var pdf=require(_0x3c89('0x0'));var emlformat=require(_0x3c89('0x1'));var rimraf=require(_0x3c89('0x2'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3c89('0x3'));var rp=require(_0x3c89('0x4'));var moment=require(_0x3c89('0x5'));var BPromise=require(_0x3c89('0x6'));var Mustache=require(_0x3c89('0x7'));var util=require(_0x3c89('0x8'));var path=require('path');var sox=require(_0x3c89('0x9'));var csv=require(_0x3c89('0xa'));var ejs=require(_0x3c89('0xb'));var fs=require('fs');var _=require(_0x3c89('0xc'));var squel=require(_0x3c89('0xd'));var crypto=require(_0x3c89('0xe'));var jsforce=require(_0x3c89('0xf'));var deskjs=require(_0x3c89('0x10'));var toCsv=require(_0x3c89('0xa'));var querystring=require('querystring');var Papa=require(_0x3c89('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3c89('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x3c89('0x13'));var logger=require('../../config/logger')(_0x3c89('0x14'));var utils=require(_0x3c89('0x15'));var config=require(_0x3c89('0x16'));var db=require(_0x3c89('0x17'))['db'];function respondWithStatusCode(_0x8b44a7,_0xc4e80f){_0xc4e80f=_0xc4e80f||0xcc;return function(_0xff81fe){if(_0xff81fe){return _0x8b44a7[_0x3c89('0x18')](_0xc4e80f);}return _0x8b44a7[_0x3c89('0x19')](_0xc4e80f)[_0x3c89('0x1a')]();};}function respondWithResult(_0x420faa,_0x14d9e0){_0x14d9e0=_0x14d9e0||0xc8;return function(_0x46d308){if(_0x46d308){return _0x420faa[_0x3c89('0x19')](_0x14d9e0)[_0x3c89('0x1b')](_0x46d308);}};}function respondWithFilteredResult(_0x78cef5,_0x459089){return function(_0xd18adb){if(_0xd18adb){var _0x1e2813=_0xd18adb[_0x3c89('0x1c')],_0x3a899f=_0x459089[_0x3c89('0x1d')],_0x5ac9b8=_0x459089[_0x3c89('0x1d')]+_0x459089[_0x3c89('0x1e')],_0x21c411;if(_0x5ac9b8>=_0x1e2813){_0x5ac9b8=_0x1e2813;_0x21c411=0xc8;}else{_0x21c411=0xce;}_0x78cef5[_0x3c89('0x19')](_0x21c411);return _0x78cef5[_0x3c89('0x1f')](_0x3c89('0x20'),_0x3a899f+'-'+_0x5ac9b8+'/'+_0x1e2813)[_0x3c89('0x1b')](_0xd18adb);}return null;};}function patchUpdates(_0x5520a3){return function(_0x493910){try{jsonpatch[_0x3c89('0x21')](_0x493910,_0x5520a3,!![]);}catch(_0x4534a9){return BPromise[_0x3c89('0x22')](_0x4534a9);}return _0x493910['save']();};}function saveUpdates(_0x3934c3,_0x2a77cb){return function(_0x40c1fb){if(_0x40c1fb){return _0x40c1fb[_0x3c89('0x23')](_0x3934c3)['then'](function(_0x3721bb){return _0x3721bb;});}return null;};}function removeEntity(_0x48d6e8,_0x296315){return function(_0x31f508){if(_0x31f508){return _0x31f508[_0x3c89('0x24')]()['then'](function(){_0x48d6e8[_0x3c89('0x19')](0xcc)[_0x3c89('0x1a')]();});}};}function handleEntityNotFound(_0x3ad141,_0x311d96){return function(_0x4221aa){if(!_0x4221aa){_0x3ad141[_0x3c89('0x18')](0x194);}return _0x4221aa;};}function handleError(_0x558ad0,_0x4e0f7c){_0x4e0f7c=_0x4e0f7c||0x1f4;return function(_0x33a93f){logger['error'](_0x33a93f[_0x3c89('0x25')]);if(_0x33a93f['name']){delete _0x33a93f[_0x3c89('0x26')];}_0x558ad0[_0x3c89('0x19')](_0x4e0f7c)[_0x3c89('0x27')](_0x33a93f);};}exports[_0x3c89('0x28')]=function(_0xc1ed0f,_0x44a14e){var _0x2d32dd={},_0x50a171={},_0x320842={'count':0x0,'rows':[]};var _0x203b7d=_[_0x3c89('0x29')](db['VoiceRecording'][_0x3c89('0x2a')],function(_0x3f87ab){return{'name':_0x3f87ab[_0x3c89('0x2b')],'type':_0x3f87ab['type'][_0x3c89('0x2c')]};});_0x50a171[_0x3c89('0x2d')]=_[_0x3c89('0x2e')](_[_0x3c89('0x29')](_0x203b7d,_0x3c89('0x26')),[_0x3c89('0x2f')]);_0x50a171[_0x3c89('0x30')]=_[_0x3c89('0x31')](_0xc1ed0f[_0x3c89('0x30')]);_0x50a171['filters']=_[_0x3c89('0x32')](_0x50a171[_0x3c89('0x2d')],_0x50a171[_0x3c89('0x30')]);_0x2d32dd[_0x3c89('0x33')]=_[_0x3c89('0x32')](_0x50a171[_0x3c89('0x2d')],qs[_0x3c89('0x34')](_0xc1ed0f[_0x3c89('0x30')][_0x3c89('0x34')]));_0x2d32dd['attributes']=_0x2d32dd[_0x3c89('0x33')][_0x3c89('0x35')]?_0x2d32dd[_0x3c89('0x33')]:_0x50a171['model'];if(!_0xc1ed0f['query'][_0x3c89('0x36')](_0x3c89('0x37'))){_0x2d32dd[_0x3c89('0x1e')]=qs[_0x3c89('0x1e')](_0xc1ed0f[_0x3c89('0x30')][_0x3c89('0x1e')]);_0x2d32dd['offset']=qs[_0x3c89('0x1d')](_0xc1ed0f['query'][_0x3c89('0x1d')]);}_0x2d32dd['order']=qs[_0x3c89('0x38')](_0xc1ed0f[_0x3c89('0x30')][_0x3c89('0x38')]);_0x2d32dd[_0x3c89('0x39')]=qs[_0x3c89('0x3a')](_[_0x3c89('0x3b')](_0xc1ed0f['query'],_0x50a171['filters']));if(_0xc1ed0f['query'][_0x3c89('0x3c')]){_0x2d32dd['where']=_[_0x3c89('0x3d')](_0x2d32dd['where'],{'$or':_[_0x3c89('0x29')](_0x203b7d,function(_0x51bdf7){if(_0x51bdf7[_0x3c89('0x3e')]!=='VIRTUAL'){var _0x3ff082={};_0x3ff082[_0x51bdf7[_0x3c89('0x26')]]={'$like':'%'+_0xc1ed0f['query'][_0x3c89('0x3c')]+'%'};return _0x3ff082;}})});}_0x2d32dd=_[_0x3c89('0x3d')]({},_0x2d32dd,_0xc1ed0f[_0x3c89('0x3f')]);var _0x1ce435={'where':_0x2d32dd[_0x3c89('0x39')]};return db[_0x3c89('0x40')]['count'](_0x1ce435)[_0x3c89('0x41')](function(_0x3267a7){_0x320842[_0x3c89('0x1c')]=_0x3267a7;if(_0xc1ed0f[_0x3c89('0x30')][_0x3c89('0x42')]){_0x2d32dd[_0x3c89('0x43')]=[{'all':!![]}];}return db[_0x3c89('0x40')][_0x3c89('0x44')](_0x2d32dd);})[_0x3c89('0x41')](function(_0x19d824){_0x320842[_0x3c89('0x45')]=_0x19d824;return _0x320842;})[_0x3c89('0x41')](respondWithFilteredResult(_0x44a14e,_0x2d32dd))[_0x3c89('0x46')](handleError(_0x44a14e,null));};exports['show']=function(_0x52394a,_0x91e066){var _0x11a58f={'raw':![],'where':{'id':_0x52394a[_0x3c89('0x47')]['id']}},_0x1aa84f={};_0x1aa84f[_0x3c89('0x2d')]=_[_0x3c89('0x31')](db[_0x3c89('0x40')][_0x3c89('0x2a')]);_0x1aa84f[_0x3c89('0x30')]=_[_0x3c89('0x31')](_0x52394a[_0x3c89('0x30')]);_0x1aa84f['filters']=_[_0x3c89('0x32')](_0x1aa84f[_0x3c89('0x2d')],_0x1aa84f[_0x3c89('0x30')]);_0x11a58f[_0x3c89('0x33')]=_[_0x3c89('0x32')](_0x1aa84f['model'],qs[_0x3c89('0x34')](_0x52394a['query']['fields']));_0x11a58f['attributes']=_0x11a58f[_0x3c89('0x33')][_0x3c89('0x35')]?_0x11a58f[_0x3c89('0x33')]:_0x1aa84f[_0x3c89('0x2d')];if(_0x52394a['query']['includeAll']){_0x11a58f['include']=[{'all':!![]}];}_0x11a58f=_['merge']({},_0x11a58f,_0x52394a['options']);return db[_0x3c89('0x40')][_0x3c89('0x48')](_0x11a58f)[_0x3c89('0x41')](handleEntityNotFound(_0x91e066,null))[_0x3c89('0x41')](respondWithResult(_0x91e066,null))[_0x3c89('0x46')](handleError(_0x91e066,null));};exports[_0x3c89('0x49')]=function(_0x3cfd26,_0x1ffd32){return db['VoiceRecording'][_0x3c89('0x49')](_0x3cfd26[_0x3c89('0x4a')],{})[_0x3c89('0x41')](respondWithResult(_0x1ffd32,0xc9))[_0x3c89('0x46')](handleError(_0x1ffd32,null));};exports[_0x3c89('0x23')]=function(_0x512dd7,_0x1b93d7){if(_0x512dd7[_0x3c89('0x4a')]['id']){delete _0x512dd7[_0x3c89('0x4a')]['id'];}return db['VoiceRecording'][_0x3c89('0x48')]({'where':{'id':_0x512dd7[_0x3c89('0x47')]['id']}})[_0x3c89('0x41')](handleEntityNotFound(_0x1b93d7,null))[_0x3c89('0x41')](saveUpdates(_0x512dd7[_0x3c89('0x4a')],null))[_0x3c89('0x41')](respondWithResult(_0x1b93d7,null))['catch'](handleError(_0x1b93d7,null));};exports[_0x3c89('0x4b')]=function(_0x3904ab,_0x19ed2c){return db[_0x3c89('0x40')][_0x3c89('0x4b')]()[_0x3c89('0x41')](respondWithResult(_0x19ed2c,null))[_0x3c89('0x46')](handleError(_0x19ed2c,null));};exports[_0x3c89('0x4c')]=function(_0x503a29,_0x356c65,_0xb7d6c6){var _0x4713b9=require('../../components/encryptor');var _0x57a036=![];var _0x4b4d7a={};if(_0x503a29[_0x3c89('0x30')][_0x3c89('0x3e')]&&_0x503a29[_0x3c89('0x30')][_0x3c89('0x3e')]===_0x3c89('0x4d')){_0x4b4d7a[_0x3c89('0x4d')]=_0x503a29['params']['id'];}else{_0x4b4d7a['id']=_0x503a29[_0x3c89('0x47')]['id'];}return db[_0x3c89('0x40')]['find']({'where':_0x4b4d7a,'attributes':['id',_0x3c89('0x4e')],'raw':!![]})[_0x3c89('0x41')](handleEntityNotFound(_0x356c65,null))[_0x3c89('0x41')](function(_0x5bffde){if(_0x5bffde){var _0x3cc5b7=_0x5bffde[_0x3c89('0x4e')];var _0x163878=util[_0x3c89('0x2f')](_0x3c89('0x4f'),_0x3cc5b7);if(fs['existsSync'](_0x163878)){_0x57a036=!![];return _0x4713b9[_0x3c89('0x50')](_0x163878,_0x3cc5b7,config[_0x3c89('0x51')]['recording'])[_0x3c89('0x41')](function(){return _0x5bffde;});}return _0x5bffde;}})[_0x3c89('0x41')](function(_0x1021ef){if(_0x1021ef){var _0x31665e=_0x1021ef[_0x3c89('0x4e')];if(!fs[_0x3c89('0x52')](_0x31665e)){throw new db[(_0x3c89('0x53'))][(_0x3c89('0x54'))](_0x3c89('0x55'));}if(_0x1021ef['filename']){return _0x356c65[_0x3c89('0x4c')](_0x31665e,_0x1021ef['filename']+path[_0x3c89('0x56')](_0x31665e),function(){if(_0x57a036){fs[_0x3c89('0x57')](_0x31665e);}});}else{return _0x356c65[_0x3c89('0x4c')](_0x31665e,function(_0x4ba67c){if(_0x57a036){fs[_0x3c89('0x57')](_0x31665e);}});}}})[_0x3c89('0x46')](function(_0x330d00){if(_0x330d00['message']==='VoiceRecording\x20not\x20found'){_0x356c65['status'](0x194)[_0x3c89('0x27')](_0x3c89('0x58'));}else{return handleError(_0x356c65,null);}});};exports['downloads']=function(_0x2ae6d7,_0x4cd252,_0x5869a6){var _0x4fde4a=require(_0x3c89('0x59'));var _0xed8267=![];var _0x53a2b1={'$and':[db['sequelize'][_0x3c89('0x39')](db[_0x3c89('0x5a')]['fn'](_0x3c89('0x5b'),db[_0x3c89('0x5a')][_0x3c89('0x5c')](_0x3c89('0x4d'))),_0x2ae6d7[_0x3c89('0x30')][_0x3c89('0x5d')])]};if(_0x2ae6d7[_0x3c89('0x30')]['type']&&_0x2ae6d7['query'][_0x3c89('0x3e')]===_0x3c89('0x4d')){_0x53a2b1[_0x3c89('0x5e')]['push']({'uniqueid':_0x2ae6d7['params']['id']});}else{_0x53a2b1[_0x3c89('0x5e')][_0x3c89('0x5f')]({'id':_0x2ae6d7[_0x3c89('0x47')]['id']});}return db[_0x3c89('0x40')][_0x3c89('0x48')]({'where':_0x53a2b1,'attributes':['id',_0x3c89('0x4e')],'raw':!![]})[_0x3c89('0x41')](handleEntityNotFound(_0x4cd252,null))[_0x3c89('0x41')](function(_0x10483a){if(_0x10483a){var _0xe9d8ff=util['format']('%s.cypher',_0x10483a[_0x3c89('0x4e')]);if(fs[_0x3c89('0x52')](_0xe9d8ff)){_0xed8267=!![];return _0x4fde4a['decryptFile'](_0xe9d8ff,_0x10483a[_0x3c89('0x4e')],config[_0x3c89('0x51')][_0x3c89('0x60')])[_0x3c89('0x41')](function(){return _0x10483a;});}return _0x10483a;}})[_0x3c89('0x41')](function(_0x2f6506){if(_0x2f6506){if(!fs['existsSync'](_0x2f6506[_0x3c89('0x4e')])){throw new db[(_0x3c89('0x53'))][(_0x3c89('0x54'))](_0x3c89('0x55'));}if(_0x2f6506[_0x3c89('0x61')]){return _0x4cd252[_0x3c89('0x4c')](_0x2f6506[_0x3c89('0x4e')],_0x2f6506['filename']+path[_0x3c89('0x56')](_0x2f6506[_0x3c89('0x4e')]),function(){if(_0xed8267){fs[_0x3c89('0x57')](_0x2f6506[_0x3c89('0x4e')]);}});}else{return _0x4cd252['download'](_0x2f6506[_0x3c89('0x4e')],function(_0x798f5){if(_0xed8267){fs[_0x3c89('0x57')](_0x2f6506['value']);}});}}})[_0x3c89('0x46')](handleError(_0x4cd252,null));};exports[_0x3c89('0x24')]=function(_0x4a6d4b,_0x494bb0){return db['VoiceRecording']['find']({'where':{'id':_0x4a6d4b[_0x3c89('0x47')]['id']}})['then'](function(_0x11585e){if(!_0x11585e)throw new ReferenceError('Entity\x20not\x20found');return _0x11585e;})[_0x3c89('0x41')](function(_0x4f6b8a){var _0x1c62d3=_0x4f6b8a[_0x3c89('0x4e')];logger[_0x3c89('0x62')](_0x3c89('0x63'),_0x1c62d3);if(!_['isNil'](_0x4f6b8a['value'])&&fs['existsSync'](_0x1c62d3)){logger[_0x3c89('0x62')]('File:\x20\x22'+_0x1c62d3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3c89('0x64')](_0x1c62d3);}_0x1c62d3=_0x1c62d3+_0x3c89('0x65');if(!_[_0x3c89('0x66')](_0x4f6b8a[_0x3c89('0x4e')])&&fs['existsSync'](_0x1c62d3)){logger[_0x3c89('0x62')](_0x3c89('0x67')+_0x1c62d3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x3c89('0x64')](_0x1c62d3);}return _0x4f6b8a;})[_0x3c89('0x41')](function(_0x43b1a8){if(!_0x43b1a8)throw new InternalError();return _0x43b1a8['destroy']();})[_0x3c89('0x41')](function(){_0x494bb0[_0x3c89('0x19')](0xcc)[_0x3c89('0x1a')]();})[_0x3c89('0x46')](handleError(_0x494bb0,null));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index d37a760..7dbe92a 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 _0xb155=['bluebird','request-promise','path','rimraf','../../config/environment','./voiceRecording.attributes','voice_recordings','uniqueid','lodash','util','api','moment'];(function(_0x154334,_0x1bb73c){var _0xd5bf66=function(_0x29dbf0){while(--_0x29dbf0){_0x154334['push'](_0x154334['shift']());}};_0xd5bf66(++_0x1bb73c);}(_0xb155,0x1f4));var _0x5b15=function(_0x9d1e6b,_0x3bdc22){_0x9d1e6b=_0x9d1e6b-0x0;var _0x2b3070=_0xb155[_0x9d1e6b];return _0x2b3070;};'use strict';var _=require(_0x5b15('0x0'));var util=require(_0x5b15('0x1'));var logger=require('../../config/logger')(_0x5b15('0x2'));var moment=require(_0x5b15('0x3'));var BPromise=require(_0x5b15('0x4'));var rp=require(_0x5b15('0x5'));var fs=require('fs');var path=require(_0x5b15('0x6'));var rimraf=require(_0x5b15('0x7'));var config=require(_0x5b15('0x8'));var attributes=require(_0x5b15('0x9'));module['exports']=function(_0x107567,_0x439e89){return _0x107567['define']('VoiceRecording',attributes,{'tableName':_0x5b15('0xa'),'paranoid':![],'indexes':[{'name':_0x5b15('0xb'),'fields':[_0x5b15('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x464a=['../../config/environment','./voiceRecording.attributes','exports','define','VoiceRecording','voice_recordings','uniqueid','util','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x464a,0xa1));var _0xa464=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x464a[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var util=require(_0xa464('0x0'));var logger=require(_0xa464('0x1'))(_0xa464('0x2'));var moment=require(_0xa464('0x3'));var BPromise=require(_0xa464('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa464('0x5'));var rimraf=require(_0xa464('0x6'));var config=require(_0xa464('0x7'));var attributes=require(_0xa464('0x8'));module[_0xa464('0x9')]=function(_0x5663bc,_0x146430){return _0x5663bc[_0xa464('0xa')](_0xa464('0xb'),attributes,{'tableName':_0xa464('0xc'),'paranoid':![],'indexes':[{'name':_0xa464('0xd'),'fields':[_0xa464('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index d63318b..f4edc31 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(_0x5e2474,_0x3dde05){var _0x4208ca=function(_0x27a93f){while(--_0x27a93f){_0x5e2474['push'](_0x5e2474['shift']());}};_0x4208ca(++_0x3dde05);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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(_0x1a50e5,_0x14accb){var _0x53b463=function(_0x12df94){while(--_0x12df94){_0x1a50e5['push'](_0x1a50e5['shift']());}};_0x53b463(++_0x14accb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xa9e0[_0x411add];return _0x238242;};'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 d80c66f..645a25c 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 _0xe3da=['../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','index','/:id','post','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service'];(function(_0x4038b7,_0x378b74){var _0xc22722=function(_0x5458f5){while(--_0x5458f5){_0x4038b7['push'](_0x4038b7['shift']());}};_0xc22722(++_0x378b74);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0xae3d('0x0'));var util=require(_0xae3d('0x1'));var path=require(_0xae3d('0x2'));var timeout=require(_0xae3d('0x3'));var express=require(_0xae3d('0x4'));var router=express[_0xae3d('0x5')]();var auth=require(_0xae3d('0x6'));var interaction=require(_0xae3d('0x7'));var config=require(_0xae3d('0x8'));var controller=require(_0xae3d('0x9'));router[_0xae3d('0xa')]('/',auth[_0xae3d('0xb')](),controller[_0xae3d('0xc')]);router[_0xae3d('0xa')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['show']);router[_0xae3d('0xe')]('/',auth[_0xae3d('0xb')](),controller['create']);router['put'](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller[_0xae3d('0xf')]);router[_0xae3d('0x10')](_0xae3d('0xd'),auth[_0xae3d('0xb')](),controller['destroy']);module[_0xae3d('0x11')]=router; \ No newline at end of file +var _0x2542=['exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','isAuthenticated','/:id','show','post','create','put','update','destroy'];(function(_0x2f9c17,_0x103d10){var _0x43d8a5=function(_0x4503d4){while(--_0x4503d4){_0x2f9c17['push'](_0x2f9c17['shift']());}};_0x43d8a5(++_0x103d10);}(_0x2542,0x169));var _0x2254=function(_0x372f8d,_0x4682a8){_0x372f8d=_0x372f8d-0x0;var _0x30aaaa=_0x2542[_0x372f8d];return _0x30aaaa;};'use strict';var multer=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var path=require(_0x2254('0x2'));var timeout=require(_0x2254('0x3'));var express=require('express');var router=express[_0x2254('0x4')]();var auth=require('../../components/auth/service');var interaction=require(_0x2254('0x5'));var config=require(_0x2254('0x6'));var controller=require(_0x2254('0x7'));router[_0x2254('0x8')]('/',auth[_0x2254('0x9')](),controller['index']);router[_0x2254('0x8')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xb')]);router[_0x2254('0xc')]('/',auth[_0x2254('0x9')](),controller[_0x2254('0xd')]);router[_0x2254('0xe')](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0xf')]);router['delete'](_0x2254('0xa'),auth[_0x2254('0x9')](),controller[_0x2254('0x10')]);module[_0x2254('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 6df8295..1d891ee 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 _0xd9c4=['STRING','Yes','moment','blind','attended'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd9c4,0x1ab));var _0x4d9c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xd9c4[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x4d9c('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x4d9c('0x1'),_0x4d9c('0x2'))},'result':{'type':Sequelize[_0x4d9c('0x3')]},'transfererchannel':{'type':Sequelize[_0x4d9c('0x3')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0x4d9c('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0x4d9c('0x3')]},'transfererconnectedlinename':{'type':Sequelize['STRING']},'transfereraccountcode':{'type':Sequelize[_0x4d9c('0x3')]},'transferercontext':{'type':Sequelize[_0x4d9c('0x3')]},'transfererexten':{'type':Sequelize[_0x4d9c('0x3')]},'transfererlinkedid':{'type':Sequelize[_0x4d9c('0x3')]},'transfereechannel':{'type':Sequelize[_0x4d9c('0x3')]},'transfereecalleridnum':{'type':Sequelize[_0x4d9c('0x3')]},'transfereecalleridname':{'type':Sequelize[_0x4d9c('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize['STRING']},'transfereeconnectedlinename':{'type':Sequelize[_0x4d9c('0x3')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize['STRING']},'transfereelinkedid':{'type':Sequelize[_0x4d9c('0x3')]},'isexternal':{'type':Sequelize['ENUM'](_0x4d9c('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4d9c('0x3')]}}; \ No newline at end of file +var _0xefda=['exports','STRING','sequelize','moment'];(function(_0x153b29,_0x2eff50){var _0x51f3bc=function(_0xd9573c){while(--_0xd9573c){_0x153b29['push'](_0x153b29['shift']());}};_0x51f3bc(++_0x2eff50);}(_0xefda,0x126));var _0xaefd=function(_0x1418bf,_0x57f368){_0x1418bf=_0x1418bf-0x0;var _0x1757f1=_0xefda[_0x1418bf];return _0x1757f1;};'use strict';var Sequelize=require(_0xaefd('0x0'));var moment=require(_0xaefd('0x1'));module[_0xaefd('0x2')]={'type':{'type':Sequelize['ENUM']('blind','attended')},'result':{'type':Sequelize['STRING']},'transfererchannel':{'type':Sequelize[_0xaefd('0x3')]},'transferercalleridnum':{'type':Sequelize[_0xaefd('0x3')]},'transferercalleridname':{'type':Sequelize[_0xaefd('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xaefd('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xaefd('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xaefd('0x3')]},'transfererexten':{'type':Sequelize[_0xaefd('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0xaefd('0x3')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize['STRING']},'transfereeconnectedlinenum':{'type':Sequelize[_0xaefd('0x3')]},'transfereeconnectedlinename':{'type':Sequelize[_0xaefd('0x3')]},'transfereeaccountcode':{'type':Sequelize[_0xaefd('0x3')]},'transfereecontext':{'type':Sequelize[_0xaefd('0x3')]},'transfereeexten':{'type':Sequelize[_0xaefd('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM']('Yes','No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xaefd('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 714cc81..e8a1ab8 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 _0x087b=['ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','status','end','json','count','offset','set','Content-Range','apply','reject','update','then','destroy','send','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','name','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','include','findAll','rows','catch','show','intersection','find','create','body','params','html-pdf','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse'];(function(_0x13eb02,_0xb8d23e){var _0x592b79=function(_0x2e908b){while(--_0x2e908b){_0x13eb02['push'](_0x13eb02['shift']());}};_0x592b79(++_0xb8d23e);}(_0x087b,0x11a));var _0xb087=function(_0x3ea913,_0x255df2){_0x3ea913=_0x3ea913-0x0;var _0x2b4f28=_0x087b[_0x3ea913];return _0x2b4f28;};'use strict';var pdf=require(_0xb087('0x0'));var emlformat=require(_0xb087('0x1'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb087('0x2'));var rp=require('request-promise');var moment=require(_0xb087('0x3'));var BPromise=require(_0xb087('0x4'));var Mustache=require(_0xb087('0x5'));var util=require(_0xb087('0x6'));var path=require(_0xb087('0x7'));var sox=require(_0xb087('0x8'));var csv=require(_0xb087('0x9'));var ejs=require(_0xb087('0xa'));var fs=require('fs');var _=require(_0xb087('0xb'));var squel=require(_0xb087('0xc'));var crypto=require(_0xb087('0xd'));var jsforce=require(_0xb087('0xe'));var deskjs=require(_0xb087('0xf'));var toCsv=require(_0xb087('0x9'));var querystring=require(_0xb087('0x10'));var Papa=require(_0xb087('0x11'));var Redis=require(_0xb087('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xb087('0x13'));var as=require(_0xb087('0x14'));var hardwareService=require(_0xb087('0x15'));var logger=require(_0xb087('0x16'))(_0xb087('0x17'));var utils=require(_0xb087('0x18'));var config=require(_0xb087('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x189e2b,_0x31f977){_0x31f977=_0x31f977||0xcc;return function(_0x323656){if(_0x323656){return _0x189e2b['sendStatus'](_0x31f977);}return _0x189e2b[_0xb087('0x1a')](_0x31f977)[_0xb087('0x1b')]();};}function respondWithResult(_0x43f136,_0x46410b){_0x46410b=_0x46410b||0xc8;return function(_0x11784c){if(_0x11784c){return _0x43f136[_0xb087('0x1a')](_0x46410b)[_0xb087('0x1c')](_0x11784c);}};}function respondWithFilteredResult(_0x5147e3,_0x24e1a3){return function(_0x16d0b7){if(_0x16d0b7){var _0x5193a4=_0x16d0b7[_0xb087('0x1d')],_0x43e576=_0x24e1a3[_0xb087('0x1e')],_0x412b48=_0x24e1a3[_0xb087('0x1e')]+_0x24e1a3['limit'],_0x597478;if(_0x412b48>=_0x5193a4){_0x412b48=_0x5193a4;_0x597478=0xc8;}else{_0x597478=0xce;}_0x5147e3[_0xb087('0x1a')](_0x597478);return _0x5147e3[_0xb087('0x1f')](_0xb087('0x20'),_0x43e576+'-'+_0x412b48+'/'+_0x5193a4)[_0xb087('0x1c')](_0x16d0b7);}return null;};}function patchUpdates(_0x4e333b){return function(_0x13d534){try{jsonpatch[_0xb087('0x21')](_0x13d534,_0x4e333b,!![]);}catch(_0x10bb5b){return BPromise[_0xb087('0x22')](_0x10bb5b);}return _0x13d534['save']();};}function saveUpdates(_0x5aeab1,_0x5ea3dc){return function(_0x49450a){if(_0x49450a){return _0x49450a[_0xb087('0x23')](_0x5aeab1)[_0xb087('0x24')](function(_0x3d0f57){return _0x3d0f57;});}return null;};}function removeEntity(_0x1f3c0e,_0x1fb765){return function(_0x258b4c){if(_0x258b4c){return _0x258b4c[_0xb087('0x25')]()['then'](function(){_0x1f3c0e[_0xb087('0x1a')](0xcc)[_0xb087('0x1b')]();});}};}function handleEntityNotFound(_0x1de654,_0x1cfb3e){return function(_0x3ad74e){if(!_0x3ad74e){_0x1de654['sendStatus'](0x194);}return _0x3ad74e;};}function handleError(_0x183eab,_0xdd4216){_0xdd4216=_0xdd4216||0x1f4;return function(_0x502438){logger['error'](_0x502438['stack']);if(_0x502438['name']){delete _0x502438['name'];}_0x183eab[_0xb087('0x1a')](_0xdd4216)[_0xb087('0x26')](_0x502438);};}exports[_0xb087('0x27')]=function(_0x3ca2df,_0xd9ec66){var _0xb72173={},_0xf3f41f={},_0x35a52c={'count':0x0,'rows':[]};var _0x6cfb22=_[_0xb087('0x28')](db[_0xb087('0x29')][_0xb087('0x2a')],function(_0xb0baf6){return{'name':_0xb0baf6[_0xb087('0x2b')],'type':_0xb0baf6['type'][_0xb087('0x2c')]};});_0xf3f41f[_0xb087('0x2d')]=_[_0xb087('0x28')](_0x6cfb22,_0xb087('0x2e'));_0xf3f41f[_0xb087('0x2f')]=_[_0xb087('0x30')](_0x3ca2df[_0xb087('0x2f')]);_0xf3f41f[_0xb087('0x31')]=_['intersection'](_0xf3f41f['model'],_0xf3f41f[_0xb087('0x2f')]);_0xb72173[_0xb087('0x32')]=_['intersection'](_0xf3f41f[_0xb087('0x2d')],qs[_0xb087('0x33')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x33')]));_0xb72173[_0xb087('0x32')]=_0xb72173[_0xb087('0x32')][_0xb087('0x34')]?_0xb72173[_0xb087('0x32')]:_0xf3f41f[_0xb087('0x2d')];if(!_0x3ca2df[_0xb087('0x2f')][_0xb087('0x35')](_0xb087('0x36'))){_0xb72173['limit']=qs[_0xb087('0x37')](_0x3ca2df['query'][_0xb087('0x37')]);_0xb72173[_0xb087('0x1e')]=qs[_0xb087('0x1e')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x1e')]);}_0xb72173[_0xb087('0x38')]=qs[_0xb087('0x39')](_0x3ca2df[_0xb087('0x2f')][_0xb087('0x39')]);_0xb72173['where']=qs['filters'](_[_0xb087('0x3a')](_0x3ca2df[_0xb087('0x2f')],_0xf3f41f[_0xb087('0x31')]));if(_0x3ca2df[_0xb087('0x2f')][_0xb087('0x3b')]){_0xb72173['where']=_[_0xb087('0x3c')](_0xb72173[_0xb087('0x3d')],{'$or':_['map'](_0x6cfb22,function(_0x480e22){if(_0x480e22[_0xb087('0x3e')]!==_0xb087('0x3f')){var _0x130ee9={};_0x130ee9[_0x480e22['name']]={'$like':'%'+_0x3ca2df[_0xb087('0x2f')][_0xb087('0x3b')]+'%'};return _0x130ee9;}})});}_0xb72173=_[_0xb087('0x3c')]({},_0xb72173,_0x3ca2df[_0xb087('0x40')]);var _0x3c8f51={'where':_0xb72173['where']};return db[_0xb087('0x29')]['count'](_0x3c8f51)[_0xb087('0x24')](function(_0x5a582d){_0x35a52c[_0xb087('0x1d')]=_0x5a582d;if(_0x3ca2df[_0xb087('0x2f')]['includeAll']){_0xb72173[_0xb087('0x41')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb087('0x42')](_0xb72173);})['then'](function(_0x2d2c74){_0x35a52c[_0xb087('0x43')]=_0x2d2c74;return _0x35a52c;})[_0xb087('0x24')](respondWithFilteredResult(_0xd9ec66,_0xb72173))[_0xb087('0x44')](handleError(_0xd9ec66,null));};exports[_0xb087('0x45')]=function(_0x2a4787,_0x35d010){var _0x5e7690={'raw':!![],'where':{'id':_0x2a4787['params']['id']}},_0x1625f6={};_0x1625f6[_0xb087('0x2d')]=_[_0xb087('0x30')](db['VoiceTransferReport'][_0xb087('0x2a')]);_0x1625f6[_0xb087('0x2f')]=_[_0xb087('0x30')](_0x2a4787['query']);_0x1625f6[_0xb087('0x31')]=_['intersection'](_0x1625f6[_0xb087('0x2d')],_0x1625f6[_0xb087('0x2f')]);_0x5e7690['attributes']=_[_0xb087('0x46')](_0x1625f6[_0xb087('0x2d')],qs['fields'](_0x2a4787[_0xb087('0x2f')][_0xb087('0x33')]));_0x5e7690['attributes']=_0x5e7690[_0xb087('0x32')][_0xb087('0x34')]?_0x5e7690[_0xb087('0x32')]:_0x1625f6[_0xb087('0x2d')];if(_0x2a4787['query']['includeAll']){_0x5e7690[_0xb087('0x41')]=[{'all':!![]}];}_0x5e7690=_[_0xb087('0x3c')]({},_0x5e7690,_0x2a4787[_0xb087('0x40')]);return db[_0xb087('0x29')][_0xb087('0x47')](_0x5e7690)[_0xb087('0x24')](handleEntityNotFound(_0x35d010,null))['then'](respondWithResult(_0x35d010,null))['catch'](handleError(_0x35d010,null));};exports[_0xb087('0x48')]=function(_0x520acc,_0x3a405b){return db[_0xb087('0x29')][_0xb087('0x48')](_0x520acc[_0xb087('0x49')],{})['then'](respondWithResult(_0x3a405b,0xc9))[_0xb087('0x44')](handleError(_0x3a405b,null));};exports['update']=function(_0x2fe8a0,_0x73413b){if(_0x2fe8a0[_0xb087('0x49')]['id']){delete _0x2fe8a0[_0xb087('0x49')]['id'];}return db[_0xb087('0x29')]['find']({'where':{'id':_0x2fe8a0[_0xb087('0x4a')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x73413b,null))[_0xb087('0x24')](saveUpdates(_0x2fe8a0['body'],null))[_0xb087('0x24')](respondWithResult(_0x73413b,null))['catch'](handleError(_0x73413b,null));};exports['destroy']=function(_0x1c9f8f,_0x341665){return db['VoiceTransferReport'][_0xb087('0x47')]({'where':{'id':_0x1c9f8f[_0xb087('0x4a')]['id']}})[_0xb087('0x24')](handleEntityNotFound(_0x341665,null))['then'](removeEntity(_0x341665,null))['catch'](handleError(_0x341665,null));}; \ No newline at end of file +var _0x91a7=['hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','count','include','findAll','show','params','keys','includeAll','catch','create','body','find','eml-format','rimraf','zip-dir','request-promise','bluebird','path','sox','ejs','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','apply','reject','save','update','then','destroy','end','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields'];(function(_0x4449fa,_0x3ce2d5){var _0x9f7348=function(_0x29d708){while(--_0x29d708){_0x4449fa['push'](_0x4449fa['shift']());}};_0x9f7348(++_0x3ce2d5);}(_0x91a7,0xe7));var _0x791a=function(_0x58d4bc,_0xe0e1eb){_0x58d4bc=_0x58d4bc-0x0;var _0x2de044=_0x91a7[_0x58d4bc];return _0x2de044;};'use strict';var pdf=require('html-pdf');var emlformat=require(_0x791a('0x0'));var rimraf=require(_0x791a('0x1'));var zipdir=require(_0x791a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x791a('0x3'));var moment=require('moment');var BPromise=require(_0x791a('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x791a('0x5'));var sox=require(_0x791a('0x6'));var csv=require('to-csv');var ejs=require(_0x791a('0x7'));var fs=require('fs');var _=require('lodash');var squel=require(_0x791a('0x8'));var crypto=require(_0x791a('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x791a('0xa'));var toCsv=require(_0x791a('0xb'));var querystring=require(_0x791a('0xc'));var Papa=require(_0x791a('0xd'));var Redis=require(_0x791a('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x791a('0xf'));var as=require(_0x791a('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x791a('0x11'))(_0x791a('0x12'));var utils=require(_0x791a('0x13'));var config=require(_0x791a('0x14'));var db=require(_0x791a('0x15'))['db'];function respondWithStatusCode(_0x3fc10a,_0x53dc41){_0x53dc41=_0x53dc41||0xcc;return function(_0x5daecd){if(_0x5daecd){return _0x3fc10a[_0x791a('0x16')](_0x53dc41);}return _0x3fc10a[_0x791a('0x17')](_0x53dc41)['end']();};}function respondWithResult(_0x346c44,_0x3a2ec6){_0x3a2ec6=_0x3a2ec6||0xc8;return function(_0x5d5b11){if(_0x5d5b11){return _0x346c44[_0x791a('0x17')](_0x3a2ec6)[_0x791a('0x18')](_0x5d5b11);}};}function respondWithFilteredResult(_0x2ef5c5,_0x5cdf2){return function(_0x55e845){if(_0x55e845){var _0x2ce2e0=_0x55e845['count'],_0x575d11=_0x5cdf2[_0x791a('0x19')],_0x43dea6=_0x5cdf2['offset']+_0x5cdf2[_0x791a('0x1a')],_0x355155;if(_0x43dea6>=_0x2ce2e0){_0x43dea6=_0x2ce2e0;_0x355155=0xc8;}else{_0x355155=0xce;}_0x2ef5c5['status'](_0x355155);return _0x2ef5c5['set']('Content-Range',_0x575d11+'-'+_0x43dea6+'/'+_0x2ce2e0)[_0x791a('0x18')](_0x55e845);}return null;};}function patchUpdates(_0x52fa43){return function(_0x4cf613){try{jsonpatch[_0x791a('0x1b')](_0x4cf613,_0x52fa43,!![]);}catch(_0x5a702e){return BPromise[_0x791a('0x1c')](_0x5a702e);}return _0x4cf613[_0x791a('0x1d')]();};}function saveUpdates(_0x5f3cec,_0x189c0d){return function(_0xcb5e66){if(_0xcb5e66){return _0xcb5e66[_0x791a('0x1e')](_0x5f3cec)[_0x791a('0x1f')](function(_0x530e32){return _0x530e32;});}return null;};}function removeEntity(_0x448085,_0x2054c6){return function(_0x25bae5){if(_0x25bae5){return _0x25bae5[_0x791a('0x20')]()[_0x791a('0x1f')](function(){_0x448085[_0x791a('0x17')](0xcc)[_0x791a('0x21')]();});}};}function handleEntityNotFound(_0x45a67d,_0x323c6a){return function(_0xe8e452){if(!_0xe8e452){_0x45a67d[_0x791a('0x16')](0x194);}return _0xe8e452;};}function handleError(_0x5e03a3,_0x1102c9){_0x1102c9=_0x1102c9||0x1f4;return function(_0x2728a0){logger[_0x791a('0x22')](_0x2728a0[_0x791a('0x23')]);if(_0x2728a0['name']){delete _0x2728a0[_0x791a('0x24')];}_0x5e03a3[_0x791a('0x17')](_0x1102c9)['send'](_0x2728a0);};}exports[_0x791a('0x25')]=function(_0x1785f5,_0x16dbaf){var _0x4c1626={},_0x29194d={},_0x2b3327={'count':0x0,'rows':[]};var _0x2b0784=_[_0x791a('0x26')](db[_0x791a('0x27')][_0x791a('0x28')],function(_0x628816){return{'name':_0x628816[_0x791a('0x29')],'type':_0x628816['type'][_0x791a('0x2a')]};});_0x29194d[_0x791a('0x2b')]=_[_0x791a('0x26')](_0x2b0784,'name');_0x29194d[_0x791a('0x2c')]=_['keys'](_0x1785f5[_0x791a('0x2c')]);_0x29194d[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x29194d[_0x791a('0x2b')],_0x29194d[_0x791a('0x2c')]);_0x4c1626[_0x791a('0x2f')]=_[_0x791a('0x2e')](_0x29194d['model'],qs[_0x791a('0x30')](_0x1785f5[_0x791a('0x2c')][_0x791a('0x30')]));_0x4c1626[_0x791a('0x2f')]=_0x4c1626[_0x791a('0x2f')]['length']?_0x4c1626[_0x791a('0x2f')]:_0x29194d[_0x791a('0x2b')];if(!_0x1785f5[_0x791a('0x2c')][_0x791a('0x31')](_0x791a('0x32'))){_0x4c1626['limit']=qs[_0x791a('0x1a')](_0x1785f5[_0x791a('0x2c')][_0x791a('0x1a')]);_0x4c1626[_0x791a('0x19')]=qs[_0x791a('0x19')](_0x1785f5['query'][_0x791a('0x19')]);}_0x4c1626['order']=qs[_0x791a('0x33')](_0x1785f5['query']['sort']);_0x4c1626[_0x791a('0x34')]=qs[_0x791a('0x2d')](_[_0x791a('0x35')](_0x1785f5[_0x791a('0x2c')],_0x29194d[_0x791a('0x2d')]));if(_0x1785f5[_0x791a('0x2c')][_0x791a('0x36')]){_0x4c1626['where']=_[_0x791a('0x37')](_0x4c1626['where'],{'$or':_[_0x791a('0x26')](_0x2b0784,function(_0x496005){if(_0x496005[_0x791a('0x38')]!==_0x791a('0x39')){var _0x4ead60={};_0x4ead60[_0x496005[_0x791a('0x24')]]={'$like':'%'+_0x1785f5[_0x791a('0x2c')]['filter']+'%'};return _0x4ead60;}})});}_0x4c1626=_[_0x791a('0x37')]({},_0x4c1626,_0x1785f5[_0x791a('0x3a')]);var _0x2861d6={'where':_0x4c1626[_0x791a('0x34')]};return db[_0x791a('0x27')][_0x791a('0x3b')](_0x2861d6)[_0x791a('0x1f')](function(_0xf223d8){_0x2b3327[_0x791a('0x3b')]=_0xf223d8;if(_0x1785f5[_0x791a('0x2c')]['includeAll']){_0x4c1626[_0x791a('0x3c')]=[{'all':!![]}];}return db[_0x791a('0x27')][_0x791a('0x3d')](_0x4c1626);})['then'](function(_0xf4e2fa){_0x2b3327['rows']=_0xf4e2fa;return _0x2b3327;})['then'](respondWithFilteredResult(_0x16dbaf,_0x4c1626))['catch'](handleError(_0x16dbaf,null));};exports[_0x791a('0x3e')]=function(_0xb88abf,_0x49b0d8){var _0x415c44={'raw':!![],'where':{'id':_0xb88abf[_0x791a('0x3f')]['id']}},_0x2d1692={};_0x2d1692[_0x791a('0x2b')]=_['keys'](db['VoiceTransferReport']['rawAttributes']);_0x2d1692[_0x791a('0x2c')]=_[_0x791a('0x40')](_0xb88abf['query']);_0x2d1692[_0x791a('0x2d')]=_[_0x791a('0x2e')](_0x2d1692[_0x791a('0x2b')],_0x2d1692[_0x791a('0x2c')]);_0x415c44['attributes']=_[_0x791a('0x2e')](_0x2d1692['model'],qs[_0x791a('0x30')](_0xb88abf[_0x791a('0x2c')][_0x791a('0x30')]));_0x415c44[_0x791a('0x2f')]=_0x415c44[_0x791a('0x2f')]['length']?_0x415c44[_0x791a('0x2f')]:_0x2d1692[_0x791a('0x2b')];if(_0xb88abf[_0x791a('0x2c')][_0x791a('0x41')]){_0x415c44[_0x791a('0x3c')]=[{'all':!![]}];}_0x415c44=_['merge']({},_0x415c44,_0xb88abf[_0x791a('0x3a')]);return db[_0x791a('0x27')]['find'](_0x415c44)['then'](handleEntityNotFound(_0x49b0d8,null))[_0x791a('0x1f')](respondWithResult(_0x49b0d8,null))[_0x791a('0x42')](handleError(_0x49b0d8,null));};exports[_0x791a('0x43')]=function(_0x5877f4,_0x5d1343){return db[_0x791a('0x27')][_0x791a('0x43')](_0x5877f4['body'],{})[_0x791a('0x1f')](respondWithResult(_0x5d1343,0xc9))[_0x791a('0x42')](handleError(_0x5d1343,null));};exports[_0x791a('0x1e')]=function(_0x549980,_0x5a30a6){if(_0x549980[_0x791a('0x44')]['id']){delete _0x549980[_0x791a('0x44')]['id'];}return db[_0x791a('0x27')][_0x791a('0x45')]({'where':{'id':_0x549980['params']['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0x5a30a6,null))[_0x791a('0x1f')](saveUpdates(_0x549980[_0x791a('0x44')],null))[_0x791a('0x1f')](respondWithResult(_0x5a30a6,null))['catch'](handleError(_0x5a30a6,null));};exports[_0x791a('0x20')]=function(_0x19654d,_0xe0696b){return db[_0x791a('0x27')][_0x791a('0x45')]({'where':{'id':_0x19654d[_0x791a('0x3f')]['id']}})[_0x791a('0x1f')](handleEntityNotFound(_0xe0696b,null))['then'](removeEntity(_0xe0696b,null))[_0x791a('0x42')](handleError(_0xe0696b,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 1ea57c9..09be647 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 _0xb429=['../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','util','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xb429,0x13e));var _0x9b42=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xb429[_0x1b349a];return _0x5d1f7c;};'use strict';var _=require('lodash');var util=require(_0x9b42('0x0'));var logger=require('../../config/logger')(_0x9b42('0x1'));var moment=require(_0x9b42('0x2'));var BPromise=require(_0x9b42('0x3'));var rp=require(_0x9b42('0x4'));var fs=require('fs');var path=require(_0x9b42('0x5'));var rimraf=require(_0x9b42('0x6'));var config=require(_0x9b42('0x7'));var attributes=require(_0x9b42('0x8'));module[_0x9b42('0x9')]=function(_0x183bfa,_0x1dd1d6){return _0x183bfa[_0x9b42('0xa')](_0x9b42('0xb'),attributes,{'tableName':_0x9b42('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f7b=['path','rimraf','../../config/environment','exports','define','report_call_transfer','lodash','util','api','moment','bluebird','request-promise'];(function(_0x4b830c,_0x2399de){var _0x274dbc=function(_0x3bc324){while(--_0x3bc324){_0x4b830c['push'](_0x4b830c['shift']());}};_0x274dbc(++_0x2399de);}(_0x5f7b,0x14a));var _0xb5f7=function(_0x2112d4,_0x3c863c){_0x2112d4=_0x2112d4-0x0;var _0x434972=_0x5f7b[_0x2112d4];return _0x434972;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var logger=require('../../config/logger')(_0xb5f7('0x2'));var moment=require(_0xb5f7('0x3'));var BPromise=require(_0xb5f7('0x4'));var rp=require(_0xb5f7('0x5'));var fs=require('fs');var path=require(_0xb5f7('0x6'));var rimraf=require(_0xb5f7('0x7'));var config=require(_0xb5f7('0x8'));var attributes=require('./voiceTransferReport.attributes');module[_0xb5f7('0x9')]=function(_0x50c8b6,_0x44689a){return _0x50c8b6[_0xb5f7('0xa')]('VoiceTransferReport',attributes,{'tableName':_0xb5f7('0xb'),'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 d247a61..2d6662c 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 _0x10e4=['VoiceTransferReport','create','options','raw','debug','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateVoiceTransferReport'];(function(_0x1d9d42,_0xbefab7){var _0x2b86bd=function(_0x411402){while(--_0x411402){_0x1d9d42['push'](_0x1d9d42['shift']());}};_0x2b86bd(++_0xbefab7);}(_0x10e4,0x114));var _0x410e=function(_0x3e546b,_0x36511c){_0x3e546b=_0x3e546b-0x0;var _0xc65a88=_0x10e4[_0x3e546b];return _0xc65a88;};'use strict';var _=require(_0x410e('0x0'));var util=require(_0x410e('0x1'));var moment=require(_0x410e('0x2'));var BPromise=require(_0x410e('0x3'));var rs=require(_0x410e('0x4'));var fs=require('fs');var Redis=require(_0x410e('0x5'));var db=require(_0x410e('0x6'))['db'];var utils=require(_0x410e('0x7'));var logger=require(_0x410e('0x8'))(_0x410e('0x9'));var config=require(_0x410e('0xa'));var jayson=require(_0x410e('0xb'));var client=jayson[_0x410e('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x44a697,_0x1b3398,_0xece8ac){return new BPromise(function(_0xdee016,_0x2547c3){return client[_0x410e('0xd')](_0x44a697,_0xece8ac)[_0x410e('0xe')](function(_0xb33891){logger['info'](_0x410e('0xf'),_0x1b3398,_0x410e('0x10'));logger['debug'](_0x410e('0x11'),_0x1b3398,'request\x20sent',JSON['stringify'](_0xb33891));if(_0xb33891[_0x410e('0x12')]){if(_0xb33891['error']['code']===0x1f4){logger[_0x410e('0x12')](_0x410e('0xf'),_0x1b3398,_0xb33891[_0x410e('0x12')][_0x410e('0x13')]);return _0x2547c3(_0xb33891['error'][_0x410e('0x13')]);}logger[_0x410e('0x12')](_0x410e('0xf'),_0x1b3398,_0xb33891[_0x410e('0x12')][_0x410e('0x13')]);return _0xdee016(_0xb33891[_0x410e('0x12')]['message']);}else{logger[_0x410e('0x14')](_0x410e('0xf'),_0x1b3398,_0x410e('0x10'));_0xdee016(_0xb33891[_0x410e('0x15')]['message']);}})[_0x410e('0x16')](function(_0x4ccf60){logger['error'](_0x410e('0xf'),_0x1b3398,_0x4ccf60);_0x2547c3(_0x4ccf60);});});}exports[_0x410e('0x17')]=function(_0x36d273){var _0x59a147=this;return new Promise(function(_0x134997,_0x2c79e4){return db[_0x410e('0x18')][_0x410e('0x19')](_0x36d273['body'],{'raw':_0x36d273[_0x410e('0x1a')]?_0x36d273[_0x410e('0x1a')][_0x410e('0x1b')]===undefined?!![]:![]:!![]})[_0x410e('0xe')](function(_0x2addba){logger[_0x410e('0x14')](_0x410e('0x17'),_0x36d273);logger[_0x410e('0x1c')]('CreateVoiceTransferReport',_0x36d273,JSON[_0x410e('0x1d')](_0x2addba));_0x134997(_0x2addba);})[_0x410e('0x16')](function(_0x1f3a44){logger[_0x410e('0x12')]('CreateVoiceTransferReport',_0x1f3a44['message'],_0x36d273);_0x2c79e4(_0x59a147[_0x410e('0x12')](0x1f4,_0x1f3a44['message']));});});}; \ No newline at end of file +var _0x632f=['result','catch','CreateVoiceTransferReport','VoiceTransferReport','body','options','raw','debug','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','http','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceTransferReport,\x20%s,\x20%s'];(function(_0x5111f5,_0x4dfbad){var _0x25c542=function(_0x361c04){while(--_0x361c04){_0x5111f5['push'](_0x5111f5['shift']());}};_0x25c542(++_0x4dfbad);}(_0x632f,0x166));var _0xf632=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x632f[_0x1beef3];return _0x5af964;};'use strict';var _=require('lodash');var util=require(_0xf632('0x0'));var moment=require('moment');var BPromise=require(_0xf632('0x1'));var rs=require(_0xf632('0x2'));var fs=require('fs');var Redis=require(_0xf632('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf632('0x4'));var logger=require('../../config/logger')(_0xf632('0x5'));var config=require('../../config/environment');var jayson=require(_0xf632('0x6'));var client=jayson[_0xf632('0x7')][_0xf632('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4e6498,_0x429845,_0x1c0bc5){return new BPromise(function(_0x443723,_0x562e19){return client['request'](_0x4e6498,_0x1c0bc5)['then'](function(_0x354a8c){logger['info']('VoiceTransferReport,\x20%s,\x20%s',_0x429845,_0xf632('0x9'));logger['debug'](_0xf632('0xa'),_0x429845,_0xf632('0x9'),JSON[_0xf632('0xb')](_0x354a8c));if(_0x354a8c[_0xf632('0xc')]){if(_0x354a8c[_0xf632('0xc')][_0xf632('0xd')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x429845,_0x354a8c[_0xf632('0xc')][_0xf632('0xe')]);return _0x562e19(_0x354a8c[_0xf632('0xc')]['message']);}logger[_0xf632('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x429845,_0x354a8c[_0xf632('0xc')][_0xf632('0xe')]);return _0x443723(_0x354a8c['error']['message']);}else{logger[_0xf632('0xf')](_0xf632('0x10'),_0x429845,_0xf632('0x9'));_0x443723(_0x354a8c[_0xf632('0x11')][_0xf632('0xe')]);}})[_0xf632('0x12')](function(_0x15d825){logger[_0xf632('0xc')]('VoiceTransferReport,\x20%s,\x20%s',_0x429845,_0x15d825);_0x562e19(_0x15d825);});});}exports[_0xf632('0x13')]=function(_0x4eb335){var _0x5defdb=this;return new Promise(function(_0x37c099,_0x50ff84){return db[_0xf632('0x14')]['create'](_0x4eb335[_0xf632('0x15')],{'raw':_0x4eb335[_0xf632('0x16')]?_0x4eb335[_0xf632('0x16')][_0xf632('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x490128){logger[_0xf632('0xf')](_0xf632('0x13'),_0x4eb335);logger[_0xf632('0x18')](_0xf632('0x13'),_0x4eb335,JSON['stringify'](_0x490128));_0x37c099(_0x490128);})[_0xf632('0x12')](function(_0x216869){logger['error']('CreateVoiceTransferReport',_0x216869[_0xf632('0xe')],_0x4eb335);_0x50ff84(_0x5defdb['error'](0x1f4,_0x216869['message']));});});}; \ No newline at end of file diff --git a/server/app.js b/server/app.js index 41dd572..f9fa164 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf959=['map','status','join','seedDB','./config/seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/logger','app','./config/pm2','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','start','info','Online\x20apps:','filter','online','Offline\x20apps:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf959,0x123));var _0x9f95=function(_0x18afca,_0x4219d9){_0x18afca=_0x18afca-0x0;var _0x11603f=_0xf959[_0x18afca];return _0x11603f;};'use strict';var _=require(_0x9f95('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x9f95('0x1'));var config=require('./config/environment');var logger=require(_0x9f95('0x2'))(_0x9f95('0x3'));var pm2=require(_0x9f95('0x4'));var pm2Config=require('./config/pm2/config');var schedule=require(_0x9f95('0x5'));var chat=require(_0x9f95('0x6'));function main(){return mysqldb['db'][_0x9f95('0x7')][_0x9f95('0x8')]()[_0x9f95('0x9')](function(){return rpc[_0x9f95('0xa')]();})['then'](function(_0x50a8ff){logger['info'](_0x50a8ff);return chat[_0x9f95('0xb')]();})[_0x9f95('0x9')](function(){return schedule[_0x9f95('0xb')]();})[_0x9f95('0x9')](function(_0x10371b){logger[_0x9f95('0xc')](_0x10371b);return pm2['start'](pm2Config);})[_0x9f95('0x9')](function(_0x32ec83){logger[_0x9f95('0xc')](_0x9f95('0xd'),_['map'](_[_0x9f95('0xe')](_0x32ec83,{'status':_0x9f95('0xf')}),'name')['join']());logger[_0x9f95('0xc')](_0x9f95('0x10'),_[_0x9f95('0x11')](_[_0x9f95('0xe')](_0x32ec83,function(_0x690dcc){return _0x690dcc[_0x9f95('0x12')]!=='online';}),'name')[_0x9f95('0x13')]()||'None');config[_0x9f95('0x14')]&&require(_0x9f95('0x15'))[_0x9f95('0x16')]();require(_0x9f95('0x17'))[_0x9f95('0x16')]();})[_0x9f95('0x18')](function(_0x287857){logger[_0x9f95('0x19')](_0x9f95('0x1a'),_0x287857);process[_0x9f95('0x1b')](0x1);});}main(); \ No newline at end of file +var _0x7ff5=['join','Offline\x20apps:','status','None','seedDB','default','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./rpc','./config/environment','app','./config/pm2/config','./config/schedule','./config/schedule/chat','sequelize','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name'];(function(_0x20228b,_0x511ef3){var _0x17b89f=function(_0x2474b2){while(--_0x2474b2){_0x20228b['push'](_0x20228b['shift']());}};_0x17b89f(++_0x511ef3);}(_0x7ff5,0x12d));var _0x57ff=function(_0x1be8f4,_0x52aa07){_0x1be8f4=_0x1be8f4-0x0;var _0x33c64a=_0x7ff5[_0x1be8f4];return _0x33c64a;};'use strict';var _=require(_0x57ff('0x0'));var mysqldb=require('./mysqldb');var rpc=require(_0x57ff('0x1'));var config=require(_0x57ff('0x2'));var logger=require('./config/logger')(_0x57ff('0x3'));var pm2=require('./config/pm2');var pm2Config=require(_0x57ff('0x4'));var schedule=require(_0x57ff('0x5'));var chat=require(_0x57ff('0x6'));function main(){return mysqldb['db'][_0x57ff('0x7')][_0x57ff('0x8')]()[_0x57ff('0x9')](function(){return rpc[_0x57ff('0xa')]();})[_0x57ff('0x9')](function(_0x6c500c){logger[_0x57ff('0xb')](_0x6c500c);return chat[_0x57ff('0xc')]();})['then'](function(){return schedule[_0x57ff('0xc')]();})[_0x57ff('0x9')](function(_0x2d1853){logger['info'](_0x2d1853);return pm2[_0x57ff('0xc')](pm2Config);})[_0x57ff('0x9')](function(_0x406e23){logger[_0x57ff('0xb')](_0x57ff('0xd'),_[_0x57ff('0xe')](_[_0x57ff('0xf')](_0x406e23,{'status':_0x57ff('0x10')}),_0x57ff('0x11'))[_0x57ff('0x12')]());logger[_0x57ff('0xb')](_0x57ff('0x13'),_[_0x57ff('0xe')](_['filter'](_0x406e23,function(_0x1af883){return _0x1af883[_0x57ff('0x14')]!==_0x57ff('0x10');}),_0x57ff('0x11'))['join']()||_0x57ff('0x15'));config[_0x57ff('0x16')]&&require('./config/seedDB')[_0x57ff('0x17')]();require(_0x57ff('0x18'))[_0x57ff('0x17')]();})[_0x57ff('0x19')](function(_0xcec6b){logger[_0x57ff('0x1a')](_0x57ff('0x1b'),_0xcec6b);process[_0x57ff('0x1c')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 166ef40..361717e 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 _0x66fa=['session','randomBytes','toString','hex','floor','HS512','../../mysqldb','../../config/environment','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','role','fullname','name','internal','email','permissions','voicePause','mailPause','pauseType','showWebBar','lastPauseAt','allowmessenger','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableSettings','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','user','findOne','disposition','then','closed','status','unmanaged','json','Unmanaged.','Forbidden.','catch','isAuthenticated','use','authorization','startsWith','headers','User','pass','Wrong\x20credentials.','Bearer','Unknown\x20authorization\x20format','getUuid','query','apikey','find','sub','isEqual','nonce','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','apiKeyNonce','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','sign','secret','payload','promisify','verify','secrets'];(function(_0x27e5f0,_0x15668a){var _0x502bf5=function(_0xb9a3e1){while(--_0xb9a3e1){_0x27e5f0['push'](_0x27e5f0['shift']());}};_0x502bf5(++_0x15668a);}(_0x66fa,0x117));var _0xa66f=function(_0x2ee015,_0x3e7447){_0x2ee015=_0x2ee015-0x0;var _0x5a78a4=_0x66fa[_0x2ee015];return _0x5a78a4;};'use strict';var db=require(_0xa66f('0x0'))['db'];var config=require(_0xa66f('0x1'));var hardwareConf=require('../../config/license/hardware');var _=require(_0xa66f('0x2'));var jwt=require(_0xa66f('0x3'));var expressJwt=require(_0xa66f('0x4'));var compose=require(_0xa66f('0x5'));var basicAuth=require(_0xa66f('0x6'));var crypto=require(_0xa66f('0x7'));var BPromise=require(_0xa66f('0x8'));var validateJwt=expressJwt({'secret':config['secrets']['session']});var userAttributes=['id',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'userpic',_0xa66f('0xe'),'md5secret',_0xa66f('0xf'),'chatPause',_0xa66f('0x10'),'faxPause','smsPause','openchannelPause',_0xa66f('0x11'),_0xa66f('0x12'),'lastLoginAt',_0xa66f('0x13'),'crudPermissions',_0xa66f('0x14'),'passwordResetAt',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'phoneBarEnableRecording','phoneBarEnableDtmfTone',_0xa66f('0x18'),'phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl',_0xa66f('0x19'),_0xa66f('0x1a'),_0xa66f('0x1b'),_0xa66f('0x1c')];exports[_0xa66f('0x1d')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x19b5ac,_0x32d338,_0x295acf){if(_0x19b5ac[_0xa66f('0x1e')]){_0x295acf();}else{return db['ChatInteraction'][_0xa66f('0x1f')]({'where':{'id':_0x19b5ac['params']['id']},'attributes':['id','closed',_0xa66f('0x20')],'raw':!![]})[_0xa66f('0x21')](function(_0x342477){if(_0x342477&&_0x342477[_0xa66f('0x22')]){return _0x32d338[_0xa66f('0x23')](_0x342477[_0xa66f('0x20')]===_0xa66f('0x24')?0x195:0x193)[_0xa66f('0x25')]({'message':_0x342477[_0xa66f('0x20')]===_0xa66f('0x24')?_0xa66f('0x26'):_0xa66f('0x27')});}else{_0x295acf();}})[_0xa66f('0x28')](function(_0x2e75ab){_0x295acf(_0x2e75ab);});}});};exports[_0xa66f('0x29')]=function isAuthenticated(_0x5cd613){return compose()[_0xa66f('0x2a')](function(_0xc5c82e,_0x40ee00,_0x37ee13){if(_0xc5c82e['headers'][_0xa66f('0x2b')]){if(_[_0xa66f('0x2c')](_0xc5c82e[_0xa66f('0x2d')][_0xa66f('0x2b')],'Basic')){var _0x5e9639=basicAuth(_0xc5c82e);db[_0xa66f('0x2e')]['find']({'where':{'name':_0x5e9639[_0xa66f('0xb')]}})[_0xa66f('0x21')](function(_0x384164){if(!_0x384164||!_0x384164['authenticate'](_0x5e9639[_0xa66f('0x2f')])){return _0x40ee00[_0xa66f('0x23')](0x191)[_0xa66f('0x25')]({'message':_0xa66f('0x30')});}_0xc5c82e[_0xa66f('0x1e')]={'id':_0x384164['id']};_0x37ee13();})[_0xa66f('0x28')](function(_0x1eb86a){_0x37ee13(_0x1eb86a);});}else if(_[_0xa66f('0x2c')](_0xc5c82e[_0xa66f('0x2d')][_0xa66f('0x2b')],_0xa66f('0x31'))){validateJwt(_0xc5c82e,_0x40ee00,_0x37ee13);}else{if(_0x5cd613){_0x37ee13();}else{return _0x40ee00[_0xa66f('0x23')](0x193)[_0xa66f('0x25')]({'message':_0xa66f('0x32')});}}}else if(_0xc5c82e['query']['apikey']){try{var _0x38daac={'audience':hardwareConf[_0xa66f('0x33')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0xc5c82e[_0xa66f('0x34')][_0xa66f('0x35')],_0x38daac)['then'](function(_0x332e86){return db[_0xa66f('0x2e')][_0xa66f('0x36')]({'where':{'id':_0x332e86[_0xa66f('0x37')]}})[_0xa66f('0x21')](function(_0x548add){if(!_0x548add||!_[_0xa66f('0x38')](_0x548add['apiKeyNonce'],_0x332e86[_0xa66f('0x39')])){return _0x40ee00[_0xa66f('0x23')](0x191)[_0xa66f('0x25')]({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}_0xc5c82e[_0xa66f('0x1e')]={'id':_0x548add['id']};_0x37ee13();});})[_0xa66f('0x28')](function(){return _0x40ee00['status'](0x191)[_0xa66f('0x25')]({'message':_0xa66f('0x3a')});});}catch(_0xba9457){_0x37ee13(_0xba9457);}}else if(_0x5cd613){_0x37ee13();}else{return _0x40ee00[_0xa66f('0x23')](0x193)[_0xa66f('0x25')]({'message':_0xa66f('0x32')});}})[_0xa66f('0x2a')](function(_0x41303c,_0x35ef27,_0xad7968){if(_0x41303c['user']){db[_0xa66f('0x2e')]['find']({'where':{'id':_0x41303c[_0xa66f('0x1e')]['id']},'attributes':userAttributes})[_0xa66f('0x21')](function(_0x9c7756){if(!_0x9c7756){return _0x35ef27[_0xa66f('0x23')](0x194)[_0xa66f('0x25')]({'message':_0xa66f('0x3b')});}_0x41303c[_0xa66f('0x1e')]=_0x9c7756;_0xad7968();})[_0xa66f('0x28')](function(_0x54d740){_0xad7968(_0x54d740);});}else if(_0x5cd613){_0xad7968();}else{return _0x35ef27[_0xa66f('0x23')](0x194)['json']({'message':_0xa66f('0x3c')});}});};exports[_0xa66f('0x3d')]=function canUpdate(){return compose()[_0xa66f('0x2a')](function(_0x47b21a,_0x4d60f9,_0x1b9174){return require(_0xa66f('0x3e'))[_0xa66f('0x3f')]()[_0xa66f('0x21')](function(_0x330169){if(_0x330169['update']){_0x1b9174();}else{return _0x4d60f9['status'](0x193)['json']({'message':_0xa66f('0x40')});}})['catch'](function(_0x4d2d27){_0x1b9174(_0x4d2d27);});});};exports['isMiddleware']=function(_0x5fdc3e,_0x5051b2,_0x8965d3){_0x5fdc3e[_0xa66f('0x41')]=!![];return _0x8965d3();};exports[_0xa66f('0x42')]=function signToken(_0x1647a0){return signJwt(_0x1647a0);};exports[_0xa66f('0x43')]=function(_0x360e61,_0x192033){if(!_0x360e61[_0xa66f('0x1e')]){return _0x192033[_0xa66f('0x23')](0x194)[_0xa66f('0x25')]({'message':_0xa66f('0x44')});}var _0x93f6ff={'payload':{'id':_0x360e61[_0xa66f('0x1e')]['id'],'role':_0x360e61[_0xa66f('0x1e')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x93f6ff)[_0xa66f('0x21')](function(_0x25c2cb){_0x192033['cookie'](_0xa66f('0x45'),_0x25c2cb);_0x192033['redirect'](_0xa66f('0x46'));})[_0xa66f('0x28')](function(_0x5f5b25){return _0x192033[_0xa66f('0x23')](0x1f4)[_0xa66f('0x47')](_0x5f5b25);});};exports[_0xa66f('0x48')]=function(_0x5276ea){if(_[_0xa66f('0x49')](_0x5276ea['apiKeyNonce'])||_[_0xa66f('0x49')](_0x5276ea[_0xa66f('0x4a')])){return null;}else{return createJwt(_0x5276ea);}};exports[_0xa66f('0x4b')]=function(_0x3a499e){_0x3a499e[_0xa66f('0x4c')]=generateNonce();_0x3a499e[_0xa66f('0x4a')]=generateIssuedAt();return createJwt(_0x3a499e);};exports[_0xa66f('0x4d')]=function(_0x50cc47,_0x3e84dd){var _0x22cec6=_0x50cc47[_0xa66f('0x34')][_0xa66f('0x35')];if(_0x22cec6){var _0x374e53={'nonce':_0x3e84dd['apiKeyNonce'],'iat':_0x3e84dd['apiKeyIat'],'audience':hardwareConf[_0xa66f('0x33')](),'issuer':hardwareConf[_0xa66f('0x33')]()};return verifyJwt(_0x22cec6,_0x374e53)[_0xa66f('0x21')](function(){return generateApiKey(_0x3e84dd);});}else{throw{'message':_0xa66f('0x4e')};}};function signJwt(_0xbd0a48){var _0xee2bb7=BPromise['promisify'](jwt[_0xa66f('0x4f')],{'context':jwt});var _0x33914b=_0xbd0a48[_0xa66f('0x50')]||config['secrets']['session'];return new BPromise(function(_0x4568f7,_0x113998){_0xee2bb7(_0xbd0a48[_0xa66f('0x51')],_0x33914b,_0xbd0a48['options'])['then'](function(_0x52054e){_0x4568f7(_0x52054e);})[_0xa66f('0x28')](function(_0x35e477){_0x113998(_0x35e477);});});}function verifyJwt(_0x40d3b6,_0x1f0e58,_0x40611f){var _0x3edf84=BPromise[_0xa66f('0x52')](jwt[_0xa66f('0x53')],{'context':jwt});var _0x56758a=_0x40611f||config[_0xa66f('0x54')][_0xa66f('0x55')];return new BPromise(function(_0x30b944,_0x393755){_0x3edf84(_0x40d3b6,_0x56758a,_0x1f0e58)[_0xa66f('0x21')](function(_0x33cdc7){_0x30b944(_0x33cdc7);})['catch'](function(_0x1840af){_0x393755(_0x1840af);});});}function generateNonce(){return crypto[_0xa66f('0x56')](0x10)[_0xa66f('0x57')](_0xa66f('0x58'));}function generateIssuedAt(){return Math[_0xa66f('0x59')](Date['now']()/0x3e8)[_0xa66f('0x57')]();}function createJwt(_0x50e0cd){var _0x292648={'payload':{'iat':_0x50e0cd['apiKeyIat'],'nonce':_0x50e0cd['apiKeyNonce']},'options':{'algorithm':_0xa66f('0x5a'),'subject':_0x50e0cd['id'][_0xa66f('0x57')](),'issuer':hardwareConf[_0xa66f('0x33')](),'audience':hardwareConf[_0xa66f('0x33')]()}};return signJwt(_0x292648)[_0xa66f('0x21')](function(_0xe97cf4){return{'iat':_0x50e0cd['apiKeyIat'],'nonce':_0x50e0cd[_0xa66f('0x4c')],'token':_0xe97cf4};});} \ No newline at end of file +var _0x2032=['params','closed','then','status','disposition','unmanaged','json','Unmanaged.','authorization','startsWith','headers','Basic','User','find','authenticate','catch','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','../../config/license/util','getLicense','Forbidden','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','redirect','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','promisify','sign','payload','options','verify','randomBytes','toString','../../config/environment','../../config/license/hardware','lodash','express-jwt','composable-middleware','crypto','bluebird','secrets','session','role','fullname','name','internal','email','userpic','permissions','chatPause','faxPause','smsPause','openchannelPause','showWebBar','lastPauseAt','allowmessenger','passwordResetAt','phoneBarEnableSettings','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x1d99c2,_0x57bc47){_0x1d99c2=_0x1d99c2-0x0;var _0x52aeb3=_0x2032[_0x1d99c2];return _0x52aeb3;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0x2203('0x0'));var hardwareConf=require(_0x2203('0x1'));var _=require(_0x2203('0x2'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x2203('0x3'));var compose=require(_0x2203('0x4'));var basicAuth=require('basic-auth');var crypto=require(_0x2203('0x5'));var BPromise=require(_0x2203('0x6'));var validateJwt=expressJwt({'secret':config[_0x2203('0x7')][_0x2203('0x8')]});var userAttributes=['id',_0x2203('0x9'),_0x2203('0xa'),_0x2203('0xb'),_0x2203('0xc'),_0x2203('0xd'),_0x2203('0xe'),_0x2203('0xf'),'md5secret','voicePause',_0x2203('0x10'),'mailPause',_0x2203('0x11'),_0x2203('0x12'),_0x2203('0x13'),'pauseType',_0x2203('0x14'),'lastLoginAt',_0x2203('0x15'),'crudPermissions',_0x2203('0x16'),_0x2203('0x17'),'alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone',_0x2203('0x18'),'phoneBarExpires','phoneBarPrefixRequired',_0x2203('0x19'),_0x2203('0x1a'),_0x2203('0x1b'),_0x2203('0x1c'),_0x2203('0x1d')];exports[_0x2203('0x1e')]=function(){return this[_0x2203('0x1f')](!![])[_0x2203('0x20')](function(_0xdf9d0b,_0x3053f3,_0x5129fb){if(_0xdf9d0b[_0x2203('0x21')]){_0x5129fb();}else{return db[_0x2203('0x22')]['findOne']({'where':{'id':_0xdf9d0b[_0x2203('0x23')]['id']},'attributes':['id',_0x2203('0x24'),'disposition'],'raw':!![]})[_0x2203('0x25')](function(_0x5ee83c){if(_0x5ee83c&&_0x5ee83c[_0x2203('0x24')]){return _0x3053f3[_0x2203('0x26')](_0x5ee83c[_0x2203('0x27')]===_0x2203('0x28')?0x195:0x193)[_0x2203('0x29')]({'message':_0x5ee83c[_0x2203('0x27')]==='unmanaged'?_0x2203('0x2a'):'Forbidden.'});}else{_0x5129fb();}})['catch'](function(_0x15f543){_0x5129fb(_0x15f543);});}});};exports['isAuthenticated']=function isAuthenticated(_0x3b8ef9){return compose()[_0x2203('0x20')](function(_0x5d4c4e,_0x3ee25b,_0x5e29cd){if(_0x5d4c4e['headers'][_0x2203('0x2b')]){if(_[_0x2203('0x2c')](_0x5d4c4e[_0x2203('0x2d')][_0x2203('0x2b')],_0x2203('0x2e'))){var _0x3114ef=basicAuth(_0x5d4c4e);db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'name':_0x3114ef['name']}})[_0x2203('0x25')](function(_0x36b958){if(!_0x36b958||!_0x36b958[_0x2203('0x31')](_0x3114ef['pass'])){return _0x3ee25b[_0x2203('0x26')](0x191)[_0x2203('0x29')]({'message':'Wrong\x20credentials.'});}_0x5d4c4e[_0x2203('0x21')]={'id':_0x36b958['id']};_0x5e29cd();})[_0x2203('0x32')](function(_0x1c6a77){_0x5e29cd(_0x1c6a77);});}else if(_[_0x2203('0x2c')](_0x5d4c4e[_0x2203('0x2d')][_0x2203('0x2b')],_0x2203('0x33'))){validateJwt(_0x5d4c4e,_0x3ee25b,_0x5e29cd);}else{if(_0x3b8ef9){_0x5e29cd();}else{return _0x3ee25b['status'](0x193)[_0x2203('0x29')]({'message':_0x2203('0x34')});}}}else if(_0x5d4c4e[_0x2203('0x35')][_0x2203('0x36')]){try{var _0x52a426={'audience':hardwareConf[_0x2203('0x37')](),'issuer':hardwareConf[_0x2203('0x37')]()};verifyJwt(_0x5d4c4e[_0x2203('0x35')][_0x2203('0x36')],_0x52a426)['then'](function(_0xea1637){return db[_0x2203('0x2f')]['find']({'where':{'id':_0xea1637['sub']}})[_0x2203('0x25')](function(_0x52fafc){if(!_0x52fafc||!_['isEqual'](_0x52fafc[_0x2203('0x38')],_0xea1637[_0x2203('0x39')])){return _0x3ee25b[_0x2203('0x26')](0x191)[_0x2203('0x29')]({'message':_0x2203('0x3a')});}_0x5d4c4e['user']={'id':_0x52fafc['id']};_0x5e29cd();});})[_0x2203('0x32')](function(){return _0x3ee25b[_0x2203('0x26')](0x191)['json']({'message':_0x2203('0x3b')});});}catch(_0x20fbe1){_0x5e29cd(_0x20fbe1);}}else if(_0x3b8ef9){_0x5e29cd();}else{return _0x3ee25b[_0x2203('0x26')](0x193)[_0x2203('0x29')]({'message':_0x2203('0x34')});}})[_0x2203('0x20')](function(_0x29da55,_0x44228e,_0x708faa){if(_0x29da55['user']){db[_0x2203('0x2f')][_0x2203('0x30')]({'where':{'id':_0x29da55['user']['id']},'attributes':userAttributes})['then'](function(_0x2c58b1){if(!_0x2c58b1){return _0x44228e['status'](0x194)[_0x2203('0x29')]({'message':_0x2203('0x3c')});}_0x29da55[_0x2203('0x21')]=_0x2c58b1;_0x708faa();})['catch'](function(_0x5a2b90){_0x708faa(_0x5a2b90);});}else if(_0x3b8ef9){_0x708faa();}else{return _0x44228e[_0x2203('0x26')](0x194)['json']({'message':_0x2203('0x3d')});}});};exports['canUpdate']=function canUpdate(){return compose()[_0x2203('0x20')](function(_0x4b6fc5,_0x86097c,_0x13ed9e){return require(_0x2203('0x3e'))[_0x2203('0x3f')]()[_0x2203('0x25')](function(_0x5436d2){if(_0x5436d2['update']){_0x13ed9e();}else{return _0x86097c['status'](0x193)[_0x2203('0x29')]({'message':_0x2203('0x40')});}})[_0x2203('0x32')](function(_0x3b0c7a){_0x13ed9e(_0x3b0c7a);});});};exports[_0x2203('0x41')]=function(_0x3b250a,_0x1c7e3d,_0x590b4e){_0x3b250a[_0x2203('0x41')]=!![];return _0x590b4e();};exports[_0x2203('0x42')]=function signToken(_0x108fde){return signJwt(_0x108fde);};exports[_0x2203('0x43')]=function(_0x493d12,_0x50d74a){if(!_0x493d12[_0x2203('0x21')]){return _0x50d74a['status'](0x194)[_0x2203('0x29')]({'message':_0x2203('0x44')});}var _0x132091={'payload':{'id':_0x493d12['user']['id'],'role':_0x493d12['user'][_0x2203('0x9')]},'options':{'expiresIn':0x15180}};return signJwt(_0x132091)[_0x2203('0x25')](function(_0x368444){_0x50d74a[_0x2203('0x45')](_0x2203('0x46'),_0x368444);_0x50d74a[_0x2203('0x47')]('/dashboards/general');})[_0x2203('0x32')](function(_0x165a3f){return _0x50d74a[_0x2203('0x26')](0x1f4)[_0x2203('0x48')](_0x165a3f);});};exports[_0x2203('0x49')]=function(_0x36b99f){if(_[_0x2203('0x4a')](_0x36b99f[_0x2203('0x38')])||_[_0x2203('0x4a')](_0x36b99f[_0x2203('0x4b')])){return null;}else{return createJwt(_0x36b99f);}};exports['generateApiKey']=function(_0x2e2ca5){_0x2e2ca5[_0x2203('0x38')]=generateNonce();_0x2e2ca5[_0x2203('0x4b')]=generateIssuedAt();return createJwt(_0x2e2ca5);};exports[_0x2203('0x4c')]=function(_0x4c3259,_0x58bd5c){var _0x1c6661=_0x4c3259['query'][_0x2203('0x36')];if(_0x1c6661){var _0x15a8e8={'nonce':_0x58bd5c[_0x2203('0x38')],'iat':_0x58bd5c[_0x2203('0x4b')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0x2203('0x37')]()};return verifyJwt(_0x1c6661,_0x15a8e8)[_0x2203('0x25')](function(){return generateApiKey(_0x58bd5c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};function signJwt(_0x29bd91){var _0x381b3e=BPromise[_0x2203('0x4d')](jwt[_0x2203('0x4e')],{'context':jwt});var _0x5a71a5=_0x29bd91['secret']||config[_0x2203('0x7')]['session'];return new BPromise(function(_0x543fde,_0x450082){_0x381b3e(_0x29bd91[_0x2203('0x4f')],_0x5a71a5,_0x29bd91[_0x2203('0x50')])['then'](function(_0x4c1496){_0x543fde(_0x4c1496);})[_0x2203('0x32')](function(_0x3eecb7){_0x450082(_0x3eecb7);});});}function verifyJwt(_0x12d7fa,_0x21d2d7,_0x225b0e){var _0x21fd78=BPromise['promisify'](jwt[_0x2203('0x51')],{'context':jwt});var _0x557659=_0x225b0e||config[_0x2203('0x7')][_0x2203('0x8')];return new BPromise(function(_0x246aff,_0x1e49dd){_0x21fd78(_0x12d7fa,_0x557659,_0x21d2d7)['then'](function(_0x506795){_0x246aff(_0x506795);})[_0x2203('0x32')](function(_0x1f772d){_0x1e49dd(_0x1f772d);});});}function generateNonce(){return crypto[_0x2203('0x52')](0x10)[_0x2203('0x53')]('hex');}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x2203('0x53')]();}function createJwt(_0x1c2734){var _0x57b891={'payload':{'iat':_0x1c2734[_0x2203('0x4b')],'nonce':_0x1c2734[_0x2203('0x38')]},'options':{'algorithm':'HS512','subject':_0x1c2734['id'][_0x2203('0x53')](),'issuer':hardwareConf[_0x2203('0x37')](),'audience':hardwareConf[_0x2203('0x37')]()}};return signJwt(_0x57b891)[_0x2203('0x25')](function(_0x4bb6f1){return{'iat':_0x1c2734[_0x2203('0x4b')],'nonce':_0x1c2734['apiKeyNonce'],'token':_0x4bb6f1};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 4f74d38..b380922 100644 --- a/server/components/encryptor/index.js +++ b/server/components/encryptor/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0713=['aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','binary','write','end','final','close','decryptFile','createDecipher','update','unlink'];(function(_0x1b03cc,_0x4f592b){var _0x4b203a=function(_0x5b5b4a){while(--_0x5b5b4a){_0x1b03cc['push'](_0x1b03cc['shift']());}};_0x4b203a(++_0x4f592b);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require('bluebird');var defaultOptions={'algorithm':_0x3071('0x0')};function combineOptions(_0x2afa91){var _0x27405a={};for(var _0x305d85 in defaultOptions){if(defaultOptions[_0x3071('0x1')](_0x305d85)){_0x27405a[_0x305d85]=defaultOptions[_0x305d85];}}if(_0x2afa91){for(var _0x52b5fb in _0x2afa91){if(_0x2afa91[_0x3071('0x1')](_0x52b5fb)){_0x27405a[_0x52b5fb]=_0x2afa91[_0x52b5fb];}}}return _0x27405a;}exports[_0x3071('0x2')]=function(_0x33a70c,_0x3137c8,_0xabd7b6,_0x41cf76){return new BPromise(function(_0x1d3dd6,_0x2f1e87){_0x41cf76=combineOptions(_0x41cf76);var _0xbd737f=new Buffer(_0xabd7b6);var _0x22274c=fs[_0x3071('0x3')](_0x33a70c);var _0x2fce7a=fs[_0x3071('0x4')](_0x3137c8);var _0x4a36ec=crypto[_0x3071('0x5')](_0x41cf76[_0x3071('0x6')],_0xbd737f);_0x22274c['on'](_0x3071('0x7'),function(_0xff9a29){var _0x1ce844=new Buffer(_0x4a36ec['update'](_0xff9a29),_0x3071('0x8'));_0x2fce7a[_0x3071('0x9')](_0x1ce844);});_0x22274c['on'](_0x3071('0xa'),function(){try{var _0x3ed4a0=new Buffer(_0x4a36ec[_0x3071('0xb')]('binary'),'binary');_0x2fce7a[_0x3071('0x9')](_0x3ed4a0);_0x2fce7a['end']();_0x2fce7a['on'](_0x3071('0xc'),function(){return _0x1d3dd6(_0x3137c8);});}catch(_0x44fbae){fs['unlink'](_0x3137c8);return _0x2f1e87(_0x44fbae);}});});};exports[_0x3071('0xd')]=function(_0x4e1219,_0x2fc15d,_0x45c93b,_0x1271d0){return new BPromise(function(_0x1f14e1,_0x1caa5d){_0x1271d0=combineOptions(_0x1271d0);var _0x2a6a4b=new Buffer(_0x45c93b);var _0x157a47=fs[_0x3071('0x3')](_0x4e1219);var _0x21aad3=fs[_0x3071('0x4')](_0x2fc15d);var _0x5f3c22=crypto[_0x3071('0xe')](_0x1271d0[_0x3071('0x6')],_0x2a6a4b);_0x157a47['on'](_0x3071('0x7'),function(_0x108a83){var _0x3acf0e=new Buffer(_0x5f3c22[_0x3071('0xf')](_0x108a83),_0x3071('0x8'));_0x21aad3[_0x3071('0x9')](_0x3acf0e);});_0x157a47['on']('end',function(){try{var _0x359e66=new Buffer(_0x5f3c22[_0x3071('0xb')](_0x3071('0x8')),'binary');_0x21aad3[_0x3071('0x9')](_0x359e66);_0x21aad3['end']();_0x21aad3['on'](_0x3071('0xc'),function(){return _0x1f14e1(_0x2fc15d);});}catch(_0x43128c){fs[_0x3071('0x10')](_0x2fc15d);return _0x1caa5d(_0x43128c);}});});}; \ No newline at end of file +var _0xe706=['unlink','crypto','bluebird','aes192','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','algorithm','data','update','end','final','binary','write','close','createDecipher'];(function(_0xe1063b,_0x49f6a5){var _0x3f79b1=function(_0x1c0f8e){while(--_0x1c0f8e){_0xe1063b['push'](_0xe1063b['shift']());}};_0x3f79b1(++_0x49f6a5);}(_0xe706,0xa3));var _0x6e70=function(_0x3d0678,_0x10e9ae){_0x3d0678=_0x3d0678-0x0;var _0x7f9a43=_0xe706[_0x3d0678];return _0x7f9a43;};'use strict';var crypto=require(_0x6e70('0x0'));var fs=require('fs');var BPromise=require(_0x6e70('0x1'));var defaultOptions={'algorithm':_0x6e70('0x2')};function combineOptions(_0x5e8446){var _0x2cae77={};for(var _0x315629 in defaultOptions){if(defaultOptions[_0x6e70('0x3')](_0x315629)){_0x2cae77[_0x315629]=defaultOptions[_0x315629];}}if(_0x5e8446){for(var _0x7dfbc3 in _0x5e8446){if(_0x5e8446[_0x6e70('0x3')](_0x7dfbc3)){_0x2cae77[_0x7dfbc3]=_0x5e8446[_0x7dfbc3];}}}return _0x2cae77;}exports[_0x6e70('0x4')]=function(_0x376a8d,_0x506db9,_0x1b0389,_0x4381d1){return new BPromise(function(_0x36357b,_0x293ce7){_0x4381d1=combineOptions(_0x4381d1);var _0x45a2d4=new Buffer(_0x1b0389);var _0x188ed3=fs[_0x6e70('0x5')](_0x376a8d);var _0x449b48=fs[_0x6e70('0x6')](_0x506db9);var _0x25e61c=crypto[_0x6e70('0x7')](_0x4381d1[_0x6e70('0x8')],_0x45a2d4);_0x188ed3['on'](_0x6e70('0x9'),function(_0x3f474a){var _0x37b3e0=new Buffer(_0x25e61c[_0x6e70('0xa')](_0x3f474a),'binary');_0x449b48['write'](_0x37b3e0);});_0x188ed3['on'](_0x6e70('0xb'),function(){try{var _0x15a1a5=new Buffer(_0x25e61c[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x449b48[_0x6e70('0xe')](_0x15a1a5);_0x449b48[_0x6e70('0xb')]();_0x449b48['on'](_0x6e70('0xf'),function(){return _0x36357b(_0x506db9);});}catch(_0x5dfbaa){fs['unlink'](_0x506db9);return _0x293ce7(_0x5dfbaa);}});});};exports['decryptFile']=function(_0x257e81,_0x5a37a6,_0x53aed0,_0x304716){return new BPromise(function(_0x22c50c,_0x5d9263){_0x304716=combineOptions(_0x304716);var _0x24f3ac=new Buffer(_0x53aed0);var _0x5c3fe7=fs[_0x6e70('0x5')](_0x257e81);var _0x161f23=fs['createWriteStream'](_0x5a37a6);var _0x49029f=crypto[_0x6e70('0x10')](_0x304716['algorithm'],_0x24f3ac);_0x5c3fe7['on'](_0x6e70('0x9'),function(_0x173afe){var _0x53acdc=new Buffer(_0x49029f['update'](_0x173afe),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x53acdc);});_0x5c3fe7['on'](_0x6e70('0xb'),function(){try{var _0x3a9978=new Buffer(_0x49029f[_0x6e70('0xc')](_0x6e70('0xd')),_0x6e70('0xd'));_0x161f23[_0x6e70('0xe')](_0x3a9978);_0x161f23[_0x6e70('0xb')]();_0x161f23['on'](_0x6e70('0xf'),function(){return _0x22c50c(_0x5a37a6);});}catch(_0x4a0cfe){fs[_0x6e70('0x11')](_0x5a37a6);return _0x5d9263(_0x4a0cfe);}});});}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 1a8f134..7988d55 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 _0x5c12=['basename','.csv','existsSync','join','mkdirSync','each','%s%d.%s','csv','%s.%s','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','path','lodash','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','find','split','then','splitSizeCsv','sequelize','QueryTypes','SELECT','Empty','length','num','push','query'];(function(_0x5d9867,_0x5e9030){var _0x7d2118=function(_0x2e5149){while(--_0x2e5149){_0x5d9867['push'](_0x5d9867['shift']());}};_0x7d2118(++_0x5e9030);}(_0x5c12,0x188));var _0x25c1=function(_0x3aeb36,_0x312dc9){_0x3aeb36=_0x3aeb36-0x0;var _0xa2ef21=_0x5c12[_0x3aeb36];return _0xa2ef21;};'use strict';var util=require('util');var path=require(_0x25c1('0x0'));var _=require(_0x25c1('0x1'));var csv=require('to-csv');var fs=require('fs');var BPromise=require(_0x25c1('0x2'));var zipdir=require(_0x25c1('0x3'));var rimraf=require(_0x25c1('0x4'));var db=require(_0x25c1('0x5'))['db'];var dbH=require(_0x25c1('0x5'))[_0x25c1('0x6')];var logger=require(_0x25c1('0x7'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x25c1('0x8')][0x2]);var QUERY=process[_0x25c1('0x8')][0x3];var PATH=process[_0x25c1('0x8')][0x4];function analyticExtractedReport(_0x4ab674,_0x5c69b1){var _0x24981c={'status':_0x4ab674};var _0x3b69ba={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c69b1){_0x24981c[_0x25c1('0x9')]=_0x5c69b1;}return db[_0x25c1('0xa')][_0x25c1('0xb')](_0x24981c,_0x3b69ba);}function main(){var _0x588f30=0x1388;var _0x3e062e;logger[_0x25c1('0xc')](util[_0x25c1('0xd')](_0x25c1('0xe'),EXTRACTED_REPORT_ID,_0x25c1('0xf')));return db['Setting'][_0x25c1('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x25c1('0x11'),'splitSizeCsv']})[_0x25c1('0x12')](function(_0x209af5){if(_0x209af5){_0x3e062e=_0x209af5;_0x588f30=_0x3e062e[_0x25c1('0x13')]||0x1388;}})[_0x25c1('0x12')](function(){return dbH['sequelize']['query'](util['format']('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]});})[_0x25c1('0x12')](function(_0x17a032){if(!_0x17a032[0x0]['num']){return analyticExtractedReport(_0x25c1('0x17'));}var _0x55b62d=[];var _0x5d631e=0x0;var _0x5b852a=!![];if(_0x17a032&&_0x17a032[_0x25c1('0x18')]){var _0x1a08b5=_0x17a032[0x0]['num']%(_0x5d631e+_0x588f30);if(_0x3e062e['split']){for(;_0x5b852a;_0x5d631e+=_0x588f30,_0x1a08b5=_0x17a032[0x0][_0x25c1('0x19')]%(_0x5d631e+_0x588f30)){if(_0x1a08b5==0x0||_0x1a08b5==_0x17a032[0x0]['num']){_0x5b852a=![];}_0x55b62d[_0x25c1('0x1a')](dbH[_0x25c1('0x14')]['query'](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x588f30,_0x5d631e),{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]}));}}else{_0x55b62d[_0x25c1('0x1a')](dbH['sequelize'][_0x25c1('0x1b')](QUERY,{'type':dbH[_0x25c1('0x14')][_0x25c1('0x15')][_0x25c1('0x16')]}));}}var _0x517a46=path['dirname'](PATH);var _0x2a8a84=path[_0x25c1('0x1c')](PATH,_0x25c1('0x1d'));var _0x1c61e7=_0x3e062e[_0x25c1('0x11')]&&_0x55b62d[_0x25c1('0x18')]>0x1;var _0x2ba595=[];if(!fs[_0x25c1('0x1e')](path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84))&&_0x1c61e7){fs[_0x25c1('0x20')](path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84));}return BPromise[_0x25c1('0x21')](_0x55b62d,function(_0x399d72){_0x2ba595['push'](_0x399d72);})[_0x25c1('0x12')](function(){for(var _0x20dbb9=0x0;_0x20dbb9<_0x2ba595[_0x25c1('0x18')];_0x20dbb9+=0x1){var _0x1fb59f;var _0x21fdb8=_0x2ba595[_0x20dbb9];if(_0x1c61e7){_0x1fb59f=path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84,util['format'](_0x25c1('0x22'),_0x2a8a84,_0x20dbb9,_0x25c1('0x23')));}else{_0x1fb59f=path[_0x25c1('0x1f')](_0x517a46,util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x25c1('0x23')));}fs['writeFileSync'](_0x1fb59f,csv(_0x21fdb8));}})[_0x25c1('0x12')](function(){if(_0x1c61e7){zipdir(path['join'](_0x517a46,_0x2a8a84),{'saveTo':path[_0x25c1('0x1f')](_0x517a46,util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x25c1('0x25')))},function(_0x2e80b5,_0x21069c){});rimraf(path[_0x25c1('0x1f')](_0x517a46,_0x2a8a84),function(){});}})[_0x25c1('0x12')](function(){logger[_0x25c1('0xc')](util['format'](_0x25c1('0x26'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport('Completed',_0x1c61e7?util[_0x25c1('0xd')](_0x25c1('0x24'),_0x2a8a84,_0x1c61e7?'zip':_0x25c1('0x23')):null);});})['catch'](function(_0x3bfcff){logger['info'](util[_0x25c1('0xd')](_0x25c1('0x27'),EXTRACTED_REPORT_ID,_0x25c1('0xf')),util[_0x25c1('0x28')](_0x3bfcff,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0x25c1('0x29'));});}main(); \ No newline at end of file +var _0x41bb=['format','CSV','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','num','Empty','length','QueryTypes','SELECT','dirname','.csv','existsSync','mkdirSync','join','%s%d.%s','csv','%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','inspect','util','path','to-csv','zip-dir','rimraf','../../mysqldb','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info'];(function(_0x387d12,_0x4277dd){var _0x427a9e=function(_0x1b9226){while(--_0x1b9226){_0x387d12['push'](_0x387d12['shift']());}};_0x427a9e(++_0x4277dd);}(_0x41bb,0xc5));var _0xb41b=function(_0x4f4367,_0x20cbf1){_0x4f4367=_0x4f4367-0x0;var _0x1e995f=_0x41bb[_0x4f4367];return _0x1e995f;};'use strict';var util=require(_0xb41b('0x0'));var path=require(_0xb41b('0x1'));var _=require('lodash');var csv=require(_0xb41b('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xb41b('0x3'));var rimraf=require(_0xb41b('0x4'));var db=require(_0xb41b('0x5'))['db'];var dbH=require(_0xb41b('0x5'))['dbH'];var logger=require(_0xb41b('0x6'))(_0xb41b('0x7'));var EXTRACTED_REPORT_ID=Number(process[_0xb41b('0x8')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];function analyticExtractedReport(_0x497242,_0x2704f0){var _0x29c30d={'status':_0x497242};var _0x53722a={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2704f0){_0x29c30d[_0xb41b('0x9')]=_0x2704f0;}return db[_0xb41b('0xa')][_0xb41b('0xb')](_0x29c30d,_0x53722a);}function main(){var _0xa2aa66=0x1388;var _0x26d531;logger[_0xb41b('0xc')](util[_0xb41b('0xd')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xb41b('0xe')));return db['Setting'][_0xb41b('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb41b('0x10'),_0xb41b('0x11')]})[_0xb41b('0x12')](function(_0x2066d5){if(_0x2066d5){_0x26d531=_0x2066d5;_0xa2aa66=_0x26d531['splitSizeCsv']||0x1388;}})[_0xb41b('0x12')](function(){return dbH[_0xb41b('0x13')][_0xb41b('0x14')](util[_0xb41b('0xd')](_0xb41b('0x15'),QUERY),{'type':dbH['sequelize']['QueryTypes']['SELECT']});})[_0xb41b('0x12')](function(_0xdc5fb0){if(!_0xdc5fb0[0x0][_0xb41b('0x16')]){return analyticExtractedReport(_0xb41b('0x17'));}var _0x29ea51=[];var _0x54591e=0x0;var _0x2f3673=!![];if(_0xdc5fb0&&_0xdc5fb0[_0xb41b('0x18')]){var _0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66);if(_0x26d531[_0xb41b('0x10')]){for(;_0x2f3673;_0x54591e+=_0xa2aa66,_0x401dd9=_0xdc5fb0[0x0][_0xb41b('0x16')]%(_0x54591e+_0xa2aa66)){if(_0x401dd9==0x0||_0x401dd9==_0xdc5fb0[0x0][_0xb41b('0x16')]){_0x2f3673=![];}_0x29ea51['push'](dbH['sequelize']['query'](util[_0xb41b('0xd')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0xa2aa66,_0x54591e),{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}else{_0x29ea51['push'](dbH['sequelize'][_0xb41b('0x14')](QUERY,{'type':dbH[_0xb41b('0x13')][_0xb41b('0x19')][_0xb41b('0x1a')]}));}}var _0x232ff1=path[_0xb41b('0x1b')](PATH);var _0x4c73da=path['basename'](PATH,_0xb41b('0x1c'));var _0x21045f=_0x26d531[_0xb41b('0x10')]&&_0x29ea51['length']>0x1;var _0x14e9c8=[];if(!fs[_0xb41b('0x1d')](path['join'](_0x232ff1,_0x4c73da))&&_0x21045f){fs[_0xb41b('0x1e')](path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da));}return BPromise['each'](_0x29ea51,function(_0xed3c7e){_0x14e9c8['push'](_0xed3c7e);})[_0xb41b('0x12')](function(){for(var _0x4c6a91=0x0;_0x4c6a91<_0x14e9c8['length'];_0x4c6a91+=0x1){var _0x3af2c;var _0x4265b8=_0x14e9c8[_0x4c6a91];if(_0x21045f){_0x3af2c=path['join'](_0x232ff1,_0x4c73da,util['format'](_0xb41b('0x20'),_0x4c73da,_0x4c6a91,_0xb41b('0x21')));}else{_0x3af2c=path[_0xb41b('0x1f')](_0x232ff1,util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0xb41b('0x21')));}fs[_0xb41b('0x23')](_0x3af2c,csv(_0x4265b8));}})['then'](function(){if(_0x21045f){zipdir(path[_0xb41b('0x1f')](_0x232ff1,_0x4c73da),{'saveTo':path[_0xb41b('0x1f')](_0x232ff1,util['format'](_0xb41b('0x22'),_0x4c73da,'zip'))},function(_0x38277f,_0x31d4cd){});rimraf(path['join'](_0x232ff1,_0x4c73da),function(){});}})[_0xb41b('0x12')](function(){logger['info'](util[_0xb41b('0xd')](_0xb41b('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xb41b('0x25'),_0x21045f?util[_0xb41b('0xd')](_0xb41b('0x22'),_0x4c73da,_0x21045f?_0xb41b('0x26'):_0xb41b('0x21')):null);});})[_0xb41b('0x27')](function(_0x157048){logger[_0xb41b('0xc')](util[_0xb41b('0xd')](_0xb41b('0x28'),EXTRACTED_REPORT_ID,'CSV'),util[_0xb41b('0x29')](_0x157048,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 8cd866a..115ad74 100644 --- a/server/components/export/pdf.js +++ b/server/components/export/pdf.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['hasOwnProperty','push','num','Empty','dirname','basename','Setting','find','split','splitSizePdf','then','length','query','format','QueryTypes','SELECT','sequelize','existsSync','join','mkdirSync','each','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','startDate','endDate','landscape','body','toString','content','/fonts/Roboto-Regular.ttf','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','%s%d.%s','pdf','%s.%s','createWriteStream','finish','err','end','info','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','lodash','bluebird','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport'];(function(_0x5f40fc,_0x123e05){var _0x3dc6cc=function(_0x415bdf){while(--_0x415bdf){_0x5f40fc['push'](_0x5f40fc['shift']());}};_0x3dc6cc(++_0x123e05);}(_0x5f2f,0x73));var _0xf5f2=function(_0x348efb,_0x3fdb02){_0x348efb=_0x348efb-0x0;var _0x3f7332=_0x5f2f[_0x348efb];return _0x3f7332;};'use strict';var _=require(_0xf5f2('0x0'));var fs=require('fs');var BPromise=require(_0xf5f2('0x1'));var util=require(_0xf5f2('0x2'));var path=require(_0xf5f2('0x3'));var moment=require(_0xf5f2('0x4'));var PdfPrinter=require(_0xf5f2('0x5'));var zipdir=require(_0xf5f2('0x6'));var rimraf=require(_0xf5f2('0x7'));var db=require('../../mysqldb')['db'];var dbH=require('../../mysqldb')[_0xf5f2('0x8')];var logger=require(_0xf5f2('0x9'))(_0xf5f2('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xf5f2('0xb')][0x2]);var QUERY=process[_0xf5f2('0xb')][0x3];var PATH=process[_0xf5f2('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xf5f2('0xc');var _extractedReport;function analyticExtractedReport(_0x46cd9c,_0x2ec345){var _0x56a69f={'status':_0x46cd9c};var _0x375da4={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x2ec345){_0x56a69f[_0xf5f2('0xd')]=_0x2ec345;}return db[_0xf5f2('0xe')]['update'](_0x56a69f,_0x375da4);}function getHeader(_0x977a59){var _0x4ebbbe=[];for(var _0x53fb33 in _0x977a59){if(_0x977a59[_0xf5f2('0xf')](_0x53fb33)){_0x4ebbbe[_0xf5f2('0x10')]({'text':_0x53fb33,'style':'tableHeader'});}}return _0x4ebbbe;}function extractReport(_0x336f6b){var _0x14b51f=0x1388;var _0x331482;if(!_0x336f6b[0x0][_0xf5f2('0x11')]){return analyticExtractedReport(_0xf5f2('0x12'));}var _0x3e5956=[];var _0x5c01b8=0x0;var _0x5850f4=!![];var _0xea612c=path[_0xf5f2('0x13')](PATH);var _0x1c1a5c=path[_0xf5f2('0x14')](PATH,'.pdf');var _0xafe430=![];var _0x286197=[];return db[_0xf5f2('0x15')][_0xf5f2('0x16')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xf5f2('0x17'),_0xf5f2('0x18')]})[_0xf5f2('0x19')](function(_0x395a5a){if(_0x395a5a){_0x331482=_0x395a5a;_0x14b51f=_0x331482[_0xf5f2('0x18')]||0x3e8;}})[_0xf5f2('0x19')](function(){if(_0x336f6b&&_0x336f6b[_0xf5f2('0x1a')]){var _0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f);if(_0x331482[_0xf5f2('0x17')]){for(;_0x5850f4;_0x5c01b8+=_0x14b51f,_0x28e097=_0x336f6b[0x0][_0xf5f2('0x11')]%(_0x5c01b8+_0x14b51f)){if(_0x28e097==0x0||_0x28e097==_0x336f6b[0x0][_0xf5f2('0x11')]){_0x5850f4=![];}_0x3e5956[_0xf5f2('0x10')](dbH['sequelize'][_0xf5f2('0x1b')](util[_0xf5f2('0x1c')]('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x14b51f,_0x5c01b8),{'type':dbH['sequelize'][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}else{_0x3e5956['push'](dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](QUERY,{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]}));}}_0xafe430=_0x331482['split']&&_0x3e5956[_0xf5f2('0x1a')]>0x1;if(!fs[_0xf5f2('0x20')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c))&&_0xafe430){fs[_0xf5f2('0x22')](path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c));}return BPromise['each'](_0x3e5956,function(_0x529f07){_0x286197[_0xf5f2('0x10')](_0x529f07);});})[_0xf5f2('0x19')](function(){return BPromise[_0xf5f2('0x23')](_0x3e5956,function(_0x1a5bb3,_0xf6c58d){var _0x788a8d;var _0x13a3be=util[_0xf5f2('0x1c')](_0xf5f2('0x24'),NAME,_extractedReport['name'],moment(_extractedReport[_0xf5f2('0x25')])[_0xf5f2('0x1c')](FORMAT),moment(_extractedReport[_0xf5f2('0x26')])[_0xf5f2('0x1c')](FORMAT));var _0x198c73={'pageSize':'A4','pageOrientation':_0xf5f2('0x27'),'content':[{'text':_0x13a3be,'style':'header'}],'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':'black'}}};var _0x22c826={'headerRows':0x1,'body':[]};_0x22c826[_0xf5f2('0x28')][_0xf5f2('0x10')](getHeader(_0x1a5bb3[0x0]));var _0x5027ab;for(var _0x5a2c7e=0x0;_0x5a2c7e<_0x1a5bb3[_0xf5f2('0x1a')];_0x5a2c7e+=0x1){_0x5027ab=[];for(var _0x50b8a2 in _0x1a5bb3[_0x5a2c7e]){if(_0x1a5bb3[_0x5a2c7e][_0xf5f2('0xf')](_0x50b8a2)){_0x5027ab[_0xf5f2('0x10')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]?_[_0xf5f2('0x29')](_0x1a5bb3[_0x5a2c7e][_0x50b8a2]):'');}}_0x22c826['body']['push'](_0x5027ab);}_0x198c73[_0xf5f2('0x2a')]['push']({'table':_0x22c826});return new BPromise(function(_0xb744b9,_0x58a4df){var _0x45b643=new PdfPrinter({'Roboto':{'normal':__dirname+_0xf5f2('0x2b'),'bold':__dirname+_0xf5f2('0x2c'),'italics':__dirname+_0xf5f2('0x2d'),'bolditalics':__dirname+_0xf5f2('0x2e')}});var _0x277eee=_0x45b643[_0xf5f2('0x2f')](_0x198c73);if(_0xafe430){_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c,util['format'](_0xf5f2('0x30'),_0x1c1a5c,_0xf6c58d,_0xf5f2('0x31')));}else{_0x788a8d=path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xf5f2('0x31')));}var _0x297c0c=_0x277eee['pipe'](fs[_0xf5f2('0x33')](_0x788a8d));_0x297c0c['on'](_0xf5f2('0x34'),function(){_0xb744b9();});_0x297c0c['on']('error',function(_0x3fc168){console['log'](_0xf5f2('0x35'),_0x3fc168);_0x58a4df(_0x3fc168);});_0x277eee[_0xf5f2('0x36')]();});});})[_0xf5f2('0x19')](function(){if(_0xafe430){return new BPromise(function(_0x2e3cca,_0x59a6dd){zipdir(path['join'](_0xea612c,_0x1c1a5c),{'saveTo':path[_0xf5f2('0x21')](_0xea612c,util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,'zip'))},function(_0x41447f){if(_0x41447f){_0x59a6dd(_0x41447f);}else{_0x2e3cca();}});});}})['then'](function(){if(_0xafe430){rimraf(path[_0xf5f2('0x21')](_0xea612c,_0x1c1a5c),function(){});}})['then'](function(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xf5f2('0x38')));return analyticExtractedReport(_0xf5f2('0x39'),_0xafe430?util[_0xf5f2('0x1c')](_0xf5f2('0x32'),_0x1c1a5c,_0xafe430?'zip':'pdf'):null);});}function main(){logger[_0xf5f2('0x37')](util[_0xf5f2('0x1c')](_0xf5f2('0x3a'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')));return db[_0xf5f2('0xe')][_0xf5f2('0x3c')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0xf5f2('0x19')](function(_0x4c0ac7){_extractedReport=_0x4c0ac7;return dbH[_0xf5f2('0x1f')][_0xf5f2('0x1b')](util['format'](_0xf5f2('0x3d'),QUERY),{'type':dbH[_0xf5f2('0x1f')][_0xf5f2('0x1d')][_0xf5f2('0x1e')]});})[_0xf5f2('0x19')](extractReport)[_0xf5f2('0x3e')](function(_0x462ea3){logger[_0xf5f2('0x37')](util['format'](_0xf5f2('0x3f'),EXTRACTED_REPORT_ID,_0xf5f2('0x3b')),util[_0xf5f2('0x40')](_0x462ea3,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file +var _0xb10b=['query','format','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','push','SELECT','existsSync','join','mkdirSync','each','name','startDate','endDate','landscape','black','body','content','/fonts/Roboto-Medium.ttf','/fonts/Roboto-Italic.ttf','/fonts/Roboto-MediumItalic.ttf','createPdfKitDocument','pdf','%s.%s','pipe','createWriteStream','finish','log','err','end','zip','info','Completed','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','lodash','util','path','moment','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','hasOwnProperty','tableHeader','num','Empty','dirname','basename','.pdf','Setting','find','split','then','splitSizePdf','length','sequelize'];(function(_0x48f9c2,_0x398c34){var _0x20a61b=function(_0x12ab92){while(--_0x12ab92){_0x48f9c2['push'](_0x48f9c2['shift']());}};_0x20a61b(++_0x398c34);}(_0xb10b,0x12a));var _0xbb10=function(_0xbc86fc,_0x1bb24d){_0xbc86fc=_0xbc86fc-0x0;var _0x549976=_0xb10b[_0xbc86fc];return _0x549976;};'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 124bd2e..833d624 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 _0x142c=['Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','util','path','lodash','json2xls','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','XLSX','Setting','find','splitSizeXlsx','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','split','length','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','Completed','zip'];(function(_0x121f32,_0x2a696e){var _0x3385cc=function(_0x4f3d6c){while(--_0x4f3d6c){_0x121f32['push'](_0x121f32['shift']());}};_0x3385cc(++_0x2a696e);}(_0x142c,0x8f));var _0xc142=function(_0x55c1d3,_0x261893){_0x55c1d3=_0x55c1d3-0x0;var _0x385b98=_0x142c[_0x55c1d3];return _0x385b98;};'use strict';var util=require(_0xc142('0x0'));var path=require(_0xc142('0x1'));var _=require(_0xc142('0x2'));var fs=require('fs');var json2xls=require(_0xc142('0x3'));var BPromise=require(_0xc142('0x4'));var zipdir=require(_0xc142('0x5'));var rimraf=require(_0xc142('0x6'));var db=require(_0xc142('0x7'))['db'];var dbH=require('../../mysqldb')[_0xc142('0x8')];var logger=require(_0xc142('0x9'))(_0xc142('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0xc142('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xc142('0xb')][0x4];function analyticExtractedReport(_0x583f7b,_0x477ae4){var _0x2e8d46={'status':_0x583f7b};var _0x4794dc={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x477ae4){_0x2e8d46[_0xc142('0xc')]=_0x477ae4;}return db[_0xc142('0xd')][_0xc142('0xe')](_0x2e8d46,_0x4794dc);}function main(){var _0x5a6ab9=0x1388;var _0x4b6780;logger[_0xc142('0xf')](util[_0xc142('0x10')]('Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xc142('0x11')));return db[_0xc142('0x12')][_0xc142('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xc142('0x14')]})[_0xc142('0x15')](function(_0x1af911){if(_0x1af911){_0x4b6780=_0x1af911;_0x5a6ab9=_0x4b6780[_0xc142('0x14')]||0x1388;}})['then'](function(){return dbH[_0xc142('0x16')][_0xc142('0x17')](util[_0xc142('0x10')](_0xc142('0x18'),QUERY),{'type':dbH[_0xc142('0x16')]['QueryTypes'][_0xc142('0x19')]});})['then'](function(_0x2bc00e){if(!_0x2bc00e[0x0][_0xc142('0x1a')]){return analyticExtractedReport('Empty');}var _0x3c2d24=[];var _0x9683fa=0x0;var _0x57c161=!![];if(_0x4b6780[_0xc142('0x1b')]){if(_0x2bc00e&&_0x2bc00e[_0xc142('0x1c')]){var _0x1a5c1a=_0x2bc00e[0x0][_0xc142('0x1a')]%(_0x9683fa+_0x5a6ab9);for(;_0x57c161;_0x9683fa+=_0x5a6ab9,_0x1a5c1a=_0x2bc00e[0x0][_0xc142('0x1a')]%(_0x9683fa+_0x5a6ab9)){if(_0x1a5c1a==0x0||_0x1a5c1a==_0x2bc00e[0x0][_0xc142('0x1a')]){_0x57c161=![];}_0x3c2d24[_0xc142('0x1d')](dbH['sequelize'][_0xc142('0x17')](util[_0xc142('0x10')](_0xc142('0x1e'),QUERY,_0x5a6ab9,_0x9683fa),{'type':dbH[_0xc142('0x16')][_0xc142('0x1f')][_0xc142('0x19')]}));}}}else{_0x3c2d24['push'](dbH[_0xc142('0x16')][_0xc142('0x17')](QUERY,{'type':dbH[_0xc142('0x16')][_0xc142('0x1f')][_0xc142('0x19')]}));}var _0x376a7a=path['dirname'](PATH);var _0x558157=path[_0xc142('0x20')](PATH,_0xc142('0x21'));var _0x3924f9=_0x4b6780[_0xc142('0x1b')]&&_0x3c2d24[_0xc142('0x1c')]>0x1;var _0xfa0959=[];if(!fs[_0xc142('0x22')](path[_0xc142('0x23')](_0x376a7a,_0x558157))&&_0x3924f9){fs[_0xc142('0x24')](path['join'](_0x376a7a,_0x558157));}return BPromise[_0xc142('0x25')](_0x3c2d24,function(_0xfb7d87){_0xfa0959[_0xc142('0x1d')](_0xfb7d87);})['then'](function(){for(var _0x121f4b=0x0;_0x121f4b<_0xfa0959[_0xc142('0x1c')];_0x121f4b+=0x1){var _0x15bf7c;var _0x4fcc97=_0xfa0959[_0x121f4b];if(_0x3924f9){_0x15bf7c=path[_0xc142('0x23')](_0x376a7a,_0x558157,util[_0xc142('0x10')](_0xc142('0x26'),_0x558157,_0x121f4b,_0xc142('0x27')));}else{_0x15bf7c=path[_0xc142('0x23')](_0x376a7a,util[_0xc142('0x10')](_0xc142('0x28'),_0x558157,_0xc142('0x27')));}fs[_0xc142('0x29')](_0x15bf7c,json2xls(_0x4fcc97),_0xc142('0x2a'));}})[_0xc142('0x15')](function(){if(_0x3924f9){zipdir(path[_0xc142('0x23')](_0x376a7a,_0x558157),{'saveTo':path['join'](_0x376a7a,util[_0xc142('0x10')](_0xc142('0x28'),_0x558157,'zip'))},function(_0x3bc723,_0x2d4c85){});rimraf(path[_0xc142('0x23')](_0x376a7a,_0x558157),function(){});}})[_0xc142('0x15')](function(){logger[_0xc142('0xf')](util[_0xc142('0x10')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0xc142('0x2b'),_0x3924f9?util[_0xc142('0x10')](_0xc142('0x28'),_0x558157,_0x3924f9?_0xc142('0x2c'):'xlsx'):null);});})['catch'](function(_0x36e30e){logger['info'](util[_0xc142('0x10')](_0xc142('0x2d'),EXTRACTED_REPORT_ID,_0xc142('0x11')),util['inspect'](_0x36e30e,{'showHidden':![],'depth':null}));return analyticExtractedReport(_0xc142('0x2e'));});}main(); \ No newline at end of file +var _0x7d2b=['%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','push','query','QueryTypes','dirname','basename','.xlsx','existsSync','join','mkdirSync','each','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Completed','info','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','util','path','lodash','json2xls','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','Setting','find','split','splitSizeXlsx','then','sequelize','num','Empty','length'];(function(_0x1e0c19,_0x54eaf4){var _0x32b513=function(_0x374774){while(--_0x374774){_0x1e0c19['push'](_0x1e0c19['shift']());}};_0x32b513(++_0x54eaf4);}(_0x7d2b,0x1aa));var _0xb7d2=function(_0x20a69c,_0x259e3d){_0x20a69c=_0x20a69c-0x0;var _0x20abe6=_0x7d2b[_0x20a69c];return _0x20abe6;};'use strict';var util=require(_0xb7d2('0x0'));var path=require(_0xb7d2('0x1'));var _=require(_0xb7d2('0x2'));var fs=require('fs');var json2xls=require(_0xb7d2('0x3'));var BPromise=require('bluebird');var zipdir=require('zip-dir');var rimraf=require(_0xb7d2('0x4'));var db=require(_0xb7d2('0x5'))['db'];var dbH=require('../../mysqldb')[_0xb7d2('0x6')];var logger=require(_0xb7d2('0x7'))(_0xb7d2('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xb7d2('0x9')][0x2]);var QUERY=process[_0xb7d2('0x9')][0x3];var PATH=process[_0xb7d2('0x9')][0x4];function analyticExtractedReport(_0x4d9c6a,_0x39e7bf){var _0x5b3e67={'status':_0x4d9c6a};var _0x3862c5={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x39e7bf){_0x5b3e67['savename']=_0x39e7bf;}return db[_0xb7d2('0xa')][_0xb7d2('0xb')](_0x5b3e67,_0x3862c5);}function main(){var _0x1a6a36=0x1388;var _0x5c8c49;logger['info'](util[_0xb7d2('0xc')](_0xb7d2('0xd'),EXTRACTED_REPORT_ID,_0xb7d2('0xe')));return db[_0xb7d2('0xf')][_0xb7d2('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xb7d2('0x11'),_0xb7d2('0x12')]})[_0xb7d2('0x13')](function(_0x37df24){if(_0x37df24){_0x5c8c49=_0x37df24;_0x1a6a36=_0x5c8c49[_0xb7d2('0x12')]||0x1388;}})['then'](function(){return dbH[_0xb7d2('0x14')]['query'](util[_0xb7d2('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0xb7d2('0x14')]['QueryTypes']['SELECT']});})[_0xb7d2('0x13')](function(_0x4bae61){if(!_0x4bae61[0x0][_0xb7d2('0x15')]){return analyticExtractedReport(_0xb7d2('0x16'));}var _0x52980d=[];var _0x22f089=0x0;var _0x9f4f40=!![];if(_0x5c8c49[_0xb7d2('0x11')]){if(_0x4bae61&&_0x4bae61[_0xb7d2('0x17')]){var _0x4f7b00=_0x4bae61[0x0][_0xb7d2('0x15')]%(_0x22f089+_0x1a6a36);for(;_0x9f4f40;_0x22f089+=_0x1a6a36,_0x4f7b00=_0x4bae61[0x0]['num']%(_0x22f089+_0x1a6a36)){if(_0x4f7b00==0x0||_0x4f7b00==_0x4bae61[0x0][_0xb7d2('0x15')]){_0x9f4f40=![];}_0x52980d['push'](dbH[_0xb7d2('0x14')]['query'](util[_0xb7d2('0xc')](_0xb7d2('0x18'),QUERY,_0x1a6a36,_0x22f089),{'type':dbH[_0xb7d2('0x14')]['QueryTypes'][_0xb7d2('0x19')]}));}}}else{_0x52980d[_0xb7d2('0x1a')](dbH[_0xb7d2('0x14')][_0xb7d2('0x1b')](QUERY,{'type':dbH[_0xb7d2('0x14')][_0xb7d2('0x1c')][_0xb7d2('0x19')]}));}var _0x3665a1=path[_0xb7d2('0x1d')](PATH);var _0x1c210a=path[_0xb7d2('0x1e')](PATH,_0xb7d2('0x1f'));var _0x1aa0e2=_0x5c8c49[_0xb7d2('0x11')]&&_0x52980d[_0xb7d2('0x17')]>0x1;var _0x306bd4=[];if(!fs[_0xb7d2('0x20')](path[_0xb7d2('0x21')](_0x3665a1,_0x1c210a))&&_0x1aa0e2){fs[_0xb7d2('0x22')](path[_0xb7d2('0x21')](_0x3665a1,_0x1c210a));}return BPromise[_0xb7d2('0x23')](_0x52980d,function(_0x47b21b){_0x306bd4[_0xb7d2('0x1a')](_0x47b21b);})[_0xb7d2('0x13')](function(){for(var _0xa5f306=0x0;_0xa5f306<_0x306bd4[_0xb7d2('0x17')];_0xa5f306+=0x1){var _0x87ce1b;var _0x52a833=_0x306bd4[_0xa5f306];if(_0x1aa0e2){_0x87ce1b=path[_0xb7d2('0x21')](_0x3665a1,_0x1c210a,util[_0xb7d2('0xc')](_0xb7d2('0x24'),_0x1c210a,_0xa5f306,_0xb7d2('0x25')));}else{_0x87ce1b=path[_0xb7d2('0x21')](_0x3665a1,util[_0xb7d2('0xc')](_0xb7d2('0x26'),_0x1c210a,'xlsx'));}fs[_0xb7d2('0x27')](_0x87ce1b,json2xls(_0x52a833),_0xb7d2('0x28'));}})[_0xb7d2('0x13')](function(){if(_0x1aa0e2){zipdir(path['join'](_0x3665a1,_0x1c210a),{'saveTo':path[_0xb7d2('0x21')](_0x3665a1,util[_0xb7d2('0xc')](_0xb7d2('0x26'),_0x1c210a,_0xb7d2('0x29')))},function(_0x48633d,_0x58300e){});rimraf(path[_0xb7d2('0x21')](_0x3665a1,_0x1c210a),function(){});}})['then'](function(){logger['info'](util[_0xb7d2('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0xb7d2('0xe')));return analyticExtractedReport(_0xb7d2('0x2a'),_0x1aa0e2?util[_0xb7d2('0xc')](_0xb7d2('0x26'),_0x1c210a,_0x1aa0e2?_0xb7d2('0x29'):_0xb7d2('0x25')):null);});})['catch'](function(_0x3aeac9){logger[_0xb7d2('0x2b')](util[_0xb7d2('0xc')](_0xb7d2('0x2c'),EXTRACTED_REPORT_ID,_0xb7d2('0xe')),util['inspect'](_0x3aeac9,{'showHidden':![],'depth':null}));return analyticExtractedReport('Failed');});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index e50ade6..56b6adf 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 _0xb6b8=['error','rewrite','util','models','Interval','then','intervals','VoiceExtension','findAll','uniq','map','exten','filter','groupBy','playback','hasOwnProperty','extensions','extension','find','type','Set','format','CDR(type)=%s','context','VoiceExtensionId','outbound','push','cutdigits','${EXTEN:','${EXTEN}','priority','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','interval','*,*,*,*','IntervalId','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','toLowerCase','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime','last','concat','transaction','destroy'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xb6b8,0xc5));var _0x8b6b=function(_0x4f6808,_0x36ea0f){_0x4f6808=_0x4f6808-0x0;var _0x5713f0=_0xb6b8[_0x4f6808];return _0x5713f0;};'use strict';var _=require('lodash');var util=require(_0x8b6b('0x0'));function rewrite(_0x2efc6b,_0x4633fe){var _0x3cc9c9=this;return _0x2efc6b[_0x8b6b('0x1')][_0x8b6b('0x2')]['findAll']({'raw':!![]})[_0x8b6b('0x3')](function(_0x23b61b){_0x3cc9c9[_0x8b6b('0x4')]=_0x23b61b;return _0x2efc6b['models'][_0x8b6b('0x5')]['findAll']({'where':{'IntervalId':_0x4633fe['IntervalId']},'raw':!![]});})[_0x8b6b('0x3')](function(_0x303c21){return _0x2efc6b[_0x8b6b('0x1')][_0x8b6b('0x5')][_0x8b6b('0x6')]({'where':{'exten':{'$in':_[_0x8b6b('0x7')](_[_0x8b6b('0x8')](_0x303c21,_0x8b6b('0x9')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x5b5825){var _0x30083b=_[_0x8b6b('0xa')](_0x5b5825,{'priority':'1'});var _0x1c79db=_['filter'](_0x5b5825,{'isApp':0x1});var _0xdbd439=_[_0x8b6b('0xb')](_0x1c79db,'exten');var _0x2e21f7=['queue',_0x8b6b('0xc')];var _0x1fd37e=[];var _0x524b0b=[];for(var _0x4d895c in _0xdbd439){if(_0xdbd439[_0x8b6b('0xd')](_0x4d895c)){_0x3cc9c9['priority']=0x2;_0x3cc9c9[_0x8b6b('0xe')]=[];_0x3cc9c9[_0x8b6b('0xf')]=_[_0x8b6b('0x10')](_0x30083b,{'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')]});_0x3cc9c9[_0x8b6b('0xe')]['push']({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':util[_0x8b6b('0x13')](_0x8b6b('0x14'),_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')]),'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x3cc9c9['priority']++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});if(_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')]===_0x8b6b('0x17')){if(_0x3cc9c9[_0x8b6b('0xf')]){_0x3cc9c9['extensions'][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':'Set','appdata':'CDR(destination)='+(_0x3cc9c9[_0x8b6b('0xf')][_0x8b6b('0x19')]?_0x8b6b('0x1a')+_0x3cc9c9['extension'][_0x8b6b('0x19')]+'}':_0x8b6b('0x1b')),'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0]['exten'],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});}_0x3cc9c9[_0x8b6b('0xe')]['push']({'type':_0xdbd439[_0x4d895c][0x0]['type'],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x1d')+_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')],'context':_0xdbd439[_0x4d895c][0x0]['context'],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});var _0x2753fc=_0x3cc9c9[_0x8b6b('0x1c')]++;_0x3cc9c9['extensions']['push']({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x1e'),'appdata':_0x8b6b('0x1f')+(_0x2753fc+0x2)+_0x8b6b('0x20')+(_0x2753fc+0x1)+')','context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x2753fc,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0]['VoiceExtensionId']});if(_0x3cc9c9['extension']){_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':_0x3cc9c9[_0x8b6b('0xf')][_0x8b6b('0x19')]?_0x8b6b('0x21')+_0x3cc9c9[_0x8b6b('0xf')][_0x8b6b('0x19')]+'}':'CDR(prefix)=noprefix','context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x3cc9c9['priority']++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});}_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':'Set','appdata':_0x8b6b('0x22')+_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')],'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});if(_0x3cc9c9[_0x8b6b('0xf')]&&_0x3cc9c9[_0x8b6b('0xf')]['hasOwnProperty'](_0x8b6b('0x23'))&&_0x3cc9c9[_0x8b6b('0xf')][_0x8b6b('0x23')]!=='none'){_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':'_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0]['exten'],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x24')+_0x3cc9c9[_0x8b6b('0xf')][_0x8b6b('0x23')]||_0x8b6b('0x25'),'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0]['exten'],'priority':_0x3cc9c9['priority']++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});}}_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0]['type'],'app':_0x8b6b('0x12'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});_0x3cc9c9['extensions'][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x26'),'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0]['exten'],'priority':_0x3cc9c9[_0x8b6b('0x1c')]++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':'Set','appdata':_0x8b6b('0x27'),'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'exten':_0xdbd439[_0x4d895c][0x0]['exten'],'priority':_0x3cc9c9['priority']++,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0]['VoiceExtensionId']});for(var _0x24d5a2=0x0,_0x5ce5a0=0x0;_0x24d5a2<_0xdbd439[_0x4d895c][_0x8b6b('0x28')];_0x24d5a2+=0x1,_0x5ce5a0=0x0){var _0x58c7a2=_0xdbd439[_0x4d895c][_0x24d5a2];if(_0x58c7a2[_0x8b6b('0x11')]){_0x58c7a2[_0x8b6b('0x11')]=_0x58c7a2[_0x8b6b('0x11')]['toLowerCase']();}var _0x3bc49e=[];var _0x1a85ee=[];delete _0x58c7a2['id'];delete _0x58c7a2['createdAt'];delete _0x58c7a2['updatedAt'];var _0x491794=_0x58c7a2[_0x8b6b('0x29')]!==_0x8b6b('0x2a')?[_0x58c7a2['interval']]:_0x58c7a2[_0x8b6b('0x2b')]?_[_0x8b6b('0x8')](_[_0x8b6b('0xa')](_0x3cc9c9[_0x8b6b('0x4')],{'IntervalId':_0x58c7a2[_0x8b6b('0x2b')]}),'interval'):[];if(_0x58c7a2[_0x8b6b('0xd')]('tag')){if(_0x58c7a2[_0x8b6b('0x2c')]&&_0x58c7a2[_0x8b6b('0x2c')]!=='--'){_0x3bc49e[_0x8b6b('0x18')]({'type':_0x58c7a2[_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x2d')+_0x58c7a2[_0x8b6b('0x2c')],'context':_0x58c7a2['context'],'exten':_0x58c7a2[_0x8b6b('0x9')],'priority':_0x491794['length']+_0x3cc9c9[_0x8b6b('0x1c')]+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2[_0x8b6b('0x16')]});}}if(_0x58c7a2[_0x8b6b('0x11')]===_0x8b6b('0x17')&&_0x58c7a2[_0x8b6b('0xd')](_0x8b6b('0x2e'))){if(_0x58c7a2[_0x8b6b('0x2e')]){_0x3bc49e[_0x8b6b('0x18')]({'type':_0x58c7a2[_0x8b6b('0x11')],'app':'ExecIf','appdata':_0x8b6b('0x2f')+_0x58c7a2[_0x8b6b('0x2e')]+')','context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2[_0x8b6b('0x9')],'priority':_0x491794['length']+_0x3cc9c9[_0x8b6b('0x1c')]+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2[_0x8b6b('0x16')]});}else{_0x3bc49e[_0x8b6b('0x18')]({'type':_0x58c7a2[_0x8b6b('0x11')],'app':'ExecIf','appdata':_0x8b6b('0x30'),'context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2['exten'],'priority':_0x491794['length']+_0x3cc9c9['priority']+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2['VoiceExtensionId']});}}if(_0x58c7a2[_0x8b6b('0xd')](_0x8b6b('0x31'))){if(_0x2e21f7[_0x8b6b('0x32')](_0x58c7a2['app'][_0x8b6b('0x33')]())>=0x0&&_0x58c7a2[_0x8b6b('0x34')]!==_0x8b6b('0x35')){if(_0x58c7a2['answer']){_0x3bc49e[_0x8b6b('0x18')]({'type':_0x58c7a2[_0x8b6b('0x11')],'app':_0x8b6b('0x1e'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2['exten'],'priority':_0x491794[_0x8b6b('0x28')]+_0x3cc9c9[_0x8b6b('0x1c')]+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2[_0x8b6b('0x16')]});_0x3bc49e['push']({'type':_0x58c7a2[_0x8b6b('0x11')],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x36'),'context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2['exten'],'priority':_0x491794[_0x8b6b('0x28')]+_0x3cc9c9[_0x8b6b('0x1c')]+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2['VoiceExtensionId']});}else{_0x3bc49e[_0x8b6b('0x18')]({'type':_0x58c7a2[_0x8b6b('0x11')],'app':_0x8b6b('0x1e'),'appdata':_0x8b6b('0x37'),'context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2['exten'],'priority':_0x491794['length']+_0x3cc9c9['priority']+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2[_0x8b6b('0x16')]});_0x3bc49e['push']({'type':_0x58c7a2['type'],'app':_0x8b6b('0x12'),'appdata':_0x8b6b('0x38'),'context':_0x58c7a2[_0x8b6b('0x15')],'exten':_0x58c7a2[_0x8b6b('0x9')],'priority':_0x491794[_0x8b6b('0x28')]+_0x3cc9c9['priority']+_0x5ce5a0++,'VoiceExtensionId':_0x58c7a2[_0x8b6b('0x16')]});}}}for(var _0x42ad7a=0x0;_0x42ad7a<_0x491794[_0x8b6b('0x28')];_0x42ad7a+=0x1){var _0x3caccc=_0x3cc9c9[_0x8b6b('0x1c')]+_0x491794['length'];var _0x503b3f=_0x42ad7a===_0x491794[_0x8b6b('0x28')]-0x1?_0x3cc9c9[_0x8b6b('0x1c')]+_0x3bc49e[_0x8b6b('0x28')]+_0x1a85ee[_0x8b6b('0x28')]+0x2:_0x3cc9c9[_0x8b6b('0x1c')]+_0x42ad7a+0x1;_0x3bc49e[_0x8b6b('0x39')](_0x42ad7a,0x0,{'type':_0x58c7a2[_0x8b6b('0x11')],'app':_0x8b6b('0x3a'),'appdata':_0x491794[_0x42ad7a]+'?'+_0x58c7a2[_0x8b6b('0x15')]+',${EXTEN},'+_0x3caccc+':'+_0x58c7a2['context']+',${EXTEN},'+_0x503b3f,'exten':_0x58c7a2[_0x8b6b('0x9')],'context':_0x58c7a2[_0x8b6b('0x15')],'priority':_0x3cc9c9[_0x8b6b('0x1c')]+_0x42ad7a,'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});}_0x58c7a2[_0x8b6b('0x1c')]=_0x3bc49e[_0x8b6b('0x28')]?_[_0x8b6b('0x3b')](_0x3bc49e)[_0x8b6b('0x1c')]+0x1:_0x3cc9c9['priority'];_0x3cc9c9[_0x8b6b('0x1c')]=(_0x1a85ee['length']?_['last'](_0x1a85ee)[_0x8b6b('0x1c')]:_0x58c7a2[_0x8b6b('0x1c')])+0x1;_0x3cc9c9[_0x8b6b('0xe')]=_[_0x8b6b('0x3c')](_0x3cc9c9[_0x8b6b('0xe')],_0x3bc49e,[_0x58c7a2],_0x1a85ee);}_0x3cc9c9[_0x8b6b('0xe')][_0x8b6b('0x18')]({'type':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x11')],'app':'Hangup','exten':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x9')],'context':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x15')],'priority':_0x3cc9c9[_0x8b6b('0x1c')],'VoiceExtensionId':_0xdbd439[_0x4d895c][0x0][_0x8b6b('0x16')]});_0x1fd37e[_0x8b6b('0x18')](_0xdbd439[_0x4d895c][0x0]['VoiceExtensionId']);_0x524b0b=_[_0x8b6b('0x3c')](_0x524b0b,_0x3cc9c9[_0x8b6b('0xe')]);}}return _0x2efc6b[_0x8b6b('0x3d')](function(_0x1ae51e){return _0x2efc6b[_0x8b6b('0x1')][_0x8b6b('0x5')][_0x8b6b('0x3e')]({'where':{'VoiceExtensionId':{'$in':_0x1fd37e}},'transaction':_0x1ae51e})['then'](function(_0xf8aeac){return _0x2efc6b[_0x8b6b('0x1')][_0x8b6b('0x5')]['bulkCreate'](_['sortBy'](_0x524b0b,_0x8b6b('0x1c')),{'transaction':_0x1ae51e});});});})['catch'](function(_0x307ee6){console[_0x8b6b('0x3f')](_0x307ee6);});}exports[_0x8b6b('0x40')]=rewrite; \ No newline at end of file +var _0xa870=['CDR(type)=%s','context','VoiceExtensionId','CDR(destination)=','cutdigits','${EXTEN:','${EXTEN}','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','intervals','tag','outbound','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','appType','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','transaction','bulkCreate','sortBy','catch','error','rewrite','lodash','models','findAll','VoiceExtension','IntervalId','then','uniq','map','exten','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','extension','find','push','type','Set','format'];(function(_0x45fed1,_0x550ca1){var _0x11133c=function(_0x301777){while(--_0x301777){_0x45fed1['push'](_0x45fed1['shift']());}};_0x11133c(++_0x550ca1);}(_0xa870,0x143));var _0x0a87=function(_0x5198ba,_0x406a6b){_0x5198ba=_0x5198ba-0x0;var _0x4b01e9=_0xa870[_0x5198ba];return _0x4b01e9;};'use strict';var _=require(_0x0a87('0x0'));var util=require('util');function rewrite(_0x4e3e40,_0x373b13){var _0x190175=this;return _0x4e3e40[_0x0a87('0x1')]['Interval'][_0x0a87('0x2')]({'raw':!![]})['then'](function(_0x46782a){_0x190175['intervals']=_0x46782a;return _0x4e3e40['models'][_0x0a87('0x3')][_0x0a87('0x2')]({'where':{'IntervalId':_0x373b13[_0x0a87('0x4')]},'raw':!![]});})[_0x0a87('0x5')](function(_0x4d8254){return _0x4e3e40[_0x0a87('0x1')]['VoiceExtension'][_0x0a87('0x2')]({'where':{'exten':{'$in':_[_0x0a87('0x6')](_[_0x0a87('0x7')](_0x4d8254,_0x0a87('0x8')))}},'order':[{'raw':'CAST(priority\x20AS\x20UNSIGNED)'}],'raw':!![]});})['then'](function(_0x37adae){var _0x435315=_[_0x0a87('0x9')](_0x37adae,{'priority':'1'});var _0x1c8acb=_[_0x0a87('0x9')](_0x37adae,{'isApp':0x1});var _0x2cce84=_[_0x0a87('0xa')](_0x1c8acb,'exten');var _0x3a0408=[_0x0a87('0xb'),_0x0a87('0xc')];var _0x1c2299=[];var _0x5df1ba=[];for(var _0x3a84a4 in _0x2cce84){if(_0x2cce84[_0x0a87('0xd')](_0x3a84a4)){_0x190175[_0x0a87('0xe')]=0x2;_0x190175[_0x0a87('0xf')]=[];_0x190175[_0x0a87('0x10')]=_[_0x0a87('0x11')](_0x435315,{'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')]});_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':util[_0x0a87('0x15')](_0x0a87('0x16'),_0x2cce84[_0x3a84a4][0x0]['type']),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});if(_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')]==='outbound'){if(_0x190175['extension']){_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x19')+(_0x190175[_0x0a87('0x10')][_0x0a87('0x1a')]?_0x0a87('0x1b')+_0x190175['extension'][_0x0a87('0x1a')]+'}':_0x0a87('0x1c')),'context':_0x2cce84[_0x3a84a4][0x0]['context'],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});}_0x190175['extensions'][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x1d')+_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')],'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});var _0x47b0b2=_0x190175[_0x0a87('0xe')]++;_0x190175['extensions'][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x1e'),'appdata':_0x0a87('0x1f')+(_0x47b0b2+0x2)+'):Goto('+(_0x47b0b2+0x1)+')','context':_0x2cce84[_0x3a84a4][0x0]['context'],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x47b0b2,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});if(_0x190175[_0x0a87('0x10')]){_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0]['type'],'app':_0x0a87('0x14'),'appdata':_0x190175['extension'][_0x0a87('0x1a')]?_0x0a87('0x20')+_0x190175[_0x0a87('0x10')][_0x0a87('0x1a')]+'}':_0x0a87('0x21'),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});}_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':'Set','appdata':_0x0a87('0x22')+_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId'],'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId']});if(_0x190175['extension']&&_0x190175[_0x0a87('0x10')]['hasOwnProperty']('recordingFormat')&&_0x190175['extension'][_0x0a87('0x23')]!=='none'){_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x24'),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175['priority']++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0]['type'],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x25')+_0x190175[_0x0a87('0x10')][_0x0a87('0x23')]||_0x0a87('0x26'),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0]['exten'],'priority':_0x190175['priority']++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId']});}}_0x190175[_0x0a87('0xf')]['push']({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x27'),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId']});_0x190175[_0x0a87('0xf')]['push']({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x28'),'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'priority':_0x190175[_0x0a87('0xe')]++,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});for(var _0x179e1f=0x0,_0x4811df=0x0;_0x179e1f<_0x2cce84[_0x3a84a4][_0x0a87('0x29')];_0x179e1f+=0x1,_0x4811df=0x0){var _0x3f12fd=_0x2cce84[_0x3a84a4][_0x179e1f];if(_0x3f12fd[_0x0a87('0x13')]){_0x3f12fd[_0x0a87('0x13')]=_0x3f12fd[_0x0a87('0x13')][_0x0a87('0x2a')]();}var _0x43a625=[];var _0x521078=[];delete _0x3f12fd['id'];delete _0x3f12fd[_0x0a87('0x2b')];delete _0x3f12fd[_0x0a87('0x2c')];var _0x46b319=_0x3f12fd[_0x0a87('0x2d')]!=='*,*,*,*'?[_0x3f12fd[_0x0a87('0x2d')]]:_0x3f12fd[_0x0a87('0x4')]?_[_0x0a87('0x7')](_[_0x0a87('0x9')](_0x190175[_0x0a87('0x2e')],{'IntervalId':_0x3f12fd[_0x0a87('0x4')]}),_0x0a87('0x2d')):[];if(_0x3f12fd[_0x0a87('0xd')](_0x0a87('0x2f'))){if(_0x3f12fd[_0x0a87('0x2f')]&&_0x3f12fd[_0x0a87('0x2f')]!=='--'){_0x43a625[_0x0a87('0x12')]({'type':_0x3f12fd[_0x0a87('0x13')],'app':_0x0a87('0x14'),'appdata':'CDR(tag)='+_0x3f12fd[_0x0a87('0x2f')],'context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd['exten'],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175[_0x0a87('0xe')]+_0x4811df++,'VoiceExtensionId':_0x3f12fd['VoiceExtensionId']});}}if(_0x3f12fd['type']===_0x0a87('0x30')&&_0x3f12fd[_0x0a87('0xd')]('callerID')){if(_0x3f12fd[_0x0a87('0x31')]){_0x43a625[_0x0a87('0x12')]({'type':_0x3f12fd[_0x0a87('0x13')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x3f12fd[_0x0a87('0x31')]+')','context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd[_0x0a87('0x8')],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175[_0x0a87('0xe')]+_0x4811df++,'VoiceExtensionId':_0x3f12fd[_0x0a87('0x18')]});}else{_0x43a625[_0x0a87('0x12')]({'type':_0x3f12fd[_0x0a87('0x13')],'app':_0x0a87('0x1e'),'appdata':_0x0a87('0x32'),'context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd[_0x0a87('0x8')],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175['priority']+_0x4811df++,'VoiceExtensionId':_0x3f12fd[_0x0a87('0x18')]});}}if(_0x3f12fd[_0x0a87('0xd')](_0x0a87('0x33'))){if(_0x3a0408[_0x0a87('0x34')](_0x3f12fd[_0x0a87('0x35')][_0x0a87('0x2a')]())>=0x0&&_0x3f12fd[_0x0a87('0x36')]!=='custom'){if(_0x3f12fd['answer']){_0x43a625[_0x0a87('0x12')]({'type':_0x3f12fd[_0x0a87('0x13')],'app':'ExecIf','appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd[_0x0a87('0x8')],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175['priority']+_0x4811df++,'VoiceExtensionId':_0x3f12fd['VoiceExtensionId']});_0x43a625['push']({'type':_0x3f12fd['type'],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x37'),'context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd[_0x0a87('0x8')],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175[_0x0a87('0xe')]+_0x4811df++,'VoiceExtensionId':_0x3f12fd['VoiceExtensionId']});}else{_0x43a625['push']({'type':_0x3f12fd[_0x0a87('0x13')],'app':_0x0a87('0x1e'),'appdata':_0x0a87('0x38'),'context':_0x3f12fd['context'],'exten':_0x3f12fd['exten'],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175['priority']+_0x4811df++,'VoiceExtensionId':_0x3f12fd['VoiceExtensionId']});_0x43a625[_0x0a87('0x12')]({'type':_0x3f12fd['type'],'app':_0x0a87('0x14'),'appdata':_0x0a87('0x39'),'context':_0x3f12fd[_0x0a87('0x17')],'exten':_0x3f12fd[_0x0a87('0x8')],'priority':_0x46b319[_0x0a87('0x29')]+_0x190175[_0x0a87('0xe')]+_0x4811df++,'VoiceExtensionId':_0x3f12fd['VoiceExtensionId']});}}}for(var _0x4c840f=0x0;_0x4c840f<_0x46b319[_0x0a87('0x29')];_0x4c840f+=0x1){var _0x4e937b=_0x190175[_0x0a87('0xe')]+_0x46b319[_0x0a87('0x29')];var _0x5f4343=_0x4c840f===_0x46b319[_0x0a87('0x29')]-0x1?_0x190175['priority']+_0x43a625[_0x0a87('0x29')]+_0x521078[_0x0a87('0x29')]+0x2:_0x190175['priority']+_0x4c840f+0x1;_0x43a625[_0x0a87('0x3a')](_0x4c840f,0x0,{'type':_0x3f12fd[_0x0a87('0x13')],'app':_0x0a87('0x3b'),'appdata':_0x46b319[_0x4c840f]+'?'+_0x3f12fd[_0x0a87('0x17')]+_0x0a87('0x3c')+_0x4e937b+':'+_0x3f12fd[_0x0a87('0x17')]+_0x0a87('0x3c')+_0x5f4343,'exten':_0x3f12fd['exten'],'context':_0x3f12fd[_0x0a87('0x17')],'priority':_0x190175[_0x0a87('0xe')]+_0x4c840f,'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId']});}_0x3f12fd[_0x0a87('0xe')]=_0x43a625['length']?_[_0x0a87('0x3d')](_0x43a625)[_0x0a87('0xe')]+0x1:_0x190175[_0x0a87('0xe')];_0x190175[_0x0a87('0xe')]=(_0x521078['length']?_[_0x0a87('0x3d')](_0x521078)[_0x0a87('0xe')]:_0x3f12fd[_0x0a87('0xe')])+0x1;_0x190175[_0x0a87('0xf')]=_['concat'](_0x190175[_0x0a87('0xf')],_0x43a625,[_0x3f12fd],_0x521078);}_0x190175[_0x0a87('0xf')][_0x0a87('0x12')]({'type':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x13')],'app':'Hangup','exten':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x8')],'context':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x17')],'priority':_0x190175[_0x0a87('0xe')],'VoiceExtensionId':_0x2cce84[_0x3a84a4][0x0][_0x0a87('0x18')]});_0x1c2299['push'](_0x2cce84[_0x3a84a4][0x0]['VoiceExtensionId']);_0x5df1ba=_[_0x0a87('0x3e')](_0x5df1ba,_0x190175['extensions']);}}return _0x4e3e40[_0x0a87('0x3f')](function(_0x372872){return _0x4e3e40[_0x0a87('0x1')][_0x0a87('0x3')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x1c2299}},'transaction':_0x372872})[_0x0a87('0x5')](function(_0x5a419a){return _0x4e3e40['models'][_0x0a87('0x3')][_0x0a87('0x40')](_[_0x0a87('0x41')](_0x5df1ba,_0x0a87('0xe')),{'transaction':_0x372872});});});})[_0x0a87('0x42')](function(_0x3d1075){console[_0x0a87('0x43')](_0x3d1075);});}exports[_0x0a87('0x44')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 2540d28..60de26a 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 _0xa9e0=['CmContact','create','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','checkHopper','inspect','insert','into','cm_hopper','fromQuery','scheduledAt','ContactId','updatedAt','select','field','NOW()','toString','createdAt','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','str','calleridnum','cm_hopper_final','id\x20IN\x20?','cm_hopper_black','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','sequelize','VoiceQueueId','onlyIfOpen','query','catch','all','BlackLists','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','contact:csv_','emit','unlinkSync','SIGINT','info','CSV\x20import\x20process\x20stopped!','resolve','createReadStream','parse','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','ioredis','../../../config/environment','../../../config/logger','api','redis','defaults','localhost','socket.io-emitter','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20socket_timestamp\x20parameter!','error','contact','index','isNil','errors','length','map','message','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate'];(function(_0x35eb5e,_0x95d354){var _0x1aaade=function(_0x4901b0){while(--_0x4901b0){_0x35eb5e['push'](_0x35eb5e['shift']());}};_0x1aaade(++_0x95d354);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var fs=require('fs');var squel=require('squel');var Papa=require('papaparse');var Redis=require(_0x0a9e('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var socket=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));require('../../../api/cmContact/cmContact.socket')['register'](socket);try{if(!process[_0x0a9e('0xb')][0x2]||process['argv'][0x2]==='undefined'||process[_0x0a9e('0xb')][0x2]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xd'));}var FILEPATH=process[_0x0a9e('0xb')][0x2];if(!process[_0x0a9e('0xb')][0x3]||process[_0x0a9e('0xb')][0x3]==='undefined'||process['argv'][0x3]==='null'||!process['argv'][0x4]||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x4]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0xf'));}var FIELDS=_[_0x0a9e('0x10')](process['argv'][0x3][_0x0a9e('0x11')](','),process[_0x0a9e('0xb')][0x4][_0x0a9e('0x11')](','));if(!process[_0x0a9e('0xb')][0x5]||process[_0x0a9e('0xb')][0x5]===_0x0a9e('0xe')||process['argv'][0x5]===_0x0a9e('0xc')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process[_0x0a9e('0xb')][0x5];var COMPANYID=process['argv'][0x6]&&process[_0x0a9e('0xb')][0x6]!==_0x0a9e('0xe')&&process['argv'][0x6]!==_0x0a9e('0xc')?process['argv'][0x6]:null;var DUPLICATES=process[_0x0a9e('0xb')][0x7]&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xe')&&process[_0x0a9e('0xb')][0x7]!==_0x0a9e('0xc')?process[_0x0a9e('0xb')][0x7]:null;if(!process[_0x0a9e('0xb')][0x8]||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xe')||process[_0x0a9e('0xb')][0x8]===_0x0a9e('0xc')){throw new Error(_0x0a9e('0x12'));}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x2c3407){logger[_0x0a9e('0x13')](_0x2c3407);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x53682f,_0x20f109,_0x5a09ef,_0x588269){var _0x3a02e1={'message':_0x20f109};_0x3a02e1[_0x53682f]=!![];if(_0x5a09ef){_0x3a02e1[_0x0a9e('0x14')]=_0x5a09ef;}if(_0x588269){_0x3a02e1[_0x0a9e('0x15')]=_0x588269;}return _0x3a02e1;}function isEmail(_0x30bae6){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/['test'](_0x30bae6);}function checkRow(_0xfb6e48,_0x2fb0e4,_0x3b45bc){return new BPromise(function(_0x4d00e6,_0x370d86){if(_[_0x0a9e('0x16')](_0xfb6e48)){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0x3b45bc));}if(_0xfb6e48['errors']&&_0xfb6e48[_0x0a9e('0x17')][_0x0a9e('0x18')]){var _0x40c424=_[_0x0a9e('0x19')](_0xfb6e48['errors'],_0x0a9e('0x1a'))['join'](';');return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x40c424,null,_0x3b45bc));}var _0x5bfb33={};for(var _0x1dc186 in FIELDS){if(FIELDS[_0x0a9e('0x1b')](_0x1dc186)&&FIELDS[_0x1dc186]){_0x5bfb33[_0x1dc186]=_0xfb6e48[_0x0a9e('0x1c')][0x0][FIELDS[_0x1dc186]]||_0xfb6e48[_0x0a9e('0x1c')][0x0]['\ufeff'+FIELDS[_0x1dc186]];}}if(!_0x5bfb33[_0x0a9e('0x1d')]){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x1e'),null,_0x3b45bc));}if(!_0x5bfb33[_0x0a9e('0x1f')]){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x20'),null,_0x3b45bc));}if(_0x5bfb33[_0x0a9e('0x21')]){var _0x2b1f27=moment(_0x5bfb33[_0x0a9e('0x21')],'YYYY-MM-DD');if(!_0x2b1f27[_0x0a9e('0x22')]()){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x23'),null,_0x3b45bc));}}if(_0x5bfb33[_0x0a9e('0x24')]){if(!isEmail(_0x5bfb33[_0x0a9e('0x24')])){return _0x370d86(handleCheckRowError(_0x0a9e('0x13'),_0x0a9e('0x25'),null,_0x3b45bc));}}_0x5bfb33[_0x0a9e('0x26')]=LISTID;_0x5bfb33[_0x0a9e('0x27')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x2fb0e4){var _0x426950={};for(var _0x5d1e0e=0x0,_0x2407f9=DUPLICATES[_0x0a9e('0x18')];_0x5d1e0e<_0x2407f9;_0x5d1e0e+=0x1){_0x426950[DUPLICATES[_0x5d1e0e]]=_0x5bfb33[DUPLICATES[_0x5d1e0e]];}var _0x1122db=_[_0x0a9e('0x28')](_0x2fb0e4,_0x426950);if(_0x1122db){return _0x370d86(handleCheckRowError(_0x0a9e('0x29'),'Duplicate\x20Contact',_0x1122db,_0x3b45bc));}}return db[_0x0a9e('0x2a')][_0x0a9e('0x2b')](_0x5bfb33,{'raw':!![],'hooks':![],'fields':_[_0x0a9e('0x2c')](_0x5bfb33)})[_0x0a9e('0x2d')](function(_0x2b45ea){if(DUPLICATES&&DUPLICATES[_0x0a9e('0x18')]&&_0x2fb0e4){_0x2fb0e4[_0x0a9e('0x2e')](_[_0x0a9e('0x2f')](_0x5bfb33,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x2b45ea['id'];return _0x4d00e6();})['catch'](function(_0x44295a){return _0x370d86(handleCheckRowError('error',_0x0a9e('0x30')+(_0x44295a[_0x0a9e('0x1a')]||JSON[_0x0a9e('0x31')](_0x44295a)),null,_0x3b45bc));});});}function checkHopper(){function _0x3f3d41(){return function(_0x567193){logger[_0x0a9e('0x13')](_0x0a9e('0x32'),_0x0a9e('0x33'),util[_0x0a9e('0x34')](_0x567193,{'showHidden':![],'depth':null}));};}var _0x4853b1=function(_0x54135e,_0x1e8694){var _0x5640eb=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')](['phone',_0x0a9e('0x39'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x1e8694,'createdAt',_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')]('phone','phone')[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),'ListId')['field'](_0x54135e['id'][_0x0a9e('0x3f')](),_0x1e8694)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')](_0x0a9e('0x46'))[_0x0a9e('0x43')](_0x0a9e('0x47'),squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')['where'](_0x1e8694+_0x0a9e('0x48'),_0x54135e['id'][_0x0a9e('0x3f')]())))[_0x0a9e('0x3f')]();return _0x5640eb;};var _0x315881=function(_0x1a69dd,_0xc9a702){var _0x10b040=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),'scheduledAt',_0x0a9e('0x3a'),_0x0a9e('0x26'),_0xc9a702,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')[_0x0a9e('0x3d')]('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x1a69dd['id'][_0x0a9e('0x3f')](),_0xc9a702)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x3b'))[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID[_0x0a9e('0x3f')]())[_0x0a9e('0x43')]('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL')['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x0a9e('0x3c')]()[_0x0a9e('0x3d')](_0x0a9e('0x4a'))[_0x0a9e('0x41')](_0x0a9e('0x4b'))[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id'][_0x0a9e('0x3f')]()))['where']('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'))[_0x0a9e('0x41')]('cm_hopper')[_0x0a9e('0x43')](_0xc9a702+_0x0a9e('0x48'),_0x1a69dd['id']['toString']())))['toString']();return _0x10b040;};function _0x2ef381(_0x59c6ff,_0x443e72){var _0x4c3845=squel[_0x0a9e('0x35')]()[_0x0a9e('0x36')](_0x0a9e('0x37'))['fromQuery']([_0x0a9e('0x1f'),_0x0a9e('0x39'),'ContactId','ListId',_0x443e72,_0x0a9e('0x40'),_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')]('phone',_0x0a9e('0x1f'))['field'](_0x0a9e('0x3e'),'scheduledAt')['field']('id','ContactId')[_0x0a9e('0x3d')](LISTID['toString'](),_0x0a9e('0x26'))[_0x0a9e('0x3d')](_0x59c6ff['id'][_0x0a9e('0x3f')](),_0x443e72)[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),'updatedAt')[_0x0a9e('0x41')](_0x0a9e('0x42'))[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')](_0x0a9e('0x45'),LISTID['toString']())[_0x0a9e('0x43')](_0x0a9e('0x4c'),squel['str'](hopperContacts))[_0x0a9e('0x43')]('phone\x20IS\x20NOT\x20NULL'))[_0x0a9e('0x3f')]();return _0x4c3845;}function _0x5ba1f9(_0x4b3c1a,_0x5674ee){var _0x273cb5=squel['insert']()[_0x0a9e('0x36')](_0x0a9e('0x4d'))[_0x0a9e('0x38')]([_0x0a9e('0x1f'),_0x0a9e('0x3a'),_0x0a9e('0x26'),_0x5674ee,'createdAt',_0x0a9e('0x3b')],squel['select']()[_0x0a9e('0x3d')](_0x0a9e('0x1f'),_0x0a9e('0x1f'))['field']('id',_0x0a9e('0x3a'))[_0x0a9e('0x3d')](LISTID[_0x0a9e('0x3f')](),_0x0a9e('0x26'))['field'](_0x4b3c1a['id'][_0x0a9e('0x3f')](),_0x5674ee)[_0x0a9e('0x3d')]('NOW()',_0x0a9e('0x40'))[_0x0a9e('0x3d')](_0x0a9e('0x3e'),_0x0a9e('0x3b'))[_0x0a9e('0x41')]('cm_contacts')[_0x0a9e('0x43')](_0x0a9e('0x44'))[_0x0a9e('0x43')]('ListId\x20=\x20?',LISTID[_0x0a9e('0x3f')]())['where']('id\x20IN\x20?',squel[_0x0a9e('0x49')](hopperContacts))[_0x0a9e('0x43')](_0x0a9e('0x46')))[_0x0a9e('0x3f')]();return _0x273cb5;}return db[_0x0a9e('0x4e')][_0x0a9e('0x4f')]({'where':{'type':_0x0a9e('0x50')},'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x53'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x19012b){var _0x2bbb86=[];if(_0x19012b){var _0x2b8192;for(var _0x320898=0x0,_0x412a72;_0x320898<_0x19012b[_0x0a9e('0x18')];_0x320898+=0x1){_0x412a72=_0x19012b[_0x320898][_0x0a9e('0x54')]({'plain':!![]});switch(_0x412a72['dialCheckDuplicateType']){case _0x0a9e('0x55'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x315881(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x2bbb86[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x4853b1(_0x412a72,_0x0a9e('0x57')))['then'](function(){})['catch'](_0x3f3d41()));break;default:_0x2bbb86['push'](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x2ef381(_0x412a72,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}}return _0x2bbb86;})[_0x0a9e('0x5b')]()[_0x0a9e('0x2d')](function(){return db[_0x0a9e('0x4e')]['findAll']({'where':{'type':_0x0a9e('0x50')},'attributes':['id'],'include':[{'model':db[_0x0a9e('0x52')],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x2bdc44){var _0x583b2e=[];if(_0x2bdc44){var _0x4437ff;for(var _0x44351d=0x0,_0x4c46c1;_0x44351d<_0x2bdc44[_0x0a9e('0x18')];_0x44351d+=0x1){_0x4c46c1=_0x2bdc44[_0x44351d][_0x0a9e('0x54')]({'plain':!![]});_0x583b2e[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x5ba1f9(_0x4c46c1,_0x0a9e('0x57')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x583b2e;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id',_0x0a9e('0x51')],'include':[{'model':db[_0x0a9e('0x52')],'as':'Lists','where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x3511c9){var _0x30a4c7=[];if(_0x3511c9){for(var _0xf410e5=0x0,_0x332367;_0xf410e5<_0x3511c9[_0x0a9e('0x18')];_0xf410e5+=0x1){_0x332367=_0x3511c9[_0xf410e5][_0x0a9e('0x54')]({'plain':!![]});switch(_0x332367[_0x0a9e('0x51')]){case _0x0a9e('0x55'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x315881(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));break;case _0x0a9e('0x58'):_0x30a4c7[_0x0a9e('0x2e')](db[_0x0a9e('0x56')]['query'](_0x4853b1(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));break;default:_0x30a4c7[_0x0a9e('0x2e')](db['sequelize']['query'](_0x2ef381(_0x332367,_0x0a9e('0x5e')))[_0x0a9e('0x2d')](function(){})['catch'](_0x3f3d41()));}}}return _0x30a4c7;})[_0x0a9e('0x5b')]();})['then'](function(){return db[_0x0a9e('0x5d')][_0x0a9e('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0x0a9e('0x5c'),'where':{'id':LISTID}}]})[_0x0a9e('0x2d')](function(_0x2d2286){var _0x42b959=[];if(_0x2d2286){for(var _0x3755fe=0x0,_0x1f42a0;_0x3755fe<_0x2d2286[_0x0a9e('0x18')];_0x3755fe+=0x1){_0x1f42a0=_0x2d2286[_0x3755fe]['get']({'plain':!![]});_0x42b959[_0x0a9e('0x2e')](db[_0x0a9e('0x56')][_0x0a9e('0x59')](_0x5ba1f9(_0x1f42a0,_0x0a9e('0x5e')))['then'](function(){})[_0x0a9e('0x5a')](_0x3f3d41()));}}return _0x42b959;})[_0x0a9e('0x5b')]();})['catch'](function(_0x1d6834){logger['error'](_0x0a9e('0x5f'),_0x0a9e('0x60'),_0x1d6834[_0x0a9e('0x1a')]);});}var processPromises=function(_0x385d52){return BPromise['all'](promises)['then'](function(_0x353384){})[_0x0a9e('0x5a')](function(_0x94dcf5){logger['error'](_0x0a9e('0x61'),JSON[_0x0a9e('0x31')](_0x94dcf5));})['finally'](function(){socket['emit'](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x385d52){return _0x385d52['resume']();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0x0a9e('0x2d')](function(){socket[_0x0a9e('0x63')](_0x0a9e('0x62')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x0a9e('0x64')](FILEPATH);}catch(_0x3c6dd6){logger[_0x0a9e('0x13')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x0a9e('0x31')](_0x3c6dd6));}finally{process['exit'](0x0);}});};process['on'](_0x0a9e('0x65'),function(){logger[_0x0a9e('0x66')](_0x0a9e('0x67'));endCsv();});function main(){return BPromise[_0x0a9e('0x68')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x0a9e('0x11')](',');return db[_0x0a9e('0x2a')][_0x0a9e('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})['then'](function(_0xb6e411){var _0x21e592=fs[_0x0a9e('0x69')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0x0a9e('0x6a')](_0x21e592,{'header':!![],'skipEmptyLines':!![],'step':function(_0x255e49,_0x1910bf){total+=0x1;var _0x32b9bd=total;promises[_0x0a9e('0x2e')](checkRow(_0x255e49,_0xb6e411,_0x32b9bd)['then'](function(){success+=0x1;})[_0x0a9e('0x5a')](function(_0x3325c5){if(_0x3325c5['error']){errors+=0x1;delete _0x3325c5[_0x0a9e('0x13')];}else if(_0x3325c5[_0x0a9e('0x29')]){duplicates+=0x1;delete _0x3325c5[_0x0a9e('0x29')];}rows['push'](_0x3325c5);}));if(total%0xc8===0x0){_0x1910bf[_0x0a9e('0x6b')]();return processPromises(_0x1910bf);}},'complete':function(){return processPromises()['then'](function(){logger[_0x0a9e('0x66')](_0x0a9e('0x6c'));endCsv();});},'error':function(_0x558a87,_0x1f29bd){logger[_0x0a9e('0x66')](_0x0a9e('0x6d'),JSON[_0x0a9e('0x31')](_0x558a87));endCsv();}});})[_0x0a9e('0x5a')](function(_0x501050){logger[_0x0a9e('0x13')](_0x0a9e('0x6e'),JSON[_0x0a9e('0x31')](_0x501050));});}main(); \ No newline at end of file +var _0xcb91=['generalCheckHopper','Error\x20processing\x20rows\x20block:','resolve','emit','contact:csv_','unlinkSync','exit','SIGINT','CSV\x20import\x20process\x20stopped!','createReadStream','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','lodash','squel','papaparse','ioredis','../../../config/environment','../../../config/logger','redis','defaults','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','Missing\x20filepath\x20parameter!','undefined','zipObject','split','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','birthDate','YYYY-MM-DD','email','ListId','duplicate','Duplicate\x20Contact','CmContact','create','keys','then','push','pick','catch','stringify','cmContact','checkHopper','inspect','insert','cm_hopper','phone','ContactId','createdAt','updatedAt','select','field','NOW()','scheduledAt','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','where','\x20=\x20?','into','fromQuery','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','phone\x20NOT\x20IN\x20(?)','findAll','outbound','dialCheckDuplicateType','CmList','Lists','always','sequelize','query','VoiceQueueId','all','VoiceQueue','BlackLists','get','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s'];(function(_0x2f593c,_0x396834){var _0x38065f=function(_0x234fb6){while(--_0x234fb6){_0x2f593c['push'](_0x2f593c['shift']());}};_0x38065f(++_0x396834);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x13b02f,_0x462a53){_0x13b02f=_0x13b02f-0x0;var _0x12e9a6=_0xcb91[_0x13b02f];return _0x12e9a6;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x1cb9('0x0'));var fs=require('fs');var squel=require(_0x1cb9('0x1'));var Papa=require(_0x1cb9('0x2'));var Redis=require(_0x1cb9('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('api');config[_0x1cb9('0x6')]=_[_0x1cb9('0x7')](config['redis'],{'host':_0x1cb9('0x8'),'port':0x18eb});var socket=require(_0x1cb9('0x9'))(new Redis(config['redis']));require(_0x1cb9('0xa'))[_0x1cb9('0xb')](socket);try{if(!process['argv'][0x2]||process[_0x1cb9('0xc')][0x2]==='undefined'||process['argv'][0x2]===_0x1cb9('0xd')){throw new Error(_0x1cb9('0xe'));}var FILEPATH=process[_0x1cb9('0xc')][0x2];if(!process[_0x1cb9('0xc')][0x3]||process[_0x1cb9('0xc')][0x3]==='undefined'||process[_0x1cb9('0xc')][0x3]===_0x1cb9('0xd')||!process[_0x1cb9('0xc')][0x4]||process[_0x1cb9('0xc')][0x4]===_0x1cb9('0xf')||process['argv'][0x4]==='null'){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x1cb9('0x10')](process[_0x1cb9('0xc')][0x3][_0x1cb9('0x11')](','),process[_0x1cb9('0xc')][0x4]['split'](','));if(!process[_0x1cb9('0xc')][0x5]||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x5]===_0x1cb9('0xd')){throw new Error('Missing\x20ListId\x20parameter!');}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x1cb9('0xc')][0x6]&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xf')&&process[_0x1cb9('0xc')][0x6]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x6]:null;var DUPLICATES=process[_0x1cb9('0xc')][0x7]&&process['argv'][0x7]!=='undefined'&&process[_0x1cb9('0xc')][0x7]!==_0x1cb9('0xd')?process[_0x1cb9('0xc')][0x7]:null;if(!process[_0x1cb9('0xc')][0x8]||process[_0x1cb9('0xc')][0x8]===_0x1cb9('0xf')||process[_0x1cb9('0xc')][0x8]==='null'){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process[_0x1cb9('0xc')][0x8];}catch(_0x5dbfae){logger[_0x1cb9('0x12')](_0x5dbfae);endCsv();}var total=0x0;var pTotal=0x0;var success=0x0;var errors=0x0;var duplicates=0x0;var rows=[];var hopperContacts='';var promises=[];var index=0x0;var alreadyInvalid=![];function handleCheckRowError(_0x2265ea,_0x523b26,_0x599275,_0x2e3854){var _0x325637={'message':_0x523b26};_0x325637[_0x2265ea]=!![];if(_0x599275){_0x325637[_0x1cb9('0x13')]=_0x599275;}if(_0x2e3854){_0x325637[_0x1cb9('0x14')]=_0x2e3854;}return _0x325637;}function isEmail(_0x45b8d3){return/^([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x22([^\x0d\x22\x5c\x80-\xff]|\x5c[\x00-\x7f])*\x22))*\x40([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d)(\x2e([^\x00-\x20\x22\x28\x29\x2c\x2e\x3a-\x3c\x3e\x40\x5b-\x5d\x7f-\xff]+|\x5b([^\x0d\x5b-\x5d\x80-\xff]|\x5c[\x00-\x7f])*\x5d))*$/[_0x1cb9('0x15')](_0x45b8d3);}function checkRow(_0x59ebea,_0x55b232,_0x6c6f61){return new BPromise(function(_0x557199,_0x10a419){if(_[_0x1cb9('0x16')](_0x59ebea)){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x1cb9('0x17'),null,_0x6c6f61));}if(_0x59ebea[_0x1cb9('0x18')]&&_0x59ebea['errors'][_0x1cb9('0x19')]){var _0x9df250=_['map'](_0x59ebea[_0x1cb9('0x18')],_0x1cb9('0x1a'))[_0x1cb9('0x1b')](';');return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),_0x9df250,null,_0x6c6f61));}var _0x406821={};for(var _0x21d6f5 in FIELDS){if(FIELDS[_0x1cb9('0x1c')](_0x21d6f5)&&FIELDS[_0x21d6f5]){_0x406821[_0x21d6f5]=_0x59ebea[_0x1cb9('0x1d')][0x0][FIELDS[_0x21d6f5]]||_0x59ebea[_0x1cb9('0x1d')][0x0]['\ufeff'+FIELDS[_0x21d6f5]];}}if(!_0x406821[_0x1cb9('0x1e')]){return _0x10a419(handleCheckRowError('error',_0x1cb9('0x1f'),null,_0x6c6f61));}if(!_0x406821['phone']){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'phone\x20not\x20specified!',null,_0x6c6f61));}if(_0x406821[_0x1cb9('0x20')]){var _0x41011c=moment(_0x406821[_0x1cb9('0x20')],_0x1cb9('0x21'));if(!_0x41011c['isValid']()){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x6c6f61));}}if(_0x406821[_0x1cb9('0x22')]){if(!isEmail(_0x406821[_0x1cb9('0x22')])){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'email\x20format\x20is\x20not\x20valid!',null,_0x6c6f61));}}_0x406821[_0x1cb9('0x23')]=LISTID;_0x406821['CompanyId']=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){var _0x58f4f5={};for(var _0x2164e3=0x0,_0x42a688=DUPLICATES[_0x1cb9('0x19')];_0x2164e3<_0x42a688;_0x2164e3+=0x1){_0x58f4f5[DUPLICATES[_0x2164e3]]=_0x406821[DUPLICATES[_0x2164e3]];}var _0xae910=_['find'](_0x55b232,_0x58f4f5);if(_0xae910){return _0x10a419(handleCheckRowError(_0x1cb9('0x24'),_0x1cb9('0x25'),_0xae910,_0x6c6f61));}}return db[_0x1cb9('0x26')][_0x1cb9('0x27')](_0x406821,{'raw':!![],'hooks':![],'fields':_[_0x1cb9('0x28')](_0x406821)})[_0x1cb9('0x29')](function(_0xc6d5fd){if(DUPLICATES&&DUPLICATES[_0x1cb9('0x19')]&&_0x55b232){_0x55b232[_0x1cb9('0x2a')](_[_0x1cb9('0x2b')](_0x406821,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0xc6d5fd['id'];return _0x557199();})[_0x1cb9('0x2c')](function(_0x26b950){return _0x10a419(handleCheckRowError(_0x1cb9('0x12'),'Error\x20while\x20creating\x20contact:\x20'+(_0x26b950['message']||JSON[_0x1cb9('0x2d')](_0x26b950)),null,_0x6c6f61));});});}function checkHopper(){function _0x30f7e4(){return function(_0x91c937){logger[_0x1cb9('0x12')](_0x1cb9('0x2e'),_0x1cb9('0x2f'),util[_0x1cb9('0x30')](_0x91c937,{'showHidden':![],'depth':null}));};}var _0x3f5637=function(_0x4d3e39,_0x2aa59b){var _0x1482c4=squel[_0x1cb9('0x31')]()['into'](_0x1cb9('0x32'))['fromQuery']([_0x1cb9('0x33'),'scheduledAt',_0x1cb9('0x34'),_0x1cb9('0x23'),_0x2aa59b,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),'phone')['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x4d3e39['id'][_0x1cb9('0x3b')](),_0x2aa59b)['field']('NOW()','createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))['where'](_0x1cb9('0x3e'))['where'](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('phone\x20IS\x20NOT\x20NULL')[_0x1cb9('0x40')]('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone')['from'](_0x1cb9('0x32'))[_0x1cb9('0x40')](_0x2aa59b+_0x1cb9('0x41'),_0x4d3e39['id'][_0x1cb9('0x3b')]())))[_0x1cb9('0x3b')]();return _0x1482c4;};var _0x58832e=function(_0x11d877,_0x5594fc){var _0x4c59e7=squel['insert']()[_0x1cb9('0x42')](_0x1cb9('0x32'))[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x5594fc,_0x1cb9('0x35'),_0x1cb9('0x36')],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')]('phone',_0x1cb9('0x33'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'scheduledAt')[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x11d877['id'][_0x1cb9('0x3b')](),_0x5594fc)['field'](_0x1cb9('0x39'),'createdAt')[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')]('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46'))['where']('phone\x20NOT\x20IN\x20(?)',squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x47'))[_0x1cb9('0x3c')](_0x1cb9('0x48'))[_0x1cb9('0x40')](_0x5594fc+_0x1cb9('0x41'),_0x11d877['id'][_0x1cb9('0x3b')]()))[_0x1cb9('0x40')](_0x1cb9('0x49'),squel['select']()[_0x1cb9('0x38')]('phone')[_0x1cb9('0x3c')]('cm_hopper')[_0x1cb9('0x40')](_0x5594fc+'\x20=\x20?',_0x11d877['id']['toString']())))[_0x1cb9('0x3b')]();return _0x4c59e7;};function _0x3b0c2e(_0x303da3,_0x4bce54){var _0x3c157f=squel[_0x1cb9('0x31')]()['into']('cm_hopper')[_0x1cb9('0x43')]([_0x1cb9('0x33'),_0x1cb9('0x3a'),_0x1cb9('0x34'),_0x1cb9('0x23'),_0x4bce54,_0x1cb9('0x35'),_0x1cb9('0x36')],squel['select']()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))['field'](_0x1cb9('0x39'),_0x1cb9('0x3a'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))[_0x1cb9('0x38')](LISTID[_0x1cb9('0x3b')](),'ListId')[_0x1cb9('0x38')](_0x303da3['id'][_0x1cb9('0x3b')](),_0x4bce54)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x36'))[_0x1cb9('0x3c')](_0x1cb9('0x3d'))[_0x1cb9('0x40')]('deletedAt\x20IS\x20NULL')[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())[_0x1cb9('0x40')]('id\x20IN\x20?',squel['str'](hopperContacts))[_0x1cb9('0x40')](_0x1cb9('0x46')))[_0x1cb9('0x3b')]();return _0x3c157f;}function _0x173db5(_0x3c2f9c,_0x75c734){var _0xc515a6=squel[_0x1cb9('0x31')]()['into']('cm_hopper_black')[_0x1cb9('0x43')](['phone','ContactId','ListId',_0x75c734,'createdAt','updatedAt'],squel[_0x1cb9('0x37')]()[_0x1cb9('0x38')](_0x1cb9('0x33'),_0x1cb9('0x33'))[_0x1cb9('0x38')]('id',_0x1cb9('0x34'))['field'](LISTID[_0x1cb9('0x3b')](),_0x1cb9('0x23'))['field'](_0x3c2f9c['id']['toString'](),_0x75c734)[_0x1cb9('0x38')](_0x1cb9('0x39'),_0x1cb9('0x35'))[_0x1cb9('0x38')](_0x1cb9('0x39'),'updatedAt')['from']('cm_contacts')[_0x1cb9('0x40')](_0x1cb9('0x3e'))[_0x1cb9('0x40')](_0x1cb9('0x3f'),LISTID[_0x1cb9('0x3b')]())['where'](_0x1cb9('0x44'),squel[_0x1cb9('0x45')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0x1cb9('0x3b')]();return _0xc515a6;}return db['VoiceQueue'][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x4aeeff){var _0xde0d93=[];if(_0x4aeeff){var _0x15fc04;for(var _0x330fc1=0x0,_0x17c361;_0x330fc1<_0x4aeeff['length'];_0x330fc1+=0x1){_0x17c361=_0x4aeeff[_0x330fc1]['get']({'plain':!![]});switch(_0x17c361[_0x1cb9('0x4c')]){case _0x1cb9('0x4f'):_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x17c361,_0x1cb9('0x52')))['then'](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;case'onlyIfOpen':_0xde0d93[_0x1cb9('0x2a')](db[_0x1cb9('0x50')]['query'](_0x3f5637(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0xde0d93['push'](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x17c361,_0x1cb9('0x52')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}}return _0xde0d93;})[_0x1cb9('0x53')]()['then'](function(){return db[_0x1cb9('0x54')][_0x1cb9('0x4a')]({'where':{'type':_0x1cb9('0x4b')},'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x128a41){var _0x37bcd9=[];if(_0x128a41){var _0x4cd544;for(var _0x28bac2=0x0,_0x78e9c;_0x28bac2<_0x128a41['length'];_0x28bac2+=0x1){_0x78e9c=_0x128a41[_0x28bac2][_0x1cb9('0x56')]({'plain':!![]});_0x37bcd9['push'](db[_0x1cb9('0x50')]['query'](_0x173db5(_0x78e9c,'VoiceQueueId'))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x37bcd9;})['all']();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id',_0x1cb9('0x4c')],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x4e'),'where':{'id':LISTID}}]})['then'](function(_0x45ca54){var _0x3d25a3=[];if(_0x45ca54){for(var _0x2a157d=0x0,_0x27cc3c;_0x2a157d<_0x45ca54[_0x1cb9('0x19')];_0x2a157d+=0x1){_0x27cc3c=_0x45ca54[_0x2a157d][_0x1cb9('0x56')]({'plain':!![]});switch(_0x27cc3c['dialCheckDuplicateType']){case _0x1cb9('0x4f'):_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x58832e(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));break;case _0x1cb9('0x58'):_0x3d25a3[_0x1cb9('0x2a')](db['sequelize'][_0x1cb9('0x51')](_0x3f5637(_0x27cc3c,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));break;default:_0x3d25a3[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x3b0c2e(_0x27cc3c,'CampaignId'))[_0x1cb9('0x29')](function(){})['catch'](_0x30f7e4()));}}}return _0x3d25a3;})[_0x1cb9('0x53')]();})[_0x1cb9('0x29')](function(){return db['Campaign'][_0x1cb9('0x4a')]({'attributes':['id'],'include':[{'model':db[_0x1cb9('0x4d')],'as':_0x1cb9('0x55'),'where':{'id':LISTID}}]})[_0x1cb9('0x29')](function(_0x56f23d){var _0x113367=[];if(_0x56f23d){for(var _0x39b0cb=0x0,_0x429371;_0x39b0cb<_0x56f23d['length'];_0x39b0cb+=0x1){_0x429371=_0x56f23d[_0x39b0cb][_0x1cb9('0x56')]({'plain':!![]});_0x113367[_0x1cb9('0x2a')](db[_0x1cb9('0x50')][_0x1cb9('0x51')](_0x173db5(_0x429371,_0x1cb9('0x57')))[_0x1cb9('0x29')](function(){})[_0x1cb9('0x2c')](_0x30f7e4()));}}return _0x113367;})['all']();})[_0x1cb9('0x2c')](function(_0x4b15a4){logger[_0x1cb9('0x12')](_0x1cb9('0x59'),_0x1cb9('0x5a'),_0x4b15a4[_0x1cb9('0x1a')]);});}var processPromises=function(_0x4bdbd2){return BPromise[_0x1cb9('0x53')](promises)[_0x1cb9('0x29')](function(_0x5e68a1){})[_0x1cb9('0x2c')](function(_0x416508){logger[_0x1cb9('0x12')](_0x1cb9('0x5b'),JSON[_0x1cb9('0x2d')](_0x416508));})['finally'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4bdbd2){return _0x4bdbd2['resume']();}});};var endCsv=function(){return BPromise[_0x1cb9('0x5c')]()[_0x1cb9('0x29')](function(){if(hopperContacts){return checkHopper();}})[_0x1cb9('0x29')](function(){socket[_0x1cb9('0x5d')](_0x1cb9('0x5e')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x1cb9('0x5f')](FILEPATH);}catch(_0x1e6402){logger[_0x1cb9('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0x1cb9('0x2d')](_0x1e6402));}finally{process[_0x1cb9('0x60')](0x0);}});};process['on'](_0x1cb9('0x61'),function(){logger['info'](_0x1cb9('0x62'));endCsv();});function main(){return BPromise[_0x1cb9('0x5c')]()['then'](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0x1cb9('0x11')](',');return db[_0x1cb9('0x26')][_0x1cb9('0x4a')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x1cb9('0x29')](function(_0x5cb5e5){var _0x2c0416=fs[_0x1cb9('0x63')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x2c0416,{'header':!![],'skipEmptyLines':!![],'step':function(_0x5bd78d,_0x1f2d69){total+=0x1;var _0x3ba0a5=total;promises['push'](checkRow(_0x5bd78d,_0x5cb5e5,_0x3ba0a5)['then'](function(){success+=0x1;})[_0x1cb9('0x2c')](function(_0x3486e5){if(_0x3486e5['error']){errors+=0x1;delete _0x3486e5['error'];}else if(_0x3486e5[_0x1cb9('0x24')]){duplicates+=0x1;delete _0x3486e5['duplicate'];}rows['push'](_0x3486e5);}));if(total%0xc8===0x0){_0x1f2d69['pause']();return processPromises(_0x1f2d69);}},'complete':function(){return processPromises()[_0x1cb9('0x29')](function(){logger['info'](_0x1cb9('0x64'));endCsv();});},'error':function(_0x3c717b,_0x33ec43){logger['info'](_0x1cb9('0x65'),JSON[_0x1cb9('0x2d')](_0x3c717b));endCsv();}});})[_0x1cb9('0x2c')](function(_0x4c54b5){logger[_0x1cb9('0x12')](_0x1cb9('0x66'),JSON[_0x1cb9('0x2d')](_0x4c54b5));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 65a62de..13ad086 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 _0x0cc7=['deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','Received\x20SIGINT','message','errors','push','code','info','sequelize','query','spread','catch','send','start','socket_timestamp','root','server/files/tmp','.csv','header','parse','createReadStream','data','length','rows','hasOwnProperty','trim','replace','YYYY-MM-DD\x20HH:mm:ss','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','SystemRow','appendFileSync','emit','contact:import:','Abort\x20parser','abort','SystemError','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues_has_cm_lists','VoiceQueueId','voice_queues_has_cm_blacklists','voice_queues','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','then','finish','affectedRows','unlink','exit','error','argv','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','binding','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','socket.io-emitter','format','select','field','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','fromQuery','phone','scheduledat','ContactId','ListId','createdAt','updatedAt','priority','UserId','recallme','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','toString','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','.CmListId','\x20=\x20?','keys','CompanyId',')\x20NOT\x20IN\x20?'];(function(_0x35b38b,_0xf4b410){var _0x41b107=function(_0x4590b5){while(--_0x4590b5){_0x35b38b['push'](_0x35b38b['shift']());}};_0x41b107(++_0xf4b410);}(_0x0cc7,0x1f3));var _0x70cc=function(_0xa8883,_0x1f107f){_0xa8883=_0xa8883-0x0;var _0x479426=_0x0cc7[_0xa8883];return _0x479426;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x70cc('0x0'));var Papa=require(_0x70cc('0x1'));var util=require(_0x70cc('0x2'));var BPromise=require(_0x70cc('0x3'));var moment=require(_0x70cc('0x4'));var squel=require('squel');var Redis=require(_0x70cc('0x5'));var db=require(_0x70cc('0x6'))['db'];var config=require(_0x70cc('0x7'));var logger=require('../../../config/logger')(_0x70cc('0x8'));config[_0x70cc('0x9')]=_[_0x70cc('0xa')](config[_0x70cc('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x70cc('0xb'))(new Redis(config[_0x70cc('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x70cc('0xc')]('YYYY-MM-DD\x20HH:mm:ss');function isEmail(_0x23adba){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'](_0x23adba);}function selectNotIn(_0x30c029,_0x3ccd5d,_0x2c1ad2,_0x47f55c,_0x5d4656){return squel[_0x70cc('0xd')]()[_0x70cc('0xe')]('phone')[_0x70cc('0xf')](_0x47f55c)[_0x70cc('0x10')](_0x3ccd5d,null,_0x3ccd5d+_0x70cc('0x11')+_0x47f55c+'.'+_0x2c1ad2)[_0x70cc('0x12')](_0x47f55c+'.'+_0x2c1ad2+_0x70cc('0x13')+_0x30c029+'.'+_0x2c1ad2)[_0x70cc('0x12')](_0x3ccd5d+'.dialCheckDuplicateType\x20IN\x20('+_0x5d4656[_0x70cc('0x10')]()+')');}function insertCmHopper(_0x3466f1,_0x5041b5,_0x242d09,_0x57281b,_0x54544b){var _0x5ceb6b=['cm_contacts.phone',_0x70cc('0x14'),_0x70cc('0x15'),'cm_contacts.ListId',_0x5041b5+'.'+_0x57281b,_0x70cc('0x16'),_0x70cc('0x17'),_0x70cc('0x18'),_0x70cc('0x19'),'\x22'+_0x54544b+'\x22'];return squel[_0x70cc('0x1a')]()[_0x70cc('0x1b')](_0x70cc('0x1c'))[_0x70cc('0x1d')]([_0x70cc('0x1e'),_0x70cc('0x1f'),_0x70cc('0x20'),_0x70cc('0x21'),_0x57281b,_0x70cc('0x22'),_0x70cc('0x23'),_0x70cc('0x24'),_0x70cc('0x25'),_0x70cc('0x26')],squel[_0x70cc('0xd')]()[_0x70cc('0x27')](_0x5ceb6b)[_0x70cc('0xf')](_0x5041b5)[_0x70cc('0x10')](_0x70cc('0x28'),null,'cm_contacts.ListId\x20=\x20'+_0x5041b5+'.CmListId')['join'](_0x242d09,null,_0x242d09+'.id\x20=\x20'+_0x5041b5+'.'+_0x57281b)[_0x70cc('0x12')](_0x5041b5+_0x70cc('0x29'),_0x3466f1)[_0x70cc('0x12')](_0x70cc('0x2a'),NOW)['where'](_0x70cc('0x2b'),selectNotIn(_0x5041b5,_0x242d09,_0x57281b,_0x70cc('0x1c'),['\x22always\x22','\x22onlyIfOpen\x22']))['where']('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x5041b5,_0x242d09,_0x57281b,_0x70cc('0x1c'),['\x22always\x22'])))[_0x70cc('0x2c')]();}function insertCmHopperBlack(_0x1f7019,_0x5954e1,_0x145e24,_0x3aa11c){var _0x3bf8b2=[_0x70cc('0x2d'),'cm_contacts.id',_0x70cc('0x2e'),_0x5954e1+'.'+_0x3aa11c,_0x70cc('0x16'),_0x70cc('0x17')];return squel[_0x70cc('0x1a')]()[_0x70cc('0x1b')](_0x70cc('0x2f'))[_0x70cc('0x1d')](['phone',_0x70cc('0x20'),_0x70cc('0x21'),_0x3aa11c,_0x70cc('0x22'),_0x70cc('0x23')],squel[_0x70cc('0xd')]()['fields'](_0x3bf8b2)[_0x70cc('0xf')](_0x5954e1)[_0x70cc('0x10')]('cm_contacts',null,'cm_contacts.ListId\x20=\x20'+_0x5954e1+_0x70cc('0x30'))[_0x70cc('0x10')](_0x145e24,null,_0x145e24+'.id\x20=\x20'+_0x5954e1+'.'+_0x3aa11c)[_0x70cc('0x12')](_0x5954e1+'.CmListId\x20=\x20?',_0x1f7019)[_0x70cc('0x12')](_0x70cc('0x2a'),NOW)[_0x70cc('0x12')](_0x70cc('0x2b'),squel['select']()[_0x70cc('0xe')](_0x70cc('0x1e'))['from'](_0x70cc('0x2f'))[_0x70cc('0x12')]('ListId\x20=\x20?',_0x1f7019)[_0x70cc('0x12')](_0x3aa11c+_0x70cc('0x31'),_0x5954e1+'.'+_0x3aa11c)))[_0x70cc('0x2c')]();}function insertCmContact(_0x5dea9c,_0x183dc1,_0x9ffdf2,_0x46c3aa){var _0x5c5b13=_['concat'](_[_0x70cc('0x32')](_0x46c3aa),[_0x70cc('0x21'),_0x70cc('0x33'),_0x70cc('0x22'),_0x70cc('0x23')]);return squel[_0x70cc('0x1a')]()[_0x70cc('0x1b')]('cm_contacts')['fromQuery'](_0x5c5b13,squel[_0x70cc('0xd')]()[_0x70cc('0x27')](_0x5c5b13)['from'](_0x183dc1)['where']('('+_0x9ffdf2[_0x70cc('0x10')](',')+_0x70cc('0x34'),squel[_0x70cc('0xd')]()[_0x70cc('0x27')](_0x9ffdf2)['from'](_0x70cc('0x28'))[_0x70cc('0x12')]('ListId\x20=\x20?',_0x5dea9c)['where'](_0x70cc('0x35')))[_0x70cc('0x12')](_0x70cc('0x36'),squel[_0x70cc('0xd')]()[_0x70cc('0xe')](_0x70cc('0x37'),_0x70cc('0x38'))[_0x70cc('0xf')](_0x183dc1)[_0x70cc('0x39')](_0x9ffdf2[_0x70cc('0x10')](','))))['toString']();}function handleStop(){logger['info'](_0x70cc('0x3a'));stopped=!![];}function handleUncaughtException(_0x3caa3a){logger['error'](_0x3caa3a[_0x70cc('0x3b')]);process['exit'](0x1);}function handleError(_0x42d492,_0x3f7305){stats[_0x70cc('0x3c')][_0x70cc('0x3d')]({'name':_0x3f7305[_0x70cc('0x3e')],'message':_0x3f7305[_0x70cc('0x3b')],'row':_0x42d492});}function handleQuery(_0x54640f){logger[_0x70cc('0x3f')](_0x54640f);return db[_0x70cc('0x40')][_0x70cc('0x41')](_0x54640f)[_0x70cc('0x42')](function(_0x5d6163){results['push'](_0x5d6163);})[_0x70cc('0x43')](function(_0x46f771){logger['error'](_0x46f771[_0x70cc('0x3b')]);});}function main(_0x3070c4,_0x2e5d0d,_0x422348,_0x507586){logger[_0x70cc('0x3f')]('main',_0x3070c4,JSON['stringify'](_0x2e5d0d));process[_0x70cc('0x44')](_0x70cc('0x45'));var _0x48f6a8=_0x2e5d0d['binding'];var _0x2ec9ce=_0x2e5d0d[_0x70cc('0x46')];var _0x531549=path[_0x70cc('0x10')](config[_0x70cc('0x47')],_0x70cc('0x48'),_0x2ec9ce+_0x70cc('0x49'));var _0x28401e=_[_0x70cc('0x32')](_0x48f6a8)[_0x70cc('0x10')]();logger[_0x70cc('0x3f')](_0x70cc('0x4a'),_0x28401e);fs['writeFileSync'](_0x531549,_0x28401e+'\x0a');Papa[_0x70cc('0x4b')](fs[_0x70cc('0x4c')](_0x3070c4),{'header':!![],'skipEmptyLines':!![],'step':function(_0xf3e0a2,_0x12577e){try{for(var _0x358059=0x0,_0x398f3d=[];_0x358059<_0xf3e0a2[_0x70cc('0x4d')][_0x70cc('0x4e')];_0x358059++){stats[_0x70cc('0x4f')]+=0x1;if(_0xf3e0a2[_0x70cc('0x3c')][_0x358059]){handleError(_0xf3e0a2[_0x70cc('0x4d')][_0x358059],_0xf3e0a2[_0x70cc('0x3c')][_0x358059]);}else{var _0x3ace8e=[];for(var _0x5e8ac0 in _0x48f6a8){if(_0x48f6a8[_0x70cc('0x50')](_0x5e8ac0)){if(_0xf3e0a2[_0x70cc('0x4d')][_0x358059][_0x48f6a8[_0x5e8ac0]]){var _0xde363=_[_0x70cc('0x51')](_0xf3e0a2['data'][_0x358059][_0x48f6a8[_0x5e8ac0]][_0x70cc('0x52')](/"/g,'\x27'));switch(_0x5e8ac0){case _0x70cc('0x1f'):var _0x53112a=moment(_0xde363,_0x70cc('0x53'),!![]);if(_0x53112a['isValid']()){_0x398f3d[_0x70cc('0x3d')]('\x22'+_0xde363+'\x22');}else{_0x3ace8e[_0x70cc('0x3d')](_0x70cc('0x54'));}break;case _0x70cc('0x24'):var _0x1d6b65=parseInt(_0xde363);_0xde363=_[_0x70cc('0x55')](_0x1d6b65)||_0x1d6b65<0x0||_0x1d6b65>0x4?_0x507586?0x3:0x2:_0x1d6b65;_0x398f3d[_0x70cc('0x3d')]('\x22'+_0xde363+'\x22');break;case'UserId':var _0x201c86=parseInt(_0xde363);if(_[_0x70cc('0x56')](_0x201c86)&&_[_0x70cc('0x57')](_0x422348,_0x201c86)){_0x398f3d[_0x70cc('0x3d')]('\x22'+_0x201c86+'\x22');}else{_0x3ace8e[_0x70cc('0x3d')](_0x70cc('0x58'));}break;case _0x70cc('0x59'):if(isEmail(_0xde363)){_0x398f3d[_0x70cc('0x3d')]('\x22'+_0xde363+'\x22');}else{_0x3ace8e[_0x70cc('0x3d')]('email\x20wrong\x20format');}break;case _0x70cc('0x5a'):var _0x4bddb8=moment(_0xde363,_0x70cc('0x5b'),!![]);if(_0x4bddb8[_0x70cc('0x5c')]()){_0x398f3d[_0x70cc('0x3d')]('\x22'+_0xde363+'\x22');}else{_0x3ace8e[_0x70cc('0x3d')](_0x70cc('0x5d'));}break;default:_0x398f3d['push']('\x22'+_0xde363+'\x22');}}else{switch(_0x5e8ac0){case _0x70cc('0x5e'):case _0x70cc('0x1e'):_0x3ace8e[_0x70cc('0x3d')](_0x5e8ac0+_0x70cc('0x5f'));break;default:_0x398f3d[_0x70cc('0x3d')]('\x22\x22');}}}}if(_0x3ace8e[_0x70cc('0x4e')]){handleError(_0xf3e0a2[_0x70cc('0x4d')][_0x358059],{'code':_0x70cc('0x60'),'message':_0x3ace8e[_0x70cc('0x10')]()});}else{fs[_0x70cc('0x61')](_0x531549,_0x398f3d[_0x70cc('0x10')]()+'\x0a');}_0x398f3d=[];}if(!(stats[_0x70cc('0x4f')]%0xc8)){socket[_0x70cc('0x62')](_0x70cc('0x63')+_0x2ec9ce,stats);stats['errors']=[];}}if(stopped){logger['info'](_0x70cc('0x64'));_0x12577e[_0x70cc('0x65')]();}}catch(_0x3372a0){handleError(_0xf3e0a2[_0x70cc('0x4d')][_0x358059],{'code':_0x70cc('0x66'),'message':_0x3372a0['message']});logger['error'](_0x70cc('0x67'),_0x3372a0['message']);}},'complete':function(){try{var _0x5325dc=[];var _0x207ad0=_0x70cc('0x28');if(_0x2e5d0d['duplicates']&&_0x2e5d0d[_0x70cc('0x68')][_0x70cc('0x4e')]){_0x207ad0=_0x70cc('0x69')+_0x2ec9ce;_0x5325dc[_0x70cc('0x3d')](_0x70cc('0x6a')+_0x207ad0+_0x70cc('0x6b'));}var _0x56dc34=util[_0x70cc('0xc')](_0x70cc('0x6c'),_0x531549,_0x207ad0,_0x28401e,_0x2e5d0d['ListId'],_0x2e5d0d['CompanyId']||null,NOW,NOW);if(_[_0x70cc('0x6d')](_0x48f6a8['scheduledat'])){_0x56dc34+=_0x70cc('0x6e');}_0x5325dc[_0x70cc('0x3d')](_0x56dc34);if(_0x2e5d0d['duplicates']&&_0x2e5d0d[_0x70cc('0x68')][_0x70cc('0x4e')]){_0x5325dc[_0x70cc('0x3d')](insertCmContact(_0x2e5d0d[_0x70cc('0x21')],_0x207ad0,_0x2e5d0d[_0x70cc('0x68')],_0x48f6a8));_0x5325dc[_0x70cc('0x3d')]('DROP\x20TABLE\x20'+_0x207ad0+';');}_0x5325dc[_0x70cc('0x3d')](insertCmHopper(_0x2e5d0d['ListId'],_0x70cc('0x6f'),'voice_queues',_0x70cc('0x70'),_0x507586));_0x5325dc['push'](insertCmHopperBlack(_0x2e5d0d[_0x70cc('0x21')],_0x70cc('0x71'),_0x70cc('0x72'),'VoiceQueueId'));_0x5325dc[_0x70cc('0x3d')](insertCmHopper(_0x2e5d0d['ListId'],_0x70cc('0x73'),_0x70cc('0x74'),_0x70cc('0x75'),_0x507586));_0x5325dc[_0x70cc('0x3d')](insertCmHopperBlack(_0x2e5d0d[_0x70cc('0x21')],_0x70cc('0x76'),_0x70cc('0x74'),_0x70cc('0x75')));BPromise[_0x70cc('0x77')](_0x5325dc,handleQuery)[_0x70cc('0x78')](function(_0xac068b){stats[_0x70cc('0x79')]=!![];stats[_0x70cc('0x7a')]=_0x2e5d0d[_0x70cc('0x68')]&&_0x2e5d0d[_0x70cc('0x68')][_0x70cc('0x4e')]?results[0x2]['affectedRows']:results[0x0][_0x70cc('0x7a')];socket[_0x70cc('0x62')]('contact:import:'+_0x2ec9ce,stats);fs[_0x70cc('0x7b')](_0x3070c4);fs[_0x70cc('0x7b')](_0x531549);process[_0x70cc('0x7c')](0x0);})[_0x70cc('0x43')](function(_0x482eea){logger[_0x70cc('0x7d')](_0x482eea[_0x70cc('0x3b')]);process['exit'](0x1);});}catch(_0x19bd2f){logger[_0x70cc('0x7d')]('complete',_0x19bd2f[_0x70cc('0x3b')]);process[_0x70cc('0x7c')](0x1);}},'error':function(_0x5d5568,_0x193725,_0x83b8e6,_0x135b64){throw new Error(_0x135b64);}});}function validate(){if(process[_0x70cc('0x7e')]&&process[_0x70cc('0x7e')][_0x70cc('0x4e')]<0x4){throw new Error('arguments\x20\x20\x20');}var _0x42154c=path[_0x70cc('0x10')](config[_0x70cc('0x47')],_0x70cc('0x48'),process['argv'][0x2]);if(!fs[_0x70cc('0x7f')](_0x42154c)){throw new Error(_0x70cc('0x80'));}var _0x1bcb64={};try{_0x1bcb64=JSON[_0x70cc('0x4b')](process[_0x70cc('0x7e')][0x3]);if(!_0x1bcb64['binding']){throw new Error(_0x70cc('0x81'));}if(!_0x1bcb64['binding'][_0x70cc('0x1e')]){throw new Error(_0x70cc('0x82'));}if(!_0x1bcb64[_0x70cc('0x83')][_0x70cc('0x5e')]){throw new Error(_0x70cc('0x84'));}var _0xc7f35b=0x0;if(_0x1bcb64[_0x70cc('0x83')][_0x70cc('0x25')]){_0xc7f35b=0x1;}if(!_0x1bcb64[_0x70cc('0x21')]){throw new Error(_0x70cc('0x85'));}}catch(_0x2bd651){throw new Error(_0x70cc('0x86'));}var _0x36f9e0=[];try{_0x36f9e0=_[_0x70cc('0x87')](JSON['parse'](process[_0x70cc('0x7e')][0x4]),'id');}catch(_0x15f884){logger['info'](_0x70cc('0x88'));}main(_0x42154c,_0x1bcb64,_0x36f9e0,_0xc7f35b);}validate();process['on'](_0x70cc('0x89'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file +var _0x25c1=['exit','errors','push','code','message','info','query','spread','catch','main','stringify','send','start','binding','root','server/files/tmp','writeFileSync','parse','data','length','rows','hasOwnProperty','trim','replace','isValid','isNaN','UserId','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','SystemRow','appendFileSync','emit','Abort\x20parser','duplicates','cm_contacts_','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27','isNil',',\x20scheduledAt\x20=\x20NOW()','voice_queues','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','campaigns_has_cm_blacklists','finish','affectedRows','contact:import:','unlink','argv','arguments\x20\x20\x20','existsSync','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','bluebird','moment','squel','../../../mysqldb','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','phone','from','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','fromQuery','scheduledat','ContactId','ListId','createdAt','priority','recallme','fields','cm_contacts','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','cm_hopper','toString','cm_contacts.phone','cm_contacts.id','cm_hopper_black','updatedAt','cm_contacts.ListId\x20=\x20','.CmListId','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','MIN(id)','min_id','group','error'];(function(_0x4ad5d8,_0x506815){var _0x404bfe=function(_0x1eaf85){while(--_0x1eaf85){_0x4ad5d8['push'](_0x4ad5d8['shift']());}};_0x404bfe(++_0x506815);}(_0x25c1,0x148));var _0x125c=function(_0x1b690b,_0xdd5468){_0x1b690b=_0x1b690b-0x0;var _0x2cebff=_0x25c1[_0x1b690b];return _0x2cebff;};'use strict';var fs=require('fs');var path=require(_0x125c('0x0'));var _=require(_0x125c('0x1'));var Papa=require(_0x125c('0x2'));var util=require('util');var BPromise=require(_0x125c('0x3'));var moment=require(_0x125c('0x4'));var squel=require(_0x125c('0x5'));var Redis=require('ioredis');var db=require(_0x125c('0x6'))['db'];var config=require('../../../config/environment');var logger=require(_0x125c('0x7'))(_0x125c('0x8'));config[_0x125c('0x9')]=_['defaults'](config[_0x125c('0x9')],{'host':_0x125c('0xa'),'port':0x18eb});var socket=require(_0x125c('0xb'))(new Redis(config[_0x125c('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x125c('0xc')](_0x125c('0xd'));function isEmail(_0x4b0e0b){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))*$/[_0x125c('0xe')](_0x4b0e0b);}function selectNotIn(_0x152307,_0x517442,_0x4ca701,_0x38f4fe,_0xe5256c){return squel[_0x125c('0xf')]()['field'](_0x125c('0x10'))[_0x125c('0x11')](_0x38f4fe)[_0x125c('0x12')](_0x517442,null,_0x517442+_0x125c('0x13')+_0x38f4fe+'.'+_0x4ca701)[_0x125c('0x14')](_0x38f4fe+'.'+_0x4ca701+_0x125c('0x15')+_0x152307+'.'+_0x4ca701)[_0x125c('0x14')](_0x517442+'.dialCheckDuplicateType\x20IN\x20('+_0xe5256c[_0x125c('0x12')]()+')');}function insertCmHopper(_0x1aff5f,_0x4ba45e,_0x41fe2b,_0x460e6e,_0x3c9744){var _0x4ee755=['cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id',_0x125c('0x16'),_0x4ba45e+'.'+_0x460e6e,_0x125c('0x17'),_0x125c('0x18'),_0x125c('0x19'),_0x125c('0x1a'),'\x22'+_0x3c9744+'\x22'];return squel[_0x125c('0x1b')]()[_0x125c('0x1c')]('cm_hopper')[_0x125c('0x1d')]([_0x125c('0x10'),_0x125c('0x1e'),_0x125c('0x1f'),_0x125c('0x20'),_0x460e6e,_0x125c('0x21'),'updatedAt',_0x125c('0x22'),'UserId',_0x125c('0x23')],squel[_0x125c('0xf')]()[_0x125c('0x24')](_0x4ee755)[_0x125c('0x11')](_0x4ba45e)['join'](_0x125c('0x25'),null,'cm_contacts.ListId\x20=\x20'+_0x4ba45e+'.CmListId')[_0x125c('0x12')](_0x41fe2b,null,_0x41fe2b+'.id\x20=\x20'+_0x4ba45e+'.'+_0x460e6e)[_0x125c('0x14')](_0x4ba45e+_0x125c('0x26'),_0x1aff5f)[_0x125c('0x14')](_0x125c('0x27'),NOW)[_0x125c('0x14')](_0x125c('0x28'),selectNotIn(_0x4ba45e,_0x41fe2b,_0x460e6e,'cm_hopper',['\x22always\x22',_0x125c('0x29')]))['where'](_0x125c('0x28'),selectNotIn(_0x4ba45e,_0x41fe2b,_0x460e6e,_0x125c('0x2a'),['\x22always\x22'])))[_0x125c('0x2b')]();}function insertCmHopperBlack(_0x5c17c4,_0x25a318,_0x5892b2,_0x485ddc){var _0x1f398a=[_0x125c('0x2c'),_0x125c('0x2d'),_0x125c('0x16'),_0x25a318+'.'+_0x485ddc,_0x125c('0x17'),_0x125c('0x18')];return squel[_0x125c('0x1b')]()['into'](_0x125c('0x2e'))['fromQuery']([_0x125c('0x10'),'ContactId','ListId',_0x485ddc,_0x125c('0x21'),_0x125c('0x2f')],squel[_0x125c('0xf')]()[_0x125c('0x24')](_0x1f398a)['from'](_0x25a318)[_0x125c('0x12')](_0x125c('0x25'),null,_0x125c('0x30')+_0x25a318+_0x125c('0x31'))['join'](_0x5892b2,null,_0x5892b2+_0x125c('0x13')+_0x25a318+'.'+_0x485ddc)[_0x125c('0x14')](_0x25a318+_0x125c('0x26'),_0x5c17c4)[_0x125c('0x14')](_0x125c('0x27'),NOW)[_0x125c('0x14')](_0x125c('0x28'),squel[_0x125c('0xf')]()['field'](_0x125c('0x10'))[_0x125c('0x11')]('cm_hopper_black')[_0x125c('0x14')](_0x125c('0x32'),_0x5c17c4)[_0x125c('0x14')](_0x485ddc+_0x125c('0x33'),_0x25a318+'.'+_0x485ddc)))[_0x125c('0x2b')]();}function insertCmContact(_0x60e421,_0x5ae0cb,_0x440c68,_0x26c54d){var _0x571202=_[_0x125c('0x34')](_[_0x125c('0x35')](_0x26c54d),[_0x125c('0x20'),_0x125c('0x36'),'createdAt',_0x125c('0x2f')]);return squel[_0x125c('0x1b')]()[_0x125c('0x1c')]('cm_contacts')[_0x125c('0x1d')](_0x571202,squel[_0x125c('0xf')]()[_0x125c('0x24')](_0x571202)[_0x125c('0x11')](_0x5ae0cb)[_0x125c('0x14')]('('+_0x440c68[_0x125c('0x12')](',')+_0x125c('0x37'),squel[_0x125c('0xf')]()[_0x125c('0x24')](_0x440c68)['from']('cm_contacts')['where']('ListId\x20=\x20?',_0x60e421)['where'](_0x125c('0x38')))[_0x125c('0x14')](_0x125c('0x39'),squel[_0x125c('0xf')]()['field'](_0x125c('0x3a'),_0x125c('0x3b'))[_0x125c('0x11')](_0x5ae0cb)[_0x125c('0x3c')](_0x440c68[_0x125c('0x12')](','))))[_0x125c('0x2b')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x2a2f68){logger[_0x125c('0x3d')](_0x2a2f68['message']);process[_0x125c('0x3e')](0x1);}function handleError(_0x20bbf2,_0x302f7d){stats[_0x125c('0x3f')][_0x125c('0x40')]({'name':_0x302f7d[_0x125c('0x41')],'message':_0x302f7d[_0x125c('0x42')],'row':_0x20bbf2});}function handleQuery(_0x1515fa){logger[_0x125c('0x43')](_0x1515fa);return db['sequelize'][_0x125c('0x44')](_0x1515fa)[_0x125c('0x45')](function(_0x150488){results[_0x125c('0x40')](_0x150488);})[_0x125c('0x46')](function(_0x158803){logger[_0x125c('0x3d')](_0x158803[_0x125c('0x42')]);});}function main(_0x5869ee,_0x1c59d2,_0x18f4e2,_0x641b8b){logger[_0x125c('0x43')](_0x125c('0x47'),_0x5869ee,JSON[_0x125c('0x48')](_0x1c59d2));process[_0x125c('0x49')](_0x125c('0x4a'));var _0x2c2c5f=_0x1c59d2[_0x125c('0x4b')];var _0xecb58d=_0x1c59d2['socket_timestamp'];var _0x3e4b2d=path[_0x125c('0x12')](config[_0x125c('0x4c')],_0x125c('0x4d'),_0xecb58d+'.csv');var _0x43dcf3=_[_0x125c('0x35')](_0x2c2c5f)[_0x125c('0x12')]();logger[_0x125c('0x43')]('header',_0x43dcf3);fs[_0x125c('0x4e')](_0x3e4b2d,_0x43dcf3+'\x0a');Papa[_0x125c('0x4f')](fs['createReadStream'](_0x5869ee),{'header':!![],'skipEmptyLines':!![],'step':function(_0x8f6197,_0x49afd5){try{for(var _0x50f386=0x0,_0xdc24b2=[];_0x50f386<_0x8f6197[_0x125c('0x50')][_0x125c('0x51')];_0x50f386++){stats[_0x125c('0x52')]+=0x1;if(_0x8f6197[_0x125c('0x3f')][_0x50f386]){handleError(_0x8f6197[_0x125c('0x50')][_0x50f386],_0x8f6197[_0x125c('0x3f')][_0x50f386]);}else{var _0x196ee6=[];for(var _0x3fd470 in _0x2c2c5f){if(_0x2c2c5f[_0x125c('0x53')](_0x3fd470)){if(_0x8f6197[_0x125c('0x50')][_0x50f386][_0x2c2c5f[_0x3fd470]]){var _0x5f1311=_[_0x125c('0x54')](_0x8f6197[_0x125c('0x50')][_0x50f386][_0x2c2c5f[_0x3fd470]][_0x125c('0x55')](/"/g,'\x27'));switch(_0x3fd470){case _0x125c('0x1e'):var _0x530ae3=moment(_0x5f1311,_0x125c('0xd'),!![]);if(_0x530ae3[_0x125c('0x56')]()){_0xdc24b2[_0x125c('0x40')]('\x22'+_0x5f1311+'\x22');}else{_0x196ee6[_0x125c('0x40')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x125c('0x22'):var _0x10593b=parseInt(_0x5f1311);_0x5f1311=_[_0x125c('0x57')](_0x10593b)||_0x10593b<0x0||_0x10593b>0x4?_0x641b8b?0x3:0x2:_0x10593b;_0xdc24b2[_0x125c('0x40')]('\x22'+_0x5f1311+'\x22');break;case _0x125c('0x58'):var _0x1c7625=parseInt(_0x5f1311);if(_[_0x125c('0x59')](_0x1c7625)&&_[_0x125c('0x5a')](_0x18f4e2,_0x1c7625)){_0xdc24b2['push']('\x22'+_0x1c7625+'\x22');}else{_0x196ee6['push'](_0x125c('0x5b'));}break;case _0x125c('0x5c'):if(isEmail(_0x5f1311)){_0xdc24b2['push']('\x22'+_0x5f1311+'\x22');}else{_0x196ee6['push']('email\x20wrong\x20format');}break;case _0x125c('0x5d'):var _0x3fee3e=moment(_0x5f1311,_0x125c('0x5e'),!![]);if(_0x3fee3e[_0x125c('0x56')]()){_0xdc24b2['push']('\x22'+_0x5f1311+'\x22');}else{_0x196ee6[_0x125c('0x40')](_0x125c('0x5f'));}break;default:_0xdc24b2['push']('\x22'+_0x5f1311+'\x22');}}else{switch(_0x3fd470){case _0x125c('0x60'):case _0x125c('0x10'):_0x196ee6['push'](_0x3fd470+'\x20not\x20specified');break;default:_0xdc24b2[_0x125c('0x40')]('\x22\x22');}}}}if(_0x196ee6[_0x125c('0x51')]){handleError(_0x8f6197[_0x125c('0x50')][_0x50f386],{'code':_0x125c('0x61'),'message':_0x196ee6[_0x125c('0x12')]()});}else{fs[_0x125c('0x62')](_0x3e4b2d,_0xdc24b2[_0x125c('0x12')]()+'\x0a');}_0xdc24b2=[];}if(!(stats[_0x125c('0x52')]%0xc8)){socket[_0x125c('0x63')]('contact:import:'+_0xecb58d,stats);stats[_0x125c('0x3f')]=[];}}if(stopped){logger['info'](_0x125c('0x64'));_0x49afd5['abort']();}}catch(_0x1a12f2){handleError(_0x8f6197[_0x125c('0x50')][_0x50f386],{'code':'SystemError','message':_0x1a12f2[_0x125c('0x42')]});logger[_0x125c('0x3d')]('step',_0x1a12f2[_0x125c('0x42')]);}},'complete':function(){try{var _0x4517a7=[];var _0xb5452a=_0x125c('0x25');if(_0x1c59d2[_0x125c('0x65')]&&_0x1c59d2['duplicates'][_0x125c('0x51')]){_0xb5452a=_0x125c('0x66')+_0xecb58d;_0x4517a7[_0x125c('0x40')](_0x125c('0x67')+_0xb5452a+_0x125c('0x68'));}var _0x383825=util[_0x125c('0xc')](_0x125c('0x69'),_0x3e4b2d,_0xb5452a,_0x43dcf3,_0x1c59d2[_0x125c('0x20')],_0x1c59d2[_0x125c('0x36')]||null,NOW,NOW);if(_[_0x125c('0x6a')](_0x2c2c5f[_0x125c('0x1e')])){_0x383825+=_0x125c('0x6b');}_0x4517a7[_0x125c('0x40')](_0x383825);if(_0x1c59d2[_0x125c('0x65')]&&_0x1c59d2[_0x125c('0x65')][_0x125c('0x51')]){_0x4517a7['push'](insertCmContact(_0x1c59d2[_0x125c('0x20')],_0xb5452a,_0x1c59d2[_0x125c('0x65')],_0x2c2c5f));_0x4517a7[_0x125c('0x40')]('DROP\x20TABLE\x20'+_0xb5452a+';');}_0x4517a7[_0x125c('0x40')](insertCmHopper(_0x1c59d2['ListId'],'voice_queues_has_cm_lists',_0x125c('0x6c'),_0x125c('0x6d'),_0x641b8b));_0x4517a7[_0x125c('0x40')](insertCmHopperBlack(_0x1c59d2[_0x125c('0x20')],_0x125c('0x6e'),_0x125c('0x6c'),_0x125c('0x6d')));_0x4517a7[_0x125c('0x40')](insertCmHopper(_0x1c59d2['ListId'],_0x125c('0x6f'),_0x125c('0x70'),'CampaignId',_0x641b8b));_0x4517a7[_0x125c('0x40')](insertCmHopperBlack(_0x1c59d2['ListId'],_0x125c('0x71'),_0x125c('0x70'),'CampaignId'));BPromise['each'](_0x4517a7,handleQuery)['then'](function(_0x15a297){stats[_0x125c('0x72')]=!![];stats[_0x125c('0x73')]=_0x1c59d2[_0x125c('0x65')]&&_0x1c59d2[_0x125c('0x65')]['length']?results[0x2][_0x125c('0x73')]:results[0x0][_0x125c('0x73')];socket['emit'](_0x125c('0x74')+_0xecb58d,stats);fs[_0x125c('0x75')](_0x5869ee);fs[_0x125c('0x75')](_0x3e4b2d);process['exit'](0x0);})[_0x125c('0x46')](function(_0x597a93){logger[_0x125c('0x3d')](_0x597a93['message']);process[_0x125c('0x3e')](0x1);});}catch(_0x577c84){logger['error']('complete',_0x577c84[_0x125c('0x42')]);process[_0x125c('0x3e')](0x1);}},'error':function(_0x387e98,_0x345a37,_0x1e7813,_0x49339e){throw new Error(_0x49339e);}});}function validate(){if(process[_0x125c('0x76')]&&process[_0x125c('0x76')][_0x125c('0x51')]<0x4){throw new Error(_0x125c('0x77'));}var _0x57e69e=path[_0x125c('0x12')](config['root'],'server/files/tmp',process[_0x125c('0x76')][0x2]);if(!fs[_0x125c('0x78')](_0x57e69e)){throw new Error('file\x20doesn\x27t\x20exists');}var _0x33a544={};try{_0x33a544=JSON[_0x125c('0x4f')](process[_0x125c('0x76')][0x3]);if(!_0x33a544[_0x125c('0x4b')]){throw new Error(_0x125c('0x79'));}if(!_0x33a544[_0x125c('0x4b')][_0x125c('0x10')]){throw new Error(_0x125c('0x7a'));}if(!_0x33a544[_0x125c('0x4b')]['firstName']){throw new Error(_0x125c('0x7b'));}var _0x4623fb=0x0;if(_0x33a544[_0x125c('0x4b')][_0x125c('0x58')]){_0x4623fb=0x1;}if(!_0x33a544[_0x125c('0x20')]){throw new Error(_0x125c('0x7c'));}}catch(_0x17acc2){throw new Error(_0x125c('0x7d'));}var _0x25c092=[];try{_0x25c092=_[_0x125c('0x7e')](JSON[_0x125c('0x4f')](process[_0x125c('0x76')][0x4]),'id');}catch(_0x21f4f0){logger[_0x125c('0x43')](_0x125c('0x7f'));}main(_0x57e69e,_0x33a544,_0x25c092,_0x4623fb);}validate();process['on'](_0x125c('0x80'),handleStop);process['on'](_0x125c('0x81'),handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 40d2e1e..d672041 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 _0x4c99=['Agent\x20Number','***\x20Time\x20Info\x20***','Agent\x20Ring','Agent\x20Connect','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','Date','starttime','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','Billable\x20Time','getSubjects','toLowerCase','voice','inbound','push','queue','outbound','string','Outbound\x20Call','variable','destcalleridnum','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','calleridnum','Caller\x20Name','Call\x20To','Queue','UniqueId','uniqueid','agentcalledAt','***\x20Agent\x20Info\x20***','Agent\x20Name'];(function(_0x2e9a85,_0x1ba0d2){var _0x1ade02=function(_0x2bedaf){while(--_0x2bedaf){_0x2e9a85['push'](_0x2e9a85['shift']());}};_0x1ade02(++_0x1ba0d2);}(_0x4c99,0x1ec));var _0x94c9=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0x4c99[_0x5d2803];return _0xdcad2c;};'use strict';exports[_0x94c9('0x0')]=function(_0x52a620,_0xbcda13){var _0x4831d6=[{'type':'string','content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x52a620[_0x94c9('0x1')]()){case _0x94c9('0x2'):switch(_0xbcda13['toLowerCase']()){case _0x94c9('0x3'):_0x4831d6[_0x94c9('0x4')]({'type':'variable','content':'','variableName':_0x94c9('0x5')});_0x4831d6['push']({'type':'variable','content':'','variableName':'calleridnum'});break;case _0x94c9('0x6'):_0x4831d6[_0x94c9('0x4')]({'type':_0x94c9('0x7'),'content':_0x94c9('0x8'),'variableName':null});_0x4831d6[_0x94c9('0x4')]({'type':_0x94c9('0x9'),'content':'','variableName':_0x94c9('0xa')});break;}}return _0x4831d6;};exports[_0x94c9('0xb')]=function(_0x1a43b0,_0x284f39){var _0x58b0ae=[];switch(_0x1a43b0[_0x94c9('0x1')]()){case _0x94c9('0x2'):switch(_0x284f39[_0x94c9('0x1')]()){case'inbound':_0x58b0ae=[{'type':_0x94c9('0x7'),'content':_0x94c9('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0xe'),'keyType':_0x94c9('0x9'),'variableName':_0x94c9('0xf')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x10'),'keyType':'variable','variableName':'calleridname'},{'type':'keyValue','content':'','key':_0x94c9('0x11'),'keyType':_0x94c9('0x9'),'variableName':'destexten'},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x12'),'keyType':_0x94c9('0x9'),'variableName':'queue'},{'type':'keyValue','content':'','key':_0x94c9('0x13'),'keyType':_0x94c9('0x9'),'variableName':_0x94c9('0x14')},{'type':_0x94c9('0xd'),'content':'','key':'Date','keyType':_0x94c9('0x9'),'variableName':_0x94c9('0x15')},{'type':_0x94c9('0x7'),'content':_0x94c9('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x17'),'keyType':_0x94c9('0x9'),'variableName':'destcalleridname'},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x18'),'keyType':'variable','variableName':_0x94c9('0xa')},{'type':_0x94c9('0x7'),'content':_0x94c9('0x19'),'key':null,'keyType':null,'variableName':null},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x1a'),'keyType':_0x94c9('0x9'),'variableName':_0x94c9('0x15')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x1b'),'keyType':_0x94c9('0x9'),'variableName':'agentconnectAt'},{'type':_0x94c9('0xd'),'content':'','key':'Agent\x20Complete','keyType':_0x94c9('0x9'),'variableName':'agentcompleteAt'},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x1c'),'keyType':_0x94c9('0x9'),'variableName':_0x94c9('0x1d')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x1e'),'keyType':'variable','variableName':_0x94c9('0x1f')}];break;case _0x94c9('0x6'):_0x58b0ae=[{'type':_0x94c9('0x7'),'content':'***\x20Call\x20Info\x20***','variableName':null},{'type':_0x94c9('0xd'),'content':'','key':'Called\x20Number','keyType':_0x94c9('0x9'),'keyContent':'','variableName':_0x94c9('0xa')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x20'),'keyType':_0x94c9('0x9'),'keyContent':'','variableName':_0x94c9('0x21')},{'type':'keyValue','content':'','key':_0x94c9('0x13'),'keyType':_0x94c9('0x9'),'keyContent':'','variableName':_0x94c9('0x14')},{'type':'keyValue','content':'','key':_0x94c9('0x22'),'keyType':_0x94c9('0x9'),'keyContent':'','variableName':_0x94c9('0x23')},{'type':_0x94c9('0x7'),'content':'***\x20Time\x20Info\x20***'},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x24'),'keyType':'variable','keyContent':'','variableName':_0x94c9('0x25')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x26'),'keyType':_0x94c9('0x9'),'keyContent':'','variableName':_0x94c9('0x27')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x28'),'keyType':'variable','keyContent':'','variableName':_0x94c9('0x29')},{'type':_0x94c9('0xd'),'content':'','key':_0x94c9('0x2a'),'keyType':_0x94c9('0x9'),'keyContent':'','variableName':'billableseconds'}];break;}}return _0x58b0ae;}; \ No newline at end of file +var _0x955f=['string','toLowerCase','inbound','variable','queue','push','calleridnum','outbound','Outbound\x20Call','destcalleridnum','getDescriptions','voice','***\x20Call\x20Info\x20***','Caller\x20Number','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','UniqueId','uniqueid','agentcalledAt','Agent\x20Name','destcalleridname','Agent\x20Connect','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Talk\x20Time','talktime','Called\x20Number','Member\x20Name','Date','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','duration','billableseconds','getSubjects'];(function(_0x2b2c50,_0x2deb39){var _0x54ad6e=function(_0xaca22e){while(--_0xaca22e){_0x2b2c50['push'](_0x2b2c50['shift']());}};_0x54ad6e(++_0x2deb39);}(_0x955f,0x1eb));var _0xf955=function(_0x150a4c,_0x4b55c7){_0x150a4c=_0x150a4c-0x0;var _0x4268a0=_0x955f[_0x150a4c];return _0x4268a0;};'use strict';exports[_0xf955('0x0')]=function(_0x471baa,_0x438668){var _0x382225=[{'type':_0xf955('0x1'),'content':'[xCALLY\x20Ticket]','variableName':null}];switch(_0x471baa[_0xf955('0x2')]()){case'voice':switch(_0x438668['toLowerCase']()){case _0xf955('0x3'):_0x382225['push']({'type':_0xf955('0x4'),'content':'','variableName':_0xf955('0x5')});_0x382225[_0xf955('0x6')]({'type':'variable','content':'','variableName':_0xf955('0x7')});break;case _0xf955('0x8'):_0x382225['push']({'type':_0xf955('0x1'),'content':_0xf955('0x9'),'variableName':null});_0x382225[_0xf955('0x6')]({'type':_0xf955('0x4'),'content':'','variableName':_0xf955('0xa')});break;}}return _0x382225;};exports[_0xf955('0xb')]=function(_0x186719,_0x4d213a){var _0xf7e3e=[];switch(_0x186719['toLowerCase']()){case _0xf955('0xc'):switch(_0x4d213a[_0xf955('0x2')]()){case _0xf955('0x3'):_0xf7e3e=[{'type':'string','content':_0xf955('0xd'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xf955('0xe'),'keyType':'variable','variableName':_0xf955('0x7')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x10'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x11')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x12'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x13')},{'type':_0xf955('0xf'),'content':'','key':'Queue','keyType':_0xf955('0x4'),'variableName':'queue'},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x14'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x15')},{'type':'keyValue','content':'','key':'Date','keyType':_0xf955('0x4'),'variableName':_0xf955('0x16')},{'type':_0xf955('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x17'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x18')},{'type':_0xf955('0xf'),'content':'','key':'Agent\x20Number','keyType':_0xf955('0x4'),'variableName':_0xf955('0xa')},{'type':_0xf955('0x1'),'content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xf955('0xf'),'content':'','key':'Agent\x20Ring','keyType':_0xf955('0x4'),'variableName':_0xf955('0x16')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x19'),'keyType':_0xf955('0x4'),'variableName':'agentconnectAt'},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x1a'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x1b')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x1c'),'keyType':_0xf955('0x4'),'variableName':'holdtime'},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x1d'),'keyType':_0xf955('0x4'),'variableName':_0xf955('0x1e')}];break;case _0xf955('0x8'):_0xf7e3e=[{'type':_0xf955('0x1'),'content':_0xf955('0xd'),'variableName':null},{'type':'keyValue','content':'','key':_0xf955('0x1f'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':_0xf955('0xa')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x20'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':'membername'},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x14'),'keyType':'variable','keyContent':'','variableName':_0xf955('0x15')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x21'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':'starttime'},{'type':_0xf955('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x22'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':_0xf955('0x23')},{'type':_0xf955('0xf'),'content':'','key':_0xf955('0x24'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':_0xf955('0x25')},{'type':'keyValue','content':'','key':_0xf955('0x26'),'keyType':_0xf955('0x4'),'keyContent':'','variableName':_0xf955('0x27')},{'type':_0xf955('0xf'),'content':'','key':'Billable\x20Time','keyType':_0xf955('0x4'),'keyContent':'','variableName':_0xf955('0x28')}];break;}}return _0xf7e3e;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 78fab2e..4c51635 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 _0x96f8=['fax-interactions','sms-interactions','chat-interactions','upperFirst','InteractionId','unknown','toLowerCase','toUpperCase','name','role','stringify','Interaction','findOne','then','update','info','catch','tracked','user','query','omit','body','html','mobile','../../mysqldb','../../config/logger','openchannel-interactions'];(function(_0x1ecfc8,_0x416e75){var _0x43d7d9=function(_0x44a24f){while(--_0x44a24f){_0x1ecfc8['push'](_0x1ecfc8['shift']());}};_0x43d7d9(++_0x416e75);}(_0x96f8,0x177));var _0x896f=function(_0x3f6813,_0x2a3e1d){_0x3f6813=_0x3f6813-0x0;var _0x5c3092=_0x96f8[_0x3f6813];return _0x5c3092;};'use strict';var _=require('lodash');var db=require(_0x896f('0x0'))['db'];var loggers={'openchannel':require(_0x896f('0x1'))(_0x896f('0x2')),'mail':require(_0x896f('0x1'))('mail-interactions'),'fax':require(_0x896f('0x1'))(_0x896f('0x3')),'sms':require(_0x896f('0x1'))(_0x896f('0x4')),'chat':require(_0x896f('0x1'))(_0x896f('0x5'))};function getInteractionId(_0x3339c3,_0x11706d,_0x1929d6){if(_0x3339c3&&_0x3339c3[_[_0x896f('0x6')](_0x1929d6)+_0x896f('0x7')]){return _0x3339c3[_[_0x896f('0x6')](_0x1929d6)+_0x896f('0x7')];}else if(_0x3339c3&&_0x3339c3['id']){return _0x3339c3['id'];}else if(_0x11706d&&_0x11706d['id']){return _0x11706d['id'];}else{return _0x896f('0x8');}}function log(_0x3b93b1,_0x5386ac,_0x63ec55,_0x5612b2,_0x2de82a,_0x1525d4){loggers[_0x2de82a[_0x896f('0x9')]()][_0x3b93b1]('[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1525d4[_0x896f('0xa')](),_0x5386ac?_0x5386ac['id']:null,_0x5386ac?_0x5386ac[_0x896f('0xb')]:null,_0x5386ac?_0x5386ac[_0x896f('0xc')]:null,getInteractionId(_0x63ec55,_0x5612b2,_0x2de82a),_0x63ec55?JSON[_0x896f('0xd')](_0x63ec55):'null');}function updateUser(_0x39088f,_0x208e63,_0x54eb56,_0x4c76b9,_0x86750e){db[_['upperFirst'](_0x4c76b9)+_0x896f('0xe')][_0x896f('0xf')]({'where':{'id':getInteractionId(_0x208e63,_0x54eb56,_0x4c76b9)}})[_0x896f('0x10')](function(_0x38027d){if(_0x38027d){return _0x38027d[_0x896f('0x11')]({'UserId':_0x39088f?_0x39088f['id']:null});}})[_0x896f('0x10')](function(_0x21e554){if(_0x21e554){log(_0x896f('0x12'),_0x39088f,_0x208e63,_0x54eb56,_0x4c76b9,_0x86750e);}})[_0x896f('0x13')](function(){log('error',_0x39088f,_0x208e63,_0x54eb56,_0x4c76b9,_0x86750e);});}exports[_0x896f('0x14')]=function(_0x5211fc,_0x14c314){return function(_0xbeafee,_0x247d6e,_0x553e15){var _0x2bc02d=_0xbeafee[_0x896f('0x15')];var _0x608d91={};var _0x2d5d60=_0xbeafee[_0x896f('0x16')];if(_0x608d91){_0x608d91=_['clone'](_0xbeafee['body']);_0x608d91=_[_0x896f('0x17')](_0x608d91,[_0x896f('0x18'),_0x896f('0x19'),'phone','fax',_0x896f('0x1a')]);}updateUser(_0x2bc02d,_0x608d91,_0x2d5d60,_0x5211fc,_0x14c314);_0x553e15(null);};}; \ No newline at end of file +var _0x99dd=['fax','mobile','../../config/logger','openchannel-interactions','fax-interactions','sms-interactions','upperFirst','InteractionId','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','name','role','stringify','findOne','then','catch','error','tracked','user','clone','body','omit','html','phone'];(function(_0x46aff0,_0x122890){var _0x9d78cf=function(_0x3f14cb){while(--_0x3f14cb){_0x46aff0['push'](_0x46aff0['shift']());}};_0x9d78cf(++_0x122890);}(_0x99dd,0xb1));var _0xd99d=function(_0x268cd2,_0x3f08fc){_0x268cd2=_0x268cd2-0x0;var _0x2480c9=_0x99dd[_0x268cd2];return _0x2480c9;};'use strict';var _=require('lodash');var db=require('../../mysqldb')['db'];var loggers={'openchannel':require(_0xd99d('0x0'))(_0xd99d('0x1')),'mail':require('../../config/logger')('mail-interactions'),'fax':require('../../config/logger')(_0xd99d('0x2')),'sms':require(_0xd99d('0x0'))(_0xd99d('0x3')),'chat':require(_0xd99d('0x0'))('chat-interactions')};function getInteractionId(_0x486dba,_0x4d1716,_0x233a5f){if(_0x486dba&&_0x486dba[_[_0xd99d('0x4')](_0x233a5f)+_0xd99d('0x5')]){return _0x486dba[_[_0xd99d('0x4')](_0x233a5f)+_0xd99d('0x5')];}else if(_0x486dba&&_0x486dba['id']){return _0x486dba['id'];}else if(_0x4d1716&&_0x4d1716['id']){return _0x4d1716['id'];}else{return _0xd99d('0x6');}}function log(_0x2e00f7,_0x39b958,_0x1d30fd,_0x5023be,_0x4ed76e,_0x41aeb5){loggers[_0x4ed76e[_0xd99d('0x7')]()][_0x2e00f7](_0xd99d('0x8'),_0x41aeb5['toUpperCase'](),_0x39b958?_0x39b958['id']:null,_0x39b958?_0x39b958[_0xd99d('0x9')]:null,_0x39b958?_0x39b958[_0xd99d('0xa')]:null,getInteractionId(_0x1d30fd,_0x5023be,_0x4ed76e),_0x1d30fd?JSON[_0xd99d('0xb')](_0x1d30fd):'null');}function updateUser(_0xf78008,_0x3b1f42,_0x2c8338,_0x1b2e66,_0x45c1c0){db[_[_0xd99d('0x4')](_0x1b2e66)+'Interaction'][_0xd99d('0xc')]({'where':{'id':getInteractionId(_0x3b1f42,_0x2c8338,_0x1b2e66)}})[_0xd99d('0xd')](function(_0x19ee48){if(_0x19ee48){return _0x19ee48['update']({'UserId':_0xf78008?_0xf78008['id']:null});}})[_0xd99d('0xd')](function(_0x488a39){if(_0x488a39){log('info',_0xf78008,_0x3b1f42,_0x2c8338,_0x1b2e66,_0x45c1c0);}})[_0xd99d('0xe')](function(){log(_0xd99d('0xf'),_0xf78008,_0x3b1f42,_0x2c8338,_0x1b2e66,_0x45c1c0);});}exports[_0xd99d('0x10')]=function(_0x57c3b5,_0x82147a){return function(_0x4cd54b,_0x2e7bc2,_0x43cca6){var _0x4e24ec=_0x4cd54b[_0xd99d('0x11')];var _0x28d8db={};var _0x401a7b=_0x4cd54b['query'];if(_0x28d8db){_0x28d8db=_[_0xd99d('0x12')](_0x4cd54b[_0xd99d('0x13')]);_0x28d8db=_[_0xd99d('0x14')](_0x28d8db,[_0xd99d('0x13'),_0xd99d('0x15'),_0xd99d('0x16'),_0xd99d('0x17'),_0xd99d('0x18')]);}updateUser(_0x4e24ec,_0x28d8db,_0x401a7b,_0x57c3b5,_0x82147a);_0x43cca6(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 4e66f01..45bda84 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 _0xeb98=['status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User','isUserLimit','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','findOne','then','count'];(function(_0x51a9cd,_0x4e5861){var _0x1bf6d2=function(_0x4a6880){while(--_0x4a6880){_0x51a9cd['push'](_0x51a9cd['shift']());}};_0x1bf6d2(++_0x4e5861);}(_0xeb98,0x197));var _0x8eb9=function(_0x51bedd,_0x14dddc){_0x51bedd=_0x51bedd-0x0;var _0x45f416=_0xeb98[_0x51bedd];return _0x45f416;};'use strict';var crypto=require(_0x8eb9('0x0'));var util=require('util');var compose=require(_0x8eb9('0x1'));var db=require(_0x8eb9('0x2'))['db'];var config=require(_0x8eb9('0x3'));function getValueFromLicense(_0x446c45,_0x1b56db){if(_0x446c45&&_0x1b56db){if(_0x1b56db[_0x8eb9('0x4')]&&_0x1b56db['license']){var _0x583957=_0x1b56db[_0x8eb9('0x4')];var _0x5b1a30=_0x1b56db[_0x8eb9('0x5')];var _0xdaf997=_0x583957[_0x8eb9('0x6')]('-')[0x4];var _0x4a4e50=_0x583957['split']('-')[0x0];var _0x436927=crypto['createDecipher'](_0x8eb9('0x7'),util[_0x8eb9('0x8')](_0x8eb9('0x9'),_0xdaf997,_0x583957,_0x4a4e50));var _0x599a35=_0x436927[_0x8eb9('0xa')](_0x5b1a30,_0x8eb9('0xb'),_0x8eb9('0xc'));_0x599a35+=_0x436927[_0x8eb9('0xd')]('utf8');var _0x415f80=JSON['parse'](_0x599a35);return _0x415f80[_0x8eb9('0xe')](_0x446c45)?_0x415f80[_0x446c45]:null;}}return null;}function isLimit(_0x50a027,_0x47efb0,_0x42a765,_0x5860c4){var _0x1745d9=_0x47efb0;return compose()['use'](function(_0x3e64b3,_0x829f53,_0x4d27a2){return db['License'][_0x8eb9('0xf')]({'where':{'id':0x1},'raw':!![]})[_0x8eb9('0x10')](function(_0xa9aad5){var _0x1165f8=getValueFromLicense(_0x50a027,_0xa9aad5);return _0x1165f8?_0x1165f8:_0x1745d9;})[_0x8eb9('0x10')](function(_0x8c5aac){_0x1745d9=_0x8c5aac;return _0x42a765[_0x8eb9('0x11')](_0x5860c4);})[_0x8eb9('0x10')](function(_0x45549f){if(_0x45549f>=_0x1745d9){return _0x829f53[_0x8eb9('0x12')](0x193)[_0x8eb9('0x13')]({'message':util[_0x8eb9('0x8')](_0x8eb9('0x14'),_0x50a027)});}_0x4d27a2();})[_0x8eb9('0x15')](function(_0x23cc82){_0x4d27a2(_0x23cc82);});});}function isUserLimit(){return isLimit(_0x8eb9('0x16'),0x1,db[_0x8eb9('0x17')],{'where':{'$or':[{'role':'admin'},{'role':'user'}]}});}exports[_0x8eb9('0x18')]=isUserLimit; \ No newline at end of file +var _0xadfa=['catch','user','isUserLimit','crypto','util','composable-middleware','../../config/environment','data1','license','split','createDecipher','format','%s:%s:%s','update','base64','utf8','final','hasOwnProperty','use','License','findOne','then','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached'];(function(_0xecf76f,_0xad107c){var _0x5700d2=function(_0x37d3e3){while(--_0x37d3e3){_0xecf76f['push'](_0xecf76f['shift']());}};_0x5700d2(++_0xad107c);}(_0xadfa,0x10b));var _0xaadf=function(_0x102480,_0x2d137d){_0x102480=_0x102480-0x0;var _0x3daa4d=_0xadfa[_0x102480];return _0x3daa4d;};'use strict';var crypto=require(_0xaadf('0x0'));var util=require(_0xaadf('0x1'));var compose=require(_0xaadf('0x2'));var db=require('../../mysqldb')['db'];var config=require(_0xaadf('0x3'));function getValueFromLicense(_0xd12a91,_0x437aaa){if(_0xd12a91&&_0x437aaa){if(_0x437aaa[_0xaadf('0x4')]&&_0x437aaa[_0xaadf('0x5')]){var _0x3ebdca=_0x437aaa[_0xaadf('0x4')];var _0x2cefac=_0x437aaa['license'];var _0x3b6430=_0x3ebdca[_0xaadf('0x6')]('-')[0x4];var _0x207cd7=_0x3ebdca[_0xaadf('0x6')]('-')[0x0];var _0xfe2b87=crypto[_0xaadf('0x7')]('aes-256-ctr',util[_0xaadf('0x8')](_0xaadf('0x9'),_0x3b6430,_0x3ebdca,_0x207cd7));var _0xca2f7f=_0xfe2b87[_0xaadf('0xa')](_0x2cefac,_0xaadf('0xb'),_0xaadf('0xc'));_0xca2f7f+=_0xfe2b87[_0xaadf('0xd')](_0xaadf('0xc'));var _0x23b4c3=JSON['parse'](_0xca2f7f);return _0x23b4c3[_0xaadf('0xe')](_0xd12a91)?_0x23b4c3[_0xd12a91]:null;}}return null;}function isLimit(_0x23ebad,_0x4f2cd5,_0x19d5e9,_0x1448a5){var _0x292642=_0x4f2cd5;return compose()[_0xaadf('0xf')](function(_0x46d324,_0x4e22d1,_0x1e940b){return db[_0xaadf('0x10')][_0xaadf('0x11')]({'where':{'id':0x1},'raw':!![]})['then'](function(_0x534b6d){var _0x2f9210=getValueFromLicense(_0x23ebad,_0x534b6d);return _0x2f9210?_0x2f9210:_0x292642;})[_0xaadf('0x12')](function(_0x23ab58){_0x292642=_0x23ab58;return _0x19d5e9['count'](_0x1448a5);})[_0xaadf('0x12')](function(_0x17fd4b){if(_0x17fd4b>=_0x292642){return _0x4e22d1['status'](0x193)[_0xaadf('0x13')]({'message':util['format'](_0xaadf('0x14'),_0x23ebad)});}_0x1e940b();})[_0xaadf('0x15')](function(_0x3e5fc6){_0x1e940b(_0x3e5fc6);});});}function isUserLimit(){return isLimit('users',0x1,db['User'],{'where':{'$or':[{'role':'admin'},{'role':_0xaadf('0x16')}]}});}exports[_0xaadf('0x17')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 8c1cb73..2bfc265 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 _0xeeff=['text','field','\x20AS\x20','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','=\x20?','$startsWith','$endsWith','LIKE\x20?','$gt','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','$notIn','start','$substring','pop','utcOffset','add','hours','minutes','seconds','lodash','moment','parseSearch','[$or]','and','replace','[$and]','split','length','slice','shift','forEach','filter','indexOf','map','push','buildExpression','DATE','operator','$eq','$between','value','includes','$lte','days','format','YYYY-MM-DD','castTo'];(function(_0x256b4c,_0x579f2b){var _0x2b5c31=function(_0x4a4af8){while(--_0x4a4af8){_0x256b4c['push'](_0x256b4c['shift']());}};_0x2b5c31(++_0x579f2b);}(_0xeeff,0x83));var _0xfeef=function(_0x4bd7f4,_0x8e30a2){_0x4bd7f4=_0x4bd7f4-0x0;var _0x426a9e=_0xeeff[_0x4bd7f4];return _0x426a9e;};'use strict';var _=require(_0xfeef('0x0'));var moment=require(_0xfeef('0x1'));exports[_0xfeef('0x2')]=function(_0x5dbe78){var _0x4946f3={'conditions':[]};_0x4946f3['sqlOperator']=_['startsWith'](_0x5dbe78,_0xfeef('0x3'))?'or':_0xfeef('0x4');var _0x28165f=_0x5dbe78[_0xfeef('0x5')](_0xfeef('0x6'),'')['replace'](_0xfeef('0x3'),'')[_0xfeef('0x7')]('||');for(var _0x5add0e=0x0;_0x5add0e<_0x28165f[_0xfeef('0x8')];_0x5add0e++){var _0x9d645=_0x28165f[_0x5add0e][_0xfeef('0x7')](':=');var _0x41e800=_0x9d645[0x0];var _0x2234c2=_0x9d645[_0xfeef('0x9')](0x1);_0x2234c2['forEach'](function(_0x29c886){var _0xf59d32=_0x29c886['split']('[')[_0xfeef('0xa')]();var _0x3649de=_0x29c886['match'](/\[(.*?)\]/g);_0x3649de[_0xfeef('0xb')](function(_0x18ffb6){var _0x3de5d2=_0x18ffb6[_0xfeef('0x7')]('[')[_0xfeef('0xc')](function(_0x5b98f7){return _0x5b98f7[_0xfeef('0xd')](']')>-0x1;})[_0xfeef('0xe')](function(_0x348703){return _0x348703[_0xfeef('0x7')](']')[0x0];})[0x0];_0x4946f3['conditions'][_0xfeef('0xf')]({'field':_0x41e800,'operator':_0xf59d32,'value':_0x3de5d2});});});}return _0x4946f3;};exports[_0xfeef('0x10')]=function(_0x2efa0f,_0x5d8487,_0x3ce558){var _0x3cddc4={};if(_0x5d8487===_0xfeef('0x11')){if(_0x3ce558[_0xfeef('0x12')]===_0xfeef('0x13')){_0x3ce558[_0xfeef('0x12')]=_0xfeef('0x14');_0x3ce558['value']+=','+_0x3ce558[_0xfeef('0x15')];}else if(_[_0xfeef('0x16')](['$gt',_0xfeef('0x17')],_0x3ce558[_0xfeef('0x12')])){_0x3ce558[_0xfeef('0x15')]=moment(_0x3ce558[_0xfeef('0x15')])['add'](0x1,_0xfeef('0x18'))[_0xfeef('0x19')](_0xfeef('0x1a'));}}if(_0x3ce558[_0xfeef('0x1b')]){_0x5d8487=_0x3ce558[_0xfeef('0x1b')];_0x3cddc4[_0xfeef('0x1c')]='CAST('+_0x2efa0f+'.'+_0x3ce558[_0xfeef('0x1d')]+_0xfeef('0x1e')+_0x3ce558[_0xfeef('0x1b')]+')\x20'+parseOperator(_0x3ce558[_0xfeef('0x12')]);}else{_0x3cddc4[_0xfeef('0x1c')]=_0x2efa0f+'.'+_0x3ce558[_0xfeef('0x1d')]+'\x20'+parseOperator(_0x3ce558[_0xfeef('0x12')]);}if(_[_0xfeef('0x16')]([_0xfeef('0x1f'),'$notIn'],_0x3ce558[_0xfeef('0x12')]))_0x3cddc4['text']='('+_0x3cddc4['text']+_0xfeef('0x20')+_0x2efa0f+'.'+_0x3ce558['field']+_0xfeef('0x21');_0x3cddc4[_0xfeef('0x15')]=parseValue(_0x5d8487,_0x3ce558[_0xfeef('0x12')],_0x3ce558[_0xfeef('0x15')]);return _0x3cddc4;};function parseOperator(_0x5f3714){var _0x3151a1;switch(_0x5f3714){case _0xfeef('0x22'):_0x3151a1='IN\x20?';break;case'$notIn':_0x3151a1='NOT\x20IN\x20?';break;case _0xfeef('0x13'):_0x3151a1=_0xfeef('0x23');break;case'$ne':_0x3151a1='<>\x20?';break;case'$substring':case _0xfeef('0x24'):case _0xfeef('0x25'):_0x3151a1=_0xfeef('0x26');break;case'$lt':_0x3151a1='<\x20?';break;case _0xfeef('0x27'):_0x3151a1='>\x20?';break;case _0xfeef('0x17'):_0x3151a1=_0xfeef('0x28');break;case _0xfeef('0x29'):_0x3151a1=_0xfeef('0x2a');break;case'$between':_0x3151a1=_0xfeef('0x2b');break;}return _0x3151a1;}function parseValue(_0xae889f,_0x105bfc,_0x59ae4b){var _0x582510={'start':undefined,'end':undefined};switch(_0x105bfc){case'$in':case _0xfeef('0x2c'):_0x582510[_0xfeef('0x2d')]=_0x59ae4b[_0xfeef('0x7')](',');break;case _0xfeef('0x2e'):_0x582510['start']='%'+_0x59ae4b+'%';break;case'$startsWith':_0x582510[_0xfeef('0x2d')]=_0x59ae4b+'%';break;case'$endsWith':_0x582510[_0xfeef('0x2d')]='%'+_0x59ae4b;break;case _0xfeef('0x14'):var _0x5514c3=_0x59ae4b[_0xfeef('0x7')](',');var _0x59ae4b=_0x5514c3[_0xfeef('0xa')]();var _0x572c68=_0x5514c3[_0xfeef('0x2f')]();if(_0xae889f===_0xfeef('0x11')){_0x59ae4b=moment(_0x59ae4b)[_0xfeef('0x30')](0x0,!![])['format']();_0x572c68=moment(_0x572c68)[_0xfeef('0x30')](0x0,!![])[_0xfeef('0x31')](0x17,_0xfeef('0x32'))[_0xfeef('0x31')](0x3b,_0xfeef('0x33'))[_0xfeef('0x31')](0x3b,_0xfeef('0x34'))[_0xfeef('0x19')]();}_0x582510={'start':_0x59ae4b,'end':_0x572c68};break;default:_0x582510['start']=_0x59ae4b;break;}return _0x582510;} \ No newline at end of file +var _0x26d2=['castTo','text','field','\x20AS\x20','$notIn','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$substring','$startsWith','LIKE\x20?','$lt','<\x20?','$gt','$gte','BETWEEN\x20?\x20AND\x20?','start','$endsWith','pop','utcOffset','hours','seconds','lodash','startsWith','[$or]','replace','[$and]','split','length','shift','forEach','filter','map','conditions','push','DATE','operator','$eq','$between','includes','$lte','value','add','days','format','YYYY-MM-DD'];(function(_0x216a5f,_0x41d4f7){var _0x4919e2=function(_0x299f23){while(--_0x299f23){_0x216a5f['push'](_0x216a5f['shift']());}};_0x4919e2(++_0x41d4f7);}(_0x26d2,0x11a));var _0x226d=function(_0x136619,_0x31c9b2){_0x136619=_0x136619-0x0;var _0x38c4a5=_0x26d2[_0x136619];return _0x38c4a5;};'use strict';var _=require(_0x226d('0x0'));var moment=require('moment');exports['parseSearch']=function(_0x1e520d){var _0x456ad5={'conditions':[]};_0x456ad5['sqlOperator']=_[_0x226d('0x1')](_0x1e520d,_0x226d('0x2'))?'or':'and';var _0x2c6904=_0x1e520d[_0x226d('0x3')](_0x226d('0x4'),'')[_0x226d('0x3')](_0x226d('0x2'),'')[_0x226d('0x5')]('||');for(var _0xa984dc=0x0;_0xa984dc<_0x2c6904[_0x226d('0x6')];_0xa984dc++){var _0x3a9aef=_0x2c6904[_0xa984dc]['split'](':=');var _0x5afb06=_0x3a9aef[0x0];var _0x267a47=_0x3a9aef['slice'](0x1);_0x267a47['forEach'](function(_0x39be02){var _0x382a23=_0x39be02[_0x226d('0x5')]('[')[_0x226d('0x7')]();var _0x49cdaf=_0x39be02['match'](/\[(.*?)\]/g);_0x49cdaf[_0x226d('0x8')](function(_0x5f6a8f){var _0x11a15e=_0x5f6a8f['split']('[')[_0x226d('0x9')](function(_0x408561){return _0x408561['indexOf'](']')>-0x1;})[_0x226d('0xa')](function(_0x396621){return _0x396621['split'](']')[0x0];})[0x0];_0x456ad5[_0x226d('0xb')][_0x226d('0xc')]({'field':_0x5afb06,'operator':_0x382a23,'value':_0x11a15e});});});}return _0x456ad5;};exports['buildExpression']=function(_0x103c45,_0x56db6d,_0x2f898c){var _0x36be5d={};if(_0x56db6d===_0x226d('0xd')){if(_0x2f898c[_0x226d('0xe')]===_0x226d('0xf')){_0x2f898c['operator']=_0x226d('0x10');_0x2f898c['value']+=','+_0x2f898c['value'];}else if(_[_0x226d('0x11')](['$gt',_0x226d('0x12')],_0x2f898c[_0x226d('0xe')])){_0x2f898c['value']=moment(_0x2f898c[_0x226d('0x13')])[_0x226d('0x14')](0x1,_0x226d('0x15'))[_0x226d('0x16')](_0x226d('0x17'));}}if(_0x2f898c['castTo']){_0x56db6d=_0x2f898c[_0x226d('0x18')];_0x36be5d[_0x226d('0x19')]='CAST('+_0x103c45+'.'+_0x2f898c[_0x226d('0x1a')]+_0x226d('0x1b')+_0x2f898c[_0x226d('0x18')]+')\x20'+parseOperator(_0x2f898c['operator']);}else{_0x36be5d[_0x226d('0x19')]=_0x103c45+'.'+_0x2f898c[_0x226d('0x1a')]+'\x20'+parseOperator(_0x2f898c[_0x226d('0xe')]);}if(_['includes'](['$ne',_0x226d('0x1c')],_0x2f898c[_0x226d('0xe')]))_0x36be5d['text']='('+_0x36be5d[_0x226d('0x19')]+_0x226d('0x1d')+_0x103c45+'.'+_0x2f898c[_0x226d('0x1a')]+_0x226d('0x1e');_0x36be5d[_0x226d('0x13')]=parseValue(_0x56db6d,_0x2f898c[_0x226d('0xe')],_0x2f898c[_0x226d('0x13')]);return _0x36be5d;};function parseOperator(_0x86ae7e){var _0x4c235f;switch(_0x86ae7e){case _0x226d('0x1f'):_0x4c235f=_0x226d('0x20');break;case _0x226d('0x1c'):_0x4c235f=_0x226d('0x21');break;case'$eq':_0x4c235f=_0x226d('0x22');break;case _0x226d('0x23'):_0x4c235f=_0x226d('0x24');break;case _0x226d('0x25'):case _0x226d('0x26'):case'$endsWith':_0x4c235f=_0x226d('0x27');break;case _0x226d('0x28'):_0x4c235f=_0x226d('0x29');break;case _0x226d('0x2a'):_0x4c235f='>\x20?';break;case _0x226d('0x12'):_0x4c235f='<=\x20?';break;case _0x226d('0x2b'):_0x4c235f='>=\x20?';break;case'$between':_0x4c235f=_0x226d('0x2c');break;}return _0x4c235f;}function parseValue(_0x2d674a,_0x351d60,_0x19a14e){var _0x4c92b4={'start':undefined,'end':undefined};switch(_0x351d60){case _0x226d('0x1f'):case'$notIn':_0x4c92b4['start']=_0x19a14e['split'](',');break;case'$substring':_0x4c92b4['start']='%'+_0x19a14e+'%';break;case _0x226d('0x26'):_0x4c92b4[_0x226d('0x2d')]=_0x19a14e+'%';break;case _0x226d('0x2e'):_0x4c92b4[_0x226d('0x2d')]='%'+_0x19a14e;break;case _0x226d('0x10'):var _0xdf6a37=_0x19a14e[_0x226d('0x5')](',');var _0x19a14e=_0xdf6a37[_0x226d('0x7')]();var _0xcb43b6=_0xdf6a37[_0x226d('0x2f')]();if(_0x2d674a===_0x226d('0xd')){_0x19a14e=moment(_0x19a14e)[_0x226d('0x30')](0x0,!![])[_0x226d('0x16')]();_0xcb43b6=moment(_0xcb43b6)[_0x226d('0x30')](0x0,!![])['add'](0x17,_0x226d('0x31'))['add'](0x3b,'minutes')[_0x226d('0x14')](0x3b,_0x226d('0x32'))[_0x226d('0x16')]();}_0x4c92b4={'start':_0x19a14e,'end':_0xcb43b6};break;default:_0x4c92b4[_0x226d('0x2d')]=_0x19a14e;break;}return _0x4c92b4;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6afd214..78faba1 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 _0x50e1=['isEmpty','forOwn','isArray','parse','limit','sort','map','priority','cast','col','DESC','omit','length','isString','hasOwnProperty','match','isEmail','getFullTextValue','push','join','lodash','sequelize','fields','split','filters'];(function(_0x5b482d,_0x230544){var _0x4d744f=function(_0x2a5246){while(--_0x2a5246){_0x5b482d['push'](_0x5b482d['shift']());}};_0x4d744f(++_0x230544);}(_0x50e1,0xf5));var _0x150e=function(_0x34c40b,_0x1b0983){_0x34c40b=_0x34c40b-0x0;var _0x565f13=_0x50e1[_0x34c40b];return _0x565f13;};'use strict';var _=require(_0x150e('0x0'));var sequelize=require(_0x150e('0x1'));var LIMIT_VALUE=0xfa;exports[_0x150e('0x2')]=function(_0xcda9db){var _0x382670=null;if(_0xcda9db){_0x382670=_0xcda9db[_0x150e('0x3')](',');}return _0x382670;};exports[_0x150e('0x4')]=function(_0xb4f9ff){var _0x140f5f={};if(!_[_0x150e('0x5')](_0xb4f9ff)){_0x140f5f={};_[_0x150e('0x6')](_0xb4f9ff,function(_0x51c1b8,_0x1ab825){try{_0x140f5f[_0x1ab825]=_[_0x150e('0x7')](_0x51c1b8)?_0x51c1b8:JSON[_0x150e('0x8')](_0x51c1b8);}catch(_0x321d65){_0x140f5f[_0x1ab825]=_0x51c1b8[_0x150e('0x3')](',');}});}return _0x140f5f;};exports[_0x150e('0x9')]=function(_0x5b704a){_0x5b704a=parseInt(_0x5b704a,0xa);if(!_0x5b704a||_0x5b704a<0x0){_0x5b704a=LIMIT_VALUE;}return _0x5b704a;};exports['offset']=function(_0x1da5f8){_0x1da5f8=parseInt(_0x1da5f8,0xa);if(!_0x1da5f8||_0x1da5f8<0x0){_0x1da5f8=0x0;}return _0x1da5f8;};exports[_0x150e('0xa')]=function(_0x2152e0){var _0x2844c0,_0x3d0d7f=null;if(_0x2152e0){_0x2844c0=_0x2152e0['split'](',');_0x3d0d7f=_[_0x150e('0xb')](_0x2844c0,function(_0x3dd08d){if(_0x3dd08d['indexOf']('-')===0x0){return[_0x3dd08d===_0x150e('0xc')?sequelize[_0x150e('0xd')](sequelize[_0x150e('0xe')](_0x150e('0xc')),'unsigned'):_0x3dd08d['substr'](0x1),_0x150e('0xf')];}else{return[_0x3dd08d===_0x150e('0xc')?sequelize[_0x150e('0xd')](sequelize['col'](_0x150e('0xc')),'unsigned'):_0x3dd08d,'ASC'];}});}return _0x3d0d7f;};exports[_0x150e('0x10')]=function(_0x475333,_0x400903){if(_['isEmpty'](_0x475333)){return _0x475333;}if(_[_0x150e('0x7')](_0x475333)){for(var _0x39d90d=0x0;_0x39d90d<_0x475333[_0x150e('0x11')];_0x39d90d+=0x1){_0x475333[_0x39d90d]=this[_0x150e('0x10')](_0x475333[_0x39d90d],_0x400903);}return _0x475333;}if(!_['isObject'](_0x475333)){return _0x475333;}if(_[_0x150e('0x12')](_0x400903)){_0x400903=[_0x400903];}if(!_['isArray'](_0x400903)){return _0x475333;}for(var _0x4bb0eb=0x0;_0x4bb0eb<_0x400903[_0x150e('0x11')];_0x4bb0eb+=0x1){_['unset'](_0x475333,_0x400903[_0x4bb0eb]);}for(var _0x5bf23f in _0x475333){if(_0x475333[_0x150e('0x13')](_0x5bf23f)){_0x475333[_0x5bf23f]=this[_0x150e('0x10')](_0x475333[_0x5bf23f],_0x400903);}}return _0x475333;};exports['isNumeric']=function(_0x35ef0b){return _0x35ef0b[_0x150e('0x14')](RegExp('^[0-9]*$'))?!![]:![];};exports[_0x150e('0x15')]=function(_0x36d056){return _0x36d056[_0x150e('0x14')](/^\S+@\S+$/)?!![]:![];};exports[_0x150e('0x16')]=function(_0x5a55be){var _0x438798=[];_0x5a55be[_0x150e('0x3')]('\x20')['forEach'](function(_0x4d2ec3){_0x438798[_0x150e('0x17')]('+'+_0x4d2ec3['toString']()+'*');});return _0x438798[_0x150e('0x18')]('\x20');}; \ No newline at end of file +var _0x977c=['filters','isEmpty','forOwn','parse','split','limit','sort','map','indexOf','priority','cast','col','unsigned','DESC','ASC','omit','isArray','length','isObject','isString','hasOwnProperty','isNumeric','match','^[0-9]*$','isEmail','getFullTextValue','forEach','push','toString','join','lodash','fields'];(function(_0x223c5f,_0x3e83fc){var _0x5694ba=function(_0x3d6784){while(--_0x3d6784){_0x223c5f['push'](_0x223c5f['shift']());}};_0x5694ba(++_0x3e83fc);}(_0x977c,0xfe));var _0xc977=function(_0x41f029,_0x10c199){_0x41f029=_0x41f029-0x0;var _0x40b9c3=_0x977c[_0x41f029];return _0x40b9c3;};'use strict';var _=require(_0xc977('0x0'));var sequelize=require('sequelize');var LIMIT_VALUE=0xfa;exports[_0xc977('0x1')]=function(_0x23ed85){var _0x388968=null;if(_0x23ed85){_0x388968=_0x23ed85['split'](',');}return _0x388968;};exports[_0xc977('0x2')]=function(_0x270e82){var _0x34f3a3={};if(!_[_0xc977('0x3')](_0x270e82)){_0x34f3a3={};_[_0xc977('0x4')](_0x270e82,function(_0x1af1dd,_0x161f0e){try{_0x34f3a3[_0x161f0e]=_['isArray'](_0x1af1dd)?_0x1af1dd:JSON[_0xc977('0x5')](_0x1af1dd);}catch(_0x2a98a3){_0x34f3a3[_0x161f0e]=_0x1af1dd[_0xc977('0x6')](',');}});}return _0x34f3a3;};exports[_0xc977('0x7')]=function(_0x1d564d){_0x1d564d=parseInt(_0x1d564d,0xa);if(!_0x1d564d||_0x1d564d<0x0){_0x1d564d=LIMIT_VALUE;}return _0x1d564d;};exports['offset']=function(_0x330ef5){_0x330ef5=parseInt(_0x330ef5,0xa);if(!_0x330ef5||_0x330ef5<0x0){_0x330ef5=0x0;}return _0x330ef5;};exports[_0xc977('0x8')]=function(_0x4694e9){var _0x3a8674,_0x1f1e03=null;if(_0x4694e9){_0x3a8674=_0x4694e9[_0xc977('0x6')](',');_0x1f1e03=_[_0xc977('0x9')](_0x3a8674,function(_0x20eeef){if(_0x20eeef[_0xc977('0xa')]('-')===0x0){return[_0x20eeef===_0xc977('0xb')?sequelize[_0xc977('0xc')](sequelize[_0xc977('0xd')](_0xc977('0xb')),_0xc977('0xe')):_0x20eeef['substr'](0x1),_0xc977('0xf')];}else{return[_0x20eeef===_0xc977('0xb')?sequelize[_0xc977('0xc')](sequelize[_0xc977('0xd')](_0xc977('0xb')),_0xc977('0xe')):_0x20eeef,_0xc977('0x10')];}});}return _0x1f1e03;};exports[_0xc977('0x11')]=function(_0x568dc3,_0x2b28e9){if(_[_0xc977('0x3')](_0x568dc3)){return _0x568dc3;}if(_[_0xc977('0x12')](_0x568dc3)){for(var _0x3b0d77=0x0;_0x3b0d77<_0x568dc3[_0xc977('0x13')];_0x3b0d77+=0x1){_0x568dc3[_0x3b0d77]=this[_0xc977('0x11')](_0x568dc3[_0x3b0d77],_0x2b28e9);}return _0x568dc3;}if(!_[_0xc977('0x14')](_0x568dc3)){return _0x568dc3;}if(_[_0xc977('0x15')](_0x2b28e9)){_0x2b28e9=[_0x2b28e9];}if(!_['isArray'](_0x2b28e9)){return _0x568dc3;}for(var _0x133cc2=0x0;_0x133cc2<_0x2b28e9[_0xc977('0x13')];_0x133cc2+=0x1){_['unset'](_0x568dc3,_0x2b28e9[_0x133cc2]);}for(var _0x133059 in _0x568dc3){if(_0x568dc3[_0xc977('0x16')](_0x133059)){_0x568dc3[_0x133059]=this[_0xc977('0x11')](_0x568dc3[_0x133059],_0x2b28e9);}}return _0x568dc3;};exports[_0xc977('0x17')]=function(_0x45e40b){return _0x45e40b[_0xc977('0x18')](RegExp(_0xc977('0x19')))?!![]:![];};exports[_0xc977('0x1a')]=function(_0x258820){return _0x258820[_0xc977('0x18')](/^\S+@\S+$/)?!![]:![];};exports[_0xc977('0x1b')]=function(_0x156cec){var _0x396849=[];_0x156cec[_0xc977('0x6')]('\x20')[_0xc977('0x1c')](function(_0x130dca){_0x396849[_0xc977('0x1d')]('+'+_0x130dca[_0xc977('0x1e')]()+'*');});return _0x396849[_0xc977('0x1f')]('\x20');}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 1446d64..dea7400 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x36dd=['split','views','html','ejs','renderFile','use','urlencoded','json','50mb','initialize','express','serve-favicon','body-parser','method-override','errorhandler','path','passport','./environment','../mysqldb','get','env','production','set','root','public','development','appPath','client','json\x20replacer','toISOString'];(function(_0x4a9dd1,_0xfa8de5){var _0x2e761a=function(_0x546de0){while(--_0x546de0){_0x4a9dd1['push'](_0x4a9dd1['shift']());}};_0x2e761a(++_0xfa8de5);}(_0x36dd,0x1ae));var _0xd36d=function(_0x54a761,_0x431fd4){_0x54a761=_0x54a761-0x0;var _0x37d1da=_0x36dd[_0x54a761];return _0x37d1da;};'use strict';var express=require(_0xd36d('0x0'));var favicon=require(_0xd36d('0x1'));var bodyParser=require(_0xd36d('0x2'));var methodOverride=require(_0xd36d('0x3'));var cookieParser=require('cookie-parser');var errorHandler=require(_0xd36d('0x4'));var path=require(_0xd36d('0x5'));var passport=require(_0xd36d('0x6'));var cors=require('cors');var moment=require('moment');var config=require(_0xd36d('0x7'));var db=require(_0xd36d('0x8'))['db'];exports['default']=function(_0x33b7dc){var _0x403cc8=_0x33b7dc[_0xd36d('0x9')](_0xd36d('0xa'));if(_0x403cc8===_0xd36d('0xb')){_0x33b7dc[_0xd36d('0xc')]('appPath',path['join'](config[_0xd36d('0xd')],_0xd36d('0xe')));}if(_0x403cc8===_0xd36d('0xf')||_0x403cc8==='test'){_0x33b7dc['set'](_0xd36d('0x10'),path['join'](config[_0xd36d('0xd')],_0xd36d('0x11')));_0x33b7dc['use'](errorHandler());}_0x33b7dc[_0xd36d('0xc')](_0xd36d('0x12'),function(_0xaaf197,_0x51b91b){if(this[_0xaaf197]instanceof Date){_0x51b91b=this[_0xaaf197][_0xd36d('0x13')]()[_0xd36d('0x14')]('.')[0x0]+'Z';}return _0x51b91b;});_0x33b7dc['use'](express['static'](_0x33b7dc[_0xd36d('0x9')](_0xd36d('0x10'))));_0x33b7dc['set'](_0xd36d('0x15'),config[_0xd36d('0xd')]+'/server/views');_0x33b7dc['engine'](_0xd36d('0x16'),require(_0xd36d('0x17'))[_0xd36d('0x18')]);_0x33b7dc[_0xd36d('0xc')]('view\x20engine','html');_0x33b7dc[_0xd36d('0x19')](bodyParser[_0xd36d('0x1a')]({'limit':'50mb','extended':!![]}));_0x33b7dc[_0xd36d('0x19')](bodyParser[_0xd36d('0x1b')]({'limit':_0xd36d('0x1c')}));_0x33b7dc[_0xd36d('0x19')](cors());_0x33b7dc[_0xd36d('0x19')](methodOverride());_0x33b7dc[_0xd36d('0x19')](cookieParser());_0x33b7dc[_0xd36d('0x19')](passport[_0xd36d('0x1d')]());}; \ No newline at end of file +var _0xa909=['html','ejs','renderFile','view\x20engine','urlencoded','50mb','json','express','serve-favicon','body-parser','method-override','cookie-parser','path','cors','moment','../mysqldb','env','production','set','appPath','join','root','public','development','test','client','use','json\x20replacer','static','get','/server/views','engine'];(function(_0x62b58e,_0x46fe1e){var _0x37fe84=function(_0x12a2ca){while(--_0x12a2ca){_0x62b58e['push'](_0x62b58e['shift']());}};_0x37fe84(++_0x46fe1e);}(_0xa909,0x107));var _0x9a90=function(_0x5e267d,_0x4d84e1){_0x5e267d=_0x5e267d-0x0;var _0x154dd2=_0xa909[_0x5e267d];return _0x154dd2;};'use strict';var express=require(_0x9a90('0x0'));var favicon=require(_0x9a90('0x1'));var bodyParser=require(_0x9a90('0x2'));var methodOverride=require(_0x9a90('0x3'));var cookieParser=require(_0x9a90('0x4'));var errorHandler=require('errorhandler');var path=require(_0x9a90('0x5'));var passport=require('passport');var cors=require(_0x9a90('0x6'));var moment=require(_0x9a90('0x7'));var config=require('./environment');var db=require(_0x9a90('0x8'))['db'];exports['default']=function(_0xa669f4){var _0x15c033=_0xa669f4['get'](_0x9a90('0x9'));if(_0x15c033===_0x9a90('0xa')){_0xa669f4[_0x9a90('0xb')](_0x9a90('0xc'),path[_0x9a90('0xd')](config[_0x9a90('0xe')],_0x9a90('0xf')));}if(_0x15c033===_0x9a90('0x10')||_0x15c033===_0x9a90('0x11')){_0xa669f4['set']('appPath',path[_0x9a90('0xd')](config['root'],_0x9a90('0x12')));_0xa669f4[_0x9a90('0x13')](errorHandler());}_0xa669f4[_0x9a90('0xb')](_0x9a90('0x14'),function(_0x202aa8,_0x1d8c45){if(this[_0x202aa8]instanceof Date){_0x1d8c45=this[_0x202aa8]['toISOString']()['split']('.')[0x0]+'Z';}return _0x1d8c45;});_0xa669f4[_0x9a90('0x13')](express[_0x9a90('0x15')](_0xa669f4[_0x9a90('0x16')](_0x9a90('0xc'))));_0xa669f4[_0x9a90('0xb')]('views',config[_0x9a90('0xe')]+_0x9a90('0x17'));_0xa669f4[_0x9a90('0x18')](_0x9a90('0x19'),require(_0x9a90('0x1a'))[_0x9a90('0x1b')]);_0xa669f4[_0x9a90('0xb')](_0x9a90('0x1c'),_0x9a90('0x19'));_0xa669f4['use'](bodyParser[_0x9a90('0x1d')]({'limit':_0x9a90('0x1e'),'extended':!![]}));_0xa669f4['use'](bodyParser[_0x9a90('0x1f')]({'limit':_0x9a90('0x1e')}));_0xa669f4[_0x9a90('0x13')](cors());_0xa669f4['use'](methodOverride());_0xa669f4[_0x9a90('0x13')](cookieParser());_0xa669f4[_0x9a90('0x13')](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 37a612f..e1b948e 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 _0x975f=['address','127.0.0.1','getFirstInterface','map','join','createHash','md5','update','digest','hex','getUuid','win32','replace','hostname','macAddress','ipAddress','substring','lodash','crypto','execSync','networkInterfaces','orderBy','keys','length','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00'];(function(_0x2e8abb,_0x48c5f9){var _0x568c7d=function(_0xf533e1){while(--_0xf533e1){_0x2e8abb['push'](_0x2e8abb['shift']());}};_0x568c7d(++_0x48c5f9);}(_0x975f,0x109));var _0xf975=function(_0x54a2e4,_0x1ff92c){_0x54a2e4=_0x54a2e4-0x0;var _0x4742d0=_0x975f[_0x54a2e4];return _0x4742d0;};'use strict';var _=require(_0xf975('0x0'));var os=require('os');var crypto=require(_0xf975('0x1'));var machine=require('bimedia-machine-uuid');var exec=require('child_process')[_0xf975('0x2')];function getInterfaces(){var _0x274f21=[];var _0x556f63=os[_0xf975('0x3')]();var _0x2d047c=_[_0xf975('0x4')](_[_0xf975('0x5')](_0x556f63));for(var _0x4a3199=0x0;_0x4a3199<_0x2d047c[_0xf975('0x6')];_0x4a3199++){var _0x5a9aca=_0x556f63[_0x2d047c[_0x4a3199]][_0xf975('0x7')](function(_0x2018ea){return _0x2018ea['family']===_0xf975('0x8')&&_0x2018ea[_0xf975('0x9')]===![];});_0x274f21=_0x274f21[_0xf975('0xa')](_0x5a9aca);}return _0x274f21;}function getFirstInterface(){var _0x53dc00=_[_0xf975('0xb')](getInterfaces());return{'macAddress':_0x53dc00&&_0x53dc00[_0xf975('0xc')]?_0x53dc00['mac']:_0xf975('0xd'),'ipAddress':_0x53dc00&&_0x53dc00[_0xf975('0xe')]?_0x53dc00[_0xf975('0xe')]:_0xf975('0xf')};}exports[_0xf975('0x10')]=getFirstInterface;function getCPUhash(){var _0x22f122=_[_0xf975('0x4')](os['cpus']()[_0xf975('0x11')](function(_0x34111a){return _0x34111a['model'];}))[_0xf975('0x12')](':');return crypto[_0xf975('0x13')](_0xf975('0x14'))[_0xf975('0x15')](_0x22f122)[_0xf975('0x16')](_0xf975('0x17'));}exports[_0xf975('0x18')]=function(){switch(os['platform']()){case _0xf975('0x19'):return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xf975('0x1a')]('\x0d\x0a','');default:var _0x168a76=getFirstInterface();var _0x24b7dc=getCPUhash();var _0x3bcc62=_0x24b7dc+'|'+os[_0xf975('0x1b')]()+'|'+_0x168a76[_0xf975('0x1c')]+'|'+_0x168a76[_0xf975('0x1d')];var _0x4f6568=crypto['createHash'](_0xf975('0x14'))[_0xf975('0x15')](_0x3bcc62)[_0xf975('0x16')](_0xf975('0x17'));return _0x4f6568[_0xf975('0x1e')](0x0,0x8)+'-'+_0x4f6568[_0xf975('0x1e')](0x8,0xc)+'-'+_0x4f6568['substring'](0xc,0x10)+'-'+_0x4f6568[_0xf975('0x1e')](0x10,0x14)+'-'+_0x4f6568[_0xf975('0x1e')](0x14);}}; \ No newline at end of file +var _0x7118=['IPv4','internal','concat','head','mac','address','127.0.0.1','getFirstInterface','cpus','map','join','createHash','md5','update','digest','hex','getUuid','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','ipAddress','substring','bimedia-machine-uuid','child_process','networkInterfaces','orderBy','keys','filter','family'];(function(_0x77b525,_0xd4dc1e){var _0xa83673=function(_0x133b1f){while(--_0x133b1f){_0x77b525['push'](_0x77b525['shift']());}};_0xa83673(++_0xd4dc1e);}(_0x7118,0x159));var _0x8711=function(_0x2f7d7a,_0x216684){_0x2f7d7a=_0x2f7d7a-0x0;var _0x1169e1=_0x7118[_0x2f7d7a];return _0x1169e1;};'use strict';var _=require('lodash');var os=require('os');var crypto=require('crypto');var machine=require(_0x8711('0x0'));var exec=require(_0x8711('0x1'))['execSync'];function getInterfaces(){var _0x1758c5=[];var _0x3ea36f=os[_0x8711('0x2')]();var _0x259c36=_[_0x8711('0x3')](_[_0x8711('0x4')](_0x3ea36f));for(var _0x206b82=0x0;_0x206b82<_0x259c36['length'];_0x206b82++){var _0x385033=_0x3ea36f[_0x259c36[_0x206b82]][_0x8711('0x5')](function(_0x1f23a9){return _0x1f23a9[_0x8711('0x6')]===_0x8711('0x7')&&_0x1f23a9[_0x8711('0x8')]===![];});_0x1758c5=_0x1758c5[_0x8711('0x9')](_0x385033);}return _0x1758c5;}function getFirstInterface(){var _0x2f01ca=_[_0x8711('0xa')](getInterfaces());return{'macAddress':_0x2f01ca&&_0x2f01ca[_0x8711('0xb')]?_0x2f01ca[_0x8711('0xb')]:'00:00:00:00:00:00','ipAddress':_0x2f01ca&&_0x2f01ca['address']?_0x2f01ca[_0x8711('0xc')]:_0x8711('0xd')};}exports[_0x8711('0xe')]=getFirstInterface;function getCPUhash(){var _0x4b1fbe=_['orderBy'](os[_0x8711('0xf')]()[_0x8711('0x10')](function(_0x5d2c38){return _0x5d2c38['model'];}))[_0x8711('0x11')](':');return crypto[_0x8711('0x12')](_0x8711('0x13'))[_0x8711('0x14')](_0x4b1fbe)[_0x8711('0x15')](_0x8711('0x16'));}exports[_0x8711('0x17')]=function(){switch(os['platform']()){case _0x8711('0x18'):return exec(_0x8711('0x19'),{'encoding':_0x8711('0x1a')})[_0x8711('0x1b')]('\x0d\x0a','');default:var _0x3ab905=getFirstInterface();var _0x4628e9=getCPUhash();var _0x57fedb=_0x4628e9+'|'+os[_0x8711('0x1c')]()+'|'+_0x3ab905[_0x8711('0x1d')]+'|'+_0x3ab905[_0x8711('0x1e')];var _0xe1e9b3=crypto[_0x8711('0x12')]('md5')['update'](_0x57fedb)['digest'](_0x8711('0x16'));return _0xe1e9b3[_0x8711('0x1f')](0x0,0x8)+'-'+_0xe1e9b3[_0x8711('0x1f')](0x8,0xc)+'-'+_0xe1e9b3['substring'](0xc,0x10)+'-'+_0xe1e9b3['substring'](0x10,0x14)+'-'+_0xe1e9b3[_0x8711('0x1f')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index f3e68e5..453db95 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 _0xd481=['License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','util','moment','request-promise','pkginfo','version','../../mysqldb','./hardware','license','../../api/jira/jira.controller','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','utf8','base64','final','createDecipher','session','update','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|uuid|','|machineUuid|','|email|','getFirstInterface','ipAddress','openIssue','MOTLICENSE','Motion\x20License\x20Alert','get','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','data1','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid'];(function(_0x38567b,_0x32ba4e){var _0x2ebec5=function(_0x207708){while(--_0x207708){_0x38567b['push'](_0x38567b['shift']());}};_0x2ebec5(++_0x32ba4e);}(_0xd481,0x1e4));var _0x1d48=function(_0x1383a3,_0xd5f97a){_0x1383a3=_0x1383a3-0x0;var _0x43b62c=_0xd481[_0x1383a3];return _0x43b62c;};'use strict';var util=require(_0x1d48('0x0'));var crypto=require('crypto');var moment=require(_0x1d48('0x1'));var rp=require(_0x1d48('0x2'));var BPromise=require('bluebird');var pkginfo=require(_0x1d48('0x3'))(module,_0x1d48('0x4'));var db=require(_0x1d48('0x5'))['db'];var config=require('../environment');var hardware=require(_0x1d48('0x6'));var logger=require('../logger')(_0x1d48('0x7'));var jira=require(_0x1d48('0x8'));var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x472584){return new BPromise(function(_0x3099cc,_0x3b8bd4){var _0x27c383=util[_0x1d48('0x9')](_0x1d48('0xa'),HOST,_0x472584,module[_0x1d48('0xb')][_0x1d48('0x4')]);if(oldToken){_0x27c383=util[_0x1d48('0x9')](_0x1d48('0xc'),HOST,_0x472584,module[_0x1d48('0xb')][_0x1d48('0x4')],oldToken);}var _0x4dd9d3={'uri':_0x27c383,'method':_0x1d48('0xd'),'timeout':0xea60,'json':!![]};return rp(_0x4dd9d3)[_0x1d48('0xe')](function(_0xf54674){_0x3099cc(_0xf54674);})[_0x1d48('0xf')](function(_0x2923f5){_0x3b8bd4(_0x2923f5);});});}function encryptDate(_0x145afb){var _0xa1246f=crypto[_0x1d48('0x10')](_0x1d48('0x11'),config[_0x1d48('0x12')]['session']);var _0x3034d5=_0xa1246f['update'](_0x145afb,_0x1d48('0x13'),_0x1d48('0x14'));_0x3034d5+=_0xa1246f[_0x1d48('0x15')](_0x1d48('0x14'));return _0x3034d5;}function decryptDate(_0x4f9f04){var _0x1845bd=crypto[_0x1d48('0x16')](_0x1d48('0x11'),config['secrets'][_0x1d48('0x17')]);var _0x433c92=_0x1845bd[_0x1d48('0x18')](_0x4f9f04,_0x1d48('0x14'),_0x1d48('0x13'));_0x433c92+=_0x1845bd[_0x1d48('0x15')](_0x1d48('0x13'));return _0x433c92;}function sendJiraAlert(_0x258c7a,_0xec25a1,_0x544426){var _0x5173a3=_0x1d48('0x19');return db[_0x1d48('0x1a')][_0x1d48('0x1b')]({'where':{'role':_0x1d48('0x1c')},'attributes':[_0x1d48('0x1d'),_0x1d48('0x1e')],'raw':!![]})[_0x1d48('0xe')](function(_0x1b0520){ADMIN=_0x1b0520;_0x5173a3+='|reason|'+_0x544426+'|\x0a';_0x5173a3+=_0x1d48('0x1f')+_0x258c7a+'|\x0a';_0x5173a3+=_0x1d48('0x20')+_0xec25a1+'|\x0a';_0x5173a3+='|name|'+ADMIN['fullname']+'|\x0a';_0x5173a3+=_0x1d48('0x21')+ADMIN[_0x1d48('0x1e')]+'|\x0a';return _0x5173a3;})[_0x1d48('0xe')](function(_0x20699a){var _0x14b6c9=hardware[_0x1d48('0x22')]()[_0x1d48('0x23')];return jira[_0x1d48('0x24')]({'key':_0x1d48('0x25'),'summary':_0x1d48('0x26'),'description':_0x20699a,'issuetype':'Alert','oldToken':_0x258c7a,'newToken':_0xec25a1,'email':ADMIN['email'],'name':ADMIN[_0x1d48('0x1d')],'reason':GRAY_PERIOD_REASON,'ip':_0x14b6c9});});}function manageLicense(_0x2c2b65,_0x42f8f6){var _0x2bf773=_0x42f8f6[_0x1d48('0x27')]({'plain':!![]});httpRequest(_0x2c2b65)[_0x1d48('0xe')](function(_0x54dc83){if(oldToken){oldToken=undefined;}if(_0x54dc83['active']){if(!_0x2bf773[_0x1d48('0x7')]&&_0x2bf773[_0x1d48('0x7')]!=_0x54dc83['license']||_0x2bf773[_0x1d48('0x7')]&&_0x2bf773[_0x1d48('0x28')]){logger[_0x1d48('0x29')](_0x1d48('0x2a'));}if(_0x2bf773['license']&&!_0x2bf773[_0x1d48('0x28')]&&_0x2bf773[_0x1d48('0x7')]!=_0x54dc83[_0x1d48('0x7')]){logger[_0x1d48('0x29')](_0x1d48('0x2b'));}if(_0x2bf773['license']&&!_0x2bf773[_0x1d48('0x28')]&&_0x2bf773[_0x1d48('0x7')]==_0x54dc83[_0x1d48('0x7')]){return _0x42f8f6;}return _0x42f8f6[_0x1d48('0x18')]({'data1':_0x2c2b65,'data2':null,'license':_0x54dc83[_0x1d48('0x7')]});}else{if(_0x54dc83['license']||_0x2bf773[_0x1d48('0x7')]){if(!_0x2bf773[_0x1d48('0x28')]){if(_0x2bf773[_0x1d48('0x2c')]==_0x2c2b65){GRAY_PERIOD_REASON='Disabled';logger[_0x1d48('0x29')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';oldToken=_0x2bf773[_0x1d48('0x2c')];logger[_0x1d48('0x29')](_0x1d48('0x2d'),_0x2bf773['data1'],_0x2c2b65);}sendJiraAlert(_0x2bf773[_0x1d48('0x2c')],_0x54dc83[_0x1d48('0x2e')],GRAY_PERIOD_REASON);logger['info'](_0x1d48('0x2f'),GRAY_PERIOD_REASON[_0x1d48('0x30')](),moment()[_0x1d48('0x9')]('YYYY-MM-DD\x20HH:mm'));return _0x42f8f6[_0x1d48('0x18')]({'data2':encryptDate(moment()['format'](_0x1d48('0x31')))});}else{if(moment()[_0x1d48('0x32')](decryptDate(_0x2bf773[_0x1d48('0x28')]),'days')>DAYS){logger['info'](_0x1d48('0x33'),moment()[_0x1d48('0x9')](_0x1d48('0x31')));return _0x42f8f6[_0x1d48('0x18')]({'data1':_0x2c2b65,'data2':null,'license':null});}}}else{if(_0x2bf773[_0x1d48('0x2c')]!=_0x2c2b65){logger[_0x1d48('0x29')](_0x1d48('0x2d'),_0x2bf773[_0x1d48('0x2c')],_0x2c2b65);return _0x42f8f6[_0x1d48('0x18')]({'data1':_0x2c2b65,'data2':null,'license':null});}}}return _0x42f8f6;})[_0x1d48('0xe')](function(_0x1474ab){_0x42f8f6=_0x1474ab;})[_0x1d48('0xf')](function(_0x78d04){logger[_0x1d48('0x34')](_0x78d04[_0x1d48('0x35')]);})[_0x1d48('0x36')](function(){setTimeout(function(){manageLicense(hardware[_0x1d48('0x37')](),_0x42f8f6);},TIME);});}function defaultLicense(){var _0xb3c168=hardware[_0x1d48('0x37')]();if(_0xb3c168){return db[_0x1d48('0x38')][_0x1d48('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0xb3c168}})[_0x1d48('0x3a')](function(_0x33010f,_0x78ca07){logger[_0x1d48('0x29')](_0x1d48('0x3b'),_0xb3c168);manageLicense(_0xb3c168,_0x33010f);})[_0x1d48('0xf')](function(_0x23f638){logger['error'](_0x23f638[_0x1d48('0x35')]);});}}exports['default']=defaultLicense; \ No newline at end of file +var _0x7880=['getFirstInterface','MOTLICENSE','Motion\x20License\x20Alert','get','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','data1','uuid','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','error','message','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','request-promise','bluebird','pkginfo','version','./hardware','license','../../api/jira/jira.controller','https://www.xcallymotion.com','format','%s/api/servers/%s/check?version=%s','exports','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch','createCipher','aes-256-ctr','secrets','utf8','base64','update','||FIELD||VALUE||\x0a','User','findOne','admin','fullname','email','|reason|','|uuid|','|machineUuid|','|name|','|email|'];(function(_0x21b032,_0x470065){var _0x1f906a=function(_0x5835d9){while(--_0x5835d9){_0x21b032['push'](_0x21b032['shift']());}};_0x1f906a(++_0x470065);}(_0x7880,0x10f));var _0x0788=function(_0x28258a,_0x22f398){_0x28258a=_0x28258a-0x0;var _0x4e968e=_0x7880[_0x28258a];return _0x4e968e;};'use strict';var util=require(_0x0788('0x0'));var crypto=require('crypto');var moment=require(_0x0788('0x1'));var rp=require(_0x0788('0x2'));var BPromise=require(_0x0788('0x3'));var pkginfo=require(_0x0788('0x4'))(module,_0x0788('0x5'));var db=require('../../mysqldb')['db'];var config=require('../environment');var hardware=require(_0x0788('0x6'));var logger=require('../logger')(_0x0788('0x7'));var jira=require(_0x0788('0x8'));var HOST=_0x0788('0x9');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var ADMIN;var oldToken;function httpRequest(_0x5ece1c){return new BPromise(function(_0x14cfa5,_0x450b71){var _0x5366c7=util[_0x0788('0xa')](_0x0788('0xb'),HOST,_0x5ece1c,module[_0x0788('0xc')][_0x0788('0x5')]);if(oldToken){_0x5366c7=util[_0x0788('0xa')](_0x0788('0xd'),HOST,_0x5ece1c,module[_0x0788('0xc')][_0x0788('0x5')],oldToken);}var _0x172cb6={'uri':_0x5366c7,'method':_0x0788('0xe'),'timeout':0xea60,'json':!![]};return rp(_0x172cb6)[_0x0788('0xf')](function(_0x51f861){_0x14cfa5(_0x51f861);})[_0x0788('0x10')](function(_0x47c4fc){_0x450b71(_0x47c4fc);});});}function encryptDate(_0x423e99){var _0x9d3024=crypto[_0x0788('0x11')](_0x0788('0x12'),config[_0x0788('0x13')]['session']);var _0x2c4682=_0x9d3024['update'](_0x423e99,_0x0788('0x14'),'base64');_0x2c4682+=_0x9d3024['final'](_0x0788('0x15'));return _0x2c4682;}function decryptDate(_0x8a7e08){var _0x32eae1=crypto['createDecipher'](_0x0788('0x12'),config[_0x0788('0x13')]['session']);var _0x334f58=_0x32eae1[_0x0788('0x16')](_0x8a7e08,_0x0788('0x15'),'utf8');_0x334f58+=_0x32eae1['final'](_0x0788('0x14'));return _0x334f58;}function sendJiraAlert(_0xf82fbc,_0x5ce32d,_0x3f0de9){var _0x3e0ad7=_0x0788('0x17');return db[_0x0788('0x18')][_0x0788('0x19')]({'where':{'role':_0x0788('0x1a')},'attributes':[_0x0788('0x1b'),_0x0788('0x1c')],'raw':!![]})['then'](function(_0x2739ac){ADMIN=_0x2739ac;_0x3e0ad7+=_0x0788('0x1d')+_0x3f0de9+'|\x0a';_0x3e0ad7+=_0x0788('0x1e')+_0xf82fbc+'|\x0a';_0x3e0ad7+=_0x0788('0x1f')+_0x5ce32d+'|\x0a';_0x3e0ad7+=_0x0788('0x20')+ADMIN[_0x0788('0x1b')]+'|\x0a';_0x3e0ad7+=_0x0788('0x21')+ADMIN['email']+'|\x0a';return _0x3e0ad7;})[_0x0788('0xf')](function(_0x1b373d){var _0x2525f7=hardware[_0x0788('0x22')]()['ipAddress'];return jira['openIssue']({'key':_0x0788('0x23'),'summary':_0x0788('0x24'),'description':_0x1b373d,'issuetype':'Alert','oldToken':_0xf82fbc,'newToken':_0x5ce32d,'email':ADMIN[_0x0788('0x1c')],'name':ADMIN[_0x0788('0x1b')],'reason':GRAY_PERIOD_REASON,'ip':_0x2525f7});});}function manageLicense(_0x4b99fa,_0x42cfcb){var _0x2e7874=_0x42cfcb[_0x0788('0x25')]({'plain':!![]});httpRequest(_0x4b99fa)[_0x0788('0xf')](function(_0x4bfc25){if(oldToken){oldToken=undefined;}if(_0x4bfc25[_0x0788('0x26')]){if(!_0x2e7874['license']&&_0x2e7874['license']!=_0x4bfc25[_0x0788('0x7')]||_0x2e7874[_0x0788('0x7')]&&_0x2e7874[_0x0788('0x27')]){logger[_0x0788('0x28')]('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2e7874['license']&&!_0x2e7874['data2']&&_0x2e7874[_0x0788('0x7')]!=_0x4bfc25[_0x0788('0x7')]){logger['info'](_0x0788('0x29'));}if(_0x2e7874[_0x0788('0x7')]&&!_0x2e7874['data2']&&_0x2e7874[_0x0788('0x7')]==_0x4bfc25['license']){return _0x42cfcb;}return _0x42cfcb[_0x0788('0x16')]({'data1':_0x4b99fa,'data2':null,'license':_0x4bfc25['license']});}else{if(_0x4bfc25[_0x0788('0x7')]||_0x2e7874[_0x0788('0x7')]){if(!_0x2e7874[_0x0788('0x27')]){if(_0x2e7874['data1']==_0x4b99fa){GRAY_PERIOD_REASON='Disabled';logger[_0x0788('0x28')](_0x0788('0x2a'));}else{GRAY_PERIOD_REASON=_0x0788('0x2b');oldToken=_0x2e7874['data1'];logger[_0x0788('0x28')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x2e7874[_0x0788('0x2c')],_0x4b99fa);}sendJiraAlert(_0x2e7874[_0x0788('0x2c')],_0x4bfc25[_0x0788('0x2d')],GRAY_PERIOD_REASON);logger[_0x0788('0x28')](_0x0788('0x2e'),GRAY_PERIOD_REASON[_0x0788('0x2f')](),moment()['format'](_0x0788('0x30')));return _0x42cfcb[_0x0788('0x16')]({'data2':encryptDate(moment()[_0x0788('0xa')](_0x0788('0x30')))});}else{if(moment()[_0x0788('0x31')](decryptDate(_0x2e7874[_0x0788('0x27')]),_0x0788('0x32'))>DAYS){logger[_0x0788('0x28')](_0x0788('0x33'),moment()[_0x0788('0xa')](_0x0788('0x30')));return _0x42cfcb['update']({'data1':_0x4b99fa,'data2':null,'license':null});}}}else{if(_0x2e7874[_0x0788('0x2c')]!=_0x4b99fa){logger[_0x0788('0x28')](_0x0788('0x34'),_0x2e7874[_0x0788('0x2c')],_0x4b99fa);return _0x42cfcb[_0x0788('0x16')]({'data1':_0x4b99fa,'data2':null,'license':null});}}}return _0x42cfcb;})[_0x0788('0xf')](function(_0x493758){_0x42cfcb=_0x493758;})[_0x0788('0x10')](function(_0x574d00){logger[_0x0788('0x35')](_0x574d00[_0x0788('0x36')]);})[_0x0788('0x37')](function(){setTimeout(function(){manageLicense(hardware['getUuid'](),_0x42cfcb);},TIME);});}function defaultLicense(){var _0x167b78=hardware[_0x0788('0x38')]();if(_0x167b78){return db['License'][_0x0788('0x39')]({'where':{'id':0x1},'defaults':{'data1':_0x167b78}})[_0x0788('0x3a')](function(_0x72750f,_0x16a56b){logger[_0x0788('0x28')](_0x0788('0x3b'),_0x167b78);manageLicense(_0x167b78,_0x72750f);})[_0x0788('0x10')](function(_0xd13e15){logger['error'](_0xd13e15[_0x0788('0x36')]);});}}exports[_0x0788('0x3c')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index e11ef61..efb7dff 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 _0xf7f6=['format','%s:%s:%s','update','base64','final','utf8','parse','demo','uuid','machineUuid','aes-256-ctr','secrets','gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','getLicense','find','defaults','then','checkLicense','crypto','util','lodash','moment','../environment','../../mysqldb','license','License\x20key\x20value\x20not\x20found','data1','data2','createDecipher'];(function(_0x4944f1,_0x482a52){var _0x433494=function(_0x40d7f3){while(--_0x40d7f3){_0x4944f1['push'](_0x4944f1['shift']());}};_0x433494(++_0x482a52);}(_0xf7f6,0x1e3));var _0x6f7f=function(_0x47ef08,_0x8aee75){_0x47ef08=_0x47ef08-0x0;var _0x53ffea=_0xf7f6[_0x47ef08];return _0x53ffea;};'use strict';var crypto=require(_0x6f7f('0x0'));var util=require(_0x6f7f('0x1'));var _=require(_0x6f7f('0x2'));var moment=require(_0x6f7f('0x3'));var hardware=require('./hardware');var config=require(_0x6f7f('0x4'));var db=require(_0x6f7f('0x5'))['db'];function checkLicense(_0x377572,_0x458568){if(_0x377572){try{var _0x51a951=_0x458568||_0x377572[_0x6f7f('0x6')];if(_['isEmpty'](_0x51a951)){throw new Error(_0x6f7f('0x7'));}var _0x24a780=_0x377572[_0x6f7f('0x8')];var _0x1485e0=_0x377572[_0x6f7f('0x9')];var _0x1cde5a=_0x24a780['split']('-')[0x4];var _0x242468=_0x24a780['split']('-')[0x0];var _0x380f03=crypto[_0x6f7f('0xa')]('aes-256-ctr',util[_0x6f7f('0xb')](_0x6f7f('0xc'),_0x1cde5a,_0x24a780,_0x242468));var _0x12c551=_0x380f03[_0x6f7f('0xd')](_0x51a951,_0x6f7f('0xe'),'utf8');_0x12c551+=_0x380f03[_0x6f7f('0xf')](_0x6f7f('0x10'));var _0x34c302=JSON[_0x6f7f('0x11')](_0x12c551);_0x34c302[_0x6f7f('0x12')]=![];_0x34c302[_0x6f7f('0x13')]=_0x24a780;_0x34c302[_0x6f7f('0x14')]=hardware['getUuid']();if(_0x1485e0){var _0x304780=crypto['createDecipher'](_0x6f7f('0x15'),config[_0x6f7f('0x16')]['session']);var _0x3d6219=_0x304780[_0x6f7f('0xd')](_0x1485e0,_0x6f7f('0xe'),_0x6f7f('0x10'));_0x3d6219+=_0x304780['final']('utf8');_0x34c302[_0x6f7f('0x17')]=_0x3d6219;_0x34c302[_0x6f7f('0x18')]=moment(_0x3d6219)[_0x6f7f('0x19')](0x7,_0x6f7f('0x1a'))['format']();_0x34c302[_0x6f7f('0x1b')]=_0x34c302[_0x6f7f('0x13')]!=_0x34c302[_0x6f7f('0x14')]?_0x6f7f('0x1c'):_0x6f7f('0x1d');}return _0x34c302;}catch(_0x48640d){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x6f7f('0x1e'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0x377572['data1'],'machineUuid':hardware['getUuid'](),'message':_0x48640d['message'],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x6f7f('0x1f'),'uuid':_0x377572[_0x6f7f('0x8')],'machineUuid':hardware[_0x6f7f('0x20')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x6f7f('0x21')]=function(_0x190e3a){return db['License'][_0x6f7f('0x22')](_[_0x6f7f('0x23')](_0x190e3a,{'raw':!![],'where':{'id':0x1}}))[_0x6f7f('0x24')](function(_0x799684){return checkLicense(_0x799684,null);});};exports[_0x6f7f('0x25')]=checkLicense; \ No newline at end of file +var _0x9b06=['License\x20key\x20value\x20not\x20found','data1','data2','split','aes-256-ctr','%s:%s:%s','final','utf8','parse','demo','uuid','machineUuid','session','update','base64','gray','deadline','add','days','grayReason','changed','disabled','2027-01-01T00:00:00.000Z','getUuid','message','Demo\x20license','getLicense','License','find','defaults','checkLicense','crypto','lodash','moment','./hardware','../../mysqldb','license','isEmpty'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x9b06,0xb7));var _0x69b0=function(_0x499aa8,_0x54e409){_0x499aa8=_0x499aa8-0x0;var _0x4558fc=_0x9b06[_0x499aa8];return _0x4558fc;};'use strict';var crypto=require(_0x69b0('0x0'));var util=require('util');var _=require(_0x69b0('0x1'));var moment=require(_0x69b0('0x2'));var hardware=require(_0x69b0('0x3'));var config=require('../environment');var db=require(_0x69b0('0x4'))['db'];function checkLicense(_0xdd7ce2,_0x1041bc){if(_0xdd7ce2){try{var _0x305628=_0x1041bc||_0xdd7ce2[_0x69b0('0x5')];if(_[_0x69b0('0x6')](_0x305628)){throw new Error(_0x69b0('0x7'));}var _0xa8f7da=_0xdd7ce2[_0x69b0('0x8')];var _0x16a93b=_0xdd7ce2[_0x69b0('0x9')];var _0x10e7b8=_0xa8f7da['split']('-')[0x4];var _0xaee0ae=_0xa8f7da[_0x69b0('0xa')]('-')[0x0];var _0x3b7004=crypto['createDecipher'](_0x69b0('0xb'),util['format'](_0x69b0('0xc'),_0x10e7b8,_0xa8f7da,_0xaee0ae));var _0x1d94ed=_0x3b7004['update'](_0x305628,'base64','utf8');_0x1d94ed+=_0x3b7004[_0x69b0('0xd')](_0x69b0('0xe'));var _0x368a3c=JSON[_0x69b0('0xf')](_0x1d94ed);_0x368a3c[_0x69b0('0x10')]=![];_0x368a3c[_0x69b0('0x11')]=_0xa8f7da;_0x368a3c[_0x69b0('0x12')]=hardware['getUuid']();if(_0x16a93b){var _0x2865a4=crypto['createDecipher'](_0x69b0('0xb'),config['secrets'][_0x69b0('0x13')]);var _0x13d640=_0x2865a4[_0x69b0('0x14')](_0x16a93b,_0x69b0('0x15'),_0x69b0('0xe'));_0x13d640+=_0x2865a4[_0x69b0('0xd')]('utf8');_0x368a3c[_0x69b0('0x16')]=_0x13d640;_0x368a3c[_0x69b0('0x17')]=moment(_0x13d640)[_0x69b0('0x18')](0x7,_0x69b0('0x19'))['format']();_0x368a3c[_0x69b0('0x1a')]=_0x368a3c[_0x69b0('0x11')]!=_0x368a3c[_0x69b0('0x12')]?_0x69b0('0x1b'):_0x69b0('0x1c');}return _0x368a3c;}catch(_0x4f4729){return{'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0x69b0('0x1d'),'chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':'Breaking\x20license','uuid':_0xdd7ce2['data1'],'machineUuid':hardware[_0x69b0('0x1e')](),'message':_0x4f4729[_0x69b0('0x1f')],'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}}return{'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x69b0('0x20'),'uuid':_0xdd7ce2[_0x69b0('0x8')],'machineUuid':hardware[_0x69b0('0x1e')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![]};}exports[_0x69b0('0x21')]=function(_0x5b471e){return db[_0x69b0('0x22')][_0x69b0('0x23')](_[_0x69b0('0x24')](_0x5b471e,{'raw':!![],'where':{'id':0x1}}))['then'](function(_0x51d901){return checkLicense(_0x51d901,null);});};exports[_0x69b0('0x25')]=checkLicense; \ No newline at end of file diff --git a/server/config/local.env.js b/server/config/local.env.js index 3bb1dfd..459919a 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 _0x4a96=['http://localhost:9000','secret','exports'];(function(_0x1bd395,_0x51fb41){var _0x2d9ce5=function(_0x29eda4){while(--_0x29eda4){_0x1bd395['push'](_0x1bd395['shift']());}};_0x2d9ce5(++_0x51fb41);}(_0x4a96,0x19d));var _0x64a9=function(_0x25f75a,_0x1c34cf){_0x25f75a=_0x25f75a-0x0;var _0x4ae1b3=_0x4a96[_0x25f75a];return _0x4ae1b3;};'use strict';module[_0x64a9('0x0')]={'DOMAIN':_0x64a9('0x1'),'SESSION_SECRET':'myappanuglar-secret','GOOGLE_ID':'app-id','GOOGLE_SECRET':_0x64a9('0x2'),'DEBUG':''}; \ No newline at end of file +var _0x228d=['exports','http://localhost:9000','myappanuglar-secret','app-id','secret'];(function(_0x559359,_0x37f65f){var _0x19822f=function(_0x26f720){while(--_0x26f720){_0x559359['push'](_0x559359['shift']());}};_0x19822f(++_0x37f65f);}(_0x228d,0x87));var _0xd228=function(_0x339da2,_0x3aa23a){_0x339da2=_0x339da2-0x0;var _0x4c6e10=_0x228d[_0x339da2];return _0x4c6e10;};'use strict';module[_0xd228('0x0')]={'DOMAIN':_0xd228('0x1'),'SESSION_SECRET':_0xd228('0x2'),'GOOGLE_ID':_0xd228('0x3'),'GOOGLE_SECRET':_0xd228('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 4f4333e..cf55e3f 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9930=['error','info','Console','debugLevel','moment','winston','path','INFO','join','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','message','exports','Logger','transports','File','%s-%s'];(function(_0x18b36c,_0x4ca518){var _0x3eeedb=function(_0x12a829){while(--_0x12a829){_0x18b36c['push'](_0x18b36c['shift']());}};_0x3eeedb(++_0x4ca518);}(_0x9930,0x11c));var _0x0993=function(_0x3674f2,_0x4802c9){_0x3674f2=_0x3674f2-0x0;var _0x5b7aeb=_0x9930[_0x3674f2];return _0x5b7aeb;};'use strict';var moment=require(_0x0993('0x0'));var winston=require(_0x0993('0x1'));var util=require('util');var path=require(_0x0993('0x2'));var debugLevel=_0x0993('0x3');function filename(_0x21f82d,_0x5c11d8){return path[_0x0993('0x4')]('/var',_0x0993('0x5'),_0x0993('0x6'),util[_0x0993('0x7')]('%s-%s.log',_0x21f82d,_0x5c11d8));}function formatter(_0x50317c,_0x422b26){return util['format'](_0x0993('0x8'),moment()[_0x0993('0x7')](_0x0993('0x9')),_0x422b26['level']['toUpperCase'](),_0x50317c,_0x422b26[_0x0993('0xa')]);}module[_0x0993('0xb')]=function(_0x50eddd){return new winston[(_0x0993('0xc'))]({'transports':[new winston[(_0x0993('0xd'))][(_0x0993('0xe'))]({'name':util[_0x0993('0x7')](_0x0993('0xf'),_0x50eddd,'error'),'filename':filename(_0x50eddd,_0x0993('0x10')),'level':'error','json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x452324){return formatter(_0x50eddd,_0x452324);}}),new winston[(_0x0993('0xd'))][(_0x0993('0xe'))]({'name':util[_0x0993('0x7')](_0x0993('0xf'),_0x50eddd,_0x0993('0x11')),'filename':filename(_0x50eddd,'info'),'level':_0x0993('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x56b6f9){return formatter(_0x50eddd,_0x56b6f9);}}),new winston[(_0x0993('0xd'))][(_0x0993('0x12'))]({'level':process['env'][_0x0993('0x13')]||debugLevel,'json':![],'formatter':function(_0x50f2f9){return formatter(_0x50eddd,_0x50f2f9);}})]});}; \ No newline at end of file +var _0xe3c1=['error','transports','File','info','Console','env','debugLevel','moment','winston','path','/var','log','xcally','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','toUpperCase','message','exports','Logger','%s-%s'];(function(_0x51ed62,_0x574379){var _0x34aee3=function(_0x2958bc){while(--_0x2958bc){_0x51ed62['push'](_0x51ed62['shift']());}};_0x34aee3(++_0x574379);}(_0xe3c1,0x157));var _0x1e3c=function(_0x5c38cd,_0x5a6b4e){_0x5c38cd=_0x5c38cd-0x0;var _0xc985ef=_0xe3c1[_0x5c38cd];return _0xc985ef;};'use strict';var moment=require(_0x1e3c('0x0'));var winston=require(_0x1e3c('0x1'));var util=require('util');var path=require(_0x1e3c('0x2'));var debugLevel='INFO';function filename(_0x3c9c35,_0x16a661){return path['join'](_0x1e3c('0x3'),_0x1e3c('0x4'),_0x1e3c('0x5'),util[_0x1e3c('0x6')]('%s-%s.log',_0x3c9c35,_0x16a661));}function formatter(_0x3af050,_0x3d272a){return util[_0x1e3c('0x6')](_0x1e3c('0x7'),moment()[_0x1e3c('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),_0x3d272a[_0x1e3c('0x8')][_0x1e3c('0x9')](),_0x3af050,_0x3d272a[_0x1e3c('0xa')]);}module[_0x1e3c('0xb')]=function(_0x1001f9){return new winston[(_0x1e3c('0xc'))]({'transports':[new winston['transports']['File']({'name':util[_0x1e3c('0x6')](_0x1e3c('0xd'),_0x1001f9,_0x1e3c('0xe')),'filename':filename(_0x1001f9,_0x1e3c('0xe')),'level':_0x1e3c('0xe'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x2a1fa2){return formatter(_0x1001f9,_0x2a1fa2);}}),new winston[(_0x1e3c('0xf'))][(_0x1e3c('0x10'))]({'name':util[_0x1e3c('0x6')]('%s-%s',_0x1001f9,_0x1e3c('0x11')),'filename':filename(_0x1001f9,'info'),'level':_0x1e3c('0x11'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x24215b){return formatter(_0x1001f9,_0x24215b);}}),new winston[(_0x1e3c('0xf'))][(_0x1e3c('0x12'))]({'level':process[_0x1e3c('0x13')][_0x1e3c('0x14')]||debugLevel,'json':![],'formatter':function(_0x31f6d7){return formatter(_0x1001f9,_0x31f6d7);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 862bbdb..673e3ad 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 _0x96c8=['../../services/xdr/index.js','express','join','ami','../../services/agi/index.js','email','routing','../../services/routing/index.js','xdr'];(function(_0x33ee27,_0x2d1d4b){var _0x20d77a=function(_0x48fafa){while(--_0x48fafa){_0x33ee27['push'](_0x33ee27['shift']());}};_0x20d77a(++_0x2d1d4b);}(_0x96c8,0xa3));var _0x896c=function(_0x4a99fb,_0x4f61f2){_0x4a99fb=_0x4a99fb-0x0;var _0x1ddcd9=_0x96c8[_0x4a99fb];return _0x1ddcd9;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0x896c('0x0'),'script':path[_0x896c('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x896c('0x2'),'script':path[_0x896c('0x1')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path[_0x896c('0x1')](__dirname,_0x896c('0x3'))},{'name':_0x896c('0x4'),'script':path[_0x896c('0x1')](__dirname,'../../services/email/index.js')},{'name':_0x896c('0x5'),'script':path[_0x896c('0x1')](__dirname,_0x896c('0x6'))},{'name':_0x896c('0x7'),'script':path[_0x896c('0x1')](__dirname,_0x896c('0x8'))}]};module['exports']=config; \ No newline at end of file +var _0x7d1c=['../../services/express/index.js','ami','../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/routing/index.js','../../services/xdr/index.js','exports','path','express','join'];(function(_0x58143d,_0x1007e3){var _0x4eb5a1=function(_0x3c374f){while(--_0x3c374f){_0x58143d['push'](_0x58143d['shift']());}};_0x4eb5a1(++_0x1007e3);}(_0x7d1c,0x141));var _0xc7d1=function(_0x1b8ad9,_0x301373){_0x1b8ad9=_0x1b8ad9-0x0;var _0x279227=_0x7d1c[_0x1b8ad9];return _0x279227;};'use strict';var path=require(_0xc7d1('0x0'));var os=require('os');var config={'apps':[{'name':_0xc7d1('0x1'),'script':path[_0xc7d1('0x2')](__dirname,_0xc7d1('0x3'))},{'name':_0xc7d1('0x4'),'script':path[_0xc7d1('0x2')](__dirname,_0xc7d1('0x5'))},{'name':_0xc7d1('0x6'),'script':path[_0xc7d1('0x2')](__dirname,_0xc7d1('0x7'))},{'name':_0xc7d1('0x8'),'script':path[_0xc7d1('0x2')](__dirname,'../../services/email/index.js')},{'name':'routing','script':path[_0xc7d1('0x2')](__dirname,_0xc7d1('0x9'))},{'name':'xdr','script':path[_0xc7d1('0x2')](__dirname,_0xc7d1('0xa'))}]};module[_0xc7d1('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index afa67c9..b5b12b1 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 _0xc21c=['connect','start','then','disconnect','stop','restart','list','describe','delete','dump','pm2','bluebird'];(function(_0xa5563d,_0x338776){var _0x298358=function(_0x308a60){while(--_0x308a60){_0xa5563d['push'](_0xa5563d['shift']());}};_0x298358(++_0x338776);}(_0xc21c,0x166));var _0xcc21=function(_0x58a1c5,_0x4b30c0){_0x58a1c5=_0x58a1c5-0x0;var _0x3b90e2=_0xc21c[_0x58a1c5];return _0x3b90e2;};'use strict';var pm2=require(_0xcc21('0x0'));var BPromise=require(_0xcc21('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x70bfbc,_0x16faaa){return pm2[_0xcc21('0x2')](function(_0x3f2c61){if(_0x3f2c61){return _0x16faaa(_0x3f2c61);}return _0x70bfbc('connected');});});};exports[_0xcc21('0x3')]=function(_0x31bf8b){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0x274889,_0x1ff108){return pm2[_0xcc21('0x3')](_0x31bf8b,function(_0x33604a,_0x4f3166){if(_0x33604a){return _0x1ff108(_0x33604a);}pm2[_0xcc21('0x5')]();return _0x274889(_0x4f3166);});});});};exports[_0xcc21('0x6')]=function(_0x4cb3ea){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0x5bb78c,_0x144387){return pm2['stop'](_0x4cb3ea,function(_0x412a15,_0x4ecf6a){if(_0x412a15){return _0x144387(_0x412a15);}pm2[_0xcc21('0x5')]();return _0x5bb78c(_0x4ecf6a);});});});};exports[_0xcc21('0x7')]=function(_0x502845){return connect()['then'](function(){return new BPromise(function(_0x32cd27,_0x29bd23){return pm2['restart'](_0x502845,function(_0x314564,_0x5a9e2e){if(_0x314564){return _0x29bd23(_0x314564);}pm2[_0xcc21('0x5')]();return _0x32cd27(_0x5a9e2e);});});});};exports[_0xcc21('0x8')]=function(){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0x5aaf2b,_0x73243b){return pm2['list'](function(_0xdd42cd,_0x35b642){if(_0xdd42cd){return _0x73243b(_0xdd42cd);}pm2[_0xcc21('0x5')]();return _0x5aaf2b(_0x35b642);});});});};exports[_0xcc21('0x9')]=function(_0x6e9b5a){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0x160e8d,_0x5b3cd2){return pm2['describe'](_0x6e9b5a,function(_0x2bd0b4,_0x56d008){if(_0x2bd0b4){return _0x5b3cd2(_0x2bd0b4);}pm2[_0xcc21('0x5')]();return _0x160e8d(_0x56d008);});});});};exports[_0xcc21('0xa')]=function(_0x26152e){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0x79ea56,_0x5a727c){return pm2[_0xcc21('0xa')](_0x26152e,function(_0x2a3056,_0x3548f4){if(_0x2a3056){return _0x5a727c(_0x2a3056);}pm2[_0xcc21('0x5')]();return _0x79ea56(_0x3548f4);});});});};exports['dump']=function(){return connect()[_0xcc21('0x4')](function(){return new BPromise(function(_0xb96492,_0x399f99){return pm2[_0xcc21('0xb')](function(_0x21e12c){if(_0x21e12c){return _0x399f99(_0x21e12c);}return _0xb96492('saved');});});});}; \ No newline at end of file +var _0xcc34=['then','disconnect','stop','restart','list','describe','delete','dump','saved','./config','connect','connected','start'];(function(_0x55c8d5,_0x29fd23){var _0x4a74f4=function(_0x4efa2d){while(--_0x4efa2d){_0x55c8d5['push'](_0x55c8d5['shift']());}};_0x4a74f4(++_0x29fd23);}(_0xcc34,0x7e));var _0x4cc3=function(_0x47515b,_0x4f9c33){_0x47515b=_0x47515b-0x0;var _0x4bef44=_0xcc34[_0x47515b];return _0x4bef44;};'use strict';var pm2=require('pm2');var BPromise=require('bluebird');var config=require(_0x4cc3('0x0'));function connect(){return new BPromise(function(_0x4804de,_0x64da87){return pm2[_0x4cc3('0x1')](function(_0x2de0d8){if(_0x2de0d8){return _0x64da87(_0x2de0d8);}return _0x4804de(_0x4cc3('0x2'));});});};exports[_0x4cc3('0x3')]=function(_0x2a80a5){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0x2dcf04,_0x24946c){return pm2[_0x4cc3('0x3')](_0x2a80a5,function(_0x567f7d,_0x3d1773){if(_0x567f7d){return _0x24946c(_0x567f7d);}pm2[_0x4cc3('0x5')]();return _0x2dcf04(_0x3d1773);});});});};exports[_0x4cc3('0x6')]=function(_0x578bc3){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0xe0d4da,_0xc0a2e3){return pm2['stop'](_0x578bc3,function(_0x30adb2,_0x198aab){if(_0x30adb2){return _0xc0a2e3(_0x30adb2);}pm2[_0x4cc3('0x5')]();return _0xe0d4da(_0x198aab);});});});};exports[_0x4cc3('0x7')]=function(_0x40b322){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0x3ed734,_0x545978){return pm2[_0x4cc3('0x7')](_0x40b322,function(_0x2dbbab,_0x2cc8bb){if(_0x2dbbab){return _0x545978(_0x2dbbab);}pm2[_0x4cc3('0x5')]();return _0x3ed734(_0x2cc8bb);});});});};exports[_0x4cc3('0x8')]=function(){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0x974cbe,_0x5b8ca7){return pm2['list'](function(_0x38da05,_0x32cadb){if(_0x38da05){return _0x5b8ca7(_0x38da05);}pm2[_0x4cc3('0x5')]();return _0x974cbe(_0x32cadb);});});});};exports[_0x4cc3('0x9')]=function(_0x35589c){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0x3c3e40,_0x4cc49e){return pm2[_0x4cc3('0x9')](_0x35589c,function(_0x4727e1,_0x47bf9e){if(_0x4727e1){return _0x4cc49e(_0x4727e1);}pm2[_0x4cc3('0x5')]();return _0x3c3e40(_0x47bf9e);});});});};exports['delete']=function(_0xed7330){return connect()[_0x4cc3('0x4')](function(){return new BPromise(function(_0x14fc0d,_0x32ad9b){return pm2[_0x4cc3('0xa')](_0xed7330,function(_0x184e5b,_0x5d0f81){if(_0x184e5b){return _0x32ad9b(_0x184e5b);}pm2[_0x4cc3('0x5')]();return _0x14fc0d(_0x5d0f81);});});});};exports[_0x4cc3('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x3d4975,_0x279875){return pm2[_0x4cc3('0xb')](function(_0x36c8ee){if(_0x36c8ee){return _0x279875(_0x36c8ee);}return _0x3d4975(_0x4cc3('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index 83dfaa1..b104e82 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 _0xcad2=['format','YYYY-MM-DD\x20HH:mm:ss','map','length','emit','chatInteraction:update','catch','error','start','lodash','ioredis','../../mysqldb','../../config/environment','defaults','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then','ChatInteraction','lastMsgAt','minutes','update','system','timeout'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xcad2,0x183));var _0x2cad=function(_0x264038,_0x4f332d){_0x264038=_0x264038-0x0;var _0x1f8fca=_0xcad2[_0x264038];return _0x1f8fca;};'use strict';var _=require(_0x2cad('0x0'));var moment=require('moment');var Redis=require(_0x2cad('0x1'));var db=require(_0x2cad('0x2'))['db'];var config=require(_0x2cad('0x3'));config['redis']=_[_0x2cad('0x4')](config[_0x2cad('0x5')],{'host':_0x2cad('0x6'),'port':0x18eb});var io=require(_0x2cad('0x7'))(new Redis(config[_0x2cad('0x5')]));function closeInteractions(){var _0x29cdeb=0x0;var _0x2a9682=[];return db[_0x2cad('0x8')][_0x2cad('0x9')]({'raw':!![],'attributes':['id',_0x2cad('0xa')],'where':{'id':0x1}})[_0x2cad('0xb')](function(_0xdcc265){_0x29cdeb=_0xdcc265[_0x2cad('0xa')];if(_0x29cdeb){return db[_0x2cad('0xc')]['findAll']({'raw':!![],'attributes':['id',_0x2cad('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0xdcc265[_0x2cad('0xa')],_0x2cad('0xe'))}}});}else{return[];}})['then'](function(_0x397546){_0x2a9682=_0x397546;if(_0x29cdeb){return db['ChatInteraction'][_0x2cad('0xf')]({'closeReason':_0x2cad('0x10'),'disposition':_0x2cad('0x11'),'closed':!![],'closedAt':moment()[_0x2cad('0x12')](_0x2cad('0x13'))},{'where':{'id':_[_0x2cad('0x14')](_0x2a9682||[],'id')}});}})[_0x2cad('0xb')](function(_0x1e398c){for(var _0x58b68b=0x0;_0x58b68b<_0x2a9682[_0x2cad('0x15')];_0x58b68b++){io[_0x2cad('0x16')](_0x2cad('0x17'),{'id':_0x2a9682[_0x58b68b]['id'],'closed':!![]});}})[_0x2cad('0x18')](function(_0x4c7ce1){console[_0x2cad('0x19')](_0x4c7ce1);});}exports[_0x2cad('0x1a')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x0cba=['YYYY-MM-DD\x20HH:mm:ss','map','emit','chatInteraction:update','catch','error','start','lodash','moment','ioredis','../../mysqldb','../../config/environment','redis','defaults','localhost','socket.io-emitter','find','then','ChatInteraction','findAll','lastMsgAt','subtract','chatTimeout','minutes','update','system','timeout'];(function(_0x3f0e56,_0x2cb8c5){var _0x4ed31b=function(_0x108a5e){while(--_0x108a5e){_0x3f0e56['push'](_0x3f0e56['shift']());}};_0x4ed31b(++_0x2cb8c5);}(_0x0cba,0x181));var _0xa0cb=function(_0x2eee25,_0x53460d){_0x2eee25=_0x2eee25-0x0;var _0x1cb8c4=_0x0cba[_0x2eee25];return _0x1cb8c4;};'use strict';var _=require(_0xa0cb('0x0'));var moment=require(_0xa0cb('0x1'));var Redis=require(_0xa0cb('0x2'));var db=require(_0xa0cb('0x3'))['db'];var config=require(_0xa0cb('0x4'));config[_0xa0cb('0x5')]=_[_0xa0cb('0x6')](config[_0xa0cb('0x5')],{'host':_0xa0cb('0x7'),'port':0x18eb});var io=require(_0xa0cb('0x8'))(new Redis(config[_0xa0cb('0x5')]));function closeInteractions(){var _0x2a92bb=0x0;var _0x1032d7=[];return db['Setting'][_0xa0cb('0x9')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xa0cb('0xa')](function(_0x15e36b){_0x2a92bb=_0x15e36b['chatTimeout'];if(_0x2a92bb){return db[_0xa0cb('0xb')][_0xa0cb('0xc')]({'raw':!![],'attributes':['id',_0xa0cb('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xa0cb('0xe')](_0x15e36b[_0xa0cb('0xf')],_0xa0cb('0x10'))}}});}else{return[];}})[_0xa0cb('0xa')](function(_0xaf7826){_0x1032d7=_0xaf7826;if(_0x2a92bb){return db[_0xa0cb('0xb')][_0xa0cb('0x11')]({'closeReason':_0xa0cb('0x12'),'disposition':_0xa0cb('0x13'),'closed':!![],'closedAt':moment()['format'](_0xa0cb('0x14'))},{'where':{'id':_[_0xa0cb('0x15')](_0x1032d7||[],'id')}});}})[_0xa0cb('0xa')](function(_0x44f7ac){for(var _0x6cd8e9=0x0;_0x6cd8e9<_0x1032d7['length'];_0x6cd8e9++){io[_0xa0cb('0x16')](_0xa0cb('0x17'),{'id':_0x1032d7[_0x6cd8e9]['id'],'closed':!![]});}})[_0xa0cb('0x18')](function(_0x2bb9c0){console[_0xa0cb('0x19')](_0x2bb9c0);});}exports[_0xa0cb('0x1a')]=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 bd110aa..f0162d0 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 _0x4725=['Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','authentication','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','Sent','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','then','error','email\x20sent','error\x20mail','data','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','CustomReportId','catch','no\x20report\x20id','Schedule','findAll','map','toString','keyBy','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','startAt','endAt','start','add\x20cron','deleteJob','stop\x20cron','active','update','update\x20cron','run','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../mysqldb','../../api/analyticCustomReport/analyticCustomReport.controller','http','info'];(function(_0x3a3b23,_0x16bb7b){var _0x3560af=function(_0xf38938){while(--_0xf38938){_0x3a3b23['push'](_0x3a3b23['shift']());}};_0x3560af(++_0x16bb7b);}(_0x4725,0x164));var _0x5472=function(_0x88355c,_0xedb8e1){_0x88355c=_0x88355c-0x0;var _0x3a73e3=_0x4725[_0x88355c];return _0x3a73e3;};'use strict';var fs=require('fs');var util=require(_0x5472('0x0'));var path=require(_0x5472('0x1'));var _=require(_0x5472('0x2'));var moment=require(_0x5472('0x3'));var CronJobManager=require(_0x5472('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0x5472('0x5'));var logger=require(_0x5472('0x6'))(_0x5472('0x7'));var db=require(_0x5472('0x8'))['db'];var analyticCustomReportController=require(_0x5472('0x9'));var analyticDefaultReportController=require('../../api/analyticDefaultReport/analyticDefaultReport.controller');var client=jayson['client'][_0x5472('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x51c21e,_0x2f3077){return function(){logger[_0x5472('0xb')](_0x5472('0xc'),_0x51c21e[_0x5472('0xd')]);var _0x5e134b=!![];var _0x1f1a61={'tls':{'rejectUnauthorized':![]}};if(_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x10')]){_0x1f1a61['service']=_0x51c21e[_0x5472('0xe')][_0x5472('0xf')]['service'];}else{_0x1f1a61[_0x5472('0x11')]=_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x11')];_0x1f1a61['port']=_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x12')];_0x1f1a61[_0x5472('0x13')]=_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x13')];}if(_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x14')]){_0x1f1a61[_0x5472('0x15')]={'user':_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x16')],'pass':_0x51c21e[_0x5472('0xe')][_0x5472('0xf')][_0x5472('0x17')]};}var _0x12e5f7={'account':_0x1f1a61,'message':{'from':util[_0x5472('0x18')](_0x5472('0x19'),_0x51c21e[_0x5472('0xe')][_0x5472('0x1a')],_0x51c21e[_0x5472('0xe')][_0x5472('0xd')]||_0x51c21e[_0x5472('0xe')]['Smtp'][_0x5472('0x16')]),'to':_0x51c21e[_0x5472('0xd')],'cc':_0x51c21e['cc'],'bcc':_0x51c21e[_0x5472('0x1b')],'subject':util[_0x5472('0x18')](_0x5472('0x1c'),_0x2f3077[_0x5472('0x1a')],_0x51c21e[_0x5472('0x1d')],_0x51c21e[_0x5472('0x1e')])}};var _0x47747d=path[_0x5472('0x1f')](__dirname,_0x5472('0x20'));var _0x2eed64=_0x2f3077[_0x5472('0x21')];var _0x2052c3=util['format'](_0x5472('0x22'),path[_0x5472('0x23')](_0x2f3077[_0x5472('0x21')],path[_0x5472('0x24')](_0x2f3077[_0x5472('0x21')])),_0x5472('0x25'));var _0x443d7b=path['join'](_0x47747d,_0x2eed64);var _0x4059f3=path[_0x5472('0x1f')](_0x47747d,_0x2052c3);if(fs[_0x5472('0x26')](_0x443d7b)){_0x2f3077['status']='Sent';_0x12e5f7[_0x5472('0x27')][_0x5472('0x28')]=[{'filename':_0x2eed64,'path':_0x443d7b}];_0x12e5f7[_0x5472('0x27')]['text']=util['format'](_0x5472('0x29'),JSON[_0x5472('0x2a')](_0x2f3077,null,0x2));}else if(fs[_0x5472('0x26')](_0x4059f3)){_0x2f3077[_0x5472('0x2b')]=_0x5472('0x2c');_0x12e5f7[_0x5472('0x27')]['attachments']=[{'filename':_0x2052c3,'path':_0x4059f3}];}else{_0x12e5f7[_0x5472('0x27')]['text']=_0x5472('0x2d');if(!_0x51c21e[_0x5472('0x2e')]){_0x5e134b=![];logger[_0x5472('0xb')](_0x5472('0x2f'));}}if(_0x5e134b){return client[_0x5472('0x30')](_0x5472('0x31'),_0x12e5f7)[_0x5472('0x32')](function(_0x2169f2){if(_0x2169f2[_0x5472('0x33')]){return logger['error']('error\x20mail',JSON[_0x5472('0x2a')](_0x2169f2));}return logger['info'](_0x5472('0x34'));})['catch'](function(_0x4c2b56){return logger[_0x5472('0x33')](_0x5472('0x35'),JSON[_0x5472('0x2a')](_0x4c2b56));});}};}function handleError(){return function(_0x1685e5){return logger[_0x5472('0x33')](JSON[_0x5472('0x2a')](_0x1685e5));};}function handleResult(_0x2fdceb){return function(_0x135256){logger['info'](_0x5472('0x36'),JSON[_0x5472('0x2a')](_0x135256));if(_0x2fdceb[_0x5472('0xe')]&&_0x2fdceb[_0x5472('0xe')]['Smtp']&&!_['isNil'](_0x2fdceb['email'])){setTimeout(handleSendEmail(_0x2fdceb,_0x135256),0x3c*0x3e8);}};}function handleJob(_0x483c41){return function(){try{if(_[_0x5472('0x37')](_0x483c41[_0x5472('0x1d')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x5472('0x37')](_0x483c41[_0x5472('0x1e')])){return logger[_0x5472('0xb')](_0x5472('0x38'));}var _0x346fb7={'startDate':moment()['subtract'](_0x483c41['subtractNumber'],_0x483c41[_0x5472('0x1e')])[_0x5472('0x18')](_0x5472('0x39')),'endDate':moment()[_0x5472('0x18')](_0x5472('0x39')),'type':_0x5472('0x3a'),'output':_0x483c41[_0x5472('0x3b')],'name':_0x483c41[_0x5472('0x1a')]};if(!_[_0x5472('0x37')](_0x483c41[_0x5472('0x3c')])){logger[_0x5472('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x483c41[_0x5472('0x3c')]);return analyticDefaultReportController[_0x5472('0x3d')]({'id':_0x483c41[_0x5472('0x3c')]},_0x346fb7)['then'](handleResult(_0x483c41))['catch'](handleError());}if(!_[_0x5472('0x37')](_0x483c41[_0x5472('0x3e')])){logger[_0x5472('0xb')]('exec\x20custom\x20report\x20id:%s',_0x483c41[_0x5472('0x3e')]);return analyticCustomReportController[_0x5472('0x3d')]({'id':_0x483c41[_0x5472('0x3e')]},_0x346fb7)[_0x5472('0x32')](handleResult(_0x483c41))[_0x5472('0x3f')](handleError());}}catch(_0x2d557c){logger[_0x5472('0x33')](JSON[_0x5472('0x2a')](_0x2d557c));}return logger['info'](_0x5472('0x40'));};}function getJobs(_0x3749fe){var _0x313417={};if(_0x3749fe){_0x313417['id']=_0x3749fe;}return db[_0x5472('0x41')][_0x5472('0x42')]({'where':_0x313417,'include':[{'model':db[_0x5472('0xe')],'attributes':['id',_0x5472('0x1a'),_0x5472('0xd')],'include':[{'model':db['MailServerOut'],'as':'Smtp'}]}]})[_0x5472('0x32')](function(_0x3f2193){var _0x16d24f=_['keys'](manager['jobs']);var _0x211d25=_[_0x5472('0x43')](_0x3f2193,function(_0x355e35){return _0x355e35['id'][_0x5472('0x44')]();});var _0x418d5b=_[_0x5472('0x45')](_0x3f2193,function(_0x53fc6b){return _0x53fc6b['id'][_0x5472('0x44')]();});var _0x2150dd=_0x3749fe?_0x211d25:_[_0x5472('0x46')](_0x211d25,_0x16d24f);var _0xb676dc=_[_0x5472('0x47')](_0x211d25,_0x16d24f);var _0x434765=_[_0x5472('0x46')](_0x16d24f,_0x211d25);var _0x5ce55c;var _0x750617;for(_0x5ce55c=0x0;_0x5ce55c<_0x434765[_0x5472('0x48')]&&!_0x3749fe;_0x5ce55c+=0x1){_0x750617=_0x434765[_0x5ce55c]['toString']();if(manager[_0x5472('0x49')](_0x750617)){manager[_0x5472('0x4a')](_0x750617);manager['deleteJob'](_0x750617);logger[_0x5472('0xb')](_0x5472('0x4b'),_0x750617);}}logger[_0x5472('0xb')](_0x5472('0x4c'),JSON['stringify'](_0x2150dd));for(_0x5ce55c=0x0;_0x5ce55c<_0x2150dd[_0x5472('0x48')];_0x5ce55c+=0x1){_0x750617=_0x2150dd[_0x5ce55c][_0x5472('0x44')]();logger[_0x5472('0xb')](_0x5472('0x4d'),_0x750617);if(_0x3749fe){logger['info'](_0x5472('0x4e'),_0x3749fe);logger[_0x5472('0xb')](JSON['stringify'](_0x418d5b[_0x750617]));BPromise[_0x5472('0x4f')]()[_0x5472('0x32')](handleJob(_0x418d5b[_0x750617]));logger[_0x5472('0xb')](_0x5472('0x50'),_0x418d5b[_0x750617][_0x5472('0x1a')],_0x418d5b[_0x750617][_0x5472('0x51')]);}else if(_0x418d5b[_0x750617][_0x5472('0x51')]&&_0x418d5b[_0x750617]['active']&&moment()['isBetween'](_0x418d5b[_0x750617][_0x5472('0x52')],_0x418d5b[_0x750617][_0x5472('0x53')])){manager['add'](_0x750617,_0x418d5b[_0x750617][_0x5472('0x51')],handleJob(_0x418d5b[_0x750617]));manager[_0x5472('0x54')](_0x750617);logger['info'](_0x5472('0x55'),_0x418d5b[_0x750617]['name'],_0x418d5b[_0x750617][_0x5472('0x51')]);}else if(manager['exists'](_0x750617)){manager[_0x5472('0x4a')](_0x750617);manager[_0x5472('0x56')](_0x750617);logger[_0x5472('0xb')](_0x5472('0x57'),_0x418d5b[_0x750617][_0x5472('0x1a')],_0x418d5b[_0x750617][_0x5472('0x51')]);}}for(_0x5ce55c=0x0,_0x750617;_0x5ce55c<_0xb676dc['length']&&!_0x3749fe;_0x5ce55c+=0x1){_0x750617=_0xb676dc[_0x5ce55c][_0x5472('0x44')]();if(manager[_0x5472('0x49')](_0x750617)){if(_0x418d5b[_0x750617][_0x5472('0x51')]&&_0x418d5b[_0x750617][_0x5472('0x58')]&&moment()['isBetween'](_0x418d5b[_0x750617][_0x5472('0x52')],_0x418d5b[_0x750617][_0x5472('0x53')])){manager[_0x5472('0x59')](_0x750617,_0x418d5b[_0x750617][_0x5472('0x51')],handleJob(_0x418d5b[_0x750617]));logger['info'](_0x5472('0x5a'),_0x418d5b[_0x750617][_0x5472('0x1a')],_0x418d5b[_0x750617][_0x5472('0x51')]);}else{manager[_0x5472('0x4a')](_0x750617);manager[_0x5472('0x56')](_0x750617);logger[_0x5472('0xb')](_0x5472('0x57'),_0x418d5b[_0x750617]['name'],_0x418d5b[_0x750617][_0x5472('0x51')]);}}}})[_0x5472('0x3f')](function(_0x1feba7){logger[_0x5472('0x33')](JSON[_0x5472('0x2a')](_0x1feba7));});}exports[_0x5472('0x5b')]=function(_0x29ed6c){return getJobs(_0x29ed6c);};exports[_0x5472('0x54')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x3cb9=['status','message','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','empty\x20file,\x20email\x20not\x20sent','request','SendMail','then','error','error\x20mail','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','DefaultReportId','runReport','catch','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','keys','jobs','map','toString','keyBy','difference','intersection','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','cron','active','isBetween','startAt','endAt','add','stop\x20cron','update','update\x20cron','run','start','lodash','cron-job-manager','jayson/promise','bluebird','../logger','schedule','../../mysqldb','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','Smtp','service','host','port','secure','auth','user','format','bcc','Report\x20%s\x20last\x20%s\x20%s','name','subtractNumber','subtractUnit','../../files/reports','savename','%s.%s','basename','extname','join','existsSync','Sent','attachments','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify'];(function(_0x4ac1f8,_0x4cbcbe){var _0x5c71bd=function(_0x321a69){while(--_0x321a69){_0x4ac1f8['push'](_0x4ac1f8['shift']());}};_0x5c71bd(++_0x4cbcbe);}(_0x3cb9,0x19b));var _0x93cb=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0x3cb9[_0x4b2436];return _0x4f5ab2;};'use strict';var fs=require('fs');var util=require('util');var path=require('path');var _=require(_0x93cb('0x0'));var moment=require('moment');var CronJobManager=require(_0x93cb('0x1'));var jayson=require(_0x93cb('0x2'));var BPromise=require(_0x93cb('0x3'));var logger=require(_0x93cb('0x4'))(_0x93cb('0x5'));var db=require(_0x93cb('0x6'))['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0x93cb('0x7'));var client=jayson[_0x93cb('0x8')][_0x93cb('0x9')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x20c049,_0x18858b){return function(){logger[_0x93cb('0xa')](_0x93cb('0xb'),_0x20c049[_0x93cb('0xc')]);var _0x1cd5a1=!![];var _0x9243b8={'tls':{'rejectUnauthorized':![]}};if(_0x20c049[_0x93cb('0xd')][_0x93cb('0xe')]['service']){_0x9243b8[_0x93cb('0xf')]=_0x20c049['MailAccount'][_0x93cb('0xe')][_0x93cb('0xf')];}else{_0x9243b8[_0x93cb('0x10')]=_0x20c049[_0x93cb('0xd')][_0x93cb('0xe')][_0x93cb('0x10')];_0x9243b8[_0x93cb('0x11')]=_0x20c049[_0x93cb('0xd')]['Smtp'][_0x93cb('0x11')];_0x9243b8[_0x93cb('0x12')]=_0x20c049[_0x93cb('0xd')][_0x93cb('0xe')][_0x93cb('0x12')];}if(_0x20c049[_0x93cb('0xd')][_0x93cb('0xe')]['authentication']){_0x9243b8[_0x93cb('0x13')]={'user':_0x20c049['MailAccount'][_0x93cb('0xe')][_0x93cb('0x14')],'pass':_0x20c049[_0x93cb('0xd')]['Smtp']['pass']};}var _0x1847e7={'account':_0x9243b8,'message':{'from':util[_0x93cb('0x15')]('\x22%s\x22\x20<%s>',_0x20c049[_0x93cb('0xd')]['name'],_0x20c049[_0x93cb('0xd')][_0x93cb('0xc')]||_0x20c049[_0x93cb('0xd')]['Smtp'][_0x93cb('0x14')]),'to':_0x20c049[_0x93cb('0xc')],'cc':_0x20c049['cc'],'bcc':_0x20c049[_0x93cb('0x16')],'subject':util[_0x93cb('0x15')](_0x93cb('0x17'),_0x18858b[_0x93cb('0x18')],_0x20c049[_0x93cb('0x19')],_0x20c049[_0x93cb('0x1a')])}};var _0x318e0a=path['join'](__dirname,_0x93cb('0x1b'));var _0x167dad=_0x18858b[_0x93cb('0x1c')];var _0x438274=util[_0x93cb('0x15')](_0x93cb('0x1d'),path[_0x93cb('0x1e')](_0x18858b[_0x93cb('0x1c')],path[_0x93cb('0x1f')](_0x18858b[_0x93cb('0x1c')])),'zip');var _0x5028fe=path[_0x93cb('0x20')](_0x318e0a,_0x167dad);var _0x3fc45d=path[_0x93cb('0x20')](_0x318e0a,_0x438274);if(fs[_0x93cb('0x21')](_0x5028fe)){_0x18858b['status']=_0x93cb('0x22');_0x1847e7['message'][_0x93cb('0x23')]=[{'filename':_0x167dad,'path':_0x5028fe}];_0x1847e7['message'][_0x93cb('0x24')]=util[_0x93cb('0x15')](_0x93cb('0x25'),JSON[_0x93cb('0x26')](_0x18858b,null,0x2));}else if(fs[_0x93cb('0x21')](_0x3fc45d)){_0x18858b[_0x93cb('0x27')]=_0x93cb('0x22');_0x1847e7[_0x93cb('0x28')][_0x93cb('0x23')]=[{'filename':_0x438274,'path':_0x3fc45d}];}else{_0x1847e7[_0x93cb('0x28')][_0x93cb('0x24')]=_0x93cb('0x29');if(!_0x20c049['sendIfEmpty']){_0x1cd5a1=![];logger[_0x93cb('0xa')](_0x93cb('0x2a'));}}if(_0x1cd5a1){return client[_0x93cb('0x2b')](_0x93cb('0x2c'),_0x1847e7)[_0x93cb('0x2d')](function(_0x3eed4a){if(_0x3eed4a[_0x93cb('0x2e')]){return logger['error']('error\x20mail',JSON[_0x93cb('0x26')](_0x3eed4a));}return logger['info']('email\x20sent');})['catch'](function(_0x4666b6){return logger[_0x93cb('0x2e')](_0x93cb('0x2f'),JSON[_0x93cb('0x26')](_0x4666b6));});}};}function handleError(){return function(_0x585686){return logger[_0x93cb('0x2e')](JSON[_0x93cb('0x26')](_0x585686));};}function handleResult(_0x47e6f8){return function(_0x3b60b3){logger[_0x93cb('0xa')](_0x93cb('0x30'),JSON['stringify'](_0x3b60b3));if(_0x47e6f8[_0x93cb('0xd')]&&_0x47e6f8[_0x93cb('0xd')][_0x93cb('0xe')]&&!_[_0x93cb('0x31')](_0x47e6f8[_0x93cb('0xc')])){setTimeout(handleSendEmail(_0x47e6f8,_0x3b60b3),0x3c*0x3e8);}};}function handleJob(_0x3526d5){return function(){try{if(_[_0x93cb('0x31')](_0x3526d5['subtractNumber'])){return logger[_0x93cb('0xa')](_0x93cb('0x32'));}if(_[_0x93cb('0x31')](_0x3526d5[_0x93cb('0x1a')])){return logger[_0x93cb('0xa')](_0x93cb('0x33'));}var _0x3b9751={'startDate':moment()[_0x93cb('0x34')](_0x3526d5[_0x93cb('0x19')],_0x3526d5[_0x93cb('0x1a')])[_0x93cb('0x15')](_0x93cb('0x35')),'endDate':moment()[_0x93cb('0x15')](_0x93cb('0x35')),'type':_0x93cb('0x36'),'output':_0x3526d5['output'],'name':_0x3526d5[_0x93cb('0x18')]};if(!_[_0x93cb('0x31')](_0x3526d5['DefaultReportId'])){logger[_0x93cb('0xa')]('exec\x20defaul\x20report\x20id:%s',_0x3526d5[_0x93cb('0x37')]);return analyticDefaultReportController[_0x93cb('0x38')]({'id':_0x3526d5['DefaultReportId']},_0x3b9751)[_0x93cb('0x2d')](handleResult(_0x3526d5))[_0x93cb('0x39')](handleError());}if(!_[_0x93cb('0x31')](_0x3526d5['CustomReportId'])){logger[_0x93cb('0xa')](_0x93cb('0x3a'),_0x3526d5[_0x93cb('0x3b')]);return analyticCustomReportController[_0x93cb('0x38')]({'id':_0x3526d5['CustomReportId']},_0x3b9751)[_0x93cb('0x2d')](handleResult(_0x3526d5))[_0x93cb('0x39')](handleError());}}catch(_0x1563c0){logger['error'](JSON[_0x93cb('0x26')](_0x1563c0));}return logger[_0x93cb('0xa')](_0x93cb('0x3c'));};}function getJobs(_0x1daedd){var _0x431b2c={};if(_0x1daedd){_0x431b2c['id']=_0x1daedd;}return db[_0x93cb('0x3d')][_0x93cb('0x3e')]({'where':_0x431b2c,'include':[{'model':db[_0x93cb('0xd')],'attributes':['id',_0x93cb('0x18'),_0x93cb('0xc')],'include':[{'model':db['MailServerOut'],'as':_0x93cb('0xe')}]}]})[_0x93cb('0x2d')](function(_0x331354){var _0x55ccb4=_[_0x93cb('0x3f')](manager[_0x93cb('0x40')]);var _0x2fde41=_[_0x93cb('0x41')](_0x331354,function(_0x24878b){return _0x24878b['id'][_0x93cb('0x42')]();});var _0x5c59ca=_[_0x93cb('0x43')](_0x331354,function(_0x2d0671){return _0x2d0671['id'][_0x93cb('0x42')]();});var _0x5eaac6=_0x1daedd?_0x2fde41:_[_0x93cb('0x44')](_0x2fde41,_0x55ccb4);var _0x67a400=_[_0x93cb('0x45')](_0x2fde41,_0x55ccb4);var _0x5f2e97=_[_0x93cb('0x44')](_0x55ccb4,_0x2fde41);var _0x496117;var _0x5baacd;for(_0x496117=0x0;_0x496117<_0x5f2e97[_0x93cb('0x46')]&&!_0x1daedd;_0x496117+=0x1){_0x5baacd=_0x5f2e97[_0x496117][_0x93cb('0x42')]();if(manager[_0x93cb('0x47')](_0x5baacd)){manager[_0x93cb('0x48')](_0x5baacd);manager[_0x93cb('0x49')](_0x5baacd);logger[_0x93cb('0xa')](_0x93cb('0x4a'),_0x5baacd);}}logger[_0x93cb('0xa')](_0x93cb('0x4b'),JSON[_0x93cb('0x26')](_0x5eaac6));for(_0x496117=0x0;_0x496117<_0x5eaac6[_0x93cb('0x46')];_0x496117+=0x1){_0x5baacd=_0x5eaac6[_0x496117][_0x93cb('0x42')]();logger[_0x93cb('0xa')](_0x93cb('0x4c'),_0x5baacd);if(_0x1daedd){logger[_0x93cb('0xa')](_0x93cb('0x4d'),_0x1daedd);logger[_0x93cb('0xa')](JSON[_0x93cb('0x26')](_0x5c59ca[_0x5baacd]));BPromise[_0x93cb('0x4e')]()[_0x93cb('0x2d')](handleJob(_0x5c59ca[_0x5baacd]));logger[_0x93cb('0xa')]('run\x20job',_0x5c59ca[_0x5baacd][_0x93cb('0x18')],_0x5c59ca[_0x5baacd][_0x93cb('0x4f')]);}else if(_0x5c59ca[_0x5baacd]['cron']&&_0x5c59ca[_0x5baacd][_0x93cb('0x50')]&&moment()[_0x93cb('0x51')](_0x5c59ca[_0x5baacd][_0x93cb('0x52')],_0x5c59ca[_0x5baacd][_0x93cb('0x53')])){manager[_0x93cb('0x54')](_0x5baacd,_0x5c59ca[_0x5baacd]['cron'],handleJob(_0x5c59ca[_0x5baacd]));manager['start'](_0x5baacd);logger[_0x93cb('0xa')]('add\x20cron',_0x5c59ca[_0x5baacd][_0x93cb('0x18')],_0x5c59ca[_0x5baacd][_0x93cb('0x4f')]);}else if(manager[_0x93cb('0x47')](_0x5baacd)){manager[_0x93cb('0x48')](_0x5baacd);manager['deleteJob'](_0x5baacd);logger[_0x93cb('0xa')](_0x93cb('0x55'),_0x5c59ca[_0x5baacd][_0x93cb('0x18')],_0x5c59ca[_0x5baacd][_0x93cb('0x4f')]);}}for(_0x496117=0x0,_0x5baacd;_0x496117<_0x67a400[_0x93cb('0x46')]&&!_0x1daedd;_0x496117+=0x1){_0x5baacd=_0x67a400[_0x496117][_0x93cb('0x42')]();if(manager[_0x93cb('0x47')](_0x5baacd)){if(_0x5c59ca[_0x5baacd][_0x93cb('0x4f')]&&_0x5c59ca[_0x5baacd]['active']&&moment()[_0x93cb('0x51')](_0x5c59ca[_0x5baacd][_0x93cb('0x52')],_0x5c59ca[_0x5baacd][_0x93cb('0x53')])){manager[_0x93cb('0x56')](_0x5baacd,_0x5c59ca[_0x5baacd]['cron'],handleJob(_0x5c59ca[_0x5baacd]));logger[_0x93cb('0xa')](_0x93cb('0x57'),_0x5c59ca[_0x5baacd][_0x93cb('0x18')],_0x5c59ca[_0x5baacd][_0x93cb('0x4f')]);}else{manager[_0x93cb('0x48')](_0x5baacd);manager['deleteJob'](_0x5baacd);logger['info'](_0x93cb('0x55'),_0x5c59ca[_0x5baacd][_0x93cb('0x18')],_0x5c59ca[_0x5baacd]['cron']);}}}})[_0x93cb('0x39')](function(_0x597792){logger['error'](JSON['stringify'](_0x597792));});}exports[_0x93cb('0x58')]=function(_0x54aa32){return getJobs(_0x54aa32);};exports[_0x93cb('0x59')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file diff --git a/server/config/seedContact.js b/server/config/seedContact.js index 4881e34..4e1221b 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8855=['catch','util','../mysqldb','push','Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','hopper2'];(function(_0x1cb701,_0xaebc06){var _0x2ac38d=function(_0x33003b){while(--_0x33003b){_0x1cb701['push'](_0x1cb701['shift']());}};_0x2ac38d(++_0xaebc06);}(_0x8855,0xf1));var _0x5885=function(_0x2c5c15,_0x428d60){_0x2c5c15=_0x2c5c15-0x0;var _0x4efc3e=_0x8855[_0x2c5c15];return _0x4efc3e;};'use strict';var util=require(_0x5885('0x0'));var db=require(_0x5885('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x5885('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x5885('0x3')+i,'phone':0xf879fb460+i,'email':_0x5885('0x4')+i+_0x5885('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date[_0x5885('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5885('0x6')](),'updatedAt':Date[_0x5885('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x5885('0x2')]({'id':i,'firstName':_0x5885('0x7')+i,'lastName':_0x5885('0x3')+i,'phone':0xf879fb460+i,'email':_0x5885('0x4')+i+_0x5885('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x5885('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x5885('0x6')](),'updatedAt':Date[_0x5885('0x6')]()});}db[_0x5885('0x8')][_0x5885('0x9')]({'where':{}})[_0x5885('0xa')](function(){return db[_0x5885('0x8')][_0x5885('0xb')](contacts);})[_0x5885('0xa')](function(){console[_0x5885('0xc')](_0x5885('0xd'),_0x5885('0xe'));return db[_0x5885('0xf')]['destroy']({'where':{}});})[_0x5885('0xa')](function(){return db[_0x5885('0xf')][_0x5885('0xb')](hopper);})['then'](function(){console[_0x5885('0xc')](_0x5885('0xd'),_0x5885('0x10'));return db[_0x5885('0x8')][_0x5885('0xb')](contacts2);})[_0x5885('0xa')](function(){console[_0x5885('0xc')](_0x5885('0xd'),_0x5885('0x11'));return db['CmHopper'][_0x5885('0xb')](hopper2);})[_0x5885('0xa')](function(){console['log'](_0x5885('0xd'),_0x5885('0x12'));})[_0x5885('0x13')](function(_0x9860c0){console['log'](_0x9860c0);}); \ No newline at end of file +var _0x0bc9=['then','bulkCreate','log','finished\x20populating','contacts1','CmHopper','hopper1','contacts2','util','../mysqldb','push','Innocenzo','innocenzo.biondo','now','Biondo','@xcally.com','CmContact','destroy'];(function(_0x526074,_0x5e5d09){var _0x83c6c8=function(_0x571483){while(--_0x571483){_0x526074['push'](_0x526074['shift']());}};_0x83c6c8(++_0x5e5d09);}(_0x0bc9,0x1ee));var _0x90bc=function(_0xb9b2f5,_0x2b16cd){_0xb9b2f5=_0xb9b2f5-0x0;var _0x20b906=_0x0bc9[_0xb9b2f5];return _0x20b906;};'use strict';var util=require(_0x90bc('0x0'));var db=require(_0x90bc('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x90bc('0x2')]({'id':i,'firstName':_0x90bc('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0x90bc('0x4')+i+'@xcally.com'});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0x90bc('0x2')]({'id':i,'active':![],'scheduledat':Date[_0x90bc('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x90bc('0x5')](),'updatedAt':Date[_0x90bc('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x90bc('0x2')]({'id':i,'firstName':_0x90bc('0x3')+i,'lastName':_0x90bc('0x6')+i,'phone':0xf879fb460+i,'email':_0x90bc('0x4')+i+_0x90bc('0x7')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date[_0x90bc('0x5')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x90bc('0x5')](),'updatedAt':Date[_0x90bc('0x5')]()});}db[_0x90bc('0x8')][_0x90bc('0x9')]({'where':{}})[_0x90bc('0xa')](function(){return db['CmContact'][_0x90bc('0xb')](contacts);})[_0x90bc('0xa')](function(){console[_0x90bc('0xc')](_0x90bc('0xd'),_0x90bc('0xe'));return db[_0x90bc('0xf')]['destroy']({'where':{}});})[_0x90bc('0xa')](function(){return db[_0x90bc('0xf')][_0x90bc('0xb')](hopper);})[_0x90bc('0xa')](function(){console[_0x90bc('0xc')](_0x90bc('0xd'),_0x90bc('0x10'));return db[_0x90bc('0x8')][_0x90bc('0xb')](contacts2);})[_0x90bc('0xa')](function(){console[_0x90bc('0xc')]('finished\x20populating',_0x90bc('0x11'));return db[_0x90bc('0xf')]['bulkCreate'](hopper2);})[_0x90bc('0xa')](function(){console[_0x90bc('0xc')](_0x90bc('0xd'),'hopper2');})['catch'](function(_0x4ee222){console[_0x90bc('0xc')](_0x4ee222);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 2875a17..dbfc621 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb7b6=['ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>','bulkCreate','then','log','add\x20user','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','all'];(function(_0x5b8685,_0x1a1c28){var _0xa3ef57=function(_0xa91aad){while(--_0xa91aad){_0x5b8685['push'](_0x5b8685['shift']());}};_0xa3ef57(++_0x1a1c28);}(_0xb7b6,0x14c));var _0x6b7b=function(_0xe7c6b3,_0x23b2bd){_0xe7c6b3=_0xe7c6b3-0x0;var _0x3eb532=_0xb7b6[_0xe7c6b3];return _0x3eb532;};'use strict';var util=require('util');var db=require(_0x6b7b('0x0'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x6b7b('0x1')]({'name':util[_0x6b7b('0x2')](_0x6b7b('0x3'),_0x6b7b('0x4'),i),'fullname':util[_0x6b7b('0x2')](_0x6b7b('0x3'),'agent',i),'email':util['format'](_0x6b7b('0x5'),_0x6b7b('0x4'),i),'role':_0x6b7b('0x4'),'password':_0x6b7b('0x6'),'internal':0xfa0+i,'type':_0x6b7b('0x7'),'transport':[_0x6b7b('0x8'),'ws','wss'],'disallow':[_0x6b7b('0x9')],'allow':[_0x6b7b('0xa')],'defaultuser':util['format'](_0x6b7b('0x3'),_0x6b7b('0x4'),i),'encryption':_0x6b7b('0xb'),'avpf':_0x6b7b('0xb'),'force_avp':_0x6b7b('0xb'),'icesupport':_0x6b7b('0xb'),'dtlsenable':_0x6b7b('0xb'),'dtlsverify':'no','dtlscertfile':_0x6b7b('0xc'),'dtlsprivatekey':_0x6b7b('0xd'),'dtlssetup':'actpass','callerid':util[_0x6b7b('0x2')](_0x6b7b('0xe'),util[_0x6b7b('0x2')](_0x6b7b('0x3'),_0x6b7b('0x4'),i),0xfa0+i)});}db['User'][_0x6b7b('0xf')](users)[_0x6b7b('0x10')](function(){console[_0x6b7b('0x11')](_0x6b7b('0x12'));})['catch'](function(_0x187165){console[_0x6b7b('0x11')](_0x187165);}); \ No newline at end of file +var _0xb23b=['actpass','\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','password','friend','wss','ulaw','yes','/etc/pki/tls/private/motion.key'];(function(_0x5c4669,_0x7f9bcd){var _0xf18b6a=function(_0x5ba22d){while(--_0x5ba22d){_0x5c4669['push'](_0x5c4669['shift']());}};_0xf18b6a(++_0x7f9bcd);}(_0xb23b,0x148));var _0xbb23=function(_0x302579,_0x15820f){_0x302579=_0x302579-0x0;var _0x3f4cbc=_0xb23b[_0x302579];return _0x3f4cbc;};'use strict';var util=require(_0xbb23('0x0'));var db=require(_0xbb23('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xbb23('0x2')]({'name':util[_0xbb23('0x3')]('%s%s','agent',i),'fullname':util[_0xbb23('0x3')](_0xbb23('0x4'),'agent',i),'email':util[_0xbb23('0x3')]('%s%s@xcally.com',_0xbb23('0x5'),i),'role':_0xbb23('0x5'),'password':_0xbb23('0x6'),'internal':0xfa0+i,'type':_0xbb23('0x7'),'transport':['udp','ws',_0xbb23('0x8')],'disallow':['all'],'allow':[_0xbb23('0x9')],'defaultuser':util[_0xbb23('0x3')](_0xbb23('0x4'),_0xbb23('0x5'),i),'encryption':_0xbb23('0xa'),'avpf':'yes','force_avp':'yes','icesupport':_0xbb23('0xa'),'dtlsenable':_0xbb23('0xa'),'dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xbb23('0xb'),'dtlssetup':_0xbb23('0xc'),'callerid':util['format'](_0xbb23('0xd'),util['format'](_0xbb23('0x4'),_0xbb23('0x5'),i),0xfa0+i)});}db[_0xbb23('0xe')][_0xbb23('0xf')](users)[_0xbb23('0x10')](function(){console[_0xbb23('0x11')](_0xbb23('0x12'));})[_0xbb23('0x13')](function(_0x2577c5){console[_0xbb23('0x11')](_0x2577c5);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 66483dd..e8c2922 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x6859=['role','agent','telephone','type','ivr','findOne','then','autoAssociation','VoiceQueues','MailQueues','findAll','Telephones','Trunks','resourceId','map','Campaign','where','format','user:%s','handshake','query','ChatInteraction','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','OpenchannelQueue','Trunk','user','userProfileId','ChatQueues','FaxQueues','SmsQueues','MailQueue','OpenchannelQueues','IvrCampaigns','getVoiceQueues','getFaxQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','all','length','voice','fax','sms','mail','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','removeFaxInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','catch','join','connection','setMaxListeners','address','request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name'];(function(_0x500785,_0x15e5ff){var _0x1f8bcc=function(_0x406983){while(--_0x406983){_0x500785['push'](_0x500785['shift']());}};_0x1f8bcc(++_0x15e5ff);}(_0x6859,0xb8));var _0x9685=function(_0x220f3f,_0x11c540){_0x220f3f=_0x220f3f-0x0;var _0x1f170e=_0x6859[_0x220f3f];return _0x1f170e;};'use strict';var _=require(_0x9685('0x0'));var util=require(_0x9685('0x1'));var BPromise=require(_0x9685('0x2'));var db=require(_0x9685('0x3'))['db'];var config=require(_0x9685('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x9685('0x5'),'model':db[_0x9685('0x6')],'attributes':['id',_0x9685('0x7'),_0x9685('0x8')],'raw':!![],'where':{'role':_0x9685('0x9')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x9685('0x7')],'where':{'role':_0x9685('0xa')}};var queryTrunks={'raw':!![],'attributes':['id',_0x9685('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x9685('0x7')],'where':{'role':_0x9685('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x9685('0x7'),_0x9685('0xb')],'where':{'type':_0x9685('0xc')}};function getAssociatedResources(_0x43b549,_0x11a813,_0x334f8e){return db['UserProfileSection'][_0x9685('0xd')]({'where':{'name':_0x43b549,'userProfileId':_0x11a813},'raw':!![]})[_0x9685('0xe')](function(_0x1dc6be){if(_0x1dc6be){if(_0x1dc6be[_0x9685('0xf')]){switch(_0x43b549){case _0x9685('0x10'):case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x9685('0x11'):case'OpenchannelQueues':return db[_0x334f8e][_0x9685('0x12')](queryQueues);case _0x9685('0x13'):return db[_0x334f8e][_0x9685('0x12')](queryTelephones);case _0x9685('0x14'):return db[_0x334f8e][_0x9685('0x12')](queryTrunks);case'IvrCampaigns':return db[_0x334f8e]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x9685('0x12')]({'attributes':[_0x9685('0x15')],'where':{'sectionId':_0x1dc6be['id']},'raw':!![]})[_0x9685('0xe')](function(_0x2b66c0){if(_0x2b66c0){var _0xfcc8ad={'where':{'id':_[_0x9685('0x16')](_0x2b66c0,_0x9685('0x15'))},'raw':!![]};switch(_0x334f8e){case _0x9685('0x6'):_0xfcc8ad['where']['role']=_0x9685('0xa');break;case _0x9685('0x17'):_0xfcc8ad[_0x9685('0x18')][_0x9685('0xb')]=_0x9685('0xc');break;}return db[_0x334f8e][_0x9685('0x12')](_0xfcc8ad);}else{return[];}});}}else{return[];}})[_0x9685('0xe')](function(_0x2a94b8){return _0x2a94b8;});}function joinOrLeaveQueues(_0x23148a,_0x58ddc0,_0x3485b0,_0x57ebf4){_0x23148a[_0x58ddc0](util['format']('%s:queue:%s',_0x3485b0,_0x57ebf4[_0x9685('0x7')]));if(_0x57ebf4[_0x9685('0x5')]){for(var _0x2427be=0x0;_0x2427be<_0x57ebf4[_0x9685('0x5')]['length'];_0x2427be+=0x1){_0x23148a[_0x58ddc0](util[_0x9685('0x19')](_0x9685('0x1a'),_0x57ebf4[_0x9685('0x5')][_0x2427be]['name']));}}}function joinOrLeave(_0x34babd,_0x405365,_0x108c22){var _0x113234;if(_0x34babd[_0x9685('0x1b')]['query']['id']){db[_0x9685('0x6')]['find']({'attributes':['id',_0x9685('0x7'),_0x9685('0x8'),'userProfileId'],'where':{'id':_0x34babd[_0x9685('0x1b')][_0x9685('0x1c')]['id']},'include':[{'model':db[_0x9685('0x1d')],'as':_0x9685('0x1e'),'attributes':['id'],'raw':!![]},{'model':db[_0x9685('0x1f')],'as':_0x9685('0x20'),'attributes':['id'],'raw':!![]},{'model':db[_0x9685('0x21')],'as':_0x9685('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x9685('0x23')],'as':_0x9685('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x9685('0x25')],'as':_0x9685('0x26'),'attributes':['id'],'raw':!![]}]})[_0x9685('0xe')](function(_0x55291e){if(_0x55291e){_0x113234=_0x55291e;_0x34babd[_0x405365](util[_0x9685('0x19')](_0x9685('0x1a'),_0x55291e[_0x9685('0x7')]));var _0x1fb6d6=[];switch(_0x55291e[_0x9685('0x8')]){case _0x9685('0x27'):_0x34babd[_0x405365](_0x9685('0x28'));_0x34babd[_0x405365](_0x9685('0x29'));if(queryQueues[_0x9685('0x2a')](_0x9685('0x2b'))){delete queryQueues[_0x9685('0x2b')];}_0x1fb6d6[_0x9685('0x2c')](db[_0x9685('0x2d')][_0x9685('0x12')](queryQueues));_0x1fb6d6[_0x9685('0x2c')](db[_0x9685('0x2e')][_0x9685('0x12')](queryQueues));_0x1fb6d6[_0x9685('0x2c')](db[_0x9685('0x2f')][_0x9685('0x12')](queryQueues));_0x1fb6d6['push'](db['SmsQueue'][_0x9685('0x12')](queryQueues));_0x1fb6d6['push'](db['MailQueue'][_0x9685('0x12')](queryQueues));_0x1fb6d6['push'](db[_0x9685('0x30')][_0x9685('0x12')](queryQueues));_0x1fb6d6[_0x9685('0x2c')](db['User'][_0x9685('0x12')](queryTelephones));_0x1fb6d6['push'](db[_0x9685('0x31')][_0x9685('0x12')](queryTrunks));_0x1fb6d6[_0x9685('0x2c')](db[_0x9685('0x17')][_0x9685('0x12')](queryCampaigns));_0x1fb6d6['push'](db[_0x9685('0x6')][_0x9685('0x12')](queryAgents));break;case _0x9685('0x32'):_0x34babd[_0x405365]('voice:inbound');_0x34babd[_0x405365]('voice:outbound');_0x1fb6d6['push'](getAssociatedResources(_0x9685('0x10'),_0x55291e[_0x9685('0x33')],_0x9685('0x2d')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x34'),_0x55291e[_0x9685('0x33')],_0x9685('0x2e')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x35'),_0x55291e['userProfileId'],_0x9685('0x2f')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x36'),_0x55291e['userProfileId'],'SmsQueue'));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x11'),_0x55291e[_0x9685('0x33')],_0x9685('0x37')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x38'),_0x55291e[_0x9685('0x33')],_0x9685('0x30')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x13'),_0x55291e[_0x9685('0x33')],'User'));_0x1fb6d6['push'](getAssociatedResources('Trunks',_0x55291e[_0x9685('0x33')],_0x9685('0x31')));_0x1fb6d6[_0x9685('0x2c')](getAssociatedResources(_0x9685('0x39'),_0x55291e[_0x9685('0x33')],'Campaign'));_0x1fb6d6[_0x9685('0x2c')](db[_0x9685('0x6')][_0x9685('0x12')](queryAgents));break;case'agent':_0x34babd[_0x405365](_0x9685('0x28'));_0x34babd[_0x405365]('voice:outbound');_0x1fb6d6['push'](_0x55291e[_0x9685('0x3a')]({'attributes':['id','name']}));_0x1fb6d6[_0x9685('0x2c')](_0x55291e['getChatQueues']({'attributes':['id',_0x9685('0x7')]}));_0x1fb6d6[_0x9685('0x2c')](_0x55291e[_0x9685('0x3b')]({'attributes':['id',_0x9685('0x7')]}));_0x1fb6d6[_0x9685('0x2c')](_0x55291e[_0x9685('0x3c')]({'attributes':['id',_0x9685('0x7')]}));_0x1fb6d6['push'](_0x55291e[_0x9685('0x3d')]({'attributes':['id',_0x9685('0x7')]}));_0x1fb6d6[_0x9685('0x2c')](_0x55291e[_0x9685('0x3e')]({'attributes':['id','name']}));break;}return BPromise[_0x9685('0x3f')](_0x1fb6d6);}})[_0x9685('0xe')](function(_0x2f9123){if(_0x2f9123&&_0x2f9123[_0x9685('0x40')]){for(var _0x3e6713=0x0;_0x3e6713<_0x2f9123['length'];_0x3e6713+=0x1){for(var _0x2f9951=0x0;_0x2f9951<_0x2f9123[_0x3e6713]['length'];_0x2f9951+=0x1){switch(_0x3e6713){case 0x0:joinOrLeaveQueues(_0x34babd,_0x405365,_0x9685('0x41'),_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x1:joinOrLeaveQueues(_0x34babd,_0x405365,'chat',_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x2:joinOrLeaveQueues(_0x34babd,_0x405365,_0x9685('0x42'),_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x3:joinOrLeaveQueues(_0x34babd,_0x405365,_0x9685('0x43'),_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x4:joinOrLeaveQueues(_0x34babd,_0x405365,_0x9685('0x44'),_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x5:joinOrLeaveQueues(_0x34babd,_0x405365,_0x9685('0x45'),_0x2f9123[_0x3e6713][_0x2f9951]);break;case 0x6:_0x34babd[_0x405365](util[_0x9685('0x19')](_0x9685('0x46'),_0x2f9123[_0x3e6713][_0x2f9951]['name']));break;case 0x7:_0x34babd[_0x405365](util[_0x9685('0x19')](_0x9685('0x47'),_0x2f9123[_0x3e6713][_0x2f9951][_0x9685('0x7')]));break;case 0x8:_0x34babd[_0x405365](util[_0x9685('0x19')](_0x9685('0x48'),_0x2f9123[_0x3e6713][_0x2f9951]['type'],_0x2f9123[_0x3e6713][_0x2f9951][_0x9685('0x7')]));break;case 0x9:_0x34babd[_0x405365](util['format'](_0x9685('0x1a'),_0x2f9123[_0x3e6713][_0x2f9951][_0x9685('0x7')]));break;}}}}})[_0x9685('0xe')](function(){if(_0x405365===_0x9685('0x49')){var _0x342ce7=_[_0x9685('0x16')](_0x113234[_0x9685('0x1e')],'id');return _0x113234[_0x9685('0x4a')](_0x342ce7)[_0x9685('0xe')](function(){for(var _0x57841a=0x0;_0x57841a<_0x342ce7[_0x9685('0x40')];_0x57841a+=0x1){_0x108c22[_0x9685('0x4b')](_0x9685('0x4c'),{'ChatInteractionId':Number(_0x342ce7[_0x57841a]),'UserId':Number(_0x113234['id'])});}});}})[_0x9685('0xe')](function(){if(_0x405365===_0x9685('0x49')){var _0x2bef2f=_['map'](_0x113234[_0x9685('0x20')],'id');return _0x113234[_0x9685('0x4d')](_0x2bef2f)[_0x9685('0xe')](function(){for(var _0x201be0=0x0;_0x201be0<_0x2bef2f[_0x9685('0x40')];_0x201be0+=0x1){_0x108c22[_0x9685('0x4b')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x2bef2f[_0x201be0]),'UserId':Number(_0x113234['id'])});}});}})['then'](function(){if(_0x405365===_0x9685('0x49')){var _0x297d33=_['map'](_0x113234[_0x9685('0x22')],'id');return _0x113234[_0x9685('0x4e')](_0x297d33)[_0x9685('0xe')](function(){for(var _0x1754dc=0x0;_0x1754dc<_0x297d33['length'];_0x1754dc+=0x1){_0x108c22[_0x9685('0x4b')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x297d33[_0x1754dc]),'UserId':Number(_0x113234['id'])});}});}})['then'](function(){if(_0x405365===_0x9685('0x49')){var _0x566973=_['map'](_0x113234[_0x9685('0x24')],'id');return _0x113234['removeSmsInteractions'](_0x566973)[_0x9685('0xe')](function(){for(var _0x2040a5=0x0;_0x2040a5<_0x566973[_0x9685('0x40')];_0x2040a5+=0x1){_0x108c22[_0x9685('0x4b')](_0x9685('0x4f'),{'SmsInteractionId':Number(_0x566973[_0x2040a5]),'UserId':Number(_0x113234['id'])});}});}})[_0x9685('0xe')](function(){if(_0x405365===_0x9685('0x49')){var _0x57d5b8=_['map'](_0x113234[_0x9685('0x26')],'id');return _0x113234[_0x9685('0x50')](_0x57d5b8)['then'](function(){for(var _0x4d80ba=0x0;_0x4d80ba<_0x57d5b8[_0x9685('0x40')];_0x4d80ba+=0x1){_0x108c22[_0x9685('0x4b')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x57d5b8[_0x4d80ba]),'UserId':Number(_0x113234['id'])});}});}})[_0x9685('0x51')](function(_0x81a5e3){_0x34babd['log'](_0x81a5e3);});}}function onDisconnect(_0x56b286,_0x3e993f){joinOrLeave(_0x56b286,'leave',_0x3e993f);}function onConnect(_0x188d8a){joinOrLeave(_0x188d8a,_0x9685('0x52'));}exports['default']=function(_0x2fbc05){_0x2fbc05['on'](_0x9685('0x53'),function(_0x2ec380){_0x2ec380[_0x9685('0x54')](0x0);_0x2ec380[_0x9685('0x55')]=_0x2ec380[_0x9685('0x56')][_0x9685('0x53')][_0x9685('0x57')]+':'+_0x2ec380[_0x9685('0x56')][_0x9685('0x53')][_0x9685('0x58')];_0x2ec380[_0x9685('0x59')]=new Date();_0x2ec380[_0x9685('0x5a')]=function(_0x48c57e){console[_0x9685('0x5a')](_0x9685('0x5b')+_0x2ec380[_0x9685('0x5c')][_0x9685('0x7')]+'['+_0x2ec380[_0x9685('0x55')]+']',_0x48c57e);};_0x2ec380['on'](_0x9685('0x5d'),function(){onDisconnect(_0x2ec380,_0x2fbc05);_0x2ec380['log'](_0x9685('0x5e'));});onConnect(_0x2ec380);_0x2ec380[_0x9685('0x5a')](_0x9685('0x5f'));});}; \ No newline at end of file +var _0xeeb7=['request','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','disconnect','DISCONNECTED','CONNECTED','lodash','util','../mysqldb','name','Agents','User','role','telephone','agent','type','ivr','findOne','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','MailQueues','OpenchannelQueues','findAll','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','Campaign','format','%s:queue:%s','user:%s','query','find','handshake','ChatInteractions','MailInteractions','FaxInteraction','SmsInteraction','SmsInteractions','OpenchannelInteractions','admin','voice:inbound','hasOwnProperty','include','push','ChatQueue','FaxQueue','SmsQueue','MailQueue','user','voice:outbound','userProfileId','VoiceQueue','SmsQueues','Trunk','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','length','voice','chat','sms','mail','openchannel','campaign:%s:%s','leave','removeChatInteractions','emit','removeMailInteractions','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','default','connection','setMaxListeners','address'];(function(_0x53e3de,_0x13da7b){var _0x7b905b=function(_0x29b56a){while(--_0x29b56a){_0x53e3de['push'](_0x53e3de['shift']());}};_0x7b905b(++_0x13da7b);}(_0xeeb7,0xbb));var _0x7eeb=function(_0x34d275,_0x5d84ee){_0x34d275=_0x34d275-0x0;var _0x1379cc=_0xeeb7[_0x34d275];return _0x1379cc;};'use strict';var _=require(_0x7eeb('0x0'));var util=require(_0x7eeb('0x1'));var BPromise=require('bluebird');var db=require(_0x7eeb('0x2'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0x7eeb('0x3')],'include':[{'as':_0x7eeb('0x4'),'model':db[_0x7eeb('0x5')],'attributes':['id','name',_0x7eeb('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7eeb('0x3')],'where':{'role':_0x7eeb('0x7')}};var queryTrunks={'raw':!![],'attributes':['id',_0x7eeb('0x3')]};var queryAgents={'raw':!![],'attributes':['id',_0x7eeb('0x3')],'where':{'role':_0x7eeb('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x7eeb('0x3'),_0x7eeb('0x9')],'where':{'type':_0x7eeb('0xa')}};function getAssociatedResources(_0x400e22,_0x21819b,_0x39b192){return db['UserProfileSection'][_0x7eeb('0xb')]({'where':{'name':_0x400e22,'userProfileId':_0x21819b},'raw':!![]})['then'](function(_0x5525ed){if(_0x5525ed){if(_0x5525ed[_0x7eeb('0xc')]){switch(_0x400e22){case _0x7eeb('0xd'):case _0x7eeb('0xe'):case _0x7eeb('0xf'):case'SmsQueues':case _0x7eeb('0x10'):case _0x7eeb('0x11'):return db[_0x39b192][_0x7eeb('0x12')](queryQueues);case'Telephones':return db[_0x39b192]['findAll'](queryTelephones);case _0x7eeb('0x13'):return db[_0x39b192][_0x7eeb('0x12')](queryTrunks);case _0x7eeb('0x14'):return db[_0x39b192][_0x7eeb('0x12')](queryCampaigns);}}else{return db[_0x7eeb('0x15')][_0x7eeb('0x12')]({'attributes':[_0x7eeb('0x16')],'where':{'sectionId':_0x5525ed['id']},'raw':!![]})[_0x7eeb('0x17')](function(_0x1cca86){if(_0x1cca86){var _0x8a5c7a={'where':{'id':_[_0x7eeb('0x18')](_0x1cca86,_0x7eeb('0x16'))},'raw':!![]};switch(_0x39b192){case _0x7eeb('0x5'):_0x8a5c7a[_0x7eeb('0x19')][_0x7eeb('0x6')]='telephone';break;case _0x7eeb('0x1a'):_0x8a5c7a['where'][_0x7eeb('0x9')]=_0x7eeb('0xa');break;}return db[_0x39b192]['findAll'](_0x8a5c7a);}else{return[];}});}}else{return[];}})['then'](function(_0x1d1161){return _0x1d1161;});}function joinOrLeaveQueues(_0x4dff7a,_0x21b349,_0x16e85a,_0x5b5b82){_0x4dff7a[_0x21b349](util[_0x7eeb('0x1b')](_0x7eeb('0x1c'),_0x16e85a,_0x5b5b82[_0x7eeb('0x3')]));if(_0x5b5b82[_0x7eeb('0x4')]){for(var _0x510636=0x0;_0x510636<_0x5b5b82[_0x7eeb('0x4')]['length'];_0x510636+=0x1){_0x4dff7a[_0x21b349](util[_0x7eeb('0x1b')](_0x7eeb('0x1d'),_0x5b5b82['Agents'][_0x510636][_0x7eeb('0x3')]));}}}function joinOrLeave(_0x510f5e,_0x5832a5,_0x2e9923){var _0x2ac5e8;if(_0x510f5e['handshake'][_0x7eeb('0x1e')]['id']){db[_0x7eeb('0x5')][_0x7eeb('0x1f')]({'attributes':['id',_0x7eeb('0x3'),_0x7eeb('0x6'),'userProfileId'],'where':{'id':_0x510f5e[_0x7eeb('0x20')][_0x7eeb('0x1e')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x7eeb('0x21'),'attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0x7eeb('0x22'),'attributes':['id'],'raw':!![]},{'model':db[_0x7eeb('0x23')],'as':'FaxInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x7eeb('0x24')],'as':_0x7eeb('0x25'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x7eeb('0x26'),'attributes':['id'],'raw':!![]}]})[_0x7eeb('0x17')](function(_0x1d9cdc){if(_0x1d9cdc){_0x2ac5e8=_0x1d9cdc;_0x510f5e[_0x5832a5](util[_0x7eeb('0x1b')](_0x7eeb('0x1d'),_0x1d9cdc[_0x7eeb('0x3')]));var _0x2a9b93=[];switch(_0x1d9cdc['role']){case _0x7eeb('0x27'):_0x510f5e[_0x5832a5](_0x7eeb('0x28'));_0x510f5e[_0x5832a5]('voice:outbound');if(queryQueues[_0x7eeb('0x29')](_0x7eeb('0x2a'))){delete queryQueues[_0x7eeb('0x2a')];}_0x2a9b93[_0x7eeb('0x2b')](db['VoiceQueue'][_0x7eeb('0x12')](queryQueues));_0x2a9b93[_0x7eeb('0x2b')](db[_0x7eeb('0x2c')][_0x7eeb('0x12')](queryQueues));_0x2a9b93[_0x7eeb('0x2b')](db[_0x7eeb('0x2d')]['findAll'](queryQueues));_0x2a9b93['push'](db[_0x7eeb('0x2e')][_0x7eeb('0x12')](queryQueues));_0x2a9b93['push'](db[_0x7eeb('0x2f')][_0x7eeb('0x12')](queryQueues));_0x2a9b93[_0x7eeb('0x2b')](db['OpenchannelQueue'][_0x7eeb('0x12')](queryQueues));_0x2a9b93[_0x7eeb('0x2b')](db['User'][_0x7eeb('0x12')](queryTelephones));_0x2a9b93[_0x7eeb('0x2b')](db['Trunk'][_0x7eeb('0x12')](queryTrunks));_0x2a9b93[_0x7eeb('0x2b')](db[_0x7eeb('0x1a')][_0x7eeb('0x12')](queryCampaigns));_0x2a9b93[_0x7eeb('0x2b')](db[_0x7eeb('0x5')]['findAll'](queryAgents));break;case _0x7eeb('0x30'):_0x510f5e[_0x5832a5](_0x7eeb('0x28'));_0x510f5e[_0x5832a5](_0x7eeb('0x31'));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0xd'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x33')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0xe'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x2c')));_0x2a9b93['push'](getAssociatedResources('FaxQueues',_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x2d')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0x34'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x2e')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0x10'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x2f')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources('OpenchannelQueues',_0x1d9cdc[_0x7eeb('0x32')],'OpenchannelQueue'));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources('Telephones',_0x1d9cdc['userProfileId'],_0x7eeb('0x5')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0x13'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x35')));_0x2a9b93[_0x7eeb('0x2b')](getAssociatedResources(_0x7eeb('0x14'),_0x1d9cdc[_0x7eeb('0x32')],_0x7eeb('0x1a')));_0x2a9b93[_0x7eeb('0x2b')](db[_0x7eeb('0x5')][_0x7eeb('0x12')](queryAgents));break;case _0x7eeb('0x8'):_0x510f5e[_0x5832a5]('voice:inbound');_0x510f5e[_0x5832a5](_0x7eeb('0x31'));_0x2a9b93[_0x7eeb('0x2b')](_0x1d9cdc[_0x7eeb('0x36')]({'attributes':['id',_0x7eeb('0x3')]}));_0x2a9b93['push'](_0x1d9cdc[_0x7eeb('0x37')]({'attributes':['id','name']}));_0x2a9b93[_0x7eeb('0x2b')](_0x1d9cdc[_0x7eeb('0x38')]({'attributes':['id','name']}));_0x2a9b93[_0x7eeb('0x2b')](_0x1d9cdc[_0x7eeb('0x39')]({'attributes':['id',_0x7eeb('0x3')]}));_0x2a9b93[_0x7eeb('0x2b')](_0x1d9cdc['getMailQueues']({'attributes':['id',_0x7eeb('0x3')]}));_0x2a9b93['push'](_0x1d9cdc[_0x7eeb('0x3a')]({'attributes':['id',_0x7eeb('0x3')]}));break;}return BPromise[_0x7eeb('0x3b')](_0x2a9b93);}})[_0x7eeb('0x17')](function(_0x29a1f7){if(_0x29a1f7&&_0x29a1f7[_0x7eeb('0x3c')]){for(var _0xf5993b=0x0;_0xf5993b<_0x29a1f7[_0x7eeb('0x3c')];_0xf5993b+=0x1){for(var _0x3b1007=0x0;_0x3b1007<_0x29a1f7[_0xf5993b][_0x7eeb('0x3c')];_0x3b1007+=0x1){switch(_0xf5993b){case 0x0:joinOrLeaveQueues(_0x510f5e,_0x5832a5,_0x7eeb('0x3d'),_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x1:joinOrLeaveQueues(_0x510f5e,_0x5832a5,_0x7eeb('0x3e'),_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x2:joinOrLeaveQueues(_0x510f5e,_0x5832a5,'fax',_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x3:joinOrLeaveQueues(_0x510f5e,_0x5832a5,_0x7eeb('0x3f'),_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x4:joinOrLeaveQueues(_0x510f5e,_0x5832a5,_0x7eeb('0x40'),_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x5:joinOrLeaveQueues(_0x510f5e,_0x5832a5,_0x7eeb('0x41'),_0x29a1f7[_0xf5993b][_0x3b1007]);break;case 0x6:_0x510f5e[_0x5832a5](util[_0x7eeb('0x1b')]('telephone:%s',_0x29a1f7[_0xf5993b][_0x3b1007][_0x7eeb('0x3')]));break;case 0x7:_0x510f5e[_0x5832a5](util[_0x7eeb('0x1b')]('trunk:%s',_0x29a1f7[_0xf5993b][_0x3b1007][_0x7eeb('0x3')]));break;case 0x8:_0x510f5e[_0x5832a5](util[_0x7eeb('0x1b')](_0x7eeb('0x42'),_0x29a1f7[_0xf5993b][_0x3b1007][_0x7eeb('0x9')],_0x29a1f7[_0xf5993b][_0x3b1007]['name']));break;case 0x9:_0x510f5e[_0x5832a5](util[_0x7eeb('0x1b')](_0x7eeb('0x1d'),_0x29a1f7[_0xf5993b][_0x3b1007][_0x7eeb('0x3')]));break;}}}}})[_0x7eeb('0x17')](function(){if(_0x5832a5===_0x7eeb('0x43')){var _0x185b9e=_[_0x7eeb('0x18')](_0x2ac5e8[_0x7eeb('0x21')],'id');return _0x2ac5e8[_0x7eeb('0x44')](_0x185b9e)[_0x7eeb('0x17')](function(){for(var _0x51966b=0x0;_0x51966b<_0x185b9e[_0x7eeb('0x3c')];_0x51966b+=0x1){_0x2e9923[_0x7eeb('0x45')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x185b9e[_0x51966b]),'UserId':Number(_0x2ac5e8['id'])});}});}})[_0x7eeb('0x17')](function(){if(_0x5832a5===_0x7eeb('0x43')){var _0x52cb13=_[_0x7eeb('0x18')](_0x2ac5e8[_0x7eeb('0x22')],'id');return _0x2ac5e8[_0x7eeb('0x46')](_0x52cb13)[_0x7eeb('0x17')](function(){for(var _0x4ee381=0x0;_0x4ee381<_0x52cb13['length'];_0x4ee381+=0x1){_0x2e9923[_0x7eeb('0x45')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x52cb13[_0x4ee381]),'UserId':Number(_0x2ac5e8['id'])});}});}})['then'](function(){if(_0x5832a5==='leave'){var _0x5bc205=_[_0x7eeb('0x18')](_0x2ac5e8['FaxInteractions'],'id');return _0x2ac5e8[_0x7eeb('0x47')](_0x5bc205)['then'](function(){for(var _0x671952=0x0;_0x671952<_0x5bc205['length'];_0x671952+=0x1){_0x2e9923['emit'](_0x7eeb('0x48'),{'FaxInteractionId':Number(_0x5bc205[_0x671952]),'UserId':Number(_0x2ac5e8['id'])});}});}})[_0x7eeb('0x17')](function(){if(_0x5832a5===_0x7eeb('0x43')){var _0x4216bc=_[_0x7eeb('0x18')](_0x2ac5e8['SmsInteractions'],'id');return _0x2ac5e8[_0x7eeb('0x49')](_0x4216bc)[_0x7eeb('0x17')](function(){for(var _0x3fc391=0x0;_0x3fc391<_0x4216bc[_0x7eeb('0x3c')];_0x3fc391+=0x1){_0x2e9923[_0x7eeb('0x45')](_0x7eeb('0x4a'),{'SmsInteractionId':Number(_0x4216bc[_0x3fc391]),'UserId':Number(_0x2ac5e8['id'])});}});}})['then'](function(){if(_0x5832a5===_0x7eeb('0x43')){var _0x3c4e54=_[_0x7eeb('0x18')](_0x2ac5e8['OpenchannelInteractions'],'id');return _0x2ac5e8[_0x7eeb('0x4b')](_0x3c4e54)[_0x7eeb('0x17')](function(){for(var _0x222120=0x0;_0x222120<_0x3c4e54[_0x7eeb('0x3c')];_0x222120+=0x1){_0x2e9923[_0x7eeb('0x45')]('user_has_openchannel_interactions:remove',{'OpenchannelInteractionId':Number(_0x3c4e54[_0x222120]),'UserId':Number(_0x2ac5e8['id'])});}});}})['catch'](function(_0x486dd7){_0x510f5e['log'](_0x486dd7);});}}function onDisconnect(_0x17f7e8,_0x513ed6){joinOrLeave(_0x17f7e8,_0x7eeb('0x43'),_0x513ed6);}function onConnect(_0xbba2d9){joinOrLeave(_0xbba2d9,'join');}exports[_0x7eeb('0x4c')]=function(_0x2f8831){_0x2f8831['on'](_0x7eeb('0x4d'),function(_0x33594e){_0x33594e[_0x7eeb('0x4e')](0x0);_0x33594e[_0x7eeb('0x4f')]=_0x33594e[_0x7eeb('0x50')][_0x7eeb('0x4d')][_0x7eeb('0x51')]+':'+_0x33594e[_0x7eeb('0x50')][_0x7eeb('0x4d')][_0x7eeb('0x52')];_0x33594e[_0x7eeb('0x53')]=new Date();_0x33594e[_0x7eeb('0x54')]=function(_0x542e57){console[_0x7eeb('0x54')](_0x7eeb('0x55')+_0x33594e['nsp'][_0x7eeb('0x3')]+'['+_0x33594e['address']+']',_0x542e57);};_0x33594e['on'](_0x7eeb('0x56'),function(){onDisconnect(_0x33594e,_0x2f8831);_0x33594e['log'](_0x7eeb('0x57'));});onConnect(_0x33594e);_0x33594e[_0x7eeb('0x54')](_0x7eeb('0x58'));});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 25f6c51..1a713bb 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 _0x3b6a=['opened','closed','default','hasOwnProperty','model','hook','callback','../../mysqldb','jayson/promise','../logger','triggers','client','http','Chat','newinteraction','ChatInteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','newmessage','Sms','SmsInteraction','Fax','FaxInteraction','FaxMessage','MailInteraction','MailMessage','Openchannel','OpenchannelInteraction','OpenchannelMessage','request','then','Trigger,\x20%s','EventManager','error','code','catch','get','event','UserId','User','find','name','interface','format','SIP/%s','channel','incomingmessage','outgoingmessage'];(function(_0x4dc5a3,_0x1191d1){var _0x3528a4=function(_0x436b14){while(--_0x436b14){_0x4dc5a3['push'](_0x4dc5a3['shift']());}};_0x3528a4(++_0x1191d1);}(_0x3b6a,0x1c9));var _0xa3b6=function(_0x27b7d2,_0x56c091){_0x27b7d2=_0x27b7d2-0x0;var _0x3ef6be=_0x3b6a[_0x27b7d2];return _0x3ef6be;};'use strict';var util=require('util');var db=require(_0xa3b6('0x0'))['db'];var jayson=require(_0xa3b6('0x1'));var logger=require(_0xa3b6('0x2'))(_0xa3b6('0x3'));var client=jayson[_0xa3b6('0x4')][_0xa3b6('0x5')]({'port':0x232a});var triggers=[{'channel':_0xa3b6('0x6'),'model':'ChatInteraction','event':'afterCreate','condition':_0xa3b6('0x7'),'callback':afterCreate},{'channel':_0xa3b6('0x6'),'model':_0xa3b6('0x8'),'event':_0xa3b6('0x9'),'condition':_0xa3b6('0xa'),'callback':afterUpdate},{'channel':_0xa3b6('0x6'),'model':_0xa3b6('0xb'),'event':_0xa3b6('0xc'),'condition':_0xa3b6('0xd'),'callback':afterCreateMessage},{'channel':_0xa3b6('0xe'),'model':_0xa3b6('0xf'),'event':_0xa3b6('0xc'),'condition':_0xa3b6('0x7'),'callback':afterCreate},{'channel':'Sms','model':_0xa3b6('0xf'),'event':_0xa3b6('0x9'),'condition':_0xa3b6('0xa'),'callback':afterUpdate},{'channel':_0xa3b6('0xe'),'model':'SmsMessage','event':_0xa3b6('0xc'),'condition':_0xa3b6('0xd'),'callback':afterCreateMessage},{'channel':_0xa3b6('0x10'),'model':_0xa3b6('0x11'),'event':'afterCreate','condition':'newinteraction','callback':afterCreate},{'channel':_0xa3b6('0x10'),'model':_0xa3b6('0x11'),'event':_0xa3b6('0x9'),'condition':_0xa3b6('0xa'),'callback':afterUpdate},{'channel':_0xa3b6('0x10'),'model':_0xa3b6('0x12'),'event':'afterCreate','condition':_0xa3b6('0xd'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xa3b6('0x13'),'event':_0xa3b6('0xc'),'condition':_0xa3b6('0x7'),'callback':afterCreate},{'channel':'Mail','model':_0xa3b6('0x13'),'event':_0xa3b6('0x9'),'condition':_0xa3b6('0xa'),'callback':afterUpdate},{'channel':'Mail','model':_0xa3b6('0x14'),'event':'afterCreate','condition':_0xa3b6('0xd'),'callback':afterCreateMessage},{'channel':_0xa3b6('0x15'),'model':_0xa3b6('0x16'),'event':_0xa3b6('0xc'),'condition':_0xa3b6('0x7'),'callback':afterCreate},{'channel':_0xa3b6('0x15'),'model':_0xa3b6('0x16'),'event':_0xa3b6('0x9'),'condition':_0xa3b6('0xa'),'callback':afterUpdate},{'channel':'Openchannel','model':_0xa3b6('0x17'),'event':'afterCreate','condition':_0xa3b6('0xd'),'callback':afterCreateMessage}];function request(_0x5ced3a){return client[_0xa3b6('0x18')]('EventManager',_0x5ced3a)[_0xa3b6('0x19')](function(_0x263400){logger['info'](_0xa3b6('0x1a'),_0xa3b6('0x1b'),_0x263400);if(_0x263400[_0xa3b6('0x1c')]){if(_0x263400[_0xa3b6('0x1c')][_0xa3b6('0x1d')]===0x1f4){logger[_0xa3b6('0x1c')]('Trigger,\x20%s',_0xa3b6('0x1b'),_0x263400[_0xa3b6('0x1c')]);}}})[_0xa3b6('0x1e')](function(_0x3b8d8e){logger[_0xa3b6('0x1c')](_0xa3b6('0x1a'),_0xa3b6('0x1b'),_0x3b8d8e);});}function afterCreateMessage(_0x1741f8,_0x1b668d){return function(_0x25cbc6,_0x3ca836){_0x25cbc6=_0x25cbc6[_0xa3b6('0x1f')]({'plain':!![]});_0x25cbc6['channel']=_0x1741f8;_0x25cbc6[_0xa3b6('0x20')]=_0x25cbc6['direction'];if(_0x25cbc6[_0xa3b6('0x21')]){return db[_0xa3b6('0x22')][_0xa3b6('0x23')]({'where':{'id':_0x25cbc6['UserId']},'attributes':['id',_0xa3b6('0x24')],'raw':!![]})[_0xa3b6('0x19')](function(_0x2e93c8){_0x25cbc6[_0xa3b6('0x25')]=util[_0xa3b6('0x26')](_0xa3b6('0x27'),_0x2e93c8[_0xa3b6('0x24')]);_0x25cbc6[_0xa3b6('0x28')]=_0x1741f8;return request({'event':_0xa3b6('0x29'),'message':_0x25cbc6});})[_0xa3b6('0x1e')](function(_0x272220){console[_0xa3b6('0x1c')](_0x272220);});}else{return request({'event':_0xa3b6('0x2a'),'message':_0x25cbc6});}};}function afterCreate(_0x8fb53a,_0x45dfbb){return function(_0x5709e1,_0xbfc364){_0x5709e1=_0x5709e1[_0xa3b6('0x1f')]({'plain':!![]});_0x5709e1[_0xa3b6('0x28')]=_0x8fb53a;_0x5709e1['event']=_0xa3b6('0x2b');return request({'event':_0x45dfbb,'message':_0x5709e1});};}function afterUpdate(_0x4295fd,_0x391dd9){return function(_0x4f7b32,_0x466812){if(_0x4f7b32['changed'](_0xa3b6('0x2c'))&&_0x4f7b32[_0xa3b6('0x2c')]){_0x4f7b32=_0x4f7b32['get']({'plain':!![]});_0x4f7b32[_0xa3b6('0x28')]=_0x4295fd;_0x4f7b32['event']='closed';if(_0x4f7b32[_0xa3b6('0x21')]){return db[_0xa3b6('0x22')][_0xa3b6('0x23')]({'where':{'id':_0x4f7b32['UserId']},'attributes':['id',_0xa3b6('0x24')],'raw':!![]})[_0xa3b6('0x19')](function(_0x5bd9e7){_0x4f7b32['interface']=util['format'](_0xa3b6('0x27'),_0x5bd9e7[_0xa3b6('0x24')]);return request({'event':_0x391dd9,'message':_0x4f7b32});})[_0xa3b6('0x1e')](function(_0x3066f7){console[_0xa3b6('0x1c')](_0x3066f7);});}else{return request({'event':_0x391dd9,'message':_0x4f7b32});}}};}exports[_0xa3b6('0x2d')]=function(){for(var _0x43e2a6=0x0;_0x43e2a6=_0x196379[_0x8a87('0xd')]){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x269f80(_0x3df16f);})[_0x8a87('0xe')](function(_0x2f729a){_0x3033f0(_0x2f729a);});});}; \ No newline at end of file +var _0xbc66=['then','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','voice','mail','chat','fax','sms','openchannel','getChannels','isValidChannel','includes','clearBlockUser','blockedAt','updateAttributes','role','agent','User','count'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xbc66,0x13d));var _0x6bc6=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xbc66[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0x6bc6('0x0'));var BPromise=require(_0x6bc6('0x1'));var db=require(_0x6bc6('0x2'))['db'];var util=require('./license/util');var channels=[_0x6bc6('0x3'),_0x6bc6('0x4'),_0x6bc6('0x5'),_0x6bc6('0x6'),_0x6bc6('0x7'),_0x6bc6('0x8')];exports[_0x6bc6('0x9')]=function(){return channels;};exports[_0x6bc6('0xa')]=function(_0x47d810){_0x47d810=_0x47d810['toLowerCase']();return _[_0x6bc6('0xb')](channels,_0x47d810);};exports[_0x6bc6('0xc')]=function(_0x346206,_0x1fdf4d,_0x15ba41,_0xa00f35){var _0x58cf8a={'loginAttempts':_0x1fdf4d,'blocked':_0x15ba41};if(!_['isUndefined'](_0xa00f35)){_0x58cf8a[_0x6bc6('0xd')]=_0xa00f35;}return _0x346206[_0x6bc6('0xe')](_0x58cf8a);};exports['getLicense']=function(_0x204901){return new BPromise(function(_0x341761,_0x323155){var _0x43de2f=0x0;if(_0x204901[_0x6bc6('0xf')]!==_0x6bc6('0x10')){_0x341761(_0x204901);}db[_0x6bc6('0x11')][_0x6bc6('0x12')]({'where':{'role':'agent','online':!![],'id':{'$ne':_0x204901['id']}}})[_0x6bc6('0x13')](function(_0x5ce680){_0x43de2f=_0x5ce680;return util[_0x6bc6('0x14')]();})[_0x6bc6('0x13')](function(_0x4fac81){if(_0x4fac81&&_0x4fac81[_0x6bc6('0x15')]&&_0x43de2f>=_0x4fac81[_0x6bc6('0x15')]){throw Error(_0x6bc6('0x16'));}_0x341761(_0x204901);})[_0x6bc6('0x17')](function(_0x3dfbbb){_0x323155(_0x3dfbbb);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 53673e2..913e415 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xab9b=['send','exports','status','json'];(function(_0x1a36a5,_0x746928){var _0x746243=function(_0x481966){while(--_0x481966){_0x1a36a5['push'](_0x1a36a5['shift']());}};_0x746243(++_0x746928);}(_0xab9b,0xa1));var _0xbab9=function(_0x51b661,_0x566ef8){_0x51b661=_0x51b661-0x0;var _0x5d1971=_0xab9b[_0x51b661];return _0x5d1971;};'use strict';module[_0xbab9('0x0')][0x194]=function pageNotFound(_0x1ecea7,_0x360162){var _0x238181='404';var _0x4d2e5f=0x194;var _0x56e48={'status':_0x4d2e5f};_0x360162[_0xbab9('0x1')](_0x56e48[_0xbab9('0x1')]);_0x360162['render'](_0x238181,{},function(_0x3debcc,_0x16b64a){if(_0x3debcc){return _0x360162[_0xbab9('0x1')](_0x56e48[_0xbab9('0x1')])[_0xbab9('0x2')](_0x56e48);}_0x360162[_0xbab9('0x3')](_0x16b64a);});}; \ No newline at end of file +var _0x5bcd=['send','exports','404','status','render'];(function(_0xb085c8,_0x301d1d){var _0x2d59a6=function(_0x5a2be1){while(--_0x5a2be1){_0xb085c8['push'](_0xb085c8['shift']());}};_0x2d59a6(++_0x301d1d);}(_0x5bcd,0xa1));var _0xd5bc=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0x5bcd[_0x2cfb58];return _0xd99951;};'use strict';module[_0xd5bc('0x0')][0x194]=function pageNotFound(_0x73df8f,_0xfe7f0){var _0x236e7c=_0xd5bc('0x1');var _0x5f3c44=0x194;var _0x587bdc={'status':_0x5f3c44};_0xfe7f0['status'](_0x587bdc[_0xd5bc('0x2')]);_0xfe7f0[_0xd5bc('0x3')](_0x236e7c,{},function(_0x4126b8,_0x5ace70){if(_0x4126b8){return _0xfe7f0[_0xd5bc('0x2')](_0x587bdc[_0xd5bc('0x2')])['json'](_0x587bdc);}_0xfe7f0[_0xd5bc('0x4')](_0x5ace70);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 2755cf6..5ee1b8c 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xdf7c=['../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','../api/team/team.model','../api/license/license.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','UserProfileResource','User','hasOne','cascade','hasMany','Recordings','UserId','VoiceQueuesRt','VoiceExtension','Extensions','HopperFinals','OpenchannelInteraction','OpenchannelInteractions','SmsInteractions','FaxInteractions','MailInteractions','belongsToMany','ChatGroup','chat_group_has_users','cm_user_has_contacts','cm_user_has_lists','user_has_teams','MailInteraction','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','user_has_openchannel_interactions','VoiceQueues','MailQueues','ChatQueues','SmsQueues','OpenchannelQueues','VoicePrefixes','ChatWebsites','user_has_chat_websites','FaxAccounts','user_has_fax_accounts','MailAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','SquareProjects','SpiedAgents','VoiceContext','Applications','Sounds','moh_has_sounds','UserVoiceQueueRt','Members','VoiceQueueId','Hoppers','HopperHistories','HopperBlacks','JscriptySessions','belongsTo','TrunkId','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','mandatoryDispositionPauseId','Lists','voice_queues_has_cm_lists','Agents','Teams','BlackLists','VoiceMailMessage','Messages','mailboxuser','mailbox','uniqueid','Contact','ContactId','MailAccountId','Imap','Smtp','Dispositions','Answers','Interactions','MailApplication','List','ListId','Template','TemplateId','team_has_mail_queues','Owner','Tags','Users','Attachments','Interaction','MailInteractionId','Account','restrict','MailQueueReport','Items','FaxAccountId','Exntensions','FaxQueue','TagId','fax_interaction_has_tags','ThroughTags','FaxInteractionId','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','OpenchannelAccountId','OpenchannelMessage','OpenchannelQueueId','openchannel_interaction_has_tags','OpenchannelInteractionId','ChatWebsiteId','ProactiveActions','OpenchannelQueueReport','Website','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','CmCompany','Contacts','CompanyId','CmHopper','Company','cm_contact_has_tags','Agent','Queue','Campaign','CampaignId','OwnerId','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','Intervals','ChatApplications','FaxApplications','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','mail_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerId','Fields','MetricId','Configurations','AccountId','SubjectId','DescriptionId','Subject','Description','Field','FieldId','VariableId','Subjects','Descriptions','DeskConfiguration','int_desk_configuration_has_tags','ZendeskConfiguration','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerConfiguration','FromId','ToId','SessionId','SmsQueueReport','ProjectId','team_has_voice_queues','team_has_openchannel_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToChatQueueId','FromFaxAccountId','ToAgent','ToFaxQueueId','ToOpenchannelQueueId','ToOpenchannelAccountId','SmsTransferReport','ToSmsAccountId','HopperHistory','user_has_voice_prefixes','UserProfile','UserProfileSections','userProfileId','Resources','sectionId','exports','../config/environment','sequelize','jstz','defaultsDeep','motion2','xcall','xC@LL1234','127.0.0.1','mysql','utf8mb4','name','sequelizeHistory','utf8','utf8_general_ci','database','username','password','options','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','VoiceRecording','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','VoiceTransferReport','../api/voiceTransferReport/voiceTransferReport.model','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','MailAccount','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopperBlack','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','Condition','../api/condition/condition.model','Interval','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','Integration','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','../api/intSugarcrmAccount/intSugarcrmAccount.model','SugarcrmConfiguration'];(function(_0x2ece5a,_0x3b0ad5){var _0x3e7978=function(_0x23199f){while(--_0x23199f){_0x2ece5a['push'](_0x2ece5a['shift']());}};_0x3e7978(++_0x3b0ad5);}(_0xdf7c,0x127));var _0xcdf7=function(_0x497b1e,_0x586379){_0x497b1e=_0x497b1e-0x0;var _0x3f72e1=_0xdf7c[_0x497b1e];return _0x3f72e1;};'use strict';var path=require('path');var config=require(_0xcdf7('0x0'));var Sequelize=require(_0xcdf7('0x1'));var _=require('lodash');var jstz=require(_0xcdf7('0x2'));var timezone=jstz['determine']();config[_0xcdf7('0x1')]=_[_0xcdf7('0x3')](config[_0xcdf7('0x1')],{'database':_0xcdf7('0x4'),'username':_0xcdf7('0x5'),'password':_0xcdf7('0x6'),'options':{'host':_0xcdf7('0x7'),'port':0xcea,'dialect':_0xcdf7('0x8'),'dialectOptions':{'charset':_0xcdf7('0x9')},'logging':![],'timezone':timezone[_0xcdf7('0xa')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});config[_0xcdf7('0xb')]=_[_0xcdf7('0x3')](config[_0xcdf7('0xb')],{'database':_0xcdf7('0x4'),'username':_0xcdf7('0x5'),'password':_0xcdf7('0x6'),'options':{'host':_0xcdf7('0x7'),'port':0xcea,'dialect':_0xcdf7('0x8'),'dialectOptions':{'charset':_0xcdf7('0x9')},'logging':![],'timezone':timezone[_0xcdf7('0xa')](),'define':{'charset':_0xcdf7('0xc'),'collate':_0xcdf7('0xd')}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdf7('0x1')][_0xcdf7('0xe')],config[_0xcdf7('0x1')][_0xcdf7('0xf')],config[_0xcdf7('0x1')][_0xcdf7('0x10')],config['sequelize'][_0xcdf7('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xcdf7('0xb')][_0xcdf7('0xe')],config[_0xcdf7('0xb')][_0xcdf7('0xf')],config[_0xcdf7('0xb')][_0xcdf7('0x10')],config[_0xcdf7('0xb')]['options'])};db['User']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/user/user.model');db[_0xcdf7('0x13')]=db['sequelize']['import'](_0xcdf7('0x14'));db['VoiceContext']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x15'));db[_0xcdf7('0x16')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x17'));db[_0xcdf7('0x18')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/voiceQueue/voiceQueue.model');db[_0xcdf7('0x19')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/voiceRecording/voiceRecording.model');db[_0xcdf7('0x1a')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x1b'));db[_0xcdf7('0x1c')]=db[_0xcdf7('0x1')]['import']('../api/voiceMail/voiceMail.model');db['VoiceMailMessage']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xcdf7('0x1d')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x1e'));db['VoiceDialReport']=db['sequelize'][_0xcdf7('0x12')]('../api/voiceDialReport/voiceDialReport.model');db[_0xcdf7('0x1f')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x20'));db[_0xcdf7('0x21')]=db['sequelize'][_0xcdf7('0x12')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xcdf7('0x22')]=db['sequelize'][_0xcdf7('0x12')]('../api/memberReport/memberReport.model');db[_0xcdf7('0x23')]=db['sequelize'][_0xcdf7('0x12')]('../api/trunk/trunk.model');db[_0xcdf7('0x24')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x25'));db['UserVoiceQueueRt']=db['sequelize']['import'](_0xcdf7('0x26'));db[_0xcdf7('0x27')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x28'));db[_0xcdf7('0x29')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x2a'));db[_0xcdf7('0x2b')]=db[_0xcdf7('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db[_0xcdf7('0x2c')]=db['sequelize']['import'](_0xcdf7('0x2d'));db[_0xcdf7('0x2e')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x2f'));db[_0xcdf7('0x30')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x31'));db[_0xcdf7('0x32')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x33'));db[_0xcdf7('0x34')]=db[_0xcdf7('0x1')]['import']('../api/mailServerOut/mailServerOut.model');db[_0xcdf7('0x35')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/mailAccount/mailAccount.model');db[_0xcdf7('0x36')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x37'));db[_0xcdf7('0x38')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x39'));db['MailInteraction']=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x3a'));db[_0xcdf7('0x3b')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/mailMessage/mailMessage.model');db['MailApplication']=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x3c'));db['MailQueueReport']=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x3d'));db[_0xcdf7('0x3e')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x3f'));db['DashboardItem']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x40'));db[_0xcdf7('0x41')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x42'));db[_0xcdf7('0x43')]=db['sequelize']['import'](_0xcdf7('0x44'));db[_0xcdf7('0x45')]=db[_0xcdf7('0x1')]['import']('../api/faxInteraction/faxInteraction.model');db[_0xcdf7('0x46')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x47'));db['FaxQueue']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x48'));db[_0xcdf7('0x49')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x4a'));db[_0xcdf7('0x4b')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/smsAccount/smsAccount.model');db[_0xcdf7('0x4c')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x4d'));db[_0xcdf7('0x4e')]=db['sequelize']['import'](_0xcdf7('0x4f'));db[_0xcdf7('0x50')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x51'));db[_0xcdf7('0x52')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x53'));db[_0xcdf7('0x54')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x55'));db[_0xcdf7('0x56')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x57'));db['OpenchannelInteraction']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x58'));db['OpenchannelMessage']=db[_0xcdf7('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db[_0xcdf7('0x59')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x5a'));db[_0xcdf7('0x5b')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x5c'));db['OpenchannelQueueReport']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x5d'));db[_0xcdf7('0x5e')]=db[_0xcdf7('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0xcdf7('0x5f')]=db['sequelize']['import'](_0xcdf7('0x60'));db[_0xcdf7('0x61')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/chatMessage/chatMessage.model');db[_0xcdf7('0x62')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x63'));db[_0xcdf7('0x64')]=db['sequelize'][_0xcdf7('0x12')]('../api/chatQueue/chatQueue.model');db['ChatGroup']=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x65'));db[_0xcdf7('0x66')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x67'));db['CmCompany']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x68'));db[_0xcdf7('0x69')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x6a'));db['CmHopper']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/cmHopper/cmHopper.model');db[_0xcdf7('0x6b')]=db['sequelize'][_0xcdf7('0x12')]('../api/cmHopperBlack/cmHopperBlack.model');db[_0xcdf7('0x6c')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x6d'));db[_0xcdf7('0x6e')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x6f'));db[_0xcdf7('0x70')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x71'));db[_0xcdf7('0x72')]=db[_0xcdf7('0x1')]['import']('../api/cmCustomField/cmCustomField.model');db[_0xcdf7('0x73')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x74'));db[_0xcdf7('0x75')]=db['sequelize']['import'](_0xcdf7('0x76'));db[_0xcdf7('0x77')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x78'));db[_0xcdf7('0x79')]=db['sequelize'][_0xcdf7('0x12')]('../api/disposition/disposition.model');db[_0xcdf7('0x7a')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x7b'));db[_0xcdf7('0x7c')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x7d'));db[_0xcdf7('0x7e')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x7f'));db[_0xcdf7('0x80')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/cdr/cdr.model');db[_0xcdf7('0x81')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x82'));db[_0xcdf7('0x83')]=db['sequelize']['import'](_0xcdf7('0x84'));db[_0xcdf7('0x85')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x86'));db[_0xcdf7('0x87')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x88'));db['Template']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x89'));db[_0xcdf7('0x8a')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x8b'));db[_0xcdf7('0x8c')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x8d'));db[_0xcdf7('0x8e')]=db['sequelize'][_0xcdf7('0x12')]('../api/integration/integration.model');db['IntegrationReport']=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x8f'));db[_0xcdf7('0x90')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x91'));db['AnalyticDefaultReport']=db['sequelize'][_0xcdf7('0x12')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0xcdf7('0x92')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x93'));db[_0xcdf7('0x94')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x95'));db[_0xcdf7('0x96')]=db['sequelize']['import'](_0xcdf7('0x97'));db[_0xcdf7('0x98')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0x99'));db[_0xcdf7('0x9a')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0x9b'));db[_0xcdf7('0x9c')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0x9d'));db[_0xcdf7('0x9e')]=db[_0xcdf7('0x1')]['import']('../api/intSalesforceField/intSalesforceField.model');db[_0xcdf7('0x9f')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xa0'));db[_0xcdf7('0xa1')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xa2'));db[_0xcdf7('0xa3')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xa4'));db[_0xcdf7('0xa5')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xa6'));db['DeskConfiguration']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xa7'));db[_0xcdf7('0xa8')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xa9'));db[_0xcdf7('0xaa')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xab'));db[_0xcdf7('0xac')]=db['sequelize']['import'](_0xcdf7('0xad'));db[_0xcdf7('0xae')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/intZohoField/intZohoField.model');db[_0xcdf7('0xaf')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xb0'));db['ZendeskConfiguration']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xb1'));db[_0xcdf7('0xb2')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xb3'));db[_0xcdf7('0xb4')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xb5'));db[_0xcdf7('0xb6')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xb7'));db[_0xcdf7('0xb8')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xb9'));db[_0xcdf7('0xba')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/intVtigerAccount/intVtigerAccount.model');db['VtigerConfiguration']=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xbb'));db[_0xcdf7('0xbc')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xbd'));db[_0xcdf7('0xbe')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xbf'));db[_0xcdf7('0xc0')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/intServicenowConfiguration/intServicenowConfiguration.model');db[_0xcdf7('0xc1')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xc2'));db[_0xcdf7('0xc3')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xc4'));db[_0xcdf7('0xc5')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xc6'));db[_0xcdf7('0xc7')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xc8'));db[_0xcdf7('0xc9')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xca'));db[_0xcdf7('0xcb')]=db['sequelize'][_0xcdf7('0x12')]('../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model');db[_0xcdf7('0xcc')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xcd'));db[_0xcdf7('0x8e')]=db[_0xcdf7('0x1')]['import']('../api/integration/integration.model');db[_0xcdf7('0xce')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xcf'));db[_0xcdf7('0xd0')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xd1'));db[_0xcdf7('0xd2')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xd3'));db[_0xcdf7('0xd4')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xd5'));db[_0xcdf7('0xd6')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xd7'));db[_0xcdf7('0xd8')]=db['sequelize'][_0xcdf7('0x12')]('../api/jscriptySessionReport/jscriptySessionReport.model');db['SmsQueueReport']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xd9'));db[_0xcdf7('0xda')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xdb'));db['SquareDetailsReport']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xdc'));db[_0xcdf7('0xdd')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xde'));db[_0xcdf7('0xdf')]=db[_0xcdf7('0x1')]['import']('../api/setting/setting.model');db['SquareOdbc']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xe0'));db[_0xcdf7('0xe1')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xe2'));db[_0xcdf7('0xe3')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xe4'));db['SquareMessage']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/squareMessage/squareMessage.model');db[_0xcdf7('0xe5')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xe6'));db['License']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xe7'));db['Campaign']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/campaign/campaign.model');db[_0xcdf7('0xe8')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xe9'));db[_0xcdf7('0xea')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xeb'));db[_0xcdf7('0xec')]=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xed'));db['MailTransferReport']=db[_0xcdf7('0x1')]['import'](_0xcdf7('0xee'));db[_0xcdf7('0xef')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xf0'));db[_0xcdf7('0xf1')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xf2'));db[_0xcdf7('0xf3')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xf4'));db['SmsTransferReport']=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/smsTransferReport/smsTransferReport.model');db[_0xcdf7('0xf5')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xf6'));db[_0xcdf7('0xf7')]=db['sequelize'][_0xcdf7('0x12')](_0xcdf7('0xf8'));db['UserProfile']=db[_0xcdf7('0x1')][_0xcdf7('0x12')](_0xcdf7('0xf9'));db[_0xcdf7('0xfa')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0xcdf7('0xfb')]=db[_0xcdf7('0x1')][_0xcdf7('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0xcdf7('0xfc')][_0xcdf7('0xfd')](db[_0xcdf7('0x1c')],{'as':_0xcdf7('0x1c'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'UserId'});db[_0xcdf7('0xfc')][_0xcdf7('0xff')](db[_0xcdf7('0x19')],{'as':_0xcdf7('0x100'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')][_0xcdf7('0xff')](db['UserVoiceQueueRt'],{'as':_0xcdf7('0x102'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')][_0xcdf7('0xff')](db[_0xcdf7('0x103')],{'as':_0xcdf7('0x104'),'onDelete':_0xcdf7('0xfe'),'hooks':!![]});db['User'][_0xcdf7('0xff')](db[_0xcdf7('0x6c')],{'as':_0xcdf7('0x105'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')]['hasMany'](db[_0xcdf7('0x6e')],{'as':'HopperHistory','foreignKey':'UserId'});db[_0xcdf7('0xfc')]['hasMany'](db[_0xcdf7('0x70')],{'as':_0xcdf7('0x70'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')]['hasMany'](db[_0xcdf7('0x106')],{'as':_0xcdf7('0x107'),'foreignKey':_0xcdf7('0x101')});db['User'][_0xcdf7('0xff')](db[_0xcdf7('0x5f')],{'as':'ChatInteractions','foreignKey':'UserId'});db['User'][_0xcdf7('0xff')](db[_0xcdf7('0x4e')],{'as':_0xcdf7('0x108'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')][_0xcdf7('0xff')](db[_0xcdf7('0x45')],{'as':_0xcdf7('0x109'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0xfc')][_0xcdf7('0xff')](db['MailInteraction'],{'as':_0xcdf7('0x10a'),'foreignKey':_0xcdf7('0x101')});db['User']['belongsTo'](db['UserProfile'],{'as':'UserProfile','foreignKey':'userProfileId'});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x10c')],{'as':'Groups','through':_0xcdf7('0x10d')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x69')],{'as':'Contacts','through':_0xcdf7('0x10e')});db[_0xcdf7('0xfc')]['belongsToMany'](db['CmList'],{'as':'Lists','through':_0xcdf7('0x10f')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db['Team'],{'through':_0xcdf7('0x110')});db[_0xcdf7('0xfc')]['belongsToMany'](db[_0xcdf7('0x111')],{'as':_0xcdf7('0x10a'),'through':_0xcdf7('0x112')});db[_0xcdf7('0xfc')]['belongsToMany'](db[_0xcdf7('0x5f')],{'as':_0xcdf7('0x113'),'through':_0xcdf7('0x114')});db['User'][_0xcdf7('0x10b')](db[_0xcdf7('0x45')],{'as':_0xcdf7('0x109'),'through':_0xcdf7('0x115')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x4e')],{'as':_0xcdf7('0x108'),'through':'user_has_sms_interactions'});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x106')],{'as':_0xcdf7('0x107'),'through':_0xcdf7('0x116')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x18')],{'as':_0xcdf7('0x117'),'through':_0xcdf7('0x27'),'required':![]});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x36')],{'as':_0xcdf7('0x118'),'through':_0xcdf7('0x2b'),'required':![]});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db['ChatQueue'],{'as':_0xcdf7('0x119'),'through':_0xcdf7('0x29'),'required':![],'hooks':!![]});db[_0xcdf7('0xfc')]['belongsToMany'](db['FaxQueue'],{'as':'FaxQueues','through':_0xcdf7('0x2c'),'required':![]});db['User']['belongsToMany'](db['SmsQueue'],{'as':_0xcdf7('0x11a'),'through':_0xcdf7('0x2e'),'required':![]});db[_0xcdf7('0xfc')]['belongsToMany'](db[_0xcdf7('0x59')],{'as':_0xcdf7('0x11b'),'through':_0xcdf7('0x30'),'required':![]});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db['CmList'],{'through':_0xcdf7('0x10f')});db['User']['belongsToMany'](db[_0xcdf7('0xf7')],{'as':_0xcdf7('0x11c'),'through':'user_has_voice_prefixes','required':![]});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x5b')],{'as':_0xcdf7('0x11d'),'through':_0xcdf7('0x11e')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x41')],{'as':_0xcdf7('0x11f'),'through':_0xcdf7('0x120')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x35')],{'as':_0xcdf7('0x121'),'through':'user_has_mail_accounts'});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x54')],{'as':'OpenchannelAccounts','through':_0xcdf7('0x122')});db[_0xcdf7('0xfc')][_0xcdf7('0x10b')](db[_0xcdf7('0x4b')],{'as':_0xcdf7('0x123'),'through':_0xcdf7('0x124')});db['User'][_0xcdf7('0x10b')](db['SquareProject'],{'as':_0xcdf7('0x125'),'through':'user_has_square_projects'});db[_0xcdf7('0x13')][_0xcdf7('0xff')](db[_0xcdf7('0x103')],{'as':_0xcdf7('0x126'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'ChanSpyId'});db[_0xcdf7('0x127')][_0xcdf7('0xff')](db[_0xcdf7('0x103')],{'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x103')][_0xcdf7('0xff')](db['VoiceExtension'],{'as':_0xcdf7('0x128'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x16')]['belongsToMany'](db[_0xcdf7('0x85')],{'as':_0xcdf7('0x129'),'through':_0xcdf7('0x12a')});db['VoiceQueue'][_0xcdf7('0xff')](db[_0xcdf7('0x12b')],{'as':_0xcdf7('0x12c'),'foreignKey':_0xcdf7('0x12d')});db[_0xcdf7('0x18')][_0xcdf7('0xff')](db['CmHopper'],{'as':_0xcdf7('0x12e'),'foreignKey':'VoiceQueueId'});db[_0xcdf7('0x18')]['hasMany'](db[_0xcdf7('0x6c')],{'as':_0xcdf7('0x105'),'foreignKey':'VoiceQueueId'});db[_0xcdf7('0x18')][_0xcdf7('0xff')](db[_0xcdf7('0x6e')],{'as':_0xcdf7('0x12f'),'foreignKey':_0xcdf7('0x12d')});db[_0xcdf7('0x18')]['hasMany'](db['ReportAgentPreview'],{'as':_0xcdf7('0x70'),'foreignKey':_0xcdf7('0x12d')});db['VoiceQueue']['hasMany'](db[_0xcdf7('0x6b')],{'as':_0xcdf7('0x130'),'foreignKey':_0xcdf7('0x12d')});db['VoiceQueue'][_0xcdf7('0xff')](db[_0xcdf7('0xd8')],{'as':_0xcdf7('0x131'),'foreignKey':_0xcdf7('0x12d')});db['VoiceQueue'][_0xcdf7('0x132')](db['Trunk'],{'as':_0xcdf7('0x23'),'foreignKey':_0xcdf7('0x133')});db[_0xcdf7('0x18')][_0xcdf7('0x132')](db[_0xcdf7('0x23')],{'as':_0xcdf7('0x134'),'foreignKey':_0xcdf7('0x135')});db['VoiceQueue'][_0xcdf7('0x132')](db['Interval'],{'as':_0xcdf7('0x7c'),'foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x18')][_0xcdf7('0x132')](db[_0xcdf7('0x7e')],{'as':_0xcdf7('0x137'),'foreignKey':_0xcdf7('0x138')});db['VoiceQueue'][_0xcdf7('0x10b')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x139'),'through':_0xcdf7('0x13a')});db[_0xcdf7('0x18')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':'UserVoiceQueue'});db[_0xcdf7('0x18')]['belongsToMany'](db[_0xcdf7('0xe5')],{'as':_0xcdf7('0x13c'),'through':'team_has_voice_queues'});db['VoiceQueue'][_0xcdf7('0x10b')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x13d'),'through':'voice_queues_has_cm_blacklists'});db[_0xcdf7('0x19')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0xfc'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x1a')][_0xcdf7('0x132')](db['User'],{'as':'User','foreignKey':_0xcdf7('0x101')});db['VoiceMail'][_0xcdf7('0xff')](db[_0xcdf7('0x13e')],{'as':_0xcdf7('0x13f'),'onDelete':'cascade','foreignKey':_0xcdf7('0x140'),'sourceKey':_0xcdf7('0x141')});db[_0xcdf7('0x13e')]['belongsTo'](db[_0xcdf7('0x1c')],{'foreignKey':_0xcdf7('0x140'),'targetKey':_0xcdf7('0x141')});db[_0xcdf7('0x1d')][_0xcdf7('0xff')](db[_0xcdf7('0x21')],{'as':'QueueCalls','foreignKey':_0xcdf7('0x142'),'constraints':![]});db[_0xcdf7('0x1d')][_0xcdf7('0xff')](db['VoiceAgentReport'],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xcdf7('0x1d')][_0xcdf7('0x132')](db['User'],{'as':'User','foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x1d')]['belongsTo'](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144')});db['MailServerIn']['belongsTo'](db[_0xcdf7('0x35')],{'as':_0xcdf7('0x35'),'foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x34')][_0xcdf7('0x132')](db['MailAccount'],{'as':_0xcdf7('0x35'),'foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x35')][_0xcdf7('0xfd')](db[_0xcdf7('0x32')],{'as':_0xcdf7('0x146'),'onDelete':'cascade'});db[_0xcdf7('0x35')]['hasOne'](db[_0xcdf7('0x34')],{'as':_0xcdf7('0x147'),'onDelete':'cascade'});db[_0xcdf7('0x35')][_0xcdf7('0xff')](db[_0xcdf7('0x79')],{'as':_0xcdf7('0x148'),'foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x35')][_0xcdf7('0xff')](db[_0xcdf7('0x77')],{'as':_0xcdf7('0x149'),'foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x35')][_0xcdf7('0xff')](db[_0xcdf7('0x3b')],{'as':'Messages','foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x35')][_0xcdf7('0xff')](db[_0xcdf7('0x111')],{'as':_0xcdf7('0x14a')});db[_0xcdf7('0x35')][_0xcdf7('0xff')](db[_0xcdf7('0x14b')],{'as':_0xcdf7('0x128')});db[_0xcdf7('0x35')]['belongsTo'](db['CmList'],{'as':_0xcdf7('0x14c'),'foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0x35')][_0xcdf7('0x132')](db[_0xcdf7('0x14e')],{'as':'Template','foreignKey':_0xcdf7('0x14f')});db[_0xcdf7('0x35')][_0xcdf7('0x132')](db[_0xcdf7('0x7e')],{'as':'mandatoryDispositionPause','foreignKey':'mandatoryDispositionPauseId'});db[_0xcdf7('0x35')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':'user_has_mail_accounts'});db[_0xcdf7('0x36')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':'UserMailQueue'});db[_0xcdf7('0x36')][_0xcdf7('0x10b')](db[_0xcdf7('0xe5')],{'through':_0xcdf7('0x150'),'as':_0xcdf7('0x13c')});db[_0xcdf7('0x111')][_0xcdf7('0xff')](db[_0xcdf7('0x3b')],{'as':_0xcdf7('0x13f'),'onDelete':'cascade','foreignKey':'MailInteractionId'});db['MailInteraction'][_0xcdf7('0x132')](db[_0xcdf7('0x35')],{'as':'Account','foreignKey':_0xcdf7('0x145')});db[_0xcdf7('0x111')]['belongsTo'](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144')});db['MailInteraction']['belongsTo'](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x151'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x111')][_0xcdf7('0x10b')](db['Tag'],{'through':'mail_interaction_has_tags','as':_0xcdf7('0x152')});db['MailInteraction'][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':'mail_interaction_has_tags','as':'ThroughTags'});db[_0xcdf7('0x111')]['belongsToMany'](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x153'),'through':_0xcdf7('0x112'),'foreignKey':'MailInteractionId'});db[_0xcdf7('0x3b')][_0xcdf7('0xff')](db[_0xcdf7('0xea')],{'as':_0xcdf7('0x154'),'onDelete':_0xcdf7('0xfe')});db['MailMessage']['belongsTo'](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0xfc')});db['MailMessage'][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x143')});db['MailMessage']['belongsTo'](db[_0xcdf7('0x111')],{'as':_0xcdf7('0x155'),'foreignKey':_0xcdf7('0x156')});db[_0xcdf7('0x3b')][_0xcdf7('0x132')](db[_0xcdf7('0x35')],{'as':_0xcdf7('0x157'),'foreignKey':'MailAccountId'});db[_0xcdf7('0x14b')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'onDelete':_0xcdf7('0x158')});db['MailApplication'][_0xcdf7('0x132')](db['MailQueue'],{'onDelete':'restrict'});db[_0xcdf7('0x14b')][_0xcdf7('0x132')](db[_0xcdf7('0x35')],{'onDelete':_0xcdf7('0x158')});db['MailApplication'][_0xcdf7('0x132')](db[_0xcdf7('0x7c')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x14b')][_0xcdf7('0x132')](db[_0xcdf7('0x87')],{'onDelete':_0xcdf7('0x158'),'foreignKey':'TagId'});db[_0xcdf7('0x159')]['belongsTo'](db[_0xcdf7('0x35')],{});db['MailQueueReport']['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xcdf7('0x159')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x159')][_0xcdf7('0x132')](db[_0xcdf7('0x111')],{});db[_0xcdf7('0x159')][_0xcdf7('0x132')](db[_0xcdf7('0x3b')],{});db[_0xcdf7('0x159')]['belongsTo'](db[_0xcdf7('0xfc')],{});db[_0xcdf7('0x159')][_0xcdf7('0x132')](db[_0xcdf7('0x36')],{});db['Dashboard'][_0xcdf7('0xff')](db['DashboardItem'],{'as':_0xcdf7('0x15a'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x41')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':_0xcdf7('0x15b')});db['FaxAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x77')],{'as':_0xcdf7('0x149'),'foreignKey':_0xcdf7('0x15b')});db[_0xcdf7('0x41')][_0xcdf7('0xff')](db[_0xcdf7('0x45')],{'as':_0xcdf7('0x14a')});db['FaxAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x43')],{'as':_0xcdf7('0x128')});db['FaxAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x103')],{'as':_0xcdf7('0x15c'),'onDelete':'cascade'});db['FaxAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x46')],{'as':'Messages'});db[_0xcdf7('0x41')][_0xcdf7('0x132')](db[_0xcdf7('0x23')],{'as':_0xcdf7('0x23')});db[_0xcdf7('0x41')][_0xcdf7('0x132')](db['CmList'],{'as':'List','foreignKey':'ListId'});db['FaxAccount'][_0xcdf7('0x132')](db['Pause'],{'as':_0xcdf7('0x137'),'foreignKey':_0xcdf7('0x138')});db[_0xcdf7('0x41')][_0xcdf7('0x10b')](db['User'],{'as':_0xcdf7('0x13b'),'through':_0xcdf7('0x120')});db[_0xcdf7('0x43')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'onDelete':_0xcdf7('0x158')});db['FaxApplication'][_0xcdf7('0x132')](db[_0xcdf7('0x15d')],{'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x43')]['belongsTo'](db['FaxAccount'],{'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x43')][_0xcdf7('0x132')](db['Tag'],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x15e')});db[_0xcdf7('0x45')][_0xcdf7('0xff')](db['FaxMessage'],{'as':_0xcdf7('0x13f'),'onDelete':'cascade','foreignKey':'FaxInteractionId'});db[_0xcdf7('0x45')][_0xcdf7('0x132')](db[_0xcdf7('0x41')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x15b')});db[_0xcdf7('0x45')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x45')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x151'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x45')][_0xcdf7('0x10b')](db['Tag'],{'through':_0xcdf7('0x15f'),'as':'Tags'});db[_0xcdf7('0x45')][_0xcdf7('0x10b')](db['Tag'],{'through':_0xcdf7('0x15f'),'as':_0xcdf7('0x160')});db['FaxInteraction'][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x153'),'through':'user_has_fax_interactions','foreignKey':_0xcdf7('0x161')});db[_0xcdf7('0x46')][_0xcdf7('0x132')](db['User'],{'onDelete':_0xcdf7('0xfe'),'as':'User'});db[_0xcdf7('0x46')][_0xcdf7('0x132')](db[_0xcdf7('0x45')],{'as':_0xcdf7('0x155'),'foreignKey':_0xcdf7('0x161')});db['FaxMessage'][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x143')});db[_0xcdf7('0x46')]['belongsTo'](db[_0xcdf7('0xea')],{'as':_0xcdf7('0xea'),'foreignKey':_0xcdf7('0x162')});db[_0xcdf7('0x46')][_0xcdf7('0x132')](db[_0xcdf7('0x41')],{'as':'Account','foreignKey':_0xcdf7('0x15b')});db[_0xcdf7('0x15d')][_0xcdf7('0x10b')](db['User'],{'as':'Agents','through':_0xcdf7('0x2c')});db[_0xcdf7('0x15d')][_0xcdf7('0x10b')](db[_0xcdf7('0xe5')],{'through':_0xcdf7('0x163'),'as':_0xcdf7('0x13c')});db[_0xcdf7('0x49')][_0xcdf7('0x132')](db['FaxAccount'],{});db[_0xcdf7('0x49')]['belongsTo'](db['CmList'],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId'});db[_0xcdf7('0x49')]['belongsTo'](db['CmContact'],{'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db[_0xcdf7('0x49')][_0xcdf7('0x132')](db[_0xcdf7('0x45')],{});db[_0xcdf7('0x49')]['belongsTo'](db[_0xcdf7('0x46')],{});db['FaxQueueReport']['belongsTo'](db[_0xcdf7('0xfc')],{});db['FaxQueueReport'][_0xcdf7('0x132')](db[_0xcdf7('0x15d')],{});db[_0xcdf7('0x4b')][_0xcdf7('0xff')](db[_0xcdf7('0x79')],{'as':'Dispositions','foreignKey':_0xcdf7('0x164')});db[_0xcdf7('0x4b')][_0xcdf7('0xff')](db[_0xcdf7('0x77')],{'as':'Answers','foreignKey':_0xcdf7('0x164')});db[_0xcdf7('0x4b')][_0xcdf7('0xff')](db[_0xcdf7('0x50')],{'as':_0xcdf7('0x13f'),'foreignKey':_0xcdf7('0x164')});db[_0xcdf7('0x4b')][_0xcdf7('0xff')](db[_0xcdf7('0x4e')],{'as':_0xcdf7('0x14a')});db[_0xcdf7('0x4b')]['hasMany'](db[_0xcdf7('0x4c')],{'as':_0xcdf7('0x128')});db[_0xcdf7('0x4b')]['belongsTo'](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId'});db[_0xcdf7('0x4b')][_0xcdf7('0x132')](db[_0xcdf7('0x7e')],{'as':_0xcdf7('0x137'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdf7('0x4b')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':'Agents','through':_0xcdf7('0x124')});db[_0xcdf7('0x4c')]['belongsTo'](db[_0xcdf7('0xfc')],{'onDelete':_0xcdf7('0x158')});db['SmsApplication']['belongsTo'](db[_0xcdf7('0x52')],{'onDelete':'restrict'});db[_0xcdf7('0x4c')][_0xcdf7('0x132')](db['SmsAccount'],{'onDelete':_0xcdf7('0x158')});db['SmsApplication'][_0xcdf7('0x132')](db[_0xcdf7('0x7c')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x4c')]['belongsTo'](db[_0xcdf7('0x87')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x15e')});db['SmsInteraction']['hasMany'](db['SmsMessage'],{'as':_0xcdf7('0x13f'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x165')});db[_0xcdf7('0x4e')]['belongsTo'](db[_0xcdf7('0x4b')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x164')});db[_0xcdf7('0x4e')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'as':'Contact','foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x4e')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':'Owner','foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x4e')][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x166'),'as':_0xcdf7('0x152')});db['SmsInteraction'][_0xcdf7('0x10b')](db['Tag'],{'through':_0xcdf7('0x166'),'as':_0xcdf7('0x160')});db[_0xcdf7('0x4e')][_0xcdf7('0x10b')](db['User'],{'as':_0xcdf7('0x153'),'through':'user_has_sms_interactions','foreignKey':'SmsInteractionId'});db[_0xcdf7('0x50')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0xfc')});db[_0xcdf7('0x50')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x143')});db[_0xcdf7('0x50')]['belongsTo'](db[_0xcdf7('0x4e')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x155'),'foreignKey':_0xcdf7('0x165')});db[_0xcdf7('0x50')][_0xcdf7('0x132')](db['SmsAccount'],{'as':'Account','foreignKey':_0xcdf7('0x164')});db['SmsQueue'][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':'Agents','through':_0xcdf7('0x2e'),'foreignKey':_0xcdf7('0x167')});db[_0xcdf7('0x52')]['belongsToMany'](db[_0xcdf7('0xe5')],{'through':'team_has_sms_queues','as':_0xcdf7('0x13c')});db[_0xcdf7('0x54')]['hasMany'](db[_0xcdf7('0x79')],{'as':_0xcdf7('0x148'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0xcdf7('0xff')](db['CannedAnswer'],{'as':_0xcdf7('0x149'),'foreignKey':'OpenchannelAccountId'});db[_0xcdf7('0x54')][_0xcdf7('0xff')](db[_0xcdf7('0x106')],{'as':_0xcdf7('0x14a'),'foreignKey':_0xcdf7('0x168')});db['OpenchannelAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x169')],{'as':_0xcdf7('0x13f'),'foreignKey':'OpenchannelAccountId'});db[_0xcdf7('0x54')][_0xcdf7('0xff')](db[_0xcdf7('0x56')],{'as':'Applications','foreignKey':'OpenchannelAccountId'});db[_0xcdf7('0x54')]['belongsTo'](db[_0xcdf7('0xf5')],{'as':'List','foreignKey':'ListId'});db[_0xcdf7('0x54')]['belongsTo'](db[_0xcdf7('0x7e')],{'as':_0xcdf7('0x137'),'foreignKey':_0xcdf7('0x138')});db['OpenchannelAccount'][_0xcdf7('0x10b')](db['User'],{'as':'Agents','through':_0xcdf7('0x122')});db['OpenchannelApplication'][_0xcdf7('0x132')](db['User'],{'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x56')][_0xcdf7('0x132')](db[_0xcdf7('0x59')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x16a')});db[_0xcdf7('0x56')][_0xcdf7('0x132')](db[_0xcdf7('0x54')],{'onDelete':_0xcdf7('0x158'),'foreignKey':'OpenchannelAccountId'});db[_0xcdf7('0x56')]['belongsTo'](db[_0xcdf7('0x7c')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x56')][_0xcdf7('0x132')](db[_0xcdf7('0x87')],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x15e')});db[_0xcdf7('0x106')]['hasMany'](db[_0xcdf7('0x169')],{'as':'Messages','onDelete':_0xcdf7('0xfe'),'foreignKey':'OpenchannelInteractionId'});db[_0xcdf7('0x106')][_0xcdf7('0x132')](db['OpenchannelAccount'],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x168')});db[_0xcdf7('0x106')][_0xcdf7('0x132')](db['CmContact'],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x106')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':'Owner','foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x106')][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x16b'),'as':_0xcdf7('0x152')});db['OpenchannelInteraction'][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x16b'),'as':_0xcdf7('0x160')});db[_0xcdf7('0x106')]['belongsToMany'](db['User'],{'as':_0xcdf7('0x153'),'through':_0xcdf7('0x116'),'foreignKey':_0xcdf7('0x16c')});db[_0xcdf7('0x169')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'onDelete':_0xcdf7('0xfe'),'as':'User'});db[_0xcdf7('0x169')]['belongsTo'](db[_0xcdf7('0x69')],{'onDelete':'cascade','as':_0xcdf7('0x143')});db[_0xcdf7('0x169')][_0xcdf7('0x132')](db[_0xcdf7('0x106')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x155'),'foreignKey':_0xcdf7('0x16c')});db['OpenchannelMessage'][_0xcdf7('0x132')](db[_0xcdf7('0xea')],{'as':_0xcdf7('0xea'),'foreignKey':'AttachmentId'});db[_0xcdf7('0x169')][_0xcdf7('0x132')](db[_0xcdf7('0x54')],{'as':_0xcdf7('0x157'),'foreignKey':'OpenchannelAccountId'});db[_0xcdf7('0x59')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':_0xcdf7('0x30'),'foreignKey':_0xcdf7('0x16a')});db[_0xcdf7('0x59')][_0xcdf7('0x10b')](db[_0xcdf7('0xe5')],{'through':'team_has_openchannel_queues','as':_0xcdf7('0x13c')});db[_0xcdf7('0x5b')]['hasMany'](db[_0xcdf7('0x79')],{'as':_0xcdf7('0x148'),'foreignKey':_0xcdf7('0x16d')});db[_0xcdf7('0x5b')][_0xcdf7('0xff')](db[_0xcdf7('0x77')],{'as':_0xcdf7('0x149'),'foreignKey':_0xcdf7('0x16d')});db[_0xcdf7('0x5b')][_0xcdf7('0xff')](db[_0xcdf7('0x66')],{'as':_0xcdf7('0x16e')});db[_0xcdf7('0x5b')][_0xcdf7('0xff')](db[_0xcdf7('0x5f')],{'as':_0xcdf7('0x14a')});db[_0xcdf7('0x5b')][_0xcdf7('0xff')](db[_0xcdf7('0x5e')],{'as':_0xcdf7('0x128')});db[_0xcdf7('0x5b')]['hasMany'](db[_0xcdf7('0x61')],{'as':_0xcdf7('0x13f')});db[_0xcdf7('0x5b')][_0xcdf7('0x132')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId'});db[_0xcdf7('0x5b')][_0xcdf7('0x132')](db['Interval'],{'as':'Interval','foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x5b')][_0xcdf7('0x132')](db['Pause'],{'as':_0xcdf7('0x137'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xcdf7('0x5b')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':_0xcdf7('0x11e')});db['OpenchannelQueueReport'][_0xcdf7('0x132')](db[_0xcdf7('0x54')],{});db[_0xcdf7('0x16f')][_0xcdf7('0x132')](db['CmList'],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId'});db[_0xcdf7('0x16f')][_0xcdf7('0x132')](db['CmContact'],{'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db[_0xcdf7('0x16f')][_0xcdf7('0x132')](db['OpenchannelInteraction'],{});db['OpenchannelQueueReport'][_0xcdf7('0x132')](db[_0xcdf7('0x169')],{});db[_0xcdf7('0x16f')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{});db[_0xcdf7('0x16f')][_0xcdf7('0x132')](db[_0xcdf7('0x59')],{});db[_0xcdf7('0x5e')][_0xcdf7('0x132')](db['User'],{'as':'Agent','foreignKey':_0xcdf7('0x101'),'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x5e')][_0xcdf7('0x132')](db['ChatQueue'],{'as':'Queue','foreignKey':'ChatQueueId','onDelete':_0xcdf7('0x158')});db['ChatApplication']['belongsTo'](db['ChatWebsite'],{'as':_0xcdf7('0x170'),'foreignKey':_0xcdf7('0x16d'),'onDelete':'restrict'});db['ChatApplication'][_0xcdf7('0x132')](db['Tag'],{'onDelete':_0xcdf7('0x158'),'foreignKey':_0xcdf7('0x15e')});db[_0xcdf7('0x5f')]['hasMany'](db[_0xcdf7('0x61')],{'as':'Messages','onDelete':_0xcdf7('0xfe'),'foreignKey':'ChatInteractionId'});db['ChatInteraction'][_0xcdf7('0x132')](db[_0xcdf7('0x5b')],{'as':'Account','foreignKey':_0xcdf7('0x16d')});db[_0xcdf7('0x5f')]['belongsTo'](db['CmContact'],{'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db[_0xcdf7('0x5f')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':'Owner','foreignKey':_0xcdf7('0x101')});db['ChatInteraction'][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x171'),'as':_0xcdf7('0x152')});db[_0xcdf7('0x5f')]['belongsToMany'](db[_0xcdf7('0x87')],{'through':'chat_interaction_has_tags','as':_0xcdf7('0x160')});db['ChatInteraction'][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':'Users','through':_0xcdf7('0x114'),'foreignKey':_0xcdf7('0x172')});db[_0xcdf7('0x61')]['belongsTo'](db['User'],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0xfc')});db[_0xcdf7('0x61')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db[_0xcdf7('0x61')][_0xcdf7('0x132')](db['ChatInteraction'],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x155'),'foreignKey':'ChatInteractionId'});db['ChatMessage'][_0xcdf7('0x132')](db[_0xcdf7('0xea')],{'as':'Attachment','foreignKey':_0xcdf7('0x162')});db[_0xcdf7('0x61')]['belongsTo'](db[_0xcdf7('0x5b')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x16d')});db['ChatOfflineMessage'][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'onDelete':_0xcdf7('0xfe'),'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db[_0xcdf7('0x62')][_0xcdf7('0x132')](db[_0xcdf7('0x5b')],{'as':_0xcdf7('0x157'),'foreignKey':'ChatWebsiteId'});db[_0xcdf7('0x64')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x13b'),'through':_0xcdf7('0x29'),'hooks':!![]});db[_0xcdf7('0x64')][_0xcdf7('0x10b')](db[_0xcdf7('0xe5')],{'through':_0xcdf7('0x173'),'as':_0xcdf7('0x13c')});db[_0xcdf7('0x10c')][_0xcdf7('0xff')](db[_0xcdf7('0xd2')],{'as':'Messages','foreignKey':'ChatGroupId','onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x10c')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x12c'),'through':'chat_group_has_users'});db[_0xcdf7('0x66')][_0xcdf7('0x132')](db[_0xcdf7('0x5b')],{'as':_0xcdf7('0x170'),'foreignKey':_0xcdf7('0x16d')});db[_0xcdf7('0x174')][_0xcdf7('0xff')](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x175'),'foreignKey':_0xcdf7('0x176')});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x177')],{'as':_0xcdf7('0x12e'),'foreignKey':_0xcdf7('0x144')});db['CmContact'][_0xcdf7('0xff')](db[_0xcdf7('0x6c')],{'as':_0xcdf7('0x105'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x69')]['hasMany'](db['CmHopperHistory'],{'as':_0xcdf7('0x12f'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x70')],{'as':_0xcdf7('0x70'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x69')]['hasMany'](db['JscriptySessionReport'],{'as':_0xcdf7('0x131'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x106')],{'as':_0xcdf7('0x107'),'foreignKey':'ContactId','onDelete':_0xcdf7('0x158')});db['CmContact'][_0xcdf7('0xff')](db[_0xcdf7('0x5f')],{'as':_0xcdf7('0x113'),'foreignKey':'ContactId','onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x4e')],{'as':_0xcdf7('0x108'),'foreignKey':_0xcdf7('0x144'),'onDelete':'restrict'});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x45')],{'as':_0xcdf7('0x109'),'foreignKey':_0xcdf7('0x144'),'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x69')][_0xcdf7('0xff')](db[_0xcdf7('0x111')],{'as':_0xcdf7('0x10a'),'foreignKey':_0xcdf7('0x144'),'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x69')][_0xcdf7('0x132')](db['CmCompany'],{'as':_0xcdf7('0x178'),'foreignKey':'CompanyId'});db['CmContact'][_0xcdf7('0x132')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId','onDelete':'cascade'});db['CmContact']['belongsToMany'](db[_0xcdf7('0xfc')],{'as':'Users','through':_0xcdf7('0x10e')});db[_0xcdf7('0x69')][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'as':_0xcdf7('0x152'),'through':_0xcdf7('0x179')});db['CmContact'][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x179'),'as':_0xcdf7('0x160')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x14c'),'foreignKey':_0xcdf7('0x14d'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x17a'),'foreignKey':_0xcdf7('0x101')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db['VoiceQueue'],{'as':_0xcdf7('0x17b'),'foreignKey':_0xcdf7('0x12d'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db[_0xcdf7('0x17c')],{'as':'Campaign','foreignKey':_0xcdf7('0x17d'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x177')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'as':_0xcdf7('0x151'),'foreignKey':_0xcdf7('0x17e')});db['CmHopperBlack'][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'as':'Contact','foreignKey':_0xcdf7('0x144'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x6b')][_0xcdf7('0x132')](db['CmList'],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db[_0xcdf7('0x6b')][_0xcdf7('0x132')](db[_0xcdf7('0x18')],{'as':_0xcdf7('0x17b'),'foreignKey':'VoiceQueueId','onDelete':_0xcdf7('0xfe')});db['CmHopperBlack']['belongsTo'](db['Campaign'],{'as':'Campaign','foreignKey':_0xcdf7('0x17d'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x75')][_0xcdf7('0xff')](db[_0xcdf7('0x7a')],{'as':{'plural':'All','singular':'OneAll'},'foreignKey':_0xcdf7('0x17f'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xcdf7('0xff')](db[_0xcdf7('0x7a')],{'as':{'plural':'Any','singular':_0xcdf7('0x180')},'foreignKey':_0xcdf7('0x181'),'onDelete':'cascade','hooks':!![]});db[_0xcdf7('0x75')]['hasMany'](db[_0xcdf7('0x73')],{'as':_0xcdf7('0x182'),'foreignKey':_0xcdf7('0x183'),'onDelete':'cascade','hooks':!![]});db[_0xcdf7('0x7c')][_0xcdf7('0xff')](db['Interval'],{'as':_0xcdf7('0x184'),'foreignKey':_0xcdf7('0x136'),'onDelete':'cascade','hooks':!![],'required':![]});db[_0xcdf7('0x7c')][_0xcdf7('0xff')](db['VoiceExtension'],{'as':_0xcdf7('0x104'),'foreignKey':_0xcdf7('0x136'),'onDelete':_0xcdf7('0x158')});db[_0xcdf7('0x7c')][_0xcdf7('0xff')](db[_0xcdf7('0x14b')],{'as':'MailApplications','foreignKey':'IntervalId'});db['Interval'][_0xcdf7('0xff')](db[_0xcdf7('0x5e')],{'as':_0xcdf7('0x185'),'foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x7c')][_0xcdf7('0xff')](db[_0xcdf7('0x43')],{'as':_0xcdf7('0x186'),'foreignKey':_0xcdf7('0x136')});db['Interval'][_0xcdf7('0xff')](db[_0xcdf7('0x4c')],{'as':_0xcdf7('0x187'),'foreignKey':'IntervalId'});db[_0xcdf7('0x83')][_0xcdf7('0x132')](db[_0xcdf7('0x35')],{});db[_0xcdf7('0x83')][_0xcdf7('0x132')](db[_0xcdf7('0x188')],{'foreignKey':_0xcdf7('0x189')});db[_0xcdf7('0x83')][_0xcdf7('0x132')](db[_0xcdf7('0x90')],{'foreignKey':_0xcdf7('0x18a')});db[_0xcdf7('0x85')][_0xcdf7('0x10b')](db[_0xcdf7('0x16')],{'as':'Mohs','through':'moh_has_sounds','onDelete':'restrict'});db['Tag'][_0xcdf7('0x10b')](db[_0xcdf7('0x69')],{'through':_0xcdf7('0x179')});db[_0xcdf7('0x87')][_0xcdf7('0x10b')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag'][_0xcdf7('0x10b')](db['MailInteraction'],{'through':_0xcdf7('0x18b')});db[_0xcdf7('0x87')][_0xcdf7('0x10b')](db[_0xcdf7('0x4e')],{'through':_0xcdf7('0x166')});db['Tag'][_0xcdf7('0x10b')](db[_0xcdf7('0x45')],{'through':_0xcdf7('0x15f')});db['Tag'][_0xcdf7('0x10b')](db[_0xcdf7('0x106')],{'through':_0xcdf7('0x16b')});db[_0xcdf7('0x8a')]['hasMany'](db['Condition'],{'as':{'plural':_0xcdf7('0x18c'),'singular':_0xcdf7('0x18d')},'foreignKey':_0xcdf7('0x18e'),'onDelete':_0xcdf7('0xfe'),'hooks':!![]});db[_0xcdf7('0x8a')][_0xcdf7('0xff')](db[_0xcdf7('0x7a')],{'as':{'plural':_0xcdf7('0x18f'),'singular':_0xcdf7('0x190')},'foreignKey':'TriggerAnyId','onDelete':_0xcdf7('0xfe'),'hooks':!![]});db[_0xcdf7('0x8a')]['hasMany'](db[_0xcdf7('0x73')],{'as':_0xcdf7('0x182'),'foreignKey':_0xcdf7('0x191'),'onDelete':_0xcdf7('0xfe'),'hooks':!![]});db[_0xcdf7('0x90')]['hasMany'](db[_0xcdf7('0x96')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x18a'),'hooks':!![]});db[_0xcdf7('0x188')]['hasMany'](db[_0xcdf7('0x96')],{'as':'Fields','onDelete':_0xcdf7('0xfe'),'foreignKey':'DefaultReportId'});db[_0xcdf7('0x94')]['hasMany'](db[_0xcdf7('0x96')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x193')});db[_0xcdf7('0x96')][_0xcdf7('0x132')](db[_0xcdf7('0x94')],{'foreignKey':'MetricId'});db['SalesforceAccount'][_0xcdf7('0xff')](db[_0xcdf7('0x9c')],{'as':_0xcdf7('0x194'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x195')});db['SalesforceConfiguration'][_0xcdf7('0xff')](db[_0xcdf7('0x9e')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0x9c')][_0xcdf7('0xff')](db[_0xcdf7('0x9e')],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0x9c')][_0xcdf7('0xff')](db['SalesforceField'],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'FieldId'});db[_0xcdf7('0x9c')]['belongsTo'](db[_0xcdf7('0x9a')],{'as':_0xcdf7('0x157'),'foreignKey':'AccountId'});db[_0xcdf7('0x9e')][_0xcdf7('0xff')](db[_0xcdf7('0x9e')],{'as':_0xcdf7('0x198'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0x9e')]['hasMany'](db[_0xcdf7('0x9e')],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db['SalesforceField']['hasMany'](db[_0xcdf7('0x9e')],{'as':_0xcdf7('0x19a'),'foreignKey':_0xcdf7('0x19b')});db['SalesforceField'][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0x9f')][_0xcdf7('0xff')](db['SugarcrmConfiguration'],{'as':_0xcdf7('0x194'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xa1')][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':_0xcdf7('0x19d'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xa1')][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':_0xcdf7('0x19e'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x197')});db['SugarcrmConfiguration'][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x19b')});db['SugarcrmConfiguration'][_0xcdf7('0x132')](db[_0xcdf7('0x9f')],{'as':'Account','foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xa3')][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':'Subject','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xa3')][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':'Description','foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xa3')][_0xcdf7('0xff')](db[_0xcdf7('0xa3')],{'as':_0xcdf7('0x19a'),'foreignKey':_0xcdf7('0x19b')});db['SugarcrmField'][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db['DeskAccount']['hasMany'](db[_0xcdf7('0x19f')],{'as':_0xcdf7('0x194'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xcdf7('0x19f')]['hasMany'](db[_0xcdf7('0xa8')],{'as':_0xcdf7('0x19d'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0x19f')]['hasMany'](db[_0xcdf7('0xa8')],{'as':_0xcdf7('0x19e'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x197')});db['DeskConfiguration']['hasMany'](db[_0xcdf7('0xa8')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x19b')});db['DeskConfiguration'][_0xcdf7('0x132')](db['DeskAccount'],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0x19f')][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x1a0')});db[_0xcdf7('0xa8')]['hasMany'](db[_0xcdf7('0xa8')],{'as':'Subject','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xa8')][_0xcdf7('0xff')](db[_0xcdf7('0xa8')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xcdf7('0xa8')]['hasMany'](db[_0xcdf7('0xa8')],{'as':_0xcdf7('0x19a'),'foreignKey':'FieldId'});db[_0xcdf7('0xa8')][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xaa')][_0xcdf7('0xff')](db[_0xcdf7('0xac')],{'as':_0xcdf7('0x194'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xac')][_0xcdf7('0xff')](db[_0xcdf7('0xae')],{'as':_0xcdf7('0x19d'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xac')][_0xcdf7('0xff')](db['ZohoField'],{'as':_0xcdf7('0x19e'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xac')][_0xcdf7('0xff')](db[_0xcdf7('0xae')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x19b')});db['ZohoConfiguration'][_0xcdf7('0x132')](db[_0xcdf7('0xaa')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xae')][_0xcdf7('0xff')](db[_0xcdf7('0xae')],{'as':_0xcdf7('0x198'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xae')]['hasMany'](db[_0xcdf7('0xae')],{'as':'Description','foreignKey':_0xcdf7('0x197')});db['ZohoField'][_0xcdf7('0xff')](db['ZohoField'],{'as':_0xcdf7('0x19a'),'foreignKey':'FieldId'});db[_0xcdf7('0xae')][_0xcdf7('0x132')](db['Variable'],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xaf')][_0xcdf7('0xff')](db[_0xcdf7('0x1a1')],{'as':_0xcdf7('0x194'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'AccountId'});db[_0xcdf7('0x1a1')][_0xcdf7('0xff')](db[_0xcdf7('0xb2')],{'as':_0xcdf7('0x19d'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0x1a1')][_0xcdf7('0xff')](db[_0xcdf7('0xb2')],{'as':_0xcdf7('0x19e'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0x1a1')][_0xcdf7('0xff')](db[_0xcdf7('0xb2')],{'as':_0xcdf7('0x192'),'foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0x1a1')][_0xcdf7('0x132')](db[_0xcdf7('0xaf')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0x1a1')]['belongsToMany'](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x1a2')});db[_0xcdf7('0xb2')][_0xcdf7('0xff')](db['ZendeskField'],{'as':_0xcdf7('0x198'),'foreignKey':'SubjectId'});db[_0xcdf7('0xb2')]['hasMany'](db['ZendeskField'],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xb2')]['hasMany'](db[_0xcdf7('0xb2')],{'as':_0xcdf7('0x19a'),'foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0xb2')]['belongsTo'](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xb4')][_0xcdf7('0xff')](db[_0xcdf7('0xb6')],{'as':_0xcdf7('0x194'),'onDelete':'cascade','foreignKey':_0xcdf7('0x195')});db['FreshdeskConfiguration'][_0xcdf7('0xff')](db[_0xcdf7('0xb8')],{'as':_0xcdf7('0x19d'),'onDelete':'cascade','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xb6')][_0xcdf7('0xff')](db[_0xcdf7('0xb8')],{'as':_0xcdf7('0x19e'),'onDelete':'cascade','foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xb6')]['hasMany'](db[_0xcdf7('0xb8')],{'as':_0xcdf7('0x192'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'FieldId'});db[_0xcdf7('0xb6')][_0xcdf7('0x132')](db[_0xcdf7('0xb4')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xb6')][_0xcdf7('0x10b')](db[_0xcdf7('0x87')],{'through':_0xcdf7('0x1a3')});db[_0xcdf7('0xb8')][_0xcdf7('0xff')](db['FreshdeskField'],{'as':_0xcdf7('0x198'),'foreignKey':'SubjectId'});db[_0xcdf7('0xb8')][_0xcdf7('0xff')](db[_0xcdf7('0xb8')],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xb8')]['hasMany'](db[_0xcdf7('0xb8')],{'as':_0xcdf7('0x19a'),'foreignKey':_0xcdf7('0x19b')});db['FreshdeskField']['belongsTo'](db['Variable'],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db['VtigerAccount'][_0xcdf7('0xff')](db['VtigerConfiguration'],{'as':'Configurations','onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0x1a4')][_0xcdf7('0xff')](db[_0xcdf7('0xbc')],{'as':_0xcdf7('0x19d'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0x1a4')][_0xcdf7('0xff')](db[_0xcdf7('0xbc')],{'as':_0xcdf7('0x19e'),'foreignKey':_0xcdf7('0x197')});db['VtigerConfiguration'][_0xcdf7('0xff')](db[_0xcdf7('0xbc')],{'as':_0xcdf7('0x192'),'foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0x1a4')][_0xcdf7('0x132')](db[_0xcdf7('0xba')],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xbc')][_0xcdf7('0xff')](db[_0xcdf7('0xbc')],{'as':'Subject','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xbc')][_0xcdf7('0xff')](db['VtigerField'],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xbc')][_0xcdf7('0xff')](db[_0xcdf7('0xbc')],{'as':'Field','foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0xbc')][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xbe')][_0xcdf7('0xff')](db['ServicenowConfiguration'],{'as':_0xcdf7('0x194'),'onDelete':'cascade','foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xc0')][_0xcdf7('0xff')](db[_0xcdf7('0xc1')],{'as':_0xcdf7('0x19d'),'foreignKey':'SubjectId'});db[_0xcdf7('0xc0')][_0xcdf7('0xff')](db[_0xcdf7('0xc1')],{'as':_0xcdf7('0x19e'),'foreignKey':_0xcdf7('0x197')});db['ServicenowConfiguration']['hasMany'](db[_0xcdf7('0xc1')],{'as':'Fields','foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0xc0')]['belongsTo'](db[_0xcdf7('0xbe')],{'as':_0xcdf7('0x157'),'foreignKey':'AccountId'});db[_0xcdf7('0xc1')]['hasMany'](db[_0xcdf7('0xc1')],{'as':_0xcdf7('0x198'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xc1')]['hasMany'](db[_0xcdf7('0xc1')],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xc1')][_0xcdf7('0xff')](db[_0xcdf7('0xc1')],{'as':'Field','foreignKey':'FieldId'});db[_0xcdf7('0xc1')][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':_0xcdf7('0x8c'),'foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xc3')][_0xcdf7('0xff')](db[_0xcdf7('0xc5')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xc5')][_0xcdf7('0xff')](db[_0xcdf7('0xc7')],{'as':'Subjects','onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xc5')][_0xcdf7('0xff')](db[_0xcdf7('0xc7')],{'as':_0xcdf7('0x19e'),'onDelete':'cascade','foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xc5')][_0xcdf7('0xff')](db[_0xcdf7('0xc7')],{'as':'Fields','onDelete':'cascade','foreignKey':'FieldId'});db[_0xcdf7('0xc5')]['belongsTo'](db[_0xcdf7('0xc3')],{'as':'Account','foreignKey':_0xcdf7('0x195')});db[_0xcdf7('0xc7')][_0xcdf7('0xff')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xc7')][_0xcdf7('0xff')](db['Dynamics365Field'],{'as':_0xcdf7('0x199'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xc7')][_0xcdf7('0xff')](db[_0xcdf7('0xc7')],{'as':_0xcdf7('0x19a'),'foreignKey':'FieldId'});db[_0xcdf7('0xc7')][_0xcdf7('0x132')](db[_0xcdf7('0x8c')],{'as':'Variable','foreignKey':'VariableId'});db[_0xcdf7('0xc9')][_0xcdf7('0xff')](db[_0xcdf7('0xcb')],{'as':_0xcdf7('0x194'),'onDelete':_0xcdf7('0xfe'),'foreignKey':'AccountId'});db[_0xcdf7('0xcb')]['hasMany'](db[_0xcdf7('0xcc')],{'as':_0xcdf7('0x19d'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xcb')][_0xcdf7('0xff')](db[_0xcdf7('0xcc')],{'as':_0xcdf7('0x19e'),'foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xcb')][_0xcdf7('0xff')](db[_0xcdf7('0xcc')],{'as':_0xcdf7('0x192'),'foreignKey':_0xcdf7('0x19b')});db['FreshsalesConfiguration'][_0xcdf7('0x132')](db['FreshsalesAccount'],{'as':_0xcdf7('0x157'),'foreignKey':_0xcdf7('0x195')});db['FreshsalesField']['hasMany'](db[_0xcdf7('0xcc')],{'as':_0xcdf7('0x198'),'foreignKey':_0xcdf7('0x196')});db[_0xcdf7('0xcc')][_0xcdf7('0xff')](db['FreshsalesField'],{'as':'Description','foreignKey':_0xcdf7('0x197')});db[_0xcdf7('0xcc')][_0xcdf7('0xff')](db[_0xcdf7('0xcc')],{'as':_0xcdf7('0x19a'),'foreignKey':_0xcdf7('0x19b')});db[_0xcdf7('0xcc')][_0xcdf7('0x132')](db['Variable'],{'as':'Variable','foreignKey':_0xcdf7('0x19c')});db[_0xcdf7('0xd0')][_0xcdf7('0x132')](db[_0xcdf7('0x5b')],{});db[_0xcdf7('0xd0')][_0xcdf7('0x132')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x14c'),'foreignKey':'ListId'});db['ChatQueueReport']['belongsTo'](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':_0xcdf7('0x144')});db[_0xcdf7('0xd0')][_0xcdf7('0x132')](db[_0xcdf7('0x5f')],{});db[_0xcdf7('0xd0')][_0xcdf7('0x132')](db[_0xcdf7('0x61')],{});db[_0xcdf7('0xd0')][_0xcdf7('0x132')](db['User'],{});db['ChatQueueReport'][_0xcdf7('0x132')](db[_0xcdf7('0x64')],{});db[_0xcdf7('0xd2')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'onDelete':'cascade','foreignKey':_0xcdf7('0x1a5')});db[_0xcdf7('0xd2')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x1a6')});db[_0xcdf7('0xd8')]['hasMany'](db[_0xcdf7('0xd6')],{'foreignKey':_0xcdf7('0x1a7'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0xd8')][_0xcdf7('0xff')](db[_0xcdf7('0xd4')],{'foreignKey':_0xcdf7('0x1a7'),'onDelete':_0xcdf7('0xfe')});db[_0xcdf7('0x1a8')][_0xcdf7('0x132')](db[_0xcdf7('0x4b')],{});db[_0xcdf7('0x1a8')]['belongsTo'](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xcdf7('0x1a8')][_0xcdf7('0x132')](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x143'),'foreignKey':'ContactId'});db['SmsQueueReport'][_0xcdf7('0x132')](db[_0xcdf7('0x4e')],{});db['SmsQueueReport']['belongsTo'](db['SmsMessage'],{});db[_0xcdf7('0x1a8')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{});db[_0xcdf7('0x1a8')][_0xcdf7('0x132')](db[_0xcdf7('0x52')],{});db[_0xcdf7('0xdd')][_0xcdf7('0xff')](db['JscriptySessionReport'],{'foreignKey':'ProjectId'});db['JscriptyProject'][_0xcdf7('0xff')](db[_0xcdf7('0xd6')],{'foreignKey':_0xcdf7('0x1a9')});db[_0xcdf7('0xdd')][_0xcdf7('0xff')](db[_0xcdf7('0xd4')],{'foreignKey':_0xcdf7('0x1a9')});db[_0xcdf7('0xe1')][_0xcdf7('0x10b')](db['User'],{'as':_0xcdf7('0x153'),'through':'user_has_square_projects'});db[_0xcdf7('0xe5')][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':'Agents','through':_0xcdf7('0x110')});db['Team']['belongsToMany'](db[_0xcdf7('0x18')],{'through':_0xcdf7('0x1aa'),'as':_0xcdf7('0x117')});db[_0xcdf7('0xe5')][_0xcdf7('0x10b')](db[_0xcdf7('0x36')],{'through':'team_has_mail_queues','as':_0xcdf7('0x118')});db[_0xcdf7('0xe5')][_0xcdf7('0x10b')](db['ChatQueue'],{'through':_0xcdf7('0x173'),'as':_0xcdf7('0x119')});db['Team'][_0xcdf7('0x10b')](db[_0xcdf7('0x15d')],{'through':_0xcdf7('0x163'),'as':'FaxQueues'});db[_0xcdf7('0xe5')]['belongsToMany'](db[_0xcdf7('0x52')],{'through':'team_has_sms_queues','as':_0xcdf7('0x11a')});db[_0xcdf7('0xe5')][_0xcdf7('0x10b')](db['OpenchannelQueue'],{'through':_0xcdf7('0x1ab'),'as':'OpenchannelQueues'});db['Campaign'][_0xcdf7('0xff')](db[_0xcdf7('0x177')],{'as':_0xcdf7('0x12e'),'foreignKey':'CampaignId'});db['Campaign'][_0xcdf7('0xff')](db['CmHopperFinal'],{'as':_0xcdf7('0x105'),'foreignKey':_0xcdf7('0x17d')});db[_0xcdf7('0x17c')][_0xcdf7('0xff')](db[_0xcdf7('0x6e')],{'as':_0xcdf7('0x12f'),'foreignKey':_0xcdf7('0x17d')});db[_0xcdf7('0x17c')]['hasMany'](db[_0xcdf7('0x6b')],{'as':_0xcdf7('0x130'),'foreignKey':'CampaignId'});db[_0xcdf7('0x17c')][_0xcdf7('0x132')](db[_0xcdf7('0x23')],{'as':_0xcdf7('0x23'),'foreignKey':_0xcdf7('0x133')});db[_0xcdf7('0x17c')][_0xcdf7('0x132')](db[_0xcdf7('0x23')],{'as':'TrunkBackup','foreignKey':_0xcdf7('0x135')});db[_0xcdf7('0x17c')][_0xcdf7('0x132')](db[_0xcdf7('0x7c')],{'as':'Interval','foreignKey':_0xcdf7('0x136')});db[_0xcdf7('0x17c')][_0xcdf7('0x132')](db[_0xcdf7('0xe1')],{'as':_0xcdf7('0xe1'),'foreignKey':_0xcdf7('0x1ac')});db[_0xcdf7('0x17c')][_0xcdf7('0x10b')](db['CmList'],{'as':_0xcdf7('0x139'),'through':_0xcdf7('0x1ad')});db[_0xcdf7('0x17c')][_0xcdf7('0x10b')](db[_0xcdf7('0xf5')],{'as':_0xcdf7('0x13d'),'through':_0xcdf7('0x1ae')});db[_0xcdf7('0x1af')][_0xcdf7('0x132')](db[_0xcdf7('0x3b')],{});db[_0xcdf7('0x1af')][_0xcdf7('0x132')](db['MailInteraction'],{});db['MailTransferReport']['belongsTo'](db['MailAccount'],{'foreignKey':_0xcdf7('0x1b0'),'as':_0xcdf7('0x1b1')});db[_0xcdf7('0x1af')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b2'),'as':_0xcdf7('0x1b3')});db[_0xcdf7('0x1af')]['belongsTo'](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b4'),'as':'ToAgent'});db[_0xcdf7('0x1af')][_0xcdf7('0x132')](db[_0xcdf7('0x36')],{'foreignKey':_0xcdf7('0x1b5'),'as':_0xcdf7('0x1b6')});db[_0xcdf7('0x1af')]['belongsTo'](db[_0xcdf7('0x35')],{'foreignKey':_0xcdf7('0x1b7'),'as':_0xcdf7('0x1b8')});db[_0xcdf7('0xef')][_0xcdf7('0x132')](db[_0xcdf7('0x61')],{});db[_0xcdf7('0xef')]['belongsTo'](db[_0xcdf7('0x5f')],{});db['ChatTransferReport'][_0xcdf7('0x132')](db[_0xcdf7('0x5b')],{'foreignKey':'FromChatWebsiteId','as':_0xcdf7('0x1b1')});db[_0xcdf7('0xef')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':'FromUserId','as':_0xcdf7('0x1b3')});db[_0xcdf7('0xef')]['belongsTo'](db['User'],{'foreignKey':_0xcdf7('0x1b4'),'as':'ToAgent'});db[_0xcdf7('0xef')][_0xcdf7('0x132')](db[_0xcdf7('0x64')],{'foreignKey':_0xcdf7('0x1b9'),'as':_0xcdf7('0x1b6')});db[_0xcdf7('0xef')]['belongsTo'](db[_0xcdf7('0x5b')],{'foreignKey':'ToChatWebsiteId','as':_0xcdf7('0x1b8')});db[_0xcdf7('0xf1')][_0xcdf7('0x132')](db[_0xcdf7('0x46')],{});db[_0xcdf7('0xf1')][_0xcdf7('0x132')](db[_0xcdf7('0x45')],{});db[_0xcdf7('0xf1')][_0xcdf7('0x132')](db[_0xcdf7('0x41')],{'foreignKey':_0xcdf7('0x1ba'),'as':_0xcdf7('0x1b1')});db[_0xcdf7('0xf1')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b2'),'as':'FromAgent'});db[_0xcdf7('0xf1')]['belongsTo'](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b4'),'as':_0xcdf7('0x1bb')});db['FaxTransferReport']['belongsTo'](db['FaxQueue'],{'foreignKey':_0xcdf7('0x1bc'),'as':_0xcdf7('0x1b6')});db[_0xcdf7('0xf1')][_0xcdf7('0x132')](db[_0xcdf7('0x41')],{'foreignKey':'ToFaxAccountId','as':_0xcdf7('0x1b8')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelMessage'],{});db[_0xcdf7('0xf3')]['belongsTo'](db[_0xcdf7('0x106')],{});db['OpenchannelTransferReport'][_0xcdf7('0x132')](db[_0xcdf7('0x54')],{'foreignKey':'FromOpenchannelAccountId','as':_0xcdf7('0x1b1')});db[_0xcdf7('0xf3')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b2'),'as':_0xcdf7('0x1b3')});db[_0xcdf7('0xf3')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':'ToUserId','as':_0xcdf7('0x1bb')});db['OpenchannelTransferReport'][_0xcdf7('0x132')](db['OpenchannelQueue'],{'foreignKey':_0xcdf7('0x1bd'),'as':_0xcdf7('0x1b6')});db[_0xcdf7('0xf3')][_0xcdf7('0x132')](db[_0xcdf7('0x54')],{'foreignKey':_0xcdf7('0x1be'),'as':_0xcdf7('0x1b8')});db['SmsTransferReport'][_0xcdf7('0x132')](db[_0xcdf7('0x50')],{});db[_0xcdf7('0x1bf')][_0xcdf7('0x132')](db[_0xcdf7('0x4e')],{});db[_0xcdf7('0x1bf')][_0xcdf7('0x132')](db['SmsAccount'],{'foreignKey':'FromSmsAccountId','as':_0xcdf7('0x1b1')});db[_0xcdf7('0x1bf')][_0xcdf7('0x132')](db[_0xcdf7('0xfc')],{'foreignKey':_0xcdf7('0x1b2'),'as':_0xcdf7('0x1b3')});db[_0xcdf7('0x1bf')][_0xcdf7('0x132')](db['User'],{'foreignKey':_0xcdf7('0x1b4'),'as':_0xcdf7('0x1bb')});db[_0xcdf7('0x1bf')][_0xcdf7('0x132')](db[_0xcdf7('0x52')],{'foreignKey':'ToSmsQueueId','as':_0xcdf7('0x1b6')});db['SmsTransferReport']['belongsTo'](db[_0xcdf7('0x4b')],{'foreignKey':_0xcdf7('0x1c0'),'as':_0xcdf7('0x1b8')});db['CmList'][_0xcdf7('0xff')](db[_0xcdf7('0x79')],{'as':'Dispositions','foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0xf5')][_0xcdf7('0xff')](db[_0xcdf7('0x72')],{'as':'CustomFields','foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0xf5')][_0xcdf7('0xff')](db[_0xcdf7('0x69')],{'as':_0xcdf7('0x175'),'onDelete':_0xcdf7('0xfe'),'foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0xf5')][_0xcdf7('0xff')](db[_0xcdf7('0x6c')],{'as':_0xcdf7('0x105'),'foreignKey':_0xcdf7('0x14d')});db['CmList'][_0xcdf7('0xff')](db[_0xcdf7('0x6e')],{'as':_0xcdf7('0x1c1'),'foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0xf5')][_0xcdf7('0xff')](db[_0xcdf7('0x70')],{'as':_0xcdf7('0x70'),'foreignKey':_0xcdf7('0x14d')});db[_0xcdf7('0xf5')][_0xcdf7('0x10b')](db[_0xcdf7('0x18')],{'as':'Queues','through':'voice_queues_has_cm_lists'});db[_0xcdf7('0xf5')]['belongsToMany'](db['User'],{'as':_0xcdf7('0x13b'),'through':'cm_user_has_lists'});db['VoicePrefix']['hasMany'](db[_0xcdf7('0x103')],{'as':_0xcdf7('0x104'),'onDelete':_0xcdf7('0x158')});db['VoicePrefix'][_0xcdf7('0x10b')](db[_0xcdf7('0xfc')],{'as':'Agents','through':_0xcdf7('0x1c2')});db['UserProfile'][_0xcdf7('0xff')](db['User'],{'as':_0xcdf7('0x153'),'foreignKey':'userProfileId'});db[_0xcdf7('0x1c3')][_0xcdf7('0xff')](db['UserProfileSection'],{'as':_0xcdf7('0x1c4'),'foreignKey':_0xcdf7('0x1c5'),'onDelete':'cascade'});db[_0xcdf7('0xfa')][_0xcdf7('0xff')](db['UserProfileResource'],{'as':_0xcdf7('0x1c6'),'foreignKey':_0xcdf7('0x1c7'),'onDelete':_0xcdf7('0xfe')});module[_0xcdf7('0x1c8')]={'db':db,'dbH':dbH}; \ No newline at end of file +var _0x812d=['team_has_sms_queues','OpenchannelAccountId','Answers','openchannel_interaction_has_tags','user_has_openchannel_interactions','OpenchannelInteractionId','AttachmentId','UserOpenchannelQueue','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ChatApplication','ChatMessage','OpenchannelQueueReport','Agent','Queue','ChatQueueId','chat_interaction_has_tags','ChatInteractionId','team_has_chat_queues','ChatGroupId','ChatProactiveAction','Website','CmCompany','CompanyId','Company','cm_contact_has_tags','CampaignId','OwnerId','Automation','OneAll','AutomationAllId','Any','OneAny','Actions','AutomationId','Intervals','SmsApplications','AnalyticDefaultReport','DefaultReportId','CustomReportId','Mohs','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','TriggerId','Fields','MetricId','SalesforceAccount','Configurations','AccountId','Subjects','SubjectId','DescriptionId','Subject','Description','Field','Descriptions','FieldId','VariableId','DeskField','ZohoAccount','ZendeskField','int_zendesk_configuration_has_tags','int_freshdesk_configuration_has_tags','VtigerField','Dynamics365Field','FreshsalesConfiguration','FromId','ToId','SessionId','JscriptyProject','ProjectId','team_has_voice_queues','ChatQueues','team_has_fax_queues','TrunkId','SquareProjectId','campaigns_has_cm_blacklists','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToUserId','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','OpenchannelTransferReport','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','FromSmsAccountId','ToSmsQueueId','ToSmsAccountId','CmCustomField','CustomFields','cm_user_has_lists','userProfileId','UserProfileSections','Resources','exports','../config/environment','sequelize','lodash','jstz','determine','defaultsDeep','xcall','xC@LL1234','127.0.0.1','name','utf8','sequelizeHistory','motion2','mysql','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','VoiceExtension','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceRecording/voiceRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','MemberReport','Trunk','VoiceTransferReport','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.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','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxQueue/faxQueue.model','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','../api/smsMessage/smsMessage.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','ChatInteraction','../api/chatInteraction/chatInteraction.model','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','CmHopperHistory','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','Action','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Template','Trigger','../api/trigger/trigger.model','Variable','../api/variable/variable.model','../api/integration/integration.model','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','../api/analyticCustomReport/analyticCustomReport.model','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','AnalyticTreeReport','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','../api/intZohoField/intZohoField.model','ZendeskAccount','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskAccount/intFreshdeskAccount.model','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','VtigerAccount','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','Integration','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptyQuestionReport','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','SquareReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','../api/migration/migration.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','ChatTransferReport','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','UserProfileResource','../api/userProfileResource/userProfileResource.model','hasOne','cascade','UserId','VoiceRecording','Recordings','hasMany','UserVoiceQueueRt','VoiceQueuesRt','Extensions','HopperFinals','HopperHistory','OpenchannelInteractions','FaxInteractions','belongsTo','UserProfile','belongsToMany','chat_group_has_users','Contacts','cm_user_has_contacts','Lists','MailInteractions','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','user_has_fax_interactions','SmsInteractions','VoiceQueues','MailQueues','UserMailQueue','UserChatQueue','FaxQueues','SmsQueues','UserSmsQueue','OpenchannelQueues','VoicePrefixes','user_has_voice_prefixes','ChatWebsites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccount','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','user_has_square_projects','SpiedAgents','ChanSpyId','Applications','VoiceMusicOnHold','Sounds','moh_has_sounds','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPause','voice_queues_has_cm_lists','Agents','voice_queues_has_cm_blacklists','ScreenRecording','VoiceMailMessage','Messages','mailboxuser','QueueCalls','uniqueid','AgentReports','ContactId','MailServerOut','Smtp','Dispositions','MailAccountId','Interactions','List','ListId','TemplateId','team_has_mail_queues','Teams','MailInteractionId','Contact','Owner','Tag','mail_interaction_has_tags','Users','Attachment','Attachments','Interaction','Account','restrict','TagId','Dashboard','Exntensions','mandatoryDispositionPauseId','FaxApplication','FaxQueue','FaxInteractionId','FaxAccountId','fax_interaction_has_tags','Tags','FaxQueueReport','SmsAccountId','SmsApplication','SmsMessage','SmsInteractionId','sms_interaction_has_tags','ThroughTags','user_has_sms_interactions','SmsQueue'];(function(_0x23a046,_0x1240d8){var _0x38165b=function(_0x9598f9){while(--_0x9598f9){_0x23a046['push'](_0x23a046['shift']());}};_0x38165b(++_0x1240d8);}(_0x812d,0x6e));var _0xd812=function(_0x1fbd0f,_0x10c042){_0x1fbd0f=_0x1fbd0f-0x0;var _0x5a5ffb=_0x812d[_0x1fbd0f];return _0x5a5ffb;};'use strict';var path=require('path');var config=require(_0xd812('0x0'));var Sequelize=require(_0xd812('0x1'));var _=require(_0xd812('0x2'));var jstz=require(_0xd812('0x3'));var timezone=jstz[_0xd812('0x4')]();config[_0xd812('0x1')]=_[_0xd812('0x5')](config[_0xd812('0x1')],{'database':'motion2','username':_0xd812('0x6'),'password':_0xd812('0x7'),'options':{'host':_0xd812('0x8'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone[_0xd812('0x9')](),'define':{'charset':_0xd812('0xa'),'collate':'utf8_general_ci'}}});config[_0xd812('0xb')]=_[_0xd812('0x5')](config['sequelizeHistory'],{'database':_0xd812('0xc'),'username':_0xd812('0x6'),'password':_0xd812('0x7'),'options':{'host':'127.0.0.1','port':0xcea,'dialect':_0xd812('0xd'),'dialectOptions':{'charset':'utf8mb4'},'logging':![],'timezone':timezone['name'](),'define':{'charset':_0xd812('0xa'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0xd812('0xe')],config[_0xd812('0x1')][_0xd812('0xf')],config['sequelize'][_0xd812('0x10')],config[_0xd812('0x1')][_0xd812('0x11')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xd812('0xb')][_0xd812('0xe')],config[_0xd812('0xb')][_0xd812('0xf')],config[_0xd812('0xb')]['password'],config['sequelizeHistory']['options'])};db[_0xd812('0x12')]=db['sequelize']['import'](_0xd812('0x13'));db[_0xd812('0x14')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x16'));db[_0xd812('0x17')]=db[_0xd812('0x1')]['import']('../api/voiceContext/voiceContext.model');db[_0xd812('0x18')]=db['sequelize'][_0xd812('0x15')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x19'));db[_0xd812('0x1a')]=db[_0xd812('0x1')]['import']('../api/voiceQueue/voiceQueue.model');db['VoiceRecording']=db['sequelize'][_0xd812('0x15')](_0xd812('0x1b'));db['ScreenRecording']=db[_0xd812('0x1')]['import']('../api/screenRecording/screenRecording.model');db[_0xd812('0x1c')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x1d'));db['VoiceMailMessage']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/voiceMailMessage/voiceMailMessage.model');db[_0xd812('0x1e')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x1f'));db['VoiceDialReport']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x20'));db[_0xd812('0x21')]=db['sequelize']['import'](_0xd812('0x22'));db[_0xd812('0x23')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/voiceQueueReport/voiceQueueReport.model');db[_0xd812('0x24')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/memberReport/memberReport.model');db[_0xd812('0x25')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/trunk/trunk.model');db[_0xd812('0x26')]=db['sequelize'][_0xd812('0x15')]('../api/voiceTransferReport/voiceTransferReport.model');db['UserVoiceQueueRt']=db['sequelize'][_0xd812('0x15')](_0xd812('0x27'));db[_0xd812('0x28')]=db[_0xd812('0x1')]['import'](_0xd812('0x29'));db['UserChatQueue']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x2a'));db['UserMailQueue']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x2b'));db[_0xd812('0x2c')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x2d'));db['UserSmsQueue']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x2e'));db['UserOpenchannelQueue']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xd812('0x2f')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x30'));db['MailServerOut']=db['sequelize']['import']('../api/mailServerOut/mailServerOut.model');db[_0xd812('0x31')]=db['sequelize']['import'](_0xd812('0x32'));db[_0xd812('0x33')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x34'));db[_0xd812('0x35')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x36'));db[_0xd812('0x37')]=db['sequelize']['import'](_0xd812('0x38'));db[_0xd812('0x39')]=db[_0xd812('0x1')]['import'](_0xd812('0x3a'));db[_0xd812('0x3b')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x3c'));db[_0xd812('0x3d')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x3e'));db['Dashboard']=db[_0xd812('0x1')]['import'](_0xd812('0x3f'));db[_0xd812('0x40')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x41'));db[_0xd812('0x42')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x43'));db['FaxApplication']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x44'));db[_0xd812('0x45')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x46'));db[_0xd812('0x47')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/faxMessage/faxMessage.model');db['FaxQueue']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x48'));db['FaxQueueReport']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x49'));db[_0xd812('0x4a')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x4b'));db['SmsApplication']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x4c'));db[_0xd812('0x4d')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x4e'));db['SmsMessage']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x4f'));db['SmsQueue']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/openchannelAccount/openchannelAccount.model');db[_0xd812('0x50')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x51'));db[_0xd812('0x52')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x53'));db[_0xd812('0x54')]=db['sequelize']['import'](_0xd812('0x55'));db[_0xd812('0x56')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x57'));db[_0xd812('0x58')]=db[_0xd812('0x1')]['import']('../api/chatWebsite/chatWebsite.model');db['OpenchannelQueueReport']=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db['ChatApplication']=db[_0xd812('0x1')]['import']('../api/chatApplication/chatApplication.model');db[_0xd812('0x59')]=db[_0xd812('0x1')]['import'](_0xd812('0x5a'));db['ChatMessage']=db[_0xd812('0x1')]['import']('../api/chatMessage/chatMessage.model');db[_0xd812('0x5b')]=db['sequelize']['import'](_0xd812('0x5c'));db[_0xd812('0x5d')]=db[_0xd812('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0xd812('0x5e')]=db[_0xd812('0x1')]['import'](_0xd812('0x5f'));db['ChatProactiveAction']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x60'));db['CmCompany']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x61'));db[_0xd812('0x62')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x63'));db[_0xd812('0x64')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x65'));db[_0xd812('0x66')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x67'));db[_0xd812('0x68')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x69'));db[_0xd812('0x6a')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x6b'));db[_0xd812('0x6c')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0xd812('0x15')]('../api/cmCustomField/cmCustomField.model');db[_0xd812('0x6d')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/action/action.model');db['Automation']=db['sequelize'][_0xd812('0x15')]('../api/automation/automation.model');db[_0xd812('0x6e')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x6f'));db[_0xd812('0x70')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x71'));db[_0xd812('0x72')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x73'));db[_0xd812('0x74')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/interval/interval.model');db[_0xd812('0x75')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x76'));db[_0xd812('0x77')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x78'));db[_0xd812('0x79')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x7a'));db[_0xd812('0x7b')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x7c'));db[_0xd812('0x7d')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x7e'));db['Tag']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/tag/tag.model');db[_0xd812('0x7f')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/template/template.model');db[_0xd812('0x80')]=db['sequelize']['import'](_0xd812('0x81'));db[_0xd812('0x82')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x83'));db['Integration']=db['sequelize']['import'](_0xd812('0x84'));db[_0xd812('0x85')]=db[_0xd812('0x1')]['import'](_0xd812('0x86'));db[_0xd812('0x87')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x88'));db['AnalyticDefaultReport']=db['sequelize'][_0xd812('0x15')](_0xd812('0x89'));db[_0xd812('0x8a')]=db['sequelize']['import'](_0xd812('0x8b'));db[_0xd812('0x8c')]=db[_0xd812('0x1')]['import'](_0xd812('0x8d'));db[_0xd812('0x8e')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/analyticFieldReport/analyticFieldReport.model');db[_0xd812('0x8f')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/analyticTreeReport/analyticTreeReport.model');db['SalesforceAccount']=db[_0xd812('0x1')]['import'](_0xd812('0x90'));db[_0xd812('0x91')]=db['sequelize'][_0xd812('0x15')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0xd812('0x92')]=db['sequelize'][_0xd812('0x15')](_0xd812('0x93'));db[_0xd812('0x94')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xd812('0x95')]=db[_0xd812('0x1')]['import']('../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model');db[_0xd812('0x96')]=db[_0xd812('0x1')]['import'](_0xd812('0x97'));db[_0xd812('0x98')]=db['sequelize']['import'](_0xd812('0x99'));db[_0xd812('0x9a')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/intDeskConfiguration/intDeskConfiguration.model');db['DeskField']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/intDeskField/intDeskField.model');db['ZohoAccount']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x9b'));db[_0xd812('0x9c')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0x9d'));db[_0xd812('0x9e')]=db['sequelize']['import'](_0xd812('0x9f'));db[_0xd812('0xa0')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/intZendeskAccount/intZendeskAccount.model');db[_0xd812('0xa1')]=db['sequelize'][_0xd812('0x15')](_0xd812('0xa2'));db['ZendeskField']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xa3'));db[_0xd812('0xa4')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xa5'));db[_0xd812('0xa6')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xa7'));db[_0xd812('0xa8')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xa9'));db[_0xd812('0xaa')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xab'));db[_0xd812('0xac')]=db['sequelize'][_0xd812('0x15')](_0xd812('0xad'));db['VtigerField']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xae'));db[_0xd812('0xaf')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/intServicenowAccount/intServicenowAccount.model');db[_0xd812('0xb0')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xb1'));db[_0xd812('0xb2')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xb3'));db[_0xd812('0xb4')]=db[_0xd812('0x1')]['import'](_0xd812('0xb5'));db[_0xd812('0xb6')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xb7'));db['Dynamics365Field']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xb8'));db[_0xd812('0xb9')]=db[_0xd812('0x1')]['import'](_0xd812('0xba'));db['FreshsalesConfiguration']=db['sequelize'][_0xd812('0x15')](_0xd812('0xbb'));db[_0xd812('0xbc')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xbd'));db[_0xd812('0xbe')]=db[_0xd812('0x1')][_0xd812('0x15')]('../api/integration/integration.model');db['Network']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xbf'));db[_0xd812('0xc0')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xc1'));db[_0xd812('0xc2')]=db[_0xd812('0x1')]['import'](_0xd812('0xc3'));db[_0xd812('0xc4')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xc5'));db[_0xd812('0xc6')]=db[_0xd812('0x1')]['import'](_0xd812('0xc7'));db[_0xd812('0xc8')]=db['sequelize'][_0xd812('0x15')](_0xd812('0xc9'));db[_0xd812('0xca')]=db[_0xd812('0x1')]['import']('../api/smsQueueReport/smsQueueReport.model');db[_0xd812('0xcb')]=db['sequelize'][_0xd812('0x15')]('../api/squareReport/squareReport.model');db['SquareDetailsReport']=db['sequelize'][_0xd812('0x15')](_0xd812('0xcc'));db['JscriptyProject']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xcd'));db[_0xd812('0xce')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xcf'));db['SquareOdbc']=db[_0xd812('0x1')]['import'](_0xd812('0xd0'));db[_0xd812('0xd1')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xd2'));db[_0xd812('0xd3')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xd4'));db['SquareMessage']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xd5'));db[_0xd812('0xd6')]=db[_0xd812('0x1')]['import'](_0xd812('0xd7'));db[_0xd812('0xd8')]=db['sequelize']['import'](_0xd812('0xd9'));db[_0xd812('0xda')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xdb'));db['Migration']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xdc'));db['Attachment']=db[_0xd812('0x1')][_0xd812('0x15')]('../api/attachment/attachment.model');db['Plugin']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xdd'));db[_0xd812('0xde')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xdf'));db[_0xd812('0xe0')]=db[_0xd812('0x1')]['import']('../api/chatTransferReport/chatTransferReport.model');db[_0xd812('0xe1')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xe2'));db['OpenchannelTransferReport']=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xe3'));db[_0xd812('0xe4')]=db['sequelize'][_0xd812('0x15')]('../api/smsTransferReport/smsTransferReport.model');db[_0xd812('0xe5')]=db[_0xd812('0x1')]['import'](_0xd812('0xe6'));db[_0xd812('0xe7')]=db[_0xd812('0x1')][_0xd812('0x15')](_0xd812('0xe8'));db['UserProfile']=db['sequelize'][_0xd812('0x15')](_0xd812('0xe9'));db[_0xd812('0xea')]=db[_0xd812('0x1')]['import'](_0xd812('0xeb'));db[_0xd812('0xec')]=db[_0xd812('0x1')]['import'](_0xd812('0xed'));db[_0xd812('0x12')][_0xd812('0xee')](db[_0xd812('0x1c')],{'as':_0xd812('0x1c'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x12')]['hasMany'](db[_0xd812('0xf1')],{'as':_0xd812('0xf2'),'foreignKey':'UserId'});db[_0xd812('0x12')][_0xd812('0xf3')](db[_0xd812('0xf4')],{'as':_0xd812('0xf5'),'foreignKey':_0xd812('0xf0')});db['User'][_0xd812('0xf3')](db[_0xd812('0x18')],{'as':_0xd812('0xf6'),'onDelete':_0xd812('0xef'),'hooks':!![]});db[_0xd812('0x12')][_0xd812('0xf3')](db[_0xd812('0x68')],{'as':_0xd812('0xf7'),'foreignKey':'UserId'});db[_0xd812('0x12')][_0xd812('0xf3')](db['CmHopperHistory'],{'as':_0xd812('0xf8'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x12')][_0xd812('0xf3')](db['ReportAgentPreview'],{'as':_0xd812('0x6c'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x12')]['hasMany'](db[_0xd812('0x52')],{'as':_0xd812('0xf9'),'foreignKey':'UserId'});db['User'][_0xd812('0xf3')](db[_0xd812('0x59')],{'as':'ChatInteractions','foreignKey':_0xd812('0xf0')});db[_0xd812('0x12')]['hasMany'](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0xd812('0xf0')});db[_0xd812('0x12')][_0xd812('0xf3')](db[_0xd812('0x45')],{'as':_0xd812('0xfa'),'foreignKey':'UserId'});db[_0xd812('0x12')][_0xd812('0xf3')](db[_0xd812('0x37')],{'as':'MailInteractions','foreignKey':'UserId'});db[_0xd812('0x12')][_0xd812('0xfb')](db['UserProfile'],{'as':_0xd812('0xfc'),'foreignKey':'userProfileId'});db['User'][_0xd812('0xfd')](db[_0xd812('0x5e')],{'as':'Groups','through':_0xd812('0xfe')});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x62')],{'as':_0xd812('0xff'),'through':_0xd812('0x100')});db[_0xd812('0x12')]['belongsToMany'](db[_0xd812('0xe5')],{'as':_0xd812('0x101'),'through':'cm_user_has_lists'});db[_0xd812('0x12')][_0xd812('0xfd')](db['Team'],{'through':'user_has_teams'});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x37')],{'as':_0xd812('0x102'),'through':_0xd812('0x103')});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x59')],{'as':_0xd812('0x104'),'through':_0xd812('0x105')});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x45')],{'as':_0xd812('0xfa'),'through':_0xd812('0x106')});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x4d')],{'as':_0xd812('0x107'),'through':'user_has_sms_interactions'});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x52')],{'as':_0xd812('0xf9'),'through':'user_has_openchannel_interactions'});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x1a')],{'as':_0xd812('0x108'),'through':_0xd812('0x28'),'required':![]});db[_0xd812('0x12')][_0xd812('0xfd')](db['MailQueue'],{'as':_0xd812('0x109'),'through':_0xd812('0x10a'),'required':![]});db['User'][_0xd812('0xfd')](db[_0xd812('0x5d')],{'as':'ChatQueues','through':_0xd812('0x10b'),'required':![],'hooks':!![]});db[_0xd812('0x12')][_0xd812('0xfd')](db['FaxQueue'],{'as':_0xd812('0x10c'),'through':_0xd812('0x2c'),'required':![]});db[_0xd812('0x12')][_0xd812('0xfd')](db['SmsQueue'],{'as':_0xd812('0x10d'),'through':_0xd812('0x10e'),'required':![]});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x56')],{'as':_0xd812('0x10f'),'through':'UserOpenchannelQueue','required':![]});db['User'][_0xd812('0xfd')](db[_0xd812('0xe5')],{'through':'cm_user_has_lists'});db['User']['belongsToMany'](db[_0xd812('0xe7')],{'as':_0xd812('0x110'),'through':_0xd812('0x111'),'required':![]});db[_0xd812('0x12')]['belongsToMany'](db[_0xd812('0x58')],{'as':_0xd812('0x112'),'through':'user_has_chat_websites'});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x42')],{'as':'FaxAccounts','through':_0xd812('0x113')});db['User'][_0xd812('0xfd')](db[_0xd812('0x31')],{'as':_0xd812('0x114'),'through':_0xd812('0x115')});db['User'][_0xd812('0xfd')](db[_0xd812('0x116')],{'as':_0xd812('0x117'),'through':_0xd812('0x118')});db[_0xd812('0x12')][_0xd812('0xfd')](db[_0xd812('0x4a')],{'as':_0xd812('0x119'),'through':_0xd812('0x11a')});db[_0xd812('0x12')][_0xd812('0xfd')](db['SquareProject'],{'as':'SquareProjects','through':_0xd812('0x11b')});db['VoiceChanSpy']['hasMany'](db['VoiceExtension'],{'as':_0xd812('0x11c'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x11d')});db[_0xd812('0x17')]['hasMany'](db[_0xd812('0x18')],{'onDelete':'cascade'});db[_0xd812('0x18')][_0xd812('0xf3')](db[_0xd812('0x18')],{'as':_0xd812('0x11e'),'onDelete':_0xd812('0xef')});db[_0xd812('0x11f')][_0xd812('0xfd')](db[_0xd812('0x7d')],{'as':_0xd812('0x120'),'through':_0xd812('0x121')});db[_0xd812('0x1a')]['hasMany'](db[_0xd812('0xf4')],{'as':'Members','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xd812('0xf3')](db['CmHopper'],{'as':_0xd812('0x122'),'foreignKey':_0xd812('0x123')});db['VoiceQueue']['hasMany'](db['CmHopperFinal'],{'as':_0xd812('0xf7'),'foreignKey':_0xd812('0x123')});db[_0xd812('0x1a')]['hasMany'](db[_0xd812('0x6a')],{'as':_0xd812('0x124'),'foreignKey':_0xd812('0x123')});db[_0xd812('0x1a')]['hasMany'](db[_0xd812('0x6c')],{'as':_0xd812('0x6c'),'foreignKey':_0xd812('0x123')});db[_0xd812('0x1a')][_0xd812('0xf3')](db[_0xd812('0x66')],{'as':_0xd812('0x125'),'foreignKey':'VoiceQueueId'});db[_0xd812('0x1a')][_0xd812('0xf3')](db[_0xd812('0xc8')],{'as':_0xd812('0x126'),'foreignKey':_0xd812('0x123')});db[_0xd812('0x1a')][_0xd812('0xfb')](db[_0xd812('0x25')],{'as':_0xd812('0x25'),'foreignKey':'TrunkId'});db[_0xd812('0x1a')][_0xd812('0xfb')](db[_0xd812('0x25')],{'as':_0xd812('0x127'),'foreignKey':_0xd812('0x128')});db[_0xd812('0x1a')][_0xd812('0xfb')](db[_0xd812('0x74')],{'as':_0xd812('0x74'),'foreignKey':_0xd812('0x129')});db[_0xd812('0x1a')]['belongsTo'](db['Pause'],{'as':_0xd812('0x12a'),'foreignKey':'mandatoryDispositionPauseId'});db[_0xd812('0x1a')][_0xd812('0xfd')](db[_0xd812('0xe5')],{'as':'Lists','through':_0xd812('0x12b')});db['VoiceQueue'][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x28')});db[_0xd812('0x1a')][_0xd812('0xfd')](db[_0xd812('0xd6')],{'as':'Teams','through':'team_has_voice_queues'});db[_0xd812('0x1a')][_0xd812('0xfd')](db[_0xd812('0xe5')],{'as':'BlackLists','through':_0xd812('0x12d')});db[_0xd812('0xf1')]['belongsTo'](db[_0xd812('0x12')],{'as':'User','foreignKey':'UserId'});db[_0xd812('0x12e')][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x12'),'foreignKey':'UserId'});db['VoiceMail'][_0xd812('0xf3')](db[_0xd812('0x12f')],{'as':_0xd812('0x130'),'onDelete':'cascade','foreignKey':'mailboxuser','sourceKey':'mailbox'});db['VoiceMailMessage'][_0xd812('0xfb')](db[_0xd812('0x1c')],{'foreignKey':_0xd812('0x131'),'targetKey':'mailbox'});db[_0xd812('0x1e')][_0xd812('0xf3')](db['VoiceQueueReport'],{'as':_0xd812('0x132'),'foreignKey':_0xd812('0x133'),'constraints':![]});db[_0xd812('0x1e')][_0xd812('0xf3')](db[_0xd812('0x21')],{'as':_0xd812('0x134'),'foreignKey':_0xd812('0x133'),'constraints':![]});db[_0xd812('0x1e')][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x12'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x1e')]['belongsTo'](db[_0xd812('0x62')],{'as':'Contact','foreignKey':_0xd812('0x135')});db[_0xd812('0x2f')][_0xd812('0xfb')](db[_0xd812('0x31')],{'as':_0xd812('0x31'),'foreignKey':'MailAccountId'});db[_0xd812('0x136')][_0xd812('0xfb')](db['MailAccount'],{'as':_0xd812('0x31'),'foreignKey':'MailAccountId'});db[_0xd812('0x31')][_0xd812('0xee')](db[_0xd812('0x2f')],{'as':'Imap','onDelete':'cascade'});db[_0xd812('0x31')][_0xd812('0xee')](db['MailServerOut'],{'as':_0xd812('0x137'),'onDelete':'cascade'});db[_0xd812('0x31')][_0xd812('0xf3')](db[_0xd812('0x70')],{'as':_0xd812('0x138'),'foreignKey':_0xd812('0x139')});db[_0xd812('0x31')]['hasMany'](db[_0xd812('0x6e')],{'as':'Answers','foreignKey':_0xd812('0x139')});db[_0xd812('0x31')][_0xd812('0xf3')](db[_0xd812('0x39')],{'as':_0xd812('0x130'),'foreignKey':_0xd812('0x139')});db[_0xd812('0x31')]['hasMany'](db[_0xd812('0x37')],{'as':_0xd812('0x13a')});db[_0xd812('0x31')]['hasMany'](db[_0xd812('0x3b')],{'as':'Applications'});db[_0xd812('0x31')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0x31')][_0xd812('0xfb')](db[_0xd812('0x7f')],{'as':'Template','foreignKey':_0xd812('0x13d')});db[_0xd812('0x31')][_0xd812('0xfb')](db[_0xd812('0x75')],{'as':_0xd812('0x12a'),'foreignKey':'mandatoryDispositionPauseId'});db['MailAccount'][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x115')});db['MailQueue']['belongsToMany'](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x10a')});db[_0xd812('0x33')][_0xd812('0xfd')](db[_0xd812('0xd6')],{'through':_0xd812('0x13e'),'as':_0xd812('0x13f')});db['MailInteraction']['hasMany'](db[_0xd812('0x39')],{'as':_0xd812('0x130'),'onDelete':'cascade','foreignKey':_0xd812('0x140')});db[_0xd812('0x37')][_0xd812('0xfb')](db[_0xd812('0x31')],{'as':'Account','foreignKey':_0xd812('0x139')});db[_0xd812('0x37')][_0xd812('0xfb')](db['CmContact'],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0x37')][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x142'),'foreignKey':_0xd812('0xf0')});db['MailInteraction']['belongsToMany'](db['Tag'],{'through':'mail_interaction_has_tags','as':'Tags'});db[_0xd812('0x37')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x144'),'as':'ThroughTags'});db[_0xd812('0x37')]['belongsToMany'](db['User'],{'as':_0xd812('0x145'),'through':_0xd812('0x103'),'foreignKey':'MailInteractionId'});db[_0xd812('0x39')][_0xd812('0xf3')](db[_0xd812('0x146')],{'as':_0xd812('0x147'),'onDelete':_0xd812('0xef')});db[_0xd812('0x39')][_0xd812('0xfb')](db['User'],{'as':_0xd812('0x12')});db[_0xd812('0x39')]['belongsTo'](db[_0xd812('0x62')],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x141')});db[_0xd812('0x39')][_0xd812('0xfb')](db[_0xd812('0x37')],{'as':_0xd812('0x148'),'foreignKey':_0xd812('0x140')});db[_0xd812('0x39')][_0xd812('0xfb')](db[_0xd812('0x31')],{'as':_0xd812('0x149'),'foreignKey':'MailAccountId'});db[_0xd812('0x3b')]['belongsTo'](db[_0xd812('0x12')],{'onDelete':_0xd812('0x14a')});db[_0xd812('0x3b')]['belongsTo'](db[_0xd812('0x33')],{'onDelete':'restrict'});db[_0xd812('0x3b')][_0xd812('0xfb')](db[_0xd812('0x31')],{'onDelete':_0xd812('0x14a')});db[_0xd812('0x3b')][_0xd812('0xfb')](db[_0xd812('0x74')],{'onDelete':_0xd812('0x14a'),'foreignKey':'IntervalId'});db[_0xd812('0x3b')][_0xd812('0xfb')](db[_0xd812('0x143')],{'onDelete':'restrict','foreignKey':_0xd812('0x14b')});db[_0xd812('0x3d')][_0xd812('0xfb')](db[_0xd812('0x31')],{});db[_0xd812('0x3d')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c')});db['MailQueueReport'][_0xd812('0xfb')](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0x3d')][_0xd812('0xfb')](db[_0xd812('0x37')],{});db[_0xd812('0x3d')][_0xd812('0xfb')](db[_0xd812('0x39')],{});db['MailQueueReport']['belongsTo'](db[_0xd812('0x12')],{});db['MailQueueReport'][_0xd812('0xfb')](db[_0xd812('0x33')],{});db[_0xd812('0x14c')][_0xd812('0xf3')](db[_0xd812('0x40')],{'as':'Items','onDelete':'cascade'});db[_0xd812('0x42')]['hasMany'](db[_0xd812('0x70')],{'as':_0xd812('0x138'),'foreignKey':'FaxAccountId'});db['FaxAccount']['hasMany'](db[_0xd812('0x6e')],{'as':'Answers','foreignKey':'FaxAccountId'});db[_0xd812('0x42')][_0xd812('0xf3')](db[_0xd812('0x45')],{'as':_0xd812('0x13a')});db[_0xd812('0x42')][_0xd812('0xf3')](db['FaxApplication'],{'as':_0xd812('0x11e')});db[_0xd812('0x42')][_0xd812('0xf3')](db['VoiceExtension'],{'as':_0xd812('0x14d'),'onDelete':'cascade'});db[_0xd812('0x42')][_0xd812('0xf3')](db[_0xd812('0x47')],{'as':'Messages'});db[_0xd812('0x42')][_0xd812('0xfb')](db[_0xd812('0x25')],{'as':_0xd812('0x25')});db[_0xd812('0x42')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':'List','foreignKey':_0xd812('0x13c')});db[_0xd812('0x42')][_0xd812('0xfb')](db['Pause'],{'as':_0xd812('0x12a'),'foreignKey':_0xd812('0x14e')});db[_0xd812('0x42')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x113')});db[_0xd812('0x14f')][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':_0xd812('0x14a')});db['FaxApplication']['belongsTo'](db[_0xd812('0x150')],{'onDelete':_0xd812('0x14a')});db['FaxApplication'][_0xd812('0xfb')](db[_0xd812('0x42')],{'onDelete':_0xd812('0x14a')});db['FaxApplication'][_0xd812('0xfb')](db[_0xd812('0x143')],{'onDelete':_0xd812('0x14a'),'foreignKey':_0xd812('0x14b')});db[_0xd812('0x45')][_0xd812('0xf3')](db['FaxMessage'],{'as':_0xd812('0x130'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x151')});db[_0xd812('0x45')][_0xd812('0xfb')](db['FaxAccount'],{'as':'Account','foreignKey':_0xd812('0x152')});db['FaxInteraction']['belongsTo'](db['CmContact'],{'as':_0xd812('0x141'),'foreignKey':'ContactId'});db[_0xd812('0x45')]['belongsTo'](db[_0xd812('0x12')],{'as':_0xd812('0x142'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x45')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x153'),'as':_0xd812('0x154')});db[_0xd812('0x45')]['belongsToMany'](db[_0xd812('0x143')],{'through':'fax_interaction_has_tags','as':'ThroughTags'});db[_0xd812('0x45')][_0xd812('0xfd')](db['User'],{'as':_0xd812('0x145'),'through':'user_has_fax_interactions','foreignKey':'FaxInteractionId'});db[_0xd812('0x47')][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':'cascade','as':'User'});db['FaxMessage'][_0xd812('0xfb')](db[_0xd812('0x45')],{'as':_0xd812('0x148'),'foreignKey':_0xd812('0x151')});db[_0xd812('0x47')][_0xd812('0xfb')](db[_0xd812('0x62')],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x141')});db['FaxMessage'][_0xd812('0xfb')](db[_0xd812('0x146')],{'as':_0xd812('0x146'),'foreignKey':'AttachmentId'});db[_0xd812('0x47')][_0xd812('0xfb')](db['FaxAccount'],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x152')});db[_0xd812('0x150')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x2c')});db['FaxQueue'][_0xd812('0xfd')](db[_0xd812('0xd6')],{'through':'team_has_fax_queues','as':_0xd812('0x13f')});db[_0xd812('0x155')][_0xd812('0xfb')](db[_0xd812('0x42')],{});db[_0xd812('0x155')][_0xd812('0xfb')](db['CmList'],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0x155')]['belongsTo'](db['CmContact'],{'as':'Contact','foreignKey':_0xd812('0x135')});db[_0xd812('0x155')][_0xd812('0xfb')](db[_0xd812('0x45')],{});db['FaxQueueReport'][_0xd812('0xfb')](db[_0xd812('0x47')],{});db['FaxQueueReport']['belongsTo'](db[_0xd812('0x12')],{});db[_0xd812('0x155')][_0xd812('0xfb')](db[_0xd812('0x150')],{});db[_0xd812('0x4a')]['hasMany'](db['Disposition'],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xd812('0x4a')][_0xd812('0xf3')](db[_0xd812('0x6e')],{'as':'Answers','foreignKey':_0xd812('0x156')});db['SmsAccount'][_0xd812('0xf3')](db['SmsMessage'],{'as':_0xd812('0x130'),'foreignKey':_0xd812('0x156')});db[_0xd812('0x4a')][_0xd812('0xf3')](db[_0xd812('0x4d')],{'as':_0xd812('0x13a')});db[_0xd812('0x4a')][_0xd812('0xf3')](db[_0xd812('0x157')],{'as':'Applications'});db[_0xd812('0x4a')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':'ListId'});db[_0xd812('0x4a')][_0xd812('0xfb')](db['Pause'],{'as':_0xd812('0x12a'),'foreignKey':_0xd812('0x14e')});db['SmsAccount'][_0xd812('0xfd')](db['User'],{'as':'Agents','through':_0xd812('0x11a')});db['SmsApplication'][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':_0xd812('0x14a')});db[_0xd812('0x157')]['belongsTo'](db['SmsQueue'],{'onDelete':_0xd812('0x14a')});db[_0xd812('0x157')][_0xd812('0xfb')](db[_0xd812('0x4a')],{'onDelete':_0xd812('0x14a')});db['SmsApplication']['belongsTo'](db['Interval'],{'onDelete':_0xd812('0x14a'),'foreignKey':_0xd812('0x129')});db[_0xd812('0x157')][_0xd812('0xfb')](db[_0xd812('0x143')],{'onDelete':'restrict','foreignKey':_0xd812('0x14b')});db[_0xd812('0x4d')]['hasMany'](db[_0xd812('0x158')],{'as':_0xd812('0x130'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x159')});db[_0xd812('0x4d')][_0xd812('0xfb')](db[_0xd812('0x4a')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x156')});db[_0xd812('0x4d')][_0xd812('0xfb')](db[_0xd812('0x62')],{'as':'Contact','foreignKey':_0xd812('0x135')});db[_0xd812('0x4d')]['belongsTo'](db['User'],{'as':_0xd812('0x142'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x4d')]['belongsToMany'](db[_0xd812('0x143')],{'through':_0xd812('0x15a'),'as':_0xd812('0x154')});db[_0xd812('0x4d')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':'sms_interaction_has_tags','as':_0xd812('0x15b')});db['SmsInteraction']['belongsToMany'](db[_0xd812('0x12')],{'as':'Users','through':_0xd812('0x15c'),'foreignKey':_0xd812('0x159')});db[_0xd812('0x158')][_0xd812('0xfb')](db['User'],{'as':_0xd812('0x12')});db['SmsMessage'][_0xd812('0xfb')](db[_0xd812('0x62')],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x141')});db[_0xd812('0x158')]['belongsTo'](db['SmsInteraction'],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x148'),'foreignKey':'SmsInteractionId'});db['SmsMessage'][_0xd812('0xfb')](db[_0xd812('0x4a')],{'as':_0xd812('0x149'),'foreignKey':'SmsAccountId'});db[_0xd812('0x15d')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x10e'),'foreignKey':'SmsQueueId'});db[_0xd812('0x15d')]['belongsToMany'](db[_0xd812('0xd6')],{'through':_0xd812('0x15e'),'as':_0xd812('0x13f')});db[_0xd812('0x116')][_0xd812('0xf3')](db[_0xd812('0x70')],{'as':_0xd812('0x138'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x116')][_0xd812('0xf3')](db[_0xd812('0x6e')],{'as':_0xd812('0x160'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x116')][_0xd812('0xf3')](db[_0xd812('0x52')],{'as':_0xd812('0x13a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount']['hasMany'](db[_0xd812('0x54')],{'as':_0xd812('0x130'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x116')][_0xd812('0xf3')](db[_0xd812('0x50')],{'as':_0xd812('0x11e'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x116')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':'ListId'});db[_0xd812('0x116')][_0xd812('0xfb')](db[_0xd812('0x75')],{'as':_0xd812('0x12a'),'foreignKey':_0xd812('0x14e')});db[_0xd812('0x116')]['belongsToMany'](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x118')});db[_0xd812('0x50')][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':_0xd812('0x14a')});db['OpenchannelApplication'][_0xd812('0xfb')](db[_0xd812('0x56')],{'onDelete':_0xd812('0x14a'),'foreignKey':'OpenchannelQueueId'});db[_0xd812('0x50')][_0xd812('0xfb')](db[_0xd812('0x116')],{'onDelete':_0xd812('0x14a'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x50')][_0xd812('0xfb')](db[_0xd812('0x74')],{'onDelete':_0xd812('0x14a'),'foreignKey':'IntervalId'});db['OpenchannelApplication']['belongsTo'](db[_0xd812('0x143')],{'onDelete':_0xd812('0x14a'),'foreignKey':_0xd812('0x14b')});db[_0xd812('0x52')][_0xd812('0xf3')](db[_0xd812('0x54')],{'as':'Messages','onDelete':_0xd812('0xef'),'foreignKey':'OpenchannelInteractionId'});db[_0xd812('0x52')][_0xd812('0xfb')](db[_0xd812('0x116')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x15f')});db[_0xd812('0x52')][_0xd812('0xfb')](db['CmContact'],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0x52')][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x142'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x52')][_0xd812('0xfd')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':'Tags'});db[_0xd812('0x52')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x161'),'as':_0xd812('0x15b')});db[_0xd812('0x52')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x145'),'through':_0xd812('0x162'),'foreignKey':_0xd812('0x163')});db[_0xd812('0x54')]['belongsTo'](db[_0xd812('0x12')],{'onDelete':_0xd812('0xef'),'as':'User'});db['OpenchannelMessage'][_0xd812('0xfb')](db[_0xd812('0x62')],{'onDelete':_0xd812('0xef'),'as':'Contact'});db[_0xd812('0x54')][_0xd812('0xfb')](db['OpenchannelInteraction'],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x148'),'foreignKey':'OpenchannelInteractionId'});db[_0xd812('0x54')][_0xd812('0xfb')](db[_0xd812('0x146')],{'as':_0xd812('0x146'),'foreignKey':_0xd812('0x164')});db[_0xd812('0x54')]['belongsTo'](db[_0xd812('0x116')],{'as':_0xd812('0x149'),'foreignKey':'OpenchannelAccountId'});db[_0xd812('0x56')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':'Agents','through':_0xd812('0x165'),'foreignKey':_0xd812('0x166')});db['OpenchannelQueue'][_0xd812('0xfd')](db[_0xd812('0xd6')],{'through':_0xd812('0x167'),'as':_0xd812('0x13f')});db[_0xd812('0x58')][_0xd812('0xf3')](db[_0xd812('0x70')],{'as':_0xd812('0x138'),'foreignKey':_0xd812('0x168')});db['ChatWebsite'][_0xd812('0xf3')](db[_0xd812('0x6e')],{'as':_0xd812('0x160'),'foreignKey':_0xd812('0x168')});db[_0xd812('0x58')]['hasMany'](db['ChatProactiveAction'],{'as':'ProactiveActions'});db['ChatWebsite'][_0xd812('0xf3')](db['ChatInteraction'],{'as':_0xd812('0x13a')});db['ChatWebsite'][_0xd812('0xf3')](db[_0xd812('0x169')],{'as':_0xd812('0x11e')});db[_0xd812('0x58')][_0xd812('0xf3')](db[_0xd812('0x16a')],{'as':'Messages'});db[_0xd812('0x58')][_0xd812('0xfb')](db['CmList'],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c')});db['ChatWebsite'][_0xd812('0xfb')](db[_0xd812('0x74')],{'as':_0xd812('0x74'),'foreignKey':_0xd812('0x129')});db['ChatWebsite'][_0xd812('0xfb')](db['Pause'],{'as':_0xd812('0x12a'),'foreignKey':_0xd812('0x14e')});db[_0xd812('0x58')][_0xd812('0xfd')](db['User'],{'as':'Agents','through':'user_has_chat_websites'});db['OpenchannelQueueReport']['belongsTo'](db[_0xd812('0x116')],{});db['OpenchannelQueueReport'][_0xd812('0xfb')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0xd812('0x16b')]['belongsTo'](db[_0xd812('0x62')],{'as':'Contact','foreignKey':_0xd812('0x135')});db[_0xd812('0x16b')][_0xd812('0xfb')](db[_0xd812('0x52')],{});db[_0xd812('0x16b')][_0xd812('0xfb')](db[_0xd812('0x54')],{});db[_0xd812('0x16b')]['belongsTo'](db[_0xd812('0x12')],{});db[_0xd812('0x16b')][_0xd812('0xfb')](db['OpenchannelQueue'],{});db['ChatApplication'][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x16c'),'foreignKey':'UserId','onDelete':_0xd812('0x14a')});db[_0xd812('0x169')]['belongsTo'](db[_0xd812('0x5d')],{'as':_0xd812('0x16d'),'foreignKey':_0xd812('0x16e'),'onDelete':_0xd812('0x14a')});db[_0xd812('0x169')]['belongsTo'](db[_0xd812('0x58')],{'as':'Website','foreignKey':_0xd812('0x168'),'onDelete':_0xd812('0x14a')});db['ChatApplication'][_0xd812('0xfb')](db['Tag'],{'onDelete':_0xd812('0x14a'),'foreignKey':'TagId'});db[_0xd812('0x59')][_0xd812('0xf3')](db[_0xd812('0x16a')],{'as':_0xd812('0x130'),'onDelete':_0xd812('0xef'),'foreignKey':'ChatInteractionId'});db[_0xd812('0x59')][_0xd812('0xfb')](db[_0xd812('0x58')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x168')});db[_0xd812('0x59')][_0xd812('0xfb')](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0x59')]['belongsTo'](db[_0xd812('0x12')],{'as':_0xd812('0x142'),'foreignKey':'UserId'});db['ChatInteraction'][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x16f'),'as':'Tags'});db[_0xd812('0x59')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x16f'),'as':_0xd812('0x15b')});db[_0xd812('0x59')]['belongsToMany'](db[_0xd812('0x12')],{'as':_0xd812('0x145'),'through':_0xd812('0x105'),'foreignKey':_0xd812('0x170')});db['ChatMessage'][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':'cascade','as':_0xd812('0x12')});db[_0xd812('0x16a')]['belongsTo'](db[_0xd812('0x62')],{'onDelete':'cascade','as':'Contact','foreignKey':_0xd812('0x135')});db['ChatMessage'][_0xd812('0xfb')](db[_0xd812('0x59')],{'onDelete':_0xd812('0xef'),'as':_0xd812('0x148'),'foreignKey':_0xd812('0x170')});db['ChatMessage'][_0xd812('0xfb')](db[_0xd812('0x146')],{'as':_0xd812('0x146'),'foreignKey':'AttachmentId'});db[_0xd812('0x16a')]['belongsTo'](db[_0xd812('0x58')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x168')});db['ChatOfflineMessage']['belongsTo'](db[_0xd812('0x62')],{'onDelete':_0xd812('0xef'),'as':'Contact','foreignKey':_0xd812('0x135')});db['ChatOfflineMessage'][_0xd812('0xfb')](db[_0xd812('0x58')],{'as':'Account','foreignKey':_0xd812('0x168')});db[_0xd812('0x5d')][_0xd812('0xfd')](db['User'],{'as':_0xd812('0x12c'),'through':'UserChatQueue','hooks':!![]});db[_0xd812('0x5d')]['belongsToMany'](db[_0xd812('0xd6')],{'through':_0xd812('0x171'),'as':'Teams'});db['ChatGroup'][_0xd812('0xf3')](db[_0xd812('0xc2')],{'as':_0xd812('0x130'),'foreignKey':_0xd812('0x172'),'onDelete':_0xd812('0xef')});db[_0xd812('0x5e')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':'Members','through':_0xd812('0xfe')});db[_0xd812('0x173')]['belongsTo'](db[_0xd812('0x58')],{'as':_0xd812('0x174'),'foreignKey':_0xd812('0x168')});db[_0xd812('0x175')][_0xd812('0xf3')](db[_0xd812('0x62')],{'as':'Contacts','foreignKey':_0xd812('0x176')});db['CmContact'][_0xd812('0xf3')](db['CmHopper'],{'as':'Hoppers','foreignKey':'ContactId'});db['CmContact'][_0xd812('0xf3')](db[_0xd812('0x68')],{'as':_0xd812('0xf7'),'foreignKey':_0xd812('0x135')});db['CmContact'][_0xd812('0xf3')](db['CmHopperHistory'],{'as':'HopperHistories','foreignKey':_0xd812('0x135')});db[_0xd812('0x62')]['hasMany'](db['ReportAgentPreview'],{'as':_0xd812('0x6c'),'foreignKey':'ContactId'});db[_0xd812('0x62')][_0xd812('0xf3')](db[_0xd812('0xc8')],{'as':_0xd812('0x126'),'foreignKey':'ContactId'});db[_0xd812('0x62')][_0xd812('0xf3')](db[_0xd812('0x52')],{'as':_0xd812('0xf9'),'foreignKey':'ContactId','onDelete':'restrict'});db[_0xd812('0x62')]['hasMany'](db[_0xd812('0x59')],{'as':'ChatInteractions','foreignKey':_0xd812('0x135'),'onDelete':'restrict'});db[_0xd812('0x62')]['hasMany'](db[_0xd812('0x4d')],{'as':_0xd812('0x107'),'foreignKey':_0xd812('0x135'),'onDelete':_0xd812('0x14a')});db['CmContact']['hasMany'](db[_0xd812('0x45')],{'as':_0xd812('0xfa'),'foreignKey':_0xd812('0x135'),'onDelete':_0xd812('0x14a')});db[_0xd812('0x62')]['hasMany'](db[_0xd812('0x37')],{'as':_0xd812('0x102'),'foreignKey':_0xd812('0x135'),'onDelete':_0xd812('0x14a')});db[_0xd812('0x62')][_0xd812('0xfb')](db[_0xd812('0x175')],{'as':_0xd812('0x177'),'foreignKey':_0xd812('0x176')});db[_0xd812('0x62')][_0xd812('0xfb')](db['CmList'],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c'),'onDelete':'cascade'});db[_0xd812('0x62')]['belongsToMany'](db['User'],{'as':_0xd812('0x145'),'through':_0xd812('0x100')});db[_0xd812('0x62')][_0xd812('0xfd')](db['Tag'],{'as':_0xd812('0x154'),'through':_0xd812('0x178')});db[_0xd812('0x62')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x178'),'as':_0xd812('0x15b')});db['CmHopper'][_0xd812('0xfb')](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135'),'onDelete':_0xd812('0xef')});db['CmHopper'][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':'ListId','onDelete':_0xd812('0xef')});db[_0xd812('0x64')][_0xd812('0xfb')](db[_0xd812('0x12')],{'as':_0xd812('0x16c'),'foreignKey':_0xd812('0xf0')});db[_0xd812('0x64')][_0xd812('0xfb')](db[_0xd812('0x1a')],{'as':_0xd812('0x16d'),'foreignKey':_0xd812('0x123'),'onDelete':_0xd812('0xef')});db['CmHopper'][_0xd812('0xfb')](db[_0xd812('0xda')],{'as':_0xd812('0xda'),'foreignKey':_0xd812('0x179'),'onDelete':'cascade'});db[_0xd812('0x64')]['belongsTo'](db[_0xd812('0x12')],{'as':_0xd812('0x142'),'foreignKey':_0xd812('0x17a')});db['CmHopperBlack']['belongsTo'](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135'),'onDelete':'cascade'});db[_0xd812('0x66')]['belongsTo'](db[_0xd812('0xe5')],{'as':'List','foreignKey':_0xd812('0x13c'),'onDelete':_0xd812('0xef')});db[_0xd812('0x66')][_0xd812('0xfb')](db[_0xd812('0x1a')],{'as':_0xd812('0x16d'),'foreignKey':_0xd812('0x123'),'onDelete':'cascade'});db[_0xd812('0x66')][_0xd812('0xfb')](db[_0xd812('0xda')],{'as':_0xd812('0xda'),'foreignKey':'CampaignId','onDelete':'cascade'});db[_0xd812('0x17b')][_0xd812('0xf3')](db[_0xd812('0x72')],{'as':{'plural':'All','singular':_0xd812('0x17c')},'foreignKey':_0xd812('0x17d'),'onDelete':'cascade','hooks':!![]});db['Automation'][_0xd812('0xf3')](db[_0xd812('0x72')],{'as':{'plural':_0xd812('0x17e'),'singular':_0xd812('0x17f')},'foreignKey':'AutomationAnyId','onDelete':_0xd812('0xef'),'hooks':!![]});db[_0xd812('0x17b')][_0xd812('0xf3')](db[_0xd812('0x6d')],{'as':_0xd812('0x180'),'foreignKey':_0xd812('0x181'),'onDelete':_0xd812('0xef'),'hooks':!![]});db[_0xd812('0x74')][_0xd812('0xf3')](db[_0xd812('0x74')],{'as':_0xd812('0x182'),'foreignKey':_0xd812('0x129'),'onDelete':_0xd812('0xef'),'hooks':!![],'required':![]});db[_0xd812('0x74')][_0xd812('0xf3')](db[_0xd812('0x18')],{'as':_0xd812('0xf6'),'foreignKey':_0xd812('0x129'),'onDelete':_0xd812('0x14a')});db['Interval']['hasMany'](db[_0xd812('0x3b')],{'as':'MailApplications','foreignKey':'IntervalId'});db[_0xd812('0x74')][_0xd812('0xf3')](db[_0xd812('0x169')],{'as':'ChatApplications','foreignKey':_0xd812('0x129')});db[_0xd812('0x74')]['hasMany'](db[_0xd812('0x14f')],{'as':'FaxApplications','foreignKey':_0xd812('0x129')});db[_0xd812('0x74')][_0xd812('0xf3')](db[_0xd812('0x157')],{'as':_0xd812('0x183'),'foreignKey':_0xd812('0x129')});db[_0xd812('0x7b')]['belongsTo'](db['MailAccount'],{});db[_0xd812('0x7b')][_0xd812('0xfb')](db[_0xd812('0x184')],{'foreignKey':_0xd812('0x185')});db[_0xd812('0x7b')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0xd812('0x186')});db[_0xd812('0x7d')][_0xd812('0xfd')](db[_0xd812('0x11f')],{'as':_0xd812('0x187'),'through':_0xd812('0x121'),'onDelete':'restrict'});db['Tag'][_0xd812('0xfd')](db[_0xd812('0x62')],{'through':_0xd812('0x178')});db[_0xd812('0x143')][_0xd812('0xfd')](db['ChatInteraction'],{'through':_0xd812('0x16f')});db[_0xd812('0x143')][_0xd812('0xfd')](db[_0xd812('0x37')],{'through':_0xd812('0x144')});db['Tag'][_0xd812('0xfd')](db['SmsInteraction'],{'through':'sms_interaction_has_tags'});db[_0xd812('0x143')][_0xd812('0xfd')](db['FaxInteraction'],{'through':'fax_interaction_has_tags'});db[_0xd812('0x143')][_0xd812('0xfd')](db[_0xd812('0x52')],{'through':_0xd812('0x161')});db['Trigger']['hasMany'](db[_0xd812('0x72')],{'as':{'plural':_0xd812('0x188'),'singular':_0xd812('0x189')},'foreignKey':_0xd812('0x18a'),'onDelete':'cascade','hooks':!![]});db[_0xd812('0x80')][_0xd812('0xf3')](db[_0xd812('0x72')],{'as':{'plural':_0xd812('0x18b'),'singular':_0xd812('0x18c')},'foreignKey':_0xd812('0x18d'),'onDelete':_0xd812('0xef'),'hooks':!![]});db[_0xd812('0x80')][_0xd812('0xf3')](db[_0xd812('0x6d')],{'as':_0xd812('0x180'),'foreignKey':_0xd812('0x18e'),'onDelete':_0xd812('0xef'),'hooks':!![]});db['AnalyticCustomReport'][_0xd812('0xf3')](db[_0xd812('0x8e')],{'as':_0xd812('0x18f'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x186'),'hooks':!![]});db['AnalyticDefaultReport'][_0xd812('0xf3')](db[_0xd812('0x8e')],{'as':'Fields','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x185')});db[_0xd812('0x8c')]['hasMany'](db[_0xd812('0x8e')],{'as':_0xd812('0x18f'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x190')});db[_0xd812('0x8e')][_0xd812('0xfb')](db[_0xd812('0x8c')],{'foreignKey':_0xd812('0x190')});db[_0xd812('0x191')][_0xd812('0xf3')](db[_0xd812('0x91')],{'as':_0xd812('0x192'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x91')][_0xd812('0xf3')](db['SalesforceField'],{'as':_0xd812('0x194'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x195')});db[_0xd812('0x91')][_0xd812('0xf3')](db[_0xd812('0x92')],{'as':'Descriptions','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x91')][_0xd812('0xf3')](db[_0xd812('0x92')],{'as':_0xd812('0x18f'),'onDelete':_0xd812('0xef'),'foreignKey':'FieldId'});db['SalesforceConfiguration'][_0xd812('0xfb')](db[_0xd812('0x191')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x92')]['hasMany'](db['SalesforceField'],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0x92')][_0xd812('0xf3')](db[_0xd812('0x92')],{'as':_0xd812('0x198'),'foreignKey':'DescriptionId'});db[_0xd812('0x92')][_0xd812('0xf3')](db[_0xd812('0x92')],{'as':_0xd812('0x199'),'foreignKey':'FieldId'});db[_0xd812('0x92')][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':'VariableId'});db[_0xd812('0x94')][_0xd812('0xf3')](db[_0xd812('0x95')],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x95')][_0xd812('0xf3')](db[_0xd812('0x96')],{'as':_0xd812('0x194'),'onDelete':_0xd812('0xef'),'foreignKey':'SubjectId'});db[_0xd812('0x95')]['hasMany'](db['SugarcrmField'],{'as':_0xd812('0x19a'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x95')]['hasMany'](db[_0xd812('0x96')],{'as':'Fields','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0x95')][_0xd812('0xfb')](db['SugarcrmAccount'],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x96')]['hasMany'](db[_0xd812('0x96')],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0x96')][_0xd812('0xf3')](db[_0xd812('0x96')],{'as':_0xd812('0x198'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x96')]['hasMany'](db['SugarcrmField'],{'as':'Field','foreignKey':_0xd812('0x19b')});db[_0xd812('0x96')][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':_0xd812('0x19c')});db[_0xd812('0x98')]['hasMany'](db[_0xd812('0x9a')],{'as':_0xd812('0x192'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x9a')][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':_0xd812('0x194'),'onDelete':'cascade','foreignKey':'SubjectId'});db['DeskConfiguration'][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':_0xd812('0x19a'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x9a')][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':_0xd812('0x18f'),'onDelete':_0xd812('0xef'),'foreignKey':'FieldId'});db[_0xd812('0x9a')][_0xd812('0xfb')](db[_0xd812('0x98')],{'as':'Account','foreignKey':'AccountId'});db['DeskConfiguration'][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':'int_desk_configuration_has_tags'});db[_0xd812('0x19d')][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0x19d')][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':_0xd812('0x198'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x19d')][_0xd812('0xf3')](db[_0xd812('0x19d')],{'as':'Field','foreignKey':'FieldId'});db['DeskField'][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':_0xd812('0x19c')});db[_0xd812('0x19e')]['hasMany'](db[_0xd812('0x9c')],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db['ZohoConfiguration'][_0xd812('0xf3')](db['ZohoField'],{'as':_0xd812('0x194'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x195')});db[_0xd812('0x9c')]['hasMany'](db[_0xd812('0x9e')],{'as':_0xd812('0x19a'),'onDelete':_0xd812('0xef'),'foreignKey':'DescriptionId'});db[_0xd812('0x9c')][_0xd812('0xf3')](db['ZohoField'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xd812('0x19b')});db[_0xd812('0x9c')]['belongsTo'](db[_0xd812('0x19e')],{'as':'Account','foreignKey':_0xd812('0x193')});db[_0xd812('0x9e')][_0xd812('0xf3')](db[_0xd812('0x9e')],{'as':'Subject','foreignKey':_0xd812('0x195')});db['ZohoField']['hasMany'](db[_0xd812('0x9e')],{'as':_0xd812('0x198'),'foreignKey':_0xd812('0x196')});db[_0xd812('0x9e')]['hasMany'](db['ZohoField'],{'as':_0xd812('0x199'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0x9e')][_0xd812('0xfb')](db['Variable'],{'as':'Variable','foreignKey':_0xd812('0x19c')});db['ZendeskAccount'][_0xd812('0xf3')](db[_0xd812('0xa1')],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':'AccountId'});db[_0xd812('0xa1')][_0xd812('0xf3')](db[_0xd812('0x19f')],{'as':_0xd812('0x194'),'foreignKey':_0xd812('0x195')});db[_0xd812('0xa1')][_0xd812('0xf3')](db[_0xd812('0x19f')],{'as':_0xd812('0x19a'),'foreignKey':_0xd812('0x196')});db['ZendeskConfiguration']['hasMany'](db[_0xd812('0x19f')],{'as':_0xd812('0x18f'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0xa1')][_0xd812('0xfb')](db[_0xd812('0xa0')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0xa1')][_0xd812('0xfd')](db['Tag'],{'through':_0xd812('0x1a0')});db[_0xd812('0x19f')][_0xd812('0xf3')](db[_0xd812('0x19f')],{'as':'Subject','foreignKey':_0xd812('0x195')});db[_0xd812('0x19f')]['hasMany'](db[_0xd812('0x19f')],{'as':'Description','foreignKey':_0xd812('0x196')});db[_0xd812('0x19f')]['hasMany'](db[_0xd812('0x19f')],{'as':_0xd812('0x199'),'foreignKey':'FieldId'});db[_0xd812('0x19f')]['belongsTo'](db['Variable'],{'as':_0xd812('0x82'),'foreignKey':_0xd812('0x19c')});db[_0xd812('0xa4')][_0xd812('0xf3')](db[_0xd812('0xa6')],{'as':'Configurations','onDelete':'cascade','foreignKey':_0xd812('0x193')});db['FreshdeskConfiguration'][_0xd812('0xf3')](db['FreshdeskField'],{'as':_0xd812('0x194'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x195')});db[_0xd812('0xa6')][_0xd812('0xf3')](db[_0xd812('0xa8')],{'as':_0xd812('0x19a'),'onDelete':_0xd812('0xef'),'foreignKey':'DescriptionId'});db[_0xd812('0xa6')][_0xd812('0xf3')](db[_0xd812('0xa8')],{'as':_0xd812('0x18f'),'onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0xa6')]['belongsTo'](db[_0xd812('0xa4')],{'as':_0xd812('0x149'),'foreignKey':'AccountId'});db[_0xd812('0xa6')][_0xd812('0xfd')](db[_0xd812('0x143')],{'through':_0xd812('0x1a1')});db['FreshdeskField']['hasMany'](db['FreshdeskField'],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0xa8')][_0xd812('0xf3')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db[_0xd812('0xa8')][_0xd812('0xf3')](db[_0xd812('0xa8')],{'as':_0xd812('0x199'),'foreignKey':'FieldId'});db[_0xd812('0xa8')]['belongsTo'](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':_0xd812('0x19c')});db[_0xd812('0xaa')]['hasMany'](db[_0xd812('0xac')],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db[_0xd812('0xac')]['hasMany'](db[_0xd812('0x1a2')],{'as':'Subjects','foreignKey':_0xd812('0x195')});db[_0xd812('0xac')]['hasMany'](db[_0xd812('0x1a2')],{'as':_0xd812('0x19a'),'foreignKey':'DescriptionId'});db[_0xd812('0xac')]['hasMany'](db['VtigerField'],{'as':_0xd812('0x18f'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0xac')][_0xd812('0xfb')](db[_0xd812('0xaa')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x1a2')][_0xd812('0xf3')](db[_0xd812('0x1a2')],{'as':'Subject','foreignKey':_0xd812('0x195')});db[_0xd812('0x1a2')]['hasMany'](db[_0xd812('0x1a2')],{'as':_0xd812('0x198'),'foreignKey':'DescriptionId'});db[_0xd812('0x1a2')][_0xd812('0xf3')](db[_0xd812('0x1a2')],{'as':'Field','foreignKey':_0xd812('0x19b')});db['VtigerField']['belongsTo'](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':'VariableId'});db[_0xd812('0xaf')][_0xd812('0xf3')](db[_0xd812('0xb0')],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db['ServicenowConfiguration'][_0xd812('0xf3')](db[_0xd812('0xb2')],{'as':_0xd812('0x194'),'foreignKey':_0xd812('0x195')});db['ServicenowConfiguration']['hasMany'](db[_0xd812('0xb2')],{'as':_0xd812('0x19a'),'foreignKey':_0xd812('0x196')});db[_0xd812('0xb0')][_0xd812('0xf3')](db[_0xd812('0xb2')],{'as':'Fields','foreignKey':'FieldId'});db['ServicenowConfiguration'][_0xd812('0xfb')](db[_0xd812('0xaf')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0xb2')][_0xd812('0xf3')](db['ServicenowField'],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0xb2')]['hasMany'](db[_0xd812('0xb2')],{'as':_0xd812('0x198'),'foreignKey':_0xd812('0x196')});db[_0xd812('0xb2')][_0xd812('0xf3')](db[_0xd812('0xb2')],{'as':'Field','foreignKey':_0xd812('0x19b')});db['ServicenowField'][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':'VariableId'});db['Dynamics365Account'][_0xd812('0xf3')](db['Dynamics365Configuration'],{'as':'Configurations','onDelete':_0xd812('0xef'),'foreignKey':_0xd812('0x193')});db[_0xd812('0xb6')][_0xd812('0xf3')](db[_0xd812('0x1a3')],{'as':_0xd812('0x194'),'onDelete':_0xd812('0xef'),'foreignKey':'SubjectId'});db['Dynamics365Configuration']['hasMany'](db['Dynamics365Field'],{'as':'Descriptions','onDelete':_0xd812('0xef'),'foreignKey':'DescriptionId'});db[_0xd812('0xb6')][_0xd812('0xf3')](db['Dynamics365Field'],{'as':_0xd812('0x18f'),'onDelete':'cascade','foreignKey':_0xd812('0x19b')});db[_0xd812('0xb6')][_0xd812('0xfb')](db[_0xd812('0xb4')],{'as':_0xd812('0x149'),'foreignKey':_0xd812('0x193')});db[_0xd812('0x1a3')][_0xd812('0xf3')](db['Dynamics365Field'],{'as':'Subject','foreignKey':_0xd812('0x195')});db[_0xd812('0x1a3')][_0xd812('0xf3')](db[_0xd812('0x1a3')],{'as':'Description','foreignKey':_0xd812('0x196')});db[_0xd812('0x1a3')][_0xd812('0xf3')](db[_0xd812('0x1a3')],{'as':_0xd812('0x199'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0x1a3')][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':'Variable','foreignKey':_0xd812('0x19c')});db[_0xd812('0xb9')]['hasMany'](db[_0xd812('0x1a4')],{'as':_0xd812('0x192'),'onDelete':'cascade','foreignKey':_0xd812('0x193')});db[_0xd812('0x1a4')]['hasMany'](db['FreshsalesField'],{'as':_0xd812('0x194'),'foreignKey':'SubjectId'});db['FreshsalesConfiguration'][_0xd812('0xf3')](db[_0xd812('0xbc')],{'as':'Descriptions','foreignKey':_0xd812('0x196')});db[_0xd812('0x1a4')]['hasMany'](db['FreshsalesField'],{'as':_0xd812('0x18f'),'foreignKey':_0xd812('0x19b')});db[_0xd812('0x1a4')]['belongsTo'](db[_0xd812('0xb9')],{'as':'Account','foreignKey':_0xd812('0x193')});db['FreshsalesField'][_0xd812('0xf3')](db[_0xd812('0xbc')],{'as':_0xd812('0x197'),'foreignKey':_0xd812('0x195')});db[_0xd812('0xbc')][_0xd812('0xf3')](db[_0xd812('0xbc')],{'as':'Description','foreignKey':_0xd812('0x196')});db['FreshsalesField'][_0xd812('0xf3')](db[_0xd812('0xbc')],{'as':_0xd812('0x199'),'foreignKey':'FieldId'});db[_0xd812('0xbc')][_0xd812('0xfb')](db[_0xd812('0x82')],{'as':_0xd812('0x82'),'foreignKey':'VariableId'});db[_0xd812('0xc0')]['belongsTo'](db['ChatWebsite'],{});db[_0xd812('0xc0')]['belongsTo'](db['CmList'],{'as':_0xd812('0x13b'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0xc0')]['belongsTo'](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0xc0')][_0xd812('0xfb')](db[_0xd812('0x59')],{});db[_0xd812('0xc0')][_0xd812('0xfb')](db[_0xd812('0x16a')],{});db[_0xd812('0xc0')][_0xd812('0xfb')](db[_0xd812('0x12')],{});db[_0xd812('0xc0')]['belongsTo'](db[_0xd812('0x5d')],{});db[_0xd812('0xc2')]['belongsTo'](db[_0xd812('0x12')],{'onDelete':'cascade','foreignKey':_0xd812('0x1a5')});db[_0xd812('0xc2')][_0xd812('0xfb')](db[_0xd812('0x12')],{'onDelete':'cascade','foreignKey':_0xd812('0x1a6')});db['JscriptySessionReport'][_0xd812('0xf3')](db['JscriptyQuestionReport'],{'foreignKey':_0xd812('0x1a7'),'onDelete':_0xd812('0xef')});db[_0xd812('0xc8')][_0xd812('0xf3')](db[_0xd812('0xc4')],{'foreignKey':_0xd812('0x1a7'),'onDelete':_0xd812('0xef')});db[_0xd812('0xca')][_0xd812('0xfb')](db[_0xd812('0x4a')],{});db[_0xd812('0xca')][_0xd812('0xfb')](db[_0xd812('0xe5')],{'as':_0xd812('0x13b'),'foreignKey':'ListId'});db[_0xd812('0xca')][_0xd812('0xfb')](db[_0xd812('0x62')],{'as':_0xd812('0x141'),'foreignKey':_0xd812('0x135')});db[_0xd812('0xca')][_0xd812('0xfb')](db[_0xd812('0x4d')],{});db[_0xd812('0xca')]['belongsTo'](db[_0xd812('0x158')],{});db[_0xd812('0xca')][_0xd812('0xfb')](db['User'],{});db['SmsQueueReport'][_0xd812('0xfb')](db[_0xd812('0x15d')],{});db[_0xd812('0x1a8')][_0xd812('0xf3')](db[_0xd812('0xc8')],{'foreignKey':_0xd812('0x1a9')});db[_0xd812('0x1a8')][_0xd812('0xf3')](db[_0xd812('0xc6')],{'foreignKey':_0xd812('0x1a9')});db[_0xd812('0x1a8')]['hasMany'](db[_0xd812('0xc4')],{'foreignKey':_0xd812('0x1a9')});db['SquareProject']['belongsToMany'](db['User'],{'as':_0xd812('0x145'),'through':_0xd812('0x11b')});db[_0xd812('0xd6')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':'Agents','through':'user_has_teams'});db[_0xd812('0xd6')][_0xd812('0xfd')](db[_0xd812('0x1a')],{'through':_0xd812('0x1aa'),'as':_0xd812('0x108')});db[_0xd812('0xd6')][_0xd812('0xfd')](db[_0xd812('0x33')],{'through':_0xd812('0x13e'),'as':_0xd812('0x109')});db['Team'][_0xd812('0xfd')](db['ChatQueue'],{'through':_0xd812('0x171'),'as':_0xd812('0x1ab')});db[_0xd812('0xd6')]['belongsToMany'](db[_0xd812('0x150')],{'through':_0xd812('0x1ac'),'as':_0xd812('0x10c')});db[_0xd812('0xd6')]['belongsToMany'](db[_0xd812('0x15d')],{'through':'team_has_sms_queues','as':'SmsQueues'});db['Team'][_0xd812('0xfd')](db['OpenchannelQueue'],{'through':'team_has_openchannel_queues','as':'OpenchannelQueues'});db[_0xd812('0xda')][_0xd812('0xf3')](db[_0xd812('0x64')],{'as':_0xd812('0x122'),'foreignKey':_0xd812('0x179')});db[_0xd812('0xda')][_0xd812('0xf3')](db[_0xd812('0x68')],{'as':_0xd812('0xf7'),'foreignKey':_0xd812('0x179')});db[_0xd812('0xda')][_0xd812('0xf3')](db[_0xd812('0x6a')],{'as':_0xd812('0x124'),'foreignKey':'CampaignId'});db[_0xd812('0xda')][_0xd812('0xf3')](db[_0xd812('0x66')],{'as':'HopperBlacks','foreignKey':_0xd812('0x179')});db[_0xd812('0xda')]['belongsTo'](db[_0xd812('0x25')],{'as':_0xd812('0x25'),'foreignKey':_0xd812('0x1ad')});db[_0xd812('0xda')]['belongsTo'](db[_0xd812('0x25')],{'as':_0xd812('0x127'),'foreignKey':_0xd812('0x128')});db[_0xd812('0xda')]['belongsTo'](db[_0xd812('0x74')],{'as':_0xd812('0x74'),'foreignKey':'IntervalId'});db[_0xd812('0xda')][_0xd812('0xfb')](db[_0xd812('0xd1')],{'as':_0xd812('0xd1'),'foreignKey':_0xd812('0x1ae')});db[_0xd812('0xda')][_0xd812('0xfd')](db['CmList'],{'as':_0xd812('0x101'),'through':'campaigns_has_cm_lists'});db[_0xd812('0xda')][_0xd812('0xfd')](db[_0xd812('0xe5')],{'as':'BlackLists','through':_0xd812('0x1af')});db['MailTransferReport'][_0xd812('0xfb')](db['MailMessage'],{});db[_0xd812('0xde')][_0xd812('0xfb')](db[_0xd812('0x37')],{});db[_0xd812('0xde')][_0xd812('0xfb')](db['MailAccount'],{'foreignKey':_0xd812('0x1b0'),'as':_0xd812('0x1b1')});db[_0xd812('0xde')][_0xd812('0xfb')](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b2'),'as':_0xd812('0x1b3')});db['MailTransferReport'][_0xd812('0xfb')](db['User'],{'foreignKey':_0xd812('0x1b4'),'as':'ToAgent'});db[_0xd812('0xde')]['belongsTo'](db[_0xd812('0x33')],{'foreignKey':_0xd812('0x1b5'),'as':_0xd812('0x1b6')});db[_0xd812('0xde')][_0xd812('0xfb')](db[_0xd812('0x31')],{'foreignKey':_0xd812('0x1b7'),'as':_0xd812('0x1b8')});db[_0xd812('0xe0')][_0xd812('0xfb')](db[_0xd812('0x16a')],{});db[_0xd812('0xe0')][_0xd812('0xfb')](db[_0xd812('0x59')],{});db['ChatTransferReport'][_0xd812('0xfb')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0xd812('0x1b1')});db[_0xd812('0xe0')]['belongsTo'](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b2'),'as':_0xd812('0x1b3')});db['ChatTransferReport'][_0xd812('0xfb')](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b4'),'as':_0xd812('0x1b9')});db['ChatTransferReport'][_0xd812('0xfb')](db[_0xd812('0x5d')],{'foreignKey':_0xd812('0x1ba'),'as':_0xd812('0x1b6')});db['ChatTransferReport'][_0xd812('0xfb')](db['ChatWebsite'],{'foreignKey':_0xd812('0x1bb'),'as':'ToAccount'});db[_0xd812('0xe1')][_0xd812('0xfb')](db[_0xd812('0x47')],{});db[_0xd812('0xe1')][_0xd812('0xfb')](db[_0xd812('0x45')],{});db[_0xd812('0xe1')][_0xd812('0xfb')](db['FaxAccount'],{'foreignKey':_0xd812('0x1bc'),'as':'FromAccount'});db[_0xd812('0xe1')][_0xd812('0xfb')](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b2'),'as':_0xd812('0x1b3')});db[_0xd812('0xe1')][_0xd812('0xfb')](db['User'],{'foreignKey':_0xd812('0x1b4'),'as':'ToAgent'});db[_0xd812('0xe1')][_0xd812('0xfb')](db['FaxQueue'],{'foreignKey':_0xd812('0x1bd'),'as':_0xd812('0x1b6')});db[_0xd812('0xe1')][_0xd812('0xfb')](db[_0xd812('0x42')],{'foreignKey':'ToFaxAccountId','as':'ToAccount'});db[_0xd812('0x1be')]['belongsTo'](db[_0xd812('0x54')],{});db[_0xd812('0x1be')][_0xd812('0xfb')](db[_0xd812('0x52')],{});db['OpenchannelTransferReport'][_0xd812('0xfb')](db[_0xd812('0x116')],{'foreignKey':_0xd812('0x1bf'),'as':_0xd812('0x1b1')});db['OpenchannelTransferReport']['belongsTo'](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b2'),'as':_0xd812('0x1b3')});db[_0xd812('0x1be')][_0xd812('0xfb')](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b4'),'as':_0xd812('0x1b9')});db[_0xd812('0x1be')][_0xd812('0xfb')](db[_0xd812('0x56')],{'foreignKey':_0xd812('0x1c0'),'as':_0xd812('0x1b6')});db[_0xd812('0x1be')][_0xd812('0xfb')](db[_0xd812('0x116')],{'foreignKey':_0xd812('0x1c1'),'as':_0xd812('0x1b8')});db[_0xd812('0xe4')][_0xd812('0xfb')](db[_0xd812('0x158')],{});db[_0xd812('0xe4')][_0xd812('0xfb')](db[_0xd812('0x4d')],{});db['SmsTransferReport']['belongsTo'](db[_0xd812('0x4a')],{'foreignKey':_0xd812('0x1c2'),'as':_0xd812('0x1b1')});db['SmsTransferReport']['belongsTo'](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b2'),'as':_0xd812('0x1b3')});db[_0xd812('0xe4')][_0xd812('0xfb')](db[_0xd812('0x12')],{'foreignKey':_0xd812('0x1b4'),'as':_0xd812('0x1b9')});db[_0xd812('0xe4')][_0xd812('0xfb')](db[_0xd812('0x15d')],{'foreignKey':_0xd812('0x1c3'),'as':_0xd812('0x1b6')});db[_0xd812('0xe4')][_0xd812('0xfb')](db[_0xd812('0x4a')],{'foreignKey':_0xd812('0x1c4'),'as':'ToAccount'});db[_0xd812('0xe5')][_0xd812('0xf3')](db[_0xd812('0x70')],{'as':_0xd812('0x138'),'foreignKey':'ListId'});db['CmList'][_0xd812('0xf3')](db[_0xd812('0x1c5')],{'as':_0xd812('0x1c6'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0xe5')][_0xd812('0xf3')](db[_0xd812('0x62')],{'as':_0xd812('0xff'),'onDelete':'cascade','foreignKey':_0xd812('0x13c')});db[_0xd812('0xe5')][_0xd812('0xf3')](db['CmHopperFinal'],{'as':_0xd812('0xf7'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0xe5')][_0xd812('0xf3')](db[_0xd812('0x6a')],{'as':_0xd812('0xf8'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0xe5')][_0xd812('0xf3')](db[_0xd812('0x6c')],{'as':_0xd812('0x6c'),'foreignKey':_0xd812('0x13c')});db[_0xd812('0xe5')]['belongsToMany'](db[_0xd812('0x1a')],{'as':'Queues','through':_0xd812('0x12b')});db[_0xd812('0xe5')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x1c7')});db[_0xd812('0xe7')][_0xd812('0xf3')](db[_0xd812('0x18')],{'as':_0xd812('0xf6'),'onDelete':_0xd812('0x14a')});db[_0xd812('0xe7')][_0xd812('0xfd')](db[_0xd812('0x12')],{'as':_0xd812('0x12c'),'through':_0xd812('0x111')});db['UserProfile']['hasMany'](db[_0xd812('0x12')],{'as':_0xd812('0x145'),'foreignKey':_0xd812('0x1c8')});db['UserProfile'][_0xd812('0xf3')](db[_0xd812('0xea')],{'as':_0xd812('0x1c9'),'foreignKey':'userProfileId','onDelete':_0xd812('0xef')});db['UserProfileSection']['hasMany'](db[_0xd812('0xec')],{'as':_0xd812('0x1ca'),'foreignKey':'sectionId','onDelete':_0xd812('0xef')});module[_0xd812('0x1cb')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index f9c2876..bac57d8 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbc21=['./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','./api/authGoogle','/api/jira','/api/rpc','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','static','join','/www','root','/demo','/snippet','snippet','1.0.16','/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','express-winston','./errors','./config/environment','./config/logger','api','default','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','user','name','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','format','url','statusCode','responseTime','other','agent_name','test','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','/api/voice/extensions','./api/voiceExtension','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','./api/faxAccount','/api/fax/applications','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','./api/faxQueueReport','/api/sms/accounts','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','./api/openchannelAccount','/api/openchannel/applications','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmCustomField','./api/action','/api/automations','./api/automation','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','/api/pauses','./api/pause','/api/cdr','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','./api/variable','/api/integrations','/api/integrations/reports','/api/analytics/default_reports','./api/analyticDefaultReport','/api/analytics/extracted_reports','/api/analytics/field_reports','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/accounts','./api/intFreshdeskAccount','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','./api/intFreshdeskField','/api/integrations/vtiger/accounts','./api/intVtigerAccount','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/freshsales/accounts','/api/integrations/freshsales/configurations','/api/integrations/freshsales/fields','/api/networks','./api/network','./api/chatQueueReport','/api/chat/internal/messages','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','/api/square/odbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/campaign','./api/migration','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer'];(function(_0xc394ee,_0x2ab576){var _0x3a6c16=function(_0x66e0ee){while(--_0x66e0ee){_0xc394ee['push'](_0xc394ee['shift']());}};_0x3a6c16(++_0x2ab576);}(_0xbc21,0x137));var _0x1bc2=function(_0x36e9bd,_0x3df63f){_0x36e9bd=_0x36e9bd-0x0;var _0x2b7cda=_0xbc21[_0x36e9bd];return _0x2b7cda;};'use strict';var path=require(_0x1bc2('0x0'));var express=require(_0x1bc2('0x1'));var ewinston=require(_0x1bc2('0x2'));var util=require('util');var errors=require(_0x1bc2('0x3'));var config=require(_0x1bc2('0x4'));var logger=require(_0x1bc2('0x5'))(_0x1bc2('0x6'));var authLogger=require(_0x1bc2('0x5'))('auth');exports[_0x1bc2('0x7')]=function(_0x4910ed){_0x4910ed[_0x1bc2('0x8')](ewinston['logger']({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x3a9afe,_0xfe18d7){return util['format'](_0x1bc2('0x9'),_0x3a9afe[_0x1bc2('0xa')],_0x3a9afe[_0x1bc2('0xb')]['x-forwarded-for']?_0x3a9afe['headers'][_0x1bc2('0xc')]:_0x3a9afe[_0x1bc2('0xd')][_0x1bc2('0xe')]||_0x3a9afe['ip'],_0x3a9afe['url'],_0xfe18d7['statusCode'],_0xfe18d7['responseTime'],_0x3a9afe['user']?_0x3a9afe[_0x1bc2('0xf')]['id']:null,_0x3a9afe[_0x1bc2('0xf')]?_0x3a9afe[_0x1bc2('0xf')][_0x1bc2('0x10')]:null,_0x3a9afe[_0x1bc2('0xf')]?_0x3a9afe[_0x1bc2('0xf')]['role']:null);}}));_0x4910ed[_0x1bc2('0x8')](ewinston[_0x1bc2('0x11')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x15ec84,_0x39b297){var _0x384188=_0x1bc2('0x12');if(_0x15ec84[_0x1bc2('0x13')]&&_0x15ec84[_0x1bc2('0x13')][_0x1bc2('0x14')]&&_0x15ec84[_0x1bc2('0x13')][_0x1bc2('0x15')]){_0x384188=_0x1bc2('0x16');}return util[_0x1bc2('0x17')](_0x384188,_0x15ec84['method'],_0x15ec84[_0x1bc2('0xb')][_0x1bc2('0xc')]?_0x15ec84[_0x1bc2('0xb')][_0x1bc2('0xc')]:_0x15ec84['connection'][_0x1bc2('0xe')]||_0x15ec84['ip'],_0x15ec84[_0x1bc2('0x18')],_0x39b297[_0x1bc2('0x19')],_0x39b297[_0x1bc2('0x1a')],_0x15ec84[_0x1bc2('0xf')]?_0x15ec84[_0x1bc2('0xf')]['id']:null,_0x15ec84[_0x1bc2('0xf')]?_0x15ec84[_0x1bc2('0xf')]['name']:null,_0x15ec84[_0x1bc2('0xf')]?_0x15ec84[_0x1bc2('0xf')]['role']:null,_0x15ec84['body']&&_0x15ec84['body'][_0x1bc2('0x14')]?_0x15ec84[_0x1bc2('0x13')]['device']:_0x1bc2('0x1b'),_0x15ec84[_0x1bc2('0x13')]&&_0x15ec84[_0x1bc2('0x13')][_0x1bc2('0x15')]?_0x15ec84[_0x1bc2('0x13')]['agent_id']:'',_0x15ec84[_0x1bc2('0x13')]&&_0x15ec84[_0x1bc2('0x13')][_0x1bc2('0x1c')]?_0x15ec84[_0x1bc2('0x13')][_0x1bc2('0x1c')]:'');},'ignoreRoute':function(_0x2f0bf8){var _0x247a98=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x247a98[_0x1bc2('0x1d')](_0x2f0bf8[_0x1bc2('0x18')]);}}));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x1e'),require(_0x1bc2('0x1f')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x20'),require(_0x1bc2('0x21')));_0x4910ed['use'](_0x1bc2('0x22'),require('./api/voiceContext'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x23'),require(_0x1bc2('0x24')));_0x4910ed[_0x1bc2('0x8')]('/api/voice/mohs',require(_0x1bc2('0x25')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x26'),require(_0x1bc2('0x27')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x28'),require(_0x1bc2('0x29')));_0x4910ed['use']('/api/screen/recordings',require(_0x1bc2('0x2a')));_0x4910ed['use'](_0x1bc2('0x2b'),require(_0x1bc2('0x2c')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x2d'),require('./api/voiceMailMessage'));_0x4910ed['use'](_0x1bc2('0x2e'),require(_0x1bc2('0x2f')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x30'),require(_0x1bc2('0x31')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x32'),require('./api/voiceAgentReport'));_0x4910ed[_0x1bc2('0x8')]('/api/voice/queues/reports',require(_0x1bc2('0x33')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x34'),require(_0x1bc2('0x35')));_0x4910ed['use'](_0x1bc2('0x36'),require(_0x1bc2('0x37')));_0x4910ed[_0x1bc2('0x8')]('/api/voice/transfers/reports',require(_0x1bc2('0x38')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x39'),require(_0x1bc2('0x3a')));_0x4910ed['use'](_0x1bc2('0x3b'),require(_0x1bc2('0x3c')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x3d'),require('./api/mailQueue'));_0x4910ed['use']('/api/mail/substatuses',require(_0x1bc2('0x3e')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x3f'),require(_0x1bc2('0x40')));_0x4910ed['use']('/api/mail/messages',require(_0x1bc2('0x41')));_0x4910ed[_0x1bc2('0x8')]('/api/mail/applications',require(_0x1bc2('0x42')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x43'),require(_0x1bc2('0x44')));_0x4910ed['use'](_0x1bc2('0x45'),require(_0x1bc2('0x46')));_0x4910ed[_0x1bc2('0x8')]('/api/dashboards/items',require(_0x1bc2('0x47')));_0x4910ed['use']('/api/fax/accounts',require(_0x1bc2('0x48')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x49'),require('./api/faxApplication'));_0x4910ed['use'](_0x1bc2('0x4a'),require(_0x1bc2('0x4b')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x4c'),require(_0x1bc2('0x4d')));_0x4910ed['use'](_0x1bc2('0x4e'),require(_0x1bc2('0x4f')));_0x4910ed[_0x1bc2('0x8')]('/api/fax/reports/queue',require(_0x1bc2('0x50')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x51'),require(_0x1bc2('0x52')));_0x4910ed['use'](_0x1bc2('0x53'),require(_0x1bc2('0x54')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x55'),require(_0x1bc2('0x56')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x57'),require('./api/smsMessage'));_0x4910ed[_0x1bc2('0x8')]('/api/sms/queues',require(_0x1bc2('0x58')));_0x4910ed['use']('/api/openchannel/accounts',require(_0x1bc2('0x59')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x5a'),require('./api/openchannelApplication'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x5b'),require(_0x1bc2('0x5c')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x5d'),require('./api/openchannelMessage'));_0x4910ed[_0x1bc2('0x8')]('/api/openchannel/queues',require(_0x1bc2('0x5e')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x5f'),require('./api/chatWebsite'));_0x4910ed['use'](_0x1bc2('0x60'),require('./api/openchannelQueueReport'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x61'),require(_0x1bc2('0x62')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x63'),require('./api/chatInteraction'));_0x4910ed[_0x1bc2('0x8')]('/api/chat/messages',require(_0x1bc2('0x64')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x65'),require('./api/chatOfflineMessage'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x66'),require(_0x1bc2('0x67')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x68'),require(_0x1bc2('0x69')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x6a'),require(_0x1bc2('0x6b')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x6c'),require(_0x1bc2('0x6d')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x6e'),require('./api/cmContact'));_0x4910ed['use'](_0x1bc2('0x6f'),require('./api/cmHopper'));_0x4910ed['use'](_0x1bc2('0x70'),require(_0x1bc2('0x71')));_0x4910ed['use']('/api/cm/hopper_final',require(_0x1bc2('0x72')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x73'),require('./api/cmHopperHistory'));_0x4910ed[_0x1bc2('0x8')]('/api/cm/custom_fields',require(_0x1bc2('0x74')));_0x4910ed[_0x1bc2('0x8')]('/api/actions',require(_0x1bc2('0x75')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x76'),require(_0x1bc2('0x77')));_0x4910ed[_0x1bc2('0x8')]('/api/canned_answers',require(_0x1bc2('0x78')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x79'),require(_0x1bc2('0x7a')));_0x4910ed['use'](_0x1bc2('0x7b'),require(_0x1bc2('0x7c')));_0x4910ed[_0x1bc2('0x8')]('/api/intervals',require('./api/interval'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x7d'),require(_0x1bc2('0x7e')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x7f'),require(_0x1bc2('0x80')));_0x4910ed['use'](_0x1bc2('0x81'),require(_0x1bc2('0x82')));_0x4910ed['use'](_0x1bc2('0x83'),require(_0x1bc2('0x84')));_0x4910ed['use'](_0x1bc2('0x85'),require(_0x1bc2('0x86')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x87'),require(_0x1bc2('0x88')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x89'),require(_0x1bc2('0x8a')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x8b'),require('./api/trigger'));_0x4910ed[_0x1bc2('0x8')]('/api/variables',require(_0x1bc2('0x8c')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x8d'),require('./api/integration'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x8e'),require('./api/integrationReport'));_0x4910ed[_0x1bc2('0x8')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x8f'),require(_0x1bc2('0x90')));_0x4910ed['use'](_0x1bc2('0x91'),require('./api/analyticExtractedReport'));_0x4910ed[_0x1bc2('0x8')]('/api/analytics/metrics',require('./api/analyticMetric'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x92'),require(_0x1bc2('0x93')));_0x4910ed[_0x1bc2('0x8')]('/api/analytics/tree_reports',require(_0x1bc2('0x94')));_0x4910ed['use'](_0x1bc2('0x95'),require('./api/intSalesforceAccount'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x96'),require('./api/intSalesforceConfiguration'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x97'),require('./api/intSalesforceField'));_0x4910ed[_0x1bc2('0x8')]('/api/integrations/sugarcrm/accounts',require(_0x1bc2('0x98')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x99'),require('./api/intSugarcrmConfiguration'));_0x4910ed[_0x1bc2('0x8')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x4910ed['use']('/api/integrations/desk/accounts',require(_0x1bc2('0x9a')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x9b'),require(_0x1bc2('0x9c')));_0x4910ed[_0x1bc2('0x8')]('/api/integrations/desk/fields',require(_0x1bc2('0x9d')));_0x4910ed['use'](_0x1bc2('0x9e'),require(_0x1bc2('0x9f')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xa0'),require(_0x1bc2('0xa1')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xa2'),require('./api/intZohoField'));_0x4910ed[_0x1bc2('0x8')]('/api/integrations/zendesk/accounts',require(_0x1bc2('0xa3')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xa4'),require(_0x1bc2('0xa5')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xa6'),require(_0x1bc2('0xa7')));_0x4910ed['use'](_0x1bc2('0xa8'),require(_0x1bc2('0xa9')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xaa'),require(_0x1bc2('0xab')));_0x4910ed['use']('/api/integrations/freshdesk/fields',require(_0x1bc2('0xac')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xad'),require(_0x1bc2('0xae')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xaf'),require(_0x1bc2('0xb0')));_0x4910ed['use']('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x4910ed['use'](_0x1bc2('0xb1'),require(_0x1bc2('0xb2')));_0x4910ed['use'](_0x1bc2('0xb3'),require(_0x1bc2('0xb4')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xb5'),require('./api/intServicenowField'));_0x4910ed['use']('/api/integrations/dynamics365/accounts',require(_0x1bc2('0xb6')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xb7'),require(_0x1bc2('0xb8')));_0x4910ed[_0x1bc2('0x8')]('/api/integrations/dynamics365/fields',require('./api/intDynamics365Field'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xb9'),require('./api/intFreshsalesAccount'));_0x4910ed['use'](_0x1bc2('0xba'),require('./api/intFreshsalesConfiguration'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xbb'),require('./api/intFreshsalesField'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xbc'),require(_0x1bc2('0xbd')));_0x4910ed['use']('/api/chat/reports/queue',require(_0x1bc2('0xbe')));_0x4910ed['use'](_0x1bc2('0xbf'),require('./api/chatInternalMessage'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xc0'),require(_0x1bc2('0xc1')));_0x4910ed['use'](_0x1bc2('0xc2'),require(_0x1bc2('0xc3')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xc4'),require(_0x1bc2('0xc5')));_0x4910ed['use'](_0x1bc2('0xc6'),require('./api/smsQueueReport'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xc7'),require(_0x1bc2('0xc8')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xc9'),require('./api/squareReportDetail'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xca'),require(_0x1bc2('0xcb')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xcc'),require(_0x1bc2('0xcd')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xce'),require('./api/squareOdbc'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xcf'),require(_0x1bc2('0xd0')));_0x4910ed[_0x1bc2('0x8')]('/api/square/recordings',require(_0x1bc2('0xd1')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xd2'),require(_0x1bc2('0xd3')));_0x4910ed['use'](_0x1bc2('0xd4'),require(_0x1bc2('0xd5')));_0x4910ed['use'](_0x1bc2('0xd6'),require('./api/license'));_0x4910ed[_0x1bc2('0x8')]('/api/campaigns',require(_0x1bc2('0xd7')));_0x4910ed['use']('/api/migrations',require(_0x1bc2('0xd8')));_0x4910ed['use']('/api/attachments',require(_0x1bc2('0xd9')));_0x4910ed['use'](_0x1bc2('0xda'),require(_0x1bc2('0xdb')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xdc'),require(_0x1bc2('0xdd')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xde'),require(_0x1bc2('0xdf')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xe0'),require(_0x1bc2('0xe1')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xe2'),require('./api/openchannelTransferReport'));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xe3'),require(_0x1bc2('0xe4')));_0x4910ed[_0x1bc2('0x8')]('/api/cm/lists',require(_0x1bc2('0xe5')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xe6'),require(_0x1bc2('0xe7')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xe8'),require(_0x1bc2('0xe9')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xea'),require(_0x1bc2('0xeb')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xec'),require(_0x1bc2('0xed')));_0x4910ed['use'](_0x1bc2('0xee'),require(_0x1bc2('0xef')));_0x4910ed['use']('/api/auth/google',require(_0x1bc2('0xf0')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xf1'),require('./api/jira'));_0x4910ed['use'](_0x1bc2('0xf2'),require(_0x1bc2('0xf3')));_0x4910ed['use'](_0x1bc2('0xf4'),require(_0x1bc2('0xf5')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xf6'),require(_0x1bc2('0xf7')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xf8'),require(_0x1bc2('0xf9')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xfa'),express[_0x1bc2('0xfb')](path[_0x1bc2('0xfc')](config['root'],'/apidoc')));_0x4910ed['use'](_0x1bc2('0xfd'),express['static'](path[_0x1bc2('0xfc')](config[_0x1bc2('0xfe')],'/www')));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0xff'),express[_0x1bc2('0xfb')](path['join'](config[_0x1bc2('0xfe')],_0x1bc2('0xff'))));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x100'),express[_0x1bc2('0xfb')](path[_0x1bc2('0xfc')](config[_0x1bc2('0xfe')],_0x1bc2('0x101'),_0x1bc2('0x102'))));_0x4910ed[_0x1bc2('0x8')](_0x1bc2('0x103'),express[_0x1bc2('0xfb')](path[_0x1bc2('0xfc')](config['root'],'/server/files/plugins')));_0x4910ed[_0x1bc2('0x104')](_0x1bc2('0x105'))['get'](errors[0x194]);_0x4910ed[_0x1bc2('0x104')]('/*')[_0x1bc2('0x106')](function(_0x579cc0,_0x22d6c0){_0x22d6c0[_0x1bc2('0x107')](path[_0x1bc2('0x108')](_0x4910ed[_0x1bc2('0x106')](_0x1bc2('0x109'))+_0x1bc2('0x10a')));});}; \ No newline at end of file +var _0x7803=['./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','./api/intSalesforceAccount','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','/api/integrations/desk/fields','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intVtigerField','/api/integrations/servicenow/accounts','./api/intServicenowAccount','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','/api/integrations/freshsales/fields','./api/intFreshsalesField','./api/network','/api/chat/reports/queue','./api/chatQueueReport','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','./api/jscriptyProject','/api/settings','/api/square/odbc','./api/squareOdbc','/api/square/recordings','/api/square/messages','./api/squareMessage','/api/teams','./api/team','/api/license','./api/license','./api/campaign','/api/migrations','/api/attachments','/api/plugins','./api/plugin','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','./api/rpc','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/apidoc','join','root','/www','static','/demo','/snippet','snippet','1.0.16','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','path','express','util','./errors','api','./config/logger','default','use','logger','format','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','method','headers','x-forwarded-for','connection','remoteAddress','statusCode','user','name','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','body','url','device','other','agent_id','agent_name','/api/users','./api/user','./api/voiceChanSpy','./api/voiceExtension','/api/voice/mohs','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/dials/reports','./api/voiceAgentReport','./api/voiceQueueReport','/api/members/reports','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','/api/mail/messages','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','/api/fax/applications','./api/faxApplication','./api/faxInteraction','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','/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/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatGroup','/api/chat/proactive_actions','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','/api/automations','./api/cannedAnswer','./api/disposition','./api/condition','/api/intervals','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/templates','./api/template','/api/triggers','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','./api/analyticDefaultReport','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics'];(function(_0x5b1093,_0x211678){var _0x34018d=function(_0x3aac95){while(--_0x3aac95){_0x5b1093['push'](_0x5b1093['shift']());}};_0x34018d(++_0x211678);}(_0x7803,0x17f));var _0x3780=function(_0xa44406,_0xe170c7){_0xa44406=_0xa44406-0x0;var _0x5291f8=_0x7803[_0xa44406];return _0x5291f8;};'use strict';var path=require(_0x3780('0x0'));var express=require(_0x3780('0x1'));var ewinston=require('express-winston');var util=require(_0x3780('0x2'));var errors=require(_0x3780('0x3'));var config=require('./config/environment');var logger=require('./config/logger')(_0x3780('0x4'));var authLogger=require(_0x3780('0x5'))('auth');exports[_0x3780('0x6')]=function(_0xb93920){_0xb93920[_0x3780('0x7')](ewinston[_0x3780('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x9168c4,_0x14f104){return util[_0x3780('0x9')](_0x3780('0xa'),_0x9168c4[_0x3780('0xb')],_0x9168c4[_0x3780('0xc')][_0x3780('0xd')]?_0x9168c4[_0x3780('0xc')]['x-forwarded-for']:_0x9168c4[_0x3780('0xe')][_0x3780('0xf')]||_0x9168c4['ip'],_0x9168c4['url'],_0x14f104[_0x3780('0x10')],_0x14f104['responseTime'],_0x9168c4[_0x3780('0x11')]?_0x9168c4['user']['id']:null,_0x9168c4[_0x3780('0x11')]?_0x9168c4['user'][_0x3780('0x12')]:null,_0x9168c4[_0x3780('0x11')]?_0x9168c4[_0x3780('0x11')][_0x3780('0x13')]:null);}}));_0xb93920[_0x3780('0x7')](ewinston[_0x3780('0x8')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x5ea7fa,_0x16c65c){var _0x25707a=_0x3780('0x14');if(_0x5ea7fa[_0x3780('0x15')]&&_0x5ea7fa[_0x3780('0x15')]['device']&&_0x5ea7fa[_0x3780('0x15')]['agent_id']){_0x25707a='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)';}return util[_0x3780('0x9')](_0x25707a,_0x5ea7fa[_0x3780('0xb')],_0x5ea7fa[_0x3780('0xc')][_0x3780('0xd')]?_0x5ea7fa[_0x3780('0xc')][_0x3780('0xd')]:_0x5ea7fa[_0x3780('0xe')][_0x3780('0xf')]||_0x5ea7fa['ip'],_0x5ea7fa[_0x3780('0x16')],_0x16c65c[_0x3780('0x10')],_0x16c65c['responseTime'],_0x5ea7fa['user']?_0x5ea7fa[_0x3780('0x11')]['id']:null,_0x5ea7fa[_0x3780('0x11')]?_0x5ea7fa['user'][_0x3780('0x12')]:null,_0x5ea7fa[_0x3780('0x11')]?_0x5ea7fa[_0x3780('0x11')][_0x3780('0x13')]:null,_0x5ea7fa[_0x3780('0x15')]&&_0x5ea7fa['body'][_0x3780('0x17')]?_0x5ea7fa[_0x3780('0x15')][_0x3780('0x17')]:_0x3780('0x18'),_0x5ea7fa['body']&&_0x5ea7fa[_0x3780('0x15')]['agent_id']?_0x5ea7fa[_0x3780('0x15')][_0x3780('0x19')]:'',_0x5ea7fa[_0x3780('0x15')]&&_0x5ea7fa[_0x3780('0x15')][_0x3780('0x1a')]?_0x5ea7fa[_0x3780('0x15')][_0x3780('0x1a')]:'');},'ignoreRoute':function(_0x1c9f5a){var _0x289a74=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x289a74['test'](_0x1c9f5a[_0x3780('0x16')]);}}));_0xb93920['use'](_0x3780('0x1b'),require(_0x3780('0x1c')));_0xb93920['use']('/api/voice/chanspy',require(_0x3780('0x1d')));_0xb93920[_0x3780('0x7')]('/api/voice/contexts',require('./api/voiceContext'));_0xb93920['use']('/api/voice/extensions',require(_0x3780('0x1e')));_0xb93920['use'](_0x3780('0x1f'),require('./api/voiceMusicOnHold'));_0xb93920[_0x3780('0x7')](_0x3780('0x20'),require(_0x3780('0x21')));_0xb93920[_0x3780('0x7')](_0x3780('0x22'),require(_0x3780('0x23')));_0xb93920['use'](_0x3780('0x24'),require(_0x3780('0x25')));_0xb93920[_0x3780('0x7')](_0x3780('0x26'),require(_0x3780('0x27')));_0xb93920['use'](_0x3780('0x28'),require(_0x3780('0x29')));_0xb93920[_0x3780('0x7')]('/api/voice/calls/reports',require('./api/voiceCallReport'));_0xb93920[_0x3780('0x7')](_0x3780('0x2a'),require('./api/voiceDialReport'));_0xb93920['use']('/api/voice/agents/reports',require(_0x3780('0x2b')));_0xb93920[_0x3780('0x7')]('/api/voice/queues/reports',require(_0x3780('0x2c')));_0xb93920[_0x3780('0x7')](_0x3780('0x2d'),require(_0x3780('0x2e')));_0xb93920[_0x3780('0x7')](_0x3780('0x2f'),require(_0x3780('0x30')));_0xb93920[_0x3780('0x7')](_0x3780('0x31'),require(_0x3780('0x32')));_0xb93920[_0x3780('0x7')](_0x3780('0x33'),require(_0x3780('0x34')));_0xb93920[_0x3780('0x7')]('/api/mail/accounts',require(_0x3780('0x35')));_0xb93920['use'](_0x3780('0x36'),require(_0x3780('0x37')));_0xb93920['use'](_0x3780('0x38'),require(_0x3780('0x39')));_0xb93920[_0x3780('0x7')](_0x3780('0x3a'),require('./api/mailInteraction'));_0xb93920['use'](_0x3780('0x3b'),require('./api/mailMessage'));_0xb93920['use'](_0x3780('0x3c'),require(_0x3780('0x3d')));_0xb93920[_0x3780('0x7')](_0x3780('0x3e'),require(_0x3780('0x3f')));_0xb93920[_0x3780('0x7')](_0x3780('0x40'),require(_0x3780('0x41')));_0xb93920[_0x3780('0x7')]('/api/dashboards/items',require(_0x3780('0x42')));_0xb93920[_0x3780('0x7')](_0x3780('0x43'),require(_0x3780('0x44')));_0xb93920[_0x3780('0x7')](_0x3780('0x45'),require(_0x3780('0x46')));_0xb93920[_0x3780('0x7')]('/api/fax/interactions',require(_0x3780('0x47')));_0xb93920[_0x3780('0x7')]('/api/fax/messages',require(_0x3780('0x48')));_0xb93920['use'](_0x3780('0x49'),require(_0x3780('0x4a')));_0xb93920['use'](_0x3780('0x4b'),require('./api/faxQueueReport'));_0xb93920[_0x3780('0x7')](_0x3780('0x4c'),require(_0x3780('0x4d')));_0xb93920[_0x3780('0x7')]('/api/sms/applications',require(_0x3780('0x4e')));_0xb93920[_0x3780('0x7')](_0x3780('0x4f'),require(_0x3780('0x50')));_0xb93920[_0x3780('0x7')](_0x3780('0x51'),require('./api/smsMessage'));_0xb93920[_0x3780('0x7')]('/api/sms/queues',require('./api/smsQueue'));_0xb93920[_0x3780('0x7')](_0x3780('0x52'),require(_0x3780('0x53')));_0xb93920[_0x3780('0x7')](_0x3780('0x54'),require(_0x3780('0x55')));_0xb93920[_0x3780('0x7')](_0x3780('0x56'),require(_0x3780('0x57')));_0xb93920[_0x3780('0x7')](_0x3780('0x58'),require(_0x3780('0x59')));_0xb93920[_0x3780('0x7')](_0x3780('0x5a'),require(_0x3780('0x5b')));_0xb93920[_0x3780('0x7')](_0x3780('0x5c'),require('./api/chatWebsite'));_0xb93920['use']('/api/openchannel/reports/queue',require(_0x3780('0x5d')));_0xb93920[_0x3780('0x7')](_0x3780('0x5e'),require('./api/chatApplication'));_0xb93920[_0x3780('0x7')]('/api/chat/interactions',require(_0x3780('0x5f')));_0xb93920['use'](_0x3780('0x60'),require(_0x3780('0x61')));_0xb93920[_0x3780('0x7')](_0x3780('0x62'),require('./api/chatOfflineMessage'));_0xb93920[_0x3780('0x7')](_0x3780('0x63'),require('./api/chatQueue'));_0xb93920[_0x3780('0x7')]('/api/chat/groups',require(_0x3780('0x64')));_0xb93920['use'](_0x3780('0x65'),require('./api/chatProactiveAction'));_0xb93920[_0x3780('0x7')](_0x3780('0x66'),require(_0x3780('0x67')));_0xb93920[_0x3780('0x7')](_0x3780('0x68'),require(_0x3780('0x69')));_0xb93920[_0x3780('0x7')](_0x3780('0x6a'),require(_0x3780('0x6b')));_0xb93920[_0x3780('0x7')]('/api/cm/hopper_black',require(_0x3780('0x6c')));_0xb93920[_0x3780('0x7')](_0x3780('0x6d'),require(_0x3780('0x6e')));_0xb93920['use'](_0x3780('0x6f'),require(_0x3780('0x70')));_0xb93920[_0x3780('0x7')](_0x3780('0x71'),require(_0x3780('0x72')));_0xb93920[_0x3780('0x7')](_0x3780('0x73'),require(_0x3780('0x74')));_0xb93920['use'](_0x3780('0x75'),require('./api/automation'));_0xb93920['use']('/api/canned_answers',require(_0x3780('0x76')));_0xb93920[_0x3780('0x7')]('/api/dispositions',require(_0x3780('0x77')));_0xb93920['use']('/api/conditions',require(_0x3780('0x78')));_0xb93920['use'](_0x3780('0x79'),require('./api/interval'));_0xb93920[_0x3780('0x7')]('/api/pauses',require(_0x3780('0x7a')));_0xb93920[_0x3780('0x7')](_0x3780('0x7b'),require('./api/cdr'));_0xb93920[_0x3780('0x7')](_0x3780('0x7c'),require(_0x3780('0x7d')));_0xb93920['use'](_0x3780('0x7e'),require('./api/schedule'));_0xb93920['use'](_0x3780('0x7f'),require(_0x3780('0x80')));_0xb93920[_0x3780('0x7')](_0x3780('0x81'),require(_0x3780('0x82')));_0xb93920[_0x3780('0x7')](_0x3780('0x83'),require(_0x3780('0x84')));_0xb93920['use'](_0x3780('0x85'),require('./api/trigger'));_0xb93920[_0x3780('0x7')](_0x3780('0x86'),require(_0x3780('0x87')));_0xb93920['use'](_0x3780('0x88'),require(_0x3780('0x89')));_0xb93920['use']('/api/integrations/reports',require(_0x3780('0x8a')));_0xb93920[_0x3780('0x7')](_0x3780('0x8b'),require(_0x3780('0x8c')));_0xb93920[_0x3780('0x7')]('/api/analytics/default_reports',require(_0x3780('0x8d')));_0xb93920[_0x3780('0x7')](_0x3780('0x8e'),require(_0x3780('0x8f')));_0xb93920[_0x3780('0x7')](_0x3780('0x90'),require(_0x3780('0x91')));_0xb93920['use'](_0x3780('0x92'),require(_0x3780('0x93')));_0xb93920[_0x3780('0x7')](_0x3780('0x94'),require(_0x3780('0x95')));_0xb93920[_0x3780('0x7')]('/api/integrations/salesforce/accounts',require(_0x3780('0x96')));_0xb93920[_0x3780('0x7')]('/api/integrations/salesforce/configurations',require(_0x3780('0x97')));_0xb93920[_0x3780('0x7')](_0x3780('0x98'),require('./api/intSalesforceField'));_0xb93920['use'](_0x3780('0x99'),require(_0x3780('0x9a')));_0xb93920['use']('/api/integrations/sugarcrm/configurations',require('./api/intSugarcrmConfiguration'));_0xb93920[_0x3780('0x7')](_0x3780('0x9b'),require('./api/intSugarcrmField'));_0xb93920[_0x3780('0x7')](_0x3780('0x9c'),require(_0x3780('0x9d')));_0xb93920[_0x3780('0x7')](_0x3780('0x9e'),require(_0x3780('0x9f')));_0xb93920[_0x3780('0x7')](_0x3780('0xa0'),require(_0x3780('0xa1')));_0xb93920[_0x3780('0x7')](_0x3780('0xa2'),require(_0x3780('0xa3')));_0xb93920[_0x3780('0x7')](_0x3780('0xa4'),require(_0x3780('0xa5')));_0xb93920[_0x3780('0x7')](_0x3780('0xa6'),require(_0x3780('0xa7')));_0xb93920[_0x3780('0x7')]('/api/integrations/zendesk/accounts',require(_0x3780('0xa8')));_0xb93920['use'](_0x3780('0xa9'),require('./api/intZendeskConfiguration'));_0xb93920[_0x3780('0x7')](_0x3780('0xaa'),require(_0x3780('0xab')));_0xb93920[_0x3780('0x7')]('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0xb93920[_0x3780('0x7')](_0x3780('0xac'),require('./api/intFreshdeskConfiguration'));_0xb93920['use'](_0x3780('0xad'),require(_0x3780('0xae')));_0xb93920[_0x3780('0x7')]('/api/integrations/vtiger/accounts',require('./api/intVtigerAccount'));_0xb93920[_0x3780('0x7')](_0x3780('0xaf'),require(_0x3780('0xb0')));_0xb93920[_0x3780('0x7')](_0x3780('0xb1'),require(_0x3780('0xb2')));_0xb93920[_0x3780('0x7')](_0x3780('0xb3'),require(_0x3780('0xb4')));_0xb93920['use']('/api/integrations/servicenow/configurations',require(_0x3780('0xb5')));_0xb93920[_0x3780('0x7')](_0x3780('0xb6'),require(_0x3780('0xb7')));_0xb93920[_0x3780('0x7')]('/api/integrations/dynamics365/accounts',require(_0x3780('0xb8')));_0xb93920[_0x3780('0x7')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0xb93920[_0x3780('0x7')](_0x3780('0xb9'),require('./api/intDynamics365Field'));_0xb93920[_0x3780('0x7')](_0x3780('0xba'),require('./api/intFreshsalesAccount'));_0xb93920[_0x3780('0x7')]('/api/integrations/freshsales/configurations',require('./api/intFreshsalesConfiguration'));_0xb93920[_0x3780('0x7')](_0x3780('0xbb'),require(_0x3780('0xbc')));_0xb93920[_0x3780('0x7')]('/api/networks',require(_0x3780('0xbd')));_0xb93920[_0x3780('0x7')](_0x3780('0xbe'),require(_0x3780('0xbf')));_0xb93920[_0x3780('0x7')]('/api/chat/internal/messages',require(_0x3780('0xc0')));_0xb93920[_0x3780('0x7')](_0x3780('0xc1'),require(_0x3780('0xc2')));_0xb93920['use'](_0x3780('0xc3'),require(_0x3780('0xc4')));_0xb93920['use'](_0x3780('0xc5'),require(_0x3780('0xc6')));_0xb93920[_0x3780('0x7')](_0x3780('0xc7'),require('./api/smsQueueReport'));_0xb93920[_0x3780('0x7')](_0x3780('0xc8'),require(_0x3780('0xc9')));_0xb93920[_0x3780('0x7')](_0x3780('0xca'),require(_0x3780('0xcb')));_0xb93920[_0x3780('0x7')]('/api/jscripty/projects',require(_0x3780('0xcc')));_0xb93920[_0x3780('0x7')](_0x3780('0xcd'),require('./api/setting'));_0xb93920[_0x3780('0x7')](_0x3780('0xce'),require(_0x3780('0xcf')));_0xb93920[_0x3780('0x7')]('/api/square/projects',require('./api/squareProject'));_0xb93920[_0x3780('0x7')](_0x3780('0xd0'),require('./api/squareRecording'));_0xb93920['use'](_0x3780('0xd1'),require(_0x3780('0xd2')));_0xb93920[_0x3780('0x7')](_0x3780('0xd3'),require(_0x3780('0xd4')));_0xb93920[_0x3780('0x7')](_0x3780('0xd5'),require(_0x3780('0xd6')));_0xb93920['use']('/api/campaigns',require(_0x3780('0xd7')));_0xb93920[_0x3780('0x7')](_0x3780('0xd8'),require('./api/migration'));_0xb93920[_0x3780('0x7')](_0x3780('0xd9'),require('./api/attachment'));_0xb93920[_0x3780('0x7')](_0x3780('0xda'),require(_0x3780('0xdb')));_0xb93920['use']('/api/mail/reports/transfer',require(_0x3780('0xdc')));_0xb93920['use'](_0x3780('0xdd'),require(_0x3780('0xde')));_0xb93920['use'](_0x3780('0xdf'),require(_0x3780('0xe0')));_0xb93920[_0x3780('0x7')](_0x3780('0xe1'),require('./api/openchannelTransferReport'));_0xb93920[_0x3780('0x7')]('/api/sms/reports/transfer',require(_0x3780('0xe2')));_0xb93920[_0x3780('0x7')](_0x3780('0xe3'),require(_0x3780('0xe4')));_0xb93920[_0x3780('0x7')](_0x3780('0xe5'),require(_0x3780('0xe6')));_0xb93920['use'](_0x3780('0xe7'),require(_0x3780('0xe8')));_0xb93920['use']('/api/userProfile/sections',require(_0x3780('0xe9')));_0xb93920['use'](_0x3780('0xea'),require(_0x3780('0xeb')));_0xb93920[_0x3780('0x7')](_0x3780('0xec'),require(_0x3780('0xed')));_0xb93920[_0x3780('0x7')](_0x3780('0xee'),require(_0x3780('0xef')));_0xb93920[_0x3780('0x7')]('/api/jira',require(_0x3780('0xf0')));_0xb93920[_0x3780('0x7')]('/api/rpc',require(_0x3780('0xf1')));_0xb93920[_0x3780('0x7')]('/api/version',require(_0x3780('0xf2')));_0xb93920['use'](_0x3780('0xf3'),require(_0x3780('0xf4')));_0xb93920['use'](_0x3780('0xf5'),require(_0x3780('0xf6')));_0xb93920['use'](_0x3780('0xf7'),express['static'](path[_0x3780('0xf8')](config[_0x3780('0xf9')],'/apidoc')));_0xb93920['use'](_0x3780('0xfa'),express[_0x3780('0xfb')](path[_0x3780('0xf8')](config[_0x3780('0xf9')],_0x3780('0xfa'))));_0xb93920[_0x3780('0x7')](_0x3780('0xfc'),express[_0x3780('0xfb')](path[_0x3780('0xf8')](config[_0x3780('0xf9')],'/demo')));_0xb93920[_0x3780('0x7')](_0x3780('0xfd'),express[_0x3780('0xfb')](path[_0x3780('0xf8')](config[_0x3780('0xf9')],_0x3780('0xfe'),_0x3780('0xff'))));_0xb93920['use']('/plugins',express[_0x3780('0xfb')](path[_0x3780('0xf8')](config[_0x3780('0xf9')],_0x3780('0x100'))));_0xb93920[_0x3780('0x101')](_0x3780('0x102'))['get'](errors[0x194]);_0xb93920[_0x3780('0x101')]('/*')[_0x3780('0x103')](function(_0xe18d32,_0x322d35){_0x322d35[_0x3780('0x104')](path[_0x3780('0x105')](_0xb93920['get'](_0x3780('0x106'))+_0x3780('0x107')));});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index a730770..7ef5ffd 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa6a6=['../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc','../api/openchannelQueueReport/openchannelQueueReport.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.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/trigger/trigger.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','rpc','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','lodash','listen','merge','../api/user/user.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc'];(function(_0x35a6cf,_0x49fecf){var _0x5cda5b=function(_0x7dc4fd){while(--_0x7dc4fd){_0x35a6cf['push'](_0x35a6cf['shift']());}};_0x5cda5b(++_0x49fecf);}(_0xa6a6,0x146));var _0x6a6a=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0xa6a6[_0x1035c1];return _0x308d67;};'use strict';var jayson=require('jayson/promise');var BPromise=require('bluebird');var _=require(_0x6a6a('0x0'));var config=require('../config/environment');exports[_0x6a6a('0x1')]=function(){return new BPromise(function(_0xf146b0,_0x179e08){var _0x1d0260={};_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x3')));_0x1d0260=_['merge'](_0x1d0260,require('../api/voiceExtension/voiceExtension.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/voiceQueue/voiceQueue.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/voiceRecording/voiceRecording.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x4')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x5')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x6')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x7')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x8')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x9')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0xa')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0xb')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0xc')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0xd')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0xe')));_0x1d0260=_['merge'](_0x1d0260,require('../api/mailInteraction/mailInteraction.rpc'));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0xf')));_0x1d0260=_['merge'](_0x1d0260,require('../api/mailApplication/mailApplication.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x10')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x11')));_0x1d0260=_['merge'](_0x1d0260,require('../api/faxApplication/faxApplication.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x12')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/faxMessage/faxMessage.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/faxQueue/faxQueue.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x13')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x14')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x15')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/smsMessage/smsMessage.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/smsQueue/smsQueue.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x16')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x17')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x18')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x19')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x1a')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/chatInteraction/chatInteraction.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x1b')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x1c')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x1d')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/cmHopper/cmHopper.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x1e')));_0x1d0260=_['merge'](_0x1d0260,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x1f')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x20')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x21')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x22')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x23')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x24')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/variable/variable.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x25')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x26')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x27')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x28')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x29')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x2a')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x2b')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x2c')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/chatQueueReport/chatQueueReport.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x2d')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x2e')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x2f')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x30')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require('../api/squareRecording/squareRecording.rpc'));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x31')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x32')));_0x1d0260=_[_0x6a6a('0x2')](_0x1d0260,require(_0x6a6a('0x33')));_0x1d0260=_['merge'](_0x1d0260,require(_0x6a6a('0x34')));var _0x58a9a2=jayson['server'](_0x1d0260)['http']();var _0x4c6e21=config[_0x6a6a('0x35')]['port']||config['port']+0x1;var _0xc0a839=config[_0x6a6a('0x35')]['ip']||'localhost';_0x58a9a2['on'](_0x6a6a('0x36'),function(_0x77891b){return _0x179e08(_0x77891b);});_0x58a9a2[_0x6a6a('0x1')](_0x4c6e21,_0xc0a839,function(){console['log'](_0x6a6a('0x37'),_0xc0a839,_0x4c6e21);require(_0x6a6a('0x38'))['default']();return _0xf146b0(_0x6a6a('0x39')+_0xc0a839+':'+_0x4c6e21);});});}; \ No newline at end of file +var _0x4346=['rpc','port','listen','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','bluebird','lodash','merge','../api/user/user.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsQueue/smsQueue.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/cmContact/cmContact.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/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareProject/squareProject.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','server','http'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4346,0x139));var _0x6434=function(_0x403115,_0x2d6d03){_0x403115=_0x403115-0x0;var _0x596ef3=_0x4346[_0x403115];return _0x596ef3;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x6434('0x0'));var _=require(_0x6434('0x1'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x5aa449,_0x2a132e){var _0x58a9e1={};_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x3')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/voiceExtension/voiceExtension.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x4')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/voiceRecording/voiceRecording.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x5')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x6')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x7')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x8')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/trunk/trunk.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x9')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0xa')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/mailServerIn/mailServerIn.rpc'));_0x58a9e1=_['merge'](_0x58a9e1,require('../api/mailAccount/mailAccount.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0xb')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0xc')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0xd')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0xe')));_0x58a9e1=_['merge'](_0x58a9e1,require('../api/mailQueueReport/mailQueueReport.rpc'));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0xf')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x10')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x11')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x12')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/faxQueue/faxQueue.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x13')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x14')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/smsInteraction/smsInteraction.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/smsMessage/smsMessage.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x15')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/openchannelApplication/openchannelApplication.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/openchannelInteraction/openchannelInteraction.rpc'));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x16')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x17')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x18')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x19')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x1a')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x1b')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x1c')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x1d')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x1e')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x1f')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x20')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x21')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x22')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/sound/sound.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x23')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x24')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x25')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x26')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x27')));_0x58a9e1=_['merge'](_0x58a9e1,require('../api/intDeskAccount/intDeskAccount.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x28')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/intFreshdeskAccount/intFreshdeskAccount.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x29')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x2a')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x2b')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/smsQueueReport/smsQueueReport.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x2c')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require('../api/squareOdbc/squareOdbc.rpc'));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x2d')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x2e')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x2f')));_0x58a9e1=_[_0x6434('0x2')](_0x58a9e1,require(_0x6434('0x30')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x31')));_0x58a9e1=_['merge'](_0x58a9e1,require(_0x6434('0x32')));var _0x24111b=jayson[_0x6434('0x33')](_0x58a9e1)[_0x6434('0x34')]();var _0x56e402=config[_0x6434('0x35')][_0x6434('0x36')]||config[_0x6434('0x36')]+0x1;var _0x4c1ab6=config[_0x6434('0x35')]['ip']||'localhost';_0x24111b['on']('error',function(_0x43a1e4){return _0x2a132e(_0x43a1e4);});_0x24111b[_0x6434('0x37')](_0x56e402,_0x4c1ab6,function(){console[_0x6434('0x38')](_0x6434('0x39'),_0x4c1ab6,_0x56e402);require(_0x6434('0x3a'))[_0x6434('0x3b')]();return _0x5aa449(_0x6434('0x3c')+_0x4c1ab6+':'+_0x56e402);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 8411ecf..e664d26 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(_0x57536d,_0x41362c){var _0x1d084c=function(_0x32e73a){while(--_0x32e73a){_0x57536d['push'](_0x57536d['shift']());}};_0x1d084c(++_0x41362c);}(_0x70e0,0x17b));var _0x070e=function(_0x24b0c7,_0x342001){_0x24b0c7=_0x24b0c7-0x0;var _0x5f2460=_0x70e0[_0x24b0c7];return _0x5f2460;};'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(_0x5b5cde,_0x1f7c5f){var _0x364ad2=function(_0x4a1172){while(--_0x4a1172){_0x5b5cde['push'](_0x5b5cde['shift']());}};_0x364ad2(++_0x1f7c5f);}(_0x9c44,0x178));var _0x49c4=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x9c44[_0x18ab2a];return _0x16dcee;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIReply=require(_0x49c4('0x2'));var AGIError=require(_0x49c4('0x3'));function AGIChannel(_0x455700){var _0x2ad237=this,_0x4e0313=new AGIReply(),_0x4941f1=![],_0x41a183={};EventEmitter['call'](_0x2ad237);_0x455700[_0x49c4('0x4')](_0x49c4('0x5'));_0x455700[_0x49c4('0x6')](0x8*0x3c*0x3c*0x3e8);_0x4e0313[_0x49c4('0x4')](_0x49c4('0x5'));_0x4e0313['on']('headers',function(_0x11c586){for(var _0x42e4f8 in _0x11c586){_0x2ad237[_0x42e4f8]=_0x11c586[_0x42e4f8];}_0x2ad237[_0x49c4('0x7')](_0x49c4('0x8'));});_0x4e0313['on']('line',function(_0x5ab4a3){if(_0x5ab4a3[_0x49c4('0x9')]()==_0x49c4('0xa')){_0x2ad237['emit'](_0x49c4('0xa'));return;}if(_0x5ab4a3[_0x49c4('0xb')](0x0,0xb)=='520-Invalid'){_0x4941f1=!![];}if(_0x4941f1){_0x41a183['rx']+=_0x5ab4a3+'\x0a';if(_0x5ab4a3['search'](_0x49c4('0xc'))!=-0x1){_0x4941f1=![];}}else{_0x41a183['rx']=_0x5ab4a3;}if(_0x4941f1){return;}if(typeof _0x41a183['cb']==_0x49c4('0xd')){var _0x5487cd=_0x41a183['rx']['substring'](0x0,0x3),_0x7df3a9=null,_0x403bfb=null;_0x5487cd=parseInt(_0x5487cd);if(isNaN(_0x5487cd)){_0x41a183['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0x49c4('0xe')});return;}if(_0x5487cd!=0xc8){_0x41a183['cb'](null,{'code':_0x5487cd,'result':-0x1,'extra':'KO'});return;}_0x7df3a9=_0x41a183['rx'][_0x49c4('0xb')](0x4)[_0x49c4('0xf')](_0x49c4('0x10'),'');if(_0x7df3a9[_0x49c4('0x11')]('\x20')!=-0x1){_0x7df3a9=_0x7df3a9[_0x49c4('0x12')](0x0,_0x7df3a9[_0x49c4('0x11')]('\x20'));}if(_[_0x49c4('0x13')](_0x7df3a9,'-1')){_0x7df3a9=parseInt(_0x7df3a9);}_0x403bfb=_0x41a183['rx']['split']('\x20');if(_0x403bfb[_0x49c4('0x14')]==0x3){_0x403bfb=_0x403bfb[0x2][_0x49c4('0xb')](0x1,_0x403bfb[0x2][_0x49c4('0x14')]-0x1);}else if(_0x403bfb[_0x49c4('0x14')]>0x3){var _0x2abc78=/\((.+)\)/;var _0x53e3a2=_0x41a183['rx'][_0x49c4('0x15')](_0x2abc78);if(_0x53e3a2){_0x403bfb=_0x53e3a2[0x1];}else{_0x403bfb=null;}}else{_0x403bfb=null;}_0x41a183['cb'](null,{'code':_0x5487cd,'result':_0x7df3a9,'extra':_0x403bfb});}});_0x455700['on'](_0x49c4('0x16'),function(_0x4c3253){_0x2ad237['emit'](_0x49c4('0x16'),new AGIError(_0x49c4('0x17'),_0x4c3253[_0x49c4('0x18')]));});_0x455700['on']('close',function(){_0x2ad237[_0x49c4('0x7')]('close',new AGIError(_0x49c4('0x19')));});_0x455700['on'](_0x49c4('0x1a'),function(){_0x2ad237[_0x49c4('0x7')](_0x49c4('0x1a'),new AGIError(_0x49c4('0x1b')));_0x455700[_0x49c4('0x1c')]();});_0x455700[_0x49c4('0x1d')](_0x4e0313);this[_0x49c4('0x1e')]=function(_0x2197d2,_0x578447){var _0x2197d2=_0x2197d2||'',_0x578447=typeof _0x578447==_0x49c4('0xd')?_0x578447:new Function();_0x41a183={'tx':_0x2197d2,'rx':'','cb':_0x578447};_0x455700['write'](_0x2197d2+'\x0a');},this['close']=function(){_0x455700[_0x49c4('0x1c')]();};}util[_0x49c4('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x49c4('0x20')][_0x49c4('0x21')]=function(_0x4811c4){return this['command'][_0x49c4('0x22')](this,_0x4811c4);};AGIChannel[_0x49c4('0x20')]['answer']=function(){return this[_0x49c4('0x21')](_0x49c4('0x23'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x24')]=function(_0x531d92,_0x543ea2,_0x449960){_0x531d92=_0x531d92===undefined?'beep':_0x531d92;_0x543ea2=_0x543ea2===undefined?'5':_0x543ea2;_0x449960=_0x449960===undefined?'1':_0x449960;return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x26'),_0x531d92,_0x543ea2*0x3e8,_0x449960));};AGIChannel[_0x49c4('0x20')]['noop']=function(_0x889909){_0x889909=_0x889909||_0x49c4('0x27');return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x28'),_0x889909));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x29')]=function(_0x427b26,_0x17b50f){if(_[_0x49c4('0x2a')](_0x17b50f)){return this[_0x49c4('0x21')](util['format']('EXEC\x20%s\x20%s',_0x427b26,_0x17b50f['join'](',')));}return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2b'),_0x427b26,_0x17b50f));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2c')]=function(_0x574fd3){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2d'),_0x574fd3));};AGIChannel[_0x49c4('0x20')]['setExtension']=function(_0x57a29c){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x2e'),_0x57a29c));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x2f')]=function(_0x4a0c7a){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x30'),_0x4a0c7a));};AGIChannel['prototype']['hangup']=function(){return this[_0x49c4('0x21')](_0x49c4('0x31'));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x32')]=function(_0x2b45a1,_0x2cf897){var _0x1d1557=_[_0x49c4('0x33')](_0x2cf897)||_[_0x49c4('0x34')](_0x2cf897)?_0x2cf897['toString']():_0x2cf897;return this[_0x49c4('0x21')](util['format'](_0x49c4('0x35'),_0x2b45a1,_0x1d1557?_0x1d1557[_0x49c4('0x36')]()[_0x49c4('0xf')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x49c4('0x20')]['sayNumber']=function(_0x335f0c,_0x31f3ff){return this[_0x49c4('0x21')](util['format'](_0x49c4('0x37'),_0x335f0c,_0x31f3ff));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x38')]=function(_0x5e5366,_0x1ba7a0){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x39'),_0x5e5366,_0x1ba7a0));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3a')]=function(_0x1e506a,_0x4e0663){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x3b'),_0x1e506a,_0x4e0663));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x3c')]=function(_0x29dd5d,_0x1be62d,_0xc9722b){_0x1be62d=_0x1be62d||this[_0x49c4('0x3d')];_0xc9722b=_0xc9722b||0x1;this[_0x49c4('0x2c')](_0x29dd5d);this[_0x49c4('0x3e')](_0x1be62d);this[_0x49c4('0x2f')](_0xc9722b);return this[_0x49c4('0x3f')](util['format'](_0x49c4('0x40'),_0x29dd5d,_0x1be62d,_0xc9722b));};AGIChannel['prototype'][_0x49c4('0x41')]=function(_0x4915bc){return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x42'),_0x4915bc));};AGIChannel[_0x49c4('0x20')]['recordFile']=function(_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x117151,_0x490823){_0x20490b=_0x20490b||_0x49c4('0x43');_0x1e7bdc=_0x1e7bdc||'';_0x38349b=_0x38349b===undefined?-0x1:_0x38349b==='-1'?-0x1:_0x38349b*0x3e8;_0x117151=_0x117151===undefined?'':'s='+_0x117151;_0x490823=_0x490823?_0x49c4('0x44'):'';return this[_0x49c4('0x21')](util[_0x49c4('0x25')](_0x49c4('0x45'),_0x4d628a,_0x20490b,_0x1e7bdc,_0x38349b,_0x490823,_0x117151));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x46')]=function(_0x3351c1,_0x3c4a1d){_0x3c4a1d=_0x3c4a1d||'';return this['sendRequest'](util[_0x49c4('0x25')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x3351c1,_0x3c4a1d));};AGIChannel[_0x49c4('0x20')][_0x49c4('0x47')]=function(_0x301def){return this[_0x49c4('0x29')](_0x49c4('0x48'),_0x301def);};AGIChannel['prototype'][_0x49c4('0x49')]=function(_0x15b674){return this[_0x49c4('0x29')](_0x49c4('0x4a'),_0x15b674);};AGIChannel[_0x49c4('0x20')][_0x49c4('0x16')]=function(_0x9779ef,_0x4d89e0){this[_0x49c4('0x3f')](util['format'](_0x49c4('0x4b'),_0x9779ef['id'],_0x9779ef[_0x49c4('0x4c')],_0x4d89e0));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x49c4('0x4d')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 349e58c..b78fd03 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 _0x6e0d=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20timeout.','E_AGI_UNDEFINED','push','apply','message','name','exports','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x6e0d,0x11c));var _0xd6e0=function(_0x46a454,_0xea225d){_0x46a454=_0x46a454-0x0;var _0x584e2d=_0x6e0d[_0x46a454];return _0x584e2d;};'use strict';var util=require(_0xd6e0('0x0'));var error={'E_AGI_UNDEFINED':_0xd6e0('0x1'),'E_AGI_ARGUMENT_PORT':_0xd6e0('0x2'),'E_AGI_SERVER_ERROR':_0xd6e0('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0xd6e0('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':'Socket\x20error.\x20Code:\x20%s.','E_AGI_SOCKET_CLOSE':'Socket\x20closed.','E_AGI_SOCKET_TIMEOUT':_0xd6e0('0x5'),'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(_0x97b7c1){var _0x97b7c1=_0x97b7c1||null,_0x30d100=_0x30d100||[],_0x1515da=0x1,_0x22ce6d='';if(!error[_0x97b7c1]){_0x97b7c1=_0xd6e0('0x6');}_0x30d100[_0xd6e0('0x7')](error[_0x97b7c1]);while(arguments[_0x1515da]){_0x30d100[_0xd6e0('0x7')](arguments[_0x1515da]);_0x1515da++;}_0x22ce6d=util['format'][_0xd6e0('0x8')](util,_0x30d100);this[_0xd6e0('0x9')]=_0x22ce6d;this[_0xd6e0('0xa')]=_0x97b7c1;}module[_0xd6e0('0xb')]=AGIError; \ No newline at end of file +var _0x64b3=['name','exports','util','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message'];(function(_0x117821,_0xaa1933){var _0x4ae9ff=function(_0x253662){while(--_0x253662){_0x117821['push'](_0x117821['shift']());}};_0x4ae9ff(++_0xaa1933);}(_0x64b3,0x1de));var _0x364b=function(_0x4d66e0,_0x30e464){_0x4d66e0=_0x4d66e0-0x0;var _0x3924ac=_0x64b3[_0x4d66e0];return _0x3924ac;};'use strict';var util=require(_0x364b('0x0'));var error={'E_AGI_UNDEFINED':'Undefined\x20error.','E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':_0x364b('0x1'),'E_AGI_SERVER_CLOSE':_0x364b('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x364b('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x364b('0x4'),'E_AGI_SOCKET_CLOSE':_0x364b('0x5'),'E_AGI_SOCKET_TIMEOUT':_0x364b('0x6'),'E_AGI_COMMAND_EMPTY':_0x364b('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x364b('0x8'),'E_AGI_IVR_ENTRY':_0x364b('0x9')};function AGIError(_0x53ae27){var _0x53ae27=_0x53ae27||null,_0x38efef=_0x38efef||[],_0x325e14=0x1,_0x3f6653='';if(!error[_0x53ae27]){_0x53ae27=_0x364b('0xa');}_0x38efef[_0x364b('0xb')](error[_0x53ae27]);while(arguments[_0x325e14]){_0x38efef[_0x364b('0xb')](arguments[_0x325e14]);_0x325e14++;}_0x3f6653=util[_0x364b('0xc')][_0x364b('0xd')](util,_0x38efef);this[_0x364b('0xe')]=_0x3f6653;this[_0x364b('0xf')]=_0x53ae27;}module[_0x364b('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index ff0ffb8..9b693a9 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 _0xc901=['numberOfEdges','prototype','addVertex','edges','addEdge','push','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','condition','agicommand','default','menu','target','includes','max\x20retry\x20reach','condition\x20not\x20found','exports','lodash','getsecretdigits','vertices'];(function(_0x48e229,_0x5a2595){var _0x408c2b=function(_0x32eb9c){while(--_0x32eb9c){_0x48e229['push'](_0x48e229['shift']());}};_0x408c2b(++_0x5a2595);}(_0xc901,0x142));var _0x1c90=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xc901[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x1c90('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0x1c90('0x1')];var Graph=function(){this[_0x1c90('0x2')]={};this['edges']={};this[_0x1c90('0x3')]=0x0;};Graph[_0x1c90('0x4')][_0x1c90('0x5')]=function(_0x2eff92){this[_0x1c90('0x2')][_0x2eff92['id']]=_0x2eff92;this[_0x1c90('0x6')][_0x2eff92['id']]=[];};Graph[_0x1c90('0x4')][_0x1c90('0x7')]=function(_0x423cfb,_0x19196f,_0x514386){this[_0x1c90('0x6')][_0x423cfb][_0x1c90('0x8')]({'target':_0x19196f,'condition':_0x514386});this[_0x1c90('0x3')]+=0x1;};Graph[_0x1c90('0x4')][_0x1c90('0x9')]=function(){return _[_0x1c90('0x9')](this[_0x1c90('0x2')]);};Graph[_0x1c90('0x4')]['relations']=function(){return this['numberOfEdges'];};Graph[_0x1c90('0x4')][_0x1c90('0xa')]=function(_0x327610){return this['vertices'][_0x327610];};Graph['prototype'][_0x1c90('0xb')]=function(_0x3353e3,_0x5e0f69){if(!this[_0x1c90('0x2')][_0x3353e3]){return logger[_0x1c90('0xc')](_0x1c90('0xd'));}var _0x589c97=_0x5e0f69(this[_0x1c90('0x2')][_0x3353e3]);if(!_0x589c97){return logger['info'](_0x1c90('0xe'));}if(this[_0x1c90('0x6')][_0x3353e3][_0x1c90('0xf')]===0x0){return logger[_0x1c90('0xc')]('no\x20edge/s\x20available');}for(var _0x296c5d=0x0,_0x526f4e=[],_0x2d3c90=![];_0x296c5d\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','mxGraphModel','root','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','length','source','target','addEdge','getSquareProject','catch','createSquareReport','indexOf','agi_','inspect','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','evtHangup','hangup','sync','production','start','stringify','joinAt','YYYY-MM-DD\x20HH:mm:ss','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','isUndefined','result','toString','agicommand\x20not\x20found','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','finally'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x029b,0x66));var _0xb029=function(_0x10c881,_0x5e6a3c){_0x10c881=_0x10c881-0x0;var _0x200e05=_0x029b[_0x10c881];return _0x200e05;};'use strict';var parser=require(_0xb029('0x0'));var _=require(_0xb029('0x1'));var syncho=require('syncho');var util=require(_0xb029('0x2'));var moment=require(_0xb029('0x3'));var config=require('../../config/environment');var logger=require(_0xb029('0x4'))(_0xb029('0x5'));var utilLicense=require('../../config/license/util');var rpc=require('./rpc');var mailRpc=require(_0xb029('0x6'));var Graph=require(_0xb029('0x7'));var Vertices=require(_0xb029('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xb029('0x5')]=_[_0xb029('0x9')](config['agi'],{'ip':_0xb029('0xa'),'port':0x11dd});function connectionHandler(_0x48b3d0){process[_0xb029('0xb')](function(){syncho(function(){try{setChannelVariables(_0x48b3d0);agiHandler(_0x48b3d0);}catch(_0x480ead){logger[_0xb029('0xc')](_0x480ead['stack']);}});});}function listeningHandler(){console[_0xb029('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0xb029('0x5')][_0xb029('0xe')]);logger['info'](util[_0xb029('0xf')](_0xb029('0x10'),config[_0xb029('0x5')]['ip'],config[_0xb029('0x5')][_0xb029('0xe')]));}function errorHandler(_0x498b6a){if(_0x498b6a&&_0x498b6a[_0xb029('0x11')]&&_0x498b6a['message']){logger[_0xb029('0xc')](util[_0xb029('0xf')](_0xb029('0x12'),_0x498b6a[_0xb029('0x11')],_0x498b6a['message']));}else{logger[_0xb029('0xc')](util[_0xb029('0xf')](_0xb029('0x13'),_0x498b6a['stack']));}}function closeHandler(){logger[_0xb029('0x14')](util[_0xb029('0xf')](_0xb029('0x15'),this[_0xb029('0x16')],this[_0xb029('0x17')],this[_0xb029('0x18')],this[_0xb029('0x19')],this[_0xb029('0x1a')]));try{createSquareReport(this);}catch(_0x3f91cb){logger['error'](_0x3f91cb['stack']);}}function timeoutHandler(){logger[_0xb029('0x14')](util['format'](_0xb029('0x1b'),this[_0xb029('0x16')],this[_0xb029('0x17')],this['callerid'],this['dnid'],this[_0xb029('0x1a')]));}function hangupHandler(){logger[_0xb029('0x14')](util[_0xb029('0xf')](_0xb029('0x1c'),this[_0xb029('0x16')],this[_0xb029('0x17')],this['callerid'],this['dnid'],this['uniqueid']));this['evtHangup']=!![];}function getRoot(_0x3e1dc4){return parser[_0xb029('0x1d')](_0x3e1dc4,{'object':!![]})[_0xb029('0x1e')][_0xb029('0x1f')];}function addVertex(_0x500bb6,_0x3642b5,_0x379ef3){_0x3642b5[_0xb029('0x20')]=_0x379ef3;if(_0x3642b5[_0xb029('0x21')](_0xb029('0x22'))){_0x3642b5[_0xb029('0x23')]=parseInt(_0x3642b5[_0xb029('0x22')],0xa);}_0x500bb6[_0xb029('0x24')](_[_0xb029('0x25')](_0x3642b5,_0xb029('0x26')));}function initGraph(_0xd9206b,_0x22dccd){var _0x279e4a=new Graph();for(var _0x599a14 in _0xd9206b){if(_0xd9206b[_0xb029('0x21')](_0x599a14)){if(_[_0xb029('0x27')](_0xd9206b[_0x599a14])){for(var _0x47f874=0x0;_0x47f874<_0xd9206b[_0x599a14]['length'];_0x47f874+=0x1){addVertex(_0x279e4a,_0xd9206b[_0x599a14][_0x47f874],_0x599a14);}}else{addVertex(_0x279e4a,_0xd9206b[_0x599a14],_0x599a14);}}}for(var _0x112ce9=0x0;_0x112ce9<_0x22dccd[_0xb029('0x28')];_0x112ce9+=0x1){if(_0x22dccd[_0x112ce9][_0xb029('0x29')]&&_0x22dccd[_0x112ce9][_0xb029('0x2a')]){_0x279e4a[_0xb029('0x2b')](_0x22dccd[_0x112ce9]['source'],_0x22dccd[_0x112ce9][_0xb029('0x2a')],_0x22dccd[_0x112ce9]['value']);}}return _0x279e4a;}function getSquareProject(_0x2b2d98,_0x6960fb){rpc[_0xb029('0x2c')](_0x2b2d98)['then'](function(_0x1aa94b){_0x6960fb(null,_0x1aa94b);})[_0xb029('0x2d')](function(_0x59bf9d){_0x6960fb(null,_0x59bf9d);});}function createSquareReport(_0x236217,_0x4d9e7e){rpc[_0xb029('0x2e')](_0x236217)['then'](function(_0x88a69b){if(_0x4d9e7e){_0x4d9e7e(null,_0x88a69b);}})[_0xb029('0x2d')](function(_0x392d0f){if(_0x4d9e7e){_0x4d9e7e(null,_0x392d0f);}});}function setChannelVariables(_0x2324f3){for(var _0x2812b7 in _0x2324f3){if(_0x2324f3[_0xb029('0x21')](_0x2812b7)){if(_0x2812b7[_0xb029('0x2f')](_0xb029('0x30'))===0x0){_0x2324f3[_0x2812b7['substring'](0x4)]=_0x2324f3[_0x2812b7];delete _0x2324f3[_0x2812b7];}}}}function getLogFromObject(_0x2d87c1){return util[_0xb029('0x31')](_0x2d87c1,{'showHidden':![],'depth':null});}function agiHandler(_0x130663){var _0x53753a,_0x4390e4,_0x2b0f6b,_0x5f4688,_0x2f17b0;logger['debug'](_0xb029('0x32'),JSON['stringify'](_0x130663,null,0x2));logger[_0xb029('0x14')](util[_0xb029('0xf')](_0xb029('0x33'),_0x130663[_0xb029('0x16')],_0x130663[_0xb029('0x17')],_0x130663[_0xb029('0x18')],_0x130663[_0xb029('0x19')],_0x130663['uniqueid']));_0x130663['on'](_0xb029('0xc'),errorHandler);_0x130663['on'](_0xb029('0x34'),closeHandler);_0x130663['on']('timeout',timeoutHandler);_0x130663[_0xb029('0x35')]=![];_0x130663['on'](_0xb029('0x36'),hangupHandler);var _0x35105c=getSquareProject[_0xb029('0x37')](null,_0x130663['arg_1']);if(_0x35105c){if(_0x35105c[_0xb029('0x38')]){_0x53753a=getRoot(_0x35105c[_0xb029('0x38')]);if(_0x53753a&&_0x53753a[_0xb029('0x39')]){logger['debug'](_0xb029('0x1f'),JSON[_0xb029('0x3a')](_0x53753a,null,0x2));_0x130663[_0xb029('0x3b')]=moment()[_0xb029('0xf')](_0xb029('0x3c'));_0x4390e4=initGraph(_[_0xb029('0x25')](_0x53753a,_0xb029('0x26')),_0x53753a[_0xb029('0x26')]);_0x2b0f6b=new Vertices(_0x130663,rpc,mailRpc);logger[_0xb029('0x14')](util[_0xb029('0xf')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x130663[_0xb029('0x16')],_0x130663[_0xb029('0x17')],_0x130663[_0xb029('0x18')],_0x130663['dnid'],_0x130663['uniqueid']));_0x4390e4['traverseBFS'](_0x53753a[_0xb029('0x39')]['id'],function(_0x41a857){try{_0x41a857=_0x2b0f6b['clear'](_0x41a857);logger[_0xb029('0x3d')](_0xb029('0x3e'),JSON[_0xb029('0x3a')](_0x41a857,null,0x2));if(_0x41a857[_0xb029('0x20')]===_0xb029('0x3f')){logger['info'](_0xb029('0x40'));_0x130663[_0xb029('0x41')]=_0x41a857['context']||_0x130663[_0xb029('0x41')];_0x130663[_0xb029('0x42')]=_0x41a857[_0xb029('0x42')];_0x130663['priority']=_0x41a857[_0xb029('0x43')]?_0x41a857[_0xb029('0x43')]-0x1:0x1;return null;}else if(_0x41a857&&_0x2b0f6b[_0x41a857['agicommand']]){_0x2f17b0=_0x2b0f6b[_0x41a857['agicommand']](_0x41a857);logger[_0xb029('0x14')](_0xb029('0x44'),JSON[_0xb029('0x3a')](_0x2f17b0,null,0x2));if(_0x2f17b0&&_0x2f17b0[_0xb029('0x45')]===AGI_CODE_SUCCESS&&_0x2f17b0['result']!==AGI_RESULT_ERROR&&!_0x130663['evtHangup']){logger[_0xb029('0x3d')]('response',getLogFromObject(_0x2f17b0));return _[_0xb029('0x46')](_0x2f17b0['result'])?null:_0x2f17b0[_0xb029('0x47')][_0xb029('0x48')]();}else{logger[_0xb029('0xc')](_0xb029('0x44'),getLogFromObject(_0x2f17b0));return null;}}else{logger[_0xb029('0xc')](_0xb029('0x49'));return null;}}catch(_0x5f294b){logger[_0xb029('0xc')](_0x5f294b['stack']);return null;}});if(_0x53753a['finally']){logger[_0xb029('0x14')](util['format'](_0xb029('0x4a'),_0x130663['arg_1'],_0x130663[_0xb029('0x17')],_0x130663[_0xb029('0x18')],_0x130663[_0xb029('0x19')],_0x130663[_0xb029('0x1a')]));_0x4390e4['traverseBFS'](_0x53753a[_0xb029('0x4b')]['id'],function(_0x43adce){try{_0x43adce=_0x2b0f6b[_0xb029('0x4c')](_0x43adce);logger[_0xb029('0x3d')](_0xb029('0x3e'),JSON[_0xb029('0x3a')](_0x43adce,null,0x2));if(_0x43adce&&_0x2b0f6b[_0x43adce[_0xb029('0x20')]]){_0x2f17b0=_0x2b0f6b[_0x43adce[_0xb029('0x20')]](_0x43adce);if(_0x2f17b0){logger[_0xb029('0x3d')](_0xb029('0x44'),getLogFromObject(_0x2f17b0));return _['isUndefined'](_0x2f17b0[_0xb029('0x47')])?null:_0x2f17b0[_0xb029('0x47')][_0xb029('0x48')]();}else{logger[_0xb029('0xc')]('response',getLogFromObject(_0x2f17b0));return null;}}else{logger[_0xb029('0xc')]('agicommand\x20not\x20found');return null;}}catch(_0x5f6e93){logger[_0xb029('0xc')](_0x5f6e93[_0xb029('0x4d')]);return null;}});}logger[_0xb029('0x14')](util[_0xb029('0xf')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x130663['arg_1'],_0x130663[_0xb029('0x17')],_0x130663[_0xb029('0x18')],_0x130663[_0xb029('0x19')],_0x130663[_0xb029('0x1a')]));logger[_0xb029('0x14')](util[_0xb029('0xf')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x130663[_0xb029('0x41')],_0x130663[_0xb029('0x42')],parseInt(_0x130663[_0xb029('0x43')],0xa)+0x1));_0x130663['continueAt'](_0x130663['context'],_0x130663[_0xb029('0x42')],parseInt(_0x130663['priority'],0xa)+0x1);_0x130663[_0xb029('0x34')]();}}else{logger[_0xb029('0xc')](util[_0xb029('0xf')]('Project\x20%s\x20not\x20published',_0x130663[_0xb029('0x16')]));_0x130663[_0xb029('0x4e')](_0x130663['context'],_0x130663[_0xb029('0x42')],parseInt(_0x130663[_0xb029('0x43')],0xa)+0x1);_0x130663[_0xb029('0x34')]();}}else{logger['error'](util[_0xb029('0xf')](_0xb029('0x4f'),_0x130663[_0xb029('0x16')]));_0x130663[_0xb029('0x4e')](_0x130663['context'],_0x130663[_0xb029('0x42')],parseInt(_0x130663[_0xb029('0x43')],0xa)+0x1);_0x130663[_0xb029('0x34')]();}}function main(){var _0x49294c;return utilLicense[_0xb029('0x50')]()['then'](function(_0x7dbf28){if(_0x7dbf28){if(_0x7dbf28[_0xb029('0x51')]){if(_0x7dbf28[_0xb029('0x52')]&&_0x7dbf28[_0xb029('0x52')]>0x0){logger[_0xb029('0x14')](util[_0xb029('0xf')](_0xb029('0x53'),_0x7dbf28['callysquare']));_0x49294c=_0x7dbf28['callysquare'];}else{logger['info'](_0xb029('0x54'));}}else{logger[_0xb029('0x14')](_0xb029('0x55'));_0x49294c=-0x1;}}})[_0xb029('0x2d')](function(_0x307c5d){logger['error'](_0xb029('0x56'),_0x307c5d[_0xb029('0x4d')]);})[_0xb029('0x4b')](function(){var _0x1ef398=require('./server')(config[_0xb029('0x5')][_0xb029('0xe')],config[_0xb029('0x5')]['ip'],_0x49294c);_0x1ef398['on'](_0xb029('0xc'),errorHandler);_0x1ef398['on'](_0xb029('0x57'),listeningHandler);_0x1ef398['on'](_0xb029('0x58'),connectionHandler);_0x1ef398['on'](_0xb029('0x34'),closeHandler);});}main(); \ No newline at end of file +var _0xac95=['callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','listening','xml2json','lodash','syncho','util','../../config/logger','agi','./rpc','./mailRpc','./vertices','defaults','nextTick','error','stack','log','port','format','name','message','[%s]\x20%s','[ERROR]\x20%s','info','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','toJson','mxGraphModel','agicommand','maxRetry','omit','hasOwnProperty','isArray','length','source','target','addEdge','getSquareProject','then','catch','agi_','inspect','debug','variables','close','hangup','sync','production','start','root','stringify','joinAt','mxCell','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','clear','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','traverseBFS','vertex','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','getLicense','voice'];(function(_0x3f581f,_0x4ea03c){var _0x1e0d19=function(_0x2b9d8a){while(--_0x2b9d8a){_0x3f581f['push'](_0x3f581f['shift']());}};_0x1e0d19(++_0x4ea03c);}(_0xac95,0xa8));var _0x5ac9=function(_0x3c0fad,_0x2aad16){_0x3c0fad=_0x3c0fad-0x0;var _0x5c43f2=_0xac95[_0x3c0fad];return _0x5c43f2;};'use strict';var parser=require(_0x5ac9('0x0'));var _=require(_0x5ac9('0x1'));var syncho=require(_0x5ac9('0x2'));var util=require(_0x5ac9('0x3'));var moment=require('moment');var config=require('../../config/environment');var logger=require(_0x5ac9('0x4'))(_0x5ac9('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0x5ac9('0x6'));var mailRpc=require(_0x5ac9('0x7'));var Graph=require('./graph');var Vertices=require(_0x5ac9('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x5ac9('0x5')]=_[_0x5ac9('0x9')](config['agi'],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x32afbc){process[_0x5ac9('0xa')](function(){syncho(function(){try{setChannelVariables(_0x32afbc);agiHandler(_0x32afbc);}catch(_0x28bc1f){logger[_0x5ac9('0xb')](_0x28bc1f[_0x5ac9('0xc')]);}});});}function listeningHandler(){console[_0x5ac9('0xd')]('Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!',config[_0x5ac9('0x5')][_0x5ac9('0xe')]);logger['info'](util[_0x5ac9('0xf')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x5ac9('0x5')]['ip'],config['agi'][_0x5ac9('0xe')]));}function errorHandler(_0x296b34){if(_0x296b34&&_0x296b34[_0x5ac9('0x10')]&&_0x296b34[_0x5ac9('0x11')]){logger['error'](util['format'](_0x5ac9('0x12'),_0x296b34['name'],_0x296b34[_0x5ac9('0x11')]));}else{logger[_0x5ac9('0xb')](util['format'](_0x5ac9('0x13'),_0x296b34[_0x5ac9('0xc')]));}}function closeHandler(){logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x15'),this[_0x5ac9('0x16')],this[_0x5ac9('0x17')],this[_0x5ac9('0x18')],this[_0x5ac9('0x19')],this['uniqueid']));try{createSquareReport(this);}catch(_0x53a8db){logger[_0x5ac9('0xb')](_0x53a8db[_0x5ac9('0xc')]);}}function timeoutHandler(){logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x1a'),this[_0x5ac9('0x16')],this[_0x5ac9('0x17')],this[_0x5ac9('0x18')],this[_0x5ac9('0x19')],this[_0x5ac9('0x1b')]));}function hangupHandler(){logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x1c'),this['arg_1'],this[_0x5ac9('0x17')],this[_0x5ac9('0x18')],this[_0x5ac9('0x19')],this[_0x5ac9('0x1b')]));this[_0x5ac9('0x1d')]=!![];}function getRoot(_0x492679){return parser[_0x5ac9('0x1e')](_0x492679,{'object':!![]})[_0x5ac9('0x1f')]['root'];}function addVertex(_0x5e42a1,_0x5a4664,_0xc36d2){_0x5a4664[_0x5ac9('0x20')]=_0xc36d2;if(_0x5a4664['hasOwnProperty']('retry')){_0x5a4664[_0x5ac9('0x21')]=parseInt(_0x5a4664['retry'],0xa);}_0x5e42a1['addVertex'](_[_0x5ac9('0x22')](_0x5a4664,'mxCell'));}function initGraph(_0x12f725,_0x3b77be){var _0x770c48=new Graph();for(var _0x3a7f68 in _0x12f725){if(_0x12f725[_0x5ac9('0x23')](_0x3a7f68)){if(_[_0x5ac9('0x24')](_0x12f725[_0x3a7f68])){for(var _0x13aaa7=0x0;_0x13aaa7<_0x12f725[_0x3a7f68][_0x5ac9('0x25')];_0x13aaa7+=0x1){addVertex(_0x770c48,_0x12f725[_0x3a7f68][_0x13aaa7],_0x3a7f68);}}else{addVertex(_0x770c48,_0x12f725[_0x3a7f68],_0x3a7f68);}}}for(var _0x203d19=0x0;_0x203d19<_0x3b77be['length'];_0x203d19+=0x1){if(_0x3b77be[_0x203d19][_0x5ac9('0x26')]&&_0x3b77be[_0x203d19][_0x5ac9('0x27')]){_0x770c48[_0x5ac9('0x28')](_0x3b77be[_0x203d19][_0x5ac9('0x26')],_0x3b77be[_0x203d19][_0x5ac9('0x27')],_0x3b77be[_0x203d19]['value']);}}return _0x770c48;}function getSquareProject(_0x47f6ad,_0x2e5b69){rpc[_0x5ac9('0x29')](_0x47f6ad)['then'](function(_0x3a15cf){_0x2e5b69(null,_0x3a15cf);})['catch'](function(_0x16b970){_0x2e5b69(null,_0x16b970);});}function createSquareReport(_0x2c85dc,_0x1d0d5a){rpc['createSquareReport'](_0x2c85dc)[_0x5ac9('0x2a')](function(_0x128866){if(_0x1d0d5a){_0x1d0d5a(null,_0x128866);}})[_0x5ac9('0x2b')](function(_0x30fb2b){if(_0x1d0d5a){_0x1d0d5a(null,_0x30fb2b);}});}function setChannelVariables(_0x5ce12f){for(var _0x35d73d in _0x5ce12f){if(_0x5ce12f['hasOwnProperty'](_0x35d73d)){if(_0x35d73d['indexOf'](_0x5ac9('0x2c'))===0x0){_0x5ce12f[_0x35d73d['substring'](0x4)]=_0x5ce12f[_0x35d73d];delete _0x5ce12f[_0x35d73d];}}}}function getLogFromObject(_0x5696c8){return util[_0x5ac9('0x2d')](_0x5696c8,{'showHidden':![],'depth':null});}function agiHandler(_0x148d0b){var _0x3e12be,_0x2f2fb4,_0x2f7f2f,_0x28754f,_0x6225c5;logger[_0x5ac9('0x2e')](_0x5ac9('0x2f'),JSON['stringify'](_0x148d0b,null,0x2));logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')]('[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x148d0b['arg_1'],_0x148d0b[_0x5ac9('0x17')],_0x148d0b[_0x5ac9('0x18')],_0x148d0b[_0x5ac9('0x19')],_0x148d0b[_0x5ac9('0x1b')]));_0x148d0b['on']('error',errorHandler);_0x148d0b['on'](_0x5ac9('0x30'),closeHandler);_0x148d0b['on']('timeout',timeoutHandler);_0x148d0b[_0x5ac9('0x1d')]=![];_0x148d0b['on'](_0x5ac9('0x31'),hangupHandler);var _0x2cb1d5=getSquareProject[_0x5ac9('0x32')](null,_0x148d0b[_0x5ac9('0x16')]);if(_0x2cb1d5){if(_0x2cb1d5[_0x5ac9('0x33')]){_0x3e12be=getRoot(_0x2cb1d5[_0x5ac9('0x33')]);if(_0x3e12be&&_0x3e12be[_0x5ac9('0x34')]){logger[_0x5ac9('0x2e')](_0x5ac9('0x35'),JSON[_0x5ac9('0x36')](_0x3e12be,null,0x2));_0x148d0b[_0x5ac9('0x37')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x2f2fb4=initGraph(_[_0x5ac9('0x22')](_0x3e12be,_0x5ac9('0x38')),_0x3e12be[_0x5ac9('0x38')]);_0x2f7f2f=new Vertices(_0x148d0b,rpc,mailRpc);logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x39'),_0x148d0b['arg_1'],_0x148d0b[_0x5ac9('0x17')],_0x148d0b[_0x5ac9('0x18')],_0x148d0b['dnid'],_0x148d0b['uniqueid']));_0x2f2fb4['traverseBFS'](_0x3e12be[_0x5ac9('0x34')]['id'],function(_0xc6be86){try{_0xc6be86=_0x2f7f2f[_0x5ac9('0x3a')](_0xc6be86);logger[_0x5ac9('0x2e')]('vertex',JSON[_0x5ac9('0x36')](_0xc6be86,null,0x2));if(_0xc6be86['agicommand']==='gotoc'){logger[_0x5ac9('0x14')](_0x5ac9('0x3b'));_0x148d0b['context']=_0xc6be86[_0x5ac9('0x3c')]||_0x148d0b[_0x5ac9('0x3c')];_0x148d0b['extension']=_0xc6be86[_0x5ac9('0x3d')];_0x148d0b[_0x5ac9('0x3e')]=_0xc6be86[_0x5ac9('0x3e')]?_0xc6be86[_0x5ac9('0x3e')]-0x1:0x1;return null;}else if(_0xc6be86&&_0x2f7f2f[_0xc6be86[_0x5ac9('0x20')]]){_0x6225c5=_0x2f7f2f[_0xc6be86[_0x5ac9('0x20')]](_0xc6be86);logger[_0x5ac9('0x14')](_0x5ac9('0x3f'),JSON[_0x5ac9('0x36')](_0x6225c5,null,0x2));if(_0x6225c5&&_0x6225c5[_0x5ac9('0x40')]===AGI_CODE_SUCCESS&&_0x6225c5[_0x5ac9('0x41')]!==AGI_RESULT_ERROR&&!_0x148d0b[_0x5ac9('0x1d')]){logger['debug'](_0x5ac9('0x3f'),getLogFromObject(_0x6225c5));return _[_0x5ac9('0x42')](_0x6225c5[_0x5ac9('0x41')])?null:_0x6225c5['result'][_0x5ac9('0x43')]();}else{logger[_0x5ac9('0xb')](_0x5ac9('0x3f'),getLogFromObject(_0x6225c5));return null;}}else{logger['error'](_0x5ac9('0x44'));return null;}}catch(_0x3044a9){logger[_0x5ac9('0xb')](_0x3044a9[_0x5ac9('0xc')]);return null;}});if(_0x3e12be[_0x5ac9('0x45')]){logger[_0x5ac9('0x14')](util['format']('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x148d0b[_0x5ac9('0x16')],_0x148d0b['calleridname'],_0x148d0b[_0x5ac9('0x18')],_0x148d0b['dnid'],_0x148d0b[_0x5ac9('0x1b')]));_0x2f2fb4[_0x5ac9('0x46')](_0x3e12be[_0x5ac9('0x45')]['id'],function(_0x398906){try{_0x398906=_0x2f7f2f[_0x5ac9('0x3a')](_0x398906);logger[_0x5ac9('0x2e')](_0x5ac9('0x47'),JSON[_0x5ac9('0x36')](_0x398906,null,0x2));if(_0x398906&&_0x2f7f2f[_0x398906[_0x5ac9('0x20')]]){_0x6225c5=_0x2f7f2f[_0x398906[_0x5ac9('0x20')]](_0x398906);if(_0x6225c5){logger[_0x5ac9('0x2e')]('response',getLogFromObject(_0x6225c5));return _[_0x5ac9('0x42')](_0x6225c5[_0x5ac9('0x41')])?null:_0x6225c5['result']['toString']();}else{logger[_0x5ac9('0xb')](_0x5ac9('0x3f'),getLogFromObject(_0x6225c5));return null;}}else{logger[_0x5ac9('0xb')]('agicommand\x20not\x20found');return null;}}catch(_0x33446e){logger[_0x5ac9('0xb')](_0x33446e[_0x5ac9('0xc')]);return null;}});}logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x48'),_0x148d0b['arg_1'],_0x148d0b['calleridname'],_0x148d0b[_0x5ac9('0x18')],_0x148d0b[_0x5ac9('0x19')],_0x148d0b['uniqueid']));logger[_0x5ac9('0x14')](util[_0x5ac9('0xf')](_0x5ac9('0x49'),_0x148d0b[_0x5ac9('0x3c')],_0x148d0b[_0x5ac9('0x3d')],parseInt(_0x148d0b['priority'],0xa)+0x1));_0x148d0b[_0x5ac9('0x4a')](_0x148d0b[_0x5ac9('0x3c')],_0x148d0b[_0x5ac9('0x3d')],parseInt(_0x148d0b['priority'],0xa)+0x1);_0x148d0b[_0x5ac9('0x30')]();}}else{logger[_0x5ac9('0xb')](util[_0x5ac9('0xf')](_0x5ac9('0x4b'),_0x148d0b[_0x5ac9('0x16')]));_0x148d0b['continueAt'](_0x148d0b['context'],_0x148d0b[_0x5ac9('0x3d')],parseInt(_0x148d0b['priority'],0xa)+0x1);_0x148d0b[_0x5ac9('0x30')]();}}else{logger['error'](util[_0x5ac9('0xf')]('Project\x20%s\x20not\x20found',_0x148d0b[_0x5ac9('0x16')]));_0x148d0b[_0x5ac9('0x4a')](_0x148d0b['context'],_0x148d0b['extension'],parseInt(_0x148d0b[_0x5ac9('0x3e')],0xa)+0x1);_0x148d0b[_0x5ac9('0x30')]();}}function main(){var _0x43db69;return utilLicense[_0x5ac9('0x4c')]()[_0x5ac9('0x2a')](function(_0x3b90d9){if(_0x3b90d9){if(_0x3b90d9[_0x5ac9('0x4d')]){if(_0x3b90d9[_0x5ac9('0x4e')]&&_0x3b90d9['callysquare']>0x0){logger[_0x5ac9('0x14')](util['format'](_0x5ac9('0x4f'),_0x3b90d9[_0x5ac9('0x4e')]));_0x43db69=_0x3b90d9['callysquare'];}else{logger[_0x5ac9('0x14')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x5ac9('0x14')](_0x5ac9('0x50'));_0x43db69=-0x1;}}})[_0x5ac9('0x2b')](function(_0x388011){logger[_0x5ac9('0xb')]('[LICENSE]',_0x388011[_0x5ac9('0xc')]);})[_0x5ac9('0x45')](function(){var _0x24b61f=require('./server')(config[_0x5ac9('0x5')][_0x5ac9('0xe')],config[_0x5ac9('0x5')]['ip'],_0x43db69);_0x24b61f['on']('error',errorHandler);_0x24b61f['on'](_0x5ac9('0x51'),listeningHandler);_0x24b61f['on']('connection',connectionHandler);_0x24b61f['on'](_0x5ac9('0x30'),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 470e470..e0a3eef 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(_0x34605a,_0x212187){var _0x322668=function(_0x487c08){while(--_0x487c08){_0x34605a['push'](_0x34605a['shift']());}};_0x322668(++_0x212187);}(_0x34e8,0x12c));var _0x834e=function(_0x2d9e64,_0x18610e){_0x2d9e64=_0x2d9e64-0x0;var _0x287363=_0x34e8[_0x2d9e64];return _0x287363;};'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(_0x4cc0c2,_0x59e71f){var _0x444078=function(_0x1e202c){while(--_0x1e202c){_0x4cc0c2['push'](_0x4cc0c2['shift']());}};_0x444078(++_0x59e71f);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'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 0f479af..13fa0fe 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(_0x3972dd,_0x298e3f){var _0x3a29c8=function(_0x461387){while(--_0x461387){_0x3972dd['push'](_0x3972dd['shift']());}};_0x3a29c8(++_0x298e3f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x13b518,_0x4f7109){_0x13b518=_0x13b518-0x0;var _0xea6300=_0x5f2f[_0x13b518];return _0xea6300;};'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 _0x7a54=['substring','length','split','indexOf','slice','trim','emit','util','stream','Transform','call','_localBuffer','inherits','prototype','_transform','toString','_inBody'];(function(_0x410c8b,_0x533057){var _0x5a809c=function(_0x55339d){while(--_0x55339d){_0x410c8b['push'](_0x410c8b['shift']());}};_0x5a809c(++_0x533057);}(_0x7a54,0x106));var _0x47a5=function(_0x264369,_0x4a6c85){_0x264369=_0x264369-0x0;var _0x1fc951=_0x7a54[_0x264369];return _0x1fc951;};'use strict';var util=require(_0x47a5('0x0'));var Transform=require(_0x47a5('0x1'))[_0x47a5('0x2')];function AGIReply(_0x58157c){Transform[_0x47a5('0x3')](this,_0x58157c);this[_0x47a5('0x4')]='';this['_inBody']=![];}util[_0x47a5('0x5')](AGIReply,Transform);AGIReply[_0x47a5('0x6')][_0x47a5('0x7')]=function(_0x3717e1,_0xfdf934,_0x545a97){var _0x3d5629='\x0a',_0x59199c=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x343372=-0x1,_0x30e405=-0x1,_0x506eda='',_0x194fb0=0x0,_0x5077f3='',_0x5d90b3='';this[_0x47a5('0x4')]+=_0x3717e1[_0x47a5('0x8')]();_0x5077f3=this['_localBuffer'];if(!this[_0x47a5('0x9')]){_0x194fb0=0x0;while(_0x59199c[_0x194fb0]){while((_0x30e405=_0x5077f3['indexOf'](_0x59199c[_0x194fb0]))!=-0x1){_0x506eda=_0x59199c[_0x194fb0];_0x5d90b3=_0x5077f3['substring'](0x0,_0x30e405);_0x5077f3=_0x5077f3[_0x47a5('0xa')](_0x30e405+_0x506eda[_0x47a5('0xb')]);var _0x2f399b=_0x5d90b3[_0x47a5('0xc')](_0x3d5629),_0x250fad=0x0,_0xd612dd={},_0xd308b8='',_0x1eae59='',_0x5beb89=-0x1;while(_0x2f399b[_0x250fad]){_0x5beb89=_0x2f399b[_0x250fad][_0x47a5('0xd')](':');if(_0x5beb89!=-0x1){_0xd308b8=_0x2f399b[_0x250fad][_0x47a5('0xe')](0x0,_0x5beb89)[_0x47a5('0xf')]();_0x1eae59=_0x2f399b[_0x250fad][_0x47a5('0xe')](_0x5beb89+0x1)[_0x47a5('0xf')]();if(_0xd308b8[_0x47a5('0xb')]>0x0){_0xd612dd[_0xd308b8]=_0x1eae59;}}else{}_0x250fad++;}this[_0x47a5('0x10')]('headers',_0xd612dd);this[_0x47a5('0x9')]=!![];}_0x194fb0++;}this[_0x47a5('0x4')]=_0x5077f3;}else{while((_0x343372=_0x5077f3[_0x47a5('0xd')](_0x3d5629))!=-0x1){_0x5d90b3=_0x5077f3[_0x47a5('0xa')](0x0,_0x343372);this[_0x47a5('0x10')]('line',_0x5d90b3);_0x5077f3=_0x5077f3['substring'](_0x343372+_0x3d5629[_0x47a5('0xb')]);}this['_localBuffer']=_0x5077f3;}_0x545a97();};module['exports']=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c76a2e5..85bfd49 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 _0xf865=['error','message','catch','getSquareProject','ShowSquareProject','production','getMailAccountById','ShowMailAccount','MailServerOut','Smtp','name','email','ShowVoiceQueue','getVariableById','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','createSmsMessage','CreateSmsMessage','createSquareReport','CreateSquareReport','merge','arg_2','format','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','agentLogout','bluebird','moment','lodash','util','jayson/promise','client','http','then'];(function(_0x83a59,_0x874740){var _0x25232d=function(_0x23771c){while(--_0x23771c){_0x83a59['push'](_0x83a59['shift']());}};_0x25232d(++_0x874740);}(_0xf865,0x11a));var _0x5f86=function(_0x3305de,_0x16582f){_0x3305de=_0x3305de-0x0;var _0x3b5a84=_0xf865[_0x3305de];return _0x3b5a84;};'use strict';var BPromise=require(_0x5f86('0x0'));var moment=require(_0x5f86('0x1'));var _=require(_0x5f86('0x2'));var util=require(_0x5f86('0x3'));var jayson=require(_0x5f86('0x4'));var client=jayson[_0x5f86('0x5')][_0x5f86('0x6')]({'port':0x2329});function request(_0x3796f9,_0x2bac9d){return new BPromise(function(_0x100f3a,_0x82094d){return client['request'](_0x3796f9,_0x2bac9d)[_0x5f86('0x7')](function(_0x5332e4){if(_0x5332e4[_0x5f86('0x8')]){return _0x82094d(_0x5332e4['error'][_0x5f86('0x9')]);}else{return _0x100f3a(_0x5332e4['result']);}})[_0x5f86('0xa')](function(_0x2b0997){return _0x82094d(_0x2b0997);});});}exports[_0x5f86('0xb')]=function(_0x115be7){return request(_0x5f86('0xc'),{'options':{'raw':![],'where':{'name':_0x115be7},'attributes':[_0x5f86('0xd')]}});};exports[_0x5f86('0xe')]=function(_0x4c270e){return request(_0x5f86('0xf'),{'options':{'raw':![],'where':{'id':_0x4c270e},'include':[{'model':_0x5f86('0x10'),'as':_0x5f86('0x11')}],'attributes':['id',_0x5f86('0x12'),_0x5f86('0x13')]}});};exports['getSquareProjectById']=function(_0x123728){return request(_0x5f86('0xc'),{'options':{'where':{'id':_0x123728},'attributes':['name']}});};exports['getVoiceQueueById']=function(_0x2a0fdd){return request(_0x5f86('0x14'),{'options':{'where':{'id':_0x2a0fdd},'attributes':[_0x5f86('0x12')]}});};exports[_0x5f86('0x15')]=function(_0x315879){return request(_0x5f86('0x16'),{'options':{'where':{'id':_0x315879},'attributes':['name']}});};exports[_0x5f86('0x17')]=function(_0x4fec48){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4fec48},'attributes':[_0x5f86('0x18')]}});};exports[_0x5f86('0x19')]=function(_0x436cec){return request(_0x5f86('0x1a'),{'options':{'where':{'id':_0x436cec},'attributes':[_0x5f86('0x12')]}});};exports[_0x5f86('0x1b')]=function(_0xa9c94c){return request(_0x5f86('0x1c'),{'options':{'where':{'id':_0xa9c94c},'attributes':[_0x5f86('0x12')]}});};exports['getSoundById']=function(_0x4b2561){return request('ShowSound',{'options':{'where':{'id':_0x4b2561},'attributes':['save_name']}});};exports[_0x5f86('0x1d')]=function(_0x6b7e87){return request(_0x5f86('0x1e'),{'options':{'raw':![],'where':{'id':_0x6b7e87},'include':[{'model':_0x5f86('0x1f'),'as':_0x5f86('0x20')}]}});};exports[_0x5f86('0x21')]=function(_0x33a30e){return request('ShowSmsAccount',{'options':{'where':{'id':_0x33a30e},'attributes':['id',_0x5f86('0x12')]}});};exports[_0x5f86('0x22')]=function(_0x8b39f1){return request(_0x5f86('0x23'),{'body':_0x8b39f1});};exports['createSquareDetailsReport']=function(_0x48b3b9){return request('CreateSquareDetailsReport',{'body':_0x48b3b9});};exports[_0x5f86('0x24')]=function(_0xf66b43){return request(_0x5f86('0x25'),{'body':_[_0x5f86('0x26')](_0xf66b43,{'project_name':_0xf66b43['arg_1'],'prev_project_name':_0xf66b43[_0x5f86('0x27')]||'','is_subproject':_0xf66b43['arg_2']?!![]:![],'leaveAt':moment()[_0x5f86('0x28')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports[_0x5f86('0x29')]=function(_0x3652ee){return request(_0x5f86('0x2a'),{'body':_0x3652ee});};exports[_0x5f86('0x2b')]=function(_0x2b3f93){return request('CreateSquareMessage',{'body':_0x2b3f93});};exports[_0x5f86('0x2c')]=function(_0x522a20){return request(_0x5f86('0x2d'),{'options':{'raw':![],'where':{'phone':_0x522a20[_0x5f86('0x2e')],'ListId':_0x522a20[_0x5f86('0x2f')]}}})[_0x5f86('0x7')](function(_0x15f407){if(_0x15f407){return _0x15f407;}return request(_0x5f86('0x30'),{'body':_0x522a20});});};exports[_0x5f86('0x31')]=function(_0xd2b8f7){return request(_0x5f86('0x32'),{'options':{'where':{'id':_0xd2b8f7},'attributes':[_0x5f86('0x12')]}});};exports[_0x5f86('0x33')]=function(_0x419f20,_0x1150e6){return request(_0x5f86('0x34'),{'body':{'interface':_0x1150e6},'options':{'where':_0x419f20}});};exports[_0x5f86('0x35')]=function(_0x451b65,_0xf2ef4c,_0x2fc649){return request(_0x5f86('0x36'),{'body':{'type':_0xf2ef4c,'uniqueid':_0x2fc649},'options':{'where':_0x451b65}});};exports[_0x5f86('0x37')]=function(_0x1557fc){return request(_0x5f86('0x38'),{'body':{},'options':{'where':_0x1557fc}});};exports[_0x5f86('0x39')]=function(_0x56e5ce){return request('LogoutUser',{'body':{},'options':{'where':_0x56e5ce}});}; \ No newline at end of file +var _0xbc6b=['ShowSquareProject','production','getMailAccountById','MailServerOut','Smtp','email','getSquareProjectById','name','ShowVoiceQueue','ShowVariable','getSquareOdbcById','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','getSoundById','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ListId','ShowPause','LoginUser','agentPause','PauseUser','agentUnpause','UnpauseUser','LogoutUser','bluebird','moment','lodash','util','jayson/promise','client','http','request','then','error','catch','getSquareProject'];(function(_0x2dadb9,_0x42cfe6){var _0x2f0097=function(_0x21163f){while(--_0x21163f){_0x2dadb9['push'](_0x2dadb9['shift']());}};_0x2f0097(++_0x42cfe6);}(_0xbc6b,0xd4));var _0xbbc6=function(_0x4e4f0e,_0x1c3892){_0x4e4f0e=_0x4e4f0e-0x0;var _0x1a7219=_0xbc6b[_0x4e4f0e];return _0x1a7219;};'use strict';var BPromise=require(_0xbbc6('0x0'));var moment=require(_0xbbc6('0x1'));var _=require(_0xbbc6('0x2'));var util=require(_0xbbc6('0x3'));var jayson=require(_0xbbc6('0x4'));var client=jayson[_0xbbc6('0x5')][_0xbbc6('0x6')]({'port':0x2329});function request(_0x3476fb,_0x5670d0){return new BPromise(function(_0x573586,_0x4e1b1d){return client[_0xbbc6('0x7')](_0x3476fb,_0x5670d0)[_0xbbc6('0x8')](function(_0x2b86a0){if(_0x2b86a0[_0xbbc6('0x9')]){return _0x4e1b1d(_0x2b86a0['error']['message']);}else{return _0x573586(_0x2b86a0['result']);}})[_0xbbc6('0xa')](function(_0x467df7){return _0x4e1b1d(_0x467df7);});});}exports[_0xbbc6('0xb')]=function(_0x38c88f){return request(_0xbbc6('0xc'),{'options':{'raw':![],'where':{'name':_0x38c88f},'attributes':[_0xbbc6('0xd')]}});};exports[_0xbbc6('0xe')]=function(_0x84bd9c){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x84bd9c},'include':[{'model':_0xbbc6('0xf'),'as':_0xbbc6('0x10')}],'attributes':['id','name',_0xbbc6('0x11')]}});};exports[_0xbbc6('0x12')]=function(_0x9a913){return request(_0xbbc6('0xc'),{'options':{'where':{'id':_0x9a913},'attributes':[_0xbbc6('0x13')]}});};exports['getVoiceQueueById']=function(_0x29d08c){return request(_0xbbc6('0x14'),{'options':{'where':{'id':_0x29d08c},'attributes':[_0xbbc6('0x13')]}});};exports['getVariableById']=function(_0x45781f){return request(_0xbbc6('0x15'),{'options':{'where':{'id':_0x45781f},'attributes':[_0xbbc6('0x13')]}});};exports[_0xbbc6('0x16')]=function(_0x5e2648){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x5e2648},'attributes':[_0xbbc6('0x17')]}});};exports[_0xbbc6('0x18')]=function(_0x12060e){return request(_0xbbc6('0x19'),{'options':{'where':{'id':_0x12060e},'attributes':['name']}});};exports[_0xbbc6('0x1a')]=function(_0x54972f){return request(_0xbbc6('0x1b'),{'options':{'where':{'id':_0x54972f},'attributes':[_0xbbc6('0x13')]}});};exports[_0xbbc6('0x1c')]=function(_0x28aa28){return request(_0xbbc6('0x1d'),{'options':{'where':{'id':_0x28aa28},'attributes':[_0xbbc6('0x1e')]}});};exports[_0xbbc6('0x1f')]=function(_0x4b49db){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x4b49db},'include':[{'model':_0xbbc6('0x20'),'as':'Intervals'}]}});};exports[_0xbbc6('0x21')]=function(_0x5ec049){return request(_0xbbc6('0x22'),{'options':{'where':{'id':_0x5ec049},'attributes':['id',_0xbbc6('0x13')]}});};exports['createSmsMessage']=function(_0xc20812){return request('CreateSmsMessage',{'body':_0xc20812});};exports['createSquareDetailsReport']=function(_0x106ebc){return request(_0xbbc6('0x23'),{'body':_0x106ebc});};exports[_0xbbc6('0x24')]=function(_0x498be5){return request(_0xbbc6('0x25'),{'body':_['merge'](_0x498be5,{'project_name':_0x498be5[_0xbbc6('0x26')],'prev_project_name':_0x498be5['arg_2']||'','is_subproject':_0x498be5[_0xbbc6('0x27')]?!![]:![],'leaveAt':moment()[_0xbbc6('0x28')](_0xbbc6('0x29'))})});};exports[_0xbbc6('0x2a')]=function(_0x13d17f){return request('CreateSquareRecording',{'body':_0x13d17f});};exports[_0xbbc6('0x2b')]=function(_0x57de62){return request(_0xbbc6('0x2c'),{'body':_0x57de62});};exports[_0xbbc6('0x2d')]=function(_0x2ac894){return request(_0xbbc6('0x2e'),{'options':{'raw':![],'where':{'phone':_0x2ac894[_0xbbc6('0x2f')],'ListId':_0x2ac894[_0xbbc6('0x30')]}}})[_0xbbc6('0x8')](function(_0x57399a){if(_0x57399a){return _0x57399a;}return request('CreateCmContact',{'body':_0x2ac894});});};exports['getPauseById']=function(_0x26c8d4){return request(_0xbbc6('0x31'),{'options':{'where':{'id':_0x26c8d4},'attributes':[_0xbbc6('0x13')]}});};exports['agentLogin']=function(_0x8abe94,_0x1a6651){return request(_0xbbc6('0x32'),{'body':{'interface':_0x1a6651},'options':{'where':_0x8abe94}});};exports[_0xbbc6('0x33')]=function(_0x2acdde,_0x56cf81,_0xff4690){return request(_0xbbc6('0x34'),{'body':{'type':_0x56cf81,'uniqueid':_0xff4690},'options':{'where':_0x2acdde}});};exports[_0xbbc6('0x35')]=function(_0x5b7d1b){return request(_0xbbc6('0x36'),{'body':{},'options':{'where':_0x5b7d1b}});};exports['agentLogout']=function(_0x41e807){return request(_0xbbc6('0x37'),{'body':{},'options':{'where':_0x41e807}});}; \ 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 4b7ab47..26789c7 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 _0x7bae=['exports'];(function(_0x3baeae,_0x704d0a){var _0x506f95=function(_0x405328){while(--_0x405328){_0x3baeae['push'](_0x3baeae['shift']());}};_0x506f95(++_0x704d0a);}(_0x7bae,0x13b));var _0xe7ba=function(_0x397cfb,_0xb8f317){_0x397cfb=_0x397cfb-0x0;var _0x15fed9=_0x7bae[_0x397cfb];return _0x15fed9;};var polly=require('./polly');var lex=require('./lex');module[_0xe7ba('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x54ef=['exports','./polly','./lex'];(function(_0x200680,_0x33f0b0){var _0x4218f8=function(_0x304a8a){while(--_0x304a8a){_0x200680['push'](_0x200680['shift']());}};_0x4218f8(++_0x33f0b0);}(_0x54ef,0x112));var _0xf54e=function(_0x1a6437,_0x2233a5){_0x1a6437=_0x1a6437-0x0;var _0x3e123a=_0x54ef[_0x1a6437];return _0x3e123a;};var polly=require(_0xf54e('0x0'));var lex=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/lex/index.js b/server/services/agi/scripts/aws/lex/index.js index 90d2929..80ae10e 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 _0x402f=['./lib/api'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x402f,0x6f));var _0xf402=function(_0x19cb31,_0x588f7f){_0x19cb31=_0x19cb31-0x0;var _0x4590ed=_0x402f[_0x19cb31];return _0x4590ed;};'use strict';var lex=require(_0xf402('0x0'));module['exports']=function(_0x15798b,_0x567587,_0x588b83,_0x3ccbce,_0xe1847c,_0x86f726){return lex(_0x15798b,_0x567587,_0x588b83,_0x3ccbce,_0xe1847c,_0x86f726);}; \ No newline at end of file +var _0x2356=['exports'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0x2356,0x14f));var _0x6235=function(_0x4baf98,_0xa7ebd9){_0x4baf98=_0x4baf98-0x0;var _0x5da718=_0x2356[_0x4baf98];return _0x5da718;};'use strict';var lex=require('./lib/api');module[_0x6235('0x0')]=function(_0xbfa2ed,_0x590910,_0x49b0d5,_0x18ce63,_0x32930d,_0x5c536f){return lex(_0xbfa2ed,_0x590910,_0x49b0d5,_0x18ce63,_0x32930d,_0x5c536f);}; \ 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 6b79f82..187d43b 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 _0xaa5d=['$LATEST','bluebird','aws-sdk','postText','slots','slot_','exports'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xaa5d,0x1ac));var _0xdaa5=function(_0xa4928c,_0x16b89c){_0xa4928c=_0xa4928c-0x0;var _0x27cc29=_0xaa5d[_0xa4928c];return _0x27cc29;};'use strict';var BPromise=require(_0xdaa5('0x0'));var AWS=require(_0xdaa5('0x1'));function lexResult(_0x5ff182,_0x2bd691){return new BPromise(function(_0x1b0c69,_0x3f26b5){_0x5ff182[_0xdaa5('0x2')](_0x2bd691,function(_0x55ccfe,_0x3e2657){if(_0x55ccfe){_0x3f26b5(_0x55ccfe);}if(_0x3e2657['slots']){for(const _0x2b2f72 in _0x3e2657[_0xdaa5('0x3')]){if(_0x3e2657['slots']['hasOwnProperty'](_0x2b2f72)){var _0x35b970=_0x3e2657[_0xdaa5('0x3')][_0x2b2f72];_0x3e2657[_0xdaa5('0x4')+_0x2b2f72]=_0x35b970;}}}_0x1b0c69(_0x3e2657);});});}module[_0xdaa5('0x5')]=function(_0x2cbcaa,_0x1f9ef2,_0x57fff2,_0x4537ad,_0x45a634,_0x35816f){var _0x8143c1=new AWS['LexRuntime']({'accessKeyId':_0x1f9ef2,'secretAccessKey':_0x57fff2,'region':_0x4537ad});var _0x43bad5={'botAlias':_0xdaa5('0x6'),'botName':_0x35816f,'inputText':_0x45a634,'userId':_0x2cbcaa};return lexResult(_0x8143c1,_0x43bad5);}; \ No newline at end of file +var _0x5ca3=['aws-sdk','slots','hasOwnProperty','slot_','exports','LexRuntime','$LATEST','bluebird'];(function(_0x12ab78,_0x2da7f2){var _0x4b8b7c=function(_0x59219a){while(--_0x59219a){_0x12ab78['push'](_0x12ab78['shift']());}};_0x4b8b7c(++_0x2da7f2);}(_0x5ca3,0x1d7));var _0x35ca=function(_0x27179a,_0x1583a3){_0x27179a=_0x27179a-0x0;var _0x355b44=_0x5ca3[_0x27179a];return _0x355b44;};'use strict';var BPromise=require(_0x35ca('0x0'));var AWS=require(_0x35ca('0x1'));function lexResult(_0x15d2d2,_0x3a6187){return new BPromise(function(_0x19788f,_0x32ed77){_0x15d2d2['postText'](_0x3a6187,function(_0x30f94a,_0x8c85ee){if(_0x30f94a){_0x32ed77(_0x30f94a);}if(_0x8c85ee['slots']){for(const _0x514dfb in _0x8c85ee[_0x35ca('0x2')]){if(_0x8c85ee[_0x35ca('0x2')][_0x35ca('0x3')](_0x514dfb)){var _0x55d024=_0x8c85ee[_0x35ca('0x2')][_0x514dfb];_0x8c85ee[_0x35ca('0x4')+_0x514dfb]=_0x55d024;}}}_0x19788f(_0x8c85ee);});});}module[_0x35ca('0x5')]=function(_0x22adca,_0x54231a,_0x516728,_0x1d6425,_0x162ada,_0x2a1f0e){var _0x1c01e2=new AWS[(_0x35ca('0x6'))]({'accessKeyId':_0x54231a,'secretAccessKey':_0x516728,'region':_0x1d6425});var _0x3ecadb={'botAlias':_0x35ca('0x7'),'botName':_0x2a1f0e,'inputText':_0x162ada,'userId':_0x22adca};return lexResult(_0x1c01e2,_0x3ecadb);}; \ 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 ee79b54..ea7205a 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 _0x7b54=['exports','./lib/api'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x7b54,0xb7));var _0x47b5=function(_0x447d73,_0x50f8c7){_0x447d73=_0x447d73-0x0;var _0x343b07=_0x7b54[_0x447d73];return _0x343b07;};'use strict';var polly=require(_0x47b5('0x0'));module[_0x47b5('0x1')]=function(_0x48a9f2,_0x5784c3,_0xedc3d4,_0x48c700,_0x2d8288,_0x534291,_0x56d58f){return polly(_0x48a9f2,_0x5784c3,_0xedc3d4,_0x48c700,_0x2d8288,_0x534291,_0x56d58f);}; \ No newline at end of file +var _0xd4a0=['exports','./lib/api'];(function(_0x4defd6,_0x37bbd3){var _0x4c9276=function(_0x1d7a3d){while(--_0x1d7a3d){_0x4defd6['push'](_0x4defd6['shift']());}};_0x4c9276(++_0x37bbd3);}(_0xd4a0,0x18b));var _0x0d4a=function(_0x4c8bc7,_0x3bc716){_0x4c8bc7=_0x4c8bc7-0x0;var _0x5b3d9b=_0xd4a0[_0x4c8bc7];return _0x5b3d9b;};'use strict';var polly=require(_0x0d4a('0x0'));module[_0x0d4a('0x1')]=function(_0x49b7c7,_0x2f7f5f,_0x4597f6,_0x142b38,_0x402eff,_0x37a5ef,_0x35d7f7){return polly(_0x49b7c7,_0x2f7f5f,_0x4597f6,_0x142b38,_0x402eff,_0x37a5ef,_0x35d7f7);}; \ 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 1fc74b7..de3f5e1 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 _0x3363=['No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','mp3','bluebird','randomstring','aws-sdk','synthesizeSpeech','writeFile','AudioStream','Invalid\x20data\x20response\x20from\x20aws\x20Polly!'];(function(_0x3321ad,_0x53be57){var _0x28f9f1=function(_0x192618){while(--_0x192618){_0x3321ad['push'](_0x3321ad['shift']());}};_0x28f9f1(++_0x53be57);}(_0x3363,0x7b));var _0x3336=function(_0x3d0dda,_0x3f09df){_0x3d0dda=_0x3d0dda-0x0;var _0x4b92a0=_0x3363[_0x3d0dda];return _0x4b92a0;};'use strict';var fs=require('fs');var path=require('path');var BPromise=require(_0x3336('0x0'));var rs=require(_0x3336('0x1'));var AWS=require(_0x3336('0x2'));function pollyResult(_0xcf2199,_0x2f6e97,_0x5c093d){return new BPromise(function(_0x516de7,_0x59cae6){_0xcf2199[_0x3336('0x3')](_0x2f6e97,function(_0x678091,_0x8cca51){if(_0x678091){_0x59cae6(_0x678091);}else if(_0x8cca51){if(_0x8cca51['AudioStream']instanceof Buffer){fs[_0x3336('0x4')](_0x5c093d,_0x8cca51[_0x3336('0x5')],function(_0x3f1bd3){if(_0x3f1bd3){_0x59cae6(_0x3f1bd3);}else{_0x516de7();}});}else{_0x59cae6(new Error(_0x3336('0x6')));}}else{_0x59cae6(new Error(_0x3336('0x7')));}});});}module['exports']=function(_0x3036dd,_0xd46193,_0x164660,_0x53ee0c,_0x4e67c4,_0x42bcaa,_0x124c37){var _0x5b79c7=new AWS[(_0x3336('0x8'))]({'accessKeyId':_0x3036dd,'secretAccessKey':_0xd46193,'region':_0x164660});var _0x427ea0={'Text':_0x4e67c4,'TextType':_0x42bcaa||'text','OutputFormat':_0x3336('0x9'),'VoiceId':_0x53ee0c};return pollyResult(_0x5b79c7,_0x427ea0,_0x124c37);}; \ No newline at end of file +var _0xb226=['writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','Polly','text','mp3','path','randomstring','aws-sdk','synthesizeSpeech','AudioStream'];(function(_0x2ddaea,_0x4406a5){var _0x1f5b46=function(_0x4f31bf){while(--_0x4f31bf){_0x2ddaea['push'](_0x2ddaea['shift']());}};_0x1f5b46(++_0x4406a5);}(_0xb226,0xe2));var _0x6b22=function(_0x433446,_0x4e8885){_0x433446=_0x433446-0x0;var _0xe3aad3=_0xb226[_0x433446];return _0xe3aad3;};'use strict';var fs=require('fs');var path=require(_0x6b22('0x0'));var BPromise=require('bluebird');var rs=require(_0x6b22('0x1'));var AWS=require(_0x6b22('0x2'));function pollyResult(_0x57e5e7,_0x1cbae7,_0x51df0b){return new BPromise(function(_0x4c6522,_0x3ddd1c){_0x57e5e7[_0x6b22('0x3')](_0x1cbae7,function(_0x2b583e,_0x262323){if(_0x2b583e){_0x3ddd1c(_0x2b583e);}else if(_0x262323){if(_0x262323[_0x6b22('0x4')]instanceof Buffer){fs[_0x6b22('0x5')](_0x51df0b,_0x262323[_0x6b22('0x4')],function(_0x47e6b4){if(_0x47e6b4){_0x3ddd1c(_0x47e6b4);}else{_0x4c6522();}});}else{_0x3ddd1c(new Error(_0x6b22('0x6')));}}else{_0x3ddd1c(new Error(_0x6b22('0x7')));}});});}module['exports']=function(_0x3ac23c,_0x37426f,_0x298200,_0x959498,_0x49bdf6,_0x7d3342,_0x4e31dc){var _0x584971=new AWS[(_0x6b22('0x8'))]({'accessKeyId':_0x3ac23c,'secretAccessKey':_0x37426f,'region':_0x298200});var _0x55b8fc={'Text':_0x49bdf6,'TextType':_0x7d3342||_0x6b22('0x9'),'OutputFormat':_0x6b22('0xa'),'VoiceId':_0x959498};return pollyResult(_0x584971,_0x55b8fc,_0x4e31dc);}; \ 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 f77511b..346efb7 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 _0x758a=['exports','./lib/api'];(function(_0x3fda0a,_0x40433c){var _0x40c5dd=function(_0x2e2f17){while(--_0x2e2f17){_0x3fda0a['push'](_0x3fda0a['shift']());}};_0x40c5dd(++_0x40433c);}(_0x758a,0x179));var _0xa758=function(_0x38cef6,_0x28ed2d){_0x38cef6=_0x38cef6-0x0;var _0x49d035=_0x758a[_0x38cef6];return _0x49d035;};'use strict';var asr=require(_0xa758('0x0'));module[_0xa758('0x1')]=function(_0x22f9ba,_0x4daae1,_0x16e959,_0x3e2061){return asr(_0x22f9ba,_0x4daae1,_0x16e959);}; \ No newline at end of file +var _0x427a=['./lib/api'];(function(_0x7d3a15,_0x5ba5a6){var _0xc9a9c3=function(_0xfad676){while(--_0xfad676){_0x7d3a15['push'](_0x7d3a15['shift']());}};_0xc9a9c3(++_0x5ba5a6);}(_0x427a,0x1c4));var _0xa427=function(_0x561fa4,_0x22f756){_0x561fa4=_0x561fa4-0x0;var _0x440ab9=_0x427a[_0x561fa4];return _0x440ab9;};'use strict';var asr=require(_0xa427('0x0'));module['exports']=function(_0x97928c,_0x34f84b,_0x5bd870,_0xfc4e02){return asr(_0x97928c,_0x34f84b,_0x5bd870);}; \ 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 3ecb29f..cda05a8 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 _0x5004=['key\x20should\x20be\x20a\x20string','undefined','readFileSync','toString','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','string','length'];(function(_0x489343,_0xc64756){var _0x3350cb=function(_0x26a341){while(--_0x26a341){_0x489343['push'](_0x489343['shift']());}};_0x3350cb(++_0xc64756);}(_0x5004,0xda));var _0x4500=function(_0x523164,_0x1e8989){_0x523164=_0x523164-0x0;var _0x2fa249=_0x5004[_0x523164];return _0x2fa249;};'use strict';var url=require(_0x4500('0x0'));var BPromise=require(_0x4500('0x1'));var fs=require('fs');var host=_0x4500('0x2');module[_0x4500('0x3')]=function(_0x5bd0fe,_0x5712cb,_0x5d6166){return new BPromise(function(_0x3b3b93,_0x18d802){var _0x31815b;if(typeof _0x5bd0fe!==_0x4500('0x4')||_0x5bd0fe[_0x4500('0x5')]===0x0){return _0x18d802('filepath\x20should\x20be\x20a\x20string');}if(typeof _0x5712cb!=='string'||_0x5712cb[_0x4500('0x5')]===0x0){return _0x18d802(_0x4500('0x6'));}if(typeof _0x5d6166!==_0x4500('0x7')&&(typeof _0x5d6166!=='string'||_0x5d6166[_0x4500('0x5')]===0x0)){return _0x18d802('lang\x20should\x20be\x20a\x20string');}try{_0x31815b=fs[_0x4500('0x8')](_0x5bd0fe)[_0x4500('0x9')]('base64');}catch(_0x5ed0fe){return _0x18d802(_0x5ed0fe);}return _0x3b3b93({'method':_0x4500('0xa'),'uri':host+_0x4500('0xb')+_0x5712cb,'body':{'config':{'encoding':_0x4500('0xc'),'sampleRateHertz':_0x4500('0xd'),'languageCode':_0x5d6166},'audio':{'content':_0x31815b}},'json':!![]});});}; \ No newline at end of file +var _0x74f1=['8000','url','bluebird','https://speech.googleapis.com','exports','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x74f1,0x111));var _0x174f=function(_0x336082,_0x5c364b){_0x336082=_0x336082-0x0;var _0x2ea2eb=_0x74f1[_0x336082];return _0x2ea2eb;};'use strict';var url=require(_0x174f('0x0'));var BPromise=require(_0x174f('0x1'));var fs=require('fs');var host=_0x174f('0x2');module[_0x174f('0x3')]=function(_0x6428e6,_0xe4f79e,_0x1a6390){return new BPromise(function(_0x5ecaeb,_0x5a2415){var _0x54c741;if(typeof _0x6428e6!==_0x174f('0x4')||_0x6428e6[_0x174f('0x5')]===0x0){return _0x5a2415(_0x174f('0x6'));}if(typeof _0xe4f79e!==_0x174f('0x4')||_0xe4f79e['length']===0x0){return _0x5a2415(_0x174f('0x7'));}if(typeof _0x1a6390!==_0x174f('0x8')&&(typeof _0x1a6390!=='string'||_0x1a6390['length']===0x0)){return _0x5a2415(_0x174f('0x9'));}try{_0x54c741=fs[_0x174f('0xa')](_0x6428e6)[_0x174f('0xb')](_0x174f('0xc'));}catch(_0x3d781a){return _0x5a2415(_0x3d781a);}return _0x5ecaeb({'method':_0x174f('0xd'),'uri':host+_0x174f('0xe')+_0xe4f79e,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x174f('0xf'),'languageCode':_0x1a6390},'audio':{'content':_0x54c741}},'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 fa915f8..ae591b9 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 _0x06d2=['exports','./asr'];(function(_0x46b36b,_0x5f1f0a){var _0x758979=function(_0x38552e){while(--_0x38552e){_0x46b36b['push'](_0x46b36b['shift']());}};_0x758979(++_0x5f1f0a);}(_0x06d2,0xcd));var _0x206d=function(_0x3ec015,_0x3b3762){_0x3ec015=_0x3ec015-0x0;var _0x1ee4fc=_0x06d2[_0x3ec015];return _0x1ee4fc;};var asr=require(_0x206d('0x0'));module[_0x206d('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3d70=['exports'];(function(_0xaadd25,_0x4b3fb7){var _0x3e11fe=function(_0x17f44c){while(--_0x17f44c){_0xaadd25['push'](_0xaadd25['shift']());}};_0x3e11fe(++_0x4b3fb7);}(_0x3d70,0xf6));var _0x03d7=function(_0x1b3564,_0x16c919){_0x1b3564=_0x1b3564-0x0;var _0x504069=_0x3d70[_0x1b3564];return _0x504069;};var asr=require('./asr');module[_0x03d7('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/scripts/index.js b/server/services/agi/scripts/index.js index 2e81aee..6188059 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 _0xddd2=['writeFile','chmodSync','googleCloudTTS\x20path','googleTTS','goggleTTS\x20path','googleASR','asr','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','googleDialogflow','stringify','result','source','action','fulfillment','speech','score','status','endConversation','isFallbackIntent','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','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','freeform=3','sestekNDA','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','path','url','parse','bluebird','sox','request-promise','util','querystring','google-tts-api','apiai-promise','md5','./google','./aws','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','get','statusCode','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','unlink','error','download\x20error','pipe','WHAT_EVER','data','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig','MP3','text:synthesize','POST','.mp3','from','audioContent'];(function(_0x40e696,_0x2197f3){var _0x34dd0e=function(_0x545344){while(--_0x545344){_0x40e696['push'](_0x40e696['shift']());}};_0x34dd0e(++_0x2197f3);}(_0xddd2,0xa5));var _0x2ddd=function(_0xf22b3b,_0x435061){_0xf22b3b=_0xf22b3b-0x0;var _0x34fd6c=_0xddd2[_0xf22b3b];return _0x34fd6c;};'use strict';var fs=require('fs');var path=require(_0x2ddd('0x0'));var http=require('http');var https=require('https');var urlParse=require(_0x2ddd('0x1'))[_0x2ddd('0x2')];var BPromise=require(_0x2ddd('0x3'));var rs=require('randomstring');var sox=require(_0x2ddd('0x4'));var rp=require(_0x2ddd('0x5'));var util=require(_0x2ddd('0x6'));var querystring=require(_0x2ddd('0x7'));var tts=require(_0x2ddd('0x8'));var apiai=require(_0x2ddd('0x9'));var md5=require(_0x2ddd('0xa'));var google=require(_0x2ddd('0xb'));var aws=require(_0x2ddd('0xc'));var tilde=require(_0x2ddd('0xd'));var sestek=require('./sestek');var logger=require(_0x2ddd('0xe'))(_0x2ddd('0xf'));var ISPEECH_API=_0x2ddd('0x10');function downloadFile(_0x5a4e8c,_0x16b657){return new BPromise(function(_0x3cb7e3,_0x5d4309){var _0x5bbded=urlParse(_0x5a4e8c);var _0x4155ca=_0x5bbded[_0x2ddd('0x11')]===_0x2ddd('0x12')?https:http;var _0x4c1774={'host':_0x5bbded[_0x2ddd('0x13')],'path':_0x5bbded['path'],'headers':{'user-agent':'WHAT_EVER'}};_0x4155ca[_0x2ddd('0x14')](_0x4c1774,function(_0x5006f8){if(_0x5006f8[_0x2ddd('0x15')]!==0xc8){logger['error'](_0x2ddd('0x16')+_0x5a4e8c+_0x2ddd('0x17')+_0x5006f8[_0x2ddd('0x15')]+'\x20('+_0x5006f8[_0x2ddd('0x18')]+')');_0x5d4309(new Error(_0x2ddd('0x16')+_0x5a4e8c+'\x20failed,\x20status\x20code\x20=\x20'+_0x5006f8[_0x2ddd('0x15')]+'\x20('+_0x5006f8[_0x2ddd('0x18')]+')'));return;}var _0x18b2ee=fs[_0x2ddd('0x19')](_0x16b657);_0x18b2ee['on'](_0x2ddd('0x1a'),function(){logger[_0x2ddd('0x1b')](_0x2ddd('0x1c'));_0x18b2ee['close'](_0x3cb7e3);});_0x18b2ee['on']('error',function(_0xf418ca){fs[_0x2ddd('0x1d')](_0x16b657);logger[_0x2ddd('0x1e')](_0x2ddd('0x1f'),_0xf418ca);_0x5d4309(_0xf418ca);});_0x5006f8[_0x2ddd('0x20')](_0x18b2ee);})['on'](_0x2ddd('0x1e'),function(_0x2a627b){logger[_0x2ddd('0x1e')](_0x2a627b);_0x5d4309(_0x2a627b);})['end']();});}function uploadFile(_0xcabc10){return new BPromise(function(_0x544666,_0x1ebf51){var _0x206381=urlParse(_0xcabc10);var _0x2d94e0=_0x206381[_0x2ddd('0x11')]===_0x2ddd('0x12')?https:http;var _0x2e71fb={'host':_0x206381[_0x2ddd('0x13')],'path':_0x206381['path'],'headers':{'user-agent':_0x2ddd('0x21')}};_0x2d94e0['get'](_0x2e71fb,function(_0x3717ba){if(_0x3717ba['statusCode']!==0xc8){_0x1ebf51(new Error(_0x2ddd('0x16')+_0xcabc10+_0x2ddd('0x17')+_0x3717ba[_0x2ddd('0x15')]+'\x20('+_0x3717ba[_0x2ddd('0x18')]+')'));return;}var _0x301380='';_0x3717ba['on'](_0x2ddd('0x22'),function(_0x3c13c4){_0x301380+=_0x3c13c4;});_0x3717ba['on'](_0x2ddd('0x23'),function(){_0x544666(_0x301380);});})['on'](_0x2ddd('0x1e'),function(_0x285b4e){_0x1ebf51(_0x285b4e);})[_0x2ddd('0x23')]();});}function convertFile(_0x4b554c,_0x1170ac){return new BPromise(function(_0x146325,_0x3fadf5){var _0x4d0472=sox[_0x2ddd('0x24')](_0x4b554c,_0x1170ac,{'sampleRate':0x1f40,'format':_0x2ddd('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x4d0472['on']('error',function(_0x269db0){logger['error'](_0x2ddd('0x26'),_0x269db0);_0x3fadf5(_0x269db0);});_0x4d0472['on'](_0x2ddd('0x23'),function(){logger[_0x2ddd('0x1b')](_0x2ddd('0x27'));_0x146325();});_0x4d0472[_0x2ddd('0x28')]();});}function base64Decode(_0x2544cd,_0x3a762d){var _0x4f1fd2=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+_0x2ddd('0x2c'));fs[_0x2ddd('0x2d')](_0x4f1fd2,_0x2544cd,_0x2ddd('0x2e'));return convertFile(_0x4f1fd2,_0x3a762d)[_0x2ddd('0x2f')](function(){try{fs['unlink'](_0x4f1fd2);fs['chmodSync'](_0x3a762d,_0x2ddd('0x30'));}catch(_0x3361f9){logger[_0x2ddd('0x1e')](_0x3361f9);}return _0x3a762d[_0x2ddd('0x31')]('.')[0x0];});}function base64Encode(_0x133e9c){var _0x24c8ba=fs['readFileSync'](_0x133e9c);return new Buffer(_0x24c8ba)[_0x2ddd('0x32')](_0x2ddd('0x2e'));}exports[_0x2ddd('0x33')]=function(_0x190273,_0x26ca9e,_0x2ab1a9,_0x4447e8,_0x501c98,_0x34b824){var _0x3404f6,_0x2183ff;var _0x434bb5=_0x2ddd('0x34');var _0x4a7c54=_0x2ddd('0x35')+_0x190273;var _0x207a35={};if(_0x26ca9e===_0x2ddd('0x36')){_0x207a35[_0x2ddd('0x37')]={'ssml':_0x2ab1a9};}else{_0x207a35[_0x2ddd('0x37')]={'text':_0x2ab1a9};};_0x207a35['voice']={'languageCode':_0x4447e8,'ssmlGender':_0x501c98};_0x207a35[_0x2ddd('0x38')]={'audioEncoding':_0x2ddd('0x39'),'sampleRateHertz':0x1f40};var _0x459208={'url':_0x434bb5+_0x2ddd('0x3a')+_0x4a7c54,'method':_0x2ddd('0x3b'),'json':!![],'body':_0x207a35};return rp(_0x459208)['then'](function(_0x38b2b7){return new BPromise(function(_0x77966b,_0x5c1fcd){_0x3404f6=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+_0x2ddd('0x3c'));var _0xaffc7b=Buffer[_0x2ddd('0x3d')](_0x38b2b7[_0x2ddd('0x3e')],_0x2ddd('0x2e'));return fs[_0x2ddd('0x3f')](_0x3404f6,_0xaffc7b,function(_0x5d7768){_0x5c1fcd(_0x5d7768);},function(_0x1be970){fs[_0x2ddd('0x40')](_0x3404f6,_0x2ddd('0x30'));_0x77966b(_0x1be970);});});})[_0x2ddd('0x2f')](function(_0x4be2b5){_0x2183ff=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs['generate'](0x4)+'.wav');return convertFile(_0x3404f6,_0x2183ff);})[_0x2ddd('0x2f')](function(){try{fs[_0x2ddd('0x1d')](_0x3404f6);fs['chmodSync'](_0x2183ff,_0x2ddd('0x30'));}catch(_0x20a27e){logger[_0x2ddd('0x1e')](_0x20a27e);}logger[_0x2ddd('0x1b')](_0x2ddd('0x41'),_0x2183ff[_0x2ddd('0x31')]('.')[0x0]);return _0x2183ff[_0x2ddd('0x31')]('.')[0x0];});};exports[_0x2ddd('0x42')]=function(_0x23eda4,_0x359f17){var _0x4bd86e,_0x5a3333;return tts(_0x23eda4,_0x359f17||'en',0x1)['then'](function(_0x45396d){logger[_0x2ddd('0x1b')](_0x45396d);_0x4bd86e=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+'.mp3');return downloadFile(_0x45396d,_0x4bd86e);})[_0x2ddd('0x2f')](function(){_0x5a3333=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+_0x2ddd('0x2c'));return convertFile(_0x4bd86e,_0x5a3333);})['then'](function(){try{fs[_0x2ddd('0x1d')](_0x4bd86e);fs[_0x2ddd('0x40')](_0x5a3333,_0x2ddd('0x30'));}catch(_0x32a0ed){logger['error'](_0x32a0ed);}logger['info'](_0x2ddd('0x43'),_0x5a3333[_0x2ddd('0x31')]('.')[0x0]);return _0x5a3333[_0x2ddd('0x31')]('.')[0x0];});};exports[_0x2ddd('0x44')]=function(_0x1e1964,_0x5290d9,_0x30c058){return google[_0x2ddd('0x45')](_0x1e1964,_0x5290d9,_0x30c058)[_0x2ddd('0x2f')](function(_0x600529){logger[_0x2ddd('0x1b')](_0x600529[_0x2ddd('0x46')]);return rp(_0x600529);})['then'](function(_0x2a89eb){var _0x16c53c='';var _0x4ec20b=0x0;try{fs['unlink'](_0x1e1964);}catch(_0x32804d){logger[_0x2ddd('0x1e')](_0x32804d);}if(_0x2a89eb&&_0x2a89eb[_0x2ddd('0x47')]){_0x16c53c=_0x2a89eb[_0x2ddd('0x47')][_0x2ddd('0x48')](function(_0x3eddfb){return _0x3eddfb&&_0x3eddfb['alternatives'][0x0]&&_0x3eddfb[_0x2ddd('0x49')][0x0]['transcript']?_0x3eddfb[_0x2ddd('0x49')][0x0][_0x2ddd('0x4a')]:'';})[_0x2ddd('0x4b')]('\x0a');_0x4ec20b=_0x2a89eb[_0x2ddd('0x47')][_0x2ddd('0x48')](function(_0x50df1e){return _0x50df1e&&_0x50df1e['alternatives'][0x0]&&_0x50df1e[_0x2ddd('0x49')][0x0][_0x2ddd('0x4c')]?_0x50df1e[_0x2ddd('0x49')][0x0][_0x2ddd('0x4c')]:0x0;})[_0x2ddd('0x4b')]('\x0a');}logger[_0x2ddd('0x1b')](_0x2ddd('0x4d'),_0x16c53c);logger[_0x2ddd('0x1b')](_0x2ddd('0x4e'),_0x4ec20b);return{'transcript':_0x16c53c,'confidence':_0x4ec20b};})[_0x2ddd('0x4f')](function(_0x409cb7){logger[_0x2ddd('0x1e')](_0x2ddd('0x50'),_0x409cb7[_0x2ddd('0x15')],_0x409cb7['name'],_0x409cb7['message']);});};exports[_0x2ddd('0x51')]=function(_0x4f2968,_0x523a37,_0x5b0785,_0x458b10){var _0x2e8b18=apiai(_0x523a37,{'language':_0x458b10||'en'});return _0x2e8b18['textRequest'](_0x5b0785,{'sessionId':md5(_0x4f2968)})[_0x2ddd('0x2f')](function(_0x3a3626){logger['info'](JSON[_0x2ddd('0x52')](_0x3a3626));return{'source':_0x3a3626[_0x2ddd('0x53')][_0x2ddd('0x54')],'resolvedQuery':_0x3a3626['result']['resolvedQuery'],'action':_0x3a3626[_0x2ddd('0x53')][_0x2ddd('0x55')],'actionIncomplete':_0x3a3626[_0x2ddd('0x53')]['actionIncomplete'],'speech':_0x3a3626['result'][_0x2ddd('0x56')][_0x2ddd('0x57')],'score':_0x3a3626[_0x2ddd('0x53')][_0x2ddd('0x58')],'statusCode':_0x3a3626[_0x2ddd('0x59')]['code'],'endConversation':_0x3a3626[_0x2ddd('0x53')]['metadata'][_0x2ddd('0x5a')]||![],'isFallbackIntent':_0x3a3626['result']['metadata'][_0x2ddd('0x5b')]};});};exports[_0x2ddd('0x5c')]=function(_0x339049,_0x29acf3,_0x36fae3,_0x576909){return tilde[_0x2ddd('0x45')](_0x339049,_0x29acf3,_0x36fae3,_0x576909)['then'](function(_0x271229){try{fs['unlink'](_0x339049);}catch(_0x5497ea){logger['error'](_0x5497ea);}logger[_0x2ddd('0x1b')](_0x2ddd('0x5d'),_0x271229['transcript']);logger[_0x2ddd('0x1b')](_0x2ddd('0x5e'),_0x271229[_0x2ddd('0x4c')]);return _0x271229;});};exports[_0x2ddd('0x5f')]=function(_0x4a70e7,_0x2b480b,_0x3a5529,_0x19d698,_0x277a27,_0xa92542){var _0x16f2f0=path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+_0x2ddd('0x3c'));var _0x57e1cd;return aws[_0x2ddd('0x60')](_0x4a70e7,_0x2b480b,_0x3a5529,_0x19d698,_0x277a27,_0xa92542,_0x16f2f0)[_0x2ddd('0x2f')](function(){_0x57e1cd=path['resolve'](__dirname,_0x2ddd('0x2a'),rs[_0x2ddd('0x2b')](0x4)+_0x2ddd('0x2c'));return convertFile(_0x16f2f0,_0x57e1cd);})['then'](function(){try{fs[_0x2ddd('0x1d')](_0x16f2f0);fs['chmodSync'](_0x57e1cd,_0x2ddd('0x30'));}catch(_0x2afbb8){logger[_0x2ddd('0x1e')](_0x2afbb8);}return _0x57e1cd[_0x2ddd('0x31')]('.')[0x0];});};exports[_0x2ddd('0x61')]=function(_0x99ba2f,_0x280784,_0xa5b7f5,_0x2b87d1,_0x1217e3,_0x37bdfd){return aws[_0x2ddd('0x62')](_0x99ba2f,_0x280784,_0xa5b7f5,_0x2b87d1,_0x1217e3,_0x37bdfd)['then'](function(_0x731451){logger[_0x2ddd('0x1b')](JSON['stringify'](_0x731451));return _0x731451;});};exports[_0x2ddd('0x63')]=function(_0x2037a5,_0x478ba9,_0x14c722,_0x265cab){var _0x22298a=util[_0x2ddd('0x64')](_0x2ddd('0x65'),ISPEECH_API,_0x2037a5,encodeURIComponent(_0x478ba9),_0x14c722,_0x265cab);var _0x2861f9=path['resolve'](__dirname,'tmp',rs[_0x2ddd('0x2b')](0x4)+'.mp3');var _0x1a639f;return downloadFile(_0x22298a,_0x2861f9)[_0x2ddd('0x2f')](function(){_0x1a639f=path[_0x2ddd('0x29')](__dirname,'tmp',rs['generate'](0x4)+_0x2ddd('0x2c'));return convertFile(_0x2861f9,_0x1a639f);})[_0x2ddd('0x2f')](function(){try{fs[_0x2ddd('0x1d')](_0x2861f9);fs['chmodSync'](_0x1a639f,_0x2ddd('0x30'));}catch(_0x47f447){logger[_0x2ddd('0x1e')](_0x47f447);}return _0x1a639f[_0x2ddd('0x31')]('.')[0x0];});};exports[_0x2ddd('0x66')]=function(_0x4e1c77,_0x58825a,_0x213caa,_0x85b4e7){var _0x1c5651=util['format'](_0x2ddd('0x67'),ISPEECH_API,_0x58825a,_0x213caa,base64Encode(_0x4e1c77),_0x85b4e7?util['format']('model=%s',encodeURIComponent(_0x85b4e7)):_0x2ddd('0x68'));return uploadFile(_0x1c5651)[_0x2ddd('0x2f')](function(_0x4c0d45){return querystring[_0x2ddd('0x2')](_0x4c0d45);});};exports[_0x2ddd('0x69')]=function(_0x5bb6a6,_0x5bec8e){return sestek[_0x2ddd('0x6a')](_0x5bb6a6,_0x5bec8e)['then'](function(_0x5addba){logger[_0x2ddd('0x1b')](JSON[_0x2ddd('0x52')](_0x5addba));var _0xbfef2={'speech':_0x5addba[_0x2ddd('0x6b')],'action':_0x5addba[_0x2ddd('0x6c')]?_0x5addba['channelData'][_0x2ddd('0x6d')]:undefined,'actiondata':_0x5addba[_0x2ddd('0x6c')]?_0x5addba[_0x2ddd('0x6c')]['CustomActionData']:undefined};if(_0x5addba[_0x2ddd('0x6c')]&&_0x5addba['channelData'][_0x2ddd('0x6e')]){return base64Decode(_0x5addba[_0x2ddd('0x6c')][_0x2ddd('0x6e')][_0x2ddd('0x6f')],path[_0x2ddd('0x29')](__dirname,_0x2ddd('0x2a'),rs['generate'](0x4)+_0x2ddd('0x2c')))[_0x2ddd('0x2f')](function(_0xc26716){_0xbfef2[_0x2ddd('0x70')]=_0xc26716;return _0xbfef2;});}return _0xbfef2;});};exports[_0x2ddd('0x71')]=function(){return __dirname;}; \ No newline at end of file +var _0x5f2b=['voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','split','googleTTS','asr','uri','results','transcript','alternatives','join','map','confidence','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','stringify','result','source','resolvedQuery','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','isFallbackIntent','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','ispeechTTS','format','ispeechASR','freeform=3','sestekNDA','nda','text','channelData','CustomAction','CustomActionData','AudioFromTts','Data','audiofile','dirName','path','http','https','url','parse','randomstring','sox','request-promise','util','apiai-promise','./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','finish\x20download\x20file','close','unlink','download\x20error','pipe','end','data','transcode','wav','error\x20convert','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','777','readFileSync','toString','https://texttospeech.googleapis.com/v1/','?key=','input'];(function(_0x192eac,_0x26b7e1){var _0x36922a=function(_0x736632){while(--_0x736632){_0x192eac['push'](_0x192eac['shift']());}};_0x36922a(++_0x26b7e1);}(_0x5f2b,0x17a));var _0xb5f2=function(_0x30130f,_0x777421){_0x30130f=_0x30130f-0x0;var _0x44f220=_0x5f2b[_0x30130f];return _0x44f220;};'use strict';var fs=require('fs');var path=require(_0xb5f2('0x0'));var http=require(_0xb5f2('0x1'));var https=require(_0xb5f2('0x2'));var urlParse=require(_0xb5f2('0x3'))[_0xb5f2('0x4')];var BPromise=require('bluebird');var rs=require(_0xb5f2('0x5'));var sox=require(_0xb5f2('0x6'));var rp=require(_0xb5f2('0x7'));var util=require(_0xb5f2('0x8'));var querystring=require('querystring');var tts=require('google-tts-api');var apiai=require(_0xb5f2('0x9'));var md5=require('md5');var google=require(_0xb5f2('0xa'));var aws=require(_0xb5f2('0xb'));var tilde=require(_0xb5f2('0xc'));var sestek=require(_0xb5f2('0xd'));var logger=require(_0xb5f2('0xe'))('agi');var ISPEECH_API=_0xb5f2('0xf');function downloadFile(_0x289e9d,_0x21aac0){return new BPromise(function(_0x4eacef,_0xf1a60){var _0x2c9090=urlParse(_0x289e9d);var _0xe1cdf6=_0x2c9090[_0xb5f2('0x10')]===_0xb5f2('0x11')?https:http;var _0x25f12f={'host':_0x2c9090[_0xb5f2('0x12')],'path':_0x2c9090[_0xb5f2('0x0')],'headers':{'user-agent':_0xb5f2('0x13')}};_0xe1cdf6[_0xb5f2('0x14')](_0x25f12f,function(_0x5434f8){if(_0x5434f8[_0xb5f2('0x15')]!==0xc8){logger[_0xb5f2('0x16')](_0xb5f2('0x17')+_0x289e9d+_0xb5f2('0x18')+_0x5434f8[_0xb5f2('0x15')]+'\x20('+_0x5434f8[_0xb5f2('0x19')]+')');_0xf1a60(new Error(_0xb5f2('0x17')+_0x289e9d+_0xb5f2('0x18')+_0x5434f8[_0xb5f2('0x15')]+'\x20('+_0x5434f8[_0xb5f2('0x19')]+')'));return;}var _0x25a86c=fs[_0xb5f2('0x1a')](_0x21aac0);_0x25a86c['on'](_0xb5f2('0x1b'),function(){logger[_0xb5f2('0x1c')](_0xb5f2('0x1d'));_0x25a86c[_0xb5f2('0x1e')](_0x4eacef);});_0x25a86c['on'](_0xb5f2('0x16'),function(_0x2614c8){fs[_0xb5f2('0x1f')](_0x21aac0);logger[_0xb5f2('0x16')](_0xb5f2('0x20'),_0x2614c8);_0xf1a60(_0x2614c8);});_0x5434f8[_0xb5f2('0x21')](_0x25a86c);})['on']('error',function(_0x3f6571){logger['error'](_0x3f6571);_0xf1a60(_0x3f6571);})[_0xb5f2('0x22')]();});}function uploadFile(_0x704b9c){return new BPromise(function(_0x49dff4,_0x44ab1c){var _0x5c3c0a=urlParse(_0x704b9c);var _0x33b501=_0x5c3c0a[_0xb5f2('0x10')]===_0xb5f2('0x11')?https:http;var _0x56857e={'host':_0x5c3c0a[_0xb5f2('0x12')],'path':_0x5c3c0a[_0xb5f2('0x0')],'headers':{'user-agent':_0xb5f2('0x13')}};_0x33b501[_0xb5f2('0x14')](_0x56857e,function(_0x49e300){if(_0x49e300[_0xb5f2('0x15')]!==0xc8){_0x44ab1c(new Error('request\x20to\x20'+_0x704b9c+_0xb5f2('0x18')+_0x49e300[_0xb5f2('0x15')]+'\x20('+_0x49e300[_0xb5f2('0x19')]+')'));return;}var _0x15dc58='';_0x49e300['on'](_0xb5f2('0x23'),function(_0x22ecc9){_0x15dc58+=_0x22ecc9;});_0x49e300['on'](_0xb5f2('0x22'),function(){_0x49dff4(_0x15dc58);});})['on'](_0xb5f2('0x16'),function(_0x3dcb22){_0x44ab1c(_0x3dcb22);})[_0xb5f2('0x22')]();});}function convertFile(_0x61a533,_0x31af39){return new BPromise(function(_0x239d17,_0x10e0bb){var _0x590863=sox[_0xb5f2('0x24')](_0x61a533,_0x31af39,{'sampleRate':0x1f40,'format':_0xb5f2('0x25'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x590863['on'](_0xb5f2('0x16'),function(_0xeb984f){logger[_0xb5f2('0x16')](_0xb5f2('0x26'),_0xeb984f);_0x10e0bb(_0xeb984f);});_0x590863['on'](_0xb5f2('0x22'),function(){logger[_0xb5f2('0x1c')](_0xb5f2('0x27'));_0x239d17();});_0x590863['start']();});}function base64Decode(_0x399eef,_0x437627){var _0x17c95c=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x2b'));fs[_0xb5f2('0x2c')](_0x17c95c,_0x399eef,_0xb5f2('0x2d'));return convertFile(_0x17c95c,_0x437627)[_0xb5f2('0x2e')](function(){try{fs[_0xb5f2('0x1f')](_0x17c95c);fs[_0xb5f2('0x2f')](_0x437627,_0xb5f2('0x30'));}catch(_0x5b6798){logger[_0xb5f2('0x16')](_0x5b6798);}return _0x437627['split']('.')[0x0];});}function base64Encode(_0x4edaa6){var _0x51f242=fs[_0xb5f2('0x31')](_0x4edaa6);return new Buffer(_0x51f242)[_0xb5f2('0x32')]('base64');}exports['googleCloudTTS']=function(_0x1ca328,_0x5bb113,_0x446921,_0x2f6898,_0x151702,_0x4be28f){var _0x407f25,_0x122c6d;var _0x2e093c=_0xb5f2('0x33');var _0x11f26d=_0xb5f2('0x34')+_0x1ca328;var _0x1643d6={};if(_0x5bb113==='ssml'){_0x1643d6[_0xb5f2('0x35')]={'ssml':_0x446921};}else{_0x1643d6[_0xb5f2('0x35')]={'text':_0x446921};};_0x1643d6[_0xb5f2('0x36')]={'languageCode':_0x2f6898,'ssmlGender':_0x151702};_0x1643d6[_0xb5f2('0x37')]={'audioEncoding':_0xb5f2('0x38'),'sampleRateHertz':0x1f40};var _0x3b2c3b={'url':_0x2e093c+_0xb5f2('0x39')+_0x11f26d,'method':_0xb5f2('0x3a'),'json':!![],'body':_0x1643d6};return rp(_0x3b2c3b)['then'](function(_0x378115){return new BPromise(function(_0x1e5af5,_0x5a328a){_0x407f25=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x3b'));var _0x2df418=Buffer['from'](_0x378115[_0xb5f2('0x3c')],_0xb5f2('0x2d'));return fs['writeFile'](_0x407f25,_0x2df418,function(_0x9196f0){_0x5a328a(_0x9196f0);},function(_0x21124f){fs['chmodSync'](_0x407f25,_0xb5f2('0x30'));_0x1e5af5(_0x21124f);});});})[_0xb5f2('0x2e')](function(_0x45ecdc){_0x122c6d=path['resolve'](__dirname,'tmp',rs['generate'](0x4)+'.wav');return convertFile(_0x407f25,_0x122c6d);})['then'](function(){try{fs[_0xb5f2('0x1f')](_0x407f25);fs[_0xb5f2('0x2f')](_0x122c6d,_0xb5f2('0x30'));}catch(_0x401848){logger['error'](_0x401848);}logger[_0xb5f2('0x1c')]('googleCloudTTS\x20path',_0x122c6d['split']('.')[0x0]);return _0x122c6d[_0xb5f2('0x3d')]('.')[0x0];});};exports[_0xb5f2('0x3e')]=function(_0x14e14d,_0x3bfa88){var _0xa2c23f,_0x56c2a5;return tts(_0x14e14d,_0x3bfa88||'en',0x1)[_0xb5f2('0x2e')](function(_0x47ca6a){logger['info'](_0x47ca6a);_0xa2c23f=path[_0xb5f2('0x28')](__dirname,'tmp',rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x3b'));return downloadFile(_0x47ca6a,_0xa2c23f);})[_0xb5f2('0x2e')](function(){_0x56c2a5=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x2b'));return convertFile(_0xa2c23f,_0x56c2a5);})[_0xb5f2('0x2e')](function(){try{fs[_0xb5f2('0x1f')](_0xa2c23f);fs[_0xb5f2('0x2f')](_0x56c2a5,_0xb5f2('0x30'));}catch(_0x253716){logger[_0xb5f2('0x16')](_0x253716);}logger['info']('goggleTTS\x20path',_0x56c2a5['split']('.')[0x0]);return _0x56c2a5[_0xb5f2('0x3d')]('.')[0x0];});};exports['googleASR']=function(_0x4fb274,_0x1369a2,_0x4da275){return google[_0xb5f2('0x3f')](_0x4fb274,_0x1369a2,_0x4da275)[_0xb5f2('0x2e')](function(_0x2c9311){logger[_0xb5f2('0x1c')](_0x2c9311[_0xb5f2('0x40')]);return rp(_0x2c9311);})[_0xb5f2('0x2e')](function(_0x24f132){var _0x24505f='';var _0x411a2e=0x0;try{fs[_0xb5f2('0x1f')](_0x4fb274);}catch(_0x25d2db){logger[_0xb5f2('0x16')](_0x25d2db);}if(_0x24f132&&_0x24f132[_0xb5f2('0x41')]){_0x24505f=_0x24f132['results']['map'](function(_0x2a5dee){return _0x2a5dee&&_0x2a5dee['alternatives'][0x0]&&_0x2a5dee['alternatives'][0x0][_0xb5f2('0x42')]?_0x2a5dee[_0xb5f2('0x43')][0x0]['transcript']:'';})[_0xb5f2('0x44')]('\x0a');_0x411a2e=_0x24f132[_0xb5f2('0x41')][_0xb5f2('0x45')](function(_0x5b58ed){return _0x5b58ed&&_0x5b58ed[_0xb5f2('0x43')][0x0]&&_0x5b58ed[_0xb5f2('0x43')][0x0][_0xb5f2('0x46')]?_0x5b58ed[_0xb5f2('0x43')][0x0]['confidence']:0x0;})[_0xb5f2('0x44')]('\x0a');}logger[_0xb5f2('0x1c')]('googleASR\x20transcription',_0x24505f);logger[_0xb5f2('0x1c')](_0xb5f2('0x47'),_0x411a2e);return{'transcript':_0x24505f,'confidence':_0x411a2e};})[_0xb5f2('0x48')](function(_0x6235ee){logger[_0xb5f2('0x16')](_0xb5f2('0x49'),_0x6235ee[_0xb5f2('0x15')],_0x6235ee[_0xb5f2('0x4a')],_0x6235ee[_0xb5f2('0x4b')]);});};exports[_0xb5f2('0x4c')]=function(_0x40defe,_0x50def0,_0x1eac29,_0x1747d5){var _0x408a45=apiai(_0x50def0,{'language':_0x1747d5||'en'});return _0x408a45[_0xb5f2('0x4d')](_0x1eac29,{'sessionId':md5(_0x40defe)})[_0xb5f2('0x2e')](function(_0x3b9caf){logger[_0xb5f2('0x1c')](JSON[_0xb5f2('0x4e')](_0x3b9caf));return{'source':_0x3b9caf[_0xb5f2('0x4f')][_0xb5f2('0x50')],'resolvedQuery':_0x3b9caf[_0xb5f2('0x4f')][_0xb5f2('0x51')],'action':_0x3b9caf[_0xb5f2('0x4f')]['action'],'actionIncomplete':_0x3b9caf['result'][_0xb5f2('0x52')],'speech':_0x3b9caf['result'][_0xb5f2('0x53')][_0xb5f2('0x54')],'score':_0x3b9caf[_0xb5f2('0x4f')][_0xb5f2('0x55')],'statusCode':_0x3b9caf[_0xb5f2('0x56')]['code'],'endConversation':_0x3b9caf[_0xb5f2('0x4f')][_0xb5f2('0x57')][_0xb5f2('0x58')]||![],'isFallbackIntent':_0x3b9caf[_0xb5f2('0x4f')][_0xb5f2('0x57')][_0xb5f2('0x59')]};});};exports['tildeASR']=function(_0x4f82e7,_0x557379,_0x5d34e1,_0x319f14){return tilde[_0xb5f2('0x3f')](_0x4f82e7,_0x557379,_0x5d34e1,_0x319f14)['then'](function(_0x35ef3e){try{fs[_0xb5f2('0x1f')](_0x4f82e7);}catch(_0x2a4d2c){logger[_0xb5f2('0x16')](_0x2a4d2c);}logger[_0xb5f2('0x1c')](_0xb5f2('0x5a'),_0x35ef3e['transcript']);logger['info'](_0xb5f2('0x5b'),_0x35ef3e[_0xb5f2('0x46')]);return _0x35ef3e;});};exports['awsPolly']=function(_0x188c62,_0x473dcc,_0xb99f3c,_0x1995e2,_0xcb005e,_0x3a7dba){var _0x14f390=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs[_0xb5f2('0x2a')](0x4)+'.mp3');var _0x147df4;return aws[_0xb5f2('0x5c')](_0x188c62,_0x473dcc,_0xb99f3c,_0x1995e2,_0xcb005e,_0x3a7dba,_0x14f390)[_0xb5f2('0x2e')](function(){_0x147df4=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs['generate'](0x4)+'.wav');return convertFile(_0x14f390,_0x147df4);})[_0xb5f2('0x2e')](function(){try{fs['unlink'](_0x14f390);fs['chmodSync'](_0x147df4,_0xb5f2('0x30'));}catch(_0x4bd05d){logger[_0xb5f2('0x16')](_0x4bd05d);}return _0x147df4[_0xb5f2('0x3d')]('.')[0x0];});};exports[_0xb5f2('0x5d')]=function(_0x26bf2d,_0x5dc250,_0x51faea,_0x80d444,_0x5d6520,_0x41b96f){return aws['lex'](_0x26bf2d,_0x5dc250,_0x51faea,_0x80d444,_0x5d6520,_0x41b96f)[_0xb5f2('0x2e')](function(_0x30eb22){logger[_0xb5f2('0x1c')](JSON[_0xb5f2('0x4e')](_0x30eb22));return _0x30eb22;});};exports[_0xb5f2('0x5e')]=function(_0x51b225,_0x4c7362,_0x3579e3,_0x3a3609){var _0x3a6763=util[_0xb5f2('0x5f')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x51b225,encodeURIComponent(_0x4c7362),_0x3579e3,_0x3a3609);var _0x223086=path[_0xb5f2('0x28')](__dirname,'tmp',rs['generate'](0x4)+_0xb5f2('0x3b'));var _0x5a7dab;return downloadFile(_0x3a6763,_0x223086)[_0xb5f2('0x2e')](function(){_0x5a7dab=path[_0xb5f2('0x28')](__dirname,_0xb5f2('0x29'),rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x2b'));return convertFile(_0x223086,_0x5a7dab);})[_0xb5f2('0x2e')](function(){try{fs[_0xb5f2('0x1f')](_0x223086);fs[_0xb5f2('0x2f')](_0x5a7dab,'777');}catch(_0x2d75dc){logger[_0xb5f2('0x16')](_0x2d75dc);}return _0x5a7dab[_0xb5f2('0x3d')]('.')[0x0];});};exports[_0xb5f2('0x60')]=function(_0x18cd59,_0xb19dbd,_0x4d4bf3,_0x4f110a){var _0x219a01=util[_0xb5f2('0x5f')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0xb19dbd,_0x4d4bf3,base64Encode(_0x18cd59),_0x4f110a?util[_0xb5f2('0x5f')]('model=%s',encodeURIComponent(_0x4f110a)):_0xb5f2('0x61'));return uploadFile(_0x219a01)['then'](function(_0x1e130e){return querystring[_0xb5f2('0x4')](_0x1e130e);});};exports[_0xb5f2('0x62')]=function(_0x431ddc,_0x22e6fd){return sestek[_0xb5f2('0x63')](_0x431ddc,_0x22e6fd)[_0xb5f2('0x2e')](function(_0xe9811f){logger[_0xb5f2('0x1c')](JSON['stringify'](_0xe9811f));var _0x35394b={'speech':_0xe9811f[_0xb5f2('0x64')],'action':_0xe9811f[_0xb5f2('0x65')]?_0xe9811f[_0xb5f2('0x65')][_0xb5f2('0x66')]:undefined,'actiondata':_0xe9811f[_0xb5f2('0x65')]?_0xe9811f[_0xb5f2('0x65')][_0xb5f2('0x67')]:undefined};if(_0xe9811f[_0xb5f2('0x65')]&&_0xe9811f[_0xb5f2('0x65')][_0xb5f2('0x68')]){return base64Decode(_0xe9811f[_0xb5f2('0x65')][_0xb5f2('0x68')][_0xb5f2('0x69')],path['resolve'](__dirname,'tmp',rs[_0xb5f2('0x2a')](0x4)+_0xb5f2('0x2b')))[_0xb5f2('0x2e')](function(_0x388369){_0x35394b[_0xb5f2('0x6a')]=_0x388369;return _0x35394b;});}return _0x35394b;});};exports[_0xb5f2('0x6b')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 03f75cb..ebf2f27 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 _0x8bbb=['exports','./nda'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8bbb,0x83));var _0xb8bb=function(_0x3dc68d,_0x1c1951){_0x3dc68d=_0x3dc68d-0x0;var _0xdf7f94=_0x8bbb[_0x3dc68d];return _0xdf7f94;};var nda=require(_0xb8bb('0x0'));module[_0xb8bb('0x1')]={'nda':nda}; \ No newline at end of file +var _0x1327=['./nda','exports'];(function(_0x3db1f7,_0x2beb9b){var _0x5016ed=function(_0x344ece){while(--_0x344ece){_0x3db1f7['push'](_0x3db1f7['shift']());}};_0x5016ed(++_0x2beb9b);}(_0x1327,0x17c));var _0x7132=function(_0x5fc0b9,_0x3a90ec){_0x5fc0b9=_0x5fc0b9-0x0;var _0xa7cbdf=_0x1327[_0x5fc0b9];return _0xa7cbdf;};var nda=require(_0x7132('0x0'));module[_0x7132('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index b915da1..f52ceb5 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 _0x04a3=['extension','access_token','project','body','ProjectName','ndagenerate_audio','AudioOutputSettings','custom_action','channelData','CustomAction','CustomActionData','custom_action_data','stringify','request-promise','../../../../../config/logger','agi','exports','resolve','ndauth_url','username','password','POST','ndassistant_url','ndaactivity_type','message','Nda','calleridname','dnid'];(function(_0x44e7a8,_0x1081e4){var _0xa2bf66=function(_0x1cb85e){while(--_0x1cb85e){_0x44e7a8['push'](_0x44e7a8['shift']());}};_0xa2bf66(++_0x1081e4);}(_0x04a3,0x1e9));var _0x304a=function(_0x4b909e,_0x23d1a2){_0x4b909e=_0x4b909e-0x0;var _0x1835f4=_0x04a3[_0x4b909e];return _0x1835f4;};'use strict';var rp=require(_0x304a('0x0'));var url=require('url');var logger=require(_0x304a('0x1'))(_0x304a('0x2'));module[_0x304a('0x3')]=function(_0x18ec9a,_0x20377e){var _0x3bcaaf={'method':'POST','uri':url[_0x304a('0x4')](_0x20377e[_0x304a('0x5')],'/token'),'form':{'grant_type':'password','username':_0x20377e[_0x304a('0x6')],'password':_0x20377e[_0x304a('0x7')]},'json':!![]};return rp(_0x3bcaaf)['then'](function(_0x150099){var _0x2505d3={'method':_0x304a('0x8'),'uri':url[_0x304a('0x4')](_0x20377e[_0x304a('0x9')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x20377e[_0x304a('0xa')]||_0x304a('0xb'),'channelId':_0x304a('0xc'),'conversation':{'id':_0x18ec9a['uniqueid']},'from':{'id':_0x18ec9a['callerid'],'name':_0x18ec9a[_0x304a('0xd')]},'recipient':{'id':_0x18ec9a[_0x304a('0xe')],'name':_0x18ec9a[_0x304a('0xf')]},'text':_0x20377e['text'],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x150099[_0x304a('0x10')]},'json':!![]};if(_0x20377e[_0x304a('0x11')]){_0x2505d3[_0x304a('0x12')]['channelData'][_0x304a('0x13')]=_0x20377e['project'];}if(_0x20377e[_0x304a('0x14')]=='1'){_0x2505d3[_0x304a('0x12')]['channelData'][_0x304a('0x15')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x20377e[_0x304a('0x16')]){_0x2505d3[_0x304a('0x12')][_0x304a('0x17')][_0x304a('0x18')]=_0x20377e[_0x304a('0x16')];if(_0x20377e['custom_action_data']){_0x2505d3['body']['channelData'][_0x304a('0x19')]=_0x20377e[_0x304a('0x1a')];}}logger['info'](JSON[_0x304a('0x1b')](_0x2505d3));return rp(_0x2505d3);});}; \ No newline at end of file +var _0x2deb=['custom_action_data','CustomActionData','info','request-promise','url','../../../../../config/logger','agi','POST','resolve','password','username','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','message','Nda','uniqueid','callerid','extension','text','Bearer\x20','project','body','channelData','AudioOutputSettings','audio/wav','custom_action','CustomAction'];(function(_0x5f49c0,_0x27a1b4){var _0x5ab653=function(_0x4de962){while(--_0x4de962){_0x5f49c0['push'](_0x5f49c0['shift']());}};_0x5ab653(++_0x27a1b4);}(_0x2deb,0xdb));var _0xb2de=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2deb[_0x3dd15e];return _0x231fd0;};'use strict';var rp=require(_0xb2de('0x0'));var url=require(_0xb2de('0x1'));var logger=require(_0xb2de('0x2'))(_0xb2de('0x3'));module['exports']=function(_0x48edfe,_0x2bce08){var _0x1eaf6f={'method':_0xb2de('0x4'),'uri':url[_0xb2de('0x5')](_0x2bce08['ndauth_url'],'/token'),'form':{'grant_type':_0xb2de('0x6'),'username':_0x2bce08[_0xb2de('0x7')],'password':_0x2bce08[_0xb2de('0x6')]},'json':!![]};return rp(_0x1eaf6f)['then'](function(_0x253d0b){var _0x1a4c44={'method':'POST','uri':url[_0xb2de('0x5')](_0x2bce08[_0xb2de('0x8')],_0xb2de('0x9')),'body':{'type':_0x2bce08['ndaactivity_type']||_0xb2de('0xa'),'channelId':_0xb2de('0xb'),'conversation':{'id':_0x48edfe[_0xb2de('0xc')]},'from':{'id':_0x48edfe[_0xb2de('0xd')],'name':_0x48edfe['calleridname']},'recipient':{'id':_0x48edfe['dnid'],'name':_0x48edfe[_0xb2de('0xe')]},'text':_0x2bce08[_0xb2de('0xf')],'channelData':{}},'headers':{'Authorization':_0xb2de('0x10')+_0x253d0b['access_token']},'json':!![]};if(_0x2bce08[_0xb2de('0x11')]){_0x1a4c44[_0xb2de('0x12')][_0xb2de('0x13')]['ProjectName']=_0x2bce08[_0xb2de('0x11')];}if(_0x2bce08['ndagenerate_audio']=='1'){_0x1a4c44[_0xb2de('0x12')]['channelData'][_0xb2de('0x14')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0xb2de('0x15')};}if(_0x2bce08[_0xb2de('0x16')]){_0x1a4c44['body'][_0xb2de('0x13')][_0xb2de('0x17')]=_0x2bce08[_0xb2de('0x16')];if(_0x2bce08[_0xb2de('0x18')]){_0x1a4c44[_0xb2de('0x12')][_0xb2de('0x13')][_0xb2de('0x19')]=_0x2bce08[_0xb2de('0x18')];}}logger[_0xb2de('0x1a')](JSON['stringify'](_0x1a4c44));return rp(_0x1a4c44);});}; \ 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 4b2debd..b29e577 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -'use strict';var asr=require('./lib/api');module['exports']=function(_0x41c617,_0x5533d1,_0x10e0d8,_0xa000e6){return asr(_0x41c617,_0x5533d1,_0x10e0d8,_0xa000e6);}; \ No newline at end of file +var _0x4e40=['./lib/api','exports'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x4e40,0x10c));var _0x04e4=function(_0x330b53,_0x3c7655){_0x330b53=_0x330b53-0x0;var _0x37e226=_0x4e40[_0x330b53];return _0x37e226;};'use strict';var asr=require(_0x04e4('0x0'));module[_0x04e4('0x1')]=function(_0x46e606,_0x15811e,_0x2a0138,_0x2d5918){return asr(_0x46e606,_0x15811e,_0x2a0138,_0x2d5918);}; \ 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 f212dae..ff8d736 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 _0xe97f=['stringify','terminate','status','result','final','Tilde\x20ASR\x20hypoteses','hypotheses','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isObject','open','close','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','createReadStream','data','error','Tilde\x20ASR\x20send\x20error'];(function(_0x4f97bd,_0x51ead5){var _0x3bfb16=function(_0x1a7922){while(--_0x1a7922){_0x4f97bd['push'](_0x4f97bd['shift']());}};_0x3bfb16(++_0x51ead5);}(_0xe97f,0x1be));var _0xfe97=function(_0x36eaaa,_0x326732){_0x36eaaa=_0x36eaaa-0x0;var _0x461349=_0xe97f[_0x36eaaa];return _0x461349;};'use strict';var BPromise=require(_0xfe97('0x0'));var _=require(_0xfe97('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xfe97('0x2'));var crypto=require(_0xfe97('0x3'));var logger=require(_0xfe97('0x4'))(_0xfe97('0x5'));module[_0xfe97('0x6')]=function(_0x4a8645,_0x39b14e,_0x129385,_0x569b96){return new BPromise(function(_0x2794e9,_0x3fe3e3){logger[_0xfe97('0x7')](_0xfe97('0x8'),_0x569b96||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE');var _0x374db3=new WebSocket(_0x569b96||_0xfe97('0x9'),{'perMessageDeflate':![]});var _0x4847a7='';var _0x156c1e='0';var _0x470573='1';var _0x384cdf=_0xfe97('0xa');function _0x90766b(_0x2ccc7c){var _0x550db3=crypto[_0xfe97('0xb')]('sha1');_0x550db3[_0xfe97('0xc')](_0x2ccc7c);return _0x550db3[_0xfe97('0xd')](_0xfe97('0xe'));}function _0x5efa23(){try{logger['info'](_0xfe97('0xf'));var _0x5a1983=moment()[_0xfe97('0x10')]();var _0x535fb7=_0x90766b(_0x5a1983+_0x39b14e+_0x129385);_0x374db3[_0xfe97('0x11')](JSON['stringify']({'appID':_0x39b14e,'timestamp':_0x5a1983,'appKey':_0x535fb7}));var _0xb79752=fs[_0xfe97('0x12')](_0x4a8645);_0xb79752['on'](_0xfe97('0x13'),function(_0x38e66a){_0x374db3[_0xfe97('0x11')](_0x38e66a);});_0xb79752['on']('close',function(){_0x374db3[_0xfe97('0x11')]('EOS');});}catch(_0x150784){logger[_0xfe97('0x14')](_0xfe97('0x15'),JSON[_0xfe97('0x16')](_0x150784));_0x374db3[_0xfe97('0x17')]();}}function _0x137344(_0x30fead){try{if(_0x30fead){var _0x42c9d2=JSON['parse'](_0x30fead);switch(_0x42c9d2[_0xfe97('0x18')]){case 0x0:if(_0x42c9d2[_0xfe97('0x19')]){if(_0x42c9d2[_0xfe97('0x19')][_0xfe97('0x1a')]){logger[_0xfe97('0x7')](_0xfe97('0x1b'),JSON[_0xfe97('0x16')](_0x42c9d2['result'][_0xfe97('0x1c')]));_0x4847a7=_0x42c9d2[_0xfe97('0x19')][_0xfe97('0x1c')][0x0]['transcript'];_0x156c1e=_0x42c9d2[_0xfe97('0x19')]['hypotheses'][0x0]['likelihood'];_0x470573='0';_0x384cdf=_0xfe97('0x1d');_0x374db3[_0xfe97('0x17')]();}}break;case 0x1:logger[_0xfe97('0x7')](_0xfe97('0xa'));_0x470573='1';_0x384cdf='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xfe97('0x7')](_0xfe97('0x1e'));_0x470573='2';_0x384cdf=_0xfe97('0x1e');break;case 0x9:logger[_0xfe97('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x470573='9';_0x384cdf=_0xfe97('0x1f');break;case 0xa:logger['info']('Authentication\x20failed.');_0x470573='10';_0x384cdf=_0xfe97('0x20');break;case 0xb:logger[_0xfe97('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x470573='11';_0x384cdf=_0xfe97('0x21');}}}catch(_0x3d7f85){logger[_0xfe97('0x14')](_0xfe97('0x22'),JSON[_0xfe97('0x16')](_0x3d7f85));_0x374db3[_0xfe97('0x17')]();}}function _0x5e1e3e(){logger['info'](_0xfe97('0x23'));_0x2794e9({'transcript':_0x4847a7,'confidence':_0x156c1e,'status':_0x470573,'status_message':_0x384cdf});}function _0x57305e(_0x3c24c1){logger[_0xfe97('0x14')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x3c24c1)){logger[_0xfe97('0x14')](_[_0xfe97('0x24')](_0x3c24c1)?JSON[_0xfe97('0x16')](_0x3c24c1):_0x3c24c1);}}_0x374db3['on'](_0xfe97('0x25'),_0x5efa23);_0x374db3['on']('message',_0x137344);_0x374db3['on'](_0xfe97('0x26'),_0x5e1e3e);_0x374db3['on'](_0xfe97('0x14'),_0x57305e);});}; \ No newline at end of file +var _0x5647=['exports','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','update','digest','hex','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','createReadStream','data','error','terminate','parse','result','final','hypotheses','likelihood','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','info','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','isObject','open','close','bluebird','lodash','../../../../../../config/logger','agi'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x5647,0xf8));var _0x7564=function(_0x2e2146,_0x2be827){_0x2e2146=_0x2e2146-0x0;var _0x2c6159=_0x5647[_0x2e2146];return _0x2c6159;};'use strict';var BPromise=require(_0x7564('0x0'));var _=require(_0x7564('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require('moment');var crypto=require('crypto');var logger=require(_0x7564('0x2'))(_0x7564('0x3'));module[_0x7564('0x4')]=function(_0x3325b5,_0x118889,_0x52acf7,_0x1377b8){return new BPromise(function(_0x4b62d3,_0x5731d7){logger['info'](_0x7564('0x5'),_0x1377b8||_0x7564('0x6'));var _0x3cff6e=new WebSocket(_0x1377b8||_0x7564('0x6'),{'perMessageDeflate':![]});var _0xfa689b='';var _0x34cd91='0';var _0x3afb='1';var _0x549082='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x374274(_0x26bf1a){var _0x2a46a9=crypto[_0x7564('0x7')]('sha1');_0x2a46a9[_0x7564('0x8')](_0x26bf1a);return _0x2a46a9[_0x7564('0x9')](_0x7564('0xa'));}function _0x4ddb46(){try{logger['info'](_0x7564('0xb'));var _0x9b57d9=moment()[_0x7564('0xc')]();var _0x4a34c0=_0x374274(_0x9b57d9+_0x118889+_0x52acf7);_0x3cff6e[_0x7564('0xd')](JSON[_0x7564('0xe')]({'appID':_0x118889,'timestamp':_0x9b57d9,'appKey':_0x4a34c0}));var _0x7bec7b=fs[_0x7564('0xf')](_0x3325b5);_0x7bec7b['on'](_0x7564('0x10'),function(_0xd84995){_0x3cff6e[_0x7564('0xd')](_0xd84995);});_0x7bec7b['on']('close',function(){_0x3cff6e['send']('EOS');});}catch(_0x37f807){logger[_0x7564('0x11')]('Tilde\x20ASR\x20send\x20error',JSON['stringify'](_0x37f807));_0x3cff6e[_0x7564('0x12')]();}}function _0x47c5b2(_0x2b60a3){try{if(_0x2b60a3){var _0x20cc2a=JSON[_0x7564('0x13')](_0x2b60a3);switch(_0x20cc2a['status']){case 0x0:if(_0x20cc2a[_0x7564('0x14')]){if(_0x20cc2a['result'][_0x7564('0x15')]){logger['info']('Tilde\x20ASR\x20hypoteses',JSON[_0x7564('0xe')](_0x20cc2a['result'][_0x7564('0x16')]));_0xfa689b=_0x20cc2a[_0x7564('0x14')][_0x7564('0x16')][0x0]['transcript'];_0x34cd91=_0x20cc2a['result'][_0x7564('0x16')][0x0][_0x7564('0x17')];_0x3afb='0';_0x549082='Success.';_0x3cff6e[_0x7564('0x12')]();}}break;case 0x1:logger['info'](_0x7564('0x18'));_0x3afb='1';_0x549082=_0x7564('0x18');break;case 0x2:logger['info'](_0x7564('0x19'));_0x3afb='2';_0x549082=_0x7564('0x19');break;case 0x9:logger[_0x7564('0x1a')](_0x7564('0x1b'));_0x3afb='9';_0x549082=_0x7564('0x1b');break;case 0xa:logger[_0x7564('0x1a')](_0x7564('0x1c'));_0x3afb='10';_0x549082=_0x7564('0x1c');break;case 0xb:logger['info']('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3afb='11';_0x549082=_0x7564('0x1d');}}}catch(_0x304807){logger['error'](_0x7564('0x1e'),JSON[_0x7564('0xe')](_0x304807));_0x3cff6e[_0x7564('0x12')]();}}function _0x47f19a(){logger[_0x7564('0x1a')](_0x7564('0x1f'));_0x4b62d3({'transcript':_0xfa689b,'confidence':_0x34cd91,'status':_0x3afb,'status_message':_0x549082});}function _0x5aa9a8(_0x166127){logger[_0x7564('0x11')](_0x7564('0x20'));if(!_['isNil'](_0x166127)){logger[_0x7564('0x11')](_[_0x7564('0x21')](_0x166127)?JSON['stringify'](_0x166127):_0x166127);}}_0x3cff6e['on'](_0x7564('0x22'),_0x4ddb46);_0x3cff6e['on']('message',_0x47c5b2);_0x3cff6e['on'](_0x7564('0x23'),_0x47f19a);_0x3cff6e['on'](_0x7564('0x11'),_0x5aa9a8);});}; \ 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 86b0aca..76faa55 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 _0x2b47=['./asr'];(function(_0x10bb69,_0x4e76ec){var _0x48624d=function(_0x517962){while(--_0x517962){_0x10bb69['push'](_0x10bb69['shift']());}};_0x48624d(++_0x4e76ec);}(_0x2b47,0x77));var _0x72b4=function(_0x2d92c6,_0x53fc97){_0x2d92c6=_0x2d92c6-0x0;var _0x23dcda=_0x2b47[_0x2d92c6];return _0x23dcda;};var asr=require(_0x72b4('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0xfaf6=['exports'];(function(_0x20053a,_0x33910a){var _0x583238=function(_0x38ba7a){while(--_0x38ba7a){_0x20053a['push'](_0x20053a['shift']());}};_0x583238(++_0x33910a);}(_0xfaf6,0x175));var _0x6faf=function(_0xad2102,_0x1b9379){_0xad2102=_0xad2102-0x0;var _0x2405b5=_0xfaf6[_0xad2102];return _0x2405b5;};var asr=require('./asr');module[_0x6faf('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 281dca8..27a7be3 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 _0xd73a=['listen','listening','connection','getConnections','error','destroy','E_AGI_SERVER_MAXCONNECTION','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','exports','util','net','events','EventEmitter','./error','127.0.0.1','call','emit','E_AGI_ARGUMENT_PORT'];(function(_0x4decb2,_0x3eec27){var _0x21d464=function(_0x29fda7){while(--_0x29fda7){_0x4decb2['push'](_0x4decb2['shift']());}};_0x21d464(++_0x3eec27);}(_0xd73a,0x171));var _0xad73=function(_0x310b6f,_0x839ec3){_0x310b6f=_0x310b6f-0x0;var _0x36182d=_0xd73a[_0x310b6f];return _0x36182d;};'use strict';var util=require(_0xad73('0x0'));var net=require(_0xad73('0x1'));var EventEmitter=require(_0xad73('0x2'))[_0xad73('0x3')];var AGIError=require(_0xad73('0x4'));var AGIChannel=require('./channel');var AGIServer=function(_0x5048f2,_0x1b0cd2,_0x216563){var _0x279d4f=this,_0x5048f2=_0x5048f2||0x11dd,_0x1b0cd2=_0x1b0cd2||_0xad73('0x5'),_0x7d2258=null,_0x247d3c=0x0;EventEmitter[_0xad73('0x6')](_0x279d4f);function _0x15cf28(){if(!_0x5048f2){_0x279d4f[_0xad73('0x7')]('error',new AGIError(_0xad73('0x8')));return![];}_0x7d2258=net['createServer']();_0x7d2258[_0xad73('0x9')](_0x5048f2,_0x1b0cd2);_0x7d2258['on'](_0xad73('0xa'),function(){_0x279d4f[_0xad73('0x7')]('listening');});_0x7d2258['on'](_0xad73('0xb'),function(_0x5567bb){_0x7d2258[_0xad73('0xc')](function(_0x5eae26,_0x2b2f33){if(_0x5eae26){_0x279d4f[_0xad73('0x7')](_0xad73('0xd'),new AGIError('E_AGI_SERVER_ERROR',_0x5eae26));}else if(_0x216563&&_0x216563<0x0){_0x279d4f[_0xad73('0x7')](_0xad73('0xd'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x5567bb[_0xad73('0xe')]();}else if(_0x216563&&_0x216563>0x0&&_0x216563<_0x2b2f33){_0x247d3c+=0x1;_0x279d4f[_0xad73('0x7')](_0xad73('0xd'),new AGIError(_0xad73('0xf'),_0x247d3c));_0x5567bb[_0xad73('0xe')]();}else{var _0x82fe13=new AGIChannel(_0x5567bb);_0x82fe13['on']('ready',function(){_0x279d4f[_0xad73('0x7')](_0xad73('0xb'),_0x82fe13);});}});});_0x7d2258['on'](_0xad73('0xd'),function(_0x155548){_0x279d4f[_0xad73('0x7')](_0xad73('0xd'),new AGIError(_0xad73('0x10'),_0x155548[_0xad73('0x11')]));});_0x7d2258['on'](_0xad73('0x12'),function(){_0x279d4f[_0xad73('0x7')]('close',new AGIError(_0xad73('0x13')));});}process['nextTick'](function(){_0x15cf28();});};util['inherits'](AGIServer,EventEmitter);module[_0xad73('0x14')]=function(_0x522010,_0x11ed16,_0x578068){return new AGIServer(_0x522010,_0x11ed16,_0x578068);}; \ No newline at end of file +var _0x4fdb=['code','close','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','events','EventEmitter','./error','./channel','call','emit','createServer','listen','listening','connection','getConnections','error','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','ready'];(function(_0x282187,_0x2c4fc5){var _0x561d20=function(_0x45c8d4){while(--_0x45c8d4){_0x282187['push'](_0x282187['shift']());}};_0x561d20(++_0x2c4fc5);}(_0x4fdb,0x9c));var _0xb4fd=function(_0x28a244,_0x29cdab){_0x28a244=_0x28a244-0x0;var _0x38c6f5=_0x4fdb[_0x28a244];return _0x38c6f5;};'use strict';var util=require(_0xb4fd('0x0'));var net=require(_0xb4fd('0x1'));var EventEmitter=require(_0xb4fd('0x2'))[_0xb4fd('0x3')];var AGIError=require(_0xb4fd('0x4'));var AGIChannel=require(_0xb4fd('0x5'));var AGIServer=function(_0x260a35,_0xd55d8e,_0x1c0b08){var _0x5b73bb=this,_0x260a35=_0x260a35||0x11dd,_0xd55d8e=_0xd55d8e||'127.0.0.1',_0x14052b=null,_0x5d8b39=0x0;EventEmitter[_0xb4fd('0x6')](_0x5b73bb);function _0x3af8e3(){if(!_0x260a35){_0x5b73bb[_0xb4fd('0x7')]('error',new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x14052b=net[_0xb4fd('0x8')]();_0x14052b[_0xb4fd('0x9')](_0x260a35,_0xd55d8e);_0x14052b['on'](_0xb4fd('0xa'),function(){_0x5b73bb['emit'](_0xb4fd('0xa'));});_0x14052b['on'](_0xb4fd('0xb'),function(_0x2148db){_0x14052b[_0xb4fd('0xc')](function(_0x306bd4,_0x502379){if(_0x306bd4){_0x5b73bb[_0xb4fd('0x7')](_0xb4fd('0xd'),new AGIError(_0xb4fd('0xe'),_0x306bd4));}else if(_0x1c0b08&&_0x1c0b08<0x0){_0x5b73bb[_0xb4fd('0x7')]('error',new AGIError(_0xb4fd('0xf')));_0x2148db[_0xb4fd('0x10')]();}else if(_0x1c0b08&&_0x1c0b08>0x0&&_0x1c0b08<_0x502379){_0x5d8b39+=0x1;_0x5b73bb[_0xb4fd('0x7')]('error',new AGIError(_0xb4fd('0x11'),_0x5d8b39));_0x2148db[_0xb4fd('0x10')]();}else{var _0xc35d8d=new AGIChannel(_0x2148db);_0xc35d8d['on'](_0xb4fd('0x12'),function(){_0x5b73bb[_0xb4fd('0x7')](_0xb4fd('0xb'),_0xc35d8d);});}});});_0x14052b['on'](_0xb4fd('0xd'),function(_0x47e288){_0x5b73bb[_0xb4fd('0x7')](_0xb4fd('0xd'),new AGIError(_0xb4fd('0xe'),_0x47e288[_0xb4fd('0x13')]));});_0x14052b['on'](_0xb4fd('0x14'),function(){_0x5b73bb[_0xb4fd('0x7')](_0xb4fd('0x14'),new AGIError(_0xb4fd('0x15')));});}process[_0xb4fd('0x16')](function(){_0x3af8e3();});};util[_0xb4fd('0x17')](AGIServer,EventEmitter);module[_0xb4fd('0x18')]=function(_0x5e930d,_0x560eaf,_0x504e80){return new AGIServer(_0x5e930d,_0x560eaf,_0x504e80);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index ade8f33..dc72619 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 _0x24b2=['appsecret','clear','agicommand','clone','hasOwnProperty','isString','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','replaceAllVariables','saveRestApiResult','isArray','%s.%s','split','length','replaceAll','getVariable','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','setVariable','isConfigured','maxRetry','retry','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','scheduledAt','delay','add','noop','custom_app','exec','Executed\x20command\x20%s\x20%s','application','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','no\x20text\x20configured','Executed\x20command\x20MRCPSynth\x20%s','MRCPSynth','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','RECOG_INSTANCE()','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','variable_id','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','Enter\x20in\x20DIAL\x20(%s)\x20block','no\x20user\x20selected','sip_id','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','ndauth_url','no\x20username\x20configured','password','no\x20password\x20configured','bot','SESTEK_NDA_%s','Sestek\x20NDA\x20%s\x20file\x20created','audiofile','streamFile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','no\x20variable\x20selected\x20for\x20the\x20result','getData','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','substr','getsecretdigits','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','GOAL\x20%s','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','message','Amazon\x20Lex\x20ready\x20for\x20fulfillment','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','NOBEEP','recordFile','intKey','google\x20%s\x20file\x20created','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appsecret\x20configured','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','extension','gotoif','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20FOUND\x20BY','success','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','Enter\x20in\x20LOGOUT\x20(%s)\x20block','no\x20find\x20by\x20configured','math','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','menu','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','getVoiceQueue','indexOf','toLowerCase','QUEUE','macro','gosub','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','statusMessage','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','debug','account_id','Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','no\x20sms\x20account\x20found','sms_text','sendSMS\x20message','Trying\x20SendSMS\x20with\x20account\x20%s','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','google_cloud_tts','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','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','join','exports','path','lodash','shelljs','randomstring','moment','mustache','request-promise','../../config/logger','agi','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','channel','rpc','mailRpc','getVariableById','then','name','prototype','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','getMailAccount','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','IntervalId','map','Intervals','interval','format','getQueryOdbc','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','query','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','label','arg_1','createSquareRecording','context','priority','accountcode','file','createSquareMessage','createCmContact','isEmpty','callback_','lastName','phone','toString','callback_priority','getPause','getPauseById','agentPause','agent','callerid','isNil','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','shellCommand','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','body','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','sestekNDA','ispeechTTS','key','ispeech_tts_language','speed','ispeechASR','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'];(function(_0x21fd45,_0x32e491){var _0x537a12=function(_0x5d446c){while(--_0x5d446c){_0x21fd45['push'](_0x21fd45['shift']());}};_0x537a12(++_0x32e491);}(_0x24b2,0x133));var _0x224b=function(_0x22f6b3,_0x35be3e){_0x22f6b3=_0x22f6b3-0x0;var _0x3dcb97=_0x24b2[_0x22f6b3];return _0x3dcb97;};'use strict';var fs=require('fs');var path=require(_0x224b('0x0'));var util=require('util');var _=require(_0x224b('0x1'));var sh=require(_0x224b('0x2'));var odbc=require('odbc')();var rs=require(_0x224b('0x3'));var moment=require(_0x224b('0x4'));var Mustache=require(_0x224b('0x5'));var rp=require(_0x224b('0x6'));var logger=require(_0x224b('0x7'))(_0x224b('0x8'));var config=require('../../config/environment');var scripts=require(_0x224b('0x9'));var FILES_PATH=_0x224b('0xa');var recursiveMapAttributes=[_0x224b('0xb'),_0x224b('0xc')];var verticesWithRetry=['menu',_0x224b('0xd'),'getsecretdigits'];var AGIVertices=function(_0x4fa46d,_0x328e13,_0x456970){this[_0x224b('0xe')]=_0x4fa46d;this[_0x224b('0xf')]=_0x328e13;this[_0x224b('0x10')]=_0x456970;};AGIVertices['prototype']['getVariable']=function(_0x7acb49,_0x21f35c){this[_0x224b('0xf')][_0x224b('0x11')](_0x7acb49)[_0x224b('0x12')](function(_0x333e58){_0x21f35c(null,_0x333e58?_0x333e58[_0x224b('0x13')]:![]);})['catch'](function(_0x240a73){_0x21f35c(_0x240a73);});};AGIVertices[_0x224b('0x14')]['getVoiceQueue']=function(_0x504e49,_0x589c35){this[_0x224b('0xf')]['getVoiceQueueById'](_0x504e49)[_0x224b('0x12')](function(_0x5ed2b1){_0x589c35(null,_0x5ed2b1?_0x5ed2b1[_0x224b('0x13')]:![]);})[_0x224b('0x15')](function(_0x4194ab){_0x589c35(_0x4194ab);});};AGIVertices[_0x224b('0x14')][_0x224b('0x16')]=function(_0x1ae020,_0x1f8a0a){this[_0x224b('0xf')]['getSquareProjectById'](_0x1ae020)[_0x224b('0x12')](function(_0x3f4936){_0x1f8a0a(null,_0x3f4936?_0x3f4936[_0x224b('0x13')]:![]);})['catch'](function(_0x7b0e07){_0x1f8a0a(_0x7b0e07);});};AGIVertices[_0x224b('0x14')][_0x224b('0x17')]=function(_0x526246,_0x1af897){this[_0x224b('0xf')][_0x224b('0x18')](_0x526246)['then'](function(_0x31403e){_0x1af897(null,_0x31403e?_0x31403e['dsn']:![]);})['catch'](function(_0x22653a){_0x1af897(_0x22653a);});};AGIVertices[_0x224b('0x14')][_0x224b('0x19')]=function(_0x36027c,_0x1e0022){this[_0x224b('0xf')][_0x224b('0x1a')](_0x36027c)['then'](function(_0x1b2699){_0x1e0022(null,_0x1b2699?_0x1b2699['name']:![]);})[_0x224b('0x15')](function(_0x33dfdb){_0x1e0022(_0x33dfdb);});};AGIVertices[_0x224b('0x14')][_0x224b('0x1b')]=function(_0x8a68ad,_0x4f67a8){this[_0x224b('0xf')][_0x224b('0x1c')](_0x8a68ad)[_0x224b('0x12')](function(_0x2f2c07){_0x4f67a8(null,_0x2f2c07?_0x2f2c07[_0x224b('0x13')]:![]);})['catch'](function(_0x457f7a){_0x4f67a8(_0x457f7a);});};AGIVertices[_0x224b('0x14')][_0x224b('0x1d')]=function(_0x22b75e,_0x2516fb){var _0x1fa27b=this;this[_0x224b('0xf')][_0x224b('0x1e')](_0x22b75e)['then'](function(_0x5d1cde){_0x2516fb(null,_0x5d1cde?_0x1fa27b[_0x224b('0x1f')](_0x5d1cde['save_name']):![]);})[_0x224b('0x15')](function(_0x42add2){_0x2516fb(_0x42add2);});};AGIVertices[_0x224b('0x14')][_0x224b('0x20')]=function(_0x56fd38,_0x21e965){this[_0x224b('0xf')][_0x224b('0x21')](_0x56fd38)[_0x224b('0x12')](function(_0x18c38c){_0x21e965(null,_0x18c38c?_0x18c38c:![]);})[_0x224b('0x15')](function(_0x157c06){_0x21e965(_0x157c06);});};AGIVertices[_0x224b('0x14')][_0x224b('0x22')]=function(_0xc375c9,_0x2ab1a8,_0x40aaf6){this['mailRpc'][_0x224b('0x22')](_0xc375c9,_0x2ab1a8)['then'](function(){_0x40aaf6(null);})[_0x224b('0x15')](function(_0x385d5d){_0x40aaf6(_0x385d5d);});};AGIVertices[_0x224b('0x14')][_0x224b('0x23')]=function(_0x4e35d6,_0x1b36d8){this[_0x224b('0xf')][_0x224b('0x24')](_0x4e35d6)[_0x224b('0x12')](function(_0x5172c0){if(_0x5172c0){if(_0x5172c0[_0x224b('0x25')]){_0x1b36d8(null,[_0x5172c0['interval']]);}else{_0x1b36d8(null,_[_0x224b('0x26')](_0x5172c0[_0x224b('0x27')],_0x224b('0x28')));}}else{_0x1b36d8(null,![]);}})[_0x224b('0x15')](function(_0x13bb9f){_0x1b36d8(_0x13bb9f);});};AGIVertices[_0x224b('0x14')][_0x224b('0x1f')]=function(_0x2d4ccf){return util[_0x224b('0x29')]('%s/sounds/converted/%s',FILES_PATH,_0x2d4ccf);};AGIVertices['prototype'][_0x224b('0x2a')]=function(_0x323438,_0x2c74a1,_0x4d2d3b){odbc['open'](_0x323438,function(_0x785ca){if(_0x785ca){logger[_0x224b('0x2b')](_0x224b('0x2c'),_0x785ca);_0x4d2d3b(_0x785ca);}else{logger[_0x224b('0x2d')]('ODBC\x20connection\x20successfully');odbc[_0x224b('0x2e')](_0x2c74a1,function(_0x598940,_0x1d4e2d){if(_0x598940){logger[_0x224b('0x2d')](_0x224b('0x2f'),_0x2c74a1);_0x4d2d3b(_0x598940);}else{logger['info'](_0x224b('0x30'),_0x2c74a1);odbc[_0x224b('0x31')](function(_0x37fdd1){if(_0x37fdd1){logger[_0x224b('0x2b')](_0x224b('0x32'),_0x37fdd1);}_0x4d2d3b(null,_0x1d4e2d);});}});}});};AGIVertices['prototype'][_0x224b('0x33')]=function(_0x2881e5,_0x5b3a21){this[_0x224b('0xf')][_0x224b('0x34')](_0x2881e5)['then'](function(_0x2e9067){_0x5b3a21(null,_0x2e9067?_0x2e9067:![]);})[_0x224b('0x15')](function(_0x26e3d7){_0x5b3a21(_0x26e3d7);});};AGIVertices[_0x224b('0x14')][_0x224b('0x35')]=function(_0x277b1e,_0x31c59c){this['rpc']['createSmsMessage'](_0x277b1e)['then'](function(_0x2c698f){_0x31c59c(null,_0x2c698f);})['catch'](function(_0x4dd085){_0x31c59c(_0x4dd085);});};AGIVertices[_0x224b('0x14')][_0x224b('0x36')]=function(_0xcf82d7,_0x364dd9,_0x41337d){this[_0x224b('0xf')][_0x224b('0x36')]({'uniqueid':this['channel'][_0x224b('0x37')],'node':_0xcf82d7[_0x224b('0x38')],'application':_0xcf82d7['agicommand'],'data':_0x364dd9||null,'project_name':this['channel'][_0x224b('0x39')],'callerid':this['channel']['callerid']})[_0x224b('0x12')](function(_0xec8624){if(_0x41337d){_0x41337d(null,_0xec8624);}})[_0x224b('0x15')](function(_0x50801a){if(_0x41337d){_0x41337d(_0x50801a);}});};AGIVertices[_0x224b('0x14')][_0x224b('0x3a')]=function(_0x42c1e3,_0x48f1f2,_0x3dacc2,_0x5d7647){this[_0x224b('0xf')][_0x224b('0x3a')]({'uniqueid':this[_0x224b('0xe')][_0x224b('0x37')],'callerid':this[_0x224b('0xe')]['callerid'],'calleridname':this[_0x224b('0xe')]['calleridname'],'context':this['channel'][_0x224b('0x3b')],'extension':this[_0x224b('0xe')]['extension'],'priority':this['channel'][_0x224b('0x3c')],'accountcode':this[_0x224b('0xe')][_0x224b('0x3d')],'dnid':this['channel']['dnid'],'projectName':this[_0x224b('0xe')]['arg_1'],'saveName':_0x48f1f2,'filename':_0x42c1e3[_0x224b('0x3e')]||_0x48f1f2,'savePath':_0x3dacc2})[_0x224b('0x12')](function(_0x12a1df){_0x5d7647(null,_0x12a1df);})['catch'](function(_0x126583){_0x5d7647(_0x126583);});};AGIVertices[_0x224b('0x14')][_0x224b('0x3f')]=function(_0x58a33e,_0x5b2192,_0x4206bf){this[_0x224b('0xf')][_0x224b('0x3f')]({'uniqueid':this['channel'][_0x224b('0x37')],'body':_0x58a33e,'direction':_0x5b2192})[_0x224b('0x12')](function(_0x577317){if(_0x4206bf){_0x4206bf(null,_0x577317);}})[_0x224b('0x15')](function(_0x57f3f6){if(_0x4206bf){_0x4206bf(_0x57f3f6);}});};AGIVertices[_0x224b('0x14')][_0x224b('0x40')]=function(_0x677765,_0x2cc6d3){this[_0x224b('0xf')]['createCmContact']({'firstName':_[_0x224b('0x41')](_0x677765[_0x224b('0x13')])||_['isNil'](_0x677765[_0x224b('0x13')])?_0x224b('0x42')+Math['random']():_0x677765['name'],'lastName':_['isEmpty'](_0x677765[_0x224b('0x43')])||_['isNil'](_0x677765['lastName'])?null:_0x677765[_0x224b('0x43')],'phone':_0x677765[_0x224b('0x44')],'ListId':_0x677765['list_id'],'scheduledat':_0x677765['scheduledAt'],'callbackUniqueid':this[_0x224b('0xe')][_0x224b('0x37')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x677765['scheduledAt'][_0x224b('0x45')](),'priority':_0x677765[_0x224b('0x46')]})[_0x224b('0x12')](function(_0x561ab3){_0x2cc6d3(null,_0x561ab3);})['catch'](function(_0x34b0aa){_0x2cc6d3(_0x34b0aa);});};AGIVertices[_0x224b('0x14')][_0x224b('0x47')]=function(_0x3895b2,_0x8d9cab){this['rpc'][_0x224b('0x48')](_0x3895b2)['then'](function(_0x38a57b){_0x8d9cab(null,_0x38a57b?_0x38a57b[_0x224b('0x13')]:![]);})[_0x224b('0x15')](function(_0x32ad7d){_0x8d9cab(_0x32ad7d);});};AGIVertices[_0x224b('0x14')][_0x224b('0x49')]=function(_0x53c7c9,_0x5740c2,_0x303940){var _0x32447b={'role':_0x224b('0x4a')};_0x32447b[_0x53c7c9]=this[_0x224b('0xe')][_0x224b('0x4b')];this[_0x224b('0xf')][_0x224b('0x49')](_0x32447b,_0x5740c2,this[_0x224b('0xe')][_0x224b('0x37')])['then'](function(_0x16a198){_0x303940(null,_[_0x224b('0x4c')](_0x16a198)?![]:!![]);})[_0x224b('0x15')](function(_0x2dc203){logger[_0x224b('0x2b')](_0x2dc203);_0x303940(null,![]);});};AGIVertices[_0x224b('0x14')][_0x224b('0x4d')]=function(_0x97eb16,_0x146243){var _0x27f5e4={'role':_0x224b('0x4a')};_0x27f5e4[_0x97eb16]=this[_0x224b('0xe')][_0x224b('0x4b')];this[_0x224b('0xf')]['agentUnpause'](_0x27f5e4)['then'](function(_0x183c70){_0x146243(null,_[_0x224b('0x4c')](_0x183c70)?![]:!![]);})[_0x224b('0x15')](function(_0x487e5e){logger[_0x224b('0x2b')](_0x487e5e);_0x146243(null,![]);});};AGIVertices['prototype'][_0x224b('0x4e')]=function(_0x591e81,_0x4387c0){var _0x30347b={'role':_0x224b('0x4a')};_0x30347b[_0x591e81]=this[_0x224b('0xe')][_0x224b('0x4b')];this[_0x224b('0xf')][_0x224b('0x4e')](_0x30347b)['then'](function(_0xc7fb4a){_0x4387c0(null,_[_0x224b('0x4c')](_0xc7fb4a)?![]:!![]);})[_0x224b('0x15')](function(_0x5a4ba9){logger[_0x224b('0x2b')](_0x5a4ba9);_0x4387c0(null,![]);});};AGIVertices['prototype'][_0x224b('0x4f')]=function(_0xc0e49b,_0x1837fd){var _0x5aa28b={'role':_0x224b('0x4a')};_0x5aa28b[_0xc0e49b]=this[_0x224b('0xe')]['callerid'];var _0x4ec9de=_0xc0e49b!=_0x224b('0x50')?util[_0x224b('0x29')](_0x224b('0x51'),_0x224b('0x52'),this[_0x224b('0xe')][_0x224b('0x4b')]):undefined;this[_0x224b('0xf')]['agentLogin'](_0x5aa28b,_0x4ec9de)[_0x224b('0x12')](function(_0x4e18a7){_0x1837fd(null,_[_0x224b('0x4c')](_0x4e18a7)?![]:!![]);})['catch'](function(_0x497019){logger[_0x224b('0x2b')](_0x497019);_0x1837fd(null,![]);});};AGIVertices[_0x224b('0x14')][_0x224b('0x53')]=function(_0x3a6004,_0x36f553){sh['exec'](_[_0x224b('0x54')](_0x3a6004),function(_0xe48f5b,_0x48073e){var _0x5157f1=_0x48073e[_0x224b('0x55')](/(\r\n|\n|\r)/gm,'');_0x36f553(null,_0x5157f1);});};AGIVertices[_0x224b('0x14')][_0x224b('0x56')]=function(_0x236ebf,_0x130898){scripts[_0x224b('0x56')](_0x236ebf[_0x224b('0x57')],_0x236ebf[_0x224b('0x58')]||_0x224b('0x59'),_0x236ebf[_0x224b('0x59')],_0x236ebf[_0x224b('0x5a')]||_0x224b('0x5b'),_0x236ebf[_0x224b('0x5c')]||'MALE',_0x236ebf[_0x224b('0x5d')]||'MP3')[_0x224b('0x12')](function(_0x3c4d5c){_0x130898(null,_0x3c4d5c);})[_0x224b('0x15')](function(_0x16d667){_0x130898(_0x16d667);});};AGIVertices[_0x224b('0x14')][_0x224b('0x5e')]=function(_0x48ae51,_0x354a1c){scripts[_0x224b('0x5e')](_0x48ae51['text'],_0x48ae51[_0x224b('0x5f')]||'en',0x1)['then'](function(_0x40ea2b){_0x354a1c(null,_0x40ea2b);})[_0x224b('0x15')](function(_0x69ac03){_0x354a1c(_0x69ac03);});};AGIVertices[_0x224b('0x14')][_0x224b('0x60')]=function(_0x5666d1,_0x766fbe){var _0x3fecc0={'uri':_0x5666d1[_0x224b('0x61')],'method':_0x5666d1[_0x224b('0x62')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x5666d1[_0x224b('0x63')])===_0x224b('0x64')&&parseInt(_0x5666d1[_0x224b('0x63')])>=0x1?parseInt(_0x5666d1[_0x224b('0x63')])*0x3e8:0x5*0x3e8};if(_[_0x224b('0x65')]([_0x224b('0x66'),_0x224b('0x67')],_0x3fecc0[_0x224b('0x62')][_0x224b('0x68')]())){try{_0x3fecc0['body']=_0x5666d1[_0x224b('0xc')]?JSON[_0x224b('0x69')](_0x5666d1[_0x224b('0xc')]):{};}catch(_0x5d73e2){logger[_0x224b('0x2b')](_0x224b('0x6a'),_0x5d73e2);}}try{_0x3fecc0[_0x224b('0x6b')]=_0x5666d1['rawHeaders']?JSON['parse'](_0x5666d1[_0x224b('0xb')]):{};}catch(_0x11d478){logger[_0x224b('0x2b')](_0x224b('0x6c'),_0x11d478);}if(_0x5666d1['computedVariables']){try{var _0xf5b826=require(_0x5666d1[_0x224b('0x6d')])[_0x224b('0x6e')](this,_0x3fecc0);_0x3fecc0[_0x224b('0x6f')]=Mustache[_0x224b('0x70')](_0x5666d1[_0x224b('0x61')],_0xf5b826,{},['$$','$$']);if(_0x3fecc0[_0x224b('0x6b')]){_0x3fecc0[_0x224b('0x6b')]=JSON[_0x224b('0x69')](Mustache[_0x224b('0x70')](JSON[_0x224b('0x71')](_0x3fecc0[_0x224b('0x6b')]),_0xf5b826,{},['$$','$$']));}if(_0x3fecc0[_0x224b('0x72')]){_0x3fecc0['body']=JSON[_0x224b('0x69')](Mustache[_0x224b('0x70')](JSON['stringify'](_0x3fecc0[_0x224b('0x72')]),_0xf5b826,{},['$$','$$']));}}catch(_0x52c70d){logger[_0x224b('0x2b')](_0x224b('0x73'),_0x52c70d);}}rp(_0x3fecc0)[_0x224b('0x12')](function(_0x3db640){var _0x506c52={'statusCode':_0x3db640[_0x224b('0x74')]||0xc8,'statusMessage':_0x3db640['statusMessage']||'OK','headers':_0x3db640['headers']||{},'body':_0x3db640[_0x224b('0x72')]||{}};_0x766fbe(null,_0x506c52);})['catch'](function(_0x4060fa){var _0x4a048f={'statusCode':_0x4060fa[_0x224b('0x74')]||0x1f4,'statusMessage':_0x4060fa['message']||_0x224b('0x75'),'headers':_0x4060fa[_0x224b('0x76')]['headers']||{},'body':_0x4060fa[_0x224b('0x76')]['body']||{}};_0x766fbe(null,_0x4a048f);});};AGIVertices[_0x224b('0x14')][_0x224b('0x77')]=function(_0x38264b,_0x5a6e7e){scripts['googleDialogflow'](this[_0x224b('0xe')][_0x224b('0x37')],_0x38264b['key'],_0x38264b['text'],_0x38264b[_0x224b('0x78')]||'en')[_0x224b('0x12')](function(_0x19e203){_0x5a6e7e(null,_0x19e203);})[_0x224b('0x15')](function(_0x30470d){_0x5a6e7e(_0x30470d);});};AGIVertices[_0x224b('0x14')][_0x224b('0x79')]=function(_0x13288f,_0x1c733b){scripts[_0x224b('0x79')](this[_0x224b('0xe')],_0x13288f)['then'](function(_0x5bf25a){_0x1c733b(null,_0x5bf25a);})[_0x224b('0x15')](function(_0x536bab){_0x1c733b(_0x536bab);});};AGIVertices[_0x224b('0x14')][_0x224b('0x7a')]=function(_0x2af4c9,_0x460e4d){scripts[_0x224b('0x7a')](_0x2af4c9[_0x224b('0x7b')],_0x2af4c9[_0x224b('0x59')],_0x2af4c9[_0x224b('0x7c')]||_0x224b('0x5b'),_0x2af4c9[_0x224b('0x7d')])[_0x224b('0x12')](function(_0x1f0b08){_0x460e4d(null,_0x1f0b08);})[_0x224b('0x15')](function(_0x430097){_0x460e4d(_0x430097);});};AGIVertices[_0x224b('0x14')]['ispeechASR']=function(_0x4f4282,_0x5d2d7d,_0x1fc28c){scripts[_0x224b('0x7e')](_0x5d2d7d,_0x4f4282[_0x224b('0x7b')],_0x4f4282['ispeech_asr_language']||_0x224b('0x5b'),this['isConfigured'](_0x4f4282[_0x224b('0x7f')])?_0x4f4282[_0x224b('0x7f')]:undefined)['then'](function(_0x28bbd5){_0x1fc28c(null,_0x28bbd5);})[_0x224b('0x15')](function(_0x5c8dc2){_0x1fc28c(_0x5c8dc2);});};AGIVertices[_0x224b('0x14')][_0x224b('0x80')]=function(_0x486b10,_0x4e0d4b){scripts[_0x224b('0x80')](_0x486b10[_0x224b('0x81')],_0x486b10['aws_secret_access_key'],_0x486b10[_0x224b('0x82')],_0x486b10[_0x224b('0x83')]||_0x224b('0x84'),_0x486b10['text'],_0x486b10[_0x224b('0x85')]||_0x224b('0x59'))['then'](function(_0x3fa337){_0x4e0d4b(null,_0x3fa337);})['catch'](function(_0x35116e){_0x4e0d4b(_0x35116e);});};AGIVertices[_0x224b('0x14')][_0x224b('0x86')]=function(_0x287565,_0x2d0744){scripts[_0x224b('0x86')](this['channel'][_0x224b('0x37')],_0x287565[_0x224b('0x81')],_0x287565[_0x224b('0x87')],_0x287565[_0x224b('0x88')],_0x287565[_0x224b('0x59')],_0x287565[_0x224b('0x89')])[_0x224b('0x12')](function(_0x478b05){_0x2d0744(null,_0x478b05);})[_0x224b('0x15')](function(_0x3ac79b){_0x2d0744(_0x3ac79b);});};AGIVertices[_0x224b('0x14')]['googleASR']=function(_0x21f5c2,_0xe31abd,_0x421747){scripts[_0x224b('0x8a')](_0xe31abd,_0x21f5c2['key'],_0x21f5c2[_0x224b('0x8b')]||_0x224b('0x5b'))[_0x224b('0x12')](function(_0x5f1253){_0x421747(null,_0x5f1253);})[_0x224b('0x15')](function(_0x29ffb5){_0x421747(_0x29ffb5);});};AGIVertices['prototype'][_0x224b('0x8c')]=function(_0x223991,_0x1772f4,_0xc85fc6){scripts[_0x224b('0x8c')](_0x1772f4,_0x223991['appid'],_0x223991[_0x224b('0x8d')],_0x223991[_0x224b('0x6f')])[_0x224b('0x12')](function(_0x1a7935){_0xc85fc6(null,_0x1a7935);})[_0x224b('0x15')](function(_0x334d0f){_0xc85fc6(_0x334d0f);});};AGIVertices[_0x224b('0x14')][_0x224b('0x8e')]=function(_0x3f46bb){var _0x4dcf3e=_[_0x224b('0x65')](verticesWithRetry,_0x3f46bb[_0x224b('0x8f')])?_0x3f46bb:_[_0x224b('0x90')](_0x3f46bb);for(var _0x14c399 in _0x4dcf3e){if(_0x4dcf3e[_0x224b('0x91')](_0x14c399)){if(_0x4dcf3e[_0x14c399]&&_[_0x224b('0x92')](_0x4dcf3e[_0x14c399])){if(_[_0x224b('0x65')](recursiveMapAttributes,_0x14c399)){_0x4dcf3e[_0x14c399]=this[_0x224b('0x93')](_0x4dcf3e[_0x14c399]);}else{_0x4dcf3e[_0x14c399]=this['replaceAllVariables'](_0x4dcf3e[_0x14c399]);}}}}return _0x4dcf3e;};AGIVertices[_0x224b('0x14')][_0x224b('0x94')]=function(_0x2a56c0){for(var _0x7301be in _0x2a56c0){if(_0x2a56c0['hasOwnProperty'](_0x7301be)){if(_[_0x224b('0x95')](_0x2a56c0[_0x7301be])){this[_0x224b('0x94')](_0x2a56c0[_0x7301be]);}else if(_['isArray'](_0x2a56c0[_0x7301be])){for(var _0x5162be=0x0;_0x5162be<_0x2a56c0[_0x7301be]['length'];_0x5162be++){this[_0x224b('0x94')](_0x2a56c0[_0x7301be][_0x5162be]);}}else if(_[_0x224b('0x92')](_0x2a56c0[_0x7301be])){_0x2a56c0[_0x7301be]=this[_0x224b('0x96')](_0x2a56c0[_0x7301be]);}}}};AGIVertices['prototype'][_0x224b('0x97')]=function(_0x1b26c7,_0x44fcf){for(var _0x30d163 in _0x1b26c7){if(_0x1b26c7['hasOwnProperty'](_0x30d163)){if(_[_0x224b('0x95')](_0x1b26c7[_0x30d163])){if(!_[_0x224b('0x41')](_0x1b26c7[_0x30d163])){this[_0x224b('0x97')](_0x1b26c7[_0x30d163],util[_0x224b('0x29')]('%s.%s',_0x44fcf,_0x30d163));}}else if(_[_0x224b('0x98')](_0x1b26c7[_0x30d163])){for(var _0x4c7b17=0x0;_0x4c7b17<_0x1b26c7[_0x30d163]['length'];_0x4c7b17++){this['saveRestApiResult'](_0x1b26c7[_0x30d163][_0x4c7b17],util[_0x224b('0x29')](_0x224b('0x99'),_0x44fcf,_0x30d163+'['+_0x4c7b17+']'));}}else{if(!_['isNil'](_0x1b26c7[_0x30d163])){this[_0x224b('0xe')]['setVariable'](util['format'](_0x224b('0x99'),_0x44fcf,_0x30d163),_0x1b26c7[_0x30d163]);}}}}};AGIVertices[_0x224b('0x14')][_0x224b('0x93')]=function(_0x1751a3){try{var _0x3864e5=JSON['parse'](_0x1751a3);this[_0x224b('0x94')](_0x3864e5);return JSON[_0x224b('0x71')](_0x3864e5);}catch(_0x56d543){return this[_0x224b('0x96')](_0x1751a3);}};AGIVertices[_0x224b('0x14')][_0x224b('0x96')]=function(_0x44fc32){var _0x4e9cef=_0x44fc32[_0x224b('0x9a')]('{');for(var _0x15ba20=0x1;_0x15ba20<_0x4e9cef['length'];_0x15ba20+=0x1){var _0x5556df=_0x4e9cef[_0x15ba20][_0x224b('0x9a')]('}');if(_0x5556df[_0x224b('0x9b')]>0x1){_0x44fc32=_0x44fc32[_0x224b('0x9c')]('{'+_0x5556df[0x0]+'}',this['channel'][_0x224b('0x9d')](_0x5556df[0x0])[_0x224b('0x9e')]||_0x5556df[0x0]);}}if(_0x4e9cef[_0x224b('0x9b')]===0x1){return _0x44fc32[_0x224b('0x45')]();}return this[_0x224b('0x96')](_0x44fc32);};AGIVertices[_0x224b('0x14')][_0x224b('0x9f')]=function(_0x511526,_0x2df8ca){var _0x34c15d=this[_0x224b('0xe')][_0x224b('0x9d')](_0x511526);if(_0x34c15d[_0x224b('0xa0')]===-0x1){return _0x34c15d;}logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xa1'),_0x2df8ca,_0x34c15d['extra']));return this[_0x224b('0xe')][_0x224b('0xa2')](_0x2df8ca,_0x34c15d[_0x224b('0x9e')]);};AGIVertices[_0x224b('0x14')][_0x224b('0xa3')]=function(_0x2d51c7){return _0x2d51c7&&_0x2d51c7!=='0'&&_0x2d51c7!=='-1'&&_0x2d51c7!=='';};AGIVertices[_0x224b('0x14')][_0x224b('0xa4')]=function(_0x5858ce){this[_0x224b('0x36')]['sync'](this,_0x5858ce,'-');_0x5858ce[_0x224b('0xa5')]=_0x5858ce[_0x224b('0xa4')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x224b('0x14')]['agi']=function(_0x129ccb){logger[_0x224b('0x2d')](util['format'](_0x224b('0xa6'),_0x129ccb[_0x224b('0x38')]));return this[_0x224b('0xe')][_0x224b('0x8')]([_0x129ccb[_0x224b('0xa7')],_0x129ccb[_0x224b('0xa8')]]);};AGIVertices['prototype'][_0x224b('0xa9')]=function(_0x3dcf34){logger[_0x224b('0x2d')](util['format'](_0x224b('0xaa'),_0x3dcf34['label']));if(this['isConfigured'](_0x3dcf34['timeout'])){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xab'),_0x3dcf34['timeout']));var _0x2b1ef7=this[_0x224b('0xe')]['wait'](_0x3dcf34[_0x224b('0x63')]);if(_0x2b1ef7[_0x224b('0xa0')]===-0x1){return _0x2b1ef7;}}return this['channel'][_0x224b('0xa9')]();};AGIVertices[_0x224b('0x14')][_0x224b('0xac')]=function(_0x5d632b){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xad'),_0x5d632b[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x5d632b[_0x224b('0xae')])){return this['channel'][_0x224b('0x2b')](_0x5d632b,'no\x20list\x20selected');}_0x5d632b[_0x224b('0xaf')]=moment();if(this[_0x224b('0xa3')](_0x5d632b[_0x224b('0xb0')])){_0x5d632b[_0x224b('0xaf')]=moment()[_0x224b('0xb1')](_0x5d632b[_0x224b('0xb0')],'minutes');}if(!this[_0x224b('0xa3')](_0x5d632b[_0x224b('0x46')])){_0x5d632b[_0x224b('0x46')]=0x2;}this['createCmContact']['sync'](this,_0x5d632b);return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x5d632b[_0x224b('0x44')],_0x5d632b[_0x224b('0xae')],_0x5d632b['scheduledAt']));};AGIVertices[_0x224b('0x14')][_0x224b('0xb3')]=function(_0x189f36){logger['info'](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x189f36[_0x224b('0x38')]));var _0x87535e=this[_0x224b('0xe')][_0x224b('0xb4')](_0x189f36['application'],_0x189f36[_0x224b('0x76')]);if(_0x87535e[_0x224b('0xa0')]===-0x1){return _0x87535e;}return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xb5'),_0x189f36[_0x224b('0xb6')],_0x189f36[_0x224b('0x76')]));};AGIVertices[_0x224b('0x14')][_0x224b('0xb7')]=function(_0x1692c6){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xb8'),_0x1692c6[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x1692c6[_0x224b('0x59')])){return this[_0x224b('0xe')]['noop'](_0x224b('0xb9'));}var _0x3751d7='\x22'+_0x1692c6[_0x224b('0x59')]+'\x22';if(this[_0x224b('0xa3')](_0x1692c6[_0x224b('0x76')])){_0x3751d7+=','+_0x1692c6[_0x224b('0x76')];}var _0x40407f=this[_0x224b('0xe')][_0x224b('0xb4')]('MRCPSynth',_0x3751d7);if(_0x40407f['result']===-0x1){return _0x40407f;}return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xba'),_0x3751d7));};AGIVertices['prototype']['sestektts']=function(_0x2979fd){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x2979fd[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x2979fd[_0x224b('0x59')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x536591='\x22'+_0x2979fd[_0x224b('0x59')]+'\x22';if(this[_0x224b('0xa3')](_0x2979fd[_0x224b('0x76')])){_0x536591+=','+_0x2979fd[_0x224b('0x76')];}var _0x1aa25e=this[_0x224b('0xe')]['exec'](_0x224b('0xbb'),_0x536591);if(_0x1aa25e[_0x224b('0xa0')]===-0x1){return _0x1aa25e;}return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xba'),_0x536591));};AGIVertices[_0x224b('0x14')]['lumenvoxasr']=function(_0xe6f2ea){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xbc'),_0xe6f2ea[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0xe6f2ea[_0x224b('0xbd')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xbe'));}var _0x1eace5=_0xe6f2ea[_0x224b('0xbd')];if(this['isConfigured'](_0xe6f2ea[_0x224b('0x76')])){_0x1eace5+=','+_0xe6f2ea['options'];}var _0x1117bf=this[_0x224b('0xe')][_0x224b('0xb4')](_0x224b('0xbf'),_0x1eace5);if(_0x1117bf[_0x224b('0xa0')]===-0x1){return _0x1117bf;}var _0x4918cc=this[_0x224b('0x9f')](_0x224b('0xc0'),_0x224b('0xc1'));if(_0x4918cc[_0x224b('0xa0')]===-0x1){return _0x4918cc;}var _0x87c013=this[_0x224b('0x9f')](_0x224b('0xc2'),_0x224b('0xc3'));if(_0x87c013[_0x224b('0xa0')]===-0x1){return _0x87c013;}var _0x1f0ce1=this[_0x224b('0x9f')](_0x224b('0xc4'),'LUMENVOX_ASR_INSTANCE');if(_0x1f0ce1['result']===-0x1){return _0x1f0ce1;}return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('Executed\x20command\x20MRCPRecog\x20%s',_0x1eace5));};AGIVertices[_0x224b('0x14')][_0x224b('0xc5')]=function(_0x520b59){logger['info'](util[_0x224b('0x29')](_0x224b('0xc6'),_0x520b59['label']));if(!this[_0x224b('0xa3')](_0x520b59[_0x224b('0xbd')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xbe'));}var _0x43684b=_0x520b59[_0x224b('0xbd')];if(this[_0x224b('0xa3')](_0x520b59['options'])){_0x43684b+=','+_0x520b59['options'];}var _0x2588c0=this[_0x224b('0xe')]['exec'](_0x224b('0xbf'),_0x43684b);if(_0x2588c0[_0x224b('0xa0')]===-0x1){return _0x2588c0;}var _0x504c56=this[_0x224b('0x9f')](_0x224b('0xc0'),_0x224b('0xc7'));if(_0x504c56[_0x224b('0xa0')]===-0x1){return _0x504c56;}var _0xc41f33=this[_0x224b('0x9f')](_0x224b('0xc2'),'SESTEK_ASR_TRANSCRIPT');if(_0xc41f33['result']===-0x1){return _0xc41f33;}var _0x1bff43=this[_0x224b('0x9f')](_0x224b('0xc4'),_0x224b('0xc8'));if(_0x1bff43[_0x224b('0xa0')]===-0x1){return _0x1bff43;}return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xc9'),_0x43684b));};AGIVertices[_0x224b('0x14')][_0x224b('0xca')]=function(_0x34eea7){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xcb'),_0x34eea7[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x34eea7[_0x224b('0xcc')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x34eea7,_0x224b('0xcd'));}var _0x33cebc=this[_0x224b('0x17')][_0x224b('0x6e')](this,_0x34eea7['odbc_id']);if(!_0x33cebc){return this['channel']['error'](_0x34eea7,_0x224b('0xce'));}if(!this[_0x224b('0xa3')](_0x34eea7['query'])){return this[_0x224b('0xe')]['error'](_0x34eea7,_0x224b('0xcf'));}var _0x4e7c51=_0x34eea7['query'][_0x224b('0x55')](/(\r\n|\n|\r)/gm,'\x20');this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xd0'),_0x4e7c51));var _0x5bdf53=this[_0x224b('0x2a')]['sync'](this,_0x33cebc,_0x4e7c51);this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x34eea7,_0x4e7c51);if(!this['isConfigured'](_0x34eea7['variable_id'])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x67ffd9=this[_0x224b('0x9d')][_0x224b('0x6e')](this,_0x34eea7[_0x224b('0xd1')]);if(!_0x67ffd9){return this[_0x224b('0xe')]['error'](_0x34eea7,_0x224b('0xd2'));}var _0x471801=this;_0x5bdf53[_0x224b('0xd3')](function(_0xc0fbec,_0x5ba603){Object['keys'](_0xc0fbec)[_0x224b('0xd3')](function(_0xb1bdca){_0x471801[_0x224b('0xe')][_0x224b('0xa2')](util['format'](_0x224b('0xd4'),_0x67ffd9,_0x5ba603,_0xb1bdca),_0xc0fbec[_0xb1bdca]);});});this[_0x224b('0xe')][_0x224b('0xa2')](util[_0x224b('0x29')](_0x224b('0xd5'),_0x67ffd9),_0x5bdf53[_0x224b('0x9b')]);return this[_0x224b('0xe')]['noop'](util[_0x224b('0x29')](_0x224b('0xd6'),_0x67ffd9));};AGIVertices[_0x224b('0x14')]['dial']=function(_0x2ffc20){logger['debug'](util[_0x224b('0x29')](_0x224b('0xd7'),_0x2ffc20[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x2ffc20['sip_id'])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x2ffc20,_0x224b('0xd8'));}var _0x22f501=this[_0x224b('0x19')][_0x224b('0x6e')](this,_0x2ffc20[_0x224b('0xd9')]);if(!_0x22f501){return this[_0x224b('0xe')]['error'](_0x2ffc20,_0x224b('0xda'));}var _0x8c9d17=this[_0x224b('0xe')][_0x224b('0xb4')](_0x224b('0xdb'),[util[_0x224b('0x29')](_0x224b('0xdc'),_0x22f501),_0x2ffc20[_0x224b('0x63')],_0x2ffc20[_0x224b('0xdd')],_0x2ffc20[_0x224b('0x61')]]);if(_0x8c9d17[_0x224b('0xa0')]===-0x1){return _0x8c9d17;}return this[_0x224b('0xe')]['noop'](util['format'](_0x224b('0xde'),_0x224b('0xdb')));};AGIVertices[_0x224b('0x14')][_0x224b('0xdf')]=function(_0x23dc95){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0xe0'),_0x23dc95['label']));if(!this[_0x224b('0xa3')](_0x23dc95[_0x224b('0x7b')])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20key\x20configured');}if(!this[_0x224b('0xa3')](_0x23dc95[_0x224b('0x59')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xb9'));}this[_0x224b('0xe')]['bot']=!![];this[_0x224b('0x36')](_0x23dc95);this['createSquareMessage'](_0x23dc95[_0x224b('0x59')],'in');this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xe1'),_0x23dc95['text']));var _0x463262=this[_0x224b('0x77')][_0x224b('0x6e')](this,_0x23dc95);if(_0x463262){for(var _0x10514b in _0x463262){if(_0x463262[_0x224b('0x91')](_0x10514b)){this['channel'][_0x224b('0xa2')](util[_0x224b('0x29')](_0x224b('0xe2'),_0x10514b[_0x224b('0x68')]()),_0x463262[_0x10514b]);}}this['createSquareMessage'](_0x463262[_0x224b('0xe3')],_0x224b('0xe4'));return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xe5'),_0x463262[_0x224b('0xe3')]));}return this[_0x224b('0xe')]['error'](_0x23dc95,_0x224b('0xe6'));};AGIVertices['prototype'][_0x224b('0xe7')]=function(_0x58393){logger['info'](util[_0x224b('0x29')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0x58393[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x58393[_0x224b('0xe8')])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20ndauth\x20url\x20configured');}if(!this[_0x224b('0xa3')](_0x58393['username'])){return this['channel']['noop'](_0x224b('0xe9'));}if(!this[_0x224b('0xa3')](_0x58393[_0x224b('0xea')])){return this[_0x224b('0xe')]['noop'](_0x224b('0xeb'));}if(!this[_0x224b('0xa3')](_0x58393['ndassistant_url'])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xb9'));}this[_0x224b('0xe')][_0x224b('0xec')]=!![];this['createSquareDetailsReport'](_0x58393);this['createSquareMessage'](_0x58393[_0x224b('0x59')],'in');this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('Trying\x20SestekNDA:\x20%s',_0x58393[_0x224b('0x59')]));var _0x5c8da2=this[_0x224b('0x79')][_0x224b('0x6e')](this,_0x58393);if(_0x5c8da2){for(var _0x4593df in _0x5c8da2){if(_0x5c8da2[_0x224b('0x91')](_0x4593df)){this[_0x224b('0xe')]['setVariable'](util[_0x224b('0x29')](_0x224b('0xed'),_0x4593df[_0x224b('0x68')]()),_0x5c8da2[_0x4593df]);}}this[_0x224b('0x3f')](_0x5c8da2[_0x224b('0xe3')],_0x224b('0xe4'));if(_0x5c8da2['audiofile']){this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xee'),_0x5c8da2[_0x224b('0xef')]));var _0x1c10e4=this['channel'][_0x224b('0xf0')](_0x5c8da2[_0x224b('0xef')]);try{fs[_0x224b('0xf1')](_0x5c8da2['audiofile']+'.wav');}catch(_0x35e204){logger[_0x224b('0x2b')](_0x35e204);}return _0x1c10e4;}else{return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xf2'),_0x5c8da2[_0x224b('0xe3')]));}}return this[_0x224b('0xe')][_0x224b('0x2b')](_0x58393,_0x224b('0xf3'));};AGIVertices[_0x224b('0x14')]['end']=function(_0x77af90){logger['info'](util[_0x224b('0x29')](_0x224b('0xf4'),_0x77af90[_0x224b('0x38')]));return this[_0x224b('0xe')]['noop']('end');};AGIVertices[_0x224b('0x14')]['ext_dial']=function(_0x4c5d49){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4c5d49[_0x224b('0x38')]));var _0x2adbb1='';if(_0x4c5d49[_0x224b('0xf5')]){if(!this[_0x224b('0xa3')](_0x4c5d49[_0x224b('0xf5')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x4c5d49,_0x224b('0xf6'));}else{var _0x1cd3c2=parseInt(_0x4c5d49[_0x224b('0xf5')],0xa);if(isNaN(_0x1cd3c2)){_0x2adbb1=_0x4c5d49[_0x224b('0xf5')];}else{_0x2adbb1=this[_0x224b('0x1b')][_0x224b('0x6e')](this,_0x4c5d49['trunk_id']);if(!_0x2adbb1){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x4c5d49,_0x224b('0xf7'));}}}}else if(_0x4c5d49[_0x224b('0xf8')]){_0x2adbb1=_0x4c5d49[_0x224b('0xf8')];}else{return this['channel'][_0x224b('0x2b')](_0x4c5d49,_0x224b('0xf6'));}var _0x4fec70=this['channel'][_0x224b('0xb4')](_0x224b('0xdb'),[util['format'](_0x224b('0xf9'),_0x2adbb1,_0x4c5d49[_0x224b('0x44')]),_0x4c5d49[_0x224b('0x63')],_0x4c5d49['opts'],_0x4c5d49[_0x224b('0x61')]]);if(_0x4fec70[_0x224b('0xa0')]===-0x1){return _0x4fec70;}return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')]('Executed\x20command\x20%s',_0x224b('0xdb')));};AGIVertices[_0x224b('0x14')][_0x224b('0xfa')]=function(_0x6d1217){logger['info'](util[_0x224b('0x29')](_0x224b('0xfb'),_0x6d1217[_0x224b('0x38')]));return this[_0x224b('0xe')][_0x224b('0xb2')]('finally');};AGIVertices['prototype'][_0x224b('0xd')]=function(_0x1065a1){logger['info'](util[_0x224b('0x29')](_0x224b('0xfc'),_0x1065a1[_0x224b('0x38')]));if(_0x1065a1[_0x224b('0xa5')]===0x0){return this[_0x224b('0xa4')](_0x1065a1);}_0x1065a1[_0x224b('0xa5')]-=0x1;if(!this[_0x224b('0xa3')](_0x1065a1['file_id'])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x1065a1,_0x224b('0xfd'));}var _0x27c929=this[_0x224b('0x1d')][_0x224b('0x6e')](this,_0x1065a1[_0x224b('0xfe')]);if(!_0x27c929){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x1065a1,_0x224b('0xff'));}if(!this[_0x224b('0xa3')](_0x1065a1[_0x224b('0xd1')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x224b('0x100'));}var _0x1b8a57=this[_0x224b('0xe')][_0x224b('0x101')](_0x27c929,_0x1065a1['response'],_0x1065a1[_0x224b('0x102')]);var _0x475403=_0x1b8a57['result']?_0x1b8a57[_0x224b('0xa0')]['toString']():'';logger[_0x224b('0x2d')](_0x224b('0x103'),JSON[_0x224b('0x71')](_0x1b8a57));if(_0x1b8a57[_0x224b('0xa0')]===-0x1){this[_0x224b('0x36')]['sync'](this,_0x1065a1,_0x475403);return _0x1b8a57;}else if(_0x1b8a57['extra']===_0x224b('0x63')){_0x1b8a57[_0x224b('0xa0')]=_0x475403[_0x224b('0x9b')]>=parseInt(_0x1065a1[_0x224b('0x104')])?'x':'i';}else{_0x1b8a57[_0x224b('0xa0')]=_0x475403[_0x224b('0x9b')]>=parseInt(_0x1065a1[_0x224b('0x104')])&&_0x475403[_0x224b('0x9b')]<=parseInt(_0x1065a1[_0x224b('0x102')])?'x':'i';}var _0xc54fdb=this[_0x224b('0x9d')][_0x224b('0x6e')](this,_0x1065a1[_0x224b('0xd1')]);if(!_0xc54fdb){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x1065a1,_0x224b('0xd2'));}this[_0x224b('0xe')]['setVariable'](_0xc54fdb,_0x475403);if(this[_0x224b('0xa3')](_0x1065a1[_0x224b('0x105')])){var _0x454a5e=parseInt(_0x1065a1[_0x224b('0x105')],0xa);var _0x3c9107=rs[_0x224b('0x106')]({'charset':'*','length':_0x454a5e});var _0x60cf23=_0x475403[_0x224b('0x9b')];if(_0x60cf23>0x0){if(_0x60cf23>_0x454a5e){this[_0x224b('0x36')]['sync'](this,_0x1065a1,_0x1065a1[_0x224b('0x107')]==='first'?_0x3c9107+_0x475403['substr'](_0x454a5e):_0x475403[_0x224b('0x108')](0x0,_0x60cf23-_0x454a5e)+_0x3c9107);}else{this['createSquareDetailsReport']['sync'](this,_0x1065a1,rs[_0x224b('0x106')]({'charset':'*','length':_0x60cf23}));}}else{this['createSquareDetailsReport'][_0x224b('0x6e')](this,_0x1065a1,'');}}else{this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x1065a1,_0x475403);}return _0x1b8a57;};AGIVertices[_0x224b('0x14')][_0x224b('0x109')]=function(_0x4ade65){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x10a'),_0x4ade65[_0x224b('0x38')]));return this[_0x224b('0xd')](_0x4ade65);};AGIVertices[_0x224b('0x14')]['goal']=function(_0x34b7ee){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x10b'),_0x34b7ee[_0x224b('0x38')]));this['createSquareDetailsReport'][_0x224b('0x6e')](this,_0x34b7ee,_0x34b7ee[_0x224b('0x10c')]);return this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x10d'),_0x34b7ee[_0x224b('0x10c')]));};AGIVertices[_0x224b('0x14')][_0x224b('0x10e')]=function(_0x45bb52){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x10f'),_0x45bb52[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x45bb52[_0x224b('0x81')])||!this['isConfigured'](_0x45bb52[_0x224b('0x87')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x110'));}if(!this[_0x224b('0xa3')](_0x45bb52[_0x224b('0x59')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xb9'));}this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x111'),_0x45bb52[_0x224b('0x59')]));var _0x28a70b=this[_0x224b('0x80')][_0x224b('0x6e')](this,_0x45bb52);if(_0x28a70b){this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('aws\x20Polly\x20%s\x20file\x20created',_0x28a70b));var _0x1f1bd3=this[_0x224b('0xe')][_0x224b('0xf0')](_0x28a70b);try{fs[_0x224b('0xf1')](_0x28a70b+_0x224b('0x112'));}catch(_0x5bc41f){logger['error'](_0x5bc41f);}return _0x1f1bd3;}return this['channel'][_0x224b('0x2b')](_0x45bb52,_0x224b('0x113'));};AGIVertices['prototype']['awslex']=function(_0x1d9653){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x114'),_0x1d9653[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x1d9653[_0x224b('0x81')])||!this[_0x224b('0xa3')](_0x1d9653[_0x224b('0x87')])){return this['channel'][_0x224b('0xb2')](_0x224b('0x110'));}if(!this[_0x224b('0xa3')](_0x1d9653[_0x224b('0x89')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x115'));}if(!this[_0x224b('0xa3')](_0x1d9653[_0x224b('0x59')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0xb9'));}this[_0x224b('0xe')][_0x224b('0xec')]=!![];this[_0x224b('0x36')](_0x1d9653);this[_0x224b('0x3f')](_0x1d9653[_0x224b('0x59')],'in');this[_0x224b('0xe')]['noop'](util[_0x224b('0x29')](_0x224b('0x116'),_0x1d9653[_0x224b('0x59')]));var _0x3e2a77=this['awsLex'][_0x224b('0x6e')](this,_0x1d9653);if(_0x3e2a77){for(var _0x56d855 in _0x3e2a77){if(_0x3e2a77[_0x224b('0x91')](_0x56d855)&&_['isString'](_0x3e2a77[_0x56d855])){this[_0x224b('0xe')][_0x224b('0xa2')](util['format'](_0x224b('0x117'),_0x56d855[_0x224b('0x68')]()),_0x3e2a77[_0x56d855]);}}if(_['isNil'](_0x3e2a77[_0x224b('0x118')])){return this['channel'][_0x224b('0xb2')](_0x224b('0x119'));}else{this[_0x224b('0x3f')](_0x3e2a77[_0x224b('0x118')],'out');return this[_0x224b('0xe')]['noop'](util['format'](_0x224b('0x11a'),_0x3e2a77[_0x224b('0x118')]));}}return this[_0x224b('0xe')]['error'](_0x1d9653,_0x224b('0x11b'));};AGIVertices[_0x224b('0x14')][_0x224b('0x11c')]=function(_0x27c029){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x11d'),_0x27c029[_0x224b('0x38')],_0x27c029[_0x224b('0x63')]));if(!this[_0x224b('0xa3')](_0x27c029['key'])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x11e'));}var _0x5bb4ac=_0x224b('0x11f');var _0x24f13c=util[_0x224b('0x29')](_0x224b('0x120'),FILES_PATH,rs[_0x224b('0x106')](0x4));var _0x6593e3=util[_0x224b('0x29')](_0x224b('0x99'),_0x24f13c,_0x5bb4ac);var _0x269530=!![];if(_0x27c029[_0x224b('0x121')]===_0x224b('0x122')){_0x269530=![];}var _0x3d64fd=this[_0x224b('0xe')][_0x224b('0x123')](_0x24f13c,_0x5bb4ac,_0x27c029[_0x224b('0x124')],_0x27c029['timeout'],undefined,_0x269530);if(_0x3d64fd[_0x224b('0xa0')]!==-0x1){this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x125'),_0x6593e3));var _0x4888b1=this[_0x224b('0x8a')][_0x224b('0x6e')](this,_0x27c029,_0x6593e3);if(_0x4888b1){for(var _0x388d8c in _0x4888b1){if(_0x4888b1[_0x224b('0x91')](_0x388d8c)){this[_0x224b('0xe')][_0x224b('0xa2')](util['format'](_0x224b('0x126'),_0x388d8c[_0x224b('0x68')]()),_0x4888b1[_0x388d8c]);}}return this['channel'][_0x224b('0xb2')](util['format'](_0x224b('0x127'),JSON[_0x224b('0x71')](_0x4888b1)));}}return _0x3d64fd;};AGIVertices[_0x224b('0x14')]['tildeasr']=function(_0x103c96){logger[_0x224b('0x2d')](util['format'](_0x224b('0x128'),_0x103c96[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x103c96['appid'])){return this[_0x224b('0xe')]['noop']('no\x20appid\x20configured');}if(!this[_0x224b('0xa3')](_0x103c96[_0x224b('0x8d')])){return this[_0x224b('0xe')]['noop'](_0x224b('0x129'));}var _0x5e414a=_0x224b('0x11f');var _0x3518c6=util[_0x224b('0x29')]('%s/recordings/%s',FILES_PATH,rs[_0x224b('0x106')](0x4));var _0x1f4955=util['format']('%s.%s',_0x3518c6,_0x5e414a);var _0x2b3e0d=!![];if(_0x103c96['beep']==='NOBEEP'){_0x2b3e0d=![];}var _0x48ce0d=this[_0x224b('0xe')][_0x224b('0x123')](_0x3518c6,_0x5e414a,_0x103c96[_0x224b('0x124')],_0x103c96['timeout'],undefined,_0x2b3e0d);if(_0x48ce0d[_0x224b('0xa0')]!==-0x1){this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x12a'),_0x1f4955));var _0x418f6b=this[_0x224b('0x8c')]['sync'](this,_0x103c96,_0x1f4955);if(_0x418f6b){for(var _0xe6572 in _0x418f6b){if(_0x418f6b[_0x224b('0x91')](_0xe6572)){this[_0x224b('0xe')]['setVariable'](util['format']('TILDE_ASR_%s',_0xe6572[_0x224b('0x68')]()),_0x418f6b[_0xe6572]);}}return this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x12b'),JSON[_0x224b('0x71')](_0x418f6b)));}}return _0x48ce0d;};AGIVertices['prototype'][_0x224b('0x12c')]=function(_0x4d0cae){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x12d'),_0x4d0cae[_0x224b('0x38')]));return this[_0x224b('0xe')][_0x224b('0x12e')](_0x4d0cae[_0x224b('0x3b')],_0x4d0cae[_0x224b('0x12f')],_0x4d0cae[_0x224b('0x3c')]);};AGIVertices[_0x224b('0x14')][_0x224b('0x130')]=function(_0x20cbe3){logger[_0x224b('0x2d')](util['format']('Enter\x20in\x20GOTOIF\x20(%s)\x20block',_0x20cbe3[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x20cbe3[_0x224b('0x131')])){return this['channel'][_0x224b('0x2b')](_0x20cbe3,_0x224b('0x132'));}try{var _0x69a451=eval(_0x20cbe3[_0x224b('0x131')])?_0x224b('0x133'):'false';this[_0x224b('0xe')]['noop'](util[_0x224b('0x29')](_0x224b('0x134'),_0x20cbe3[_0x224b('0x131')],_0x69a451));return{'code':0xc8,'result':_0x69a451};}catch(_0x236b2c){return{'code':0xc8,'result':_0x224b('0x135')};}};AGIVertices[_0x224b('0x14')]['gotoiftime']=function(_0x306f24){logger[_0x224b('0x2d')](util['format'](_0x224b('0x136'),_0x306f24[_0x224b('0x38')]));if(!this['isConfigured'](_0x306f24[_0x224b('0x137')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x306f24,_0x224b('0x138'));}var _0x16d238=this['getIntervals'][_0x224b('0x6e')](this,_0x306f24[_0x224b('0x137')]);if(!_0x16d238){return this['channel'][_0x224b('0x2b')](_0x306f24,_0x224b('0x139'));}for(var _0x4d2d0f=0x0;_0x4d2d0f<_0x16d238[_0x224b('0x9b')];_0x4d2d0f+=0x1){var _0x430a2c=this['channel'][_0x224b('0x9d')](util[_0x224b('0x29')]('IFTIME(%s?true:false)',_0x16d238[_0x4d2d0f]));if(_0x430a2c['result']===-0x1){return _0x430a2c;}logger[_0x224b('0x2d')](util['format'](_0x224b('0x13a'),_0x16d238[_0x4d2d0f],_0x430a2c[_0x224b('0x9e')]));if(_0x430a2c[_0x224b('0x9e')]===_0x224b('0x133')){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('IFTIME\x20%s\x20%s',_0x16d238[_0x4d2d0f],_0x224b('0x133')));this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('IFTIME\x20%s\x20%s',_0x16d238[_0x4d2d0f],_0x224b('0x133')));return{'code':0xc8,'result':_0x224b('0x133')};}else{logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x13a'),_0x16d238[_0x4d2d0f],_0x224b('0x135')));this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x13a'),_0x16d238[_0x4d2d0f],_0x224b('0x135')));}}return{'code':0xc8,'result':_0x224b('0x135')};};AGIVertices[_0x224b('0x14')][_0x224b('0x13b')]=function(_0x1d32c6){logger[_0x224b('0x2d')](util['format']('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x1d32c6['label']));return this['channel']['hangup']();};AGIVertices['prototype'][_0x224b('0x13c')]=function(_0x91155){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x13d'),_0x91155[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x91155[_0x224b('0x7b')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x11e'));}var _0x3aae32='wav';var _0x4e6756=util['format'](_0x224b('0x120'),FILES_PATH,rs[_0x224b('0x106')](0x4));var _0x1ad32f=util[_0x224b('0x29')](_0x224b('0x99'),_0x4e6756,_0x3aae32);var _0x17ea5b=!![];if(_0x91155[_0x224b('0x121')]===_0x224b('0x122')){_0x17ea5b=![];}var _0x5a4611=this['channel']['recordFile'](_0x4e6756,_0x3aae32,_0x91155[_0x224b('0x124')],_0x91155[_0x224b('0x63')],undefined,_0x17ea5b);if(_0x5a4611['result']!==-0x1){this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x13e'),_0x1ad32f));var _0x5ab91f=this['ispeechASR']['sync'](this,_0x91155,_0x1ad32f);if(_0x5ab91f){for(var _0x1e7f17 in _0x5ab91f){if(_0x5ab91f[_0x224b('0x91')](_0x1e7f17)){this[_0x224b('0xe')][_0x224b('0xa2')](util[_0x224b('0x29')]('ISPEECH_ASR_%s',_0x1e7f17[_0x224b('0x68')]()),_0x5ab91f[_0x1e7f17]);}}return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x13f'),JSON[_0x224b('0x71')](_0x5ab91f)));}}return _0x5a4611;};AGIVertices['prototype'][_0x224b('0x140')]=function(_0x29c9c0){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x141'),_0x29c9c0[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x29c9c0[_0x224b('0x7b')])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20key\x20configured');}if(!this[_0x224b('0xa3')](_0x29c9c0['text'])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20text\x20configured');}this[_0x224b('0xe')][_0x224b('0xb2')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x29c9c0[_0x224b('0x59')]));var _0xf01a91=this['ispeechTTS'][_0x224b('0x6e')](this,_0x29c9c0);if(_0xf01a91){this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x13e'),_0xf01a91));var _0xc2d294=this[_0x224b('0xe')][_0x224b('0xf0')](_0xf01a91,_0x29c9c0[_0x224b('0x124')]);try{fs[_0x224b('0xf1')](_0xf01a91+_0x224b('0x112'));}catch(_0x45ee85){logger[_0x224b('0x2b')](_0x45ee85);}return _0xc2d294;}return this[_0x224b('0xe')][_0x224b('0x2b')](_0x29c9c0,_0x224b('0x142'));};AGIVertices[_0x224b('0x14')][_0x224b('0x143')]=function(_0x4cb532){logger[_0x224b('0x2d')](util['format'](_0x224b('0x144'),_0x4cb532[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x4cb532['findBy'])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x4cb532,'no\x20find\x20by\x20configured');}logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x145'),this['channel'][_0x224b('0x4b')],_0x4cb532['findBy']));var _0x5f2185=this['agentLogin'][_0x224b('0x6e')](this,_0x4cb532[_0x224b('0x146')]);if(_0x5f2185){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x147'),this['channel']['callerid'],_0x4cb532[_0x224b('0x146')]));this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x147'),this[_0x224b('0xe')]['callerid'],_0x4cb532[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x148')};}else{logger['info'](util[_0x224b('0x29')](_0x224b('0x149'),this['channel'][_0x224b('0x4b')],_0x4cb532[_0x224b('0x146')]));this[_0x224b('0xe')]['noop'](util[_0x224b('0x29')](_0x224b('0x149'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x4cb532[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x14a')};}};AGIVertices[_0x224b('0x14')]['logout']=function(_0x409fe1){logger[_0x224b('0x2d')](util['format'](_0x224b('0x14b'),_0x409fe1[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x409fe1[_0x224b('0x146')])){return this[_0x224b('0xe')]['error'](_0x409fe1,_0x224b('0x14c'));}logger[_0x224b('0x2d')](util[_0x224b('0x29')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0x224b('0xe')][_0x224b('0x4b')],_0x409fe1[_0x224b('0x146')]));var _0x1ff13b=this[_0x224b('0x4e')][_0x224b('0x6e')](this,_0x409fe1[_0x224b('0x146')]);if(_0x1ff13b){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x224b('0xe')][_0x224b('0x4b')],_0x409fe1[_0x224b('0x146')]));this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x147'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x409fe1[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x148')};}else{logger['info'](util[_0x224b('0x29')](_0x224b('0x149'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x409fe1[_0x224b('0x146')]));this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x149'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x409fe1[_0x224b('0x146')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x224b('0x14')][_0x224b('0x14d')]=function(_0x2b8385){logger['info'](util['format']('Enter\x20in\x20MATH\x20(%s)\x20block',_0x2b8385[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x2b8385['operation'])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x2b8385,_0x224b('0x14e'));}this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x14f'),_0x2b8385[_0x224b('0x150')]));var _0x10766c=eval(_0x2b8385[_0x224b('0x150')]);if(!this[_0x224b('0xa3')](_0x2b8385[_0x224b('0xd1')])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x4ae122=this['getVariable'][_0x224b('0x6e')](this,_0x2b8385[_0x224b('0xd1')]);if(!_0x4ae122){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x2b8385,_0x224b('0xd2'));}if(_['isArray'](_0x10766c)){var _0xb5781=this;_0x10766c[_0x224b('0xd3')](function(_0x4f9705,_0x4cb11f){_0xb5781['channel'][_0x224b('0xa2')](util['format'](_0x224b('0x151'),_0x4ae122,_0x4cb11f),_0x4f9705);});return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('variable\x20%s[key]\x20set',_0x4ae122));}else{return this[_0x224b('0xe')][_0x224b('0xa2')](_0x4ae122,_0x10766c);}};AGIVertices['prototype'][_0x224b('0x152')]=function(_0x46515d){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('Enter\x20in\x20MENU\x20(%s)\x20block',_0x46515d[_0x224b('0x38')]));if(_0x46515d[_0x224b('0xa5')]===0x0){return this[_0x224b('0xa4')](_0x46515d);}_0x46515d['retry']-=0x1;if(!this[_0x224b('0xa3')](_0x46515d[_0x224b('0xfe')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x46515d,_0x224b('0xfd'));}var _0x1f5ccd=this['getSound']['sync'](this,_0x46515d[_0x224b('0xfe')]);if(!_0x1f5ccd){return this['channel'][_0x224b('0x2b')](_0x46515d,_0x224b('0xff'));}var _0x4730cf=this[_0x224b('0xe')]['getData'](_0x1f5ccd,_0x46515d[_0x224b('0x153')],_0x46515d[_0x224b('0x154')]);var _0x26752f=_0x4730cf[_0x224b('0xa0')];if(_0x4730cf[_0x224b('0xa0')]===-0x1){this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x46515d,'-1');return _0x4730cf;}else if(_0x4730cf[_0x224b('0x9e')]===_0x224b('0x63')){_0x4730cf['result']=_0x4730cf[_0x224b('0xa0')]['length']>0x0?_0x4730cf[_0x224b('0xa0')]:'t';}else if(_[_0x224b('0x41')](_0x4730cf[_0x224b('0xa0')])){_0x4730cf['result']='#';_0x26752f='#';}if(!this['isConfigured'](_0x46515d[_0x224b('0xd1')])){this['channel']['noop'](_0x224b('0x100'));}else{var _0x5ced07=this['getVariable'][_0x224b('0x6e')](this,_0x46515d[_0x224b('0xd1')]);if(!_0x5ced07){return this['channel']['error'](_0x46515d,_0x224b('0xd2'));}this[_0x224b('0xe')][_0x224b('0xa2')](_0x5ced07,_0x26752f);}this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x46515d,_0x26752f);return _0x4730cf;};AGIVertices['prototype']['noop']=function(_0x142fd6){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x155'),_0x142fd6[_0x224b('0x38')]));return this[_0x224b('0xe')][_0x224b('0xb2')](_0x142fd6[_0x224b('0x156')]||_0x142fd6[_0x224b('0x38')]);};AGIVertices['prototype'][_0x224b('0x157')]=function(_0x18a799){logger['info'](util['format'](_0x224b('0x158'),_0x18a799[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x18a799[_0x224b('0x146')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x18a799,_0x224b('0x14c'));}logger[_0x224b('0x2d')](util['format'](_0x224b('0x145'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x18a799[_0x224b('0x146')]));var _0x52f277=this[_0x224b('0x47')]['sync'](this,_0x18a799[_0x224b('0x159')]);var _0x21b25a=this['agentPause']['sync'](this,_0x18a799[_0x224b('0x146')],_0x52f277);if(_0x21b25a){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x147'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x18a799[_0x224b('0x146')]));this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x147'),this[_0x224b('0xe')]['callerid'],_0x18a799[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x148')};}else{logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x149'),this[_0x224b('0xe')]['callerid'],_0x18a799['findBy']));this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x147'),this[_0x224b('0xe')][_0x224b('0x4b')],_0x18a799[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x14a')};}};AGIVertices[_0x224b('0x14')][_0x224b('0x15a')]=function(_0x1ff8b1){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x15b'),_0x1ff8b1['label']));if(!this[_0x224b('0xa3')](_0x1ff8b1[_0x224b('0xfe')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x1ff8b1,_0x224b('0xfd'));}var _0x5b0f9c=this[_0x224b('0x1d')][_0x224b('0x6e')](this,_0x1ff8b1[_0x224b('0xfe')]);if(!_0x5b0f9c){return this['channel'][_0x224b('0x2b')](_0x1ff8b1,'no\x20file\x20audio\x20found');}var _0x35d873=this[_0x224b('0xe')][_0x224b('0xb4')]('PLAYBACK',[_0x5b0f9c,_0x1ff8b1[_0x224b('0xdd')]]);if(_0x35d873[_0x224b('0xa0')]===-0x1){return _0x35d873;}return this[_0x224b('0xe')]['noop'](util['format']('Executed\x20command\x20%s\x20%s',_0x224b('0x15c'),_0x5b0f9c));};AGIVertices[_0x224b('0x14')][_0x224b('0x15d')]=function(_0x132216){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x15e'),_0x132216['label']));if(!this[_0x224b('0xa3')](_0x132216[_0x224b('0x15f')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x132216,_0x224b('0x160'));}var _0x10c0e7='';var _0x4cb85c=parseInt(_0x132216['queue_id'],0xa);if(isNaN(_0x4cb85c)){_0x10c0e7=_0x132216[_0x224b('0x15f')];}else{_0x10c0e7=this[_0x224b('0x161')][_0x224b('0x6e')](this,_0x132216[_0x224b('0x15f')]);if(!_0x10c0e7){return this['channel']['error'](_0x132216,'no\x20queue\x20found');}}var _0x4bd3d2='';if(this[_0x224b('0xa3')](_0x132216['file_id'])){var _0x1ebcf7=this['getSound'][_0x224b('0x6e')](this,_0x132216[_0x224b('0xfe')]);if(_0x1ebcf7){_0x4bd3d2=_0x1ebcf7;}}this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x132216,_0x10c0e7);if(_0x132216['opts'][_0x224b('0x162')]('x')<0x0){_0x132216[_0x224b('0xdd')]+='x';}if(_0x132216[_0x224b('0xdd')][_0x224b('0x162')]('X')<0x0){_0x132216[_0x224b('0xdd')]+='X';}this['channel'][_0x224b('0xa2')]('XMCS-QUEUE',_0x10c0e7?_0x10c0e7[_0x224b('0x163')]():'');var _0x42f4f2=this['channel'][_0x224b('0xb4')](_0x224b('0x164'),[_0x10c0e7,_0x132216[_0x224b('0xdd')],_0x132216[_0x224b('0x61')],_0x4bd3d2,_0x132216['timeout'],_0x132216[_0x224b('0x8')],_0x132216[_0x224b('0x165')],_0x132216[_0x224b('0x166')],'',_0x132216[_0x224b('0x167')]]);if(_0x42f4f2[_0x224b('0xa0')]===-0x1){return _0x42f4f2;}return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0xb5'),'QUEUE',_0x10c0e7));};AGIVertices[_0x224b('0x14')][_0x224b('0x168')]=function(_0x52c7af){logger[_0x224b('0x2d')](util['format'](_0x224b('0x169'),_0x52c7af[_0x224b('0x38')]));var _0x5e973e=_0x52c7af[_0x224b('0x16a')]||'wav';var _0x2438b1=util[_0x224b('0x29')](_0x224b('0x16b'),this[_0x224b('0xe')][_0x224b('0x37')],rs[_0x224b('0x106')](0x5));var _0x26a065=util['format'](_0x224b('0x16c'),FILES_PATH,_0x2438b1,_0x5e973e);var _0x2ebad7=util[_0x224b('0x29')](_0x224b('0x120'),FILES_PATH,_0x2438b1);this[_0x224b('0x3a')][_0x224b('0x6e')](this,_0x52c7af,_0x2438b1,_0x26a065);this['channel'][_0x224b('0xa2')](_0x224b('0x16d'),_0x2438b1);logger[_0x224b('0x2d')](_0x224b('0x16e'),_0x2ebad7,_0x5e973e,_0x52c7af[_0x224b('0x16f')],_0x52c7af[_0x224b('0x63')]);return this[_0x224b('0xe')][_0x224b('0x123')](_0x2ebad7,_0x5e973e,_0x52c7af['escape_digits'],_0x52c7af['timeout'],undefined,!![]);};AGIVertices['prototype'][_0x224b('0x170')]=function(_0x26e0b3){logger[_0x224b('0x2d')](util['format'](_0x224b('0x171'),_0x26e0b3[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x26e0b3[_0x224b('0x61')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x172'));}var _0x79e3fd=this['restAPI'][_0x224b('0x6e')](this,_0x26e0b3);logger['info'](util['format'](_0x224b('0x173'),util['inspect'](_0x79e3fd,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x26e0b3[_0x224b('0xd1')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x174'));}var _0x5a35fb=this['getVariable'][_0x224b('0x6e')](this,_0x26e0b3['variable_id']);if(!_0x5a35fb){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x26e0b3,_0x224b('0xd2'));}this[_0x224b('0xe')]['setVariable'](util[_0x224b('0x29')](_0x224b('0x175'),_0x5a35fb),_0x79e3fd['statusCode']?_0x79e3fd['statusCode']:'200');this[_0x224b('0xe')][_0x224b('0xa2')](util[_0x224b('0x29')]('%s_STATUS_MESSAGE',_0x5a35fb),_0x79e3fd[_0x224b('0x176')]?_0x79e3fd['statusMessage']:'OK');if(_0x79e3fd[_0x224b('0x72')]){try{this[_0x224b('0x97')](_0x79e3fd[_0x224b('0x72')],_0x5a35fb);}catch(_0x31bf82){logger[_0x224b('0x2b')](util['format'](_0x224b('0x177'),_0x5a35fb));}}return this['channel']['noop'](util[_0x224b('0x29')](_0x224b('0xd6'),_0x5a35fb));};AGIVertices['prototype'][_0x224b('0x178')]=function(_0x1f98ac){logger[_0x224b('0x2d')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1f98ac[_0x224b('0x38')]));return this[_0x224b('0xe')]['sayDigits'](_0x1f98ac[_0x224b('0x179')][_0x224b('0x55')](/\s+/g,''),_0x1f98ac[_0x224b('0x16f')]);};AGIVertices[_0x224b('0x14')][_0x224b('0x17a')]=function(_0x1860af){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1860af[_0x224b('0x38')]));return this[_0x224b('0xe')]['sayNumber'](_0x1860af[_0x224b('0x64')][_0x224b('0x55')](/\s+/g,''),_0x1860af[_0x224b('0x16f')]);};AGIVertices['prototype'][_0x224b('0x17b')]=function(_0x50ca90){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x17c'),_0x50ca90['label']));return this[_0x224b('0xe')]['sayPhonetic'](_0x50ca90[_0x224b('0x59')],_0x50ca90[_0x224b('0x16f')]);};AGIVertices[_0x224b('0x14')][_0x224b('0x17d')]=function(_0x312c85){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x17e'),_0x312c85[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x312c85['account_id'])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x17f'));}var _0x1f1a2b=this['getMailAccount'][_0x224b('0x6e')](this,_0x312c85['account_id']);if(!_0x1f1a2b||!_0x1f1a2b[_0x224b('0x180')]){return this[_0x224b('0xe')]['error'](_0x312c85,_0x224b('0x181'));}var _0x50102b={'from':util['format'](_0x224b('0x182'),_0x1f1a2b[_0x224b('0x13')],_0x1f1a2b[_0x224b('0x183')]||_0x1f1a2b[_0x224b('0x180')][_0x224b('0x184')]),'to':_0x312c85['to']||'','cc':_0x312c85['cc']||'','bcc':_0x312c85[_0x224b('0x185')]||'','subject':_0x312c85[_0x224b('0x186')],'html':_0x312c85[_0x224b('0x59')],'text':_0x312c85[_0x224b('0x59')]};var _0xf7e58c={'tls':{'rejectUnauthorized':![]}};if(_0x1f1a2b[_0x224b('0x180')]['service']){_0xf7e58c[_0x224b('0x187')]=_0x1f1a2b[_0x224b('0x180')][_0x224b('0x187')];}else{_0xf7e58c[_0x224b('0x188')]=_0x1f1a2b[_0x224b('0x180')][_0x224b('0x188')];_0xf7e58c[_0x224b('0x189')]=_0x1f1a2b['Smtp'][_0x224b('0x189')];_0xf7e58c[_0x224b('0x18a')]=_0x1f1a2b[_0x224b('0x180')][_0x224b('0x18a')];}if(_0x1f1a2b['Smtp'][_0x224b('0x18b')]){_0xf7e58c[_0x224b('0x18c')]={'user':_0x1f1a2b[_0x224b('0x180')][_0x224b('0x184')],'pass':_0x1f1a2b[_0x224b('0x180')][_0x224b('0x18d')]};}if(this[_0x224b('0xa3')](_0x312c85['template_id'])){}logger[_0x224b('0x18e')]('sendMail\x20message',JSON['stringify'](_0x50102b));this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x312c85,_0x312c85[_0x224b('0x18f')]);this[_0x224b('0xe')][_0x224b('0xb2')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x1f1a2b[_0x224b('0x13')]));this[_0x224b('0x22')][_0x224b('0x6e')](this,_0xf7e58c,_0x50102b);return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x190'));};AGIVertices[_0x224b('0x14')][_0x224b('0x191')]=function(_0x15b922){logger[_0x224b('0x2d')](util['format'](_0x224b('0x192'),_0x15b922[_0x224b('0x38')]));return this[_0x224b('0xe')]['noop'](_0x224b('0x193'));};AGIVertices[_0x224b('0x14')]['sendSMS']=function(_0x30a128){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x194'),_0x30a128[_0x224b('0x38')]));if(!this['isConfigured'](_0x30a128[_0x224b('0x195')])){return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x196'));}var _0x574788=this[_0x224b('0x33')][_0x224b('0x6e')](this,_0x30a128['sms_account_id']);if(!_0x574788){return this[_0x224b('0xe')]['error'](_0x30a128,_0x224b('0x197'));}var _0x41f186={'body':_0x30a128[_0x224b('0x198')],'phone':_0x30a128['to']||'','SmsAccountId':_0x574788['id']};logger['debug'](_0x224b('0x199'),JSON[_0x224b('0x71')](_0x41f186));this['createSquareDetailsReport'][_0x224b('0x6e')](this,_0x30a128,_0x30a128[_0x224b('0x195')]);this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x19a'),_0x574788[_0x224b('0x13')]));this['createSmsMessage'][_0x224b('0x6e')](this,_0x41f186);return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x19b'));};AGIVertices['prototype'][_0x224b('0x19c')]=function(_0x256803){logger[_0x224b('0x2d')](util[_0x224b('0x29')]('Enter\x20in\x20SET\x20(%s)\x20block',_0x256803[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x256803[_0x224b('0xd1')])){return this['channel'][_0x224b('0x2b')](_0x256803,_0x224b('0x19d'));}var _0x2010db=this[_0x224b('0x9d')][_0x224b('0x6e')](this,_0x256803[_0x224b('0xd1')]);if(!_0x2010db){return this['channel'][_0x224b('0x2b')](_0x256803,'no\x20variable\x20found');}return this[_0x224b('0xe')][_0x224b('0xa2')](_0x2010db,_0x256803[_0x224b('0x19e')]);};AGIVertices[_0x224b('0x14')][_0x224b('0x19f')]=function(_0x56cca9){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x1a0'),_0x56cca9[_0x224b('0x38')]));this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x1a1'));if(_0x56cca9[_0x224b('0xa9')]===_0x224b('0x1a2')){this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x1a3'));return this['channel']['answer']();}return this[_0x224b('0xe')][_0x224b('0xb2')](_0x224b('0x1a4'));};AGIVertices['prototype'][_0x224b('0x1a5')]=function(_0x46f7c9){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x1a6'),_0x46f7c9[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0x46f7c9[_0x224b('0x1a7')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x46f7c9,_0x224b('0x1a8'));}var _0x140c61=this[_0x224b('0x16')]['sync'](this,_0x46f7c9['project_id']);if(!this[_0x224b('0xa3')](_0x140c61)){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x46f7c9,util[_0x224b('0x29')](_0x224b('0x1a9'),_0x46f7c9['project_id']));}if(_0x140c61===this[_0x224b('0xe')][_0x224b('0x39')]){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x46f7c9,_0x224b('0x1aa'));}this['createSquareDetailsReport'][_0x224b('0x6e')](this,_0x46f7c9,_0x140c61);var _0x3b753b=this[_0x224b('0xe')]['exec'](_0x224b('0x1ab'),util[_0x224b('0x29')]('agi://%s/square,\x22%s\x22,\x22%s\x22',config[_0x224b('0x8')][_0x224b('0x188')]||_0x224b('0x1ac'),_0x140c61,this['channel'][_0x224b('0x39')]));if(_0x3b753b[_0x224b('0xa0')]===-0x1){return _0x3b753b;}return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('Executed\x20command\x20%s\x20%s',_0x224b('0x1ab'),_0x140c61));};AGIVertices[_0x224b('0x14')][_0x224b('0x1ad')]=function(_0x2508ae){logger['info'](util[_0x224b('0x29')](_0x224b('0x1ae'),_0x2508ae['label']));var _0xbc9a73=this['shellCommand'][_0x224b('0x6e')](this,_0x2508ae[_0x224b('0xa7')]);this[_0x224b('0x36')][_0x224b('0x6e')](this,_0x2508ae,_0x2508ae['command']);if(this[_0x224b('0xa3')](_0x2508ae[_0x224b('0xd1')])){var _0x1212a2=this[_0x224b('0x9d')][_0x224b('0x6e')](this,_0x2508ae[_0x224b('0xd1')]);if(_0x1212a2){this[_0x224b('0xe')][_0x224b('0xa2')](_0x1212a2,_0xbc9a73);return this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x2508ae[_0x224b('0xa7')],_0x1212a2));}}return this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x2508ae[_0x224b('0xa7')]));};AGIVertices['prototype'][_0x224b('0x1af')]=function(_0x419414){logger['info'](util[_0x224b('0x29')](_0x224b('0x1b0'),_0x419414[_0x224b('0x38')]));if(!this['isConfigured'](_0x419414['apiKey'])){return this[_0x224b('0xe')][_0x224b('0xb2')]('no\x20apiKey\x20configured');}if(!this[_0x224b('0xa3')](_0x419414['text'])){return this['channel'][_0x224b('0xb2')](_0x224b('0xb9'));}this['channel'][_0x224b('0xb2')](util[_0x224b('0x29')](_0x224b('0x1b1'),_0x419414['text']));var _0x5c8cf6=this[_0x224b('0x56')][_0x224b('0x6e')](this,_0x419414);if(_0x5c8cf6){this[_0x224b('0xe')]['noop'](util['format'](_0x224b('0x1b2'),_0x5c8cf6));var _0x42dff6=this[_0x224b('0xe')][_0x224b('0xf0')](_0x5c8cf6);try{fs[_0x224b('0xf1')](_0x5c8cf6+_0x224b('0x112'));}catch(_0x5eb2e5){logger[_0x224b('0x2b')](_0x5eb2e5);}return _0x42dff6;}return this[_0x224b('0xe')][_0x224b('0x2b')](_0x419414,_0x224b('0x1b3'));};AGIVertices[_0x224b('0x14')]['tts']=function(_0x477414){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x1b4'),_0x477414['label']));if(!this[_0x224b('0xa3')](_0x477414[_0x224b('0x59')])){return this[_0x224b('0xe')]['noop'](_0x224b('0xb9'));}this[_0x224b('0xe')][_0x224b('0xb2')](util[_0x224b('0x29')]('Trying\x20Google\x20TTS\x20%s',_0x477414[_0x224b('0x59')]));var _0xf21ca=this['googleTTS'][_0x224b('0x6e')](this,_0x477414);if(_0xf21ca){this[_0x224b('0xe')][_0x224b('0xb2')](util['format'](_0x224b('0x1b5'),_0xf21ca));var _0x4a9e09=this['channel'][_0x224b('0xf0')](_0xf21ca);try{fs['unlink'](_0xf21ca+_0x224b('0x112'));}catch(_0x858275){logger[_0x224b('0x2b')](_0x858275);}return _0x4a9e09;}return this[_0x224b('0xe')][_0x224b('0x2b')](_0x477414,_0x224b('0x1b6'));};AGIVertices[_0x224b('0x14')][_0x224b('0x1b7')]=function(_0xbd4778){logger[_0x224b('0x2d')](util['format'](_0x224b('0x1b8'),_0xbd4778[_0x224b('0x38')]));if(!this[_0x224b('0xa3')](_0xbd4778[_0x224b('0x146')])){return this[_0x224b('0xe')]['error'](_0xbd4778,_0x224b('0x14c'));}logger[_0x224b('0x2d')](util['format'](_0x224b('0x145'),this[_0x224b('0xe')][_0x224b('0x4b')],_0xbd4778[_0x224b('0x146')]));var _0x8a40a9=this[_0x224b('0x4d')][_0x224b('0x6e')](this,_0xbd4778[_0x224b('0x146')]);if(_0x8a40a9){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x147'),this[_0x224b('0xe')][_0x224b('0x4b')],_0xbd4778[_0x224b('0x146')]));this[_0x224b('0xe')]['noop'](util['format'](_0x224b('0x147'),this['channel'][_0x224b('0x4b')],_0xbd4778[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x148')};}else{logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x149'),this['channel'][_0x224b('0x4b')],_0xbd4778['findBy']));this['channel'][_0x224b('0xb2')](util['format']('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x224b('0xe')][_0x224b('0x4b')],_0xbd4778[_0x224b('0x146')]));return{'code':0xc8,'result':_0x224b('0x14a')};}};AGIVertices[_0x224b('0x14')][_0x224b('0x1b9')]=function(_0x3b1219){logger[_0x224b('0x2d')](util[_0x224b('0x29')](_0x224b('0x1ba'),_0x3b1219[_0x224b('0x38')]));var _0x5e2b5c=this['channel'][_0x224b('0xb4')](_0x224b('0x1bb'),[_0x3b1219[_0x224b('0x1bc')],_0x3b1219[_0x224b('0x76')]]);if(_0x5e2b5c['result']===-0x1){return _0x5e2b5c;}return this[_0x224b('0xe')]['noop'](util['format'](_0x224b('0xb5'),_0x224b('0x1bb'),_0x3b1219['mailbox']));};AGIVertices[_0x224b('0x14')][_0x224b('0x1bd')]=function(_0x432b89){logger[_0x224b('0x2d')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x432b89[_0x224b('0x38')]));if(!this['isConfigured'](_0x432b89[_0x224b('0xd1')])){return this[_0x224b('0xe')][_0x224b('0x2b')](_0x432b89,_0x224b('0x19d'));}var _0x3c5f84=this['getVariable'][_0x224b('0x6e')](this,_0x432b89[_0x224b('0xd1')]);if(!_0x3c5f84){return this[_0x224b('0xe')]['error'](_0x432b89,_0x224b('0xd2'));}var _0x2ecd0f=this[_0x224b('0xe')][_0x224b('0x9d')](_0x3c5f84);return{'code':0xc8,'result':_0x2ecd0f[_0x224b('0x9e')]?_0x2ecd0f[_0x224b('0x9e')]:'-'};};String[_0x224b('0x14')][_0x224b('0x9c')]=function(_0x54aaf3,_0x2642c9){return this[_0x224b('0x9a')](_0x54aaf3)[_0x224b('0x1be')](_0x2642c9);};module[_0x224b('0x1bf')]=AGIVertices; \ No newline at end of file +var _0xdd74=['Mail\x20message\x20added\x20to\x20outgoing\x20process','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','sendSMS','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','sms_text','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','project_id','no\x20subproject\x20selected','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','tts','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','googleTTS','Google\x20TTS\x20is\x20unreachable','unpause','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','vswitch','join','exports','path','util','shelljs','odbc','randomstring','moment','mustache','agi','../../config/environment','./scripts','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','then','name','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSoundPath','save_name','getMailAccount','getMailAccountById','sendMailMessage','mailRpc','getIntervals','getIntervalById','map','Intervals','interval','getQueryOdbc','open','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','uniqueid','agicommand','arg_1','callerid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','callback_','random','lastName','isNil','list_id','scheduledAt','callback','callback_priority','agentPause','agent','error','agentUnpause','agentLogout','agentLogin','internal','format','LOCAL','shellCommand','exec','trim','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','MALE','MP3','google_tts_language','restAPI','url','method','number','timeout','includes','POST','PUT','toUpperCase','body','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','model','awsPolly','aws_secret_access_key','aws_polly_region','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','aws_bot_name','googleASR','tildeASR','appsecret','clear','clone','hasOwnProperty','isString','recursiveNodeIndex','isArray','length','saveRestApiResult','isPlainObject','%s.%s','setVariable','replaceObjectAllVariables','replaceAllVariables','split','replaceAll','extra','getAndSetVariable','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20AGI\x20(%s)\x20block','label','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','isConfigured','Wait\x20%s\x20seconds\x20before\x20answer','wait','result','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','phone','custom_app','application','noop','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','MRCPRecog','SESTEK_ASR_CONFIDENCE','RECOG_INSTANCE()','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20odbc\x20database\x20found','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','opts','Executed\x20command\x20%s','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','no\x20password\x20configured','ndassistant_url','bot','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','unlink','.wav','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','retry','getSound','file_id','variable_id','toString','test','mindigit','maxdigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','no\x20valid\x20credentials\x20configured','no\x20text\x20configured','aws\x20Polly\x20%s\x20file\x20created','aws\x20Polly\x20is\x20unreachable','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','message','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','%s/recordings/%s','beep','NOBEEP','intKey','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','no\x20appid\x20configured','no\x20appsecret\x20configured','recordFile','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','context','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','true','EVAL\x20CONDITION\x20%s\x20%s','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','wav','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','findBy','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','AGENT\x20%s\x20FOUND\x20BY','success','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','variable\x20%s[key]\x20set','menu','Enter\x20in\x20MENU\x20(%s)\x20block','no\x20file\x20audio\x20selected','getData','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','getPause','pause_id','playback','no\x20file\x20audio\x20found','PLAYBACK','Executed\x20command\x20%s\x20%s','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','indexOf','XMCS-QUEUE','toLowerCase','macro','gosub','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','%s/recordings/%s.%s','createSquareRecording','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','sayDigits','digits','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','account_id','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','bcc','subject','Smtp','service','host','port','secure','authentication','auth','pass','template_id','sendMail\x20message'];(function(_0x179cc9,_0x15051d){var _0x5c70db=function(_0x41ca05){while(--_0x41ca05){_0x179cc9['push'](_0x179cc9['shift']());}};_0x5c70db(++_0x15051d);}(_0xdd74,0x1e7));var _0x4dd7=function(_0x28e6ca,_0xc0f98b){_0x28e6ca=_0x28e6ca-0x0;var _0x35078b=_0xdd74[_0x28e6ca];return _0x35078b;};'use strict';var fs=require('fs');var path=require(_0x4dd7('0x0'));var util=require(_0x4dd7('0x1'));var _=require('lodash');var sh=require(_0x4dd7('0x2'));var odbc=require(_0x4dd7('0x3'))();var rs=require(_0x4dd7('0x4'));var moment=require(_0x4dd7('0x5'));var Mustache=require(_0x4dd7('0x6'));var rp=require('request-promise');var logger=require('../../config/logger')(_0x4dd7('0x7'));var config=require(_0x4dd7('0x8'));var scripts=require(_0x4dd7('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0x4dd7('0xa'),_0x4dd7('0xb')];var verticesWithRetry=['menu',_0x4dd7('0xc'),_0x4dd7('0xd')];var AGIVertices=function(_0x4e1ee5,_0x14abf3,_0x201b45){this[_0x4dd7('0xe')]=_0x4e1ee5;this[_0x4dd7('0xf')]=_0x14abf3;this['mailRpc']=_0x201b45;};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x11')]=function(_0x2753e2,_0x545ac1){this[_0x4dd7('0xf')]['getVariableById'](_0x2753e2)[_0x4dd7('0x12')](function(_0x3f75b6){_0x545ac1(null,_0x3f75b6?_0x3f75b6[_0x4dd7('0x13')]:![]);})['catch'](function(_0x1159bc){_0x545ac1(_0x1159bc);});};AGIVertices['prototype'][_0x4dd7('0x14')]=function(_0x3da0ad,_0x278c51){this[_0x4dd7('0xf')][_0x4dd7('0x15')](_0x3da0ad)['then'](function(_0x503b65){_0x278c51(null,_0x503b65?_0x503b65[_0x4dd7('0x13')]:![]);})[_0x4dd7('0x16')](function(_0x40e8dc){_0x278c51(_0x40e8dc);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x17')]=function(_0x9eae51,_0x25dd09){this['rpc']['getSquareProjectById'](_0x9eae51)[_0x4dd7('0x12')](function(_0x3dd767){_0x25dd09(null,_0x3dd767?_0x3dd767[_0x4dd7('0x13')]:![]);})[_0x4dd7('0x16')](function(_0x23e44e){_0x25dd09(_0x23e44e);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x18')]=function(_0x2209dd,_0x2aee60){this[_0x4dd7('0xf')][_0x4dd7('0x19')](_0x2209dd)[_0x4dd7('0x12')](function(_0x424fa3){_0x2aee60(null,_0x424fa3?_0x424fa3[_0x4dd7('0x1a')]:![]);})[_0x4dd7('0x16')](function(_0x5f13fd){_0x2aee60(_0x5f13fd);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1b')]=function(_0x45bdf6,_0xbcb86a){this[_0x4dd7('0xf')][_0x4dd7('0x1c')](_0x45bdf6)['then'](function(_0x729926){_0xbcb86a(null,_0x729926?_0x729926[_0x4dd7('0x13')]:![]);})[_0x4dd7('0x16')](function(_0x2f40fe){_0xbcb86a(_0x2f40fe);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1d')]=function(_0xa45b55,_0x6e7251){this['rpc']['getTrunkById'](_0xa45b55)['then'](function(_0x167b6f){_0x6e7251(null,_0x167b6f?_0x167b6f[_0x4dd7('0x13')]:![]);})['catch'](function(_0x42c484){_0x6e7251(_0x42c484);});};AGIVertices[_0x4dd7('0x10')]['getSound']=function(_0x33a06e,_0x1eeab8){var _0xecbaf5=this;this[_0x4dd7('0xf')]['getSoundById'](_0x33a06e)['then'](function(_0x107b2e){_0x1eeab8(null,_0x107b2e?_0xecbaf5[_0x4dd7('0x1e')](_0x107b2e[_0x4dd7('0x1f')]):![]);})[_0x4dd7('0x16')](function(_0x3af200){_0x1eeab8(_0x3af200);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x20')]=function(_0x38e9ab,_0x5f5587){this[_0x4dd7('0xf')][_0x4dd7('0x21')](_0x38e9ab)['then'](function(_0x26af5){_0x5f5587(null,_0x26af5?_0x26af5:![]);})['catch'](function(_0x11606c){_0x5f5587(_0x11606c);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x22')]=function(_0x4ea4e9,_0x203b52,_0x30ed8b){this[_0x4dd7('0x23')][_0x4dd7('0x22')](_0x4ea4e9,_0x203b52)[_0x4dd7('0x12')](function(){_0x30ed8b(null);})['catch'](function(_0x18ecb3){_0x30ed8b(_0x18ecb3);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x24')]=function(_0x497a03,_0x2c0ba2){this[_0x4dd7('0xf')][_0x4dd7('0x25')](_0x497a03)['then'](function(_0x51bca8){if(_0x51bca8){if(_0x51bca8['IntervalId']){_0x2c0ba2(null,[_0x51bca8['interval']]);}else{_0x2c0ba2(null,_[_0x4dd7('0x26')](_0x51bca8[_0x4dd7('0x27')],_0x4dd7('0x28')));}}else{_0x2c0ba2(null,![]);}})[_0x4dd7('0x16')](function(_0x47f531){_0x2c0ba2(_0x47f531);});};AGIVertices[_0x4dd7('0x10')]['getSoundPath']=function(_0x2003c1){return util['format']('%s/sounds/converted/%s',FILES_PATH,_0x2003c1);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x29')]=function(_0x49edb5,_0x28dbe2,_0x309243){odbc[_0x4dd7('0x2a')](_0x49edb5,function(_0x34bd60){if(_0x34bd60){logger['error'](_0x4dd7('0x2b'),_0x34bd60);_0x309243(_0x34bd60);}else{logger['info'](_0x4dd7('0x2c'));odbc[_0x4dd7('0x2d')](_0x28dbe2,function(_0x3de0d1,_0x1bf609){if(_0x3de0d1){logger[_0x4dd7('0x2e')](_0x4dd7('0x2f'),_0x28dbe2);_0x309243(_0x3de0d1);}else{logger[_0x4dd7('0x2e')](_0x4dd7('0x30'),_0x28dbe2);odbc[_0x4dd7('0x31')](function(_0xd5e6d0){if(_0xd5e6d0){logger['error'](_0x4dd7('0x32'),_0xd5e6d0);}_0x309243(null,_0x1bf609);});}});}});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x33')]=function(_0x3fff20,_0x252eb2){this[_0x4dd7('0xf')][_0x4dd7('0x34')](_0x3fff20)['then'](function(_0x1b272b){_0x252eb2(null,_0x1b272b?_0x1b272b:![]);})[_0x4dd7('0x16')](function(_0x2eb1bd){_0x252eb2(_0x2eb1bd);});};AGIVertices['prototype']['createSmsMessage']=function(_0x2c7f92,_0x351b9e){this[_0x4dd7('0xf')][_0x4dd7('0x35')](_0x2c7f92)[_0x4dd7('0x12')](function(_0x2f3504){_0x351b9e(null,_0x2f3504);})[_0x4dd7('0x16')](function(_0x2d2464){_0x351b9e(_0x2d2464);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x36')]=function(_0x1d4857,_0x4ff02f,_0x32f2ad){this[_0x4dd7('0xf')]['createSquareDetailsReport']({'uniqueid':this[_0x4dd7('0xe')][_0x4dd7('0x37')],'node':_0x1d4857['label'],'application':_0x1d4857[_0x4dd7('0x38')],'data':_0x4ff02f||null,'project_name':this['channel'][_0x4dd7('0x39')],'callerid':this[_0x4dd7('0xe')][_0x4dd7('0x3a')]})['then'](function(_0x2b5e7d){if(_0x32f2ad){_0x32f2ad(null,_0x2b5e7d);}})['catch'](function(_0x346cf9){if(_0x32f2ad){_0x32f2ad(_0x346cf9);}});};AGIVertices[_0x4dd7('0x10')]['createSquareRecording']=function(_0x447021,_0x2d8cd7,_0x48864f,_0x119b9d){this[_0x4dd7('0xf')]['createSquareRecording']({'uniqueid':this[_0x4dd7('0xe')]['uniqueid'],'callerid':this['channel'][_0x4dd7('0x3a')],'calleridname':this[_0x4dd7('0xe')][_0x4dd7('0x3b')],'context':this['channel']['context'],'extension':this[_0x4dd7('0xe')][_0x4dd7('0x3c')],'priority':this[_0x4dd7('0xe')][_0x4dd7('0x3d')],'accountcode':this[_0x4dd7('0xe')][_0x4dd7('0x3e')],'dnid':this[_0x4dd7('0xe')][_0x4dd7('0x3f')],'projectName':this[_0x4dd7('0xe')]['arg_1'],'saveName':_0x2d8cd7,'filename':_0x447021[_0x4dd7('0x40')]||_0x2d8cd7,'savePath':_0x48864f})[_0x4dd7('0x12')](function(_0xdebd){_0x119b9d(null,_0xdebd);})[_0x4dd7('0x16')](function(_0x5afe53){_0x119b9d(_0x5afe53);});};AGIVertices['prototype']['createSquareMessage']=function(_0x3a442f,_0x1d9468,_0x7ed80e){this[_0x4dd7('0xf')][_0x4dd7('0x41')]({'uniqueid':this['channel'][_0x4dd7('0x37')],'body':_0x3a442f,'direction':_0x1d9468})[_0x4dd7('0x12')](function(_0x2485b2){if(_0x7ed80e){_0x7ed80e(null,_0x2485b2);}})['catch'](function(_0x5393d3){if(_0x7ed80e){_0x7ed80e(_0x5393d3);}});};AGIVertices[_0x4dd7('0x10')]['createCmContact']=function(_0xab0d6b,_0x500668){this[_0x4dd7('0xf')][_0x4dd7('0x42')]({'firstName':_[_0x4dd7('0x43')](_0xab0d6b[_0x4dd7('0x13')])||_['isNil'](_0xab0d6b['name'])?_0x4dd7('0x44')+Math[_0x4dd7('0x45')]():_0xab0d6b[_0x4dd7('0x13')],'lastName':_[_0x4dd7('0x43')](_0xab0d6b[_0x4dd7('0x46')])||_[_0x4dd7('0x47')](_0xab0d6b['lastName'])?null:_0xab0d6b[_0x4dd7('0x46')],'phone':_0xab0d6b['phone'],'ListId':_0xab0d6b[_0x4dd7('0x48')],'scheduledat':_0xab0d6b[_0x4dd7('0x49')],'callbackUniqueid':this[_0x4dd7('0xe')][_0x4dd7('0x37')],'tags':_0x4dd7('0x4a'),'description':'Callback\x20scheduled\x20at\x20'+_0xab0d6b[_0x4dd7('0x49')]['toString'](),'priority':_0xab0d6b[_0x4dd7('0x4b')]})[_0x4dd7('0x12')](function(_0x2201ba){_0x500668(null,_0x2201ba);})[_0x4dd7('0x16')](function(_0x362f8f){_0x500668(_0x362f8f);});};AGIVertices[_0x4dd7('0x10')]['getPause']=function(_0x35a164,_0x3f3daa){this[_0x4dd7('0xf')]['getPauseById'](_0x35a164)[_0x4dd7('0x12')](function(_0x10be4e){_0x3f3daa(null,_0x10be4e?_0x10be4e['name']:![]);})[_0x4dd7('0x16')](function(_0x7e50c5){_0x3f3daa(_0x7e50c5);});};AGIVertices['prototype'][_0x4dd7('0x4c')]=function(_0x3a2b9b,_0x2c0c98,_0x4f4819){var _0x2fa756={'role':_0x4dd7('0x4d')};_0x2fa756[_0x3a2b9b]=this[_0x4dd7('0xe')][_0x4dd7('0x3a')];this[_0x4dd7('0xf')]['agentPause'](_0x2fa756,_0x2c0c98,this[_0x4dd7('0xe')][_0x4dd7('0x37')])[_0x4dd7('0x12')](function(_0x273fa4){_0x4f4819(null,_[_0x4dd7('0x47')](_0x273fa4)?![]:!![]);})[_0x4dd7('0x16')](function(_0x4b9f8b){logger[_0x4dd7('0x4e')](_0x4b9f8b);_0x4f4819(null,![]);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x4f')]=function(_0x1fb71d,_0x2fc6a1){var _0x5ce67d={'role':_0x4dd7('0x4d')};_0x5ce67d[_0x1fb71d]=this['channel'][_0x4dd7('0x3a')];this['rpc'][_0x4dd7('0x4f')](_0x5ce67d)['then'](function(_0x2eb753){_0x2fc6a1(null,_[_0x4dd7('0x47')](_0x2eb753)?![]:!![]);})['catch'](function(_0x139cec){logger[_0x4dd7('0x4e')](_0x139cec);_0x2fc6a1(null,![]);});};AGIVertices['prototype'][_0x4dd7('0x50')]=function(_0x303d81,_0x190537){var _0x29abc2={'role':_0x4dd7('0x4d')};_0x29abc2[_0x303d81]=this[_0x4dd7('0xe')][_0x4dd7('0x3a')];this[_0x4dd7('0xf')][_0x4dd7('0x50')](_0x29abc2)[_0x4dd7('0x12')](function(_0x5be331){_0x190537(null,_['isNil'](_0x5be331)?![]:!![]);})['catch'](function(_0x41e57c){logger[_0x4dd7('0x4e')](_0x41e57c);_0x190537(null,![]);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x51')]=function(_0x36b206,_0x38f5c4){var _0x2eb2ea={'role':_0x4dd7('0x4d')};_0x2eb2ea[_0x36b206]=this[_0x4dd7('0xe')][_0x4dd7('0x3a')];var _0x2e10c4=_0x36b206!=_0x4dd7('0x52')?util[_0x4dd7('0x53')]('%s/%s@from-sip/n',_0x4dd7('0x54'),this[_0x4dd7('0xe')]['callerid']):undefined;this[_0x4dd7('0xf')]['agentLogin'](_0x2eb2ea,_0x2e10c4)[_0x4dd7('0x12')](function(_0x2b1009){_0x38f5c4(null,_[_0x4dd7('0x47')](_0x2b1009)?![]:!![]);})['catch'](function(_0x326951){logger[_0x4dd7('0x4e')](_0x326951);_0x38f5c4(null,![]);});};AGIVertices['prototype'][_0x4dd7('0x55')]=function(_0x4c6bc4,_0x35c4a0){sh[_0x4dd7('0x56')](_[_0x4dd7('0x57')](_0x4c6bc4),function(_0x33eb86,_0x444826){var _0x46b8e1=_0x444826[_0x4dd7('0x58')](/(\r\n|\n|\r)/gm,'');_0x35c4a0(null,_0x46b8e1);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x59')]=function(_0x5582b7,_0x546ed7){scripts[_0x4dd7('0x59')](_0x5582b7[_0x4dd7('0x5a')],_0x5582b7[_0x4dd7('0x5b')]||_0x4dd7('0x5c'),_0x5582b7[_0x4dd7('0x5c')],_0x5582b7[_0x4dd7('0x5d')]||_0x4dd7('0x5e'),_0x5582b7[_0x4dd7('0x5f')]||_0x4dd7('0x60'),_0x5582b7['audioEncoding']||_0x4dd7('0x61'))[_0x4dd7('0x12')](function(_0x4aebfe){_0x546ed7(null,_0x4aebfe);})[_0x4dd7('0x16')](function(_0x6239b1){_0x546ed7(_0x6239b1);});};AGIVertices[_0x4dd7('0x10')]['googleTTS']=function(_0x193cda,_0x3b2cb3){scripts['googleTTS'](_0x193cda['text'],_0x193cda[_0x4dd7('0x62')]||'en',0x1)['then'](function(_0x1ef13f){_0x3b2cb3(null,_0x1ef13f);})[_0x4dd7('0x16')](function(_0x4ea81b){_0x3b2cb3(_0x4ea81b);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x63')]=function(_0xadf0e4,_0x30288f){var _0x567cfc={'uri':_0xadf0e4[_0x4dd7('0x64')],'method':_0xadf0e4[_0x4dd7('0x65')],'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0xadf0e4['timeout'])===_0x4dd7('0x66')&&parseInt(_0xadf0e4[_0x4dd7('0x67')])>=0x1?parseInt(_0xadf0e4[_0x4dd7('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x4dd7('0x68')]([_0x4dd7('0x69'),_0x4dd7('0x6a')],_0x567cfc[_0x4dd7('0x65')][_0x4dd7('0x6b')]())){try{_0x567cfc[_0x4dd7('0x6c')]=_0xadf0e4[_0x4dd7('0xb')]?JSON['parse'](_0xadf0e4[_0x4dd7('0xb')]):{};}catch(_0x1c29c3){logger['error']('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x1c29c3);}}try{_0x567cfc[_0x4dd7('0x6d')]=_0xadf0e4['rawHeaders']?JSON['parse'](_0xadf0e4['rawHeaders']):{};}catch(_0x19f77b){logger[_0x4dd7('0x4e')](_0x4dd7('0x6e'),_0x19f77b);}if(_0xadf0e4[_0x4dd7('0x6f')]){try{var _0xd15fa7=require(_0xadf0e4[_0x4dd7('0x6f')])[_0x4dd7('0x70')](this,_0x567cfc);_0x567cfc[_0x4dd7('0x71')]=Mustache[_0x4dd7('0x72')](_0xadf0e4[_0x4dd7('0x64')],_0xd15fa7,{},['$$','$$']);if(_0x567cfc[_0x4dd7('0x6d')]){_0x567cfc[_0x4dd7('0x6d')]=JSON[_0x4dd7('0x73')](Mustache[_0x4dd7('0x72')](JSON[_0x4dd7('0x74')](_0x567cfc[_0x4dd7('0x6d')]),_0xd15fa7,{},['$$','$$']));}if(_0x567cfc[_0x4dd7('0x6c')]){_0x567cfc['body']=JSON[_0x4dd7('0x73')](Mustache['render'](JSON[_0x4dd7('0x74')](_0x567cfc[_0x4dd7('0x6c')]),_0xd15fa7,{},['$$','$$']));}}catch(_0x592c6b){logger[_0x4dd7('0x4e')](_0x4dd7('0x75'),_0x592c6b);}}rp(_0x567cfc)['then'](function(_0x2d024e){var _0x30921d={'statusCode':_0x2d024e[_0x4dd7('0x76')]||0xc8,'statusMessage':_0x2d024e[_0x4dd7('0x77')]||'OK','headers':_0x2d024e[_0x4dd7('0x6d')]||{},'body':_0x2d024e[_0x4dd7('0x6c')]||{}};_0x30288f(null,_0x30921d);})['catch'](function(_0x43cc5e){var _0x5b55ed={'statusCode':_0x43cc5e[_0x4dd7('0x76')]||0x1f4,'statusMessage':_0x43cc5e['message']||_0x4dd7('0x78'),'headers':_0x43cc5e['options'][_0x4dd7('0x6d')]||{},'body':_0x43cc5e[_0x4dd7('0x79')][_0x4dd7('0x6c')]||{}};_0x30288f(null,_0x5b55ed);});};AGIVertices[_0x4dd7('0x10')]['googleDialogflow']=function(_0x122a5e,_0x22d4b3){scripts[_0x4dd7('0x7a')](this[_0x4dd7('0xe')]['uniqueid'],_0x122a5e[_0x4dd7('0x7b')],_0x122a5e[_0x4dd7('0x5c')],_0x122a5e['dialogflow_language']||'en')[_0x4dd7('0x12')](function(_0x593a8f){_0x22d4b3(null,_0x593a8f);})[_0x4dd7('0x16')](function(_0x278c60){_0x22d4b3(_0x278c60);});};AGIVertices[_0x4dd7('0x10')]['sestekNDA']=function(_0x268e7d,_0x3d75a1){scripts[_0x4dd7('0x7c')](this['channel'],_0x268e7d)[_0x4dd7('0x12')](function(_0x44ed2a){_0x3d75a1(null,_0x44ed2a);})['catch'](function(_0x45ce65){_0x3d75a1(_0x45ce65);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x7d')]=function(_0x427c07,_0x119e2c){scripts[_0x4dd7('0x7d')](_0x427c07[_0x4dd7('0x7b')],_0x427c07[_0x4dd7('0x5c')],_0x427c07[_0x4dd7('0x7e')]||_0x4dd7('0x5e'),_0x427c07[_0x4dd7('0x7f')])[_0x4dd7('0x12')](function(_0x41039d){_0x119e2c(null,_0x41039d);})['catch'](function(_0x2837d9){_0x119e2c(_0x2837d9);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x80')]=function(_0x1c5bfc,_0x1a5a84,_0x1b648d){scripts[_0x4dd7('0x80')](_0x1a5a84,_0x1c5bfc[_0x4dd7('0x7b')],_0x1c5bfc[_0x4dd7('0x81')]||_0x4dd7('0x5e'),this['isConfigured'](_0x1c5bfc[_0x4dd7('0x82')])?_0x1c5bfc['model']:undefined)[_0x4dd7('0x12')](function(_0x5348e7){_0x1b648d(null,_0x5348e7);})[_0x4dd7('0x16')](function(_0x4c696f){_0x1b648d(_0x4c696f);});};AGIVertices['prototype'][_0x4dd7('0x83')]=function(_0xe2da03,_0x434c3d){scripts[_0x4dd7('0x83')](_0xe2da03['aws_access_key_id'],_0xe2da03[_0x4dd7('0x84')],_0xe2da03[_0x4dd7('0x85')],_0xe2da03['aws_polly_voice']||'Amy',_0xe2da03[_0x4dd7('0x5c')],_0xe2da03[_0x4dd7('0x86')]||_0x4dd7('0x5c'))[_0x4dd7('0x12')](function(_0x3ddab3){_0x434c3d(null,_0x3ddab3);})[_0x4dd7('0x16')](function(_0x2cbf96){_0x434c3d(_0x2cbf96);});};AGIVertices[_0x4dd7('0x10')]['awsLex']=function(_0x3c11ab,_0x28b03e){scripts[_0x4dd7('0x87')](this[_0x4dd7('0xe')]['uniqueid'],_0x3c11ab[_0x4dd7('0x88')],_0x3c11ab['aws_secret_access_key'],_0x3c11ab[_0x4dd7('0x89')],_0x3c11ab['text'],_0x3c11ab[_0x4dd7('0x8a')])[_0x4dd7('0x12')](function(_0x42b151){_0x28b03e(null,_0x42b151);})['catch'](function(_0x3f086b){_0x28b03e(_0x3f086b);});};AGIVertices['prototype'][_0x4dd7('0x8b')]=function(_0x209c91,_0x1e2ad6,_0x1bfcc2){scripts[_0x4dd7('0x8b')](_0x1e2ad6,_0x209c91[_0x4dd7('0x7b')],_0x209c91['google_asr_language']||'en-US')[_0x4dd7('0x12')](function(_0x1dbeb5){_0x1bfcc2(null,_0x1dbeb5);})[_0x4dd7('0x16')](function(_0x1341e4){_0x1bfcc2(_0x1341e4);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x8c')]=function(_0x477c72,_0x269919,_0x142a06){scripts['tildeASR'](_0x269919,_0x477c72['appid'],_0x477c72[_0x4dd7('0x8d')],_0x477c72['uri'])[_0x4dd7('0x12')](function(_0x5db4d6){_0x142a06(null,_0x5db4d6);})['catch'](function(_0x3e61b5){_0x142a06(_0x3e61b5);});};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x8e')]=function(_0x429398){var _0x3e64b3=_[_0x4dd7('0x68')](verticesWithRetry,_0x429398['agicommand'])?_0x429398:_[_0x4dd7('0x8f')](_0x429398);for(var _0x259838 in _0x3e64b3){if(_0x3e64b3[_0x4dd7('0x90')](_0x259838)){if(_0x3e64b3[_0x259838]&&_[_0x4dd7('0x91')](_0x3e64b3[_0x259838])){if(_['includes'](recursiveMapAttributes,_0x259838)){_0x3e64b3[_0x259838]=this['replaceObjectAllVariables'](_0x3e64b3[_0x259838]);}else{_0x3e64b3[_0x259838]=this['replaceAllVariables'](_0x3e64b3[_0x259838]);}}}}return _0x3e64b3;};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x92')]=function(_0x19b404){for(var _0x4c42ba in _0x19b404){if(_0x19b404['hasOwnProperty'](_0x4c42ba)){if(_['isPlainObject'](_0x19b404[_0x4c42ba])){this[_0x4dd7('0x92')](_0x19b404[_0x4c42ba]);}else if(_[_0x4dd7('0x93')](_0x19b404[_0x4c42ba])){for(var _0x554f86=0x0;_0x554f86<_0x19b404[_0x4c42ba][_0x4dd7('0x94')];_0x554f86++){this[_0x4dd7('0x92')](_0x19b404[_0x4c42ba][_0x554f86]);}}else if(_[_0x4dd7('0x91')](_0x19b404[_0x4c42ba])){_0x19b404[_0x4c42ba]=this['replaceAllVariables'](_0x19b404[_0x4c42ba]);}}}};AGIVertices['prototype'][_0x4dd7('0x95')]=function(_0x5741cb,_0x31f746){for(var _0x54eee4 in _0x5741cb){if(_0x5741cb['hasOwnProperty'](_0x54eee4)){if(_[_0x4dd7('0x96')](_0x5741cb[_0x54eee4])){if(!_['isEmpty'](_0x5741cb[_0x54eee4])){this['saveRestApiResult'](_0x5741cb[_0x54eee4],util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x31f746,_0x54eee4));}}else if(_[_0x4dd7('0x93')](_0x5741cb[_0x54eee4])){for(var _0x51b579=0x0;_0x51b579<_0x5741cb[_0x54eee4][_0x4dd7('0x94')];_0x51b579++){this['saveRestApiResult'](_0x5741cb[_0x54eee4][_0x51b579],util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x31f746,_0x54eee4+'['+_0x51b579+']'));}}else{if(!_[_0x4dd7('0x47')](_0x5741cb[_0x54eee4])){this['channel'][_0x4dd7('0x98')](util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x31f746,_0x54eee4),_0x5741cb[_0x54eee4]);}}}}};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x99')]=function(_0x5a6fc2){try{var _0x514420=JSON[_0x4dd7('0x73')](_0x5a6fc2);this['recursiveNodeIndex'](_0x514420);return JSON[_0x4dd7('0x74')](_0x514420);}catch(_0x1e3db6){return this['replaceAllVariables'](_0x5a6fc2);}};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x9a')]=function(_0x34704c){var _0xa50c6e=_0x34704c[_0x4dd7('0x9b')]('{');for(var _0x3f866d=0x1;_0x3f866d<_0xa50c6e[_0x4dd7('0x94')];_0x3f866d+=0x1){var _0x59ac10=_0xa50c6e[_0x3f866d][_0x4dd7('0x9b')]('}');if(_0x59ac10[_0x4dd7('0x94')]>0x1){_0x34704c=_0x34704c[_0x4dd7('0x9c')]('{'+_0x59ac10[0x0]+'}',this['channel'][_0x4dd7('0x11')](_0x59ac10[0x0])[_0x4dd7('0x9d')]||_0x59ac10[0x0]);}}if(_0xa50c6e[_0x4dd7('0x94')]===0x1){return _0x34704c['toString']();}return this[_0x4dd7('0x9a')](_0x34704c);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x9e')]=function(_0x220cdb,_0x105184){var _0x52383e=this[_0x4dd7('0xe')][_0x4dd7('0x11')](_0x220cdb);if(_0x52383e['result']===-0x1){return _0x52383e;}logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x9f'),_0x105184,_0x52383e[_0x4dd7('0x9d')]));return this['channel'][_0x4dd7('0x98')](_0x105184,_0x52383e[_0x4dd7('0x9d')]);};AGIVertices[_0x4dd7('0x10')]['isConfigured']=function(_0x36f11e){return _0x36f11e&&_0x36f11e!=='0'&&_0x36f11e!=='-1'&&_0x36f11e!=='';};AGIVertices['prototype'][_0x4dd7('0xa0')]=function(_0x388a69){this[_0x4dd7('0x36')]['sync'](this,_0x388a69,'-');_0x388a69['retry']=_0x388a69[_0x4dd7('0xa0')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x7')]=function(_0x5de5a4){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0xa1'),_0x5de5a4[_0x4dd7('0xa2')]));return this['channel'][_0x4dd7('0x7')]([_0x5de5a4[_0x4dd7('0xa3')],_0x5de5a4[_0x4dd7('0xa4')]]);};AGIVertices['prototype']['answer']=function(_0x995e87){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0xa5'),_0x995e87['label']));if(this[_0x4dd7('0xa6')](_0x995e87[_0x4dd7('0x67')])){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0xa7'),_0x995e87['timeout']));var _0x52ebbe=this[_0x4dd7('0xe')][_0x4dd7('0xa8')](_0x995e87['timeout']);if(_0x52ebbe[_0x4dd7('0xa9')]===-0x1){return _0x52ebbe;}}return this[_0x4dd7('0xe')][_0x4dd7('0xaa')]();};AGIVertices['prototype'][_0x4dd7('0x4a')]=function(_0x4e64f2){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0xab'),_0x4e64f2['label']));if(!this[_0x4dd7('0xa6')](_0x4e64f2[_0x4dd7('0x48')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x4e64f2,_0x4dd7('0xac'));}_0x4e64f2[_0x4dd7('0x49')]=moment();if(this[_0x4dd7('0xa6')](_0x4e64f2[_0x4dd7('0xad')])){_0x4e64f2[_0x4dd7('0x49')]=moment()[_0x4dd7('0xae')](_0x4e64f2[_0x4dd7('0xad')],_0x4dd7('0xaf'));}if(!this[_0x4dd7('0xa6')](_0x4e64f2[_0x4dd7('0x4b')])){_0x4e64f2['callback_priority']=0x2;}this[_0x4dd7('0x42')]['sync'](this,_0x4e64f2);return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0xb0'),_0x4e64f2[_0x4dd7('0xb1')],_0x4e64f2[_0x4dd7('0x48')],_0x4e64f2[_0x4dd7('0x49')]));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xb2')]=function(_0x4831c5){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x4831c5[_0x4dd7('0xa2')]));var _0x2b57b4=this[_0x4dd7('0xe')][_0x4dd7('0x56')](_0x4831c5[_0x4dd7('0xb3')],_0x4831c5['options']);if(_0x2b57b4[_0x4dd7('0xa9')]===-0x1){return _0x2b57b4;}return this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('Executed\x20command\x20%s\x20%s',_0x4831c5[_0x4dd7('0xb3')],_0x4831c5['options']));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xb5')]=function(_0x6098df){logger['info'](util['format'](_0x4dd7('0xb6'),_0x6098df[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x6098df[_0x4dd7('0x5c')])){return this['channel'][_0x4dd7('0xb4')]('no\x20text\x20configured');}var _0x4f6327='\x22'+_0x6098df[_0x4dd7('0x5c')]+'\x22';if(this['isConfigured'](_0x6098df[_0x4dd7('0x79')])){_0x4f6327+=','+_0x6098df[_0x4dd7('0x79')];}var _0x129d13=this[_0x4dd7('0xe')][_0x4dd7('0x56')](_0x4dd7('0xb7'),_0x4f6327);if(_0x129d13[_0x4dd7('0xa9')]===-0x1){return _0x129d13;}return this['channel']['noop'](util[_0x4dd7('0x53')](_0x4dd7('0xb8'),_0x4f6327));};AGIVertices['prototype']['sestektts']=function(_0x1fc880){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x1fc880[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x1fc880[_0x4dd7('0x5c')])){return this['channel']['noop']('no\x20text\x20configured');}var _0x3efa8a='\x22'+_0x1fc880['text']+'\x22';if(this['isConfigured'](_0x1fc880['options'])){_0x3efa8a+=','+_0x1fc880[_0x4dd7('0x79')];}var _0x5d87f4=this['channel'][_0x4dd7('0x56')](_0x4dd7('0xb7'),_0x3efa8a);if(_0x5d87f4[_0x4dd7('0xa9')]===-0x1){return _0x5d87f4;}return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0xb8'),_0x3efa8a));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xb9')]=function(_0x3bba51){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0xba'),_0x3bba51[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x3bba51[_0x4dd7('0xbb')])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0xbc'));}var _0x14f051=_0x3bba51[_0x4dd7('0xbb')];if(this[_0x4dd7('0xa6')](_0x3bba51['options'])){_0x14f051+=','+_0x3bba51['options'];}var _0x1faf29=this[_0x4dd7('0xe')]['exec']('MRCPRecog',_0x14f051);if(_0x1faf29[_0x4dd7('0xa9')]===-0x1){return _0x1faf29;}var _0x552f63=this['getAndSetVariable'](_0x4dd7('0xbd'),_0x4dd7('0xbe'));if(_0x552f63[_0x4dd7('0xa9')]===-0x1){return _0x552f63;}var _0x4abf16=this['getAndSetVariable'](_0x4dd7('0xbf'),_0x4dd7('0xc0'));if(_0x4abf16['result']===-0x1){return _0x4abf16;}var _0x4e53b4=this[_0x4dd7('0x9e')]('RECOG_INSTANCE()',_0x4dd7('0xc1'));if(_0x4e53b4['result']===-0x1){return _0x4e53b4;}return this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xc2'),_0x14f051));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xc3')]=function(_0x3e6424){logger['info'](util['format'](_0x4dd7('0xc4'),_0x3e6424[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x3e6424[_0x4dd7('0xbb')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xbc'));}var _0x206459=_0x3e6424[_0x4dd7('0xbb')];if(this[_0x4dd7('0xa6')](_0x3e6424[_0x4dd7('0x79')])){_0x206459+=','+_0x3e6424[_0x4dd7('0x79')];}var _0x346858=this['channel'][_0x4dd7('0x56')](_0x4dd7('0xc5'),_0x206459);if(_0x346858[_0x4dd7('0xa9')]===-0x1){return _0x346858;}var _0x1c9060=this[_0x4dd7('0x9e')](_0x4dd7('0xbd'),_0x4dd7('0xc6'));if(_0x1c9060[_0x4dd7('0xa9')]===-0x1){return _0x1c9060;}var _0x309449=this[_0x4dd7('0x9e')](_0x4dd7('0xbf'),'SESTEK_ASR_TRANSCRIPT');if(_0x309449['result']===-0x1){return _0x309449;}var _0x52a947=this[_0x4dd7('0x9e')](_0x4dd7('0xc7'),_0x4dd7('0xc8'));if(_0x52a947[_0x4dd7('0xa9')]===-0x1){return _0x52a947;}return this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xc2'),_0x206459));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xc9')]=function(_0x1cb2a4){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0xca'),_0x1cb2a4[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x1cb2a4['odbc_id'])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1cb2a4,'no\x20database\x20selected');}var _0x507634=this[_0x4dd7('0x18')][_0x4dd7('0x70')](this,_0x1cb2a4['odbc_id']);if(!_0x507634){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1cb2a4,_0x4dd7('0xcb'));}if(!this['isConfigured'](_0x1cb2a4[_0x4dd7('0x2d')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1cb2a4,'no\x20query\x20configured');}var _0x24766b=_0x1cb2a4[_0x4dd7('0x2d')]['replace'](/(\r\n|\n|\r)/gm,'\x20');this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format'](_0x4dd7('0xcc'),_0x24766b));var _0x13ef4a=this[_0x4dd7('0x29')][_0x4dd7('0x70')](this,_0x507634,_0x24766b);this['createSquareDetailsReport'][_0x4dd7('0x70')](this,_0x1cb2a4,_0x24766b);if(!this[_0x4dd7('0xa6')](_0x1cb2a4['variable_id'])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0xcd'));}var _0x5d22ad=this[_0x4dd7('0x11')]['sync'](this,_0x1cb2a4['variable_id']);if(!_0x5d22ad){return this[_0x4dd7('0xe')]['error'](_0x1cb2a4,_0x4dd7('0xce'));}var _0x19b37d=this;_0x13ef4a[_0x4dd7('0xcf')](function(_0x40ef05,_0x2dd872){Object[_0x4dd7('0xd0')](_0x40ef05)['forEach'](function(_0x14a18e){_0x19b37d[_0x4dd7('0xe')]['setVariable'](util['format'](_0x4dd7('0xd1'),_0x5d22ad,_0x2dd872,_0x14a18e),_0x40ef05[_0x14a18e]);});});this[_0x4dd7('0xe')][_0x4dd7('0x98')](util['format'](_0x4dd7('0xd2'),_0x5d22ad),_0x13ef4a[_0x4dd7('0x94')]);return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')]('variable\x20%s\x20set',_0x5d22ad));};AGIVertices['prototype'][_0x4dd7('0xd3')]=function(_0x4cdb3c){logger[_0x4dd7('0xd4')](util[_0x4dd7('0x53')](_0x4dd7('0xd5'),_0x4cdb3c['label']));if(!this['isConfigured'](_0x4cdb3c[_0x4dd7('0xd6')])){return this['channel'][_0x4dd7('0x4e')](_0x4cdb3c,_0x4dd7('0xd7'));}var _0x3b0d43=this['getUser'][_0x4dd7('0x70')](this,_0x4cdb3c[_0x4dd7('0xd6')]);if(!_0x3b0d43){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x4cdb3c,_0x4dd7('0xd8'));}var _0x4bbee3=this[_0x4dd7('0xe')][_0x4dd7('0x56')](_0x4dd7('0xd9'),[util[_0x4dd7('0x53')](_0x4dd7('0xda'),_0x3b0d43),_0x4cdb3c[_0x4dd7('0x67')],_0x4cdb3c[_0x4dd7('0xdb')],_0x4cdb3c[_0x4dd7('0x64')]]);if(_0x4bbee3['result']===-0x1){return _0x4bbee3;}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xdc'),_0x4dd7('0xd9')));};AGIVertices[_0x4dd7('0x10')]['dialogflow']=function(_0x3014b1){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0xdd'),_0x3014b1[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x3014b1[_0x4dd7('0x7b')])){return this['channel'][_0x4dd7('0xb4')](_0x4dd7('0xde'));}if(!this[_0x4dd7('0xa6')](_0x3014b1[_0x4dd7('0x5c')])){return this['channel'][_0x4dd7('0xb4')]('no\x20text\x20configured');}this[_0x4dd7('0xe')]['bot']=!![];this['createSquareDetailsReport'](_0x3014b1);this[_0x4dd7('0x41')](_0x3014b1[_0x4dd7('0x5c')],'in');this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xdf'),_0x3014b1[_0x4dd7('0x5c')]));var _0x4eba52=this[_0x4dd7('0x7a')][_0x4dd7('0x70')](this,_0x3014b1);if(_0x4eba52){for(var _0x400518 in _0x4eba52){if(_0x4eba52[_0x4dd7('0x90')](_0x400518)){this[_0x4dd7('0xe')][_0x4dd7('0x98')](util[_0x4dd7('0x53')]('DIALOGFLOW_%s',_0x400518[_0x4dd7('0x6b')]()),_0x4eba52[_0x400518]);}}this[_0x4dd7('0x41')](_0x4eba52[_0x4dd7('0xe0')],_0x4dd7('0xe1'));return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xe2'),_0x4eba52[_0x4dd7('0xe0')]));}return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x3014b1,_0x4dd7('0xe3'));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xe4')]=function(_0x4705fc){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0xe5'),_0x4705fc[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x4705fc[_0x4dd7('0xe6')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xe7'));}if(!this['isConfigured'](_0x4705fc['username'])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xe8'));}if(!this['isConfigured'](_0x4705fc['password'])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xe9'));}if(!this[_0x4dd7('0xa6')](_0x4705fc[_0x4dd7('0xea')])){return this[_0x4dd7('0xe')]['noop']('no\x20text\x20configured');}this[_0x4dd7('0xe')][_0x4dd7('0xeb')]=!![];this[_0x4dd7('0x36')](_0x4705fc);this[_0x4dd7('0x41')](_0x4705fc['text'],'in');this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0xec'),_0x4705fc[_0x4dd7('0x5c')]));var _0x2f9b29=this[_0x4dd7('0x7c')]['sync'](this,_0x4705fc);if(_0x2f9b29){for(var _0x1ea317 in _0x2f9b29){if(_0x2f9b29[_0x4dd7('0x90')](_0x1ea317)){this[_0x4dd7('0xe')][_0x4dd7('0x98')](util[_0x4dd7('0x53')](_0x4dd7('0xed'),_0x1ea317[_0x4dd7('0x6b')]()),_0x2f9b29[_0x1ea317]);}}this['createSquareMessage'](_0x2f9b29[_0x4dd7('0xe0')],_0x4dd7('0xe1'));if(_0x2f9b29[_0x4dd7('0xee')]){this['channel']['noop'](util[_0x4dd7('0x53')](_0x4dd7('0xef'),_0x2f9b29[_0x4dd7('0xee')]));var _0xf28763=this[_0x4dd7('0xe')][_0x4dd7('0xf0')](_0x2f9b29[_0x4dd7('0xee')]);try{fs[_0x4dd7('0xf1')](_0x2f9b29[_0x4dd7('0xee')]+_0x4dd7('0xf2'));}catch(_0x2e7876){logger['error'](_0x2e7876);}return _0xf28763;}else{return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('SestekNDA\x20Result\x20%s',_0x2f9b29[_0x4dd7('0xe0')]));}}return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x4705fc,_0x4dd7('0xf3'));};AGIVertices['prototype'][_0x4dd7('0xf4')]=function(_0x196296){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0xf5'),_0x196296[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xf4'));};AGIVertices[_0x4dd7('0x10')]['ext_dial']=function(_0x25cc06){logger[_0x4dd7('0x2e')](util['format']('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x25cc06[_0x4dd7('0xa2')]));var _0x2ed990='';if(_0x25cc06[_0x4dd7('0xf6')]){if(!this[_0x4dd7('0xa6')](_0x25cc06['trunk_id'])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x25cc06,_0x4dd7('0xf7'));}else{var _0x3418fc=parseInt(_0x25cc06[_0x4dd7('0xf6')],0xa);if(isNaN(_0x3418fc)){_0x2ed990=_0x25cc06[_0x4dd7('0xf6')];}else{_0x2ed990=this[_0x4dd7('0x1d')][_0x4dd7('0x70')](this,_0x25cc06[_0x4dd7('0xf6')]);if(!_0x2ed990){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x25cc06,_0x4dd7('0xf8'));}}}}else if(_0x25cc06[_0x4dd7('0xf9')]){_0x2ed990=_0x25cc06[_0x4dd7('0xf9')];}else{return this['channel'][_0x4dd7('0x4e')](_0x25cc06,_0x4dd7('0xf7'));}var _0x2e0095=this['channel'][_0x4dd7('0x56')](_0x4dd7('0xd9'),[util[_0x4dd7('0x53')](_0x4dd7('0xfa'),_0x2ed990,_0x25cc06[_0x4dd7('0xb1')]),_0x25cc06[_0x4dd7('0x67')],_0x25cc06['opts'],_0x25cc06[_0x4dd7('0x64')]]);if(_0x2e0095[_0x4dd7('0xa9')]===-0x1){return _0x2e0095;}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0xdc'),'DIAL'));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xfb')]=function(_0x4fa251){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0xfc'),_0x4fa251[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0xfb'));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xc')]=function(_0x220e55){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20GETDIGITS\x20(%s)\x20block',_0x220e55['label']));if(_0x220e55[_0x4dd7('0xfd')]===0x0){return this[_0x4dd7('0xa0')](_0x220e55);}_0x220e55[_0x4dd7('0xfd')]-=0x1;if(!this[_0x4dd7('0xa6')](_0x220e55['file_id'])){return this[_0x4dd7('0xe')]['error'](_0x220e55,'no\x20file\x20audio\x20selected');}var _0x45b2c6=this[_0x4dd7('0xfe')]['sync'](this,_0x220e55[_0x4dd7('0xff')]);if(!_0x45b2c6){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x220e55,'no\x20file\x20audio\x20found');}if(!this[_0x4dd7('0xa6')](_0x220e55[_0x4dd7('0x100')])){return this[_0x4dd7('0xe')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x5ec32a=this[_0x4dd7('0xe')]['getData'](_0x45b2c6,_0x220e55['response'],_0x220e55['maxdigit']);var _0x311fc4=_0x5ec32a['result']?_0x5ec32a[_0x4dd7('0xa9')][_0x4dd7('0x101')]():'';logger[_0x4dd7('0x2e')](_0x4dd7('0x102'),JSON[_0x4dd7('0x74')](_0x5ec32a));if(_0x5ec32a['result']===-0x1){this['createSquareDetailsReport'][_0x4dd7('0x70')](this,_0x220e55,_0x311fc4);return _0x5ec32a;}else if(_0x5ec32a[_0x4dd7('0x9d')]==='timeout'){_0x5ec32a[_0x4dd7('0xa9')]=_0x311fc4[_0x4dd7('0x94')]>=parseInt(_0x220e55[_0x4dd7('0x103')])?'x':'i';}else{_0x5ec32a[_0x4dd7('0xa9')]=_0x311fc4[_0x4dd7('0x94')]>=parseInt(_0x220e55[_0x4dd7('0x103')])&&_0x311fc4['length']<=parseInt(_0x220e55[_0x4dd7('0x104')])?'x':'i';}var _0x58ecca=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x220e55[_0x4dd7('0x100')]);if(!_0x58ecca){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x220e55,'no\x20variable\x20found');}this[_0x4dd7('0xe')]['setVariable'](_0x58ecca,_0x311fc4);if(this['isConfigured'](_0x220e55[_0x4dd7('0x105')])){var _0x3ceade=parseInt(_0x220e55[_0x4dd7('0x105')],0xa);var _0x3b35d1=rs[_0x4dd7('0x106')]({'charset':'*','length':_0x3ceade});var _0xd6d586=_0x311fc4['length'];if(_0xd6d586>0x0){if(_0xd6d586>_0x3ceade){this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x220e55,_0x220e55[_0x4dd7('0x107')]===_0x4dd7('0x108')?_0x3b35d1+_0x311fc4[_0x4dd7('0x109')](_0x3ceade):_0x311fc4[_0x4dd7('0x109')](0x0,_0xd6d586-_0x3ceade)+_0x3b35d1);}else{this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x220e55,rs['generate']({'charset':'*','length':_0xd6d586}));}}else{this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x220e55,'');}}else{this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x220e55,_0x311fc4);}return _0x5ec32a;};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xd')]=function(_0x1478b1){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x10a'),_0x1478b1[_0x4dd7('0xa2')]));return this['getdigits'](_0x1478b1);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x10b')]=function(_0xc4c2ea){logger['info'](util['format'](_0x4dd7('0x10c'),_0xc4c2ea[_0x4dd7('0xa2')]));this['createSquareDetailsReport'][_0x4dd7('0x70')](this,_0xc4c2ea,_0xc4c2ea[_0x4dd7('0x10d')]);return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('GOAL\x20%s',_0xc4c2ea['goalname']));};AGIVertices[_0x4dd7('0x10')]['awspolly']=function(_0x5bf57a){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x5bf57a[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x5bf57a[_0x4dd7('0x88')])||!this[_0x4dd7('0xa6')](_0x5bf57a[_0x4dd7('0x84')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x10e'));}if(!this[_0x4dd7('0xa6')](_0x5bf57a[_0x4dd7('0x5c')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x10f'));}this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x5bf57a[_0x4dd7('0x5c')]));var _0x184ccf=this[_0x4dd7('0x83')][_0x4dd7('0x70')](this,_0x5bf57a);if(_0x184ccf){this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x110'),_0x184ccf));var _0x5d0d8d=this[_0x4dd7('0xe')][_0x4dd7('0xf0')](_0x184ccf);try{fs[_0x4dd7('0xf1')](_0x184ccf+_0x4dd7('0xf2'));}catch(_0x37a416){logger[_0x4dd7('0x4e')](_0x37a416);}return _0x5d0d8d;}return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x5bf57a,_0x4dd7('0x111'));};AGIVertices[_0x4dd7('0x10')]['awslex']=function(_0x317033){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block',_0x317033['label']));if(!this[_0x4dd7('0xa6')](_0x317033[_0x4dd7('0x88')])||!this[_0x4dd7('0xa6')](_0x317033['aws_secret_access_key'])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x10e'));}if(!this['isConfigured'](_0x317033[_0x4dd7('0x8a')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x112'));}if(!this[_0x4dd7('0xa6')](_0x317033[_0x4dd7('0x5c')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x10f'));}this[_0x4dd7('0xe')][_0x4dd7('0xeb')]=!![];this['createSquareDetailsReport'](_0x317033);this[_0x4dd7('0x41')](_0x317033[_0x4dd7('0x5c')],'in');this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x113'),_0x317033['text']));var _0x12f99d=this['awsLex'][_0x4dd7('0x70')](this,_0x317033);if(_0x12f99d){for(var _0x44d6ee in _0x12f99d){if(_0x12f99d[_0x4dd7('0x90')](_0x44d6ee)&&_[_0x4dd7('0x91')](_0x12f99d[_0x44d6ee])){this[_0x4dd7('0xe')][_0x4dd7('0x98')](util[_0x4dd7('0x53')]('AWS_LEX_%s',_0x44d6ee[_0x4dd7('0x6b')]()),_0x12f99d[_0x44d6ee]);}}if(_['isNil'](_0x12f99d['message'])){return this['channel']['noop'](_0x4dd7('0x114'));}else{this[_0x4dd7('0x41')](_0x12f99d['message'],_0x4dd7('0xe1'));return this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x115'),_0x12f99d[_0x4dd7('0x116')]));}}return this[_0x4dd7('0xe')]['error'](_0x317033,'Amazon\x20Lex\x20is\x20unreachable');};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x117')]=function(_0x599944){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x118'),_0x599944['label'],_0x599944[_0x4dd7('0x67')]));if(!this[_0x4dd7('0xa6')](_0x599944[_0x4dd7('0x7b')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')]('no\x20key\x20configured');}var _0x3a4e05='wav';var _0x4df88f=util['format'](_0x4dd7('0x119'),FILES_PATH,rs[_0x4dd7('0x106')](0x4));var _0x523fbd=util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x4df88f,_0x3a4e05);var _0x4a6c26=!![];if(_0x599944[_0x4dd7('0x11a')]===_0x4dd7('0x11b')){_0x4a6c26=![];}var _0x130b54=this['channel']['recordFile'](_0x4df88f,_0x3a4e05,_0x599944[_0x4dd7('0x11c')],_0x599944[_0x4dd7('0x67')],undefined,_0x4a6c26);if(_0x130b54[_0x4dd7('0xa9')]!==-0x1){this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('google\x20%s\x20file\x20created',_0x523fbd));var _0x3e20c4=this[_0x4dd7('0x8b')][_0x4dd7('0x70')](this,_0x599944,_0x523fbd);if(_0x3e20c4){for(var _0x408858 in _0x3e20c4){if(_0x3e20c4[_0x4dd7('0x90')](_0x408858)){this[_0x4dd7('0xe')][_0x4dd7('0x98')](util[_0x4dd7('0x53')](_0x4dd7('0x11d'),_0x408858[_0x4dd7('0x6b')]()),_0x3e20c4[_0x408858]);}}return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x11e'),JSON['stringify'](_0x3e20c4)));}}return _0x130b54;};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x11f')]=function(_0x56d87a){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20TILDEASR\x20(%s)\x20block',_0x56d87a[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x56d87a['appid'])){return this['channel'][_0x4dd7('0xb4')](_0x4dd7('0x120'));}if(!this[_0x4dd7('0xa6')](_0x56d87a[_0x4dd7('0x8d')])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x121'));}var _0x4bde84='wav';var _0x556a38=util['format'](_0x4dd7('0x119'),FILES_PATH,rs[_0x4dd7('0x106')](0x4));var _0xcb3523=util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x556a38,_0x4bde84);var _0x2fc06e=!![];if(_0x56d87a[_0x4dd7('0x11a')]===_0x4dd7('0x11b')){_0x2fc06e=![];}var _0xa7f3c4=this[_0x4dd7('0xe')][_0x4dd7('0x122')](_0x556a38,_0x4bde84,_0x56d87a[_0x4dd7('0x11c')],_0x56d87a[_0x4dd7('0x67')],undefined,_0x2fc06e);if(_0xa7f3c4['result']!==-0x1){this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('tilde\x20%s\x20file\x20created',_0xcb3523));var _0x1d2d17=this[_0x4dd7('0x8c')]['sync'](this,_0x56d87a,_0xcb3523);if(_0x1d2d17){for(var _0x3f44d1 in _0x1d2d17){if(_0x1d2d17[_0x4dd7('0x90')](_0x3f44d1)){this['channel'][_0x4dd7('0x98')](util[_0x4dd7('0x53')]('TILDE_ASR_%s',_0x3f44d1['toUpperCase']()),_0x1d2d17[_0x3f44d1]);}}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('TildeASR\x20Result\x20%s',JSON[_0x4dd7('0x74')](_0x1d2d17)));}}return _0xa7f3c4;};AGIVertices['prototype'][_0x4dd7('0x123')]=function(_0x344ba5){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x124'),_0x344ba5['label']));return this[_0x4dd7('0xe')][_0x4dd7('0x125')](_0x344ba5[_0x4dd7('0x126')],_0x344ba5[_0x4dd7('0x3c')],_0x344ba5[_0x4dd7('0x3d')]);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x127')]=function(_0x211c33){logger['info'](util['format'](_0x4dd7('0x128'),_0x211c33[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x211c33[_0x4dd7('0x129')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x211c33,'no\x20condition\x20configured');}try{var _0x796a5a=eval(_0x211c33[_0x4dd7('0x129')])?_0x4dd7('0x12a'):'false';this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x12b'),_0x211c33[_0x4dd7('0x129')],_0x796a5a));return{'code':0xc8,'result':_0x796a5a};}catch(_0x5f139e){return{'code':0xc8,'result':_0x4dd7('0x12c')};}};AGIVertices['prototype'][_0x4dd7('0x12d')]=function(_0x1d65df){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x12e'),_0x1d65df[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x1d65df[_0x4dd7('0x12f')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1d65df,_0x4dd7('0x130'));}var _0x9fc5f8=this[_0x4dd7('0x24')][_0x4dd7('0x70')](this,_0x1d65df[_0x4dd7('0x12f')]);if(!_0x9fc5f8){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1d65df,'no\x20intervals\x20found');}for(var _0x2dbd0e=0x0;_0x2dbd0e<_0x9fc5f8['length'];_0x2dbd0e+=0x1){var _0x51f399=this[_0x4dd7('0xe')][_0x4dd7('0x11')](util[_0x4dd7('0x53')](_0x4dd7('0x131'),_0x9fc5f8[_0x2dbd0e]));if(_0x51f399[_0x4dd7('0xa9')]===-0x1){return _0x51f399;}logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x132'),_0x9fc5f8[_0x2dbd0e],_0x51f399[_0x4dd7('0x9d')]));if(_0x51f399[_0x4dd7('0x9d')]===_0x4dd7('0x12a')){logger[_0x4dd7('0x2e')](util['format']('IFTIME\x20%s\x20%s',_0x9fc5f8[_0x2dbd0e],_0x4dd7('0x12a')));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x132'),_0x9fc5f8[_0x2dbd0e],_0x4dd7('0x12a')));return{'code':0xc8,'result':_0x4dd7('0x12a')};}else{logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x132'),_0x9fc5f8[_0x2dbd0e],_0x4dd7('0x12c')));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x132'),_0x9fc5f8[_0x2dbd0e],'false'));}}return{'code':0xc8,'result':_0x4dd7('0x12c')};};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x133')]=function(_0x5112a6){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x5112a6['label']));return this[_0x4dd7('0xe')][_0x4dd7('0x133')]();};AGIVertices['prototype'][_0x4dd7('0x134')]=function(_0x3d8f4e){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x135'),_0x3d8f4e[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x3d8f4e[_0x4dd7('0x7b')])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0xde'));}var _0x3af646=_0x4dd7('0x136');var _0x41aba1=util[_0x4dd7('0x53')](_0x4dd7('0x119'),FILES_PATH,rs[_0x4dd7('0x106')](0x4));var _0x458d76=util[_0x4dd7('0x53')](_0x4dd7('0x97'),_0x41aba1,_0x3af646);var _0x55b4e5=!![];if(_0x3d8f4e[_0x4dd7('0x11a')]===_0x4dd7('0x11b')){_0x55b4e5=![];}var _0x3aab64=this[_0x4dd7('0xe')][_0x4dd7('0x122')](_0x41aba1,_0x3af646,_0x3d8f4e[_0x4dd7('0x11c')],_0x3d8f4e[_0x4dd7('0x67')],undefined,_0x55b4e5);if(_0x3aab64[_0x4dd7('0xa9')]!==-0x1){this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x137'),_0x458d76));var _0x3bde45=this['ispeechASR'][_0x4dd7('0x70')](this,_0x3d8f4e,_0x458d76);if(_0x3bde45){for(var _0x520e98 in _0x3bde45){if(_0x3bde45[_0x4dd7('0x90')](_0x520e98)){this['channel'][_0x4dd7('0x98')](util['format'](_0x4dd7('0x138'),_0x520e98['toUpperCase']()),_0x3bde45[_0x520e98]);}}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x139'),JSON[_0x4dd7('0x74')](_0x3bde45)));}}return _0x3aab64;};AGIVertices[_0x4dd7('0x10')]['ispeechtts']=function(_0x1b4c23){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x13a'),_0x1b4c23[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x1b4c23[_0x4dd7('0x7b')])){return this[_0x4dd7('0xe')]['noop']('no\x20key\x20configured');}if(!this[_0x4dd7('0xa6')](_0x1b4c23[_0x4dd7('0x5c')])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x10f'));}this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x13b'),_0x1b4c23['text']));var _0x162f7b=this[_0x4dd7('0x7d')][_0x4dd7('0x70')](this,_0x1b4c23);if(_0x162f7b){this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x137'),_0x162f7b));var _0x34d016=this[_0x4dd7('0xe')][_0x4dd7('0xf0')](_0x162f7b,_0x1b4c23[_0x4dd7('0x11c')]);try{fs[_0x4dd7('0xf1')](_0x162f7b+_0x4dd7('0xf2'));}catch(_0x1f4c5a){logger['error'](_0x1f4c5a);}return _0x34d016;}return this['channel'][_0x4dd7('0x4e')](_0x1b4c23,_0x4dd7('0x13c'));};AGIVertices[_0x4dd7('0x10')]['login']=function(_0xb7faff){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x13d'),_0xb7faff[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0xb7faff['findBy'])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0xb7faff,_0x4dd7('0x13e'));}logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x13f'),this[_0x4dd7('0xe')]['callerid'],_0xb7faff[_0x4dd7('0x140')]));var _0x396613=this[_0x4dd7('0x51')]['sync'](this,_0xb7faff[_0x4dd7('0x140')]);if(_0x396613){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0xb7faff[_0x4dd7('0x140')]));this['channel']['noop'](util[_0x4dd7('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0xb7faff[_0x4dd7('0x140')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this['channel'][_0x4dd7('0x3a')],_0xb7faff[_0x4dd7('0x140')]));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this[_0x4dd7('0xe')]['callerid'],_0xb7faff[_0x4dd7('0x140')]));return{'code':0xc8,'result':_0x4dd7('0x142')};}};AGIVertices['prototype'][_0x4dd7('0x143')]=function(_0x2019e3){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x144'),_0x2019e3[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x2019e3[_0x4dd7('0x140')])){return this['channel'][_0x4dd7('0x4e')](_0x2019e3,_0x4dd7('0x13e'));}logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x13f'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x2019e3[_0x4dd7('0x140')]));var _0x5e7dec=this[_0x4dd7('0x50')]['sync'](this,_0x2019e3[_0x4dd7('0x140')]);if(_0x5e7dec){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x145'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x2019e3[_0x4dd7('0x140')]));this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x145'),this[_0x4dd7('0xe')]['callerid'],_0x2019e3[_0x4dd7('0x140')]));return{'code':0xc8,'result':_0x4dd7('0x146')};}else{logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x141'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x2019e3[_0x4dd7('0x140')]));this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x2019e3[_0x4dd7('0x140')]));return{'code':0xc8,'result':_0x4dd7('0x142')};}};AGIVertices[_0x4dd7('0x10')]['math']=function(_0x1f3e13){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x147'),_0x1f3e13[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x1f3e13[_0x4dd7('0x148')])){return this['channel'][_0x4dd7('0x4e')](_0x1f3e13,_0x4dd7('0x149'));}this['channel'][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x14a'),_0x1f3e13[_0x4dd7('0x148')]));var _0x2bf7f2=eval(_0x1f3e13[_0x4dd7('0x148')]);if(!this[_0x4dd7('0xa6')](_0x1f3e13[_0x4dd7('0x100')])){return this['channel'][_0x4dd7('0xb4')](_0x4dd7('0xcd'));}var _0x5cabb6=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x1f3e13['variable_id']);if(!_0x5cabb6){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x1f3e13,_0x4dd7('0xce'));}if(_['isArray'](_0x2bf7f2)){var _0x1a93c3=this;_0x2bf7f2[_0x4dd7('0xcf')](function(_0x55fe96,_0x2b6ef0){_0x1a93c3[_0x4dd7('0xe')][_0x4dd7('0x98')](util[_0x4dd7('0x53')]('%s[%s]',_0x5cabb6,_0x2b6ef0),_0x55fe96);});return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x14b'),_0x5cabb6));}else{return this[_0x4dd7('0xe')]['setVariable'](_0x5cabb6,_0x2bf7f2);}};AGIVertices['prototype'][_0x4dd7('0x14c')]=function(_0x223fb2){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x14d'),_0x223fb2[_0x4dd7('0xa2')]));if(_0x223fb2[_0x4dd7('0xfd')]===0x0){return this[_0x4dd7('0xa0')](_0x223fb2);}_0x223fb2[_0x4dd7('0xfd')]-=0x1;if(!this[_0x4dd7('0xa6')](_0x223fb2[_0x4dd7('0xff')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x223fb2,_0x4dd7('0x14e'));}var _0x162ff1=this[_0x4dd7('0xfe')][_0x4dd7('0x70')](this,_0x223fb2['file_id']);if(!_0x162ff1){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x223fb2,'no\x20file\x20audio\x20found');}var _0x2f8955=this[_0x4dd7('0xe')][_0x4dd7('0x14f')](_0x162ff1,_0x223fb2['response'],_0x223fb2[_0x4dd7('0x150')]);var _0x49cd87=_0x2f8955[_0x4dd7('0xa9')];if(_0x2f8955[_0x4dd7('0xa9')]===-0x1){this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x223fb2,'-1');return _0x2f8955;}else if(_0x2f8955['extra']==='timeout'){_0x2f8955[_0x4dd7('0xa9')]=_0x2f8955['result'][_0x4dd7('0x94')]>0x0?_0x2f8955[_0x4dd7('0xa9')]:'t';}else if(_[_0x4dd7('0x43')](_0x2f8955[_0x4dd7('0xa9')])){_0x2f8955[_0x4dd7('0xa9')]='#';_0x49cd87='#';}if(!this['isConfigured'](_0x223fb2[_0x4dd7('0x100')])){this['channel'][_0x4dd7('0xb4')](_0x4dd7('0xcd'));}else{var _0x5b6e77=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x223fb2[_0x4dd7('0x100')]);if(!_0x5b6e77){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x223fb2,_0x4dd7('0xce'));}this[_0x4dd7('0xe')]['setVariable'](_0x5b6e77,_0x49cd87);}this['createSquareDetailsReport'][_0x4dd7('0x70')](this,_0x223fb2,_0x49cd87);return _0x2f8955;};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0xb4')]=function(_0x1b8af2){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x151'),_0x1b8af2[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x1b8af2[_0x4dd7('0x152')]||_0x1b8af2[_0x4dd7('0xa2')]);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x153')]=function(_0xd915e5){logger['info'](util[_0x4dd7('0x53')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0xd915e5[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0xd915e5[_0x4dd7('0x140')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0xd915e5,'no\x20find\x20by\x20configured');}logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x13f'),this['channel'][_0x4dd7('0x3a')],_0xd915e5[_0x4dd7('0x140')]));var _0x1e09f1=this[_0x4dd7('0x154')]['sync'](this,_0xd915e5[_0x4dd7('0x155')]);var _0x33a456=this[_0x4dd7('0x4c')]['sync'](this,_0xd915e5[_0x4dd7('0x140')],_0x1e09f1);if(_0x33a456){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x145'),this['channel'][_0x4dd7('0x3a')],_0xd915e5[_0x4dd7('0x140')]));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x145'),this['channel'][_0x4dd7('0x3a')],_0xd915e5['findBy']));return{'code':0xc8,'result':_0x4dd7('0x146')};}else{logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0xd915e5[_0x4dd7('0x140')]));this[_0x4dd7('0xe')]['noop'](util['format'](_0x4dd7('0x145'),this['channel'][_0x4dd7('0x3a')],_0xd915e5['findBy']));return{'code':0xc8,'result':_0x4dd7('0x142')};}};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x156')]=function(_0x5e2856){logger['info'](util[_0x4dd7('0x53')]('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x5e2856[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x5e2856['file_id'])){return this['channel'][_0x4dd7('0x4e')](_0x5e2856,'no\x20file\x20audio\x20selected');}var _0x312f87=this[_0x4dd7('0xfe')][_0x4dd7('0x70')](this,_0x5e2856[_0x4dd7('0xff')]);if(!_0x312f87){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x5e2856,_0x4dd7('0x157'));}var _0x33a715=this[_0x4dd7('0xe')][_0x4dd7('0x56')](_0x4dd7('0x158'),[_0x312f87,_0x5e2856[_0x4dd7('0xdb')]]);if(_0x33a715['result']===-0x1){return _0x33a715;}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x159'),_0x4dd7('0x158'),_0x312f87));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x15a')]=function(_0x2b9e28){logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x15b'),_0x2b9e28[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x2b9e28[_0x4dd7('0x15c')])){return this[_0x4dd7('0xe')]['error'](_0x2b9e28,_0x4dd7('0x15d'));}var _0x43de4d='';var _0x2ae794=parseInt(_0x2b9e28[_0x4dd7('0x15c')],0xa);if(isNaN(_0x2ae794)){_0x43de4d=_0x2b9e28[_0x4dd7('0x15c')];}else{_0x43de4d=this[_0x4dd7('0x14')][_0x4dd7('0x70')](this,_0x2b9e28[_0x4dd7('0x15c')]);if(!_0x43de4d){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x2b9e28,'no\x20queue\x20found');}}var _0x56ef60='';if(this['isConfigured'](_0x2b9e28[_0x4dd7('0xff')])){var _0x3d2618=this[_0x4dd7('0xfe')][_0x4dd7('0x70')](this,_0x2b9e28['file_id']);if(_0x3d2618){_0x56ef60=_0x3d2618;}}this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x2b9e28,_0x43de4d);if(_0x2b9e28[_0x4dd7('0xdb')][_0x4dd7('0x15e')]('x')<0x0){_0x2b9e28[_0x4dd7('0xdb')]+='x';}if(_0x2b9e28[_0x4dd7('0xdb')][_0x4dd7('0x15e')]('X')<0x0){_0x2b9e28[_0x4dd7('0xdb')]+='X';}this[_0x4dd7('0xe')][_0x4dd7('0x98')](_0x4dd7('0x15f'),_0x43de4d?_0x43de4d[_0x4dd7('0x160')]():'');var _0x134946=this[_0x4dd7('0xe')]['exec']('QUEUE',[_0x43de4d,_0x2b9e28[_0x4dd7('0xdb')],_0x2b9e28['url'],_0x56ef60,_0x2b9e28[_0x4dd7('0x67')],_0x2b9e28[_0x4dd7('0x7')],_0x2b9e28[_0x4dd7('0x161')],_0x2b9e28[_0x4dd7('0x162')],'',_0x2b9e28['position']]);if(_0x134946[_0x4dd7('0xa9')]===-0x1){return _0x134946;}return this['channel'][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x159'),'QUEUE',_0x43de4d));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x163')]=function(_0x304ffb){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x164'),_0x304ffb['label']));var _0x5e56a9=_0x304ffb[_0x4dd7('0x165')]||_0x4dd7('0x136');var _0x45db77=util['format'](_0x4dd7('0x166'),this['channel'][_0x4dd7('0x37')],rs['generate'](0x5));var _0xe12e0f=util['format'](_0x4dd7('0x167'),FILES_PATH,_0x45db77,_0x5e56a9);var _0x3d42a1=util[_0x4dd7('0x53')](_0x4dd7('0x119'),FILES_PATH,_0x45db77);this[_0x4dd7('0x168')][_0x4dd7('0x70')](this,_0x304ffb,_0x45db77,_0xe12e0f);this['channel'][_0x4dd7('0x98')]('RECORDING_SAVENAME',_0x45db77);logger[_0x4dd7('0x2e')]('Recording\x20%s\x20%s\x20%s\x20%s',_0x3d42a1,_0x5e56a9,_0x304ffb[_0x4dd7('0x169')],_0x304ffb[_0x4dd7('0x67')]);return this[_0x4dd7('0xe')]['recordFile'](_0x3d42a1,_0x5e56a9,_0x304ffb[_0x4dd7('0x169')],_0x304ffb[_0x4dd7('0x67')],undefined,!![]);};AGIVertices['prototype'][_0x4dd7('0x16a')]=function(_0x2dbd60){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x16b'),_0x2dbd60[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x2dbd60[_0x4dd7('0x64')])){return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x16c'));}var _0x232a5f=this[_0x4dd7('0x63')][_0x4dd7('0x70')](this,_0x2dbd60);logger[_0x4dd7('0x2e')](util['format'](_0x4dd7('0x16d'),util[_0x4dd7('0x16e')](_0x232a5f,{'showHidden':![],'depth':null})));if(!this[_0x4dd7('0xa6')](_0x2dbd60[_0x4dd7('0x100')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x16f'));}var _0x4c41bd=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x2dbd60['variable_id']);if(!_0x4c41bd){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x2dbd60,_0x4dd7('0xce'));}this['channel'][_0x4dd7('0x98')](util['format'](_0x4dd7('0x170'),_0x4c41bd),_0x232a5f['statusCode']?_0x232a5f['statusCode']:_0x4dd7('0x171'));this['channel']['setVariable'](util[_0x4dd7('0x53')]('%s_STATUS_MESSAGE',_0x4c41bd),_0x232a5f[_0x4dd7('0x77')]?_0x232a5f[_0x4dd7('0x77')]:'OK');if(_0x232a5f[_0x4dd7('0x6c')]){try{this[_0x4dd7('0x95')](_0x232a5f[_0x4dd7('0x6c')],_0x4c41bd);}catch(_0x161e60){logger[_0x4dd7('0x4e')](util[_0x4dd7('0x53')](_0x4dd7('0x172'),_0x4c41bd));}}return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x173'),_0x4c41bd));};AGIVertices['prototype']['saydigits']=function(_0x1a0932){logger['info'](util[_0x4dd7('0x53')]('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x1a0932[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')][_0x4dd7('0x174')](_0x1a0932[_0x4dd7('0x175')]['replace'](/\s+/g,''),_0x1a0932[_0x4dd7('0x169')]);};AGIVertices['prototype']['saynumber']=function(_0x1b3038){logger['info'](util['format'](_0x4dd7('0x176'),_0x1b3038[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')][_0x4dd7('0x177')](_0x1b3038['number'][_0x4dd7('0x58')](/\s+/g,''),_0x1b3038[_0x4dd7('0x169')]);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x178')]=function(_0x176f4b){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x179'),_0x176f4b[_0x4dd7('0xa2')]));return this[_0x4dd7('0xe')]['sayPhonetic'](_0x176f4b[_0x4dd7('0x5c')],_0x176f4b[_0x4dd7('0x169')]);};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x17a')]=function(_0x5b7c68){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x17b'),_0x5b7c68[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x5b7c68['account_id'])){return this['channel']['noop'](_0x4dd7('0x17c'));}var _0x1dccb0=this['getMailAccount']['sync'](this,_0x5b7c68[_0x4dd7('0x17d')]);if(!_0x1dccb0||!_0x1dccb0['Smtp']){return this['channel'][_0x4dd7('0x4e')](_0x5b7c68,_0x4dd7('0x17e'));}var _0x167d5d={'from':util[_0x4dd7('0x53')](_0x4dd7('0x17f'),_0x1dccb0[_0x4dd7('0x13')],_0x1dccb0[_0x4dd7('0x180')]||_0x1dccb0['Smtp']['user']),'to':_0x5b7c68['to']||'','cc':_0x5b7c68['cc']||'','bcc':_0x5b7c68[_0x4dd7('0x181')]||'','subject':_0x5b7c68[_0x4dd7('0x182')],'html':_0x5b7c68[_0x4dd7('0x5c')],'text':_0x5b7c68[_0x4dd7('0x5c')]};var _0x3ee00d={'tls':{'rejectUnauthorized':![]}};if(_0x1dccb0[_0x4dd7('0x183')][_0x4dd7('0x184')]){_0x3ee00d[_0x4dd7('0x184')]=_0x1dccb0[_0x4dd7('0x183')][_0x4dd7('0x184')];}else{_0x3ee00d[_0x4dd7('0x185')]=_0x1dccb0[_0x4dd7('0x183')][_0x4dd7('0x185')];_0x3ee00d['port']=_0x1dccb0[_0x4dd7('0x183')][_0x4dd7('0x186')];_0x3ee00d[_0x4dd7('0x187')]=_0x1dccb0[_0x4dd7('0x183')][_0x4dd7('0x187')];}if(_0x1dccb0['Smtp'][_0x4dd7('0x188')]){_0x3ee00d[_0x4dd7('0x189')]={'user':_0x1dccb0[_0x4dd7('0x183')]['user'],'pass':_0x1dccb0['Smtp'][_0x4dd7('0x18a')]};}if(this[_0x4dd7('0xa6')](_0x5b7c68[_0x4dd7('0x18b')])){}logger[_0x4dd7('0xd4')](_0x4dd7('0x18c'),JSON[_0x4dd7('0x74')](_0x167d5d));this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x5b7c68,_0x5b7c68['account_id']);this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x1dccb0[_0x4dd7('0x13')]));this[_0x4dd7('0x22')]['sync'](this,_0x3ee00d,_0x167d5d);return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x18d'));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x18e')]=function(_0x23af89){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x18f'),_0x23af89[_0x4dd7('0xa2')]));return this['channel'][_0x4dd7('0xb4')](_0x4dd7('0x190'));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x191')]=function(_0x5054af){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x192'),_0x5054af[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x5054af[_0x4dd7('0x193')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x194'));}var _0x5a1470=this[_0x4dd7('0x33')][_0x4dd7('0x70')](this,_0x5054af[_0x4dd7('0x193')]);if(!_0x5a1470){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x5054af,'no\x20sms\x20account\x20found');}var _0x563ea1={'body':_0x5054af[_0x4dd7('0x195')],'phone':_0x5054af['to']||'','SmsAccountId':_0x5a1470['id']};logger[_0x4dd7('0xd4')](_0x4dd7('0x196'),JSON[_0x4dd7('0x74')](_0x563ea1));this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0x5054af,_0x5054af[_0x4dd7('0x193')]);this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('Trying\x20SendSMS\x20with\x20account\x20%s',_0x5a1470['name']));this[_0x4dd7('0x35')][_0x4dd7('0x70')](this,_0x563ea1);return this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x197'));};AGIVertices['prototype'][_0x4dd7('0x198')]=function(_0x9e3a76){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x199'),_0x9e3a76[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x9e3a76[_0x4dd7('0x100')])){return this[_0x4dd7('0xe')]['error'](_0x9e3a76,_0x4dd7('0x19a'));}var _0x27c895=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x9e3a76[_0x4dd7('0x100')]);if(!_0x27c895){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x9e3a76,_0x4dd7('0xce'));}return this[_0x4dd7('0xe')][_0x4dd7('0x98')](_0x27c895,_0x9e3a76[_0x4dd7('0x19b')]);};AGIVertices[_0x4dd7('0x10')]['start']=function(_0x527c8f){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x19c'),_0x527c8f['label']));this[_0x4dd7('0xe')]['noop'](_0x4dd7('0x19d'));if(_0x527c8f[_0x4dd7('0xaa')]==='yes'){this[_0x4dd7('0xe')]['noop']('Answer');return this[_0x4dd7('0xe')]['answer']();}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x19e'));};AGIVertices['prototype'][_0x4dd7('0x19f')]=function(_0xf749a3){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x1a0'),_0xf749a3[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0xf749a3[_0x4dd7('0x1a1')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0xf749a3,_0x4dd7('0x1a2'));}var _0x32d4f4=this[_0x4dd7('0x17')]['sync'](this,_0xf749a3[_0x4dd7('0x1a1')]);if(!this[_0x4dd7('0xa6')](_0x32d4f4)){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0xf749a3,util['format'](_0x4dd7('0x1a3'),_0xf749a3['project_id']));}if(_0x32d4f4===this[_0x4dd7('0xe')][_0x4dd7('0x39')]){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0xf749a3,_0x4dd7('0x1a4'));}this[_0x4dd7('0x36')][_0x4dd7('0x70')](this,_0xf749a3,_0x32d4f4);var _0x1e4e99=this[_0x4dd7('0xe')][_0x4dd7('0x56')](_0x4dd7('0x1a5'),util[_0x4dd7('0x53')](_0x4dd7('0x1a6'),config[_0x4dd7('0x7')][_0x4dd7('0x185')]||_0x4dd7('0x1a7'),_0x32d4f4,this[_0x4dd7('0xe')][_0x4dd7('0x39')]));if(_0x1e4e99[_0x4dd7('0xa9')]===-0x1){return _0x1e4e99;}return this[_0x4dd7('0xe')]['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x159'),_0x4dd7('0x1a5'),_0x32d4f4));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1a8')]=function(_0x11f9fa){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x11f9fa[_0x4dd7('0xa2')]));var _0x110b48=this[_0x4dd7('0x55')][_0x4dd7('0x70')](this,_0x11f9fa[_0x4dd7('0xa3')]);this['createSquareDetailsReport'][_0x4dd7('0x70')](this,_0x11f9fa,_0x11f9fa[_0x4dd7('0xa3')]);if(this['isConfigured'](_0x11f9fa[_0x4dd7('0x100')])){var _0x318f92=this[_0x4dd7('0x11')][_0x4dd7('0x70')](this,_0x11f9fa['variable_id']);if(_0x318f92){this['channel']['setVariable'](_0x318f92,_0x110b48);return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x1a9'),_0x11f9fa[_0x4dd7('0xa3')],_0x318f92));}}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x1aa'),_0x11f9fa[_0x4dd7('0xa3')]));};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1ab')]=function(_0x5ac31c){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x1ac'),_0x5ac31c[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x5ac31c['apiKey'])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x1ad'));}if(!this[_0x4dd7('0xa6')](_0x5ac31c[_0x4dd7('0x5c')])){return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](_0x4dd7('0x10f'));}this['channel'][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5ac31c['text']));var _0x559d38=this[_0x4dd7('0x59')][_0x4dd7('0x70')](this,_0x5ac31c);if(_0x559d38){this['channel']['noop'](util[_0x4dd7('0x53')](_0x4dd7('0x1ae'),_0x559d38));var _0x276c2f=this['channel'][_0x4dd7('0xf0')](_0x559d38);try{fs[_0x4dd7('0xf1')](_0x559d38+_0x4dd7('0xf2'));}catch(_0x2b3fdc){logger[_0x4dd7('0x4e')](_0x2b3fdc);}return _0x276c2f;}return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x5ac31c,'Google\x20Cloud\x20TTS\x20is\x20unreachable');};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1af')]=function(_0x343cbd){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x1b0'),_0x343cbd[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x343cbd[_0x4dd7('0x5c')])){return this['channel'][_0x4dd7('0xb4')](_0x4dd7('0x10f'));}this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')]('Trying\x20Google\x20TTS\x20%s',_0x343cbd[_0x4dd7('0x5c')]));var _0x26ef1f=this[_0x4dd7('0x1b1')][_0x4dd7('0x70')](this,_0x343cbd);if(_0x26ef1f){this['channel']['noop'](util[_0x4dd7('0x53')]('Google\x20TTS\x20%s\x20file\x20created',_0x26ef1f));var _0x7c4be5=this[_0x4dd7('0xe')][_0x4dd7('0xf0')](_0x26ef1f);try{fs[_0x4dd7('0xf1')](_0x26ef1f+_0x4dd7('0xf2'));}catch(_0xb254fb){logger[_0x4dd7('0x4e')](_0xb254fb);}return _0x7c4be5;}return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x343cbd,_0x4dd7('0x1b2'));};AGIVertices['prototype'][_0x4dd7('0x1b3')]=function(_0x495ad1){logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')]('Enter\x20in\x20UNPAUSE\x20(%s)\x20block',_0x495ad1[_0x4dd7('0xa2')]));if(!this['isConfigured'](_0x495ad1[_0x4dd7('0x140')])){return this[_0x4dd7('0xe')][_0x4dd7('0x4e')](_0x495ad1,_0x4dd7('0x13e'));}logger['info'](util['format'](_0x4dd7('0x13f'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x495ad1[_0x4dd7('0x140')]));var _0x3b3189=this[_0x4dd7('0x4f')][_0x4dd7('0x70')](this,_0x495ad1[_0x4dd7('0x140')]);if(_0x3b3189){logger['info'](util[_0x4dd7('0x53')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x495ad1[_0x4dd7('0x140')]));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util['format'](_0x4dd7('0x145'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x495ad1[_0x4dd7('0x140')]));return{'code':0xc8,'result':'success'};}else{logger[_0x4dd7('0x2e')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x495ad1[_0x4dd7('0x140')]));this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x141'),this[_0x4dd7('0xe')][_0x4dd7('0x3a')],_0x495ad1[_0x4dd7('0x140')]));return{'code':0xc8,'result':_0x4dd7('0x142')};}};AGIVertices[_0x4dd7('0x10')][_0x4dd7('0x1b4')]=function(_0x43393b){logger['info'](util[_0x4dd7('0x53')](_0x4dd7('0x1b5'),_0x43393b[_0x4dd7('0xa2')]));var _0x3c6382=this[_0x4dd7('0xe')][_0x4dd7('0x56')]('VOICEMAIL',[_0x43393b[_0x4dd7('0x1b6')],_0x43393b[_0x4dd7('0x79')]]);if(_0x3c6382['result']===-0x1){return _0x3c6382;}return this[_0x4dd7('0xe')][_0x4dd7('0xb4')](util[_0x4dd7('0x53')](_0x4dd7('0x159'),'VOICEMAIL',_0x43393b['mailbox']));};AGIVertices['prototype'][_0x4dd7('0x1b7')]=function(_0x4da7b1){logger[_0x4dd7('0x2e')](util['format']('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x4da7b1[_0x4dd7('0xa2')]));if(!this[_0x4dd7('0xa6')](_0x4da7b1[_0x4dd7('0x100')])){return this[_0x4dd7('0xe')]['error'](_0x4da7b1,_0x4dd7('0x19a'));}var _0x19a30b=this[_0x4dd7('0x11')]['sync'](this,_0x4da7b1[_0x4dd7('0x100')]);if(!_0x19a30b){return this[_0x4dd7('0xe')]['error'](_0x4da7b1,_0x4dd7('0xce'));}var _0x14f3dd=this['channel'][_0x4dd7('0x11')](_0x19a30b);return{'code':0xc8,'result':_0x14f3dd[_0x4dd7('0x9d')]?_0x14f3dd[_0x4dd7('0x9d')]:'-'};};String[_0x4dd7('0x10')][_0x4dd7('0x9c')]=function(_0x3f38af,_0x146dbc){return this[_0x4dd7('0x9b')](_0x3f38af)[_0x4dd7('0x1b8')](_0x146dbc);};module[_0x4dd7('0x1b9')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index d52339f..94d6bb9 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 _0x0e85=['[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','uniqueid','queue','updateAcw','update','catch','error','[%s][UPDATE][ERRORS:%s]','[ACW][START]\x20%s','prototype','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','message','acw','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','linkedid','isUndefined','attended','[%s][HANGUP:LINKEDID]','startAcw','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','isNil','transfertargetuniqueid','secondtransfereruniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','../ami','../../../config/logger','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','milliseconds','diff','seconds','interface','ACW','mandatoryDisposition','mandatoryDispositionPause','Action','QueuePause','then','voicePause','info','destlinkedid','savePause'];(function(_0x51553b,_0x568b17){var _0xddba53=function(_0x88d101){while(--_0x88d101){_0x51553b['push'](_0x51553b['shift']());}};_0xddba53(++_0x568b17);}(_0x0e85,0x7c));var _0x50e8=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x0e85[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x50e8('0x0'));var _=require(_0x50e8('0x1'));var moment=require('moment');var ami=require(_0x50e8('0x2'));var logger=require(_0x50e8('0x3'))('acw');var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x236cf3){this['voiceQueues']=_0x236cf3[_0x50e8('0x4')];this[_0x50e8('0x5')]=_0x236cf3[_0x50e8('0x5')];this[_0x50e8('0x6')]=_0x236cf3['timers'];this[_0x50e8('0x7')]={};ami['on'](_0x50e8('0x8'),this[_0x50e8('0x9')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xb'),this[_0x50e8('0xc')]['bind'](this));ami['on'](_0x50e8('0xd'),this[_0x50e8('0xe')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0xf'),this[_0x50e8('0x10')][_0x50e8('0xa')](this));ami['on'](_0x50e8('0x11'),this[_0x50e8('0x12')]['bind'](this));ami['on']('blindtransfer',this[_0x50e8('0x13')][_0x50e8('0xa')](this));ami['on']('custom:agentConnectPreview',this['syncAgentConnectPreview'][_0x50e8('0xa')](this));}function getDiff(_0x2abda1){var _0x1a4c85=moment()[_0x50e8('0x14')](0x0);var _0x54efd3=moment(_0x2abda1)[_0x50e8('0x14')](0x0);return _0x1a4c85[_0x50e8('0x15')](_0x54efd3,_0x50e8('0x16'));}Acw['prototype']['startAcw']=function(_0x30a872){try{var _0xf02b48=this;var _0x40c184=this[_0x50e8('0x7')][_0x30a872][_0x50e8('0x17')];var _0x1f0338=this['channels'][_0x30a872]['queue'];var _0x441f25=this[_0x50e8('0x4')][_0x1f0338];var _0x40d060=![];var _0x45ce11=_0x50e8('0x18');if(_0x441f25[_0x50e8('0x19')]){if(_0x441f25[_0x50e8('0x1a')]['name']){_0x40d060=!![];_0x45ce11=_0x441f25[_0x50e8('0x1a')]['name'];}}ami[_0x50e8('0x1b')]({'action':_0x50e8('0x1c'),'interface':_0x40c184,'paused':!![],'reason':_0x45ce11})[_0x50e8('0x1d')](function(_0x20f835){if(_0xf02b48[_0x50e8('0x5')][_0x40c184]){return RpcUser['getAgent'](_0xf02b48[_0x50e8('0x5')][_0x40c184]['id'])[_0x50e8('0x1d')](function(_0x58110d){if(_0x58110d&&!_0x58110d[_0x50e8('0x1e')]){logger[_0x50e8('0x1f')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);var _0x1ce7fc=_0xf02b48[_0x50e8('0x7')][_0x30a872]['attended']&&_0xf02b48['channels'][_0x30a872]['destlinkedid']?_0xf02b48[_0x50e8('0x7')][_0x30a872][_0x50e8('0x20')]:_0x30a872;return RpcUser[_0x50e8('0x21')](_0xf02b48[_0x50e8('0x5')][_0x40c184],_0x45ce11,_0x1ce7fc)[_0x50e8('0x1d')](function(_0x13b6e9){if(!_0x40d060){_0xf02b48['timers'][_0x40c184]={};logger[_0x50e8('0x1f')](_0x50e8('0x22'),_0x30a872,_0xf02b48['voiceQueues'][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x24')]=setTimeout(_0xf02b48[_0x50e8('0x25')]['bind'](_0xf02b48,_0x40c184),_0xf02b48[_0x50e8('0x4')][_0x1f0338]['acwTimeout']*0x3e8);_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x26')]=moment()[_0x50e8('0x27')]('YYYY-MM-DD\x20HH:mm:ss');_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x28')]=_0x30a872;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x29')]=_0x1f0338;_0xf02b48[_0x50e8('0x6')][_0x40c184][_0x50e8('0x2a')]=function(){var _0x2c6fb3=getDiff(_0xf02b48['timers'][_0x40c184][_0x50e8('0x26')]);clearTimeout(_0xf02b48[_0x50e8('0x6')][_0x40c184]['timer']);_0xf02b48['timers'][_0x40c184][_0x50e8('0x24')]=![];RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2c6fb3},_0xf02b48[_0x50e8('0x6')][_0x40c184]['uniqueid'],_0x40c184)['then'](function(_0x3e58a9){logger[_0x50e8('0x1f')]('[%s][UPDATE][ACWTIME:%s]',_0x30a872,_0x2c6fb3,_0x3e58a9);})[_0x50e8('0x2c')](function(_0x17c6a5){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x30a872,_0x17c6a5);});delete _0xf02b48['timers'][_0x40c184];};}});}else{logger[_0x50e8('0x1f')]('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x30a872,_0x40c184,_0x1f0338);}});}})[_0x50e8('0x2c')](function(_0x33fc5b){logger[_0x50e8('0x2d')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x30a872,_0xf02b48[_0x50e8('0x4')][_0x1f0338][_0x50e8('0x23')],_0x40c184,_0x1f0338);})['finally'](function(){delete _0xf02b48[_0x50e8('0x7')][_0x30a872];});}catch(_0x1c2fdb){logger[_0x50e8('0x2d')](_0x50e8('0x2f'),_0x1c2fdb['message']);}};Acw[_0x50e8('0x30')][_0x50e8('0x25')]=function(_0x24d3ea){try{var _0x4e2a37=this;if(_0x4e2a37['timers'][_0x24d3ea]){_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x24')]=![];var _0x3f01ee=_0x4e2a37['timers'][_0x24d3ea]['uniqueid'];var _0x5dff99=_0x4e2a37[_0x50e8('0x6')][_0x24d3ea][_0x50e8('0x29')];var _0x2cbee3=_0x4e2a37[_0x50e8('0x4')][_0x5dff99][_0x50e8('0x23')];logger[_0x50e8('0x1f')](_0x50e8('0x31'),_0x24d3ea);RpcUser[_0x50e8('0x32')](this[_0x50e8('0x5')][_0x24d3ea]);RpcVoiceAgentReport[_0x50e8('0x2b')]({'acwtime':_0x2cbee3,'agentacw':!![]},_0x3f01ee,_0x24d3ea)['then'](function(_0x3371a4){logger[_0x50e8('0x1f')](_0x50e8('0x33'),_0x3f01ee,_0x2cbee3,_0x3371a4);})[_0x50e8('0x2c')](function(_0x5dbbe1){logger[_0x50e8('0x2d')](_0x50e8('0x2e'),_0x3f01ee,_0x5dbbe1);});}else{logger[_0x50e8('0x2d')](_0x50e8('0x34'),_0x24d3ea);if(_0x4e2a37[_0x50e8('0x6')]){logger['info']('[ACW][TIMERS]',JSON[_0x50e8('0x35')](_0x4e2a37[_0x50e8('0x6')]));}}}catch(_0x53705e){logger[_0x50e8('0x2d')](_0x50e8('0x36'),_0x53705e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x9')]=function(_0x313e7b){try{if(this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]&&(this['voiceQueues'][_0x313e7b[_0x50e8('0x29')]][_0x50e8('0x38')]||this[_0x50e8('0x4')][_0x313e7b[_0x50e8('0x29')]]['mandatoryDisposition'])){if(this[_0x50e8('0x5')][_0x313e7b[_0x50e8('0x17')]]){this[_0x50e8('0x7')][_0x313e7b[_0x50e8('0x28')]]={'queue':_0x313e7b['queue'],'interface':_0x313e7b[_0x50e8('0x17')],'destlinkedid':_0x313e7b['destlinkedid']};}}}catch(_0x4a2619){logger['error'](_0x50e8('0x39'),_0x4a2619[_0x50e8('0x37')]);}};Acw['prototype'][_0x50e8('0x3a')]=function(_0x2007c4){try{if(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]&&(this[_0x50e8('0x4')][_0x2007c4[_0x50e8('0x29')]]['acw']||this[_0x50e8('0x4')][_0x2007c4['queue']][_0x50e8('0x19')])){if(this[_0x50e8('0x5')][_0x2007c4['interface']]){this[_0x50e8('0x7')][_0x2007c4['uniqueid']]={'queue':_0x2007c4[_0x50e8('0x29')],'interface':_0x2007c4[_0x50e8('0x17')]};}}}catch(_0x2e55ed){logger[_0x50e8('0x2d')](_0x50e8('0x3b'),_0x2e55ed[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xc')]=function(_0x141bd4){try{if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]&&_['isUndefined'](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x28')]]['attended'])){logger[_0x50e8('0x1f')]('[%s][HANGUP:UNIQUEID]',_0x141bd4[_0x50e8('0x28')]);this['startAcw'](_0x141bd4[_0x50e8('0x28')]);}else if(this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]]&&_[_0x50e8('0x3d')](this[_0x50e8('0x7')][_0x141bd4[_0x50e8('0x3c')]][_0x50e8('0x3e')])){logger['info'](_0x50e8('0x3f'),_0x141bd4[_0x50e8('0x3c')]);this[_0x50e8('0x40')](_0x141bd4[_0x50e8('0x3c')]);}}catch(_0x3303f5){logger[_0x50e8('0x2d')]('[ACW][syncHangupRequest]\x20%s',_0x3303f5[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0xe')]=function(_0x27c80a){try{if(this['channels'][_0x27c80a[_0x50e8('0x28')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x28')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x41'),_0x27c80a[_0x50e8('0x28')]);this['startAcw'](_0x27c80a['uniqueid']);}else if(this['channels'][_0x27c80a[_0x50e8('0x3c')]]&&this[_0x50e8('0x7')][_0x27c80a[_0x50e8('0x3c')]][_0x50e8('0x3e')]){logger[_0x50e8('0x1f')](_0x50e8('0x42'),_0x27c80a['linkedid']);this[_0x50e8('0x40')](_0x27c80a[_0x50e8('0x3c')]);}}catch(_0x460c8e){logger[_0x50e8('0x2d')]('[ACW][syncHangup]\x20%s',_0x460c8e[_0x50e8('0x37')]);}};Acw[_0x50e8('0x30')][_0x50e8('0x12')]=function(_0x1cc5ba){try{if(!_[_0x50e8('0x43')](this[_0x50e8('0x7')][_0x1cc5ba['transfereeuniqueid']])){this[_0x50e8('0x40')](_0x1cc5ba['transfereeuniqueid']);if(this['channels'][_0x1cc5ba['secondtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba['secondtransfereruniqueid']][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]]=this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];delete this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x45')]];}}else if(!_['isNil'](this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x44')]])){this[_0x50e8('0x40')](_0x1cc5ba['transfertargetuniqueid']);if(this['channels'][_0x1cc5ba['origtransfereruniqueid']]){this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x46')]][_0x50e8('0x3e')]=!![];this[_0x50e8('0x7')][_0x1cc5ba[_0x50e8('0x47')]]=this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];delete this[_0x50e8('0x7')][_0x1cc5ba['origtransfereruniqueid']];}}}catch(_0x255b48){logger[_0x50e8('0x2d')]('[ACW][syncAttendedTransfer]\x20%s',_0x255b48['message']);}};Acw['prototype'][_0x50e8('0x13')]=function(_0x3588f0){try{if(this['channels'][_0x3588f0[_0x50e8('0x48')]]){logger[_0x50e8('0x1f')](_0x50e8('0x49'),JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x48')]));this['startAcw'](_0x3588f0[_0x50e8('0x48')]);}else if(this[_0x50e8('0x7')][_0x3588f0[_0x50e8('0x4a')]]){logger['info']('[%s][BLINDTRANSFER:LINKEDID]',JSON[_0x50e8('0x35')](_0x3588f0[_0x50e8('0x4a')]));this[_0x50e8('0x40')](_0x3588f0[_0x50e8('0x4a')]);}}catch(_0x2b59f5){logger[_0x50e8('0x2d')]('[ACW][syncBlindTransfer]\x20%s',_0x2b59f5['message']);}};Acw[_0x50e8('0x30')]['syncAgentRingNoAnswer']=function(_0x1fc530){try{if(this[_0x50e8('0x4')][_0x1fc530['queue']]&&this[_0x50e8('0x4')][_0x1fc530['queue']]['autopause']==='all'){if(this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]]){logger[_0x50e8('0x1f')](_0x50e8('0x4b'),_0x1fc530['uniqueid'],_0x1fc530['interface'],_0x1fc530[_0x50e8('0x29')]);return RpcUser[_0x50e8('0x21')](this[_0x50e8('0x5')][_0x1fc530[_0x50e8('0x17')]],_0x50e8('0x4c'),_0x1fc530[_0x50e8('0x28')]);}}}catch(_0x42e1dd){logger[_0x50e8('0x2d')](_0x50e8('0x4d'),_0x42e1dd[_0x50e8('0x37')]);}};module[_0x50e8('0x4e')]=Acw; \ No newline at end of file +var _0x032e=['[ACW][syncAgentConnect]\x20%s','acw','mandatoryDisposition','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','syncBlindTransfer','[%s][BLINDTRANSFER:UNIQUEID]','stringify','transfereruniqueid','transfererlinkedid','[ACW][syncBlindTransfer]\x20%s','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','moment','../ami','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','name','Action','QueuePause','then','getAgent','voicePause','info','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','stopAcw','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','updateAcw','update','uniqueid','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','[TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][TIMERS]','[ACW][STOP]\x20%s'];(function(_0x464838,_0x28c910){var _0x2ca654=function(_0x380da8){while(--_0x380da8){_0x464838['push'](_0x464838['shift']());}};_0x2ca654(++_0x28c910);}(_0x032e,0x124));var _0xe032=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x032e[_0x491a7f];return _0x3d8f44;};'use strict';var util=require(_0xe032('0x0'));var _=require('lodash');var moment=require(_0xe032('0x1'));var ami=require(_0xe032('0x2'));var logger=require('../../../config/logger')('acw');var RpcUser=require(_0xe032('0x3'));var RpcVoiceAgentReport=require(_0xe032('0x4'));function Acw(_0x2f44f6){this[_0xe032('0x5')]=_0x2f44f6[_0xe032('0x5')];this[_0xe032('0x6')]=_0x2f44f6[_0xe032('0x6')];this[_0xe032('0x7')]=_0x2f44f6[_0xe032('0x7')];this[_0xe032('0x8')]={};ami['on'](_0xe032('0x9'),this[_0xe032('0xa')][_0xe032('0xb')](this));ami['on'](_0xe032('0xc'),this[_0xe032('0xd')][_0xe032('0xb')](this));ami['on'](_0xe032('0xe'),this[_0xe032('0xf')]['bind'](this));ami['on'](_0xe032('0x10'),this[_0xe032('0x11')][_0xe032('0xb')](this));ami['on'](_0xe032('0x12'),this[_0xe032('0x13')][_0xe032('0xb')](this));ami['on'](_0xe032('0x14'),this['syncBlindTransfer'][_0xe032('0xb')](this));ami['on'](_0xe032('0x15'),this[_0xe032('0x16')][_0xe032('0xb')](this));}function getDiff(_0x4aee44){var _0x311592=moment()[_0xe032('0x17')](0x0);var _0x176547=moment(_0x4aee44)[_0xe032('0x17')](0x0);return _0x311592[_0xe032('0x18')](_0x176547,_0xe032('0x19'));}Acw[_0xe032('0x1a')]['startAcw']=function(_0x231c35){try{var _0x749018=this;var _0x36fb7c=this[_0xe032('0x8')][_0x231c35][_0xe032('0x1b')];var _0x208b00=this['channels'][_0x231c35][_0xe032('0x1c')];var _0x25cedb=this[_0xe032('0x5')][_0x208b00];var _0x41d2a5=![];var _0x208c47='ACW';if(_0x25cedb['mandatoryDisposition']){if(_0x25cedb['mandatoryDispositionPause'][_0xe032('0x1d')]){_0x41d2a5=!![];_0x208c47=_0x25cedb['mandatoryDispositionPause'][_0xe032('0x1d')];}}ami[_0xe032('0x1e')]({'action':_0xe032('0x1f'),'interface':_0x36fb7c,'paused':!![],'reason':_0x208c47})[_0xe032('0x20')](function(_0x288d91){if(_0x749018[_0xe032('0x6')][_0x36fb7c]){return RpcUser[_0xe032('0x21')](_0x749018['agents'][_0x36fb7c]['id'])[_0xe032('0x20')](function(_0x866c81){if(_0x866c81&&!_0x866c81[_0xe032('0x22')]){logger[_0xe032('0x23')](_0xe032('0x24'),_0x231c35,_0x36fb7c,_0x208b00);var _0x33d89a=_0x749018[_0xe032('0x8')][_0x231c35][_0xe032('0x25')]&&_0x749018['channels'][_0x231c35]['destlinkedid']?_0x749018['channels'][_0x231c35][_0xe032('0x26')]:_0x231c35;return RpcUser[_0xe032('0x27')](_0x749018[_0xe032('0x6')][_0x36fb7c],_0x208c47,_0x33d89a)[_0xe032('0x20')](function(_0x2bfe8f){if(!_0x41d2a5){_0x749018[_0xe032('0x7')][_0x36fb7c]={};logger[_0xe032('0x23')](_0xe032('0x28'),_0x231c35,_0x749018[_0xe032('0x5')][_0x208b00][_0xe032('0x29')],_0x36fb7c,_0x208b00);_0x749018['timers'][_0x36fb7c][_0xe032('0x2a')]=setTimeout(_0x749018[_0xe032('0x2b')][_0xe032('0xb')](_0x749018,_0x36fb7c),_0x749018[_0xe032('0x5')][_0x208b00]['acwTimeout']*0x3e8);_0x749018['timers'][_0x36fb7c][_0xe032('0x2c')]=moment()[_0xe032('0x2d')](_0xe032('0x2e'));_0x749018[_0xe032('0x7')][_0x36fb7c]['uniqueid']=_0x231c35;_0x749018['timers'][_0x36fb7c]['queue']=_0x208b00;_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2f')]=function(){var _0x5518ac=getDiff(_0x749018[_0xe032('0x7')][_0x36fb7c]['lastPauseAt']);clearTimeout(_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2a')]);_0x749018[_0xe032('0x7')][_0x36fb7c][_0xe032('0x2a')]=![];RpcVoiceAgentReport[_0xe032('0x30')]({'acwtime':_0x5518ac},_0x749018['timers'][_0x36fb7c][_0xe032('0x31')],_0x36fb7c)[_0xe032('0x20')](function(_0x319a2f){logger[_0xe032('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x231c35,_0x5518ac,_0x319a2f);})[_0xe032('0x32')](function(_0x4c86e9){logger[_0xe032('0x33')]('[%s][UPDATE][ERRORS:%s]',_0x231c35,_0x4c86e9);});delete _0x749018[_0xe032('0x7')][_0x36fb7c];};}});}else{logger['info'](_0xe032('0x34'),_0x231c35,_0x36fb7c,_0x208b00);}});}})['catch'](function(_0x3970e1){logger[_0xe032('0x33')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x231c35,_0x749018[_0xe032('0x5')][_0x208b00][_0xe032('0x29')],_0x36fb7c,_0x208b00);})[_0xe032('0x35')](function(){delete _0x749018[_0xe032('0x8')][_0x231c35];});}catch(_0x4e222c){logger[_0xe032('0x33')]('[ACW][START]\x20%s',_0x4e222c[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')]['stopAcw']=function(_0x450ba4){try{var _0x23b790=this;if(_0x23b790['timers'][_0x450ba4]){_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x2a')]=![];var _0x3cc437=_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x31')];var _0x42f58a=_0x23b790[_0xe032('0x7')][_0x450ba4][_0xe032('0x1c')];var _0x22651f=_0x23b790[_0xe032('0x5')][_0x42f58a][_0xe032('0x29')];logger[_0xe032('0x23')](_0xe032('0x37'),_0x450ba4);RpcUser[_0xe032('0x38')](this[_0xe032('0x6')][_0x450ba4]);RpcVoiceAgentReport[_0xe032('0x30')]({'acwtime':_0x22651f,'agentacw':!![]},_0x3cc437,_0x450ba4)[_0xe032('0x20')](function(_0x555914){logger[_0xe032('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x3cc437,_0x22651f,_0x555914);})[_0xe032('0x32')](function(_0x2bcfb4){logger[_0xe032('0x33')](_0xe032('0x39'),_0x3cc437,_0x2bcfb4);});}else{logger[_0xe032('0x33')]('[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer',_0x450ba4);if(_0x23b790[_0xe032('0x7')]){logger['info'](_0xe032('0x3a'),JSON['stringify'](_0x23b790[_0xe032('0x7')]));}}}catch(_0x475355){logger[_0xe032('0x33')](_0xe032('0x3b'),_0x475355['message']);}};Acw[_0xe032('0x1a')]['syncAgentConnect']=function(_0x2b9664){try{if(this[_0xe032('0x5')][_0x2b9664[_0xe032('0x1c')]]&&(this[_0xe032('0x5')][_0x2b9664['queue']]['acw']||this[_0xe032('0x5')][_0x2b9664[_0xe032('0x1c')]]['mandatoryDisposition'])){if(this[_0xe032('0x6')][_0x2b9664[_0xe032('0x1b')]]){this[_0xe032('0x8')][_0x2b9664[_0xe032('0x31')]]={'queue':_0x2b9664[_0xe032('0x1c')],'interface':_0x2b9664['interface'],'destlinkedid':_0x2b9664[_0xe032('0x26')]};}}}catch(_0x7bc08){logger[_0xe032('0x33')](_0xe032('0x3c'),_0x7bc08[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x16')]=function(_0x318f86){try{if(this['voiceQueues'][_0x318f86['queue']]&&(this[_0xe032('0x5')][_0x318f86['queue']][_0xe032('0x3d')]||this[_0xe032('0x5')][_0x318f86[_0xe032('0x1c')]][_0xe032('0x3e')])){if(this[_0xe032('0x6')][_0x318f86[_0xe032('0x1b')]]){this[_0xe032('0x8')][_0x318f86[_0xe032('0x31')]]={'queue':_0x318f86[_0xe032('0x1c')],'interface':_0x318f86['interface']};}}}catch(_0x1549c){logger['error']('[ACW][syncAgentConnectPreview]\x20%s',_0x1549c[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0xd')]=function(_0x1e54d3){try{if(this['channels'][_0x1e54d3[_0xe032('0x31')]]&&_[_0xe032('0x3f')](this[_0xe032('0x8')][_0x1e54d3[_0xe032('0x31')]][_0xe032('0x25')])){logger[_0xe032('0x23')](_0xe032('0x40'),_0x1e54d3['uniqueid']);this[_0xe032('0x41')](_0x1e54d3[_0xe032('0x31')]);}else if(this['channels'][_0x1e54d3[_0xe032('0x42')]]&&_[_0xe032('0x3f')](this[_0xe032('0x8')][_0x1e54d3[_0xe032('0x42')]][_0xe032('0x25')])){logger[_0xe032('0x23')](_0xe032('0x43'),_0x1e54d3[_0xe032('0x42')]);this[_0xe032('0x41')](_0x1e54d3[_0xe032('0x42')]);}}catch(_0x3a0253){logger[_0xe032('0x33')](_0xe032('0x44'),_0x3a0253[_0xe032('0x36')]);}};Acw['prototype'][_0xe032('0xf')]=function(_0x53c8b2){try{if(this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x31')]]&&this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x31')]][_0xe032('0x25')]){logger[_0xe032('0x23')](_0xe032('0x45'),_0x53c8b2[_0xe032('0x31')]);this[_0xe032('0x41')](_0x53c8b2[_0xe032('0x31')]);}else if(this[_0xe032('0x8')][_0x53c8b2['linkedid']]&&this[_0xe032('0x8')][_0x53c8b2[_0xe032('0x42')]]['attended']){logger[_0xe032('0x23')]('[%s][HANGUPATTENDEDTRANSFER:LINKEDID]',_0x53c8b2[_0xe032('0x42')]);this[_0xe032('0x41')](_0x53c8b2[_0xe032('0x42')]);}}catch(_0x414243){logger[_0xe032('0x33')]('[ACW][syncHangup]\x20%s',_0x414243[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x13')]=function(_0x21a32f){try{if(!_[_0xe032('0x46')](this[_0xe032('0x8')][_0x21a32f[_0xe032('0x47')]])){this['startAcw'](_0x21a32f[_0xe032('0x47')]);if(this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]]){this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]][_0xe032('0x25')]=!![];this[_0xe032('0x8')][_0x21a32f[_0xe032('0x49')]]=this[_0xe032('0x8')][_0x21a32f['secondtransfereruniqueid']];delete this[_0xe032('0x8')][_0x21a32f[_0xe032('0x48')]];}}else if(!_[_0xe032('0x46')](this['channels'][_0x21a32f[_0xe032('0x49')]])){this[_0xe032('0x41')](_0x21a32f['transfertargetuniqueid']);if(this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]]){this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]][_0xe032('0x25')]=!![];this[_0xe032('0x8')][_0x21a32f[_0xe032('0x47')]]=this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]];delete this[_0xe032('0x8')][_0x21a32f[_0xe032('0x4a')]];}}}catch(_0x505986){logger[_0xe032('0x33')](_0xe032('0x4b'),_0x505986[_0xe032('0x36')]);}};Acw[_0xe032('0x1a')][_0xe032('0x4c')]=function(_0x4d305b){try{if(this[_0xe032('0x8')][_0x4d305b['transfereruniqueid']]){logger[_0xe032('0x23')](_0xe032('0x4d'),JSON[_0xe032('0x4e')](_0x4d305b[_0xe032('0x4f')]));this[_0xe032('0x41')](_0x4d305b[_0xe032('0x4f')]);}else if(this[_0xe032('0x8')][_0x4d305b[_0xe032('0x50')]]){logger[_0xe032('0x23')]('[%s][BLINDTRANSFER:LINKEDID]',JSON['stringify'](_0x4d305b['transfererlinkedid']));this[_0xe032('0x41')](_0x4d305b[_0xe032('0x50')]);}}catch(_0x889c28){logger[_0xe032('0x33')](_0xe032('0x51'),_0x889c28[_0xe032('0x36')]);}};Acw['prototype'][_0xe032('0x11')]=function(_0x1d66c3){try{if(this[_0xe032('0x5')][_0x1d66c3['queue']]&&this[_0xe032('0x5')][_0x1d66c3['queue']][_0xe032('0x52')]===_0xe032('0x53')){if(this['agents'][_0x1d66c3['interface']]){logger['info'](_0xe032('0x54'),_0x1d66c3['uniqueid'],_0x1d66c3['interface'],_0x1d66c3[_0xe032('0x1c')]);return RpcUser[_0xe032('0x27')](this[_0xe032('0x6')][_0x1d66c3['interface']],_0xe032('0x55'),_0x1d66c3['uniqueid']);}}}catch(_0x2cf342){logger[_0xe032('0x33')](_0xe032('0x56'),_0x2cf342[_0xe032('0x36')]);}};module[_0xe032('0x57')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index f45281b..2715844 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 _0xdf9f=['../../config/logger','ami','../../config/environment','asterisk','port','username','password','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','actionSipPeerStatus','actionQueueSummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','actionCoreShowChannels','log','exports','moment','util'];(function(_0x487f78,_0x4cb9db){var _0x1283ac=function(_0x5dc557){while(--_0x5dc557){_0x487f78['push'](_0x487f78['shift']());}};_0x1283ac(++_0x4cb9db);}(_0xdf9f,0xd6));var _0xfdf9=function(_0x4b2cfb,_0x5293c3){_0x4b2cfb=_0x4b2cfb-0x0;var _0x466f9f=_0xdf9f[_0x4b2cfb];return _0x466f9f;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0xfdf9('0x0'));var util=require(_0xfdf9('0x1'));var _=require('lodash');var logger=require(_0xfdf9('0x2'))(_0xfdf9('0x3'));var config=require(_0xfdf9('0x4'));var ami=new Manager(config[_0xfdf9('0x5')][_0xfdf9('0x6')],config[_0xfdf9('0x5')]['ip'],config[_0xfdf9('0x5')][_0xfdf9('0x7')],config[_0xfdf9('0x5')][_0xfdf9('0x8')],!![]);ami[_0xfdf9('0x9')]();ami[_0xfdf9('0xa')]=BPromise['promisify'](ami[_0xfdf9('0xb')]);function error(_0x2e6041){logger[_0xfdf9('0xc')](util[_0xfdf9('0xd')](_0xfdf9('0xe'),config[_0xfdf9('0x5')]['username'],config['asterisk']['ip'],config[_0xfdf9('0x5')][_0xfdf9('0x6')],util[_0xfdf9('0xf')](_0x2e6041,![],null)));}function close(){logger[_0xfdf9('0xc')](util[_0xfdf9('0xd')](_0xfdf9('0x10'),config[_0xfdf9('0x5')]['username'],config['asterisk']['ip'],config[_0xfdf9('0x5')][_0xfdf9('0x6')]));}ami[_0xfdf9('0x11')]=function(){return function(){return ami[_0xfdf9('0xa')]({'action':_0xfdf9('0x12')});};};ami[_0xfdf9('0x13')]=function(){return function(){return ami[_0xfdf9('0xa')]({'action':'devicestatelist'});};};ami[_0xfdf9('0x14')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0xfdf9('0x15')]=function(){return function(){return ami[_0xfdf9('0xa')]({'action':'queuesummary'});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xfdf9('0xa')]({'action':_0xfdf9('0x16')});};};function connect(_0x3830dc){logger[_0xfdf9('0x17')](util[_0xfdf9('0xd')](_0xfdf9('0x18'),config[_0xfdf9('0x5')][_0xfdf9('0x7')],config[_0xfdf9('0x5')]['ip'],config['asterisk'][_0xfdf9('0x6')]));ami[_0xfdf9('0x19')](_0xfdf9('0xc'),error);ami[_0xfdf9('0x19')](_0xfdf9('0x1a'),close);}ami['on'](_0xfdf9('0x1b'),connect);ami['on'](_0xfdf9('0x1c'),function(_0x269b4c){logger['info'](util[_0xfdf9('0xd')](_0xfdf9('0x1d'),config['asterisk'][_0xfdf9('0x7')],config['asterisk']['ip'],config['asterisk']['port'],util['inspect'](_0x269b4c,![],null)));});ami['on'](_0xfdf9('0x1e'),function(_0x1b3c9d){logger[_0xfdf9('0x17')](util[_0xfdf9('0xd')](_0xfdf9('0x1f'),config[_0xfdf9('0x5')]['username'],config['asterisk']['ip'],config[_0xfdf9('0x5')]['port']));return BPromise['resolve']()[_0xfdf9('0x20')](ami[_0xfdf9('0x11')]())['then'](ami[_0xfdf9('0x13')]())[_0xfdf9('0x20')](ami[_0xfdf9('0x14')]())[_0xfdf9('0x20')](ami['actionQueueSummary']())[_0xfdf9('0x20')](ami[_0xfdf9('0x21')]())['catch'](function(_0x1ee184){console[_0xfdf9('0x22')](_0x1ee184);});});ami['once'](_0xfdf9('0xc'),error);ami[_0xfdf9('0x19')](_0xfdf9('0x1a'),close);module[_0xfdf9('0x23')]=ami; \ No newline at end of file +var _0x70c7=['moment','util','../../config/logger','ami','../../config/environment','asterisk','username','password','promisify','error','format','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','coreshowchannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','port','once','connect','shutdown','info','inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then','log','close','asterisk-manager','bluebird'];(function(_0x519fa1,_0x5e439d){var _0x4393c5=function(_0x3b219b){while(--_0x3b219b){_0x519fa1['push'](_0x519fa1['shift']());}};_0x4393c5(++_0x5e439d);}(_0x70c7,0x1ab));var _0x770c=function(_0x2273e0,_0x568a61){_0x2273e0=_0x2273e0-0x0;var _0x456e57=_0x70c7[_0x2273e0];return _0x456e57;};'use strict';var Manager=require(_0x770c('0x0'));var BPromise=require(_0x770c('0x1'));var moment=require(_0x770c('0x2'));var util=require(_0x770c('0x3'));var _=require('lodash');var logger=require(_0x770c('0x4'))(_0x770c('0x5'));var config=require(_0x770c('0x6'));var ami=new Manager(config[_0x770c('0x7')]['port'],config[_0x770c('0x7')]['ip'],config['asterisk'][_0x770c('0x8')],config[_0x770c('0x7')][_0x770c('0x9')],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x770c('0xa')](ami['action']);function error(_0x50eb20){logger[_0x770c('0xb')](util[_0x770c('0xc')]('Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s',config[_0x770c('0x7')]['username'],config[_0x770c('0x7')]['ip'],config[_0x770c('0x7')]['port'],util['inspect'](_0x50eb20,![],null)));}function close(){logger[_0x770c('0xb')](util[_0x770c('0xc')](_0x770c('0xd'),config['asterisk']['username'],config[_0x770c('0x7')]['ip'],config['asterisk']['port']));}ami[_0x770c('0xe')]=function(){return function(){return ami[_0x770c('0xf')]({'action':'sipshowregistry'});};};ami['actionDeviceStateList']=function(){return function(){return ami[_0x770c('0xf')]({'action':'devicestatelist'});};};ami[_0x770c('0x10')]=function(){return function(){return ami[_0x770c('0xf')]({'action':'sippeerstatus'});};};ami[_0x770c('0x11')]=function(){return function(){return ami[_0x770c('0xf')]({'action':'queuesummary'});};};ami[_0x770c('0x12')]=function(){return function(){return ami['Action']({'action':_0x770c('0x13')});};};function connect(_0x2f42bf){logger['info'](util[_0x770c('0xc')](_0x770c('0x14'),config[_0x770c('0x7')][_0x770c('0x8')],config['asterisk']['ip'],config['asterisk'][_0x770c('0x15')]));ami[_0x770c('0x16')]('error',error);ami[_0x770c('0x16')]('close',close);}ami['on'](_0x770c('0x17'),connect);ami['on'](_0x770c('0x18'),function(_0x3f65e6){logger[_0x770c('0x19')](util[_0x770c('0xc')]('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x770c('0x7')][_0x770c('0x8')],config[_0x770c('0x7')]['ip'],config[_0x770c('0x7')][_0x770c('0x15')],util[_0x770c('0x1a')](_0x3f65e6,![],null)));});ami['on'](_0x770c('0x1b'),function(_0x56b18f){logger[_0x770c('0x19')](util['format'](_0x770c('0x1c'),config[_0x770c('0x7')][_0x770c('0x8')],config[_0x770c('0x7')]['ip'],config['asterisk'][_0x770c('0x15')]));return BPromise[_0x770c('0x1d')]()[_0x770c('0x1e')](ami['actionSipShowRegistry']())[_0x770c('0x1e')](ami['actionDeviceStateList']())[_0x770c('0x1e')](ami[_0x770c('0x10')]())[_0x770c('0x1e')](ami[_0x770c('0x11')]())[_0x770c('0x1e')](ami[_0x770c('0x12')]())['catch'](function(_0x2c28b8){console[_0x770c('0x1f')](_0x2c28b8);});});ami[_0x770c('0x16')]('error',error);ami[_0x770c('0x16')](_0x770c('0x20'),close);module['exports']=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index d0656bf..73329bc 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 _0xa612=['jayson/promise','bluebird','../../config/logger','ami','client','http','request','debug','rpc','error','message','result','catch','memberReport','exports'];(function(_0x9e23,_0x1aabe5){var _0x152578=function(_0xc312ca){while(--_0xc312ca){_0x9e23['push'](_0x9e23['shift']());}};_0x152578(++_0x1aabe5);}(_0xa612,0x1ef));var _0x2a61=function(_0x5e7fe2,_0x571808){_0x5e7fe2=_0x5e7fe2-0x0;var _0xdaa56a=_0xa612[_0x5e7fe2];return _0xdaa56a;};'use strict';var jayson=require(_0x2a61('0x0'));var BPromise=require(_0x2a61('0x1'));var logger=require(_0x2a61('0x2'))(_0x2a61('0x3'));var client=jayson[_0x2a61('0x4')][_0x2a61('0x5')]({'port':0x2329});client['Request']=function(_0x161c58,_0x2861d3){return new BPromise(function(_0x2bfae7,_0x12b6ee){return client[_0x2a61('0x6')](_0x161c58,_0x2861d3)['then'](function(_0x35eeca){logger[_0x2a61('0x7')](_0x2a61('0x8'),'memberReport',_0x161c58,_0x2861d3,_0x35eeca);if(_0x35eeca['error']){logger[_0x2a61('0x9')]('rpc','memberReport',_0x161c58,_0x35eeca['error']['message'],_0x2861d3);return _0x12b6ee(_0x35eeca[_0x2a61('0x9')][_0x2a61('0xa')]);}else{return _0x2bfae7(_0x35eeca[_0x2a61('0xb')]);}})[_0x2a61('0xc')](function(_0x658bb4){logger[_0x2a61('0x9')](_0x2a61('0x8'),_0x2a61('0xd'),_0x161c58,_0x658bb4,_0x2861d3);return _0x12b6ee(_0x658bb4);});});};module[_0x2a61('0xe')]=client; \ No newline at end of file +var _0x7549=['request','then','rpc','memberReport','error','message','exports','bluebird','../../config/logger','ami','client','http','Request'];(function(_0x19a72c,_0x2229cb){var _0x3c6199=function(_0x4293e9){while(--_0x4293e9){_0x19a72c['push'](_0x19a72c['shift']());}};_0x3c6199(++_0x2229cb);}(_0x7549,0xd7));var _0x9754=function(_0x351808,_0x2bba1a){_0x351808=_0x351808-0x0;var _0x1c7a06=_0x7549[_0x351808];return _0x1c7a06;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x9754('0x0'));var logger=require(_0x9754('0x1'))(_0x9754('0x2'));var client=jayson[_0x9754('0x3')][_0x9754('0x4')]({'port':0x2329});client[_0x9754('0x5')]=function(_0xb1e66,_0xf5b290){return new BPromise(function(_0x4160e6,_0x59526f){return client[_0x9754('0x6')](_0xb1e66,_0xf5b290)[_0x9754('0x7')](function(_0x5f4f10){logger['debug'](_0x9754('0x8'),_0x9754('0x9'),_0xb1e66,_0xf5b290,_0x5f4f10);if(_0x5f4f10['error']){logger['error'](_0x9754('0x8'),_0x9754('0x9'),_0xb1e66,_0x5f4f10[_0x9754('0xa')][_0x9754('0xb')],_0xf5b290);return _0x59526f(_0x5f4f10[_0x9754('0xa')][_0x9754('0xb')]);}else{return _0x4160e6(_0x5f4f10['result']);}})['catch'](function(_0x46a64b){logger['error'](_0x9754('0x8'),'memberReport',_0xb1e66,_0x46a64b,_0xf5b290);return _0x59526f(_0x46a64b);});});};module[_0x9754('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/action.js b/server/services/ami/dialer/action.js index 9ca3af8..832dc51 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 _0xe126=['active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','ContactFirstName','starttime','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','prototype','getCaller','format','\x22%s\x22\x20<%s>','substring','getQueue','exports','util','lodash','isNil','voiceQueue','uniqueid','name','Contact','phone','firstName','number','queue'];(function(_0x12eab4,_0x50003d){var _0x47ab6c=function(_0x59c8da){while(--_0x59c8da){_0x12eab4['push'](_0x12eab4['shift']());}};_0x47ab6c(++_0x50003d);}(_0xe126,0xeb));var _0x6e12=function(_0xe73080,_0x24c56d){_0xe73080=_0xe73080-0x0;var _0x12cbc4=_0xe126[_0xe73080];return _0x12cbc4;};'use strict';var util=require(_0x6e12('0x0'));var _=require(_0x6e12('0x1'));var moment=require('moment');function checkNameSurname(_0x2f58a1,_0x397a9d,_0x206eb5){var _0x3078b5='';if(!_[_0x6e12('0x2')](_0x397a9d)&&'string'===typeof _0x397a9d){_0x3078b5+=_0x397a9d;}if(!_[_0x6e12('0x2')](_0x206eb5)&&'string'===typeof _0x206eb5){_0x3078b5+='\x20'+_0x206eb5;}if(_0x3078b5!==''){return _0x3078b5;}return _0x2f58a1;}function Action(_0x43c79e,_0xeba6b3,_0x4e8c75){this[_0x6e12('0x3')]=_0x43c79e;this[_0x6e12('0x4')]=_0x4e8c75||undefined;this[_0x6e12('0x5')]=checkNameSurname(_0xeba6b3[_0x6e12('0x6')][_0x6e12('0x7')],_0xeba6b3[_0x6e12('0x6')][_0x6e12('0x8')],_0xeba6b3['Contact']['lastName']);this[_0x6e12('0x9')]=_0xeba6b3[_0x6e12('0x6')]['phone'];this[_0x6e12('0xa')]=_0x43c79e['name'];this['active']=_0xeba6b3[_0x6e12('0xb')]||![];this[_0x6e12('0xc')]=_0x43c79e['type'];this[_0x6e12('0xd')]=_0x43c79e['dialQueueTimeout']||0x3;this[_0x6e12('0xe')]=_0xeba6b3[_0x6e12('0xe')];this[_0x6e12('0xf')]=_0xeba6b3[_0x6e12('0xf')];this['countcongestionretry']=_0xeba6b3[_0x6e12('0x10')];this['countnoanswerretry']=_0xeba6b3[_0x6e12('0x11')];this[_0x6e12('0x12')]=_0xeba6b3[_0x6e12('0x12')];this[_0x6e12('0x13')]=_0xeba6b3['countdropretry'];this[_0x6e12('0x14')]=_0xeba6b3[_0x6e12('0x14')];this[_0x6e12('0x15')]=_0xeba6b3['countmachineretry'];this['countagentrejectretry']=_0xeba6b3['countagentrejectretry'];this[_0x6e12('0x16')]=_0xeba6b3[_0x6e12('0x16')];this[_0x6e12('0x17')]=_0xeba6b3[_0x6e12('0x17')];this[_0x6e12('0x18')]=_0xeba6b3[_0x6e12('0x18')];this[_0x6e12('0x19')]=_0xeba6b3['VoiceQueueId'];this[_0x6e12('0x1a')]=_0xeba6b3['CampaignId'];this['idHopper']=_0xeba6b3['id'];this[_0x6e12('0x1b')]=_0xeba6b3[_0x6e12('0x6')][_0x6e12('0x8')]||'';this[_0x6e12('0x1c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x6e12('0x1d')]=_0xeba6b3['callback'];this['callbackuniqueid']=_0xeba6b3[_0x6e12('0x1e')];this[_0x6e12('0x1f')]=_0xeba6b3[_0x6e12('0x1f')];this[_0x6e12('0x20')]=_0xeba6b3['recallme'];this[_0x6e12('0x21')]='';this['originatecalleridname']='';}Action[_0x6e12('0x22')][_0x6e12('0x23')]=function(){return util[_0x6e12('0x24')](_0x6e12('0x25'),this[_0x6e12('0x5')],this[_0x6e12('0x3')]['dialCutDigit']>0x0?this[_0x6e12('0x9')][_0x6e12('0x26')](this['voiceQueue']['dialCutDigit']):this['number']);};Action[_0x6e12('0x22')][_0x6e12('0x27')]=function(){return this[_0x6e12('0xa')];};module[_0x6e12('0x28')]=Action; \ No newline at end of file +var _0x9a6a=['lastName','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','idHopper','ContactFirstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','exports','lodash','isNil','string','voiceQueue','uniqueid','name','phone','Contact','firstName'];(function(_0x1ce2bb,_0xf151b){var _0x40dc49=function(_0x143c46){while(--_0x143c46){_0x1ce2bb['push'](_0x1ce2bb['shift']());}};_0x40dc49(++_0xf151b);}(_0x9a6a,0xce));var _0xa9a6=function(_0x577935,_0x56535d){_0x577935=_0x577935-0x0;var _0x455214=_0x9a6a[_0x577935];return _0x455214;};'use strict';var util=require('util');var _=require(_0xa9a6('0x0'));var moment=require('moment');function checkNameSurname(_0x2835b7,_0xa4a3ca,_0x4d1134){var _0x2fb58b='';if(!_[_0xa9a6('0x1')](_0xa4a3ca)&&_0xa9a6('0x2')===typeof _0xa4a3ca){_0x2fb58b+=_0xa4a3ca;}if(!_[_0xa9a6('0x1')](_0x4d1134)&&_0xa9a6('0x2')===typeof _0x4d1134){_0x2fb58b+='\x20'+_0x4d1134;}if(_0x2fb58b!==''){return _0x2fb58b;}return _0x2835b7;}function Action(_0x560bce,_0x58a70c,_0x4678ed){this[_0xa9a6('0x3')]=_0x560bce;this[_0xa9a6('0x4')]=_0x4678ed||undefined;this[_0xa9a6('0x5')]=checkNameSurname(_0x58a70c['Contact'][_0xa9a6('0x6')],_0x58a70c[_0xa9a6('0x7')][_0xa9a6('0x8')],_0x58a70c[_0xa9a6('0x7')][_0xa9a6('0x9')]);this[_0xa9a6('0xa')]=_0x58a70c[_0xa9a6('0x7')][_0xa9a6('0x6')];this[_0xa9a6('0xb')]=_0x560bce[_0xa9a6('0x5')];this[_0xa9a6('0xc')]=_0x58a70c[_0xa9a6('0xc')]||![];this[_0xa9a6('0xd')]=_0x560bce[_0xa9a6('0xd')];this[_0xa9a6('0xe')]=_0x560bce[_0xa9a6('0xe')]||0x3;this[_0xa9a6('0xf')]=_0x58a70c[_0xa9a6('0xf')];this['countbusyretry']=_0x58a70c[_0xa9a6('0x10')];this[_0xa9a6('0x11')]=_0x58a70c[_0xa9a6('0x11')];this[_0xa9a6('0x12')]=_0x58a70c['countnoanswerretry'];this['countnosuchnumberretry']=_0x58a70c[_0xa9a6('0x13')];this['countdropretry']=_0x58a70c[_0xa9a6('0x14')];this[_0xa9a6('0x15')]=_0x58a70c[_0xa9a6('0x15')];this[_0xa9a6('0x16')]=_0x58a70c[_0xa9a6('0x16')];this[_0xa9a6('0x17')]=_0x58a70c[_0xa9a6('0x17')];this[_0xa9a6('0x18')]=_0x58a70c[_0xa9a6('0x18')];this[_0xa9a6('0x19')]=_0x58a70c[_0xa9a6('0x19')];this[_0xa9a6('0x1a')]=_0x58a70c[_0xa9a6('0x1a')];this[_0xa9a6('0x1b')]=_0x58a70c[_0xa9a6('0x1b')];this['CampaignId']=_0x58a70c['CampaignId'];this[_0xa9a6('0x1c')]=_0x58a70c['id'];this[_0xa9a6('0x1d')]=_0x58a70c[_0xa9a6('0x7')][_0xa9a6('0x8')]||'';this['starttime']=moment()[_0xa9a6('0x1e')](_0xa9a6('0x1f'));this[_0xa9a6('0x20')]=_0x58a70c[_0xa9a6('0x20')];this[_0xa9a6('0x21')]=_0x58a70c[_0xa9a6('0x21')];this['callbackat']=_0x58a70c['callbackat'];this[_0xa9a6('0x22')]=_0x58a70c['recallme'];this[_0xa9a6('0x23')]='';this[_0xa9a6('0x24')]='';}Action[_0xa9a6('0x25')][_0xa9a6('0x26')]=function(){return util[_0xa9a6('0x1e')](_0xa9a6('0x27'),this[_0xa9a6('0x5')],this[_0xa9a6('0x3')][_0xa9a6('0x28')]>0x0?this[_0xa9a6('0xa')][_0xa9a6('0x29')](this[_0xa9a6('0x3')]['dialCutDigit']):this['number']);};Action['prototype']['getQueue']=function(){return this[_0xa9a6('0xb')];};module[_0xa9a6('0x2a')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index 3da9c80..0748800 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 _0xe380=['queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','name','calleridnum','number','starttime','responsetime','answertime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','holdtime','talktime','membername','reason','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','state','Answer','scheduledat','type','campaigntype','outbound'];(function(_0x3d962f,_0x518679){var _0x11c5cf=function(_0x13d0ca){while(--_0x13d0ca){_0x3d962f['push'](_0x3d962f['shift']());}};_0x11c5cf(++_0x518679);}(_0xe380,0x1ee));var _0x0e38=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xe380[_0x50a0c2];return _0x5ebadd;};'use strict';var util=require(_0x0e38('0x0'));var _=require(_0x0e38('0x1'));var moment=require(_0x0e38('0x2'));function getSeconds(_0x226f19,_0x54196c){var _0xa0766b=moment(_0x226f19)['milliseconds'](0x0);var _0x2f1328=moment(_0x54196c)[_0x0e38('0x3')](0x0);return _0xa0766b[_0x0e38('0x4')](_0x2f1328,_0x0e38('0x5'));}function AgentComplete(_0x44f0aa,_0x102217){this[_0x0e38('0x6')]=0x4;this['statedesc']=_0x0e38('0x7');this[_0x0e38('0x8')]=_0x44f0aa['scheduledat'];this[_0x0e38('0x9')]=_0x44f0aa[_0x0e38('0x9')];this[_0x0e38('0xa')]=_0x44f0aa['type']===_0x0e38('0xb')?_0x0e38('0xc'):_0x44f0aa[_0x0e38('0x9')];this[_0x0e38('0xd')]=_0x44f0aa[_0x0e38('0xd')];this[_0x0e38('0xe')]=_0x44f0aa[_0x0e38('0xe')];this['countnoanswerretry']=_0x44f0aa[_0x0e38('0xf')];this[_0x0e38('0x10')]=_0x44f0aa[_0x0e38('0xd')]+_0x44f0aa[_0x0e38('0xe')]+_0x44f0aa['countnoanswerretry']+_0x44f0aa[_0x0e38('0x11')]+_0x44f0aa[_0x0e38('0x12')]+_0x44f0aa[_0x0e38('0x13')]+_0x44f0aa[_0x0e38('0x14')]+_0x44f0aa[_0x0e38('0x15')];this['countnosuchnumberretry']=_0x44f0aa[_0x0e38('0x11')];this[_0x0e38('0x12')]=_0x44f0aa[_0x0e38('0x12')];this[_0x0e38('0x13')]=_0x44f0aa[_0x0e38('0x13')];this['countmachineretry']=_0x44f0aa[_0x0e38('0x14')];this['countagentrejectretry']=_0x44f0aa[_0x0e38('0x15')];this[_0x0e38('0x16')]=_0x102217[_0x0e38('0x16')];this['calleridname']=_0x44f0aa[_0x0e38('0x17')];this[_0x0e38('0x18')]=_0x44f0aa[_0x0e38('0x19')];this[_0x0e38('0x1a')]=_0x44f0aa[_0x0e38('0x1a')];this[_0x0e38('0x1b')]=_0x44f0aa[_0x0e38('0x1b')];this['answertime']=_0x44f0aa[_0x0e38('0x1c')];this[_0x0e38('0x1d')]=moment()[_0x0e38('0x1e')](_0x0e38('0x1f'));this['ringtime']=getSeconds(_0x44f0aa[_0x0e38('0x1b')],_0x44f0aa[_0x0e38('0x1a')]);this[_0x0e38('0x20')]=getSeconds(_0x44f0aa[_0x0e38('0x1c')],_0x44f0aa[_0x0e38('0x1b')]);this[_0x0e38('0x21')]=getSeconds(this[_0x0e38('0x1d')],_0x44f0aa[_0x0e38('0x1c')]);this['queue']=_0x102217[_0x0e38('0xc')];this[_0x0e38('0x22')]=_0x102217[_0x0e38('0x22')];this['reason']=_0x102217[_0x0e38('0x23')];this['callback']=_0x44f0aa['callback'];this[_0x0e38('0x24')]=_0x44f0aa[_0x0e38('0x24')];this[_0x0e38('0x25')]=_0x44f0aa[_0x0e38('0x25')];this[_0x0e38('0x26')]=_0x44f0aa[_0x0e38('0x26')];this[_0x0e38('0x27')]=_0x44f0aa[_0x0e38('0x27')];this[_0x0e38('0x28')]=_0x44f0aa[_0x0e38('0x28')];this[_0x0e38('0x29')]=_0x44f0aa[_0x0e38('0x29')];this[_0x0e38('0x2a')]=_0x44f0aa[_0x0e38('0x2a')];this[_0x0e38('0x2b')]=_0x44f0aa['CampaignId'];this[_0x0e38('0x2c')]=_0x44f0aa[_0x0e38('0x2c')]||'';this[_0x0e38('0x2d')]=_0x44f0aa[_0x0e38('0x2d')]||'';}module['exports']=AgentComplete; \ No newline at end of file +var _0x923a=['countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','answertime','endtime','holdtime','talktime','membername','reason','callback','callbackuniqueid','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','lodash','moment','milliseconds','diff','seconds','statedesc','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry'];(function(_0x55d420,_0x103084){var _0x26699e=function(_0x13666b){while(--_0x13666b){_0x55d420['push'](_0x55d420['shift']());}};_0x26699e(++_0x103084);}(_0x923a,0xbc));var _0xa923=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x923a[_0x21a9d9];return _0x46adce;};'use strict';var util=require('util');var _=require(_0xa923('0x0'));var moment=require(_0xa923('0x1'));function getSeconds(_0x2fff58,_0x2427ef){var _0x34b69b=moment(_0x2fff58)[_0xa923('0x2')](0x0);var _0x2dbac4=moment(_0x2427ef)[_0xa923('0x2')](0x0);return _0x34b69b[_0xa923('0x3')](_0x2dbac4,_0xa923('0x4'));}function AgentComplete(_0x916cd,_0x4903e2){this['state']=0x4;this[_0xa923('0x5')]='Answer';this[_0xa923('0x6')]=_0x916cd['scheduledat'];this[_0xa923('0x7')]=_0x916cd[_0xa923('0x7')];this[_0xa923('0x8')]=_0x916cd[_0xa923('0x7')]===_0xa923('0x9')?'queue':_0x916cd[_0xa923('0x7')];this[_0xa923('0xa')]=_0x916cd[_0xa923('0xa')];this[_0xa923('0xb')]=_0x916cd['countcongestionretry'];this['countnoanswerretry']=_0x916cd[_0xa923('0xc')];this[_0xa923('0xd')]=_0x916cd['countbusyretry']+_0x916cd[_0xa923('0xb')]+_0x916cd['countnoanswerretry']+_0x916cd['countnosuchnumberretry']+_0x916cd[_0xa923('0xe')]+_0x916cd[_0xa923('0xf')]+_0x916cd[_0xa923('0x10')]+_0x916cd[_0xa923('0x11')];this[_0xa923('0x12')]=_0x916cd[_0xa923('0x12')];this['countdropretry']=_0x916cd[_0xa923('0xe')];this[_0xa923('0xf')]=_0x916cd[_0xa923('0xf')];this[_0xa923('0x10')]=_0x916cd[_0xa923('0x10')];this['countagentrejectretry']=_0x916cd['countagentrejectretry'];this['uniqueid']=_0x4903e2[_0xa923('0x13')];this[_0xa923('0x14')]=_0x916cd[_0xa923('0x15')];this[_0xa923('0x16')]=_0x916cd[_0xa923('0x17')];this['starttime']=_0x916cd[_0xa923('0x18')];this['responsetime']=_0x916cd[_0xa923('0x19')];this['answertime']=_0x916cd[_0xa923('0x1a')];this[_0xa923('0x1b')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this['ringtime']=getSeconds(_0x916cd['responsetime'],_0x916cd[_0xa923('0x18')]);this[_0xa923('0x1c')]=getSeconds(_0x916cd[_0xa923('0x1a')],_0x916cd[_0xa923('0x19')]);this[_0xa923('0x1d')]=getSeconds(this['endtime'],_0x916cd[_0xa923('0x1a')]);this['queue']=_0x4903e2['queue'];this[_0xa923('0x1e')]=_0x4903e2['membername'];this['reason']=_0x4903e2[_0xa923('0x1f')];this[_0xa923('0x20')]=_0x916cd[_0xa923('0x20')];this['callbackuniqueid']=_0x916cd[_0xa923('0x21')];this['callbackat']=_0x916cd['callbackat'];this[_0xa923('0x22')]=_0x916cd['recallme'];this[_0xa923('0x23')]=_0x916cd[_0xa923('0x23')];this['ListId']=_0x916cd['ListId'];this[_0xa923('0x24')]=_0x916cd['UserId'];this[_0xa923('0x25')]=_0x916cd[_0xa923('0x25')];this[_0xa923('0x26')]=_0x916cd[_0xa923('0x26')];this[_0xa923('0x27')]=_0x916cd[_0xa923('0x27')]||'';this[_0xa923('0x28')]=_0x916cd[_0xa923('0x28')]||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 9554bd9..079337a 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 _0x9617=['countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','calleridname','calleridnum','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x9617,0x175));var _0x7961=function(_0x4996b1,_0xba7b8d){_0x4996b1=_0x4996b1-0x0;var _0x298372=_0x9617[_0x4996b1];return _0x298372;};'use strict';var util=require(_0x7961('0x0'));var _=require(_0x7961('0x1'));var moment=require(_0x7961('0x2'));function getSeconds(_0x3ca26d,_0x57bfd6){var _0xaa22fb=moment(_0x3ca26d)[_0x7961('0x3')](0x0);var _0x29866c=moment(_0x57bfd6)['milliseconds'](0x0);return _0xaa22fb[_0x7961('0x4')](_0x29866c,_0x7961('0x5'));}function Final(_0x5a83f8){this['uniqueid']=_0x5a83f8[_0x7961('0x6')];this[_0x7961('0x7')]=_0x5a83f8[_0x7961('0x7')];this[_0x7961('0x8')]=_0x5a83f8[_0x7961('0x8')];this[_0x7961('0x9')]=_0x5a83f8[_0x7961('0x8')]===_0x7961('0xa')?_0x7961('0xb'):_0x5a83f8[_0x7961('0x8')];this['countbusyretry']=_0x5a83f8[_0x7961('0xc')];this['countcongestionretry']=_0x5a83f8[_0x7961('0xd')];this[_0x7961('0xe')]=_0x5a83f8[_0x7961('0xe')];this[_0x7961('0xf')]=_0x5a83f8['countbusyretry']+_0x5a83f8[_0x7961('0xd')]+_0x5a83f8[_0x7961('0xe')]+_0x5a83f8[_0x7961('0x10')]+_0x5a83f8['countdropretry']+_0x5a83f8[_0x7961('0x11')]+_0x5a83f8[_0x7961('0x12')]+_0x5a83f8[_0x7961('0x13')];this[_0x7961('0x10')]=_0x5a83f8['countnosuchnumberretry'];this[_0x7961('0x14')]=_0x5a83f8[_0x7961('0x14')];this[_0x7961('0x11')]=_0x5a83f8['countabandonedretry'];this[_0x7961('0x12')]=_0x5a83f8[_0x7961('0x12')];this[_0x7961('0x13')]=_0x5a83f8[_0x7961('0x13')];this[_0x7961('0xb')]=_0x5a83f8[_0x7961('0xb')];this[_0x7961('0x15')]=_0x5a83f8['calleridname'];this[_0x7961('0x16')]=_0x5a83f8[_0x7961('0x16')];this['starttime']=_0x5a83f8['starttime'];this[_0x7961('0x17')]=_0x5a83f8['responsetime'];this[_0x7961('0x18')]=_0x5a83f8[_0x7961('0x17')];this[_0x7961('0x19')]=_0x5a83f8['ringtime']||0x0;this[_0x7961('0x1a')]=_0x5a83f8[_0x7961('0x1a')]||0x0;this[_0x7961('0x1b')]=_0x5a83f8[_0x7961('0x1b')]||0x0;this['callback']=_0x5a83f8[_0x7961('0x1c')];this[_0x7961('0x1d')]=_0x5a83f8[_0x7961('0x1d')];this[_0x7961('0x1e')]=_0x5a83f8[_0x7961('0x1e')];this['recallme']=_0x5a83f8[_0x7961('0x1f')];this[_0x7961('0x20')]=_0x5a83f8[_0x7961('0x20')];this[_0x7961('0x21')]=_0x5a83f8[_0x7961('0x21')];this[_0x7961('0x22')]=_0x5a83f8['UserId'];this[_0x7961('0x23')]=_0x5a83f8[_0x7961('0x23')];this[_0x7961('0x24')]=_0x5a83f8[_0x7961('0x24')];this[_0x7961('0x25')]=_0x5a83f8[_0x7961('0x25')]||'';this['originatecalleridname']=_0x5a83f8['originatecalleridname']||'';}module[_0x7961('0x26')]=Final; \ No newline at end of file +var _0x858b=['callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','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','callback','callbackuniqueid'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0x858b,0x1de));var _0xb858=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x858b[_0x179b53];return _0x38a146;};'use strict';var util=require(_0xb858('0x0'));var _=require(_0xb858('0x1'));var moment=require(_0xb858('0x2'));function getSeconds(_0x3630e5,_0x30f798){var _0x156557=moment(_0x3630e5)[_0xb858('0x3')](0x0);var _0x356400=moment(_0x30f798)[_0xb858('0x3')](0x0);return _0x156557['diff'](_0x356400,_0xb858('0x4'));}function Final(_0x7a586a){this['uniqueid']=_0x7a586a[_0xb858('0x5')];this[_0xb858('0x6')]=_0x7a586a[_0xb858('0x6')];this[_0xb858('0x7')]=_0x7a586a[_0xb858('0x7')];this[_0xb858('0x8')]=_0x7a586a[_0xb858('0x7')]===_0xb858('0x9')?_0xb858('0xa'):_0x7a586a['type'];this[_0xb858('0xb')]=_0x7a586a[_0xb858('0xb')];this[_0xb858('0xc')]=_0x7a586a[_0xb858('0xc')];this[_0xb858('0xd')]=_0x7a586a[_0xb858('0xd')];this[_0xb858('0xe')]=_0x7a586a[_0xb858('0xb')]+_0x7a586a['countcongestionretry']+_0x7a586a[_0xb858('0xd')]+_0x7a586a[_0xb858('0xf')]+_0x7a586a[_0xb858('0x10')]+_0x7a586a[_0xb858('0x11')]+_0x7a586a[_0xb858('0x12')]+_0x7a586a[_0xb858('0x13')];this[_0xb858('0xf')]=_0x7a586a[_0xb858('0xf')];this['countdropretry']=_0x7a586a[_0xb858('0x10')];this[_0xb858('0x11')]=_0x7a586a[_0xb858('0x11')];this[_0xb858('0x12')]=_0x7a586a[_0xb858('0x12')];this[_0xb858('0x13')]=_0x7a586a[_0xb858('0x13')];this[_0xb858('0xa')]=_0x7a586a[_0xb858('0xa')];this[_0xb858('0x14')]=_0x7a586a['calleridname'];this[_0xb858('0x15')]=_0x7a586a[_0xb858('0x15')];this[_0xb858('0x16')]=_0x7a586a[_0xb858('0x16')];this[_0xb858('0x17')]=_0x7a586a[_0xb858('0x17')];this[_0xb858('0x18')]=_0x7a586a['responsetime'];this[_0xb858('0x19')]=_0x7a586a[_0xb858('0x19')]||0x0;this[_0xb858('0x1a')]=_0x7a586a[_0xb858('0x1a')]||0x0;this['talktime']=_0x7a586a['talktime']||0x0;this[_0xb858('0x1b')]=_0x7a586a[_0xb858('0x1b')];this['callbackuniqueid']=_0x7a586a[_0xb858('0x1c')];this[_0xb858('0x1d')]=_0x7a586a[_0xb858('0x1d')];this[_0xb858('0x1e')]=_0x7a586a[_0xb858('0x1e')];this[_0xb858('0x1f')]=_0x7a586a[_0xb858('0x1f')];this[_0xb858('0x20')]=_0x7a586a[_0xb858('0x20')];this['UserId']=_0x7a586a[_0xb858('0x21')];this[_0xb858('0x22')]=_0x7a586a[_0xb858('0x22')];this[_0xb858('0x23')]=_0x7a586a[_0xb858('0x23')];this[_0xb858('0x24')]=_0x7a586a[_0xb858('0x24')]||'';this['originatecalleridname']=_0x7a586a[_0xb858('0x25')]||'';}module[_0xb858('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index dbb6678..c6312a5 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 _0x0ac4=['name','calleridnum','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','talktime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','recallme','ListId','UserId','VoiceQueueId','CampaignId','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid'];(function(_0x3186aa,_0x34c21e){var _0x2d8c36=function(_0x239e99){while(--_0x239e99){_0x3186aa['push'](_0x3186aa['shift']());}};_0x2d8c36(++_0x34c21e);}(_0x0ac4,0x1ec));var _0x40ac=function(_0xe30e17,_0xce02be){_0xe30e17=_0xe30e17-0x0;var _0x2342c9=_0x0ac4[_0xe30e17];return _0x2342c9;};'use strict';var util=require(_0x40ac('0x0'));var _=require(_0x40ac('0x1'));var moment=require(_0x40ac('0x2'));function getSeconds(_0x4d4a1e,_0x4255c3){var _0x21af2c=moment(_0x4d4a1e)[_0x40ac('0x3')](0x0);var _0x2a0eae=moment(_0x4255c3)[_0x40ac('0x3')](0x0);return _0x21af2c[_0x40ac('0x4')](_0x2a0eae,_0x40ac('0x5'));}function Hangup(_0x27cd3b,_0x548cff){this[_0x40ac('0x6')]=0x4;this[_0x40ac('0x7')]=_0x40ac('0x8');this[_0x40ac('0x9')]=_0x27cd3b[_0x40ac('0x9')];this[_0x40ac('0xa')]=_0x27cd3b[_0x40ac('0xa')];this[_0x40ac('0xb')]=_0x27cd3b[_0x40ac('0xa')]===_0x40ac('0xc')?_0x40ac('0xd'):_0x27cd3b[_0x40ac('0xa')];this[_0x40ac('0xe')]=_0x27cd3b['countbusyretry'];this['countcongestionretry']=_0x27cd3b[_0x40ac('0xf')];this['countnoanswerretry']=_0x27cd3b[_0x40ac('0x10')];this[_0x40ac('0x11')]=_0x27cd3b[_0x40ac('0xe')]+_0x27cd3b[_0x40ac('0xf')]+_0x27cd3b[_0x40ac('0x10')]+_0x27cd3b['countnosuchnumberretry']+_0x27cd3b[_0x40ac('0x12')]+_0x27cd3b['countabandonedretry']+_0x27cd3b[_0x40ac('0x13')]+_0x27cd3b[_0x40ac('0x14')];this[_0x40ac('0x15')]=_0x27cd3b['countnosuchnumberretry'];this[_0x40ac('0x12')]=_0x27cd3b[_0x40ac('0x12')];this[_0x40ac('0x16')]=_0x27cd3b['countabandonedretry'];this[_0x40ac('0x13')]=_0x27cd3b['countmachineretry'];this[_0x40ac('0x14')]=_0x27cd3b['countagentrejectretry'];this['uniqueid']=_0x548cff[_0x40ac('0x17')];this['calleridname']=_0x27cd3b[_0x40ac('0x18')];this[_0x40ac('0x19')]=_0x27cd3b['number'];this[_0x40ac('0x1a')]=_0x27cd3b[_0x40ac('0x1a')];this[_0x40ac('0x1b')]=_0x27cd3b[_0x40ac('0x1b')];this[_0x40ac('0x1c')]=moment()[_0x40ac('0x1d')](_0x40ac('0x1e'));this['ringtime']=getSeconds(_0x27cd3b['responsetime'],_0x27cd3b[_0x40ac('0x1a')]);this['holdtime']=0x0;this[_0x40ac('0x1f')]=getSeconds(this[_0x40ac('0x1c')],_0x27cd3b[_0x40ac('0x1b')]);this[_0x40ac('0xd')]=_0x27cd3b['queue'];this[_0x40ac('0x20')]=_0x40ac('0x21');this[_0x40ac('0x22')]=_0x548cff[_0x40ac('0x23')];this[_0x40ac('0x24')]=_0x27cd3b[_0x40ac('0x24')];this[_0x40ac('0x25')]=_0x27cd3b[_0x40ac('0x25')];this['callbackat']=_0x27cd3b['callbackat'];this['recallme']=_0x27cd3b[_0x40ac('0x26')];this['ContactId']=_0x27cd3b['ContactId'];this[_0x40ac('0x27')]=_0x27cd3b[_0x40ac('0x27')];this[_0x40ac('0x28')]=_0x27cd3b[_0x40ac('0x28')];this[_0x40ac('0x29')]=_0x27cd3b['VoiceQueueId'];this[_0x40ac('0x2a')]=_0x27cd3b[_0x40ac('0x2a')];}module['exports']=Hangup; \ No newline at end of file +var _0x0e0c=['diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','uniqueid','calleridname','number','starttime','responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','membername','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','moment','milliseconds'];(function(_0x352c5f,_0xed7153){var _0x535af1=function(_0x14d5d5){while(--_0x14d5d5){_0x352c5f['push'](_0x352c5f['shift']());}};_0x535af1(++_0xed7153);}(_0x0e0c,0xb8));var _0xc0e0=function(_0x137f86,_0x3dc7f8){_0x137f86=_0x137f86-0x0;var _0x3b7758=_0x0e0c[_0x137f86];return _0x3b7758;};'use strict';var util=require(_0xc0e0('0x0'));var _=require(_0xc0e0('0x1'));var moment=require(_0xc0e0('0x2'));function getSeconds(_0x5fb2c2,_0x2bb9e3){var _0x3b2e4a=moment(_0x5fb2c2)[_0xc0e0('0x3')](0x0);var _0x378d31=moment(_0x2bb9e3)[_0xc0e0('0x3')](0x0);return _0x3b2e4a[_0xc0e0('0x4')](_0x378d31,_0xc0e0('0x5'));}function Hangup(_0x46e421,_0x3a8b67){this[_0xc0e0('0x6')]=0x4;this[_0xc0e0('0x7')]=_0xc0e0('0x8');this[_0xc0e0('0x9')]=_0x46e421[_0xc0e0('0x9')];this[_0xc0e0('0xa')]=_0x46e421[_0xc0e0('0xa')];this[_0xc0e0('0xb')]=_0x46e421[_0xc0e0('0xa')]===_0xc0e0('0xc')?_0xc0e0('0xd'):_0x46e421[_0xc0e0('0xa')];this[_0xc0e0('0xe')]=_0x46e421[_0xc0e0('0xe')];this[_0xc0e0('0xf')]=_0x46e421[_0xc0e0('0xf')];this[_0xc0e0('0x10')]=_0x46e421[_0xc0e0('0x10')];this[_0xc0e0('0x11')]=_0x46e421[_0xc0e0('0xe')]+_0x46e421[_0xc0e0('0xf')]+_0x46e421['countnoanswerretry']+_0x46e421[_0xc0e0('0x12')]+_0x46e421[_0xc0e0('0x13')]+_0x46e421['countabandonedretry']+_0x46e421['countmachineretry']+_0x46e421[_0xc0e0('0x14')];this[_0xc0e0('0x12')]=_0x46e421[_0xc0e0('0x12')];this[_0xc0e0('0x13')]=_0x46e421['countdropretry'];this[_0xc0e0('0x15')]=_0x46e421[_0xc0e0('0x15')];this[_0xc0e0('0x16')]=_0x46e421[_0xc0e0('0x16')];this[_0xc0e0('0x14')]=_0x46e421['countagentrejectretry'];this[_0xc0e0('0x17')]=_0x3a8b67[_0xc0e0('0x17')];this[_0xc0e0('0x18')]=_0x46e421['name'];this['calleridnum']=_0x46e421[_0xc0e0('0x19')];this['starttime']=_0x46e421[_0xc0e0('0x1a')];this[_0xc0e0('0x1b')]=_0x46e421[_0xc0e0('0x1b')];this[_0xc0e0('0x1c')]=moment()[_0xc0e0('0x1d')](_0xc0e0('0x1e'));this[_0xc0e0('0x1f')]=getSeconds(_0x46e421[_0xc0e0('0x1b')],_0x46e421[_0xc0e0('0x1a')]);this[_0xc0e0('0x20')]=0x0;this['talktime']=getSeconds(this[_0xc0e0('0x1c')],_0x46e421[_0xc0e0('0x1b')]);this[_0xc0e0('0xd')]=_0x46e421['queue'];this[_0xc0e0('0x21')]=_0xc0e0('0x22');this[_0xc0e0('0x23')]=_0x3a8b67[_0xc0e0('0x24')];this[_0xc0e0('0x25')]=_0x46e421[_0xc0e0('0x25')];this[_0xc0e0('0x26')]=_0x46e421[_0xc0e0('0x26')];this[_0xc0e0('0x27')]=_0x46e421[_0xc0e0('0x27')];this['recallme']=_0x46e421[_0xc0e0('0x28')];this[_0xc0e0('0x29')]=_0x46e421[_0xc0e0('0x29')];this[_0xc0e0('0x2a')]=_0x46e421[_0xc0e0('0x2a')];this[_0xc0e0('0x2b')]=_0x46e421[_0xc0e0('0x2b')];this[_0xc0e0('0x2c')]=_0x46e421['VoiceQueueId'];this[_0xc0e0('0x2d')]=_0x46e421['CampaignId'];}module[_0xc0e0('0x2e')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 2647d80..f0da7b7 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 _0xd8ba=['outbound','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','countmachineretry','queue','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype'];(function(_0x276308,_0x29ef69){var _0x3fbe6f=function(_0x302816){while(--_0x302816){_0x276308['push'](_0x276308['shift']());}};_0x3fbe6f(++_0x29ef69);}(_0xd8ba,0x12f));var _0xad8b=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xd8ba[_0x4a9fb1];return _0x348672;};'use strict';var util=require(_0xad8b('0x0'));var _=require(_0xad8b('0x1'));var moment=require(_0xad8b('0x2'));function getSeconds(_0x6cef9f,_0x43ea9b){var _0x80966e=moment(_0x6cef9f)[_0xad8b('0x3')](0x0);var _0x30c70c=moment(_0x43ea9b)[_0xad8b('0x3')](0x0);return _0x80966e['diff'](_0x30c70c,_0xad8b('0x4'));}function History(_0x3a8d85){this[_0xad8b('0x5')]=_0x3a8d85[_0xad8b('0x5')];this[_0xad8b('0x6')]=_0x3a8d85[_0xad8b('0x6')]||undefined;this[_0xad8b('0x7')]=_0x3a8d85[_0xad8b('0x7')];this[_0xad8b('0x8')]=_0x3a8d85[_0xad8b('0x7')]===_0xad8b('0x9')?'queue':_0x3a8d85[_0xad8b('0x7')];this[_0xad8b('0xa')]=_0x3a8d85[_0xad8b('0xa')];this[_0xad8b('0xb')]=_0x3a8d85['countcongestionretry'];this[_0xad8b('0xc')]=_0x3a8d85['countnoanswerretry'];this['countglobal']=_0x3a8d85[_0xad8b('0xa')]+_0x3a8d85['countcongestionretry']+_0x3a8d85[_0xad8b('0xc')]+_0x3a8d85[_0xad8b('0xd')]+_0x3a8d85[_0xad8b('0xe')]+_0x3a8d85[_0xad8b('0xf')]+_0x3a8d85['countmachineretry']+_0x3a8d85[_0xad8b('0x10')];this['countnosuchnumberretry']=_0x3a8d85[_0xad8b('0xd')];this[_0xad8b('0xe')]=_0x3a8d85[_0xad8b('0xe')];this[_0xad8b('0xf')]=_0x3a8d85[_0xad8b('0xf')];this[_0xad8b('0x11')]=_0x3a8d85[_0xad8b('0x11')];this[_0xad8b('0x10')]=_0x3a8d85[_0xad8b('0x10')];this[_0xad8b('0x12')]=_0x3a8d85[_0xad8b('0x12')];this['calleridname']=_0x3a8d85[_0xad8b('0x13')];this[_0xad8b('0x14')]=_0x3a8d85[_0xad8b('0x15')];this[_0xad8b('0x16')]=_0x3a8d85[_0xad8b('0x16')];this[_0xad8b('0x17')]=_0x3a8d85[_0xad8b('0x17')];this[_0xad8b('0x18')]=_0x3a8d85['responsetime'];this[_0xad8b('0x19')]=getSeconds(_0x3a8d85['responsetime'],_0x3a8d85['starttime']);this[_0xad8b('0x1a')]=0x0;this[_0xad8b('0x1b')]=0x0;this[_0xad8b('0x1c')]=_0x3a8d85['callback'];this[_0xad8b('0x1d')]=_0x3a8d85[_0xad8b('0x1d')];this['callbackat']=_0x3a8d85[_0xad8b('0x1e')];this[_0xad8b('0x1f')]=_0x3a8d85['recallme'];this['ContactId']=_0x3a8d85[_0xad8b('0x20')];this['ListId']=_0x3a8d85['ListId'];this[_0xad8b('0x21')]=_0x3a8d85[_0xad8b('0x21')];this[_0xad8b('0x22')]=_0x3a8d85[_0xad8b('0x22')];this['CampaignId']=_0x3a8d85[_0xad8b('0x23')];this[_0xad8b('0x24')]=_0x3a8d85['originatecalleridnum']||'';this['originatecalleridname']=_0x3a8d85[_0xad8b('0x25')]||'';}module[_0xad8b('0x26')]=History; \ No newline at end of file +var _0x65b8=['ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','seconds','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countglobal','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','number','starttime','responsetime','endtime','ringtime','holdtime','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x65b8,0x1c1));var _0x865b=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x65b8[_0x3e5086];return _0xfeb102;};'use strict';var util=require(_0x865b('0x0'));var _=require(_0x865b('0x1'));var moment=require(_0x865b('0x2'));function getSeconds(_0x4606af,_0x5276e1){var _0x24cc5c=moment(_0x4606af)['milliseconds'](0x0);var _0x4aaabf=moment(_0x5276e1)[_0x865b('0x3')](0x0);return _0x24cc5c[_0x865b('0x4')](_0x4aaabf,_0x865b('0x5'));}function History(_0x116183){this['uniqueid']=_0x116183[_0x865b('0x6')];this[_0x865b('0x7')]=_0x116183[_0x865b('0x7')]||undefined;this[_0x865b('0x8')]=_0x116183[_0x865b('0x8')];this[_0x865b('0x9')]=_0x116183[_0x865b('0x8')]==='outbound'?_0x865b('0xa'):_0x116183[_0x865b('0x8')];this[_0x865b('0xb')]=_0x116183[_0x865b('0xb')];this[_0x865b('0xc')]=_0x116183['countcongestionretry'];this['countnoanswerretry']=_0x116183['countnoanswerretry'];this[_0x865b('0xd')]=_0x116183[_0x865b('0xb')]+_0x116183[_0x865b('0xc')]+_0x116183[_0x865b('0xe')]+_0x116183[_0x865b('0xf')]+_0x116183[_0x865b('0x10')]+_0x116183[_0x865b('0x11')]+_0x116183[_0x865b('0x12')]+_0x116183[_0x865b('0x13')];this[_0x865b('0xf')]=_0x116183['countnosuchnumberretry'];this[_0x865b('0x10')]=_0x116183[_0x865b('0x10')];this[_0x865b('0x11')]=_0x116183['countabandonedretry'];this[_0x865b('0x12')]=_0x116183[_0x865b('0x12')];this[_0x865b('0x13')]=_0x116183['countagentrejectretry'];this['queue']=_0x116183['queue'];this[_0x865b('0x14')]=_0x116183[_0x865b('0x15')];this['calleridnum']=_0x116183[_0x865b('0x16')];this[_0x865b('0x17')]=_0x116183['starttime'];this[_0x865b('0x18')]=_0x116183[_0x865b('0x18')];this[_0x865b('0x19')]=_0x116183[_0x865b('0x18')];this[_0x865b('0x1a')]=getSeconds(_0x116183[_0x865b('0x18')],_0x116183['starttime']);this[_0x865b('0x1b')]=0x0;this['talktime']=0x0;this['callback']=_0x116183['callback'];this[_0x865b('0x1c')]=_0x116183['callbackuniqueid'];this[_0x865b('0x1d')]=_0x116183[_0x865b('0x1d')];this[_0x865b('0x1e')]=_0x116183[_0x865b('0x1e')];this[_0x865b('0x1f')]=_0x116183['ContactId'];this[_0x865b('0x20')]=_0x116183[_0x865b('0x20')];this[_0x865b('0x21')]=_0x116183['UserId'];this[_0x865b('0x22')]=_0x116183['VoiceQueueId'];this['CampaignId']=_0x116183['CampaignId'];this[_0x865b('0x23')]=_0x116183[_0x865b('0x23')]||'';this[_0x865b('0x24')]=_0x116183[_0x865b('0x24')]||'';}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index cc58c94..beaa720 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 _0x95af=['MACHINE','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','Machine','amd','[syncMachineIvr][createHistory]','[syncMachineIvr]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','AnswerAGI','AGI','dialQueueProject','cause-txt','Unknow','reason','agent','agiafterat','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','[syncQueueCallerAbandon]\x20[Drop]','droptime','responsetime','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialDropMaxRetry','countdropretry','add','dialDropRetryFrequency','minutes','ListId','[rescheduleContact][Drop]','Abandoned','CALLEREXIT','countabandonedretry','[rescheduleContact][Abandoned]','channel','syncQueueMember','actionid','locked','stateinterface','push','idHopper','paused','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','finally','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','contactAgent-idHopper:\x20','Agent:\x20','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncCampaigns','TrunkBackup','TRUNK_IS_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','ifTime','checkIfTimeIntervals','Failure','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','\x20Intervals\x20is\x20empty\x20','timezones','TIMEZONE_UNKNOW','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','content','indexOf','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','power','handlePower','booked','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','loggedIn','checkIsTrunkReachable','dialGlobalInterval','dialTimezone','[syncCampaigns]','pow','replace','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','originate','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','dialQueueProject2','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialQueueTimeout','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','tags','updatedAt','%s%s','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','OriginateError','[originate][error]','originate\x20action\x20Error','syncOriginateResponse','getQueue','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','countbusyretry','countcongestionretry','countnosuchnumberretry','countagentrejectretry','dialGlobalMaxRetry','countnoanswerretry','dialNoAnswerRetryFrequency','dialBusyRetryFrequency','dialCongestionMaxRetry','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialAbandonedRetryFrequency','countmachineretry','dialMachineMaxRetry','[rescheduleContact][Machine]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','NoSuchNumber','[syncAgentComplete][createHistory][0]','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','Busy','countglobal','dialBusyMaxRetry','reason\x205\x20busy','stateGlobal','reason\x208\x20congestion','outboundAbandonedCallsDay','dialAbandonedMaxRetry','reason\x2011\x20abandoned','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','Dropped\x20calls\x20day','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','predictiveIntervalPauses','[CatchErlangB]','check\x20failure','floor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','queueStatusComplete:\x20','Queue:\x20','queuestatus','[booked][checkContactBlack][else]','[unlockOriginate][syncQueueStatusComplete]','dialRecallMeTimeout','Agent','voicePause','log','Contact\x20updated','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','loggerHandler','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','[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]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','busyFactor','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','m\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','bluebird','md5','../../../config/logger','dialer','predictive','predictiveCalls','syncQueueSummary','../ami','redis','localhost','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./agentComplete','./queueCallerAbandon','./hangup','env','rrmemory','roundrobin','prototype','enqueue','tail','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','agentconnect','syncAgentConnect','bind','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','isUndefined','message','AGENTS_NOT_LOGGED','\x20AGENTS\x20NOT\x20LOGGED','name','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','Intervals','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','type','outbound','strategy','answered','available','pTalking','sumBillable','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialPrefix','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','Trunk','callerid','voice:queue:%s','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','inspect','stack','length','[decremetOriginate]\x20object\x20originated\x20is\x20negative','[decremetOriginate]\x20is\x20null\x20or\x20undefined','RESCHEDULED_CONTACTS','contactsRescheduled','contacts','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','IS_DISACTIVED','state','statedesc','endtime','starttime','clearZombieChannels','[uniqueid]','[actions]','hasOwnProperty','isNil','Action','status','catch','updateOriginated','queue','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','countReScheduled','then','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','[checkIsBlackListIvr]\x20','avgHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','[unlockContact]\x20','getContactDialer','getContactDialerIvr','[getContactDialer]\x20','getVoiceQueueRtPauses','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','saveInDb','pick','ContactId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','Success','isTrunkReachable','active','reachable','unmonitored','variable','amdstatus','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','uniqueid','outboundAnswerCallsDay','HangupInAMD','membername','AMD','[syncHangupInAMD][createHistory]'];(function(_0x3e2e87,_0x3123af){var _0x3c00f0=function(_0x1e5f4c){while(--_0x1e5f4c){_0x3e2e87['push'](_0x3e2e87['shift']());}};_0x3c00f0(++_0x3123af);}(_0x95af,0x11f));var _0xf95a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x95af[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0xf95a('0x0'));var _=require('lodash');var BPromise=require(_0xf95a('0x1'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xf95a('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment/');var logger=require(_0xf95a('0x3'))(_0xf95a('0x4'));var loggerBooked=require('../../../config/logger')('booked');var loggerPredictive=require('../../../config/logger')(_0xf95a('0x5'));var loggerPredictiveCalls=require('../../../config/logger')(_0xf95a('0x6'));var loggerSyncQueueSummary=require(_0xf95a('0x3'))(_0xf95a('0x7'));var ami=require(_0xf95a('0x8'));config[_0xf95a('0x9')]=_['defaults'](config[_0xf95a('0x9')],{'host':_0xf95a('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf95a('0x9')]));var cmHopper=require('../rpc/cmHopper');var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0xf95a('0xb'));var voiceQueueRt=require(_0xf95a('0xc'));var Action=require(_0xf95a('0xd'));var History=require('./history');var Final=require('./final');var AgentComplete=require(_0xf95a('0xe'));var QueueCallerAbandon=require(_0xf95a('0xf'));var Hangup=require(_0xf95a('0x10'));var ipAgi=process[_0xf95a('0x11')]['XCALLY_IP_AGI']||'127.0.0.1';var strategy={'rrmemory':_0xf95a('0x12'),'roundrobin':_0xf95a('0x13')};var Sequence=function(){};Sequence[_0xf95a('0x14')][_0xf95a('0x15')]=function(_0x44c905){this['tail']=this[_0xf95a('0x16')]?this[_0xf95a('0x16')]['finally'](_0x44c905):_0x44c905();};function Dialer(_0x181d7d,_0x1afc4d){this[_0xf95a('0x17')]=new Sequence();this[_0xf95a('0x18')]=_0x1afc4d;this[_0xf95a('0x19')]=_0x181d7d['voiceQueues'];this['campaigns']=_0x181d7d[_0xf95a('0x1a')];this[_0xf95a('0x1b')]=_0x181d7d[_0xf95a('0x1b')];this['trunks']=_0x181d7d[_0xf95a('0x1c')];this[_0xf95a('0x1d')]=config[_0xf95a('0x1d')]||0x2;this[_0xf95a('0x1e')]={};this[_0xf95a('0x1f')]={};this['contactsId']={};this[_0xf95a('0x20')]={};this[_0xf95a('0x21')]={};this[_0xf95a('0x22')]={};this[_0xf95a('0x23')]={};this[_0xf95a('0x24')]={};this[_0xf95a('0x25')]={};this['queueBookedRR']={};ami['on'](_0xf95a('0x26'),this[_0xf95a('0x27')][_0xf95a('0x28')](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon']['bind'](this));ami['on'](_0xf95a('0x29'),this['syncOriginateResponse'][_0xf95a('0x28')](this));ami['on']('agentcomplete',this[_0xf95a('0x2a')][_0xf95a('0x28')](this));ami['on'](_0xf95a('0x2b'),this[_0xf95a('0x7')]['bind'](this));ami['on'](_0xf95a('0x2c'),this[_0xf95a('0x2d')][_0xf95a('0x28')](this));ami['on'](_0xf95a('0x2e'),this[_0xf95a('0x2f')][_0xf95a('0x28')](this));ami['on'](_0xf95a('0x30'),this[_0xf95a('0x31')][_0xf95a('0x28')](this));ami['on'](_0xf95a('0x32'),this['syncQueueMember'][_0xf95a('0x28')](this));ami['on']('queuestatuscomplete',this[_0xf95a('0x33')][_0xf95a('0x28')](this));this[_0xf95a('0x34')]();this[_0xf95a('0x35')]();}function isNotNull(_0x24d8ba){return _0x24d8ba!==null&&!_[_0xf95a('0x36')](_0x24d8ba);}function checkIsLoggedIn(_0x3b7e55,_0x337012){return function(){if(_0x337012<=0x0){_0x3b7e55[_0xf95a('0x37')]=_0xf95a('0x38');throw _0x3b7e55['name']+_0xf95a('0x39');}};}function isActive(_0x50f21a){return _0x50f21a;}function checkIsActive(_0x5022c9,_0x5cda51){return function(){if(!isActive(_0x5cda51)){_0x5022c9[_0xf95a('0x37')]='NOT_ACTIVE';throw _0x5022c9[_0xf95a('0x3a')]+_0xf95a('0x3b');}};}function checkInterval(_0x18776b){return function(){if(!isNotNull(_0x18776b[_0xf95a('0x3c')])){_0x18776b[_0xf95a('0x37')]=_0xf95a('0x3d');throw _0x18776b['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_0x18776b[_0xf95a('0x3c')][_0xf95a('0x3e')])){_0x18776b[_0xf95a('0x37')]=_0xf95a('0x3d');throw _0x18776b['name']+_0xf95a('0x3f');}if(!isNotNull(_[_0xf95a('0x40')](_0x18776b['Interval']['Intervals']))){_0x18776b[_0xf95a('0x37')]=_0xf95a('0x3d');throw _0x18776b[_0xf95a('0x3a')]+_0xf95a('0x3f');}};}function msgResponse(_0x311b9c,_0x5a233d,_0x3e9244){return{'action':_0x311b9c,'response':_0x5a233d,'message':_0x3e9244,'stack':_0x3e9244};}function myreject(_0x2dacc9){return function(_0xf35d47){return _0x2dacc9(msgResponse(_0xf95a('0x41'),_0xf95a('0x42'),JSON[_0xf95a('0x43')](_0xf35d47)));};}function getSeconds(_0xa5eca,_0x4cc143){var _0xa92273=moment(_0xa5eca)[_0xf95a('0x44')](0x0);var _0x1842cd=moment(_0x4cc143)[_0xf95a('0x44')](0x0);return _0xa92273[_0xf95a('0x45')](_0x1842cd,_0xf95a('0x46'));}function emit(_0xcd7826,_0x191c39,_0x35c845){io['to'](_0xcd7826)['emit'](_0x191c39,_0x35c845);}function emitVoiceQueueSummary(_0x33d072){if(_0x33d072[_0xf95a('0x47')]===_0xf95a('0x48')){var _0x4b3279={'id':_0x33d072['id'],'name':_0x33d072['name'],'strategy':_0x33d072[_0xf95a('0x49')],'answered':_0x33d072[_0xf95a('0x4a')],'available':_0x33d072[_0xf95a('0x4b')],'loggedIn':_0x33d072['loggedIn'],'pTalking':_0x33d072[_0xf95a('0x4c')],'sumBillable':_0x33d072[_0xf95a('0x4d')],'sumDuration':_0x33d072['sumDuration'],'sumHoldTime':_0x33d072['sumHoldTime']||0x0,'talking':_0x33d072[_0xf95a('0x4e')],'total':_0x33d072[_0xf95a('0x4f')],'type':_0x33d072[_0xf95a('0x47')],'unmanaged':_0x33d072[_0xf95a('0x50')],'abandoned':_0x33d072[_0xf95a('0x51')],'waiting':_0x33d072[_0xf95a('0x52')],'loggedInDb':_0x33d072[_0xf95a('0x53')],'dialActive':_0x33d072[_0xf95a('0x54')],'dialMethod':_0x33d072[_0xf95a('0x55')],'dialOriginateCallerIdName':_0x33d072['dialOriginateCallerIdName'],'dialOriginateCallerIdNumber':_0x33d072['dialOriginateCallerIdNumber'],'dialOriginateTimeout':_0x33d072['dialOriginateTimeout'],'dialPrefix':_0x33d072[_0xf95a('0x56')],'outboundAnswerAgiCallsDay':_0x33d072[_0xf95a('0x57')],'outboundAnswerCallsDay':_0x33d072['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x33d072['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x33d072[_0xf95a('0x58')],'outboundCongestionCallsDay':_0x33d072[_0xf95a('0x59')],'outboundDropCallsDayACS':_0x33d072[_0xf95a('0x5a')],'outboundDropCallsDayCallersExit':_0x33d072[_0xf95a('0x5b')],'outboundDropCallsDayTimeout':_0x33d072[_0xf95a('0x5c')],'outboundNoAnswerCallsDay':_0x33d072[_0xf95a('0x5d')],'outboundNoSuchCallsDay':_0x33d072[_0xf95a('0x5e')],'outboundOriginateFailureCallsDay':_0x33d072[_0xf95a('0x5f')],'outboundReCallsDay':_0x33d072[_0xf95a('0x60')],'outboundRejectCallsDay':_0x33d072['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x33d072[_0xf95a('0x61')],'predictiveIntervalAnsweredCalls':_0x33d072['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x33d072[_0xf95a('0x62')],'predictiveIntervalAvgTalktime':_0x33d072[_0xf95a('0x63')],'predictiveIntervalDroppedCallsCallersExit':_0x33d072[_0xf95a('0x64')],'predictiveIntervalDroppedCallsTimeout':_0x33d072[_0xf95a('0x65')],'predictiveIntervalErlangCalls':_0x33d072[_0xf95a('0x66')],'predictiveIntervalErlangCallsDroppedCalls':_0x33d072['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x33d072[_0xf95a('0x67')],'predictiveIntervalMultiplicativeFactor':_0x33d072[_0xf95a('0x68')],'predictiveIntervalPauses':_0x33d072['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x33d072[_0xf95a('0x69')],'predictiveIntervalTotalCalls':_0x33d072[_0xf95a('0x6a')],'message':_0x33d072[_0xf95a('0x37')],'originated':_0x33d072[_0xf95a('0x6b')],'erlangCalls':_0x33d072[_0xf95a('0x6c')],'erlangCallToSecond':_0x33d072[_0xf95a('0x6d')],'erlangAbandonmentRate':_0x33d072['erlangAbandonmentRate'],'erlangBusyFactor':_0x33d072[_0xf95a('0x6e')],'startPredictive':_0x33d072[_0xf95a('0x22')],'startProgressive':_0x33d072['startProgressive']};if(_0x33d072[_0xf95a('0x6f')]){_0x4b3279[_0xf95a('0x6f')]={'id':_0x33d072[_0xf95a('0x6f')]['id'],'name':_0x33d072[_0xf95a('0x6f')]['name'],'active':_0x33d072[_0xf95a('0x6f')]['active'],'callerid':_0x33d072[_0xf95a('0x6f')][_0xf95a('0x70')]};}if(_0x33d072[_0xf95a('0x3c')]){_0x4b3279['Interval']={'id':_0x33d072[_0xf95a('0x3c')]['id'],'name':_0x33d072[_0xf95a('0x3c')][_0xf95a('0x3a')]};}var _0x21a9b4=md5(JSON[_0xf95a('0x43')](_0x4b3279));if(_0x33d072['md5']!==_0x21a9b4){_0x33d072['md5']=_0x21a9b4;emit(util['format'](_0xf95a('0x71'),_0x4b3279[_0xf95a('0x3a')]),_0xf95a('0x72'),_0x4b3279);}}}function emitCampaignSummary(_0x1965c2){if(_0x1965c2['type']===_0xf95a('0x73')){emit(util[_0xf95a('0x74')](_0xf95a('0x75'),_0x1965c2['name']),_0xf95a('0x76'),_0x1965c2);}}function checkGetDataPredictive(_0x366d14){if(isNotNull(_0x366d14)){if(!_[_0xf95a('0x40')](_0x366d14)){loggerPredictive[_0xf95a('0x77')](_0xf95a('0x78'));loggerPredictive[_0xf95a('0x77')](_0xf95a('0x79'),_0x366d14[_0xf95a('0x6a')]);loggerPredictive['info'](_0xf95a('0x7a'),_0x366d14[_0xf95a('0x7b')]);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x7c'),_0x366d14[_0xf95a('0x65')]);loggerPredictive['info'](_0xf95a('0x7d'),_0x366d14[_0xf95a('0x64')]);loggerPredictive['info'](_0xf95a('0x7e'),_0x366d14[_0xf95a('0x62')]);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x7f'),_0x366d14[_0xf95a('0x63')]);loggerPredictive['info']('---------------------------');if(_0x366d14[_0xf95a('0x6a')]>0x0){if(!_[_0xf95a('0x36')](_0x366d14['predictiveIntervalAvgTalktime'])&&_0x366d14[_0xf95a('0x63')]>0x0){return!![];}else{loggerPredictive[_0xf95a('0x77')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xf95a('0x36')](_0x366d14['predictiveIntervalAvgHoldtime'])&&_0x366d14[_0xf95a('0x62')]>0x0){return!![];}else{loggerPredictive[_0xf95a('0x77')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xf95a('0x77')](_0xf95a('0x80'));}}else{loggerPredictive[_0xf95a('0x77')](_0xf95a('0x81'));}}else{loggerPredictive[_0xf95a('0x77')](_0xf95a('0x81'));}return![];}function mergeDataErlangB(_0x4be7d7){return function(_0x42ff44){loggerPredictive[_0xf95a('0x77')]('---------\x20ErlangB\x20---------');loggerPredictive[_0xf95a('0x77')](_0xf95a('0x82'),_0x42ff44['erlangCalls']);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x83'),_0x42ff44['erlangCallToSecond']);loggerPredictive['info'](_0xf95a('0x84'),_0x42ff44[_0xf95a('0x85')]);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x86'),_0x42ff44[_0xf95a('0x6e')]);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x84'),_0x42ff44[_0xf95a('0x85')]);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x87'));_[_0xf95a('0x88')](_0x4be7d7,_0x42ff44);};}function getDiff(_0x2d7007){var _0x33386b=moment()['milliseconds'](0x0);var _0x3efe4d=moment(_0x2d7007)[_0xf95a('0x44')](0x0);return _0x33386b[_0xf95a('0x45')](_0x3efe4d,_0xf95a('0x46'));}function ifInterval(_0x5c0f33,_0x560b58){if(_[_0xf95a('0x36')](_0x560b58)){return![];}if(getDiff(_0x560b58)<_0x5c0f33*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x3e486c){if(isNotNull(_0x3e486c)){if(!_['isUndefined'](_0x3e486c[_0xf95a('0x23')])){_0x3e486c['startProgressive']=undefined;loggerPredictive[_0xf95a('0x77')](_0x3e486c[_0xf95a('0x3a')],_0xf95a('0x89'));}if(!_['isUndefined'](_0x3e486c['startPredictive'])){_0x3e486c[_0xf95a('0x22')]=undefined;loggerPredictive[_0xf95a('0x77')](_0x3e486c['name'],_0xf95a('0x8a'));}if(!_[_0xf95a('0x36')](_0x3e486c[_0xf95a('0x8b')])){clearInterval(_0x3e486c['handlePredictive']);_0x3e486c[_0xf95a('0x8b')]=undefined;loggerPredictive['info'](_0x3e486c[_0xf95a('0x3a')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x46e542,_0x41405a){if(_0x41405a===0x0){return 0x0;}var _0x1a52bd=0x1;for(var _0x405077=0x1;_0x405077<=_0x41405a;_0x405077+=0x1){_0x1a52bd=0x1+_0x1a52bd*_0x405077/_0x46e542;}return 0x1/_0x1a52bd;}function isVoiceQueueOutbound(_0x116c43){return _0x116c43===_0xf95a('0x48');}function isNotPreview(_0x27fb20){return _0x27fb20!==_0xf95a('0x18');}function isCampaignIvr(_0x55481a){return _0x55481a==='ivr';}function getCallerId(_0x317834,_0x37ad5c,_0x87c28f){if(!_['isUndefined'](_0x87c28f)&&_0xf95a('0x8c')===typeof _0x87c28f&&!_[_0xf95a('0x40')](_0x87c28f)){if(!_[_0xf95a('0x36')](_0x37ad5c)&&_0xf95a('0x8c')===typeof _0x37ad5c&&!_['isEmpty'](_0x37ad5c)){return util[_0xf95a('0x74')]('\x22%s\x22\x20<%s>',_0x37ad5c,_0x87c28f);}return util[_0xf95a('0x74')](_0xf95a('0x8d'),_0x87c28f,_0x87c28f);}if(!_[_0xf95a('0x36')](_0x317834)&&_0xf95a('0x8c')===typeof _0x317834&&!_[_0xf95a('0x40')](_0x317834)){return _0x317834;}return _0xf95a('0x8e');}function loggerCatchQueueSummary(_0x5456e1,_0x4a2431){return function(_0x269a67){freeVariablesPredictive(_0x4a2431);emitVoiceQueueSummary(_0x4a2431);emitCampaignSummary(_0x4a2431);loggerSyncQueueSummary[_0xf95a('0x8f')](_0x5456e1,util[_0xf95a('0x90')](_0x269a67,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2788af,_0x5870f3){return function(_0x5ecb42){loggerPredictive[_0xf95a('0x8f')](_0x5870f3[_0xf95a('0x3a')],_0x2788af);loggerPredictive[_0xf95a('0x8f')](_0x5ecb42[_0xf95a('0x91')]);freeVariablesPredictive(_0x5870f3);};}function loggerCatch(_0x175190){return function(_0x41f70d){logger[_0xf95a('0x8f')](_0x175190,util[_0xf95a('0x90')](_0x41f70d,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x2a6cec){return _0x2a6cec&&!_[_0xf95a('0x36')](_0x2a6cec)&&_0x2a6cec[_0xf95a('0x92')]>0x0;}function decremetOriginate(_0x4bb9f3){if(!_['isUndefined'](_0x4bb9f3)&&_0x4bb9f3!==null){if(_0x4bb9f3['hasOwnProperty'](_0xf95a('0x6b'))){if(_0x4bb9f3['originated']>0x0){_0x4bb9f3[_0xf95a('0x6b')]-=0x1;}else{logger['error'](_0xf95a('0x93'));}}}else{logger[_0xf95a('0x8f')](_0xf95a('0x94'));}}function checkContactLowerLimitOriginate(_0xae4d8f,_0x2ddcdf,_0x30adc5){if(_0x2ddcdf>_0x30adc5){for(var _0xcc2c80=0x0;_0xcc2c80<_0x2ddcdf-_0x30adc5;_0xcc2c80+=0x1){decremetOriginate(_0xae4d8f);}}}function loggerGetContactDialer(_0x3a0395,_0x2a47c6,_0x4bc5e2){return function(_0x4175fc){checkContactLowerLimitOriginate(_0x2a47c6,_0x4bc5e2,0x0);logger[_0xf95a('0x8f')](_0x3a0395,util[_0xf95a('0x90')](_0x4175fc,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x49be51){return function(_0x146511){if(isNotNull(_0x146511)&&isNotNull(_0x146511[0x0])){if(_0x146511[0x0]['contactsRescheduled']>0x0){_0x49be51[_0xf95a('0x37')]=_0xf95a('0x95');logger[_0xf95a('0x77')]('[getContactDialer2][ReScheduled]'+_0x49be51['name'],_0x146511[0x0][_0xf95a('0x96')],_0xf95a('0x97'));}else{_0x49be51['message']='AVAILABLE_CONTACTS_FINISHED';logger[_0xf95a('0x77')](_0xf95a('0x98')+_0x49be51['name']);}}};}function notSendMessagesQueue(_0x896cb2){if(_0x896cb2['sendMessageOneNotActive']){freeVariablesPredictive(_0x896cb2);if(_0x896cb2[_0xf95a('0x6b')]===0x0&&_0x896cb2[_0xf95a('0x4e')]===0x0&&_0x896cb2[_0xf95a('0x52')]===0x0&&(_0x896cb2[_0xf95a('0x4c')]||0x0)===0x0){_0x896cb2[_0xf95a('0x99')]=![];_0x896cb2[_0xf95a('0x4b')]=0x0;_0x896cb2[_0xf95a('0x37')]='NOT_ACTIVE';loggerSyncQueueSummary[_0xf95a('0x8f')](_0xf95a('0x9a'),_0x896cb2['name'],_0xf95a('0x9b'));}else{_0x896cb2[_0xf95a('0x37')]='IS_DISACTIVED';loggerSyncQueueSummary['error'](_0xf95a('0x9a'),_0x896cb2[_0xf95a('0x3a')],_0xf95a('0x9c'));}emitVoiceQueueSummary(_0x896cb2);}}function notSendMessagesCampaign(_0x5f0b3a){if(_0x5f0b3a[_0xf95a('0x99')]){if(_0x5f0b3a[_0xf95a('0x6b')]===0x0){_0x5f0b3a[_0xf95a('0x99')]=![];_0x5f0b3a[_0xf95a('0x37')]=_0xf95a('0x9d');loggerSyncQueueSummary['error'](_0xf95a('0x9e'),_0x5f0b3a['name'],'is\x20not\x20active');}else{_0x5f0b3a[_0xf95a('0x37')]=_0xf95a('0x9f');loggerSyncQueueSummary[_0xf95a('0x8f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x5f0b3a[_0xf95a('0x3a')],_0xf95a('0x9c'));}emitCampaignSummary(_0x5f0b3a);}}function createObjHistory(_0x3ea1f6,_0x4c7877,_0x31cbe5,_0x287e99,_0x36646a){_0x3ea1f6[_0xf95a('0x37')]=_0x31cbe5;var _0x29c6e5=new Action(_0x3ea1f6,_0x4c7877);var _0x5cf622=new History(_0x29c6e5);_0x5cf622[_0xf95a('0xa0')]=_0x287e99;_0x5cf622[_0xf95a('0xa1')]=_0x36646a;_0x5cf622[_0xf95a('0xa2')]=_0x29c6e5[_0xf95a('0xa3')];return _0x5cf622;}Dialer['prototype'][_0xf95a('0x35')]=function(){var _0x304636=this;setInterval(function(){_0x304636[_0xf95a('0xa4')](_0x304636[_0xf95a('0x20')],_0xf95a('0xa5'));_0x304636[_0xf95a('0xa4')](_0x304636['actions'],_0xf95a('0xa6'));},0x32c8);};Dialer['prototype']['clearZombieChannels']=function(_0x270e07,_0x53691e){var _0x5db962=this;for(var _0x3608d5 in _0x270e07){if(_0x270e07[_0xf95a('0xa7')](_0x3608d5)){this['sequence'][_0xf95a('0x15')](function(){if(!_[_0xf95a('0xa8')](_0x270e07[_0x3608d5])){return ami[_0xf95a('0xa9')]({'action':_0xf95a('0xaa'),'channel':_0x270e07[_0x3608d5]['channel']})[_0xf95a('0xab')](function(_0x1c80ef){if(_0x1c80ef[_0xf95a('0x37')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x270e07[_0x3608d5]&&_0x270e07[_0x3608d5][_0xf95a('0x47')]!==_0xf95a('0x73')){_0x5db962[_0xf95a('0xac')](_0x5db962['voiceQueues'][_0x270e07[_0x3608d5][_0xf95a('0xad')]]);logger[_0xf95a('0x8f')](_0xf95a('0xae'),_0x53691e,_0x3608d5,_0x270e07[_0x3608d5][_0xf95a('0xad')]);delete _0x270e07[_0x3608d5];}if(_0x270e07[_0x3608d5]&&_0x270e07[_0x3608d5][_0xf95a('0x47')]===_0xf95a('0x73')){_0x5db962[_0xf95a('0xac')](_0x5db962[_0xf95a('0x1a')][_0x270e07[_0x3608d5][_0xf95a('0xad')]]);logger[_0xf95a('0x8f')](_0xf95a('0xaf'),_0x53691e,_0x3608d5,_0x270e07[_0x3608d5][_0xf95a('0xad')]);delete _0x270e07[_0x3608d5];}},0x2328);}});}});}}};Dialer['prototype'][_0xf95a('0xb0')]=function(_0x435d92){return BPromise['resolve']()[_0xf95a('0xb1')](cmHopper[_0xf95a('0xb0')](_0x435d92))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xb2')));};Dialer[_0xf95a('0x14')][_0xf95a('0xb3')]=function(_0x225c5a){return BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](cmHopperBlack[_0xf95a('0xb3')](_0x225c5a))['catch'](loggerCatch(_0xf95a('0xb5')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x3c7b1a){return BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](cmHopperBlack['checkIsBlackListIvr'](_0x3c7b1a))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xb6')));};Dialer[_0xf95a('0x14')]['averageHandleTime']=function(_0x27d887){return BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](cmHopperHistory[_0xf95a('0xb7')](_0x27d887))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xb8')));};Dialer[_0xf95a('0x14')][_0xf95a('0xb9')]=function(_0x577733){return BPromise['resolve']()[_0xf95a('0xb1')](cmHopper[_0xf95a('0xb9')](_0x577733))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xba')));};Dialer[_0xf95a('0x14')]['unlockContact']=function(_0x1c3318,_0x51ef4f,_0x8d1d5c){return BPromise['resolve']()[_0xf95a('0xb1')](cmHopper['unlockContact'](_0x1c3318,_0x51ef4f,_0x8d1d5c))['catch'](loggerCatch(_0xf95a('0xbb')));};Dialer[_0xf95a('0x14')]['getContactDialer']=function(_0x73bbfc,_0x34a0e1,_0x3dc334,_0x5086b4){return BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](cmHopper[_0xf95a('0xbc')](_0x73bbfc,_0x34a0e1,_0x3dc334,_0x5086b4))[_0xf95a('0xab')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xf95a('0x14')][_0xf95a('0xbd')]=function(_0x3bf078,_0x360e8,_0x3d34fc){return BPromise['resolve']()[_0xf95a('0xb1')](cmHopper[_0xf95a('0xbd')](_0x3bf078,_0x360e8,_0x3d34fc))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xbe')));};Dialer[_0xf95a('0x14')]['getVoiceQueueRtPauses']=function(_0x444369){return BPromise['resolve']()[_0xf95a('0xb1')](voiceQueueRt[_0xf95a('0xbf')](_0x444369))[_0xf95a('0xab')](loggerCatch('[getVoiceQueueRtPauses]\x20'));};Dialer[_0xf95a('0x14')][_0xf95a('0xc0')]=function(_0x54449c){return BPromise['resolve']()[_0xf95a('0xb1')](cmHopper[_0xf95a('0xc0')](_0x54449c))[_0xf95a('0xab')](loggerCatch(_0xf95a('0xc1')));};Dialer[_0xf95a('0x14')][_0xf95a('0xc2')]=function(_0x3c7ecf){return BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](cmHopperHistory['createHistory'](_0x3c7ecf))['catch'](loggerCatch(_0xf95a('0xc3')));};Dialer[_0xf95a('0x14')]['updateOriginated']=function(_0x495018){if(!_['isUndefined'](_0x495018)&&_0x495018!==null){if(_0x495018[_0xf95a('0xa7')](_0xf95a('0x6b'))){if(_0x495018[_0xf95a('0x6b')]>0x0){_0x495018[_0xf95a('0x6b')]-=0x1;}else{logger['error'](_0xf95a('0xc4'));}}}else{logger[_0xf95a('0x8f')](_0xf95a('0xc5'));}};Dialer['prototype']['loggerHandler']=function(_0x3ef2f9,_0x2e613d){var _0x4e56a9=this;return function(_0x5d0055){_0x4e56a9[_0xf95a('0xac')](_0x2e613d);logger[_0xf95a('0x8f')](_0x3ef2f9,util[_0xf95a('0x90')](_0x5d0055,{'showHidden':![],'depth':null}));};};Dialer[_0xf95a('0x14')][_0xf95a('0xc6')]=function(_0x54bb0c,_0x587eaf,_0x2c1d4d){var _0x970fc5={'state':0x19,'statedesc':'notFound'};this[_0xf95a('0xac')](_0x587eaf);this[_0xf95a('0xc7')](_[_0xf95a('0x88')](_0x970fc5,_[_0xf95a('0xc8')](_0x2c1d4d,[_0xf95a('0xc9'),'ListId',_0xf95a('0xca'),_0xf95a('0xcb'),_0xf95a('0xcc')])),_0xf95a('0xcd'),_0xf95a('0xce'));logger[_0xf95a('0x8f')](_0x54bb0c);};Dialer[_0xf95a('0x14')][_0xf95a('0xcf')]=function(_0x1e1301){return _0x1e1301===_0xf95a('0xd0');};Dialer['prototype'][_0xf95a('0xd1')]=function(_0x3bc16f){return!_[_0xf95a('0x36')](_0x3bc16f)&&_0x3bc16f&&!_['isUndefined'](_0x3bc16f[_0xf95a('0x3a')])&&!_['isUndefined'](_0x3bc16f[_0xf95a('0xd2')])&&_0x3bc16f[_0xf95a('0xd2')]&&(this[_0xf95a('0x1c')][util[_0xf95a('0x74')]('SIP/%s',_0x3bc16f[_0xf95a('0x3a')])][_0xf95a('0xaa')]===_0xf95a('0xd3')||this[_0xf95a('0x1c')][util[_0xf95a('0x74')]('SIP/%s',_0x3bc16f[_0xf95a('0x3a')])][_0xf95a('0xaa')]===_0xf95a('0xd4'));};Dialer[_0xf95a('0x14')][_0xf95a('0xc7')]=function(_0x4672d6,_0x539d82,_0x59b126){this[_0xf95a('0xc2')](_0x4672d6)[_0xf95a('0xab')](loggerCatch(_0x539d82));this['moveContactManagedDialer'](_0x4672d6)['catch'](loggerCatch(_0x59b126));};Dialer[_0xf95a('0x14')]['syncVarSet']=function(_0x1dc731){var _0x5dd025=this['uniqueId'][_0x1dc731['uniqueid']];var _0x46f05a;if(!_[_0xf95a('0xa8')](_0x1dc731)&&!_[_0xf95a('0xa8')](_0x1dc731[_0xf95a('0xd5')])&&!_['isNil'](_0x1dc731['variable'][_0xf95a('0xd6')])&&_0x1dc731[_0xf95a('0xd7')]===_0xf95a('0xd8')&&_0x5dd025){if(_0x5dd025['type']!=='ivr'&&this[_0xf95a('0x19')][_0x5dd025[_0xf95a('0xad')]][_0xf95a('0xd9')]&&_0x1dc731[_0xf95a('0xda')]===_0xf95a('0xdb')){delete this[_0xf95a('0x20')][_0x1dc731[_0xf95a('0xdc')]];this[_0xf95a('0xac')](this[_0xf95a('0x19')][_0x5dd025[_0xf95a('0xad')]]);this[_0xf95a('0x19')][_0x5dd025[_0xf95a('0xad')]][_0xf95a('0xdd')]+=0x1;this[_0xf95a('0x19')][_0x5dd025[_0xf95a('0xad')]][_0xf95a('0x57')]+=0x1;_0x46f05a=new Hangup(_0x5dd025,_0x1dc731);_0x46f05a[_0xf95a('0xa0')]=0x12;_0x46f05a[_0xf95a('0xa1')]=_0xf95a('0xde');_0x46f05a[_0xf95a('0xdf')]=_0xf95a('0xe0');this['saveInDb'](_0x46f05a,_0xf95a('0xe1'),'[syncHangupInAMD]');}if(_0x5dd025[_0xf95a('0x47')]!==_0xf95a('0x73')&&this[_0xf95a('0x19')][_0x5dd025['queue']][_0xf95a('0xd9')]&&_0x1dc731[_0xf95a('0xda')]===_0xf95a('0xe2')){delete this[_0xf95a('0x20')][_0x1dc731[_0xf95a('0xdc')]];this[_0xf95a('0xac')](this[_0xf95a('0x19')][_0x5dd025['queue']]);this[_0xf95a('0x19')][_0x5dd025['queue']][_0xf95a('0xdd')]+=0x1;this[_0xf95a('0x19')][_0x5dd025['queue']][_0xf95a('0x57')]+=0x1;_0x46f05a=new Hangup(_0x5dd025,_0x1dc731);_0x46f05a['state']=0x13;_0x46f05a[_0xf95a('0xa1')]='Machine';_0x46f05a[_0xf95a('0xdf')]=_0xf95a('0xe0');_0x46f05a['amd']=!![];this[_0xf95a('0xc7')](_0x46f05a,'[syncMachine][createHistory]','[syncMachine]');}if(_0x5dd025[_0xf95a('0x47')]===_0xf95a('0x73')&&this['campaigns'][_0x5dd025[_0xf95a('0xad')]][_0xf95a('0xd9')]&&_0x1dc731[_0xf95a('0xda')]===_0xf95a('0xdb')){delete this[_0xf95a('0x20')][_0x1dc731[_0xf95a('0xdc')]];this[_0xf95a('0xac')](this['campaigns'][_0x5dd025['queue']]);_0x46f05a=new Hangup(_0x5dd025,_0x1dc731);_0x46f05a[_0xf95a('0xa0')]=0x12;_0x46f05a[_0xf95a('0xa1')]=_0xf95a('0xde');_0x46f05a[_0xf95a('0xdf')]='AMD';this[_0xf95a('0xc7')](_0x46f05a,_0xf95a('0xe3'),_0xf95a('0xe4'));}if(_0x5dd025[_0xf95a('0x47')]===_0xf95a('0x73')&&this[_0xf95a('0x1a')][_0x5dd025[_0xf95a('0xad')]][_0xf95a('0xd9')]&&_0x1dc731['value']===_0xf95a('0xe2')){delete this[_0xf95a('0x20')][_0x1dc731['uniqueid']];this[_0xf95a('0xac')](this['campaigns'][_0x5dd025[_0xf95a('0xad')]]);_0x46f05a=new Hangup(_0x5dd025,_0x1dc731);_0x46f05a[_0xf95a('0xa0')]=0x13;_0x46f05a[_0xf95a('0xa1')]=_0xf95a('0xe5');_0x46f05a[_0xf95a('0xdf')]='AMD';_0x46f05a[_0xf95a('0xe6')]=!![];this[_0xf95a('0xc7')](_0x46f05a,_0xf95a('0xe7'),_0xf95a('0xe8'));}}};Dialer[_0xf95a('0x14')][_0xf95a('0x2d')]=function(_0x5b1012){var _0x49247c=this[_0xf95a('0x20')][_0x5b1012[_0xf95a('0xdc')]];var _0x2232ff=this;var _0x7af3ca;if(_0x49247c&&_0x49247c['type']===_0xf95a('0x73')){delete this[_0xf95a('0x20')][_0x5b1012['uniqueid']];this[_0xf95a('0xac')](this[_0xf95a('0x1a')][_0x49247c['queue']]);this[_0xf95a('0x1a')][_0x49247c['queue']][_0xf95a('0xe9')]+=0x1;_0x7af3ca=new Hangup(_0x49247c,_0x5b1012);this[_0xf95a('0xc2')](_0x7af3ca)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xea')));this[_0xf95a('0xc0')](_0x7af3ca)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xeb')));}if(_0x49247c&&_0x49247c[_0xf95a('0x47')]!==_0xf95a('0x73')&&isNotNull(this[_0xf95a('0x19')][_0x49247c[_0xf95a('0xad')]]['dialQueueProject'])){delete this[_0xf95a('0x20')][_0x5b1012[_0xf95a('0xdc')]];this[_0xf95a('0xac')](this[_0xf95a('0x19')][_0x49247c[_0xf95a('0xad')]]);this['voiceQueues'][_0x49247c[_0xf95a('0xad')]][_0xf95a('0xdd')]+=0x1;this[_0xf95a('0x19')][_0x49247c[_0xf95a('0xad')]][_0xf95a('0x57')]+=0x1;_0x7af3ca=new Hangup(_0x49247c,_0x5b1012);_0x7af3ca[_0xf95a('0xa0')]=0x10;_0x7af3ca[_0xf95a('0xa1')]=_0xf95a('0xec');_0x7af3ca[_0xf95a('0xdf')]=_0xf95a('0xed');this[_0xf95a('0xc2')](_0x7af3ca)['catch'](loggerCatch(_0xf95a('0xea')));this[_0xf95a('0xc0')](_0x7af3ca)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xeb')));}if(_0x49247c&&_0x49247c['type']!==_0xf95a('0x73')&&!isNotNull(this['voiceQueues'][_0x49247c[_0xf95a('0xad')]][_0xf95a('0xee')])){delete this[_0xf95a('0x20')][_0x5b1012[_0xf95a('0xdc')]];this[_0xf95a('0xac')](this['voiceQueues'][_0x49247c[_0xf95a('0xad')]]);this[_0xf95a('0x19')][_0x49247c[_0xf95a('0xad')]][_0xf95a('0x61')]+=0x1;_0x7af3ca=new Hangup(_0x49247c,_0x5b1012);_0x7af3ca['state']=0xc;_0x7af3ca[_0xf95a('0xa1')]=_0x5b1012[_0xf95a('0xef')];_0x7af3ca['membername']=_0xf95a('0xf0');this['createHistory'](_0x7af3ca)[_0xf95a('0xab')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf95a('0xc0')](_0x7af3ca)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xeb')));}};Dialer[_0xf95a('0x14')][_0xf95a('0x2a')]=function(_0x252ea2){var _0x3a3f7=this[_0xf95a('0x20')][_0x252ea2['uniqueid']];var _0x42990a=this;if(this[_0xf95a('0x19')][_0x252ea2[_0xf95a('0xad')]]){if(_0x3a3f7&&_0x3a3f7['type']!==_0xf95a('0x73')){delete this[_0xf95a('0x20')][_0x252ea2['uniqueid']];this['voiceQueues'][_0x252ea2[_0xf95a('0xad')]]['outboundAnswerCallsDay']+=0x1;var _0x377a39=new AgentComplete(_0x3a3f7,_0x252ea2);if(_0x252ea2[_0xf95a('0xf1')]===_0xf95a('0xf2')){_0x377a39[_0xf95a('0xf3')]=this[_0xf95a('0x19')][_0x252ea2[_0xf95a('0xad')]]['dialQueueProject2']&&this['voiceQueues'][_0x252ea2[_0xf95a('0xad')]][_0xf95a('0xf4')]?moment()[_0xf95a('0x74')](_0xf95a('0xf5')):undefined;}this['createHistory'](_0x377a39)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xf6')));this[_0xf95a('0xc0')](_0x377a39)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xf7')));}}};Dialer[_0xf95a('0x14')][_0xf95a('0x27')]=function(_0x158447){if(this[_0xf95a('0x19')][_0x158447[_0xf95a('0xad')]]){if(this[_0xf95a('0x20')][_0x158447['uniqueid']]&&this[_0xf95a('0x20')][_0x158447[_0xf95a('0xdc')]][_0xf95a('0x47')]!==_0xf95a('0x73')){this['updateOriginated'](this['voiceQueues'][_0x158447[_0xf95a('0xad')]]);this['uniqueId'][_0x158447[_0xf95a('0xdc')]]['answertime']=moment()[_0xf95a('0x74')](_0xf95a('0xf5'));}}};Dialer[_0xf95a('0x14')]['queueCallerAbandonCreateState']=function(_0x421f55){this[_0xf95a('0xc2')](_0x421f55)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xf6')));this['moveContactManagedDialer'](_0x421f55)[_0xf95a('0xab')](loggerCatch(_0xf95a('0xf8')));};Dialer['prototype']['syncQueueCallerAbandon']=function(_0x4a2d10){var _0x387262=this[_0xf95a('0x20')][_0x4a2d10[_0xf95a('0xdc')]];var _0x4e3712=this;if(this[_0xf95a('0x19')][_0x4a2d10['queue']]){if(_0x387262&&_0x387262[_0xf95a('0x47')]!==_0xf95a('0x73')){delete this[_0xf95a('0x20')][_0x4a2d10[_0xf95a('0xdc')]];this['updateOriginated'](this[_0xf95a('0x19')][_0x4a2d10[_0xf95a('0xad')]]);_0x387262['droptime']=moment()[_0xf95a('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x5ef6d3=new QueueCallerAbandon(_0x387262,_0x4a2d10);if(getSeconds(_0x387262[_0xf95a('0xf9')],_0x387262[_0xf95a('0xfa')])>=_0x387262['dialQueueTimeout']){this['voiceQueues'][_0x4a2d10[_0xf95a('0xad')]][_0xf95a('0x65')]+=0x1;this[_0xf95a('0x19')][_0x4a2d10[_0xf95a('0xad')]]['outboundDropCallsDayTimeout']+=0x1;this['voiceQueues'][_0x4a2d10[_0xf95a('0xad')]][_0xf95a('0xfb')]+=0x1;_0x5ef6d3['state']=0xa;_0x5ef6d3[_0xf95a('0xa1')]=_0xf95a('0xfc');_0x5ef6d3[_0xf95a('0xfd')]=_0xf95a('0xfe');_0x5ef6d3[_0xf95a('0xf3')]=this['voiceQueues'][_0x4a2d10[_0xf95a('0xad')]]['dialQueueProject2']?moment()[_0xf95a('0x74')](_0xf95a('0xf5')):undefined;if(_0x5ef6d3['countdropretry']>=this[_0xf95a('0x19')][_0x4a2d10[_0xf95a('0xad')]][_0xf95a('0xff')]-0x1){this['queueCallerAbandonCreateState'](_0x5ef6d3);}else{this[_0xf95a('0xb9')]({'active':![],'countdropretry':_0x5ef6d3[_0xf95a('0x100')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](this[_0xf95a('0x19')][_0x4a2d10['queue']][_0xf95a('0x102')],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x387262['ContactId'],'ListId':_0x387262[_0xf95a('0x104')],'VoiceQueueId':_0x387262[_0xf95a('0xcb')]||undefined,'CampaignId':_0x387262[_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x105')));}}else{this['voiceQueues'][_0x4a2d10[_0xf95a('0xad')]]['predictiveIntervalDroppedCallsCallersExit']+=0x1;this[_0xf95a('0x19')][_0x4a2d10[_0xf95a('0xad')]]['outboundDropCallsDayCallersExit']+=0x1;_0x5ef6d3['state']=0xb;_0x5ef6d3[_0xf95a('0xa1')]=_0xf95a('0x106');_0x5ef6d3[_0xf95a('0xfd')]=_0xf95a('0x107');if(_0x5ef6d3[_0xf95a('0x108')]>=this['voiceQueues'][_0x4a2d10[_0xf95a('0xad')]]['dialAbandonedMaxRetry']-0x1){this['queueCallerAbandonCreateState'](_0x5ef6d3);}else{this[_0xf95a('0xb9')]({'active':![],'countabandonedretry':_0x5ef6d3[_0xf95a('0x108')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](this[_0xf95a('0x19')][_0x4a2d10[_0xf95a('0xad')]]['dialAbandonedRetryFrequency'],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x387262[_0xf95a('0xc9')],'ListId':_0x387262['ListId'],'VoiceQueueId':_0x387262[_0xf95a('0xcb')]||undefined,'CampaignId':_0x387262['CampaignId']||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x109')));}}}}};Dialer[_0xf95a('0x14')][_0xf95a('0x2f')]=function(_0xa088ac){if(this[_0xf95a('0x1f')][_0xa088ac[_0xf95a('0xdc')]]){this[_0xf95a('0x1f')][_0xa088ac['uniqueid']][_0xf95a('0x10a')]=_0xa088ac['channel'];}if(this[_0xf95a('0x20')][_0xa088ac[_0xf95a('0xdc')]]){this[_0xf95a('0x20')][_0xa088ac['uniqueid']][_0xf95a('0x10a')]=_0xa088ac[_0xf95a('0x10a')];}};Dialer[_0xf95a('0x14')][_0xf95a('0x10b')]=function(_0x3fcc1b){if(strategy[this['voiceQueues'][this[_0xf95a('0x1f')][_0x3fcc1b['actionid']][_0xf95a('0xad')]]['strategy']]===_0xf95a('0x13')){if(this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]]&&_[_0xf95a('0xa8')](this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0x10d')])&&_0x3fcc1b['status']==='1'&&_0x3fcc1b['paused']==='0'){if(this[_0xf95a('0x1b')][_0x3fcc1b['stateinterface']]){if(!this[_0xf95a('0x1b')][_0x3fcc1b['stateinterface']][_0xf95a('0x10d')]){this[_0xf95a('0x1b')][_0x3fcc1b['stateinterface']][_0xf95a('0x10d')]=!![];this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0x10d')]=!![];this['actions'][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0x10e')]=_0x3fcc1b[_0xf95a('0x10e')];}}}}else if((strategy[this['voiceQueues'][this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0xad')]][_0xf95a('0x49')]]||_0xf95a('0x12'))===_0xf95a('0x12')){if(this['actions'][_0x3fcc1b[_0xf95a('0x10c')]]){if(this['agents'][_0x3fcc1b[_0xf95a('0x10e')]]){this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0x10e')]=_0x3fcc1b[_0xf95a('0x10e')];if(_[_0xf95a('0xa8')](this[_0xf95a('0x25')][this['actions'][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0xad')]])){this['queueBooked'][this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]][_0xf95a('0xad')]]=[];}this[_0xf95a('0x25')][this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]]['queue']][_0xf95a('0x10f')](_[_0xf95a('0x88')](_[_0xf95a('0xc8')](this[_0xf95a('0x1f')][_0x3fcc1b[_0xf95a('0x10c')]],[_0xf95a('0x110'),_0xf95a('0x10e')]),{'status':_0x3fcc1b['status'],'paused':_0x3fcc1b[_0xf95a('0x111')]}));}}}};function unlockQueueStatus(_0x19fff3,_0x4c044a){setTimeout(function(){if(_[_0xf95a('0x36')](_0x19fff3['queueStatusComplete'])){loggerBooked['error'](_0xf95a('0x112'),_0x4c044a);}_0x19fff3[_0xf95a('0x113')]=!![];loggerBooked[_0xf95a('0x77')](_0xf95a('0x114'),_0x4c044a,JSON['stringify'](_['pick'](_0x19fff3,[_0xf95a('0x3a'),_0xf95a('0x113')])));},0x1f3);}Dialer[_0xf95a('0x14')]['syncQueueStatusComplete']=function(_0x358366){var _0x121e37=this;var _0x34bbf1=_0x121e37[_0xf95a('0x19')][_0x121e37[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]];if(strategy[this[_0xf95a('0x19')][this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]]['strategy']]===_0xf95a('0x13')){if(this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]]&&this[_0xf95a('0x1f')][_0x358366['actionid']][_0xf95a('0x10e')]){this[_0xf95a('0x18')][_0xf95a('0x115')](this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0x110')],this[_0xf95a('0x1f')][_0x358366['actionid']][_0xf95a('0x10e')])[_0xf95a('0xab')](function(_0x156f88){logger['error'](_0xf95a('0x116'),util[_0xf95a('0x90')](_0x156f88,{'showHidden':![],'depth':null}));})[_0xf95a('0x117')](function(){_0x121e37[_0xf95a('0xac')](_0x121e37[_0xf95a('0x19')][_0x121e37[_0xf95a('0x1f')][_0x358366['actionid']][_0xf95a('0xad')]]);_0x121e37[_0xf95a('0x1b')][_0x121e37[_0xf95a('0x1f')][_0x358366['actionid']]['stateinterface']][_0xf95a('0x10d')]=![];delete _0x121e37[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]];unlockQueueStatus(_0x34bbf1);});}else{this[_0xf95a('0xac')](this[_0xf95a('0x19')][this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]]['queue']]);this[_0xf95a('0xb9')]({'active':![],'ContactId':this['actions'][_0x358366[_0xf95a('0x10c')]]['ContactId'],'ListId':this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]]['ListId'],'VoiceQueueId':this['actions'][_0x358366['actionid']][_0xf95a('0xcb')]||undefined,'CampaignId':this[_0xf95a('0x1f')][_0x358366['actionid']][_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x118')));delete this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]];unlockQueueStatus(_0x34bbf1);}}else if((strategy[this['voiceQueues'][this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]][_0xf95a('0x49')]]||'rrmemory')===_0xf95a('0x12')){var _0x29d81a;if(this[_0xf95a('0x1f')][_0x358366['actionid']]&&!_[_0xf95a('0x40')](this['queueBooked'][this['actions'][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]])){if(this[_0xf95a('0x119')][_0x121e37[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]]){this[_0xf95a('0x119')][_0x121e37['actions'][_0x358366['actionid']][_0xf95a('0xad')]]=this['queueBookedRR'][this['actions'][_0x358366[_0xf95a('0x10c')]]['queue']]?this[_0xf95a('0x119')][this[_0xf95a('0x1f')][_0x358366['actionid']][_0xf95a('0xad')]]:this['queueBooked'][this[_0xf95a('0x1f')][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]]?this[_0xf95a('0x25')][this['actions'][_0x358366[_0xf95a('0x10c')]]['queue']]['_rr']||0x0:0x0;}this[_0xf95a('0x25')][this['actions'][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]]['_rr']=this[_0xf95a('0x119')][this['actions'][_0x358366[_0xf95a('0x10c')]][_0xf95a('0xad')]];for(var _0x4ea094=0x0;_0x4ea094=0x0?!![]:![];})['catch'](myreject(_0x298819)));}}else{_0x5bd6c3['push'](ami[_0xf95a('0xa9')]({'action':'command','command':util[_0xf95a('0x74')](_0xf95a('0x132'),_0x229068,!_['isUndefined'](config['timezones'][_0x106796])?_0x106796:'')})[_0xf95a('0xb1')](function(_0x1afcd0){return _0x1afcd0[_0xf95a('0x133')][_0xf95a('0x134')]('true')>=0x0?!![]:![];})[_0xf95a('0xab')](myreject(_0x298819)));}BPromise[_0xf95a('0x135')](_0x5bd6c3)[_0xf95a('0xb1')](function(_0x464bf2){var _0x106fab=_[_0xf95a('0x136')](_0x464bf2);if(_0x106fab){return _0x257027(_0x106fab);}else{_0x11b770[_0xf95a('0x37')]=_0x486bf7?_0xf95a('0x137'):_0xf95a('0x138');return _0x298819(msgResponse(_0xf95a('0x139'),_0xf95a('0x129'),'Global:\x20'+_0x486bf7+'\x20'+_0x1d357f+_0xf95a('0x13a')+util[_0xf95a('0x90')](_0x229068,{'showHidden':![],'depth':null})+_0xf95a('0x13b')+_0x106796));}})[_0xf95a('0xab')](function(_0x450e58){return _0x298819(msgResponse(_0xf95a('0x127'),'Failure',JSON[_0xf95a('0x43')](_0x450e58)));});});};Dialer['prototype'][_0xf95a('0x13c')]=function(_0x56f1b1){var _0x6e6752=this;return function(){switch(_0x56f1b1[_0xf95a('0x55')]){case _0xf95a('0x13d'):freeVariablesPredictive(_0x56f1b1);_0x6e6752['handlePower'](_0x56f1b1,0x1);break;case _0xf95a('0x13e'):freeVariablesPredictive(_0x56f1b1);_0x6e6752[_0xf95a('0x13f')](_0x56f1b1,_0x56f1b1['dialPowerLevel']);break;case _0xf95a('0x5'):_0x6e6752[_0xf95a('0x5')](_0x56f1b1);break;case _0xf95a('0x140'):freeVariablesPredictive(_0x56f1b1);_0x6e6752[_0xf95a('0x13f')](_0x56f1b1,0x1);break;default:freeVariablesPredictive(_0x56f1b1);logger[_0xf95a('0x8f')](_0xf95a('0x141'),_0x56f1b1[_0xf95a('0x3a')],_0xf95a('0x142'));}};};Dialer[_0xf95a('0x14')][_0xf95a('0x143')]=function(_0x5dc7ee){var _0x46c6ed=this;return function(){_0x46c6ed[_0xf95a('0x144')](_0x5dc7ee);};};Dialer[_0xf95a('0x14')]['syncQueueSummary']=function(_0x24f2f8){var _0x56d293=this;if(isNotPreview(_0x24f2f8[_0xf95a('0x55')])){if(isVoiceQueueOutbound(_0x24f2f8[_0xf95a('0x47')])&&isActive(_0x24f2f8[_0xf95a('0x54')])){_0x24f2f8[_0xf95a('0x99')]=!![];BPromise[_0xf95a('0xb4')]()[_0xf95a('0xb1')](checkIsLoggedIn(_0x24f2f8,_0x24f2f8[_0xf95a('0x145')]))[_0xf95a('0xb1')](checkIsActive(_0x24f2f8,_0x24f2f8[_0xf95a('0x54')]))[_0xf95a('0xb1')](checkInterval(_0x24f2f8))['then'](_0x56d293[_0xf95a('0x146')](_0x24f2f8))[_0xf95a('0xb1')](_0x56d293[_0xf95a('0x126')](_0x24f2f8[_0xf95a('0x147')],_0x24f2f8[_0xf95a('0x148')],_0x24f2f8[_0xf95a('0x3a')],_0x24f2f8))['then'](_0x56d293[_0xf95a('0x128')](_0x24f2f8[_0xf95a('0x3c')],_0x24f2f8[_0xf95a('0x148')],_0x24f2f8[_0xf95a('0x3a')],_0x24f2f8))['then'](_0x56d293[_0xf95a('0x13c')](_0x24f2f8))[_0xf95a('0xab')](loggerCatchQueueSummary('[syncQueueSummary]',_0x24f2f8));}else{notSendMessagesQueue(_0x24f2f8);}}else{freeVariablesPredictive(_0x24f2f8);}};Dialer[_0xf95a('0x14')][_0xf95a('0x122')]=function(){var _0x162855=this;var _0xf47d65;for(var _0x176fdd in this[_0xf95a('0x1a')]){if(this[_0xf95a('0x1a')][_0xf95a('0xa7')](_0x176fdd)){_0xf47d65=this[_0xf95a('0x1a')][_0x176fdd];if(isCampaignIvr(_0xf47d65['type'])&&isActive(_0xf47d65['active'])){_0xf47d65['sendMessageOneNotActive']=!![];BPromise['resolve']()['then'](checkIsActive(_0xf47d65,_0xf47d65['active']))[_0xf95a('0xb1')](checkInterval(_0xf47d65))[_0xf95a('0xb1')](_0x162855[_0xf95a('0x146')](_0xf47d65))[_0xf95a('0xb1')](_0x162855[_0xf95a('0x126')](_0xf47d65[_0xf95a('0x147')],_0xf47d65['dialTimezone'],_0xf47d65[_0xf95a('0x3a')],_0xf47d65))[_0xf95a('0xb1')](_0x162855[_0xf95a('0x128')](_0xf47d65['Interval'],_0xf47d65[_0xf95a('0x148')],_0xf47d65['name'],_0xf47d65))[_0xf95a('0xb1')](_0x162855['launchHandleIvr'](_0xf47d65))[_0xf95a('0xab')](loggerCatchQueueSummary(_0xf95a('0x149'),_0xf47d65));}else{notSendMessagesCampaign(_0xf47d65);}}}};function getCallerIdRandom(_0x5b53dc,_0x5ed605){var _0x314a91,_0xd0d277,_0x231f8c;if(_0x5ed605<=0x0){_0x5ed605=0x1;}_0x314a91=new RegExp('\x5cw{0,'+_0x5ed605+'}$');_0xd0d277=Math[_0xf95a('0x14a')](0xa,_0x5ed605-0x1);_0x231f8c=Math[_0xf95a('0x14a')](0xa,_0x5ed605)-0x1;return util[_0xf95a('0x74')]('%s',_[_0xf95a('0x14b')](_0x5b53dc,_0x314a91,_['random'](_0xd0d277,_0x231f8c)));}function extractCalleridName(_0x13cff1){var _0x2cc392=_0x13cff1['match'](/"(.*?)"/);return _0x2cc392?_0x2cc392[0x1]:_0x13cff1;}function extractCalleridNumber(_0x1bf67c){var _0x21a0a2=_0x1bf67c[_0xf95a('0x14c')](/<(.*?)>/);return _0x21a0a2?_0x21a0a2[0x1]:_0x1bf67c;}Dialer['prototype'][_0xf95a('0x14d')]=function(_0x1442e9,_0x53a3c1){var _0x33f506=this;var _0x2ed783=uuid['v4']();this[_0xf95a('0x1f')][_0x2ed783]=new Action(_0x1442e9,_0x53a3c1,_0x2ed783);return new BPromise(function(_0x5359de,_0x4cb97d){if(_['isUndefined'](_0x1442e9)&&_0xf95a('0x14e')!==typeof _0x1442e9){return _0x4cb97d(msgResponse('originate',_0xf95a('0x129'),_0xf95a('0x14f')));}if(_[_0xf95a('0x36')](_0x53a3c1[_0xf95a('0x150')][_0xf95a('0x151')])||_0x53a3c1[_0xf95a('0x150')]['phone']===null){return _0x4cb97d(msgResponse(_0xf95a('0x152'),'Failure',_0xf95a('0x153')));}var _0x2eba31={'XMD-CALLERID':_0x33f506[_0xf95a('0x1f')][_0x2ed783][_0xf95a('0x154')](),'XMD-AGI':_0x1442e9[_0xf95a('0xee')]?util[_0xf95a('0x74')](_0xf95a('0x155'),ipAgi,_0x1442e9['dialQueueProject']):_0xf95a('0x156'),'XMD-AGIAFTER':_0x1442e9[_0xf95a('0x157')]?util[_0xf95a('0x74')](_0xf95a('0x155'),ipAgi,_0x1442e9['dialQueueProject2']):_0xf95a('0x156'),'XMD-QUEUE':_0x1442e9[_0xf95a('0x47')]==='outbound'?util[_0xf95a('0x74')](_0xf95a('0x158'),_0x1442e9[_0xf95a('0x3a')],_0x1442e9[_0xf95a('0x159')]||'',_0x1442e9[_0xf95a('0xf4')]?'c':'',_0x1442e9[_0xf95a('0x15a')]||0x3):_0xf95a('0x156'),'XMD-CONTACTID':_0x53a3c1[_0xf95a('0xc9')],'XMD-CDRTYPE':_0xf95a('0x4'),'CALLERID(all)':_0x33f506['actions'][_0x2ed783][_0xf95a('0x154')](),'XMD-AMD':_0x1442e9['dialAMDActive']?_0xf95a('0x15b'):_0xf95a('0x156'),'XMD-DESTINATION':_0xf95a('0xd8')};if(_0x1442e9[_0xf95a('0xd9')]){_0x2eba31[_0xf95a('0x15c')]=_0x1442e9[_0xf95a('0x15d')]||0x9c4;_0x2eba31['XMD-AMDGREETING']=_0x1442e9['dialAMDGreeting']||0x5dc;_0x2eba31[_0xf95a('0x15e')]=_0x1442e9[_0xf95a('0x15f')]||0x320;_0x2eba31['XMD-AMDTOTALANALYSISTIME']=_0x1442e9['dialAMDTotalAnalysisTime']||0x1388;_0x2eba31[_0xf95a('0x160')]=_0x1442e9[_0xf95a('0x161')]||0x64;_0x2eba31[_0xf95a('0x162')]=_0x1442e9[_0xf95a('0x163')]||0x32;_0x2eba31['XMD-AMDMAXIMUMNUMBEROFWORDS']=_0x1442e9[_0xf95a('0x164')]||0x3;_0x2eba31['XMD-AMDSILENCETHRESHOLD']=_0x1442e9[_0xf95a('0x165')]||0x100;_0x2eba31[_0xf95a('0x166')]=_0x1442e9[_0xf95a('0x167')]||0x1388;}if(_0x1442e9[_0xf95a('0x47')]===_0xf95a('0x48')){_0x2eba31['XMD-VOICEQUEUEID']=_0x53a3c1[_0xf95a('0xcb')];}else{_0x2eba31['XMD-CAMPAIGNID']=_0x53a3c1[_0xf95a('0xcc')];}for(var _0x3e93da in _0x53a3c1['Contact']){if(_0x53a3c1['Contact']['hasOwnProperty'](_0x3e93da)){if(isNotNull(_0x53a3c1['Contact'][_0x3e93da])&&_0x3e93da!=='id'&&_0x3e93da!==_0xf95a('0x168')&&_0x3e93da!=='createdAt'&&_0x3e93da!==_0xf95a('0x169')){_0x2eba31[util['format'](_0xf95a('0x16a'),'XMD-',_['toUpper'](_0x3e93da))]=_0x53a3c1[_0xf95a('0x150')][_0x3e93da];}}}var _0x302ef6=_0x33f506[_0xf95a('0xd1')](_0x1442e9[_0xf95a('0x6f')])?getCallerId(_0x1442e9[_0xf95a('0x6f')][_0xf95a('0x70')],_0x1442e9[_0xf95a('0x16b')],_0x1442e9[_0xf95a('0x16c')]>0x0?getCallerIdRandom(_0x1442e9[_0xf95a('0x16d')],_0x1442e9[_0xf95a('0x16c')]):_0x1442e9['dialOriginateCallerIdNumber']):getCallerId(_[_0xf95a('0xa8')](_0x1442e9[_0xf95a('0x123')])?_0x1442e9['Trunk'][_0xf95a('0x70')]:_0x1442e9['TrunkBackup'][_0xf95a('0x70')],_0x1442e9[_0xf95a('0x16b')],_0x1442e9[_0xf95a('0x16c')]>0x0?getCallerIdRandom(_0x1442e9['dialOriginateCallerIdNumber'],_0x1442e9[_0xf95a('0x16c')]):_0x1442e9[_0xf95a('0x16d')]);if(_0x302ef6){_0x2eba31[_0xf95a('0x16e')]=_0x33f506[_0xf95a('0x1f')][_0x2ed783][_0xf95a('0x16f')]=extractCalleridName(_0x302ef6);_0x2eba31['XMD-ORIGINATECALLERIDNUM']=_0x33f506[_0xf95a('0x1f')][_0x2ed783][_0xf95a('0x170')]=extractCalleridNumber(_0x302ef6);}return ami['Action']({'actionid':_0x2ed783,'action':_0xf95a('0x152'),'channel':_0x33f506[_0xf95a('0xd1')](_0x1442e9[_0xf95a('0x6f')])?util[_0xf95a('0x74')](_0xf95a('0x171'),_0x1442e9[_0xf95a('0x6f')][_0xf95a('0x3a')],isNotNull(_0x1442e9['dialPrefix'])?_0x1442e9['dialPrefix'][_0xf95a('0x172')]()||'':'',_0x1442e9[_0xf95a('0x173')]>0x0?_0x53a3c1[_0xf95a('0x150')]['phone'][_0xf95a('0x174')](_0x1442e9[_0xf95a('0x173')]):_0x53a3c1['Contact'][_0xf95a('0x151')]):util['format'](_0xf95a('0x171'),_[_0xf95a('0xa8')](_0x1442e9[_0xf95a('0x123')])?_0x1442e9[_0xf95a('0x6f')][_0xf95a('0x3a')]:_0x1442e9[_0xf95a('0x123')][_0xf95a('0x3a')],isNotNull(_0x1442e9[_0xf95a('0x56')])?_0x1442e9[_0xf95a('0x56')][_0xf95a('0x172')]()||'':'',_0x1442e9[_0xf95a('0x173')]>0x0?_0x53a3c1[_0xf95a('0x150')][_0xf95a('0x151')][_0xf95a('0x174')](_0x1442e9[_0xf95a('0x173')]):_0x53a3c1[_0xf95a('0x150')][_0xf95a('0x151')]),'callerid':_0x302ef6,'Exten':'xcally-motion-dialer','Context':'from-sip','Priority':'1','variable':_0x2eba31,'timeout':(_0x1442e9['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x2ed783})['then'](function(_0x5db057){return _0x5359de(_0x5db057);})[_0xf95a('0xab')](function(_0xd3021e){_0x1442e9['outboundOriginateFailureCallsDay']+=0x1;var _0x1f1a67=new History(_0x33f506['actions'][_0x2ed783]);logger[_0xf95a('0x8f')](util[_0xf95a('0x74')]('[originateError]:\x20%s',JSON[_0xf95a('0x43')](_0xd3021e)));_0x1f1a67[_0xf95a('0xa0')]=0xe;_0x1f1a67[_0xf95a('0xa1')]=_0xf95a('0x175');_0x1f1a67[_0xf95a('0xa3')]=moment()[_0xf95a('0x74')](_0xf95a('0xf5'));_0x1f1a67[_0xf95a('0xa2')]=_0x1f1a67[_0xf95a('0xa3')];_0x33f506['createHistory'](_0x1f1a67)[_0xf95a('0xab')](loggerCatch('[originate][error]'));_0x33f506[_0xf95a('0xc0')](_0x1f1a67)[_0xf95a('0xab')](loggerCatch(_0xf95a('0x176')))['finally'](function(){delete _0x33f506['actions'][_0x2ed783];return _0x4cb97d(msgResponse('originate','Error',_0xf95a('0x177')));});});});};Dialer['prototype'][_0xf95a('0x178')]=function(_0x370440){var _0x21b597=this['actions'][_0x370440[_0xf95a('0x10c')]];var _0x25fc30=this;if(_0x21b597){delete this[_0xf95a('0x1f')][_0x370440[_0xf95a('0x10c')]];_0x21b597[_0xf95a('0xfa')]=moment()[_0xf95a('0x74')]('YYYY-MM-DD\x20HH:mm:ss');var _0x10ca44=_0x21b597[_0xf95a('0x47')]==='ivr'?this[_0xf95a('0x1a')][_0x21b597[_0xf95a('0xad')]]:this['voiceQueues'][_0x21b597[_0xf95a('0x179')]()];if(!this[_0xf95a('0xcf')](_0x370440['response'])){this[_0xf95a('0xac')](_0x10ca44);return this[_0xf95a('0x17a')](_0x21b597,_0x10ca44,_0x370440)[_0xf95a('0xb1')](function(_0x5945e6){})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x17b')));}else{this[_0xf95a('0x20')][_0x370440[_0xf95a('0xdc')]]=_0x21b597;}}};Dialer[_0xf95a('0x14')][_0xf95a('0x17c')]=function(_0x48bb5a,_0x1a4ce1,_0x11952a){var _0x341be0=new History(_0x1a4ce1);if(_0x341be0[_0xf95a('0x17d')]+_0x341be0[_0xf95a('0x17e')]+_0x341be0['countnoanswerretry']+_0x341be0[_0xf95a('0x17f')]+_0x341be0['countdropretry']+_0x341be0[_0xf95a('0x108')]+_0x341be0['countmachineretry']+_0x341be0[_0xf95a('0x180')]>=_0x11952a[_0xf95a('0x181')]-0x1){return!![];}switch(_0x48bb5a){case 0x3:if(_0x341be0[_0xf95a('0x182')]>=_0x11952a['dialNoAnswerMaxRetry']-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countnoanswerretry':_0x341be0[_0xf95a('0x182')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a[_0xf95a('0x183')],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0[_0xf95a('0xcb')]||undefined,'CampaignId':_0x341be0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x341be0[_0xf95a('0x17d')]>=_0x11952a['dialBusyMaxRetry']-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countbusyretry':_0x341be0[_0xf95a('0x17d')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a[_0xf95a('0x184')],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0['VoiceQueueId']||undefined,'CampaignId':_0x341be0['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact]\x20[Busy]'));}break;case 0x8:if(_0x341be0[_0xf95a('0x17e')]>=_0x11952a[_0xf95a('0x185')]-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countcongestionretry':_0x341be0[_0xf95a('0x17e')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a['dialCongestionRetryFrequency'],_0xf95a('0x103'))['format'](_0xf95a('0xf5')),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0[_0xf95a('0xcb')]||undefined,'CampaignId':_0x341be0[_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x186')));}break;case 0x0:if(_0x341be0[_0xf95a('0x17f')]>=_0x11952a[_0xf95a('0x187')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countnosuchnumberretry':_0x341be0[_0xf95a('0x17f')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a['dialNoSuchNumberRetryFrequency'],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0[_0xf95a('0xcb')]||undefined,'CampaignId':_0x341be0[_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch('[rescheduleContact][NoSuchNumber]'));}break;case 0xa:if(_0x341be0[_0xf95a('0x100')]>=_0x11952a[_0xf95a('0xff')]-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countdropretry':_0x341be0[_0xf95a('0x100')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a[_0xf95a('0x102')],_0xf95a('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0['VoiceQueueId']||undefined,'CampaignId':_0x341be0[_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x105')));}break;case 0xb:if(_0x341be0[_0xf95a('0x108')]>=_0x11952a['dialAbandonedMaxRetry']-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countabandonedretry':_0x341be0['countabandonedretry']+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a[_0xf95a('0x188')],_0xf95a('0x103'))[_0xf95a('0x74')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0[_0xf95a('0xcb')]||undefined,'CampaignId':_0x341be0['CampaignId']||undefined})[_0xf95a('0xab')](loggerCatch('[rescheduleContact][Abandoned]'));}break;case 0x13:if(_0x341be0[_0xf95a('0x189')]>=_0x11952a[_0xf95a('0x18a')]-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countmachineretry':_0x341be0['countmachineretry']+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a['dialMachineRetryFrequency'],_0xf95a('0x103'))[_0xf95a('0x74')](_0xf95a('0xf5')),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0['VoiceQueueId']||undefined,'CampaignId':_0x341be0[_0xf95a('0xcc')]||undefined})['catch'](loggerCatch(_0xf95a('0x18b')));}break;case 0x14:if(_0x341be0[_0xf95a('0x180')]>=_0x11952a[_0xf95a('0x18c')]-0x1){return!![];}else{this[_0xf95a('0xb9')]({'active':![],'countagentrejectretry':_0x341be0[_0xf95a('0x180')]+=0x1,'scheduledat':moment()[_0xf95a('0x101')](_0x11952a['dialAgentRejectRetryFrequency'],_0xf95a('0x103'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x341be0[_0xf95a('0xc9')],'ListId':_0x341be0[_0xf95a('0x104')],'VoiceQueueId':_0x341be0[_0xf95a('0xcb')]||undefined,'CampaignId':_0x341be0[_0xf95a('0xcc')]||undefined})['catch'](loggerCatch(_0xf95a('0x18d')));}break;default:return!![];}};Dialer[_0xf95a('0x14')]['callProgressDetecting']=function(_0x5c8990,_0x52dc08,_0x27d6e6){var _0xf44107=this;var _0x5f0951=new History(_0x5c8990);return new BPromise(function(_0x2f7fa2,_0x23f80f){if(_[_0xf95a('0x36')](_0x52dc08)&&_0xf95a('0x14e')!==typeof _0x52dc08){return _0x23f80f(msgResponse(_0xf95a('0x18e'),_0xf95a('0x129'),_0xf95a('0x18f')));}if(_[_0xf95a('0x36')](_0x27d6e6)&&_0xf95a('0x14e')!==typeof _0x27d6e6){return _0x23f80f(msgResponse('[callProgressDetecting]','Failure',_0xf95a('0x190')));}switch(_0x27d6e6[_0xf95a('0xf1')]){case'0':_0x52dc08[_0xf95a('0x5e')]+=0x1;_0x5f0951[_0xf95a('0xa0')]=0x0;_0x5f0951[_0xf95a('0xa1')]=_0xf95a('0x191');_0xf44107[_0xf95a('0xc2')](_0x5f0951)[_0xf95a('0xab')](loggerCatch(_0xf95a('0x192')));if(_0xf44107[_0xf95a('0x17c')](0x0,_0x5c8990,_0x52dc08)){if(_0x5f0951['countbusyretry']+_0x5f0951[_0xf95a('0x17e')]+_0x5f0951[_0xf95a('0x182')]+_0x5f0951[_0xf95a('0x17f')]+_0x5f0951[_0xf95a('0x100')]+_0x5f0951[_0xf95a('0x108')]+_0x5f0951[_0xf95a('0x189')]+_0x5f0951[_0xf95a('0x180')]>=_0x52dc08['dialGlobalMaxRetry']){_0xf44107['stateGlobal'](_0x5f0951,_0x2f7fa2,_0x23f80f,'reason\x200\x20no\x20such\x20number....');}else{_0xf44107[_0xf95a('0x193')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x194'));}}break;case'3':_0x52dc08['outboundNoAnswerCallsDay']+=0x1;_0x5f0951[_0xf95a('0xa0')]=0x3;_0x5f0951['statedesc']=_0xf95a('0x195');_0x5f0951[_0xf95a('0x182')]+=0x1;_0x5f0951['countglobal']+=0x1;_0xf44107[_0xf95a('0xc2')](_0x5f0951)[_0xf95a('0xab')](loggerCatch(_0xf95a('0x196')));if(_0xf44107[_0xf95a('0x17c')](0x3,_0x5c8990,_0x52dc08)){if(_0x5f0951['countnoanswerretry']>=_0x52dc08[_0xf95a('0x197')]){_0xf44107['createStateFinal'](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x198'));}else{_0xf44107['stateGlobal'](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x198'));}}break;case'5':_0x52dc08[_0xf95a('0x58')]+=0x1;_0x5f0951[_0xf95a('0xa0')]=0x5;_0x5f0951[_0xf95a('0xa1')]=_0xf95a('0x199');_0x5f0951[_0xf95a('0x17d')]+=0x1;_0x5f0951[_0xf95a('0x19a')]+=0x1;_0xf44107[_0xf95a('0xc2')](_0x5f0951)[_0xf95a('0xab')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0xf44107['checkRetriveMax'](0x5,_0x5c8990,_0x52dc08)){if(_0x5f0951[_0xf95a('0x17d')]>=_0x52dc08[_0xf95a('0x19b')]){_0xf44107[_0xf95a('0x193')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x19c'));}else{_0xf44107[_0xf95a('0x19d')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x19c'));}}break;case'8':_0x52dc08[_0xf95a('0x59')]+=0x1;_0x5f0951[_0xf95a('0xa0')]=0x8;_0x5f0951['statedesc']='Congestion';_0x5f0951[_0xf95a('0x17e')]+=0x1;_0x5f0951[_0xf95a('0x19a')]+=0x1;_0xf44107['createHistory'](_0x5f0951)[_0xf95a('0xab')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0xf44107[_0xf95a('0x17c')](0x8,_0x5c8990,_0x52dc08)){if(_0x5f0951[_0xf95a('0x17e')]>=_0x52dc08[_0xf95a('0x185')]){_0xf44107[_0xf95a('0x193')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x19e'));}else{_0xf44107[_0xf95a('0x19d')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x19e'));}}break;case'11':_0x52dc08[_0xf95a('0x19f')]+=0x1;_0x5f0951['state']=0xb;_0x5f0951[_0xf95a('0xa1')]=_0xf95a('0x106');_0x5f0951['countabandonedretry']+=0x1;_0x5f0951[_0xf95a('0x19a')]+=0x1;_0xf44107[_0xf95a('0xc2')](_0x5f0951)[_0xf95a('0xab')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0xf44107['checkRetriveMax'](0xb,_0x5c8990,_0x52dc08)){if(_0x5f0951[_0xf95a('0x108')]>=_0x52dc08[_0xf95a('0x1a0')]){_0xf44107['createStateFinal'](_0x5f0951,_0x2f7fa2,_0x23f80f,'reason\x2011\x20abandoned');}else{_0xf44107[_0xf95a('0x19d')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x1a1'));}}break;case'20':_0x52dc08['outboundRejectCallsDay']+=0x1;_0x5f0951[_0xf95a('0xa0')]=0x14;_0x5f0951[_0xf95a('0xa1')]='AgentReject';_0x5f0951[_0xf95a('0x180')]+=0x1;_0x5f0951[_0xf95a('0x19a')]+=0x1;_0xf44107[_0xf95a('0xc2')](_0x5f0951)[_0xf95a('0xab')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0xf44107[_0xf95a('0x17c')](0x14,_0x5c8990,_0x52dc08)){if(_0x5f0951[_0xf95a('0x180')]>=_0x52dc08[_0xf95a('0x18c')]){_0xf44107[_0xf95a('0x193')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x1a2'));}else{_0xf44107[_0xf95a('0x19d')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0xf95a('0x1a2'));}}break;default:_0x52dc08[_0xf95a('0x61')]+=0x1;_0x5f0951[_0xf95a('0xa0')]=0xc;_0x5f0951[_0xf95a('0xa1')]=_0x27d6e6[_0xf95a('0xf1')];_0xf44107['createHistory'](_0x5f0951)[_0xf95a('0xab')](loggerCatch(_0xf95a('0x1a3')));if(_0xf44107[_0xf95a('0x17c')](_0x27d6e6[_0xf95a('0xf1')],_0x5c8990,_0x52dc08)){if(_0x5f0951[_0xf95a('0x17d')]+_0x5f0951['countcongestionretry']+_0x5f0951[_0xf95a('0x182')]+_0x5f0951[_0xf95a('0x17f')]+_0x5f0951[_0xf95a('0x100')]+_0x5f0951[_0xf95a('0x108')]+_0x5f0951['countmachineretry']+_0x5f0951[_0xf95a('0x180')]>=_0x52dc08[_0xf95a('0x181')]){_0xf44107[_0xf95a('0x19d')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0x27d6e6[_0xf95a('0xf1')]);}else{_0xf44107[_0xf95a('0x193')](_0x5f0951,_0x2f7fa2,_0x23f80f,_0x27d6e6[_0xf95a('0xf1')]);}}}});};Dialer['prototype'][_0xf95a('0x19d')]=function(_0x3ce77a,_0x540f5c,_0x4fc0ae,_0x1d191c){var _0x5393fb=new Final(_0x3ce77a);_0x5393fb[_0xf95a('0xa0')]=0xf;_0x5393fb['statedesc']='Global';this[_0xf95a('0x193')](_0x5393fb,_0x540f5c,_0x4fc0ae,_0x1d191c);};Dialer[_0xf95a('0x14')][_0xf95a('0x193')]=function(_0x285de8,_0x14179e,_0x98fc9a,_0x57ad7b){this['moveContactManagedDialer'](_0x285de8)[_0xf95a('0xb1')](function(_0x5d0021){return _0x14179e(msgResponse(_0xf95a('0x18e'),_0xf95a('0xd0'),_0x57ad7b));})[_0xf95a('0xab')](function(_0x1c0ec7){return _0x98fc9a(msgResponse(_0xf95a('0x1a4'),_0xf95a('0x129'),_0xf95a('0x1a5')));});};Dialer[_0xf95a('0x14')][_0xf95a('0x5')]=function(_0x7b6e1b){var _0x1dc4c9=this;var _0x39b467=_0x7b6e1b[_0xf95a('0x1a6')]/0x64;var _0x3c65dc=_0x7b6e1b['outboundDropCallsDayTimeout']/(_0x7b6e1b[_0xf95a('0x5c')]+_0x7b6e1b['outboundAnswerCallsDay']);var _0x47dad4=Math[_0xf95a('0x1a7')](_0x7b6e1b[_0xf95a('0x69')]*(_0x7b6e1b[_0xf95a('0x1a8')]/0x64));var _0x561bd7=Math[_0xf95a('0x1a7')](_0x7b6e1b[_0xf95a('0x69')]*(_0x7b6e1b[_0xf95a('0x1a9')]/0x64));var _0x31b444=_0x7b6e1b[_0xf95a('0x4b')]+_0x7b6e1b[_0xf95a('0x4e')];var _0x3c55f9=Math['floor'](_0x7b6e1b['erlangCalls']*_0x7b6e1b[_0xf95a('0x85')]*_0x7b6e1b[_0xf95a('0x67')]*_0x7b6e1b[_0xf95a('0x68')]);if(_[_0xf95a('0x36')](_0x7b6e1b[_0xf95a('0x23')])){if(!_[_0xf95a('0x36')](_0x7b6e1b['startPredictive'])){_0x7b6e1b[_0xf95a('0x22')]=undefined;loggerPredictive[_0xf95a('0x8f')]('[startMethodPredictive][StartProgressive]',_0xf95a('0x1aa'));}if(!_[_0xf95a('0x36')](_0x7b6e1b[_0xf95a('0x8b')])){loggerPredictive[_0xf95a('0x8f')](_0xf95a('0x1ab'),_0xf95a('0x1ac'));clearInterval(_0x7b6e1b[_0xf95a('0x8b')]);_0x7b6e1b[_0xf95a('0x8b')]=undefined;}_0x7b6e1b[_0xf95a('0x23')]=moment()[_0xf95a('0x74')](_0xf95a('0xf5'));loggerPredictive[_0xf95a('0x77')](_0x7b6e1b[_0xf95a('0x3a')],_0xf95a('0x1ad'),_0x7b6e1b['startProgressive']);this[_0xf95a('0x13f')](_0x7b6e1b,0x1);}else if(ifInterval(_0x7b6e1b[_0xf95a('0x1ae')],_0x7b6e1b[_0xf95a('0x23')])){this[_0xf95a('0x13f')](_0x7b6e1b,0x1);loggerPredictiveCalls[_0xf95a('0x77')]('[startMethodPredictive][StartProgressive][Loop]',_0x7b6e1b['startProgressive'],_0x7b6e1b[_0xf95a('0x3a')]);_0x7b6e1b['erlangCalls']=0x0;_0x7b6e1b[_0xf95a('0xfb')]=0x0;}else if(_0x39b467<_0x3c65dc&&_0x7b6e1b['dialPredictiveOptimization']==='dropRate'){freeVariablesPredictive(_0x7b6e1b);loggerPredictive[_0xf95a('0x77')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0xf95a('0x1af'),_0x3c65dc,_0xf95a('0x23'),_0x7b6e1b[_0xf95a('0x3a')]);}else if(_0x3c55f9<_0x7b6e1b[_0xf95a('0xfb')]&&_0x7b6e1b[_0xf95a('0x1b0')]===_0xf95a('0x1b1')){freeVariablesPredictive(_0x7b6e1b);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1b2'),'Max\x20Drop\x20',_0x3c55f9,_0xf95a('0x1b3'),_0x7b6e1b['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x7b6e1b[_0xf95a('0x3a')]);}else if(!ifInterval(_0x7b6e1b['dialPredictiveInterval'],_0x7b6e1b[_0xf95a('0x23')])&&_[_0xf95a('0x36')](_0x7b6e1b[_0xf95a('0x22')])&&!_[_0xf95a('0x36')](_0x7b6e1b['startProgressive'])){_0x7b6e1b[_0xf95a('0x22')]=moment()[_0xf95a('0x74')](_0xf95a('0xf5'));loggerPredictive[_0xf95a('0x77')](_0x7b6e1b['name'],_0xf95a('0x1b4'),_0x7b6e1b[_0xf95a('0x22')]);this['averageHandleTime'](_0x7b6e1b['dialPredictiveInterval'])[_0xf95a('0xb1')](this[_0xf95a('0x1b5')](_0x7b6e1b))[_0xf95a('0xb1')](mergeDataErlangB(_0x7b6e1b))[_0xf95a('0xb1')](this['startMethodPredictive'](_0x7b6e1b))[_0xf95a('0xab')](loggerCatchPredictive(_0xf95a('0x1b6'),_0x7b6e1b));}else if(!ifInterval(_0x7b6e1b[_0xf95a('0x1ae')],_0x7b6e1b[_0xf95a('0x22')])){_0x7b6e1b[_0xf95a('0xfb')]=0x0;_0x7b6e1b[_0xf95a('0x22')]=moment()[_0xf95a('0x74')](_0xf95a('0xf5'));loggerPredictive['info'](_0x7b6e1b[_0xf95a('0x3a')],_0xf95a('0x1b7'),_0x7b6e1b[_0xf95a('0x22')]);clearInterval(_0x7b6e1b[_0xf95a('0x8b')]);_0x7b6e1b[_0xf95a('0x8b')]=undefined;this['averageHandleTime'](_0x7b6e1b[_0xf95a('0x1ae')])[_0xf95a('0xb1')](this[_0xf95a('0x1b5')](_0x7b6e1b))[_0xf95a('0xb1')](mergeDataErlangB(_0x7b6e1b))[_0xf95a('0xb1')](this[_0xf95a('0x1b8')](_0x7b6e1b))['catch'](loggerCatchPredictive(_0xf95a('0x1b9'),_0x7b6e1b));}else if(_0x7b6e1b[_0xf95a('0x69')]&&_0x31b444<_0x7b6e1b[_0xf95a('0x69')]-_0x561bd7){freeVariablesPredictive(_0x7b6e1b);loggerPredictive[_0xf95a('0x77')](_0x7b6e1b[_0xf95a('0x3a')],_0xf95a('0x1ba'),_0x31b444,_0xf95a('0x1bb'),_0x7b6e1b[_0xf95a('0x69')],'-',_0x561bd7,'=',_0x7b6e1b[_0xf95a('0x69')]-_0x561bd7,')');}else if(_0x7b6e1b[_0xf95a('0x69')]&&_0x31b444>_0x7b6e1b['predictiveIntervalAvailable']+_0x47dad4){freeVariablesPredictive(_0x7b6e1b);loggerPredictive[_0xf95a('0x77')](_0x7b6e1b[_0xf95a('0x3a')],_0xf95a('0x1ba'),_0x31b444,')\x20are\x20more\x20than\x20threshold\x20(',_0x7b6e1b['predictiveIntervalAvailable'],'+',_0x47dad4,'=',_0x7b6e1b[_0xf95a('0x69')]+_0x47dad4,')');}};Dialer[_0xf95a('0x14')][_0xf95a('0x1b5')]=function(_0x9b6297){var _0x54a1c3=this;return function(_0x119384){return new BPromise(function(_0x571a74,_0x348cb4){_[_0xf95a('0x88')](_0x9b6297,_0x119384[0x0]);if(checkGetDataPredictive(_0x119384[0x0])){var _0x2735f2=_0x9b6297[_0xf95a('0x69')]=_0x9b6297[_0xf95a('0x4e')]+_0x9b6297[_0xf95a('0x4b')];var _0x2384b0=_0x9b6297['dialPredictiveInterval']*0x3c;var _0x226826=_0x119384[0x0][_0xf95a('0x63')]+_0x119384[0x0][_0xf95a('0x62')];var _0x399e48=(_0x119384[0x0]['predictiveIntervalAnsweredCalls']+_0x119384[0x0][_0xf95a('0x65')]+_0x119384[0x0][_0xf95a('0x64')])/_0x119384[0x0][_0xf95a('0x6a')];_0x9b6297[_0xf95a('0x67')]=_0x399e48>0x0?_0x399e48:0x1;switch(_0x9b6297[_0xf95a('0x1b0')]){case _0xf95a('0x1b1'):var _0x584602=_0x9b6297[_0xf95a('0x1a6')]/0x64;return _0x54a1c3[_0xf95a('0x1bc')](_0x2735f2,_0x2384b0,_0x226826,_0x399e48,_0x584602)[_0xf95a('0xb1')](function(_0x2a211c){return _0x571a74(_0x2a211c);});case _0xf95a('0x1bd'):var _0x51834a=_0x9b6297['dialPredictiveOptimizationPercentage']/0x64;return _0x54a1c3['busyFactor'](_0x2735f2,_0x2384b0,_0x226826,_0x399e48,_0x51834a)[_0xf95a('0xb1')](function(_0x492fdb){return _0x571a74(_0x492fdb);});default:return _0x348cb4(msgResponse(_0xf95a('0x1be'),_0xf95a('0x129'),'Unknown\x20Predictive'));}}else{return _0x348cb4(msgResponse('[getDataPredictive]',_0xf95a('0x129'),'check\x20failure'));}});};};Dialer[_0xf95a('0x14')][_0xf95a('0x1bf')]=function(_0x683b19){var _0x1c1c04=this;return function(_0x269892){return new BPromise(function(_0x114acb,_0x37687b){_['merge'](_0x683b19,_0x269892[0x0]);if(checkGetDataPredictive(_0x269892[0x0])){loggerPredictive[_0xf95a('0x77')](JSON[_0xf95a('0x43')](_0x269892[0x0]));if(_0x683b19[_0xf95a('0x1b0')]==='dropRate'){return _0x1c1c04['getVoiceQueueRtPauses'](_0x683b19['id'])[_0xf95a('0xb1')](function(_0x3e1945){var _0x38efae=_0x683b19['loggedIn']-_0x3e1945[0x0][_0xf95a('0x1c0')];var _0x5b65b3=_0x683b19[_0xf95a('0x1ae')]*0x3c;var _0x2b2c15=_0x269892[0x0][_0xf95a('0x63')]+_0x269892[0x0][_0xf95a('0x62')];var _0x3011ed=(_0x269892[0x0][_0xf95a('0x7b')]+_0x269892[0x0][_0xf95a('0x65')]+_0x269892[0x0][_0xf95a('0x64')])/_0x269892[0x0][_0xf95a('0x6a')];var _0x597fd4=_0x683b19[_0xf95a('0x1a6')]/0x64;_0x683b19[_0xf95a('0x1c1')]=_0x3e1945[0x0][_0xf95a('0x1c0')]||0x0;_0x683b19[_0xf95a('0x67')]=_0x3011ed>0x0?_0x3011ed:0x1;return _0x1c1c04[_0xf95a('0x1bc')](_0x38efae,_0x5b65b3,_0x2b2c15,_0x3011ed,_0x597fd4);})[_0xf95a('0xb1')](function(_0x471e39){return _0x114acb(_0x471e39);})[_0xf95a('0xab')](function(_0x3d4a16){return _0x37687b(msgResponse(_0xf95a('0x1c2'),_0xf95a('0x129'),JSON[_0xf95a('0x43')](_0x3d4a16)));});}if(_0x683b19['dialPredictiveOptimization']==='agentBusyFactor'){return _0x1c1c04[_0xf95a('0xbf')](_0x683b19['id'])['then'](function(_0x2256e3){var _0x444049=_0x683b19[_0xf95a('0x145')]-_0x2256e3[0x0][_0xf95a('0x1c0')];var _0x55bac2=_0x683b19['dialPredictiveInterval']*0x3c;var _0x587f60=_0x269892[0x0]['predictiveIntervalAvgTalktime']+_0x269892[0x0]['predictiveIntervalAvgHoldtime'];var _0x29dc9f=(_0x269892[0x0][_0xf95a('0x7b')]+_0x269892[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x269892[0x0][_0xf95a('0x64')])/_0x269892[0x0][_0xf95a('0x6a')];var _0x666d68=_0x683b19[_0xf95a('0x1a6')]/0x64;_0x683b19[_0xf95a('0x1c1')]=_0x2256e3[0x0][_0xf95a('0x1c0')]||0x0;_0x683b19[_0xf95a('0x67')]=_0x29dc9f>0x0?_0x29dc9f:0x1;return _0x1c1c04['busyFactor'](_0x444049,_0x55bac2,_0x587f60,_0x29dc9f,_0x666d68);})[_0xf95a('0xb1')](function(_0x3ac811){return _0x114acb(_0x3ac811);})['catch'](function(_0x36b1b4){return _0x37687b(msgResponse(_0xf95a('0x1c2'),_0xf95a('0x129'),JSON[_0xf95a('0x43')](_0x36b1b4)));});}}else{return _0x37687b(msgResponse(_0xf95a('0x1be'),_0xf95a('0x129'),_0xf95a('0x1c3')));}});};};Dialer[_0xf95a('0x14')]['startMethodPredictive']=function(_0x486006){var _0x4c84d9=this;return function(){var _0x6cb8c3=0x0;var _0x19d638=Math[_0xf95a('0x1c4')](_0x486006[_0xf95a('0x6d')]*0x3e8);if(_0x19d638>0x0){_0x19d638=_0x19d638<0x64?0x64:_0x19d638;loggerPredictive[_0xf95a('0x77')](_0x486006[_0xf95a('0x3a')],_0xf95a('0x1c5'),_0x19d638,_0xf95a('0x44'));_0x486006[_0xf95a('0x8b')]=setInterval(function(){_0x4c84d9[_0xf95a('0x8b')](_0x486006);loggerPredictiveCalls[_0xf95a('0x77')](_0xf95a('0x1c6'),_0x6cb8c3+=0x1);},_0x19d638);}else{loggerPredictive[_0xf95a('0x77')](_0x486006[_0xf95a('0x3a')],_0xf95a('0x1c7'));}};};Dialer[_0xf95a('0x14')][_0xf95a('0x1c8')]=function(_0xbcb2cb,_0x5ab3e9){var _0x971aa8=this;return function(_0x45ffb9){if(_[_0xf95a('0x40')](_0x45ffb9)){if(_[_0xf95a('0xa8')](_0x5ab3e9[_0xf95a('0xca')])||!_0x5ab3e9[_0xf95a('0x1c9')]){if(_0xbcb2cb[_0xf95a('0x55')]===_0xf95a('0x140')){_0xbcb2cb[_0xf95a('0x113')]=_[_0xf95a('0x36')](_0xbcb2cb['queueStatusComplete'])?!![]:_0xbcb2cb['queueStatusComplete'];var _0x2dbf3e=uuid['v4']();_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e]=new Action(_0xbcb2cb,_0x5ab3e9,_0x2dbf3e);loggerBooked[_0xf95a('0x77')]('[booked][checkContactBlack]',_0x2dbf3e,_0xf95a('0x1ca'),JSON['stringify'](_0xbcb2cb[_0xf95a('0x113')]),_0xf95a('0x1cb'),_0xbcb2cb[_0xf95a('0x3a')]);if(_0xbcb2cb['queueStatusComplete']){_0xbcb2cb['queueStatusComplete']=![];_0x971aa8['queueBooked'][_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e][_0xf95a('0xad')]]=[];ami[_0xf95a('0xa9')]({'actionid':_0x2dbf3e,'action':_0xf95a('0x1cc'),'queue':_0xbcb2cb[_0xf95a('0x3a')]})[_0xf95a('0xab')](function(_0x263021){_0x971aa8[_0xf95a('0xac')](_0xbcb2cb);_0x971aa8['rescheduleContact']({'active':![],'ContactId':_0x971aa8['actions'][_0x2dbf3e]['ContactId'],'ListId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e][_0xf95a('0x104')],'VoiceQueueId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e]['VoiceQueueId']||undefined,'CampaignId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e][_0xf95a('0xcc')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x971aa8['actions'][_0x2dbf3e];});}else{loggerBooked[_0xf95a('0x77')](_0xf95a('0x1cd'),JSON['stringify'](_0xbcb2cb[_0xf95a('0x113')]),_0xf95a('0x1cb'),_0xbcb2cb[_0xf95a('0x3a')]);_0x971aa8[_0xf95a('0xac')](_0xbcb2cb);_0x971aa8[_0xf95a('0xb9')]({'active':![],'ContactId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e]['ContactId'],'ListId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e][_0xf95a('0x104')],'VoiceQueueId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e]['VoiceQueueId']||undefined,'CampaignId':_0x971aa8[_0xf95a('0x1f')][_0x2dbf3e][_0xf95a('0xcc')]||undefined})['catch'](loggerCatch(_0xf95a('0x1ce')));delete _0x971aa8['actions'][_0x2dbf3e];}}else{return _0x971aa8[_0xf95a('0x14d')](_0xbcb2cb,_0x5ab3e9);}}else{if(getDiff(_0x5ab3e9['scheduledat'])<_0xbcb2cb[_0xf95a('0x1cf')]*0x3c){if(_0x5ab3e9[_0xf95a('0x1d0')]&&!_0x5ab3e9[_0xf95a('0x1d0')][_0xf95a('0x1d1')]){_0x971aa8[_0xf95a('0x18')]['run'](_0x5ab3e9['id'])['finally'](function(){_0x971aa8[_0xf95a('0xac')](_0xbcb2cb);});}else{_0x971aa8['unlockContact']({'active':![]},_0x5ab3e9['id'],0x1)[_0xf95a('0x117')](function(){console[_0xf95a('0x1d2')](_0xf95a('0x1d3'));_0x971aa8[_0xf95a('0xac')](_0xbcb2cb);});}}else{_0xbcb2cb[_0xf95a('0x60')]+=0x1;_0x971aa8['updateOriginated'](_0xbcb2cb);if(_0xbcb2cb[_0xf95a('0x1d4')]){_0x971aa8[_0xf95a('0xb9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5ab3e9[_0xf95a('0xc9')],'ListId':_0x5ab3e9['ListId'],'VoiceQueueId':_0x5ab3e9[_0xf95a('0xcb')]||undefined,'CampaignId':_0x5ab3e9[_0xf95a('0xcc')]||undefined})[_0xf95a('0xab')](loggerCatch(_0xf95a('0x1d5')));_0x971aa8['createHistory'](createObjHistory(_0xbcb2cb,_0x5ab3e9,_0xf95a('0x1d6'),0x17,_0xf95a('0x1d7')))[_0xf95a('0xab')](loggerCatch(_0xf95a('0x1d8')));}else{_0x971aa8['saveInDb'](createObjHistory(_0xbcb2cb,_0x5ab3e9,'RECALLFAILEDTIMEOUT',0x16,_0xf95a('0x1d9')),_0xf95a('0x1da'),_0xf95a('0x1db'));}}}}else{_0xbcb2cb['outboundBlacklistCallsDay']+=0x1;_0x971aa8[_0xf95a('0xc7')](createObjHistory(_0xbcb2cb,_0x5ab3e9,_0xf95a('0x1dc'),0xd,_0xf95a('0x1dd')),_0xf95a('0x1de'),'[Originate][MoveBlacklist]');throw _0xf95a('0x1df');}};};Dialer[_0xf95a('0x14')][_0xf95a('0x144')]=function(_0x2d39d8){var _0x5344e1=this;var _0x5e4d17=[];var _0x59a9c1=_0x2d39d8[_0xf95a('0x1e0')]-_0x2d39d8[_0xf95a('0x6b')]-_0x2d39d8[_0xf95a('0x1e1')];emitCampaignSummary(_0x2d39d8);if(_0x59a9c1>0x0){if(_0x59a9c1>this['maxNumberOriginate']){_0x59a9c1=this['maxNumberOriginate'];}_0x2d39d8[_0xf95a('0x1e1')]+=_0x59a9c1;this[_0xf95a('0xbd')](_0x2d39d8['id'],_0x59a9c1,_0x2d39d8[_0xf95a('0x1e2')])[_0xf95a('0xb1')](function(_0x3cdce1){_0x2d39d8[_0xf95a('0x1e1')]-=_0x59a9c1;_0x2d39d8[_0xf95a('0x1e1')]=_0x2d39d8[_0xf95a('0x1e1')]>0x0?_0x2d39d8['temp']:0x0;if(!checkContactEmpty(_0x3cdce1)){_0x2d39d8[_0xf95a('0x37')]='AVAILABLE_CONTACTS_FINISHED';logger[_0xf95a('0x77')]('[getContactCampaign2][Empty]'+_0x2d39d8[_0xf95a('0x3a')]);}else{_0x2d39d8[_0xf95a('0x6b')]+=_0x3cdce1['length'];_0x2d39d8[_0xf95a('0x37')]=_0xf95a('0x1e3');for(var _0x3e9451=0x0;_0x3e9451<_0x3cdce1[_0xf95a('0x92')];_0x3e9451+=0x1){_0x2d39d8[_0xf95a('0x1e4')]+=0x1;if(_[_0xf95a('0xa8')](_0x3cdce1[_0x3e9451])||_[_0xf95a('0xa8')](_0x3cdce1[_0x3e9451]['Contact'])||_[_0xf95a('0xa8')](_0x3cdce1[_0x3e9451]['Contact'][_0xf95a('0x151')])){_0x5344e1['emptyContact'](_0xf95a('0x1e5'),_0x2d39d8,_0x3cdce1[_0x3e9451]);}else{_0x5344e1['checkIsBlackListIvr'](_[_0xf95a('0xc8')](_0x3cdce1[_0x3e9451],[_0xf95a('0xcc'),_0xf95a('0x1e6')]))['then'](_0x5344e1[_0xf95a('0x1c8')](_0x2d39d8,_0x3cdce1[_0x3e9451]))[_0xf95a('0xab')](_0x5344e1[_0xf95a('0x1e7')](_0xf95a('0x1e8'),_0x2d39d8));}}}})[_0xf95a('0xab')](loggerGetContactDialer(_0xf95a('0x1e9'),_0x2d39d8,_0x59a9c1));}};Dialer[_0xf95a('0x14')][_0xf95a('0x13f')]=function(_0x3176e9,_0x55b13b){var _0x515229=this;var _0x4c0ac3=[];var _0x1457ca=_0x55b13b>=0x1?_0x55b13b:0x1;var _0x33bfc9=[];if(_0x3176e9[_0xf95a('0x55')]===_0xf95a('0x140')){_0x1457ca=0x1;}var _0x408712=Math[_0xf95a('0x1c4')](_0x3176e9[_0xf95a('0x4b')]*_0x1457ca)-_0x3176e9[_0xf95a('0x6b')]-_0x3176e9['temp'];emitVoiceQueueSummary(_0x3176e9);if(_0x3176e9[_0xf95a('0x1ea')]>0x0){var _0x2dcaa9=_0x3176e9[_0xf95a('0x1ea')]-_0x3176e9[_0xf95a('0x6b')]-_0x3176e9[_0xf95a('0x4e')]-_0x3176e9['temp']-_0x3176e9['pTalking'];if(_0x408712>_0x2dcaa9){_0x408712=_0x2dcaa9;}}if(_0x408712>0x0){if(_0x3176e9[_0xf95a('0x55')]==='booked'){_0x408712=0x1;}if(_0x408712>this[_0xf95a('0x1d')]){_0x408712=this[_0xf95a('0x1d')];}_0x3176e9[_0xf95a('0x1e1')]+=_0x408712;for(var _0x495ccb in this['agents']){if(this[_0xf95a('0x1b')][_0xf95a('0xa7')](_0x495ccb)){if(this['agents'][_0x495ccb][_0xf95a('0xa0')]==='not_inuse'&&this[_0xf95a('0x1b')][_0x495ccb][_0xf95a('0xaa')]===_0xf95a('0xd3')){_0x4c0ac3['push'](this[_0xf95a('0x1b')][_0x495ccb]['id']);}}}this[_0xf95a('0xbc')](_0x3176e9['id'],_0x4c0ac3,_0x408712,_0x3176e9[_0xf95a('0x1e2')])[_0xf95a('0xb1')](function(_0x7a100f){_0x3176e9['temp']-=_0x408712;_0x3176e9[_0xf95a('0x1e1')]=_0x3176e9[_0xf95a('0x1e1')]>0x0?_0x3176e9[_0xf95a('0x1e1')]:0x0;if(!checkContactEmpty(_0x7a100f)){_0x515229[_0xf95a('0xb0')](_0x3176e9)[_0xf95a('0xb1')](sendMessageReschedule(_0x3176e9))['catch'](loggerCatch(_0xf95a('0xb2')));}else{_0x3176e9['originated']+=_0x7a100f[_0xf95a('0x92')];_0x3176e9['message']=_0x3176e9[_0xf95a('0x55')]==='booked'?_0xf95a('0x15b'):_0xf95a('0x1e3');for(var _0x5f1777=0x0;_0x5f1777<_0x7a100f[_0xf95a('0x92')];_0x5f1777+=0x1){if(_[_0xf95a('0xa8')](_0x7a100f[_0x5f1777])||_[_0xf95a('0xa8')](_0x7a100f[_0x5f1777][_0xf95a('0x150')])||_[_0xf95a('0xa8')](_0x7a100f[_0x5f1777][_0xf95a('0x150')][_0xf95a('0x151')])){_0x515229[_0xf95a('0xc6')](_0xf95a('0x1e5'),_0x3176e9,_0x7a100f[_0x5f1777]);}else{_0x515229['checkIsBlackList'](_[_0xf95a('0xc8')](_0x7a100f[_0x5f1777],[_0xf95a('0xcb'),'Contact.phone']))[_0xf95a('0xb1')](_0x515229[_0xf95a('0x1c8')](_0x3176e9,_0x7a100f[_0x5f1777]))['catch'](_0x515229[_0xf95a('0x1e7')](_0xf95a('0x1e5'),_0x3176e9));}}}})[_0xf95a('0xab')](loggerGetContactDialer(_0xf95a('0x1eb'),_0x3176e9,_0x408712));}};Dialer[_0xf95a('0x14')][_0xf95a('0x8b')]=function(_0x2ef365){var _0x53ba49=this;if(_0x2ef365['dialLimitQueue']>0x0){var _0xe7f23a=_0x2ef365[_0xf95a('0x1ea')]-_0x2ef365[_0xf95a('0x6b')]-_0x2ef365[_0xf95a('0x4e')];if(_0xe7f23a>0x0){this[_0xf95a('0x1ec')](_0x2ef365);}else{loggerPredictiveCalls[_0xf95a('0x77')](_0xf95a('0x1ed'));}}else{this[_0xf95a('0x1ec')](_0x2ef365);}};Dialer['prototype'][_0xf95a('0x1ec')]=function(_0x44f9c0){var _0x670ff8=this;var _0x3a8acb=[];_0x44f9c0[_0xf95a('0x6b')]+=0x1;for(var _0x67aac6 in this[_0xf95a('0x1b')]){if(this['agents'][_0xf95a('0xa7')](_0x67aac6)){if(this[_0xf95a('0x1b')][_0x67aac6][_0xf95a('0xa0')]===_0xf95a('0x1ee')&&this[_0xf95a('0x1b')][_0x67aac6][_0xf95a('0xaa')]===_0xf95a('0xd3')){_0x3a8acb['push'](this[_0xf95a('0x1b')][_0x67aac6]['id']);}}}this[_0xf95a('0xbc')](_0x44f9c0['id'],_0x3a8acb,0x1,_0x44f9c0['dialOrderByScheduledAt'])[_0xf95a('0xb1')](function(_0xb19202){if(!checkContactEmpty(_0xb19202)){checkContactLowerLimitOriginate(_0x44f9c0,0x1,0x0);_0x670ff8['countReScheduled'](_0x44f9c0)['then'](sendMessageReschedule(_0x44f9c0))[_0xf95a('0xab')](loggerCatch('[countReScheduled]\x20'));}else{_0x44f9c0[_0xf95a('0x37')]=_0xf95a('0x1e3');if(_[_0xf95a('0xa8')](_0xb19202[0x0])||_['isNil'](_0xb19202[0x0][_0xf95a('0x150')])||_['isNil'](_0xb19202[0x0][_0xf95a('0x150')][_0xf95a('0x151')])){_0x670ff8[_0xf95a('0xc6')](_0xf95a('0x1e5'),_0x44f9c0,_0xb19202[0x0]);}else{_0x670ff8['checkIsBlackList'](_[_0xf95a('0xc8')](_0xb19202[0x0],[_0xf95a('0xcb'),_0xf95a('0x1e6')]))[_0xf95a('0xb1')](_0x670ff8[_0xf95a('0x1c8')](_0x44f9c0,_0xb19202[0x0]))[_0xf95a('0xab')](_0x670ff8['loggerHandler']('[actionOriginatePredictive]\x20',_0x44f9c0));}}})['catch'](loggerGetContactDialer(_0xf95a('0x1ef'),_0x44f9c0,0x1));emitVoiceQueueSummary(_0x44f9c0);};Dialer[_0xf95a('0x14')]['abandonmentRate']=function(_0x4108be,_0x59e01a,_0x17c2d9,_0x32f46d,_0x39d2a3,_0x3884cc){loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f0'));loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f1'),_0x4108be);loggerPredictive['info'](_0xf95a('0x1f2'),_0x59e01a);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f3'),_0x17c2d9);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f4'),_0x32f46d);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f5'),_0x39d2a3);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x87'));return new BPromise(function(_0x33e56f,_0x28c983){if(_0x4108be<=0x0||isNaN(_0x4108be)){return _0x28c983(msgResponse(_0xf95a('0x1f6'),_0xf95a('0x42'),'m\x20=\x20'+_0x4108be));}if(_0x17c2d9<=0x0||isNaN(_0x17c2d9)){return _0x28c983(msgResponse(_0xf95a('0x1f6'),'Error',_0xf95a('0x1f7')+_0x17c2d9));}if(_0x32f46d<=0x0||isNaN(_0x32f46d)){return _0x28c983(msgResponse(_0xf95a('0x1f6'),_0xf95a('0x42'),_0xf95a('0x1f8')+_0x32f46d));}if(_0x59e01a<=0x0||isNaN(_0x59e01a)){return _0x28c983(msgResponse(_0xf95a('0x1f6'),_0xf95a('0x42'),_0xf95a('0x1f9')+_0x59e01a));}if(_0x39d2a3<=0x0||isNaN(_0x39d2a3)){return _0x28c983(msgResponse('[abandonmentRate]',_0xf95a('0x42'),_0xf95a('0x1fa')+_0x39d2a3));}_0x3884cc=_0x3884cc||0x0;var _0x5d1bb8=0x1/_0x17c2d9;var _0x863565=0x0;var _0x186b69=0x0;var _0xea7e15=0x0;var _0x3a26a3=0x0;for(var _0x40d15b=0x0;_0xea7e15<_0x39d2a3;_0x40d15b+=0x1){_0x186b69=_0x40d15b/_0x59e01a;_0x863565=(_0x32f46d*_0x186b69+_0x3884cc)/_0x5d1bb8;_0xea7e15=erlangb(_0x863565,_0x4108be);_0x3a26a3=_0x863565/_0x4108be*(0x1-erlangb(_0x863565,_0x4108be));}return _0x33e56f({'erlangCalls':_0x40d15b,'erlangCallToSecond':_0x59e01a/_0x40d15b,'erlangAbandonmentRate':_0xea7e15,'erlangBusyFactor':_0x3a26a3});});};Dialer[_0xf95a('0x14')][_0xf95a('0x1fb')]=function(_0x27f174,_0x21cab7,_0xc80d96,_0x337e6e,_0x23edec,_0x2b341d){loggerPredictive[_0xf95a('0x77')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f1'),_0x27f174);loggerPredictive['info'](_0xf95a('0x1f2'),_0x21cab7);loggerPredictive[_0xf95a('0x77')]('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',_0xc80d96);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1f4'),_0x337e6e);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x1fc'),_0x23edec);loggerPredictive[_0xf95a('0x77')](_0xf95a('0x87'));return new BPromise(function(_0xdac97,_0x5509eb){if(_0x27f174<=0x0||isNaN(_0x27f174)){return _0x5509eb(msgResponse('[busyFactor]','Error',_0xf95a('0x1fd')+_0x27f174));}if(_0xc80d96<=0x0||isNaN(_0xc80d96)){return _0x5509eb(msgResponse(_0xf95a('0x1fe'),_0xf95a('0x42'),_0xf95a('0x1f7')+_0xc80d96));}if(_0x337e6e<=0x0||isNaN(_0x337e6e)){return _0x5509eb(msgResponse(_0xf95a('0x1fe'),_0xf95a('0x42'),_0xf95a('0x1f8')+_0x337e6e));}if(_0x21cab7<=0x0||isNaN(_0x21cab7)){return _0x5509eb(msgResponse('[busyFactor]',_0xf95a('0x42'),_0xf95a('0x1f9')+_0x21cab7));}if(_0x23edec<=0x0||isNaN(_0x23edec)){return _0x5509eb(msgResponse(_0xf95a('0x1fe'),_0xf95a('0x42'),_0xf95a('0x1ff')+_0x23edec));}_0x2b341d=_0x2b341d||0x0;var _0x1ab737=0x1/_0xc80d96;var _0x12df33=0x0;var _0x1b76cb=0x0;var _0x1b5b49=0x0;var _0x39163e=0x0;for(var _0x771156=0x0;_0x39163e<_0x23edec;_0x771156+=0x1){_0x1b76cb=_0x771156/_0x21cab7;_0x12df33=(_0x337e6e*_0x1b76cb+_0x2b341d)/_0x1ab737;_0x1b5b49=erlangb(_0x12df33,_0x27f174);_0x39163e=_0x12df33/_0x27f174*(0x1-erlangb(_0x12df33,_0x27f174));}return _0xdac97({'erlangCalls':_0x771156,'erlangCallToSecond':_0x21cab7/_0x771156,'erlangAbandonmentRate':_0x1b5b49,'erlangBusyFactor':_0x39163e});});};module[_0xf95a('0x200')]=Dialer; \ No newline at end of file +var _0x865f=['predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','voice:queue:%s','ivr','format','campaign:ivr:%s','campaign:save','-----\x20Stats\x20Predictive\x20---','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','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','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\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20predictive','handlePredictive','preview','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','length','hasOwnProperty','originated','[decremetOriginate]\x20is\x20null\x20or\x20undefined','inspect','[getContactDialer2][ReScheduled]','contactsRescheduled','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','state','statedesc','endtime','starttime','clearZombieChannels','Action','status','catch','No\x20such\x20channel','updateOriginated','queue','campaigns','[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','createHistory','[createHistory]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','notFound','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','isSuccess','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','saveInDb','uniqueid','isNil','variable','amdstatus','xcally-motion-dialer','dialAMDActive','HANGUP','HangupInAMD','AMD','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','value','MACHINE','membername','amd','[syncMachine][createHistory]','[syncMachine]','[syncHangupInAMDIvr]','Machine','[syncMachineIvr][createHistory]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','dialQueueProject','outboundAnswerCallsDay','AnswerAGI','[syncHangupIvr]','Unknow','agent','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','YYYY-MM-DD\x20HH:mm:ss','[syncAgentComplete][createHistory]','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','dialQueueTimeout','Drop','dropreason','TIMEOUT','countdropretry','dialDropMaxRetry','minutes','ContactId','[rescheduleContact][Drop]','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','channel','actionid','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','run','[Catch][Preview][syncQueueStatusComplete]','locked','[unlock][syncQueueStatusComplete]','_rr','unlockRR','[booked][RR]','contactAgent-idHopper:\x20','[booked][RR][finaly]','Agent:\x20','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','syncCampaigns','\x20trunk\x20is\x20not\x20reachable','ifTime','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','interval','content','indexOf','true','iftime\x20%s,%s','all','some','GLOBAL_INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','launchHandleIvr','handleIvr','checkIsTrunkReachable','checkIfTime','dialGlobalInterval','dialTimezone','checkIfTimeIntervals','[syncQueueSummary]','[syncCampaigns]','\x5cw{0,','pow','replace','random','match','actionOriginate','object','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialer','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','updatedAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','originate','SIP/%s/%s%s','trim','dialCutDigit','substring','TrunkBackup','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','countbusyretry','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','dialNoAnswerMaxRetry','add','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','countcongestionretry','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialAbandonedMaxRetry','[rescheduleContact][Abandoned]','dialMachineMaxRetry','countmachineretry','dialMachineRetryFrequency','[rescheduleContact][Machine]','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','checkRetriveMax','reason\x200\x20no\x20such\x20number....','createStateFinal','NoAnswer','countglobal','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','stateGlobal','Busy','reason\x205\x20busy','Congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','[syncAgentComplete][createHistory][11]','reason\x2011\x20abandoned','AgentReject','[syncAgentComplete][createHistory][20]','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','[syncAgentComplete][createHistory][?]','dialGlobalMaxRetry','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','predictiveIntervalMaxThreshold','round','predictiveIntervalMinThreshold','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','floor','one\x20call\x20every:','[handlePredictive]','recallme','queueStatusComplete:\x20','Queue:\x20','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','log','Contact\x20updated','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','RECALLFAILEDTIMEOUT','RecallFailedTimeout','Blacklist','inBlackList','limitCalls','temp','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','[actionOriginate]\x20','Contact.phone','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','[countReScheduled]\x20','checkContactBlack','[getContactDialer2]','tryOriginatePredictive','[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','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','exports','bluebird','md5','ioredis','../../../config/logger','booked','predictive','predictiveCalls','syncQueueSummary','../ami','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','voiceQueues','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','loopClearZombieChannels','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','\x20INTERVAL_IS_NULL','Interval','Intervals','INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','Error','stringify','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime'];(function(_0x38f202,_0x1df2b1){var _0x451615=function(_0x16199c){while(--_0x16199c){_0x38f202['push'](_0x38f202['shift']());}};_0x451615(++_0x1df2b1);}(_0x865f,0x19d));var _0xf865=function(_0x3333b3,_0x1e7bff){_0x3333b3=_0x3333b3-0x0;var _0x3e9b30=_0x865f[_0x3333b3];return _0x3e9b30;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0xf865('0x0'));var uuid=require('uuid');var moment=require('moment');var rr=require('rr');var md5=require(_0xf865('0x1'));var Redis=require(_0xf865('0x2'));var config=require('../../../config/environment/');var logger=require(_0xf865('0x3'))('dialer');var loggerBooked=require(_0xf865('0x3'))(_0xf865('0x4'));var loggerPredictive=require(_0xf865('0x3'))(_0xf865('0x5'));var loggerPredictiveCalls=require(_0xf865('0x3'))(_0xf865('0x6'));var loggerSyncQueueSummary=require(_0xf865('0x3'))(_0xf865('0x7'));var ami=require(_0xf865('0x8'));config[_0xf865('0x9')]=_[_0xf865('0xa')](config[_0xf865('0x9')],{'host':_0xf865('0xb'),'port':0x18eb});var io=require(_0xf865('0xc'))(new Redis(config[_0xf865('0x9')]));var cmHopper=require(_0xf865('0xd'));var cmHopperFinal=require('../rpc/cmHopperFinal');var cmHopperHistory=require(_0xf865('0xe'));var cmHopperBlack=require(_0xf865('0xf'));var voiceQueueRt=require(_0xf865('0x10'));var Action=require(_0xf865('0x11'));var History=require(_0xf865('0x12'));var Final=require(_0xf865('0x13'));var AgentComplete=require(_0xf865('0x14'));var QueueCallerAbandon=require(_0xf865('0x15'));var Hangup=require(_0xf865('0x16'));var ipAgi=process[_0xf865('0x17')][_0xf865('0x18')]||_0xf865('0x19');var strategy={'rrmemory':_0xf865('0x1a'),'roundrobin':_0xf865('0x1b')};var Sequence=function(){};Sequence[_0xf865('0x1c')]['enqueue']=function(_0x197ead){this[_0xf865('0x1d')]=this['tail']?this[_0xf865('0x1d')][_0xf865('0x1e')](_0x197ead):_0x197ead();};function Dialer(_0x18cec5,_0x4c0aea){this[_0xf865('0x1f')]=new Sequence();this['preview']=_0x4c0aea;this[_0xf865('0x20')]=_0x18cec5[_0xf865('0x20')];this['campaigns']=_0x18cec5['campaigns'];this['agents']=_0x18cec5[_0xf865('0x21')];this[_0xf865('0x22')]=_0x18cec5[_0xf865('0x22')];this[_0xf865('0x23')]=config[_0xf865('0x23')]||0x2;this[_0xf865('0x24')]={};this[_0xf865('0x25')]={};this[_0xf865('0x26')]={};this[_0xf865('0x27')]={};this['optionPredictive']={};this[_0xf865('0x28')]={};this[_0xf865('0x29')]={};this[_0xf865('0x2a')]={};this[_0xf865('0x2b')]={};this[_0xf865('0x2c')]={};ami['on'](_0xf865('0x2d'),this[_0xf865('0x2e')][_0xf865('0x2f')](this));ami['on'](_0xf865('0x30'),this[_0xf865('0x31')][_0xf865('0x2f')](this));ami['on']('originateresponse',this[_0xf865('0x32')]['bind'](this));ami['on']('agentcomplete',this[_0xf865('0x33')][_0xf865('0x2f')](this));ami['on'](_0xf865('0x34'),this[_0xf865('0x7')]['bind'](this));ami['on'](_0xf865('0x35'),this[_0xf865('0x36')]['bind'](this));ami['on'](_0xf865('0x37'),this[_0xf865('0x38')][_0xf865('0x2f')](this));ami['on'](_0xf865('0x39'),this[_0xf865('0x3a')][_0xf865('0x2f')](this));ami['on'](_0xf865('0x3b'),this[_0xf865('0x3c')][_0xf865('0x2f')](this));ami['on'](_0xf865('0x3d'),this[_0xf865('0x3e')][_0xf865('0x2f')](this));this[_0xf865('0x3f')]();this[_0xf865('0x40')]();}function isNotNull(_0x172524){return _0x172524!==null&&!_['isUndefined'](_0x172524);}function checkIsLoggedIn(_0x53a597,_0x2093f0){return function(){if(_0x2093f0<=0x0){_0x53a597[_0xf865('0x41')]='AGENTS_NOT_LOGGED';throw _0x53a597[_0xf865('0x42')]+_0xf865('0x43');}};}function isActive(_0x465214){return _0x465214;}function checkIsActive(_0xb5aaf8,_0x2bcb86){return function(){if(!isActive(_0x2bcb86)){_0xb5aaf8[_0xf865('0x41')]=_0xf865('0x44');throw _0xb5aaf8['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x548281){return function(){if(!isNotNull(_0x548281['Interval'])){_0x548281['message']='INTERVAL_IS_NULL';throw _0x548281[_0xf865('0x42')]+_0xf865('0x45');}if(!isNotNull(_0x548281[_0xf865('0x46')][_0xf865('0x47')])){_0x548281[_0xf865('0x41')]=_0xf865('0x48');throw _0x548281[_0xf865('0x42')]+_0xf865('0x45');}if(!isNotNull(_[_0xf865('0x49')](_0x548281[_0xf865('0x46')]['Intervals']))){_0x548281['message']=_0xf865('0x48');throw _0x548281[_0xf865('0x42')]+'\x20INTERVAL_IS_NULL';}};}function msgResponse(_0x594350,_0x100b45,_0x1a7af1){return{'action':_0x594350,'response':_0x100b45,'message':_0x1a7af1,'stack':_0x1a7af1};}function myreject(_0x285b5b){return function(_0x3c7c6b){return _0x285b5b(msgResponse(_0xf865('0x4a'),_0xf865('0x4b'),JSON[_0xf865('0x4c')](_0x3c7c6b)));};}function getSeconds(_0x2fcdc0,_0x453705){var _0x3472f0=moment(_0x2fcdc0)[_0xf865('0x4d')](0x0);var _0x319a5e=moment(_0x453705)[_0xf865('0x4d')](0x0);return _0x3472f0[_0xf865('0x4e')](_0x319a5e,_0xf865('0x4f'));}function emit(_0x1f0131,_0x1db7f4,_0x37e524){io['to'](_0x1f0131)[_0xf865('0x50')](_0x1db7f4,_0x37e524);}function emitVoiceQueueSummary(_0x3d2c16){if(_0x3d2c16[_0xf865('0x51')]===_0xf865('0x52')){var _0xcea4e9={'id':_0x3d2c16['id'],'name':_0x3d2c16['name'],'strategy':_0x3d2c16[_0xf865('0x53')],'answered':_0x3d2c16[_0xf865('0x54')],'available':_0x3d2c16[_0xf865('0x55')],'loggedIn':_0x3d2c16[_0xf865('0x56')],'pTalking':_0x3d2c16[_0xf865('0x57')],'sumBillable':_0x3d2c16[_0xf865('0x58')],'sumDuration':_0x3d2c16[_0xf865('0x59')],'sumHoldTime':_0x3d2c16[_0xf865('0x5a')]||0x0,'talking':_0x3d2c16[_0xf865('0x5b')],'total':_0x3d2c16[_0xf865('0x5c')],'type':_0x3d2c16['type'],'unmanaged':_0x3d2c16[_0xf865('0x5d')],'abandoned':_0x3d2c16['abandoned'],'waiting':_0x3d2c16[_0xf865('0x5e')],'loggedInDb':_0x3d2c16[_0xf865('0x5f')],'dialActive':_0x3d2c16[_0xf865('0x60')],'dialMethod':_0x3d2c16[_0xf865('0x61')],'dialOriginateCallerIdName':_0x3d2c16[_0xf865('0x62')],'dialOriginateCallerIdNumber':_0x3d2c16[_0xf865('0x63')],'dialOriginateTimeout':_0x3d2c16[_0xf865('0x64')],'dialPrefix':_0x3d2c16[_0xf865('0x65')],'outboundAnswerAgiCallsDay':_0x3d2c16[_0xf865('0x66')],'outboundAnswerCallsDay':_0x3d2c16['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x3d2c16[_0xf865('0x67')],'outboundBusyCallsDay':_0x3d2c16[_0xf865('0x68')],'outboundCongestionCallsDay':_0x3d2c16[_0xf865('0x69')],'outboundDropCallsDayACS':_0x3d2c16['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x3d2c16[_0xf865('0x6a')],'outboundDropCallsDayTimeout':_0x3d2c16[_0xf865('0x6b')],'outboundNoAnswerCallsDay':_0x3d2c16[_0xf865('0x6c')],'outboundNoSuchCallsDay':_0x3d2c16['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x3d2c16[_0xf865('0x6d')],'outboundReCallsDay':_0x3d2c16[_0xf865('0x6e')],'outboundRejectCallsDay':_0x3d2c16[_0xf865('0x6f')],'outboundUnknownCallsDay':_0x3d2c16[_0xf865('0x70')],'predictiveIntervalAnsweredCalls':_0x3d2c16[_0xf865('0x71')],'predictiveIntervalAvgHoldtime':_0x3d2c16[_0xf865('0x72')],'predictiveIntervalAvgTalktime':_0x3d2c16[_0xf865('0x73')],'predictiveIntervalDroppedCallsCallersExit':_0x3d2c16['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x3d2c16[_0xf865('0x74')],'predictiveIntervalErlangCalls':_0x3d2c16[_0xf865('0x75')],'predictiveIntervalErlangCallsDroppedCalls':_0x3d2c16[_0xf865('0x76')],'predictiveIntervalHitRate':_0x3d2c16[_0xf865('0x77')],'predictiveIntervalMultiplicativeFactor':_0x3d2c16[_0xf865('0x78')],'predictiveIntervalPauses':_0x3d2c16[_0xf865('0x79')],'predictiveIntervalAvailable':_0x3d2c16[_0xf865('0x7a')],'predictiveIntervalTotalCalls':_0x3d2c16[_0xf865('0x7b')],'message':_0x3d2c16[_0xf865('0x41')],'originated':_0x3d2c16['originated'],'erlangCalls':_0x3d2c16[_0xf865('0x7c')],'erlangCallToSecond':_0x3d2c16['erlangCallToSecond'],'erlangAbandonmentRate':_0x3d2c16[_0xf865('0x7d')],'erlangBusyFactor':_0x3d2c16[_0xf865('0x7e')],'startPredictive':_0x3d2c16[_0xf865('0x28')],'startProgressive':_0x3d2c16[_0xf865('0x29')]};if(_0x3d2c16[_0xf865('0x7f')]){_0xcea4e9['Trunk']={'id':_0x3d2c16[_0xf865('0x7f')]['id'],'name':_0x3d2c16[_0xf865('0x7f')]['name'],'active':_0x3d2c16['Trunk'][_0xf865('0x80')],'callerid':_0x3d2c16[_0xf865('0x7f')][_0xf865('0x81')]};}if(_0x3d2c16['Interval']){_0xcea4e9[_0xf865('0x46')]={'id':_0x3d2c16[_0xf865('0x46')]['id'],'name':_0x3d2c16[_0xf865('0x46')]['name']};}var _0xf42512=md5(JSON['stringify'](_0xcea4e9));if(_0x3d2c16[_0xf865('0x1')]!==_0xf42512){_0x3d2c16['md5']=_0xf42512;emit(util['format'](_0xf865('0x82'),_0xcea4e9['name']),'voice_queue:save',_0xcea4e9);}}}function emitCampaignSummary(_0x25c638){if(_0x25c638['type']===_0xf865('0x83')){emit(util[_0xf865('0x84')](_0xf865('0x85'),_0x25c638[_0xf865('0x42')]),_0xf865('0x86'),_0x25c638);}}function checkGetDataPredictive(_0x4d15a0){if(isNotNull(_0x4d15a0)){if(!_['isEmpty'](_0x4d15a0)){loggerPredictive['info'](_0xf865('0x87'));loggerPredictive[_0xf865('0x88')](_0xf865('0x89'),_0x4d15a0[_0xf865('0x7b')]);loggerPredictive[_0xf865('0x88')](_0xf865('0x8a'),_0x4d15a0['predictiveIntervalAnsweredCalls']);loggerPredictive[_0xf865('0x88')](_0xf865('0x8b'),_0x4d15a0['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0xf865('0x88')](_0xf865('0x8c'),_0x4d15a0[_0xf865('0x8d')]);loggerPredictive[_0xf865('0x88')](_0xf865('0x8e'),_0x4d15a0[_0xf865('0x72')]);loggerPredictive[_0xf865('0x88')](_0xf865('0x8f'),_0x4d15a0['predictiveIntervalAvgTalktime']);loggerPredictive[_0xf865('0x88')](_0xf865('0x90'));if(_0x4d15a0[_0xf865('0x7b')]>0x0){if(!_['isUndefined'](_0x4d15a0[_0xf865('0x73')])&&_0x4d15a0[_0xf865('0x73')]>0x0){return!![];}else{loggerPredictive[_0xf865('0x88')]('Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}if(!_[_0xf865('0x91')](_0x4d15a0['predictiveIntervalAvgHoldtime'])&&_0x4d15a0[_0xf865('0x72')]>0x0){return!![];}else{loggerPredictive[_0xf865('0x88')](_0xf865('0x92'));}}else{loggerPredictive[_0xf865('0x88')](_0xf865('0x93'));}}else{loggerPredictive['info']('History\x20information\x20are\x20empty');}}else{loggerPredictive['info'](_0xf865('0x94'));}return![];}function mergeDataErlangB(_0x30b063){return function(_0x22ab73){loggerPredictive['info'](_0xf865('0x95'));loggerPredictive[_0xf865('0x88')](_0xf865('0x96'),_0x22ab73[_0xf865('0x7c')]);loggerPredictive[_0xf865('0x88')](_0xf865('0x97'),_0x22ab73['erlangCallToSecond']);loggerPredictive[_0xf865('0x88')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22ab73['erlangAbandonmentRate']);loggerPredictive[_0xf865('0x88')](_0xf865('0x98'),_0x22ab73[_0xf865('0x7e')]);loggerPredictive[_0xf865('0x88')]('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x22ab73[_0xf865('0x7d')]);loggerPredictive[_0xf865('0x88')](_0xf865('0x90'));_[_0xf865('0x99')](_0x30b063,_0x22ab73);};}function getDiff(_0xffc588){var _0x3bfbfb=moment()[_0xf865('0x4d')](0x0);var _0x6b0300=moment(_0xffc588)[_0xf865('0x4d')](0x0);return _0x3bfbfb[_0xf865('0x4e')](_0x6b0300,_0xf865('0x4f'));}function ifInterval(_0x5736d5,_0x6f22d7){if(_['isUndefined'](_0x6f22d7)){return![];}if(getDiff(_0x6f22d7)<_0x5736d5*0x3c){return!![];}else{return![];}}function freeVariablesPredictive(_0x2d12f7){if(isNotNull(_0x2d12f7)){if(!_[_0xf865('0x91')](_0x2d12f7[_0xf865('0x29')])){_0x2d12f7[_0xf865('0x29')]=undefined;loggerPredictive[_0xf865('0x88')](_0x2d12f7['name'],'clearing\x20variable\x20start\x20progressive');}if(!_[_0xf865('0x91')](_0x2d12f7[_0xf865('0x28')])){_0x2d12f7[_0xf865('0x28')]=undefined;loggerPredictive[_0xf865('0x88')](_0x2d12f7[_0xf865('0x42')],_0xf865('0x9a'));}if(!_['isUndefined'](_0x2d12f7[_0xf865('0x9b')])){clearInterval(_0x2d12f7[_0xf865('0x9b')]);_0x2d12f7[_0xf865('0x9b')]=undefined;loggerPredictive[_0xf865('0x88')](_0x2d12f7[_0xf865('0x42')],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x4cd1b6,_0x242fe6){if(_0x242fe6===0x0){return 0x0;}var _0xadfe27=0x1;for(var _0x1c90a2=0x1;_0x1c90a2<=_0x242fe6;_0x1c90a2+=0x1){_0xadfe27=0x1+_0xadfe27*_0x1c90a2/_0x4cd1b6;}return 0x1/_0xadfe27;}function isVoiceQueueOutbound(_0x26884b){return _0x26884b===_0xf865('0x52');}function isNotPreview(_0x314a0c){return _0x314a0c!==_0xf865('0x9c');}function isCampaignIvr(_0x5e1a15){return _0x5e1a15===_0xf865('0x83');}function getCallerId(_0x8d9c3a,_0x3e1ec3,_0x3493ad){if(!_[_0xf865('0x91')](_0x3493ad)&&_0xf865('0x9d')===typeof _0x3493ad&&!_[_0xf865('0x49')](_0x3493ad)){if(!_[_0xf865('0x91')](_0x3e1ec3)&&_0xf865('0x9d')===typeof _0x3e1ec3&&!_['isEmpty'](_0x3e1ec3)){return util['format'](_0xf865('0x9e'),_0x3e1ec3,_0x3493ad);}return util[_0xf865('0x84')]('\x22%s\x22\x20<%s>',_0x3493ad,_0x3493ad);}if(!_[_0xf865('0x91')](_0x8d9c3a)&&_0xf865('0x9d')===typeof _0x8d9c3a&&!_[_0xf865('0x49')](_0x8d9c3a)){return _0x8d9c3a;}return _0xf865('0x9f');}function loggerCatchQueueSummary(_0x477b15,_0x32f3f0){return function(_0x3b4b88){freeVariablesPredictive(_0x32f3f0);emitVoiceQueueSummary(_0x32f3f0);emitCampaignSummary(_0x32f3f0);loggerSyncQueueSummary[_0xf865('0xa0')](_0x477b15,util['inspect'](_0x3b4b88,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x418350,_0x1b9173){return function(_0x59d0bb){loggerPredictive[_0xf865('0xa0')](_0x1b9173[_0xf865('0x42')],_0x418350);loggerPredictive[_0xf865('0xa0')](_0x59d0bb[_0xf865('0xa1')]);freeVariablesPredictive(_0x1b9173);};}function loggerCatch(_0x5f2925){return function(_0x45a69f){logger[_0xf865('0xa0')](_0x5f2925,util['inspect'](_0x45a69f,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x1a5f25){return _0x1a5f25&&!_[_0xf865('0x91')](_0x1a5f25)&&_0x1a5f25[_0xf865('0xa2')]>0x0;}function decremetOriginate(_0x5490c5){if(!_[_0xf865('0x91')](_0x5490c5)&&_0x5490c5!==null){if(_0x5490c5[_0xf865('0xa3')](_0xf865('0xa4'))){if(_0x5490c5['originated']>0x0){_0x5490c5[_0xf865('0xa4')]-=0x1;}else{logger[_0xf865('0xa0')]('[decremetOriginate]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf865('0xa0')](_0xf865('0xa5'));}}function checkContactLowerLimitOriginate(_0x2bb7f6,_0x194f70,_0x4f62e8){if(_0x194f70>_0x4f62e8){for(var _0x171b17=0x0;_0x171b17<_0x194f70-_0x4f62e8;_0x171b17+=0x1){decremetOriginate(_0x2bb7f6);}}}function loggerGetContactDialer(_0x13c25c,_0x45d13b,_0xef505b){return function(_0x5dfe45){checkContactLowerLimitOriginate(_0x45d13b,_0xef505b,0x0);logger[_0xf865('0xa0')](_0x13c25c,util[_0xf865('0xa6')](_0x5dfe45,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x51a20b){return function(_0x4eccf2){if(isNotNull(_0x4eccf2)&&isNotNull(_0x4eccf2[0x0])){if(_0x4eccf2[0x0]['contactsRescheduled']>0x0){_0x51a20b[_0xf865('0x41')]='RESCHEDULED_CONTACTS';logger[_0xf865('0x88')](_0xf865('0xa7')+_0x51a20b[_0xf865('0x42')],_0x4eccf2[0x0][_0xf865('0xa8')],_0xf865('0xa9'));}else{_0x51a20b[_0xf865('0x41')]=_0xf865('0xaa');logger['info'](_0xf865('0xab')+_0x51a20b[_0xf865('0x42')]);}}};}function notSendMessagesQueue(_0x22c103){if(_0x22c103['sendMessageOneNotActive']){freeVariablesPredictive(_0x22c103);if(_0x22c103[_0xf865('0xa4')]===0x0&&_0x22c103[_0xf865('0x5b')]===0x0&&_0x22c103[_0xf865('0x5e')]===0x0&&(_0x22c103[_0xf865('0x57')]||0x0)===0x0){_0x22c103[_0xf865('0xac')]=![];_0x22c103[_0xf865('0x55')]=0x0;_0x22c103[_0xf865('0x41')]=_0xf865('0x44');loggerSyncQueueSummary[_0xf865('0xa0')](_0xf865('0xad'),_0x22c103[_0xf865('0x42')],_0xf865('0xae'));}else{_0x22c103[_0xf865('0x41')]=_0xf865('0xaf');loggerSyncQueueSummary[_0xf865('0xa0')](_0xf865('0xad'),_0x22c103['name'],_0xf865('0xb0'));}emitVoiceQueueSummary(_0x22c103);}}function notSendMessagesCampaign(_0x41fdf8){if(_0x41fdf8['sendMessageOneNotActive']){if(_0x41fdf8[_0xf865('0xa4')]===0x0){_0x41fdf8['sendMessageOneNotActive']=![];_0x41fdf8[_0xf865('0x41')]=_0xf865('0x44');loggerSyncQueueSummary[_0xf865('0xa0')](_0xf865('0xb1'),_0x41fdf8[_0xf865('0x42')],'is\x20not\x20active');}else{_0x41fdf8['message']=_0xf865('0xaf');loggerSyncQueueSummary[_0xf865('0xa0')](_0xf865('0xb1'),_0x41fdf8[_0xf865('0x42')],_0xf865('0xb0'));}emitCampaignSummary(_0x41fdf8);}}function createObjHistory(_0x3785a3,_0x27f05d,_0x554c58,_0x1789bd,_0x49a681){_0x3785a3['message']=_0x554c58;var _0x16b4ba=new Action(_0x3785a3,_0x27f05d);var _0x3a043f=new History(_0x16b4ba);_0x3a043f[_0xf865('0xb2')]=_0x1789bd;_0x3a043f[_0xf865('0xb3')]=_0x49a681;_0x3a043f[_0xf865('0xb4')]=_0x16b4ba[_0xf865('0xb5')];return _0x3a043f;}Dialer[_0xf865('0x1c')][_0xf865('0x40')]=function(){var _0x8911c7=this;setInterval(function(){_0x8911c7[_0xf865('0xb6')](_0x8911c7[_0xf865('0x27')],'[uniqueid]');_0x8911c7[_0xf865('0xb6')](_0x8911c7['actions'],'[actions]');},0x32c8);};Dialer[_0xf865('0x1c')][_0xf865('0xb6')]=function(_0x5e08d8,_0x34fd84){var _0x3a8abf=this;for(var _0x56abf5 in _0x5e08d8){if(_0x5e08d8[_0xf865('0xa3')](_0x56abf5)){this['sequence']['enqueue'](function(){if(!_['isNil'](_0x5e08d8[_0x56abf5])){return ami[_0xf865('0xb7')]({'action':_0xf865('0xb8'),'channel':_0x5e08d8[_0x56abf5]['channel']})[_0xf865('0xb9')](function(_0x526f04){if(_0x526f04[_0xf865('0x41')]===_0xf865('0xba')){setTimeout(function(){if(_0x5e08d8[_0x56abf5]&&_0x5e08d8[_0x56abf5][_0xf865('0x51')]!==_0xf865('0x83')){_0x3a8abf[_0xf865('0xbb')](_0x3a8abf['voiceQueues'][_0x5e08d8[_0x56abf5][_0xf865('0xbc')]]);logger[_0xf865('0xa0')]('[Dialer][checkChannel]',_0x34fd84,_0x56abf5,_0x5e08d8[_0x56abf5]['queue']);delete _0x5e08d8[_0x56abf5];}if(_0x5e08d8[_0x56abf5]&&_0x5e08d8[_0x56abf5][_0xf865('0x51')]===_0xf865('0x83')){_0x3a8abf[_0xf865('0xbb')](_0x3a8abf[_0xf865('0xbd')][_0x5e08d8[_0x56abf5][_0xf865('0xbc')]]);logger[_0xf865('0xa0')](_0xf865('0xbe'),_0x34fd84,_0x56abf5,_0x5e08d8[_0x56abf5]['queue']);delete _0x5e08d8[_0x56abf5];}},0x2328);}});}});}}};Dialer[_0xf865('0x1c')][_0xf865('0xbf')]=function(_0x553fcb){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](cmHopper[_0xf865('0xbf')](_0x553fcb))[_0xf865('0xb9')](loggerCatch('[countReScheduled]\x20'));};Dialer[_0xf865('0x1c')][_0xf865('0xc2')]=function(_0x3600b9){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](cmHopperBlack[_0xf865('0xc2')](_0x3600b9))['catch'](loggerCatch(_0xf865('0xc3')));};Dialer['prototype']['checkIsBlackListIvr']=function(_0x5b6a17){return BPromise[_0xf865('0xc0')]()['then'](cmHopperBlack[_0xf865('0xc4')](_0x5b6a17))[_0xf865('0xb9')](loggerCatch(_0xf865('0xc5')));};Dialer[_0xf865('0x1c')][_0xf865('0xc6')]=function(_0x4b87c8){return BPromise['resolve']()[_0xf865('0xc1')](cmHopperHistory[_0xf865('0xc7')](_0x4b87c8))[_0xf865('0xb9')](loggerCatch(_0xf865('0xc8')));};Dialer[_0xf865('0x1c')]['rescheduleContact']=function(_0x77d75a){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](cmHopper[_0xf865('0xc9')](_0x77d75a))[_0xf865('0xb9')](loggerCatch('[rescheduleContact]\x20'));};Dialer[_0xf865('0x1c')][_0xf865('0xca')]=function(_0x4a15e9,_0x432a76,_0x389d61){return BPromise[_0xf865('0xc0')]()['then'](cmHopper[_0xf865('0xca')](_0x4a15e9,_0x432a76,_0x389d61))[_0xf865('0xb9')](loggerCatch(_0xf865('0xcb')));};Dialer[_0xf865('0x1c')][_0xf865('0xcc')]=function(_0x22e54c,_0x205dc8,_0xd77bd1,_0x316621){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](cmHopper['getContactDialer'](_0x22e54c,_0x205dc8,_0xd77bd1,_0x316621))[_0xf865('0xb9')](loggerCatch(_0xf865('0xcd')));};Dialer[_0xf865('0x1c')]['getContactDialerIvr']=function(_0x56b9ad,_0x72d86a,_0x501c48){return BPromise['resolve']()['then'](cmHopper[_0xf865('0xce')](_0x56b9ad,_0x72d86a,_0x501c48))[_0xf865('0xb9')](loggerCatch('[getContactDialer]\x20'));};Dialer[_0xf865('0x1c')][_0xf865('0xcf')]=function(_0x314acf){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](voiceQueueRt[_0xf865('0xcf')](_0x314acf))[_0xf865('0xb9')](loggerCatch(_0xf865('0xd0')));};Dialer['prototype'][_0xf865('0xd1')]=function(_0x19dd92){return BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](cmHopper['moveContactManagedDialer'](_0x19dd92))['catch'](loggerCatch('[moveContactManagedDialer]\x20'));};Dialer[_0xf865('0x1c')][_0xf865('0xd2')]=function(_0x521685){return BPromise['resolve']()[_0xf865('0xc1')](cmHopperHistory['createHistory'](_0x521685))[_0xf865('0xb9')](loggerCatch(_0xf865('0xd3')));};Dialer['prototype'][_0xf865('0xbb')]=function(_0x3671db){if(!_[_0xf865('0x91')](_0x3671db)&&_0x3671db!==null){if(_0x3671db[_0xf865('0xa3')](_0xf865('0xa4'))){if(_0x3671db[_0xf865('0xa4')]>0x0){_0x3671db[_0xf865('0xa4')]-=0x1;}else{logger['error']('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0xf865('0xa0')](_0xf865('0xd4'));}};Dialer[_0xf865('0x1c')][_0xf865('0xd5')]=function(_0x3fee3c,_0x251e28){var _0x5b3071=this;return function(_0x2d2591){_0x5b3071[_0xf865('0xbb')](_0x251e28);logger[_0xf865('0xa0')](_0x3fee3c,util['inspect'](_0x2d2591,{'showHidden':![],'depth':null}));};};Dialer[_0xf865('0x1c')][_0xf865('0xd6')]=function(_0x2c9df2,_0x38e18f,_0x595930){var _0x56bc51={'state':0x19,'statedesc':_0xf865('0xd7')};this[_0xf865('0xbb')](_0x38e18f);this['saveInDb'](_[_0xf865('0x99')](_0x56bc51,_['pick'](_0x595930,['ContactId',_0xf865('0xd8'),_0xf865('0xd9'),_0xf865('0xda'),_0xf865('0xdb')])),_0xf865('0xdc'),'[emptyContact]');logger[_0xf865('0xa0')](_0x2c9df2);};Dialer['prototype'][_0xf865('0xdd')]=function(_0x2f3da9){return _0x2f3da9===_0xf865('0xde');};Dialer[_0xf865('0x1c')][_0xf865('0xdf')]=function(_0x4ae328){return!_[_0xf865('0x91')](_0x4ae328)&&_0x4ae328&&!_['isUndefined'](_0x4ae328[_0xf865('0x42')])&&!_['isUndefined'](_0x4ae328[_0xf865('0x80')])&&_0x4ae328['active']&&(this['trunks'][util[_0xf865('0x84')](_0xf865('0xe0'),_0x4ae328[_0xf865('0x42')])][_0xf865('0xb8')]===_0xf865('0xe1')||this[_0xf865('0x22')][util[_0xf865('0x84')](_0xf865('0xe0'),_0x4ae328[_0xf865('0x42')])][_0xf865('0xb8')]===_0xf865('0xe2'));};Dialer[_0xf865('0x1c')][_0xf865('0xe3')]=function(_0x379a79,_0x502c57,_0x505133){this[_0xf865('0xd2')](_0x379a79)[_0xf865('0xb9')](loggerCatch(_0x502c57));this['moveContactManagedDialer'](_0x379a79)[_0xf865('0xb9')](loggerCatch(_0x505133));};Dialer[_0xf865('0x1c')]['syncVarSet']=function(_0x1e366f){var _0x2aa7ed=this['uniqueId'][_0x1e366f[_0xf865('0xe4')]];var _0x5af71a;if(!_[_0xf865('0xe5')](_0x1e366f)&&!_[_0xf865('0xe5')](_0x1e366f[_0xf865('0xe6')])&&!_[_0xf865('0xe5')](_0x1e366f['variable'][_0xf865('0xe7')])&&_0x1e366f['exten']===_0xf865('0xe8')&&_0x2aa7ed){if(_0x2aa7ed['type']!==_0xf865('0x83')&&this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]][_0xf865('0xe9')]&&_0x1e366f['value']===_0xf865('0xea')){delete this[_0xf865('0x27')][_0x1e366f[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]]);this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]]['outboundAnswerCallsDay']+=0x1;this[_0xf865('0x20')][_0x2aa7ed['queue']][_0xf865('0x66')]+=0x1;_0x5af71a=new Hangup(_0x2aa7ed,_0x1e366f);_0x5af71a[_0xf865('0xb2')]=0x12;_0x5af71a['statedesc']=_0xf865('0xeb');_0x5af71a['membername']=_0xf865('0xec');this[_0xf865('0xe3')](_0x5af71a,_0xf865('0xed'),_0xf865('0xee'));}if(_0x2aa7ed[_0xf865('0x51')]!==_0xf865('0x83')&&this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]][_0xf865('0xe9')]&&_0x1e366f[_0xf865('0xef')]===_0xf865('0xf0')){delete this[_0xf865('0x27')][_0x1e366f[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]]);this[_0xf865('0x20')][_0x2aa7ed['queue']]['outboundAnswerCallsDay']+=0x1;this[_0xf865('0x20')][_0x2aa7ed[_0xf865('0xbc')]]['outboundAnswerAgiCallsDay']+=0x1;_0x5af71a=new Hangup(_0x2aa7ed,_0x1e366f);_0x5af71a[_0xf865('0xb2')]=0x13;_0x5af71a['statedesc']='Machine';_0x5af71a[_0xf865('0xf1')]='AMD';_0x5af71a[_0xf865('0xf2')]=!![];this['saveInDb'](_0x5af71a,_0xf865('0xf3'),_0xf865('0xf4'));}if(_0x2aa7ed[_0xf865('0x51')]===_0xf865('0x83')&&this[_0xf865('0xbd')][_0x2aa7ed[_0xf865('0xbc')]][_0xf865('0xe9')]&&_0x1e366f[_0xf865('0xef')]===_0xf865('0xea')){delete this[_0xf865('0x27')][_0x1e366f[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0xbd')][_0x2aa7ed['queue']]);_0x5af71a=new Hangup(_0x2aa7ed,_0x1e366f);_0x5af71a['state']=0x12;_0x5af71a[_0xf865('0xb3')]='HangupInAMD';_0x5af71a['membername']='AMD';this[_0xf865('0xe3')](_0x5af71a,'[syncHangupInAMDIvr][createHistory]',_0xf865('0xf5'));}if(_0x2aa7ed[_0xf865('0x51')]===_0xf865('0x83')&&this['campaigns'][_0x2aa7ed[_0xf865('0xbc')]]['dialAMDActive']&&_0x1e366f[_0xf865('0xef')]===_0xf865('0xf0')){delete this[_0xf865('0x27')][_0x1e366f[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0xbd')][_0x2aa7ed[_0xf865('0xbc')]]);_0x5af71a=new Hangup(_0x2aa7ed,_0x1e366f);_0x5af71a[_0xf865('0xb2')]=0x13;_0x5af71a[_0xf865('0xb3')]=_0xf865('0xf6');_0x5af71a['membername']=_0xf865('0xec');_0x5af71a[_0xf865('0xf2')]=!![];this[_0xf865('0xe3')](_0x5af71a,_0xf865('0xf7'),'[syncMachineIvr]');}}};Dialer[_0xf865('0x1c')][_0xf865('0x36')]=function(_0x5f4753){var _0x5ab2f5=this[_0xf865('0x27')][_0x5f4753[_0xf865('0xe4')]];var _0x4159e3=this;var _0x1e61a2;if(_0x5ab2f5&&_0x5ab2f5['type']==='ivr'){delete this['uniqueId'][_0x5f4753[_0xf865('0xe4')]];this['updateOriginated'](this[_0xf865('0xbd')][_0x5ab2f5[_0xf865('0xbc')]]);this[_0xf865('0xbd')][_0x5ab2f5[_0xf865('0xbc')]][_0xf865('0xf8')]+=0x1;_0x1e61a2=new Hangup(_0x5ab2f5,_0x5f4753);this[_0xf865('0xd2')](_0x1e61a2)[_0xf865('0xb9')](loggerCatch(_0xf865('0xf9')));this[_0xf865('0xd1')](_0x1e61a2)[_0xf865('0xb9')](loggerCatch('[syncHangupIvr]'));}if(_0x5ab2f5&&_0x5ab2f5['type']!=='ivr'&&isNotNull(this[_0xf865('0x20')][_0x5ab2f5['queue']][_0xf865('0xfa')])){delete this[_0xf865('0x27')][_0x5f4753[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0x20')][_0x5ab2f5[_0xf865('0xbc')]]);this[_0xf865('0x20')][_0x5ab2f5[_0xf865('0xbc')]][_0xf865('0xfb')]+=0x1;this[_0xf865('0x20')][_0x5ab2f5[_0xf865('0xbc')]][_0xf865('0x66')]+=0x1;_0x1e61a2=new Hangup(_0x5ab2f5,_0x5f4753);_0x1e61a2[_0xf865('0xb2')]=0x10;_0x1e61a2[_0xf865('0xb3')]=_0xf865('0xfc');_0x1e61a2[_0xf865('0xf1')]='AGI';this[_0xf865('0xd2')](_0x1e61a2)[_0xf865('0xb9')](loggerCatch(_0xf865('0xf9')));this[_0xf865('0xd1')](_0x1e61a2)[_0xf865('0xb9')](loggerCatch(_0xf865('0xfd')));}if(_0x5ab2f5&&_0x5ab2f5['type']!==_0xf865('0x83')&&!isNotNull(this[_0xf865('0x20')][_0x5ab2f5[_0xf865('0xbc')]][_0xf865('0xfa')])){delete this[_0xf865('0x27')][_0x5f4753[_0xf865('0xe4')]];this['updateOriginated'](this[_0xf865('0x20')][_0x5ab2f5['queue']]);this[_0xf865('0x20')][_0x5ab2f5[_0xf865('0xbc')]]['outboundUnknownCallsDay']+=0x1;_0x1e61a2=new Hangup(_0x5ab2f5,_0x5f4753);_0x1e61a2[_0xf865('0xb2')]=0xc;_0x1e61a2[_0xf865('0xb3')]=_0x5f4753['cause-txt'];_0x1e61a2['membername']=_0xf865('0xfe');this[_0xf865('0xd2')](_0x1e61a2)[_0xf865('0xb9')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xf865('0xd1')](_0x1e61a2)['catch'](loggerCatch('[syncHangupIvr]'));}};Dialer[_0xf865('0x1c')][_0xf865('0x33')]=function(_0x6b1bec){var _0xa45610=this[_0xf865('0x27')][_0x6b1bec[_0xf865('0xe4')]];var _0x3bacac=this;if(this[_0xf865('0x20')][_0x6b1bec['queue']]){if(_0xa45610&&_0xa45610[_0xf865('0x51')]!==_0xf865('0x83')){delete this['uniqueId'][_0x6b1bec[_0xf865('0xe4')]];this[_0xf865('0x20')][_0x6b1bec[_0xf865('0xbc')]][_0xf865('0xfb')]+=0x1;var _0x30100d=new AgentComplete(_0xa45610,_0x6b1bec);if(_0x6b1bec['reason']===_0xf865('0xff')){_0x30100d[_0xf865('0x100')]=this[_0xf865('0x20')][_0x6b1bec[_0xf865('0xbc')]][_0xf865('0x101')]&&this[_0xf865('0x20')][_0x6b1bec[_0xf865('0xbc')]][_0xf865('0x102')]?moment()[_0xf865('0x84')](_0xf865('0x103')):undefined;}this[_0xf865('0xd2')](_0x30100d)[_0xf865('0xb9')](loggerCatch(_0xf865('0x104')));this[_0xf865('0xd1')](_0x30100d)[_0xf865('0xb9')](loggerCatch(_0xf865('0x105')));}}};Dialer[_0xf865('0x1c')][_0xf865('0x2e')]=function(_0x6ef7ed){if(this[_0xf865('0x20')][_0x6ef7ed[_0xf865('0xbc')]]){if(this[_0xf865('0x27')][_0x6ef7ed[_0xf865('0xe4')]]&&this[_0xf865('0x27')][_0x6ef7ed['uniqueid']]['type']!=='ivr'){this[_0xf865('0xbb')](this[_0xf865('0x20')][_0x6ef7ed['queue']]);this[_0xf865('0x27')][_0x6ef7ed[_0xf865('0xe4')]][_0xf865('0x106')]=moment()[_0xf865('0x84')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer[_0xf865('0x1c')][_0xf865('0x107')]=function(_0x2c206e){this['createHistory'](_0x2c206e)['catch'](loggerCatch(_0xf865('0x104')));this[_0xf865('0xd1')](_0x2c206e)[_0xf865('0xb9')](loggerCatch(_0xf865('0x108')));};Dialer['prototype'][_0xf865('0x31')]=function(_0x2dfbd0){var _0x38ea81=this[_0xf865('0x27')][_0x2dfbd0[_0xf865('0xe4')]];var _0x4d9d8d=this;if(this['voiceQueues'][_0x2dfbd0['queue']]){if(_0x38ea81&&_0x38ea81['type']!=='ivr'){delete this[_0xf865('0x27')][_0x2dfbd0[_0xf865('0xe4')]];this[_0xf865('0xbb')](this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]]);_0x38ea81[_0xf865('0x109')]=moment()[_0xf865('0x84')]('YYYY-MM-DD\x20HH:mm:ss');var _0x48aa36=new QueueCallerAbandon(_0x38ea81,_0x2dfbd0);if(getSeconds(_0x38ea81[_0xf865('0x109')],_0x38ea81['responsetime'])>=_0x38ea81[_0xf865('0x10a')]){this['voiceQueues'][_0x2dfbd0[_0xf865('0xbc')]][_0xf865('0x74')]+=0x1;this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]][_0xf865('0x6b')]+=0x1;this[_0xf865('0x20')][_0x2dfbd0['queue']][_0xf865('0x76')]+=0x1;_0x48aa36['state']=0xa;_0x48aa36[_0xf865('0xb3')]=_0xf865('0x10b');_0x48aa36[_0xf865('0x10c')]=_0xf865('0x10d');_0x48aa36[_0xf865('0x100')]=this[_0xf865('0x20')][_0x2dfbd0['queue']][_0xf865('0x101')]?moment()[_0xf865('0x84')](_0xf865('0x103')):undefined;if(_0x48aa36[_0xf865('0x10e')]>=this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]][_0xf865('0x10f')]-0x1){this[_0xf865('0x107')](_0x48aa36);}else{this[_0xf865('0xc9')]({'active':![],'countdropretry':_0x48aa36[_0xf865('0x10e')]+=0x1,'scheduledat':moment()['add'](this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]]['dialDropRetryFrequency'],_0xf865('0x110'))[_0xf865('0x84')](_0xf865('0x103')),'ContactId':_0x38ea81[_0xf865('0x111')],'ListId':_0x38ea81[_0xf865('0xd8')],'VoiceQueueId':_0x38ea81[_0xf865('0xda')]||undefined,'CampaignId':_0x38ea81['CampaignId']||undefined})['catch'](loggerCatch(_0xf865('0x112')));}}else{this[_0xf865('0x20')][_0x2dfbd0['queue']][_0xf865('0x8d')]+=0x1;this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]][_0xf865('0x6a')]+=0x1;_0x48aa36[_0xf865('0xb2')]=0xb;_0x48aa36['statedesc']=_0xf865('0x113');_0x48aa36['dropreason']=_0xf865('0x114');if(_0x48aa36[_0xf865('0x115')]>=this['voiceQueues'][_0x2dfbd0[_0xf865('0xbc')]]['dialAbandonedMaxRetry']-0x1){this[_0xf865('0x107')](_0x48aa36);}else{this['rescheduleContact']({'active':![],'countabandonedretry':_0x48aa36[_0xf865('0x115')]+=0x1,'scheduledat':moment()['add'](this[_0xf865('0x20')][_0x2dfbd0[_0xf865('0xbc')]][_0xf865('0x116')],'minutes')['format'](_0xf865('0x103')),'ContactId':_0x38ea81[_0xf865('0x111')],'ListId':_0x38ea81['ListId'],'VoiceQueueId':_0x38ea81['VoiceQueueId']||undefined,'CampaignId':_0x38ea81[_0xf865('0xdb')]||undefined})[_0xf865('0xb9')](loggerCatch('[rescheduleContact][Abandoned]'));}}}}};Dialer['prototype'][_0xf865('0x38')]=function(_0xa81a0f){if(this[_0xf865('0x25')][_0xa81a0f[_0xf865('0xe4')]]){this['actions'][_0xa81a0f[_0xf865('0xe4')]][_0xf865('0x117')]=_0xa81a0f[_0xf865('0x117')];}if(this[_0xf865('0x27')][_0xa81a0f['uniqueid']]){this[_0xf865('0x27')][_0xa81a0f[_0xf865('0xe4')]][_0xf865('0x117')]=_0xa81a0f[_0xf865('0x117')];}};Dialer[_0xf865('0x1c')][_0xf865('0x3c')]=function(_0x5f45c0){if(strategy[this['voiceQueues'][this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0xbc')]][_0xf865('0x53')]]==='roundrobin'){if(this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]]&&_[_0xf865('0xe5')](this[_0xf865('0x25')][_0x5f45c0['actionid']]['locked'])&&_0x5f45c0[_0xf865('0xb8')]==='1'&&_0x5f45c0[_0xf865('0x119')]==='0'){if(this[_0xf865('0x21')][_0x5f45c0[_0xf865('0x11a')]]){if(!this[_0xf865('0x21')][_0x5f45c0[_0xf865('0x11a')]]['locked']){this['agents'][_0x5f45c0['stateinterface']]['locked']=!![];this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]]['locked']=!![];this['actions'][_0x5f45c0[_0xf865('0x118')]]['stateinterface']=_0x5f45c0[_0xf865('0x11a')];}}}}else if((strategy[this[_0xf865('0x20')][this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0xbc')]]['strategy']]||_0xf865('0x1a'))===_0xf865('0x1a')){if(this['actions'][_0x5f45c0[_0xf865('0x118')]]){if(this['agents'][_0x5f45c0[_0xf865('0x11a')]]){this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0x11a')]=_0x5f45c0['stateinterface'];if(_[_0xf865('0xe5')](this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0xbc')]])){this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0xbc')]]=[];}this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]][_0xf865('0xbc')]][_0xf865('0x11b')](_[_0xf865('0x99')](_[_0xf865('0x11c')](this[_0xf865('0x25')][_0x5f45c0[_0xf865('0x118')]],[_0xf865('0x11d'),_0xf865('0x11a')]),{'status':_0x5f45c0['status'],'paused':_0x5f45c0['paused']}));}}}};function unlockQueueStatus(_0x315747,_0x4400d2){setTimeout(function(){if(_[_0xf865('0x91')](_0x315747[_0xf865('0x11e')])){loggerBooked[_0xf865('0xa0')](_0xf865('0x11f'),_0x4400d2);}_0x315747['queueStatusComplete']=!![];loggerBooked['info'](_0xf865('0x120'),_0x4400d2,JSON[_0xf865('0x4c')](_[_0xf865('0x11c')](_0x315747,['name',_0xf865('0x11e')])));},0x1f3);}Dialer[_0xf865('0x1c')][_0xf865('0x3e')]=function(_0x50933c){var _0x1e0274=this;var _0x41e8e8=_0x1e0274[_0xf865('0x20')][_0x1e0274[_0xf865('0x25')][_0x50933c['actionid']][_0xf865('0xbc')]];if(strategy[this[_0xf865('0x20')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]]['queue']][_0xf865('0x53')]]==='roundrobin'){if(this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]]&&this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0x11a')]){this[_0xf865('0x9c')][_0xf865('0x121')](this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0x11d')],this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0x11a')])['catch'](function(_0x452ea7){logger['error'](_0xf865('0x122'),util['inspect'](_0x452ea7,{'showHidden':![],'depth':null}));})['finally'](function(){_0x1e0274[_0xf865('0xbb')](_0x1e0274[_0xf865('0x20')][_0x1e0274[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]]);_0x1e0274['agents'][_0x1e0274[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0x11a')]][_0xf865('0x123')]=![];delete _0x1e0274[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]];unlockQueueStatus(_0x41e8e8);});}else{this[_0xf865('0xbb')](this[_0xf865('0x20')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]]);this[_0xf865('0xc9')]({'active':![],'ContactId':this['actions'][_0x50933c['actionid']][_0xf865('0x111')],'ListId':this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]]['ListId'],'VoiceQueueId':this['actions'][_0x50933c[_0xf865('0x118')]][_0xf865('0xda')]||undefined,'CampaignId':this['actions'][_0x50933c[_0xf865('0x118')]][_0xf865('0xdb')]||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x124')));delete this['actions'][_0x50933c[_0xf865('0x118')]];unlockQueueStatus(_0x41e8e8);}}else if((strategy[this[_0xf865('0x20')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]][_0xf865('0x53')]]||_0xf865('0x1a'))===_0xf865('0x1a')){var _0x3ae80a;if(this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]]&&!_[_0xf865('0x49')](this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x50933c['actionid']][_0xf865('0xbc')]])){if(this[_0xf865('0x2c')][_0x1e0274[_0xf865('0x25')][_0x50933c['actionid']][_0xf865('0xbc')]]){this[_0xf865('0x2c')][_0x1e0274[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]]['queue']]=this[_0xf865('0x2c')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]]?this[_0xf865('0x2c')][this[_0xf865('0x25')][_0x50933c['actionid']][_0xf865('0xbc')]]:this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]]?this['queueBooked'][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]][_0xf865('0x125')]||0x0:0x0;}this[_0xf865('0x2b')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]]['_rr']=this[_0xf865('0x2c')][this[_0xf865('0x25')][_0x50933c[_0xf865('0x118')]][_0xf865('0xbc')]];for(var _0x4c3d96=0x0;_0x4c3d96=0x0?!![]:![];})[_0xf865('0xb9')](myreject(_0x2bb0d9)));}}else{_0x2a6486[_0xf865('0x11b')](ami[_0xf865('0xb7')]({'action':_0xf865('0x138'),'command':util[_0xf865('0x84')](_0xf865('0x13d'),_0x34ceb5,!_[_0xf865('0x91')](config['timezones'][_0x273fde])?_0x273fde:'')})['then'](function(_0x129501){return _0x129501[_0xf865('0x13a')]['indexOf']('true')>=0x0?!![]:![];})[_0xf865('0xb9')](myreject(_0x2bb0d9)));}BPromise[_0xf865('0x13e')](_0x2a6486)['then'](function(_0x55e039){var _0x3b0d6c=_[_0xf865('0x13f')](_0x55e039);if(_0x3b0d6c){return _0x3243cb(_0x3b0d6c);}else{_0x485839[_0xf865('0x41')]=_0x27c3fc?_0xf865('0x140'):'INTERVAL_IS_OVERTIME';return _0x2bb0d9(msgResponse(_0xf865('0x141'),_0xf865('0x133'),'Global:\x20'+_0x27c3fc+'\x20'+_0x438a70+'\x20Interval\x20is\x20overtime:\x20'+util[_0xf865('0xa6')](_0x34ceb5,{'showHidden':![],'depth':null})+_0xf865('0x142')+_0x273fde));}})['catch'](function(_0x1a7292){return _0x2bb0d9(msgResponse(_0xf865('0x131'),_0xf865('0x133'),JSON['stringify'](_0x1a7292)));});});};Dialer['prototype'][_0xf865('0x143')]=function(_0x363c59){var _0x44c5a4=this;return function(){switch(_0x363c59['dialMethod']){case _0xf865('0x144'):freeVariablesPredictive(_0x363c59);_0x44c5a4[_0xf865('0x145')](_0x363c59,0x1);break;case _0xf865('0x146'):freeVariablesPredictive(_0x363c59);_0x44c5a4['handlePower'](_0x363c59,_0x363c59[_0xf865('0x147')]);break;case _0xf865('0x5'):_0x44c5a4[_0xf865('0x5')](_0x363c59);break;case'booked':freeVariablesPredictive(_0x363c59);_0x44c5a4[_0xf865('0x145')](_0x363c59,0x1);break;default:freeVariablesPredictive(_0x363c59);logger['error'](_0xf865('0x148'),_0x363c59[_0xf865('0x42')],_0xf865('0x149'));}};};Dialer[_0xf865('0x1c')][_0xf865('0x14a')]=function(_0x3cee8c){var _0x41c7b7=this;return function(){_0x41c7b7[_0xf865('0x14b')](_0x3cee8c);};};Dialer[_0xf865('0x1c')][_0xf865('0x7')]=function(_0x47b155){var _0x311a3d=this;if(isNotPreview(_0x47b155[_0xf865('0x61')])){if(isVoiceQueueOutbound(_0x47b155['type'])&&isActive(_0x47b155[_0xf865('0x60')])){_0x47b155['sendMessageOneNotActive']=!![];BPromise['resolve']()[_0xf865('0xc1')](checkIsLoggedIn(_0x47b155,_0x47b155[_0xf865('0x56')]))[_0xf865('0xc1')](checkIsActive(_0x47b155,_0x47b155[_0xf865('0x60')]))[_0xf865('0xc1')](checkInterval(_0x47b155))[_0xf865('0xc1')](_0x311a3d[_0xf865('0x14c')](_0x47b155))[_0xf865('0xc1')](_0x311a3d[_0xf865('0x14d')](_0x47b155[_0xf865('0x14e')],_0x47b155[_0xf865('0x14f')],_0x47b155[_0xf865('0x42')],_0x47b155))[_0xf865('0xc1')](_0x311a3d[_0xf865('0x150')](_0x47b155[_0xf865('0x46')],_0x47b155[_0xf865('0x14f')],_0x47b155[_0xf865('0x42')],_0x47b155))[_0xf865('0xc1')](_0x311a3d[_0xf865('0x143')](_0x47b155))[_0xf865('0xb9')](loggerCatchQueueSummary(_0xf865('0x151'),_0x47b155));}else{notSendMessagesQueue(_0x47b155);}}else{freeVariablesPredictive(_0x47b155);}};Dialer[_0xf865('0x1c')][_0xf865('0x12f')]=function(){var _0x85b8c1=this;var _0x4addec;for(var _0x2bcdf1 in this['campaigns']){if(this[_0xf865('0xbd')][_0xf865('0xa3')](_0x2bcdf1)){_0x4addec=this[_0xf865('0xbd')][_0x2bcdf1];if(isCampaignIvr(_0x4addec['type'])&&isActive(_0x4addec[_0xf865('0x80')])){_0x4addec['sendMessageOneNotActive']=!![];BPromise[_0xf865('0xc0')]()[_0xf865('0xc1')](checkIsActive(_0x4addec,_0x4addec[_0xf865('0x80')]))[_0xf865('0xc1')](checkInterval(_0x4addec))[_0xf865('0xc1')](_0x85b8c1[_0xf865('0x14c')](_0x4addec))[_0xf865('0xc1')](_0x85b8c1[_0xf865('0x14d')](_0x4addec[_0xf865('0x14e')],_0x4addec[_0xf865('0x14f')],_0x4addec[_0xf865('0x42')],_0x4addec))[_0xf865('0xc1')](_0x85b8c1[_0xf865('0x150')](_0x4addec[_0xf865('0x46')],_0x4addec[_0xf865('0x14f')],_0x4addec[_0xf865('0x42')],_0x4addec))[_0xf865('0xc1')](_0x85b8c1['launchHandleIvr'](_0x4addec))['catch'](loggerCatchQueueSummary(_0xf865('0x152'),_0x4addec));}else{notSendMessagesCampaign(_0x4addec);}}}};function getCallerIdRandom(_0x347852,_0x16ac70){var _0x39c5db,_0x55c89a,_0x4db49b;if(_0x16ac70<=0x0){_0x16ac70=0x1;}_0x39c5db=new RegExp(_0xf865('0x153')+_0x16ac70+'}$');_0x55c89a=Math[_0xf865('0x154')](0xa,_0x16ac70-0x1);_0x4db49b=Math[_0xf865('0x154')](0xa,_0x16ac70)-0x1;return util['format']('%s',_[_0xf865('0x155')](_0x347852,_0x39c5db,_[_0xf865('0x156')](_0x55c89a,_0x4db49b)));}function extractCalleridName(_0x544df9){var _0x43d62d=_0x544df9[_0xf865('0x157')](/"(.*?)"/);return _0x43d62d?_0x43d62d[0x1]:_0x544df9;}function extractCalleridNumber(_0x37e7af){var _0x373676=_0x37e7af['match'](/<(.*?)>/);return _0x373676?_0x373676[0x1]:_0x37e7af;}Dialer[_0xf865('0x1c')][_0xf865('0x158')]=function(_0x3c5f9e,_0x596e10){var _0x7a5508=this;var _0x3be882=uuid['v4']();this[_0xf865('0x25')][_0x3be882]=new Action(_0x3c5f9e,_0x596e10,_0x3be882);return new BPromise(function(_0x63c4c6,_0x27d475){if(_['isUndefined'](_0x3c5f9e)&&_0xf865('0x159')!==typeof _0x3c5f9e){return _0x27d475(msgResponse('originate',_0xf865('0x133'),_0xf865('0x15a')));}if(_[_0xf865('0x91')](_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')])||_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')]===null){return _0x27d475(msgResponse('originate',_0xf865('0x133'),_0xf865('0x15d')));}var _0x4cad34={'XMD-CALLERID':_0x7a5508[_0xf865('0x25')][_0x3be882][_0xf865('0x15e')](),'XMD-AGI':_0x3c5f9e[_0xf865('0xfa')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x3c5f9e['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x3c5f9e['dialQueueProject2']?util[_0xf865('0x84')](_0xf865('0x15f'),ipAgi,_0x3c5f9e['dialQueueProject2']):_0xf865('0x160'),'XMD-QUEUE':_0x3c5f9e[_0xf865('0x51')]===_0xf865('0x52')?util['format'](_0xf865('0x161'),_0x3c5f9e[_0xf865('0x42')],_0x3c5f9e[_0xf865('0x162')]||'',_0x3c5f9e['dialAgiAfterHangupAgent']?'c':'',_0x3c5f9e[_0xf865('0x10a')]||0x3):'NONE','XMD-CONTACTID':_0x596e10[_0xf865('0x111')],'XMD-CDRTYPE':_0xf865('0x163'),'CALLERID(all)':_0x7a5508[_0xf865('0x25')][_0x3be882][_0xf865('0x15e')](),'XMD-AMD':_0x3c5f9e['dialAMDActive']?_0xf865('0x164'):_0xf865('0x160'),'XMD-DESTINATION':_0xf865('0xe8')};if(_0x3c5f9e[_0xf865('0xe9')]){_0x4cad34[_0xf865('0x165')]=_0x3c5f9e[_0xf865('0x166')]||0x9c4;_0x4cad34['XMD-AMDGREETING']=_0x3c5f9e['dialAMDGreeting']||0x5dc;_0x4cad34['XMD-AMDAFTERGREETINGSILENCE']=_0x3c5f9e[_0xf865('0x167')]||0x320;_0x4cad34['XMD-AMDTOTALANALYSISTIME']=_0x3c5f9e[_0xf865('0x168')]||0x1388;_0x4cad34[_0xf865('0x169')]=_0x3c5f9e[_0xf865('0x16a')]||0x64;_0x4cad34[_0xf865('0x16b')]=_0x3c5f9e[_0xf865('0x16c')]||0x32;_0x4cad34[_0xf865('0x16d')]=_0x3c5f9e[_0xf865('0x16e')]||0x3;_0x4cad34[_0xf865('0x16f')]=_0x3c5f9e[_0xf865('0x170')]||0x100;_0x4cad34[_0xf865('0x171')]=_0x3c5f9e[_0xf865('0x172')]||0x1388;}if(_0x3c5f9e[_0xf865('0x51')]==='outbound'){_0x4cad34[_0xf865('0x173')]=_0x596e10['VoiceQueueId'];}else{_0x4cad34[_0xf865('0x174')]=_0x596e10[_0xf865('0xdb')];}for(var _0x599e22 in _0x596e10[_0xf865('0x15b')]){if(_0x596e10[_0xf865('0x15b')][_0xf865('0xa3')](_0x599e22)){if(isNotNull(_0x596e10[_0xf865('0x15b')][_0x599e22])&&_0x599e22!=='id'&&_0x599e22!==_0xf865('0x175')&&_0x599e22!=='createdAt'&&_0x599e22!==_0xf865('0x176')){_0x4cad34[util[_0xf865('0x84')](_0xf865('0x177'),_0xf865('0x178'),_[_0xf865('0x179')](_0x599e22))]=_0x596e10[_0xf865('0x15b')][_0x599e22];}}}var _0x454a4e=_0x7a5508['isTrunkReachable'](_0x3c5f9e[_0xf865('0x7f')])?getCallerId(_0x3c5f9e[_0xf865('0x7f')]['callerid'],_0x3c5f9e[_0xf865('0x62')],_0x3c5f9e[_0xf865('0x17a')]>0x0?getCallerIdRandom(_0x3c5f9e[_0xf865('0x63')],_0x3c5f9e[_0xf865('0x17a')]):_0x3c5f9e[_0xf865('0x63')]):getCallerId(_[_0xf865('0xe5')](_0x3c5f9e['TrunkBackup'])?_0x3c5f9e[_0xf865('0x7f')][_0xf865('0x81')]:_0x3c5f9e['TrunkBackup'][_0xf865('0x81')],_0x3c5f9e[_0xf865('0x62')],_0x3c5f9e[_0xf865('0x17a')]>0x0?getCallerIdRandom(_0x3c5f9e[_0xf865('0x63')],_0x3c5f9e[_0xf865('0x17a')]):_0x3c5f9e['dialOriginateCallerIdNumber']);if(_0x454a4e){_0x4cad34[_0xf865('0x17b')]=_0x7a5508['actions'][_0x3be882]['originatecalleridname']=extractCalleridName(_0x454a4e);_0x4cad34[_0xf865('0x17c')]=_0x7a5508['actions'][_0x3be882][_0xf865('0x17d')]=extractCalleridNumber(_0x454a4e);}return ami[_0xf865('0xb7')]({'actionid':_0x3be882,'action':_0xf865('0x17e'),'channel':_0x7a5508[_0xf865('0xdf')](_0x3c5f9e[_0xf865('0x7f')])?util[_0xf865('0x84')](_0xf865('0x17f'),_0x3c5f9e['Trunk'][_0xf865('0x42')],isNotNull(_0x3c5f9e[_0xf865('0x65')])?_0x3c5f9e[_0xf865('0x65')][_0xf865('0x180')]()||'':'',_0x3c5f9e[_0xf865('0x181')]>0x0?_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')][_0xf865('0x182')](_0x3c5f9e[_0xf865('0x181')]):_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')]):util[_0xf865('0x84')]('SIP/%s/%s%s',_[_0xf865('0xe5')](_0x3c5f9e[_0xf865('0x183')])?_0x3c5f9e[_0xf865('0x7f')]['name']:_0x3c5f9e[_0xf865('0x183')]['name'],isNotNull(_0x3c5f9e[_0xf865('0x65')])?_0x3c5f9e[_0xf865('0x65')][_0xf865('0x180')]()||'':'',_0x3c5f9e['dialCutDigit']>0x0?_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')]['substring'](_0x3c5f9e[_0xf865('0x181')]):_0x596e10[_0xf865('0x15b')][_0xf865('0x15c')]),'callerid':_0x454a4e,'Exten':_0xf865('0xe8'),'Context':_0xf865('0x184'),'Priority':'1','variable':_0x4cad34,'timeout':(_0x3c5f9e[_0xf865('0x64')]||0x1e)*0x3e8,'async':!![],'channelid':_0x3be882})[_0xf865('0xc1')](function(_0x1ebe41){return _0x63c4c6(_0x1ebe41);})[_0xf865('0xb9')](function(_0x2fa8b6){_0x3c5f9e[_0xf865('0x6d')]+=0x1;var _0x2a7754=new History(_0x7a5508[_0xf865('0x25')][_0x3be882]);logger[_0xf865('0xa0')](util['format'](_0xf865('0x185'),JSON[_0xf865('0x4c')](_0x2fa8b6)));_0x2a7754[_0xf865('0xb2')]=0xe;_0x2a7754['statedesc']=_0xf865('0x186');_0x2a7754[_0xf865('0xb5')]=moment()[_0xf865('0x84')](_0xf865('0x103'));_0x2a7754[_0xf865('0xb4')]=_0x2a7754[_0xf865('0xb5')];_0x7a5508['createHistory'](_0x2a7754)[_0xf865('0xb9')](loggerCatch(_0xf865('0x187')));_0x7a5508[_0xf865('0xd1')](_0x2a7754)[_0xf865('0xb9')](loggerCatch(_0xf865('0x187')))[_0xf865('0x1e')](function(){delete _0x7a5508[_0xf865('0x25')][_0x3be882];return _0x27d475(msgResponse(_0xf865('0x17e'),_0xf865('0x4b'),_0xf865('0x188')));});});});};Dialer[_0xf865('0x1c')]['syncOriginateResponse']=function(_0x3cfb11){var _0x2c1cfb=this[_0xf865('0x25')][_0x3cfb11['actionid']];var _0x10fb1c=this;if(_0x2c1cfb){delete this[_0xf865('0x25')][_0x3cfb11[_0xf865('0x118')]];_0x2c1cfb[_0xf865('0x189')]=moment()[_0xf865('0x84')](_0xf865('0x103'));var _0x2f7d46=_0x2c1cfb[_0xf865('0x51')]===_0xf865('0x83')?this[_0xf865('0xbd')][_0x2c1cfb[_0xf865('0xbc')]]:this[_0xf865('0x20')][_0x2c1cfb[_0xf865('0x18a')]()];if(!this['isSuccess'](_0x3cfb11[_0xf865('0x18b')])){this[_0xf865('0xbb')](_0x2f7d46);return this[_0xf865('0x18c')](_0x2c1cfb,_0x2f7d46,_0x3cfb11)[_0xf865('0xc1')](function(_0x1da4ae){})[_0xf865('0xb9')](loggerCatch(_0xf865('0x18d')));}else{this[_0xf865('0x27')][_0x3cfb11[_0xf865('0xe4')]]=_0x2c1cfb;}}};Dialer['prototype']['checkRetriveMax']=function(_0x3fa131,_0xf320de,_0x310ac5){var _0x32e871=new History(_0xf320de);if(_0x32e871[_0xf865('0x18e')]+_0x32e871['countcongestionretry']+_0x32e871[_0xf865('0x18f')]+_0x32e871[_0xf865('0x190')]+_0x32e871[_0xf865('0x10e')]+_0x32e871['countabandonedretry']+_0x32e871['countmachineretry']+_0x32e871[_0xf865('0x191')]>=_0x310ac5['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x3fa131){case 0x3:if(_0x32e871['countnoanswerretry']>=_0x310ac5[_0xf865('0x192')]-0x1){return!![];}else{this[_0xf865('0xc9')]({'active':![],'countnoanswerretry':_0x32e871[_0xf865('0x18f')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5[_0xf865('0x194')],_0xf865('0x110'))[_0xf865('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e871[_0xf865('0x111')],'ListId':_0x32e871[_0xf865('0xd8')],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch('[rescheduleContact][NoAnswer]'));}break;case 0x5:if(_0x32e871[_0xf865('0x18e')]>=_0x310ac5[_0xf865('0x195')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countbusyretry':_0x32e871[_0xf865('0x18e')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5[_0xf865('0x196')],_0xf865('0x110'))[_0xf865('0x84')](_0xf865('0x103')),'ContactId':_0x32e871[_0xf865('0x111')],'ListId':_0x32e871['ListId'],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871[_0xf865('0xdb')]||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x197')));}break;case 0x8:if(_0x32e871[_0xf865('0x198')]>=_0x310ac5[_0xf865('0x199')]-0x1){return!![];}else{this[_0xf865('0xc9')]({'active':![],'countcongestionretry':_0x32e871['countcongestionretry']+=0x1,'scheduledat':moment()['add'](_0x310ac5[_0xf865('0x19a')],_0xf865('0x110'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e871['ContactId'],'ListId':_0x32e871['ListId'],'VoiceQueueId':_0x32e871['VoiceQueueId']||undefined,'CampaignId':_0x32e871['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x19b')));}break;case 0x0:if(_0x32e871[_0xf865('0x190')]>=_0x310ac5['dialNoSuchNumberMaxRetry']-0x1){return!![];}else{this[_0xf865('0xc9')]({'active':![],'countnosuchnumberretry':_0x32e871['countnosuchnumberretry']+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5[_0xf865('0x19c')],_0xf865('0x110'))[_0xf865('0x84')](_0xf865('0x103')),'ContactId':_0x32e871[_0xf865('0x111')],'ListId':_0x32e871['ListId'],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871[_0xf865('0xdb')]||undefined})['catch'](loggerCatch(_0xf865('0x19d')));}break;case 0xa:if(_0x32e871[_0xf865('0x10e')]>=_0x310ac5[_0xf865('0x10f')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countdropretry':_0x32e871[_0xf865('0x10e')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5['dialDropRetryFrequency'],_0xf865('0x110'))[_0xf865('0x84')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e871[_0xf865('0x111')],'ListId':_0x32e871[_0xf865('0xd8')],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch('[rescheduleContact][Drop]'));}break;case 0xb:if(_0x32e871[_0xf865('0x115')]>=_0x310ac5[_0xf865('0x19e')]-0x1){return!![];}else{this[_0xf865('0xc9')]({'active':![],'countabandonedretry':_0x32e871[_0xf865('0x115')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5[_0xf865('0x116')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x32e871['ContactId'],'ListId':_0x32e871['ListId'],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871[_0xf865('0xdb')]||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x19f')));}break;case 0x13:if(_0x32e871['countmachineretry']>=_0x310ac5[_0xf865('0x1a0')]-0x1){return!![];}else{this['rescheduleContact']({'active':![],'countmachineretry':_0x32e871[_0xf865('0x1a1')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5[_0xf865('0x1a2')],_0xf865('0x110'))[_0xf865('0x84')](_0xf865('0x103')),'ContactId':_0x32e871['ContactId'],'ListId':_0x32e871[_0xf865('0xd8')],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x1a3')));}break;case 0x14:if(_0x32e871[_0xf865('0x191')]>=_0x310ac5['dialAgentRejectMaxRetry']-0x1){return!![];}else{this[_0xf865('0xc9')]({'active':![],'countagentrejectretry':_0x32e871[_0xf865('0x191')]+=0x1,'scheduledat':moment()[_0xf865('0x193')](_0x310ac5['dialAgentRejectRetryFrequency'],_0xf865('0x110'))[_0xf865('0x84')](_0xf865('0x103')),'ContactId':_0x32e871[_0xf865('0x111')],'ListId':_0x32e871[_0xf865('0xd8')],'VoiceQueueId':_0x32e871[_0xf865('0xda')]||undefined,'CampaignId':_0x32e871['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x1a4')));}break;default:return!![];}};Dialer[_0xf865('0x1c')][_0xf865('0x18c')]=function(_0x4b7ec4,_0x5cc8d6,_0x343df7){var _0x2b41ff=this;var _0x329533=new History(_0x4b7ec4);return new BPromise(function(_0x423726,_0x46aa99){if(_[_0xf865('0x91')](_0x5cc8d6)&&_0xf865('0x159')!==typeof _0x5cc8d6){return _0x46aa99(msgResponse(_0xf865('0x1a5'),_0xf865('0x133'),_0xf865('0x1a6')));}if(_['isUndefined'](_0x343df7)&&'object'!==typeof _0x343df7){return _0x46aa99(msgResponse(_0xf865('0x1a5'),_0xf865('0x133'),_0xf865('0x1a7')));}switch(_0x343df7[_0xf865('0x1a8')]){case'0':_0x5cc8d6[_0xf865('0x1a9')]+=0x1;_0x329533['state']=0x0;_0x329533[_0xf865('0xb3')]=_0xf865('0x1aa');_0x2b41ff['createHistory'](_0x329533)[_0xf865('0xb9')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2b41ff[_0xf865('0x1ab')](0x0,_0x4b7ec4,_0x5cc8d6)){if(_0x329533[_0xf865('0x18e')]+_0x329533[_0xf865('0x198')]+_0x329533[_0xf865('0x18f')]+_0x329533[_0xf865('0x190')]+_0x329533[_0xf865('0x10e')]+_0x329533['countabandonedretry']+_0x329533[_0xf865('0x1a1')]+_0x329533[_0xf865('0x191')]>=_0x5cc8d6['dialGlobalMaxRetry']){_0x2b41ff['stateGlobal'](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1ac'));}else{_0x2b41ff[_0xf865('0x1ad')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1ac'));}}break;case'3':_0x5cc8d6['outboundNoAnswerCallsDay']+=0x1;_0x329533[_0xf865('0xb2')]=0x3;_0x329533['statedesc']=_0xf865('0x1ae');_0x329533[_0xf865('0x18f')]+=0x1;_0x329533[_0xf865('0x1af')]+=0x1;_0x2b41ff[_0xf865('0xd2')](_0x329533)[_0xf865('0xb9')](loggerCatch(_0xf865('0x1b0')));if(_0x2b41ff[_0xf865('0x1ab')](0x3,_0x4b7ec4,_0x5cc8d6)){if(_0x329533[_0xf865('0x18f')]>=_0x5cc8d6[_0xf865('0x192')]){_0x2b41ff[_0xf865('0x1ad')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1b1'));}else{_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1b1'));}}break;case'5':_0x5cc8d6[_0xf865('0x68')]+=0x1;_0x329533[_0xf865('0xb2')]=0x5;_0x329533[_0xf865('0xb3')]=_0xf865('0x1b3');_0x329533[_0xf865('0x18e')]+=0x1;_0x329533[_0xf865('0x1af')]+=0x1;_0x2b41ff[_0xf865('0xd2')](_0x329533)['catch'](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x2b41ff[_0xf865('0x1ab')](0x5,_0x4b7ec4,_0x5cc8d6)){if(_0x329533[_0xf865('0x18e')]>=_0x5cc8d6[_0xf865('0x195')]){_0x2b41ff['createStateFinal'](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1b4'));}else{_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,'reason\x205\x20busy');}}break;case'8':_0x5cc8d6[_0xf865('0x69')]+=0x1;_0x329533[_0xf865('0xb2')]=0x8;_0x329533[_0xf865('0xb3')]=_0xf865('0x1b5');_0x329533[_0xf865('0x198')]+=0x1;_0x329533[_0xf865('0x1af')]+=0x1;_0x2b41ff[_0xf865('0xd2')](_0x329533)[_0xf865('0xb9')](loggerCatch(_0xf865('0x1b6')));if(_0x2b41ff[_0xf865('0x1ab')](0x8,_0x4b7ec4,_0x5cc8d6)){if(_0x329533[_0xf865('0x198')]>=_0x5cc8d6['dialCongestionMaxRetry']){_0x2b41ff['createStateFinal'](_0x329533,_0x423726,_0x46aa99,'reason\x208\x20congestion');}else{_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1b7'));}}break;case'11':_0x5cc8d6[_0xf865('0x1b8')]+=0x1;_0x329533[_0xf865('0xb2')]=0xb;_0x329533[_0xf865('0xb3')]='Abandoned';_0x329533[_0xf865('0x115')]+=0x1;_0x329533[_0xf865('0x1af')]+=0x1;_0x2b41ff['createHistory'](_0x329533)[_0xf865('0xb9')](loggerCatch(_0xf865('0x1b9')));if(_0x2b41ff[_0xf865('0x1ab')](0xb,_0x4b7ec4,_0x5cc8d6)){if(_0x329533['countabandonedretry']>=_0x5cc8d6[_0xf865('0x19e')]){_0x2b41ff[_0xf865('0x1ad')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1ba'));}else{_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1ba'));}}break;case'20':_0x5cc8d6[_0xf865('0x6f')]+=0x1;_0x329533[_0xf865('0xb2')]=0x14;_0x329533[_0xf865('0xb3')]=_0xf865('0x1bb');_0x329533[_0xf865('0x191')]+=0x1;_0x329533[_0xf865('0x1af')]+=0x1;_0x2b41ff[_0xf865('0xd2')](_0x329533)[_0xf865('0xb9')](loggerCatch(_0xf865('0x1bc')));if(_0x2b41ff['checkRetriveMax'](0x14,_0x4b7ec4,_0x5cc8d6)){if(_0x329533[_0xf865('0x191')]>=_0x5cc8d6[_0xf865('0x1bd')]){_0x2b41ff[_0xf865('0x1ad')](_0x329533,_0x423726,_0x46aa99,_0xf865('0x1be'));}else{_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,'reason\x2020\x20agentreject');}}break;default:_0x5cc8d6[_0xf865('0x70')]+=0x1;_0x329533['state']=0xc;_0x329533[_0xf865('0xb3')]=_0x343df7[_0xf865('0x1a8')];_0x2b41ff[_0xf865('0xd2')](_0x329533)[_0xf865('0xb9')](loggerCatch(_0xf865('0x1bf')));if(_0x2b41ff['checkRetriveMax'](_0x343df7[_0xf865('0x1a8')],_0x4b7ec4,_0x5cc8d6)){if(_0x329533['countbusyretry']+_0x329533[_0xf865('0x198')]+_0x329533[_0xf865('0x18f')]+_0x329533['countnosuchnumberretry']+_0x329533['countdropretry']+_0x329533[_0xf865('0x115')]+_0x329533['countmachineretry']+_0x329533[_0xf865('0x191')]>=_0x5cc8d6[_0xf865('0x1c0')]){_0x2b41ff[_0xf865('0x1b2')](_0x329533,_0x423726,_0x46aa99,_0x343df7['reason']);}else{_0x2b41ff[_0xf865('0x1ad')](_0x329533,_0x423726,_0x46aa99,_0x343df7[_0xf865('0x1a8')]);}}}});};Dialer[_0xf865('0x1c')]['stateGlobal']=function(_0x303a32,_0x1efe96,_0xafa6e0,_0x54938c){var _0x2d45c0=new Final(_0x303a32);_0x2d45c0[_0xf865('0xb2')]=0xf;_0x2d45c0[_0xf865('0xb3')]='Global';this[_0xf865('0x1ad')](_0x2d45c0,_0x1efe96,_0xafa6e0,_0x54938c);};Dialer['prototype']['createStateFinal']=function(_0x5d6f0f,_0xe21e29,_0x5270f2,_0x3ae187){this[_0xf865('0xd1')](_0x5d6f0f)[_0xf865('0xc1')](function(_0x31c799){return _0xe21e29(msgResponse(_0xf865('0x1a5'),_0xf865('0xde'),_0x3ae187));})[_0xf865('0xb9')](function(_0x1c765e){return _0x5270f2(msgResponse(_0xf865('0x1c1'),_0xf865('0x133'),'contact\x20not\x20moved'));});};Dialer[_0xf865('0x1c')]['predictive']=function(_0x105448){var _0x419c31=this;var _0x3e4a21=_0x105448[_0xf865('0x1c2')]/0x64;var _0x27490a=_0x105448[_0xf865('0x6b')]/(_0x105448[_0xf865('0x6b')]+_0x105448['outboundAnswerCallsDay']);var _0x36a258=Math['round'](_0x105448['predictiveIntervalAvailable']*(_0x105448[_0xf865('0x1c3')]/0x64));var _0x34b1d0=Math[_0xf865('0x1c4')](_0x105448[_0xf865('0x7a')]*(_0x105448[_0xf865('0x1c5')]/0x64));var _0xf8e2e9=_0x105448[_0xf865('0x55')]+_0x105448[_0xf865('0x5b')];var _0x4fcb30=Math['floor'](_0x105448['erlangCalls']*_0x105448[_0xf865('0x7d')]*_0x105448['predictiveIntervalHitRate']*_0x105448[_0xf865('0x78')]);if(_[_0xf865('0x91')](_0x105448['startProgressive'])){if(!_[_0xf865('0x91')](_0x105448[_0xf865('0x28')])){_0x105448['startPredictive']=undefined;loggerPredictive[_0xf865('0xa0')]('[startMethodPredictive][StartProgressive]',_0xf865('0x1c6'));}if(!_[_0xf865('0x91')](_0x105448[_0xf865('0x9b')])){loggerPredictive[_0xf865('0xa0')](_0xf865('0x1c7'),_0xf865('0x1c8'));clearInterval(_0x105448[_0xf865('0x9b')]);_0x105448['handlePredictive']=undefined;}_0x105448[_0xf865('0x29')]=moment()[_0xf865('0x84')](_0xf865('0x103'));loggerPredictive[_0xf865('0x88')](_0x105448[_0xf865('0x42')],_0xf865('0x1c9'),_0x105448['startProgressive']);this[_0xf865('0x145')](_0x105448,0x1);}else if(ifInterval(_0x105448[_0xf865('0x1ca')],_0x105448[_0xf865('0x29')])){this[_0xf865('0x145')](_0x105448,0x1);loggerPredictiveCalls[_0xf865('0x88')]('[startMethodPredictive][StartProgressive][Loop]',_0x105448[_0xf865('0x29')],_0x105448[_0xf865('0x42')]);_0x105448[_0xf865('0x7c')]=0x0;_0x105448[_0xf865('0x76')]=0x0;}else if(_0x3e4a21<_0x27490a&&_0x105448[_0xf865('0x1cb')]===_0xf865('0x1cc')){freeVariablesPredictive(_0x105448);loggerPredictive[_0xf865('0x88')](_0xf865('0x1cd'),'Dropped\x20calls\x20day',_0x27490a,_0xf865('0x29'),_0x105448[_0xf865('0x42')]);}else if(_0x4fcb30<_0x105448[_0xf865('0x76')]&&_0x105448[_0xf865('0x1cb')]===_0xf865('0x1cc')){freeVariablesPredictive(_0x105448);loggerPredictive[_0xf865('0x88')](_0xf865('0x1ce'),_0xf865('0x1cf'),_0x4fcb30,'Drop\x20in\x20this\x20interval',_0x105448[_0xf865('0x76')],'startProgressive',_0x105448[_0xf865('0x42')]);}else if(!ifInterval(_0x105448[_0xf865('0x1ca')],_0x105448[_0xf865('0x29')])&&_['isUndefined'](_0x105448[_0xf865('0x28')])&&!_['isUndefined'](_0x105448[_0xf865('0x29')])){_0x105448[_0xf865('0x28')]=moment()[_0xf865('0x84')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive['info'](_0x105448[_0xf865('0x42')],_0xf865('0x1d0'),_0x105448[_0xf865('0x28')]);this[_0xf865('0xc6')](_0x105448['dialPredictiveInterval'])[_0xf865('0xc1')](this[_0xf865('0x1d1')](_0x105448))[_0xf865('0xc1')](mergeDataErlangB(_0x105448))[_0xf865('0xc1')](this[_0xf865('0x1d2')](_0x105448))[_0xf865('0xb9')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x105448));}else if(!ifInterval(_0x105448['dialPredictiveInterval'],_0x105448[_0xf865('0x28')])){_0x105448['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x105448[_0xf865('0x28')]=moment()[_0xf865('0x84')](_0xf865('0x103'));loggerPredictive[_0xf865('0x88')](_0x105448[_0xf865('0x42')],_0xf865('0x1d3'),_0x105448[_0xf865('0x28')]);clearInterval(_0x105448[_0xf865('0x9b')]);_0x105448[_0xf865('0x9b')]=undefined;this[_0xf865('0xc6')](_0x105448['dialPredictiveInterval'])[_0xf865('0xc1')](this['getDataPredictive'](_0x105448))['then'](mergeDataErlangB(_0x105448))[_0xf865('0xc1')](this[_0xf865('0x1d2')](_0x105448))[_0xf865('0xb9')](loggerCatchPredictive(_0xf865('0x1d4'),_0x105448));}else if(_0x105448['predictiveIntervalAvailable']&&_0xf8e2e9<_0x105448[_0xf865('0x7a')]-_0x34b1d0){freeVariablesPredictive(_0x105448);loggerPredictive[_0xf865('0x88')](_0x105448[_0xf865('0x42')],_0xf865('0x1d5'),_0xf8e2e9,_0xf865('0x1d6'),_0x105448[_0xf865('0x7a')],'-',_0x34b1d0,'=',_0x105448[_0xf865('0x7a')]-_0x34b1d0,')');}else if(_0x105448[_0xf865('0x7a')]&&_0xf8e2e9>_0x105448[_0xf865('0x7a')]+_0x36a258){freeVariablesPredictive(_0x105448);loggerPredictive[_0xf865('0x88')](_0x105448[_0xf865('0x42')],_0xf865('0x1d5'),_0xf8e2e9,')\x20are\x20more\x20than\x20threshold\x20(',_0x105448[_0xf865('0x7a')],'+',_0x36a258,'=',_0x105448[_0xf865('0x7a')]+_0x36a258,')');}};Dialer[_0xf865('0x1c')]['getDataPredictive']=function(_0x4236af){var _0x1b8e99=this;return function(_0x3c92ca){return new BPromise(function(_0x45b65c,_0x13dc6b){_['merge'](_0x4236af,_0x3c92ca[0x0]);if(checkGetDataPredictive(_0x3c92ca[0x0])){var _0x563da2=_0x4236af[_0xf865('0x7a')]=_0x4236af[_0xf865('0x5b')]+_0x4236af[_0xf865('0x55')];var _0x15adac=_0x4236af[_0xf865('0x1ca')]*0x3c;var _0x336d97=_0x3c92ca[0x0]['predictiveIntervalAvgTalktime']+_0x3c92ca[0x0][_0xf865('0x72')];var _0xce594f=(_0x3c92ca[0x0]['predictiveIntervalAnsweredCalls']+_0x3c92ca[0x0][_0xf865('0x74')]+_0x3c92ca[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x3c92ca[0x0][_0xf865('0x7b')];_0x4236af[_0xf865('0x77')]=_0xce594f>0x0?_0xce594f:0x1;switch(_0x4236af[_0xf865('0x1cb')]){case _0xf865('0x1cc'):var _0x34e627=_0x4236af['dialPredictiveOptimizationPercentage']/0x64;return _0x1b8e99[_0xf865('0x1d7')](_0x563da2,_0x15adac,_0x336d97,_0xce594f,_0x34e627)['then'](function(_0x453e0e){return _0x45b65c(_0x453e0e);});case _0xf865('0x1d8'):var _0x1c80f9=_0x4236af[_0xf865('0x1c2')]/0x64;return _0x1b8e99[_0xf865('0x1d9')](_0x563da2,_0x15adac,_0x336d97,_0xce594f,_0x1c80f9)[_0xf865('0xc1')](function(_0x517dff){return _0x45b65c(_0x517dff);});default:return _0x13dc6b(msgResponse('[getDataPredictive]',_0xf865('0x133'),'Unknown\x20Predictive'));}}else{return _0x13dc6b(msgResponse(_0xf865('0x1da'),_0xf865('0x133'),_0xf865('0x1db')));}});};};Dialer[_0xf865('0x1c')]['getDataPredictiveOld']=function(_0x507d26){var _0x6b68c6=this;return function(_0x23f2dd){return new BPromise(function(_0x501709,_0x329460){_[_0xf865('0x99')](_0x507d26,_0x23f2dd[0x0]);if(checkGetDataPredictive(_0x23f2dd[0x0])){loggerPredictive['info'](JSON['stringify'](_0x23f2dd[0x0]));if(_0x507d26[_0xf865('0x1cb')]===_0xf865('0x1cc')){return _0x6b68c6[_0xf865('0xcf')](_0x507d26['id'])[_0xf865('0xc1')](function(_0x1069a2){var _0x46b443=_0x507d26[_0xf865('0x56')]-_0x1069a2[0x0][_0xf865('0x1dc')];var _0x106817=_0x507d26[_0xf865('0x1ca')]*0x3c;var _0x2848b3=_0x23f2dd[0x0]['predictiveIntervalAvgTalktime']+_0x23f2dd[0x0][_0xf865('0x72')];var _0x40670f=(_0x23f2dd[0x0]['predictiveIntervalAnsweredCalls']+_0x23f2dd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x23f2dd[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x23f2dd[0x0]['predictiveIntervalTotalCalls'];var _0x1843a0=_0x507d26[_0xf865('0x1c2')]/0x64;_0x507d26[_0xf865('0x79')]=_0x1069a2[0x0]['outboundQueuePauses']||0x0;_0x507d26[_0xf865('0x77')]=_0x40670f>0x0?_0x40670f:0x1;return _0x6b68c6[_0xf865('0x1d7')](_0x46b443,_0x106817,_0x2848b3,_0x40670f,_0x1843a0);})[_0xf865('0xc1')](function(_0x11ebff){return _0x501709(_0x11ebff);})['catch'](function(_0x57d37f){return _0x329460(msgResponse(_0xf865('0x1dd'),_0xf865('0x133'),JSON['stringify'](_0x57d37f)));});}if(_0x507d26[_0xf865('0x1cb')]===_0xf865('0x1d8')){return _0x6b68c6[_0xf865('0xcf')](_0x507d26['id'])['then'](function(_0x4115b2){var _0xd159af=_0x507d26[_0xf865('0x56')]-_0x4115b2[0x0][_0xf865('0x1dc')];var _0x60b32d=_0x507d26[_0xf865('0x1ca')]*0x3c;var _0x36509a=_0x23f2dd[0x0]['predictiveIntervalAvgTalktime']+_0x23f2dd[0x0][_0xf865('0x72')];var _0x5797f0=(_0x23f2dd[0x0]['predictiveIntervalAnsweredCalls']+_0x23f2dd[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x23f2dd[0x0][_0xf865('0x8d')])/_0x23f2dd[0x0][_0xf865('0x7b')];var _0x29a15a=_0x507d26[_0xf865('0x1c2')]/0x64;_0x507d26[_0xf865('0x79')]=_0x4115b2[0x0][_0xf865('0x1dc')]||0x0;_0x507d26['predictiveIntervalHitRate']=_0x5797f0>0x0?_0x5797f0:0x1;return _0x6b68c6[_0xf865('0x1d9')](_0xd159af,_0x60b32d,_0x36509a,_0x5797f0,_0x29a15a);})[_0xf865('0xc1')](function(_0x30bdfb){return _0x501709(_0x30bdfb);})['catch'](function(_0x1eb172){return _0x329460(msgResponse(_0xf865('0x1dd'),_0xf865('0x133'),JSON['stringify'](_0x1eb172)));});}}else{return _0x329460(msgResponse(_0xf865('0x1da'),'Failure',_0xf865('0x1db')));}});};};Dialer[_0xf865('0x1c')][_0xf865('0x1d2')]=function(_0x431843){var _0x21c40d=this;return function(){var _0x569b32=0x0;var _0x64439b=Math[_0xf865('0x1de')](_0x431843['erlangCallToSecond']*0x3e8);if(_0x64439b>0x0){_0x64439b=_0x64439b<0x64?0x64:_0x64439b;loggerPredictive[_0xf865('0x88')](_0x431843['name'],_0xf865('0x1df'),_0x64439b,_0xf865('0x4d'));_0x431843[_0xf865('0x9b')]=setInterval(function(){_0x21c40d[_0xf865('0x9b')](_0x431843);loggerPredictiveCalls[_0xf865('0x88')](_0xf865('0x1e0'),_0x569b32+=0x1);},_0x64439b);}else{loggerPredictive[_0xf865('0x88')](_0x431843[_0xf865('0x42')],'fail\x20to\x20scheduled\x20calls');}};};Dialer['prototype']['checkContactBlack']=function(_0x53edfa,_0x4086e1){var _0x58d09e=this;return function(_0x4f6203){if(_['isEmpty'](_0x4f6203)){if(_[_0xf865('0xe5')](_0x4086e1[_0xf865('0xd9')])||!_0x4086e1[_0xf865('0x1e1')]){if(_0x53edfa['dialMethod']===_0xf865('0x4')){_0x53edfa[_0xf865('0x11e')]=_[_0xf865('0x91')](_0x53edfa['queueStatusComplete'])?!![]:_0x53edfa[_0xf865('0x11e')];var _0x382d6c=uuid['v4']();_0x58d09e[_0xf865('0x25')][_0x382d6c]=new Action(_0x53edfa,_0x4086e1,_0x382d6c);loggerBooked[_0xf865('0x88')]('[booked][checkContactBlack]',_0x382d6c,_0xf865('0x1e2'),JSON[_0xf865('0x4c')](_0x53edfa['queueStatusComplete']),_0xf865('0x1e3'),_0x53edfa[_0xf865('0x42')]);if(_0x53edfa['queueStatusComplete']){_0x53edfa[_0xf865('0x11e')]=![];_0x58d09e[_0xf865('0x2b')][_0x58d09e[_0xf865('0x25')][_0x382d6c]['queue']]=[];ami['Action']({'actionid':_0x382d6c,'action':'queuestatus','queue':_0x53edfa[_0xf865('0x42')]})['catch'](function(_0x3e5583){_0x58d09e[_0xf865('0xbb')](_0x53edfa);_0x58d09e[_0xf865('0xc9')]({'active':![],'ContactId':_0x58d09e['actions'][_0x382d6c][_0xf865('0x111')],'ListId':_0x58d09e['actions'][_0x382d6c]['ListId'],'VoiceQueueId':_0x58d09e[_0xf865('0x25')][_0x382d6c]['VoiceQueueId']||undefined,'CampaignId':_0x58d09e['actions'][_0x382d6c][_0xf865('0xdb')]||undefined})['catch'](loggerCatch(_0xf865('0x1e4')));delete _0x58d09e['actions'][_0x382d6c];});}else{loggerBooked[_0xf865('0x88')](_0xf865('0x1e5'),JSON['stringify'](_0x53edfa[_0xf865('0x11e')]),_0xf865('0x1e3'),_0x53edfa['name']);_0x58d09e[_0xf865('0xbb')](_0x53edfa);_0x58d09e[_0xf865('0xc9')]({'active':![],'ContactId':_0x58d09e['actions'][_0x382d6c][_0xf865('0x111')],'ListId':_0x58d09e[_0xf865('0x25')][_0x382d6c][_0xf865('0xd8')],'VoiceQueueId':_0x58d09e[_0xf865('0x25')][_0x382d6c][_0xf865('0xda')]||undefined,'CampaignId':_0x58d09e[_0xf865('0x25')][_0x382d6c][_0xf865('0xdb')]||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x1e4')));delete _0x58d09e[_0xf865('0x25')][_0x382d6c];}}else{return _0x58d09e[_0xf865('0x158')](_0x53edfa,_0x4086e1);}}else{if(getDiff(_0x4086e1[_0xf865('0x1e6')])<_0x53edfa[_0xf865('0x1e7')]*0x3c){if(_0x4086e1[_0xf865('0x1e8')]&&!_0x4086e1[_0xf865('0x1e8')]['voicePause']){_0x58d09e[_0xf865('0x9c')][_0xf865('0x121')](_0x4086e1['id'])[_0xf865('0x1e')](function(){_0x58d09e[_0xf865('0xbb')](_0x53edfa);});}else{_0x58d09e['unlockContact']({'active':![]},_0x4086e1['id'],0x1)[_0xf865('0x1e')](function(){console[_0xf865('0x1e9')](_0xf865('0x1ea'));_0x58d09e['updateOriginated'](_0x53edfa);});}}else{_0x53edfa[_0xf865('0x6e')]+=0x1;_0x58d09e['updateOriginated'](_0x53edfa);if(_0x53edfa['dialRecallInQueue']){_0x58d09e['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4086e1['ContactId'],'ListId':_0x4086e1['ListId'],'VoiceQueueId':_0x4086e1[_0xf865('0xda')]||undefined,'CampaignId':_0x4086e1['CampaignId']||undefined})[_0xf865('0xb9')](loggerCatch(_0xf865('0x1eb')));_0x58d09e[_0xf865('0xd2')](createObjHistory(_0x53edfa,_0x4086e1,_0xf865('0x1ec'),0x17,_0xf865('0x1ed')))['catch'](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x58d09e[_0xf865('0xe3')](createObjHistory(_0x53edfa,_0x4086e1,_0xf865('0x1ee'),0x16,_0xf865('0x1ef')),'[Originate][HistoryRecallClose][historyCatch]','[Originate][HistoryRecallClose]');}}}}else{_0x53edfa[_0xf865('0x67')]+=0x1;_0x58d09e[_0xf865('0xe3')](createObjHistory(_0x53edfa,_0x4086e1,'BLACKLIST',0xd,_0xf865('0x1f0')),'[Originate][historyBlacklist]','[Originate][MoveBlacklist]');throw _0xf865('0x1f1');}};};Dialer[_0xf865('0x1c')][_0xf865('0x14b')]=function(_0x3435cd){var _0x343d2b=this;var _0x1d2369=[];var _0x194da3=_0x3435cd[_0xf865('0x1f2')]-_0x3435cd[_0xf865('0xa4')]-_0x3435cd[_0xf865('0x1f3')];emitCampaignSummary(_0x3435cd);if(_0x194da3>0x0){if(_0x194da3>this[_0xf865('0x23')]){_0x194da3=this[_0xf865('0x23')];}_0x3435cd['temp']+=_0x194da3;this['getContactDialerIvr'](_0x3435cd['id'],_0x194da3,_0x3435cd[_0xf865('0x1f4')])['then'](function(_0x55a342){_0x3435cd[_0xf865('0x1f3')]-=_0x194da3;_0x3435cd[_0xf865('0x1f3')]=_0x3435cd[_0xf865('0x1f3')]>0x0?_0x3435cd[_0xf865('0x1f3')]:0x0;if(!checkContactEmpty(_0x55a342)){_0x3435cd[_0xf865('0x41')]='AVAILABLE_CONTACTS_FINISHED';logger['info']('[getContactCampaign2][Empty]'+_0x3435cd['name']);}else{_0x3435cd[_0xf865('0xa4')]+=_0x55a342[_0xf865('0xa2')];_0x3435cd[_0xf865('0x41')]=_0xf865('0x1f5');for(var _0x2aa50f=0x0;_0x2aa50f<_0x55a342[_0xf865('0xa2')];_0x2aa50f+=0x1){_0x3435cd[_0xf865('0x1f6')]+=0x1;if(_[_0xf865('0xe5')](_0x55a342[_0x2aa50f])||_['isNil'](_0x55a342[_0x2aa50f][_0xf865('0x15b')])||_[_0xf865('0xe5')](_0x55a342[_0x2aa50f][_0xf865('0x15b')][_0xf865('0x15c')])){_0x343d2b[_0xf865('0xd6')](_0xf865('0x1f7'),_0x3435cd,_0x55a342[_0x2aa50f]);}else{_0x343d2b['checkIsBlackListIvr'](_[_0xf865('0x11c')](_0x55a342[_0x2aa50f],[_0xf865('0xdb'),_0xf865('0x1f8')]))[_0xf865('0xc1')](_0x343d2b['checkContactBlack'](_0x3435cd,_0x55a342[_0x2aa50f]))['catch'](_0x343d2b[_0xf865('0xd5')](_0xf865('0x1f9'),_0x3435cd));}}}})[_0xf865('0xb9')](loggerGetContactDialer(_0xf865('0x1fa'),_0x3435cd,_0x194da3));}};Dialer[_0xf865('0x1c')][_0xf865('0x145')]=function(_0xea32bb,_0x964781){var _0x379233=this;var _0x2596b1=[];var _0x3dbca0=_0x964781>=0x1?_0x964781:0x1;var _0x178313=[];if(_0xea32bb[_0xf865('0x61')]===_0xf865('0x4')){_0x3dbca0=0x1;}var _0x1f6ac0=Math[_0xf865('0x1de')](_0xea32bb[_0xf865('0x55')]*_0x3dbca0)-_0xea32bb[_0xf865('0xa4')]-_0xea32bb[_0xf865('0x1f3')];emitVoiceQueueSummary(_0xea32bb);if(_0xea32bb[_0xf865('0x1fb')]>0x0){var _0x3c7bff=_0xea32bb[_0xf865('0x1fb')]-_0xea32bb[_0xf865('0xa4')]-_0xea32bb[_0xf865('0x5b')]-_0xea32bb[_0xf865('0x1f3')]-_0xea32bb[_0xf865('0x57')];if(_0x1f6ac0>_0x3c7bff){_0x1f6ac0=_0x3c7bff;}}if(_0x1f6ac0>0x0){if(_0xea32bb[_0xf865('0x61')]==='booked'){_0x1f6ac0=0x1;}if(_0x1f6ac0>this[_0xf865('0x23')]){_0x1f6ac0=this[_0xf865('0x23')];}_0xea32bb['temp']+=_0x1f6ac0;for(var _0x1ee500 in this[_0xf865('0x21')]){if(this[_0xf865('0x21')][_0xf865('0xa3')](_0x1ee500)){if(this[_0xf865('0x21')][_0x1ee500][_0xf865('0xb2')]===_0xf865('0x1fc')&&this['agents'][_0x1ee500][_0xf865('0xb8')]===_0xf865('0xe1')){_0x2596b1['push'](this[_0xf865('0x21')][_0x1ee500]['id']);}}}this[_0xf865('0xcc')](_0xea32bb['id'],_0x2596b1,_0x1f6ac0,_0xea32bb[_0xf865('0x1f4')])[_0xf865('0xc1')](function(_0x566d8f){_0xea32bb['temp']-=_0x1f6ac0;_0xea32bb[_0xf865('0x1f3')]=_0xea32bb['temp']>0x0?_0xea32bb['temp']:0x0;if(!checkContactEmpty(_0x566d8f)){_0x379233[_0xf865('0xbf')](_0xea32bb)[_0xf865('0xc1')](sendMessageReschedule(_0xea32bb))['catch'](loggerCatch(_0xf865('0x1fd')));}else{_0xea32bb[_0xf865('0xa4')]+=_0x566d8f[_0xf865('0xa2')];_0xea32bb[_0xf865('0x41')]=_0xea32bb['dialMethod']===_0xf865('0x4')?_0xf865('0x164'):'RUNNING';for(var _0x20f02d=0x0;_0x20f02d<_0x566d8f[_0xf865('0xa2')];_0x20f02d+=0x1){if(_[_0xf865('0xe5')](_0x566d8f[_0x20f02d])||_[_0xf865('0xe5')](_0x566d8f[_0x20f02d][_0xf865('0x15b')])||_[_0xf865('0xe5')](_0x566d8f[_0x20f02d][_0xf865('0x15b')][_0xf865('0x15c')])){_0x379233[_0xf865('0xd6')]('[actionOriginate]\x20',_0xea32bb,_0x566d8f[_0x20f02d]);}else{_0x379233[_0xf865('0xc2')](_[_0xf865('0x11c')](_0x566d8f[_0x20f02d],[_0xf865('0xda'),_0xf865('0x1f8')]))['then'](_0x379233[_0xf865('0x1fe')](_0xea32bb,_0x566d8f[_0x20f02d]))[_0xf865('0xb9')](_0x379233[_0xf865('0xd5')](_0xf865('0x1f7'),_0xea32bb));}}}})[_0xf865('0xb9')](loggerGetContactDialer(_0xf865('0x1ff'),_0xea32bb,_0x1f6ac0));}};Dialer[_0xf865('0x1c')][_0xf865('0x9b')]=function(_0x3540c9){var _0x38224b=this;if(_0x3540c9[_0xf865('0x1fb')]>0x0){var _0x5ce257=_0x3540c9['dialLimitQueue']-_0x3540c9['originated']-_0x3540c9[_0xf865('0x5b')];if(_0x5ce257>0x0){this[_0xf865('0x200')](_0x3540c9);}else{loggerPredictiveCalls[_0xf865('0x88')]('[handlePredictive][limitChannel]');}}else{this[_0xf865('0x200')](_0x3540c9);}};Dialer[_0xf865('0x1c')][_0xf865('0x200')]=function(_0x7c26d7){var _0x3a0057=this;var _0xd72c91=[];_0x7c26d7[_0xf865('0xa4')]+=0x1;for(var _0xa95a6c in this[_0xf865('0x21')]){if(this[_0xf865('0x21')][_0xf865('0xa3')](_0xa95a6c)){if(this['agents'][_0xa95a6c]['state']===_0xf865('0x1fc')&&this['agents'][_0xa95a6c][_0xf865('0xb8')]===_0xf865('0xe1')){_0xd72c91[_0xf865('0x11b')](this[_0xf865('0x21')][_0xa95a6c]['id']);}}}this['getContactDialer'](_0x7c26d7['id'],_0xd72c91,0x1,_0x7c26d7['dialOrderByScheduledAt'])['then'](function(_0x1a579a){if(!checkContactEmpty(_0x1a579a)){checkContactLowerLimitOriginate(_0x7c26d7,0x1,0x0);_0x3a0057[_0xf865('0xbf')](_0x7c26d7)[_0xf865('0xc1')](sendMessageReschedule(_0x7c26d7))[_0xf865('0xb9')](loggerCatch(_0xf865('0x1fd')));}else{_0x7c26d7[_0xf865('0x41')]='RUNNING';if(_[_0xf865('0xe5')](_0x1a579a[0x0])||_['isNil'](_0x1a579a[0x0]['Contact'])||_[_0xf865('0xe5')](_0x1a579a[0x0]['Contact'][_0xf865('0x15c')])){_0x3a0057['emptyContact'](_0xf865('0x1f7'),_0x7c26d7,_0x1a579a[0x0]);}else{_0x3a0057[_0xf865('0xc2')](_[_0xf865('0x11c')](_0x1a579a[0x0],[_0xf865('0xda'),_0xf865('0x1f8')]))[_0xf865('0xc1')](_0x3a0057[_0xf865('0x1fe')](_0x7c26d7,_0x1a579a[0x0]))['catch'](_0x3a0057[_0xf865('0xd5')](_0xf865('0x201'),_0x7c26d7));}}})[_0xf865('0xb9')](loggerGetContactDialer(_0xf865('0x202'),_0x7c26d7,0x1));emitVoiceQueueSummary(_0x7c26d7);};Dialer[_0xf865('0x1c')][_0xf865('0x1d7')]=function(_0x4e62ad,_0x3b0c95,_0x3e7027,_0x2ffc54,_0x40ae2e,_0x54fed6){loggerPredictive['info'](_0xf865('0x203'));loggerPredictive[_0xf865('0x88')](_0xf865('0x204'),_0x4e62ad);loggerPredictive[_0xf865('0x88')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3b0c95);loggerPredictive['info']('Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x3e7027);loggerPredictive[_0xf865('0x88')](_0xf865('0x205'),_0x2ffc54);loggerPredictive[_0xf865('0x88')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x40ae2e);loggerPredictive[_0xf865('0x88')](_0xf865('0x90'));return new BPromise(function(_0x209aaa,_0x11f405){if(_0x4e62ad<=0x0||isNaN(_0x4e62ad)){return _0x11f405(msgResponse(_0xf865('0x206'),'Error',_0xf865('0x207')+_0x4e62ad));}if(_0x3e7027<=0x0||isNaN(_0x3e7027)){return _0x11f405(msgResponse(_0xf865('0x206'),_0xf865('0x4b'),_0xf865('0x208')+_0x3e7027));}if(_0x2ffc54<=0x0||isNaN(_0x2ffc54)){return _0x11f405(msgResponse(_0xf865('0x206'),_0xf865('0x4b'),_0xf865('0x209')+_0x2ffc54));}if(_0x3b0c95<=0x0||isNaN(_0x3b0c95)){return _0x11f405(msgResponse(_0xf865('0x206'),_0xf865('0x4b'),_0xf865('0x20a')+_0x3b0c95));}if(_0x40ae2e<=0x0||isNaN(_0x40ae2e)){return _0x11f405(msgResponse('[abandonmentRate]',_0xf865('0x4b'),'Amax\x20=\x20'+_0x40ae2e));}_0x54fed6=_0x54fed6||0x0;var _0x83fd75=0x1/_0x3e7027;var _0xfc90a4=0x0;var _0x335c83=0x0;var _0x306a4e=0x0;var _0x3fc9ef=0x0;for(var _0x7f136e=0x0;_0x306a4e<_0x40ae2e;_0x7f136e+=0x1){_0x335c83=_0x7f136e/_0x3b0c95;_0xfc90a4=(_0x2ffc54*_0x335c83+_0x54fed6)/_0x83fd75;_0x306a4e=erlangb(_0xfc90a4,_0x4e62ad);_0x3fc9ef=_0xfc90a4/_0x4e62ad*(0x1-erlangb(_0xfc90a4,_0x4e62ad));}return _0x209aaa({'erlangCalls':_0x7f136e,'erlangCallToSecond':_0x3b0c95/_0x7f136e,'erlangAbandonmentRate':_0x306a4e,'erlangBusyFactor':_0x3fc9ef});});};Dialer['prototype']['busyFactor']=function(_0x2f86d8,_0x5003a5,_0x2a1eaf,_0xb2ab0e,_0x3e139d,_0x146121){loggerPredictive[_0xf865('0x88')](_0xf865('0x20b'));loggerPredictive['info'](_0xf865('0x204'),_0x2f86d8);loggerPredictive['info'](_0xf865('0x20c'),_0x5003a5);loggerPredictive[_0xf865('0x88')](_0xf865('0x20d'),_0x2a1eaf);loggerPredictive[_0xf865('0x88')]('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',_0xb2ab0e);loggerPredictive['info'](_0xf865('0x20e'),_0x3e139d);loggerPredictive[_0xf865('0x88')]('---------------------------');return new BPromise(function(_0x5abd8d,_0xc694e8){if(_0x2f86d8<=0x0||isNaN(_0x2f86d8)){return _0xc694e8(msgResponse(_0xf865('0x20f'),_0xf865('0x4b'),_0xf865('0x207')+_0x2f86d8));}if(_0x2a1eaf<=0x0||isNaN(_0x2a1eaf)){return _0xc694e8(msgResponse(_0xf865('0x20f'),_0xf865('0x4b'),_0xf865('0x208')+_0x2a1eaf));}if(_0xb2ab0e<=0x0||isNaN(_0xb2ab0e)){return _0xc694e8(msgResponse(_0xf865('0x20f'),_0xf865('0x4b'),_0xf865('0x209')+_0xb2ab0e));}if(_0x5003a5<=0x0||isNaN(_0x5003a5)){return _0xc694e8(msgResponse(_0xf865('0x20f'),_0xf865('0x4b'),_0xf865('0x20a')+_0x5003a5));}if(_0x3e139d<=0x0||isNaN(_0x3e139d)){return _0xc694e8(msgResponse('[busyFactor]',_0xf865('0x4b'),'Umin\x20=\x20'+_0x3e139d));}_0x146121=_0x146121||0x0;var _0x1e942b=0x1/_0x2a1eaf;var _0x2889a4=0x0;var _0x118c69=0x0;var _0x1f6bb3=0x0;var _0xc4f483=0x0;for(var _0x3f721b=0x0;_0xc4f483<_0x3e139d;_0x3f721b+=0x1){_0x118c69=_0x3f721b/_0x5003a5;_0x2889a4=(_0xb2ab0e*_0x118c69+_0x146121)/_0x1e942b;_0x1f6bb3=erlangb(_0x2889a4,_0x2f86d8);_0xc4f483=_0x2889a4/_0x2f86d8*(0x1-erlangb(_0x2889a4,_0x2f86d8));}return _0x5abd8d({'erlangCalls':_0x3f721b,'erlangCallToSecond':_0x5003a5/_0x3f721b,'erlangAbandonmentRate':_0x1f6bb3,'erlangBusyFactor':_0xc4f483});});};module[_0xf865('0x210')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index cf5cfca..c53e765 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 _0x8c96=['queue','countbusyretry','countcongestionretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','number','responsetime','droptime','endtime','ringtime','talktime','connectedlinename','reason','callbackuniqueid','recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','diff','scheduledat','type','campaigntype','outbound'];(function(_0x2f1ae9,_0x11ce9a){var _0x2420e7=function(_0x3908ee){while(--_0x3908ee){_0x2f1ae9['push'](_0x2f1ae9['shift']());}};_0x2420e7(++_0x11ce9a);}(_0x8c96,0x1ef));var _0x68c9=function(_0x381543,_0x1aacb5){_0x381543=_0x381543-0x0;var _0x30b94d=_0x8c96[_0x381543];return _0x30b94d;};'use strict';var util=require(_0x68c9('0x0'));var _=require(_0x68c9('0x1'));var moment=require(_0x68c9('0x2'));function getSeconds(_0x1708e7,_0x316199){var _0x4b571a=moment(_0x1708e7)[_0x68c9('0x3')](0x0);var _0x58cf19=moment(_0x316199)[_0x68c9('0x3')](0x0);return _0x4b571a[_0x68c9('0x4')](_0x58cf19,'seconds');}function QueueCallerAbandon(_0x2fa148,_0x20acc6){this[_0x68c9('0x5')]=_0x2fa148[_0x68c9('0x5')];this[_0x68c9('0x6')]=_0x2fa148[_0x68c9('0x6')];this[_0x68c9('0x7')]=_0x2fa148[_0x68c9('0x6')]===_0x68c9('0x8')?_0x68c9('0x9'):_0x2fa148[_0x68c9('0x6')];this[_0x68c9('0xa')]=_0x2fa148[_0x68c9('0xa')];this[_0x68c9('0xb')]=_0x2fa148[_0x68c9('0xb')];this['countnoanswerretry']=_0x2fa148['countnoanswerretry'];this[_0x68c9('0xc')]=_0x2fa148[_0x68c9('0xa')]+_0x2fa148[_0x68c9('0xb')]+_0x2fa148['countnoanswerretry']+_0x2fa148[_0x68c9('0xd')]+_0x2fa148['countdropretry']+_0x2fa148[_0x68c9('0xe')]+_0x2fa148[_0x68c9('0xf')]+_0x2fa148['countagentrejectretry'];this[_0x68c9('0xd')]=_0x2fa148[_0x68c9('0xd')];this['countdropretry']=_0x2fa148['countdropretry'];this[_0x68c9('0xe')]=_0x2fa148[_0x68c9('0xe')];this[_0x68c9('0xf')]=_0x2fa148[_0x68c9('0xf')];this['countagentrejectretry']=_0x2fa148[_0x68c9('0x10')];this[_0x68c9('0x11')]=_0x20acc6[_0x68c9('0x11')];this[_0x68c9('0x12')]=_0x2fa148[_0x68c9('0x13')];this['calleridnum']=_0x2fa148[_0x68c9('0x14')];this['starttime']=_0x2fa148['starttime'];this[_0x68c9('0x15')]=_0x2fa148[_0x68c9('0x15')];this[_0x68c9('0x16')]=_0x2fa148['droptime'];this[_0x68c9('0x17')]=this[_0x68c9('0x16')];this[_0x68c9('0x18')]=getSeconds(_0x2fa148[_0x68c9('0x15')],_0x2fa148['starttime']);this['holdtime']=getSeconds(this[_0x68c9('0x16')],_0x2fa148[_0x68c9('0x15')]);this[_0x68c9('0x19')]=0x0;this[_0x68c9('0x9')]=_0x20acc6[_0x68c9('0x9')];this['membername']=_0x20acc6[_0x68c9('0x1a')];this['reason']=_0x20acc6[_0x68c9('0x1b')];this['callback']=_0x2fa148['callback'];this[_0x68c9('0x1c')]=_0x2fa148[_0x68c9('0x1c')];this['callbackat']=_0x2fa148['callbackat'];this[_0x68c9('0x1d')]=_0x2fa148[_0x68c9('0x1d')];this[_0x68c9('0x1e')]=_0x2fa148[_0x68c9('0x1e')];this[_0x68c9('0x1f')]=_0x2fa148[_0x68c9('0x1f')];this['UserId']=_0x2fa148['UserId'];this[_0x68c9('0x20')]=_0x2fa148['VoiceQueueId'];this[_0x68c9('0x21')]=_0x2fa148['CampaignId'];this[_0x68c9('0x22')]=_0x2fa148[_0x68c9('0x22')]||'';this[_0x68c9('0x23')]=_0x2fa148[_0x68c9('0x23')]||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file +var _0xe795=['uniqueid','calleridname','name','calleridnum','number','starttime','responsetime','droptime','endtime','ringtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','util','lodash','moment','milliseconds','diff','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry'];(function(_0x34e1e7,_0x256967){var _0x1e023e=function(_0x1c4f3f){while(--_0x1c4f3f){_0x34e1e7['push'](_0x34e1e7['shift']());}};_0x1e023e(++_0x256967);}(_0xe795,0x191));var _0x5e79=function(_0xafdafe,_0x590359){_0xafdafe=_0xafdafe-0x0;var _0x47544c=_0xe795[_0xafdafe];return _0x47544c;};'use strict';var util=require(_0x5e79('0x0'));var _=require(_0x5e79('0x1'));var moment=require(_0x5e79('0x2'));function getSeconds(_0x67962a,_0x283a22){var _0x27425f=moment(_0x67962a)[_0x5e79('0x3')](0x0);var _0x2a1bc1=moment(_0x283a22)[_0x5e79('0x3')](0x0);return _0x27425f[_0x5e79('0x4')](_0x2a1bc1,_0x5e79('0x5'));}function QueueCallerAbandon(_0x287930,_0x57ced2){this['scheduledat']=_0x287930[_0x5e79('0x6')];this['type']=_0x287930[_0x5e79('0x7')];this[_0x5e79('0x8')]=_0x287930['type']===_0x5e79('0x9')?'queue':_0x287930[_0x5e79('0x7')];this[_0x5e79('0xa')]=_0x287930[_0x5e79('0xa')];this['countcongestionretry']=_0x287930['countcongestionretry'];this['countnoanswerretry']=_0x287930[_0x5e79('0xb')];this[_0x5e79('0xc')]=_0x287930[_0x5e79('0xa')]+_0x287930[_0x5e79('0xd')]+_0x287930[_0x5e79('0xb')]+_0x287930[_0x5e79('0xe')]+_0x287930[_0x5e79('0xf')]+_0x287930['countabandonedretry']+_0x287930['countmachineretry']+_0x287930[_0x5e79('0x10')];this[_0x5e79('0xe')]=_0x287930['countnosuchnumberretry'];this['countdropretry']=_0x287930['countdropretry'];this[_0x5e79('0x11')]=_0x287930[_0x5e79('0x11')];this[_0x5e79('0x12')]=_0x287930[_0x5e79('0x12')];this[_0x5e79('0x10')]=_0x287930[_0x5e79('0x10')];this['uniqueid']=_0x57ced2[_0x5e79('0x13')];this[_0x5e79('0x14')]=_0x287930[_0x5e79('0x15')];this[_0x5e79('0x16')]=_0x287930[_0x5e79('0x17')];this[_0x5e79('0x18')]=_0x287930[_0x5e79('0x18')];this['responsetime']=_0x287930[_0x5e79('0x19')];this[_0x5e79('0x1a')]=_0x287930[_0x5e79('0x1a')];this[_0x5e79('0x1b')]=this[_0x5e79('0x1a')];this[_0x5e79('0x1c')]=getSeconds(_0x287930[_0x5e79('0x19')],_0x287930[_0x5e79('0x18')]);this['holdtime']=getSeconds(this[_0x5e79('0x1a')],_0x287930[_0x5e79('0x19')]);this['talktime']=0x0;this[_0x5e79('0x1d')]=_0x57ced2[_0x5e79('0x1d')];this[_0x5e79('0x1e')]=_0x57ced2[_0x5e79('0x1f')];this[_0x5e79('0x20')]=_0x57ced2[_0x5e79('0x20')];this['callback']=_0x287930[_0x5e79('0x21')];this[_0x5e79('0x22')]=_0x287930[_0x5e79('0x22')];this[_0x5e79('0x23')]=_0x287930[_0x5e79('0x23')];this[_0x5e79('0x24')]=_0x287930['recallme'];this[_0x5e79('0x25')]=_0x287930[_0x5e79('0x25')];this[_0x5e79('0x26')]=_0x287930['ListId'];this[_0x5e79('0x27')]=_0x287930[_0x5e79('0x27')];this[_0x5e79('0x28')]=_0x287930['VoiceQueueId'];this['CampaignId']=_0x287930['CampaignId'];this['originatecalleridnum']=_0x287930[_0x5e79('0x29')]||'';this['originatecalleridname']=_0x287930['originatecalleridname']||'';}module['exports']=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 77f6954..be742c1 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 _0x93ae=['localstationid','headerinfo','path','AttachmentId','exports','util','moment','uniqueid','channel','format','%s/%s/%s','tech','Trunk','name','fax'];(function(_0x5da1af,_0x1b5e20){var _0x38caca=function(_0x64cecb){while(--_0x64cecb){_0x5da1af['push'](_0x5da1af['shift']());}};_0x38caca(++_0x1b5e20);}(_0x93ae,0x16d));var _0xe93a=function(_0x2e9ca2,_0x35dcea){_0x2e9ca2=_0x2e9ca2-0x0;var _0x269542=_0x93ae[_0x2e9ca2];return _0x269542;};'use strict';var util=require(_0xe93a('0x0'));var _=require('lodash');var moment=require(_0xe93a('0x1'));function Action(_0x3eab96,_0x3b2c9a,_0x268598){this[_0xe93a('0x2')]=_0x3eab96||undefined;this[_0xe93a('0x3')]=util[_0xe93a('0x4')](_0xe93a('0x5'),_0x3b2c9a[_0xe93a('0x6')],_0x3b2c9a[_0xe93a('0x7')][_0xe93a('0x8')],_0x268598[_0xe93a('0x9')]);this[_0xe93a('0xa')]=_0x3b2c9a[_0xe93a('0xa')];this[_0xe93a('0xb')]=_0x3b2c9a[_0xe93a('0xb')];this[_0xe93a('0xc')]=_0x268598[_0xe93a('0xc')];this[_0xe93a('0xd')]=_0x268598[_0xe93a('0xd')];}module[_0xe93a('0xe')]=Action; \ No newline at end of file +var _0x2dff=['%s/%s/%s','tech','Trunk','name','localstationid','headerinfo','AttachmentId','lodash','moment','uniqueid','channel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2dff,0xac));var _0xf2df=function(_0x3a21c1,_0x1dcf73){_0x3a21c1=_0x3a21c1-0x0;var _0x5be9c6=_0x2dff[_0x3a21c1];return _0x5be9c6;};'use strict';var util=require('util');var _=require(_0xf2df('0x0'));var moment=require(_0xf2df('0x1'));function Action(_0x1f556b,_0x5a6f80,_0x387882){this[_0xf2df('0x2')]=_0x1f556b||undefined;this[_0xf2df('0x3')]=util['format'](_0xf2df('0x4'),_0x5a6f80[_0xf2df('0x5')],_0x5a6f80[_0xf2df('0x6')][_0xf2df('0x7')],_0x387882['fax']);this[_0xf2df('0x8')]=_0x5a6f80[_0xf2df('0x8')];this[_0xf2df('0x9')]=_0x5a6f80['headerinfo'];this['path']=_0x387882['path'];this[_0xf2df('0xa')]=_0x387882[_0xf2df('0xa')];}module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index fca7287..ab90c88 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 _0x2c75=['[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','exports','util','lodash','bluebird','moment','path','./util/gs','../../../config/logger','../ami','./channel','./action','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','syncNewchannel','syncVarSet','newstate','syncNewState','bind','newexten','syncNewExten','faxstatus','syncFaxStatus','syncReceiveFax','hangup','originateresponse','prototype','context','from-voip-provider','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','channelstate','channelstatedesc','hasOwnProperty','value','operation','status','filename','\x20syncFaxStatus\x20','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','fax','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','actions','merge','pick','response','reason','AttachmentId','SENDING\x20FAILED\x20','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','faxpages','updateStatus','faxstatusstring','SENDING\x20FAILED','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','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','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working'];(function(_0x16b073,_0x390662){var _0x301039=function(_0x2d5eae){while(--_0x2d5eae){_0x16b073['push'](_0x16b073['shift']());}};_0x301039(++_0x390662);}(_0x2c75,0x1cb));var _0x52c7=function(_0x3c6dce,_0x5424dd){_0x3c6dce=_0x3c6dce-0x0;var _0x1450e9=_0x2c75[_0x3c6dce];return _0x1450e9;};'use strict';var util=require(_0x52c7('0x0'));var _=require(_0x52c7('0x1'));var BPromise=require(_0x52c7('0x2'));var uuid=require('uuid');var moment=require(_0x52c7('0x3'));var path=require(_0x52c7('0x4'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x52c7('0x5'));var logger=require(_0x52c7('0x6'))('fax');var ami=require(_0x52c7('0x7'));var rpcDb=require('./rpcDb');var Channel=require(_0x52c7('0x8'));var ut=require('./util/util');var Action=require(_0x52c7('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x52c7('0xa'));function Fax(_0x2c1e1d){this[_0x52c7('0xb')]={};this[_0x52c7('0xc')]=_0x2c1e1d[_0x52c7('0xc')];this[_0x52c7('0xd')]=_0x2c1e1d[_0x52c7('0xd')];this['actions']={};ami['on'](_0x52c7('0xe'),this[_0x52c7('0xf')]['bind'](this));ami['on']('varset',this[_0x52c7('0x10')]['bind'](this));ami['on'](_0x52c7('0x11'),this[_0x52c7('0x12')][_0x52c7('0x13')](this));ami['on'](_0x52c7('0x14'),this[_0x52c7('0x15')]['bind'](this));ami['on'](_0x52c7('0x16'),this[_0x52c7('0x17')]['bind'](this));ami['on']('receivefax',this[_0x52c7('0x18')]['bind'](this));ami['on'](_0x52c7('0x19'),this['syncHangup'][_0x52c7('0x13')](this));ami['on'](_0x52c7('0x1a'),this['syncOriginateResponse']['bind'](this));}Fax[_0x52c7('0x1b')][_0x52c7('0xf')]=function(_0x597d35){if(_0x597d35[_0x52c7('0x1c')]===_0x52c7('0x1d')){for(var _0x6378e5 in this['faxAccounts']){if(this[_0x52c7('0xc')]['hasOwnProperty'](_0x6378e5)){if(_0x597d35['exten']===this[_0x52c7('0xc')][_0x6378e5][_0x52c7('0x1e')]){this[_0x52c7('0xb')][_0x597d35[_0x52c7('0x1f')]]={};this[_0x52c7('0xb')][_0x597d35[_0x52c7('0x1f')]]['channel']=_0x597d35[_0x52c7('0x20')];this[_0x52c7('0xb')][_0x597d35['uniqueid']]['id']=this[_0x52c7('0xc')][_0x6378e5]['id'];this[_0x52c7('0xb')][_0x597d35[_0x52c7('0x1f')]][_0x52c7('0x21')]=this[_0x52c7('0xc')][_0x6378e5][_0x52c7('0x21')];logger['info'](_0x597d35['uniqueid'],_0x52c7('0x22'));}}}}if(this['actions'][_0x597d35['uniqueid']]){this[_0x52c7('0xb')][_0x597d35['uniqueid']]={};this['channels'][_0x597d35[_0x52c7('0x1f')]]['channel']=_0x597d35[_0x52c7('0x20')];logger[_0x52c7('0x23')](_0x597d35[_0x52c7('0x1f')],_0x52c7('0x22'));}};Fax[_0x52c7('0x1b')][_0x52c7('0x10')]=function(_0x26bcf5){if(this['channels'][_0x26bcf5[_0x52c7('0x1f')]]){for(var _0x1f1c88 in _0x26bcf5[_0x52c7('0x24')]){if(_0x26bcf5['variable']['hasOwnProperty'](_0x1f1c88)){this[_0x52c7('0xb')][_0x26bcf5[_0x52c7('0x1f')]][_0x1f1c88]=_0x26bcf5['value'];}}}};Fax['prototype'][_0x52c7('0x12')]=function(_0x450c96){if(this['channels'][_0x450c96['uniqueid']]){this[_0x52c7('0xb')][_0x450c96['uniqueid']]['channelstate']=_0x450c96[_0x52c7('0x25')];this[_0x52c7('0xb')][_0x450c96[_0x52c7('0x1f')]][_0x52c7('0x26')]=_0x450c96['channelstatedesc'];}};Fax[_0x52c7('0x1b')][_0x52c7('0x15')]=function(_0x54d873){if(this[_0x52c7('0xb')][_0x54d873[_0x52c7('0x1f')]]){for(var _0x2d53ce in _0x54d873[_0x52c7('0x24')]){if(_0x54d873[_0x52c7('0x24')][_0x52c7('0x27')](_0x2d53ce)){this[_0x52c7('0xb')][_0x54d873[_0x52c7('0x1f')]][_0x2d53ce]=_0x54d873[_0x52c7('0x28')];}}}};Fax['prototype'][_0x52c7('0x17')]=function(_0x554ad5){if(this[_0x52c7('0xb')][_0x554ad5[_0x52c7('0x1f')]]){this['channels'][_0x554ad5[_0x52c7('0x1f')]][_0x52c7('0x29')]=_0x554ad5[_0x52c7('0x29')];this['channels'][_0x554ad5[_0x52c7('0x1f')]][_0x52c7('0x2a')]=_0x554ad5[_0x52c7('0x2a')];this[_0x52c7('0xb')][_0x554ad5[_0x52c7('0x1f')]][_0x52c7('0x1e')]=_0x554ad5[_0x52c7('0x1e')];this[_0x52c7('0xb')][_0x554ad5[_0x52c7('0x1f')]][_0x52c7('0x2b')]=_0x554ad5[_0x52c7('0x2b')];logger[_0x52c7('0x23')](_0x554ad5[_0x52c7('0x1f')],_0x52c7('0x2c'));}};Fax['prototype'][_0x52c7('0x18')]=function(_0x3550b3){var _0x253a61=this;if(this[_0x52c7('0xb')][_0x3550b3[_0x52c7('0x1f')]]){var _0x2c4700=this['channels'][_0x3550b3[_0x52c7('0x1f')]]['id'];this['channels'][_0x3550b3[_0x52c7('0x1f')]]['remotestationid']=_0x3550b3['remotestationid'];this['channels'][_0x3550b3[_0x52c7('0x1f')]][_0x52c7('0x2d')]=_0x3550b3[_0x52c7('0x2d')];this['channels'][_0x3550b3['uniqueid']][_0x52c7('0x1e')]=_0x3550b3[_0x52c7('0x1e')];this[_0x52c7('0xb')][_0x3550b3[_0x52c7('0x1f')]][_0x52c7('0x2e')]=_0x3550b3['resolution'];this[_0x52c7('0xb')][_0x3550b3[_0x52c7('0x1f')]]['transferrate']=_0x3550b3[_0x52c7('0x2f')];this['channels'][_0x3550b3['uniqueid']][_0x52c7('0x2b')]=_0x3550b3[_0x52c7('0x2b')];this[_0x52c7('0xb')][_0x3550b3[_0x52c7('0x1f')]]['calleridnum']=_0x3550b3[_0x52c7('0x30')];if(this['channels'][_0x3550b3['uniqueid']][_0x52c7('0x2d')]>0x0){tiff2pdf(_0x3550b3[_0x52c7('0x2b')],_0x52c7('0x31'),function(_0x1f9ca7){logger[_0x52c7('0x23')](_0x3550b3[_0x52c7('0x1f')],_0x52c7('0x32'),_0x1f9ca7[_0x52c7('0x33')]);attachment[_0x52c7('0x34')]({'name':path[_0x52c7('0x35')](_0x3550b3['filename'])[_0x52c7('0x21')],'basename':path[_0x52c7('0x35')](_0x3550b3[_0x52c7('0x2b')])[_0x52c7('0x21')]+_0x52c7('0x36'),'type':_0x52c7('0x37')})[_0x52c7('0x38')](function(_0x56930b){faxAccount[_0x52c7('0x39')](_0x2c4700,{'from':_0x3550b3[_0x52c7('0x30')],'mapKey':_0x52c7('0x3a'),'body':path[_0x52c7('0x35')](_0x3550b3['filename'])['name']+_0x52c7('0x36'),'AttachmentId':_0x56930b['id']})[_0x52c7('0x3b')](function(_0x1928db){logger[_0x52c7('0x3c')](_0x3550b3[_0x52c7('0x1f')],_0x52c7('0x3d'),JSON[_0x52c7('0x3e')](_0x1928db));});})[_0x52c7('0x3b')](function(_0x7ef1e0){logger[_0x52c7('0x3c')](_0x3550b3[_0x52c7('0x1f')],_0x52c7('0x3f'),JSON['stringify'](_0x7ef1e0));});});}logger[_0x52c7('0x23')](_0x3550b3[_0x52c7('0x1f')],'\x20receiveFax\x20');}};Fax['prototype']['syncOriginateResponse']=function(_0x17d6b0){if(this[_0x52c7('0x40')][_0x17d6b0[_0x52c7('0x1f')]]){_[_0x52c7('0x41')](this[_0x52c7('0xb')][_0x17d6b0[_0x52c7('0x1f')]],_[_0x52c7('0x42')](_0x17d6b0,[_0x52c7('0x43'),_0x52c7('0x44')]));}};function updateStatus(_0x3026a4){if(_0x3026a4[_0x52c7('0x45')]){faxMessage['update'](_0x3026a4[_0x52c7('0x45')],{'failMessage':_0x52c7('0x46')})['then'](function(_0x65155e){ut[_0x52c7('0x47')]('[Fax][Message][Error][Updated]',_0x65155e);})[_0x52c7('0x3b')](function(_0x36fc22){ut['logger'](_0x52c7('0x48'),_0x36fc22);});}else{ut[_0x52c7('0x47')](_0x52c7('0x49'));}}Fax[_0x52c7('0x1b')]['updateStatus']=function(_0x47fd3c,_0x81cfd1,_0x1be146){var _0x40845f=this;var _0x259705={};if(_0x81cfd1){_0x259705={'read':_0x81cfd1};}else{_0x259705={'failMessage':_0x1be146};}if(this[_0x52c7('0x40')][_0x47fd3c][_0x52c7('0x45')]){faxMessage['update'](this['actions'][_0x47fd3c]['AttachmentId'],_0x259705)[_0x52c7('0x38')](function(_0x156c98){ut['logger'](_0x52c7('0x4a'),_0x156c98);})[_0x52c7('0x3b')](function(_0x348ac3){ut[_0x52c7('0x47')](_0x52c7('0x4b'),_0x348ac3);})[_0x52c7('0x4c')](function(){delete _0x40845f[_0x52c7('0xb')][_0x47fd3c];delete _0x40845f['actions'][_0x47fd3c];});}else{ut[_0x52c7('0x47')](_0x52c7('0x4d'));delete this['channels'][_0x47fd3c];delete this[_0x52c7('0x40')][_0x47fd3c];}};Fax['prototype'][_0x52c7('0x4e')]=function(_0x2b690d){var _0x547c36=this;if(this[_0x52c7('0xb')][_0x2b690d[_0x52c7('0x1f')]]){if(this['actions'][_0x2b690d[_0x52c7('0x1f')]]){this['channels'][_0x2b690d[_0x52c7('0x1f')]]['id']=this[_0x52c7('0x40')][_0x2b690d['uniqueid']]['id'];this[_0x52c7('0xb')][_0x2b690d[_0x52c7('0x1f')]][_0x52c7('0x21')]=this[_0x52c7('0x40')][_0x2b690d[_0x52c7('0x1f')]]['name'];}logger[_0x52c7('0x23')](_0x2b690d[_0x52c7('0x1f')],this[_0x52c7('0x40')][_0x2b690d[_0x52c7('0x1f')]]?'\x20hangup\x20sendFile\x20':'\x20hangup\x20faxRiceive\x20',JSON[_0x52c7('0x3e')](this[_0x52c7('0xb')][_0x2b690d['uniqueid']]));if(this[_0x52c7('0x40')][_0x2b690d['uniqueid']]){if(this[_0x52c7('0xb')][_0x2b690d[_0x52c7('0x1f')]][_0x52c7('0x4f')]>0x0&&this[_0x52c7('0xb')][_0x2b690d[_0x52c7('0x1f')]][_0x52c7('0x16')]==='SUCCESS'){this['updateStatus'](_0x2b690d['uniqueid'],!![]);}else{this[_0x52c7('0x50')](_0x2b690d[_0x52c7('0x1f')],![],this[_0x52c7('0xb')][_0x2b690d[_0x52c7('0x1f')]][_0x52c7('0x51')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x2b690d['uniqueid']][_0x52c7('0x51')]:_0x52c7('0x52'));}}}};Fax['prototype'][_0x52c7('0x53')]=function(_0x27ad4f){var _0x51de97=this;return new BPromise(function(_0x782bff,_0x526690){_0x51de97['execOriginate'](_0x27ad4f,_0x51de97[_0x52c7('0xc')][_0x27ad4f[_0x52c7('0x54')]])[_0x52c7('0x38')](function(_0x2c42f6){ut[_0x52c7('0x47')]('[Fax][execOriginate][success]',_0x2c42f6);_0x782bff(ut[_0x52c7('0x33')](_0x52c7('0x55')));})[_0x52c7('0x3b')](function(_0x50ba10){ut['logger'](_0x52c7('0x56'),_0x50ba10);updateStatus(_0x27ad4f);_0x526690(ut[_0x52c7('0x33')](_0x52c7('0x57')));});});};Fax[_0x52c7('0x1b')][_0x52c7('0x58')]=function(_0x1ebcea){var _0x1f6287=this;return new BPromise(function(_0x3b4ca9,_0x21c657){var _0x4965b0=_0x1f6287[_0x52c7('0x59')](_0x1f6287[_0x52c7('0xc')][_0x1ebcea[_0x52c7('0x54')]][_0x52c7('0x5a')],_0x1ebcea);if(_0x4965b0[_0x52c7('0x5b')]){_0x3b4ca9(ut[_0x52c7('0x33')](_0x52c7('0x5c')));}else{_0x21c657(ut[_0x52c7('0x33')](_0x4965b0[_0x52c7('0x33')]));}});};function originate(_0x58b7ea,_0x33f46c,_0x3d1ff6){return new BPromise(function(_0x1b826b,_0x5c3f8c){if(_0x3d1ff6){var _0x58d659=util[_0x52c7('0x5d')](_0x52c7('0x5e'),path[_0x52c7('0x35')](_0x58b7ea[_0x52c7('0x4')])['name'],_0x58b7ea[_0x52c7('0x4')]);gs[_0x52c7('0x5f')](_0x58d659)[_0x52c7('0x38')](function(){_0x58b7ea[_0x52c7('0x4')]=util['format']('%s/%s.tif',path[_0x52c7('0x35')](_0x58b7ea[_0x52c7('0x4')])[_0x52c7('0x60')],path[_0x52c7('0x35')](_0x58b7ea[_0x52c7('0x4')])[_0x52c7('0x21')]);_0x33f46c[_0x52c7('0x61')]=_0x58b7ea[_0x52c7('0x4')];ut['logger'](_0x52c7('0x62'),'');ami['Action'](ut['variablesAction'](_0x58b7ea,_0x33f46c))[_0x52c7('0x38')](function(_0x484570){_0x1b826b(_0x484570);})[_0x52c7('0x3b')](function(_0x4b35e8){_0x5c3f8c(_0x4b35e8);});})[_0x52c7('0x3b')](function(_0x599d73){_0x5c3f8c(_0x599d73);});}else{ami[_0x52c7('0x63')](ut[_0x52c7('0x64')](_0x58b7ea,_0x33f46c))[_0x52c7('0x38')](function(_0x4407d6){_0x1b826b(_0x4407d6);})[_0x52c7('0x3b')](function(_0x5dab48){_0x5c3f8c(_0x5dab48);});}});}Fax['prototype'][_0x52c7('0x65')]=function(_0xcba5ad,_0x255f52){var _0x533be4=this;return new BPromise(function(_0x39be88,_0xa32bef){var _0x1462f5=uuid['v4']();var _0x50e1c8=ut[_0x52c7('0x66')](_0xcba5ad,_0x255f52);_0x533be4[_0x52c7('0x40')][_0x1462f5]=new Action(_0x1462f5,_0x255f52,_0xcba5ad);var _0x1c7fcc=_0x533be4[_0x52c7('0x40')][_0x1462f5];if(path[_0x52c7('0x35')](_0xcba5ad[_0x52c7('0x4')])[_0x52c7('0x67')]===_0x52c7('0x36')){originate(_0x1c7fcc,_0x50e1c8,!![])[_0x52c7('0x38')](function(_0x51b76a){_0x39be88(_0x51b76a);})[_0x52c7('0x3b')](function(_0x291b04){_0xa32bef(_0x291b04);});}else{originate(_0x1c7fcc,_0x50e1c8,![])['then'](function(_0x9b92b1){_0x39be88(_0x9b92b1);})['catch'](function(_0x345dc2){_0xa32bef(_0x345dc2);});}});};Fax['prototype'][_0x52c7('0x68')]=function(_0x143b46){return!_[_0x52c7('0x69')](_0x143b46)&&!_[_0x52c7('0x69')](_0x143b46[_0x52c7('0x21')])&&!_[_0x52c7('0x69')](_0x143b46[_0x52c7('0x6a')])&&_0x143b46[_0x52c7('0x6a')]&&!_[_0x52c7('0x69')](this[_0x52c7('0xd')][util[_0x52c7('0x5d')](_0x52c7('0x6b'),_0x143b46[_0x52c7('0x21')])])&&!_[_0x52c7('0x69')](this[_0x52c7('0xd')][util[_0x52c7('0x5d')](_0x52c7('0x6b'),_0x143b46[_0x52c7('0x21')])][_0x52c7('0x2a')])&&(this[_0x52c7('0xd')][util[_0x52c7('0x5d')](_0x52c7('0x6b'),_0x143b46[_0x52c7('0x21')])]['status']===_0x52c7('0x6c')||this['trunks'][util['format'](_0x52c7('0x6b'),_0x143b46[_0x52c7('0x21')])]['status']==='unmonitored');};Fax[_0x52c7('0x1b')][_0x52c7('0x59')]=function(_0x465c1e,_0x567d3d){if(!this[_0x52c7('0x68')](_0x465c1e)){ut[_0x52c7('0x47')](_0x52c7('0x6d'),_[_0x52c7('0x69')](_0x465c1e)?'':_0x465c1e[_0x52c7('0x21')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x52c7('0x6e')};}if(_[_0x52c7('0x69')](_0x567d3d['fax'])){ut[_0x52c7('0x47')](_0x52c7('0x6f'),JSON[_0x52c7('0x3e')](_0x567d3d));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x567d3d['path'])){ut[_0x52c7('0x47')](_0x52c7('0x70'),JSON['stringify'](_0x567d3d));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x52c7('0x71')]=Fax; \ No newline at end of file +var _0xa7cf=['catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','syncOriginateResponse','pick','response','reason','SENDING\x20FAILED\x20','then','logger','[Fax][Message][Error][NoUpdate1]','updateStatus','AttachmentId','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','FaxAccountId','message','Trunk\x20Reachable','gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit','path','format','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20work]','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','util','lodash','bluebird','uuid','tiff2pdf','./util/gs','../ami','./channel','./util/util','../rpc/attachment','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','bind','varset','syncVarSet','newstate','syncNewExten','syncReceiveFax','syncHangup','prototype','syncNewchannel','context','from-voip-provider','hasOwnProperty','localstationid','channels','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','value','syncNewState','channelstate','channelstatedesc','syncFaxStatus','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','create','parse','.pdf','application/pdf','fax'];(function(_0x87e628,_0x40f176){var _0x1a5387=function(_0x2dd4be){while(--_0x2dd4be){_0x87e628['push'](_0x87e628['shift']());}};_0x1a5387(++_0x40f176);}(_0xa7cf,0x174));var _0xfa7c=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0xa7cf[_0x1589dd];return _0x1bddd1;};'use strict';var util=require(_0xfa7c('0x0'));var _=require(_0xfa7c('0x1'));var BPromise=require(_0xfa7c('0x2'));var uuid=require(_0xfa7c('0x3'));var moment=require('moment');var path=require('path');var tiff2pdf=require(_0xfa7c('0x4'));var gs=require(_0xfa7c('0x5'));var logger=require('../../../config/logger')('fax');var ami=require(_0xfa7c('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0xfa7c('0x7'));var ut=require(_0xfa7c('0x8'));var Action=require('./action');var faxAccount=require('../rpc/faxAccount');var attachment=require(_0xfa7c('0x9'));var faxMessage=require(_0xfa7c('0xa'));function Fax(_0x504b9e){this['channels']={};this[_0xfa7c('0xb')]=_0x504b9e[_0xfa7c('0xb')];this[_0xfa7c('0xc')]=_0x504b9e['trunks'];this[_0xfa7c('0xd')]={};ami['on'](_0xfa7c('0xe'),this['syncNewchannel'][_0xfa7c('0xf')](this));ami['on'](_0xfa7c('0x10'),this[_0xfa7c('0x11')]['bind'](this));ami['on'](_0xfa7c('0x12'),this['syncNewState'][_0xfa7c('0xf')](this));ami['on']('newexten',this[_0xfa7c('0x13')]['bind'](this));ami['on']('faxstatus',this['syncFaxStatus'][_0xfa7c('0xf')](this));ami['on']('receivefax',this[_0xfa7c('0x14')][_0xfa7c('0xf')](this));ami['on']('hangup',this[_0xfa7c('0x15')]['bind'](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));}Fax[_0xfa7c('0x16')][_0xfa7c('0x17')]=function(_0x269d85){if(_0x269d85[_0xfa7c('0x18')]===_0xfa7c('0x19')){for(var _0x20e744 in this[_0xfa7c('0xb')]){if(this[_0xfa7c('0xb')][_0xfa7c('0x1a')](_0x20e744)){if(_0x269d85['exten']===this['faxAccounts'][_0x20e744][_0xfa7c('0x1b')]){this[_0xfa7c('0x1c')][_0x269d85['uniqueid']]={};this[_0xfa7c('0x1c')][_0x269d85[_0xfa7c('0x1d')]][_0xfa7c('0x1e')]=_0x269d85[_0xfa7c('0x1e')];this['channels'][_0x269d85['uniqueid']]['id']=this['faxAccounts'][_0x20e744]['id'];this['channels'][_0x269d85[_0xfa7c('0x1d')]]['name']=this[_0xfa7c('0xb')][_0x20e744][_0xfa7c('0x1f')];logger['info'](_0x269d85[_0xfa7c('0x1d')],_0xfa7c('0x20'));}}}}if(this[_0xfa7c('0xd')][_0x269d85[_0xfa7c('0x1d')]]){this[_0xfa7c('0x1c')][_0x269d85[_0xfa7c('0x1d')]]={};this[_0xfa7c('0x1c')][_0x269d85[_0xfa7c('0x1d')]]['channel']=_0x269d85[_0xfa7c('0x1e')];logger[_0xfa7c('0x21')](_0x269d85[_0xfa7c('0x1d')],_0xfa7c('0x20'));}};Fax[_0xfa7c('0x16')][_0xfa7c('0x11')]=function(_0x10b626){if(this[_0xfa7c('0x1c')][_0x10b626[_0xfa7c('0x1d')]]){for(var _0x2e52ff in _0x10b626[_0xfa7c('0x22')]){if(_0x10b626[_0xfa7c('0x22')]['hasOwnProperty'](_0x2e52ff)){this[_0xfa7c('0x1c')][_0x10b626[_0xfa7c('0x1d')]][_0x2e52ff]=_0x10b626[_0xfa7c('0x23')];}}}};Fax[_0xfa7c('0x16')][_0xfa7c('0x24')]=function(_0x2a344a){if(this[_0xfa7c('0x1c')][_0x2a344a[_0xfa7c('0x1d')]]){this[_0xfa7c('0x1c')][_0x2a344a['uniqueid']][_0xfa7c('0x25')]=_0x2a344a[_0xfa7c('0x25')];this[_0xfa7c('0x1c')][_0x2a344a[_0xfa7c('0x1d')]][_0xfa7c('0x26')]=_0x2a344a['channelstatedesc'];}};Fax[_0xfa7c('0x16')][_0xfa7c('0x13')]=function(_0x17bb2f){if(this['channels'][_0x17bb2f[_0xfa7c('0x1d')]]){for(var _0x23ae15 in _0x17bb2f[_0xfa7c('0x22')]){if(_0x17bb2f[_0xfa7c('0x22')][_0xfa7c('0x1a')](_0x23ae15)){this[_0xfa7c('0x1c')][_0x17bb2f[_0xfa7c('0x1d')]][_0x23ae15]=_0x17bb2f[_0xfa7c('0x23')];}}}};Fax[_0xfa7c('0x16')][_0xfa7c('0x27')]=function(_0xf455ab){if(this[_0xfa7c('0x1c')][_0xf455ab[_0xfa7c('0x1d')]]){this[_0xfa7c('0x1c')][_0xf455ab[_0xfa7c('0x1d')]][_0xfa7c('0x28')]=_0xf455ab[_0xfa7c('0x28')];this[_0xfa7c('0x1c')][_0xf455ab['uniqueid']][_0xfa7c('0x29')]=_0xf455ab[_0xfa7c('0x29')];this['channels'][_0xf455ab[_0xfa7c('0x1d')]][_0xfa7c('0x1b')]=_0xf455ab['localstationid'];this[_0xfa7c('0x1c')][_0xf455ab[_0xfa7c('0x1d')]][_0xfa7c('0x2a')]=_0xf455ab[_0xfa7c('0x2a')];logger[_0xfa7c('0x21')](_0xf455ab[_0xfa7c('0x1d')],_0xfa7c('0x2b'));}};Fax[_0xfa7c('0x16')][_0xfa7c('0x14')]=function(_0x5826ac){var _0x1fbbda=this;if(this[_0xfa7c('0x1c')][_0x5826ac['uniqueid']]){var _0x31713c=this[_0xfa7c('0x1c')][_0x5826ac[_0xfa7c('0x1d')]]['id'];this[_0xfa7c('0x1c')][_0x5826ac[_0xfa7c('0x1d')]][_0xfa7c('0x2c')]=_0x5826ac[_0xfa7c('0x2c')];this[_0xfa7c('0x1c')][_0x5826ac['uniqueid']]['pagestransferred']=_0x5826ac[_0xfa7c('0x2d')];this['channels'][_0x5826ac[_0xfa7c('0x1d')]][_0xfa7c('0x1b')]=_0x5826ac['localstationid'];this['channels'][_0x5826ac[_0xfa7c('0x1d')]]['resolution']=_0x5826ac[_0xfa7c('0x2e')];this[_0xfa7c('0x1c')][_0x5826ac['uniqueid']][_0xfa7c('0x2f')]=_0x5826ac[_0xfa7c('0x2f')];this[_0xfa7c('0x1c')][_0x5826ac[_0xfa7c('0x1d')]]['filename']=_0x5826ac['filename'];this[_0xfa7c('0x1c')][_0x5826ac['uniqueid']][_0xfa7c('0x30')]=_0x5826ac['calleridnum'];if(this[_0xfa7c('0x1c')][_0x5826ac[_0xfa7c('0x1d')]]['pagestransferred']>0x0){tiff2pdf(_0x5826ac['filename'],_0xfa7c('0x31'),function(_0x4ac8d6){logger[_0xfa7c('0x21')](_0x5826ac[_0xfa7c('0x1d')],_0xfa7c('0x32'),_0x4ac8d6['message']);attachment[_0xfa7c('0x33')]({'name':path['parse'](_0x5826ac[_0xfa7c('0x2a')])[_0xfa7c('0x1f')],'basename':path[_0xfa7c('0x34')](_0x5826ac[_0xfa7c('0x2a')])[_0xfa7c('0x1f')]+_0xfa7c('0x35'),'type':_0xfa7c('0x36')})['then'](function(_0x550e95){faxAccount['notify'](_0x31713c,{'from':_0x5826ac[_0xfa7c('0x30')],'mapKey':_0xfa7c('0x37'),'body':path[_0xfa7c('0x34')](_0x5826ac[_0xfa7c('0x2a')])['name']+_0xfa7c('0x35'),'AttachmentId':_0x550e95['id']})[_0xfa7c('0x38')](function(_0x58de64){logger[_0xfa7c('0x39')](_0x5826ac[_0xfa7c('0x1d')],_0xfa7c('0x3a'),JSON['stringify'](_0x58de64));});})[_0xfa7c('0x38')](function(_0x4ca61d){logger[_0xfa7c('0x39')](_0x5826ac[_0xfa7c('0x1d')],_0xfa7c('0x3b'),JSON[_0xfa7c('0x3c')](_0x4ca61d));});});}logger['info'](_0x5826ac[_0xfa7c('0x1d')],_0xfa7c('0x3b'));}};Fax[_0xfa7c('0x16')][_0xfa7c('0x3d')]=function(_0x42e5c2){if(this['actions'][_0x42e5c2[_0xfa7c('0x1d')]]){_['merge'](this[_0xfa7c('0x1c')][_0x42e5c2[_0xfa7c('0x1d')]],_[_0xfa7c('0x3e')](_0x42e5c2,[_0xfa7c('0x3f'),_0xfa7c('0x40')]));}};function updateStatus(_0x594528){if(_0x594528['AttachmentId']){faxMessage['update'](_0x594528['AttachmentId'],{'failMessage':_0xfa7c('0x41')})[_0xfa7c('0x42')](function(_0x47fdc9){ut[_0xfa7c('0x43')]('[Fax][Message][Error][Updated]',_0x47fdc9);})[_0xfa7c('0x38')](function(_0x16a5cf){ut[_0xfa7c('0x43')](_0xfa7c('0x44'),_0x16a5cf);});}else{ut[_0xfa7c('0x43')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0xfa7c('0x16')][_0xfa7c('0x45')]=function(_0x18633f,_0x1ed301,_0x474305){var _0xe01c14=this;var _0x59b43c={};if(_0x1ed301){_0x59b43c={'read':_0x1ed301};}else{_0x59b43c={'failMessage':_0x474305};}if(this[_0xfa7c('0xd')][_0x18633f][_0xfa7c('0x46')]){faxMessage['update'](this['actions'][_0x18633f][_0xfa7c('0x46')],_0x59b43c)[_0xfa7c('0x42')](function(_0x335159){ut[_0xfa7c('0x43')](_0xfa7c('0x47'),_0x335159);})[_0xfa7c('0x38')](function(_0x71cea7){ut['logger'](_0xfa7c('0x48'),_0x71cea7);})[_0xfa7c('0x49')](function(){delete _0xe01c14[_0xfa7c('0x1c')][_0x18633f];delete _0xe01c14[_0xfa7c('0xd')][_0x18633f];});}else{ut['logger'](_0xfa7c('0x4a'));delete this['channels'][_0x18633f];delete this[_0xfa7c('0xd')][_0x18633f];}};Fax['prototype'][_0xfa7c('0x15')]=function(_0x398a06){var _0x31215a=this;if(this[_0xfa7c('0x1c')][_0x398a06['uniqueid']]){if(this[_0xfa7c('0xd')][_0x398a06[_0xfa7c('0x1d')]]){this[_0xfa7c('0x1c')][_0x398a06[_0xfa7c('0x1d')]]['id']=this[_0xfa7c('0xd')][_0x398a06[_0xfa7c('0x1d')]]['id'];this[_0xfa7c('0x1c')][_0x398a06[_0xfa7c('0x1d')]][_0xfa7c('0x1f')]=this['actions'][_0x398a06['uniqueid']][_0xfa7c('0x1f')];}logger['info'](_0x398a06['uniqueid'],this[_0xfa7c('0xd')][_0x398a06['uniqueid']]?'\x20hangup\x20sendFile\x20':_0xfa7c('0x4b'),JSON['stringify'](this[_0xfa7c('0x1c')][_0x398a06[_0xfa7c('0x1d')]]));if(this['actions'][_0x398a06[_0xfa7c('0x1d')]]){if(this['channels'][_0x398a06[_0xfa7c('0x1d')]]['faxpages']>0x0&&this['channels'][_0x398a06[_0xfa7c('0x1d')]]['faxstatus']===_0xfa7c('0x4c')){this['updateStatus'](_0x398a06[_0xfa7c('0x1d')],!![]);}else{this[_0xfa7c('0x45')](_0x398a06[_0xfa7c('0x1d')],![],this[_0xfa7c('0x1c')][_0x398a06[_0xfa7c('0x1d')]][_0xfa7c('0x4d')]?_0xfa7c('0x4e')+this[_0xfa7c('0x1c')][_0x398a06[_0xfa7c('0x1d')]][_0xfa7c('0x4d')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x344034){var _0x52d4c5=this;return new BPromise(function(_0x210107,_0x4dc2ab){_0x52d4c5[_0xfa7c('0x4f')](_0x344034,_0x52d4c5[_0xfa7c('0xb')][_0x344034['FaxAccountId']])[_0xfa7c('0x42')](function(_0x13f8dd){ut[_0xfa7c('0x43')](_0xfa7c('0x50'),_0x13f8dd);_0x210107(ut['message'](_0xfa7c('0x51')));})[_0xfa7c('0x38')](function(_0x25513d){ut[_0xfa7c('0x43')]('[Fax][execOriginate][failure]',_0x25513d);updateStatus(_0x344034);_0x4dc2ab(ut['message'](_0xfa7c('0x52')));});});};Fax[_0xfa7c('0x16')][_0xfa7c('0x53')]=function(_0x933a22){var _0x27f115=this;return new BPromise(function(_0x16c76f,_0x27d35f){var _0x2b8ae4=_0x27f115[_0xfa7c('0x54')](_0x27f115['faxAccounts'][_0x933a22[_0xfa7c('0x55')]]['Trunk'],_0x933a22);if(_0x2b8ae4['isValid']){_0x16c76f(ut[_0xfa7c('0x56')](_0xfa7c('0x57')));}else{_0x27d35f(ut[_0xfa7c('0x56')](_0x2b8ae4[_0xfa7c('0x56')]));}});};function originate(_0x53c9ff,_0xae275c,_0xfbd31e){return new BPromise(function(_0x53d990,_0x3d1058){if(_0xfbd31e){var _0x3e3c94=util['format'](_0xfa7c('0x58'),path[_0xfa7c('0x34')](_0x53c9ff[_0xfa7c('0x59')])['name'],_0x53c9ff[_0xfa7c('0x59')]);gs['execute'](_0x3e3c94)[_0xfa7c('0x42')](function(){_0x53c9ff[_0xfa7c('0x59')]=util[_0xfa7c('0x5a')](_0xfa7c('0x5b'),path[_0xfa7c('0x34')](_0x53c9ff[_0xfa7c('0x59')])['dir'],path[_0xfa7c('0x34')](_0x53c9ff['path'])[_0xfa7c('0x1f')]);_0xae275c[_0xfa7c('0x5c')]=_0x53c9ff[_0xfa7c('0x59')];ut[_0xfa7c('0x43')](_0xfa7c('0x5d'),'');ami[_0xfa7c('0x5e')](ut[_0xfa7c('0x5f')](_0x53c9ff,_0xae275c))[_0xfa7c('0x42')](function(_0x45afab){_0x53d990(_0x45afab);})[_0xfa7c('0x38')](function(_0x494422){_0x3d1058(_0x494422);});})['catch'](function(_0x4be479){_0x3d1058(_0x4be479);});}else{ami[_0xfa7c('0x5e')](ut['variablesAction'](_0x53c9ff,_0xae275c))[_0xfa7c('0x42')](function(_0x1d46d1){_0x53d990(_0x1d46d1);})[_0xfa7c('0x38')](function(_0x309f02){_0x3d1058(_0x309f02);});}});}Fax['prototype'][_0xfa7c('0x4f')]=function(_0x44f028,_0x244539){var _0x161d5d=this;return new BPromise(function(_0x3373f3,_0x576bd2){var _0x35a3c8=uuid['v4']();var _0x386c93=ut['addVariables'](_0x44f028,_0x244539);_0x161d5d['actions'][_0x35a3c8]=new Action(_0x35a3c8,_0x244539,_0x44f028);var _0x43798b=_0x161d5d['actions'][_0x35a3c8];if(path[_0xfa7c('0x34')](_0x44f028[_0xfa7c('0x59')])['ext']===_0xfa7c('0x35')){originate(_0x43798b,_0x386c93,!![])[_0xfa7c('0x42')](function(_0x547cc4){_0x3373f3(_0x547cc4);})[_0xfa7c('0x38')](function(_0x594c34){_0x576bd2(_0x594c34);});}else{originate(_0x43798b,_0x386c93,![])[_0xfa7c('0x42')](function(_0x18a0e4){_0x3373f3(_0x18a0e4);})['catch'](function(_0x2ee801){_0x576bd2(_0x2ee801);});}});};Fax[_0xfa7c('0x16')][_0xfa7c('0x60')]=function(_0x9980f7){return!_['isNil'](_0x9980f7)&&!_[_0xfa7c('0x61')](_0x9980f7['name'])&&!_[_0xfa7c('0x61')](_0x9980f7['active'])&&_0x9980f7[_0xfa7c('0x62')]&&!_[_0xfa7c('0x61')](this[_0xfa7c('0xc')][util[_0xfa7c('0x5a')](_0xfa7c('0x63'),_0x9980f7[_0xfa7c('0x1f')])])&&!_['isNil'](this[_0xfa7c('0xc')][util[_0xfa7c('0x5a')](_0xfa7c('0x63'),_0x9980f7[_0xfa7c('0x1f')])][_0xfa7c('0x29')])&&(this[_0xfa7c('0xc')][util['format'](_0xfa7c('0x63'),_0x9980f7[_0xfa7c('0x1f')])][_0xfa7c('0x29')]===_0xfa7c('0x64')||this[_0xfa7c('0xc')][util[_0xfa7c('0x5a')]('SIP/%s',_0x9980f7[_0xfa7c('0x1f')])][_0xfa7c('0x29')]===_0xfa7c('0x65'));};Fax['prototype']['checkTrunk']=function(_0x21de53,_0x494473){if(!this[_0xfa7c('0x60')](_0x21de53)){ut[_0xfa7c('0x43')](_0xfa7c('0x66'),_[_0xfa7c('0x61')](_0x21de53)?'':_0x21de53['name']+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0xfa7c('0x67')};}if(_['isNil'](_0x494473[_0xfa7c('0x37')])){ut[_0xfa7c('0x43')]('[Fax][checkTrunk][Empty\x20Fax]',JSON[_0xfa7c('0x3c')](_0x494473));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0xfa7c('0x61')](_0x494473[_0xfa7c('0x59')])){ut[_0xfa7c('0x43')](_0xfa7c('0x68'),JSON[_0xfa7c('0x3c')](_0x494473));return{'isValid':![],'message':_0xfa7c('0x69')};}return{'isValid':!![],'message':_0xfa7c('0x6a')};};module['exports']=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 933364e..b439ee2 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 _0x3216=['bluebird','../../../config/logger','preview','lodash','../rpc/faxAccount','error','notify','util'];(function(_0x1399d6,_0x2c1661){var _0x4a9db4=function(_0x4666b8){while(--_0x4666b8){_0x1399d6['push'](_0x1399d6['shift']());}};_0x4a9db4(++_0x2c1661);}(_0x3216,0x187));var _0x6321=function(_0x3c8bf0,_0x220db4){_0x3c8bf0=_0x3c8bf0-0x0;var _0x422c89=_0x3216[_0x3c8bf0];return _0x422c89;};'use strict';var util=require(_0x6321('0x0'));var BPromise=require(_0x6321('0x1'));var logger=require(_0x6321('0x2'))(_0x6321('0x3'));var _=require(_0x6321('0x4'));var faxAccount=require(_0x6321('0x5'));function loggerCatch(_0x28a72d){return function(_0x8649c2){logger[_0x6321('0x6')](_0x28a72d,util['inspect'](_0x8649c2,{'showHidden':![],'depth':null}));};}exports[_0x6321('0x7')]=function(_0x3c83c4,_0xa8c051){return BPromise['resolve']()['then'](faxAccount[_0x6321('0x7')](_0x3c83c4,_0xa8c051))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x1c81=['lodash','inspect','notify','resolve','then','[Notify]\x20','preview'];(function(_0x2b51c6,_0x1dfe85){var _0x4d0e44=function(_0x288b9d){while(--_0x288b9d){_0x2b51c6['push'](_0x2b51c6['shift']());}};_0x4d0e44(++_0x1dfe85);}(_0x1c81,0xca));var _0x11c8=function(_0x1685d9,_0x371481){_0x1685d9=_0x1685d9-0x0;var _0x4889c9=_0x1c81[_0x1685d9];return _0x4889c9;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require('../../../config/logger')(_0x11c8('0x0'));var _=require(_0x11c8('0x1'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x40b3d4){return function(_0x3abb74){logger['error'](_0x40b3d4,util[_0x11c8('0x2')](_0x3abb74,{'showHidden':![],'depth':null}));};}exports[_0x11c8('0x3')]=function(_0x2c3730,_0x3e2025){return BPromise[_0x11c8('0x4')]()[_0x11c8('0x5')](faxAccount[_0x11c8('0x3')](_0x2c3730,_0x3e2025))['catch'](loggerCatch(_0x11c8('0x6')));}; \ 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 95ec915..4e181de 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 _0xd246=['child_process','exec','execute','Exec\x20gs','\x20Error\x20:','util','fax','bluebird'];(function(_0x696ea7,_0x5deaa8){var _0x2987b3=function(_0x399e22){while(--_0x399e22){_0x696ea7['push'](_0x696ea7['shift']());}};_0x2987b3(++_0x5deaa8);}(_0xd246,0x18d));var _0x6d24=function(_0x1800cb,_0xba50f9){_0x1800cb=_0x1800cb-0x0;var _0x3b5e95=_0xd246[_0x1800cb];return _0x3b5e95;};'use strict';var util=require(_0x6d24('0x0'));var logger=require('../../../../config/logger')(_0x6d24('0x1'));var BPromise=require(_0x6d24('0x2'));var exec=require(_0x6d24('0x3'))[_0x6d24('0x4')];exports[_0x6d24('0x5')]=function(_0x3b859b){return new BPromise(function(_0x26efa4,_0x2eea7c){exec(_0x3b859b,function(_0x54d351,_0x1dfb58,_0x3b9b32){logger['info'](_0x6d24('0x6'),_0x1dfb58);if(_0x54d351){logger['info'](_0x6d24('0x6'),_0x6d24('0x7'),util['inspect'](_0x54d351,{'showHidden':![],'depth':null}),_0x1dfb58,_0x3b9b32);_0x2eea7c(_0x54d351);}_0x26efa4(_0x1dfb58);});});}; \ No newline at end of file +var _0xa496=['child_process','info','Exec\x20gs','\x20Error\x20:','fax','bluebird'];(function(_0x5633b3,_0x1d5142){var _0x58f7c4=function(_0x215be2){while(--_0x215be2){_0x5633b3['push'](_0x5633b3['shift']());}};_0x58f7c4(++_0x1d5142);}(_0xa496,0xd6));var _0x6a49=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa496[_0x3dd15e];return _0x231fd0;};'use strict';var util=require('util');var logger=require('../../../../config/logger')(_0x6a49('0x0'));var BPromise=require(_0x6a49('0x1'));var exec=require(_0x6a49('0x2'))['exec'];exports['execute']=function(_0xe973b3){return new BPromise(function(_0x306fef,_0x2f7f3b){exec(_0xe973b3,function(_0x4f68c9,_0x547c3d,_0x1cf1bd){logger[_0x6a49('0x3')]('Exec\x20gs',_0x547c3d);if(_0x4f68c9){logger['info'](_0x6a49('0x4'),_0x6a49('0x5'),util['inspect'](_0x4f68c9,{'showHidden':![],'depth':null}),_0x547c3d,_0x1cf1bd);_0x2f7f3b(_0x4f68c9);}_0x306fef(_0x547c3d);});});}; \ 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 4b6be68..d36c7ce 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 _0xbdb7=['faxdetect','t38timeout','localstationid','path','variablesAction','originate','channel','from-sip','util','lodash','moment','../../../../config/logger','fax','message','logger','info','headerinfo','minrate','\x22%s\x22','modem','gateway'];(function(_0x347bbe,_0x587a74){var _0x178a9c=function(_0x59076e){while(--_0x59076e){_0x347bbe['push'](_0x347bbe['shift']());}};_0x178a9c(++_0x587a74);}(_0xbdb7,0x12e));var _0x7bdb=function(_0x395155,_0x192ffd){_0x395155=_0x395155-0x0;var _0x179767=_0xbdb7[_0x395155];return _0x179767;};'use strict';var util=require(_0x7bdb('0x0'));var _=require(_0x7bdb('0x1'));var moment=require(_0x7bdb('0x2'));var logger=require(_0x7bdb('0x3'))(_0x7bdb('0x4'));exports[_0x7bdb('0x5')]=function(_0x4496ac){return{'message':_0x4496ac};};exports[_0x7bdb('0x6')]=function(_0x46c068,_0x47aec5){logger[_0x7bdb('0x7')](_0x46c068,util['inspect'](_0x47aec5,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0xffdc86,_0x1e23a3){var _0x493bde={'XMF-ECM':_0x1e23a3['ecm'],'XMF-HEADERINFO':_0x1e23a3[_0x7bdb('0x8')],'XMF-MINRATE':_0x1e23a3[_0x7bdb('0x9')],'XMF-MAXRATE':_0x1e23a3['maxrate'],'XMF-MODEM':util['format'](_0x7bdb('0xa'),_0x1e23a3[_0x7bdb('0xb')]),'XMF-GATEWAY':_0x1e23a3[_0x7bdb('0xc')],'XMF-FAXDETECT':_0x1e23a3[_0x7bdb('0xd')],'XMF-T38TIMEOUT':_0x1e23a3[_0x7bdb('0xe')],'XMF-LOCALSTATIONID':_0x1e23a3[_0x7bdb('0xf')],'XMF-PATH':_0xffdc86[_0x7bdb('0x10')]};return _0x493bde;};exports[_0x7bdb('0x11')]=function(_0x5462da,_0x4e5b8e){return{'actionid':_0x5462da['uniqueid'],'action':_0x7bdb('0x12'),'channel':_0x5462da[_0x7bdb('0x13')],'Exten':'xcally-motion-fax','Context':_0x7bdb('0x14'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x5462da[_0x7bdb('0x8')]?_0x5462da[_0x7bdb('0x8')]:'',_0x5462da['localstationid']),'variable':_0x4e5b8e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x5462da['uniqueid']};}; \ No newline at end of file +var _0xc788=['logger','inspect','addVariables','headerinfo','minrate','maxrate','format','\x22%s\x22','modem','faxdetect','localstationid','path','originate','from-sip','\x22%s\x22\x20<%s>','uniqueid','util','lodash','moment','message'];(function(_0x226695,_0x2b824a){var _0x5314a3=function(_0x3d03b2){while(--_0x3d03b2){_0x226695['push'](_0x226695['shift']());}};_0x5314a3(++_0x2b824a);}(_0xc788,0xc4));var _0x8c78=function(_0x5b7b22,_0x5bc479){_0x5b7b22=_0x5b7b22-0x0;var _0x53dc9d=_0xc788[_0x5b7b22];return _0x53dc9d;};'use strict';var util=require(_0x8c78('0x0'));var _=require(_0x8c78('0x1'));var moment=require(_0x8c78('0x2'));var logger=require('../../../../config/logger')('fax');exports[_0x8c78('0x3')]=function(_0x1af8e2){return{'message':_0x1af8e2};};exports[_0x8c78('0x4')]=function(_0x1d0670,_0x386f0a){logger['info'](_0x1d0670,util[_0x8c78('0x5')](_0x386f0a,{'showHidden':![],'depth':null}));};exports[_0x8c78('0x6')]=function(_0x329152,_0x1ac27f){var _0x205cc1={'XMF-ECM':_0x1ac27f['ecm'],'XMF-HEADERINFO':_0x1ac27f[_0x8c78('0x7')],'XMF-MINRATE':_0x1ac27f[_0x8c78('0x8')],'XMF-MAXRATE':_0x1ac27f[_0x8c78('0x9')],'XMF-MODEM':util[_0x8c78('0xa')](_0x8c78('0xb'),_0x1ac27f[_0x8c78('0xc')]),'XMF-GATEWAY':_0x1ac27f['gateway'],'XMF-FAXDETECT':_0x1ac27f[_0x8c78('0xd')],'XMF-T38TIMEOUT':_0x1ac27f['t38timeout'],'XMF-LOCALSTATIONID':_0x1ac27f[_0x8c78('0xe')],'XMF-PATH':_0x329152[_0x8c78('0xf')]};return _0x205cc1;};exports['variablesAction']=function(_0x1a05a7,_0x95e78e){return{'actionid':_0x1a05a7['uniqueid'],'action':_0x8c78('0x10'),'channel':_0x1a05a7['channel'],'Exten':'xcally-motion-fax','Context':_0x8c78('0x11'),'Priority':'1','callerid':util[_0x8c78('0xa')](_0x8c78('0x12'),_0x1a05a7[_0x8c78('0x7')]?_0x1a05a7[_0x8c78('0x7')]:'',_0x1a05a7[_0x8c78('0xe')]),'variable':_0x95e78e,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x1a05a7[_0x8c78('0x13')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 69af275..8ec95a4 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 _0x9149=['./rpc/faxAccount','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','getVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getDynamics365Accounts','initCampaigns','getVoiceExtensions','initVoiceExtensions','initFaxAccounts','resolve','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/cmHopperHistory','./rpc/voiceExtension'];(function(_0x1048e9,_0x55693a){var _0x4a8f29=function(_0xe3b7eb){while(--_0xe3b7eb){_0x1048e9['push'](_0x1048e9['shift']());}};_0x4a8f29(++_0x55693a);}(_0x9149,0x1d7));var _0x9914=function(_0x4eb67a,_0x5aec85){_0x4eb67a=_0x4eb67a-0x0;var _0x29aa20=_0x9149[_0x4eb67a];return _0x29aa20;};'use strict';var BPromise=require(_0x9914('0x0'));var util=require(_0x9914('0x1'));var moment=require(_0x9914('0x2'));var server=require(_0x9914('0x3'));var Realtime=require(_0x9914('0x4'));var Report=require(_0x9914('0x5'));var Acw=require(_0x9914('0x6'));var Trigger=require(_0x9914('0x7'));var Dialer=require(_0x9914('0x8'));var Preview=require(_0x9914('0x9'));var Fax=require(_0x9914('0xa'));var user=require(_0x9914('0xb'));var voiceQueue=require(_0x9914('0xc'));var voiceQueueReport=require(_0x9914('0xd'));var voiceCallReport=require(_0x9914('0xe'));var trunk=require(_0x9914('0xf'));var trigger=require(_0x9914('0x10'));var template=require('./rpc/template');var cmHopperHistory=require(_0x9914('0x11'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x9914('0x12'));var faxAccount=require(_0x9914('0x13'));var zendesk=require('./rpc/integrations/zendesk');var salesforce=require(_0x9914('0x14'));var sugarcrm=require(_0x9914('0x15'));var freshdesk=require(_0x9914('0x16'));var desk=require(_0x9914('0x17'));var zoho=require(_0x9914('0x18'));var vtiger=require(_0x9914('0x19'));var freshsales=require(_0x9914('0x1a'));var servicenow=require(_0x9914('0x1b'));var dynamics365=require(_0x9914('0x1c'));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()[_0x9914('0x1d')](_0x9914('0x1e'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x9914('0x1d')](_0x9914('0x1e'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x9914('0x1f')](user[_0x9914('0x20')]())[_0x9914('0x1f')](realtime[_0x9914('0x21')]())[_0x9914('0x1f')](user[_0x9914('0x22')]())['then'](realtime['initTelephones']())[_0x9914('0x1f')](trunk['getTrunks']())[_0x9914('0x1f')](realtime['initTrunks']())[_0x9914('0x1f')](voiceQueue[_0x9914('0x23')]())['then'](realtime['initVoiceQueues']())['then'](trigger[_0x9914('0x24')]())['then'](realtime[_0x9914('0x25')]())[_0x9914('0x1f')](template[_0x9914('0x26')]())[_0x9914('0x1f')](realtime[_0x9914('0x27')]())[_0x9914('0x1f')](zendesk[_0x9914('0x28')]())[_0x9914('0x1f')](realtime[_0x9914('0x29')]())[_0x9914('0x1f')](salesforce[_0x9914('0x2a')]())[_0x9914('0x1f')](realtime[_0x9914('0x2b')]())[_0x9914('0x1f')](sugarcrm[_0x9914('0x2c')]())[_0x9914('0x1f')](realtime[_0x9914('0x2d')]())[_0x9914('0x1f')](freshdesk[_0x9914('0x2e')]())[_0x9914('0x1f')](realtime[_0x9914('0x2f')]())['then'](desk[_0x9914('0x30')]())[_0x9914('0x1f')](realtime['initDeskAccounts']())[_0x9914('0x1f')](zoho[_0x9914('0x31')]())[_0x9914('0x1f')](realtime[_0x9914('0x32')]())[_0x9914('0x1f')](vtiger[_0x9914('0x33')]())['then'](realtime[_0x9914('0x34')]())[_0x9914('0x1f')](freshsales[_0x9914('0x35')]())[_0x9914('0x1f')](realtime[_0x9914('0x36')]())[_0x9914('0x1f')](servicenow['getServicenowAccounts']())[_0x9914('0x1f')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x9914('0x37')]())[_0x9914('0x1f')](realtime['initDynamics365Accounts']())[_0x9914('0x1f')](campaign['getCampaigns']())[_0x9914('0x1f')](realtime[_0x9914('0x38')]())['then'](voiceExtension[_0x9914('0x39')]())[_0x9914('0x1f')](realtime[_0x9914('0x3a')]())['then'](faxAccount['getFaxAccounts']())['then'](realtime[_0x9914('0x3b')]())[_0x9914('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0x9914('0x3c')]()[_0x9914('0x1f')](voiceQueueReport['getVoiceQueueReports']())['then'](realtime[_0x9914('0x3d')]())[_0x9914('0x1f')](cmHopperHistory[_0x9914('0x3e')]())['then'](realtime[_0x9914('0x3f')]())[_0x9914('0x1f')](cmHopperHistory['getCampaignHopperHistory']())[_0x9914('0x1f')](realtime[_0x9914('0x40')]())[_0x9914('0x1f')](voiceCallReport[_0x9914('0x41')]())['then'](realtime[_0x9914('0x42')]())[_0x9914('0x1f')](function(_0x89270d){})[_0x9914('0x43')](function(_0x3d0315){console['log'](_0x3d0315);});}function main(){return server['listen'](realtime,preview,fax)['then'](function(_0x371375){return initRealtime();})[_0x9914('0x1f')](function(){return initParams();})[_0x9914('0x1f')](function(){report[_0x9914('0x44')]();setInterval(initRealtime,0x1388);})[_0x9914('0x43')](function(_0x46a347){console[_0x9914('0x45')](_0x46a347);});}main(); \ No newline at end of file +var _0xd86e=['getTrunks','initVoiceQueues','initTriggers','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','initDynamics365Accounts','getCampaigns','initCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','catch','listen','sync','log','bluebird','util','moment','./server','./realtime','./report','./acw','./trigger','./dialer','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','getAgents','initAgents','getTelephones','initTelephones'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd86e,0xfa));var _0xed86=function(_0x4bb6c1,_0x4d467e){_0x4bb6c1=_0x4bb6c1-0x0;var _0x4f7ff4=_0xd86e[_0x4bb6c1];return _0x4f7ff4;};'use strict';var BPromise=require(_0xed86('0x0'));var util=require(_0xed86('0x1'));var moment=require(_0xed86('0x2'));var server=require(_0xed86('0x3'));var Realtime=require(_0xed86('0x4'));var Report=require(_0xed86('0x5'));var Acw=require(_0xed86('0x6'));var Trigger=require(_0xed86('0x7'));var Dialer=require(_0xed86('0x8'));var Preview=require('./preview');var Fax=require('./fax');var user=require('./rpc/user');var voiceQueue=require(_0xed86('0x9'));var voiceQueueReport=require(_0xed86('0xa'));var voiceCallReport=require(_0xed86('0xb'));var trunk=require(_0xed86('0xc'));var trigger=require('./rpc/trigger');var template=require(_0xed86('0xd'));var cmHopperHistory=require(_0xed86('0xe'));var campaign=require(_0xed86('0xf'));var voiceExtension=require(_0xed86('0x10'));var faxAccount=require(_0xed86('0x11'));var zendesk=require(_0xed86('0x12'));var salesforce=require(_0xed86('0x13'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0xed86('0x14'));var desk=require(_0xed86('0x15'));var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0xed86('0x16'));var freshsales=require(_0xed86('0x17'));var servicenow=require(_0xed86('0x18'));var dynamics365=require(_0xed86('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()[_0xed86('0x1a')]('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get'](_0xed86('0x1b'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xed86('0x1c')]()[_0xed86('0x1d')](user[_0xed86('0x1e')]())[_0xed86('0x1d')](realtime[_0xed86('0x1f')]())[_0xed86('0x1d')](user[_0xed86('0x20')]())[_0xed86('0x1d')](realtime[_0xed86('0x21')]())[_0xed86('0x1d')](trunk[_0xed86('0x22')]())[_0xed86('0x1d')](realtime['initTrunks']())[_0xed86('0x1d')](voiceQueue['getVoiceQueues']())[_0xed86('0x1d')](realtime[_0xed86('0x23')]())['then'](trigger['getTriggers']())['then'](realtime[_0xed86('0x24')]())['then'](template['getTemplates']())['then'](realtime[_0xed86('0x25')]())[_0xed86('0x1d')](zendesk[_0xed86('0x26')]())[_0xed86('0x1d')](realtime[_0xed86('0x27')]())[_0xed86('0x1d')](salesforce[_0xed86('0x28')]())[_0xed86('0x1d')](realtime[_0xed86('0x29')]())[_0xed86('0x1d')](sugarcrm['getSugarcrmAccounts']())[_0xed86('0x1d')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0xed86('0x2a')]())[_0xed86('0x1d')](realtime[_0xed86('0x2b')]())[_0xed86('0x1d')](desk[_0xed86('0x2c')]())[_0xed86('0x1d')](realtime[_0xed86('0x2d')]())['then'](zoho[_0xed86('0x2e')]())['then'](realtime[_0xed86('0x2f')]())[_0xed86('0x1d')](vtiger[_0xed86('0x30')]())['then'](realtime[_0xed86('0x31')]())[_0xed86('0x1d')](freshsales[_0xed86('0x32')]())['then'](realtime[_0xed86('0x33')]())[_0xed86('0x1d')](servicenow[_0xed86('0x34')]())['then'](realtime[_0xed86('0x35')]())[_0xed86('0x1d')](dynamics365['getDynamics365Accounts']())[_0xed86('0x1d')](realtime[_0xed86('0x36')]())[_0xed86('0x1d')](campaign[_0xed86('0x37')]())[_0xed86('0x1d')](realtime[_0xed86('0x38')]())[_0xed86('0x1d')](voiceExtension[_0xed86('0x39')]())[_0xed86('0x1d')](realtime[_0xed86('0x3a')]())['then'](faxAccount[_0xed86('0x3b')]())[_0xed86('0x1d')](realtime[_0xed86('0x3c')]())[_0xed86('0x1d')](function(){return realtime;});}function initParams(){return BPromise[_0xed86('0x1c')]()['then'](voiceQueueReport[_0xed86('0x3d')]())[_0xed86('0x1d')](realtime[_0xed86('0x3e')]())[_0xed86('0x1d')](cmHopperHistory[_0xed86('0x3f')]())[_0xed86('0x1d')](realtime[_0xed86('0x40')]())['then'](cmHopperHistory[_0xed86('0x41')]())['then'](realtime[_0xed86('0x42')]())[_0xed86('0x1d')](voiceCallReport['getVoiceCallReports']())['then'](realtime['initVoiceCallReports']())[_0xed86('0x1d')](function(_0x196f70){})[_0xed86('0x43')](function(_0x130070){console['log'](_0x130070);});}function main(){return server[_0xed86('0x44')](realtime,preview,fax)['then'](function(_0x1d0290){return initRealtime();})[_0xed86('0x1d')](function(){return initParams();})[_0xed86('0x1d')](function(){report[_0xed86('0x45')]();setInterval(initRealtime,0x1388);})[_0xed86('0x43')](function(_0x45ee15){console[_0xed86('0x46')](_0x45ee15);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index b2636f8..a2ae84a 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 _0x1db4=['lodash','util','md5','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','mobile','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','toNumber','stringify','format','user:%s','user:save'];(function(_0x58981c,_0x1b8a43){var _0x2f3aae=function(_0x347a01){while(--_0x347a01){_0x58981c['push'](_0x58981c['shift']());}};_0x2f3aae(++_0x1b8a43);}(_0x1db4,0x1c8));var _0x41db=function(_0x431d49,_0x474f1a){_0x431d49=_0x431d49-0x0;var _0x52b90e=_0x1db4[_0x431d49];return _0x52b90e;};'use strict';var _=require(_0x41db('0x0'));var util=require(_0x41db('0x1'));var moment=require('moment');var md5=require(_0x41db('0x2'));var Redis=require(_0x41db('0x3'));var config=require(_0x41db('0x4'));config['redis']=_['defaults'](config[_0x41db('0x5')],{'host':_0x41db('0x6'),'port':0x18eb});var io=require(_0x41db('0x7'))(new Redis(config['redis']));function Agent(_0xcdea93){this['id']=_0xcdea93['id']||0x0;this['name']=_0xcdea93[_0x41db('0x8')]||'';this[_0x41db('0x9')]=_0xcdea93[_0x41db('0x9')]||'';this['accountcode']=_0xcdea93[_0x41db('0xa')]||'';this[_0x41db('0xb')]=_0xcdea93[_0x41db('0xb')]||'';this[_0x41db('0xc')]=_0x41db('0xd');this[_0x41db('0xe')]=0x0;this[_0x41db('0xf')]='unknown';this[_0x41db('0x10')]='';this[_0x41db('0x11')]='';this[_0x41db('0x12')]='';this[_0x41db('0x13')]='';this[_0x41db('0x14')]=_0xcdea93[_0x41db('0x14')]||![];this[_0x41db('0x15')]=_0x41db('0xd');this[_0x41db('0x16')]=0x0;this[_0x41db('0x17')]='';this['voiceStatusQueue']='';this[_0x41db('0x18')]=![];this[_0x41db('0x19')]=![];this[_0x41db('0x2')]='';}Agent['prototype'][_0x41db('0x1a')]=function(_0x4cdc95){var _0xee709;if(_0x4cdc95&&_0x4cdc95[_0x41db('0xc')]){_0xee709=_0x4cdc95[_0x41db('0xc')][_0x41db('0x1b')]();switch(_0xee709){case _0x41db('0x1c'):_0xee709=_0x41db('0x1d');break;case _0x41db('0x1e'):_0xee709=_0x41db('0x1f');break;}}if(_0xee709&&this['voiceStatus']!==_0xee709||_0x4cdc95[_0x41db('0x20')]){this['voiceStatusTime']=_[_0x41db('0x21')](moment()['format']('x'));}if(_0xee709){this[_0x41db('0x15')]=_0xee709;}var _0x1befd4={'id':this['id'],'name':this[_0x41db('0x8')],'email':this[_0x41db('0x9')],'accountcode':this[_0x41db('0xa')],'fullname':this[_0x41db('0xb')],'state':this[_0x41db('0xc')],'stateTime':this[_0x41db('0xe')],'status':this['status'],'address':this[_0x41db('0x10')],'online':this[_0x41db('0x14')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x41db('0x13')],'onhold':this['onhold']};var _0x2ba838=md5(JSON[_0x41db('0x22')](_0x1befd4));if(this['md5']!==_0x2ba838){this['md5']=_0x2ba838;io['to'](util[_0x41db('0x23')](_0x41db('0x24'),_0x1befd4[_0x41db('0x8')]))['emit'](_0x41db('0x25'),_0x1befd4);}};module['exports']=Agent; \ No newline at end of file +var _0x7baf=['toLowerCase','not_inuse','idle','inuse','talking','format','address','stringify','user:%s','emit','user:save','lodash','util','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','stateTime','interface','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','local','prototype','updateStatusRealtime','state'];(function(_0x5de437,_0x3b8e20){var _0xe58691=function(_0x3f5942){while(--_0x3f5942){_0x5de437['push'](_0x5de437['shift']());}};_0xe58691(++_0x3b8e20);}(_0x7baf,0x9b));var _0xf7ba=function(_0x812136,_0x5df217){_0x812136=_0x812136-0x0;var _0x3b5c29=_0x7baf[_0x812136];return _0x3b5c29;};'use strict';var _=require(_0xf7ba('0x0'));var util=require(_0xf7ba('0x1'));var moment=require('moment');var md5=require(_0xf7ba('0x2'));var Redis=require(_0xf7ba('0x3'));var config=require(_0xf7ba('0x4'));config[_0xf7ba('0x5')]=_[_0xf7ba('0x6')](config[_0xf7ba('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0xf7ba('0x7'))(new Redis(config[_0xf7ba('0x5')]));function Agent(_0x3c3688){this['id']=_0x3c3688['id']||0x0;this[_0xf7ba('0x8')]=_0x3c3688[_0xf7ba('0x8')]||'';this['email']=_0x3c3688[_0xf7ba('0x9')]||'';this[_0xf7ba('0xa')]=_0x3c3688['accountcode']||'';this[_0xf7ba('0xb')]=_0x3c3688['fullname']||'';this['state']=_0xf7ba('0xc');this[_0xf7ba('0xd')]=0x0;this['status']=_0xf7ba('0xc');this['address']='';this['phone']='';this['mobile']='';this[_0xf7ba('0xe')]='';this[_0xf7ba('0xf')]=_0x3c3688[_0xf7ba('0xf')]||![];this[_0xf7ba('0x10')]=_0xf7ba('0xc');this[_0xf7ba('0x11')]=0x0;this[_0xf7ba('0x12')]='';this[_0xf7ba('0x13')]='';this[_0xf7ba('0x14')]=![];this[_0xf7ba('0x15')]=![];this[_0xf7ba('0x2')]='';}Agent[_0xf7ba('0x16')][_0xf7ba('0x17')]=function(_0x3ab615){var _0x5936af;if(_0x3ab615&&_0x3ab615[_0xf7ba('0x18')]){_0x5936af=_0x3ab615[_0xf7ba('0x18')][_0xf7ba('0x19')]();switch(_0x5936af){case _0xf7ba('0x1a'):_0x5936af=_0xf7ba('0x1b');break;case _0xf7ba('0x1c'):_0x5936af=_0xf7ba('0x1d');break;}}if(_0x5936af&&this[_0xf7ba('0x10')]!==_0x5936af||_0x3ab615['statePause']){this[_0xf7ba('0x11')]=_['toNumber'](moment()[_0xf7ba('0x1e')]('x'));}if(_0x5936af){this[_0xf7ba('0x10')]=_0x5936af;}var _0x22becd={'id':this['id'],'name':this['name'],'email':this[_0xf7ba('0x9')],'accountcode':this[_0xf7ba('0xa')],'fullname':this[_0xf7ba('0xb')],'state':this['state'],'stateTime':this['stateTime'],'status':this['status'],'address':this[_0xf7ba('0x1f')],'online':this['online'],'voiceStatus':this[_0xf7ba('0x10')],'voiceStatusTime':this[_0xf7ba('0x11')],'voiceStatusCallerIdNumber':this[_0xf7ba('0x12')],'voiceStatusQueue':this[_0xf7ba('0x13')],'interface':this['interface'],'onhold':this['onhold']};var _0x1b576a=md5(JSON[_0xf7ba('0x20')](_0x22becd));if(this[_0xf7ba('0x2')]!==_0x1b576a){this['md5']=_0x1b576a;io['to'](util['format'](_0xf7ba('0x21'),_0x22becd[_0xf7ba('0x8')]))[_0xf7ba('0x22')](_0xf7ba('0x23'),_0x22becd);}};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 ccf71ff..df0a124 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 _0x757a=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x1d997f,_0x259b5a){var _0x307704=function(_0x4358a8){while(--_0x4358a8){_0x1d997f['push'](_0x1d997f['shift']());}};_0x307704(++_0x259b5a);}(_0x757a,0xde));var _0xa757=function(_0xd29c93,_0xe1dcf3){_0xd29c93=_0xd29c93-0x0;var _0x5149be=_0x757a[_0xd29c93];return _0x5149be;};'use strict';function Campaign(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['type']=_0x1acf7d['type']||'campaign';this[_0xa757('0x1')]=0x0;this[_0xa757('0x2')]=0x0;this[_0xa757('0x3')]=0x0;this[_0xa757('0x4')]=0x0;this[_0xa757('0x5')]='';this[_0xa757('0x6')]=!![];this['active']=_0x1acf7d[_0xa757('0x7')];this[_0xa757('0x8')]=_0x1acf7d['limitCalls'];this[_0xa757('0x9')]=_0x1acf7d[_0xa757('0x9')]||null;this[_0xa757('0xa')]=_0x1acf7d[_0xa757('0xa')]?_0x1acf7d[_0xa757('0xa')]:null;this['dialOriginateCallerIdName']=_0x1acf7d[_0xa757('0xb')];this[_0xa757('0xc')]=_0x1acf7d[_0xa757('0xc')];this[_0xa757('0xd')]=_0x1acf7d[_0xa757('0xd')]||0x1e;this[_0xa757('0xe')]=_0x1acf7d[_0xa757('0xe')];this['dialCongestionRetryFrequency']=_0x1acf7d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1acf7d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1acf7d[_0xa757('0xf')];this['dialNoAnswerMaxRetry']=_0x1acf7d['dialNoAnswerMaxRetry'];this[_0xa757('0x10')]=_0x1acf7d['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1acf7d[_0xa757('0x11')];this[_0xa757('0x12')]=_0x1acf7d[_0xa757('0x12')]||_0xa757('0x13');this[_0xa757('0x14')]=_0x1acf7d[_0xa757('0x14')]||undefined;this[_0xa757('0x15')]=_0x1acf7d[_0xa757('0x15')]||undefined;this[_0xa757('0x16')]=_0x1acf7d[_0xa757('0x16')]||undefined;this['TrunkBackup']=_0x1acf7d[_0xa757('0x17')]?_0x1acf7d[_0xa757('0x17')]:undefined;this[_0xa757('0x18')]=_0x1acf7d['Trunk']?_0x1acf7d['Trunk']:undefined;this[_0xa757('0x19')]=_0x1acf7d[_0xa757('0x19')]?_0x1acf7d[_0xa757('0x19')]:undefined;this[_0xa757('0x1a')]=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d[_0xa757('0x1a')]:undefined;this['dialQueueProject']=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d['SquareProject'][_0xa757('0x0')]:undefined;this[_0xa757('0x1b')]=_0x1acf7d[_0xa757('0x1b')]||![];this[_0xa757('0x1c')]=_0x1acf7d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1acf7d[_0xa757('0x1d')];this[_0xa757('0x1e')]=_0x1acf7d[_0xa757('0x1e')];this[_0xa757('0x1f')]=_0x1acf7d[_0xa757('0x1f')];this[_0xa757('0x20')]=_0x1acf7d[_0xa757('0x20')];this[_0xa757('0x21')]=_0x1acf7d[_0xa757('0x21')];this['dialAMDMaximumNumberOfWords']=_0x1acf7d[_0xa757('0x22')];this['dialAMDSilenceThreshold']=_0x1acf7d[_0xa757('0x23')];this['dialAMDMaximumWordLength']=_0x1acf7d[_0xa757('0x24')];}module[_0xa757('0x25')]=Campaign; \ No newline at end of file +var _0x757a=['sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','originated','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message'];(function(_0x31f94d,_0x97563){var _0xca77c0=function(_0x1e9e04){while(--_0x1e9e04){_0x31f94d['push'](_0x31f94d['shift']());}};_0xca77c0(++_0x97563);}(_0x757a,0xde));var _0xa757=function(_0x279953,_0x22326c){_0x279953=_0x279953-0x0;var _0x4c71d0=_0x757a[_0x279953];return _0x4c71d0;};'use strict';function Campaign(_0x1acf7d){this['id']=_0x1acf7d['id']||0x0;this[_0xa757('0x0')]=_0x1acf7d[_0xa757('0x0')]||'';this['type']=_0x1acf7d['type']||'campaign';this[_0xa757('0x1')]=0x0;this[_0xa757('0x2')]=0x0;this[_0xa757('0x3')]=0x0;this[_0xa757('0x4')]=0x0;this[_0xa757('0x5')]='';this[_0xa757('0x6')]=!![];this['active']=_0x1acf7d[_0xa757('0x7')];this[_0xa757('0x8')]=_0x1acf7d['limitCalls'];this[_0xa757('0x9')]=_0x1acf7d[_0xa757('0x9')]||null;this[_0xa757('0xa')]=_0x1acf7d[_0xa757('0xa')]?_0x1acf7d[_0xa757('0xa')]:null;this['dialOriginateCallerIdName']=_0x1acf7d[_0xa757('0xb')];this[_0xa757('0xc')]=_0x1acf7d[_0xa757('0xc')];this[_0xa757('0xd')]=_0x1acf7d[_0xa757('0xd')]||0x1e;this[_0xa757('0xe')]=_0x1acf7d[_0xa757('0xe')];this['dialCongestionRetryFrequency']=_0x1acf7d['dialCongestionRetryFrequency'];this['dialBusyMaxRetry']=_0x1acf7d['dialBusyMaxRetry'];this['dialBusyRetryFrequency']=_0x1acf7d[_0xa757('0xf')];this['dialNoAnswerMaxRetry']=_0x1acf7d['dialNoAnswerMaxRetry'];this[_0xa757('0x10')]=_0x1acf7d['dialNoAnswerRetryFrequency'];this['dialGlobalMaxRetry']=_0x1acf7d[_0xa757('0x11')];this[_0xa757('0x12')]=_0x1acf7d[_0xa757('0x12')]||_0xa757('0x13');this[_0xa757('0x14')]=_0x1acf7d[_0xa757('0x14')]||undefined;this[_0xa757('0x15')]=_0x1acf7d[_0xa757('0x15')]||undefined;this[_0xa757('0x16')]=_0x1acf7d[_0xa757('0x16')]||undefined;this['TrunkBackup']=_0x1acf7d[_0xa757('0x17')]?_0x1acf7d[_0xa757('0x17')]:undefined;this[_0xa757('0x18')]=_0x1acf7d['Trunk']?_0x1acf7d['Trunk']:undefined;this[_0xa757('0x19')]=_0x1acf7d[_0xa757('0x19')]?_0x1acf7d[_0xa757('0x19')]:undefined;this[_0xa757('0x1a')]=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d[_0xa757('0x1a')]:undefined;this['dialQueueProject']=_0x1acf7d[_0xa757('0x1a')]?_0x1acf7d['SquareProject'][_0xa757('0x0')]:undefined;this[_0xa757('0x1b')]=_0x1acf7d[_0xa757('0x1b')]||![];this[_0xa757('0x1c')]=_0x1acf7d['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x1acf7d[_0xa757('0x1d')];this[_0xa757('0x1e')]=_0x1acf7d[_0xa757('0x1e')];this[_0xa757('0x1f')]=_0x1acf7d[_0xa757('0x1f')];this[_0xa757('0x20')]=_0x1acf7d[_0xa757('0x20')];this[_0xa757('0x21')]=_0x1acf7d[_0xa757('0x21')];this['dialAMDMaximumNumberOfWords']=_0x1acf7d[_0xa757('0x22')];this['dialAMDSilenceThreshold']=_0x1acf7d[_0xa757('0x23')];this['dialAMDMaximumWordLength']=_0x1acf7d[_0xa757('0x24')];}module[_0xa757('0x25')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index 485bb4a..7e1698f 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 _0x8863=['calleridnum','calleridname','uniqueid','linkedid','answered','answertime','unmanaged','abandoned','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitorFilename','queue','monitors','mohtime','exports','channel','destinationchannel'];(function(_0x317e30,_0x32ad66){var _0x203788=function(_0x264d38){while(--_0x264d38){_0x317e30['push'](_0x317e30['shift']());}};_0x203788(++_0x32ad66);}(_0x8863,0x1b6));var _0x3886=function(_0x34c300,_0x45abcc){_0x34c300=_0x34c300-0x0;var _0x272bb0=_0x8863[_0x34c300];return _0x272bb0;};'use strict';function Channel(){this['starttime']=null;this[_0x3886('0x0')]='';this[_0x3886('0x1')]='';this[_0x3886('0x2')]=0x0;this[_0x3886('0x3')]='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this['accountcode']=0x0;this['context']='';this[_0x3886('0x4')]=0x0;this[_0x3886('0x5')]=0x0;this['exten']=0x0;this[_0x3886('0x6')]=![];this[_0x3886('0x7')]=null;this['endtime']=null;this[_0x3886('0x8')]=![];this[_0x3886('0x9')]=![];this[_0x3886('0xa')]='';this[_0x3886('0xb')]='';this['duration']=0x0;this[_0x3886('0xc')]=0x0;this[_0x3886('0xd')]=0x0;this[_0x3886('0xe')]=null;this[_0x3886('0xf')]=null;this[_0x3886('0x10')]=null;this['monitor']=![];this[_0x3886('0x11')]=null;this[_0x3886('0x12')]=null;this[_0x3886('0x13')]=[];this['transfercalleridnum']=undefined;this['transferconnectedlinenum']=undefined;this[_0x3886('0x14')]=0x0;}module[_0x3886('0x15')]=Channel; \ No newline at end of file +var _0xa63a=['mohtime','exports','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid','exten','unmanaged','lastapplication','lastdata','billableseconds','holdtime','type','tag','disposition','monitor','monitorFilename','monitors','transfercalleridnum','transferconnectedlinenum'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa63a,0x154));var _0xaa63=function(_0xf273f9,_0x486198){_0xf273f9=_0xf273f9-0x0;var _0xb4abcc=_0xa63a[_0xf273f9];return _0xb4abcc;};'use strict';function Channel(){this['starttime']=null;this[_0xaa63('0x0')]='';this[_0xaa63('0x1')]='';this[_0xaa63('0x2')]=0x0;this[_0xaa63('0x3')]='';this[_0xaa63('0x4')]=undefined;this[_0xaa63('0x5')]=undefined;this[_0xaa63('0x6')]=0x0;this[_0xaa63('0x7')]='';this[_0xaa63('0x8')]=0x0;this[_0xaa63('0x9')]=0x0;this[_0xaa63('0xa')]=0x0;this['answered']=![];this['answertime']=null;this['endtime']=null;this[_0xaa63('0xb')]=![];this['abandoned']=![];this[_0xaa63('0xc')]='';this[_0xaa63('0xd')]='';this['duration']=0x0;this[_0xaa63('0xe')]=0x0;this[_0xaa63('0xf')]=0x0;this[_0xaa63('0x10')]=null;this[_0xaa63('0x11')]=null;this[_0xaa63('0x12')]=null;this[_0xaa63('0x13')]=![];this[_0xaa63('0x14')]=null;this['queue']=null;this[_0xaa63('0x15')]=[];this[_0xaa63('0x16')]=undefined;this[_0xaa63('0x17')]=undefined;this[_0xaa63('0x18')]=0x0;}module[_0xaa63('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 d7c37a5..33f342e 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 _0x39c7=['exports','name','username','remoteUri','authType','password','consumerSecret','tokenSecret','type','serverUrl','Configurations'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x39c7,0x85));var _0x739c=function(_0x2fc2a9,_0x5a4c89){_0x2fc2a9=_0x2fc2a9-0x0;var _0x41f799=_0x39c7[_0x2fc2a9];return _0x41f799;};'use strict';function DeskAccount(_0x4f59a6){this['id']=_0x4f59a6['id']||0x0;this[_0x739c('0x0')]=_0x4f59a6[_0x739c('0x0')]||'';this[_0x739c('0x1')]=_0x4f59a6[_0x739c('0x1')]||'';this[_0x739c('0x2')]=_0x4f59a6[_0x739c('0x2')]||'';this['authType']=_0x4f59a6[_0x739c('0x3')]||'';this[_0x739c('0x4')]=_0x4f59a6[_0x739c('0x4')]||'';this['consumerKey']=_0x4f59a6['consumerKey']||'';this[_0x739c('0x5')]=_0x4f59a6[_0x739c('0x5')]||'';this['token']=_0x4f59a6['token']||'';this[_0x739c('0x6')]=_0x4f59a6[_0x739c('0x6')]||'';this['type']=_0x4f59a6[_0x739c('0x7')]||'';this[_0x739c('0x8')]=_0x4f59a6['serverUrl']||'';this['Configurations']=_0x4f59a6[_0x739c('0x9')]||{};}module[_0x739c('0xa')]=DeskAccount; \ No newline at end of file +var _0xb38e=['remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','username'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb38e,0xa7));var _0xeb38=function(_0x311089,_0x5045fd){_0x311089=_0x311089-0x0;var _0x53e159=_0xb38e[_0x311089];return _0x53e159;};'use strict';function DeskAccount(_0x52c245){this['id']=_0x52c245['id']||0x0;this[_0xeb38('0x0')]=_0x52c245[_0xeb38('0x0')]||'';this[_0xeb38('0x1')]=_0x52c245[_0xeb38('0x1')]||'';this[_0xeb38('0x2')]=_0x52c245[_0xeb38('0x2')]||'';this['authType']=_0x52c245[_0xeb38('0x3')]||'';this[_0xeb38('0x4')]=_0x52c245['password']||'';this[_0xeb38('0x5')]=_0x52c245[_0xeb38('0x5')]||'';this[_0xeb38('0x6')]=_0x52c245[_0xeb38('0x6')]||'';this['token']=_0x52c245[_0xeb38('0x7')]||'';this[_0xeb38('0x8')]=_0x52c245[_0xeb38('0x8')]||'';this[_0xeb38('0x9')]=_0x52c245['type']||'';this[_0xeb38('0xa')]=_0x52c245[_0xeb38('0xa')]||'';this[_0xeb38('0xb')]=_0x52c245[_0xeb38('0xb')]||{};}module[_0xeb38('0xc')]=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index 2c7cc04..0a6df95 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 _0x761c=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','exports','name'];(function(_0x4b7124,_0x206b7b){var _0x23e16d=function(_0x2cd68e){while(--_0x2cd68e){_0x4b7124['push'](_0x4b7124['shift']());}};_0x23e16d(++_0x206b7b);}(_0x761c,0xe9));var _0xc761=function(_0x16b0ca,_0x4a96b3){_0x16b0ca=_0x16b0ca-0x0;var _0x1825f3=_0x761c[_0x16b0ca];return _0x1825f3;};'use strict';function Dynamics365Account(_0x3dacf0){this['id']=_0x3dacf0['id']||0x0;this[_0xc761('0x0')]=_0x3dacf0[_0xc761('0x0')]||'';this[_0xc761('0x1')]=_0x3dacf0[_0xc761('0x1')]||'';this[_0xc761('0x2')]=_0x3dacf0[_0xc761('0x2')]||'';this[_0xc761('0x3')]=_0x3dacf0[_0xc761('0x3')]||'';this['tenantId']=_0x3dacf0[_0xc761('0x4')]||'';this['clientId']=_0x3dacf0[_0xc761('0x5')]||'';this[_0xc761('0x6')]=_0x3dacf0[_0xc761('0x6')]||{};this[_0xc761('0x7')]=_0x3dacf0[_0xc761('0x7')]||'';this['Configurations']=_0x3dacf0['Configurations']||{};}module[_0xc761('0x8')]=Dynamics365Account; \ No newline at end of file +var _0xb3c1=['serverUrl','Configurations','exports','name','username','remoteUri','tenantId','clientId','clientSecret'];(function(_0x42696c,_0x39e509){var _0x53dbb3=function(_0x31a38d){while(--_0x31a38d){_0x42696c['push'](_0x42696c['shift']());}};_0x53dbb3(++_0x39e509);}(_0xb3c1,0x9c));var _0x1b3c=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb3c1[_0x321bb2];return _0x9c12ed;};'use strict';function Dynamics365Account(_0x5dacb8){this['id']=_0x5dacb8['id']||0x0;this[_0x1b3c('0x0')]=_0x5dacb8['name']||'';this['username']=_0x5dacb8[_0x1b3c('0x1')]||'';this['password']=_0x5dacb8['password']||'';this[_0x1b3c('0x2')]=_0x5dacb8[_0x1b3c('0x2')]||'';this[_0x1b3c('0x3')]=_0x5dacb8[_0x1b3c('0x3')]||'';this['clientId']=_0x5dacb8[_0x1b3c('0x4')]||'';this[_0x1b3c('0x5')]=_0x5dacb8['clientSecret']||{};this[_0x1b3c('0x6')]=_0x5dacb8[_0x1b3c('0x6')]||'';this[_0x1b3c('0x7')]=_0x5dacb8[_0x1b3c('0x7')]||{};}module[_0x1b3c('0x8')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 12da29c..9f3b6d0 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 _0x80e5=['localstationid','minrate','maxrate','modem','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo'];(function(_0x43aa1e,_0x4b3ca6){var _0x159353=function(_0x225c7f){while(--_0x225c7f){_0x43aa1e['push'](_0x43aa1e['shift']());}};_0x159353(++_0x4b3ca6);}(_0x80e5,0xb7));var _0x580e=function(_0x35825e,_0x657421){_0x35825e=_0x35825e-0x0;var _0x4f4d90=_0x80e5[_0x35825e];return _0x4f4d90;};'use strict';function FaxAccount(_0xf85d2a){this['id']=_0xf85d2a['id']||0x0;this[_0x580e('0x0')]=_0xf85d2a['name']||'';this['description']=_0xf85d2a[_0x580e('0x1')];this[_0x580e('0x2')]=_0xf85d2a[_0x580e('0x2')];this[_0x580e('0x3')]=_0xf85d2a[_0x580e('0x3')];this[_0x580e('0x4')]=_0xf85d2a[_0x580e('0x4')];this[_0x580e('0x5')]=_0xf85d2a[_0x580e('0x5')]||0x960;this[_0x580e('0x6')]=_0xf85d2a[_0x580e('0x6')]||0x3840;this[_0x580e('0x7')]=_0xf85d2a[_0x580e('0x7')]||'v17,v27,v29';this[_0x580e('0x8')]=_0xf85d2a['gateway']||'no';this[_0x580e('0x9')]=_0xf85d2a['faxdetect']||'no';this['t38timeout']=_0xf85d2a[_0x580e('0xa')]||0x1388;this[_0x580e('0xb')]=_0xf85d2a[_0x580e('0xb')]||_0x580e('0xc');this[_0x580e('0xd')]=_0xf85d2a[_0x580e('0xd')]?_0xf85d2a[_0x580e('0xd')]:undefined;this[_0x580e('0xe')]=_0xf85d2a[_0x580e('0xe')];this[_0x580e('0xf')]=_0xf85d2a[_0x580e('0xf')];}module[_0x580e('0x10')]=FaxAccount; \ No newline at end of file +var _0x27d8=['SIP','Trunk','ListId','key','name','description','ecm','headerinfo','localstationid','minrate','modem','v17,v27,v29','gateway','t38timeout','tech'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x27d8,0x13f));var _0x827d=function(_0x3afe18,_0x26922c){_0x3afe18=_0x3afe18-0x0;var _0x19ed1f=_0x27d8[_0x3afe18];return _0x19ed1f;};'use strict';function FaxAccount(_0x113740){this['id']=_0x113740['id']||0x0;this[_0x827d('0x0')]=_0x113740[_0x827d('0x0')]||'';this['description']=_0x113740[_0x827d('0x1')];this[_0x827d('0x2')]=_0x113740[_0x827d('0x2')];this[_0x827d('0x3')]=_0x113740[_0x827d('0x3')];this[_0x827d('0x4')]=_0x113740[_0x827d('0x4')];this[_0x827d('0x5')]=_0x113740[_0x827d('0x5')]||0x960;this['maxrate']=_0x113740['maxrate']||0x3840;this[_0x827d('0x6')]=_0x113740[_0x827d('0x6')]||_0x827d('0x7');this[_0x827d('0x8')]=_0x113740[_0x827d('0x8')]||'no';this['faxdetect']=_0x113740['faxdetect']||'no';this[_0x827d('0x9')]=_0x113740['t38timeout']||0x1388;this['tech']=_0x113740[_0x827d('0xa')]||_0x827d('0xb');this[_0x827d('0xc')]=_0x113740[_0x827d('0xc')]?_0x113740[_0x827d('0xc')]:undefined;this[_0x827d('0xd')]=_0x113740[_0x827d('0xd')];this[_0x827d('0xe')]=_0x113740['key'];}module['exports']=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 6cc5f3c..e0bd5da 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 _0x2966=['remoteUri','serverUrl','Configurations','name','username','token'];(function(_0x215dc8,_0x52c245){var _0x583ea3=function(_0x32350d){while(--_0x32350d){_0x215dc8['push'](_0x215dc8['shift']());}};_0x583ea3(++_0x52c245);}(_0x2966,0x1a1));var _0x6296=function(_0x487d61,_0x4d9bda){_0x487d61=_0x487d61-0x0;var _0x13fdab=_0x2966[_0x487d61];return _0x13fdab;};'use strict';function FreshdeskAccount(_0x38112e){this['id']=_0x38112e['id']||0x0;this['name']=_0x38112e[_0x6296('0x0')]||'';this[_0x6296('0x1')]=_0x38112e[_0x6296('0x1')]||'';this['apiKey']=_0x38112e[_0x6296('0x2')]||'';this[_0x6296('0x3')]=_0x38112e['remoteUri']||'';this[_0x6296('0x4')]=_0x38112e['serverUrl']||'';this[_0x6296('0x5')]=_0x38112e[_0x6296('0x5')]||{};}module['exports']=FreshdeskAccount; \ No newline at end of file +var _0xcdf8=['username','apiKey','token','remoteUri','Configurations','exports'];(function(_0x439d15,_0x508525){var _0x39def2=function(_0x3cf84b){while(--_0x3cf84b){_0x439d15['push'](_0x439d15['shift']());}};_0x39def2(++_0x508525);}(_0xcdf8,0xba));var _0x8cdf=function(_0x22f8ab,_0x15d8ff){_0x22f8ab=_0x22f8ab-0x0;var _0x2a70e5=_0xcdf8[_0x22f8ab];return _0x2a70e5;};'use strict';function FreshdeskAccount(_0x11c2a0){this['id']=_0x11c2a0['id']||0x0;this['name']=_0x11c2a0['name']||'';this[_0x8cdf('0x0')]=_0x11c2a0[_0x8cdf('0x0')]||'';this[_0x8cdf('0x1')]=_0x11c2a0[_0x8cdf('0x2')]||'';this['remoteUri']=_0x11c2a0[_0x8cdf('0x3')]||'';this['serverUrl']=_0x11c2a0['serverUrl']||'';this[_0x8cdf('0x4')]=_0x11c2a0['Configurations']||{};}module[_0x8cdf('0x5')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 8570f2c..24bfca6 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 _0x84b1=['Configurations','exports','name','username','apiKey','remoteUri'];(function(_0x44992a,_0x1bf5b5){var _0x14b7bf=function(_0x52b52a){while(--_0x52b52a){_0x44992a['push'](_0x44992a['shift']());}};_0x14b7bf(++_0x1bf5b5);}(_0x84b1,0x122));var _0x184b=function(_0x2afe3d,_0x1468db){_0x2afe3d=_0x2afe3d-0x0;var _0x3a751e=_0x84b1[_0x2afe3d];return _0x3a751e;};'use strict';function FreshsalesAccount(_0x1046d5){this['id']=_0x1046d5['id']||0x0;this[_0x184b('0x0')]=_0x1046d5[_0x184b('0x0')]||'';this['username']=_0x1046d5[_0x184b('0x1')]||'';this[_0x184b('0x2')]=_0x1046d5['token']||'';this[_0x184b('0x3')]=_0x1046d5[_0x184b('0x3')]||'';this['serverUrl']=_0x1046d5['serverUrl']||'';this['Configurations']=_0x1046d5[_0x184b('0x4')]||{};}module[_0x184b('0x5')]=FreshsalesAccount; \ No newline at end of file +var _0x95cf=['Configurations','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x568039,_0x254d6f){var _0x3b1462=function(_0x4c4194){while(--_0x4c4194){_0x568039['push'](_0x568039['shift']());}};_0x3b1462(++_0x254d6f);}(_0x95cf,0x14a));var _0xf95c=function(_0x452ec3,_0x34241b){_0x452ec3=_0x452ec3-0x0;var _0x2906bc=_0x95cf[_0x452ec3];return _0x2906bc;};'use strict';function FreshsalesAccount(_0x2c2284){this['id']=_0x2c2284['id']||0x0;this[_0xf95c('0x0')]=_0x2c2284[_0xf95c('0x0')]||'';this['username']=_0x2c2284[_0xf95c('0x1')]||'';this[_0xf95c('0x2')]=_0x2c2284[_0xf95c('0x3')]||'';this['remoteUri']=_0x2c2284[_0xf95c('0x4')]||'';this[_0xf95c('0x5')]=_0x2c2284[_0xf95c('0x5')]||'';this[_0xf95c('0x6')]=_0x2c2284[_0xf95c('0x6')]||{};}module['exports']=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 463e676..c1256d6 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 _0x0c88=['queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandon','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','context','holdtime','lastAssignedTo','variables','type','uniqueid','calleridnum','calleridname','queue'];(function(_0x45783c,_0x49c56d){var _0x1161da=function(_0x3c5d41){while(--_0x3c5d41){_0x45783c['push'](_0x45783c['shift']());}};_0x1161da(++_0x49c56d);}(_0x0c88,0x1b4));var _0x80c8=function(_0x210d7f,_0x2abe4f){_0x210d7f=_0x210d7f-0x0;var _0x42d687=_0x0c88[_0x210d7f];return _0x42d687;};'use strict';function QueueReport(){this[_0x80c8('0x0')]='inbound';this[_0x80c8('0x1')]='';this[_0x80c8('0x2')]='';this[_0x80c8('0x3')]='';this[_0x80c8('0x4')]='';this[_0x80c8('0x5')]=null;this[_0x80c8('0x6')]=null;this[_0x80c8('0x7')]=0x1;this[_0x80c8('0x8')]=0x1;this[_0x80c8('0x9')]=![];this['queuecallerabandonAt']=null;this[_0x80c8('0xa')]=![];this[_0x80c8('0xb')]=null;this['queuecallerexit']=![];this[_0x80c8('0xc')]=null;this[_0x80c8('0xd')]=0x1;this[_0x80c8('0xe')]='';this[_0x80c8('0xf')]='';this[_0x80c8('0x10')]='';this['accountcode']='';this[_0x80c8('0x11')]='';this['exten']='';this['priority']='';this[_0x80c8('0x12')]=0x0;this['assigned']=![];this[_0x80c8('0x13')]='';this['mohtime']=0x0;this[_0x80c8('0x14')]={};}module['exports']=QueueReport; \ No newline at end of file +var _0xc54a=['mohtime','type','inbound','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','channel','connectedlinenum','connectedlinename','exten','priority','holdtime','lastAssignedTo'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc54a,0x17b));var _0xac54=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc54a[_0x3dd15e];return _0x231fd0;};'use strict';function QueueReport(){this[_0xac54('0x0')]=_0xac54('0x1');this['uniqueid']='';this['calleridnum']='';this[_0xac54('0x2')]='';this[_0xac54('0x3')]='';this[_0xac54('0x4')]=null;this[_0xac54('0x5')]=null;this['position']=0x1;this['count']=0x1;this['queuecallerabandon']=![];this[_0xac54('0x6')]=null;this[_0xac54('0x7')]=![];this[_0xac54('0x8')]=null;this[_0xac54('0x9')]=![];this['queuecallerexitAt']=null;this['originalposition']=0x1;this[_0xac54('0xa')]='';this[_0xac54('0xb')]='';this[_0xac54('0xc')]='';this['accountcode']='';this['context']='';this[_0xac54('0xd')]='';this[_0xac54('0xe')]='';this[_0xac54('0xf')]=0x0;this['assigned']=![];this[_0xac54('0x10')]='';this[_0xac54('0x11')]=0x0;this['variables']={};}module['exports']=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index d411c4d..d126b99 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 _0x5a19=['exports','name','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x5b0779,_0x40d92a){var _0x2d8671=function(_0x5cd62d){while(--_0x5cd62d){_0x5b0779['push'](_0x5b0779['shift']());}};_0x2d8671(++_0x40d92a);}(_0x5a19,0x7a));var _0x95a1=function(_0xaedc8f,_0x2487db){_0xaedc8f=_0xaedc8f-0x0;var _0x2e1d6f=_0x5a19[_0xaedc8f];return _0x2e1d6f;};'use strict';function SalesforceAccount(_0x48bd4b){this['id']=_0x48bd4b['id']||0x0;this[_0x95a1('0x0')]=_0x48bd4b[_0x95a1('0x0')]||'';this['username']=_0x48bd4b['username']||'';this['remoteUri']=_0x48bd4b[_0x95a1('0x1')]||'';this['password']=_0x48bd4b[_0x95a1('0x2')]||'';this[_0x95a1('0x3')]=_0x48bd4b[_0x95a1('0x3')]||'';this[_0x95a1('0x4')]=_0x48bd4b[_0x95a1('0x4')]||'';this[_0x95a1('0x5')]=_0x48bd4b[_0x95a1('0x5')]||'';this[_0x95a1('0x6')]=_0x48bd4b['type']||_0x95a1('0x7');this[_0x95a1('0x8')]=_0x48bd4b[_0x95a1('0x8')]||'';this[_0x95a1('0x9')]=_0x48bd4b[_0x95a1('0x9')]||{};}module[_0x95a1('0xa')]=SalesforceAccount; \ No newline at end of file +var _0x0721=['remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name','username'];(function(_0x56a7c0,_0x50ab73){var _0x5e501b=function(_0x384c49){while(--_0x384c49){_0x56a7c0['push'](_0x56a7c0['shift']());}};_0x5e501b(++_0x50ab73);}(_0x0721,0x82));var _0x1072=function(_0x2becba,_0x4ea656){_0x2becba=_0x2becba-0x0;var _0x90b5dd=_0x0721[_0x2becba];return _0x90b5dd;};'use strict';function SalesforceAccount(_0x128815){this['id']=_0x128815['id']||0x0;this[_0x1072('0x0')]=_0x128815[_0x1072('0x0')]||'';this[_0x1072('0x1')]=_0x128815[_0x1072('0x1')]||'';this[_0x1072('0x2')]=_0x128815[_0x1072('0x2')]||'';this[_0x1072('0x3')]=_0x128815[_0x1072('0x3')]||'';this[_0x1072('0x4')]=_0x128815[_0x1072('0x4')]||'';this[_0x1072('0x5')]=_0x128815[_0x1072('0x5')]||'';this[_0x1072('0x6')]=_0x128815[_0x1072('0x6')]||'';this[_0x1072('0x7')]=_0x128815[_0x1072('0x7')]||_0x1072('0x8');this['serverUrl']=_0x128815[_0x1072('0x9')]||'';this[_0x1072('0xa')]=_0x128815['Configurations']||{};}module[_0x1072('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 94c63d3..78e8147 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 _0x46f9=['Configurations','name','username','password','remoteUri','serverUrl'];(function(_0x2c5a7c,_0x158c6b){var _0x1e7733=function(_0x52d0b9){while(--_0x52d0b9){_0x2c5a7c['push'](_0x2c5a7c['shift']());}};_0x1e7733(++_0x158c6b);}(_0x46f9,0x1ed));var _0x946f=function(_0x3e902d,_0x3c02eb){_0x3e902d=_0x3e902d-0x0;var _0x31f549=_0x46f9[_0x3e902d];return _0x31f549;};'use strict';function ServicenowAccount(_0xac2ef0){this['id']=_0xac2ef0['id']||0x0;this[_0x946f('0x0')]=_0xac2ef0[_0x946f('0x0')]||'';this[_0x946f('0x1')]=_0xac2ef0[_0x946f('0x1')]||'';this[_0x946f('0x2')]=_0xac2ef0[_0x946f('0x2')]||'';this['remoteUri']=_0xac2ef0[_0x946f('0x3')]||'';this[_0x946f('0x4')]=_0xac2ef0[_0x946f('0x4')]||'';this[_0x946f('0x5')]=_0xac2ef0['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xc29e=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xc32ca2,_0x137fc8){var _0x2b2052=function(_0x53672d){while(--_0x53672d){_0xc32ca2['push'](_0xc32ca2['shift']());}};_0x2b2052(++_0x137fc8);}(_0xc29e,0x118));var _0xec29=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xc29e[_0x4243a3];return _0x1b2a33;};'use strict';function ServicenowAccount(_0x167595){this['id']=_0x167595['id']||0x0;this[_0xec29('0x0')]=_0x167595[_0xec29('0x0')]||'';this[_0xec29('0x1')]=_0x167595[_0xec29('0x1')]||'';this[_0xec29('0x2')]=_0x167595[_0xec29('0x2')]||'';this[_0xec29('0x3')]=_0x167595['remoteUri']||'';this[_0xec29('0x4')]=_0x167595[_0xec29('0x4')]||'';this[_0xec29('0x5')]=_0x167595[_0xec29('0x5')]||{};}module[_0xec29('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 668e7c1..bcca5df 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 _0x6b0f=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0xafe637,_0x2d33e9){var _0x19e1f1=function(_0x1b0a78){while(--_0x1b0a78){_0xafe637['push'](_0xafe637['shift']());}};_0x19e1f1(++_0x2d33e9);}(_0x6b0f,0x1a5));var _0xf6b0=function(_0x111ae7,_0x413b3f){_0x111ae7=_0x111ae7-0x0;var _0x2cfaf5=_0x6b0f[_0x111ae7];return _0x2cfaf5;};'use strict';function SugarcrmAccount(_0x3a7f27){this['id']=_0x3a7f27['id']||0x0;this[_0xf6b0('0x0')]=_0x3a7f27['name']||'';this['username']=_0x3a7f27[_0xf6b0('0x1')]||'';this[_0xf6b0('0x2')]=_0x3a7f27['password']||'';this[_0xf6b0('0x3')]=_0x3a7f27[_0xf6b0('0x3')]||'';this['serverUrl']=_0x3a7f27[_0xf6b0('0x4')]||'';this['Configurations']=_0x3a7f27[_0xf6b0('0x5')]||{};}module[_0xf6b0('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xe579=['name','username','password','remoteUri','serverUrl','Configurations','exports'];(function(_0xb603f1,_0x31555a){var _0x5a77aa=function(_0x4991a1){while(--_0x4991a1){_0xb603f1['push'](_0xb603f1['shift']());}};_0x5a77aa(++_0x31555a);}(_0xe579,0x1a4));var _0x9e57=function(_0x116e4a,_0x416475){_0x116e4a=_0x116e4a-0x0;var _0x55e1f8=_0xe579[_0x116e4a];return _0x55e1f8;};'use strict';function SugarcrmAccount(_0x1a31fb){this['id']=_0x1a31fb['id']||0x0;this['name']=_0x1a31fb[_0x9e57('0x0')]||'';this[_0x9e57('0x1')]=_0x1a31fb[_0x9e57('0x1')]||'';this['password']=_0x1a31fb[_0x9e57('0x2')]||'';this[_0x9e57('0x3')]=_0x1a31fb['remoteUri']||'';this[_0x9e57('0x4')]=_0x1a31fb['serverUrl']||'';this[_0x9e57('0x5')]=_0x1a31fb['Configurations']||{};}module[_0x9e57('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 fb31c9f..9b70e12 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 _0x1518=['address','exports','name','accountcode','state','stateTime','unknown'];(function(_0x4e244e,_0x19f805){var _0x545332=function(_0x3f50de){while(--_0x3f50de){_0x4e244e['push'](_0x4e244e['shift']());}};_0x545332(++_0x19f805);}(_0x1518,0x159));var _0x8151=function(_0x39f21a,_0x312fd0){_0x39f21a=_0x39f21a-0x0;var _0x515125=_0x1518[_0x39f21a];return _0x515125;};'use strict';function Telephone(_0x502362){this['id']=_0x502362['id']||0x0;this[_0x8151('0x0')]=_0x502362[_0x8151('0x0')]||'';this[_0x8151('0x1')]=_0x502362['accountcode']||'';this[_0x8151('0x2')]='unknown';this[_0x8151('0x3')]=0x0;this['status']=_0x8151('0x4');this[_0x8151('0x5')]='';}module[_0x8151('0x6')]=Telephone; \ No newline at end of file +var _0xd1c6=['state','stateTime','unknown','address','name','accountcode'];(function(_0x2275fd,_0x2750ea){var _0x5c7af2=function(_0x42a9bf){while(--_0x42a9bf){_0x2275fd['push'](_0x2275fd['shift']());}};_0x5c7af2(++_0x2750ea);}(_0xd1c6,0x1c0));var _0x6d1c=function(_0x4fdabe,_0x246704){_0x4fdabe=_0x4fdabe-0x0;var _0x1c7f69=_0xd1c6[_0x4fdabe];return _0x1c7f69;};'use strict';function Telephone(_0x5288cb){this['id']=_0x5288cb['id']||0x0;this['name']=_0x5288cb[_0x6d1c('0x0')]||'';this[_0x6d1c('0x1')]=_0x5288cb['accountcode']||'';this[_0x6d1c('0x2')]='unknown';this[_0x6d1c('0x3')]=0x0;this['status']=_0x6d1c('0x4');this[_0x6d1c('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index 07ff045..ba1c220 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 _0x0bcd=['name','html'];(function(_0xafceaf,_0x5c65ad){var _0x3684e4=function(_0x1aaf86){while(--_0x1aaf86){_0xafceaf['push'](_0xafceaf['shift']());}};_0x3684e4(++_0x5c65ad);}(_0x0bcd,0xb2));var _0xd0bc=function(_0x39e4b1,_0x13a82a){_0x39e4b1=_0x39e4b1-0x0;var _0x43b765=_0x0bcd[_0x39e4b1];return _0x43b765;};'use strict';function template(_0x1e3c7e){this['id']=_0x1e3c7e['id']||0x0;this[_0xd0bc('0x0')]=_0x1e3c7e[_0xd0bc('0x0')]||'';this[_0xd0bc('0x1')]=_0x1e3c7e['html']||'';}module['exports']=template; \ No newline at end of file +var _0x59ad=['exports','name','html'];(function(_0x12f78f,_0x433347){var _0x357600=function(_0x1859a2){while(--_0x1859a2){_0x12f78f['push'](_0x12f78f['shift']());}};_0x357600(++_0x433347);}(_0x59ad,0xee));var _0xd59a=function(_0x2d91bb,_0x5abaf8){_0x2d91bb=_0x2d91bb-0x0;var _0x43ad2f=_0x59ad[_0x2d91bb];return _0x43ad2f;};'use strict';function template(_0xc9ee44){this['id']=_0xc9ee44['id']||0x0;this[_0xd59a('0x0')]=_0xc9ee44[_0xd59a('0x0')]||'';this[_0xd59a('0x1')]=_0xc9ee44[_0xd59a('0x1')]||'';}module[_0xd59a('0x2')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index d20682c..4eed987 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 _0x9957=['AnyConditions','Actions','exports','name','channel','voice','status','AllConditions'];(function(_0x6d97b2,_0x3c1332){var _0x514465=function(_0x13c3ce){while(--_0x13c3ce){_0x6d97b2['push'](_0x6d97b2['shift']());}};_0x514465(++_0x3c1332);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';function Trigger(_0x202794){this['id']=_0x202794['id']||0x0;this[_0x7995('0x0')]=_0x202794[_0x7995('0x0')]||'';this[_0x7995('0x1')]=_0x202794['channel']||_0x7995('0x2');this[_0x7995('0x3')]=_0x202794[_0x7995('0x3')]||![];this[_0x7995('0x4')]=_0x202794['AllConditions']||[];this[_0x7995('0x5')]=_0x202794[_0x7995('0x5')]||[];this[_0x7995('0x6')]=_0x202794[_0x7995('0x6')]||[];}module[_0x7995('0x7')]=Trigger; \ No newline at end of file +var _0x9c44=['voice','status','AnyConditions','Actions','exports','name','channel'];(function(_0x645df8,_0x299983){var _0x40187f=function(_0x1a0592){while(--_0x1a0592){_0x645df8['push'](_0x645df8['shift']());}};_0x40187f(++_0x299983);}(_0x9c44,0x178));var _0x49c4=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0x9c44[_0x160c73];return _0xd9302;};'use strict';function Trigger(_0x2fa01d){this['id']=_0x2fa01d['id']||0x0;this['name']=_0x2fa01d[_0x49c4('0x0')]||'';this[_0x49c4('0x1')]=_0x2fa01d[_0x49c4('0x1')]||_0x49c4('0x2');this[_0x49c4('0x3')]=_0x2fa01d[_0x49c4('0x3')]||![];this['AllConditions']=_0x2fa01d['AllConditions']||[];this[_0x49c4('0x4')]=_0x2fa01d['AnyConditions']||[];this[_0x49c4('0x5')]=_0x2fa01d[_0x49c4('0x5')]||[];}module[_0x49c4('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index cddb341..56cab9c 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 _0xc4db=['stateRegistry','registrationtime','address','active','name','state','unknown','status','registry','split','host','port','domainport','refresh'];(function(_0x3e73af,_0x19dbea){var _0x389e19=function(_0x1606ee){while(--_0x1606ee){_0x3e73af['push'](_0x3e73af['shift']());}};_0x389e19(++_0x19dbea);}(_0xc4db,0xb9));var _0xbc4d=function(_0x2e5ea9,_0x4d280a){_0x2e5ea9=_0x2e5ea9-0x0;var _0x228844=_0xc4db[_0x2e5ea9];return _0x228844;};'use strict';function Trunk(_0x3a39b5){this['id']=_0x3a39b5['id']||0x0;this[_0xbc4d('0x0')]=_0x3a39b5[_0xbc4d('0x0')]||![];this[_0xbc4d('0x1')]=_0x3a39b5[_0xbc4d('0x1')]||'';this[_0xbc4d('0x2')]=_0xbc4d('0x3');this['stateTime']=0x0;this[_0xbc4d('0x4')]=_0xbc4d('0x3');this[_0xbc4d('0x5')]=_0x3a39b5[_0xbc4d('0x5')]&&_0x3a39b5[_0xbc4d('0x5')]['indexOf'](':')?_0x3a39b5[_0xbc4d('0x5')][_0xbc4d('0x6')](':')[0x0]:'';this[_0xbc4d('0x7')]='';this[_0xbc4d('0x8')]='';this['domain']='';this[_0xbc4d('0x9')]='';this[_0xbc4d('0xa')]='';this[_0xbc4d('0xb')]=_0xbc4d('0x3');this[_0xbc4d('0xc')]='';this[_0xbc4d('0xd')]='';}module['exports']=Trunk; \ No newline at end of file +var _0x462e=['indexOf','split','port','domain','domainport','refresh','registrationtime','address','active','name','unknown','stateTime','status','registry'];(function(_0xc87d08,_0x59c9be){var _0x30a714=function(_0x437c0d){while(--_0x437c0d){_0xc87d08['push'](_0xc87d08['shift']());}};_0x30a714(++_0x59c9be);}(_0x462e,0x13c));var _0xe462=function(_0x33c368,_0x360da4){_0x33c368=_0x33c368-0x0;var _0x36c85d=_0x462e[_0x33c368];return _0x36c85d;};'use strict';function Trunk(_0x2907ae){this['id']=_0x2907ae['id']||0x0;this[_0xe462('0x0')]=_0x2907ae[_0xe462('0x0')]||![];this[_0xe462('0x1')]=_0x2907ae[_0xe462('0x1')]||'';this['state']=_0xe462('0x2');this[_0xe462('0x3')]=0x0;this[_0xe462('0x4')]=_0xe462('0x2');this['registry']=_0x2907ae[_0xe462('0x5')]&&_0x2907ae[_0xe462('0x5')][_0xe462('0x6')](':')?_0x2907ae[_0xe462('0x5')][_0xe462('0x7')](':')[0x0]:'';this['host']='';this[_0xe462('0x8')]='';this[_0xe462('0x9')]='';this[_0xe462('0xa')]='';this[_0xe462('0xb')]='';this['stateRegistry']=_0xe462('0x2');this[_0xe462('0xc')]='';this[_0xe462('0xd')]='';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index ff05fc3..44391d3 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 _0x3253=['recordingFormat','none','exten'];(function(_0x616290,_0x280b7f){var _0x453879=function(_0x27bda7){while(--_0x27bda7){_0x616290['push'](_0x616290['shift']());}};_0x453879(++_0x280b7f);}(_0x3253,0x107));var _0x3325=function(_0xa1e3ca,_0x559022){_0xa1e3ca=_0xa1e3ca-0x0;var _0x5005ab=_0x3253[_0xa1e3ca];return _0x5005ab;};'use strict';function voiceExtension(_0xd50e7b){this['id']=_0xd50e7b['id']||0x0;this[_0x3325('0x0')]=_0xd50e7b['exten']||'';this[_0x3325('0x1')]=_0xd50e7b['recordingFormat']||_0x3325('0x2');this['mandatoryDisposition']=_0xd50e7b['mandatoryDisposition']||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x72d7=['exten','recordingFormat','mandatoryDisposition'];(function(_0x1cca7,_0x496ca4){var _0x4bd58c=function(_0x52acad){while(--_0x52acad){_0x1cca7['push'](_0x1cca7['shift']());}};_0x4bd58c(++_0x496ca4);}(_0x72d7,0x1f2));var _0x772d=function(_0x513aa5,_0x1fba79){_0x513aa5=_0x513aa5-0x0;var _0x1a1a7c=_0x72d7[_0x513aa5];return _0x1a1a7c;};'use strict';function voiceExtension(_0x44e4d3){this['id']=_0x44e4d3['id']||0x0;this[_0x772d('0x0')]=_0x44e4d3['exten']||'';this[_0x772d('0x1')]=_0x44e4d3[_0x772d('0x1')]||'none';this[_0x772d('0x2')]=_0x44e4d3[_0x772d('0x2')]||![];}module['exports']=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index f60f786..966bbf9 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 _0xd065=['predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','inuse','busy','invalid','ringing','ringinuse','onhold','wav49','gsm','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumDuration','unmanaged','abandoned','available','acw','acwTimeout','autopause','message','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','anonymous','dialOriginateCallerIdNumber','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','rrmemory','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd065,0x87));var _0x5d06=function(_0x4e4c7b,_0x4ff657){_0x4e4c7b=_0x4e4c7b-0x0;var _0x6816d0=_0xd065[_0x4e4c7b];return _0x6816d0;};'use strict';var statusDesc=[_0x5d06('0x0'),'not_inuse',_0x5d06('0x1'),_0x5d06('0x2'),_0x5d06('0x3'),'unavailable',_0x5d06('0x4'),_0x5d06('0x5'),_0x5d06('0x6')];var monitorFormat={'wav':'wav','wav49':_0x5d06('0x7'),'gsm':_0x5d06('0x8')};var strategy={'rrmemory':'rrmemory','roundrobin':_0x5d06('0x9')};function VoiceQueue(_0x56baf2){this['id']=_0x56baf2['id']||0x0;this[_0x5d06('0xa')]=_0x56baf2[_0x5d06('0xa')]||'';this['monitor_format']=_0x56baf2[_0x5d06('0xb')]||'';this[_0x5d06('0xc')]=_0x56baf2[_0x5d06('0xc')]||_0x5d06('0xd');this[_0x5d06('0xe')]=0x0;this[_0x5d06('0xf')]=0x0;this[_0x5d06('0x10')]=0x0;this[_0x5d06('0x11')]=0x0;this[_0x5d06('0x12')]=0x0;this['sumHoldTime']=0x0;this['sumBillable']=0x0;this[_0x5d06('0x13')]=0x0;this[_0x5d06('0x14')]=0x0;this['loggedIn']=0x0;this[_0x5d06('0x15')]=0x0;this[_0x5d06('0x16')]=_0x56baf2[_0x5d06('0x16')]||![];this[_0x5d06('0x17')]=_0x56baf2[_0x5d06('0x17')]||0xa;this['autopause']=_0x56baf2[_0x5d06('0x18')]||'no';this['sendMessageOneNotActive']=!![];this[_0x5d06('0x19')]='';this['originated']=0x0;this[_0x5d06('0x1a')]=0x0;this[_0x5d06('0x1b')]=_0x56baf2[_0x5d06('0x1b')]||null;this[_0x5d06('0x1c')]=_0x56baf2[_0x5d06('0x1c')]?_0x56baf2[_0x5d06('0x1c')]:null;this[_0x5d06('0x1d')]=_0x56baf2['dialActive'];this[_0x5d06('0x1e')]=_0x56baf2['dialMethod']||'progressive';this[_0x5d06('0x1f')]=_0x56baf2[_0x5d06('0x1f')]||0x0;this['dialLimitQueue']=_0x56baf2[_0x5d06('0x20')]||0x0;this[_0x5d06('0x21')]=_0x56baf2[_0x5d06('0x21')]||0x1;this[_0x5d06('0x22')]=_0x56baf2[_0x5d06('0x22')]||_0x5d06('0x23');this[_0x5d06('0x24')]=_0x56baf2[_0x5d06('0x24')]||0.03;this['dialPredictiveInterval']=_0x56baf2[_0x5d06('0x25')]||0x258;this[_0x5d06('0x26')]=_0x56baf2[_0x5d06('0x26')]||_0x5d06('0x27');this[_0x5d06('0x28')]=_0x56baf2[_0x5d06('0x28')]||'anonymous';this['dialOriginateTimeout']=_0x56baf2['dialOriginateTimeout']||0x1e;this[_0x5d06('0x29')]=_0x56baf2[_0x5d06('0x29')]||_0x5d06('0x2a');this[_0x5d06('0x2b')]=_0x56baf2[_0x5d06('0x2b')]||0x3;this[_0x5d06('0x2c')]=_0x56baf2[_0x5d06('0x2c')]||undefined;this[_0x5d06('0x2d')]=_0x56baf2['dialCongestionMaxRetry']||0x3;this[_0x5d06('0x2e')]=_0x56baf2[_0x5d06('0x2e')]||0x96;this[_0x5d06('0x2f')]=_0x56baf2[_0x5d06('0x2f')]||0x3;this[_0x5d06('0x30')]=_0x56baf2[_0x5d06('0x30')]||0x96;this[_0x5d06('0x31')]=_0x56baf2[_0x5d06('0x31')]||0x3;this[_0x5d06('0x32')]=_0x56baf2[_0x5d06('0x32')]||0x96;this[_0x5d06('0x33')]=_0x56baf2[_0x5d06('0x33')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x56baf2[_0x5d06('0x34')]||0x96;this[_0x5d06('0x35')]=_0x56baf2[_0x5d06('0x35')]||0x3;this[_0x5d06('0x36')]=_0x56baf2['dialDropRetryFrequency']||0x96;this[_0x5d06('0x37')]=_0x56baf2['dialAbandonedMaxRetry']||0x3;this[_0x5d06('0x38')]=_0x56baf2['dialAbandonedRetryFrequency']||0x96;this[_0x5d06('0x39')]=_0x56baf2[_0x5d06('0x39')]||0x3;this['dialMachineRetryFrequency']=_0x56baf2['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x56baf2[_0x5d06('0x3a')]||0x3;this[_0x5d06('0x3b')]=_0x56baf2[_0x5d06('0x3b')]||0x96;this[_0x5d06('0x3c')]=_0x56baf2[_0x5d06('0x3c')]||0x4;this['Trunk']=_0x56baf2[_0x5d06('0x3d')]?_0x56baf2[_0x5d06('0x3d')]:undefined;this[_0x5d06('0x3e')]=_0x56baf2['TrunkBackup']?_0x56baf2['TrunkBackup']:undefined;this[_0x5d06('0x3f')]=_0x56baf2[_0x5d06('0x3f')]||undefined;this[_0x5d06('0x40')]=_0x56baf2[_0x5d06('0x40')]?_0x56baf2[_0x5d06('0x40')]:undefined;this[_0x5d06('0x41')]=_0x56baf2[_0x5d06('0x41')]||_0x5d06('0x42');this[_0x5d06('0x43')]=_0x56baf2[_0x5d06('0x43')]||undefined;this[_0x5d06('0x44')]=_0x56baf2[_0x5d06('0x44')]||undefined;this[_0x5d06('0x45')]=strategy[_0x56baf2[_0x5d06('0x45')]]||_0x5d06('0x46');this[_0x5d06('0x47')]=!![];this['dialAMDActive']=_0x56baf2[_0x5d06('0x48')]||![];this[_0x5d06('0x49')]=_0x56baf2[_0x5d06('0x49')];this['dialAMDGreeting']=_0x56baf2[_0x5d06('0x4a')];this[_0x5d06('0x4b')]=_0x56baf2[_0x5d06('0x4b')];this[_0x5d06('0x4c')]=_0x56baf2['dialAMDTotalAnalysisTime'];this[_0x5d06('0x4d')]=_0x56baf2[_0x5d06('0x4d')];this[_0x5d06('0x4e')]=_0x56baf2[_0x5d06('0x4e')];this[_0x5d06('0x4f')]=_0x56baf2['dialAMDMaximumNumberOfWords'];this[_0x5d06('0x50')]=_0x56baf2[_0x5d06('0x50')];this[_0x5d06('0x51')]=_0x56baf2[_0x5d06('0x51')];this[_0x5d06('0x52')]=0x0;this['pTalking']=0x0;this[_0x5d06('0x53')]=_0x56baf2[_0x5d06('0x53')];this[_0x5d06('0x54')]=0x0;this[_0x5d06('0x55')]=0x0;this['outboundNoAnswerCallsDay']=0x0;this[_0x5d06('0x56')]=0x0;this[_0x5d06('0x57')]=0x0;this[_0x5d06('0x58')]=0x0;this[_0x5d06('0x59')]=0x0;this[_0x5d06('0x5a')]=0x0;this[_0x5d06('0x5b')]=0x0;this[_0x5d06('0x5c')]=0x0;this[_0x5d06('0x5d')]=0x0;this[_0x5d06('0x5e')]=0x0;this['outboundReCallsDay']=0x0;this[_0x5d06('0x5f')]=0x0;this[_0x5d06('0x60')]=undefined;this[_0x5d06('0x61')]=undefined;this[_0x5d06('0x62')]=undefined;this[_0x5d06('0x63')]=1.05;this[_0x5d06('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x5d06('0x65')]=0x0;this[_0x5d06('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0x5d06('0x67')]=0x0;this[_0x5d06('0x68')]=_0x56baf2['dialPredictiveIntervalMaxThreshold']||0x14;this[_0x5d06('0x69')]=_0x56baf2[_0x5d06('0x6a')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0x5d06('0x6b')]=0x1;this[_0x5d06('0x6c')]=0x0;this[_0x5d06('0x6d')]=0x0;this[_0x5d06('0x6e')]=0x0;this[_0x5d06('0x6f')]=0x0;this[_0x5d06('0x70')]=_0x56baf2['dialRecallMeTimeout']||0x1e;this[_0x5d06('0x71')]=_0x56baf2[_0x5d06('0x71')]||![];this[_0x5d06('0x72')]=_0x56baf2[_0x5d06('0x72')]||undefined;this[_0x5d06('0x73')]=_0x56baf2[_0x5d06('0x73')]||![];this[_0x5d06('0x74')]=_0x56baf2[_0x5d06('0x74')]||![];this[_0x5d06('0xb')]=monitorFormat[_0x56baf2[_0x5d06('0xb')]]?monitorFormat[_0x56baf2[_0x5d06('0xb')]]:undefined;this[_0x5d06('0x75')]=_0x56baf2['mandatoryDisposition']||![];this[_0x5d06('0x76')]=_0x56baf2['mandatoryDispositionPause']?_0x56baf2[_0x5d06('0x76')]:undefined;}module['exports']=VoiceQueue; \ No newline at end of file +var _0x1c6a=['dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','unknown','not_inuse','inuse','unavailable','ringing','ringinuse','onhold','wav','wav49','rrmemory','roundrobin','name','monitor_format','type','inbound','waiting','talking','total','answered','sumBillable','unmanaged','abandoned','loggedIn','available','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x1c6a,0x197));var _0xa1c6=function(_0x2fcf6b,_0xd140ff){_0x2fcf6b=_0x2fcf6b-0x0;var _0x155073=_0x1c6a[_0x2fcf6b];return _0x155073;};'use strict';var statusDesc=[_0xa1c6('0x0'),_0xa1c6('0x1'),_0xa1c6('0x2'),'busy','invalid',_0xa1c6('0x3'),_0xa1c6('0x4'),_0xa1c6('0x5'),_0xa1c6('0x6')];var monitorFormat={'wav':_0xa1c6('0x7'),'wav49':_0xa1c6('0x8'),'gsm':'gsm'};var strategy={'rrmemory':_0xa1c6('0x9'),'roundrobin':_0xa1c6('0xa')};function VoiceQueue(_0x379fae){this['id']=_0x379fae['id']||0x0;this[_0xa1c6('0xb')]=_0x379fae[_0xa1c6('0xb')]||'';this[_0xa1c6('0xc')]=_0x379fae[_0xa1c6('0xc')]||'';this[_0xa1c6('0xd')]=_0x379fae[_0xa1c6('0xd')]||_0xa1c6('0xe');this[_0xa1c6('0xf')]=0x0;this[_0xa1c6('0x10')]=0x0;this[_0xa1c6('0x11')]=0x0;this[_0xa1c6('0x12')]=0x0;this['sumDuration']=0x0;this['sumHoldTime']=0x0;this[_0xa1c6('0x13')]=0x0;this[_0xa1c6('0x14')]=0x0;this[_0xa1c6('0x15')]=0x0;this[_0xa1c6('0x16')]=0x0;this[_0xa1c6('0x17')]=0x0;this['acw']=_0x379fae['acw']||![];this[_0xa1c6('0x18')]=_0x379fae[_0xa1c6('0x18')]||0xa;this[_0xa1c6('0x19')]=_0x379fae[_0xa1c6('0x19')]||'no';this[_0xa1c6('0x1a')]=!![];this[_0xa1c6('0x1b')]='';this[_0xa1c6('0x1c')]=0x0;this[_0xa1c6('0x1d')]=0x0;this[_0xa1c6('0x1e')]=_0x379fae[_0xa1c6('0x1e')]||null;this['dialGlobalInterval']=_0x379fae[_0xa1c6('0x1f')]?_0x379fae[_0xa1c6('0x1f')]:null;this[_0xa1c6('0x20')]=_0x379fae['dialActive'];this[_0xa1c6('0x21')]=_0x379fae[_0xa1c6('0x21')]||_0xa1c6('0x22');this[_0xa1c6('0x23')]=_0x379fae[_0xa1c6('0x23')]||0x0;this[_0xa1c6('0x24')]=_0x379fae[_0xa1c6('0x24')]||0x0;this['dialPowerLevel']=_0x379fae[_0xa1c6('0x25')]||0x1;this[_0xa1c6('0x26')]=_0x379fae[_0xa1c6('0x26')]||'dropRate';this['dialPredictiveOptimizationPercentage']=_0x379fae[_0xa1c6('0x27')]||0.03;this[_0xa1c6('0x28')]=_0x379fae[_0xa1c6('0x28')]||0x258;this[_0xa1c6('0x29')]=_0x379fae['dialOriginateCallerIdName']||'anonymous';this[_0xa1c6('0x2a')]=_0x379fae['dialOriginateCallerIdNumber']||_0xa1c6('0x2b');this[_0xa1c6('0x2c')]=_0x379fae['dialOriginateTimeout']||0x1e;this[_0xa1c6('0x2d')]=_0x379fae[_0xa1c6('0x2d')]||_0xa1c6('0x2e');this[_0xa1c6('0x2f')]=_0x379fae[_0xa1c6('0x2f')]||0x3;this[_0xa1c6('0x30')]=_0x379fae[_0xa1c6('0x30')]||undefined;this[_0xa1c6('0x31')]=_0x379fae[_0xa1c6('0x31')]||0x3;this[_0xa1c6('0x32')]=_0x379fae[_0xa1c6('0x32')]||0x96;this[_0xa1c6('0x33')]=_0x379fae[_0xa1c6('0x33')]||0x3;this[_0xa1c6('0x34')]=_0x379fae[_0xa1c6('0x34')]||0x96;this[_0xa1c6('0x35')]=_0x379fae[_0xa1c6('0x35')]||0x3;this[_0xa1c6('0x36')]=_0x379fae[_0xa1c6('0x36')]||0x96;this['dialNoSuchNumberMaxRetry']=_0x379fae['dialNoSuchNumberMaxRetry']||0x3;this[_0xa1c6('0x37')]=_0x379fae[_0xa1c6('0x37')]||0x96;this[_0xa1c6('0x38')]=_0x379fae[_0xa1c6('0x38')]||0x3;this['dialDropRetryFrequency']=_0x379fae['dialDropRetryFrequency']||0x96;this[_0xa1c6('0x39')]=_0x379fae[_0xa1c6('0x39')]||0x3;this[_0xa1c6('0x3a')]=_0x379fae['dialAbandonedRetryFrequency']||0x96;this[_0xa1c6('0x3b')]=_0x379fae[_0xa1c6('0x3b')]||0x3;this[_0xa1c6('0x3c')]=_0x379fae[_0xa1c6('0x3c')]||0x96;this[_0xa1c6('0x3d')]=_0x379fae[_0xa1c6('0x3d')]||0x3;this[_0xa1c6('0x3e')]=_0x379fae[_0xa1c6('0x3e')]||0x96;this[_0xa1c6('0x3f')]=_0x379fae[_0xa1c6('0x3f')]||0x4;this[_0xa1c6('0x40')]=_0x379fae[_0xa1c6('0x40')]?_0x379fae[_0xa1c6('0x40')]:undefined;this['TrunkBackup']=_0x379fae[_0xa1c6('0x41')]?_0x379fae['TrunkBackup']:undefined;this[_0xa1c6('0x42')]=_0x379fae[_0xa1c6('0x42')]||undefined;this[_0xa1c6('0x43')]=_0x379fae[_0xa1c6('0x43')]?_0x379fae[_0xa1c6('0x43')]:undefined;this[_0xa1c6('0x44')]=_0x379fae[_0xa1c6('0x44')]||_0xa1c6('0x45');this[_0xa1c6('0x46')]=_0x379fae[_0xa1c6('0x46')]||undefined;this[_0xa1c6('0x47')]=_0x379fae['dialCutDigit']||undefined;this[_0xa1c6('0x48')]=strategy[_0x379fae[_0xa1c6('0x48')]]||'rrmemory';this[_0xa1c6('0x49')]=!![];this['dialAMDActive']=_0x379fae['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x379fae['dialAMDInitialSilence'];this[_0xa1c6('0x4a')]=_0x379fae[_0xa1c6('0x4a')];this[_0xa1c6('0x4b')]=_0x379fae[_0xa1c6('0x4b')];this['dialAMDTotalAnalysisTime']=_0x379fae[_0xa1c6('0x4c')];this[_0xa1c6('0x4d')]=_0x379fae[_0xa1c6('0x4d')];this[_0xa1c6('0x4e')]=_0x379fae[_0xa1c6('0x4e')];this[_0xa1c6('0x4f')]=_0x379fae[_0xa1c6('0x4f')];this[_0xa1c6('0x50')]=_0x379fae[_0xa1c6('0x50')];this[_0xa1c6('0x51')]=_0x379fae[_0xa1c6('0x51')];this[_0xa1c6('0x52')]=0x0;this[_0xa1c6('0x53')]=0x0;this['timeout']=_0x379fae[_0xa1c6('0x54')];this[_0xa1c6('0x55')]=0x0;this[_0xa1c6('0x56')]=0x0;this[_0xa1c6('0x57')]=0x0;this[_0xa1c6('0x58')]=0x0;this[_0xa1c6('0x59')]=0x0;this[_0xa1c6('0x5a')]=0x0;this[_0xa1c6('0x5b')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0xa1c6('0x5c')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xa1c6('0x5d')]=0x0;this[_0xa1c6('0x5e')]=0x0;this[_0xa1c6('0x5f')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xa1c6('0x60')]=undefined;this['startPredictive']=undefined;this[_0xa1c6('0x61')]=undefined;this[_0xa1c6('0x62')]=1.05;this[_0xa1c6('0x63')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xa1c6('0x64')]=0x0;this[_0xa1c6('0x65')]=0x0;this[_0xa1c6('0x66')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this[_0xa1c6('0x67')]=0x0;this[_0xa1c6('0x68')]=0x0;this[_0xa1c6('0x69')]=_0x379fae[_0xa1c6('0x6a')]||0x14;this[_0xa1c6('0x6b')]=_0x379fae[_0xa1c6('0x6a')]||0xa;this[_0xa1c6('0x6c')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xa1c6('0x6d')]=0x1;this[_0xa1c6('0x6e')]=0x0;this[_0xa1c6('0x6f')]=0x0;this[_0xa1c6('0x70')]=0x0;this[_0xa1c6('0x71')]=0x0;this[_0xa1c6('0x72')]=_0x379fae[_0xa1c6('0x72')]||0x1e;this[_0xa1c6('0x73')]=_0x379fae[_0xa1c6('0x73')]||![];this[_0xa1c6('0x74')]=_0x379fae[_0xa1c6('0x74')]||undefined;this[_0xa1c6('0x75')]=_0x379fae[_0xa1c6('0x75')]||![];this[_0xa1c6('0x76')]=_0x379fae['dialAgiAfterHangupAgent']||![];this[_0xa1c6('0xc')]=monitorFormat[_0x379fae['monitor_format']]?monitorFormat[_0x379fae[_0xa1c6('0xc')]]:undefined;this['mandatoryDisposition']=_0x379fae[_0xa1c6('0x77')]||![];this[_0xa1c6('0x78')]=_0x379fae[_0xa1c6('0x78')]?_0x379fae['mandatoryDispositionPause']:undefined;}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 8eb162a..3bbef06 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 _0xecfb=['remoteUri','serverUrl','Configurations','exports','name','username','accessKey'];(function(_0x5120d7,_0x4b1363){var _0x228399=function(_0x3a263e){while(--_0x3a263e){_0x5120d7['push'](_0x5120d7['shift']());}};_0x228399(++_0x4b1363);}(_0xecfb,0x1d2));var _0xbecf=function(_0x3ead18,_0x119a26){_0x3ead18=_0x3ead18-0x0;var _0x5a67da=_0xecfb[_0x3ead18];return _0x5a67da;};'use strict';function VtigerAccount(_0x43e69c){this['id']=_0x43e69c['id']||0x0;this[_0xbecf('0x0')]=_0x43e69c['name']||'';this['username']=_0x43e69c[_0xbecf('0x1')]||'';this[_0xbecf('0x2')]=_0x43e69c[_0xbecf('0x2')]||'';this['remoteUri']=_0x43e69c[_0xbecf('0x3')]||'';this[_0xbecf('0x4')]=_0x43e69c[_0xbecf('0x4')]||'';this[_0xbecf('0x5')]=_0x43e69c[_0xbecf('0x5')]||{};}module[_0xbecf('0x6')]=VtigerAccount; \ No newline at end of file +var _0x5541=['username','accessKey','remoteUri','serverUrl','Configurations','name'];(function(_0x4188e7,_0x319155){var _0x26e9fb=function(_0x1f7890){while(--_0x1f7890){_0x4188e7['push'](_0x4188e7['shift']());}};_0x26e9fb(++_0x319155);}(_0x5541,0x1df));var _0x1554=function(_0x21c6b8,_0x16d6f6){_0x21c6b8=_0x21c6b8-0x0;var _0x39d474=_0x5541[_0x21c6b8];return _0x39d474;};'use strict';function VtigerAccount(_0xe56e5b){this['id']=_0xe56e5b['id']||0x0;this['name']=_0xe56e5b[_0x1554('0x0')]||'';this[_0x1554('0x1')]=_0xe56e5b['username']||'';this['accessKey']=_0xe56e5b[_0x1554('0x2')]||'';this['remoteUri']=_0xe56e5b[_0x1554('0x3')]||'';this[_0x1554('0x4')]=_0xe56e5b[_0x1554('0x4')]||'';this[_0x1554('0x5')]=_0xe56e5b['Configurations']||{};}module['exports']=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 3cd8814..6a8f70b 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(_0x440a5d,_0x372b3a){_0x440a5d=_0x440a5d-0x0;var _0x51aa39=_0xdb28[_0x440a5d];return _0x51aa39;};'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(_0x2aec84,_0x18baf2){_0x2aec84=_0x2aec84-0x0;var _0x2f08c4=_0xadb5[_0x2aec84];return _0x2f08c4;};'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 3c45b93..8f4c8eb 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 _0x91b6=['description','host','zone','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','exports','name'];(function(_0x4c52f3,_0x5bf82a){var _0x17f703=function(_0x3cd79b){while(--_0x3cd79b){_0x4c52f3['push'](_0x4c52f3['shift']());}};_0x17f703(++_0x5bf82a);}(_0x91b6,0x18b));var _0x691b=function(_0x3de2e3,_0x138ce7){_0x3de2e3=_0x3de2e3-0x0;var _0x1bce2a=_0x91b6[_0x3de2e3];return _0x1bce2a;};'use strict';function ZohoAccount(_0x1c0163){this['id']=_0x1c0163['id']||0x0;this[_0x691b('0x0')]=_0x1c0163['name']||'';this[_0x691b('0x1')]=_0x1c0163['description']||'';this['host']=_0x1c0163[_0x691b('0x2')]||'';this[_0x691b('0x3')]=_0x1c0163[_0x691b('0x3')]||'';this[_0x691b('0x4')]=_0x1c0163[_0x691b('0x4')]||'';this[_0x691b('0x5')]=_0x1c0163['clientSecret']||'';this['serverUrl']=_0x1c0163[_0x691b('0x6')]||'';this[_0x691b('0x7')]=_0x1c0163['code']||'';this[_0x691b('0x8')]=_0x1c0163[_0x691b('0x8')]||'';this[_0x691b('0x9')]=_0x1c0163[_0x691b('0x9')]||{};}module[_0x691b('0xa')]=ZohoAccount; \ No newline at end of file +var _0x85de=['clientSecret','serverUrl','code','refreshToken','Configurations','exports','name','description','host','clientId'];(function(_0x430a36,_0x3ede38){var _0x6e4889=function(_0x3e2447){while(--_0x3e2447){_0x430a36['push'](_0x430a36['shift']());}};_0x6e4889(++_0x3ede38);}(_0x85de,0x1f0));var _0xe85d=function(_0x490090,_0x444634){_0x490090=_0x490090-0x0;var _0x5898d8=_0x85de[_0x490090];return _0x5898d8;};'use strict';function ZohoAccount(_0x43a651){this['id']=_0x43a651['id']||0x0;this[_0xe85d('0x0')]=_0x43a651[_0xe85d('0x0')]||'';this[_0xe85d('0x1')]=_0x43a651[_0xe85d('0x1')]||'';this['host']=_0x43a651[_0xe85d('0x2')]||'';this['zone']=_0x43a651['zone']||'';this[_0xe85d('0x3')]=_0x43a651[_0xe85d('0x3')]||'';this['clientSecret']=_0x43a651[_0xe85d('0x4')]||'';this[_0xe85d('0x5')]=_0x43a651[_0xe85d('0x5')]||'';this[_0xe85d('0x6')]=_0x43a651[_0xe85d('0x6')]||'';this[_0xe85d('0x7')]=_0x43a651[_0xe85d('0x7')]||'';this[_0xe85d('0x8')]=_0x43a651['Configurations']||{};}module[_0xe85d('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 c9781b8..760e402 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 _0x3b95=['callbackat','recallme','ListId','UserId','VoiceQueueId','originatecalleridnum','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','isNil','string','uniqueid','idContact','queue','name','type','dialAnswer','Agent','channelAgent','format','SIP/%s','membername','Contact','phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid'];(function(_0x42c05e,_0x33da91){var _0x461b6c=function(_0x246ce5){while(--_0x246ce5){_0x42c05e['push'](_0x42c05e['shift']());}};_0x461b6c(++_0x33da91);}(_0x3b95,0x101));var _0x53b9=function(_0x1b1b8a,_0x4e49db){_0x1b1b8a=_0x1b1b8a-0x0;var _0x405f71=_0x3b95[_0x1b1b8a];return _0x405f71;};'use strict';var util=require('util');var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x56e8d2,_0x367f8f,_0x4cd385){var _0x1d02dc='';if(!_[_0x53b9('0x0')](_0x367f8f)&&_0x53b9('0x1')===typeof _0x367f8f){_0x1d02dc+=_0x367f8f;}if(!_['isNil'](_0x4cd385)&&'string'===typeof _0x4cd385){_0x1d02dc+='\x20'+_0x4cd385;}if(_0x1d02dc!==''){return _0x1d02dc;}return _0x56e8d2;}function Action(_0x2ef9cf,_0x183695,_0x118b60,_0x34483a,_0x5a8c6e){this[_0x53b9('0x2')]=_0x118b60||undefined;this[_0x53b9('0x3')]=_0x2ef9cf['id'];this[_0x53b9('0x4')]=_0x183695[_0x53b9('0x5')];this[_0x53b9('0x6')]=_0x183695[_0x53b9('0x6')];this['campaigntype']='queue';this[_0x53b9('0x7')]=![];this['membername']=_['isNil'](_0x2ef9cf[_0x53b9('0x8')])?undefined:_0x2ef9cf['Agent']['name'];this[_0x53b9('0x9')]=this['membername']?util[_0x53b9('0xa')](_0x53b9('0xb'),this[_0x53b9('0xc')]):_0x34483a||undefined;this['calleridname']=checkNameSurname(_0x2ef9cf[_0x53b9('0xd')][_0x53b9('0xe')],_0x2ef9cf[_0x53b9('0xd')][_0x53b9('0xf')],_0x2ef9cf['Contact'][_0x53b9('0x10')]);this[_0x53b9('0x11')]=_0x2ef9cf[_0x53b9('0x11')]||![];this['calleridnum']=_0x2ef9cf[_0x53b9('0xd')][_0x53b9('0xe')];this[_0x53b9('0x12')]=_0x2ef9cf[_0x53b9('0x12')];this[_0x53b9('0x13')]=_0x2ef9cf[_0x53b9('0x13')]||0x0;this['countcongestionretry']=_0x2ef9cf[_0x53b9('0x14')]||0x0;this[_0x53b9('0x15')]=_0x2ef9cf[_0x53b9('0x15')]||0x0;this[_0x53b9('0x16')]=(_0x2ef9cf[_0x53b9('0x13')]||0x0)+(_0x2ef9cf['countcongestionretry']||0x0)+(_0x2ef9cf[_0x53b9('0x15')]||0x0);this[_0x53b9('0x17')]=_0x2ef9cf[_0x53b9('0x17')]||0x0;this[_0x53b9('0x18')]=_0x2ef9cf[_0x53b9('0x18')]||0x0;this[_0x53b9('0x19')]=_0x2ef9cf['countabandonedretry']||0x0;this[_0x53b9('0x1a')]=_0x2ef9cf['countmachineretry']||0x0;this[_0x53b9('0x1b')]=_0x2ef9cf[_0x53b9('0x1b')]||0x0;this[_0x53b9('0x1c')]=_0x2ef9cf[_0x53b9('0x1c')];this[_0x53b9('0x1d')]=_0x2ef9cf[_0x53b9('0x1d')];this[_0x53b9('0x1e')]=_0x2ef9cf[_0x53b9('0x1e')];this[_0x53b9('0x1f')]=_0x2ef9cf['recallme'];this['ContactId']=_0x2ef9cf['ContactId'];this[_0x53b9('0x20')]=_0x2ef9cf[_0x53b9('0x20')];this[_0x53b9('0x21')]=_[_0x53b9('0x0')](_0x2ef9cf[_0x53b9('0x8')])?_0x2ef9cf['UserId']:_0x2ef9cf[_0x53b9('0x8')]['id'];this[_0x53b9('0x22')]=_0x2ef9cf['VoiceQueueId'];this[_0x53b9('0x23')]='';this['originatecalleridname']='';}Action['prototype'][_0x53b9('0x24')]=function(){return util[_0x53b9('0xa')](_0x53b9('0x25'),this[_0x53b9('0x26')],this[_0x53b9('0x27')]);};module[_0x53b9('0x28')]=Action; \ No newline at end of file +var _0x3c72=['phone','firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','callback','callbackuniqueid','callbackat','recallme','ContactId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','number','util','lodash','moment','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','calleridname','Contact'];(function(_0x35201e,_0x34341b){var _0x4bc5b7=function(_0x504ba7){while(--_0x504ba7){_0x35201e['push'](_0x35201e['shift']());}};_0x4bc5b7(++_0x34341b);}(_0x3c72,0x18b));var _0x23c7=function(_0x52f415,_0x48a802){_0x52f415=_0x52f415-0x0;var _0x34246f=_0x3c72[_0x52f415];return _0x34246f;};'use strict';var util=require(_0x23c7('0x0'));var _=require(_0x23c7('0x1'));var moment=require(_0x23c7('0x2'));function checkNameSurname(_0x3924c6,_0x42f5e9,_0x47efb7){var _0x136a67='';if(!_['isNil'](_0x42f5e9)&&_0x23c7('0x3')===typeof _0x42f5e9){_0x136a67+=_0x42f5e9;}if(!_['isNil'](_0x47efb7)&&_0x23c7('0x3')===typeof _0x47efb7){_0x136a67+='\x20'+_0x47efb7;}if(_0x136a67!==''){return _0x136a67;}return _0x3924c6;}function Action(_0x28913a,_0x4102e9,_0x313db2,_0x3b132e,_0x202ed1){this['uniqueid']=_0x313db2||undefined;this[_0x23c7('0x4')]=_0x28913a['id'];this[_0x23c7('0x5')]=_0x4102e9[_0x23c7('0x6')];this['type']=_0x4102e9[_0x23c7('0x7')];this[_0x23c7('0x8')]='queue';this[_0x23c7('0x9')]=![];this[_0x23c7('0xa')]=_['isNil'](_0x28913a[_0x23c7('0xb')])?undefined:_0x28913a[_0x23c7('0xb')][_0x23c7('0x6')];this[_0x23c7('0xc')]=this[_0x23c7('0xa')]?util['format']('SIP/%s',this['membername']):_0x3b132e||undefined;this[_0x23c7('0xd')]=checkNameSurname(_0x28913a[_0x23c7('0xe')][_0x23c7('0xf')],_0x28913a[_0x23c7('0xe')][_0x23c7('0x10')],_0x28913a[_0x23c7('0xe')][_0x23c7('0x11')]);this[_0x23c7('0x12')]=_0x28913a['active']||![];this['calleridnum']=_0x28913a[_0x23c7('0xe')][_0x23c7('0xf')];this[_0x23c7('0x13')]=_0x28913a['scheduledat'];this['countbusyretry']=_0x28913a[_0x23c7('0x14')]||0x0;this[_0x23c7('0x15')]=_0x28913a[_0x23c7('0x15')]||0x0;this[_0x23c7('0x16')]=_0x28913a[_0x23c7('0x16')]||0x0;this[_0x23c7('0x17')]=(_0x28913a[_0x23c7('0x14')]||0x0)+(_0x28913a[_0x23c7('0x15')]||0x0)+(_0x28913a['countnoanswerretry']||0x0);this[_0x23c7('0x18')]=_0x28913a[_0x23c7('0x18')]||0x0;this[_0x23c7('0x19')]=_0x28913a[_0x23c7('0x19')]||0x0;this['countabandonedretry']=_0x28913a[_0x23c7('0x1a')]||0x0;this['countmachineretry']=_0x28913a[_0x23c7('0x1b')]||0x0;this['countagentrejectretry']=_0x28913a[_0x23c7('0x1c')]||0x0;this['callback']=_0x28913a[_0x23c7('0x1d')];this[_0x23c7('0x1e')]=_0x28913a['callbackuniqueid'];this[_0x23c7('0x1f')]=_0x28913a['callbackat'];this['recallme']=_0x28913a[_0x23c7('0x20')];this['ContactId']=_0x28913a[_0x23c7('0x21')];this['ListId']=_0x28913a['ListId'];this[_0x23c7('0x22')]=_['isNil'](_0x28913a[_0x23c7('0xb')])?_0x28913a['UserId']:_0x28913a[_0x23c7('0xb')]['id'];this[_0x23c7('0x23')]=_0x28913a[_0x23c7('0x23')];this['originatecalleridnum']='';this[_0x23c7('0x24')]='';}Action[_0x23c7('0x25')][_0x23c7('0x26')]=function(){return util['format'](_0x23c7('0x27'),this['calleridname'],this[_0x23c7('0x28')]);};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 2112881..22aa3e0 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 _0x5350=['Is\x20Valid','execCall','SIP/%s/%s%s','trim','phone','substring','dialCutDigit','getCallerId','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','originatecalleridname','extractCalleridName','originatecalleridnum','addVariables','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','clone','isFailure','custom:agentringnoanswer','rejected','Answer','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','callProgressDetectingCustomer','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','transfer','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','md5','../../../config/environment','../../../config/logger','../ami','./rpcDb','redis','localhost','socket.io-emitter','tail','finally','sequence','campaignsPreview','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','syncHangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalAvailable','predictiveIntervalTotalCalls','message','originated','erlangCalls','erlangCallToSecond','startPredictive','startProgressive','Trunk','name','active','callerid','Interval','stringify','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','sendMessageOneNotActive','paused','NOT_ACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','IS_DISACTIVED','\x20is\x20disactive','syncCampaigns','hasOwnProperty','dialMethod','preview','booked','clearZombieChannels','recallMe','prototype','clearZombieChannel','enqueue','isNil','[clearZombieChannels][talking]','Queue','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','Action','status','channel','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','logger2','[RecallMe]','starttime','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','catch','setMessage','IsNotLoggedIn','isActive','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','totalGlobal','NoSuchNumber','createCustomerHistory','[callProgressDetectingCustomer][logNoSuch]','cloneAction','Global','countnosuchnumberretry','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','uniqueid','\x20Queue','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','[16]','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','countbusyretry','countglobal','Busy','[callProgressDetectingCustomer][logBusy]','dialGlobalMaxRetry','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','dialNoAnswerMaxRetry','CONGESTION','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','outboundRejectCallsDay','countagentrejectretry','AgentReject','unlockContact','disableContact','idContact','ABANDONED','countabandonedretry','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','dialAbandonedRetryFrequency','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','ANSWER','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logBusy]','logAgent','Congestion','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','Queue:\x20','\x20IdHopper:\x20','custom:agentcalled','[Preview][execCall][failure]','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','format','SIP/%s','unmonitored','execRun','unlock','recallme','validateContact','isValid','VoiceQueueId','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','\x20Trunk\x20Backup\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active'];(function(_0x2f5f55,_0x50581c){var _0x19a906=function(_0x47ee45){while(--_0x47ee45){_0x2f5f55['push'](_0x2f5f55['shift']());}};_0x19a906(++_0x50581c);}(_0x5350,0x16b));var _0x0535=function(_0x23be36,_0x4acc97){_0x23be36=_0x23be36-0x0;var _0x5f27ee=_0x5350[_0x23be36];return _0x5f27ee;};'use strict';var util=require(_0x0535('0x0'));var _=require(_0x0535('0x1'));var BPromise=require(_0x0535('0x2'));var uuid=require('uuid');var moment=require(_0x0535('0x3'));var md5=require(_0x0535('0x4'));var Redis=require('ioredis');var config=require(_0x0535('0x5'));var logger=require(_0x0535('0x6'))('preview');var loggerAction=require(_0x0535('0x6'))('actionPreview');var ami=require(_0x0535('0x7'));var rpcDb=require(_0x0535('0x8'));var Action=require('./action');var ut=require('./util/util');config[_0x0535('0x9')]=_['defaults'](config[_0x0535('0x9')],{'host':_0x0535('0xa'),'port':0x18eb});var io=require(_0x0535('0xb'))(new Redis(config[_0x0535('0x9')]));var Sequence=function(){};Sequence['prototype']['enqueue']=function(_0x42f7dd){this[_0x0535('0xc')]=this[_0x0535('0xc')]?this[_0x0535('0xc')][_0x0535('0xd')](_0x42f7dd):_0x42f7dd();};function Preview(_0x559ad8){this[_0x0535('0xe')]=new Sequence();this[_0x0535('0xf')]=_0x559ad8['voiceQueues'];this[_0x0535('0x10')]=_0x559ad8[_0x0535('0x10')];this[_0x0535('0x11')]={};this['agents']=_0x559ad8[_0x0535('0x12')];this[_0x0535('0x13')]=0x0;ami['on'](_0x0535('0x14'),this['syncOriginateResponse'][_0x0535('0x15')](this));ami['on']('hangup',this[_0x0535('0x16')]['bind'](this));ami['on'](_0x0535('0x17'),this[_0x0535('0x18')][_0x0535('0x15')](this));ami['on'](_0x0535('0x19'),this[_0x0535('0x1a')]['bind'](this));ami['on']('newexten',this[_0x0535('0x1b')][_0x0535('0x15')](this));ami['on'](_0x0535('0x1c'),this[_0x0535('0x1d')]['bind'](this));ami['on'](_0x0535('0x1e'),this[_0x0535('0x1f')][_0x0535('0x15')](this));ami['on'](_0x0535('0x20'),this[_0x0535('0x21')][_0x0535('0x15')](this));this[_0x0535('0x22')](this['campaignsPreview']);}function emit(_0x1a76c0,_0x59488e,_0x26a935){io['to'](_0x1a76c0)[_0x0535('0x23')](_0x59488e,_0x26a935);}function emitCampaignPreview(_0x4c5503){if(_0x4c5503[_0x0535('0x24')]===_0x0535('0x25')){var _0x1fee2b={'id':_0x4c5503['id'],'name':_0x4c5503['name'],'strategy':_0x4c5503[_0x0535('0x26')],'answered':_0x4c5503[_0x0535('0x27')],'available':_0x4c5503[_0x0535('0x28')],'loggedIn':_0x4c5503[_0x0535('0x29')],'pTalking':_0x4c5503[_0x0535('0x2a')],'sumBillable':_0x4c5503[_0x0535('0x2b')],'sumDuration':_0x4c5503[_0x0535('0x2c')],'sumHoldTime':_0x4c5503[_0x0535('0x2d')]||0x0,'talking':_0x4c5503[_0x0535('0x2e')],'total':_0x4c5503[_0x0535('0x2f')],'type':_0x4c5503[_0x0535('0x24')],'unmanaged':_0x4c5503[_0x0535('0x30')],'abandoned':_0x4c5503[_0x0535('0x31')],'waiting':_0x4c5503['waiting'],'loggedInDb':_0x4c5503[_0x0535('0x32')],'dialActive':_0x4c5503[_0x0535('0x33')],'dialMethod':_0x4c5503['dialMethod'],'dialOriginateCallerIdName':_0x4c5503[_0x0535('0x34')],'dialOriginateCallerIdNumber':_0x4c5503[_0x0535('0x35')],'dialOriginateTimeout':_0x4c5503[_0x0535('0x36')],'dialPrefix':_0x4c5503[_0x0535('0x37')],'outboundAnswerAgiCallsDay':_0x4c5503['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4c5503[_0x0535('0x38')],'outboundBlacklistCallsDay':_0x4c5503[_0x0535('0x39')],'outboundBusyCallsDay':_0x4c5503[_0x0535('0x3a')],'outboundCongestionCallsDay':_0x4c5503[_0x0535('0x3b')],'outboundDropCallsDayACS':_0x4c5503[_0x0535('0x3c')],'outboundDropCallsDayCallersExit':_0x4c5503['outboundDropCallsDayCallersExit'],'outboundDropCallsDayTimeout':_0x4c5503[_0x0535('0x3d')],'outboundNoAnswerCallsDay':_0x4c5503[_0x0535('0x3e')],'outboundNoSuchCallsDay':_0x4c5503[_0x0535('0x3f')],'outboundOriginateFailureCallsDay':_0x4c5503[_0x0535('0x40')],'outboundReCallsDay':_0x4c5503[_0x0535('0x41')],'outboundRejectCallsDay':_0x4c5503['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x4c5503[_0x0535('0x42')],'outboundAbandonedCallsDay':_0x4c5503[_0x0535('0x43')],'predictiveIntervalAnsweredCalls':_0x4c5503[_0x0535('0x44')],'predictiveIntervalAvgHoldtime':_0x4c5503[_0x0535('0x45')],'predictiveIntervalAvgTalktime':_0x4c5503['predictiveIntervalAvgTalktime'],'predictiveIntervalDroppedCallsCallersExit':_0x4c5503['predictiveIntervalDroppedCallsCallersExit'],'predictiveIntervalDroppedCallsTimeout':_0x4c5503[_0x0535('0x46')],'predictiveIntervalErlangCalls':_0x4c5503[_0x0535('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x4c5503[_0x0535('0x48')],'predictiveIntervalHitRate':_0x4c5503[_0x0535('0x49')],'predictiveIntervalMultiplicativeFactor':_0x4c5503[_0x0535('0x4a')],'predictiveIntervalPauses':_0x4c5503['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x4c5503[_0x0535('0x4b')],'predictiveIntervalTotalCalls':_0x4c5503[_0x0535('0x4c')],'message':_0x4c5503[_0x0535('0x4d')],'originated':_0x4c5503[_0x0535('0x4e')],'erlangCalls':_0x4c5503[_0x0535('0x4f')],'erlangCallToSecond':_0x4c5503[_0x0535('0x50')],'erlangAbandonmentRate':_0x4c5503['erlangAbandonmentRate'],'erlangBusyFactor':_0x4c5503['erlangBusyFactor'],'startPredictive':_0x4c5503[_0x0535('0x51')],'startProgressive':_0x4c5503[_0x0535('0x52')]};if(_0x4c5503[_0x0535('0x53')]){_0x1fee2b[_0x0535('0x53')]={'id':_0x4c5503[_0x0535('0x53')]['id'],'name':_0x4c5503[_0x0535('0x53')][_0x0535('0x54')],'active':_0x4c5503[_0x0535('0x53')][_0x0535('0x55')],'callerid':_0x4c5503[_0x0535('0x53')][_0x0535('0x56')]};}if(_0x4c5503['Interval']){_0x1fee2b['Interval']={'id':_0x4c5503[_0x0535('0x57')]['id'],'name':_0x4c5503['Interval'][_0x0535('0x54')]};}var _0x3e0417=md5(JSON[_0x0535('0x58')](_0x1fee2b));if(_0x4c5503['md5']!==_0x3e0417){_0x4c5503['md5']=_0x3e0417;emit(util['format'](_0x0535('0x59'),_0x1fee2b[_0x0535('0x54')]),'voice_queue:save',_0x1fee2b);}}}function emitVoiceQueueChannelRemove(_0x57ad17){logger[_0x0535('0x5a')](_0x0535('0x5b'),JSON[_0x0535('0x58')](_0x57ad17));emit(util['format'](_0x0535('0x59'),_0x57ad17['name']),_0x0535('0x5c'),_0x57ad17);}function notSendMessagesQueue(_0xf95877){if(_0xf95877['sendMessageOneNotActive']){if(_0xf95877[_0x0535('0x4e')]===0x0&&_0xf95877[_0x0535('0x2a')]===0x0){_0xf95877[_0x0535('0x5d')]=![];_0xf95877[_0x0535('0x28')]=0x0;_0xf95877[_0x0535('0x5e')]=0x0;_0xf95877[_0x0535('0x4d')]=_0x0535('0x5f');ut[_0x0535('0x60')](_0x0535('0x61'),_0xf95877['name']+_0x0535('0x62'));}else{_0xf95877[_0x0535('0x4d')]=_0x0535('0x63');ut[_0x0535('0x60')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0xf95877[_0x0535('0x54')]+_0x0535('0x64'));}emitCampaignPreview(_0xf95877);}}Preview['prototype'][_0x0535('0x22')]=function(){var _0x3ad9dc=this;setInterval(function(){_0x3ad9dc[_0x0535('0x65')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x315026=this[_0x0535('0xf')];this[_0x0535('0x13')]+=0x1;for(var _0x25a66f in _0x315026){if(_0x315026[_0x0535('0x66')](_0x25a66f)&&(_0x315026[_0x25a66f][_0x0535('0x67')]===_0x0535('0x68')||_0x315026[_0x25a66f][_0x0535('0x67')]===_0x0535('0x69'))&&_0x315026[_0x25a66f]['type']===_0x0535('0x25')){if(this[_0x0535('0x13')]>0x7){this[_0x0535('0x13')]=0x0;this[_0x0535('0x6a')]();}}if(_0x315026[_0x0535('0x66')](_0x25a66f)&&_0x315026[_0x25a66f]['dialMethod']===_0x0535('0x68')&&_0x315026[_0x25a66f][_0x0535('0x24')]===_0x0535('0x25')){if(_0x315026[_0x25a66f][_0x0535('0x33')]){this['setMessage'](_0x315026[_0x25a66f]);this[_0x0535('0x6b')](_0x315026[_0x25a66f]);}else{notSendMessagesQueue(_0x315026[_0x25a66f]);}}}};Preview[_0x0535('0x6c')][_0x0535('0x6d')]=function(_0x2ea665){var _0x11ab06=this;this[_0x0535('0xe')][_0x0535('0x6e')](function(){if(!_[_0x0535('0x6f')](_0x11ab06['actions'][_0x2ea665])){loggerAction[_0x0535('0x5a')](_0x0535('0x70'),_0x2ea665,_0x0535('0x71'),_0x11ab06[_0x0535('0x11')][_0x2ea665][_0x0535('0x72')],_0x0535('0x73'),JSON[_0x0535('0x58')](_0x11ab06['campaignsPreview'][_0x11ab06['actions'][_0x2ea665][_0x0535('0x72')]][_0x0535('0x4e')]),_0x0535('0x74'),JSON[_0x0535('0x58')](_0x11ab06[_0x0535('0xf')][_0x11ab06['actions'][_0x2ea665][_0x0535('0x72')]]['pTalking']),JSON[_0x0535('0x58')](_0x11ab06[_0x0535('0x11')][_0x2ea665][_0x0535('0x75')]),JSON[_0x0535('0x58')](_[_0x0535('0x76')](_0x11ab06[_0x0535('0x11')][_0x2ea665],[_0x0535('0x77'),_0x0535('0x78'),'VoiceQueueId','ListId'])));return ami[_0x0535('0x79')]({'action':_0x0535('0x7a'),'channel':_0x11ab06['actions'][_0x2ea665][_0x0535('0x7b')]})['catch'](function(_0x51bce3){if(_0x51bce3['message']===_0x0535('0x7c')){setTimeout(function(){if(_0x11ab06['actions'][_0x2ea665]){ut[_0x0535('0x7d')](_0x11ab06[_0x0535('0xf')][_0x11ab06[_0x0535('0x11')][_0x2ea665][_0x0535('0x72')]],_0x0535('0x7e'));if(_0x11ab06[_0x0535('0x11')][_0x2ea665][_0x0535('0x75')]===!![]){ut[_0x0535('0x7f')](_0x11ab06['campaignsPreview'][_0x11ab06['actions'][_0x2ea665][_0x0535('0x72')]],_0x0535('0x7e'));ut[_0x0535('0x80')]('[Dialer][checkChannel][pTalking][Preview]'+_0x2ea665,_0x11ab06[_0x0535('0x11')][_0x2ea665]['queue']);}ut[_0x0535('0x80')](_0x0535('0x81')+_0x2ea665,_0x11ab06[_0x0535('0x11')][_0x2ea665][_0x0535('0x72')]);delete _0x11ab06['actions'][_0x2ea665];}},0x2328);}});}});};Preview[_0x0535('0x6c')][_0x0535('0x6a')]=function(){var _0x54a8f1=this;loggerAction[_0x0535('0x5a')](_0x0535('0x82'),_[_0x0535('0x83')](this['actions']));for(var _0x10bd67 in this[_0x0535('0x11')]){if(_0x54a8f1[_0x0535('0x11')][_0x0535('0x66')](_0x10bd67)){_0x54a8f1[_0x0535('0x6d')](_0x10bd67);}}};Preview['prototype'][_0x0535('0x6b')]=function(_0x263c1f){var _0x4d215b=this;rpcDb[_0x0535('0x84')](_0x263c1f['id'],ut[_0x0535('0x85')](this[_0x0535('0x12')]))[_0x0535('0x86')](function(_0x5fa1c3){if(!_[_0x0535('0x6f')](_0x5fa1c3)){for(var _0x1e1196=0x0;_0x1e1196<_0x5fa1c3[_0x0535('0x87')];_0x1e1196+=0x1){if(ut[_0x0535('0x88')](_0x5fa1c3[_0x1e1196][_0x0535('0x89')])<_0x263c1f[_0x0535('0x8a')]*0x3c){if(_0x5fa1c3[_0x1e1196][_0x0535('0x8b')]&&!_0x5fa1c3[_0x1e1196][_0x0535('0x8b')][_0x0535('0x8c')]){_0x4d215b['run'](_0x5fa1c3[_0x1e1196]['id'])[_0x0535('0x86')](ut[_0x0535('0x8d')](_0x0535('0x8e')))['catch'](ut[_0x0535('0x8d')](_0x0535('0x8e')));}else{rpcDb['disableContact'](_0x5fa1c3[_0x1e1196]['id']);}}else{var _0x466876=new Action(_0x5fa1c3[_0x1e1196],_0x263c1f);_0x466876[_0x0535('0x8f')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x263c1f[_0x0535('0x41')]+=0x1;ut[_0x0535('0x90')](_0x466876,0x17,_0x0535('0x91'));if(_0x263c1f[_0x0535('0x92')]){rpcDb[_0x0535('0x93')](ut['createBody'](_0x5fa1c3[_0x1e1196]));rpcDb['createCustomerHistory'](_0x466876,_0x0535('0x94'));}else{ut['logCustomer'](_0x466876,0x16,_0x0535('0x95'));rpcDb['createCustomerHistory'](_0x466876,_0x0535('0x96'));rpcDb[_0x0535('0x97')](_0x466876,_0x0535('0x96'));}}}}})[_0x0535('0x98')](ut[_0x0535('0x8d')]('[getContactRecallMe]'));};Preview[_0x0535('0x6c')][_0x0535('0x99')]=function(_0x21b7ec){_0x21b7ec['sendMessageOneNotActive']=!![];if(ut[_0x0535('0x9a')](_0x21b7ec['loggedIn'])){_0x21b7ec[_0x0535('0x4d')]='AGENTS_NOT_LOGGED';}else if(!ut[_0x0535('0x9b')](_0x21b7ec['dialActive'])){_0x21b7ec['message']=_0x0535('0x5f');}else if(!this[_0x0535('0x9c')](_0x21b7ec['Trunk'])){if(!this[_0x0535('0x9c')](_0x21b7ec[_0x0535('0x9d')])){_0x21b7ec['message']=_0x0535('0x9e');}else{_0x21b7ec[_0x0535('0x4d')]=_0x0535('0x9f');}}else{_0x21b7ec[_0x0535('0x4d')]='ACTIVE';}emitCampaignPreview(_0x21b7ec);};Preview[_0x0535('0x6c')]['callProgressDetectingCustomer']=function(_0x2be94b,_0x35c014,_0x20d31d){var _0x5a073b=this;var _0x5beeeb=this[_0x0535('0x11')][_0x35c014];var _0xbcffc3=this[_0x0535('0xf')][_0x5beeeb[_0x0535('0x72')]];var _0x433cb8;if(_0xbcffc3){switch(_0x20d31d){case'1':_0xbcffc3[_0x0535('0x3f')]+=0x1;_0x5beeeb['countnosuchnumberretry']+=0x1;_0x5beeeb['countglobal']=ut[_0x0535('0xa0')](_0x5beeeb);ut['logCustomer'](_0x5beeeb,0x0,_0x0535('0xa1'));rpcDb[_0x0535('0xa2')](_0x5beeeb,_0x0535('0xa3'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3['dialGlobalMaxRetry']){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,_0x0535('0xa5'));rpcDb[_0x0535('0x97')](_0x433cb8,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x5beeeb[_0x0535('0xa6')]>=_0xbcffc3['dialNoSuchNumberMaxRetry']){rpcDb[_0x0535('0x97')](_0x5beeeb,_0x0535('0xa7'));}else{rpcDb[_0x0535('0xa8')](ut[_0x0535('0xa9')](_0x5beeeb,_0x0535('0xa6'),_0xbcffc3[_0x0535('0xaa')]),_0x5beeeb[_0x0535('0xab')],_0x5beeeb[_0x0535('0xac')]);}}delete this[_0x0535('0x11')][_0x2be94b[_0x0535('0xad')]];break;case'ANSWER':var _0x53ac7e=moment()['format'](_0x0535('0xae'));_0x5beeeb[_0x0535('0xaf')]=_0x53ac7e;_0x5beeeb['answertime']=_0x53ac7e;_0x5beeeb[_0x0535('0x75')]=!![];_0xbcffc3[_0x0535('0x2a')]+=0x1;logger[_0x0535('0x5a')]('[syncHangup][talking][increment]',_0x5beeeb[_0x0535('0xb0')],_0x0535('0xb1'),_0xbcffc3[_0x0535('0x54')],_0x0535('0x74'),_0xbcffc3[_0x0535('0x2a')]);ami[_0x0535('0x23')](_0x0535('0xb2'),ut[_0x0535('0xb3')](_0x5beeeb,'connect'));if(_0xbcffc3[_0x0535('0xb4')]){ami[_0x0535('0x23')](_0x0535('0xb5'),ut[_0x0535('0xb6')](_0x5beeeb));}break;case'16':ami[_0x0535('0x23')](_0x0535('0xb7'),ut[_0x0535('0xb3')](_0x5beeeb,_0x0535('0xb8')));emitVoiceQueueChannelRemove(ut[_0x0535('0xb3')](_0x5beeeb,_0x0535('0xb8')));_0xbcffc3[_0x0535('0x38')]+=0x1;_0xbcffc3[_0x0535('0x2f')]+=0x1;_0xbcffc3[_0x0535('0x27')]+=0x1;ut['decrementTalkink'](_0xbcffc3,_0x0535('0xb9'));_0x5beeeb['countglobal']=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0x4,'Answer');rpcDb['createCustomerHistory'](_0x5beeeb,_0x0535('0xba'));rpcDb[_0x0535('0x97')](_0x5beeeb,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x0535('0xbb')](_0x5beeeb);_0xbcffc3['sumDuration']+=_0x5beeeb['talktime'];_0xbcffc3[_0x0535('0x2b')]+=_0x5beeeb[_0x0535('0xbc')];logger[_0x0535('0x5a')]('[syncHangup][talking][decrement]',_0x5beeeb['uniqueid'],'\x20Queue',_0xbcffc3[_0x0535('0x54')],_0x0535('0x74'),_0xbcffc3[_0x0535('0x2a')]);delete this[_0x0535('0x11')][_0x2be94b[_0x0535('0xad')]];break;case'BUSY':_0xbcffc3[_0x0535('0x3a')]+=0x1;_0x5beeeb[_0x0535('0xbd')]+=0x1;_0x5beeeb[_0x0535('0xbe')]=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0x5,_0x0535('0xbf'));rpcDb[_0x0535('0xa2')](_0x5beeeb,_0x0535('0xc0'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3[_0x0535('0xc1')]){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,'Global');rpcDb['createCustomerFinal'](_0x433cb8,_0x0535('0xc2'));}else{if(_0x5beeeb['countbusyretry']>=_0xbcffc3[_0x0535('0xc3')]){rpcDb['createCustomerFinal'](_0x5beeeb,_0x0535('0xc0'));}else{rpcDb[_0x0535('0xa8')](ut['scheduledAt'](_0x5beeeb,_0x0535('0xbd'),_0xbcffc3[_0x0535('0xc4')]),_0x5beeeb[_0x0535('0xab')],_0x5beeeb[_0x0535('0xac')]);}}break;case _0x0535('0xc5'):_0xbcffc3[_0x0535('0x3e')]+=0x1;_0x5beeeb[_0x0535('0xc6')]+=0x1;_0x5beeeb[_0x0535('0xbe')]=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0x3,_0x0535('0xc7'));rpcDb[_0x0535('0xa2')](_0x5beeeb,_0x0535('0xc8'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3[_0x0535('0xc1')]){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,_0x0535('0xa5'));rpcDb[_0x0535('0x97')](_0x433cb8,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x5beeeb['countnoanswerretry']>=_0xbcffc3[_0x0535('0xc9')]){rpcDb[_0x0535('0x97')](_0x5beeeb,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0x0535('0xa8')](ut[_0x0535('0xa9')](_0x5beeeb,_0x0535('0xc6'),_0xbcffc3['dialNoAnswerRetryFrequency']),_0x5beeeb[_0x0535('0xab')],_0x5beeeb[_0x0535('0xac')]);}}break;case _0x0535('0xca'):_0xbcffc3[_0x0535('0x3b')]+=0x1;_0x5beeeb['countcongestionretry']+=0x1;_0x5beeeb[_0x0535('0xbe')]=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0x8,'Congestion');rpcDb[_0x0535('0xa2')](_0x5beeeb,_0x0535('0xcb'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3[_0x0535('0xc1')]){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,'Global');rpcDb[_0x0535('0x97')](_0x433cb8,_0x0535('0xcc'));}else{if(_0x5beeeb[_0x0535('0xcd')]>=_0xbcffc3[_0x0535('0xce')]){rpcDb[_0x0535('0x97')](_0x5beeeb,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb['rescheduleContact'](ut[_0x0535('0xa9')](_0x5beeeb,_0x0535('0xcd'),_0xbcffc3[_0x0535('0xc4')]),_0x5beeeb[_0x0535('0xab')],_0x5beeeb[_0x0535('0xac')]);}}break;case'CANCEL':_0xbcffc3[_0x0535('0xcf')]+=0x1;_0x5beeeb[_0x0535('0xd0')]+=0x1;_0x5beeeb[_0x0535('0xbe')]=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0x14,_0x0535('0xd1'));rpcDb[_0x0535('0xa2')](_0x5beeeb,'[syncHangupRequest][logAgentReject]');if(_0x5beeeb['unlockAgent']){rpcDb[_0x0535('0xd2')](_0x5beeeb['idContact']);}if(_0x5beeeb[_0x0535('0xac')]){rpcDb[_0x0535('0xd3')](_0x5beeeb[_0x0535('0xd4')]);}break;case _0x0535('0xd5'):_0xbcffc3[_0x0535('0x43')]+=0x1;_0x5beeeb[_0x0535('0xd6')]+=0x1;_0x5beeeb['countglobal']=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0xb,'Abandoned');rpcDb[_0x0535('0xa2')](_0x5beeeb,_0x0535('0xd7'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3[_0x0535('0xc1')]){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,_0x0535('0xa5'));rpcDb[_0x0535('0x97')](_0x433cb8,_0x0535('0xd7'));}else{if(_0x5beeeb[_0x0535('0xd8')]>=_0xbcffc3[_0x0535('0xd9')]){rpcDb[_0x0535('0x97')](_0x5beeeb,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb['rescheduleContact'](ut[_0x0535('0xa9')](_0x5beeeb,_0x0535('0xd6'),_0xbcffc3[_0x0535('0xda')]),_0x5beeeb[_0x0535('0xab')],_0x5beeeb['activeContact']);}}break;default:if(_0x5beeeb[_0x0535('0x75')]){ut[_0x0535('0x7f')](_0xbcffc3,_0x0535('0xdb'));ut[_0x0535('0x80')](_0x0535('0xdc')+_0xbcffc3[_0x0535('0x54')],_0x2be94b);}_0xbcffc3[_0x0535('0x42')]+=0x1;_0x5beeeb['countglobal']=ut[_0x0535('0xa0')](_0x5beeeb);ut[_0x0535('0x90')](_0x5beeeb,0xc,_0x2be94b[_0x0535('0xdd')]||_0x2be94b[_0x0535('0xde')]);rpcDb['createCustomerHistory'](_0x5beeeb,_0x0535('0xdf'));if(ut[_0x0535('0xa0')](_0x5beeeb)>=_0xbcffc3[_0x0535('0xc1')]){_0x433cb8=ut[_0x0535('0xa4')](_0x5beeeb,0xf,'Global');rpcDb['createCustomerFinal'](_0x433cb8,_0x0535('0xe0'));}else{rpcDb[_0x0535('0x97')](_0x5beeeb,_0x0535('0xe0'));}delete this['actions'][_0x2be94b[_0x0535('0xad')]];}if(!(_0x5beeeb[_0x0535('0x75')]&&_0x20d31d==='16')){ut[_0x0535('0x7d')](_0xbcffc3,'[callProgressDetectingCustomer]');logger[_0x0535('0x5a')]('[originated][decrement][callProgressDetectingCustomer]',_0x5beeeb['uniqueid'],_0x0535('0xb1'),_0xbcffc3['name'],_0x0535('0x73'),_0xbcffc3[_0x0535('0x4e')]);}if(_0x20d31d!==_0x0535('0xe1')){delete this['actions'][_0x2be94b['linkedid']];delete this['actions'][_0x2be94b[_0x0535('0xe2')]];}}};Preview['prototype'][_0x0535('0xe3')]=function(_0x428076,_0x1e5aca,_0x1df8d2){if(_[_0x0535('0xe4')](_0x1e5aca)&&_0x0535('0xe5')!==typeof _0x1e5aca){return;}if(_['isUndefined'](_0x1df8d2)&&'object'!==typeof _0x1df8d2){return;}switch(_0x1df8d2[_0x0535('0xe6')]){case'0':ut['logAgent'](_0x428076,0x0,_0x0535('0xa1'));rpcDb[_0x0535('0xe7')](_0x428076,_0x0535('0xe8'));break;case'3':ut['logAgent'](_0x428076,0x3,'NoAnswer');rpcDb[_0x0535('0xe7')](_0x428076,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut['logAgent'](_0x428076,0x5,_0x0535('0xbf'));rpcDb[_0x0535('0xe7')](_0x428076,_0x0535('0xe9'));break;case'8':ut[_0x0535('0xea')](_0x428076,0x8,_0x0535('0xeb'));rpcDb['createAgentHistory'](_0x428076,_0x0535('0xec'));break;case'22':ut[_0x0535('0xea')](_0x428076,0x16,'AnswerAGI');rpcDb[_0x0535('0xe7')](_0x428076,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x0535('0xea')](_0x428076,0xc,_0x1df8d2[_0x0535('0xe6')]);rpcDb['createAgentHistory'](_0x428076,_0x0535('0xec'));}ut[_0x0535('0x7d')](_0x1e5aca,_0x0535('0xed'));logger[_0x0535('0x5a')]('[originated][decrement][callProgressDetectingAgent]',_0x428076['uniqueid'],_0x0535('0xb1'),_0x1e5aca['name'],_0x0535('0x73'),_0x1e5aca['originated']);delete this['actions'][_0x428076['uniqueid']];};Preview[_0x0535('0x6c')][_0x0535('0xee')]=function(_0xa0189a,_0x1e2683,_0x2cb386,_0x5e7603,_0x489127){var _0x431734=this;return new BPromise(function(_0x5ce8a3,_0x47d7c2){if(_[_0x0535('0x6f')](_0x1e2683)||_[_0x0535('0x6f')](_0x1e2683[_0x0535('0xef')])||_[_0x0535('0x6f')](_0x1e2683[_0x0535('0xef')]['phone'])||_[_0x0535('0x6f')](_0x1e2683['VoiceQueueId'])){_0x47d7c2(ut['message'](_0x0535('0xf0'),_0x5e7603,_0x489127));return;}var _0x311daf=uuid['v4']();var _0x21c1ac=_0x431734[_0x0535('0xf')][_0x1e2683['Queue']['name']];var _0x244fd3=_0x2cb386?_0x431734[_0x0535('0x12')][_0x2cb386]['id']:undefined;_0x431734[_0x0535('0x11')][_0x311daf]=new Action(_0x1e2683,_0x21c1ac,_0x311daf,_0x2cb386,_0x244fd3);var _0x17ed18=_0x431734[_0x0535('0x11')][_0x311daf];_0x17ed18[_0x0535('0xab')]=_0x5e7603;_0x17ed18[_0x0535('0xac')]=_0x489127;_0x17ed18[_0x0535('0xf1')]=_0x2cb386;if(_[_0x0535('0xf2')](_0xa0189a)){_0x431734['execCall'](_0x17ed18,_0x21c1ac,_0x1e2683,_0x2cb386)[_0x0535('0x86')](function(_0x41f95a){logger[_0x0535('0x5a')]('[Preview][execCall][success]',_0x0535('0xf3')+_0x17ed18[_0x0535('0x72')]+_0x0535('0xf4')+_0x17ed18['idContact'],JSON[_0x0535('0x58')](_0x41f95a));ami[_0x0535('0x23')](_0x0535('0xf5'),ut[_0x0535('0xb3')](_0x17ed18,'called'));_0x5ce8a3(ut[_0x0535('0x4d')]('Calling'));})[_0x0535('0x98')](function(_0x117a7a){ut[_0x0535('0x60')](_0x0535('0xf6'),_0x117a7a);_0x47d7c2(ut[_0x0535('0x4d')](_0x0535('0xf7'),_0x5e7603,_0x489127));});}else{_0x21c1ac['outboundBlacklistCallsDay']+=0x1;ut[_0x0535('0xf8')](_0x17ed18);rpcDb[_0x0535('0xf9')](_0x17ed18,_0x0535('0xfa'));delete _0x431734[_0x0535('0x11')][_0x311daf];_0x47d7c2(ut[_0x0535('0x4d')]('Contact\x20in\x20black\x20List',_0x5e7603,_0x489127));}});};Preview[_0x0535('0x6c')][_0x0535('0x9c')]=function(_0x5f3e0c){return!_[_0x0535('0x6f')](_0x5f3e0c)&&!_[_0x0535('0x6f')](_0x5f3e0c[_0x0535('0x54')])&&!_['isNil'](_0x5f3e0c[_0x0535('0x55')])&&_0x5f3e0c[_0x0535('0x55')]&&!_[_0x0535('0x6f')](this[_0x0535('0x10')][util[_0x0535('0xfb')](_0x0535('0xfc'),_0x5f3e0c[_0x0535('0x54')])])&&!_[_0x0535('0x6f')](this[_0x0535('0x10')][util[_0x0535('0xfb')](_0x0535('0xfc'),_0x5f3e0c[_0x0535('0x54')])][_0x0535('0x7a')])&&(this[_0x0535('0x10')][util['format']('SIP/%s',_0x5f3e0c[_0x0535('0x54')])]['status']==='reachable'||this[_0x0535('0x10')][util['format'](_0x0535('0xfc'),_0x5f3e0c[_0x0535('0x54')])][_0x0535('0x7a')]===_0x0535('0xfd'));};Preview[_0x0535('0x6c')]['run']=function(_0x7a01c6,_0x3e1660){var _0x4479d4=this;return new BPromise(function(_0x821cf5,_0x2a2d89){_0x4479d4[_0x0535('0xfe')](_0x7a01c6,_0x3e1660)[_0x0535('0x86')](function(_0x3f016b){_0x821cf5(_[_0x0535('0x76')](_0x3f016b,['message']));})[_0x0535('0x98')](function(_0x187fbf){if(_0x187fbf[_0x0535('0xff')]){rpcDb[_0x0535('0xd2')](_0x7a01c6);}if(_0x187fbf[_0x0535('0x55')]){rpcDb[_0x0535('0xd3')](_0x7a01c6);}_0x2a2d89(_[_0x0535('0x76')](_0x187fbf,[_0x0535('0x4d')]));});});};Preview['prototype'][_0x0535('0xfe')]=function(_0x417855,_0x32e7d5){var _0x5d3028=this;return new BPromise(function(_0x1cbfbb,_0x2b89d6){var _0x2ad13b,_0x372848;rpcDb['getContactPreview'](_0x417855)[_0x0535('0x86')](function(_0x17f38d){if(!_[_0x0535('0x6f')](_0x17f38d[0x0])){_0x372848=_0x17f38d[0x0][_0x0535('0x100')]?![]:!![];_0x2ad13b=_0x17f38d[0x0][_0x0535('0x100')]?!![]:![];_0x2ad13b=_0x32e7d5?!![]:_0x2ad13b;}var _0x55367e=_0x5d3028[_0x0535('0x101')](_0x17f38d);if(_0x55367e[_0x0535('0x102')]){rpcDb['checkIsBlackList'](_[_0x0535('0x76')](_0x17f38d[0x0],[_0x0535('0x103'),_0x0535('0x104')]))[_0x0535('0x86')](function(_0x54dec0){_0x5d3028[_0x0535('0xee')](_0x54dec0,_0x17f38d[0x0],_0x32e7d5,_0x372848,_0x2ad13b)[_0x0535('0x86')](function(_0x4b358b){_0x1cbfbb(_0x4b358b);})[_0x0535('0x98')](function(_0x4ebd6d){_0x2b89d6(_0x4ebd6d);});})[_0x0535('0x98')](function(_0x2b8f9a){ut[_0x0535('0x60')](_0x0535('0x105'),_0x2b8f9a);_0x2b89d6(ut[_0x0535('0x4d')](_0x0535('0x106'),_0x372848,_0x2ad13b));});}else{_0x2b89d6(ut[_0x0535('0x4d')](_0x55367e['message'],_0x372848,_0x2ad13b));}})[_0x0535('0x98')](function(_0x53c444){ut[_0x0535('0x60')](_0x0535('0x107'),_0x53c444);_0x2b89d6(ut[_0x0535('0x4d')](_0x0535('0x106'),![],!![]));});});};Preview[_0x0535('0x6c')][_0x0535('0x101')]=function(_0x524613){if(_['isNil'](_0x524613)||_[_0x0535('0xf2')](_0x524613)||!_[_0x0535('0x6f')](_0x524613[0x0][_0x0535('0x8b')])&&_['isNil'](_0x524613[0x0][_0x0535('0x8b')][_0x0535('0x54')])){ut[_0x0535('0x60')](_0x0535('0x108'),_0x524613);return{'isValid':![],'message':_0x0535('0x109')};}var _0x51ec70=this[_0x0535('0xf')][_0x524613[0x0][_0x0535('0x71')][_0x0535('0x54')]];_0x51ec70[_0x0535('0x4d')]=_0x0535('0x9f');if(_[_0x0535('0x6f')](_0x51ec70)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x51ec70);return{'isValid':![],'message':_0x0535('0x10a')};}if(!this[_0x0535('0x9c')](_0x51ec70[_0x0535('0x53')])){ut[_0x0535('0x60')](_0x0535('0x10b'),_0x0535('0x10c')+_0x51ec70[_0x0535('0x54')]+_0x0535('0x10d'));if(!this[_0x0535('0x9c')](_0x51ec70[_0x0535('0x9d')])){ut[_0x0535('0x60')](_0x0535('0x10b'),_0x51ec70['name']+_0x0535('0x10e'));return{'isValid':![],'message':'Trunk\x20not\x20work'};}}if(!ut['isActive'](_0x51ec70[_0x0535('0x33')])){ut[_0x0535('0x60')](_0x0535('0x10f'),_0x51ec70[_0x0535('0x54')]+_0x0535('0x110'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x51ec70[_0x0535('0x54')]+_0x0535('0x110')};}return{'isValid':!![],'message':_0x0535('0x111')};};Preview['prototype'][_0x0535('0x112')]=function(_0x5ce2dd,_0x3723cf,_0x5684b1,_0x3ced22){var _0x54363=this;return new BPromise(function(_0x3c4bdc,_0x153b76){var _0x6993a7=_0x5ce2dd[_0x0535('0xb0')];var _0x160e9e=_0x54363[_0x0535('0x9c')](_0x3723cf[_0x0535('0x53')])?util['format'](_0x0535('0x113'),_0x3723cf['Trunk'][_0x0535('0x54')],_[_0x0535('0x6f')](_0x3723cf[_0x0535('0x37')])?'':_0x3723cf[_0x0535('0x37')][_0x0535('0x114')]()||'',_0x3723cf['dialCutDigit']>0x0?_0x5684b1[_0x0535('0xef')][_0x0535('0x115')][_0x0535('0x116')](_0x3723cf['dialCutDigit']):_0x5684b1[_0x0535('0xef')]['phone']):util[_0x0535('0xfb')]('SIP/%s/%s%s',_[_0x0535('0x6f')](_0x3723cf[_0x0535('0x9d')])?_0x3723cf[_0x0535('0x53')][_0x0535('0x54')]:_0x3723cf['TrunkBackup'][_0x0535('0x54')],_[_0x0535('0x6f')](_0x3723cf[_0x0535('0x37')])?'':_0x3723cf[_0x0535('0x37')]['trim']()||'',_0x3723cf[_0x0535('0x117')]>0x0?_0x5684b1[_0x0535('0xef')]['phone'][_0x0535('0x116')](_0x3723cf[_0x0535('0x117')]):_0x5684b1[_0x0535('0xef')][_0x0535('0x115')]);var _0x588ace=_0x54363[_0x0535('0x9c')](_0x3723cf[_0x0535('0x53')])?ut[_0x0535('0x118')](_0x3723cf[_0x0535('0x53')][_0x0535('0x56')],_0x3723cf['dialOriginateCallerIdName'],_0x3723cf[_0x0535('0x119')]>0x0?ut[_0x0535('0x11a')](_0x3723cf['dialOriginateCallerIdNumber'],_0x3723cf[_0x0535('0x119')]):_0x3723cf[_0x0535('0x35')]):ut[_0x0535('0x118')](_[_0x0535('0x6f')](_0x3723cf[_0x0535('0x9d')])?_0x3723cf[_0x0535('0x53')][_0x0535('0x56')]:_0x3723cf['TrunkBackup'][_0x0535('0x56')],_0x3723cf[_0x0535('0x34')],_0x3723cf['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0x0535('0x11a')](_0x3723cf['dialOriginateCallerIdNumber'],_0x3723cf['dialRandomLastDigitCallerIdNumber']):_0x3723cf['dialOriginateCallerIdNumber']);if(_0x588ace){_0x5ce2dd[_0x0535('0x11b')]=ut[_0x0535('0x11c')](_0x588ace);_0x5ce2dd[_0x0535('0x11d')]=ut['extractCalleridNumber'](_0x588ace);}var _0x439c9b=ut[_0x0535('0x11e')](_0x3723cf,_0x5684b1,_0x160e9e,_0x588ace,_0x6993a7,_0x5ce2dd);_[_0x0535('0x11f')](_0x5ce2dd,ut[_0x0535('0x120')](_0x439c9b));_0x5ce2dd[_0x0535('0x8f')]=moment()[_0x0535('0xfb')](_0x0535('0xae'));ami['Action'](ut[_0x0535('0x121')](_0x5ce2dd,_0x3723cf,_0x439c9b,_0x5ce2dd['activeContact'],_0x3ced22))[_0x0535('0x86')](function(_0x4c08f9){_0x3723cf[_0x0535('0x4e')]+=0x1;logger[_0x0535('0x5a')](_0x0535('0x122'),_0x6993a7,_0x0535('0xb1'),_0x3723cf[_0x0535('0x54')],'originated:\x20',_0x3723cf[_0x0535('0x4e')]);_0x3c4bdc(_0x4c08f9);})['catch'](function(_0x49723c){ut['logAgent'](_0x5ce2dd,0xe,_0x0535('0x123'));rpcDb['createAgentHistory'](_0x5ce2dd,_0x0535('0x124'));_0x153b76(_0x49723c);});});};Preview['prototype']['syncNewExten']=function(_0x125484){if(this['actions'][_0x125484[_0x0535('0xad')]]){this[_0x0535('0x11')][_0x125484['linkedid']][_0x0535('0x7b')]=_0x125484[_0x0535('0x7b')];}};Preview[_0x0535('0x6c')]['syncOriginateResponse']=function(_0xf1f673){var _0x212c05=this;var _0x7a25d7=this['actions'][_0xf1f673['actionid']];if(_0x7a25d7){if(_0x7a25d7[_0x0535('0xf1')]&&this[_0x0535('0x12')][_0x7a25d7[_0x0535('0xf1')]]){ut['logLookAgent'](_0x7a25d7,this[_0x0535('0x12')][_0x7a25d7[_0x0535('0xf1')]][_0x0535('0x54')],this[_0x0535('0x12')][_0x7a25d7[_0x0535('0xf1')]]['id']);}var _0x1ce53d=_[_0x0535('0x125')](_0x7a25d7);_0x1ce53d['responsetime']=moment()[_0x0535('0xfb')](_0x0535('0xae'));var _0x3aeae6=_0x212c05[_0x0535('0xf')][_0x7a25d7[_0x0535('0x72')]];if(ut[_0x0535('0x126')](_0xf1f673['response'])){if(_0x7a25d7[_0x0535('0xab')]){rpcDb[_0x0535('0xd2')](_0x7a25d7[_0x0535('0xd4')]);}if(_0x7a25d7[_0x0535('0xac')]){rpcDb[_0x0535('0xd3')](_0x7a25d7['idContact']);}ami['emit'](_0x0535('0x127'),ut[_0x0535('0xb3')](_0x7a25d7,_0x0535('0x128')));this[_0x0535('0xe3')](_0x1ce53d,_0x3aeae6,_0xf1f673);}else{_0x7a25d7[_0x0535('0x8f')]=moment()[_0x0535('0xfb')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x0535('0xea')](_0x1ce53d,0x4,_0x0535('0x129'));rpcDb[_0x0535('0xe7')](_0x1ce53d,_0x0535('0x12a'));}}};Preview[_0x0535('0x6c')][_0x0535('0x16')]=function(_0x5ad2a6){var _0x461729=this;var _0x3d4083=this[_0x0535('0x11')][_0x5ad2a6[_0x0535('0xad')]];var _0x5950c9;if(_0x3d4083){_0x5950c9=this[_0x0535('0xf')][_0x3d4083[_0x0535('0x72')]];logger['info'](_0x0535('0x12b'),_0x5ad2a6[_0x0535('0xad')],_0x0535('0xb1'),_0x5950c9[_0x0535('0x54')],_0x0535('0x74'),_0x5950c9[_0x0535('0x2a')]);}if(this[_0x0535('0x11')][_0x5ad2a6[_0x0535('0xad')]]&&_0x5ad2a6['linkedid']!==_0x5ad2a6[_0x0535('0xb0')]){if(_0x5ad2a6[_0x0535('0x12c')]==='16'&&this[_0x0535('0x11')][_0x5ad2a6[_0x0535('0xad')]][_0x0535('0x75')]){this[_0x0535('0x12d')](_0x5ad2a6,_0x5ad2a6[_0x0535('0xad')],_0x5ad2a6[_0x0535('0x12c')]);}else if(this['actions'][_0x5ad2a6['linkedid']][_0x0535('0x75')]){logger[_0x0535('0x5a')](_0x0535('0x12e'),_0x5ad2a6[_0x0535('0xad')],_0x5ad2a6[_0x0535('0x12c')],'\x20Queue',_0x5950c9[_0x0535('0x54')],_0x0535('0x74'),_0x5950c9[_0x0535('0x2a')]);this['callProgressDetectingCustomer'](_0x5ad2a6,_0x5ad2a6[_0x0535('0xad')],_0x5ad2a6[_0x0535('0x12c')]);}}else if(_0x3d4083&&_[_0x0535('0x6f')](_0x3d4083[_0x0535('0x12f')])&&_0x5950c9[_0x0535('0x130')]&&_0x5ad2a6[_0x0535('0xad')]===_0x5ad2a6[_0x0535('0xb0')]&&_['isNil'](_0x5ad2a6[_0x0535('0xe6')])&&_0x5ad2a6[_0x0535('0x12c')]==='16'&&_0x5ad2a6[_0x0535('0x131')]==='6'&&_['isUndefined'](_0x3d4083[_0x0535('0x132')])){if(_0x3d4083[_0x0535('0xab')]){rpcDb['unlockContact'](_0x3d4083['idContact']);}if(_0x3d4083['activeContact']){rpcDb[_0x0535('0xd3')](_0x3d4083[_0x0535('0xd4')]);}_0x5ad2a6[_0x0535('0xe6')]='22';this[_0x0535('0xe3')](_0x3d4083,_0x5950c9,_0x5ad2a6);}else if(_0x3d4083&&_0x3d4083['transfer']){if(_0x5ad2a6[_0x0535('0x12c')]==='16'&&this[_0x0535('0x11')][_0x5ad2a6[_0x0535('0xad')]][_0x0535('0x75')]){logger['info']('[syncHangup][talking][transfer]',_0x5ad2a6[_0x0535('0xad')],_0x5ad2a6[_0x0535('0x12c')],_0x0535('0xb1'),_0x5950c9['name'],_0x0535('0x74'),_0x5950c9[_0x0535('0x2a')]);this[_0x0535('0x12d')](_0x5ad2a6,_0x5ad2a6[_0x0535('0xad')],_0x5ad2a6[_0x0535('0x12c')]);}else if(this[_0x0535('0x11')][_0x5ad2a6[_0x0535('0xad')]][_0x0535('0x75')]){logger[_0x0535('0x5a')](_0x0535('0x12e'),_0x5ad2a6['linkedid'],_0x5ad2a6[_0x0535('0x12c')],_0x0535('0xb1'),_0x5950c9[_0x0535('0x54')],_0x0535('0x74'),_0x5950c9[_0x0535('0x2a')]);this['callProgressDetectingCustomer'](_0x5ad2a6,_0x5ad2a6['linkedid'],_0x5ad2a6['cause']);}}};Preview[_0x0535('0x6c')][_0x0535('0x1a')]=function(_0x103e2a){if(this[_0x0535('0x11')][_0x103e2a[_0x0535('0xe2')]]&&_0x103e2a[_0x0535('0xe2')]!==_0x103e2a['destuniqueid']){this['callProgressDetectingCustomer'](_0x103e2a,_0x103e2a[_0x0535('0xe2')],_0x103e2a['dialstatus']);}};Preview['prototype'][_0x0535('0x18')]=function(_0xef2ae6){if(this['actions'][_0xef2ae6[_0x0535('0xad')]]&&_0xef2ae6[_0x0535('0xad')]!==_0xef2ae6[_0x0535('0xb0')]&&!this[_0x0535('0x11')][_0xef2ae6[_0x0535('0xad')]]['dialAnswer']){if(_0xef2ae6[_0x0535('0x12c')]==='1'){this[_0x0535('0x12d')](_0xef2ae6,_0xef2ae6[_0x0535('0xad')],_0xef2ae6[_0x0535('0x12c')]);}}};Preview[_0x0535('0x6c')][_0x0535('0x133')]=function(_0xa6ec26,_0x5c2ff5,_0x193ef2){if(this[_0x0535('0x11')][_0xa6ec26]){if(_['isNil'](this[_0x0535('0x11')][_0xa6ec26][_0x0535('0x134')])){this[_0x0535('0x11')][_0xa6ec26][_0x0535('0x134')]={};}this[_0x0535('0x11')][_0xa6ec26]['variables'][_0x5c2ff5]=_0x193ef2;}};Preview[_0x0535('0x6c')]['syncVarSet']=function(_0x10b650){try{if(!_[_0x0535('0x6f')](_0x10b650)){if(ut[_0x0535('0x135')](_['keys'](_0x10b650['variable'])[0x0])){this[_0x0535('0x133')](_0x10b650['uniqueid'],_[_0x0535('0x136')](_0x10b650[_0x0535('0x137')])[0x0],_0x10b650[_0x0535('0x138')]);}}}catch(_0x33008d){logger['error'](_0x0535('0x139'),util[_0x0535('0x13a')](_0x33008d,{'showHidden':![],'depth':null}));}};Preview[_0x0535('0x6c')][_0x0535('0x1f')]=function(_0xb6620f){if(_0xb6620f){if(this[_0x0535('0x11')][_0xb6620f[_0x0535('0x13b')]]){this[_0x0535('0x11')][_0xb6620f['transfertargetlinkedid']]['transfer']=!![];}}};Preview[_0x0535('0x6c')]['syncBlindTransfer']=function(_0x54fa9d){if(_0x54fa9d){if(this['actions'][_0x54fa9d['transfererlinkedid']]){this[_0x0535('0x11')][_0x54fa9d[_0x0535('0x13c')]][_0x0535('0x132')]=!![];}}};module[_0x0535('0x13d')]=Preview; \ No newline at end of file +var _0x3333=['[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','[default]','cause-txt','dialstatus','[callProgressDetectingCustomer][logUnknownGlobal]','updateOriginated','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','object','reason','logAgent','createAgentHistory','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent]','originated:\x20','Contact','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','idContact','custom:agentcalled','called','Calling','[Preview][execCall][failure]','Call\x20failed','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','unmonitored','execRun','pick','getContactPreview','recallme','validateContact','isValid','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','Trunk\x20not\x20work','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','phone','trim','getCallerId','dialRandomLastDigitCallerIdNumber','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','[originated][increment]','[originateFailure][logOriginateFailure]','logLookAgent','clone','isFailure','response','unlockContact','rejected','[callProgressDetectingAgent][logAnswer]','cause','[syncHangup][talking][cause]','statedesc','channelstate','isUndefined','transfer','[syncHangup][talking][transfer]','destuniqueid','syncHangupRequest','addVariable','variables','filterKey','keys','variable','value','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','bluebird','uuid','moment','md5','../../../config/environment','../../../config/logger','preview','actionPreview','./rpcDb','./action','./util/util','redis','defaults','localhost','prototype','enqueue','tail','finally','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','syncHangup','syncDialEnd','newexten','syncNewExten','syncVarSet','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','name','strategy','answered','available','loggedIn','pTalking','sumBillable','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalMultiplicativeFactor','message','erlangBusyFactor','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','originated','sendMessageOneNotActive','paused','[CampaignPreview]\x20Campaign\x20Queue:\x20','logger','\x20is\x20disactive','syncCampaigns','dialMethod','booked','type','outbound','hasOwnProperty','setMessage','recallMe','isNil','Queue','pTalking:\x20','queue','dialAnswer','VoiceQueueId','status','channel','catch','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][Preview]','clearZombieChannels','size','clearZombieChannel','getContactRecallMe','then','length','getDiff','Agent','voicePause','run','logger2','disableContact','starttime','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','createCustomerHistory','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','TrunkBackup','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','activeContact','linkedid','YYYY-MM-DD\x20HH:mm:ss','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','emit','custom:agentconnect','buildObj','acw','custom:agentConnectPreview','buildAcw','complete','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','[callProgressDetectingCustomer][logAnswerGlobal]','crateCustomerReportQueue','talktime','[syncHangup][talking][decrement]','BUSY','countbusyretry','[callProgressDetectingCustomer][logBusyGlobal]','[callProgressDetectingCustomer][logBusy]','scheduledAt','unlockAgent','countnoanswerretry','NoAnswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','[callProgressDetectingCustomer][logCongestion]','dialBusyRetryFrequency','CANCEL','outboundRejectCallsDay'];(function(_0x1eaa4a,_0x54e953){var _0x2c237a=function(_0x2ddaa3){while(--_0x2ddaa3){_0x1eaa4a['push'](_0x1eaa4a['shift']());}};_0x2c237a(++_0x54e953);}(_0x3333,0x70));var _0x3333=function(_0x3df223,_0x1740fc){_0x3df223=_0x3df223-0x0;var _0x562d11=_0x3333[_0x3df223];return _0x562d11;};'use strict';var util=require(_0x3333('0x0'));var _=require(_0x3333('0x1'));var BPromise=require(_0x3333('0x2'));var uuid=require(_0x3333('0x3'));var moment=require(_0x3333('0x4'));var md5=require(_0x3333('0x5'));var Redis=require('ioredis');var config=require(_0x3333('0x6'));var logger=require(_0x3333('0x7'))(_0x3333('0x8'));var loggerAction=require(_0x3333('0x7'))(_0x3333('0x9'));var ami=require('../ami');var rpcDb=require(_0x3333('0xa'));var Action=require(_0x3333('0xb'));var ut=require(_0x3333('0xc'));config[_0x3333('0xd')]=_[_0x3333('0xe')](config[_0x3333('0xd')],{'host':_0x3333('0xf'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Sequence=function(){};Sequence[_0x3333('0x10')][_0x3333('0x11')]=function(_0x45ba1d){this[_0x3333('0x12')]=this[_0x3333('0x12')]?this['tail'][_0x3333('0x13')](_0x45ba1d):_0x45ba1d();};function Preview(_0x3f273a){this['sequence']=new Sequence();this[_0x3333('0x14')]=_0x3f273a[_0x3333('0x15')];this[_0x3333('0x16')]=_0x3f273a['trunks'];this[_0x3333('0x17')]={};this[_0x3333('0x18')]=_0x3f273a['agents'];this[_0x3333('0x19')]=0x0;ami['on'](_0x3333('0x1a'),this['syncOriginateResponse'][_0x3333('0x1b')](this));ami['on'](_0x3333('0x1c'),this[_0x3333('0x1d')][_0x3333('0x1b')](this));ami['on']('hanguprequest',this['syncHangupRequest'][_0x3333('0x1b')](this));ami['on']('dialend',this[_0x3333('0x1e')][_0x3333('0x1b')](this));ami['on'](_0x3333('0x1f'),this[_0x3333('0x20')][_0x3333('0x1b')](this));ami['on']('varset',this[_0x3333('0x21')]['bind'](this));ami['on']('attendedtransfer',this[_0x3333('0x22')][_0x3333('0x1b')](this));ami['on']('blindtransfer',this[_0x3333('0x23')][_0x3333('0x1b')](this));this[_0x3333('0x24')](this['campaignsPreview']);}function emit(_0x2d87e5,_0x45b383,_0x4a0b0d){io['to'](_0x2d87e5)['emit'](_0x45b383,_0x4a0b0d);}function emitCampaignPreview(_0x34a44c){if(_0x34a44c['type']==='outbound'){var _0xad15b8={'id':_0x34a44c['id'],'name':_0x34a44c[_0x3333('0x25')],'strategy':_0x34a44c[_0x3333('0x26')],'answered':_0x34a44c[_0x3333('0x27')],'available':_0x34a44c[_0x3333('0x28')],'loggedIn':_0x34a44c[_0x3333('0x29')],'pTalking':_0x34a44c[_0x3333('0x2a')],'sumBillable':_0x34a44c[_0x3333('0x2b')],'sumDuration':_0x34a44c[_0x3333('0x2c')],'sumHoldTime':_0x34a44c[_0x3333('0x2d')]||0x0,'talking':_0x34a44c[_0x3333('0x2e')],'total':_0x34a44c[_0x3333('0x2f')],'type':_0x34a44c['type'],'unmanaged':_0x34a44c[_0x3333('0x30')],'abandoned':_0x34a44c[_0x3333('0x31')],'waiting':_0x34a44c[_0x3333('0x32')],'loggedInDb':_0x34a44c[_0x3333('0x33')],'dialActive':_0x34a44c[_0x3333('0x34')],'dialMethod':_0x34a44c['dialMethod'],'dialOriginateCallerIdName':_0x34a44c[_0x3333('0x35')],'dialOriginateCallerIdNumber':_0x34a44c[_0x3333('0x36')],'dialOriginateTimeout':_0x34a44c['dialOriginateTimeout'],'dialPrefix':_0x34a44c['dialPrefix'],'outboundAnswerAgiCallsDay':_0x34a44c[_0x3333('0x37')],'outboundAnswerCallsDay':_0x34a44c[_0x3333('0x38')],'outboundBlacklistCallsDay':_0x34a44c[_0x3333('0x39')],'outboundBusyCallsDay':_0x34a44c[_0x3333('0x3a')],'outboundCongestionCallsDay':_0x34a44c['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x34a44c[_0x3333('0x3b')],'outboundDropCallsDayCallersExit':_0x34a44c[_0x3333('0x3c')],'outboundDropCallsDayTimeout':_0x34a44c[_0x3333('0x3d')],'outboundNoAnswerCallsDay':_0x34a44c[_0x3333('0x3e')],'outboundNoSuchCallsDay':_0x34a44c[_0x3333('0x3f')],'outboundOriginateFailureCallsDay':_0x34a44c[_0x3333('0x40')],'outboundReCallsDay':_0x34a44c['outboundReCallsDay'],'outboundRejectCallsDay':_0x34a44c['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x34a44c[_0x3333('0x41')],'outboundAbandonedCallsDay':_0x34a44c[_0x3333('0x42')],'predictiveIntervalAnsweredCalls':_0x34a44c['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x34a44c[_0x3333('0x43')],'predictiveIntervalAvgTalktime':_0x34a44c[_0x3333('0x44')],'predictiveIntervalDroppedCallsCallersExit':_0x34a44c[_0x3333('0x45')],'predictiveIntervalDroppedCallsTimeout':_0x34a44c[_0x3333('0x46')],'predictiveIntervalErlangCalls':_0x34a44c[_0x3333('0x47')],'predictiveIntervalErlangCallsDroppedCalls':_0x34a44c['predictiveIntervalErlangCallsDroppedCalls'],'predictiveIntervalHitRate':_0x34a44c['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x34a44c[_0x3333('0x48')],'predictiveIntervalPauses':_0x34a44c['predictiveIntervalPauses'],'predictiveIntervalAvailable':_0x34a44c['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x34a44c['predictiveIntervalTotalCalls'],'message':_0x34a44c[_0x3333('0x49')],'originated':_0x34a44c['originated'],'erlangCalls':_0x34a44c['erlangCalls'],'erlangCallToSecond':_0x34a44c['erlangCallToSecond'],'erlangAbandonmentRate':_0x34a44c['erlangAbandonmentRate'],'erlangBusyFactor':_0x34a44c[_0x3333('0x4a')],'startPredictive':_0x34a44c['startPredictive'],'startProgressive':_0x34a44c[_0x3333('0x4b')]};if(_0x34a44c[_0x3333('0x4c')]){_0xad15b8[_0x3333('0x4c')]={'id':_0x34a44c[_0x3333('0x4c')]['id'],'name':_0x34a44c[_0x3333('0x4c')]['name'],'active':_0x34a44c[_0x3333('0x4c')][_0x3333('0x4d')],'callerid':_0x34a44c[_0x3333('0x4c')][_0x3333('0x4e')]};}if(_0x34a44c['Interval']){_0xad15b8[_0x3333('0x4f')]={'id':_0x34a44c[_0x3333('0x4f')]['id'],'name':_0x34a44c[_0x3333('0x4f')]['name']};}var _0x4b20ee=md5(JSON[_0x3333('0x50')](_0xad15b8));if(_0x34a44c[_0x3333('0x5')]!==_0x4b20ee){_0x34a44c['md5']=_0x4b20ee;emit(util[_0x3333('0x51')](_0x3333('0x52'),_0xad15b8[_0x3333('0x25')]),_0x3333('0x53'),_0xad15b8);}}}function emitVoiceQueueChannelRemove(_0x5180cb){logger[_0x3333('0x54')](_0x3333('0x55'),JSON[_0x3333('0x50')](_0x5180cb));emit(util['format'](_0x3333('0x52'),_0x5180cb['name']),_0x3333('0x56'),_0x5180cb);}function notSendMessagesQueue(_0xf65046){if(_0xf65046['sendMessageOneNotActive']){if(_0xf65046[_0x3333('0x57')]===0x0&&_0xf65046['pTalking']===0x0){_0xf65046[_0x3333('0x58')]=![];_0xf65046['available']=0x0;_0xf65046[_0x3333('0x59')]=0x0;_0xf65046[_0x3333('0x49')]='NOT_ACTIVE';ut['logger'](_0x3333('0x5a'),_0xf65046[_0x3333('0x25')]+'\x20is\x20not\x20active');}else{_0xf65046['message']='IS_DISACTIVED';ut[_0x3333('0x5b')](_0x3333('0x5a'),_0xf65046[_0x3333('0x25')]+_0x3333('0x5c'));}emitCampaignPreview(_0xf65046);}}Preview['prototype'][_0x3333('0x24')]=function(){var _0x1eaa34=this;setInterval(function(){_0x1eaa34[_0x3333('0x5d')]();},0x7cf);};Preview[_0x3333('0x10')][_0x3333('0x5d')]=function(){var _0x1c9ffc=this['campaignsPreview'];this[_0x3333('0x19')]+=0x1;for(var _0x3315d1 in _0x1c9ffc){if(_0x1c9ffc['hasOwnProperty'](_0x3315d1)&&(_0x1c9ffc[_0x3315d1][_0x3333('0x5e')]==='preview'||_0x1c9ffc[_0x3315d1][_0x3333('0x5e')]===_0x3333('0x5f'))&&_0x1c9ffc[_0x3315d1][_0x3333('0x60')]===_0x3333('0x61')){if(this[_0x3333('0x19')]>0x7){this[_0x3333('0x19')]=0x0;this['clearZombieChannels']();}}if(_0x1c9ffc[_0x3333('0x62')](_0x3315d1)&&_0x1c9ffc[_0x3315d1][_0x3333('0x5e')]===_0x3333('0x8')&&_0x1c9ffc[_0x3315d1]['type']==='outbound'){if(_0x1c9ffc[_0x3315d1]['dialActive']){this[_0x3333('0x63')](_0x1c9ffc[_0x3315d1]);this[_0x3333('0x64')](_0x1c9ffc[_0x3315d1]);}else{notSendMessagesQueue(_0x1c9ffc[_0x3315d1]);}}}};Preview[_0x3333('0x10')]['clearZombieChannel']=function(_0x3d7124){var _0x2f9061=this;this['sequence'][_0x3333('0x11')](function(){if(!_[_0x3333('0x65')](_0x2f9061[_0x3333('0x17')][_0x3d7124])){loggerAction[_0x3333('0x54')]('[clearZombieChannels][talking]',_0x3d7124,_0x3333('0x66'),_0x2f9061[_0x3333('0x17')][_0x3d7124]['queue'],'originated:\x20',JSON[_0x3333('0x50')](_0x2f9061[_0x3333('0x14')][_0x2f9061['actions'][_0x3d7124]['queue']]['originated']),_0x3333('0x67'),JSON[_0x3333('0x50')](_0x2f9061[_0x3333('0x14')][_0x2f9061[_0x3333('0x17')][_0x3d7124][_0x3333('0x68')]]['pTalking']),JSON[_0x3333('0x50')](_0x2f9061[_0x3333('0x17')][_0x3d7124][_0x3333('0x69')]),JSON[_0x3333('0x50')](_['pick'](_0x2f9061[_0x3333('0x17')][_0x3d7124],['contactId','UserId',_0x3333('0x6a'),'ListId'])));return ami['Action']({'action':_0x3333('0x6b'),'channel':_0x2f9061['actions'][_0x3d7124][_0x3333('0x6c')]})[_0x3333('0x6d')](function(_0x3e36f7){if(_0x3e36f7[_0x3333('0x49')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x2f9061[_0x3333('0x17')][_0x3d7124]){ut['updateOriginated'](_0x2f9061[_0x3333('0x14')][_0x2f9061[_0x3333('0x17')][_0x3d7124][_0x3333('0x68')]],_0x3333('0x6e'));if(_0x2f9061[_0x3333('0x17')][_0x3d7124][_0x3333('0x69')]===!![]){ut[_0x3333('0x6f')](_0x2f9061[_0x3333('0x14')][_0x2f9061['actions'][_0x3d7124][_0x3333('0x68')]],_0x3333('0x6e'));ut[_0x3333('0x70')]('[Dialer][checkChannel][pTalking][Preview]'+_0x3d7124,_0x2f9061[_0x3333('0x17')][_0x3d7124][_0x3333('0x68')]);}ut[_0x3333('0x70')](_0x3333('0x71')+_0x3d7124,_0x2f9061[_0x3333('0x17')][_0x3d7124]['queue']);delete _0x2f9061[_0x3333('0x17')][_0x3d7124];}},0x2328);}});}});};Preview[_0x3333('0x10')][_0x3333('0x72')]=function(){var _0x257a06=this;loggerAction['info']('[action]',_[_0x3333('0x73')](this['actions']));for(var _0x5ccad6 in this[_0x3333('0x17')]){if(_0x257a06[_0x3333('0x17')]['hasOwnProperty'](_0x5ccad6)){_0x257a06[_0x3333('0x74')](_0x5ccad6);}}};Preview['prototype']['recallMe']=function(_0x418902){var _0x3bd4da=this;rpcDb[_0x3333('0x75')](_0x418902['id'],ut['agentReadyId'](this[_0x3333('0x18')]))[_0x3333('0x76')](function(_0x5927c6){if(!_[_0x3333('0x65')](_0x5927c6)){for(var _0x5705c0=0x0;_0x5705c0<_0x5927c6[_0x3333('0x77')];_0x5705c0+=0x1){if(ut[_0x3333('0x78')](_0x5927c6[_0x5705c0]['scheduledat'])<_0x418902['dialRecallMeTimeout']*0x3c){if(_0x5927c6[_0x5705c0][_0x3333('0x79')]&&!_0x5927c6[_0x5705c0][_0x3333('0x79')][_0x3333('0x7a')]){_0x3bd4da[_0x3333('0x7b')](_0x5927c6[_0x5705c0]['id'])[_0x3333('0x76')](ut['logger2']('[RecallMe]'))[_0x3333('0x6d')](ut[_0x3333('0x7c')]('[RecallMe]'));}else{rpcDb[_0x3333('0x7d')](_0x5927c6[_0x5705c0]['id']);}}else{var _0x106649=new Action(_0x5927c6[_0x5705c0],_0x418902);_0x106649[_0x3333('0x7e')]=moment()[_0x3333('0x51')]('YYYY-MM-DD\x20HH:mm:ss');_0x418902[_0x3333('0x7f')]+=0x1;ut[_0x3333('0x80')](_0x106649,0x17,_0x3333('0x81'));if(_0x418902[_0x3333('0x82')]){rpcDb[_0x3333('0x83')](ut[_0x3333('0x84')](_0x5927c6[_0x5705c0]));rpcDb['createCustomerHistory'](_0x106649,_0x3333('0x85'));}else{ut[_0x3333('0x80')](_0x106649,0x16,_0x3333('0x86'));rpcDb[_0x3333('0x87')](_0x106649,_0x3333('0x88'));rpcDb[_0x3333('0x89')](_0x106649,_0x3333('0x88'));}}}}})[_0x3333('0x6d')](ut['logger2'](_0x3333('0x8a')));};Preview['prototype'][_0x3333('0x63')]=function(_0x19c4fa){_0x19c4fa[_0x3333('0x58')]=!![];if(ut['IsNotLoggedIn'](_0x19c4fa[_0x3333('0x29')])){_0x19c4fa[_0x3333('0x49')]=_0x3333('0x8b');}else if(!ut[_0x3333('0x8c')](_0x19c4fa[_0x3333('0x34')])){_0x19c4fa[_0x3333('0x49')]='NOT_ACTIVE';}else if(!this[_0x3333('0x8d')](_0x19c4fa['Trunk'])){if(!this['isTrunkReachable'](_0x19c4fa[_0x3333('0x8e')])){_0x19c4fa[_0x3333('0x49')]='TRUNK_IS_NOT_REACHABLE';}else{_0x19c4fa['message']=_0x3333('0x8f');}}else{_0x19c4fa[_0x3333('0x49')]=_0x3333('0x8f');}emitCampaignPreview(_0x19c4fa);};Preview[_0x3333('0x10')][_0x3333('0x90')]=function(_0x4830e1,_0x21a1c7,_0x57303d){var _0x128e5a=this;var _0x19bfdd=this[_0x3333('0x17')][_0x21a1c7];var _0x18bb84=this['campaignsPreview'][_0x19bfdd['queue']];var _0x2ff2d9;if(_0x18bb84){switch(_0x57303d){case'1':_0x18bb84[_0x3333('0x3f')]+=0x1;_0x19bfdd[_0x3333('0x91')]+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0x0,_0x3333('0x94'));rpcDb['createCustomerHistory'](_0x19bfdd,_0x3333('0x95'));if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84[_0x3333('0x96')]){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0xf,_0x3333('0x98'));rpcDb['createCustomerFinal'](_0x2ff2d9,_0x3333('0x99'));}else{if(_0x19bfdd[_0x3333('0x91')]>=_0x18bb84[_0x3333('0x9a')]){rpcDb[_0x3333('0x89')](_0x19bfdd,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{rpcDb[_0x3333('0x9b')](ut['scheduledAt'](_0x19bfdd,_0x3333('0x91'),_0x18bb84[_0x3333('0x9c')]),_0x19bfdd['unlockAgent'],_0x19bfdd[_0x3333('0x9d')]);}}delete this[_0x3333('0x17')][_0x4830e1[_0x3333('0x9e')]];break;case'ANSWER':var _0x411667=moment()[_0x3333('0x51')](_0x3333('0x9f'));_0x19bfdd[_0x3333('0xa0')]=_0x411667;_0x19bfdd[_0x3333('0xa1')]=_0x411667;_0x19bfdd[_0x3333('0x69')]=!![];_0x18bb84[_0x3333('0x2a')]+=0x1;logger[_0x3333('0x54')](_0x3333('0xa2'),_0x19bfdd[_0x3333('0xa3')],_0x3333('0xa4'),_0x18bb84[_0x3333('0x25')],_0x3333('0x67'),_0x18bb84[_0x3333('0x2a')]);ami[_0x3333('0xa5')](_0x3333('0xa6'),ut[_0x3333('0xa7')](_0x19bfdd,'connect'));if(_0x18bb84[_0x3333('0xa8')]){ami[_0x3333('0xa5')](_0x3333('0xa9'),ut[_0x3333('0xaa')](_0x19bfdd));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0x3333('0xa7')](_0x19bfdd,'complete'));emitVoiceQueueChannelRemove(ut[_0x3333('0xa7')](_0x19bfdd,_0x3333('0xab')));_0x18bb84[_0x3333('0x38')]+=0x1;_0x18bb84[_0x3333('0x2f')]+=0x1;_0x18bb84[_0x3333('0x27')]+=0x1;ut[_0x3333('0x6f')](_0x18bb84,_0x3333('0xac'));_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0x4,_0x3333('0xad'));rpcDb[_0x3333('0x87')](_0x19bfdd,_0x3333('0xae'));rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xaf'));rpcDb[_0x3333('0xb0')](_0x19bfdd);_0x18bb84[_0x3333('0x2c')]+=_0x19bfdd['talktime'];_0x18bb84['sumBillable']+=_0x19bfdd[_0x3333('0xb1')];logger['info'](_0x3333('0xb2'),_0x19bfdd['uniqueid'],_0x3333('0xa4'),_0x18bb84[_0x3333('0x25')],_0x3333('0x67'),_0x18bb84[_0x3333('0x2a')]);delete this[_0x3333('0x17')][_0x4830e1[_0x3333('0x9e')]];break;case _0x3333('0xb3'):_0x18bb84['outboundBusyCallsDay']+=0x1;_0x19bfdd[_0x3333('0xb4')]+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0x5,'Busy');rpcDb[_0x3333('0x87')](_0x19bfdd,'[callProgressDetectingCustomer][logBusy]');if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84[_0x3333('0x96')]){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0xf,_0x3333('0x98'));rpcDb[_0x3333('0x89')](_0x2ff2d9,_0x3333('0xb5'));}else{if(_0x19bfdd[_0x3333('0xb4')]>=_0x18bb84['dialBusyMaxRetry']){rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xb6'));}else{rpcDb[_0x3333('0x9b')](ut[_0x3333('0xb7')](_0x19bfdd,_0x3333('0xb4'),_0x18bb84['dialBusyRetryFrequency']),_0x19bfdd[_0x3333('0xb8')],_0x19bfdd[_0x3333('0x9d')]);}}break;case'NOANSWER':_0x18bb84[_0x3333('0x3e')]+=0x1;_0x19bfdd[_0x3333('0xb9')]+=0x1;_0x19bfdd[_0x3333('0x92')]=ut['totalGlobal'](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0x3,_0x3333('0xba'));rpcDb[_0x3333('0x87')](_0x19bfdd,_0x3333('0xbb'));if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84['dialGlobalMaxRetry']){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0xf,_0x3333('0x98'));rpcDb['createCustomerFinal'](_0x2ff2d9,_0x3333('0xbc'));}else{if(_0x19bfdd[_0x3333('0xb9')]>=_0x18bb84[_0x3333('0xbd')]){rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xbb'));}else{rpcDb[_0x3333('0x9b')](ut[_0x3333('0xb7')](_0x19bfdd,_0x3333('0xb9'),_0x18bb84['dialNoAnswerRetryFrequency']),_0x19bfdd[_0x3333('0xb8')],_0x19bfdd[_0x3333('0x9d')]);}}break;case _0x3333('0xbe'):_0x18bb84[_0x3333('0xbf')]+=0x1;_0x19bfdd[_0x3333('0xc0')]+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut['logCustomer'](_0x19bfdd,0x8,_0x3333('0xc1'));rpcDb[_0x3333('0x87')](_0x19bfdd,_0x3333('0xc2'));if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84[_0x3333('0x96')]){_0x2ff2d9=ut['cloneAction'](_0x19bfdd,0xf,_0x3333('0x98'));rpcDb[_0x3333('0x89')](_0x2ff2d9,'[callProgressDetectingCustomer][logCongestionGlobal]');}else{if(_0x19bfdd[_0x3333('0xc0')]>=_0x18bb84['dialCongestionMaxRetry']){rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xc2'));}else{rpcDb[_0x3333('0x9b')](ut[_0x3333('0xb7')](_0x19bfdd,_0x3333('0xc0'),_0x18bb84[_0x3333('0xc3')]),_0x19bfdd[_0x3333('0xb8')],_0x19bfdd['activeContact']);}}break;case _0x3333('0xc4'):_0x18bb84[_0x3333('0xc5')]+=0x1;_0x19bfdd['countagentrejectretry']+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0x14,'AgentReject');rpcDb[_0x3333('0x87')](_0x19bfdd,_0x3333('0xc6'));if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84['dialGlobalMaxRetry']){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0x14,_0x3333('0xc7'));rpcDb[_0x3333('0x89')](_0x2ff2d9,_0x3333('0xc8'));}else{if(_0x19bfdd[_0x3333('0xc9')]>=_0x18bb84[_0x3333('0xca')]){rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xc8'));}else{rpcDb[_0x3333('0x9b')](ut[_0x3333('0xb7')](_0x19bfdd,_0x3333('0xc9'),_0x18bb84[_0x3333('0xcb')]),_0x19bfdd['unlockAgent'],_0x19bfdd[_0x3333('0x9d')]);}}break;case _0x3333('0xcc'):_0x18bb84[_0x3333('0x42')]+=0x1;_0x19bfdd[_0x3333('0xcd')]+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut['logCustomer'](_0x19bfdd,0xb,_0x3333('0xce'));rpcDb[_0x3333('0x87')](_0x19bfdd,_0x3333('0xcf'));if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84[_0x3333('0x96')]){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0xf,_0x3333('0x98'));rpcDb[_0x3333('0x89')](_0x2ff2d9,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x19bfdd[_0x3333('0xd0')]>=_0x18bb84['dialAbandonedMaxRety']){rpcDb['createCustomerFinal'](_0x19bfdd,_0x3333('0xcf'));}else{rpcDb[_0x3333('0x9b')](ut[_0x3333('0xb7')](_0x19bfdd,'countabandonedretry',_0x18bb84[_0x3333('0xd1')]),_0x19bfdd['unlockAgent'],_0x19bfdd['activeContact']);}}break;default:if(_0x19bfdd['dialAnswer']){ut['decrementTalkink'](_0x18bb84,_0x3333('0xd2'));ut[_0x3333('0x70')]('[Dialer][decrementTalkink][no\x20Hangup][Preview]'+_0x18bb84[_0x3333('0x25')],_0x4830e1);}_0x18bb84['outboundUnknownCallsDay']+=0x1;_0x19bfdd[_0x3333('0x92')]=ut[_0x3333('0x93')](_0x19bfdd);ut[_0x3333('0x80')](_0x19bfdd,0xc,_0x4830e1[_0x3333('0xd3')]||_0x4830e1[_0x3333('0xd4')]);rpcDb[_0x3333('0x87')](_0x19bfdd,'[callProgressDetectingCustomer][logUnknown]');if(ut[_0x3333('0x93')](_0x19bfdd)>=_0x18bb84[_0x3333('0x96')]){_0x2ff2d9=ut[_0x3333('0x97')](_0x19bfdd,0xf,'Global');rpcDb[_0x3333('0x89')](_0x2ff2d9,_0x3333('0xd5'));}else{rpcDb[_0x3333('0x89')](_0x19bfdd,_0x3333('0xd5'));}delete this['actions'][_0x4830e1[_0x3333('0x9e')]];}if(!(_0x19bfdd[_0x3333('0x69')]&&_0x57303d==='16')){ut[_0x3333('0xd6')](_0x18bb84,_0x3333('0xd7'));logger['info'](_0x3333('0xd8'),_0x19bfdd[_0x3333('0xa3')],_0x3333('0xa4'),_0x18bb84['name'],'originated:\x20',_0x18bb84['originated']);}if(_0x57303d!=='ANSWER'){delete this[_0x3333('0x17')][_0x4830e1[_0x3333('0x9e')]];delete this[_0x3333('0x17')][_0x4830e1[_0x3333('0xd9')]];}}};Preview[_0x3333('0x10')][_0x3333('0xda')]=function(_0x2c7db6,_0x16c032,_0x1c04f4){if(_['isUndefined'](_0x16c032)&&_0x3333('0xdb')!==typeof _0x16c032){return;}if(_['isUndefined'](_0x1c04f4)&&_0x3333('0xdb')!==typeof _0x1c04f4){return;}switch(_0x1c04f4[_0x3333('0xdc')]){case'0':ut[_0x3333('0xdd')](_0x2c7db6,0x0,_0x3333('0x94'));rpcDb['createAgentHistory'](_0x2c7db6,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x3333('0xdd')](_0x2c7db6,0x3,'NoAnswer');rpcDb[_0x3333('0xde')](_0x2c7db6,'[callProgressDetectingAgent][logNoAnswer]');break;case'5':ut[_0x3333('0xdd')](_0x2c7db6,0x5,_0x3333('0xdf'));rpcDb['createAgentHistory'](_0x2c7db6,_0x3333('0xe0'));break;case'8':ut[_0x3333('0xdd')](_0x2c7db6,0x8,_0x3333('0xc1'));rpcDb[_0x3333('0xde')](_0x2c7db6,_0x3333('0xe1'));break;case'22':ut[_0x3333('0xdd')](_0x2c7db6,0x16,_0x3333('0xe2'));rpcDb[_0x3333('0xde')](_0x2c7db6,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut[_0x3333('0xdd')](_0x2c7db6,0xc,_0x1c04f4[_0x3333('0xdc')]);rpcDb[_0x3333('0xde')](_0x2c7db6,_0x3333('0xe1'));}ut[_0x3333('0xd6')](_0x16c032,_0x3333('0xe3'));logger[_0x3333('0x54')]('[originated][decrement][callProgressDetectingAgent]',_0x2c7db6['uniqueid'],_0x3333('0xa4'),_0x16c032['name'],_0x3333('0xe4'),_0x16c032[_0x3333('0x57')]);delete this[_0x3333('0x17')][_0x2c7db6[_0x3333('0xa3')]];};Preview[_0x3333('0x10')]['checkInBlack']=function(_0x55f32a,_0x5cb463,_0x29c99b,_0x58cb34,_0x20f984){var _0x594d65=this;return new BPromise(function(_0x5deaf8,_0x1de816){if(_[_0x3333('0x65')](_0x5cb463)||_[_0x3333('0x65')](_0x5cb463[_0x3333('0xe5')])||_['isNil'](_0x5cb463[_0x3333('0xe5')]['phone'])||_[_0x3333('0x65')](_0x5cb463[_0x3333('0x6a')])){_0x1de816(ut[_0x3333('0x49')](_0x3333('0xe6'),_0x58cb34,_0x20f984));return;}var _0xa93116=uuid['v4']();var _0x1f1795=_0x594d65[_0x3333('0x14')][_0x5cb463['Queue'][_0x3333('0x25')]];var _0x13993f=_0x29c99b?_0x594d65[_0x3333('0x18')][_0x29c99b]['id']:undefined;_0x594d65[_0x3333('0x17')][_0xa93116]=new Action(_0x5cb463,_0x1f1795,_0xa93116,_0x29c99b,_0x13993f);var _0x57d7a7=_0x594d65[_0x3333('0x17')][_0xa93116];_0x57d7a7[_0x3333('0xb8')]=_0x58cb34;_0x57d7a7[_0x3333('0x9d')]=_0x20f984;_0x57d7a7[_0x3333('0xe7')]=_0x29c99b;if(_[_0x3333('0xe8')](_0x55f32a)){_0x594d65[_0x3333('0xe9')](_0x57d7a7,_0x1f1795,_0x5cb463,_0x29c99b)[_0x3333('0x76')](function(_0x5cf418){logger[_0x3333('0x54')](_0x3333('0xea'),_0x3333('0xeb')+_0x57d7a7[_0x3333('0x68')]+_0x3333('0xec')+_0x57d7a7[_0x3333('0xed')],JSON[_0x3333('0x50')](_0x5cf418));ami[_0x3333('0xa5')](_0x3333('0xee'),ut[_0x3333('0xa7')](_0x57d7a7,_0x3333('0xef')));_0x5deaf8(ut['message'](_0x3333('0xf0')));})[_0x3333('0x6d')](function(_0xde1d6f){ut[_0x3333('0x5b')](_0x3333('0xf1'),_0xde1d6f);_0x1de816(ut[_0x3333('0x49')](_0x3333('0xf2'),_0x58cb34,_0x20f984));});}else{_0x1f1795[_0x3333('0x39')]+=0x1;ut['logBlacklist'](_0x57d7a7);rpcDb['createHistory'](_0x57d7a7,_0x3333('0xf3'));delete _0x594d65[_0x3333('0x17')][_0xa93116];_0x1de816(ut[_0x3333('0x49')](_0x3333('0xf4'),_0x58cb34,_0x20f984));}});};Preview['prototype'][_0x3333('0x8d')]=function(_0x52c9eb){return!_[_0x3333('0x65')](_0x52c9eb)&&!_['isNil'](_0x52c9eb['name'])&&!_[_0x3333('0x65')](_0x52c9eb[_0x3333('0x4d')])&&_0x52c9eb[_0x3333('0x4d')]&&!_[_0x3333('0x65')](this[_0x3333('0x16')][util[_0x3333('0x51')](_0x3333('0xf5'),_0x52c9eb[_0x3333('0x25')])])&&!_[_0x3333('0x65')](this['trunks'][util[_0x3333('0x51')](_0x3333('0xf5'),_0x52c9eb[_0x3333('0x25')])][_0x3333('0x6b')])&&(this['trunks'][util[_0x3333('0x51')](_0x3333('0xf5'),_0x52c9eb[_0x3333('0x25')])][_0x3333('0x6b')]===_0x3333('0xf6')||this[_0x3333('0x16')][util[_0x3333('0x51')]('SIP/%s',_0x52c9eb['name'])][_0x3333('0x6b')]===_0x3333('0xf7'));};Preview['prototype'][_0x3333('0x7b')]=function(_0x4cb179,_0x340694){var _0x4a72c8=this;return new BPromise(function(_0x8c7684,_0x54f102){_0x4a72c8[_0x3333('0xf8')](_0x4cb179,_0x340694)['then'](function(_0x294afc){_0x8c7684(_[_0x3333('0xf9')](_0x294afc,['message']));})[_0x3333('0x6d')](function(_0x285dd2){if(_0x285dd2['unlock']){rpcDb['unlockContact'](_0x4cb179);}if(_0x285dd2[_0x3333('0x4d')]){rpcDb[_0x3333('0x7d')](_0x4cb179);}_0x54f102(_[_0x3333('0xf9')](_0x285dd2,[_0x3333('0x49')]));});});};Preview['prototype'][_0x3333('0xf8')]=function(_0x15a66b,_0x9f0d45){var _0x1538f6=this;return new BPromise(function(_0x18e649,_0x45f955){var _0x28407c,_0x4026b4;rpcDb[_0x3333('0xfa')](_0x15a66b)['then'](function(_0x13bfd1){if(!_[_0x3333('0x65')](_0x13bfd1[0x0])){_0x4026b4=_0x13bfd1[0x0][_0x3333('0xfb')]?![]:!![];_0x28407c=_0x13bfd1[0x0][_0x3333('0xfb')]?!![]:![];_0x28407c=_0x9f0d45?!![]:_0x28407c;}var _0x27ad89=_0x1538f6[_0x3333('0xfc')](_0x13bfd1);if(_0x27ad89[_0x3333('0xfd')]){rpcDb['checkIsBlackList'](_['pick'](_0x13bfd1[0x0],[_0x3333('0x6a'),_0x3333('0xfe')]))[_0x3333('0x76')](function(_0x543dba){_0x1538f6['checkInBlack'](_0x543dba,_0x13bfd1[0x0],_0x9f0d45,_0x4026b4,_0x28407c)[_0x3333('0x76')](function(_0x53b313){_0x18e649(_0x53b313);})[_0x3333('0x6d')](function(_0x3f79f3){_0x45f955(_0x3f79f3);});})[_0x3333('0x6d')](function(_0x3ae64c){ut[_0x3333('0x5b')](_0x3333('0xff'),_0x3ae64c);_0x45f955(ut[_0x3333('0x49')](_0x3333('0x100'),_0x4026b4,_0x28407c));});}else{_0x45f955(ut[_0x3333('0x49')](_0x27ad89[_0x3333('0x49')],_0x4026b4,_0x28407c));}})[_0x3333('0x6d')](function(_0x3bc062){ut[_0x3333('0x5b')](_0x3333('0x101'),_0x3bc062);_0x45f955(ut[_0x3333('0x49')](_0x3333('0x100'),![],!![]));});});};Preview[_0x3333('0x10')][_0x3333('0xfc')]=function(_0x58305f){if(_[_0x3333('0x65')](_0x58305f)||_[_0x3333('0xe8')](_0x58305f)||!_[_0x3333('0x65')](_0x58305f[0x0][_0x3333('0x79')])&&_[_0x3333('0x65')](_0x58305f[0x0][_0x3333('0x79')][_0x3333('0x25')])){ut['logger'](_0x3333('0x102'),_0x58305f);return{'isValid':![],'message':_0x3333('0x103')};}var _0x451be8=this[_0x3333('0x14')][_0x58305f[0x0][_0x3333('0x66')]['name']];_0x451be8['message']=_0x3333('0x8f');if(_[_0x3333('0x65')](_0x451be8)){ut[_0x3333('0x5b')](_0x3333('0x104'),_0x451be8);return{'isValid':![],'message':_0x3333('0x105')};}if(!this[_0x3333('0x8d')](_0x451be8[_0x3333('0x4c')])){ut['logger'](_0x3333('0x106'),_0x3333('0x107')+_0x451be8[_0x3333('0x25')]+'\x20Trunk\x20is\x20not\x20active');if(!this[_0x3333('0x8d')](_0x451be8[_0x3333('0x8e')])){ut[_0x3333('0x5b')]('[Preview][validateContact][Trunk\x20not\x20work]',_0x451be8[_0x3333('0x25')]+_0x3333('0x108'));return{'isValid':![],'message':_0x3333('0x109')};}}if(!ut[_0x3333('0x8c')](_0x451be8[_0x3333('0x34')])){ut[_0x3333('0x5b')](_0x3333('0x10a'),_0x451be8[_0x3333('0x25')]+_0x3333('0x10b'));return{'isValid':![],'message':_0x3333('0x107')+_0x451be8[_0x3333('0x25')]+_0x3333('0x10b')};}return{'isValid':!![],'message':_0x3333('0x10c')};};Preview[_0x3333('0x10')][_0x3333('0xe9')]=function(_0x218c73,_0x307778,_0x5a5755,_0x518d94){var _0x54b983=this;return new BPromise(function(_0x5f9c57,_0x4240ca){var _0x862a26=_0x218c73[_0x3333('0xa3')];var _0x49d39b=_0x54b983[_0x3333('0x8d')](_0x307778[_0x3333('0x4c')])?util['format'](_0x3333('0x10d'),_0x307778[_0x3333('0x4c')]['name'],_['isNil'](_0x307778[_0x3333('0x10e')])?'':_0x307778[_0x3333('0x10e')]['trim']()||'',_0x307778[_0x3333('0x10f')]>0x0?_0x5a5755['Contact']['phone'][_0x3333('0x110')](_0x307778[_0x3333('0x10f')]):_0x5a5755[_0x3333('0xe5')][_0x3333('0x111')]):util[_0x3333('0x51')](_0x3333('0x10d'),_[_0x3333('0x65')](_0x307778[_0x3333('0x8e')])?_0x307778[_0x3333('0x4c')][_0x3333('0x25')]:_0x307778['TrunkBackup'][_0x3333('0x25')],_[_0x3333('0x65')](_0x307778[_0x3333('0x10e')])?'':_0x307778['dialPrefix'][_0x3333('0x112')]()||'',_0x307778['dialCutDigit']>0x0?_0x5a5755['Contact'][_0x3333('0x111')][_0x3333('0x110')](_0x307778[_0x3333('0x10f')]):_0x5a5755[_0x3333('0xe5')][_0x3333('0x111')]);var _0x183660=_0x54b983[_0x3333('0x8d')](_0x307778[_0x3333('0x4c')])?ut[_0x3333('0x113')](_0x307778[_0x3333('0x4c')]['callerid'],_0x307778[_0x3333('0x35')],_0x307778[_0x3333('0x114')]>0x0?ut['getCallerIdRandom'](_0x307778['dialOriginateCallerIdNumber'],_0x307778['dialRandomLastDigitCallerIdNumber']):_0x307778[_0x3333('0x36')]):ut[_0x3333('0x113')](_[_0x3333('0x65')](_0x307778[_0x3333('0x8e')])?_0x307778[_0x3333('0x4c')][_0x3333('0x4e')]:_0x307778[_0x3333('0x8e')]['callerid'],_0x307778[_0x3333('0x35')],_0x307778[_0x3333('0x114')]>0x0?ut['getCallerIdRandom'](_0x307778['dialOriginateCallerIdNumber'],_0x307778['dialRandomLastDigitCallerIdNumber']):_0x307778[_0x3333('0x36')]);if(_0x183660){_0x218c73['originatecalleridname']=ut['extractCalleridName'](_0x183660);_0x218c73[_0x3333('0x115')]=ut[_0x3333('0x116')](_0x183660);}var _0xd5cbd9=ut[_0x3333('0x117')](_0x307778,_0x5a5755,_0x49d39b,_0x183660,_0x862a26,_0x218c73);_[_0x3333('0x118')](_0x218c73,ut['toLowerVariables'](_0xd5cbd9));_0x218c73[_0x3333('0x7e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');ami[_0x3333('0x119')](ut['variablesAction'](_0x218c73,_0x307778,_0xd5cbd9,_0x218c73[_0x3333('0x9d')],_0x518d94))[_0x3333('0x76')](function(_0x53297b){_0x307778[_0x3333('0x57')]+=0x1;logger[_0x3333('0x54')](_0x3333('0x11a'),_0x862a26,_0x3333('0xa4'),_0x307778['name'],_0x3333('0xe4'),_0x307778[_0x3333('0x57')]);_0x5f9c57(_0x53297b);})[_0x3333('0x6d')](function(_0x1bdf6c){ut[_0x3333('0xdd')](_0x218c73,0xe,'OriginateError');rpcDb[_0x3333('0xde')](_0x218c73,_0x3333('0x11b'));_0x4240ca(_0x1bdf6c);});});};Preview['prototype'][_0x3333('0x20')]=function(_0x5f5c52){if(this['actions'][_0x5f5c52['linkedid']]){this[_0x3333('0x17')][_0x5f5c52[_0x3333('0x9e')]][_0x3333('0x6c')]=_0x5f5c52[_0x3333('0x6c')];}};Preview[_0x3333('0x10')]['syncOriginateResponse']=function(_0x510c62){var _0x260471=this;var _0x2c2ff2=this[_0x3333('0x17')][_0x510c62['actionid']];if(_0x2c2ff2){if(_0x2c2ff2[_0x3333('0xe7')]&&this[_0x3333('0x18')][_0x2c2ff2[_0x3333('0xe7')]]){ut[_0x3333('0x11c')](_0x2c2ff2,this[_0x3333('0x18')][_0x2c2ff2[_0x3333('0xe7')]][_0x3333('0x25')],this[_0x3333('0x18')][_0x2c2ff2['lookAgent']]['id']);}var _0x26bc48=_[_0x3333('0x11d')](_0x2c2ff2);_0x26bc48[_0x3333('0xa0')]=moment()['format'](_0x3333('0x9f'));var _0x143a56=_0x260471[_0x3333('0x14')][_0x2c2ff2['queue']];if(ut[_0x3333('0x11e')](_0x510c62[_0x3333('0x11f')])){if(_0x2c2ff2[_0x3333('0xb8')]){rpcDb[_0x3333('0x120')](_0x2c2ff2[_0x3333('0xed')]);}if(_0x2c2ff2[_0x3333('0x9d')]){rpcDb[_0x3333('0x7d')](_0x2c2ff2[_0x3333('0xed')]);}ami[_0x3333('0xa5')]('custom:agentringnoanswer',ut[_0x3333('0xa7')](_0x2c2ff2,_0x3333('0x121')));this['callProgressDetectingAgent'](_0x26bc48,_0x143a56,_0x510c62);}else{_0x2c2ff2[_0x3333('0x7e')]=moment()[_0x3333('0x51')](_0x3333('0x9f'));ut[_0x3333('0xdd')](_0x26bc48,0x4,_0x3333('0xad'));rpcDb[_0x3333('0xde')](_0x26bc48,_0x3333('0x122'));}}};Preview[_0x3333('0x10')][_0x3333('0x1d')]=function(_0x37e367){var _0x6477a6=this;var _0x122b0a=this['actions'][_0x37e367[_0x3333('0x9e')]];var _0x260dc0;if(_0x122b0a){_0x260dc0=this[_0x3333('0x14')][_0x122b0a[_0x3333('0x68')]];logger[_0x3333('0x54')]('[syncHangup][talking]',_0x37e367[_0x3333('0x9e')],_0x3333('0xa4'),_0x260dc0[_0x3333('0x25')],'pTalking:\x20',_0x260dc0[_0x3333('0x2a')]);}if(this[_0x3333('0x17')][_0x37e367['linkedid']]&&_0x37e367[_0x3333('0x9e')]!==_0x37e367[_0x3333('0xa3')]){if(_0x37e367[_0x3333('0x123')]==='16'&&this[_0x3333('0x17')][_0x37e367['linkedid']][_0x3333('0x69')]){this[_0x3333('0x90')](_0x37e367,_0x37e367['linkedid'],_0x37e367[_0x3333('0x123')]);}else if(this[_0x3333('0x17')][_0x37e367[_0x3333('0x9e')]][_0x3333('0x69')]){logger[_0x3333('0x54')](_0x3333('0x124'),_0x37e367['linkedid'],_0x37e367[_0x3333('0x123')],_0x3333('0xa4'),_0x260dc0['name'],_0x3333('0x67'),_0x260dc0[_0x3333('0x2a')]);this[_0x3333('0x90')](_0x37e367,_0x37e367[_0x3333('0x9e')],_0x37e367['cause']);}}else if(_0x122b0a&&_[_0x3333('0x65')](_0x122b0a[_0x3333('0x125')])&&_0x260dc0['dialQueueProject']&&_0x37e367[_0x3333('0x9e')]===_0x37e367[_0x3333('0xa3')]&&_[_0x3333('0x65')](_0x37e367[_0x3333('0xdc')])&&_0x37e367[_0x3333('0x123')]==='16'&&_0x37e367[_0x3333('0x126')]==='6'&&_[_0x3333('0x127')](_0x122b0a[_0x3333('0x128')])){if(_0x122b0a[_0x3333('0xb8')]){rpcDb[_0x3333('0x120')](_0x122b0a[_0x3333('0xed')]);}if(_0x122b0a['activeContact']){rpcDb[_0x3333('0x7d')](_0x122b0a[_0x3333('0xed')]);}_0x37e367[_0x3333('0xdc')]='22';this[_0x3333('0xda')](_0x122b0a,_0x260dc0,_0x37e367);}else if(_0x122b0a&&_0x122b0a[_0x3333('0x128')]){if(_0x37e367[_0x3333('0x123')]==='16'&&this[_0x3333('0x17')][_0x37e367[_0x3333('0x9e')]][_0x3333('0x69')]){logger['info'](_0x3333('0x129'),_0x37e367[_0x3333('0x9e')],_0x37e367[_0x3333('0x123')],_0x3333('0xa4'),_0x260dc0['name'],_0x3333('0x67'),_0x260dc0[_0x3333('0x2a')]);this[_0x3333('0x90')](_0x37e367,_0x37e367[_0x3333('0x9e')],_0x37e367[_0x3333('0x123')]);}else if(this[_0x3333('0x17')][_0x37e367[_0x3333('0x9e')]]['dialAnswer']){logger[_0x3333('0x54')](_0x3333('0x124'),_0x37e367['linkedid'],_0x37e367[_0x3333('0x123')],'\x20Queue',_0x260dc0['name'],_0x3333('0x67'),_0x260dc0[_0x3333('0x2a')]);this[_0x3333('0x90')](_0x37e367,_0x37e367[_0x3333('0x9e')],_0x37e367['cause']);}}};Preview[_0x3333('0x10')]['syncDialEnd']=function(_0x2bb14d){if(this[_0x3333('0x17')][_0x2bb14d[_0x3333('0xd9')]]&&_0x2bb14d[_0x3333('0xd9')]!==_0x2bb14d[_0x3333('0x12a')]){this['callProgressDetectingCustomer'](_0x2bb14d,_0x2bb14d[_0x3333('0xd9')],_0x2bb14d['dialstatus']);}};Preview[_0x3333('0x10')][_0x3333('0x12b')]=function(_0x4ac3ff){if(this[_0x3333('0x17')][_0x4ac3ff[_0x3333('0x9e')]]&&_0x4ac3ff[_0x3333('0x9e')]!==_0x4ac3ff[_0x3333('0xa3')]&&!this[_0x3333('0x17')][_0x4ac3ff[_0x3333('0x9e')]][_0x3333('0x69')]){if(_0x4ac3ff[_0x3333('0x123')]==='1'){this[_0x3333('0x90')](_0x4ac3ff,_0x4ac3ff['linkedid'],_0x4ac3ff[_0x3333('0x123')]);}}};Preview[_0x3333('0x10')][_0x3333('0x12c')]=function(_0x3172eb,_0x307354,_0x49bfe7){if(this['actions'][_0x3172eb]){if(_[_0x3333('0x65')](this[_0x3333('0x17')][_0x3172eb][_0x3333('0x12d')])){this[_0x3333('0x17')][_0x3172eb][_0x3333('0x12d')]={};}this['actions'][_0x3172eb][_0x3333('0x12d')][_0x307354]=_0x49bfe7;}};Preview[_0x3333('0x10')][_0x3333('0x21')]=function(_0xcea3a9){try{if(!_[_0x3333('0x65')](_0xcea3a9)){if(ut[_0x3333('0x12e')](_[_0x3333('0x12f')](_0xcea3a9[_0x3333('0x130')])[0x0])){this['addVariable'](_0xcea3a9[_0x3333('0xa3')],_[_0x3333('0x12f')](_0xcea3a9[_0x3333('0x130')])[0x0],_0xcea3a9[_0x3333('0x131')]);}}}catch(_0x22224e){logger['error'](_0x3333('0x132'),util[_0x3333('0x133')](_0x22224e,{'showHidden':![],'depth':null}));}};Preview[_0x3333('0x10')][_0x3333('0x22')]=function(_0x1b3745){if(_0x1b3745){if(this[_0x3333('0x17')][_0x1b3745[_0x3333('0x134')]]){this[_0x3333('0x17')][_0x1b3745[_0x3333('0x134')]]['transfer']=!![];}}};Preview[_0x3333('0x10')][_0x3333('0x23')]=function(_0x437f06){if(_0x437f06){if(this[_0x3333('0x17')][_0x437f06['transfererlinkedid']]){this[_0x3333('0x17')][_0x437f06[_0x3333('0x135')]][_0x3333('0x128')]=!![];}}};module['exports']=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 2337b16..daf80fb 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 _0xee14=['uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','membername','context','xcally-motion-preview','holdtime','assigned','queuecallerexitreason','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','inspect','resolve','then','createHistory','[createHistory]\x20','catch','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','[unlockContact]\x20','disableContact','unlockContact','[activeContact]\x20','type'];(function(_0x44a42d,_0x5f0e34){var _0x49b9be=function(_0x5ed354){while(--_0x5ed354){_0x44a42d['push'](_0x44a42d['shift']());}};_0x49b9be(++_0x5f0e34);}(_0xee14,0x13a));var _0x4ee1=function(_0x113024,_0x226cd3){_0x113024=_0x113024-0x0;var _0x338998=_0xee14[_0x113024];return _0x338998;};'use strict';var util=require('util');var BPromise=require('bluebird');var logger=require(_0x4ee1('0x0'))(_0x4ee1('0x1'));var _=require(_0x4ee1('0x2'));var cmHopper=require(_0x4ee1('0x3'));var cmHopperFinal=require(_0x4ee1('0x4'));var cmHopperHistory=require(_0x4ee1('0x5'));var cmHopperBlack=require(_0x4ee1('0x6'));var voiceQueueRt=require(_0x4ee1('0x7'));var agentReportPreview=require(_0x4ee1('0x8'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0xba6d36){return function(_0x573700){logger[_0x4ee1('0x9')](_0xba6d36,util[_0x4ee1('0xa')](_0x573700,{'showHidden':![],'depth':null}));};}function create(_0x187656){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperHistory[_0x4ee1('0xd')](_0x187656))['catch'](loggerCatch(_0x4ee1('0xe')));}function createAgent(_0x38be25){return BPromise['resolve']()[_0x4ee1('0xc')](agentReportPreview[_0x4ee1('0xd')](_0x38be25))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0xe')));}function moveContact(_0x5cbcb0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x10')](_0x5cbcb0,!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x11')));}exports[_0x4ee1('0x12')]=function(_0x5616d6){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopperBlack[_0x4ee1('0x12')](_0x5616d6))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x13')));};exports[_0x4ee1('0x14')]=function(_0x2ffb2d){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactPreview'](_0x2ffb2d))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x15')));};exports[_0x4ee1('0xd')]=function(_0x1b1e0e,_0x123c5e){create(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));moveContact(_0x1b1e0e)[_0x4ee1('0xf')](loggerCatch(_0x123c5e));};exports[_0x4ee1('0x16')]=function(_0x360056,_0x3a0967){createAgent(_0x360056)[_0x4ee1('0xf')](loggerCatch(_0x3a0967));};exports['createCustomerHistory']=function(_0x236215,_0x3db827){create(_0x236215)[_0x4ee1('0xf')](loggerCatch(_0x3db827));};exports[_0x4ee1('0x17')]=function(_0x43f9a2,_0x383ab0){moveContact(_0x43f9a2)['catch'](loggerCatch(_0x383ab0));};exports[_0x4ee1('0x18')]=function(_0x333e96,_0x46611a,_0x3f0d59){if(_0x46611a){_0x333e96[_0x4ee1('0x19')]=null;}if(_0x3f0d59){_0x333e96[_0x4ee1('0x1a')]=![];}return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x333e96))[_0x4ee1('0xf')](loggerCatch('[rescheduleContact]\x20'));};exports['countReScheduled']=function(_0x14110c){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1b')](_0x14110c))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1c')));};exports['unlockContact']=function(_0x5cc0b5){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['unlockContact']({'UserId':null},_0x5cc0b5,0x1))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x1d')));};exports[_0x4ee1('0x1e')]=function(_0x215949){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x1f')]({'active':![]},_0x215949,0x1))['catch'](loggerCatch(_0x4ee1('0x20')));};exports['crateCustomerReportQueue']=function(_0x4746c2){var _0x4ec408={};_0x4ec408[_0x4ee1('0x21')]=_0x4746c2[_0x4ee1('0x21')];_0x4ec408[_0x4ee1('0x22')]=_0x4746c2[_0x4ee1('0x22')];_0x4ec408[_0x4ee1('0x23')]=_0x4746c2['calleridnum'];_0x4ec408[_0x4ee1('0x24')]=_0x4746c2['calleridname'];_0x4ec408[_0x4ee1('0x25')]=_0x4746c2[_0x4ee1('0x25')];_0x4ec408[_0x4ee1('0x26')]=_0x4746c2[_0x4ee1('0x27')];_0x4ec408[_0x4ee1('0x28')]=_0x4746c2['answertime'];_0x4ec408[_0x4ee1('0x29')]=0x1;_0x4ec408[_0x4ee1('0x2a')]=_0x4746c2[_0x4ee1('0x2b')];_0x4ec408[_0x4ee1('0x2c')]=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x2e')]='from-sip';_0x4ec408['exten']=_0x4ee1('0x2f');_0x4ec408[_0x4ee1('0x30')]=0x0;_0x4ec408[_0x4ee1('0x31')]=0x1;_0x4ec408['lastAssignedTo']=_0x4746c2[_0x4ee1('0x2d')];_0x4ec408[_0x4ee1('0x32')]=_0x4ee1('0x33');return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](voiceQueueReport[_0x4ee1('0x34')](_0x4ec408))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x35')));};exports[_0x4ee1('0x36')]=function(_0x3cc595,_0x4445d0){return BPromise[_0x4ee1('0xb')]()[_0x4ee1('0xc')](cmHopper['getContactRecallMe'](_0x3cc595,_0x4445d0))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x37')));};exports[_0x4ee1('0x38')]=function(_0x50539f){return BPromise['resolve']()[_0x4ee1('0xc')](cmHopper[_0x4ee1('0x18')](_0x50539f,!![],!![]))[_0x4ee1('0xf')](loggerCatch(_0x4ee1('0x39')));}; \ No newline at end of file +var _0x5075=['exten','xcally-motion-preview','holdtime','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','error','resolve','then','[createHistory]\x20','catch','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createHistory','createAgentHistory','createCustomerFinal','rescheduleContact','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','disableContact','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','endtime','connectedlinename','membername','context','from-sip'];(function(_0x14016c,_0x5d7d8e){var _0x44a523=function(_0x2e4fca){while(--_0x2e4fca){_0x14016c['push'](_0x14016c['shift']());}};_0x44a523(++_0x5d7d8e);}(_0x5075,0x73));var _0x5507=function(_0x4d821c,_0x22bd0e){_0x4d821c=_0x4d821c-0x0;var _0x15dd5b=_0x5075[_0x4d821c];return _0x15dd5b;};'use strict';var util=require(_0x5507('0x0'));var BPromise=require(_0x5507('0x1'));var logger=require(_0x5507('0x2'))(_0x5507('0x3'));var _=require(_0x5507('0x4'));var cmHopper=require(_0x5507('0x5'));var cmHopperFinal=require(_0x5507('0x6'));var cmHopperHistory=require('../rpc/cmHopperHistory');var cmHopperBlack=require(_0x5507('0x7'));var voiceQueueRt=require(_0x5507('0x8'));var agentReportPreview=require(_0x5507('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x5b6d7f){return function(_0x2cd9ee){logger[_0x5507('0xa')](_0x5b6d7f,util['inspect'](_0x2cd9ee,{'showHidden':![],'depth':null}));};}function create(_0x42c232){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperHistory['createHistory'](_0x42c232))['catch'](loggerCatch(_0x5507('0xd')));}function createAgent(_0x441bdc){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](agentReportPreview['createHistory'](_0x441bdc))[_0x5507('0xe')](loggerCatch(_0x5507('0xd')));}function moveContact(_0x55520e){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper['moveContactManagedDialer'](_0x55520e,!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0xf')));}exports[_0x5507('0x10')]=function(_0x267f27){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopperBlack['checkIsBlackList'](_0x267f27))[_0x5507('0xe')](loggerCatch(_0x5507('0x11')));};exports[_0x5507('0x12')]=function(_0x46545d){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x12')](_0x46545d))[_0x5507('0xe')](loggerCatch(_0x5507('0x13')));};exports[_0x5507('0x14')]=function(_0x2ede34,_0x241932){create(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));moveContact(_0x2ede34)[_0x5507('0xe')](loggerCatch(_0x241932));};exports[_0x5507('0x15')]=function(_0x233b6a,_0x2260f7){createAgent(_0x233b6a)[_0x5507('0xe')](loggerCatch(_0x2260f7));};exports['createCustomerHistory']=function(_0x14dab0,_0x276a81){create(_0x14dab0)[_0x5507('0xe')](loggerCatch(_0x276a81));};exports[_0x5507('0x16')]=function(_0x54f473,_0x1dc53e){moveContact(_0x54f473)[_0x5507('0xe')](loggerCatch(_0x1dc53e));};exports[_0x5507('0x17')]=function(_0x3ca1f7,_0x68397c,_0x1be8b1){if(_0x68397c){_0x3ca1f7['UserId']=null;}if(_0x1be8b1){_0x3ca1f7[_0x5507('0x18')]=![];}return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x3ca1f7))[_0x5507('0xe')](loggerCatch(_0x5507('0x19')));};exports[_0x5507('0x1a')]=function(_0x10f149){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x1a')](_0x10f149))[_0x5507('0xe')](loggerCatch(_0x5507('0x1b')));};exports[_0x5507('0x1c')]=function(_0x1a2203){return BPromise['resolve']()[_0x5507('0xc')](cmHopper['unlockContact']({'UserId':null},_0x1a2203,0x1))[_0x5507('0xe')](loggerCatch('[unlockContact]\x20'));};exports[_0x5507('0x1d')]=function(_0x24668b){return BPromise['resolve']()['then'](cmHopper[_0x5507('0x1c')]({'active':![]},_0x24668b,0x1))[_0x5507('0xe')](loggerCatch('[activeContact]\x20'));};exports[_0x5507('0x1e')]=function(_0x24574b){var _0x85d383={};_0x85d383[_0x5507('0x1f')]=_0x24574b[_0x5507('0x1f')];_0x85d383[_0x5507('0x20')]=_0x24574b['uniqueid'];_0x85d383[_0x5507('0x21')]=_0x24574b[_0x5507('0x21')];_0x85d383[_0x5507('0x22')]=_0x24574b[_0x5507('0x22')];_0x85d383[_0x5507('0x23')]=_0x24574b['queue'];_0x85d383['queuecallerjoinAt']=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x25')]=_0x24574b[_0x5507('0x24')];_0x85d383[_0x5507('0x26')]=0x1;_0x85d383['queuecallercompleteAt']=_0x24574b[_0x5507('0x27')];_0x85d383[_0x5507('0x28')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x2a')]=_0x5507('0x2b');_0x85d383[_0x5507('0x2c')]=_0x5507('0x2d');_0x85d383[_0x5507('0x2e')]=0x0;_0x85d383['assigned']=0x1;_0x85d383[_0x5507('0x2f')]=_0x24574b[_0x5507('0x29')];_0x85d383[_0x5507('0x30')]='COMPLETED';return BPromise['resolve']()[_0x5507('0xc')](voiceQueueReport[_0x5507('0x31')](_0x85d383))[_0x5507('0xe')](loggerCatch(_0x5507('0x32')));};exports[_0x5507('0x33')]=function(_0x574fc6,_0x5cc72c){return BPromise[_0x5507('0xb')]()[_0x5507('0xc')](cmHopper[_0x5507('0x33')](_0x574fc6,_0x5cc72c))[_0x5507('0xe')](loggerCatch('[GetContactRecallMe]\x20'));};exports['rescheduleContactInQueue']=function(_0x23ea7c){return BPromise['resolve']()[_0x5507('0xc')](cmHopper[_0x5507('0x17')](_0x23ea7c,!![],!![]))[_0x5507('0xe')](loggerCatch(_0x5507('0x34')));}; \ 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 ff2d707..13de2ce 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 _0xf6b3=['getCallerIdRandom','\x5cw{0,','pow','replace','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','seconds','loggerCatch','inspect','logger','loggerError','error','logger2','info','message','getCallerId','string','isEmpty','format','\x22%s\x22\x20<%s>','isUndefined','\x22\x22\x20<>','isActive','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','monitor_format','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','isNil','tags','%s%s','XMD-','toUpper','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','Blacklist','starttime','responsetime','endtime','logLookAgent','membername','UserId','logCustomer','ringtime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','cloneAction','Global','scheduledAt','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','interface','queue','not_inuse','status','reachable','getDiff','diff','CampaignId','filterKey','idContact','type','campaigntype','dialAnswer','active','callback','callbackuniqueid','recallme','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-agiafter','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqos','bridgepeer','bridgepvtcallid'];(function(_0x174ef5,_0x256e8e){var _0x1cc379=function(_0x3eafcf){while(--_0x3eafcf){_0x174ef5['push'](_0x174ef5['shift']());}};_0x1cc379(++_0x256e8e);}(_0xf6b3,0x97));var _0x3f6b=function(_0x35615a,_0x316487){_0x35615a=_0x35615a-0x0;var _0x3d6e88=_0xf6b3[_0x35615a];return _0x3d6e88;};'use strict';var util=require(_0x3f6b('0x0'));var _=require('lodash');var moment=require(_0x3f6b('0x1'));var logger=require(_0x3f6b('0x2'))(_0x3f6b('0x3'));var ipAgi=process[_0x3f6b('0x4')][_0x3f6b('0x5')]||_0x3f6b('0x6');function getSeconds(_0x4be215,_0x38d26a){var _0x2c4c64=moment(_0x4be215)['milliseconds'](0x0);var _0xdfde01=moment(_0x38d26a)[_0x3f6b('0x7')](0x0);return _0x2c4c64['diff'](_0xdfde01,_0x3f6b('0x8'));}exports[_0x3f6b('0x9')]=function(_0x3499cf){return function(_0x18a383){logger['error'](_0x3499cf,util[_0x3f6b('0xa')](_0x18a383,{'showHidden':![],'depth':null}));};};exports[_0x3f6b('0xb')]=function(_0x18f0af,_0x41eca3){logger['info'](_0x18f0af,util[_0x3f6b('0xa')](_0x41eca3,{'showHidden':![],'depth':null}));};exports[_0x3f6b('0xc')]=function(_0x4072a9,_0x3c3958){logger[_0x3f6b('0xd')](_0x4072a9,util[_0x3f6b('0xa')](_0x3c3958,{'showHidden':![],'depth':null}));};exports[_0x3f6b('0xe')]=function(_0xd03ba9){return function(_0xdd7c7){logger[_0x3f6b('0xf')](_0xd03ba9,util[_0x3f6b('0xa')](_0xdd7c7,{'showHidden':![],'depth':null}));};};exports[_0x3f6b('0x10')]=function(_0x5b282a,_0x50767f,_0x52405a){return{'message':_0x5b282a,'unlock':_0x50767f,'active':_0x52405a};};exports[_0x3f6b('0x11')]=function(_0x4d0acd,_0x44504b,_0x1564a2){if(!_['isUndefined'](_0x1564a2)&&_0x3f6b('0x12')===typeof _0x1564a2&&!_[_0x3f6b('0x13')](_0x1564a2)){if(!_['isUndefined'](_0x44504b)&&_0x3f6b('0x12')===typeof _0x44504b&&!_[_0x3f6b('0x13')](_0x44504b)){return util[_0x3f6b('0x14')](_0x3f6b('0x15'),_0x44504b,_0x1564a2);}return util[_0x3f6b('0x14')](_0x3f6b('0x15'),_0x1564a2,_0x1564a2);}if(!_[_0x3f6b('0x16')](_0x4d0acd)&&'string'===typeof _0x4d0acd&&!_[_0x3f6b('0x13')](_0x4d0acd)){return _0x4d0acd;}return _0x3f6b('0x17');};exports[_0x3f6b('0x18')]=function(_0x1c33db){if(_['isNil'](_0x1c33db)){return![];}return _0x1c33db;};exports[_0x3f6b('0x19')]=function(_0x2559ee,_0x39d1c7,_0x520c52,_0xe9cbc9,_0x1bf9c9,_0x2f7055){var _0x5bba74={'XMD-QUEUE':_0x39d1c7[_0x3f6b('0x1a')]?_0x39d1c7[_0x3f6b('0x1a')][_0x3f6b('0x1b')]:'','XMD-CALLERID':_0xe9cbc9,'XMD-CALLERID-PREVIEW':_0x2f7055?util['format'](_0x3f6b('0x15'),_0x2f7055[_0x3f6b('0x1c')],_0x2f7055[_0x3f6b('0x1d')]):_0xe9cbc9,'XMD-DIALID':_0x1bf9c9,'XMD-CONTACTID':_0x39d1c7[_0x3f6b('0x1e')],'XMD-CDRTYPE':_0x3f6b('0x1f'),'CALLERID(all)':_0xe9cbc9,'XMD-VOICEQUEUEID':_0x39d1c7[_0x3f6b('0x20')],'XMD-DIALCHANNEL':_0x520c52,'XMD-DIALTIMEOUT':_0x2559ee[_0x3f6b('0x21')]||0x1e,'XMD-DIALOPTIONS':util['format'](_0x3f6b('0x22'),_0x2559ee[_0x3f6b('0x23')]?'g':'',_[_0x3f6b('0x13')](_0x2559ee['monitor_format'])?'':_0x3f6b('0x24')),'XMD-DIALURL':_0x2559ee[_0x3f6b('0x25')]||'','XMD-AGI':_0x2559ee[_0x3f6b('0x26')]?util[_0x3f6b('0x14')](_0x3f6b('0x27'),ipAgi,_0x2559ee[_0x3f6b('0x26')]):_0x3f6b('0x28'),'XMD-AGIAFTER':_0x2559ee[_0x3f6b('0x23')]?util['format'](_0x3f6b('0x27'),ipAgi,_0x2559ee[_0x3f6b('0x23')]):_0x3f6b('0x28'),'XMD-ORIGINATECALLERIDNUM':_0x2f7055?_0x2f7055[_0x3f6b('0x29')]:'','XMD-ORIGINATECALLERIDNAME':_0x2f7055?_0x2f7055[_0x3f6b('0x2a')]:'','XMD-DESTINATION':_0x3f6b('0x2b')};if(!_[_0x3f6b('0x13')](_0x2559ee[_0x3f6b('0x2c')])){_0x5bba74[util[_0x3f6b('0x14')]('%s',_0x3f6b('0x2d'))]=_0x2559ee['monitor_format'];_0x5bba74[util[_0x3f6b('0x14')]('%s',_0x3f6b('0x2e'))]=_0x1bf9c9;}if(_0x39d1c7&&_0x39d1c7[_0x3f6b('0x2f')]){for(var _0x3e96a5 in _0x39d1c7[_0x3f6b('0x2f')]){if(_0x39d1c7['Contact'][_0x3f6b('0x30')](_0x3e96a5)){if(!_[_0x3f6b('0x31')](_0x39d1c7['Contact'][_0x3e96a5])&&_0x3e96a5!=='id'&&_0x3e96a5!==_0x3f6b('0x32')&&_0x3e96a5!=='createdAt'&&_0x3e96a5!=='updatedAt'){_0x5bba74[util[_0x3f6b('0x14')](_0x3f6b('0x33'),_0x3f6b('0x34'),_[_0x3f6b('0x35')](_0x3e96a5))]=_0x39d1c7['Contact'][_0x3e96a5];}}}}return _0x5bba74;};exports['toLowerVariables']=function(_0x327889){var _0x4497dc={};for(var _0x30233b in _0x327889){if(_0x327889[_0x3f6b('0x30')](_0x30233b)){_0x4497dc[util['format']('%s',_[_0x3f6b('0x36')](_0x30233b))]=_0x327889[_0x30233b];}}return{'variables':_0x4497dc};};exports[_0x3f6b('0x37')]=function(_0x3f1944,_0x12e31e){if(!_[_0x3f6b('0x31')](_0x3f1944)){if(_0x3f1944[_0x3f6b('0x30')](_0x3f6b('0x38'))){if(_0x3f1944[_0x3f6b('0x38')]>0x0){_0x3f1944[_0x3f6b('0x38')]-=0x1;}else{logger[_0x3f6b('0xd')](_0x3f6b('0x39'),_0x12e31e);}}}else{logger[_0x3f6b('0xd')](_0x3f6b('0x3a'),_0x12e31e);}};exports[_0x3f6b('0x3b')]=function(_0x2dfd9d){var _0x1155e7=moment()[_0x3f6b('0x14')](_0x3f6b('0x3c'));_0x2dfd9d[_0x3f6b('0x3d')]=0xd;_0x2dfd9d[_0x3f6b('0x3e')]=_0x3f6b('0x3f');_0x2dfd9d[_0x3f6b('0x40')]=_0x1155e7;_0x2dfd9d[_0x3f6b('0x41')]=_0x1155e7;_0x2dfd9d[_0x3f6b('0x42')]=_0x1155e7;};exports['logAgent']=function(_0x4f5718,_0x435479,_0x52bb72){var _0x26d5b0=moment()[_0x3f6b('0x14')](_0x3f6b('0x3c'));_0x4f5718[_0x3f6b('0x3d')]=_0x435479;_0x4f5718['statedesc']=_0x52bb72;_0x4f5718[_0x3f6b('0x41')]=_0x26d5b0;_0x4f5718['ringtime']=getSeconds(_0x4f5718[_0x3f6b('0x41')],_0x4f5718[_0x3f6b('0x40')]);};exports[_0x3f6b('0x43')]=function(_0x479500,_0x1587b6,_0x4b60d0){_0x479500[_0x3f6b('0x44')]=_0x1587b6;_0x479500[_0x3f6b('0x45')]=_0x4b60d0;};exports[_0x3f6b('0x46')]=function(_0x32d978,_0x4c98b1,_0x235c28){var _0xaae061=moment()[_0x3f6b('0x14')](_0x3f6b('0x3c'));_0x32d978['state']=_0x4c98b1;_0x32d978[_0x3f6b('0x3e')]=_0x235c28;_0x32d978[_0x3f6b('0x41')]=_0x32d978[_0x3f6b('0x41')]?_0x32d978[_0x3f6b('0x41')]:_0xaae061;_0x32d978[_0x3f6b('0x42')]=_0x32d978[_0x3f6b('0x42')]?_0x32d978['endtime']:_0xaae061;_0x32d978[_0x3f6b('0x47')]=getSeconds(_0x32d978[_0x3f6b('0x41')]||0x0,_0x32d978[_0x3f6b('0x40')]||0x0);_0x32d978['talktime']=_0x32d978[_0x3f6b('0x48')]?getSeconds(_0x32d978[_0x3f6b('0x42')],_0x32d978['answertime']):0x0;};exports[_0x3f6b('0x49')]=function(_0x501d16){return _0x501d16===_0x3f6b('0x4a');};exports[_0x3f6b('0x4b')]=function(_0x4c24ba,_0x439a43,_0x264ac6,_0x423a10,_0x3354fd){var _0x48e7d1=_0x423a10?'RECALL':_0x4c24ba[_0x3f6b('0x1c')];_0x48e7d1=_0x3354fd?_0x3f6b('0x4c'):_0x48e7d1;return{'actionid':_0x4c24ba[_0x3f6b('0x4d')],'action':_0x3f6b('0x4e'),'channel':_0x4c24ba[_0x3f6b('0x4f')],'callerid':util['format']('\x22%s\x22\x20<%s>',_0x48e7d1,_0x4c24ba['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x3f6b('0x50'),'Priority':'1','variable':_0x264ac6,'timeout':(_0x439a43['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x4c24ba['uniqueid']};};exports[_0x3f6b('0x51')]=function(_0x8fea5e){return _0x8fea5e[_0x3f6b('0x52')]+_0x8fea5e[_0x3f6b('0x53')]+_0x8fea5e[_0x3f6b('0x54')];};exports[_0x3f6b('0x55')]=function(_0x45be4b){var _0x5a9b37=_['clone'](_0x45be4b);_0x5a9b37['state']=0xf;_0x5a9b37[_0x3f6b('0x3e')]=_0x3f6b('0x56');return _0x5a9b37;};exports[_0x3f6b('0x57')]=function(_0x175b36,_0x4d99b4,_0xa4fc0){var _0x110238={};_0x110238[_0x4d99b4]=_0x175b36[_0x4d99b4];_0x110238['active']=![];_0x110238[_0x3f6b('0x58')]=moment()[_0x3f6b('0x59')](_0xa4fc0,_0x3f6b('0x5a'))[_0x3f6b('0x14')](_0x3f6b('0x3c'));_0x110238[_0x3f6b('0x1e')]=_0x175b36[_0x3f6b('0x1e')];_0x110238[_0x3f6b('0x5b')]=_0x175b36[_0x3f6b('0x5b')];_0x110238['VoiceQueueId']=_0x175b36['VoiceQueueId']||undefined;return _0x110238;};exports[_0x3f6b('0x5c')]=function(_0x16a730,_0x566a22){if(!_[_0x3f6b('0x31')](_0x16a730)){if(_0x16a730[_0x3f6b('0x5d')]>0x0){_0x16a730['pTalking']-=0x1;}else{logger[_0x3f6b('0xd')](_0x566a22,_0x3f6b('0x5e'));}}else{logger[_0x3f6b('0xd')](_0x566a22,_0x3f6b('0x5f'));}};exports['IsNotLoggedIn']=function(_0x146225){if(_0x146225<=0x0){return!![];}return![];};exports[_0x3f6b('0x60')]=function(_0x31493b,_0xe88c6d){_0x31493b[_0x3f6b('0x61')]=_0xe88c6d;_0x31493b[_0x3f6b('0x1b')]=_0x31493b['queue'];_0x31493b[_0x3f6b('0x62')]=_0x31493b['channelAgent'];return _0x31493b;};exports['buildAcw']=function(_0xc5ac8e){var _0x8eaf0={};_0x8eaf0[_0x3f6b('0x63')]=_0xc5ac8e[_0x3f6b('0x63')];_0x8eaf0[_0x3f6b('0x62')]=_0xc5ac8e[_0x3f6b('0x4f')];_0x8eaf0['uniqueid']=_0xc5ac8e['uniqueid'];return _0x8eaf0;};exports['agentReadyId']=function(_0x4677db){var _0x17ef65=[];for(var _0x3fc199 in _0x4677db){if(_0x4677db[_0x3f6b('0x30')](_0x3fc199)){if(!_[_0x3f6b('0x31')](_0x4677db[_0x3fc199])&&_0x4677db[_0x3fc199][_0x3f6b('0x3d')]===_0x3f6b('0x64')&&_0x4677db[_0x3fc199][_0x3f6b('0x65')]===_0x3f6b('0x66')){_0x17ef65['push'](_0x4677db[_0x3fc199]['id']);}}}return _0x17ef65;};exports[_0x3f6b('0x67')]=function(_0xc82421){var _0x39a1d6=moment()[_0x3f6b('0x7')](0x0);var _0x44449c=moment(_0xc82421)['milliseconds'](0x0);return _0x39a1d6[_0x3f6b('0x68')](_0x44449c,_0x3f6b('0x8'));};exports['createBody']=function(_0x47ba32){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x47ba32[_0x3f6b('0x1e')],'ListId':_0x47ba32[_0x3f6b('0x5b')],'VoiceQueueId':_0x47ba32[_0x3f6b('0x20')]||undefined,'CampaignId':_0x47ba32[_0x3f6b('0x69')]||undefined};};exports[_0x3f6b('0x6a')]=function(_0x24c80c){if(_0x24c80c===_0x3f6b('0x4d')||_0x24c80c===_0x3f6b('0x6b')||_0x24c80c===_0x3f6b('0x63')||_0x24c80c===_0x3f6b('0x6c')||_0x24c80c===_0x3f6b('0x6d')||_0x24c80c===_0x3f6b('0x6e')||_0x24c80c===_0x3f6b('0x44')||_0x24c80c==='channelAgent'||_0x24c80c===_0x3f6b('0x1c')||_0x24c80c===_0x3f6b('0x6f')||_0x24c80c===_0x3f6b('0x1d')||_0x24c80c===_0x3f6b('0x58')||_0x24c80c===_0x3f6b('0x52')||_0x24c80c===_0x3f6b('0x53')||_0x24c80c===_0x3f6b('0x54')||_0x24c80c==='countglobal'||_0x24c80c===_0x3f6b('0x70')||_0x24c80c===_0x3f6b('0x71')||_0x24c80c==='callbackat'||_0x24c80c===_0x3f6b('0x72')||_0x24c80c==='ContactId'||_0x24c80c==='ListId'||_0x24c80c===_0x3f6b('0x45')||_0x24c80c===_0x3f6b('0x20')||_0x24c80c===_0x3f6b('0x73')||_0x24c80c===_0x3f6b('0x74')||_0x24c80c===_0x3f6b('0x75')||_0x24c80c===_0x3f6b('0x76')||_0x24c80c===_0x3f6b('0x77')||_0x24c80c===_0x3f6b('0x78')||_0x24c80c==='xmd-dialtimeout'||_0x24c80c===_0x3f6b('0x79')||_0x24c80c===_0x3f6b('0x7a')||_0x24c80c===_0x3f6b('0x7b')||_0x24c80c===_0x3f6b('0x7c')||_0x24c80c==='xmd-cdrtype'||_0x24c80c==='xmd-callerid'||_0x24c80c===_0x3f6b('0x7d')||_0x24c80c==='xmd-agi'||_0x24c80c==='rtpaudioqos'||_0x24c80c===_0x3f6b('0x7e')||_0x24c80c===_0x3f6b('0x7f')||_0x24c80c===_0x3f6b('0x80')||_0x24c80c===_0x3f6b('0x81')||_0x24c80c===_0x3f6b('0x82')||_0x24c80c===_0x3f6b('0x83')||_0x24c80c==='rtpaudioqosrttbridged'||_0x24c80c===_0x3f6b('0x84')||_0x24c80c===_0x3f6b('0x7e')||_0x24c80c===_0x3f6b('0x7f')||_0x24c80c===_0x3f6b('0x80')||_0x24c80c===_0x3f6b('0x81')||_0x24c80c===_0x3f6b('0x82')||_0x24c80c===_0x3f6b('0x83')||_0x24c80c==='rtpaudioqosrttbridged'||_0x24c80c===_0x3f6b('0x85')||_0x24c80c===_0x3f6b('0x86')||_0x24c80c===_0x3f6b('0x3d')||_0x24c80c==='statedesc'){return![];}return!![];};exports[_0x3f6b('0x87')]=function(_0x5697d1,_0x43d910){var _0x1858e3,_0x4a5412,_0x51c0e3;if(_0x43d910<=0x0){_0x43d910=0x1;}_0x1858e3=new RegExp(_0x3f6b('0x88')+_0x43d910+'}$');_0x4a5412=Math['pow'](0xa,_0x43d910-0x1);_0x51c0e3=Math[_0x3f6b('0x89')](0xa,_0x43d910)-0x1;return util[_0x3f6b('0x14')]('%s',_[_0x3f6b('0x8a')](_0x5697d1,_0x1858e3,_[_0x3f6b('0x8b')](_0x4a5412,_0x51c0e3)));};exports[_0x3f6b('0x8c')]=function(_0xbd4b5d){var _0x148aa5=_0xbd4b5d[_0x3f6b('0x8d')](/"(.*?)"/);return _0x148aa5?_0x148aa5[0x1]:_0xbd4b5d;};exports[_0x3f6b('0x8e')]=function(_0x414181){var _0x5d1e8e=_0x414181['match'](/<(.*?)>/);return _0x5d1e8e?_0x5d1e8e[0x1]:_0x414181;}; \ No newline at end of file +var _0xa906=['error','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','Blacklist','starttime','responsetime','logAgent','statedesc','ringtime','logLookAgent','membername','logCustomer','endtime','talktime','answertime','isFailure','Failure','variablesAction','BOOKED','uniqueid','originate','channelAgent','xcally-motion-preview','from-sip','timeout','totalGlobal','countnoanswerretry','cloneAction','clone','Global','active','scheduledat','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','CampaignId','filterKey','idContact','campaigntype','dialAnswer','countbusyretry','countcongestionretry','countglobal','callback','callbackuniqueid','callbackat','recallme','UserId','xmd-queue','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosjitter','rtpaudioqosrtt','getCallerIdRandom','\x5cw{0,','pow','replace','random','match','extractCalleridNumber','util','moment','env','XCALLY_IP_AGI','milliseconds','diff','inspect','info','loggerError','logger2','getCallerId','isUndefined','string','isEmpty','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isNil','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_FORMAT','Contact','hasOwnProperty','tags','createdAt','%s%s','XMD-','toUpper','toLowerVariables','updateOriginated','originated'];(function(_0x1886d0,_0x36d4b4){var _0x152689=function(_0x4515e4){while(--_0x4515e4){_0x1886d0['push'](_0x1886d0['shift']());}};_0x152689(++_0x36d4b4);}(_0xa906,0x1e3));var _0x6a90=function(_0x131143,_0x159b9f){_0x131143=_0x131143-0x0;var _0xf3e318=_0xa906[_0x131143];return _0xf3e318;};'use strict';var util=require(_0x6a90('0x0'));var _=require('lodash');var moment=require(_0x6a90('0x1'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x6a90('0x2')][_0x6a90('0x3')]||'127.0.0.1';function getSeconds(_0x5f307e,_0x442d26){var _0x3980ce=moment(_0x5f307e)['milliseconds'](0x0);var _0x88b473=moment(_0x442d26)[_0x6a90('0x4')](0x0);return _0x3980ce[_0x6a90('0x5')](_0x88b473,'seconds');}exports['loggerCatch']=function(_0x427a66){return function(_0x58c66d){logger['error'](_0x427a66,util[_0x6a90('0x6')](_0x58c66d,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x56c925,_0x935444){logger[_0x6a90('0x7')](_0x56c925,util[_0x6a90('0x6')](_0x935444,{'showHidden':![],'depth':null}));};exports[_0x6a90('0x8')]=function(_0x224c8c,_0x22b322){logger['error'](_0x224c8c,util[_0x6a90('0x6')](_0x22b322,{'showHidden':![],'depth':null}));};exports[_0x6a90('0x9')]=function(_0x4ddfdb){return function(_0x3ac580){logger[_0x6a90('0x7')](_0x4ddfdb,util[_0x6a90('0x6')](_0x3ac580,{'showHidden':![],'depth':null}));};};exports['message']=function(_0x3c0862,_0x328b57,_0x39aec7){return{'message':_0x3c0862,'unlock':_0x328b57,'active':_0x39aec7};};exports[_0x6a90('0xa')]=function(_0x16cf2b,_0x3234ff,_0x1d5d77){if(!_[_0x6a90('0xb')](_0x1d5d77)&&_0x6a90('0xc')===typeof _0x1d5d77&&!_['isEmpty'](_0x1d5d77)){if(!_[_0x6a90('0xb')](_0x3234ff)&&_0x6a90('0xc')===typeof _0x3234ff&&!_[_0x6a90('0xd')](_0x3234ff)){return util[_0x6a90('0xe')](_0x6a90('0xf'),_0x3234ff,_0x1d5d77);}return util[_0x6a90('0xe')](_0x6a90('0xf'),_0x1d5d77,_0x1d5d77);}if(!_[_0x6a90('0xb')](_0x16cf2b)&&'string'===typeof _0x16cf2b&&!_['isEmpty'](_0x16cf2b)){return _0x16cf2b;}return _0x6a90('0x10');};exports['isActive']=function(_0x1ca66e){if(_[_0x6a90('0x11')](_0x1ca66e)){return![];}return _0x1ca66e;};exports['addVariables']=function(_0x3869ba,_0x7d4423,_0x5f1b2b,_0x3afcb9,_0x27b489,_0x1948aa){var _0x32697f={'XMD-QUEUE':_0x7d4423[_0x6a90('0x12')]?_0x7d4423[_0x6a90('0x12')][_0x6a90('0x13')]:'','XMD-CALLERID':_0x3afcb9,'XMD-CALLERID-PREVIEW':_0x1948aa?util[_0x6a90('0xe')](_0x6a90('0xf'),_0x1948aa[_0x6a90('0x14')],_0x1948aa[_0x6a90('0x15')]):_0x3afcb9,'XMD-DIALID':_0x27b489,'XMD-CONTACTID':_0x7d4423[_0x6a90('0x16')],'XMD-CDRTYPE':_0x6a90('0x17'),'CALLERID(all)':_0x3afcb9,'XMD-VOICEQUEUEID':_0x7d4423[_0x6a90('0x18')],'XMD-DIALCHANNEL':_0x5f1b2b,'XMD-DIALTIMEOUT':_0x3869ba[_0x6a90('0x19')]||0x1e,'XMD-DIALOPTIONS':util[_0x6a90('0xe')](_0x6a90('0x1a'),_0x3869ba[_0x6a90('0x1b')]?'g':'',_['isEmpty'](_0x3869ba[_0x6a90('0x1c')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x3869ba['dialPreviewUrl']||'','XMD-AGI':_0x3869ba[_0x6a90('0x1d')]?util[_0x6a90('0xe')](_0x6a90('0x1e'),ipAgi,_0x3869ba['dialQueueProject']):_0x6a90('0x1f'),'XMD-AGIAFTER':_0x3869ba[_0x6a90('0x1b')]?util[_0x6a90('0xe')]('\x22agi://%s/square,%s\x22',ipAgi,_0x3869ba['dialQueueProject2']):_0x6a90('0x1f'),'XMD-ORIGINATECALLERIDNUM':_0x1948aa?_0x1948aa[_0x6a90('0x20')]:'','XMD-ORIGINATECALLERIDNAME':_0x1948aa?_0x1948aa[_0x6a90('0x21')]:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_[_0x6a90('0xd')](_0x3869ba[_0x6a90('0x1c')])){_0x32697f[util[_0x6a90('0xe')]('%s',_0x6a90('0x22'))]=_0x3869ba[_0x6a90('0x1c')];_0x32697f[util['format']('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x27b489;}if(_0x7d4423&&_0x7d4423[_0x6a90('0x23')]){for(var _0x73fa59 in _0x7d4423[_0x6a90('0x23')]){if(_0x7d4423[_0x6a90('0x23')][_0x6a90('0x24')](_0x73fa59)){if(!_['isNil'](_0x7d4423[_0x6a90('0x23')][_0x73fa59])&&_0x73fa59!=='id'&&_0x73fa59!==_0x6a90('0x25')&&_0x73fa59!==_0x6a90('0x26')&&_0x73fa59!=='updatedAt'){_0x32697f[util[_0x6a90('0xe')](_0x6a90('0x27'),_0x6a90('0x28'),_[_0x6a90('0x29')](_0x73fa59))]=_0x7d4423[_0x6a90('0x23')][_0x73fa59];}}}}return _0x32697f;};exports[_0x6a90('0x2a')]=function(_0x13e004){var _0x57b862={};for(var _0x108d7b in _0x13e004){if(_0x13e004[_0x6a90('0x24')](_0x108d7b)){_0x57b862[util['format']('%s',_['toLower'](_0x108d7b))]=_0x13e004[_0x108d7b];}}return{'variables':_0x57b862};};exports[_0x6a90('0x2b')]=function(_0x5b53f2,_0x5786b5){if(!_['isNil'](_0x5b53f2)){if(_0x5b53f2[_0x6a90('0x24')](_0x6a90('0x2c'))){if(_0x5b53f2['originated']>0x0){_0x5b53f2['originated']-=0x1;}else{logger[_0x6a90('0x2d')](_0x6a90('0x2e'),_0x5786b5);}}}else{logger[_0x6a90('0x2d')](_0x6a90('0x2f'),_0x5786b5);}};exports['logBlacklist']=function(_0x29b253){var _0xfea545=moment()[_0x6a90('0xe')](_0x6a90('0x30'));_0x29b253[_0x6a90('0x31')]=0xd;_0x29b253['statedesc']=_0x6a90('0x32');_0x29b253[_0x6a90('0x33')]=_0xfea545;_0x29b253[_0x6a90('0x34')]=_0xfea545;_0x29b253['endtime']=_0xfea545;};exports[_0x6a90('0x35')]=function(_0x3b2889,_0x4bbcad,_0x360949){var _0x1fa52f=moment()[_0x6a90('0xe')](_0x6a90('0x30'));_0x3b2889[_0x6a90('0x31')]=_0x4bbcad;_0x3b2889[_0x6a90('0x36')]=_0x360949;_0x3b2889[_0x6a90('0x34')]=_0x1fa52f;_0x3b2889[_0x6a90('0x37')]=getSeconds(_0x3b2889[_0x6a90('0x34')],_0x3b2889[_0x6a90('0x33')]);};exports[_0x6a90('0x38')]=function(_0x8e992a,_0x443476,_0x5c2870){_0x8e992a[_0x6a90('0x39')]=_0x443476;_0x8e992a['UserId']=_0x5c2870;};exports[_0x6a90('0x3a')]=function(_0x36441e,_0x5d6bbc,_0x4a98b9){var _0x482b02=moment()[_0x6a90('0xe')](_0x6a90('0x30'));_0x36441e[_0x6a90('0x31')]=_0x5d6bbc;_0x36441e[_0x6a90('0x36')]=_0x4a98b9;_0x36441e['responsetime']=_0x36441e['responsetime']?_0x36441e[_0x6a90('0x34')]:_0x482b02;_0x36441e['endtime']=_0x36441e['endtime']?_0x36441e[_0x6a90('0x3b')]:_0x482b02;_0x36441e[_0x6a90('0x37')]=getSeconds(_0x36441e[_0x6a90('0x34')]||0x0,_0x36441e[_0x6a90('0x33')]||0x0);_0x36441e[_0x6a90('0x3c')]=_0x36441e[_0x6a90('0x3d')]?getSeconds(_0x36441e[_0x6a90('0x3b')],_0x36441e[_0x6a90('0x3d')]):0x0;};exports[_0x6a90('0x3e')]=function(_0x34edb0){return _0x34edb0===_0x6a90('0x3f');};exports[_0x6a90('0x40')]=function(_0x39b1de,_0x4de6c4,_0x58624c,_0x14368c,_0x22825e){var _0x2eb0df=_0x14368c?'RECALL':_0x39b1de[_0x6a90('0x14')];_0x2eb0df=_0x22825e?_0x6a90('0x41'):_0x2eb0df;return{'actionid':_0x39b1de[_0x6a90('0x42')],'action':_0x6a90('0x43'),'channel':_0x39b1de[_0x6a90('0x44')],'callerid':util['format'](_0x6a90('0xf'),_0x2eb0df,_0x39b1de[_0x6a90('0x15')]),'Exten':_0x6a90('0x45'),'Context':_0x6a90('0x46'),'Priority':'1','variable':_0x58624c,'timeout':(_0x4de6c4[_0x6a90('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x39b1de[_0x6a90('0x42')]};};exports[_0x6a90('0x48')]=function(_0x4f8f02){return _0x4f8f02['countbusyretry']+_0x4f8f02['countcongestionretry']+_0x4f8f02[_0x6a90('0x49')];};exports[_0x6a90('0x4a')]=function(_0x1e252a){var _0xf03ec9=_[_0x6a90('0x4b')](_0x1e252a);_0xf03ec9[_0x6a90('0x31')]=0xf;_0xf03ec9[_0x6a90('0x36')]=_0x6a90('0x4c');return _0xf03ec9;};exports['scheduledAt']=function(_0x1e41bf,_0x40bad7,_0x5764fa){var _0x107148={};_0x107148[_0x40bad7]=_0x1e41bf[_0x40bad7];_0x107148[_0x6a90('0x4d')]=![];_0x107148[_0x6a90('0x4e')]=moment()['add'](_0x5764fa,_0x6a90('0x4f'))[_0x6a90('0xe')](_0x6a90('0x30'));_0x107148[_0x6a90('0x16')]=_0x1e41bf[_0x6a90('0x16')];_0x107148[_0x6a90('0x50')]=_0x1e41bf[_0x6a90('0x50')];_0x107148[_0x6a90('0x18')]=_0x1e41bf['VoiceQueueId']||undefined;return _0x107148;};exports[_0x6a90('0x51')]=function(_0x31a4e7,_0x3a4300){if(!_[_0x6a90('0x11')](_0x31a4e7)){if(_0x31a4e7[_0x6a90('0x52')]>0x0){_0x31a4e7['pTalking']-=0x1;}else{logger['error'](_0x3a4300,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger[_0x6a90('0x2d')](_0x3a4300,_0x6a90('0x53'));}};exports[_0x6a90('0x54')]=function(_0x33ac91){if(_0x33ac91<=0x0){return!![];}return![];};exports['buildObj']=function(_0x1a7623,_0x51be2d){_0x1a7623[_0x6a90('0x55')]=_0x51be2d;_0x1a7623[_0x6a90('0x13')]=_0x1a7623[_0x6a90('0x56')];_0x1a7623[_0x6a90('0x57')]=_0x1a7623['channelAgent'];return _0x1a7623;};exports['buildAcw']=function(_0x328205){var _0x2ff7c6={};_0x2ff7c6[_0x6a90('0x56')]=_0x328205[_0x6a90('0x56')];_0x2ff7c6[_0x6a90('0x57')]=_0x328205[_0x6a90('0x44')];_0x2ff7c6[_0x6a90('0x42')]=_0x328205[_0x6a90('0x42')];return _0x2ff7c6;};exports[_0x6a90('0x58')]=function(_0x33aa77){var _0xd7ace5=[];for(var _0x1f1265 in _0x33aa77){if(_0x33aa77[_0x6a90('0x24')](_0x1f1265)){if(!_[_0x6a90('0x11')](_0x33aa77[_0x1f1265])&&_0x33aa77[_0x1f1265][_0x6a90('0x31')]===_0x6a90('0x59')&&_0x33aa77[_0x1f1265][_0x6a90('0x5a')]===_0x6a90('0x5b')){_0xd7ace5[_0x6a90('0x5c')](_0x33aa77[_0x1f1265]['id']);}}}return _0xd7ace5;};exports[_0x6a90('0x5d')]=function(_0x30d529){var _0x1161a8=moment()[_0x6a90('0x4')](0x0);var _0x1347ec=moment(_0x30d529)[_0x6a90('0x4')](0x0);return _0x1161a8['diff'](_0x1347ec,_0x6a90('0x5e'));};exports['createBody']=function(_0x3fd9a3){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3fd9a3[_0x6a90('0x16')],'ListId':_0x3fd9a3[_0x6a90('0x50')],'VoiceQueueId':_0x3fd9a3['VoiceQueueId']||undefined,'CampaignId':_0x3fd9a3[_0x6a90('0x5f')]||undefined};};exports[_0x6a90('0x60')]=function(_0x491184){if(_0x491184==='uniqueid'||_0x491184===_0x6a90('0x61')||_0x491184===_0x6a90('0x56')||_0x491184==='type'||_0x491184===_0x6a90('0x62')||_0x491184===_0x6a90('0x63')||_0x491184===_0x6a90('0x39')||_0x491184===_0x6a90('0x44')||_0x491184===_0x6a90('0x14')||_0x491184===_0x6a90('0x4d')||_0x491184===_0x6a90('0x15')||_0x491184===_0x6a90('0x4e')||_0x491184===_0x6a90('0x64')||_0x491184===_0x6a90('0x65')||_0x491184===_0x6a90('0x49')||_0x491184===_0x6a90('0x66')||_0x491184===_0x6a90('0x67')||_0x491184===_0x6a90('0x68')||_0x491184===_0x6a90('0x69')||_0x491184===_0x6a90('0x6a')||_0x491184==='ContactId'||_0x491184===_0x6a90('0x50')||_0x491184===_0x6a90('0x6b')||_0x491184===_0x6a90('0x18')||_0x491184==='sipcallid'||_0x491184==='xmd-voicequeueid'||_0x491184===_0x6a90('0x6c')||_0x491184==='xmd-phone'||_0x491184===_0x6a90('0x6d')||_0x491184===_0x6a90('0x6e')||_0x491184===_0x6a90('0x6f')||_0x491184===_0x6a90('0x70')||_0x491184===_0x6a90('0x71')||_0x491184===_0x6a90('0x72')||_0x491184===_0x6a90('0x73')||_0x491184===_0x6a90('0x74')||_0x491184===_0x6a90('0x75')||_0x491184==='xmd-agiafter'||_0x491184==='xmd-agi'||_0x491184===_0x6a90('0x76')||_0x491184===_0x6a90('0x77')||_0x491184==='rtpaudioqosjitter'||_0x491184===_0x6a90('0x78')||_0x491184===_0x6a90('0x79')||_0x491184===_0x6a90('0x7a')||_0x491184==='rtpaudioqosrtt'||_0x491184==='rtpaudioqosrttbridged'||_0x491184==='rtpaudioqos'||_0x491184==='rtpaudioqosbridged'||_0x491184===_0x6a90('0x7b')||_0x491184==='rtpaudioqosjitterbridged'||_0x491184===_0x6a90('0x79')||_0x491184===_0x6a90('0x7a')||_0x491184===_0x6a90('0x7c')||_0x491184==='rtpaudioqosrttbridged'||_0x491184==='bridgepeer'||_0x491184==='bridgepvtcallid'||_0x491184==='state'||_0x491184===_0x6a90('0x36')){return![];}return!![];};exports[_0x6a90('0x7d')]=function(_0x397d56,_0x1ee771){var _0x25871c,_0x4234ec,_0x477ffb;if(_0x1ee771<=0x0){_0x1ee771=0x1;}_0x25871c=new RegExp(_0x6a90('0x7e')+_0x1ee771+'}$');_0x4234ec=Math[_0x6a90('0x7f')](0xa,_0x1ee771-0x1);_0x477ffb=Math[_0x6a90('0x7f')](0xa,_0x1ee771)-0x1;return util['format']('%s',_[_0x6a90('0x80')](_0x397d56,_0x25871c,_[_0x6a90('0x81')](_0x4234ec,_0x477ffb)));};exports['extractCalleridName']=function(_0x3dcdcc){var _0xe62a53=_0x3dcdcc[_0x6a90('0x82')](/"(.*?)"/);return _0xe62a53?_0xe62a53[0x1]:_0x3dcdcc;};exports[_0x6a90('0x83')]=function(_0x1cc4f4){var _0x6fe067=_0x1cc4f4[_0x6a90('0x82')](/<(.*?)>/);return _0x6fe067?_0x6fe067[0x1]:_0x1cc4f4;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 2891a78..c062f6c 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 _0x7a54=['number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5a7a9e,_0x73438a){var _0x553dd=function(_0x6de615){while(--_0x6de615){_0x5a7a9e['push'](_0x5a7a9e['shift']());}};_0x553dd(++_0x73438a);}(_0x7a54,0x106));var _0x47a5=function(_0x4bdd6e,_0x4212b4){_0x4bdd6e=_0x4bdd6e-0x0;var _0x1880b1=_0x7a54[_0x4bdd6e];return _0x1880b1;};'use strict';exports[_0x47a5('0x0')]={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':_0x47a5('0x2'),'required':![]},'paused':{'type':_0x47a5('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0x47a5('0x1'),'required':!![]},'interface':{'type':_0x47a5('0x1'),'required':!![]}};exports[_0x47a5('0x4')]={'interface':{'type':_0x47a5('0x1'),'required':!![]},'paused':{'type':_0x47a5('0x3')},'reason':{'type':'string','required':![]}};exports[_0x47a5('0x5')]={'module':{'type':'string','required':![]}};exports[_0x47a5('0x6')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':'string'},'mixmonitorid':{'type':'string'}};exports[_0x47a5('0x7')]={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0x47a5('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0x5f2f=['number','boolean','queueremove','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','queueadd','string'];(function(_0x5b07ae,_0x5ef16f){var _0x1e9f93=function(_0x5b3ad4){while(--_0x5b3ad4){_0x5b07ae['push'](_0x5b07ae['shift']());}};_0x1e9f93(++_0x5ef16f);}(_0x5f2f,0x73));var _0xf5f2=function(_0x62aed4,_0x2e2998){_0x62aed4=_0x62aed4-0x0;var _0x2ecfe8=_0x5f2f[_0x62aed4];return _0x2ecfe8;};'use strict';exports[_0xf5f2('0x0')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':_0xf5f2('0x1'),'required':!![]},'membername':{'type':_0xf5f2('0x1'),'required':!![]},'penalty':{'type':_0xf5f2('0x2'),'required':![]},'paused':{'type':_0xf5f2('0x3'),'required':![]}};exports[_0xf5f2('0x4')]={'queue':{'type':_0xf5f2('0x1'),'required':!![]},'interface':{'type':'string','required':!![]}};exports['queuepause']={'interface':{'type':_0xf5f2('0x1'),'required':!![]},'paused':{'type':_0xf5f2('0x3')},'reason':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x5')]={'module':{'type':_0xf5f2('0x1'),'required':![]}};exports[_0xf5f2('0x6')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xf5f2('0x7')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'filename':{'type':_0xf5f2('0x1')},'format':{'type':'string'},'mixmonitorid':{'type':_0xf5f2('0x1')}};exports[_0xf5f2('0x8')]={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xf5f2('0x1'),'required':!![]},'exten':{'type':'string','required':!![]},'context':{'type':'string'}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index b47f6af..1b1175b 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 _0xadca=['zendeskAccounts','initFreshdeskAccounts','initZohoAccounts','zohoAccounts','initDeskAccounts','initSugarcrmAccounts','servicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','uniqueid','queue','queuecallerexit','unmanaged','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','answered','queuecallercompleteAt','initVoiceCallReports','disposition','billableseconds','initCampaigns','campaigns','initVoiceExtensions','initCampaignHopperHistory','merge','initFaxAccounts','util','lodash','moment','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/voiceExtension','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','telephones','trunks','voiceQueues','outbound','voiceExtensions','channels','outboundChannels','timers','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','deskAccounts','vtigerAccounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','interface','total','sumHoldTime','sumBillable','ivrTotalCallsDays','ivrAnswerCallsDay','isEmpty','abandoned','sumDuration','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','isNil','isUndefined','initTrunks','length','initVoiceQueues','initTriggers','triggers','templates'];(function(_0x3104b0,_0x1869b0){var _0xc084ae=function(_0x33cfaf){while(--_0x33cfaf){_0x3104b0['push'](_0x3104b0['shift']());}};_0xc084ae(++_0x1869b0);}(_0xadca,0x162));var _0xaadc=function(_0x30986c,_0x39ce58){_0x30986c=_0x30986c-0x0;var _0x57c209=_0xadca[_0x30986c];return _0x57c209;};'use strict';var BPromise=require('bluebird');var util=require(_0xaadc('0x0'));var _=require(_0xaadc('0x1'));var moment=require(_0xaadc('0x2'));var Agent=require('../model/agent');var Telephone=require('../model/telephone');var Trunk=require(_0xaadc('0x3'));var VoiceQueue=require(_0xaadc('0x4'));var Trigger=require(_0xaadc('0x5'));var Template=require('../model/template');var Campaign=require(_0xaadc('0x6'));var VoiceExtension=require(_0xaadc('0x7'));var ZendeskAccount=require(_0xaadc('0x8'));var SalesforceAccount=require(_0xaadc('0x9'));var FreshdeskAccount=require(_0xaadc('0xa'));var SugarcrmAccount=require(_0xaadc('0xb'));var ZohoAccount=require(_0xaadc('0xc'));var DeskAccount=require(_0xaadc('0xd'));var VtigerAccount=require(_0xaadc('0xe'));var ServicenowAccount=require(_0xaadc('0xf'));var Dynamics365Account=require(_0xaadc('0x10'));var FreshsalesAccount=require(_0xaadc('0x11'));var FaxAccount=require(_0xaadc('0x12'));var Realtime=function(){this['agents']={};this[_0xaadc('0x13')]={};this[_0xaadc('0x14')]={};this[_0xaadc('0x15')]={};this['triggers']={};this['campaigns']={};this['templates']={};this[_0xaadc('0x16')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xaadc('0x17')]={};this[_0xaadc('0x18')]={};this['queueChannels']={};this[_0xaadc('0x19')]={};this[_0xaadc('0x1a')]={};this['zendeskAccounts']={};this[_0xaadc('0x1b')]={};this[_0xaadc('0x1c')]={};this[_0xaadc('0x1d')]={};this['zohoAccounts']={};this[_0xaadc('0x1e')]={};this[_0xaadc('0x1f')]={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xaadc('0x20')]={};this[_0xaadc('0x21')]={};};function freeIsNotKey(_0x5b8bde,_0xa5b6db,_0x53ecfb){var _0x16a182=_[_0xaadc('0x22')](_0x5b8bde,function(_0x2c4d8f,_0x2101ad){return _0x2c4d8f[_0x53ecfb];});for(var _0x5c8d4f in _0xa5b6db){if(_0xa5b6db['hasOwnProperty'](_0x5c8d4f)){if(!_0x16a182[_0x5c8d4f]){delete _0xa5b6db[_0x5c8d4f];}}}}function freeIsNotKeySip(_0x3ffa0d,_0x324319){var _0x3ab480=_[_0xaadc('0x22')](_0x3ffa0d,function(_0x2c0a38,_0x5590d0){return util[_0xaadc('0x23')](_0xaadc('0x24'),_0x2c0a38[_0xaadc('0x25')]);});for(var _0x3251b5 in _0x324319){if(_0x324319[_0xaadc('0x26')](_0x3251b5)){if(!_0x3ab480[_0x3251b5]){delete _0x324319[_0x3251b5];}}}}function freeIsNotKeyAgent(_0x5bb5c1,_0x42bc8c){var _0x2809b3=_[_0xaadc('0x22')](_0x5bb5c1,function(_0x414fef,_0x30c793){var _0x25c336=_['isNil'](_0x414fef[_0xaadc('0x27')])?util[_0xaadc('0x23')](_0xaadc('0x24'),_0x414fef['name']):_0x414fef[_0xaadc('0x27')];return _0x25c336;});for(var _0x1f3a79 in _0x42bc8c){if(_0x42bc8c[_0xaadc('0x26')](_0x1f3a79)){if(!_0x2809b3[_0x1f3a79]){delete _0x42bc8c[_0x1f3a79];}}}}function clearVoiceCallReports(_0x26e208){_0x26e208[_0xaadc('0x28')]=0x0;_0x26e208['answered']=0x0;_0x26e208[_0xaadc('0x29')]=0x0;_0x26e208['sumDuration']=0x0;_0x26e208[_0xaadc('0x2a')]=0x0;}function clearCampaigns(_0x541693){if(!_['isEmpty'](_0x541693)){for(var _0xaf2677 in _0x541693){if(_0x541693[_0xaadc('0x26')](_0xaf2677)){_0x541693[_0xaf2677][_0xaadc('0x2b')]=0x0;_0x541693[_0xaf2677][_0xaadc('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x5e2623){if(!_[_0xaadc('0x2d')](_0x5e2623)){for(var _0x39c35d in _0x5e2623){if(_0x5e2623['hasOwnProperty'](_0x39c35d)){_0x5e2623[_0x39c35d][_0xaadc('0x28')]=0x0;_0x5e2623[_0x39c35d]['answered']=0x0;_0x5e2623[_0x39c35d]['unmanaged']=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x2e')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x29')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x2f')]=0x0;_0x5e2623[_0x39c35d]['sumBillable']=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x30')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x31')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x32')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x33')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x34')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x35')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x36')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x37')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x38')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x39')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x3a')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x3b')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x30')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x3c')]=0x0;_0x5e2623[_0x39c35d][_0xaadc('0x3d')]=!![];}}}}Realtime[_0xaadc('0x3e')][_0xaadc('0x3f')]=function(_0x5d5c94,_0x3fcc8a){for(var _0x41bfd3 in _0x3fcc8a){if(_0x5d5c94[_0xaadc('0x26')](_0x41bfd3)){_0x5d5c94[_0x41bfd3]=_0x3fcc8a[_0x41bfd3];}}};Realtime[_0xaadc('0x3e')][_0xaadc('0x40')]=function(){var _0x515f7a=this;return function(_0x3d0371){if(_0x3d0371){freeIsNotKeyAgent(_0x3d0371,_0x515f7a[_0xaadc('0x41')]);for(var _0x5d63b3=0x0,_0x543cd1={},_0x350f8f={};_0x5d63b3<_0x3d0371['length'];_0x5d63b3+=0x1){_0x543cd1=_0x3d0371[_0x5d63b3];var _0x5513fe=_[_0xaadc('0x42')](_0x543cd1[_0xaadc('0x27')])?util[_0xaadc('0x23')](_0xaadc('0x24'),_0x543cd1[_0xaadc('0x25')]):_0x543cd1['interface'];if(_[_0xaadc('0x43')](_0x515f7a['agents'][_0x5513fe])){_0x515f7a['agents'][_0x5513fe]=new Agent(_0x543cd1);}else{_0x515f7a[_0xaadc('0x3f')](_0x515f7a[_0xaadc('0x41')][_0x5513fe],_0x543cd1);}}}return _0x515f7a[_0xaadc('0x41')];};};Realtime[_0xaadc('0x3e')]['initTelephones']=function(){var _0x56018a=this;return function(_0x27a59b){if(_0x27a59b){freeIsNotKeySip(_0x27a59b,_0x56018a[_0xaadc('0x13')]);for(var _0xd3ec5b=0x0,_0x3a4aee={},_0x57c656={};_0xd3ec5b<_0x27a59b['length'];_0xd3ec5b+=0x1){_0x3a4aee=_0x27a59b[_0xd3ec5b];if(_[_0xaadc('0x43')](_0x56018a[_0xaadc('0x13')][util['format'](_0xaadc('0x24'),_0x3a4aee[_0xaadc('0x25')])])){_0x56018a[_0xaadc('0x13')][util[_0xaadc('0x23')](_0xaadc('0x24'),_0x3a4aee[_0xaadc('0x25')])]=new Telephone(_0x3a4aee);}else{_0x56018a[_0xaadc('0x3f')](_0x56018a[_0xaadc('0x13')][util[_0xaadc('0x23')](_0xaadc('0x24'),_0x3a4aee[_0xaadc('0x25')])],_0x3a4aee);}}}return _0x56018a[_0xaadc('0x13')];};};Realtime['prototype'][_0xaadc('0x44')]=function(){var _0x4bc56d=this;return function(_0x2a39f9){if(_0x2a39f9){freeIsNotKeySip(_0x2a39f9,_0x4bc56d[_0xaadc('0x14')]);for(var _0x2265ae=0x0,_0x489199={},_0x119bd6={};_0x2265ae<_0x2a39f9[_0xaadc('0x45')];_0x2265ae+=0x1){_0x489199=_0x2a39f9[_0x2265ae];if(_[_0xaadc('0x43')](_0x4bc56d[_0xaadc('0x14')][util[_0xaadc('0x23')](_0xaadc('0x24'),_0x489199[_0xaadc('0x25')])])){_0x4bc56d[_0xaadc('0x14')][util[_0xaadc('0x23')]('SIP/%s',_0x489199[_0xaadc('0x25')])]=new Trunk(_0x489199);}else{_0x4bc56d['mergeFromDatabase'](_0x4bc56d[_0xaadc('0x14')][util['format'](_0xaadc('0x24'),_0x489199[_0xaadc('0x25')])],_0x489199);}}}return _0x4bc56d[_0xaadc('0x14')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x46')]=function(){var _0x21f5e9=this;return function(_0xdfe08f){if(_0xdfe08f){freeIsNotKey(_0xdfe08f,_0x21f5e9[_0xaadc('0x15')],_0xaadc('0x25'));for(var _0x24e1d6=0x0,_0x4a0568={},_0x219580={};_0x24e1d6<_0xdfe08f['length'];_0x24e1d6+=0x1){_0x4a0568=_0xdfe08f[_0x24e1d6];if(_[_0xaadc('0x43')](_0x21f5e9[_0xaadc('0x15')][_0x4a0568['name']])){_0x21f5e9[_0xaadc('0x15')][_0x4a0568['name']]=new VoiceQueue(_0x4a0568);}else{_0x21f5e9[_0xaadc('0x3f')](_0x21f5e9[_0xaadc('0x15')][_0x4a0568['name']],_0x4a0568);}}}return _0x21f5e9['voiceQueues'];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x47')]=function(){var _0x269e13=this;return function(_0x229dd4){if(_0x229dd4){freeIsNotKey(_0x229dd4,_0x269e13['triggers'],'id');for(var _0x563c39=0x0,_0x28045f={},_0x1d58f6={};_0x563c39<_0x229dd4['length'];_0x563c39+=0x1){_0x28045f=_0x229dd4[_0x563c39];if(_[_0xaadc('0x43')](_0x269e13[_0xaadc('0x48')][_0x28045f['id']])){_0x269e13['triggers'][_0x28045f['id']]=new Trigger(_0x28045f);}else{_0x269e13[_0xaadc('0x3f')](_0x269e13[_0xaadc('0x48')][_0x28045f['id']],_0x28045f);}}}return _0x269e13['triggers'];};};Realtime[_0xaadc('0x3e')]['initTemplates']=function(){var _0xfa95f3=this;return function(_0x388752){if(_0x388752){freeIsNotKey(_0x388752,_0xfa95f3['templates'],'id');for(var _0x2f82c3=0x0,_0xa26cc1={},_0x594db7={};_0x2f82c3<_0x388752[_0xaadc('0x45')];_0x2f82c3+=0x1){_0xa26cc1=_0x388752[_0x2f82c3];if(_[_0xaadc('0x43')](_0xfa95f3['templates'][_0xa26cc1['id']])){_0xfa95f3['templates'][_0xa26cc1['id']]=new Template(_0xa26cc1);}else{_0xfa95f3[_0xaadc('0x3f')](_0xfa95f3[_0xaadc('0x49')][_0xa26cc1['id']],_0xa26cc1);}}}return _0xfa95f3[_0xaadc('0x49')];};};Realtime[_0xaadc('0x3e')]['initZendeskAccounts']=function(){var _0x1aa20d=this;return function(_0x224d53){if(_0x224d53){freeIsNotKey(_0x224d53,_0x1aa20d[_0xaadc('0x4a')],'id');for(var _0x134fd9=0x0,_0xb30bc={},_0x55fa60={};_0x134fd9<_0x224d53[_0xaadc('0x45')];_0x134fd9+=0x1){_0xb30bc=_0x224d53[_0x134fd9];if(_[_0xaadc('0x43')](_0x1aa20d['zendeskAccounts'][_0xb30bc['id']])){_0x1aa20d[_0xaadc('0x4a')][_0xb30bc['id']]=new ZendeskAccount(_0xb30bc);}else{_0x1aa20d[_0xaadc('0x3f')](_0x1aa20d[_0xaadc('0x4a')][_0xb30bc['id']],_0xb30bc);}}}return _0x1aa20d[_0xaadc('0x4a')];};};Realtime[_0xaadc('0x3e')]['initSalesforceAccounts']=function(){var _0x148e87=this;return function(_0x253bec){if(_0x253bec){freeIsNotKey(_0x253bec,_0x148e87[_0xaadc('0x1b')],'id');for(var _0x1ac2cd=0x0,_0x2abcc4={},_0xf8baac={};_0x1ac2cd<_0x253bec[_0xaadc('0x45')];_0x1ac2cd+=0x1){_0x2abcc4=_0x253bec[_0x1ac2cd];if(_[_0xaadc('0x43')](_0x148e87[_0xaadc('0x1b')][_0x2abcc4['id']])){_0x148e87[_0xaadc('0x1b')][_0x2abcc4['id']]=new SalesforceAccount(_0x2abcc4);}else{_0x148e87[_0xaadc('0x3f')](_0x148e87[_0xaadc('0x1b')][_0x2abcc4['id']],_0x2abcc4);}}}return _0x148e87['salesforceAccounts'];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x4b')]=function(){var _0x1bd80a=this;return function(_0x266eac){if(_0x266eac){freeIsNotKey(_0x266eac,_0x1bd80a[_0xaadc('0x1d')],'id');for(var _0x22715f=0x0,_0x34736f={},_0x51f277={};_0x22715f<_0x266eac[_0xaadc('0x45')];_0x22715f+=0x1){_0x34736f=_0x266eac[_0x22715f];if(_['isUndefined'](_0x1bd80a[_0xaadc('0x1d')][_0x34736f['id']])){_0x1bd80a[_0xaadc('0x1d')][_0x34736f['id']]=new FreshdeskAccount(_0x34736f);}else{_0x1bd80a[_0xaadc('0x3f')](_0x1bd80a[_0xaadc('0x1d')][_0x34736f['id']],_0x34736f);}}}return _0x1bd80a[_0xaadc('0x1d')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x4c')]=function(){var _0x41c617=this;return function(_0x169874){if(_0x169874){freeIsNotKey(_0x169874,_0x41c617[_0xaadc('0x4d')],'id');for(var _0x2c50d4=0x0,_0x2e772e={},_0x470bb8={};_0x2c50d4<_0x169874[_0xaadc('0x45')];_0x2c50d4+=0x1){_0x2e772e=_0x169874[_0x2c50d4];if(_['isUndefined'](_0x41c617[_0xaadc('0x4d')][_0x2e772e['id']])){_0x41c617[_0xaadc('0x4d')][_0x2e772e['id']]=new ZohoAccount(_0x2e772e);}else{_0x41c617[_0xaadc('0x3f')](_0x41c617['zohoAccounts'][_0x2e772e['id']],_0x2e772e);}}}return _0x41c617[_0xaadc('0x4d')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x4e')]=function(){var _0x3d774c=this;return function(_0x488e5b){if(_0x488e5b){freeIsNotKey(_0x488e5b,_0x3d774c[_0xaadc('0x1e')],'id');for(var _0x4c5e92=0x0,_0x34cd35={},_0x143382={};_0x4c5e92<_0x488e5b['length'];_0x4c5e92+=0x1){_0x34cd35=_0x488e5b[_0x4c5e92];if(_[_0xaadc('0x43')](_0x3d774c['deskAccounts'][_0x34cd35['id']])){_0x3d774c['deskAccounts'][_0x34cd35['id']]=new DeskAccount(_0x34cd35);}else{_0x3d774c[_0xaadc('0x3f')](_0x3d774c['deskAccounts'][_0x34cd35['id']],_0x34cd35);}}}return _0x3d774c[_0xaadc('0x1e')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x4f')]=function(){var _0x19d542=this;return function(_0x1b5fe5){if(_0x1b5fe5){freeIsNotKey(_0x1b5fe5,_0x19d542[_0xaadc('0x1c')],'id');for(var _0x5e1519=0x0,_0x59af48={},_0x978db0={};_0x5e1519<_0x1b5fe5['length'];_0x5e1519+=0x1){_0x59af48=_0x1b5fe5[_0x5e1519];if(_['isUndefined'](_0x19d542[_0xaadc('0x1c')][_0x59af48['id']])){_0x19d542[_0xaadc('0x1c')][_0x59af48['id']]=new SugarcrmAccount(_0x59af48);}else{_0x19d542['mergeFromDatabase'](_0x19d542[_0xaadc('0x1c')][_0x59af48['id']],_0x59af48);}}}return _0x19d542[_0xaadc('0x1c')];};};Realtime[_0xaadc('0x3e')]['initVtigerAccounts']=function(){var _0x379cc1=this;return function(_0x18a7da){if(_0x18a7da){freeIsNotKey(_0x18a7da,_0x379cc1[_0xaadc('0x1f')],'id');for(var _0x2551a5=0x0,_0xd24c7={},_0x1fe455={};_0x2551a5<_0x18a7da[_0xaadc('0x45')];_0x2551a5+=0x1){_0xd24c7=_0x18a7da[_0x2551a5];if(_[_0xaadc('0x43')](_0x379cc1['vtigerAccounts'][_0xd24c7['id']])){_0x379cc1[_0xaadc('0x1f')][_0xd24c7['id']]=new VtigerAccount(_0xd24c7);}else{_0x379cc1[_0xaadc('0x3f')](_0x379cc1['vtigerAccounts'][_0xd24c7['id']],_0xd24c7);}}}return _0x379cc1[_0xaadc('0x1f')];};};Realtime[_0xaadc('0x3e')]['initServicenowAccounts']=function(){var _0x4f3267=this;return function(_0xd3ec14){if(_0xd3ec14){freeIsNotKey(_0xd3ec14,_0x4f3267[_0xaadc('0x50')],'id');for(var _0x3b79f=0x0,_0x43b91c={},_0x15f107={};_0x3b79f<_0xd3ec14[_0xaadc('0x45')];_0x3b79f+=0x1){_0x43b91c=_0xd3ec14[_0x3b79f];if(_[_0xaadc('0x43')](_0x4f3267[_0xaadc('0x50')][_0x43b91c['id']])){_0x4f3267['servicenowAccounts'][_0x43b91c['id']]=new ServicenowAccount(_0x43b91c);}else{_0x4f3267[_0xaadc('0x3f')](_0x4f3267['servicenowAccounts'][_0x43b91c['id']],_0x43b91c);}}}return _0x4f3267[_0xaadc('0x50')];};};Realtime[_0xaadc('0x3e')]['initDynamics365Accounts']=function(){var _0x42857a=this;return function(_0x4a9da9){if(_0x4a9da9){freeIsNotKey(_0x4a9da9,_0x42857a[_0xaadc('0x51')],'id');for(var _0x1da008=0x0,_0x52f05e={},_0x2531fe={};_0x1da008<_0x4a9da9['length'];_0x1da008+=0x1){_0x52f05e=_0x4a9da9[_0x1da008];if(_[_0xaadc('0x43')](_0x42857a[_0xaadc('0x51')][_0x52f05e['id']])){_0x42857a['dynamics365Accounts'][_0x52f05e['id']]=new Dynamics365Account(_0x52f05e);}else{_0x42857a['mergeFromDatabase'](_0x42857a[_0xaadc('0x51')][_0x52f05e['id']],_0x52f05e);}}}return _0x42857a[_0xaadc('0x51')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x52')]=function(){var _0x1f26ee=this;return function(_0x230442){if(_0x230442){freeIsNotKey(_0x230442,_0x1f26ee[_0xaadc('0x20')],'id');for(var _0x36f57a=0x0,_0x536423={},_0x2303aa={};_0x36f57a<_0x230442['length'];_0x36f57a+=0x1){_0x536423=_0x230442[_0x36f57a];if(_[_0xaadc('0x43')](_0x1f26ee[_0xaadc('0x20')][_0x536423['id']])){_0x1f26ee[_0xaadc('0x20')][_0x536423['id']]=new FreshsalesAccount(_0x536423);}else{_0x1f26ee[_0xaadc('0x3f')](_0x1f26ee[_0xaadc('0x20')][_0x536423['id']],_0x536423);}}}return _0x1f26ee['freshsalesAccounts'];};};Realtime['prototype'][_0xaadc('0x53')]=function(){var _0x412500=this;return function(_0x5dfc66){for(var _0x3c3d04=0x0;_0x3c3d04<_0x5dfc66[_0xaadc('0x45')];_0x3c3d04+=0x1){_['merge'](_0x412500[_0xaadc('0x15')][_0x5dfc66[_0x3c3d04][_0xaadc('0x25')]],_0x5dfc66[_0x3c3d04]);}return _0x412500[_0xaadc('0x15')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x54')]=function(){var _0x13854f=this;return function(_0x2f9f30){clearVoiceQueues(_0x13854f[_0xaadc('0x15')]);if(_0x2f9f30){_0x2f9f30=_['groupBy'](_0x2f9f30,_0xaadc('0x55'));for(var _0x5bc37c in _0x2f9f30){if(_0x2f9f30['hasOwnProperty'](_0x5bc37c)){var _0x46ce96={};for(var _0x1b8fbc=0x0;_0x1b8fbc<_0x2f9f30[_0x5bc37c][_0xaadc('0x45')];_0x1b8fbc+=0x1){var _0x37436c=_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x56')];if(_0x13854f[_0xaadc('0x15')][_0x37436c]){if(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x57')]){_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x58')]+=0x1;}if(_0x2f9f30[_0x5bc37c][_0x1b8fbc]['queuecallerabandon']){_0x13854f[_0xaadc('0x15')][_0x37436c]['abandoned']+=0x1;}_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x29')]+=moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x59')])[_0xaadc('0x5a')](moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x5b')]),_0xaadc('0x5c'))||0x0;if(_0x1b8fbc===_0x2f9f30[_0x5bc37c]['length']-0x1){_0x13854f[_0xaadc('0x15')][_0x37436c]['sumDuration']+=moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc]['queuecallercompleteAt']||_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x5d')]||_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x5e')])[_0xaadc('0x5a')](moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x5b')]),_0xaadc('0x5c'))||0x0;_0x13854f['voiceQueues'][_0x37436c][_0xaadc('0x28')]+=0x1;if(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x5f')]){_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x60')]+=0x1;_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x2a')]+=moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x61')])['diff'](moment(_0x2f9f30[_0x5bc37c][_0x1b8fbc][_0xaadc('0x59')]),'seconds')||0x0;}}else{_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x2f')]+=_0x13854f[_0xaadc('0x15')][_0x37436c][_0xaadc('0x29')]||0x0;}}}}}}return _0x13854f['voiceQueues'];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x62')]=function(){var _0x1a5df3=this;return function(_0x2f5322){clearVoiceCallReports(_0x1a5df3['outbound']);if(_0x2f5322){for(var _0x30a244=0x0;_0x30a244<_0x2f5322['length'];_0x30a244+=0x1){_0x1a5df3[_0xaadc('0x16')]['total']+=0x1;_0x1a5df3['outbound']['sumDuration']+=_0x2f5322[_0x30a244]['duration'];if(_0x2f5322[_0x30a244][_0xaadc('0x63')]==='ANSWERED'){_0x1a5df3[_0xaadc('0x16')]['answered']+=0x1;_0x1a5df3[_0xaadc('0x16')]['sumHoldTime']+=_0x2f5322[_0x30a244]['duration']-_0x2f5322[_0x30a244][_0xaadc('0x64')]||0x0;_0x1a5df3[_0xaadc('0x16')][_0xaadc('0x2a')]+=_0x2f5322[_0x30a244][_0xaadc('0x64')];}}}return _0x1a5df3[_0xaadc('0x16')];};};Realtime['prototype'][_0xaadc('0x65')]=function(){var _0x5e1ab2=this;return function(_0x4ab965){if(_0x4ab965){freeIsNotKey(_0x4ab965,_0x5e1ab2[_0xaadc('0x66')],'name');for(var _0xd5cd09=0x0,_0x1c6e41={};_0xd5cd09<_0x4ab965['length'];_0xd5cd09+=0x1){_0x1c6e41=_0x4ab965[_0xd5cd09];if(_[_0xaadc('0x43')](_0x5e1ab2['campaigns'][_0x1c6e41[_0xaadc('0x25')]])){_0x5e1ab2[_0xaadc('0x66')][_0x1c6e41[_0xaadc('0x25')]]=new Campaign(_0x1c6e41);}else{_0x5e1ab2[_0xaadc('0x3f')](_0x5e1ab2[_0xaadc('0x66')][_0x1c6e41[_0xaadc('0x25')]],_0x1c6e41);}}}return _0x5e1ab2[_0xaadc('0x66')];};};Realtime['prototype'][_0xaadc('0x67')]=function(){var _0x57c391=this;return function(_0x5c10b1){if(_0x5c10b1){freeIsNotKey(_0x5c10b1,_0x57c391[_0xaadc('0x17')],'id');for(var _0x3515a0=0x0,_0x348bc3={};_0x3515a0<_0x5c10b1['length'];_0x3515a0+=0x1){_0x348bc3=_0x5c10b1[_0x3515a0];if(_['isUndefined'](_0x57c391[_0xaadc('0x17')][_0x348bc3['id']])){_0x57c391['voiceExtensions'][_0x348bc3['id']]=new VoiceExtension(_0x348bc3);}else{_0x57c391[_0xaadc('0x3f')](_0x57c391[_0xaadc('0x17')][_0x348bc3['id']],_0x348bc3);}}}return _0x57c391[_0xaadc('0x17')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x68')]=function(){var _0x441f1e=this;return function(_0x254f1b){clearCampaigns(_0x441f1e[_0xaadc('0x66')]);for(var _0x116be6=0x0;_0x116be6<_0x254f1b['length'];_0x116be6+=0x1){_[_0xaadc('0x69')](_0x441f1e['campaigns'][_0x254f1b[_0x116be6][_0xaadc('0x25')]],_0x254f1b[_0x116be6]);}return _0x441f1e[_0xaadc('0x66')];};};Realtime[_0xaadc('0x3e')][_0xaadc('0x6a')]=function(){var _0x5b1c4e=this;return function(_0xfcabec){if(_0xfcabec){freeIsNotKey(_0xfcabec,_0x5b1c4e[_0xaadc('0x21')],'id');for(var _0x35458f=0x0,_0x84d4d8={},_0x1ea941={};_0x35458f<_0xfcabec[_0xaadc('0x45')];_0x35458f+=0x1){_0x84d4d8=_0xfcabec[_0x35458f];if(_['isUndefined'](_0x5b1c4e['faxAccounts'][_0x84d4d8['id']])){_0x5b1c4e['faxAccounts'][_0x84d4d8['id']]=new FaxAccount(_0x84d4d8);}else{_0x5b1c4e[_0xaadc('0x3f')](_0x5b1c4e['faxAccounts'][_0x84d4d8['id']],_0x84d4d8);}}}return _0x5b1c4e[_0xaadc('0x21')];};};module['exports']=Realtime; \ No newline at end of file +var _0xe7c8=['queueStatusComplete','mergeFromDatabase','prototype','initAgents','length','isUndefined','initTrunks','trunks','initVoiceQueues','initTriggers','initTemplates','templates','initZendeskAccounts','initSalesforceAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','groupBy','uniqueid','queue','queuecallerexit','unmanaged','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt','diff','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','initVoiceExtensions','initCampaignHopperHistory','exports','bluebird','lodash','moment','../model/agent','../model/telephone','../model/voiceExtension','../model/zendeskAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/dynamics365Account','../model/faxAccount','agents','telephones','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','timers','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','format','SIP/%s','name','hasOwnProperty','isNil','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay'];(function(_0x3b547e,_0x57def9){var _0x1cdc52=function(_0x440c26){while(--_0x440c26){_0x3b547e['push'](_0x3b547e['shift']());}};_0x1cdc52(++_0x57def9);}(_0xe7c8,0xfe));var _0x8e7c=function(_0x1158d5,_0x4e7ee8){_0x1158d5=_0x1158d5-0x0;var _0x3e9d61=_0xe7c8[_0x1158d5];return _0x3e9d61;};'use strict';var BPromise=require(_0x8e7c('0x0'));var util=require('util');var _=require(_0x8e7c('0x1'));var moment=require(_0x8e7c('0x2'));var Agent=require(_0x8e7c('0x3'));var Telephone=require(_0x8e7c('0x4'));var Trunk=require('../model/trunk');var VoiceQueue=require('../model/voiceQueue');var Trigger=require('../model/trigger');var Template=require('../model/template');var Campaign=require('../model/campaign');var VoiceExtension=require(_0x8e7c('0x5'));var ZendeskAccount=require(_0x8e7c('0x6'));var SalesforceAccount=require('../model/salesforceAccount');var FreshdeskAccount=require(_0x8e7c('0x7'));var SugarcrmAccount=require(_0x8e7c('0x8'));var ZohoAccount=require(_0x8e7c('0x9'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require('../model/vtigerAccount');var ServicenowAccount=require('../model/servicenowAccount');var Dynamics365Account=require(_0x8e7c('0xa'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0x8e7c('0xb'));var Realtime=function(){this[_0x8e7c('0xc')]={};this[_0x8e7c('0xd')]={};this['trunks']={};this[_0x8e7c('0xe')]={};this[_0x8e7c('0xf')]={};this[_0x8e7c('0x10')]={};this['templates']={};this[_0x8e7c('0x11')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0x8e7c('0x12')]={};this[_0x8e7c('0x13')]={};this[_0x8e7c('0x14')]={};this[_0x8e7c('0x15')]={};this[_0x8e7c('0x16')]={};this[_0x8e7c('0x17')]={};this[_0x8e7c('0x18')]={};this[_0x8e7c('0x19')]={};this[_0x8e7c('0x1a')]={};this[_0x8e7c('0x1b')]={};this['deskAccounts']={};this['vtigerAccounts']={};this[_0x8e7c('0x1c')]={};this[_0x8e7c('0x1d')]={};this[_0x8e7c('0x1e')]={};this[_0x8e7c('0x1f')]={};};function freeIsNotKey(_0x13d2d9,_0xb7956e,_0x382c34){var _0x4f1bad=_[_0x8e7c('0x20')](_0x13d2d9,function(_0x1f0f0c,_0x2b9125){return _0x1f0f0c[_0x382c34];});for(var _0x1b9f8b in _0xb7956e){if(_0xb7956e['hasOwnProperty'](_0x1b9f8b)){if(!_0x4f1bad[_0x1b9f8b]){delete _0xb7956e[_0x1b9f8b];}}}}function freeIsNotKeySip(_0x4ea75a,_0x39bd55){var _0x59c8f7=_[_0x8e7c('0x20')](_0x4ea75a,function(_0xf833fb,_0x55fa5c){return util[_0x8e7c('0x21')](_0x8e7c('0x22'),_0xf833fb[_0x8e7c('0x23')]);});for(var _0x437820 in _0x39bd55){if(_0x39bd55[_0x8e7c('0x24')](_0x437820)){if(!_0x59c8f7[_0x437820]){delete _0x39bd55[_0x437820];}}}}function freeIsNotKeyAgent(_0x2fa268,_0x2ba63b){var _0x7c175f=_[_0x8e7c('0x20')](_0x2fa268,function(_0x4eaade,_0x3b7fa1){var _0x4b5a3a=_[_0x8e7c('0x25')](_0x4eaade[_0x8e7c('0x26')])?util[_0x8e7c('0x21')](_0x8e7c('0x22'),_0x4eaade[_0x8e7c('0x23')]):_0x4eaade[_0x8e7c('0x26')];return _0x4b5a3a;});for(var _0x267f76 in _0x2ba63b){if(_0x2ba63b[_0x8e7c('0x24')](_0x267f76)){if(!_0x7c175f[_0x267f76]){delete _0x2ba63b[_0x267f76];}}}}function clearVoiceCallReports(_0x4a1460){_0x4a1460[_0x8e7c('0x27')]=0x0;_0x4a1460[_0x8e7c('0x28')]=0x0;_0x4a1460[_0x8e7c('0x29')]=0x0;_0x4a1460['sumDuration']=0x0;_0x4a1460[_0x8e7c('0x2a')]=0x0;}function clearCampaigns(_0x15e23f){if(!_[_0x8e7c('0x2b')](_0x15e23f)){for(var _0x1f752c in _0x15e23f){if(_0x15e23f[_0x8e7c('0x24')](_0x1f752c)){_0x15e23f[_0x1f752c][_0x8e7c('0x2c')]=0x0;_0x15e23f[_0x1f752c][_0x8e7c('0x2d')]=0x0;}}}}function clearVoiceQueues(_0x58aaa2){if(!_[_0x8e7c('0x2b')](_0x58aaa2)){for(var _0x52bd4f in _0x58aaa2){if(_0x58aaa2['hasOwnProperty'](_0x52bd4f)){_0x58aaa2[_0x52bd4f][_0x8e7c('0x27')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x28')]=0x0;_0x58aaa2[_0x52bd4f]['unmanaged']=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x2e')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x29')]=0x0;_0x58aaa2[_0x52bd4f]['sumDuration']=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x2a')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x2f')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x30')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x31')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x32')]=0x0;_0x58aaa2[_0x52bd4f]['outboundNoSuchCallsDay']=0x0;_0x58aaa2[_0x52bd4f]['outboundUnknownCallsDay']=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x33')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x34')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x35')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x36')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x37')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x38')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x2f')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x39')]=0x0;_0x58aaa2[_0x52bd4f][_0x8e7c('0x3a')]=!![];}}}}Realtime['prototype'][_0x8e7c('0x3b')]=function(_0x13f4c2,_0x5ba44e){for(var _0x16c3dc in _0x5ba44e){if(_0x13f4c2[_0x8e7c('0x24')](_0x16c3dc)){_0x13f4c2[_0x16c3dc]=_0x5ba44e[_0x16c3dc];}}};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x3d')]=function(){var _0x4ee51b=this;return function(_0x567a93){if(_0x567a93){freeIsNotKeyAgent(_0x567a93,_0x4ee51b[_0x8e7c('0xc')]);for(var _0x4ca12b=0x0,_0x13b8bd={},_0x320cfa={};_0x4ca12b<_0x567a93[_0x8e7c('0x3e')];_0x4ca12b+=0x1){_0x13b8bd=_0x567a93[_0x4ca12b];var _0xa4201a=_[_0x8e7c('0x25')](_0x13b8bd[_0x8e7c('0x26')])?util[_0x8e7c('0x21')](_0x8e7c('0x22'),_0x13b8bd[_0x8e7c('0x23')]):_0x13b8bd[_0x8e7c('0x26')];if(_['isUndefined'](_0x4ee51b[_0x8e7c('0xc')][_0xa4201a])){_0x4ee51b[_0x8e7c('0xc')][_0xa4201a]=new Agent(_0x13b8bd);}else{_0x4ee51b['mergeFromDatabase'](_0x4ee51b[_0x8e7c('0xc')][_0xa4201a],_0x13b8bd);}}}return _0x4ee51b[_0x8e7c('0xc')];};};Realtime[_0x8e7c('0x3c')]['initTelephones']=function(){var _0x4ba60f=this;return function(_0x164031){if(_0x164031){freeIsNotKeySip(_0x164031,_0x4ba60f['telephones']);for(var _0x4e71ae=0x0,_0x6bc1b9={},_0x3b1226={};_0x4e71ae<_0x164031['length'];_0x4e71ae+=0x1){_0x6bc1b9=_0x164031[_0x4e71ae];if(_[_0x8e7c('0x3f')](_0x4ba60f[_0x8e7c('0xd')][util['format'](_0x8e7c('0x22'),_0x6bc1b9[_0x8e7c('0x23')])])){_0x4ba60f['telephones'][util['format']('SIP/%s',_0x6bc1b9['name'])]=new Telephone(_0x6bc1b9);}else{_0x4ba60f[_0x8e7c('0x3b')](_0x4ba60f[_0x8e7c('0xd')][util[_0x8e7c('0x21')]('SIP/%s',_0x6bc1b9['name'])],_0x6bc1b9);}}}return _0x4ba60f['telephones'];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x40')]=function(){var _0x17aae2=this;return function(_0x59423c){if(_0x59423c){freeIsNotKeySip(_0x59423c,_0x17aae2[_0x8e7c('0x41')]);for(var _0x440a81=0x0,_0xbaa689={},_0x3d0c53={};_0x440a81<_0x59423c[_0x8e7c('0x3e')];_0x440a81+=0x1){_0xbaa689=_0x59423c[_0x440a81];if(_[_0x8e7c('0x3f')](_0x17aae2[_0x8e7c('0x41')][util[_0x8e7c('0x21')](_0x8e7c('0x22'),_0xbaa689[_0x8e7c('0x23')])])){_0x17aae2[_0x8e7c('0x41')][util[_0x8e7c('0x21')]('SIP/%s',_0xbaa689[_0x8e7c('0x23')])]=new Trunk(_0xbaa689);}else{_0x17aae2['mergeFromDatabase'](_0x17aae2[_0x8e7c('0x41')][util[_0x8e7c('0x21')]('SIP/%s',_0xbaa689[_0x8e7c('0x23')])],_0xbaa689);}}}return _0x17aae2[_0x8e7c('0x41')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x42')]=function(){var _0xe79c87=this;return function(_0x40331f){if(_0x40331f){freeIsNotKey(_0x40331f,_0xe79c87[_0x8e7c('0xe')],_0x8e7c('0x23'));for(var _0x484841=0x0,_0x416956={},_0x2014c1={};_0x484841<_0x40331f['length'];_0x484841+=0x1){_0x416956=_0x40331f[_0x484841];if(_[_0x8e7c('0x3f')](_0xe79c87[_0x8e7c('0xe')][_0x416956[_0x8e7c('0x23')]])){_0xe79c87[_0x8e7c('0xe')][_0x416956[_0x8e7c('0x23')]]=new VoiceQueue(_0x416956);}else{_0xe79c87[_0x8e7c('0x3b')](_0xe79c87[_0x8e7c('0xe')][_0x416956[_0x8e7c('0x23')]],_0x416956);}}}return _0xe79c87[_0x8e7c('0xe')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x43')]=function(){var _0x14e235=this;return function(_0x10f0e7){if(_0x10f0e7){freeIsNotKey(_0x10f0e7,_0x14e235[_0x8e7c('0xf')],'id');for(var _0x502b6c=0x0,_0x4fc30d={},_0x117263={};_0x502b6c<_0x10f0e7[_0x8e7c('0x3e')];_0x502b6c+=0x1){_0x4fc30d=_0x10f0e7[_0x502b6c];if(_[_0x8e7c('0x3f')](_0x14e235[_0x8e7c('0xf')][_0x4fc30d['id']])){_0x14e235[_0x8e7c('0xf')][_0x4fc30d['id']]=new Trigger(_0x4fc30d);}else{_0x14e235[_0x8e7c('0x3b')](_0x14e235[_0x8e7c('0xf')][_0x4fc30d['id']],_0x4fc30d);}}}return _0x14e235[_0x8e7c('0xf')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x44')]=function(){var _0x27a310=this;return function(_0x2e8258){if(_0x2e8258){freeIsNotKey(_0x2e8258,_0x27a310['templates'],'id');for(var _0x1329c6=0x0,_0x1b7997={},_0x593ddd={};_0x1329c6<_0x2e8258[_0x8e7c('0x3e')];_0x1329c6+=0x1){_0x1b7997=_0x2e8258[_0x1329c6];if(_['isUndefined'](_0x27a310[_0x8e7c('0x45')][_0x1b7997['id']])){_0x27a310[_0x8e7c('0x45')][_0x1b7997['id']]=new Template(_0x1b7997);}else{_0x27a310[_0x8e7c('0x3b')](_0x27a310[_0x8e7c('0x45')][_0x1b7997['id']],_0x1b7997);}}}return _0x27a310[_0x8e7c('0x45')];};};Realtime['prototype'][_0x8e7c('0x46')]=function(){var _0x359019=this;return function(_0x392d52){if(_0x392d52){freeIsNotKey(_0x392d52,_0x359019['zendeskAccounts'],'id');for(var _0x431f98=0x0,_0x229f77={},_0x59accd={};_0x431f98<_0x392d52[_0x8e7c('0x3e')];_0x431f98+=0x1){_0x229f77=_0x392d52[_0x431f98];if(_['isUndefined'](_0x359019[_0x8e7c('0x17')][_0x229f77['id']])){_0x359019['zendeskAccounts'][_0x229f77['id']]=new ZendeskAccount(_0x229f77);}else{_0x359019[_0x8e7c('0x3b')](_0x359019[_0x8e7c('0x17')][_0x229f77['id']],_0x229f77);}}}return _0x359019['zendeskAccounts'];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x47')]=function(){var _0x44ebf5=this;return function(_0x10906c){if(_0x10906c){freeIsNotKey(_0x10906c,_0x44ebf5['salesforceAccounts'],'id');for(var _0x3fe9e5=0x0,_0x44a5c7={},_0x13fddb={};_0x3fe9e5<_0x10906c['length'];_0x3fe9e5+=0x1){_0x44a5c7=_0x10906c[_0x3fe9e5];if(_[_0x8e7c('0x3f')](_0x44ebf5[_0x8e7c('0x18')][_0x44a5c7['id']])){_0x44ebf5['salesforceAccounts'][_0x44a5c7['id']]=new SalesforceAccount(_0x44a5c7);}else{_0x44ebf5[_0x8e7c('0x3b')](_0x44ebf5[_0x8e7c('0x18')][_0x44a5c7['id']],_0x44a5c7);}}}return _0x44ebf5[_0x8e7c('0x18')];};};Realtime[_0x8e7c('0x3c')]['initFreshdeskAccounts']=function(){var _0x18d7d1=this;return function(_0x4526a8){if(_0x4526a8){freeIsNotKey(_0x4526a8,_0x18d7d1['freshdeskAccounts'],'id');for(var _0x14bd45=0x0,_0x59df22={},_0x1c6f8a={};_0x14bd45<_0x4526a8[_0x8e7c('0x3e')];_0x14bd45+=0x1){_0x59df22=_0x4526a8[_0x14bd45];if(_[_0x8e7c('0x3f')](_0x18d7d1['freshdeskAccounts'][_0x59df22['id']])){_0x18d7d1['freshdeskAccounts'][_0x59df22['id']]=new FreshdeskAccount(_0x59df22);}else{_0x18d7d1[_0x8e7c('0x3b')](_0x18d7d1[_0x8e7c('0x1a')][_0x59df22['id']],_0x59df22);}}}return _0x18d7d1[_0x8e7c('0x1a')];};};Realtime['prototype'][_0x8e7c('0x48')]=function(){var _0x261296=this;return function(_0x1d37cc){if(_0x1d37cc){freeIsNotKey(_0x1d37cc,_0x261296[_0x8e7c('0x1b')],'id');for(var _0x4c992e=0x0,_0x47756f={},_0xecefef={};_0x4c992e<_0x1d37cc[_0x8e7c('0x3e')];_0x4c992e+=0x1){_0x47756f=_0x1d37cc[_0x4c992e];if(_['isUndefined'](_0x261296[_0x8e7c('0x1b')][_0x47756f['id']])){_0x261296[_0x8e7c('0x1b')][_0x47756f['id']]=new ZohoAccount(_0x47756f);}else{_0x261296[_0x8e7c('0x3b')](_0x261296['zohoAccounts'][_0x47756f['id']],_0x47756f);}}}return _0x261296[_0x8e7c('0x1b')];};};Realtime['prototype'][_0x8e7c('0x49')]=function(){var _0x2ca490=this;return function(_0x150b93){if(_0x150b93){freeIsNotKey(_0x150b93,_0x2ca490[_0x8e7c('0x4a')],'id');for(var _0x1e3870=0x0,_0x50f960={},_0x229720={};_0x1e3870<_0x150b93[_0x8e7c('0x3e')];_0x1e3870+=0x1){_0x50f960=_0x150b93[_0x1e3870];if(_[_0x8e7c('0x3f')](_0x2ca490[_0x8e7c('0x4a')][_0x50f960['id']])){_0x2ca490[_0x8e7c('0x4a')][_0x50f960['id']]=new DeskAccount(_0x50f960);}else{_0x2ca490[_0x8e7c('0x3b')](_0x2ca490['deskAccounts'][_0x50f960['id']],_0x50f960);}}}return _0x2ca490[_0x8e7c('0x4a')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x4b')]=function(){var _0x220761=this;return function(_0x25768a){if(_0x25768a){freeIsNotKey(_0x25768a,_0x220761[_0x8e7c('0x19')],'id');for(var _0x49099b=0x0,_0x1239b1={},_0x25cc1c={};_0x49099b<_0x25768a[_0x8e7c('0x3e')];_0x49099b+=0x1){_0x1239b1=_0x25768a[_0x49099b];if(_[_0x8e7c('0x3f')](_0x220761['sugarcrmAccounts'][_0x1239b1['id']])){_0x220761[_0x8e7c('0x19')][_0x1239b1['id']]=new SugarcrmAccount(_0x1239b1);}else{_0x220761[_0x8e7c('0x3b')](_0x220761[_0x8e7c('0x19')][_0x1239b1['id']],_0x1239b1);}}}return _0x220761['sugarcrmAccounts'];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x4c')]=function(){var _0x222173=this;return function(_0x1c42d1){if(_0x1c42d1){freeIsNotKey(_0x1c42d1,_0x222173[_0x8e7c('0x4d')],'id');for(var _0xe1c487=0x0,_0x5550fb={},_0x5f2764={};_0xe1c487<_0x1c42d1[_0x8e7c('0x3e')];_0xe1c487+=0x1){_0x5550fb=_0x1c42d1[_0xe1c487];if(_[_0x8e7c('0x3f')](_0x222173[_0x8e7c('0x4d')][_0x5550fb['id']])){_0x222173['vtigerAccounts'][_0x5550fb['id']]=new VtigerAccount(_0x5550fb);}else{_0x222173[_0x8e7c('0x3b')](_0x222173['vtigerAccounts'][_0x5550fb['id']],_0x5550fb);}}}return _0x222173['vtigerAccounts'];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x4e')]=function(){var _0x540983=this;return function(_0x52216c){if(_0x52216c){freeIsNotKey(_0x52216c,_0x540983[_0x8e7c('0x1c')],'id');for(var _0x8720b2=0x0,_0x376b05={},_0x1dd1f7={};_0x8720b2<_0x52216c['length'];_0x8720b2+=0x1){_0x376b05=_0x52216c[_0x8720b2];if(_[_0x8e7c('0x3f')](_0x540983[_0x8e7c('0x1c')][_0x376b05['id']])){_0x540983[_0x8e7c('0x1c')][_0x376b05['id']]=new ServicenowAccount(_0x376b05);}else{_0x540983[_0x8e7c('0x3b')](_0x540983[_0x8e7c('0x1c')][_0x376b05['id']],_0x376b05);}}}return _0x540983[_0x8e7c('0x1c')];};};Realtime[_0x8e7c('0x3c')]['initDynamics365Accounts']=function(){var _0x1669e7=this;return function(_0x565992){if(_0x565992){freeIsNotKey(_0x565992,_0x1669e7[_0x8e7c('0x1d')],'id');for(var _0x3afa7e=0x0,_0x3407c3={},_0x1958c4={};_0x3afa7e<_0x565992[_0x8e7c('0x3e')];_0x3afa7e+=0x1){_0x3407c3=_0x565992[_0x3afa7e];if(_[_0x8e7c('0x3f')](_0x1669e7['dynamics365Accounts'][_0x3407c3['id']])){_0x1669e7[_0x8e7c('0x1d')][_0x3407c3['id']]=new Dynamics365Account(_0x3407c3);}else{_0x1669e7[_0x8e7c('0x3b')](_0x1669e7['dynamics365Accounts'][_0x3407c3['id']],_0x3407c3);}}}return _0x1669e7[_0x8e7c('0x1d')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x4f')]=function(){var _0x118b8c=this;return function(_0x4b380b){if(_0x4b380b){freeIsNotKey(_0x4b380b,_0x118b8c[_0x8e7c('0x1e')],'id');for(var _0x44ebb4=0x0,_0x43e3d6={},_0x126ffa={};_0x44ebb4<_0x4b380b['length'];_0x44ebb4+=0x1){_0x43e3d6=_0x4b380b[_0x44ebb4];if(_[_0x8e7c('0x3f')](_0x118b8c[_0x8e7c('0x1e')][_0x43e3d6['id']])){_0x118b8c[_0x8e7c('0x1e')][_0x43e3d6['id']]=new FreshsalesAccount(_0x43e3d6);}else{_0x118b8c[_0x8e7c('0x3b')](_0x118b8c['freshsalesAccounts'][_0x43e3d6['id']],_0x43e3d6);}}}return _0x118b8c[_0x8e7c('0x1e')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x50')]=function(){var _0x4275fb=this;return function(_0x3d5ce3){for(var _0xf58cd6=0x0;_0xf58cd6<_0x3d5ce3[_0x8e7c('0x3e')];_0xf58cd6+=0x1){_[_0x8e7c('0x51')](_0x4275fb['voiceQueues'][_0x3d5ce3[_0xf58cd6][_0x8e7c('0x23')]],_0x3d5ce3[_0xf58cd6]);}return _0x4275fb[_0x8e7c('0xe')];};};Realtime[_0x8e7c('0x3c')]['initVoiceQueueReports']=function(){var _0x247163=this;return function(_0x2912b8){clearVoiceQueues(_0x247163[_0x8e7c('0xe')]);if(_0x2912b8){_0x2912b8=_[_0x8e7c('0x52')](_0x2912b8,_0x8e7c('0x53'));for(var _0xfb4f51 in _0x2912b8){if(_0x2912b8[_0x8e7c('0x24')](_0xfb4f51)){var _0x4387d2={};for(var _0x1df3cc=0x0;_0x1df3cc<_0x2912b8[_0xfb4f51][_0x8e7c('0x3e')];_0x1df3cc+=0x1){var _0x2d182b=_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x54')];if(_0x247163[_0x8e7c('0xe')][_0x2d182b]){if(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x55')]){_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x56')]+=0x1;}if(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x57')]){_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x2e')]+=0x1;}_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x29')]+=moment(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x58')])['diff'](moment(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x59')]),'seconds')||0x0;if(_0x1df3cc===_0x2912b8[_0xfb4f51][_0x8e7c('0x3e')]-0x1){_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x5a')]+=moment(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x5b')]||_0x2912b8[_0xfb4f51][_0x1df3cc]['queuecallerabandonAt']||_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x5c')])[_0x8e7c('0x5d')](moment(_0x2912b8[_0xfb4f51][_0x1df3cc]['queuecallerjoinAt']),'seconds')||0x0;_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x27')]+=0x1;if(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x5e')]){_0x247163['voiceQueues'][_0x2d182b][_0x8e7c('0x28')]+=0x1;_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x2a')]+=moment(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x5b')])['diff'](moment(_0x2912b8[_0xfb4f51][_0x1df3cc][_0x8e7c('0x58')]),'seconds')||0x0;}}else{_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x5a')]+=_0x247163[_0x8e7c('0xe')][_0x2d182b][_0x8e7c('0x29')]||0x0;}}}}}}return _0x247163[_0x8e7c('0xe')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x5f')]=function(){var _0x5431db=this;return function(_0x5291cb){clearVoiceCallReports(_0x5431db[_0x8e7c('0x11')]);if(_0x5291cb){for(var _0x4c6622=0x0;_0x4c6622<_0x5291cb[_0x8e7c('0x3e')];_0x4c6622+=0x1){_0x5431db['outbound'][_0x8e7c('0x27')]+=0x1;_0x5431db[_0x8e7c('0x11')][_0x8e7c('0x5a')]+=_0x5291cb[_0x4c6622][_0x8e7c('0x60')];if(_0x5291cb[_0x4c6622][_0x8e7c('0x61')]===_0x8e7c('0x62')){_0x5431db[_0x8e7c('0x11')][_0x8e7c('0x28')]+=0x1;_0x5431db['outbound'][_0x8e7c('0x29')]+=_0x5291cb[_0x4c6622][_0x8e7c('0x60')]-_0x5291cb[_0x4c6622][_0x8e7c('0x63')]||0x0;_0x5431db[_0x8e7c('0x11')][_0x8e7c('0x2a')]+=_0x5291cb[_0x4c6622]['billableseconds'];}}}return _0x5431db[_0x8e7c('0x11')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x64')]=function(){var _0x2f0ab8=this;return function(_0x5b2b70){if(_0x5b2b70){freeIsNotKey(_0x5b2b70,_0x2f0ab8[_0x8e7c('0x10')],_0x8e7c('0x23'));for(var _0x233e19=0x0,_0x19d962={};_0x233e19<_0x5b2b70[_0x8e7c('0x3e')];_0x233e19+=0x1){_0x19d962=_0x5b2b70[_0x233e19];if(_[_0x8e7c('0x3f')](_0x2f0ab8[_0x8e7c('0x10')][_0x19d962[_0x8e7c('0x23')]])){_0x2f0ab8[_0x8e7c('0x10')][_0x19d962['name']]=new Campaign(_0x19d962);}else{_0x2f0ab8[_0x8e7c('0x3b')](_0x2f0ab8[_0x8e7c('0x10')][_0x19d962[_0x8e7c('0x23')]],_0x19d962);}}}return _0x2f0ab8[_0x8e7c('0x10')];};};Realtime['prototype'][_0x8e7c('0x65')]=function(){var _0x15bb87=this;return function(_0x2eebd8){if(_0x2eebd8){freeIsNotKey(_0x2eebd8,_0x15bb87[_0x8e7c('0x12')],'id');for(var _0x48c086=0x0,_0x26b383={};_0x48c086<_0x2eebd8[_0x8e7c('0x3e')];_0x48c086+=0x1){_0x26b383=_0x2eebd8[_0x48c086];if(_['isUndefined'](_0x15bb87[_0x8e7c('0x12')][_0x26b383['id']])){_0x15bb87[_0x8e7c('0x12')][_0x26b383['id']]=new VoiceExtension(_0x26b383);}else{_0x15bb87[_0x8e7c('0x3b')](_0x15bb87[_0x8e7c('0x12')][_0x26b383['id']],_0x26b383);}}}return _0x15bb87[_0x8e7c('0x12')];};};Realtime[_0x8e7c('0x3c')][_0x8e7c('0x66')]=function(){var _0x3654db=this;return function(_0x3d7c10){clearCampaigns(_0x3654db[_0x8e7c('0x10')]);for(var _0x401231=0x0;_0x401231<_0x3d7c10[_0x8e7c('0x3e')];_0x401231+=0x1){_[_0x8e7c('0x51')](_0x3654db[_0x8e7c('0x10')][_0x3d7c10[_0x401231]['name']],_0x3d7c10[_0x401231]);}return _0x3654db[_0x8e7c('0x10')];};};Realtime[_0x8e7c('0x3c')]['initFaxAccounts']=function(){var _0x300fc4=this;return function(_0x53b1d3){if(_0x53b1d3){freeIsNotKey(_0x53b1d3,_0x300fc4[_0x8e7c('0x1f')],'id');for(var _0x127b6=0x0,_0x4893e3={},_0x28ee8a={};_0x127b6<_0x53b1d3[_0x8e7c('0x3e')];_0x127b6+=0x1){_0x4893e3=_0x53b1d3[_0x127b6];if(_[_0x8e7c('0x3f')](_0x300fc4['faxAccounts'][_0x4893e3['id']])){_0x300fc4['faxAccounts'][_0x4893e3['id']]=new FaxAccount(_0x4893e3);}else{_0x300fc4[_0x8e7c('0x3b')](_0x300fc4[_0x8e7c('0x1f')][_0x4893e3['id']],_0x4893e3);}}}return _0x300fc4[_0x8e7c('0x1f')];};};module[_0x8e7c('0x67')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 0358dd4..26a3821 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 _0x6a29=['phone','lastIndexOf','blindTransfer','exports','lodash','moment','util','../ami','../rpc/voiceAgentReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','sync','xdr','custom:voiceQueueReport','voiceQueueReport','custom:voiceCallReport','voiceCallReport','bind','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer','prototype','find','accountcode','name','isNil','telephones','interface','SIP/%s','length','findAgent','connectedlinenum','assigned','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','lastapplication','queue','context','from-voip-provider','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','calleridpreview','disposition','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','indexOf','mobile'];(function(_0x28b12e,_0x59f4f5){var _0x2c3bd1=function(_0x1680c1){while(--_0x1680c1){_0x28b12e['push'](_0x28b12e['shift']());}};_0x2c3bd1(++_0x59f4f5);}(_0x6a29,0x150));var _0x96a2=function(_0x532f5c,_0x52bc44){_0x532f5c=_0x532f5c-0x0;var _0x1df091=_0x6a29[_0x532f5c];return _0x1df091;};'use strict';var BPromise=require('bluebird');var _=require(_0x96a2('0x0'));var moment=require(_0x96a2('0x1'));var util=require(_0x96a2('0x2'));var config=require('../../../config/environment');var logger=require('../../../config/logger')('ami');var ami=require(_0x96a2('0x3'));var RpcVoiceAgentReport=require(_0x96a2('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0x96a2('0x5'));var RpcVoiceTransferReport=require(_0x96a2('0x6'));var VoiceQueueReport=require(_0x96a2('0x7'));var VoiceCallReport=require(_0x96a2('0x8'));var VoiceAgentReport=require(_0x96a2('0x9'));var VoiceDialReport=require(_0x96a2('0xa'));var UserReport=require(_0x96a2('0xb'));function Report(_0x4e5f25){this[_0x96a2('0xc')]=_0x4e5f25;this[_0x96a2('0xd')]=_0x4e5f25[_0x96a2('0xd')];this['telephones']=_0x4e5f25['telephones'];}Report['prototype'][_0x96a2('0xe')]=function(_0x4aaf9f){var _0x394338=new VoiceQueueReport(this[_0x96a2('0xc')]);var _0x3e1072=new VoiceAgentReport(this[_0x96a2('0xc')]);var _0x28dd6e=new VoiceDialReport(this[_0x96a2('0xc')]);var _0x4792f8=new VoiceCallReport(this[_0x96a2('0xc')]);var _0x3c9b63=new UserReport(this[_0x96a2('0xc')]);if(config[_0x96a2('0xf')]&&config[_0x96a2('0xf')]['disabled']){ami['on'](_0x96a2('0x10'),this[_0x96a2('0x11')]['bind'](this));ami['on'](_0x96a2('0x12'),this[_0x96a2('0x13')][_0x96a2('0x14')](this));ami['on'](_0x96a2('0x15'),this[_0x96a2('0x16')][_0x96a2('0x14')](this));ami['on'](_0x96a2('0x17'),this[_0x96a2('0x18')][_0x96a2('0x14')](this));ami['on'](_0x96a2('0x19'),this['blindTransfer'][_0x96a2('0x14')](this));ami['on'](_0x96a2('0x1a'),this[_0x96a2('0x1b')][_0x96a2('0x14')](this));}};Report[_0x96a2('0x1c')]['findAgent']=function(_0x4da286){var _0x1765be=undefined;_0x1765be=_[_0x96a2('0x1d')](this[_0x96a2('0xd')],function(_0x10197b){return _0x10197b[_0x96a2('0x1e')]==_0x4da286||_0x10197b[_0x96a2('0x1f')]==_0x4da286;});if(_[_0x96a2('0x20')](_0x1765be)){var _0x23f3d8=_[_0x96a2('0x1d')](this[_0x96a2('0x21')],function(_0x526cc2){return _0x526cc2[_0x96a2('0x1e')]==_0x4da286||_0x526cc2[_0x96a2('0x1f')]==_0x4da286;});if(_0x23f3d8){_0x1765be=_[_0x96a2('0x1d')](this['agents'],function(_0x3c5371){return _0x3c5371[_0x96a2('0x22')]==util['format'](_0x96a2('0x23'),_0x23f3d8[_0x96a2('0x1f')]);});}}return _0x1765be;};Report[_0x96a2('0x1c')][_0x96a2('0x11')]=function(_0x3917ed){for(var _0x25f2f6=0x0;_0x25f2f6<_0x3917ed[_0x96a2('0x24')];_0x25f2f6+=0x1){var _0x31e75f=this[_0x96a2('0x25')](_0x3917ed[_0x25f2f6][_0x96a2('0x26')]);if(_0x31e75f){_0x3917ed[_0x25f2f6][_0x96a2('0x1e')]=_0x31e75f[_0x96a2('0x1e')];_0x3917ed[_0x25f2f6][_0x96a2('0x27')]=!![];_0x3917ed[_0x25f2f6][_0x96a2('0x28')]=_0x31e75f[_0x96a2('0x1f')];_0x3917ed[_0x25f2f6][_0x96a2('0x22')]=_[_0x96a2('0x20')](_0x31e75f[_0x96a2('0x22')])?util[_0x96a2('0x29')](_0x96a2('0x23'),_0x31e75f[_0x96a2('0x1f')]):_0x31e75f['interface'];if(_0x3917ed[_0x25f2f6][_0x96a2('0x2a')]){_0x3917ed[_0x25f2f6][_0x96a2('0x2b')]=moment()[_0x96a2('0x29')](_0x96a2('0x2c'));}if(_0x3917ed[_0x25f2f6][_0x96a2('0x2d')]){_0x3917ed[_0x25f2f6][_0x96a2('0x2e')]=moment()[_0x96a2('0x29')](_0x96a2('0x2c'));}RpcMemberReport[_0x96a2('0x11')](_0x3917ed[_0x25f2f6]);}RpcVoiceQueueReport[_0x96a2('0x2f')](_0x3917ed[_0x25f2f6]);}};function extractCalleridNumber(_0x50d9d8){var _0x319b4f=_0x50d9d8[_0x96a2('0x30')](/<(.*?)>/);return _0x319b4f?_0x319b4f[0x1]:_0x50d9d8;}Report[_0x96a2('0x1c')]['voiceCallReport']=function(_0x58fa6c){_0x58fa6c['destination']=_0x58fa6c[_0x96a2('0x31')]||_0x58fa6c[_0x96a2('0x32')];if(_0x58fa6c[_0x96a2('0x33')]==_0x96a2('0x34')){_0x58fa6c[_0x96a2('0x35')]='queue';_0x58fa6c['lastdata']=_0x58fa6c[_0x96a2('0x36')];if(_0x58fa6c[_0x96a2('0x37')]==_0x96a2('0x38')){_0x58fa6c[_0x96a2('0x1e')]='';_0x58fa6c[_0x96a2('0x31')]=extractCalleridNumber(_0x58fa6c['callerid']);}else if(_0x58fa6c[_0x96a2('0x37')]==_0x96a2('0x39')){if(_0x58fa6c[_0x96a2('0x31')]==_0x96a2('0x3a')){_0x58fa6c['destination']=extractCalleridNumber(_0x58fa6c['calleridpreview']);_0x58fa6c[_0x96a2('0x3b')]=_0x58fa6c[_0x96a2('0x3c')];_0x58fa6c[_0x96a2('0x3d')]=[_0x58fa6c[_0x96a2('0x3e')],_0x58fa6c[_0x96a2('0x3e')]=_0x58fa6c['destinationchannel']][0x0];_0x58fa6c[_0x96a2('0x3f')]=_0x58fa6c[_0x96a2('0x40')];}else{_0x58fa6c[_0x96a2('0x31')]=_0x58fa6c[_0x96a2('0x3b')];_0x58fa6c[_0x96a2('0x3b')]=_0x58fa6c[_0x96a2('0x3c')];if(_0x58fa6c[_0x96a2('0x41')]=='ANSWERED'){_0x58fa6c[_0x96a2('0x1e')]=_0x58fa6c[_0x96a2('0x26')];}else{_0x58fa6c[_0x96a2('0x1e')]='';}}}}else{_0x58fa6c[_0x96a2('0x3f')]=util[_0x96a2('0x29')](_0x96a2('0x42'),_0x58fa6c[_0x96a2('0x43')],_0x58fa6c[_0x96a2('0x3b')]);}RpcVoiceCallReport['create'](_0x58fa6c);if(_0x58fa6c[_0x96a2('0x44')]){for(var _0x3c488c=0x0;_0x3c488c<_0x58fa6c['monitors'][_0x96a2('0x24')];_0x3c488c+=0x1){_0x58fa6c['monitorFilename']=_0x58fa6c[_0x96a2('0x45')][_0x3c488c]['filename'];_0x58fa6c['createdAt']=_0x58fa6c['monitors'][_0x3c488c]['createdAt'];if(_0x58fa6c[_0x96a2('0x32')]=='xcally-motion-preview'){_0x58fa6c[_0x96a2('0x3b')]=_0x58fa6c[_0x96a2('0x26')];_0x58fa6c['calleridname']=_0x58fa6c['connectedlinename'];_0x58fa6c[_0x96a2('0x26')]=_0x58fa6c[_0x96a2('0x1e')];_0x58fa6c[_0x96a2('0x46')]=_0x58fa6c[_0x96a2('0x47')];_0x58fa6c[_0x96a2('0x32')]=_0x58fa6c['originatecalleridnum'];}else if(_0x58fa6c[_0x96a2('0x32')]==_0x96a2('0x48')){_0x58fa6c[_0x96a2('0x3b')]=_0x58fa6c[_0x96a2('0x31')];_0x58fa6c[_0x96a2('0x32')]=_0x58fa6c[_0x96a2('0x3c')];}RpcVoiceRecording[_0x96a2('0x2f')](_0x58fa6c);}}};Report[_0x96a2('0x1c')][_0x96a2('0x16')]=function(_0x24c0e3){if(_[_0x96a2('0x49')](_0x24c0e3)){_0x24c0e3[_0x96a2('0x4a')](function(_0x4e05f2){RpcVoiceAgentReport[_0x96a2('0x2f')](_0x4e05f2);});}else{RpcVoiceAgentReport[_0x96a2('0x2f')](_0x24c0e3);}};Report[_0x96a2('0x1c')]['voiceDialReport']=function(_0xfc648c){RpcVoiceDialReport['create'](_0xfc648c);var _0x41253c=undefined;var _0x2e9b1f=_0xfc648c[_0x96a2('0x3e')];if(_['startsWith'](_0x2e9b1f,_0x96a2('0x4b'))){var _0x221c0f=_0x2e9b1f[_0x96a2('0x4c')](_0x2e9b1f[_0x96a2('0x4d')]('/')+0x1,_0x2e9b1f[_0x96a2('0x4d')]('@'));_0x41253c=_[_0x96a2('0x1d')](this[_0x96a2('0xd')],function(_0x16cb46){return _0x16cb46[_0x96a2('0x4e')]==_0x221c0f||_0x16cb46[_0x96a2('0x4f')]==_0x221c0f||_0x16cb46['accountcode']==_0x221c0f;});}else{var _0x221c0f=_0x2e9b1f[_0x96a2('0x4c')](_0x2e9b1f['indexOf']('/')+0x1,_0x2e9b1f[_0x96a2('0x50')]('-'));_0x41253c=this['findAgent'](_0x221c0f);}if(_0x41253c){_0xfc648c[_0x96a2('0x22')]=_['isNil'](_0x41253c[_0x96a2('0x22')])?util[_0x96a2('0x29')](_0x96a2('0x23'),_0x41253c[_0x96a2('0x1f')]):_0x41253c[_0x96a2('0x22')];_0xfc648c[_0x96a2('0x47')]=_0x41253c[_0x96a2('0x1f')];_0xfc648c[_0x96a2('0x1e')]=_0x41253c[_0x96a2('0x1e')];RpcMemberReport['voiceDialReport'](_0xfc648c);}};Report[_0x96a2('0x1c')][_0x96a2('0x51')]=function(_0x31c735){RpcVoiceTransferReport[_0x96a2('0x51')](_0x31c735);};Report[_0x96a2('0x1c')][_0x96a2('0x1b')]=function(_0x404601){RpcVoiceTransferReport[_0x96a2('0x1b')](_0x404601);};module[_0x96a2('0x52')]=Report; \ No newline at end of file +var _0xa37b=['findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallerexit','queuecallerexitAt','YYYY-MM-DD\x20HH:mm:ss','create','match','destination','exten','dialer','lastapplication','queue','lastdata','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','channel','calleridpreview','disposition','ANSWERED','\x22%s\x22\x20<%s>','calleridname','monitor','monitors','monitorFilename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','Local','substring','mobile','phone','blindTransfer','exports','bluebird','lodash','moment','util','ami','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','realtime','agents','telephones','prototype','sync','xdr','custom:voiceQueueReport','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','attendedtransfer','attendedTransfer'];(function(_0x21549c,_0x6d64d1){var _0x426cbd=function(_0x323f5b){while(--_0x323f5b){_0x21549c['push'](_0x21549c['shift']());}};_0x426cbd(++_0x6d64d1);}(_0xa37b,0x137));var _0xba37=function(_0x408b34,_0xb7d872){_0x408b34=_0x408b34-0x0;var _0x1182aa=_0xa37b[_0x408b34];return _0x1182aa;};'use strict';var BPromise=require(_0xba37('0x0'));var _=require(_0xba37('0x1'));var moment=require(_0xba37('0x2'));var util=require(_0xba37('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xba37('0x4'));var ami=require(_0xba37('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xba37('0x6'));var RpcVoiceDialReport=require(_0xba37('0x7'));var RpcMemberReport=require(_0xba37('0x8'));var RpcVoiceQueueReport=require('../rpc/voiceQueueReport');var RpcVoiceRecording=require(_0xba37('0x9'));var RpcVoiceTransferReport=require(_0xba37('0xa'));var VoiceQueueReport=require(_0xba37('0xb'));var VoiceCallReport=require(_0xba37('0xc'));var VoiceAgentReport=require(_0xba37('0xd'));var VoiceDialReport=require(_0xba37('0xe'));var UserReport=require('./userReport');function Report(_0x4b6571){this[_0xba37('0xf')]=_0x4b6571;this[_0xba37('0x10')]=_0x4b6571[_0xba37('0x10')];this[_0xba37('0x11')]=_0x4b6571['telephones'];}Report[_0xba37('0x12')][_0xba37('0x13')]=function(_0x295945){var _0x2da6cf=new VoiceQueueReport(this[_0xba37('0xf')]);var _0x5d1c2f=new VoiceAgentReport(this[_0xba37('0xf')]);var _0x46c349=new VoiceDialReport(this[_0xba37('0xf')]);var _0x55951e=new VoiceCallReport(this[_0xba37('0xf')]);var _0x1cf7ea=new UserReport(this['realtime']);if(config['xdr']&&config[_0xba37('0x14')]['disabled']){ami['on'](_0xba37('0x15'),this[_0xba37('0x16')][_0xba37('0x17')](this));ami['on'](_0xba37('0x18'),this[_0xba37('0x19')][_0xba37('0x17')](this));ami['on'](_0xba37('0x1a'),this[_0xba37('0x1b')][_0xba37('0x17')](this));ami['on'](_0xba37('0x1c'),this[_0xba37('0x1d')][_0xba37('0x17')](this));ami['on'](_0xba37('0x1e'),this['blindTransfer'][_0xba37('0x17')](this));ami['on'](_0xba37('0x1f'),this[_0xba37('0x20')][_0xba37('0x17')](this));}};Report[_0xba37('0x12')][_0xba37('0x21')]=function(_0x50159b){var _0x2520b5=undefined;_0x2520b5=_[_0xba37('0x22')](this[_0xba37('0x10')],function(_0x116b96){return _0x116b96[_0xba37('0x23')]==_0x50159b||_0x116b96['name']==_0x50159b;});if(_[_0xba37('0x24')](_0x2520b5)){var _0x17f325=_[_0xba37('0x22')](this[_0xba37('0x11')],function(_0x2dc0e5){return _0x2dc0e5[_0xba37('0x23')]==_0x50159b||_0x2dc0e5[_0xba37('0x25')]==_0x50159b;});if(_0x17f325){_0x2520b5=_[_0xba37('0x22')](this['agents'],function(_0x147cc9){return _0x147cc9[_0xba37('0x26')]==util[_0xba37('0x27')](_0xba37('0x28'),_0x17f325[_0xba37('0x25')]);});}}return _0x2520b5;};Report[_0xba37('0x12')][_0xba37('0x16')]=function(_0x340e9c){for(var _0x33a42c=0x0;_0x33a42c<_0x340e9c[_0xba37('0x29')];_0x33a42c+=0x1){var _0x4a8024=this[_0xba37('0x21')](_0x340e9c[_0x33a42c][_0xba37('0x2a')]);if(_0x4a8024){_0x340e9c[_0x33a42c][_0xba37('0x23')]=_0x4a8024['accountcode'];_0x340e9c[_0x33a42c][_0xba37('0x2b')]=!![];_0x340e9c[_0x33a42c][_0xba37('0x2c')]=_0x4a8024['name'];_0x340e9c[_0x33a42c][_0xba37('0x26')]=_[_0xba37('0x24')](_0x4a8024[_0xba37('0x26')])?util[_0xba37('0x27')](_0xba37('0x28'),_0x4a8024['name']):_0x4a8024[_0xba37('0x26')];if(_0x340e9c[_0x33a42c][_0xba37('0x2d')]){_0x340e9c[_0x33a42c]['queuecallercompleteAt']=moment()[_0xba37('0x27')]('YYYY-MM-DD\x20HH:mm:ss');}if(_0x340e9c[_0x33a42c][_0xba37('0x2e')]){_0x340e9c[_0x33a42c][_0xba37('0x2f')]=moment()[_0xba37('0x27')](_0xba37('0x30'));}RpcMemberReport[_0xba37('0x16')](_0x340e9c[_0x33a42c]);}RpcVoiceQueueReport[_0xba37('0x31')](_0x340e9c[_0x33a42c]);}};function extractCalleridNumber(_0x133522){var _0x584a3a=_0x133522[_0xba37('0x32')](/<(.*?)>/);return _0x584a3a?_0x584a3a[0x1]:_0x133522;}Report[_0xba37('0x12')][_0xba37('0x19')]=function(_0x15d98d){_0x15d98d[_0xba37('0x33')]=_0x15d98d[_0xba37('0x33')]||_0x15d98d[_0xba37('0x34')];if(_0x15d98d['type']==_0xba37('0x35')){_0x15d98d[_0xba37('0x36')]=_0xba37('0x37');_0x15d98d[_0xba37('0x38')]=_0x15d98d['queue'];if(_0x15d98d['context']==_0xba37('0x39')){_0x15d98d[_0xba37('0x23')]='';_0x15d98d['destination']=extractCalleridNumber(_0x15d98d[_0xba37('0x3a')]);}else if(_0x15d98d[_0xba37('0x3b')]==_0xba37('0x3c')){if(_0x15d98d[_0xba37('0x33')]==_0xba37('0x3d')){_0x15d98d[_0xba37('0x33')]=extractCalleridNumber(_0x15d98d['calleridpreview']);_0x15d98d[_0xba37('0x3e')]=_0x15d98d[_0xba37('0x3f')];_0x15d98d[_0xba37('0x40')]=[_0x15d98d[_0xba37('0x41')],_0x15d98d[_0xba37('0x41')]=_0x15d98d[_0xba37('0x40')]][0x0];_0x15d98d[_0xba37('0x3a')]=_0x15d98d[_0xba37('0x42')];}else{_0x15d98d['destination']=_0x15d98d[_0xba37('0x3e')];_0x15d98d[_0xba37('0x3e')]=_0x15d98d[_0xba37('0x3f')];if(_0x15d98d[_0xba37('0x43')]==_0xba37('0x44')){_0x15d98d[_0xba37('0x23')]=_0x15d98d[_0xba37('0x2a')];}else{_0x15d98d[_0xba37('0x23')]='';}}}}else{_0x15d98d[_0xba37('0x3a')]=util[_0xba37('0x27')](_0xba37('0x45'),_0x15d98d[_0xba37('0x46')],_0x15d98d[_0xba37('0x3e')]);}RpcVoiceCallReport[_0xba37('0x31')](_0x15d98d);if(_0x15d98d[_0xba37('0x47')]){for(var _0x79b4be=0x0;_0x79b4be<_0x15d98d[_0xba37('0x48')][_0xba37('0x29')];_0x79b4be+=0x1){_0x15d98d[_0xba37('0x49')]=_0x15d98d[_0xba37('0x48')][_0x79b4be]['filename'];_0x15d98d[_0xba37('0x4a')]=_0x15d98d['monitors'][_0x79b4be][_0xba37('0x4a')];if(_0x15d98d[_0xba37('0x34')]==_0xba37('0x3d')){_0x15d98d['calleridnum']=_0x15d98d[_0xba37('0x2a')];_0x15d98d[_0xba37('0x46')]=_0x15d98d[_0xba37('0x4b')];_0x15d98d[_0xba37('0x2a')]=_0x15d98d['accountcode'];_0x15d98d[_0xba37('0x4b')]=_0x15d98d[_0xba37('0x4c')];_0x15d98d[_0xba37('0x34')]=_0x15d98d[_0xba37('0x3f')];}else if(_0x15d98d[_0xba37('0x34')]==_0xba37('0x4d')){_0x15d98d[_0xba37('0x3e')]=_0x15d98d[_0xba37('0x33')];_0x15d98d[_0xba37('0x34')]=_0x15d98d[_0xba37('0x3f')];}RpcVoiceRecording['create'](_0x15d98d);}}};Report[_0xba37('0x12')][_0xba37('0x1b')]=function(_0x2a82e2){if(_[_0xba37('0x4e')](_0x2a82e2)){_0x2a82e2[_0xba37('0x4f')](function(_0x3f4765){RpcVoiceAgentReport[_0xba37('0x31')](_0x3f4765);});}else{RpcVoiceAgentReport[_0xba37('0x31')](_0x2a82e2);}};Report['prototype']['voiceDialReport']=function(_0x3ee7b2){RpcVoiceDialReport[_0xba37('0x31')](_0x3ee7b2);var _0x4ffc74=undefined;var _0x31aa6d=_0x3ee7b2['channel'];if(_['startsWith'](_0x31aa6d,_0xba37('0x50'))){var _0x463021=_0x31aa6d[_0xba37('0x51')](_0x31aa6d['indexOf']('/')+0x1,_0x31aa6d['indexOf']('@'));_0x4ffc74=_['find'](this[_0xba37('0x10')],function(_0x554412){return _0x554412[_0xba37('0x52')]==_0x463021||_0x554412[_0xba37('0x53')]==_0x463021||_0x554412[_0xba37('0x23')]==_0x463021;});}else{var _0x463021=_0x31aa6d[_0xba37('0x51')](_0x31aa6d['indexOf']('/')+0x1,_0x31aa6d['lastIndexOf']('-'));_0x4ffc74=this['findAgent'](_0x463021);}if(_0x4ffc74){_0x3ee7b2[_0xba37('0x26')]=_['isNil'](_0x4ffc74[_0xba37('0x26')])?util[_0xba37('0x27')](_0xba37('0x28'),_0x4ffc74['name']):_0x4ffc74[_0xba37('0x26')];_0x3ee7b2['membername']=_0x4ffc74['name'];_0x3ee7b2[_0xba37('0x23')]=_0x4ffc74['accountcode'];RpcMemberReport[_0xba37('0x1d')](_0x3ee7b2);}};Report[_0xba37('0x12')][_0xba37('0x54')]=function(_0x4f21ed){RpcVoiceTransferReport[_0xba37('0x54')](_0x4f21ed);};Report['prototype']['attendedTransfer']=function(_0x5ca99d){RpcVoiceTransferReport[_0xba37('0x20')](_0x5ca99d);};module[_0xba37('0x55')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 1fce202..2ec4460 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 _0x3401=['actionSipShowRegistry','actionDeviceStateList','actionSipPeerStatus','error','inspect','loopSyncRealTimeShow','catch','[loopSyncRealTimeShow]','prototype','isUndefined','emit','isNotNull','find','username','merge','event','actionid','state','format','trunk:%s','trunk:save','[syncRegistry][UserReport]','syncDeviceState','device','toLowerCase','inuse','local','stateTime','toNumber','updateStatusRealtime','telephone:%s','name','telephone:save','startsWith','Local','indexOf','mobile','phone','accountcode','registered','peer','status','address','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','peerstatus','syncPeerStatus','resolve','then'];(function(_0x18261f,_0x3eddfa){var _0x1c5910=function(_0x57224e){while(--_0x57224e){_0x18261f['push'](_0x18261f['shift']());}};_0x1c5910(++_0x3eddfa);}(_0x3401,0x176));var _0x1340=function(_0x5b04d4,_0x17a9be){_0x5b04d4=_0x5b04d4-0x0;var _0x1106c8=_0x3401[_0x5b04d4];return _0x1106c8;};'use strict';var _=require(_0x1340('0x0'));var moment=require(_0x1340('0x1'));var BPromise=require(_0x1340('0x2'));var util=require('util');var Redis=require(_0x1340('0x3'));var config=require(_0x1340('0x4'));var logger=require(_0x1340('0x5'))('ami');var ami=require(_0x1340('0x6'));config[_0x1340('0x7')]=_[_0x1340('0x8')](config[_0x1340('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x1340('0x9'))(new Redis(config['redis']));function UserReport(_0x34f567){this[_0x1340('0xa')]=_0x34f567[_0x1340('0xa')];this[_0x1340('0xb')]=_0x34f567['agents'];this[_0x1340('0xc')]=_0x34f567[_0x1340('0xc')];ami['on'](_0x1340('0xd'),this[_0x1340('0xe')][_0x1340('0xf')](this));ami['on'](_0x1340('0x10'),this[_0x1340('0xe')][_0x1340('0xf')](this));ami['on'](_0x1340('0x11'),this['syncDeviceState'][_0x1340('0xf')](this));ami['on'](_0x1340('0x12'),this[_0x1340('0x13')][_0x1340('0xf')](this));this['loopSyncRealTimeShow']();return BPromise[_0x1340('0x14')]()[_0x1340('0x15')](ami[_0x1340('0x16')]())[_0x1340('0x15')](ami[_0x1340('0x17')]())['then'](ami[_0x1340('0x18')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5154fb){return function(_0x1272cb){logger[_0x1340('0x19')](_0x5154fb,util[_0x1340('0x1a')](_0x1272cb,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0x1340('0x1b')]=function(){setInterval(function(){BPromise[_0x1340('0x14')]()[_0x1340('0x15')](ami[_0x1340('0x16')]())[_0x1340('0x15')](ami[_0x1340('0x17')]())[_0x1340('0x15')](ami[_0x1340('0x18')]())[_0x1340('0x1c')](loggerCatch(_0x1340('0x1d')));},0x32c8);};UserReport[_0x1340('0x1e')]['isNotNull']=function(_0x59bcfa){return _0x59bcfa!==null&&!_[_0x1340('0x1f')](_0x59bcfa);};UserReport[_0x1340('0x1e')][_0x1340('0x20')]=function(_0x353b9e,_0x8ff3af,_0xde16a8){io['to'](_0x353b9e)['emit'](_0x8ff3af,_0xde16a8);};UserReport[_0x1340('0x1e')][_0x1340('0xe')]=function(_0x22bf6a){try{if(this[_0x1340('0x21')](_0x22bf6a)){var _0x4bca13=_[_0x1340('0x22')](this[_0x1340('0xa')],{'registry':_0x22bf6a[_0x1340('0x23')]});if(_0x4bca13){_0x22bf6a['stateRegistry']=_0x22bf6a['state'];_[_0x1340('0x24')](_0x4bca13,_['omit'](_0x22bf6a,[_0x1340('0x25'),_0x1340('0x26'),_0x1340('0x23'),_0x1340('0x27')]));this['emit'](util[_0x1340('0x28')](_0x1340('0x29'),_0x4bca13['name']),_0x1340('0x2a'),_0x4bca13);}}}catch(_0x3b4e6c){logger[_0x1340('0x19')](_0x1340('0x2b'),util['inspect'](_0x3b4e6c,{'showHidden':![],'depth':null}));}};UserReport['prototype'][_0x1340('0x2c')]=function(_0x18b5cd){try{if(this[_0x1340('0x21')](_0x18b5cd)){if(this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]]){if(!this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]]['local']||_0x18b5cd['state'][_0x1340('0x2e')]()==_0x1340('0x2f')){this['agents'][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x30')]=![];if(this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x27')]!==_0x18b5cd[_0x1340('0x27')][_0x1340('0x2e')]()){this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x31')]=_[_0x1340('0x32')](moment()[_0x1340('0x28')]('x'));}this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x27')]=_0x18b5cd[_0x1340('0x27')]['toLowerCase']();this[_0x1340('0xb')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x33')](_0x18b5cd);}}else if(this[_0x1340('0xc')][_0x18b5cd['device']]){if(this[_0x1340('0xc')][_0x18b5cd[_0x1340('0x2d')]]['state']!==_0x18b5cd['state'][_0x1340('0x2e')]()){this['telephones'][_0x18b5cd['device']]['stateTime']=_['toNumber'](moment()[_0x1340('0x28')]('x'));}this['telephones'][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x27')]=_0x18b5cd['state'][_0x1340('0x2e')]();this[_0x1340('0x20')](util['format'](_0x1340('0x34'),this[_0x1340('0xc')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x35')]),_0x1340('0x36'),this[_0x1340('0xc')][_0x18b5cd['device']]);}else if(this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]]){if(this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x27')]!==_0x18b5cd['state'][_0x1340('0x2e')]()){this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x31')]=_[_0x1340('0x32')](moment()['format']('x'));}this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]]['state']=_0x18b5cd[_0x1340('0x27')][_0x1340('0x2e')]();this[_0x1340('0x20')](util[_0x1340('0x28')]('trunk:%s',this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]][_0x1340('0x35')]),_0x1340('0x2a'),this[_0x1340('0xa')][_0x18b5cd[_0x1340('0x2d')]]);}else if(_[_0x1340('0x37')](_0x18b5cd[_0x1340('0x2d')],'Queue')){}else if(_[_0x1340('0x37')](_0x18b5cd[_0x1340('0x2d')],_0x1340('0x38'))){var _0x5456cc=_0x18b5cd[_0x1340('0x2d')];var _0x38071e=_0x5456cc['substring'](_0x5456cc[_0x1340('0x39')]('/')+0x1,_0x5456cc['indexOf']('@'));var _0x26fdf7=_[_0x1340('0x22')](this[_0x1340('0xb')],function(_0x3ec59a){return _0x3ec59a[_0x1340('0x3a')]==_0x38071e||_0x3ec59a[_0x1340('0x3b')]==_0x38071e||_0x3ec59a[_0x1340('0x3c')]==_0x38071e;});if(_0x26fdf7){if(_0x26fdf7[_0x1340('0x27')]!==_0x18b5cd[_0x1340('0x27')][_0x1340('0x2e')]()){_0x26fdf7[_0x1340('0x31')]=_[_0x1340('0x32')](moment()[_0x1340('0x28')]('x'));}_0x26fdf7['state']=_0x18b5cd[_0x1340('0x27')][_0x1340('0x2e')]();_0x26fdf7['local']=!![];_0x26fdf7[_0x1340('0x33')](_0x18b5cd);}}else{}}}catch(_0xc3a36b){logger[_0x1340('0x19')]('[syncDeviceState][UserReport]',util[_0x1340('0x1a')](_0xc3a36b,{'showHidden':![],'depth':null}));}};UserReport[_0x1340('0x1e')]['syncPeerStatus']=function(_0x31a4f9){try{if(this[_0x1340('0x21')](_0x31a4f9)&&this[_0x1340('0x21')](_0x31a4f9['peerstatus'])){if(this[_0x1340('0xb')][_0x31a4f9['peer']]){if(!this['agents'][_0x31a4f9['peer']][_0x1340('0x30')]||_0x31a4f9[_0x1340('0x12')]['toLowerCase']()==_0x1340('0x3d')){this[_0x1340('0xb')][_0x31a4f9['peer']][_0x1340('0x30')]=![];this[_0x1340('0xb')][_0x31a4f9[_0x1340('0x3e')]][_0x1340('0x3f')]=_0x31a4f9[_0x1340('0x12')]['toLowerCase']();this[_0x1340('0xb')][_0x31a4f9[_0x1340('0x3e')]][_0x1340('0x40')]=_0x31a4f9[_0x1340('0x40')];this[_0x1340('0xb')][_0x31a4f9[_0x1340('0x3e')]][_0x1340('0x33')](_0x31a4f9);}}else if(this[_0x1340('0xc')][_0x31a4f9[_0x1340('0x3e')]]){this[_0x1340('0xc')][_0x31a4f9['peer']]['status']=_0x31a4f9[_0x1340('0x12')][_0x1340('0x2e')]();this['telephones'][_0x31a4f9['peer']][_0x1340('0x40')]=_0x31a4f9[_0x1340('0x40')];this['emit'](util[_0x1340('0x28')](_0x1340('0x34'),this[_0x1340('0xc')][_0x31a4f9[_0x1340('0x3e')]]['name']),_0x1340('0x36'),this[_0x1340('0xc')][_0x31a4f9['peer']]);}else if(this[_0x1340('0xa')][_0x31a4f9['peer']]){this[_0x1340('0xa')][_0x31a4f9[_0x1340('0x3e')]][_0x1340('0x3f')]=_0x31a4f9['peerstatus']['toLowerCase']();this['trunks'][_0x31a4f9[_0x1340('0x3e')]][_0x1340('0x40')]=_0x31a4f9[_0x1340('0x40')];this[_0x1340('0x20')](util[_0x1340('0x28')](_0x1340('0x29'),this[_0x1340('0xa')][_0x31a4f9['peer']][_0x1340('0x35')]),_0x1340('0x2a'),this[_0x1340('0xa')][_0x31a4f9['peer']]);}else{}}}catch(_0x62ec7f){logger[_0x1340('0x19')]('[syncPeerStatus][UserReport]',util['inspect'](_0x62ec7f,{'showHidden':![],'depth':null}));}};module[_0x1340('0x41')]=UserReport; \ No newline at end of file +var _0x562f=['actionSipShowRegistry','actionDeviceStateList','catch','error','inspect','loopSyncRealTimeShow','then','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','username','stateRegistry','state','event','format','trunk:%s','device','local','toLowerCase','inuse','toNumber','updateStatusRealtime','telephone:%s','name','stateTime','trunk:save','startsWith','Queue','Local','substring','indexOf','mobile','accountcode','[syncDeviceState][UserReport]','peer','registered','status','address','telephone:save','exports','bluebird','util','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','registry','devicestatechange','syncDeviceState','peerstatus','syncPeerStatus','resolve'];(function(_0x1c2b3e,_0x309b0a){var _0x3b22f7=function(_0x282aa8){while(--_0x282aa8){_0x1c2b3e['push'](_0x1c2b3e['shift']());}};_0x3b22f7(++_0x309b0a);}(_0x562f,0x69));var _0xf562=function(_0x39bc06,_0x18d7ff){_0x39bc06=_0x39bc06-0x0;var _0x131143=_0x562f[_0x39bc06];return _0x131143;};'use strict';var _=require('lodash');var moment=require('moment');var BPromise=require(_0xf562('0x0'));var util=require(_0xf562('0x1'));var Redis=require('ioredis');var config=require(_0xf562('0x2'));var logger=require('../../../config/logger')(_0xf562('0x3'));var ami=require(_0xf562('0x4'));config['redis']=_[_0xf562('0x5')](config[_0xf562('0x6')],{'host':_0xf562('0x7'),'port':0x18eb});var io=require(_0xf562('0x8'))(new Redis(config[_0xf562('0x6')]));function UserReport(_0x3a5d6b){this[_0xf562('0x9')]=_0x3a5d6b['trunks'];this[_0xf562('0xa')]=_0x3a5d6b[_0xf562('0xa')];this[_0xf562('0xb')]=_0x3a5d6b[_0xf562('0xb')];ami['on'](_0xf562('0xc'),this[_0xf562('0xd')][_0xf562('0xe')](this));ami['on'](_0xf562('0xf'),this[_0xf562('0xd')][_0xf562('0xe')](this));ami['on'](_0xf562('0x10'),this[_0xf562('0x11')]['bind'](this));ami['on'](_0xf562('0x12'),this[_0xf562('0x13')][_0xf562('0xe')](this));this['loopSyncRealTimeShow']();return BPromise[_0xf562('0x14')]()['then'](ami[_0xf562('0x15')]())['then'](ami[_0xf562('0x16')]())['then'](ami['actionSipPeerStatus']())[_0xf562('0x17')](loggerCatch('[loopSyncRealTimeShow]'));}function loggerCatch(_0x5db2c3){return function(_0x5aeac2){logger[_0xf562('0x18')](_0x5db2c3,util[_0xf562('0x19')](_0x5aeac2,{'showHidden':![],'depth':null}));};}UserReport['prototype'][_0xf562('0x1a')]=function(){setInterval(function(){BPromise[_0xf562('0x14')]()[_0xf562('0x1b')](ami['actionSipShowRegistry']())['then'](ami['actionDeviceStateList']())[_0xf562('0x1b')](ami[_0xf562('0x1c')]())['catch'](loggerCatch('[loopSyncRealTimeShow]'));},0x32c8);};UserReport[_0xf562('0x1d')][_0xf562('0x1e')]=function(_0x3c523d){return _0x3c523d!==null&&!_[_0xf562('0x1f')](_0x3c523d);};UserReport[_0xf562('0x1d')][_0xf562('0x20')]=function(_0x577342,_0x20582d,_0x34a83a){io['to'](_0x577342)[_0xf562('0x20')](_0x20582d,_0x34a83a);};UserReport[_0xf562('0x1d')][_0xf562('0xd')]=function(_0xe273be){try{if(this[_0xf562('0x1e')](_0xe273be)){var _0x16bb8b=_['find'](this['trunks'],{'registry':_0xe273be[_0xf562('0x21')]});if(_0x16bb8b){_0xe273be[_0xf562('0x22')]=_0xe273be[_0xf562('0x23')];_['merge'](_0x16bb8b,_['omit'](_0xe273be,[_0xf562('0x24'),'actionid','username',_0xf562('0x23')]));this[_0xf562('0x20')](util[_0xf562('0x25')](_0xf562('0x26'),_0x16bb8b['name']),'trunk:save',_0x16bb8b);}}}catch(_0x51b8d7){logger[_0xf562('0x18')]('[syncRegistry][UserReport]',util['inspect'](_0x51b8d7,{'showHidden':![],'depth':null}));}};UserReport[_0xf562('0x1d')][_0xf562('0x11')]=function(_0x354492){try{if(this[_0xf562('0x1e')](_0x354492)){if(this[_0xf562('0xa')][_0x354492[_0xf562('0x27')]]){if(!this['agents'][_0x354492[_0xf562('0x27')]][_0xf562('0x28')]||_0x354492[_0xf562('0x23')][_0xf562('0x29')]()==_0xf562('0x2a')){this['agents'][_0x354492[_0xf562('0x27')]][_0xf562('0x28')]=![];if(this[_0xf562('0xa')][_0x354492[_0xf562('0x27')]][_0xf562('0x23')]!==_0x354492[_0xf562('0x23')]['toLowerCase']()){this[_0xf562('0xa')][_0x354492['device']]['stateTime']=_[_0xf562('0x2b')](moment()['format']('x'));}this[_0xf562('0xa')][_0x354492['device']][_0xf562('0x23')]=_0x354492['state'][_0xf562('0x29')]();this[_0xf562('0xa')][_0x354492['device']][_0xf562('0x2c')](_0x354492);}}else if(this[_0xf562('0xb')][_0x354492[_0xf562('0x27')]]){if(this[_0xf562('0xb')][_0x354492[_0xf562('0x27')]][_0xf562('0x23')]!==_0x354492['state'][_0xf562('0x29')]()){this[_0xf562('0xb')][_0x354492[_0xf562('0x27')]]['stateTime']=_['toNumber'](moment()['format']('x'));}this[_0xf562('0xb')][_0x354492[_0xf562('0x27')]][_0xf562('0x23')]=_0x354492['state']['toLowerCase']();this[_0xf562('0x20')](util[_0xf562('0x25')](_0xf562('0x2d'),this[_0xf562('0xb')][_0x354492[_0xf562('0x27')]][_0xf562('0x2e')]),'telephone:save',this[_0xf562('0xb')][_0x354492['device']]);}else if(this[_0xf562('0x9')][_0x354492[_0xf562('0x27')]]){if(this[_0xf562('0x9')][_0x354492[_0xf562('0x27')]][_0xf562('0x23')]!==_0x354492[_0xf562('0x23')]['toLowerCase']()){this[_0xf562('0x9')][_0x354492[_0xf562('0x27')]][_0xf562('0x2f')]=_[_0xf562('0x2b')](moment()[_0xf562('0x25')]('x'));}this['trunks'][_0x354492['device']]['state']=_0x354492[_0xf562('0x23')][_0xf562('0x29')]();this[_0xf562('0x20')](util[_0xf562('0x25')](_0xf562('0x26'),this[_0xf562('0x9')][_0x354492['device']][_0xf562('0x2e')]),_0xf562('0x30'),this[_0xf562('0x9')][_0x354492['device']]);}else if(_[_0xf562('0x31')](_0x354492[_0xf562('0x27')],_0xf562('0x32'))){}else if(_[_0xf562('0x31')](_0x354492[_0xf562('0x27')],_0xf562('0x33'))){var _0x184695=_0x354492['device'];var _0x9ce7e7=_0x184695[_0xf562('0x34')](_0x184695[_0xf562('0x35')]('/')+0x1,_0x184695[_0xf562('0x35')]('@'));var _0xc33b89=_['find'](this[_0xf562('0xa')],function(_0xa616d3){return _0xa616d3[_0xf562('0x36')]==_0x9ce7e7||_0xa616d3['phone']==_0x9ce7e7||_0xa616d3[_0xf562('0x37')]==_0x9ce7e7;});if(_0xc33b89){if(_0xc33b89[_0xf562('0x23')]!==_0x354492[_0xf562('0x23')][_0xf562('0x29')]()){_0xc33b89['stateTime']=_[_0xf562('0x2b')](moment()[_0xf562('0x25')]('x'));}_0xc33b89['state']=_0x354492[_0xf562('0x23')]['toLowerCase']();_0xc33b89[_0xf562('0x28')]=!![];_0xc33b89['updateStatusRealtime'](_0x354492);}}else{}}}catch(_0x5e3c36){logger[_0xf562('0x18')](_0xf562('0x38'),util[_0xf562('0x19')](_0x5e3c36,{'showHidden':![],'depth':null}));}};UserReport['prototype']['syncPeerStatus']=function(_0x5e4323){try{if(this[_0xf562('0x1e')](_0x5e4323)&&this[_0xf562('0x1e')](_0x5e4323[_0xf562('0x12')])){if(this[_0xf562('0xa')][_0x5e4323[_0xf562('0x39')]]){if(!this[_0xf562('0xa')][_0x5e4323['peer']][_0xf562('0x28')]||_0x5e4323['peerstatus'][_0xf562('0x29')]()==_0xf562('0x3a')){this['agents'][_0x5e4323[_0xf562('0x39')]][_0xf562('0x28')]=![];this[_0xf562('0xa')][_0x5e4323[_0xf562('0x39')]][_0xf562('0x3b')]=_0x5e4323[_0xf562('0x12')][_0xf562('0x29')]();this[_0xf562('0xa')][_0x5e4323['peer']][_0xf562('0x3c')]=_0x5e4323[_0xf562('0x3c')];this['agents'][_0x5e4323[_0xf562('0x39')]][_0xf562('0x2c')](_0x5e4323);}}else if(this['telephones'][_0x5e4323[_0xf562('0x39')]]){this[_0xf562('0xb')][_0x5e4323[_0xf562('0x39')]][_0xf562('0x3b')]=_0x5e4323[_0xf562('0x12')][_0xf562('0x29')]();this[_0xf562('0xb')][_0x5e4323['peer']][_0xf562('0x3c')]=_0x5e4323[_0xf562('0x3c')];this[_0xf562('0x20')](util[_0xf562('0x25')]('telephone:%s',this[_0xf562('0xb')][_0x5e4323[_0xf562('0x39')]][_0xf562('0x2e')]),_0xf562('0x3d'),this[_0xf562('0xb')][_0x5e4323[_0xf562('0x39')]]);}else if(this[_0xf562('0x9')][_0x5e4323[_0xf562('0x39')]]){this[_0xf562('0x9')][_0x5e4323[_0xf562('0x39')]][_0xf562('0x3b')]=_0x5e4323[_0xf562('0x12')]['toLowerCase']();this['trunks'][_0x5e4323[_0xf562('0x39')]]['address']=_0x5e4323[_0xf562('0x3c')];this[_0xf562('0x20')](util['format'](_0xf562('0x26'),this[_0xf562('0x9')][_0x5e4323[_0xf562('0x39')]]['name']),_0xf562('0x30'),this['trunks'][_0x5e4323[_0xf562('0x39')]]);}else{}}}catch(_0x39d8bd){logger[_0xf562('0x18')]('[syncPeerStatus][UserReport]',util[_0xf562('0x19')](_0x39d8bd,{'showHidden':![],'depth':null}));}};module[_0xf562('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 2ed4aa7..ae7c28c 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 _0xd132=['[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','redis','defaults','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','syncAgentCalled','bind','agentringnoanswer','syncAgentRingNoAnswer','queuecallerabandon','agentcomplete','syncVarSet','hangup','syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','prototype','emit','isNotNull','isUndefined','uniqueid','destuniqueid','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','type','inbound','omit','event','privilege','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','syncAgentConnect','agentconnectAt','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','merge','interface','destconnectedlinenum','user:%s','user:agentconnect','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','lastevent','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','syncQueueCallerAbandon','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','syncAgentComplete','agentcompleteAt','complete','talktime','agent','agentacw','acwtime','acwTimeout','user:agentcomplete','custom:agentcomplete','[syncAgentComplete][VoiceAgentReport]','addVariable','keys','variable','value','[syncVarSet][VoiceAgentReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosrtt','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','isNil','includes','transfer','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','origtransfereruniqueid','diff','seconds','secondtransfereruniqueid','transfereruniqueid','[syncBlindTransfer][VoiceAgentReport]','channel','substring','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','lastIndexOf'];(function(_0x410f6b,_0x4fce77){var _0x283d98=function(_0x5e1870){while(--_0x5e1870){_0x410f6b['push'](_0x410f6b['shift']());}};_0x283d98(++_0x4fce77);}(_0xd132,0x81));var _0x2d13=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd132[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x2d13('0x0'));var moment=require(_0x2d13('0x1'));var util=require(_0x2d13('0x2'));var Redis=require('ioredis');var config=require(_0x2d13('0x3'));var logger=require(_0x2d13('0x4'))(_0x2d13('0x5'));var ami=require(_0x2d13('0x6'));config[_0x2d13('0x7')]=_[_0x2d13('0x8')](config['redis'],{'host':_0x2d13('0x9'),'port':0x18eb});var io=require(_0x2d13('0xa'))(new Redis(config[_0x2d13('0x7')]));function VoiceAgentReport(_0xe8a242){this[_0x2d13('0xb')]={};this[_0x2d13('0xc')]=_0xe8a242['voiceQueues'];this[_0x2d13('0xd')]=_0xe8a242[_0x2d13('0xd')];this[_0x2d13('0xe')]={};ami['on']('agentcalled',this[_0x2d13('0xf')][_0x2d13('0x10')](this));ami['on']('agentconnect',this['syncAgentConnect']['bind'](this));ami['on'](_0x2d13('0x11'),this[_0x2d13('0x12')][_0x2d13('0x10')](this));ami['on'](_0x2d13('0x13'),this['syncQueueCallerAbandon'][_0x2d13('0x10')](this));ami['on'](_0x2d13('0x14'),this['syncAgentComplete'][_0x2d13('0x10')](this));ami['on']('varset',this[_0x2d13('0x15')][_0x2d13('0x10')](this));ami['on'](_0x2d13('0x16'),this[_0x2d13('0x17')]['bind'](this));ami['on'](_0x2d13('0x18'),this[_0x2d13('0x19')][_0x2d13('0x10')](this));ami['on'](_0x2d13('0x1a'),this[_0x2d13('0x1b')][_0x2d13('0x10')](this));ami['on'](_0x2d13('0x1c'),this[_0x2d13('0x1d')][_0x2d13('0x10')](this));ami['on']('blindtransfer',this[_0x2d13('0x1e')]['bind'](this));}VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x20')]=function(_0x27fa44,_0x3efd21,_0x3f8de0){io['to'](_0x27fa44)['emit'](_0x3efd21,_0x3f8de0);};VoiceAgentReport['prototype'][_0x2d13('0x21')]=function(_0x2671cd){return _0x2671cd!==null&&!_[_0x2d13('0x22')](_0x2671cd);};VoiceAgentReport[_0x2d13('0x1f')]['syncAgentCalled']=function(_0x309cd3){try{if(this[_0x2d13('0x21')](_0x309cd3)){if(_['isUndefined'](this[_0x2d13('0xb')][_0x309cd3[_0x2d13('0x23')]])){this[_0x2d13('0xb')][_0x309cd3[_0x2d13('0x23')]]={};}if(_['isUndefined'](this['channels'][_0x309cd3[_0x2d13('0x23')]][_0x309cd3[_0x2d13('0x24')]])){this[_0x2d13('0xb')][_0x309cd3[_0x2d13('0x23')]][_0x309cd3[_0x2d13('0x24')]]={'agentcalledAt':moment()[_0x2d13('0x25')](_0x2d13('0x26')),'lastevent':_0x2d13('0x27'),'variables':this[_0x2d13('0xe')][_0x309cd3[_0x2d13('0x23')]],'type':this['voiceQueues'][_0x309cd3[_0x2d13('0x28')]]?this[_0x2d13('0xc')][_0x309cd3[_0x2d13('0x28')]][_0x2d13('0x29')]||_0x2d13('0x2a'):_0x2d13('0x2a')};}_['merge'](this[_0x2d13('0xb')][_0x309cd3[_0x2d13('0x23')]][_0x309cd3['destuniqueid']],_[_0x2d13('0x2b')](_0x309cd3,[_0x2d13('0x2c'),_0x2d13('0x2d')]));ami[_0x2d13('0x20')]('custom:agentcalled',this[_0x2d13('0xb')][_0x309cd3[_0x2d13('0x23')]][_0x309cd3[_0x2d13('0x24')]]);this['emit'](util[_0x2d13('0x25')]('user:%s',_0x309cd3[_0x2d13('0x2e')]),_0x2d13('0x2f'),this['channels'][_0x309cd3[_0x2d13('0x23')]][_0x309cd3[_0x2d13('0x24')]]);}}catch(_0x833ecd){logger[_0x2d13('0x30')](_0x2d13('0x31'),util[_0x2d13('0x32')](_0x833ecd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x33')]=function(_0x102112){try{if(this[_0x2d13('0x21')](_0x102112)){if(this['channels'][_0x102112[_0x2d13('0x23')]]){for(var _0x27d5f3 in this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]]){if(this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]]['hasOwnProperty'](_0x27d5f3)){if(_0x102112[_0x2d13('0x24')]===_0x27d5f3){this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x34')]=moment()[_0x2d13('0x25')](_0x2d13('0x26'));this[_0x2d13('0xb')][_0x102112['uniqueid']][_0x27d5f3]['lastevent']=_0x2d13('0x35');this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x36')]=_0x102112[_0x2d13('0x36')];this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x37')]=_0x102112['connectedlinenum'];this['channels'][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x38')]=_0x102112[_0x2d13('0x38')];this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x39')]=_0x102112[_0x2d13('0x39')];this[_0x2d13('0xb')][_0x102112['uniqueid']][_0x27d5f3][_0x2d13('0x3a')]=_0x102112[_0x2d13('0x3a')];_[_0x2d13('0x3b')](this[_0x2d13('0xd')][_0x102112[_0x2d13('0x3c')]],_['pick'](_0x102112,[_0x2d13('0x28'),_0x2d13('0x3d')]));this['emit'](util[_0x2d13('0x25')](_0x2d13('0x3e'),_0x102112['membername']),_0x2d13('0x3f'),this[_0x2d13('0xb')][_0x102112['uniqueid']][_0x102112['destuniqueid']]);ami[_0x2d13('0x20')](_0x2d13('0x40'),this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3]);}else if(!this['channels'][_0x102112['uniqueid']][_0x27d5f3][_0x2d13('0x11')]&&!this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x14')]){this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x11')]=!![];this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x41')]=moment()[_0x2d13('0x25')](_0x2d13('0x26'));this[_0x2d13('0xb')][_0x102112['uniqueid']][_0x27d5f3][_0x2d13('0x42')]=_0x2d13('0x43');this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x44')]=_0x2d13('0x43');this['channels'][_0x102112[_0x2d13('0x23')]][_0x27d5f3][_0x2d13('0x45')]=_0x102112[_0x2d13('0x24')];this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3]['answeredelsewheremembername']=_0x102112[_0x2d13('0x2e')];ami[_0x2d13('0x20')](_0x2d13('0x46'),this[_0x2d13('0xb')][_0x102112[_0x2d13('0x23')]][_0x27d5f3]);}}}}}}catch(_0x4bacbf){logger['error'](_0x2d13('0x47'),util[_0x2d13('0x32')](_0x4bacbf,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x2d13('0x12')]=function(_0xe64c36){try{if(this['isNotNull'](_0xe64c36)){if(this[_0x2d13('0xb')][_0xe64c36['uniqueid']]&&this['channels'][_0xe64c36[_0x2d13('0x23')]][_0xe64c36[_0x2d13('0x24')]]){this[_0x2d13('0xb')][_0xe64c36[_0x2d13('0x23')]][_0xe64c36['destuniqueid']]['agentringnoanswer']=!![];this[_0x2d13('0xb')][_0xe64c36[_0x2d13('0x23')]][_0xe64c36[_0x2d13('0x24')]][_0x2d13('0x41')]=moment()[_0x2d13('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0xe64c36[_0x2d13('0x23')]][_0xe64c36[_0x2d13('0x24')]][_0x2d13('0x42')]='rejected';this['channels'][_0xe64c36[_0x2d13('0x23')]][_0xe64c36[_0x2d13('0x24')]][_0x2d13('0x44')]='rejected';ami[_0x2d13('0x20')](_0x2d13('0x48'),this[_0x2d13('0xb')][_0xe64c36[_0x2d13('0x23')]][_0xe64c36[_0x2d13('0x24')]]);}}}catch(_0x50833f){logger[_0x2d13('0x30')](_0x2d13('0x49'),util[_0x2d13('0x32')](_0x50833f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x4a')]=function(_0x3be951){try{if(this[_0x2d13('0x21')](_0x3be951)){if(this[_0x2d13('0xb')][_0x3be951['uniqueid']]){for(var _0x4b5274 in this['channels'][_0x3be951['uniqueid']]){if(this[_0x2d13('0xb')][_0x3be951[_0x2d13('0x23')]][_0x2d13('0x4b')](_0x4b5274)&&!this[_0x2d13('0xb')][_0x3be951[_0x2d13('0x23')]][_0x4b5274]['agentringnoanswer']&&!this[_0x2d13('0xb')][_0x3be951[_0x2d13('0x23')]][_0x4b5274][_0x2d13('0x14')]){this['channels'][_0x3be951['uniqueid']][_0x4b5274][_0x2d13('0x11')]=!![];this[_0x2d13('0xb')][_0x3be951['uniqueid']][_0x4b5274][_0x2d13('0x41')]=moment()[_0x2d13('0x25')](_0x2d13('0x26'));this[_0x2d13('0xb')][_0x3be951[_0x2d13('0x23')]][_0x4b5274][_0x2d13('0x42')]=_0x2d13('0x4c');this[_0x2d13('0xb')][_0x3be951[_0x2d13('0x23')]][_0x4b5274][_0x2d13('0x44')]=_0x2d13('0x4c');ami[_0x2d13('0x20')](_0x2d13('0x4d'),this['channels'][_0x3be951[_0x2d13('0x23')]][_0x4b5274]);}}}}}catch(_0x470ffe){logger[_0x2d13('0x30')]('[syncQueueCallerAbandon][VoiceAgentReport]',util[_0x2d13('0x32')](_0x470ffe,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x4e')]=function(_0x1836e5){try{if(this['isNotNull'](_0x1836e5)){if(this[_0x2d13('0xb')][_0x1836e5['uniqueid']]){for(var _0x1fa12a in this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]]){if(this[_0x2d13('0xb')][_0x1836e5['uniqueid']][_0x2d13('0x4b')](_0x1fa12a)){if(this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x34')]&&!this['channels'][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a]['agentcomplete']){this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x14')]=!![];this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x4f')]=moment()[_0x2d13('0x25')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x44')]=_0x2d13('0x50');this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x51')]=_0x1836e5[_0x2d13('0x51')];this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a]['reason']=_0x1836e5[_0x2d13('0x42')]=='transfer'?_0x2d13('0x52'):_0x1836e5[_0x2d13('0x42')];if(this[_0x2d13('0xc')][_0x1836e5['queue']]&&this[_0x2d13('0xc')][_0x1836e5['queue']]['acw']){this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x53')]=!![];this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a][_0x2d13('0x54')]=this['voiceQueues'][_0x1836e5[_0x2d13('0x28')]][_0x2d13('0x55')];}this[_0x2d13('0xd')][_0x1836e5[_0x2d13('0x3c')]]=_[_0x2d13('0x2b')](this[_0x2d13('0xd')][_0x1836e5[_0x2d13('0x3c')]],[_0x2d13('0x28'),_0x2d13('0x3d')]);this['emit'](util['format'](_0x2d13('0x3e'),_0x1836e5[_0x2d13('0x2e')]),_0x2d13('0x56'),this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a]);ami[_0x2d13('0x20')](_0x2d13('0x57'),this[_0x2d13('0xb')][_0x1836e5[_0x2d13('0x23')]][_0x1fa12a]);}}}}}}catch(_0x73ee61){logger[_0x2d13('0x30')](_0x2d13('0x58'),util['inspect'](_0x73ee61,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x15')]=function(_0x4f1faa){try{if(this[_0x2d13('0x21')](_0x4f1faa)){this[_0x2d13('0x59')](_0x4f1faa[_0x2d13('0x23')],_[_0x2d13('0x5a')](_0x4f1faa[_0x2d13('0x5b')])[0x0],_0x4f1faa[_0x2d13('0x5c')]);if(this[_0x2d13('0xb')][_0x4f1faa[_0x2d13('0x23')]]){for(var _0x3407c4 in this['channels'][_0x4f1faa[_0x2d13('0x23')]]){if(this['channels'][_0x4f1faa['uniqueid']][_0x2d13('0x4b')](_0x3407c4)){if(_[_0x2d13('0x22')](this['channels'][_0x4f1faa[_0x2d13('0x23')]][_0x3407c4][_0x2d13('0xe')])){this['channels'][_0x4f1faa[_0x2d13('0x23')]][_0x3407c4][_0x2d13('0xe')]={};}this['channels'][_0x4f1faa['uniqueid']][_0x3407c4][_0x2d13('0xe')]=this['variables'][_0x4f1faa[_0x2d13('0x23')]];}}}}}catch(_0x458eff){logger['error'](_0x2d13('0x5d'),util[_0x2d13('0x32')](_0x458eff,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x59')]=function(_0x55a1f1,_0x37df4e,_0x4d73fb){var _0x1f83a8=[_0x2d13('0x5e'),_0x2d13('0x5f'),_0x2d13('0x60'),_0x2d13('0x61'),'rtpaudioqosloss','rtpaudioqoslossbridged',_0x2d13('0x62'),'rtpaudioqosrttbridged',_0x2d13('0x63'),_0x2d13('0x64'),_0x2d13('0x65'),_0x2d13('0x66'),_0x2d13('0x67'),_0x2d13('0x68'),_0x2d13('0x69'),_0x2d13('0x6a'),_0x2d13('0x2e'),_0x2d13('0x6b'),'memberrealtime'];if(!_[_0x2d13('0x6c')](_0x37df4e)&&!_[_0x2d13('0x6d')](_0x1f83a8,_0x37df4e)){if(_[_0x2d13('0x22')](this[_0x2d13('0xe')][_0x55a1f1])){this[_0x2d13('0xe')][_0x55a1f1]={};}this[_0x2d13('0xe')][_0x55a1f1][_0x37df4e]=_0x4d73fb;}};VoiceAgentReport['prototype'][_0x2d13('0x17')]=function(_0x39bbdd){try{if(this[_0x2d13('0x21')](_0x39bbdd)){if(this[_0x2d13('0xb')][_0x39bbdd['uniqueid']]){for(var _0x2ce5e9 in this[_0x2d13('0xb')][_0x39bbdd[_0x2d13('0x23')]]){if(this[_0x2d13('0xb')][_0x39bbdd[_0x2d13('0x23')]]['hasOwnProperty'](_0x2ce5e9)){if(this[_0x2d13('0xb')][_0x39bbdd[_0x2d13('0x23')]][_0x2ce5e9][_0x2d13('0x42')]==_0x2d13('0x6e')&&this['channels'][_0x39bbdd['uniqueid']][_0x2ce5e9][_0x2d13('0x14')]){this[_0x2d13('0xb')][_0x39bbdd['uniqueid']][_0x2ce5e9]['agentcompleteAt']=moment()[_0x2d13('0x25')](_0x2d13('0x26'));}}}ami['emit']('custom:voiceAgentReport',_[_0x2d13('0x6f')](this[_0x2d13('0xb')][_0x39bbdd[_0x2d13('0x23')]]));delete this[_0x2d13('0xb')][_0x39bbdd[_0x2d13('0x23')]];}if(this[_0x2d13('0xe')][_0x39bbdd['uniqueid']]){delete this[_0x2d13('0xe')][_0x39bbdd[_0x2d13('0x23')]];}}}catch(_0x314b5e){logger[_0x2d13('0x30')](_0x2d13('0x70'),util[_0x2d13('0x32')](_0x314b5e,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x1d')]=function(_0x7e17af){try{if(this[_0x2d13('0x21')](_0x7e17af)){if(this['channels'][_0x7e17af[_0x2d13('0x71')]]){for(var _0x1fb2a6 in this['channels'][_0x7e17af[_0x2d13('0x71')]]){if(this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x2d13('0x4b')](_0x1fb2a6)){if(_0x7e17af[_0x2d13('0x72')]===_0x1fb2a6){var _0xb705e8=moment();this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x1fb2a6][_0x2d13('0x14')]=!![];this['channels'][_0x7e17af['transfereeuniqueid']][_0x1fb2a6][_0x2d13('0x4f')]=moment()['format'](_0x2d13('0x26'));this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x1fb2a6][_0x2d13('0x42')]='transfer';this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x1fb2a6][_0x2d13('0x44')]=_0x2d13('0x50');this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x1fb2a6][_0x2d13('0x51')]=_0xb705e8[_0x2d13('0x73')](this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]][_0x1fb2a6]['agentconnectAt'],_0x2d13('0x74'));}}}}if(this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x75')]]){var _0x10d76d=this['channels'][_0x7e17af['secondtransfereruniqueid']];this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x75')]]=this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]];this[_0x2d13('0xb')][_0x7e17af[_0x2d13('0x71')]]=_0x10d76d;}}}catch(_0x157320){logger[_0x2d13('0x30')]('[syncAttendedTransfer][VoiceAgentReport]',util['inspect'](_0x157320,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x1e')]=function(_0x335ed9){try{if(this[_0x2d13('0x21')](_0x335ed9)){if(this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]]){for(var _0x5b19fc in this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]]){if(this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]]['hasOwnProperty'](_0x5b19fc)){if(_0x335ed9[_0x2d13('0x76')]===_0x5b19fc){var _0xc5de1c=moment();this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]][_0x5b19fc][_0x2d13('0x14')]=!![];this['channels'][_0x335ed9[_0x2d13('0x71')]][_0x5b19fc][_0x2d13('0x4f')]=_0xc5de1c;this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]][_0x5b19fc][_0x2d13('0x42')]=_0x2d13('0x6e');this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]][_0x5b19fc]['lastevent']=_0x2d13('0x50');this[_0x2d13('0xb')][_0x335ed9[_0x2d13('0x71')]][_0x5b19fc][_0x2d13('0x51')]=_0xc5de1c[_0x2d13('0x73')](this[_0x2d13('0xb')][_0x335ed9['transfereeuniqueid']][_0x5b19fc][_0x2d13('0x34')],_0x2d13('0x74'));}}}}}}catch(_0x3b1e3c){logger[_0x2d13('0x30')](_0x2d13('0x77'),util[_0x2d13('0x32')](_0x3b1e3c,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStart']=function(_0x3a3dbe){var _0x31ee35='';try{if(this[_0x2d13('0x21')](_0x3a3dbe)){if(_0x3a3dbe['channel']){_0x31ee35=_0x3a3dbe[_0x2d13('0x78')][_0x2d13('0x79')](0x0,_0x3a3dbe['channel']['lastIndexOf']('-'));if(this['agents'][_0x31ee35]){this[_0x2d13('0xd')][_0x31ee35][_0x2d13('0x7a')]=!![];}}}}catch(_0x115aac){logger['error'](_0x2d13('0x7b'),util[_0x2d13('0x32')](_0x115aac,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x2d13('0x1f')][_0x2d13('0x1b')]=function(_0x2f8c49){var _0x2e9545='';try{if(this[_0x2d13('0x21')](_0x2f8c49)){if(_0x2f8c49[_0x2d13('0x78')]){_0x2e9545=_0x2f8c49['channel'][_0x2d13('0x79')](0x0,_0x2f8c49['channel'][_0x2d13('0x7c')]('-'));if(this[_0x2d13('0xd')][_0x2e9545]){this[_0x2d13('0xd')][_0x2e9545][_0x2d13('0x7a')]=![];}}}}catch(_0x13464a){logger[_0x2d13('0x30')](_0x2d13('0x7d'),util[_0x2d13('0x32')](_0x13464a,{'showHidden':![],'depth':null}));}};module[_0x2d13('0x7e')]=VoiceAgentReport; \ No newline at end of file +var _0x78b8=['syncHangup','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','emit','isNotNull','isUndefined','channels','uniqueid','destuniqueid','called','queue','type','inbound','merge','omit','event','privilege','user:%s','membername','user:called','error','[syncAgentCalled][VoiceAgentReport]','inspect','prototype','agentconnectAt','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','connect','holdtime','connectedlinenum','connectedlinename','destchannelstate','destchannelstatedesc','pick','destconnectedlinenum','custom:agentconnect','agentringnoanswerAt','reason','answered_elsewhere','answeredelsewheredestinationuniqueid','custom:agentansweredelsewhere','[syncAgentConnect][VoiceAgentReport]','rejected','custom:agentringnoanswer','[syncAgentRingNoAnswer][VoiceAgentReport]','hasOwnProperty','abandoned','custom:agentqueuecallerabandon','agentcompleteAt','transfer','agent','agentacw','acwtime','agents','interface','user:agentcomplete','[syncAgentComplete][VoiceAgentReport]','keys','variable','value','[syncVarSet][VoiceAgentReport]','addVariable','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqoslossbridged','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','memberpenalty','memberrealtime','isNil','values','[syncHangup][VoiceAgentReport]','transfereeuniqueid','complete','talktime','seconds','secondtransfereruniqueid','[syncAttendedTransfer][VoiceAgentReport]','channel','substring','lastIndexOf','onhold','[syncMusicOnHoldStart][VoiceAgentReport]','[syncMusicOnHoldStop][VoiceAgentReport]','exports','lodash','ioredis','../../../config/environment','../../../config/logger','ami','redis','defaults','localhost','socket.io-emitter','voiceQueues','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','hangup'];(function(_0x38537f,_0x252124){var _0x141e23=function(_0x2809b5){while(--_0x2809b5){_0x38537f['push'](_0x38537f['shift']());}};_0x141e23(++_0x252124);}(_0x78b8,0x1c5));var _0x878b=function(_0xa89dad,_0x143ad4){_0xa89dad=_0xa89dad-0x0;var _0x26da6d=_0x78b8[_0xa89dad];return _0x26da6d;};'use strict';var _=require(_0x878b('0x0'));var moment=require('moment');var util=require('util');var Redis=require(_0x878b('0x1'));var config=require(_0x878b('0x2'));var logger=require(_0x878b('0x3'))(_0x878b('0x4'));var ami=require('../ami');config[_0x878b('0x5')]=_[_0x878b('0x6')](config[_0x878b('0x5')],{'host':_0x878b('0x7'),'port':0x18eb});var io=require(_0x878b('0x8'))(new Redis(config[_0x878b('0x5')]));function VoiceAgentReport(_0x21b190){this['channels']={};this[_0x878b('0x9')]=_0x21b190[_0x878b('0x9')];this['agents']=_0x21b190['agents'];this[_0x878b('0xa')]={};ami['on'](_0x878b('0xb'),this[_0x878b('0xc')][_0x878b('0xd')](this));ami['on'](_0x878b('0xe'),this[_0x878b('0xf')][_0x878b('0xd')](this));ami['on'](_0x878b('0x10'),this[_0x878b('0x11')][_0x878b('0xd')](this));ami['on']('queuecallerabandon',this[_0x878b('0x12')][_0x878b('0xd')](this));ami['on'](_0x878b('0x13'),this[_0x878b('0x14')]['bind'](this));ami['on'](_0x878b('0x15'),this['syncVarSet'][_0x878b('0xd')](this));ami['on'](_0x878b('0x16'),this[_0x878b('0x17')][_0x878b('0xd')](this));ami['on'](_0x878b('0x18'),this[_0x878b('0x19')][_0x878b('0xd')](this));ami['on'](_0x878b('0x1a'),this['syncMusicOnHoldStop'][_0x878b('0xd')](this));ami['on'](_0x878b('0x1b'),this[_0x878b('0x1c')][_0x878b('0xd')](this));ami['on']('blindtransfer',this[_0x878b('0x1d')][_0x878b('0xd')](this));}VoiceAgentReport['prototype'][_0x878b('0x1e')]=function(_0x9022d8,_0x1c4055,_0x5c8309){io['to'](_0x9022d8)['emit'](_0x1c4055,_0x5c8309);};VoiceAgentReport['prototype'][_0x878b('0x1f')]=function(_0x223568){return _0x223568!==null&&!_[_0x878b('0x20')](_0x223568);};VoiceAgentReport['prototype'][_0x878b('0xc')]=function(_0x37790a){try{if(this['isNotNull'](_0x37790a)){if(_[_0x878b('0x20')](this[_0x878b('0x21')][_0x37790a[_0x878b('0x22')]])){this[_0x878b('0x21')][_0x37790a[_0x878b('0x22')]]={};}if(_[_0x878b('0x20')](this[_0x878b('0x21')][_0x37790a[_0x878b('0x22')]][_0x37790a[_0x878b('0x23')]])){this['channels'][_0x37790a['uniqueid']][_0x37790a[_0x878b('0x23')]]={'agentcalledAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x878b('0x24'),'variables':this[_0x878b('0xa')][_0x37790a[_0x878b('0x22')]],'type':this['voiceQueues'][_0x37790a['queue']]?this[_0x878b('0x9')][_0x37790a[_0x878b('0x25')]][_0x878b('0x26')]||_0x878b('0x27'):'inbound'};}_[_0x878b('0x28')](this['channels'][_0x37790a[_0x878b('0x22')]][_0x37790a['destuniqueid']],_[_0x878b('0x29')](_0x37790a,[_0x878b('0x2a'),_0x878b('0x2b')]));ami[_0x878b('0x1e')]('custom:agentcalled',this[_0x878b('0x21')][_0x37790a[_0x878b('0x22')]][_0x37790a[_0x878b('0x23')]]);this['emit'](util['format'](_0x878b('0x2c'),_0x37790a[_0x878b('0x2d')]),_0x878b('0x2e'),this[_0x878b('0x21')][_0x37790a[_0x878b('0x22')]][_0x37790a[_0x878b('0x23')]]);}}catch(_0x5e65cb){logger[_0x878b('0x2f')](_0x878b('0x30'),util[_0x878b('0x31')](_0x5e65cb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')]['syncAgentConnect']=function(_0x3c5749){try{if(this[_0x878b('0x1f')](_0x3c5749)){if(this['channels'][_0x3c5749['uniqueid']]){for(var _0x4028e8 in this['channels'][_0x3c5749['uniqueid']]){if(this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]]['hasOwnProperty'](_0x4028e8)){if(_0x3c5749[_0x878b('0x23')]===_0x4028e8){this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x33')]=moment()[_0x878b('0x34')](_0x878b('0x35'));this['channels'][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x36')]=_0x878b('0x37');this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x38')]=_0x3c5749['holdtime'];this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x39')]=_0x3c5749['connectedlinenum'];this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x3a')]=_0x3c5749['connectedlinename'];this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8]['destchannelstate']=_0x3c5749[_0x878b('0x3b')];this['channels'][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x3c')]=_0x3c5749[_0x878b('0x3c')];_[_0x878b('0x28')](this['agents'][_0x3c5749['interface']],_[_0x878b('0x3d')](_0x3c5749,[_0x878b('0x25'),_0x878b('0x3e')]));this['emit'](util['format'](_0x878b('0x2c'),_0x3c5749[_0x878b('0x2d')]),'user:agentconnect',this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x3c5749[_0x878b('0x23')]]);ami['emit'](_0x878b('0x3f'),this['channels'][_0x3c5749['uniqueid']][_0x4028e8]);}else if(!this[_0x878b('0x21')][_0x3c5749['uniqueid']][_0x4028e8]['agentringnoanswer']&&!this[_0x878b('0x21')][_0x3c5749['uniqueid']][_0x4028e8]['agentcomplete']){this['channels'][_0x3c5749[_0x878b('0x22')]][_0x4028e8]['agentringnoanswer']=!![];this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x40')]=moment()[_0x878b('0x34')](_0x878b('0x35'));this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x41')]=_0x878b('0x42');this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x36')]=_0x878b('0x42');this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8][_0x878b('0x43')]=_0x3c5749[_0x878b('0x23')];this[_0x878b('0x21')][_0x3c5749[_0x878b('0x22')]][_0x4028e8]['answeredelsewheremembername']=_0x3c5749['membername'];ami['emit'](_0x878b('0x44'),this['channels'][_0x3c5749[_0x878b('0x22')]][_0x4028e8]);}}}}}}catch(_0x563340){logger[_0x878b('0x2f')](_0x878b('0x45'),util[_0x878b('0x31')](_0x563340,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x11')]=function(_0x22d35c){try{if(this[_0x878b('0x1f')](_0x22d35c)){if(this[_0x878b('0x21')][_0x22d35c[_0x878b('0x22')]]&&this[_0x878b('0x21')][_0x22d35c[_0x878b('0x22')]][_0x22d35c[_0x878b('0x23')]]){this[_0x878b('0x21')][_0x22d35c['uniqueid']][_0x22d35c[_0x878b('0x23')]][_0x878b('0x10')]=!![];this[_0x878b('0x21')][_0x22d35c[_0x878b('0x22')]][_0x22d35c[_0x878b('0x23')]]['agentringnoanswerAt']=moment()[_0x878b('0x34')](_0x878b('0x35'));this[_0x878b('0x21')][_0x22d35c['uniqueid']][_0x22d35c[_0x878b('0x23')]][_0x878b('0x41')]=_0x878b('0x46');this[_0x878b('0x21')][_0x22d35c[_0x878b('0x22')]][_0x22d35c['destuniqueid']][_0x878b('0x36')]='rejected';ami[_0x878b('0x1e')](_0x878b('0x47'),this[_0x878b('0x21')][_0x22d35c['uniqueid']][_0x22d35c[_0x878b('0x23')]]);}}}catch(_0x43a3bd){logger[_0x878b('0x2f')](_0x878b('0x48'),util[_0x878b('0x31')](_0x43a3bd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x12')]=function(_0x567861){try{if(this['isNotNull'](_0x567861)){if(this['channels'][_0x567861[_0x878b('0x22')]]){for(var _0x134b9d in this[_0x878b('0x21')][_0x567861['uniqueid']]){if(this[_0x878b('0x21')][_0x567861['uniqueid']][_0x878b('0x49')](_0x134b9d)&&!this['channels'][_0x567861[_0x878b('0x22')]][_0x134b9d][_0x878b('0x10')]&&!this[_0x878b('0x21')][_0x567861[_0x878b('0x22')]][_0x134b9d][_0x878b('0x13')]){this[_0x878b('0x21')][_0x567861[_0x878b('0x22')]][_0x134b9d][_0x878b('0x10')]=!![];this[_0x878b('0x21')][_0x567861[_0x878b('0x22')]][_0x134b9d][_0x878b('0x40')]=moment()['format'](_0x878b('0x35'));this[_0x878b('0x21')][_0x567861[_0x878b('0x22')]][_0x134b9d][_0x878b('0x41')]=_0x878b('0x4a');this[_0x878b('0x21')][_0x567861[_0x878b('0x22')]][_0x134b9d]['lastevent']=_0x878b('0x4a');ami['emit'](_0x878b('0x4b'),this[_0x878b('0x21')][_0x567861['uniqueid']][_0x134b9d]);}}}}}catch(_0x32f452){logger[_0x878b('0x2f')]('[syncQueueCallerAbandon][VoiceAgentReport]',util['inspect'](_0x32f452,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0x878b('0x14')]=function(_0xf8e7eb){try{if(this['isNotNull'](_0xf8e7eb)){if(this[_0x878b('0x21')][_0xf8e7eb['uniqueid']]){for(var _0x165d19 in this[_0x878b('0x21')][_0xf8e7eb['uniqueid']]){if(this[_0x878b('0x21')][_0xf8e7eb['uniqueid']][_0x878b('0x49')](_0x165d19)){if(this[_0x878b('0x21')][_0xf8e7eb[_0x878b('0x22')]][_0x165d19][_0x878b('0x33')]&&!this[_0x878b('0x21')][_0xf8e7eb[_0x878b('0x22')]][_0x165d19]['agentcomplete']){this[_0x878b('0x21')][_0xf8e7eb['uniqueid']][_0x165d19][_0x878b('0x13')]=!![];this[_0x878b('0x21')][_0xf8e7eb['uniqueid']][_0x165d19][_0x878b('0x4c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x878b('0x21')][_0xf8e7eb[_0x878b('0x22')]][_0x165d19][_0x878b('0x36')]='complete';this['channels'][_0xf8e7eb[_0x878b('0x22')]][_0x165d19]['talktime']=_0xf8e7eb['talktime'];this['channels'][_0xf8e7eb[_0x878b('0x22')]][_0x165d19][_0x878b('0x41')]=_0xf8e7eb[_0x878b('0x41')]==_0x878b('0x4d')?_0x878b('0x4e'):_0xf8e7eb[_0x878b('0x41')];if(this[_0x878b('0x9')][_0xf8e7eb[_0x878b('0x25')]]&&this[_0x878b('0x9')][_0xf8e7eb[_0x878b('0x25')]]['acw']){this[_0x878b('0x21')][_0xf8e7eb['uniqueid']][_0x165d19][_0x878b('0x4f')]=!![];this['channels'][_0xf8e7eb[_0x878b('0x22')]][_0x165d19][_0x878b('0x50')]=this[_0x878b('0x9')][_0xf8e7eb[_0x878b('0x25')]]['acwTimeout'];}this[_0x878b('0x51')][_0xf8e7eb[_0x878b('0x52')]]=_[_0x878b('0x29')](this[_0x878b('0x51')][_0xf8e7eb[_0x878b('0x52')]],[_0x878b('0x25'),_0x878b('0x3e')]);this['emit'](util[_0x878b('0x34')]('user:%s',_0xf8e7eb[_0x878b('0x2d')]),_0x878b('0x53'),this[_0x878b('0x21')][_0xf8e7eb['uniqueid']][_0x165d19]);ami[_0x878b('0x1e')]('custom:agentcomplete',this['channels'][_0xf8e7eb[_0x878b('0x22')]][_0x165d19]);}}}}}}catch(_0x292beb){logger[_0x878b('0x2f')](_0x878b('0x54'),util[_0x878b('0x31')](_0x292beb,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')]['syncVarSet']=function(_0x88b44f){try{if(this[_0x878b('0x1f')](_0x88b44f)){this['addVariable'](_0x88b44f[_0x878b('0x22')],_[_0x878b('0x55')](_0x88b44f[_0x878b('0x56')])[0x0],_0x88b44f[_0x878b('0x57')]);if(this[_0x878b('0x21')][_0x88b44f[_0x878b('0x22')]]){for(var _0x55a8a3 in this['channels'][_0x88b44f[_0x878b('0x22')]]){if(this[_0x878b('0x21')][_0x88b44f[_0x878b('0x22')]][_0x878b('0x49')](_0x55a8a3)){if(_[_0x878b('0x20')](this[_0x878b('0x21')][_0x88b44f['uniqueid']][_0x55a8a3][_0x878b('0xa')])){this['channels'][_0x88b44f[_0x878b('0x22')]][_0x55a8a3][_0x878b('0xa')]={};}this[_0x878b('0x21')][_0x88b44f['uniqueid']][_0x55a8a3][_0x878b('0xa')]=this['variables'][_0x88b44f[_0x878b('0x22')]];}}}}}catch(_0x1a57ee){logger[_0x878b('0x2f')](_0x878b('0x58'),util[_0x878b('0x31')](_0x1a57ee,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x59')]=function(_0x3eb2ed,_0x20ecbe,_0x28319a){var _0x3f96d5=['rtpaudioqos',_0x878b('0x5a'),_0x878b('0x5b'),'rtpaudioqosjitterbridged','rtpaudioqosloss',_0x878b('0x5c'),'rtpaudioqosrtt',_0x878b('0x5d'),_0x878b('0x5e'),_0x878b('0x5f'),_0x878b('0x60'),'bridgepvtcallid',_0x878b('0x61'),_0x878b('0x62'),_0x878b('0x63'),_0x878b('0x64'),_0x878b('0x2d'),_0x878b('0x65'),_0x878b('0x66')];if(!_[_0x878b('0x67')](_0x20ecbe)&&!_['includes'](_0x3f96d5,_0x20ecbe)){if(_[_0x878b('0x20')](this['variables'][_0x3eb2ed])){this[_0x878b('0xa')][_0x3eb2ed]={};}this[_0x878b('0xa')][_0x3eb2ed][_0x20ecbe]=_0x28319a;}};VoiceAgentReport[_0x878b('0x32')]['syncHangup']=function(_0x374cc0){try{if(this[_0x878b('0x1f')](_0x374cc0)){if(this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]]){for(var _0x2eb7a2 in this['channels'][_0x374cc0[_0x878b('0x22')]]){if(this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]][_0x878b('0x49')](_0x2eb7a2)){if(this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]][_0x2eb7a2][_0x878b('0x41')]==_0x878b('0x4d')&&this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]][_0x2eb7a2][_0x878b('0x13')]){this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]][_0x2eb7a2]['agentcompleteAt']=moment()[_0x878b('0x34')](_0x878b('0x35'));}}}ami[_0x878b('0x1e')]('custom:voiceAgentReport',_[_0x878b('0x68')](this['channels'][_0x374cc0['uniqueid']]));delete this[_0x878b('0x21')][_0x374cc0[_0x878b('0x22')]];}if(this['variables'][_0x374cc0['uniqueid']]){delete this[_0x878b('0xa')][_0x374cc0['uniqueid']];}}}catch(_0x3eba86){logger[_0x878b('0x2f')](_0x878b('0x69'),util[_0x878b('0x31')](_0x3eba86,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x1c')]=function(_0x296ec8){try{if(this[_0x878b('0x1f')](_0x296ec8)){if(this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]]){for(var _0x409653 in this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]]){if(this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]][_0x878b('0x49')](_0x409653)){if(_0x296ec8['origtransfereruniqueid']===_0x409653){var _0x18aa7c=moment();this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]][_0x409653][_0x878b('0x13')]=!![];this['channels'][_0x296ec8[_0x878b('0x6a')]][_0x409653][_0x878b('0x4c')]=moment()[_0x878b('0x34')](_0x878b('0x35'));this['channels'][_0x296ec8[_0x878b('0x6a')]][_0x409653]['reason']=_0x878b('0x4d');this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]][_0x409653][_0x878b('0x36')]=_0x878b('0x6b');this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]][_0x409653][_0x878b('0x6c')]=_0x18aa7c['diff'](this[_0x878b('0x21')][_0x296ec8['transfereeuniqueid']][_0x409653][_0x878b('0x33')],_0x878b('0x6d'));}}}}if(this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6e')]]){var _0x135024=this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6e')]];this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6e')]]=this[_0x878b('0x21')][_0x296ec8[_0x878b('0x6a')]];this['channels'][_0x296ec8[_0x878b('0x6a')]]=_0x135024;}}}catch(_0x1cff47){logger[_0x878b('0x2f')](_0x878b('0x6f'),util[_0x878b('0x31')](_0x1cff47,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x1d')]=function(_0x2a831b){try{if(this['isNotNull'](_0x2a831b)){if(this[_0x878b('0x21')][_0x2a831b[_0x878b('0x6a')]]){for(var _0x147612 in this[_0x878b('0x21')][_0x2a831b[_0x878b('0x6a')]]){if(this[_0x878b('0x21')][_0x2a831b[_0x878b('0x6a')]]['hasOwnProperty'](_0x147612)){if(_0x2a831b['transfereruniqueid']===_0x147612){var _0x1e5675=moment();this['channels'][_0x2a831b[_0x878b('0x6a')]][_0x147612][_0x878b('0x13')]=!![];this[_0x878b('0x21')][_0x2a831b[_0x878b('0x6a')]][_0x147612][_0x878b('0x4c')]=_0x1e5675;this['channels'][_0x2a831b[_0x878b('0x6a')]][_0x147612][_0x878b('0x41')]='transfer';this['channels'][_0x2a831b[_0x878b('0x6a')]][_0x147612][_0x878b('0x36')]=_0x878b('0x6b');this[_0x878b('0x21')][_0x2a831b[_0x878b('0x6a')]][_0x147612][_0x878b('0x6c')]=_0x1e5675['diff'](this['channels'][_0x2a831b[_0x878b('0x6a')]][_0x147612]['agentconnectAt'],_0x878b('0x6d'));}}}}}}catch(_0x15acba){logger[_0x878b('0x2f')]('[syncBlindTransfer][VoiceAgentReport]',util[_0x878b('0x31')](_0x15acba,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x878b('0x32')][_0x878b('0x19')]=function(_0x249bb0){var _0x528ca0='';try{if(this[_0x878b('0x1f')](_0x249bb0)){if(_0x249bb0[_0x878b('0x70')]){_0x528ca0=_0x249bb0[_0x878b('0x70')][_0x878b('0x71')](0x0,_0x249bb0['channel'][_0x878b('0x72')]('-'));if(this[_0x878b('0x51')][_0x528ca0]){this['agents'][_0x528ca0][_0x878b('0x73')]=!![];}}}}catch(_0x2ba6d1){logger['error'](_0x878b('0x74'),util[_0x878b('0x31')](_0x2ba6d1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype']['syncMusicOnHoldStop']=function(_0xa1670c){var _0x295f01='';try{if(this[_0x878b('0x1f')](_0xa1670c)){if(_0xa1670c['channel']){_0x295f01=_0xa1670c[_0x878b('0x70')][_0x878b('0x71')](0x0,_0xa1670c[_0x878b('0x70')][_0x878b('0x72')]('-'));if(this['agents'][_0x295f01]){this[_0x878b('0x51')][_0x295f01][_0x878b('0x73')]=![];}}}}catch(_0x2fdeaf){logger['error'](_0x878b('0x75'),util[_0x878b('0x31')](_0x2fdeaf,{'showHidden':![],'depth':null}));}};module[_0x878b('0x76')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index 54dc9a8..5701161 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 _0x4e2b=['user:%s','accountcode','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','transfereecalleridnum','extension','transfererchannel','[syncBlindTransfer][VoiceCallReport]','isNil','mohstarttime','[syncMusicOnHoldStart][VoiceCallReport]','mohtime','milliseconds','[syncMusicOnHoldStop][VoiceCallReport]','exports','lodash','util','path','ioredis','ami','../ami','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','set','queue','dial','playback','voicemail','NO\x20ANSWER','FAILED','redis','defaults','socket.io-emitter','channels','agents','syncNewExten','bind','newexten','syncNewChannel','newstate','syncVarSet','hangup','syncHangup','newcallerid','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','syncMusicOnHoldStop','resolve','actionCoreShowChannels','log','prototype','isNotNull','isUndefined','emit','uniqueid','linkedid','merge','pick','error','[syncNewCallerId][VoiceCallReport]','channel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','toNumber','channelstate','keys','context','from-sip','split','destconnectedlinenum','exten','name','user:agentconnect','[syncNewChannel][VoiceCallReport]','inspect','OutgoingSpoolFailed','application','toLowerCase','applicationdata','appdata','subtract','duration','seconds','lastapplication','startsWith','cdr(','match','[syncNewExten][VoiceCallReport]','syncNewState','answered','answertime','holdtime','diff','calleridnum','destinationchannel','UserId','[syncNewState][VoiceCallReport]','syncMixMonitorFilename','monitor','endsWith','.wav49','replace','.WAV','monitorFilename','find','monitors','rec','variable','mixmonitor_filename','value','xmd-phone','callerid','type','xmd-queue','originatecalleridnum','xmd-destination','destination','xmd-callerid-preview','calleridpreview','xmcs-queue','parse','sipcallid','sipcalllinkedid','[syncVarSet][VoiceCallReport]','billableseconds'];(function(_0x58d01d,_0x4fd99e){var _0x240b7e=function(_0x35e16c){while(--_0x35e16c){_0x58d01d['push'](_0x58d01d['shift']());}};_0x240b7e(++_0x4fd99e);}(_0x4e2b,0xa9));var _0xb4e2=function(_0x2e3fed,_0x598d58){_0x2e3fed=_0x2e3fed-0x0;var _0x366b52=_0x4e2b[_0x2e3fed];return _0x366b52;};'use strict';var BPromise=require('bluebird');var _=require(_0xb4e2('0x0'));var moment=require('moment');var util=require(_0xb4e2('0x1'));var path=require(_0xb4e2('0x2'));var Redis=require(_0xb4e2('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0xb4e2('0x4'));var ami=require(_0xb4e2('0x5'));var Channel=require('../model/channel');var statusDesc=[_0xb4e2('0x6'),_0xb4e2('0x7'),'inuse',_0xb4e2('0x8'),_0xb4e2('0x9'),_0xb4e2('0xa'),_0xb4e2('0xb'),_0xb4e2('0xc'),'onhold'];var applications=[_0xb4e2('0xd'),_0xb4e2('0xe'),'agi',_0xb4e2('0xf'),_0xb4e2('0x10'),_0xb4e2('0x11')];var dispositions=[_0xb4e2('0x12'),_0xb4e2('0x13'),_0xb4e2('0x13'),_0xb4e2('0x12'),_0xb4e2('0x12'),_0xb4e2('0x12'),'ANSWERED','BUSY',_0xb4e2('0x13'),_0xb4e2('0x13'),_0xb4e2('0x13')];var actions={};config[_0xb4e2('0x14')]=_[_0xb4e2('0x15')](config[_0xb4e2('0x14')],{'host':'localhost','port':0x18eb});var io=require(_0xb4e2('0x16'))(new Redis(config[_0xb4e2('0x14')]));function VoiceCallReport(_0x3c9b89){this[_0xb4e2('0x17')]=_0x3c9b89[_0xb4e2('0x17')];this[_0xb4e2('0x18')]=_0x3c9b89[_0xb4e2('0x18')];ami['on']('coreshowchannel',this[_0xb4e2('0x19')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x1b'),this[_0xb4e2('0x19')][_0xb4e2('0x1a')](this));ami['on']('newchannel',this[_0xb4e2('0x1c')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x1d'),this['syncNewState'][_0xb4e2('0x1a')](this));ami['on']('varset',this[_0xb4e2('0x1e')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x1f'),this[_0xb4e2('0x20')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x21'),this[_0xb4e2('0x22')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x23'),this[_0xb4e2('0x24')][_0xb4e2('0x1a')](this));ami['on'](_0xb4e2('0x25'),this[_0xb4e2('0x26')][_0xb4e2('0x1a')](this));ami['on']('musiconholdstart',this[_0xb4e2('0x27')][_0xb4e2('0x1a')](this));ami['on']('musiconholdstop',this[_0xb4e2('0x28')][_0xb4e2('0x1a')](this));return BPromise[_0xb4e2('0x29')]()['then'](ami[_0xb4e2('0x2a')]())['catch'](function(_0x56709c){console[_0xb4e2('0x2b')](_0x56709c);});}VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x2d')]=function(_0xadf0f){return _0xadf0f!==null&&!_[_0xb4e2('0x2e')](_0xadf0f);};VoiceCallReport['prototype'][_0xb4e2('0x2f')]=function(_0x9869a7,_0x20e524,_0x41329e){io['to'](_0x9869a7)[_0xb4e2('0x2f')](_0x20e524,_0x41329e);};VoiceCallReport[_0xb4e2('0x2c')]['syncNewCallerId']=function(_0x40d438){try{if(this[_0xb4e2('0x2d')](_0x40d438)){if(_0x40d438[_0xb4e2('0x30')]===_0x40d438[_0xb4e2('0x31')]){if(!_['isUndefined'](this[_0xb4e2('0x17')][_0x40d438['uniqueid']])){_[_0xb4e2('0x32')](this[_0xb4e2('0x17')][_0x40d438[_0xb4e2('0x30')]],_[_0xb4e2('0x33')](_0x40d438,_['keys'](this[_0xb4e2('0x17')][_0x40d438[_0xb4e2('0x30')]])));}}}}catch(_0x54508f){logger[_0xb4e2('0x34')](_0xb4e2('0x35'),util['inspect'](_0x54508f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x1c')]=function(_0x147620){try{if(this[_0xb4e2('0x2d')](_0x147620)){if(_0x147620[_0xb4e2('0x30')]===_0x147620[_0xb4e2('0x31')]&&_0x147620[_0xb4e2('0x36')]!='OutgoingSpoolFailed'){if(_[_0xb4e2('0x2e')](this[_0xb4e2('0x17')][_0x147620[_0xb4e2('0x30')]])){this['channels'][_0x147620[_0xb4e2('0x30')]]=new Channel();this[_0xb4e2('0x17')][_0x147620[_0xb4e2('0x30')]][_0xb4e2('0x37')]=moment()[_0xb4e2('0x38')](_0xb4e2('0x39'));this['channels'][_0x147620[_0xb4e2('0x30')]][_0xb4e2('0x3a')]=dispositions[_[_0xb4e2('0x3b')](_0x147620[_0xb4e2('0x3c')])];_[_0xb4e2('0x32')](this[_0xb4e2('0x17')][_0x147620['uniqueid']],_[_0xb4e2('0x33')](_0x147620,_[_0xb4e2('0x3d')](this['channels'][_0x147620[_0xb4e2('0x30')]])));if(_0x147620[_0xb4e2('0x3e')]===_0xb4e2('0x3f')){if(this['agents'][_0x147620['channel'][_0xb4e2('0x40')]('-')[0x0]]){this[_0xb4e2('0x18')][_0x147620[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]][_0xb4e2('0x41')]=_0x147620[_0xb4e2('0x42')];this[_0xb4e2('0x2f')](util['format']('user:%s',this[_0xb4e2('0x18')][_0x147620[_0xb4e2('0x36')]['split']('-')[0x0]][_0xb4e2('0x43')]),_0xb4e2('0x44'),{'destaccountcode':this[_0xb4e2('0x18')][_0x147620[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]]['accountcode'],'destconnectedlinenum':_0x147620['exten']});}}}}}}catch(_0x5624e5){logger[_0xb4e2('0x34')](_0xb4e2('0x45'),util[_0xb4e2('0x46')](_0x5624e5,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncNewExten']=function(_0x3b62ea){try{if(this[_0xb4e2('0x2d')](_0x3b62ea)){if(_0x3b62ea['uniqueid']===_0x3b62ea[_0xb4e2('0x31')]&&_0x3b62ea['exten']!='h'&&_0x3b62ea[_0xb4e2('0x36')]!=_0xb4e2('0x47')){_0x3b62ea[_0xb4e2('0x48')]=_0x3b62ea['application'][_0xb4e2('0x49')]();_0x3b62ea[_0xb4e2('0x4a')]=(_0x3b62ea[_0xb4e2('0x4b')]||_0x3b62ea[_0xb4e2('0x4a')])[_0xb4e2('0x49')]();if(_[_0xb4e2('0x2e')](this[_0xb4e2('0x17')][_0x3b62ea[_0xb4e2('0x30')]])){this[_0xb4e2('0x17')][_0x3b62ea['uniqueid']]=new Channel();this['channels'][_0x3b62ea['uniqueid']][_0xb4e2('0x37')]=_0x3b62ea['duration']?moment()[_0xb4e2('0x4c')](moment[_0xb4e2('0x4d')](_0x3b62ea['duration'])[_0xb4e2('0x4e')](),'seconds')[_0xb4e2('0x38')]('YYYY-MM-DD\x20HH:mm:ss'):moment()[_0xb4e2('0x38')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x3b62ea[_0xb4e2('0x30')]][_0xb4e2('0x3a')]=_0xb4e2('0x12');}_[_0xb4e2('0x32')](this[_0xb4e2('0x17')][_0x3b62ea[_0xb4e2('0x30')]],_[_0xb4e2('0x33')](_0x3b62ea,_[_0xb4e2('0x3d')](this[_0xb4e2('0x17')][_0x3b62ea[_0xb4e2('0x30')]])));if(_['includes'](applications,_0x3b62ea['application'])){this[_0xb4e2('0x17')][_0x3b62ea['uniqueid']][_0xb4e2('0x4f')]=_0x3b62ea[_0xb4e2('0x48')];this[_0xb4e2('0x17')][_0x3b62ea['uniqueid']]['lastdata']=_0x3b62ea[_0xb4e2('0x4a')];if(_0x3b62ea['application']===_0xb4e2('0xd')&&_[_0xb4e2('0x50')](_0x3b62ea['applicationdata'],_0xb4e2('0x51'))){var _0x219b1c=_0x3b62ea[_0xb4e2('0x4a')][_0xb4e2('0x40')]('=');var _0x383e99=_0x219b1c[0x0][_0xb4e2('0x52')](/cdr\((.*)\)/);if(_0x383e99){this[_0xb4e2('0x17')][_0x3b62ea['uniqueid']][_0x383e99[0x1]]=_0x219b1c[0x1];}}else if(_0x3b62ea[_0xb4e2('0x48')]===_0xb4e2('0xe')){this['channels'][_0x3b62ea[_0xb4e2('0x30')]]['queue']=_0x3b62ea[_0xb4e2('0x4a')][_0xb4e2('0x40')](',')[0x0];}}}}}catch(_0x503bfc){logger[_0xb4e2('0x34')](_0xb4e2('0x53'),util[_0xb4e2('0x46')](_0x503bfc,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x54')]=function(_0x392f0e){try{if(this[_0xb4e2('0x2d')](_0x392f0e)){if(_0x392f0e[_0xb4e2('0x30')]!==_0x392f0e['linkedid']){if(this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]]){if(_0x392f0e['channelstate']==='6'){if(!this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x55')]){var _0xd2ce22=moment();this[_0xb4e2('0x17')][_0x392f0e['linkedid']][_0xb4e2('0x55')]=!![];this['channels'][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x56')]=_0xd2ce22[_0xb4e2('0x38')](_0xb4e2('0x39'));if(this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x37')]){this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x57')]=_0xd2ce22[_0xb4e2('0x58')](this[_0xb4e2('0x17')][_0x392f0e['linkedid']][_0xb4e2('0x37')],_0xb4e2('0x4e'));}}this[_0xb4e2('0x17')][_0x392f0e['linkedid']][_0xb4e2('0x31')]=_0x392f0e[_0xb4e2('0x30')];if(_0x392f0e['calleridnum']!=='xcally-motion-preview'){this[_0xb4e2('0x17')][_0x392f0e['linkedid']]['connectedlinenum']=_0x392f0e[_0xb4e2('0x59')];}this['channels'][_0x392f0e[_0xb4e2('0x31')]]['connectedlinename']=_0x392f0e['calleridname'];this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x5a')]=_0x392f0e[_0xb4e2('0x36')];this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x3a')]=dispositions[_[_0xb4e2('0x3b')](_0x392f0e['channelstate'])];if(this[_0xb4e2('0x18')][_0x392f0e[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]]){this['channels'][_0x392f0e[_0xb4e2('0x31')]][_0xb4e2('0x5b')]=this[_0xb4e2('0x18')][_0x392f0e['channel'][_0xb4e2('0x40')]('-')[0x0]]['id'];this['channels'][_0x392f0e[_0xb4e2('0x31')]]['membername']=this[_0xb4e2('0x18')][_0x392f0e[_0xb4e2('0x36')]['split']('-')[0x0]][_0xb4e2('0x43')];}}}}else{if(this[_0xb4e2('0x17')][_0x392f0e[_0xb4e2('0x30')]]){if(_0x392f0e[_0xb4e2('0x3c')]==='6'){if(this[_0xb4e2('0x18')][_0x392f0e[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]]){this[_0xb4e2('0x17')][_0x392f0e['uniqueid']][_0xb4e2('0x5b')]=this[_0xb4e2('0x18')][_0x392f0e[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]]['id'];this['channels'][_0x392f0e[_0xb4e2('0x30')]]['membername']=this[_0xb4e2('0x18')][_0x392f0e[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]][_0xb4e2('0x43')];}}}}}}catch(_0x246f3f){logger[_0xb4e2('0x34')](_0xb4e2('0x5c'),util['inspect'](_0x246f3f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x5d')]=function(_0x24afb6,_0x4d257a){if(this[_0xb4e2('0x17')][_0x24afb6]){this[_0xb4e2('0x17')][_0x24afb6][_0xb4e2('0x5e')]=!![];if(_[_0xb4e2('0x5f')](_0x4d257a,_0xb4e2('0x60'))){_0x4d257a=_0x4d257a[_0xb4e2('0x61')](_0xb4e2('0x60'),_0xb4e2('0x62'));}this[_0xb4e2('0x17')][_0x24afb6][_0xb4e2('0x63')]=_0x4d257a;var _0x840712=_[_0xb4e2('0x64')](this[_0xb4e2('0x17')][_0x24afb6][_0xb4e2('0x65')],{'filename':_0x4d257a});if(_['isNil'](_0x840712)){this[_0xb4e2('0x17')][_0x24afb6][_0xb4e2('0x65')]['push']({'filename':_0x4d257a,'createdAt':moment()[_0xb4e2('0x38')](_0xb4e2('0x39')),'mixmonitorid':'','status':_0xb4e2('0x66')});}}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x1e')]=function(_0x5107f2){try{if(this[_0xb4e2('0x2d')](_0x5107f2)){if(this['channels'][_0x5107f2['uniqueid']]&&_0x5107f2[_0xb4e2('0x36')]!=_0xb4e2('0x47')){if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')])){if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x68')])){this[_0xb4e2('0x5d')](_0x5107f2[_0xb4e2('0x30')],_0x5107f2[_0xb4e2('0x69')]);}else if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x6a')])){this[_0xb4e2('0x17')][_0x5107f2['uniqueid']][_0xb4e2('0x59')]=_0x5107f2[_0xb4e2('0x69')];}else if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')]['xmd-callerid'])){this[_0xb4e2('0x17')][_0x5107f2['uniqueid']][_0xb4e2('0x6b')]=_0x5107f2['value'];}else if(this['isNotNull'](_0x5107f2[_0xb4e2('0x67')]['xmd-cdrtype'])){this['channels'][_0x5107f2['uniqueid']][_0xb4e2('0x6c')]=_0x5107f2[_0xb4e2('0x69')];}else if(this['isNotNull'](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x6d')])){this[_0xb4e2('0x17')][_0x5107f2['uniqueid']][_0xb4e2('0xe')]=_0x5107f2[_0xb4e2('0x69')]['split'](',')[0x0];}else if(this['isNotNull'](_0x5107f2[_0xb4e2('0x67')]['xmd-originatecalleridnum'])){this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x30')]][_0xb4e2('0x6e')]=_0x5107f2[_0xb4e2('0x69')];}else if(this['isNotNull'](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x6f')])){this[_0xb4e2('0x17')][_0x5107f2['uniqueid']][_0xb4e2('0x70')]=_0x5107f2['value'];}else if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x71')])){this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x30')]][_0xb4e2('0x72')]=_0x5107f2[_0xb4e2('0x69')];}else if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x73')])){this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x30')]]['queue']=_0x5107f2[_0xb4e2('0x69')];}else if(this[_0xb4e2('0x2d')](_0x5107f2['variable']['sipcallid'])){this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x30')]]['sipcalluniqueid']=_0x5107f2['value'];}}}else if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x68')])){if(_0x5107f2[_0xb4e2('0x69')]){var _0x33704f=path[_0xb4e2('0x74')](_0x5107f2[_0xb4e2('0x69')])['name'];this[_0xb4e2('0x5d')](_0x33704f,_0x5107f2[_0xb4e2('0x69')]);}}else if(this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x31')]]){if(this['isNotNull'](_0x5107f2[_0xb4e2('0x67')])){if(this[_0xb4e2('0x2d')](_0x5107f2[_0xb4e2('0x67')][_0xb4e2('0x75')])){this[_0xb4e2('0x17')][_0x5107f2[_0xb4e2('0x31')]][_0xb4e2('0x76')]=_0x5107f2[_0xb4e2('0x69')];}}}}}catch(_0x2f028c){logger[_0xb4e2('0x34')](_0xb4e2('0x77'),util['inspect'](_0x2f028c,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x20')]=function(_0x43cd38){try{if(this['isNotNull'](_0x43cd38)){if(this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]]){var _0x1040be=moment();this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]]['endtime']=_0x1040be['format']('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x43cd38[_0xb4e2('0x30')]][_0xb4e2('0x4d')]=_0x1040be[_0xb4e2('0x58')](this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]][_0xb4e2('0x37')],'seconds');if(this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]]['answered']){this[_0xb4e2('0x17')][_0x43cd38['uniqueid']]['billableseconds']=_0x1040be['diff'](this['channels'][_0x43cd38['uniqueid']][_0xb4e2('0x56')],_0xb4e2('0x4e'));this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]][_0xb4e2('0x57')]=this[_0xb4e2('0x17')][_0x43cd38[_0xb4e2('0x30')]][_0xb4e2('0x4d')]-this[_0xb4e2('0x17')][_0x43cd38['uniqueid']][_0xb4e2('0x78')];}if(_0x43cd38['context']===_0xb4e2('0x3f')){if(this[_0xb4e2('0x18')][_0x43cd38[_0xb4e2('0x36')]['split']('-')[0x0]]){this[_0xb4e2('0x18')][_0x43cd38[_0xb4e2('0x36')][_0xb4e2('0x40')]('-')[0x0]]=_['omit'](this[_0xb4e2('0x18')][_0x43cd38['channel']['split']('-')[0x0]],[_0xb4e2('0x41')]);this['emit'](util[_0xb4e2('0x38')](_0xb4e2('0x79'),this[_0xb4e2('0x18')][_0x43cd38[_0xb4e2('0x36')]['split']('-')[0x0]][_0xb4e2('0x43')]),'user:agentcomplete',{'destaccountcode':this['agents'][_0x43cd38['channel'][_0xb4e2('0x40')]('-')[0x0]][_0xb4e2('0x7a')]});}}ami[_0xb4e2('0x2f')](_0xb4e2('0x7b'),this[_0xb4e2('0x17')][_0x43cd38['uniqueid']]);delete this['channels'][_0x43cd38[_0xb4e2('0x30')]];}}}catch(_0x9ffe7){logger['error'](_0xb4e2('0x7c'),util[_0xb4e2('0x46')](_0x9ffe7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x24')]=function(_0x5b5cfb){try{if(this['isNotNull'](_0x5b5cfb)){if(this[_0xb4e2('0x17')][_0x5b5cfb['transfereeuniqueid']]){this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x7d')]][_0xb4e2('0x7e')]=_0x5b5cfb[_0xb4e2('0x7f')];this['channels'][_0x5b5cfb[_0xb4e2('0x7d')]][_0xb4e2('0x80')]=_0x5b5cfb[_0xb4e2('0x81')];if(this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x82')]]){var _0x1fab70=this['channels'][_0x5b5cfb[_0xb4e2('0x82')]];this[_0xb4e2('0x17')][_0x5b5cfb['secondtransfereruniqueid']]=this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x7d')]];this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x7d')]]=_0x1fab70;}}else if(this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x83')]]){this['channels'][_0x5b5cfb[_0xb4e2('0x83')]][_0xb4e2('0x7e')]=_0x5b5cfb[_0xb4e2('0x7f')];this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x83')]]['transferconnectedlinenum']=_0x5b5cfb[_0xb4e2('0x81')];if(this['channels'][_0x5b5cfb[_0xb4e2('0x84')]]){var _0x1fab70=this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x84')]];this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x84')]]=this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x83')]];this[_0xb4e2('0x17')][_0x5b5cfb[_0xb4e2('0x83')]]=_0x1fab70;}}}}catch(_0x3f2e6b){logger[_0xb4e2('0x34')](_0xb4e2('0x85'),util[_0xb4e2('0x46')](_0x3f2e6b,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xb4e2('0x26')]=function(_0x538f28){try{if(this['isNotNull'](_0x538f28)){if(this[_0xb4e2('0x17')][_0x538f28[_0xb4e2('0x7d')]]){this['channels'][_0x538f28[_0xb4e2('0x7d')]][_0xb4e2('0x7e')]=_0x538f28[_0xb4e2('0x86')];this['channels'][_0x538f28['transfereeuniqueid']][_0xb4e2('0x80')]=_0x538f28[_0xb4e2('0x87')];this[_0xb4e2('0x20')]({'event':'BlindTransfer','uniqueid':_0x538f28[_0xb4e2('0x7d')],'context':_0x538f28['context'],'channel':_0x538f28[_0xb4e2('0x88')]});}}}catch(_0x1c9305){logger[_0xb4e2('0x34')](_0xb4e2('0x89'),util[_0xb4e2('0x46')](_0x1c9305,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x27')]=function(_0x592738){try{if(this['isNotNull'](_0x592738)){if(this[_0xb4e2('0x17')][_0x592738[_0xb4e2('0x30')]]){if(!_[_0xb4e2('0x8a')](this[_0xb4e2('0x17')][_0x592738[_0xb4e2('0x30')]]['answertime'])){this[_0xb4e2('0x17')][_0x592738[_0xb4e2('0x30')]][_0xb4e2('0x8b')]=moment()[_0xb4e2('0x38')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x7914ff){logger[_0xb4e2('0x34')](_0xb4e2('0x8c'),util[_0xb4e2('0x46')](_0x7914ff,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xb4e2('0x2c')][_0xb4e2('0x28')]=function(_0x4e5995){try{if(this['isNotNull'](_0x4e5995)){if(this[_0xb4e2('0x17')][_0x4e5995[_0xb4e2('0x30')]]){if(!_[_0xb4e2('0x8a')](this[_0xb4e2('0x17')][_0x4e5995[_0xb4e2('0x30')]]['mohstarttime'])){this[_0xb4e2('0x17')][_0x4e5995[_0xb4e2('0x30')]][_0xb4e2('0x8d')]+=moment()[_0xb4e2('0x8e')](0x0)[_0xb4e2('0x58')](this[_0xb4e2('0x17')][_0x4e5995['uniqueid']][_0xb4e2('0x8b')],_0xb4e2('0x4e'));delete this[_0xb4e2('0x17')][_0x4e5995[_0xb4e2('0x30')]][_0xb4e2('0x8b')];}}}}catch(_0xb7ac46){logger[_0xb4e2('0x34')](_0xb4e2('0x8f'),util[_0xb4e2('0x46')](_0xb7ac46,{'showHidden':![],'depth':null}));}};module[_0xb4e2('0x90')]=VoiceCallReport; \ No newline at end of file +var _0x1ac8=['[syncNewCallerId][VoiceCallReport]','inspect','syncNewChannel','channel','starttime','format','YYYY-MM-DD\x20HH:mm:ss','toNumber','channelstate','context','from-sip','split','destconnectedlinenum','exten','name','user:agentconnect','accountcode','error','[syncNewChannel][VoiceCallReport]','OutgoingSpoolFailed','application','toLowerCase','applicationdata','duration','subtract','disposition','lastapplication','lastdata','match','[syncNewExten][VoiceCallReport]','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','calleridnum','calleridname','destinationchannel','membername','UserId','endsWith','.wav49','replace','monitorFilename','find','isNil','monitors','push','rec','variable','mixmonitor_filename','syncMixMonitorFilename','xmd-phone','xmd-callerid','value','type','xmd-destination','destination','xmd-callerid-preview','xmcs-queue','sipcallid','sipcalluniqueid','parse','endtime','seconds','billableseconds','omit','user:agentcomplete','custom:voiceCallReport','[syncHangup][VoiceCallReport]','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[syncAttendedTransfer][VoiceCallReport]','extension','BlindTransfer','[syncBlindTransfer][VoiceCallReport]','[syncMusicOnHoldStart][VoiceCallReport]','syncMusicOnHoldStop','mohstarttime','mohtime','exports','bluebird','lodash','moment','util','path','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','unknown','not_inuse','busy','invalid','unavailable','ringing','ringinuse','onhold','set','queue','agi','dial','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','defaults','localhost','redis','channels','agents','syncNewExten','bind','newexten','newchannel','newstate','syncNewState','varset','syncVarSet','hangup','syncHangup','syncNewCallerId','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncMusicOnHoldStart','musiconholdstop','resolve','then','catch','isNotNull','isUndefined','prototype','emit','uniqueid','linkedid','merge','pick','keys'];(function(_0x342700,_0x569f75){var _0x53406f=function(_0x3b3c32){while(--_0x3b3c32){_0x342700['push'](_0x342700['shift']());}};_0x53406f(++_0x569f75);}(_0x1ac8,0xed));var _0x81ac=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x1ac8[_0x4565bf];return _0x5610ba;};'use strict';var BPromise=require(_0x81ac('0x0'));var _=require(_0x81ac('0x1'));var moment=require(_0x81ac('0x2'));var util=require(_0x81ac('0x3'));var path=require(_0x81ac('0x4'));var Redis=require('ioredis');var config=require(_0x81ac('0x5'));var logger=require(_0x81ac('0x6'))(_0x81ac('0x7'));var ami=require(_0x81ac('0x8'));var Channel=require(_0x81ac('0x9'));var statusDesc=[_0x81ac('0xa'),_0x81ac('0xb'),'inuse',_0x81ac('0xc'),_0x81ac('0xd'),_0x81ac('0xe'),_0x81ac('0xf'),_0x81ac('0x10'),_0x81ac('0x11')];var applications=[_0x81ac('0x12'),_0x81ac('0x13'),_0x81ac('0x14'),_0x81ac('0x15'),'playback',_0x81ac('0x16')];var dispositions=[_0x81ac('0x17'),'FAILED',_0x81ac('0x18'),'NO\x20ANSWER',_0x81ac('0x17'),'NO\x20ANSWER',_0x81ac('0x19'),_0x81ac('0x1a'),'FAILED','FAILED',_0x81ac('0x18')];var actions={};config['redis']=_[_0x81ac('0x1b')](config['redis'],{'host':_0x81ac('0x1c'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x81ac('0x1d')]));function VoiceCallReport(_0x23b015){this[_0x81ac('0x1e')]=_0x23b015['channels'];this[_0x81ac('0x1f')]=_0x23b015[_0x81ac('0x1f')];ami['on']('coreshowchannel',this[_0x81ac('0x20')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x22'),this[_0x81ac('0x20')]['bind'](this));ami['on'](_0x81ac('0x23'),this['syncNewChannel']['bind'](this));ami['on'](_0x81ac('0x24'),this[_0x81ac('0x25')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x26'),this[_0x81ac('0x27')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x28'),this[_0x81ac('0x29')][_0x81ac('0x21')](this));ami['on']('newcallerid',this[_0x81ac('0x2a')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x2b'),this[_0x81ac('0x2c')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x2d'),this[_0x81ac('0x2e')]['bind'](this));ami['on']('musiconholdstart',this[_0x81ac('0x2f')][_0x81ac('0x21')](this));ami['on'](_0x81ac('0x30'),this['syncMusicOnHoldStop'][_0x81ac('0x21')](this));return BPromise[_0x81ac('0x31')]()[_0x81ac('0x32')](ami['actionCoreShowChannels']())[_0x81ac('0x33')](function(_0x13b761){console['log'](_0x13b761);});}VoiceCallReport['prototype'][_0x81ac('0x34')]=function(_0x373887){return _0x373887!==null&&!_[_0x81ac('0x35')](_0x373887);};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x37')]=function(_0x37594b,_0xb3f5d3,_0x478344){io['to'](_0x37594b)[_0x81ac('0x37')](_0xb3f5d3,_0x478344);};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x2a')]=function(_0x47ad49){try{if(this[_0x81ac('0x34')](_0x47ad49)){if(_0x47ad49[_0x81ac('0x38')]===_0x47ad49[_0x81ac('0x39')]){if(!_['isUndefined'](this[_0x81ac('0x1e')][_0x47ad49['uniqueid']])){_[_0x81ac('0x3a')](this[_0x81ac('0x1e')][_0x47ad49[_0x81ac('0x38')]],_[_0x81ac('0x3b')](_0x47ad49,_[_0x81ac('0x3c')](this[_0x81ac('0x1e')][_0x47ad49[_0x81ac('0x38')]])));}}}}catch(_0x37c2c7){logger['error'](_0x81ac('0x3d'),util[_0x81ac('0x3e')](_0x37c2c7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x3f')]=function(_0x4e350a){try{if(this['isNotNull'](_0x4e350a)){if(_0x4e350a[_0x81ac('0x38')]===_0x4e350a[_0x81ac('0x39')]&&_0x4e350a[_0x81ac('0x40')]!='OutgoingSpoolFailed'){if(_['isUndefined'](this[_0x81ac('0x1e')][_0x4e350a[_0x81ac('0x38')]])){this[_0x81ac('0x1e')][_0x4e350a[_0x81ac('0x38')]]=new Channel();this[_0x81ac('0x1e')][_0x4e350a[_0x81ac('0x38')]][_0x81ac('0x41')]=moment()[_0x81ac('0x42')](_0x81ac('0x43'));this['channels'][_0x4e350a[_0x81ac('0x38')]]['disposition']=dispositions[_[_0x81ac('0x44')](_0x4e350a[_0x81ac('0x45')])];_[_0x81ac('0x3a')](this[_0x81ac('0x1e')][_0x4e350a[_0x81ac('0x38')]],_[_0x81ac('0x3b')](_0x4e350a,_['keys'](this[_0x81ac('0x1e')][_0x4e350a[_0x81ac('0x38')]])));if(_0x4e350a[_0x81ac('0x46')]===_0x81ac('0x47')){if(this[_0x81ac('0x1f')][_0x4e350a['channel']['split']('-')[0x0]]){this['agents'][_0x4e350a[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x49')]=_0x4e350a[_0x81ac('0x4a')];this[_0x81ac('0x37')](util[_0x81ac('0x42')]('user:%s',this[_0x81ac('0x1f')][_0x4e350a[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x4b')]),_0x81ac('0x4c'),{'destaccountcode':this[_0x81ac('0x1f')][_0x4e350a[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x4d')],'destconnectedlinenum':_0x4e350a[_0x81ac('0x4a')]});}}}}}}catch(_0x21372e){logger[_0x81ac('0x4e')](_0x81ac('0x4f'),util[_0x81ac('0x3e')](_0x21372e,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x20')]=function(_0x37d84d){try{if(this[_0x81ac('0x34')](_0x37d84d)){if(_0x37d84d[_0x81ac('0x38')]===_0x37d84d[_0x81ac('0x39')]&&_0x37d84d[_0x81ac('0x4a')]!='h'&&_0x37d84d[_0x81ac('0x40')]!=_0x81ac('0x50')){_0x37d84d[_0x81ac('0x51')]=_0x37d84d[_0x81ac('0x51')][_0x81ac('0x52')]();_0x37d84d[_0x81ac('0x53')]=(_0x37d84d['appdata']||_0x37d84d[_0x81ac('0x53')])[_0x81ac('0x52')]();if(_['isUndefined'](this['channels'][_0x37d84d[_0x81ac('0x38')]])){this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]]=new Channel();this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]][_0x81ac('0x41')]=_0x37d84d[_0x81ac('0x54')]?moment()[_0x81ac('0x55')](moment[_0x81ac('0x54')](_0x37d84d[_0x81ac('0x54')])['seconds'](),'seconds')['format'](_0x81ac('0x43')):moment()[_0x81ac('0x42')](_0x81ac('0x43'));this['channels'][_0x37d84d[_0x81ac('0x38')]][_0x81ac('0x56')]=_0x81ac('0x17');}_['merge'](this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]],_[_0x81ac('0x3b')](_0x37d84d,_[_0x81ac('0x3c')](this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]])));if(_['includes'](applications,_0x37d84d[_0x81ac('0x51')])){this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]][_0x81ac('0x57')]=_0x37d84d[_0x81ac('0x51')];this[_0x81ac('0x1e')][_0x37d84d[_0x81ac('0x38')]][_0x81ac('0x58')]=_0x37d84d[_0x81ac('0x53')];if(_0x37d84d[_0x81ac('0x51')]===_0x81ac('0x12')&&_['startsWith'](_0x37d84d[_0x81ac('0x53')],'cdr(')){var _0x2cc7b9=_0x37d84d[_0x81ac('0x53')][_0x81ac('0x48')]('=');var _0x25c93=_0x2cc7b9[0x0][_0x81ac('0x59')](/cdr\((.*)\)/);if(_0x25c93){this['channels'][_0x37d84d['uniqueid']][_0x25c93[0x1]]=_0x2cc7b9[0x1];}}else if(_0x37d84d['application']===_0x81ac('0x13')){this['channels'][_0x37d84d['uniqueid']][_0x81ac('0x13')]=_0x37d84d['applicationdata']['split'](',')[0x0];}}}}}catch(_0x1cef94){logger[_0x81ac('0x4e')](_0x81ac('0x5a'),util[_0x81ac('0x3e')](_0x1cef94,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x25')]=function(_0x3f6265){try{if(this['isNotNull'](_0x3f6265)){if(_0x3f6265['uniqueid']!==_0x3f6265[_0x81ac('0x39')]){if(this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]]){if(_0x3f6265[_0x81ac('0x45')]==='6'){if(!this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x5b')]){var _0x5a5a31=moment();this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x5b')]=!![];this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x5c')]=_0x5a5a31['format'](_0x81ac('0x43'));if(this['channels'][_0x3f6265['linkedid']]['starttime']){this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x5d')]=_0x5a5a31[_0x81ac('0x5e')](this['channels'][_0x3f6265['linkedid']][_0x81ac('0x41')],'seconds');}}this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x39')]=_0x3f6265['uniqueid'];if(_0x3f6265['calleridnum']!==_0x81ac('0x5f')){this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]][_0x81ac('0x60')]=_0x3f6265[_0x81ac('0x61')];}this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]]['connectedlinename']=_0x3f6265[_0x81ac('0x62')];this[_0x81ac('0x1e')][_0x3f6265['linkedid']][_0x81ac('0x63')]=_0x3f6265[_0x81ac('0x40')];this['channels'][_0x3f6265[_0x81ac('0x39')]]['disposition']=dispositions[_['toNumber'](_0x3f6265['channelstate'])];if(this[_0x81ac('0x1f')][_0x3f6265['channel'][_0x81ac('0x48')]('-')[0x0]]){this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x39')]]['UserId']=this[_0x81ac('0x1f')][_0x3f6265[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]]['id'];this[_0x81ac('0x1e')][_0x3f6265['linkedid']][_0x81ac('0x64')]=this[_0x81ac('0x1f')][_0x3f6265[_0x81ac('0x40')]['split']('-')[0x0]][_0x81ac('0x4b')];}}}}else{if(this[_0x81ac('0x1e')][_0x3f6265[_0x81ac('0x38')]]){if(_0x3f6265[_0x81ac('0x45')]==='6'){if(this[_0x81ac('0x1f')][_0x3f6265['channel'][_0x81ac('0x48')]('-')[0x0]]){this[_0x81ac('0x1e')][_0x3f6265['uniqueid']][_0x81ac('0x65')]=this['agents'][_0x3f6265[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]]['id'];this['channels'][_0x3f6265['uniqueid']][_0x81ac('0x64')]=this[_0x81ac('0x1f')][_0x3f6265[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x4b')];}}}}}}catch(_0x494cbe){logger[_0x81ac('0x4e')]('[syncNewState][VoiceCallReport]',util[_0x81ac('0x3e')](_0x494cbe,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')]['syncMixMonitorFilename']=function(_0x2e04de,_0x1112db){if(this[_0x81ac('0x1e')][_0x2e04de]){this[_0x81ac('0x1e')][_0x2e04de]['monitor']=!![];if(_[_0x81ac('0x66')](_0x1112db,_0x81ac('0x67'))){_0x1112db=_0x1112db[_0x81ac('0x68')](_0x81ac('0x67'),'.WAV');}this[_0x81ac('0x1e')][_0x2e04de][_0x81ac('0x69')]=_0x1112db;var _0x5565cb=_[_0x81ac('0x6a')](this[_0x81ac('0x1e')][_0x2e04de]['monitors'],{'filename':_0x1112db});if(_[_0x81ac('0x6b')](_0x5565cb)){this['channels'][_0x2e04de][_0x81ac('0x6c')][_0x81ac('0x6d')]({'filename':_0x1112db,'createdAt':moment()[_0x81ac('0x42')](_0x81ac('0x43')),'mixmonitorid':'','status':_0x81ac('0x6e')});}}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x27')]=function(_0x35179e){try{if(this[_0x81ac('0x34')](_0x35179e)){if(this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]]&&_0x35179e[_0x81ac('0x40')]!=_0x81ac('0x50')){if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')])){if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x70')])){this[_0x81ac('0x71')](_0x35179e[_0x81ac('0x38')],_0x35179e['value']);}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x72')])){this[_0x81ac('0x1e')][_0x35179e['uniqueid']][_0x81ac('0x61')]=_0x35179e['value'];}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x73')])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]]['callerid']=_0x35179e[_0x81ac('0x74')];}else if(this['isNotNull'](_0x35179e[_0x81ac('0x6f')]['xmd-cdrtype'])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]][_0x81ac('0x75')]=_0x35179e[_0x81ac('0x74')];}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')]['xmd-queue'])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]][_0x81ac('0x13')]=_0x35179e['value'][_0x81ac('0x48')](',')[0x0];}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')]['xmd-originatecalleridnum'])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]]['originatecalleridnum']=_0x35179e[_0x81ac('0x74')];}else if(this[_0x81ac('0x34')](_0x35179e['variable'][_0x81ac('0x76')])){this[_0x81ac('0x1e')][_0x35179e['uniqueid']][_0x81ac('0x77')]=_0x35179e[_0x81ac('0x74')];}else if(this['isNotNull'](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x78')])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]]['calleridpreview']=_0x35179e[_0x81ac('0x74')];}else if(this['isNotNull'](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x79')])){this['channels'][_0x35179e['uniqueid']][_0x81ac('0x13')]=_0x35179e['value'];}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x7a')])){this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x38')]][_0x81ac('0x7b')]=_0x35179e['value'];}}}else if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x70')])){if(_0x35179e[_0x81ac('0x74')]){var _0x558bba=path[_0x81ac('0x7c')](_0x35179e[_0x81ac('0x74')])[_0x81ac('0x4b')];this[_0x81ac('0x71')](_0x558bba,_0x35179e['value']);}}else if(this[_0x81ac('0x1e')][_0x35179e[_0x81ac('0x39')]]){if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')])){if(this[_0x81ac('0x34')](_0x35179e[_0x81ac('0x6f')][_0x81ac('0x7a')])){this[_0x81ac('0x1e')][_0x35179e['linkedid']]['sipcalllinkedid']=_0x35179e[_0x81ac('0x74')];}}}}}catch(_0x31d0bf){logger[_0x81ac('0x4e')]('[syncVarSet][VoiceCallReport]',util['inspect'](_0x31d0bf,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x81ac('0x29')]=function(_0x4df6ab){try{if(this['isNotNull'](_0x4df6ab)){if(this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]]){var _0x133193=moment();this[_0x81ac('0x1e')][_0x4df6ab['uniqueid']][_0x81ac('0x7d')]=_0x133193['format'](_0x81ac('0x43'));this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]][_0x81ac('0x54')]=_0x133193['diff'](this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]][_0x81ac('0x41')],_0x81ac('0x7e'));if(this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]][_0x81ac('0x5b')]){this[_0x81ac('0x1e')][_0x4df6ab['uniqueid']][_0x81ac('0x7f')]=_0x133193['diff'](this['channels'][_0x4df6ab[_0x81ac('0x38')]]['answertime'],_0x81ac('0x7e'));this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]][_0x81ac('0x5d')]=this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]]['duration']-this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]][_0x81ac('0x7f')];}if(_0x4df6ab['context']===_0x81ac('0x47')){if(this[_0x81ac('0x1f')][_0x4df6ab[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]]){this[_0x81ac('0x1f')][_0x4df6ab[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]]=_[_0x81ac('0x80')](this['agents'][_0x4df6ab['channel']['split']('-')[0x0]],[_0x81ac('0x49')]);this['emit'](util[_0x81ac('0x42')]('user:%s',this['agents'][_0x4df6ab[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x4b')]),_0x81ac('0x81'),{'destaccountcode':this[_0x81ac('0x1f')][_0x4df6ab[_0x81ac('0x40')][_0x81ac('0x48')]('-')[0x0]][_0x81ac('0x4d')]});}}ami[_0x81ac('0x37')](_0x81ac('0x82'),this[_0x81ac('0x1e')][_0x4df6ab['uniqueid']]);delete this[_0x81ac('0x1e')][_0x4df6ab[_0x81ac('0x38')]];}}}catch(_0x1eea38){logger[_0x81ac('0x4e')](_0x81ac('0x83'),util[_0x81ac('0x3e')](_0x1eea38,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x2c')]=function(_0x46629f){try{if(this[_0x81ac('0x34')](_0x46629f)){if(this['channels'][_0x46629f[_0x81ac('0x84')]]){this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x84')]][_0x81ac('0x85')]=_0x46629f[_0x81ac('0x86')];this[_0x81ac('0x1e')][_0x46629f['transfereeuniqueid']][_0x81ac('0x87')]=_0x46629f[_0x81ac('0x88')];if(this['channels'][_0x46629f[_0x81ac('0x89')]]){var _0x2c9b5b=this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x89')]];this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x89')]]=this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x84')]];this['channels'][_0x46629f[_0x81ac('0x84')]]=_0x2c9b5b;}}else if(this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8a')]]){this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8a')]][_0x81ac('0x85')]=_0x46629f[_0x81ac('0x86')];this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8a')]]['transferconnectedlinenum']=_0x46629f[_0x81ac('0x88')];if(this[_0x81ac('0x1e')][_0x46629f['origtransfereruniqueid']]){var _0x2c9b5b=this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8b')]];this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8b')]]=this[_0x81ac('0x1e')][_0x46629f[_0x81ac('0x8a')]];this['channels'][_0x46629f[_0x81ac('0x8a')]]=_0x2c9b5b;}}}}catch(_0x36f9d7){logger[_0x81ac('0x4e')](_0x81ac('0x8c'),util[_0x81ac('0x3e')](_0x36f9d7,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x2e')]=function(_0x5c0956){try{if(this[_0x81ac('0x34')](_0x5c0956)){if(this[_0x81ac('0x1e')][_0x5c0956[_0x81ac('0x84')]]){this[_0x81ac('0x1e')][_0x5c0956[_0x81ac('0x84')]][_0x81ac('0x85')]=_0x5c0956['transfereecalleridnum'];this[_0x81ac('0x1e')][_0x5c0956[_0x81ac('0x84')]][_0x81ac('0x87')]=_0x5c0956[_0x81ac('0x8d')];this['syncHangup']({'event':_0x81ac('0x8e'),'uniqueid':_0x5c0956[_0x81ac('0x84')],'context':_0x5c0956[_0x81ac('0x46')],'channel':_0x5c0956['transfererchannel']});}}}catch(_0x514f4d){logger[_0x81ac('0x4e')](_0x81ac('0x8f'),util[_0x81ac('0x3e')](_0x514f4d,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x2f')]=function(_0x177ba6){try{if(this[_0x81ac('0x34')](_0x177ba6)){if(this[_0x81ac('0x1e')][_0x177ba6[_0x81ac('0x38')]]){if(!_[_0x81ac('0x6b')](this['channels'][_0x177ba6[_0x81ac('0x38')]]['answertime'])){this[_0x81ac('0x1e')][_0x177ba6['uniqueid']]['mohstarttime']=moment()[_0x81ac('0x42')]('YYYY-MM-DD\x20HH:mm:ss');}}}}catch(_0x4e22b5){logger[_0x81ac('0x4e')](_0x81ac('0x90'),util[_0x81ac('0x3e')](_0x4e22b5,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x81ac('0x36')][_0x81ac('0x91')]=function(_0x20f691){try{if(this[_0x81ac('0x34')](_0x20f691)){if(this[_0x81ac('0x1e')][_0x20f691[_0x81ac('0x38')]]){if(!_[_0x81ac('0x6b')](this[_0x81ac('0x1e')][_0x20f691['uniqueid']][_0x81ac('0x92')])){this['channels'][_0x20f691[_0x81ac('0x38')]][_0x81ac('0x93')]+=moment()['milliseconds'](0x0)[_0x81ac('0x5e')](this[_0x81ac('0x1e')][_0x20f691[_0x81ac('0x38')]][_0x81ac('0x92')],'seconds');delete this[_0x81ac('0x1e')][_0x20f691[_0x81ac('0x38')]][_0x81ac('0x92')];}}}}catch(_0x5d22ec){logger[_0x81ac('0x4e')]('[syncMusicOnHoldStop][VoiceCallReport]',util[_0x81ac('0x3e')](_0x5d22ec,{'showHidden':![],'depth':null}));}};module[_0x81ac('0x94')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index f10d78e..41790a0 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 _0xf8b1=['includes','endtime','duration','starttime','seconds','complete','total','answertime','answered','holdtime','diff','billableseconds','sumHoldTime','sumBillable','sumDuration','custom:voiceDialReport','voice_outbound:save','info','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','moment','util','ioredis','../../../config/environment','ami','../ami','redis','defaults','localhost','socket.io-emitter','outbound','dialbegin','syncDialBegin','varset','syncVarSet','bind','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','channels','uniqueid','called','channel','substring','lastIndexOf','event','privilege','voice:outbound','voice_outbound_channel:save','custom:dialbegin','inspect','syncDialEnd','dialstatus','ANSWER','connectedlinenum','connectedlinename','format','YYYY-MM-DD\x20HH:mm:ss','lastevent','custom:dialconnect','error','[syncDialEnd][VoiceDialReport]','keys','value','variable','outboundrouteid','variables','addVariable','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','memberrealtime','isNil'];(function(_0x42faef,_0x2b3aaf){var _0x1a2cdd=function(_0x26301d){while(--_0x26301d){_0x42faef['push'](_0x42faef['shift']());}};_0x1a2cdd(++_0x2b3aaf);}(_0xf8b1,0x1c8));var _0x1f8b=function(_0x4083df,_0xd407){_0x4083df=_0x4083df-0x0;var _0x6947cd=_0xf8b1[_0x4083df];return _0x6947cd;};'use strict';var _=require('lodash');var moment=require(_0x1f8b('0x0'));var util=require(_0x1f8b('0x1'));var Redis=require(_0x1f8b('0x2'));var config=require(_0x1f8b('0x3'));var logger=require('../../../config/logger')(_0x1f8b('0x4'));var ami=require(_0x1f8b('0x5'));config[_0x1f8b('0x6')]=_[_0x1f8b('0x7')](config[_0x1f8b('0x6')],{'host':_0x1f8b('0x8'),'port':0x18eb});var io=require(_0x1f8b('0x9'))(new Redis(config[_0x1f8b('0x6')]));function VoiceDialReport(_0x2c815d){this['channels']=_0x2c815d['outboundChannels'];this[_0x1f8b('0xa')]=_0x2c815d[_0x1f8b('0xa')];this['variables']={};ami['on'](_0x1f8b('0xb'),this[_0x1f8b('0xc')]['bind'](this));ami['on']('dialend',this['syncDialEnd']['bind'](this));ami['on'](_0x1f8b('0xd'),this[_0x1f8b('0xe')][_0x1f8b('0xf')](this));ami['on'](_0x1f8b('0x10'),this[_0x1f8b('0x11')][_0x1f8b('0xf')](this));}VoiceDialReport[_0x1f8b('0x12')][_0x1f8b('0x13')]=function(_0x266e5a){return _0x266e5a!==null&&!_[_0x1f8b('0x14')](_0x266e5a);};VoiceDialReport['prototype'][_0x1f8b('0x15')]=function(_0xa03573,_0x54850c,_0x170167){io['to'](_0xa03573)[_0x1f8b('0x15')](_0x54850c,_0x170167);};VoiceDialReport[_0x1f8b('0x12')]['syncDialBegin']=function(_0x6c788){try{if(this['isNotNull'](_0x6c788)){if(this[_0x1f8b('0x16')][_0x6c788['uniqueid']]){_['merge'](this[_0x1f8b('0x16')][_0x6c788[_0x1f8b('0x17')]],{'starttime':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastevent':_0x1f8b('0x18'),'interface':_0x6c788['channel']['substring'](0x0,_0x6c788[_0x1f8b('0x19')]['lastIndexOf']('-')),'membername':_0x6c788[_0x1f8b('0x19')][_0x1f8b('0x1a')](_0x6c788[_0x1f8b('0x19')][_0x1f8b('0x1b')]('/')+0x1,_0x6c788[_0x1f8b('0x19')][_0x1f8b('0x1b')]('-'))},_['omit'](_0x6c788,[_0x1f8b('0x1c'),_0x1f8b('0x1d')]));this[_0x1f8b('0x15')](_0x1f8b('0x1e'),_0x1f8b('0x1f'),this[_0x1f8b('0x16')][_0x6c788[_0x1f8b('0x17')]]);ami[_0x1f8b('0x15')](_0x1f8b('0x20'),this[_0x1f8b('0x16')][_0x6c788[_0x1f8b('0x17')]]);}}}catch(_0x55b1d0){logger['error']('[syncDialBegin][VoiceDialReport]',util[_0x1f8b('0x21')](_0x55b1d0,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1f8b('0x12')][_0x1f8b('0x22')]=function(_0x4bb4a0){try{if(this[_0x1f8b('0x13')](_0x4bb4a0)){if(this[_0x1f8b('0x16')][_0x4bb4a0[_0x1f8b('0x17')]]){this[_0x1f8b('0x16')][_0x4bb4a0['uniqueid']][_0x1f8b('0x23')]=_0x4bb4a0['dialstatus'];if(_0x4bb4a0['dialstatus']===_0x1f8b('0x24')){this[_0x1f8b('0x16')][_0x4bb4a0['uniqueid']][_0x1f8b('0x25')]=_0x4bb4a0[_0x1f8b('0x25')];this[_0x1f8b('0x16')][_0x4bb4a0[_0x1f8b('0x17')]][_0x1f8b('0x26')]=_0x4bb4a0['connectedlinename'];this['channels'][_0x4bb4a0[_0x1f8b('0x17')]]['answertime']=moment()[_0x1f8b('0x27')](_0x1f8b('0x28'));this[_0x1f8b('0x16')][_0x4bb4a0[_0x1f8b('0x17')]][_0x1f8b('0x29')]='connect';ami[_0x1f8b('0x15')](_0x1f8b('0x2a'),this[_0x1f8b('0x16')][_0x4bb4a0[_0x1f8b('0x17')]]);}this[_0x1f8b('0x15')](_0x1f8b('0x1e'),'voice_outbound_channel:save',this[_0x1f8b('0x16')][_0x4bb4a0[_0x1f8b('0x17')]]);}}}catch(_0x4fca79){logger[_0x1f8b('0x2b')](_0x1f8b('0x2c'),util[_0x1f8b('0x21')](_0x4fca79,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1f8b('0x12')][_0x1f8b('0xe')]=function(_0x490649){try{if(this[_0x1f8b('0x13')](_0x490649)){this['addVariable'](_0x490649[_0x1f8b('0x17')],_[_0x1f8b('0x2d')](_0x490649['variable'])[0x0],_0x490649[_0x1f8b('0x2e')]);if(this[_0x1f8b('0x13')](_0x490649[_0x1f8b('0x2f')])&&this[_0x1f8b('0x13')](_0x490649[_0x1f8b('0x2f')][_0x1f8b('0x30')])){if(_[_0x1f8b('0x14')](this[_0x1f8b('0x16')][_0x490649[_0x1f8b('0x17')]])){this[_0x1f8b('0x16')][_0x490649[_0x1f8b('0x17')]]={'routeId':_0x490649[_0x1f8b('0x2e')],'variables':this[_0x1f8b('0x31')][_0x490649[_0x1f8b('0x17')]]};this[_0x1f8b('0x15')](_0x1f8b('0x1e'),_0x1f8b('0x1f'),this[_0x1f8b('0x16')][_0x490649[_0x1f8b('0x17')]]);}}}}catch(_0x216e95){logger[_0x1f8b('0x2b')]('[syncVarSet][VoiceDialReport]',util[_0x1f8b('0x21')](_0x216e95,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x1f8b('0x12')][_0x1f8b('0x32')]=function(_0x159b7c,_0x3d3d87,_0x52b57d){var _0x9b8aa5=[_0x1f8b('0x33'),_0x1f8b('0x34'),_0x1f8b('0x35'),_0x1f8b('0x36'),_0x1f8b('0x37'),_0x1f8b('0x38'),_0x1f8b('0x39'),_0x1f8b('0x3a'),'sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls',_0x1f8b('0x3b'),_0x1f8b('0x3c'),_0x1f8b('0x3d'),_0x1f8b('0x3e'),_0x1f8b('0x3f'),_0x1f8b('0x40')];if(!_[_0x1f8b('0x41')](_0x3d3d87)&&!_[_0x1f8b('0x42')](_0x9b8aa5,_0x3d3d87)){if(_['isUndefined'](this[_0x1f8b('0x31')][_0x159b7c])){this[_0x1f8b('0x31')][_0x159b7c]={};}this[_0x1f8b('0x31')][_0x159b7c][_0x3d3d87]=_0x52b57d;}};VoiceDialReport['prototype'][_0x1f8b('0x11')]=function(_0x1b113b){try{if(this['isNotNull'](_0x1b113b)){if(this[_0x1f8b('0x16')][_0x1b113b['uniqueid']]){this[_0x1f8b('0x16')][_0x1b113b['uniqueid']][_0x1f8b('0x43')]=moment()[_0x1f8b('0x27')](_0x1f8b('0x28'));this['channels'][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x44')]=moment(this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x43')])['diff'](this[_0x1f8b('0x16')][_0x1b113b['uniqueid']][_0x1f8b('0x45')],_0x1f8b('0x46'));this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x29')]=_0x1f8b('0x47');this['outbound'][_0x1f8b('0x48')]+=0x1;if(this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x49')]){this[_0x1f8b('0xa')][_0x1f8b('0x4a')]+=0x1;this[_0x1f8b('0x16')][_0x1b113b['uniqueid']][_0x1f8b('0x4b')]=moment(this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x49')])[_0x1f8b('0x4c')](this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x45')],_0x1f8b('0x46'));this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x4d')]=moment(this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x43')])['diff'](this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x49')],_0x1f8b('0x46'));this[_0x1f8b('0xa')][_0x1f8b('0x4e')]+=this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x4b')]||0x0;this['outbound'][_0x1f8b('0x4f')]+=this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x4d')];}this[_0x1f8b('0xa')][_0x1f8b('0x50')]+=this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]][_0x1f8b('0x44')];ami['emit'](_0x1f8b('0x51'),this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]]);ami[_0x1f8b('0x15')]('custom:dialend',this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]]);this[_0x1f8b('0x15')](_0x1f8b('0x1e'),_0x1f8b('0x52'),this[_0x1f8b('0xa')]);logger[_0x1f8b('0x53')](_0x1f8b('0x54'),JSON[_0x1f8b('0x55')](this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]]));this[_0x1f8b('0x15')](_0x1f8b('0x1e'),_0x1f8b('0x56'),this[_0x1f8b('0x16')][_0x1b113b[_0x1f8b('0x17')]]);delete this[_0x1f8b('0x16')][_0x1b113b['uniqueid']];}if(this[_0x1f8b('0x31')][_0x1b113b[_0x1f8b('0x17')]]){delete this[_0x1f8b('0x31')][_0x1b113b['uniqueid']];}}}catch(_0x24d96a){logger[_0x1f8b('0x2b')]('[syncHangup][VoiceDialReport]',util[_0x1f8b('0x21')](_0x24d96a,{'showHidden':![],'depth':null}));}};module['exports']=VoiceDialReport; \ No newline at end of file +var _0xc44b=['sumDuration','custom:voiceDialReport','[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event','stringify','voice_outbound_channel:remove','[syncHangup][VoiceDialReport]','exports','lodash','moment','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','outboundChannels','outbound','bind','dialend','syncDialEnd','hangup','syncHangup','prototype','isNotNull','isUndefined','emit','uniqueid','merge','channels','YYYY-MM-DD\x20HH:mm:ss','called','channel','substring','lastIndexOf','privilege','custom:dialbegin','error','[syncDialBegin][VoiceDialReport]','inspect','dialstatus','connectedlinenum','connectedlinename','answertime','format','lastevent','connect','custom:dialconnect','[syncDialEnd][VoiceDialReport]','syncVarSet','addVariable','keys','variable','value','variables','voice:outbound','voice_outbound_channel:save','[syncVarSet][VoiceDialReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqosrttbridged','sipuri','bridgepeer','membercalls','memberdynamic','memberinterface','memberlastcall','membername','memberpenalty','isNil','endtime','duration','diff','starttime','seconds','total','answered','holdtime','billableseconds','sumHoldTime','sumBillable'];(function(_0x5519a9,_0x1c5147){var _0x32f2cc=function(_0x52ed58){while(--_0x52ed58){_0x5519a9['push'](_0x5519a9['shift']());}};_0x32f2cc(++_0x1c5147);}(_0xc44b,0xad));var _0xbc44=function(_0x27b423,_0x312583){_0x27b423=_0x27b423-0x0;var _0x5c11b8=_0xc44b[_0x27b423];return _0x5c11b8;};'use strict';var _=require(_0xbc44('0x0'));var moment=require(_0xbc44('0x1'));var util=require(_0xbc44('0x2'));var Redis=require('ioredis');var config=require(_0xbc44('0x3'));var logger=require('../../../config/logger')('ami');var ami=require('../ami');config[_0xbc44('0x4')]=_[_0xbc44('0x5')](config['redis'],{'host':_0xbc44('0x6'),'port':0x18eb});var io=require(_0xbc44('0x7'))(new Redis(config['redis']));function VoiceDialReport(_0x584de6){this['channels']=_0x584de6[_0xbc44('0x8')];this[_0xbc44('0x9')]=_0x584de6[_0xbc44('0x9')];this['variables']={};ami['on']('dialbegin',this['syncDialBegin'][_0xbc44('0xa')](this));ami['on'](_0xbc44('0xb'),this[_0xbc44('0xc')]['bind'](this));ami['on']('varset',this['syncVarSet']['bind'](this));ami['on'](_0xbc44('0xd'),this[_0xbc44('0xe')]['bind'](this));}VoiceDialReport[_0xbc44('0xf')][_0xbc44('0x10')]=function(_0x548e79){return _0x548e79!==null&&!_[_0xbc44('0x11')](_0x548e79);};VoiceDialReport['prototype'][_0xbc44('0x12')]=function(_0x49d40d,_0x2f8e09,_0xaddfd5){io['to'](_0x49d40d)['emit'](_0x2f8e09,_0xaddfd5);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x4034c1){try{if(this[_0xbc44('0x10')](_0x4034c1)){if(this['channels'][_0x4034c1[_0xbc44('0x13')]]){_[_0xbc44('0x14')](this[_0xbc44('0x15')][_0x4034c1[_0xbc44('0x13')]],{'starttime':moment()['format'](_0xbc44('0x16')),'lastevent':_0xbc44('0x17'),'interface':_0x4034c1[_0xbc44('0x18')][_0xbc44('0x19')](0x0,_0x4034c1[_0xbc44('0x18')][_0xbc44('0x1a')]('-')),'membername':_0x4034c1[_0xbc44('0x18')][_0xbc44('0x19')](_0x4034c1[_0xbc44('0x18')][_0xbc44('0x1a')]('/')+0x1,_0x4034c1[_0xbc44('0x18')][_0xbc44('0x1a')]('-'))},_['omit'](_0x4034c1,['event',_0xbc44('0x1b')]));this['emit']('voice:outbound','voice_outbound_channel:save',this['channels'][_0x4034c1[_0xbc44('0x13')]]);ami[_0xbc44('0x12')](_0xbc44('0x1c'),this[_0xbc44('0x15')][_0x4034c1[_0xbc44('0x13')]]);}}}catch(_0x275c9e){logger[_0xbc44('0x1d')](_0xbc44('0x1e'),util[_0xbc44('0x1f')](_0x275c9e,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbc44('0xf')]['syncDialEnd']=function(_0x23114f){try{if(this['isNotNull'](_0x23114f)){if(this[_0xbc44('0x15')][_0x23114f['uniqueid']]){this[_0xbc44('0x15')][_0x23114f['uniqueid']]['dialstatus']=_0x23114f[_0xbc44('0x20')];if(_0x23114f[_0xbc44('0x20')]==='ANSWER'){this['channels'][_0x23114f[_0xbc44('0x13')]][_0xbc44('0x21')]=_0x23114f[_0xbc44('0x21')];this[_0xbc44('0x15')][_0x23114f['uniqueid']][_0xbc44('0x22')]=_0x23114f[_0xbc44('0x22')];this[_0xbc44('0x15')][_0x23114f[_0xbc44('0x13')]][_0xbc44('0x23')]=moment()[_0xbc44('0x24')](_0xbc44('0x16'));this['channels'][_0x23114f['uniqueid']][_0xbc44('0x25')]=_0xbc44('0x26');ami[_0xbc44('0x12')](_0xbc44('0x27'),this[_0xbc44('0x15')][_0x23114f['uniqueid']]);}this['emit']('voice:outbound','voice_outbound_channel:save',this['channels'][_0x23114f[_0xbc44('0x13')]]);}}}catch(_0x1a16a2){logger[_0xbc44('0x1d')](_0xbc44('0x28'),util['inspect'](_0x1a16a2,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbc44('0xf')][_0xbc44('0x29')]=function(_0x38120b){try{if(this[_0xbc44('0x10')](_0x38120b)){this[_0xbc44('0x2a')](_0x38120b[_0xbc44('0x13')],_[_0xbc44('0x2b')](_0x38120b[_0xbc44('0x2c')])[0x0],_0x38120b[_0xbc44('0x2d')]);if(this[_0xbc44('0x10')](_0x38120b[_0xbc44('0x2c')])&&this['isNotNull'](_0x38120b[_0xbc44('0x2c')]['outboundrouteid'])){if(_[_0xbc44('0x11')](this[_0xbc44('0x15')][_0x38120b[_0xbc44('0x13')]])){this[_0xbc44('0x15')][_0x38120b[_0xbc44('0x13')]]={'routeId':_0x38120b['value'],'variables':this[_0xbc44('0x2e')][_0x38120b[_0xbc44('0x13')]]};this[_0xbc44('0x12')](_0xbc44('0x2f'),_0xbc44('0x30'),this['channels'][_0x38120b[_0xbc44('0x13')]]);}}}}catch(_0x5498e8){logger['error'](_0xbc44('0x31'),util['inspect'](_0x5498e8,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xbc44('0xf')][_0xbc44('0x2a')]=function(_0x2f7666,_0x3430d0,_0x254427){var _0x9aa468=[_0xbc44('0x32'),_0xbc44('0x33'),_0xbc44('0x34'),_0xbc44('0x35'),_0xbc44('0x36'),'rtpaudioqoslossbridged','rtpaudioqosrtt',_0xbc44('0x37'),'sipcallid',_0xbc44('0x38'),_0xbc44('0x39'),'bridgepvtcallid',_0xbc44('0x3a'),_0xbc44('0x3b'),_0xbc44('0x3c'),_0xbc44('0x3d'),_0xbc44('0x3e'),_0xbc44('0x3f'),'memberrealtime'];if(!_[_0xbc44('0x40')](_0x3430d0)&&!_['includes'](_0x9aa468,_0x3430d0)){if(_[_0xbc44('0x11')](this[_0xbc44('0x2e')][_0x2f7666])){this[_0xbc44('0x2e')][_0x2f7666]={};}this[_0xbc44('0x2e')][_0x2f7666][_0x3430d0]=_0x254427;}};VoiceDialReport['prototype'][_0xbc44('0xe')]=function(_0x458a45){try{if(this[_0xbc44('0x10')](_0x458a45)){if(this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]]){this[_0xbc44('0x15')][_0x458a45['uniqueid']][_0xbc44('0x41')]=moment()[_0xbc44('0x24')](_0xbc44('0x16'));this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x42')]=moment(this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x41')])[_0xbc44('0x43')](this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x44')],_0xbc44('0x45'));this['channels'][_0x458a45['uniqueid']][_0xbc44('0x25')]='complete';this[_0xbc44('0x9')][_0xbc44('0x46')]+=0x1;if(this[_0xbc44('0x15')][_0x458a45['uniqueid']][_0xbc44('0x23')]){this[_0xbc44('0x9')][_0xbc44('0x47')]+=0x1;this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x48')]=moment(this['channels'][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x23')])[_0xbc44('0x43')](this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x44')],_0xbc44('0x45'));this[_0xbc44('0x15')][_0x458a45['uniqueid']][_0xbc44('0x49')]=moment(this['channels'][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x41')])[_0xbc44('0x43')](this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x23')],_0xbc44('0x45'));this['outbound'][_0xbc44('0x4a')]+=this['channels'][_0x458a45[_0xbc44('0x13')]]['holdtime']||0x0;this[_0xbc44('0x9')][_0xbc44('0x4b')]+=this['channels'][_0x458a45[_0xbc44('0x13')]]['billableseconds'];}this[_0xbc44('0x9')][_0xbc44('0x4c')]+=this['channels'][_0x458a45[_0xbc44('0x13')]][_0xbc44('0x42')];ami[_0xbc44('0x12')](_0xbc44('0x4d'),this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]]);ami['emit']('custom:dialend',this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]]);this[_0xbc44('0x12')](_0xbc44('0x2f'),'voice_outbound:save',this[_0xbc44('0x9')]);logger['info'](_0xbc44('0x4e'),JSON[_0xbc44('0x4f')](this[_0xbc44('0x15')][_0x458a45[_0xbc44('0x13')]]));this[_0xbc44('0x12')](_0xbc44('0x2f'),_0xbc44('0x50'),this['channels'][_0x458a45[_0xbc44('0x13')]]);delete this['channels'][_0x458a45[_0xbc44('0x13')]];}if(this[_0xbc44('0x2e')][_0x458a45[_0xbc44('0x13')]]){delete this[_0xbc44('0x2e')][_0x458a45[_0xbc44('0x13')]];}}}catch(_0x5e14e5){logger[_0xbc44('0x1d')](_0xbc44('0x51'),util[_0xbc44('0x1f')](_0x5e14e5,{'showHidden':![],'depth':null}));}};module[_0xbc44('0x52')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index bd2df5b..5cfb940 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 _0x7e27=['COMPLETEDBY','toUpperCase','[syncAgentComplete][VoiceQueueReport]','syncVarSet','addVariable','keys','variable','value','queuestatus','CONTINUE','queueposition','EXITWITHKEY','[syncVarSet][VoiceQueueReport]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','sipuri','bridgepeer','bridgepvtcallid','membercalls','includes','length','unmanaged','sumDuration','diff','answered','sumBillable','milliseconds','lastevent','custom:queuecallerunmanaged','custom:queuecallerabandon','custom:voiceQueueReport','[syncHangup][VoiceQueueReport]','syncAttendedTransfer','transfereeuniqueid','secondtransfererexten','secondtransfereruniqueid','ATTENDEDTRANSFER','transfertype','ATTENDED','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[syncAttendedTransfer][VoiceQueueReport]','BLINDTRANSFER','context','transfererchannel','[syncBlindTransfer][VoiceQueueReport]','mohstarttime','[syncMusicOnHoldStart][VoiceQueueReport]','mohtime','exports','moment','util','ioredis','../../../config/environment','ami','../model/queueReport','defaults','localhost','redis','prototype','enqueue','tail','finally','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','variables','syncQueueSummary','bind','queuesummarycomplete','syncQueueSummaryComplete','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','agentconnect','syncAgentConnect','varset','syncHangup','fullybooted','syncFullyBooted','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncBlindTransfer','loopQueueSummary','isEmpty','hasOwnProperty','originated','talking','pTalking','waiting','queueStatusComplete','unlockRR','clearZombieChannels','switch','sequence','isNil','Action','status','channel','catch','No\x20such\x20channel','error','[voiceQueueReport][checkChannel]','queueReports','[voiceQueueReport][checkQueueReport]','[voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','agents','clearQueueReport','inspect','emitVoiceQueueChannelSave','emit','format','voice:queue:%s','name','voice_queue_channel:save','emitVoiceQueueChannelRemove','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','voice_queue_channel:remove','inbound','strategy','available','sumHoldTime','total','type','abandoned','Trunk','callerid','Interval','md5','voice_queue:save','isNotNull','isUndefined','loopQueueShow','[queues]','queuesummary','then','queue','countBy','callers','toNumber','loggedIn','loggedin','emitVoiceQueueSummary','custom:queuesummary','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','position','count','merge','last','queuecallercompleteAt','holdtime','originalposition','queuecallerabandonAt','queuecallerexitreason','lastAssignedTo','[syncQueueCallerAbandon][VoiceQueueReport]','queuecallerleaveAt','connectedlinenum','connectedlinename','queuecallercomplete','[syncAgentConnect][VoiceQueueReport]','syncAgentComplete','membername','queuecallerexit','queuecallerexitAt','transfer','COMPLETED','startsWith','toLowerCase','linkedid','add','seconds','transferexten','destexten','transferuniqueid'];(function(_0x3d4394,_0x25f537){var _0x2746a7=function(_0x55c890){while(--_0x55c890){_0x3d4394['push'](_0x3d4394['shift']());}};_0x2746a7(++_0x25f537);}(_0x7e27,0x1bf));var _0x77e2=function(_0x9e191f,_0x9af4a8){_0x9e191f=_0x9e191f-0x0;var _0x35edce=_0x7e27[_0x9e191f];return _0x35edce;};'use strict';var _=require('lodash');var moment=require(_0x77e2('0x0'));var BPromise=require('bluebird');var util=require(_0x77e2('0x1'));var md5=require('md5');var Redis=require(_0x77e2('0x2'));var config=require(_0x77e2('0x3'));var logger=require('../../../config/logger')(_0x77e2('0x4'));var ami=require('../ami');var QueueReport=require(_0x77e2('0x5'));config['redis']=_[_0x77e2('0x6')](config['redis'],{'host':_0x77e2('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x77e2('0x8')]));var Sequence=function(){};Sequence[_0x77e2('0x9')][_0x77e2('0xa')]=function(_0x4e24b1){this[_0x77e2('0xb')]=this[_0x77e2('0xb')]?this['tail'][_0x77e2('0xc')](_0x4e24b1):_0x4e24b1();};function VoiceQueueReport(_0x179062){this['sequence']=new Sequence();this['queueReports']={};this['agents']=_0x179062['agents'];this[_0x77e2('0xd')]=_0x179062[_0x77e2('0xe')];this[_0x77e2('0xf')]=_0x179062[_0x77e2('0xf')];this[_0x77e2('0x10')]=!![];this[_0x77e2('0x11')]=_0x179062[_0x77e2('0x11')];this[_0x77e2('0x12')]={};ami['on']('queuesummary',this[_0x77e2('0x13')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x15'),this[_0x77e2('0x16')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x17'),this[_0x77e2('0x18')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x19'),this[_0x77e2('0x1a')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x1b'),this[_0x77e2('0x1c')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x1d'),this['syncAgentComplete'][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x1e'),this[_0x77e2('0x1f')]['bind'](this));ami['on'](_0x77e2('0x20'),this['syncVarSet'][_0x77e2('0x14')](this));ami['on']('hangup',this[_0x77e2('0x21')]['bind'](this));ami['on'](_0x77e2('0x22'),this[_0x77e2('0x23')]['bind'](this));ami['on']('musiconholdstart',this[_0x77e2('0x24')][_0x77e2('0x14')](this));ami['on'](_0x77e2('0x25'),this[_0x77e2('0x26')]['bind'](this));ami['on'](_0x77e2('0x27'),this['syncAttendedTransfer'][_0x77e2('0x14')](this));ami['on']('blindtransfer',this[_0x77e2('0x28')][_0x77e2('0x14')](this));this[_0x77e2('0x29')]();this['loopQueueShow']();}function isNotNull(_0x387fc8){return _0x387fc8!==null&&!_['isUndefined'](_0x387fc8);}function clearChannels(_0x44c351){if(!_[_0x77e2('0x2a')](_0x44c351)){for(var _0x51fd5a in _0x44c351){if(_0x44c351[_0x77e2('0x2b')](_0x51fd5a)){delete _0x44c351[_0x51fd5a];}}}}function clearCampaigns(_0x141804){if(!_['isEmpty'](_0x141804)){for(var _0x5dd8c7 in _0x141804){if(_0x141804[_0x77e2('0x2b')](_0x5dd8c7)){_0x141804[_0x5dd8c7][_0x77e2('0x2c')]=0x0;}}}}function clearVoiceQueues(_0x1e81ce){if(!_['isEmpty'](_0x1e81ce)){for(var _0x1dc655 in _0x1e81ce){if(_0x1e81ce[_0x77e2('0x2b')](_0x1dc655)){_0x1e81ce[_0x1dc655][_0x77e2('0x2c')]=0x0;_0x1e81ce[_0x1dc655][_0x77e2('0x2d')]=0x0;_0x1e81ce[_0x1dc655][_0x77e2('0x2e')]=0x0;_0x1e81ce[_0x1dc655][_0x77e2('0x2f')]=0x0;_0x1e81ce[_0x1dc655][_0x77e2('0x30')]=!![];}}}}function clearAgentBooked(_0x3c6fc0){if(!_[_0x77e2('0x2a')](_0x3c6fc0)){for(var _0x44c02f in _0x3c6fc0){if(_0x3c6fc0[_0x77e2('0x2b')](_0x44c02f)){_0x3c6fc0[_0x44c02f][_0x77e2('0x31')]=!![];}}}}VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x32')]=function(){var _0x25a533=this;for(var _0x160f56 in this[_0x77e2('0xd')]){if(this[_0x77e2('0xd')]['hasOwnProperty'](_0x160f56)&&!this[_0x77e2('0xd')][_0x160f56][_0x77e2('0x33')]){this[_0x77e2('0x34')][_0x77e2('0xa')](function(){if(!_[_0x77e2('0x35')](_0x25a533['channels'][_0x160f56])){return ami[_0x77e2('0x36')]({'action':_0x77e2('0x37'),'channel':_0x25a533[_0x77e2('0xd')][_0x160f56][_0x77e2('0x38')]})[_0x77e2('0x39')](function(_0x1757a4){if(_0x1757a4['message']===_0x77e2('0x3a')){setTimeout(function(){if(_0x25a533['channels'][_0x160f56]){delete _0x25a533[_0x77e2('0xd')][_0x160f56];logger[_0x77e2('0x3b')](_0x77e2('0x3c'),_0x160f56);}if(_0x25a533['queueReports'][_0x160f56]){delete _0x25a533[_0x77e2('0x3d')][_0x160f56];logger[_0x77e2('0x3b')](_0x77e2('0x3e'),_0x160f56);}if(_0x25a533['variables'][_0x160f56]){delete _0x25a533['variables'][_0x160f56];logger[_0x77e2('0x3b')](_0x77e2('0x3f'),_0x160f56);}},0x1f40);}});}});}}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x23')]=function(){logger[_0x77e2('0x3b')](_0x77e2('0x40'));clearChannels(this['channels']);this['clearQueueReport'](this[_0x77e2('0x3d')]);clearAgentBooked(this[_0x77e2('0x41')]);clearVoiceQueues(this['voiceQueues']);clearCampaigns(this[_0x77e2('0x11')]);};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x42')]=function(_0x1b92de){var _0x13d902=this;if(!_[_0x77e2('0x2a')](_0x1b92de)){for(var _0x4d7dd9 in _0x1b92de){if(_0x1b92de['hasOwnProperty'](_0x4d7dd9)){_0x13d902['emitVoiceQueueChannelRemove'](_0x1b92de[_0x4d7dd9]);delete _0x1b92de[_0x4d7dd9];}}}};function loggerCatch(_0x7b84fe){return function(_0x12b5bd){logger[_0x77e2('0x3b')](_0x7b84fe,util[_0x77e2('0x43')](_0x12b5bd,{'showHidden':![],'depth':null}));};}VoiceQueueReport[_0x77e2('0x9')]['emit']=function(_0x1d888b,_0x5f4532,_0x45deb0){io['to'](_0x1d888b)['emit'](_0x5f4532,_0x45deb0);};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x44')]=function(_0xa226d7){this[_0x77e2('0x45')](util[_0x77e2('0x46')](_0x77e2('0x47'),_0xa226d7[_0x77e2('0x48')]),_0x77e2('0x49'),_0xa226d7);};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x4a')]=function(_0x5c72d5){logger[_0x77e2('0x4b')](_0x77e2('0x4c'),JSON[_0x77e2('0x4d')](_0x5c72d5));this['emit'](util[_0x77e2('0x46')](_0x77e2('0x47'),_0x5c72d5['name']),_0x77e2('0x4e'),_0x5c72d5);};VoiceQueueReport[_0x77e2('0x9')]['emitVoiceQueueSummary']=function(_0x69a693){if(_0x69a693['type']===_0x77e2('0x4f')){var _0x35167c={'id':_0x69a693['id'],'name':_0x69a693[_0x77e2('0x48')],'strategy':_0x69a693[_0x77e2('0x50')],'answered':_0x69a693['answered'],'available':_0x69a693[_0x77e2('0x51')],'loggedIn':_0x69a693['loggedIn'],'pTalking':_0x69a693[_0x77e2('0x2e')],'sumBillable':_0x69a693['sumBillable'],'sumDuration':_0x69a693['sumDuration'],'sumHoldTime':_0x69a693[_0x77e2('0x52')]||0x0,'talking':_0x69a693[_0x77e2('0x2d')],'total':_0x69a693[_0x77e2('0x53')],'type':_0x69a693[_0x77e2('0x54')],'unmanaged':_0x69a693['unmanaged'],'abandoned':_0x69a693[_0x77e2('0x55')],'waiting':_0x69a693[_0x77e2('0x2f')]};if(_0x69a693['Trunk']){_0x35167c[_0x77e2('0x56')]={'id':_0x69a693[_0x77e2('0x56')]['id'],'name':_0x69a693['Trunk'][_0x77e2('0x48')],'active':_0x69a693[_0x77e2('0x56')]['active'],'callerid':_0x69a693[_0x77e2('0x56')][_0x77e2('0x57')]};}if(_0x69a693[_0x77e2('0x58')]){_0x35167c['Interval']={'id':_0x69a693['Interval']['id'],'name':_0x69a693[_0x77e2('0x58')][_0x77e2('0x48')]};}var _0x391b07=md5(JSON[_0x77e2('0x4d')](_0x35167c));if(_0x69a693[_0x77e2('0x59')]!==_0x391b07){_0x69a693[_0x77e2('0x59')]=_0x391b07;this['emit'](util[_0x77e2('0x46')](_0x77e2('0x47'),_0x35167c['name']),_0x77e2('0x5a'),_0x35167c);}}};VoiceQueueReport['prototype'][_0x77e2('0x5b')]=function(_0x2871fa){return _0x2871fa!==null&&!_[_0x77e2('0x5c')](_0x2871fa);};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x5d')]=function(){var _0x5cd17b=this;setInterval(function(){_0x5cd17b['clearZombieChannels']();ami['Action']({'action':'queues'})[_0x77e2('0x39')](loggerCatch(_0x77e2('0x5e')));},0x2710);};VoiceQueueReport[_0x77e2('0x9')]['loopQueueSummary']=function(){var _0x27b01d=this;setInterval(function(){if(_0x27b01d['flagQueueSummary']){return ami['Action']({'action':_0x77e2('0x5f')})[_0x77e2('0x60')](function(_0x11ffe4){_0x27b01d['flagQueueSummary']=![];})[_0x77e2('0x39')](loggerCatch('[queuesummary]'));}},0x3e8);};VoiceQueueReport[_0x77e2('0x9')]['syncQueueSummary']=function(_0x37361c){try{if(this[_0x77e2('0x5b')](_0x37361c)&&this['isNotNull'](_0x37361c[_0x77e2('0x61')])){if(this[_0x77e2('0xf')][_0x37361c['queue']]){var _0x3bc0b2=_[_0x77e2('0x62')](this[_0x77e2('0xd')],_0x77e2('0x61'))[_0x37361c[_0x77e2('0x61')]]||0x0;var _0x2d21ad=_0x3bc0b2-_0x37361c[_0x77e2('0x63')];if(this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x2f')]!==_[_0x77e2('0x64')](_0x37361c['callers'])||this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x65')]!==_[_0x77e2('0x64')](_0x37361c[_0x77e2('0x66')])||this['voiceQueues'][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x51')]!==_['toNumber'](_0x37361c['available'])||this['voiceQueues'][_0x37361c['queue']]['talking']!==_0x2d21ad){this[_0x77e2('0xf')][_0x37361c['queue']][_0x77e2('0x2f')]=_[_0x77e2('0x64')](_0x37361c[_0x77e2('0x63')]);this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x65')]=_[_0x77e2('0x64')](_0x37361c[_0x77e2('0x66')]);this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x51')]=_[_0x77e2('0x64')](_0x37361c['available']);this[_0x77e2('0xf')][_0x37361c['queue']][_0x77e2('0x2d')]=_0x2d21ad>0x0?_0x2d21ad:0x0;this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]]['talking']=this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x2d')]>_[_0x77e2('0x64')](_0x37361c[_0x77e2('0x66')])?_[_0x77e2('0x64')](_0x37361c[_0x77e2('0x66')]):this[_0x77e2('0xf')][_0x37361c[_0x77e2('0x61')]][_0x77e2('0x2d')];this[_0x77e2('0x67')](this[_0x77e2('0xf')][_0x37361c['queue']]);}ami[_0x77e2('0x45')](_0x77e2('0x68'),this['voiceQueues'][_0x37361c[_0x77e2('0x61')]]);}}}catch(_0x40c859){logger[_0x77e2('0x3b')]('[syncQueueSummary][VoiceQueueReport]',util[_0x77e2('0x43')](_0x40c859,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x77e2('0x16')]=function(_0x53262a){this[_0x77e2('0x10')]=!![];};VoiceQueueReport[_0x77e2('0x9')]['syncNewExten']=function(_0x55a57f){};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x18')]=function(_0x18cd29){try{if(this[_0x77e2('0x5b')](_0x18cd29)){if(_[_0x77e2('0x5c')](this[_0x77e2('0x3d')][_0x18cd29[_0x77e2('0x69')]])){this[_0x77e2('0x3d')][_0x18cd29[_0x77e2('0x69')]]=[];this[_0x77e2('0xd')][_0x18cd29[_0x77e2('0x69')]]={};}var _0xa4ac18=new QueueReport();_0xa4ac18[_0x77e2('0x48')]=_0x18cd29['queue'];_0xa4ac18[_0x77e2('0x54')]=this[_0x77e2('0xf')][_0xa4ac18[_0x77e2('0x48')]]&&this[_0x77e2('0xf')][_0xa4ac18[_0x77e2('0x48')]][_0x77e2('0x54')]?this[_0x77e2('0xf')][_0xa4ac18[_0x77e2('0x48')]][_0x77e2('0x54')]||'inbound':_0x77e2('0x4f');_0xa4ac18[_0x77e2('0x61')]=_0x18cd29['queue'];_0xa4ac18[_0x77e2('0x6a')]=moment()[_0x77e2('0x46')](_0x77e2('0x6b'));_0xa4ac18['position']=_0x18cd29[_0x77e2('0x6c')];_0xa4ac18[_0x77e2('0x6d')]=_0x18cd29[_0x77e2('0x6d')];_[_0x77e2('0x6e')](_0xa4ac18,_['pick'](_0x18cd29,_['keys'](_0xa4ac18)));this['queueReports'][_0x18cd29[_0x77e2('0x69')]]['push'](_0xa4ac18);this[_0x77e2('0xd')][_0x18cd29[_0x77e2('0x69')]]=_0xa4ac18;this[_0x77e2('0x44')](_0xa4ac18);}}catch(_0x480ef1){logger['error']('[syncQueueCallerJoin][VoiceQueueReport]',util['inspect'](_0x480ef1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x1a')]=function(_0x412d24){try{if(this[_0x77e2('0x5b')](_0x412d24)){if(this[_0x77e2('0x3d')][_0x412d24[_0x77e2('0x69')]]){var _0x5d71d1=_[_0x77e2('0x6f')](this[_0x77e2('0x3d')][_0x412d24[_0x77e2('0x69')]]);_0x5d71d1['queuecallercomplete']=![];_0x5d71d1[_0x77e2('0x70')]=null;_0x5d71d1[_0x77e2('0x71')]=_0x412d24[_0x77e2('0x71')];_0x5d71d1[_0x77e2('0x72')]=_0x412d24[_0x77e2('0x72')];_0x5d71d1[_0x77e2('0x19')]=!![];_0x5d71d1[_0x77e2('0x73')]=moment()[_0x77e2('0x46')](_0x77e2('0x6b'));_0x5d71d1[_0x77e2('0x74')]='ABANDONED';_0x5d71d1[_0x77e2('0x75')]=null;this['channels'][_0x412d24[_0x77e2('0x69')]]=_0x5d71d1;this[_0x77e2('0x4a')](_0x5d71d1);}}}catch(_0x4305a1){logger['error'](_0x77e2('0x76'),util[_0x77e2('0x43')](_0x4305a1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x1c')]=function(_0x334169){try{if(this[_0x77e2('0x5b')](_0x334169)){if(this[_0x77e2('0x3d')][_0x334169[_0x77e2('0x69')]]){var _0x3482ce=_['last'](this['queueReports'][_0x334169[_0x77e2('0x69')]]);_0x3482ce[_0x77e2('0x77')]=moment()[_0x77e2('0x46')](_0x77e2('0x6b'));_0x3482ce[_0x77e2('0x78')]=_0x334169[_0x77e2('0x78')];_0x3482ce['connectedlinename']=_0x334169[_0x77e2('0x79')];this[_0x77e2('0xd')][_0x334169[_0x77e2('0x69')]]=_0x3482ce;this[_0x77e2('0x44')](_0x3482ce);}}}catch(_0x1e9848){logger[_0x77e2('0x3b')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0x1e9848,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x1f')]=function(_0x59f843){try{if(this[_0x77e2('0x5b')](_0x59f843)){if(this[_0x77e2('0x3d')][_0x59f843[_0x77e2('0x69')]]){var _0xe159b3=_[_0x77e2('0x6f')](this[_0x77e2('0x3d')][_0x59f843[_0x77e2('0x69')]]);_0xe159b3[_0x77e2('0x7a')]=!![];_0xe159b3['queuecallerexitreason']='COMPLETEDBYAGENT';}}}catch(_0x20eeab){logger[_0x77e2('0x3b')](_0x77e2('0x7b'),util[_0x77e2('0x43')](_0x20eeab,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x7c')]=function(_0x303a3a){try{if(this[_0x77e2('0x5b')](_0x303a3a)){if(this[_0x77e2('0x3d')][_0x303a3a[_0x77e2('0x69')]]){var _0x1412cb=_['last'](this['queueReports'][_0x303a3a['uniqueid']]);_0x1412cb[_0x77e2('0x19')]=![];_0x1412cb['queuecallerabandonAt']=null;_0x1412cb['assigned']=!![];_0x1412cb['lastAssignedTo']=_0x303a3a[_0x77e2('0x7d')];_0x1412cb[_0x77e2('0x71')]=_0x303a3a[_0x77e2('0x71')];_0x1412cb[_0x77e2('0x7a')]=!![];_0x1412cb[_0x77e2('0x7e')]=![];_0x1412cb[_0x77e2('0x7f')]=null;if(!_0x1412cb[_0x77e2('0x80')]){if(_0x303a3a['reason']==_0x77e2('0x80')){_0x1412cb[_0x77e2('0x74')]=_0x77e2('0x81');}else{if(_[_0x77e2('0x82')](_0x303a3a[_0x77e2('0x38')][_0x77e2('0x83')](),'local/')){if(this[_0x77e2('0x3d')][_0x303a3a[_0x77e2('0x84')]]){var _0x39a5f4=_[_0x77e2('0x6f')](this[_0x77e2('0x3d')][_0x303a3a['linkedid']]);_0x39a5f4[_0x77e2('0x7a')]=![];_0x39a5f4['queuecallerexit']=!![];_0x39a5f4[_0x77e2('0x7f')]=moment(_0x1412cb[_0x77e2('0x6a')])[_0x77e2('0x85')](_0x303a3a[_0x77e2('0x71')],_0x77e2('0x86'))[_0x77e2('0x46')](_0x77e2('0x6b'));_0x39a5f4[_0x77e2('0x74')]='FORWARDTRANSFER';_0x39a5f4[_0x77e2('0x80')]=!![];_0x39a5f4['transfertype']='FORWARD';_0x39a5f4[_0x77e2('0x87')]=_0x303a3a[_0x77e2('0x88')];_0x39a5f4[_0x77e2('0x89')]=_0x303a3a['uniqueid'];var _0x47c9dc=this['queueReports'][_0x303a3a[_0x77e2('0x84')]];this[_0x77e2('0x3d')][_0x303a3a[_0x77e2('0x84')]]=this[_0x77e2('0x3d')][_0x303a3a[_0x77e2('0x69')]];this[_0x77e2('0x3d')][_0x303a3a[_0x77e2('0x69')]]=_0x47c9dc;}}else{_0x1412cb[_0x77e2('0x74')]=_0x77e2('0x8a')+_0x303a3a['reason'][_0x77e2('0x8b')]();}}}this['channels'][_0x303a3a[_0x77e2('0x69')]]=_0x1412cb;this[_0x77e2('0x4a')](_0x1412cb);}}}catch(_0x4d51b3){logger[_0x77e2('0x3b')](_0x77e2('0x8c'),util[_0x77e2('0x43')](_0x4d51b3,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x77e2('0x8d')]=function(_0x52d559){try{if(this['isNotNull'](_0x52d559)){this[_0x77e2('0x8e')](_0x52d559[_0x77e2('0x69')],_[_0x77e2('0x8f')](_0x52d559[_0x77e2('0x90')])[0x0],_0x52d559[_0x77e2('0x91')]);if(this[_0x77e2('0x3d')][_0x52d559['uniqueid']]){var _0xfd1a3b=_[_0x77e2('0x6f')](this[_0x77e2('0x3d')][_0x52d559[_0x77e2('0x69')]]);if(_0xfd1a3b){if(this[_0x77e2('0x5b')](_0x52d559['variable'])&&this[_0x77e2('0x5b')](_0x52d559[_0x77e2('0x90')][_0x77e2('0x92')])){switch(_0x52d559[_0x77e2('0x91')]){case _0x77e2('0x93'):_0xfd1a3b[_0x77e2('0x7e')]=![];_0xfd1a3b[_0x77e2('0x7f')]=null;break;default:_0xfd1a3b['queuecallerexit']=!![];_0xfd1a3b['queuecallerexitAt']=moment()[_0x77e2('0x46')](_0x77e2('0x6b'));_0xfd1a3b[_0x77e2('0x77')]=moment()['format'](_0x77e2('0x6b'));}_0xfd1a3b['queuecallerabandon']=![];_0xfd1a3b['queuecallerabandonAt']=null;_0xfd1a3b[_0x77e2('0x74')]=_0x52d559[_0x77e2('0x91')];this[_0x77e2('0xd')][_0x52d559[_0x77e2('0x69')]]=_0xfd1a3b;this[_0x77e2('0x4a')](_0xfd1a3b);}else if(this['isNotNull'](_0x52d559[_0x77e2('0x90')])&&this[_0x77e2('0x5b')](_0x52d559['variable'][_0x77e2('0x94')])){if(!_0xfd1a3b['queuecallerabandon']){_0xfd1a3b[_0x77e2('0x7e')]=!![];_0xfd1a3b['queuecallerexitAt']=moment()[_0x77e2('0x46')]('YYYY-MM-DD\x20HH:mm:ss');_0xfd1a3b[_0x77e2('0x74')]=_0x77e2('0x95');_0xfd1a3b['queuecallerleaveAt']=moment()[_0x77e2('0x46')](_0x77e2('0x6b'));this[_0x77e2('0xd')][_0x52d559[_0x77e2('0x69')]]=_0xfd1a3b;}}_0xfd1a3b[_0x77e2('0x12')]=this[_0x77e2('0x12')][_0x52d559[_0x77e2('0x69')]];}}}}catch(_0x43c5f1){logger[_0x77e2('0x3b')](_0x77e2('0x96'),util['inspect'](_0x43c5f1,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x8e')]=function(_0x1c3fa9,_0x6b69f5,_0x27e44d){var _0x16b2bd=[_0x77e2('0x97'),_0x77e2('0x98'),_0x77e2('0x99'),'rtpaudioqosjitterbridged',_0x77e2('0x9a'),_0x77e2('0x9b'),_0x77e2('0x9c'),_0x77e2('0x9d'),_0x77e2('0x9e'),_0x77e2('0x9f'),_0x77e2('0xa0'),_0x77e2('0xa1'),_0x77e2('0xa2'),'memberdynamic','memberinterface','memberlastcall',_0x77e2('0x7d'),'memberpenalty','memberrealtime'];if(!_[_0x77e2('0x35')](_0x6b69f5)&&!_[_0x77e2('0xa3')](_0x16b2bd,_0x6b69f5)){if(_[_0x77e2('0x5c')](this['variables'][_0x1c3fa9])){this['variables'][_0x1c3fa9]={};}this[_0x77e2('0x12')][_0x1c3fa9][_0x6b69f5]=_0x27e44d;}};VoiceQueueReport[_0x77e2('0x9')][_0x77e2('0x21')]=function(_0x32d175){try{if(this[_0x77e2('0x5b')](_0x32d175)){if(this[_0x77e2('0x3d')][_0x32d175[_0x77e2('0x69')]]){for(var _0x537b9c=0x0,_0x57e56a={};_0x537b9c0x0?_0x41fe80:0x0;this[_0xafa6('0x14')][_0xff9df[_0xafa6('0x64')]]['talking']=this[_0xafa6('0x14')][_0xff9df['queue']]['talking']>_[_0xafa6('0x66')](_0xff9df['loggedin'])?_[_0xafa6('0x66')](_0xff9df[_0xafa6('0x68')]):this[_0xafa6('0x14')][_0xff9df[_0xafa6('0x64')]][_0xafa6('0x33')];this['emitVoiceQueueSummary'](this[_0xafa6('0x14')][_0xff9df['queue']]);}ami[_0xafa6('0x48')](_0xafa6('0x69'),this[_0xafa6('0x14')][_0xff9df['queue']]);}}}catch(_0x12d60e){logger['error'](_0xafa6('0x6a'),util['inspect'](_0x12d60e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')][_0xafa6('0x1c')]=function(_0x4288ea){this['flagQueueSummary']=!![];};VoiceQueueReport['prototype'][_0xafa6('0x6b')]=function(_0x3d5ae9){};VoiceQueueReport[_0xafa6('0xd')]['syncQueueCallerJoin']=function(_0x327154){try{if(this[_0xafa6('0x60')](_0x327154)){if(_['isUndefined'](this[_0xafa6('0x11')][_0x327154[_0xafa6('0x6c')]])){this[_0xafa6('0x11')][_0x327154[_0xafa6('0x6c')]]=[];this[_0xafa6('0x36')][_0x327154[_0xafa6('0x6c')]]={};}var _0x4cd477=new QueueReport();_0x4cd477[_0xafa6('0x4a')]=_0x327154['queue'];_0x4cd477[_0xafa6('0x52')]=this[_0xafa6('0x14')][_0x4cd477[_0xafa6('0x4a')]]&&this[_0xafa6('0x14')][_0x4cd477['name']][_0xafa6('0x52')]?this['voiceQueues'][_0x4cd477[_0xafa6('0x4a')]][_0xafa6('0x52')]||_0xafa6('0x53'):_0xafa6('0x53');_0x4cd477[_0xafa6('0x64')]=_0x327154['queue'];_0x4cd477['queuecallerjoinAt']=moment()[_0xafa6('0x4f')](_0xafa6('0x6d'));_0x4cd477[_0xafa6('0x6e')]=_0x327154[_0xafa6('0x6e')];_0x4cd477['count']=_0x327154[_0xafa6('0x6f')];_['merge'](_0x4cd477,_[_0xafa6('0x70')](_0x327154,_[_0xafa6('0x71')](_0x4cd477)));this[_0xafa6('0x11')][_0x327154[_0xafa6('0x6c')]][_0xafa6('0x72')](_0x4cd477);this[_0xafa6('0x36')][_0x327154[_0xafa6('0x6c')]]=_0x4cd477;this['emitVoiceQueueChannelSave'](_0x4cd477);}}catch(_0x5afe19){logger[_0xafa6('0x40')](_0xafa6('0x73'),util[_0xafa6('0x47')](_0x5afe19,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')][_0xafa6('0x1e')]=function(_0x108d4a){try{if(this[_0xafa6('0x60')](_0x108d4a)){if(this[_0xafa6('0x11')][_0x108d4a['uniqueid']]){var _0x30adf9=_[_0xafa6('0x74')](this[_0xafa6('0x11')][_0x108d4a[_0xafa6('0x6c')]]);_0x30adf9[_0xafa6('0x75')]=![];_0x30adf9[_0xafa6('0x76')]=null;_0x30adf9['holdtime']=_0x108d4a[_0xafa6('0x77')];_0x30adf9[_0xafa6('0x78')]=_0x108d4a[_0xafa6('0x78')];_0x30adf9[_0xafa6('0x1d')]=!![];_0x30adf9['queuecallerabandonAt']=moment()['format'](_0xafa6('0x6d'));_0x30adf9[_0xafa6('0x79')]='ABANDONED';_0x30adf9[_0xafa6('0x7a')]=null;this[_0xafa6('0x36')][_0x108d4a['uniqueid']]=_0x30adf9;this['emitVoiceQueueChannelRemove'](_0x30adf9);}}}catch(_0x5b69ce){logger[_0xafa6('0x40')](_0xafa6('0x7b'),util['inspect'](_0x5b69ce,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')]['syncQueueCallerLeave']=function(_0x74f362){try{if(this[_0xafa6('0x60')](_0x74f362)){if(this[_0xafa6('0x11')][_0x74f362[_0xafa6('0x6c')]]){var _0x414e75=_[_0xafa6('0x74')](this[_0xafa6('0x11')][_0x74f362[_0xafa6('0x6c')]]);_0x414e75[_0xafa6('0x7c')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x414e75[_0xafa6('0x7d')]=_0x74f362['connectedlinenum'];_0x414e75[_0xafa6('0x7e')]=_0x74f362['connectedlinename'];this[_0xafa6('0x36')][_0x74f362[_0xafa6('0x6c')]]=_0x414e75;this['emitVoiceQueueChannelSave'](_0x414e75);}}}catch(_0xe7c6d){logger[_0xafa6('0x40')]('[syncQueueCallerLeave][VoiceQueueReport]',util['inspect'](_0xe7c6d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')]['syncAgentConnect']=function(_0x1bcbaf){try{if(this[_0xafa6('0x60')](_0x1bcbaf)){if(this[_0xafa6('0x11')][_0x1bcbaf[_0xafa6('0x6c')]]){var _0x47d9c1=_[_0xafa6('0x74')](this[_0xafa6('0x11')][_0x1bcbaf[_0xafa6('0x6c')]]);_0x47d9c1[_0xafa6('0x75')]=!![];_0x47d9c1[_0xafa6('0x79')]='COMPLETEDBYAGENT';}}}catch(_0x404a84){logger[_0xafa6('0x40')]('[syncAgentConnect][VoiceQueueReport]',util[_0xafa6('0x47')](_0x404a84,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0xafa6('0x21')]=function(_0xe010d1){try{if(this[_0xafa6('0x60')](_0xe010d1)){if(this[_0xafa6('0x11')][_0xe010d1['uniqueid']]){var _0x2c1ee2=_[_0xafa6('0x74')](this['queueReports'][_0xe010d1['uniqueid']]);_0x2c1ee2['queuecallerabandon']=![];_0x2c1ee2[_0xafa6('0x7f')]=null;_0x2c1ee2['assigned']=!![];_0x2c1ee2['lastAssignedTo']=_0xe010d1[_0xafa6('0x80')];_0x2c1ee2[_0xafa6('0x77')]=_0xe010d1[_0xafa6('0x77')];_0x2c1ee2[_0xafa6('0x75')]=!![];_0x2c1ee2[_0xafa6('0x81')]=![];_0x2c1ee2[_0xafa6('0x82')]=null;if(!_0x2c1ee2['transfer']){if(_0xe010d1[_0xafa6('0x83')]==_0xafa6('0x84')){_0x2c1ee2['queuecallerexitreason']=_0xafa6('0x85');}else{if(_[_0xafa6('0x86')](_0xe010d1[_0xafa6('0x3c')]['toLowerCase'](),_0xafa6('0x87'))){if(this[_0xafa6('0x11')][_0xe010d1['linkedid']]){var _0x428781=_['last'](this['queueReports'][_0xe010d1[_0xafa6('0x88')]]);_0x428781['queuecallercomplete']=![];_0x428781[_0xafa6('0x81')]=!![];_0x428781[_0xafa6('0x82')]=moment(_0x2c1ee2[_0xafa6('0x89')])[_0xafa6('0x8a')](_0xe010d1[_0xafa6('0x77')],_0xafa6('0x8b'))[_0xafa6('0x4f')](_0xafa6('0x6d'));_0x428781['queuecallerexitreason']=_0xafa6('0x8c');_0x428781[_0xafa6('0x84')]=!![];_0x428781[_0xafa6('0x8d')]=_0xafa6('0x8e');_0x428781[_0xafa6('0x8f')]=_0xe010d1[_0xafa6('0x90')];_0x428781[_0xafa6('0x91')]=_0xe010d1['uniqueid'];var _0xb65bbc=this[_0xafa6('0x11')][_0xe010d1[_0xafa6('0x88')]];this[_0xafa6('0x11')][_0xe010d1['linkedid']]=this[_0xafa6('0x11')][_0xe010d1[_0xafa6('0x6c')]];this[_0xafa6('0x11')][_0xe010d1[_0xafa6('0x6c')]]=_0xb65bbc;}}else{_0x2c1ee2['queuecallerexitreason']='COMPLETEDBY'+_0xe010d1['reason']['toUpperCase']();}}}this[_0xafa6('0x36')][_0xe010d1[_0xafa6('0x6c')]]=_0x2c1ee2;this[_0xafa6('0x46')](_0x2c1ee2);}}}catch(_0x359146){logger[_0xafa6('0x40')]('[syncAgentComplete][VoiceQueueReport]',util[_0xafa6('0x47')](_0x359146,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')][_0xafa6('0x92')]=function(_0x3a0751){try{if(this[_0xafa6('0x60')](_0x3a0751)){this['addVariable'](_0x3a0751[_0xafa6('0x6c')],_[_0xafa6('0x71')](_0x3a0751[_0xafa6('0x93')])[0x0],_0x3a0751[_0xafa6('0x94')]);if(this['queueReports'][_0x3a0751['uniqueid']]){var _0x32b8e6=_[_0xafa6('0x74')](this[_0xafa6('0x11')][_0x3a0751[_0xafa6('0x6c')]]);if(_0x32b8e6){if(this[_0xafa6('0x60')](_0x3a0751[_0xafa6('0x93')])&&this['isNotNull'](_0x3a0751[_0xafa6('0x93')][_0xafa6('0x95')])){switch(_0x3a0751[_0xafa6('0x94')]){case _0xafa6('0x96'):_0x32b8e6['queuecallerexit']=![];_0x32b8e6[_0xafa6('0x82')]=null;break;default:_0x32b8e6[_0xafa6('0x81')]=!![];_0x32b8e6[_0xafa6('0x82')]=moment()[_0xafa6('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');_0x32b8e6[_0xafa6('0x7c')]=moment()[_0xafa6('0x4f')](_0xafa6('0x6d'));}_0x32b8e6['queuecallerabandon']=![];_0x32b8e6['queuecallerabandonAt']=null;_0x32b8e6['queuecallerexitreason']=_0x3a0751[_0xafa6('0x94')];this[_0xafa6('0x36')][_0x3a0751[_0xafa6('0x6c')]]=_0x32b8e6;this[_0xafa6('0x46')](_0x32b8e6);}else if(this[_0xafa6('0x60')](_0x3a0751['variable'])&&this[_0xafa6('0x60')](_0x3a0751[_0xafa6('0x93')]['queueposition'])){if(!_0x32b8e6[_0xafa6('0x1d')]){_0x32b8e6[_0xafa6('0x81')]=!![];_0x32b8e6[_0xafa6('0x82')]=moment()[_0xafa6('0x4f')](_0xafa6('0x6d'));_0x32b8e6[_0xafa6('0x79')]=_0xafa6('0x97');_0x32b8e6['queuecallerleaveAt']=moment()['format'](_0xafa6('0x6d'));this['channels'][_0x3a0751[_0xafa6('0x6c')]]=_0x32b8e6;}}_0x32b8e6[_0xafa6('0x17')]=this[_0xafa6('0x17')][_0x3a0751[_0xafa6('0x6c')]];}}}}catch(_0x1baee5){logger[_0xafa6('0x40')]('[syncVarSet][VoiceQueueReport]',util[_0xafa6('0x47')](_0x1baee5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0xafa6('0xd')][_0xafa6('0x98')]=function(_0x43e796,_0x6525d6,_0xdee69d){var _0xd71c31=[_0xafa6('0x99'),_0xafa6('0x9a'),'rtpaudioqosjitter',_0xafa6('0x9b'),_0xafa6('0x9c'),_0xafa6('0x9d'),_0xafa6('0x9e'),_0xafa6('0x9f'),_0xafa6('0xa0'),_0xafa6('0xa1'),_0xafa6('0xa2'),_0xafa6('0xa3'),_0xafa6('0xa4'),_0xafa6('0xa5'),_0xafa6('0xa6'),_0xafa6('0xa7'),'membername',_0xafa6('0xa8'),_0xafa6('0xa9')];if(!_[_0xafa6('0x39')](_0x6525d6)&&!_['includes'](_0xd71c31,_0x6525d6)){if(_[_0xafa6('0x2f')](this[_0xafa6('0x17')][_0x43e796])){this[_0xafa6('0x17')][_0x43e796]={};}this[_0xafa6('0x17')][_0x43e796][_0x6525d6]=_0xdee69d;}};VoiceQueueReport[_0xafa6('0xd')][_0xafa6('0x25')]=function(_0x2a752e){try{if(this[_0xafa6('0x60')](_0x2a752e)){if(this[_0xafa6('0x11')][_0x2a752e[_0xafa6('0x6c')]]){for(var _0x251888=0x0,_0x1c36b4={};_0x251888=0x0?moment(_0x1fa04a[_0xc05d('0x19')])[_0xc05d('0xf')](_0x1fa04a['starttime'],_0xc05d('0x10')):null,'data1':_0xc05d('0x1b'),'data2':_0x1fa04a[_0xc05d('0x16')],'data3':_0x1fa04a['exten'],'data4':_0x1fa04a['dialstring']||null,'role':'agent','internal':_0x1fa04a[_0xc05d('0x16')]?_[_0xc05d('0x15')](_0x1fa04a[_0xc05d('0x16')]):undefined,'uniqueid':_0x1fa04a[_0xc05d('0x17')]},'log':_0xc05d('0x6')});}; \ No newline at end of file +var _0x8363=['exten','util','../client','voiceQueueReport','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface','SIP/%s','diff','queuecallerleaveAt','seconds','agent','accountcode','toNumber','uniqueid','voiceDialReport','membername','TALKING','starttime','endtime','outbound'];(function(_0x297fd3,_0x115406){var _0x2af381=function(_0x1dd31b){while(--_0x1dd31b){_0x297fd3['push'](_0x297fd3['shift']());}};_0x2af381(++_0x115406);}(_0x8363,0x199));var _0x3836=function(_0x2b39ba,_0xb68ea4){_0x2b39ba=_0x2b39ba-0x0;var _0x144864=_0x8363[_0x2b39ba];return _0x144864;};'use strict';var moment=require('moment');var _=require('lodash');var util=require(_0x3836('0x0'));var client=require(_0x3836('0x1'));exports[_0x3836('0x2')]=function(_0x1cc26c){var _0x14b8b5=_0x1cc26c['queuecallercompleteAt']||_0x1cc26c[_0x3836('0x3')];return client[_0x3836('0x4')](_0x3836('0x5'),{'body':{'channel':_0x3836('0x6'),'membername':_0x1cc26c[_0x3836('0x7')],'interface':_['isNil'](_0x1cc26c[_0x3836('0x8')])?util['format'](_0x3836('0x9'),_0x1cc26c['lastAssignedTo']):_0x1cc26c[_0x3836('0x8')],'type':'TALKING','enterAt':_0x1cc26c['queuecallerleaveAt'],'exitAt':_0x14b8b5,'duration':moment(_0x14b8b5)[_0x3836('0xa')](_0x1cc26c[_0x3836('0xb')],_0x3836('0xc')),'data1':'inbound','data2':_0x1cc26c['calleridnum'],'data3':_0x1cc26c['exten'],'data4':null,'data5':_0x1cc26c['queue'],'role':_0x3836('0xd'),'internal':_0x1cc26c[_0x3836('0xe')]?_[_0x3836('0xf')](_0x1cc26c[_0x3836('0xe')]):undefined,'uniqueid':_0x1cc26c[_0x3836('0x10')]},'log':_0x3836('0x5')});};exports[_0x3836('0x11')]=function(_0x3b27ed){return client[_0x3836('0x4')](_0x3836('0x5'),{'body':{'channel':'voice','membername':_0x3b27ed[_0x3836('0x12')],'interface':_0x3b27ed['interface'],'type':_0x3836('0x13'),'enterAt':_0x3b27ed[_0x3836('0x14')],'exitAt':_0x3b27ed['endtime'],'duration':moment(_0x3b27ed[_0x3836('0x15')])[_0x3836('0xa')](_0x3b27ed[_0x3836('0x14')],'seconds')>=0x0?moment(_0x3b27ed[_0x3836('0x15')])[_0x3836('0xa')](_0x3b27ed[_0x3836('0x14')],_0x3836('0xc')):null,'data1':_0x3836('0x16'),'data2':_0x3b27ed[_0x3836('0xe')],'data3':_0x3b27ed[_0x3836('0x17')],'data4':_0x3b27ed['dialstring']||null,'role':_0x3836('0xd'),'internal':_0x3b27ed['accountcode']?_[_0x3836('0xf')](_0x3b27ed[_0x3836('0xe')]):undefined,'uniqueid':_0x3b27ed[_0x3836('0x10')]},'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 05d1aa0..b74b27b 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 _0xd64b=['GetTemplate','name','html','../client','Request'];(function(_0x21970a,_0xd9d04e){var _0x222f45=function(_0x2e24c5){while(--_0x2e24c5){_0x21970a['push'](_0x21970a['shift']());}};_0x222f45(++_0xd9d04e);}(_0xd64b,0xc1));var _0xbd64=function(_0x4caea4,_0x4f02e4){_0x4caea4=_0x4caea4-0x0;var _0x207c7c=_0xd64b[_0x4caea4];return _0x207c7c;};'use strict';var client=require(_0xbd64('0x0'));exports['getTemplates']=function(_0xf0de04){return function(_0x4bfb7c){return client[_0xbd64('0x1')](_0xbd64('0x2'),{'options':{'raw':!![],'attributes':['id',_0xbd64('0x3'),_0xbd64('0x4')]},'log':_0xbd64('0x2')});};}; \ No newline at end of file +var _0x3c81=['../client','getTemplates','Request'];(function(_0x534e67,_0x45eb1d){var _0x3d9e51=function(_0x4e0e12){while(--_0x4e0e12){_0x534e67['push'](_0x534e67['shift']());}};_0x3d9e51(++_0x45eb1d);}(_0x3c81,0x102));var _0x13c8=function(_0x54fb55,_0x497bd5){_0x54fb55=_0x54fb55-0x0;var _0x359030=_0x3c81[_0x54fb55];return _0x359030;};'use strict';var client=require(_0x13c8('0x0'));exports[_0x13c8('0x1')]=function(_0x48c35b){return function(_0x252f26){return client[_0x13c8('0x2')]('GetTemplate',{'options':{'raw':!![],'attributes':['id','name','html']},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index 7db6c26..e36fc66 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 _0x3237=['data3','data5','data6','data7','../client','getTriggers','Request','GetTrigger','name','channel','status','Condition','operator','AnyConditions','field','value','Action','action'];(function(_0x4fc3d7,_0x13777d){var _0x4ece22=function(_0x2e5b5a){while(--_0x2e5b5a){_0x4fc3d7['push'](_0x4fc3d7['shift']());}};_0x4ece22(++_0x13777d);}(_0x3237,0x1d8));var _0x7323=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3237[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7323('0x0'));exports[_0x7323('0x1')]=function(_0x5108a3){return function(_0x213550){return client[_0x7323('0x2')](_0x7323('0x3'),{'options':{'raw':![],'attributes':['id',_0x7323('0x4'),_0x7323('0x5'),_0x7323('0x6')],'include':[{'model':_0x7323('0x7'),'as':'AllConditions','attributes':['id','field',_0x7323('0x8'),'value']},{'model':_0x7323('0x7'),'as':_0x7323('0x9'),'attributes':['id',_0x7323('0xa'),'operator',_0x7323('0xb')]},{'model':_0x7323('0xc'),'as':'Actions','attributes':['id',_0x7323('0xd'),'data1','data2',_0x7323('0xe'),'data4',_0x7323('0xf'),_0x7323('0x10'),_0x7323('0x11')]}]},'log':_0x7323('0x3')});};}; \ No newline at end of file +var _0xb09a=['AnyConditions','Action','action','data1','data2','data3','data4','data5','data7','GetTrigger','../client','getTriggers','name','status','Condition','field','operator','value'];(function(_0x389882,_0x31c162){var _0x329a0a=function(_0x3d32fe){while(--_0x3d32fe){_0x389882['push'](_0x389882['shift']());}};_0x329a0a(++_0x31c162);}(_0xb09a,0x1cc));var _0xab09=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0xb09a[_0x5a2285];return _0x48f6ed;};'use strict';var client=require(_0xab09('0x0'));exports[_0xab09('0x1')]=function(_0x29f90c){return function(_0x23a1b4){return client['Request']('GetTrigger',{'options':{'raw':![],'attributes':['id',_0xab09('0x2'),'channel',_0xab09('0x3')],'include':[{'model':_0xab09('0x4'),'as':'AllConditions','attributes':['id',_0xab09('0x5'),_0xab09('0x6'),_0xab09('0x7')]},{'model':_0xab09('0x4'),'as':_0xab09('0x8'),'attributes':['id',_0xab09('0x5'),'operator','value']},{'model':_0xab09('0x9'),'as':'Actions','attributes':['id',_0xab09('0xa'),_0xab09('0xb'),_0xab09('0xc'),_0xab09('0xd'),_0xab09('0xe'),_0xab09('0xf'),'data6',_0xab09('0x10')]}]},'log':_0xab09('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 99782cf..ee77f7c 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 _0x1f87=['getTrunks','Request','GetTrunk','registry','../client'];(function(_0x2160a9,_0x3cbd9e){var _0xa88cf7=function(_0x51ab6f){while(--_0x51ab6f){_0x2160a9['push'](_0x2160a9['shift']());}};_0xa88cf7(++_0x3cbd9e);}(_0x1f87,0x86));var _0x71f8=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0x1f87[_0x2a4fe2];return _0x225c4a;};'use strict';var client=require(_0x71f8('0x0'));exports[_0x71f8('0x1')]=function(_0x1727da){return function(_0x4b5c70){return client[_0x71f8('0x2')](_0x71f8('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name',_0x71f8('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x958a=['name','registry','GetTrunk'];(function(_0x47aa64,_0xfb8a07){var _0x549c7a=function(_0x266165){while(--_0x266165){_0x47aa64['push'](_0x47aa64['shift']());}};_0x549c7a(++_0xfb8a07);}(_0x958a,0x1c4));var _0xa958=function(_0x5ea987,_0x5f08b2){_0x5ea987=_0x5ea987-0x0;var _0x1a98c8=_0x958a[_0x5ea987];return _0x1a98c8;};'use strict';var client=require('../client');exports['getTrunks']=function(_0x3810a1){return function(_0x363286){return client['Request'](_0xa958('0x0'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xa958('0x1'),_0xa958('0x2')]},'log':_0xa958('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index 47ac4ee..c083a82 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 _0x5734=['Request','GetUser','accountcode','internal','savePause','PauseUser','saveUnpause','UnpauseUser','ShowUser','online','../client','agent','name','email','fullname','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x5734,0x82));var _0x4573=function(_0x37e343,_0x5dbfea){_0x37e343=_0x37e343-0x0;var _0xf688dc=_0x5734[_0x37e343];return _0xf688dc;};'use strict';var client=require(_0x4573('0x0'));exports['getAgents']=function(){return function(){return client['Request']('GetUser',{'options':{'raw':![],'where':{'role':_0x4573('0x1')},'attributes':['id',_0x4573('0x2'),_0x4573('0x3'),'accountcode',_0x4573('0x4'),'online',_0x4573('0x5'),_0x4573('0x6'),_0x4573('0x7'),_0x4573('0x8'),_0x4573('0x9'),_0x4573('0xa'),_0x4573('0xb')]},'log':_0x4573('0xc')});};};exports[_0x4573('0xd')]=function(){return function(){return client[_0x4573('0xe')](_0x4573('0xf'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x4573('0x2'),_0x4573('0x10'),_0x4573('0x11')]},'log':_0x4573('0xd')});};};exports[_0x4573('0x12')]=function(_0x57c5f1,_0x5dacf1,_0x57fdc0){return client['Request'](_0x4573('0x13'),{'body':{'type':_0x5dacf1,'uniqueid':_0x57fdc0},'options':{'where':{'id':_0x57c5f1['id']}},'log':_0x4573('0x12')});};exports[_0x4573('0x14')]=function(_0x309b2a){return client[_0x4573('0xe')](_0x4573('0x15'),{'body':{},'options':{'where':{'id':_0x309b2a['id']}},'log':'savePause'});};exports['getAgent']=function(_0x7a8c3f){return client[_0x4573('0xe')](_0x4573('0x16'),{'options':{'raw':![],'where':{'role':_0x4573('0x1'),'id':_0x7a8c3f},'attributes':['id',_0x4573('0x2'),_0x4573('0x3'),_0x4573('0x10'),_0x4573('0x4'),_0x4573('0x17'),_0x4573('0x5'),_0x4573('0x6'),'lastPauseAt',_0x4573('0x8'),'interface']},'log':'getAgent'});}; \ No newline at end of file +var _0x3dab=['voicePause','phone','interface','getTelephones','telephone','internal','savePause','saveUnpause','ShowUser','agent','fullname','lastPauseAt','../client','getAgents','Request','GetUser','name','email','accountcode','online','lastLoginAt','pauseType'];(function(_0x153e7d,_0x10a35f){var _0x3c22dd=function(_0x4d33f6){while(--_0x4d33f6){_0x153e7d['push'](_0x153e7d['shift']());}};_0x3c22dd(++_0x10a35f);}(_0x3dab,0xfe));var _0xb3da=function(_0x19416a,_0x44f465){_0x19416a=_0x19416a-0x0;var _0x1ed6c0=_0x3dab[_0x19416a];return _0x1ed6c0;};'use strict';var client=require(_0xb3da('0x0'));exports[_0xb3da('0x1')]=function(){return function(){return client[_0xb3da('0x2')](_0xb3da('0x3'),{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0xb3da('0x4'),_0xb3da('0x5'),_0xb3da('0x6'),'fullname',_0xb3da('0x7'),_0xb3da('0x8'),_0xb3da('0x9'),'lastPauseAt',_0xb3da('0xa'),_0xb3da('0xb'),'mobile',_0xb3da('0xc')]},'log':_0xb3da('0x1')});};};exports[_0xb3da('0xd')]=function(){return function(){return client[_0xb3da('0x2')](_0xb3da('0x3'),{'options':{'raw':!![],'where':{'role':_0xb3da('0xe')},'attributes':['id',_0xb3da('0x4'),'accountcode',_0xb3da('0xf')]},'log':_0xb3da('0xd')});};};exports[_0xb3da('0x10')]=function(_0x18eb87,_0x3eb4bb,_0x1e1fea){return client[_0xb3da('0x2')]('PauseUser',{'body':{'type':_0x3eb4bb,'uniqueid':_0x1e1fea},'options':{'where':{'id':_0x18eb87['id']}},'log':'savePause'});};exports[_0xb3da('0x11')]=function(_0x2dfb62){return client[_0xb3da('0x2')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x2dfb62['id']}},'log':_0xb3da('0x10')});};exports['getAgent']=function(_0x5f2fea){return client[_0xb3da('0x2')](_0xb3da('0x12'),{'options':{'raw':![],'where':{'role':_0xb3da('0x13'),'id':_0x5f2fea},'attributes':['id','name','email',_0xb3da('0x6'),_0xb3da('0x14'),_0xb3da('0x7'),_0xb3da('0x8'),_0xb3da('0x9'),_0xb3da('0x15'),_0xb3da('0xa'),_0xb3da('0xc')]},'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 73526bd..708a073 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 _0x6cba=['create','CreateVoiceAgentReport','update','Request','UpdateVoiceAgentReport','../client'];(function(_0x238c6c,_0x33f3cd){var _0x182005=function(_0x1b098e){while(--_0x1b098e){_0x238c6c['push'](_0x238c6c['shift']());}};_0x182005(++_0x33f3cd);}(_0x6cba,0x173));var _0xa6cb=function(_0x2553b9,_0x240a53){_0x2553b9=_0x2553b9-0x0;var _0x4938b0=_0x6cba[_0x2553b9];return _0x4938b0;};'use strict';var client=require(_0xa6cb('0x0'));exports[_0xa6cb('0x1')]=function(_0x1a7eef){return client['Request'](_0xa6cb('0x2'),{'body':_0x1a7eef,'log':_0xa6cb('0x2')});};exports[_0xa6cb('0x3')]=function(_0x42f723,_0x23fff2,_0x317c34){return client[_0xa6cb('0x4')](_0xa6cb('0x5'),{'body':_0x42f723,'options':{'where':{'uniqueid':_0x23fff2,'interface':_0x317c34,'agentcomplete':!![]}},'log':_0xa6cb('0x5')});}; \ No newline at end of file +var _0xf254=['update','UpdateVoiceAgentReport','../client','create','Request','CreateVoiceAgentReport'];(function(_0x42c1f7,_0x2348ff){var _0x5ca4f0=function(_0x3cbaff){while(--_0x3cbaff){_0x42c1f7['push'](_0x42c1f7['shift']());}};_0x5ca4f0(++_0x2348ff);}(_0xf254,0x188));var _0x4f25=function(_0x34c063,_0x11d3d7){_0x34c063=_0x34c063-0x0;var _0x2c63a3=_0xf254[_0x34c063];return _0x2c63a3;};'use strict';var client=require(_0x4f25('0x0'));exports[_0x4f25('0x1')]=function(_0x4e1076){return client[_0x4f25('0x2')](_0x4f25('0x3'),{'body':_0x4e1076,'log':_0x4f25('0x3')});};exports[_0x4f25('0x4')]=function(_0x37beb5,_0x4c77c0,_0x34a30f){return client['Request'](_0x4f25('0x5'),{'body':_0x37beb5,'options':{'where':{'uniqueid':_0x4c77c0,'interface':_0x34a30f,'agentcomplete':!![]}},'log':_0x4f25('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 3ad6545..ded4c3f 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 _0xb696=['format','YYYY-MM-DD\x20HH:mm:ss','endOf','type','billableseconds','GetVoiceCallReports','util','lodash','create','Request','CreateVoiceCallReport','calleridnum','context','callerid','DOCUMENTATION','GetVoiceCallReport','startOf','day'];(function(_0x40c70a,_0x566177){var _0xa49b66=function(_0x1556d0){while(--_0x1556d0){_0x40c70a['push'](_0x40c70a['shift']());}};_0xa49b66(++_0x566177);}(_0xb696,0x84));var _0x6b69=function(_0x3d6ab3,_0x7205ab){_0x3d6ab3=_0x3d6ab3-0x0;var _0x65519b=_0xb696[_0x3d6ab3];return _0x65519b;};'use strict';var moment=require('moment');var util=require(_0x6b69('0x0'));var _=require(_0x6b69('0x1'));var client=require('../client');exports[_0x6b69('0x2')]=function(_0x233c08){return client[_0x6b69('0x3')](_0x6b69('0x4'),{'body':_['merge'](_0x233c08,{'source':_0x233c08[_0x6b69('0x5')],'destinationcontext':_0x233c08[_0x6b69('0x6')],'callerid':_0x233c08[_0x6b69('0x7')],'amaflags':_0x6b69('0x8')}),'log':_0x6b69('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x6b69('0x3')](_0x6b69('0x9'),{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x6b69('0xa')](_0x6b69('0xb'))[_0x6b69('0xc')](_0x6b69('0xd')),moment()[_0x6b69('0xe')](_0x6b69('0xb'))[_0x6b69('0xc')](_0x6b69('0xd'))]}},'attributes':[_0x6b69('0xf'),'disposition','duration',_0x6b69('0x10')]},'log':_0x6b69('0x11')});};}; \ No newline at end of file +var _0x8d05=['duration','billableseconds','GetVoiceCallReports','moment','util','lodash','create','CreateVoiceCallReport','context','callerid','DOCUMENTATION','Request','outbound','startOf','day','format','YYYY-MM-DD\x20HH:mm:ss','type','disposition'];(function(_0x13cb5e,_0x143268){var _0x4226ac=function(_0x2144e7){while(--_0x2144e7){_0x13cb5e['push'](_0x13cb5e['shift']());}};_0x4226ac(++_0x143268);}(_0x8d05,0x159));var _0x58d0=function(_0xaae8e8,_0x35aa5c){_0xaae8e8=_0xaae8e8-0x0;var _0xcff5cf=_0x8d05[_0xaae8e8];return _0xcff5cf;};'use strict';var moment=require(_0x58d0('0x0'));var util=require(_0x58d0('0x1'));var _=require(_0x58d0('0x2'));var client=require('../client');exports[_0x58d0('0x3')]=function(_0x43cc1d){return client['Request'](_0x58d0('0x4'),{'body':_['merge'](_0x43cc1d,{'source':_0x43cc1d['calleridnum'],'destinationcontext':_0x43cc1d[_0x58d0('0x5')],'callerid':_0x43cc1d[_0x58d0('0x6')],'amaflags':_0x58d0('0x7')}),'log':_0x58d0('0x4')});};exports['getVoiceCallReports']=function(){return function(){return client[_0x58d0('0x8')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x58d0('0x9')],'createdAt':{'$between':[moment()[_0x58d0('0xa')](_0x58d0('0xb'))[_0x58d0('0xc')](_0x58d0('0xd')),moment()['endOf'](_0x58d0('0xb'))[_0x58d0('0xc')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x58d0('0xe'),_0x58d0('0xf'),_0x58d0('0x10'),_0x58d0('0x11')]},'log':_0x58d0('0x12')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index b3e0dc2..846320c 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 _0xa36a=['create','Request','CreateVoiceDialReport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa36a,0xc6));var _0xaa36=function(_0x48fd30,_0x3aaf97){_0x48fd30=_0x48fd30-0x0;var _0x205130=_0xa36a[_0x48fd30];return _0x205130;};'use strict';var client=require('../client');exports[_0xaa36('0x0')]=function(_0x2d37ca){return client[_0xaa36('0x1')](_0xaa36('0x2'),{'body':_0x2d37ca,'log':'CreateVoiceDialReport'});}; \ No newline at end of file +var _0x5c2b=['../client','create','Request','CreateVoiceDialReport'];(function(_0x1a574a,_0x5c1b4f){var _0x1d3ccb=function(_0x2d265a){while(--_0x2d265a){_0x1a574a['push'](_0x1a574a['shift']());}};_0x1d3ccb(++_0x5c1b4f);}(_0x5c2b,0x140));var _0xb5c2=function(_0x2c2e43,_0x4ac6a9){_0x2c2e43=_0x2c2e43-0x0;var _0x37d45c=_0x5c2b[_0x2c2e43];return _0x37d45c;};'use strict';var client=require(_0xb5c2('0x0'));exports[_0xb5c2('0x1')]=function(_0x38cdf7){return client[_0xb5c2('0x2')](_0xb5c2('0x3'),{'body':_0x38cdf7,'log':_0xb5c2('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index 078f899..2382a53 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 _0xfbb2=['getVoiceExtensions','Request','GetVoiceExtension','recordingFormat','../client'];(function(_0x277764,_0x4085da){var _0xb2c1df=function(_0x35fe8f){while(--_0x35fe8f){_0x277764['push'](_0x277764['shift']());}};_0xb2c1df(++_0x4085da);}(_0xfbb2,0xae));var _0x2fbb=function(_0x4a2718,_0x2b8edb){_0x4a2718=_0x4a2718-0x0;var _0x41cddf=_0xfbb2[_0x4a2718];return _0x41cddf;};'use strict';var client=require(_0x2fbb('0x0'));exports[_0x2fbb('0x1')]=function(){return function(){return client[_0x2fbb('0x2')](_0x2fbb('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x2fbb('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x2fbb('0x1')});};}; \ No newline at end of file +var _0xbc6f=['recordingFormat','../client','getVoiceExtensions','Request','GetVoiceExtension','exten'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc6f,0x127));var _0xfbc6=function(_0x1a1d9b,_0x5ea65a){_0x1a1d9b=_0x1a1d9b-0x0;var _0x1d7a59=_0xbc6f[_0x1a1d9b];return _0x1d7a59;};'use strict';var client=require(_0xfbc6('0x0'));exports[_0xfbc6('0x1')]=function(){return function(){return client[_0xfbc6('0x2')](_0xfbc6('0x3'),{'options':{'raw':!![],'attributes':['id',_0xfbc6('0x4'),_0xfbc6('0x5')],'where':{'VoiceExtensionId':null}},'log':_0xfbc6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 12d6fcc..42c7c9f 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 _0x076c=['callerid','Pause','Interval','interval','../client','getVoiceQueues','Request','name','acw','monitor_format','dialActive','dialMethod','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialQueueProject2','strategy','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','Trunk'];(function(_0x3355c0,_0x4b530b){var _0x5a3288=function(_0x46dad1){while(--_0x46dad1){_0x3355c0['push'](_0x3355c0['shift']());}};_0x5a3288(++_0x4b530b);}(_0x076c,0xe8));var _0xc076=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0x076c[_0x2e50a2];return _0x47e5de;};'use strict';var client=require(_0xc076('0x0'));exports[_0xc076('0x1')]=function(){return function(){return client[_0xc076('0x2')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0xc076('0x3'),_0xc076('0x4'),'acwTimeout','autopause',_0xc076('0x5'),'type',_0xc076('0x6'),_0xc076('0x7'),'dialLimitChannel',_0xc076('0x8'),_0xc076('0x9'),_0xc076('0xa'),_0xc076('0xb'),_0xc076('0xc'),_0xc076('0xd'),_0xc076('0xe'),'dialOriginateTimeout',_0xc076('0xf'),_0xc076('0x10'),_0xc076('0x11'),_0xc076('0x12'),_0xc076('0x13'),_0xc076('0x14'),_0xc076('0x15'),_0xc076('0x16'),_0xc076('0x17'),_0xc076('0x18'),_0xc076('0x19'),_0xc076('0x1a'),'dialPrefix',_0xc076('0x1b'),_0xc076('0x1c'),_0xc076('0x1d'),_0xc076('0x1e'),_0xc076('0x1f'),_0xc076('0x20'),'dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords',_0xc076('0x21'),'dialAMDMaximumWordLength',_0xc076('0x22'),_0xc076('0x23'),_0xc076('0x24'),_0xc076('0x25'),_0xc076('0x26'),'dialAgiAfterHangupClient',_0xc076('0x27'),'monitor_format',_0xc076('0x28'),_0xc076('0x29'),'dialCutDigit',_0xc076('0x2a'),_0xc076('0x2b'),_0xc076('0x2c'),_0xc076('0x2d'),'dialAbandonedMaxRetry',_0xc076('0x2e'),'dialMachineMaxRetry',_0xc076('0x2f'),'dialAgentRejectMaxRetry',_0xc076('0x30'),_0xc076('0x31'),_0xc076('0x32'),_0xc076('0x33')],'include':[{'model':_0xc076('0x34'),'as':_0xc076('0x34'),'attributes':['id',_0xc076('0x3'),_0xc076('0x35'),'active']},{'model':_0xc076('0x36'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0xc076('0x34'),'as':'TrunkBackup','attributes':['id','name',_0xc076('0x35'),'active']},{'model':_0xc076('0x37'),'as':_0xc076('0x37'),'attributes':['id',_0xc076('0x3')],'include':[{'model':_0xc076('0x37'),'as':'Intervals','attributes':['id',_0xc076('0x3'),_0xc076('0x38')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0x5170=['Trunk','active','Pause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','name','acw','acwTimeout','autopause','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDMaximumWordLength','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMaxThreshold'];(function(_0x55f549,_0x4f90ac){var _0x589a78=function(_0x4b2cc3){while(--_0x4b2cc3){_0x55f549['push'](_0x55f549['shift']());}};_0x589a78(++_0x4f90ac);}(_0x5170,0x1e0));var _0x0517=function(_0x5a2f58,_0x42fa6f){_0x5a2f58=_0x5a2f58-0x0;var _0xa8920d=_0x5170[_0x5a2f58];return _0xa8920d;};'use strict';var client=require('../client');exports[_0x0517('0x0')]=function(){return function(){return client[_0x0517('0x1')]('GetVoiceQueue',{'options':{'raw':![],'attributes':['id',_0x0517('0x2'),_0x0517('0x3'),_0x0517('0x4'),_0x0517('0x5'),'monitor_format',_0x0517('0x6'),_0x0517('0x7'),_0x0517('0x8'),_0x0517('0x9'),_0x0517('0xa'),'dialPowerLevel',_0x0517('0xb'),_0x0517('0xc'),'dialPredictiveInterval',_0x0517('0xd'),_0x0517('0xe'),_0x0517('0xf'),_0x0517('0x10'),_0x0517('0x11'),'dialQueueProject',_0x0517('0x12'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x0517('0x13'),_0x0517('0x14'),_0x0517('0x15'),_0x0517('0x16'),_0x0517('0x17'),_0x0517('0x18'),_0x0517('0x19'),'dialCheckDuplicateType',_0x0517('0x1a'),_0x0517('0x1b'),_0x0517('0x1c'),_0x0517('0x1d'),_0x0517('0x1e'),_0x0517('0x1f'),_0x0517('0x20'),_0x0517('0x21'),'dialAMDSilenceThreshold',_0x0517('0x22'),'timeout','dialRecallMeTimeout',_0x0517('0x23'),_0x0517('0x24'),_0x0517('0x25'),_0x0517('0x26'),'dialQueueProject2',_0x0517('0x27'),_0x0517('0x28'),_0x0517('0x29'),_0x0517('0x2a'),_0x0517('0x2b'),'dialNoSuchNumberRetryFrequency','dialDropMaxRetry',_0x0517('0x2c'),'dialAbandonedMaxRetry',_0x0517('0x2d'),_0x0517('0x2e'),_0x0517('0x2f'),_0x0517('0x30'),'dialAgentRejectRetryFrequency',_0x0517('0x31'),_0x0517('0x32'),'dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x0517('0x33'),'as':_0x0517('0x33'),'attributes':['id',_0x0517('0x2'),'callerid',_0x0517('0x34')]},{'model':_0x0517('0x35'),'as':'mandatoryDispositionPause','attributes':['id','name']},{'model':_0x0517('0x33'),'as':_0x0517('0x36'),'attributes':['id','name',_0x0517('0x37'),_0x0517('0x34')]},{'model':_0x0517('0x38'),'as':_0x0517('0x38'),'attributes':['id',_0x0517('0x2')],'include':[{'model':_0x0517('0x38'),'as':_0x0517('0x39'),'attributes':['id',_0x0517('0x2'),_0x0517('0x3a')]}]}]},'log':_0x0517('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index d5f91bb..b68f32f 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 _0x10df=['startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss','queue','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','create','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport'];(function(_0x4d9f48,_0x5e1079){var _0x391a71=function(_0x106b46){while(--_0x106b46){_0x4d9f48['push'](_0x4d9f48['shift']());}};_0x391a71(++_0x5e1079);}(_0x10df,0x1ae));var _0xf10d=function(_0x32fc14,_0x20cd7b){_0x32fc14=_0x32fc14-0x0;var _0x434767=_0x10df[_0x32fc14];return _0x434767;};'use strict';var moment=require(_0xf10d('0x0'));var _=require(_0xf10d('0x1'));var client=require('../client');exports[_0xf10d('0x2')]=function(_0x47c467){return client[_0xf10d('0x3')](_0xf10d('0x4'),{'body':_0x47c467,'log':_0xf10d('0x4')});};exports[_0xf10d('0x5')]=function(){return function(){return client['Request'](_0xf10d('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0xf10d('0x7')](_0xf10d('0x8'))[_0xf10d('0x9')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xf10d('0xa')](_0xf10d('0x8'))['format'](_0xf10d('0xb'))]}},'attributes':['uniqueid',_0xf10d('0xc'),_0xf10d('0xd'),'queuecallerleaveAt',_0xf10d('0xe'),_0xf10d('0xf'),'queuecallerexit',_0xf10d('0x10'),'queuecallerabandon',_0xf10d('0x11')]},'log':_0xf10d('0x12')});};}; \ No newline at end of file +var _0xf0b7=['queuecallerexitAt','queuecallerabandon','queuecallerabandonAt','GetVoiceQueueReports','moment','lodash','Request','CreateVoiceQueueReport','GetVoiceQueueReport','YYYY-MM-DD\x20HH:mm:ss','endOf','day','format','uniqueid','queue','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0b7,0x158));var _0x7f0b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf0b7[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require(_0x7f0b('0x0'));var _=require(_0x7f0b('0x1'));var client=require('../client');exports['create']=function(_0x48b994){return client[_0x7f0b('0x2')](_0x7f0b('0x3'),{'body':_0x48b994,'log':_0x7f0b('0x3')});};exports['getVoiceQueueReports']=function(){return function(){return client[_0x7f0b('0x2')](_0x7f0b('0x4'),{'options':{'where':{'createdAt':{'$between':[moment()['startOf']('day')['format'](_0x7f0b('0x5')),moment()[_0x7f0b('0x6')](_0x7f0b('0x7'))[_0x7f0b('0x8')](_0x7f0b('0x5'))]}},'attributes':[_0x7f0b('0x9'),_0x7f0b('0xa'),_0x7f0b('0xb'),_0x7f0b('0xc'),_0x7f0b('0xd'),_0x7f0b('0xe'),_0x7f0b('0xf'),_0x7f0b('0x10'),_0x7f0b('0x11'),_0x7f0b('0x12')]},'log':_0x7f0b('0x13')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index a1ca3a4..43aa8d6 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 _0x0963=['GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses','Request'];(function(_0x2902b1,_0x3df95d){var _0x4d13de=function(_0x4b3d6b){while(--_0x4b3d6b){_0x2902b1['push'](_0x2902b1['shift']());}};_0x4d13de(++_0x3df95d);}(_0x0963,0x1d5));var _0x3096=function(_0x42e675,_0x4f24ef){_0x42e675=_0x42e675-0x0;var _0x1e18b9=_0x0963[_0x42e675];return _0x1e18b9;};'use strict';var client=require(_0x3096('0x0'));exports[_0x3096('0x1')]=function(_0x84b999){return function(){return client[_0x3096('0x2')](_0x3096('0x3'),{'options':{'where':{'VoiceQueueId':_0x84b999,'paused':!![]},'raw':!![]},'log':_0x3096('0x1')});};}; \ No newline at end of file +var _0x2f62=['Request','GetVoiceQueueRtPauses','../client','getVoiceQueueRtPauses'];(function(_0x5dbb3e,_0x4b494d){var _0x138d23=function(_0x414fb4){while(--_0x414fb4){_0x5dbb3e['push'](_0x5dbb3e['shift']());}};_0x138d23(++_0x4b494d);}(_0x2f62,0x182));var _0x22f6=function(_0xba2382,_0x19ef46){_0xba2382=_0xba2382-0x0;var _0xa4e9d4=_0x2f62[_0xba2382];return _0xa4e9d4;};'use strict';var client=require(_0x22f6('0x0'));exports[_0x22f6('0x1')]=function(_0x327171){return function(){return client[_0x22f6('0x2')](_0x22f6('0x3'),{'options':{'where':{'VoiceQueueId':_0x327171,'paused':!![]},'raw':!![]},'log':_0x22f6('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 41eeea7..ba9be66 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 _0x8afd=['monitorFilename','lodash','../client','create','Request','CreateVoiceRecording'];(function(_0x3b594b,_0x5835c3){var _0x1ea5f8=function(_0x191b3e){while(--_0x191b3e){_0x3b594b['push'](_0x3b594b['shift']());}};_0x1ea5f8(++_0x5835c3);}(_0x8afd,0x199));var _0xd8af=function(_0x50ec70,_0x58e191){_0x50ec70=_0x50ec70-0x0;var _0x3bf416=_0x8afd[_0x50ec70];return _0x3bf416;};'use strict';var _=require(_0xd8af('0x0'));var client=require(_0xd8af('0x1'));exports[_0xd8af('0x2')]=function(_0x42d7ce){return client[_0xd8af('0x3')](_0xd8af('0x4'),{'body':_['merge'](_0x42d7ce,{'value':_0x42d7ce[_0xd8af('0x5')]}),'log':_0xd8af('0x4')});}; \ No newline at end of file +var _0x2a9e=['create','Request','merge','monitorFilename','CreateVoiceRecording','lodash','../client'];(function(_0xa1fc48,_0x2bb399){var _0x4bb2e5=function(_0x5e4a23){while(--_0x5e4a23){_0xa1fc48['push'](_0xa1fc48['shift']());}};_0x4bb2e5(++_0x2bb399);}(_0x2a9e,0x132));var _0xe2a9=function(_0x3569de,_0x3c3c3a){_0x3569de=_0x3569de-0x0;var _0xcac2a3=_0x2a9e[_0x3569de];return _0xcac2a3;};'use strict';var _=require(_0xe2a9('0x0'));var client=require(_0xe2a9('0x1'));exports[_0xe2a9('0x2')]=function(_0x484a17){return client[_0xe2a9('0x3')]('CreateVoiceRecording',{'body':_[_0xe2a9('0x4')](_0x484a17,{'value':_0x484a17[_0xe2a9('0x5')]}),'log':_0xe2a9('0x6')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 30ae86e..d2c4570 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 _0xf526=['context','extension','blind','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererexten','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereecontext','transfereelinkedid'];(function(_0x5b1f65,_0x1b5cb4){var _0x290cc6=function(_0x168364){while(--_0x168364){_0x5b1f65['push'](_0x5b1f65['shift']());}};_0x290cc6(++_0x1b5cb4);}(_0xf526,0x1e7));var _0x6f52=function(_0x2c998b,_0xc241d3){_0x2c998b=_0x2c998b-0x0;var _0x38414c=_0xf526[_0x2c998b];return _0x38414c;};'use strict';var client=require(_0x6f52('0x0'));exports[_0x6f52('0x1')]=function(_0x49b097){return client[_0x6f52('0x2')](_0x6f52('0x3'),{'body':{'result':_0x49b097[_0x6f52('0x4')],'transfererchannel':_0x49b097[_0x6f52('0x5')],'transferercalleridnum':_0x49b097[_0x6f52('0x6')],'transferercalleridname':_0x49b097[_0x6f52('0x7')],'transfererconnectedlinenum':_0x49b097[_0x6f52('0x8')],'transfererconnectedlinename':_0x49b097[_0x6f52('0x9')],'transfereraccountcode':_0x49b097[_0x6f52('0xa')],'transferercontext':_0x49b097[_0x6f52('0xb')],'transfererexten':_0x49b097[_0x6f52('0xc')],'transfererlinkedid':_0x49b097['transfererlinkedid'],'transfereechannel':_0x49b097[_0x6f52('0xd')],'transfereecalleridnum':_0x49b097[_0x6f52('0xe')],'transfereecalleridname':_0x49b097[_0x6f52('0xf')],'transfereeconnectedlinenum':_0x49b097[_0x6f52('0x10')],'transfereeconnectedlinename':_0x49b097[_0x6f52('0x11')],'transfereeaccountcode':_0x49b097['transfereeaccountcode'],'transfereecontext':_0x49b097[_0x6f52('0x12')],'transfereeexten':_0x49b097['transfereeexten'],'transfereelinkedid':_0x49b097[_0x6f52('0x13')],'isexternal':_0x49b097['isexternal'],'context':_0x49b097[_0x6f52('0x14')],'extension':_0x49b097[_0x6f52('0x15')],'type':_0x6f52('0x16')},'log':'CreateVoiceTransferReport'});};exports['attendedTransfer']=function(_0x4d1829){return client[_0x6f52('0x2')](_0x6f52('0x3'),{'body':{'result':_0x4d1829[_0x6f52('0x4')],'transfererchannel':_0x4d1829[_0x6f52('0x17')],'transferercalleridnum':_0x4d1829[_0x6f52('0x18')],'transferercalleridname':_0x4d1829[_0x6f52('0x19')],'transfererconnectedlinenum':_0x4d1829['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x4d1829[_0x6f52('0x1a')],'transfereraccountcode':_0x4d1829['origtransfereraccountcode'],'transferercontext':_0x4d1829[_0x6f52('0x1b')],'transfererexten':_0x4d1829[_0x6f52('0x1c')],'transfererlinkedid':_0x4d1829[_0x6f52('0x1d')],'transfereechannel':_0x4d1829[_0x6f52('0x1e')],'transfereecalleridnum':_0x4d1829[_0x6f52('0x1f')],'transfereecalleridname':_0x4d1829[_0x6f52('0x20')],'transfereeconnectedlinenum':_0x4d1829['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x4d1829[_0x6f52('0x21')],'transfereeaccountcode':_0x4d1829['transfertargetaccountcode'],'transfereecontext':_0x4d1829['transfertargetcontext'],'transfereeexten':_0x4d1829[_0x6f52('0x22')],'transfereelinkedid':_0x4d1829[_0x6f52('0x23')],'isexternal':_0x4d1829['isexternal'],'context':_0x4d1829[_0x6f52('0x24')],'extension':_0x4d1829[_0x6f52('0x25')],'type':_0x6f52('0x26')},'log':_0x6f52('0x3')});}; \ No newline at end of file +var _0xde22=['origtransfererexten','../client','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereelinkedid','isexternal','context','attendedTransfer','Request','origtransfererchannel','origtransferercalleridnum','secondtransferercontext','secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid'];(function(_0x221ebf,_0x5aacde){var _0x218db2=function(_0x53f99d){while(--_0x53f99d){_0x221ebf['push'](_0x221ebf['shift']());}};_0x218db2(++_0x5aacde);}(_0xde22,0x111));var _0x2de2=function(_0x2863e9,_0x3c96a4){_0x2863e9=_0x2863e9-0x0;var _0x2d2754=_0xde22[_0x2863e9];return _0x2d2754;};'use strict';var client=require(_0x2de2('0x0'));exports['blindTransfer']=function(_0x9799b7){return client['Request'](_0x2de2('0x1'),{'body':{'result':_0x9799b7['result'],'transfererchannel':_0x9799b7[_0x2de2('0x2')],'transferercalleridnum':_0x9799b7[_0x2de2('0x3')],'transferercalleridname':_0x9799b7[_0x2de2('0x4')],'transfererconnectedlinenum':_0x9799b7[_0x2de2('0x5')],'transfererconnectedlinename':_0x9799b7['transfererconnectedlinename'],'transfereraccountcode':_0x9799b7[_0x2de2('0x6')],'transferercontext':_0x9799b7[_0x2de2('0x7')],'transfererexten':_0x9799b7[_0x2de2('0x8')],'transfererlinkedid':_0x9799b7[_0x2de2('0x9')],'transfereechannel':_0x9799b7[_0x2de2('0xa')],'transfereecalleridnum':_0x9799b7['transfereecalleridnum'],'transfereecalleridname':_0x9799b7[_0x2de2('0xb')],'transfereeconnectedlinenum':_0x9799b7[_0x2de2('0xc')],'transfereeconnectedlinename':_0x9799b7[_0x2de2('0xd')],'transfereeaccountcode':_0x9799b7[_0x2de2('0xe')],'transfereecontext':_0x9799b7[_0x2de2('0xf')],'transfereeexten':_0x9799b7['transfereeexten'],'transfereelinkedid':_0x9799b7[_0x2de2('0x10')],'isexternal':_0x9799b7[_0x2de2('0x11')],'context':_0x9799b7[_0x2de2('0x12')],'extension':_0x9799b7['extension'],'type':'blind'},'log':_0x2de2('0x1')});};exports[_0x2de2('0x13')]=function(_0x1e1d2c){return client[_0x2de2('0x14')](_0x2de2('0x1'),{'body':{'result':_0x1e1d2c['result'],'transfererchannel':_0x1e1d2c[_0x2de2('0x15')],'transferercalleridnum':_0x1e1d2c[_0x2de2('0x16')],'transferercalleridname':_0x1e1d2c['origtransferercalleridname'],'transfererconnectedlinenum':_0x1e1d2c['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x1e1d2c['secondtransfererconnectedlinename'],'transfereraccountcode':_0x1e1d2c['origtransfereraccountcode'],'transferercontext':_0x1e1d2c[_0x2de2('0x17')],'transfererexten':_0x1e1d2c[_0x2de2('0x18')],'transfererlinkedid':_0x1e1d2c['origtransfererlinkedid'],'transfereechannel':_0x1e1d2c[_0x2de2('0x19')],'transfereecalleridnum':_0x1e1d2c[_0x2de2('0x1a')],'transfereecalleridname':_0x1e1d2c[_0x2de2('0x1b')],'transfereeconnectedlinenum':_0x1e1d2c[_0x2de2('0x1c')],'transfereeconnectedlinename':_0x1e1d2c[_0x2de2('0x1d')],'transfereeaccountcode':_0x1e1d2c[_0x2de2('0x1e')],'transfereecontext':_0x1e1d2c['transfertargetcontext'],'transfereeexten':_0x1e1d2c[_0x2de2('0x1f')],'transfereelinkedid':_0x1e1d2c[_0x2de2('0x20')],'isexternal':_0x1e1d2c[_0x2de2('0x11')],'context':_0x1e1d2c['origtransferercontext'],'extension':_0x1e1d2c[_0x2de2('0x21')],'type':'attended'},'log':'CreateVoiceTransferReport'});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 82a9340..8ed8cdc 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 _0x0e05=['event','Event\x20name\x20mandatory','custom:','faxAccounts','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','pause','QueuePause','error','asterisk','ami\x20disconnected','join','pick','action','Reload','message','isConnected','Command','content','catch','voiceQueues','strategy','answered','available','loggedIn','sumBillable','sumHoldTime','total','type','unmanaged','abandoned','waiting','loggedInDb','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','channels','length','voicechannel','map','find','uniqueid','channel','%s.%s','filename','wav','Action','MixMonitor','ai(mixmonitorid)','toLowerCase','isNil','monitors','/var/spool/asterisk/monitor/','mixmonitorid','status','MixMonitor\x20Success','username','then','destinationchannel','StopMixMonitor','stop','Channel\x20doesn\x27t\x20exist','values','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','outboundChannels','campaigns','run'];(function(_0x224a54,_0x3e8341){var _0x35c5ff=function(_0x5a680d){while(--_0x5a680d){_0x224a54['push'](_0x224a54['shift']());}};_0x35c5ff(++_0x3e8341);}(_0x0e05,0x18f));var _0x50e0=function(_0x5cd86e,_0x3db8d1){_0x5cd86e=_0x5cd86e-0x0;var _0x5dbce7=_0x0e05[_0x5cd86e];return _0x5dbce7;};'use strict';var _=require(_0x50e0('0x0'));var util=require(_0x50e0('0x1'));var jayson=require(_0x50e0('0x2'));var schema=require(_0x50e0('0x3'));var BPromise=require('bluebird');var moment=require('moment');var config=require(_0x50e0('0x4'));var properties=require(_0x50e0('0x5'));var ami=require(_0x50e0('0x6'));exports[_0x50e0('0x7')]=function(_0x4ff4ae,_0xaeb5ac,_0x27580c){return new BPromise(function(_0x40dd49,_0x2875a7){var _0x559e96={'QueuePause':function(_0x422626){return new Promise(function(_0x4cbfaf,_0x1a2f8e){var _0x22f8fb=util[_0x50e0('0x8')](_0x50e0('0x9'),_0x50e0('0xa'),_0x422626[_0x50e0('0xb')]);if(_0x4ff4ae['timers']&&_0x4ff4ae[_0x50e0('0xc')][_0x22f8fb]&&_0x4ff4ae[_0x50e0('0xc')][_0x22f8fb][_0x50e0('0xd')]){_0x4ff4ae['timers'][_0x22f8fb][_0x50e0('0xe')]();}if(_0x4ff4ae[_0x50e0('0xf')][_0x22f8fb]){_0x4ff4ae[_0x50e0('0xf')][_0x22f8fb]['updateStatusRealtime']({'statePause':_0x422626[_0x50e0('0x10')]?!![]:![]});}_0x4cbfaf({'code':0xc8,'message':_0x50e0('0x11')});});},'Reload':function(_0x833a39){var _0x26d05b=this;return new Promise(function(_0x12dd82,_0x2ac66b){if(ami['isConnected']()==![]){return _0x2ac66b(_0x26d05b[_0x50e0('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x50e0('0x13')]['username'],_0x50e0('0x14')][_0x50e0('0x15')]('\x20')));}_0x833a39=_[_0x50e0('0x16')](_0x833a39,_['keys'](properties['module']));_0x833a39[_0x50e0('0x17')]=_0x50e0('0x18');return ami['Action'](_0x833a39)['then'](function(_0x3d47f7){_0x12dd82({'code':0xc8,'message':_0x3d47f7[_0x50e0('0x19')]});})['catch'](function(_0x1f7e1d){_0x2ac66b(_0x26d05b[_0x50e0('0x12')](0x1f5,_0x1f7e1d[_0x50e0('0x19')]));});});},'Command':function(_0x47b771){var _0x18deef=this;return new Promise(function(_0x2afa47,_0x23007c){if(ami[_0x50e0('0x1a')]()==![]){return _0x23007c(_0x18deef[_0x50e0('0x12')](0x1f4,[config[_0x50e0('0x13')]['ip'],config[_0x50e0('0x13')]['username'],'ami\x20disconnected']['join']('\x20')));}_0x47b771=_[_0x50e0('0x16')](_0x47b771,'command');_0x47b771[_0x50e0('0x17')]=_0x50e0('0x1b');return ami['Action'](_0x47b771)['then'](function(_0x6b4bae){_0x2afa47({'code':0xc8,'message':_0x6b4bae[_0x50e0('0x1c')]});})[_0x50e0('0x1d')](function(_0x4324c8){_0x23007c(_0x18deef[_0x50e0('0x12')](0x1f5,_0x4324c8[_0x50e0('0x19')]));});});},'VoiceQueues':function(_0x376b79){return new Promise(function(_0xdd0cd5,_0x1575fc){var _0x2e13b3=[];for(var _0x52cb5c in _0x4ff4ae[_0x50e0('0x1e')]){if(_0x4ff4ae[_0x50e0('0x1e')]['hasOwnProperty'](_0x52cb5c)){var _0x164ca9=_0x4ff4ae[_0x50e0('0x1e')][_0x52cb5c];var _0x5541c1={'id':_0x164ca9['id'],'name':_0x164ca9['name'],'strategy':_0x164ca9[_0x50e0('0x1f')],'answered':_0x164ca9[_0x50e0('0x20')],'available':_0x164ca9[_0x50e0('0x21')],'loggedIn':_0x164ca9[_0x50e0('0x22')],'pTalking':_0x164ca9['pTalking'],'sumBillable':_0x164ca9[_0x50e0('0x23')],'sumDuration':_0x164ca9['sumDuration'],'sumHoldTime':_0x164ca9[_0x50e0('0x24')]||0x0,'talking':_0x164ca9['talking'],'total':_0x164ca9[_0x50e0('0x25')],'type':_0x164ca9[_0x50e0('0x26')],'unmanaged':_0x164ca9[_0x50e0('0x27')],'abandoned':_0x164ca9[_0x50e0('0x28')],'waiting':_0x164ca9[_0x50e0('0x29')],'loggedInDb':_0x164ca9[_0x50e0('0x2a')]};if(_0x164ca9[_0x50e0('0x26')]===_0x50e0('0x2b')){_0x5541c1[_0x50e0('0x2c')]=_0x164ca9[_0x50e0('0x2c')];_0x5541c1[_0x50e0('0x2d')]=_0x164ca9['dialMethod'];_0x5541c1[_0x50e0('0x2e')]=_0x164ca9[_0x50e0('0x2e')];_0x5541c1[_0x50e0('0x2f')]=_0x164ca9[_0x50e0('0x2f')];_0x5541c1['dialOriginateTimeout']=_0x164ca9[_0x50e0('0x30')];_0x5541c1['dialPrefix']=_0x164ca9[_0x50e0('0x31')];_0x5541c1[_0x50e0('0x32')]=_0x164ca9[_0x50e0('0x32')];_0x5541c1[_0x50e0('0x33')]=_0x164ca9[_0x50e0('0x33')];_0x5541c1[_0x50e0('0x34')]=_0x164ca9[_0x50e0('0x34')];_0x5541c1[_0x50e0('0x35')]=_0x164ca9[_0x50e0('0x35')];_0x5541c1[_0x50e0('0x36')]=_0x164ca9['outboundCongestionCallsDay'];_0x5541c1[_0x50e0('0x37')]=_0x164ca9[_0x50e0('0x37')];_0x5541c1['outboundDropCallsDayCallersExit']=_0x164ca9[_0x50e0('0x38')];_0x5541c1[_0x50e0('0x39')]=_0x164ca9[_0x50e0('0x39')];_0x5541c1[_0x50e0('0x3a')]=_0x164ca9['outboundNoAnswerCallsDay'];_0x5541c1['outboundNoSuchCallsDay']=_0x164ca9[_0x50e0('0x3b')];_0x5541c1['outboundOriginateFailureCallsDay']=_0x164ca9[_0x50e0('0x3c')];_0x5541c1[_0x50e0('0x3d')]=_0x164ca9[_0x50e0('0x3d')];_0x5541c1[_0x50e0('0x3e')]=_0x164ca9[_0x50e0('0x3e')];_0x5541c1[_0x50e0('0x3f')]=_0x164ca9['outboundUnknownCallsDay'];_0x5541c1['predictiveIntervalAnsweredCalls']=_0x164ca9['predictiveIntervalAnsweredCalls'];_0x5541c1[_0x50e0('0x40')]=_0x164ca9['predictiveIntervalAvgHoldtime'];_0x5541c1[_0x50e0('0x41')]=_0x164ca9[_0x50e0('0x41')];_0x5541c1[_0x50e0('0x42')]=_0x164ca9[_0x50e0('0x42')];_0x5541c1[_0x50e0('0x43')]=_0x164ca9['predictiveIntervalDroppedCallsTimeout'];_0x5541c1[_0x50e0('0x44')]=_0x164ca9[_0x50e0('0x44')];_0x5541c1['predictiveIntervalErlangCallsDroppedCalls']=_0x164ca9[_0x50e0('0x45')];_0x5541c1[_0x50e0('0x46')]=_0x164ca9[_0x50e0('0x46')];_0x5541c1[_0x50e0('0x47')]=_0x164ca9[_0x50e0('0x47')];_0x5541c1['predictiveIntervalPauses']=_0x164ca9[_0x50e0('0x48')];_0x5541c1[_0x50e0('0x49')]=_0x164ca9[_0x50e0('0x49')];_0x5541c1['predictiveIntervalTotalCalls']=_0x164ca9['predictiveIntervalTotalCalls'];_0x5541c1[_0x50e0('0x19')]=_0x164ca9[_0x50e0('0x19')];_0x5541c1['originated']=_0x164ca9[_0x50e0('0x4a')];_0x5541c1[_0x50e0('0x4b')]=_0x164ca9['erlangCalls'];_0x5541c1[_0x50e0('0x4c')]=_0x164ca9[_0x50e0('0x4c')];_0x5541c1[_0x50e0('0x4d')]=_0x164ca9[_0x50e0('0x4d')];_0x5541c1[_0x50e0('0x4e')]=_0x164ca9[_0x50e0('0x4e')];_0x5541c1[_0x50e0('0x4f')]=_0x164ca9[_0x50e0('0x4f')];_0x5541c1[_0x50e0('0x50')]=_0x164ca9[_0x50e0('0x50')];}if(_0x164ca9[_0x50e0('0x51')]){_0x5541c1[_0x50e0('0x51')]={'id':_0x164ca9[_0x50e0('0x51')]['id'],'name':_0x164ca9[_0x50e0('0x51')][_0x50e0('0xb')],'active':_0x164ca9[_0x50e0('0x51')][_0x50e0('0x52')],'callerid':_0x164ca9['Trunk'][_0x50e0('0x53')]};}if(_0x164ca9[_0x50e0('0x54')]){_0x5541c1[_0x50e0('0x54')]={'id':_0x164ca9['Interval']['id'],'name':_0x164ca9['Interval'][_0x50e0('0xb')]};}_0x2e13b3[_0x50e0('0x55')](_0x5541c1);}}_0xdd0cd5({'count':_0x2e13b3['length'],'rows':_0x2e13b3});});},'VoiceChannels':function(_0x1a234d){return new Promise(function(_0x20dd7d,_0x12ff31){var _0x4e727c=_['values'](_0x4ff4ae[_0x50e0('0x56')]);_0x20dd7d({'count':_0x4e727c[_0x50e0('0x57')],'rows':_0x4e727c});});},'VoiceChannelMixMonitor':function(_0x1c790e){var _0x33ad39=this;return new Promise(function(_0x2f4e5a,_0x2d4b98){if(ami['isConnected']()==![]){return _0x2d4b98(_0x33ad39[_0x50e0('0x12')](0x1f4,[config[_0x50e0('0x13')]['ip'],config[_0x50e0('0x13')]['username'],'ami\x20disconnected'][_0x50e0('0x15')]('\x20')));}var _0x59a918=schema(properties[_0x50e0('0x58')])['validate'](_0x1c790e);if(_0x59a918['length']>0x0){return _0x2d4b98(_0x33ad39['error'](0x1f4,_[_0x50e0('0x59')](_0x59a918,_0x50e0('0x19'))['join'](',\x20')));}var _0x447e4b=_[_0x50e0('0x5a')](_0x4ff4ae[_0x50e0('0x56')],{'uniqueid':_0x1c790e[_0x50e0('0x5b')]});if(_0x447e4b&&_0x447e4b[_0x50e0('0x5c')]){var _0x33c0e8=util[_0x50e0('0x8')](_0x50e0('0x5d'),_0x1c790e[_0x50e0('0x5e')]||_0x1c790e[_0x50e0('0x5b')],_0x1c790e[_0x50e0('0x8')]||_0x50e0('0x5f'));return ami[_0x50e0('0x60')]({'action':_0x50e0('0x61'),'channel':_0x447e4b['channel'],'file':_0x33c0e8,'options':_0x50e0('0x62')})['then'](function(_0x28ecb1){var _0x1ab984=_['find'](_0x447e4b['monitors'],{'filename':'/var/spool/asterisk/monitor/'+_0x33c0e8[_0x50e0('0x63')]()});if(_[_0x50e0('0x64')](_0x1ab984)){_0x447e4b[_0x50e0('0x65')][_0x50e0('0x55')]({'filename':_0x50e0('0x66')+_0x33c0e8['toLowerCase'](),'createdAt':moment()[_0x50e0('0x8')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x28ecb1[_0x50e0('0x67')],'status':'rec'});}else{_0x1ab984[_0x50e0('0x67')]=_0x28ecb1['mixmonitorid'];_0x1ab984[_0x50e0('0x68')]='rec';}_0x2f4e5a({'code':0xc8,'message':[_0x1c790e[_0x50e0('0x5b')],_0x50e0('0x69'),_0x28ecb1[_0x50e0('0x67')]]['join']('\x20'),'mixmonitorid':_0x28ecb1[_0x50e0('0x67')]});})['catch'](function(_0x32b136){_0x2d4b98(_0x33ad39[_0x50e0('0x12')](0x1f5,[_0x1c790e[_0x50e0('0x5b')],_0x32b136[_0x50e0('0x19')][_0x50e0('0x63')]()][_0x50e0('0x15')]('\x20')));});}else{return _0x2d4b98(_0x33ad39['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x33df95){var _0x14fdf8=this;return new Promise(function(_0x581a1b,_0xd890e6){if(ami[_0x50e0('0x1a')]()==![]){return _0xd890e6(_0x14fdf8[_0x50e0('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x50e0('0x6a')],_0x50e0('0x14')][_0x50e0('0x15')]('\x20')));}var _0x14ea9f=schema(properties[_0x50e0('0x58')])[_0x50e0('0x3')](_0x33df95);if(_0x14ea9f[_0x50e0('0x57')]>0x0){return _0xd890e6(_0x14fdf8['error'](0x1f4,_[_0x50e0('0x59')](_0x14ea9f,_0x50e0('0x19'))[_0x50e0('0x15')](',\x20')));}var _0x59fe32=_[_0x50e0('0x5a')](_0x4ff4ae[_0x50e0('0x56')],{'uniqueid':_0x33df95[_0x50e0('0x5b')]});if(_0x59fe32){return BPromise['resolve']()[_0x50e0('0x6b')](function(){if(_0x59fe32[_0x50e0('0x5c')]){return ami[_0x50e0('0x60')]({'action':'StopMixMonitor','channel':_0x59fe32[_0x50e0('0x5c')],'mixmonitorid':_0x33df95[_0x50e0('0x67')]})[_0x50e0('0x1d')](function(_0x130ef6){});}})['then'](function(){if(_0x59fe32[_0x50e0('0x6c')]){return ami[_0x50e0('0x60')]({'action':_0x50e0('0x6d'),'channel':_0x59fe32[_0x50e0('0x6c')],'mixmonitorid':_0x33df95[_0x50e0('0x67')]})[_0x50e0('0x1d')](function(_0x42f00d){});}})['then'](function(_0x49a7b4){var _0x3bf6d9=_[_0x50e0('0x5a')](_0x59fe32[_0x50e0('0x65')],{'mixmonitorid':_0x33df95[_0x50e0('0x67')]});if(_0x3bf6d9){_0x3bf6d9[_0x50e0('0x68')]=_0x50e0('0x6e');}})[_0x50e0('0x6b')](function(){var _0x38b277=util[_0x50e0('0x8')]('%s.%s',_0x33df95[_0x50e0('0x5e')]||_0x33df95[_0x50e0('0x5b')],_0x33df95[_0x50e0('0x8')]||'wav');var _0x1bd457=_['find'](_0x59fe32[_0x50e0('0x65')],{'filename':_0x50e0('0x66')+_0x38b277[_0x50e0('0x63')]()});if(_0x1bd457){_0x1bd457[_0x50e0('0x68')]=_0x50e0('0x6e');}})[_0x50e0('0x6b')](function(){_0x581a1b({'code':0xc8,'message':[_0x33df95[_0x50e0('0x5b')],'StopMixMonitor\x20Success'][_0x50e0('0x15')]('\x20')});})['catch'](function(_0x320c6b){_0xd890e6(_0x14fdf8[_0x50e0('0x12')](0x1f5,[_0x33df95['uniqueid'],_0x320c6b['message'][_0x50e0('0x63')]()][_0x50e0('0x15')]('\x20')));});}else{return _0xd890e6(_0x14fdf8[_0x50e0('0x12')](0x1f5,_0x50e0('0x6f')));}});},'VoiceQueuesChannels':function(_0x583102){return new Promise(function(_0x658d55,_0x4fc0f5){var _0x1ba0a9=_[_0x50e0('0x70')](_0x4ff4ae[_0x50e0('0x71')]);_0x658d55({'count':_0x1ba0a9['length'],'rows':_0x1ba0a9});});},'VoiceQueuesChannel':function(_0x15e394){var _0x540b3d=this;return new Promise(function(_0x4c5a95,_0x1335fa){var _0x41a23f=schema(properties[_0x50e0('0x72')])[_0x50e0('0x3')](_0x15e394);if(_0x41a23f[_0x50e0('0x57')]>0x0){return _0x1335fa(_0x540b3d['error'](0x1f4,_[_0x50e0('0x59')](_0x41a23f,_0x50e0('0x19'))[_0x50e0('0x15')](',\x20')));}var _0x547a18=_['find'](_0x4ff4ae[_0x50e0('0x71')],{'uniqueid':_0x15e394[_0x50e0('0x5b')]});if(_0x547a18){_0x4c5a95(_0x547a18);}else{return _0x1335fa(_0x540b3d[_0x50e0('0x12')](0x1f5,_0x50e0('0x6f')));}});},'VoiceQueuesChannelHangup':function(_0xb9eb1a){var _0x4736b4=this;return new Promise(function(_0x4c99a2,_0x4bb452){if(ami[_0x50e0('0x1a')]()==![]){return _0x4bb452(_0x4736b4[_0x50e0('0x12')](0x1f4,[config[_0x50e0('0x13')]['ip'],config[_0x50e0('0x13')][_0x50e0('0x6a')],_0x50e0('0x14')]['join']('\x20')));}var _0x513e3f=schema(properties[_0x50e0('0x73')])['validate'](_0xb9eb1a);if(_0x513e3f[_0x50e0('0x57')]>0x0){return _0x4bb452(_0x4736b4[_0x50e0('0x12')](0x1f4,_['map'](_0x513e3f,_0x50e0('0x19'))[_0x50e0('0x15')](',\x20')));}var _0x552c61=_['find'](_0x4ff4ae[_0x50e0('0x71')],{'uniqueid':_0xb9eb1a[_0x50e0('0x5b')]});if(_0x552c61&&_0x552c61['channel']){return ami[_0x50e0('0x60')]({'action':_0x50e0('0x74'),'channel':_0x552c61[_0x50e0('0x5c')]})[_0x50e0('0x6b')](function(_0x5d8dea){_0x4c99a2({'code':0xc8,'message':[_0xb9eb1a['uniqueid'],_0x5d8dea[_0x50e0('0x19')]['toLowerCase']()][_0x50e0('0x15')]('\x20')});})[_0x50e0('0x1d')](function(_0xbbde3b){_0x4bb452(_0x4736b4[_0x50e0('0x12')](0x1f5,[_0xb9eb1a[_0x50e0('0x5b')],_0xbbde3b[_0x50e0('0x19')][_0x50e0('0x63')]()][_0x50e0('0x15')]('\x20')));});}else{return _0x4bb452(_0x4736b4['error'](0x1f5,_0x50e0('0x6f')));}});},'VoiceQueuesChannelRedirect':function(_0x3064b2){var _0x3cd208=this;return new Promise(function(_0x622f1,_0xaa10d3){if(ami['isConnected']()==![]){return _0xaa10d3(_0x3cd208[_0x50e0('0x12')](0x1f4,[config[_0x50e0('0x13')]['ip'],config[_0x50e0('0x13')]['username'],_0x50e0('0x14')][_0x50e0('0x15')]('\x20')));}var _0xb4f084=schema(properties[_0x50e0('0x75')])[_0x50e0('0x3')](_0x3064b2);if(_0xb4f084[_0x50e0('0x57')]>0x0){return _0xaa10d3(_0x3cd208[_0x50e0('0x12')](0x1f4,_[_0x50e0('0x59')](_0xb4f084,_0x50e0('0x19'))[_0x50e0('0x15')](',\x20')));}var _0x1d437e=_[_0x50e0('0x5a')](_0x4ff4ae[_0x50e0('0x71')],{'uniqueid':_0x3064b2[_0x50e0('0x5b')]});if(_0x1d437e&&_0x1d437e[_0x50e0('0x5c')]){return ami[_0x50e0('0x60')]({'action':_0x50e0('0x76'),'channel':_0x1d437e[_0x50e0('0x5c')],'exten':_0x3064b2[_0x50e0('0x77')],'context':_0x3064b2[_0x50e0('0x78')]||_0x1d437e[_0x50e0('0x78')],'priority':0x1})[_0x50e0('0x6b')](function(_0x10fbb0){_0x622f1({'code':0xc8,'message':[_0x3064b2[_0x50e0('0x5b')],_0x10fbb0[_0x50e0('0x19')][_0x50e0('0x63')]()][_0x50e0('0x15')]('\x20')});})[_0x50e0('0x1d')](function(_0x425e3c){_0xaa10d3(_0x3cd208[_0x50e0('0x12')](0x1f5,[_0x3064b2['uniqueid'],_0x425e3c[_0x50e0('0x19')][_0x50e0('0x63')]()][_0x50e0('0x15')]('\x20')));});}else{return _0xaa10d3(_0x3cd208['error'](0x1f5,_0x50e0('0x6f')));}});},'Agents':function(_0x4c6f48){return new Promise(function(_0x3c96ef,_0x4b4b2c){var _0x3b5d28=_[_0x50e0('0x70')](_0x4ff4ae[_0x50e0('0xf')]);_0x3c96ef({'count':_0x3b5d28['length'],'rows':_0x3b5d28});});},'Telephones':function(_0x54c48e){return new Promise(function(_0x176b69,_0x50a86b){var _0x4d7b41=_[_0x50e0('0x70')](_0x4ff4ae[_0x50e0('0x79')]);_0x176b69({'count':_0x4d7b41[_0x50e0('0x57')],'rows':_0x4d7b41});});},'Trunks':function(_0x802e60){return new Promise(function(_0x1bf0a3,_0x41dec9){var _0x41b50b=_[_0x50e0('0x70')](_0x4ff4ae['trunks']);_0x1bf0a3({'count':_0x41b50b[_0x50e0('0x57')],'rows':_0x41b50b});});},'OutboundChannels':function(_0x444311){return new Promise(function(_0x14a243,_0x3fdd9b){var _0x42325d=_[_0x50e0('0x70')](_0x4ff4ae[_0x50e0('0x7a')]);_0x14a243({'count':_0x42325d['length'],'rows':_0x42325d});});},'Outbound':function(_0x5eeee0){return new Promise(function(_0x57e09a,_0xa243de){_0x57e09a(_0x4ff4ae['outbound']);});},'Campaigns':function(_0x2ff678){return new Promise(function(_0x371e33,_0x61aa79){var _0x5cbe4f=_[_0x50e0('0x70')](_0x4ff4ae[_0x50e0('0x7b')]);_0x371e33({'count':_0x5cbe4f['length'],'rows':_0x5cbe4f});});},'VoiceQueuesPreview':function(_0x567881){var _0x352da5=this;return new Promise(function(_0x3f7a4d,_0x4364fa){_0xaeb5ac[_0x50e0('0x7c')](_0x567881['id'])[_0x50e0('0x6b')](function(_0x42d5fc){_0x3f7a4d({'code':0xc8,'message':_0x42d5fc[_0x50e0('0x19')]});})[_0x50e0('0x1d')](function(_0x4574a6){_0x4364fa(_0x352da5[_0x50e0('0x12')](0x1f4,_0x4574a6[_0x50e0('0x19')]));});});},'EventManager':function(_0x2766f9){var _0x3d577f=this;return new Promise(function(_0x159e9a,_0x174286){if(!_0x2766f9[_0x50e0('0x7d')]){return _0x174286(_0x3d577f[_0x50e0('0x12')](0x1f4,_0x50e0('0x7e')));}ami['emit'](_0x50e0('0x7f')+_0x2766f9[_0x50e0('0x7d')],_0x2766f9[_0x50e0('0x19')]);_0x159e9a({'code':0xc8,'message':_0x2766f9});});},'FaxAccounts':function(_0x4fe478){return new Promise(function(_0x407dde,_0xc79bf4){var _0x2fbb68=_['values'](_0x4ff4ae[_0x50e0('0x80')]);_0x407dde({'count':_0x2fbb68[_0x50e0('0x57')],'rows':_0x2fbb68});});},'SendFax':function(_0x398288){var _0x5920db=this;return new Promise(function(_0x4421f5,_0x2e9e58){_0x27580c['send'](_0x398288)[_0x50e0('0x6b')](function(_0x11aa2e){_0x4421f5({'code':0xc8,'message':_0x11aa2e[_0x50e0('0x19')]});})[_0x50e0('0x1d')](function(_0x5e9866){_0x2e9e58(_0x5920db[_0x50e0('0x12')](0x1f4,_0x5e9866[_0x50e0('0x19')]));});});},'CheckAfterSend':function(_0x2b83a6){var _0x3fcc09=this;return new Promise(function(_0x3e4a67,_0x68e6cb){_0x27580c['checkAfterSend'](_0x2b83a6)[_0x50e0('0x6b')](function(_0x38612d){_0x3e4a67({'code':0xc8,'message':_0x38612d['message']});})[_0x50e0('0x1d')](function(_0x2be572){_0x68e6cb(_0x3fcc09['error'](0x1f4,_0x2be572[_0x50e0('0x19')]));});});}};var _0x474f73=jayson['server'](_0x559e96)['http']();_0x474f73['on'](_0x50e0('0x12'),function(_0x5bcb64){return _0x2875a7(_0x5bcb64);});_0x474f73['listen'](0x232a,_0x50e0('0x81'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x40dd49(_0x50e0('0x82')+0x232a);});});}; \ No newline at end of file +var _0x5259=['MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','isNil','/var/spool/asterisk/monitor/','rec','mixmonitorid','status','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','find','resolve','StopMixMonitor','destinationchannel','stop','queueChannels','voicequeuechannel','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','send','server','http','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','../../../config/environment','../properties','../ami','listen','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','isConnected','error','asterisk','ami\x20disconnected','join','pick','keys','module','action','Action','then','message','catch','username','command','Command','voiceQueues','hasOwnProperty','strategy','answered','available','pTalking','sumHoldTime','abandoned','loggedInDb','type','outbound','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','push','length','values','channels','voicechannel','map','channel','format','%s.%s','filename','uniqueid','wav'];(function(_0x16b75f,_0x386ca4){var _0x31764e=function(_0x3eeed7){while(--_0x3eeed7){_0x16b75f['push'](_0x16b75f['shift']());}};_0x31764e(++_0x386ca4);}(_0x5259,0x1c5));var _0x9525=function(_0x164ad8,_0x424b53){_0x164ad8=_0x164ad8-0x0;var _0x2ffa73=_0x5259[_0x164ad8];return _0x2ffa73;};'use strict';var _=require(_0x9525('0x0'));var util=require('util');var jayson=require(_0x9525('0x1'));var schema=require(_0x9525('0x2'));var BPromise=require(_0x9525('0x3'));var moment=require('moment');var config=require(_0x9525('0x4'));var properties=require(_0x9525('0x5'));var ami=require(_0x9525('0x6'));exports[_0x9525('0x7')]=function(_0x1caee2,_0x417faa,_0x34dfb9){return new BPromise(function(_0x36e7a0,_0x3278c7){var _0x22cb48={'QueuePause':function(_0x4f42f7){return new Promise(function(_0x1687c3,_0x3015d1){var _0x3c39c2=util['format'](_0x9525('0x8'),_0x9525('0x9'),_0x4f42f7[_0x9525('0xa')]);if(_0x1caee2[_0x9525('0xb')]&&_0x1caee2['timers'][_0x3c39c2]&&_0x1caee2['timers'][_0x3c39c2][_0x9525('0xc')]){_0x1caee2[_0x9525('0xb')][_0x3c39c2][_0x9525('0xd')]();}if(_0x1caee2['agents'][_0x3c39c2]){_0x1caee2[_0x9525('0xe')][_0x3c39c2][_0x9525('0xf')]({'statePause':_0x4f42f7['pause']?!![]:![]});}_0x1687c3({'code':0xc8,'message':_0x9525('0x10')});});},'Reload':function(_0x358ff9){var _0x13f507=this;return new Promise(function(_0x3eb46a,_0x113d64){if(ami[_0x9525('0x11')]()==![]){return _0x113d64(_0x13f507[_0x9525('0x12')](0x1f4,[config[_0x9525('0x13')]['ip'],config[_0x9525('0x13')]['username'],_0x9525('0x14')][_0x9525('0x15')]('\x20')));}_0x358ff9=_[_0x9525('0x16')](_0x358ff9,_[_0x9525('0x17')](properties[_0x9525('0x18')]));_0x358ff9[_0x9525('0x19')]='Reload';return ami[_0x9525('0x1a')](_0x358ff9)[_0x9525('0x1b')](function(_0x1d6e96){_0x3eb46a({'code':0xc8,'message':_0x1d6e96[_0x9525('0x1c')]});})[_0x9525('0x1d')](function(_0x1070ac){_0x113d64(_0x13f507[_0x9525('0x12')](0x1f5,_0x1070ac[_0x9525('0x1c')]));});});},'Command':function(_0x15656d){var _0x155acc=this;return new Promise(function(_0x164a4b,_0x34713c){if(ami[_0x9525('0x11')]()==![]){return _0x34713c(_0x155acc[_0x9525('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x9525('0x13')][_0x9525('0x1e')],'ami\x20disconnected'][_0x9525('0x15')]('\x20')));}_0x15656d=_[_0x9525('0x16')](_0x15656d,_0x9525('0x1f'));_0x15656d[_0x9525('0x19')]=_0x9525('0x20');return ami[_0x9525('0x1a')](_0x15656d)[_0x9525('0x1b')](function(_0x2684ae){_0x164a4b({'code':0xc8,'message':_0x2684ae['content']});})['catch'](function(_0x42dd62){_0x34713c(_0x155acc[_0x9525('0x12')](0x1f5,_0x42dd62[_0x9525('0x1c')]));});});},'VoiceQueues':function(_0x3a696a){return new Promise(function(_0x54ec3d,_0x3aea57){var _0x203941=[];for(var _0x16c65d in _0x1caee2[_0x9525('0x21')]){if(_0x1caee2[_0x9525('0x21')][_0x9525('0x22')](_0x16c65d)){var _0x3844e4=_0x1caee2[_0x9525('0x21')][_0x16c65d];var _0x268983={'id':_0x3844e4['id'],'name':_0x3844e4[_0x9525('0xa')],'strategy':_0x3844e4[_0x9525('0x23')],'answered':_0x3844e4[_0x9525('0x24')],'available':_0x3844e4[_0x9525('0x25')],'loggedIn':_0x3844e4['loggedIn'],'pTalking':_0x3844e4[_0x9525('0x26')],'sumBillable':_0x3844e4['sumBillable'],'sumDuration':_0x3844e4['sumDuration'],'sumHoldTime':_0x3844e4[_0x9525('0x27')]||0x0,'talking':_0x3844e4['talking'],'total':_0x3844e4['total'],'type':_0x3844e4['type'],'unmanaged':_0x3844e4['unmanaged'],'abandoned':_0x3844e4[_0x9525('0x28')],'waiting':_0x3844e4['waiting'],'loggedInDb':_0x3844e4[_0x9525('0x29')]};if(_0x3844e4[_0x9525('0x2a')]===_0x9525('0x2b')){_0x268983[_0x9525('0x2c')]=_0x3844e4[_0x9525('0x2c')];_0x268983['dialMethod']=_0x3844e4[_0x9525('0x2d')];_0x268983[_0x9525('0x2e')]=_0x3844e4[_0x9525('0x2e')];_0x268983[_0x9525('0x2f')]=_0x3844e4[_0x9525('0x2f')];_0x268983[_0x9525('0x30')]=_0x3844e4[_0x9525('0x30')];_0x268983['dialPrefix']=_0x3844e4[_0x9525('0x31')];_0x268983[_0x9525('0x32')]=_0x3844e4[_0x9525('0x32')];_0x268983[_0x9525('0x33')]=_0x3844e4[_0x9525('0x33')];_0x268983[_0x9525('0x34')]=_0x3844e4[_0x9525('0x34')];_0x268983[_0x9525('0x35')]=_0x3844e4[_0x9525('0x35')];_0x268983[_0x9525('0x36')]=_0x3844e4[_0x9525('0x36')];_0x268983['outboundDropCallsDayACS']=_0x3844e4[_0x9525('0x37')];_0x268983['outboundDropCallsDayCallersExit']=_0x3844e4[_0x9525('0x38')];_0x268983[_0x9525('0x39')]=_0x3844e4[_0x9525('0x39')];_0x268983[_0x9525('0x3a')]=_0x3844e4[_0x9525('0x3a')];_0x268983[_0x9525('0x3b')]=_0x3844e4[_0x9525('0x3b')];_0x268983[_0x9525('0x3c')]=_0x3844e4[_0x9525('0x3c')];_0x268983[_0x9525('0x3d')]=_0x3844e4[_0x9525('0x3d')];_0x268983[_0x9525('0x3e')]=_0x3844e4[_0x9525('0x3e')];_0x268983[_0x9525('0x3f')]=_0x3844e4[_0x9525('0x3f')];_0x268983[_0x9525('0x40')]=_0x3844e4[_0x9525('0x40')];_0x268983[_0x9525('0x41')]=_0x3844e4[_0x9525('0x41')];_0x268983['predictiveIntervalAvgTalktime']=_0x3844e4[_0x9525('0x42')];_0x268983['predictiveIntervalDroppedCallsCallersExit']=_0x3844e4[_0x9525('0x43')];_0x268983[_0x9525('0x44')]=_0x3844e4[_0x9525('0x44')];_0x268983['predictiveIntervalErlangCalls']=_0x3844e4[_0x9525('0x45')];_0x268983[_0x9525('0x46')]=_0x3844e4[_0x9525('0x46')];_0x268983['predictiveIntervalHitRate']=_0x3844e4[_0x9525('0x47')];_0x268983[_0x9525('0x48')]=_0x3844e4[_0x9525('0x48')];_0x268983['predictiveIntervalPauses']=_0x3844e4[_0x9525('0x49')];_0x268983['predictiveIntervalAvailable']=_0x3844e4[_0x9525('0x4a')];_0x268983['predictiveIntervalTotalCalls']=_0x3844e4[_0x9525('0x4b')];_0x268983[_0x9525('0x1c')]=_0x3844e4[_0x9525('0x1c')];_0x268983[_0x9525('0x4c')]=_0x3844e4[_0x9525('0x4c')];_0x268983[_0x9525('0x4d')]=_0x3844e4[_0x9525('0x4d')];_0x268983[_0x9525('0x4e')]=_0x3844e4[_0x9525('0x4e')];_0x268983[_0x9525('0x4f')]=_0x3844e4['erlangAbandonmentRate'];_0x268983[_0x9525('0x50')]=_0x3844e4[_0x9525('0x50')];_0x268983[_0x9525('0x51')]=_0x3844e4[_0x9525('0x51')];_0x268983[_0x9525('0x52')]=_0x3844e4[_0x9525('0x52')];}if(_0x3844e4['Trunk']){_0x268983['Trunk']={'id':_0x3844e4[_0x9525('0x53')]['id'],'name':_0x3844e4[_0x9525('0x53')][_0x9525('0xa')],'active':_0x3844e4['Trunk'][_0x9525('0x54')],'callerid':_0x3844e4[_0x9525('0x53')][_0x9525('0x55')]};}if(_0x3844e4[_0x9525('0x56')]){_0x268983[_0x9525('0x56')]={'id':_0x3844e4[_0x9525('0x56')]['id'],'name':_0x3844e4[_0x9525('0x56')]['name']};}_0x203941[_0x9525('0x57')](_0x268983);}}_0x54ec3d({'count':_0x203941[_0x9525('0x58')],'rows':_0x203941});});},'VoiceChannels':function(_0x1fe3df){return new Promise(function(_0x3e2765,_0x13ecbf){var _0x23a31c=_[_0x9525('0x59')](_0x1caee2[_0x9525('0x5a')]);_0x3e2765({'count':_0x23a31c['length'],'rows':_0x23a31c});});},'VoiceChannelMixMonitor':function(_0x152222){var _0x5acccd=this;return new Promise(function(_0x46bfd7,_0x2a2c55){if(ami['isConnected']()==![]){return _0x2a2c55(_0x5acccd[_0x9525('0x12')](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0x9525('0x1e')],_0x9525('0x14')][_0x9525('0x15')]('\x20')));}var _0x19e770=schema(properties[_0x9525('0x5b')])[_0x9525('0x2')](_0x152222);if(_0x19e770['length']>0x0){return _0x2a2c55(_0x5acccd[_0x9525('0x12')](0x1f4,_[_0x9525('0x5c')](_0x19e770,_0x9525('0x1c'))[_0x9525('0x15')](',\x20')));}var _0x2fb3db=_['find'](_0x1caee2[_0x9525('0x5a')],{'uniqueid':_0x152222['uniqueid']});if(_0x2fb3db&&_0x2fb3db[_0x9525('0x5d')]){var _0x53fc6f=util[_0x9525('0x5e')](_0x9525('0x5f'),_0x152222[_0x9525('0x60')]||_0x152222[_0x9525('0x61')],_0x152222[_0x9525('0x5e')]||_0x9525('0x62'));return ami[_0x9525('0x1a')]({'action':_0x9525('0x63'),'channel':_0x2fb3db[_0x9525('0x5d')],'file':_0x53fc6f,'options':_0x9525('0x64')})['then'](function(_0x5cc9e2){var _0x21cc6a=_['find'](_0x2fb3db[_0x9525('0x65')],{'filename':'/var/spool/asterisk/monitor/'+_0x53fc6f[_0x9525('0x66')]()});if(_[_0x9525('0x67')](_0x21cc6a)){_0x2fb3db['monitors'][_0x9525('0x57')]({'filename':_0x9525('0x68')+_0x53fc6f[_0x9525('0x66')](),'createdAt':moment()[_0x9525('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':_0x5cc9e2['mixmonitorid'],'status':_0x9525('0x69')});}else{_0x21cc6a[_0x9525('0x6a')]=_0x5cc9e2['mixmonitorid'];_0x21cc6a[_0x9525('0x6b')]=_0x9525('0x69');}_0x46bfd7({'code':0xc8,'message':[_0x152222['uniqueid'],_0x9525('0x6c'),_0x5cc9e2[_0x9525('0x6a')]][_0x9525('0x15')]('\x20'),'mixmonitorid':_0x5cc9e2['mixmonitorid']});})[_0x9525('0x1d')](function(_0x5edae9){_0x2a2c55(_0x5acccd[_0x9525('0x12')](0x1f5,[_0x152222['uniqueid'],_0x5edae9['message'][_0x9525('0x66')]()][_0x9525('0x15')]('\x20')));});}else{return _0x2a2c55(_0x5acccd[_0x9525('0x12')](0x1f5,_0x9525('0x6d')));}});},'VoiceChannelStopMixMonitor':function(_0x1d2af3){var _0x3db778=this;return new Promise(function(_0x75450,_0xf16332){if(ami['isConnected']()==![]){return _0xf16332(_0x3db778[_0x9525('0x12')](0x1f4,[config[_0x9525('0x13')]['ip'],config[_0x9525('0x13')]['username'],_0x9525('0x14')][_0x9525('0x15')]('\x20')));}var _0x4755e5=schema(properties[_0x9525('0x5b')])[_0x9525('0x2')](_0x1d2af3);if(_0x4755e5[_0x9525('0x58')]>0x0){return _0xf16332(_0x3db778[_0x9525('0x12')](0x1f4,_[_0x9525('0x5c')](_0x4755e5,_0x9525('0x1c'))[_0x9525('0x15')](',\x20')));}var _0x13c9f7=_[_0x9525('0x6e')](_0x1caee2[_0x9525('0x5a')],{'uniqueid':_0x1d2af3['uniqueid']});if(_0x13c9f7){return BPromise[_0x9525('0x6f')]()[_0x9525('0x1b')](function(){if(_0x13c9f7[_0x9525('0x5d')]){return ami[_0x9525('0x1a')]({'action':_0x9525('0x70'),'channel':_0x13c9f7[_0x9525('0x5d')],'mixmonitorid':_0x1d2af3[_0x9525('0x6a')]})[_0x9525('0x1d')](function(_0x14081){});}})[_0x9525('0x1b')](function(){if(_0x13c9f7[_0x9525('0x71')]){return ami['Action']({'action':_0x9525('0x70'),'channel':_0x13c9f7[_0x9525('0x71')],'mixmonitorid':_0x1d2af3[_0x9525('0x6a')]})[_0x9525('0x1d')](function(_0x2d669b){});}})[_0x9525('0x1b')](function(_0x9be6a){var _0x5da7d5=_[_0x9525('0x6e')](_0x13c9f7['monitors'],{'mixmonitorid':_0x1d2af3[_0x9525('0x6a')]});if(_0x5da7d5){_0x5da7d5[_0x9525('0x6b')]='stop';}})['then'](function(){var _0x51c365=util[_0x9525('0x5e')](_0x9525('0x5f'),_0x1d2af3[_0x9525('0x60')]||_0x1d2af3[_0x9525('0x61')],_0x1d2af3['format']||'wav');var _0x231b8a=_[_0x9525('0x6e')](_0x13c9f7[_0x9525('0x65')],{'filename':_0x9525('0x68')+_0x51c365['toLowerCase']()});if(_0x231b8a){_0x231b8a[_0x9525('0x6b')]=_0x9525('0x72');}})[_0x9525('0x1b')](function(){_0x75450({'code':0xc8,'message':[_0x1d2af3['uniqueid'],'StopMixMonitor\x20Success']['join']('\x20')});})[_0x9525('0x1d')](function(_0x4bd3d8){_0xf16332(_0x3db778['error'](0x1f5,[_0x1d2af3[_0x9525('0x61')],_0x4bd3d8[_0x9525('0x1c')][_0x9525('0x66')]()]['join']('\x20')));});}else{return _0xf16332(_0x3db778[_0x9525('0x12')](0x1f5,_0x9525('0x6d')));}});},'VoiceQueuesChannels':function(_0x343b6c){return new Promise(function(_0x329a96,_0x52c2b3){var _0x4c148b=_['values'](_0x1caee2[_0x9525('0x73')]);_0x329a96({'count':_0x4c148b[_0x9525('0x58')],'rows':_0x4c148b});});},'VoiceQueuesChannel':function(_0x191b47){var _0x4e8775=this;return new Promise(function(_0x67330,_0x3f9791){var _0x4c65bf=schema(properties[_0x9525('0x74')])['validate'](_0x191b47);if(_0x4c65bf['length']>0x0){return _0x3f9791(_0x4e8775['error'](0x1f4,_[_0x9525('0x5c')](_0x4c65bf,_0x9525('0x1c'))['join'](',\x20')));}var _0x10a2a3=_['find'](_0x1caee2['queueChannels'],{'uniqueid':_0x191b47[_0x9525('0x61')]});if(_0x10a2a3){_0x67330(_0x10a2a3);}else{return _0x3f9791(_0x4e8775[_0x9525('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x11ecda){var _0x2f3518=this;return new Promise(function(_0x4f9cd8,_0x5f42d5){if(ami[_0x9525('0x11')]()==![]){return _0x5f42d5(_0x2f3518[_0x9525('0x12')](0x1f4,[config[_0x9525('0x13')]['ip'],config[_0x9525('0x13')][_0x9525('0x1e')],_0x9525('0x14')][_0x9525('0x15')]('\x20')));}var _0x1ad7bb=schema(properties[_0x9525('0x75')])[_0x9525('0x2')](_0x11ecda);if(_0x1ad7bb[_0x9525('0x58')]>0x0){return _0x5f42d5(_0x2f3518[_0x9525('0x12')](0x1f4,_[_0x9525('0x5c')](_0x1ad7bb,_0x9525('0x1c'))[_0x9525('0x15')](',\x20')));}var _0x11141b=_[_0x9525('0x6e')](_0x1caee2[_0x9525('0x73')],{'uniqueid':_0x11ecda[_0x9525('0x61')]});if(_0x11141b&&_0x11141b[_0x9525('0x5d')]){return ami[_0x9525('0x1a')]({'action':_0x9525('0x76'),'channel':_0x11141b['channel']})[_0x9525('0x1b')](function(_0x1011aa){_0x4f9cd8({'code':0xc8,'message':[_0x11ecda[_0x9525('0x61')],_0x1011aa[_0x9525('0x1c')][_0x9525('0x66')]()][_0x9525('0x15')]('\x20')});})[_0x9525('0x1d')](function(_0x99852c){_0x5f42d5(_0x2f3518[_0x9525('0x12')](0x1f5,[_0x11ecda[_0x9525('0x61')],_0x99852c[_0x9525('0x1c')][_0x9525('0x66')]()]['join']('\x20')));});}else{return _0x5f42d5(_0x2f3518['error'](0x1f5,_0x9525('0x6d')));}});},'VoiceQueuesChannelRedirect':function(_0x26d0e5){var _0x1bc4f7=this;return new Promise(function(_0x1a096a,_0x22fe73){if(ami['isConnected']()==![]){return _0x22fe73(_0x1bc4f7[_0x9525('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x9525('0x13')][_0x9525('0x1e')],'ami\x20disconnected'][_0x9525('0x15')]('\x20')));}var _0x581521=schema(properties[_0x9525('0x77')])[_0x9525('0x2')](_0x26d0e5);if(_0x581521[_0x9525('0x58')]>0x0){return _0x22fe73(_0x1bc4f7[_0x9525('0x12')](0x1f4,_[_0x9525('0x5c')](_0x581521,_0x9525('0x1c'))[_0x9525('0x15')](',\x20')));}var _0x386219=_[_0x9525('0x6e')](_0x1caee2[_0x9525('0x73')],{'uniqueid':_0x26d0e5[_0x9525('0x61')]});if(_0x386219&&_0x386219[_0x9525('0x5d')]){return ami[_0x9525('0x1a')]({'action':_0x9525('0x78'),'channel':_0x386219[_0x9525('0x5d')],'exten':_0x26d0e5[_0x9525('0x79')],'context':_0x26d0e5[_0x9525('0x7a')]||_0x386219['context'],'priority':0x1})[_0x9525('0x1b')](function(_0x38e1fe){_0x1a096a({'code':0xc8,'message':[_0x26d0e5[_0x9525('0x61')],_0x38e1fe[_0x9525('0x1c')][_0x9525('0x66')]()][_0x9525('0x15')]('\x20')});})[_0x9525('0x1d')](function(_0x8d35cd){_0x22fe73(_0x1bc4f7[_0x9525('0x12')](0x1f5,[_0x26d0e5['uniqueid'],_0x8d35cd[_0x9525('0x1c')][_0x9525('0x66')]()][_0x9525('0x15')]('\x20')));});}else{return _0x22fe73(_0x1bc4f7[_0x9525('0x12')](0x1f5,_0x9525('0x6d')));}});},'Agents':function(_0x16da72){return new Promise(function(_0x3cbf4f,_0x29c7b0){var _0x4b9e9d=_[_0x9525('0x59')](_0x1caee2[_0x9525('0xe')]);_0x3cbf4f({'count':_0x4b9e9d['length'],'rows':_0x4b9e9d});});},'Telephones':function(_0x6e940){return new Promise(function(_0x560dd7,_0x14e300){var _0x4ed4e9=_[_0x9525('0x59')](_0x1caee2['telephones']);_0x560dd7({'count':_0x4ed4e9[_0x9525('0x58')],'rows':_0x4ed4e9});});},'Trunks':function(_0x49aa29){return new Promise(function(_0x5d2981,_0x5ea319){var _0x53ab26=_[_0x9525('0x59')](_0x1caee2[_0x9525('0x7b')]);_0x5d2981({'count':_0x53ab26[_0x9525('0x58')],'rows':_0x53ab26});});},'OutboundChannels':function(_0x306b1f){return new Promise(function(_0x18818f,_0x346487){var _0x576030=_['values'](_0x1caee2[_0x9525('0x7c')]);_0x18818f({'count':_0x576030[_0x9525('0x58')],'rows':_0x576030});});},'Outbound':function(_0x314122){return new Promise(function(_0x28cf61,_0x494cbe){_0x28cf61(_0x1caee2[_0x9525('0x2b')]);});},'Campaigns':function(_0x441765){return new Promise(function(_0x5a8ca9,_0x10882c){var _0x1f277a=_['values'](_0x1caee2[_0x9525('0x7d')]);_0x5a8ca9({'count':_0x1f277a[_0x9525('0x58')],'rows':_0x1f277a});});},'VoiceQueuesPreview':function(_0x5130ff){var _0x5bf1eb=this;return new Promise(function(_0x523082,_0x55ba65){_0x417faa[_0x9525('0x7e')](_0x5130ff['id'])[_0x9525('0x1b')](function(_0x29c6d0){_0x523082({'code':0xc8,'message':_0x29c6d0[_0x9525('0x1c')]});})[_0x9525('0x1d')](function(_0x3aafd6){_0x55ba65(_0x5bf1eb[_0x9525('0x12')](0x1f4,_0x3aafd6['message']));});});},'EventManager':function(_0x14704c){var _0xf90f50=this;return new Promise(function(_0x248ab6,_0x217d1d){if(!_0x14704c['event']){return _0x217d1d(_0xf90f50[_0x9525('0x12')](0x1f4,_0x9525('0x7f')));}ami[_0x9525('0x80')](_0x9525('0x81')+_0x14704c[_0x9525('0x82')],_0x14704c[_0x9525('0x1c')]);_0x248ab6({'code':0xc8,'message':_0x14704c});});},'FaxAccounts':function(_0x1f6ffb){return new Promise(function(_0x371c6e,_0x53965e){var _0x16b4e2=_[_0x9525('0x59')](_0x1caee2[_0x9525('0x83')]);_0x371c6e({'count':_0x16b4e2['length'],'rows':_0x16b4e2});});},'SendFax':function(_0x56628f){var _0x1deb18=this;return new Promise(function(_0x564029,_0x361b71){_0x34dfb9[_0x9525('0x84')](_0x56628f)['then'](function(_0x1342c6){_0x564029({'code':0xc8,'message':_0x1342c6[_0x9525('0x1c')]});})[_0x9525('0x1d')](function(_0x4a7aa8){_0x361b71(_0x1deb18[_0x9525('0x12')](0x1f4,_0x4a7aa8[_0x9525('0x1c')]));});});},'CheckAfterSend':function(_0x8da32a){var _0x11c2f2=this;return new Promise(function(_0x38ec0e,_0x4f2040){_0x34dfb9['checkAfterSend'](_0x8da32a)[_0x9525('0x1b')](function(_0x5e084b){_0x38ec0e({'code':0xc8,'message':_0x5e084b[_0x9525('0x1c')]});})['catch'](function(_0x10c9b7){_0x4f2040(_0x11c2f2[_0x9525('0x12')](0x1f4,_0x10c9b7[_0x9525('0x1c')]));});});}};var _0xfffbea=jayson[_0x9525('0x85')](_0x22cb48)[_0x9525('0x86')]();_0xfffbea['on'](_0x9525('0x12'),function(_0x20f686){return _0x3278c7(_0x20f686);});_0xfffbea[_0x9525('0x7')](0x232a,'127.0.0.1',function(){console[_0x9525('0x87')](_0x9525('0x88'),0x232a);return _0x36e7a0(_0x9525('0x89')+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 88353db..19fb081 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 _0xb982=['stringify','exec','data2','data1','calleridnum','routeId','calleridname','','uniqueid','destcalleridname','destcalleridnum','phone','resolve','then','showContact','xmd-contactid2','name','format','trigger:%s','toLowerCase','merge','createContact','user:%s','action','catch','error','lodash','ioredis','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','localhost','info'];(function(_0x42bafd,_0x3f0fe3){var _0x2ed705=function(_0x4311ea){while(--_0x4311ea){_0x42bafd['push'](_0x42bafd['shift']());}};_0x2ed705(++_0x3f0fe3);}(_0xb982,0x15e));var _0x2b98=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb982[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require('bluebird');var util=require('util');var _=require(_0x2b98('0x0'));var Redis=require(_0x2b98('0x1'));var config=require(_0x2b98('0x2'));var logger=require(_0x2b98('0x3'))(_0x2b98('0x4'));var cmContactRpc=require(_0x2b98('0x5'));config[_0x2b98('0x6')]=_[_0x2b98('0x7')](config[_0x2b98('0x6')],{'host':_0x2b98('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x2b98('0x6')]));function emit(_0x1166cb,_0x15ee91,_0x4626ad){logger[_0x2b98('0x9')](_0x1166cb,_0x15ee91,JSON[_0x2b98('0xa')](_0x4626ad));io['to'](_0x1166cb)['emit'](_0x15ee91,_0x4626ad);}exports[_0x2b98('0xb')]=function(_0x4c64b5,_0x4c5377,_0x8e30c5){_0x8e30c5['autoCreate']=0x0;if(_0x4c5377[_0x2b98('0xc')]&&parseInt(_0x4c5377[_0x2b98('0xc')],0xa)){var _0x457b35={'ListId':parseInt(_0x4c5377[_0x2b98('0xd')],0xa),'phone':_0x8e30c5[_0x2b98('0xe')]};if(_['isNil'](_0x8e30c5[_0x2b98('0xf')])){_0x457b35['firstName']=_0x8e30c5[_0x2b98('0x10')]&&_0x8e30c5[_0x2b98('0x10')]!==_0x2b98('0x11')?_0x8e30c5[_0x2b98('0x10')]:_0x8e30c5[_0x2b98('0xe')]||_0x8e30c5[_0x2b98('0x12')];}else{_0x457b35['firstName']=_0x8e30c5[_0x2b98('0x13')]&&_0x8e30c5[_0x2b98('0x13')]!==_0x2b98('0x11')?_0x8e30c5[_0x2b98('0x13')]:_0x8e30c5[_0x2b98('0x14')]||_0x8e30c5[_0x2b98('0x12')];_0x457b35[_0x2b98('0x15')]=_0x8e30c5['destcalleridname']&&_0x8e30c5[_0x2b98('0x13')]!==_0x2b98('0x11')?_0x8e30c5['destcalleridname']:_0x8e30c5[_0x2b98('0x14')]||_0x8e30c5['uniqueid'];}BPromise[_0x2b98('0x16')]()[_0x2b98('0x17')](cmContactRpc[_0x2b98('0x18')]({'where':_['omit'](_0x457b35,['firstName'])}))['then'](function(_0x4751d3){if(_0x4751d3){_0x8e30c5[_0x2b98('0x19')]=_0x4751d3['id'];emit(util['format']('user:%s',_0x4c64b5[_0x2b98('0x1a')]),util[_0x2b98('0x1b')](_0x2b98('0x1c'),_0x4c5377['action'][_0x2b98('0x1d')]()),_[_0x2b98('0x1e')](_0x8e30c5,{'ListId':parseInt(_0x4c5377[_0x2b98('0xd')],0xa)}));return;}else{return BPromise[_0x2b98('0x16')]()[_0x2b98('0x17')](cmContactRpc[_0x2b98('0x1f')](_0x457b35));}})['then'](function(_0x543a20){if(_0x543a20){_0x8e30c5[_0x2b98('0x19')]=_0x543a20['id'];emit(util[_0x2b98('0x1b')](_0x2b98('0x20'),_0x4c64b5[_0x2b98('0x1a')]),util[_0x2b98('0x1b')](_0x2b98('0x1c'),_0x4c5377[_0x2b98('0x21')][_0x2b98('0x1d')]()),_[_0x2b98('0x1e')](_0x8e30c5,{'ListId':parseInt(_0x4c5377[_0x2b98('0xd')],0xa)}));}})[_0x2b98('0x22')](function(_0x112d71){logger[_0x2b98('0x23')]('Error\x20creating\x20contact',JSON[_0x2b98('0xa')](_0x112d71));});}else{if(_0x4c64b5){emit(util['format']('user:%s',_0x4c64b5[_0x2b98('0x1a')]),util['format'](_0x2b98('0x1c'),_0x4c5377[_0x2b98('0x21')][_0x2b98('0x1d')]()),_['merge']({'ListId':parseInt(_0x4c5377['data1'],0xa)},_0x8e30c5));}}}; \ No newline at end of file +var _0x9134=['calleridnum','routeId','calleridname','','firstName','destcalleridname','destcalleridnum','uniqueid','phone','resolve','then','omit','xmd-contactid2','name','trigger:%s','action','merge','createContact','format','toLowerCase','catch','error','Error\x20creating\x20contact','user:%s','util','lodash','ioredis','../../../../config/environment','../../rpc/cmContact','redis','defaults','localhost','socket.io-emitter','stringify','emit','data2','data1'];(function(_0x17b0d4,_0x377add){var _0x2d02c7=function(_0x56e627){while(--_0x56e627){_0x17b0d4['push'](_0x17b0d4['shift']());}};_0x2d02c7(++_0x377add);}(_0x9134,0x87));var _0x4913=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9134[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require('bluebird');var util=require(_0x4913('0x0'));var _=require(_0x4913('0x1'));var Redis=require(_0x4913('0x2'));var config=require(_0x4913('0x3'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require(_0x4913('0x4'));config[_0x4913('0x5')]=_[_0x4913('0x6')](config[_0x4913('0x5')],{'host':_0x4913('0x7'),'port':0x18eb});var io=require(_0x4913('0x8'))(new Redis(config['redis']));function emit(_0x46e307,_0x177977,_0x16ab4f){logger['info'](_0x46e307,_0x177977,JSON[_0x4913('0x9')](_0x16ab4f));io['to'](_0x46e307)[_0x4913('0xa')](_0x177977,_0x16ab4f);}exports['exec']=function(_0x536f95,_0x4d9eb2,_0xae5842){_0xae5842['autoCreate']=0x0;if(_0x4d9eb2[_0x4913('0xb')]&&parseInt(_0x4d9eb2[_0x4913('0xb')],0xa)){var _0x27c27f={'ListId':parseInt(_0x4d9eb2[_0x4913('0xc')],0xa),'phone':_0xae5842[_0x4913('0xd')]};if(_['isNil'](_0xae5842[_0x4913('0xe')])){_0x27c27f['firstName']=_0xae5842[_0x4913('0xf')]&&_0xae5842['calleridname']!==_0x4913('0x10')?_0xae5842[_0x4913('0xf')]:_0xae5842[_0x4913('0xd')]||_0xae5842['uniqueid'];}else{_0x27c27f[_0x4913('0x11')]=_0xae5842[_0x4913('0x12')]&&_0xae5842['destcalleridname']!==''?_0xae5842[_0x4913('0x12')]:_0xae5842[_0x4913('0x13')]||_0xae5842[_0x4913('0x14')];_0x27c27f[_0x4913('0x15')]=_0xae5842['destcalleridname']&&_0xae5842[_0x4913('0x12')]!==_0x4913('0x10')?_0xae5842['destcalleridname']:_0xae5842[_0x4913('0x13')]||_0xae5842['uniqueid'];}BPromise[_0x4913('0x16')]()[_0x4913('0x17')](cmContactRpc['showContact']({'where':_[_0x4913('0x18')](_0x27c27f,['firstName'])}))[_0x4913('0x17')](function(_0x1371fc){if(_0x1371fc){_0xae5842[_0x4913('0x19')]=_0x1371fc['id'];emit(util['format']('user:%s',_0x536f95[_0x4913('0x1a')]),util['format'](_0x4913('0x1b'),_0x4d9eb2[_0x4913('0x1c')]['toLowerCase']()),_[_0x4913('0x1d')](_0xae5842,{'ListId':parseInt(_0x4d9eb2[_0x4913('0xc')],0xa)}));return;}else{return BPromise[_0x4913('0x16')]()[_0x4913('0x17')](cmContactRpc[_0x4913('0x1e')](_0x27c27f));}})[_0x4913('0x17')](function(_0x3dbf4e){if(_0x3dbf4e){_0xae5842['xmd-contactid2']=_0x3dbf4e['id'];emit(util[_0x4913('0x1f')]('user:%s',_0x536f95[_0x4913('0x1a')]),util[_0x4913('0x1f')](_0x4913('0x1b'),_0x4d9eb2[_0x4913('0x1c')][_0x4913('0x20')]()),_[_0x4913('0x1d')](_0xae5842,{'ListId':parseInt(_0x4d9eb2[_0x4913('0xc')],0xa)}));}})[_0x4913('0x21')](function(_0x203ba7){logger[_0x4913('0x22')](_0x4913('0x23'),JSON[_0x4913('0x9')](_0x203ba7));});}else{if(_0x536f95){emit(util['format'](_0x4913('0x24'),_0x536f95[_0x4913('0x1a')]),util['format'](_0x4913('0x1b'),_0x4d9eb2[_0x4913('0x1c')]['toLowerCase']()),_['merge']({'ListId':parseInt(_0x4d9eb2[_0x4913('0xc')],0xa)},_0xae5842));}}}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f156b89..59223de 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 _0xf3c8=['hasOwnProperty','status','checkTrigger','merge','variables','length','Actions','action','contactmanager','motionbar','browser','data1','TemplateId','data2','html','template\x20not\x20found','uri','isNil','data3','data4','uriLocation','windowWidth','data5','windowHeight','data6','render','winArguments','user:%s','interface','name','trigger:%s:%s','format','trigger:%s','toLowerCase','exec','integration','queue','routeId','urlforward','buildUri','parse','query','search','replace','AllConditions','checkConditions','channel','some','AnyConditions','chat','ChatWebsiteId','operator','upperFirst','AccountId','value','message','event','agent','membername','exports','util','url','mustache','./integration','./script','../rpc/cmContact','../../../config/logger','trigger','../ami','redis','defaults','socket.io-emitter','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','bind','custom:agentconnect','syncCustomEvent','custom:agentringnoanswer','custom:agentcomplete','custom:dialbegin','syncAgentDial','custom:newinteraction','custom:closedinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','emit','stringify','prototype','clone','checkTriggers'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf3c8,0x114));var _0x8f3c=function(_0x9dec18,_0x5171c3){_0x9dec18=_0x9dec18-0x0;var _0xfbf485=_0xf3c8[_0x9dec18];return _0xfbf485;};'use strict';var util=require(_0x8f3c('0x0'));var _=require('lodash');var url=require(_0x8f3c('0x1'));var Mustache=require(_0x8f3c('0x2'));var Redis=require('ioredis');var urlforward=require('./urlforward');var integration=require(_0x8f3c('0x3'));var cmContact=require('./cmContact');var script=require(_0x8f3c('0x4'));var cmContactRpc=require(_0x8f3c('0x5'));var config=require('../../../config/environment');var logger=require(_0x8f3c('0x6'))(_0x8f3c('0x7'));var ami=require(_0x8f3c('0x8'));config[_0x8f3c('0x9')]=_[_0x8f3c('0xa')](config[_0x8f3c('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x8f3c('0xb'))(new Redis(config[_0x8f3c('0x9')]));var operators={'equals':function(_0x14dc85,_0x22ff9b){return _0x14dc85==_0x22ff9b;},'not_equals':function(_0xc2fd25,_0x27edc7){return _0xc2fd25!=_0x27edc7;}};var barAndWebActions=[_0x8f3c('0xc'),'url',_0x8f3c('0xd')];function Trigger(_0x3ff99d){this[_0x8f3c('0xe')]=_0x3ff99d['triggers'];this[_0x8f3c('0xf')]=_0x3ff99d[_0x8f3c('0xf')];this[_0x8f3c('0x10')]=_0x3ff99d[_0x8f3c('0x10')];this['templates']=_0x3ff99d[_0x8f3c('0x11')];this[_0x8f3c('0x12')]=_0x3ff99d[_0x8f3c('0x12')];this['zendeskAccounts']=_0x3ff99d['zendeskAccounts'];this[_0x8f3c('0x13')]=_0x3ff99d[_0x8f3c('0x13')];this[_0x8f3c('0x14')]=_0x3ff99d['salesforceAccounts'];this[_0x8f3c('0x15')]=_0x3ff99d[_0x8f3c('0x15')];this[_0x8f3c('0x16')]=_0x3ff99d['zohoAccounts'];this[_0x8f3c('0x17')]=_0x3ff99d[_0x8f3c('0x17')];this[_0x8f3c('0x18')]=_0x3ff99d[_0x8f3c('0x18')];this[_0x8f3c('0x19')]=_0x3ff99d[_0x8f3c('0x19')];this[_0x8f3c('0x1a')]=_0x3ff99d[_0x8f3c('0x1a')];this[_0x8f3c('0x1b')]=_0x3ff99d['freshsalesAccounts'];this[_0x8f3c('0x1c')]={'zendesk':this['zendeskAccounts'],'salesforce':this['salesforceAccounts'],'freshdesk':this[_0x8f3c('0x13')],'sugarcrm':this[_0x8f3c('0x15')],'zoho':this[_0x8f3c('0x16')],'desk':this['deskAccounts'],'vtiger':this['vtigerAccounts'],'dynamics365':this[_0x8f3c('0x1a')],'freshsales':this['freshsalesAccounts'],'servicenow':this[_0x8f3c('0x19')]};ami['on'](_0x8f3c('0x1d'),this['syncCustomEvent'][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x1f'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x21'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x22'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on']('custom:queuecallerabandon',this['syncCustomEvent'][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x23'),this[_0x8f3c('0x24')]['bind'](this));ami['on']('custom:dialconnect',this['syncAgentDial'][_0x8f3c('0x1e')](this));ami['on']('custom:dialend',this[_0x8f3c('0x24')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x25'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x26'),this[_0x8f3c('0x20')]['bind'](this));ami['on'](_0x8f3c('0x27'),this['syncCustomEvent'][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x28'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x29'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));ami['on'](_0x8f3c('0x2a'),this[_0x8f3c('0x20')][_0x8f3c('0x1e')](this));}Trigger['prototype'][_0x8f3c('0x2b')]=function(_0x59ae20,_0x1c06c7,_0x2bc650){logger['info'](_0x59ae20,_0x1c06c7,JSON[_0x8f3c('0x2c')](_0x2bc650));io['to'](_0x59ae20)[_0x8f3c('0x2b')](_0x1c06c7,_0x2bc650);};Trigger[_0x8f3c('0x2d')]['syncCustomEvent']=function(_0x246709){var _0x42b675=_[_0x8f3c('0x2e')](_0x246709);this[_0x8f3c('0x2f')](_0x42b675);};Trigger[_0x8f3c('0x2d')][_0x8f3c('0x24')]=function(_0x50811a){if(this[_0x8f3c('0xf')][_0x50811a['interface']]){this[_0x8f3c('0x20')](_0x50811a);}};Trigger[_0x8f3c('0x2d')]['checkTriggers']=function(_0x3de46b){var _0x2e2a65;for(var _0x41735d in this['triggers']){if(this[_0x8f3c('0xe')][_0x8f3c('0x30')](_0x41735d)){if(this[_0x8f3c('0xe')][_0x41735d][_0x8f3c('0x31')]){_0x2e2a65=this[_0x8f3c('0x32')](this[_0x8f3c('0xe')][_0x41735d],_0x3de46b);if(_0x2e2a65){_[_0x8f3c('0x33')](_0x3de46b,_0x3de46b[_0x8f3c('0x34')]);for(var _0x22be49=0x0,_0x43d248,_0xadfb64,_0x1e1872;_0x22be490x0){_0x4f1fc8=_['map'](_0x21a473,_0x27b358);}return _0x4f1fc8;}function getCustomFields(_0x221602,_0x9bac28){var _0xc497ce=[];var _0x20b87d={'custom_fields':{}};if(_0x221602[_0x2d4a('0x27')]>0x0){_[_0x2d4a('0x28')](_0x221602,function(_0x25ac5c){if(_0x25ac5c[_0x2d4a('0x29')]==='string'&&_0x25ac5c[_0x2d4a('0x2a')]&&!_0x25ac5c[_0x2d4a('0x2b')]){_0x20b87d[_0x25ac5c[_0x2d4a('0x2a')][_0x2d4a('0x2c')]()]=_0x25ac5c[_0x2d4a('0x2d')]['toString']();}else if(_0x25ac5c[_0x2d4a('0x29')]===_0x2d4a('0x2e')&&_0x25ac5c[_0x2d4a('0x2f')]&&_0x25ac5c[_0x2d4a('0x2b')]){_0x20b87d[_0x2d4a('0x30')][_0x25ac5c['idField']]=_0x25ac5c[_0x2d4a('0x2d')][_0x2d4a('0x1f')]();}else if(_0x25ac5c[_0x2d4a('0x29')]===_0x2d4a('0x31')&&_0x25ac5c[_0x2d4a('0x32')]&&_0x25ac5c[_0x2d4a('0x2f')]&&_0x25ac5c['customField']){_0x9bac28[_0x25ac5c[_0x2d4a('0x32')]]&&(_0x20b87d[_0x2d4a('0x30')][_0x25ac5c[_0x2d4a('0x2f')]]=_0x9bac28[_0x25ac5c[_0x2d4a('0x32')]][_0x2d4a('0x1f')]());}else if(_0x25ac5c['type']===_0x2d4a('0x33')&&_0x25ac5c[_0x2d4a('0x34')]&&_0x25ac5c['Variable'][_0x2d4a('0x35')]&&_0x25ac5c[_0x2d4a('0x2f')]&&_0x25ac5c[_0x2d4a('0x2b')]){_0x9bac28[_0x25ac5c[_0x2d4a('0x34')][_0x2d4a('0x35')][_0x2d4a('0x2c')]()]&&(_0x20b87d['custom_fields'][_0x25ac5c[_0x2d4a('0x2f')]]=_0x9bac28[_0x25ac5c[_0x2d4a('0x34')][_0x2d4a('0x35')][_0x2d4a('0x2c')]()][_0x2d4a('0x1f')]());}});}if(_0x20b87d[_0x2d4a('0x36')]){_0x20b87d['priority']=Number(_0x20b87d['priority']);}return _0x20b87d;}function getTicket(_0x393762,_0x4b833b,_0x6e0716,_0x309e33,_0x5aeae4){logger[_0x2d4a('0xb')](_0x2d4a('0x37'));var _0x8e1bea=_[_0x2d4a('0x38')]({'subject':intUtil[_0x2d4a('0x39')](_0x309e33[_0x2d4a('0x3a')],_0x5aeae4,'\x20'),'type':_0x2d4a('0x3b'),'status':_0x2d4a('0x3c'),'labels':[_0x2d4a('0x3d'),_0x2d4a('0x3e'),_0x2d4a('0x3f')]['concat'](getTags(_0x309e33[_0x2d4a('0x40')],_0x2d4a('0x35'))),'description':intUtil[_0x2d4a('0x39')](_0x309e33[_0x2d4a('0x41')],_0x5aeae4,'\x0a'),'_links':{'assigned_user':{'href':util[_0x2d4a('0xd')]('/api/v2/users/%d',_0x4b833b['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x309e33['Descriptions'],_0x5aeae4,'\x0a')}},getCustomFields(_0x309e33[_0x2d4a('0x42')],_0x5aeae4));return request({'uri':util[_0x2d4a('0xd')](_0x2d4a('0x43'),_0x393762[_0x2d4a('0x14')],_0x6e0716['id']),'method':'POST','body':_0x8e1bea});}exports[_0x2d4a('0x44')]=function(_0x3df6b4,_0x5e9704,_0x189d2a,_0x13b0f0,_0x8a9375,_0x13970c){var _0x1ad852,_0x2c91e1;_0x13970c['remoteUri']=intUtil[_0x2d4a('0x45')](_0x13970c[_0x2d4a('0x14')]);_0x13970c[_0x2d4a('0x46')]=intUtil[_0x2d4a('0x45')](_0x13970c[_0x2d4a('0x46')]);if(_0x8a9375&&_0x8a9375[_0x2d4a('0x47')]){logger['info'](_0x2d4a('0x48'),_0x2d4a('0x49'));_0x5e9704[_0x2d4a('0x4a')]=util['format'](_0x2d4a('0x4b'),_0x13970c['serverUrl'],_0x5e9704[_0x2d4a('0x4c')],md5(_0x5e9704[_0x2d4a('0x4c')]));}else{_0x5e9704[_0x2d4a('0x4a')]='';}headers[_0x2d4a('0x4d')]=getAuth(_0x13970c);return getUser(_0x13970c,_0x13b0f0[_0x2d4a('0x4e')])['then'](function(_0x5d481c){_0x1ad852=_0x5d481c;logger[_0x2d4a('0xb')](_0x2d4a('0x4f'),_0x1ad852['id']);return getEndUser(_0x13970c,_0x5e9704['calleridname'],_0x5e9704[_0x2d4a('0x50')]);})['then'](function(_0x16b858){_0x2c91e1=_0x16b858;logger[_0x2d4a('0xb')](_0x2d4a('0x51'),_0x2c91e1['id']);return getTicket(_0x13970c,_0x1ad852,_0x2c91e1,_0x189d2a,_0x5e9704);})['then'](function(_0x38d795){if(_0x38d795){logger['info'](_0x2d4a('0x52'));logger[_0x2d4a('0xb')](_0x2d4a('0x53'),_0x38d795['id']);switch(_0x13970c[_0x2d4a('0x29')]){case _0x2d4a('0x54'):logger[_0x2d4a('0xb')](_0x2d4a('0x48'),_0x2d4a('0x55'));emit(util[_0x2d4a('0xd')](_0x2d4a('0x56'),_0x13b0f0[_0x2d4a('0x35')]),'trigger:desk:display',{'recordId':_0x38d795['id']});break;case _0x2d4a('0x57'):logger[_0x2d4a('0xb')](_0x2d4a('0x48'),_0x2d4a('0x58'));emit(util[_0x2d4a('0xd')]('user:%s',_0x13b0f0[_0x2d4a('0x35')]),_0x2d4a('0x59'),{'uri':util[_0x2d4a('0xd')](_0x2d4a('0x5a'),_0x38d795['id'])});break;default:logger[_0x2d4a('0x5b')]('[QUEUE]','Desk\x20account\x20type\x20not\x20recognized');}}})[_0x2d4a('0x5c')](function(_0x6d238b){console['error'](_0x6d238b);logger[_0x2d4a('0x5b')](_0x2d4a('0x48'),JSON[_0x2d4a('0x17')](_0x6d238b));});};exports[_0x2d4a('0x5d')]=function(_0x52a468,_0x31576d,_0x4e0198,_0x3e3fb7,_0x3fe91b,_0x298fed,_0x1174e2){var _0x1866c3,_0x3103ca;_0x298fed[_0x2d4a('0x14')]=intUtil[_0x2d4a('0x45')](_0x298fed['remoteUri']);_0x298fed[_0x2d4a('0x46')]=intUtil[_0x2d4a('0x45')](_0x298fed[_0x2d4a('0x46')]);if(_0x1174e2&&_0x1174e2[_0x2d4a('0x5e')]&&_0x1174e2[_0x2d4a('0x5e')]!==_0x2d4a('0x5f')){logger[_0x2d4a('0xb')](_0x2d4a('0x60'),_0x2d4a('0x49'));_0x31576d[_0x2d4a('0x4a')]=util[_0x2d4a('0xd')](_0x2d4a('0x4b'),_0x298fed[_0x2d4a('0x46')],_0x31576d[_0x2d4a('0x4c')],md5(_0x31576d[_0x2d4a('0x4c')]));}headers[_0x2d4a('0x4d')]=getAuth(_0x298fed);return getUser(_0x298fed,_0x3e3fb7[_0x2d4a('0x4e')])['then'](function(_0x3515b8){_0x1866c3=_0x3515b8;logger[_0x2d4a('0xb')]('The\x20User\x20ID\x20is:',_0x1866c3['id']);return getEndUser(_0x298fed,_0x31576d[_0x2d4a('0x61')],_0x31576d[_0x2d4a('0x62')]);})[_0x2d4a('0xe')](function(_0x228741){_0x3103ca=_0x228741;logger[_0x2d4a('0xb')](_0x2d4a('0x51'),_0x3103ca['id']);return getTicket(_0x298fed,_0x1866c3,_0x3103ca,_0x4e0198,_0x31576d);})[_0x2d4a('0xe')](function(_0x1cf982){if(_0x1cf982){logger[_0x2d4a('0xb')](_0x2d4a('0x52'));logger[_0x2d4a('0xb')](_0x2d4a('0x53'),_0x1cf982['id']);switch(_0x298fed['type']){case _0x2d4a('0x54'):logger[_0x2d4a('0xb')]('[QUEUE]',_0x2d4a('0x55'));emit(util[_0x2d4a('0xd')](_0x2d4a('0x56'),_0x3e3fb7[_0x2d4a('0x35')]),_0x2d4a('0x63'),{'recordId':_0x1cf982['id']});break;case _0x2d4a('0x57'):logger[_0x2d4a('0xb')](_0x2d4a('0x48'),_0x2d4a('0x58'));emit(util[_0x2d4a('0xd')]('user:%s',_0x3e3fb7[_0x2d4a('0x35')]),_0x2d4a('0x59'),{'uri':util[_0x2d4a('0xd')]('%s/agent/tickets/%s',_0x298fed[_0x2d4a('0x14')],_0x1cf982['id'])});break;default:logger[_0x2d4a('0x5b')](_0x2d4a('0x60'),_0x2d4a('0x64'));}}})[_0x2d4a('0x5c')](function(_0x278bbc){logger[_0x2d4a('0x5b')](_0x2d4a('0x60'),JSON[_0x2d4a('0x17')](_0x278bbc));});};exports['abandoned']=function(_0x21b8e9,_0x17ade0,_0x2a876b,_0x17ef80,_0x2c50e7,_0x2f77ee){var _0x53f52b,_0x38e4ae;_0x2f77ee[_0x2d4a('0x14')]=intUtil[_0x2d4a('0x45')](_0x2f77ee['remoteUri']);_0x2f77ee[_0x2d4a('0x46')]=intUtil[_0x2d4a('0x45')](_0x2f77ee['serverUrl']);if(_0x2c50e7&&_0x2c50e7[_0x2d4a('0x47')]){logger[_0x2d4a('0xb')]('[ABANDONED]',_0x2d4a('0x49'));_0x17ade0['recordingURL']=util['format'](_0x2d4a('0x4b'),_0x2f77ee[_0x2d4a('0x46')],_0x17ade0[_0x2d4a('0x4c')],md5(_0x17ade0[_0x2d4a('0x4c')]));}else{_0x17ade0['recordingURL']='';}headers[_0x2d4a('0x4d')]=getAuth(_0x2f77ee);return getUser(_0x2f77ee)[_0x2d4a('0xe')](function(_0x25ee37){_0x53f52b=_0x25ee37;logger[_0x2d4a('0xb')]('The\x20User\x20ID\x20is:',_0x53f52b['id']);return getEndUser(_0x2f77ee,_0x17ade0['calleridname'],_0x17ade0[_0x2d4a('0x50')]);})[_0x2d4a('0xe')](function(_0x2a2441){_0x38e4ae=_0x2a2441;logger[_0x2d4a('0xb')](_0x2d4a('0x51'),_0x38e4ae['id']);return getTicket(_0x2f77ee,_0x53f52b,_0x38e4ae,_0x2a876b,_0x17ade0);})[_0x2d4a('0xe')](function(_0x18db11){if(_0x18db11){logger['info'](_0x2d4a('0x52'));logger[_0x2d4a('0xb')](_0x2d4a('0x53'),_0x18db11['id']);}})[_0x2d4a('0x5c')](function(_0x59810d){logger[_0x2d4a('0x5b')](_0x2d4a('0x65'),JSON[_0x2d4a('0x17')](_0x59810d));});}; \ No newline at end of file +var _0x14a0=['Tags','Descriptions','/api/v2/users/%d','Fields','queue','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','[QUEUE]','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','catch','error','recordingFormat','none','destcalleridname','destcalleridnum','integrationTab','%s/agent/tickets/%s','[OUTBOUND]','Desk\x20account\x20type\x20not\x20recognized','[ABANDONED]','The\x20User\x20ID\x20is:','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','defaults','redis','localhost','application/json','Getting\x20agent\x20with\x20email','%s/users','remoteUri','total_entries','find','_embedded','entries','then','info','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','format','%s/users/me','debug','[HTTP]','stringify','GET','authType','basic','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','work','map','length','forEach','string','nameField','customField','toLowerCase','content','type','idField','variable','variableName','custom_fields','customVariable','Variable','name','priority','Creating\x20new\x20ticket...','merge','getString','phone','new','Motion','CTI','concat'];(function(_0x2893cb,_0x139b3b){var _0x414d4b=function(_0x992372){while(--_0x992372){_0x2893cb['push'](_0x2893cb['shift']());}};_0x414d4b(++_0x139b3b);}(_0x14a0,0x8e));var _0x014a=function(_0x34f9d6,_0x145d02){_0x34f9d6=_0x34f9d6-0x0;var _0x533022=_0x14a0[_0x34f9d6];return _0x533022;};'use strict';var _=require('lodash');var rp=require(_0x014a('0x0'));var md5=require(_0x014a('0x1'));var util=require(_0x014a('0x2'));var Redis=require(_0x014a('0x3'));var intUtil=require(_0x014a('0x4'));var config=require(_0x014a('0x5'));var logger=require(_0x014a('0x6'))('desk');config['redis']=_[_0x014a('0x7')](config[_0x014a('0x8')],{'host':_0x014a('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x11b8ce,_0x6d05f2,_0x22f17c){io['to'](_0x11b8ce)['emit'](_0x6d05f2,_0x22f17c);}var headers={'Content-Type':'application/json','Accept':_0x014a('0xa')};function getUser(_0x4f5506,_0x490ea2){if(intUtil['validateEmail'](_0x490ea2)===!![]){logger['info'](_0x014a('0xb'),_0x490ea2);return request({'uri':util['format'](_0x014a('0xc'),_0x4f5506[_0x014a('0xd')])})['then'](function(_0x18c742){if(_0x18c742[_0x014a('0xe')]){return _[_0x014a('0xf')](_0x18c742[_0x014a('0x10')][_0x014a('0x11')],{'email':_0x490ea2});}})[_0x014a('0x12')](function(_0x200ab8){if(_0x200ab8){logger[_0x014a('0x13')](_0x014a('0x14'));return _0x200ab8;}else{logger[_0x014a('0x13')](_0x014a('0x15'));return request({'uri':util[_0x014a('0x16')]('%s/users/me',_0x4f5506[_0x014a('0xd')])});}});}else{logger[_0x014a('0x13')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x014a('0x16')](_0x014a('0x17'),_0x4f5506['remoteUri'])});}}function request(_0x16e6fc){logger[_0x014a('0x18')](_0x014a('0x19'),JSON[_0x014a('0x1a')](_0x16e6fc));return rp(_[_0x014a('0x7')](_0x16e6fc,{'method':_0x014a('0x1b'),'headers':headers,'json':!![]}));}function getAuth(_0x61ec9f){var _0x263b07;if(_0x61ec9f[_0x014a('0x1c')]===_0x014a('0x1d')){_0x263b07=util[_0x014a('0x16')](_0x014a('0x1e'),_0x61ec9f[_0x014a('0x1f')],_0x61ec9f[_0x014a('0x20')]);}else if(_0x61ec9f['authType']===_0x014a('0x21')){_0x263b07=util[_0x014a('0x16')](_0x014a('0x22'),_0x61ec9f[_0x014a('0x1f')],_0x61ec9f[_0x014a('0x21')]);}return util[_0x014a('0x16')](_0x014a('0x23'),new Buffer(_0x263b07)[_0x014a('0x24')](_0x014a('0x25')));}function getEndUser(_0x486e66,_0x3679ed,_0x5f556e){logger[_0x014a('0x13')](_0x014a('0x26'),_0x5f556e);return request({'uri':util[_0x014a('0x16')](_0x014a('0x27'),_0x486e66[_0x014a('0xd')]),'qs':{'phone':_0x5f556e}})[_0x014a('0x12')](function(_0x3fec9f){if(_0x3fec9f[_0x014a('0xe')]){logger[_0x014a('0x13')]('Enduser\x20found!');return _0x3fec9f[_0x014a('0x10')]['entries'][0x0];}else{logger[_0x014a('0x13')](_0x014a('0x28'));return request({'uri':util['format']('%s/customers',_0x486e66[_0x014a('0xd')]),'method':_0x014a('0x29'),'body':{'first_name':_0x3679ed,'title':_0x3679ed,'phone_numbers':[{'type':_0x014a('0x2a'),'value':_0x5f556e}]}});}});}function getTags(_0x5ed71b,_0x183f19){var _0x3c1fa4=[];if(_0x5ed71b&&_0x5ed71b['length']>0x0){_0x3c1fa4=_[_0x014a('0x2b')](_0x5ed71b,_0x183f19);}return _0x3c1fa4;}function getCustomFields(_0x2560a6,_0x496040){var _0x4f9c1c=[];var _0x397850={'custom_fields':{}};if(_0x2560a6[_0x014a('0x2c')]>0x0){_[_0x014a('0x2d')](_0x2560a6,function(_0x29fce5){if(_0x29fce5['type']===_0x014a('0x2e')&&_0x29fce5[_0x014a('0x2f')]&&!_0x29fce5[_0x014a('0x30')]){_0x397850[_0x29fce5[_0x014a('0x2f')][_0x014a('0x31')]()]=_0x29fce5[_0x014a('0x32')][_0x014a('0x24')]();}else if(_0x29fce5[_0x014a('0x33')]===_0x014a('0x2e')&&_0x29fce5[_0x014a('0x34')]&&_0x29fce5[_0x014a('0x30')]){_0x397850['custom_fields'][_0x29fce5[_0x014a('0x34')]]=_0x29fce5[_0x014a('0x32')][_0x014a('0x24')]();}else if(_0x29fce5[_0x014a('0x33')]===_0x014a('0x35')&&_0x29fce5[_0x014a('0x36')]&&_0x29fce5[_0x014a('0x34')]&&_0x29fce5['customField']){_0x496040[_0x29fce5[_0x014a('0x36')]]&&(_0x397850[_0x014a('0x37')][_0x29fce5['idField']]=_0x496040[_0x29fce5[_0x014a('0x36')]][_0x014a('0x24')]());}else if(_0x29fce5[_0x014a('0x33')]===_0x014a('0x38')&&_0x29fce5[_0x014a('0x39')]&&_0x29fce5[_0x014a('0x39')][_0x014a('0x3a')]&&_0x29fce5[_0x014a('0x34')]&&_0x29fce5['customField']){_0x496040[_0x29fce5[_0x014a('0x39')][_0x014a('0x3a')][_0x014a('0x31')]()]&&(_0x397850[_0x014a('0x37')][_0x29fce5['idField']]=_0x496040[_0x29fce5[_0x014a('0x39')][_0x014a('0x3a')][_0x014a('0x31')]()][_0x014a('0x24')]());}});}if(_0x397850[_0x014a('0x3b')]){_0x397850[_0x014a('0x3b')]=Number(_0x397850[_0x014a('0x3b')]);}return _0x397850;}function getTicket(_0x36187b,_0x1ec350,_0x5f2f66,_0x1b34f8,_0x585962){logger[_0x014a('0x13')](_0x014a('0x3c'));var _0x44958f=_[_0x014a('0x3d')]({'subject':intUtil[_0x014a('0x3e')](_0x1b34f8['Subjects'],_0x585962,'\x20'),'type':_0x014a('0x3f'),'status':_0x014a('0x40'),'labels':['xCALLY',_0x014a('0x41'),_0x014a('0x42')][_0x014a('0x43')](getTags(_0x1b34f8[_0x014a('0x44')],_0x014a('0x3a'))),'description':intUtil[_0x014a('0x3e')](_0x1b34f8[_0x014a('0x45')],_0x585962,'\x0a'),'_links':{'assigned_user':{'href':util[_0x014a('0x16')](_0x014a('0x46'),_0x1ec350['id']),'class':'user'}},'message':{'direction':'in','body':intUtil[_0x014a('0x3e')](_0x1b34f8[_0x014a('0x45')],_0x585962,'\x0a')}},getCustomFields(_0x1b34f8[_0x014a('0x47')],_0x585962));return request({'uri':util[_0x014a('0x16')]('%s/customers/%d/cases',_0x36187b[_0x014a('0xd')],_0x5f2f66['id']),'method':_0x014a('0x29'),'body':_0x44958f});}exports[_0x014a('0x48')]=function(_0x1355dd,_0x1dc647,_0x430a56,_0x5f2969,_0x361866,_0x2830e1){var _0x5e2f74,_0xc086b3;_0x2830e1[_0x014a('0xd')]=intUtil[_0x014a('0x49')](_0x2830e1['remoteUri']);_0x2830e1[_0x014a('0x4a')]=intUtil['stripTrailingSlash'](_0x2830e1['serverUrl']);if(_0x361866&&_0x361866[_0x014a('0x4b')]){logger[_0x014a('0x13')]('[QUEUE]',_0x014a('0x4c'));_0x1dc647[_0x014a('0x4d')]=util[_0x014a('0x16')](_0x014a('0x4e'),_0x2830e1[_0x014a('0x4a')],_0x1dc647[_0x014a('0x4f')],md5(_0x1dc647['uniqueid']));}else{_0x1dc647[_0x014a('0x4d')]='';}headers[_0x014a('0x50')]=getAuth(_0x2830e1);return getUser(_0x2830e1,_0x5f2969[_0x014a('0x51')])['then'](function(_0x56937d){_0x5e2f74=_0x56937d;logger[_0x014a('0x13')]('The\x20User\x20ID\x20is:',_0x5e2f74['id']);return getEndUser(_0x2830e1,_0x1dc647['calleridname'],_0x1dc647[_0x014a('0x52')]);})['then'](function(_0x2a4679){_0xc086b3=_0x2a4679;logger[_0x014a('0x13')](_0x014a('0x53'),_0xc086b3['id']);return getTicket(_0x2830e1,_0x5e2f74,_0xc086b3,_0x430a56,_0x1dc647);})['then'](function(_0x395e5e){if(_0x395e5e){logger[_0x014a('0x13')](_0x014a('0x54'));logger[_0x014a('0x13')](_0x014a('0x55'),_0x395e5e['id']);switch(_0x2830e1[_0x014a('0x33')]){case'integrationTab':logger[_0x014a('0x13')](_0x014a('0x56'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x014a('0x16')](_0x014a('0x57'),_0x5f2969[_0x014a('0x3a')]),_0x014a('0x58'),{'recordId':_0x395e5e['id']});break;case _0x014a('0x59'):logger[_0x014a('0x13')](_0x014a('0x56'),_0x014a('0x5a'));emit(util['format'](_0x014a('0x57'),_0x5f2969[_0x014a('0x3a')]),_0x014a('0x5b'),{'uri':util[_0x014a('0x16')](_0x014a('0x5c'),_0x395e5e['id'])});break;default:logger['error'](_0x014a('0x56'),'Desk\x20account\x20type\x20not\x20recognized');}}})[_0x014a('0x5d')](function(_0x3b5ac9){console[_0x014a('0x5e')](_0x3b5ac9);logger[_0x014a('0x5e')](_0x014a('0x56'),JSON['stringify'](_0x3b5ac9));});};exports['outbound']=function(_0x4bb0b2,_0x58905d,_0x1c11d0,_0x4c2479,_0x1fe253,_0x5b5318,_0x59cfbe){var _0x21ff0c,_0x55ca2f;_0x5b5318[_0x014a('0xd')]=intUtil[_0x014a('0x49')](_0x5b5318[_0x014a('0xd')]);_0x5b5318[_0x014a('0x4a')]=intUtil[_0x014a('0x49')](_0x5b5318[_0x014a('0x4a')]);if(_0x59cfbe&&_0x59cfbe[_0x014a('0x5f')]&&_0x59cfbe[_0x014a('0x5f')]!==_0x014a('0x60')){logger[_0x014a('0x13')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x58905d[_0x014a('0x4d')]=util[_0x014a('0x16')](_0x014a('0x4e'),_0x5b5318['serverUrl'],_0x58905d['uniqueid'],md5(_0x58905d[_0x014a('0x4f')]));}headers['Authorization']=getAuth(_0x5b5318);return getUser(_0x5b5318,_0x4c2479[_0x014a('0x51')])[_0x014a('0x12')](function(_0x34c65a){_0x21ff0c=_0x34c65a;logger[_0x014a('0x13')]('The\x20User\x20ID\x20is:',_0x21ff0c['id']);return getEndUser(_0x5b5318,_0x58905d[_0x014a('0x61')],_0x58905d[_0x014a('0x62')]);})[_0x014a('0x12')](function(_0x56c09b){_0x55ca2f=_0x56c09b;logger[_0x014a('0x13')]('The\x20Enduser\x20ID\x20is:',_0x55ca2f['id']);return getTicket(_0x5b5318,_0x21ff0c,_0x55ca2f,_0x1c11d0,_0x58905d);})[_0x014a('0x12')](function(_0x47074f){if(_0x47074f){logger[_0x014a('0x13')](_0x014a('0x54'));logger[_0x014a('0x13')](_0x014a('0x55'),_0x47074f['id']);switch(_0x5b5318['type']){case _0x014a('0x63'):logger[_0x014a('0x13')](_0x014a('0x56'),'Displaying\x20ticket\x20to\x20agent...');emit(util[_0x014a('0x16')](_0x014a('0x57'),_0x4c2479[_0x014a('0x3a')]),_0x014a('0x58'),{'recordId':_0x47074f['id']});break;case _0x014a('0x59'):logger['info'](_0x014a('0x56'),_0x014a('0x5a'));emit(util[_0x014a('0x16')](_0x014a('0x57'),_0x4c2479[_0x014a('0x3a')]),_0x014a('0x5b'),{'uri':util[_0x014a('0x16')](_0x014a('0x64'),_0x5b5318[_0x014a('0xd')],_0x47074f['id'])});break;default:logger[_0x014a('0x5e')](_0x014a('0x65'),_0x014a('0x66'));}}})['catch'](function(_0x2ac66a){logger['error']('[OUTBOUND]',JSON['stringify'](_0x2ac66a));});};exports['abandoned']=function(_0x5a38b4,_0x1716d3,_0x19be40,_0x2613ff,_0x52d602,_0x3c6fc0){var _0x2a5007,_0x3071c8;_0x3c6fc0[_0x014a('0xd')]=intUtil['stripTrailingSlash'](_0x3c6fc0['remoteUri']);_0x3c6fc0[_0x014a('0x4a')]=intUtil[_0x014a('0x49')](_0x3c6fc0[_0x014a('0x4a')]);if(_0x52d602&&_0x52d602[_0x014a('0x4b')]){logger[_0x014a('0x13')](_0x014a('0x67'),_0x014a('0x4c'));_0x1716d3[_0x014a('0x4d')]=util[_0x014a('0x16')](_0x014a('0x4e'),_0x3c6fc0[_0x014a('0x4a')],_0x1716d3['uniqueid'],md5(_0x1716d3[_0x014a('0x4f')]));}else{_0x1716d3[_0x014a('0x4d')]='';}headers['Authorization']=getAuth(_0x3c6fc0);return getUser(_0x3c6fc0)[_0x014a('0x12')](function(_0x3e39c9){_0x2a5007=_0x3e39c9;logger['info'](_0x014a('0x68'),_0x2a5007['id']);return getEndUser(_0x3c6fc0,_0x1716d3['calleridname'],_0x1716d3[_0x014a('0x52')]);})[_0x014a('0x12')](function(_0xcdcbbb){_0x3071c8=_0xcdcbbb;logger[_0x014a('0x13')](_0x014a('0x53'),_0x3071c8['id']);return getTicket(_0x3c6fc0,_0x2a5007,_0x3071c8,_0x19be40,_0x1716d3);})['then'](function(_0x2cd82e){if(_0x2cd82e){logger[_0x014a('0x13')](_0x014a('0x54'));logger[_0x014a('0x13')](_0x014a('0x55'),_0x2cd82e['id']);}})['catch'](function(_0x20cddc){logger[_0x014a('0x5e')](_0x014a('0x67'),JSON['stringify'](_0x20cddc));});}; \ 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 d26cab5..c018280 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 _0x35a6=['telephone1','contactid',']\x20Enduser\x20Created!','forEach','string','nameField','customField','idField','indexOf','content','ticketType','incident','incidents','assign','getString','Subjects','Descriptions','/contacts(','Fields','phonecall','phonecalls','callDirection','queue','ticketId','format','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','remoteUri','name',']\x20Error\x20running\x20Dynamics365\x20integration','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','dynamics365','../../../../config/environment','redis','localhost','socket.io-emitter','POST','clientId','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','then','isNil','email','length',']\x20Agent\x20found\x20','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userEmail','username','internalemailaddress','userId','outbound','calleridnum','contacts','/systemusers(','4.0','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','toLowerCase','destcalleridnum'];(function(_0x2d364e,_0x301c5e){var _0x1b9312=function(_0x1b05bb){while(--_0x1b05bb){_0x2d364e['push'](_0x2d364e['shift']());}};_0x1b9312(++_0x301c5e);}(_0x35a6,0x1b6));var _0x635a=function(_0x5ce3c1,_0x2ab59b){_0x5ce3c1=_0x5ce3c1-0x0;var _0x585640=_0x35a6[_0x5ce3c1];return _0x585640;};'use strict';var _=require(_0x635a('0x0'));var BPromise=require(_0x635a('0x1'));var rp=require(_0x635a('0x2'));var util=require(_0x635a('0x3'));var intUtil=require(_0x635a('0x4'));var md5=require(_0x635a('0x5'));var Redis=require(_0x635a('0x6'));var logger=require(_0x635a('0x7'))(_0x635a('0x8'));var config=require(_0x635a('0x9'));config[_0x635a('0xa')]=_['defaults'](config['redis'],{'host':_0x635a('0xb'),'port':0x18eb});var io=require(_0x635a('0xc'))(new Redis(config[_0x635a('0xa')]));function getAuthToken(_0x4d6d89,_0xf7bc17,_0x34a56a){var _0xd59849={'method':_0x635a('0xd'),'uri':_0xf7bc17,'form':{'client_id':_0x4d6d89[_0x635a('0xe')],'resource':_0x4d6d89['remoteUri'],'username':_0x4d6d89['username'],'password':_0x4d6d89[_0x635a('0xf')],'grant_type':_0x635a('0xf'),'client_secret':_0x4d6d89[_0x635a('0x10')]},'json':!![]};return rp(_0xd59849)['then'](function(_0x1c7057){return _0x1c7057[_0x635a('0x11')];})[_0x635a('0x12')](function(_0xd550e){logger[_0x635a('0x13')]('['+[_0x34a56a[_0x635a('0x14')]()]+_0x635a('0x15'));return _0xd550e[_0x635a('0x16')];});}function getUser(_0x55e480,_0x5465e4,_0x306d48,_0x2c09e2,_0x3f1817,_0x2aa176){return new BPromise(function(_0x581ec0,_0x2f4250){return getAuthToken(_0x5465e4,_0x2c09e2,_0x2aa176)['then'](function(_0x52f485){var _0x1f9157={'method':_0x635a('0x17'),'uri':_0x3f1817+_0x635a('0x18'),'headers':{'Authorization':_0x635a('0x19')+_0x52f485,'OData-Version':'4.0'},'json':!![]};return rp(_0x1f9157);})[_0x635a('0x1a')](function(_0x48b0f4){var _0x51e442=_0x48b0f4['value'];var _0x424ce5=![];var _0x4af5ae=null;if(!_[_0x635a('0x1b')](_0x306d48)){if(intUtil['validateEmail'](_0x306d48['email'])){_0x55e480['userEmail']=_0x306d48[_0x635a('0x1c')];for(_0x4af5ae=0x0;_0x4af5ae<_0x51e442[_0x635a('0x1d')];_0x4af5ae++){if(_0x51e442[_0x4af5ae]['internalemailaddress']===_0x306d48['email']&&!_0x51e442[_0x4af5ae]['isdisabled']){_0x424ce5=!![];logger['info']('['+[_0x2aa176[_0x635a('0x14')]()]+_0x635a('0x1e')+_0x51e442[_0x4af5ae][_0x635a('0x1f')]+'!');_0x55e480['userId']=_0x51e442[_0x4af5ae][_0x635a('0x1f')];}}}}if(!_0x424ce5){logger[_0x635a('0x20')]('['+[_0x2aa176[_0x635a('0x14')]()]+_0x635a('0x21'));_0x55e480[_0x635a('0x22')]=_0x5465e4[_0x635a('0x23')];for(_0x4af5ae=0x0;_0x4af5ae<_0x51e442[_0x635a('0x1d')];_0x4af5ae++){if(_0x51e442[_0x4af5ae][_0x635a('0x24')]===_0x5465e4[_0x635a('0x23')]){_0x55e480[_0x635a('0x25')]=_0x51e442[_0x4af5ae]['systemuserid'];}}}_0x581ec0(_0x55e480);})[_0x635a('0x12')](function(_0x3c97f2){_0x2f4250(_0x3c97f2[_0x635a('0x16')]);});});}function createEndUser(_0x3cb2b4,_0x3bfb1f,_0x111abe,_0x23522b,_0x5c41bd,_0x7a457d){return new BPromise(function(_0x4f24a6,_0x40f45e){return getAuthToken(_0x3bfb1f,_0x111abe,_0x7a457d)['then'](function(_0x4d57c6){var _0x5d6ba2=_0x7a457d['toLowerCase']()===_0x635a('0x26')?_0x5c41bd['destcalleridnum']:_0x5c41bd[_0x635a('0x27')];var _0x350915={'method':'POST','uri':_0x23522b+_0x635a('0x28'),'body':{'telephone1':_0x5d6ba2,'fullname':_0x5d6ba2,'firstname':_0x5d6ba2,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x635a('0x29')+_0x3cb2b4[_0x635a('0x25')]+')'},'headers':{'Authorization':'Bearer\x20'+_0x4d57c6,'OData-Version':_0x635a('0x2a')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x350915);})[_0x635a('0x1a')](function(_0x367408){var _0x68814b=_0x367408[_0x635a('0x2b')][_0x635a('0x2c')];var _0x5dce14=_0x68814b[_0x635a('0x2d')](_0x68814b[_0x635a('0x2e')]('(')+0x1,_0x68814b[_0x635a('0x2e')](')'));_0x3cb2b4[_0x635a('0x2f')]=_0x5dce14;_0x4f24a6(_0x3cb2b4);})[_0x635a('0x12')](function(_0x36240b){_0x40f45e(_0x36240b[_0x635a('0x16')]);});});}function getEndUser(_0xad941b,_0x53dcee,_0x10bfc4,_0x306f9f,_0x356beb,_0x54aba2){return new BPromise(function(_0x1f6866,_0x30124e){return getAuthToken(_0x53dcee,_0x10bfc4,_0x54aba2)[_0x635a('0x1a')](function(_0x5d9d80){var _0x283764={'method':_0x635a('0x17'),'uri':_0x306f9f+_0x635a('0x30'),'headers':{'Authorization':'Bearer\x20'+_0x5d9d80,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x283764);})['then'](function(_0x13e82a){var _0x16fb5f=null;if(_0x13e82a){var _0x3de15f=_0x13e82a[_0x635a('0x31')];var _0x1fc059=![];for(_0x16fb5f=0x0;_0x16fb5f<_0x3de15f[_0x635a('0x1d')];_0x16fb5f++){var _0x5918df=_0x54aba2[_0x635a('0x32')]()===_0x635a('0x26')?_0x356beb[_0x635a('0x33')]:_0x356beb[_0x635a('0x27')];if(_0x3de15f[_0x16fb5f][_0x635a('0x34')]===_0x5918df){_0x1fc059=!![];_0xad941b[_0x635a('0x2f')]=_0x3de15f[_0x16fb5f][_0x635a('0x35')];}}if(_0x1fc059){_0x1f6866(_0xad941b);}else{return createEndUser(_0xad941b,_0x53dcee,_0x10bfc4,_0x306f9f,_0x356beb,_0x54aba2)[_0x635a('0x1a')](function(_0x5db8ca){logger['info']('['+[_0x54aba2[_0x635a('0x14')]()]+']\x20Enduser\x20created!',_0x5db8ca[_0x635a('0x2f')]);_0x1f6866(_0x5db8ca);});}}else{return createEndUser(_0xad941b,_0x53dcee,_0x10bfc4,_0x306f9f,_0x356beb,_0x54aba2)[_0x635a('0x1a')](function(_0x3d777f){logger['info']('['+[_0x54aba2[_0x635a('0x14')]()]+_0x635a('0x36'),_0x3d777f['enduserId']);_0x1f6866(_0x3d777f);});}});});}function getCustomFields(_0x4cf3b8,_0x2e69c3,_0xa307e7){var _0x5e291b={};if(_0x4cf3b8[_0x635a('0x1d')]>0x0){_[_0x635a('0x37')](_0x4cf3b8,function(_0x5dddf7){if(_0x5dddf7['type']===_0x635a('0x38')&&_0x5dddf7[_0x635a('0x39')]&&!_0x5dddf7[_0x635a('0x3a')]){var _0x53c3ce=_0x5dddf7[_0x635a('0x3b')][_0x635a('0x32')]();var _0x4103e5=_0x53c3ce[_0x635a('0x2d')](0x0,_0x53c3ce[_0x635a('0x3c')]('_'));var _0x26f764=_0x53c3ce[_0x635a('0x2d')](_0x53c3ce[_0x635a('0x3c')]('_')+0x1);if(_0x4103e5===_0xa307e7){_0x5e291b[_0x26f764]=_0x5dddf7[_0x635a('0x3d')];}}});}return _0x5e291b;}function getTicket(_0x5a1c29,_0x5b8be4,_0x3498f4,_0x3e77,_0x3536f1,_0x486f24,_0x9db2a7){return new BPromise(function(_0x3cc1fc,_0x4afde9){var _0x33459b;return getAuthToken(_0x5b8be4,_0x3498f4,_0x9db2a7)[_0x635a('0x1a')](function(_0x544290){if(_0x486f24[_0x635a('0x3e')]===_0x635a('0x3f')){_0x33459b={'method':'POST','uri':_0x3e77+_0x635a('0x40'),'body':Object[_0x635a('0x41')]({},{'title':intUtil[_0x635a('0x42')](_0x486f24[_0x635a('0x43')],_0x3536f1,'\x20'),'description':intUtil[_0x635a('0x42')](_0x486f24[_0x635a('0x44')],_0x3536f1,'\x0a'),'customerid_contact@odata.bind':_0x635a('0x45')+_0x5a1c29[_0x635a('0x2f')]+')','ownerid@odata.bind':_0x635a('0x29')+_0x5a1c29[_0x635a('0x25')]+')','caseorigincode':'1'},getCustomFields(_0x486f24[_0x635a('0x46')],_0x3536f1,_0x486f24[_0x635a('0x3e')])),'headers':{'Authorization':_0x635a('0x19')+_0x544290,'OData-Version':_0x635a('0x2a')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x486f24[_0x635a('0x3e')]===_0x635a('0x47')){_0x33459b={'method':'POST','uri':_0x3e77+_0x635a('0x48'),'body':Object[_0x635a('0x41')]({},{'subject':intUtil[_0x635a('0x42')](_0x486f24[_0x635a('0x43')],_0x3536f1,'\x20'),'phonenumber':String(_0x3536f1[_0x635a('0x27')]),'description':intUtil[_0x635a('0x42')](_0x486f24[_0x635a('0x44')],_0x3536f1,'\x0a'),'regardingobjectid_contact@odata.bind':_0x635a('0x45')+_0x5a1c29[_0x635a('0x2f')]+')','ownerid@odata.bind':_0x635a('0x29')+_0x5a1c29['userId']+')','directioncode':_0x5a1c29['callDirection']==='queue'?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x635a('0x29')+_0x5a1c29[_0x635a('0x25')]+')','participationtypemask':_0x5a1c29[_0x635a('0x49')]===_0x635a('0x4a')?0x2:0x1},{'partyid_contact@odata.bind':'/contacts('+_0x5a1c29['enduserId']+')','participationtypemask':_0x5a1c29[_0x635a('0x49')]===_0x635a('0x4a')?0x1:0x2}]},getCustomFields(_0x486f24['Fields'],_0x3536f1,_0x486f24['ticketType'])),'headers':{'Authorization':_0x635a('0x19')+_0x544290,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x33459b);})['then'](function(_0x53a611){var _0x1d9f73=_0x53a611[_0x635a('0x2b')][_0x635a('0x2c')];var _0x3fa34c=_0x1d9f73[_0x635a('0x2d')](_0x1d9f73[_0x635a('0x2e')]('(')+0x1,_0x1d9f73['lastIndexOf'](')'));_0x5a1c29[_0x635a('0x4b')]=_0x3fa34c;_0x3cc1fc(_0x5a1c29);})[_0x635a('0x12')](function(_0x1b3c80){_0x4afde9(_0x1b3c80[_0x635a('0x16')]);});});}function emit(_0xc56ad4,_0x560fdc,_0xbf9e3c,_0x4a1064){var _0x52e4d5={'uri':util[_0x635a('0x4c')]('%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s',_0xc56ad4,_0xbf9e3c,_0x4a1064)};io['to'](util[_0x635a('0x4c')]('user:%s',_0x560fdc))['emit'](_0x635a('0x4d'),_0x52e4d5);}exports['cs']=function(_0x52a628,_0x5087b8,_0x240358,_0x163bba,_0x5f09cf,_0x5fc862,_0x170ea2,_0x2c89a6){var _0x32c246={};_0x5fc862['remoteUri']=intUtil[_0x635a('0x4e')](_0x5fc862['remoteUri']);_0x5fc862[_0x635a('0x4f')]=intUtil['stripTrailingSlash'](_0x5fc862[_0x635a('0x4f')]);_0x32c246[_0x635a('0x49')]=_0x2c89a6==='queue'||_0x2c89a6===_0x635a('0x50')?_0x635a('0x4a'):'outbound';var _0x3459a2=util[_0x635a('0x4c')](_0x635a('0x51'),_0x5fc862['remoteUri']);var _0x5c722b=util['format'](_0x635a('0x52'),_0x5fc862[_0x635a('0x53')]);var _0x26ef34=util[_0x635a('0x4c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5fc862[_0x635a('0x4f')],_0x5087b8[_0x635a('0x54')],md5(_0x5087b8['uniqueid']));if(_0x5f09cf&&_0x5f09cf[_0x635a('0x55')]){logger[_0x635a('0x20')](_0x635a('0x56'),_0x635a('0x57'));_0x5087b8['recordingURL']=_0x26ef34;}else if(_0x170ea2&&_0x170ea2['recordingFormat']&&_0x170ea2[_0x635a('0x58')]!=='none'){logger[_0x635a('0x20')](_0x635a('0x59'),_0x635a('0x57'));_0x5087b8['recordingURL']=_0x26ef34;}else{_0x5087b8[_0x635a('0x5a')]='';}return getUser(_0x32c246,_0x5fc862,_0x163bba,_0x5c722b,_0x3459a2,_0x2c89a6)[_0x635a('0x1a')](function(_0x204dec){logger[_0x635a('0x20')]('['+_0x2c89a6['toUpperCase']()+']\x20The\x20User\x20ID\x20is:',_0x204dec[_0x635a('0x25')]);logger['info']('['+_0x2c89a6[_0x635a('0x14')]()+']\x20The\x20User\x20email\x20is:',_0x204dec[_0x635a('0x22')]);return getEndUser(_0x204dec,_0x5fc862,_0x5c722b,_0x3459a2,_0x5087b8,_0x2c89a6);})[_0x635a('0x1a')](function(_0x4479e3){logger[_0x635a('0x20')]('['+_0x2c89a6[_0x635a('0x14')]()+_0x635a('0x5b'),_0x4479e3[_0x635a('0x2f')]);logger['info']('['+_0x2c89a6[_0x635a('0x14')]()+_0x635a('0x5c'),_0x5087b8[_0x635a('0x27')]);return getTicket(_0x4479e3,_0x5fc862,_0x5c722b,_0x3459a2,_0x5087b8,_0x240358,_0x2c89a6);})['then'](function(_0x131c33){logger[_0x635a('0x20')](util[_0x635a('0x4c')]('['+_0x2c89a6[_0x635a('0x14')]()+_0x635a('0x5d'),_0x240358['ticketType'],_0x131c33[_0x635a('0x4b')]));logger[_0x635a('0x20')](util[_0x635a('0x4c')]('['+_0x2c89a6[_0x635a('0x14')]()+']\x20Call\x20direction:\x20%s',_0x2c89a6));if(_0x2c89a6!==_0x635a('0x50')){logger['info']('['+_0x2c89a6['toUpperCase']()+']',_0x635a('0x5e'));emit(_0x5fc862[_0x635a('0x5f')],_0x163bba[_0x635a('0x60')],_0x240358[_0x635a('0x3e')],_0x131c33[_0x635a('0x4b')]);}})[_0x635a('0x12')](function(_0x3657da){logger[_0x635a('0x13')]('['+_0x2c89a6['toUpperCase']()+_0x635a('0x61'),util['inspect'](_0x3657da,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xda7b=['catch','error','message','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','isNil','validateEmail','email','length','info',']\x20Agent\x20found\x20','systemuserid','userId','toUpperCase','userEmail','toLowerCase','outbound','destcalleridnum','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=telephone1','value','calleridnum','telephone1',']\x20Enduser\x20Created!','forEach','type','nameField','customField','indexOf','content','incidents','assign','getString','Descriptions','/contacts(','/systemusers(','ticketType','phonecalls','Subjects','callDirection','queue','Fields','ticketId','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','abandoned','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','./util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','remoteUri','username','password','clientSecret','then','access_token'];(function(_0x2399f4,_0x4e55d7){var _0x352e4c=function(_0x4798e3){while(--_0x4798e3){_0x2399f4['push'](_0x2399f4['shift']());}};_0x352e4c(++_0x4e55d7);}(_0xda7b,0x102));var _0xbda7=function(_0xf177e6,_0x42c236){_0xf177e6=_0xf177e6-0x0;var _0x2daeef=_0xda7b[_0xf177e6];return _0x2daeef;};'use strict';var _=require(_0xbda7('0x0'));var BPromise=require(_0xbda7('0x1'));var rp=require(_0xbda7('0x2'));var util=require('util');var intUtil=require(_0xbda7('0x3'));var md5=require(_0xbda7('0x4'));var Redis=require('ioredis');var logger=require(_0xbda7('0x5'))(_0xbda7('0x6'));var config=require(_0xbda7('0x7'));config[_0xbda7('0x8')]=_[_0xbda7('0x9')](config['redis'],{'host':_0xbda7('0xa'),'port':0x18eb});var io=require(_0xbda7('0xb'))(new Redis(config[_0xbda7('0x8')]));function getAuthToken(_0x481c55,_0x11dbb1,_0x1bb504){var _0x4fd949={'method':'POST','uri':_0x11dbb1,'form':{'client_id':_0x481c55['clientId'],'resource':_0x481c55[_0xbda7('0xc')],'username':_0x481c55[_0xbda7('0xd')],'password':_0x481c55[_0xbda7('0xe')],'grant_type':_0xbda7('0xe'),'client_secret':_0x481c55[_0xbda7('0xf')]},'json':!![]};return rp(_0x4fd949)[_0xbda7('0x10')](function(_0x5e790d){return _0x5e790d[_0xbda7('0x11')];})[_0xbda7('0x12')](function(_0x1c0412){logger[_0xbda7('0x13')]('['+[_0x1bb504['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x1c0412[_0xbda7('0x14')];});}function getUser(_0x3146a6,_0x5038f7,_0xed0d5f,_0x778d3e,_0x1a07ad,_0x2736aa){return new BPromise(function(_0x259609,_0xde7795){return getAuthToken(_0x5038f7,_0x778d3e,_0x2736aa)[_0xbda7('0x10')](function(_0x31b5be){var _0xcaa209={'method':_0xbda7('0x15'),'uri':_0x1a07ad+_0xbda7('0x16'),'headers':{'Authorization':_0xbda7('0x17')+_0x31b5be,'OData-Version':_0xbda7('0x18')},'json':!![]};return rp(_0xcaa209);})[_0xbda7('0x10')](function(_0x408a1a){var _0x51e730=_0x408a1a['value'];var _0x40fa83=![];var _0x594773=null;if(!_[_0xbda7('0x19')](_0xed0d5f)){if(intUtil[_0xbda7('0x1a')](_0xed0d5f[_0xbda7('0x1b')])){_0x3146a6['userEmail']=_0xed0d5f[_0xbda7('0x1b')];for(_0x594773=0x0;_0x594773<_0x51e730[_0xbda7('0x1c')];_0x594773++){if(_0x51e730[_0x594773]['internalemailaddress']===_0xed0d5f[_0xbda7('0x1b')]&&!_0x51e730[_0x594773]['isdisabled']){_0x40fa83=!![];logger[_0xbda7('0x1d')]('['+[_0x2736aa['toUpperCase']()]+_0xbda7('0x1e')+_0x51e730[_0x594773][_0xbda7('0x1f')]+'!');_0x3146a6[_0xbda7('0x20')]=_0x51e730[_0x594773][_0xbda7('0x1f')];}}}}if(!_0x40fa83){logger[_0xbda7('0x1d')]('['+[_0x2736aa[_0xbda7('0x21')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x3146a6[_0xbda7('0x22')]=_0x5038f7['username'];for(_0x594773=0x0;_0x594773<_0x51e730['length'];_0x594773++){if(_0x51e730[_0x594773]['internalemailaddress']===_0x5038f7['username']){_0x3146a6[_0xbda7('0x20')]=_0x51e730[_0x594773][_0xbda7('0x1f')];}}}_0x259609(_0x3146a6);})[_0xbda7('0x12')](function(_0x49fd69){_0xde7795(_0x49fd69[_0xbda7('0x14')]);});});}function createEndUser(_0x6a5ef6,_0x239c60,_0x27503a,_0x4d0758,_0x17f745,_0x417e29){return new BPromise(function(_0x1add31,_0x49ed7f){return getAuthToken(_0x239c60,_0x27503a,_0x417e29)[_0xbda7('0x10')](function(_0x27a956){var _0x29bee3=_0x417e29[_0xbda7('0x23')]()===_0xbda7('0x24')?_0x17f745[_0xbda7('0x25')]:_0x17f745['calleridnum'];var _0x480785={'method':'POST','uri':_0x4d0758+'contacts','body':{'telephone1':_0x29bee3,'fullname':_0x29bee3,'firstname':_0x29bee3,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x6a5ef6[_0xbda7('0x20')]+')'},'headers':{'Authorization':_0xbda7('0x17')+_0x27a956,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x480785);})[_0xbda7('0x10')](function(_0x4157b1){var _0x462c83=_0x4157b1[_0xbda7('0x26')][_0xbda7('0x27')];var _0x1d5294=_0x462c83[_0xbda7('0x28')](_0x462c83['lastIndexOf']('(')+0x1,_0x462c83[_0xbda7('0x29')](')'));_0x6a5ef6[_0xbda7('0x2a')]=_0x1d5294;_0x1add31(_0x6a5ef6);})['catch'](function(_0x5e3d39){_0x49ed7f(_0x5e3d39[_0xbda7('0x14')]);});});}function getEndUser(_0x266a63,_0x25265f,_0x1a7869,_0x592049,_0x5bd8cb,_0x424a73){return new BPromise(function(_0x54b7b5,_0x2bfb5b){return getAuthToken(_0x25265f,_0x1a7869,_0x424a73)['then'](function(_0x5a374a){var _0x1659a8={'method':_0xbda7('0x15'),'uri':_0x592049+_0xbda7('0x2b'),'headers':{'Authorization':_0xbda7('0x17')+_0x5a374a,'If-None-Match':null,'OData-Version':_0xbda7('0x18')},'json':!![]};return rp(_0x1659a8);})[_0xbda7('0x10')](function(_0x1cce83){var _0x129201=null;if(_0x1cce83){var _0xc33c4c=_0x1cce83[_0xbda7('0x2c')];var _0x5854d3=![];for(_0x129201=0x0;_0x129201<_0xc33c4c[_0xbda7('0x1c')];_0x129201++){var _0xaa1f12=_0x424a73['toLowerCase']()===_0xbda7('0x24')?_0x5bd8cb[_0xbda7('0x25')]:_0x5bd8cb[_0xbda7('0x2d')];if(_0xc33c4c[_0x129201][_0xbda7('0x2e')]===_0xaa1f12){_0x5854d3=!![];_0x266a63[_0xbda7('0x2a')]=_0xc33c4c[_0x129201]['contactid'];}}if(_0x5854d3){_0x54b7b5(_0x266a63);}else{return createEndUser(_0x266a63,_0x25265f,_0x1a7869,_0x592049,_0x5bd8cb,_0x424a73)['then'](function(_0x42a10d){logger['info']('['+[_0x424a73['toUpperCase']()]+']\x20Enduser\x20created!',_0x42a10d[_0xbda7('0x2a')]);_0x54b7b5(_0x42a10d);});}}else{return createEndUser(_0x266a63,_0x25265f,_0x1a7869,_0x592049,_0x5bd8cb,_0x424a73)[_0xbda7('0x10')](function(_0x5dd8b4){logger['info']('['+[_0x424a73[_0xbda7('0x21')]()]+_0xbda7('0x2f'),_0x5dd8b4[_0xbda7('0x2a')]);_0x54b7b5(_0x5dd8b4);});}});});}function getCustomFields(_0x187ae3,_0x28cb4d,_0x308b0f){var _0x3562e9={};if(_0x187ae3[_0xbda7('0x1c')]>0x0){_[_0xbda7('0x30')](_0x187ae3,function(_0x3e25b1){if(_0x3e25b1[_0xbda7('0x31')]==='string'&&_0x3e25b1[_0xbda7('0x32')]&&!_0x3e25b1[_0xbda7('0x33')]){var _0x1fee3f=_0x3e25b1['idField'][_0xbda7('0x23')]();var _0x2cfd4d=_0x1fee3f[_0xbda7('0x28')](0x0,_0x1fee3f[_0xbda7('0x34')]('_'));var _0x4710ca=_0x1fee3f['substring'](_0x1fee3f[_0xbda7('0x34')]('_')+0x1);if(_0x2cfd4d===_0x308b0f){_0x3562e9[_0x4710ca]=_0x3e25b1[_0xbda7('0x35')];}}});}return _0x3562e9;}function getTicket(_0xfd7615,_0xe1b5d5,_0x19ebb8,_0x559506,_0x2363c1,_0x569cc0,_0x1370ec){return new BPromise(function(_0x45bfe2,_0x57cb1a){var _0x200b24;return getAuthToken(_0xe1b5d5,_0x19ebb8,_0x1370ec)[_0xbda7('0x10')](function(_0x23f54a){if(_0x569cc0['ticketType']==='incident'){_0x200b24={'method':'POST','uri':_0x559506+_0xbda7('0x36'),'body':Object[_0xbda7('0x37')]({},{'title':intUtil[_0xbda7('0x38')](_0x569cc0['Subjects'],_0x2363c1,'\x20'),'description':intUtil['getString'](_0x569cc0[_0xbda7('0x39')],_0x2363c1,'\x0a'),'customerid_contact@odata.bind':_0xbda7('0x3a')+_0xfd7615[_0xbda7('0x2a')]+')','ownerid@odata.bind':_0xbda7('0x3b')+_0xfd7615[_0xbda7('0x20')]+')','caseorigincode':'1'},getCustomFields(_0x569cc0['Fields'],_0x2363c1,_0x569cc0[_0xbda7('0x3c')])),'headers':{'Authorization':_0xbda7('0x17')+_0x23f54a,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x569cc0[_0xbda7('0x3c')]==='phonecall'){_0x200b24={'method':'POST','uri':_0x559506+_0xbda7('0x3d'),'body':Object[_0xbda7('0x37')]({},{'subject':intUtil[_0xbda7('0x38')](_0x569cc0[_0xbda7('0x3e')],_0x2363c1,'\x20'),'phonenumber':String(_0x2363c1[_0xbda7('0x2d')]),'description':intUtil[_0xbda7('0x38')](_0x569cc0[_0xbda7('0x39')],_0x2363c1,'\x0a'),'regardingobjectid_contact@odata.bind':_0xbda7('0x3a')+_0xfd7615[_0xbda7('0x2a')]+')','ownerid@odata.bind':_0xbda7('0x3b')+_0xfd7615[_0xbda7('0x20')]+')','directioncode':_0xfd7615[_0xbda7('0x3f')]===_0xbda7('0x40')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xbda7('0x3b')+_0xfd7615[_0xbda7('0x20')]+')','participationtypemask':_0xfd7615[_0xbda7('0x3f')]===_0xbda7('0x40')?0x2:0x1},{'partyid_contact@odata.bind':_0xbda7('0x3a')+_0xfd7615[_0xbda7('0x2a')]+')','participationtypemask':_0xfd7615[_0xbda7('0x3f')]===_0xbda7('0x40')?0x1:0x2}]},getCustomFields(_0x569cc0[_0xbda7('0x41')],_0x2363c1,_0x569cc0[_0xbda7('0x3c')])),'headers':{'Authorization':_0xbda7('0x17')+_0x23f54a,'OData-Version':_0xbda7('0x18')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x200b24);})[_0xbda7('0x10')](function(_0xd4930d){var _0x420a11=_0xd4930d[_0xbda7('0x26')][_0xbda7('0x27')];var _0x487bab=_0x420a11[_0xbda7('0x28')](_0x420a11['lastIndexOf']('(')+0x1,_0x420a11[_0xbda7('0x29')](')'));_0xfd7615[_0xbda7('0x42')]=_0x487bab;_0x45bfe2(_0xfd7615);})[_0xbda7('0x12')](function(_0x3f8d9d){_0x57cb1a(_0x3f8d9d[_0xbda7('0x14')]);});});}function emit(_0x3847af,_0x3c551c,_0x2ec36e,_0x149a6f){var _0x28d513={'uri':util[_0xbda7('0x43')](_0xbda7('0x44'),_0x3847af,_0x2ec36e,_0x149a6f)};io['to'](util['format']('user:%s',_0x3c551c))[_0xbda7('0x45')](_0xbda7('0x46'),_0x28d513);}exports['cs']=function(_0x1512fc,_0x41a897,_0x236caf,_0x125ee8,_0x3f6cc1,_0x3f842b,_0x2d055a,_0x523f69){var _0x4d8d34={};_0x3f842b[_0xbda7('0xc')]=intUtil[_0xbda7('0x47')](_0x3f842b['remoteUri']);_0x3f842b[_0xbda7('0x48')]=intUtil[_0xbda7('0x47')](_0x3f842b[_0xbda7('0x48')]);_0x4d8d34['callDirection']=_0x523f69===_0xbda7('0x40')||_0x523f69===_0xbda7('0x49')?_0xbda7('0x40'):_0xbda7('0x24');var _0xf4d39a=util[_0xbda7('0x43')](_0xbda7('0x4a'),_0x3f842b[_0xbda7('0xc')]);var _0x238ebd=util[_0xbda7('0x43')](_0xbda7('0x4b'),_0x3f842b[_0xbda7('0x4c')]);var _0x17cc07=util[_0xbda7('0x43')](_0xbda7('0x4d'),_0x3f842b['serverUrl'],_0x41a897[_0xbda7('0x4e')],md5(_0x41a897[_0xbda7('0x4e')]));if(_0x3f6cc1&&_0x3f6cc1[_0xbda7('0x4f')]){logger[_0xbda7('0x1d')]('[QUEUE]',_0xbda7('0x50'));_0x41a897['recordingURL']=_0x17cc07;}else if(_0x2d055a&&_0x2d055a[_0xbda7('0x51')]&&_0x2d055a[_0xbda7('0x51')]!==_0xbda7('0x52')){logger['info'](_0xbda7('0x53'),_0xbda7('0x50'));_0x41a897[_0xbda7('0x54')]=_0x17cc07;}else{_0x41a897[_0xbda7('0x54')]='';}return getUser(_0x4d8d34,_0x3f842b,_0x125ee8,_0x238ebd,_0xf4d39a,_0x523f69)['then'](function(_0x4852e5){logger['info']('['+_0x523f69[_0xbda7('0x21')]()+_0xbda7('0x55'),_0x4852e5[_0xbda7('0x20')]);logger[_0xbda7('0x1d')]('['+_0x523f69[_0xbda7('0x21')]()+_0xbda7('0x56'),_0x4852e5[_0xbda7('0x22')]);return getEndUser(_0x4852e5,_0x3f842b,_0x238ebd,_0xf4d39a,_0x41a897,_0x523f69);})[_0xbda7('0x10')](function(_0x39db27){logger['info']('['+_0x523f69[_0xbda7('0x21')]()+']\x20The\x20Enduser\x20ID\x20is:',_0x39db27[_0xbda7('0x2a')]);logger[_0xbda7('0x1d')]('['+_0x523f69[_0xbda7('0x21')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x41a897[_0xbda7('0x2d')]);return getTicket(_0x39db27,_0x3f842b,_0x238ebd,_0xf4d39a,_0x41a897,_0x236caf,_0x523f69);})['then'](function(_0x2cd5ab){logger['info'](util[_0xbda7('0x43')]('['+_0x523f69[_0xbda7('0x21')]()+_0xbda7('0x57'),_0x236caf[_0xbda7('0x3c')],_0x2cd5ab['ticketId']));logger[_0xbda7('0x1d')](util[_0xbda7('0x43')]('['+_0x523f69[_0xbda7('0x21')]()+_0xbda7('0x58'),_0x523f69));if(_0x523f69!=='abandoned'){logger['info']('['+_0x523f69[_0xbda7('0x21')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3f842b[_0xbda7('0xc')],_0x125ee8[_0xbda7('0x59')],_0x236caf['ticketType'],_0x2cd5ab[_0xbda7('0x42')]);}})[_0xbda7('0x12')](function(_0x376e91){logger['error']('['+_0x523f69['toUpperCase']()+_0xbda7('0x5a'),util[_0xbda7('0x5b')](_0x376e91,{'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 d58a644..804a1e1 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 _0x5218=['ioredis','./util','../../../../config/environment','../../../../config/logger','redis','socket.io-emitter','application/json','info','Caller\x20-\x20%s','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20found!','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','map','forEach','type','toLowerCase','content','toString','string','idField','customField','variable','variableName','push','customVariable','Variable','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','%s/helpdesk/tickets/%d','catch','error','recordingFormat','none','[OUTBOUND]','destcalleridnum','[ABANDONED]','lodash','request-promise','util'];(function(_0x531c9b,_0x2b19b6){var _0x182336=function(_0x451fe6){while(--_0x451fe6){_0x531c9b['push'](_0x531c9b['shift']());}};_0x182336(++_0x2b19b6);}(_0x5218,0xa7));var _0x8521=function(_0x95f06,_0x371032){_0x95f06=_0x95f06-0x0;var _0x36aff0=_0x5218[_0x95f06];return _0x36aff0;};'use strict';var _=require(_0x8521('0x0'));var rp=require(_0x8521('0x1'));var md5=require('md5');var util=require(_0x8521('0x2'));var Redis=require(_0x8521('0x3'));var intUtil=require(_0x8521('0x4'));var config=require(_0x8521('0x5'));var logger=require(_0x8521('0x6'))('freshdesk');config['redis']=_['defaults'](config[_0x8521('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x8521('0x8'))(new Redis(config['redis']));var headers={'Content-Type':_0x8521('0x9'),'Accept':_0x8521('0x9')};function emit(_0x5a1adc,_0x22328d,_0x51be70){io['to'](_0x5a1adc)['emit'](_0x22328d,_0x51be70);}function getTicket(_0x214b14,_0x55a312,_0x1707c6,_0x297a64,_0x28a3fa){logger[_0x8521('0xa')]('Creating\x20new\x20ticket...');var _0x50d5e1=_['merge']({'responder_id':_0x55a312['id'],'requester_id':_0x1707c6['id'],'name':util['format'](_0x8521('0xb'),_0x28a3fa['calleridname']),'phone':_0x28a3fa[_0x8521('0xc')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x8521('0xd')](_0x297a64[_0x8521('0xe')],_0x28a3fa,'\x20'),'description':intUtil[_0x8521('0xd')](_0x297a64[_0x8521('0xf')],_0x28a3fa,_0x8521('0x10')),'tags':getTags(_0x297a64[_0x8521('0x11')],_0x8521('0x12'))},getCustomFields(_0x297a64[_0x8521('0x13')],_0x28a3fa));_0x50d5e1['custom_fields']=_[_0x8521('0x14')](_[_0x8521('0x15')](_0x50d5e1[_0x8521('0x16')],'id'),_0x8521('0x17'));return request({'uri':util['format'](_0x8521('0x18'),_0x214b14[_0x8521('0x19')]),'method':_0x8521('0x1a'),'body':_0x50d5e1})[_0x8521('0x1b')](function(_0x532a4d){logger['info'](_0x8521('0x1c'));return _0x532a4d;});}function getUser(_0x5c25f3,_0x170129){if(intUtil[_0x8521('0x1d')](_0x170129)){return request({'uri':util[_0x8521('0x1e')](_0x8521('0x1f'),_0x5c25f3[_0x8521('0x19')]),'qs':{'email':_0x170129}})['then'](function(_0xa46393){if(_0xa46393[_0x8521('0x20')]){logger[_0x8521('0xa')](_0x8521('0x21'));return _[_0x8521('0x22')](_0xa46393,function(_0x43b796){return _0x43b796[_0x8521('0x23')][_0x8521('0x24')]===_0x170129;});}else{logger[_0x8521('0xa')](_0x8521('0x25'));return request({'uri':util['format']('%s/api/v2/agents/me',_0x5c25f3['remoteUri'])})[_0x8521('0x1b')](function(_0x42363b){logger['info']('Admin\x20account\x20selected.');return _0x42363b;});}});}else{logger['info']('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x8521('0x1e')]('%s/api/v2/agents/me',_0x5c25f3[_0x8521('0x19')])})[_0x8521('0x1b')](function(_0x5eee15){logger[_0x8521('0xa')](_0x8521('0x26'));return _0x5eee15;});}}function getEndUser(_0xb20e6d,_0x4a57f2,_0x526c1b){logger[_0x8521('0xa')](_0x8521('0x27'),_0x526c1b);return request({'uri':util[_0x8521('0x1e')](_0x8521('0x28'),_0xb20e6d[_0x8521('0x19')]),'qs':{'phone':_0x526c1b}})['then'](function(_0x4f3793){if(_0x4f3793['length']){logger[_0x8521('0xa')](_0x8521('0x29'));return _[_0x8521('0x22')](_0x4f3793,{'phone':_0x526c1b});}else{logger[_0x8521('0xa')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x8521('0x1e')](_0x8521('0x28'),_0xb20e6d['remoteUri']),'method':_0x8521('0x1a'),'body':{'name':_0x4a57f2,'phone':_0x526c1b}})[_0x8521('0x1b')](function(_0x60a446){logger[_0x8521('0xa')]('Enduser\x20created.');return _0x60a446;});}});}function getAuth(_0x3f6be7){return util[_0x8521('0x1e')](_0x8521('0x2a'),new Buffer(_0x3f6be7[_0x8521('0x2b')]+':X')['toString'](_0x8521('0x2c')));}function request(_0xf650b5){logger[_0x8521('0x2d')](_0x8521('0x2e'),JSON[_0x8521('0x2f')](_0xf650b5));return rp(_['defaults'](_0xf650b5,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x268727,_0x229efc){var _0x573965=[];if(_0x268727&&_0x268727[_0x8521('0x20')]>0x0){_0x573965=_[_0x8521('0x30')](_0x268727,_0x229efc);}return _0x573965;}function getCustomFields(_0x2d3b84,_0x1814b5){var _0x26bab8=[];var _0x30449b={'custom_fields':[]};if(_0x2d3b84[_0x8521('0x20')]>0x0){_[_0x8521('0x31')](_0x2d3b84,function(_0x487c3c){if(_0x487c3c[_0x8521('0x32')]==='string'&&_0x487c3c['nameField']&&!_0x487c3c['customField']){_0x30449b[_0x487c3c['nameField'][_0x8521('0x33')]()]=_0x487c3c[_0x8521('0x34')][_0x8521('0x35')]();}else if(_0x487c3c[_0x8521('0x32')]===_0x8521('0x36')&&_0x487c3c[_0x8521('0x37')]&&_0x487c3c[_0x8521('0x38')]){_0x30449b[_0x8521('0x16')]['push']({'id':_0x487c3c[_0x8521('0x37')],'value':_0x487c3c[_0x8521('0x34')][_0x8521('0x35')]()});}else if(_0x487c3c[_0x8521('0x32')]===_0x8521('0x39')&&_0x487c3c[_0x8521('0x3a')]&&_0x487c3c[_0x8521('0x37')]&&_0x487c3c[_0x8521('0x38')]){_0x1814b5[_0x487c3c[_0x8521('0x3a')]]&&_0x30449b[_0x8521('0x16')][_0x8521('0x3b')]({'id':_0x487c3c['idField'],'value':_0x1814b5[_0x487c3c[_0x8521('0x3a')]][_0x8521('0x35')]()});}else if(_0x487c3c['type']===_0x8521('0x3c')&&_0x487c3c[_0x8521('0x3d')]&&_0x487c3c[_0x8521('0x3d')][_0x8521('0x12')]&&_0x487c3c[_0x8521('0x37')]&&_0x487c3c[_0x8521('0x38')]){_0x1814b5[_0x487c3c['Variable']['name'][_0x8521('0x33')]()]&&_0x30449b[_0x8521('0x16')][_0x8521('0x3b')]({'id':_0x487c3c[_0x8521('0x37')],'value':_0x1814b5[_0x487c3c['Variable'][_0x8521('0x12')][_0x8521('0x33')]()][_0x8521('0x35')]()});}});}return _0x30449b;}exports[_0x8521('0x3e')]=function(_0x132cfc,_0x57148d,_0x4f9bc1,_0x4e33f7,_0x45f414,_0x192a42){var _0x5d7093,_0x11ca3d;_0x192a42[_0x8521('0x19')]=intUtil[_0x8521('0x3f')](_0x192a42['remoteUri']);_0x192a42[_0x8521('0x40')]=intUtil[_0x8521('0x3f')](_0x192a42[_0x8521('0x40')]);if(_0x45f414&&_0x45f414[_0x8521('0x41')]){logger[_0x8521('0xa')](_0x8521('0x42'),_0x8521('0x43'));_0x57148d[_0x8521('0x44')]=util['format'](_0x8521('0x45'),_0x192a42[_0x8521('0x40')],_0x57148d[_0x8521('0x46')],md5(_0x57148d[_0x8521('0x46')]));}else{_0x57148d[_0x8521('0x44')]='';}headers[_0x8521('0x47')]=getAuth(_0x192a42);return getUser(_0x192a42,_0x4e33f7['email'])['then'](function(_0x2b7f77){_0x5d7093=_0x2b7f77;logger[_0x8521('0xa')](_0x8521('0x48'),_0x5d7093['id']);return getEndUser(_0x192a42,_0x57148d['calleridname'],_0x57148d[_0x8521('0xc')]);})[_0x8521('0x1b')](function(_0x235e95){_0x11ca3d=_0x235e95;logger[_0x8521('0xa')](_0x8521('0x49'),_0x11ca3d['id']);return getTicket(_0x192a42,_0x5d7093,_0x11ca3d,_0x4f9bc1,_0x57148d);})[_0x8521('0x1b')](function(_0x2b787e){if(_0x2b787e&&_0x2b787e['id']){logger[_0x8521('0xa')](_0x8521('0x1c'));logger['info'](_0x8521('0x4a'),_0x2b787e['id']);logger[_0x8521('0xa')](_0x8521('0x42'),_0x8521('0x4b'));emit(util[_0x8521('0x1e')](_0x8521('0x4c'),_0x4e33f7['name']),'trigger:browser:url',{'uri':util['format'](_0x8521('0x4d'),_0x192a42[_0x8521('0x19')],_0x2b787e['id'])});}})[_0x8521('0x4e')](function(_0x3536a4){logger[_0x8521('0x4f')](_0x8521('0x42'),JSON[_0x8521('0x2f')](_0x3536a4));});};exports['outbound']=function(_0x4942ce,_0x141408,_0xb6eef6,_0x466c5f,_0x2b26d7,_0xed18a1,_0x43f42c){var _0x30efa6,_0x150821;_0xed18a1[_0x8521('0x19')]=intUtil['stripTrailingSlash'](_0xed18a1[_0x8521('0x19')]);_0xed18a1[_0x8521('0x40')]=intUtil[_0x8521('0x3f')](_0xed18a1[_0x8521('0x40')]);if(_0x43f42c&&_0x43f42c['recordingFormat']&&_0x43f42c[_0x8521('0x50')]!==_0x8521('0x51')){logger['info'](_0x8521('0x52'),_0x8521('0x43'));_0x141408['recordingURL']=util[_0x8521('0x1e')](_0x8521('0x45'),_0xed18a1['serverUrl'],_0x141408[_0x8521('0x46')],md5(_0x141408[_0x8521('0x46')]));}headers[_0x8521('0x47')]=getAuth(_0xed18a1);return getUser(_0xed18a1,_0x466c5f['email'])[_0x8521('0x1b')](function(_0x566579){_0x30efa6=_0x566579;logger['info']('The\x20User\x20ID\x20is:',_0x30efa6['id']);return getEndUser(_0xed18a1,_0x141408['destcalleridname'],_0x141408[_0x8521('0x53')]);})['then'](function(_0x448090){_0x150821=_0x448090;logger[_0x8521('0xa')](_0x8521('0x49'),_0x150821['id']);return getTicket(_0xed18a1,_0x30efa6,_0x150821,_0xb6eef6,_0x141408);})['then'](function(_0x2dd18c){if(_0x2dd18c&&_0x2dd18c['id']){logger['info'](_0x8521('0x1c'));logger[_0x8521('0xa')]('The\x20Ticket\x20ID\x20is:',_0x2dd18c['id']);logger[_0x8521('0xa')](_0x8521('0x52'),_0x8521('0x4b'));emit(util['format'](_0x8521('0x4c'),_0x466c5f[_0x8521('0x12')]),'trigger:browser:url',{'uri':util[_0x8521('0x1e')](_0x8521('0x4d'),_0xed18a1['remoteUri'],_0x2dd18c['id'])});}})[_0x8521('0x4e')](function(_0x5b2cf6){logger[_0x8521('0x4f')](_0x8521('0x52'),JSON[_0x8521('0x2f')](_0x5b2cf6));});};exports['abandoned']=function(_0x5c2bd6,_0x28759b,_0x432dfe,_0x19aa4c,_0x8cf819,_0x23b5b0){var _0x492251,_0x1522d0;_0x23b5b0['remoteUri']=intUtil[_0x8521('0x3f')](_0x23b5b0[_0x8521('0x19')]);_0x23b5b0['serverUrl']=intUtil[_0x8521('0x3f')](_0x23b5b0[_0x8521('0x40')]);if(_0x8cf819&&_0x8cf819[_0x8521('0x41')]){logger[_0x8521('0xa')](_0x8521('0x54'),_0x8521('0x43'));_0x28759b[_0x8521('0x44')]=util[_0x8521('0x1e')](_0x8521('0x45'),_0x23b5b0[_0x8521('0x40')],_0x28759b[_0x8521('0x46')],md5(_0x28759b[_0x8521('0x46')]));}else{_0x28759b[_0x8521('0x44')]='';}headers[_0x8521('0x47')]=getAuth(_0x23b5b0);return getUser(_0x23b5b0,'')[_0x8521('0x1b')](function(_0x441b05){_0x492251=_0x441b05;logger[_0x8521('0xa')]('The\x20User\x20ID\x20is:',_0x492251['id']);return getEndUser(_0x23b5b0,_0x28759b['calleridname'],_0x28759b[_0x8521('0xc')]);})[_0x8521('0x1b')](function(_0x5e2b03){_0x1522d0=_0x5e2b03;logger[_0x8521('0xa')](_0x8521('0x49'),_0x1522d0['id']);return getTicket(_0x23b5b0,_0x492251,_0x1522d0,_0x432dfe,_0x28759b);})['then'](function(_0xcf42b){if(_0xcf42b){logger['info'](_0x8521('0x1c'));logger['info'](_0x8521('0x4a'),_0xcf42b['id']);}})[_0x8521('0x4e')](function(_0x29c722){logger['error']('[ABANDONED]',JSON['stringify'](_0x29c722));});}; \ No newline at end of file +var _0x5252=['util','../../../../config/environment','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','info','Creating\x20new\x20ticket...','merge','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Descriptions','
','Tags','name','Fields','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','then','Ticket\x20created!','validateEmail','%s/api/v2/agents','length','find','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','debug','[HTTP]','type','string','nameField','customField','toLowerCase','idField','content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','catch','error','stringify','outbound','recordingFormat','none','destcalleridnum','The\x20Enduser\x20ID\x20is:','user:%s','[OUTBOUND]','abandoned','Authorization','[ABANDONED]','md5'];(function(_0x25a574,_0x932152){var _0x2e0f19=function(_0x5b75a3){while(--_0x5b75a3){_0x25a574['push'](_0x25a574['shift']());}};_0x2e0f19(++_0x932152);}(_0x5252,0x1b2));var _0x2525=function(_0xbecea,_0x905b78){_0xbecea=_0xbecea-0x0;var _0x5aed20=_0x5252[_0xbecea];return _0x5aed20;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x2525('0x0'));var util=require(_0x2525('0x1'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x2525('0x2'));var logger=require(_0x2525('0x3'))(_0x2525('0x4'));config[_0x2525('0x5')]=_[_0x2525('0x6')](config[_0x2525('0x5')],{'host':_0x2525('0x7'),'port':0x18eb});var io=require(_0x2525('0x8'))(new Redis(config[_0x2525('0x5')]));var headers={'Content-Type':_0x2525('0x9'),'Accept':_0x2525('0x9')};function emit(_0x4f6f80,_0xcca4bf,_0x3a7e49){io['to'](_0x4f6f80)['emit'](_0xcca4bf,_0x3a7e49);}function getTicket(_0x5c16c1,_0x3d8c57,_0x5ca5fa,_0x12f126,_0x200b24){logger[_0x2525('0xa')](_0x2525('0xb'));var _0x28a669=_[_0x2525('0xc')]({'responder_id':_0x3d8c57['id'],'requester_id':_0x5ca5fa['id'],'name':util[_0x2525('0xd')](_0x2525('0xe'),_0x200b24[_0x2525('0xf')]),'phone':_0x200b24[_0x2525('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x2525('0x11')](_0x12f126['Subjects'],_0x200b24,'\x20'),'description':intUtil[_0x2525('0x11')](_0x12f126[_0x2525('0x12')],_0x200b24,_0x2525('0x13')),'tags':getTags(_0x12f126[_0x2525('0x14')],_0x2525('0x15'))},getCustomFields(_0x12f126[_0x2525('0x16')],_0x200b24));_0x28a669[_0x2525('0x17')]=_['mapValues'](_[_0x2525('0x18')](_0x28a669[_0x2525('0x17')],'id'),_0x2525('0x19'));return request({'uri':util['format'](_0x2525('0x1a'),_0x5c16c1[_0x2525('0x1b')]),'method':_0x2525('0x1c'),'body':_0x28a669})[_0x2525('0x1d')](function(_0x5d98c0){logger['info'](_0x2525('0x1e'));return _0x5d98c0;});}function getUser(_0xa06f66,_0xcd159e){if(intUtil[_0x2525('0x1f')](_0xcd159e)){return request({'uri':util[_0x2525('0xd')](_0x2525('0x20'),_0xa06f66[_0x2525('0x1b')]),'qs':{'email':_0xcd159e}})[_0x2525('0x1d')](function(_0x1eed65){if(_0x1eed65[_0x2525('0x21')]){logger[_0x2525('0xa')]('Agent\x20found!');return _[_0x2525('0x22')](_0x1eed65,function(_0x18147c){return _0x18147c['contact']['email']===_0xcd159e;});}else{logger[_0x2525('0xa')](_0x2525('0x23'));return request({'uri':util[_0x2525('0xd')](_0x2525('0x24'),_0xa06f66[_0x2525('0x1b')])})[_0x2525('0x1d')](function(_0x503917){logger[_0x2525('0xa')]('Admin\x20account\x20selected.');return _0x503917;});}});}else{logger[_0x2525('0xa')]('Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x2525('0xd')]('%s/api/v2/agents/me',_0xa06f66['remoteUri'])})[_0x2525('0x1d')](function(_0x32555c){logger['info']('Admin\x20account\x20selected.');return _0x32555c;});}}function getEndUser(_0x40eb21,_0x438553,_0x39e763){logger[_0x2525('0xa')]('Searching\x20enduser\x20with\x20phone',_0x39e763);return request({'uri':util[_0x2525('0xd')](_0x2525('0x25'),_0x40eb21['remoteUri']),'qs':{'phone':_0x39e763}})['then'](function(_0x39f9c6){if(_0x39f9c6['length']){logger['info'](_0x2525('0x26'));return _[_0x2525('0x22')](_0x39f9c6,{'phone':_0x39e763});}else{logger[_0x2525('0xa')](_0x2525('0x27'));return request({'uri':util[_0x2525('0xd')]('%s/api/v2/contacts',_0x40eb21['remoteUri']),'method':'POST','body':{'name':_0x438553,'phone':_0x39e763}})[_0x2525('0x1d')](function(_0xee7503){logger['info'](_0x2525('0x28'));return _0xee7503;});}});}function getAuth(_0x31201a){return util[_0x2525('0xd')](_0x2525('0x29'),new Buffer(_0x31201a[_0x2525('0x2a')]+':X')[_0x2525('0x2b')](_0x2525('0x2c')));}function request(_0x3da49b){logger[_0x2525('0x2d')](_0x2525('0x2e'),JSON['stringify'](_0x3da49b));return rp(_[_0x2525('0x6')](_0x3da49b,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x1e53d5,_0x50f0bf){var _0x16c364=[];if(_0x1e53d5&&_0x1e53d5[_0x2525('0x21')]>0x0){_0x16c364=_['map'](_0x1e53d5,_0x50f0bf);}return _0x16c364;}function getCustomFields(_0x47bb94,_0x35451c){var _0x1f3bbb=[];var _0x278bb2={'custom_fields':[]};if(_0x47bb94[_0x2525('0x21')]>0x0){_['forEach'](_0x47bb94,function(_0x5c0d2f){if(_0x5c0d2f[_0x2525('0x2f')]===_0x2525('0x30')&&_0x5c0d2f[_0x2525('0x31')]&&!_0x5c0d2f[_0x2525('0x32')]){_0x278bb2[_0x5c0d2f['nameField'][_0x2525('0x33')]()]=_0x5c0d2f['content'][_0x2525('0x2b')]();}else if(_0x5c0d2f['type']==='string'&&_0x5c0d2f[_0x2525('0x34')]&&_0x5c0d2f[_0x2525('0x32')]){_0x278bb2[_0x2525('0x17')]['push']({'id':_0x5c0d2f[_0x2525('0x34')],'value':_0x5c0d2f[_0x2525('0x35')][_0x2525('0x2b')]()});}else if(_0x5c0d2f[_0x2525('0x2f')]===_0x2525('0x36')&&_0x5c0d2f[_0x2525('0x37')]&&_0x5c0d2f[_0x2525('0x34')]&&_0x5c0d2f[_0x2525('0x32')]){_0x35451c[_0x5c0d2f[_0x2525('0x37')]]&&_0x278bb2[_0x2525('0x17')][_0x2525('0x38')]({'id':_0x5c0d2f['idField'],'value':_0x35451c[_0x5c0d2f[_0x2525('0x37')]][_0x2525('0x2b')]()});}else if(_0x5c0d2f[_0x2525('0x2f')]===_0x2525('0x39')&&_0x5c0d2f['Variable']&&_0x5c0d2f[_0x2525('0x3a')][_0x2525('0x15')]&&_0x5c0d2f[_0x2525('0x34')]&&_0x5c0d2f['customField']){_0x35451c[_0x5c0d2f['Variable']['name']['toLowerCase']()]&&_0x278bb2['custom_fields'][_0x2525('0x38')]({'id':_0x5c0d2f['idField'],'value':_0x35451c[_0x5c0d2f[_0x2525('0x3a')][_0x2525('0x15')][_0x2525('0x33')]()]['toString']()});}});}return _0x278bb2;}exports[_0x2525('0x3b')]=function(_0x225f33,_0x5e6143,_0x1c7380,_0x542e61,_0x4a564f,_0x23ac21){var _0x41a391,_0x498f10;_0x23ac21[_0x2525('0x1b')]=intUtil[_0x2525('0x3c')](_0x23ac21[_0x2525('0x1b')]);_0x23ac21[_0x2525('0x3d')]=intUtil['stripTrailingSlash'](_0x23ac21[_0x2525('0x3d')]);if(_0x4a564f&&_0x4a564f[_0x2525('0x3e')]){logger[_0x2525('0xa')](_0x2525('0x3f'),_0x2525('0x40'));_0x5e6143['recordingURL']=util[_0x2525('0xd')](_0x2525('0x41'),_0x23ac21[_0x2525('0x3d')],_0x5e6143[_0x2525('0x42')],md5(_0x5e6143[_0x2525('0x42')]));}else{_0x5e6143[_0x2525('0x43')]='';}headers['Authorization']=getAuth(_0x23ac21);return getUser(_0x23ac21,_0x542e61[_0x2525('0x44')])[_0x2525('0x1d')](function(_0x838866){_0x41a391=_0x838866;logger[_0x2525('0xa')](_0x2525('0x45'),_0x41a391['id']);return getEndUser(_0x23ac21,_0x5e6143[_0x2525('0xf')],_0x5e6143[_0x2525('0x10')]);})[_0x2525('0x1d')](function(_0x40949f){_0x498f10=_0x40949f;logger[_0x2525('0xa')]('The\x20Enduser\x20ID\x20is:',_0x498f10['id']);return getTicket(_0x23ac21,_0x41a391,_0x498f10,_0x1c7380,_0x5e6143);})['then'](function(_0xa299fa){if(_0xa299fa&&_0xa299fa['id']){logger[_0x2525('0xa')](_0x2525('0x1e'));logger[_0x2525('0xa')](_0x2525('0x46'),_0xa299fa['id']);logger[_0x2525('0xa')](_0x2525('0x3f'),_0x2525('0x47'));emit(util[_0x2525('0xd')]('user:%s',_0x542e61[_0x2525('0x15')]),_0x2525('0x48'),{'uri':util[_0x2525('0xd')](_0x2525('0x49'),_0x23ac21[_0x2525('0x1b')],_0xa299fa['id'])});}})[_0x2525('0x4a')](function(_0xf7e7ab){logger[_0x2525('0x4b')](_0x2525('0x3f'),JSON[_0x2525('0x4c')](_0xf7e7ab));});};exports[_0x2525('0x4d')]=function(_0x5d4056,_0x4caf6a,_0x3d23c2,_0x4af050,_0x14bcf2,_0x3476af,_0x248c7a){var _0x47cbac,_0x1bb86d;_0x3476af[_0x2525('0x1b')]=intUtil[_0x2525('0x3c')](_0x3476af['remoteUri']);_0x3476af[_0x2525('0x3d')]=intUtil['stripTrailingSlash'](_0x3476af[_0x2525('0x3d')]);if(_0x248c7a&&_0x248c7a[_0x2525('0x4e')]&&_0x248c7a[_0x2525('0x4e')]!==_0x2525('0x4f')){logger[_0x2525('0xa')]('[OUTBOUND]','Recording\x20is\x20enabled!');_0x4caf6a['recordingURL']=util['format'](_0x2525('0x41'),_0x3476af[_0x2525('0x3d')],_0x4caf6a[_0x2525('0x42')],md5(_0x4caf6a[_0x2525('0x42')]));}headers['Authorization']=getAuth(_0x3476af);return getUser(_0x3476af,_0x4af050[_0x2525('0x44')])[_0x2525('0x1d')](function(_0x112ae8){_0x47cbac=_0x112ae8;logger[_0x2525('0xa')](_0x2525('0x45'),_0x47cbac['id']);return getEndUser(_0x3476af,_0x4caf6a['destcalleridname'],_0x4caf6a[_0x2525('0x50')]);})[_0x2525('0x1d')](function(_0x4547a0){_0x1bb86d=_0x4547a0;logger[_0x2525('0xa')](_0x2525('0x51'),_0x1bb86d['id']);return getTicket(_0x3476af,_0x47cbac,_0x1bb86d,_0x3d23c2,_0x4caf6a);})[_0x2525('0x1d')](function(_0x53cb46){if(_0x53cb46&&_0x53cb46['id']){logger[_0x2525('0xa')]('Ticket\x20created!');logger[_0x2525('0xa')](_0x2525('0x46'),_0x53cb46['id']);logger['info']('[OUTBOUND]',_0x2525('0x47'));emit(util['format'](_0x2525('0x52'),_0x4af050[_0x2525('0x15')]),_0x2525('0x48'),{'uri':util[_0x2525('0xd')]('%s/helpdesk/tickets/%d',_0x3476af[_0x2525('0x1b')],_0x53cb46['id'])});}})[_0x2525('0x4a')](function(_0x49e605){logger[_0x2525('0x4b')](_0x2525('0x53'),JSON[_0x2525('0x4c')](_0x49e605));});};exports[_0x2525('0x54')]=function(_0x591bae,_0xffa625,_0x21d99a,_0x545d49,_0x4d2776,_0x230cd8){var _0x50dc9e,_0x7d49e4;_0x230cd8[_0x2525('0x1b')]=intUtil[_0x2525('0x3c')](_0x230cd8['remoteUri']);_0x230cd8[_0x2525('0x3d')]=intUtil[_0x2525('0x3c')](_0x230cd8['serverUrl']);if(_0x4d2776&&_0x4d2776['monitor_format']){logger['info']('[ABANDONED]','Recording\x20is\x20enabled!');_0xffa625[_0x2525('0x43')]=util[_0x2525('0xd')](_0x2525('0x41'),_0x230cd8[_0x2525('0x3d')],_0xffa625[_0x2525('0x42')],md5(_0xffa625['uniqueid']));}else{_0xffa625['recordingURL']='';}headers[_0x2525('0x55')]=getAuth(_0x230cd8);return getUser(_0x230cd8,'')['then'](function(_0x45617b){_0x50dc9e=_0x45617b;logger[_0x2525('0xa')](_0x2525('0x45'),_0x50dc9e['id']);return getEndUser(_0x230cd8,_0xffa625[_0x2525('0xf')],_0xffa625[_0x2525('0x10')]);})[_0x2525('0x1d')](function(_0x4a12de){_0x7d49e4=_0x4a12de;logger['info'](_0x2525('0x51'),_0x7d49e4['id']);return getTicket(_0x230cd8,_0x50dc9e,_0x7d49e4,_0x21d99a,_0xffa625);})[_0x2525('0x1d')](function(_0x14c353){if(_0x14c353){logger[_0x2525('0xa')](_0x2525('0x1e'));logger[_0x2525('0xa')]('The\x20Ticket\x20ID\x20is:',_0x14c353['id']);}})[_0x2525('0x4a')](function(_0x387ae2){logger[_0x2525('0x4b')](_0x2525('0x56'),JSON['stringify'](_0x387ae2));});}; \ 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 dd0dfb8..41d0a36 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 _0xad77=['task','Task\x20created:','/contacts/','user:%s','emit','Token\x20token=','apiKey','remoteUri','serverUrl','stripTrailingSlash','toLowerCase','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','recordingURL','Displaying\x20task\x20in\x20a\x20new\x20tab...','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','defaults','redis','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','message','/api/selector/owners','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','length','User\x20found:','userId','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','/api/contacts/view/','Searching\x20contact\x20with\x20phone','contactNumber','contacts','find','mobile_number','endUserId','Contact\x20found:','Contact\x20created:','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','toUpperCase','POST','Subjects','getString','Contact','format','add','ticketId'];(function(_0x41d6fd,_0x1b580f){var _0x3764fb=function(_0x2afa62){while(--_0x2afa62){_0x41d6fd['push'](_0x41d6fd['shift']());}};_0x3764fb(++_0x1b580f);}(_0xad77,0x1bd));var _0x7ad7=function(_0x33190c,_0x483589){_0x33190c=_0x33190c-0x0;var _0x465647=_0xad77[_0x33190c];return _0x465647;};'use strict';var _=require(_0x7ad7('0x0'));var rp=require(_0x7ad7('0x1'));var md5=require('md5');var util=require(_0x7ad7('0x2'));var moment=require(_0x7ad7('0x3'));var Promise=require(_0x7ad7('0x4'));var Redis=require(_0x7ad7('0x5'));var intUtil=require(_0x7ad7('0x6'));var config=require(_0x7ad7('0x7'));var logger=require(_0x7ad7('0x8'))(_0x7ad7('0x9'));config['redis']=_[_0x7ad7('0xa')](config[_0x7ad7('0xb')],{'host':'localhost','port':0x18eb});var io=require(_0x7ad7('0xc'))(new Redis(config['redis']));function getAdminId(_0x2bb0a6,_0x3c4ae9,_0x4126a,_0x585109){return new Promise(function(_0x4b568a,_0x2ca730){var _0x2216c6=![];var _0x309234={'method':_0x7ad7('0xd'),'uri':_0x585109+'/api/selector/owners','json':!![]};_0x309234[_0x7ad7('0xe')]=_0x4126a;logger[_0x7ad7('0xf')](_0x7ad7('0x10'));return rp(_0x309234)[_0x7ad7('0x11')](function(_0x2a5e95){if(_0x2a5e95){var _0x270082=_0x2a5e95[_0x7ad7('0x12')];var _0x389b5f=null;for(_0x389b5f=0x0;_0x389b5f<_0x270082['length'];_0x389b5f++){if(_0x270082[_0x389b5f][_0x7ad7('0x13')]===_0x2bb0a6[_0x7ad7('0x14')]){_0x2bb0a6[_0x7ad7('0x15')]=_0x270082[_0x389b5f]['id'];_0x2216c6=!![];}}if(_0x2216c6){logger[_0x7ad7('0xf')](_0x7ad7('0x16'),_0x2bb0a6[_0x7ad7('0x15')]);_0x4b568a(_0x2bb0a6);}else{_0x2ca730({'statusCode':0x194,'message':_0x7ad7('0x17')});}}else{_0x2ca730({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7ad7('0x18')](function(_0x3b453e){logger[_0x7ad7('0x19')]('['+[_0x3c4ae9['toUpperCase']()]+']',_0x3b453e[_0x7ad7('0x1a')]);_0x2ca730(_0x3b453e);});});}function getUser(_0x218f13,_0x4d40fe,_0x58c9da){return function(_0x103c1c){return new Promise(function(_0x24f21e,_0x1b7119){var _0x450116={'method':_0x7ad7('0xd'),'uri':_0x58c9da+_0x7ad7('0x1b'),'json':!![]};_0x450116[_0x7ad7('0xe')]=_0x4d40fe;logger[_0x7ad7('0xf')](_0x7ad7('0x1c'));return rp(_0x450116)['then'](function(_0x477762){if(_0x477762){var _0x566b0c=_0x477762['users'];var _0x1f1fa0=![];var _0x93c374=null;if(_0x103c1c[_0x7ad7('0x1d')]!==null){logger[_0x7ad7('0xf')](_0x7ad7('0x1e'),_0x103c1c[_0x7ad7('0x1d')]);_0x103c1c[_0x7ad7('0x1f')]=_0x103c1c[_0x7ad7('0x1d')];for(_0x93c374=0x0;_0x93c374<_0x566b0c[_0x7ad7('0x20')];_0x93c374++){if(_0x566b0c[_0x93c374][_0x7ad7('0x13')]===_0x103c1c[_0x7ad7('0x1d')]){_0x1f1fa0=!![];_0x103c1c['userId']=_0x566b0c[_0x93c374]['id'];logger[_0x7ad7('0xf')](_0x7ad7('0x21'),_0x103c1c[_0x7ad7('0x22')]);}}}if(!_0x1f1fa0){logger[_0x7ad7('0xf')]('Admin\x20selected');_0x103c1c[_0x7ad7('0x1f')]=_0x103c1c[_0x7ad7('0x14')];_0x103c1c[_0x7ad7('0x22')]=_0x103c1c[_0x7ad7('0x15')];_0x1f1fa0=!![];}if(_0x1f1fa0){_0x24f21e(_0x103c1c);}else{_0x1b7119({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x1b7119({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x7ad7('0x18')](function(_0x149974){logger[_0x7ad7('0x19')]('['+[_0x218f13['toUpperCase']()]+']',_0x149974[_0x7ad7('0x1a')]);_0x1b7119(_0x149974);});});};}function getEndUser(_0x264c30,_0x67091b,_0x38fd77){return function(_0x26c387){return new Promise(function(_0x26cc03,_0x5c1468){var _0x40a5e5=0x0;var _0x584677={'method':'GET','uri':_0x38fd77+_0x7ad7('0x23'),'json':!![]};_0x584677[_0x7ad7('0xe')]=_0x67091b;logger['info'](_0x7ad7('0x24'));return rp(_0x584677)['then'](function(_0x408d15){_0x408d15[_0x7ad7('0x25')][_0x7ad7('0x26')](function(_0x56d080){if(_0x56d080[_0x7ad7('0x27')]==='All\x20Contacts'){_0x40a5e5=_0x56d080['id'];}});})[_0x7ad7('0x11')](function(){logger['info']('Getting\x20contact\x20list');var _0x4b14b1={'method':_0x7ad7('0xd'),'uri':_0x38fd77+_0x7ad7('0x28')+_0x40a5e5,'json':!![]};_0x4b14b1['headers']=_0x67091b;return rp(_0x4b14b1);})[_0x7ad7('0x11')](function(_0x18177c){logger[_0x7ad7('0xf')](_0x7ad7('0x29'),_0x26c387[_0x7ad7('0x2a')]);if(_0x18177c[_0x7ad7('0x2b')][_0x7ad7('0x20')]>0x0){var _0x3e5ada=_[_0x7ad7('0x2c')](_0x18177c[_0x7ad7('0x2b')],function(_0x157fdb){if(_0x157fdb['work_number']===_0x26c387['contactNumber']||_0x157fdb[_0x7ad7('0x2d')]===_0x26c387[_0x7ad7('0x2a')]){return _0x157fdb;}});if(_0x3e5ada){_0x26c387[_0x7ad7('0x2e')]=_0x3e5ada['id'];logger[_0x7ad7('0xf')](_0x7ad7('0x2f'),_0x26c387[_0x7ad7('0x2e')]);_0x26cc03(_0x26c387);}else{return createEndUser(_0x26c387,_0x264c30,_0x67091b,_0x38fd77)[_0x7ad7('0x11')](function(_0x270a5b){logger[_0x7ad7('0xf')](_0x7ad7('0x30'),_0x26c387[_0x7ad7('0x2e')]);_0x26cc03(_0x270a5b);});}}else{return createEndUser(_0x26c387,_0x264c30,_0x67091b,_0x38fd77)['then'](function(_0x30e3df){logger['info'](_0x7ad7('0x30'),_0x26c387[_0x7ad7('0x2e')]);_0x26cc03(_0x30e3df);});}})[_0x7ad7('0x18')](function(_0x4bb31c){throw new Error(_0x4bb31c[_0x7ad7('0x1a')]);});});};}function createEndUser(_0xdf8538,_0x759d16,_0x1db8e3,_0x47b997){return new Promise(function(_0x45b100,_0xb5d1c3){var _0x333940=moment();var _0x2348a3={'method':'POST','uri':_0x47b997+'/api/contacts','body':{'contact':{'last_name':_0xdf8538[_0x7ad7('0x2a')],'work_number':_0xdf8538['contactNumber'],'mobile_number':_0xdf8538[_0x7ad7('0x2a')],'owner_id':_0xdf8538[_0x7ad7('0x22')],'created_at':_0x333940['format'](_0x7ad7('0x31'))}},'json':!![]};_0x2348a3[_0x7ad7('0xe')]=_0x1db8e3;logger[_0x7ad7('0xf')](_0x7ad7('0x32'));return rp(_0x2348a3)['then'](function(_0x41db94){_0xdf8538['endUserId']=_0x41db94['contact']['id'];_0x45b100(_0xdf8538);})[_0x7ad7('0x18')](function(_0x83501f){logger[_0x7ad7('0x19')]('['+[_0x759d16[_0x7ad7('0x33')]()]+']',_0x83501f[_0x7ad7('0x1a')]);_0xb5d1c3(_0x83501f[_0x7ad7('0x1a')]);});});}function getTicket(_0x3ceaf8,_0x5b7e67,_0x26fdb8,_0x58f370,_0x49f6f0){return function(_0x5c39a3){logger[_0x7ad7('0xf')]('Creating\x20new\x20task');return new Promise(function(_0x417272,_0x4d988b){var _0x21374a=moment();var _0x2c44b4={'method':_0x7ad7('0x34'),'uri':_0x26fdb8+'/api/tasks','body':{'title':intUtil['getString'](_0x58f370[_0x7ad7('0x35')],_0x49f6f0,'\x20'),'description':intUtil[_0x7ad7('0x36')](_0x58f370['Descriptions'],_0x49f6f0,'\x0a'),'owner_id':_0x5c39a3[_0x7ad7('0x22')],'creater_id':_0x5c39a3['adminId'],'targetable_id':_0x5c39a3[_0x7ad7('0x2e')],'targetable_type':_0x7ad7('0x37'),'created_at':_0x21374a[_0x7ad7('0x38')](_0x7ad7('0x31')),'due_date':_0x21374a[_0x7ad7('0x39')](0x1e,'m')[_0x7ad7('0x38')](_0x7ad7('0x31'))},'json':!![]};_0x2c44b4[_0x7ad7('0xe')]=_0x5b7e67;return rp(_0x2c44b4)[_0x7ad7('0x11')](function(_0x3943bf){_0x5c39a3[_0x7ad7('0x3a')]=_0x3943bf[_0x7ad7('0x3b')]['id'];logger['info'](_0x7ad7('0x3c'),_0x5c39a3['ticketId']);_0x417272(_0x5c39a3);})['catch'](function(_0x8acacf){logger[_0x7ad7('0x19')]('['+[_0x3ceaf8['toUpperCase']()]+']',_0x8acacf[_0x7ad7('0x1a')]);_0x4d988b(_0x8acacf[_0x7ad7('0x1a')]);});});};}function emit(_0x52de1e,_0x388178,_0x3aa405){var _0x5b9942={'uri':_0x52de1e+_0x7ad7('0x3d')+_0x3aa405};io['to'](util[_0x7ad7('0x38')](_0x7ad7('0x3e'),_0x388178))[_0x7ad7('0x3f')]('trigger:browser:url',_0x5b9942);}exports['cs']=function(_0x2159ba,_0x100085,_0x314633,_0x472be9,_0x449def,_0xa18150,_0x46aa20,_0x34b22a){var _0x1c5145={};var _0x46174d={'Authorization':_0x7ad7('0x40')+_0xa18150[_0x7ad7('0x41')]};_0xa18150[_0x7ad7('0x42')]=intUtil['stripTrailingSlash'](_0xa18150['remoteUri']);_0xa18150[_0x7ad7('0x43')]=intUtil[_0x7ad7('0x44')](_0xa18150['serverUrl']);var _0x416d70=_0xa18150[_0x7ad7('0x42')];_0x1c5145[_0x7ad7('0x14')]=_0xa18150['username'];_0x1c5145[_0x7ad7('0x2a')]=_0x34b22a[_0x7ad7('0x45')]()==='outbound'?_0x100085['destcalleridnum']:_0x100085['calleridnum'];_0x1c5145[_0x7ad7('0x46')]=_0x34b22a===_0x7ad7('0x47')||_0x34b22a===_0x7ad7('0x48')?_0x7ad7('0x47'):'outbound';if(_0x472be9){_0x1c5145[_0x7ad7('0x1d')]=_0x472be9[_0x7ad7('0x13')];}var _0x562f2d=util[_0x7ad7('0x38')](_0x7ad7('0x49'),_0xa18150[_0x7ad7('0x43')],_0x100085[_0x7ad7('0x4a')],md5(_0x100085[_0x7ad7('0x4a')]));if(_0x449def&&_0x449def[_0x7ad7('0x4b')]){logger[_0x7ad7('0xf')](_0x7ad7('0x4c'),'Recording\x20is\x20enabled!');_0x100085['recordingURL']=_0x562f2d;}else if(_0x46aa20&&_0x46aa20[_0x7ad7('0x4d')]&&_0x46aa20['recordingFormat']!==_0x7ad7('0x4e')){logger[_0x7ad7('0xf')](_0x7ad7('0x4f'),_0x7ad7('0x50'));_0x100085[_0x7ad7('0x51')]=_0x562f2d;}else{_0x100085['recordingURL']='';}return getAdminId(_0x1c5145,_0x34b22a,_0x46174d,_0x416d70)[_0x7ad7('0x11')](getUser(_0x34b22a,_0x46174d,_0x416d70))['then'](getEndUser(_0x34b22a,_0x46174d,_0x416d70))['then'](getTicket(_0x34b22a,_0x46174d,_0x416d70,_0x314633,_0x100085))['then'](function(_0x3ad78d){logger[_0x7ad7('0xf')](util[_0x7ad7('0x38')]('The\x20ticket\x20ID\x20is:\x20%s',_0x3ad78d[_0x7ad7('0x3a')]));if(_0x34b22a!==_0x7ad7('0x48')){logger[_0x7ad7('0xf')]('['+[_0x34b22a['toUpperCase']()]+']',_0x7ad7('0x52'));emit(_0x416d70,_0x472be9[_0x7ad7('0x27')],_0x3ad78d[_0x7ad7('0x2e')]);}})[_0x7ad7('0x18')](function(_0x37c94d){logger[_0x7ad7('0x19')]('['+[_0x34b22a[_0x7ad7('0x33')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0x7ad7('0x53')](_0x37c94d,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6de3=['/api/selector/owners','headers','info','Getting\x20admin\x20information','then','users','length','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','userEmail','userId','User\x20found:','Admin\x20selected','error','/api/contacts/filters','Getting\x20contacts\x20filter','filters','forEach','name','All\x20Contacts','contacts','find','work_number','mobile_number','contactNumber','endUserId','Contact\x20found:','Contact\x20created:','/api/contacts','format','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','POST','/api/tasks','getString','Subjects','Descriptions','ticketId','task','Task\x20created:','/contacts/','user:%s','emit','trigger:browser:url','Token\x20token=','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','calleridnum','callDirection','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','bluebird','ioredis','../../../../config/logger','freshsales','defaults','socket.io-emitter','redis','GET'];(function(_0xbc9201,_0x8a58fb){var _0x2b139d=function(_0x3de53e){while(--_0x3de53e){_0xbc9201['push'](_0xbc9201['shift']());}};_0x2b139d(++_0x8a58fb);}(_0x6de3,0xa6));var _0x36de=function(_0x590606,_0x1074be){_0x590606=_0x590606-0x0;var _0x40dd57=_0x6de3[_0x590606];return _0x40dd57;};'use strict';var _=require(_0x36de('0x0'));var rp=require(_0x36de('0x1'));var md5=require(_0x36de('0x2'));var util=require(_0x36de('0x3'));var moment=require('moment');var Promise=require(_0x36de('0x4'));var Redis=require(_0x36de('0x5'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x36de('0x6'))(_0x36de('0x7'));config['redis']=_[_0x36de('0x8')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x36de('0x9'))(new Redis(config[_0x36de('0xa')]));function getAdminId(_0xd35fe0,_0xfb0479,_0x71d95,_0x45b72f){return new Promise(function(_0x331ff8,_0x223e84){var _0x1a9e96=![];var _0x308674={'method':_0x36de('0xb'),'uri':_0x45b72f+_0x36de('0xc'),'json':!![]};_0x308674[_0x36de('0xd')]=_0x71d95;logger[_0x36de('0xe')](_0x36de('0xf'));return rp(_0x308674)[_0x36de('0x10')](function(_0x45cae6){if(_0x45cae6){var _0x169930=_0x45cae6[_0x36de('0x11')];var _0x1af75e=null;for(_0x1af75e=0x0;_0x1af75e<_0x169930[_0x36de('0x12')];_0x1af75e++){if(_0x169930[_0x1af75e][_0x36de('0x13')]===_0xd35fe0[_0x36de('0x14')]){_0xd35fe0[_0x36de('0x15')]=_0x169930[_0x1af75e]['id'];_0x1a9e96=!![];}}if(_0x1a9e96){logger[_0x36de('0xe')]('Admin\x20found:',_0xd35fe0[_0x36de('0x15')]);_0x331ff8(_0xd35fe0);}else{_0x223e84({'statusCode':0x194,'message':_0x36de('0x16')});}}else{_0x223e84({'statusCode':0x194,'message':_0x36de('0x16')});}})[_0x36de('0x17')](function(_0x585266){logger['error']('['+[_0xfb0479[_0x36de('0x18')]()]+']',_0x585266[_0x36de('0x19')]);_0x223e84(_0x585266);});});}function getUser(_0x59e92c,_0x5c1752,_0x2965dd){return function(_0x515ec7){return new Promise(function(_0x5ed257,_0x5edad9){var _0x15525d={'method':_0x36de('0xb'),'uri':_0x2965dd+'/api/selector/owners','json':!![]};_0x15525d[_0x36de('0xd')]=_0x5c1752;logger[_0x36de('0xe')](_0x36de('0x1a'));return rp(_0x15525d)[_0x36de('0x10')](function(_0x9d1086){if(_0x9d1086){var _0x1f6d62=_0x9d1086['users'];var _0x8a216=![];var _0x48e3dc=null;if(_0x515ec7[_0x36de('0x1b')]!==null){logger['info'](_0x36de('0x1c'),_0x515ec7['agentEmail']);_0x515ec7[_0x36de('0x1d')]=_0x515ec7[_0x36de('0x1b')];for(_0x48e3dc=0x0;_0x48e3dc<_0x1f6d62[_0x36de('0x12')];_0x48e3dc++){if(_0x1f6d62[_0x48e3dc][_0x36de('0x13')]===_0x515ec7[_0x36de('0x1b')]){_0x8a216=!![];_0x515ec7[_0x36de('0x1e')]=_0x1f6d62[_0x48e3dc]['id'];logger['info'](_0x36de('0x1f'),_0x515ec7[_0x36de('0x1e')]);}}}if(!_0x8a216){logger['info'](_0x36de('0x20'));_0x515ec7[_0x36de('0x1d')]=_0x515ec7['adminEmail'];_0x515ec7['userId']=_0x515ec7[_0x36de('0x15')];_0x8a216=!![];}if(_0x8a216){_0x5ed257(_0x515ec7);}else{_0x5edad9({'statusCode':0x194,'message':_0x36de('0x16')});}}else{_0x5edad9({'statusCode':0x194,'message':_0x36de('0x16')});}})['catch'](function(_0xd02e0a){logger[_0x36de('0x21')]('['+[_0x59e92c[_0x36de('0x18')]()]+']',_0xd02e0a['message']);_0x5edad9(_0xd02e0a);});});};}function getEndUser(_0x5a2bed,_0xf7e068,_0x24f6fa){return function(_0x3e1c9e){return new Promise(function(_0x5e3ca5,_0x11226c){var _0x28390b=0x0;var _0x3da86d={'method':'GET','uri':_0x24f6fa+_0x36de('0x22'),'json':!![]};_0x3da86d[_0x36de('0xd')]=_0xf7e068;logger[_0x36de('0xe')](_0x36de('0x23'));return rp(_0x3da86d)[_0x36de('0x10')](function(_0x477be8){_0x477be8[_0x36de('0x24')][_0x36de('0x25')](function(_0x4bbc05){if(_0x4bbc05[_0x36de('0x26')]===_0x36de('0x27')){_0x28390b=_0x4bbc05['id'];}});})[_0x36de('0x10')](function(){logger[_0x36de('0xe')]('Getting\x20contact\x20list');var _0x39e462={'method':_0x36de('0xb'),'uri':_0x24f6fa+'/api/contacts/view/'+_0x28390b,'json':!![]};_0x39e462[_0x36de('0xd')]=_0xf7e068;return rp(_0x39e462);})[_0x36de('0x10')](function(_0x29daa7){logger[_0x36de('0xe')]('Searching\x20contact\x20with\x20phone',_0x3e1c9e['contactNumber']);if(_0x29daa7[_0x36de('0x28')][_0x36de('0x12')]>0x0){var _0x88d1c8=_[_0x36de('0x29')](_0x29daa7[_0x36de('0x28')],function(_0xba1e53){if(_0xba1e53[_0x36de('0x2a')]===_0x3e1c9e['contactNumber']||_0xba1e53[_0x36de('0x2b')]===_0x3e1c9e[_0x36de('0x2c')]){return _0xba1e53;}});if(_0x88d1c8){_0x3e1c9e[_0x36de('0x2d')]=_0x88d1c8['id'];logger[_0x36de('0xe')](_0x36de('0x2e'),_0x3e1c9e[_0x36de('0x2d')]);_0x5e3ca5(_0x3e1c9e);}else{return createEndUser(_0x3e1c9e,_0x5a2bed,_0xf7e068,_0x24f6fa)[_0x36de('0x10')](function(_0x4651c2){logger[_0x36de('0xe')](_0x36de('0x2f'),_0x3e1c9e[_0x36de('0x2d')]);_0x5e3ca5(_0x4651c2);});}}else{return createEndUser(_0x3e1c9e,_0x5a2bed,_0xf7e068,_0x24f6fa)[_0x36de('0x10')](function(_0xf9a6dc){logger[_0x36de('0xe')](_0x36de('0x2f'),_0x3e1c9e[_0x36de('0x2d')]);_0x5e3ca5(_0xf9a6dc);});}})[_0x36de('0x17')](function(_0x471f9f){throw new Error(_0x471f9f[_0x36de('0x19')]);});});};}function createEndUser(_0x1e10a3,_0x3ea594,_0x5ca2dc,_0x42e20c){return new Promise(function(_0x307097,_0x467ca5){var _0x40032f=moment();var _0x44fa12={'method':'POST','uri':_0x42e20c+_0x36de('0x30'),'body':{'contact':{'last_name':_0x1e10a3[_0x36de('0x2c')],'work_number':_0x1e10a3[_0x36de('0x2c')],'mobile_number':_0x1e10a3[_0x36de('0x2c')],'owner_id':_0x1e10a3[_0x36de('0x1e')],'created_at':_0x40032f[_0x36de('0x31')](_0x36de('0x32'))}},'json':!![]};_0x44fa12['headers']=_0x5ca2dc;logger[_0x36de('0xe')](_0x36de('0x33'));return rp(_0x44fa12)[_0x36de('0x10')](function(_0xdec34){_0x1e10a3[_0x36de('0x2d')]=_0xdec34[_0x36de('0x34')]['id'];_0x307097(_0x1e10a3);})[_0x36de('0x17')](function(_0x33bdc3){logger[_0x36de('0x21')]('['+[_0x3ea594[_0x36de('0x18')]()]+']',_0x33bdc3[_0x36de('0x19')]);_0x467ca5(_0x33bdc3[_0x36de('0x19')]);});});}function getTicket(_0x53d02d,_0x3d2227,_0x426dcb,_0x3b67fc,_0x4775db){return function(_0x15638e){logger['info'](_0x36de('0x35'));return new Promise(function(_0x6592df,_0x5cead4){var _0x5def5e=moment();var _0x3131c5={'method':_0x36de('0x36'),'uri':_0x426dcb+_0x36de('0x37'),'body':{'title':intUtil[_0x36de('0x38')](_0x3b67fc[_0x36de('0x39')],_0x4775db,'\x20'),'description':intUtil[_0x36de('0x38')](_0x3b67fc[_0x36de('0x3a')],_0x4775db,'\x0a'),'owner_id':_0x15638e[_0x36de('0x1e')],'creater_id':_0x15638e[_0x36de('0x15')],'targetable_id':_0x15638e[_0x36de('0x2d')],'targetable_type':'Contact','created_at':_0x5def5e[_0x36de('0x31')](_0x36de('0x32')),'due_date':_0x5def5e['add'](0x1e,'m')[_0x36de('0x31')](_0x36de('0x32'))},'json':!![]};_0x3131c5[_0x36de('0xd')]=_0x3d2227;return rp(_0x3131c5)['then'](function(_0x187977){_0x15638e[_0x36de('0x3b')]=_0x187977[_0x36de('0x3c')]['id'];logger['info'](_0x36de('0x3d'),_0x15638e[_0x36de('0x3b')]);_0x6592df(_0x15638e);})[_0x36de('0x17')](function(_0x35b79d){logger[_0x36de('0x21')]('['+[_0x53d02d[_0x36de('0x18')]()]+']',_0x35b79d[_0x36de('0x19')]);_0x5cead4(_0x35b79d[_0x36de('0x19')]);});});};}function emit(_0x59999d,_0x5502d1,_0x254617){var _0x16bdfb={'uri':_0x59999d+_0x36de('0x3e')+_0x254617};io['to'](util[_0x36de('0x31')](_0x36de('0x3f'),_0x5502d1))[_0x36de('0x40')](_0x36de('0x41'),_0x16bdfb);}exports['cs']=function(_0x4714ef,_0x370079,_0x3b5d23,_0x5c89d8,_0x5dad2a,_0x562961,_0x47b430,_0x18d447){var _0x5546da={};var _0x586374={'Authorization':_0x36de('0x42')+_0x562961['apiKey']};_0x562961[_0x36de('0x43')]=intUtil[_0x36de('0x44')](_0x562961[_0x36de('0x43')]);_0x562961['serverUrl']=intUtil[_0x36de('0x44')](_0x562961[_0x36de('0x45')]);var _0x5d2377=_0x562961[_0x36de('0x43')];_0x5546da[_0x36de('0x14')]=_0x562961[_0x36de('0x46')];_0x5546da[_0x36de('0x2c')]=_0x18d447[_0x36de('0x47')]()===_0x36de('0x48')?_0x370079['destcalleridnum']:_0x370079[_0x36de('0x49')];_0x5546da[_0x36de('0x4a')]=_0x18d447===_0x36de('0x4b')||_0x18d447===_0x36de('0x4c')?_0x36de('0x4b'):'outbound';if(_0x5c89d8){_0x5546da[_0x36de('0x1b')]=_0x5c89d8[_0x36de('0x13')];}var _0x29e709=util[_0x36de('0x31')](_0x36de('0x4d'),_0x562961[_0x36de('0x45')],_0x370079[_0x36de('0x4e')],md5(_0x370079[_0x36de('0x4e')]));if(_0x5dad2a&&_0x5dad2a[_0x36de('0x4f')]){logger[_0x36de('0xe')](_0x36de('0x50'),_0x36de('0x51'));_0x370079[_0x36de('0x52')]=_0x29e709;}else if(_0x47b430&&_0x47b430[_0x36de('0x53')]&&_0x47b430[_0x36de('0x53')]!=='none'){logger[_0x36de('0xe')](_0x36de('0x54'),_0x36de('0x51'));_0x370079[_0x36de('0x52')]=_0x29e709;}else{_0x370079[_0x36de('0x52')]='';}return getAdminId(_0x5546da,_0x18d447,_0x586374,_0x5d2377)[_0x36de('0x10')](getUser(_0x18d447,_0x586374,_0x5d2377))[_0x36de('0x10')](getEndUser(_0x18d447,_0x586374,_0x5d2377))['then'](getTicket(_0x18d447,_0x586374,_0x5d2377,_0x3b5d23,_0x370079))[_0x36de('0x10')](function(_0x37985f){logger['info'](util['format'](_0x36de('0x55'),_0x37985f[_0x36de('0x3b')]));if(_0x18d447!=='abandoned'){logger[_0x36de('0xe')]('['+[_0x18d447['toUpperCase']()]+']',_0x36de('0x56'));emit(_0x5d2377,_0x5c89d8[_0x36de('0x26')],_0x37985f['endUserId']);}})['catch'](function(_0x3885f0){logger[_0x36de('0x21')]('['+[_0x18d447[_0x36de('0x18')]()]+_0x36de('0x57'),util[_0x36de('0x58')](_0x3885f0,{'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 2ecbc6e..d805537 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 _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x4b247d,_0x3679d9){var _0x41039f=function(_0x11921e){while(--_0x11921e){_0x4b247d['push'](_0x4b247d['shift']());}};_0x41039f(++_0x3679d9);}(_0xa9e0,0x123));var _0x0a9e=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xa9e0[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ No newline at end of file +var _0xa9e0=['./vtiger','./servicenow','./dynamics365','./freshsales','salesforce','sugarcrm','freshdesk','vtiger','servicenow','exec','toLowerCase','data1','data2','find','Configurations','data3','queue','routeId','log','abandoned','zendesk','zoho','desk','freshsales','dynamics365','unknown\x20integration','../../../../config/logger','error','[EXEC]','%s\x20configuration\x20#%s\x20not\x20found','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./freshdesk','./desk'];(function(_0x1a52c2,_0x26f5f5){var _0x1b0723=function(_0x43261a){while(--_0x43261a){_0x1a52c2['push'](_0x1a52c2['shift']());}};_0x1b0723(++_0x26f5f5);}(_0xa9e0,0x123));var _0x0a9e=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0xa9e0[_0xa1e3e3];return _0xc980e9;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var zendesk=require(_0x0a9e('0x2'));var salesforce=require('./salesforce');var sugarcrm=require('./sugarcrm');var freshdesk=require(_0x0a9e('0x3'));var zoho=require('./zoho');var desk=require(_0x0a9e('0x4'));var vtiger=require(_0x0a9e('0x5'));var servicenow=require(_0x0a9e('0x6'));var dynamics365=require(_0x0a9e('0x7'));var freshsales=require(_0x0a9e('0x8'));var integrations=['zendesk',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'zoho','desk',_0x0a9e('0xc'),'dynamics365','freshsales',_0x0a9e('0xd')];exports[_0x0a9e('0xe')]=function(_0x307b3e,_0x3ab53f,_0xfeb75b,_0xbd1168,_0x4a4c56,_0x50dfb2){if(_0xfeb75b){if(_['includes'](integrations,_0x307b3e['data1'][_0x0a9e('0xf')]())){try{var _0x36471c=null;var _0xd5b662='';var _0x26d672=_0xfeb75b[_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]()];if(_0x26d672){var _0x5db4b0=_0x26d672[_0x307b3e[_0x0a9e('0x11')]];if(_0x5db4b0){var _0x239b12=_[_0x0a9e('0x12')](_0x5db4b0[_0x0a9e('0x13')],{'id':parseInt(_0x307b3e[_0x0a9e('0x14')],0xa)});if(_0x239b12){if(_0xbd1168){if(_0x4a4c56&&_0x3ab53f[_0x0a9e('0x15')]){_0xd5b662='queue';}else if(_0x3ab53f[_0x0a9e('0x16')]){_0xd5b662='outbound';}else{console[_0x0a9e('0x17')]('EVENT\x20UNKNOWN',_0x3ab53f);}}else{_0xd5b662=_0x0a9e('0x18');}switch(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']()){case _0x0a9e('0x19'):zendesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case'salesforce':salesforce[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xa'):sugarcrm[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xb'):freshdesk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1a'):zoho[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1b'):desk[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0xc'):vtiger[_0xd5b662](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2);break;case _0x0a9e('0x1c'):freshsales['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);case _0x0a9e('0xd'):servicenow['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;case _0x0a9e('0x1d'):dynamics365['cs'](_0x307b3e,_0x3ab53f,_0x239b12,_0xbd1168,_0x4a4c56,_0x5db4b0,_0x50dfb2,_0xd5b662);break;default:console[_0x0a9e('0x17')](_0x0a9e('0x1e'));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')]['toLowerCase']());_0x36471c[_0x0a9e('0x20')](_0x0a9e('0x21'),util['format'](_0x0a9e('0x22'),_0x307b3e['data1']['toLowerCase'](),_0x307b3e[_0x0a9e('0x14')]));}}else{_0x36471c=require(_0x0a9e('0x1f'))(_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')]());_0x36471c['error'](_0x0a9e('0x21'),util[_0x0a9e('0x23')](_0x0a9e('0x24'),_0x307b3e[_0x0a9e('0x10')][_0x0a9e('0xf')](),_0x307b3e[_0x0a9e('0x11')]));}}else{}}catch(_0x16b1ca){console['error'](_0x16b1ca);}}}}; \ 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 8ab361f..5ee8343 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 _0xd58a=['redis','localhost','emit','Task','assign','utc','getString','Subjects','Descriptions','WhoId','Case','sobject','ticketType','create','isNil','validateEmail','User','find','execute','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','then','user_id','display_name','info','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','lead','Company','No\x20Company','forEach','type','string','idField','toString','variable','variableName','Variable','name','toLowerCase','password','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','username','Connection\x20established.','queue','serverUrl','stripTrailingSlash','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','catch','stringify','outbound','recordingFormat','[OUTBOUND]','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','Salesforce\x20account\x20type\x20not\x20recognized','abandoned','monitor_format','calleridname','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','[ABANDONED]','moment','bluebird','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce'];(function(_0x4c51a8,_0x3d34d6){var _0x108c27=function(_0x29adbe){while(--_0x29adbe){_0x4c51a8['push'](_0x4c51a8['shift']());}};_0x108c27(++_0x3d34d6);}(_0xd58a,0x194));var _0xad58=function(_0x1d0412,_0x1a3d7c){_0x1d0412=_0x1d0412-0x0;var _0x5c0420=_0xd58a[_0x1d0412];return _0x5c0420;};'use strict';var _=require('lodash');var rp=require('request-promise');var moment=require(_0xad58('0x0'));var BPromise=require(_0xad58('0x1'));var md5=require('md5');var jsforce=require(_0xad58('0x2'));var util=require(_0xad58('0x3'));var Redis=require(_0xad58('0x4'));var intUtil=require('./util');var config=require(_0xad58('0x5'));var logger=require(_0xad58('0x6'))(_0xad58('0x7'));config['redis']=_['defaults'](config[_0xad58('0x8')],{'host':_0xad58('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x59b474,_0x809c00,_0x3953f3){io['to'](_0x59b474)[_0xad58('0xa')](_0x809c00,_0x3953f3);}function getTicket(_0x163dd9,_0x1b05a9,_0x23807c,_0xe9f084,_0xf7b0b7,_0x1906e6,_0x243039,_0x2810ce){var _0x6bb9f5={};if(_0xe9f084['ticketType']===_0xad58('0xb')){_0x6bb9f5=Object[_0xad58('0xc')]({},{'OwnerId':_0x1b05a9['id'],'ActivityDate':moment[_0xad58('0xd')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0xad58('0xe')](_0xe9f084[_0xad58('0xf')],_0xf7b0b7,'\x20'),'Description':intUtil[_0xad58('0xe')](_0xe9f084[_0xad58('0x10')],_0xf7b0b7,'\x0a')},getCustomFields(_0x1906e6,_0xf7b0b7));if(_0x23807c){_0x6bb9f5[_0xad58('0x11')]=_0x23807c['id'];}}else if(_0xe9f084['ticketType']===_0xad58('0x12')){_0x6bb9f5=Object[_0xad58('0xc')]({},{'OwnerId':_0x1b05a9['id'],'Subject':intUtil['getString'](_0xe9f084[_0xad58('0xf')],_0xf7b0b7,'\x20'),'Description':intUtil[_0xad58('0xe')](_0xe9f084[_0xad58('0x10')],_0xf7b0b7,'\x0a')},getCustomFields(_0x1906e6,_0xf7b0b7));if(_0x23807c){_0x6bb9f5['ContactId']=_0x23807c['id'];}}return _0x243039[_0xad58('0x13')](_0xe9f084[_0xad58('0x14')])[_0xad58('0x15')](_0x6bb9f5);}function getUser(_0x3407e5,_0x59b035,_0x3c5b72){if(!_[_0xad58('0x16')](_0x59b035)&&intUtil[_0xad58('0x17')](_0x59b035)){var _0x226b6f={'Email':_0x59b035};var _0x3fbc39={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3c5b72[_0xad58('0x13')](_0xad58('0x18'))[_0xad58('0x19')](_0x226b6f,_0x3fbc39)[_0xad58('0x1a')]()['then'](function(_0x35f335){if(_0x35f335[_0xad58('0x1b')]){var _0x155ff1=_[_0xad58('0x19')](_0x35f335,function(_0x3dcb41){return _0x3dcb41[_0xad58('0x1c')]===_0x59b035;});if(_0x155ff1){logger['info'](_0xad58('0x1d'),_0x59b035);return BPromise[_0xad58('0x1e')]({'id':_0x155ff1['Id'],'name':_0x155ff1[_0xad58('0x1f')]});}}else{logger['info'](_0xad58('0x20'),_0x59b035);return _0x3c5b72[_0xad58('0x21')]()[_0xad58('0x22')](function(_0x3459dc){return BPromise[_0xad58('0x1e')]({'id':_0x3459dc[_0xad58('0x23')],'name':_0x3459dc[_0xad58('0x24')]});});}});}else{logger['info'](_0xad58('0x20'),_0x59b035);return _0x3c5b72[_0xad58('0x21')]()[_0xad58('0x22')](function(_0x549628){return BPromise[_0xad58('0x1e')]({'id':_0x549628['user_id'],'name':_0x549628[_0xad58('0x24')]});});}}function getEndUser(_0x2c83c1,_0x503c82,_0x1e3856,_0x18a950,_0x1b74ea){var _0x26aec4={'Phone':_0x18a950};var _0x7aff00={'Id':!![],'Name':!![],'Phone':!![]};return BPromise['resolve']()['then'](function(){if(_0x503c82[_0xad58('0x14')]==='Task'){logger[_0xad58('0x25')](_0xad58('0x26'),_0x18a950,_0x503c82[_0xad58('0x27')]);switch(_0x503c82[_0xad58('0x27')]){case'contact_lead':return _0x1b74ea[_0xad58('0x13')](_0xad58('0x28'))['find'](_0x26aec4,_0x7aff00)[_0xad58('0x1a')]()[_0xad58('0x22')](function(_0x2cad64){if(_0x2cad64&&_0x2cad64[_0xad58('0x1b')]){return _0x2cad64;}else{return _0x1b74ea[_0xad58('0x13')](_0xad58('0x29'))[_0xad58('0x19')](_0x26aec4,_0x7aff00);}});case'contact':return _0x1b74ea['sobject'](_0xad58('0x28'))['find'](_0x26aec4,_0x7aff00)[_0xad58('0x1a')]();case'lead':return _0x1b74ea[_0xad58('0x13')](_0xad58('0x29'))['find'](_0x26aec4,_0x7aff00);default:return null;}}else if(_0x503c82[_0xad58('0x14')]===_0xad58('0x12')){logger[_0xad58('0x25')](_0xad58('0x26'),_0x18a950,'contact');return _0x1b74ea[_0xad58('0x13')]('Contact')['find'](_0x26aec4,_0x7aff00)[_0xad58('0x1a')]();}})[_0xad58('0x22')](function(_0x125409){if(_0x125409&&_0x125409[_0xad58('0x1b')]){var _0x166d21=_[_0xad58('0x19')](_0x125409,function(_0x5e7de6){return _0x5e7de6[_0xad58('0x2a')]===_0x18a950;});if(_0x166d21){return BPromise[_0xad58('0x1e')]({'id':_0x166d21['Id'],'name':_0x166d21[_0xad58('0x1f')],'phone':_0x166d21['Phone']});}}})[_0xad58('0x22')](function(_0x1c1204){if(_0x1c1204){logger[_0xad58('0x25')](_0xad58('0x2b'),_0x18a950);return BPromise[_0xad58('0x1e')](_0x1c1204);}else{logger[_0xad58('0x25')](_0xad58('0x2c'),_0x18a950);var _0x1fbff1={'LastName':_0x1e3856!==''?_0x1e3856:util['format']('Caller\x20-\x20%s',_0x18a950),'Phone':_0x18a950};if(_0x503c82[_0xad58('0x2d')]){if(_0x503c82[_0xad58('0x2d')]==='contact'){logger[_0xad58('0x25')](_0xad58('0x2e'),_0x18a950,_0x503c82[_0xad58('0x2d')]);}else if(_0x503c82[_0xad58('0x2d')]===_0xad58('0x2f')&&_0x503c82[_0xad58('0x14')]===_0xad58('0xb')){logger['info'](_0xad58('0x2e'),_0x18a950,_0x503c82[_0xad58('0x2d')]);_0x1fbff1[_0xad58('0x30')]=_0xad58('0x31');}else{return null;}}return _0x1b74ea[_0xad58('0x13')](_['upperFirst'](_0x503c82['moduleCreate']))[_0xad58('0x15')](_0x1fbff1);}});}function getCustomFields(_0x322cf1,_0xe3992a){var _0x51e7b4={};if(_0x322cf1[_0xad58('0x1b')]>0x0){_[_0xad58('0x32')](_0x322cf1,function(_0xaac080){if(_0xaac080[_0xad58('0x33')]===_0xad58('0x34')&&_0xaac080[_0xad58('0x35')]){_0x51e7b4[_0xaac080[_0xad58('0x35')]]=_0xaac080['content'][_0xad58('0x36')]();}else if(_0xaac080['type']===_0xad58('0x37')&&_0xaac080['variableName']&&_0xaac080[_0xad58('0x35')]){_0xe3992a[_0xaac080['variableName']]&&(_0x51e7b4[_0xaac080[_0xad58('0x35')]]=_0xe3992a[_0xaac080[_0xad58('0x38')]]['toString']());}else if(_0xaac080[_0xad58('0x33')]==='customVariable'&&_0xaac080[_0xad58('0x39')]&&_0xaac080['Variable'][_0xad58('0x3a')]&&_0xaac080[_0xad58('0x35')]){_0xe3992a[_0xaac080[_0xad58('0x39')][_0xad58('0x3a')][_0xad58('0x3b')]()]&&(_0x51e7b4[_0xaac080['idField']]=_0xe3992a[_0xaac080[_0xad58('0x39')][_0xad58('0x3a')][_0xad58('0x3b')]()][_0xad58('0x36')]());}});}return _0x51e7b4;}function getConnection(_0x58bb86){var _0x1e6d0f=_0x58bb86[_0xad58('0x3c')]['concat'](_0x58bb86[_0xad58('0x3d')]);var _0x32d4ac=new jsforce[(_0xad58('0x3e'))]({'oauth2':{'loginUrl':_0x58bb86[_0xad58('0x3f')]||_0xad58('0x40'),'clientId':_0x58bb86[_0xad58('0x41')],'clientSecret':_0x58bb86['clientSecret']}});return _0x32d4ac['login'](_0x58bb86[_0xad58('0x42')],_0x1e6d0f)[_0xad58('0x22')](function(){logger[_0xad58('0x25')](_0xad58('0x43'));return _0x32d4ac;});}exports[_0xad58('0x44')]=function(_0x449735,_0x37c182,_0x2af397,_0x302446,_0x61daf,_0x4046fc){var _0x59ea91,_0x3c7e27,_0x26d30e,_0x1cd964;_0x4046fc[_0xad58('0x45')]=intUtil[_0xad58('0x46')](_0x4046fc[_0xad58('0x45')]);_0x4046fc['remoteUri']=intUtil[_0xad58('0x46')](_0x4046fc[_0xad58('0x3f')]);if(_0x61daf&&_0x61daf['monitor_format']){logger[_0xad58('0x25')](_0xad58('0x47'),_0xad58('0x48'));_0x37c182[_0xad58('0x49')]=util[_0xad58('0x4a')](_0xad58('0x4b'),_0x4046fc['serverUrl'],_0x37c182[_0xad58('0x4c')],md5(_0x37c182['uniqueid']));}else{_0x37c182['recordingURL']='';}return getConnection(_0x4046fc)[_0xad58('0x22')](function(_0xa1c7ba){_0x1cd964=_0xa1c7ba;return getUser(_0x4046fc,_0x302446[_0xad58('0x4d')],_0x1cd964);})[_0xad58('0x22')](function(_0x23e5ee){_0x59ea91=_0x23e5ee;return getEndUser(_0x4046fc,_0x2af397,_0x37c182['calleridname'],_0x37c182[_0xad58('0x4e')],_0x1cd964);})[_0xad58('0x22')](function(_0x8860c9){_0x3c7e27=_0x8860c9;return getTicket(_0x4046fc,_0x59ea91,_0x3c7e27,_0x2af397,_0x37c182,_0x2af397[_0xad58('0x4f')],_0x1cd964,_0xad58('0x44'));})[_0xad58('0x22')](function(_0xf5a355){_0x26d30e=_0xf5a355;logger[_0xad58('0x25')](_0xad58('0x50'),_0x26d30e['id']);logger[_0xad58('0x25')](_0xad58('0x51'),_0x26d30e['id'],_0x302446[_0xad58('0x3a')],_0x4046fc['type']);switch(_0x4046fc[_0xad58('0x33')]){case'integrationTab':emit(util[_0xad58('0x4a')]('user:%s',_0x302446[_0xad58('0x3a')]),_0xad58('0x52'),{'recordId':_0x26d30e['id']});break;case _0xad58('0x53'):emit(util[_0xad58('0x4a')]('user:%s',_0x302446[_0xad58('0x3a')]),_0xad58('0x54'),{'uri':util[_0xad58('0x4a')](_0xad58('0x55'),_0x1cd964[_0xad58('0x56')],_0x26d30e['id'])});break;default:logger[_0xad58('0x57')]('[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.');}})[_0xad58('0x58')](function(_0x57d764){logger['error'](_0xad58('0x47'),JSON[_0xad58('0x59')](_0x57d764));});};exports[_0xad58('0x5a')]=function(_0x14be2e,_0x15d25b,_0x137792,_0x2e53dd,_0x3fa7fa,_0x12b97b,_0x5a95b7){var _0x1c452a,_0x5cd15a,_0xf5970d,_0x11fb8b;_0x12b97b['serverUrl']=intUtil['stripTrailingSlash'](_0x12b97b[_0xad58('0x45')]);_0x12b97b['remoteUri']=intUtil[_0xad58('0x46')](_0x12b97b['remoteUri']);if(_0x5a95b7&&_0x5a95b7[_0xad58('0x5b')]&&_0x5a95b7[_0xad58('0x5b')]!=='none'){logger[_0xad58('0x25')](_0xad58('0x5c'),_0xad58('0x48'));_0x15d25b['recordingURL']=util[_0xad58('0x4a')](_0xad58('0x4b'),_0x12b97b[_0xad58('0x45')],_0x15d25b[_0xad58('0x4c')],md5(_0x15d25b[_0xad58('0x4c')]));}return getConnection(_0x12b97b)['then'](function(_0x82556f){_0x11fb8b=_0x82556f;return getUser(_0x12b97b,_0x2e53dd['email'],_0x11fb8b);})['then'](function(_0x3156c6){_0x1c452a=_0x3156c6;return getEndUser(_0x12b97b,_0x137792,_0x15d25b['destcalleridname'],_0x15d25b['destcalleridnum'],_0x11fb8b);})[_0xad58('0x22')](function(_0x3668db){_0x5cd15a=_0x3668db;return getTicket(_0x12b97b,_0x1c452a,_0x5cd15a,_0x137792,_0x15d25b,_0x137792['Fields'],_0x11fb8b,_0xad58('0x5a'));})[_0xad58('0x22')](function(_0x9d20d1){_0xf5970d=_0x9d20d1;logger[_0xad58('0x25')]('[OUTBOUND]\x20Ticket\x20%s\x20created.',_0xf5970d['id']);logger[_0xad58('0x25')](_0xad58('0x5d'),_0xf5970d['id'],_0x2e53dd['name'],_0x12b97b[_0xad58('0x33')]);switch(_0x12b97b['type']){case _0xad58('0x5e'):emit(util['format'](_0xad58('0x5f'),_0x2e53dd[_0xad58('0x3a')]),_0xad58('0x52'),{'recordId':_0xf5970d['id']});break;case'newTab':emit(util[_0xad58('0x4a')](_0xad58('0x5f'),_0x2e53dd[_0xad58('0x3a')]),_0xad58('0x54'),{'uri':util['format'](_0xad58('0x55'),_0x11fb8b[_0xad58('0x56')],_0xf5970d['id'])});break;default:logger[_0xad58('0x57')]('[OUTBOUND]',_0xad58('0x60'));}})[_0xad58('0x58')](function(_0x512ac9){logger[_0xad58('0x57')](_0xad58('0x5c'),JSON[_0xad58('0x59')](_0x512ac9));});};exports[_0xad58('0x61')]=function(_0x4ecc2c,_0x442e62,_0x30ebbd,_0x44d138,_0x7d6e44,_0x378900){var _0x555802,_0x52fe72,_0x5d2a1c,_0x4dd07a;_0x378900[_0xad58('0x45')]=intUtil['stripTrailingSlash'](_0x378900['serverUrl']);_0x378900[_0xad58('0x3f')]=intUtil[_0xad58('0x46')](_0x378900[_0xad58('0x3f')]);if(_0x7d6e44&&_0x7d6e44[_0xad58('0x62')]){logger[_0xad58('0x25')]('[ABANDONED]',_0xad58('0x48'));_0x442e62['recordingURL']=util['format'](_0xad58('0x4b'),_0x378900[_0xad58('0x45')],_0x442e62[_0xad58('0x4c')],md5(_0x442e62[_0xad58('0x4c')]));}else{_0x442e62[_0xad58('0x49')]='';}return getConnection(_0x378900)[_0xad58('0x22')](function(_0x55144){_0x4dd07a=_0x55144;if(!_[_0xad58('0x16')](_0x44d138)){return getUser(_0x378900,_0x44d138[_0xad58('0x3a')],_0x4dd07a);}else{return getUser(_0x378900,null,_0x4dd07a);}})['then'](function(_0x3a9ea1){_0x555802=_0x3a9ea1;return getEndUser(_0x378900,_0x30ebbd,_0x442e62[_0xad58('0x63')],_0x442e62[_0xad58('0x4e')],_0x4dd07a);})[_0xad58('0x22')](function(_0x3c56d4){_0x52fe72=_0x3c56d4;return getTicket(_0x378900,_0x555802,_0x52fe72,_0x30ebbd,_0x442e62,_0x30ebbd[_0xad58('0x4f')],_0x4dd07a);})[_0xad58('0x22')](function(_0x585128){_0x5d2a1c=_0x585128;logger[_0xad58('0x25')](_0xad58('0x64'),_0x5d2a1c['id']);logger['info'](_0xad58('0x65'),_0x378900[_0xad58('0x33')]);})[_0xad58('0x58')](function(_0x396893){logger[_0xad58('0x57')](_0xad58('0x66'),JSON[_0xad58('0x59')](_0x396893));});}; \ No newline at end of file +var _0x2445=['Task','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','Contact','Lead','contact','Phone','Enduser\x20with\x20phone\x20%s\x20found.','Enduser\x20with\x20phone\x20%s\x20not\x20found.','','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','Company','forEach','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','queue','serverUrl','stripTrailingSlash','monitor_format','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','Fields','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','newTab','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','[QUEUE]','stringify','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','Salesforce\x20account\x20type\x20not\x20recognized','catch','abandoned','[ABANDONED]','[ABANDONED]\x20Ticket\x20%s\x20created.','[ABANDONED]\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','ticketType','utc','getString','Subjects','Case','Descriptions','sobject','create','isNil','find','execute','then','length','Email','info','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name'];(function(_0x6f9baa,_0xd7b1f6){var _0x3cb09f=function(_0x1e5e8b){while(--_0x1e5e8b){_0x6f9baa['push'](_0x6f9baa['shift']());}};_0x3cb09f(++_0xd7b1f6);}(_0x2445,0x121));var _0x5244=function(_0x2f45ea,_0x15c656){_0x2f45ea=_0x2f45ea-0x0;var _0x485a84=_0x2445[_0x2f45ea];return _0x485a84;};'use strict';var _=require(_0x5244('0x0'));var rp=require(_0x5244('0x1'));var moment=require(_0x5244('0x2'));var BPromise=require(_0x5244('0x3'));var md5=require(_0x5244('0x4'));var jsforce=require(_0x5244('0x5'));var util=require('util');var Redis=require(_0x5244('0x6'));var intUtil=require(_0x5244('0x7'));var config=require(_0x5244('0x8'));var logger=require('../../../../config/logger')('salesforce');config[_0x5244('0x9')]=_['defaults'](config['redis'],{'host':_0x5244('0xa'),'port':0x18eb});var io=require(_0x5244('0xb'))(new Redis(config[_0x5244('0x9')]));function emit(_0x307cfc,_0x4a2c55,_0x4b6ac0){io['to'](_0x307cfc)[_0x5244('0xc')](_0x4a2c55,_0x4b6ac0);}function getTicket(_0x5a9fa3,_0x1d4e19,_0x160b05,_0x20da84,_0x37dc18,_0x41a01b,_0x25d135,_0xafe6d8){var _0x2f5f15={};if(_0x20da84[_0x5244('0xd')]==='Task'){_0x2f5f15=Object['assign']({},{'OwnerId':_0x1d4e19['id'],'ActivityDate':moment[_0x5244('0xe')](),'IsReminderSet':![],'IsRecurrence':![],'Subject':intUtil[_0x5244('0xf')](_0x20da84[_0x5244('0x10')],_0x37dc18,'\x20'),'Description':intUtil[_0x5244('0xf')](_0x20da84['Descriptions'],_0x37dc18,'\x0a')},getCustomFields(_0x41a01b,_0x37dc18));if(_0x160b05){_0x2f5f15['WhoId']=_0x160b05['id'];}}else if(_0x20da84['ticketType']===_0x5244('0x11')){_0x2f5f15=Object['assign']({},{'OwnerId':_0x1d4e19['id'],'Subject':intUtil[_0x5244('0xf')](_0x20da84[_0x5244('0x10')],_0x37dc18,'\x20'),'Description':intUtil[_0x5244('0xf')](_0x20da84[_0x5244('0x12')],_0x37dc18,'\x0a')},getCustomFields(_0x41a01b,_0x37dc18));if(_0x160b05){_0x2f5f15['ContactId']=_0x160b05['id'];}}return _0x25d135[_0x5244('0x13')](_0x20da84['ticketType'])[_0x5244('0x14')](_0x2f5f15);}function getUser(_0x43dcfb,_0x443240,_0x3cdf49){if(!_[_0x5244('0x15')](_0x443240)&&intUtil['validateEmail'](_0x443240)){var _0x3318a8={'Email':_0x443240};var _0x1d631b={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x3cdf49[_0x5244('0x13')]('User')[_0x5244('0x16')](_0x3318a8,_0x1d631b)[_0x5244('0x17')]()[_0x5244('0x18')](function(_0x27b603){if(_0x27b603[_0x5244('0x19')]){var _0x4f938d=_[_0x5244('0x16')](_0x27b603,function(_0x19bfea){return _0x19bfea[_0x5244('0x1a')]===_0x443240;});if(_0x4f938d){logger[_0x5244('0x1b')](_0x5244('0x1c'),_0x443240);return BPromise[_0x5244('0x1d')]({'id':_0x4f938d['Id'],'name':_0x4f938d[_0x5244('0x1e')]});}}else{logger[_0x5244('0x1b')](_0x5244('0x1f'),_0x443240);return _0x3cdf49[_0x5244('0x20')]()[_0x5244('0x18')](function(_0x9c17c5){return BPromise[_0x5244('0x1d')]({'id':_0x9c17c5[_0x5244('0x21')],'name':_0x9c17c5['display_name']});});}});}else{logger[_0x5244('0x1b')](_0x5244('0x1f'),_0x443240);return _0x3cdf49[_0x5244('0x20')]()[_0x5244('0x18')](function(_0x410589){return BPromise[_0x5244('0x1d')]({'id':_0x410589[_0x5244('0x21')],'name':_0x410589[_0x5244('0x22')]});});}}function getEndUser(_0x2937a3,_0x27c8b5,_0x7c53f6,_0x7591a6,_0x334ff8){var _0x2c2143={'Phone':_0x7591a6};var _0x3df123={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x5244('0x1d')]()[_0x5244('0x18')](function(){if(_0x27c8b5[_0x5244('0xd')]===_0x5244('0x23')){logger[_0x5244('0x1b')](_0x5244('0x24'),_0x7591a6,_0x27c8b5['moduleSearch']);switch(_0x27c8b5[_0x5244('0x25')]){case'contact_lead':return _0x334ff8[_0x5244('0x13')](_0x5244('0x26'))[_0x5244('0x16')](_0x2c2143,_0x3df123)[_0x5244('0x17')]()['then'](function(_0x4c0afa){if(_0x4c0afa&&_0x4c0afa[_0x5244('0x19')]){return _0x4c0afa;}else{return _0x334ff8[_0x5244('0x13')](_0x5244('0x27'))[_0x5244('0x16')](_0x2c2143,_0x3df123);}});case _0x5244('0x28'):return _0x334ff8['sobject'](_0x5244('0x26'))[_0x5244('0x16')](_0x2c2143,_0x3df123)[_0x5244('0x17')]();case'lead':return _0x334ff8[_0x5244('0x13')]('Lead')[_0x5244('0x16')](_0x2c2143,_0x3df123);default:return null;}}else if(_0x27c8b5[_0x5244('0xd')]==='Case'){logger[_0x5244('0x1b')](_0x5244('0x24'),_0x7591a6,_0x5244('0x28'));return _0x334ff8[_0x5244('0x13')](_0x5244('0x26'))[_0x5244('0x16')](_0x2c2143,_0x3df123)['execute']();}})[_0x5244('0x18')](function(_0x556255){if(_0x556255&&_0x556255[_0x5244('0x19')]){var _0x231fe1=_[_0x5244('0x16')](_0x556255,function(_0x54644f){return _0x54644f['Phone']===_0x7591a6;});if(_0x231fe1){return BPromise[_0x5244('0x1d')]({'id':_0x231fe1['Id'],'name':_0x231fe1[_0x5244('0x1e')],'phone':_0x231fe1[_0x5244('0x29')]});}}})[_0x5244('0x18')](function(_0x3d7b67){if(_0x3d7b67){logger[_0x5244('0x1b')](_0x5244('0x2a'),_0x7591a6);return BPromise[_0x5244('0x1d')](_0x3d7b67);}else{logger[_0x5244('0x1b')](_0x5244('0x2b'),_0x7591a6);var _0x2b3f92={'LastName':_0x7c53f6!==_0x5244('0x2c')?_0x7c53f6:util['format']('Caller\x20-\x20%s',_0x7591a6),'Phone':_0x7591a6};if(_0x27c8b5[_0x5244('0x2d')]){if(_0x27c8b5[_0x5244('0x2d')]===_0x5244('0x28')){logger[_0x5244('0x1b')](_0x5244('0x2e'),_0x7591a6,_0x27c8b5[_0x5244('0x2d')]);}else if(_0x27c8b5[_0x5244('0x2d')]==='lead'&&_0x27c8b5[_0x5244('0xd')]==='Task'){logger[_0x5244('0x1b')](_0x5244('0x2e'),_0x7591a6,_0x27c8b5[_0x5244('0x2d')]);_0x2b3f92[_0x5244('0x2f')]='No\x20Company';}else{return null;}}return _0x334ff8[_0x5244('0x13')](_['upperFirst'](_0x27c8b5['moduleCreate']))[_0x5244('0x14')](_0x2b3f92);}});}function getCustomFields(_0xd6979,_0x4f9857){var _0x5e0dfb={};if(_0xd6979[_0x5244('0x19')]>0x0){_[_0x5244('0x30')](_0xd6979,function(_0x49c417){if(_0x49c417[_0x5244('0x31')]==='string'&&_0x49c417['idField']){_0x5e0dfb[_0x49c417[_0x5244('0x32')]]=_0x49c417[_0x5244('0x33')][_0x5244('0x34')]();}else if(_0x49c417[_0x5244('0x31')]===_0x5244('0x35')&&_0x49c417[_0x5244('0x36')]&&_0x49c417['idField']){_0x4f9857[_0x49c417[_0x5244('0x36')]]&&(_0x5e0dfb[_0x49c417[_0x5244('0x32')]]=_0x4f9857[_0x49c417[_0x5244('0x36')]][_0x5244('0x34')]());}else if(_0x49c417[_0x5244('0x31')]===_0x5244('0x37')&&_0x49c417[_0x5244('0x38')]&&_0x49c417[_0x5244('0x38')][_0x5244('0x39')]&&_0x49c417[_0x5244('0x32')]){_0x4f9857[_0x49c417['Variable'][_0x5244('0x39')][_0x5244('0x3a')]()]&&(_0x5e0dfb[_0x49c417[_0x5244('0x32')]]=_0x4f9857[_0x49c417['Variable'][_0x5244('0x39')][_0x5244('0x3a')]()][_0x5244('0x34')]());}});}return _0x5e0dfb;}function getConnection(_0x16f7a8){var _0x217ddb=_0x16f7a8[_0x5244('0x3b')][_0x5244('0x3c')](_0x16f7a8[_0x5244('0x3d')]);var _0x5ce38a=new jsforce[(_0x5244('0x3e'))]({'oauth2':{'loginUrl':_0x16f7a8[_0x5244('0x3f')]||_0x5244('0x40'),'clientId':_0x16f7a8[_0x5244('0x41')],'clientSecret':_0x16f7a8[_0x5244('0x42')]}});return _0x5ce38a[_0x5244('0x43')](_0x16f7a8[_0x5244('0x44')],_0x217ddb)[_0x5244('0x18')](function(){logger[_0x5244('0x1b')]('Connection\x20established.');return _0x5ce38a;});}exports[_0x5244('0x45')]=function(_0x300a24,_0x4c5340,_0x2acbdd,_0x20c1cb,_0x20ad48,_0x2a67bf){var _0xe7d3e1,_0x3c43f5,_0x14906a,_0x4fc9c7;_0x2a67bf[_0x5244('0x46')]=intUtil['stripTrailingSlash'](_0x2a67bf[_0x5244('0x46')]);_0x2a67bf[_0x5244('0x3f')]=intUtil[_0x5244('0x47')](_0x2a67bf[_0x5244('0x3f')]);if(_0x20ad48&&_0x20ad48[_0x5244('0x48')]){logger[_0x5244('0x1b')]('[QUEUE]',_0x5244('0x49'));_0x4c5340[_0x5244('0x4a')]=util[_0x5244('0x4b')](_0x5244('0x4c'),_0x2a67bf[_0x5244('0x46')],_0x4c5340[_0x5244('0x4d')],md5(_0x4c5340[_0x5244('0x4d')]));}else{_0x4c5340[_0x5244('0x4a')]='';}return getConnection(_0x2a67bf)[_0x5244('0x18')](function(_0x5dbe3e){_0x4fc9c7=_0x5dbe3e;return getUser(_0x2a67bf,_0x20c1cb['email'],_0x4fc9c7);})['then'](function(_0x19c690){_0xe7d3e1=_0x19c690;return getEndUser(_0x2a67bf,_0x2acbdd,_0x4c5340[_0x5244('0x4e')],_0x4c5340[_0x5244('0x4f')],_0x4fc9c7);})[_0x5244('0x18')](function(_0x3d193d){_0x3c43f5=_0x3d193d;return getTicket(_0x2a67bf,_0xe7d3e1,_0x3c43f5,_0x2acbdd,_0x4c5340,_0x2acbdd[_0x5244('0x50')],_0x4fc9c7,_0x5244('0x45'));})[_0x5244('0x18')](function(_0x1da3c6){_0x14906a=_0x1da3c6;logger[_0x5244('0x1b')](_0x5244('0x51'),_0x14906a['id']);logger['info'](_0x5244('0x52'),_0x14906a['id'],_0x20c1cb[_0x5244('0x39')],_0x2a67bf[_0x5244('0x31')]);switch(_0x2a67bf[_0x5244('0x31')]){case _0x5244('0x53'):emit(util['format']('user:%s',_0x20c1cb[_0x5244('0x39')]),_0x5244('0x54'),{'recordId':_0x14906a['id']});break;case _0x5244('0x55'):emit(util[_0x5244('0x4b')](_0x5244('0x56'),_0x20c1cb[_0x5244('0x39')]),_0x5244('0x57'),{'uri':util[_0x5244('0x4b')](_0x5244('0x58'),_0x4fc9c7[_0x5244('0x59')],_0x14906a['id'])});break;default:logger[_0x5244('0x5a')](_0x5244('0x5b'));}})['catch'](function(_0x141db7){logger['error'](_0x5244('0x5c'),JSON[_0x5244('0x5d')](_0x141db7));});};exports[_0x5244('0x5e')]=function(_0x235b71,_0xfc9914,_0x34df48,_0x52b8ec,_0x55d011,_0x5e4308,_0x1e4ebf){var _0x3a9bd0,_0x3380c7,_0x15d0ab,_0x124806;_0x5e4308[_0x5244('0x46')]=intUtil[_0x5244('0x47')](_0x5e4308[_0x5244('0x46')]);_0x5e4308['remoteUri']=intUtil[_0x5244('0x47')](_0x5e4308[_0x5244('0x3f')]);if(_0x1e4ebf&&_0x1e4ebf[_0x5244('0x5f')]&&_0x1e4ebf[_0x5244('0x5f')]!==_0x5244('0x60')){logger['info'](_0x5244('0x61'),_0x5244('0x49'));_0xfc9914[_0x5244('0x4a')]=util[_0x5244('0x4b')](_0x5244('0x4c'),_0x5e4308[_0x5244('0x46')],_0xfc9914[_0x5244('0x4d')],md5(_0xfc9914[_0x5244('0x4d')]));}return getConnection(_0x5e4308)[_0x5244('0x18')](function(_0x1f3b54){_0x124806=_0x1f3b54;return getUser(_0x5e4308,_0x52b8ec['email'],_0x124806);})[_0x5244('0x18')](function(_0x255638){_0x3a9bd0=_0x255638;return getEndUser(_0x5e4308,_0x34df48,_0xfc9914[_0x5244('0x62')],_0xfc9914[_0x5244('0x63')],_0x124806);})[_0x5244('0x18')](function(_0x313035){_0x3380c7=_0x313035;return getTicket(_0x5e4308,_0x3a9bd0,_0x3380c7,_0x34df48,_0xfc9914,_0x34df48[_0x5244('0x50')],_0x124806,_0x5244('0x5e'));})['then'](function(_0x10c61b){_0x15d0ab=_0x10c61b;logger[_0x5244('0x1b')](_0x5244('0x64'),_0x15d0ab['id']);logger[_0x5244('0x1b')](_0x5244('0x65'),_0x15d0ab['id'],_0x52b8ec[_0x5244('0x39')],_0x5e4308[_0x5244('0x31')]);switch(_0x5e4308[_0x5244('0x31')]){case _0x5244('0x53'):emit(util['format'](_0x5244('0x56'),_0x52b8ec[_0x5244('0x39')]),_0x5244('0x54'),{'recordId':_0x15d0ab['id']});break;case _0x5244('0x55'):emit(util[_0x5244('0x4b')]('user:%s',_0x52b8ec[_0x5244('0x39')]),_0x5244('0x57'),{'uri':util['format'](_0x5244('0x58'),_0x124806[_0x5244('0x59')],_0x15d0ab['id'])});break;default:logger[_0x5244('0x5a')](_0x5244('0x61'),_0x5244('0x66'));}})[_0x5244('0x67')](function(_0x551d69){logger[_0x5244('0x5a')]('[OUTBOUND]',JSON[_0x5244('0x5d')](_0x551d69));});};exports[_0x5244('0x68')]=function(_0x108961,_0x32329e,_0x1458de,_0x91851,_0x20ecc4,_0x5e838c){var _0x53b4f8,_0x56c38e,_0x4027bf,_0x14de3f;_0x5e838c[_0x5244('0x46')]=intUtil['stripTrailingSlash'](_0x5e838c[_0x5244('0x46')]);_0x5e838c[_0x5244('0x3f')]=intUtil[_0x5244('0x47')](_0x5e838c[_0x5244('0x3f')]);if(_0x20ecc4&&_0x20ecc4[_0x5244('0x48')]){logger[_0x5244('0x1b')](_0x5244('0x69'),_0x5244('0x49'));_0x32329e[_0x5244('0x4a')]=util['format'](_0x5244('0x4c'),_0x5e838c[_0x5244('0x46')],_0x32329e[_0x5244('0x4d')],md5(_0x32329e[_0x5244('0x4d')]));}else{_0x32329e[_0x5244('0x4a')]='';}return getConnection(_0x5e838c)[_0x5244('0x18')](function(_0x223156){_0x14de3f=_0x223156;if(!_[_0x5244('0x15')](_0x91851)){return getUser(_0x5e838c,_0x91851[_0x5244('0x39')],_0x14de3f);}else{return getUser(_0x5e838c,null,_0x14de3f);}})[_0x5244('0x18')](function(_0x2d7098){_0x53b4f8=_0x2d7098;return getEndUser(_0x5e838c,_0x1458de,_0x32329e[_0x5244('0x4e')],_0x32329e['calleridnum'],_0x14de3f);})['then'](function(_0x553025){_0x56c38e=_0x553025;return getTicket(_0x5e838c,_0x53b4f8,_0x56c38e,_0x1458de,_0x32329e,_0x1458de['Fields'],_0x14de3f);})[_0x5244('0x18')](function(_0x4fd0b2){_0x4027bf=_0x4fd0b2;logger['info'](_0x5244('0x6a'),_0x4027bf['id']);logger['info'](_0x5244('0x6b'),_0x5e838c[_0x5244('0x31')]);})[_0x5244('0x67')](function(_0x55a359){logger['error'](_0x5244('0x69'),JSON[_0x5244('0x5d')](_0x55a359));});}; \ 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 d95b24f..afa8220 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 _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','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','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xa9e0,0x123));var _0x0a9e=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0xa9e0[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xa9e0=['validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','],\x20getUser\x20entity','userId','adminEmail','],\x20getUser\x20crm','catch','],\x20createEndUser\x20input\x20crm','POST','sys_user?','user','endUserNumber','true','System','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','length','forEach','type','customField','idField','content','toString','toLowerCase','variable','variableName','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema',']\x20getTicket\x20crm','label','Incident','ticketId','Incident\x20-\x20','ticketNumber','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','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','format','user:%s','emit','trigger:browser:url','password','sysparm_limit=1','sysparm_display_value=true','serverUrl','stripTrailingSlash','%s/api/now/table/','remoteUri','email','destcalleridnum','calleridnum','queue','abandoned','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','localhost','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'use strict';var _=require(_0x0a9e('0x0'));var Promise=require(_0x0a9e('0x1'));var rp=require(_0x0a9e('0x2'));var util=require('util');var md5=require('md5');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function getAdminUser(_0x5f41ea,_0x503809,_0xe42b77,_0x56465b,_0x52cace,_0x39753a){return new Promise(function(_0xf81284,_0x307b3e){var _0x3ab53f={'method':_0x0a9e('0xb'),'uri':_0x56465b+_0x0a9e('0xc')+'&'+_0x52cace+'&'+_0x39753a,'auth':_0x503809,'json':!![]};return rp(_0x3ab53f)['then'](function(_0x50dfb2){if(_0x50dfb2['result']['length']>0x0){_0xe42b77[_0x0a9e('0xd')]=_0x50dfb2[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}logger[_0x0a9e('0x10')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+_0x0a9e('0x12'),_0xe42b77);_0xf81284(_0xe42b77);})['catch'](function(_0x4283ce){logger[_0x0a9e('0x13')]('['+[_0x5f41ea[_0x0a9e('0x11')]()]+']',_0x4283ce[_0x0a9e('0x14')]);_0x307b3e(_0x4283ce[_0x0a9e('0x14')]);});});}function getUser(_0x4d5611,_0x52a03d,_0x22dccb,_0x5d0880,_0x1985b6){return function(_0x519dfd){logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x519dfd);return new Promise(function(_0x225616,_0x5a0a06){if(intUtil[_0x0a9e('0x15')](_0x519dfd[_0x0a9e('0x16')])){var _0x106033={'method':_0x0a9e('0xb'),'uri':_0x22dccb+_0x0a9e('0x17')+_0x519dfd[_0x0a9e('0x16')]+'&'+_0x5d0880+'&'+_0x1985b6,'auth':_0x52a03d,'json':!![]};logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x18'),_0x106033);return rp(_0x106033)[_0x0a9e('0x19')](function(_0x1c696a){logger[_0x0a9e('0x10')]('['+[_0x4d5611['toUpperCase']()]+_0x0a9e('0x1a'),_0x1c696a);if(_0x1c696a[_0x0a9e('0xe')]['length']>0x0&&String(_0x1c696a[_0x0a9e('0xe')][0x0]['active'])==='true'){_0x519dfd[_0x0a9e('0x1b')]=_0x1c696a[_0x0a9e('0xe')][0x0][_0x0a9e('0xf')];}else{_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd[_0x0a9e('0x1c')];}logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+_0x0a9e('0x1d'),_0x519dfd);_0x225616(_0x519dfd);})[_0x0a9e('0x1e')](function(_0x16b1ca){logger['error']('['+[_0x4d5611['toUpperCase']()]+']',_0x16b1ca[_0x0a9e('0x14')]);_0x5a0a06(_0x16b1ca[_0x0a9e('0x14')]);});}else{logger[_0x0a9e('0x10')]('['+[_0x4d5611[_0x0a9e('0x11')]()]+']\x20using\x20admin\x20profile');_0x519dfd[_0x0a9e('0x1b')]=_0x519dfd['adminId'];_0x519dfd[_0x0a9e('0x16')]=_0x519dfd['adminEmail'];_0x225616(_0x519dfd);}});};}function createEndUser(_0x1dc186,_0x34dc65,_0x25fba9,_0x14433c,_0x140511){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+_0x0a9e('0x1f'),_0x25fba9);return new Promise(function(_0x5a101a,_0x3652a7){var _0x468813={'method':_0x0a9e('0x20'),'uri':_0x14433c+_0x0a9e('0x21')+_0x140511,'body':{'user_name':_0x25fba9['endUserNumber'],'roles':_0x0a9e('0x22'),'first_name':_0x25fba9[_0x0a9e('0x23')],'active':_0x0a9e('0x24'),'date_format':_0x0a9e('0x25'),'phone':_0x25fba9[_0x0a9e('0x23')]},'auth':_0x34dc65,'json':!![]};return rp(_0x468813)[_0x0a9e('0x19')](function(_0x296f41){logger[_0x0a9e('0x10')]('['+[_0x1dc186[_0x0a9e('0x11')]()]+'],\x20EndUser\x20schema',_0x296f41[_0x0a9e('0xe')]);_0x25fba9['endUserId']=_0x296f41[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x5a101a(_0x25fba9);})[_0x0a9e('0x1e')](function(_0x33bdb7){logger[_0x0a9e('0x13')]('['+[_0x1dc186['toUpperCase']()]+']',_0x33bdb7[_0x0a9e('0x14')]);_0x3652a7(_0x33bdb7[_0x0a9e('0x14')]);});});}function getEndUser(_0x40cb85,_0x2da5c0,_0x2b45ea,_0x409319,_0x332d35){return function(_0x39e565){logger['info']('['+[_0x40cb85[_0x0a9e('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x39e565);return new Promise(function(_0x2cc7a0,_0x14b13f){var _0x2b7e7f={'method':_0x0a9e('0xb'),'uri':_0x2b45ea+'sys_user?sysparm_query=phone%3D'+_0x39e565[_0x0a9e('0x23')]+'&'+_0x409319+'&'+_0x332d35,'auth':_0x2da5c0,'json':!![]};return rp(_0x2b7e7f)[_0x0a9e('0x19')](function(_0x1fa90d){if(_0x1fa90d[_0x0a9e('0xe')]['length']>0x0){_0x39e565['endUserId']=_0x1fa90d[_0x0a9e('0xe')][0x0]['sys_id'];logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x26'),_0x39e565);_0x2cc7a0(_0x39e565);}else{return createEndUser(_0x40cb85,_0x2da5c0,_0x39e565,_0x2b45ea,_0x409319)[_0x0a9e('0x19')](function(_0x4f41ae){logger[_0x0a9e('0x10')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+_0x0a9e('0x27'),_0x4f41ae);_0x2cc7a0(_0x4f41ae);});}})['catch'](function(_0x1dbf74){logger[_0x0a9e('0x13')]('['+[_0x40cb85[_0x0a9e('0x11')]()]+']',_0x1dbf74['message']);_0x14b13f(_0x1dbf74['message']);});});};}function getCustomFields(_0x11b61d,_0x40d766){var _0x5adda1={};if(_0x11b61d[_0x0a9e('0x28')]>0x0){_[_0x0a9e('0x29')](_0x11b61d,function(_0x2e1b3a){if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a['nameField']&&!_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')]['toLowerCase']()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]==='string'&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x2e1b3a[_0x0a9e('0x2d')][_0x0a9e('0x2e')]();}else if(_0x2e1b3a[_0x0a9e('0x2a')]===_0x0a9e('0x30')&&_0x2e1b3a[_0x0a9e('0x31')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x31')]][_0x0a9e('0x2e')]();}else if(_0x2e1b3a['type']==='customVariable'&&_0x2e1b3a[_0x0a9e('0x32')]&&_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')]&&_0x2e1b3a[_0x0a9e('0x2c')]&&_0x2e1b3a[_0x0a9e('0x2b')]){_0x5adda1[_0x2e1b3a[_0x0a9e('0x2c')][_0x0a9e('0x2f')]()]=_0x40d766[_0x2e1b3a[_0x0a9e('0x32')][_0x0a9e('0x33')][_0x0a9e('0x2f')]()][_0x0a9e('0x2e')]();}});}return _0x5adda1;}function getTicket(_0x35ed4a,_0x5026aa,_0x117c99,_0x138b8b,_0xdd268f,_0xfbd5ad){return function(_0x2e8caf){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x34'),_0x2e8caf);return new Promise(function(_0x59afe8,_0x2e9d90){var _0x48fd45=_0x35ed4a[_0x0a9e('0x2f')]()===_0x0a9e('0x35')?_0x2e8caf[_0x0a9e('0x1b')]:_0x2e8caf['endUserId'];var _0x14bec2={'method':_0x0a9e('0x20'),'uri':_0x117c99+_0x0a9e('0x36')+'?'+_0xfbd5ad,'body':Object[_0x0a9e('0x37')]({},{'active':_0x0a9e('0x24'),'caller_id':_0x48fd45,'assigned_to':_0x2e8caf[_0x0a9e('0x1b')],'short_description':intUtil[_0x0a9e('0x38')](_0x138b8b['Subjects'],_0xdd268f,'\x20'),'description':intUtil[_0x0a9e('0x38')](_0x138b8b[_0x0a9e('0x39')],_0xdd268f,'\x0a')},getCustomFields(_0x138b8b[_0x0a9e('0x3a')],_0xdd268f)),'auth':_0x5026aa,'json':!![]};return rp(_0x14bec2)[_0x0a9e('0x19')](function(_0x409789){logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3b'),_0x409789[_0x0a9e('0xe')]);_0x2e8caf['ticketId']=_0x409789[_0x0a9e('0xe')][_0x0a9e('0xf')];_0x2e8caf['ticketNumber']=_0x409789['result']['number'];logger[_0x0a9e('0x10')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+_0x0a9e('0x3c'),_0x2e8caf);_0x59afe8(_0x2e8caf);})[_0x0a9e('0x1e')](function(_0x61bb17){logger[_0x0a9e('0x13')]('['+[_0x35ed4a[_0x0a9e('0x11')]()]+']',_0x61bb17[_0x0a9e('0x14')]);_0x2e9d90(_0x61bb17['message']);});});};}function createRemoteTag(_0x4b1b9f,_0x53975a,_0x39d77d,_0x204173){return new Promise(function(_0x14d602,_0x5bb3ed){var _0x2b69d9={'method':_0x0a9e('0x20'),'uri':_0x39d77d+'label'+'?'+_0x204173,'body':{'short_description':_0x4b1b9f,'global':!![],'active':!![],'name':_0x4b1b9f},'auth':_0x53975a,'json':!![]};return rp(_0x2b69d9)['then'](function(_0x2ef381){var _0x59c6ff=_0x2ef381[_0x0a9e('0xe')]['sys_id'];_0x14d602(_0x59c6ff);});});}function getRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a,_0x2f82da){return new Promise(function(_0x1bf38a,_0x508b47){var _0x50f687={'method':_0x0a9e('0xb'),'uri':_0x439340+_0x0a9e('0x3d')+'?sysparm_query=name%3D'+_0x2e5e62+'&'+_0x53613a,'auth':_0x3c20b2,'json':!![]};return rp(_0x50f687)[_0x0a9e('0x19')](function(_0x5ce9ac){if(_0x5ce9ac[_0x0a9e('0xe')]['length']>0x0){var _0xe22ccc=_0x5ce9ac['result'][0x0]['sys_id'];_0x1bf38a(_0xe22ccc);}else{return createRemoteTag(_0x2e5e62,_0x3c20b2,_0x439340,_0x53613a)['then'](function(_0x2da03c){_0x1bf38a(_0x2da03c);});}});});}function assignTagToIncident(_0x47de4c,_0x2f7092,_0x65432,_0x3cfd00,_0x19b4df){return new Promise(function(_0x232830,_0x272738){var _0xd10662={'method':_0x0a9e('0x20'),'uri':_0x65432+'label_entry'+'?'+_0x19b4df,'body':{'label':_0x47de4c,'table':_0x0a9e('0x36'),'id_type':_0x0a9e('0x3e'),'table_key':_0x3cfd00[_0x0a9e('0x3f')],'title':_0x0a9e('0x40')+_0x3cfd00[_0x0a9e('0x41')],'id_display':_0x3cfd00[_0x0a9e('0x41')]},'auth':_0x2f7092,'json':!![]};return rp(_0xd10662)['then'](function(_0x956fbe){_0x232830();})[_0x0a9e('0x1e')](function(){_0x232830();});});}function manageTags(_0x5239ef,_0x3649cc,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a,_0x5674ee){return new Promise(function(_0x273cb5,_0x49d231){var _0x2244d6=[];_0x3649cc[_0x0a9e('0x29')](function(_0x261adb){_0x2244d6[_0x0a9e('0x42')](getRemoteTag(_0x261adb,_0x5cc8fb,_0x20c668,_0x4b3c1a,_0x5674ee));});return Promise[_0x0a9e('0x43')](_0x2244d6)[_0x0a9e('0x19')](function(_0x49eed0){if(_0x49eed0[_0x0a9e('0x28')]){logger['info']('['+[_0x5239ef[_0x0a9e('0x11')]()]+_0x0a9e('0x44'),_0x49eed0);var _0x51aaf7=[];_0x49eed0['forEach'](function(_0x453360){_0x51aaf7[_0x0a9e('0x42')](assignTagToIncident(_0x453360,_0x5cc8fb,_0x20c668,_0x5ba1f9,_0x4b3c1a));});return Promise[_0x0a9e('0x43')](_0x51aaf7)[_0x0a9e('0x19')](function(){_0x273cb5();})['catch'](function(){_0x273cb5();});}else{_0x273cb5();}});});}function getTags(_0x1d0dc8,_0xe05a5a,_0x54327c,_0x797b45,_0x17e88c,_0x88dcbf){return function(_0x409b29){return new Promise(function(_0x401837,_0x4d4a35){var _0x176840=[];var _0x2937e0=_0x797b45[_0x0a9e('0x45')];if(_0x2937e0&&_0x2937e0['length']>0x0){_0x176840=_[_0x0a9e('0x46')](_0x2937e0,'name');}if(_0x176840['length']>0x0){return manageTags(_0x1d0dc8,_0x176840,_0xe05a5a,_0x54327c,_0x409b29,_0x17e88c,_0x88dcbf)[_0x0a9e('0x19')](function(){_0x401837(_0x409b29);});}else{_0x401837(_0x409b29);}});};}function emit(_0x4556c5,_0x9375fb,_0x19c995){var _0x186f39=_0x0a9e('0x47')+_0x0a9e('0x48')+_0x0a9e('0x49')+_0x0a9e('0x4a');var _0x1cc4f3={'uri':_0x4556c5+_0x0a9e('0x4b')+_0x19c995+_0x186f39};io['to'](util[_0x0a9e('0x4c')](_0x0a9e('0x4d'),_0x9375fb))[_0x0a9e('0x4e')](_0x0a9e('0x4f'),_0x1cc4f3);}exports['cs']=function(_0x412a72,_0x2a28c0,_0x4257c9,_0x5150a4,_0x1b0b98,_0x295763,_0x243d12,_0x4edbb0){var _0x1148a1={};var _0x30944e={'user':_0x295763['username'],'pass':_0x295763[_0x0a9e('0x50')]};var _0x56e31e=_0x0a9e('0x51');var _0x427946=_0x0a9e('0x52');_0x295763['remoteUri']=intUtil['stripTrailingSlash'](_0x295763['remoteUri']);_0x295763[_0x0a9e('0x53')]=intUtil[_0x0a9e('0x54')](_0x295763[_0x0a9e('0x53')]);var _0x23a7d3=util[_0x0a9e('0x4c')](_0x0a9e('0x55'),_0x295763[_0x0a9e('0x56')]);_0x1148a1[_0x0a9e('0x16')]=!_['isNil'](_0x5150a4)?_0x5150a4[_0x0a9e('0x57')]:null;_0x1148a1[_0x0a9e('0x1c')]=_0x295763[_0x0a9e('0x57')];_0x1148a1['endUserNumber']=_0x4edbb0[_0x0a9e('0x2f')]()==='outbound'?_0x2a28c0[_0x0a9e('0x58')]:_0x2a28c0[_0x0a9e('0x59')];_0x1148a1['callDirection']=_0x4edbb0===_0x0a9e('0x5a')||_0x4edbb0===_0x0a9e('0x5b')?_0x0a9e('0x5a'):_0x0a9e('0x35');var _0x542ece=util[_0x0a9e('0x4c')](_0x0a9e('0x5c'),_0x295763[_0x0a9e('0x53')],_0x2a28c0[_0x0a9e('0x5d')],md5(_0x2a28c0['uniqueid']));if(_0x1b0b98&&_0x1b0b98[_0x0a9e('0x5e')]){logger[_0x0a9e('0x10')](_0x0a9e('0x5f'),_0x0a9e('0x60'));_0x2a28c0['recordingURL']=_0x542ece;}else if(_0x243d12&&_0x243d12[_0x0a9e('0x61')]&&_0x243d12[_0x0a9e('0x61')]!==_0x0a9e('0x62')){logger[_0x0a9e('0x10')](_0x0a9e('0x63'),_0x0a9e('0x60'));_0x2a28c0[_0x0a9e('0x64')]=_0x542ece;}else{_0x2a28c0[_0x0a9e('0x64')]='';}return getAdminUser(_0x4edbb0,_0x30944e,_0x1148a1,_0x23a7d3,_0x427946,_0x56e31e)[_0x0a9e('0x19')](getUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getEndUser(_0x4edbb0,_0x30944e,_0x23a7d3,_0x427946,_0x56e31e))[_0x0a9e('0x19')](getTicket(_0x4edbb0,_0x30944e,_0x23a7d3,_0x4257c9,_0x2a28c0,_0x427946))[_0x0a9e('0x19')](function(_0x25744a){logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x65'),_0x25744a[_0x0a9e('0x3f')]));logger[_0x0a9e('0x10')](util['format'](_0x0a9e('0x66'),_0x4edbb0));if(_0x4edbb0!==_0x0a9e('0x5b')){logger[_0x0a9e('0x10')]('['+[_0x4edbb0[_0x0a9e('0x11')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x295763['remoteUri'],_0x5150a4[_0x0a9e('0x33')],_0x25744a[_0x0a9e('0x3f')]);}})['catch'](function(_0x45108c){logger['error']('['+[_0x4edbb0[_0x0a9e('0x11')]()]+_0x0a9e('0x67'),util['inspect'](_0x45108c,{'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 96713d0..7ba85a2 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 _0x0b59=['queue','remoteUri','stripTrailingSlash','serverUrl','uri','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','contacts','charAt','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','%s/service/v4_1/rest.php','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','error','[ABANDONED]','isNil','Inbound','users','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','emit','info','name','assigned_user_id','created_by','description','getString','Descriptions','slice','duration_hours','duration_minutes','parent_id','parent_type','parent_name','direction','forEach','variableName','push','idField','JSON','Calls','format','Basic\x20%s','toString','get_server_info','stringify','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','Contacts','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','set_entry','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','merge','map','string','nameField','customField','toLowerCase','content','type','custom_fields','customVariable','Variable','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship'];(function(_0x1da436,_0x2fab9d){var _0xe4468d=function(_0x7d74bd){while(--_0x7d74bd){_0x1da436['push'](_0x1da436['shift']());}};_0xe4468d(++_0x2fab9d);}(_0x0b59,0x18c));var _0x90b5=function(_0x592217,_0x3ff469){_0x592217=_0x592217-0x0;var _0x31538b=_0x0b59[_0x592217];return _0x31538b;};'use strict';var _=require('lodash');var rp=require(_0x90b5('0x0'));var BPromise=require(_0x90b5('0x1'));var md5=require(_0x90b5('0x2'));var util=require('util');var Redis=require(_0x90b5('0x3'));var intUtil=require(_0x90b5('0x4'));var config=require(_0x90b5('0x5'));var logger=require(_0x90b5('0x6'))('sugarcrm');config[_0x90b5('0x7')]=_[_0x90b5('0x8')](config[_0x90b5('0x7')],{'host':_0x90b5('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x90b5('0x7')]));var def={'method':_0x90b5('0xa'),'json':!![]};function emit(_0x2e5eb9,_0x4f1af7,_0x142d48){io['to'](_0x2e5eb9)[_0x90b5('0xb')](_0x4f1af7,_0x142d48);}function getTicket(_0x2a7e51,_0xbb898d,_0xc22a90,_0x254fec,_0x5cd645,_0x56e7c2,_0x1ddefe,_0x1a1ad){logger[_0x90b5('0xc')]('Creating\x20new\x20ticket...');var _0x43d89b=new Date();var _0x2a46dc=[{'name':_0x90b5('0xd'),'value':intUtil['getString'](_0x254fec['Subjects'],_0x5cd645,'\x20')},{'name':_0x90b5('0xe'),'value':_0xbb898d['id']},{'name':_0x90b5('0xf'),'value':_0xbb898d['id']},{'name':_0x90b5('0x10'),'value':intUtil[_0x90b5('0x11')](_0x254fec[_0x90b5('0x12')],_0x5cd645,'\x0a')},{'name':'date_start','value':_0x43d89b['toISOString']()[_0x90b5('0x13')](0x0,0x13)['replace']('T','\x20')},{'name':_0x90b5('0x14'),'value':'0'},{'name':_0x90b5('0x15'),'value':'15'},{'name':_0x90b5('0x16'),'value':_0xc22a90['id']},{'name':_0x90b5('0x17'),'value':'Contacts'},{'name':_0x90b5('0x18'),'value':_0xc22a90[_0x90b5('0xd')]},{'name':_0x90b5('0x19'),'value':_0x1a1ad}];if(_0x56e7c2['length']){_[_0x90b5('0x1a')](_0x56e7c2,function(_0x266731){if(_0x5cd645[_0x266731[_0x90b5('0x1b')]]){_0x2a46dc[_0x90b5('0x1c')]({'name':_0x266731[_0x90b5('0x1d')],'value':_0x5cd645[_0x266731[_0x90b5('0x1b')]]});}});}return request({'form':{'method':'set_entry','input_type':_0x90b5('0x1e'),'response_type':_0x90b5('0x1e'),'rest_data':JSON['stringify']({'session':_0x1ddefe['id'],'module_name':_0x90b5('0x1f'),'name_value_list':_0x2a46dc})}});}function getAuth(_0x4591e0){return util[_0x90b5('0x20')](_0x90b5('0x21'),new Buffer(_0x4591e0['apiKey']+':X')[_0x90b5('0x22')]('base64'));}function getServerInfo(_0x257036){return request({'form':{'method':_0x90b5('0x23'),'input_type':_0x90b5('0x1e'),'response_type':_0x90b5('0x1e'),'rest_data':JSON[_0x90b5('0x24')]({'session':_0x257036['id']})}});}function getUser(_0x4c4cfa,_0x2ef9fd,_0x274187){if(!_['isNil'](_0x2ef9fd)){logger['info'](_0x90b5('0x25'),_0x2ef9fd);return request({'form':{'method':_0x90b5('0x26'),'input_type':_0x90b5('0x1e'),'response_type':_0x90b5('0x1e'),'rest_data':JSON['stringify']({'session':_0x274187['id'],'module_name':_0x90b5('0x27'),'query':util[_0x90b5('0x20')](_0x90b5('0x28'),_0x2ef9fd),'order_by':'','offset':'0','select_fields':['id','name',_0x90b5('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x90b5('0x2a')](function(_0x1c9d82){if(_0x1c9d82[_0x90b5('0x2b')][_0x90b5('0x2c')]){var _0x49b96b=_[_0x90b5('0x2d')](_0x1c9d82['entry_list'],function(_0xfb6d35){return _0xfb6d35[_0x90b5('0x2e')][_0x90b5('0x29')][_0x90b5('0x2f')]===_0x2ef9fd;});if(_0x49b96b){logger[_0x90b5('0xc')](_0x90b5('0x30'));return BPromise[_0x90b5('0x31')]({'id':_0x49b96b['name_value_list']['id']['value'],'name':_0x49b96b['name_value_list'][_0x90b5('0xd')]['value']});}}logger['info'](_0x90b5('0x32'));return BPromise['resolve']({'id':_0x274187[_0x90b5('0x2e')][_0x90b5('0x33')]['value'],'name':_0x274187[_0x90b5('0x2e')]['user_name'][_0x90b5('0x2f')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x90b5('0x31')]({'id':_0x274187[_0x90b5('0x2e')][_0x90b5('0x33')][_0x90b5('0x2f')],'name':_0x274187['name_value_list'][_0x90b5('0x29')][_0x90b5('0x2f')]});}}function getEndUser(_0x52b5e8,_0x342d67,_0xb9c0cb,_0x462af4){logger[_0x90b5('0xc')](_0x90b5('0x34'),_0xb9c0cb);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x90b5('0x1e'),'rest_data':JSON[_0x90b5('0x24')]({'session':_0x462af4['id'],'module_name':_0x90b5('0x35'),'query':util[_0x90b5('0x20')]('contacts.phone_home\x20=\x20\x22%s\x22',_0xb9c0cb),'order_by':'','offset':'0','select_fields':['id',_0x90b5('0xd'),_0x90b5('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x18d621){if(_0x18d621[_0x90b5('0x2b')]['length']){var _0x52cbb8=_[_0x90b5('0x2d')](_0x18d621['entry_list'],function(_0x1521b4){return _0x1521b4[_0x90b5('0x2e')]['phone_home'][_0x90b5('0x2f')]===_0xb9c0cb;});if(_0x52cbb8){logger['info'](_0x90b5('0x37'));return BPromise[_0x90b5('0x31')]({'id':_0x52cbb8[_0x90b5('0x2e')]['id'][_0x90b5('0x2f')],'name':_0x52cbb8[_0x90b5('0x2e')][_0x90b5('0xd')][_0x90b5('0x2f')],'phone':_0x52cbb8[_0x90b5('0x2e')]['phone_home'][_0x90b5('0x2f')]});}}else{logger[_0x90b5('0xc')](_0x90b5('0x38'));return request({'form':{'method':_0x90b5('0x39'),'input_type':_0x90b5('0x1e'),'response_type':_0x90b5('0x1e'),'rest_data':JSON['stringify']({'session':_0x462af4['id'],'module_name':_0x90b5('0x35'),'name_value_list':[{'name':_0x90b5('0x3a'),'value':_0x342d67!==_0x90b5('0x3b')?_0x342d67:util[_0x90b5('0x20')](_0x90b5('0x3c'),_0xb9c0cb)},{'name':_0x90b5('0x36'),'value':_0xb9c0cb}]})}})[_0x90b5('0x2a')](function(_0x186ea6){logger[_0x90b5('0xc')](_0x90b5('0x3d'));return BPromise[_0x90b5('0x31')]({'id':_0x186ea6['id'],'name':_0x186ea6[_0x90b5('0x2b')][_0x90b5('0x3a')]['value'],'phone':_0x186ea6[_0x90b5('0x2b')][_0x90b5('0x36')]['value']});});}});}function request(_0x3dd7e3){logger[_0x90b5('0x3e')]('[HTTP]',JSON[_0x90b5('0x24')](_0x3dd7e3));return rp(_[_0x90b5('0x3f')](def,_0x3dd7e3));}function getTags(_0x53d9af,_0xd7d963){var _0x3ff8e1=[];if(_0x53d9af&&_0x53d9af[_0x90b5('0x2c')]>0x0){_0x3ff8e1=_[_0x90b5('0x40')](_0x53d9af,_0xd7d963);}return _0x3ff8e1;}function getCustomFields(_0x3fe4f6,_0xf4045d){var _0x2f62f0=[];var _0x57077d={'custom_fields':[]};if(_0x3fe4f6[_0x90b5('0x2c')]>0x0){_[_0x90b5('0x1a')](_0x3fe4f6,function(_0x3df973){if(_0x3df973['type']===_0x90b5('0x41')&&_0x3df973[_0x90b5('0x42')]&&!_0x3df973[_0x90b5('0x43')]){_0x57077d[_0x3df973[_0x90b5('0x42')][_0x90b5('0x44')]()]=_0x3df973['content'][_0x90b5('0x22')]();}else if(_0x3df973['type']===_0x90b5('0x41')&&_0x3df973[_0x90b5('0x1d')]&&_0x3df973['customField']){_0x57077d['custom_fields']['push']({'id':_0x3df973[_0x90b5('0x1d')],'value':_0x3df973[_0x90b5('0x45')][_0x90b5('0x22')]()});}else if(_0x3df973[_0x90b5('0x46')]==='variable'&&_0x3df973['variableName']&&_0x3df973['idField']&&_0x3df973[_0x90b5('0x43')]){_0xf4045d[_0x3df973['variableName']]&&_0x57077d[_0x90b5('0x47')][_0x90b5('0x1c')]({'id':_0x3df973[_0x90b5('0x1d')],'value':_0xf4045d[_0x3df973[_0x90b5('0x1b')]][_0x90b5('0x22')]()});}else if(_0x3df973[_0x90b5('0x46')]===_0x90b5('0x48')&&_0x3df973['Variable']&&_0x3df973[_0x90b5('0x49')][_0x90b5('0xd')]&&_0x3df973[_0x90b5('0x1d')]&&_0x3df973['customField']){_0xf4045d[_0x3df973[_0x90b5('0x49')][_0x90b5('0xd')]['toLowerCase']()]&&_0x57077d[_0x90b5('0x47')]['push']({'id':_0x3df973[_0x90b5('0x1d')],'value':_0xf4045d[_0x3df973[_0x90b5('0x49')]['name'][_0x90b5('0x44')]()]['toString']()});}});}return _0x57077d;}function getConnection(_0x4ce892){return request({'method':'POST','form':{'method':'login','input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x90b5('0x24')]({'user_auth':{'user_name':_0x4ce892['username'],'password':_0x4ce892[_0x90b5('0x4a')],'encryption':_0x90b5('0x4b')},'application':_0x90b5('0x4c')})}})[_0x90b5('0x2a')](function(_0x495a3d){var _0x20eb5f=_0x495a3d;if(_0x20eb5f['id']){def[_0x90b5('0x4d')]=_0x20eb5f['id'];return BPromise[_0x90b5('0x31')](_0x20eb5f);}else{throw new Error(util[_0x90b5('0x20')](_0x90b5('0x4e'),_0x4ce892['id']));}});}function setRelationship(_0x4417b3,_0x5d88a4,_0x2232ee,_0x3ef77f){return request({'form':{'method':_0x90b5('0x4f'),'input_type':_0x90b5('0x1e'),'response_type':'JSON','rest_data':JSON[_0x90b5('0x24')]({'session':_0x4417b3['id'],'module_name':_0x90b5('0x1f'),'module_id':_0x2232ee['id'],'link_field_name':_0x3ef77f,'related_ids':[_0x5d88a4['id']]})}});}exports[_0x90b5('0x50')]=function(_0x537cae,_0xa9d77,_0x73c889,_0x36e46a,_0x4276e7,_0x5ca115){var _0x33e55b,_0x4d377b,_0x24a010,_0x58615b;_0x5ca115[_0x90b5('0x51')]=intUtil[_0x90b5('0x52')](_0x5ca115['remoteUri']);_0x5ca115[_0x90b5('0x53')]=intUtil['stripTrailingSlash'](_0x5ca115['serverUrl']);def[_0x90b5('0x54')]=util[_0x90b5('0x20')]('%s/service/v4_1/rest.php',_0x5ca115[_0x90b5('0x51')]);if(_0x4276e7&&_0x4276e7[_0x90b5('0x55')]){logger['info'](_0x90b5('0x56'),_0x90b5('0x57'));_0xa9d77[_0x90b5('0x58')]=util[_0x90b5('0x20')](_0x90b5('0x59'),_0x5ca115[_0x90b5('0x53')],_0xa9d77[_0x90b5('0x5a')],md5(_0xa9d77[_0x90b5('0x5a')]));}else{_0xa9d77[_0x90b5('0x58')]='';}return getConnection(_0x5ca115)[_0x90b5('0x2a')](function(_0x1fae28){_0x58615b=_0x1fae28;return getUser(_0x5ca115,_0x36e46a[_0x90b5('0xd')],_0x58615b);})['then'](function(_0x501c03){_0x33e55b=_0x501c03;logger[_0x90b5('0xc')](_0x90b5('0x5b'),_0x33e55b['id']);return getEndUser(_0x5ca115,_0xa9d77[_0x90b5('0x5c')],_0xa9d77[_0x90b5('0x5d')],_0x58615b);})[_0x90b5('0x2a')](function(_0x46706b){_0x4d377b=_0x46706b;logger[_0x90b5('0xc')]('The\x20Enduser\x20ID\x20is:',_0x4d377b['id']);return getTicket(_0x5ca115,_0x33e55b,_0x4d377b,_0x73c889,_0xa9d77,_0x73c889[_0x90b5('0x5e')],_0x58615b,'Inbound');})[_0x90b5('0x2a')](function(_0x44e655){_0x24a010=_0x44e655;logger['info']('Ticket\x20created!');logger[_0x90b5('0xc')]('The\x20Ticket\x20ID\x20is:',_0x24a010['id']);return setRelationship(_0x58615b,_0x33e55b,_0x24a010,'users');})[_0x90b5('0x2a')](function(){return setRelationship(_0x58615b,_0x4d377b,_0x24a010,_0x90b5('0x5f'));})[_0x90b5('0x2a')](function(){return getServerInfo(_0x58615b);})[_0x90b5('0x2a')](function(_0x3a2a3f){var _0x3f025b=parseInt(_0x3a2a3f['version'][_0x90b5('0x60')](0x0));var _0x434762=util['format'](_0x90b5('0x61'),_0x5ca115['remoteUri'],_0x24a010['id']);if(_0x3f025b>0x6){_0x434762=util[_0x90b5('0x20')](_0x90b5('0x62'),_0x5ca115[_0x90b5('0x51')],_0x24a010['id']);}logger['info']('[QUEUE]',_0x90b5('0x63'));emit(util[_0x90b5('0x20')](_0x90b5('0x64'),_0x36e46a[_0x90b5('0xd')]),_0x90b5('0x65'),{'uri':_0x434762});})['catch'](function(_0x344708){logger['error'](_0x90b5('0x56'),JSON['stringify'](_0x344708));});};exports[_0x90b5('0x66')]=function(_0x118c03,_0x4de2e4,_0x519fe8,_0x38e0b0,_0x208664,_0x169fb9,_0x3a8807){var _0x4dc590,_0x134f4f,_0x4ead54,_0xf8ee7a;_0x169fb9['remoteUri']=intUtil[_0x90b5('0x52')](_0x169fb9[_0x90b5('0x51')]);_0x169fb9['serverUrl']=intUtil['stripTrailingSlash'](_0x169fb9[_0x90b5('0x53')]);def[_0x90b5('0x54')]=util[_0x90b5('0x20')](_0x90b5('0x67'),_0x169fb9['remoteUri']);if(_0x3a8807&&_0x3a8807[_0x90b5('0x68')]&&_0x3a8807[_0x90b5('0x68')]!==_0x90b5('0x69')){logger[_0x90b5('0xc')](_0x90b5('0x6a'),_0x90b5('0x57'));_0x4de2e4[_0x90b5('0x58')]=util[_0x90b5('0x20')](_0x90b5('0x59'),_0x169fb9['serverUrl'],_0x4de2e4['uniqueid'],md5(_0x4de2e4['uniqueid']));}return getConnection(_0x169fb9)[_0x90b5('0x2a')](function(_0x10be60){_0xf8ee7a=_0x10be60;return getUser(_0x169fb9,_0x38e0b0[_0x90b5('0xd')],_0xf8ee7a);})[_0x90b5('0x2a')](function(_0x1f2af5){_0x4dc590=_0x1f2af5;logger[_0x90b5('0xc')]('The\x20User\x20ID\x20is:',_0x4dc590['id']);return getEndUser(_0x169fb9,_0x4de2e4[_0x90b5('0x6b')],_0x4de2e4[_0x90b5('0x6c')],_0xf8ee7a);})['then'](function(_0x1260c6){_0x134f4f=_0x1260c6;logger[_0x90b5('0xc')](_0x90b5('0x6d'),_0x134f4f['id']);return getTicket(_0x169fb9,_0x4dc590,_0x134f4f,_0x519fe8,_0x4de2e4,_0x519fe8['Fields'],_0xf8ee7a,_0x90b5('0x6e'));})[_0x90b5('0x2a')](function(_0xa56344){_0x4ead54=_0xa56344;logger[_0x90b5('0xc')](_0x90b5('0x6f'));logger[_0x90b5('0xc')](_0x90b5('0x70'),_0x4ead54['id']);return setRelationship(_0xf8ee7a,_0x4dc590,_0x4ead54,'users');})[_0x90b5('0x2a')](function(){return setRelationship(_0xf8ee7a,_0x134f4f,_0x4ead54,'contacts');})[_0x90b5('0x2a')](function(){return getServerInfo(_0xf8ee7a);})[_0x90b5('0x2a')](function(_0x1c379b){var _0x346bc7=parseInt(_0x1c379b[_0x90b5('0x71')][_0x90b5('0x60')](0x0));var _0x2b218d=util[_0x90b5('0x20')](_0x90b5('0x61'),_0x169fb9[_0x90b5('0x51')],_0x4ead54['id']);if(_0x346bc7>0x6){_0x2b218d=util[_0x90b5('0x20')](_0x90b5('0x62'),_0x169fb9[_0x90b5('0x51')],_0x4ead54['id']);}logger['info'](_0x90b5('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x90b5('0x64'),_0x38e0b0['name']),_0x90b5('0x65'),{'uri':_0x2b218d});})['catch'](function(_0x1c3eaa){logger[_0x90b5('0x72')]('[OUTBOUND]',JSON['stringify'](_0x1c3eaa));});};exports['abandoned']=function(_0x1e98f5,_0x230af0,_0x4b6f07,_0x15552d,_0x6db280,_0x1341ee){var _0x19d9db,_0x10a265,_0x5329af,_0x49ccce;_0x1341ee[_0x90b5('0x51')]=intUtil[_0x90b5('0x52')](_0x1341ee['remoteUri']);_0x1341ee['serverUrl']=intUtil['stripTrailingSlash'](_0x1341ee[_0x90b5('0x53')]);def[_0x90b5('0x54')]=util[_0x90b5('0x20')](_0x90b5('0x67'),_0x1341ee[_0x90b5('0x51')]);if(_0x6db280&&_0x6db280['monitor_format']){logger[_0x90b5('0xc')](_0x90b5('0x73'),_0x90b5('0x57'));_0x230af0[_0x90b5('0x58')]=util[_0x90b5('0x20')](_0x90b5('0x59'),_0x1341ee[_0x90b5('0x53')],_0x230af0['uniqueid'],md5(_0x230af0[_0x90b5('0x5a')]));}else{_0x230af0[_0x90b5('0x58')]='';}return getConnection(_0x1341ee)[_0x90b5('0x2a')](function(_0x7e270){_0x49ccce=_0x7e270;if(!_[_0x90b5('0x74')](_0x15552d)){return getUser(_0x1341ee,_0x15552d[_0x90b5('0xd')],_0x49ccce);}else{return getUser(_0x1341ee,null,_0x49ccce);}})[_0x90b5('0x2a')](function(_0x3b8ef7){_0x19d9db=_0x3b8ef7;logger['info'](_0x90b5('0x5b'),_0x19d9db['id']);return getEndUser(_0x1341ee,_0x230af0[_0x90b5('0x5c')],_0x230af0[_0x90b5('0x5d')],_0x49ccce);})['then'](function(_0x139c86){_0x10a265=_0x139c86;logger['info'](_0x90b5('0x6d'),_0x10a265['id']);return getTicket(_0x1341ee,_0x19d9db,_0x10a265,_0x4b6f07,_0x230af0,_0x4b6f07[_0x90b5('0x5e')],_0x49ccce,_0x90b5('0x75'));})[_0x90b5('0x2a')](function(_0x5a2dda){_0x5329af=_0x5a2dda;logger[_0x90b5('0xc')](_0x90b5('0x6f'));logger[_0x90b5('0xc')]('The\x20Ticket\x20ID\x20is:',_0x5329af['id']);return setRelationship(_0x49ccce,_0x19d9db,_0x5329af,_0x90b5('0x76'));})[_0x90b5('0x2a')](function(){return setRelationship(_0x49ccce,_0x10a265,_0x5329af,_0x90b5('0x5f'));})[_0x90b5('0x2a')](function(){return getServerInfo(_0x49ccce);})['catch'](function(_0x661584){logger[_0x90b5('0x72')](_0x90b5('0x73'),JSON[_0x90b5('0x24')](_0x661584));});}; \ No newline at end of file +var _0x81d5=['parent_type','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','toString','base64','isNil','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','value','Agent\x20found!','resolve','name_value_list','user_id','Contacts','contacts.phone_home\x20=\x20\x22%s\x22','Enduser\x20found!','phone_home','first_name','','Caller\x20-\x20%s','Enduser\x20created.','[HTTP]','type','customField','string','custom_fields','content','customVariable','Variable','toLowerCase','login','username','password','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','error','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','abandoned','monitor_format','[ABANDONED]','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','duration_hours','parent_id'];(function(_0x2d2e85,_0x22faa9){var _0x3e9f5e=function(_0x101c22){while(--_0x101c22){_0x2d2e85['push'](_0x2d2e85['shift']());}};_0x3e9f5e(++_0x22faa9);}(_0x81d5,0x1ab));var _0x581d=function(_0x327e1e,_0x18a30f){_0x327e1e=_0x327e1e-0x0;var _0x37032b=_0x81d5[_0x327e1e];return _0x37032b;};'use strict';var _=require(_0x581d('0x0'));var rp=require(_0x581d('0x1'));var BPromise=require('bluebird');var md5=require(_0x581d('0x2'));var util=require(_0x581d('0x3'));var Redis=require(_0x581d('0x4'));var intUtil=require(_0x581d('0x5'));var config=require(_0x581d('0x6'));var logger=require('../../../../config/logger')('sugarcrm');config[_0x581d('0x7')]=_[_0x581d('0x8')](config[_0x581d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x581d('0x9'))(new Redis(config[_0x581d('0x7')]));var def={'method':_0x581d('0xa'),'json':!![]};function emit(_0x497368,_0xf1a3b6,_0x5efb9b){io['to'](_0x497368)['emit'](_0xf1a3b6,_0x5efb9b);}function getTicket(_0x5d8fa3,_0xdeeb73,_0x3435a9,_0x2b73b1,_0x1cd001,_0x21fb9e,_0x5f31d8,_0x3f9320){logger[_0x581d('0xb')](_0x581d('0xc'));var _0x3bf7f7=new Date();var _0x1e403e=[{'name':_0x581d('0xd'),'value':intUtil[_0x581d('0xe')](_0x2b73b1[_0x581d('0xf')],_0x1cd001,'\x20')},{'name':_0x581d('0x10'),'value':_0xdeeb73['id']},{'name':_0x581d('0x11'),'value':_0xdeeb73['id']},{'name':'description','value':intUtil[_0x581d('0xe')](_0x2b73b1[_0x581d('0x12')],_0x1cd001,'\x0a')},{'name':'date_start','value':_0x3bf7f7['toISOString']()['slice'](0x0,0x13)['replace']('T','\x20')},{'name':_0x581d('0x13'),'value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x581d('0x14'),'value':_0x3435a9['id']},{'name':_0x581d('0x15'),'value':'Contacts'},{'name':_0x581d('0x16'),'value':_0x3435a9['name']},{'name':_0x581d('0x17'),'value':_0x3f9320}];if(_0x21fb9e[_0x581d('0x18')]){_[_0x581d('0x19')](_0x21fb9e,function(_0x42f7db){if(_0x1cd001[_0x42f7db[_0x581d('0x1a')]]){_0x1e403e[_0x581d('0x1b')]({'name':_0x42f7db[_0x581d('0x1c')],'value':_0x1cd001[_0x42f7db['variableName']]});}});}return request({'form':{'method':_0x581d('0x1d'),'input_type':_0x581d('0x1e'),'response_type':_0x581d('0x1e'),'rest_data':JSON[_0x581d('0x1f')]({'session':_0x5f31d8['id'],'module_name':_0x581d('0x20'),'name_value_list':_0x1e403e})}});}function getAuth(_0x2a2aba){return util[_0x581d('0x21')](_0x581d('0x22'),new Buffer(_0x2a2aba[_0x581d('0x23')]+':X')[_0x581d('0x24')](_0x581d('0x25')));}function getServerInfo(_0xf74d2b){return request({'form':{'method':'get_server_info','input_type':_0x581d('0x1e'),'response_type':_0x581d('0x1e'),'rest_data':JSON[_0x581d('0x1f')]({'session':_0xf74d2b['id']})}});}function getUser(_0x2a4cd9,_0x2addd8,_0x4f7420){if(!_[_0x581d('0x26')](_0x2addd8)){logger[_0x581d('0xb')]('Getting\x20agent\x20with\x20name',_0x2addd8);return request({'form':{'method':_0x581d('0x27'),'input_type':_0x581d('0x1e'),'response_type':_0x581d('0x1e'),'rest_data':JSON['stringify']({'session':_0x4f7420['id'],'module_name':_0x581d('0x28'),'query':util[_0x581d('0x21')](_0x581d('0x29'),_0x2addd8),'order_by':'','offset':'0','select_fields':['id',_0x581d('0xd'),_0x581d('0x2a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x581d('0x2b')](function(_0x4b9b62){if(_0x4b9b62[_0x581d('0x2c')][_0x581d('0x18')]){var _0x36ee1b=_['find'](_0x4b9b62['entry_list'],function(_0x504f71){return _0x504f71['name_value_list'][_0x581d('0x2a')][_0x581d('0x2d')]===_0x2addd8;});if(_0x36ee1b){logger[_0x581d('0xb')](_0x581d('0x2e'));return BPromise[_0x581d('0x2f')]({'id':_0x36ee1b[_0x581d('0x30')]['id'][_0x581d('0x2d')],'name':_0x36ee1b[_0x581d('0x30')][_0x581d('0xd')][_0x581d('0x2d')]});}}logger[_0x581d('0xb')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x581d('0x2f')]({'id':_0x4f7420['name_value_list'][_0x581d('0x31')][_0x581d('0x2d')],'name':_0x4f7420[_0x581d('0x30')][_0x581d('0x2a')][_0x581d('0x2d')]});});}else{logger[_0x581d('0xb')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x581d('0x2f')]({'id':_0x4f7420[_0x581d('0x30')]['user_id']['value'],'name':_0x4f7420['name_value_list'][_0x581d('0x2a')][_0x581d('0x2d')]});}}function getEndUser(_0x34c71b,_0x2d6f9e,_0xeccfd6,_0x5399fe){logger[_0x581d('0xb')]('Searching\x20enduser\x20with\x20phone',_0xeccfd6);return request({'form':{'method':_0x581d('0x27'),'input_type':_0x581d('0x1e'),'response_type':'JSON','rest_data':JSON[_0x581d('0x1f')]({'session':_0x5399fe['id'],'module_name':_0x581d('0x32'),'query':util[_0x581d('0x21')](_0x581d('0x33'),_0xeccfd6),'order_by':'','offset':'0','select_fields':['id',_0x581d('0xd'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x581d('0x2b')](function(_0x5cb54b){if(_0x5cb54b[_0x581d('0x2c')][_0x581d('0x18')]){var _0x5ad1fe=_['find'](_0x5cb54b['entry_list'],function(_0x59fc1e){return _0x59fc1e[_0x581d('0x30')]['phone_home'][_0x581d('0x2d')]===_0xeccfd6;});if(_0x5ad1fe){logger['info'](_0x581d('0x34'));return BPromise[_0x581d('0x2f')]({'id':_0x5ad1fe[_0x581d('0x30')]['id'][_0x581d('0x2d')],'name':_0x5ad1fe[_0x581d('0x30')][_0x581d('0xd')][_0x581d('0x2d')],'phone':_0x5ad1fe[_0x581d('0x30')][_0x581d('0x35')][_0x581d('0x2d')]});}}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'form':{'method':_0x581d('0x1d'),'input_type':_0x581d('0x1e'),'response_type':_0x581d('0x1e'),'rest_data':JSON['stringify']({'session':_0x5399fe['id'],'module_name':_0x581d('0x32'),'name_value_list':[{'name':_0x581d('0x36'),'value':_0x2d6f9e!==_0x581d('0x37')?_0x2d6f9e:util['format'](_0x581d('0x38'),_0xeccfd6)},{'name':_0x581d('0x35'),'value':_0xeccfd6}]})}})['then'](function(_0x3de4ca){logger[_0x581d('0xb')](_0x581d('0x39'));return BPromise[_0x581d('0x2f')]({'id':_0x3de4ca['id'],'name':_0x3de4ca[_0x581d('0x2c')][_0x581d('0x36')][_0x581d('0x2d')],'phone':_0x3de4ca['entry_list'][_0x581d('0x35')][_0x581d('0x2d')]});});}});}function request(_0x20fbf1){logger['debug'](_0x581d('0x3a'),JSON[_0x581d('0x1f')](_0x20fbf1));return rp(_['merge'](def,_0x20fbf1));}function getTags(_0x5c1b16,_0x3e1351){var _0x458851=[];if(_0x5c1b16&&_0x5c1b16[_0x581d('0x18')]>0x0){_0x458851=_['map'](_0x5c1b16,_0x3e1351);}return _0x458851;}function getCustomFields(_0x1ca4df,_0x3dad08){var _0x4a7fcd=[];var _0x31a7ce={'custom_fields':[]};if(_0x1ca4df['length']>0x0){_[_0x581d('0x19')](_0x1ca4df,function(_0x546ae1){if(_0x546ae1[_0x581d('0x3b')]==='string'&&_0x546ae1['nameField']&&!_0x546ae1[_0x581d('0x3c')]){_0x31a7ce[_0x546ae1['nameField']['toLowerCase']()]=_0x546ae1['content'][_0x581d('0x24')]();}else if(_0x546ae1[_0x581d('0x3b')]===_0x581d('0x3d')&&_0x546ae1['idField']&&_0x546ae1[_0x581d('0x3c')]){_0x31a7ce[_0x581d('0x3e')]['push']({'id':_0x546ae1['idField'],'value':_0x546ae1[_0x581d('0x3f')]['toString']()});}else if(_0x546ae1[_0x581d('0x3b')]==='variable'&&_0x546ae1[_0x581d('0x1a')]&&_0x546ae1[_0x581d('0x1c')]&&_0x546ae1['customField']){_0x3dad08[_0x546ae1[_0x581d('0x1a')]]&&_0x31a7ce[_0x581d('0x3e')][_0x581d('0x1b')]({'id':_0x546ae1[_0x581d('0x1c')],'value':_0x3dad08[_0x546ae1[_0x581d('0x1a')]]['toString']()});}else if(_0x546ae1[_0x581d('0x3b')]===_0x581d('0x40')&&_0x546ae1[_0x581d('0x41')]&&_0x546ae1[_0x581d('0x41')][_0x581d('0xd')]&&_0x546ae1[_0x581d('0x1c')]&&_0x546ae1[_0x581d('0x3c')]){_0x3dad08[_0x546ae1['Variable'][_0x581d('0xd')][_0x581d('0x42')]()]&&_0x31a7ce[_0x581d('0x3e')][_0x581d('0x1b')]({'id':_0x546ae1[_0x581d('0x1c')],'value':_0x3dad08[_0x546ae1[_0x581d('0x41')][_0x581d('0xd')]['toLowerCase']()][_0x581d('0x24')]()});}});}return _0x31a7ce;}function getConnection(_0x1f2846){return request({'method':'POST','form':{'method':_0x581d('0x43'),'input_type':'JSON','response_type':_0x581d('0x1e'),'rest_data':JSON[_0x581d('0x1f')]({'user_auth':{'user_name':_0x1f2846[_0x581d('0x44')],'password':_0x1f2846[_0x581d('0x45')],'encryption':'PLAIN'},'application':'xCALLY\x20Motion\x20integration'})}})[_0x581d('0x2b')](function(_0x3b9c05){var _0x4bd895=_0x3b9c05;if(_0x4bd895['id']){def['sessionID']=_0x4bd895['id'];return BPromise[_0x581d('0x2f')](_0x4bd895);}else{throw new Error(util[_0x581d('0x21')](_0x581d('0x46'),_0x1f2846['id']));}});}function setRelationship(_0x43bd60,_0x5d4966,_0x468642,_0x4350c3){return request({'form':{'method':_0x581d('0x47'),'input_type':_0x581d('0x1e'),'response_type':_0x581d('0x1e'),'rest_data':JSON[_0x581d('0x1f')]({'session':_0x43bd60['id'],'module_name':_0x581d('0x20'),'module_id':_0x468642['id'],'link_field_name':_0x4350c3,'related_ids':[_0x5d4966['id']]})}});}exports[_0x581d('0x48')]=function(_0x4730d9,_0x5a565e,_0x3749a0,_0x3252dc,_0x2115b5,_0x510a39){var _0x2a6ab3,_0x513b5b,_0x40ec25,_0x3bd923;_0x510a39[_0x581d('0x49')]=intUtil[_0x581d('0x4a')](_0x510a39['remoteUri']);_0x510a39['serverUrl']=intUtil[_0x581d('0x4a')](_0x510a39[_0x581d('0x4b')]);def[_0x581d('0x4c')]=util[_0x581d('0x21')](_0x581d('0x4d'),_0x510a39['remoteUri']);if(_0x2115b5&&_0x2115b5['monitor_format']){logger[_0x581d('0xb')](_0x581d('0x4e'),_0x581d('0x4f'));_0x5a565e['recordingURL']=util[_0x581d('0x21')](_0x581d('0x50'),_0x510a39[_0x581d('0x4b')],_0x5a565e[_0x581d('0x51')],md5(_0x5a565e[_0x581d('0x51')]));}else{_0x5a565e[_0x581d('0x52')]='';}return getConnection(_0x510a39)[_0x581d('0x2b')](function(_0x1dedb9){_0x3bd923=_0x1dedb9;return getUser(_0x510a39,_0x3252dc['name'],_0x3bd923);})[_0x581d('0x2b')](function(_0x311635){_0x2a6ab3=_0x311635;logger['info'](_0x581d('0x53'),_0x2a6ab3['id']);return getEndUser(_0x510a39,_0x5a565e[_0x581d('0x54')],_0x5a565e[_0x581d('0x55')],_0x3bd923);})[_0x581d('0x2b')](function(_0x223af8){_0x513b5b=_0x223af8;logger[_0x581d('0xb')](_0x581d('0x56'),_0x513b5b['id']);return getTicket(_0x510a39,_0x2a6ab3,_0x513b5b,_0x3749a0,_0x5a565e,_0x3749a0[_0x581d('0x57')],_0x3bd923,_0x581d('0x58'));})[_0x581d('0x2b')](function(_0x4249b7){_0x40ec25=_0x4249b7;logger[_0x581d('0xb')]('Ticket\x20created!');logger[_0x581d('0xb')]('The\x20Ticket\x20ID\x20is:',_0x40ec25['id']);return setRelationship(_0x3bd923,_0x2a6ab3,_0x40ec25,_0x581d('0x59'));})['then'](function(){return setRelationship(_0x3bd923,_0x513b5b,_0x40ec25,_0x581d('0x5a'));})[_0x581d('0x2b')](function(){return getServerInfo(_0x3bd923);})[_0x581d('0x2b')](function(_0x19fd4c){var _0x1dcb58=parseInt(_0x19fd4c['version'][_0x581d('0x5b')](0x0));var _0x4ef7a3=util[_0x581d('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x510a39[_0x581d('0x49')],_0x40ec25['id']);if(_0x1dcb58>0x6){_0x4ef7a3=util[_0x581d('0x21')](_0x581d('0x5c'),_0x510a39[_0x581d('0x49')],_0x40ec25['id']);}logger[_0x581d('0xb')](_0x581d('0x4e'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x581d('0x5d'),_0x3252dc[_0x581d('0xd')]),'trigger:browser:url',{'uri':_0x4ef7a3});})['catch'](function(_0x345d58){logger[_0x581d('0x5e')]('[QUEUE]',JSON[_0x581d('0x1f')](_0x345d58));});};exports[_0x581d('0x5f')]=function(_0xa21214,_0x4a6748,_0x2f5310,_0x5b553d,_0x5f31b1,_0x30e6f0,_0x293302){var _0xe1a8da,_0x44cee5,_0x3942ce,_0x4c8c96;_0x30e6f0[_0x581d('0x49')]=intUtil[_0x581d('0x4a')](_0x30e6f0[_0x581d('0x49')]);_0x30e6f0[_0x581d('0x4b')]=intUtil[_0x581d('0x4a')](_0x30e6f0[_0x581d('0x4b')]);def[_0x581d('0x4c')]=util[_0x581d('0x21')]('%s/service/v4_1/rest.php',_0x30e6f0[_0x581d('0x49')]);if(_0x293302&&_0x293302[_0x581d('0x60')]&&_0x293302[_0x581d('0x60')]!==_0x581d('0x61')){logger[_0x581d('0xb')](_0x581d('0x62'),_0x581d('0x4f'));_0x4a6748[_0x581d('0x52')]=util[_0x581d('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x30e6f0[_0x581d('0x4b')],_0x4a6748[_0x581d('0x51')],md5(_0x4a6748[_0x581d('0x51')]));}return getConnection(_0x30e6f0)['then'](function(_0xf0d76f){_0x4c8c96=_0xf0d76f;return getUser(_0x30e6f0,_0x5b553d[_0x581d('0xd')],_0x4c8c96);})[_0x581d('0x2b')](function(_0xa401c5){_0xe1a8da=_0xa401c5;logger[_0x581d('0xb')](_0x581d('0x53'),_0xe1a8da['id']);return getEndUser(_0x30e6f0,_0x4a6748[_0x581d('0x63')],_0x4a6748[_0x581d('0x64')],_0x4c8c96);})[_0x581d('0x2b')](function(_0x709197){_0x44cee5=_0x709197;logger['info'](_0x581d('0x56'),_0x44cee5['id']);return getTicket(_0x30e6f0,_0xe1a8da,_0x44cee5,_0x2f5310,_0x4a6748,_0x2f5310[_0x581d('0x57')],_0x4c8c96,_0x581d('0x65'));})[_0x581d('0x2b')](function(_0x3e6d92){_0x3942ce=_0x3e6d92;logger[_0x581d('0xb')](_0x581d('0x66'));logger[_0x581d('0xb')](_0x581d('0x67'),_0x3942ce['id']);return setRelationship(_0x4c8c96,_0xe1a8da,_0x3942ce,_0x581d('0x59'));})['then'](function(){return setRelationship(_0x4c8c96,_0x44cee5,_0x3942ce,'contacts');})[_0x581d('0x2b')](function(){return getServerInfo(_0x4c8c96);})[_0x581d('0x2b')](function(_0x2efe64){var _0x20e074=parseInt(_0x2efe64[_0x581d('0x68')][_0x581d('0x5b')](0x0));var _0xb7c37c=util['format'](_0x581d('0x69'),_0x30e6f0['remoteUri'],_0x3942ce['id']);if(_0x20e074>0x6){_0xb7c37c=util[_0x581d('0x21')](_0x581d('0x5c'),_0x30e6f0[_0x581d('0x49')],_0x3942ce['id']);}logger[_0x581d('0xb')](_0x581d('0x62'),_0x581d('0x6a'));emit(util['format'](_0x581d('0x5d'),_0x5b553d[_0x581d('0xd')]),_0x581d('0x6b'),{'uri':_0xb7c37c});})[_0x581d('0x6c')](function(_0x75595b){logger[_0x581d('0x5e')](_0x581d('0x62'),JSON[_0x581d('0x1f')](_0x75595b));});};exports[_0x581d('0x6d')]=function(_0x50bf64,_0x1642d8,_0x3e1c34,_0x48a8f1,_0x1e2d7b,_0xd9781){var _0x52ca16,_0x21b8da,_0x54e758,_0x343c2a;_0xd9781[_0x581d('0x49')]=intUtil[_0x581d('0x4a')](_0xd9781[_0x581d('0x49')]);_0xd9781[_0x581d('0x4b')]=intUtil['stripTrailingSlash'](_0xd9781[_0x581d('0x4b')]);def['uri']=util[_0x581d('0x21')](_0x581d('0x4d'),_0xd9781['remoteUri']);if(_0x1e2d7b&&_0x1e2d7b[_0x581d('0x6e')]){logger[_0x581d('0xb')](_0x581d('0x6f'),'Recording\x20is\x20enabled!');_0x1642d8[_0x581d('0x52')]=util[_0x581d('0x21')](_0x581d('0x50'),_0xd9781['serverUrl'],_0x1642d8[_0x581d('0x51')],md5(_0x1642d8['uniqueid']));}else{_0x1642d8['recordingURL']='';}return getConnection(_0xd9781)[_0x581d('0x2b')](function(_0x574b6c){_0x343c2a=_0x574b6c;if(!_[_0x581d('0x26')](_0x48a8f1)){return getUser(_0xd9781,_0x48a8f1[_0x581d('0xd')],_0x343c2a);}else{return getUser(_0xd9781,null,_0x343c2a);}})['then'](function(_0x11fb53){_0x52ca16=_0x11fb53;logger['info'](_0x581d('0x53'),_0x52ca16['id']);return getEndUser(_0xd9781,_0x1642d8[_0x581d('0x54')],_0x1642d8[_0x581d('0x55')],_0x343c2a);})[_0x581d('0x2b')](function(_0x456ec2){_0x21b8da=_0x456ec2;logger[_0x581d('0xb')](_0x581d('0x56'),_0x21b8da['id']);return getTicket(_0xd9781,_0x52ca16,_0x21b8da,_0x3e1c34,_0x1642d8,_0x3e1c34[_0x581d('0x57')],_0x343c2a,'Inbound');})[_0x581d('0x2b')](function(_0x551505){_0x54e758=_0x551505;logger[_0x581d('0xb')](_0x581d('0x66'));logger['info'](_0x581d('0x67'),_0x54e758['id']);return setRelationship(_0x343c2a,_0x52ca16,_0x54e758,'users');})[_0x581d('0x2b')](function(){return setRelationship(_0x343c2a,_0x21b8da,_0x54e758,'contacts');})[_0x581d('0x2b')](function(){return getServerInfo(_0x343c2a);})[_0x581d('0x6c')](function(_0xd9184){logger['error'](_0x581d('0x6f'),JSON['stringify'](_0xd9184));});}; \ 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 f1ce001..dd27625 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 _0x872a=['variableName','toString','Variable','name','toLowerCase','keyType','key','%s:\x20%s','keyContent','format','customVariable','stripTrailingSlash','substring','lastIndexOf','validateEmail','isNil','test','lodash','getString','length','sortBy','string','push','content','type','variable'];(function(_0x4d67b8,_0x565134){var _0x55af3b=function(_0x145904){while(--_0x145904){_0x4d67b8['push'](_0x4d67b8['shift']());}};_0x55af3b(++_0x565134);}(_0x872a,0xad));var _0xa872=function(_0x5815c2,_0x454a8a){_0x5815c2=_0x5815c2-0x0;var _0x1fe394=_0x872a[_0x5815c2];return _0x1fe394;};'use strict';var _=require(_0xa872('0x0'));var util=require('util');exports[_0xa872('0x1')]=function(_0xe6aef8,_0x1e24de,_0x48e8bb){var _0x5c50db=[];if(_0xe6aef8[_0xa872('0x2')]>0x0){var _0x5f1a56=_[_0xa872('0x3')](_0xe6aef8,['id']);for(var _0x56eced=0x0;_0x56eced<_0x5f1a56[_0xa872('0x2')];_0x56eced++){var _0x330831=_0x5f1a56[_0x56eced];if(_0x330831['type']===_0xa872('0x4')){_0x5c50db[_0xa872('0x5')](_0x330831[_0xa872('0x6')]);}else if(_0x330831[_0xa872('0x7')]===_0xa872('0x8')&&_0x330831[_0xa872('0x9')]){_0x1e24de[_0x330831['variableName']]&&_0x5c50db[_0xa872('0x5')](_0x1e24de[_0x330831[_0xa872('0x9')]][_0xa872('0xa')]());}else if(_0x330831[_0xa872('0x7')]==='customVariable'&&_0x330831[_0xa872('0xb')]&&_0x330831[_0xa872('0xb')][_0xa872('0xc')]){_0x1e24de[_0x330831[_0xa872('0xb')][_0xa872('0xc')][_0xa872('0xd')]()]&&_0x5c50db[_0xa872('0x5')](_0x1e24de[_0x330831['Variable'][_0xa872('0xc')][_0xa872('0xd')]()][_0xa872('0xa')]());}else if(_0x330831['type']==='keyValue'){if(_0x330831[_0xa872('0xe')]===_0xa872('0x4')&&_0x330831[_0xa872('0xf')]){_0x5c50db[_0xa872('0x5')](util['format'](_0xa872('0x10'),_0x330831[_0xa872('0xf')],_0x330831[_0xa872('0x11')]));}else if(_0x330831[_0xa872('0xe')]===_0xa872('0x8')&&_0x330831[_0xa872('0x9')]&&_0x330831['key']){_0x1e24de[_0x330831[_0xa872('0x9')]]&&_0x5c50db[_0xa872('0x5')](util[_0xa872('0x12')]('%s:\x20%s',_0x330831['key'],_0x1e24de[_0x330831[_0xa872('0x9')]]));}else if(_0x330831[_0xa872('0xe')]===_0xa872('0x13')&&_0x330831[_0xa872('0xb')]&&_0x330831[_0xa872('0xb')][_0xa872('0xc')]&&_0x330831[_0xa872('0xf')]){_0x1e24de[_0x330831[_0xa872('0xb')]['name'][_0xa872('0xd')]()]&&_0x5c50db[_0xa872('0x5')](util[_0xa872('0x12')](_0xa872('0x10'),_0x330831['key'],_0x1e24de[_0x330831[_0xa872('0xb')][_0xa872('0xc')][_0xa872('0xd')]()]));}}}}return _0x5c50db['join'](_0x48e8bb);};exports[_0xa872('0x14')]=function(_0x42ec7b){var _0x35952e=_0x42ec7b['slice'](-0x1);if(_0x35952e==='/'){_0x42ec7b=_0x42ec7b[_0xa872('0x15')](0x0,_0x42ec7b[_0xa872('0x16')](_0x35952e));}return _0x42ec7b;};exports[_0xa872('0x17')]=function(_0x231026){if(!_[_0xa872('0x18')](_0x231026)&&_0x231026!==''){var _0x434cfe=/^(([^<>()\[\]\\.,;:\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 _0x434cfe[_0xa872('0x19')](String(_0x231026)[_0xa872('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xbd4d=['%s:\x20%s','customVariable','join','stripTrailingSlash','slice','substring','lastIndexOf','isNil','test','lodash','util','getString','length','sortBy','content','variable','variableName','push','toString','type','Variable','name','toLowerCase','keyValue','keyType','string','key','format'];(function(_0x39d39d,_0x5586bd){var _0x577ac3=function(_0x12f9f2){while(--_0x12f9f2){_0x39d39d['push'](_0x39d39d['shift']());}};_0x577ac3(++_0x5586bd);}(_0xbd4d,0x191));var _0xdbd4=function(_0x11a383,_0x4e05ae){_0x11a383=_0x11a383-0x0;var _0x49f2bb=_0xbd4d[_0x11a383];return _0x49f2bb;};'use strict';var _=require(_0xdbd4('0x0'));var util=require(_0xdbd4('0x1'));exports[_0xdbd4('0x2')]=function(_0x1f5dbd,_0x1b8455,_0x4417d2){var _0x578062=[];if(_0x1f5dbd[_0xdbd4('0x3')]>0x0){var _0x1b4b2d=_[_0xdbd4('0x4')](_0x1f5dbd,['id']);for(var _0x426150=0x0;_0x426150<_0x1b4b2d[_0xdbd4('0x3')];_0x426150++){var _0x53eb9e=_0x1b4b2d[_0x426150];if(_0x53eb9e['type']==='string'){_0x578062['push'](_0x53eb9e[_0xdbd4('0x5')]);}else if(_0x53eb9e['type']===_0xdbd4('0x6')&&_0x53eb9e[_0xdbd4('0x7')]){_0x1b8455[_0x53eb9e[_0xdbd4('0x7')]]&&_0x578062[_0xdbd4('0x8')](_0x1b8455[_0x53eb9e[_0xdbd4('0x7')]][_0xdbd4('0x9')]());}else if(_0x53eb9e[_0xdbd4('0xa')]==='customVariable'&&_0x53eb9e[_0xdbd4('0xb')]&&_0x53eb9e[_0xdbd4('0xb')][_0xdbd4('0xc')]){_0x1b8455[_0x53eb9e[_0xdbd4('0xb')][_0xdbd4('0xc')][_0xdbd4('0xd')]()]&&_0x578062[_0xdbd4('0x8')](_0x1b8455[_0x53eb9e[_0xdbd4('0xb')]['name'][_0xdbd4('0xd')]()][_0xdbd4('0x9')]());}else if(_0x53eb9e[_0xdbd4('0xa')]===_0xdbd4('0xe')){if(_0x53eb9e[_0xdbd4('0xf')]===_0xdbd4('0x10')&&_0x53eb9e[_0xdbd4('0x11')]){_0x578062[_0xdbd4('0x8')](util[_0xdbd4('0x12')]('%s:\x20%s',_0x53eb9e['key'],_0x53eb9e['keyContent']));}else if(_0x53eb9e['keyType']==='variable'&&_0x53eb9e[_0xdbd4('0x7')]&&_0x53eb9e[_0xdbd4('0x11')]){_0x1b8455[_0x53eb9e[_0xdbd4('0x7')]]&&_0x578062[_0xdbd4('0x8')](util[_0xdbd4('0x12')](_0xdbd4('0x13'),_0x53eb9e[_0xdbd4('0x11')],_0x1b8455[_0x53eb9e[_0xdbd4('0x7')]]));}else if(_0x53eb9e[_0xdbd4('0xf')]===_0xdbd4('0x14')&&_0x53eb9e[_0xdbd4('0xb')]&&_0x53eb9e[_0xdbd4('0xb')][_0xdbd4('0xc')]&&_0x53eb9e[_0xdbd4('0x11')]){_0x1b8455[_0x53eb9e['Variable'][_0xdbd4('0xc')][_0xdbd4('0xd')]()]&&_0x578062[_0xdbd4('0x8')](util[_0xdbd4('0x12')]('%s:\x20%s',_0x53eb9e[_0xdbd4('0x11')],_0x1b8455[_0x53eb9e[_0xdbd4('0xb')][_0xdbd4('0xc')][_0xdbd4('0xd')]()]));}}}}return _0x578062[_0xdbd4('0x15')](_0x4417d2);};exports[_0xdbd4('0x16')]=function(_0x349224){var _0x243500=_0x349224[_0xdbd4('0x17')](-0x1);if(_0x243500==='/'){_0x349224=_0x349224[_0xdbd4('0x18')](0x0,_0x349224[_0xdbd4('0x19')](_0x243500));}return _0x349224;};exports['validateEmail']=function(_0x53305e){if(!_[_0xdbd4('0x1a')](_0x53305e)&&_0x53305e!==''){var _0x2582a9=/^(([^<>()\[\]\\.,;:\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 _0x2582a9[_0xdbd4('0x1b')](String(_0x53305e)[_0xdbd4('0xd')]());}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 f4f51b5..8f769d1 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 _0xedd9=['success','resolve','result','stringify','error','catch','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','GET','%s/webservice.php','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','length','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','getEndUser','accessKey','login','token','getConnection','[HTTP]','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','outbound','serverUrl','recordingFormat','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','abandoned','calleridname','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','emit','forEach','string','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','merge','getString','Subjects','POST','format','remoteUri','create','username','sessionName','HelpDesk','then'];(function(_0x130ac7,_0x10b492){var _0x69fef2=function(_0x249f71){while(--_0x249f71){_0x130ac7['push'](_0x130ac7['shift']());}};_0x69fef2(++_0x10b492);}(_0xedd9,0xfc));var _0x9edd=function(_0x381c51,_0x15afd6){_0x381c51=_0x381c51-0x0;var _0x308326=_0xedd9[_0x381c51];return _0x308326;};'use strict';var _=require('lodash');var rp=require(_0x9edd('0x0'));var BPromise=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var util=require(_0x9edd('0x3'));var Redis=require(_0x9edd('0x4'));var intUtil=require(_0x9edd('0x5'));var config=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('vTiger');config[_0x9edd('0x8')]=_[_0x9edd('0x9')](config[_0x9edd('0x8')],{'host':_0x9edd('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9edd('0x8')]));function emit(_0x571af9,_0x172522,_0x190185){io['to'](_0x571af9)[_0x9edd('0xb')](_0x172522,_0x190185);}function getCustomFields(_0x3280fd,_0x49d5e3){var _0x494a24={};if(_0x3280fd['length']>0x0){_[_0x9edd('0xc')](_0x3280fd,function(_0x138767){if(_0x138767['type']===_0x9edd('0xd')&&_0x138767[_0x9edd('0xe')]){_0x494a24[_0x138767['idField']]=_0x138767[_0x9edd('0xf')][_0x9edd('0x10')]();}else if(_0x138767[_0x9edd('0x11')]===_0x9edd('0x12')&&_0x138767[_0x9edd('0x13')]&&_0x138767[_0x9edd('0xe')]&&_0x49d5e3[_0x138767[_0x9edd('0x13')]]){_0x494a24[_0x138767[_0x9edd('0xe')]]=_0x49d5e3[_0x138767['variableName']][_0x9edd('0x10')]();}else if(_0x138767[_0x9edd('0x11')]===_0x9edd('0x14')&&_0x138767[_0x9edd('0x15')]&&_0x138767[_0x9edd('0x15')][_0x9edd('0x16')]&&_0x138767[_0x9edd('0xe')]&&_0x49d5e3[_0x138767[_0x9edd('0x15')]['name'][_0x9edd('0x17')]()]){_0x494a24[_0x138767[_0x9edd('0xe')]]=_0x49d5e3[_0x138767[_0x9edd('0x15')]['name'][_0x9edd('0x17')]()][_0x9edd('0x10')]();}});}return _0x494a24;}function createTicket(_0x40ba32,_0x4d8f33,_0x43dc70,_0x5d879c,_0x2cdcef,_0x1083e4,_0x4bdb88){logger['info'](_0x9edd('0x18'));var _0x50338f=_[_0x9edd('0x19')]({'parent_id':'','assigned_user_id':_0x4d8f33['id'],'ticketpriorities':'Normal','ticketstatus':'Open','ticket_title':intUtil[_0x9edd('0x1a')](_0x5d879c[_0x9edd('0x1b')],_0x2cdcef,'\x20'),'description':intUtil['getString'](_0x5d879c['Descriptions'],_0x2cdcef,'\x0a'),'contact_id':_0x43dc70['id']},getCustomFields(_0x1083e4,_0x2cdcef));var _0x341d67={'method':_0x9edd('0x1c'),'uri':util[_0x9edd('0x1d')]('%s/webservice.php',_0x40ba32[_0x9edd('0x1e')]),'form':{'operation':_0x9edd('0x1f'),'username':_0x40ba32[_0x9edd('0x20')],'sessionName':_0x4bdb88[_0x9edd('0x21')],'elementType':_0x9edd('0x22'),'element':JSON['stringify'](_0x50338f)},'json':!![]};return request(_0x341d67)[_0x9edd('0x23')](function(_0xeaf55a){if(_0xeaf55a[_0x9edd('0x24')]){return BPromise[_0x9edd('0x25')]({'id':_0xeaf55a[_0x9edd('0x26')]['id']});}else{throw new Error(util['format']('Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s',JSON[_0x9edd('0x27')](_0xeaf55a[_0x9edd('0x28')])));}})[_0x9edd('0x29')](function(_0x25e135){var _0x3c2227=_0x25e135['statusCode']||0x1f4;logger['error'](_0x9edd('0x2a'),_0x9edd('0x2b'),_0x3c2227,JSON[_0x9edd('0x27')](_0x25e135));});}function getUser(_0x52746a,_0x238b22,_0x28cfae){if(intUtil[_0x9edd('0x2c')](_0x238b22)){logger[_0x9edd('0x2d')]('Getting\x20agent\x20with\x20email',_0x238b22);return request({'method':_0x9edd('0x2e'),'uri':util[_0x9edd('0x1d')](_0x9edd('0x2f'),_0x52746a[_0x9edd('0x1e')]),'qs':{'operation':_0x9edd('0x30'),'username':_0x52746a[_0x9edd('0x20')],'sessionName':_0x28cfae[_0x9edd('0x21')],'query':util[_0x9edd('0x1d')](_0x9edd('0x31'),_0x238b22)},'json':!![]})[_0x9edd('0x23')](function(_0x4fd03f){if(_0x4fd03f[_0x9edd('0x24')]&&_0x4fd03f[_0x9edd('0x26')][_0x9edd('0x32')]){logger[_0x9edd('0x2d')]('Agent\x20found!');return BPromise[_0x9edd('0x25')]({'id':_0x4fd03f[_0x9edd('0x26')][0x0]['id'],'email':_0x4fd03f[_0x9edd('0x26')][0x0]['email1'],'name':_0x4fd03f[_0x9edd('0x26')][0x0][_0x9edd('0x33')]+'\x20'+_0x4fd03f[_0x9edd('0x26')][_0x9edd('0x34')]});}else{logger[_0x9edd('0x2d')](_0x9edd('0x35'));return BPromise[_0x9edd('0x25')]({'id':_0x28cfae[_0x9edd('0x36')],'email':_0x52746a[_0x9edd('0x20')],'name':_0x9edd('0x37')});}})[_0x9edd('0x29')](function(_0x42c1d9){var _0x27eb7e=_0x42c1d9[_0x9edd('0x38')]||0x1f4;logger['error'](_0x9edd('0x2a'),'getUser',_0x27eb7e,JSON[_0x9edd('0x27')](_0x42c1d9));});}else{logger[_0x9edd('0x2d')](_0x9edd('0x35'));return BPromise[_0x9edd('0x25')]({'id':_0x28cfae[_0x9edd('0x36')],'email':_0x52746a['username'],'name':_0x9edd('0x37')})[_0x9edd('0x29')](function(_0x2b3469){var _0x38e9be=_0x2b3469[_0x9edd('0x38')]||0x1f4;logger[_0x9edd('0x28')](_0x9edd('0x2a'),_0x9edd('0x39'),_0x38e9be,JSON[_0x9edd('0x27')](_0x2b3469));});}}function getEndUser(_0x35c16f,_0x51a54a,_0x231604,_0x56a228){logger[_0x9edd('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0x231604);return request({'method':_0x9edd('0x2e'),'uri':util[_0x9edd('0x1d')](_0x9edd('0x2f'),_0x35c16f['remoteUri']),'qs':{'operation':_0x9edd('0x30'),'username':_0x35c16f[_0x9edd('0x20')],'sessionName':_0x56a228[_0x9edd('0x21')],'query':util['format'](_0x9edd('0x3a'),_0x231604,_0x231604,_0x231604,_0x231604,_0x231604)},'json':!![]})['then'](function(_0x1fc4fb){if(_0x1fc4fb[_0x9edd('0x24')]&&_0x1fc4fb['result'][_0x9edd('0x32')]){logger[_0x9edd('0x2d')](_0x9edd('0x3b'));return BPromise[_0x9edd('0x25')]({'id':_0x1fc4fb['result'][0x0]['id'],'name':_0x1fc4fb[_0x9edd('0x26')][0x0]['firstname']+'\x20'+_0x1fc4fb[_0x9edd('0x26')][0x0][_0x9edd('0x3c')],'phone':_0x231604});}else{logger['info'](_0x9edd('0x3d'));return request({'method':'POST','uri':util['format'](_0x9edd('0x2f'),_0x35c16f[_0x9edd('0x1e')]),'form':{'operation':_0x9edd('0x1f'),'sessionName':_0x56a228[_0x9edd('0x21')],'elementType':_0x9edd('0x3e'),'element':JSON[_0x9edd('0x27')]({'lastname':_0x51a54a,'phone':_0x231604,'assigned_user_id':'\x20'})},'json':!![]})[_0x9edd('0x23')](function(_0x75efbe){logger[_0x9edd('0x2d')](_0x9edd('0x3f'));return BPromise[_0x9edd('0x25')]({'id':_0x75efbe[_0x9edd('0x26')]['id'],'name':_0x75efbe[_0x9edd('0x26')][_0x9edd('0x3c')],'phone':_0x75efbe[_0x9edd('0x26')]['phone']});})[_0x9edd('0x29')](function(_0x2570e3){var _0x2231c1=_0x2570e3[_0x9edd('0x38')]||0x1f4;logger[_0x9edd('0x28')](_0x9edd('0x2a'),_0x9edd('0x40'),_0x2231c1,JSON['stringify'](_0x2570e3));});}});}function getConnection(_0x4a4656){var _0x4bc7a1=_0x4a4656[_0x9edd('0x20')];var _0x58a1dd=_0x4a4656[_0x9edd('0x41')];return request({'method':_0x9edd('0x2e'),'uri':util[_0x9edd('0x1d')](_0x9edd('0x2f'),_0x4a4656[_0x9edd('0x1e')]),'qs':{'operation':'getchallenge','username':_0x4bc7a1},'json':!![]})[_0x9edd('0x23')](function(_0x35e63c){if(_0x35e63c[_0x9edd('0x24')]){return request({'method':'POST','uri':util[_0x9edd('0x1d')](_0x9edd('0x2f'),_0x4a4656[_0x9edd('0x1e')]),'form':{'operation':_0x9edd('0x42'),'username':_0x4bc7a1,'accessKey':md5(_0x35e63c[_0x9edd('0x26')][_0x9edd('0x43')]+_0x58a1dd)},'json':!![]});}})['then'](function(_0x441e4a){if(_0x441e4a[_0x9edd('0x24')]){return BPromise['resolve'](_0x441e4a[_0x9edd('0x26')]);}else{throw new Error(util[_0x9edd('0x1d')]('Account\x20%d\x20is\x20not\x20valid',_0x4a4656['id']));}})[_0x9edd('0x29')](function(_0x8134cd){var _0x468239=_0x8134cd['statusCode']||0x1f4;logger[_0x9edd('0x28')](_0x9edd('0x2a'),_0x9edd('0x44'),_0x468239,JSON[_0x9edd('0x27')](_0x8134cd));});}function request(_0x53f6e3){logger[_0x9edd('0x2d')](_0x9edd('0x45'),JSON[_0x9edd('0x27')](_0x53f6e3));return rp(_0x53f6e3);}exports['queue']=function(_0x16951a,_0x21f6ce,_0x57db43,_0x8e59bd,_0x4e2aaf,_0x336494){var _0xe6b20c,_0x24245f,_0x3fcdf5,_0x1e3c19;_0x336494[_0x9edd('0x1e')]=intUtil[_0x9edd('0x46')](_0x336494[_0x9edd('0x1e')]);if(_0x4e2aaf&&_0x4e2aaf[_0x9edd('0x47')]){logger[_0x9edd('0x2d')](_0x9edd('0x48'),'Recording\x20is\x20enabled!');_0x21f6ce[_0x9edd('0x49')]=util[_0x9edd('0x1d')](_0x9edd('0x4a'),_0x336494['serverUrl'],_0x21f6ce[_0x9edd('0x4b')],md5(_0x21f6ce['uniqueid']));}else{_0x21f6ce['recordingURL']='';}return getConnection(_0x336494)['then'](function(_0x1348a7){_0x1e3c19=_0x1348a7;return getUser(_0x336494,_0x8e59bd[_0x9edd('0x4c')],_0x1e3c19);})[_0x9edd('0x23')](function(_0x35ddb3){_0xe6b20c=_0x35ddb3;logger['info']('The\x20User\x20ID\x20is:',_0xe6b20c['id']);return getEndUser(_0x336494,_0x21f6ce['calleridname'],_0x21f6ce[_0x9edd('0x4d')],_0x1e3c19);})[_0x9edd('0x23')](function(_0xd5090a){_0x24245f=_0xd5090a;logger[_0x9edd('0x2d')](_0x9edd('0x4e'),_0x24245f['id']);return createTicket(_0x336494,_0xe6b20c,_0x24245f,_0x57db43,_0x21f6ce,_0x57db43[_0x9edd('0x4f')],_0x1e3c19);})[_0x9edd('0x23')](function(_0x1e3087){_0x3fcdf5=_0x1e3087;logger['info'](_0x9edd('0x50'));logger['info'](_0x9edd('0x51'),_0x3fcdf5['id']);var _0x6a1cfc=util['format'](_0x9edd('0x52'),_0x336494[_0x9edd('0x1e')],_[_0x9edd('0x53')](_0x3fcdf5['id'],'x')[0x1]);logger['info'](_0x9edd('0x48'),_0x9edd('0x54'));emit(util[_0x9edd('0x1d')](_0x9edd('0x55'),_0x8e59bd[_0x9edd('0x16')]),_0x9edd('0x56'),{'uri':_0x6a1cfc});})['catch'](function(_0x4aa337){logger[_0x9edd('0x28')]('[QUEUE]',JSON[_0x9edd('0x27')](_0x4aa337));});};exports[_0x9edd('0x57')]=function(_0x439083,_0x17d2f2,_0x5df1d7,_0x21ead2,_0x507cce,_0x3e5dca,_0x344692){var _0xc6bde6,_0x5ca123,_0x2651a2,_0x57da5b;_0x3e5dca[_0x9edd('0x1e')]=intUtil[_0x9edd('0x46')](_0x3e5dca['remoteUri']);_0x3e5dca[_0x9edd('0x58')]=intUtil['stripTrailingSlash'](_0x3e5dca[_0x9edd('0x58')]);if(_0x344692&&_0x344692[_0x9edd('0x59')]&&_0x344692[_0x9edd('0x59')]!=='none'){logger[_0x9edd('0x2d')](_0x9edd('0x5a'),_0x9edd('0x5b'));_0x17d2f2[_0x9edd('0x49')]=util[_0x9edd('0x1d')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e5dca['serverUrl'],_0x17d2f2[_0x9edd('0x4b')],md5(_0x17d2f2[_0x9edd('0x4b')]));}return getConnection(_0x3e5dca)['then'](function(_0x5496e9){_0x57da5b=_0x5496e9;return getUser(_0x3e5dca,_0x21ead2['email'],_0x57da5b);})[_0x9edd('0x23')](function(_0x4e003a){_0xc6bde6=_0x4e003a;logger['info'](_0x9edd('0x5c'),_0xc6bde6['id']);return getEndUser(_0x3e5dca,_0x17d2f2[_0x9edd('0x5d')],_0x17d2f2['destcalleridnum'],_0x57da5b);})[_0x9edd('0x23')](function(_0x11e082){_0x5ca123=_0x11e082;logger[_0x9edd('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x5ca123['id']);return createTicket(_0x3e5dca,_0xc6bde6,_0x5ca123,_0x5df1d7,_0x17d2f2,_0x5df1d7[_0x9edd('0x4f')],_0x57da5b);})['then'](function(_0x37b018){_0x2651a2=_0x37b018;logger[_0x9edd('0x2d')]('Ticket\x20created!');logger[_0x9edd('0x2d')](_0x9edd('0x51'),_0x2651a2['id']);var _0x5c1746=util[_0x9edd('0x1d')](_0x9edd('0x52'),_0x3e5dca[_0x9edd('0x1e')],_[_0x9edd('0x53')](_0x2651a2['id'],'x')[0x1]);logger['info'](_0x9edd('0x5a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x9edd('0x1d')](_0x9edd('0x55'),_0x21ead2[_0x9edd('0x16')]),'trigger:browser:url',{'uri':_0x5c1746});})[_0x9edd('0x29')](function(_0x286593){logger[_0x9edd('0x28')](_0x9edd('0x5a'),JSON[_0x9edd('0x27')](_0x286593));});};exports[_0x9edd('0x5e')]=function(_0x3fa4a9,_0x512d3a,_0x5e29d0,_0x322165,_0x3c7874,_0x13254e){var _0x171403,_0x1e2126,_0x52f6f3,_0x2e40c8;_0x13254e[_0x9edd('0x1e')]=intUtil[_0x9edd('0x46')](_0x13254e['remoteUri']);_0x13254e[_0x9edd('0x58')]=intUtil[_0x9edd('0x46')](_0x13254e['serverUrl']);if(_0x3c7874&&_0x3c7874[_0x9edd('0x47')]){logger[_0x9edd('0x2d')]('[ABANDONED]',_0x9edd('0x5b'));_0x512d3a[_0x9edd('0x49')]=util['format'](_0x9edd('0x4a'),_0x13254e['serverUrl'],_0x512d3a['uniqueid'],md5(_0x512d3a[_0x9edd('0x4b')]));}else{_0x512d3a[_0x9edd('0x49')]='';}return getConnection(_0x13254e)[_0x9edd('0x23')](function(_0x5b56c7){_0x2e40c8=_0x5b56c7;return getUser(_0x13254e,'',_0x2e40c8);})[_0x9edd('0x23')](function(_0x286e47){_0x171403=_0x286e47;logger['info'](_0x9edd('0x5c'),_0x171403['id']);return getEndUser(_0x13254e,_0x512d3a[_0x9edd('0x5f')],_0x512d3a[_0x9edd('0x4d')],_0x2e40c8);})[_0x9edd('0x23')](function(_0x54ac71){_0x1e2126=_0x54ac71;logger['info'](_0x9edd('0x4e'),_0x1e2126['id']);return createTicket(_0x13254e,_0x171403,_0x1e2126,_0x5e29d0,_0x512d3a,_0x5e29d0['Fields'],_0x2e40c8);})[_0x9edd('0x23')](function(_0x2c71ce){_0x52f6f3=_0x2c71ce;logger[_0x9edd('0x2d')](_0x9edd('0x50'));logger[_0x9edd('0x2d')](_0x9edd('0x51'),_0x52f6f3['id']);})[_0x9edd('0x29')](function(_0x5a4d4b){logger[_0x9edd('0x28')]('[ABANDONED]',JSON[_0x9edd('0x27')](_0x5a4d4b));});}; \ No newline at end of file +var _0x9957=['query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','Agent\x20found!','email1','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','catch','GET','%s/webservice.php','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!','lastname','getEndUser','accessKey','login','token','Account\x20%d\x20is\x20not\x20valid','getConnection','queue','stripTrailingSlash','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','The\x20Enduser\x20ID\x20is:','user:%s','abandoned','[ABANDONED]','Ticket\x20created!','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','length','forEach','type','idField','toString','variable','variableName','customVariable','Variable','name','toLowerCase','Creating\x20new\x20ticket...','Normal','Subjects','getString','Descriptions','POST','format','remoteUri','create','username','sessionName','HelpDesk','stringify','then','resolve','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','info','Getting\x20agent\x20with\x20email'];(function(_0x58d1d7,_0x5e4958){var _0x52fe28=function(_0x2d6596){while(--_0x2d6596){_0x58d1d7['push'](_0x58d1d7['shift']());}};_0x52fe28(++_0x5e4958);}(_0x9957,0x93));var _0x7995=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0x9957[_0x6131cd];return _0x47e916;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var BPromise=require(_0x7995('0x2'));var md5=require(_0x7995('0x3'));var util=require('util');var Redis=require(_0x7995('0x4'));var intUtil=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('vTiger');config[_0x7995('0x8')]=_[_0x7995('0x9')](config[_0x7995('0x8')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x8')]));function emit(_0x4996ca,_0x465276,_0x1cad37){io['to'](_0x4996ca)['emit'](_0x465276,_0x1cad37);}function getCustomFields(_0xa2e5f0,_0x3116fb){var _0x18c8a3={};if(_0xa2e5f0[_0x7995('0xc')]>0x0){_[_0x7995('0xd')](_0xa2e5f0,function(_0x1e400a){if(_0x1e400a[_0x7995('0xe')]==='string'&&_0x1e400a[_0x7995('0xf')]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x1e400a['content'][_0x7995('0x10')]();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x11')&&_0x1e400a[_0x7995('0x12')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x12')]]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['variableName']]['toString']();}else if(_0x1e400a[_0x7995('0xe')]===_0x7995('0x13')&&_0x1e400a[_0x7995('0x14')]&&_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]&&_0x1e400a[_0x7995('0xf')]&&_0x3116fb[_0x1e400a[_0x7995('0x14')][_0x7995('0x15')]['toLowerCase']()]){_0x18c8a3[_0x1e400a[_0x7995('0xf')]]=_0x3116fb[_0x1e400a['Variable'][_0x7995('0x15')][_0x7995('0x16')]()][_0x7995('0x10')]();}});}return _0x18c8a3;}function createTicket(_0x291317,_0x1e1415,_0x37a7d4,_0x4faa60,_0x54c9ae,_0x2536c8,_0x5e6f90){logger['info'](_0x7995('0x17'));var _0x3d463e=_['merge']({'parent_id':'','assigned_user_id':_0x1e1415['id'],'ticketpriorities':_0x7995('0x18'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4faa60[_0x7995('0x19')],_0x54c9ae,'\x20'),'description':intUtil[_0x7995('0x1a')](_0x4faa60[_0x7995('0x1b')],_0x54c9ae,'\x0a'),'contact_id':_0x37a7d4['id']},getCustomFields(_0x2536c8,_0x54c9ae));var _0x1a8568={'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x291317[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x1f'),'username':_0x291317[_0x7995('0x20')],'sessionName':_0x5e6f90[_0x7995('0x21')],'elementType':_0x7995('0x22'),'element':JSON[_0x7995('0x23')](_0x3d463e)},'json':!![]};return request(_0x1a8568)[_0x7995('0x24')](function(_0x472195){if(_0x472195['success']){return BPromise[_0x7995('0x25')]({'id':_0x472195[_0x7995('0x26')]['id']});}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x27'),JSON[_0x7995('0x23')](_0x472195[_0x7995('0x28')])));}})['catch'](function(_0x47625f){var _0x5911c3=_0x47625f[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),_0x7995('0x2b'),_0x5911c3,JSON[_0x7995('0x23')](_0x47625f));});}function getUser(_0x4b6f99,_0x9b2a15,_0x514445){if(intUtil[_0x7995('0x2c')](_0x9b2a15)){logger[_0x7995('0x2d')](_0x7995('0x2e'),_0x9b2a15);return request({'method':'GET','uri':util['format']('%s/webservice.php',_0x4b6f99[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x4b6f99[_0x7995('0x20')],'sessionName':_0x514445[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x30'),_0x9b2a15)},'json':!![]})['then'](function(_0x481c74){if(_0x481c74[_0x7995('0x31')]&&_0x481c74['result'][_0x7995('0xc')]){logger[_0x7995('0x2d')](_0x7995('0x32'));return BPromise[_0x7995('0x25')]({'id':_0x481c74[_0x7995('0x26')][0x0]['id'],'email':_0x481c74['result'][0x0][_0x7995('0x33')],'name':_0x481c74[_0x7995('0x26')][0x0]['first_name']+'\x20'+_0x481c74['result']['last_name']});}else{logger[_0x7995('0x2d')](_0x7995('0x34'));return BPromise['resolve']({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99['username'],'name':_0x7995('0x36')});}})[_0x7995('0x37')](function(_0x177cb4){var _0x5014d2=_0x177cb4['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s','getUser',_0x5014d2,JSON[_0x7995('0x23')](_0x177cb4));});}else{logger[_0x7995('0x2d')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x7995('0x25')]({'id':_0x514445[_0x7995('0x35')],'email':_0x4b6f99[_0x7995('0x20')],'name':_0x7995('0x36')})[_0x7995('0x37')](function(_0x53002a){var _0x2d4285=_0x53002a[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')](_0x7995('0x2a'),'getUser',_0x2d4285,JSON[_0x7995('0x23')](_0x53002a));});}}function getEndUser(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee){logger[_0x7995('0x2d')]('Searching\x20end\x20user\x20with\x20phone',_0xe5ea43);return request({'method':_0x7995('0x38'),'uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x235df7[_0x7995('0x1e')]),'qs':{'operation':_0x7995('0x2f'),'username':_0x235df7[_0x7995('0x20')],'sessionName':_0x1f5bee[_0x7995('0x21')],'query':util[_0x7995('0x1d')](_0x7995('0x3a'),_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43,_0xe5ea43)},'json':!![]})[_0x7995('0x24')](function(_0x6fe77b){if(_0x6fe77b[_0x7995('0x31')]&&_0x6fe77b[_0x7995('0x26')]['length']){logger['info'](_0x7995('0x3b'));return BPromise[_0x7995('0x25')]({'id':_0x6fe77b['result'][0x0]['id'],'name':_0x6fe77b['result'][0x0][_0x7995('0x3c')]+'\x20'+_0x6fe77b['result'][0x0]['lastname'],'phone':_0xe5ea43});}else{logger[_0x7995('0x2d')](_0x7995('0x3d'));return request({'method':_0x7995('0x1c'),'uri':util['format'](_0x7995('0x39'),_0x235df7['remoteUri']),'form':{'operation':_0x7995('0x1f'),'sessionName':_0x1f5bee['sessionName'],'elementType':'Contacts','element':JSON[_0x7995('0x23')]({'lastname':_0x3eb04f,'phone':_0xe5ea43,'assigned_user_id':'\x20'})},'json':!![]})[_0x7995('0x24')](function(_0xc04e5){logger[_0x7995('0x2d')]('Enduser\x20created.');return BPromise[_0x7995('0x25')]({'id':_0xc04e5[_0x7995('0x26')]['id'],'name':_0xc04e5[_0x7995('0x26')][_0x7995('0x3e')],'phone':_0xc04e5['result']['phone']});})[_0x7995('0x37')](function(_0x55791b){var _0x23c41d=_0x55791b['statusCode']||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x3f'),_0x23c41d,JSON[_0x7995('0x23')](_0x55791b));});}});}function getConnection(_0x4d9245){var _0x3e9e62=_0x4d9245[_0x7995('0x20')];var _0x314145=_0x4d9245[_0x7995('0x40')];return request({'method':'GET','uri':util[_0x7995('0x1d')](_0x7995('0x39'),_0x4d9245[_0x7995('0x1e')]),'qs':{'operation':'getchallenge','username':_0x3e9e62},'json':!![]})[_0x7995('0x24')](function(_0x44f516){if(_0x44f516[_0x7995('0x31')]){return request({'method':_0x7995('0x1c'),'uri':util[_0x7995('0x1d')]('%s/webservice.php',_0x4d9245[_0x7995('0x1e')]),'form':{'operation':_0x7995('0x41'),'username':_0x3e9e62,'accessKey':md5(_0x44f516['result'][_0x7995('0x42')]+_0x314145)},'json':!![]});}})['then'](function(_0x1d87f9){if(_0x1d87f9[_0x7995('0x31')]){return BPromise[_0x7995('0x25')](_0x1d87f9[_0x7995('0x26')]);}else{throw new Error(util[_0x7995('0x1d')](_0x7995('0x43'),_0x4d9245['id']));}})[_0x7995('0x37')](function(_0x4d46bc){var _0x427dcf=_0x4d46bc[_0x7995('0x29')]||0x1f4;logger[_0x7995('0x28')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x7995('0x44'),_0x427dcf,JSON[_0x7995('0x23')](_0x4d46bc));});}function request(_0x12d4b8){logger['info']('[HTTP]',JSON['stringify'](_0x12d4b8));return rp(_0x12d4b8);}exports[_0x7995('0x45')]=function(_0x1fd1ca,_0x4cf5db,_0x1cd85,_0x29f300,_0x31f27c,_0x1a9bd7){var _0xc04004,_0x528c8e,_0x29ee32,_0x4ab09f;_0x1a9bd7[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1a9bd7[_0x7995('0x1e')]);if(_0x31f27c&&_0x31f27c['monitor_format']){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4cf5db[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1a9bd7[_0x7995('0x49')],_0x4cf5db[_0x7995('0x4a')],md5(_0x4cf5db[_0x7995('0x4a')]));}else{_0x4cf5db[_0x7995('0x47')]='';}return getConnection(_0x1a9bd7)[_0x7995('0x24')](function(_0x328671){_0x4ab09f=_0x328671;return getUser(_0x1a9bd7,_0x29f300[_0x7995('0x4b')],_0x4ab09f);})[_0x7995('0x24')](function(_0x133c63){_0xc04004=_0x133c63;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0xc04004['id']);return getEndUser(_0x1a9bd7,_0x4cf5db[_0x7995('0x4d')],_0x4cf5db[_0x7995('0x4e')],_0x4ab09f);})[_0x7995('0x24')](function(_0x223e08){_0x528c8e=_0x223e08;logger[_0x7995('0x2d')]('The\x20Enduser\x20ID\x20is:',_0x528c8e['id']);return createTicket(_0x1a9bd7,_0xc04004,_0x528c8e,_0x1cd85,_0x4cf5db,_0x1cd85[_0x7995('0x4f')],_0x4ab09f);})[_0x7995('0x24')](function(_0x3b8a54){_0x29ee32=_0x3b8a54;logger[_0x7995('0x2d')]('Ticket\x20created!');logger['info'](_0x7995('0x50'),_0x29ee32['id']);var _0x197b52=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1a9bd7['remoteUri'],_[_0x7995('0x52')](_0x29ee32['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x53'),_0x7995('0x54'));emit(util['format']('user:%s',_0x29f300[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x197b52});})[_0x7995('0x37')](function(_0x1d69ce){logger[_0x7995('0x28')](_0x7995('0x53'),JSON[_0x7995('0x23')](_0x1d69ce));});};exports[_0x7995('0x56')]=function(_0x984c23,_0x50caf5,_0x18f230,_0x3ec5a8,_0xdf9e38,_0x1ecfdb,_0x59c5aa){var _0x51bf6a,_0x3053fd,_0xebb5c8,_0x47d5d7;_0x1ecfdb[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x1ecfdb[_0x7995('0x1e')]);_0x1ecfdb[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x1ecfdb['serverUrl']);if(_0x59c5aa&&_0x59c5aa[_0x7995('0x57')]&&_0x59c5aa['recordingFormat']!==_0x7995('0x58')){logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x5a'));_0x50caf5[_0x7995('0x47')]=util[_0x7995('0x1d')](_0x7995('0x48'),_0x1ecfdb[_0x7995('0x49')],_0x50caf5[_0x7995('0x4a')],md5(_0x50caf5[_0x7995('0x4a')]));}return getConnection(_0x1ecfdb)[_0x7995('0x24')](function(_0x234d8d){_0x47d5d7=_0x234d8d;return getUser(_0x1ecfdb,_0x3ec5a8['email'],_0x47d5d7);})[_0x7995('0x24')](function(_0x23bbc1){_0x51bf6a=_0x23bbc1;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x51bf6a['id']);return getEndUser(_0x1ecfdb,_0x50caf5[_0x7995('0x5b')],_0x50caf5['destcalleridnum'],_0x47d5d7);})['then'](function(_0x268fde){_0x3053fd=_0x268fde;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x3053fd['id']);return createTicket(_0x1ecfdb,_0x51bf6a,_0x3053fd,_0x18f230,_0x50caf5,_0x18f230[_0x7995('0x4f')],_0x47d5d7);})['then'](function(_0x22d317){_0xebb5c8=_0x22d317;logger['info']('Ticket\x20created!');logger[_0x7995('0x2d')](_0x7995('0x50'),_0xebb5c8['id']);var _0x3f0a71=util[_0x7995('0x1d')](_0x7995('0x51'),_0x1ecfdb[_0x7995('0x1e')],_[_0x7995('0x52')](_0xebb5c8['id'],'x')[0x1]);logger[_0x7995('0x2d')](_0x7995('0x59'),_0x7995('0x54'));emit(util['format'](_0x7995('0x5d'),_0x3ec5a8[_0x7995('0x15')]),_0x7995('0x55'),{'uri':_0x3f0a71});})['catch'](function(_0x1fe1cb){logger[_0x7995('0x28')](_0x7995('0x59'),JSON[_0x7995('0x23')](_0x1fe1cb));});};exports[_0x7995('0x5e')]=function(_0x51ab1e,_0x550a10,_0x3adfd2,_0x2f94c4,_0x1fdff6,_0x435a1b){var _0x535131,_0x5e8b4c,_0xd07c1c,_0xfe1105;_0x435a1b[_0x7995('0x1e')]=intUtil[_0x7995('0x46')](_0x435a1b['remoteUri']);_0x435a1b[_0x7995('0x49')]=intUtil[_0x7995('0x46')](_0x435a1b['serverUrl']);if(_0x1fdff6&&_0x1fdff6['monitor_format']){logger[_0x7995('0x2d')](_0x7995('0x5f'),'Recording\x20is\x20enabled!');_0x550a10[_0x7995('0x47')]=util['format'](_0x7995('0x48'),_0x435a1b[_0x7995('0x49')],_0x550a10['uniqueid'],md5(_0x550a10['uniqueid']));}else{_0x550a10[_0x7995('0x47')]='';}return getConnection(_0x435a1b)['then'](function(_0x31b9e6){_0xfe1105=_0x31b9e6;return getUser(_0x435a1b,'',_0xfe1105);})[_0x7995('0x24')](function(_0x3dd197){_0x535131=_0x3dd197;logger[_0x7995('0x2d')](_0x7995('0x4c'),_0x535131['id']);return getEndUser(_0x435a1b,_0x550a10[_0x7995('0x4d')],_0x550a10[_0x7995('0x4e')],_0xfe1105);})[_0x7995('0x24')](function(_0x29e0ee){_0x5e8b4c=_0x29e0ee;logger[_0x7995('0x2d')](_0x7995('0x5c'),_0x5e8b4c['id']);return createTicket(_0x435a1b,_0x535131,_0x5e8b4c,_0x3adfd2,_0x550a10,_0x3adfd2[_0x7995('0x4f')],_0xfe1105);})[_0x7995('0x24')](function(_0x1ff436){_0xd07c1c=_0x1ff436;logger[_0x7995('0x2d')](_0x7995('0x60'));logger[_0x7995('0x2d')](_0x7995('0x50'),_0xd07c1c['id']);})[_0x7995('0x37')](function(_0xa2fc8e){logger[_0x7995('0x28')](_0x7995('0x5f'),JSON[_0x7995('0x23')](_0xa2fc8e));});}; \ 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 25f3286..31488df 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 _0x0ff2=['Agent\x20found!','find','results','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','filter','end-user','%s/users.json','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','defaults','GET','length','map','forEach','type','string','nameField','customField','toLowerCase','content','idField','push','variableName','custom_fields','customVariable','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/agent/tickets/%s','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','inspect','outbound','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','[ABANDONED]','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','socket.io-emitter','emit','application/json','Creating\x20new\x20ticket...','format','%s/tickets.json','remoteUri','Tags','name','Subjects','Descriptions','getString','then','info','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','type:user\x20role:agent\x20email:%s','count'];(function(_0xb09590,_0x1655da){var _0x2f1100=function(_0x1a173e){while(--_0x1a173e){_0xb09590['push'](_0xb09590['shift']());}};_0x2f1100(++_0x1655da);}(_0x0ff2,0x197));var _0x20ff=function(_0x224ab7,_0x5dd6d1){_0x224ab7=_0x224ab7-0x0;var _0x469838=_0x0ff2[_0x224ab7];return _0x469838;};'use strict';var _=require(_0x20ff('0x0'));var rp=require('request-promise');var md5=require(_0x20ff('0x1'));var util=require('util');var Redis=require(_0x20ff('0x2'));var intUtil=require(_0x20ff('0x3'));var config=require(_0x20ff('0x4'));var logger=require(_0x20ff('0x5'))(_0x20ff('0x6'));config[_0x20ff('0x7')]=_['defaults'](config[_0x20ff('0x7')],{'host':_0x20ff('0x8'),'port':0x18eb});var io=require(_0x20ff('0x9'))(new Redis(config[_0x20ff('0x7')]));function emit(_0x4458fc,_0x1401fb,_0x491fba){io['to'](_0x4458fc)[_0x20ff('0xa')](_0x1401fb,_0x491fba);}var headers={'Content-Type':'application/json','Accept':_0x20ff('0xb')};function getTicket(_0xc9ccbe,_0x2d2f30,_0xb004ac,_0x3d8603,_0x1f623c){logger['info'](_0x20ff('0xc'));return request({'uri':util[_0x20ff('0xd')](_0x20ff('0xe'),_0xc9ccbe[_0x20ff('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0xb004ac['id'],'submitter_id':_0x2d2f30?_0x2d2f30['id']:undefined,'assignee_id':_0x2d2f30?_0x2d2f30['id']:undefined,'tags':getTags(_0x3d8603[_0x20ff('0x10')],_0x20ff('0x11')),'subject':intUtil['getString'](_0x3d8603[_0x20ff('0x12')],_0x1f623c,'\x20'),'description':intUtil['getString'](_0x3d8603[_0x20ff('0x13')],_0x1f623c,'\x0a'),'comment':{'public':![],'body':intUtil[_0x20ff('0x14')](_0x3d8603[_0x20ff('0x13')],_0x1f623c,'\x0a')}},getCustomFields(_0x3d8603['Fields'],_0x1f623c))}})[_0x20ff('0x15')](function(_0x12684e){logger[_0x20ff('0x16')]('Ticket\x20created!');return _0x12684e[_0x20ff('0x17')];});}function getUser(_0x2fc54a,_0x43451d){if(intUtil[_0x20ff('0x18')](_0x43451d)){logger[_0x20ff('0x16')](_0x20ff('0x19'),_0x43451d);return request({'uri':util[_0x20ff('0xd')](_0x20ff('0x1a'),_0x2fc54a[_0x20ff('0xf')]),'qs':{'query':util[_0x20ff('0xd')](_0x20ff('0x1b'),_0x43451d)}})[_0x20ff('0x15')](function(_0x4ee322){if(_0x4ee322[_0x20ff('0x1c')]){logger[_0x20ff('0x16')](_0x20ff('0x1d'));return _[_0x20ff('0x1e')](_0x4ee322[_0x20ff('0x1f')],{'email':_0x43451d,'role':'agent'});}else{logger['info'](_0x20ff('0x20'));return request({'uri':util['format'](_0x20ff('0x21'),_0x2fc54a[_0x20ff('0xf')])})[_0x20ff('0x15')](function(_0x40607e){logger[_0x20ff('0x16')](_0x20ff('0x22'));return _0x40607e[_0x20ff('0x23')];});}});}else{logger[_0x20ff('0x16')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0x20ff('0xd')](_0x20ff('0x21'),_0x2fc54a['remoteUri'])})[_0x20ff('0x15')](function(_0x15ae25){logger[_0x20ff('0x16')](_0x20ff('0x22'));return _0x15ae25['user'];});}}function getEndUser(_0x271d30,_0x2c5e71,_0x4ca82d){logger[_0x20ff('0x16')](_0x20ff('0x24'),_0x4ca82d);return request({'uri':util[_0x20ff('0xd')](_0x20ff('0x1a'),_0x271d30[_0x20ff('0xf')]),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x4ca82d)}})[_0x20ff('0x15')](function(_0x1e3ac1){var _0x44daf5;if(_0x1e3ac1[_0x20ff('0x1f')]['length']){_0x1e3ac1['results']=_[_0x20ff('0x25')](_0x1e3ac1[_0x20ff('0x1f')],{'suspended':![],'role':_0x20ff('0x26')});if(_0x1e3ac1[_0x20ff('0x1f')]['length']){_0x44daf5=_['first'](_0x1e3ac1[_0x20ff('0x1f')]);}}if(_0x44daf5){logger[_0x20ff('0x16')]('Enduser\x20found!');return _0x44daf5;}else{logger[_0x20ff('0x16')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x20ff('0x27'),_0x271d30[_0x20ff('0xf')]),'method':'POST','body':{'user':{'role':_0x20ff('0x26'),'name':util[_0x20ff('0xd')](_0x20ff('0x28'),_0x2c5e71||_0x4ca82d),'phone':_0x4ca82d}}})['then'](function(_0x24f0cd){logger['info'](_0x20ff('0x29'));return _0x24f0cd[_0x20ff('0x23')];});}});}function getAuth(_0x51cac6){var _0x4c948e;if(_0x51cac6[_0x20ff('0x2a')]===_0x20ff('0x2b')){_0x4c948e=util[_0x20ff('0xd')](_0x20ff('0x2c'),_0x51cac6[_0x20ff('0x2d')],_0x51cac6[_0x20ff('0x2b')]);}else if(_0x51cac6[_0x20ff('0x2a')]===_0x20ff('0x2e')){_0x4c948e=util['format'](_0x20ff('0x2f'),_0x51cac6[_0x20ff('0x2d')],_0x51cac6[_0x20ff('0x2e')]);}return util['format'](_0x20ff('0x30'),new Buffer(_0x4c948e)[_0x20ff('0x31')](_0x20ff('0x32')));}function request(_0x2dd0b2){logger[_0x20ff('0x33')](_0x20ff('0x34'),JSON[_0x20ff('0x35')](_0x2dd0b2));return rp(_[_0x20ff('0x36')](_0x2dd0b2,{'method':_0x20ff('0x37'),'headers':headers,'json':!![]}));}function getTags(_0x1d0195,_0x347577){var _0x578c1b=[];if(_0x1d0195&&_0x1d0195[_0x20ff('0x38')]>0x0){_0x578c1b=_[_0x20ff('0x39')](_0x1d0195,_0x347577);}return _0x578c1b;}function getCustomFields(_0xc26292,_0x12be76){var _0x42f46f=[];var _0x52d2c4={'custom_fields':[]};if(_0xc26292[_0x20ff('0x38')]>0x0){_[_0x20ff('0x3a')](_0xc26292,function(_0x4de750){if(_0x4de750[_0x20ff('0x3b')]===_0x20ff('0x3c')&&_0x4de750[_0x20ff('0x3d')]&&!_0x4de750[_0x20ff('0x3e')]){_0x52d2c4[_0x4de750['nameField'][_0x20ff('0x3f')]()]=_0x4de750[_0x20ff('0x40')]['toString']();}else if(_0x4de750['type']==='string'&&_0x4de750[_0x20ff('0x41')]&&_0x4de750[_0x20ff('0x3e')]){_0x52d2c4['custom_fields'][_0x20ff('0x42')]({'id':_0x4de750[_0x20ff('0x41')],'value':_0x4de750[_0x20ff('0x40')][_0x20ff('0x31')]()});}else if(_0x4de750[_0x20ff('0x3b')]==='variable'&&_0x4de750[_0x20ff('0x43')]&&_0x4de750['idField']&&_0x4de750['customField']){_0x12be76[_0x4de750[_0x20ff('0x43')]]&&_0x52d2c4[_0x20ff('0x44')][_0x20ff('0x42')]({'id':_0x4de750['idField'],'value':_0x12be76[_0x4de750[_0x20ff('0x43')]][_0x20ff('0x31')]()});}else if(_0x4de750[_0x20ff('0x3b')]===_0x20ff('0x45')&&_0x4de750[_0x20ff('0x46')]&&_0x4de750['Variable']['name']&&_0x4de750[_0x20ff('0x41')]&&_0x4de750['customField']){_0x12be76[_0x4de750[_0x20ff('0x46')][_0x20ff('0x11')]['toLowerCase']()]&&_0x52d2c4[_0x20ff('0x44')]['push']({'id':_0x4de750[_0x20ff('0x41')],'value':_0x12be76[_0x4de750[_0x20ff('0x46')][_0x20ff('0x11')][_0x20ff('0x3f')]()][_0x20ff('0x31')]()});}});}return _0x52d2c4;}exports[_0x20ff('0x47')]=function(_0x348dff,_0x45aae4,_0x58d3cd,_0x2f7899,_0x57804b,_0x40ef6c){var _0x329a73,_0x28611b;_0x40ef6c['remoteUri']=intUtil[_0x20ff('0x48')](_0x40ef6c[_0x20ff('0xf')]);_0x40ef6c[_0x20ff('0x49')]=intUtil[_0x20ff('0x48')](_0x40ef6c[_0x20ff('0x49')]);if(_0x57804b&&_0x57804b[_0x20ff('0x4a')]){logger['info'](_0x20ff('0x4b'),_0x20ff('0x4c'));_0x45aae4[_0x20ff('0x4d')]=util[_0x20ff('0xd')](_0x20ff('0x4e'),_0x40ef6c[_0x20ff('0x49')],_0x45aae4[_0x20ff('0x4f')],md5(_0x45aae4[_0x20ff('0x4f')]));}else{_0x45aae4[_0x20ff('0x4d')]='';}headers[_0x20ff('0x50')]=getAuth(_0x40ef6c);return getUser(_0x40ef6c,_0x2f7899[_0x20ff('0x51')])[_0x20ff('0x15')](function(_0x10d507){_0x329a73=_0x10d507;logger[_0x20ff('0x16')]('The\x20User\x20ID\x20is:',_0x329a73['id']);return getEndUser(_0x40ef6c,_0x45aae4[_0x20ff('0x52')],_0x45aae4[_0x20ff('0x53')]);})[_0x20ff('0x15')](function(_0xb5adf6){_0x28611b=_0xb5adf6;logger['info']('The\x20Enduser\x20ID\x20is:',_0x28611b['id']);return getTicket(_0x40ef6c,_0x329a73,_0x28611b,_0x58d3cd,_0x45aae4);})[_0x20ff('0x15')](function(_0x26af4a){if(_0x26af4a){logger[_0x20ff('0x16')](_0x20ff('0x54'),_0x26af4a['id']);switch(_0x40ef6c['type']){case _0x20ff('0x55'):logger[_0x20ff('0x16')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');return request({'uri':util['format']('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x40ef6c[_0x20ff('0xf')],_0x329a73['id'],_0x26af4a['id']),'method':'POST'});case _0x20ff('0x56'):logger[_0x20ff('0x16')](_0x20ff('0x4b'),_0x20ff('0x57'));emit(util[_0x20ff('0xd')](_0x20ff('0x58'),_0x2f7899[_0x20ff('0x11')]),_0x20ff('0x59'),{'uri':util[_0x20ff('0xd')](_0x20ff('0x5a'),_0x40ef6c[_0x20ff('0xf')],_0x26af4a['id'])});break;default:logger[_0x20ff('0x5b')](_0x20ff('0x4b'),_0x20ff('0x5c'));}}})[_0x20ff('0x5d')](function(_0x5efcba){logger[_0x20ff('0x5b')]('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util[_0x20ff('0x5e')](_0x5efcba,{'showHidden':!![],'depth':null}));});};exports[_0x20ff('0x5f')]=function(_0x2487f6,_0x32830e,_0xab8b42,_0x466bd2,_0x4b46f9,_0x4e74f0,_0x1db26e){var _0x56fe2c,_0x352ad3;_0x4e74f0['remoteUri']=intUtil[_0x20ff('0x48')](_0x4e74f0[_0x20ff('0xf')]);_0x4e74f0[_0x20ff('0x49')]=intUtil[_0x20ff('0x48')](_0x4e74f0[_0x20ff('0x49')]);if(_0x1db26e&&_0x1db26e[_0x20ff('0x60')]&&_0x1db26e[_0x20ff('0x60')]!==_0x20ff('0x61')){logger['info']('[OUTBOUND]',_0x20ff('0x4c'));_0x32830e['recordingURL']=util[_0x20ff('0xd')](_0x20ff('0x4e'),_0x4e74f0[_0x20ff('0x49')],_0x32830e[_0x20ff('0x4f')],md5(_0x32830e[_0x20ff('0x4f')]));}headers[_0x20ff('0x50')]=getAuth(_0x4e74f0);return getUser(_0x4e74f0,_0x466bd2[_0x20ff('0x51')])[_0x20ff('0x15')](function(_0x1df1bf){_0x56fe2c=_0x1df1bf;logger['info'](_0x20ff('0x62'),_0x56fe2c['id']);return getEndUser(_0x4e74f0,_0x32830e[_0x20ff('0x63')],_0x32830e[_0x20ff('0x64')]);})[_0x20ff('0x15')](function(_0xb205a1){_0x352ad3=_0xb205a1;logger[_0x20ff('0x16')](_0x20ff('0x65'),_0x352ad3['id']);return getTicket(_0x4e74f0,_0x56fe2c,_0x352ad3,_0xab8b42,_0x32830e);})[_0x20ff('0x15')](function(_0xeaa8d3){if(_0xeaa8d3){logger[_0x20ff('0x16')](_0x20ff('0x54'),_0xeaa8d3['id']);switch(_0x4e74f0[_0x20ff('0x3b')]){case _0x20ff('0x55'):logger[_0x20ff('0x16')](_0x20ff('0x66'),_0x20ff('0x67'));return request({'uri':util[_0x20ff('0xd')](_0x20ff('0x68'),_0x4e74f0[_0x20ff('0xf')],_0x56fe2c['id'],_0xeaa8d3['id']),'method':_0x20ff('0x69')});case'newTab':logger[_0x20ff('0x16')](_0x20ff('0x66'),_0x20ff('0x57'));emit(util[_0x20ff('0xd')](_0x20ff('0x58'),_0x466bd2[_0x20ff('0x11')]),'trigger:browser:url',{'uri':util[_0x20ff('0xd')](_0x20ff('0x5a'),_0x4e74f0[_0x20ff('0xf')],_0xeaa8d3['id'])});break;default:logger[_0x20ff('0x5b')](_0x20ff('0x66'),_0x20ff('0x5c'));}}})['catch'](function(_0x2f1730){logger['error'](_0x20ff('0x6a'),util['inspect'](_0x2f1730,{'showHidden':!![],'depth':null}));});};exports['abandoned']=function(_0x1eebbd,_0x2f9842,_0x4796d7,_0x510ecb,_0x1a8283,_0x3e26ef){var _0x10d6d4,_0x48f74c;_0x3e26ef[_0x20ff('0xf')]=intUtil['stripTrailingSlash'](_0x3e26ef[_0x20ff('0xf')]);_0x3e26ef[_0x20ff('0x49')]=intUtil[_0x20ff('0x48')](_0x3e26ef['serverUrl']);if(_0x1a8283&&_0x1a8283[_0x20ff('0x4a')]){logger[_0x20ff('0x16')](_0x20ff('0x6b'),_0x20ff('0x4c'));_0x2f9842[_0x20ff('0x4d')]=util['format'](_0x20ff('0x4e'),_0x3e26ef[_0x20ff('0x49')],_0x2f9842[_0x20ff('0x4f')],md5(_0x2f9842[_0x20ff('0x4f')]));}else{_0x2f9842[_0x20ff('0x4d')]='';}headers[_0x20ff('0x50')]=getAuth(_0x3e26ef);return getUser(_0x3e26ef)[_0x20ff('0x15')](function(_0x392188){_0x10d6d4=_0x392188;logger['info'](_0x20ff('0x62'),_0x10d6d4['id']);return getEndUser(_0x3e26ef,_0x2f9842['calleridname'],_0x2f9842[_0x20ff('0x53')]);})['then'](function(_0x327872){_0x48f74c=_0x327872;logger[_0x20ff('0x16')](_0x20ff('0x65'),_0x48f74c['id']);return getTicket(_0x3e26ef,_0x10d6d4,_0x48f74c,_0x4796d7,_0x2f9842);})[_0x20ff('0x15')](function(_0xa510b8){if(_0xa510b8){logger[_0x20ff('0x16')](_0x20ff('0x54'),_0xa510b8['id']);}})[_0x20ff('0x5d')](function(_0x407c64){logger['error'](_0x20ff('0x6c'),util['inspect'](_0x407c64,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc8f3=['Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','length','first','%s/users.json','end-user','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','toString','debug','map','forEach','string','nameField','toLowerCase','type','customField','custom_fields','push','variableName','idField','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','Authorization','destcalleridnum','integrationTab','%s/agent/tickets/%s','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','abandoned','calleridname','[ABANDONED]\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/logger','defaults','redis','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','Tags','getString','Descriptions','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','format','type:user\x20role:agent\x20email:%s','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json'];(function(_0x56b324,_0x15497d){var _0x4c1129=function(_0x2d21e0){while(--_0x2d21e0){_0x56b324['push'](_0x56b324['shift']());}};_0x4c1129(++_0x15497d);}(_0xc8f3,0x1d3));var _0x3c8f=function(_0x51cae7,_0x540716){_0x51cae7=_0x51cae7-0x0;var _0x36dd74=_0xc8f3[_0x51cae7];return _0x36dd74;};'use strict';var _=require(_0x3c8f('0x0'));var rp=require(_0x3c8f('0x1'));var md5=require(_0x3c8f('0x2'));var util=require(_0x3c8f('0x3'));var Redis=require(_0x3c8f('0x4'));var intUtil=require(_0x3c8f('0x5'));var config=require('../../../../config/environment');var logger=require(_0x3c8f('0x6'))('zendesk');config['redis']=_[_0x3c8f('0x7')](config[_0x3c8f('0x8')],{'host':_0x3c8f('0x9'),'port':0x18eb});var io=require(_0x3c8f('0xa'))(new Redis(config[_0x3c8f('0x8')]));function emit(_0x4c6b0c,_0x416355,_0x3039cc){io['to'](_0x4c6b0c)[_0x3c8f('0xb')](_0x416355,_0x3039cc);}var headers={'Content-Type':_0x3c8f('0xc'),'Accept':_0x3c8f('0xc')};function getTicket(_0xe1ca00,_0x419518,_0x1ce5c4,_0x3e9156,_0x572141){logger[_0x3c8f('0xd')](_0x3c8f('0xe'));return request({'uri':util['format'](_0x3c8f('0xf'),_0xe1ca00[_0x3c8f('0x10')]),'method':_0x3c8f('0x11'),'body':{'ticket':_['merge']({'requester_id':_0x1ce5c4['id'],'submitter_id':_0x419518?_0x419518['id']:undefined,'assignee_id':_0x419518?_0x419518['id']:undefined,'tags':getTags(_0x3e9156[_0x3c8f('0x12')],'name'),'subject':intUtil[_0x3c8f('0x13')](_0x3e9156['Subjects'],_0x572141,'\x20'),'description':intUtil[_0x3c8f('0x13')](_0x3e9156['Descriptions'],_0x572141,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3c8f('0x13')](_0x3e9156[_0x3c8f('0x14')],_0x572141,'\x0a')}},getCustomFields(_0x3e9156['Fields'],_0x572141))}})[_0x3c8f('0x15')](function(_0x4ff130){logger[_0x3c8f('0xd')](_0x3c8f('0x16'));return _0x4ff130[_0x3c8f('0x17')];});}function getUser(_0x2edbc,_0x1aab78){if(intUtil[_0x3c8f('0x18')](_0x1aab78)){logger[_0x3c8f('0xd')](_0x3c8f('0x19'),_0x1aab78);return request({'uri':util[_0x3c8f('0x1a')]('%s/search.json',_0x2edbc[_0x3c8f('0x10')]),'qs':{'query':util[_0x3c8f('0x1a')](_0x3c8f('0x1b'),_0x1aab78)}})['then'](function(_0x5ee69e){if(_0x5ee69e['count']){logger[_0x3c8f('0xd')]('Agent\x20found!');return _[_0x3c8f('0x1c')](_0x5ee69e[_0x3c8f('0x1d')],{'email':_0x1aab78,'role':_0x3c8f('0x1e')});}else{logger['info'](_0x3c8f('0x1f'));return request({'uri':util['format'](_0x3c8f('0x20'),_0x2edbc[_0x3c8f('0x10')])})['then'](function(_0x19fb6a){logger[_0x3c8f('0xd')](_0x3c8f('0x21'));return _0x19fb6a[_0x3c8f('0x22')];});}});}else{logger[_0x3c8f('0xd')](_0x3c8f('0x1f'));return request({'uri':util[_0x3c8f('0x1a')](_0x3c8f('0x20'),_0x2edbc[_0x3c8f('0x10')])})[_0x3c8f('0x15')](function(_0x43c83d){logger[_0x3c8f('0xd')](_0x3c8f('0x21'));return _0x43c83d[_0x3c8f('0x22')];});}}function getEndUser(_0x5396c1,_0x48e6f1,_0x1f6599){logger[_0x3c8f('0xd')](_0x3c8f('0x23'),_0x1f6599);return request({'uri':util['format']('%s/search.json',_0x5396c1['remoteUri']),'qs':{'query':util['format']('type:user\x20role:end-user\x20phone:%s',_0x1f6599)}})[_0x3c8f('0x15')](function(_0x4d8bdb){var _0x295e64;if(_0x4d8bdb['results'][_0x3c8f('0x24')]){_0x4d8bdb['results']=_['filter'](_0x4d8bdb[_0x3c8f('0x1d')],{'suspended':![],'role':'end-user'});if(_0x4d8bdb[_0x3c8f('0x1d')][_0x3c8f('0x24')]){_0x295e64=_[_0x3c8f('0x25')](_0x4d8bdb[_0x3c8f('0x1d')]);}}if(_0x295e64){logger[_0x3c8f('0xd')]('Enduser\x20found!');return _0x295e64;}else{logger[_0x3c8f('0xd')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3c8f('0x1a')](_0x3c8f('0x26'),_0x5396c1[_0x3c8f('0x10')]),'method':_0x3c8f('0x11'),'body':{'user':{'role':_0x3c8f('0x27'),'name':util[_0x3c8f('0x1a')](_0x3c8f('0x28'),_0x48e6f1||_0x1f6599),'phone':_0x1f6599}}})[_0x3c8f('0x15')](function(_0x55921b){logger['info'](_0x3c8f('0x29'));return _0x55921b[_0x3c8f('0x22')];});}});}function getAuth(_0x27f0c4){var _0xa259f4;if(_0x27f0c4[_0x3c8f('0x2a')]===_0x3c8f('0x2b')){_0xa259f4=util['format'](_0x3c8f('0x2c'),_0x27f0c4[_0x3c8f('0x2d')],_0x27f0c4[_0x3c8f('0x2b')]);}else if(_0x27f0c4['authType']===_0x3c8f('0x2e')){_0xa259f4=util[_0x3c8f('0x1a')]('%s/token:%s',_0x27f0c4[_0x3c8f('0x2d')],_0x27f0c4[_0x3c8f('0x2e')]);}return util[_0x3c8f('0x1a')]('Basic\x20%s',new Buffer(_0xa259f4)[_0x3c8f('0x2f')]('base64'));}function request(_0x178773){logger[_0x3c8f('0x30')]('[HTTP]',JSON['stringify'](_0x178773));return rp(_[_0x3c8f('0x7')](_0x178773,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x5cd56e,_0x7ab82a){var _0x4555e6=[];if(_0x5cd56e&&_0x5cd56e[_0x3c8f('0x24')]>0x0){_0x4555e6=_[_0x3c8f('0x31')](_0x5cd56e,_0x7ab82a);}return _0x4555e6;}function getCustomFields(_0x156598,_0x49d062){var _0x3782e5=[];var _0x5b5191={'custom_fields':[]};if(_0x156598[_0x3c8f('0x24')]>0x0){_[_0x3c8f('0x32')](_0x156598,function(_0x3630bf){if(_0x3630bf['type']===_0x3c8f('0x33')&&_0x3630bf[_0x3c8f('0x34')]&&!_0x3630bf['customField']){_0x5b5191[_0x3630bf[_0x3c8f('0x34')][_0x3c8f('0x35')]()]=_0x3630bf['content'][_0x3c8f('0x2f')]();}else if(_0x3630bf[_0x3c8f('0x36')]===_0x3c8f('0x33')&&_0x3630bf['idField']&&_0x3630bf[_0x3c8f('0x37')]){_0x5b5191[_0x3c8f('0x38')][_0x3c8f('0x39')]({'id':_0x3630bf['idField'],'value':_0x3630bf['content'][_0x3c8f('0x2f')]()});}else if(_0x3630bf[_0x3c8f('0x36')]==='variable'&&_0x3630bf[_0x3c8f('0x3a')]&&_0x3630bf[_0x3c8f('0x3b')]&&_0x3630bf['customField']){_0x49d062[_0x3630bf[_0x3c8f('0x3a')]]&&_0x5b5191[_0x3c8f('0x38')]['push']({'id':_0x3630bf['idField'],'value':_0x49d062[_0x3630bf['variableName']][_0x3c8f('0x2f')]()});}else if(_0x3630bf[_0x3c8f('0x36')]===_0x3c8f('0x3c')&&_0x3630bf['Variable']&&_0x3630bf[_0x3c8f('0x3d')][_0x3c8f('0x3e')]&&_0x3630bf[_0x3c8f('0x3b')]&&_0x3630bf['customField']){_0x49d062[_0x3630bf[_0x3c8f('0x3d')][_0x3c8f('0x3e')]['toLowerCase']()]&&_0x5b5191[_0x3c8f('0x38')][_0x3c8f('0x39')]({'id':_0x3630bf[_0x3c8f('0x3b')],'value':_0x49d062[_0x3630bf[_0x3c8f('0x3d')][_0x3c8f('0x3e')][_0x3c8f('0x35')]()][_0x3c8f('0x2f')]()});}});}return _0x5b5191;}exports[_0x3c8f('0x3f')]=function(_0x33fb52,_0x3dbff3,_0x45f0ca,_0x372ffc,_0x57999f,_0x1d2a8a){var _0x5bee7c,_0x82e47f;_0x1d2a8a[_0x3c8f('0x10')]=intUtil[_0x3c8f('0x40')](_0x1d2a8a[_0x3c8f('0x10')]);_0x1d2a8a[_0x3c8f('0x41')]=intUtil[_0x3c8f('0x40')](_0x1d2a8a[_0x3c8f('0x41')]);if(_0x57999f&&_0x57999f[_0x3c8f('0x42')]){logger['info'](_0x3c8f('0x43'),_0x3c8f('0x44'));_0x3dbff3[_0x3c8f('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1d2a8a[_0x3c8f('0x41')],_0x3dbff3[_0x3c8f('0x46')],md5(_0x3dbff3['uniqueid']));}else{_0x3dbff3['recordingURL']='';}headers['Authorization']=getAuth(_0x1d2a8a);return getUser(_0x1d2a8a,_0x372ffc[_0x3c8f('0x47')])[_0x3c8f('0x15')](function(_0x42efa9){_0x5bee7c=_0x42efa9;logger['info'](_0x3c8f('0x48'),_0x5bee7c['id']);return getEndUser(_0x1d2a8a,_0x3dbff3['calleridname'],_0x3dbff3[_0x3c8f('0x49')]);})[_0x3c8f('0x15')](function(_0x1dc169){_0x82e47f=_0x1dc169;logger[_0x3c8f('0xd')](_0x3c8f('0x4a'),_0x82e47f['id']);return getTicket(_0x1d2a8a,_0x5bee7c,_0x82e47f,_0x45f0ca,_0x3dbff3);})[_0x3c8f('0x15')](function(_0x21aafd){if(_0x21aafd){logger[_0x3c8f('0xd')](_0x3c8f('0x4b'),_0x21aafd['id']);switch(_0x1d2a8a[_0x3c8f('0x36')]){case'integrationTab':logger[_0x3c8f('0xd')](_0x3c8f('0x43'),_0x3c8f('0x4c'));return request({'uri':util[_0x3c8f('0x1a')](_0x3c8f('0x4d'),_0x1d2a8a[_0x3c8f('0x10')],_0x5bee7c['id'],_0x21aafd['id']),'method':'POST'});case _0x3c8f('0x4e'):logger['info'](_0x3c8f('0x43'),_0x3c8f('0x4f'));emit(util['format'](_0x3c8f('0x50'),_0x372ffc['name']),_0x3c8f('0x51'),{'uri':util['format']('%s/agent/tickets/%s',_0x1d2a8a['remoteUri'],_0x21aafd['id'])});break;default:logger[_0x3c8f('0x52')](_0x3c8f('0x43'),_0x3c8f('0x53'));}}})[_0x3c8f('0x54')](function(_0x3c0e97){logger[_0x3c8f('0x52')](_0x3c8f('0x55'),util[_0x3c8f('0x56')](_0x3c0e97,{'showHidden':!![],'depth':null}));});};exports[_0x3c8f('0x57')]=function(_0x32a72a,_0x4cfce1,_0x4f6d2e,_0x1b88cd,_0x1ca678,_0x26eebb,_0x5abb7c){var _0x1f2581,_0x2d4279;_0x26eebb[_0x3c8f('0x10')]=intUtil[_0x3c8f('0x40')](_0x26eebb[_0x3c8f('0x10')]);_0x26eebb[_0x3c8f('0x41')]=intUtil[_0x3c8f('0x40')](_0x26eebb['serverUrl']);if(_0x5abb7c&&_0x5abb7c[_0x3c8f('0x58')]&&_0x5abb7c['recordingFormat']!==_0x3c8f('0x59')){logger['info'](_0x3c8f('0x5a'),_0x3c8f('0x44'));_0x4cfce1[_0x3c8f('0x45')]=util[_0x3c8f('0x1a')](_0x3c8f('0x5b'),_0x26eebb[_0x3c8f('0x41')],_0x4cfce1['uniqueid'],md5(_0x4cfce1[_0x3c8f('0x46')]));}headers[_0x3c8f('0x5c')]=getAuth(_0x26eebb);return getUser(_0x26eebb,_0x1b88cd[_0x3c8f('0x47')])[_0x3c8f('0x15')](function(_0x578122){_0x1f2581=_0x578122;logger[_0x3c8f('0xd')]('The\x20User\x20ID\x20is:',_0x1f2581['id']);return getEndUser(_0x26eebb,_0x4cfce1['destcalleridname'],_0x4cfce1[_0x3c8f('0x5d')]);})[_0x3c8f('0x15')](function(_0x48a058){_0x2d4279=_0x48a058;logger[_0x3c8f('0xd')](_0x3c8f('0x4a'),_0x2d4279['id']);return getTicket(_0x26eebb,_0x1f2581,_0x2d4279,_0x4f6d2e,_0x4cfce1);})['then'](function(_0xdca06e){if(_0xdca06e){logger['info']('The\x20Ticket\x20ID\x20is:',_0xdca06e['id']);switch(_0x26eebb[_0x3c8f('0x36')]){case _0x3c8f('0x5e'):logger[_0x3c8f('0xd')](_0x3c8f('0x5a'),_0x3c8f('0x4c'));return request({'uri':util['format'](_0x3c8f('0x4d'),_0x26eebb[_0x3c8f('0x10')],_0x1f2581['id'],_0xdca06e['id']),'method':_0x3c8f('0x11')});case _0x3c8f('0x4e'):logger[_0x3c8f('0xd')]('[OUTBOUND]',_0x3c8f('0x4f'));emit(util['format'](_0x3c8f('0x50'),_0x1b88cd['name']),'trigger:browser:url',{'uri':util[_0x3c8f('0x1a')](_0x3c8f('0x5f'),_0x26eebb['remoteUri'],_0xdca06e['id'])});break;default:logger['error'](_0x3c8f('0x5a'),_0x3c8f('0x53'));}}})[_0x3c8f('0x54')](function(_0x3ee4c0){logger[_0x3c8f('0x52')](_0x3c8f('0x60'),util['inspect'](_0x3ee4c0,{'showHidden':!![],'depth':null}));});};exports[_0x3c8f('0x61')]=function(_0x3fc51e,_0x22cc79,_0x387a08,_0x8f4fa6,_0xc02d43,_0x54b6e3){var _0x5e166c,_0x25626e;_0x54b6e3['remoteUri']=intUtil[_0x3c8f('0x40')](_0x54b6e3[_0x3c8f('0x10')]);_0x54b6e3[_0x3c8f('0x41')]=intUtil[_0x3c8f('0x40')](_0x54b6e3[_0x3c8f('0x41')]);if(_0xc02d43&&_0xc02d43[_0x3c8f('0x42')]){logger[_0x3c8f('0xd')]('[ABANDONED]',_0x3c8f('0x44'));_0x22cc79[_0x3c8f('0x45')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x54b6e3[_0x3c8f('0x41')],_0x22cc79['uniqueid'],md5(_0x22cc79[_0x3c8f('0x46')]));}else{_0x22cc79[_0x3c8f('0x45')]='';}headers[_0x3c8f('0x5c')]=getAuth(_0x54b6e3);return getUser(_0x54b6e3)['then'](function(_0x3a6af1){_0x5e166c=_0x3a6af1;logger[_0x3c8f('0xd')]('The\x20User\x20ID\x20is:',_0x5e166c['id']);return getEndUser(_0x54b6e3,_0x22cc79[_0x3c8f('0x62')],_0x22cc79[_0x3c8f('0x49')]);})[_0x3c8f('0x15')](function(_0x4ea6c8){_0x25626e=_0x4ea6c8;logger[_0x3c8f('0xd')](_0x3c8f('0x4a'),_0x25626e['id']);return getTicket(_0x54b6e3,_0x5e166c,_0x25626e,_0x387a08,_0x22cc79);})[_0x3c8f('0x15')](function(_0x5a9eef){if(_0x5a9eef){logger[_0x3c8f('0xd')](_0x3c8f('0x4b'),_0x5a9eef['id']);}})['catch'](function(_0x2aa3ff){logger[_0x3c8f('0x52')](_0x3c8f('0x63'),util['inspect'](_0x2aa3ff,{'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 6c51f4e..156ada9 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 _0xf636=['stack','Search\x20user','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','findIndex','email','Agent\x20found!','info','Using\x20the\x20admin\x20account!','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','error','data','POST','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','log','CREATE\x20ERROR','GET','moduleSearch','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','contact','nothing','lead','/crm/v2/Leads/search?criteria=((Phone:equals:','Creating\x20new\x20call...','Owner','administrator','Subject','getString','Subjects','Descriptions','enduserType','Last_Name','What_Id','Full_Name','First_Name','$se_module','talktime','utc','format','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','starttime','lastevent','called','Call_Result','Called','complete','connect','Answered','Abandoned','outbound','Call_Type','merge','Fields','Call\x20created!','err','queue','stripTrailingSlash','serverUrl','monitor_format','recordingURL','/api/voice/recordings/','/downloads?type=uniqueid&token=','uniqueid','host','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','[QUEUE]','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','Recording\x20is\x20enabled!','destcalleridname','Outbound','[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','abandoned','[ABANDONED]','lodash','request-promise','util','./util','moment','ioredis','bluebird','../../../../config/logger','redis','defaults','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','type','string','idField','content','toString','variableName','Variable','name','toLowerCase','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','refreshToken','refresh_token','then','add','seconds','catch','Failing\x20creating\x20the\x20access_token'];(function(_0x527fb1,_0x2b7979){var _0x31c69b=function(_0x205c47){while(--_0x205c47){_0x527fb1['push'](_0x527fb1['shift']());}};_0x31c69b(++_0x2b7979);}(_0xf636,0x195));var _0x6f63=function(_0x20438e,_0x52d60e){_0x20438e=_0x20438e-0x0;var _0x28a646=_0xf636[_0x20438e];return _0x28a646;};'use strict';var _=require(_0x6f63('0x0'));var rp=require(_0x6f63('0x1'));var md5=require('md5');var util=require(_0x6f63('0x2'));var intUtil=require(_0x6f63('0x3'));var moment=require(_0x6f63('0x4'));var Redis=require(_0x6f63('0x5'));var BPromise=require(_0x6f63('0x6'));var config=require('../../../../config/environment');var logger=require(_0x6f63('0x7'))('zoho');config[_0x6f63('0x8')]=_[_0x6f63('0x9')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x6f63('0xa'))(new Redis(config[_0x6f63('0x8')]));function emit(_0x581381,_0x77c276,_0x561473){io['to'](_0x581381)['emit'](_0x77c276,_0x561473);}function request(_0x30906c){logger[_0x6f63('0xb')](_0x6f63('0xc'),JSON[_0x6f63('0xd')](_0x30906c));return rp(_0x30906c);}function getCustomFields(_0x196570,_0x551b0e){var _0x43654f={};if(_0x196570[_0x6f63('0xe')]>0x0){_[_0x6f63('0xf')](_0x196570,function(_0x2fccde){if(_0x2fccde[_0x6f63('0x10')]===_0x6f63('0x11')&&_0x2fccde[_0x6f63('0x12')]){_0x43654f[_0x2fccde[_0x6f63('0x12')]]=_0x2fccde[_0x6f63('0x13')][_0x6f63('0x14')]();}else if(_0x2fccde[_0x6f63('0x10')]==='variable'&&_0x2fccde[_0x6f63('0x15')]&&_0x2fccde['idField']&&_0x551b0e[_0x2fccde[_0x6f63('0x15')]]){_0x43654f[_0x2fccde[_0x6f63('0x12')]]=_0x551b0e[_0x2fccde[_0x6f63('0x15')]]['toString']();}else if(_0x2fccde[_0x6f63('0x10')]==='customVariable'&&_0x2fccde[_0x6f63('0x16')]&&_0x2fccde[_0x6f63('0x16')]['name']&&_0x2fccde[_0x6f63('0x12')]&&_0x551b0e[_0x2fccde['Variable'][_0x6f63('0x17')]['toLowerCase']()]){_0x43654f[_0x2fccde[_0x6f63('0x12')]]=_0x551b0e[_0x2fccde[_0x6f63('0x16')]['name'][_0x6f63('0x18')]()][_0x6f63('0x14')]();}});}return _0x43654f;}function getName(_0x5b9b54){if(_0x5b9b54['indexOf']('\x20')>0x0){var _0x54a292=_0x5b9b54['split'](/ (.+)/);if(_0x54a292[0x1]){return _0x54a292;}}return[_0x5b9b54,_0x5b9b54];}var accountsTokens={};function getAccessToken(_0xc61f84){return new Promise(function(_0x31ae9b,_0x389ff0){if(!_[_0x6f63('0x19')](accountsTokens[_0xc61f84['id']])&&!_[_0x6f63('0x19')](accountsTokens[_0xc61f84['id']][_0x6f63('0x1a')])){if(moment()[_0x6f63('0x1b')](accountsTokens[_0xc61f84['id']][_0x6f63('0x1c')])){_0x31ae9b(accountsTokens[_0xc61f84['id']]['access_token']);}}var _0x5d804a;switch(_0xc61f84[_0x6f63('0x1d')]){case'US':_0x5d804a=_0x6f63('0x1e');break;case'AU':_0x5d804a=_0x6f63('0x1f');break;case'EU':_0x5d804a=_0x6f63('0x20');break;case'IN':_0x5d804a=_0x6f63('0x21');break;case'CN':_0x5d804a=_0x6f63('0x22');break;default:_0x5d804a=_0x6f63('0x20');break;}var _0x439377={'method':'POST','uri':_0x5d804a+'/oauth/v2/token','qs':{'refresh_token':_0xc61f84[_0x6f63('0x23')],'client_id':_0xc61f84['clientId'],'client_secret':_0xc61f84['clientSecret'],'grant_type':_0x6f63('0x24')},'json':!![]};return rp(_0x439377)[_0x6f63('0x25')](function(_0x1dada6){accountsTokens[_0xc61f84['id']]={'access_token':_0x1dada6[_0x6f63('0x1a')],'expires_in':moment()[_0x6f63('0x26')](_0x1dada6['expires_in'],_0x6f63('0x27'))};_0x31ae9b(_0x1dada6[_0x6f63('0x1a')]);})[_0x6f63('0x28')](function(_0x41962d){logger['error'](_0x6f63('0x29'),_0x41962d[_0x6f63('0x2a')]);_0x389ff0(_0x41962d);});});}function getUser(_0x526fba,_0x7ac381,_0x5409ec,_0x237496){logger['info'](_0x6f63('0x2b'));return request({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/users',_0x7ac381),'qs':{'type':_0x6f63('0x2c')},'headers':{'Authorization':_0x6f63('0x2d')+_0x526fba},'json':!![]})[_0x6f63('0x25')](function(_0x29fd17){if(_0x29fd17[_0x6f63('0x2e')]){var _0x3a5467=-0x1;if(_[_0x6f63('0x2f')](_0x29fd17[_0x6f63('0x2e')])){if(!_['isNil'](_0x237496)){_0x3a5467=_[_0x6f63('0x30')](_0x29fd17['users'],function(_0x356da4){return _0x356da4[_0x6f63('0x31')]===_0x237496;});}if(_0x3a5467>=0x0){logger['info'](_0x6f63('0x32'));}else{logger[_0x6f63('0x33')](_0x6f63('0x34'));_0x3a5467=_[_0x6f63('0x30')](_0x29fd17['users'],function(_0x54110f){return _0x54110f['profile'][_0x6f63('0x17')]==='Administrator';});}return _0x29fd17['users'][_0x3a5467];}else{if(_0x29fd17['user'][_0x6f63('0x35')]['name']===_0x6f63('0x36')){logger[_0x6f63('0x33')](_0x6f63('0x34'));user=_0x29fd17['user'];return user;}else{logger['error'](_0x6f63('0x37'),JSON[_0x6f63('0xd')](_0x29fd17));throw new Error(_0x6f63('0x38')+JSON[_0x6f63('0xd')](_0x29fd17));}}}else{logger[_0x6f63('0x39')]('The\x20failing\x20result\x20is',JSON[_0x6f63('0xd')](_0x29fd17));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x6f63('0xd')](_0x29fd17));}})['catch'](function(_0x43d615){console[_0x6f63('0x39')](_0x43d615);});}function getZohoUser(_0x337af7,_0x5a2a16){return new BPromise(function(_0x51ff06,_0x528851){request(_0x337af7)[_0x6f63('0x25')](function(_0x555dba){var _0x1e0402=null;if(_0x555dba){_0x1e0402=_0x555dba[_0x6f63('0x3a')][0x0];_0x1e0402['enduserType']=_0x5a2a16;}_0x51ff06(_0x1e0402);})[_0x6f63('0x28')](function(_0x5d3133){_0x528851(_0x5d3133);});});}function createEndUser(_0x32e110,_0x339ab2,_0x195eb5,_0x1235f3,_0x11bed2,_0x17a34e){var _0x195eb5=getName(_0x195eb5);return request({'method':_0x6f63('0x3b'),'uri':_0x6f63('0x3c')+_0x339ab2+_0x6f63('0x3d')+_[_0x6f63('0x3e')](_0x17a34e[_0x6f63('0x3f')])+'s','body':{'data':[{'Last_Name':_0x195eb5[0x1],'First_Name':_0x195eb5[0x0],'Phone':_0x1235f3,'Owner':{'name':!_[_0x6f63('0x19')](_0x11bed2[_0x6f63('0x40')][_0x6f63('0x17')])?_0x11bed2['role'][_0x6f63('0x17')]:!_[_0x6f63('0x19')](_0x11bed2['first_name'])?_0x11bed2[_0x6f63('0x41')]+'\x20'+_0x11bed2[_0x6f63('0x42')]:_0x11bed2[_0x6f63('0x42')],'id':_0x11bed2['id']}}]},'headers':{'Authorization':_0x6f63('0x2d')+_0x32e110},'json':!![]})[_0x6f63('0x25')](function(_0x2ef6d4){if(_0x2ef6d4&&_0x2ef6d4[_0x6f63('0x3a')][0x0][_0x6f63('0x43')]===_0x6f63('0x44')){var _0x12c987=_0x2ef6d4[_0x6f63('0x3a')][0x0][_0x6f63('0x45')];_0x12c987['enduserType']=_[_0x6f63('0x3e')](_0x17a34e[_0x6f63('0x3f')])+'s';return _0x12c987;}logger['error'](_0x6f63('0x37'),JSON[_0x6f63('0xd')](data));throw new Error('Error:\x20'+JSON[_0x6f63('0xd')](data));})[_0x6f63('0x28')](function(_0x19efd6){console[_0x6f63('0x46')](_0x6f63('0x47'),_0x19efd6);});}function getEndUser(_0x325282,_0x2c8b81,_0x28fd35,_0x29180d,_0x27408f,_0x3e1f3f,_0x4ce8dc){var _0x337a37={'method':_0x6f63('0x48'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x325282},'json':!![]};switch(_0x4ce8dc[_0x6f63('0x49')]){case _0x6f63('0x4a'):_0x337a37[_0x6f63('0x4b')]=_0x6f63('0x3c')+_0x2c8b81+_0x6f63('0x4c')+_0x27408f+'))';return getZohoUser(_0x337a37,_0x6f63('0x4d'))[_0x6f63('0x25')](function(_0x409ff0){if(_0x409ff0)return _0x409ff0;_0x337a37[_0x6f63('0x4b')]=_0x6f63('0x3c')+_0x2c8b81+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x27408f+'))';return getZohoUser(_0x337a37,_0x6f63('0x4e'))[_0x6f63('0x25')](function(_0x147bb9){if(_0x147bb9)return _0x147bb9;if(_0x4ce8dc[_0x6f63('0x3f')]!='nothing'){return createEndUser(_0x325282,_0x2c8b81,_0x29180d,_0x27408f,_0x3e1f3f,_0x4ce8dc);}else{return{};}});});break;case _0x6f63('0x4f'):_0x337a37[_0x6f63('0x4b')]=_0x6f63('0x3c')+_0x2c8b81+_0x6f63('0x4c')+_0x27408f+'))';return getZohoUser(_0x337a37,_0x6f63('0x4d'))[_0x6f63('0x25')](function(_0x49d72a){if(_0x49d72a)return _0x49d72a;if(_0x4ce8dc[_0x6f63('0x3f')]!=_0x6f63('0x50')){return createEndUser(_0x325282,_0x2c8b81,_0x29180d,_0x27408f,_0x3e1f3f,_0x4ce8dc);}else{return{};}});break;case _0x6f63('0x51'):_0x337a37[_0x6f63('0x4b')]=_0x6f63('0x3c')+_0x2c8b81+_0x6f63('0x52')+_0x27408f+'))';return getZohoUser(_0x337a37,_0x6f63('0x4e'))[_0x6f63('0x25')](function(_0x4c5a88){if(_0x4c5a88)return _0x4c5a88;if(_0x4ce8dc['moduleCreate']!=_0x6f63('0x50')){return createEndUser(_0x325282,_0x2c8b81,_0x29180d,_0x27408f,_0x3e1f3f,_0x4ce8dc);}else{return{};}});break;}}function getCall(_0x12168b,_0x46144a,_0x14d781,_0x1fb973,_0x5f2b2f,_0x5049d9,_0x41e168,_0x306689){logger[_0x6f63('0x33')](_0x6f63('0x53'));var _0x201adc={};_0x201adc[_0x6f63('0x54')]={'name':!_[_0x6f63('0x19')](_0x1fb973[_0x6f63('0x40')][_0x6f63('0x17')])&&!_[_0x6f63('0x19')](_0x1fb973['profile'][_0x6f63('0x17')])&&_0x1fb973['profile'][_0x6f63('0x17')]===_0x6f63('0x55')?_0x1fb973[_0x6f63('0x40')][_0x6f63('0x17')]:!_[_0x6f63('0x19')](_0x1fb973[_0x6f63('0x41')])?_0x1fb973[_0x6f63('0x41')]+'\x20'+_0x1fb973['last_name']:_0x1fb973[_0x6f63('0x42')],'id':_0x1fb973['id']};_0x201adc[_0x6f63('0x56')]=intUtil[_0x6f63('0x57')](_0x5049d9[_0x6f63('0x58')],_0x41e168,'\x20');_0x201adc['Description']=intUtil[_0x6f63('0x57')](_0x5049d9[_0x6f63('0x59')],_0x41e168,'\x0a');if(_0x5f2b2f[_0x6f63('0x5a')]===_0x6f63('0x4d')){_0x201adc['Who_Id']={'name':!_['isNil'](_0x5f2b2f['Full_Name'])?_0x5f2b2f['Full_Name']:!_[_0x6f63('0x19')](_0x5f2b2f['First_Name'])?_0x5f2b2f['First_Name']+'\x20'+_0x5f2b2f[_0x6f63('0x5b')]:_0x5f2b2f['Last_Name'],'id':_0x5f2b2f['id']};}if(_0x5f2b2f['enduserType']===_0x6f63('0x4e')){_0x201adc[_0x6f63('0x5c')]={'name':!_[_0x6f63('0x19')](_0x5f2b2f[_0x6f63('0x5d')])?_0x5f2b2f['Full_Name']:!_[_0x6f63('0x19')](_0x5f2b2f[_0x6f63('0x5e')])?_0x5f2b2f[_0x6f63('0x5e')]+'\x20'+_0x5f2b2f[_0x6f63('0x5b')]:_0x5f2b2f[_0x6f63('0x5b')],'id':_0x5f2b2f['id']};_0x201adc[_0x6f63('0x5f')]=_[_0x6f63('0x3e')](_0x5f2b2f[_0x6f63('0x5a')]);}if(_0x41e168[_0x6f63('0x60')]){_0x201adc['Call_Duration']=moment[_0x6f63('0x61')](parseInt(_0x41e168[_0x6f63('0x60')])*0x3e8)[_0x6f63('0x62')](_0x6f63('0x63'));}else if(_0x41e168[_0x6f63('0x64')]&&_0x41e168['endtime']){_0x201adc['Call_Duration']=moment[_0x6f63('0x61')](moment(_0x41e168[_0x6f63('0x65')],_0x6f63('0x66'))[_0x6f63('0x67')](moment(_0x41e168[_0x6f63('0x68')],_0x6f63('0x66'))))[_0x6f63('0x62')](_0x6f63('0x63'));}switch(_0x41e168[_0x6f63('0x69')]){case _0x6f63('0x6a'):_0x201adc[_0x6f63('0x6b')]=_0x6f63('0x6c');break;case _0x6f63('0x6d'):case _0x6f63('0x6e'):_0x201adc[_0x6f63('0x6b')]=_0x6f63('0x6f');break;case'rejected':_0x201adc['Call_Result']='Rejected';break;case'abandoned':_0x201adc[_0x6f63('0x6b')]=_0x6f63('0x70');break;default:}_0x201adc['Call_Start_Time']=(_0x306689===_0x6f63('0x71')?moment(_0x41e168[_0x6f63('0x68')])[_0x6f63('0x62')](_0x6f63('0x66')):moment(_0x41e168['agentcalledAt'])['format'](_0x6f63('0x66')))||moment()[_0x6f63('0x62')](_0x6f63('0x66'));_0x201adc[_0x6f63('0x72')]=_0x306689||'Inbound';_0x201adc=_[_0x6f63('0x73')](_0x201adc,getCustomFields(_0x5049d9[_0x6f63('0x74')],_0x41e168));return request({'method':_0x6f63('0x3b'),'uri':_0x6f63('0x3c')+_0x46144a+'/crm/v2/Calls','headers':{'Authorization':_0x6f63('0x2d')+_0x12168b},'body':{'data':[_0x201adc]},'json':!![]})[_0x6f63('0x25')](function(_0x55d863){if(_0x55d863&&_0x55d863['data'][0x0][_0x6f63('0x43')]==='SUCCESS'){logger[_0x6f63('0x33')](_0x6f63('0x75'));return{'id':_0x55d863[_0x6f63('0x3a')][0x0][_0x6f63('0x45')]['id']};}})[_0x6f63('0x28')](function(_0x16d3e1){logger[_0x6f63('0x33')](_0x6f63('0x76'),_0x16d3e1[_0x6f63('0x2a')]);console[_0x6f63('0x46')](_0x6f63('0x76'),_0x16d3e1);});}exports[_0x6f63('0x77')]=function(_0x3084cb,_0x4e7a5d,_0x1a0b52,_0x1651d9,_0x5ed4ae,_0x146f3b){var _0x20395c,_0x1fdca8,_0x20e5b2;_0x146f3b['host']=intUtil[_0x6f63('0x78')](_0x146f3b['host']);_0x146f3b[_0x6f63('0x79')]=intUtil['stripTrailingSlash'](_0x146f3b[_0x6f63('0x79')]);if(_0x5ed4ae&&_0x5ed4ae[_0x6f63('0x7a')]){logger['info']('[QUEUE]','Recording\x20is\x20enabled!');_0x4e7a5d[_0x6f63('0x7b')]=_0x146f3b[_0x6f63('0x79')]+_0x6f63('0x7c')+_0x4e7a5d['uniqueid']+_0x6f63('0x7d')+md5(_0x4e7a5d[_0x6f63('0x7e')]);}else{_0x4e7a5d[_0x6f63('0x7b')]='';}var _0x83788a=_0x146f3b[_0x6f63('0x7f')]===_0x6f63('0x80')?'eu':_0x6f63('0x81');return getAccessToken(_0x146f3b)['then'](function(_0x421ec3){_0x20e5b2=_0x421ec3;return getUser(_0x20e5b2,_0x83788a,_0x146f3b,_0x1651d9[_0x6f63('0x31')]);})[_0x6f63('0x25')](function(_0x36b35b){_0x20395c=_0x36b35b;logger['info'](_0x6f63('0x82'),_0x20395c['id']);return getEndUser(_0x20e5b2,_0x83788a,_0x146f3b,_0x4e7a5d[_0x6f63('0x83')],_0x4e7a5d[_0x6f63('0x84')],_0x20395c,_0x1a0b52);})[_0x6f63('0x25')](function(_0x49b063){_0x1fdca8=_0x49b063;return getCall(_0x20e5b2,_0x83788a,_0x146f3b,_0x20395c,_0x1fdca8,_0x1a0b52,_0x4e7a5d,_0x6f63('0x85'));})[_0x6f63('0x25')](function(_0x4548fc){if(_0x4548fc){logger[_0x6f63('0x33')](_0x6f63('0x86'),_0x4548fc['id']);logger[_0x6f63('0x33')](_0x6f63('0x87'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x6f63('0x62')](_0x6f63('0x88'),_0x1651d9[_0x6f63('0x17')]),_0x6f63('0x89'),{'uri':_0x6f63('0x8a')+_0x146f3b[_0x6f63('0x7f')]+_0x6f63('0x8b')+_0x4548fc['id']});}})['catch'](function(_0x441498){logger[_0x6f63('0x39')]('[QUEUE]',JSON['stringify'](_0x441498));});};exports['outbound']=function(_0x344252,_0x34d81f,_0x41a594,_0x48d2d1,_0x5d37d9,_0x10e0cf,_0x88482f){var _0x2696a4,_0x1a823b,_0x28dbaf;_0x10e0cf[_0x6f63('0x7f')]=intUtil[_0x6f63('0x78')](_0x10e0cf['host']);_0x10e0cf[_0x6f63('0x79')]=intUtil[_0x6f63('0x78')](_0x10e0cf[_0x6f63('0x79')]);if(_0x88482f&&_0x88482f[_0x6f63('0x8c')]&&_0x88482f[_0x6f63('0x8c')]!==_0x6f63('0x8d')){logger[_0x6f63('0x33')]('[OUTBOUND]',_0x6f63('0x8e'));_0x34d81f[_0x6f63('0x7b')]=_0x10e0cf[_0x6f63('0x79')]+_0x6f63('0x7c')+_0x34d81f[_0x6f63('0x7e')]+_0x6f63('0x7d')+md5(_0x34d81f['uniqueid']);}var _0x2ad1b1=_0x10e0cf['host']===_0x6f63('0x80')?'eu':'com';return getAccessToken(_0x10e0cf)[_0x6f63('0x25')](function(_0x4b0ec8){_0x28dbaf=_0x4b0ec8;return getUser(_0x28dbaf,_0x2ad1b1,_0x10e0cf,_0x48d2d1['email']);})[_0x6f63('0x25')](function(_0x540b60){_0x2696a4=_0x540b60;logger[_0x6f63('0x33')](_0x6f63('0x82'),_0x2696a4['id']);return getEndUser(_0x28dbaf,_0x2ad1b1,_0x10e0cf,_0x34d81f[_0x6f63('0x8f')],_0x34d81f['destcalleridnum'],_0x2696a4,_0x41a594);})[_0x6f63('0x25')](function(_0x2b68f5){_0x1a823b=_0x2b68f5;return getCall(_0x28dbaf,_0x2ad1b1,_0x10e0cf,_0x2696a4,_0x1a823b,_0x41a594,_0x34d81f,_0x6f63('0x90'));})[_0x6f63('0x25')](function(_0xd6a6b2){if(_0xd6a6b2){logger[_0x6f63('0x33')](_0x6f63('0x86'),_0xd6a6b2['id']);logger[_0x6f63('0x33')](_0x6f63('0x91'),_0x6f63('0x92'));emit(util[_0x6f63('0x62')](_0x6f63('0x88'),_0x48d2d1[_0x6f63('0x17')]),_0x6f63('0x89'),{'uri':_0x6f63('0x8a')+_0x10e0cf[_0x6f63('0x7f')]+_0x6f63('0x8b')+_0xd6a6b2['id']});}})[_0x6f63('0x28')](function(_0x433ab7){logger['error'](_0x6f63('0x91'),JSON[_0x6f63('0xd')](_0x433ab7));});};exports[_0x6f63('0x93')]=function(_0x5d2738,_0x24efc5,_0x2c9a6a,_0x1412ee,_0x3549ce,_0x3bb3da){var _0x2fe36b,_0x47c835,_0x78dd32;_0x3bb3da[_0x6f63('0x7f')]=intUtil[_0x6f63('0x78')](_0x3bb3da['host']);_0x3bb3da[_0x6f63('0x79')]=intUtil[_0x6f63('0x78')](_0x3bb3da[_0x6f63('0x79')]);if(_0x3549ce&&_0x3549ce[_0x6f63('0x7a')]){logger[_0x6f63('0x33')](_0x6f63('0x94'),_0x6f63('0x8e'));_0x24efc5[_0x6f63('0x7b')]=_0x3bb3da[_0x6f63('0x79')]+'/api/voice/recordings/'+_0x24efc5['uniqueid']+_0x6f63('0x7d')+md5(_0x24efc5['uniqueid']);}else{_0x24efc5[_0x6f63('0x7b')]='';}var _0x295040=_0x3bb3da[_0x6f63('0x7f')]===_0x6f63('0x80')?'eu':_0x6f63('0x81');return getAccessToken(_0x3bb3da)[_0x6f63('0x25')](function(_0x5f0a58){_0x78dd32=_0x5f0a58;return getUser(_0x78dd32,_0x295040,_0x3bb3da);})[_0x6f63('0x25')](function(_0x549a0c){_0x2fe36b=_0x549a0c;logger[_0x6f63('0x33')](_0x6f63('0x82'),_0x2fe36b['id']);return getEndUser(_0x78dd32,_0x295040,_0x3bb3da,_0x24efc5['calleridname'],_0x24efc5[_0x6f63('0x84')],_0x2fe36b,_0x2c9a6a);})[_0x6f63('0x25')](function(_0x430433){_0x47c835=_0x430433;return getCall(_0x78dd32,_0x295040,_0x3bb3da,_0x2fe36b,_0x47c835,_0x2c9a6a,_0x24efc5,_0x6f63('0x85'));})['then'](function(_0x50d78a){if(_0x50d78a){logger[_0x6f63('0x33')](_0x6f63('0x86'),_0x50d78a['id']);}})[_0x6f63('0x28')](function(_0x6da9a0){logger['error'](_0x6f63('0x94'),JSON[_0x6f63('0xd')](_0x6da9a0));});}; \ No newline at end of file +var _0xf03c=['https://www.zohoapis.','startCase','moduleCreate','role','first_name','last_name','Zoho-oauthtoken\x20','code','SUCCESS','details','enduserType','CREATE\x20ERROR','contact_lead','uri','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','Leads','nothing','contact','lead','Owner','getString','Subjects','Description','Descriptions','Who_Id','Full_Name','First_Name','What_Id','Last_Name','Call_Duration','utc','talktime','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','lastevent','Call_Result','connect','Answered','Rejected','abandoned','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','merge','Fields','/crm/v2/Calls','Call\x20created!','err','stack','log','queue','host','stripTrailingSlash','serverUrl','monitor_format','Recording\x20is\x20enabled!','/api/voice/recordings/','/downloads?type=uniqueid&token=','recordingURL','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','[QUEUE]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','uniqueid','destcalleridname','Outbound','The\x20Call\x20ID\x20is:','[ABANDONED]','lodash','request-promise','md5','moment','ioredis','bluebird','../../../../config/environment','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','forEach','type','string','idField','content','toString','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com','https://accounts.zoho.eu','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','then','expires_in','seconds','catch','error','info','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','isArrayLikeObject','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','stringify','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data'];(function(_0x21aa12,_0xd6e085){var _0x446932=function(_0xc79fa6){while(--_0xc79fa6){_0x21aa12['push'](_0x21aa12['shift']());}};_0x446932(++_0xd6e085);}(_0xf03c,0x17a));var _0xcf03=function(_0x42c3d3,_0x292445){_0x42c3d3=_0x42c3d3-0x0;var _0x4409ee=_0xf03c[_0x42c3d3];return _0x4409ee;};'use strict';var _=require(_0xcf03('0x0'));var rp=require(_0xcf03('0x1'));var md5=require(_0xcf03('0x2'));var util=require('util');var intUtil=require('./util');var moment=require(_0xcf03('0x3'));var Redis=require(_0xcf03('0x4'));var BPromise=require(_0xcf03('0x5'));var config=require(_0xcf03('0x6'));var logger=require('../../../../config/logger')(_0xcf03('0x7'));config[_0xcf03('0x8')]=_[_0xcf03('0x9')](config['redis'],{'host':_0xcf03('0xa'),'port':0x18eb});var io=require(_0xcf03('0xb'))(new Redis(config[_0xcf03('0x8')]));function emit(_0x2e4a4b,_0x24ae7b,_0x542492){io['to'](_0x2e4a4b)[_0xcf03('0xc')](_0x24ae7b,_0x542492);}function request(_0x4751a8){logger[_0xcf03('0xd')](_0xcf03('0xe'),JSON['stringify'](_0x4751a8));return rp(_0x4751a8);}function getCustomFields(_0x191e75,_0x43a0e5){var _0x28b269={};if(_0x191e75['length']>0x0){_[_0xcf03('0xf')](_0x191e75,function(_0x5798c){if(_0x5798c[_0xcf03('0x10')]===_0xcf03('0x11')&&_0x5798c[_0xcf03('0x12')]){_0x28b269[_0x5798c[_0xcf03('0x12')]]=_0x5798c[_0xcf03('0x13')][_0xcf03('0x14')]();}else if(_0x5798c[_0xcf03('0x10')]==='variable'&&_0x5798c[_0xcf03('0x15')]&&_0x5798c[_0xcf03('0x12')]&&_0x43a0e5[_0x5798c[_0xcf03('0x15')]]){_0x28b269[_0x5798c[_0xcf03('0x12')]]=_0x43a0e5[_0x5798c['variableName']][_0xcf03('0x14')]();}else if(_0x5798c[_0xcf03('0x10')]===_0xcf03('0x16')&&_0x5798c[_0xcf03('0x17')]&&_0x5798c['Variable'][_0xcf03('0x18')]&&_0x5798c[_0xcf03('0x12')]&&_0x43a0e5[_0x5798c[_0xcf03('0x17')][_0xcf03('0x18')]['toLowerCase']()]){_0x28b269[_0x5798c['idField']]=_0x43a0e5[_0x5798c[_0xcf03('0x17')][_0xcf03('0x18')][_0xcf03('0x19')]()][_0xcf03('0x14')]();}});}return _0x28b269;}function getName(_0x215722){if(_0x215722[_0xcf03('0x1a')]('\x20')>0x0){var _0x13b8bd=_0x215722[_0xcf03('0x1b')](/ (.+)/);if(_0x13b8bd[0x1]){return _0x13b8bd;}}return[_0x215722,_0x215722];}var accountsTokens={};function getAccessToken(_0x2d5fb4){return new Promise(function(_0x17dd1f,_0x49a6cf){if(!_['isNil'](accountsTokens[_0x2d5fb4['id']])&&!_[_0xcf03('0x1c')](accountsTokens[_0x2d5fb4['id']][_0xcf03('0x1d')])){if(moment()[_0xcf03('0x1e')](accountsTokens[_0x2d5fb4['id']]['expires_in'])){_0x17dd1f(accountsTokens[_0x2d5fb4['id']][_0xcf03('0x1d')]);}}var _0xa55fc8;switch(_0x2d5fb4[_0xcf03('0x1f')]){case'US':_0xa55fc8=_0xcf03('0x20');break;case'AU':_0xa55fc8='https://accounts.zoho.com.au';break;case'EU':_0xa55fc8=_0xcf03('0x21');break;case'IN':_0xa55fc8='https://accounts.zoho.in';break;case'CN':_0xa55fc8=_0xcf03('0x22');break;default:_0xa55fc8=_0xcf03('0x21');break;}var _0x128fb9={'method':_0xcf03('0x23'),'uri':_0xa55fc8+_0xcf03('0x24'),'qs':{'refresh_token':_0x2d5fb4[_0xcf03('0x25')],'client_id':_0x2d5fb4[_0xcf03('0x26')],'client_secret':_0x2d5fb4[_0xcf03('0x27')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x128fb9)[_0xcf03('0x28')](function(_0x35e191){accountsTokens[_0x2d5fb4['id']]={'access_token':_0x35e191[_0xcf03('0x1d')],'expires_in':moment()['add'](_0x35e191[_0xcf03('0x29')],_0xcf03('0x2a'))};_0x17dd1f(_0x35e191[_0xcf03('0x1d')]);})[_0xcf03('0x2b')](function(_0x347593){logger[_0xcf03('0x2c')]('Failing\x20creating\x20the\x20access_token',_0x347593['stack']);_0x49a6cf(_0x347593);});});}function getUser(_0x243eec,_0x3a51d0,_0x583f4d,_0x172a09){logger[_0xcf03('0x2d')]('Search\x20user');return request({'method':_0xcf03('0x2e'),'uri':util[_0xcf03('0x2f')](_0xcf03('0x30'),_0x3a51d0),'qs':{'type':_0xcf03('0x31')},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x243eec},'json':!![]})['then'](function(_0x11df0a){if(_0x11df0a['users']){var _0x41f720=-0x1;if(_[_0xcf03('0x32')](_0x11df0a['users'])){if(!_[_0xcf03('0x1c')](_0x172a09)){_0x41f720=_['findIndex'](_0x11df0a[_0xcf03('0x33')],function(_0x2fdc93){return _0x2fdc93[_0xcf03('0x34')]===_0x172a09;});}if(_0x41f720>=0x0){logger[_0xcf03('0x2d')](_0xcf03('0x35'));}else{logger[_0xcf03('0x2d')](_0xcf03('0x36'));_0x41f720=_[_0xcf03('0x37')](_0x11df0a[_0xcf03('0x33')],function(_0x14827f){return _0x14827f[_0xcf03('0x38')][_0xcf03('0x18')]===_0xcf03('0x39');});}return _0x11df0a[_0xcf03('0x33')][_0x41f720];}else{if(_0x11df0a['user'][_0xcf03('0x38')][_0xcf03('0x18')]==='Administrator'){logger[_0xcf03('0x2d')](_0xcf03('0x36'));user=_0x11df0a[_0xcf03('0x3a')];return user;}else{logger[_0xcf03('0x2c')](_0xcf03('0x3b'),JSON[_0xcf03('0x3c')](_0x11df0a));throw new Error(_0xcf03('0x3d')+JSON['stringify'](_0x11df0a));}}}else{logger[_0xcf03('0x2c')](_0xcf03('0x3b'),JSON[_0xcf03('0x3c')](_0x11df0a));throw new Error(_0xcf03('0x3d')+JSON[_0xcf03('0x3c')](_0x11df0a));}})[_0xcf03('0x2b')](function(_0x59da39){console[_0xcf03('0x2c')](_0x59da39);});}function getZohoUser(_0x2e3bfb,_0x116e5f){return new BPromise(function(_0x20c0e0,_0x2f8ff4){request(_0x2e3bfb)[_0xcf03('0x28')](function(_0x62da2f){var _0x513dfd=null;if(_0x62da2f){_0x513dfd=_0x62da2f[_0xcf03('0x3e')][0x0];_0x513dfd['enduserType']=_0x116e5f;}_0x20c0e0(_0x513dfd);})['catch'](function(_0x3e25f4){_0x2f8ff4(_0x3e25f4);});});}function createEndUser(_0x21467e,_0x18fba2,_0x5263ed,_0x1c6158,_0x275bc9,_0x1a2fec){var _0x5263ed=getName(_0x5263ed);return request({'method':_0xcf03('0x23'),'uri':_0xcf03('0x3f')+_0x18fba2+'/crm/v2/'+_[_0xcf03('0x40')](_0x1a2fec[_0xcf03('0x41')])+'s','body':{'data':[{'Last_Name':_0x5263ed[0x1],'First_Name':_0x5263ed[0x0],'Phone':_0x1c6158,'Owner':{'name':!_[_0xcf03('0x1c')](_0x275bc9[_0xcf03('0x42')]['name'])?_0x275bc9[_0xcf03('0x42')][_0xcf03('0x18')]:!_[_0xcf03('0x1c')](_0x275bc9['first_name'])?_0x275bc9[_0xcf03('0x43')]+'\x20'+_0x275bc9[_0xcf03('0x44')]:_0x275bc9[_0xcf03('0x44')],'id':_0x275bc9['id']}}]},'headers':{'Authorization':_0xcf03('0x45')+_0x21467e},'json':!![]})[_0xcf03('0x28')](function(_0x367186){if(_0x367186&&_0x367186[_0xcf03('0x3e')][0x0][_0xcf03('0x46')]===_0xcf03('0x47')){var _0x37fe80=_0x367186[_0xcf03('0x3e')][0x0][_0xcf03('0x48')];_0x37fe80[_0xcf03('0x49')]=_[_0xcf03('0x40')](_0x1a2fec[_0xcf03('0x41')])+'s';return _0x37fe80;}logger[_0xcf03('0x2c')](_0xcf03('0x3b'),JSON[_0xcf03('0x3c')](data));throw new Error('Error:\x20'+JSON['stringify'](data));})[_0xcf03('0x2b')](function(_0x13ee9a){console['log'](_0xcf03('0x4a'),_0x13ee9a);});}function getEndUser(_0x4ecd91,_0x20b35b,_0x47908f,_0x178450,_0x36c892,_0x3d5f44,_0x3a03fb){var _0x3821e2={'method':_0xcf03('0x2e'),'uri':'','headers':{'Authorization':_0xcf03('0x45')+_0x4ecd91},'json':!![]};switch(_0x3a03fb['moduleSearch']){case _0xcf03('0x4b'):_0x3821e2[_0xcf03('0x4c')]=_0xcf03('0x3f')+_0x20b35b+_0xcf03('0x4d')+_0x36c892+'))';return getZohoUser(_0x3821e2,_0xcf03('0x4e'))[_0xcf03('0x28')](function(_0x365441){if(_0x365441)return _0x365441;_0x3821e2[_0xcf03('0x4c')]=_0xcf03('0x3f')+_0x20b35b+_0xcf03('0x4f')+_0x36c892+'))';return getZohoUser(_0x3821e2,_0xcf03('0x50'))[_0xcf03('0x28')](function(_0x304a31){if(_0x304a31)return _0x304a31;if(_0x3a03fb[_0xcf03('0x41')]!=_0xcf03('0x51')){return createEndUser(_0x4ecd91,_0x20b35b,_0x178450,_0x36c892,_0x3d5f44,_0x3a03fb);}else{return{};}});});break;case _0xcf03('0x52'):_0x3821e2[_0xcf03('0x4c')]=_0xcf03('0x3f')+_0x20b35b+_0xcf03('0x4d')+_0x36c892+'))';return getZohoUser(_0x3821e2,'Contacts')[_0xcf03('0x28')](function(_0x198abb){if(_0x198abb)return _0x198abb;if(_0x3a03fb['moduleCreate']!=_0xcf03('0x51')){return createEndUser(_0x4ecd91,_0x20b35b,_0x178450,_0x36c892,_0x3d5f44,_0x3a03fb);}else{return{};}});break;case _0xcf03('0x53'):_0x3821e2[_0xcf03('0x4c')]=_0xcf03('0x3f')+_0x20b35b+_0xcf03('0x4f')+_0x36c892+'))';return getZohoUser(_0x3821e2,_0xcf03('0x50'))['then'](function(_0x2c0184){if(_0x2c0184)return _0x2c0184;if(_0x3a03fb[_0xcf03('0x41')]!=_0xcf03('0x51')){return createEndUser(_0x4ecd91,_0x20b35b,_0x178450,_0x36c892,_0x3d5f44,_0x3a03fb);}else{return{};}});break;}}function getCall(_0x470555,_0x361cc6,_0x33d552,_0x100ebc,_0x10f14d,_0x102c07,_0x1cbe24,_0xd51474){logger[_0xcf03('0x2d')]('Creating\x20new\x20call...');var _0x51e623={};_0x51e623[_0xcf03('0x54')]={'name':!_[_0xcf03('0x1c')](_0x100ebc['role'][_0xcf03('0x18')])&&!_[_0xcf03('0x1c')](_0x100ebc[_0xcf03('0x38')]['name'])&&_0x100ebc[_0xcf03('0x38')][_0xcf03('0x18')]==='administrator'?_0x100ebc['role'][_0xcf03('0x18')]:!_['isNil'](_0x100ebc[_0xcf03('0x43')])?_0x100ebc[_0xcf03('0x43')]+'\x20'+_0x100ebc['last_name']:_0x100ebc['last_name'],'id':_0x100ebc['id']};_0x51e623['Subject']=intUtil[_0xcf03('0x55')](_0x102c07[_0xcf03('0x56')],_0x1cbe24,'\x20');_0x51e623[_0xcf03('0x57')]=intUtil[_0xcf03('0x55')](_0x102c07[_0xcf03('0x58')],_0x1cbe24,'\x0a');if(_0x10f14d[_0xcf03('0x49')]===_0xcf03('0x4e')){_0x51e623[_0xcf03('0x59')]={'name':!_[_0xcf03('0x1c')](_0x10f14d[_0xcf03('0x5a')])?_0x10f14d[_0xcf03('0x5a')]:!_[_0xcf03('0x1c')](_0x10f14d[_0xcf03('0x5b')])?_0x10f14d[_0xcf03('0x5b')]+'\x20'+_0x10f14d['Last_Name']:_0x10f14d['Last_Name'],'id':_0x10f14d['id']};}if(_0x10f14d[_0xcf03('0x49')]==='Leads'){_0x51e623[_0xcf03('0x5c')]={'name':!_[_0xcf03('0x1c')](_0x10f14d[_0xcf03('0x5a')])?_0x10f14d['Full_Name']:!_[_0xcf03('0x1c')](_0x10f14d['First_Name'])?_0x10f14d[_0xcf03('0x5b')]+'\x20'+_0x10f14d[_0xcf03('0x5d')]:_0x10f14d[_0xcf03('0x5d')],'id':_0x10f14d['id']};_0x51e623['$se_module']=_[_0xcf03('0x40')](_0x10f14d['enduserType']);}if(_0x1cbe24['talktime']){_0x51e623[_0xcf03('0x5e')]=moment[_0xcf03('0x5f')](parseInt(_0x1cbe24[_0xcf03('0x60')])*0x3e8)['format'](_0xcf03('0x61'));}else if(_0x1cbe24[_0xcf03('0x62')]&&_0x1cbe24[_0xcf03('0x63')]){_0x51e623[_0xcf03('0x5e')]=moment['utc'](moment(_0x1cbe24['endtime'],'YYYY-MM-DDTHH:mm:ss')['diff'](moment(_0x1cbe24['starttime'],_0xcf03('0x64'))))[_0xcf03('0x2f')](_0xcf03('0x61'));}switch(_0x1cbe24[_0xcf03('0x65')]){case'called':_0x51e623[_0xcf03('0x66')]='Called';break;case'complete':case _0xcf03('0x67'):_0x51e623['Call_Result']=_0xcf03('0x68');break;case'rejected':_0x51e623[_0xcf03('0x66')]=_0xcf03('0x69');break;case _0xcf03('0x6a'):_0x51e623[_0xcf03('0x66')]='Abandoned';break;default:}_0x51e623[_0xcf03('0x6b')]=(_0xd51474===_0xcf03('0x6c')?moment(_0x1cbe24['starttime'])[_0xcf03('0x2f')](_0xcf03('0x64')):moment(_0x1cbe24[_0xcf03('0x6d')])[_0xcf03('0x2f')](_0xcf03('0x64')))||moment()['format'](_0xcf03('0x64'));_0x51e623[_0xcf03('0x6e')]=_0xd51474||_0xcf03('0x6f');_0x51e623=_[_0xcf03('0x70')](_0x51e623,getCustomFields(_0x102c07[_0xcf03('0x71')],_0x1cbe24));return request({'method':'POST','uri':'https://www.zohoapis.'+_0x361cc6+_0xcf03('0x72'),'headers':{'Authorization':_0xcf03('0x45')+_0x470555},'body':{'data':[_0x51e623]},'json':!![]})[_0xcf03('0x28')](function(_0x568667){if(_0x568667&&_0x568667['data'][0x0][_0xcf03('0x46')]==='SUCCESS'){logger[_0xcf03('0x2d')](_0xcf03('0x73'));return{'id':_0x568667['data'][0x0][_0xcf03('0x48')]['id']};}})[_0xcf03('0x2b')](function(_0x22d82d){logger['info'](_0xcf03('0x74'),_0x22d82d[_0xcf03('0x75')]);console[_0xcf03('0x76')](_0xcf03('0x74'),_0x22d82d);});}exports[_0xcf03('0x77')]=function(_0x48619f,_0x13c8ad,_0x391945,_0x22d4da,_0x1d6461,_0x31f039){var _0x4f0034,_0x2b0ba8,_0x516669;_0x31f039[_0xcf03('0x78')]=intUtil[_0xcf03('0x79')](_0x31f039[_0xcf03('0x78')]);_0x31f039[_0xcf03('0x7a')]=intUtil[_0xcf03('0x79')](_0x31f039[_0xcf03('0x7a')]);if(_0x1d6461&&_0x1d6461[_0xcf03('0x7b')]){logger['info']('[QUEUE]',_0xcf03('0x7c'));_0x13c8ad['recordingURL']=_0x31f039['serverUrl']+_0xcf03('0x7d')+_0x13c8ad['uniqueid']+_0xcf03('0x7e')+md5(_0x13c8ad['uniqueid']);}else{_0x13c8ad[_0xcf03('0x7f')]='';}var _0xebf05e=_0x31f039['host']===_0xcf03('0x80')?'eu':_0xcf03('0x81');return getAccessToken(_0x31f039)[_0xcf03('0x28')](function(_0x37e996){_0x516669=_0x37e996;return getUser(_0x516669,_0xebf05e,_0x31f039,_0x22d4da[_0xcf03('0x34')]);})[_0xcf03('0x28')](function(_0x313e28){_0x4f0034=_0x313e28;logger[_0xcf03('0x2d')](_0xcf03('0x82'),_0x4f0034['id']);return getEndUser(_0x516669,_0xebf05e,_0x31f039,_0x13c8ad[_0xcf03('0x83')],_0x13c8ad[_0xcf03('0x84')],_0x4f0034,_0x391945);})[_0xcf03('0x28')](function(_0x41b1e9){_0x2b0ba8=_0x41b1e9;return getCall(_0x516669,_0xebf05e,_0x31f039,_0x4f0034,_0x2b0ba8,_0x391945,_0x13c8ad,_0xcf03('0x6f'));})[_0xcf03('0x28')](function(_0x5d713c){if(_0x5d713c){logger['info']('The\x20Call\x20ID\x20is:',_0x5d713c['id']);logger[_0xcf03('0x2d')](_0xcf03('0x85'),_0xcf03('0x86'));emit(util['format'](_0xcf03('0x87'),_0x22d4da['name']),_0xcf03('0x88'),{'uri':_0xcf03('0x89')+_0x31f039[_0xcf03('0x78')]+_0xcf03('0x8a')+_0x5d713c['id']});}})[_0xcf03('0x2b')](function(_0xb3b548){logger['error'](_0xcf03('0x85'),JSON[_0xcf03('0x3c')](_0xb3b548));});};exports[_0xcf03('0x6c')]=function(_0x1d0898,_0x3f42db,_0x16aa80,_0x252dcd,_0x369b1f,_0x113de5,_0x22cc09){var _0x5361e8,_0x2c93ed,_0x2c868f;_0x113de5[_0xcf03('0x78')]=intUtil[_0xcf03('0x79')](_0x113de5[_0xcf03('0x78')]);_0x113de5[_0xcf03('0x7a')]=intUtil[_0xcf03('0x79')](_0x113de5[_0xcf03('0x7a')]);if(_0x22cc09&&_0x22cc09[_0xcf03('0x8b')]&&_0x22cc09[_0xcf03('0x8b')]!==_0xcf03('0x8c')){logger[_0xcf03('0x2d')](_0xcf03('0x8d'),_0xcf03('0x7c'));_0x3f42db[_0xcf03('0x7f')]=_0x113de5[_0xcf03('0x7a')]+_0xcf03('0x7d')+_0x3f42db[_0xcf03('0x8e')]+_0xcf03('0x7e')+md5(_0x3f42db['uniqueid']);}var _0x15c2da=_0x113de5[_0xcf03('0x78')]===_0xcf03('0x80')?'eu':_0xcf03('0x81');return getAccessToken(_0x113de5)[_0xcf03('0x28')](function(_0x1e841c){_0x2c868f=_0x1e841c;return getUser(_0x2c868f,_0x15c2da,_0x113de5,_0x252dcd[_0xcf03('0x34')]);})[_0xcf03('0x28')](function(_0x55d271){_0x5361e8=_0x55d271;logger[_0xcf03('0x2d')](_0xcf03('0x82'),_0x5361e8['id']);return getEndUser(_0x2c868f,_0x15c2da,_0x113de5,_0x3f42db[_0xcf03('0x8f')],_0x3f42db['destcalleridnum'],_0x5361e8,_0x16aa80);})[_0xcf03('0x28')](function(_0x4c8434){_0x2c93ed=_0x4c8434;return getCall(_0x2c868f,_0x15c2da,_0x113de5,_0x5361e8,_0x2c93ed,_0x16aa80,_0x3f42db,_0xcf03('0x90'));})[_0xcf03('0x28')](function(_0x3a82d5){if(_0x3a82d5){logger['info'](_0xcf03('0x91'),_0x3a82d5['id']);logger[_0xcf03('0x2d')]('[OUTBOUND]','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xcf03('0x2f')](_0xcf03('0x87'),_0x252dcd[_0xcf03('0x18')]),_0xcf03('0x88'),{'uri':_0xcf03('0x89')+_0x113de5['host']+_0xcf03('0x8a')+_0x3a82d5['id']});}})[_0xcf03('0x2b')](function(_0x4663c8){logger[_0xcf03('0x2c')](_0xcf03('0x8d'),JSON['stringify'](_0x4663c8));});};exports[_0xcf03('0x6a')]=function(_0xf08a02,_0x24911b,_0x26c866,_0x4b4344,_0x1213fd,_0x52fcbf){var _0xf53acc,_0x263f1b,_0x249c53;_0x52fcbf[_0xcf03('0x78')]=intUtil[_0xcf03('0x79')](_0x52fcbf[_0xcf03('0x78')]);_0x52fcbf[_0xcf03('0x7a')]=intUtil['stripTrailingSlash'](_0x52fcbf['serverUrl']);if(_0x1213fd&&_0x1213fd[_0xcf03('0x7b')]){logger[_0xcf03('0x2d')](_0xcf03('0x92'),'Recording\x20is\x20enabled!');_0x24911b[_0xcf03('0x7f')]=_0x52fcbf['serverUrl']+_0xcf03('0x7d')+_0x24911b['uniqueid']+_0xcf03('0x7e')+md5(_0x24911b[_0xcf03('0x8e')]);}else{_0x24911b['recordingURL']='';}var _0x5de447=_0x52fcbf[_0xcf03('0x78')]===_0xcf03('0x80')?'eu':_0xcf03('0x81');return getAccessToken(_0x52fcbf)[_0xcf03('0x28')](function(_0x2c66e){_0x249c53=_0x2c66e;return getUser(_0x249c53,_0x5de447,_0x52fcbf);})[_0xcf03('0x28')](function(_0x27636b){_0xf53acc=_0x27636b;logger[_0xcf03('0x2d')](_0xcf03('0x82'),_0xf53acc['id']);return getEndUser(_0x249c53,_0x5de447,_0x52fcbf,_0x24911b[_0xcf03('0x83')],_0x24911b[_0xcf03('0x84')],_0xf53acc,_0x26c866);})['then'](function(_0x12fb4f){_0x263f1b=_0x12fb4f;return getCall(_0x249c53,_0x5de447,_0x52fcbf,_0xf53acc,_0x263f1b,_0x26c866,_0x24911b,'Inbound');})[_0xcf03('0x28')](function(_0x10615c){if(_0x10615c){logger['info']('The\x20Call\x20ID\x20is:',_0x10615c['id']);}})[_0xcf03('0x2b')](function(_0x5f0bb2){logger[_0xcf03('0x2c')](_0xcf03('0x92'),JSON[_0xcf03('0x3c')](_0x5f0bb2));});}; \ 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 3b3f38b..856abd2 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(_0xd4ef4,_0x36db92){var _0x464183=function(_0x38bcc7){while(--_0x38bcc7){_0xd4ef4['push'](_0xd4ef4['shift']());}};_0x464183(++_0x36db92);}(_0x7a54,0x106));var _0x47a5=function(_0x5f3cf0,_0x2df5eb){_0x5f3cf0=_0x5f3cf0-0x0;var _0x2e2a27=_0x7a54[_0x5f3cf0];return _0x2e2a27;};'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(_0x3281e5,_0x458ba3){var _0x302204=function(_0x10315d){while(--_0x10315d){_0x3281e5['push'](_0x3281e5['shift']());}};_0x302204(++_0x458ba3);}(_0x7a54,0x106));var _0x47a5=function(_0x24faa7,_0x1b8d91){_0x24faa7=_0x24faa7-0x0;var _0x1f4678=_0x7a54[_0x24faa7];return _0x1f4678;};'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 eb97cfd..c720af9 100644 --- a/server/services/ami/trigger/urlforward/index.js +++ b/server/services/ami/trigger/urlforward/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['number','headers','data6','parse','error','stack','DELETE','POST','PUT','data7','body','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','data1','statusCode','name','message','request-promise','lodash','mustache','../../../../config/logger','exec','toUpperCase','render','data5'];(function(_0x46a355,_0x4b9083){var _0xff2f8a=function(_0xb4e123){while(--_0xb4e123){_0x46a355['push'](_0x46a355['shift']());}};_0xff2f8a(++_0x4b9083);}(_0xb10b,0x12a));var _0xbb10=function(_0xe06071,_0x4eeaa1){_0xe06071=_0xe06071-0x0;var _0x8ad8be=_0xb10b[_0xe06071];return _0x8ad8be;};'use strict';var rp=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var Mustache=require(_0xbb10('0x2'));var logger=require(_0xbb10('0x3'))('trigger');exports[_0xbb10('0x4')]=function(_0x9bbed,_0x460981){var _0x22320e,_0x49baf4;var _0x312b72={'method':_0x9bbed['data1'][_0xbb10('0x5')](),'uri':Mustache[_0xbb10('0x6')](_0x9bbed['data2'],_0x460981),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x9bbed[_0xbb10('0x7')])===_0xbb10('0x8')&&parseInt(_0x9bbed[_0xbb10('0x7')])>=0x1&&parseInt(_0x9bbed[_0xbb10('0x7')])<=0xa?parseInt(_0x9bbed[_0xbb10('0x7')])*0x3e8:0x5*0x3e8};try{_0x312b72[_0xbb10('0x9')]=_0x9bbed[_0xbb10('0xa')]?JSON[_0xbb10('0xb')](Mustache['render'](_0x9bbed['data6'],_0x460981)):{};}catch(_0x20bd61){logger[_0xbb10('0xc')](_0x20bd61[_0xbb10('0xd')]);}switch(_0x9bbed['data1'][_0xbb10('0x5')]()){case'GET':case _0xbb10('0xe'):_0x22320e=null;_0x312b72['qs']=_0x460981;break;case _0xbb10('0xf'):case _0xbb10('0x10'):if(_0x9bbed[_0xbb10('0x11')]){try{_0x22320e=JSON[_0xbb10('0xb')](Mustache[_0xbb10('0x6')](_0x9bbed['data7'],_0x460981));_0x312b72[_0xbb10('0x12')]=_0x22320e;}catch(_0x42d7e4){logger[_0xbb10('0xc')](_0x42d7e4[_0xbb10('0xd')]);logger[_0xbb10('0xc')](_0xbb10('0x13'));}}else{_0x22320e=_0x460981;_0x312b72[_0xbb10('0x12')]=_0x22320e;}break;}logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x16'),_0x9bbed['data1'],_0x9bbed[_0xbb10('0x17')],JSON[_0xbb10('0x18')](_0x312b72)));rp(_0x312b72)[_0xbb10('0x19')](function(_0x42db98){_0x22320e=!_[_0xbb10('0x1a')](_0x22320e)?_0xbb10('0x1b')+_0x22320e:'';_0x49baf4=typeof _0x42db98[_0xbb10('0x12')]===_0xbb10('0x1c')?JSON[_0xbb10('0x18')](_0x42db98[_0xbb10('0x12')]):_0x42db98['body'];logger[_0xbb10('0x14')](util[_0xbb10('0x15')](_0xbb10('0x1d'),_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x42db98[_0xbb10('0x1f')],_0x49baf4));})['catch'](function(_0x12f888){logger[_0xbb10('0xc')](util['format']('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x9bbed[_0xbb10('0x1e')],_0x9bbed[_0xbb10('0x17')],_0x12f888[_0xbb10('0x1f')],_0x12f888[_0xbb10('0x20')],_0x12f888[_0xbb10('0x21')]));});}; \ No newline at end of file +var _0x5f2f=['lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','render','data2','number','data5','headers','data6','parse','stack','GET','DELETE','POST','PUT','data7','body','error','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','statusCode','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','name','message','request-promise','util'];(function(_0x3a253b,_0x4b2275){var _0x571b02=function(_0x41ef67){while(--_0x41ef67){_0x3a253b['push'](_0x3a253b['shift']());}};_0x571b02(++_0x4b2275);}(_0x5f2f,0x73));var _0xf5f2=function(_0x4dca7c,_0x113ebe){_0x4dca7c=_0x4dca7c-0x0;var _0x1198a7=_0x5f2f[_0x4dca7c];return _0x1198a7;};'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 255bfee..0071612 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 _0xaf9b=['request','debug','error','rpc','routing','message','result','catch','exports','jayson/promise','../../config/logger','client','http','Request'];(function(_0x1b7368,_0x3286ed){var _0x25d54c=function(_0x2366da){while(--_0x2366da){_0x1b7368['push'](_0x1b7368['shift']());}};_0x25d54c(++_0x3286ed);}(_0xaf9b,0x1d7));var _0xbaf9=function(_0x947746,_0x6cce68){_0x947746=_0x947746-0x0;var _0x245fe4=_0xaf9b[_0x947746];return _0x245fe4;};'use strict';var jayson=require(_0xbaf9('0x0'));var BPromise=require('bluebird');var logger=require(_0xbaf9('0x1'))('routing');var client=jayson[_0xbaf9('0x2')][_0xbaf9('0x3')]({'port':0x2329});client[_0xbaf9('0x4')]=function(_0x3c19b1,_0x512b7c){return new BPromise(function(_0x64585f,_0x178a7a){return client[_0xbaf9('0x5')](_0x3c19b1,_0x512b7c)['then'](function(_0x40b949){logger[_0xbaf9('0x6')]('rpc','routing',_0x3c19b1,_0x512b7c,_0x40b949);if(_0x40b949[_0xbaf9('0x7')]){logger[_0xbaf9('0x7')](_0xbaf9('0x8'),_0xbaf9('0x9'),_0x3c19b1,_0x40b949[_0xbaf9('0x7')][_0xbaf9('0xa')],_0x512b7c);return _0x178a7a(_0x40b949[_0xbaf9('0x7')][_0xbaf9('0xa')]);}else{return _0x64585f(_0x40b949[_0xbaf9('0xb')]);}})[_0xbaf9('0xc')](function(_0x30fa1f){logger[_0xbaf9('0x7')]('rpc',_0xbaf9('0x9'),_0x3c19b1,_0x30fa1f,_0x512b7c);return _0x178a7a(_0x30fa1f);});});};module[_0xbaf9('0xd')]=client; \ No newline at end of file +var _0x2bbb=['exports','bluebird','../../config/logger','routing','http','Request','then','rpc','error','message','result','catch'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0x2bbb,0x85));var _0xb2bb=function(_0x1ce653,_0x4e3fe0){_0x1ce653=_0x1ce653-0x0;var _0x47d173=_0x2bbb[_0x1ce653];return _0x47d173;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0xb2bb('0x0'));var logger=require(_0xb2bb('0x1'))(_0xb2bb('0x2'));var client=jayson['client'][_0xb2bb('0x3')]({'port':0x2329});client[_0xb2bb('0x4')]=function(_0x14da5e,_0x242b0b){return new BPromise(function(_0x31565a,_0x152ddd){return client['request'](_0x14da5e,_0x242b0b)[_0xb2bb('0x5')](function(_0x5bee47){logger['debug'](_0xb2bb('0x6'),_0xb2bb('0x2'),_0x14da5e,_0x242b0b,_0x5bee47);if(_0x5bee47[_0xb2bb('0x7')]){logger[_0xb2bb('0x7')]('rpc',_0xb2bb('0x2'),_0x14da5e,_0x5bee47['error'][_0xb2bb('0x8')],_0x242b0b);return _0x152ddd(_0x5bee47[_0xb2bb('0x7')][_0xb2bb('0x8')]);}else{return _0x31565a(_0x5bee47[_0xb2bb('0x9')]);}})[_0xb2bb('0xa')](function(_0x574166){logger[_0xb2bb('0x7')]('rpc',_0xb2bb('0x2'),_0x14da5e,_0x574166,_0x242b0b);return _0x152ddd(_0x574166);});});};module[_0xb2bb('0xb')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 7c753fa..d59c945 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 _0x92bc=['catch','log','bluebird','./server','./realtime','../../mysqldb','resolve','then','getMailAccounts','initMailAccounts','refresh','Setting','findOne'];(function(_0x33d427,_0x47c8c2){var _0x383dbd=function(_0x578493){while(--_0x578493){_0x33d427['push'](_0x33d427['shift']());}};_0x383dbd(++_0x47c8c2);}(_0x92bc,0x106));var _0xc92b=function(_0x56c4cb,_0x4e1e77){_0x56c4cb=_0x56c4cb-0x0;var _0x4cf0c9=_0x92bc[_0x56c4cb];return _0x4cf0c9;};'use strict';var BPromise=require(_0xc92b('0x0'));var server=require(_0xc92b('0x1'));var Realtime=require(_0xc92b('0x2'));var EmailChannel=require('./lib/email');var mailAccount=require('./rpc/mailAccount');var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xc92b('0x3'))['db'];function initRealtime(){return BPromise[_0xc92b('0x4')]()[_0xc92b('0x5')](mailAccount[_0xc92b('0x6')]())['then'](realtime[_0xc92b('0x7')]())[_0xc92b('0x5')](function(){email[_0xc92b('0x8')](realtime['mailAccounts']);return realtime;});}function main(){return server['listen'](realtime,email)[_0xc92b('0x5')](function(_0x439122){return initRealtime();})['then'](function(_0x10d280){return db[_0xc92b('0x9')][_0xc92b('0xa')]({'attributes':['id','loginMailFrequency'],'raw':!![]});})[_0xc92b('0x5')](function(_0x5619a3){return setInterval(initRealtime,_0x5619a3['loginMailFrequency']*0x3e8);})[_0xc92b('0xb')](function(_0x5960e0){console[_0xc92b('0xc')](_0x5960e0);});}main(); \ No newline at end of file +var _0x7a2d=['catch','log','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','../../mysqldb','resolve','then','initMailAccounts','refresh','listen','Setting','findOne','loginMailFrequency'];(function(_0x220ac9,_0x3dc24a){var _0xf3e712=function(_0x316d3e){while(--_0x316d3e){_0x220ac9['push'](_0x220ac9['shift']());}};_0xf3e712(++_0x3dc24a);}(_0x7a2d,0x142));var _0xd7a2=function(_0x6bb271,_0x9f2ebf){_0x6bb271=_0x6bb271-0x0;var _0x17130c=_0x7a2d[_0x6bb271];return _0x17130c;};'use strict';var BPromise=require(_0xd7a2('0x0'));var server=require(_0xd7a2('0x1'));var Realtime=require(_0xd7a2('0x2'));var EmailChannel=require(_0xd7a2('0x3'));var mailAccount=require(_0xd7a2('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);var db=require(_0xd7a2('0x5'))['db'];function initRealtime(){return BPromise[_0xd7a2('0x6')]()['then'](mailAccount['getMailAccounts']())[_0xd7a2('0x7')](realtime[_0xd7a2('0x8')]())[_0xd7a2('0x7')](function(){email[_0xd7a2('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xd7a2('0xa')](realtime,email)[_0xd7a2('0x7')](function(_0x1e3fc8){return initRealtime();})[_0xd7a2('0x7')](function(_0x1ea591){return db[_0xd7a2('0xb')][_0xd7a2('0xc')]({'attributes':['id',_0xd7a2('0xd')],'raw':!![]});})[_0xd7a2('0x7')](function(_0x503b42){return setInterval(initRealtime,_0x503b42[_0xd7a2('0xd')]*0x3e8);})[_0xd7a2('0xe')](function(_0xe6e4b9){console[_0xd7a2('0xf')](_0xe6e4b9);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index d4149d1..8da3144 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 _0xfc44=['status','messageStatus','total','isNil','stringify','emit','mailAccount:update','hasOwnProperty','active','handleImapBox','bind','end','handleImapEnd','error','handleImapError','connected','name','messages','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','from','notify','catch','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','prototype','key','Imap'];(function(_0x1e46a5,_0x5b094e){var _0x35a2cf=function(_0x5e7c65){while(--_0x5e7c65){_0x1e46a5['push'](_0x1e46a5['shift']());}};_0x35a2cf(++_0x5b094e);}(_0xfc44,0xbb));var _0x4fc4=function(_0x5c452e,_0x48d665){_0x5c452e=_0x5c452e-0x0;var _0x4c04c7=_0xfc44[_0x5c452e];return _0x4c04c7;};'use strict';var _=require('lodash');var moment=require(_0x4fc4('0x0'));var BPromise=require(_0x4fc4('0x1'));var md5=require(_0x4fc4('0x2'));var Redis=require(_0x4fc4('0x3'));var config=require(_0x4fc4('0x4'));var logger=require(_0x4fc4('0x5'))(_0x4fc4('0x6'));config[_0x4fc4('0x7')]=_[_0x4fc4('0x8')](config['redis'],{'host':_0x4fc4('0x9'),'port':0x18eb});var io=require(_0x4fc4('0xa'))(new Redis(config[_0x4fc4('0x7')]));var EmailImap=require(_0x4fc4('0xb'));var EmailSmtp=require('./smtp');var mailAccount=require(_0x4fc4('0xc'));var md5Accounts={};function EmailChannel(_0x3b9469){logger[_0x4fc4('0xd')](_0x4fc4('0xe'));this[_0x4fc4('0xf')]=_0x3b9469[_0x4fc4('0xf')];this[_0x4fc4('0x10')]={};this[_0x4fc4('0x11')]=new EmailSmtp();}EmailChannel[_0x4fc4('0x12')]['emit']=function(_0x20c684){var _0x588633=this['mailAccounts'][_0x20c684];var _0x1e9885={'id':_0x588633['id'],'name':_0x588633['name'],'key':_0x588633[_0x4fc4('0x13')],'active':_0x588633['active'],'Imap':{'status':_0x588633[_0x4fc4('0x14')][_0x4fc4('0x15')],'messageStatus':_0x588633['Imap'][_0x4fc4('0x16')],'total':_0x588633[_0x4fc4('0x14')][_0x4fc4('0x17')]}};if(_[_0x4fc4('0x18')](md5Accounts[_0x20c684])){md5Accounts[_0x20c684]={};}var _0x247e2c=md5(JSON[_0x4fc4('0x19')](_0x1e9885));if(md5Accounts[_0x20c684][_0x4fc4('0x2')]!==_0x247e2c){md5Accounts[_0x20c684]['md5']=_0x247e2c;io[_0x4fc4('0x1a')](_0x4fc4('0x1b'),_0x1e9885);}};EmailChannel[_0x4fc4('0x12')]['refresh']=function(_0x48cbae){for(var _0x3feb90 in _0x48cbae){if(_0x48cbae[_0x4fc4('0x1c')](_0x3feb90)){if(_0x48cbae[_0x3feb90][_0x4fc4('0x14')]&&_0x48cbae[_0x3feb90][_0x4fc4('0x1d')]){var _0x310ba5=_0x48cbae[_0x3feb90][_0x4fc4('0x14')];if(!this[_0x4fc4('0x10')][_0x4fc4('0x1c')](_0x310ba5['id'])){this['imapAccounts'][_0x310ba5['id']]=new EmailImap(_0x310ba5,_0x48cbae[_0x3feb90]['email']);this[_0x4fc4('0x10')][_0x310ba5['id']]['on']('box',this[_0x4fc4('0x1e')][_0x4fc4('0x1f')](this,_0x3feb90));this[_0x4fc4('0x10')][_0x310ba5['id']]['on'](_0x4fc4('0x6'),this['handleImapEmail'][_0x4fc4('0x1f')](this,_0x3feb90));this[_0x4fc4('0x10')][_0x310ba5['id']]['on'](_0x4fc4('0x20'),this[_0x4fc4('0x21')]['bind'](this,_0x3feb90));this[_0x4fc4('0x10')][_0x310ba5['id']]['on'](_0x4fc4('0x22'),this[_0x4fc4('0x23')]['bind'](this,_0x3feb90));}}else{if(_[_0x4fc4('0x18')](this[_0x4fc4('0xf')][_0x3feb90][_0x4fc4('0x14')])){this[_0x4fc4('0xf')][_0x3feb90]['Imap']={};}this[_0x4fc4('0xf')][_0x3feb90][_0x4fc4('0x14')][_0x4fc4('0x15')]='disabled';this[_0x4fc4('0xf')][_0x3feb90]['Imap']['messageStatus']='';this[_0x4fc4('0x1a')](_0x3feb90);}}}};EmailChannel[_0x4fc4('0x12')]['handleImapBox']=function(_0x2bb412,_0x50d9a6){if(this[_0x4fc4('0xf')][_0x2bb412]){this[_0x4fc4('0xf')][_0x2bb412][_0x4fc4('0x14')]['status']=_0x4fc4('0x24');this[_0x4fc4('0xf')][_0x2bb412]['Imap'][_0x4fc4('0x16')]=_0x50d9a6[_0x4fc4('0x25')];if(_0x50d9a6[_0x4fc4('0x26')]){this['mailAccounts'][_0x2bb412][_0x4fc4('0x14')][_0x4fc4('0x17')]=_0x50d9a6[_0x4fc4('0x26')][_0x4fc4('0x17')];}return this[_0x4fc4('0x1a')](_0x2bb412);}};EmailChannel[_0x4fc4('0x12')][_0x4fc4('0x27')]=function(_0x42c296,_0x20f79d){logger[_0x4fc4('0xd')](_0x4fc4('0x28'),_0x20f79d['firstName'],_0x20f79d['lastName'],_0x20f79d[_0x4fc4('0x29')],_0x42c296);if(this[_0x4fc4('0xf')][_0x42c296]){return mailAccount[_0x4fc4('0x2a')](_0x42c296,_0x20f79d)['then'](function(_0xb6cbc8){if(_0xb6cbc8){logger[_0x4fc4('0xd')]('Mail\x20accepted\x20from\x20routing');}})[_0x4fc4('0x2b')](function(_0x1ff379){logger[_0x4fc4('0x22')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4fc4('0x19')](_0x1ff379));});}};EmailChannel[_0x4fc4('0x12')][_0x4fc4('0x21')]=function(_0xad2b8e){if(this[_0x4fc4('0xf')][_0xad2b8e]&&this[_0x4fc4('0xf')][_0xad2b8e][_0x4fc4('0x14')]){if(this[_0x4fc4('0x10')][this[_0x4fc4('0xf')][_0xad2b8e]['Imap']['id']]){delete this[_0x4fc4('0x10')][this[_0x4fc4('0xf')][_0xad2b8e][_0x4fc4('0x14')]['id']];}this[_0x4fc4('0xf')][_0xad2b8e][_0x4fc4('0x14')][_0x4fc4('0x2c')]=moment();this['emit'](_0xad2b8e);}};EmailChannel[_0x4fc4('0x12')][_0x4fc4('0x23')]=function(_0x2645df,_0x2baa68){if(this[_0x4fc4('0xf')][_0x2645df]){this[_0x4fc4('0xf')][_0x2645df][_0x4fc4('0x14')][_0x4fc4('0x15')]=_0x4fc4('0x22');this[_0x4fc4('0xf')][_0x2645df][_0x4fc4('0x14')]['messageStatus']=_0x2baa68;return this[_0x4fc4('0x1a')](_0x2645df);}};EmailChannel[_0x4fc4('0x12')][_0x4fc4('0x2d')]=function(_0x193139,_0x1c342c){return this[_0x4fc4('0x11')][_0x4fc4('0x2e')](_0x193139,_0x1c342c);};EmailChannel[_0x4fc4('0x12')][_0x4fc4('0x2f')]=function(_0x5e35b0){var _0x49c0a8=this;if(this[_0x4fc4('0xf')][_0x5e35b0['id']]){if(_[_0x4fc4('0x18')](this[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')])){this[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')]={};}this[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')][_0x4fc4('0x2c')]=moment();return new BPromise(function(_0xa7e115,_0x42ecb8){return _0x49c0a8['smtp'][_0x4fc4('0x31')](_0x5e35b0)['then'](function(_0x192d6c){_0x49c0a8[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')][_0x4fc4('0x15')]=_0x4fc4('0x32');_0x49c0a8[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')]['messageStatus']='';_0x49c0a8[_0x4fc4('0x1a')](_0x5e35b0['id']);_0xa7e115(_0x192d6c);})['catch'](function(_0x18fe88){_0x49c0a8['mailAccounts'][_0x5e35b0['id']][_0x4fc4('0x30')][_0x4fc4('0x15')]='error';_0x49c0a8[_0x4fc4('0xf')][_0x5e35b0['id']][_0x4fc4('0x30')]['messageStatus']=_0x18fe88;_0x49c0a8['emit'](_0x5e35b0['id']);_0x42ecb8(_0x18fe88);});});}return this[_0x4fc4('0x11')]['verify'](_0x5e35b0);};module[_0x4fc4('0x33')]=EmailChannel; \ No newline at end of file +var _0x4757=['then','verified','exports','lodash','bluebird','md5','ioredis','../../../config/logger','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','prototype','emit','name','key','status','Imap','messageStatus','isNil','mailAccount:update','hasOwnProperty','active','email','box','handleImapBox','bind','handleImapEmail','handleImapEnd','error','handleImapError','connected','messages','total','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','notify','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','smtp','send','verifySmtp','Smtp','verify'];(function(_0x2601b4,_0x315e78){var _0x3e3661=function(_0x13b45b){while(--_0x13b45b){_0x2601b4['push'](_0x2601b4['shift']());}};_0x3e3661(++_0x315e78);}(_0x4757,0x9c));var _0x7475=function(_0x5c4f6b,_0x2cdfce){_0x5c4f6b=_0x5c4f6b-0x0;var _0x104c4e=_0x4757[_0x5c4f6b];return _0x104c4e;};'use strict';var _=require(_0x7475('0x0'));var moment=require('moment');var BPromise=require(_0x7475('0x1'));var md5=require(_0x7475('0x2'));var Redis=require(_0x7475('0x3'));var config=require('../../../config/environment');var logger=require(_0x7475('0x4'))('email');config['redis']=_[_0x7475('0x5')](config[_0x7475('0x6')],{'host':_0x7475('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var EmailImap=require(_0x7475('0x8'));var EmailSmtp=require(_0x7475('0x9'));var mailAccount=require(_0x7475('0xa'));var md5Accounts={};function EmailChannel(_0x3b7a63){logger[_0x7475('0xb')]('start\x20email\x20channel');this[_0x7475('0xc')]=_0x3b7a63['mailAccounts'];this[_0x7475('0xd')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x7475('0xe')][_0x7475('0xf')]=function(_0x8a7f10){var _0x13e0ab=this[_0x7475('0xc')][_0x8a7f10];var _0x313360={'id':_0x13e0ab['id'],'name':_0x13e0ab[_0x7475('0x10')],'key':_0x13e0ab[_0x7475('0x11')],'active':_0x13e0ab['active'],'Imap':{'status':_0x13e0ab['Imap'][_0x7475('0x12')],'messageStatus':_0x13e0ab[_0x7475('0x13')][_0x7475('0x14')],'total':_0x13e0ab[_0x7475('0x13')]['total']}};if(_[_0x7475('0x15')](md5Accounts[_0x8a7f10])){md5Accounts[_0x8a7f10]={};}var _0x57f61e=md5(JSON['stringify'](_0x313360));if(md5Accounts[_0x8a7f10][_0x7475('0x2')]!==_0x57f61e){md5Accounts[_0x8a7f10][_0x7475('0x2')]=_0x57f61e;io[_0x7475('0xf')](_0x7475('0x16'),_0x313360);}};EmailChannel[_0x7475('0xe')]['refresh']=function(_0x3c125f){for(var _0x154efa in _0x3c125f){if(_0x3c125f[_0x7475('0x17')](_0x154efa)){if(_0x3c125f[_0x154efa][_0x7475('0x13')]&&_0x3c125f[_0x154efa][_0x7475('0x18')]){var _0xb728e2=_0x3c125f[_0x154efa][_0x7475('0x13')];if(!this[_0x7475('0xd')]['hasOwnProperty'](_0xb728e2['id'])){this[_0x7475('0xd')][_0xb728e2['id']]=new EmailImap(_0xb728e2,_0x3c125f[_0x154efa][_0x7475('0x19')]);this[_0x7475('0xd')][_0xb728e2['id']]['on'](_0x7475('0x1a'),this[_0x7475('0x1b')][_0x7475('0x1c')](this,_0x154efa));this[_0x7475('0xd')][_0xb728e2['id']]['on'](_0x7475('0x19'),this[_0x7475('0x1d')][_0x7475('0x1c')](this,_0x154efa));this[_0x7475('0xd')][_0xb728e2['id']]['on']('end',this[_0x7475('0x1e')][_0x7475('0x1c')](this,_0x154efa));this[_0x7475('0xd')][_0xb728e2['id']]['on'](_0x7475('0x1f'),this[_0x7475('0x20')][_0x7475('0x1c')](this,_0x154efa));}}else{if(_['isNil'](this[_0x7475('0xc')][_0x154efa][_0x7475('0x13')])){this['mailAccounts'][_0x154efa][_0x7475('0x13')]={};}this[_0x7475('0xc')][_0x154efa][_0x7475('0x13')]['status']='disabled';this[_0x7475('0xc')][_0x154efa]['Imap'][_0x7475('0x14')]='';this[_0x7475('0xf')](_0x154efa);}}}};EmailChannel[_0x7475('0xe')][_0x7475('0x1b')]=function(_0x2ff277,_0x2aa818){if(this[_0x7475('0xc')][_0x2ff277]){this[_0x7475('0xc')][_0x2ff277]['Imap'][_0x7475('0x12')]=_0x7475('0x21');this[_0x7475('0xc')][_0x2ff277][_0x7475('0x13')][_0x7475('0x14')]=_0x2aa818[_0x7475('0x10')];if(_0x2aa818[_0x7475('0x22')]){this[_0x7475('0xc')][_0x2ff277][_0x7475('0x13')][_0x7475('0x23')]=_0x2aa818[_0x7475('0x22')]['total'];}return this[_0x7475('0xf')](_0x2ff277);}};EmailChannel['prototype']['handleImapEmail']=function(_0xb7d64d,_0x57b3ed){logger['info'](_0x7475('0x24'),_0x57b3ed['firstName'],_0x57b3ed[_0x7475('0x25')],_0x57b3ed[_0x7475('0x26')],_0xb7d64d);if(this['mailAccounts'][_0xb7d64d]){return mailAccount[_0x7475('0x27')](_0xb7d64d,_0x57b3ed)['then'](function(_0x296224){if(_0x296224){logger[_0x7475('0xb')]('Mail\x20accepted\x20from\x20routing');}})[_0x7475('0x28')](function(_0x3489b0){logger[_0x7475('0x1f')](_0x7475('0x29'),JSON['stringify'](_0x3489b0));});}};EmailChannel['prototype'][_0x7475('0x1e')]=function(_0x207ceb){if(this[_0x7475('0xc')][_0x207ceb]&&this[_0x7475('0xc')][_0x207ceb][_0x7475('0x13')]){if(this[_0x7475('0xd')][this[_0x7475('0xc')][_0x207ceb][_0x7475('0x13')]['id']]){delete this[_0x7475('0xd')][this[_0x7475('0xc')][_0x207ceb][_0x7475('0x13')]['id']];}this[_0x7475('0xc')][_0x207ceb][_0x7475('0x13')][_0x7475('0x2a')]=moment();this[_0x7475('0xf')](_0x207ceb);}};EmailChannel[_0x7475('0xe')]['handleImapError']=function(_0x133b2e,_0x54a532){if(this[_0x7475('0xc')][_0x133b2e]){this[_0x7475('0xc')][_0x133b2e][_0x7475('0x13')][_0x7475('0x12')]='error';this[_0x7475('0xc')][_0x133b2e][_0x7475('0x13')]['messageStatus']=_0x54a532;return this[_0x7475('0xf')](_0x133b2e);}};EmailChannel[_0x7475('0xe')]['sendMail']=function(_0xad9b2d,_0xacd2c6){return this[_0x7475('0x2b')][_0x7475('0x2c')](_0xad9b2d,_0xacd2c6);};EmailChannel['prototype'][_0x7475('0x2d')]=function(_0x596c22){var _0x1bcaeb=this;if(this[_0x7475('0xc')][_0x596c22['id']]){if(_[_0x7475('0x15')](this['mailAccounts'][_0x596c22['id']][_0x7475('0x2e')])){this[_0x7475('0xc')][_0x596c22['id']]['Smtp']={};}this[_0x7475('0xc')][_0x596c22['id']]['Smtp'][_0x7475('0x2a')]=moment();return new BPromise(function(_0x55b473,_0xe3da8a){return _0x1bcaeb[_0x7475('0x2b')][_0x7475('0x2f')](_0x596c22)[_0x7475('0x30')](function(_0x5b39db){_0x1bcaeb['mailAccounts'][_0x596c22['id']][_0x7475('0x2e')][_0x7475('0x12')]=_0x7475('0x31');_0x1bcaeb[_0x7475('0xc')][_0x596c22['id']]['Smtp'][_0x7475('0x14')]='';_0x1bcaeb[_0x7475('0xf')](_0x596c22['id']);_0x55b473(_0x5b39db);})['catch'](function(_0x3dcc3c){_0x1bcaeb[_0x7475('0xc')][_0x596c22['id']][_0x7475('0x2e')][_0x7475('0x12')]='error';_0x1bcaeb[_0x7475('0xc')][_0x596c22['id']][_0x7475('0x2e')][_0x7475('0x14')]=_0x3dcc3c;_0x1bcaeb['emit'](_0x596c22['id']);_0xe3da8a(_0x3dcc3c);});});}return this[_0x7475('0x2b')][_0x7475('0x2f')](_0x596c22);};module[_0x7475('0x32')]=EmailChannel; \ No newline at end of file diff --git a/server/services/email/lib/imap.js b/server/services/email/lib/imap.js index c31f32d..c6614cf 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 _0x4dd9=['simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','account','once','ready','handleReady','end','bind','handleError','connect','inherits','prototype','getAccount','connTimeout','authTimeout','isNil','service','authentication','user','password','host','port','tls','required','getHost','anonymous@xcally.com','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','handleEnd','error','stringify','textCode','hasOwnProperty','upperFirst','exports','util','imap','randomstring'];(function(_0x414b50,_0x1f3d1c){var _0x21ece9=function(_0x2d719d){while(--_0x2d719d){_0x414b50['push'](_0x414b50['shift']());}};_0x21ece9(++_0x1f3d1c);}(_0x4dd9,0x1a8));var _0x94dd=function(_0xed5f9c,_0x5a25cd){_0xed5f9c=_0xed5f9c-0x0;var _0x3a1c43=_0x4dd9[_0xed5f9c];return _0x3a1c43;};'use strict';var fs=require('fs');var path=require('path');var util=require(_0x94dd('0x0'));var Imap=require(_0x94dd('0x1'));var _=require('lodash');var rs=require(_0x94dd('0x2'));var simpleParser=require('mailparser')[_0x94dd('0x3')];var Iconv=require(_0x94dd('0x4'))[_0x94dd('0x5')];var EventEmitter=require(_0x94dd('0x6'))[_0x94dd('0x7')];var utils=require(_0x94dd('0x8'));var logger=require(_0x94dd('0x9'))(_0x94dd('0xa'));function EmailImap(_0x262d40,_0x5b7f0b){this[_0x94dd('0xb')]='INBOX';this[_0x94dd('0xc')]=this['getAccount'](_0x262d40,_0x5b7f0b);this['imap']=new Imap(this[_0x94dd('0xc')]);this[_0x94dd('0x1')][_0x94dd('0xd')](_0x94dd('0xe'),this[_0x94dd('0xf')]['bind'](this));this[_0x94dd('0x1')][_0x94dd('0xd')](_0x94dd('0x10'),this['handleEnd'][_0x94dd('0x11')](this));this['imap']['on']('error',this[_0x94dd('0x12')][_0x94dd('0x11')](this));this[_0x94dd('0x1')][_0x94dd('0x13')]();}util[_0x94dd('0x14')](EmailImap,EventEmitter);EmailImap[_0x94dd('0x15')][_0x94dd('0x16')]=function(_0x93a227,_0x31a205){var _0x491634={'connTimeout':_0x93a227[_0x94dd('0x17')]?_0x93a227[_0x94dd('0x17')]*0x3e8:0x2710,'authTimeout':_0x93a227[_0x94dd('0x18')]?_0x93a227[_0x94dd('0x18')]*0x3e8:0x1388};if(_[_0x94dd('0x19')](_0x93a227[_0x94dd('0x1a')])){if(_0x93a227[_0x94dd('0x1b')]){_0x491634[_0x94dd('0x1c')]=_0x93a227[_0x94dd('0x1c')];_0x491634[_0x94dd('0x1d')]=_0x93a227['password'];}_0x491634[_0x94dd('0x1e')]=_0x93a227[_0x94dd('0x1e')];_0x491634[_0x94dd('0x1f')]=_0x93a227[_0x94dd('0x1f')]||0x3e1;if(_0x93a227[_0x94dd('0x20')]){_0x491634[_0x94dd('0x20')]=!![];}else{_0x491634['tls']=![];_0x491634['autotls']=_0x94dd('0x21');}}else{_0x491634[_0x94dd('0x1c')]=_0x93a227['user'];_0x491634[_0x94dd('0x1d')]=_0x93a227['password'];_0x491634[_0x94dd('0x1e')]=utils[_0x94dd('0x22')](_0x93a227[_0x94dd('0x1a')]);_0x491634[_0x94dd('0x1f')]=0x3e1;_0x491634[_0x94dd('0x20')]=!![];}_0x491634[_0x94dd('0xa')]=_0x31a205||_0x93a227[_0x94dd('0x1c')]||_0x94dd('0x23');return _0x491634;};EmailImap[_0x94dd('0x15')][_0x94dd('0xf')]=function(){this['imap'][_0x94dd('0x24')](this[_0x94dd('0xb')],![],this[_0x94dd('0x25')][_0x94dd('0x11')](this));};EmailImap['prototype'][_0x94dd('0x25')]=function(_0x23c932,_0x2ec9c7){if(_0x23c932){this['handleError'](_0x23c932,!![]);}else{this[_0x94dd('0x26')]('box',_0x2ec9c7);this[_0x94dd('0x27')]();}};EmailImap['prototype'][_0x94dd('0x28')]=function(_0x117d5b){if(_0x117d5b){this['handleError'](_0x117d5b,!![]);}else{this['imap']['end']();}};EmailImap[_0x94dd('0x15')][_0x94dd('0x27')]=function(){this[_0x94dd('0x1')]['search']([_0x94dd('0x29')],this['handleReadUnseen'][_0x94dd('0x11')](this));};EmailImap[_0x94dd('0x15')][_0x94dd('0x2a')]=function(_0x4a32b2,_0x5e973b){if(_0x4a32b2){this[_0x94dd('0x12')](_0x4a32b2,!![]);}else{if(_0x5e973b[_0x94dd('0x2b')]){try{var _0x3c1a8e=this['imap']['fetch'](_0x5e973b,{'bodies':'','markSeen':!![]});_0x3c1a8e['on'](_0x94dd('0x2c'),this[_0x94dd('0x2d')][_0x94dd('0x11')](this));_0x3c1a8e[_0x94dd('0xd')]('error',this[_0x94dd('0x2e')][_0x94dd('0x11')](this));_0x3c1a8e[_0x94dd('0xd')]('end',this[_0x94dd('0x2f')][_0x94dd('0x11')](this));}catch(_0x31d713){logger['error'](_0x31d713);}}else{this[_0x94dd('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));}}};EmailImap['prototype']['handleFetchMessage']=function(_0x2cf869,_0xc8490e){_0x2cf869['on']('body',this[_0x94dd('0x30')][_0x94dd('0x11')](this));_0x2cf869['once']('attributes',this[_0x94dd('0x31')][_0x94dd('0x11')](this));_0x2cf869['once'](_0x94dd('0x10'),this[_0x94dd('0x32')][_0x94dd('0x11')](this));};EmailImap['prototype'][_0x94dd('0x30')]=function(_0x1f88e4,_0x218e06){simpleParser(_0x1f88e4,{'Iconv':Iconv},this[_0x94dd('0x33')]['bind'](this));};EmailImap['prototype'][_0x94dd('0x31')]=function(_0x16f68){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0x94dd('0x15')][_0x94dd('0x33')]=function(_0x203859,_0x5bbc68){if(_0x203859){logger['error'](_0x203859);}else{var _0x6b3ac2=this;utils[_0x94dd('0x34')](this['account'],_0x5bbc68,function(_0x25c720){_0x6b3ac2[_0x94dd('0x26')](_0x94dd('0xa'),_0x25c720);});}};EmailImap[_0x94dd('0x15')]['handleFetchEnd']=function(){this[_0x94dd('0x1')][_0x94dd('0x35')](!![],this[_0x94dd('0x28')][_0x94dd('0x11')](this));};EmailImap[_0x94dd('0x15')][_0x94dd('0x2e')]=function(_0x14291b){this[_0x94dd('0x12')](_0x14291b);this[_0x94dd('0x1')][_0x94dd('0x35')](!![],this[_0x94dd('0x28')]['bind'](this));};EmailImap[_0x94dd('0x15')][_0x94dd('0x36')]=function(){this['emit']('end');};EmailImap[_0x94dd('0x15')][_0x94dd('0x12')]=function(_0x4af93c,_0x401e28){logger[_0x94dd('0x37')]('handleError',this[_0x94dd('0xc')]['email'],JSON[_0x94dd('0x38')](_0x4af93c));var _0x66853e='';if(_0x4af93c){if(_0x4af93c[_0x94dd('0x39')]){_0x66853e=_0x4af93c[_0x94dd('0x39')];}else{for(var _0x1821e6 in _0x4af93c){if(_0x4af93c[_0x94dd('0x3a')](_0x1821e6)){_0x66853e+=_[_0x94dd('0x3b')](_0x1821e6)+':\x20'+_0x4af93c[_0x1821e6]+'\x0a';}}}}if(_0x401e28){this['imap'][_0x94dd('0x10')]();}else{this['emit'](_0x94dd('0x37'),_0x66853e);this['emit'](_0x94dd('0x10'));}};module[_0x94dd('0x3c')]=EmailImap; \ No newline at end of file +var _0x9ba5=['randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','email','mailbox','INBOX','getAccount','account','once','ready','handleReady','bind','end','handleEnd','error','connect','inherits','connTimeout','authTimeout','authentication','user','password','host','port','tls','autotls','required','getHost','service','prototype','openBox','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','handleCloseBox','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','parser','closeBox','stringify','textCode','hasOwnProperty','exports','path','util','imap','lodash'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x9ba5,0x146));var _0x59ba=function(_0x2261ce,_0x9ed8b6){_0x2261ce=_0x2261ce-0x0;var _0x524640=_0x9ba5[_0x2261ce];return _0x524640;};'use strict';var fs=require('fs');var path=require(_0x59ba('0x0'));var util=require(_0x59ba('0x1'));var Imap=require(_0x59ba('0x2'));var _=require(_0x59ba('0x3'));var rs=require(_0x59ba('0x4'));var simpleParser=require(_0x59ba('0x5'))[_0x59ba('0x6')];var Iconv=require(_0x59ba('0x7'))[_0x59ba('0x8')];var EventEmitter=require(_0x59ba('0x9'))[_0x59ba('0xa')];var utils=require(_0x59ba('0xb'));var logger=require(_0x59ba('0xc'))(_0x59ba('0xd'));function EmailImap(_0x2c6289,_0x423888){this[_0x59ba('0xe')]=_0x59ba('0xf');this['account']=this[_0x59ba('0x10')](_0x2c6289,_0x423888);this[_0x59ba('0x2')]=new Imap(this[_0x59ba('0x11')]);this[_0x59ba('0x2')][_0x59ba('0x12')](_0x59ba('0x13'),this[_0x59ba('0x14')][_0x59ba('0x15')](this));this[_0x59ba('0x2')][_0x59ba('0x12')](_0x59ba('0x16'),this[_0x59ba('0x17')][_0x59ba('0x15')](this));this[_0x59ba('0x2')]['on'](_0x59ba('0x18'),this['handleError'][_0x59ba('0x15')](this));this[_0x59ba('0x2')][_0x59ba('0x19')]();}util[_0x59ba('0x1a')](EmailImap,EventEmitter);EmailImap['prototype'][_0x59ba('0x10')]=function(_0x57a5bb,_0x583c55){var _0x6a1cf0={'connTimeout':_0x57a5bb[_0x59ba('0x1b')]?_0x57a5bb['connTimeout']*0x3e8:0x2710,'authTimeout':_0x57a5bb[_0x59ba('0x1c')]?_0x57a5bb[_0x59ba('0x1c')]*0x3e8:0x1388};if(_['isNil'](_0x57a5bb['service'])){if(_0x57a5bb[_0x59ba('0x1d')]){_0x6a1cf0['user']=_0x57a5bb[_0x59ba('0x1e')];_0x6a1cf0[_0x59ba('0x1f')]=_0x57a5bb[_0x59ba('0x1f')];}_0x6a1cf0[_0x59ba('0x20')]=_0x57a5bb[_0x59ba('0x20')];_0x6a1cf0[_0x59ba('0x21')]=_0x57a5bb['port']||0x3e1;if(_0x57a5bb[_0x59ba('0x22')]){_0x6a1cf0[_0x59ba('0x22')]=!![];}else{_0x6a1cf0[_0x59ba('0x22')]=![];_0x6a1cf0[_0x59ba('0x23')]=_0x59ba('0x24');}}else{_0x6a1cf0[_0x59ba('0x1e')]=_0x57a5bb[_0x59ba('0x1e')];_0x6a1cf0[_0x59ba('0x1f')]=_0x57a5bb[_0x59ba('0x1f')];_0x6a1cf0[_0x59ba('0x20')]=utils[_0x59ba('0x25')](_0x57a5bb[_0x59ba('0x26')]);_0x6a1cf0[_0x59ba('0x21')]=0x3e1;_0x6a1cf0[_0x59ba('0x22')]=!![];}_0x6a1cf0['email']=_0x583c55||_0x57a5bb[_0x59ba('0x1e')]||'anonymous@xcally.com';return _0x6a1cf0;};EmailImap[_0x59ba('0x27')][_0x59ba('0x14')]=function(){this[_0x59ba('0x2')][_0x59ba('0x28')](this[_0x59ba('0xe')],![],this['handleOpenBox'][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')]['handleOpenBox']=function(_0x24970e,_0x2d7b1f){if(_0x24970e){this[_0x59ba('0x29')](_0x24970e,!![]);}else{this[_0x59ba('0x2a')](_0x59ba('0x2b'),_0x2d7b1f);this[_0x59ba('0x2c')]();}};EmailImap[_0x59ba('0x27')]['handleCloseBox']=function(_0xe84481){if(_0xe84481){this[_0x59ba('0x29')](_0xe84481,!![]);}else{this[_0x59ba('0x2')][_0x59ba('0x16')]();}};EmailImap['prototype'][_0x59ba('0x2c')]=function(){this[_0x59ba('0x2')][_0x59ba('0x2d')]([_0x59ba('0x2e')],this[_0x59ba('0x2f')][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')][_0x59ba('0x2f')]=function(_0x5de4da,_0x5274f0){if(_0x5de4da){this[_0x59ba('0x29')](_0x5de4da,!![]);}else{if(_0x5274f0[_0x59ba('0x30')]){try{var _0x347ef8=this[_0x59ba('0x2')][_0x59ba('0x31')](_0x5274f0,{'bodies':'','markSeen':!![]});_0x347ef8['on'](_0x59ba('0x32'),this[_0x59ba('0x33')][_0x59ba('0x15')](this));_0x347ef8['once']('error',this['handleFetchError'][_0x59ba('0x15')](this));_0x347ef8[_0x59ba('0x12')](_0x59ba('0x16'),this[_0x59ba('0x34')][_0x59ba('0x15')](this));}catch(_0x4925aa){logger[_0x59ba('0x18')](_0x4925aa);}}else{this[_0x59ba('0x2')]['closeBox'](!![],this[_0x59ba('0x35')][_0x59ba('0x15')](this));}}};EmailImap[_0x59ba('0x27')][_0x59ba('0x33')]=function(_0xdfb7fe,_0x11d4c1){_0xdfb7fe['on'](_0x59ba('0x36'),this[_0x59ba('0x37')][_0x59ba('0x15')](this));_0xdfb7fe[_0x59ba('0x12')](_0x59ba('0x38'),this[_0x59ba('0x39')][_0x59ba('0x15')](this));_0xdfb7fe['once']('end',this[_0x59ba('0x3a')][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')][_0x59ba('0x37')]=function(_0x51c6b7,_0xafbf2d){simpleParser(_0x51c6b7,{'Iconv':Iconv},this[_0x59ba('0x3b')][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')][_0x59ba('0x39')]=function(_0x12352e){};EmailImap[_0x59ba('0x27')][_0x59ba('0x3a')]=function(){};EmailImap[_0x59ba('0x27')][_0x59ba('0x3b')]=function(_0x2ef0cc,_0x8f3cc9){if(_0x2ef0cc){logger[_0x59ba('0x18')](_0x2ef0cc);}else{var _0xf11bac=this;utils[_0x59ba('0x3c')](this[_0x59ba('0x11')],_0x8f3cc9,function(_0x3a85c8){_0xf11bac['emit']('email',_0x3a85c8);});}};EmailImap[_0x59ba('0x27')][_0x59ba('0x34')]=function(){this[_0x59ba('0x2')]['closeBox'](!![],this[_0x59ba('0x35')][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')]['handleFetchError']=function(_0x587866){this[_0x59ba('0x29')](_0x587866);this[_0x59ba('0x2')][_0x59ba('0x3d')](!![],this[_0x59ba('0x35')][_0x59ba('0x15')](this));};EmailImap[_0x59ba('0x27')][_0x59ba('0x17')]=function(){this[_0x59ba('0x2a')](_0x59ba('0x16'));};EmailImap[_0x59ba('0x27')][_0x59ba('0x29')]=function(_0x1516bc,_0x1e2a97){logger[_0x59ba('0x18')]('handleError',this[_0x59ba('0x11')][_0x59ba('0xd')],JSON[_0x59ba('0x3e')](_0x1516bc));var _0x44451e='';if(_0x1516bc){if(_0x1516bc[_0x59ba('0x3f')]){_0x44451e=_0x1516bc[_0x59ba('0x3f')];}else{for(var _0x47676e in _0x1516bc){if(_0x1516bc[_0x59ba('0x40')](_0x47676e)){_0x44451e+=_['upperFirst'](_0x47676e)+':\x20'+_0x1516bc[_0x47676e]+'\x0a';}}}}if(_0x1e2a97){this[_0x59ba('0x2')]['end']();}else{this[_0x59ba('0x2a')]('error',_0x44451e);this['emit']('end');}};module[_0x59ba('0x41')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 6de78df..f34e600 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 _0x7a50=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','bluebird','nodemailer-plugin-inline-base64','prototype','send','createTransport','use'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x7a50,0x158));var _0x07a5=function(_0x5483f7,_0x61e068){_0x5483f7=_0x5483f7-0x0;var _0x48065c=_0x7a50[_0x5483f7];return _0x48065c;};'use strict';var nodemailer=require(_0x07a5('0x0'));var BPromise=require(_0x07a5('0x1'));var inlineBase64=require(_0x07a5('0x2'));function EmailSmtp(){}EmailSmtp[_0x07a5('0x3')][_0x07a5('0x4')]=function(_0xedf050,_0x4ebb35){return new BPromise(function(_0x24b0e3,_0x56b2d2){var _0x53c9ac=nodemailer[_0x07a5('0x5')](_0xedf050);_0x53c9ac[_0x07a5('0x6')](_0x07a5('0x7'),inlineBase64());_0x53c9ac[_0x07a5('0x8')](_0x4ebb35,function(_0x1ca36c,_0x4a33d9){if(_0x1ca36c){_0x56b2d2(_0x1ca36c[_0x07a5('0x9')]());}else{_0x24b0e3(_0x4a33d9);}});});};EmailSmtp['prototype'][_0x07a5('0xa')]=function(_0x63e794){return new BPromise(function(_0x5be63e,_0x53fdaf){var _0x3062c2=nodemailer['createTransport'](_0x63e794);_0x3062c2[_0x07a5('0xa')](function(_0x46d622,_0x32b049){if(_0x46d622){_0x53fdaf(_0x46d622[_0x07a5('0x9')]());}else{if(_0x32b049){_0x5be63e(_0x32b049);}else{_0x53fdaf(_0x07a5('0xb'));}}});});};module[_0x07a5('0xc')]=EmailSmtp; \ No newline at end of file +var _0xe289=['toString','verify','nodemailer','bluebird','prototype','send','createTransport','use','compile','sendMail'];(function(_0x577519,_0x346daf){var _0x5b12f7=function(_0x4aecb6){while(--_0x4aecb6){_0x577519['push'](_0x577519['shift']());}};_0x5b12f7(++_0x346daf);}(_0xe289,0x156));var _0x9e28=function(_0x1b2a4c,_0x5e55be){_0x1b2a4c=_0x1b2a4c-0x0;var _0x395fb7=_0xe289[_0x1b2a4c];return _0x395fb7;};'use strict';var nodemailer=require(_0x9e28('0x0'));var BPromise=require(_0x9e28('0x1'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x9e28('0x2')][_0x9e28('0x3')]=function(_0x244934,_0x4fe702){return new BPromise(function(_0x1838fd,_0x403011){var _0x1530c2=nodemailer[_0x9e28('0x4')](_0x244934);_0x1530c2[_0x9e28('0x5')](_0x9e28('0x6'),inlineBase64());_0x1530c2[_0x9e28('0x7')](_0x4fe702,function(_0x3b44c1,_0x4712fd){if(_0x3b44c1){_0x403011(_0x3b44c1[_0x9e28('0x8')]());}else{_0x1838fd(_0x4712fd);}});});};EmailSmtp['prototype'][_0x9e28('0x9')]=function(_0x1b3389){return new BPromise(function(_0x393d1d,_0xf23f69){var _0xf62b0e=nodemailer[_0x9e28('0x4')](_0x1b3389);_0xf62b0e[_0x9e28('0x9')](function(_0x8421e7,_0x43098c){if(_0x8421e7){_0xf23f69(_0x8421e7[_0x9e28('0x8')]());}else{if(_0x43098c){_0x393d1d(_0x43098c);}else{_0xf23f69('Not\x20verifired');}}});});};module['exports']=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 6ab168e..359e88d 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 _0x090d=['Data','getHost','gmail','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','email','../../../config/environment','head','value','address','generate','@xcally.com','name','split','join','Anonymous','length','isEmpty','anonymous','html','replace','body','textAsHtml','message','originTo','originCc','includes','bcc','attachments','attachment-','format','%s-%s','now','root','server/files/attachments/','writeFileSync','push','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','content','BodyHTML','

Empty\x20message

','Attachments','Title'];(function(_0x71689e,_0x3a49f1){var _0x2c4c81=function(_0x306f36){while(--_0x306f36){_0x71689e['push'](_0x71689e['shift']());}};_0x2c4c81(++_0x3a49f1);}(_0x090d,0xc3));var _0xd090=function(_0x490f7f,_0x2ed5ff){_0x490f7f=_0x490f7f-0x0;var _0x1a9042=_0x090d[_0x490f7f];return _0x1a9042;};'use strict';var _=require(_0xd090('0x0'));var moment=require(_0xd090('0x1'));var random=require(_0xd090('0x2'));var fs=require('fs');var path=require(_0xd090('0x3'));var util=require(_0xd090('0x4'));var tnef=require(_0xd090('0x5'));var logger=require('../../../config/logger')(_0xd090('0x6'));var config=require(_0xd090('0x7'));function getAddress(_0x6e99cf){var _0x4bcc22=_[_0xd090('0x8')](_0x6e99cf[_0xd090('0x9')]);return _0x4bcc22&&_0x4bcc22[_0xd090('0xa')]?_0x4bcc22['address']:'anonymous'+random[_0xd090('0xb')](0x6)+_0xd090('0xc');}function getFirstName(_0x3c8c69){var _0x35311a=_['head'](_0x3c8c69[_0xd090('0x9')]);if(_0x35311a&&_0x35311a['name']){var _0x53c4b4=_0x35311a[_0xd090('0xd')][_0xd090('0xe')](/\s+/);return _0x53c4b4['length']?_0x53c4b4['slice'](0x0,-0x1)[_0xd090('0xf')]('\x20'):_0x35311a[_0xd090('0xd')];}return _0xd090('0x10');}function getLastName(_0x57b49d){var _0x1e3501=_[_0xd090('0x8')](_0x57b49d[_0xd090('0x9')]);if(_0x1e3501&&_0x1e3501[_0xd090('0xd')]){var _0x493384=_0x1e3501[_0xd090('0xd')]['split'](/\s+/);return _0x493384[_0xd090('0x11')]>0x1?_0x493384['pop']():'';}return'';}function getMails(_0x5bd1f7,_0x3288dd){var _0x4e25f5='';for(var _0x1a4f75=0x0;_0x1a4f75<_0x3288dd[_0xd090('0x9')][_0xd090('0x11')];_0x1a4f75+=0x1){if(_0x3288dd[_0xd090('0x9')][_0x1a4f75]['address']!==_0x5bd1f7){if(!_[_0xd090('0x12')](_0x4e25f5)){_0x4e25f5+=',';}_0x4e25f5+=_0x3288dd['value'][_0x1a4f75][_0xd090('0xd')]||_0x3288dd[_0xd090('0x9')][_0x1a4f75][_0xd090('0xa')]||'';_0x4e25f5+='\x20<';_0x4e25f5+=_0x3288dd[_0xd090('0x9')][_0x1a4f75]['address']?_0x3288dd[_0xd090('0x9')][_0x1a4f75][_0xd090('0xa')]:_0xd090('0x13')+random['generate'](0x6)+'@xcally.com';_0x4e25f5+='>';}}return _0x4e25f5;}function parseEmail(_0x30e069,_0x158519,_0x1c8957){if(_0x158519[_0xd090('0x14')]){var _0x23ac71=/)<[^<]*)*<\/script>/gi;while(_0x23ac71['test'](_0x158519[_0xd090('0x14')])){_0x158519[_0xd090('0x14')]=_0x158519[_0xd090('0x14')][_0xd090('0x15')](_0x23ac71,'');}_0x1c8957[_0xd090('0x16')]=_0x158519[_0xd090('0x14')];}else{_0x1c8957['body']=_0x158519[_0xd090('0x17')];}if(_0x1c8957[_0xd090('0x16')]){_0x1c8957['body']=_0x1c8957[_0xd090('0x16')][_0xd090('0x15')](/Empty\x20message

','Attachments','push','Title','Data','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','@xcally.com','name','slice','join','Anonymous','split','length','isEmpty','generate','html','test','replace','body','textAsHtml','0x1?_0x39d28e['pop']():'';}return'';}function getMails(_0x2fbf10,_0x15dfc1){var _0x53902d='';for(var _0x1cac37=0x0;_0x1cac37<_0x15dfc1[_0xb28d('0xa')]['length'];_0x1cac37+=0x1){if(_0x15dfc1[_0xb28d('0xa')][_0x1cac37]['address']!==_0x2fbf10){if(!_[_0xb28d('0x14')](_0x53902d)){_0x53902d+=',';}_0x53902d+=_0x15dfc1['value'][_0x1cac37][_0xb28d('0xe')]||_0x15dfc1[_0xb28d('0xa')][_0x1cac37][_0xb28d('0xb')]||'';_0x53902d+='\x20<';_0x53902d+=_0x15dfc1[_0xb28d('0xa')][_0x1cac37][_0xb28d('0xb')]?_0x15dfc1[_0xb28d('0xa')][_0x1cac37][_0xb28d('0xb')]:_0xb28d('0xc')+random[_0xb28d('0x15')](0x6)+_0xb28d('0xd');_0x53902d+='>';}}return _0x53902d;}function parseEmail(_0x3ae9c0,_0x18771a,_0x20ba72){if(_0x18771a[_0xb28d('0x16')]){var _0x4c8414=/)<[^<]*)*<\/script>/gi;while(_0x4c8414[_0xb28d('0x17')](_0x18771a[_0xb28d('0x16')])){_0x18771a['html']=_0x18771a['html'][_0xb28d('0x18')](_0x4c8414,'');}_0x20ba72[_0xb28d('0x19')]=_0x18771a[_0xb28d('0x16')];}else{_0x20ba72[_0xb28d('0x19')]=_0x18771a[_0xb28d('0x1a')];}if(_0x20ba72[_0xb28d('0x19')]){_0x20ba72[_0xb28d('0x19')]=_0x20ba72[_0xb28d('0x19')]['replace'](/0x0){if(this[_0x33d7bd+_0xab49('0x22')]>0x0&&this[_0x33d7bd+'CurrentCapacity']>=this[_0x33d7bd+_0xab49('0x22')]){return _0xab49('0x23');}else{return'working';}}else{return'idle';}};Agent[_0xab49('0x24')]['updateRealtime']=function(){var _0x32a1d1=['mail',_0xab49('0x25'),_0xab49('0x26'),_0xab49('0x27'),'sms'];for(var _0x2bf8e0=0x0;_0x2bf8e0<_0x32a1d1['length'];_0x2bf8e0+=0x1){var _0x322153=this[_0xab49('0x21')](_0x32a1d1[_0x2bf8e0]);if(this[_0x32a1d1[_0x2bf8e0]+'Status']!==_0x322153){this[_0x32a1d1[_0x2bf8e0]+_0xab49('0x28')]=_[_0xab49('0x29')](moment()['format']('x'));}this[_0x32a1d1[_0x2bf8e0]+'Status']=_0x322153;}var _0x11446b={'id':this['id'],'name':this[_0xab49('0x7')],'online':this[_0xab49('0x8')],'voicePause':this['voicePause'],'chatPause':this[_0xab49('0xa')],'mailPause':this[_0xab49('0xb')],'smsPause':this['smsPause'],'faxPause':this[_0xab49('0xc')],'openchannelPause':this[_0xab49('0xe')],'chatStatus':this[_0xab49('0xf')],'chatStatusTime':this['chatStatusTime'],'chatCapacity':this[_0xab49('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xab49('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xab49('0x15')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xab49('0x17')],'faxStatusTime':this[_0xab49('0x2a')],'faxCapacity':this[_0xab49('0x18')],'faxCurrentCapacity':this[_0xab49('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xab49('0x2b')],'smsCapacity':this[_0xab49('0x1b')],'smsCurrentCapacity':this[_0xab49('0x1c')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xab49('0x2c')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xab49('0x1f')],'busy':this['busy'],'busyQueue':this['busyQueue']};var _0x553867=md5(JSON[_0xab49('0x2d')](_0x11446b));if(this['md5']!==_0x553867){this[_0xab49('0x2')]=_0x553867;io[_0xab49('0x2e')](_0xab49('0x2f'),_0x11446b);}};module['exports']=Agent; \ No newline at end of file +var _0xf45e=['working','idle','chat','openchannel','fax','sms','length','Status','toNumber','format','chatStatusTime','smsStatus','smsCurrentCapacity','openchannelCurrentCapacity','busy','stringify','exports','lodash','md5','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','faxStatus','faxStatusTime','faxCurrentCapacity','smsStatusTime','smsCapacity','openchannelStatusTime','openchannelCapacity','busyQueue','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity'];(function(_0x519d85,_0x1fa8ed){var _0x24b504=function(_0x458715){while(--_0x458715){_0x519d85['push'](_0x519d85['shift']());}};_0x24b504(++_0x1fa8ed);}(_0xf45e,0x115));var _0xef45=function(_0x392127,_0x5efe59){_0x392127=_0x392127-0x0;var _0x148787=_0xf45e[_0x392127];return _0x148787;};'use strict';var _=require(_0xef45('0x0'));var moment=require('moment');var md5=require(_0xef45('0x1'));var Redis=require('ioredis');var config=require(_0xef45('0x2'));config[_0xef45('0x3')]=_[_0xef45('0x4')](config[_0xef45('0x3')],{'host':_0xef45('0x5'),'port':0x18eb});var io=require(_0xef45('0x6'))(new Redis(config[_0xef45('0x3')]));function Agent(_0x116068){this['id']=_0x116068['id']||0x0;this[_0xef45('0x7')]=_0x116068[_0xef45('0x7')]||'';this[_0xef45('0x8')]=_0x116068[_0xef45('0x8')]||!![];this[_0xef45('0x9')]=_0x116068[_0xef45('0x9')]||![];this[_0xef45('0xa')]=_0x116068[_0xef45('0xa')]||![];this[_0xef45('0xb')]=_0x116068[_0xef45('0xb')]||![];this[_0xef45('0xc')]=_0x116068['faxPause']||![];this[_0xef45('0xd')]=_0x116068[_0xef45('0xd')]||![];this[_0xef45('0xe')]=_0x116068[_0xef45('0xe')]||![];this[_0xef45('0xf')]=_0xef45('0x10');this['chatStatusTime']=0x0;this[_0xef45('0x11')]=_0x116068[_0xef45('0x11')]||0x0;this[_0xef45('0x12')]=0x0;this[_0xef45('0x13')]=_0xef45('0x10');this['mailStatusTime']=0x0;this['mailCapacity']=_0x116068[_0xef45('0x14')]||0x0;this['mailCurrentCapacity']=0x0;this[_0xef45('0x15')]=_0xef45('0x10');this[_0xef45('0x16')]=0x0;this['faxCapacity']=_0x116068['faxCapacity']||0x0;this[_0xef45('0x17')]=0x0;this['smsStatus']=_0xef45('0x10');this[_0xef45('0x18')]=0x0;this[_0xef45('0x19')]=_0x116068[_0xef45('0x19')]||0x0;this['smsCurrentCapacity']=0x0;this['openchannelStatus']=_0xef45('0x10');this[_0xef45('0x1a')]=0x0;this[_0xef45('0x1b')]=_0x116068[_0xef45('0x1b')]||0x0;this['openchannelCurrentCapacity']=0x0;this['busy']=![];this[_0xef45('0x1c')]=undefined;this[_0xef45('0x1')]='';this[_0xef45('0x1d')]();}Agent[_0xef45('0x1e')][_0xef45('0x1f')]=function(_0xde347f){if(this[_0xde347f+_0xef45('0x20')]>0x0){if(this[_0xde347f+'Capacity']>0x0&&this[_0xde347f+_0xef45('0x20')]>=this[_0xde347f+_0xef45('0x21')]){return _0xef45('0x22');}else{return _0xef45('0x23');}}else{return _0xef45('0x24');}};Agent['prototype'][_0xef45('0x1d')]=function(){var _0x54a75d=['mail',_0xef45('0x25'),_0xef45('0x26'),_0xef45('0x27'),_0xef45('0x28')];for(var _0x839eff=0x0;_0x839eff<_0x54a75d[_0xef45('0x29')];_0x839eff+=0x1){var _0x315777=this['getChannelStatus'](_0x54a75d[_0x839eff]);if(this[_0x54a75d[_0x839eff]+_0xef45('0x2a')]!==_0x315777){this[_0x54a75d[_0x839eff]+'StatusTime']=_[_0xef45('0x2b')](moment()[_0xef45('0x2c')]('x'));}this[_0x54a75d[_0x839eff]+'Status']=_0x315777;}var _0x46e423={'id':this['id'],'name':this[_0xef45('0x7')],'online':this['online'],'voicePause':this[_0xef45('0x9')],'chatPause':this['chatPause'],'mailPause':this['mailPause'],'smsPause':this['smsPause'],'faxPause':this['faxPause'],'openchannelPause':this[_0xef45('0xe')],'chatStatus':this[_0xef45('0xf')],'chatStatusTime':this[_0xef45('0x2d')],'chatCapacity':this[_0xef45('0x11')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xef45('0x13')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xef45('0x14')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xef45('0x15')],'faxStatusTime':this['faxStatusTime'],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xef45('0x17')],'smsStatus':this[_0xef45('0x2e')],'smsStatusTime':this[_0xef45('0x18')],'smsCapacity':this[_0xef45('0x19')],'smsCurrentCapacity':this[_0xef45('0x2f')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this['openchannelStatusTime'],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0xef45('0x30')],'busy':this[_0xef45('0x31')],'busyQueue':this[_0xef45('0x1c')]};var _0x3039b0=md5(JSON[_0xef45('0x32')](_0x46e423));if(this[_0xef45('0x1')]!==_0x3039b0){this[_0xef45('0x1')]=_0x3039b0;io['emit']('user:save',_0x46e423);}};module[_0xef45('0x33')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index e1de0b1..e2ce659 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 _0xf505=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','updateRouting','updateRealtime','prototype','mapAgentsId','_rr','map','loggedIn','length','online','chatPause','paused','available','stringify','format','chat:queue:%s','chat_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment'];(function(_0x21d742,_0x10f6cc){var _0x522720=function(_0x9a876e){while(--_0x9a876e){_0x21d742['push'](_0x21d742['shift']());}};_0x522720(++_0x10f6cc);}(_0xf505,0x9b));var _0x5f50=function(_0x1dd2cc,_0x36ddfe){_0x1dd2cc=_0x1dd2cc-0x0;var _0x305d8e=_0xf505[_0x1dd2cc];return _0x305d8e;};'use strict';var _=require(_0x5f50('0x0'));var md5=require(_0x5f50('0x1'));var util=require(_0x5f50('0x2'));var Redis=require(_0x5f50('0x3'));var config=require(_0x5f50('0x4'));config[_0x5f50('0x5')]=_[_0x5f50('0x6')](config['redis'],{'host':_0x5f50('0x7'),'port':0x18eb});var io=require(_0x5f50('0x8'))(new Redis(config[_0x5f50('0x5')]));function ChatQueue(_0x520c51){this['id']=_0x520c51['id']||0x0;this[_0x5f50('0x9')]=_0x520c51[_0x5f50('0x9')]||'';this[_0x5f50('0xa')]=_0x520c51[_0x5f50('0xa')]||0xa;this[_0x5f50('0xb')]=_0x520c51[_0x5f50('0xb')]||_0x5f50('0xc');this['Agents']=_0x520c51[_0x5f50('0xd')];this['mapAgentsId']={};this[_0x5f50('0xe')]=0x0;this['md5']='';this[_0x5f50('0xf')]();this[_0x5f50('0x10')]();}ChatQueue[_0x5f50('0x11')][_0x5f50('0xf')]=function(){var _0x29661f=this[_0x5f50('0x12')][_0x5f50('0x13')];this['mapAgentsId']=_[_0x5f50('0x14')](this['Agents'],'id');this['mapAgentsId'][_0x5f50('0x13')]=_0x29661f;};ChatQueue['prototype'][_0x5f50('0x10')]=function(){this[_0x5f50('0x15')]=0x0;this['paused']=0x0;for(var _0x1d1654=0x0;_0x1d1654=0x0?this[_0x5f50('0x1a')]:0x0;var _0x1bd046={'id':this['id'],'available':this[_0x5f50('0x1a')],'loggedIn':this[_0x5f50('0x15')],'name':this['name'],'paused':this[_0x5f50('0x19')],'waiting':this[_0x5f50('0xe')]};var _0x3e0d4b=md5(JSON[_0x5f50('0x1b')](_0x1bd046));if(this[_0x5f50('0x1')]!==_0x3e0d4b){this[_0x5f50('0x1')]=_0x3e0d4b;io['to'](util[_0x5f50('0x1c')](_0x5f50('0x1d'),_0x1bd046[_0x5f50('0x9')]))['emit'](_0x5f50('0x1e'),_0x1bd046);}};module[_0x5f50('0x1f')]=ChatQueue; \ No newline at end of file +var _0x5a6a=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','loggedIn','length','online','available','paused','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis'];(function(_0x5da83e,_0x243590){var _0x7de022=function(_0xd1e3b2){while(--_0xd1e3b2){_0x5da83e['push'](_0x5da83e['shift']());}};_0x7de022(++_0x243590);}(_0x5a6a,0x83));var _0xa5a6=function(_0x58abc8,_0x440ea0){_0x58abc8=_0x58abc8-0x0;var _0x23c7de=_0x5a6a[_0x58abc8];return _0x23c7de;};'use strict';var _=require(_0xa5a6('0x0'));var md5=require(_0xa5a6('0x1'));var util=require(_0xa5a6('0x2'));var Redis=require(_0xa5a6('0x3'));var config=require(_0xa5a6('0x4'));config['redis']=_['defaults'](config[_0xa5a6('0x5')],{'host':_0xa5a6('0x6'),'port':0x18eb});var io=require(_0xa5a6('0x7'))(new Redis(config[_0xa5a6('0x5')]));function ChatQueue(_0x2331b0){this['id']=_0x2331b0['id']||0x0;this[_0xa5a6('0x8')]=_0x2331b0['name']||'';this[_0xa5a6('0x9')]=_0x2331b0[_0xa5a6('0x9')]||0xa;this[_0xa5a6('0xa')]=_0x2331b0[_0xa5a6('0xa')]||'beepall';this[_0xa5a6('0xb')]=_0x2331b0[_0xa5a6('0xb')];this[_0xa5a6('0xc')]={};this[_0xa5a6('0xd')]=0x0;this[_0xa5a6('0x1')]='';this['updateRouting']();this[_0xa5a6('0xe')]();}ChatQueue[_0xa5a6('0xf')][_0xa5a6('0x10')]=function(){var _0x32ba94=this[_0xa5a6('0xc')][_0xa5a6('0x11')];this[_0xa5a6('0xc')]=_['map'](this[_0xa5a6('0xb')],'id');this['mapAgentsId'][_0xa5a6('0x11')]=_0x32ba94;};ChatQueue[_0xa5a6('0xf')]['updateRealtime']=function(){this[_0xa5a6('0x12')]=0x0;this['paused']=0x0;for(var _0x43e036=0x0;_0x43e036=0x0?this[_0xa5a6('0x15')]:0x0;var _0x2b79ad={'id':this['id'],'available':this[_0xa5a6('0x15')],'loggedIn':this[_0xa5a6('0x12')],'name':this['name'],'paused':this['paused'],'waiting':this[_0xa5a6('0xd')]};var _0x401db7=md5(JSON['stringify'](_0x2b79ad));if(this[_0xa5a6('0x1')]!==_0x401db7){this[_0xa5a6('0x1')]=_0x401db7;io['to'](util[_0xa5a6('0x17')](_0xa5a6('0x18'),_0x2b79ad[_0xa5a6('0x8')]))[_0xa5a6('0x19')]('chat_queue:save',_0x2b79ad);}};module[_0xa5a6('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 7221567..b374d7d 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(_0x2084c4,_0x34c9a5){var _0x3f1880=function(_0x59c7c1){while(--_0x59c7c1){_0x2084c4['push'](_0x2084c4['shift']());}};_0x3f1880(++_0x34c9a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xa9e0[_0x297fd3];return _0x2af381;};'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(_0xc2f6df,_0x3d8598){var _0x5b427b=function(_0x26bdb7){while(--_0x26bdb7){_0xc2f6df['push'](_0xc2f6df['shift']());}};_0x5b427b(++_0x3d8598);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'use strict';var _=require(_0x0a9e('0x0'));var md5=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var Redis=require('ioredis');var config=require('../../../config/environment');config[_0x0a9e('0x3')]=_['defaults'](config[_0x0a9e('0x3')],{'host':_0x0a9e('0x4'),'port':0x18eb});var io=require(_0x0a9e('0x5'))(new Redis(config[_0x0a9e('0x3')]));function FaxQueue(_0x981158){this['id']=_0x981158['id']||0x0;this['name']=_0x981158[_0x0a9e('0x6')]||'';this[_0x0a9e('0x7')]=_0x981158[_0x0a9e('0x7')]||0xa;this['strategy']=_0x981158['strategy']||_0x0a9e('0x8');this['Agents']=_0x981158['Agents'];this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]=0x0;this[_0x0a9e('0x1')]='';this[_0x0a9e('0xb')]();this[_0x0a9e('0xc')]();}FaxQueue[_0x0a9e('0xd')]['updateRouting']=function(){var _0x50dfb2=this['mapAgentsId']['_rr'];this[_0x0a9e('0x9')]=_[_0x0a9e('0xe')](this[_0x0a9e('0xf')],'id');this[_0x0a9e('0x9')][_0x0a9e('0x10')]=_0x50dfb2;};FaxQueue[_0x0a9e('0xd')]['updateRealtime']=function(){this[_0x0a9e('0x11')]=0x0;this[_0x0a9e('0x12')]=0x0;for(var _0x2b4227=0x0;_0x2b4227=0x0?this[_0x0a9e('0x15')]:0x0;var _0x478723={'id':this['id'],'available':this[_0x0a9e('0x15')],'loggedIn':this[_0x0a9e('0x11')],'name':this[_0x0a9e('0x6')],'paused':this[_0x0a9e('0x12')],'waiting':this[_0x0a9e('0xa')]};var _0x20559e=md5(JSON[_0x0a9e('0x16')](_0x478723));if(this[_0x0a9e('0x1')]!==_0x20559e){this[_0x0a9e('0x1')]=_0x20559e;io['to'](util[_0x0a9e('0x17')]('fax:queue:%s',_0x478723[_0x0a9e('0x6')]))[_0x0a9e('0x18')]('fax_queue:save',_0x478723);}};module[_0x0a9e('0x19')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index eabc6e9..43231b7 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 _0x2cab=['name','Intervals','exports'];(function(_0xe84953,_0xa2cc7){var _0x2f486f=function(_0x4a0a09){while(--_0x4a0a09){_0xe84953['push'](_0xe84953['shift']());}};_0x2f486f(++_0xa2cc7);}(_0x2cab,0x1ce));var _0xb2ca=function(_0x3b5424,_0xc089e2){_0x3b5424=_0x3b5424-0x0;var _0x16a0d0=_0x2cab[_0x3b5424];return _0x16a0d0;};'use strict';function Interval(_0x7f40e4){this['id']=_0x7f40e4['id']||0x0;this[_0xb2ca('0x0')]=_0x7f40e4[_0xb2ca('0x0')]||'';this[_0xb2ca('0x1')]=_0x7f40e4[_0xb2ca('0x1')]||{};}module[_0xb2ca('0x2')]=Interval; \ No newline at end of file +var _0x2375=['Intervals','exports','name'];(function(_0x336e64,_0x27778d){var _0x3ccf12=function(_0x3091d7){while(--_0x3091d7){_0x336e64['push'](_0x336e64['shift']());}};_0x3ccf12(++_0x27778d);}(_0x2375,0x77));var _0x5237=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x2375[_0xefd519];return _0x4bb882;};'use strict';function Interval(_0x596438){this['id']=_0x596438['id']||0x0;this[_0x5237('0x0')]=_0x596438[_0x5237('0x0')]||'';this['Intervals']=_0x596438[_0x5237('0x1')]||{};}module[_0x5237('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 143834f..a79aa0c 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 _0x05e2=['mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x3483b7,_0xc5f15e){var _0x48707b=function(_0x3b02c2){while(--_0x3b02c2){_0x3483b7['push'](_0x3483b7['shift']());}};_0x48707b(++_0xc5f15e);}(_0x05e2,0x179));var _0x205e=function(_0xbc1a4b,_0x4dfbe4){_0xbc1a4b=_0xbc1a4b-0x0;var _0x108b87=_0x05e2[_0xbc1a4b];return _0x108b87;};'use strict';var _=require(_0x205e('0x0'));var md5=require(_0x205e('0x1'));var util=require(_0x205e('0x2'));var Redis=require(_0x205e('0x3'));var config=require(_0x205e('0x4'));config[_0x205e('0x5')]=_[_0x205e('0x6')](config[_0x205e('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x205e('0x7'))(new Redis(config[_0x205e('0x5')]));function MailQueue(_0x387d89){this['id']=_0x387d89['id']||0x0;this[_0x205e('0x8')]=_0x387d89[_0x205e('0x8')]||'';this[_0x205e('0x9')]=_0x387d89[_0x205e('0x9')]||0xa;this[_0x205e('0xa')]=_0x387d89['strategy']||_0x205e('0xb');this[_0x205e('0xc')]=_0x387d89[_0x205e('0xc')];this[_0x205e('0xd')]={};this[_0x205e('0xe')]=0x0;this[_0x205e('0x1')]='';this[_0x205e('0xf')]();this[_0x205e('0x10')]();}MailQueue['prototype'][_0x205e('0xf')]=function(){var _0x619bce=this[_0x205e('0xd')][_0x205e('0x11')];this[_0x205e('0xd')]=_['map'](this[_0x205e('0xc')],'id');this[_0x205e('0xd')][_0x205e('0x11')]=_0x619bce;};MailQueue[_0x205e('0x12')][_0x205e('0x10')]=function(){this[_0x205e('0x13')]=0x0;this[_0x205e('0x14')]=0x0;for(var _0x465f53=0x0;_0x465f53=0x0?this[_0x205e('0x17')]:0x0;var _0x25505f={'id':this['id'],'available':this['available'],'loggedIn':this[_0x205e('0x13')],'name':this[_0x205e('0x8')],'paused':this['paused'],'waiting':this[_0x205e('0xe')]};var _0x3f2ade=md5(JSON[_0x205e('0x18')](_0x25505f));if(this[_0x205e('0x1')]!==_0x3f2ade){this[_0x205e('0x1')]=_0x3f2ade;io['to'](util[_0x205e('0x19')](_0x205e('0x1a'),_0x25505f[_0x205e('0x8')]))[_0x205e('0x1b')](_0x205e('0x1c'),_0x25505f);}};module[_0x205e('0x1d')]=MailQueue; \ No newline at end of file +var _0x973f=['defaults','localhost','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','mailPause','available','stringify','format','mail:queue:%s','emit','mail_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis'];(function(_0x5d0c95,_0x232739){var _0x474940=function(_0x11554e){while(--_0x11554e){_0x5d0c95['push'](_0x5d0c95['shift']());}};_0x474940(++_0x232739);}(_0x973f,0x18d));var _0xf973=function(_0x4c440b,_0x3ea627){_0x4c440b=_0x4c440b-0x0;var _0x2d48cf=_0x973f[_0x4c440b];return _0x2d48cf;};'use strict';var _=require(_0xf973('0x0'));var md5=require(_0xf973('0x1'));var util=require(_0xf973('0x2'));var Redis=require(_0xf973('0x3'));var config=require(_0xf973('0x4'));config[_0xf973('0x5')]=_[_0xf973('0x6')](config['redis'],{'host':_0xf973('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xf973('0x5')]));function MailQueue(_0x3faef4){this['id']=_0x3faef4['id']||0x0;this[_0xf973('0x8')]=_0x3faef4[_0xf973('0x8')]||'';this['timeout']=_0x3faef4[_0xf973('0x9')]||0xa;this[_0xf973('0xa')]=_0x3faef4[_0xf973('0xa')]||_0xf973('0xb');this[_0xf973('0xc')]=_0x3faef4['Agents'];this[_0xf973('0xd')]={};this[_0xf973('0xe')]=0x0;this[_0xf973('0x1')]='';this[_0xf973('0xf')]();this[_0xf973('0x10')]();}MailQueue[_0xf973('0x11')]['updateRouting']=function(){var _0x120986=this[_0xf973('0xd')][_0xf973('0x12')];this[_0xf973('0xd')]=_[_0xf973('0x13')](this[_0xf973('0xc')],'id');this[_0xf973('0xd')][_0xf973('0x12')]=_0x120986;};MailQueue['prototype'][_0xf973('0x10')]=function(){this[_0xf973('0x14')]=0x0;this[_0xf973('0x15')]=0x0;for(var _0x1da223=0x0;_0x1da223=0x0?this[_0xf973('0x18')]:0x0;var _0x423247={'id':this['id'],'available':this['available'],'loggedIn':this[_0xf973('0x14')],'name':this[_0xf973('0x8')],'paused':this[_0xf973('0x15')],'waiting':this['waiting']};var _0x258c41=md5(JSON[_0xf973('0x19')](_0x423247));if(this[_0xf973('0x1')]!==_0x258c41){this[_0xf973('0x1')]=_0x258c41;io['to'](util[_0xf973('0x1a')](_0xf973('0x1b'),_0x423247['name']))[_0xf973('0x1c')](_0xf973('0x1d'),_0x423247);}};module[_0xf973('0x1e')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b138972..5bbbec2 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 _0x6438=['defaults','localhost','name','timeout','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','openchannelPause','available','stringify','format','openchannel:queue:%s','emit','exports','lodash','md5','util','ioredis','redis'];(function(_0x35af1a,_0x2c4ef0){var _0x5694e9=function(_0x34eaf1){while(--_0x34eaf1){_0x35af1a['push'](_0x35af1a['shift']());}};_0x5694e9(++_0x2c4ef0);}(_0x6438,0xe5));var _0x8643=function(_0x3fe7ad,_0x409418){_0x3fe7ad=_0x3fe7ad-0x0;var _0x5bf081=_0x6438[_0x3fe7ad];return _0x5bf081;};'use strict';var _=require(_0x8643('0x0'));var md5=require(_0x8643('0x1'));var util=require(_0x8643('0x2'));var Redis=require(_0x8643('0x3'));var config=require('../../../config/environment');config[_0x8643('0x4')]=_[_0x8643('0x5')](config['redis'],{'host':_0x8643('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function OpenchannelQueue(_0x3b21e4){this['id']=_0x3b21e4['id']||0x0;this['name']=_0x3b21e4[_0x8643('0x7')]||'';this[_0x8643('0x8')]=_0x3b21e4['timeout']||0xa;this['strategy']=_0x3b21e4['strategy']||'beepall';this[_0x8643('0x9')]=_0x3b21e4[_0x8643('0x9')];this[_0x8643('0xa')]={};this[_0x8643('0xb')]=0x0;this['md5']='';this[_0x8643('0xc')]();this[_0x8643('0xd')]();}OpenchannelQueue[_0x8643('0xe')]['updateRouting']=function(){var _0x48a417=this[_0x8643('0xa')]['_rr'];this[_0x8643('0xa')]=_[_0x8643('0xf')](this[_0x8643('0x9')],'id');this['mapAgentsId'][_0x8643('0x10')]=_0x48a417;};OpenchannelQueue[_0x8643('0xe')][_0x8643('0xd')]=function(){this[_0x8643('0x11')]=0x0;this[_0x8643('0x12')]=0x0;for(var _0x23230f=0x0;_0x23230f=0x0?this['available']:0x0;var _0xb7be9f={'id':this['id'],'available':this[_0x8643('0x14')],'loggedIn':this[_0x8643('0x11')],'name':this['name'],'paused':this[_0x8643('0x12')],'waiting':this[_0x8643('0xb')]};var _0x42d809=md5(JSON[_0x8643('0x15')](_0xb7be9f));if(this[_0x8643('0x1')]!==_0x42d809){this['md5']=_0x42d809;io['to'](util[_0x8643('0x16')](_0x8643('0x17'),_0xb7be9f['name']))[_0x8643('0x18')]('openchannel_queue:save',_0xb7be9f);}};module[_0x8643('0x19')]=OpenchannelQueue; \ No newline at end of file +var _0x0e90=['openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','length','online','openchannelPause','paused','available','stringify','format','openchannel:queue:%s','emit'];(function(_0x18fb16,_0x45edbc){var _0x147b0d=function(_0x5b1b00){while(--_0x5b1b00){_0x18fb16['push'](_0x18fb16['shift']());}};_0x147b0d(++_0x45edbc);}(_0x0e90,0xc2));var _0x00e9=function(_0x55db61,_0x42d5a9){_0x55db61=_0x55db61-0x0;var _0x1b4c51=_0x0e90[_0x55db61];return _0x1b4c51;};'use strict';var _=require(_0x00e9('0x0'));var md5=require(_0x00e9('0x1'));var util=require(_0x00e9('0x2'));var Redis=require(_0x00e9('0x3'));var config=require(_0x00e9('0x4'));config[_0x00e9('0x5')]=_[_0x00e9('0x6')](config[_0x00e9('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x00e9('0x7'))(new Redis(config[_0x00e9('0x5')]));function OpenchannelQueue(_0x283bca){this['id']=_0x283bca['id']||0x0;this['name']=_0x283bca[_0x00e9('0x8')]||'';this[_0x00e9('0x9')]=_0x283bca[_0x00e9('0x9')]||0xa;this['strategy']=_0x283bca[_0x00e9('0xa')]||_0x00e9('0xb');this[_0x00e9('0xc')]=_0x283bca[_0x00e9('0xc')];this[_0x00e9('0xd')]={};this[_0x00e9('0xe')]=0x0;this[_0x00e9('0x1')]='';this[_0x00e9('0xf')]();this[_0x00e9('0x10')]();}OpenchannelQueue['prototype'][_0x00e9('0xf')]=function(){var _0x5398f1=this['mapAgentsId'][_0x00e9('0x11')];this['mapAgentsId']=_[_0x00e9('0x12')](this['Agents'],'id');this['mapAgentsId'][_0x00e9('0x11')]=_0x5398f1;};OpenchannelQueue[_0x00e9('0x13')]['updateRealtime']=function(){this[_0x00e9('0x14')]=0x0;this['paused']=0x0;for(var _0x4e9696=0x0;_0x4e9696=0x0?this[_0x00e9('0x19')]:0x0;var _0x5791f2={'id':this['id'],'available':this['available'],'loggedIn':this[_0x00e9('0x14')],'name':this[_0x00e9('0x8')],'paused':this['paused'],'waiting':this['waiting']};var _0x31507a=md5(JSON[_0x00e9('0x1a')](_0x5791f2));if(this[_0x00e9('0x1')]!==_0x31507a){this['md5']=_0x31507a;io['to'](util[_0x00e9('0x1b')](_0x00e9('0x1c'),_0x5791f2[_0x00e9('0x8')]))[_0x00e9('0x1d')](_0x00e9('0x1e'),_0x5791f2);}};module[_0x00e9('0x1f')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index bbc5a13..f5c32cf 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 _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0xb10b,0x12a));var _0xbb10=function(_0x45ce90,_0x114609){_0x45ce90=_0x45ce90-0x0;var _0x313c45=_0xb10b[_0x45ce90];return _0x313c45;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file +var _0xb10b=['length','online','loggedIn','smsPause','available','stringify','format','sms:queue:%s','emit','sms_queue:save','lodash','util','ioredis','../../../config/environment','defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','_rr','map','updateRealtime','paused'];(function(_0x5f25b3,_0x35481a){var _0x4ab9bf=function(_0x49baf7){while(--_0x49baf7){_0x5f25b3['push'](_0x5f25b3['shift']());}};_0x4ab9bf(++_0x35481a);}(_0xb10b,0x12a));var _0xbb10=function(_0x1829c6,_0x4d98fd){_0x1829c6=_0x1829c6-0x0;var _0x19a7a0=_0xb10b[_0x1829c6];return _0x19a7a0;};'use strict';var _=require(_0xbb10('0x0'));var md5=require('md5');var util=require(_0xbb10('0x1'));var Redis=require(_0xbb10('0x2'));var config=require(_0xbb10('0x3'));config['redis']=_[_0xbb10('0x4')](config[_0xbb10('0x5')],{'host':_0xbb10('0x6'),'port':0x18eb});var io=require(_0xbb10('0x7'))(new Redis(config[_0xbb10('0x5')]));function SmsQueue(_0x312b72){this['id']=_0x312b72['id']||0x0;this['name']=_0x312b72[_0xbb10('0x8')]||'';this[_0xbb10('0x9')]=_0x312b72['timeout']||0xa;this[_0xbb10('0xa')]=_0x312b72[_0xbb10('0xa')]||_0xbb10('0xb');this[_0xbb10('0xc')]=_0x312b72[_0xbb10('0xc')];this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]=0x0;this[_0xbb10('0xf')]='';this['updateRouting']();this['updateRealtime']();}SmsQueue[_0xbb10('0x10')][_0xbb10('0x11')]=function(){var _0xce64f3=this['mapAgentsId'][_0xbb10('0x12')];this['mapAgentsId']=_[_0xbb10('0x13')](this[_0xbb10('0xc')],'id');this[_0xbb10('0xd')][_0xbb10('0x12')]=_0xce64f3;};SmsQueue[_0xbb10('0x10')][_0xbb10('0x14')]=function(){this['loggedIn']=0x0;this[_0xbb10('0x15')]=0x0;for(var _0x42d7e4=0x0;_0x42d7e4=0x0?this[_0xbb10('0x1a')]:0x0;var _0x1682a4={'id':this['id'],'available':this[_0xbb10('0x1a')],'loggedIn':this[_0xbb10('0x18')],'name':this[_0xbb10('0x8')],'paused':this[_0xbb10('0x15')],'waiting':this['waiting']};var _0x5ff0cf=md5(JSON[_0xbb10('0x1b')](_0x1682a4));if(this[_0xbb10('0xf')]!==_0x5ff0cf){this[_0xbb10('0xf')]=_0x5ff0cf;io['to'](util[_0xbb10('0x1c')](_0xbb10('0x1d'),_0x1682a4['name']))[_0xbb10('0x1e')](_0xbb10('0x1f'),_0x1682a4);}};module['exports']=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index bcf3bfe..c1a0c3c 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 _0x0692=['util','lodash','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','intervals','smsQueues','mailQueues','faxQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length','isUndefined','initIntervals','openchannelQueues','updateRouting','updateRealtime','initChatQueues','chatQueues','initSmsQueues','exports','bluebird'];(function(_0x469eee,_0x3fa6a3){var _0x10c192=function(_0xe80d6b){while(--_0xe80d6b){_0x469eee['push'](_0x469eee['shift']());}};_0x10c192(++_0x3fa6a3);}(_0x0692,0x1bf));var _0x2069=function(_0x58b6e3,_0x568828){_0x58b6e3=_0x58b6e3-0x0;var _0x2d0940=_0x0692[_0x58b6e3];return _0x2d0940;};'use strict';var BPromise=require(_0x2069('0x0'));var util=require(_0x2069('0x1'));var _=require(_0x2069('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x2069('0x3'));var OpenchannelQueue=require(_0x2069('0x4'));var ChatQueue=require(_0x2069('0x5'));var SmsQueue=require(_0x2069('0x6'));var MailQueue=require(_0x2069('0x7'));var FaxQueue=require('../model/faxQueue');var Realtime=function(){this['agents']={};this[_0x2069('0x8')]={};this['openchannelQueues']={};this['chatQueues']={};this[_0x2069('0x9')]={};this[_0x2069('0xa')]={};this[_0x2069('0xb')]={};this[_0x2069('0xc')]={};this[_0x2069('0xd')]={};this['openchannelQueuesWaitingInteractions']={};this[_0x2069('0xe')]={};this[_0x2069('0xf')]={};};function freeIsNotKey(_0x1740d4,_0xa220e1,_0x422045){var _0x3a5c1a=_[_0x2069('0x10')](_0x1740d4,function(_0x13c0eb,_0x298244){return _0x13c0eb[_0x422045];});for(var _0x1e29e0 in _0xa220e1){if(_0xa220e1[_0x2069('0x11')](_0x1e29e0)){if(!_0x3a5c1a[_0x1e29e0]){delete _0xa220e1[_0x1e29e0];}}}}Realtime[_0x2069('0x12')][_0x2069('0x13')]=function(_0x53cc5a,_0x794d2a){for(var _0x1d975f in _0x794d2a){if(_0x53cc5a[_0x2069('0x11')](_0x1d975f)){_0x53cc5a[_0x1d975f]=_0x794d2a[_0x1d975f];}}};Realtime[_0x2069('0x12')][_0x2069('0x14')]=function(){var _0x2086a6=this;return function(_0x3f1b9d){if(_0x3f1b9d){freeIsNotKey(_0x3f1b9d,_0x2086a6[_0x2069('0x15')],'id');for(var _0x216c5f=0x0,_0x5c3dd3={},_0x459bcc={};_0x216c5f<_0x3f1b9d[_0x2069('0x16')];_0x216c5f+=0x1){_0x5c3dd3=_0x3f1b9d[_0x216c5f];if(_[_0x2069('0x17')](_0x2086a6[_0x2069('0x15')][_0x5c3dd3['id']])){_0x2086a6['agents'][_0x5c3dd3['id']]=new Agent(_0x5c3dd3);}else{_0x2086a6['mergeFromDatabase'](_0x2086a6[_0x2069('0x15')][_0x5c3dd3['id']],_0x5c3dd3);}}}return _0x2086a6[_0x2069('0x15')];};};Realtime[_0x2069('0x12')][_0x2069('0x18')]=function(){var _0x2b6338=this;return function(_0x4b1fd2){if(_0x4b1fd2){freeIsNotKey(_0x4b1fd2,_0x2b6338[_0x2069('0x8')],'id');for(var _0x3127f4=0x0,_0x19abcd={},_0x361c2e={};_0x3127f4<_0x4b1fd2[_0x2069('0x16')];_0x3127f4+=0x1){_0x19abcd=_0x4b1fd2[_0x3127f4];if(_[_0x2069('0x17')](_0x2b6338['intervals'][_0x19abcd['id']])){_0x2b6338[_0x2069('0x8')][_0x19abcd['id']]=new Interval(_0x19abcd);}else{_0x2b6338[_0x2069('0x13')](_0x2b6338[_0x2069('0x8')][_0x19abcd['id']],_0x19abcd);}}}return _0x2b6338['intervals'];};};Realtime[_0x2069('0x12')]['initOpenchannelQueues']=function(){var _0x496bb9=this;return function(_0x340ee0){if(_0x340ee0){freeIsNotKey(_0x340ee0,_0x496bb9[_0x2069('0x19')],'id');for(var _0x1fad38=0x0,_0x321a40={},_0x3e4c38={};_0x1fad38<_0x340ee0[_0x2069('0x16')];_0x1fad38+=0x1){_0x321a40=_0x340ee0[_0x1fad38];if(_[_0x2069('0x17')](_0x496bb9[_0x2069('0x19')][_0x321a40['id']])){_0x496bb9[_0x2069('0x19')][_0x321a40['id']]=new OpenchannelQueue(_0x321a40);}else{_0x496bb9[_0x2069('0x13')](_0x496bb9['openchannelQueues'][_0x321a40['id']],_0x321a40);}_0x496bb9[_0x2069('0x19')][_0x321a40['id']][_0x2069('0x1a')]();_0x496bb9['openchannelQueues'][_0x321a40['id']][_0x2069('0x1b')]();}}return _0x496bb9[_0x2069('0x19')];};};Realtime['prototype'][_0x2069('0x1c')]=function(){var _0x59253f=this;return function(_0x35d869){if(_0x35d869){freeIsNotKey(_0x35d869,_0x59253f['chatQueues'],'id');for(var _0x36758b=0x0,_0x12917a={},_0x4be40c={};_0x36758b<_0x35d869[_0x2069('0x16')];_0x36758b+=0x1){_0x12917a=_0x35d869[_0x36758b];if(_[_0x2069('0x17')](_0x59253f[_0x2069('0x1d')][_0x12917a['id']])){_0x59253f['chatQueues'][_0x12917a['id']]=new ChatQueue(_0x12917a);}else{_0x59253f['mergeFromDatabase'](_0x59253f[_0x2069('0x1d')][_0x12917a['id']],_0x12917a);}_0x59253f[_0x2069('0x1d')][_0x12917a['id']][_0x2069('0x1a')]();_0x59253f[_0x2069('0x1d')][_0x12917a['id']][_0x2069('0x1b')]();}}return _0x59253f[_0x2069('0x1d')];};};Realtime[_0x2069('0x12')][_0x2069('0x1e')]=function(){var _0x532688=this;return function(_0xcbc67f){if(_0xcbc67f){freeIsNotKey(_0xcbc67f,_0x532688[_0x2069('0x9')],'id');for(var _0x7f2809=0x0,_0x685a18={},_0x4a1e27={};_0x7f2809<_0xcbc67f[_0x2069('0x16')];_0x7f2809+=0x1){_0x685a18=_0xcbc67f[_0x7f2809];if(_['isUndefined'](_0x532688[_0x2069('0x9')][_0x685a18['id']])){_0x532688[_0x2069('0x9')][_0x685a18['id']]=new SmsQueue(_0x685a18);}else{_0x532688[_0x2069('0x13')](_0x532688['smsQueues'][_0x685a18['id']],_0x685a18);}_0x532688[_0x2069('0x9')][_0x685a18['id']][_0x2069('0x1a')]();_0x532688[_0x2069('0x9')][_0x685a18['id']][_0x2069('0x1b')]();}}return _0x532688['smsQueues'];};};Realtime[_0x2069('0x12')]['initMailQueues']=function(){var _0x38c21e=this;return function(_0x1f2713){if(_0x1f2713){freeIsNotKey(_0x1f2713,_0x38c21e['mailQueues'],'id');for(var _0x32f043=0x0,_0x40bd14={},_0x2918fb={};_0x32f043<_0x1f2713[_0x2069('0x16')];_0x32f043+=0x1){_0x40bd14=_0x1f2713[_0x32f043];if(_[_0x2069('0x17')](_0x38c21e[_0x2069('0xa')][_0x40bd14['id']])){_0x38c21e[_0x2069('0xa')][_0x40bd14['id']]=new MailQueue(_0x40bd14);}else{_0x38c21e[_0x2069('0x13')](_0x38c21e[_0x2069('0xa')][_0x40bd14['id']],_0x40bd14);}_0x38c21e[_0x2069('0xa')][_0x40bd14['id']][_0x2069('0x1a')]();_0x38c21e[_0x2069('0xa')][_0x40bd14['id']]['updateRealtime']();}}return _0x38c21e[_0x2069('0xa')];};};Realtime['prototype']['initFaxQueues']=function(){var _0x3f6be6=this;return function(_0xf64046){if(_0xf64046){freeIsNotKey(_0xf64046,_0x3f6be6['faxQueues'],'id');for(var _0x5be5c5=0x0,_0x1df893={},_0x5857b4={};_0x5be5c5<_0xf64046['length'];_0x5be5c5+=0x1){_0x1df893=_0xf64046[_0x5be5c5];if(_[_0x2069('0x17')](_0x3f6be6[_0x2069('0xb')][_0x1df893['id']])){_0x3f6be6[_0x2069('0xb')][_0x1df893['id']]=new FaxQueue(_0x1df893);}else{_0x3f6be6[_0x2069('0x13')](_0x3f6be6[_0x2069('0xb')][_0x1df893['id']],_0x1df893);}_0x3f6be6[_0x2069('0xb')][_0x1df893['id']][_0x2069('0x1a')]();_0x3f6be6[_0x2069('0xb')][_0x1df893['id']]['updateRealtime']();}}return _0x3f6be6[_0x2069('0xb')];};};module[_0x2069('0x1f')]=Realtime; \ No newline at end of file +var _0x6945=['mailQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','prototype','mergeFromDatabase','initAgents','length','isUndefined','intervals','initOpenchannelQueues','openchannelQueues','updateRouting','initChatQueues','updateRealtime','initSmsQueues','smsQueues','initMailQueues','initFaxQueues','exports','bluebird','util','moment','../model/agent','../model/interval','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','agents','chatQueues'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6945,0x104));var _0x5694=function(_0x346200,_0x34df7d){_0x346200=_0x346200-0x0;var _0x46d214=_0x6945[_0x346200];return _0x46d214;};'use strict';var BPromise=require(_0x5694('0x0'));var util=require(_0x5694('0x1'));var _=require('lodash');var moment=require(_0x5694('0x2'));var Agent=require(_0x5694('0x3'));var Interval=require(_0x5694('0x4'));var OpenchannelQueue=require(_0x5694('0x5'));var ChatQueue=require(_0x5694('0x6'));var SmsQueue=require(_0x5694('0x7'));var MailQueue=require(_0x5694('0x8'));var FaxQueue=require(_0x5694('0x9'));var Realtime=function(){this[_0x5694('0xa')]={};this['intervals']={};this['openchannelQueues']={};this[_0x5694('0xb')]={};this['smsQueues']={};this[_0x5694('0xc')]={};this[_0x5694('0xd')]={};this['chatQueuesWaitingInteractions']={};this[_0x5694('0xe')]={};this[_0x5694('0xf')]={};this[_0x5694('0x10')]={};this[_0x5694('0x11')]={};};function freeIsNotKey(_0x47d830,_0x5739df,_0x1efcfb){var _0x94850=_['mapKeys'](_0x47d830,function(_0x4e6f99,_0x1ddd2d){return _0x4e6f99[_0x1efcfb];});for(var _0x587aaa in _0x5739df){if(_0x5739df['hasOwnProperty'](_0x587aaa)){if(!_0x94850[_0x587aaa]){delete _0x5739df[_0x587aaa];}}}}Realtime[_0x5694('0x12')][_0x5694('0x13')]=function(_0x551a01,_0x5ced20){for(var _0x16e591 in _0x5ced20){if(_0x551a01['hasOwnProperty'](_0x16e591)){_0x551a01[_0x16e591]=_0x5ced20[_0x16e591];}}};Realtime[_0x5694('0x12')][_0x5694('0x14')]=function(){var _0x59518d=this;return function(_0x2ad1f8){if(_0x2ad1f8){freeIsNotKey(_0x2ad1f8,_0x59518d[_0x5694('0xa')],'id');for(var _0x349a2c=0x0,_0x175afc={},_0x39dc2d={};_0x349a2c<_0x2ad1f8[_0x5694('0x15')];_0x349a2c+=0x1){_0x175afc=_0x2ad1f8[_0x349a2c];if(_[_0x5694('0x16')](_0x59518d[_0x5694('0xa')][_0x175afc['id']])){_0x59518d[_0x5694('0xa')][_0x175afc['id']]=new Agent(_0x175afc);}else{_0x59518d['mergeFromDatabase'](_0x59518d[_0x5694('0xa')][_0x175afc['id']],_0x175afc);}}}return _0x59518d[_0x5694('0xa')];};};Realtime[_0x5694('0x12')]['initIntervals']=function(){var _0x244c76=this;return function(_0x30cd79){if(_0x30cd79){freeIsNotKey(_0x30cd79,_0x244c76[_0x5694('0x17')],'id');for(var _0x30d799=0x0,_0x162e0a={},_0x48d574={};_0x30d799<_0x30cd79[_0x5694('0x15')];_0x30d799+=0x1){_0x162e0a=_0x30cd79[_0x30d799];if(_['isUndefined'](_0x244c76[_0x5694('0x17')][_0x162e0a['id']])){_0x244c76['intervals'][_0x162e0a['id']]=new Interval(_0x162e0a);}else{_0x244c76['mergeFromDatabase'](_0x244c76[_0x5694('0x17')][_0x162e0a['id']],_0x162e0a);}}}return _0x244c76['intervals'];};};Realtime[_0x5694('0x12')][_0x5694('0x18')]=function(){var _0x56dd9c=this;return function(_0x577c67){if(_0x577c67){freeIsNotKey(_0x577c67,_0x56dd9c[_0x5694('0x19')],'id');for(var _0x54f8cb=0x0,_0x206eff={},_0x50f865={};_0x54f8cb<_0x577c67[_0x5694('0x15')];_0x54f8cb+=0x1){_0x206eff=_0x577c67[_0x54f8cb];if(_['isUndefined'](_0x56dd9c[_0x5694('0x19')][_0x206eff['id']])){_0x56dd9c[_0x5694('0x19')][_0x206eff['id']]=new OpenchannelQueue(_0x206eff);}else{_0x56dd9c[_0x5694('0x13')](_0x56dd9c[_0x5694('0x19')][_0x206eff['id']],_0x206eff);}_0x56dd9c[_0x5694('0x19')][_0x206eff['id']][_0x5694('0x1a')]();_0x56dd9c['openchannelQueues'][_0x206eff['id']]['updateRealtime']();}}return _0x56dd9c['openchannelQueues'];};};Realtime[_0x5694('0x12')][_0x5694('0x1b')]=function(){var _0x2faab3=this;return function(_0xc64917){if(_0xc64917){freeIsNotKey(_0xc64917,_0x2faab3[_0x5694('0xb')],'id');for(var _0x3e3800=0x0,_0x29d23b={},_0x373bcc={};_0x3e3800<_0xc64917[_0x5694('0x15')];_0x3e3800+=0x1){_0x29d23b=_0xc64917[_0x3e3800];if(_['isUndefined'](_0x2faab3[_0x5694('0xb')][_0x29d23b['id']])){_0x2faab3[_0x5694('0xb')][_0x29d23b['id']]=new ChatQueue(_0x29d23b);}else{_0x2faab3[_0x5694('0x13')](_0x2faab3[_0x5694('0xb')][_0x29d23b['id']],_0x29d23b);}_0x2faab3['chatQueues'][_0x29d23b['id']]['updateRouting']();_0x2faab3[_0x5694('0xb')][_0x29d23b['id']][_0x5694('0x1c')]();}}return _0x2faab3[_0x5694('0xb')];};};Realtime[_0x5694('0x12')][_0x5694('0x1d')]=function(){var _0x16ac39=this;return function(_0x4ccb9b){if(_0x4ccb9b){freeIsNotKey(_0x4ccb9b,_0x16ac39[_0x5694('0x1e')],'id');for(var _0x2b5c3c=0x0,_0x23e5a2={},_0x2b93b2={};_0x2b5c3c<_0x4ccb9b[_0x5694('0x15')];_0x2b5c3c+=0x1){_0x23e5a2=_0x4ccb9b[_0x2b5c3c];if(_[_0x5694('0x16')](_0x16ac39['smsQueues'][_0x23e5a2['id']])){_0x16ac39[_0x5694('0x1e')][_0x23e5a2['id']]=new SmsQueue(_0x23e5a2);}else{_0x16ac39[_0x5694('0x13')](_0x16ac39[_0x5694('0x1e')][_0x23e5a2['id']],_0x23e5a2);}_0x16ac39['smsQueues'][_0x23e5a2['id']]['updateRouting']();_0x16ac39['smsQueues'][_0x23e5a2['id']][_0x5694('0x1c')]();}}return _0x16ac39[_0x5694('0x1e')];};};Realtime[_0x5694('0x12')][_0x5694('0x1f')]=function(){var _0x164849=this;return function(_0x17c1f0){if(_0x17c1f0){freeIsNotKey(_0x17c1f0,_0x164849[_0x5694('0xc')],'id');for(var _0x427f18=0x0,_0x28e1a1={},_0x44d625={};_0x427f18<_0x17c1f0['length'];_0x427f18+=0x1){_0x28e1a1=_0x17c1f0[_0x427f18];if(_[_0x5694('0x16')](_0x164849[_0x5694('0xc')][_0x28e1a1['id']])){_0x164849[_0x5694('0xc')][_0x28e1a1['id']]=new MailQueue(_0x28e1a1);}else{_0x164849[_0x5694('0x13')](_0x164849[_0x5694('0xc')][_0x28e1a1['id']],_0x28e1a1);}_0x164849['mailQueues'][_0x28e1a1['id']][_0x5694('0x1a')]();_0x164849[_0x5694('0xc')][_0x28e1a1['id']][_0x5694('0x1c')]();}}return _0x164849[_0x5694('0xc')];};};Realtime[_0x5694('0x12')][_0x5694('0x20')]=function(){var _0x5009a0=this;return function(_0x19739e){if(_0x19739e){freeIsNotKey(_0x19739e,_0x5009a0[_0x5694('0xd')],'id');for(var _0x2379a1=0x0,_0x176b03={},_0x24bfff={};_0x2379a1<_0x19739e['length'];_0x2379a1+=0x1){_0x176b03=_0x19739e[_0x2379a1];if(_[_0x5694('0x16')](_0x5009a0['faxQueues'][_0x176b03['id']])){_0x5009a0[_0x5694('0xd')][_0x176b03['id']]=new FaxQueue(_0x176b03);}else{_0x5009a0['mergeFromDatabase'](_0x5009a0[_0x5694('0xd')][_0x176b03['id']],_0x176b03);}_0x5009a0[_0x5694('0xd')][_0x176b03['id']][_0x5694('0x1a')]();_0x5009a0[_0x5694('0xd')][_0x176b03['id']][_0x5694('0x1c')]();}}return _0x5009a0[_0x5694('0xd')];};};module[_0x5694('0x21')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index 8f083d5..a8c897a 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 _0x7382=['UpdateChatInteraction','AddTagsToChatInteraction','addTagsToChatInteraction','update','Request'];(function(_0x2d6191,_0x282760){var _0x3dff6c=function(_0xfd0fbb){while(--_0xfd0fbb){_0x2d6191['push'](_0x2d6191['shift']());}};_0x3dff6c(++_0x282760);}(_0x7382,0x99));var _0x2738=function(_0x5b7f44,_0x569a05){_0x5b7f44=_0x5b7f44-0x0;var _0x415304=_0x7382[_0x5b7f44];return _0x415304;};'use strict';var client=require('../client');exports[_0x2738('0x0')]=function(_0x3f2109,_0x370b7f){return client[_0x2738('0x1')](_0x2738('0x2'),{'body':_0x370b7f,'options':{'where':{'id':_0x3f2109}},'log':'updateChatInteraction'});};exports['addTags']=function(_0x17588f,_0x2a5ae8){return client['Request'](_0x2738('0x3'),{'body':_0x2a5ae8,'options':{'where':{'id':_0x17588f}},'log':_0x2738('0x4')});}; \ No newline at end of file +var _0x8ddb=['addTagsToChatInteraction','../client','update','addTags','Request'];(function(_0x271fe4,_0x45d56f){var _0x26ae7d=function(_0x5ee52b){while(--_0x5ee52b){_0x271fe4['push'](_0x271fe4['shift']());}};_0x26ae7d(++_0x45d56f);}(_0x8ddb,0xd8));var _0xb8dd=function(_0x21e71a,_0xf0b818){_0x21e71a=_0x21e71a-0x0;var _0x174f46=_0x8ddb[_0x21e71a];return _0x174f46;};'use strict';var client=require(_0xb8dd('0x0'));exports[_0xb8dd('0x1')]=function(_0x281e22,_0x20cdca){return client['Request']('UpdateChatInteraction',{'body':_0x20cdca,'options':{'where':{'id':_0x281e22}},'log':'updateChatInteraction'});};exports[_0xb8dd('0x2')]=function(_0x53835a,_0x41539e){return client[_0xb8dd('0x3')]('AddTagsToChatInteraction',{'body':_0x41539e,'options':{'where':{'id':_0x53835a}},'log':_0xb8dd('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 2d7d80b..77d12d4 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 _0xa71a=['create','Request','CreateChatMessage','createChatMessage','../client'];(function(_0xbc5c0c,_0x330004){var _0x244f6e=function(_0x1ad32d){while(--_0x1ad32d){_0xbc5c0c['push'](_0xbc5c0c['shift']());}};_0x244f6e(++_0x330004);}(_0xa71a,0x13a));var _0xaa71=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xa71a[_0x2641f9];return _0x585741;};'use strict';var client=require(_0xaa71('0x0'));exports[_0xaa71('0x1')]=function(_0x175d4c){return client[_0xaa71('0x2')](_0xaa71('0x3'),{'body':_0x175d4c,'log':_0xaa71('0x4')});}; \ No newline at end of file +var _0x60a8=['Request','CreateChatMessage','../client','create'];(function(_0x171f79,_0x5f2757){var _0x6c9c9e=function(_0x473e5e){while(--_0x473e5e){_0x171f79['push'](_0x171f79['shift']());}};_0x6c9c9e(++_0x5f2757);}(_0x60a8,0x1aa));var _0x860a=function(_0x541b49,_0x497c69){_0x541b49=_0x541b49-0x0;var _0x3ee5d7=_0x60a8[_0x541b49];return _0x3ee5d7;};'use strict';var client=require(_0x860a('0x0'));exports[_0x860a('0x1')]=function(_0x2e3583){return client[_0x860a('0x2')](_0x860a('0x3'),{'body':_0x2e3583,'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 3806dee..82312eb 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 _0x4a49=['../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy','User','online'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x4a49,0x14d));var _0x94a4=function(_0x32f978,_0x1175c6){_0x32f978=_0x32f978-0x0;var _0x3c2aa5=_0x4a49[_0x32f978];return _0x3c2aa5;};'use strict';var client=require(_0x94a4('0x0'));exports[_0x94a4('0x1')]=function(){return function(){return client[_0x94a4('0x2')](_0x94a4('0x3'),{'options':{'raw':![],'attributes':['id',_0x94a4('0x4'),_0x94a4('0x5'),_0x94a4('0x6')],'include':[{'model':_0x94a4('0x7'),'as':'Agents','attributes':['id','name',_0x94a4('0x8'),'chatPause']}]},'log':_0x94a4('0x1')});};}; \ No newline at end of file +var _0x68ac=['User','Agents','online','chatPause','../client','getChatQueues','Request','GetChatQueue','name','timeout','strategy'];(function(_0x263dbf,_0x555419){var _0x57302b=function(_0x4fbfcb){while(--_0x4fbfcb){_0x263dbf['push'](_0x263dbf['shift']());}};_0x57302b(++_0x555419);}(_0x68ac,0xb4));var _0xc68a=function(_0x523e57,_0x43ae46){_0x523e57=_0x523e57-0x0;var _0x4ed1c9=_0x68ac[_0x523e57];return _0x4ed1c9;};'use strict';var client=require(_0xc68a('0x0'));exports[_0xc68a('0x1')]=function(){return function(){return client[_0xc68a('0x2')](_0xc68a('0x3'),{'options':{'raw':![],'attributes':['id',_0xc68a('0x4'),_0xc68a('0x5'),_0xc68a('0x6')],'include':[{'model':_0xc68a('0x7'),'as':_0xc68a('0x8'),'attributes':['id','name',_0xc68a('0x9'),_0xc68a('0xa')]}]},'log':_0xc68a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 0eea5f8..635283b 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 _0xdeb7=['create','CreateChatQueueReport','update','UpdateChatQueueReport','DESC','../client'];(function(_0x175721,_0x319c64){var _0x2a5fa3=function(_0x50d761){while(--_0x50d761){_0x175721['push'](_0x175721['shift']());}};_0x2a5fa3(++_0x319c64);}(_0xdeb7,0x77));var _0x7deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb7[_0x2641f9];return _0x585741;};'use strict';var client=require(_0x7deb('0x0'));exports[_0x7deb('0x1')]=function(_0x5f4b03){return client['Request'](_0x7deb('0x2'),{'body':_0x5f4b03,'log':_0x7deb('0x2')});};exports[_0x7deb('0x3')]=function(_0x20de63,_0x307ce7){return client['Request'](_0x7deb('0x4'),{'body':_0x307ce7,'options':{'where':{'uniqueid':_0x20de63},'order':[['id',_0x7deb('0x5')]],'limit':0x1},'log':_0x7deb('0x4')});}; \ No newline at end of file +var _0x2123=['DESC','../client','create','Request','CreateChatQueueReport','update','UpdateChatQueueReport'];(function(_0x371655,_0x4cd20f){var _0x3a4c99=function(_0x56ef70){while(--_0x56ef70){_0x371655['push'](_0x371655['shift']());}};_0x3a4c99(++_0x4cd20f);}(_0x2123,0x190));var _0x3212=function(_0x470afe,_0x2bf985){_0x470afe=_0x470afe-0x0;var _0x479070=_0x2123[_0x470afe];return _0x479070;};'use strict';var client=require(_0x3212('0x0'));exports[_0x3212('0x1')]=function(_0x420d05){return client[_0x3212('0x2')](_0x3212('0x3'),{'body':_0x420d05,'log':_0x3212('0x3')});};exports[_0x3212('0x4')]=function(_0x2e951f,_0x304f80){return client[_0x3212('0x2')](_0x3212('0x5'),{'body':_0x304f80,'options':{'where':{'uniqueid':_0x2e951f},'order':[['id',_0x3212('0x6')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 911b8ad..17ab8ca 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 _0xdd8e=['updateFaxInteraction','addTags','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','Request','UpdateFaxInteraction'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xdd8e,0x162));var _0xedd8=function(_0x443051,_0xe527f6){_0x443051=_0x443051-0x0;var _0x423279=_0xdd8e[_0x443051];return _0x423279;};'use strict';var client=require(_0xedd8('0x0'));exports['update']=function(_0x461f4b,_0x49da82){return client[_0xedd8('0x1')](_0xedd8('0x2'),{'body':_0x49da82,'options':{'where':{'id':_0x461f4b}},'log':_0xedd8('0x3')});};exports[_0xedd8('0x4')]=function(_0x3feaf8,_0x35911f){return client[_0xedd8('0x1')](_0xedd8('0x5'),{'body':_0x35911f,'options':{'where':{'id':_0x3feaf8}},'log':_0xedd8('0x6')});}; \ No newline at end of file +var _0x9ccd=['update','Request','UpdateFaxInteraction','updateFaxInteraction','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client'];(function(_0x75276e,_0x4a4015){var _0x3d8d88=function(_0x54e4a6){while(--_0x54e4a6){_0x75276e['push'](_0x75276e['shift']());}};_0x3d8d88(++_0x4a4015);}(_0x9ccd,0xdf));var _0xd9cc=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9ccd[_0x14add3];return _0x4a174f;};'use strict';var client=require(_0xd9cc('0x0'));exports[_0xd9cc('0x1')]=function(_0x29d472,_0x11ad57){return client[_0xd9cc('0x2')](_0xd9cc('0x3'),{'body':_0x11ad57,'options':{'where':{'id':_0x29d472}},'log':_0xd9cc('0x4')});};exports['addTags']=function(_0xe877a6,_0x23a568){return client[_0xd9cc('0x2')](_0xd9cc('0x5'),{'body':_0x23a568,'options':{'where':{'id':_0xe877a6}},'log':_0xd9cc('0x6')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 672e12a..ab526e0 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 _0x09c1=['../client','create','Request','CreateFaxMessage','createFaxMessage'];(function(_0x18605f,_0x1da100){var _0x436e18=function(_0xe3f16d){while(--_0xe3f16d){_0x18605f['push'](_0x18605f['shift']());}};_0x436e18(++_0x1da100);}(_0x09c1,0xf5));var _0x109c=function(_0x20c6f1,_0x21fa65){_0x20c6f1=_0x20c6f1-0x0;var _0x43c3bf=_0x09c1[_0x20c6f1];return _0x43c3bf;};'use strict';var client=require(_0x109c('0x0'));exports[_0x109c('0x1')]=function(_0xce9475){return client[_0x109c('0x2')](_0x109c('0x3'),{'body':_0xce9475,'log':_0x109c('0x4')});}; \ No newline at end of file +var _0x05d4=['CreateFaxMessage','createFaxMessage','../client','Request'];(function(_0x21b651,_0x2a22f0){var _0x4398bd=function(_0x1874aa){while(--_0x1874aa){_0x21b651['push'](_0x21b651['shift']());}};_0x4398bd(++_0x2a22f0);}(_0x05d4,0x72));var _0x405d=function(_0x1379e9,_0x3cf0c3){_0x1379e9=_0x1379e9-0x0;var _0x54bc52=_0x05d4[_0x1379e9];return _0x54bc52;};'use strict';var client=require(_0x405d('0x0'));exports['create']=function(_0xc72907){return client[_0x405d('0x1')](_0x405d('0x2'),{'body':_0xc72907,'log':_0x405d('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index c8314c2..e42e10d 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 _0x0755=['name','timeout','strategy','User','Agents','online','faxPause','../client','getFaxQueues','GetFaxQueue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x0755,0x15b));var _0x5075=function(_0x3d3fde,_0x260b16){_0x3d3fde=_0x3d3fde-0x0;var _0x54b62e=_0x0755[_0x3d3fde];return _0x54b62e;};'use strict';var client=require(_0x5075('0x0'));exports[_0x5075('0x1')]=function(){return function(){return client['Request'](_0x5075('0x2'),{'options':{'raw':![],'attributes':['id',_0x5075('0x3'),_0x5075('0x4'),_0x5075('0x5')],'include':[{'model':_0x5075('0x6'),'as':_0x5075('0x7'),'attributes':['id',_0x5075('0x3'),_0x5075('0x8'),_0x5075('0x9')]}]},'log':_0x5075('0x1')});};}; \ No newline at end of file +var _0x212e=['faxPause','getFaxQueues','Request','GetFaxQueue','timeout','strategy','Agents','name'];(function(_0xff4a4a,_0x2df5c3){var _0x1356a4=function(_0xcfc746){while(--_0xcfc746){_0xff4a4a['push'](_0xff4a4a['shift']());}};_0x1356a4(++_0x2df5c3);}(_0x212e,0xc1));var _0xe212=function(_0x110dbf,_0x16a620){_0x110dbf=_0x110dbf-0x0;var _0x49e064=_0x212e[_0x110dbf];return _0x49e064;};'use strict';var client=require('../client');exports[_0xe212('0x0')]=function(){return function(){return client[_0xe212('0x1')](_0xe212('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xe212('0x3'),_0xe212('0x4')],'include':[{'model':'User','as':_0xe212('0x5'),'attributes':['id',_0xe212('0x6'),'online',_0xe212('0x7')]}]},'log':_0xe212('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 736ef2c..699588f 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 _0xe288=['UpdateFaxQueueReport','../client','create','Request','CreateFaxQueueReport','update','DESC'];(function(_0x547e20,_0x284545){var _0x359171=function(_0x590250){while(--_0x590250){_0x547e20['push'](_0x547e20['shift']());}};_0x359171(++_0x284545);}(_0xe288,0x104));var _0x8e28=function(_0x527eef,_0x386ebb){_0x527eef=_0x527eef-0x0;var _0x4903cc=_0xe288[_0x527eef];return _0x4903cc;};'use strict';var client=require(_0x8e28('0x0'));exports[_0x8e28('0x1')]=function(_0x1ff394){return client[_0x8e28('0x2')](_0x8e28('0x3'),{'body':_0x1ff394,'log':_0x8e28('0x3')});};exports[_0x8e28('0x4')]=function(_0x453f88,_0x1ce6ac){return client[_0x8e28('0x2')]('UpdateFaxQueueReport',{'body':_0x1ce6ac,'options':{'where':{'uniqueid':_0x453f88},'order':[['id',_0x8e28('0x5')]],'limit':0x1},'log':_0x8e28('0x6')});}; \ No newline at end of file +var _0x5902=['DESC','../client','Request','CreateFaxQueueReport','update','UpdateFaxQueueReport'];(function(_0x13caf0,_0x27f5ab){var _0x520401=function(_0x5b30eb){while(--_0x5b30eb){_0x13caf0['push'](_0x13caf0['shift']());}};_0x520401(++_0x27f5ab);}(_0x5902,0x187));var _0x2590=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5902[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0x2590('0x0'));exports['create']=function(_0x181ea6){return client[_0x2590('0x1')]('CreateFaxQueueReport',{'body':_0x181ea6,'log':_0x2590('0x2')});};exports[_0x2590('0x3')]=function(_0x52a254,_0x456f63){return client[_0x2590('0x1')](_0x2590('0x4'),{'body':_0x456f63,'options':{'where':{'uniqueid':_0x52a254},'order':[['id',_0x2590('0x5')]],'limit':0x1},'log':'UpdateFaxQueueReport'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 1f03eff..e8077ff 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 _0xa7fa=['../client','GetInterval','name','Interval','Intervals','interval','getIntervals'];(function(_0x32ebaf,_0x4e03ce){var _0x436b62=function(_0x3e374f){while(--_0x3e374f){_0x32ebaf['push'](_0x32ebaf['shift']());}};_0x436b62(++_0x4e03ce);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var client=require(_0xaa7f('0x0'));exports['getIntervals']=function(){return function(){return client['Request'](_0xaa7f('0x1'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xaa7f('0x2')],'include':[{'model':_0xaa7f('0x3'),'as':_0xaa7f('0x4'),'attributes':['id','name',_0xaa7f('0x5')]}]},'log':_0xaa7f('0x6')});};}; \ No newline at end of file +var _0xe511=['interval','../client','getIntervals','GetInterval','Interval','Intervals'];(function(_0x2693c1,_0x54ffea){var _0x48a150=function(_0x42ba93){while(--_0x42ba93){_0x2693c1['push'](_0x2693c1['shift']());}};_0x48a150(++_0x54ffea);}(_0xe511,0x16f));var _0x1e51=function(_0xfe08bf,_0x2aab40){_0xfe08bf=_0xfe08bf-0x0;var _0x44b8ca=_0xe511[_0xfe08bf];return _0x44b8ca;};'use strict';var client=require(_0x1e51('0x0'));exports[_0x1e51('0x1')]=function(){return function(){return client['Request'](_0x1e51('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0x1e51('0x3'),'as':_0x1e51('0x4'),'attributes':['id','name',_0x1e51('0x5')]}]},'log':_0x1e51('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cdb46db..0c233ed 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 _0x82b7=['../client','update','Request','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x1602af,_0x540e07){var _0x3c088e=function(_0x1be346){while(--_0x1be346){_0x1602af['push'](_0x1602af['shift']());}};_0x3c088e(++_0x540e07);}(_0x82b7,0xd2));var _0x782b=function(_0x2348d0,_0x1ea2bd){_0x2348d0=_0x2348d0-0x0;var _0x1c4283=_0x82b7[_0x2348d0];return _0x1c4283;};'use strict';var client=require(_0x782b('0x0'));exports[_0x782b('0x1')]=function(_0x4cea89,_0x5071bd){return client[_0x782b('0x2')]('UpdateMailInteraction',{'body':_0x5071bd,'options':{'where':{'id':_0x4cea89}},'log':_0x782b('0x3')});};exports[_0x782b('0x4')]=function(_0x1d7562,_0x20a2a2){return client['Request'](_0x782b('0x5'),{'body':_0x20a2a2,'options':{'where':{'id':_0x1d7562}},'log':_0x782b('0x6')});}; \ No newline at end of file +var _0x2632=['addTags','../client','Request','updateMailInteraction'];(function(_0xd09668,_0x1435b2){var _0x68726=function(_0x54a030){while(--_0x54a030){_0xd09668['push'](_0xd09668['shift']());}};_0x68726(++_0x1435b2);}(_0x2632,0x1d5));var _0x2263=function(_0x172121,_0x8f97c4){_0x172121=_0x172121-0x0;var _0x4501d3=_0x2632[_0x172121];return _0x4501d3;};'use strict';var client=require(_0x2263('0x0'));exports['update']=function(_0x737c29,_0x4a2640){return client[_0x2263('0x1')]('UpdateMailInteraction',{'body':_0x4a2640,'options':{'where':{'id':_0x737c29}},'log':_0x2263('0x2')});};exports[_0x2263('0x3')]=function(_0x3fe975,_0x42bfe9){return client[_0x2263('0x1')]('AddTagsToMailInteraction',{'body':_0x42bfe9,'options':{'where':{'id':_0x3fe975}},'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 50873c7..b15fda3 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 _0x813e=['CreateMailMessage','createMailMessage','../client','create','Request'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x813e,0x15b));var _0xe813=function(_0x491842,_0x4ca9af){_0x491842=_0x491842-0x0;var _0x54b04e=_0x813e[_0x491842];return _0x54b04e;};'use strict';var client=require(_0xe813('0x0'));exports[_0xe813('0x1')]=function(_0xbe908){return client[_0xe813('0x2')](_0xe813('0x3'),{'body':_0xbe908,'log':_0xe813('0x4')});}; \ No newline at end of file +var _0x3bd5=['createMailMessage','Request','CreateMailMessage'];(function(_0x14ac27,_0x3025e5){var _0x51dfd2=function(_0x5d79f8){while(--_0x5d79f8){_0x14ac27['push'](_0x14ac27['shift']());}};_0x51dfd2(++_0x3025e5);}(_0x3bd5,0x1b1));var _0x53bd=function(_0x16bd24,_0x4c00b5){_0x16bd24=_0x16bd24-0x0;var _0x313b77=_0x3bd5[_0x16bd24];return _0x313b77;};'use strict';var client=require('../client');exports['create']=function(_0x4ef089){return client[_0x53bd('0x0')](_0x53bd('0x1'),{'body':_0x4ef089,'log':_0x53bd('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index bdacc2f..9812663 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 _0x280e=['../client','getMailQueues','name','timeout','User','online','mailPause'];(function(_0x838bd5,_0x68e087){var _0x425efb=function(_0x3a1005){while(--_0x3a1005){_0x838bd5['push'](_0x838bd5['shift']());}};_0x425efb(++_0x68e087);}(_0x280e,0xd2));var _0xe280=function(_0xa1e3e3,_0x29fe0e){_0xa1e3e3=_0xa1e3e3-0x0;var _0xc980e9=_0x280e[_0xa1e3e3];return _0xc980e9;};'use strict';var client=require(_0xe280('0x0'));exports[_0xe280('0x1')]=function(){return function(){return client['Request']('GetMailQueue',{'options':{'raw':![],'attributes':['id',_0xe280('0x2'),_0xe280('0x3'),'strategy'],'include':[{'model':_0xe280('0x4'),'as':'Agents','attributes':['id','name',_0xe280('0x5'),_0xe280('0x6')]}]},'log':'getMailQueues'});};}; \ No newline at end of file +var _0xf671=['mailPause','getMailQueues','Request','GetMailQueue','name','strategy','User','Agents','online'];(function(_0x5c2141,_0x4f20df){var _0x1972a7=function(_0x144af5){while(--_0x144af5){_0x5c2141['push'](_0x5c2141['shift']());}};_0x1972a7(++_0x4f20df);}(_0xf671,0x1a9));var _0x1f67=function(_0x4bfe08,_0x48ae7b){_0x4bfe08=_0x4bfe08-0x0;var _0x1f9125=_0xf671[_0x4bfe08];return _0x1f9125;};'use strict';var client=require('../client');exports['getMailQueues']=function(){return function(){return client[_0x1f67('0x0')](_0x1f67('0x1'),{'options':{'raw':![],'attributes':['id',_0x1f67('0x2'),'timeout',_0x1f67('0x3')],'include':[{'model':_0x1f67('0x4'),'as':_0x1f67('0x5'),'attributes':['id',_0x1f67('0x2'),_0x1f67('0x6'),_0x1f67('0x7')]}]},'log':_0x1f67('0x8')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 0f365a2..acc8e16 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 _0x1c75=['UpdateMailQueueReport','DESC','create','CreateMailQueueReport','update','Request'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c75,0x92));var _0x51c7=function(_0xe66f5a,_0x20056b){_0xe66f5a=_0xe66f5a-0x0;var _0x9f6f71=_0x1c75[_0xe66f5a];return _0x9f6f71;};'use strict';var client=require('../client');exports[_0x51c7('0x0')]=function(_0x6a921){return client['Request'](_0x51c7('0x1'),{'body':_0x6a921,'log':_0x51c7('0x1')});};exports[_0x51c7('0x2')]=function(_0x4fa2b3,_0x2e2419){return client[_0x51c7('0x3')](_0x51c7('0x4'),{'body':_0x2e2419,'options':{'where':{'uniqueid':_0x4fa2b3},'order':[['id',_0x51c7('0x5')]],'limit':0x1},'log':_0x51c7('0x4')});}; \ No newline at end of file +var _0x1622=['CreateMailQueueReport','update','UpdateMailQueueReport','DESC','create','Request'];(function(_0x5ba8c2,_0x476ede){var _0x1ff6a6=function(_0x5764e7){while(--_0x5764e7){_0x5ba8c2['push'](_0x5ba8c2['shift']());}};_0x1ff6a6(++_0x476ede);}(_0x1622,0x1b4));var _0x2162=function(_0x2f4abe,_0x257fd4){_0x2f4abe=_0x2f4abe-0x0;var _0x30797b=_0x1622[_0x2f4abe];return _0x30797b;};'use strict';var client=require('../client');exports[_0x2162('0x0')]=function(_0x58f550){return client[_0x2162('0x1')]('CreateMailQueueReport',{'body':_0x58f550,'log':_0x2162('0x2')});};exports[_0x2162('0x3')]=function(_0x1c6092,_0x33e90f){return client[_0x2162('0x1')](_0x2162('0x4'),{'body':_0x33e90f,'options':{'where':{'uniqueid':_0x1c6092},'order':[['id',_0x2162('0x5')]],'limit':0x1},'log':_0x2162('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 6261881..cd24580 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 _0x6009=['Request','UpdateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x38e233,_0x574714){var _0x5e7ea5=function(_0x4be59e){while(--_0x4be59e){_0x38e233['push'](_0x38e233['shift']());}};_0x5e7ea5(++_0x574714);}(_0x6009,0xd7));var _0x9600=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x6009[_0x1c6ef2];return _0x404b8c;};'use strict';var client=require('../client');exports['update']=function(_0x4be822,_0x5a1d80){return client[_0x9600('0x0')](_0x9600('0x1'),{'body':_0x5a1d80,'options':{'where':{'id':_0x4be822}},'log':'updateOpenchannelInteraction'});};exports[_0x9600('0x2')]=function(_0x468590,_0x289085){return client['Request'](_0x9600('0x3'),{'body':_0x289085,'options':{'where':{'id':_0x468590}},'log':_0x9600('0x4')});}; \ No newline at end of file +var _0xb0e9=['../client','Request','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x37a7c6,_0x3a84b6){var _0x539905=function(_0xa00c20){while(--_0xa00c20){_0x37a7c6['push'](_0x37a7c6['shift']());}};_0x539905(++_0x3a84b6);}(_0xb0e9,0xc3));var _0x9b0e=function(_0x12ba59,_0x139b9d){_0x12ba59=_0x12ba59-0x0;var _0x147a9c=_0xb0e9[_0x12ba59];return _0x147a9c;};'use strict';var client=require(_0x9b0e('0x0'));exports['update']=function(_0x3252ac,_0x2cfd17){return client[_0x9b0e('0x1')](_0x9b0e('0x2'),{'body':_0x2cfd17,'options':{'where':{'id':_0x3252ac}},'log':'updateOpenchannelInteraction'});};exports['addTags']=function(_0x731d5d,_0x4925c2){return client['Request'](_0x9b0e('0x3'),{'body':_0x4925c2,'options':{'where':{'id':_0x731d5d}},'log':_0x9b0e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0802977..08ed058 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 _0xe706=['create','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x32ffb5,_0x3866b5){var _0x3cbd7a=function(_0x42315b){while(--_0x42315b){_0x32ffb5['push'](_0x32ffb5['shift']());}};_0x3cbd7a(++_0x3866b5);}(_0xe706,0xa3));var _0x6e70=function(_0x25ffd4,_0x16b31d){_0x25ffd4=_0x25ffd4-0x0;var _0x414452=_0xe706[_0x25ffd4];return _0x414452;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(_0x311951){return client['Request'](_0x6e70('0x2'),{'body':_0x311951,'log':_0x6e70('0x3')});}; \ No newline at end of file +var _0x6f0d=['CreateOpenchannelMessage','create','Request'];(function(_0xad64c,_0x4538b0){var _0x339763=function(_0x2f13d6){while(--_0x2f13d6){_0xad64c['push'](_0xad64c['shift']());}};_0x339763(++_0x4538b0);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x23efce,_0x3abeb1){_0x23efce=_0x23efce-0x0;var _0x121d0e=_0x6f0d[_0x23efce];return _0x121d0e;};'use strict';var client=require('../client');exports[_0xd6f0('0x0')]=function(_0x64ebf2){return client[_0xd6f0('0x1')](_0xd6f0('0x2'),{'body':_0x64ebf2,'log':'createOpenchannelMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index a23725a..3aba890 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 _0x2a65=['name','online','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','timeout','User','Agents'];(function(_0x4d0c16,_0x3da4de){var _0x5212e0=function(_0x575ab4){while(--_0x575ab4){_0x4d0c16['push'](_0x4d0c16['shift']());}};_0x5212e0(++_0x3da4de);}(_0x2a65,0x158));var _0x52a6=function(_0x312b37,_0x19f474){_0x312b37=_0x312b37-0x0;var _0x2e5f91=_0x2a65[_0x312b37];return _0x2e5f91;};'use strict';var client=require(_0x52a6('0x0'));exports[_0x52a6('0x1')]=function(){return function(){return client[_0x52a6('0x2')](_0x52a6('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x52a6('0x4'),'strategy'],'include':[{'model':_0x52a6('0x5'),'as':_0x52a6('0x6'),'attributes':['id',_0x52a6('0x7'),_0x52a6('0x8'),'openchannelPause']}]},'log':_0x52a6('0x1')});};}; \ No newline at end of file +var _0xe3d6=['timeout','strategy','User','online','getOpenchannelQueues','../client','GetOpenchannelQueue','name'];(function(_0x2d6197,_0x82ebfb){var _0x4d0e75=function(_0x577e7a){while(--_0x577e7a){_0x2d6197['push'](_0x2d6197['shift']());}};_0x4d0e75(++_0x82ebfb);}(_0xe3d6,0x165));var _0x6e3d=function(_0x12e509,_0x503590){_0x12e509=_0x12e509-0x0;var _0x5eddc9=_0xe3d6[_0x12e509];return _0x5eddc9;};'use strict';var client=require(_0x6e3d('0x0'));exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x6e3d('0x1'),{'options':{'raw':![],'attributes':['id',_0x6e3d('0x2'),_0x6e3d('0x3'),_0x6e3d('0x4')],'include':[{'model':_0x6e3d('0x5'),'as':'Agents','attributes':['id',_0x6e3d('0x2'),_0x6e3d('0x6'),'openchannelPause']}]},'log':_0x6e3d('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 9323a53..6d06a0f 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 _0x59ee=['UpdateOpenchannelQueueReport','DESC','Request','CreateOpenchannelQueueReport','update'];(function(_0x367284,_0x26688c){var _0xe5c015=function(_0x19705e){while(--_0x19705e){_0x367284['push'](_0x367284['shift']());}};_0xe5c015(++_0x26688c);}(_0x59ee,0x192));var _0xe59e=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x59ee[_0x9cd4c3];return _0x4c9025;};'use strict';var client=require('../client');exports['create']=function(_0x4afb87){return client[_0xe59e('0x0')](_0xe59e('0x1'),{'body':_0x4afb87,'log':_0xe59e('0x1')});};exports[_0xe59e('0x2')]=function(_0x3b0331,_0x1255ec){return client[_0xe59e('0x0')](_0xe59e('0x3'),{'body':_0x1255ec,'options':{'where':{'uniqueid':_0x3b0331},'order':[['id',_0xe59e('0x4')]],'limit':0x1},'log':_0xe59e('0x3')});}; \ No newline at end of file +var _0xe4e7=['update','Request','UpdateOpenchannelQueueReport','../client','CreateOpenchannelQueueReport'];(function(_0x4bff20,_0x5107ff){var _0x2291e8=function(_0x33e8d7){while(--_0x33e8d7){_0x4bff20['push'](_0x4bff20['shift']());}};_0x2291e8(++_0x5107ff);}(_0xe4e7,0xb2));var _0x7e4e=function(_0x78f045,_0x1a9f62){_0x78f045=_0x78f045-0x0;var _0x1cf0d5=_0xe4e7[_0x78f045];return _0x1cf0d5;};'use strict';var client=require(_0x7e4e('0x0'));exports['create']=function(_0x290b38){return client['Request'](_0x7e4e('0x1'),{'body':_0x290b38,'log':'CreateOpenchannelQueueReport'});};exports[_0x7e4e('0x2')]=function(_0x50aae2,_0x3c9469){return client[_0x7e4e('0x3')]('UpdateOpenchannelQueueReport',{'body':_0x3c9469,'options':{'where':{'uniqueid':_0x50aae2},'order':[['id','DESC']],'limit':0x1},'log':_0x7e4e('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index 9e3c98f..02d2be4 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 _0x43b7=['addTagsToSmsInteraction','../client','Request','UpdateSmsInteraction','updateSmsInteraction','addTags','AddTagsToSmsInteraction'];(function(_0x406e46,_0x5799cb){var _0x4a3742=function(_0x1fa435){while(--_0x1fa435){_0x406e46['push'](_0x406e46['shift']());}};_0x4a3742(++_0x5799cb);}(_0x43b7,0x1b3));var _0x743b=function(_0x1cfc24,_0x41b8f6){_0x1cfc24=_0x1cfc24-0x0;var _0x2e0f60=_0x43b7[_0x1cfc24];return _0x2e0f60;};'use strict';var client=require(_0x743b('0x0'));exports['update']=function(_0x58a788,_0x4a434e){return client[_0x743b('0x1')](_0x743b('0x2'),{'body':_0x4a434e,'options':{'where':{'id':_0x58a788}},'log':_0x743b('0x3')});};exports[_0x743b('0x4')]=function(_0x2cef8d,_0x24ef01){return client['Request'](_0x743b('0x5'),{'body':_0x24ef01,'options':{'where':{'id':_0x2cef8d}},'log':_0x743b('0x6')});}; \ No newline at end of file +var _0xb980=['UpdateSmsInteraction','updateSmsInteraction','AddTagsToSmsInteraction','../client','update','Request'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0xb980,0xf9));var _0x0b98=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb980[_0x3dd15e];return _0x231fd0;};'use strict';var client=require(_0x0b98('0x0'));exports[_0x0b98('0x1')]=function(_0x501041,_0x46c93c){return client[_0x0b98('0x2')](_0x0b98('0x3'),{'body':_0x46c93c,'options':{'where':{'id':_0x501041}},'log':_0x0b98('0x4')});};exports['addTags']=function(_0x1f2191,_0x3c791b){return client['Request'](_0x0b98('0x5'),{'body':_0x3c791b,'options':{'where':{'id':_0x1f2191}},'log':'addTagsToSmsInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 364154c..72a99c8 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 _0xdbca=['../client','Request','CreateSmsMessage','createSmsMessage'];(function(_0x1866ea,_0x547489){var _0x34f90a=function(_0x2b9a5c){while(--_0x2b9a5c){_0x1866ea['push'](_0x1866ea['shift']());}};_0x34f90a(++_0x547489);}(_0xdbca,0x150));var _0xadbc=function(_0x1103c4,_0x562d1d){_0x1103c4=_0x1103c4-0x0;var _0x1c19ab=_0xdbca[_0x1103c4];return _0x1c19ab;};'use strict';var client=require(_0xadbc('0x0'));exports['create']=function(_0x2b1e00){return client[_0xadbc('0x1')](_0xadbc('0x2'),{'body':_0x2b1e00,'log':_0xadbc('0x3')});}; \ No newline at end of file +var _0x2139=['createSmsMessage','../client','CreateSmsMessage'];(function(_0x562bba,_0x8d929){var _0x2a1d2e=function(_0x1e4700){while(--_0x1e4700){_0x562bba['push'](_0x562bba['shift']());}};_0x2a1d2e(++_0x8d929);}(_0x2139,0x1a5));var _0x9213=function(_0x3993f0,_0x40c90e){_0x3993f0=_0x3993f0-0x0;var _0x4545d9=_0x2139[_0x3993f0];return _0x4545d9;};'use strict';var client=require(_0x9213('0x0'));exports['create']=function(_0x27117d){return client['Request'](_0x9213('0x1'),{'body':_0x27117d,'log':_0x9213('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 004b3e6..5d5b3ff 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 _0x0e4b=['strategy','User','name','online','smsPause','getSmsQueues','../client','Request','timeout'];(function(_0x520fc7,_0x207bee){var _0x14d40a=function(_0x2af7ef){while(--_0x2af7ef){_0x520fc7['push'](_0x520fc7['shift']());}};_0x14d40a(++_0x207bee);}(_0x0e4b,0x1d1));var _0xb0e4=function(_0x1aade5,_0x28d424){_0x1aade5=_0x1aade5-0x0;var _0x538d6d=_0x0e4b[_0x1aade5];return _0x538d6d;};'use strict';var client=require(_0xb0e4('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0xb0e4('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0xb0e4('0x2'),_0xb0e4('0x3')],'include':[{'model':_0xb0e4('0x4'),'as':'Agents','attributes':['id',_0xb0e4('0x5'),_0xb0e4('0x6'),_0xb0e4('0x7')]}]},'log':_0xb0e4('0x8')});};}; \ No newline at end of file +var _0x9fa0=['Agents','online','getSmsQueues','GetSmsQueue','name','timeout','strategy'];(function(_0x259835,_0x34ff5c){var _0x48479e=function(_0x1e273f){while(--_0x1e273f){_0x259835['push'](_0x259835['shift']());}};_0x48479e(++_0x34ff5c);}(_0x9fa0,0x6c));var _0x09fa=function(_0x4bc65f,_0x39ec43){_0x4bc65f=_0x4bc65f-0x0;var _0x44f85f=_0x9fa0[_0x4bc65f];return _0x44f85f;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client['Request'](_0x09fa('0x0'),{'options':{'raw':![],'attributes':['id',_0x09fa('0x1'),_0x09fa('0x2'),_0x09fa('0x3')],'include':[{'model':'User','as':_0x09fa('0x4'),'attributes':['id',_0x09fa('0x1'),_0x09fa('0x5'),'smsPause']}]},'log':_0x09fa('0x6')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index f99e98d..95313d3 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 _0xed3c=['UpdateSmsQueueReport','DESC','../client','create','Request','CreateSmsQueueReport','update'];(function(_0x350f58,_0x54efda){var _0x370e27=function(_0x18a034){while(--_0x18a034){_0x350f58['push'](_0x350f58['shift']());}};_0x370e27(++_0x54efda);}(_0xed3c,0x1a6));var _0xced3=function(_0x185063,_0x3f0bb7){_0x185063=_0x185063-0x0;var _0x16d9d3=_0xed3c[_0x185063];return _0x16d9d3;};'use strict';var client=require(_0xced3('0x0'));exports[_0xced3('0x1')]=function(_0xa7adca){return client[_0xced3('0x2')]('CreateSmsQueueReport',{'body':_0xa7adca,'log':_0xced3('0x3')});};exports[_0xced3('0x4')]=function(_0x14488e,_0x5f03e0){return client['Request'](_0xced3('0x5'),{'body':_0x5f03e0,'options':{'where':{'uniqueid':_0x14488e},'order':[['id',_0xced3('0x6')]],'limit':0x1},'log':_0xced3('0x5')});}; \ No newline at end of file +var _0x624a=['CreateSmsQueueReport','update','UpdateSmsQueueReport','create','Request'];(function(_0x232d96,_0x31f394){var _0x4af075=function(_0x15c995){while(--_0x15c995){_0x232d96['push'](_0x232d96['shift']());}};_0x4af075(++_0x31f394);}(_0x624a,0x143));var _0xa624=function(_0x55054d,_0x35adc6){_0x55054d=_0x55054d-0x0;var _0x5324fa=_0x624a[_0x55054d];return _0x5324fa;};'use strict';var client=require('../client');exports[_0xa624('0x0')]=function(_0x48b4ee){return client[_0xa624('0x1')](_0xa624('0x2'),{'body':_0x48b4ee,'log':_0xa624('0x2')});};exports[_0xa624('0x3')]=function(_0x5b55d0,_0x5d780c){return client[_0xa624('0x1')]('UpdateSmsQueueReport',{'body':_0x5d780c,'options':{'where':{'uniqueid':_0x5b55d0},'order':[['id','DESC']],'limit':0x1},'log':_0xa624('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index adff425..1975a1b 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 _0x438e=['getAgents','Request','name','online','pauseType','lastPauseAt','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatCapacity','mailCapacity','openchannelCapacity','../client'];(function(_0x2cbc97,_0x138d19){var _0x252f91=function(_0x56d978){while(--_0x56d978){_0x2cbc97['push'](_0x2cbc97['shift']());}};_0x252f91(++_0x138d19);}(_0x438e,0x167));var _0xe438=function(_0x1cbcf1,_0x3f9fd9){_0x1cbcf1=_0x1cbcf1-0x0;var _0x3a06f0=_0x438e[_0x1cbcf1];return _0x3a06f0;};'use strict';var client=require(_0xe438('0x0'));exports[_0xe438('0x1')]=function(){return function(){return client[_0xe438('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0xe438('0x3'),_0xe438('0x4'),_0xe438('0x5'),_0xe438('0x6'),'voicePause',_0xe438('0x7'),_0xe438('0x8'),_0xe438('0x9'),_0xe438('0xa'),_0xe438('0xb'),_0xe438('0xc'),_0xe438('0xd'),'faxCapacity','smsCapacity',_0xe438('0xe')]},'log':'getAgents'});};}; \ No newline at end of file +var _0x54f7=['chatCapacity','mailCapacity','faxCapacity','smsCapacity','openchannelCapacity','../client','getAgents','Request','agent','name','online','lastPauseAt','voicePause','chatPause','smsPause','openchannelPause'];(function(_0x567883,_0x3e80ca){var _0x5429d8=function(_0x1486bc){while(--_0x1486bc){_0x567883['push'](_0x567883['shift']());}};_0x5429d8(++_0x3e80ca);}(_0x54f7,0x85));var _0x754f=function(_0x5b3117,_0xdc252d){_0x5b3117=_0x5b3117-0x0;var _0x934b63=_0x54f7[_0x5b3117];return _0x934b63;};'use strict';var client=require(_0x754f('0x0'));exports[_0x754f('0x1')]=function(){return function(){return client[_0x754f('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':_0x754f('0x3')},'attributes':['id',_0x754f('0x4'),_0x754f('0x5'),'pauseType',_0x754f('0x6'),_0x754f('0x7'),_0x754f('0x8'),'mailPause','faxPause',_0x754f('0x9'),_0x754f('0xa'),_0x754f('0xb'),_0x754f('0xc'),_0x754f('0xd'),_0x754f('0xe'),_0x754f('0xf')]},'log':_0x754f('0x1')});};}; \ 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 739943d..b34f1c0 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 _0xcde6=['[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','join','stop','find','agents','channel','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','[%s][AGENT]\x20ROUTING\x20END','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','number','timeout\x20is\x20a\x20number','info','format'];(function(_0x5c7522,_0xe2f5a3){var _0x3a6f0a=function(_0xe2af07){while(--_0xe2af07){_0x5c7522['push'](_0x5c7522['shift']());}};_0x3a6f0a(++_0xe2f5a3);}(_0xcde6,0xc8));var _0x6cde=function(_0x552f5e,_0xf0e465){_0x552f5e=_0x552f5e-0x0;var _0x17c078=_0xcde6[_0x552f5e];return _0x17c078;};'use strict';var schema=require(_0x6cde('0x0'));var _=require(_0x6cde('0x1'));var util=require(_0x6cde('0x2'));var seqqueue=require(_0x6cde('0x3'));var logger=require(_0x6cde('0x4'))(_0x6cde('0x5'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':_0x6cde('0x6'),'message':_0x6cde('0x7')}});function writeLog(_0x369090,_0x55cbd7,_0x448c9b){return logger[_0x6cde('0x8')](util[_0x6cde('0x9')](_0x6cde('0xa'),_0x369090,_0x55cbd7[_0x6cde('0xb')],_0x448c9b));}function handleFindAgent(_0x5602b7){return function(_0xe68af4){return _0xe68af4['name'][_0x6cde('0xc')]()===_0x5602b7[_0x6cde('0xc')]();};}exports[_0x6cde('0xd')]=function(_0x38f32c,_0x5f3a3f,_0x58f01b,_0x43a3f1){return function(_0x50699e){try{var _0x156d6a={'name':_0x5f3a3f[0x0],'timeout':_0x5f3a3f[0x1]};var _0x2cbd58=queue[_0x6cde('0x0')](_0x156d6a,{'typecast':!![]});if(_0x2cbd58[_0x6cde('0xe')]){logger[_0x6cde('0xf')](_0x6cde('0x10'),_0x38f32c,_['map'](_0x2cbd58,_0x6cde('0x11'))[_0x6cde('0x12')](',\x20'));_0x50699e[_0x6cde('0x13')]();}else{var _0x28841b=_[_0x6cde('0x14')](_0x58f01b[_0x6cde('0x15')],handleFindAgent(_0x156d6a['name']));if(_0x28841b){var _0x3073ce=(_0x156d6a['timeout']||0xa)*0x3e8;var _0x582fc1,_0x54f8e2;var _0x491984=seqqueue['createQueue'](_0x3073ce);_0x491984['id']=_0x38f32c;_0x491984['atimeout']=_0x3073ce;_0x491984[_0x6cde('0x16')]=_0x43a3f1[_0x6cde('0x16')];writeLog(_0x38f32c,_0x28841b,util[_0x6cde('0x9')](_0x6cde('0x17'),_0x3073ce));_0x58f01b[_0x6cde('0x18')][_0x38f32c]['on'](_0x6cde('0x19'),function(){logger[_0x6cde('0x8')](_0x6cde('0x1a'),_0x38f32c);clearTimeout(_0x54f8e2);_0x54f8e2=undefined;_0x491984[_0x6cde('0x1b')]();if(_0x58f01b[_0x6cde('0x18')][_0x38f32c]){delete _0x58f01b[_0x6cde('0x18')][_0x38f32c];}_0x50699e[_0x6cde('0x13')]();});_0x58f01b['rules'][_0x38f32c]['on'](_0x6cde('0x1c'),function(){if(_0x58f01b[_0x6cde('0x18')][_0x38f32c]){delete _0x58f01b[_0x6cde('0x18')][_0x38f32c];}});_0x54f8e2=setTimeout(function(){logger[_0x6cde('0x8')](_0x6cde('0x1d'),_0x38f32c);clearTimeout(_0x54f8e2);_0x491984[_0x6cde('0x1b')]();_0x50699e[_0x6cde('0x1e')]();},_0x3073ce);strategy[_0x6cde('0x1f')](_0x491984,_0x28841b,_0x58f01b,_0x43a3f1);}else{logger[_0x6cde('0xf')](_0x6cde('0x20'),_0x38f32c,_0x156d6a[_0x6cde('0xb')]);_0x50699e[_0x6cde('0x13')]();}}}catch(_0x119862){console[_0x6cde('0x21')](_0x119862);logger[_0x6cde('0xf')]('[%s][QUEUE]\x20%s',_0x38f32c,_0x119862[_0x6cde('0x22')]);_0x50699e['stop']();}};}; \ No newline at end of file +var _0x847a=['stack','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','message','agents','createQueue','atimeout','START:%s','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','close','complete','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s'];(function(_0x1d1823,_0x3bdc9c){var _0x202e3c=function(_0x1ae44f){while(--_0x1ae44f){_0x1d1823['push'](_0x1d1823['shift']());}};_0x202e3c(++_0x3bdc9c);}(_0x847a,0x81));var _0xa847=function(_0x521c78,_0x515d3f){_0x521c78=_0x521c78-0x0;var _0x255fff=_0x847a[_0x521c78];return _0x255fff;};'use strict';var schema=require(_0xa847('0x0'));var _=require(_0xa847('0x1'));var util=require(_0xa847('0x2'));var seqqueue=require(_0xa847('0x3'));var logger=require(_0xa847('0x4'))(_0xa847('0x5'));var strategy=require(_0xa847('0x6'));var queue=schema({'name':{'type':_0xa847('0x7'),'required':!![],'message':_0xa847('0x8')},'timeout':{'type':'number','message':'timeout\x20is\x20a\x20number'}});function writeLog(_0x54e352,_0x2dcfc0,_0x491ede){return logger[_0xa847('0x9')](util[_0xa847('0xa')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x54e352,_0x2dcfc0[_0xa847('0xb')],_0x491ede));}function handleFindAgent(_0x63bd9a){return function(_0x101539){return _0x101539[_0xa847('0xb')]['toLowerCase']()===_0x63bd9a[_0xa847('0xc')]();};}exports[_0xa847('0xd')]=function(_0x56247b,_0x123a12,_0x3678ad,_0x1bb3af){return function(_0x1f2878){try{var _0xb56607={'name':_0x123a12[0x0],'timeout':_0x123a12[0x1]};var _0x237162=queue[_0xa847('0x0')](_0xb56607,{'typecast':!![]});if(_0x237162[_0xa847('0xe')]){logger[_0xa847('0xf')](_0xa847('0x10'),_0x56247b,_['map'](_0x237162,_0xa847('0x11'))['join'](',\x20'));_0x1f2878['stop']();}else{var _0x13ed41=_['find'](_0x3678ad[_0xa847('0x12')],handleFindAgent(_0xb56607[_0xa847('0xb')]));if(_0x13ed41){var _0x106bac=(_0xb56607['timeout']||0xa)*0x3e8;var _0x16e71f,_0x1bee92;var _0xf1bc4d=seqqueue[_0xa847('0x13')](_0x106bac);_0xf1bc4d['id']=_0x56247b;_0xf1bc4d[_0xa847('0x14')]=_0x106bac;_0xf1bc4d['channel']=_0x1bb3af['channel'];writeLog(_0x56247b,_0x13ed41,util[_0xa847('0xa')](_0xa847('0x15'),_0x106bac));_0x3678ad[_0xa847('0x16')][_0x56247b]['on'](_0xa847('0x17'),function(){logger[_0xa847('0x9')](_0xa847('0x18'),_0x56247b);clearTimeout(_0x1bee92);_0x1bee92=undefined;_0xf1bc4d[_0xa847('0x19')]();if(_0x3678ad[_0xa847('0x16')][_0x56247b]){delete _0x3678ad[_0xa847('0x16')][_0x56247b];}_0x1f2878['stop']();});_0x3678ad[_0xa847('0x16')][_0x56247b]['on'](_0xa847('0x1a'),function(){if(_0x3678ad[_0xa847('0x16')][_0x56247b]){delete _0x3678ad[_0xa847('0x16')][_0x56247b];}});_0x1bee92=setTimeout(function(){logger[_0xa847('0x9')]('[%s][AGENT]\x20ROUTING\x20END',_0x56247b);clearTimeout(_0x1bee92);_0xf1bc4d[_0xa847('0x19')]();_0x1f2878['next']();},_0x106bac);strategy[_0xa847('0x1b')](_0xf1bc4d,_0x13ed41,_0x3678ad,_0x1bb3af);}else{logger[_0xa847('0xf')](_0xa847('0x1c'),_0x56247b,_0xb56607[_0xa847('0xb')]);_0x1f2878['stop']();}}}catch(_0x598bfe){console[_0xa847('0x1d')](_0x598bfe);logger[_0xa847('0xf')](_0xa847('0x1e'),_0x56247b,_0x598bfe[_0xa847('0x1f')]);_0x1f2878['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/amazonlex.js b/server/services/routing/server/applications/amazonlex.js index a250cef..33024fc 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 _0xa407=['$LATEST','message','toString','postText','next','amazonlex','create','dialogState','Failed','catch','moment','aws-sdk','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','out','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','isEmpty','body','getMustacheRender','Message','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime'];(function(_0x2d9e27,_0x5965b2){var _0xd35381=function(_0x343d18){while(--_0x343d18){_0x2d9e27['push'](_0x2d9e27['shift']());}};_0xd35381(++_0x5965b2);}(_0xa407,0x64));var _0x7a40=function(_0xdb61ca,_0x158540){_0xdb61ca=_0xdb61ca-0x0;var _0x42c484=_0xa407[_0xdb61ca];return _0x42c484;};'use strict';var _=require('lodash');var moment=require(_0x7a40('0x0'));var AWS=require(_0x7a40('0x1'));var utils=require('./utils');var logger=require(_0x7a40('0x2'))(_0x7a40('0x3'));var rpc={'chatMessage':require(_0x7a40('0x4')),'openchannelMessage':require(_0x7a40('0x5')),'mailMessage':require(_0x7a40('0x6')),'smsMessage':require(_0x7a40('0x7')),'faxMessage':require(_0x7a40('0x8'))};exports[_0x7a40('0x9')]=function(_0x3b1414,_0x160270){return function(_0x3b948b){try{if(!_[_0x7a40('0xa')](this[_0x7a40('0xb')][_0x7a40('0xc')])){logger[_0x7a40('0xd')](_0x7a40('0xe'),_0x3b1414,_0x7a40('0xf'));return _0x3b948b['next']();}var _0x1061de={'ContactId':this[_0x7a40('0x10')]['id'],'sentAt':moment()[_0x7a40('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x7a40('0x12')};var _0x27d609=this[_0x7a40('0x13')];if(_0x27d609===_0x7a40('0x14')){_0x1061de[_0x7a40('0x15')]=this[_0x7a40('0x16')]['id'];}else{_0x1061de[_[_0x7a40('0x17')](_0x27d609)+_0x7a40('0x18')]=this['account']['id'];}_0x1061de[_[_0x7a40('0x17')](_0x27d609)+'InteractionId']=this[_0x7a40('0xb')]['id'];if(this[_0x7a40('0xb')]['created']){var _0x234764=_0x160270[0x4];if(!_[_0x7a40('0x19')](_0x234764)){_0x1061de[_0x7a40('0x1a')]=utils[_0x7a40('0x1b')](_0x234764,this);return rpc[_0x27d609+_0x7a40('0x1c')]['create'](_0x1061de)['then'](function(_0xd060b8){logger[_0x7a40('0xd')](_0x7a40('0xe'),_0x3b1414,_0x1061de[_0x7a40('0x1a')]);})['catch'](function(_0x3f56b1){logger[_0x7a40('0x1d')](_0x7a40('0xe'),_0x3b1414,JSON[_0x7a40('0x1e')](_0x3f56b1));})['finally'](function(){logger[_0x7a40('0xd')](_0x7a40('0x1f'),_0x3b1414);_0x3b948b[_0x7a40('0x20')]();});}else{logger['info'](_0x7a40('0x21'),_0x3b1414);_0x3b948b[_0x7a40('0x20')]();}}else{var _0x39117d=this;var _0x551974=new AWS[(_0x7a40('0x22'))]({'accessKeyId':_0x160270[0x0],'secretAccessKey':_0x160270[0x1],'region':_0x160270[0x2]});var _0x1a669d={'botAlias':_0x7a40('0x23'),'botName':_0x160270[0x3],'inputText':this[_0x7a40('0x24')][_0x7a40('0x1a')],'userId':this['interaction']['id'][_0x7a40('0x25')]()};_0x551974[_0x7a40('0x26')](_0x1a669d,function(_0x120897,_0xe82adb){if(_0x120897){logger[_0x7a40('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3b1414,_0x120897['message']);_0x3b948b[_0x7a40('0x27')]();}else if(_0xe82adb&&_0xe82adb[_0x7a40('0x24')]){_0x39117d[_0x7a40('0x1a')][_0x7a40('0x28')]=_0xe82adb;_0x1061de[_0x7a40('0x1a')]=_0xe82adb['message'];return rpc[_0x27d609+_0x7a40('0x1c')][_0x7a40('0x29')](_0x1061de)['then'](function(_0x16bcd1){logger['info']('[%s][AMAZONLEX]\x20%s',_0x3b1414,_0x1061de[_0x7a40('0x1a')]);if(_0xe82adb[_0x7a40('0x2a')]==_0x7a40('0x2b')){_0x3b948b[_0x7a40('0x27')]();}else{_0x3b948b[_0x7a40('0x20')]();}})[_0x7a40('0x2c')](function(_0x4e89ae){logger[_0x7a40('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3b1414,JSON['stringify'](_0x4e89ae));_0x3b948b[_0x7a40('0x27')]();});}else{_0x3b948b['next']();}});}}catch(_0x353f13){logger[_0x7a40('0x1d')](_0x7a40('0xe'),_0x3b1414,JSON[_0x7a40('0x1e')](_0x353f13));_0x3b948b['stop']();}};}; \ No newline at end of file +var _0x48ec=['../../../../config/logger','routing','../../rpc/openchannelMessage','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','account','upperFirst','AccountId','InteractionId','created','isEmpty','body','Message','create','then','[%s][AMAZONLEX]\x20%s','catch','error','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','$LATEST','postText','message','amazonlex','dialogState','Failed','lodash','moment','aws-sdk','./utils'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x48ec,0x196));var _0xc48e=function(_0xe1b14b,_0x275799){_0xe1b14b=_0xe1b14b-0x0;var _0x21da52=_0x48ec[_0xe1b14b];return _0x21da52;};'use strict';var _=require(_0xc48e('0x0'));var moment=require(_0xc48e('0x1'));var AWS=require(_0xc48e('0x2'));var utils=require(_0xc48e('0x3'));var logger=require(_0xc48e('0x4'))(_0xc48e('0x5'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xc48e('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports['consequence']=function(_0x3e1b36,_0xb953aa){return function(_0xd5317e){try{if(!_[_0xc48e('0x7')](this[_0xc48e('0x8')][_0xc48e('0x9')])){logger[_0xc48e('0xa')]('[%s][AMAZONLEX]\x20%s',_0x3e1b36,_0xc48e('0xb'));return _0xd5317e[_0xc48e('0xc')]();}var _0x32f409={'ContactId':this['contact']['id'],'sentAt':moment()['format'](_0xc48e('0xd')),'direction':_0xc48e('0xe')};var _0x42057b=this[_0xc48e('0xf')];if(_0x42057b===_0xc48e('0x10')){_0x32f409['ChatWebsiteId']=this[_0xc48e('0x11')]['id'];}else{_0x32f409[_[_0xc48e('0x12')](_0x42057b)+_0xc48e('0x13')]=this[_0xc48e('0x11')]['id'];}_0x32f409[_[_0xc48e('0x12')](_0x42057b)+_0xc48e('0x14')]=this[_0xc48e('0x8')]['id'];if(this[_0xc48e('0x8')][_0xc48e('0x15')]){var _0x33cb96=_0xb953aa[0x4];if(!_[_0xc48e('0x16')](_0x33cb96)){_0x32f409[_0xc48e('0x17')]=utils['getMustacheRender'](_0x33cb96,this);return rpc[_0x42057b+_0xc48e('0x18')][_0xc48e('0x19')](_0x32f409)[_0xc48e('0x1a')](function(_0x5b64b3){logger['info'](_0xc48e('0x1b'),_0x3e1b36,_0x32f409[_0xc48e('0x17')]);})[_0xc48e('0x1c')](function(_0x51a034){logger[_0xc48e('0x1d')](_0xc48e('0x1b'),_0x3e1b36,JSON[_0xc48e('0x1e')](_0x51a034));})[_0xc48e('0x1f')](function(){logger[_0xc48e('0xa')](_0xc48e('0x20'),_0x3e1b36);_0xd5317e['stop']();});}else{logger['info'](_0xc48e('0x21'),_0x3e1b36);_0xd5317e[_0xc48e('0x22')]();}}else{var _0x167e32=this;var _0x260396=new AWS['LexRuntime']({'accessKeyId':_0xb953aa[0x0],'secretAccessKey':_0xb953aa[0x1],'region':_0xb953aa[0x2]});var _0x1c6a67={'botAlias':_0xc48e('0x23'),'botName':_0xb953aa[0x3],'inputText':this['message'][_0xc48e('0x17')],'userId':this[_0xc48e('0x8')]['id']['toString']()};_0x260396[_0xc48e('0x24')](_0x1c6a67,function(_0x22c8fe,_0x360139){if(_0x22c8fe){logger[_0xc48e('0x1d')](_0xc48e('0x1b'),_0x3e1b36,_0x22c8fe[_0xc48e('0x25')]);_0xd5317e[_0xc48e('0xc')]();}else if(_0x360139&&_0x360139[_0xc48e('0x25')]){_0x167e32[_0xc48e('0x17')][_0xc48e('0x26')]=_0x360139;_0x32f409[_0xc48e('0x17')]=_0x360139['message'];return rpc[_0x42057b+_0xc48e('0x18')][_0xc48e('0x19')](_0x32f409)[_0xc48e('0x1a')](function(_0x1ee536){logger[_0xc48e('0xa')](_0xc48e('0x1b'),_0x3e1b36,_0x32f409['body']);if(_0x360139[_0xc48e('0x27')]==_0xc48e('0x28')){_0xd5317e['next']();}else{_0xd5317e[_0xc48e('0x22')]();}})[_0xc48e('0x1c')](function(_0x2a3090){logger['error'](_0xc48e('0x1b'),_0x3e1b36,JSON['stringify'](_0x2a3090));_0xd5317e[_0xc48e('0xc')]();});}else{_0xd5317e['next']();}});}}catch(_0x17aaf7){logger[_0xc48e('0x1d')]('[%s][AMAZONLEX]\x20%s',_0x3e1b36,JSON[_0xc48e('0x1e')](_0x17aaf7));_0xd5317e[_0xc48e('0x22')]();}};}; \ 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 3d1add5..48fe345 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 _0x70e0=['from','phone','subject','startsWith','Re:','chat','ChatWebsiteId','upperFirst','AccountId','account','Message','Smtp','service','host','port','secure','authentication','user','pass','inReplyTo','html','','replace','','sendMailMessage','[%s][AUTOREPLY]\x20SMTP\x20SENT','messageId','then','error','finally','next','create','body','catch','stringify','stop','lodash','moment','./utils','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../mailRpc','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','channel','getMustacheRender','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','message'];(function(_0x8cb1fa,_0x2a1ab3){var _0x309018=function(_0x2ae4b5){while(--_0x2ae4b5){_0x8cb1fa['push'](_0x8cb1fa['shift']());}};_0x309018(++_0x2a1ab3);}(_0x70e0,0x17b));var _0x070e=function(_0x4f1c7f,_0x2d0530){_0x4f1c7f=_0x4f1c7f-0x0;var _0x174787=_0x70e0[_0x4f1c7f];return _0x174787;};'use strict';var _=require(_0x070e('0x0'));var moment=require(_0x070e('0x1'));var utils=require(_0x070e('0x2'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x070e('0x3')),'openchannelMessage':require(_0x070e('0x4')),'mailMessage':require(_0x070e('0x5')),'smsMessage':require(_0x070e('0x6')),'faxMessage':require('../../rpc/faxMessage')};var mailRpc=require(_0x070e('0x7'));exports['consequence']=function(_0x46fe68,_0x4b041d){return function(_0x56e420){try{if(_0x4b041d[0x0]==='1'&&(_['isNil'](this[_0x070e('0x8')][_0x070e('0x9')])||!this[_0x070e('0x8')][_0x070e('0x9')])){logger[_0x070e('0xa')](_0x070e('0xb'),_0x46fe68,_0x070e('0xc'));return _0x56e420['next']();}var _0x49b2fb=this[_0x070e('0xd')];var _0x2e3e5e={'body':utils[_0x070e('0xe')](_0x4b041d[0x1],this),'ContactId':this[_0x070e('0xf')]['id'],'sentAt':moment()[_0x070e('0x10')](_0x070e('0x11')),'direction':_0x070e('0x12')};if(this[_0x070e('0x13')]){_0x2e3e5e['to']=this[_0x070e('0x13')][_0x070e('0x14')]||'';_0x2e3e5e['cc']=this[_0x070e('0x13')]['cc']||'';_0x2e3e5e['from']=this['message']['to']||'';_0x2e3e5e[_0x070e('0x15')]=this['message']['phone']||'';_0x2e3e5e['read']=!![];if(this[_0x070e('0x13')][_0x070e('0x16')]){_0x2e3e5e['subject']='';_0x2e3e5e['subject']+=_[_0x070e('0x17')](this[_0x070e('0x13')][_0x070e('0x16')],_0x070e('0x18'))?'':'Re:\x20';_0x2e3e5e['subject']+=this[_0x070e('0x13')][_0x070e('0x16')];}}if(this[_0x070e('0xd')]===_0x070e('0x19')){_0x2e3e5e[_0x070e('0x1a')]=this['account']['id'];}else{_0x2e3e5e[_[_0x070e('0x1b')](this[_0x070e('0xd')])+_0x070e('0x1c')]=this[_0x070e('0x1d')]['id'];}_0x2e3e5e[_[_0x070e('0x1b')](this['channel'])+'InteractionId']=this['interaction']['id'];if(rpc[this[_0x070e('0xd')]+_0x070e('0x1e')]){if(this[_0x070e('0xd')]==='mail'){var _0x5b184={'tls':{'rejectUnauthorized':![]}};if(this['account'][_0x070e('0x1f')][_0x070e('0x20')]){_0x5b184[_0x070e('0x20')]=this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x20')];}else{_0x5b184[_0x070e('0x21')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x21')];_0x5b184[_0x070e('0x22')]=this[_0x070e('0x1d')]['Smtp'][_0x070e('0x22')];_0x5b184['secure']=this['account'][_0x070e('0x1f')][_0x070e('0x23')];}if(this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x24')]){_0x5b184['auth']={'user':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x25')],'pass':this[_0x070e('0x1d')][_0x070e('0x1f')][_0x070e('0x26')]};}_0x2e3e5e[_0x070e('0x27')]=this[_0x070e('0x13')]['messageId'];_0x2e3e5e[_0x070e('0x28')]=_0x070e('0x29')+_[_0x070e('0x2a')](_0x2e3e5e['body'],''+_[_0x0a9e('0x29')](_0xbd1168[_0x0a9e('0x2a')],_0x0a9e('0x2b'),_0x0a9e('0x2c'))+'';return mailRpc[_0x0a9e('0x2d')](_0x20f109,_0xbd1168)[_0x0a9e('0x2e')](function(_0x1843b2){logger[_0x0a9e('0x2f')](_0x0a9e('0x30'),_0x57b080);_0xbd1168[_0x0a9e('0x27')]=_0x1843b2[_0x0a9e('0x10')][_0x0a9e('0x27')];return rpc[_0x3ab53f+_0x0a9e('0x1d')]['create'](_0xbd1168);})[_0x0a9e('0x2e')](function(_0x5d1e0e){logger[_0x0a9e('0x2f')](_0x0a9e('0xb'),_0x57b080,JSON[_0x0a9e('0x31')](_0x5d1e0e));})[_0x0a9e('0x32')](function(_0x25ce3a){logger['error'](_0x0a9e('0x33'),_0x57b080,JSON[_0x0a9e('0x31')](_0x25ce3a));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}else{return rpc[this[_0x0a9e('0xe')]+_0x0a9e('0x1d')][_0x0a9e('0x35')](_0xbd1168)[_0x0a9e('0x2e')](function(_0x5583a4){logger[_0x0a9e('0x2f')]('[%s][AUTOREPLY]\x20%s',_0x57b080,_0xbd1168[_0x0a9e('0x2a')]);})[_0x0a9e('0x32')](function(_0x2b7e7f){logger[_0x0a9e('0x36')]('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x2b7e7f));})[_0x0a9e('0x34')](function(){_0x441e3a[_0x0a9e('0xd')]();});}}}catch(_0x15de0e){logger['error']('[%s][AUTOREPLY]\x20%s',_0x57b080,JSON[_0x0a9e('0x31')](_0x15de0e));_0x441e3a['stop']();}};}; \ 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 b7e9065..70ab787 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 _0xe98f=['[%s][CLOSE]\x20%s','stop','moment','routing','../../rpc/openchannelInteraction','../../rpc/smsInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','system','channel','Interaction','update','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally'];(function(_0x82129b,_0x484ae9){var _0x2ae5dc=function(_0x299e34){while(--_0x299e34){_0x82129b['push'](_0x82129b['shift']());}};_0x2ae5dc(++_0x484ae9);}(_0xe98f,0xde));var _0xfe98=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xe98f[_0x42cae2];return _0x5f256f;};'use strict';var moment=require(_0xfe98('0x0'));var logger=require('../../../../config/logger')(_0xfe98('0x1'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0xfe98('0x2')),'smsInteraction':require(_0xfe98('0x3')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require('../../rpc/faxInteraction')};exports[_0xfe98('0x4')]=function(_0x5efd60,_0xabc73f,_0x1e8d17,_0x4a2baa){return function(_0x3aab59){try{logger['info'](_0xfe98('0x5'),_0x5efd60,_0xabc73f[0x0]);var _0x2721d1={'closed':0x1,'closedAt':moment()[_0xfe98('0x6')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':_0xfe98('0x7'),'disposition':_0xabc73f[0x0]};if(rpc[_0x4a2baa[_0xfe98('0x8')]+'Interaction']){rpc[_0x4a2baa[_0xfe98('0x8')]+_0xfe98('0x9')][_0xfe98('0xa')](_0x4a2baa[_0xfe98('0xb')]['id'],_0x2721d1)[_0xfe98('0xc')](function(_0x25cf67){logger['info'](_0xfe98('0xd'),_0x5efd60,_0x4a2baa[_0xfe98('0xb')]['id']);})[_0xfe98('0xe')](function(_0x53692c){logger[_0xfe98('0xf')]('[%s][CLOSE]\x20%s',_0x5efd60,JSON[_0xfe98('0x10')](_0x53692c));})[_0xfe98('0x11')](function(){_0x3aab59['stop']();});}}catch(_0x1d03c4){logger['error'](_0xfe98('0x12'),_0x5efd60,JSON[_0xfe98('0x10')](_0x1d03c4));_0x3aab59[_0xfe98('0x13')]();}};}; \ No newline at end of file +var _0x73a1=['stop','routing','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','consequence','info','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','stringify','finally','[%s][CLOSE]\x20%s'];(function(_0x4c1be6,_0x134eeb){var _0x4f453c=function(_0x197fc1){while(--_0x197fc1){_0x4c1be6['push'](_0x4c1be6['shift']());}};_0x4f453c(++_0x134eeb);}(_0x73a1,0x161));var _0x173a=function(_0x44fef1,_0x132cf4){_0x44fef1=_0x44fef1-0x0;var _0x3c3a04=_0x73a1[_0x44fef1];return _0x3c3a04;};'use strict';var moment=require('moment');var logger=require('../../../../config/logger')(_0x173a('0x0'));var rpc={'chatInteraction':require(_0x173a('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x173a('0x2')),'mailInteraction':require(_0x173a('0x3')),'faxInteraction':require(_0x173a('0x4'))};exports[_0x173a('0x5')]=function(_0x4a3f0f,_0x57edf4,_0x417ec0,_0x1a8b94){return function(_0xac84a){try{logger[_0x173a('0x6')](_0x173a('0x7'),_0x4a3f0f,_0x57edf4[0x0]);var _0x550e2b={'closed':0x1,'closedAt':moment()[_0x173a('0x8')](_0x173a('0x9')),'closeReason':_0x173a('0xa'),'disposition':_0x57edf4[0x0]};if(rpc[_0x1a8b94[_0x173a('0xb')]+_0x173a('0xc')]){rpc[_0x1a8b94[_0x173a('0xb')]+'Interaction'][_0x173a('0xd')](_0x1a8b94['interaction']['id'],_0x550e2b)[_0x173a('0xe')](function(_0x101aeb){logger[_0x173a('0x6')](_0x173a('0xf'),_0x4a3f0f,_0x1a8b94['interaction']['id']);})[_0x173a('0x10')](function(_0x53bfd0){logger[_0x173a('0x11')]('[%s][CLOSE]\x20%s',_0x4a3f0f,JSON[_0x173a('0x12')](_0x53bfd0));})[_0x173a('0x13')](function(){_0xac84a['stop']();});}}catch(_0x1cbfdc){logger[_0x173a('0x11')](_0x173a('0x14'),_0x4a3f0f,JSON[_0x173a('0x12')](_0x1cbfdc));_0xac84a[_0x173a('0x15')]();}};}; \ 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 17ea3ff..d8c9348 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 _0x2ae5=['Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','out','channel','chat','ChatWebsiteId','account','AccountId','InteractionId','body','create','then','stringify','finally','stop','textRequest','message','dialogflow','result','fulfillment','speech','catch','error','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','interaction','UserId','info','[%s][DIALOGFLOW]\x20%s'];(function(_0x4dbbf5,_0x10588d){var _0x140bdf=function(_0x3e8b41){while(--_0x3e8b41){_0x4dbbf5['push'](_0x4dbbf5['shift']());}};_0x140bdf(++_0x10588d);}(_0x2ae5,0xb0));var _0x52ae=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x2ae5[_0x580576];return _0x3f55a0;};'use strict';var _=require('lodash');var moment=require(_0x52ae('0x0'));var apiai=require(_0x52ae('0x1'));var md5=require(_0x52ae('0x2'));var utils=require(_0x52ae('0x3'));var logger=require(_0x52ae('0x4'))(_0x52ae('0x5'));var rpc={'chatMessage':require(_0x52ae('0x6')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x52ae('0x7')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0x52ae('0x8'))};exports[_0x52ae('0x9')]=function(_0x27761d,_0x2f35a4){return function(_0xa96798){try{if(!_['isNil'](this[_0x52ae('0xa')][_0x52ae('0xb')])){logger[_0x52ae('0xc')](_0x52ae('0xd'),_0x27761d,_0x52ae('0xe'));return _0xa96798[_0x52ae('0xf')]();}var _0x55ac06={'ContactId':this[_0x52ae('0x10')]['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x52ae('0x11')};var _0x6684eb=this[_0x52ae('0x12')];if(_0x6684eb===_0x52ae('0x13')){_0x55ac06[_0x52ae('0x14')]=this[_0x52ae('0x15')]['id'];}else{_0x55ac06[_['upperFirst'](_0x6684eb)+_0x52ae('0x16')]=this[_0x52ae('0x15')]['id'];}_0x55ac06[_['upperFirst'](_0x6684eb)+_0x52ae('0x17')]=this[_0x52ae('0xa')]['id'];if(this[_0x52ae('0xa')]['created']){var _0x56038e=_0x2f35a4[0x2];if(!_['isEmpty'](_0x56038e)){_0x55ac06[_0x52ae('0x18')]=utils['getMustacheRender'](_0x56038e,this);return rpc[_0x6684eb+'Message'][_0x52ae('0x19')](_0x55ac06)[_0x52ae('0x1a')](function(_0x398cbf){logger[_0x52ae('0xc')]('[%s][DIALOGFLOW]\x20%s',_0x27761d,_0x55ac06[_0x52ae('0x18')]);})['catch'](function(_0xc0c0e8){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x27761d,JSON[_0x52ae('0x1b')](_0xc0c0e8));})[_0x52ae('0x1c')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x27761d);_0xa96798[_0x52ae('0x1d')]();});}else{logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x27761d);_0xa96798[_0x52ae('0x1d')]();}}else{var _0x364533=this;var _0x431cc1=apiai(_0x2f35a4[0x0],{'language':_0x2f35a4[0x1]||'en'});return _0x431cc1[_0x52ae('0x1e')](this[_0x52ae('0x1f')][_0x52ae('0x18')],{'sessionId':md5(this[_0x52ae('0xa')]['id'])})[_0x52ae('0x1a')](function(_0xfa2de1){_0x364533[_0x52ae('0x18')][_0x52ae('0x20')]=_0xfa2de1;_0x55ac06['body']=_0xfa2de1[_0x52ae('0x21')][_0x52ae('0x22')][_0x52ae('0x23')];return rpc[_0x6684eb+'Message'][_0x52ae('0x19')](_0x55ac06)[_0x52ae('0x1a')](function(_0x31180e){logger[_0x52ae('0xc')](_0x52ae('0xd'),_0x27761d,_0x55ac06['body']);if(_0xfa2de1[_0x52ae('0x21')]['metadata']['endConversation']){_0xa96798[_0x52ae('0xf')]();}else{_0xa96798[_0x52ae('0x1d')]();}})[_0x52ae('0x24')](function(_0x48659f){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x27761d,JSON[_0x52ae('0x1b')](_0x48659f));_0xa96798[_0x52ae('0xf')]();});})[_0x52ae('0x24')](function(_0xd8eb05){logger[_0x52ae('0x25')](_0x52ae('0xd'),_0x27761d,_0xd8eb05['message']);_0xa96798['next']();});}}catch(_0x1c7dff){logger[_0x52ae('0x25')](_0x52ae('0xd'),_0x27761d,JSON['stringify'](_0x1c7dff));_0xa96798[_0x52ae('0x1d')]();}};}; \ No newline at end of file +var _0x40a0=['lodash','apiai-promise','md5','./utils','../../rpc/chatMessage','consequence','info','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','chat','ChatWebsiteId','upperFirst','AccountId','account','InteractionId','interaction','created','isEmpty','body','getMustacheRender','Message','then','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','dialogflow','fulfillment','speech','create','result','metadata','endConversation','next','stop','catch','error'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x40a0,0x81));var _0x040a=function(_0x590851,_0x496bee){_0x590851=_0x590851-0x0;var _0x3b0115=_0x40a0[_0x590851];return _0x3b0115;};'use strict';var _=require(_0x040a('0x0'));var moment=require('moment');var apiai=require(_0x040a('0x1'));var md5=require(_0x040a('0x2'));var utils=require(_0x040a('0x3'));var logger=require('../../../../config/logger')('routing');var rpc={'chatMessage':require(_0x040a('0x4')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage')};exports[_0x040a('0x5')]=function(_0x331e94,_0x533f58){return function(_0xa9416f){try{if(!_['isNil'](this['interaction']['UserId'])){logger[_0x040a('0x6')](_0x040a('0x7'),_0x331e94,_0x040a('0x8'));return _0xa9416f['next']();}var _0x1e4297={'ContactId':this[_0x040a('0x9')]['id'],'sentAt':moment()[_0x040a('0xa')](_0x040a('0xb')),'direction':_0x040a('0xc')};var _0x191e55=this[_0x040a('0xd')];if(_0x191e55===_0x040a('0xe')){_0x1e4297[_0x040a('0xf')]=this['account']['id'];}else{_0x1e4297[_[_0x040a('0x10')](_0x191e55)+_0x040a('0x11')]=this[_0x040a('0x12')]['id'];}_0x1e4297[_[_0x040a('0x10')](_0x191e55)+_0x040a('0x13')]=this[_0x040a('0x14')]['id'];if(this[_0x040a('0x14')][_0x040a('0x15')]){var _0x45e203=_0x533f58[0x2];if(!_[_0x040a('0x16')](_0x45e203)){_0x1e4297[_0x040a('0x17')]=utils[_0x040a('0x18')](_0x45e203,this);return rpc[_0x191e55+_0x040a('0x19')]['create'](_0x1e4297)[_0x040a('0x1a')](function(_0x2a01bd){logger[_0x040a('0x6')]('[%s][DIALOGFLOW]\x20%s',_0x331e94,_0x1e4297[_0x040a('0x17')]);})['catch'](function(_0x443d66){logger['error'](_0x040a('0x7'),_0x331e94,JSON[_0x040a('0x1b')](_0x443d66));})[_0x040a('0x1c')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x331e94);_0xa9416f['stop']();});}else{logger[_0x040a('0x6')](_0x040a('0x1d'),_0x331e94);_0xa9416f['stop']();}}else{var _0x406c34=this;var _0x10922b=apiai(_0x533f58[0x0],{'language':_0x533f58[0x1]||'en'});return _0x10922b[_0x040a('0x1e')](this[_0x040a('0x1f')][_0x040a('0x17')],{'sessionId':md5(this[_0x040a('0x14')]['id'])})['then'](function(_0x50ad72){_0x406c34[_0x040a('0x17')][_0x040a('0x20')]=_0x50ad72;_0x1e4297[_0x040a('0x17')]=_0x50ad72['result'][_0x040a('0x21')][_0x040a('0x22')];return rpc[_0x191e55+'Message'][_0x040a('0x23')](_0x1e4297)['then'](function(_0x52d9f3){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x331e94,_0x1e4297['body']);if(_0x50ad72[_0x040a('0x24')][_0x040a('0x25')][_0x040a('0x26')]){_0xa9416f[_0x040a('0x27')]();}else{_0xa9416f[_0x040a('0x28')]();}})[_0x040a('0x29')](function(_0x2313ec){logger[_0x040a('0x2a')](_0x040a('0x7'),_0x331e94,JSON[_0x040a('0x1b')](_0x2313ec));_0xa9416f[_0x040a('0x27')]();});})[_0x040a('0x29')](function(_0x3cd0c8){logger['error'](_0x040a('0x7'),_0x331e94,_0x3cd0c8[_0x040a('0x1f')]);_0xa9416f['next']();});}}catch(_0x288e8a){logger[_0x040a('0x2a')](_0x040a('0x7'),_0x331e94,JSON[_0x040a('0x1b')](_0x288e8a));_0xa9416f[_0x040a('0x28')]();}};}; \ 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 0ae9156..7984ed8 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 _0xe937=['priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','next','findIndex','rules','info','[%s][GOTOIF]\x20eval\x20error:\x20%s','message','stringify','lodash','html-to-text','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','consequence','fromString','getMustacheRender','validate','length','error','[%s][GOTOIF]\x20%s','map','join','stop','condition'];(function(_0x5ac340,_0x23531b){var _0x4bca33=function(_0x5bed15){while(--_0x5bed15){_0x5ac340['push'](_0x5ac340['shift']());}};_0x4bca33(++_0x23531b);}(_0xe937,0x1ca));var _0x7e93=function(_0x15db76,_0x5e6e45){_0x15db76=_0x15db76-0x0;var _0xaa0486=_0xe937[_0x15db76];return _0xaa0486;};'use strict';var schema=require('validate');var _=require(_0x7e93('0x0'));var htmlToText=require(_0x7e93('0x1'));var utils=require('./utils');var logger=require(_0x7e93('0x2'))(_0x7e93('0x3'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x7e93('0x4')},'priorityTrue':{'type':_0x7e93('0x5'),'message':_0x7e93('0x6')},'priorityFalse':{'type':_0x7e93('0x5'),'message':'priority\x20false\x20is\x20a\x20number'}});exports[_0x7e93('0x7')]=function(_0x375c2d,_0x1775fb){return function(_0x1a2ea9){try{var _0x20df70={'condition':htmlToText[_0x7e93('0x8')](utils[_0x7e93('0x9')](_0x1775fb[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x1775fb[0x1],'priorityFalse':_0x1775fb[0x2]};var _0x1e447c=gotoif[_0x7e93('0xa')](_0x20df70,{'typecast':!![]});if(_0x1e447c[_0x7e93('0xb')]){logger[_0x7e93('0xc')](_0x7e93('0xd'),_0x375c2d,_[_0x7e93('0xe')](_0x1e447c,'message')[_0x7e93('0xf')](',\x20'));_0x1a2ea9[_0x7e93('0x10')]();}else{try{var _0x2f58ee=eval('('+_0x20df70[_0x7e93('0x11')]+')');var _0x2e674d=_0x2f58ee?_0x20df70[_0x7e93('0x12')]:_0x20df70[_0x7e93('0x13')];logger['info'](_0x7e93('0x14'),_0x375c2d,_0x20df70[_0x7e93('0x11')],_0x2f58ee,_0x2e674d||_0x7e93('0x15'));if(_0x2e674d){var _0x450501=_[_0x7e93('0x16')](_0x1a2ea9[_0x7e93('0x17')](),{'p':_0x2e674d});if(_0x450501>=0x0){logger[_0x7e93('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x375c2d,_0x2e674d||'next',_0x450501);_0x1a2ea9[_0x7e93('0x15')](_0x450501);}else{logger[_0x7e93('0x18')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x375c2d,_0x2e674d||_0x7e93('0x15'));_0x1a2ea9[_0x7e93('0x10')]();}}else{_0x1a2ea9['next']();}}catch(_0x3b005e){logger[_0x7e93('0xc')](_0x7e93('0x19'),_0x375c2d,_0x3b005e[_0x7e93('0x1a')]);_0x1a2ea9[_0x7e93('0x10')]();}}}catch(_0x208e0d){logger[_0x7e93('0xc')]('[%s][GOTOIF]\x20%s',_0x375c2d,JSON[_0x7e93('0x1b')](_0x208e0d));_0x1a2ea9[_0x7e93('0x10')]();}};}; \ No newline at end of file +var _0xa638=['condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','fromString','getMustacheRender','replace','validate','length','error','[%s][GOTOIF]\x20%s','map','message','join','stop','priorityTrue','priorityFalse','info','next','findIndex','rules','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','routing'];(function(_0x24fa1a,_0x16d9c2){var _0xc5621f=function(_0x5616ac){while(--_0x5616ac){_0x24fa1a['push'](_0x24fa1a['shift']());}};_0xc5621f(++_0x16d9c2);}(_0xa638,0xa7));var _0x8a63=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xa638[_0x5d2803];return _0xdcad2c;};'use strict';var schema=require('validate');var _=require('lodash');var htmlToText=require('html-to-text');var utils=require('./utils');var logger=require('../../../../config/logger')(_0x8a63('0x0'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x8a63('0x1')},'priorityTrue':{'type':_0x8a63('0x2'),'message':_0x8a63('0x3')},'priorityFalse':{'type':_0x8a63('0x2'),'message':_0x8a63('0x4')}});exports['consequence']=function(_0x54f856,_0x27f094){return function(_0x50784e){try{var _0x9bc197={'condition':htmlToText[_0x8a63('0x5')](utils[_0x8a63('0x6')](_0x27f094[0x0],this),{'wordwrap':![]})[_0x8a63('0x7')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x27f094[0x1],'priorityFalse':_0x27f094[0x2]};var _0x3f28e6=gotoif[_0x8a63('0x8')](_0x9bc197,{'typecast':!![]});if(_0x3f28e6[_0x8a63('0x9')]){logger[_0x8a63('0xa')](_0x8a63('0xb'),_0x54f856,_[_0x8a63('0xc')](_0x3f28e6,_0x8a63('0xd'))[_0x8a63('0xe')](',\x20'));_0x50784e[_0x8a63('0xf')]();}else{try{var _0x5e9d68=eval('('+_0x9bc197['condition']+')');var _0x120412=_0x5e9d68?_0x9bc197[_0x8a63('0x10')]:_0x9bc197[_0x8a63('0x11')];logger[_0x8a63('0x12')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x54f856,_0x9bc197['condition'],_0x5e9d68,_0x120412||_0x8a63('0x13'));if(_0x120412){var _0x1fea11=_[_0x8a63('0x14')](_0x50784e[_0x8a63('0x15')](),{'p':_0x120412});if(_0x1fea11>=0x0){logger[_0x8a63('0x12')](_0x8a63('0x16'),_0x54f856,_0x120412||'next',_0x1fea11);_0x50784e[_0x8a63('0x13')](_0x1fea11);}else{logger['info'](_0x8a63('0x17'),_0x54f856,_0x120412||_0x8a63('0x13'));_0x50784e['stop']();}}else{_0x50784e[_0x8a63('0x13')]();}}catch(_0x3c2116){logger[_0x8a63('0xa')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x54f856,_0x3c2116[_0x8a63('0xd')]);_0x50784e[_0x8a63('0xf')]();}}}catch(_0x57e9fa){logger['error'](_0x8a63('0xb'),_0x54f856,JSON['stringify'](_0x57e9fa));_0x50784e['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 12919e8..0ecf3b7 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 _0xa657=['priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stop','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','info'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0xa657,0x171));var _0x7a65=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa657[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x7a65('0x0'));var _=require(_0x7a65('0x1'));var logger=require(_0x7a65('0x2'))(_0x7a65('0x3'));var gotop=schema({'priority':{'type':_0x7a65('0x4'),'required':!![],'message':_0x7a65('0x5')}});exports[_0x7a65('0x6')]=function(_0x17c7d1,_0x1afdf2){return function(_0x5a2a0e){try{var _0x163a63={'priority':_0x1afdf2[0x0]};var _0x30670d=gotop[_0x7a65('0x0')](_0x163a63,{'typecast':!![]});if(_0x30670d[_0x7a65('0x7')]){logger[_0x7a65('0x8')](_0x7a65('0x9'),_0x17c7d1,_['map'](_0x30670d,'message')['join'](',\x20'));_0x5a2a0e['stop']();}else{logger[_0x7a65('0xa')]('[%s][GOTOP]\x20priority\x20%s',_0x17c7d1,_0x163a63[_0x7a65('0xb')]);if(_0x163a63['priority']){var _0x5c23be=_[_0x7a65('0xc')](_0x5a2a0e[_0x7a65('0xd')](),{'p':_0x163a63['priority']});if(_0x5c23be>=0x0){logger[_0x7a65('0xa')](_0x7a65('0xe'),_0x17c7d1,_0x163a63[_0x7a65('0xb')]||_0x7a65('0xf'),_0x5c23be);_0x5a2a0e[_0x7a65('0xf')](_0x5c23be);}else{logger[_0x7a65('0xa')](_0x7a65('0x10'),_0x17c7d1,_0x163a63[_0x7a65('0xb')]||_0x7a65('0xf'));_0x5a2a0e[_0x7a65('0x11')]();}}else{_0x5a2a0e[_0x7a65('0xf')]();}}}catch(_0x132180){logger['error'](_0x7a65('0x9'),_0x17c7d1,JSON[_0x7a65('0x12')](_0x132180));_0x5a2a0e[_0x7a65('0x11')]();}};}; \ No newline at end of file +var _0x95c0=['findIndex','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','validate','length','error','[%s][GOTOP]\x20%s','map','message','stop','info','priority'];(function(_0x1db1b5,_0x460358){var _0x19b558=function(_0x4258c0){while(--_0x4258c0){_0x1db1b5['push'](_0x1db1b5['shift']());}};_0x19b558(++_0x460358);}(_0x95c0,0x15b));var _0x095c=function(_0x3ec6c4,_0x1f6330){_0x3ec6c4=_0x3ec6c4-0x0;var _0x3926eb=_0x95c0[_0x3ec6c4];return _0x3926eb;};'use strict';var schema=require('validate');var _=require(_0x095c('0x0'));var logger=require(_0x095c('0x1'))(_0x095c('0x2'));var gotop=schema({'priority':{'type':_0x095c('0x3'),'required':!![],'message':_0x095c('0x4')}});exports['consequence']=function(_0x5821c3,_0x217394){return function(_0x330360){try{var _0x2601bf={'priority':_0x217394[0x0]};var _0x2ad681=gotop[_0x095c('0x5')](_0x2601bf,{'typecast':!![]});if(_0x2ad681[_0x095c('0x6')]){logger[_0x095c('0x7')](_0x095c('0x8'),_0x5821c3,_[_0x095c('0x9')](_0x2ad681,_0x095c('0xa'))['join'](',\x20'));_0x330360[_0x095c('0xb')]();}else{logger[_0x095c('0xc')]('[%s][GOTOP]\x20priority\x20%s',_0x5821c3,_0x2601bf['priority']);if(_0x2601bf[_0x095c('0xd')]){var _0x3108ca=_[_0x095c('0xe')](_0x330360['rules'](),{'p':_0x2601bf[_0x095c('0xd')]});if(_0x3108ca>=0x0){logger['info'](_0x095c('0xf'),_0x5821c3,_0x2601bf['priority']||'next',_0x3108ca);_0x330360[_0x095c('0x10')](_0x3108ca);}else{logger[_0x095c('0xc')](_0x095c('0x11'),_0x5821c3,_0x2601bf[_0x095c('0xd')]||_0x095c('0x10'));_0x330360[_0x095c('0xb')]();}}else{_0x330360['next']();}}}catch(_0x479c98){logger[_0x095c('0x7')](_0x095c('0x8'),_0x5821c3,JSON[_0x095c('0x12')](_0x479c98));_0x330360['stop']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/message.js b/server/services/routing/server/applications/message.js index 0ecfc4e..431bc7c 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 _0x402d=['body','next','catch','stringify','stop','[%s][MESSAGE]\x20%s','lodash','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','channel','ChatWebsiteId','account','AccountId','InteractionId','Message','then'];(function(_0xcfc7e3,_0x48be3d){var _0x7eb6f2=function(_0x4f8bf6){while(--_0x4f8bf6){_0xcfc7e3['push'](_0xcfc7e3['shift']());}};_0x7eb6f2(++_0x48be3d);}(_0x402d,0x1d4));var _0xd402=function(_0x14d8c3,_0x2b55a9){_0x14d8c3=_0x14d8c3-0x0;var _0x354f8f=_0x402d[_0x14d8c3];return _0x354f8f;};'use strict';var _=require(_0xd402('0x0'));var utils=require('./utils');var logger=require(_0xd402('0x1'))(_0xd402('0x2'));var rpc={'chatMessage':require(_0xd402('0x3')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xd402('0x4')),'smsMessage':require(_0xd402('0x5')),'faxMessage':require(_0xd402('0x6'))};exports[_0xd402('0x7')]=function(_0x296697,_0x8de136){return function(_0x2fd2ef){try{var _0x3802f2={'body':utils[_0xd402('0x8')](_0x8de136[0x0],this),'ContactId':this['contact']['id']};if(this[_0xd402('0x9')]==='chat'){_0x3802f2[_0xd402('0xa')]=this[_0xd402('0xb')]['id'];}else{_0x3802f2[_['upperFirst'](this[_0xd402('0x9')])+_0xd402('0xc')]=this['account']['id'];}_0x3802f2[_['upperFirst'](this[_0xd402('0x9')])+_0xd402('0xd')]=this['interaction']['id'];if(rpc[this[_0xd402('0x9')]+'Message']){return rpc[this['channel']+_0xd402('0xe')]['create'](_0x3802f2)[_0xd402('0xf')](function(_0x56efef){logger['info']('[%s][MESSAGE]\x20%s',_0x296697,_0x3802f2[_0xd402('0x10')]);_0x2fd2ef[_0xd402('0x11')]();})[_0xd402('0x12')](function(_0x5cacae){logger['error']('[%s][MESSAGE]\x20%s',_0x296697,JSON[_0xd402('0x13')](_0x5cacae));_0x2fd2ef[_0xd402('0x14')]();});}}catch(_0x582953){logger['error'](_0xd402('0x15'),_0x296697,JSON[_0xd402('0x13')](_0x582953));_0x2fd2ef['stop']();}};}; \ No newline at end of file +var _0xae8c=['../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','./utils'];(function(_0x4aedc7,_0x3ca446){var _0x5003ed=function(_0x5f078f){while(--_0x5f078f){_0x4aedc7['push'](_0x4aedc7['shift']());}};_0x5003ed(++_0x3ca446);}(_0xae8c,0x194));var _0xcae8=function(_0x50bbec,_0x33529a){_0x50bbec=_0x50bbec-0x0;var _0x396400=_0xae8c[_0x50bbec];return _0x396400;};'use strict';var _=require('lodash');var utils=require(_0xcae8('0x0'));var logger=require(_0xcae8('0x1'))(_0xcae8('0x2'));var rpc={'chatMessage':require(_0xcae8('0x3')),'openchannelMessage':require(_0xcae8('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xcae8('0x5'))};exports[_0xcae8('0x6')]=function(_0x2aae9b,_0x4848b8){return function(_0x1541e2){try{var _0x162ed6={'body':utils[_0xcae8('0x7')](_0x4848b8[0x0],this),'ContactId':this[_0xcae8('0x8')]['id']};if(this[_0xcae8('0x9')]===_0xcae8('0xa')){_0x162ed6[_0xcae8('0xb')]=this[_0xcae8('0xc')]['id'];}else{_0x162ed6[_[_0xcae8('0xd')](this[_0xcae8('0x9')])+_0xcae8('0xe')]=this[_0xcae8('0xc')]['id'];}_0x162ed6[_[_0xcae8('0xd')](this[_0xcae8('0x9')])+'InteractionId']=this[_0xcae8('0xf')]['id'];if(rpc[this['channel']+_0xcae8('0x10')]){return rpc[this[_0xcae8('0x9')]+_0xcae8('0x10')][_0xcae8('0x11')](_0x162ed6)[_0xcae8('0x12')](function(_0x557581){logger[_0xcae8('0x13')](_0xcae8('0x14'),_0x2aae9b,_0x162ed6[_0xcae8('0x15')]);_0x1541e2[_0xcae8('0x16')]();})[_0xcae8('0x17')](function(_0x381108){logger[_0xcae8('0x18')]('[%s][MESSAGE]\x20%s',_0x2aae9b,JSON[_0xcae8('0x19')](_0x381108));_0x1541e2[_0xcae8('0x1a')]();});}}catch(_0x2cc724){logger[_0xcae8('0x18')]('[%s][MESSAGE]\x20%s',_0x2aae9b,JSON[_0xcae8('0x19')](_0x2cc724));_0x1541e2[_0xcae8('0x1a')]();}};}; \ 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 4f83381..d7423d3 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 _0x327e=['next','stringify','stop','./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s'];(function(_0x54e48f,_0x95f57d){var _0xba6e=function(_0x31ec4a){while(--_0x31ec4a){_0x54e48f['push'](_0x54e48f['shift']());}};_0xba6e(++_0x95f57d);}(_0x327e,0xf6));var _0xe327=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x327e[_0x20a584];return _0x4b41a8;};'use strict';var utils=require(_0xe327('0x0'));var logger=require(_0xe327('0x1'))(_0xe327('0x2'));exports[_0xe327('0x3')]=function(_0x2ba600,_0x1e3d9e){return function(_0x22ca19){try{logger[_0xe327('0x4')](_0xe327('0x5'),_0x2ba600,utils['getMustacheRender'](_0x1e3d9e[0x0],this));_0x22ca19[_0xe327('0x6')]();}catch(_0x3fdfaf){logger['error'](_0xe327('0x5'),_0x2ba600,JSON[_0xe327('0x7')](_0x3fdfaf));_0x22ca19[_0xe327('0x8')]();}};}; \ No newline at end of file +var _0xbda1=['consequence','info','[%s][NOOP]\x20%s','next','error','stop','./utils','../../../../config/logger','routing'];(function(_0x3edd87,_0x33dfc3){var _0x4e97ab=function(_0x1c2226){while(--_0x1c2226){_0x3edd87['push'](_0x3edd87['shift']());}};_0x4e97ab(++_0x33dfc3);}(_0xbda1,0x1c8));var _0x1bda=function(_0x13b269,_0x5894b2){_0x13b269=_0x13b269-0x0;var _0xba7577=_0xbda1[_0x13b269];return _0xba7577;};'use strict';var utils=require(_0x1bda('0x0'));var logger=require(_0x1bda('0x1'))(_0x1bda('0x2'));exports[_0x1bda('0x3')]=function(_0x37aa5b,_0x172378){return function(_0x500587){try{logger[_0x1bda('0x4')](_0x1bda('0x5'),_0x37aa5b,utils['getMustacheRender'](_0x172378[0x0],this));_0x500587[_0x1bda('0x6')]();}catch(_0x83e982){logger[_0x1bda('0x7')](_0x1bda('0x5'),_0x37aa5b,JSON['stringify'](_0x83e982));_0x500587[_0x1bda('0x8')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/queue.js b/server/services/routing/server/applications/queue.js index 2f697aa..3d36963 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 _0x9bde=['lodash','seq-queue','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','account','queue','from','joinAt','clone','format','%sQueuesWaitingInteractions','%s:queue:%s','%s_queue_waiting_interaction:%s','save','pick','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','contact','list','channel','QueueId','upperFirst','interaction','MessageId','message','chat','AccountId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','error','create\x20queue\x20report','YYYY-MM-DD\x20HH:mm:ss','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','[%s][END:QUEUE][NAME:%s]','toLowerCase','length','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','log','stack'];(function(_0x405385,_0x56f573){var _0x43837b=function(_0x30e20e){while(--_0x30e20e){_0x405385['push'](_0x405385['shift']());}};_0x43837b(++_0x56f573);}(_0x9bde,0xe1));var _0xe9bd=function(_0x3c3faf,_0x1c05c1){_0x3c3faf=_0x3c3faf-0x0;var _0x3ac02d=_0x9bde[_0x3c3faf];return _0x3ac02d;};'use strict';var schema=require('validate');var _=require(_0xe9bd('0x0'));var util=require('util');var seqqueue=require(_0xe9bd('0x1'));var moment=require('moment');var Redis=require(_0xe9bd('0x2'));var config=require(_0xe9bd('0x3'));var logger=require(_0xe9bd('0x4'))(_0xe9bd('0x5'));var strategy=require(_0xe9bd('0x6'));config[_0xe9bd('0x7')]=_[_0xe9bd('0x8')](config['redis'],{'host':_0xe9bd('0x9'),'port':0x18eb});var io=require(_0xe9bd('0xa'))(new Redis(config[_0xe9bd('0x7')]));var attributes=['id',_0xe9bd('0xb'),_0xe9bd('0xc'),_0xe9bd('0xd'),_0xe9bd('0xe'),_0xe9bd('0xf')];function emit(_0x439abc,_0x45c7ba,_0x581602){io['to'](_0x439abc)['emit'](_0x45c7ba,_0x581602);}function emitChannelQueueInteraction(_0x3c8e95,_0x145521,_0x2601ac,_0x581ab9,_0x12c96e,_0x9eca50,_0x3339f9,_0x141587){var _0x5e022a=_[_0xe9bd('0x10')](_0x2601ac);_0x5e022a['queue_id']=_0x141587;_0x5e022a[_0xe9bd('0xd')]=_0x145521;_0x5e022a[_0xe9bd('0xc')]=_0x581ab9;_0x5e022a['id']=_0x12c96e;if(_0x9eca50){_0x3339f9[util[_0xe9bd('0x11')]('%sQueuesWaitingInteractions',_0x3c8e95)][_0x12c96e]=_['pick'](_0x5e022a,attributes);}else{delete _0x3339f9[util[_0xe9bd('0x11')](_0xe9bd('0x12'),_0x3c8e95)][_0x12c96e];}emit(util[_0xe9bd('0x11')](_0xe9bd('0x13'),_0x3c8e95,_0x145521),util[_0xe9bd('0x11')](_0xe9bd('0x14'),_0x3c8e95,_0x9eca50?_0xe9bd('0x15'):'remove'),_[_0xe9bd('0x16')](_0x5e022a,attributes));}var rpc={'openchannelQueueReport':require(_0xe9bd('0x17')),'mailQueueReport':require(_0xe9bd('0x18')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xe9bd('0x19')),'faxQueueReport':require(_0xe9bd('0x1a'))};var queue=schema({'name':{'type':_0xe9bd('0x1b'),'required':!![],'message':_0xe9bd('0x1c')},'timeout':{'type':'number','message':_0xe9bd('0x1d')}});function startRouting(_0x50a5e8,_0xc6b661,_0x55b869,_0x26aa4a){if(_0x50a5e8&&_0xc6b661&&_0x55b869){_0xc6b661[_0xe9bd('0x1e')]+=0x1;var _0x134c4e={'uniqueid':_0x50a5e8,'from':_0x55b869[_0xe9bd('0x1f')]?_0x55b869[_0xe9bd('0x1f')][_0xe9bd('0xe')]:'','joinAt':moment()[_0xe9bd('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x55b869[_0xe9bd('0x20')]?_0x55b869[_0xe9bd('0x20')]['id']:null,'ListId':_0x55b869['list']?_0x55b869[_0xe9bd('0x21')]['id']:null};_0x134c4e[_['upperFirst'](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x23')]=_0xc6b661['id']||null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+'InteractionId']=_0x55b869[_0xe9bd('0x25')]?_0x55b869[_0xe9bd('0x25')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+_0xe9bd('0x26')]=_0x55b869[_0xe9bd('0x27')]?_0x55b869[_0xe9bd('0x27')]['id']:null;_0x134c4e[_[_0xe9bd('0x24')](_0x55b869[_0xe9bd('0x22')])+(_0x55b869['channel']!==_0xe9bd('0x28')?_0xe9bd('0x29'):'WebsiteId')]=_0x55b869[_0xe9bd('0xc')]?_0x55b869[_0xe9bd('0xc')]['id']:null;logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x2b'),_0x50a5e8,_0xc6b661[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x55b869['channel'],_0xc6b661['name'],_0x134c4e,_0x55b869[_0xe9bd('0xc')]['name'],_0x55b869[_0xe9bd('0x27')]['id'],!![],_0x26aa4a,_0xc6b661['id']);if(rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x55b869[_0xe9bd('0x22')]+_0xe9bd('0x2d')]['create'](_0x134c4e)['catch'](function(_0x7f2c5){logger[_0xe9bd('0x2e')](_0xe9bd('0x2f'));});}}}function stopRouting(_0x3081f3,_0xe2436,_0x1f0f9e,_0x3c31ee){if(_0x3081f3&&_0xe2436){_0xe2436[_0xe9bd('0x1e')]-=0x1;var _0x45703e={'leaveAt':moment()['format'](_0xe9bd('0x30')),'acceptAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'accepted'};logger['info'](util[_0xe9bd('0x11')](_0xe9bd('0x31'),_0x3081f3,_0xe2436[_0xe9bd('0x2c')]));emitChannelQueueInteraction(_0x1f0f9e[_0xe9bd('0x22')],_0xe2436[_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x1f')],_0x1f0f9e[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x1f0f9e[_0xe9bd('0x27')]['id'],![],_0x3c31ee,_0xe2436['id']);if(rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')]){return rpc[_0x1f0f9e[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x3081f3,_0x45703e)[_0xe9bd('0x33')](function(_0x8ff624){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function endRouting(_0x4c689d,_0x3f3cf5,_0x32e764,_0x56b4a5){if(_0x4c689d&&_0x3f3cf5){_0x3f3cf5[_0xe9bd('0x1e')]-=0x1;var _0x264c87={'leaveAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0xe9bd('0x11')](_0xe9bd('0x30')),'reason':'timeout'};logger[_0xe9bd('0x2a')](util[_0xe9bd('0x11')](_0xe9bd('0x35'),_0x4c689d,_0x3f3cf5['name']));emitChannelQueueInteraction(_0x32e764[_0xe9bd('0x22')],_0x3f3cf5['name'],_0x32e764[_0xe9bd('0x1f')],_0x32e764[_0xe9bd('0xc')][_0xe9bd('0x2c')],_0x32e764[_0xe9bd('0x27')]['id'],![],_0x56b4a5);if(rpc[_0x32e764['channel']+_0xe9bd('0x2d')]){return rpc[_0x32e764[_0xe9bd('0x22')]+_0xe9bd('0x2d')][_0xe9bd('0x32')](_0x4c689d,_0x264c87)[_0xe9bd('0x33')](function(_0x1e061d){logger[_0xe9bd('0x2e')](_0xe9bd('0x34'));});}}}function handleFindQueue(_0x2b5a71){return function(_0x1d5d93){return _0x1d5d93['name']['toLowerCase']()===_0x2b5a71[_0xe9bd('0x36')]();};}exports['consequence']=function(_0x4608a0,_0x340819,_0x41881a,_0x480797){return function(_0x1ba613){try{var _0x2923cf={'name':_0x340819[0x0],'timeout':_0x340819[0x1]};var _0x1a2d94=queue['validate'](_0x2923cf,{'typecast':!![]});if(_0x1a2d94[_0xe9bd('0x37')]){logger[_0xe9bd('0x2e')](_0xe9bd('0x38'),_0x4608a0,_[_0xe9bd('0x39')](_0x1a2d94,_0xe9bd('0x27'))[_0xe9bd('0x3a')](',\x20'));_0x1ba613[_0xe9bd('0x3b')]();}else{var _0x3c4482=_[_0xe9bd('0x3c')](_0x41881a[_0x480797[_0xe9bd('0x22')]+_0xe9bd('0x3d')],handleFindQueue(_0x2923cf[_0xe9bd('0x2c')]));if(_0x3c4482){startRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);var _0x2d4e62=(_0x3c4482[_0xe9bd('0x3e')]||0xa)*0x3e8;var _0x41da6e=(_0x2923cf['timeout']||0x14)*0x3e8;var _0x5a86fd,_0x283e67;if(_0x2d4e62>_0x41da6e){_0x41da6e=_0x2d4e62;}var _0x2ced7c=seqqueue[_0xe9bd('0x3f')](_0x2d4e62);_0x2ced7c['id']=_0x4608a0;_0x2ced7c['atimeout']=_0x2d4e62;_0x2ced7c['qtimeout']=_0x41da6e;_0x2ced7c[_0xe9bd('0x22')]=_0x480797[_0xe9bd('0x22')];_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x41'),function(){logger[_0xe9bd('0x2a')](_0xe9bd('0x42'),_0x4608a0);stopRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x5a86fd=undefined;_0x2ced7c[_0xe9bd('0x43')](!![]);if(_0x41881a['rules'][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}_0x1ba613['stop']();});_0x41881a[_0xe9bd('0x40')][_0x4608a0]['on'](_0xe9bd('0x44'),function(){if(_0x41881a[_0xe9bd('0x40')][_0x4608a0]){delete _0x41881a[_0xe9bd('0x40')][_0x4608a0];}});_0x5a86fd=setTimeout(function(){logger[_0xe9bd('0x2a')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x4608a0);endRouting(_0x4608a0,_0x3c4482,_0x480797,_0x41881a);clearTimeout(_0x5a86fd);_0x2ced7c[_0xe9bd('0x43')](!![]);_0x1ba613[_0xe9bd('0x45')]();},_0x41da6e);switch(_0x3c4482[_0xe9bd('0x46')]){case'rrmemory':strategy[_0xe9bd('0x47')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);break;default:strategy[_0xe9bd('0x48')](_0x2ced7c,_0x3c4482,_0x41881a,_0x480797);}}else{logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x4608a0,_0x2923cf[_0xe9bd('0x2c')]);_0x1ba613[_0xe9bd('0x3b')]();}}}catch(_0x2e634d){console[_0xe9bd('0x49')](_0x2e634d);logger[_0xe9bd('0x2e')]('[%s][QUEUE]\x20%s',_0x4608a0,_0x2e634d[_0xe9bd('0x4a')]);_0x1ba613['stop']();}};}; \ No newline at end of file +var _0x2750=['toLowerCase','consequence','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','atimeout','qtimeout','rules','end','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','validate','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','queue_id','queue','from','joinAt','account','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','QueueId','InteractionId','interaction','channel','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','waiting','info','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]'];(function(_0x34e17a,_0x118bcc){var _0xbed956=function(_0x3dd58f){while(--_0x3dd58f){_0x34e17a['push'](_0x34e17a['shift']());}};_0xbed956(++_0x118bcc);}(_0x2750,0x13b));var _0x0275=function(_0x1773bc,_0x35ff3f){_0x1773bc=_0x1773bc-0x0;var _0x3b18c9=_0x2750[_0x1773bc];return _0x3b18c9;};'use strict';var schema=require(_0x0275('0x0'));var _=require('lodash');var util=require(_0x0275('0x1'));var seqqueue=require(_0x0275('0x2'));var moment=require(_0x0275('0x3'));var Redis=require(_0x0275('0x4'));var config=require(_0x0275('0x5'));var logger=require(_0x0275('0x6'))(_0x0275('0x7'));var strategy=require(_0x0275('0x8'));config[_0x0275('0x9')]=_[_0x0275('0xa')](config['redis'],{'host':_0x0275('0xb'),'port':0x18eb});var io=require(_0x0275('0xc'))(new Redis(config[_0x0275('0x9')]));var attributes=['id',_0x0275('0xd'),'account',_0x0275('0xe'),_0x0275('0xf'),_0x0275('0x10')];function emit(_0x5e0e4a,_0x5ae225,_0x224e0f){io['to'](_0x5e0e4a)['emit'](_0x5ae225,_0x224e0f);}function emitChannelQueueInteraction(_0x26fa6b,_0x377087,_0x14f68c,_0x41e828,_0x14bc3e,_0x5ae208,_0x2e8723,_0x1e0932){var _0x1f128d=_['clone'](_0x14f68c);_0x1f128d['queue_id']=_0x1e0932;_0x1f128d[_0x0275('0xe')]=_0x377087;_0x1f128d[_0x0275('0x11')]=_0x41e828;_0x1f128d['id']=_0x14bc3e;if(_0x5ae208){_0x2e8723[util[_0x0275('0x12')](_0x0275('0x13'),_0x26fa6b)][_0x14bc3e]=_[_0x0275('0x14')](_0x1f128d,attributes);}else{delete _0x2e8723[util[_0x0275('0x12')]('%sQueuesWaitingInteractions',_0x26fa6b)][_0x14bc3e];}emit(util[_0x0275('0x12')](_0x0275('0x15'),_0x26fa6b,_0x377087),util['format'](_0x0275('0x16'),_0x26fa6b,_0x5ae208?_0x0275('0x17'):'remove'),_[_0x0275('0x14')](_0x1f128d,attributes));}var rpc={'openchannelQueueReport':require(_0x0275('0x18')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require('../../rpc/smsQueueReport'),'faxQueueReport':require('../../rpc/faxQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x0275('0x19')},'timeout':{'type':_0x0275('0x1a'),'message':_0x0275('0x1b')}});function startRouting(_0x5b2a4c,_0x7075c9,_0x30730a,_0x20c7fc){if(_0x5b2a4c&&_0x7075c9&&_0x30730a){_0x7075c9['waiting']+=0x1;var _0x1bd201={'uniqueid':_0x5b2a4c,'from':_0x30730a[_0x0275('0x1c')]?_0x30730a['body']['from']:'','joinAt':moment()[_0x0275('0x12')](_0x0275('0x1d')),'ContactId':_0x30730a[_0x0275('0x1e')]?_0x30730a['contact']['id']:null,'ListId':_0x30730a[_0x0275('0x1f')]?_0x30730a['list']['id']:null};_0x1bd201[_[_0x0275('0x20')](_0x30730a['channel'])+_0x0275('0x21')]=_0x7075c9['id']||null;_0x1bd201[_[_0x0275('0x20')](_0x30730a['channel'])+_0x0275('0x22')]=_0x30730a[_0x0275('0x23')]?_0x30730a[_0x0275('0x23')]['id']:null;_0x1bd201[_['upperFirst'](_0x30730a[_0x0275('0x24')])+_0x0275('0x25')]=_0x30730a[_0x0275('0x26')]?_0x30730a[_0x0275('0x26')]['id']:null;_0x1bd201[_[_0x0275('0x20')](_0x30730a[_0x0275('0x24')])+(_0x30730a['channel']!==_0x0275('0x27')?_0x0275('0x28'):_0x0275('0x29'))]=_0x30730a[_0x0275('0x11')]?_0x30730a[_0x0275('0x11')]['id']:null;logger['info'](util[_0x0275('0x12')](_0x0275('0x2a'),_0x5b2a4c,_0x7075c9[_0x0275('0x2b')]));emitChannelQueueInteraction(_0x30730a[_0x0275('0x24')],_0x7075c9[_0x0275('0x2b')],_0x1bd201,_0x30730a['account'][_0x0275('0x2b')],_0x30730a[_0x0275('0x26')]['id'],!![],_0x20c7fc,_0x7075c9['id']);if(rpc[_0x30730a[_0x0275('0x24')]+'QueueReport']){return rpc[_0x30730a['channel']+_0x0275('0x2c')][_0x0275('0x2d')](_0x1bd201)['catch'](function(_0x7eff96){logger[_0x0275('0x2e')](_0x0275('0x2f'));});}}}function stopRouting(_0x4111fa,_0x5d763d,_0x24c762,_0x86940b){if(_0x4111fa&&_0x5d763d){_0x5d763d[_0x0275('0x30')]-=0x1;var _0x2002c2={'leaveAt':moment()['format'](_0x0275('0x1d')),'acceptAt':moment()['format'](_0x0275('0x1d')),'reason':'accepted'};logger[_0x0275('0x31')](util[_0x0275('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x4111fa,_0x5d763d[_0x0275('0x2b')]));emitChannelQueueInteraction(_0x24c762[_0x0275('0x24')],_0x5d763d[_0x0275('0x2b')],_0x24c762[_0x0275('0x1c')],_0x24c762['account'][_0x0275('0x2b')],_0x24c762[_0x0275('0x26')]['id'],![],_0x86940b,_0x5d763d['id']);if(rpc[_0x24c762[_0x0275('0x24')]+_0x0275('0x2c')]){return rpc[_0x24c762[_0x0275('0x24')]+'QueueReport'][_0x0275('0x32')](_0x4111fa,_0x2002c2)[_0x0275('0x33')](function(_0x1b7276){logger[_0x0275('0x2e')](_0x0275('0x34'));});}}}function endRouting(_0x430307,_0x28cf71,_0x471fc7,_0x3bf52d){if(_0x430307&&_0x28cf71){_0x28cf71[_0x0275('0x30')]-=0x1;var _0xb3264e={'leaveAt':moment()['format'](_0x0275('0x1d')),'exitAt':moment()[_0x0275('0x12')](_0x0275('0x1d')),'reason':_0x0275('0x35')};logger[_0x0275('0x31')](util[_0x0275('0x12')](_0x0275('0x36'),_0x430307,_0x28cf71[_0x0275('0x2b')]));emitChannelQueueInteraction(_0x471fc7[_0x0275('0x24')],_0x28cf71[_0x0275('0x2b')],_0x471fc7[_0x0275('0x1c')],_0x471fc7[_0x0275('0x11')][_0x0275('0x2b')],_0x471fc7[_0x0275('0x26')]['id'],![],_0x3bf52d);if(rpc[_0x471fc7['channel']+_0x0275('0x2c')]){return rpc[_0x471fc7[_0x0275('0x24')]+'QueueReport'][_0x0275('0x32')](_0x430307,_0xb3264e)[_0x0275('0x33')](function(_0x19cded){logger[_0x0275('0x2e')](_0x0275('0x34'));});}}}function handleFindQueue(_0x14d148){return function(_0x279db8){return _0x279db8['name'][_0x0275('0x37')]()===_0x14d148[_0x0275('0x37')]();};}exports[_0x0275('0x38')]=function(_0x214d2b,_0x4f888c,_0x410511,_0x1f781b){return function(_0x3f37cb){try{var _0x2ef256={'name':_0x4f888c[0x0],'timeout':_0x4f888c[0x1]};var _0x4ad75f=queue[_0x0275('0x0')](_0x2ef256,{'typecast':!![]});if(_0x4ad75f['length']){logger[_0x0275('0x2e')](_0x0275('0x39'),_0x214d2b,_[_0x0275('0x3a')](_0x4ad75f,_0x0275('0x26'))['join'](',\x20'));_0x3f37cb[_0x0275('0x3b')]();}else{var _0x3d1bfc=_['find'](_0x410511[_0x1f781b[_0x0275('0x24')]+_0x0275('0x3c')],handleFindQueue(_0x2ef256[_0x0275('0x2b')]));if(_0x3d1bfc){startRouting(_0x214d2b,_0x3d1bfc,_0x1f781b,_0x410511);var _0x4f06b3=(_0x3d1bfc[_0x0275('0x35')]||0xa)*0x3e8;var _0x12b637=(_0x2ef256['timeout']||0x14)*0x3e8;var _0x1da178,_0x2049da;if(_0x4f06b3>_0x12b637){_0x12b637=_0x4f06b3;}var _0x27aace=seqqueue[_0x0275('0x3d')](_0x4f06b3);_0x27aace['id']=_0x214d2b;_0x27aace[_0x0275('0x3e')]=_0x4f06b3;_0x27aace[_0x0275('0x3f')]=_0x12b637;_0x27aace[_0x0275('0x24')]=_0x1f781b[_0x0275('0x24')];_0x410511[_0x0275('0x40')][_0x214d2b]['on'](_0x0275('0x41'),function(){logger[_0x0275('0x31')]('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0x214d2b);stopRouting(_0x214d2b,_0x3d1bfc,_0x1f781b,_0x410511);clearTimeout(_0x1da178);_0x1da178=undefined;_0x27aace[_0x0275('0x42')](!![]);if(_0x410511[_0x0275('0x40')][_0x214d2b]){delete _0x410511[_0x0275('0x40')][_0x214d2b];}_0x3f37cb[_0x0275('0x3b')]();});_0x410511[_0x0275('0x40')][_0x214d2b]['on'](_0x0275('0x43'),function(){if(_0x410511[_0x0275('0x40')][_0x214d2b]){delete _0x410511[_0x0275('0x40')][_0x214d2b];}});_0x1da178=setTimeout(function(){logger[_0x0275('0x31')](_0x0275('0x44'),_0x214d2b);endRouting(_0x214d2b,_0x3d1bfc,_0x1f781b,_0x410511);clearTimeout(_0x1da178);_0x27aace[_0x0275('0x42')](!![]);_0x3f37cb['next']();},_0x12b637);switch(_0x3d1bfc['strategy']){case _0x0275('0x45'):strategy[_0x0275('0x45')](_0x27aace,_0x3d1bfc,_0x410511,_0x1f781b);break;default:strategy[_0x0275('0x46')](_0x27aace,_0x3d1bfc,_0x410511,_0x1f781b);}}else{logger[_0x0275('0x2e')](_0x0275('0x47'),_0x214d2b,_0x2ef256['name']);_0x3f37cb[_0x0275('0x3b')]();}}}catch(_0x55fdff){console[_0x0275('0x48')](_0x55fdff);logger[_0x0275('0x2e')](_0x0275('0x39'),_0x214d2b,_0x55fdff[_0x0275('0x49')]);_0x3f37cb['stop']();}};}; \ 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 45eb05b..638e8c6 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 _0xc757=['notificationId','squeue','agent','realtime','push','bind','timeout','handleTimeout','handleDrained','prototype','handleRun','info','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','busy','busyQueue','showNotification',':FORCED','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing'];(function(_0x3bec0b,_0x3ccf05){var _0x5fc9a0=function(_0x30bdde){while(--_0x30bdde){_0x3bec0b['push'](_0x3bec0b['shift']());}};_0x5fc9a0(++_0x3ccf05);}(_0xc757,0xe3));var _0x7c75=function(_0x7caf8b,_0x51a6be){_0x7caf8b=_0x7caf8b-0x0;var _0x16e8de=_0xc757[_0x7caf8b];return _0x16e8de;};'use strict';var _=require(_0x7c75('0x0'));var uuid=require(_0x7c75('0x1'));var util=require(_0x7c75('0x2'));var logger=require(_0x7c75('0x3'))(_0x7c75('0x4'));var Agent=function(_0x51c0dc,_0x1e47e6,_0x4f7a3b,_0x4d373a){this[_0x7c75('0x5')]=uuid['v4']();this[_0x7c75('0x6')]=_0x51c0dc;this[_0x7c75('0x7')]=_0x1e47e6;this[_0x7c75('0x8')]=_0x4f7a3b;this[_0x7c75('0x4')]=_0x4d373a;this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this['handleTimeout'][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on'](_0x7c75('0xb'),this[_0x7c75('0xc')][_0x7c75('0xa')](this));this[_0x7c75('0x6')]['on']('drained',this[_0x7c75('0xd')][_0x7c75('0xa')](this));};Agent['prototype']['push']=function(){this[_0x7c75('0x6')][_0x7c75('0x9')](this['handleRun'][_0x7c75('0xa')](this),this[_0x7c75('0xc')]['bind'](this));};Agent[_0x7c75('0xe')][_0x7c75('0xd')]=function(){this[_0x7c75('0xc')](!![]);};Agent['prototype'][_0x7c75('0xf')]=function(_0x439130){logger[_0x7c75('0x10')]('[%s][AGENT]\x20try\x20with\x20%s',this[_0x7c75('0x6')]['id'],this['agent']['id']);if(_[_0x7c75('0x11')](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){logger[_0x7c75('0x10')](_0x7c75('0x13'),this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')]['bind'](this),0x3e8);}else{if(this[_0x7c75('0x4')][_0x7c75('0x14')]||util['isAgentAvailable'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],this['squeue']['channel'],![])){this[_0x7c75('0x8')]['agents'][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=!![];this['realtime']['agents'][this['agent']['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x17')](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],null,this[_0x7c75('0x4')]);util['writeLog'](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],'RINGING'+(this[_0x7c75('0x4')][_0x7c75('0x14')]?_0x7c75('0x18'):''));}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}}};Agent['prototype'][_0x7c75('0xc')]=function(_0x5d6ee5){if(_['isNil'](this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']])){return logger['info'](_0x7c75('0x13'),this['squeue']['id'],this[_0x7c75('0x7')]['id']);}else{logger[_0x7c75('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this[_0x7c75('0x6')]['id'],this[_0x7c75('0x7')]['id']);util['hideNotification'](this[_0x7c75('0x5')],this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']],null,this[_0x7c75('0x4')]);this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x15')]=![];this[_0x7c75('0x8')][_0x7c75('0x12')][this[_0x7c75('0x7')]['id']][_0x7c75('0x16')]=undefined;util[_0x7c75('0x19')](this[_0x7c75('0x6')]['id'],this[_0x7c75('0x8')][_0x7c75('0x12')][this['agent']['id']],_0x5d6ee5?_0x7c75('0x1a'):_0x7c75('0x1b'));}if(!_0x5d6ee5){setTimeout(this[_0x7c75('0x9')][_0x7c75('0xa')](this),0x3e8);}};function agent(_0xc39653,_0x591648,_0x455df2,_0x490729){return new Agent(_0xc39653,_0x591648,_0x455df2,_0x490729);}module[_0x7c75('0x1c')]=agent; \ No newline at end of file +var _0x00d6=['handleTimeout','timeout','handleDrained','prototype','handleRun','info','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','channel',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','busy','busyQueue','writeLog','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','push','bind'];(function(_0x31f7c5,_0x3bf428){var _0x19fabc=function(_0x268080){while(--_0x268080){_0x31f7c5['push'](_0x31f7c5['shift']());}};_0x19fabc(++_0x3bf428);}(_0x00d6,0x1e5));var _0x600d=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x00d6[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x600d('0x0'));var uuid=require(_0x600d('0x1'));var util=require(_0x600d('0x2'));var logger=require(_0x600d('0x3'))(_0x600d('0x4'));var Agent=function(_0x255be3,_0x1a0371,_0x953cf,_0x1d6019){this[_0x600d('0x5')]=uuid['v4']();this[_0x600d('0x6')]=_0x255be3;this[_0x600d('0x7')]=_0x1a0371;this[_0x600d('0x8')]=_0x953cf;this['routing']=_0x1d6019;this['squeue'][_0x600d('0x9')](this['handleRun'][_0x600d('0xa')](this),this[_0x600d('0xb')][_0x600d('0xa')](this));this[_0x600d('0x6')]['on'](_0x600d('0xc'),this[_0x600d('0xb')][_0x600d('0xa')](this));this[_0x600d('0x6')]['on']('drained',this[_0x600d('0xd')][_0x600d('0xa')](this));};Agent[_0x600d('0xe')][_0x600d('0x9')]=function(){this[_0x600d('0x6')]['push'](this['handleRun'][_0x600d('0xa')](this),this[_0x600d('0xb')][_0x600d('0xa')](this));};Agent[_0x600d('0xe')][_0x600d('0xd')]=function(){this[_0x600d('0xb')](!![]);};Agent[_0x600d('0xe')][_0x600d('0xf')]=function(_0x576a3f){logger[_0x600d('0x10')](_0x600d('0x11'),this[_0x600d('0x6')]['id'],this[_0x600d('0x7')]['id']);if(_[_0x600d('0x12')](this['realtime'][_0x600d('0x13')][this['agent']['id']])){logger[_0x600d('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x600d('0x6')]['id'],this[_0x600d('0x7')]['id']);setTimeout(this[_0x600d('0x9')][_0x600d('0xa')](this),0x3e8);}else{if(this[_0x600d('0x4')]['forcedOwnership']||util['isAgentAvailable'](this[_0x600d('0x6')]['id'],this['realtime']['agents'][this[_0x600d('0x7')]['id']],this['squeue'][_0x600d('0x14')],![])){this[_0x600d('0x8')]['agents'][this[_0x600d('0x7')]['id']]['busy']=!![];this[_0x600d('0x8')][_0x600d('0x13')][this['agent']['id']]['busyQueue']=undefined;util['showNotification'](this[_0x600d('0x5')],this[_0x600d('0x6')]['id'],this[_0x600d('0x8')][_0x600d('0x13')][this[_0x600d('0x7')]['id']],null,this['routing']);util['writeLog'](this[_0x600d('0x6')]['id'],this[_0x600d('0x8')][_0x600d('0x13')][this[_0x600d('0x7')]['id']],'RINGING'+(this[_0x600d('0x4')]['forcedOwnership']?_0x600d('0x15'):''));}else{logger[_0x600d('0x10')](_0x600d('0x16'),this[_0x600d('0x6')]['id'],this['agent']['id']);setTimeout(this[_0x600d('0x9')][_0x600d('0xa')](this),0x3e8);}}};Agent[_0x600d('0xe')][_0x600d('0xb')]=function(_0x14c4a2){if(_[_0x600d('0x12')](this['realtime']['agents'][this['agent']['id']])){return logger['info'](_0x600d('0x17'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x600d('0x10')]('[%s][AGENT]\x20timeout\x20with\x20%s',this['squeue']['id'],this[_0x600d('0x7')]['id']);util[_0x600d('0x18')](this[_0x600d('0x5')],this[_0x600d('0x6')]['id'],this[_0x600d('0x8')][_0x600d('0x13')][this[_0x600d('0x7')]['id']],null,this['routing']);this[_0x600d('0x8')][_0x600d('0x13')][this['agent']['id']][_0x600d('0x19')]=![];this[_0x600d('0x8')][_0x600d('0x13')][this['agent']['id']][_0x600d('0x1a')]=undefined;util[_0x600d('0x1b')](this[_0x600d('0x6')]['id'],this[_0x600d('0x8')][_0x600d('0x13')][this[_0x600d('0x7')]['id']],_0x14c4a2?_0x600d('0x1c'):_0x600d('0x1d'));}if(!_0x14c4a2){setTimeout(this[_0x600d('0x9')][_0x600d('0xa')](this),0x3e8);}};function agent(_0x26e250,_0x4c4a47,_0x3e3793,_0x269017){return new Agent(_0x26e250,_0x4c4a47,_0x3e3793,_0x269017);}module[_0x600d('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 5994a73..7f1b14b 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 _0x6955=['prototype','handleRun','isNil','Agents','length','agents','info','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','channel','writeLog','RINGING','busy','busyQueue','name','[%s][QUEUE]\x20EMPTY','hideNotification','STOP','TIMEOUT','exports','./util','routing','notificationId','squeue','queue','realtime','push','bind','handleTimeout','timeout','drained','handleDrained'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x6955,0xf4));var _0x5695=function(_0x56a3b1,_0x5576b8){_0x56a3b1=_0x56a3b1-0x0;var _0x41fc0a=_0x6955[_0x56a3b1];return _0x41fc0a;};'use strict';var _=require('lodash');var uuid=require('uuid');var util=require(_0x5695('0x0'));var logger=require('../../../../../config/logger')(_0x5695('0x1'));var Beepall=function(_0x1c3e23,_0x2b4edd,_0xa17cdf,_0x5c45e2){this[_0x5695('0x2')]=uuid['v4']();this[_0x5695('0x3')]=_0x1c3e23;this[_0x5695('0x4')]=_0x2b4edd;this[_0x5695('0x5')]=_0xa17cdf;this['routing']=_0x5c45e2;this[_0x5695('0x3')][_0x5695('0x6')](this['handleRun'][_0x5695('0x7')](this),this[_0x5695('0x8')][_0x5695('0x7')](this));this[_0x5695('0x3')]['on'](_0x5695('0x9'),this[_0x5695('0x8')]['bind'](this));this[_0x5695('0x3')]['on'](_0x5695('0xa'),this[_0x5695('0xb')]['bind'](this));};Beepall[_0x5695('0xc')][_0x5695('0x6')]=function(){this[_0x5695('0x3')][_0x5695('0x6')](this[_0x5695('0xd')][_0x5695('0x7')](this),this[_0x5695('0x8')][_0x5695('0x7')](this));};Beepall[_0x5695('0xc')][_0x5695('0xb')]=function(_0x196cf0){this['handleTimeout'](!![]);};Beepall[_0x5695('0xc')]['handleRun']=function(_0x4c1608){var _0x1ee6af=!![];if(!_['isNil'](this[_0x5695('0x4')])&&!_[_0x5695('0xe')](this[_0x5695('0x4')]['Agents'])&&this[_0x5695('0x4')][_0x5695('0xf')][_0x5695('0x10')]>0x0){for(var _0x17587c=0x0,_0x515733;_0x17587c0x0){for(var _0x116e68=0x0,_0x26be50;_0x116e680x0&&_0x53b783[_0x12048c+_0xfd35('0x25')]>=_0x53b783[_0x12048c+'Capacity']){writeLog(_0x298bdc,_0x53b783,_0x12048c[_0xfd35('0x26')]()+_0xfd35('0x27'));return![];}}return!![];};exports['showNotification']=function(_0x5f1679,_0x2954a2,_0x333d68,_0x2b1eae,_0x2fdeab){return sendNotification(!![],_0x5f1679,_0x2954a2,_0x333d68,_0x2b1eae,_0x2fdeab);};exports['hideNotification']=function(_0x1e13c2,_0x5bf9fb,_0x56d1b6,_0x4b7b7e,_0x3f8e85){return sendNotification(![],_0x1e13c2,_0x5bf9fb,_0x56d1b6,_0x4b7b7e,_0x3f8e85);};exports[_0xfd35('0x28')]=writeLog; \ No newline at end of file +var _0x0854=['routing','redis','localhost','socket.io-emitter','emit','format','user:%s','name','split','account','notificationSound','body','queue','getMustacheRender','notificationTemplate','msg','I\x20can\x27t\x20render\x20your\x20template','error','[%s][QUEUE]\x20%s','notification:%s','save','remove','isAgentAvailable','busy','OFFLINE','hasOwnProperty','CurrentCapacity','Capacity','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','../utils','mustache','../../../../../config/environment','../../../../../config/logger'];(function(_0x5cd6e3,_0x24f7c6){var _0x2cf4f8=function(_0x2dddb3){while(--_0x2dddb3){_0x5cd6e3['push'](_0x5cd6e3['shift']());}};_0x2cf4f8(++_0x24f7c6);}(_0x0854,0xd9));var _0x4085=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x0854[_0xa464c9];return _0x3d73c4;};'use strict';var _=require(_0x4085('0x0'));var util=require('util');var utils=require(_0x4085('0x1'));var Mustache=require(_0x4085('0x2'));var Redis=require('ioredis');var config=require(_0x4085('0x3'));var logger=require(_0x4085('0x4'))(_0x4085('0x5'));config[_0x4085('0x6')]=_['defaults'](config[_0x4085('0x6')],{'host':_0x4085('0x7'),'port':0x18eb});var io=require(_0x4085('0x8'))(new Redis(config[_0x4085('0x6')]));function emit(_0x2b3306,_0x3e5db5,_0x511f52){io['to'](_0x2b3306)[_0x4085('0x9')](_0x3e5db5,_0x511f52);}function sendNotification(_0x4cf43c,_0x58d4eb,_0x1385d6,_0x23c35f,_0x278993,_0x172119){io['to'](util[_0x4085('0xa')](_0x4085('0xb'),_0x23c35f[_0x4085('0xc')]))[_0x4085('0x9')]('user:save',_0x23c35f);var _0x253c38=_0x172119||{};var _0x41a3e1=_0x1385d6[_0x4085('0xd')]('.');var _0x45b778={'uniqueid':_0x58d4eb,'channel':_0x41a3e1[0x0],'id':_0x41a3e1[0x1],'title':_0x41a3e1[0x0]+'\x20interaction','interactionId':_0x41a3e1[0x2],'queue':_0x278993?_0x278993[_0x4085('0xc')]:null,'sound':_0x253c38[_0x4085('0xe')][_0x4085('0xf')],'shake':_0x253c38[_0x4085('0xe')]['notificationShake']};try{if(!_0x253c38[_0x4085('0x10')]){_0x253c38[_0x4085('0x10')]={};}if(_0x278993){_0x253c38[_0x4085('0x10')][_0x4085('0x11')]=_0x278993;}else if(_0x253c38['body'][_0x4085('0x11')]){delete _0x253c38[_0x4085('0x10')][_0x4085('0x11')];}_0x45b778['msg']=utils[_0x4085('0x12')](_0x253c38[_0x4085('0xe')][_0x4085('0x13')],_0x253c38);}catch(_0x11c80a){_0x45b778[_0x4085('0x14')]=_0x4085('0x15');logger[_0x4085('0x16')](util[_0x4085('0xa')](_0x4085('0x17'),_0x58d4eb,_0x11c80a['message']));}io['to'](util[_0x4085('0xa')](_0x4085('0xb'),_0x23c35f[_0x4085('0xc')]))[_0x4085('0x9')](util['format'](_0x4085('0x18'),_0x4cf43c?_0x4085('0x19'):_0x4085('0x1a')),_0x45b778);}function writeLog(_0x31c979,_0x80fa2,_0x46827b){return logger['info'](util[_0x4085('0xa')]('[%s][QUEUE][AGENT:%s][STATUS:%s]',_0x31c979,_0x80fa2['name'],_0x46827b));}exports[_0x4085('0x1b')]=function(_0x4ecbfb,_0x430a33,_0x15e1a1,_0x29ddda){if(_0x430a33[_0x4085('0x1c')]){writeLog(_0x4ecbfb,_0x430a33,'BUSY');return![];}if(!_0x430a33['online']){writeLog(_0x4ecbfb,_0x430a33,_0x4085('0x1d'));return![];}if(_0x430a33[_0x15e1a1+'Pause']){writeLog(_0x4ecbfb,_0x430a33,'PAUSE');return![];}if(_0x29ddda&&_0x430a33[_0x4085('0x1e')](_0x15e1a1+'Capacity')&&_0x430a33[_0x4085('0x1e')](_0x15e1a1+_0x4085('0x1f'))){if(_0x430a33[_0x15e1a1+_0x4085('0x20')]>0x0&&_0x430a33[_0x15e1a1+_0x4085('0x1f')]>=_0x430a33[_0x15e1a1+_0x4085('0x20')]){writeLog(_0x4ecbfb,_0x430a33,_0x15e1a1['toUpperCase']()+_0x4085('0x21'));return![];}}return!![];};exports[_0x4085('0x22')]=function(_0x18668f,_0x1bacf6,_0x48b418,_0x1d8114,_0x58dfd8){return sendNotification(!![],_0x18668f,_0x1bacf6,_0x48b418,_0x1d8114,_0x58dfd8);};exports[_0x4085('0x23')]=function(_0x45969b,_0x29952e,_0x2e285b,_0x5713fc,_0x1bf24e){return sendNotification(![],_0x45969b,_0x29952e,_0x2e285b,_0x5713fc,_0x1bf24e);};exports[_0x4085('0x24')]=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 46c4bf9..7b6a2cf 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 _0x1686=['replace','isNil','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','stringify','next','validate','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','message','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0x42490d,_0xd02637){var _0x377a79=function(_0x45a186){while(--_0x45a186){_0x42490d['push'](_0x42490d['shift']());}};_0x377a79(++_0xd02637);}(_0x1686,0xc5));var _0x6168=function(_0x32ea03,_0x325386){_0x32ea03=_0x32ea03-0x0;var _0x3299d5=_0x1686[_0x32ea03];return _0x3299d5;};'use strict';var schema=require(_0x6168('0x0'));var sh=require('shelljs');var _=require(_0x6168('0x1'));var utils=require(_0x6168('0x2'));var logger=require(_0x6168('0x3'))('routing');var system=schema({'command':{'type':_0x6168('0x4'),'required':!![],'message':_0x6168('0x5')}});exports[_0x6168('0x6')]=function(_0x17cd86,_0x3220a9){return function(_0x2c55d9){try{var _0x13f3e3={'command':_0x3220a9[0x0]};var _0x372f6e=system[_0x6168('0x0')](_0x13f3e3,{'typecast':!![]});if(_0x372f6e[_0x6168('0x7')]){logger[_0x6168('0x8')](_0x6168('0x9'),_0x17cd86,_[_0x6168('0xa')](_0x372f6e,_0x6168('0xb'))[_0x6168('0xc')](',\x20'));logger[_0x6168('0xd')](_0x6168('0xe'),_0x17cd86);_0x2c55d9['next']();}else{var _0x1a1d4f=this;var _0x53adbf=utils[_0x6168('0xf')](_0x3220a9[0x0],this);logger[_0x6168('0xd')](_0x6168('0x10'),_0x17cd86,_0x53adbf);sh[_0x6168('0x11')](_[_0x6168('0x12')](_0x53adbf),function(_0x50e46e,_0x535ebe){logger['info']('[%s][SYSTEM]\x20result\x20code:\x20%s',_0x17cd86,_0x50e46e);if(_0x50e46e==0x0){var _0x26276d=_0x535ebe[_0x6168('0x13')](/(\r\n|\n|\r)/gm,'');if(_[_0x6168('0x14')](_0x3220a9[0x1])||_[_0x6168('0x15')](_0x3220a9[0x1])){logger[_0x6168('0xd')](_0x6168('0x16'),_0x17cd86);_0x1a1d4f[_0x6168('0x17')][_0x3220a9[0x1]]=_0x26276d;}else{logger[_0x6168('0xd')](_0x6168('0x18'),_0x17cd86,_0x3220a9[0x1],_0x26276d);_0x1a1d4f['body'][_0x3220a9[0x1]]=_0x26276d;}}_0x2c55d9['next']();});}}catch(_0x1fe0a8){logger[_0x6168('0x8')](_0x6168('0x9'),_0x17cd86,_['isObject'](_0x1fe0a8)?JSON[_0x6168('0x19')](_0x1fe0a8):_0x1fe0a8);logger['info'](_0x6168('0xe'),_0x17cd86);_0x2c55d9[_0x6168('0x1a')]();}};}; \ No newline at end of file +var _0xf061=['[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','next','validate','shelljs','./utils','../../../../config/logger','routing','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','trim'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf061,0x1b9));var _0x1f06=function(_0x9abb78,_0x5670a3){_0x9abb78=_0x9abb78-0x0;var _0x49d9c2=_0xf061[_0x9abb78];return _0x49d9c2;};'use strict';var schema=require(_0x1f06('0x0'));var sh=require(_0x1f06('0x1'));var _=require('lodash');var utils=require(_0x1f06('0x2'));var logger=require(_0x1f06('0x3'))(_0x1f06('0x4'));var system=schema({'command':{'type':'string','required':!![],'message':'command\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports['consequence']=function(_0x3ac275,_0x5db890){return function(_0x10f996){try{var _0x5369c9={'command':_0x5db890[0x0]};var _0x238fc3=system[_0x1f06('0x0')](_0x5369c9,{'typecast':!![]});if(_0x238fc3[_0x1f06('0x5')]){logger[_0x1f06('0x6')](_0x1f06('0x7'),_0x3ac275,_[_0x1f06('0x8')](_0x238fc3,'message')[_0x1f06('0x9')](',\x20'));logger[_0x1f06('0xa')](_0x1f06('0xb'),_0x3ac275);_0x10f996['next']();}else{var _0x4f645e=this;var _0x4d1b3e=utils[_0x1f06('0xc')](_0x5db890[0x0],this);logger[_0x1f06('0xa')](_0x1f06('0xd'),_0x3ac275,_0x4d1b3e);sh['exec'](_[_0x1f06('0xe')](_0x4d1b3e),function(_0x535b31,_0x5a9e95){logger[_0x1f06('0xa')](_0x1f06('0xf'),_0x3ac275,_0x535b31);if(_0x535b31==0x0){var _0x2ee704=_0x5a9e95[_0x1f06('0x10')](/(\r\n|\n|\r)/gm,'');if(_[_0x1f06('0x11')](_0x5db890[0x1])||_[_0x1f06('0x12')](_0x5db890[0x1])){logger[_0x1f06('0xa')]('[%s][SYSTEM]\x20no\x20variable',_0x3ac275);_0x4f645e[_0x1f06('0x13')][_0x5db890[0x1]]=_0x2ee704;}else{logger[_0x1f06('0xa')](_0x1f06('0x14'),_0x3ac275,_0x5db890[0x1],_0x2ee704);_0x4f645e['body'][_0x5db890[0x1]]=_0x2ee704;}}_0x10f996['next']();});}}catch(_0x1d74f1){logger[_0x1f06('0x6')](_0x1f06('0x7'),_0x3ac275,_[_0x1f06('0x15')](_0x1d74f1)?JSON[_0x1f06('0x16')](_0x1d74f1):_0x1d74f1);logger['info'](_0x1f06('0xb'),_0x3ac275);_0x10f996[_0x1f06('0x17')]();}};}; \ 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 49b5fbd..bc4021c 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 _0x7a54=['finally','error','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','[%s][TAG]\x20%s','map','join','next','channel','Interaction','addTags','then','info','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','interaction','catch','stringify','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next'];(function(_0xa03abc,_0x303217){var _0x201a28=function(_0x35b2c6){while(--_0x35b2c6){_0xa03abc['push'](_0xa03abc['shift']());}};_0x201a28(++_0x303217);}(_0x7a54,0x106));var _0x47a5=function(_0x1a23ff,_0x4fbb2f){_0x1a23ff=_0x1a23ff-0x0;var _0x41175f=_0x7a54[_0x1a23ff];return _0x41175f;};'use strict';var schema=require(_0x47a5('0x0'));var _=require(_0x47a5('0x1'));var rpc={'chatInteraction':require(_0x47a5('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x47a5('0x3')),'mailInteraction':require(_0x47a5('0x4')),'faxInteraction':require('../../rpc/faxInteraction')};var logger=require(_0x47a5('0x5'))(_0x47a5('0x6'));var tag=schema({'tag':{'type':_0x47a5('0x7'),'required':!![],'message':_0x47a5('0x8')}});exports[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629,_0x59199c,_0x343372){return function(_0x30e405){try{var _0x506eda={'tag':_0x3d5629[0x0]};var _0x194fb0=tag['validate'](_0x506eda,{'typecast':!![]});if(_0x194fb0['length']){logger['error'](_0x47a5('0xa'),_0x545a97,_[_0x47a5('0xb')](_0x194fb0,'message')[_0x47a5('0xc')](',\x20'));logger['info']('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x545a97);_0x30e405[_0x47a5('0xd')]();}else{var _0x69e4d4={'ids':[_0x3d5629[0x0]]};if(rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')]){rpc[_0x343372[_0x47a5('0xe')]+_0x47a5('0xf')][_0x47a5('0x10')](_0x343372['interaction']['id'],_0x69e4d4)[_0x47a5('0x11')](function(_0x221b54){logger[_0x47a5('0x12')](_0x47a5('0x13'),_0x545a97,_0x3d5629[0x1],_0x343372[_0x47a5('0xe')],_0x343372[_0x47a5('0x14')]['id']);})[_0x47a5('0x15')](function(_0x190faa){logger['error'](_0x47a5('0xa'),_0x545a97,JSON[_0x47a5('0x16')](_0x190faa));logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);})[_0x47a5('0x18')](function(){_0x30e405['next']();});}}}catch(_0x549de3){logger[_0x47a5('0x19')]('[%s][TAG]\x20%s',_0x545a97,_['isObject'](_0x549de3)?JSON[_0x47a5('0x16')](_0x549de3):_0x549de3);logger[_0x47a5('0x12')](_0x47a5('0x17'),_0x545a97);_0x30e405[_0x47a5('0xd')]();}};}; \ No newline at end of file +var _0x9957=['join','info','next','Interaction','channel','addTags','interaction','then','catch','stringify','finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../../../config/logger','routing','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][TAG]\x20%s','map','message'];(function(_0xf9016f,_0x1fca5e){var _0x5e3ce2=function(_0x21f09c){while(--_0x21f09c){_0xf9016f['push'](_0xf9016f['shift']());}};_0x5e3ce2(++_0x1fca5e);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var schema=require(_0x7995('0x0'));var _=require(_0x7995('0x1'));var rpc={'chatInteraction':require(_0x7995('0x2')),'openchannelInteraction':require(_0x7995('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7995('0x4')),'faxInteraction':require(_0x7995('0x5'))};var logger=require(_0x7995('0x6'))(_0x7995('0x7'));var tag=schema({'tag':{'type':'number','required':!![],'message':_0x7995('0x8')}});exports[_0x7995('0x9')]=function(_0x137b6b,_0x219534,_0xbda126,_0x326741){return function(_0x4996ca){try{var _0x465276={'tag':_0x219534[0x0]};var _0x1cad37=tag['validate'](_0x465276,{'typecast':!![]});if(_0x1cad37[_0x7995('0xa')]){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0xd')](_0x1cad37,_0x7995('0xe'))[_0x7995('0xf')](',\x20'));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca[_0x7995('0x11')]();}else{var _0x41c652={'ids':[_0x219534[0x0]]};if(rpc[_0x326741['channel']+_0x7995('0x12')]){rpc[_0x326741[_0x7995('0x13')]+_0x7995('0x12')][_0x7995('0x14')](_0x326741[_0x7995('0x15')]['id'],_0x41c652)[_0x7995('0x16')](function(_0x2bbe7a){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0x137b6b,_0x219534[0x1],_0x326741[_0x7995('0x13')],_0x326741[_0x7995('0x15')]['id']);})[_0x7995('0x17')](function(_0x321ae8){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,JSON[_0x7995('0x18')](_0x321ae8));logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);})[_0x7995('0x19')](function(){_0x4996ca['next']();});}}}catch(_0x2f832e){logger[_0x7995('0xb')](_0x7995('0xc'),_0x137b6b,_[_0x7995('0x1a')](_0x2f832e)?JSON[_0x7995('0x18')](_0x2f832e):_0x2f832e);logger[_0x7995('0x10')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x137b6b);_0x4996ca['next']();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/utils.js b/server/services/routing/server/applications/utils.js index 5b52bb2..e94c3f0 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 _0xde50=['exports','render','body','message'];(function(_0xfaa90,_0x5ec45f){var _0xfad1fb=function(_0x33168d){while(--_0x33168d){_0xfaa90['push'](_0xfaa90['shift']());}};_0xfad1fb(++_0x5ec45f);}(_0xde50,0x140));var _0x0de5=function(_0x4009a6,_0x4fd666){_0x4009a6=_0x4009a6-0x0;var _0x48cc58=_0xde50[_0x4009a6];return _0x48cc58;};'use strict';var Mustache=require('mustache');var _=require('lodash');module[_0x0de5('0x0')]={'getMustacheRender':function(_0x34b791,_0x13190a){return Mustache[_0x0de5('0x1')](_0x34b791,_['merge'](_0x13190a[_0x0de5('0x2')],{'contact':_0x13190a['contact'],'message':_0x13190a[_0x0de5('0x3')],'account':_0x13190a['account'],'interaction':_0x13190a['interaction'],'list':_0x13190a['list']}))||'';}}; \ No newline at end of file +var _0x0cee=['render','contact','message','account','interaction','list','mustache','lodash','exports'];(function(_0x3f65de,_0x582751){var _0x4996df=function(_0x388bd5){while(--_0x388bd5){_0x3f65de['push'](_0x3f65de['shift']());}};_0x4996df(++_0x582751);}(_0x0cee,0x12f));var _0xe0ce=function(_0xab95a7,_0x498ef6){_0xab95a7=_0xab95a7-0x0;var _0x234e8c=_0x0cee[_0xab95a7];return _0x234e8c;};'use strict';var Mustache=require(_0xe0ce('0x0'));var _=require(_0xe0ce('0x1'));module[_0xe0ce('0x2')]={'getMustacheRender':function(_0x3a68d6,_0x315ac1){return Mustache[_0xe0ce('0x3')](_0x3a68d6,_['merge'](_0x315ac1['body'],{'contact':_0x315ac1[_0xe0ce('0x4')],'message':_0x315ac1[_0xe0ce('0x5')],'account':_0x315ac1[_0xe0ce('0x6')],'interaction':_0x315ac1[_0xe0ce('0x7')],'list':_0x315ac1[_0xe0ce('0x8')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 05dc401..e6b25fe 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 _0x1888=['../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','rules','message','interaction','applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','amazonlex','tag','%s:%s:%s','./interval','intervals','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','execute','Applications\x20executed','stringify','matchPath','emit','complete','No\x20applications\x20to\x20execute','channel','end','QueueReport','update','UserId','catch','stack','message\x20is\x20empty','agent','agents','busy','busyQueue','hasOwnProperty','capacity','CurrentCapacity','values','chatQueues','available','name','paused','waiting','mailQueues','loggedIn','openchannelQueues','smsQueues','faxQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','path','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing'];(function(_0x9eb079,_0x5d4e84){var _0x49dadd=function(_0x1a05dc){while(--_0x1a05dc){_0x9eb079['push'](_0x9eb079['shift']());}};_0x49dadd(++_0x5d4e84);}(_0x1888,0xfd));var _0x8188=function(_0x9aca96,_0x497a2a){_0x9aca96=_0x9aca96-0x0;var _0x2d64a5=_0x1888[_0x9aca96];return _0x2d64a5;};'use strict';var _=require('lodash');var util=require(_0x8188('0x0'));var path=require(_0x8188('0x1'));var fs=require('fs');var jayson=require(_0x8188('0x2'));var BPromise=require(_0x8188('0x3'));var uuid=require(_0x8188('0x4'));var config=require(_0x8188('0x5'));var logger=require(_0x8188('0x6'))(_0x8188('0x7'));var rpc={'openchannelQueueReport':require(_0x8188('0x8'))};var rpc={'openchannelQueueReport':require(_0x8188('0x8')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x8188('0x9')),'smsQueueReport':require(_0x8188('0xa')),'faxQueueReport':require('../rpc/faxQueueReport')};var RuleEngine=require('../lib/rule-engine');function getId(_0x12928c,_0xb47b70,_0x40732e){return util[_0x8188('0xb')](_0x8188('0xc'),_0x12928c,_0xb47b70||0x0,_0x40732e||0x0);}function getIntervals(_0x315e89,_0x5ebc31){var _0x62e033=[];if(!_[_0x8188('0xd')](_0x5ebc31[_0x8188('0xe')])&&!_[_0x8188('0xd')](_0x315e89[_0x5ebc31[_0x8188('0xe')]])&&!_[_0x8188('0xd')](_0x315e89[_0x5ebc31[_0x8188('0xe')]][_0x8188('0xf')])){_0x62e033=_['map'](_0x315e89[_0x5ebc31[_0x8188('0xe')]][_0x8188('0xf')],'interval');}else if(!_['isNil'](_0x5ebc31[_0x8188('0x10')])){_0x62e033=[_0x5ebc31['interval']];}return _0x62e033;}exports[_0x8188('0x11')]=function(_0x2f2815){_0x2f2815[_0x8188('0x12')]={};return new BPromise(function(_0x30bccf,_0x22e948){var _0x45473a={'Start':function(_0x452314){var _0x3feba3=this;return new Promise(function(_0x271a0b,_0x4f1563){if(_0x452314){try{var _0x19f0e0=[];var _0x216de5=getId(_0x452314['channel'],_0x452314[_0x8188('0x13')]?_0x452314[_0x8188('0x13')]['id']:0x0,_0x452314[_0x8188('0x14')]?_0x452314['interaction']['id']:0x0);if(_0x452314['applications']&&_['isArray'](_0x452314[_0x8188('0x15')])&&_0x452314[_0x8188('0x15')][_0x8188('0x16')]){for(var _0x318243=0x0;_0x318243<_0x452314[_0x8188('0x15')][_0x8188('0x16')];_0x318243+=0x1){var _0x2fbb7c=_0x452314['applications'][_0x318243];if(fs[_0x8188('0x17')](path[_0x8188('0x18')](__dirname,_0x8188('0x15'),_0x2fbb7c[_0x8188('0x19')]+_0x8188('0x1a')))){var _0x41f363=[];switch(_0x2fbb7c['app'][_0x8188('0x1b')]()){case _0x8188('0x1c'):var _0x5a5839=_0x2fbb7c[_0x8188('0x1d')]['split'](',');_0x41f363[_0x8188('0x1e')](_0x5a5839[0x0]);_0x41f363['push'](_0x5a5839[_0x8188('0x1f')](0x1,_0x5a5839['length'])[_0x8188('0x18')](','));break;case _0x8188('0x20'):var _0x101250=_0x2fbb7c[_0x8188('0x1d')][_0x8188('0x21')](',');_0x41f363[_0x8188('0x1e')](_0x101250[0x0]);_0x41f363[_0x8188('0x1e')](_0x101250[0x1]);_0x41f363[_0x8188('0x1e')](_0x101250[_0x8188('0x1f')](0x2,_0x101250[_0x8188('0x16')])[_0x8188('0x18')](','));break;case _0x8188('0x22'):var _0xa444fe=_0x2fbb7c['appdata']['split'](',');_0x41f363[_0x8188('0x1e')](_0xa444fe[0x0]);_0x41f363[_0x8188('0x1e')](_0xa444fe[0x1]);_0x41f363['push'](_0xa444fe[0x2]);_0x41f363['push'](_0xa444fe[0x3]);_0x41f363['push'](_0xa444fe[_0x8188('0x1f')](0x4,_0xa444fe[_0x8188('0x16')])[_0x8188('0x18')](','));break;case _0x8188('0x13'):_0x41f363[_0x8188('0x1e')](_0x2fbb7c[_0x8188('0x1d')]);break;case _0x8188('0x23'):_0x41f363[_0x8188('0x1e')](_0x2fbb7c['TagId']);_0x41f363['push'](_0x2fbb7c['appdata']);break;default:_0x41f363=_[_0x8188('0xd')](_0x2fbb7c[_0x8188('0x1d')])?[]:_0x2fbb7c[_0x8188('0x1d')][_0x8188('0x21')](',');}var _0xeef8da={'id':util['format'](_0x8188('0x24'),_0x216de5,_0x2fbb7c['id'],_0x2fbb7c[_0x8188('0x19')]),'condition':require(_0x8188('0x25'))['condition'](_0x216de5,getIntervals(_0x2f2815[_0x8188('0x26')],_0x2fbb7c),_0x2f2815),'consequence':require('./applications/'+_0x2fbb7c[_0x8188('0x19')])['consequence'](_0x216de5,_0x41f363,_0x2f2815,_0x452314),'p':_0x2fbb7c[_0x8188('0x27')]||0x0};logger[_0x8188('0x28')](_0x8188('0x29'),_0xeef8da['id'],_0x8188('0x2a'),getIntervals(_0x2f2815['intervals'],_0x2fbb7c)[_0x8188('0x18')](_0x8188('0x2b')));_0x19f0e0[_0x8188('0x1e')](_0xeef8da);}else{logger[_0x8188('0x2c')]('Please\x20create\x20a\x20new\x20file\x20under',path[_0x8188('0x18')](__dirname,'applications',_0x2fbb7c[_0x8188('0x19')]+_0x8188('0x1a')));}}_0x2f2815[_0x8188('0x12')][_0x216de5]=new RuleEngine(_0x19f0e0);_0x2f2815[_0x8188('0x12')][_0x216de5][_0x8188('0x2d')](_0x452314,function(_0x307a97){logger[_0x8188('0x28')](_0x8188('0x2e'),JSON[_0x8188('0x2f')](_0x307a97[_0x8188('0x30')]));if(_0x2f2815[_0x8188('0x12')][_0x216de5]){_0x2f2815[_0x8188('0x12')][_0x216de5][_0x8188('0x31')](_0x8188('0x32'));}});return _0x271a0b({'code':0xc8,'message':_0x452314});}else{logger[_0x8188('0x28')](_0x8188('0x33'));return _0x271a0b({'code':0xc8,'message':_0x452314});}}catch(_0x2233f0){logger['error'](_0x2233f0['stack']);return _0x4f1563(_0x3feba3[_0x8188('0x2c')](0x1f4,_0x2233f0));}}return _0x4f1563('routing\x20is\x20empty');});},'AcceptMessage':function(_0x2738ea){var _0x18876e=this;return new Promise(function(_0x206600,_0x12fe75){if(_0x2738ea[_0x8188('0x13')]&&_0x2738ea[_0x8188('0x13')]['id']){try{var _0x15199b=getId(_0x2738ea[_0x8188('0x34')],_0x2738ea[_0x8188('0x13')]?_0x2738ea['message']['id']:0x0,_0x2738ea[_0x8188('0x14')]?_0x2738ea[_0x8188('0x14')]['id']:0x0);if(_0x2f2815[_0x8188('0x12')][_0x15199b]){_0x2f2815[_0x8188('0x12')][_0x15199b][_0x8188('0x31')](_0x8188('0x35'));if(rpc[_0x2738ea[_0x8188('0x34')]+_0x8188('0x36')]){rpc[_0x2738ea[_0x8188('0x34')]+_0x8188('0x36')][_0x8188('0x37')](_0x15199b,{'UserId':_0x2738ea[_0x8188('0x13')][_0x8188('0x38')]})[_0x8188('0x39')](function(_0xf0ab40){logger['error']('error\x20update\x20queue\x20report');});}}return _0x206600({'code':0xc8,'message':_0x2738ea});}catch(_0x3e7203){logger[_0x8188('0x2c')](_0x3e7203[_0x8188('0x3a')]);return _0x12fe75(_0x18876e[_0x8188('0x2c')](0x1f4,_0x3e7203));}}logger['error'](_0x8188('0x3b'));return _0x12fe75(_0x18876e[_0x8188('0x2c')](0x1f4,_0x8188('0x3b')));});},'RejectMessage':function(_0x26aeec){var _0x32cf8d=this;return new Promise(function(_0x4e4c3b,_0x2687a3){if(_0x26aeec[_0x8188('0x3c')]&&_0x26aeec[_0x8188('0x3c')]['id']){try{if(_0x2f2815['agents'][_0x26aeec[_0x8188('0x3c')]['id']]){_0x2f2815[_0x8188('0x3d')][_0x26aeec['agent']['id']][_0x8188('0x3e')]=![];_0x2f2815[_0x8188('0x3d')][_0x26aeec['agent']['id']][_0x8188('0x3f')]=undefined;}return _0x4e4c3b({'code':0xc8,'message':_0x26aeec});}catch(_0x5c30d4){logger[_0x8188('0x2c')](_0x5c30d4[_0x8188('0x3a')]);return _0x2687a3(_0x32cf8d[_0x8188('0x2c')](0x1f4,_0x5c30d4));}}logger['error'](_0x8188('0x3b'));return _0x2687a3(_0x32cf8d[_0x8188('0x2c')](0x1f4,_0x8188('0x3b')));});},'AbandonInteraction':function(_0x5c5a5e){var _0x530301=this;return new Promise(function(_0x517966,_0x2dc809){if(_0x5c5a5e[_0x8188('0x34')]&&_0x5c5a5e[_0x8188('0x14')]&&_0x5c5a5e[_0x8188('0x14')]['id']){try{var _0x508b07=getId(_0x5c5a5e[_0x8188('0x34')],_0x5c5a5e['message']?_0x5c5a5e[_0x8188('0x13')]['id']:0x0,_0x5c5a5e['interaction']?_0x5c5a5e[_0x8188('0x14')]['id']:0x0);if(_0x2f2815[_0x8188('0x12')][_0x508b07]){_0x2f2815[_0x8188('0x12')][_0x508b07]['emit']('end');}return _0x517966({'code':0xc8,'message':_0x5c5a5e});}catch(_0x5df9fb){logger[_0x8188('0x2c')](_0x5df9fb['stack']);return _0x2dc809(_0x530301['error'](0x1f4,_0x5df9fb));}}logger['error'](_0x8188('0x3b'));return _0x2dc809(_0x530301[_0x8188('0x2c')](0x1f4,_0x8188('0x3b')));});},'AgentCapacity':function(_0x3ca6a0){var _0x14919b=this;return new Promise(function(_0x4cce45,_0x161e62){if(_0x2f2815[_0x8188('0x3d')][_0x8188('0x40')](_0x3ca6a0['id'])){for(var _0x22fb20 in _0x3ca6a0[_0x8188('0x41')]){if(_0x3ca6a0[_0x8188('0x41')][_0x8188('0x40')](_0x22fb20)){if(_0x2f2815['agents'][_0x3ca6a0['id']][_0x8188('0x40')](_0x22fb20+'CurrentCapacity')){_0x2f2815[_0x8188('0x3d')][_0x3ca6a0['id']][_0x22fb20+_0x8188('0x42')]=parseInt(_0x3ca6a0[_0x8188('0x41')][_0x22fb20],0xa);}}}_0x2f2815[_0x8188('0x3d')][_0x3ca6a0['id']]['updateRealtime']();return _0x4cce45({'code':0xc8,'message':_0x2f2815[_0x8188('0x3d')][_0x3ca6a0['id']]});}else{return _0x161e62(_0x14919b[_0x8188('0x2c')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x3838e0){return new Promise(function(_0x1ad446,_0x4ed9a4){var _0x3017c3=_[_0x8188('0x43')](_0x2f2815[_0x8188('0x3d')]);_0x1ad446({'count':_0x3017c3[_0x8188('0x16')],'rows':_0x3017c3});});},'ChatQueues':function(_0x4d899b){return new Promise(function(_0x5456a6,_0xcd6608){var _0x4adfe9=[];for(var _0x39241e in _0x2f2815[_0x8188('0x44')]){if(_0x2f2815[_0x8188('0x44')]['hasOwnProperty'](_0x39241e)){var _0x2e48ef=_0x2f2815[_0x8188('0x44')][_0x39241e];var _0x2a2ba2={'id':_0x2e48ef['id'],'available':_0x2e48ef[_0x8188('0x45')],'loggedIn':_0x2e48ef['loggedIn'],'name':_0x2e48ef[_0x8188('0x46')],'paused':_0x2e48ef[_0x8188('0x47')],'waiting':_0x2e48ef[_0x8188('0x48')]};_0x4adfe9['push'](_0x2a2ba2);}}_0x5456a6({'count':_0x4adfe9[_0x8188('0x16')],'rows':_0x4adfe9});});},'MailQueues':function(_0x5badb7){return new Promise(function(_0x460a2e,_0x34b8a7){var _0x52923a=[];for(var _0x55f046 in _0x2f2815[_0x8188('0x49')]){if(_0x2f2815[_0x8188('0x49')][_0x8188('0x40')](_0x55f046)){var _0x4c7c1f=_0x2f2815[_0x8188('0x49')][_0x55f046];var _0x7c16cc={'id':_0x4c7c1f['id'],'available':_0x4c7c1f[_0x8188('0x45')],'loggedIn':_0x4c7c1f[_0x8188('0x4a')],'name':_0x4c7c1f[_0x8188('0x46')],'paused':_0x4c7c1f[_0x8188('0x47')],'waiting':_0x4c7c1f[_0x8188('0x48')]};_0x52923a[_0x8188('0x1e')](_0x7c16cc);}}_0x460a2e({'count':_0x52923a[_0x8188('0x16')],'rows':_0x52923a});});},'OpenchannelQueues':function(_0x319e7c){return new Promise(function(_0x419183,_0x398e2d){var _0x5e2dd1=[];for(var _0x69fc26 in _0x2f2815['openchannelQueues']){if(_0x2f2815[_0x8188('0x4b')][_0x8188('0x40')](_0x69fc26)){var _0x16d0e6=_0x2f2815[_0x8188('0x4b')][_0x69fc26];var _0x241938={'id':_0x16d0e6['id'],'available':_0x16d0e6['available'],'loggedIn':_0x16d0e6[_0x8188('0x4a')],'name':_0x16d0e6['name'],'paused':_0x16d0e6[_0x8188('0x47')],'waiting':_0x16d0e6[_0x8188('0x48')]};_0x5e2dd1[_0x8188('0x1e')](_0x241938);}}_0x419183({'count':_0x5e2dd1[_0x8188('0x16')],'rows':_0x5e2dd1});});},'SmsQueues':function(_0x5af4be){return new Promise(function(_0x3b2157,_0x3d78bc){var _0x278295=[];for(var _0xf8763c in _0x2f2815[_0x8188('0x4c')]){if(_0x2f2815[_0x8188('0x4c')][_0x8188('0x40')](_0xf8763c)){var _0x1b60ac=_0x2f2815['smsQueues'][_0xf8763c];var _0x2e7af8={'id':_0x1b60ac['id'],'available':_0x1b60ac['available'],'loggedIn':_0x1b60ac[_0x8188('0x4a')],'name':_0x1b60ac[_0x8188('0x46')],'paused':_0x1b60ac[_0x8188('0x47')],'waiting':_0x1b60ac[_0x8188('0x48')]};_0x278295[_0x8188('0x1e')](_0x2e7af8);}}_0x3b2157({'count':_0x278295[_0x8188('0x16')],'rows':_0x278295});});},'FaxQueues':function(_0x2eec46){return new Promise(function(_0x188ae9,_0x1ebc41){var _0xc06ea7=[];for(var _0x3b8714 in _0x2f2815[_0x8188('0x4d')]){if(_0x2f2815[_0x8188('0x4d')][_0x8188('0x40')](_0x3b8714)){var _0x49c75c=_0x2f2815[_0x8188('0x4d')][_0x3b8714];var _0x273dca={'id':_0x49c75c['id'],'available':_0x49c75c[_0x8188('0x45')],'loggedIn':_0x49c75c[_0x8188('0x4a')],'name':_0x49c75c[_0x8188('0x46')],'paused':_0x49c75c[_0x8188('0x47')],'waiting':_0x49c75c[_0x8188('0x48')]};_0xc06ea7[_0x8188('0x1e')](_0x273dca);}}_0x188ae9({'count':_0xc06ea7[_0x8188('0x16')],'rows':_0xc06ea7});});},'ChatQueuesWaitingInteractions':function(_0x13511d){return new Promise(function(_0x374c96,_0x365c02){var _0x174f36=_['values'](_0x2f2815[_0x8188('0x4e')]);_0x374c96({'count':_0x174f36[_0x8188('0x16')],'rows':_0x174f36});});},'MailQueuesWaitingInteractions':function(_0x492c20){return new Promise(function(_0x28f57f,_0xcfa1ed){var _0x1f657a=_[_0x8188('0x43')](_0x2f2815['mailQueuesWaitingInteractions']);_0x28f57f({'count':_0x1f657a['length'],'rows':_0x1f657a});});},'OpenchannelQueuesWaitingInteractions':function(_0x4cf4b4){return new Promise(function(_0x13ad88,_0x41c165){var _0x17ae72=_['values'](_0x2f2815[_0x8188('0x4f')]);_0x13ad88({'count':_0x17ae72[_0x8188('0x16')],'rows':_0x17ae72});});},'SmsQueuesWaitingInteractions':function(_0x4b9fcb){return new Promise(function(_0xc3a2a5,_0x2833f7){var _0x10b681=_[_0x8188('0x43')](_0x2f2815[_0x8188('0x50')]);_0xc3a2a5({'count':_0x10b681[_0x8188('0x16')],'rows':_0x10b681});});},'FaxQueuesWaitingInteractions':function(_0x231f44){return new Promise(function(_0x55d99c,_0x593e46){var _0x3051d3=_[_0x8188('0x43')](_0x2f2815[_0x8188('0x51')]);_0x55d99c({'count':_0x3051d3['length'],'rows':_0x3051d3});});}};var _0x105ae5=jayson['server'](_0x45473a)[_0x8188('0x52')]();_0x105ae5['on'](_0x8188('0x2c'),function(_0x10568c){logger['error'](JSON['stringify'](_0x10568c));return _0x22e948(_0x10568c);});_0x105ae5[_0x8188('0x11')](0x232c,_0x8188('0x53'),function(){console[_0x8188('0x54')](_0x8188('0x55'),0x232c);return _0x30bccf(_0x8188('0x56')+0x232c);});});}; \ No newline at end of file +var _0x18dc=['intervals','./applications/','consequence','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','execute','Applications\x20executed','stringify','matchPath','emit','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','channel','end','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty','agent','agents','busyQueue','hasOwnProperty','CurrentCapacity','capacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','paused','waiting','mailQueues','available','openchannelQueues','smsQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','bluebird','uuid','../../../config/environment','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','message','interaction','applications','isArray','length','existsSync','join','app','.js','toLowerCase','appdata','split','push','slice','dialogflow','amazonlex','tag','TagId','format','%s:%s:%s','./interval','condition'];(function(_0x535de7,_0xc933a1){var _0x1a347e=function(_0x33de63){while(--_0x33de63){_0x535de7['push'](_0x535de7['shift']());}};_0x1a347e(++_0xc933a1);}(_0x18dc,0x1b7));var _0xc18d=function(_0x3f0406,_0x3d338d){_0x3f0406=_0x3f0406-0x0;var _0x667f30=_0x18dc[_0x3f0406];return _0x667f30;};'use strict';var _=require(_0xc18d('0x0'));var util=require(_0xc18d('0x1'));var path=require('path');var fs=require('fs');var jayson=require(_0xc18d('0x2'));var BPromise=require(_0xc18d('0x3'));var uuid=require(_0xc18d('0x4'));var config=require(_0xc18d('0x5'));var logger=require(_0xc18d('0x6'))(_0xc18d('0x7'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport')};var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xc18d('0x8')),'chatQueueReport':require('../rpc/chatQueueReport'),'smsQueueReport':require(_0xc18d('0x9')),'faxQueueReport':require(_0xc18d('0xa'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x2f1f8a,_0x443cdd,_0x1e2233){return util['format'](_0xc18d('0xb'),_0x2f1f8a,_0x443cdd||0x0,_0x1e2233||0x0);}function getIntervals(_0x526933,_0x531bed){var _0x2e7388=[];if(!_[_0xc18d('0xc')](_0x531bed[_0xc18d('0xd')])&&!_[_0xc18d('0xc')](_0x526933[_0x531bed['IntervalId']])&&!_[_0xc18d('0xc')](_0x526933[_0x531bed['IntervalId']][_0xc18d('0xe')])){_0x2e7388=_[_0xc18d('0xf')](_0x526933[_0x531bed['IntervalId']][_0xc18d('0xe')],_0xc18d('0x10'));}else if(!_[_0xc18d('0xc')](_0x531bed[_0xc18d('0x10')])){_0x2e7388=[_0x531bed[_0xc18d('0x10')]];}return _0x2e7388;}exports[_0xc18d('0x11')]=function(_0x36c81a){_0x36c81a[_0xc18d('0x12')]={};return new BPromise(function(_0x6d0d48,_0x7b109d){var _0x56e3fb={'Start':function(_0x4eed1a){var _0x155b6c=this;return new Promise(function(_0x3a3dcd,_0x58ea85){if(_0x4eed1a){try{var _0x12fe85=[];var _0x469f21=getId(_0x4eed1a['channel'],_0x4eed1a[_0xc18d('0x13')]?_0x4eed1a[_0xc18d('0x13')]['id']:0x0,_0x4eed1a['interaction']?_0x4eed1a[_0xc18d('0x14')]['id']:0x0);if(_0x4eed1a[_0xc18d('0x15')]&&_[_0xc18d('0x16')](_0x4eed1a[_0xc18d('0x15')])&&_0x4eed1a[_0xc18d('0x15')]['length']){for(var _0xb269fc=0x0;_0xb269fc<_0x4eed1a[_0xc18d('0x15')][_0xc18d('0x17')];_0xb269fc+=0x1){var _0x5568ff=_0x4eed1a[_0xc18d('0x15')][_0xb269fc];if(fs[_0xc18d('0x18')](path[_0xc18d('0x19')](__dirname,'applications',_0x5568ff[_0xc18d('0x1a')]+_0xc18d('0x1b')))){var _0x190ff9=[];switch(_0x5568ff[_0xc18d('0x1a')][_0xc18d('0x1c')]()){case'autoreply':var _0x1ab05c=_0x5568ff[_0xc18d('0x1d')][_0xc18d('0x1e')](',');_0x190ff9[_0xc18d('0x1f')](_0x1ab05c[0x0]);_0x190ff9['push'](_0x1ab05c[_0xc18d('0x20')](0x1,_0x1ab05c[_0xc18d('0x17')])[_0xc18d('0x19')](','));break;case _0xc18d('0x21'):var _0x510ebb=_0x5568ff[_0xc18d('0x1d')]['split'](',');_0x190ff9[_0xc18d('0x1f')](_0x510ebb[0x0]);_0x190ff9[_0xc18d('0x1f')](_0x510ebb[0x1]);_0x190ff9[_0xc18d('0x1f')](_0x510ebb[_0xc18d('0x20')](0x2,_0x510ebb[_0xc18d('0x17')])[_0xc18d('0x19')](','));break;case _0xc18d('0x22'):var _0x56ec9f=_0x5568ff[_0xc18d('0x1d')]['split'](',');_0x190ff9[_0xc18d('0x1f')](_0x56ec9f[0x0]);_0x190ff9['push'](_0x56ec9f[0x1]);_0x190ff9[_0xc18d('0x1f')](_0x56ec9f[0x2]);_0x190ff9['push'](_0x56ec9f[0x3]);_0x190ff9['push'](_0x56ec9f[_0xc18d('0x20')](0x4,_0x56ec9f[_0xc18d('0x17')])[_0xc18d('0x19')](','));break;case _0xc18d('0x13'):_0x190ff9[_0xc18d('0x1f')](_0x5568ff['appdata']);break;case _0xc18d('0x23'):_0x190ff9[_0xc18d('0x1f')](_0x5568ff[_0xc18d('0x24')]);_0x190ff9[_0xc18d('0x1f')](_0x5568ff['appdata']);break;default:_0x190ff9=_[_0xc18d('0xc')](_0x5568ff['appdata'])?[]:_0x5568ff[_0xc18d('0x1d')][_0xc18d('0x1e')](',');}var _0x7af659={'id':util[_0xc18d('0x25')](_0xc18d('0x26'),_0x469f21,_0x5568ff['id'],_0x5568ff[_0xc18d('0x1a')]),'condition':require(_0xc18d('0x27'))[_0xc18d('0x28')](_0x469f21,getIntervals(_0x36c81a[_0xc18d('0x29')],_0x5568ff),_0x36c81a),'consequence':require(_0xc18d('0x2a')+_0x5568ff[_0xc18d('0x1a')])[_0xc18d('0x2b')](_0x469f21,_0x190ff9,_0x36c81a,_0x4eed1a),'p':_0x5568ff[_0xc18d('0x2c')]||0x0};logger[_0xc18d('0x2d')](_0xc18d('0x2e'),_0x7af659['id'],_0xc18d('0x2f'),getIntervals(_0x36c81a[_0xc18d('0x29')],_0x5568ff)[_0xc18d('0x19')](_0xc18d('0x30')));_0x12fe85[_0xc18d('0x1f')](_0x7af659);}else{logger[_0xc18d('0x31')](_0xc18d('0x32'),path['join'](__dirname,_0xc18d('0x15'),_0x5568ff[_0xc18d('0x1a')]+_0xc18d('0x1b')));}}_0x36c81a[_0xc18d('0x12')][_0x469f21]=new RuleEngine(_0x12fe85);_0x36c81a[_0xc18d('0x12')][_0x469f21][_0xc18d('0x33')](_0x4eed1a,function(_0xb1c991){logger[_0xc18d('0x2d')](_0xc18d('0x34'),JSON[_0xc18d('0x35')](_0xb1c991[_0xc18d('0x36')]));if(_0x36c81a[_0xc18d('0x12')][_0x469f21]){_0x36c81a[_0xc18d('0x12')][_0x469f21][_0xc18d('0x37')]('complete');}});return _0x3a3dcd({'code':0xc8,'message':_0x4eed1a});}else{logger['info'](_0xc18d('0x38'));return _0x3a3dcd({'code':0xc8,'message':_0x4eed1a});}}catch(_0x4619fa){logger[_0xc18d('0x31')](_0x4619fa[_0xc18d('0x39')]);return _0x58ea85(_0x155b6c[_0xc18d('0x31')](0x1f4,_0x4619fa));}}return _0x58ea85(_0xc18d('0x3a'));});},'AcceptMessage':function(_0x218179){var _0x20aab4=this;return new Promise(function(_0x5ccf13,_0x6d317){if(_0x218179[_0xc18d('0x13')]&&_0x218179['message']['id']){try{var _0x180926=getId(_0x218179[_0xc18d('0x3b')],_0x218179[_0xc18d('0x13')]?_0x218179[_0xc18d('0x13')]['id']:0x0,_0x218179[_0xc18d('0x14')]?_0x218179[_0xc18d('0x14')]['id']:0x0);if(_0x36c81a['rules'][_0x180926]){_0x36c81a['rules'][_0x180926]['emit'](_0xc18d('0x3c'));if(rpc[_0x218179[_0xc18d('0x3b')]+'QueueReport']){rpc[_0x218179[_0xc18d('0x3b')]+_0xc18d('0x3d')][_0xc18d('0x3e')](_0x180926,{'UserId':_0x218179[_0xc18d('0x13')][_0xc18d('0x3f')]})[_0xc18d('0x40')](function(_0x13c7b5){logger[_0xc18d('0x31')](_0xc18d('0x41'));});}}return _0x5ccf13({'code':0xc8,'message':_0x218179});}catch(_0x1b782d){logger[_0xc18d('0x31')](_0x1b782d[_0xc18d('0x39')]);return _0x6d317(_0x20aab4[_0xc18d('0x31')](0x1f4,_0x1b782d));}}logger[_0xc18d('0x31')](_0xc18d('0x42'));return _0x6d317(_0x20aab4[_0xc18d('0x31')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x34a097){var _0x6957eb=this;return new Promise(function(_0x88cc6a,_0x2e253c){if(_0x34a097[_0xc18d('0x43')]&&_0x34a097[_0xc18d('0x43')]['id']){try{if(_0x36c81a[_0xc18d('0x44')][_0x34a097[_0xc18d('0x43')]['id']]){_0x36c81a[_0xc18d('0x44')][_0x34a097['agent']['id']]['busy']=![];_0x36c81a[_0xc18d('0x44')][_0x34a097[_0xc18d('0x43')]['id']][_0xc18d('0x45')]=undefined;}return _0x88cc6a({'code':0xc8,'message':_0x34a097});}catch(_0x3e3885){logger['error'](_0x3e3885[_0xc18d('0x39')]);return _0x2e253c(_0x6957eb['error'](0x1f4,_0x3e3885));}}logger[_0xc18d('0x31')](_0xc18d('0x42'));return _0x2e253c(_0x6957eb['error'](0x1f4,_0xc18d('0x42')));});},'AbandonInteraction':function(_0x386af1){var _0x201950=this;return new Promise(function(_0x4f12d2,_0x27c15b){if(_0x386af1[_0xc18d('0x3b')]&&_0x386af1[_0xc18d('0x14')]&&_0x386af1[_0xc18d('0x14')]['id']){try{var _0x52d516=getId(_0x386af1[_0xc18d('0x3b')],_0x386af1['message']?_0x386af1[_0xc18d('0x13')]['id']:0x0,_0x386af1[_0xc18d('0x14')]?_0x386af1['interaction']['id']:0x0);if(_0x36c81a[_0xc18d('0x12')][_0x52d516]){_0x36c81a[_0xc18d('0x12')][_0x52d516][_0xc18d('0x37')]('end');}return _0x4f12d2({'code':0xc8,'message':_0x386af1});}catch(_0x230bf1){logger[_0xc18d('0x31')](_0x230bf1['stack']);return _0x27c15b(_0x201950['error'](0x1f4,_0x230bf1));}}logger[_0xc18d('0x31')](_0xc18d('0x42'));return _0x27c15b(_0x201950[_0xc18d('0x31')](0x1f4,_0xc18d('0x42')));});},'AgentCapacity':function(_0x27a5b0){var _0x4f3f41=this;return new Promise(function(_0x2cb6f8,_0x5cdf27){if(_0x36c81a[_0xc18d('0x44')]['hasOwnProperty'](_0x27a5b0['id'])){for(var _0x255c12 in _0x27a5b0['capacity']){if(_0x27a5b0['capacity'][_0xc18d('0x46')](_0x255c12)){if(_0x36c81a['agents'][_0x27a5b0['id']][_0xc18d('0x46')](_0x255c12+_0xc18d('0x47'))){_0x36c81a[_0xc18d('0x44')][_0x27a5b0['id']][_0x255c12+_0xc18d('0x47')]=parseInt(_0x27a5b0[_0xc18d('0x48')][_0x255c12],0xa);}}}_0x36c81a[_0xc18d('0x44')][_0x27a5b0['id']][_0xc18d('0x49')]();return _0x2cb6f8({'code':0xc8,'message':_0x36c81a[_0xc18d('0x44')][_0x27a5b0['id']]});}else{return _0x5cdf27(_0x4f3f41['error'](0x1f4,_0xc18d('0x4a')));}});},'Agents':function(_0x346adb){return new Promise(function(_0x35a8c7,_0x126d9b){var _0x321ed7=_[_0xc18d('0x4b')](_0x36c81a[_0xc18d('0x44')]);_0x35a8c7({'count':_0x321ed7[_0xc18d('0x17')],'rows':_0x321ed7});});},'ChatQueues':function(_0x9e0216){return new Promise(function(_0xafe76a,_0x59f83f){var _0x1c9c1e=[];for(var _0x3cba71 in _0x36c81a[_0xc18d('0x4c')]){if(_0x36c81a[_0xc18d('0x4c')]['hasOwnProperty'](_0x3cba71)){var _0xfa9d0b=_0x36c81a[_0xc18d('0x4c')][_0x3cba71];var _0x4f5bdd={'id':_0xfa9d0b['id'],'available':_0xfa9d0b['available'],'loggedIn':_0xfa9d0b[_0xc18d('0x4d')],'name':_0xfa9d0b[_0xc18d('0x4e')],'paused':_0xfa9d0b[_0xc18d('0x4f')],'waiting':_0xfa9d0b[_0xc18d('0x50')]};_0x1c9c1e[_0xc18d('0x1f')](_0x4f5bdd);}}_0xafe76a({'count':_0x1c9c1e[_0xc18d('0x17')],'rows':_0x1c9c1e});});},'MailQueues':function(_0x101837){return new Promise(function(_0xf7aa94,_0x274535){var _0xa855c4=[];for(var _0x5bbed7 in _0x36c81a[_0xc18d('0x51')]){if(_0x36c81a['mailQueues'][_0xc18d('0x46')](_0x5bbed7)){var _0x50a82a=_0x36c81a[_0xc18d('0x51')][_0x5bbed7];var _0x5e80f4={'id':_0x50a82a['id'],'available':_0x50a82a[_0xc18d('0x52')],'loggedIn':_0x50a82a[_0xc18d('0x4d')],'name':_0x50a82a[_0xc18d('0x4e')],'paused':_0x50a82a[_0xc18d('0x4f')],'waiting':_0x50a82a[_0xc18d('0x50')]};_0xa855c4['push'](_0x5e80f4);}}_0xf7aa94({'count':_0xa855c4[_0xc18d('0x17')],'rows':_0xa855c4});});},'OpenchannelQueues':function(_0x26f589){return new Promise(function(_0x46fa94,_0x18060a){var _0x12f946=[];for(var _0x53bcca in _0x36c81a['openchannelQueues']){if(_0x36c81a[_0xc18d('0x53')]['hasOwnProperty'](_0x53bcca)){var _0x445664=_0x36c81a['openchannelQueues'][_0x53bcca];var _0x1e0675={'id':_0x445664['id'],'available':_0x445664[_0xc18d('0x52')],'loggedIn':_0x445664['loggedIn'],'name':_0x445664['name'],'paused':_0x445664[_0xc18d('0x4f')],'waiting':_0x445664[_0xc18d('0x50')]};_0x12f946[_0xc18d('0x1f')](_0x1e0675);}}_0x46fa94({'count':_0x12f946['length'],'rows':_0x12f946});});},'SmsQueues':function(_0x1d42f3){return new Promise(function(_0x5e77c8,_0x57ee52){var _0x509f44=[];for(var _0xf177eb in _0x36c81a[_0xc18d('0x54')]){if(_0x36c81a[_0xc18d('0x54')]['hasOwnProperty'](_0xf177eb)){var _0x137f31=_0x36c81a[_0xc18d('0x54')][_0xf177eb];var _0x3e5643={'id':_0x137f31['id'],'available':_0x137f31[_0xc18d('0x52')],'loggedIn':_0x137f31[_0xc18d('0x4d')],'name':_0x137f31[_0xc18d('0x4e')],'paused':_0x137f31[_0xc18d('0x4f')],'waiting':_0x137f31[_0xc18d('0x50')]};_0x509f44['push'](_0x3e5643);}}_0x5e77c8({'count':_0x509f44['length'],'rows':_0x509f44});});},'FaxQueues':function(_0x155b80){return new Promise(function(_0x12b79a,_0x53ec75){var _0x46ef82=[];for(var _0x2c82c2 in _0x36c81a['faxQueues']){if(_0x36c81a[_0xc18d('0x55')][_0xc18d('0x46')](_0x2c82c2)){var _0x4c8ef3=_0x36c81a[_0xc18d('0x55')][_0x2c82c2];var _0x2c0e32={'id':_0x4c8ef3['id'],'available':_0x4c8ef3[_0xc18d('0x52')],'loggedIn':_0x4c8ef3[_0xc18d('0x4d')],'name':_0x4c8ef3[_0xc18d('0x4e')],'paused':_0x4c8ef3[_0xc18d('0x4f')],'waiting':_0x4c8ef3['waiting']};_0x46ef82[_0xc18d('0x1f')](_0x2c0e32);}}_0x12b79a({'count':_0x46ef82[_0xc18d('0x17')],'rows':_0x46ef82});});},'ChatQueuesWaitingInteractions':function(_0x54ebbc){return new Promise(function(_0x37c4de,_0x470bff){var _0xe44df=_[_0xc18d('0x4b')](_0x36c81a['chatQueuesWaitingInteractions']);_0x37c4de({'count':_0xe44df[_0xc18d('0x17')],'rows':_0xe44df});});},'MailQueuesWaitingInteractions':function(_0x500f0d){return new Promise(function(_0x5a8db9,_0x12c880){var _0x6be5=_[_0xc18d('0x4b')](_0x36c81a[_0xc18d('0x56')]);_0x5a8db9({'count':_0x6be5['length'],'rows':_0x6be5});});},'OpenchannelQueuesWaitingInteractions':function(_0x4f7378){return new Promise(function(_0x359582,_0x19bef8){var _0x3a03a2=_['values'](_0x36c81a[_0xc18d('0x57')]);_0x359582({'count':_0x3a03a2[_0xc18d('0x17')],'rows':_0x3a03a2});});},'SmsQueuesWaitingInteractions':function(_0x465b37){return new Promise(function(_0x30d894,_0x1e1932){var _0x50ffcc=_[_0xc18d('0x4b')](_0x36c81a[_0xc18d('0x58')]);_0x30d894({'count':_0x50ffcc[_0xc18d('0x17')],'rows':_0x50ffcc});});},'FaxQueuesWaitingInteractions':function(_0x13d88b){return new Promise(function(_0x50dc9d,_0x549838){var _0x593343=_[_0xc18d('0x4b')](_0x36c81a[_0xc18d('0x59')]);_0x50dc9d({'count':_0x593343['length'],'rows':_0x593343});});}};var _0x138936=jayson[_0xc18d('0x5a')](_0x56e3fb)[_0xc18d('0x5b')]();_0x138936['on'](_0xc18d('0x31'),function(_0x1ee3a5){logger[_0xc18d('0x31')](JSON[_0xc18d('0x35')](_0x1ee3a5));return _0x7b109d(_0x1ee3a5);});_0x138936['listen'](0x232c,_0xc18d('0x5c'),function(){console[_0xc18d('0x5d')](_0xc18d('0x5e'),0x232c);return _0x6d0d48(_0xc18d('0x5f')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index 381a87b..d24e1a6 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 _0xd3e3=['lodash','routing','client','request','error','message','catch','condition','rules','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','iftime\x20%s','then','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','when','\x20|\x20','stack','stop','bluebird','jayson/promise'];(function(_0x189ada,_0x8aee39){var _0x37f78f=function(_0x4df9ba){while(--_0x4df9ba){_0x189ada['push'](_0x189ada['shift']());}};_0x37f78f(++_0x8aee39);}(_0xd3e3,0x1c9));var _0x3d3e=function(_0x1ab2cf,_0x4f2f4e){_0x1ab2cf=_0x1ab2cf-0x0;var _0x3a8aa0=_0xd3e3[_0x1ab2cf];return _0x3a8aa0;};'use strict';var util=require('util');var BPromise=require(_0x3d3e('0x0'));var jayson=require(_0x3d3e('0x1'));var _=require(_0x3d3e('0x2'));var logger=require('../../../config/logger')(_0x3d3e('0x3'));var client=jayson[_0x3d3e('0x4')]['http']({'port':0x232a});function request(_0x47e193,_0x5344fe){return new BPromise(function(_0x14f02c,_0x5049a1){return client[_0x3d3e('0x5')](_0x47e193,_0x5344fe)['then'](function(_0x5412bf){if(_0x5412bf['error']){return _0x5049a1(_0x5412bf[_0x3d3e('0x6')][_0x3d3e('0x7')]);}else{return _0x14f02c(_0x5412bf['result']);}})[_0x3d3e('0x8')](function(_0x5857b2){return _0x5049a1(_0x5857b2);});});}exports[_0x3d3e('0x9')]=function(_0x1cf73f,_0x19bc65,_0x2b8083){return function(_0x419312){if(_0x2b8083[_0x3d3e('0xa')]&&!_0x2b8083[_0x3d3e('0xa')][_0x1cf73f]){logger['info'](_0x3d3e('0xb'),_0x1cf73f);return _0x419312['stop']();}var _0xb42d80=[];for(var _0x354df1=0x0;_0x354df1<_0x19bc65[_0x3d3e('0xc')];_0x354df1+=0x1){_0xb42d80[_0x3d3e('0xd')](request(_0x3d3e('0xe'),{'command':util['format'](_0x3d3e('0xf'),_0x19bc65[_0x354df1])})[_0x3d3e('0x10')](function(_0x28baba){return _0x28baba&&_0x28baba[_0x3d3e('0x7')]&&_0x28baba[_0x3d3e('0x7')]['indexOf'](_0x3d3e('0x11'))>=0x0?!![]:![];})[_0x3d3e('0x8')](function(_0x2957f0){logger[_0x3d3e('0x6')](_0x3d3e('0x12'),_0x1cf73f,_0x19bc65[_0x354df1]);}));}BPromise[_0x3d3e('0x13')](_0xb42d80)[_0x3d3e('0x10')](function(_0x3b7b8a){var _0x58c33f=_[_0x3d3e('0x14')](_0x3b7b8a);logger['info'](_0x3d3e('0x15'),_0x1cf73f,_0x19bc65[_0x3d3e('0x16')]('\x20|\x20'),_0x58c33f);_0x419312[_0x3d3e('0x17')](_0x58c33f);})[_0x3d3e('0x8')](function(_0x1b71ab){console['log'](_0x1b71ab);logger[_0x3d3e('0x6')]('[%s][INTERVAL]\x20%s\x20%s',_0x1cf73f,_0x19bc65[_0x3d3e('0x16')](_0x3d3e('0x18')),_0x1b71ab[_0x3d3e('0x19')]);_0x419312[_0x3d3e('0x1a')]();});};}; \ No newline at end of file +var _0x288f=['join','log','\x20|\x20','stack','util','bluebird','jayson/promise','../../../config/logger','routing','client','error','message','result','catch','condition','rules','info','stop','length','push','Command','format','then','indexOf','true','[%s][INTERVAL]\x20%s','some','[%s][INTERVAL]\x20%s\x20%s'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x288f,0xe4));var _0xf288=function(_0x4f4ef7,_0x11642b){_0x4f4ef7=_0x4f4ef7-0x0;var _0x5e3efc=_0x288f[_0x4f4ef7];return _0x5e3efc;};'use strict';var util=require(_0xf288('0x0'));var BPromise=require(_0xf288('0x1'));var jayson=require(_0xf288('0x2'));var _=require('lodash');var logger=require(_0xf288('0x3'))(_0xf288('0x4'));var client=jayson[_0xf288('0x5')]['http']({'port':0x232a});function request(_0x1f18ca,_0x4268e0){return new BPromise(function(_0x4d445d,_0x3b834e){return client['request'](_0x1f18ca,_0x4268e0)['then'](function(_0x597d81){if(_0x597d81[_0xf288('0x6')]){return _0x3b834e(_0x597d81[_0xf288('0x6')][_0xf288('0x7')]);}else{return _0x4d445d(_0x597d81[_0xf288('0x8')]);}})[_0xf288('0x9')](function(_0x46efe6){return _0x3b834e(_0x46efe6);});});}exports[_0xf288('0xa')]=function(_0x5b5ef2,_0x2bd586,_0x474199){return function(_0x83e4f9){if(_0x474199[_0xf288('0xb')]&&!_0x474199['rules'][_0x5b5ef2]){logger[_0xf288('0xc')]('[%s][INTERVAL]\x20ROUTING\x20STOPPED',_0x5b5ef2);return _0x83e4f9[_0xf288('0xd')]();}var _0x313ef2=[];for(var _0x247686=0x0;_0x247686<_0x2bd586[_0xf288('0xe')];_0x247686+=0x1){_0x313ef2[_0xf288('0xf')](request(_0xf288('0x10'),{'command':util[_0xf288('0x11')]('iftime\x20%s',_0x2bd586[_0x247686])})[_0xf288('0x12')](function(_0x36c2f1){return _0x36c2f1&&_0x36c2f1[_0xf288('0x7')]&&_0x36c2f1[_0xf288('0x7')][_0xf288('0x13')](_0xf288('0x14'))>=0x0?!![]:![];})[_0xf288('0x9')](function(_0x321d1f){logger[_0xf288('0x6')](_0xf288('0x15'),_0x5b5ef2,_0x2bd586[_0x247686]);}));}BPromise['all'](_0x313ef2)[_0xf288('0x12')](function(_0x2552d9){var _0x4a5e45=_[_0xf288('0x16')](_0x2552d9);logger['info'](_0xf288('0x17'),_0x5b5ef2,_0x2bd586[_0xf288('0x18')]('\x20|\x20'),_0x4a5e45);_0x83e4f9['when'](_0x4a5e45);})['catch'](function(_0x2d9596){console[_0xf288('0x19')](_0x2d9596);logger['error'](_0xf288('0x17'),_0x5b5ef2,_0x2bd586['join'](_0xf288('0x1a')),_0x2d9596[_0xf288('0x1b')]);_0x83e4f9[_0xf288('0xd')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index b66c99c..84f217e 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 _0x955f=['origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','agent','lodash','util','./utils','format','channel','membername','interface','calleridnum','lastevent','queue','then','type','agentacw','agentcomplete','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalledAt','now','called','connectedlinenum','connectedlinename','error','stack','agentringnoanswer','timeout','holdtime','ringtime','talktime','forIn','uniqueid','abandoned','reason','agentconnect','agentconnectAt','connect','agentringnoanswerAt','answered_elsewhere','answeredelsewheremembername','agentcompleteAt','diffTime','complete','blindtransfer','isNil','transfereruniqueid','transfer','blind','transferexten','extension','transferuniqueid','attendedtransfer'];(function(_0x440a2a,_0x149ff3){var _0x190705=function(_0x34f20e){while(--_0x34f20e){_0x440a2a['push'](_0x440a2a['shift']());}};_0x190705(++_0x149ff3);}(_0x955f,0x1eb));var _0xf955=function(_0x12e4ad,_0x14676d){_0x12e4ad=_0x12e4ad-0x0;var _0x549497=_0x955f[_0x12e4ad];return _0x549497;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var utils=require(_0xf955('0x2'));var agents={};var transfers={};function writeDB(_0x382225,_0x2834f7){utils['info'](util[_0xf955('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x382225['uniqueid'],_0x382225[_0xf955('0x4')],_0x382225['queue'],_0x382225[_0xf955('0x5')],_0x382225[_0xf955('0x6')],_0x382225[_0xf955('0x7')],_0x382225['connectedlinenum'],_0x382225[_0xf955('0x8')]));if(_0x382225[_0xf955('0x9')]){utils['getVoiceQueueByName'](_0x382225[_0xf955('0x9')])[_0xf955('0xa')](function(_0x168ffb){if(_0x168ffb){_0x382225[_0xf955('0xb')]=_0x168ffb[_0xf955('0xb')];_0x382225[_0xf955('0xc')]=_0x382225[_0xf955('0xd')]?_0x168ffb['acw']:![];_0x382225[_0xf955('0xe')]=_0x382225['agentacw']?_0x168ffb[_0xf955('0xf')]:0x0;}utils[_0xf955('0x10')](_0xf955('0x11'),_0x382225);});}else{utils['request'](_0xf955('0x11'),_0x382225);}if(_0x2834f7){delete transfers[_0x382225['uniqueid']];}else{delete agents[_0x382225[_0xf955('0x12')]];}}exports['agentcalled']=function(_0x19c94a){try{agents[_0x19c94a[_0xf955('0x12')]]=_0x19c94a;agents[_0x19c94a[_0xf955('0x12')]][_0xf955('0x13')]=utils[_0xf955('0x14')]();agents[_0x19c94a[_0xf955('0x12')]][_0xf955('0x8')]=_0xf955('0x15');agents[_0x19c94a[_0xf955('0x12')]][_0xf955('0x16')]=null;agents[_0x19c94a['destuniqueid']][_0xf955('0x17')]=null;}catch(_0x54e60b){utils[_0xf955('0x18')](_0x54e60b[_0xf955('0x19')]);}};exports[_0xf955('0x1a')]=function(_0x15c07c){try{if(!_['isNil'](agents[_0x15c07c['destuniqueid']])){agents[_0x15c07c[_0xf955('0x12')]][_0xf955('0x1a')]=!![];agents[_0x15c07c[_0xf955('0x12')]]['agentringnoanswerAt']=utils[_0xf955('0x14')]();agents[_0x15c07c[_0xf955('0x12')]][_0xf955('0x8')]=_0xf955('0x1b');agents[_0x15c07c[_0xf955('0x12')]]['reason']=_0xf955('0x1b');agents[_0x15c07c[_0xf955('0x12')]][_0xf955('0x1c')]=_0x15c07c['ringtime']?parseInt(_0x15c07c[_0xf955('0x1d')])/0x3e8:0x0;agents[_0x15c07c['destuniqueid']][_0xf955('0x1e')]=0x0;writeDB(agents[_0x15c07c[_0xf955('0x12')]]);}}catch(_0x37143d){utils[_0xf955('0x18')](_0x37143d[_0xf955('0x19')]);}};exports['queuecallerabandon']=function(_0x25f4f2){try{_[_0xf955('0x1f')](agents,function(_0x3585c7,_0x13a1a7){if(_0x3585c7[_0xf955('0x20')]==_0x25f4f2[_0xf955('0x20')]){_0x3585c7[_0xf955('0x1a')]=!![];_0x3585c7['agentringnoanswerAt']=utils[_0xf955('0x14')]();_0x3585c7[_0xf955('0x8')]=_0xf955('0x21');_0x3585c7[_0xf955('0x22')]=_0xf955('0x21');_0x3585c7[_0xf955('0x1c')]=_0x25f4f2[_0xf955('0x1c')];_0x3585c7['talktime']=0x0;writeDB(_0x3585c7);}});}catch(_0x3caea6){utils[_0xf955('0x18')](_0x3caea6[_0xf955('0x19')]);}};exports[_0xf955('0x23')]=function(_0x28fa9c){try{if(agents[_0x28fa9c[_0xf955('0x12')]]){agents[_0x28fa9c['destuniqueid']][_0xf955('0x24')]=utils[_0xf955('0x14')]();agents[_0x28fa9c['destuniqueid']][_0xf955('0x16')]=_0x28fa9c[_0xf955('0x16')];agents[_0x28fa9c[_0xf955('0x12')]][_0xf955('0x17')]=_0x28fa9c['connectedlinename'];agents[_0x28fa9c[_0xf955('0x12')]]['holdtime']=_0x28fa9c[_0xf955('0x1d')];agents[_0x28fa9c[_0xf955('0x12')]][_0xf955('0x8')]=_0xf955('0x25');_[_0xf955('0x1f')](agents,function(_0x32121b,_0xd5dfb0){if(_0x32121b[_0xf955('0x12')]!=_0x28fa9c['destuniqueid']&&_0x32121b[_0xf955('0x20')]==_0x28fa9c[_0xf955('0x20')]){_0x32121b[_0xf955('0x1e')]=0x0;_0x32121b[_0xf955('0x1c')]=_0x28fa9c['ringtime'];_0x32121b[_0xf955('0x1a')]=!![];_0x32121b[_0xf955('0x26')]=utils[_0xf955('0x14')]();_0x32121b[_0xf955('0x8')]=_0xf955('0x27');_0x32121b['reason']='answered_elsewhere';_0x32121b['answeredelsewheredestinationuniqueid']=_0x28fa9c[_0xf955('0x12')];_0x32121b[_0xf955('0x28')]=_0x28fa9c[_0xf955('0x5')];writeDB(_0x32121b);}});}}catch(_0x6d564c){utils[_0xf955('0x18')](_0x6d564c[_0xf955('0x19')]);}};exports['agentcomplete']=function(_0x3acc4b){try{if(!_['isNil'](agents[_0x3acc4b[_0xf955('0x12')]])){agents[_0x3acc4b[_0xf955('0x12')]][_0xf955('0xd')]=!![];agents[_0x3acc4b['destuniqueid']][_0xf955('0x29')]=utils['now']();agents[_0x3acc4b[_0xf955('0x12')]][_0xf955('0x1e')]=utils[_0xf955('0x2a')](agents[_0x3acc4b[_0xf955('0x12')]]['agentcompleteAt'],agents[_0x3acc4b[_0xf955('0x12')]][_0xf955('0x24')]);agents[_0x3acc4b['destuniqueid']][_0xf955('0x22')]=_0x3acc4b[_0xf955('0x22')];agents[_0x3acc4b[_0xf955('0x12')]]['lastevent']=_0xf955('0x2b');writeDB(agents[_0x3acc4b[_0xf955('0x12')]]);}}catch(_0x11b7e2){utils['error'](_0x11b7e2[_0xf955('0x19')]);}};exports[_0xf955('0x2c')]=function(_0x21e4a6){try{if(!_[_0xf955('0x2d')](agents[_0x21e4a6[_0xf955('0x2e')]])){agents[_0x21e4a6[_0xf955('0x2e')]][_0xf955('0x2f')]=!![];agents[_0x21e4a6[_0xf955('0x2e')]]['transfertype']=_0xf955('0x30');agents[_0x21e4a6[_0xf955('0x2e')]][_0xf955('0x31')]=_0x21e4a6[_0xf955('0x32')];agents[_0x21e4a6[_0xf955('0x2e')]][_0xf955('0x33')]=agents[_0x21e4a6[_0xf955('0x2e')]][_0xf955('0x20')];}}catch(_0x47651b){utils[_0xf955('0x18')](_0x47651b[_0xf955('0x19')]);}};exports[_0xf955('0x34')]=function(_0x40d7e9){try{if(_0x40d7e9[_0xf955('0x35')]==_0x40d7e9[_0xf955('0x36')]){if(!_[_0xf955('0x2d')](agents[_0x40d7e9[_0xf955('0x37')]])){agents[_0x40d7e9[_0xf955('0x37')]][_0xf955('0x2f')]=!![];agents[_0x40d7e9['secondtransfereruniqueid']][_0xf955('0x38')]=_0xf955('0x39');agents[_0x40d7e9[_0xf955('0x37')]]['transferexten']=_0x40d7e9[_0xf955('0x3a')];agents[_0x40d7e9['secondtransfereruniqueid']][_0xf955('0x33')]=_0x40d7e9['origtransfereruniqueid'];}if(_0x40d7e9[_0xf955('0x3b')]&&agents[_0x40d7e9[_0xf955('0x3b')]]){agents[_0x40d7e9[_0xf955('0x3b')]][_0xf955('0x3c')]=0x1;transfers[_0x40d7e9['transfereeuniqueid']]=_[_0xf955('0x3d')](agents[_0x40d7e9[_0xf955('0x3b')]]);transfers[_0x40d7e9[_0xf955('0x3b')]]['calleridnum']=agents[_0x40d7e9['secondtransfereruniqueid']][_0xf955('0x7')];transfers[_0x40d7e9[_0xf955('0x3b')]][_0xf955('0x3e')]=agents[_0x40d7e9[_0xf955('0x37')]]['calleridname'];transfers[_0x40d7e9[_0xf955('0x3b')]][_0xf955('0x13')]=utils[_0xf955('0x14')]();transfers[_0x40d7e9['transfereeuniqueid']][_0xf955('0x24')]=utils['now']();transfers[_0x40d7e9[_0xf955('0x3b')]][_0xf955('0x1c')]=0x0;transfers[_0x40d7e9[_0xf955('0x3b')]]['agententerreason']=0x2;}}else if(_0x40d7e9[_0xf955('0x37')]==_0x40d7e9[_0xf955('0x3f')]){if(!_[_0xf955('0x2d')](agents[_0x40d7e9[_0xf955('0x35')]])){agents[_0x40d7e9['origtransfereruniqueid']][_0xf955('0x2f')]=!![];agents[_0x40d7e9[_0xf955('0x35')]][_0xf955('0x38')]=_0xf955('0x39');agents[_0x40d7e9[_0xf955('0x35')]]['transferexten']=_0x40d7e9[_0xf955('0x40')];agents[_0x40d7e9['origtransfereruniqueid']][_0xf955('0x33')]=_0x40d7e9['secondtransfereruniqueid'];}if(_0x40d7e9[_0xf955('0x41')]&&agents[_0x40d7e9['transfertargetuniqueid']]){agents[_0x40d7e9['transfertargetuniqueid']][_0xf955('0x3c')]=0x1;transfers[_0x40d7e9[_0xf955('0x41')]]=_['clone'](agents[_0x40d7e9[_0xf955('0x41')]]);transfers[_0x40d7e9['transfertargetuniqueid']]['calleridnum']=agents[_0x40d7e9['origtransfereruniqueid']]['calleridnum'];transfers[_0x40d7e9[_0xf955('0x41')]][_0xf955('0x3e')]=agents[_0x40d7e9['origtransfereruniqueid']]['calleridname'];transfers[_0x40d7e9[_0xf955('0x41')]][_0xf955('0x13')]=utils[_0xf955('0x14')]();transfers[_0x40d7e9[_0xf955('0x41')]][_0xf955('0x24')]=utils[_0xf955('0x14')]();transfers[_0x40d7e9[_0xf955('0x41')]][_0xf955('0x1c')]=0x0;transfers[_0x40d7e9[_0xf955('0x41')]][_0xf955('0x3c')]=0x2;}}}catch(_0x1b7b73){utils[_0xf955('0x18')](_0x1b7b73['stack']);}};exports[_0xf955('0x42')]=function(_0x2e1186){try{if(transfers[_0x2e1186[_0xf955('0x20')]]){transfers[_0x2e1186[_0xf955('0x20')]][_0xf955('0xd')]=!![];transfers[_0x2e1186['uniqueid']][_0xf955('0x29')]=utils[_0xf955('0x14')]();transfers[_0x2e1186[_0xf955('0x20')]][_0xf955('0x1e')]=utils[_0xf955('0x2a')](transfers[_0x2e1186[_0xf955('0x20')]][_0xf955('0x29')],transfers[_0x2e1186[_0xf955('0x20')]][_0xf955('0x24')]);transfers[_0x2e1186[_0xf955('0x20')]]['reason']=_0xf955('0x43');transfers[_0x2e1186[_0xf955('0x20')]][_0xf955('0x8')]=_0xf955('0x2b');writeDB(transfers[_0x2e1186[_0xf955('0x20')]],!![]);}if(agents[_0x2e1186[_0xf955('0x20')]]&&agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0x24')]){agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0xd')]=!![];agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0x29')]=utils['now']();agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0x1e')]=utils[_0xf955('0x2a')](agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0x29')],agents[_0x2e1186[_0xf955('0x20')]][_0xf955('0x24')]);agents[_0x2e1186['uniqueid']]['reason']=agents[_0x2e1186['uniqueid']][_0xf955('0x2f')]?'transfer':'agent';agents[_0x2e1186[_0xf955('0x20')]]['lastevent']=_0xf955('0x2b');writeDB(agents[_0x2e1186[_0xf955('0x20')]]);}}catch(_0x158469){utils[_0xf955('0x18')](_0x158469['stack']);}}; \ No newline at end of file +var _0x9264=['agentcomplete','acw','CreateVoiceAgentReport','request','destuniqueid','agentcalled','agentcalledAt','now','lastevent','called','connectedlinename','error','stack','agentringnoanswer','timeout','reason','holdtime','talktime','forIn','agentringnoanswerAt','abandoned','ringtime','connect','uniqueid','answered_elsewhere','answeredelsewheredestinationuniqueid','membername','isNil','agentcompleteAt','diffTime','agentconnectAt','complete','blindtransfer','transfer','transfereruniqueid','transfertype','blind','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','transfertargetuniqueid','hangup','agent','lodash','util','./utils','format','channel','calleridnum','connectedlinenum','queue','getVoiceQueueByName','then','type','agentacw'];(function(_0x5e5e75,_0x1cb75f){var _0x52db5e=function(_0x458081){while(--_0x458081){_0x5e5e75['push'](_0x5e5e75['shift']());}};_0x52db5e(++_0x1cb75f);}(_0x9264,0xb1));var _0x4926=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9264[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x4926('0x0'));var util=require(_0x4926('0x1'));var utils=require(_0x4926('0x2'));var agents={};var transfers={};function writeDB(_0x4e5d0,_0x59fed0){utils['info'](util[_0x4926('0x3')]('AGENT|%s|%s|%s|%s|%s|%s|%s|%s',_0x4e5d0['uniqueid'],_0x4e5d0[_0x4926('0x4')],_0x4e5d0['queue'],_0x4e5d0['membername'],_0x4e5d0['interface'],_0x4e5d0[_0x4926('0x5')],_0x4e5d0[_0x4926('0x6')],_0x4e5d0['lastevent']));if(_0x4e5d0[_0x4926('0x7')]){utils[_0x4926('0x8')](_0x4e5d0['queue'])[_0x4926('0x9')](function(_0x425893){if(_0x425893){_0x4e5d0[_0x4926('0xa')]=_0x425893['type'];_0x4e5d0[_0x4926('0xb')]=_0x4e5d0[_0x4926('0xc')]?_0x425893[_0x4926('0xd')]:![];_0x4e5d0['acwtime']=_0x4e5d0[_0x4926('0xb')]?_0x425893['acwTimeout']:0x0;}utils['request'](_0x4926('0xe'),_0x4e5d0);});}else{utils[_0x4926('0xf')](_0x4926('0xe'),_0x4e5d0);}if(_0x59fed0){delete transfers[_0x4e5d0['uniqueid']];}else{delete agents[_0x4e5d0[_0x4926('0x10')]];}}exports[_0x4926('0x11')]=function(_0x42b003){try{agents[_0x42b003[_0x4926('0x10')]]=_0x42b003;agents[_0x42b003[_0x4926('0x10')]][_0x4926('0x12')]=utils[_0x4926('0x13')]();agents[_0x42b003[_0x4926('0x10')]][_0x4926('0x14')]=_0x4926('0x15');agents[_0x42b003[_0x4926('0x10')]][_0x4926('0x6')]=null;agents[_0x42b003[_0x4926('0x10')]][_0x4926('0x16')]=null;}catch(_0x55b957){utils[_0x4926('0x17')](_0x55b957[_0x4926('0x18')]);}};exports[_0x4926('0x19')]=function(_0x5736dd){try{if(!_['isNil'](agents[_0x5736dd[_0x4926('0x10')]])){agents[_0x5736dd['destuniqueid']][_0x4926('0x19')]=!![];agents[_0x5736dd[_0x4926('0x10')]]['agentringnoanswerAt']=utils[_0x4926('0x13')]();agents[_0x5736dd['destuniqueid']][_0x4926('0x14')]=_0x4926('0x1a');agents[_0x5736dd[_0x4926('0x10')]][_0x4926('0x1b')]='timeout';agents[_0x5736dd['destuniqueid']][_0x4926('0x1c')]=_0x5736dd['ringtime']?parseInt(_0x5736dd['ringtime'])/0x3e8:0x0;agents[_0x5736dd[_0x4926('0x10')]][_0x4926('0x1d')]=0x0;writeDB(agents[_0x5736dd['destuniqueid']]);}}catch(_0xfd1095){utils['error'](_0xfd1095[_0x4926('0x18')]);}};exports['queuecallerabandon']=function(_0x10d0b2){try{_[_0x4926('0x1e')](agents,function(_0x2df18c,_0x44eb88){if(_0x2df18c['uniqueid']==_0x10d0b2['uniqueid']){_0x2df18c['agentringnoanswer']=!![];_0x2df18c[_0x4926('0x1f')]=utils[_0x4926('0x13')]();_0x2df18c[_0x4926('0x14')]=_0x4926('0x20');_0x2df18c['reason']='abandoned';_0x2df18c['holdtime']=_0x10d0b2[_0x4926('0x1c')];_0x2df18c[_0x4926('0x1d')]=0x0;writeDB(_0x2df18c);}});}catch(_0x18f56d){utils['error'](_0x18f56d['stack']);}};exports['agentconnect']=function(_0x37701c){try{if(agents[_0x37701c[_0x4926('0x10')]]){agents[_0x37701c[_0x4926('0x10')]]['agentconnectAt']=utils[_0x4926('0x13')]();agents[_0x37701c[_0x4926('0x10')]][_0x4926('0x6')]=_0x37701c[_0x4926('0x6')];agents[_0x37701c[_0x4926('0x10')]][_0x4926('0x16')]=_0x37701c['connectedlinename'];agents[_0x37701c[_0x4926('0x10')]][_0x4926('0x1c')]=_0x37701c[_0x4926('0x21')];agents[_0x37701c[_0x4926('0x10')]][_0x4926('0x14')]=_0x4926('0x22');_[_0x4926('0x1e')](agents,function(_0x50ea49,_0x4564a4){if(_0x50ea49[_0x4926('0x10')]!=_0x37701c['destuniqueid']&&_0x50ea49[_0x4926('0x23')]==_0x37701c[_0x4926('0x23')]){_0x50ea49[_0x4926('0x1d')]=0x0;_0x50ea49[_0x4926('0x1c')]=_0x37701c[_0x4926('0x21')];_0x50ea49[_0x4926('0x19')]=!![];_0x50ea49[_0x4926('0x1f')]=utils[_0x4926('0x13')]();_0x50ea49[_0x4926('0x14')]=_0x4926('0x24');_0x50ea49[_0x4926('0x1b')]=_0x4926('0x24');_0x50ea49[_0x4926('0x25')]=_0x37701c[_0x4926('0x10')];_0x50ea49['answeredelsewheremembername']=_0x37701c[_0x4926('0x26')];writeDB(_0x50ea49);}});}}catch(_0x12d414){utils[_0x4926('0x17')](_0x12d414[_0x4926('0x18')]);}};exports['agentcomplete']=function(_0x297b36){try{if(!_[_0x4926('0x27')](agents[_0x297b36[_0x4926('0x10')]])){agents[_0x297b36[_0x4926('0x10')]][_0x4926('0xc')]=!![];agents[_0x297b36['destuniqueid']][_0x4926('0x28')]=utils[_0x4926('0x13')]();agents[_0x297b36[_0x4926('0x10')]]['talktime']=utils[_0x4926('0x29')](agents[_0x297b36[_0x4926('0x10')]][_0x4926('0x28')],agents[_0x297b36[_0x4926('0x10')]][_0x4926('0x2a')]);agents[_0x297b36[_0x4926('0x10')]]['reason']=_0x297b36[_0x4926('0x1b')];agents[_0x297b36[_0x4926('0x10')]][_0x4926('0x14')]=_0x4926('0x2b');writeDB(agents[_0x297b36[_0x4926('0x10')]]);}}catch(_0x5237f4){utils[_0x4926('0x17')](_0x5237f4[_0x4926('0x18')]);}};exports[_0x4926('0x2c')]=function(_0x203d4c){try{if(!_['isNil'](agents[_0x203d4c['transfereruniqueid']])){agents[_0x203d4c['transfereruniqueid']][_0x4926('0x2d')]=!![];agents[_0x203d4c[_0x4926('0x2e')]][_0x4926('0x2f')]=_0x4926('0x30');agents[_0x203d4c[_0x4926('0x2e')]]['transferexten']=_0x203d4c['extension'];agents[_0x203d4c['transfereruniqueid']]['transferuniqueid']=agents[_0x203d4c[_0x4926('0x2e')]][_0x4926('0x23')];}}catch(_0x4380da){utils[_0x4926('0x17')](_0x4380da[_0x4926('0x18')]);}};exports['attendedtransfer']=function(_0x2e10e8){try{if(_0x2e10e8[_0x4926('0x31')]==_0x2e10e8[_0x4926('0x32')]){if(!_[_0x4926('0x27')](agents[_0x2e10e8[_0x4926('0x33')]])){agents[_0x2e10e8[_0x4926('0x33')]][_0x4926('0x2d')]=!![];agents[_0x2e10e8[_0x4926('0x33')]][_0x4926('0x2f')]=_0x4926('0x34');agents[_0x2e10e8['secondtransfereruniqueid']]['transferexten']=_0x2e10e8[_0x4926('0x35')];agents[_0x2e10e8['secondtransfereruniqueid']][_0x4926('0x36')]=_0x2e10e8[_0x4926('0x31')];}if(_0x2e10e8[_0x4926('0x37')]&&agents[_0x2e10e8['transfereeuniqueid']]){agents[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x38')]=0x1;transfers[_0x2e10e8[_0x4926('0x37')]]=_[_0x4926('0x39')](agents[_0x2e10e8[_0x4926('0x37')]]);transfers[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x5')]=agents[_0x2e10e8[_0x4926('0x33')]][_0x4926('0x5')];transfers[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x3a')]=agents[_0x2e10e8[_0x4926('0x33')]][_0x4926('0x3a')];transfers[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x12')]=utils['now']();transfers[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x2a')]=utils['now']();transfers[_0x2e10e8[_0x4926('0x37')]][_0x4926('0x1c')]=0x0;transfers[_0x2e10e8[_0x4926('0x37')]]['agententerreason']=0x2;}}else if(_0x2e10e8[_0x4926('0x33')]==_0x2e10e8[_0x4926('0x3b')]){if(!_[_0x4926('0x27')](agents[_0x2e10e8[_0x4926('0x31')]])){agents[_0x2e10e8[_0x4926('0x31')]][_0x4926('0x2d')]=!![];agents[_0x2e10e8[_0x4926('0x31')]][_0x4926('0x2f')]='ATTENDED';agents[_0x2e10e8[_0x4926('0x31')]]['transferexten']=_0x2e10e8['secondtransfererexten'];agents[_0x2e10e8[_0x4926('0x31')]][_0x4926('0x36')]=_0x2e10e8['secondtransfereruniqueid'];}if(_0x2e10e8[_0x4926('0x3c')]&&agents[_0x2e10e8[_0x4926('0x3c')]]){agents[_0x2e10e8[_0x4926('0x3c')]][_0x4926('0x38')]=0x1;transfers[_0x2e10e8[_0x4926('0x3c')]]=_[_0x4926('0x39')](agents[_0x2e10e8['transfertargetuniqueid']]);transfers[_0x2e10e8['transfertargetuniqueid']]['calleridnum']=agents[_0x2e10e8['origtransfereruniqueid']][_0x4926('0x5')];transfers[_0x2e10e8[_0x4926('0x3c')]][_0x4926('0x3a')]=agents[_0x2e10e8[_0x4926('0x31')]][_0x4926('0x3a')];transfers[_0x2e10e8[_0x4926('0x3c')]]['agentcalledAt']=utils[_0x4926('0x13')]();transfers[_0x2e10e8[_0x4926('0x3c')]]['agentconnectAt']=utils[_0x4926('0x13')]();transfers[_0x2e10e8[_0x4926('0x3c')]]['holdtime']=0x0;transfers[_0x2e10e8[_0x4926('0x3c')]][_0x4926('0x38')]=0x2;}}}catch(_0x4bad13){utils[_0x4926('0x17')](_0x4bad13['stack']);}};exports[_0x4926('0x3d')]=function(_0x691972){try{if(transfers[_0x691972[_0x4926('0x23')]]){transfers[_0x691972[_0x4926('0x23')]][_0x4926('0xc')]=!![];transfers[_0x691972['uniqueid']]['agentcompleteAt']=utils[_0x4926('0x13')]();transfers[_0x691972[_0x4926('0x23')]]['talktime']=utils[_0x4926('0x29')](transfers[_0x691972[_0x4926('0x23')]][_0x4926('0x28')],transfers[_0x691972['uniqueid']][_0x4926('0x2a')]);transfers[_0x691972[_0x4926('0x23')]][_0x4926('0x1b')]=_0x4926('0x3e');transfers[_0x691972['uniqueid']]['lastevent']='complete';writeDB(transfers[_0x691972[_0x4926('0x23')]],!![]);}if(agents[_0x691972[_0x4926('0x23')]]&&agents[_0x691972[_0x4926('0x23')]][_0x4926('0x2a')]){agents[_0x691972['uniqueid']]['agentcomplete']=!![];agents[_0x691972['uniqueid']][_0x4926('0x28')]=utils[_0x4926('0x13')]();agents[_0x691972[_0x4926('0x23')]][_0x4926('0x1d')]=utils[_0x4926('0x29')](agents[_0x691972[_0x4926('0x23')]][_0x4926('0x28')],agents[_0x691972[_0x4926('0x23')]]['agentconnectAt']);agents[_0x691972['uniqueid']][_0x4926('0x1b')]=agents[_0x691972[_0x4926('0x23')]][_0x4926('0x2d')]?_0x4926('0x2d'):'agent';agents[_0x691972['uniqueid']]['lastevent']=_0x4926('0x2b');writeDB(agents[_0x691972[_0x4926('0x23')]]);}}catch(_0x490ba8){utils['error'](_0x490ba8[_0x4926('0x18')]);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index aa9dfeb..ec4d3bb 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 _0xe5ed=['xmd-callerid','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','sipcallid','application','set','startsWith','appdata','toLowerCase','split','substring','lastIndexOf','includes','noop','lodash','NO\x20ANSWER','FAILED','ANSWERED','BUSY','info','format','CALL|%s|%s|%s|%s|%s|%s|%s|%s','type','accountcode','source','destination','callerid','disposition','UserId','CreateVoiceCallReport','request','uniqueid','newchannel','linkedid','channel','OutgoingSpoolFailed','calleridnum','exten','context','now','DOCUMENTATION','error','isNil','channelstate','systemanswertime','transfer','destinationchannel','toNumber','stack','hangup','calleridname','endtime','duration','diffTime','answertime','attendedtransfer','localtwolinkedid','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstop','musiconholdstartAt','mohtime','varset','variable','value','xmd-phone','\x22\x20<','xmd-callerid-preview'];(function(_0x445550,_0x2c060e){var _0x1a66f7=function(_0x51fefc){while(--_0x51fefc){_0x445550['push'](_0x445550['shift']());}};_0x1a66f7(++_0x2c060e);}(_0xe5ed,0x156));var _0xde5e=function(_0xf22faa,_0x16bd24){_0xf22faa=_0xf22faa-0x0;var _0x4e40bc=_0xe5ed[_0xf22faa];return _0x4e40bc;};'use strict';var _=require(_0xde5e('0x0'));var util=require('util');var utils=require('./utils');var dispositions=[_0xde5e('0x1'),'FAILED',_0xde5e('0x2'),_0xde5e('0x1'),_0xde5e('0x1'),_0xde5e('0x1'),_0xde5e('0x3'),_0xde5e('0x4'),_0xde5e('0x2'),_0xde5e('0x2'),'FAILED'];var channels={};function writeDB(_0x455cab){utils[_0xde5e('0x5')](util[_0xde5e('0x6')](_0xde5e('0x7'),_0x455cab['uniqueid'],_0x455cab['channel'],_0x455cab[_0xde5e('0x8')],_0x455cab[_0xde5e('0x9')],_0x455cab[_0xde5e('0xa')],_0x455cab[_0xde5e('0xb')],_0x455cab[_0xde5e('0xc')],_0x455cab[_0xde5e('0xd')]));if(_0x455cab[_0xde5e('0x9')]){utils['getUserByInternal'](_0x455cab['accountcode'])['then'](function(_0x387662){if(_0x387662){_0x455cab[_0xde5e('0xe')]=_0x387662['id'];}utils['request'](_0xde5e('0xf'),_0x455cab);});}else{utils[_0xde5e('0x10')](_0xde5e('0xf'),_0x455cab);}if(channels[_0x455cab[_0xde5e('0x11')]]){delete channels[_0x455cab[_0xde5e('0x11')]];}}exports[_0xde5e('0x12')]=function(_0x64a05b){try{if(_0x64a05b['uniqueid']==_0x64a05b[_0xde5e('0x13')]&&_0x64a05b[_0xde5e('0x14')]!=_0xde5e('0x15')){channels[_0x64a05b[_0xde5e('0x11')]]={'uniqueid':_0x64a05b[_0xde5e('0x11')],'accountcode':_0x64a05b[_0xde5e('0x9')],'source':_0x64a05b[_0xde5e('0x16')],'destination':_0x64a05b[_0xde5e('0x17')],'destinationcontext':_0x64a05b[_0xde5e('0x18')],'channel':_0x64a05b['channel'],'starttime':utils[_0xde5e('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xde5e('0x1'),'amaflags':_0xde5e('0x1a')};}}catch(_0x26af75){utils[_0xde5e('0x1b')](_0x26af75['stack']);}};exports['newstate']=function(_0x267459){try{if(!_[_0xde5e('0x1c')](channels[_0x267459[_0xde5e('0x11')]])&&_0x267459[_0xde5e('0x1d')]==0x6){if(_[_0xde5e('0x1c')](channels[_0x267459[_0xde5e('0x11')]][_0xde5e('0x1e')])){channels[_0x267459[_0xde5e('0x11')]][_0xde5e('0x1e')]=utils['now']();}}else if(!_[_0xde5e('0x1c')](channels[_0x267459['linkedid']])&&_0x267459[_0xde5e('0x1d')]==0x6&&_0x267459[_0xde5e('0x18')]!=_0xde5e('0x1f')){channels[_0x267459[_0xde5e('0x13')]][_0xde5e('0x9')]=_0x267459[_0xde5e('0x9')];channels[_0x267459[_0xde5e('0x13')]][_0xde5e('0x20')]=_0x267459['channel'];if(_[_0xde5e('0x1c')](channels[_0x267459[_0xde5e('0x13')]]['answertime'])){channels[_0x267459[_0xde5e('0x13')]]['answertime']=utils[_0xde5e('0x19')]();}channels[_0x267459[_0xde5e('0x13')]]['disposition']=dispositions[_[_0xde5e('0x21')](_0x267459[_0xde5e('0x1d')])]||_0xde5e('0x3');}}catch(_0x4a6c43){utils[_0xde5e('0x1b')](_0x4a6c43[_0xde5e('0x22')]);}};exports[_0xde5e('0x23')]=function(_0x47efe9){try{if(!_[_0xde5e('0x1c')](channels[_0x47efe9[_0xde5e('0x11')]])){if(_[_0xde5e('0x1c')](channels[_0x47efe9['uniqueid']][_0xde5e('0xc')])){channels[_0x47efe9['uniqueid']][_0xde5e('0xc')]=_0x47efe9[_0xde5e('0x24')]+'\x20<'+_0x47efe9[_0xde5e('0x16')]+'>';}channels[_0x47efe9[_0xde5e('0x11')]][_0xde5e('0x25')]=utils[_0xde5e('0x19')]();channels[_0x47efe9[_0xde5e('0x11')]][_0xde5e('0x26')]=utils[_0xde5e('0x27')](channels[_0x47efe9[_0xde5e('0x11')]][_0xde5e('0x25')],channels[_0x47efe9['uniqueid']]['starttime']);channels[_0x47efe9[_0xde5e('0x11')]]['billableseconds']=channels[_0x47efe9[_0xde5e('0x11')]][_0xde5e('0x28')]?utils['diffTime'](channels[_0x47efe9[_0xde5e('0x11')]]['endtime'],channels[_0x47efe9['uniqueid']][_0xde5e('0x28')]):0x0;writeDB(channels[_0x47efe9[_0xde5e('0x11')]]);}}catch(_0x1912d9){utils[_0xde5e('0x1b')](_0x1912d9[_0xde5e('0x22')]);}};exports[_0xde5e('0x29')]=function(_0x93d37f){try{if(!_['isNil'](channels[_0x93d37f[_0xde5e('0x2a')]])){if(channels[_0x93d37f[_0xde5e('0x2a')]]['channel']==_0x93d37f['transfereechannel']){channels[_0x93d37f[_0xde5e('0x2a')]][_0xde5e('0x20')]=_0x93d37f[_0xde5e('0x2b')];channels[_0x93d37f[_0xde5e('0x2a')]][_0xde5e('0x2c')]=_0xde5e('0x2d');}else if(channels[_0x93d37f[_0xde5e('0x2a')]][_0xde5e('0x14')]=_0x93d37f[_0xde5e('0x2e')]){channels[_0x93d37f['localtwolinkedid']]['destinationchannel']=_0x93d37f[_0xde5e('0x2f')];channels[_0x93d37f[_0xde5e('0x2a')]][_0xde5e('0x2c')]='_attended';}}}catch(_0x44dc10){utils[_0xde5e('0x1b')](_0x44dc10[_0xde5e('0x22')]);}};exports[_0xde5e('0x30')]=function(_0x194049){try{if(!_[_0xde5e('0x1c')](channels[_0x194049['uniqueid']])){channels[_0x194049['uniqueid']]['musiconholdstartAt']=utils['now']();}}catch(_0x1fad4c){utils[_0xde5e('0x1b')](_0x1fad4c[_0xde5e('0x22')]);}};exports[_0xde5e('0x31')]=function(_0x3a3439){try{if(!_[_0xde5e('0x1c')](channels[_0x3a3439[_0xde5e('0x11')]])){if(!_[_0xde5e('0x1c')](channels[_0x3a3439[_0xde5e('0x11')]][_0xde5e('0x32')])){channels[_0x3a3439[_0xde5e('0x11')]][_0xde5e('0x33')]+=utils[_0xde5e('0x27')](utils[_0xde5e('0x19')](),channels[_0x3a3439[_0xde5e('0x11')]][_0xde5e('0x32')]);delete channels[_0x3a3439[_0xde5e('0x11')]][_0xde5e('0x32')];}}}catch(_0xc425f9){utils['error'](_0xc425f9[_0xde5e('0x22')]);}};exports[_0xde5e('0x34')]=function(_0x2e4e3e){try{if(!_[_0xde5e('0x1c')](channels[_0x2e4e3e[_0xde5e('0x11')]])){if(!_['isNil'](_0x2e4e3e[_0xde5e('0x35')]['xmd-originatecalleridnum'])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0xa')]=_0x2e4e3e[_0xde5e('0x36')];}if(!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x37')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0xb')]=_0x2e4e3e[_0xde5e('0x36')];channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0xc')]='\x22'+_0x2e4e3e[_0xde5e('0x36')]+_0xde5e('0x38')+_0x2e4e3e['value']+'>';}if(!_['isNil'](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x39')])||!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x3a')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0xc')]=_0x2e4e3e[_0xde5e('0x36')];}if(!_['isNil'](_0x2e4e3e[_0xde5e('0x35')]['xmd-queue'])||!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x3b')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x3c')]=_0xde5e('0x3d');channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x3e')]=_0x2e4e3e[_0xde5e('0x36')];channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x3f')]=!![];}if(!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x40')])){channels[_0x2e4e3e['uniqueid']][_0xde5e('0x41')]=_0x2e4e3e[_0xde5e('0x36')];}if(!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x42')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x8')]=_0x2e4e3e['value'];}if(!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x43')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x44')]=_0x2e4e3e[_0xde5e('0x36')];}if(!_[_0xde5e('0x1c')](_0x2e4e3e[_0xde5e('0x35')][_0xde5e('0x45')])){channels[_0x2e4e3e[_0xde5e('0x11')]][_0xde5e('0x45')]=_0x2e4e3e[_0xde5e('0x36')];}}}catch(_0x367a6a){utils[_0xde5e('0x1b')](_0x367a6a[_0xde5e('0x22')]);}};exports['newexten']=function(_0x4912a9){try{if(!_['isNil'](channels[_0x4912a9[_0xde5e('0x11')]])){if(_0x4912a9[_0xde5e('0x46')]['toLowerCase']()==_0xde5e('0x47')&&_[_0xde5e('0x48')](_0x4912a9[_0xde5e('0x49')][_0xde5e('0x4a')](),'cdr')){var _0xe47009=_0x4912a9[_0xde5e('0x49')][_0xde5e('0x4b')]('=');var _0x508ebf=_0xe47009[0x0][_0xde5e('0x4c')](_0xe47009[0x0][_0xde5e('0x4d')]('(')+0x1,_0xe47009[0x0][_0xde5e('0x4d')](')'));var _0x23b7b7=_0xe47009[0x1];channels[_0x4912a9[_0xde5e('0x11')]][_0x508ebf]=_0x23b7b7;}if(!_[_0xde5e('0x4e')]([_0xde5e('0x23'),_0xde5e('0x4f'),'execif',_0xde5e('0x47'),'gotoif'],_0x4912a9[_0xde5e('0x46')][_0xde5e('0x4a')]())){channels[_0x4912a9[_0xde5e('0x11')]]['lastapplication']=_0x4912a9[_0xde5e('0x46')];channels[_0x4912a9[_0xde5e('0x11')]]['lastdata']=_0x4912a9[_0xde5e('0x49')];}}}catch(_0x2c1b80){utils['error'](_0x2c1b80[_0xde5e('0x22')]);}}; \ No newline at end of file +var _0x4ce1=['gotoif','util','./utils','NO\x20ANSWER','ANSWERED','BUSY','FAILED','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','now','DOCUMENTATION','error','stack','isNil','channelstate','systemanswertime','transfer','answertime','toNumber','calleridname','duration','diffTime','starttime','billableseconds','endtime','localtwolinkedid','transfereechannel','destinationchannel','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','musiconholdstart','musiconholdstartAt','musiconholdstop','mohtime','varset','xmd-originatecalleridnum','variable','xmd-phone','value','\x22\x20<','xmd-queue','lastapplication','Queue','queue','xmd-contactid','ContactId','xmd-cdrtype','outboundrouteid','routeid','application','toLowerCase','set','startsWith','appdata','cdr','split','lastIndexOf','includes','hangup','noop','execif'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0x4ce1,0xa3));var _0x14ce=function(_0x542390,_0x57284d){_0x542390=_0x542390-0x0;var _0x5cc7fd=_0x4ce1[_0x542390];return _0x5cc7fd;};'use strict';var _=require('lodash');var util=require(_0x14ce('0x0'));var utils=require(_0x14ce('0x1'));var dispositions=[_0x14ce('0x2'),'FAILED','FAILED',_0x14ce('0x2'),'NO\x20ANSWER',_0x14ce('0x2'),_0x14ce('0x3'),_0x14ce('0x4'),_0x14ce('0x5'),_0x14ce('0x5'),_0x14ce('0x5')];var channels={};function writeDB(_0x29f4ed){utils['info'](util['format'](_0x14ce('0x6'),_0x29f4ed['uniqueid'],_0x29f4ed[_0x14ce('0x7')],_0x29f4ed[_0x14ce('0x8')],_0x29f4ed[_0x14ce('0x9')],_0x29f4ed[_0x14ce('0xa')],_0x29f4ed[_0x14ce('0xb')],_0x29f4ed[_0x14ce('0xc')],_0x29f4ed[_0x14ce('0xd')]));if(_0x29f4ed[_0x14ce('0x9')]){utils[_0x14ce('0xe')](_0x29f4ed[_0x14ce('0x9')])[_0x14ce('0xf')](function(_0x5bb15c){if(_0x5bb15c){_0x29f4ed[_0x14ce('0x10')]=_0x5bb15c['id'];}utils[_0x14ce('0x11')](_0x14ce('0x12'),_0x29f4ed);});}else{utils[_0x14ce('0x11')](_0x14ce('0x12'),_0x29f4ed);}if(channels[_0x29f4ed[_0x14ce('0x13')]]){delete channels[_0x29f4ed[_0x14ce('0x13')]];}}exports['newchannel']=function(_0x5965ae){try{if(_0x5965ae[_0x14ce('0x13')]==_0x5965ae[_0x14ce('0x14')]&&_0x5965ae[_0x14ce('0x7')]!=_0x14ce('0x15')){channels[_0x5965ae[_0x14ce('0x13')]]={'uniqueid':_0x5965ae['uniqueid'],'accountcode':_0x5965ae[_0x14ce('0x9')],'source':_0x5965ae[_0x14ce('0x16')],'destination':_0x5965ae[_0x14ce('0x17')],'destinationcontext':_0x5965ae[_0x14ce('0x18')],'channel':_0x5965ae['channel'],'starttime':utils[_0x14ce('0x19')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0x14ce('0x1a')};}}catch(_0x558f49){utils[_0x14ce('0x1b')](_0x558f49[_0x14ce('0x1c')]);}};exports['newstate']=function(_0x358095){try{if(!_[_0x14ce('0x1d')](channels[_0x358095[_0x14ce('0x13')]])&&_0x358095[_0x14ce('0x1e')]==0x6){if(_['isNil'](channels[_0x358095['uniqueid']][_0x14ce('0x1f')])){channels[_0x358095['uniqueid']][_0x14ce('0x1f')]=utils['now']();}}else if(!_[_0x14ce('0x1d')](channels[_0x358095['linkedid']])&&_0x358095[_0x14ce('0x1e')]==0x6&&_0x358095['context']!=_0x14ce('0x20')){channels[_0x358095[_0x14ce('0x14')]][_0x14ce('0x9')]=_0x358095['accountcode'];channels[_0x358095[_0x14ce('0x14')]]['destinationchannel']=_0x358095[_0x14ce('0x7')];if(_['isNil'](channels[_0x358095[_0x14ce('0x14')]]['answertime'])){channels[_0x358095['linkedid']][_0x14ce('0x21')]=utils[_0x14ce('0x19')]();}channels[_0x358095[_0x14ce('0x14')]][_0x14ce('0xd')]=dispositions[_[_0x14ce('0x22')](_0x358095[_0x14ce('0x1e')])]||_0x14ce('0x3');}}catch(_0x448879){utils[_0x14ce('0x1b')](_0x448879[_0x14ce('0x1c')]);}};exports['hangup']=function(_0x277dcd){try{if(!_[_0x14ce('0x1d')](channels[_0x277dcd[_0x14ce('0x13')]])){if(_['isNil'](channels[_0x277dcd['uniqueid']][_0x14ce('0xc')])){channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0xc')]=_0x277dcd[_0x14ce('0x23')]+'\x20<'+_0x277dcd[_0x14ce('0x16')]+'>';}channels[_0x277dcd[_0x14ce('0x13')]]['endtime']=utils[_0x14ce('0x19')]();channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x24')]=utils[_0x14ce('0x25')](channels[_0x277dcd['uniqueid']]['endtime'],channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x26')]);channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x27')]=channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x21')]?utils[_0x14ce('0x25')](channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x28')],channels[_0x277dcd[_0x14ce('0x13')]][_0x14ce('0x21')]):0x0;writeDB(channels[_0x277dcd[_0x14ce('0x13')]]);}}catch(_0x3bd0e2){utils['error'](_0x3bd0e2[_0x14ce('0x1c')]);}};exports['attendedtransfer']=function(_0x374a25){try{if(!_[_0x14ce('0x1d')](channels[_0x374a25[_0x14ce('0x29')]])){if(channels[_0x374a25[_0x14ce('0x29')]][_0x14ce('0x7')]==_0x374a25[_0x14ce('0x2a')]){channels[_0x374a25[_0x14ce('0x29')]][_0x14ce('0x2b')]=_0x374a25[_0x14ce('0x2c')];channels[_0x374a25[_0x14ce('0x29')]][_0x14ce('0x2d')]=_0x14ce('0x2e');}else if(channels[_0x374a25[_0x14ce('0x29')]][_0x14ce('0x7')]=_0x374a25[_0x14ce('0x2f')]){channels[_0x374a25['localtwolinkedid']][_0x14ce('0x2b')]=_0x374a25[_0x14ce('0x30')];channels[_0x374a25[_0x14ce('0x29')]]['userfield']=_0x14ce('0x2e');}}}catch(_0x4903d4){utils[_0x14ce('0x1b')](_0x4903d4[_0x14ce('0x1c')]);}};exports[_0x14ce('0x31')]=function(_0x3b7665){try{if(!_[_0x14ce('0x1d')](channels[_0x3b7665[_0x14ce('0x13')]])){channels[_0x3b7665[_0x14ce('0x13')]][_0x14ce('0x32')]=utils[_0x14ce('0x19')]();}}catch(_0x410117){utils[_0x14ce('0x1b')](_0x410117[_0x14ce('0x1c')]);}};exports[_0x14ce('0x33')]=function(_0x48767a){try{if(!_[_0x14ce('0x1d')](channels[_0x48767a[_0x14ce('0x13')]])){if(!_[_0x14ce('0x1d')](channels[_0x48767a['uniqueid']]['musiconholdstartAt'])){channels[_0x48767a[_0x14ce('0x13')]][_0x14ce('0x34')]+=utils[_0x14ce('0x25')](utils[_0x14ce('0x19')](),channels[_0x48767a[_0x14ce('0x13')]]['musiconholdstartAt']);delete channels[_0x48767a[_0x14ce('0x13')]]['musiconholdstartAt'];}}}catch(_0x61bfe8){utils[_0x14ce('0x1b')](_0x61bfe8['stack']);}};exports[_0x14ce('0x35')]=function(_0xfdec1e){try{if(!_['isNil'](channels[_0xfdec1e[_0x14ce('0x13')]])){if(!_[_0x14ce('0x1d')](_0xfdec1e['variable'][_0x14ce('0x36')])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0xa')]=_0xfdec1e['value'];}if(!_['isNil'](_0xfdec1e[_0x14ce('0x37')][_0x14ce('0x38')])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0xb')]=_0xfdec1e['value'];channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0xc')]='\x22'+_0xfdec1e[_0x14ce('0x39')]+_0x14ce('0x3a')+_0xfdec1e[_0x14ce('0x39')]+'>';}if(!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')]['xmd-callerid-preview'])||!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')]['xmd-callerid'])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0xc')]=_0xfdec1e[_0x14ce('0x39')];}if(!_['isNil'](_0xfdec1e[_0x14ce('0x37')][_0x14ce('0x3b')])||!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')]['xmcs-queue'])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0x3c')]=_0x14ce('0x3d');channels[_0xfdec1e[_0x14ce('0x13')]]['lastdata']=_0xfdec1e['value'];channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0x3e')]=!![];}if(!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')][_0x14ce('0x3f')])){channels[_0xfdec1e['uniqueid']][_0x14ce('0x40')]=_0xfdec1e[_0x14ce('0x39')];}if(!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')][_0x14ce('0x41')])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0x8')]=_0xfdec1e[_0x14ce('0x39')];}if(!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')][_0x14ce('0x42')])){channels[_0xfdec1e[_0x14ce('0x13')]][_0x14ce('0x43')]=_0xfdec1e[_0x14ce('0x39')];}if(!_[_0x14ce('0x1d')](_0xfdec1e[_0x14ce('0x37')]['sipcallid'])){channels[_0xfdec1e[_0x14ce('0x13')]]['sipcallid']=_0xfdec1e['value'];}}}catch(_0x46faa2){utils[_0x14ce('0x1b')](_0x46faa2[_0x14ce('0x1c')]);}};exports['newexten']=function(_0x4f2ca8){try{if(!_[_0x14ce('0x1d')](channels[_0x4f2ca8['uniqueid']])){if(_0x4f2ca8[_0x14ce('0x44')][_0x14ce('0x45')]()==_0x14ce('0x46')&&_[_0x14ce('0x47')](_0x4f2ca8[_0x14ce('0x48')]['toLowerCase'](),_0x14ce('0x49'))){var _0x23e521=_0x4f2ca8[_0x14ce('0x48')][_0x14ce('0x4a')]('=');var _0x5671d0=_0x23e521[0x0]['substring'](_0x23e521[0x0][_0x14ce('0x4b')]('(')+0x1,_0x23e521[0x0][_0x14ce('0x4b')](')'));var _0x21a549=_0x23e521[0x1];channels[_0x4f2ca8['uniqueid']][_0x5671d0]=_0x21a549;}if(!_[_0x14ce('0x4c')]([_0x14ce('0x4d'),_0x14ce('0x4e'),_0x14ce('0x4f'),'set',_0x14ce('0x50')],_0x4f2ca8[_0x14ce('0x44')][_0x14ce('0x45')]())){channels[_0x4f2ca8[_0x14ce('0x13')]][_0x14ce('0x3c')]=_0x4f2ca8[_0x14ce('0x44')];channels[_0x4f2ca8[_0x14ce('0x13')]]['lastdata']=_0x4f2ca8[_0x14ce('0x48')];}}}catch(_0x54cb64){utils[_0x14ce('0x1b')](_0x54cb64['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 39f9e35..d3ba1d6 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 _0x3baf=['SHUTDOWN','fullybooted','FULLYBOOTED','error','close','./utils','lodash','connect','info','CONNECTED','shutdown'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x3baf,0xf7));var _0xf3ba=function(_0x35b0d3,_0x15f5d8){_0x35b0d3=_0x35b0d3-0x0;var _0x1e20ea=_0x3baf[_0x35b0d3];return _0x1e20ea;};'use strict';var utils=require(_0xf3ba('0x0'));var _=require(_0xf3ba('0x1'));exports[_0xf3ba('0x2')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x4'));};exports[_0xf3ba('0x5')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x6'));};exports[_0xf3ba('0x7')]=function(){utils[_0xf3ba('0x3')](_0xf3ba('0x8'));};exports[_0xf3ba('0x9')]=function(_0x475268){utils[_0xf3ba('0x9')](_0x475268);};exports[_0xf3ba('0xa')]=function(){utils['info']('CLOSE');};exports['managerevent']=function(_0x32f810){}; \ No newline at end of file +var _0xc1c6=['CONNECTED','info','SHUTDOWN','fullybooted','error','CLOSE','managerevent','./utils','lodash','connect'];(function(_0x45b034,_0x3a57dd){var _0x509cb0=function(_0x3a89d5){while(--_0x3a89d5){_0x45b034['push'](_0x45b034['shift']());}};_0x509cb0(++_0x3a57dd);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x4c6ac7,_0xb4d218){_0x4c6ac7=_0x4c6ac7-0x0;var _0x4001bc=_0xc1c6[_0x4c6ac7];return _0x4001bc;};'use strict';var utils=require(_0x6c1c('0x0'));var _=require(_0x6c1c('0x1'));exports[_0x6c1c('0x2')]=function(){utils['info'](_0x6c1c('0x3'));};exports['shutdown']=function(){utils[_0x6c1c('0x4')](_0x6c1c('0x5'));};exports[_0x6c1c('0x6')]=function(){utils['info']('FULLYBOOTED');};exports[_0x6c1c('0x7')]=function(_0x524a6b){utils[_0x6c1c('0x7')](_0x524a6b);};exports['close']=function(){utils[_0x6c1c('0x4')](_0x6c1c('0x8'));};exports[_0x6c1c('0x9')]=function(_0x2cec58){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 6bbe328..9bb7a3f 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 _0xf443=['toLowerCase','set','startsWith','cdr(routeid)','appdata','split','error','stack','isNil','variable','value','dialbegin','assign','starttime','lastevent','answertime','now','connect','complete','endtime','holdtime','diffTime','util','./utils','info','DIAL|%s|%s|%s|%s|%s|%s','uniqueid','channel','dialstring','calleridnum','dialstatus','request','CreateVoiceDialReport','newexten','application'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf443,0xc5));var _0x3f44=function(_0x12d69c,_0x1190a1){_0x12d69c=_0x12d69c-0x0;var _0xa3cb15=_0xf443[_0x12d69c];return _0xa3cb15;};'use strict';var _=require('lodash');var util=require(_0x3f44('0x0'));var utils=require(_0x3f44('0x1'));var dials={};function writeDB(_0x3997e5){utils[_0x3f44('0x2')](util['format'](_0x3f44('0x3'),_0x3997e5[_0x3f44('0x4')],_0x3997e5[_0x3f44('0x5')],_0x3997e5[_0x3f44('0x6')],_0x3997e5[_0x3f44('0x7')],_0x3997e5['connectedlinenum'],_0x3997e5[_0x3f44('0x8')]));utils[_0x3f44('0x9')](_0x3f44('0xa'),_0x3997e5);delete dials[_0x3997e5[_0x3f44('0x4')]];}exports[_0x3f44('0xb')]=function(_0x4e6c0d){try{if(_0x4e6c0d[_0x3f44('0xc')][_0x3f44('0xd')]()==_0x3f44('0xe')&&_[_0x3f44('0xf')](_0x4e6c0d['appdata'][_0x3f44('0xd')](),_0x3f44('0x10'))){var _0x25cd7d=_0x4e6c0d[_0x3f44('0x11')][_0x3f44('0x12')]('=');dials[_0x4e6c0d[_0x3f44('0x4')]]={'routeId':_0x25cd7d[0x1]};}}catch(_0x472ee1){utils[_0x3f44('0x13')](_0x472ee1[_0x3f44('0x14')]);}};exports['varset']=function(_0x59688e){try{if(!_[_0x3f44('0x15')](_0x59688e[_0x3f44('0x16')]['outboundrouteid'])){dials[_0x59688e['uniqueid']]={'routeId':_0x59688e[_0x3f44('0x17')]};}}catch(_0x1f441c){utils[_0x3f44('0x13')](_0x1f441c[_0x3f44('0x14')]);}};exports[_0x3f44('0x18')]=function(_0x272368){try{if(!_[_0x3f44('0x15')](dials[_0x272368[_0x3f44('0x4')]])){dials[_0x272368[_0x3f44('0x4')]]=_[_0x3f44('0x19')](dials[_0x272368['uniqueid']],_0x272368);dials[_0x272368[_0x3f44('0x4')]][_0x3f44('0x1a')]=utils['now']();dials[_0x272368[_0x3f44('0x4')]][_0x3f44('0x1b')]='called';}}catch(_0x754962){utils[_0x3f44('0x13')](_0x754962[_0x3f44('0x14')]);}};exports['dialend']=function(_0x4b98aa){try{if(!_['isNil'](dials[_0x4b98aa[_0x3f44('0x4')]])){dials[_0x4b98aa[_0x3f44('0x4')]][_0x3f44('0x8')]=_0x4b98aa[_0x3f44('0x8')];if(_0x4b98aa['dialstatus']=='ANSWER'){dials[_0x4b98aa[_0x3f44('0x4')]]=_[_0x3f44('0x19')](dials[_0x4b98aa[_0x3f44('0x4')]],_0x4b98aa);dials[_0x4b98aa[_0x3f44('0x4')]][_0x3f44('0x1c')]=utils[_0x3f44('0x1d')]();dials[_0x4b98aa[_0x3f44('0x4')]][_0x3f44('0x1b')]=_0x3f44('0x1e');}}}catch(_0x546e21){utils[_0x3f44('0x13')](_0x546e21['stack']);}};exports['hangup']=function(_0x3b9fd5){try{if(!_['isNil'](dials[_0x3b9fd5[_0x3f44('0x4')]])){dials[_0x3b9fd5[_0x3f44('0x4')]]=_[_0x3f44('0x19')](dials[_0x3b9fd5[_0x3f44('0x4')]],{'endtime':utils[_0x3f44('0x1d')](),'lastevent':_0x3f44('0x1f')});dials[_0x3b9fd5[_0x3f44('0x4')]]['duration']=utils['diffTime'](dials[_0x3b9fd5[_0x3f44('0x4')]][_0x3f44('0x20')],dials[_0x3b9fd5[_0x3f44('0x4')]][_0x3f44('0x1a')]);dials[_0x3b9fd5[_0x3f44('0x4')]][_0x3f44('0x21')]=utils[_0x3f44('0x22')](dials[_0x3b9fd5['uniqueid']]['answertime']||dials[_0x3b9fd5['uniqueid']][_0x3f44('0x20')],dials[_0x3b9fd5['uniqueid']][_0x3f44('0x1a')]);dials[_0x3b9fd5[_0x3f44('0x4')]]['billableseconds']=dials[_0x3b9fd5['uniqueid']]['answertime']?utils['diffTime'](dials[_0x3b9fd5['uniqueid']][_0x3f44('0x20')],dials[_0x3b9fd5[_0x3f44('0x4')]][_0x3f44('0x1c')]):0x0;writeDB(dials[_0x3b9fd5[_0x3f44('0x4')]]);}}catch(_0x4297fa){utils[_0x3f44('0x13')](_0x4297fa[_0x3f44('0x14')]);}}; \ No newline at end of file +var _0x5193=['diffTime','endtime','billableseconds','lodash','util','./utils','info','format','DIAL|%s|%s|%s|%s|%s|%s','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','uniqueid','newexten','application','toLowerCase','set','startsWith','appdata','split','error','stack','isNil','variable','outboundrouteid','value','assign','starttime','now','lastevent','called','ANSWER','answertime','connect','complete','duration'];(function(_0x4ac60a,_0x503a99){var _0x4b22e8=function(_0x145c47){while(--_0x145c47){_0x4ac60a['push'](_0x4ac60a['shift']());}};_0x4b22e8(++_0x503a99);}(_0x5193,0x143));var _0x3519=function(_0x2a676e,_0xe0535d){_0x2a676e=_0x2a676e-0x0;var _0x36b87a=_0x5193[_0x2a676e];return _0x36b87a;};'use strict';var _=require(_0x3519('0x0'));var util=require(_0x3519('0x1'));var utils=require(_0x3519('0x2'));var dials={};function writeDB(_0x4d4057){utils[_0x3519('0x3')](util[_0x3519('0x4')](_0x3519('0x5'),_0x4d4057['uniqueid'],_0x4d4057[_0x3519('0x6')],_0x4d4057[_0x3519('0x7')],_0x4d4057[_0x3519('0x8')],_0x4d4057[_0x3519('0x9')],_0x4d4057[_0x3519('0xa')]));utils[_0x3519('0xb')](_0x3519('0xc'),_0x4d4057);delete dials[_0x4d4057[_0x3519('0xd')]];}exports[_0x3519('0xe')]=function(_0x16a6a0){try{if(_0x16a6a0[_0x3519('0xf')][_0x3519('0x10')]()==_0x3519('0x11')&&_[_0x3519('0x12')](_0x16a6a0[_0x3519('0x13')][_0x3519('0x10')](),'cdr(routeid)')){var _0x4ff42b=_0x16a6a0['appdata'][_0x3519('0x14')]('=');dials[_0x16a6a0[_0x3519('0xd')]]={'routeId':_0x4ff42b[0x1]};}}catch(_0x6a1924){utils[_0x3519('0x15')](_0x6a1924[_0x3519('0x16')]);}};exports['varset']=function(_0x3b5e1e){try{if(!_[_0x3519('0x17')](_0x3b5e1e[_0x3519('0x18')][_0x3519('0x19')])){dials[_0x3b5e1e[_0x3519('0xd')]]={'routeId':_0x3b5e1e[_0x3519('0x1a')]};}}catch(_0x238393){utils['error'](_0x238393[_0x3519('0x16')]);}};exports['dialbegin']=function(_0x28353d){try{if(!_[_0x3519('0x17')](dials[_0x28353d[_0x3519('0xd')]])){dials[_0x28353d[_0x3519('0xd')]]=_[_0x3519('0x1b')](dials[_0x28353d['uniqueid']],_0x28353d);dials[_0x28353d[_0x3519('0xd')]][_0x3519('0x1c')]=utils[_0x3519('0x1d')]();dials[_0x28353d['uniqueid']][_0x3519('0x1e')]=_0x3519('0x1f');}}catch(_0x5ca320){utils[_0x3519('0x15')](_0x5ca320[_0x3519('0x16')]);}};exports['dialend']=function(_0x35a346){try{if(!_[_0x3519('0x17')](dials[_0x35a346[_0x3519('0xd')]])){dials[_0x35a346[_0x3519('0xd')]][_0x3519('0xa')]=_0x35a346['dialstatus'];if(_0x35a346[_0x3519('0xa')]==_0x3519('0x20')){dials[_0x35a346[_0x3519('0xd')]]=_[_0x3519('0x1b')](dials[_0x35a346[_0x3519('0xd')]],_0x35a346);dials[_0x35a346[_0x3519('0xd')]][_0x3519('0x21')]=utils[_0x3519('0x1d')]();dials[_0x35a346[_0x3519('0xd')]][_0x3519('0x1e')]=_0x3519('0x22');}}}catch(_0xe9a7a9){utils[_0x3519('0x15')](_0xe9a7a9[_0x3519('0x16')]);}};exports['hangup']=function(_0xefdfbf){try{if(!_[_0x3519('0x17')](dials[_0xefdfbf[_0x3519('0xd')]])){dials[_0xefdfbf[_0x3519('0xd')]]=_['assign'](dials[_0xefdfbf[_0x3519('0xd')]],{'endtime':utils[_0x3519('0x1d')](),'lastevent':_0x3519('0x23')});dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x24')]=utils['diffTime'](dials[_0xefdfbf[_0x3519('0xd')]]['endtime'],dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x1c')]);dials[_0xefdfbf[_0x3519('0xd')]]['holdtime']=utils[_0x3519('0x25')](dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x21')]||dials[_0xefdfbf['uniqueid']][_0x3519('0x26')],dials[_0xefdfbf['uniqueid']][_0x3519('0x1c')]);dials[_0xefdfbf['uniqueid']][_0x3519('0x27')]=dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x21')]?utils[_0x3519('0x25')](dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x26')],dials[_0xefdfbf[_0x3519('0xd')]][_0x3519('0x21')]):0x0;writeDB(dials[_0xefdfbf[_0x3519('0xd')]]);}}catch(_0x344fcb){utils[_0x3519('0x15')](_0x344fcb['stack']);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index 1c376aa..65dc685 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 _0x17dd=['cdr','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialend','asterisk-manager','./utils','asterisk','username','password','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate','hangup'];(function(_0x46520f,_0x4d3ede){var _0x47fdd3=function(_0x25f30f){while(--_0x25f30f){_0x46520f['push'](_0x46520f['shift']());}};_0x47fdd3(++_0x4d3ede);}(_0x17dd,0x14f));var _0xd17d=function(_0x1c2d07,_0x30fbc8){_0x1c2d07=_0x1c2d07-0x0;var _0x3cec89=_0x17dd[_0x1c2d07];return _0x3cec89;};var AsteriskManager=require(_0xd17d('0x0'));var config=require('../../config/environment');var utils=require(_0xd17d('0x1'));var ami=new AsteriskManager(config[_0xd17d('0x2')]['port'],config[_0xd17d('0x2')]['ip'],config[_0xd17d('0x2')][_0xd17d('0x3')],config[_0xd17d('0x2')][_0xd17d('0x4')],!![]);ami['keepConnected']();if(config[_0xd17d('0x5')]&&config[_0xd17d('0x5')][_0xd17d('0x6')]){utils[_0xd17d('0x7')](_0xd17d('0x8'));}else{var agents=require(_0xd17d('0x9'));var calls=require('./calls.controller');var queues=require(_0xd17d('0xa'));var recordings=require(_0xd17d('0xb'));var members=require(_0xd17d('0xc'));var dials=require(_0xd17d('0xd'));var transfers=require(_0xd17d('0xe'));var core=require(_0xd17d('0xf'));ami['on'](_0xd17d('0x10'),core['connect']);ami['on'](_0xd17d('0x11'),core[_0xd17d('0x11')]);ami['on'](_0xd17d('0x12'),core[_0xd17d('0x12')]);ami['on'](_0xd17d('0x13'),core[_0xd17d('0x13')]);ami['on'](_0xd17d('0x14'),core['close']);ami['on']('managerevent',core[_0xd17d('0x15')]);ami['on'](_0xd17d('0x16'),function(_0x2101c4){try{members['devicestatechange'](_0x2101c4);}catch(_0x2dc86b){utils[_0xd17d('0x13')](_0x2dc86b);}});ami['on'](_0xd17d('0x17'),function(_0x282ddf){try{agents[_0xd17d('0x17')](_0x282ddf);}catch(_0x4fc4ba){utils[_0xd17d('0x13')](_0x4fc4ba);}});ami['on'](_0xd17d('0x18'),function(_0x26fd40){try{agents[_0xd17d('0x18')](_0x26fd40);}catch(_0x540761){utils['error'](_0x540761);}});ami['on'](_0xd17d('0x19'),function(_0x5a4497){try{agents[_0xd17d('0x19')](_0x5a4497);queues[_0xd17d('0x19')](_0x5a4497);}catch(_0x5272a7){utils[_0xd17d('0x13')](_0x5272a7);}});ami['on'](_0xd17d('0x1a'),function(_0x168926){try{agents[_0xd17d('0x1a')](_0x168926);queues[_0xd17d('0x1a')](_0x168926);members[_0xd17d('0x1a')](_0x168926);}catch(_0x1de43b){utils[_0xd17d('0x13')](_0x1de43b);}});ami['on'](_0xd17d('0x1b'),function(_0x4cbc60){try{agents[_0xd17d('0x1b')](_0x4cbc60);queues['queuecallerabandon'](_0x4cbc60);}catch(_0x5c9677){utils['error'](_0x5c9677);}});ami['on'](_0xd17d('0x1c'),function(_0x114cac){try{queues[_0xd17d('0x1c')](_0x114cac);recordings[_0xd17d('0x1c')](_0x114cac);}catch(_0x5248c1){utils[_0xd17d('0x13')](_0x5248c1);}});ami['on'](_0xd17d('0x1d'),function(_0x309b58){try{queues[_0xd17d('0x1d')](_0x309b58);}catch(_0x5f39f9){utils['error'](_0x5f39f9);}});ami['on']('musiconholdstart',function(_0x3f95c5){try{queues[_0xd17d('0x1e')](_0x3f95c5);calls[_0xd17d('0x1e')](_0x3f95c5);}catch(_0x2a7e1a){utils[_0xd17d('0x13')](_0x2a7e1a);}});ami['on'](_0xd17d('0x1f'),function(_0x1dc954){try{queues['musiconholdstop'](_0x1dc954);calls[_0xd17d('0x1f')](_0x1dc954);}catch(_0xb039c2){utils[_0xd17d('0x13')](_0xb039c2);}});ami['on'](_0xd17d('0x20'),function(_0x1c2d09){try{calls[_0xd17d('0x20')](_0x1c2d09);recordings[_0xd17d('0x20')](_0x1c2d09);}catch(_0x32d777){utils[_0xd17d('0x13')](_0x32d777);}});ami['on']('hangup',function(_0x12f44b){try{calls[_0xd17d('0x21')](_0x12f44b);recordings['hangup'](_0x12f44b);dials[_0xd17d('0x21')](_0x12f44b);agents[_0xd17d('0x21')](_0x12f44b);queues[_0xd17d('0x21')](_0x12f44b);}catch(_0x1b2625){utils['error'](_0x1b2625);}});ami['on'](_0xd17d('0x22'),function(_0x312ef4){try{members[_0xd17d('0x22')](_0x312ef4);}catch(_0x4e8a1c){utils[_0xd17d('0x13')](_0x4e8a1c);}});ami['on'](_0xd17d('0x23'),function(_0x5a010b){try{queues[_0xd17d('0x23')](_0x5a010b);agents['blindtransfer'](_0x5a010b);transfers['blindtransfer'](_0x5a010b);}catch(_0x4b7d2c){utils[_0xd17d('0x13')](_0x4b7d2c);}});ami['on']('attendedtransfer',function(_0x15f963){try{queues[_0xd17d('0x24')](_0x15f963);transfers[_0xd17d('0x24')](_0x15f963);agents[_0xd17d('0x24')](_0x15f963);calls[_0xd17d('0x24')](_0x15f963);}catch(_0x8625da){utils[_0xd17d('0x13')](_0x8625da);}});ami['on'](_0xd17d('0x25'),function(_0x29f6d3){try{queues[_0xd17d('0x25')](_0x29f6d3);recordings[_0xd17d('0x25')](_0x29f6d3);calls[_0xd17d('0x25')](_0x29f6d3);dials[_0xd17d('0x25')](_0x29f6d3);}catch(_0x4f89b8){utils['error'](_0x4f89b8);}});ami['on'](_0xd17d('0x26'),function(_0x1e249d){try{calls['newexten'](_0x1e249d);recordings[_0xd17d('0x26')](_0x1e249d);dials['newexten'](_0x1e249d);}catch(_0x404d1e){utils[_0xd17d('0x13')](_0x404d1e);}});ami['on'](_0xd17d('0x27'),function(_0x1bf196){try{calls[_0xd17d('0x27')](_0x1bf196);recordings[_0xd17d('0x27')](_0x1bf196);}catch(_0x4f47f3){utils[_0xd17d('0x13')](_0x4f47f3);}});ami['on']('dialbegin',function(_0x3ee2e6){try{dials['dialbegin'](_0x3ee2e6);}catch(_0x4d9464){utils['error'](_0x4d9464);}});ami['on'](_0xd17d('0x28'),function(_0x3cbcf6){try{dials[_0xd17d('0x28')](_0x3cbcf6);}catch(_0x2c569a){utils['error'](_0x2c569a);}});} \ No newline at end of file +var _0x3a51=['hangup','blindtransfer','attendedtransfer','varset','newexten','newchannel','dialbegin','dialend','asterisk-manager','../../config/environment','asterisk','port','username','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./dials.controller','./core.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','agentcalled','agentringnoanswer','agentconnect','agentcomplete','queuecallerabandon','queuecallerjoin','queuecallerleave','musiconholdstart','musiconholdstop','newstate'];(function(_0x1646e6,_0x26e484){var _0x42f2db=function(_0x3fb32c){while(--_0x3fb32c){_0x1646e6['push'](_0x1646e6['shift']());}};_0x42f2db(++_0x26e484);}(_0x3a51,0x1f4));var _0x13a5=function(_0x1f90cd,_0x4ac2b1){_0x1f90cd=_0x1f90cd-0x0;var _0x23e83f=_0x3a51[_0x1f90cd];return _0x23e83f;};var AsteriskManager=require(_0x13a5('0x0'));var config=require(_0x13a5('0x1'));var utils=require('./utils');var ami=new AsteriskManager(config[_0x13a5('0x2')][_0x13a5('0x3')],config['asterisk']['ip'],config[_0x13a5('0x2')][_0x13a5('0x4')],config[_0x13a5('0x2')][_0x13a5('0x5')],!![]);ami[_0x13a5('0x6')]();if(config[_0x13a5('0x7')]&&config['xdr'][_0x13a5('0x8')]){utils[_0x13a5('0x9')](_0x13a5('0xa'));}else{var agents=require(_0x13a5('0xb'));var calls=require(_0x13a5('0xc'));var queues=require(_0x13a5('0xd'));var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x13a5('0xe'));var transfers=require('./transfers.controller');var core=require(_0x13a5('0xf'));ami['on'](_0x13a5('0x10'),core['connect']);ami['on'](_0x13a5('0x11'),core[_0x13a5('0x11')]);ami['on']('fullybooted',core[_0x13a5('0x12')]);ami['on']('error',core[_0x13a5('0x13')]);ami['on'](_0x13a5('0x14'),core[_0x13a5('0x14')]);ami['on'](_0x13a5('0x15'),core[_0x13a5('0x15')]);ami['on'](_0x13a5('0x16'),function(_0x722e37){try{members[_0x13a5('0x16')](_0x722e37);}catch(_0x55a937){utils['error'](_0x55a937);}});ami['on'](_0x13a5('0x17'),function(_0x34ab28){try{agents[_0x13a5('0x17')](_0x34ab28);}catch(_0x3748ae){utils[_0x13a5('0x13')](_0x3748ae);}});ami['on']('agentringnoanswer',function(_0x43feef){try{agents[_0x13a5('0x18')](_0x43feef);}catch(_0x428f1a){utils[_0x13a5('0x13')](_0x428f1a);}});ami['on'](_0x13a5('0x19'),function(_0x4b464d){try{agents[_0x13a5('0x19')](_0x4b464d);queues[_0x13a5('0x19')](_0x4b464d);}catch(_0xcc274e){utils[_0x13a5('0x13')](_0xcc274e);}});ami['on'](_0x13a5('0x1a'),function(_0x19995c){try{agents[_0x13a5('0x1a')](_0x19995c);queues['agentcomplete'](_0x19995c);members[_0x13a5('0x1a')](_0x19995c);}catch(_0xa21f57){utils[_0x13a5('0x13')](_0xa21f57);}});ami['on'](_0x13a5('0x1b'),function(_0x11c39e){try{agents['queuecallerabandon'](_0x11c39e);queues['queuecallerabandon'](_0x11c39e);}catch(_0x3889e3){utils['error'](_0x3889e3);}});ami['on'](_0x13a5('0x1c'),function(_0x3c40c4){try{queues['queuecallerjoin'](_0x3c40c4);recordings[_0x13a5('0x1c')](_0x3c40c4);}catch(_0x2f21a0){utils['error'](_0x2f21a0);}});ami['on']('queuecallerleave',function(_0xeb99cf){try{queues[_0x13a5('0x1d')](_0xeb99cf);}catch(_0x29ee69){utils['error'](_0x29ee69);}});ami['on']('musiconholdstart',function(_0x5bd7d7){try{queues['musiconholdstart'](_0x5bd7d7);calls[_0x13a5('0x1e')](_0x5bd7d7);}catch(_0x575e3f){utils[_0x13a5('0x13')](_0x575e3f);}});ami['on'](_0x13a5('0x1f'),function(_0x34f82d){try{queues[_0x13a5('0x1f')](_0x34f82d);calls[_0x13a5('0x1f')](_0x34f82d);}catch(_0x3c5aae){utils[_0x13a5('0x13')](_0x3c5aae);}});ami['on'](_0x13a5('0x20'),function(_0x3c64c1){try{calls[_0x13a5('0x20')](_0x3c64c1);recordings[_0x13a5('0x20')](_0x3c64c1);}catch(_0x2ec529){utils[_0x13a5('0x13')](_0x2ec529);}});ami['on'](_0x13a5('0x21'),function(_0x51863d){try{calls[_0x13a5('0x21')](_0x51863d);recordings['hangup'](_0x51863d);dials[_0x13a5('0x21')](_0x51863d);agents[_0x13a5('0x21')](_0x51863d);queues[_0x13a5('0x21')](_0x51863d);}catch(_0x390fd9){utils[_0x13a5('0x13')](_0x390fd9);}});ami['on']('cdr',function(_0x4ba64a){try{members['cdr'](_0x4ba64a);}catch(_0x5e71d9){utils[_0x13a5('0x13')](_0x5e71d9);}});ami['on'](_0x13a5('0x22'),function(_0x140fd7){try{queues[_0x13a5('0x22')](_0x140fd7);agents['blindtransfer'](_0x140fd7);transfers[_0x13a5('0x22')](_0x140fd7);}catch(_0x67f7ef){utils[_0x13a5('0x13')](_0x67f7ef);}});ami['on']('attendedtransfer',function(_0x3a9a48){try{queues[_0x13a5('0x23')](_0x3a9a48);transfers[_0x13a5('0x23')](_0x3a9a48);agents[_0x13a5('0x23')](_0x3a9a48);calls[_0x13a5('0x23')](_0x3a9a48);}catch(_0x2e5dc9){utils[_0x13a5('0x13')](_0x2e5dc9);}});ami['on']('varset',function(_0x58ecb2){try{queues[_0x13a5('0x24')](_0x58ecb2);recordings['varset'](_0x58ecb2);calls[_0x13a5('0x24')](_0x58ecb2);dials[_0x13a5('0x24')](_0x58ecb2);}catch(_0x5313df){utils[_0x13a5('0x13')](_0x5313df);}});ami['on'](_0x13a5('0x25'),function(_0xd46172){try{calls['newexten'](_0xd46172);recordings[_0x13a5('0x25')](_0xd46172);dials[_0x13a5('0x25')](_0xd46172);}catch(_0x9ba916){utils[_0x13a5('0x13')](_0x9ba916);}});ami['on'](_0x13a5('0x26'),function(_0x4606e9){try{calls[_0x13a5('0x26')](_0x4606e9);recordings['newchannel'](_0x4606e9);}catch(_0x5e470b){utils[_0x13a5('0x13')](_0x5e470b);}});ami['on'](_0x13a5('0x27'),function(_0x2dd372){try{dials[_0x13a5('0x27')](_0x2dd372);}catch(_0x587a6a){utils['error'](_0x587a6a);}});ami['on']('dialend',function(_0x56f6eb){try{dials[_0x13a5('0x28')](_0x56f6eb);}catch(_0x35466b){utils[_0x13a5('0x13')](_0x35466b);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index ce1c7f0..e8953e4 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 _0xac74=['getUserByName','split','catch','error','some','devicestatechange','state','BUSY','device','TALKING','now','agent','NOT_INUSE','isNil','exitAt','duration','enterAt','agentcomplete','assign','queue','cdr','channel','data1','destination','destinationchannel','source','data3','lodash','util','./utils','Local/_attended@transfer','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','membername','type','then','name','internal','CreateMemberReport'];(function(_0x6f4475,_0x34cf12){var _0x43d0cc=function(_0x5ad432){while(--_0x5ad432){_0x6f4475['push'](_0x6f4475['shift']());}};_0x43d0cc(++_0x34cf12);}(_0xac74,0x71));var _0x4ac7=function(_0x380e75,_0x486360){_0x380e75=_0x380e75-0x0;var _0x444d96=_0xac74[_0x380e75];return _0x444d96;};'use strict';var _=require(_0x4ac7('0x0'));var util=require(_0x4ac7('0x1'));var utils=require(_0x4ac7('0x2'));var members={};var exclude=[_0x4ac7('0x3'),_0x4ac7('0x4')];function writeDB(_0x27e76d){utils['info'](util[_0x4ac7('0x5')](_0x4ac7('0x6'),_0x27e76d[_0x4ac7('0x7')],_0x27e76d[_0x4ac7('0x8')],_0x27e76d['channel'],_0x27e76d[_0x4ac7('0x9')],_0x27e76d[_0x4ac7('0xa')],_0x27e76d[_0x4ac7('0xb')]));if(_0x27e76d[_0x4ac7('0x8')]){utils['getUserByInterface'](_0x27e76d[_0x4ac7('0x8')])[_0x4ac7('0xc')](function(_0x3ccd7f){if(_0x3ccd7f){_0x27e76d['membername']=_0x3ccd7f[_0x4ac7('0xd')];_0x27e76d['internal']=_0x3ccd7f[_0x4ac7('0xe')];utils['request'](_0x4ac7('0xf'),_0x27e76d);}else{utils[_0x4ac7('0x10')](_0x27e76d[_0x4ac7('0x8')][_0x4ac7('0x11')]('/')[0x1])[_0x4ac7('0xc')](function(_0x116f8c){if(_0x116f8c){_0x27e76d[_0x4ac7('0xa')]=_0x116f8c[_0x4ac7('0xd')];_0x27e76d[_0x4ac7('0xe')]=_0x116f8c[_0x4ac7('0xe')];utils['request'](_0x4ac7('0xf'),_0x27e76d);}});}})[_0x4ac7('0x12')](function(_0x360682){utils[_0x4ac7('0x13')](_0x360682);});}delete members[_0x27e76d[_0x4ac7('0x8')]];}function startsWith(_0x1ed8c7,_0x34b8af){return _[_0x4ac7('0x14')](_0x1ed8c7,function(_0x414d5c){return _['startsWith'](_0x34b8af,_0x414d5c);});}exports[_0x4ac7('0x15')]=function(_0x46e78d){switch(_0x46e78d[_0x4ac7('0x16')]){case'INUSE':case _0x4ac7('0x17'):if(!startsWith(exclude,_0x46e78d[_0x4ac7('0x18')])){members[_0x46e78d[_0x4ac7('0x18')]]={'channel':'voice','interface':_0x46e78d['device'],'type':_0x4ac7('0x19'),'enterAt':utils[_0x4ac7('0x1a')](),'role':_0x4ac7('0x1b')};}break;case _0x4ac7('0x1c'):if(!_[_0x4ac7('0x1d')](members[_0x46e78d[_0x4ac7('0x18')]])){members[_0x46e78d[_0x4ac7('0x18')]][_0x4ac7('0x1e')]=utils[_0x4ac7('0x1a')]();members[_0x46e78d[_0x4ac7('0x18')]][_0x4ac7('0x1f')]=utils['diffTime'](members[_0x46e78d[_0x4ac7('0x18')]][_0x4ac7('0x1e')],members[_0x46e78d['device']][_0x4ac7('0x20')]);if(members[_0x46e78d[_0x4ac7('0x18')]][_0x4ac7('0x7')]){writeDB(members[_0x46e78d[_0x4ac7('0x18')]]);}}default:break;}};exports[_0x4ac7('0x21')]=function(_0x14ed86){if(!_['isNil'](members[_0x14ed86[_0x4ac7('0x8')]])){members[_0x14ed86[_0x4ac7('0x8')]]=_[_0x4ac7('0x22')](members[_0x14ed86[_0x4ac7('0x8')]],{'data4':_0x14ed86[_0x4ac7('0x23')],'uniqueid':_0x14ed86[_0x4ac7('0x7')]});}};exports[_0x4ac7('0x24')]=function(_0x44ee13){if(_0x44ee13[_0x4ac7('0x25')]){var _0x5e0103=_0x44ee13[_0x4ac7('0x25')][_0x4ac7('0x11')]('-')[0x0];if(!_['isNil'](members[_0x5e0103])){members[_0x5e0103]=_[_0x4ac7('0x22')](members[_0x5e0103],{'data1':members[_0x5e0103][_0x4ac7('0x26')]||_0x44ee13[_0x4ac7('0xb')],'data2':members[_0x5e0103][_0x4ac7('0x9')]||_0x44ee13['source'],'data3':members[_0x5e0103]['data3']||_0x44ee13[_0x4ac7('0x27')],'uniqueid':members[_0x5e0103]['uniqueid']||_0x44ee13[_0x4ac7('0x7')]});if(members[_0x5e0103]['exitAt']){writeDB(members[_0x5e0103]);}}}if(_0x44ee13[_0x4ac7('0x28')]){var _0x2140a0=_0x44ee13[_0x4ac7('0x28')][_0x4ac7('0x11')]('-')[0x0];if(!_[_0x4ac7('0x1d')](members[_0x2140a0])){members[_0x2140a0]=_['assign'](members[_0x2140a0],{'data1':members[_0x2140a0][_0x4ac7('0x26')]||_0x44ee13[_0x4ac7('0xb')],'data2':members[_0x2140a0][_0x4ac7('0x9')]||_0x44ee13[_0x4ac7('0x29')],'data3':members[_0x2140a0][_0x4ac7('0x2a')]||_0x44ee13[_0x4ac7('0x27')],'uniqueid':members[_0x2140a0][_0x4ac7('0x7')]||_0x44ee13[_0x4ac7('0x7')]});if(members[_0x2140a0]['exitAt']){writeDB(members[_0x2140a0]);}}}}; \ No newline at end of file +var _0x3d8d=['duration','diffTime','enterAt','agentcomplete','channel','assign','data1','data3','destination','destinationchannel','source','lodash','util','./utils','Local/_attended@transfer','Queue:','format','MEMBER|%s|%s|%s|%s|%s|%s','uniqueid','interface','data2','type','then','membername','name','internal','request','getUserByName','split','CreateMemberReport','catch','some','state','INUSE','BUSY','device','voice','TALKING','now','agent','NOT_INUSE','isNil','exitAt'];(function(_0x44314b,_0x546bbf){var _0x1a63e8=function(_0xd0175){while(--_0xd0175){_0x44314b['push'](_0x44314b['shift']());}};_0x1a63e8(++_0x546bbf);}(_0x3d8d,0x1b9));var _0xd3d8=function(_0xfa2e1e,_0x4002ed){_0xfa2e1e=_0xfa2e1e-0x0;var _0x2f1d12=_0x3d8d[_0xfa2e1e];return _0x2f1d12;};'use strict';var _=require(_0xd3d8('0x0'));var util=require(_0xd3d8('0x1'));var utils=require(_0xd3d8('0x2'));var members={};var exclude=[_0xd3d8('0x3'),_0xd3d8('0x4')];function writeDB(_0x75c42c){utils['info'](util[_0xd3d8('0x5')](_0xd3d8('0x6'),_0x75c42c[_0xd3d8('0x7')],_0x75c42c[_0xd3d8('0x8')],_0x75c42c['channel'],_0x75c42c[_0xd3d8('0x9')],_0x75c42c['membername'],_0x75c42c[_0xd3d8('0xa')]));if(_0x75c42c[_0xd3d8('0x8')]){utils['getUserByInterface'](_0x75c42c[_0xd3d8('0x8')])[_0xd3d8('0xb')](function(_0x90441f){if(_0x90441f){_0x75c42c[_0xd3d8('0xc')]=_0x90441f[_0xd3d8('0xd')];_0x75c42c[_0xd3d8('0xe')]=_0x90441f[_0xd3d8('0xe')];utils[_0xd3d8('0xf')]('CreateMemberReport',_0x75c42c);}else{utils[_0xd3d8('0x10')](_0x75c42c['interface'][_0xd3d8('0x11')]('/')[0x1])[_0xd3d8('0xb')](function(_0x166ccc){if(_0x166ccc){_0x75c42c[_0xd3d8('0xc')]=_0x166ccc[_0xd3d8('0xd')];_0x75c42c[_0xd3d8('0xe')]=_0x166ccc[_0xd3d8('0xe')];utils[_0xd3d8('0xf')](_0xd3d8('0x12'),_0x75c42c);}});}})[_0xd3d8('0x13')](function(_0x238f97){utils['error'](_0x238f97);});}delete members[_0x75c42c['interface']];}function startsWith(_0x2e3b4e,_0x454a92){return _[_0xd3d8('0x14')](_0x2e3b4e,function(_0x33ba0d){return _['startsWith'](_0x454a92,_0x33ba0d);});}exports['devicestatechange']=function(_0x46a323){switch(_0x46a323[_0xd3d8('0x15')]){case _0xd3d8('0x16'):case _0xd3d8('0x17'):if(!startsWith(exclude,_0x46a323[_0xd3d8('0x18')])){members[_0x46a323[_0xd3d8('0x18')]]={'channel':_0xd3d8('0x19'),'interface':_0x46a323[_0xd3d8('0x18')],'type':_0xd3d8('0x1a'),'enterAt':utils[_0xd3d8('0x1b')](),'role':_0xd3d8('0x1c')};}break;case _0xd3d8('0x1d'):if(!_[_0xd3d8('0x1e')](members[_0x46a323['device']])){members[_0x46a323[_0xd3d8('0x18')]][_0xd3d8('0x1f')]=utils['now']();members[_0x46a323[_0xd3d8('0x18')]][_0xd3d8('0x20')]=utils[_0xd3d8('0x21')](members[_0x46a323['device']][_0xd3d8('0x1f')],members[_0x46a323[_0xd3d8('0x18')]][_0xd3d8('0x22')]);if(members[_0x46a323[_0xd3d8('0x18')]]['uniqueid']){writeDB(members[_0x46a323[_0xd3d8('0x18')]]);}}default:break;}};exports[_0xd3d8('0x23')]=function(_0x336f87){if(!_[_0xd3d8('0x1e')](members[_0x336f87['interface']])){members[_0x336f87[_0xd3d8('0x8')]]=_['assign'](members[_0x336f87['interface']],{'data4':_0x336f87['queue'],'uniqueid':_0x336f87[_0xd3d8('0x7')]});}};exports['cdr']=function(_0x59a354){if(_0x59a354[_0xd3d8('0x24')]){var _0x5008e3=_0x59a354[_0xd3d8('0x24')][_0xd3d8('0x11')]('-')[0x0];if(!_[_0xd3d8('0x1e')](members[_0x5008e3])){members[_0x5008e3]=_[_0xd3d8('0x25')](members[_0x5008e3],{'data1':members[_0x5008e3][_0xd3d8('0x26')]||_0x59a354[_0xd3d8('0xa')],'data2':members[_0x5008e3][_0xd3d8('0x9')]||_0x59a354['source'],'data3':members[_0x5008e3][_0xd3d8('0x27')]||_0x59a354[_0xd3d8('0x28')],'uniqueid':members[_0x5008e3][_0xd3d8('0x7')]||_0x59a354['uniqueid']});if(members[_0x5008e3][_0xd3d8('0x1f')]){writeDB(members[_0x5008e3]);}}}if(_0x59a354['destinationchannel']){var _0x494c1f=_0x59a354[_0xd3d8('0x29')]['split']('-')[0x0];if(!_[_0xd3d8('0x1e')](members[_0x494c1f])){members[_0x494c1f]=_[_0xd3d8('0x25')](members[_0x494c1f],{'data1':members[_0x494c1f][_0xd3d8('0x26')]||_0x59a354[_0xd3d8('0xa')],'data2':members[_0x494c1f][_0xd3d8('0x9')]||_0x59a354[_0xd3d8('0x2a')],'data3':members[_0x494c1f][_0xd3d8('0x27')]||_0x59a354['destination'],'uniqueid':members[_0x494c1f]['uniqueid']||_0x59a354[_0xd3d8('0x7')]});if(members[_0x494c1f][_0xd3d8('0x1f')]){writeDB(members[_0x494c1f]);}}}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index a699cd0..dc0c9ee 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 _0xd21e=['connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','membername','agentcomplete','reason','transfer','TRANSFER','COMPLETEDBY','blindtransfer','transfereeuniqueid','transfertype','BLIND','transferexten','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','queuecallerenterreason','clone','calleridname','secondtransfereruniqueid','transfertargetlinkedid','transfertargetuniqueid','mohtime','error','stack','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','uniqueid','channel','queue','lastAssignedTo','calleridnum','queuecallerexitreason','then','type','request','CreateVoiceQueueReport','queuecallerjoin','position','hangup','isNil','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','now','COMPLETEDBYAGENT','transfereduniqueid','varset','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','queuecallerexitAt','toUpperCase','queueposition','EXITWITHKEY','queuecallerleave','holdtime','diffTime','queuecallerjoinAt','count'];(function(_0x3c5061,_0x56b8c8){var _0x28f9db=function(_0x4889de){while(--_0x4889de){_0x3c5061['push'](_0x3c5061['shift']());}};_0x28f9db(++_0x56b8c8);}(_0xd21e,0x1af));var _0xed21=function(_0x4246ef,_0x508804){_0x4246ef=_0x4246ef-0x0;var _0x20d87b=_0xd21e[_0x4246ef];return _0x20d87b;};'use strict';var _=require(_0xed21('0x0'));var util=require(_0xed21('0x1'));var utils=require(_0xed21('0x2'));var queues={};function writeDB(_0x26c786){utils[_0xed21('0x3')](util[_0xed21('0x4')](_0xed21('0x5'),_0x26c786[_0xed21('0x6')],_0x26c786[_0xed21('0x7')],_0x26c786[_0xed21('0x8')],_0x26c786[_0xed21('0x9')],_0x26c786[_0xed21('0xa')],_0x26c786['accountcode'],_0x26c786[_0xed21('0xb')]));if(_0x26c786['queue']){utils['getVoiceQueueByName'](_0x26c786[_0xed21('0x8')])[_0xed21('0xc')](function(_0x9f942a){if(_0x9f942a){_0x26c786[_0xed21('0xd')]=_0x9f942a[_0xed21('0xd')];}utils[_0xed21('0xe')](_0xed21('0xf'),_0x26c786);});}else{utils[_0xed21('0xe')](_0xed21('0xf'),_0x26c786);}if(_0x26c786['transfereduniqueid']){delete queues[_0x26c786['transfereduniqueid']];}else{delete queues[_0x26c786[_0xed21('0x6')]];}}exports[_0xed21('0x10')]=function(_0x1ec2c7){queues[_0x1ec2c7[_0xed21('0x6')]]=_['assign'](_0x1ec2c7,{'originalposition':_0x1ec2c7[_0xed21('0x11')],'queuecallerjoinAt':utils['now'](),'mohtime':0x0});};exports[_0xed21('0x12')]=function(_0x39fcb8){if(!_[_0xed21('0x13')](queues[_0x39fcb8[_0xed21('0x6')]])){if(queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x14')]){if(!queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x15')]&&!queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x16')]){queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x17')]=!![];queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x18')]=utils[_0xed21('0x19')]();queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0xb')]=_0xed21('0x1a');}writeDB(queues[_0x39fcb8[_0xed21('0x6')]]);}else{if(queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x1b')]){queues[queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x1b')]]=queues[_0x39fcb8['uniqueid']];queues[queues[_0x39fcb8[_0xed21('0x6')]][_0xed21('0x1b')]]['queuecallerenterreason']=0x2;delete queues[_0x39fcb8['uniqueid']];}}}};exports[_0xed21('0x1c')]=function(_0x42e0af){if(!_[_0xed21('0x13')](_0x42e0af[_0xed21('0x1d')][_0xed21('0x1e')])&&_0x42e0af[_0xed21('0x1f')]['toUpperCase']()!==_0xed21('0x20')){if(!_[_0xed21('0x13')](queues[_0x42e0af[_0xed21('0x6')]])){queues[_0x42e0af[_0xed21('0x6')]]['queuecallerabandon']=![];queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0x21')]=null;queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0x16')]=!![];queues[_0x42e0af['uniqueid']][_0xed21('0x22')]=utils[_0xed21('0x19')]();queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0xb')]=_0x42e0af[_0xed21('0x1f')][_0xed21('0x23')]();writeDB(queues[_0x42e0af[_0xed21('0x6')]]);}}else if(!_[_0xed21('0x13')](_0x42e0af[_0xed21('0x1d')][_0xed21('0x24')])){if(!_['isNil'](queues[_0x42e0af[_0xed21('0x6')]])&&!queues[_0x42e0af['uniqueid']][_0xed21('0x15')]){queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0x15')]=![];queues[_0x42e0af[_0xed21('0x6')]]['queuecallerabandonAt']=null;queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0x16')]=!![];queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0x22')]=utils[_0xed21('0x19')]();queues[_0x42e0af[_0xed21('0x6')]][_0xed21('0xb')]=_0xed21('0x25');}}};exports[_0xed21('0x15')]=function(_0x321829){if(!_[_0xed21('0x13')](queues[_0x321829[_0xed21('0x6')]])){queues[_0x321829[_0xed21('0x6')]][_0xed21('0x16')]=![];queues[_0x321829[_0xed21('0x6')]][_0xed21('0x22')]=null;queues[_0x321829[_0xed21('0x6')]]['queuecallerabandon']=!![];queues[_0x321829[_0xed21('0x6')]][_0xed21('0x21')]=utils[_0xed21('0x19')]();queues[_0x321829[_0xed21('0x6')]][_0xed21('0xb')]='ABANDONED';}};exports['queuecallerleave']=function(_0x4be7cb){if(!_[_0xed21('0x13')](queues[_0x4be7cb['uniqueid']])){queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x26')]=!![];queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x14')]=utils[_0xed21('0x19')]();queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x27')]=utils[_0xed21('0x28')](queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x14')],queues[_0x4be7cb['uniqueid']][_0xed21('0x29')]);queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x11')]=_0x4be7cb[_0xed21('0x11')];queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x2a')]=_0x4be7cb[_0xed21('0x2a')];queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x2b')]=_0x4be7cb['connectedlinenum'];queues[_0x4be7cb[_0xed21('0x6')]][_0xed21('0x2c')]=_0x4be7cb[_0xed21('0x2c')];}};exports[_0xed21('0x2d')]=function(_0x55ec02){if(!_[_0xed21('0x13')](queues[_0x55ec02[_0xed21('0x6')]])){queues[_0x55ec02[_0xed21('0x6')]]['queuecallerabandon']=![];queues[_0x55ec02[_0xed21('0x6')]][_0xed21('0x15')]=![];queues[_0x55ec02[_0xed21('0x6')]][_0xed21('0x21')]=null;queues[_0x55ec02['uniqueid']][_0xed21('0x16')]=![];queues[_0x55ec02[_0xed21('0x6')]][_0xed21('0xb')]=null;queues[_0x55ec02[_0xed21('0x6')]]['queuecallerexitAt']=null;queues[_0x55ec02[_0xed21('0x6')]][_0xed21('0x2e')]=!![];queues[_0x55ec02[_0xed21('0x6')]][_0xed21('0x2f')]=_0x55ec02['destaccountcode'];queues[_0x55ec02['uniqueid']][_0xed21('0x9')]=_0x55ec02[_0xed21('0x30')];}};exports[_0xed21('0x31')]=function(_0x11f68a){if(!_['isNil'](queues[_0x11f68a[_0xed21('0x6')]])){if(queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x14')]){queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x15')]=![];queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x15')]=![];queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x21')]=null;queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x16')]=![];queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x22')]=null;queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x2e')]=!![];queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x9')]=_0x11f68a[_0xed21('0x30')];queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x17')]=!![];queues[_0x11f68a[_0xed21('0x6')]]['queuecallercompleteAt']=utils[_0xed21('0x19')]();if(_0x11f68a[_0xed21('0x32')]==_0xed21('0x33')){if(!queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0x33')]){queues[_0x11f68a['uniqueid']][_0xed21('0xb')]=_0xed21('0x34');}}else{queues[_0x11f68a[_0xed21('0x6')]][_0xed21('0xb')]=_0xed21('0x35')+_0x11f68a['reason'][_0xed21('0x23')]();}writeDB(queues[_0x11f68a[_0xed21('0x6')]]);}}};exports[_0xed21('0x36')]=function(_0x22d1cd){if(!_[_0xed21('0x13')](queues[_0x22d1cd['transfereeuniqueid']])){queues[_0x22d1cd[_0xed21('0x37')]]['transfer']=!![];queues[_0x22d1cd['transfereeuniqueid']][_0xed21('0x38')]=_0xed21('0x39');queues[_0x22d1cd[_0xed21('0x37')]][_0xed21('0x3a')]=_0x22d1cd['extension'];queues[_0x22d1cd[_0xed21('0x37')]][_0xed21('0x3b')]=_0x22d1cd[_0xed21('0x37')];queues[_0x22d1cd[_0xed21('0x37')]][_0xed21('0xb')]=_0xed21('0x3c');}};exports['attendedtransfer']=function(_0x4f2722){try{if(_0x4f2722[_0xed21('0x3d')]==_0x4f2722[_0xed21('0x3e')]){if(!_[_0xed21('0x13')](queues[_0x4f2722['secondtransfererlinkedid']])){queues[_0x4f2722[_0xed21('0x3f')]]['transfer']=!![];queues[_0x4f2722[_0xed21('0x3f')]][_0xed21('0x38')]=_0xed21('0x40');queues[_0x4f2722[_0xed21('0x3f')]]['transferexten']=_0x4f2722[_0xed21('0x41')];queues[_0x4f2722[_0xed21('0x3f')]][_0xed21('0x3b')]=_0x4f2722[_0xed21('0x3d')];queues[_0x4f2722[_0xed21('0x3f')]][_0xed21('0xb')]=_0xed21('0x42');}if(!_[_0xed21('0x13')](queues[_0x4f2722['origtransfererlinkedid']])){if(_0x4f2722[_0xed21('0x43')]&&queues[_0x4f2722[_0xed21('0x43')]]){queues[_0x4f2722[_0xed21('0x43')]][_0xed21('0x44')]=0x1;queues[_0x4f2722[_0xed21('0x37')]]=_[_0xed21('0x45')](queues[_0x4f2722[_0xed21('0x43')]]);queues[_0x4f2722['transfereeuniqueid']][_0xed21('0x1b')]=_0x4f2722['transfertargetuniqueid'];queues[_0x4f2722[_0xed21('0x37')]]['queuecallerenterreason']=0x2;queues[_0x4f2722[_0xed21('0x37')]][_0xed21('0xa')]=queues[_0x4f2722[_0xed21('0x3f')]]['calleridnum'];queues[_0x4f2722[_0xed21('0x37')]][_0xed21('0x46')]=queues[_0x4f2722[_0xed21('0x3f')]]['calleridname'];queues[_0x4f2722[_0xed21('0x37')]]['queuecallerjoinAt']=utils[_0xed21('0x19')]();queues[_0x4f2722['transfereeuniqueid']][_0xed21('0x14')]=utils[_0xed21('0x19')]();queues[_0x4f2722['transfereeuniqueid']][_0xed21('0x27')]=0x0;queues[_0x4f2722[_0xed21('0x37')]]['mohtime']=0x0;}else{queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0x1b')]=_0x4f2722['secondtransfererlinkedid'];}}}else if(_0x4f2722[_0xed21('0x47')]==_0x4f2722[_0xed21('0x3f')]){if(!_[_0xed21('0x13')](queues[_0x4f2722[_0xed21('0x3e')]])){queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0x33')]=!![];queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0x38')]=_0xed21('0x40');queues[_0x4f2722['origtransfererlinkedid']][_0xed21('0x3a')]=_0x4f2722['secondtransfererexten'];queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0x3b')]=_0x4f2722['secondtransfereruniqueid'];queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0xb')]=_0xed21('0x42');}if(!_[_0xed21('0x13')](queues[_0x4f2722['secondtransfererlinkedid']])){if(_0x4f2722[_0xed21('0x48')]&&queues[_0x4f2722['transfertargetlinkedid']]){queues[_0x4f2722[_0xed21('0x48')]][_0xed21('0x44')]=0x1;queues[_0x4f2722['transfertargetuniqueid']]=_[_0xed21('0x45')](queues[_0x4f2722[_0xed21('0x48')]]);queues[_0x4f2722['transfertargetuniqueid']]['transfereduniqueid']=_0x4f2722['transfertargetuniqueid'];queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0x44')]=0x2;queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0xa')]=queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0xa')];queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0x46')]=queues[_0x4f2722[_0xed21('0x3e')]][_0xed21('0x46')];queues[_0x4f2722['transfertargetuniqueid']][_0xed21('0x29')]=utils[_0xed21('0x19')]();queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0x14')]=utils['now']();queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0x27')]=0x0;queues[_0x4f2722[_0xed21('0x49')]][_0xed21('0x4a')]=0x0;}else{queues[_0x4f2722[_0xed21('0x3f')]][_0xed21('0x1b')]=_0x4f2722[_0xed21('0x3e')];}}}}catch(_0x15ebe0){utils[_0xed21('0x4b')](_0x15ebe0[_0xed21('0x4c')]);}};exports['musiconholdstart']=function(_0x2db454){if(!_['isNil'](queues[_0x2db454[_0xed21('0x6')]])){queues[_0x2db454[_0xed21('0x6')]][_0xed21('0x4d')]=utils[_0xed21('0x19')]();}};exports[_0xed21('0x4e')]=function(_0x4aa5e6){if(!_[_0xed21('0x13')](queues[_0x4aa5e6[_0xed21('0x6')]])){if(!_['isNil'](queues[_0x4aa5e6[_0xed21('0x6')]][_0xed21('0x4d')])){queues[_0x4aa5e6[_0xed21('0x6')]]['mohtime']+=utils[_0xed21('0x28')](utils[_0xed21('0x19')](),queues[_0x4aa5e6[_0xed21('0x6')]][_0xed21('0x4d')]);delete queues[_0x4aa5e6[_0xed21('0x6')]][_0xed21('0x4d')];}}}; \ No newline at end of file +var _0x9976=['reason','transfer','blindtransfer','transfereeuniqueid','transfertype','transferexten','transferuniqueid','BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','mohtime','secondtransfereruniqueid','transfertargetlinkedid','calleridnum','error','stack','musiconholdstart','musiconholdstartAt','musiconholdstop','lodash','util','./utils','info','format','QUEUE|%s|%s|%s|%s|%s|%s|%s','channel','queue','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','uniqueid','assign','now','hangup','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercomplete','queuecallercompleteAt','queuecallerenterreason','varset','isNil','variable','queuestatus','value','toUpperCase','queueposition','EXITWITHKEY','queuecallerexitAt','queuecallerabandonAt','ABANDONED','holdtime','diffTime','queuecallerjoinAt','position','count','connectedlinenum','connectedlinename','agentconnect','assigned','accountcode','destaccountcode','lastAssignedTo','membername','agentcomplete'];(function(_0x35426c,_0x1d18c8){var _0x334f90=function(_0x5077e0){while(--_0x5077e0){_0x35426c['push'](_0x35426c['shift']());}};_0x334f90(++_0x1d18c8);}(_0x9976,0x153));var _0x6997=function(_0x1c5848,_0x424af2){_0x1c5848=_0x1c5848-0x0;var _0x209dc2=_0x9976[_0x1c5848];return _0x209dc2;};'use strict';var _=require(_0x6997('0x0'));var util=require(_0x6997('0x1'));var utils=require(_0x6997('0x2'));var queues={};function writeDB(_0x283def){utils[_0x6997('0x3')](util[_0x6997('0x4')](_0x6997('0x5'),_0x283def['uniqueid'],_0x283def[_0x6997('0x6')],_0x283def[_0x6997('0x7')],_0x283def['lastAssignedTo'],_0x283def['calleridnum'],_0x283def['accountcode'],_0x283def[_0x6997('0x8')]));if(_0x283def[_0x6997('0x7')]){utils[_0x6997('0x9')](_0x283def[_0x6997('0x7')])[_0x6997('0xa')](function(_0x58c7ed){if(_0x58c7ed){_0x283def['type']=_0x58c7ed[_0x6997('0xb')];}utils[_0x6997('0xc')](_0x6997('0xd'),_0x283def);});}else{utils['request']('CreateVoiceQueueReport',_0x283def);}if(_0x283def[_0x6997('0xe')]){delete queues[_0x283def['transfereduniqueid']];}else{delete queues[_0x283def['uniqueid']];}}exports[_0x6997('0xf')]=function(_0x37323f){queues[_0x37323f[_0x6997('0x10')]]=_[_0x6997('0x11')](_0x37323f,{'originalposition':_0x37323f['position'],'queuecallerjoinAt':utils[_0x6997('0x12')](),'mohtime':0x0});};exports[_0x6997('0x13')]=function(_0x5e6ca9){if(!_['isNil'](queues[_0x5e6ca9[_0x6997('0x10')]])){if(queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0x14')]){if(!queues[_0x5e6ca9['uniqueid']][_0x6997('0x15')]&&!queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0x16')]){queues[_0x5e6ca9['uniqueid']][_0x6997('0x17')]=!![];queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0x18')]=utils[_0x6997('0x12')]();queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0x8')]='COMPLETEDBYAGENT';}writeDB(queues[_0x5e6ca9[_0x6997('0x10')]]);}else{if(queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0xe')]){queues[queues[_0x5e6ca9[_0x6997('0x10')]][_0x6997('0xe')]]=queues[_0x5e6ca9[_0x6997('0x10')]];queues[queues[_0x5e6ca9['uniqueid']][_0x6997('0xe')]][_0x6997('0x19')]=0x2;delete queues[_0x5e6ca9[_0x6997('0x10')]];}}}};exports[_0x6997('0x1a')]=function(_0xe96f6a){if(!_[_0x6997('0x1b')](_0xe96f6a[_0x6997('0x1c')][_0x6997('0x1d')])&&_0xe96f6a[_0x6997('0x1e')][_0x6997('0x1f')]()!=='CONTINUE'){if(!_[_0x6997('0x1b')](queues[_0xe96f6a[_0x6997('0x10')]])){queues[_0xe96f6a[_0x6997('0x10')]][_0x6997('0x15')]=![];queues[_0xe96f6a['uniqueid']]['queuecallerabandonAt']=null;queues[_0xe96f6a['uniqueid']]['queuecallerexit']=!![];queues[_0xe96f6a[_0x6997('0x10')]]['queuecallerexitAt']=utils[_0x6997('0x12')]();queues[_0xe96f6a['uniqueid']][_0x6997('0x8')]=_0xe96f6a[_0x6997('0x1e')][_0x6997('0x1f')]();writeDB(queues[_0xe96f6a[_0x6997('0x10')]]);}}else if(!_[_0x6997('0x1b')](_0xe96f6a[_0x6997('0x1c')][_0x6997('0x20')])){if(!_[_0x6997('0x1b')](queues[_0xe96f6a['uniqueid']])&&!queues[_0xe96f6a['uniqueid']][_0x6997('0x15')]){queues[_0xe96f6a[_0x6997('0x10')]][_0x6997('0x15')]=![];queues[_0xe96f6a['uniqueid']]['queuecallerabandonAt']=null;queues[_0xe96f6a[_0x6997('0x10')]][_0x6997('0x16')]=!![];queues[_0xe96f6a[_0x6997('0x10')]]['queuecallerexitAt']=utils[_0x6997('0x12')]();queues[_0xe96f6a[_0x6997('0x10')]][_0x6997('0x8')]=_0x6997('0x21');}}};exports[_0x6997('0x15')]=function(_0x54467e){if(!_[_0x6997('0x1b')](queues[_0x54467e['uniqueid']])){queues[_0x54467e[_0x6997('0x10')]][_0x6997('0x16')]=![];queues[_0x54467e[_0x6997('0x10')]][_0x6997('0x22')]=null;queues[_0x54467e['uniqueid']]['queuecallerabandon']=!![];queues[_0x54467e['uniqueid']][_0x6997('0x23')]=utils[_0x6997('0x12')]();queues[_0x54467e[_0x6997('0x10')]][_0x6997('0x8')]=_0x6997('0x24');}};exports['queuecallerleave']=function(_0x508eca){if(!_[_0x6997('0x1b')](queues[_0x508eca[_0x6997('0x10')]])){queues[_0x508eca[_0x6997('0x10')]]['queuecallerleave']=!![];queues[_0x508eca[_0x6997('0x10')]]['queuecallerleaveAt']=utils[_0x6997('0x12')]();queues[_0x508eca['uniqueid']][_0x6997('0x25')]=utils[_0x6997('0x26')](queues[_0x508eca[_0x6997('0x10')]][_0x6997('0x14')],queues[_0x508eca[_0x6997('0x10')]][_0x6997('0x27')]);queues[_0x508eca[_0x6997('0x10')]][_0x6997('0x28')]=_0x508eca[_0x6997('0x28')];queues[_0x508eca[_0x6997('0x10')]][_0x6997('0x29')]=_0x508eca['count'];queues[_0x508eca['uniqueid']][_0x6997('0x2a')]=_0x508eca[_0x6997('0x2a')];queues[_0x508eca['uniqueid']][_0x6997('0x2b')]=_0x508eca[_0x6997('0x2b')];}};exports[_0x6997('0x2c')]=function(_0x15a56e){if(!_[_0x6997('0x1b')](queues[_0x15a56e[_0x6997('0x10')]])){queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x15')]=![];queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x15')]=![];queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x23')]=null;queues[_0x15a56e[_0x6997('0x10')]]['queuecallerexit']=![];queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x8')]=null;queues[_0x15a56e[_0x6997('0x10')]]['queuecallerexitAt']=null;queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x2d')]=!![];queues[_0x15a56e['uniqueid']][_0x6997('0x2e')]=_0x15a56e[_0x6997('0x2f')];queues[_0x15a56e[_0x6997('0x10')]][_0x6997('0x30')]=_0x15a56e[_0x6997('0x31')];}};exports[_0x6997('0x32')]=function(_0x478271){if(!_[_0x6997('0x1b')](queues[_0x478271[_0x6997('0x10')]])){if(queues[_0x478271[_0x6997('0x10')]][_0x6997('0x14')]){queues[_0x478271['uniqueid']][_0x6997('0x15')]=![];queues[_0x478271[_0x6997('0x10')]][_0x6997('0x15')]=![];queues[_0x478271[_0x6997('0x10')]][_0x6997('0x23')]=null;queues[_0x478271['uniqueid']][_0x6997('0x16')]=![];queues[_0x478271['uniqueid']][_0x6997('0x22')]=null;queues[_0x478271[_0x6997('0x10')]][_0x6997('0x2d')]=!![];queues[_0x478271[_0x6997('0x10')]][_0x6997('0x30')]=_0x478271[_0x6997('0x31')];queues[_0x478271['uniqueid']][_0x6997('0x17')]=!![];queues[_0x478271[_0x6997('0x10')]][_0x6997('0x18')]=utils[_0x6997('0x12')]();if(_0x478271[_0x6997('0x33')]==_0x6997('0x34')){if(!queues[_0x478271['uniqueid']]['transfer']){queues[_0x478271['uniqueid']][_0x6997('0x8')]='TRANSFER';}}else{queues[_0x478271[_0x6997('0x10')]][_0x6997('0x8')]='COMPLETEDBY'+_0x478271[_0x6997('0x33')][_0x6997('0x1f')]();}writeDB(queues[_0x478271[_0x6997('0x10')]]);}}};exports[_0x6997('0x35')]=function(_0x47298f){if(!_[_0x6997('0x1b')](queues[_0x47298f[_0x6997('0x36')]])){queues[_0x47298f[_0x6997('0x36')]][_0x6997('0x34')]=!![];queues[_0x47298f[_0x6997('0x36')]][_0x6997('0x37')]='BLIND';queues[_0x47298f[_0x6997('0x36')]][_0x6997('0x38')]=_0x47298f['extension'];queues[_0x47298f[_0x6997('0x36')]][_0x6997('0x39')]=_0x47298f[_0x6997('0x36')];queues[_0x47298f[_0x6997('0x36')]][_0x6997('0x8')]=_0x6997('0x3a');}};exports[_0x6997('0x3b')]=function(_0x361634){try{if(_0x361634[_0x6997('0x3c')]==_0x361634[_0x6997('0x3d')]){if(!_[_0x6997('0x1b')](queues[_0x361634[_0x6997('0x3e')]])){queues[_0x361634['secondtransfererlinkedid']]['transfer']=!![];queues[_0x361634[_0x6997('0x3e')]]['transfertype']=_0x6997('0x3f');queues[_0x361634[_0x6997('0x3e')]][_0x6997('0x38')]=_0x361634['origtransfererexten'];queues[_0x361634[_0x6997('0x3e')]][_0x6997('0x39')]=_0x361634[_0x6997('0x3c')];queues[_0x361634[_0x6997('0x3e')]]['queuecallerexitreason']=_0x6997('0x40');}if(!_[_0x6997('0x1b')](queues[_0x361634[_0x6997('0x3d')]])){if(_0x361634[_0x6997('0x41')]&&queues[_0x361634[_0x6997('0x41')]]){queues[_0x361634[_0x6997('0x41')]][_0x6997('0x19')]=0x1;queues[_0x361634[_0x6997('0x36')]]=_[_0x6997('0x42')](queues[_0x361634[_0x6997('0x41')]]);queues[_0x361634[_0x6997('0x36')]]['transfereduniqueid']=_0x361634[_0x6997('0x43')];queues[_0x361634['transfereeuniqueid']][_0x6997('0x19')]=0x2;queues[_0x361634['transfereeuniqueid']]['calleridnum']=queues[_0x361634[_0x6997('0x3e')]]['calleridnum'];queues[_0x361634[_0x6997('0x36')]][_0x6997('0x44')]=queues[_0x361634[_0x6997('0x3e')]]['calleridname'];queues[_0x361634[_0x6997('0x36')]][_0x6997('0x27')]=utils[_0x6997('0x12')]();queues[_0x361634['transfereeuniqueid']][_0x6997('0x14')]=utils['now']();queues[_0x361634[_0x6997('0x36')]][_0x6997('0x25')]=0x0;queues[_0x361634[_0x6997('0x36')]][_0x6997('0x45')]=0x0;}else{queues[_0x361634[_0x6997('0x3d')]][_0x6997('0xe')]=_0x361634['secondtransfererlinkedid'];}}}else if(_0x361634[_0x6997('0x46')]==_0x361634['secondtransfererlinkedid']){if(!_[_0x6997('0x1b')](queues[_0x361634[_0x6997('0x3d')]])){queues[_0x361634[_0x6997('0x3d')]]['transfer']=!![];queues[_0x361634[_0x6997('0x3d')]][_0x6997('0x37')]='ATTENDED';queues[_0x361634[_0x6997('0x3d')]][_0x6997('0x38')]=_0x361634['secondtransfererexten'];queues[_0x361634[_0x6997('0x3d')]]['transferuniqueid']=_0x361634[_0x6997('0x46')];queues[_0x361634[_0x6997('0x3d')]][_0x6997('0x8')]=_0x6997('0x40');}if(!_['isNil'](queues[_0x361634[_0x6997('0x3e')]])){if(_0x361634[_0x6997('0x47')]&&queues[_0x361634[_0x6997('0x47')]]){queues[_0x361634[_0x6997('0x47')]]['queuecallerenterreason']=0x1;queues[_0x361634[_0x6997('0x43')]]=_[_0x6997('0x42')](queues[_0x361634[_0x6997('0x47')]]);queues[_0x361634[_0x6997('0x43')]][_0x6997('0xe')]=_0x361634[_0x6997('0x43')];queues[_0x361634[_0x6997('0x43')]]['queuecallerenterreason']=0x2;queues[_0x361634[_0x6997('0x43')]][_0x6997('0x48')]=queues[_0x361634[_0x6997('0x3d')]][_0x6997('0x48')];queues[_0x361634['transfertargetuniqueid']]['calleridname']=queues[_0x361634['origtransfererlinkedid']][_0x6997('0x44')];queues[_0x361634['transfertargetuniqueid']][_0x6997('0x27')]=utils['now']();queues[_0x361634[_0x6997('0x43')]][_0x6997('0x14')]=utils[_0x6997('0x12')]();queues[_0x361634['transfertargetuniqueid']][_0x6997('0x25')]=0x0;queues[_0x361634[_0x6997('0x43')]][_0x6997('0x45')]=0x0;}else{queues[_0x361634[_0x6997('0x3e')]][_0x6997('0xe')]=_0x361634[_0x6997('0x3d')];}}}}catch(_0x4e6406){utils[_0x6997('0x49')](_0x4e6406[_0x6997('0x4a')]);}};exports[_0x6997('0x4b')]=function(_0x5829ca){if(!_[_0x6997('0x1b')](queues[_0x5829ca[_0x6997('0x10')]])){queues[_0x5829ca['uniqueid']][_0x6997('0x4c')]=utils['now']();}};exports[_0x6997('0x4d')]=function(_0x57e873){if(!_[_0x6997('0x1b')](queues[_0x57e873[_0x6997('0x10')]])){if(!_[_0x6997('0x1b')](queues[_0x57e873[_0x6997('0x10')]][_0x6997('0x4c')])){queues[_0x57e873[_0x6997('0x10')]][_0x6997('0x45')]+=utils[_0x6997('0x26')](utils['now'](),queues[_0x57e873['uniqueid']][_0x6997('0x4c')]);delete queues[_0x57e873[_0x6997('0x10')]][_0x6997('0x4c')];}}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index 35d4fdd..76991f4 100644 --- a/server/services/xdr/recordings.controller.js +++ b/server/services/xdr/recordings.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['CreateVoiceRecording','newchannel','uniqueid','linkedid','exten','context','channel','error','isNil','channelstate','stack','varset','variable','value','.WAV','find','monitors','hangup','calleridname','connectedlinenum','connectedlinename','forEach','clone','newexten','application','toLowerCase','startsWith','appdata','cdr','split','substring','lastIndexOf','queuecallerjoin','queue','lodash','./utils','accountcode','getUserByInternal','then','membername','name','UserId','request'];(function(_0x2141a7,_0x9e2391){var _0x5add5b=function(_0x282302){while(--_0x282302){_0x2141a7['push'](_0x2141a7['shift']());}};_0x5add5b(++_0x9e2391);}(_0xe706,0xa3));var _0x6e70=function(_0x2ae444,_0x5e9881){_0x2ae444=_0x2ae444-0x0;var _0x4d8790=_0xe706[_0x2ae444];return _0x4d8790;};'use strict';var _=require(_0x6e70('0x0'));var utils=require(_0x6e70('0x1'));var recordings={};function writeDB(_0x311951){utils['debug'](_0x311951);if(_0x311951[_0x6e70('0x2')]){utils[_0x6e70('0x3')](_0x311951[_0x6e70('0x2')])[_0x6e70('0x4')](function(_0x142c27){if(_0x142c27){_0x311951[_0x6e70('0x5')]=_0x142c27[_0x6e70('0x6')];_0x311951[_0x6e70('0x7')]=_0x142c27['id'];}utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);});}else{utils[_0x6e70('0x8')](_0x6e70('0x9'),_0x311951);}}exports[_0x6e70('0xa')]=function(_0x188ed3){try{if(_0x188ed3[_0x6e70('0xb')]==_0x188ed3[_0x6e70('0xc')]){recordings[_0x188ed3[_0x6e70('0xb')]]={'uniqueid':_0x188ed3[_0x6e70('0xb')],'accountcode':_0x188ed3[_0x6e70('0x2')],'exten':_0x188ed3[_0x6e70('0xd')],'context':_0x188ed3[_0x6e70('0xe')],'channel':_0x188ed3[_0x6e70('0xf')],'monitors':[]};}}catch(_0x37b3e0){utils[_0x6e70('0x10')](_0x37b3e0['stack']);}};exports['newstate']=function(_0x3594c1){try{if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xb')]])&&_0x3594c1[_0x6e70('0x12')]==0x6){}else if(!_[_0x6e70('0x11')](recordings[_0x3594c1[_0x6e70('0xc')]])&&_0x3594c1[_0x6e70('0x12')]==0x6&&_0x3594c1[_0x6e70('0xe')]!='transfer'){recordings[_0x3594c1['linkedid']]['accountcode']=_0x3594c1[_0x6e70('0x2')];}}catch(_0x5a37a6){utils['error'](_0x5a37a6[_0x6e70('0x13')]);}};exports[_0x6e70('0x14')]=function(_0x5d9263){try{if(!_[_0x6e70('0x11')](_0x5d9263['variable'])&&!_[_0x6e70('0x11')](_0x5d9263[_0x6e70('0x15')]['mixmonitor_filename'])){if(_['endsWith'](_0x5d9263[_0x6e70('0x16')],'.wav49')){_0x5d9263[_0x6e70('0x16')]=_0x5d9263[_0x6e70('0x16')]['replace']('.wav49',_0x6e70('0x17'));}if(recordings[_0x5d9263[_0x6e70('0xc')]]){var _0x2368eb=_[_0x6e70('0x18')](recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')],{'value':_0x5d9263[_0x6e70('0x16')]});if(_[_0x6e70('0x11')](_0x2368eb)){recordings[_0x5d9263[_0x6e70('0xc')]][_0x6e70('0x19')]['push']({'value':_0x5d9263[_0x6e70('0x16')]});}}}}catch(_0x344b65){utils[_0x6e70('0x10')](_0x344b65['stack']);}};exports[_0x6e70('0x1a')]=function(_0xa5d49){try{if(!_[_0x6e70('0x11')](recordings[_0xa5d49['uniqueid']])){recordings[_0xa5d49[_0x6e70('0xb')]]['calleridnum']=_0xa5d49['calleridnum'];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1b')]=_0xa5d49[_0x6e70('0x1b')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1c')]=_0xa5d49[_0x6e70('0x1c')];recordings[_0xa5d49['uniqueid']][_0x6e70('0x1d')]=_0xa5d49[_0x6e70('0x1d')];if(recordings[_0xa5d49[_0x6e70('0xb')]]['type']=='outbound'&&recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x2')]){recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1c')]=recordings[_0xa5d49[_0x6e70('0xb')]]['accountcode'];recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x1d')]='';}recordings[_0xa5d49[_0x6e70('0xb')]][_0x6e70('0x19')][_0x6e70('0x1e')](_0x20a225=>{var _0x3f78d2=_[_0x6e70('0x1f')](recordings[_0xa5d49[_0x6e70('0xb')]]);_0x3f78d2[_0x6e70('0x16')]=_0x20a225['value'];writeDB(_0x3f78d2);});delete recordings[_0xa5d49[_0x6e70('0xb')]];}}catch(_0x50d60b){utils[_0x6e70('0x10')](_0x50d60b['stack']);}};exports[_0x6e70('0x20')]=function(_0x2722e8){try{if(!_[_0x6e70('0x11')](recordings[_0x2722e8['uniqueid']])){if(_0x2722e8[_0x6e70('0x21')][_0x6e70('0x22')]()=='set'&&_[_0x6e70('0x23')](_0x2722e8[_0x6e70('0x24')]['toLowerCase'](),_0x6e70('0x25'))){var _0x3665a1=_0x2722e8[_0x6e70('0x24')][_0x6e70('0x26')]('=');var _0x3b4a13=_0x3665a1[0x0][_0x6e70('0x27')](_0x3665a1[0x0][_0x6e70('0x28')]('(')+0x1,_0x3665a1[0x0][_0x6e70('0x28')](')'));var _0xf146fd=_0x3665a1[0x1];recordings[_0x2722e8[_0x6e70('0xb')]][_0x3b4a13]=_0xf146fd;}}}catch(_0x4d32d8){utils[_0x6e70('0x10')](_0x4d32d8['stack']);}};exports[_0x6e70('0x29')]=function(_0x3222a2){try{if(!_[_0x6e70('0x11')](recordings[_0x3222a2[_0x6e70('0xb')]])){recordings[_0x3222a2[_0x6e70('0xb')]][_0x6e70('0x2a')]=_0x3222a2[_0x6e70('0x2a')];}}catch(_0xdd0bee){utils[_0x6e70('0x10')](_0xdd0bee[_0x6e70('0x13')]);}}; \ No newline at end of file +var _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(_0x2760be,_0x510af5){var _0x3a118d=function(_0x1aeb91){while(--_0x1aeb91){_0x2760be['push'](_0x2760be['shift']());}};_0x3a118d(++_0x510af5);}(_0x9c44,0x178));var _0x49c4=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9c44[_0x167cc1];return _0x10bc4b;};'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 f98a182..047a119 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 _0x430e=['stack','attendedtransfer','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','isNil','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','util','./utils','info','format','TRANSFER|%s','type','CreateVoiceTransferReport','blindtransfer','error'];(function(_0x4b0409,_0x166de9){var _0x46e574=function(_0x481705){while(--_0x481705){_0x4b0409['push'](_0x4b0409['shift']());}};_0x46e574(++_0x166de9);}(_0x430e,0x105));var _0xe430=function(_0x34882f,_0x601a99){_0x34882f=_0x34882f-0x0;var _0x455929=_0x430e[_0x34882f];return _0x455929;};'use strict';var _=require('lodash');var util=require(_0xe430('0x0'));var utils=require(_0xe430('0x1'));function writeDB(_0x4eaa9b){utils[_0xe430('0x2')](util[_0xe430('0x3')](_0xe430('0x4'),_0x4eaa9b[_0xe430('0x5')]));utils['request'](_0xe430('0x6'),_0x4eaa9b);}exports[_0xe430('0x7')]=function(_0x41376b){try{_0x41376b[_0xe430('0x5')]='blind';writeDB(_0x41376b);}catch(_0x1d2365){utils[_0xe430('0x8')](_0x1d2365[_0xe430('0x9')]);}};exports[_0xe430('0xa')]=function(_0xc558e2){try{_0xc558e2=_['assign'](_0xc558e2,{'transfererchannel':_0xc558e2[_0xe430('0xb')],'transferercalleridnum':_0xc558e2[_0xe430('0xc')],'transferercalleridname':_0xc558e2[_0xe430('0xd')],'transfererconnectedlinenum':_0xc558e2[_0xe430('0xe')],'transfererconnectedlinename':_0xc558e2[_0xe430('0xf')],'transfereraccountcode':_0xc558e2['origtransfereraccountcode'],'transferercontext':_0xc558e2[_0xe430('0x10')],'transfererexten':_0xc558e2[_0xe430('0x11')],'transfererlinkedid':_0xc558e2[_0xe430('0x12')],'context':_0xc558e2[_0xe430('0x13')],'extension':_0xc558e2[_0xe430('0x14')],'type':'attended'});if(_[_0xe430('0x15')](_0xc558e2['transfereechannel'])){_0xc558e2=_['assign'](_0xc558e2,{'transfereechannel':_0xc558e2[_0xe430('0x16')],'transfereecalleridnum':_0xc558e2[_0xe430('0x17')],'transfereecalleridname':_0xc558e2[_0xe430('0x18')],'transfereeconnectedlinenum':_0xc558e2[_0xe430('0x19')],'transfereeconnectedlinename':_0xc558e2[_0xe430('0x1a')],'transfereeaccountcode':_0xc558e2[_0xe430('0x1b')],'transfereecontext':_0xc558e2[_0xe430('0x1c')],'transfereeexten':_0xc558e2['transfertargetexten'],'transfereelinkedid':_0xc558e2[_0xe430('0x1d')]});}writeDB(_0xc558e2);}catch(_0xe36466){utils[_0xe430('0x8')](_0xe36466[_0xe430('0x9')]);}}; \ No newline at end of file +var _0x769c=['lodash','./utils','TRANSFER|%s','type','request','CreateVoiceTransferReport','error','stack','attendedtransfer','assign','origtransfererchannel','origtransferercalleridnum','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','attended','isNil','transfereechannel','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetlinkedid'];(function(_0x5527b4,_0x4a920c){var _0x1040ad=function(_0x2389b7){while(--_0x2389b7){_0x5527b4['push'](_0x5527b4['shift']());}};_0x1040ad(++_0x4a920c);}(_0x769c,0x96));var _0xc769=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x769c[_0x4a9fb1];return _0x348672;};'use strict';var _=require(_0xc769('0x0'));var util=require('util');var utils=require(_0xc769('0x1'));function writeDB(_0x463db3){utils['info'](util['format'](_0xc769('0x2'),_0x463db3[_0xc769('0x3')]));utils[_0xc769('0x4')](_0xc769('0x5'),_0x463db3);}exports['blindtransfer']=function(_0x4b5ec){try{_0x4b5ec[_0xc769('0x3')]='blind';writeDB(_0x4b5ec);}catch(_0x4ad2f6){utils[_0xc769('0x6')](_0x4ad2f6[_0xc769('0x7')]);}};exports[_0xc769('0x8')]=function(_0x2b4951){try{_0x2b4951=_[_0xc769('0x9')](_0x2b4951,{'transfererchannel':_0x2b4951[_0xc769('0xa')],'transferercalleridnum':_0x2b4951[_0xc769('0xb')],'transferercalleridname':_0x2b4951['origtransferercalleridname'],'transfererconnectedlinenum':_0x2b4951['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x2b4951['secondtransfererconnectedlinename'],'transfereraccountcode':_0x2b4951[_0xc769('0xc')],'transferercontext':_0x2b4951[_0xc769('0xd')],'transfererexten':_0x2b4951[_0xc769('0xe')],'transfererlinkedid':_0x2b4951['origtransfererlinkedid'],'context':_0x2b4951[_0xc769('0xf')],'extension':_0x2b4951['origtransfererexten'],'type':_0xc769('0x10')});if(_[_0xc769('0x11')](_0x2b4951[_0xc769('0x12')])){_0x2b4951=_[_0xc769('0x9')](_0x2b4951,{'transfereechannel':_0x2b4951[_0xc769('0x13')],'transfereecalleridnum':_0x2b4951[_0xc769('0x14')],'transfereecalleridname':_0x2b4951[_0xc769('0x15')],'transfereeconnectedlinenum':_0x2b4951[_0xc769('0x16')],'transfereeconnectedlinename':_0x2b4951[_0xc769('0x17')],'transfereeaccountcode':_0x2b4951['transfertargetaccountcode'],'transfereecontext':_0x2b4951['transfertargetcontext'],'transfereeexten':_0x2b4951['transfertargetexten'],'transfereelinkedid':_0x2b4951[_0xc769('0x18')]});}writeDB(_0x2b4951);}catch(_0x585081){utils[_0xc769('0x6')](_0x585081[_0xc769('0x7')]);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 40f8833..adb7b28 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 _0xf3a0=['now','isAfter','isBefore','moment','bluebird','http','xdr','info','debug','stringify','error','stack','request','then','catch','GetUser','GETUSER|','result','length','FOUND','NOTFOUND','getUserByInterface','getUserByName','getVoiceQueueByName','GetVoiceQueue','name','type','acwTimeout','GETVOICEQUEUEBYNAME|','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','diffTime'];(function(_0x4b717a,_0x1d5cd9){var _0x2ed05c=function(_0x2dc85a){while(--_0x2dc85a){_0x4b717a['push'](_0x4b717a['shift']());}};_0x2ed05c(++_0x1d5cd9);}(_0xf3a0,0x161));var _0x0f3a=function(_0x4346c4,_0x53ac29){_0x4346c4=_0x4346c4-0x0;var _0x304289=_0xf3a0[_0x4346c4];return _0x304289;};'use strict';var jayson=require('jayson/promise');var moment=require(_0x0f3a('0x0'));var BPromise=require(_0x0f3a('0x1'));var client=jayson['client'][_0x0f3a('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0x0f3a('0x3'));exports[_0x0f3a('0x4')]=function(_0x159b5b){logger[_0x0f3a('0x4')](_0x159b5b);};exports[_0x0f3a('0x5')]=function(_0x335184){logger[_0x0f3a('0x5')](JSON[_0x0f3a('0x6')](_0x335184));};exports[_0x0f3a('0x7')]=function(_0x441b2c){logger[_0x0f3a('0x7')](_0x441b2c[_0x0f3a('0x8')]);};exports[_0x0f3a('0x9')]=function(_0x5eaeaf,_0xb730b8){return client[_0x0f3a('0x9')](_0x5eaeaf,{'body':_0xb730b8})[_0x0f3a('0xa')](function(_0x37d9e2){logger['debug'](JSON['stringify'](_0x37d9e2));})[_0x0f3a('0xb')](function(_0x3c8c6a){logger[_0x0f3a('0x7')](_0x3c8c6a[_0x0f3a('0x8')]);});};function getUser(_0x15fe3e){return client['request'](_0x0f3a('0xc'),{'options':{'raw':!![],'attributes':['id','internal','name','interface'],'where':_0x15fe3e,'limit':0x1}})[_0x0f3a('0xa')](function(_0x2736b4){logger[_0x0f3a('0x4')](_0x0f3a('0xd')+JSON[_0x0f3a('0x6')](_0x15fe3e)+'|'+(_0x2736b4[_0x0f3a('0xe')][_0x0f3a('0xf')]?_0x0f3a('0x10'):_0x0f3a('0x11')));return _0x2736b4[_0x0f3a('0xe')]['length']?_0x2736b4['result'][0x0]:null;});}exports['getUserByInternal']=function(_0x28b26a){return new BPromise(function(_0x58fd0c,_0x5a8617){if(_0x28b26a){return getUser({'internal':_0x28b26a})[_0x0f3a('0xa')](function(_0x161675){return _0x58fd0c(_0x161675);})['catch'](function(_0x27eb76){logger[_0x0f3a('0x7')](_0x27eb76[_0x0f3a('0x8')]);return _0x58fd0c(null);});}else{return _0x58fd0c(null);}});};exports[_0x0f3a('0x12')]=function(_0x4133eb){return new BPromise(function(_0x17786c,_0x3dae42){if(_0x4133eb){return getUser({'interface':_0x4133eb})['then'](function(_0x4f5e59){return _0x17786c(_0x4f5e59);})[_0x0f3a('0xb')](function(_0x538156){logger[_0x0f3a('0x7')](_0x538156[_0x0f3a('0x8')]);return _0x17786c(null);});}else{return _0x17786c(null);}});};exports[_0x0f3a('0x13')]=function(_0x35916d){return new BPromise(function(_0x463282,_0x1a0f61){if(_0x35916d){return getUser({'name':_0x35916d})[_0x0f3a('0xa')](function(_0x46e36c){return _0x463282(_0x46e36c);})[_0x0f3a('0xb')](function(_0x46e087){logger[_0x0f3a('0x7')](_0x46e087[_0x0f3a('0x8')]);return _0x463282(null);});}else{return _0x463282(null);}});};exports[_0x0f3a('0x14')]=function(_0x16e597){return new BPromise(function(_0x22081c,_0x5d3db8){if(_0x16e597){return client['request'](_0x0f3a('0x15'),{'options':{'raw':!![],'attributes':['id',_0x0f3a('0x16'),_0x0f3a('0x17'),'acw',_0x0f3a('0x18')],'where':{'name':_0x16e597},'limit':0x1}})['then'](function(_0x559056){logger[_0x0f3a('0x4')](_0x0f3a('0x19')+_0x16e597+'|'+(_0x559056[_0x0f3a('0xe')][_0x0f3a('0xf')]?_0x0f3a('0x10'):_0x0f3a('0x11')));return _0x22081c(_0x559056[_0x0f3a('0xe')][_0x0f3a('0xf')]?_0x559056[_0x0f3a('0xe')][0x0]:null);})[_0x0f3a('0xb')](function(_0x3d3b45){logger[_0x0f3a('0x7')](_0x3d3b45['stack']);return _0x22081c(null);});}else{return _0x22081c(null);}});};exports['addTime']=function(_0x344a99,_0x3d5a05){return moment(_0x344a99)[_0x0f3a('0x1a')](_0x3d5a05,_0x0f3a('0x1b'))[_0x0f3a('0x1c')](_0x0f3a('0x1d'));};exports[_0x0f3a('0x1e')]=function(_0x4236ec,_0x4a14b3){return moment(_0x4236ec)['subtract'](_0x4a14b3,_0x0f3a('0x1b'))[_0x0f3a('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x0f3a('0x1f')]=function(_0x2ddbad,_0x2c72fe){return moment(_0x2ddbad)['diff'](moment(_0x2c72fe),_0x0f3a('0x1b'));};exports['sumTime']=function(_0x451453,_0x127a8e){return parseInt(_0x451453,0xa)+parseInt(_0x127a8e,0xa);};exports[_0x0f3a('0x20')]=function(){return moment()[_0x0f3a('0x1c')](_0x0f3a('0x1d'));};exports[_0x0f3a('0x21')]=function(_0x27e298,_0x83c8db){if(_0x83c8db){return moment(_0x27e298)[_0x0f3a('0x21')](_0x83c8db);}else{return!![];}};exports[_0x0f3a('0x22')]=function(_0x18c7dc,_0x5e397f){if(_0x5e397f){return moment(_0x18c7dc)[_0x0f3a('0x22')](_0x5e397f);}else if(_0x18c7dc){return!![];}else{return![];}}; \ No newline at end of file +var _0x96ff=['add','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','seconds','diffTime','diff','sumTime','now','isAfter','isBefore','jayson/promise','bluebird','http','xdr','info','debug','stringify','error','stack','request','then','catch','internal','name','interface','GETUSER|','length','FOUND','result','getUserByName','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','GETVOICEQUEUEBYNAME|','NOTFOUND','addTime'];(function(_0x369776,_0xed2171){var _0x5d87c4=function(_0x1da74e){while(--_0x1da74e){_0x369776['push'](_0x369776['shift']());}};_0x5d87c4(++_0xed2171);}(_0x96ff,0x14c));var _0xf96f=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x96ff[_0x19950b];return _0x3c6b41;};'use strict';var jayson=require(_0xf96f('0x0'));var moment=require('moment');var BPromise=require(_0xf96f('0x1'));var client=jayson['client'][_0xf96f('0x2')]({'port':0x2329});var logger=require('../../config/logger')(_0xf96f('0x3'));exports[_0xf96f('0x4')]=function(_0x31ee5f){logger[_0xf96f('0x4')](_0x31ee5f);};exports[_0xf96f('0x5')]=function(_0x55aa17){logger['debug'](JSON[_0xf96f('0x6')](_0x55aa17));};exports['error']=function(_0x80b474){logger[_0xf96f('0x7')](_0x80b474[_0xf96f('0x8')]);};exports[_0xf96f('0x9')]=function(_0x412277,_0x1f3730){return client['request'](_0x412277,{'body':_0x1f3730})[_0xf96f('0xa')](function(_0xbc3f2f){logger[_0xf96f('0x5')](JSON['stringify'](_0xbc3f2f));})[_0xf96f('0xb')](function(_0x4f3721){logger[_0xf96f('0x7')](_0x4f3721[_0xf96f('0x8')]);});};function getUser(_0xabbaf4){return client[_0xf96f('0x9')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0xf96f('0xc'),_0xf96f('0xd'),_0xf96f('0xe')],'where':_0xabbaf4,'limit':0x1}})['then'](function(_0x4058ab){logger[_0xf96f('0x4')](_0xf96f('0xf')+JSON['stringify'](_0xabbaf4)+'|'+(_0x4058ab['result'][_0xf96f('0x10')]?_0xf96f('0x11'):'NOTFOUND'));return _0x4058ab[_0xf96f('0x12')]['length']?_0x4058ab[_0xf96f('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x3bf48a){return new BPromise(function(_0x244237,_0x5b87e0){if(_0x3bf48a){return getUser({'internal':_0x3bf48a})[_0xf96f('0xa')](function(_0x5dcf){return _0x244237(_0x5dcf);})[_0xf96f('0xb')](function(_0x5bc32e){logger[_0xf96f('0x7')](_0x5bc32e[_0xf96f('0x8')]);return _0x244237(null);});}else{return _0x244237(null);}});};exports['getUserByInterface']=function(_0x527dba){return new BPromise(function(_0x3f76d1,_0x2d3b97){if(_0x527dba){return getUser({'interface':_0x527dba})[_0xf96f('0xa')](function(_0x2a94fd){return _0x3f76d1(_0x2a94fd);})['catch'](function(_0x351ecf){logger[_0xf96f('0x7')](_0x351ecf[_0xf96f('0x8')]);return _0x3f76d1(null);});}else{return _0x3f76d1(null);}});};exports[_0xf96f('0x13')]=function(_0x1d0d60){return new BPromise(function(_0x568318,_0x209693){if(_0x1d0d60){return getUser({'name':_0x1d0d60})[_0xf96f('0xa')](function(_0x119210){return _0x568318(_0x119210);})[_0xf96f('0xb')](function(_0xbf9252){logger[_0xf96f('0x7')](_0xbf9252['stack']);return _0x568318(null);});}else{return _0x568318(null);}});};exports[_0xf96f('0x14')]=function(_0x28b56d){return new BPromise(function(_0x3daf76,_0x48d3ce){if(_0x28b56d){return client[_0xf96f('0x9')](_0xf96f('0x15'),{'options':{'raw':!![],'attributes':['id','name',_0xf96f('0x16'),_0xf96f('0x17'),_0xf96f('0x18')],'where':{'name':_0x28b56d},'limit':0x1}})['then'](function(_0x4c6c16){logger[_0xf96f('0x4')](_0xf96f('0x19')+_0x28b56d+'|'+(_0x4c6c16[_0xf96f('0x12')][_0xf96f('0x10')]?'FOUND':_0xf96f('0x1a')));return _0x3daf76(_0x4c6c16[_0xf96f('0x12')][_0xf96f('0x10')]?_0x4c6c16['result'][0x0]:null);})[_0xf96f('0xb')](function(_0x3b02c0){logger[_0xf96f('0x7')](_0x3b02c0[_0xf96f('0x8')]);return _0x3daf76(null);});}else{return _0x3daf76(null);}});};exports[_0xf96f('0x1b')]=function(_0x2f6285,_0x545957){return moment(_0x2f6285)[_0xf96f('0x1c')](_0x545957,'seconds')[_0xf96f('0x1d')](_0xf96f('0x1e'));};exports[_0xf96f('0x1f')]=function(_0x4ad661,_0x4abccc){return moment(_0x4ad661)[_0xf96f('0x20')](_0x4abccc,_0xf96f('0x21'))[_0xf96f('0x1d')](_0xf96f('0x1e'));};exports[_0xf96f('0x22')]=function(_0x3dd42d,_0x1d1b89){return moment(_0x3dd42d)[_0xf96f('0x23')](moment(_0x1d1b89),_0xf96f('0x21'));};exports[_0xf96f('0x24')]=function(_0x6212db,_0x5f1feb){return parseInt(_0x6212db,0xa)+parseInt(_0x5f1feb,0xa);};exports[_0xf96f('0x25')]=function(){return moment()[_0xf96f('0x1d')](_0xf96f('0x1e'));};exports[_0xf96f('0x26')]=function(_0x268e36,_0x47f4df){if(_0x47f4df){return moment(_0x268e36)[_0xf96f('0x26')](_0x47f4df);}else{return!![];}};exports[_0xf96f('0x27')]=function(_0x2698d0,_0x25ab86){if(_0x25ab86){return moment(_0x2698d0)[_0xf96f('0x27')](_0x25ab86);}else if(_0x2698d0){return!![];}else{return![];}}; \ No newline at end of file